@oonacode/win32-x64 0.3.275 → 0.3.276

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.
@@ -77,7 +77,7 @@ Error generating stack: `+e.message+`
77
77
 
78
78
  Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function ya(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:Sa(t,`input`,e.processors),output:Sa(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function ba(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return ba(r.element,n);if(r.type===`set`)return ba(r.valueType,n);if(r.type===`lazy`)return ba(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`)return ba(r.innerType,n);if(r.type===`intersection`)return ba(r.left,n)||ba(r.right,n);if(r.type===`record`||r.type===`map`)return ba(r.keyType,n)||ba(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:ba(r.in,n)||ba(r.out,n);if(r.type===`object`){for(let e in r.shape)if(ba(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(ba(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(ba(e,n))return!0;return!!(r.rest&&ba(r.rest,n))}return!1}var xa=(e,t={})=>n=>{let r=ga({...n,processors:t});return _a(e,r),va(r,e),ya(r,e)},Sa=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=ga({...i??{},target:a,io:t,processors:n});return _a(e,o),va(o,e),ya(o,e)},Ca={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},wa=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Ca[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Ta=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;i.type=typeof s==`string`&&s.includes(`int`)?`integer`:`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},Ea=(e,t,n,r)=>{n.type=`boolean`},Da=(e,t,n,r)=>{n.not={}},Oa=(e,t,n,r)=>{let i=e._zod.def,a=Qe(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},ka=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},Aa=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},ja=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Ma=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=_a(a.element,t,{...r,path:[...r.path,`items`]})},Na=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=_a(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=_a(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Pa=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>_a(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Fa=(e,t,n,r)=>{let i=e._zod.def,a=_a(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=_a(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},Ia=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=_a(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else(t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=_a(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=_a(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},La=(e,t,n,r)=>{let i=e._zod.def,a=_a(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Ra=(e,t,n,r)=>{let i=e._zod.def;_a(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},za=(e,t,n,r)=>{let i=e._zod.def;_a(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Ba=(e,t,n,r)=>{let i=e._zod.def;_a(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Va=(e,t,n,r)=>{let i=e._zod.def;_a(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},Ha=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;_a(o,t,r);let s=t.seen.get(e);s.ref=o},Ua=(e,t,n,r)=>{let i=e._zod.def;_a(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Wa=(e,t,n,r)=>{let i=e._zod.def;_a(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Ga=V(`ZodISODateTime`,(e,t)=>{dr.init(e,t),vo.init(e,t)});function Ka(e){return Li(Ga,e)}var qa=V(`ZodISODate`,(e,t)=>{fr.init(e,t),vo.init(e,t)});function Ja(e){return Ri(qa,e)}var Ya=V(`ZodISOTime`,(e,t)=>{pr.init(e,t),vo.init(e,t)});function Xa(e){return zi(Ya,e)}var Za=V(`ZodISODuration`,(e,t)=>{mr.init(e,t),vo.init(e,t)});function Qa(e){return Bi(Za,e)}var $a=V(`ZodError`,(e,t)=>{It.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>zt(e,t)},flatten:{value:t=>Rt(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,$e,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,$e,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),eo=Bt($a),to=Vt($a),no=Ht($a),ro=Wt($a),io=Kt($a),ao=qt($a),oo=Jt($a),so=Yt($a),co=Xt($a),lo=Zt($a),uo=Qt($a),fo=$t($a),po=new WeakMap;function mo(e,t,n){let r=Object.getPrototypeOf(e),i=po.get(r);if(i||(i=new Set,po.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}var ho=V(`ZodType`,(e,t)=>(Zn.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:Sa(e,`input`),output:Sa(e,`output`)}}),e.toJSONSchema=xa(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>eo(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>no(e,t,n),e.parseAsync=async(t,n)=>to(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>ro(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>io(e,t,n),e.decode=(t,n)=>ao(e,t,n),e.encodeAsync=async(t,n)=>oo(e,t,n),e.decodeAsync=async(t,n)=>so(e,t,n),e.safeEncode=(t,n)=>co(e,t,n),e.safeDecode=(t,n)=>lo(e,t,n),e.safeEncodeAsync=async(t,n)=>uo(e,t,n),e.safeDecodeAsync=async(t,n)=>fo(e,t,n),mo(e,`ZodType`,{check(...e){let t=this.def;return this.clone(st(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return _t(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(js(e,t))},superRefine(e,t){return this.check(Ms(e,t))},overwrite(e){return this.check(oa(e))},optional(){return ps(this)},exactOptional(){return hs(this)},nullable(){return _s(this)},nullish(){return ps(_s(this))},nonoptional(e){return Cs(this,e)},array(){return Yo(this)},or(e){return $o([this,e])},and(e){return rs(this,e)},transform(e){return Ds(this,ds(e))},default(e){return ys(this,e)},prefault(e){return xs(this,e)},catch(e){return Ts(this,e)},pipe(e){return Ds(this,e)},readonly(){return ks(this)},describe(e){let t=this.clone();return pi.add(t,{description:e}),t},meta(...e){if(e.length===0)return pi.get(this);let t=this.clone();return pi.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){return pi.get(e)?.description},configurable:!0}),e)),go=V(`_ZodString`,(e,t)=>{Qn.init(e,t),ho.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wa(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,mo(e,`_ZodString`,{regex(...e){return this.check(ea(...e))},includes(...e){return this.check(ra(...e))},startsWith(...e){return this.check(ia(...e))},endsWith(...e){return this.check(aa(...e))},min(...e){return this.check(Qi(...e))},max(...e){return this.check(Zi(...e))},length(...e){return this.check($i(...e))},nonempty(...e){return this.check(Qi(1,...e))},lowercase(e){return this.check(ta(e))},uppercase(e){return this.check(na(e))},trim(){return this.check(ca())},normalize(...e){return this.check(sa(...e))},toLowerCase(){return this.check(la())},toUpperCase(){return this.check(ua())},slugify(){return this.check(da())}})}),_o=V(`ZodString`,(e,t)=>{Qn.init(e,t),go.init(e,t),e.email=t=>e.check(hi(yo,t)),e.url=t=>e.check(xi(So,t)),e.jwt=t=>e.check(Ii(Lo,t)),e.emoji=t=>e.check(Si(Co,t)),e.guid=t=>e.check(gi(bo,t)),e.uuid=t=>e.check(_i(xo,t)),e.uuidv4=t=>e.check(vi(xo,t)),e.uuidv6=t=>e.check(yi(xo,t)),e.uuidv7=t=>e.check(bi(xo,t)),e.nanoid=t=>e.check(Ci(wo,t)),e.guid=t=>e.check(gi(bo,t)),e.cuid=t=>e.check(wi(To,t)),e.cuid2=t=>e.check(Ti(Eo,t)),e.ulid=t=>e.check(Ei(Do,t)),e.base64=t=>e.check(Ni(Po,t)),e.base64url=t=>e.check(Pi(Fo,t)),e.xid=t=>e.check(Di(Oo,t)),e.ksuid=t=>e.check(Oi(ko,t)),e.ipv4=t=>e.check(ki(Ao,t)),e.ipv6=t=>e.check(Ai(jo,t)),e.cidrv4=t=>e.check(ji(Mo,t)),e.cidrv6=t=>e.check(Mi(No,t)),e.e164=t=>e.check(Fi(Io,t)),e.datetime=t=>e.check(Ka(t)),e.date=t=>e.check(Ja(t)),e.time=t=>e.check(Xa(t)),e.duration=t=>e.check(Qa(t))});function H(e){return mi(_o,e)}var vo=V(`ZodStringFormat`,(e,t)=>{$n.init(e,t),go.init(e,t)}),yo=V(`ZodEmail`,(e,t)=>{nr.init(e,t),vo.init(e,t)}),bo=V(`ZodGUID`,(e,t)=>{er.init(e,t),vo.init(e,t)}),xo=V(`ZodUUID`,(e,t)=>{tr.init(e,t),vo.init(e,t)}),So=V(`ZodURL`,(e,t)=>{rr.init(e,t),vo.init(e,t)}),Co=V(`ZodEmoji`,(e,t)=>{ir.init(e,t),vo.init(e,t)}),wo=V(`ZodNanoID`,(e,t)=>{ar.init(e,t),vo.init(e,t)}),To=V(`ZodCUID`,(e,t)=>{or.init(e,t),vo.init(e,t)}),Eo=V(`ZodCUID2`,(e,t)=>{sr.init(e,t),vo.init(e,t)}),Do=V(`ZodULID`,(e,t)=>{cr.init(e,t),vo.init(e,t)}),Oo=V(`ZodXID`,(e,t)=>{lr.init(e,t),vo.init(e,t)}),ko=V(`ZodKSUID`,(e,t)=>{ur.init(e,t),vo.init(e,t)}),Ao=V(`ZodIPv4`,(e,t)=>{hr.init(e,t),vo.init(e,t)}),jo=V(`ZodIPv6`,(e,t)=>{gr.init(e,t),vo.init(e,t)}),Mo=V(`ZodCIDRv4`,(e,t)=>{_r.init(e,t),vo.init(e,t)}),No=V(`ZodCIDRv6`,(e,t)=>{vr.init(e,t),vo.init(e,t)}),Po=V(`ZodBase64`,(e,t)=>{br.init(e,t),vo.init(e,t)}),Fo=V(`ZodBase64URL`,(e,t)=>{Sr.init(e,t),vo.init(e,t)}),Io=V(`ZodE164`,(e,t)=>{Cr.init(e,t),vo.init(e,t)}),Lo=V(`ZodJWT`,(e,t)=>{Tr.init(e,t),vo.init(e,t)}),Ro=V(`ZodNumber`,(e,t)=>{Er.init(e,t),ho.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ta(e,t,n,r),mo(e,`ZodNumber`,{gt(e,t){return this.check(Ji(e,t))},gte(e,t){return this.check(Yi(e,t))},min(e,t){return this.check(Yi(e,t))},lt(e,t){return this.check(Ki(e,t))},lte(e,t){return this.check(qi(e,t))},max(e,t){return this.check(qi(e,t))},int(e){return this.check(Vo(e))},safe(e){return this.check(Vo(e))},positive(e){return this.check(Ji(0,e))},nonnegative(e){return this.check(Yi(0,e))},negative(e){return this.check(Ki(0,e))},nonpositive(e){return this.check(qi(0,e))},multipleOf(e,t){return this.check(Xi(e,t))},step(e,t){return this.check(Xi(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function zo(e){return Vi(Ro,e)}var Bo=V(`ZodNumberFormat`,(e,t)=>{Dr.init(e,t),Ro.init(e,t)});function Vo(e){return Hi(Bo,e)}var Ho=V(`ZodBoolean`,(e,t)=>{Or.init(e,t),ho.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ea(e,t,n,r)});function Uo(e){return Ui(Ho,e)}var Wo=V(`ZodUnknown`,(e,t)=>{kr.init(e,t),ho.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Go(){return Wi(Wo)}var Ko=V(`ZodNever`,(e,t)=>{Ar.init(e,t),ho.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Da(e,t,n,r)});function qo(e){return Gi(Ko,e)}var Jo=V(`ZodArray`,(e,t)=>{Mr.init(e,t),ho.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ma(e,t,n,r),e.element=t.element,mo(e,`ZodArray`,{min(e,t){return this.check(Qi(e,t))},nonempty(e){return this.check(Qi(1,e))},max(e,t){return this.check(Zi(e,t))},length(e,t){return this.check($i(e,t))},unwrap(){return this.element}})});function Yo(e,t){return fa(Jo,e,t)}var Xo=V(`ZodObject`,(e,t)=>{Lr.init(e,t),ho.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Na(e,t,n,r),at(e,`shape`,()=>t.shape),mo(e,`ZodObject`,{keyof(){return ss(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:Go()})},loose(){return this.clone({...this._zod.def,catchall:Go()})},strict(){return this.clone({...this._zod.def,catchall:qo()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return Ct(this,e)},safeExtend(e){return wt(this,e)},merge(e){return Tt(this,e)},pick(e){return xt(this,e)},omit(e){return St(this,e)},partial(...e){return Et(fs,this,e[0])},required(...e){return Dt(Ss,this,e[0])}})});function Zo(e,t){return new Xo({type:`object`,shape:e??{},...vt(t)})}var Qo=V(`ZodUnion`,(e,t)=>{zr.init(e,t),ho.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pa(e,t,n,r),e.options=t.options});function $o(e,t){return new Qo({type:`union`,options:e,...vt(t)})}var es=V(`ZodDiscriminatedUnion`,(e,t)=>{Qo.init(e,t),Br.init(e,t)});function ts(e,t,n){return new es({type:`union`,options:t,discriminator:e,...vt(n)})}var ns=V(`ZodIntersection`,(e,t)=>{Vr.init(e,t),ho.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fa(e,t,n,r)});function rs(e,t){return new ns({type:`intersection`,left:e,right:t})}var is=V(`ZodRecord`,(e,t)=>{Wr.init(e,t),ho.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ia(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function as(e,t,n){return!t||!t._zod?new is({type:`record`,keyType:H(),valueType:e,...vt(t)}):new is({type:`record`,keyType:e,valueType:t,...vt(n)})}var os=V(`ZodEnum`,(e,t)=>{Gr.init(e,t),ho.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oa(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new os({...t,checks:[],...vt(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new os({...t,checks:[],...vt(r),entries:i})}});function ss(e,t){return new os({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...vt(t)})}var cs=V(`ZodLiteral`,(e,t)=>{Kr.init(e,t),ho.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ka(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function ls(e,t){return new cs({type:`literal`,values:Array.isArray(e)?e:[e],...vt(t)})}var us=V(`ZodTransform`,(e,t)=>{qr.init(e,t),ho.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ja(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Ye(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Pt(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(Pt(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function ds(e){return new us({type:`transform`,transform:e})}var fs=V(`ZodOptional`,(e,t)=>{Yr.init(e,t),ho.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wa(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ps(e){return new fs({type:`optional`,innerType:e})}var ms=V(`ZodExactOptional`,(e,t)=>{Xr.init(e,t),ho.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wa(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function hs(e){return new ms({type:`optional`,innerType:e})}var gs=V(`ZodNullable`,(e,t)=>{Zr.init(e,t),ho.init(e,t),e._zod.processJSONSchema=(t,n,r)=>La(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function _s(e){return new gs({type:`nullable`,innerType:e})}var vs=V(`ZodDefault`,(e,t)=>{Qr.init(e,t),ho.init(e,t),e._zod.processJSONSchema=(t,n,r)=>za(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function ys(e,t){return new vs({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():mt(t)}})}var bs=V(`ZodPrefault`,(e,t)=>{ei.init(e,t),ho.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ba(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function xs(e,t){return new bs({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():mt(t)}})}var Ss=V(`ZodNonOptional`,(e,t)=>{ti.init(e,t),ho.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ra(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Cs(e,t){return new Ss({type:`nonoptional`,innerType:e,...vt(t)})}var ws=V(`ZodCatch`,(e,t)=>{ri.init(e,t),ho.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Va(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Ts(e,t){return new ws({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var Es=V(`ZodPipe`,(e,t)=>{ii.init(e,t),ho.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ha(e,t,n,r),e.in=t.in,e.out=t.out});function Ds(e,t){return new Es({type:`pipe`,in:e,out:t})}var Os=V(`ZodReadonly`,(e,t)=>{oi.init(e,t),ho.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ua(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ks(e){return new Os({type:`readonly`,innerType:e})}var As=V(`ZodCustom`,(e,t)=>{ci.init(e,t),ho.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Aa(e,t,n,r)});function js(e,t={}){return pa(As,e,t)}function Ms(e,t){return ma(e,t)}var Ns={artificial_analysis_intelligence_index:{label:`Intelligence index`,scale:`index`},artificial_analysis_coding_index:{label:`Coding index`,scale:`index`},artificial_analysis_math_index:{label:`Math index`,scale:`index`},gpqa:{label:`GPQA Diamond`,scale:`fraction`},hle:{label:`Humanity's Last Exam`,scale:`fraction`},lcr:{label:`Long-context reasoning`,scale:`fraction`},livecodebench:{label:`LiveCodeBench`,scale:`fraction`},scicode:{label:`SciCode`,scale:`fraction`},math_500:{label:`MATH-500`,scale:`fraction`},aime:{label:`AIME`,scale:`fraction`},aime_25:{label:`AIME 2025`,scale:`fraction`},ifbench:{label:`IFBench`,scale:`fraction`},mmlu_pro:{label:`MMLU Pro`,scale:`fraction`},tau2:{label:`τ²-bench (agentic)`,scale:`fraction`},tau_banking:{label:`τ-bench banking`,scale:`fraction`},terminalbench_hard:{label:`Terminal-Bench Hard`,scale:`fraction`},terminalbench_v2_1:{label:`Terminal-Bench 2.1`,scale:`fraction`}};function Ps(e){return(e.credentialVariants??[]).filter(e=>!e.operatorOnly)}function Fs(e){let t=new Set(e.map(e=>e.definition.id));return e.filter(e=>!e.definition.clientGroup||e.definition.clientGroup===e.definition.id||!t.has(e.definition.clientGroup))}function Is(e,t){return e.filter(e=>e.definition.id===t||e.definition.clientGroup===t&&e.definition.id!==t)}function Ls(e){return Fs(e).filter(e=>e.definition.enabled&&e.definition.credentialClass!==`none`&&e.definition.poolOnly!==!0&&T(e.definition.id)&&!D(e.definition.id))}function Rs(e){if(!e)return!1;try{let t=new URL(e).hostname.toLowerCase();return t===`127.0.0.1`||t===`localhost`||t===`::1`||t===`[::1]`}catch{return!1}}function zs(e,t={}){let n=e.displayName,r=t.credentialClass??e.credentialClass,i=t.baseUrl??e.baseUrl;return e.id===`oonacode`?{kind:`pool`,badge:`via OonaCode`,detail:`Runs on OonaCode's own provider accounts, through the OonaCode gateway. Priced models are billed to your account in credits; free models cost nothing on any plan.`,viaGateway:!0}:e.engine===`agy`?{kind:`subscription-direct`,badge:`agy · direct to Google`,detail:`Runs on Google’s own agy CLI on this PC, with your Google plan. Each request is recorded here and goes straight from this PC to Google — never through the OonaCode gateway, and OonaCode does not translate it.`,viaGateway:!1}:e.route===`direct`?{kind:`subscription-direct`,badge:`direct to provider`,detail:`Your ${n} subscription runs straight from this PC to the provider — it never passes through the OonaCode gateway.`,viaGateway:!1}:r===`api_key`&&e.kind!==`anthropic-passthrough`?{kind:`own-key-translated`,badge:`direct to provider`,detail:`Your ${n} key stays on this PC: OonaCode translates the request here and calls ${n} from this machine. The gateway sees neither the key nor the traffic.`,viaGateway:!1}:Rs(i)?{kind:`local-server`,badge:`on this machine`,detail:`Runs against ${n} on this machine (${i}) — the request never leaves the PC.`,viaGateway:!1}:r===`api_key`&&e.kind===`anthropic-passthrough`&&e.directCapable===!0?{kind:`own-key-direct`,badge:`direct to provider`,detail:`Your ${n} key runs straight from this PC to ${n} — the OonaCode gateway is not in the path.`,viaGateway:!1}:{kind:`gateway`,badge:`via OonaCode`,detail:`Routed to ${n} through the OonaCode gateway.`,viaGateway:!0}}var Bs=ts(`type`,[Zo({type:ls(`oauth-device`),deviceAuthorizationUrl:H().url(),tokenUrl:H().url(),clientId:H().min(1),scopes:Yo(H().min(1)).min(1),signInLabel:H().min(1).optional(),referrer:H().min(1).optional()}),Zo({type:ls(`openai-device`),deviceAuthorizationUrl:H().url(),pollUrl:H().url(),tokenUrl:H().url(),verificationUri:H().url(),redirectUri:H().url(),clientId:H().min(1),signInLabel:H().min(1).optional()})]),Vs=Zo({type:ls(`google-loopback`),authorizationUrl:H().url(),tokenUrl:H().url(),redirectUri:H().url(),scopes:Yo(H().min(1)).min(1),clientIdSetting:H().min(1),clientSecretSetting:H().min(1),userinfoUrl:H().url().optional(),signInLabel:H().min(1).optional()}),Hs=Zo({id:H().min(1),displayName:H().min(1),upstreamId:H().min(1).optional(),servedBy:Yo(H().min(1)).optional(),subscriptionServedBy:Yo(H().min(1)).optional(),contextWindow:zo().int().positive().optional(),maxOutputTokens:zo().int().positive().optional(),supportsTools:Uo().optional(),supportsThinking:Uo().optional(),effortLevels:Yo(ss(Ce)).optional(),defaultEffort:ss(Ce).optional(),helperModel:H().min(1).optional(),supportsVision:Uo().optional(),inputPricePerM:zo().nonnegative().optional(),outputPricePerM:zo().nonnegative().optional(),creditsPerM:Zo({input:zo().nonnegative(),output:zo().nonnegative(),maxInput:zo().nonnegative().optional(),maxOutput:zo().nonnegative().optional()}).optional(),notes:H().optional(),free:Uo().optional(),aaIntelligence:zo().optional(),aaCoding:zo().optional(),aaOutputTps:zo().optional(),aaTtft:zo().optional(),aa:Zo({fetchedAt:H(),creator:H().optional(),releaseDate:H().optional(),benchmarks:as(H(),zo()).optional()}).loose().optional()}).loose(),Us=Zo({id:H().regex(/^[a-z0-9][a-z0-9-]{1,40}$/,`provider id must be lowercase kebab-case`),displayName:H().min(1),kind:ss([`anthropic-passthrough`,`openai-compatible`,`gemini`]),route:ss([`gateway`,`direct`]),credentialClass:ss([`api_key`,`subscription`,`none`]),baseUrl:H().url(),messagesPath:H().startsWith(`/`).optional(),modelsPath:H().startsWith(`/`).optional(),auth:Zo({header:ss([`x-api-key`,`authorization-bearer`,`api-key`,`x-goog-api-key`,`none`]),extraHeaders:as(H(),H()).optional()}),models:Yo(Hs),defaultModel:H().min(1),modelAliases:as(H(),H()).optional(),helperModel:H().min(1).optional(),capabilities:Zo({streaming:Uo(),tools:Uo(),thinking:Uo(),vision:Uo(),countTokens:Uo(),promptCaching:Uo(),promptCacheTtlSec:zo().int().positive().optional()}),translate:Zo({maxTokensParam:ss([`max_tokens`,`max_completion_tokens`]).optional(),reasoningEffortFromBudget:Uo().optional(),reasoningContentField:H().nullable().optional(),supportsParallelToolCalls:Uo().optional(),systemRole:ss([`system`,`developer`]).optional(),streamIncludeUsage:Uo().optional(),wire:ss([`chat`,`responses`,`gemini-code-assist`]).optional()}).optional(),passthrough:Zo({stripCacheControl:Uo().optional(),cacheChain:Uo().optional(),toolSchemaRequiredArray:Uo().optional(),toolDescriptionRequired:Uo().optional(),keepOutputConfig:Uo().optional(),allowedBetas:Yo(H()).optional(),anthropicVersion:H().optional()}).optional(),userBaseUrl:Uo().optional(),engineEnv:as(H(),H()).optional(),directCapable:Uo().optional(),subscriptionLogin:Bs.optional(),museCliLogin:Zo({type:ls(`muse-cli`),signInLabel:H().min(1).optional()}).optional(),poolOnly:Uo().optional(),contributorMode:Zo({suffix:H().min(1),summary:H().min(1)}).optional(),phase:$o([ls(1),ls(2)]),enabled:Uo(),docsUrl:H().url().optional(),notes:H().optional(),references:Yo(Zo({label:H().min(1),url:H().url(),kind:ss([`docs`,`pricing`,`models`,`console`,`status`,`keys`,`signup`,`other`]).optional()})).optional(),keyFormat:H().optional(),credentialVariants:Yo(Zo({id:H().min(1),label:H().min(1),header:ss([`x-api-key`,`authorization-bearer`,`api-key`,`x-goog-api-key`,`none`]).optional(),extraHeaders:as(H(),H()).optional(),operatorOnly:Uo().optional(),requiresClaudeCodeIdentity:Uo().optional(),subscriptionLogin:Bs.optional(),loopbackLogin:Vs.optional(),agyLogin:Zo({type:ls(`agy-server`),signInLabel:H().optional()}).optional(),codexLogin:Zo({type:ls(`codex-server`),signInLabel:H().optional()}).optional(),museLogin:Zo({type:ls(`muse-server`),signInLabel:H().optional()}).optional(),claudeCodeShape:Zo({betas:H().min(1),userAgent:H().min(1),billingHeader:H().min(1),headers:as(H(),H()).optional()}).optional(),baseUrl:H().url().optional(),keyFormat:H().optional(),notes:H().optional()})).optional(),adminGroup:H().optional(),clientGroup:H().optional(),recordLabel:H().optional(),engine:ls(`agy`).optional(),effortLevels:Yo(ss(Ce)).optional(),defaultEffort:ss(Ce).optional()});Zo({version:zo().int().positive(),updatedAt:H(),providers:Yo(Us)});function Ws(e,t){return Gs(e,ec(e,t))}function Gs(e,t){return e.models.find(e=>e.id===t)?.upstreamId??t}function Ks(e){return/^claude-/i.test(e)}function qs(e){return/^claude-.+-\d{8}$/i.test(e)?e.replace(/-\d{8}$/,``):null}function Js(e){return e.replace(/\[1m\]$/i,``)}var Ys=new Set([`opus`,`sonnet`,`haiku`,`fable`]);function Xs(e){return Ys.has(e.toLowerCase())}function Zs(e,t){let n=Js(t);if(Xs(n)||e.models.some(e=>e.id===n))return null;let r=e.modelAliases;if(!r)return null;let i=qs(n);if(i!==null&&e.models.some(e=>e.id===i))return null;let a=r[n]??(i===null?void 0:r[i]);return a!==void 0&&e.models.some(e=>e.id===a)?a:null}function Qs(e,t){return{images:e.models.find(e=>e.id===t)?.supportsVision??e.capabilities.vision,documents:Ks(t)}}function $s(e,t,n){let r=Qs(e,t),i=e.engine===`agy`,a=new Set;for(let e of n){let t=e?.type;t===`image`&&(i||!r.images)&&a.add(`image`),t===`document`&&(i||!r.documents)&&a.add(`document`)}return a}function ec(e,t){if(!t)return e.defaultModel;if(e.models.some(e=>e.id===t))return t;let n=e.modelAliases?.[t];if(n)return n;let r=Zs(e,t);if(r)return r;let i=t.toLowerCase(),a=i.includes(`haiku`)?`haiku`:i.includes(`opus`)?`opus`:i.includes(`sonnet`)?`sonnet`:i.includes(`fable`)?`fable`:null;if(a){if(e.modelAliases?.[a])return e.modelAliases[a];let t=e.models.find(e=>e.id.toLowerCase().includes(a));if(t)return t.id}return e.defaultModel}var tc={messages:`/v1/messages`,countTokens:`/v1/messages/count_tokens`,models:`/v1/models`,providerMessages:e=>`/p/${e}/v1/messages`,providerCountTokens:e=>`/p/${e}/v1/messages/count_tokens`,providerModels:e=>`/p/${e}/v1/models`,voiceTranslation:`/v1/oonacode/voice-translation`,health:`/api/health`,streamCheck:`/api/stream-check`,register:`/api/auth/register`,login:`/api/auth/login`,refresh:`/api/auth/refresh`,logout:`/api/auth/logout`,me:`/api/auth/me`,prelogin:`/api/auth/prelogin`,tokens:`/api/me/tokens`,token:e=>`/api/me/tokens/${e}`,tokenPurge:e=>`/api/me/tokens/${e}/purge`,tokenSealed:e=>`/api/me/tokens/${e}/sealed`,tokenUsage:e=>`/api/me/tokens/${e}/usage`,providers:`/api/me/providers`,provider:e=>`/api/me/providers/${e}`,providerTest:e=>`/api/me/providers/${e}/test`,routing:`/api/me/routing`,usage:`/api/me/usage`,usageSession:e=>`/api/me/usage/sessions/${e}`,usageBreakdown:`/api/me/usage/breakdown`,devices:`/api/me/devices`,pushToken:`/api/me/push-token`,hostNotify:`/api/me/hosts/notify`,device:e=>`/api/me/devices/${e}`,hosts:`/api/me/hosts`,hostHeartbeat:`/api/me/hosts/heartbeat`,hostVaultUnlock:e=>`/api/me/hosts/${encodeURIComponent(e)}/vault-unlock`,host:e=>`/api/me/hosts/${encodeURIComponent(e)}`,vault:`/api/me/vault`,vaultEvents:`/api/me/vault/events`,registry:`/api/registry`,agentTools:`/api/agent-tools`,agentToolCalls:`/api/me/agent-tools/calls`,poolReleaseSession:`/api/me/pool/release-session`,poolAutoRoute:`/api/me/pool/auto-route`,releasesLatest:`/api/releases/latest`,releasesHistory:`/api/releases`,team:`/api/me/team`,teamInvites:`/api/me/team/invites`,teamInvite:e=>`/api/me/team/invites/${e}`,teamInviteLookup:`/api/team/invites/lookup`,teamInviteDecline:`/api/team/invites/decline`,teamJoin:`/api/me/team/join`,teamInvitations:`/api/me/team/invitations`,teamInvitationAccept:e=>`/api/me/team/invitations/${e}/accept`,teamInvitationDecline:e=>`/api/me/team/invitations/${e}/decline`,teamMember:e=>`/api/me/team/members/${e}`,teamLeave:`/api/me/team/leave`,teamTransfer:`/api/me/team/transfer`,teamAudit:`/api/me/team/audit`,teamCheckout:`/api/me/team/checkout`,teamTopup:`/api/me/team/topup`,teamSeats:`/api/me/team/seats`,googleConfig:`/api/auth/google/config`,googleStart:`/api/auth/google/start`,googleCallback:`/api/auth/google/callback`,githubConfig:`/api/auth/github/config`,githubStart:`/api/auth/github/start`,githubCallback:`/api/auth/github/callback`,googleUnlink:`/api/me/google`,telegramConfig:`/api/auth/telegram/config`,telegramAuth:`/api/auth/telegram`,telegram:`/api/me/telegram`,telegramWebhook:`/api/webhooks/telegram`,passphraseSetup:`/api/auth/passphrase/setup`,passphraseRekey:`/api/me/passphrase/rekey`,recovery:`/api/me/recovery`,recoveryChallenge:`/api/auth/recovery/challenge`,recoveryConsume:`/api/auth/recovery/consume`,deviceApprovals:`/api/me/device-approvals`,deviceApproval:e=>`/api/me/device-approvals/${e}`,deviceApprovalApprove:e=>`/api/me/device-approvals/${e}/approve`,deviceApprovalDeny:e=>`/api/me/device-approvals/${e}/deny`,passwordResetRequest:`/api/auth/password-reset/request`,passwordResetConfirm:`/api/auth/password-reset/confirm`,vaultRekeyComplete:`/api/me/vault/rekey-complete`,vaultRekeyPending:`/api/me/vault/rekey-pending`,emailVerifySend:`/api/auth/email/verify/send`,emailVerifyConfirm:`/api/auth/email/verify/confirm`,emailVerifyWatch:`/api/auth/email/verify/watch`,twoFactor:`/api/me/2fa`,twoFactorEnroll:`/api/me/2fa/enroll`,twoFactorConfirm:`/api/me/2fa/confirm`,twoFactorDisable:`/api/me/2fa/disable`,twoFactorDisableRequest:`/api/me/2fa/disable/request`,twoFactorRecoveryCodes:`/api/me/2fa/recovery-codes`,twoFactorVerify:`/api/auth/2fa/verify`,deviceLinkStart:`/api/auth/device/start`,deviceLinkPoll:`/api/auth/device/poll`,deviceLinks:`/api/me/device-links`,deviceLink:e=>`/api/me/device-links/${e}`,deviceLinkApprove:e=>`/api/me/device-links/${e}/approve`,deviceLinkDeny:e=>`/api/me/device-links/${e}/deny`,hostLogs:`/api/me/hosts/logs`,errorReport:`/api/me/errors`,bugReports:`/api/me/bug-reports`,plans:`/api/plans`,myPlan:`/api/me/plan`,checkout:`/api/me/plan/checkout`,creditsTopup:`/api/me/credits/topup`,billing:`/api/me/billing`},nc=2048,rc=16384,ic=8e3,ac=5242880,oc=12582912;new Set(`BCDFGHJKLMNPQRSTVWXZ`.split(``));var sc=`discard-my-vault-and-history`,cc=`Anyone who can use this device can use your saved provider keys without your passphrase. Turn this off on shared or public computers. You can revoke it any time from Devices.`,lc={notes:100,title:80,text:1e5,totalText:1e6},uc={name:120,instructions:2e4,goal:2e3,repositories:50,repositoryUrl:500,memory:2e4,minIntervalFloor:1,minIntervalCeiling:10080},dc=`⏰ Scheduled task "`;function fc(e){if(!e.startsWith(dc))return null;let t=e.indexOf(`"
79
79
 
80
- `,18);return t<0?null:{title:e.slice(18,t),prompt:e.slice(t+3)}}Object.freeze({tengu_amber_sentinel:!0,tengu_groovy_eclipse:!0,tengu_humble_hammock:!0});function pc(e){return e===null||!Number.isFinite(e)?`neutral`:e>30?`ok`:e>10?`warn`:`danger`}var mc=3e4,hc=1440,gc=6e4,_c=[`mon`,`tue`,`wed`,`thu`,`fri`,`sat`,`sun`],vc=/^([01]\d|2[0-3]):[0-5]\d$/;Zo({tz:H().min(1),windows:Yo(Zo({from:H().regex(vc,`HH:MM`),to:H().regex(vc,`HH:MM`),days:Yo(ss(_c)).optional(),kind:ss([`peak`,`offpeak`])})),offpeakDiscount:zo().nonnegative().max(1).optional()});var yc=[`priceInputCacheMissPeak`,`priceInputCacheMissOffpeak`,`priceInputCacheHitPeak`,`priceInputCacheHitOffpeak`,`priceCacheWritePeak`,`priceCacheWriteOffpeak`,`priceOutputPeak`,`priceOutputOffpeak`],bc=Zo({inputCacheMiss:zo().nonnegative(),inputCacheHit:zo().nonnegative().optional(),cacheWrite:zo().nonnegative().optional(),output:zo().nonnegative()});Zo({by:ls(`prompt_tokens`),tiers:Yo(Zo({upToPromptTokens:zo().int().positive().optional(),price:bc.optional(),cost:bc.optional()})).min(1),note:H().optional()}).superRefine((e,t)=>{let n=0;e.tiers.forEach((r,i)=>{!r.cost&&!r.price&&t.addIssue({code:`custom`,message:`a tier needs its cost (the provider’s rates; retail is cost × the record’s ratio)`,path:[`tiers`,i,`cost`]});let a=r.upToPromptTokens;if(a===void 0){i!==e.tiers.length-1&&t.addIssue({code:`custom`,message:`only the LAST tier may omit upToPromptTokens`,path:[`tiers`,i]});return}a<=n&&t.addIssue({code:`custom`,message:`tiers must ascend: ${a} does not exceed ${n}`,path:[`tiers`,i,`upToPromptTokens`]}),n=a})}),[...yc];var xc={realtime:`/v1/realtime`,translations:`/v1/realtime/translations`,live:`/v1/live/sessions`,speechStream:`/v1/audio/speech/stream`,transcriptionStream:`/v1/audio/transcriptions/stream`,clientSecrets:`/v1/realtime/client_secrets`,translationClientSecrets:`/v1/realtime/translations/client_secrets`};xc.realtime,xc.translations,xc.live,xc.speechStream,xc.transcriptionStream;var Sc=`M0.72 12a11.28 11.28 0 1 0 22.56 0a11.28 11.28 0 1 0 -22.56 0ZM4.8 12a7.2 7.2 0 1 0 14.4 0a7.2 7.2 0 1 0 -14.4 0ZM7.44 12a4.56 4.56 0 1 0 9.12 0a4.56 4.56 0 1 0 -9.12 0Z`,Cc=`M14.234 10.162 22.977 0h-2.072l-7.591 8.824L7.251 0H.258l9.168 13.343L.258 24H2.33l8.016-9.318L16.749 24h6.993zm-2.837 3.299-.929-1.329L3.076 1.56h3.182l5.965 8.532.929 1.329 7.754 11.09h-3.182z`,wc=`M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z`,Tc=`M11.04 19.32Q12 21.51 12 24q0-2.49.93-4.68.96-2.19 2.58-3.81t3.81-2.55Q21.51 12 24 12q-2.49 0-4.68-.93a12.3 12.3 0 0 1-3.81-2.58 12.3 12.3 0 0 1-2.58-3.81Q12 2.49 12 0q0 2.49-.96 4.68-.93 2.19-2.55 3.81a12.3 12.3 0 0 1-3.81 2.58Q2.49 12 0 12q2.49 0 4.68.96 2.19.93 3.81 2.55t2.55 3.81`,Ec={oonacode:{hex:`#000000`,owner:`OonaCode`,d:Sc,fillRule:`evenodd`},anthropic:{hex:`#D97757`,owner:`Anthropic`,d:`m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z`},"anthropic-subscription":{hex:`#D97757`,owner:`Anthropic`,d:`m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z`},openai:{hex:`#000000`,owner:`OpenAI`,d:wc},xai:{hex:`#000000`,owner:`xAI`,d:Cc},deepseek:{hex:`#5786FE`,owner:`DeepSeek`,d:`M23.748 4.651c-.254-.124-.364.113-.512.233-.051.04-.094.09-.137.137-.372.397-.806.657-1.373.626-.829-.046-1.537.214-2.163.848-.133-.782-.575-1.248-1.247-1.548-.352-.155-.708-.311-.955-.65-.172-.24-.219-.509-.305-.774-.055-.16-.11-.323-.293-.35-.2-.031-.278.136-.356.276-.313.572-.434 1.202-.422 1.84.027 1.436.633 2.58 1.838 3.393.137.094.172.187.129.323-.082.28-.18.553-.266.833-.055.179-.137.218-.328.14a5.5 5.5 0 0 1-1.737-1.179c-.857-.828-1.631-1.743-2.597-2.46a12 12 0 0 0-.689-.47c-.985-.957.13-1.743.387-1.836.27-.098.094-.433-.778-.428-.872.003-1.67.295-2.687.685a3 3 0 0 1-.465.136 9.6 9.6 0 0 0-2.883-.101c-1.885.21-3.39 1.1-4.497 2.622C.082 8.776-.231 10.854.152 13.02c.403 2.284 1.568 4.175 3.36 5.653 1.857 1.533 3.997 2.284 6.438 2.14 1.482-.085 3.132-.284 4.994-1.86.47.234.962.328 1.78.398.629.058 1.235-.031 1.705-.129.735-.155.684-.836.418-.961-2.155-1.004-1.682-.595-2.112-.926 1.095-1.295 2.768-3.598 3.284-6.733.05-.346.115-.834.108-1.114-.004-.171.035-.238.23-.257a4.2 4.2 0 0 0 1.545-.475c1.397-.763 1.96-2.016 2.093-3.517.02-.23-.004-.467-.247-.588M11.58 18.168c-2.088-1.642-3.101-2.183-3.52-2.16-.39.024-.32.472-.234.763.09.288.207.487.371.74.114.167.192.416-.113.603-.673.416-1.842-.14-1.897-.168-1.361-.801-2.5-1.86-3.301-3.306-.775-1.393-1.225-2.888-1.299-4.482-.02-.385.094-.522.477-.592a4.7 4.7 0 0 1 1.53-.038c2.131.311 3.946 1.264 5.467 2.774.868.86 1.525 1.887 2.202 2.89.72 1.066 1.494 2.082 2.48 2.915.348.291.626.513.892.677-.802.09-2.14.109-3.055-.615zm1.001-6.44a.306.306 0 0 1 .415-.287.3.3 0 0 1 .113.074.3.3 0 0 1 .086.214c0 .17-.136.307-.308.307a.303.303 0 0 1-.306-.307m3.11 1.596c-.2.081-.4.151-.591.16a1.25 1.25 0 0 1-.798-.254c-.274-.23-.47-.358-.551-.758a1.7 1.7 0 0 1 .015-.588c.07-.327-.007-.537-.238-.727-.188-.156-.426-.199-.689-.199a.6.6 0 0 1-.254-.078.253.253 0 0 1-.114-.358 1 1 0 0 1 .192-.21c.356-.202.767-.136 1.146.016.352.144.618.408 1.001.782.392.451.462.576.685.915.176.264.336.536.446.848.066.194-.02.353-.25.45`},kimi:{hex:`#000000`,owner:`Moonshot`,d:`M21.765.351C22.998.351 24 1.353 24 2.586S22.998 4.82 21.765 4.82h-1.974c-.15 0-.26-.12-.26-.26V2.586A2.237 2.237 0 0 1 21.765.35M9.41 13.388l8.447-8.377c.16-.16.07-.471-.14-.471h-4.55s-.1.02-.14.06l-9.099 9.029c-.14.14-.35.02-.35-.21V4.81c0-.15-.1-.27-.221-.27H.22c-.12 0-.22.12-.22.27v18.57c0 .15.1.27.22.27h3.137c.12 0 .22-.12.22-.27v-3.79c0-.08.03-.16.08-.21l2.826-2.796c.07-.07.16-.08.241-.03l7.546 5.551a8.9 8.9 0 0 0 4.018 1.493c.12.01.23-.11.23-.27V19.76c0-.14-.08-.25-.19-.26a5.8 5.8 0 0 1-2.355-.942l-6.533-4.73c-.14-.09-.15-.32-.03-.441`},qwen:{hex:`#6950EF`,owner:`Alibaba`,d:`M23.919 14.545 20.817 9.17l1.47-2.544a.56.56 0 0 0 0-.566l-1.633-2.83a.57.57 0 0 0-.49-.283h-6.207L12.487.402a.57.57 0 0 0-.49-.284H8.732a.56.56 0 0 0-.49.284L5.139 5.775h-2.94a.56.56 0 0 0-.49.284L.077 8.887a.56.56 0 0 0 0 .567L3.18 14.83l-1.47 2.545a.56.56 0 0 0 0 .566l1.634 2.83a.57.57 0 0 0 .49.283h6.205l1.47 2.545a.57.57 0 0 0 .49.284h3.266a.57.57 0 0 0 .49-.284l3.104-5.375h2.94a.57.57 0 0 0 .49-.283l1.634-2.828a.55.55 0 0 0-.004-.568M8.733.686l1.634 2.828-1.634 2.828H21.8L20.164 9.17H7.425L5.63 6.06Zm1.306 19.801-6.205-.002 1.634-2.83h3.265L2.201 6.344h3.267q3.182 5.517 6.367 11.032zm10.124-5.66L18.53 12l-6.532 11.315-1.634-2.83c2.129-3.673 4.25-7.351 6.373-11.028h3.592l3.102 5.374z`},"xai-subscription":{hex:`#000000`,owner:`xAI`,d:Cc},"openai-subscription":{hex:`#000000`,owner:`OpenAI`,d:wc},"openai-codex":{hex:`#000000`,owner:`OpenAI`,d:wc},"google-agy":{hex:`#8E75B2`,owner:`Google`,d:Tc},antigravity:{hex:`#8E75B2`,owner:`Google`,d:Tc},mimo:{hex:`#FF6900`,owner:`Xiaomi`,d:`M12 0C8.016 0 4.756.255 2.493 2.516.23 4.776 0 8.033 0 12.012c0 3.98.23 7.235 2.494 9.497C4.757 23.77 8.017 24 12 24c3.983 0 7.243-.23 9.506-2.491C23.77 19.247 24 15.99 24 12.012c0-3.984-.233-7.243-2.502-9.504C19.234.252 15.978 0 12 0zM4.906 7.405h5.624c1.47 0 3.007.068 3.764.827.746.746.827 2.233.83 3.676v4.54a.15.15 0 0 1-.152.147h-1.947a.15.15 0 0 1-.152-.148V11.83c-.002-.806-.048-1.634-.464-2.051-.358-.36-1.026-.441-1.72-.458H7.158a.15.15 0 0 0-.151.147v6.98a.15.15 0 0 1-.152.148H4.906a.15.15 0 0 1-.15-.148V7.554a.15.15 0 0 1 .15-.149zm12.131 0h1.949a.15.15 0 0 1 .15.15v8.892a.15.15 0 0 1-.15.148h-1.949a.15.15 0 0 1-.151-.148V7.554a.15.15 0 0 1 .151-.149zM8.92 10.948h2.046c.083 0 .15.066.15.147v5.352a.15.15 0 0 1-.15.148H8.92a.15.15 0 0 1-.152-.148v-5.352a.15.15 0 0 1 .152-.147Z`}};function Dc(e){return Ec[e]??null}function Oc(e){let t=e.replace(/\(.*?\)/g,` `).split(/[\s/_-]+/).filter(Boolean);return t.length===0?`?`:t.length===1?t[0].slice(0,2).toUpperCase():`${t[0][0]}${t[1][0]}`.toUpperCase()}var kc=9230,Ac=1024,jc=65534,Mc=`127.0.0.1`;Object.freeze({enabled:!1,port:kc,inspectMain:!1}),Object.freeze({port:null,listening:!1,fromCommandLine:!1,inspectPort:null,inspectProblem:null});function Nc(e){return e+1}function Pc(e){return typeof e==`number`&&Number.isInteger(e)}function Fc(e){return!Pc(e)||e<1024||e>65534?`The port must be a whole number from ${Ac.toLocaleString(`en-US`)} to ${jc.toLocaleString(`en-US`)} (the main-process inspector takes the next one).`:null}function Ic(e){return e.port!==null||e.inspectPort!==null}function Lc(e,t){let n=e.enabled?e.port:null,r=e.enabled&&e.inspectMain?Nc(e.port):null;return!t.fromCommandLine&&t.port!==n||t.inspectPort!==r}function Rc(e){let t=[];return e.port!==null&&t.push(`${Mc}:${e.port}`),e.inspectPort!==null&&t.push(`${Mc}:${e.inspectPort}`),t.length===2?`${t[0]} (windows) and ${t[1]} (main process)`:e.inspectPort===null?t[0]??``:`${t[0]} (main process)`}var zc=[`stable`,`dev`];function Bc(e){return typeof e==`string`&&zc.includes(e)}function Vc(e){if(typeof e!=`string`)return null;let t=e.trim().toLowerCase();return Bc(t)?t:null}var Hc=[`win32`,`linux`,`darwin`],Uc=[`x64`,`arm64`];function Wc(e,t){let n=Vc(e)??`stable`,r=[];return n!==`stable`&&r.push(`channel=${encodeURIComponent(n)}`),t&&Hc.includes(t.platform)&&(r.push(`platform=${t.platform}`),t.arch&&Uc.includes(t.arch)&&r.push(`arch=${t.arch}`)),r.length>0?`${tc.releasesLatest}?${r.join(`&`)}`:tc.releasesLatest}function Gc(e,t){let n=Vc(t)??`stable`;return n===`stable`?e:`${e} (${n})`}var Kc={safeguards:`safeguards`,safety_filters:`safety filters`},qc=[{vendor:`Alibaba (Model Studio / DashScope — Qwen, and the DeepSeek/GLM it hosts)`,seenAs:`400 {"error":{"code":"data_inspection_failed","message":"Input data may contain inappropriate content."}}`,pattern:/data[_ ]?inspection[_ ]?failed|may contain inappropriate content/i},{vendor:`Zhipu (GLM)`,seenAs:`400 {"error":{"code":"1301","message":"系统检测到输入或生成内容可能包含不安全或敏感内容…"}} (contentFilter)`,pattern:/"code"\s*:\s*"?1301"?|不安全或敏感内容|unsafe or sensitive content|contentFilter/i},{vendor:`DeepSeek`,seenAs:`400 {"error":{"message":"Content Exists Risk","type":"invalid_request_error"}}`,pattern:/content exists risk/i},{vendor:`Moonshot (Kimi)`,seenAs:`400 {"error":{"type":"content_filter","message":"The request was rejected because it was considered high risk"}}`,pattern:/"type"\s*:\s*"content_filter"|considered high risk/i},{vendor:`xAI (Grok)`,seenAs:`400 "Content violates usage guidelines. Failed check: SAFETY_CHECK_TYPE_…"`,pattern:/content violates usage guidelines|SAFETY_CHECK_TYPE_/i},{vendor:`OpenAI (and Azure-style filters)`,seenAs:`400 {"error":{"code":"content_filter" | "content_policy_violation" | "moderation_blocked"}}`,pattern:/"code"\s*:\s*"(?:content_filter|content_policy_violation|moderation_blocked)"/i},{vendor:`Google (Gemini)`,seenAs:`This request was blocked by Gemini's filters. They can occasionally trigger by mistake on safe coding, security, or biology-related queries.`,pattern:/blocked by Gemini(?:'s)? filters|Gemini(?:'s)? filters/i}],Jc=/blocked by (?:the )?(?:content[ -]safety|Gemini(?:'s)?) filters?|content safety filters?|blocked by Gemini(?:'s)? filters?/i,Yc=/blocked by Gemini(?:'s)? filters|Gemini(?:'s)? filters\.? They can occasionally trigger/i;function Xc(e){return typeof e==`string`&&Yc.test(e)}function Zc(e){return typeof e!=`string`||e===``||!/^\s*(?:Failed to authenticate\.\s*)?API Error\b/i.test(e)?null:qc.find(t=>t.pattern.test(e))??null}function Qc(e){return typeof e==`string`&&(Xc(e)||Jc.test(e)&&/blocked/i.test(e))}var $c=`:free`;function el(e){return e.endsWith($c)}function tl(e){return el(e)?e.slice(0,-5):e}var nl=`model_refusal_fallback`,rl=`model_refusal_no_fallback`;function il(e){return typeof e==`string`&&e.trim()!==``?e.trim():null}function al(e,t,n){return il(e[t])??il(e[n])}function ol(e){if(typeof e!=`object`||!e)return null;let t=e,n=t.subtype,r=n===`model_refusal_fallback`?`fallback`:n===`model_refusal_no_fallback`?`no_fallback`:t.kind===`fallback`||t.kind===`no_fallback`?t.kind:null;if(!r||t.type!==void 0&&t.type!==`system`)return null;let i=t.retracted_message_uuids??t.retractedMessageUuids??t.retractedUuids;return{kind:r,scope:t.scope===`local`?`local`:`session`,originalModel:al(t,`original_model`,`originalModel`),fallbackModel:r===`fallback`?al(t,`fallback_model`,`fallbackModel`):null,category:al(t,`api_refusal_category`,`apiRefusalCategory`)??il(t.category),explanation:al(t,`api_refusal_explanation`,`apiRefusalExplanation`)??il(t.explanation),text:typeof t.content==`string`?t.content.trim():il(t.text)??``,retractedUuids:Array.isArray(i)?i.filter(e=>typeof e==`string`):[]}}function sl(e,t){switch(t.type){case`notice`:return t.notice.kind!==`fallback`||t.notice.scope!==`session`?e:{notice:t.notice,at:t.at,live:t.live};case`engine_start`:case`model_change`:return null}}function cl(e,t){return!e||t.alive===!1||!e.live&&t.since!==null&&e.at!==null&&e.at<t.since?null:e}function ll(e){let t=Js(e.trim()),n=t.slice(t.lastIndexOf(`/`)+1),r=e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase(),i=n.split(`-`);if(i[0]?.toLowerCase()!==`claude`)return t;let a=i.slice(1).filter(e=>!/^\d{6,}$/.test(e)),o=a.filter(e=>!/^\d+$/.test(e)),s=a.filter(e=>/^\d+$/.test(e));return o.length!==1||s.length===0?t:`${r(o[0])} ${s.join(`.`)}`}function ul(e,t=[]){let n=Js(e.trim()),r=null;for(let e of t)for(let t of e.definition.models){if(t.id===n||Js(t.id)===n)return t.displayName;r===null&&(t.upstreamId===n||tl(t.id)===n)&&(r=t.displayName)}return r??ll(n)}function dl(e){return`${e} (safeguard)`}var fl=`none`,pl={mode:`auto`,model:null,perModel:{}};function ml(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0&&t.length<=200&&/^[A-Za-z0-9._:@/[\]-]+$/.test(t)?t:null}function hl(e){return Js(e.trim()).toLowerCase()}function gl(e){let t=typeof e==`object`&&e&&!Array.isArray(e)?e:{},n=ml(t.model),r=t.mode,i=r===`off`?`off`:r===`model`&&n!==null?`model`:`auto`,a={},o=t.perModel;if(typeof o==`object`&&o&&!Array.isArray(o))for(let[e,t]of Object.entries(o)){let n=ml(e),r=t===`none`?fl:ml(t);if(n!==null&&r!==null&&hl(n)!==hl(r)&&(a[hl(n)]=r,Object.keys(a).length>=64))break}return{mode:i,model:i===`model`?n:null,perModel:a}}function _l(e){return e===w}var vl=`oona settings safeguard-fallback auto`;function yl(e,t=[]){if(!e)return`the model`;let n=hl(e);return t.find(e=>hl(e.id)===n||e.upstreamId&&hl(e.upstreamId)===n)?.displayName??ll(e)}function bl(e,t=e=>yl(e)){let n=`blocked by ${Kc[e.reason]}`;if(e.outcome===`retried`)return`${n} → retried on ${e.retriedOn?t(e.retriedOn):`another model`}`;switch(e.blocked){case`off`:return`${n} · fallback off (${vl})`;case`no_model`:return`${n} · no fallback model`;case`unavailable`:return`${n} · fallback not available here`;case`refused_again`:return`${n} · fallback refused too`;case`not_retryable`:return`${n} · not retried`;default:return n}}var xl=5e4,Sl=6,Cl=[`sessions`,`search`,`files`],wl=[`media`,`sessionInfo`];function Tl(e){return typeof e==`string`&&Cl.includes(e)?e:null}function El(e){if(!Array.isArray(e))return null;let t=[];for(let n of e)typeof n==`string`&&wl.includes(n)&&!t.includes(n)&&t.push(n);return t}var Dl=[`bg`,`surface`,`surface-2`,`surface-3`,`border`,`fg`,`fg-muted`,`fg-faint`,`accent`,`accent-fg`,`accent-soft`,`project`,`ok`,`ok-soft`,`warn`,`warn-soft`,`danger`,`danger-soft`,`think`,`think-soft`,`code-bg`,`user-bubble`],Ol=/^[A-Za-z0-9 ,'"_-]+$/,kl=/^(?:[A-Za-z0-9 _-]+|'[A-Za-z0-9 _-]+'|"[A-Za-z0-9 _-]+")$/;function Al(e){let t=typeof e==`number`&&Number.isFinite(e)?Math.round(e):NaN;return Number.isFinite(t)?Math.min(28,Math.max(10,t)):null}function jl(e){if(typeof e!=`string`)return null;let t=e.trim().slice(0,160).trim();return t.length===0||!Ol.test(t)?null:t.split(`,`).every(e=>kl.test(e.trim()))?t:null}function Ml(e){let t=Ql(e);return{family:jl(t.family),size:Al(t.size)}}function Nl(e){let t=Ql(e);return{chat:Ml(t.chat),sidebar:Ml(t.sidebar)}}var Pl={agentFinished:!1,permissionRequired:!0,errorOccurred:!0},Fl={autoAcceptPermissions:!1,autosaveFiles:!1,safeguardFallback:pl,showReasoningSummaries:!0,notifications:Pl,showAgentPicker:!0,transcriptWindowSize:500,openTabs:[],draftTabs:[],draftTitles:{},activeTab:null,editorLayout:null,remoteTabs:{},sessionPanelOpen:!1,explorerOpen:!1,leftPanelSection:`sessions`,leftPanelOpen:!0,rightPanelSections:[],rightPanelCollapsed:[],sidebarWidth:288,sessionPanelWidth:288,mediaPanelWidth:320,rightPanelWidth:320,sidebarPinned:!0,dismissedUpdateVersion:null,lastSeenReleaseNotes:null,claudeImportOffered:!1,claudeImportOffers:0,collapsedProjects:[],themeColors:{light:{},dark:{}},fonts:{chat:{family:null,size:null},sidebar:{family:null,size:null}},pinned:[],sidebarView:`recent`};function Il(e){return Math.min(Math.max(typeof e==`number`&&Number.isFinite(e)?Math.floor(e):0,0),3)}function Ll(e){return Math.min(640,Math.max(200,typeof e==`number`&&Number.isFinite(e)?Math.round(e):288))}function Rl(e,t){return Math.min(720,Math.max(240,typeof e==`number`&&Number.isFinite(e)?Math.round(e):t))}function zl(e){return Math.min(xl,Math.max(100,typeof e==`number`&&Number.isFinite(e)?Math.round(e):500))}function Bl(e,t){return typeof e==`boolean`?e:t}function Vl(e){return typeof e==`string`&&e.length>0&&e.length<=64?e:null}function Hl(e,t=50){if(!Array.isArray(e))return[];let n=[];for(let r of e)if(!(typeof r!=`string`||r.length===0||r.length>200)&&!n.includes(r)&&(n.push(r),n.length>=t))break;return n}function Ul(e,t=50){if(typeof e!=`object`||!e||Array.isArray(e))return{};let n={};for(let[r,i]of Object.entries(e))if(!(r.length===0||r.length>200)&&!(typeof i!=`string`||i.length===0||i.length>200)&&(n[r]=i,Object.keys(n).length>=t))break;return n}function Wl(e){if(typeof e!=`string`)return null;let t=e.trim();return/^#[0-9a-fA-F]{6}$/.test(t)?t.toLowerCase():null}function Gl(e){if(typeof e!=`object`||!e||Array.isArray(e))return{};let t={};for(let[n,r]of Object.entries(e)){if(!Dl.includes(n))continue;let e=Wl(r);e!==null&&(t[n]=e)}return t}function Kl(e){let t=typeof e==`object`&&e?e:{};return{light:Gl(t.light),dark:Gl(t.dark)}}function ql(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(typeof n!=`object`||!n)continue;let e=n.kind,r=n.id;if((e===`chat`||e===`project`)&&!(typeof r!=`string`||r.length===0||r.length>200)&&!t.some(t=>t.kind===e&&t.id===r)&&(t.push({kind:e,id:r}),t.length>=50))break}return t}function Jl(e,t){if(typeof e!=`object`||!e||Array.isArray(e))return null;let n=e,r=new Set(t),i=new Set,a=0,o=(e,t)=>{if(t>Sl||typeof e!=`object`||!e)return null;let n=e,s=n.group;if(typeof s==`object`&&s&&!Array.isArray(s)){if(a>=8)return null;let e=s,t=[];for(let n of Array.isArray(e.tabs)?e.tabs:[])typeof n!=`string`||!r.has(n)||i.has(n)||(i.add(n),t.push(n));return t.length===0?null:(a+=1,{group:{tabs:t,active:(typeof e.active==`string`&&t.includes(e.active)?e.active:null)??t[t.length-1]}})}let c=n.split;if(c!==`row`&&c!==`column`)return null;let l=Array.isArray(n.children)?n.children:[],u=Array.isArray(n.sizes)?n.sizes:[],d=[],f=[];if(l.slice(0,8).forEach((e,n)=>{let r=o(e,t+1);if(!r)return;d.push(r);let i=u[n];f.push(typeof i==`number`&&Number.isFinite(i)&&i>0?i:0)}),d.length===0)return null;if(d.length===1)return d[0];let p=f.filter(e=>e>0),m=p.length>0?p.reduce((e,t)=>e+t,0)/p.length:1,h=f.map(e=>e>0?e:m),g=h.reduce((e,t)=>e+t,0);return{split:c,sizes:h.map(e=>e/g),children:d}},s=o(n.root,0);if(!s||a<2)return null;let c=n.focused;return{root:s,focused:typeof c==`number`&&Number.isInteger(c)&&c>=0&&c<a?c:0}}function Yl(e,t,n){return e.some(e=>e.kind===t&&e.id===n)}function Xl(e,t,n,r){return r===Yl(e,t,n)?e:r?[...e.length>=50?e.slice(e.length-50+1):e,{kind:t,id:n}]:e.filter(e=>e.kind!==t||e.id!==n)}function Zl(e){let t=typeof e==`object`&&e?e:{},n=typeof t.notifications==`object`&&t.notifications!==null?t.notifications:{},r=Hl(t.openTabs),i=Hl(t.draftTabs).filter(e=>!r.includes(e)),a={};for(let[e,n]of Object.entries(Ul(t.draftTitles)))i.includes(e)&&(a[e]=n);let o=[...r,...i],s=t.activeTab,c=typeof s==`string`&&o.includes(s)?s:o[o.length-1]??null,l=Bl(t.sessionPanelOpen,Fl.sessionPanelOpen),u=Bl(t.explorerOpen,Fl.explorerOpen),d=El(t.rightPanelSections)??(l?[`sessionInfo`]:[]),f=(El(t.rightPanelCollapsed)??[]).filter(e=>d.includes(e));return{autoAcceptPermissions:Bl(t.autoAcceptPermissions,Fl.autoAcceptPermissions),autosaveFiles:Bl(t.autosaveFiles,Fl.autosaveFiles),safeguardFallback:gl(t.safeguardFallback),showReasoningSummaries:Bl(t.showReasoningSummaries,Fl.showReasoningSummaries),notifications:{agentFinished:Bl(n.agentFinished,Pl.agentFinished),permissionRequired:Bl(n.permissionRequired,Pl.permissionRequired),errorOccurred:Bl(n.errorOccurred,Pl.errorOccurred)},showAgentPicker:Bl(t.showAgentPicker,Fl.showAgentPicker),transcriptWindowSize:zl(t.transcriptWindowSize),openTabs:r,draftTabs:i,draftTitles:a,activeTab:c,editorLayout:Jl(t.editorLayout,o),remoteTabs:Ul(t.remoteTabs),sessionPanelOpen:l,explorerOpen:u,leftPanelSection:Tl(t.leftPanelSection)??(u?`files`:`sessions`),leftPanelOpen:Bl(t.leftPanelOpen,Fl.leftPanelOpen),rightPanelSections:d,rightPanelCollapsed:f,sidebarWidth:Ll(t.sidebarWidth),sessionPanelWidth:Rl(t.sessionPanelWidth,288),mediaPanelWidth:Rl(t.mediaPanelWidth,320),rightPanelWidth:Rl(t.rightPanelWidth??t.mediaPanelWidth??t.sessionPanelWidth,320),sidebarPinned:Bl(t.sidebarPinned,Fl.sidebarPinned),dismissedUpdateVersion:Vl(t.dismissedUpdateVersion),lastSeenReleaseNotes:Vl(t.lastSeenReleaseNotes),claudeImportOffered:Bl(t.claudeImportOffered,Fl.claudeImportOffered),claudeImportOffers:Il(t.claudeImportOffers),collapsedProjects:Hl(t.collapsedProjects),themeColors:Kl(t.themeColors),fonts:Nl(t.fonts),pinned:ql(t.pinned),sidebarView:t.sidebarView===`projects`?`projects`:`recent`}}new Set(Object.keys(Fl));function Ql(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}var $l=3650,eu=[{version:`0.3.275`,date:`2026-10-27`,added:[`Kimi (Moonshot) is back as a provider you connect with your own Moonshot API key: Kimi K3, K3.1 Pro, K2.7 Code and K2.6. Your PC talks to Moonshot directly — nothing goes through OonaCode’s servers. (The Kimi Code subscription is a different service and is not included.)`],fixed:[`The app keeps up with the provider and model list from OonaCode’s server again. After the server added a provider for Google’s voices, builds before this one could not read the new list and quietly kept the old one, so new models and providers did not appear until the next update.`,`A chat that was set to Gemini is told that the provider was removed and asked to pick another, instead of failing with “unknown provider”. Gemini itself was never available to use.`]},{version:`0.3.274`,date:`2026-10-27`,added:[],fixed:[`A big chat you reopen (Ctrl+R, or after a restart) now ends on its newest messages. Before, the transcripts of old agents were listed after the whole chat, so their cards piled up at the bottom and the last few minutes of the conversation sat above them, out of the window.`,`The note that earlier messages were left out of the request is shown as its folded line after a reload too, not as raw <local-command-stdout> text.`]},{version:`0.3.273`,date:`2026-10-26`,added:[`Rest the pointer on the model box (or focus it with the keyboard) to see how much of that model’s plan or key you have used: the bars and when each limit resets, with the model you are on first. For your own Claude plan it shows what Claude itself reported on its last answer; when that is older than 10 minutes, OonaCode asks again with one tiny message (a few tokens of your own plan or key), or you press “Check now”. Settings → This PC can switch the check off or change the 10 minutes.`],fixed:[`A picture or file sent in a chat on Google’s agy — any of its models, Claude through Google included — is no longer refused with “takes text only”: OonaCode saves it in the chat’s folder and gives the model its path, as it does for every other model.`,`A Google agy chat no longer repeats “Google answered “service unavailable” — continuing in …” (and redoes its last step each time) when Google had in fact answered every request of the turn. A real Google outage is still waited out as before.`]},{version:`0.3.272`,date:`2026-10-26`,added:[`A find-in-page field in the top bar, next to the MCP servers icon: it searches everything visible in OonaCode and highlights the matches (Enter and Shift+Enter step through them). Ctrl+F opens it when no chat find takes the key; Ctrl+Shift+F always does.`,`On the website’s API keys page, a key you create from now on can be shown again with “Reveal key” — it is sealed in your browser with your vault key, so the server still cannot read it. Keys made before this still show only their last four characters.`,`Removing a message now also removes the summary the engine wrote after it, if the chat was summarised later (the summary was made from that message); the confirmation says so. The model then reads the earlier messages themselves again.`],fixed:[`Messages you type while a Google agy turn is running now all go together when the turn ends, instead of one turn per message with “2 queued” left over. The waiting strip says when they will be read, how long they have waited, what the agent is doing and how long earlier turns took.`,`The media panel starts over when OonaCode comes back after an update: it asks for a fresh access grant and reads the list again, and a failed read has a Try again button.`,`The Session info panel shows a chat’s context size as soon as you open it, not only after its next reply.`,`A sub-agent’s “Conversation compacted” line stays inside that agent’s card instead of appearing loose at the end of the chat.`,`When a chat’s own model cannot write its About or the summary of older messages, OonaCode now says so instead of quietly answering with another model.`]},{version:`0.3.271`,date:`2026-10-25`,added:[`Messages can be removed from a chat, and from what the model remembers. Right-click one of your messages, or any reply, tool call or thought of its exchange: “Remove this exchange…” takes out your message and everything the agent did for it; “Remove this and everything after…” also takes out every later message. Open windows update at once, and the chat starts fresh from what is left on its next message. Text already sent to a provider stays in that provider’s own logs.`,`When the provider is throttling OonaCode for a short while, the pool now holds your request and sends it the moment the provider is ready, instead of failing it straight away. It holds up to 90 seconds at a time, and a longer pause is waited out over the engine’s next retry.`,`Your PC’s agy and Muse helper move to the versions tested on the server (agy 1.4.7, Muse 1.4.13).`],fixed:[`Chats on a ChatGPT plan (Codex) no longer fail their About, titles and the summary of older messages with a 400 error.`,`Chats on Claude through Google, and chats on your own NVIDIA key, keep a summary of the messages that no longer fit the model’s window: their background calls now use a model the key can actually reach.`,`A chat on another of your PCs shows “PC linked · N folders” again after a restart, instead of asking you to link the same folders once more.`,`The agy note “still reports Individual quota reached…” is gone from the chat; the turn is still treated as the success it was.`,`The file explorer is back in VS Code, the chat font now also covers the message box, and a tool call at the edge of an older page of a remote chat keeps its name and input.`,`“Not delivered — the chat couldn’t start” now appears only when OonaCode itself could not start the turn, never for an error the model returned, so Send again cannot double a message.`]},{version:`0.3.270`,date:`2026-10-25`,added:[`One left panel: an icon strip on the far left switches between Sessions, Search and Files, and the file explorer now has the sidebar’s width and resize handle. Sessions and Files each have a filter box at the top.`,`Search has its own section with two scopes: Chats (every option the old search had) and Files & contents, which searches the open chat’s folder and shows the matching lines.`,`Settings → Theme → Fonts: choose the typeface and size for the chat and for the sidebar separately. Left alone, everything looks as before.`,`Hover a provider you use with your own key or subscription in the model picker to see its usage: quota bars with the time each resets.`,`On a Mac, updating now shows a window saying what is happening — it closes by itself when the new OonaCode opens, so you know whether to wait. Windows has had one since 0.3.92.`],fixed:[`Dark mode: Settings → Theme now has the Colour scheme switch (Light, Dark, System), and the colour editor opens on the colours you are actually looking at. Its old Light | Dark buttons only chose which colours to edit, so choosing Dark there seemed to do nothing. On System, the file editor also follows Windows’ dark setting now.`,`A chat on another of your PCs opens with its newest 500 messages and loads earlier ones as you scroll up, instead of pulling thousands at once over a slow link.`,`A message sent into a chat that then failed to start is marked “Not delivered — the chat couldn’t start”, with Send again. It used to look sent although the model never received it.`,`Subagents always run on the chat’s own model.`,`On a Mac, an update that could not close OonaCode used to report “done” and leave the old app in place — the terminal half updated and the app did not, sometimes for days. It now closes the app even when its window is frozen, and says plainly if it still could not, instead of claiming success.`,`After an update on a Mac, OonaCode opens again by itself. It used to reopen only if the update had closed it.`,`A browser the agent opened no longer leaves processes behind when it is closed or when OonaCode restarts. Helpers of a browser whose window was already gone could keep running for days — one of them found using most of a processor core — and they also stopped old browser versions from being cleaned up.`]},{version:`0.3.269`,date:`2026-10-25`,added:[],fixed:[`OonaCode can be quit again. Since 0.3.244, Quit (and ⌘Q on a Mac) did nothing at all unless a chat happened to be working: the question that warns about working chats answered itself when nothing was running, forgot it had answered, and asked again for ever — so the app stayed open and kept a processor core busy trying to close. If an app of yours has been sitting at high CPU, this was why.`]},{version:`0.3.268`,date:`2026-10-25`,added:[],fixed:[`Long chats no longer fail to start with “SessionStore.load() timed out after 60000ms”. Since 0.3.264 a chat’s start waited for the summary of its older messages, and the first one of a long chat could take longer than the engine allows; a chat now starts after at most 15 seconds, and the summary finishes in the background for the next start.`,`Stop now always stops a turn, even when the model is stuck retrying.`,`There is one Session info button on a wide window (on the right edge) instead of two.`]},{version:`0.3.267`,date:`2026-10-25`,added:[`Claude through Google now takes chats up to 500,000 tokens (it was 200,000), so a long chat on it keeps far more of its own history before anything is left out.`],fixed:[]},{version:`0.3.266`,date:`2026-10-25`,added:[],fixed:[`A chat’s “about” in Session info is now always written in English, whatever language the chat or its files are in — it used to follow pasted text, so an English chat could get a Persian about. The briefing and Listen still translate it into your language when you ask.`,`An about that ran over its length is now cut at the end of a whole sentence instead of in the middle of a thought, and the model is told to keep it short so the “where it stands now” part is not lost.`]},{version:`0.3.265`,date:`2026-10-25`,added:[],fixed:[`A model’s context limit now comes from the server instead of a copy kept in the app, so changing it in the admin reaches every PC. If a model ever refuses a chat as too long and names its limit, OonaCode remembers that limit and plans the next start by it, instead of hitting the same wall again.`]},{version:`0.3.264`,date:`2026-10-25`,added:[`A long chat keeps its older part in view. When a chat has grown past what the model can read, OonaCode gives the model as much of the recent conversation as fits and, in front of it, a short summary of the older part — what you asked for, what was decided and done, and what is left — instead of simply dropping it. The summary is written once, kept on this PC, and only extended as the chat grows; it appears in Usage as “Long-chat summaries”.`],fixed:[`A chat that was one very long piece of work followed by a short message no longer answers that it cannot see any earlier context: the model now gets the newest steps of that work under your original request.`,`The “invalid request” and “Autocompact is thrashing” errors that long runs of work could end in on models with a smaller window are gone: a chat is no longer handed to the model larger than the model accepts.`,`The note that earlier messages were left out now says when the cut fell inside your latest request, and when a summary was given in their place.`]},{version:`0.3.263`,date:`2026-10-25`,added:[`The right-hand side is now one dock: an icon strip on the edge, and Media and Session info stacked in it as sections. Each icon puts its section in or takes it out, both can be open at once, and a header folds its section to a line without losing what it had loaded.`,`The dock has one width and one drag handle for both sections, and it remembers which sections are in and which are folded.`],fixed:[]},{version:`0.3.262`,date:`2026-10-24`,added:[`xAI text-to-speech can now use a pronunciation map, so you can keep the written words while supplying IPA or a spoken replacement for names and multilingual dubbing.`],fixed:[`Voice and media requests recover onto another eligible operator key when one key reaches its limit, rather than failing the request immediately.`,`Google text-to-speech limits are now tracked per model, so a limit on one voice model does not make another available voice model unavailable.`,`OonaCode now presents the current versions of the Muse and Grok coding clients to their providers.`]},{version:`0.3.261`,date:`2026-10-24`,platforms:[`darwin`],added:[`“Bring this PC into the chat” remembers the folders you picked for that chat. Switching between two remote chats, reopening one, or reloading the window comes back linked to exactly those folders — you choose them once. Unlink still clears them for good.`,`A model change says what it came from: “Set model to X for this session only (previous model was Y)”, with the model you just picked in blue and the one it left in grey.`,`You can set a model typed by id on a chat that runs on another one of your PCs, instead of having to go to that PC to change it.`,`A file named in a chat opens in OonaCode, even when it is outside the chat folder. Text and code can be edited; a sound, picture or video plays as before.`,`An edited file no longer has a Save button. A changed tab shows *, Ctrl+S saves it, and Settings → General → Autosave files saves each change as you type.`,`Right-clicking a file the chat names offers “Copy relative path” and “Copy absolute path”.`,`A change to the model list or to settings now reaches this PC on its next check-in with the server, without restarting.`,`The chat’s browser no longer shows a “Restore pages?” bubble or brings back the tabs it had last time. OonaCode closes it on every exit, which used to look like a crash.`],fixed:[`One “Send now” for the whole queue: it sends every queued message at once and empties the list, instead of one button per message.`,`A message the agent had already read gets its receipt instead of staying pinned in the queue, where pressing Send now answered “The agent has already read that message”.`,`Stopping a reply, or pressing Send now while one is running, no longer shows an error. The chat says “User requested stop”.`,`Closing a file you have changed asks whether to save it, with Save, Don’t save and Cancel.`,`A file you edit keeps the line endings it had on disk when you save it, and a file the model writes while you have it open no longer replaces what you are typing in it.`,`After an admin changes a provider’s offered models, this PC’s list keeps every model’s prices and limits — no stale or emptied list in between.`,`A PC that checks in with the server on a slow schedule no longer reads as offline between check-ins; a change reaches it within a minute.`,`A Google Gemini chat no longer shows an error after a complete answer when the connection closes. The answer stays, and a real failure still shows as an error.`,`A folder you linked that may no longer be linked (a drive root, your home folder, a network share, OonaCode’s own data) is dropped when the link comes back, and never a folder you did not pick is added.`]},{version:`0.3.260`,date:`2026-10-24`,platforms:[`win32`],added:[`“Bring this PC into the chat” remembers the folders you picked for that chat. Switching between two remote chats, reopening one, or reloading the window comes back linked to exactly those folders — you choose them once. Unlink still clears them for good.`],fixed:[`One “Send now” for the whole queue on the phone too: it sends every queued message at once and empties the list, instead of one button per message.`,`A folder you linked that may no longer be linked (a drive root, your home folder, a network share, OonaCode’s own data) is dropped when the link comes back, and never a folder you did not pick is added.`]},{version:`0.3.260`,date:`2026-10-24`,platforms:[`linux`],added:[`“Bring this PC into the chat” remembers the folders you picked for that chat. Switching between two remote chats, reopening one, or reloading the window comes back linked to exactly those folders — you choose them once. Unlink still clears them for good.`,`This is Linux’s first update since 0.3.250, so it also brings everything in between: a model change says what it came from (“Set model to X for this session only (previous model was Y)”, the model you picked in blue and the one it left in grey); a model typed by id can be set on a chat that runs on another of your PCs; right-clicking a file the chat names offers “Copy relative path” and “Copy absolute path”; a file named in a chat opens in OonaCode even outside the chat folder and its text can be edited; an edited file is saved with Ctrl+S (and Settings → General → Autosave files saves as you type); the sticky notes button shows how many note tabs you have; and a Google Gemini chat in Build asks before running a command, like every other chat.`],fixed:[`One “Send now” for the whole queue on the phone too: it sends every queued message at once and empties the list, instead of one button per message.`,`A folder you linked that may no longer be linked (a drive root, your home folder, a network share, OonaCode’s own data) is dropped when the link comes back, and never a folder you did not pick is added.`,`Also from in between: stopping a reply, or pressing Send now while one is running, says “User requested stop” instead of an error; closing a file you have changed asks whether to save it; a file you edit keeps the line endings it had on disk and a file the model writes while you have it open no longer replaces what you are typing in it; after an admin changes a provider’s offered models, this PC’s list keeps every model’s prices and limits; a PC that checks in with the server on a slow schedule no longer reads as offline between check-ins; a Google Gemini chat no longer shows an error after a complete answer when the connection closes; and a message the agent had already read gets its receipt instead of staying pinned in the queue.`]},{version:`0.3.259`,date:`2026-10-24`,platforms:[`win32`],added:[`A model change says what it came from: “Set model to X for this session only (previous model was Y)”, with the model you just picked in blue and the one it left in grey.`,`You can set a model typed by id on a chat that runs on another one of your PCs, instead of having to go to that PC to change it.`],fixed:[`One “Send now” sends the whole queue at once and empties it, instead of one button per message.`,`A message the agent had already read gets its receipt instead of staying pinned in the queue, where pressing Send now answered “The agent has already read that message”.`]},{version:`0.3.258`,date:`2026-10-23`,platforms:[`win32`],added:[`Right-clicking a file the chat names offers “Copy relative path” and “Copy absolute path”.`],fixed:[`A file you edit keeps the line endings it had on disk when you save it, and a file the model writes while you have it open no longer replaces what you are typing in it.`,`A Google Gemini chat in Build asks before running a command again, and Allow runs that command.`,`After an admin changes a provider’s offered models, this PC’s list keeps every model’s prices and limits — no stale or emptied list in between.`,`A PC that checks in with the server on a slow schedule no longer reads as offline between check-ins; a change reaches it within a minute.`]},{version:`0.3.257`,date:`2026-10-23`,platforms:[`win32`],added:[],fixed:[`Stopping a reply, or pressing Send now while one is running, no longer shows an error. The chat says “User requested stop”.`,`Closing a file you have changed asks whether to save it, with Save, Don’t save and Cancel.`]},{version:`0.3.256`,date:`2026-10-22`,platforms:[`win32`],added:[`A change to the model list or to settings now reaches this PC on its next check-in with the server, without restarting.`],fixed:[]},{version:`0.3.255`,date:`2026-10-22`,platforms:[`win32`],added:[],fixed:[`A Google Gemini chat no longer shows an error after a complete answer when agy’s local connection closes. The answer stays, and a real failure still shows as an error.`]},{version:`0.3.254`,date:`2026-10-22`,platforms:[`win32`],added:[`A file named in a chat opens in OonaCode, even when it is outside the chat folder. Text and code can be edited; a sound, picture or video plays as before.`,`An edited file no longer has a Save button. A changed tab shows *, Ctrl+S saves it, and Settings → General → Autosave files saves each change as you type.`],fixed:[]},{version:`0.3.252`,date:`2026-10-21`,platforms:[`win32`,`darwin`],added:[`The sticky notes button shows how many note tabs you have, as a blue number.`],fixed:[]},{version:`0.3.251`,date:`2026-10-21`,platforms:[`win32`],added:[`A Google Gemini chat in Build now asks before running a command, using the same permission card as every other chat. Autonomous and auto-accept still run commands without asking.`],fixed:[]},{version:`0.3.250`,date:`2026-10-21`,added:[`The file list now has Show in Explorer, which opens the file or folder selected in your computer’s file manager, and Rename for both files and folders.`,`A text file opened from the file list can now be edited. Change it, then press Save or Ctrl+S. Pictures, videos, sounds and PDF files stay view-only.`],fixed:[]},{version:`0.3.249`,date:`2026-10-20`,added:[`When the model reads a picture, a video or a sound file, that step in the chat now opens by itself: you see the picture, or get a player for the video or sound, without clicking. Click the step to close it. Steps that read ordinary text files stay closed as before.`],fixed:[]},{version:`0.3.248`,date:`2026-10-20`,added:[],fixed:[`A chat on Google Gemini (through your Google plan) no longer ends a finished turn with an error. Google’s agy tool can keep repeating an old “quota reached” message at the end of a long chat even though your limit was fine and the answer arrived; OonaCode now shows the answer as done and adds a short note. A limit you really hit still shows as an error.`,`When you do reach your Google limit in a Gemini chat, OonaCode now shows Google’s own message, including when it resets, instead of a message about the OonaCode pool that did not apply to you.`]},{version:`0.3.247`,date:`2026-10-20`,added:[`On the Android app, a short tap on a message now opens a menu: Reply (quotes it above the box), Copy, Forward (opens it as a draft in another chat you pick), Share and Save text to… A long press still selects text.`,`On the Android app, a picture, video, sound or file that a reply names now opens from your PC: pictures show right in the chat, videos and sounds play in the chat, and other files open in the app you choose or are saved where you say. A file larger than 25 MB asks first.`,`This PC now hands those files to your phone over the same private link as your chats — only files that the chat itself named or that sit in its folder, one piece at a time.`],fixed:[]},{version:`0.3.246`,date:`2026-10-19`,added:[`Every chat can now make videos and spoken audio, not only pictures: ask for a short clip or a voice-over and the model makes it, saves it in the chat’s folder and plays it right in the chat. Video and Speech sit beside Images in the Tools menu, switched on by default.`,`In the Tools menu each of the three has a model choice for this chat (its default follows the model you are chatting with: a Grok chat uses Grok’s, an Alibaba chat Alibaba’s) and an “Ask me first” switch. With it on — the default for video — the model asks you for the length, resolution and shape and tells you the price in credits before anything is spent.`,`Pictures, videos and speech are paid with your OonaCode credits like any other message, whatever model or key the chat runs on, and the credits charged are shown in the answer.`,`On Apple Silicon Macs (M1 and later) Oonak Browser is now the native build: it quits with its last window, shows its own Dock icon and never asks for notification permission.`],fixed:[]},{version:`0.3.245`,date:`2026-10-19`,added:[`A picture, video or sound that a model reply named but that is not on your PC any more is now left out of the Media explorer, with a line under the list saying how many were left out and a Show button to see them.`,`A picture the model made now shows up in the chat as a small square beside its name — you no longer need the Media panel to notice it — and a click enlarges it.`,`A file the model names (a PDF, a Word or Excel document, a zip and so on) now shows its type’s icon in the chat and in the Media explorer; a file of any other type gets a plain file icon.`],fixed:[`The Media explorer no longer lists a website path such as /logo.svg or /favicon.png from a model reply as if it were a file on your PC, and a card that cannot be opened now shows the file name and date instead of only “Moved or deleted”.`]},{version:`0.3.244`,date:`2026-10-19`,added:[`When the agent enters plan mode (and when you approve its plan) the Build / Plan / Ask picker now follows it, so the picker always shows the mode the chat is really in.`],fixed:[`Four engine tools nobody uses here — ListAgents, EnterWorktree, ExitWorktree and ReportFindings — are switched off in every chat, which makes each request a little smaller.`]},{version:`0.3.243`,date:`2026-10-18`,added:[`OonaCode now asks before it quits or updates while any chat is still working — including chats whose tabs you closed — and names them, so nothing is interrupted by accident.`],fixed:[]},{version:`0.3.242`,date:`2026-10-18`,added:[`Every model can now take any attachment: a picture or PDF that the chosen model cannot read (Google’s agy, text-only Qwen or GLM models, and so on) is saved in the chat’s temporary folder and the model is given its file path instead of the message being refused.`,`The media panel can filter by All, Mine or Replies, so the pictures, videos, sounds and links that the model’s replies name are listed too, and every item has a right-click menu (View or Play, Show in chat, Show in folder, Copy path or link).`,`The “Media in this chat” and “Session info” panels can be resized by dragging their left edge; double-click the edge for the default width.`,`Web search is now in every chat, always: there is no Tools-menu switch for it any more, and chats that had it switched off search again.`],fixed:[]},{version:`0.3.241`,date:`2026-10-17`,added:[`Remote sessions in the sidebar now have a full right-click context menu and actions button (Pin to top, Move to Project, Project settings, Change folder, Details, Listen to this chat, Files, Rename, Fork and Delete) plus a details card on hover.`,`The Files explorer and file viewer now work for remote chats over the blind relay, so you can browse folders, view code, Markdown and images, copy paths and delete files on the remote PC.`,`Oonak Browser is now available for macOS chats as well as Windows and Linux.`],fixed:[`Newly created or renamed remote chats now appear immediately in the Remote section of the left sidebar, and the sidebar automatically recovers after a brief server or connection blip.`,`Opening a long remote chat with many screenshots no longer disconnects the relay for backpressure or stops loading recent messages.`]},{version:`0.3.240`,date:`2026-10-17`,added:[`Every Thought block now shows how long the model spent thinking (for example “Thought · 42 words · 12s”), both live and when a chat is reopened.`,`Remote chat tabs now show a badge naming the PC they run on, and you can rename a remote chat directly from its tab or from the Remote list in the sidebar.`,`Files attached from the Android app are uploaded into the chat’s folder on the PC that runs the chat.`],fixed:[`Subagent reports and continuation notes now fold into a single Engine note line instead of staying pinned at the bottom of the chat or replacing the pinned user question.`,`Local video and file paths in replies (including Windows paths with forward slashes, paths with spaces, and Markdown links) now reliably show their Play, View and Open in folder buttons.`,`Chats on a ChatGPT (Codex) subscription no longer fail when the model calls tools.`,`Google agy chats wait and retry automatically (5 s, 20 s, 1 min, 2 min) when Google answers with a temporary 503 Unavailable.`]},{version:`0.3.239`,date:`2026-10-16`,platforms:[`win32`],added:[`Media in every chat: the gallery button at the top right of a chat lists the photos, videos, audio, files and links you sent in it. Photos open in the viewer (← → step through them), videos and audio play in place, files open or show in their folder, and “Show in chat” jumps to the message.`],fixed:[`Google agy chats no longer flash a command window when they start. OonaCode now keeps agy up to date itself, quietly, while no agy chat is running.`,`An agy command that waits for someone to type (a password prompt, an ssh question) no longer holds the chat for hours: after 15 minutes with no output and no work, OonaCode ends that command, says so in the chat, and agy carries on.`,`The coding engine is updated (Claude Code 2.1.301): long answers are no longer cut off after three minutes of silence, a long chat no longer compacts again and again, and a tool no longer runs twice.`,`If the app’s window crashes (for example when the computer runs out of memory), it reloads by itself.`,`A chat on your own Meta Muse or ChatGPT plan that started on another provider no longer fails with “call_id must be at most 64 characters”.`,`Your other PCs keep one order in the Remote list instead of reshuffling.`,"`oona -p` with an OonaCode API key says what went wrong instead of asking you to sign in."]},{version:`0.3.239`,date:`2026-10-16`,platforms:[`darwin`],added:[`Media in every chat: the gallery button at the top right of a chat lists the photos, videos, audio, files and links you sent in it. Photos open in the viewer (← → step through them), videos and audio play in place, files open or show in their folder, and “Show in chat” jumps to the message.`],fixed:[`The coding engine is updated (Claude Code 2.1.301): long answers are no longer cut off after three minutes of silence, a long chat no longer compacts again and again, and a tool no longer runs twice.`,`If the app’s window crashes (for example when the computer runs out of memory), it reloads by itself.`,`A chat on your own Meta Muse or ChatGPT plan that started on another provider no longer fails with “call_id must be at most 64 characters”.`,`Your other PCs keep one order in the Remote list instead of reshuffling.`,`A download cut part-way during an update is resumed instead of starting over.`,"`oona -p` with an OonaCode API key says what went wrong instead of asking you to sign in."]},{version:`0.3.239`,date:`2026-10-16`,platforms:[`linux`],added:[`Media in every chat: the gallery button at the top right of a chat lists the photos, videos, audio, files and links you sent in it. Photos open in the viewer (← → step through them), videos and audio play in place, files open or show in their folder, and “Show in chat” jumps to the message.`],fixed:[`“Restart now” in Settings opens the app again instead of closing it for good.`,`The OonaCode service starts again after a quick reboot.`,`A power cut no longer empties the files that keep you signed in and unlocked.`,`A download cut part-way (weak Wi-Fi) during an install or update is resumed instead of giving up.`,`Notifications come from “OonaCode”.`,`The coding engine is updated (Claude Code 2.1.301): long answers are no longer cut off after three minutes of silence, a long chat no longer compacts again and again, and a tool no longer runs twice.`,`If the app’s window crashes (for example when the computer runs out of memory), it reloads by itself.`,`A chat on your own Meta Muse or ChatGPT plan that started on another provider no longer fails with “call_id must be at most 64 characters”.`,`Your other PCs keep one order in the Remote list instead of reshuffling.`,"`oona -p` with an OonaCode API key says what went wrong instead of asking you to sign in."]},{version:`0.3.238`,date:`2026-10-16`,added:[`Auto in the OonaCode pool: pick “Auto” and each new message runs on the pool model that suits it — how hard the task is, how big the chat is, whether a model already has the chat in its cache, speed and cost — at an effort it picks too. The model button shows which model Auto chose, like “Auto (Qwen3.8 Max)”. (It appears once OonaCode switches it on.)`,`Window control in the Tools menu: when you ask, the agent can list, hide, show, minimise, restore or focus the windows on your computer (Windows; apps on macOS; X11 and KDE on Linux).`,`The conversations popup in a chat shows when each conversation started and when it was last active.`],fixed:[`A Google agy chat that hits a temporary “service unavailable” from Google now waits a few seconds and carries on in the same conversation instead of ending the turn.`,`The agent keeps Oonak Browser’s window visible: no hidden or headless browser unless you ask for one.`]},{version:`0.3.237`,date:`2026-10-15`,platforms:[`win32`,`darwin`],added:[`When a long chat no longer fits the model, the chat shows one line saying how many earlier messages the request left out; click it for the explanation.`],fixed:[`The model picker no longer has an “All models” list, which showed the same model twice when a provider offers it both by key and by subscription. Pick a provider to see its models.`,`Google’s agy: Gemini 3.7 Flash, 3.6 Flash and 3.1 Pro are gone from the picker, because Google no longer offers them, and the picker shows only the models your own Google plan lists. A chat that was on one of them asks you to pick another model.`,`A picture or PDF attached to a chat on Google’s agy is refused with words that say agy takes text only on every one of its models, and that another provider’s model can read it.`,`A thought with no words in it (Meta Muse hides its thinking) no longer leaves an empty “Thought” card in the chat.`,`Conversations between chats read “idle” when nothing is going on.`]},{version:`0.3.237`,date:`2026-10-15`,platforms:[`linux`],added:[`The model picker is redone: your providers on the left, each with how many models it has, and the chosen provider’s models on the right, best first by independent intelligence rating. Each side has its own search. After you pick a model from another provider, its button says “next message” until your next message runs on it.`,`Every model shows its own effort levels, and the effort picker starts on the model’s default. A model with no effort levels shows no picker.`,`Meta Muse: Muse Spark 1.3 and 1.2, Wonder 1.0 and Wonder Full 1.0 — paste your Muse key in Connect or press “Sign in with Meta”.`,`ChatGPT plans: GPT-6.1 Sol, GPT-6 Sol, GPT-6 Astra and GPT-5.6 Sol when your plan lists them; chats keep their thinking across tool calls and use the effort you pick.`,`NVIDIA is back for your own NVIDIA key, with twelve hosted models that call tools. Your own SuperGrok subscription offers Grok 4.7 Fast.`,`Bring this PC into the chat: on a chat that runs on another PC, pick folders on this PC and what the chat may do there; it asks you before every change. And a Tools switch lets a chat list, read and message the chats on your other PCs.`,`Sticky notes beside the bug button, saved in your vault so they follow you to your other computers.`,`Suggest, beside Listen in every chat, proposes what to send next, and the project manager does it for several chats at once. Nothing is sent until you press Send.`,`Listen to this chat is a player with a seek bar, a speed you can change while it plays, and the spoken word highlighted.`,`A tab whose chat finished a turn you have not looked at yet wears a dot. A long chat folds old agents into one “N earlier agents” row, and every block shows its time.`,`When a long chat no longer fits the model, one line says how many earlier messages the request left out.`],fixed:[`A message sent while a chat is working, right after you picked another model, waits for the running turn and is answered by the model you picked.`,`A PC you sign in later appears in the left panel by itself.`,`A thought with no words in it no longer leaves an empty “Thought” card.`,`The Claude Code engine is updated to 2.1.296.`]},{version:`0.3.236`,date:`2026-10-14`,platforms:[`win32`,`darwin`],added:[`Every model now shows its own effort levels, and the effort picker starts on the model’s default — so you can see what level a chat really runs at. A model that has no effort levels no longer shows a picker at all.`,`A collapsed thought block now shows how the thought begins, like a command does: “Thought 42 words: First I read the file…”.`,`Meta Muse requests now match Meta’s own Muse CLI, so its thinking, tool calls, pictures and PDFs show up properly in the chat.`],fixed:[`Grok 4.5 no longer offers an “extra high” effort that xAI treats as high, and GPT-4.1 no longer shows an effort picker it cannot use.`]},{version:`0.3.235`,date:`2026-10-13`,platforms:[`win32`,`darwin`],added:[`Meta Muse: use Meta’s Muse Spark 1.3, Spark 1.2, Wonder 1.0 and Wonder Full 1.0 in your chats. Open Connect, pick Meta Muse, and either paste your Muse key or press “Sign in with Meta” — OonaCode downloads Meta’s Muse once (about 360 MB, after you agree), you confirm the code on Meta’s page, and the key is kept in your vault.`,`ChatGPT plans: GPT-6.1 Sol (500k context), GPT-6 Sol, GPT-6 Astra and GPT-5.6 Sol are available when your plan lists them, next to the models you already had.`,`Google’s agy: Gemini 4 Argon appears in the model picker when your Google plan includes it (Ultra), at Low, Medium and High.`],fixed:[]},{version:`0.3.234`,date:`2026-10-13`,platforms:[`win32`,`darwin`],added:[`Bring this PC into the chat: on a chat that runs on another PC, press the button in the chat’s toolbar, pick folders on this PC and tick Read, Create, Edit or Delete for each. The chat can then work with those files. It asks you before it creates, changes, moves or deletes anything, and the link ends when you close the tab. Both PCs need this version.`,`Chats on my other PCs: a new switch in the Tools menu lets a chat list your other PCs and their chats, read them, message them and start new chats there on the model you choose. You confirm every new chat.`,`The Tools menu now works on a chat that runs on another PC, so you can switch its tools from here.`],fixed:[`A PC you sign in after OonaCode has started now appears in the left panel by itself, without opening Settings → Devices first.`]},{version:`0.3.233`,date:`2026-10-12`,platforms:[`win32`,`darwin`],added:[`The model picker now tells you when a pick is not in use yet: after you pick a model from another provider, its button says “next message” and explains that the chat keeps running on its current model until your next message.`,`A long chat folds the agents that ran long ago into one “N earlier agents” row that says when they ran, instead of one card for each of them under your newest message.`],fixed:[`A message you send while a chat is working, right after you picked another model or provider, now waits for the running turn and is answered by the model you picked. It used to go to the model that was already running, so the chat kept answering as the old one while the picker showed the new one.`,`Every block in a chat now shows the time it happened — also the notes the app writes itself and the cards for earlier agents.`]},{version:`0.3.232`,date:`2026-10-12`,platforms:[`win32`],added:[`The model picker is redone: your providers on the left, each with how many models it has, and the chosen provider’s models on the right, best first by independent intelligence rating (unrated ones last). Each side has its own search, and the one over the providers finds a model across every provider, showing only the providers that carry it.`,`NVIDIA is back for your own NVIDIA key: twelve hosted models that call tools, among them Nemotron 3 Ultra and Super, Kimi K3, GLM-5.3, DeepSeek V4.1 Flash and Gemma 4.`],fixed:[`Models hosted as vendor/model (Kimi K3 on NVIDIA and the like) now show their intelligence rating.`]},{version:`0.3.232`,date:`2026-10-12`,platforms:[`darwin`],added:[`Sticky notes: the note button beside the bug button at the top opens your notes as tabs. Make as many as you like, name them with a double-click, and write — every change is saved by itself in your vault, so the notes follow you to your other computers. Text only.`,`Chats on your own ChatGPT plan keep their thinking across tool calls, use the effort level you pick (up to max where the model has it), and list the models your account really offers.`,`The model picker is redone: your providers on the left, each with how many models it has, and the chosen provider’s models on the right, best first by independent intelligence rating (unrated ones last). Each side has its own search, and the one over the providers finds a model across every provider, showing only the providers that carry it.`,`NVIDIA is back for your own NVIDIA key: twelve hosted models that call tools, among them Nemotron 3 Ultra and Super, Kimi K3, GLM-5.3, DeepSeek V4.1 Flash and Gemma 4.`],fixed:[`Suggest no longer starts reading the chat the moment you open it: pick how many hours to read, then press Suggest.`,`The Claude Code engine is updated to 2.1.296.`,`Models hosted as vendor/model (Kimi K3 on NVIDIA and the like) now show their intelligence rating.`]},{version:`0.3.231`,date:`2026-10-12`,platforms:[`android`],added:[`On the phone: any text in a chat can be selected and copied, and About became Session info.`],fixed:[]},{version:`0.3.230`,date:`2026-10-11`,platforms:[`win32`],added:[`Sticky notes: the note button beside the bug button at the top opens your notes as tabs. Make as many as you like, name them with a double-click, and write — every change is saved by itself in your vault, so the notes follow you to your other PCs. Text only.`,`Chats on your own ChatGPT plan keep their thinking across tool calls, use the effort level you pick (up to max where the model has it), and list the models your account really offers.`],fixed:[`Suggest no longer starts reading the chat the moment you open it: pick how many hours to read, then press Suggest.`,`A Gemini chat on your own Google plan no longer repeats, turn after turn, a command it refused earlier.`,`The Claude Code engine is updated to 2.1.296.`]},{version:`0.3.229`,date:`2026-10-11`,platforms:[`darwin`],added:[`Suggest, beside Listen in every chat: it reads the last few hours of the chat and suggests what to send it next. You edit it, put it in the message box or send it — nothing runs by itself.`,`The project manager, beside the "about" button over the chat list: tick chats, press Review, and each gets a suggestion you can edit and send with its own button.`,`A tab whose chat finished a turn you have not looked at yet wears a dot (red when the turn failed), and so does its row in the list.`,`Listen to this chat is a player: a seek bar, play and pause, ten seconds back and forward, the previous or next sentence, a speed you can change while it plays, the spoken word highlighted (click any word to play from it), and every summary listed newest first on top.`,`MCP servers: add them in Settings → MCP Servers from a directory of popular ones (PostgreSQL, Supabase, GitHub, Sentry, Slack, Notion, Linear and more) or your own, and switch each on or off per chat.`,`Connectors: Supabase, Railway and Vercel in the Tools menu — sign in once, switch one on in a chat, and the agent can look at your projects, databases, logs and deployments; read-only until you allow changes, and it asks before each one.`,`Pictures: ask any chat for an image and it makes one, saved in the chat’s folder and shown in the chat (a few credits each; Images in the Tools menu turns it off).`,`Web search for every model, from your Mac, with no key and no credits.`,`Claude Haiku 5.5 with a 1M-token window, and Grok 4.7 Fast on your own SuperGrok subscription.`,`Pasting a very long text, or a video, sound or large picture, saves it in the chat’s folder and attaches it as a file.`,`Hover a “Read …png” line in the chat and the picture shows at once.`],fixed:[`A compacted chat reopens with its whole history, not only what came after its last compaction.`,`Deleting a chat frees its OonaCode pool seat at once.`,`Large chats resume faster.`,`The chat summary (“About”) no longer fails on models that think at length.`,`A refusal by Gemini’s safety filter is retried once on another model, like the others.`,`Error notes in the chat read as plain sentences instead of codes or raw data.`,`The message navigator always shows at least four lines and no longer vanishes on the way to it.`]},{version:`0.3.228`,date:`2026-10-11`,platforms:[`win32`],added:[`Suggest, beside Listen in every chat: it reads the last few hours of the chat and suggests what to send it next. You edit it, put it in the message box or send it — nothing runs by itself.`,`The project manager, beside the "about" button over the chat list: tick chats, press Review, and each gets a suggestion you can edit and send with its own button.`,`A tab whose chat finished a turn you have not looked at yet wears a dot (red when the turn failed), and so does its row in the list.`],fixed:[]},{version:`0.3.227`,date:`2026-10-11`,platforms:[`win32`],added:[`Listen to this chat is a player: a seek bar, play and pause, ten seconds back and forward, the previous or next sentence, and a speed you can change while it plays.`,`The word being spoken is highlighted in the summary, and clicking any word plays from there.`,`Every summary the chat has is listed on top, newest first; pick one to hear it, with the languages it was already translated into.`],fixed:[]},{version:`0.3.226`,date:`2026-10-11`,platforms:[`win32`],added:[`Google Gemini (agy) chats show what agy looked at: a picture it viewed appears in the chat, and a sound or video it named plays inside the tool card.`,`Your own SuperGrok subscription offers Grok 4.7 Fast.`,`The Android app groups this PC’s chats by the project each one is filed under.`],fixed:[`Google Gemini (agy) tool steps read in words — View file, Run command, Edit — with their file or command, instead of raw arguments.`,`Your own SuperGrok sign-in presents the current Grok CLI (1.0.50), so xAI does not refuse it as outdated.`]},{version:`0.3.225`,date:`2026-10-10`,platforms:[`win32`,`linux`],added:[`Per-credential usage keys: operator credentials can now store their own console session keys (such as Xiaomi MiMo account credentials) directly in the Admin Panel to monitor individual token plan quotas and balances.`,`Google agy thinking blocks: local Google Antigravity (Gemini) sessions now extract and display model thinking blocks and rich tool arguments in chat from agy transcripts.`],fixed:[`Session info regeneration: fixed an issue where regenerating the session summary for Google Antigravity (Gemini) sessions would fail with a missing subscription token error.`,`Xiaomi MiMo cleanup: removed redundant and withdrawn mimo-v2.5 and mimo-v2.5-pro models from the registry and models catalog; replaced by mimo-v2.6-pro and mimo-v2.6-flash.`]},{version:`0.3.224`,date:`2026-10-09`,platforms:[`win32`,`linux`],added:[`Auto-save clipboard files and large pasted text: pasting text exceeding 10,000 characters or 300 lines automatically saves into your workspace .oonacode/tmp folder and attaches as a file without bloating the composer. Clipboard videos, audio, and large images are similarly saved and attached as local paths.`],fixed:[`Error display in chat: masked internal error codes, raw JSON, and provider balance exhaustion notices from the user chat bubble, displaying clean status indicators instead.`,`Google Antigravity pool plan access: included Gemini 3.8 Flash and 3.7 Flash across all active subscription plans (Standard, Pro, Team Standard, Team Premium, Free).`,`Session info panel: fixed an issue where switching between chats could leave stale child views mounted in the session info panel.`]},{version:`0.3.223`,date:`2026-10-09`,platforms:[`win32`,`linux`],added:[`MCP Servers settings & Antigravity catalog: configure stdio, sse, and http Model Context Protocol servers in File -> Settings -> MCP Servers. Choose from a rich directory of popular providers (PostgreSQL, Supabase, Redis, SQLite, MongoDB Atlas, GitHub, GitLab, Sentry, Cloudflare, Slack, Notion, Linear, PostHog, Brave Search) or add custom servers.`,`TopBar MCP badge: see your configured MCP servers count at a glance next to the Bug Report button, and click to open MCP settings directly.`,`Per-chat MCP server toggles: selectively enable or disable configured MCP servers per conversation in the composer toolbar to eliminate prompt token overhead.`],fixed:[]},{version:`0.3.222`,date:`2026-10-09`,platforms:[`win32`,`linux`],added:[],fixed:[`Chat summary "About": increased housekeeper output token headroom to prevent thinking and verbose models (e.g. Qwen, Gemini) from exceeding the token ceiling and failing with "Claude's response exceeded the 700 output token maximum".`]},{version:`0.3.221`,date:`2026-10-09`,platforms:[`win32`,`linux`],added:[`Web search for every model: all models can now search the web via keyless local DuckDuckGo search from your PC, with no extra credentials or credits needed.`,`Claude Haiku 5.5: available with 1M context, 128K output, and tiered pricing (replaces Haiku 4.5).`],fixed:[`Deleting a chat immediately frees its pool seat on the server, instead of keeping it held until the session cache window expires.`,`Session info panel headers: distinct icons for About (sparkle) and Scheduled tasks (bell) so sections no longer repeat the same info glyph.`,`Large sessions resume faster and safer with reverse-bounded transcript loading and auto-trimming to disk.`,`Gemini content safety filter blocks are now caught by safeguard fallback and retried on the fallback model.`]},{version:`0.3.220`,date:`2026-10-07`,platforms:[`win32`,`linux`],added:[],fixed:[`A chat on a Google Claude model no longer stops with “Autocompact is thrashing”. Its window was set to 100,000 tokens, so the chat compacted again right after every compaction and the engine gave up; it is now 200,000, and if the engine ever gives up this way the next message starts from a shorter history instead of repeating the same state.`]},{version:`0.3.219`,date:`2026-10-07`,platforms:[`win32`,`linux`],added:[`Pictures: ask any chat for an image — “generate a realistic tiger fighting a crocodile” — and it now makes one, with any model, the way Google’s Antigravity does. The picture is saved in the chat’s folder and shown right in the chat; click it for the full viewer. It costs a few OonaCode credits per picture, you can edit a picture file from the folder too, and it can be switched off in the Tools menu (Images).`,`The Google Claude models (typed by exact id in the model picker’s Custom model row) show their real 100,000-token window in the session panel, and the chat now compacts before the limit instead of being refused and re-sent.`],fixed:[`Google-hosted Claude and Gemini chats re-used almost none of Google’s prompt cache, so big chats ate the 5-hour window in minutes. They now reuse about 98 % of the prompt, which makes them far cheaper and faster.`,`The hidden /setcustommodel command and the admin custom-model tool are gone — the model picker’s Custom model row does the same job.`]},{version:`0.3.218`,date:`2026-10-07`,platforms:[`win32`,`linux`],added:[`Connectors: Supabase, Railway and Vercel in the Tools menu. Sign in once with the service’s own page, switch the connector on in a chat, and the agent can look at your projects, databases, logs and deployments. It is read-only until you turn on “Allow changes”, and then it asks you before every change; purchases, billing and secret or key readers are never offered. Each shows whether the service’s command-line tool is installed and can add the vendor’s own skills. In the terminal: oona connectors. Guide: /docs/connectors.`,`Hover a “Read …png” line in the chat and the picture shows at once; click the picture for the full viewer with zoom, like a picture you sent.`],fixed:[`A chat that was compacted no longer reopens showing only what came after its last compaction: the whole history is there again.`,`The message navigator always shows at least four lines, and its list no longer vanishes while the pointer crosses the gap to it.`]},{version:`0.3.217`,date:`2026-10-07`,platforms:[`darwin`],added:[`Pictures you attach open large: click one in the box or in a sent message for a viewer with zoom (buttons, wheel, drag, Fit and 100 %). Click a PDF or text file and it opens in its own program.`,`When a model refuses a message on safety grounds, OonaCode retries it once on another model and says so in the chat. Choose how in Settings → Safeguards: switch automatically, always switch to a model you pick, or never — with a fallback for each model. The same in the terminal: oona settings safeguard-fallback and --fallback-model. Works for Claude, Gemini and Google’s agy.`,`The terminal signs in two ways: your OonaCode account (through your browser) or an OonaCode API key. A fresh oona asks which; oona login --api-key-stdin stores a key for scripts, oona whoami says which one is in use, and oona logout removes it. The terminal manual is on the website: /docs/cli.`,`The conversations badge reads like the agents badge — “3 conversations · 1 active” — and the Conversations window lists every limit: messages, tokens, credits, depth, rates and the idle close.`,`A chat can start a new chat for you on another provider, model, effort or project — it asks you first, and a chat that was itself started by a chat cannot start more.`,`The message navigator’s list shows each message’s date and opens on your latest one; messages further back than 5,000 lines are greyed.`],fixed:[`A chat that was compacted no longer reopens showing only what came after its last compaction: the whole history is there again.`,`The message navigator always shows at least four lines, and its list no longer vanishes while the pointer crosses the gap to it. A click on it now takes you to older messages even while the chat is still replying (the page used to jump straight back).`,`oona: a wrong command or flag now exits with code 2, oona sessions list no longer breaks on multi-line titles, piping oona into head no longer prints an error, and the plain-prompt mode can send a message again.`,`One-shot terminal runs reuse the engine already on the Mac instead of downloading it every time, and a model you typed with /model that is not in the picker keeps its name after OonaCode restarts.`]},{version:`0.3.216`,date:`2026-10-07`,platforms:[`win32`,`linux`],added:[`The terminal signs in two ways: your OonaCode account (through your browser) or an OonaCode API key. A fresh oona asks which; oona login --api-key-stdin stores a key for scripts and servers, oona whoami says which one is in use, and oona logout removes it. The key is sealed by the host and never written to the terminal’s config.`,`The terminal manual is on the website: /docs/cli, written from commands run on Debian and Ubuntu servers.`],fixed:[`oona: a wrong command or flag now exits with code 2, oona sessions list no longer breaks on multi-line titles, piping oona into head no longer prints an error, and the plain-prompt mode can send a message again.`,`One-shot terminal runs reuse the engine already on the PC instead of downloading it every time.`,`A model you typed with /model that is not in the picker keeps its name after OonaCode restarts.`]},{version:`0.3.215`,date:`2026-10-07`,platforms:[`win32`,`linux`],added:[`Pictures you attach open large: click one in the box or in a sent message for a viewer with zoom (buttons, wheel, drag, Fit and 100 %). Click a PDF or text file and it opens in its own program.`,`When a model refuses a message on safety grounds, OonaCode retries it once on another model and says so in the chat. Choose how in Settings → Safeguards: switch automatically, always switch to a model you pick, or never — with a fallback for each model. The same in the terminal: oona settings safeguard-fallback and --fallback-model. Works for Claude, Gemini and Google’s agy.`,`The conversations badge reads like the agents badge — “3 conversations · 1 active” — and the Conversations window lists every limit: messages, tokens, credits, depth, rates and the idle close.`,`A chat can start a new chat for you on another provider, model, effort or project — it asks you first, and a chat that was itself started by a chat cannot start more.`,`The message navigator’s list shows each message’s date and opens on your latest one; messages further back than 5,000 lines are greyed.`],fixed:[`A click on the message navigator now takes you to older messages even while the chat is still replying (the page used to jump straight back).`,`The message navigator no longer touches the message times, and its lines are darker and longer.`]},{version:`0.3.214`,date:`2026-10-06`,platforms:[`darwin`],added:[`OonaCode runs natively on Apple Silicon Macs. The installer picks the Apple Silicon build by itself, and an Apple Silicon Mac that had the Intel one moves to it on its next install or update — the Intel build cannot run there on macOS 14 or older.`,`A message navigator on every chat: the small stack of lines at the middle-right of the chat is your own messages — rest on it, focus it or tap it and the list of everything you sent opens; click one and the chat scrolls straight to it.`],fixed:[`On an Apple Silicon Mac with macOS 14 or older, every chat crashed (“CPU lacks AVX support”) and Update did nothing. If yours did, run once in Terminal: curl -fsSL https://oonacode.oonak.ai/install.sh | bash`,`When an update cannot start, the app now says why and what to run instead of saying “Updating OonaCode…” while nothing happens.`,`File → Export chats… no longer freezes the window under a Save panel: the zip goes straight into Downloads and Finder shows it.`]},{version:`0.3.213`,date:`2026-10-06`,added:[`A message navigator on every chat: the small stack of lines at the middle-right of the chat is your own messages — rest on it, focus it or tap it and the list of everything you sent opens; click one and the chat scrolls straight to it. Escape closes the list.`],fixed:[],platforms:[`win32`,`linux`]},{version:`0.3.212`,date:`2026-10-06`,added:[`Headless one-shot runs without signing in: --api-key (or OONACODE_API_KEY) bills the run through the gateway on that OonaCode key — held in memory for the run only, never stored. For containers and CI.`],fixed:[`A keyed run no longer stops at the device-link screen, and no longer dies with "the OonaCode pool needs your OonaCode account": the key now also covers provider routing and the registry read on a machine that was never signed in.`],platforms:[`win32`,`linux`]},{version:`0.3.211`,date:`2026-10-06`,added:[`A message navigator on every chat: the small stack of lines at the middle-right of the chat is your own messages — rest on it and the list of everything you sent opens; click one and the chat scrolls straight to it.`,`One-shot runs without signing in: --api-key (or OONACODE_API_KEY) bills the run through the gateway on that OonaCode key — held in memory for the run only, never stored. For headless machines and containers.`],fixed:[],platforms:[`linux`]},{version:`0.3.210`,date:`2026-10-05`,added:[`Use a project folder opens on the folder the chat runs in — its project, or the workspace OonaCode made for it — instead of an empty box.`],fixed:[`Send now on one queued message no longer makes the other queued messages look sent: they stay under the chat, each with its own Send now, and get their tick when the agent reads them.`,`After you confirm the agent’s request to move a chat to another folder, the chat shows the new folder at once, not only after your next message.`]},{version:`0.3.209`,date:`2026-10-05`,platforms:[`win32`,`darwin`],added:[`Scheduled tasks say which model a run uses: always the chat’s model at the moment the task fires, named in the Scheduled tasks panel.`],fixed:[`A Google Gemini chat keeps Google’s agent running for half an hour between messages, so the next message after a pause no longer waits about four seconds for agy to start.`,`Commands run in a Google Gemini chat reach servers on your own PC (localhost) and plain http:// sites again.`]},{version:`0.3.209`,date:`2026-10-05`,platforms:[`linux`],added:[`Grok 4.7, xAI’s newest model, on the OonaCode pool and on your own SuperGrok subscription — and an effort picker for Grok 4.7, 4.6 and 4.5 (low, medium, high, extra high), sent the way xAI’s own Grok CLI sends it.`,`Every provider in the model picker shows its own logo — Google’s Gemini mark for Google, xAI’s for your SuperGrok, OpenAI’s for your ChatGPT plan, Z.ai’s for GLM — instead of two letters.`,`Scheduled tasks say which model a run uses: always the chat’s model at the moment the task fires, named in the Scheduled tasks panel.`],fixed:[`When a subscription behind the OonaCode pool refuses or fails a request, the same request is answered at once from the provider’s API key instead of showing you the error.`,`Grok on your own SuperGrok subscription and on the OonaCode pool works again: xAI started refusing the Grok CLI identity OonaCode presented as outdated.`,`When your own subscription’s sign-in stops working, the chat now says so and asks you to sign in again, instead of a confusing “own-subscription providers run directly to the provider” error.`,`A Google Gemini chat keeps Google’s agent running for half an hour between messages, so the next message after a pause no longer waits about four seconds for agy to start.`,`Commands run in a Google Gemini chat reach servers on your own PC (localhost) and plain http:// sites again.`]},{version:`0.3.208`,date:`2026-10-04`,platforms:[`win32`,`darwin`],added:[`Grok 4.7, xAI’s newest model, on the OonaCode pool and on your own SuperGrok subscription — and an effort picker for Grok 4.7, 4.6 and 4.5 (low, medium, high, extra high), sent the way xAI’s own Grok CLI sends it.`,`Every provider in the model picker shows its own logo — Google’s Gemini mark for Google, xAI’s for your SuperGrok, OpenAI’s for your ChatGPT plan, Z.ai’s for GLM — instead of two letters.`],fixed:[`When a subscription behind the OonaCode pool refuses or fails a request, the same request is answered at once from the provider’s API key instead of showing you the error.`,`Grok on your own SuperGrok subscription and on the OonaCode pool works again: xAI started refusing the Grok CLI identity OonaCode presented as outdated.`,`When your own subscription’s sign-in stops working, the chat now says so and asks you to sign in again, instead of a confusing “own-subscription providers run directly to the provider” error.`]},{version:`0.3.207`,date:`2026-10-04`,added:[`Every chat lists every provider you have connected and the OonaCode pool — Google Gemini too, whatever the chat ran on before. Switching keeps the conversation: a chat moving off Google continues with its whole history, and a chat moving onto Google gives Google’s agent the conversation so far, so it can carry on.`],fixed:[`Two messages sent a moment apart while a chat was starting no longer leave one of them stuck in the queued strip: the engine had read them together as one message, and OonaCode now recognises that.`]},{version:`0.3.206`,date:`2026-10-04`,platforms:[`win32`],added:[`Google Gemini installs Google’s agy by itself the first time you use it — open the provider in Settings → Providers, or send a message to a Google Gemini chat — instead of waiting for you to press Install.`],fixed:[`Deleting a chat now says what really happens: a chat is kept only on the PC it runs on, so deleting it there removes it everywhere.`,`oona doctor no longer tells you to change settings that OonaCode stopped reading.`]},{version:`0.3.206`,date:`2026-10-04`,platforms:[`linux`],added:[`Gemini on your own Google plan, through Google’s own agent. Open Settings → Providers → Google Gemini: OonaCode downloads Google’s agy for you and checks it. Then press Sign in with Google, sign in on Google’s own page and paste the one-time code back within the minute agy allows. OonaCode never sees your password. Every model your Google plan offers through agy is listed — Gemini 3.8, 3.7 and 3.6 Flash, Gemini 3.1 Pro, and Claude Opus 5.5, Claude Sonnet 5.5 and GPT-OSS 120B marked “via Google”. A Google Gemini chat runs Google’s agent as it is (Build or Autonomous mode, text only), and the chat’s info panel lists every request it made to Google.`,`Every provider in the model picker ends with a “Custom model…” row: type any model id and the chat runs it on that provider.`],fixed:[`The agents badge highlights what is happening now: “4 working” is blue and the total is grey.`,`Deleting a chat now says what really happens: a chat is kept only on the PC it runs on, so deleting it there removes it everywhere.`]},{version:`0.3.206`,date:`2026-10-04`,platforms:[`darwin`],added:[`Gemini on your own Google plan, through Google’s own agent. Open Settings → Providers → Google Gemini: OonaCode downloads Google’s agy for you and checks it. Then press Sign in with Google, sign in on Google’s own page and paste the one-time code back within the minute agy allows. OonaCode never sees your password. Every model your Google plan offers through agy is listed — Gemini 3.8, 3.7 and 3.6 Flash, Gemini 3.1 Pro, and Claude Opus 5.5, Claude Sonnet 5.5 and GPT-OSS 120B marked “via Google”. A Google Gemini chat runs Google’s agent as it is (Build or Autonomous mode, text only), and the chat’s info panel lists every request it made to Google.`,`Every provider in the model picker ends with a “Custom model…” row: type any model id and the chat runs it on that provider.`],fixed:[`The agents badge highlights what is happening now: “4 working” is blue and the total is grey.`,`The command line’s reinstall hint on a Mac is the one that works: curl -fsSL https://oonacode.oonak.ai/install.sh | bash.`]},{version:`0.3.205`,date:`2026-10-04`,platforms:[`win32`],added:[`Google Gemini now lists every model your Google plan offers through agy, not only Gemini: Claude Opus 5.5, Claude Sonnet 5.5 and GPT-OSS 120B (marked “via Google”) sit beside Gemini 3.8, 3.7 and 3.6 Flash and Gemini 3.1 Pro. They run on Google’s own agent with your Google plan, and have their own usage window.`],fixed:[]},{version:`0.3.204`,date:`2026-10-04`,platforms:[`win32`],added:[`Signing in to Google Gemini opens Google’s page for you and shows how many seconds are left: Google’s agy waits only one minute for the sign-in. Paste the code Google shows and it is sent at once.`],fixed:[`Signing in to Google Gemini finishes. The code you pasted never reached Google’s agy in the installed app (the window it types into dropped everything typed), so the sign-in waited out its minute and failed.`,`The Claude sign-in’s “paste the code” box, which used the same window, can type the code too.`]},{version:`0.3.203`,date:`2026-10-04`,platforms:[`win32`],added:[`Gemini on your own Google plan, through Google’s own agent. Open Settings → Providers → Google Gemini and press Install: OonaCode downloads Google’s agy for you and checks it. Then press Sign in with Google, sign in on Google’s own page and paste the one-time code back here. OonaCode never sees your password. A Google Gemini chat runs Google’s agent as it is (Build or Autonomous mode, text only, no pictures), and the chat’s info panel lists every request it made to Google.`,`Every provider in the model picker ends with a “Custom model…” row: type any model id and the chat runs it on that provider.`],fixed:[`The agents badge highlights what is happening now: “4 working” is blue and the total (“51 agents”) is grey, instead of the other way round.`]},{version:`0.3.202`,date:`2026-10-03`,platforms:[`darwin`],added:[`OonaCode runs on macOS 12 or newer: the agent, your chats, the background service and the desktop app, installed with the same one line as on Linux — curl -fsSL https://oonacode.oonak.ai/install.sh | bash. An Intel build; Apple Silicon Macs run it through Rosetta 2. Your sign-in key is kept in your login keychain.`,`Updating is the same line again, oona update in a terminal, or the update button in the app: it closes OonaCode, puts the new version in place and opens it again. The app is not signed by Apple yet, so it cannot be downloaded from a browser and does not update itself the way it does on Windows.`],fixed:[]},{version:`0.3.202`,date:`2026-10-03`,platforms:[`linux`],added:[],fixed:[`Your sign-in survives a restart on a PC that keeps OonaCode’s key in the login keyring (GNOME Keyring, KWallet): two of OonaCode’s keys shared one keyring entry and overwrote each other, and every start of the host wrote over the stored key — so after a restart you could find yourself signed out.`,`OonaCode never runs a Claude Code you installed yourself as its engine, even when it sits in the same folder as the Node.js that runs OonaCode (an nvm folder, for example).`,`oona update installs from the site your OonaCode was installed from, not always from oonacode.oonak.ai.`]},{version:`0.3.202`,date:`2026-10-03`,platforms:[`win32`],added:[],fixed:[`OonaCode never runs a Claude Code you installed yourself as its engine, even when it sits in the same folder as the Node.js that runs OonaCode.`]},{version:`0.3.201`,date:`2026-10-03`,added:[`The Tools menu lists only tools that work. Desktop control, Clipboard, Screen capture and Run as administrator were demos that never ran anything, and they are gone: the agent already reads and sets your clipboard, takes screenshots and asks Windows for administrator rights through its own commands.`],fixed:[`Oonak Browser keeps working when its window is behind other windows. A browser covered by the OonaCode window used to crawl, and some clicks and scrolls gave up after 30 seconds.`,`Oonak Browser no longer clicks a hidden copy of a link, or a link inside a closed menu, when a site has both a visible and a hidden one.`,`A message you send right after a reply failed no longer stays pinned above the box as “queued” once the agent has read it.`]},{version:`0.3.200`,date:`2026-10-03`,platforms:[`win32`],added:[`Everything OonaCode shows you is in credits, never in dollars: the model picker gives what an OonaCode pool model charges per 1M tokens in credits, and a chat’s spend, Usage, Conversations, Listen and the terminal all count credits. A chat on your own key or your own subscription says so instead of a price.`],fixed:[`Oonak Browser works on sites built from web components, Google’s own forms among them: it reads, finds, clicks and types inside them, where it used to answer “the page changed” or find nothing.`,`The model’s questions appear only in their own window: the chat no longer shows the question’s raw text while you answer, and afterwards keeps one line — “You answered 3 questions” — that opens to your answers.`]},{version:`0.3.200`,date:`2026-10-03`,platforms:[`linux`],added:[`Your chats now live only on the PC that runs them. Your phone, the website and your other PCs read a chat straight from its PC, through the same encrypted connection they use to continue it — OonaCode’s server no longer keeps any copy. While a PC is off or asleep its chats cannot be read from elsewhere; the window says so and they come back when it is online. Update OonaCode on each of your PCs: another device reads a PC’s chats only once that PC runs this version.`,`Everything OonaCode shows you is in credits, never in dollars: the model picker gives what an OonaCode pool model charges per 1M tokens in credits, and a chat’s spend, Usage, Conversations, Listen and the terminal all count credits. A chat on your own key or your own subscription says so instead of a price.`,`Listen has one button: Play. It writes a summary when the chat has none or has moved on, translates it once when you pick a new language, or just plays — saying only “Generating…” or “Translating…” while it works. A summary written in the last ten minutes is used for every language, so switching language never writes it again.`,`A morning briefing in View → What chats are about…: show the chats active in the last 24 hours, 3, 7, 10 or 30 days (or your own dates), tick the ones you want — or all — pick a language, a voice and a speed, and press Play. OonaCode reads each chat’s name and what it is about, one after another, with Next, Previous, Pause and Stop.`,`A chat can offer to move a task to a new chat. When a task deserves its own chat — a separate job, a chat that has grown long, work in another folder — the model proposes it with the first message written out; you can edit it, then Start new chat opens the new chat in a tab, sends the message and carries on there. Nothing starts without your yes.`,`Talk to other chats: a chat can now write to a chat whose switch is off. That chat’s switch stays off and it gets no new tools — it can only answer the chat that wrote to it. Finding a chat by name matches each word, in its name, project, folder and description, and spelling like “AI-control” or “aicontrol” no longer matters.`,`Oonak Browser acts like a person: every click, keystroke and scroll is a real input event, so sites that ignore scripted clicks now respond, and it works inside web components, Google’s own forms among them. Typing into a drop-down picks the option, and typing into an editor adds the text at its end.`,`Scheduled shows at a glance what will still run: paused tasks and one-time tasks that have already run are greyed out, with the day they will be removed — 10 days after their last change.`,`Settings → Developer → Allow debugging: opens a debugging port on this PC only, so a developer can look at and drive the app while fixing a problem with you. Off by default; while it is on, every window shows a red “Debugging on” badge.`],fixed:[`A chat keeps its Build / Plan / Ask first / Autonomous choice, and every device shows the same one. A chat set to “Ask first” now asks you before acting even when this PC answers prompts by itself.`,`A chat no longer ends up on a model nobody picked for it: a model the provider does not offer is refused instead of quietly switching the chat to the provider’s default, and Enter in the model picker no longer picks the row under the mouse pointer.`,`Chats talking to each other no longer ping-pong: a reply needs no answer, several messages from the same chat are read together in one turn, and a message card says “answer requested” until the answer has gone back, then “answered” with the time.`,`A tool you switch on while a chat is replying works for the message you send next, even mid-reply. After an update, a chat that had background tasks running shows one line saying how many stopped, instead of one card per task.`,`The model’s questions appear only in their own window: the chat no longer shows the question’s raw text while you answer, and afterwards keeps one line — “You answered 3 questions” — that opens to your answers.`,`A model your plan does not include now says “not in your plan”, instead of “Failed to authenticate … sign-in needed”.`,`A long message waiting in the queue no longer hides its “Send now” button: it is folded to a few lines, with Show all to read the rest.`,`The account window no longer stays on “offline · vault event stream responded 503” after a short server interruption.`]},{version:`0.3.199`,date:`2026-10-02`,platforms:[`win32`],added:[`Talk to other chats: a chat can now write to a chat whose switch is off. That chat’s switch stays off and it gets no new tools — it can only answer the chat that wrote to it. Finding a chat by name is smarter too: each word is matched, in its name, project, folder and description, and spelling like “AI-control” or “aicontrol” no longer matters.`,`Oonak Browser acts like a person: every click, keystroke and scroll is a real input event, so sites that ignore scripted clicks now respond. Typing into a drop-down picks the option, and typing into an editor adds the text at its end.`],fixed:[`A chat no longer ends up on a model nobody picked for it: a model the provider does not offer is refused instead of quietly switching the chat to the provider’s default, and Enter in the model picker no longer picks the row under the mouse pointer.`]},{version:`0.3.198`,date:`2026-10-01`,platforms:[`win32`],added:[`Listen has one button: Play. It writes a summary when the chat has none or has moved on, translates it once when you pick a new language, or just plays — saying only “Generating…” or “Translating…” while it works. A summary written in the last ten minutes is used for every language, so switching language never writes it again.`],fixed:[`A chat keeps its Build / Plan / Ask first / Autonomous choice, and every device shows the same one — the phone used to show “Ask first” for a Build chat. A chat set to “Ask first” now asks you before acting even when this PC answers prompts by itself.`,`Play in Listen is never greyed out for want of a voice: it gets the text ready and names the voice to install.`]},{version:`0.3.197`,date:`2026-10-01`,platforms:[`win32`],added:[`Oonak Browser, the browser your chats use, moves to version 151 by itself at its next use: a build with no Google services (no Safe Browsing warnings, push notifications or search suggestions). The download is checked against its fingerprint before anything is unpacked, and the old version is removed once no chat’s browser still runs from it.`],fixed:[`A model your plan does not include now says “not in your plan”, instead of “Failed to authenticate … sign-in needed”.`]},{version:`0.3.196`,date:`2026-10-01`,platforms:[`win32`],added:[`Your chats now live only on the PC that runs them. Your phone, the website and your other PCs read a chat straight from its PC, through the same encrypted connection they use to continue it — OonaCode’s server no longer keeps any copy. While a PC is off or asleep its chats cannot be read from elsewhere; the window says so and they come back when it is online. Update OonaCode on each of your PCs: another device reads a PC’s chats only once that PC runs this version.`],fixed:[`The account window no longer stays on “offline · vault event stream responded 503” after a short server interruption: the next sync that works clears it by itself.`]},{version:`0.3.195`,date:`2026-10-01`,platforms:[`win32`],added:[],fixed:[`Chats talking to each other no longer ping-pong. A message asks for an answer only when the chat really needs one; a reply needs no answer and is not answered with a new message; and several messages waiting from the same chat are read together in one turn. Fewer wake-ups, fewer tokens.`,`A message card says what is true: “answer requested” until the answer has gone back, then “answered” with the time — instead of an orange “reply expected” that never went away.`]},{version:`0.3.194`,date:`2026-10-01`,platforms:[`win32`],added:[`A chat can offer to move a task to a new chat. When a task deserves its own chat — a separate job, a chat that has grown long, work in another folder — the model proposes it with the first message written out; you can edit it, then Start new chat opens the new chat in a tab, sends the message and carries on there. Nothing starts without your yes.`,`Settings → Developer → Allow debugging: opens a debugging port on this PC only, so a developer can look at and drive the app while fixing a problem with you. Off by default; while it is on, every window shows a red “Debugging on” badge.`],fixed:[]},{version:`0.3.193`,date:`2026-10-01`,platforms:[`win32`],added:[],fixed:[`A tool you switch on while a chat is replying works for the message you send next, even mid-reply: that message now waits for the chat to restart with the new tool instead of reaching the model without it.`,`After an update, a chat that had background tasks running shows one line — “11 background tasks stopped — they were running when OonaCode restarted this chat” — instead of one card per task. Click it to see each one.`]},{version:`0.3.192`,date:`2026-09-30`,platforms:[`win32`],added:[`A morning briefing in View → What chats are about…: show the chats active in the last 24 hours, 3, 7, 10 or 30 days (or your own dates), tick the ones you want — or all — pick a language, a voice and a speed, and press Play. OonaCode reads each chat’s name and what it is about, one after another, with Next, Previous, Pause and Stop. Other languages are translated once and kept, so hearing the same briefing again costs nothing.`],fixed:[]},{version:`0.3.191`,date:`2026-09-30`,platforms:[`win32`],added:[`Scheduled shows at a glance what will still run: paused tasks and one-time tasks that have already run are greyed out, with the day they will be removed. They are deleted by themselves 10 days after their last change; resuming or editing a paused task gives it another 10 days.`],fixed:[]},{version:`0.3.190`,date:`2026-09-30`,platforms:[`win32`],added:[],fixed:[`A long message waiting in the queue no longer hides its “Send now” button: it is folded to a few lines, with Show all to read the rest.`]},{version:`0.3.189`,date:`2026-09-30`,platforms:[`linux`],added:[`Split views, like VS Code: drag a chat tab to the left, right, top or bottom of the chat area to open it beside the other one — a shaded area shows where it will land. Every chat on screen works on its own, with its own replies streaming and its own message box. Drag the divider to resize; Ctrl+\\ splits the current tab to the right, Ctrl+1, Ctrl+2… jump between views, and a tab’s menu has Split right, Split down and Move to other group.`,`Chats in windows of their own, like Chrome tabs: drag a tab out of the window, or choose “Move to new window” in its menu, and it opens in its own window; “Move to main window” brings it back. On Wayland desktops the new window opens at the usual place rather than under the pointer. Your split views and windows come back when you restart OonaCode.`,`Every language plays in Listen to a chat: each language picks the best voice on its own — OonaCode’s Armenian voices first, then your system’s voices, then eSpeak (install the espeak-ng package if your system has no voice for a language).`],fixed:[`Picking another language for a summary no longer needs a new summary: Play translates the one you have, keeps the translation, shows it and plays it.`,`“Summarise now” says “Up to date — nothing to summarise” while the chat has not changed, instead of seeming to do nothing.`]},{version:`0.3.188`,date:`2026-09-30`,platforms:[`win32`],added:[`Split views, like VS Code: drag a chat tab to the left, right, top or bottom of the chat area to open it beside the other one — a shaded area shows where it will land. Every chat on screen works on its own, with its own replies streaming and its own message box. Drag the divider to resize; Ctrl+\\ splits the current tab to the right, Ctrl+1, Ctrl+2… jump between views, and a tab’s menu has Split right, Split down and Move to other group.`,`Chats in windows of their own, like Chrome tabs: drag a tab out of the window, or choose “Move to new window” in its menu, and it opens in its own window. Drag it back onto the main window’s tabs, or choose “Move to main window”, to bring it back. Your split views and popped-out windows come back when you restart OonaCode.`],fixed:[]},{version:`0.3.187`,date:`2026-09-30`,platforms:[`win32`],added:[`Every language plays in Listen to a chat. Persian, Georgian, Ukrainian — and any language whose Windows voice is not installed — now speak with eSpeak, a free voice that comes with OonaCode (it sounds robotic, but it always works). Each language picks the best voice on its own: OonaCode’s Armenian voices first, then Windows’ own, then eSpeak.`],fixed:[`Picking another language for a summary no longer needs a new summary: Play translates the one you have, keeps the translation, shows it and plays it.`,`“Summarise now” says “Up to date — nothing to summarise” while the chat has not changed, instead of seeming to do nothing.`]},{version:`0.3.186`,date:`2026-09-30`,platforms:[`linux`],added:[`Listen to a chat: right-click a chat → Listen to this chat…, or the speaker button beside the chat’s title. The chat’s own model writes a short spoken summary — the goal, what was done, where it stands, what is left — and OonaCode reads it aloud on this PC, in the voice and at the speed you choose. Every summary is kept with its date, so you can play it again at any time; a new one is written only when the chat has moved on. Other languages are translated once and kept with the summary.`,`OonaCode brings two Armenian voices of its own, Astgh and Artsiv, and also speaks with your system’s voices through speech-dispatcher — install speech-dispatcher and espeak-ng for Persian, Russian and every other language; the Listen window names the packages for your distribution.`,`Listen to a chat from your phone: the OonaCode app’s 🔊 Listen reaches this PC’s summaries and plays them with the phone’s own voices. It needs this update on the PC and the next OonaCode app on the phone.`,`See where your credits go: Account → Usage. Pick the last 24 hours, 7, 30 or 90 days or your own dates, by hour or by day, for the coding agent or your API keys apart. A chart shows the credits over time by model or by what they were for, and the lists below give every model with its tokens and price, and every use — chat turns, a chat’s “about”, images, speech and the rest.`,`The chat list is laid out like the Claude desktop app: New, Projects, Scheduled, then your pinned chats and projects, then Today and Older. The old grouping by project is one click away — the small icon beside “Today”.`,`Projects opens a page of project cards — each with its goal, its chats and when it was last used — with search, sort and New project. Click a card to see that project’s chats, instructions and settings, and to start a new chat in it.`,`Scheduled shows every scheduled task from every chat on this PC in one place, with its next run, its chat, and pause, resume and delete. Pin any chat or project to the top of the list from its menu.`,`Claude Sonnet 5.5 is in the model picker — on the OonaCode pool and on your own Claude subscription — with a 1M-token context. It costs the same as Sonnet 5 per token and usually needs fewer tokens for the same work.`,`Type / at the start of a message to see the chat’s commands and skills, with what each does, in two titled sections. Type to narrow the list, then Enter or Tab. They work with every model, not only Claude.`,`Each chat has a Skills list beside Tools. Every skill starts off, so the model sees none of them and they cost nothing; switch one on to let the model use it by itself in that chat. Typing /name still runs any skill for one turn.`,`Your own skills: Settings → Skills lists the skills OonaCode gives every chat, and “Import from Claude Code…” copies the ones you choose from your Claude Code install — it only reads it, never changes it.`,`In the terminal app (oona), a command the chat’s engine knows — /context, /compact or a skill — now runs instead of answering “unknown command”.`,`Search in the Import window: find a chat by its name, its first or last message or its folder, or pick “Whole conversations” to search inside the chats themselves.`],fixed:[`Import chats shows every chat on this PC, grouped by the app it came from, with nothing folded away. Each row says whether it is new, already imported, moved on since, or deleted by you in OonaCode. Nothing is ticked when you open it yourself: search for a chat and tick it, or tick a whole group at once.`,`The message box fits a narrow chat: its buttons and pickers move onto a second line and the box grows to hold them — Stop and Queue no longer slip outside it.`,`Claude’s thoughts show their words again. Every “Thought” from Claude Opus, Sonnet and Fable came back empty — Anthropic leaves the text out unless it is asked for a summary, and now OonaCode asks. Only new replies change.`,`A chat’s “about” no longer starts in the middle of a sentence when the model wrote a long answer.`,`Commands that only duplicated OonaCode’s own controls or showed misleading numbers are gone from the / menu — /model, /usage, /autocompact, /output-style, /mcp, /list-agents and /reload-skills. Typed, they say why.`,`Skills you import or remove in Settings → Skills reach your chats by themselves, at each chat’s next message.`,`Claude Sonnet 5 is retired: a chat that was on it moves to Sonnet 5.5 at its next message.`,`The engine’s built-in keyboard-shortcuts helper is turned off: it would have edited your own Claude Code settings.`,`Typing /model in a chat updates the chat’s model and the model picker again, and command output such as /context reads the same while it arrives and after you reopen the chat.`,`A chat row’s ⋯ button shows only when you point at the row.`]},{version:`0.3.185`,date:`2026-09-30`,platforms:[`win32`],added:[`Listen to a chat from your phone: the OonaCode app’s 🔊 Listen reaches this PC’s summaries and plays them with the phone’s own voices. It needs this update on the PC and the next OonaCode app on the phone.`],fixed:[`Listening with a Windows voice no longer stops after the first sentence when the voice fails to say it has finished.`]},{version:`0.3.184`,date:`2026-09-30`,platforms:[`win32`],added:[`Listen to a chat: right-click a chat → Listen to this chat…, or the speaker button beside the chat’s title. The chat’s own model writes a short spoken summary — the goal, what was done, where it stands, what is left — and OonaCode reads it aloud on this PC, in the voice and at the speed you choose. Every summary is kept with its date, so you can play it again at any time; a new one is written only when the chat has moved on. Other languages are translated once and kept with the summary.`],fixed:[`A chat’s “about” no longer starts in the middle of a sentence when the model wrote a long answer.`]},{version:`0.3.183`,date:`2026-09-30`,platforms:[`win32`],added:[`See where your credits go: Account → Usage. Pick the last 24 hours, 7, 30 or 90 days or your own dates, by hour or by day, for the coding agent or your API keys apart. A chart shows the credits over time by model or by what they were for, and the lists below give every model with its tokens and price, and every use — chat turns, a chat’s “about”, images, speech and the rest.`],fixed:[]},{version:`0.3.182`,date:`2026-09-30`,platforms:[`win32`],added:[],fixed:[`Import chats shows every chat on this PC, grouped by the app it came from — Claude Code, the Claude app, Qwen Code, Cursor — with nothing folded away. Each row says whether it is new, already imported, moved on since, or deleted by you in OonaCode. Nothing is ticked when you open it yourself: search for a chat and tick it, or tick a whole group at once. The Import button says how many chats it will bring over.`]},{version:`0.3.181`,date:`2026-09-30`,platforms:[`win32`],added:[],fixed:[`The message box fits a narrow chat. In a small window, or with the side panels open, its buttons and pickers move onto a second line and the box grows to hold them — Stop and Queue no longer slip outside it, and the model and effort pickers keep their words readable.`]},{version:`0.3.180`,date:`2026-09-30`,platforms:[`win32`],added:[],fixed:[`Claude’s thoughts show their words again. Every “Thought” from Claude Opus, Sonnet and Fable came back empty — Anthropic leaves the text out unless it is asked for a summary, and now OonaCode asks. Other models were never affected. Only new replies change; older thoughts stay empty.`]},{version:`0.3.179`,date:`2026-09-29`,platforms:[`win32`],added:[],fixed:[`The / menu is easier to read: skills and commands in two titled sections, each with one short line — the full description shows when you point at it.`,`Commands that only duplicated OonaCode’s own controls or showed misleading numbers are gone from the / menu — /model (use the model picker), /usage (the engine’s own estimate, not your credits), /autocompact, /output-style, /mcp, /list-agents and /reload-skills. Typed, they say why.`,`Skills you import or remove in Settings → Skills reach your chats by themselves, at each chat’s next message.`]},{version:`0.3.178`,date:`2026-09-29`,platforms:[`win32`],added:[`The chat list is laid out like the Claude desktop app: New, Projects, Scheduled, then your pinned chats and projects, then Today and Older. The old grouping by project is one click away — the small icon beside “Today”.`,`Projects opens a page of project cards — each with its goal, its chats and when it was last used — with search, sort and New project. Click a card to see that project’s chats, instructions and settings, and to start a new chat in it.`,`Scheduled shows every scheduled task from every chat on this PC in one place, with its next run, its chat, and pause, resume and delete. A dot on it tells you when something is due soon.`,`Pin any chat or project to the top of the list from its menu.`],fixed:[`A chat row’s ⋯ button shows only when you point at the row.`]},{version:`0.3.177`,date:`2026-09-29`,platforms:[`win32`],added:[`Claude Sonnet 5.5 is in the model picker — on the OonaCode pool and on your own Claude subscription — with a 1M-token context. It costs the same as Sonnet 5 per token and usually needs fewer tokens for the same work.`],fixed:[`Claude Sonnet 5 is retired: a chat that was on it moves to Sonnet 5.5 at its next message, and the picker shows Sonnet 5.5.`]},{version:`0.3.176`,date:`2026-09-29`,platforms:[`win32`],added:[`Each chat has a Skills list beside Tools. Every skill starts off, so the model sees none of them and they cost nothing — about 1,400 tokens on every message until now. Switch one on to let the model use it by itself in that chat; the list shows what each one costs per message while on.`,`Typing /name still runs any skill for one turn, whether its switch is on or off.`],fixed:[`The engine’s built-in keyboard-shortcuts helper is turned off: it would have edited your own Claude Code settings.`]},{version:`0.3.175`,date:`2026-09-29`,platforms:[`win32`],added:[`Type / at the start of a message to see the chat’s commands and skills — the Claude Code engine’s own (/compact, /context, /review, /security-review, /init and more) and the skills in your project’s .claude folder — with what each does. Type to narrow the list, then Enter or Tab. They work with every model, not only Claude.`,`Your own skills: Settings → Skills lists the skills OonaCode gives every chat, and “Import from Claude Code…” copies the ones you choose from your Claude Code install — it only reads it, never changes it.`,`In the terminal app (oona), a command the chat’s engine knows — /context, /compact or a skill — now runs instead of answering “unknown command”.`],fixed:[`Typing /model in a chat updates the chat’s model and the model picker again.`,`Command output such as /context reads the same while it arrives and after you reopen the chat.`]},{version:`0.3.174`,date:`2026-09-28`,platforms:[`win32`],added:[`Search in the Import window. Type to find a chat by its name, its first or last message, or its folder — chats folded away as already imported or deleted here show up too when they match. Or open the search options and pick “Whole conversations” to search inside the chats themselves, with a few lines of each match under the chat. It only reads Claude Code, Cursor and the Claude app’s files, never changes them.`],fixed:[`Chats Claude Code switched to another model are answered by that model for real: OonaCode’s pool now serves the model the engine falls back to, and never answers a Claude request with another company’s model.`]},{version:`0.3.173`,date:`2026-09-28`,platforms:[`linux`],added:[`Every chat now has an “about”: a short note, written in the background by a cheap helper model of the chat’s own provider, saying what the chat works on. Your other chats read it — with each chat’s folder and when it was last active — when they look for the right chat to ask. See it, edit it or press Regenerate in the session info panel.`,`View → What chats are about… (and a sidebar button) lists every chat’s about and what writing them cost, with a switch to turn it off and “Generate for all chats now”. The switch and its numbers are also in Settings → This PC.`,`Your phone can now do from anywhere what this PC’s window does: switch each tool on or off per chat, see and control the conversations between your chats, read, edit and regenerate each chat’s “about”, and manage scheduled tasks. It needs this update on the PC and the next OonaCode app on the phone.`,`A chat can switch its own workspace. When the work belongs in another folder — a project you name that lives elsewhere, or a new project folder — the model proposes the switch and you answer Switch or Not now. It always asks you, even with “accept automatically” on, and the chat moves when its current step ends, with the conversation kept.`,`Right-click a chat tab → Delete (in red, under “Close all tabs”) deletes that chat after asking, just like Delete in the sidebar.`,`When Anthropic’s safeguards flag a chat and Claude Code moves it to another model for the rest of the run, the model box says so in red — for example “Opus 4.8 (safeguard)” — and the chat shows a notice at the switch. Picking a model takes the chat back to it at the next message.`],fixed:[`Typing in the message box while a chat is replying is no longer interrupted. With “accept automatically” on, an approval card flashed for an instant on some tool calls and took the cursor away from the box.`,`A permission card that appears while you are typing no longer takes the keyboard, so your next Space or Enter can never press Allow by accident.`,`“Send now” stays disabled and says “Sending now…” until the agent has taken the message — it can take a few seconds while the agent stops its current step, and a second press can no longer send it twice.`,`A message sent from your phone is confirmed by this PC, and the same message is never run twice when the phone sends it again after a lost connection.`,`File and folder names in a reply get their ▶, Open and Show in folder buttons only when they really exist on this PC. A bare file name is also looked for in the folder the reply named just before it.`,`A chat can no longer be moved into your home folder or the root folder through a link. Where /home is itself a link (Fedora Silverblue, Bazzite and similar systems), the home folder passed as an ordinary folder, and the chat would have loaded your own Claude Code settings as its project.`,`Signing in to your own Claude subscription inside the app works on Ubuntu 24.04, Debian, Linux Mint, Pop!_OS and Zorin OS again. There, a part of OonaCode built for newer systems did not load, and the sign-in fell back to a command you had to paste.`,"On Ubuntu, Linux Mint, Pop!_OS, Zorin OS and similar systems, `oona` now works in every new terminal right after you install or update. The installer used to leave it off your PATH until you logged out and back in; now it adds it for new terminals itself, and `oona uninstall` takes that line out again.",`Every way of uninstalling — “oona uninstall”, or the install command with --uninstall — now takes this PC off your account: keep your chats and they stay readable on your other devices; delete them and their copies go too. It never touches your Claude Code or the Claude app, and “oona uninstall” no longer gives up when the background service is stopped.`,`The installer now says at once when a system cannot run OonaCode — one older than Ubuntu 22.04, Debian 12 or RHEL 9, or one built on musl such as Alpine — instead of installing a copy that could not start. The .deb and .rpm tell apt and dnf the same.`]},{version:`0.3.172`,date:`2026-09-28`,platforms:[`win32`],added:[`When Anthropic’s safeguards flag a chat and Claude Code moves it to another model for the rest of the run, the model box says so in red — for example “Opus 4.8 (safeguard)” — and the chat shows a notice at the switch. Picking a model takes the chat back to it at the next message.`],fixed:[`Uninstalling from Settings → Apps now also takes this PC off your account, exactly like “oona uninstall”: keep your chats and they stay readable on your other devices; delete them and their copies go too.`,`“oona uninstall” no longer gives up when the background service is stopped.`,`The “Updating OonaCode…” window shows again on the newest Windows 11 versions (24H2 and later).`]},{version:`0.3.171`,date:`2026-09-28`,platforms:[`win32`],added:[`Oonak Browser now picks its own control port from a range no developer tool uses by default, so it can no longer take a port that Shopify CLI or a dev server wants. If a program needs a particular port kept free, or you want the browser on a specific one, just ask the chat.`],fixed:[`File and folder names in a reply get their ▶, Open and Show in folder buttons only when they really exist on this PC. A bare file name is also looked for in the folder the reply named just before it.`,`Uninstalling OonaCode from Settings → Apps now removes all of it — the app, the command line and its background service — and asks whether to keep your chats. Installing again afterwards no longer says it is already installed. Your Claude Code and Claude app are never touched.`,`“oona uninstall” works again on Windows 11.`,`A chat “about” you wrote yourself no longer shows “stale”.`]},{version:`0.3.170`,date:`2026-09-28`,platforms:[`win32`],added:[`Your phone can now do from anywhere what this PC’s window does: switch each tool on or off per chat, see and control the conversations between your chats, read, edit and regenerate each chat’s “about”, and manage scheduled tasks. It needs this update on the PC and the next OonaCode app on the phone.`],fixed:[`“Send now” stays disabled and says “Sending now…” until the agent has taken the message — it can take a few seconds while the agent stops its current step, and a second press can no longer send it twice.`,`A message sent from your phone is confirmed by this PC, and the same message is never run twice when the phone sends it again after a lost connection.`]},{version:`0.3.169`,date:`2026-09-28`,platforms:[`win32`],added:[`Every chat now has an “about”: a short note, written in the background by a cheap helper model of the chat’s own provider, saying what the chat works on. Your other chats read it — with each chat’s folder and when it was last active — when they look for the right chat to ask. See it, edit it or press Regenerate in the session info panel.`,`View → What chats are about… (and a sidebar button) lists every chat’s about and what writing them cost, with a switch to turn it off and “Generate for all chats now”. The switch and its numbers are also in Settings → This PC.`],fixed:[`A chat can no longer be moved into your user folder or a drive root through a link or junction that points there — its project settings would have been your own Claude Code settings.`]},{version:`0.3.167`,date:`2026-09-27`,platforms:[`win32`],added:[`A chat can switch its own workspace. When the work belongs in another folder — a project you name that lives elsewhere, or a new project folder — the model proposes the switch and you answer Switch or Not now. It always asks you, even with “accept automatically” on, and the chat moves when its current step ends, with the conversation kept.`],fixed:[]},{version:`0.3.166`,date:`2026-09-27`,platforms:[`win32`],added:[],fixed:[`Typing in the message box while a chat is replying is no longer interrupted. With “accept automatically” on, an approval card flashed for an instant on some tool calls and took the cursor away from the box.`,`A permission card that appears while you are typing no longer takes the keyboard, so your next Space or Enter can never press Allow by accident.`]},{version:`0.3.165`,date:`2026-09-27`,platforms:[`win32`],added:[`Right-click a chat tab → Delete (in red, under “Close all tabs”) deletes that chat after asking, just like Delete in the sidebar.`,`Chats now use Oonak Browser, in a window you can see, for everything that needs a web browser — not Chrome, Edge or a hidden script browser — unless you name another browser. It runs without a window (headless) only when you ask for that.`],fixed:[`After an update, the background service comes back by itself. An update could leave it unable to restart, and the app then showed “OonaCode could not start its host service” even though it went on to open normally.`]},{version:`0.3.164`,date:`2026-09-27`,platforms:[`win32`],added:[`Send now: a message you typed while the agent works has a Send now button while it waits. It stops what the agent is doing right now and sends your message immediately — the step that is running is cut. On the desktop and the phone.`,`Conversations → Map: see at a glance which chats are talking to each other. Each conversation is a hub with a line to each of its chats; working chats pulse; click a hub for its history or a chat to open it.`],fixed:[`A restart no longer signs this PC out when OonaCode’s stored key cannot be opened for a moment. OonaCode used to replace the key and lose your sign-in; it now keeps the key and signs you back in by itself as soon as it opens.`]},{version:`0.3.163`,date:`2026-09-27`,platforms:[`linux`],added:[`Send now: a message you typed while the agent works has a Send now button while it waits. It stops what the agent is doing right now and sends your message immediately — the step that is running is cut. On the desktop and the phone.`,`Conversations → Map: see at a glance which chats are talking to each other. Each conversation is a hub with a line to each of its chats; working chats pulse; click a hub for its history or a chat to open it.`],fixed:[`A restart no longer signs this PC out when its security chip is slow to open OonaCode’s stored key. After a system update and reboot, the chip on some machines refuses for a while; OonaCode used to replace the key and lose your sign-in. It now keeps the key and signs you back in by itself as soon as the chip opens it.`]},{version:`0.3.162`,date:`2026-09-27`,added:[],fixed:[`A chat switched to another model knows which model it is. After a switch from Claude to DeepSeek, the model used to keep saying it was Claude — the chat history and Claude Code’s own prompt told it so.`,`Oonak Browser is offered only where it can run. An older OonaCode no longer lists a browser tool it cannot use, so the model does not spend tokens working around it — update to get the browser.`]},{version:`0.3.161`,date:`2026-09-27`,added:[`Settings → This PC → “Replace pictures older than N days”: screenshots and pasted pictures in your chat history are replaced by a short note once they are older than a year (you choose the number, or 0 to keep them). The words of every chat stay; the database stops growing with pictures. It runs by itself.`],fixed:[`The model, Build/Plan/Ask and effort pickers under the message box now look like the dropdowns they are.`,`Switches that are off are easy to see in dark mode.`,`Error messages show what went wrong in words, without raw tags or a provider’s JSON.`,`The ✕ that removes an attachment or a reply is round.`,`Pressing Stop, or an update cutting a turn, no longer files an automatic bug report.`]},{version:`0.3.160`,date:`2026-09-27`,added:[`On Windows, the agent can use a real browser. Ask it to open a site, read a page, click, fill in a form or take a screenshot, and it does it in Oonak Browser, in a window you can see. The first time, OonaCode asks once to install the browser (about 210 MB); after that it opens straight away.`,`Each chat has its own browser profile, so a site you sign in to stays signed in for that chat. Switch the browser off for a chat in its Tools menu.`],fixed:[]},{version:`0.3.159`,date:`2026-09-27`,added:[],fixed:[`A chat reopened after an update no longer says “turn complete” the instant you send a message and then answer anyway. The engine’s own note about work that stopped during the update used to be taken for the end of your turn, with the whole earlier conversation’s tokens on the line.`,`A background task that stopped because OonaCode restarted now says so in plain words, instead of “Orphaned by a previous Claude Code process exit”.`]},{version:`0.3.158`,date:`2026-09-27`,added:[`Every thought in a chat shows how many words it has, so you can tell at a glance whether there is anything to read.`],fixed:[`A thought with nothing in it — some models return only a signature for their thinking — now says “Thought · empty” and no longer opens onto a blank box.`,`A command the agent was allowed to run no longer leaves an “Allowed Bash (automatically)” line under its own card: the card already shows the command and its result. Refusals are still shown.`]},{version:`0.3.157`,date:`2026-09-27`,added:[`On Linux, OonaCode has its own signed apt and dnf repositories. Install the app with apt (Debian, Ubuntu, Mint) or dnf (Fedora, RHEL, Rocky, Alma) — the commands are on the download page — and your package manager keeps it up to date with the rest of the system.`,`Every Linux release is signed with the OonaCode release key, and the one-line installer checks that signature before it installs anything.`],fixed:[`On Linux, the menu bar is drawn in the window in the app’s own colours, and it switches between light and dark with the app instead of keeping the desktop’s theme until a restart.`,`Upgrading the .rpm no longer removes the oonacode command, and removing it no longer leaves empty folders behind.`]},{version:`0.3.156`,date:`2026-09-27`,added:[`Chats can talk to each other. Turn on “Talk to other chats” in a chat’s Tools menu, and its agent can find your other chats that have it on, read them, and ask them for help — one chat or a whole group. A chat that is closed wakes up to answer; a busy one answers when it finishes. The reply comes back to the chat that asked.`,`The Conversations window (in the sidebar) shows every conversation between your chats: who said what to whom, what each answer cost, and buttons to pause, resume, close or stop them all. Each conversation has a budget — 20 messages and 1,000,000 new tokens by default — and pauses itself when it is used up, so chats can never talk forever.`,`Hover over any tool in a chat’s Tools menu to read what it does, how it works, what it costs and how to turn it off.`],fixed:[`A chat woken in the background — by a scheduled task or another chat — shows as working in the sidebar even when it is not open in a tab.`,`A scheduled task no longer slips into a chat at the same moment you send it a message; yours always goes first.`,`A message sent from the terminal no longer waits forever when a chat’s history cannot be resumed and the restart fails. It now says why.`,`Notes OonaCode writes into a chat — a model change, a conversation paused — are still there when you reopen it.`,`When every Claude seat in the OonaCode pool is taken, a new chat now says the model is busy and to try again in a few minutes or pick another model, instead of “Something went wrong on our side”.`,`On Linux, the app tells you it is updating while it swaps itself, so there is no need to start it again.`,`On Linux, removing the .deb or .rpm leaves nothing running and nothing failing at the next login, and the one-line installer checks for free disk space before it changes anything.`]},{version:`0.3.155`,date:`2026-09-27`,added:[`OonaCode runs on Linux. One command installs the command line, the background service and the desktop app: curl -fsSL https://oonacode.oonak.ai/install.sh | bash. The AppImage, .deb and .rpm are on the download page too.`,`On Linux the app lives in the system tray as it does on Windows, follows your desktop’s light or dark theme, and gets its own entry in the applications menu.`,`Uninstalling on Linux removes the desktop app along with the rest, and asks whether to keep your chats for a future install.`],fixed:[`A window no longer stays on “Unauthorized” after the background service restarts with a new key. It reconnects by itself.`]},{version:`0.3.154`,date:`2026-09-26`,added:[],fixed:[`A chat waiting on a long job no longer loses its watcher. OonaCode used to close a chat’s engine ten minutes after the model last spoke, which stopped any Monitor or background command it had left running. The engine now stays up while such work runs, up to 12 hours.`,`A chat moved into a project, or whose project you edit, now follows the project’s instructions from its next message. It used to keep the ones it started with.`]},{version:`0.3.153`,date:`2026-09-25`,added:[],fixed:[`A very long chat no longer answers “Prompt is too long” after OonaCode restarts or updates. The engine was judging the chat’s size by a figure left over from before the restart, and now gets an accurate one.`,`If a message is ever refused as too long before the model has started on it, OonaCode sends it again by itself with a shorter history. You see your message once and then the answer, not an error.`]},{version:`0.3.152`,date:`2026-09-25`,added:[],fixed:[`Uninstalling the app from Windows’ Apps list no longer stops the command-line OonaCode on the same PC from starting after a restart.`]},{version:`0.3.151`,date:`2026-09-25`,added:[`Files the agent names in a chat are clickable. Audio and video play right in the chat with a small player, pictures open as a preview, and in the app every file can be opened in its own program or shown in its folder.`,`Uninstalling the app asks whether to keep your chats on this PC. Keeping them means a new install signs in and continues every chat.`],fixed:[`Installing and updating no longer fail with “The operation has timed out” on PCs whose network drops the newer internet addresses, nor while our server restarts for an update.`]},{version:`0.3.150`,date:`2026-09-25`,added:[],fixed:[`The fix in 0.3.149 for long, sleeping turns now really reaches the agent: the Monitor tool and the block on long waits are on for every chat.`,`A chat compacted after a long pause no longer pays to cache a conversation it is about to replace, and the agent keeps each tool call in its history exactly as it wrote it — both as Claude Code does.`]},{version:`0.3.149`,date:`2026-09-25`,added:[`The agent can watch a long job with the Monitor tool, as Claude Code does, and is woken the moment the job finishes.`],fixed:[`Long chats no longer spend their time asleep. With no way to watch a background job, the agent had been polling it with waits of four to eight minutes. One chat spent more than three and a half hours of a day sleeping, and turns ran for hours while the model worked for a fraction of that. The agent now gets the same working rules as Claude Code, and long waits are blocked.`]},{version:`0.3.148`,date:`2026-09-25`,added:[],fixed:[`A scheduled task that could not be sent — the PC had just restarted, the vault was still locked, the server was not reachable yet — waits and tries again instead of switching itself off. Pausing, editing or deleting a task while its prompt is being sent is no longer undone, and a scheduled prompt no longer lands in a chat whose engine is still starting.`,`A chat on your own DeepSeek key, or one switched with a typed “/model opus”, is no longer shown as withdrawn and locked. “/model fable” picks Claude Fable instead of the default model.`,`Moving a chat to another model no longer lowers its saved effort level to what the old model offered, and a one-off “oona --effort” is no longer saved as the chat’s level.`,`After you pick another model for a locked chat and send, the chat no longer flashes the lock again while the engine starts; if the start fails, your pick is kept.`,`Coming back from a file tab no longer jumps the chat to an old reply or reopens the search bar.`,`The hidden sidebar slides away again when the pointer leaves the window past its edge, and the keyboard no longer tabs through it while it is hidden. Clicking ⓘ in Settings opens its note instead of closing it.`,`Subagents write their prompt cache for five minutes, as Claude Code does for its subscribers; the chat itself keeps the hour. Their cache writes cost less.`]},{version:`0.3.147`,date:`2026-09-25`,added:[`A chat’s scheduled tasks sit beside its subagents: a clock badge says how many are live and when the next one runs, and opens the list — each task’s schedule, its next and last run, Pause and Delete. The tasks run on this PC.`],fixed:[`A prompt the scheduler sends into a chat reads as a “Scheduled task” line, not as your own message waiting in the queue.`,`A chat whose model is no longer offered shows that model in red and waits for you to pick another; its history stays, and the old model is not in the list any more.`,`The effort list follows the server within minutes, without restarting the app. A chat set to a level that has been switched off moves to the nearest one — ultracode becomes xhigh. Chats on your own Claude subscription have an effort picker again.`]},{version:`0.3.146`,date:`2026-09-25`,added:[`A Tools menu beside the model picker: switch OonaCode’s own tools on or off for each chat — browser, desktop and window control, clipboard, screen capture, Office documents and run-as-administrator. Each tool costs the model only a short line until it is used, and the menu shows how much. The first tools are marked Demo while they are tested with every model: a demo tool answers what it would have done, and does nothing on your PC yet.`],fixed:[]},{version:`0.3.145`,date:`2026-09-25`,added:[],fixed:[`Every request of every chat, on every model, is about 3,200 tokens smaller: the engine’s own “auto memory” instructions are gone. OonaCode starts each engine in a fresh private folder and deletes it afterwards, so the notes the model was told to keep there were thrown away when the chat went idle — the model spent tool calls writing memories it would never read. A project’s memory is OonaCode’s own and stays.`,`The engine’s claude.ai Artifact tools are switched off everywhere OonaCode runs it — the app, the terminal, VS Code, the phone, Telegram and the agent API.`]},{version:`0.3.144`,date:`2026-09-25`,added:[],fixed:[`Long chats on Claude models in the OonaCode pool keep their cache for an hour, as Claude Code does for its subscribers. A pause of more than five minutes no longer re-sends the whole conversation at the full cache-write price, which in a large chat was the most expensive part of coming back to it.`,`The session panel’s Context shows how big the conversation is now, not the total of every request the chat ever made — a long chat read “10.7M / 1.0M tokens”.`,`The message box keeps the cursor after you send, so you can go straight on typing the next message.`,`A paid chat’s background work (titles, reading web pages) no longer goes to a free model of the same vendor.`]},{version:`0.3.143`,date:`2026-09-24`,added:[`Search inside your chats: open the search in the chat list, press the sliders button and choose Whole chats. It looks through every message of every chat on this PC, and you choose whose words — yours, the model’s, or both — plus, if you like, the tools’ commands and output and the subagents’ conversations. Results show each message with the words lit; a click opens the chat with its search on them.`,`More search options, for both kinds of search: one project only, a time window (today, 7 or 30 days), match case and whole words.`],fixed:[`While you search the chat list, projects with no matching chat are hidden too.`]},{version:`0.3.142`,date:`2026-09-24`,added:[],fixed:[`A reply you sent shows as the same small chip it had in the message box — “Reply to” and the first few words — instead of the whole quoted text; the full quote appears when you rest the pointer on it, and a click jumps to the message it answers.`,`The model now knows a reply points back into the conversation: it is told the quoted lines are from the chat history, not new input, and whose words they were — its own earlier reply, your earlier message, a file, or a tool’s output.`,`When the chat list is narrow, its buttons wrap onto a second line instead of spilling out of it.`]},{version:`0.3.141`,date:`2026-09-24`,added:[`The chat list on the left can be made wider or narrower: drag its right edge (double-click it for the usual width).`,`The chat list can hide: press the pin in its header, the button at the top left, or View → Sidebar (Ctrl+B). While hidden it slides in when the pointer reaches the left edge of the window, and slides away when you leave it.`,`Search in the chat list is a single magnifier now; click it and the search box opens across the top. Escape or × clears it.`],fixed:[`Opening OonaCode right after a restart no longer leaves the OonaCode pool models out of the model list: if they cannot be read yet, OonaCode asks again by itself a few seconds later and the list fills in.`,`The Artificial Analysis scores (intelligence, coding, speed and benchmarks) show on every model in the model list again — including the models of your own Claude and SuperGrok subscriptions, which never had them.`,`A chat’s details card no longer appears on top of its right-click menu.`]},{version:`0.3.140`,date:`2026-09-24`,added:[`Reply is tidier: the message you reply to shows as a small chip above the message box with its first few words, instead of filling the box. Click the chip — or the quote in a sent reply — to jump to that message; the × removes it.`,`Right-click a project in the sidebar for its settings: Project settings… opens Projects with that project already selected. The gear beside a project’s “+” does the same, and a chat filed in a project offers it in its own menu too.`,`Link GitHub. Under a project’s Repositories (and in Settings → Providers), link your GitHub account once: the agent’s git and gh then clone, pull and push your private repositories on every PC of yours. You type a short code on github.com; the token stays in your encrypted vault and never reaches the OonaCode server. Public repositories need nothing.`],fixed:[]},{version:`0.3.139`,date:`2026-09-24`,added:[`Every setting now says what it does, and resting the pointer on the ⓘ beside it tells you where in OonaCode it applies and what it does not do.`,`Export chats… is in the File menu (and on the sidebar in a browser window) instead of in Settings.`,`With Remote access turned off on a PC, your phone, Telegram, the website and your other PCs still show it — online or not — marked “remote access off”, and opening it tells you to turn Remote access back on in OonaCode on that PC.`],fixed:[`Turning Remote access off now tells your other devices at once. Before, the PC was already unreachable from them, but they could not say why.`,`The settings of This PC save the moment you change them — nothing is lost by closing the dialog.`,`Settings that did nothing, or repeated another one, are gone: the default permission mode (each chat’s Build / Plan / Ask first picker decides), the agent-picker switch, the Git Bash path, the engine path and the extra allowed origins. The server address is shown, not edited — signing in sets it.`]},{version:`0.3.138`,date:`2026-09-24`,added:[`Projects have settings now, like the Claude app’s: a goal, the repositories the project works on, what a new chat in it starts on (model, effort and folder), a project memory the agent keeps up to date, and whether its chats may schedule work — and how often at most. All of it is in Projects, and a Claude app project you import brings its own.`,`OonaCode has a scheduler. Ask the agent to do something later or on a repeat — “check the build every morning at nine” — and it schedules it on this PC; when it is due, the prompt arrives in the chat, even if the chat had gone quiet. The Projects dialog and the chat’s info panel list what is scheduled, where you can pause, resume or delete it.`],fixed:[`Saving a project’s instructions now reaches its chats at their next message, instead of waiting until the chat happened to restart.`]},{version:`0.3.137`,date:`2026-09-24`,added:[],fixed:[`After a PC restart the app could ask for a "host token" and sign you out: two copies of the OonaCode background service started at once and fought over your session. Only one ever runs now, and the app never shows the token page — if its service is replaced it reconnects by itself.`,`The unlock screen stays put until you unlock, and says what went wrong in place — a wrong password, or a connection it is re-establishing — instead of jumping to another page.`,`A message with a picture sent while the agent was working stayed “queued”, and removing it said it was already sent. It now shows as read the moment the agent takes it, and a reopened chat shows it with its picture.`,`In the model’s questions, typing your own answer now clears the options you had picked, and picking an option clears what you typed — the answer sent is exactly the one you chose. The same on the phone, in the terminal and in Telegram.`]},{version:`0.3.136`,date:`2026-09-24`,added:[`Every model now has its own housekeeper — the small, fast model of the same maker that writes a chat’s titles and reads the web pages it fetches. On the OonaCode pool a MiMo v2.6 Pro chat uses MiMo v2.6 Flash, a Qwen chat Qwen3.8 Flash, a GLM chat GLM-5.3 Flash and a GPT-5 chat GPT-5 mini, instead of doing that work on the big model itself. A free model keeps its own, so it stays free.`],fixed:[]},{version:`0.3.135`,date:`2026-09-24`,added:[],fixed:[`Claude models on the OonaCode pool — Opus 5.5, Opus 5, Sonnet 5 and Fable 5.1 — now use their whole 1M context. A long chat no longer stops to summarise itself every ~170k tokens, and its subagents get the same window.`,`Reading a web page is quick again in a Claude chat: pages are read by Claude Haiku, as in Claude Code, instead of a helper that took about a minute a page.`,`Changing a chat’s model now moves its subagents and background helpers to the new model too; before, they stayed on the old one until the app restarted.`,`MiMo v2.5 and v2.5 Pro chats now use their full 1M context too.`]},{version:`0.3.134`,date:`2026-09-23`,added:[],fixed:[`On the Android app, the model’s questions can be answered again. They come one at a time — “Question 2 of 3” — with Back, Next and Skip, and Answer sends them to your PC. The card used to show only the first question, hide the rest below it and wait for all of them, so it could not be sent.`]},{version:`0.3.133`,date:`2026-09-23`,added:[`Bring your Claude desktop app projects across: File → Import chats from other coding agents now lists every project the Claude app has opened on this PC. Each one arrives as an OonaCode project of the same name — its goal, instructions and what Claude noted about it become the project’s instructions — with its project chat and one chat per thread filed under it, ready to carry on.`,`A Claude Code chat you moved into a Claude app project is filed under that project here too.`,`A thread you never opened in the Claude app still comes across, with its task and every reply the project chat saw; open it once in the Claude app and import again for its whole conversation.`],fixed:[`Cursor chats appear in the import list again — they had been left out since September 10.`]},{version:`0.3.132`,date:`2026-09-23`,added:[`Reply to any part of a chat: select some text (or just right-click a block), choose Reply, and it is quoted in your message box — type your answer under it. A quote from a file the agent read names the file.`,`Right-click in a chat: copy what you selected, copy a whole reply or tool output, copy a code block or a link, find the selected words in the chat, or select a block.`,`Search in a chat opens the block its match is in — a folded tool card, a thought, a finished agent’s work — and scrolls to the words themselves.`,`Search matches are now bright orange, the current one strongest, so they stand out on code too.`,`The file viewer shows pictures (PNG, JPEG, GIF, WebP, SVG and more), plays audio and video, and shows Markdown formatted, with a switch to the source.`,`Right-click a file or folder in the explorer to copy its path or delete it.`],fixed:[`Moving a chat to another folder or project while it was working could delete the folder it was working in, start two agents at once, or send your next message to the old folder.`,`The working line no longer says a chat may be stuck while it waits for your approval or answer, or right after you send a message, and it counts time correctly (no more "4m 60s").`,`A date line no longer says "Today" for yesterday’s messages when the app stays open past midnight.`,"Installing with npm (`npm i -g oonacode`) installs this version again; earlier npm releases carried an old program.",`The What’s new window could open again on the next start, showing the same update a second time.`,`An older OonaCode window or VS Code extension no longer resets settings it does not know about, such as your theme colours or which project groups you folded.`,`A new install no longer opens with a list of changes; this window now appears only after an update.`,`The notification switch for permissions now says it also covers the agent’s questions.`]},{version:`0.3.131`,date:`2026-09-23`,added:[`Claude Opus 5.5 is here — the newest Opus, and cheaper to run than Opus 5. Choose it in the model picker, from the OonaCode pool or on your own Claude subscription. It runs on the newer Claude Code engine (2.1.280) that this update brings.`,`Every block in a chat shows its time at the bottom right, in your local time — hover it for the full date — and a date line marks where each day starts.`,`A running chat tells you how long the agent has been quiet, and after five minutes that it may be stuck and what to do.`,`After every update, OonaCode now opens this window to show you what changed.`],fixed:[`A reply that streamed in live had no time on it until the chat was opened again.`,`Chats open in tabs could fail to come back after a restart if a setting changed while they were being restored.`]}];function tu(e,t){let n=e=>{let[t,...n]=e.trim().replace(/^v/,``).split(`-`);return{nums:(t??``).split(`.`).map(e=>Number.parseInt(e,10)||0),pre:n.length>0?n.join(`-`):null}},r=n(e),i=n(t);for(let e=0;e<Math.max(r.nums.length,i.nums.length);e++){let t=(r.nums[e]??0)-(i.nums[e]??0);if(t!==0)return t}return r.pre===i.pre?0:r.pre===null?1:i.pre===null?-1:nu(r.pre,i.pre)}function nu(e,t){let n=e.split(`.`),r=t.split(`.`);for(let e=0;e<Math.max(n.length,r.length);e++){let t=n[e],i=r[e];if(t===i)continue;if(t===void 0)return-1;if(i===void 0)return 1;let a=/^\d+$/.test(t),o=/^\d+$/.test(i);if(a&&o){let e=Number(t)-Number(i);if(e!==0)return e;continue}return a===o?t<i?-1:1:a?-1:1}return 0}function ru(e,t,n=eu,r=null){if(!e||e===`0.0.0`)return[];let i=n.filter(t=>tu(t.version,e)<=0&&(!r||!t.platforms||t.platforms.includes(r)));return[...t===null?i.filter(t=>tu(t.version,e)===0):i.filter(e=>tu(e.version,t)>0)].sort((e,t)=>tu(t.version,e.version))}function iu(e,t,n,r=eu,i=null){if(!e||e===`0.0.0`)return{record:null,show:[]};let a=null;for(let e of r)(a===null||tu(e.version,a)>0)&&(a=e.version);let o=a!==null&&tu(e,a)>0?a:e;return{record:t===null||tu(o,t)>0?o:null,show:t===null&&!n?[]:ru(e,t,r,i)}}function au(e,t){if(t==null)return[...e];if(t.length===0)return[];let n=new Set(t),r=e.filter(e=>n.has(e.id));return r.length>0?r:[...e]}var ou=`the user skipped the question`,su=`(the user skipped this question)`;function cu(e){let t=e?.questions;if(!Array.isArray(t))return[];let n=[];for(let e of t){if(!e||typeof e!=`object`)continue;let t=e;if(typeof t.question!=`string`)continue;let r=Array.isArray(t.options)?t.options.map(e=>e&&typeof e==`object`?e:null).filter(e=>e!==null&&typeof e.label==`string`).map(e=>({label:e.label,...typeof e.description==`string`?{description:e.description}:{}})):[];n.push({question:t.question,header:typeof t.header==`string`?t.header:``,options:r,multiSelect:t.multiSelect===!0})}return n}function lu(e,t,n={},r=new Set){let i={};return e.forEach((e,a)=>{if(r.has(a)){i[e.question]=su;return}let o=(n[a]??``).trim();i[e.question]=o||(t[a]??[]).join(`, `)}),i}function uu(e){let t=e.questions,n=t===1?`question`:`questions`,r=t===1?`the model’s question`:`the model’s questions`,i=t===1?`The model’s question was`:`The model’s questions were`;switch(e.outcome){case`answered`:{let r=e.answers?Object.values(e.answers):null,i=r?r.filter(e=>typeof e==`string`&&e!==``&&e!==`(the user skipped this question)`).length:t;return t>0&&i<t?`You answered ${i} of ${t} ${n}`:t===0?`You answered the model’s questions`:t===1?`You answered the model’s question`:`You answered ${t} ${n}`}case`skipped`:return`You skipped ${r}`;case`dismissed`:return`${i} dismissed`;case`unanswered`:return`${i} not answered — the turn ended`}}function du(e){if(!e||typeof e!=`object`)return null;let t=e.answers;return t&&typeof t==`object`&&!Array.isArray(t)?t:null}var fu=[`oauth`,`token`];function pu(e){switch(e){case`signed-out`:return`Not signed in`;case`connecting`:return`Waiting for your sign-in…`;case`connected`:return`Connected`;case`expired`:return`Sign-in expired`;case`error`:return`Cannot reach the service`}}var mu=H().refine(e=>/^https:\/\/[^\s]+$/i.test(e),`must be an https address`),hu=Zo({vendor:H().min(1).max(60),mcpUrl:mu,readOnlyQuery:as(H(),H()).nullable(),auth:Zo({methods:Yo(ss(fu)).min(1),scopes:Yo(H()),offlineAccess:Uo(),token:Zo({label:H(),createUrl:mu,note:H().nullable()}).nullable()}),tools:Zo({deny:Yo(H()),allowWrites:Yo(H()),featured:Yo(H()),maxResultChars:zo().int().min(1e3).max(2e5)}),cli:Zo({command:H().regex(/^[A-Za-z0-9._-]{1,40}$/),versionArg:H().regex(/^--?[A-Za-z0-9-]{1,20}$/),install:as(H(),H()),login:Zo({command:H(),tokenEnv:H().nullable()}),purpose:H()}).nullable(),skills:Yo(Zo({name:H().regex(/^[a-z0-9][a-z0-9_-]{0,47}$/),source:Zo({repo:H().regex(/^[A-Za-z0-9._-]+\/[A-Za-z0-9._-]+$/),ref:H().regex(/^[0-9a-f]{40}$/,`pin a full commit, never a branch`),path:H().refine(e=>!/(^|[\\/])\.\.([\\/]|$)|^[\\/]/.test(e),`relative path`)}),license:H(),exclude:Yo(H())})),docsUrl:mu}).loose();function gu(e){if(e.toolName!==`ConnectorChange`)return null;let t=e.input;if(!t||typeof t!=`object`||typeof t.connector!=`string`||typeof t.vendor!=`string`||typeof t.tool!=`string`)return null;let n=t.arguments!==null&&typeof t.arguments==`object`&&!Array.isArray(t.arguments)?t.arguments:{};return{connector:t.connector,vendor:t.vendor,tool:t.tool,description:typeof t.description==`string`?t.description:``,arguments:n}}function _u(e){let t=Object.keys(e.arguments).slice(0,8);return`${e.vendor}: ${e.tool}${t.length>0?` (${t.join(`, `)})`:``}`}var vu=[`win32`,`linux`,`darwin`],yu=[`demo`,`live`],bu=[`allow`,`ask`],xu=[`string`,`number`,`integer`,`boolean`,`array`,`object`];function Su(e){let t=e/1048576;return t>=100?`${Math.round(t)} MB`:t>=1?`${t.toFixed(1)} MB`:`${Math.max(1,Math.round(e/1024))} KB`}function Cu(e){if(e.toolName!==`InstallToolPack`)return null;let t=e.input;return!t||typeof t!=`object`||typeof t.pack!=`string`||typeof t.name!=`string`||typeof t.version!=`string`||typeof t.sizeBytes!=`number`||typeof t.path!=`string`?null:{pack:t.pack,name:t.name,version:t.version,sizeBytes:t.sizeBytes,path:t.path}}function wu(e,t){let n=t?.[e.slug];return typeof n==`boolean`?n:e.defaultOn}function Tu(e,t){return e.filter(e=>wu(e,t))}var Eu={slug:48,name:80,entryTool:40,description:2e3,promptLine:1e3,details:8e3,actionDescription:1e3,params:30,paramName:48,paramDescription:400,enumValues:40,callArgKeys:20,callError:500,callBatch:100},Du=/^[A-Za-z0-9_-]+$/;function Ou(e){return typeof e==`string`&&e.length>0&&e.length<=Eu.entryTool&&Du.test(e)}function ku(e){return Math.ceil(e.length/4)}function Au(e){return ku(`${e.entryTool} ${e.description}`)+55}function ju(e){return e.tokensPerRequest??Au(e)+(e.promptLine?ku(e.promptLine):0)}var Mu=Zo({type:ss(xu),required:Uo().optional(),enum:Yo($o([H(),zo()])).optional(),description:H().optional()}),Nu=Zo({slug:H().min(1),description:H(),params:as(H(),Mu),permission:ss(bu),sort:zo()}),Pu=Zo({version:H(),url:H(),sha256:H(),sizeBytes:zo(),exe:H(),format:ls(`zip`)}),Fu=Zo({slug:H().min(1),name:H(),entryTool:H().refine(Ou,`not a valid tool name`),description:H(),promptLine:H().nullable(),details:H().nullable().optional(),status:ss(yu),defaultOn:Uo(),sort:zo(),install:Pu.nullable(),actions:Yo(Nu),connector:hu.nullable().optional().catch(null)}).loose();Zo({platform:ss(vu),version:H(),packs:Yo(Fu),refreshMinutes:zo()});var Iu=ss([`stdio`,`sse`,`http`]),Lu=Zo({id:H().trim().regex(/^[a-z0-9][a-z0-9._-]{0,63}$/i,`ID must be 1-64 alphanumeric, dash, dot, or underscore characters`),name:H().trim().min(1).max(100),description:H().max(500).optional(),transport:Iu,command:H().min(1).max(500).optional(),args:Yo(H()).max(100).optional(),env:as(H(),H()).optional(),url:H().url().max(2e3).optional(),headers:as(H(),H()).optional(),defaultOn:Uo(),enabled:Uo().optional(),catalogId:H().max(100).optional()});Lu.refine(e=>e.transport===`stdio`?typeof e.command==`string`&&e.command.length>0:typeof e.url==`string`&&e.url.length>0,{message:`stdio transport requires a command; sse/http transports require a url`}),Lu.partial(),as(H().regex(/^[a-z0-9][a-z0-9._-]{0,63}$/i),Uo()).refine(e=>Object.keys(e).length<=128,`At most 128 MCP server switches`);function Ru(e,t){if(e.enabled===!1)return!1;let n=t?t[e.id]:void 0;return typeof n==`boolean`?n:e.defaultOn}function zu(e,t,n){return{...e??{},[t]:n}}var Bu=[{id:`databases`,label:`Databases`},{id:`cloud`,label:`Cloud & DevOps`},{id:`productivity`,label:`Productivity`},{id:`analytics`,label:`Analytics`},{id:`ai`,label:`AI & Reasoning`},{id:`developer`,label:`Developer Tools`}],Vu=[{id:`postgres`,name:`PostgreSQL`,description:`Inspect schemas, query tables, run read operations and analyze database structures.`,category:`databases`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@modelcontextprotocol/server-postgres`,"${connectionString}"],parameters:[{key:`connectionString`,label:`Database Connection URL`,placeholder:`postgresql://user:password@localhost:5432/dbname`,type:`password`,required:!0,target:`arg`,templateIndex:2}],docsUrl:`https://github.com/modelcontextprotocol/servers/tree/main/src/postgres`},{id:`sqlite`,name:`SQLite`,description:`Direct SQL query and schema inspection for local SQLite database files.`,category:`databases`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@modelcontextprotocol/server-sqlite`,`--db-path`,"${dbPath}"],parameters:[{key:`dbPath`,label:`SQLite File Path`,placeholder:`C:/data/app.db or /var/data/app.db`,type:`string`,required:!0,target:`arg`,templateIndex:3}],docsUrl:`https://github.com/modelcontextprotocol/servers/tree/main/src/sqlite`},{id:`supabase`,name:`Supabase`,description:`Manage Supabase Postgres database, migrations, edge functions, and project config.`,category:`databases`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@modelcontextprotocol/server-supabase`],parameters:[{key:`SUPABASE_ACCESS_TOKEN`,label:`Personal Access Token`,type:`password`,required:!0,target:`env`},{key:`SUPABASE_PROJECT_REF`,label:`Project Reference ID`,placeholder:`abcdefghijklmnopqrst`,type:`string`,required:!0,target:`env`}],docsUrl:`https://supabase.com/docs/guides/ai/mcp`},{id:`redis`,name:`Redis`,description:`Inspect keys, data structures, and execute Redis operational commands.`,category:`databases`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@modelcontextprotocol/server-redis`,"${redisUrl}"],parameters:[{key:`redisUrl`,label:`Redis Connection URL`,placeholder:`redis://localhost:6379`,type:`string`,required:!0,target:`arg`,templateIndex:2}]},{id:`mongodb`,name:`MongoDB Atlas`,description:`Query collections, inspect schemas, and interact with MongoDB Atlas databases.`,category:`databases`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@modelcontextprotocol/server-mongodb`,"${connectionString}"],parameters:[{key:`connectionString`,label:`MongoDB Connection URI`,placeholder:`mongodb+srv://user:pass@cluster.mongodb.net/dbname`,type:`password`,required:!0,target:`arg`,templateIndex:2}]},{id:`github`,name:`GitHub`,description:`Search repositories, manage issues, pull requests, files, and branches.`,category:`cloud`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@modelcontextprotocol/server-github`],parameters:[{key:`GITHUB_PERSONAL_ACCESS_TOKEN`,label:`GitHub Personal Access Token (repo scope)`,placeholder:`ghp_...`,type:`password`,required:!0,target:`env`}],docsUrl:`https://github.com/modelcontextprotocol/servers/tree/main/src/github`},{id:`gitlab`,name:`GitLab`,description:`Access GitLab merge requests, project branches, issues, and pipelines.`,category:`cloud`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@modelcontextprotocol/server-gitlab`],parameters:[{key:`GITLAB_PERSONAL_ACCESS_TOKEN`,label:`GitLab Personal Access Token`,type:`password`,required:!0,target:`env`},{key:`GITLAB_API_URL`,label:`GitLab API URL (optional for self-hosted)`,placeholder:`https://gitlab.com/api/v4`,type:`string`,required:!1,target:`env`}]},{id:`cloudflare`,name:`Cloudflare`,description:`Inspect and manage Cloudflare Workers, KV namespaces, D1 databases, and DNS records.`,category:`cloud`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@cloudflare/mcp-server-cloudflare`],parameters:[{key:`CLOUDFLARE_API_TOKEN`,label:`API Token`,type:`password`,required:!0,target:`env`},{key:`CLOUDFLARE_ACCOUNT_ID`,label:`Account ID`,type:`string`,required:!0,target:`env`}]},{id:`sentry`,name:`Sentry`,description:`Retrieve real-time application errors, stack traces, and issue analytics.`,category:`cloud`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@modelcontextprotocol/server-sentry`],parameters:[{key:`SENTRY_AUTH_TOKEN`,label:`Auth Token`,type:`password`,required:!0,target:`env`}]},{id:`google-drive`,name:`Google Drive`,description:`Search, read, and export documents, spreadsheets, and files from Google Drive.`,category:`productivity`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@modelcontextprotocol/server-gdrive`],docsUrl:`https://github.com/modelcontextprotocol/servers/tree/main/src/gdrive`},{id:`slack`,name:`Slack`,description:`Read conversation history, search channel messages, and post updates to Slack channels.`,category:`productivity`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@modelcontextprotocol/server-slack`],parameters:[{key:`SLACK_BOT_TOKEN`,label:`Bot User OAuth Token (xoxb-...)`,type:`password`,required:!0,target:`env`},{key:`SLACK_TEAM_ID`,label:`Slack Workspace Team ID`,type:`string`,required:!0,target:`env`}]},{id:`notion`,name:`Notion`,description:`Read and update Notion workspaces, databases, pages, and blocks.`,category:`productivity`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@modelcontextprotocol/server-notion`],parameters:[{key:`NOTION_API_KEY`,label:`Internal Integration Secret (secret_...)`,type:`password`,required:!0,target:`env`}]},{id:`linear`,name:`Linear`,description:`Track issues, cycles, projects, and comments in Linear.`,category:`productivity`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@modelcontextprotocol/server-linear`],parameters:[{key:`LINEAR_API_KEY`,label:`Personal API Key`,type:`password`,required:!0,target:`env`}]},{id:`posthog`,name:`PostHog`,description:`Query product analytics funnels, trends, user session paths, and feature flags.`,category:`analytics`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@posthog/mcp-server-posthog`],parameters:[{key:`POSTHOG_API_KEY`,label:`Personal API Key`,type:`password`,required:!0,target:`env`},{key:`POSTHOG_PROJECT_ID`,label:`Project ID`,type:`string`,required:!0,target:`env`}]},{id:`brave-search`,name:`Brave Search`,description:`Search the live web and discover local points of interest via Brave Search API.`,category:`ai`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@modelcontextprotocol/server-brave-search`],parameters:[{key:`BRAVE_API_KEY`,label:`Brave Search API Key`,type:`password`,required:!0,target:`env`}]},{id:`memory-graph`,name:`Memory (Knowledge Graph)`,description:`Persistent knowledge-graph entity and relation memory across agent turns.`,category:`ai`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@modelcontextprotocol/server-memory`]},{id:`puppeteer`,name:`Puppeteer Headless Browser`,description:`Automate browser navigation, take page screenshots, and scrape dynamic web content.`,category:`ai`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@modelcontextprotocol/server-puppeteer`]},{id:`remote-sse`,name:`Remote SSE MCP Server`,description:`Connect to any hosted remote MCP server over Server-Sent Events (SSE).`,category:`developer`,transport:`sse`,defaultUrl:`https://`,parameters:[{key:`url`,label:`SSE Endpoint URL`,placeholder:`https://mcp.example.com/sse`,type:`string`,required:!0,target:`url`},{key:`Authorization`,label:`Authorization Header (optional, e.g. Bearer token)`,placeholder:`Bearer ...`,type:`password`,required:!1,target:`header`}]},{id:`remote-http`,name:`Remote Streamable HTTP Server`,description:`Connect to any remote MCP server using standard Streamable HTTP transport.`,category:`developer`,transport:`http`,defaultUrl:`https://`,parameters:[{key:`url`,label:`HTTP Endpoint URL`,placeholder:`https://mcp.example.com/mcp`,type:`string`,required:!0,target:`url`},{key:`Authorization`,label:`Authorization Header (optional, e.g. Bearer token)`,placeholder:`Bearer ...`,type:`password`,required:!1,target:`header`}]}],Hu=[`No answer needed.`,`"Talk to other chats" is off in this chat: this message is from another chat's agent, not the person, and you cannot message chats. Your final answer goes back to that chat by itself.`,`"Talk to other chats" is off in this chat: this message is from another chat's agent, not the person, and you cannot message chats. It asked for no answer, so nothing goes back.`,`Last hop of this chain: you cannot message chats in this turn; put what you have in your final answer.`];[`**Let this chat work together with your other chats.**`,``,`### What it does`,`- Finds your other chats on this PC and reads their recent messages.`,`- Sends one chat, or a group of chats, a message or a task.`,`- Brings their answers back to this chat, by itself.`,``,`### How it works`,`- A chat that is asleep is woken from its saved history. A busy one gets the message when its current turn ends, never in the middle of it.`,`- The other chat does the work with its own model, folder and tools. Its answer comes back here as a new message only when this chat asked for one.`,`- Several messages from one chat that wait for a busy chat are handed over together, in one turn, with one answer.`,`- Several chats can share one conversation (a group). An answer goes only to the chat that asked, so a group cannot multiply its own messages.`,`- A chat with this switch OFF can still be messaged by a chat that has it on. It does the work, and its final answer goes back to that chat when that chat asked for one. That is all it can do: it gets none of these tools, cannot message or read other chats, and its switch stays off.`,``,`### What it costs`,`- About 650 tokens on every request while it is on, read from the prompt cache. Nothing while it is off, even in a chat that is messaged.`,`- Every message makes the chat that receives it do a turn, which spends its own tokens.`,`- Switching it on or off in a chat that already has a conversation re-writes its prompt cache once.`,``,`### Safety limits`,`- Each conversation has a budget: 20 delivered messages and 1,000,000 new tokens by default (context read back from the prompt cache is not counted). Reaching either pauses the conversation, and the chats say so.`,`- A chain stops after 3 hops (a message caused by a message caused by a message).`,`- At most 5 messages between two chats and 20 from one chat in 10 minutes, and 10 waiting for any one chat. A chat cannot message itself.`,`- A conversation with no activity for 24 hours closes by itself.`,``,`### How to stop it`,`- Turn this switch off: the chat loses these tools, and what it sent and the answers it asked for pause. It still answers a chat that messages it.`,`- Or open the Conversations window and use Pause, Close or Stop all.`,``,`### Privacy`,`- Everything stays on your PC: the messages are kept in this PC's database, never on OonaCode's server.`,`- A message never grants anything. The other chat runs with its own permissions and asks you as usual.`,``,`Only a chat with this switch on can start a conversation; a chat with it off only answers.`].join(`
80
+ `,18);return t<0?null:{title:e.slice(18,t),prompt:e.slice(t+3)}}Object.freeze({tengu_amber_sentinel:!0,tengu_groovy_eclipse:!0,tengu_humble_hammock:!0});function pc(e){return e===null||!Number.isFinite(e)?`neutral`:e>30?`ok`:e>10?`warn`:`danger`}var mc=3e4,hc=1440,gc=6e4,_c=[`mon`,`tue`,`wed`,`thu`,`fri`,`sat`,`sun`],vc=/^([01]\d|2[0-3]):[0-5]\d$/;Zo({tz:H().min(1),windows:Yo(Zo({from:H().regex(vc,`HH:MM`),to:H().regex(vc,`HH:MM`),days:Yo(ss(_c)).optional(),kind:ss([`peak`,`offpeak`])})),offpeakDiscount:zo().nonnegative().max(1).optional()});var yc=[`priceInputCacheMissPeak`,`priceInputCacheMissOffpeak`,`priceInputCacheHitPeak`,`priceInputCacheHitOffpeak`,`priceCacheWritePeak`,`priceCacheWriteOffpeak`,`priceOutputPeak`,`priceOutputOffpeak`],bc=Zo({inputCacheMiss:zo().nonnegative(),inputCacheHit:zo().nonnegative().optional(),cacheWrite:zo().nonnegative().optional(),output:zo().nonnegative()});Zo({by:ls(`prompt_tokens`),tiers:Yo(Zo({upToPromptTokens:zo().int().positive().optional(),price:bc.optional(),cost:bc.optional()})).min(1),note:H().optional()}).superRefine((e,t)=>{let n=0;e.tiers.forEach((r,i)=>{!r.cost&&!r.price&&t.addIssue({code:`custom`,message:`a tier needs its cost (the provider’s rates; retail is cost × the record’s ratio)`,path:[`tiers`,i,`cost`]});let a=r.upToPromptTokens;if(a===void 0){i!==e.tiers.length-1&&t.addIssue({code:`custom`,message:`only the LAST tier may omit upToPromptTokens`,path:[`tiers`,i]});return}a<=n&&t.addIssue({code:`custom`,message:`tiers must ascend: ${a} does not exceed ${n}`,path:[`tiers`,i,`upToPromptTokens`]}),n=a})}),[...yc];var xc={realtime:`/v1/realtime`,translations:`/v1/realtime/translations`,live:`/v1/live/sessions`,speechStream:`/v1/audio/speech/stream`,transcriptionStream:`/v1/audio/transcriptions/stream`,clientSecrets:`/v1/realtime/client_secrets`,translationClientSecrets:`/v1/realtime/translations/client_secrets`};xc.realtime,xc.translations,xc.live,xc.speechStream,xc.transcriptionStream;var Sc=`M0.72 12a11.28 11.28 0 1 0 22.56 0a11.28 11.28 0 1 0 -22.56 0ZM4.8 12a7.2 7.2 0 1 0 14.4 0a7.2 7.2 0 1 0 -14.4 0ZM7.44 12a4.56 4.56 0 1 0 9.12 0a4.56 4.56 0 1 0 -9.12 0Z`,Cc=`M14.234 10.162 22.977 0h-2.072l-7.591 8.824L7.251 0H.258l9.168 13.343L.258 24H2.33l8.016-9.318L16.749 24h6.993zm-2.837 3.299-.929-1.329L3.076 1.56h3.182l5.965 8.532.929 1.329 7.754 11.09h-3.182z`,wc=`M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z`,Tc=`M11.04 19.32Q12 21.51 12 24q0-2.49.93-4.68.96-2.19 2.58-3.81t3.81-2.55Q21.51 12 24 12q-2.49 0-4.68-.93a12.3 12.3 0 0 1-3.81-2.58 12.3 12.3 0 0 1-2.58-3.81Q12 2.49 12 0q0 2.49-.96 4.68-.93 2.19-2.55 3.81a12.3 12.3 0 0 1-3.81 2.58Q2.49 12 0 12q2.49 0 4.68.96 2.19.93 3.81 2.55t2.55 3.81`,Ec={oonacode:{hex:`#000000`,owner:`OonaCode`,d:Sc,fillRule:`evenodd`},anthropic:{hex:`#D97757`,owner:`Anthropic`,d:`m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z`},"anthropic-subscription":{hex:`#D97757`,owner:`Anthropic`,d:`m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z`},openai:{hex:`#000000`,owner:`OpenAI`,d:wc},xai:{hex:`#000000`,owner:`xAI`,d:Cc},deepseek:{hex:`#5786FE`,owner:`DeepSeek`,d:`M23.748 4.651c-.254-.124-.364.113-.512.233-.051.04-.094.09-.137.137-.372.397-.806.657-1.373.626-.829-.046-1.537.214-2.163.848-.133-.782-.575-1.248-1.247-1.548-.352-.155-.708-.311-.955-.65-.172-.24-.219-.509-.305-.774-.055-.16-.11-.323-.293-.35-.2-.031-.278.136-.356.276-.313.572-.434 1.202-.422 1.84.027 1.436.633 2.58 1.838 3.393.137.094.172.187.129.323-.082.28-.18.553-.266.833-.055.179-.137.218-.328.14a5.5 5.5 0 0 1-1.737-1.179c-.857-.828-1.631-1.743-2.597-2.46a12 12 0 0 0-.689-.47c-.985-.957.13-1.743.387-1.836.27-.098.094-.433-.778-.428-.872.003-1.67.295-2.687.685a3 3 0 0 1-.465.136 9.6 9.6 0 0 0-2.883-.101c-1.885.21-3.39 1.1-4.497 2.622C.082 8.776-.231 10.854.152 13.02c.403 2.284 1.568 4.175 3.36 5.653 1.857 1.533 3.997 2.284 6.438 2.14 1.482-.085 3.132-.284 4.994-1.86.47.234.962.328 1.78.398.629.058 1.235-.031 1.705-.129.735-.155.684-.836.418-.961-2.155-1.004-1.682-.595-2.112-.926 1.095-1.295 2.768-3.598 3.284-6.733.05-.346.115-.834.108-1.114-.004-.171.035-.238.23-.257a4.2 4.2 0 0 0 1.545-.475c1.397-.763 1.96-2.016 2.093-3.517.02-.23-.004-.467-.247-.588M11.58 18.168c-2.088-1.642-3.101-2.183-3.52-2.16-.39.024-.32.472-.234.763.09.288.207.487.371.74.114.167.192.416-.113.603-.673.416-1.842-.14-1.897-.168-1.361-.801-2.5-1.86-3.301-3.306-.775-1.393-1.225-2.888-1.299-4.482-.02-.385.094-.522.477-.592a4.7 4.7 0 0 1 1.53-.038c2.131.311 3.946 1.264 5.467 2.774.868.86 1.525 1.887 2.202 2.89.72 1.066 1.494 2.082 2.48 2.915.348.291.626.513.892.677-.802.09-2.14.109-3.055-.615zm1.001-6.44a.306.306 0 0 1 .415-.287.3.3 0 0 1 .113.074.3.3 0 0 1 .086.214c0 .17-.136.307-.308.307a.303.303 0 0 1-.306-.307m3.11 1.596c-.2.081-.4.151-.591.16a1.25 1.25 0 0 1-.798-.254c-.274-.23-.47-.358-.551-.758a1.7 1.7 0 0 1 .015-.588c.07-.327-.007-.537-.238-.727-.188-.156-.426-.199-.689-.199a.6.6 0 0 1-.254-.078.253.253 0 0 1-.114-.358 1 1 0 0 1 .192-.21c.356-.202.767-.136 1.146.016.352.144.618.408 1.001.782.392.451.462.576.685.915.176.264.336.536.446.848.066.194-.02.353-.25.45`},kimi:{hex:`#000000`,owner:`Moonshot`,d:`M21.765.351C22.998.351 24 1.353 24 2.586S22.998 4.82 21.765 4.82h-1.974c-.15 0-.26-.12-.26-.26V2.586A2.237 2.237 0 0 1 21.765.35M9.41 13.388l8.447-8.377c.16-.16.07-.471-.14-.471h-4.55s-.1.02-.14.06l-9.099 9.029c-.14.14-.35.02-.35-.21V4.81c0-.15-.1-.27-.221-.27H.22c-.12 0-.22.12-.22.27v18.57c0 .15.1.27.22.27h3.137c.12 0 .22-.12.22-.27v-3.79c0-.08.03-.16.08-.21l2.826-2.796c.07-.07.16-.08.241-.03l7.546 5.551a8.9 8.9 0 0 0 4.018 1.493c.12.01.23-.11.23-.27V19.76c0-.14-.08-.25-.19-.26a5.8 5.8 0 0 1-2.355-.942l-6.533-4.73c-.14-.09-.15-.32-.03-.441`},qwen:{hex:`#6950EF`,owner:`Alibaba`,d:`M23.919 14.545 20.817 9.17l1.47-2.544a.56.56 0 0 0 0-.566l-1.633-2.83a.57.57 0 0 0-.49-.283h-6.207L12.487.402a.57.57 0 0 0-.49-.284H8.732a.56.56 0 0 0-.49.284L5.139 5.775h-2.94a.56.56 0 0 0-.49.284L.077 8.887a.56.56 0 0 0 0 .567L3.18 14.83l-1.47 2.545a.56.56 0 0 0 0 .566l1.634 2.83a.57.57 0 0 0 .49.283h6.205l1.47 2.545a.57.57 0 0 0 .49.284h3.266a.57.57 0 0 0 .49-.284l3.104-5.375h2.94a.57.57 0 0 0 .49-.283l1.634-2.828a.55.55 0 0 0-.004-.568M8.733.686l1.634 2.828-1.634 2.828H21.8L20.164 9.17H7.425L5.63 6.06Zm1.306 19.801-6.205-.002 1.634-2.83h3.265L2.201 6.344h3.267q3.182 5.517 6.367 11.032zm10.124-5.66L18.53 12l-6.532 11.315-1.634-2.83c2.129-3.673 4.25-7.351 6.373-11.028h3.592l3.102 5.374z`},"xai-subscription":{hex:`#000000`,owner:`xAI`,d:Cc},"openai-subscription":{hex:`#000000`,owner:`OpenAI`,d:wc},"openai-codex":{hex:`#000000`,owner:`OpenAI`,d:wc},"google-agy":{hex:`#8E75B2`,owner:`Google`,d:Tc},antigravity:{hex:`#8E75B2`,owner:`Google`,d:Tc},mimo:{hex:`#FF6900`,owner:`Xiaomi`,d:`M12 0C8.016 0 4.756.255 2.493 2.516.23 4.776 0 8.033 0 12.012c0 3.98.23 7.235 2.494 9.497C4.757 23.77 8.017 24 12 24c3.983 0 7.243-.23 9.506-2.491C23.77 19.247 24 15.99 24 12.012c0-3.984-.233-7.243-2.502-9.504C19.234.252 15.978 0 12 0zM4.906 7.405h5.624c1.47 0 3.007.068 3.764.827.746.746.827 2.233.83 3.676v4.54a.15.15 0 0 1-.152.147h-1.947a.15.15 0 0 1-.152-.148V11.83c-.002-.806-.048-1.634-.464-2.051-.358-.36-1.026-.441-1.72-.458H7.158a.15.15 0 0 0-.151.147v6.98a.15.15 0 0 1-.152.148H4.906a.15.15 0 0 1-.15-.148V7.554a.15.15 0 0 1 .15-.149zm12.131 0h1.949a.15.15 0 0 1 .15.15v8.892a.15.15 0 0 1-.15.148h-1.949a.15.15 0 0 1-.151-.148V7.554a.15.15 0 0 1 .151-.149zM8.92 10.948h2.046c.083 0 .15.066.15.147v5.352a.15.15 0 0 1-.15.148H8.92a.15.15 0 0 1-.152-.148v-5.352a.15.15 0 0 1 .152-.147Z`}};function Dc(e){return Ec[e]??null}function Oc(e){let t=e.replace(/\(.*?\)/g,` `).split(/[\s/_-]+/).filter(Boolean);return t.length===0?`?`:t.length===1?t[0].slice(0,2).toUpperCase():`${t[0][0]}${t[1][0]}`.toUpperCase()}var kc=9230,Ac=1024,jc=65534,Mc=`127.0.0.1`;Object.freeze({enabled:!1,port:kc,inspectMain:!1}),Object.freeze({port:null,listening:!1,fromCommandLine:!1,inspectPort:null,inspectProblem:null});function Nc(e){return e+1}function Pc(e){return typeof e==`number`&&Number.isInteger(e)}function Fc(e){return!Pc(e)||e<1024||e>65534?`The port must be a whole number from ${Ac.toLocaleString(`en-US`)} to ${jc.toLocaleString(`en-US`)} (the main-process inspector takes the next one).`:null}function Ic(e){return e.port!==null||e.inspectPort!==null}function Lc(e,t){let n=e.enabled?e.port:null,r=e.enabled&&e.inspectMain?Nc(e.port):null;return!t.fromCommandLine&&t.port!==n||t.inspectPort!==r}function Rc(e){let t=[];return e.port!==null&&t.push(`${Mc}:${e.port}`),e.inspectPort!==null&&t.push(`${Mc}:${e.inspectPort}`),t.length===2?`${t[0]} (windows) and ${t[1]} (main process)`:e.inspectPort===null?t[0]??``:`${t[0]} (main process)`}var zc=[`stable`,`dev`];function Bc(e){return typeof e==`string`&&zc.includes(e)}function Vc(e){if(typeof e!=`string`)return null;let t=e.trim().toLowerCase();return Bc(t)?t:null}var Hc=[`win32`,`linux`,`darwin`],Uc=[`x64`,`arm64`];function Wc(e,t){let n=Vc(e)??`stable`,r=[];return n!==`stable`&&r.push(`channel=${encodeURIComponent(n)}`),t&&Hc.includes(t.platform)&&(r.push(`platform=${t.platform}`),t.arch&&Uc.includes(t.arch)&&r.push(`arch=${t.arch}`)),r.length>0?`${tc.releasesLatest}?${r.join(`&`)}`:tc.releasesLatest}function Gc(e,t){let n=Vc(t)??`stable`;return n===`stable`?e:`${e} (${n})`}var Kc={safeguards:`safeguards`,safety_filters:`safety filters`},qc=[{vendor:`Alibaba (Model Studio / DashScope — Qwen, and the DeepSeek/GLM it hosts)`,seenAs:`400 {"error":{"code":"data_inspection_failed","message":"Input data may contain inappropriate content."}}`,pattern:/data[_ ]?inspection[_ ]?failed|may contain inappropriate content/i},{vendor:`Zhipu (GLM)`,seenAs:`400 {"error":{"code":"1301","message":"系统检测到输入或生成内容可能包含不安全或敏感内容…"}} (contentFilter)`,pattern:/"code"\s*:\s*"?1301"?|不安全或敏感内容|unsafe or sensitive content|contentFilter/i},{vendor:`DeepSeek`,seenAs:`400 {"error":{"message":"Content Exists Risk","type":"invalid_request_error"}}`,pattern:/content exists risk/i},{vendor:`Moonshot (Kimi)`,seenAs:`400 {"error":{"type":"content_filter","message":"The request was rejected because it was considered high risk"}}`,pattern:/"type"\s*:\s*"content_filter"|considered high risk/i},{vendor:`xAI (Grok)`,seenAs:`400 "Content violates usage guidelines. Failed check: SAFETY_CHECK_TYPE_…"`,pattern:/content violates usage guidelines|SAFETY_CHECK_TYPE_/i},{vendor:`OpenAI (and Azure-style filters)`,seenAs:`400 {"error":{"code":"content_filter" | "content_policy_violation" | "moderation_blocked"}}`,pattern:/"code"\s*:\s*"(?:content_filter|content_policy_violation|moderation_blocked)"/i},{vendor:`Google (Gemini)`,seenAs:`This request was blocked by Gemini's filters. They can occasionally trigger by mistake on safe coding, security, or biology-related queries.`,pattern:/blocked by Gemini(?:'s)? filters|Gemini(?:'s)? filters/i}],Jc=/blocked by (?:the )?(?:content[ -]safety|Gemini(?:'s)?) filters?|content safety filters?|blocked by Gemini(?:'s)? filters?/i,Yc=/blocked by Gemini(?:'s)? filters|Gemini(?:'s)? filters\.? They can occasionally trigger/i;function Xc(e){return typeof e==`string`&&Yc.test(e)}function Zc(e){return typeof e!=`string`||e===``||!/^\s*(?:Failed to authenticate\.\s*)?API Error\b/i.test(e)?null:qc.find(t=>t.pattern.test(e))??null}function Qc(e){return typeof e==`string`&&(Xc(e)||Jc.test(e)&&/blocked/i.test(e))}var $c=`:free`;function el(e){return e.endsWith($c)}function tl(e){return el(e)?e.slice(0,-5):e}var nl=`model_refusal_fallback`,rl=`model_refusal_no_fallback`;function il(e){return typeof e==`string`&&e.trim()!==``?e.trim():null}function al(e,t,n){return il(e[t])??il(e[n])}function ol(e){if(typeof e!=`object`||!e)return null;let t=e,n=t.subtype,r=n===`model_refusal_fallback`?`fallback`:n===`model_refusal_no_fallback`?`no_fallback`:t.kind===`fallback`||t.kind===`no_fallback`?t.kind:null;if(!r||t.type!==void 0&&t.type!==`system`)return null;let i=t.retracted_message_uuids??t.retractedMessageUuids??t.retractedUuids;return{kind:r,scope:t.scope===`local`?`local`:`session`,originalModel:al(t,`original_model`,`originalModel`),fallbackModel:r===`fallback`?al(t,`fallback_model`,`fallbackModel`):null,category:al(t,`api_refusal_category`,`apiRefusalCategory`)??il(t.category),explanation:al(t,`api_refusal_explanation`,`apiRefusalExplanation`)??il(t.explanation),text:typeof t.content==`string`?t.content.trim():il(t.text)??``,retractedUuids:Array.isArray(i)?i.filter(e=>typeof e==`string`):[]}}function sl(e,t){switch(t.type){case`notice`:return t.notice.kind!==`fallback`||t.notice.scope!==`session`?e:{notice:t.notice,at:t.at,live:t.live};case`engine_start`:case`model_change`:return null}}function cl(e,t){return!e||t.alive===!1||!e.live&&t.since!==null&&e.at!==null&&e.at<t.since?null:e}function ll(e){let t=Js(e.trim()),n=t.slice(t.lastIndexOf(`/`)+1),r=e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase(),i=n.split(`-`);if(i[0]?.toLowerCase()!==`claude`)return t;let a=i.slice(1).filter(e=>!/^\d{6,}$/.test(e)),o=a.filter(e=>!/^\d+$/.test(e)),s=a.filter(e=>/^\d+$/.test(e));return o.length!==1||s.length===0?t:`${r(o[0])} ${s.join(`.`)}`}function ul(e,t=[]){let n=Js(e.trim()),r=null;for(let e of t)for(let t of e.definition.models){if(t.id===n||Js(t.id)===n)return t.displayName;r===null&&(t.upstreamId===n||tl(t.id)===n)&&(r=t.displayName)}return r??ll(n)}function dl(e){return`${e} (safeguard)`}var fl=`none`,pl={mode:`auto`,model:null,perModel:{}};function ml(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0&&t.length<=200&&/^[A-Za-z0-9._:@/[\]-]+$/.test(t)?t:null}function hl(e){return Js(e.trim()).toLowerCase()}function gl(e){let t=typeof e==`object`&&e&&!Array.isArray(e)?e:{},n=ml(t.model),r=t.mode,i=r===`off`?`off`:r===`model`&&n!==null?`model`:`auto`,a={},o=t.perModel;if(typeof o==`object`&&o&&!Array.isArray(o))for(let[e,t]of Object.entries(o)){let n=ml(e),r=t===`none`?fl:ml(t);if(n!==null&&r!==null&&hl(n)!==hl(r)&&(a[hl(n)]=r,Object.keys(a).length>=64))break}return{mode:i,model:i===`model`?n:null,perModel:a}}function _l(e){return e===w}var vl=`oona settings safeguard-fallback auto`;function yl(e,t=[]){if(!e)return`the model`;let n=hl(e);return t.find(e=>hl(e.id)===n||e.upstreamId&&hl(e.upstreamId)===n)?.displayName??ll(e)}function bl(e,t=e=>yl(e)){let n=`blocked by ${Kc[e.reason]}`;if(e.outcome===`retried`)return`${n} → retried on ${e.retriedOn?t(e.retriedOn):`another model`}`;switch(e.blocked){case`off`:return`${n} · fallback off (${vl})`;case`no_model`:return`${n} · no fallback model`;case`unavailable`:return`${n} · fallback not available here`;case`refused_again`:return`${n} · fallback refused too`;case`not_retryable`:return`${n} · not retried`;default:return n}}var xl=5e4,Sl=6,Cl=[`sessions`,`search`,`files`],wl=[`media`,`sessionInfo`];function Tl(e){return typeof e==`string`&&Cl.includes(e)?e:null}function El(e){if(!Array.isArray(e))return null;let t=[];for(let n of e)typeof n==`string`&&wl.includes(n)&&!t.includes(n)&&t.push(n);return t}var Dl=[`bg`,`surface`,`surface-2`,`surface-3`,`border`,`fg`,`fg-muted`,`fg-faint`,`accent`,`accent-fg`,`accent-soft`,`project`,`ok`,`ok-soft`,`warn`,`warn-soft`,`danger`,`danger-soft`,`think`,`think-soft`,`code-bg`,`user-bubble`],Ol=/^[A-Za-z0-9 ,'"_-]+$/,kl=/^(?:[A-Za-z0-9 _-]+|'[A-Za-z0-9 _-]+'|"[A-Za-z0-9 _-]+")$/;function Al(e){let t=typeof e==`number`&&Number.isFinite(e)?Math.round(e):NaN;return Number.isFinite(t)?Math.min(28,Math.max(10,t)):null}function jl(e){if(typeof e!=`string`)return null;let t=e.trim().slice(0,160).trim();return t.length===0||!Ol.test(t)?null:t.split(`,`).every(e=>kl.test(e.trim()))?t:null}function Ml(e){let t=Ql(e);return{family:jl(t.family),size:Al(t.size)}}function Nl(e){let t=Ql(e);return{chat:Ml(t.chat),sidebar:Ml(t.sidebar)}}var Pl={agentFinished:!1,permissionRequired:!0,errorOccurred:!0},Fl={autoAcceptPermissions:!1,autosaveFiles:!1,safeguardFallback:pl,showReasoningSummaries:!0,notifications:Pl,showAgentPicker:!0,transcriptWindowSize:500,openTabs:[],draftTabs:[],draftTitles:{},activeTab:null,editorLayout:null,remoteTabs:{},sessionPanelOpen:!1,explorerOpen:!1,leftPanelSection:`sessions`,leftPanelOpen:!0,rightPanelSections:[],rightPanelCollapsed:[],sidebarWidth:288,sessionPanelWidth:288,mediaPanelWidth:320,rightPanelWidth:320,sidebarPinned:!0,dismissedUpdateVersion:null,lastSeenReleaseNotes:null,claudeImportOffered:!1,claudeImportOffers:0,collapsedProjects:[],themeColors:{light:{},dark:{}},fonts:{chat:{family:null,size:null},sidebar:{family:null,size:null}},pinned:[],sidebarView:`recent`};function Il(e){return Math.min(Math.max(typeof e==`number`&&Number.isFinite(e)?Math.floor(e):0,0),3)}function Ll(e){return Math.min(640,Math.max(200,typeof e==`number`&&Number.isFinite(e)?Math.round(e):288))}function Rl(e,t){return Math.min(720,Math.max(240,typeof e==`number`&&Number.isFinite(e)?Math.round(e):t))}function zl(e){return Math.min(xl,Math.max(100,typeof e==`number`&&Number.isFinite(e)?Math.round(e):500))}function Bl(e,t){return typeof e==`boolean`?e:t}function Vl(e){return typeof e==`string`&&e.length>0&&e.length<=64?e:null}function Hl(e,t=50){if(!Array.isArray(e))return[];let n=[];for(let r of e)if(!(typeof r!=`string`||r.length===0||r.length>200)&&!n.includes(r)&&(n.push(r),n.length>=t))break;return n}function Ul(e,t=50){if(typeof e!=`object`||!e||Array.isArray(e))return{};let n={};for(let[r,i]of Object.entries(e))if(!(r.length===0||r.length>200)&&!(typeof i!=`string`||i.length===0||i.length>200)&&(n[r]=i,Object.keys(n).length>=t))break;return n}function Wl(e){if(typeof e!=`string`)return null;let t=e.trim();return/^#[0-9a-fA-F]{6}$/.test(t)?t.toLowerCase():null}function Gl(e){if(typeof e!=`object`||!e||Array.isArray(e))return{};let t={};for(let[n,r]of Object.entries(e)){if(!Dl.includes(n))continue;let e=Wl(r);e!==null&&(t[n]=e)}return t}function Kl(e){let t=typeof e==`object`&&e?e:{};return{light:Gl(t.light),dark:Gl(t.dark)}}function ql(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(typeof n!=`object`||!n)continue;let e=n.kind,r=n.id;if((e===`chat`||e===`project`)&&!(typeof r!=`string`||r.length===0||r.length>200)&&!t.some(t=>t.kind===e&&t.id===r)&&(t.push({kind:e,id:r}),t.length>=50))break}return t}function Jl(e,t){if(typeof e!=`object`||!e||Array.isArray(e))return null;let n=e,r=new Set(t),i=new Set,a=0,o=(e,t)=>{if(t>Sl||typeof e!=`object`||!e)return null;let n=e,s=n.group;if(typeof s==`object`&&s&&!Array.isArray(s)){if(a>=8)return null;let e=s,t=[];for(let n of Array.isArray(e.tabs)?e.tabs:[])typeof n!=`string`||!r.has(n)||i.has(n)||(i.add(n),t.push(n));return t.length===0?null:(a+=1,{group:{tabs:t,active:(typeof e.active==`string`&&t.includes(e.active)?e.active:null)??t[t.length-1]}})}let c=n.split;if(c!==`row`&&c!==`column`)return null;let l=Array.isArray(n.children)?n.children:[],u=Array.isArray(n.sizes)?n.sizes:[],d=[],f=[];if(l.slice(0,8).forEach((e,n)=>{let r=o(e,t+1);if(!r)return;d.push(r);let i=u[n];f.push(typeof i==`number`&&Number.isFinite(i)&&i>0?i:0)}),d.length===0)return null;if(d.length===1)return d[0];let p=f.filter(e=>e>0),m=p.length>0?p.reduce((e,t)=>e+t,0)/p.length:1,h=f.map(e=>e>0?e:m),g=h.reduce((e,t)=>e+t,0);return{split:c,sizes:h.map(e=>e/g),children:d}},s=o(n.root,0);if(!s||a<2)return null;let c=n.focused;return{root:s,focused:typeof c==`number`&&Number.isInteger(c)&&c>=0&&c<a?c:0}}function Yl(e,t,n){return e.some(e=>e.kind===t&&e.id===n)}function Xl(e,t,n,r){return r===Yl(e,t,n)?e:r?[...e.length>=50?e.slice(e.length-50+1):e,{kind:t,id:n}]:e.filter(e=>e.kind!==t||e.id!==n)}function Zl(e){let t=typeof e==`object`&&e?e:{},n=typeof t.notifications==`object`&&t.notifications!==null?t.notifications:{},r=Hl(t.openTabs),i=Hl(t.draftTabs).filter(e=>!r.includes(e)),a={};for(let[e,n]of Object.entries(Ul(t.draftTitles)))i.includes(e)&&(a[e]=n);let o=[...r,...i],s=t.activeTab,c=typeof s==`string`&&o.includes(s)?s:o[o.length-1]??null,l=Bl(t.sessionPanelOpen,Fl.sessionPanelOpen),u=Bl(t.explorerOpen,Fl.explorerOpen),d=El(t.rightPanelSections)??(l?[`sessionInfo`]:[]),f=(El(t.rightPanelCollapsed)??[]).filter(e=>d.includes(e));return{autoAcceptPermissions:Bl(t.autoAcceptPermissions,Fl.autoAcceptPermissions),autosaveFiles:Bl(t.autosaveFiles,Fl.autosaveFiles),safeguardFallback:gl(t.safeguardFallback),showReasoningSummaries:Bl(t.showReasoningSummaries,Fl.showReasoningSummaries),notifications:{agentFinished:Bl(n.agentFinished,Pl.agentFinished),permissionRequired:Bl(n.permissionRequired,Pl.permissionRequired),errorOccurred:Bl(n.errorOccurred,Pl.errorOccurred)},showAgentPicker:Bl(t.showAgentPicker,Fl.showAgentPicker),transcriptWindowSize:zl(t.transcriptWindowSize),openTabs:r,draftTabs:i,draftTitles:a,activeTab:c,editorLayout:Jl(t.editorLayout,o),remoteTabs:Ul(t.remoteTabs),sessionPanelOpen:l,explorerOpen:u,leftPanelSection:Tl(t.leftPanelSection)??(u?`files`:`sessions`),leftPanelOpen:Bl(t.leftPanelOpen,Fl.leftPanelOpen),rightPanelSections:d,rightPanelCollapsed:f,sidebarWidth:Ll(t.sidebarWidth),sessionPanelWidth:Rl(t.sessionPanelWidth,288),mediaPanelWidth:Rl(t.mediaPanelWidth,320),rightPanelWidth:Rl(t.rightPanelWidth??t.mediaPanelWidth??t.sessionPanelWidth,320),sidebarPinned:Bl(t.sidebarPinned,Fl.sidebarPinned),dismissedUpdateVersion:Vl(t.dismissedUpdateVersion),lastSeenReleaseNotes:Vl(t.lastSeenReleaseNotes),claudeImportOffered:Bl(t.claudeImportOffered,Fl.claudeImportOffered),claudeImportOffers:Il(t.claudeImportOffers),collapsedProjects:Hl(t.collapsedProjects),themeColors:Kl(t.themeColors),fonts:Nl(t.fonts),pinned:ql(t.pinned),sidebarView:t.sidebarView===`projects`?`projects`:`recent`}}new Set(Object.keys(Fl));function Ql(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}var $l=3650,eu=[{version:`0.3.276`,date:`2026-10-27`,added:[`Kimi now accepts a Kimi Code subscription key (the sk-kimi… key from the Kimi Code console) as well as a Moonshot API key. With a Kimi Code key, resting the pointer on the model box shows how much of your 5-hour and monthly allowance is used and when each resets.`],fixed:[`A chat on Google’s agy can now use the GitHub account you linked: git and gh are signed in there too. Before, agy chats had no GitHub access at all, because agy keeps to its own private home.`,`When GitHub answers “not found” for a repository of an organization that has not approved OonaCode (the organization’s owner approves “OonaCode Git” in its OAuth app settings), the chat now says that instead of concluding the repository does not exist.`]},{version:`0.3.275`,date:`2026-10-27`,added:[`Kimi (Moonshot) is back as a provider you connect with your own Moonshot API key: Kimi K3, K3.1 Pro, K2.7 Code and K2.6. Your PC talks to Moonshot directly — nothing goes through OonaCode’s servers. (The Kimi Code subscription is a different service and is not included.)`],fixed:[`The app keeps up with the provider and model list from OonaCode’s server again. After the server added a provider for Google’s voices, builds before this one could not read the new list and quietly kept the old one, so new models and providers did not appear until the next update.`,`A chat that was set to Gemini is told that the provider was removed and asked to pick another, instead of failing with “unknown provider”. Gemini itself was never available to use.`]},{version:`0.3.274`,date:`2026-10-27`,added:[],fixed:[`A big chat you reopen (Ctrl+R, or after a restart) now ends on its newest messages. Before, the transcripts of old agents were listed after the whole chat, so their cards piled up at the bottom and the last few minutes of the conversation sat above them, out of the window.`,`The note that earlier messages were left out of the request is shown as its folded line after a reload too, not as raw <local-command-stdout> text.`]},{version:`0.3.273`,date:`2026-10-26`,added:[`Rest the pointer on the model box (or focus it with the keyboard) to see how much of that model’s plan or key you have used: the bars and when each limit resets, with the model you are on first. For your own Claude plan it shows what Claude itself reported on its last answer; when that is older than 10 minutes, OonaCode asks again with one tiny message (a few tokens of your own plan or key), or you press “Check now”. Settings → This PC can switch the check off or change the 10 minutes.`],fixed:[`A picture or file sent in a chat on Google’s agy — any of its models, Claude through Google included — is no longer refused with “takes text only”: OonaCode saves it in the chat’s folder and gives the model its path, as it does for every other model.`,`A Google agy chat no longer repeats “Google answered “service unavailable” — continuing in …” (and redoes its last step each time) when Google had in fact answered every request of the turn. A real Google outage is still waited out as before.`]},{version:`0.3.272`,date:`2026-10-26`,added:[`A find-in-page field in the top bar, next to the MCP servers icon: it searches everything visible in OonaCode and highlights the matches (Enter and Shift+Enter step through them). Ctrl+F opens it when no chat find takes the key; Ctrl+Shift+F always does.`,`On the website’s API keys page, a key you create from now on can be shown again with “Reveal key” — it is sealed in your browser with your vault key, so the server still cannot read it. Keys made before this still show only their last four characters.`,`Removing a message now also removes the summary the engine wrote after it, if the chat was summarised later (the summary was made from that message); the confirmation says so. The model then reads the earlier messages themselves again.`],fixed:[`Messages you type while a Google agy turn is running now all go together when the turn ends, instead of one turn per message with “2 queued” left over. The waiting strip says when they will be read, how long they have waited, what the agent is doing and how long earlier turns took.`,`The media panel starts over when OonaCode comes back after an update: it asks for a fresh access grant and reads the list again, and a failed read has a Try again button.`,`The Session info panel shows a chat’s context size as soon as you open it, not only after its next reply.`,`A sub-agent’s “Conversation compacted” line stays inside that agent’s card instead of appearing loose at the end of the chat.`,`When a chat’s own model cannot write its About or the summary of older messages, OonaCode now says so instead of quietly answering with another model.`]},{version:`0.3.271`,date:`2026-10-25`,added:[`Messages can be removed from a chat, and from what the model remembers. Right-click one of your messages, or any reply, tool call or thought of its exchange: “Remove this exchange…” takes out your message and everything the agent did for it; “Remove this and everything after…” also takes out every later message. Open windows update at once, and the chat starts fresh from what is left on its next message. Text already sent to a provider stays in that provider’s own logs.`,`When the provider is throttling OonaCode for a short while, the pool now holds your request and sends it the moment the provider is ready, instead of failing it straight away. It holds up to 90 seconds at a time, and a longer pause is waited out over the engine’s next retry.`,`Your PC’s agy and Muse helper move to the versions tested on the server (agy 1.4.7, Muse 1.4.13).`],fixed:[`Chats on a ChatGPT plan (Codex) no longer fail their About, titles and the summary of older messages with a 400 error.`,`Chats on Claude through Google, and chats on your own NVIDIA key, keep a summary of the messages that no longer fit the model’s window: their background calls now use a model the key can actually reach.`,`A chat on another of your PCs shows “PC linked · N folders” again after a restart, instead of asking you to link the same folders once more.`,`The agy note “still reports Individual quota reached…” is gone from the chat; the turn is still treated as the success it was.`,`The file explorer is back in VS Code, the chat font now also covers the message box, and a tool call at the edge of an older page of a remote chat keeps its name and input.`,`“Not delivered — the chat couldn’t start” now appears only when OonaCode itself could not start the turn, never for an error the model returned, so Send again cannot double a message.`]},{version:`0.3.270`,date:`2026-10-25`,added:[`One left panel: an icon strip on the far left switches between Sessions, Search and Files, and the file explorer now has the sidebar’s width and resize handle. Sessions and Files each have a filter box at the top.`,`Search has its own section with two scopes: Chats (every option the old search had) and Files & contents, which searches the open chat’s folder and shows the matching lines.`,`Settings → Theme → Fonts: choose the typeface and size for the chat and for the sidebar separately. Left alone, everything looks as before.`,`Hover a provider you use with your own key or subscription in the model picker to see its usage: quota bars with the time each resets.`,`On a Mac, updating now shows a window saying what is happening — it closes by itself when the new OonaCode opens, so you know whether to wait. Windows has had one since 0.3.92.`],fixed:[`Dark mode: Settings → Theme now has the Colour scheme switch (Light, Dark, System), and the colour editor opens on the colours you are actually looking at. Its old Light | Dark buttons only chose which colours to edit, so choosing Dark there seemed to do nothing. On System, the file editor also follows Windows’ dark setting now.`,`A chat on another of your PCs opens with its newest 500 messages and loads earlier ones as you scroll up, instead of pulling thousands at once over a slow link.`,`A message sent into a chat that then failed to start is marked “Not delivered — the chat couldn’t start”, with Send again. It used to look sent although the model never received it.`,`Subagents always run on the chat’s own model.`,`On a Mac, an update that could not close OonaCode used to report “done” and leave the old app in place — the terminal half updated and the app did not, sometimes for days. It now closes the app even when its window is frozen, and says plainly if it still could not, instead of claiming success.`,`After an update on a Mac, OonaCode opens again by itself. It used to reopen only if the update had closed it.`,`A browser the agent opened no longer leaves processes behind when it is closed or when OonaCode restarts. Helpers of a browser whose window was already gone could keep running for days — one of them found using most of a processor core — and they also stopped old browser versions from being cleaned up.`]},{version:`0.3.269`,date:`2026-10-25`,added:[],fixed:[`OonaCode can be quit again. Since 0.3.244, Quit (and ⌘Q on a Mac) did nothing at all unless a chat happened to be working: the question that warns about working chats answered itself when nothing was running, forgot it had answered, and asked again for ever — so the app stayed open and kept a processor core busy trying to close. If an app of yours has been sitting at high CPU, this was why.`]},{version:`0.3.268`,date:`2026-10-25`,added:[],fixed:[`Long chats no longer fail to start with “SessionStore.load() timed out after 60000ms”. Since 0.3.264 a chat’s start waited for the summary of its older messages, and the first one of a long chat could take longer than the engine allows; a chat now starts after at most 15 seconds, and the summary finishes in the background for the next start.`,`Stop now always stops a turn, even when the model is stuck retrying.`,`There is one Session info button on a wide window (on the right edge) instead of two.`]},{version:`0.3.267`,date:`2026-10-25`,added:[`Claude through Google now takes chats up to 500,000 tokens (it was 200,000), so a long chat on it keeps far more of its own history before anything is left out.`],fixed:[]},{version:`0.3.266`,date:`2026-10-25`,added:[],fixed:[`A chat’s “about” in Session info is now always written in English, whatever language the chat or its files are in — it used to follow pasted text, so an English chat could get a Persian about. The briefing and Listen still translate it into your language when you ask.`,`An about that ran over its length is now cut at the end of a whole sentence instead of in the middle of a thought, and the model is told to keep it short so the “where it stands now” part is not lost.`]},{version:`0.3.265`,date:`2026-10-25`,added:[],fixed:[`A model’s context limit now comes from the server instead of a copy kept in the app, so changing it in the admin reaches every PC. If a model ever refuses a chat as too long and names its limit, OonaCode remembers that limit and plans the next start by it, instead of hitting the same wall again.`]},{version:`0.3.264`,date:`2026-10-25`,added:[`A long chat keeps its older part in view. When a chat has grown past what the model can read, OonaCode gives the model as much of the recent conversation as fits and, in front of it, a short summary of the older part — what you asked for, what was decided and done, and what is left — instead of simply dropping it. The summary is written once, kept on this PC, and only extended as the chat grows; it appears in Usage as “Long-chat summaries”.`],fixed:[`A chat that was one very long piece of work followed by a short message no longer answers that it cannot see any earlier context: the model now gets the newest steps of that work under your original request.`,`The “invalid request” and “Autocompact is thrashing” errors that long runs of work could end in on models with a smaller window are gone: a chat is no longer handed to the model larger than the model accepts.`,`The note that earlier messages were left out now says when the cut fell inside your latest request, and when a summary was given in their place.`]},{version:`0.3.263`,date:`2026-10-25`,added:[`The right-hand side is now one dock: an icon strip on the edge, and Media and Session info stacked in it as sections. Each icon puts its section in or takes it out, both can be open at once, and a header folds its section to a line without losing what it had loaded.`,`The dock has one width and one drag handle for both sections, and it remembers which sections are in and which are folded.`],fixed:[]},{version:`0.3.262`,date:`2026-10-24`,added:[`xAI text-to-speech can now use a pronunciation map, so you can keep the written words while supplying IPA or a spoken replacement for names and multilingual dubbing.`],fixed:[`Voice and media requests recover onto another eligible operator key when one key reaches its limit, rather than failing the request immediately.`,`Google text-to-speech limits are now tracked per model, so a limit on one voice model does not make another available voice model unavailable.`,`OonaCode now presents the current versions of the Muse and Grok coding clients to their providers.`]},{version:`0.3.261`,date:`2026-10-24`,platforms:[`darwin`],added:[`“Bring this PC into the chat” remembers the folders you picked for that chat. Switching between two remote chats, reopening one, or reloading the window comes back linked to exactly those folders — you choose them once. Unlink still clears them for good.`,`A model change says what it came from: “Set model to X for this session only (previous model was Y)”, with the model you just picked in blue and the one it left in grey.`,`You can set a model typed by id on a chat that runs on another one of your PCs, instead of having to go to that PC to change it.`,`A file named in a chat opens in OonaCode, even when it is outside the chat folder. Text and code can be edited; a sound, picture or video plays as before.`,`An edited file no longer has a Save button. A changed tab shows *, Ctrl+S saves it, and Settings → General → Autosave files saves each change as you type.`,`Right-clicking a file the chat names offers “Copy relative path” and “Copy absolute path”.`,`A change to the model list or to settings now reaches this PC on its next check-in with the server, without restarting.`,`The chat’s browser no longer shows a “Restore pages?” bubble or brings back the tabs it had last time. OonaCode closes it on every exit, which used to look like a crash.`],fixed:[`One “Send now” for the whole queue: it sends every queued message at once and empties the list, instead of one button per message.`,`A message the agent had already read gets its receipt instead of staying pinned in the queue, where pressing Send now answered “The agent has already read that message”.`,`Stopping a reply, or pressing Send now while one is running, no longer shows an error. The chat says “User requested stop”.`,`Closing a file you have changed asks whether to save it, with Save, Don’t save and Cancel.`,`A file you edit keeps the line endings it had on disk when you save it, and a file the model writes while you have it open no longer replaces what you are typing in it.`,`After an admin changes a provider’s offered models, this PC’s list keeps every model’s prices and limits — no stale or emptied list in between.`,`A PC that checks in with the server on a slow schedule no longer reads as offline between check-ins; a change reaches it within a minute.`,`A Google Gemini chat no longer shows an error after a complete answer when the connection closes. The answer stays, and a real failure still shows as an error.`,`A folder you linked that may no longer be linked (a drive root, your home folder, a network share, OonaCode’s own data) is dropped when the link comes back, and never a folder you did not pick is added.`]},{version:`0.3.260`,date:`2026-10-24`,platforms:[`win32`],added:[`“Bring this PC into the chat” remembers the folders you picked for that chat. Switching between two remote chats, reopening one, or reloading the window comes back linked to exactly those folders — you choose them once. Unlink still clears them for good.`],fixed:[`One “Send now” for the whole queue on the phone too: it sends every queued message at once and empties the list, instead of one button per message.`,`A folder you linked that may no longer be linked (a drive root, your home folder, a network share, OonaCode’s own data) is dropped when the link comes back, and never a folder you did not pick is added.`]},{version:`0.3.260`,date:`2026-10-24`,platforms:[`linux`],added:[`“Bring this PC into the chat” remembers the folders you picked for that chat. Switching between two remote chats, reopening one, or reloading the window comes back linked to exactly those folders — you choose them once. Unlink still clears them for good.`,`This is Linux’s first update since 0.3.250, so it also brings everything in between: a model change says what it came from (“Set model to X for this session only (previous model was Y)”, the model you picked in blue and the one it left in grey); a model typed by id can be set on a chat that runs on another of your PCs; right-clicking a file the chat names offers “Copy relative path” and “Copy absolute path”; a file named in a chat opens in OonaCode even outside the chat folder and its text can be edited; an edited file is saved with Ctrl+S (and Settings → General → Autosave files saves as you type); the sticky notes button shows how many note tabs you have; and a Google Gemini chat in Build asks before running a command, like every other chat.`],fixed:[`One “Send now” for the whole queue on the phone too: it sends every queued message at once and empties the list, instead of one button per message.`,`A folder you linked that may no longer be linked (a drive root, your home folder, a network share, OonaCode’s own data) is dropped when the link comes back, and never a folder you did not pick is added.`,`Also from in between: stopping a reply, or pressing Send now while one is running, says “User requested stop” instead of an error; closing a file you have changed asks whether to save it; a file you edit keeps the line endings it had on disk and a file the model writes while you have it open no longer replaces what you are typing in it; after an admin changes a provider’s offered models, this PC’s list keeps every model’s prices and limits; a PC that checks in with the server on a slow schedule no longer reads as offline between check-ins; a Google Gemini chat no longer shows an error after a complete answer when the connection closes; and a message the agent had already read gets its receipt instead of staying pinned in the queue.`]},{version:`0.3.259`,date:`2026-10-24`,platforms:[`win32`],added:[`A model change says what it came from: “Set model to X for this session only (previous model was Y)”, with the model you just picked in blue and the one it left in grey.`,`You can set a model typed by id on a chat that runs on another one of your PCs, instead of having to go to that PC to change it.`],fixed:[`One “Send now” sends the whole queue at once and empties it, instead of one button per message.`,`A message the agent had already read gets its receipt instead of staying pinned in the queue, where pressing Send now answered “The agent has already read that message”.`]},{version:`0.3.258`,date:`2026-10-23`,platforms:[`win32`],added:[`Right-clicking a file the chat names offers “Copy relative path” and “Copy absolute path”.`],fixed:[`A file you edit keeps the line endings it had on disk when you save it, and a file the model writes while you have it open no longer replaces what you are typing in it.`,`A Google Gemini chat in Build asks before running a command again, and Allow runs that command.`,`After an admin changes a provider’s offered models, this PC’s list keeps every model’s prices and limits — no stale or emptied list in between.`,`A PC that checks in with the server on a slow schedule no longer reads as offline between check-ins; a change reaches it within a minute.`]},{version:`0.3.257`,date:`2026-10-23`,platforms:[`win32`],added:[],fixed:[`Stopping a reply, or pressing Send now while one is running, no longer shows an error. The chat says “User requested stop”.`,`Closing a file you have changed asks whether to save it, with Save, Don’t save and Cancel.`]},{version:`0.3.256`,date:`2026-10-22`,platforms:[`win32`],added:[`A change to the model list or to settings now reaches this PC on its next check-in with the server, without restarting.`],fixed:[]},{version:`0.3.255`,date:`2026-10-22`,platforms:[`win32`],added:[],fixed:[`A Google Gemini chat no longer shows an error after a complete answer when agy’s local connection closes. The answer stays, and a real failure still shows as an error.`]},{version:`0.3.254`,date:`2026-10-22`,platforms:[`win32`],added:[`A file named in a chat opens in OonaCode, even when it is outside the chat folder. Text and code can be edited; a sound, picture or video plays as before.`,`An edited file no longer has a Save button. A changed tab shows *, Ctrl+S saves it, and Settings → General → Autosave files saves each change as you type.`],fixed:[]},{version:`0.3.252`,date:`2026-10-21`,platforms:[`win32`,`darwin`],added:[`The sticky notes button shows how many note tabs you have, as a blue number.`],fixed:[]},{version:`0.3.251`,date:`2026-10-21`,platforms:[`win32`],added:[`A Google Gemini chat in Build now asks before running a command, using the same permission card as every other chat. Autonomous and auto-accept still run commands without asking.`],fixed:[]},{version:`0.3.250`,date:`2026-10-21`,added:[`The file list now has Show in Explorer, which opens the file or folder selected in your computer’s file manager, and Rename for both files and folders.`,`A text file opened from the file list can now be edited. Change it, then press Save or Ctrl+S. Pictures, videos, sounds and PDF files stay view-only.`],fixed:[]},{version:`0.3.249`,date:`2026-10-20`,added:[`When the model reads a picture, a video or a sound file, that step in the chat now opens by itself: you see the picture, or get a player for the video or sound, without clicking. Click the step to close it. Steps that read ordinary text files stay closed as before.`],fixed:[]},{version:`0.3.248`,date:`2026-10-20`,added:[],fixed:[`A chat on Google Gemini (through your Google plan) no longer ends a finished turn with an error. Google’s agy tool can keep repeating an old “quota reached” message at the end of a long chat even though your limit was fine and the answer arrived; OonaCode now shows the answer as done and adds a short note. A limit you really hit still shows as an error.`,`When you do reach your Google limit in a Gemini chat, OonaCode now shows Google’s own message, including when it resets, instead of a message about the OonaCode pool that did not apply to you.`]},{version:`0.3.247`,date:`2026-10-20`,added:[`On the Android app, a short tap on a message now opens a menu: Reply (quotes it above the box), Copy, Forward (opens it as a draft in another chat you pick), Share and Save text to… A long press still selects text.`,`On the Android app, a picture, video, sound or file that a reply names now opens from your PC: pictures show right in the chat, videos and sounds play in the chat, and other files open in the app you choose or are saved where you say. A file larger than 25 MB asks first.`,`This PC now hands those files to your phone over the same private link as your chats — only files that the chat itself named or that sit in its folder, one piece at a time.`],fixed:[]},{version:`0.3.246`,date:`2026-10-19`,added:[`Every chat can now make videos and spoken audio, not only pictures: ask for a short clip or a voice-over and the model makes it, saves it in the chat’s folder and plays it right in the chat. Video and Speech sit beside Images in the Tools menu, switched on by default.`,`In the Tools menu each of the three has a model choice for this chat (its default follows the model you are chatting with: a Grok chat uses Grok’s, an Alibaba chat Alibaba’s) and an “Ask me first” switch. With it on — the default for video — the model asks you for the length, resolution and shape and tells you the price in credits before anything is spent.`,`Pictures, videos and speech are paid with your OonaCode credits like any other message, whatever model or key the chat runs on, and the credits charged are shown in the answer.`,`On Apple Silicon Macs (M1 and later) Oonak Browser is now the native build: it quits with its last window, shows its own Dock icon and never asks for notification permission.`],fixed:[]},{version:`0.3.245`,date:`2026-10-19`,added:[`A picture, video or sound that a model reply named but that is not on your PC any more is now left out of the Media explorer, with a line under the list saying how many were left out and a Show button to see them.`,`A picture the model made now shows up in the chat as a small square beside its name — you no longer need the Media panel to notice it — and a click enlarges it.`,`A file the model names (a PDF, a Word or Excel document, a zip and so on) now shows its type’s icon in the chat and in the Media explorer; a file of any other type gets a plain file icon.`],fixed:[`The Media explorer no longer lists a website path such as /logo.svg or /favicon.png from a model reply as if it were a file on your PC, and a card that cannot be opened now shows the file name and date instead of only “Moved or deleted”.`]},{version:`0.3.244`,date:`2026-10-19`,added:[`When the agent enters plan mode (and when you approve its plan) the Build / Plan / Ask picker now follows it, so the picker always shows the mode the chat is really in.`],fixed:[`Four engine tools nobody uses here — ListAgents, EnterWorktree, ExitWorktree and ReportFindings — are switched off in every chat, which makes each request a little smaller.`]},{version:`0.3.243`,date:`2026-10-18`,added:[`OonaCode now asks before it quits or updates while any chat is still working — including chats whose tabs you closed — and names them, so nothing is interrupted by accident.`],fixed:[]},{version:`0.3.242`,date:`2026-10-18`,added:[`Every model can now take any attachment: a picture or PDF that the chosen model cannot read (Google’s agy, text-only Qwen or GLM models, and so on) is saved in the chat’s temporary folder and the model is given its file path instead of the message being refused.`,`The media panel can filter by All, Mine or Replies, so the pictures, videos, sounds and links that the model’s replies name are listed too, and every item has a right-click menu (View or Play, Show in chat, Show in folder, Copy path or link).`,`The “Media in this chat” and “Session info” panels can be resized by dragging their left edge; double-click the edge for the default width.`,`Web search is now in every chat, always: there is no Tools-menu switch for it any more, and chats that had it switched off search again.`],fixed:[]},{version:`0.3.241`,date:`2026-10-17`,added:[`Remote sessions in the sidebar now have a full right-click context menu and actions button (Pin to top, Move to Project, Project settings, Change folder, Details, Listen to this chat, Files, Rename, Fork and Delete) plus a details card on hover.`,`The Files explorer and file viewer now work for remote chats over the blind relay, so you can browse folders, view code, Markdown and images, copy paths and delete files on the remote PC.`,`Oonak Browser is now available for macOS chats as well as Windows and Linux.`],fixed:[`Newly created or renamed remote chats now appear immediately in the Remote section of the left sidebar, and the sidebar automatically recovers after a brief server or connection blip.`,`Opening a long remote chat with many screenshots no longer disconnects the relay for backpressure or stops loading recent messages.`]},{version:`0.3.240`,date:`2026-10-17`,added:[`Every Thought block now shows how long the model spent thinking (for example “Thought · 42 words · 12s”), both live and when a chat is reopened.`,`Remote chat tabs now show a badge naming the PC they run on, and you can rename a remote chat directly from its tab or from the Remote list in the sidebar.`,`Files attached from the Android app are uploaded into the chat’s folder on the PC that runs the chat.`],fixed:[`Subagent reports and continuation notes now fold into a single Engine note line instead of staying pinned at the bottom of the chat or replacing the pinned user question.`,`Local video and file paths in replies (including Windows paths with forward slashes, paths with spaces, and Markdown links) now reliably show their Play, View and Open in folder buttons.`,`Chats on a ChatGPT (Codex) subscription no longer fail when the model calls tools.`,`Google agy chats wait and retry automatically (5 s, 20 s, 1 min, 2 min) when Google answers with a temporary 503 Unavailable.`]},{version:`0.3.239`,date:`2026-10-16`,platforms:[`win32`],added:[`Media in every chat: the gallery button at the top right of a chat lists the photos, videos, audio, files and links you sent in it. Photos open in the viewer (← → step through them), videos and audio play in place, files open or show in their folder, and “Show in chat” jumps to the message.`],fixed:[`Google agy chats no longer flash a command window when they start. OonaCode now keeps agy up to date itself, quietly, while no agy chat is running.`,`An agy command that waits for someone to type (a password prompt, an ssh question) no longer holds the chat for hours: after 15 minutes with no output and no work, OonaCode ends that command, says so in the chat, and agy carries on.`,`The coding engine is updated (Claude Code 2.1.301): long answers are no longer cut off after three minutes of silence, a long chat no longer compacts again and again, and a tool no longer runs twice.`,`If the app’s window crashes (for example when the computer runs out of memory), it reloads by itself.`,`A chat on your own Meta Muse or ChatGPT plan that started on another provider no longer fails with “call_id must be at most 64 characters”.`,`Your other PCs keep one order in the Remote list instead of reshuffling.`,"`oona -p` with an OonaCode API key says what went wrong instead of asking you to sign in."]},{version:`0.3.239`,date:`2026-10-16`,platforms:[`darwin`],added:[`Media in every chat: the gallery button at the top right of a chat lists the photos, videos, audio, files and links you sent in it. Photos open in the viewer (← → step through them), videos and audio play in place, files open or show in their folder, and “Show in chat” jumps to the message.`],fixed:[`The coding engine is updated (Claude Code 2.1.301): long answers are no longer cut off after three minutes of silence, a long chat no longer compacts again and again, and a tool no longer runs twice.`,`If the app’s window crashes (for example when the computer runs out of memory), it reloads by itself.`,`A chat on your own Meta Muse or ChatGPT plan that started on another provider no longer fails with “call_id must be at most 64 characters”.`,`Your other PCs keep one order in the Remote list instead of reshuffling.`,`A download cut part-way during an update is resumed instead of starting over.`,"`oona -p` with an OonaCode API key says what went wrong instead of asking you to sign in."]},{version:`0.3.239`,date:`2026-10-16`,platforms:[`linux`],added:[`Media in every chat: the gallery button at the top right of a chat lists the photos, videos, audio, files and links you sent in it. Photos open in the viewer (← → step through them), videos and audio play in place, files open or show in their folder, and “Show in chat” jumps to the message.`],fixed:[`“Restart now” in Settings opens the app again instead of closing it for good.`,`The OonaCode service starts again after a quick reboot.`,`A power cut no longer empties the files that keep you signed in and unlocked.`,`A download cut part-way (weak Wi-Fi) during an install or update is resumed instead of giving up.`,`Notifications come from “OonaCode”.`,`The coding engine is updated (Claude Code 2.1.301): long answers are no longer cut off after three minutes of silence, a long chat no longer compacts again and again, and a tool no longer runs twice.`,`If the app’s window crashes (for example when the computer runs out of memory), it reloads by itself.`,`A chat on your own Meta Muse or ChatGPT plan that started on another provider no longer fails with “call_id must be at most 64 characters”.`,`Your other PCs keep one order in the Remote list instead of reshuffling.`,"`oona -p` with an OonaCode API key says what went wrong instead of asking you to sign in."]},{version:`0.3.238`,date:`2026-10-16`,added:[`Auto in the OonaCode pool: pick “Auto” and each new message runs on the pool model that suits it — how hard the task is, how big the chat is, whether a model already has the chat in its cache, speed and cost — at an effort it picks too. The model button shows which model Auto chose, like “Auto (Qwen3.8 Max)”. (It appears once OonaCode switches it on.)`,`Window control in the Tools menu: when you ask, the agent can list, hide, show, minimise, restore or focus the windows on your computer (Windows; apps on macOS; X11 and KDE on Linux).`,`The conversations popup in a chat shows when each conversation started and when it was last active.`],fixed:[`A Google agy chat that hits a temporary “service unavailable” from Google now waits a few seconds and carries on in the same conversation instead of ending the turn.`,`The agent keeps Oonak Browser’s window visible: no hidden or headless browser unless you ask for one.`]},{version:`0.3.237`,date:`2026-10-15`,platforms:[`win32`,`darwin`],added:[`When a long chat no longer fits the model, the chat shows one line saying how many earlier messages the request left out; click it for the explanation.`],fixed:[`The model picker no longer has an “All models” list, which showed the same model twice when a provider offers it both by key and by subscription. Pick a provider to see its models.`,`Google’s agy: Gemini 3.7 Flash, 3.6 Flash and 3.1 Pro are gone from the picker, because Google no longer offers them, and the picker shows only the models your own Google plan lists. A chat that was on one of them asks you to pick another model.`,`A picture or PDF attached to a chat on Google’s agy is refused with words that say agy takes text only on every one of its models, and that another provider’s model can read it.`,`A thought with no words in it (Meta Muse hides its thinking) no longer leaves an empty “Thought” card in the chat.`,`Conversations between chats read “idle” when nothing is going on.`]},{version:`0.3.237`,date:`2026-10-15`,platforms:[`linux`],added:[`The model picker is redone: your providers on the left, each with how many models it has, and the chosen provider’s models on the right, best first by independent intelligence rating. Each side has its own search. After you pick a model from another provider, its button says “next message” until your next message runs on it.`,`Every model shows its own effort levels, and the effort picker starts on the model’s default. A model with no effort levels shows no picker.`,`Meta Muse: Muse Spark 1.3 and 1.2, Wonder 1.0 and Wonder Full 1.0 — paste your Muse key in Connect or press “Sign in with Meta”.`,`ChatGPT plans: GPT-6.1 Sol, GPT-6 Sol, GPT-6 Astra and GPT-5.6 Sol when your plan lists them; chats keep their thinking across tool calls and use the effort you pick.`,`NVIDIA is back for your own NVIDIA key, with twelve hosted models that call tools. Your own SuperGrok subscription offers Grok 4.7 Fast.`,`Bring this PC into the chat: on a chat that runs on another PC, pick folders on this PC and what the chat may do there; it asks you before every change. And a Tools switch lets a chat list, read and message the chats on your other PCs.`,`Sticky notes beside the bug button, saved in your vault so they follow you to your other computers.`,`Suggest, beside Listen in every chat, proposes what to send next, and the project manager does it for several chats at once. Nothing is sent until you press Send.`,`Listen to this chat is a player with a seek bar, a speed you can change while it plays, and the spoken word highlighted.`,`A tab whose chat finished a turn you have not looked at yet wears a dot. A long chat folds old agents into one “N earlier agents” row, and every block shows its time.`,`When a long chat no longer fits the model, one line says how many earlier messages the request left out.`],fixed:[`A message sent while a chat is working, right after you picked another model, waits for the running turn and is answered by the model you picked.`,`A PC you sign in later appears in the left panel by itself.`,`A thought with no words in it no longer leaves an empty “Thought” card.`,`The Claude Code engine is updated to 2.1.296.`]},{version:`0.3.236`,date:`2026-10-14`,platforms:[`win32`,`darwin`],added:[`Every model now shows its own effort levels, and the effort picker starts on the model’s default — so you can see what level a chat really runs at. A model that has no effort levels no longer shows a picker at all.`,`A collapsed thought block now shows how the thought begins, like a command does: “Thought 42 words: First I read the file…”.`,`Meta Muse requests now match Meta’s own Muse CLI, so its thinking, tool calls, pictures and PDFs show up properly in the chat.`],fixed:[`Grok 4.5 no longer offers an “extra high” effort that xAI treats as high, and GPT-4.1 no longer shows an effort picker it cannot use.`]},{version:`0.3.235`,date:`2026-10-13`,platforms:[`win32`,`darwin`],added:[`Meta Muse: use Meta’s Muse Spark 1.3, Spark 1.2, Wonder 1.0 and Wonder Full 1.0 in your chats. Open Connect, pick Meta Muse, and either paste your Muse key or press “Sign in with Meta” — OonaCode downloads Meta’s Muse once (about 360 MB, after you agree), you confirm the code on Meta’s page, and the key is kept in your vault.`,`ChatGPT plans: GPT-6.1 Sol (500k context), GPT-6 Sol, GPT-6 Astra and GPT-5.6 Sol are available when your plan lists them, next to the models you already had.`,`Google’s agy: Gemini 4 Argon appears in the model picker when your Google plan includes it (Ultra), at Low, Medium and High.`],fixed:[]},{version:`0.3.234`,date:`2026-10-13`,platforms:[`win32`,`darwin`],added:[`Bring this PC into the chat: on a chat that runs on another PC, press the button in the chat’s toolbar, pick folders on this PC and tick Read, Create, Edit or Delete for each. The chat can then work with those files. It asks you before it creates, changes, moves or deletes anything, and the link ends when you close the tab. Both PCs need this version.`,`Chats on my other PCs: a new switch in the Tools menu lets a chat list your other PCs and their chats, read them, message them and start new chats there on the model you choose. You confirm every new chat.`,`The Tools menu now works on a chat that runs on another PC, so you can switch its tools from here.`],fixed:[`A PC you sign in after OonaCode has started now appears in the left panel by itself, without opening Settings → Devices first.`]},{version:`0.3.233`,date:`2026-10-12`,platforms:[`win32`,`darwin`],added:[`The model picker now tells you when a pick is not in use yet: after you pick a model from another provider, its button says “next message” and explains that the chat keeps running on its current model until your next message.`,`A long chat folds the agents that ran long ago into one “N earlier agents” row that says when they ran, instead of one card for each of them under your newest message.`],fixed:[`A message you send while a chat is working, right after you picked another model or provider, now waits for the running turn and is answered by the model you picked. It used to go to the model that was already running, so the chat kept answering as the old one while the picker showed the new one.`,`Every block in a chat now shows the time it happened — also the notes the app writes itself and the cards for earlier agents.`]},{version:`0.3.232`,date:`2026-10-12`,platforms:[`win32`],added:[`The model picker is redone: your providers on the left, each with how many models it has, and the chosen provider’s models on the right, best first by independent intelligence rating (unrated ones last). Each side has its own search, and the one over the providers finds a model across every provider, showing only the providers that carry it.`,`NVIDIA is back for your own NVIDIA key: twelve hosted models that call tools, among them Nemotron 3 Ultra and Super, Kimi K3, GLM-5.3, DeepSeek V4.1 Flash and Gemma 4.`],fixed:[`Models hosted as vendor/model (Kimi K3 on NVIDIA and the like) now show their intelligence rating.`]},{version:`0.3.232`,date:`2026-10-12`,platforms:[`darwin`],added:[`Sticky notes: the note button beside the bug button at the top opens your notes as tabs. Make as many as you like, name them with a double-click, and write — every change is saved by itself in your vault, so the notes follow you to your other computers. Text only.`,`Chats on your own ChatGPT plan keep their thinking across tool calls, use the effort level you pick (up to max where the model has it), and list the models your account really offers.`,`The model picker is redone: your providers on the left, each with how many models it has, and the chosen provider’s models on the right, best first by independent intelligence rating (unrated ones last). Each side has its own search, and the one over the providers finds a model across every provider, showing only the providers that carry it.`,`NVIDIA is back for your own NVIDIA key: twelve hosted models that call tools, among them Nemotron 3 Ultra and Super, Kimi K3, GLM-5.3, DeepSeek V4.1 Flash and Gemma 4.`],fixed:[`Suggest no longer starts reading the chat the moment you open it: pick how many hours to read, then press Suggest.`,`The Claude Code engine is updated to 2.1.296.`,`Models hosted as vendor/model (Kimi K3 on NVIDIA and the like) now show their intelligence rating.`]},{version:`0.3.231`,date:`2026-10-12`,platforms:[`android`],added:[`On the phone: any text in a chat can be selected and copied, and About became Session info.`],fixed:[]},{version:`0.3.230`,date:`2026-10-11`,platforms:[`win32`],added:[`Sticky notes: the note button beside the bug button at the top opens your notes as tabs. Make as many as you like, name them with a double-click, and write — every change is saved by itself in your vault, so the notes follow you to your other PCs. Text only.`,`Chats on your own ChatGPT plan keep their thinking across tool calls, use the effort level you pick (up to max where the model has it), and list the models your account really offers.`],fixed:[`Suggest no longer starts reading the chat the moment you open it: pick how many hours to read, then press Suggest.`,`A Gemini chat on your own Google plan no longer repeats, turn after turn, a command it refused earlier.`,`The Claude Code engine is updated to 2.1.296.`]},{version:`0.3.229`,date:`2026-10-11`,platforms:[`darwin`],added:[`Suggest, beside Listen in every chat: it reads the last few hours of the chat and suggests what to send it next. You edit it, put it in the message box or send it — nothing runs by itself.`,`The project manager, beside the "about" button over the chat list: tick chats, press Review, and each gets a suggestion you can edit and send with its own button.`,`A tab whose chat finished a turn you have not looked at yet wears a dot (red when the turn failed), and so does its row in the list.`,`Listen to this chat is a player: a seek bar, play and pause, ten seconds back and forward, the previous or next sentence, a speed you can change while it plays, the spoken word highlighted (click any word to play from it), and every summary listed newest first on top.`,`MCP servers: add them in Settings → MCP Servers from a directory of popular ones (PostgreSQL, Supabase, GitHub, Sentry, Slack, Notion, Linear and more) or your own, and switch each on or off per chat.`,`Connectors: Supabase, Railway and Vercel in the Tools menu — sign in once, switch one on in a chat, and the agent can look at your projects, databases, logs and deployments; read-only until you allow changes, and it asks before each one.`,`Pictures: ask any chat for an image and it makes one, saved in the chat’s folder and shown in the chat (a few credits each; Images in the Tools menu turns it off).`,`Web search for every model, from your Mac, with no key and no credits.`,`Claude Haiku 5.5 with a 1M-token window, and Grok 4.7 Fast on your own SuperGrok subscription.`,`Pasting a very long text, or a video, sound or large picture, saves it in the chat’s folder and attaches it as a file.`,`Hover a “Read …png” line in the chat and the picture shows at once.`],fixed:[`A compacted chat reopens with its whole history, not only what came after its last compaction.`,`Deleting a chat frees its OonaCode pool seat at once.`,`Large chats resume faster.`,`The chat summary (“About”) no longer fails on models that think at length.`,`A refusal by Gemini’s safety filter is retried once on another model, like the others.`,`Error notes in the chat read as plain sentences instead of codes or raw data.`,`The message navigator always shows at least four lines and no longer vanishes on the way to it.`]},{version:`0.3.228`,date:`2026-10-11`,platforms:[`win32`],added:[`Suggest, beside Listen in every chat: it reads the last few hours of the chat and suggests what to send it next. You edit it, put it in the message box or send it — nothing runs by itself.`,`The project manager, beside the "about" button over the chat list: tick chats, press Review, and each gets a suggestion you can edit and send with its own button.`,`A tab whose chat finished a turn you have not looked at yet wears a dot (red when the turn failed), and so does its row in the list.`],fixed:[]},{version:`0.3.227`,date:`2026-10-11`,platforms:[`win32`],added:[`Listen to this chat is a player: a seek bar, play and pause, ten seconds back and forward, the previous or next sentence, and a speed you can change while it plays.`,`The word being spoken is highlighted in the summary, and clicking any word plays from there.`,`Every summary the chat has is listed on top, newest first; pick one to hear it, with the languages it was already translated into.`],fixed:[]},{version:`0.3.226`,date:`2026-10-11`,platforms:[`win32`],added:[`Google Gemini (agy) chats show what agy looked at: a picture it viewed appears in the chat, and a sound or video it named plays inside the tool card.`,`Your own SuperGrok subscription offers Grok 4.7 Fast.`,`The Android app groups this PC’s chats by the project each one is filed under.`],fixed:[`Google Gemini (agy) tool steps read in words — View file, Run command, Edit — with their file or command, instead of raw arguments.`,`Your own SuperGrok sign-in presents the current Grok CLI (1.0.50), so xAI does not refuse it as outdated.`]},{version:`0.3.225`,date:`2026-10-10`,platforms:[`win32`,`linux`],added:[`Per-credential usage keys: operator credentials can now store their own console session keys (such as Xiaomi MiMo account credentials) directly in the Admin Panel to monitor individual token plan quotas and balances.`,`Google agy thinking blocks: local Google Antigravity (Gemini) sessions now extract and display model thinking blocks and rich tool arguments in chat from agy transcripts.`],fixed:[`Session info regeneration: fixed an issue where regenerating the session summary for Google Antigravity (Gemini) sessions would fail with a missing subscription token error.`,`Xiaomi MiMo cleanup: removed redundant and withdrawn mimo-v2.5 and mimo-v2.5-pro models from the registry and models catalog; replaced by mimo-v2.6-pro and mimo-v2.6-flash.`]},{version:`0.3.224`,date:`2026-10-09`,platforms:[`win32`,`linux`],added:[`Auto-save clipboard files and large pasted text: pasting text exceeding 10,000 characters or 300 lines automatically saves into your workspace .oonacode/tmp folder and attaches as a file without bloating the composer. Clipboard videos, audio, and large images are similarly saved and attached as local paths.`],fixed:[`Error display in chat: masked internal error codes, raw JSON, and provider balance exhaustion notices from the user chat bubble, displaying clean status indicators instead.`,`Google Antigravity pool plan access: included Gemini 3.8 Flash and 3.7 Flash across all active subscription plans (Standard, Pro, Team Standard, Team Premium, Free).`,`Session info panel: fixed an issue where switching between chats could leave stale child views mounted in the session info panel.`]},{version:`0.3.223`,date:`2026-10-09`,platforms:[`win32`,`linux`],added:[`MCP Servers settings & Antigravity catalog: configure stdio, sse, and http Model Context Protocol servers in File -> Settings -> MCP Servers. Choose from a rich directory of popular providers (PostgreSQL, Supabase, Redis, SQLite, MongoDB Atlas, GitHub, GitLab, Sentry, Cloudflare, Slack, Notion, Linear, PostHog, Brave Search) or add custom servers.`,`TopBar MCP badge: see your configured MCP servers count at a glance next to the Bug Report button, and click to open MCP settings directly.`,`Per-chat MCP server toggles: selectively enable or disable configured MCP servers per conversation in the composer toolbar to eliminate prompt token overhead.`],fixed:[]},{version:`0.3.222`,date:`2026-10-09`,platforms:[`win32`,`linux`],added:[],fixed:[`Chat summary "About": increased housekeeper output token headroom to prevent thinking and verbose models (e.g. Qwen, Gemini) from exceeding the token ceiling and failing with "Claude's response exceeded the 700 output token maximum".`]},{version:`0.3.221`,date:`2026-10-09`,platforms:[`win32`,`linux`],added:[`Web search for every model: all models can now search the web via keyless local DuckDuckGo search from your PC, with no extra credentials or credits needed.`,`Claude Haiku 5.5: available with 1M context, 128K output, and tiered pricing (replaces Haiku 4.5).`],fixed:[`Deleting a chat immediately frees its pool seat on the server, instead of keeping it held until the session cache window expires.`,`Session info panel headers: distinct icons for About (sparkle) and Scheduled tasks (bell) so sections no longer repeat the same info glyph.`,`Large sessions resume faster and safer with reverse-bounded transcript loading and auto-trimming to disk.`,`Gemini content safety filter blocks are now caught by safeguard fallback and retried on the fallback model.`]},{version:`0.3.220`,date:`2026-10-07`,platforms:[`win32`,`linux`],added:[],fixed:[`A chat on a Google Claude model no longer stops with “Autocompact is thrashing”. Its window was set to 100,000 tokens, so the chat compacted again right after every compaction and the engine gave up; it is now 200,000, and if the engine ever gives up this way the next message starts from a shorter history instead of repeating the same state.`]},{version:`0.3.219`,date:`2026-10-07`,platforms:[`win32`,`linux`],added:[`Pictures: ask any chat for an image — “generate a realistic tiger fighting a crocodile” — and it now makes one, with any model, the way Google’s Antigravity does. The picture is saved in the chat’s folder and shown right in the chat; click it for the full viewer. It costs a few OonaCode credits per picture, you can edit a picture file from the folder too, and it can be switched off in the Tools menu (Images).`,`The Google Claude models (typed by exact id in the model picker’s Custom model row) show their real 100,000-token window in the session panel, and the chat now compacts before the limit instead of being refused and re-sent.`],fixed:[`Google-hosted Claude and Gemini chats re-used almost none of Google’s prompt cache, so big chats ate the 5-hour window in minutes. They now reuse about 98 % of the prompt, which makes them far cheaper and faster.`,`The hidden /setcustommodel command and the admin custom-model tool are gone — the model picker’s Custom model row does the same job.`]},{version:`0.3.218`,date:`2026-10-07`,platforms:[`win32`,`linux`],added:[`Connectors: Supabase, Railway and Vercel in the Tools menu. Sign in once with the service’s own page, switch the connector on in a chat, and the agent can look at your projects, databases, logs and deployments. It is read-only until you turn on “Allow changes”, and then it asks you before every change; purchases, billing and secret or key readers are never offered. Each shows whether the service’s command-line tool is installed and can add the vendor’s own skills. In the terminal: oona connectors. Guide: /docs/connectors.`,`Hover a “Read …png” line in the chat and the picture shows at once; click the picture for the full viewer with zoom, like a picture you sent.`],fixed:[`A chat that was compacted no longer reopens showing only what came after its last compaction: the whole history is there again.`,`The message navigator always shows at least four lines, and its list no longer vanishes while the pointer crosses the gap to it.`]},{version:`0.3.217`,date:`2026-10-07`,platforms:[`darwin`],added:[`Pictures you attach open large: click one in the box or in a sent message for a viewer with zoom (buttons, wheel, drag, Fit and 100 %). Click a PDF or text file and it opens in its own program.`,`When a model refuses a message on safety grounds, OonaCode retries it once on another model and says so in the chat. Choose how in Settings → Safeguards: switch automatically, always switch to a model you pick, or never — with a fallback for each model. The same in the terminal: oona settings safeguard-fallback and --fallback-model. Works for Claude, Gemini and Google’s agy.`,`The terminal signs in two ways: your OonaCode account (through your browser) or an OonaCode API key. A fresh oona asks which; oona login --api-key-stdin stores a key for scripts, oona whoami says which one is in use, and oona logout removes it. The terminal manual is on the website: /docs/cli.`,`The conversations badge reads like the agents badge — “3 conversations · 1 active” — and the Conversations window lists every limit: messages, tokens, credits, depth, rates and the idle close.`,`A chat can start a new chat for you on another provider, model, effort or project — it asks you first, and a chat that was itself started by a chat cannot start more.`,`The message navigator’s list shows each message’s date and opens on your latest one; messages further back than 5,000 lines are greyed.`],fixed:[`A chat that was compacted no longer reopens showing only what came after its last compaction: the whole history is there again.`,`The message navigator always shows at least four lines, and its list no longer vanishes while the pointer crosses the gap to it. A click on it now takes you to older messages even while the chat is still replying (the page used to jump straight back).`,`oona: a wrong command or flag now exits with code 2, oona sessions list no longer breaks on multi-line titles, piping oona into head no longer prints an error, and the plain-prompt mode can send a message again.`,`One-shot terminal runs reuse the engine already on the Mac instead of downloading it every time, and a model you typed with /model that is not in the picker keeps its name after OonaCode restarts.`]},{version:`0.3.216`,date:`2026-10-07`,platforms:[`win32`,`linux`],added:[`The terminal signs in two ways: your OonaCode account (through your browser) or an OonaCode API key. A fresh oona asks which; oona login --api-key-stdin stores a key for scripts and servers, oona whoami says which one is in use, and oona logout removes it. The key is sealed by the host and never written to the terminal’s config.`,`The terminal manual is on the website: /docs/cli, written from commands run on Debian and Ubuntu servers.`],fixed:[`oona: a wrong command or flag now exits with code 2, oona sessions list no longer breaks on multi-line titles, piping oona into head no longer prints an error, and the plain-prompt mode can send a message again.`,`One-shot terminal runs reuse the engine already on the PC instead of downloading it every time.`,`A model you typed with /model that is not in the picker keeps its name after OonaCode restarts.`]},{version:`0.3.215`,date:`2026-10-07`,platforms:[`win32`,`linux`],added:[`Pictures you attach open large: click one in the box or in a sent message for a viewer with zoom (buttons, wheel, drag, Fit and 100 %). Click a PDF or text file and it opens in its own program.`,`When a model refuses a message on safety grounds, OonaCode retries it once on another model and says so in the chat. Choose how in Settings → Safeguards: switch automatically, always switch to a model you pick, or never — with a fallback for each model. The same in the terminal: oona settings safeguard-fallback and --fallback-model. Works for Claude, Gemini and Google’s agy.`,`The conversations badge reads like the agents badge — “3 conversations · 1 active” — and the Conversations window lists every limit: messages, tokens, credits, depth, rates and the idle close.`,`A chat can start a new chat for you on another provider, model, effort or project — it asks you first, and a chat that was itself started by a chat cannot start more.`,`The message navigator’s list shows each message’s date and opens on your latest one; messages further back than 5,000 lines are greyed.`],fixed:[`A click on the message navigator now takes you to older messages even while the chat is still replying (the page used to jump straight back).`,`The message navigator no longer touches the message times, and its lines are darker and longer.`]},{version:`0.3.214`,date:`2026-10-06`,platforms:[`darwin`],added:[`OonaCode runs natively on Apple Silicon Macs. The installer picks the Apple Silicon build by itself, and an Apple Silicon Mac that had the Intel one moves to it on its next install or update — the Intel build cannot run there on macOS 14 or older.`,`A message navigator on every chat: the small stack of lines at the middle-right of the chat is your own messages — rest on it, focus it or tap it and the list of everything you sent opens; click one and the chat scrolls straight to it.`],fixed:[`On an Apple Silicon Mac with macOS 14 or older, every chat crashed (“CPU lacks AVX support”) and Update did nothing. If yours did, run once in Terminal: curl -fsSL https://oonacode.oonak.ai/install.sh | bash`,`When an update cannot start, the app now says why and what to run instead of saying “Updating OonaCode…” while nothing happens.`,`File → Export chats… no longer freezes the window under a Save panel: the zip goes straight into Downloads and Finder shows it.`]},{version:`0.3.213`,date:`2026-10-06`,added:[`A message navigator on every chat: the small stack of lines at the middle-right of the chat is your own messages — rest on it, focus it or tap it and the list of everything you sent opens; click one and the chat scrolls straight to it. Escape closes the list.`],fixed:[],platforms:[`win32`,`linux`]},{version:`0.3.212`,date:`2026-10-06`,added:[`Headless one-shot runs without signing in: --api-key (or OONACODE_API_KEY) bills the run through the gateway on that OonaCode key — held in memory for the run only, never stored. For containers and CI.`],fixed:[`A keyed run no longer stops at the device-link screen, and no longer dies with "the OonaCode pool needs your OonaCode account": the key now also covers provider routing and the registry read on a machine that was never signed in.`],platforms:[`win32`,`linux`]},{version:`0.3.211`,date:`2026-10-06`,added:[`A message navigator on every chat: the small stack of lines at the middle-right of the chat is your own messages — rest on it and the list of everything you sent opens; click one and the chat scrolls straight to it.`,`One-shot runs without signing in: --api-key (or OONACODE_API_KEY) bills the run through the gateway on that OonaCode key — held in memory for the run only, never stored. For headless machines and containers.`],fixed:[],platforms:[`linux`]},{version:`0.3.210`,date:`2026-10-05`,added:[`Use a project folder opens on the folder the chat runs in — its project, or the workspace OonaCode made for it — instead of an empty box.`],fixed:[`Send now on one queued message no longer makes the other queued messages look sent: they stay under the chat, each with its own Send now, and get their tick when the agent reads them.`,`After you confirm the agent’s request to move a chat to another folder, the chat shows the new folder at once, not only after your next message.`]},{version:`0.3.209`,date:`2026-10-05`,platforms:[`win32`,`darwin`],added:[`Scheduled tasks say which model a run uses: always the chat’s model at the moment the task fires, named in the Scheduled tasks panel.`],fixed:[`A Google Gemini chat keeps Google’s agent running for half an hour between messages, so the next message after a pause no longer waits about four seconds for agy to start.`,`Commands run in a Google Gemini chat reach servers on your own PC (localhost) and plain http:// sites again.`]},{version:`0.3.209`,date:`2026-10-05`,platforms:[`linux`],added:[`Grok 4.7, xAI’s newest model, on the OonaCode pool and on your own SuperGrok subscription — and an effort picker for Grok 4.7, 4.6 and 4.5 (low, medium, high, extra high), sent the way xAI’s own Grok CLI sends it.`,`Every provider in the model picker shows its own logo — Google’s Gemini mark for Google, xAI’s for your SuperGrok, OpenAI’s for your ChatGPT plan, Z.ai’s for GLM — instead of two letters.`,`Scheduled tasks say which model a run uses: always the chat’s model at the moment the task fires, named in the Scheduled tasks panel.`],fixed:[`When a subscription behind the OonaCode pool refuses or fails a request, the same request is answered at once from the provider’s API key instead of showing you the error.`,`Grok on your own SuperGrok subscription and on the OonaCode pool works again: xAI started refusing the Grok CLI identity OonaCode presented as outdated.`,`When your own subscription’s sign-in stops working, the chat now says so and asks you to sign in again, instead of a confusing “own-subscription providers run directly to the provider” error.`,`A Google Gemini chat keeps Google’s agent running for half an hour between messages, so the next message after a pause no longer waits about four seconds for agy to start.`,`Commands run in a Google Gemini chat reach servers on your own PC (localhost) and plain http:// sites again.`]},{version:`0.3.208`,date:`2026-10-04`,platforms:[`win32`,`darwin`],added:[`Grok 4.7, xAI’s newest model, on the OonaCode pool and on your own SuperGrok subscription — and an effort picker for Grok 4.7, 4.6 and 4.5 (low, medium, high, extra high), sent the way xAI’s own Grok CLI sends it.`,`Every provider in the model picker shows its own logo — Google’s Gemini mark for Google, xAI’s for your SuperGrok, OpenAI’s for your ChatGPT plan, Z.ai’s for GLM — instead of two letters.`],fixed:[`When a subscription behind the OonaCode pool refuses or fails a request, the same request is answered at once from the provider’s API key instead of showing you the error.`,`Grok on your own SuperGrok subscription and on the OonaCode pool works again: xAI started refusing the Grok CLI identity OonaCode presented as outdated.`,`When your own subscription’s sign-in stops working, the chat now says so and asks you to sign in again, instead of a confusing “own-subscription providers run directly to the provider” error.`]},{version:`0.3.207`,date:`2026-10-04`,added:[`Every chat lists every provider you have connected and the OonaCode pool — Google Gemini too, whatever the chat ran on before. Switching keeps the conversation: a chat moving off Google continues with its whole history, and a chat moving onto Google gives Google’s agent the conversation so far, so it can carry on.`],fixed:[`Two messages sent a moment apart while a chat was starting no longer leave one of them stuck in the queued strip: the engine had read them together as one message, and OonaCode now recognises that.`]},{version:`0.3.206`,date:`2026-10-04`,platforms:[`win32`],added:[`Google Gemini installs Google’s agy by itself the first time you use it — open the provider in Settings → Providers, or send a message to a Google Gemini chat — instead of waiting for you to press Install.`],fixed:[`Deleting a chat now says what really happens: a chat is kept only on the PC it runs on, so deleting it there removes it everywhere.`,`oona doctor no longer tells you to change settings that OonaCode stopped reading.`]},{version:`0.3.206`,date:`2026-10-04`,platforms:[`linux`],added:[`Gemini on your own Google plan, through Google’s own agent. Open Settings → Providers → Google Gemini: OonaCode downloads Google’s agy for you and checks it. Then press Sign in with Google, sign in on Google’s own page and paste the one-time code back within the minute agy allows. OonaCode never sees your password. Every model your Google plan offers through agy is listed — Gemini 3.8, 3.7 and 3.6 Flash, Gemini 3.1 Pro, and Claude Opus 5.5, Claude Sonnet 5.5 and GPT-OSS 120B marked “via Google”. A Google Gemini chat runs Google’s agent as it is (Build or Autonomous mode, text only), and the chat’s info panel lists every request it made to Google.`,`Every provider in the model picker ends with a “Custom model…” row: type any model id and the chat runs it on that provider.`],fixed:[`The agents badge highlights what is happening now: “4 working” is blue and the total is grey.`,`Deleting a chat now says what really happens: a chat is kept only on the PC it runs on, so deleting it there removes it everywhere.`]},{version:`0.3.206`,date:`2026-10-04`,platforms:[`darwin`],added:[`Gemini on your own Google plan, through Google’s own agent. Open Settings → Providers → Google Gemini: OonaCode downloads Google’s agy for you and checks it. Then press Sign in with Google, sign in on Google’s own page and paste the one-time code back within the minute agy allows. OonaCode never sees your password. Every model your Google plan offers through agy is listed — Gemini 3.8, 3.7 and 3.6 Flash, Gemini 3.1 Pro, and Claude Opus 5.5, Claude Sonnet 5.5 and GPT-OSS 120B marked “via Google”. A Google Gemini chat runs Google’s agent as it is (Build or Autonomous mode, text only), and the chat’s info panel lists every request it made to Google.`,`Every provider in the model picker ends with a “Custom model…” row: type any model id and the chat runs it on that provider.`],fixed:[`The agents badge highlights what is happening now: “4 working” is blue and the total is grey.`,`The command line’s reinstall hint on a Mac is the one that works: curl -fsSL https://oonacode.oonak.ai/install.sh | bash.`]},{version:`0.3.205`,date:`2026-10-04`,platforms:[`win32`],added:[`Google Gemini now lists every model your Google plan offers through agy, not only Gemini: Claude Opus 5.5, Claude Sonnet 5.5 and GPT-OSS 120B (marked “via Google”) sit beside Gemini 3.8, 3.7 and 3.6 Flash and Gemini 3.1 Pro. They run on Google’s own agent with your Google plan, and have their own usage window.`],fixed:[]},{version:`0.3.204`,date:`2026-10-04`,platforms:[`win32`],added:[`Signing in to Google Gemini opens Google’s page for you and shows how many seconds are left: Google’s agy waits only one minute for the sign-in. Paste the code Google shows and it is sent at once.`],fixed:[`Signing in to Google Gemini finishes. The code you pasted never reached Google’s agy in the installed app (the window it types into dropped everything typed), so the sign-in waited out its minute and failed.`,`The Claude sign-in’s “paste the code” box, which used the same window, can type the code too.`]},{version:`0.3.203`,date:`2026-10-04`,platforms:[`win32`],added:[`Gemini on your own Google plan, through Google’s own agent. Open Settings → Providers → Google Gemini and press Install: OonaCode downloads Google’s agy for you and checks it. Then press Sign in with Google, sign in on Google’s own page and paste the one-time code back here. OonaCode never sees your password. A Google Gemini chat runs Google’s agent as it is (Build or Autonomous mode, text only, no pictures), and the chat’s info panel lists every request it made to Google.`,`Every provider in the model picker ends with a “Custom model…” row: type any model id and the chat runs it on that provider.`],fixed:[`The agents badge highlights what is happening now: “4 working” is blue and the total (“51 agents”) is grey, instead of the other way round.`]},{version:`0.3.202`,date:`2026-10-03`,platforms:[`darwin`],added:[`OonaCode runs on macOS 12 or newer: the agent, your chats, the background service and the desktop app, installed with the same one line as on Linux — curl -fsSL https://oonacode.oonak.ai/install.sh | bash. An Intel build; Apple Silicon Macs run it through Rosetta 2. Your sign-in key is kept in your login keychain.`,`Updating is the same line again, oona update in a terminal, or the update button in the app: it closes OonaCode, puts the new version in place and opens it again. The app is not signed by Apple yet, so it cannot be downloaded from a browser and does not update itself the way it does on Windows.`],fixed:[]},{version:`0.3.202`,date:`2026-10-03`,platforms:[`linux`],added:[],fixed:[`Your sign-in survives a restart on a PC that keeps OonaCode’s key in the login keyring (GNOME Keyring, KWallet): two of OonaCode’s keys shared one keyring entry and overwrote each other, and every start of the host wrote over the stored key — so after a restart you could find yourself signed out.`,`OonaCode never runs a Claude Code you installed yourself as its engine, even when it sits in the same folder as the Node.js that runs OonaCode (an nvm folder, for example).`,`oona update installs from the site your OonaCode was installed from, not always from oonacode.oonak.ai.`]},{version:`0.3.202`,date:`2026-10-03`,platforms:[`win32`],added:[],fixed:[`OonaCode never runs a Claude Code you installed yourself as its engine, even when it sits in the same folder as the Node.js that runs OonaCode.`]},{version:`0.3.201`,date:`2026-10-03`,added:[`The Tools menu lists only tools that work. Desktop control, Clipboard, Screen capture and Run as administrator were demos that never ran anything, and they are gone: the agent already reads and sets your clipboard, takes screenshots and asks Windows for administrator rights through its own commands.`],fixed:[`Oonak Browser keeps working when its window is behind other windows. A browser covered by the OonaCode window used to crawl, and some clicks and scrolls gave up after 30 seconds.`,`Oonak Browser no longer clicks a hidden copy of a link, or a link inside a closed menu, when a site has both a visible and a hidden one.`,`A message you send right after a reply failed no longer stays pinned above the box as “queued” once the agent has read it.`]},{version:`0.3.200`,date:`2026-10-03`,platforms:[`win32`],added:[`Everything OonaCode shows you is in credits, never in dollars: the model picker gives what an OonaCode pool model charges per 1M tokens in credits, and a chat’s spend, Usage, Conversations, Listen and the terminal all count credits. A chat on your own key or your own subscription says so instead of a price.`],fixed:[`Oonak Browser works on sites built from web components, Google’s own forms among them: it reads, finds, clicks and types inside them, where it used to answer “the page changed” or find nothing.`,`The model’s questions appear only in their own window: the chat no longer shows the question’s raw text while you answer, and afterwards keeps one line — “You answered 3 questions” — that opens to your answers.`]},{version:`0.3.200`,date:`2026-10-03`,platforms:[`linux`],added:[`Your chats now live only on the PC that runs them. Your phone, the website and your other PCs read a chat straight from its PC, through the same encrypted connection they use to continue it — OonaCode’s server no longer keeps any copy. While a PC is off or asleep its chats cannot be read from elsewhere; the window says so and they come back when it is online. Update OonaCode on each of your PCs: another device reads a PC’s chats only once that PC runs this version.`,`Everything OonaCode shows you is in credits, never in dollars: the model picker gives what an OonaCode pool model charges per 1M tokens in credits, and a chat’s spend, Usage, Conversations, Listen and the terminal all count credits. A chat on your own key or your own subscription says so instead of a price.`,`Listen has one button: Play. It writes a summary when the chat has none or has moved on, translates it once when you pick a new language, or just plays — saying only “Generating…” or “Translating…” while it works. A summary written in the last ten minutes is used for every language, so switching language never writes it again.`,`A morning briefing in View → What chats are about…: show the chats active in the last 24 hours, 3, 7, 10 or 30 days (or your own dates), tick the ones you want — or all — pick a language, a voice and a speed, and press Play. OonaCode reads each chat’s name and what it is about, one after another, with Next, Previous, Pause and Stop.`,`A chat can offer to move a task to a new chat. When a task deserves its own chat — a separate job, a chat that has grown long, work in another folder — the model proposes it with the first message written out; you can edit it, then Start new chat opens the new chat in a tab, sends the message and carries on there. Nothing starts without your yes.`,`Talk to other chats: a chat can now write to a chat whose switch is off. That chat’s switch stays off and it gets no new tools — it can only answer the chat that wrote to it. Finding a chat by name matches each word, in its name, project, folder and description, and spelling like “AI-control” or “aicontrol” no longer matters.`,`Oonak Browser acts like a person: every click, keystroke and scroll is a real input event, so sites that ignore scripted clicks now respond, and it works inside web components, Google’s own forms among them. Typing into a drop-down picks the option, and typing into an editor adds the text at its end.`,`Scheduled shows at a glance what will still run: paused tasks and one-time tasks that have already run are greyed out, with the day they will be removed — 10 days after their last change.`,`Settings → Developer → Allow debugging: opens a debugging port on this PC only, so a developer can look at and drive the app while fixing a problem with you. Off by default; while it is on, every window shows a red “Debugging on” badge.`],fixed:[`A chat keeps its Build / Plan / Ask first / Autonomous choice, and every device shows the same one. A chat set to “Ask first” now asks you before acting even when this PC answers prompts by itself.`,`A chat no longer ends up on a model nobody picked for it: a model the provider does not offer is refused instead of quietly switching the chat to the provider’s default, and Enter in the model picker no longer picks the row under the mouse pointer.`,`Chats talking to each other no longer ping-pong: a reply needs no answer, several messages from the same chat are read together in one turn, and a message card says “answer requested” until the answer has gone back, then “answered” with the time.`,`A tool you switch on while a chat is replying works for the message you send next, even mid-reply. After an update, a chat that had background tasks running shows one line saying how many stopped, instead of one card per task.`,`The model’s questions appear only in their own window: the chat no longer shows the question’s raw text while you answer, and afterwards keeps one line — “You answered 3 questions” — that opens to your answers.`,`A model your plan does not include now says “not in your plan”, instead of “Failed to authenticate … sign-in needed”.`,`A long message waiting in the queue no longer hides its “Send now” button: it is folded to a few lines, with Show all to read the rest.`,`The account window no longer stays on “offline · vault event stream responded 503” after a short server interruption.`]},{version:`0.3.199`,date:`2026-10-02`,platforms:[`win32`],added:[`Talk to other chats: a chat can now write to a chat whose switch is off. That chat’s switch stays off and it gets no new tools — it can only answer the chat that wrote to it. Finding a chat by name is smarter too: each word is matched, in its name, project, folder and description, and spelling like “AI-control” or “aicontrol” no longer matters.`,`Oonak Browser acts like a person: every click, keystroke and scroll is a real input event, so sites that ignore scripted clicks now respond. Typing into a drop-down picks the option, and typing into an editor adds the text at its end.`],fixed:[`A chat no longer ends up on a model nobody picked for it: a model the provider does not offer is refused instead of quietly switching the chat to the provider’s default, and Enter in the model picker no longer picks the row under the mouse pointer.`]},{version:`0.3.198`,date:`2026-10-01`,platforms:[`win32`],added:[`Listen has one button: Play. It writes a summary when the chat has none or has moved on, translates it once when you pick a new language, or just plays — saying only “Generating…” or “Translating…” while it works. A summary written in the last ten minutes is used for every language, so switching language never writes it again.`],fixed:[`A chat keeps its Build / Plan / Ask first / Autonomous choice, and every device shows the same one — the phone used to show “Ask first” for a Build chat. A chat set to “Ask first” now asks you before acting even when this PC answers prompts by itself.`,`Play in Listen is never greyed out for want of a voice: it gets the text ready and names the voice to install.`]},{version:`0.3.197`,date:`2026-10-01`,platforms:[`win32`],added:[`Oonak Browser, the browser your chats use, moves to version 151 by itself at its next use: a build with no Google services (no Safe Browsing warnings, push notifications or search suggestions). The download is checked against its fingerprint before anything is unpacked, and the old version is removed once no chat’s browser still runs from it.`],fixed:[`A model your plan does not include now says “not in your plan”, instead of “Failed to authenticate … sign-in needed”.`]},{version:`0.3.196`,date:`2026-10-01`,platforms:[`win32`],added:[`Your chats now live only on the PC that runs them. Your phone, the website and your other PCs read a chat straight from its PC, through the same encrypted connection they use to continue it — OonaCode’s server no longer keeps any copy. While a PC is off or asleep its chats cannot be read from elsewhere; the window says so and they come back when it is online. Update OonaCode on each of your PCs: another device reads a PC’s chats only once that PC runs this version.`],fixed:[`The account window no longer stays on “offline · vault event stream responded 503” after a short server interruption: the next sync that works clears it by itself.`]},{version:`0.3.195`,date:`2026-10-01`,platforms:[`win32`],added:[],fixed:[`Chats talking to each other no longer ping-pong. A message asks for an answer only when the chat really needs one; a reply needs no answer and is not answered with a new message; and several messages waiting from the same chat are read together in one turn. Fewer wake-ups, fewer tokens.`,`A message card says what is true: “answer requested” until the answer has gone back, then “answered” with the time — instead of an orange “reply expected” that never went away.`]},{version:`0.3.194`,date:`2026-10-01`,platforms:[`win32`],added:[`A chat can offer to move a task to a new chat. When a task deserves its own chat — a separate job, a chat that has grown long, work in another folder — the model proposes it with the first message written out; you can edit it, then Start new chat opens the new chat in a tab, sends the message and carries on there. Nothing starts without your yes.`,`Settings → Developer → Allow debugging: opens a debugging port on this PC only, so a developer can look at and drive the app while fixing a problem with you. Off by default; while it is on, every window shows a red “Debugging on” badge.`],fixed:[]},{version:`0.3.193`,date:`2026-10-01`,platforms:[`win32`],added:[],fixed:[`A tool you switch on while a chat is replying works for the message you send next, even mid-reply: that message now waits for the chat to restart with the new tool instead of reaching the model without it.`,`After an update, a chat that had background tasks running shows one line — “11 background tasks stopped — they were running when OonaCode restarted this chat” — instead of one card per task. Click it to see each one.`]},{version:`0.3.192`,date:`2026-09-30`,platforms:[`win32`],added:[`A morning briefing in View → What chats are about…: show the chats active in the last 24 hours, 3, 7, 10 or 30 days (or your own dates), tick the ones you want — or all — pick a language, a voice and a speed, and press Play. OonaCode reads each chat’s name and what it is about, one after another, with Next, Previous, Pause and Stop. Other languages are translated once and kept, so hearing the same briefing again costs nothing.`],fixed:[]},{version:`0.3.191`,date:`2026-09-30`,platforms:[`win32`],added:[`Scheduled shows at a glance what will still run: paused tasks and one-time tasks that have already run are greyed out, with the day they will be removed. They are deleted by themselves 10 days after their last change; resuming or editing a paused task gives it another 10 days.`],fixed:[]},{version:`0.3.190`,date:`2026-09-30`,platforms:[`win32`],added:[],fixed:[`A long message waiting in the queue no longer hides its “Send now” button: it is folded to a few lines, with Show all to read the rest.`]},{version:`0.3.189`,date:`2026-09-30`,platforms:[`linux`],added:[`Split views, like VS Code: drag a chat tab to the left, right, top or bottom of the chat area to open it beside the other one — a shaded area shows where it will land. Every chat on screen works on its own, with its own replies streaming and its own message box. Drag the divider to resize; Ctrl+\\ splits the current tab to the right, Ctrl+1, Ctrl+2… jump between views, and a tab’s menu has Split right, Split down and Move to other group.`,`Chats in windows of their own, like Chrome tabs: drag a tab out of the window, or choose “Move to new window” in its menu, and it opens in its own window; “Move to main window” brings it back. On Wayland desktops the new window opens at the usual place rather than under the pointer. Your split views and windows come back when you restart OonaCode.`,`Every language plays in Listen to a chat: each language picks the best voice on its own — OonaCode’s Armenian voices first, then your system’s voices, then eSpeak (install the espeak-ng package if your system has no voice for a language).`],fixed:[`Picking another language for a summary no longer needs a new summary: Play translates the one you have, keeps the translation, shows it and plays it.`,`“Summarise now” says “Up to date — nothing to summarise” while the chat has not changed, instead of seeming to do nothing.`]},{version:`0.3.188`,date:`2026-09-30`,platforms:[`win32`],added:[`Split views, like VS Code: drag a chat tab to the left, right, top or bottom of the chat area to open it beside the other one — a shaded area shows where it will land. Every chat on screen works on its own, with its own replies streaming and its own message box. Drag the divider to resize; Ctrl+\\ splits the current tab to the right, Ctrl+1, Ctrl+2… jump between views, and a tab’s menu has Split right, Split down and Move to other group.`,`Chats in windows of their own, like Chrome tabs: drag a tab out of the window, or choose “Move to new window” in its menu, and it opens in its own window. Drag it back onto the main window’s tabs, or choose “Move to main window”, to bring it back. Your split views and popped-out windows come back when you restart OonaCode.`],fixed:[]},{version:`0.3.187`,date:`2026-09-30`,platforms:[`win32`],added:[`Every language plays in Listen to a chat. Persian, Georgian, Ukrainian — and any language whose Windows voice is not installed — now speak with eSpeak, a free voice that comes with OonaCode (it sounds robotic, but it always works). Each language picks the best voice on its own: OonaCode’s Armenian voices first, then Windows’ own, then eSpeak.`],fixed:[`Picking another language for a summary no longer needs a new summary: Play translates the one you have, keeps the translation, shows it and plays it.`,`“Summarise now” says “Up to date — nothing to summarise” while the chat has not changed, instead of seeming to do nothing.`]},{version:`0.3.186`,date:`2026-09-30`,platforms:[`linux`],added:[`Listen to a chat: right-click a chat → Listen to this chat…, or the speaker button beside the chat’s title. The chat’s own model writes a short spoken summary — the goal, what was done, where it stands, what is left — and OonaCode reads it aloud on this PC, in the voice and at the speed you choose. Every summary is kept with its date, so you can play it again at any time; a new one is written only when the chat has moved on. Other languages are translated once and kept with the summary.`,`OonaCode brings two Armenian voices of its own, Astgh and Artsiv, and also speaks with your system’s voices through speech-dispatcher — install speech-dispatcher and espeak-ng for Persian, Russian and every other language; the Listen window names the packages for your distribution.`,`Listen to a chat from your phone: the OonaCode app’s 🔊 Listen reaches this PC’s summaries and plays them with the phone’s own voices. It needs this update on the PC and the next OonaCode app on the phone.`,`See where your credits go: Account → Usage. Pick the last 24 hours, 7, 30 or 90 days or your own dates, by hour or by day, for the coding agent or your API keys apart. A chart shows the credits over time by model or by what they were for, and the lists below give every model with its tokens and price, and every use — chat turns, a chat’s “about”, images, speech and the rest.`,`The chat list is laid out like the Claude desktop app: New, Projects, Scheduled, then your pinned chats and projects, then Today and Older. The old grouping by project is one click away — the small icon beside “Today”.`,`Projects opens a page of project cards — each with its goal, its chats and when it was last used — with search, sort and New project. Click a card to see that project’s chats, instructions and settings, and to start a new chat in it.`,`Scheduled shows every scheduled task from every chat on this PC in one place, with its next run, its chat, and pause, resume and delete. Pin any chat or project to the top of the list from its menu.`,`Claude Sonnet 5.5 is in the model picker — on the OonaCode pool and on your own Claude subscription — with a 1M-token context. It costs the same as Sonnet 5 per token and usually needs fewer tokens for the same work.`,`Type / at the start of a message to see the chat’s commands and skills, with what each does, in two titled sections. Type to narrow the list, then Enter or Tab. They work with every model, not only Claude.`,`Each chat has a Skills list beside Tools. Every skill starts off, so the model sees none of them and they cost nothing; switch one on to let the model use it by itself in that chat. Typing /name still runs any skill for one turn.`,`Your own skills: Settings → Skills lists the skills OonaCode gives every chat, and “Import from Claude Code…” copies the ones you choose from your Claude Code install — it only reads it, never changes it.`,`In the terminal app (oona), a command the chat’s engine knows — /context, /compact or a skill — now runs instead of answering “unknown command”.`,`Search in the Import window: find a chat by its name, its first or last message or its folder, or pick “Whole conversations” to search inside the chats themselves.`],fixed:[`Import chats shows every chat on this PC, grouped by the app it came from, with nothing folded away. Each row says whether it is new, already imported, moved on since, or deleted by you in OonaCode. Nothing is ticked when you open it yourself: search for a chat and tick it, or tick a whole group at once.`,`The message box fits a narrow chat: its buttons and pickers move onto a second line and the box grows to hold them — Stop and Queue no longer slip outside it.`,`Claude’s thoughts show their words again. Every “Thought” from Claude Opus, Sonnet and Fable came back empty — Anthropic leaves the text out unless it is asked for a summary, and now OonaCode asks. Only new replies change.`,`A chat’s “about” no longer starts in the middle of a sentence when the model wrote a long answer.`,`Commands that only duplicated OonaCode’s own controls or showed misleading numbers are gone from the / menu — /model, /usage, /autocompact, /output-style, /mcp, /list-agents and /reload-skills. Typed, they say why.`,`Skills you import or remove in Settings → Skills reach your chats by themselves, at each chat’s next message.`,`Claude Sonnet 5 is retired: a chat that was on it moves to Sonnet 5.5 at its next message.`,`The engine’s built-in keyboard-shortcuts helper is turned off: it would have edited your own Claude Code settings.`,`Typing /model in a chat updates the chat’s model and the model picker again, and command output such as /context reads the same while it arrives and after you reopen the chat.`,`A chat row’s ⋯ button shows only when you point at the row.`]},{version:`0.3.185`,date:`2026-09-30`,platforms:[`win32`],added:[`Listen to a chat from your phone: the OonaCode app’s 🔊 Listen reaches this PC’s summaries and plays them with the phone’s own voices. It needs this update on the PC and the next OonaCode app on the phone.`],fixed:[`Listening with a Windows voice no longer stops after the first sentence when the voice fails to say it has finished.`]},{version:`0.3.184`,date:`2026-09-30`,platforms:[`win32`],added:[`Listen to a chat: right-click a chat → Listen to this chat…, or the speaker button beside the chat’s title. The chat’s own model writes a short spoken summary — the goal, what was done, where it stands, what is left — and OonaCode reads it aloud on this PC, in the voice and at the speed you choose. Every summary is kept with its date, so you can play it again at any time; a new one is written only when the chat has moved on. Other languages are translated once and kept with the summary.`],fixed:[`A chat’s “about” no longer starts in the middle of a sentence when the model wrote a long answer.`]},{version:`0.3.183`,date:`2026-09-30`,platforms:[`win32`],added:[`See where your credits go: Account → Usage. Pick the last 24 hours, 7, 30 or 90 days or your own dates, by hour or by day, for the coding agent or your API keys apart. A chart shows the credits over time by model or by what they were for, and the lists below give every model with its tokens and price, and every use — chat turns, a chat’s “about”, images, speech and the rest.`],fixed:[]},{version:`0.3.182`,date:`2026-09-30`,platforms:[`win32`],added:[],fixed:[`Import chats shows every chat on this PC, grouped by the app it came from — Claude Code, the Claude app, Qwen Code, Cursor — with nothing folded away. Each row says whether it is new, already imported, moved on since, or deleted by you in OonaCode. Nothing is ticked when you open it yourself: search for a chat and tick it, or tick a whole group at once. The Import button says how many chats it will bring over.`]},{version:`0.3.181`,date:`2026-09-30`,platforms:[`win32`],added:[],fixed:[`The message box fits a narrow chat. In a small window, or with the side panels open, its buttons and pickers move onto a second line and the box grows to hold them — Stop and Queue no longer slip outside it, and the model and effort pickers keep their words readable.`]},{version:`0.3.180`,date:`2026-09-30`,platforms:[`win32`],added:[],fixed:[`Claude’s thoughts show their words again. Every “Thought” from Claude Opus, Sonnet and Fable came back empty — Anthropic leaves the text out unless it is asked for a summary, and now OonaCode asks. Other models were never affected. Only new replies change; older thoughts stay empty.`]},{version:`0.3.179`,date:`2026-09-29`,platforms:[`win32`],added:[],fixed:[`The / menu is easier to read: skills and commands in two titled sections, each with one short line — the full description shows when you point at it.`,`Commands that only duplicated OonaCode’s own controls or showed misleading numbers are gone from the / menu — /model (use the model picker), /usage (the engine’s own estimate, not your credits), /autocompact, /output-style, /mcp, /list-agents and /reload-skills. Typed, they say why.`,`Skills you import or remove in Settings → Skills reach your chats by themselves, at each chat’s next message.`]},{version:`0.3.178`,date:`2026-09-29`,platforms:[`win32`],added:[`The chat list is laid out like the Claude desktop app: New, Projects, Scheduled, then your pinned chats and projects, then Today and Older. The old grouping by project is one click away — the small icon beside “Today”.`,`Projects opens a page of project cards — each with its goal, its chats and when it was last used — with search, sort and New project. Click a card to see that project’s chats, instructions and settings, and to start a new chat in it.`,`Scheduled shows every scheduled task from every chat on this PC in one place, with its next run, its chat, and pause, resume and delete. A dot on it tells you when something is due soon.`,`Pin any chat or project to the top of the list from its menu.`],fixed:[`A chat row’s ⋯ button shows only when you point at the row.`]},{version:`0.3.177`,date:`2026-09-29`,platforms:[`win32`],added:[`Claude Sonnet 5.5 is in the model picker — on the OonaCode pool and on your own Claude subscription — with a 1M-token context. It costs the same as Sonnet 5 per token and usually needs fewer tokens for the same work.`],fixed:[`Claude Sonnet 5 is retired: a chat that was on it moves to Sonnet 5.5 at its next message, and the picker shows Sonnet 5.5.`]},{version:`0.3.176`,date:`2026-09-29`,platforms:[`win32`],added:[`Each chat has a Skills list beside Tools. Every skill starts off, so the model sees none of them and they cost nothing — about 1,400 tokens on every message until now. Switch one on to let the model use it by itself in that chat; the list shows what each one costs per message while on.`,`Typing /name still runs any skill for one turn, whether its switch is on or off.`],fixed:[`The engine’s built-in keyboard-shortcuts helper is turned off: it would have edited your own Claude Code settings.`]},{version:`0.3.175`,date:`2026-09-29`,platforms:[`win32`],added:[`Type / at the start of a message to see the chat’s commands and skills — the Claude Code engine’s own (/compact, /context, /review, /security-review, /init and more) and the skills in your project’s .claude folder — with what each does. Type to narrow the list, then Enter or Tab. They work with every model, not only Claude.`,`Your own skills: Settings → Skills lists the skills OonaCode gives every chat, and “Import from Claude Code…” copies the ones you choose from your Claude Code install — it only reads it, never changes it.`,`In the terminal app (oona), a command the chat’s engine knows — /context, /compact or a skill — now runs instead of answering “unknown command”.`],fixed:[`Typing /model in a chat updates the chat’s model and the model picker again.`,`Command output such as /context reads the same while it arrives and after you reopen the chat.`]},{version:`0.3.174`,date:`2026-09-28`,platforms:[`win32`],added:[`Search in the Import window. Type to find a chat by its name, its first or last message, or its folder — chats folded away as already imported or deleted here show up too when they match. Or open the search options and pick “Whole conversations” to search inside the chats themselves, with a few lines of each match under the chat. It only reads Claude Code, Cursor and the Claude app’s files, never changes them.`],fixed:[`Chats Claude Code switched to another model are answered by that model for real: OonaCode’s pool now serves the model the engine falls back to, and never answers a Claude request with another company’s model.`]},{version:`0.3.173`,date:`2026-09-28`,platforms:[`linux`],added:[`Every chat now has an “about”: a short note, written in the background by a cheap helper model of the chat’s own provider, saying what the chat works on. Your other chats read it — with each chat’s folder and when it was last active — when they look for the right chat to ask. See it, edit it or press Regenerate in the session info panel.`,`View → What chats are about… (and a sidebar button) lists every chat’s about and what writing them cost, with a switch to turn it off and “Generate for all chats now”. The switch and its numbers are also in Settings → This PC.`,`Your phone can now do from anywhere what this PC’s window does: switch each tool on or off per chat, see and control the conversations between your chats, read, edit and regenerate each chat’s “about”, and manage scheduled tasks. It needs this update on the PC and the next OonaCode app on the phone.`,`A chat can switch its own workspace. When the work belongs in another folder — a project you name that lives elsewhere, or a new project folder — the model proposes the switch and you answer Switch or Not now. It always asks you, even with “accept automatically” on, and the chat moves when its current step ends, with the conversation kept.`,`Right-click a chat tab → Delete (in red, under “Close all tabs”) deletes that chat after asking, just like Delete in the sidebar.`,`When Anthropic’s safeguards flag a chat and Claude Code moves it to another model for the rest of the run, the model box says so in red — for example “Opus 4.8 (safeguard)” — and the chat shows a notice at the switch. Picking a model takes the chat back to it at the next message.`],fixed:[`Typing in the message box while a chat is replying is no longer interrupted. With “accept automatically” on, an approval card flashed for an instant on some tool calls and took the cursor away from the box.`,`A permission card that appears while you are typing no longer takes the keyboard, so your next Space or Enter can never press Allow by accident.`,`“Send now” stays disabled and says “Sending now…” until the agent has taken the message — it can take a few seconds while the agent stops its current step, and a second press can no longer send it twice.`,`A message sent from your phone is confirmed by this PC, and the same message is never run twice when the phone sends it again after a lost connection.`,`File and folder names in a reply get their ▶, Open and Show in folder buttons only when they really exist on this PC. A bare file name is also looked for in the folder the reply named just before it.`,`A chat can no longer be moved into your home folder or the root folder through a link. Where /home is itself a link (Fedora Silverblue, Bazzite and similar systems), the home folder passed as an ordinary folder, and the chat would have loaded your own Claude Code settings as its project.`,`Signing in to your own Claude subscription inside the app works on Ubuntu 24.04, Debian, Linux Mint, Pop!_OS and Zorin OS again. There, a part of OonaCode built for newer systems did not load, and the sign-in fell back to a command you had to paste.`,"On Ubuntu, Linux Mint, Pop!_OS, Zorin OS and similar systems, `oona` now works in every new terminal right after you install or update. The installer used to leave it off your PATH until you logged out and back in; now it adds it for new terminals itself, and `oona uninstall` takes that line out again.",`Every way of uninstalling — “oona uninstall”, or the install command with --uninstall — now takes this PC off your account: keep your chats and they stay readable on your other devices; delete them and their copies go too. It never touches your Claude Code or the Claude app, and “oona uninstall” no longer gives up when the background service is stopped.`,`The installer now says at once when a system cannot run OonaCode — one older than Ubuntu 22.04, Debian 12 or RHEL 9, or one built on musl such as Alpine — instead of installing a copy that could not start. The .deb and .rpm tell apt and dnf the same.`]},{version:`0.3.172`,date:`2026-09-28`,platforms:[`win32`],added:[`When Anthropic’s safeguards flag a chat and Claude Code moves it to another model for the rest of the run, the model box says so in red — for example “Opus 4.8 (safeguard)” — and the chat shows a notice at the switch. Picking a model takes the chat back to it at the next message.`],fixed:[`Uninstalling from Settings → Apps now also takes this PC off your account, exactly like “oona uninstall”: keep your chats and they stay readable on your other devices; delete them and their copies go too.`,`“oona uninstall” no longer gives up when the background service is stopped.`,`The “Updating OonaCode…” window shows again on the newest Windows 11 versions (24H2 and later).`]},{version:`0.3.171`,date:`2026-09-28`,platforms:[`win32`],added:[`Oonak Browser now picks its own control port from a range no developer tool uses by default, so it can no longer take a port that Shopify CLI or a dev server wants. If a program needs a particular port kept free, or you want the browser on a specific one, just ask the chat.`],fixed:[`File and folder names in a reply get their ▶, Open and Show in folder buttons only when they really exist on this PC. A bare file name is also looked for in the folder the reply named just before it.`,`Uninstalling OonaCode from Settings → Apps now removes all of it — the app, the command line and its background service — and asks whether to keep your chats. Installing again afterwards no longer says it is already installed. Your Claude Code and Claude app are never touched.`,`“oona uninstall” works again on Windows 11.`,`A chat “about” you wrote yourself no longer shows “stale”.`]},{version:`0.3.170`,date:`2026-09-28`,platforms:[`win32`],added:[`Your phone can now do from anywhere what this PC’s window does: switch each tool on or off per chat, see and control the conversations between your chats, read, edit and regenerate each chat’s “about”, and manage scheduled tasks. It needs this update on the PC and the next OonaCode app on the phone.`],fixed:[`“Send now” stays disabled and says “Sending now…” until the agent has taken the message — it can take a few seconds while the agent stops its current step, and a second press can no longer send it twice.`,`A message sent from your phone is confirmed by this PC, and the same message is never run twice when the phone sends it again after a lost connection.`]},{version:`0.3.169`,date:`2026-09-28`,platforms:[`win32`],added:[`Every chat now has an “about”: a short note, written in the background by a cheap helper model of the chat’s own provider, saying what the chat works on. Your other chats read it — with each chat’s folder and when it was last active — when they look for the right chat to ask. See it, edit it or press Regenerate in the session info panel.`,`View → What chats are about… (and a sidebar button) lists every chat’s about and what writing them cost, with a switch to turn it off and “Generate for all chats now”. The switch and its numbers are also in Settings → This PC.`],fixed:[`A chat can no longer be moved into your user folder or a drive root through a link or junction that points there — its project settings would have been your own Claude Code settings.`]},{version:`0.3.167`,date:`2026-09-27`,platforms:[`win32`],added:[`A chat can switch its own workspace. When the work belongs in another folder — a project you name that lives elsewhere, or a new project folder — the model proposes the switch and you answer Switch or Not now. It always asks you, even with “accept automatically” on, and the chat moves when its current step ends, with the conversation kept.`],fixed:[]},{version:`0.3.166`,date:`2026-09-27`,platforms:[`win32`],added:[],fixed:[`Typing in the message box while a chat is replying is no longer interrupted. With “accept automatically” on, an approval card flashed for an instant on some tool calls and took the cursor away from the box.`,`A permission card that appears while you are typing no longer takes the keyboard, so your next Space or Enter can never press Allow by accident.`]},{version:`0.3.165`,date:`2026-09-27`,platforms:[`win32`],added:[`Right-click a chat tab → Delete (in red, under “Close all tabs”) deletes that chat after asking, just like Delete in the sidebar.`,`Chats now use Oonak Browser, in a window you can see, for everything that needs a web browser — not Chrome, Edge or a hidden script browser — unless you name another browser. It runs without a window (headless) only when you ask for that.`],fixed:[`After an update, the background service comes back by itself. An update could leave it unable to restart, and the app then showed “OonaCode could not start its host service” even though it went on to open normally.`]},{version:`0.3.164`,date:`2026-09-27`,platforms:[`win32`],added:[`Send now: a message you typed while the agent works has a Send now button while it waits. It stops what the agent is doing right now and sends your message immediately — the step that is running is cut. On the desktop and the phone.`,`Conversations → Map: see at a glance which chats are talking to each other. Each conversation is a hub with a line to each of its chats; working chats pulse; click a hub for its history or a chat to open it.`],fixed:[`A restart no longer signs this PC out when OonaCode’s stored key cannot be opened for a moment. OonaCode used to replace the key and lose your sign-in; it now keeps the key and signs you back in by itself as soon as it opens.`]},{version:`0.3.163`,date:`2026-09-27`,platforms:[`linux`],added:[`Send now: a message you typed while the agent works has a Send now button while it waits. It stops what the agent is doing right now and sends your message immediately — the step that is running is cut. On the desktop and the phone.`,`Conversations → Map: see at a glance which chats are talking to each other. Each conversation is a hub with a line to each of its chats; working chats pulse; click a hub for its history or a chat to open it.`],fixed:[`A restart no longer signs this PC out when its security chip is slow to open OonaCode’s stored key. After a system update and reboot, the chip on some machines refuses for a while; OonaCode used to replace the key and lose your sign-in. It now keeps the key and signs you back in by itself as soon as the chip opens it.`]},{version:`0.3.162`,date:`2026-09-27`,added:[],fixed:[`A chat switched to another model knows which model it is. After a switch from Claude to DeepSeek, the model used to keep saying it was Claude — the chat history and Claude Code’s own prompt told it so.`,`Oonak Browser is offered only where it can run. An older OonaCode no longer lists a browser tool it cannot use, so the model does not spend tokens working around it — update to get the browser.`]},{version:`0.3.161`,date:`2026-09-27`,added:[`Settings → This PC → “Replace pictures older than N days”: screenshots and pasted pictures in your chat history are replaced by a short note once they are older than a year (you choose the number, or 0 to keep them). The words of every chat stay; the database stops growing with pictures. It runs by itself.`],fixed:[`The model, Build/Plan/Ask and effort pickers under the message box now look like the dropdowns they are.`,`Switches that are off are easy to see in dark mode.`,`Error messages show what went wrong in words, without raw tags or a provider’s JSON.`,`The ✕ that removes an attachment or a reply is round.`,`Pressing Stop, or an update cutting a turn, no longer files an automatic bug report.`]},{version:`0.3.160`,date:`2026-09-27`,added:[`On Windows, the agent can use a real browser. Ask it to open a site, read a page, click, fill in a form or take a screenshot, and it does it in Oonak Browser, in a window you can see. The first time, OonaCode asks once to install the browser (about 210 MB); after that it opens straight away.`,`Each chat has its own browser profile, so a site you sign in to stays signed in for that chat. Switch the browser off for a chat in its Tools menu.`],fixed:[]},{version:`0.3.159`,date:`2026-09-27`,added:[],fixed:[`A chat reopened after an update no longer says “turn complete” the instant you send a message and then answer anyway. The engine’s own note about work that stopped during the update used to be taken for the end of your turn, with the whole earlier conversation’s tokens on the line.`,`A background task that stopped because OonaCode restarted now says so in plain words, instead of “Orphaned by a previous Claude Code process exit”.`]},{version:`0.3.158`,date:`2026-09-27`,added:[`Every thought in a chat shows how many words it has, so you can tell at a glance whether there is anything to read.`],fixed:[`A thought with nothing in it — some models return only a signature for their thinking — now says “Thought · empty” and no longer opens onto a blank box.`,`A command the agent was allowed to run no longer leaves an “Allowed Bash (automatically)” line under its own card: the card already shows the command and its result. Refusals are still shown.`]},{version:`0.3.157`,date:`2026-09-27`,added:[`On Linux, OonaCode has its own signed apt and dnf repositories. Install the app with apt (Debian, Ubuntu, Mint) or dnf (Fedora, RHEL, Rocky, Alma) — the commands are on the download page — and your package manager keeps it up to date with the rest of the system.`,`Every Linux release is signed with the OonaCode release key, and the one-line installer checks that signature before it installs anything.`],fixed:[`On Linux, the menu bar is drawn in the window in the app’s own colours, and it switches between light and dark with the app instead of keeping the desktop’s theme until a restart.`,`Upgrading the .rpm no longer removes the oonacode command, and removing it no longer leaves empty folders behind.`]},{version:`0.3.156`,date:`2026-09-27`,added:[`Chats can talk to each other. Turn on “Talk to other chats” in a chat’s Tools menu, and its agent can find your other chats that have it on, read them, and ask them for help — one chat or a whole group. A chat that is closed wakes up to answer; a busy one answers when it finishes. The reply comes back to the chat that asked.`,`The Conversations window (in the sidebar) shows every conversation between your chats: who said what to whom, what each answer cost, and buttons to pause, resume, close or stop them all. Each conversation has a budget — 20 messages and 1,000,000 new tokens by default — and pauses itself when it is used up, so chats can never talk forever.`,`Hover over any tool in a chat’s Tools menu to read what it does, how it works, what it costs and how to turn it off.`],fixed:[`A chat woken in the background — by a scheduled task or another chat — shows as working in the sidebar even when it is not open in a tab.`,`A scheduled task no longer slips into a chat at the same moment you send it a message; yours always goes first.`,`A message sent from the terminal no longer waits forever when a chat’s history cannot be resumed and the restart fails. It now says why.`,`Notes OonaCode writes into a chat — a model change, a conversation paused — are still there when you reopen it.`,`When every Claude seat in the OonaCode pool is taken, a new chat now says the model is busy and to try again in a few minutes or pick another model, instead of “Something went wrong on our side”.`,`On Linux, the app tells you it is updating while it swaps itself, so there is no need to start it again.`,`On Linux, removing the .deb or .rpm leaves nothing running and nothing failing at the next login, and the one-line installer checks for free disk space before it changes anything.`]},{version:`0.3.155`,date:`2026-09-27`,added:[`OonaCode runs on Linux. One command installs the command line, the background service and the desktop app: curl -fsSL https://oonacode.oonak.ai/install.sh | bash. The AppImage, .deb and .rpm are on the download page too.`,`On Linux the app lives in the system tray as it does on Windows, follows your desktop’s light or dark theme, and gets its own entry in the applications menu.`,`Uninstalling on Linux removes the desktop app along with the rest, and asks whether to keep your chats for a future install.`],fixed:[`A window no longer stays on “Unauthorized” after the background service restarts with a new key. It reconnects by itself.`]},{version:`0.3.154`,date:`2026-09-26`,added:[],fixed:[`A chat waiting on a long job no longer loses its watcher. OonaCode used to close a chat’s engine ten minutes after the model last spoke, which stopped any Monitor or background command it had left running. The engine now stays up while such work runs, up to 12 hours.`,`A chat moved into a project, or whose project you edit, now follows the project’s instructions from its next message. It used to keep the ones it started with.`]},{version:`0.3.153`,date:`2026-09-25`,added:[],fixed:[`A very long chat no longer answers “Prompt is too long” after OonaCode restarts or updates. The engine was judging the chat’s size by a figure left over from before the restart, and now gets an accurate one.`,`If a message is ever refused as too long before the model has started on it, OonaCode sends it again by itself with a shorter history. You see your message once and then the answer, not an error.`]},{version:`0.3.152`,date:`2026-09-25`,added:[],fixed:[`Uninstalling the app from Windows’ Apps list no longer stops the command-line OonaCode on the same PC from starting after a restart.`]},{version:`0.3.151`,date:`2026-09-25`,added:[`Files the agent names in a chat are clickable. Audio and video play right in the chat with a small player, pictures open as a preview, and in the app every file can be opened in its own program or shown in its folder.`,`Uninstalling the app asks whether to keep your chats on this PC. Keeping them means a new install signs in and continues every chat.`],fixed:[`Installing and updating no longer fail with “The operation has timed out” on PCs whose network drops the newer internet addresses, nor while our server restarts for an update.`]},{version:`0.3.150`,date:`2026-09-25`,added:[],fixed:[`The fix in 0.3.149 for long, sleeping turns now really reaches the agent: the Monitor tool and the block on long waits are on for every chat.`,`A chat compacted after a long pause no longer pays to cache a conversation it is about to replace, and the agent keeps each tool call in its history exactly as it wrote it — both as Claude Code does.`]},{version:`0.3.149`,date:`2026-09-25`,added:[`The agent can watch a long job with the Monitor tool, as Claude Code does, and is woken the moment the job finishes.`],fixed:[`Long chats no longer spend their time asleep. With no way to watch a background job, the agent had been polling it with waits of four to eight minutes. One chat spent more than three and a half hours of a day sleeping, and turns ran for hours while the model worked for a fraction of that. The agent now gets the same working rules as Claude Code, and long waits are blocked.`]},{version:`0.3.148`,date:`2026-09-25`,added:[],fixed:[`A scheduled task that could not be sent — the PC had just restarted, the vault was still locked, the server was not reachable yet — waits and tries again instead of switching itself off. Pausing, editing or deleting a task while its prompt is being sent is no longer undone, and a scheduled prompt no longer lands in a chat whose engine is still starting.`,`A chat on your own DeepSeek key, or one switched with a typed “/model opus”, is no longer shown as withdrawn and locked. “/model fable” picks Claude Fable instead of the default model.`,`Moving a chat to another model no longer lowers its saved effort level to what the old model offered, and a one-off “oona --effort” is no longer saved as the chat’s level.`,`After you pick another model for a locked chat and send, the chat no longer flashes the lock again while the engine starts; if the start fails, your pick is kept.`,`Coming back from a file tab no longer jumps the chat to an old reply or reopens the search bar.`,`The hidden sidebar slides away again when the pointer leaves the window past its edge, and the keyboard no longer tabs through it while it is hidden. Clicking ⓘ in Settings opens its note instead of closing it.`,`Subagents write their prompt cache for five minutes, as Claude Code does for its subscribers; the chat itself keeps the hour. Their cache writes cost less.`]},{version:`0.3.147`,date:`2026-09-25`,added:[`A chat’s scheduled tasks sit beside its subagents: a clock badge says how many are live and when the next one runs, and opens the list — each task’s schedule, its next and last run, Pause and Delete. The tasks run on this PC.`],fixed:[`A prompt the scheduler sends into a chat reads as a “Scheduled task” line, not as your own message waiting in the queue.`,`A chat whose model is no longer offered shows that model in red and waits for you to pick another; its history stays, and the old model is not in the list any more.`,`The effort list follows the server within minutes, without restarting the app. A chat set to a level that has been switched off moves to the nearest one — ultracode becomes xhigh. Chats on your own Claude subscription have an effort picker again.`]},{version:`0.3.146`,date:`2026-09-25`,added:[`A Tools menu beside the model picker: switch OonaCode’s own tools on or off for each chat — browser, desktop and window control, clipboard, screen capture, Office documents and run-as-administrator. Each tool costs the model only a short line until it is used, and the menu shows how much. The first tools are marked Demo while they are tested with every model: a demo tool answers what it would have done, and does nothing on your PC yet.`],fixed:[]},{version:`0.3.145`,date:`2026-09-25`,added:[],fixed:[`Every request of every chat, on every model, is about 3,200 tokens smaller: the engine’s own “auto memory” instructions are gone. OonaCode starts each engine in a fresh private folder and deletes it afterwards, so the notes the model was told to keep there were thrown away when the chat went idle — the model spent tool calls writing memories it would never read. A project’s memory is OonaCode’s own and stays.`,`The engine’s claude.ai Artifact tools are switched off everywhere OonaCode runs it — the app, the terminal, VS Code, the phone, Telegram and the agent API.`]},{version:`0.3.144`,date:`2026-09-25`,added:[],fixed:[`Long chats on Claude models in the OonaCode pool keep their cache for an hour, as Claude Code does for its subscribers. A pause of more than five minutes no longer re-sends the whole conversation at the full cache-write price, which in a large chat was the most expensive part of coming back to it.`,`The session panel’s Context shows how big the conversation is now, not the total of every request the chat ever made — a long chat read “10.7M / 1.0M tokens”.`,`The message box keeps the cursor after you send, so you can go straight on typing the next message.`,`A paid chat’s background work (titles, reading web pages) no longer goes to a free model of the same vendor.`]},{version:`0.3.143`,date:`2026-09-24`,added:[`Search inside your chats: open the search in the chat list, press the sliders button and choose Whole chats. It looks through every message of every chat on this PC, and you choose whose words — yours, the model’s, or both — plus, if you like, the tools’ commands and output and the subagents’ conversations. Results show each message with the words lit; a click opens the chat with its search on them.`,`More search options, for both kinds of search: one project only, a time window (today, 7 or 30 days), match case and whole words.`],fixed:[`While you search the chat list, projects with no matching chat are hidden too.`]},{version:`0.3.142`,date:`2026-09-24`,added:[],fixed:[`A reply you sent shows as the same small chip it had in the message box — “Reply to” and the first few words — instead of the whole quoted text; the full quote appears when you rest the pointer on it, and a click jumps to the message it answers.`,`The model now knows a reply points back into the conversation: it is told the quoted lines are from the chat history, not new input, and whose words they were — its own earlier reply, your earlier message, a file, or a tool’s output.`,`When the chat list is narrow, its buttons wrap onto a second line instead of spilling out of it.`]},{version:`0.3.141`,date:`2026-09-24`,added:[`The chat list on the left can be made wider or narrower: drag its right edge (double-click it for the usual width).`,`The chat list can hide: press the pin in its header, the button at the top left, or View → Sidebar (Ctrl+B). While hidden it slides in when the pointer reaches the left edge of the window, and slides away when you leave it.`,`Search in the chat list is a single magnifier now; click it and the search box opens across the top. Escape or × clears it.`],fixed:[`Opening OonaCode right after a restart no longer leaves the OonaCode pool models out of the model list: if they cannot be read yet, OonaCode asks again by itself a few seconds later and the list fills in.`,`The Artificial Analysis scores (intelligence, coding, speed and benchmarks) show on every model in the model list again — including the models of your own Claude and SuperGrok subscriptions, which never had them.`,`A chat’s details card no longer appears on top of its right-click menu.`]},{version:`0.3.140`,date:`2026-09-24`,added:[`Reply is tidier: the message you reply to shows as a small chip above the message box with its first few words, instead of filling the box. Click the chip — or the quote in a sent reply — to jump to that message; the × removes it.`,`Right-click a project in the sidebar for its settings: Project settings… opens Projects with that project already selected. The gear beside a project’s “+” does the same, and a chat filed in a project offers it in its own menu too.`,`Link GitHub. Under a project’s Repositories (and in Settings → Providers), link your GitHub account once: the agent’s git and gh then clone, pull and push your private repositories on every PC of yours. You type a short code on github.com; the token stays in your encrypted vault and never reaches the OonaCode server. Public repositories need nothing.`],fixed:[]},{version:`0.3.139`,date:`2026-09-24`,added:[`Every setting now says what it does, and resting the pointer on the ⓘ beside it tells you where in OonaCode it applies and what it does not do.`,`Export chats… is in the File menu (and on the sidebar in a browser window) instead of in Settings.`,`With Remote access turned off on a PC, your phone, Telegram, the website and your other PCs still show it — online or not — marked “remote access off”, and opening it tells you to turn Remote access back on in OonaCode on that PC.`],fixed:[`Turning Remote access off now tells your other devices at once. Before, the PC was already unreachable from them, but they could not say why.`,`The settings of This PC save the moment you change them — nothing is lost by closing the dialog.`,`Settings that did nothing, or repeated another one, are gone: the default permission mode (each chat’s Build / Plan / Ask first picker decides), the agent-picker switch, the Git Bash path, the engine path and the extra allowed origins. The server address is shown, not edited — signing in sets it.`]},{version:`0.3.138`,date:`2026-09-24`,added:[`Projects have settings now, like the Claude app’s: a goal, the repositories the project works on, what a new chat in it starts on (model, effort and folder), a project memory the agent keeps up to date, and whether its chats may schedule work — and how often at most. All of it is in Projects, and a Claude app project you import brings its own.`,`OonaCode has a scheduler. Ask the agent to do something later or on a repeat — “check the build every morning at nine” — and it schedules it on this PC; when it is due, the prompt arrives in the chat, even if the chat had gone quiet. The Projects dialog and the chat’s info panel list what is scheduled, where you can pause, resume or delete it.`],fixed:[`Saving a project’s instructions now reaches its chats at their next message, instead of waiting until the chat happened to restart.`]},{version:`0.3.137`,date:`2026-09-24`,added:[],fixed:[`After a PC restart the app could ask for a "host token" and sign you out: two copies of the OonaCode background service started at once and fought over your session. Only one ever runs now, and the app never shows the token page — if its service is replaced it reconnects by itself.`,`The unlock screen stays put until you unlock, and says what went wrong in place — a wrong password, or a connection it is re-establishing — instead of jumping to another page.`,`A message with a picture sent while the agent was working stayed “queued”, and removing it said it was already sent. It now shows as read the moment the agent takes it, and a reopened chat shows it with its picture.`,`In the model’s questions, typing your own answer now clears the options you had picked, and picking an option clears what you typed — the answer sent is exactly the one you chose. The same on the phone, in the terminal and in Telegram.`]},{version:`0.3.136`,date:`2026-09-24`,added:[`Every model now has its own housekeeper — the small, fast model of the same maker that writes a chat’s titles and reads the web pages it fetches. On the OonaCode pool a MiMo v2.6 Pro chat uses MiMo v2.6 Flash, a Qwen chat Qwen3.8 Flash, a GLM chat GLM-5.3 Flash and a GPT-5 chat GPT-5 mini, instead of doing that work on the big model itself. A free model keeps its own, so it stays free.`],fixed:[]},{version:`0.3.135`,date:`2026-09-24`,added:[],fixed:[`Claude models on the OonaCode pool — Opus 5.5, Opus 5, Sonnet 5 and Fable 5.1 — now use their whole 1M context. A long chat no longer stops to summarise itself every ~170k tokens, and its subagents get the same window.`,`Reading a web page is quick again in a Claude chat: pages are read by Claude Haiku, as in Claude Code, instead of a helper that took about a minute a page.`,`Changing a chat’s model now moves its subagents and background helpers to the new model too; before, they stayed on the old one until the app restarted.`,`MiMo v2.5 and v2.5 Pro chats now use their full 1M context too.`]},{version:`0.3.134`,date:`2026-09-23`,added:[],fixed:[`On the Android app, the model’s questions can be answered again. They come one at a time — “Question 2 of 3” — with Back, Next and Skip, and Answer sends them to your PC. The card used to show only the first question, hide the rest below it and wait for all of them, so it could not be sent.`]},{version:`0.3.133`,date:`2026-09-23`,added:[`Bring your Claude desktop app projects across: File → Import chats from other coding agents now lists every project the Claude app has opened on this PC. Each one arrives as an OonaCode project of the same name — its goal, instructions and what Claude noted about it become the project’s instructions — with its project chat and one chat per thread filed under it, ready to carry on.`,`A Claude Code chat you moved into a Claude app project is filed under that project here too.`,`A thread you never opened in the Claude app still comes across, with its task and every reply the project chat saw; open it once in the Claude app and import again for its whole conversation.`],fixed:[`Cursor chats appear in the import list again — they had been left out since September 10.`]},{version:`0.3.132`,date:`2026-09-23`,added:[`Reply to any part of a chat: select some text (or just right-click a block), choose Reply, and it is quoted in your message box — type your answer under it. A quote from a file the agent read names the file.`,`Right-click in a chat: copy what you selected, copy a whole reply or tool output, copy a code block or a link, find the selected words in the chat, or select a block.`,`Search in a chat opens the block its match is in — a folded tool card, a thought, a finished agent’s work — and scrolls to the words themselves.`,`Search matches are now bright orange, the current one strongest, so they stand out on code too.`,`The file viewer shows pictures (PNG, JPEG, GIF, WebP, SVG and more), plays audio and video, and shows Markdown formatted, with a switch to the source.`,`Right-click a file or folder in the explorer to copy its path or delete it.`],fixed:[`Moving a chat to another folder or project while it was working could delete the folder it was working in, start two agents at once, or send your next message to the old folder.`,`The working line no longer says a chat may be stuck while it waits for your approval or answer, or right after you send a message, and it counts time correctly (no more "4m 60s").`,`A date line no longer says "Today" for yesterday’s messages when the app stays open past midnight.`,"Installing with npm (`npm i -g oonacode`) installs this version again; earlier npm releases carried an old program.",`The What’s new window could open again on the next start, showing the same update a second time.`,`An older OonaCode window or VS Code extension no longer resets settings it does not know about, such as your theme colours or which project groups you folded.`,`A new install no longer opens with a list of changes; this window now appears only after an update.`,`The notification switch for permissions now says it also covers the agent’s questions.`]},{version:`0.3.131`,date:`2026-09-23`,added:[`Claude Opus 5.5 is here — the newest Opus, and cheaper to run than Opus 5. Choose it in the model picker, from the OonaCode pool or on your own Claude subscription. It runs on the newer Claude Code engine (2.1.280) that this update brings.`,`Every block in a chat shows its time at the bottom right, in your local time — hover it for the full date — and a date line marks where each day starts.`,`A running chat tells you how long the agent has been quiet, and after five minutes that it may be stuck and what to do.`,`After every update, OonaCode now opens this window to show you what changed.`],fixed:[`A reply that streamed in live had no time on it until the chat was opened again.`,`Chats open in tabs could fail to come back after a restart if a setting changed while they were being restored.`]}];function tu(e,t){let n=e=>{let[t,...n]=e.trim().replace(/^v/,``).split(`-`);return{nums:(t??``).split(`.`).map(e=>Number.parseInt(e,10)||0),pre:n.length>0?n.join(`-`):null}},r=n(e),i=n(t);for(let e=0;e<Math.max(r.nums.length,i.nums.length);e++){let t=(r.nums[e]??0)-(i.nums[e]??0);if(t!==0)return t}return r.pre===i.pre?0:r.pre===null?1:i.pre===null?-1:nu(r.pre,i.pre)}function nu(e,t){let n=e.split(`.`),r=t.split(`.`);for(let e=0;e<Math.max(n.length,r.length);e++){let t=n[e],i=r[e];if(t===i)continue;if(t===void 0)return-1;if(i===void 0)return 1;let a=/^\d+$/.test(t),o=/^\d+$/.test(i);if(a&&o){let e=Number(t)-Number(i);if(e!==0)return e;continue}return a===o?t<i?-1:1:a?-1:1}return 0}function ru(e,t,n=eu,r=null){if(!e||e===`0.0.0`)return[];let i=n.filter(t=>tu(t.version,e)<=0&&(!r||!t.platforms||t.platforms.includes(r)));return[...t===null?i.filter(t=>tu(t.version,e)===0):i.filter(e=>tu(e.version,t)>0)].sort((e,t)=>tu(t.version,e.version))}function iu(e,t,n,r=eu,i=null){if(!e||e===`0.0.0`)return{record:null,show:[]};let a=null;for(let e of r)(a===null||tu(e.version,a)>0)&&(a=e.version);let o=a!==null&&tu(e,a)>0?a:e;return{record:t===null||tu(o,t)>0?o:null,show:t===null&&!n?[]:ru(e,t,r,i)}}function au(e,t){if(t==null)return[...e];if(t.length===0)return[];let n=new Set(t),r=e.filter(e=>n.has(e.id));return r.length>0?r:[...e]}var ou=`the user skipped the question`,su=`(the user skipped this question)`;function cu(e){let t=e?.questions;if(!Array.isArray(t))return[];let n=[];for(let e of t){if(!e||typeof e!=`object`)continue;let t=e;if(typeof t.question!=`string`)continue;let r=Array.isArray(t.options)?t.options.map(e=>e&&typeof e==`object`?e:null).filter(e=>e!==null&&typeof e.label==`string`).map(e=>({label:e.label,...typeof e.description==`string`?{description:e.description}:{}})):[];n.push({question:t.question,header:typeof t.header==`string`?t.header:``,options:r,multiSelect:t.multiSelect===!0})}return n}function lu(e,t,n={},r=new Set){let i={};return e.forEach((e,a)=>{if(r.has(a)){i[e.question]=su;return}let o=(n[a]??``).trim();i[e.question]=o||(t[a]??[]).join(`, `)}),i}function uu(e){let t=e.questions,n=t===1?`question`:`questions`,r=t===1?`the model’s question`:`the model’s questions`,i=t===1?`The model’s question was`:`The model’s questions were`;switch(e.outcome){case`answered`:{let r=e.answers?Object.values(e.answers):null,i=r?r.filter(e=>typeof e==`string`&&e!==``&&e!==`(the user skipped this question)`).length:t;return t>0&&i<t?`You answered ${i} of ${t} ${n}`:t===0?`You answered the model’s questions`:t===1?`You answered the model’s question`:`You answered ${t} ${n}`}case`skipped`:return`You skipped ${r}`;case`dismissed`:return`${i} dismissed`;case`unanswered`:return`${i} not answered — the turn ended`}}function du(e){if(!e||typeof e!=`object`)return null;let t=e.answers;return t&&typeof t==`object`&&!Array.isArray(t)?t:null}var fu=[`oauth`,`token`];function pu(e){switch(e){case`signed-out`:return`Not signed in`;case`connecting`:return`Waiting for your sign-in…`;case`connected`:return`Connected`;case`expired`:return`Sign-in expired`;case`error`:return`Cannot reach the service`}}var mu=H().refine(e=>/^https:\/\/[^\s]+$/i.test(e),`must be an https address`),hu=Zo({vendor:H().min(1).max(60),mcpUrl:mu,readOnlyQuery:as(H(),H()).nullable(),auth:Zo({methods:Yo(ss(fu)).min(1),scopes:Yo(H()),offlineAccess:Uo(),token:Zo({label:H(),createUrl:mu,note:H().nullable()}).nullable()}),tools:Zo({deny:Yo(H()),allowWrites:Yo(H()),featured:Yo(H()),maxResultChars:zo().int().min(1e3).max(2e5)}),cli:Zo({command:H().regex(/^[A-Za-z0-9._-]{1,40}$/),versionArg:H().regex(/^--?[A-Za-z0-9-]{1,20}$/),install:as(H(),H()),login:Zo({command:H(),tokenEnv:H().nullable()}),purpose:H()}).nullable(),skills:Yo(Zo({name:H().regex(/^[a-z0-9][a-z0-9_-]{0,47}$/),source:Zo({repo:H().regex(/^[A-Za-z0-9._-]+\/[A-Za-z0-9._-]+$/),ref:H().regex(/^[0-9a-f]{40}$/,`pin a full commit, never a branch`),path:H().refine(e=>!/(^|[\\/])\.\.([\\/]|$)|^[\\/]/.test(e),`relative path`)}),license:H(),exclude:Yo(H())})),docsUrl:mu}).loose();function gu(e){if(e.toolName!==`ConnectorChange`)return null;let t=e.input;if(!t||typeof t!=`object`||typeof t.connector!=`string`||typeof t.vendor!=`string`||typeof t.tool!=`string`)return null;let n=t.arguments!==null&&typeof t.arguments==`object`&&!Array.isArray(t.arguments)?t.arguments:{};return{connector:t.connector,vendor:t.vendor,tool:t.tool,description:typeof t.description==`string`?t.description:``,arguments:n}}function _u(e){let t=Object.keys(e.arguments).slice(0,8);return`${e.vendor}: ${e.tool}${t.length>0?` (${t.join(`, `)})`:``}`}var vu=[`win32`,`linux`,`darwin`],yu=[`demo`,`live`],bu=[`allow`,`ask`],xu=[`string`,`number`,`integer`,`boolean`,`array`,`object`];function Su(e){let t=e/1048576;return t>=100?`${Math.round(t)} MB`:t>=1?`${t.toFixed(1)} MB`:`${Math.max(1,Math.round(e/1024))} KB`}function Cu(e){if(e.toolName!==`InstallToolPack`)return null;let t=e.input;return!t||typeof t!=`object`||typeof t.pack!=`string`||typeof t.name!=`string`||typeof t.version!=`string`||typeof t.sizeBytes!=`number`||typeof t.path!=`string`?null:{pack:t.pack,name:t.name,version:t.version,sizeBytes:t.sizeBytes,path:t.path}}function wu(e,t){let n=t?.[e.slug];return typeof n==`boolean`?n:e.defaultOn}function Tu(e,t){return e.filter(e=>wu(e,t))}var Eu={slug:48,name:80,entryTool:40,description:2e3,promptLine:1e3,details:8e3,actionDescription:1e3,params:30,paramName:48,paramDescription:400,enumValues:40,callArgKeys:20,callError:500,callBatch:100},Du=/^[A-Za-z0-9_-]+$/;function Ou(e){return typeof e==`string`&&e.length>0&&e.length<=Eu.entryTool&&Du.test(e)}function ku(e){return Math.ceil(e.length/4)}function Au(e){return ku(`${e.entryTool} ${e.description}`)+55}function ju(e){return e.tokensPerRequest??Au(e)+(e.promptLine?ku(e.promptLine):0)}var Mu=Zo({type:ss(xu),required:Uo().optional(),enum:Yo($o([H(),zo()])).optional(),description:H().optional()}),Nu=Zo({slug:H().min(1),description:H(),params:as(H(),Mu),permission:ss(bu),sort:zo()}),Pu=Zo({version:H(),url:H(),sha256:H(),sizeBytes:zo(),exe:H(),format:ls(`zip`)}),Fu=Zo({slug:H().min(1),name:H(),entryTool:H().refine(Ou,`not a valid tool name`),description:H(),promptLine:H().nullable(),details:H().nullable().optional(),status:ss(yu),defaultOn:Uo(),sort:zo(),install:Pu.nullable(),actions:Yo(Nu),connector:hu.nullable().optional().catch(null)}).loose();Zo({platform:ss(vu),version:H(),packs:Yo(Fu),refreshMinutes:zo()});var Iu=ss([`stdio`,`sse`,`http`]),Lu=Zo({id:H().trim().regex(/^[a-z0-9][a-z0-9._-]{0,63}$/i,`ID must be 1-64 alphanumeric, dash, dot, or underscore characters`),name:H().trim().min(1).max(100),description:H().max(500).optional(),transport:Iu,command:H().min(1).max(500).optional(),args:Yo(H()).max(100).optional(),env:as(H(),H()).optional(),url:H().url().max(2e3).optional(),headers:as(H(),H()).optional(),defaultOn:Uo(),enabled:Uo().optional(),catalogId:H().max(100).optional()});Lu.refine(e=>e.transport===`stdio`?typeof e.command==`string`&&e.command.length>0:typeof e.url==`string`&&e.url.length>0,{message:`stdio transport requires a command; sse/http transports require a url`}),Lu.partial(),as(H().regex(/^[a-z0-9][a-z0-9._-]{0,63}$/i),Uo()).refine(e=>Object.keys(e).length<=128,`At most 128 MCP server switches`);function Ru(e,t){if(e.enabled===!1)return!1;let n=t?t[e.id]:void 0;return typeof n==`boolean`?n:e.defaultOn}function zu(e,t,n){return{...e??{},[t]:n}}var Bu=[{id:`databases`,label:`Databases`},{id:`cloud`,label:`Cloud & DevOps`},{id:`productivity`,label:`Productivity`},{id:`analytics`,label:`Analytics`},{id:`ai`,label:`AI & Reasoning`},{id:`developer`,label:`Developer Tools`}],Vu=[{id:`postgres`,name:`PostgreSQL`,description:`Inspect schemas, query tables, run read operations and analyze database structures.`,category:`databases`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@modelcontextprotocol/server-postgres`,"${connectionString}"],parameters:[{key:`connectionString`,label:`Database Connection URL`,placeholder:`postgresql://user:password@localhost:5432/dbname`,type:`password`,required:!0,target:`arg`,templateIndex:2}],docsUrl:`https://github.com/modelcontextprotocol/servers/tree/main/src/postgres`},{id:`sqlite`,name:`SQLite`,description:`Direct SQL query and schema inspection for local SQLite database files.`,category:`databases`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@modelcontextprotocol/server-sqlite`,`--db-path`,"${dbPath}"],parameters:[{key:`dbPath`,label:`SQLite File Path`,placeholder:`C:/data/app.db or /var/data/app.db`,type:`string`,required:!0,target:`arg`,templateIndex:3}],docsUrl:`https://github.com/modelcontextprotocol/servers/tree/main/src/sqlite`},{id:`supabase`,name:`Supabase`,description:`Manage Supabase Postgres database, migrations, edge functions, and project config.`,category:`databases`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@modelcontextprotocol/server-supabase`],parameters:[{key:`SUPABASE_ACCESS_TOKEN`,label:`Personal Access Token`,type:`password`,required:!0,target:`env`},{key:`SUPABASE_PROJECT_REF`,label:`Project Reference ID`,placeholder:`abcdefghijklmnopqrst`,type:`string`,required:!0,target:`env`}],docsUrl:`https://supabase.com/docs/guides/ai/mcp`},{id:`redis`,name:`Redis`,description:`Inspect keys, data structures, and execute Redis operational commands.`,category:`databases`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@modelcontextprotocol/server-redis`,"${redisUrl}"],parameters:[{key:`redisUrl`,label:`Redis Connection URL`,placeholder:`redis://localhost:6379`,type:`string`,required:!0,target:`arg`,templateIndex:2}]},{id:`mongodb`,name:`MongoDB Atlas`,description:`Query collections, inspect schemas, and interact with MongoDB Atlas databases.`,category:`databases`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@modelcontextprotocol/server-mongodb`,"${connectionString}"],parameters:[{key:`connectionString`,label:`MongoDB Connection URI`,placeholder:`mongodb+srv://user:pass@cluster.mongodb.net/dbname`,type:`password`,required:!0,target:`arg`,templateIndex:2}]},{id:`github`,name:`GitHub`,description:`Search repositories, manage issues, pull requests, files, and branches.`,category:`cloud`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@modelcontextprotocol/server-github`],parameters:[{key:`GITHUB_PERSONAL_ACCESS_TOKEN`,label:`GitHub Personal Access Token (repo scope)`,placeholder:`ghp_...`,type:`password`,required:!0,target:`env`}],docsUrl:`https://github.com/modelcontextprotocol/servers/tree/main/src/github`},{id:`gitlab`,name:`GitLab`,description:`Access GitLab merge requests, project branches, issues, and pipelines.`,category:`cloud`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@modelcontextprotocol/server-gitlab`],parameters:[{key:`GITLAB_PERSONAL_ACCESS_TOKEN`,label:`GitLab Personal Access Token`,type:`password`,required:!0,target:`env`},{key:`GITLAB_API_URL`,label:`GitLab API URL (optional for self-hosted)`,placeholder:`https://gitlab.com/api/v4`,type:`string`,required:!1,target:`env`}]},{id:`cloudflare`,name:`Cloudflare`,description:`Inspect and manage Cloudflare Workers, KV namespaces, D1 databases, and DNS records.`,category:`cloud`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@cloudflare/mcp-server-cloudflare`],parameters:[{key:`CLOUDFLARE_API_TOKEN`,label:`API Token`,type:`password`,required:!0,target:`env`},{key:`CLOUDFLARE_ACCOUNT_ID`,label:`Account ID`,type:`string`,required:!0,target:`env`}]},{id:`sentry`,name:`Sentry`,description:`Retrieve real-time application errors, stack traces, and issue analytics.`,category:`cloud`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@modelcontextprotocol/server-sentry`],parameters:[{key:`SENTRY_AUTH_TOKEN`,label:`Auth Token`,type:`password`,required:!0,target:`env`}]},{id:`google-drive`,name:`Google Drive`,description:`Search, read, and export documents, spreadsheets, and files from Google Drive.`,category:`productivity`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@modelcontextprotocol/server-gdrive`],docsUrl:`https://github.com/modelcontextprotocol/servers/tree/main/src/gdrive`},{id:`slack`,name:`Slack`,description:`Read conversation history, search channel messages, and post updates to Slack channels.`,category:`productivity`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@modelcontextprotocol/server-slack`],parameters:[{key:`SLACK_BOT_TOKEN`,label:`Bot User OAuth Token (xoxb-...)`,type:`password`,required:!0,target:`env`},{key:`SLACK_TEAM_ID`,label:`Slack Workspace Team ID`,type:`string`,required:!0,target:`env`}]},{id:`notion`,name:`Notion`,description:`Read and update Notion workspaces, databases, pages, and blocks.`,category:`productivity`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@modelcontextprotocol/server-notion`],parameters:[{key:`NOTION_API_KEY`,label:`Internal Integration Secret (secret_...)`,type:`password`,required:!0,target:`env`}]},{id:`linear`,name:`Linear`,description:`Track issues, cycles, projects, and comments in Linear.`,category:`productivity`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@modelcontextprotocol/server-linear`],parameters:[{key:`LINEAR_API_KEY`,label:`Personal API Key`,type:`password`,required:!0,target:`env`}]},{id:`posthog`,name:`PostHog`,description:`Query product analytics funnels, trends, user session paths, and feature flags.`,category:`analytics`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@posthog/mcp-server-posthog`],parameters:[{key:`POSTHOG_API_KEY`,label:`Personal API Key`,type:`password`,required:!0,target:`env`},{key:`POSTHOG_PROJECT_ID`,label:`Project ID`,type:`string`,required:!0,target:`env`}]},{id:`brave-search`,name:`Brave Search`,description:`Search the live web and discover local points of interest via Brave Search API.`,category:`ai`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@modelcontextprotocol/server-brave-search`],parameters:[{key:`BRAVE_API_KEY`,label:`Brave Search API Key`,type:`password`,required:!0,target:`env`}]},{id:`memory-graph`,name:`Memory (Knowledge Graph)`,description:`Persistent knowledge-graph entity and relation memory across agent turns.`,category:`ai`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@modelcontextprotocol/server-memory`]},{id:`puppeteer`,name:`Puppeteer Headless Browser`,description:`Automate browser navigation, take page screenshots, and scrape dynamic web content.`,category:`ai`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@modelcontextprotocol/server-puppeteer`]},{id:`remote-sse`,name:`Remote SSE MCP Server`,description:`Connect to any hosted remote MCP server over Server-Sent Events (SSE).`,category:`developer`,transport:`sse`,defaultUrl:`https://`,parameters:[{key:`url`,label:`SSE Endpoint URL`,placeholder:`https://mcp.example.com/sse`,type:`string`,required:!0,target:`url`},{key:`Authorization`,label:`Authorization Header (optional, e.g. Bearer token)`,placeholder:`Bearer ...`,type:`password`,required:!1,target:`header`}]},{id:`remote-http`,name:`Remote Streamable HTTP Server`,description:`Connect to any remote MCP server using standard Streamable HTTP transport.`,category:`developer`,transport:`http`,defaultUrl:`https://`,parameters:[{key:`url`,label:`HTTP Endpoint URL`,placeholder:`https://mcp.example.com/mcp`,type:`string`,required:!0,target:`url`},{key:`Authorization`,label:`Authorization Header (optional, e.g. Bearer token)`,placeholder:`Bearer ...`,type:`password`,required:!1,target:`header`}]}],Hu=[`No answer needed.`,`"Talk to other chats" is off in this chat: this message is from another chat's agent, not the person, and you cannot message chats. Your final answer goes back to that chat by itself.`,`"Talk to other chats" is off in this chat: this message is from another chat's agent, not the person, and you cannot message chats. It asked for no answer, so nothing goes back.`,`Last hop of this chain: you cannot message chats in this turn; put what you have in your final answer.`];[`**Let this chat work together with your other chats.**`,``,`### What it does`,`- Finds your other chats on this PC and reads their recent messages.`,`- Sends one chat, or a group of chats, a message or a task.`,`- Brings their answers back to this chat, by itself.`,``,`### How it works`,`- A chat that is asleep is woken from its saved history. A busy one gets the message when its current turn ends, never in the middle of it.`,`- The other chat does the work with its own model, folder and tools. Its answer comes back here as a new message only when this chat asked for one.`,`- Several messages from one chat that wait for a busy chat are handed over together, in one turn, with one answer.`,`- Several chats can share one conversation (a group). An answer goes only to the chat that asked, so a group cannot multiply its own messages.`,`- A chat with this switch OFF can still be messaged by a chat that has it on. It does the work, and its final answer goes back to that chat when that chat asked for one. That is all it can do: it gets none of these tools, cannot message or read other chats, and its switch stays off.`,``,`### What it costs`,`- About 650 tokens on every request while it is on, read from the prompt cache. Nothing while it is off, even in a chat that is messaged.`,`- Every message makes the chat that receives it do a turn, which spends its own tokens.`,`- Switching it on or off in a chat that already has a conversation re-writes its prompt cache once.`,``,`### Safety limits`,`- Each conversation has a budget: 20 delivered messages and 1,000,000 new tokens by default (context read back from the prompt cache is not counted). Reaching either pauses the conversation, and the chats say so.`,`- A chain stops after 3 hops (a message caused by a message caused by a message).`,`- At most 5 messages between two chats and 20 from one chat in 10 minutes, and 10 waiting for any one chat. A chat cannot message itself.`,`- A conversation with no activity for 24 hours closes by itself.`,``,`### How to stop it`,`- Turn this switch off: the chat loses these tools, and what it sent and the answers it asked for pause. It still answers a chat that messages it.`,`- Or open the Conversations window and use Pause, Close or Stop all.`,``,`### Privacy`,`- Everything stays on your PC: the messages are kept in this PC's database, never on OonaCode's server.`,`- A message never grants anything. The other chat runs with its own permissions and asks you as usual.`,``,`Only a chat with this switch on can start a conversation; a chat with it off only answers.`].join(`
81
81
  `);var Uu={hops:3,rateWindowMs:6e5,perPair:5,perSender:20,pendingPerTarget:10,idleCloseMs:864e5,messageChars:2e4,titleChars:80,conversationTitleChars:120,recipients:10,listChats:50,readMessages:50,budgetMessagesMax:1e4,budgetTokensMax:1e9},Wu={message:`✉️ Message from chat "`,reply:`↩️ Reply from chat "`,continue:`↻ Continue the message from chat "`},Gu=`⚠ `,Ku=`<local-command-stdout>`,qu=`</local-command-stdout>`,Ju=/^[A-Za-z0-9._:-]{1,128}$/;function Yu(e){let t=(e??``).replace(/["“”]/g,`'`).replace(/\s+/g,` `).trim();if(!t)return`Untitled chat`;let n=Uu.titleChars;return t.length>n?`${t.slice(0,n-1).trimEnd()}…`:t}function Xu(e){return Yu(e.title?.trim()||e.firstPrompt?.trim()||`Chat ${e.id.slice(0,8)}`)}function Zu(e,t){let n=Hu.filter(e=>t===`reply`||e!==`No answer needed.`),r=e;for(let e=!0;e;){e=!1;for(let t of n){if(r===t)return``;r.startsWith(`${t}\n\n`)&&(r=r.slice(t.length+2),e=!0)}}return r}var Qu=/^\[conv:(\S+) chat:(\S+) host:(\S+) msg:(\S+?)(?: reply-to:(\S+?))?( reply expected)?\]$/;function $u(e){if(typeof e!=`string`)return null;let t=e;t.startsWith(Ku)&&t.endsWith(qu)&&(t=t.slice(22,t.length-23)),t=t.replace(/\r\n/g,`
82
82
  `);let n=t.indexOf(`
83
83
  `);if(n<0)return null;let r=t.slice(0,n),i=t.slice(n+1),a=i.indexOf(`
@@ -122,7 +122,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
122
122
  `):``}function Y_(e){if(e==null||!Number.isFinite(e))return``;if(e<1e3)return`${Math.floor(e)}ms`;if(e<1e4)return`${(Math.floor(e/100)/10).toFixed(1)}s`;let t=Math.floor(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/3600),r=Math.floor(t%3600/60);return n>0?`${n}h ${r}m`:`${r}m ${t%60}s`}function X_(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e4?`${Math.round(e/1e3)}k`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function Z_(e,t=Date.now()){if(!e)return``;let n=Date.parse(e);if(!Number.isFinite(n))return``;let r=Math.max(0,t-n),i=Math.floor(r/1e3);if(i<45)return`just now`;let a=Math.floor(i/60);if(a<60)return`${a}m ago`;let o=Math.floor(a/60);if(o<24)return`${o}h ago`;let s=Math.floor(o/24);return s<30?`${s}d ago`:new Date(n).toLocaleDateString()}function Q_(e,t=Date.now()){if(e==null||!Number.isFinite(e)||e<=0)return``;let n=Math.floor(Math.max(0,t-e)/1e3);if(n<45)return`just now`;let r=(e,t)=>`${e} ${t}${e===1?``:`s`} ago`,i=Math.floor(n/60);if(i<60)return r(Math.max(1,i),`minute`);let a=Math.floor(i/60);if(a<24)return r(a,`hour`);let o=Math.floor(a/24);return o<30?r(o,`day`):new Date(e).toLocaleDateString()}function $_(e){if(!e)return;let t=new Date(e);if(!Number.isNaN(t.getTime()))return t.toLocaleString()}function ev(e){if(!e)return``;let t=Date.parse(e);return Number.isFinite(t)?new Date(t).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}):``}function tv(e){let t=e.replace(/[\\/]+$/,``),n=t.split(/[\\/]/);return n[n.length-1]||t}function nv(e,t){return e.length<=t?e:`${e.slice(0,Math.max(0,t-1))}…`}function rv(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}function U(...e){return e.filter(Boolean).join(` `)}function iv(e,t=6){let n=e.trim().split(/\s+/).filter(Boolean);return n.length<=t?n.join(` `):`${n.slice(0,t).join(` `)}…`}function av(e){return e.title?.trim()||e.firstPrompt?.trim().replace(/\s+/g,` `)||`Session ${e.id.slice(0,8)}`}function ov(e){if(e instanceof Error)return e.message;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function sv(e,t=Date.now()){return{id:e,title:null,providerId:null,variantId:null,projectId:null,model:null,permissionMode:null,projectDir:null,createdAt:t}}function cv(e,t){if(!t)return e;let n={...e};return!e.model&&!e.providerId&&t.model&&(n.model=t.model,n.providerId=t.providerId??null,n.variantId=null),!e.effort&&t.effort&&(n.effort=t.effort),!e.projectDir&&t.cwd&&(n.projectDir=t.cwd),n}var ete=/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function tte(e){return ete.test(e)}function nte(){let e=new Uint8Array(16),t=globalThis.crypto;if(t&&typeof t.getRandomValues==`function`)return t.getRandomValues(e),e;for(let t=0;t<e.length;t++)e[t]=Math.floor(Math.random()*256);return e}function lv(){let e=globalThis.crypto;if(e&&typeof e.randomUUID==`function`){let t=e.randomUUID();if(tte(t))return t}let t=nte();t[6]=(t[6]??0)&15|64,t[8]=(t[8]??0)&63|128;let n=Array.from(t,e=>e.toString(16).padStart(2,`0`)).join(``);return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`}function uv(e){return e.title?.trim()||`New chat`}function dv(e){let t=e.trim().replace(/\s+/g,` `).slice(0,500);return t.length>0?t:null}function rte(e,t){return typeof t==`string`&&e[t]!==void 0}var ite=`data-font-scope`,fv=`oonacode-fonts`,ate=[[`xs`,12],[`sm`,14],[`base`,16],[`lg`,18],[`xl`,20],[`2xl`,24],[`3xl`,30]],ote=[9,10,11,12.5,13,15],ste=[[`h1`,20],[`h2`,18],[`h3`,16]];function pv(e){return`${Math.round(e*100)/100}px`}function cte(e){return`.text-\\[${String(e).replace(`.`,`\\.`)}px\\]`}function mv(e,t){let n=Al(t.size),r=jl(t.family);if(n===null&&r===null)return``;let i=`[${ite}='${e}']`,a=[];r!==null&&a.push(`font-family: ${r};`,`--font-sans: ${r};`);let o=[];if(r!==null&&o.push(`${i} .font-sans { font-family: ${r}; }`,`${i} .placeholder\\:font-sans::placeholder { font-family: ${r}; }`),n!==null){let e=n/14;a.push(`font-size: ${pv(n)};`);for(let[t,n]of ate)a.push(`--text-${t}: ${pv(n*e)};`);for(let t of ote)o.push(`${i} ${cte(t)} { font-size: ${pv(t*e)}; }`);for(let[t,n]of ste)o.push(`${i} .md:not(.md-compact) ${t} { font-size: ${pv(n*e)}; }`)}return[`${i} {\n ${a.join(`
123
123
  `)}\n}`,...o].join(`
124
124
  `)}function lte(e){return[mv(`chat`,e.chat),mv(`sidebar`,e.sidebar)].filter(e=>e!==``).join(`
125
- `)}function ute(e,t){let n=lte(t),r=e.getElementById(fv);if(n===``){r?.remove();return}let i=r??e.createElement(`style`);r||(i.id=fv,e.head.appendChild(i)),i.textContent!==n&&(i.textContent=n)}var hv=[{label:`System UI`,family:`system-ui, 'Segoe UI', Roboto, sans-serif`},{label:`Segoe UI`,family:`'Segoe UI', system-ui, sans-serif`},{label:`Arial`,family:`Arial, Helvetica, sans-serif`},{label:`Verdana`,family:`Verdana, Geneva, sans-serif`},{label:`Tahoma`,family:`Tahoma, Verdana, sans-serif`},{label:`Calibri`,family:`Calibri, Carlito, sans-serif`},{label:`Georgia (serif)`,family:`Georgia, 'Times New Roman', serif`},{label:`Times New Roman (serif)`,family:`'Times New Roman', Times, serif`},{label:`Monospace`,family:`ui-monospace, 'Cascadia Code', Consolas, monospace`}];function dte(e,t){return e===`dark`||e===`light`?e:t?`dark`:`light`}function gv(){return typeof document>`u`?`light`:document.documentElement.getAttribute(`data-theme`)===`dark`?`dark`:`light`}function fte(){let[e,t]=(0,v.useState)(gv);return(0,v.useEffect)(()=>{if(typeof document>`u`||typeof MutationObserver>`u`)return;let e=()=>t(gv());e();let n=new MutationObserver(e);return n.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-theme`]}),()=>n.disconnect()},[]),e}var _v=`oonacode.uiPrefs`;function pte(e){if(!e)return null;try{let t=e.getItem(_v);return t?Zl(JSON.parse(t)):null}catch{return null}}function vv(e,t){if(e)try{e.setItem(_v,JSON.stringify(t))}catch{}}function mte(e,t){let n=t.notifications?{...e.notifications,...t.notifications}:e.notifications;return Zl({...e,...t,notifications:n})}function hte(e){let t=e;return!t||typeof t!=`object`?!1:t.status===400||t.status===422||t.code===`bad_request`}function yv(e){let{row:t,panel:n,viewport:r}=e,i=e.gap??6,a=e.margin??8,o=Math.max(0,Math.min(e.width??352,r.width-2*a)),s=Math.max(0,Math.min(e.maxHeight??448,r.height-2*a)),c=Math.min(e.height>0?e.height:200,s),l=Math.max(a,Math.min(t.top,r.height-a-c)),u=n.right+i;if(u+o<=r.width-a)return{left:u,top:l,width:o,maxHeight:s,side:`right`};let d=n.left-i-o;if(d>=a)return{left:d,top:l,width:o,maxHeight:s,side:`left`};let f=Math.max(a,Math.min(t.left,r.width-a-o)),p=r.height-a-(t.bottom+i),m=t.top-i-a;if(p>=c||p>=m)return{left:f,top:t.bottom+i,width:o,maxHeight:Math.max(0,Math.min(s,p)),side:`below`};let h=Math.max(0,Math.min(s,m));return{left:f,top:t.top-i-Math.min(c,h),width:o,maxHeight:h,side:`above`}}function gte(e){let t=dd(e);return t?{media:t}:{}}function _te(e,t,n){let r={...e??{}};return n?r[t]=n:delete r[t],r}function vte(e,t,n){return{...e??{},ask:{...e?.ask??{},[t]:n}}}function bv(e){for(let t of Object.keys(cd))if(cd[t]===e)return t;return null}var xv={language:`en`,localVoice:{},speed:1,words:xf.words},Sv=`oonacode.voiceSummary.v1`;function yte(e){let t=e&&typeof e==`object`?e:{},n=xv,r={};if(t.localVoice&&typeof t.localVoice==`object`)for(let[e,n]of Object.entries(t.localVoice))typeof n==`string`&&n.length<300&&yf(e)&&(r[e]=n);return{language:typeof t.language==`string`&&yf(t.language)?yf(t.language).code:n.language,localVoice:r,speed:wf(t.speed),words:Cf(t.words)}}function Cv(e=Tv()){try{let t=e?.getItem(Sv);return yte(t?JSON.parse(t):null)}catch{return{...xv}}}function wv(e,t=Tv()){try{t?.setItem(Sv,JSON.stringify(e))}catch{}}function Tv(){try{return typeof window<`u`?window.localStorage:null}catch{return null}}function Ev(e){return e.kind===`system`?null:e.key.slice(e.key.indexOf(`:`)+1)}var Dv={zh:[`cmn`]};function Ov(e){return e.toLowerCase().replace(/_/g,`-`)}function kv(e,t){let n=Ov(e);return[t.code,...Dv[t.code]??[]].some(e=>n===e||n.startsWith(`${e}-`))}function bte(e,t){let n=Ov(e);return n===Ov(t.bcp47)?0:n===t.code||(Dv[t.code]??[]).includes(n)?1:2}function xte(e){let t=new Set(e.map(e=>e.name));return e.filter(e=>{let n=e.name.indexOf(`+`);if(n<=0)return!0;let r=e.name.lastIndexOf(` `),i=r>n?e.name.slice(r+1):``,a=i?`${e.name.slice(0,n)} ${i}`:e.name.slice(0,n);return!t.has(a)})}function Av(e,t,n){let r=t.filter(t=>t.language===e.code||(t.locale?kv(t.locale,e):!1)),i=r.filter(e=>e.engine!==`espeak`).map(e=>({key:`sherpa:${e.id}`,label:e.label,kind:`sherpa`})),a=r.filter(e=>e.engine===`espeak`).slice(0,1).map(e=>({key:`espeak:${e.id}`,label:e.label||`eSpeak (robotic)`,kind:`espeak`})),o=xte(n.filter(t=>kv(t.lang,e)&&t.localService!==!1)).map((t,n)=>({v:t,i:n,fit:bte(t.lang,e)})).sort((e,t)=>e.fit-t.fit||e.i-t.i).map(({v:e})=>({key:`system:${e.voiceURI}`,label:`${e.name} (system)`,kind:`system`}));return[...i,...o,...a]}function jv(e,t){return e.find(e=>e.key===t)??e[0]??null}function Mv(e,t){if(e===`win32`||e===`linux`||e===`darwin`)return e;let n=t??``;return/Windows|Win32|Win64/i.test(n)?`win32`:/Android|CrOS/i.test(n)?null:/Linux|X11/i.test(n)?`linux`:/Mac OS X|Macintosh/i.test(n)?`darwin`:null}function Nv(e,t,n=null,r=!1){let i=t?``:` The OonaCode desktop app comes with its own Armenian voices, and eSpeak for every other language.`,a=`No local voice for ${e.name} on this PC.`;return t&&n===`win32`&&r?`${a} The app’s own eSpeak voice, which speaks every language here, could not start — usually because Microsoft’s Visual C++ Redistributable (x64) is not installed: https://aka.ms/vs/17/release/vc_redist.x64.exe. Install it, then open this window again.`:n===`linux`?`${a} Install speech-dispatcher and espeak-ng from your distribution (Debian, Ubuntu, Mint: sudo apt install speech-dispatcher espeak-ng · Fedora: sudo dnf install speech-dispatcher espeak-ng · Arch: sudo pacman -S speech-dispatcher espeak-ng), then restart OonaCode.${i}`:n===`darwin`?`${a} Add a ${e.name} voice in System Settings → Accessibility → Spoken Content → System voice → Manage Voices, then open this window again.${i}`:n===`win32`?`${a} Add a ${e.name} voice in Settings → Time & language → Speech → Add voices, if Windows offers one for ${e.name}, then open this window again.${i}`:`${a} Add a ${e.name} voice in the system's speech settings (Windows: Settings → Time & language → Speech), then open this window again.${i}`}function Pv(e){return e===`linux`?`whole`:`sentences`}var Ste=75;function Fv(e,t){return Math.round(3e3+e.length*120/wf(t))}async function Cte(e,t,n,r){let{signal:i,onItem:a}=r,o=e.getVoices().find(e=>e.voiceURI===r.voiceURI)??null;e.cancel();let s=r.mode===`whole`?[n.join(` `)]:[...n];for(let c=0;c<s.length;c+=1){if(i.aborted)return;let l=s[c],u=await new Promise((s,u)=>{let d=[],f=!1,p=()=>!f&&(f=!0,d.forEach(e=>clearTimeout(e)),i.removeEventListener(`abort`,m),!0),m=()=>{p()&&(e.cancel(),s(`stopped`))},h=t(l);o&&(h.voice=o),h.lang=o?.lang??r.bcp47,h.rate=r.rate,h.onstart=()=>{if(f)return;if(r.mode===`sentences`){a(c);return}a(0);let e=0;for(let t=1;t<n.length;t+=1)e+=(n[t-1].length+1)*Ste/wf(r.rate),d.push(setTimeout(()=>!f&&a(t),e))},h.onend=()=>{p()&&s(`ended`)},h.onerror=e=>{p()&&(i.aborted||e.error===`interrupted`||e.error===`canceled`?s(`stopped`):u(Error(`The system voice failed: ${e.error??`unknown error`}`)))},i.addEventListener(`abort`,m),d.push(setTimeout(()=>{p()&&s(`lost`)},Fv(l,r.rate))),e.speak(h)});if(u===`stopped`)return;u===`lost`&&e.cancel()}}function Iv(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function wte(e,t){let n=new DataView(new ArrayBuffer(44)),r=(e,t)=>{for(let r=0;r<t.length;r+=1)n.setUint8(e+r,t.charCodeAt(r))};return r(0,`RIFF`),n.setUint32(4,36+e,!0),r(8,`WAVE`),r(12,`fmt `),n.setUint32(16,16,!0),n.setUint16(20,1,!0),n.setUint16(22,1,!0),n.setUint32(24,t,!0),n.setUint32(28,t*2,!0),n.setUint16(32,2,!0),n.setUint16(34,16,!0),r(36,`data`),n.setUint32(40,e,!0),n}function Tte(e,t){let n=new Uint8Array(44+e.length);return n.set(new Uint8Array(wte(e.length,t).buffer),0),n.set(e,44),n.buffer}function Lv(e,t){let n=new DataView(new ArrayBuffer(e.length*2));for(let t=0;t<e.length;t+=1){let r=Math.max(-1,Math.min(1,e[t]));n.setInt16(t*2,Math.round(r*32767),!0)}return Tte(new Uint8Array(n.buffer),t)}function Ete(){let e=null,t=()=>{if(!e)return;let t=e;e=null,URL.revokeObjectURL(t.url),t.done()};return{play(n,r){return t(),new Promise(i=>{let a=URL.createObjectURL(new Blob([n],{type:`audio/wav`})),o=new Audio(a);o.preservesPitch=!0,o.playbackRate=r,e={audio:o,url:a,done:i},o.onended=t,o.onerror=t,o.play().catch(t)})},stop(){e&&e.audio.pause(),t()}}}var Dte=Ete;async function Ote(e,t,n,r){if(e.length===0)return;let i=t(e[0],0);for(let a=0;a<e.length;a+=1){if(r.signal.aborted)return;let o=await i;if(r.signal.aborted)return;i=a+1<e.length?t(e[a+1],a+1):null,i?.catch(()=>void 0),r.onItem?.(a),await n.play(o,r.playbackRate??1)}}var Rv={range:`all`,from:``,to:``},zv=`oonacode.aboutBriefing.v1`,Bv=/^\d{4}-\d{2}-\d{2}$/;function Vv(e){let t=e&&typeof e==`object`?e:{};return{range:uf(t.range)?t.range:Rv.range,from:typeof t.from==`string`&&Bv.test(t.from)?t.from:``,to:typeof t.to==`string`&&Bv.test(t.to)?t.to:``}}function kte(){try{let e=window.localStorage.getItem(zv);return Vv(e?JSON.parse(e):null)}catch{return{...Rv}}}function Ate(e){try{window.localStorage.setItem(zv,JSON.stringify(e))}catch{}}function Hv(e,t){if(e.length===0)return`none`;let n=0;for(let r of e)t.has(r)&&(n+=1);return n===0?`none`:n===e.length?`all`:`some`}function Uv(e,t){let n=new Set(t);if(Hv(e,t)===`all`)for(let t of e)n.delete(t);else for(let t of e)n.add(t);return n}function Wv(e,t){let n=new Set(t),r=!1;for(let t of e)n.has(t)||(r=!0);return r?new Set([...e].filter(e=>n.has(e))):e}function jte(e,t){let n=[];if(e>0&&n.push(`${e} of the picked chats ${e===1?`has`:`have`} no about yet`),t>0){let r=e>0?`${t}`:`${t} of the picked chats`;n.push(`${r} ${t===1?`has an about`:`have abouts`} older than the chat’s last change`)}let r=[e>0?`a chat with no about is announced by its name and “no summary yet”`:null,t>0?`an older about is read as it is`:null].filter(Boolean).join(`, and `);return`${n.join(`; `)}. Writing them is one housekeeper call per chat, paid by the chat’s own route — credits for an OonaCode pool chat. Until then ${r}.`}var Gv={status:`idle`,index:-1,total:0,sessionId:null,title:null,part:0,error:null,playlist:[]};function Mte(e){return e.status===`preparing`||e.status===`speaking`||e.status===`paused`}var Kv={afterNameMs:cf.afterNameMs,betweenChatsMs:cf.betweenChatsMs};function Nte(e,t){return new Promise(n=>{if(t.aborted||e<=0){n();return}let r=()=>{clearTimeout(i),t.removeEventListener(`abort`,r),n()},i=setTimeout(r,e);t.addEventListener(`abort`,r,{once:!0})})}function Pte(e,t){return t.aborted?Promise.reject(Error(`stopped`)):new Promise((n,r)=>{let i=()=>r(Error(`stopped`));t.addEventListener(`abort`,i,{once:!0}),e.then(e=>{t.removeEventListener(`abort`,i),n(e)},e=>{t.removeEventListener(`abort`,i),r(e)})})}var Fte=class{#e;#t=[];#n=Gv;#r=null;#i=new Map;#a=new AbortController;constructor(e){this.#e=e}get state(){return this.#n}start(e,t=0){if(this.#t=[...e],this.#i.clear(),this.#t.length===0){this.#o(),this.#s({...Gv});return}this.#l(Math.max(0,Math.min(t,this.#t.length-1)),0)}pause(){(this.#n.status===`preparing`||this.#n.status===`speaking`)&&(this.#o(),this.#s({status:`paused`}))}resume(){let e=this.#n;e.index<0||this.#t.length===0||(e.status===`paused`?this.#l(e.index,e.part):e.status===`error`&&this.#l(e.index,0))}stop(){this.#o(),this.#n.status!==`idle`&&this.#n.status!==`stopped`&&this.#s({status:`stopped`,index:-1,part:0,error:null})}reset(){this.#o(),this.#t=[],this.#i.clear(),this.#n!==Gv&&(this.#n=Gv,this.#e.onState(Gv))}next(){if(this.#t.length===0||this.#n.index<0)return;let e=this.#n.index+1;if(e>=this.#t.length){this.#o(),this.#s({status:`done`,part:0});return}this.#l(e,0)}previous(){this.#t.length===0||this.#n.index<0||this.#l(Math.max(0,this.#n.index-1),0)}jumpTo(e){let t=this.#t.findIndex(t=>t.sessionId===e);t>=0&&this.#l(t,0)}resetWords(){this.#i.clear()}dispose(){this.reset(),this.#a.abort()}#o(){let e=this.#r;if(this.#r=null,e){e.abort();try{this.#e.silence()}catch{}}}#s(e){let t={...this.#n,...e},n=t.index>=0?this.#t[t.index]:void 0;t.total=this.#t.length,t.sessionId=n?.sessionId??null,t.title=n?.title??null,t.playlist=t.playlist.length===this.#t.length&&t.playlist.every((e,t)=>e===this.#t[t].sessionId)?t.playlist:this.#t.map(e=>e.sessionId),this.#n=t,this.#e.onState(t)}#c(e){let t=this.#t[e],n=this.#i.get(t.sessionId);if(n)return n;let r=this.#e.words(t,this.#a.signal);return this.#i.set(t.sessionId,r),r.catch(()=>{this.#i.get(t.sessionId)===r&&this.#i.delete(t.sessionId)}),r}#l(e,t){this.#o();let n=new AbortController;this.#r=n,this.#u(e,t,n.signal)}async#u(e,t,n){let r=this.#e.sleep??Nte,i=this.#e.afterNameMs??Kv.afterNameMs,a=this.#e.betweenChatsMs??Kv.betweenChatsMs,o=e;try{for(;o<this.#t.length;o+=1){let s=o===e?t:0;this.#s({status:`preparing`,index:o,part:s,error:null});let c=await Pte(this.#c(o),n);if(n.aborted)return;o+1<this.#t.length&&this.#c(o+1).catch(()=>void 0);let l=+!!c.name;if(c.name&&s===0&&(this.#s({status:`speaking`,part:0}),await this.#e.speak([c.name],{signal:n,onItem:()=>void 0}),n.aborted||(c.body.length>0&&await r(i,n),n.aborted)))return;let u=Math.max(0,s-l),d=c.body.slice(u);if(d.length>0&&(this.#s({status:`speaking`,part:l+u}),await this.#e.speak(d,{signal:n,onItem:e=>{n.aborted||this.#s({status:`speaking`,part:l+u+e})}}),n.aborted)||o+1<this.#t.length&&(await r(a,n),n.aborted))return}this.#r?.signal===n&&(this.#r=null),this.#s({status:`done`,index:this.#t.length-1,part:0})}catch(e){if(n.aborted)return;this.#r?.signal===n&&(this.#r=null);try{this.#e.silence()}catch{}let t=this.#t[o]?.title??`a chat`,r=e instanceof Error?e.message:String(e);this.#s({status:`error`,index:Math.min(o,this.#t.length-1),part:0,error:`${t}: ${r}`})}}};async function Ite(e,t){let{voice:n,language:r,speed:i,tts:a,signal:o,onItem:s}=t,c=n?Ev(n):null;if(c&&a){await Ote(e,async e=>{let n=await a.speak({voiceId:c,text:t.prepare(e,r.code),speed:i});return Lv(n.samples,n.sampleRate)},t.player,{signal:o,onItem:s});return}if(n?.kind===`system`){if(!t.synth)throw Error(`This window has no system speech.`);await Cte(t.synth,t.makeUtterance,e,{voiceURI:n.key.slice(7),bcp47:r.bcp47,rate:i,mode:Pv(t.platform),signal:o,onItem:s});return}throw Error(Nv(r,!!a,t.platform,t.espeakMissing))}var qv={ids:[],activeId:null};function Jv(e=[],t=null){let n=[];for(let t of e)t&&!n.includes(t)&&n.push(t);let r=n.slice(-20);return{ids:r,activeId:t&&r.includes(t)?t:r[r.length-1]??null}}function Yv(e,t){return!e.ids.includes(t)||e.activeId===t?e:{ids:e.ids,activeId:t}}function Xv(e,t){let n=e.ids.indexOf(t);if(n===-1)return e;let r=e.ids.filter(e=>e!==t);return e.activeId===t?{ids:r,activeId:r[n]??r[n-1]??null}:{ids:r,activeId:e.activeId}}function Lte(e,t,n){if(t===n||t<0||t>=e.ids.length)return e;let r=Math.max(0,Math.min(e.ids.length-1,n));if(r===t)return e;let i=[...e.ids],[a]=i.splice(t,1);return a===void 0?e:(i.splice(r,0,a),{ids:i,activeId:e.activeId})}function Rte(e,t){let n=t instanceof Set?t:new Set(t),r=e.ids.filter(e=>n.has(e));return r.length===e.ids.length?e:{ids:r,activeId:e.activeId&&r.includes(e.activeId)?e.activeId:r[r.length-1]??null}}function zte(e,t){if(e.ids.length===0)return e;let n=e.activeId?e.ids.indexOf(e.activeId):-1,r=n===-1?0:n,i=e.ids.length,a=((r+t)%i+i)%i,o=e.ids[a];return o?Yv(e,o):e}function Zv(e,t={},n={}){let r=[],i=[],a={},o={};for(let s of e.ids){let e=n[s];if(e){i.push(s),e.title&&(a[s]=e.title);continue}r.push(s);let c=t[s];c&&(o[s]=c)}return{openTabs:r,draftTabs:i,draftTitles:a,activeTab:e.activeId,remoteTabs:o}}function Bte(e){let t=e?.remoteTabs;if(!t)return{};let n={};for(let[e,r]of Object.entries(t))typeof r==`string`&&r.length>0&&(n[e]=r);return n}function Vte(e){let t=e?.draftTabs??[],n=e?.draftTitles??{},r=[];for(let e of t){if(typeof e!=`string`||e.length===0)continue;let t=n[e];r.push({id:e,title:typeof t==`string`&&t.length>0?t:null})}return r}function Hte(e){return Jv([...e.openTabs??[],...e.draftTabs??[]],e.activeTab??null)}function Qv(e,t){if(e.length!==t.length)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!0;return!1}function $v(e,t){for(let n of new Set([...Object.keys(e),...Object.keys(t)]))if(e[n]!==t[n])return!0;return!1}function Ute(e,t,n,r={}){let i=Zv(e,n??{},r);return!!(Qv(t.openTabs??[],i.openTabs)||Qv(t.draftTabs??[],i.draftTabs)||$v(t.draftTitles??{},i.draftTitles)||(t.activeTab??null)!==e.activeId||n&&$v(t.remoteTabs??{},i.remoteTabs))}var Wte=.25,ey=`g1`;function ty(e=qv){return{root:{type:`group`,id:ey},groups:{[ey]:e},focused:ey}}function ny(e){let t=[],n=e=>{if(e.type===`group`)t.push(e.id);else for(let t of e.children)n(t)};return n(e.root),t}function ry(e){let t=[];for(let n of ny(e))t.push(...e.groups[n]?.ids??[]);return t}function iy(e,t){for(let n of ny(e))if(e.groups[n]?.ids.includes(t))return n;return null}function ay(e){return e.groups[e.focused]??qv}function oy(e){return{ids:ry(e),activeId:ay(e).activeId}}function sy(e,t){if(e.activeId!==t.activeId||e.ids.length!==t.ids.length)return!1;for(let n=0;n<e.ids.length;n++)if(e.ids[n]!==t.ids[n])return!1;return!0}function cy(e){let t=[];for(let n of ny(e)){let r=e.groups[n]?.activeId;r&&t.push(r)}return t}function ly(e,t){let n=ny(e);return n.length<2?null:n[(n.indexOf(t)+1)%n.length]??null}function uy(e,t){let n=e.root;for(let e of t){if(n.type!==`split`)return null;let t=n.children[e];if(!t)return null;n=t}return n}function dy(e,t=e.length){let n=Array.from({length:t},(t,n)=>{let r=e[n];return typeof r==`number`&&Number.isFinite(r)&&r>0?r:0}),r=n.reduce((e,t)=>e+t,0);if(t===0)return[];if(r<=0)return n.map(()=>1/t);let i=r/n.filter(e=>e>0).length,a=n.map(e=>e>0?e:i),o=a.reduce((e,t)=>e+t,0);return a.map(e=>e/o)}function fy(e){if(e.type===`group`)return e;let t=[],n=[],r=dy(e.sizes,e.children.length);return e.children.forEach((i,a)=>{let o=fy(i);if(!o)return;let s=r[a]??0;o.type===`split`&&o.direction===e.direction?o.children.forEach((e,r)=>{t.push(e),n.push(s*(o.sizes[r]??0))}):(t.push(o),n.push(s))}),t.length===0?null:t.length===1?t[0]:{type:`split`,direction:e.direction,children:t,sizes:dy(n)}}function py(e,t){if(e.type===`group`)return e.id===t?null:e;let n=[],r=[];return e.children.forEach((i,a)=>{let o=py(i,t);o&&(n.push(o),r.push(e.sizes[a]??0))}),n.length===0?null:fy({type:`split`,direction:e.direction,children:n,sizes:r})}function my(e){let t=0;for(let n of Object.keys(e.groups)){let e=/^g(\d+)$/.exec(n);e&&(t=Math.max(t,Number(e[1])))}return`g${t+1}`}function hy(e,t){let n=ny(e);if(n.length<=1||!n.includes(t))return e;let r=n.indexOf(t),i=n.filter(e=>e!==t),a=py(e.root,t)??{type:`group`,id:i[0]},{[t]:o,...s}=e.groups;return{root:a,groups:s,focused:e.focused===t?n[r-1]??n[r+1]??i[0]:e.focused}}function gy(e,t,n){return e.groups[t]===n?e:{...e,groups:{...e.groups,[t]:n}}}function _y(e,t){let n=e.groups[t];return n&&n.ids.length===0?hy(e,t):e}function vy(e,t,n,r){let i=r===`left`||r===`right`?`row`:`column`,a=r===`left`||r===`top`;if(e.type===`group`)return e.id===t?{type:`split`,direction:i,children:a?[n,e]:[e,n],sizes:[.5,.5]}:e;let o=e.children.findIndex(e=>e.type===`group`&&e.id===t);if(o>=0&&e.direction===i){let t=e.sizes[o]??1/e.children.length,r=[...e.children],i=[...e.sizes],s=a?o:o+1;return i[o]=t/2,r.splice(s,0,n),i.splice(s,0,t/2),{...e,children:r,sizes:i}}return{...e,children:e.children.map(e=>vy(e,t,n,r))}}function yy(e,t,n){let r=e;for(let e=0;e<40&&ry(r).length>20;e++){let e=new Set(ny(r).map(e=>r.groups[e]?.activeId??null).filter(Boolean)),i=r=>r.find(r=>r!==t&&r!==n&&!e.has(r)),a=i(r.groups[r.focused]?.ids??[]);if(!a){for(let e of ny(r))if(a=i(r.groups[e]?.ids??[]),a)break}if(!a)break;r=wy(r,a)}return r}function by(e,t){return e.focused===t||!e.groups[t]?e:{...e,focused:t}}function xy(e,t){let n=ny(e)[t];return n?by(e,n):e}function Sy(e,t){let n=iy(e,t);if(!n)return e;let r=e.groups[n];return r.activeId===t&&e.focused===n?e:{...gy(e,n,Yv(r,t)),focused:n}}function Cy(e,t,n=e.focused){if(!t)return e;if(iy(e,t))return Sy(e,t);let r=e.groups[n]?n:e.focused,i=e.groups[r]??qv;return yy({...gy(e,r,{ids:[...i.ids,t],activeId:t}),focused:r},t,i.activeId)}function wy(e,t){let n=iy(e,t);return n?_y(gy(e,n,Xv(e.groups[n],t)),n):e}function Ty(e,t,n,r){let i=e.groups[t];return i?gy(e,t,Lte(i,n,r)):e}function Ey(e,t){let n=e.groups[e.focused];return n?gy(e,e.focused,zte(n,t)):e}function Dy(e,t,n,r){let i=e.groups[n];if(!i)return e;let a=iy(e,t);if(a===n){let a=i.ids.indexOf(t);return Sy(by(r===void 0?e:Ty(e,n,a,r>a?r-1:r),n),t)}let o=[...i.ids],s=r===void 0?o.length:Math.max(0,Math.min(o.length,r));o.splice(s,0,t);let c={...e,focused:n};return c=gy(c,n,{ids:o,activeId:t}),a&&(c=_y(gy(c,a,Xv(c.groups[a],t)),a)),a?c:yy(c,t,i.activeId)}function Oy(e,t,n,r){if(!e.groups[n])return e;let i=iy(e,t);if(i===n&&e.groups[n].ids.length===1||ny(e).length>=8)return e;let a=e;i&&(a=_y(gy(a,i,Xv(a.groups[i],t)),i));let o=my(a),s={root:fy(vy(a.root,n,{type:`group`,id:o},r))??a.root,groups:{...a.groups,[o]:{ids:[t],activeId:t}},focused:o};return i?s:yy(s,t,null)}function ky(e,t,n){return e.groups[n.groupId]?n.zone===`center`?Dy(e,t,n.groupId,n.index):Oy(e,t,n.groupId,n.zone):e}function Ay(e,t,n){return n.zone===`center`&&n.index===void 0?iy(e,t)!==n.groupId:ky(e,t,n)!==e}function jy(e,t,n){let r=uy(e,t);if(!r||r.type!==`split`)return e;let i=dy(n,r.children.length);return i.every((e,t)=>Math.abs(e-(r.sizes[t]??0))<1e-6)?e:{...e,root:Ny(e.root,t,{...r,sizes:i})}}function My(e,t){let n=uy(e,t);return!n||n.type!==`split`?e:jy(e,t,n.children.map(()=>1))}function Ny(e,t,n){if(t.length===0)return n;if(e.type!==`split`)return e;let[r,...i]=t;return{...e,children:e.children.map((e,t)=>t===r?Ny(e,i,n):e)}}function Py(e,t,n=null){let r=new Set(t),i=new Set,a=e;for(let t of ny(e)){let e=a.groups[t],n=e.ids.filter(e=>!r.has(e)||i.has(e)?!1:(i.add(e),!0));if(n.length===e.ids.length)continue;let o=e.activeId&&n.includes(e.activeId)?e.activeId:n.at(-1)??null;a=gy(a,t,{ids:n,activeId:o})}for(let e of ny(a))a=_y(a,e);let o=t.filter(e=>!i.has(e));if(o.length>0){let e=a.groups[a.focused]??qv,t=[...e.ids,...o.filter((e,t)=>o.indexOf(e)===t)];a=gy(a,a.focused,{ids:t,activeId:e.activeId??t.at(-1)??null})}return n&&r.has(n)&&(a=Sy(a,n)),a}function Fy(e){if(e.type===`group`)return{width:380,height:240};let t=e.children.map(Fy);return e.direction===`row`?{width:t.reduce((e,t)=>e+t.width,0),height:Math.max(0,...t.map(e=>e.height))}:{width:Math.max(0,...t.map(e=>e.width)),height:t.reduce((e,t)=>e+t.height,0)}}function Iy(e,t,n){if(e.root.type===`group`)return!1;let r=Fy(e.root);return t<r.width||n<r.height}function Ly(e,t,n,r=Wte){if(e.width<=0||e.height<=0)return`center`;let i=(t-e.left)/e.width,a=(n-e.top)/e.height,o=[[`left`,i],[`right`,1-i],[`top`,a],[`bottom`,1-a]],s=o[0];for(let e of o)e[1]<s[1]&&(s=e);return s[1]<r?s[0]:`center`}function Ry(e,t){for(let n=0;n<e.length;n++){let r=e[n];if(t<r.left+r.width/2)return n}return e.length}function zy(e){switch(e){case`left`:return{left:0,top:0,width:.5,height:1};case`right`:return{left:.5,top:0,width:.5,height:1};case`top`:return{left:0,top:0,width:1,height:.5};case`bottom`:return{left:0,top:.5,width:1,height:.5};default:return{left:0,top:0,width:1,height:1}}}function By(e){if(e.root.type===`group`)return null;let t=n=>{if(n.type===`group`){let t=e.groups[n.id]??qv;return{group:{tabs:[...t.ids],active:t.activeId}}}return{split:n.direction,sizes:n.sizes.map(e=>Math.round(e*1e4)/1e4),children:n.children.map(t)}};return{root:t(e.root),focused:Math.max(0,ny(e).indexOf(e.focused))}}function Vy(e,t){if(!e||!t)return!e&&!t;if(e.focused!==t.focused)return!1;let n=(e,t)=>{if(`group`in e||`group`in t){if(!(`group`in e)||!(`group`in t))return!1;let n=e.group,r=t.group;return n.active===r.active&&n.tabs.length===r.tabs.length&&n.tabs.every((e,t)=>e===r.tabs[t])}return e.split===t.split&&e.children.length===t.children.length&&e.children.every((e,r)=>n(e,t.children[r]))&&e.sizes.every((e,n)=>Math.abs(e-(t.sizes[n]??NaN))<.001)};return n(e.root,t.root)}function Hy(e,t,n=null){let r=ty();if(e&&typeof e==`object`&&e.root){let t={},n=0,i=(e,r)=>{if(r>8||!e||typeof e!=`object`)return null;if(`group`in e&&e.group&&Array.isArray(e.group.tabs)){if(n>=8)return null;n+=1;let r=`g${n}`,i=e.group.tabs.filter(e=>typeof e==`string`),a=typeof e.group.active==`string`&&i.includes(e.group.active)?e.group.active:i.at(-1)??null;return t[r]={ids:i,activeId:a},{type:`group`,id:r}}if(`split`in e&&(e.split===`row`||e.split===`column`)){let t=Array.isArray(e.children)?e.children:[],n=[],a=[];return t.forEach((t,o)=>{let s=i(t,r+1);s&&(n.push(s),a.push(Array.isArray(e.sizes)?e.sizes[o]??0:0))}),n.length===0?null:fy({type:`split`,direction:e.split,children:n,sizes:a})}return null},a=i(e.root,0);if(a&&Object.keys(t).length>0){let n=[],i=e=>{e.type===`group`?n.push(e.id):e.children.forEach(i)};i(a),r={root:a,groups:t,focused:n[typeof e.focused==`number`&&Number.isInteger(e.focused)?e.focused:0]??n[0]}}}return Py(r,t,n)}var Uy={seq:0,sessionIds:null};function Wy(e,t){return e.sessionIds===null||e.sessionIds.includes(t)}var Gy=`oonacode.nextPromptWindow.v1`,Ky=`oonacode.projectManagerFilter.v1`,qy={range:`24h`,from:``,to:``};function Jy(){try{let e=window.localStorage.getItem(Gy);return e===null?Mp.windowHours:Pp(Number(e))}catch{return Mp.windowHours}}function Yy(e){try{window.localStorage.setItem(Gy,String(Pp(e)))}catch{}}function Xy(){try{let e=window.localStorage.getItem(Ky);return e?Vv(JSON.parse(e)):{...qy}}catch{return{...qy}}}function Zy(e){try{window.localStorage.setItem(Ky,JSON.stringify(e))}catch{}}function Qy(e){let t=e.running?`Reviewing ${e.done} of ${e.total}`:e.stopped?`Stopped at ${e.done} of ${e.total}`:`Reviewed ${e.done} of ${e.total}`,n=[`${e.ok} ready`,`${e.failed} failed`];return e.skipped>0&&n.push(`${e.skipped} unchanged`),`${t} — ${n.join(`, `)}`}function $y(e){return e.isError?Fp.finishedUnseenError:Fp.finishedUnseen}function eb(e){let t=new Date(e);return Number.isFinite(t.getTime())?`${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}`:``}function tb(e,t,n){let r=[];for(let i of cy(e))t[i]?.active||(n===null||e.groups[n]?.activeId!==i)&&r.push(i);return r}function nb(e,t){return!e?.finishedUnseen||t===`running`||t===`waiting_permission`?null:e.finishedUnseen}function rb(){return typeof document>`u`||document.visibilityState!==`visible`?!1:typeof document.hasFocus==`function`&&document.hasFocus()}function ib(e){return!e||e.text.length===0&&e.attachments.length===0&&(e.replies?.length??0)===0}function ab(e,t){if(!e||e.text!==t.text||e.attachments.length!==t.attachments.length)return!1;let n=e.replies??[],r=t.replies??[];return n.length!==r.length||!n.every((e,t)=>e===r[t])?!1:e.attachments.every((e,n)=>e===t.attachments[n])}function ob(e,t,n){if(ib(n)){if(e[t]===void 0)return e;let{[t]:n,...r}=e;return r}return ab(e[t],n)?e:{...e,[t]:n}}function sb(e,t){let n=Object.keys(e);if(n.length===0)return e;let r=new Set(t);if(n.every(e=>r.has(e)))return e;let i={};for(let t of n)r.has(t)&&(i[t]=e[t]);return i}var cb=new Map;function lb(e,t){return cb.set(e,t),()=>{cb.get(e)===t&&cb.delete(e)}}function ub(e){return cb.get(e)?.()??null}var db=1e5,fb=50;function pb(e,t,n=null){let r=e.drafts[t],i=e.remoteTabs[t],a={id:t,kind:i?`remote`:r?`draft`:`session`};i&&(a.hostId=i.hostId,a.hostName=i.hostName),r&&(a.draft={title:r.title,providerId:r.providerId,model:r.model,variantId:r.variantId,permissionMode:r.permissionMode,...r.posture?{posture:r.posture}:{},projectDir:r.projectDir,projectId:r.projectId});let o=(n??e.unsent[t])?.text??``;o.length>0&&(a.unsentText=o.slice(0,db));let s=e.files[t];if(s&&s.open.length>0){let e=s.open.slice(0,fb);a.files={open:e,active:s.active&&e.includes(s.active)?s.active:null}}return a}function mb(e){let{unsentText:t,files:n,...r}=e;return r}var hb=[`default`,`acceptEdits`,`plan`,`auto`,`dontAsk`,`bypassPermissions`];function gb(e,t=Date.now()){let n=e.draft??{},r=e=>typeof e==`string`&&e.length>0?e:null,i=r(n.permissionMode);return{...sv(e.id,t),title:r(n.title),providerId:r(n.providerId),model:r(n.model),variantId:r(n.variantId),permissionMode:i&&hb.includes(i)?i:null,...N(n.posture)?{posture:n.posture}:{},projectDir:r(n.projectDir),projectId:r(n.projectId)}}var _b=`application/x-oonacode-tab`,vb=null;function yb(e,t){if(vb={...t},e){e.effectAllowed=`move`;try{e.setData(_b,t.tabId)}catch{}}}function bb(){return vb}function xb(){let e=vb;return vb=null,e}function Sb(e){if(vb)return!0;let t=e?.types;if(!t)return!1;for(let e=0;e<t.length;e++)if(t[e]===`application/x-oonacode-tab`)return!0;return!1}function Cb(e,t){return e.clientX<0||e.clientY<0||e.clientX>t.innerWidth||e.clientY>t.innerHeight}function wb(e,t,n){let r=e.getAttribute(`data-editor-group`);if(!r)return null;let i=e.querySelector(`[data-tab-strip]`),a=i?.getBoundingClientRect();if(i&&a&&a.height>0&&n>=a.top&&n<=a.bottom)return{groupId:r,zone:`center`,index:Ry(Array.from(i.querySelectorAll(`[data-tab-group="${Eb(r)}"]`)).filter(e=>e.hasAttribute(`data-tab-id`)).map(e=>e.getBoundingClientRect()),t)};let o=e.querySelector(`[data-group-body]`)??e;return e.getAttribute(`data-compact`)===`true`?{groupId:r,zone:`center`}:{groupId:r,zone:Ly(o.getBoundingClientRect(),t,n)}}function Tb(e,t,n){let r=(typeof e.elementFromPoint==`function`?e.elementFromPoint(t,n):null)?.closest(`[data-editor-group]`)??null;return r?wb(r,t,n):null}function Eb(e){return typeof CSS<`u`&&typeof CSS.escape==`function`?CSS.escape(e):e.replace(/["\\]/g,`\\$&`)}function Db(e,t){if(e.includes(t))return e.filter(e=>e!==t);let n=e=>wl.indexOf(e),r=e.findIndex(e=>n(e)>n(t)),i=[...e];return i.splice(r===-1?i.length:r,0,t),i}function Ob(e,t){return e.includes(t)?e.filter(e=>e!==t):[...e,t]}function kb(e,t){return e.filter(e=>!t||t(e))}function Ab(e,t){let n={};for(let r of e)n[r]=+!t.includes(r);return n}function jb(e,t){return{rightPanelSections:[...e],rightPanelCollapsed:t.filter(t=>e.includes(t)),sessionPanelOpen:e.includes(`sessionInfo`)}}function Mb(e,t,n){return{sections:e.includes(n)?[...e]:Db(e,n),collapsed:t.filter(e=>e!==n)}}function Nb(e,t=!0){return{leftPanelSection:e,leftPanelOpen:t,explorerOpen:t&&e===`files`}}function Pb(){return typeof window<`u`&&typeof window.matchMedia==`function`&&!window.matchMedia(`(min-width: 768px)`).matches}function Fb(e){Pb()&&e(!1)}function Ib(e,t,n){return t!==e.section||!n?{section:t,open:!0}:{section:t,open:!e.open}}function Lb(e){return e.trim().toLowerCase()}function Rb(e,t,n){let r=Lb(t);return r===``||av(e).toLowerCase().includes(r)?!0:!!n&&n.toLowerCase().includes(r)}function zb(e,t){let n=Lb(t),r=new Set,i=new Set,a=(e,t)=>e?`${e}/${t}`:t,o=t=>{for(let n of e[t]?.entries??[]){let e=a(t,n.name);r.add(e),n.type===`dir`&&o(e)}},s=t=>{let c=!1;for(let l of e[t]?.entries??[]){let e=a(t,l.name);l.name.toLowerCase().includes(n)?(r.add(e),l.type===`dir`&&o(e),c=!0):l.type===`dir`&&s(e)&&(r.add(e),i.add(e),c=!0)}return c};return n!==``&&s(``),{visible:r,open:i}}function Bb(e=500){let t=Vb(e);return{size:t,rendered:t}}function Vb(e){return Number.isFinite(e)?Math.max(1,Math.round(e)):500}function Hb(e,t){let n=Vb(t);return e.size===n&&e.rendered===n?e:{size:n,rendered:n}}function Ub(e,t,n=100){let r=Math.max(0,Math.floor(t)),i=Math.max(1,Math.floor(n));if(e.rendered>=r)return e;let a=Math.min(r,e.rendered+i);return a===e.rendered?e:{size:e.size,rendered:a}}function Wb(e,t,n,r=!1){let i=Math.min(Math.max(0,Math.floor(n)),Math.max(0,Math.floor(t)));return i<=e.rendered?r&&!e.held?{...e,held:!0}:e:{size:e.size,rendered:i,...r||e.held?{held:!0}:{}}}function Gb(e,t=!1){return e.held&&!t||e.rendered===e.size&&!e.held?e:{size:e.size,rendered:e.size}}function Kb(e,t){let n=e.length,r=Math.min(n,Math.max(t.size,t.rendered)),i=Math.max(0,n-r);return{start:i,items:i===0?e.slice():e.slice(i),hiddenAbove:i,hasMore:i>0,total:n}}function qb(e,t=48){return e.scrollHeight-e.scrollTop-e.clientHeight<=t}function Jb(e,t=24){return e.scrollTop<=t}var Yb=2e3;function Xb(e,t=Yb,n=Date.now){let r=-1/0,i=null,a=()=>{i=null,r=n(),e()};return{request(){if(i!==null)return;let e=r+t-n();e<=0?a():i=setTimeout(a,e)},dispose(){i!==null&&(clearTimeout(i),i=null)}}}var Zb=3e3;function Qb(e){let{balance:t}=e.credits;if(typeof e.credits.plan!=`number`&&typeof e.credits.topup!=`number`)return{balance:t,plan:null,topup:null,hasSplit:!1};let n=e.credits.plan??Math.max(0,t-(e.credits.topup??0));return{balance:t,plan:n,topup:e.credits.topup??Math.max(0,t-n),hasSplit:!0}}function $b(e){return e.credits.monthlyGrant>0?e.credits.monthlyGrant:Zb}function ex(e){if(!e)return`ok`;let{balance:t}=e.credits;return t<=0?`empty`:t<=$b(e)*.1?`low`:`ok`}function tx(e){if(!e)return null;let t=ex(e);if(t===`ok`)return null;let n=nx(e.credits.balance);return t===`empty`?{level:t,text:`No credits left — a priced model will be refused. Free models still run, on every plan.`}:{level:t,text:`Running low: ${n} credits left. Free models still run, on every plan.`}}function nx(e){return e.toLocaleString(`en-US`,{maximumFractionDigits:0})}function rx(e,t){return!t||t.providerId!==`oonacode`?!1:(t.poolCredits??0)!==(e?.providerId===`oonacode`?e.poolCredits??0:0)}var ix=new Set([`Alt`,`AltGraph`,`Control`,`Shift`,`Meta`,`OS`,`CapsLock`]),ax=new Set([`Tab`,`Escape`,`ContextMenu`,`Help`]),ox=1500,sx=24,cx=-1/0,lx=()=>Date.now();function ux(){cx=lx()}function dx(e){if(!e)return`none`;if(typeof document<`u`&&e===document.body)return`BODY`;let t=e.tagName??`?`,n=e.getAttribute?.(`data-testid`)??e.getAttribute?.(`aria-label`)??e.getAttribute?.(`role`),r=typeof e.className==`string`?e.className.split(/\s+/).filter(Boolean).slice(0,3):[];return`${t}${n?`[${n.slice(0,60)}]`:``}${r.length>0?`.${r.join(`.`)}`:``}`}function fx(e){return ix.has(e.key)?`modifier`:!(typeof e.getModifierState==`function`&&e.getModifierState(`AltGraph`))&&(e.ctrlKey||e.metaKey||e.altKey)||ax.has(e.key)||/^F\d{1,2}$/.test(e.key)?`shortcut`:e.key.length===1?`text`:e.key.slice(0,20)}function px(e,t){let n=t.now??(()=>Date.now());lx=n;let r=-1/0,i=`none`,a=-1/0,o=-1/0,s=!1,c=[],l=e=>{let t=fx(e);if(t!==`modifier`){if(t===`shortcut`){a=n();return}r=n(),i=t}},u=()=>{o=n(),s=!0},d=()=>{o=n(),s=!1},f=e=>e-r<=2e3&&!s&&e-o>1e3&&e-a>1e3&&(e-cx>1e3||e<cx),p=()=>{let e=n();return c.filter(t=>e-t.t<=ox).map(e=>e.what)},m=a=>{let o=n();if(!f(o))return;let s=a.relatedTarget instanceof Element?a.relatedTarget:null,c=p();setTimeout(()=>{if(typeof document<`u`&&!document.hasFocus()||typeof document<`u`&&document.activeElement===e)return;let n=typeof document<`u`?document.activeElement:null;n&&n!==e&&n.closest?.(`[data-testid="composer"]`)||t.report({activeAfter:dx(n),relatedTarget:dx(s),boxConnected:e.isConnected,boxDisabled:e.disabled,recentlyAdded:c,sinceKeyMs:Math.round(o-r),lastKey:i,unmounted:!e.isConnected})},0)},h=null,g=t.root??(typeof document<`u`?document.body:null);return g&&typeof MutationObserver<`u`&&(h=new MutationObserver(e=>{let t=n();for(let n of e)for(let e of Array.from(n.addedNodes))e.nodeType===1&&(c.push({t,what:dx(e)}),c.length>sx&&c.shift())}),h.observe(g,{childList:!0,subtree:!0})),e.addEventListener(`keydown`,l),e.addEventListener(`blur`,m),typeof document<`u`&&(document.addEventListener(`pointerdown`,u,!0),document.addEventListener(`pointerup`,d,!0),document.addEventListener(`pointercancel`,d,!0)),()=>{let a=n();typeof document<`u`&&document.activeElement===e&&f(a)&&t.report({activeAfter:`unmounting`,relatedTarget:`none`,boxConnected:e.isConnected,boxDisabled:e.disabled,recentlyAdded:p(),sinceKeyMs:Math.round(a-r),lastKey:i,unmounted:!0}),h?.disconnect(),e.removeEventListener(`keydown`,l),e.removeEventListener(`blur`,m),typeof document<`u`&&(document.removeEventListener(`pointerdown`,u,!0),document.removeEventListener(`pointerup`,d,!0),document.removeEventListener(`pointercancel`,d,!0))}}var mx=[`desktop`,`host`,`cli`,`engine`],hx={desktop:`Desktop app`,host:`Host service`,cli:`oona CLI`,engine:`Agent engine`},gx={available:!1,components:[],version:``,channel:``,publishedAt:``,notes:``},_x=/(\d+(?:\.\d+)*(?:[-+][0-9A-Za-z.-]+)?)\s*$/;function vx(e){return typeof e.version==`string`&&e.version.trim()?e.version.trim():_x.exec(e.name??``)?.[1]??null}function yx(e){let[t=``,n=``]=(e.trim().replace(/^v/i,``).split(`+`)[0]??``).split(`-`,2);return{nums:t.split(`.`).map(e=>{let t=Number.parseInt(e,10);return Number.isFinite(t)?t:0}).filter((e,t)=>t<4),pre:n?n.split(`.`):[]}}function bx(e,t){let n=yx(e),r=yx(t),i=Math.max(n.nums.length,r.nums.length);for(let e=0;e<i;e++){let t=n.nums[e]??0,i=r.nums[e]??0;if(t!==i)return t<i?-1:1}if(n.pre.length===0&&r.pre.length===0)return 0;if(n.pre.length===0)return 1;if(r.pre.length===0)return-1;let a=Math.max(n.pre.length,r.pre.length);for(let e=0;e<a;e++){let t=n.pre[e],i=r.pre[e];if(t===i)continue;if(t===void 0)return-1;if(i===void 0)return 1;let a=Number.parseInt(t,10),o=Number.parseInt(i,10);return Number.isFinite(a)&&Number.isFinite(o)&&/^\d+$/.test(t)&&/^\d+$/.test(i)?a<o?-1:1:t<i?-1:1}return 0}function xx(e,t){return!e||!t?!1:bx(e,t)===1}function Sx(e){if(typeof e!=`object`||!e)return null;let t=e,n=typeof t.version==`string`?t.version:``;if(!n)return null;let r=Array.isArray(t.assets)?t.assets.filter(e=>typeof e==`object`&&!!e):[];return{version:n,channel:typeof t.channel==`string`?t.channel:`stable`,publishedAt:typeof t.publishedAt==`string`?t.publishedAt:``,notes:typeof t.notes==`string`?t.notes:``,assets:r}}function Cx(e,t,n){if(!e||!e.version)return gx;let r=(e.assets??[]).filter(e=>typeof e?.kind==`string`&&e.kind),i=new Map;for(let e of r)n&&e.platform&&e.platform!==n||i.has(e.kind)||i.set(e.kind,e);let a=e=>!!n&&!i.has(e)&&r.some(t=>t.kind===e),o=[];for(let n of mx){let r=t[n];if(typeof r!=`string`||!r.trim())continue;let s=i.get(n);if(!s&&a(n))continue;let c=(s?vx(s):null)??(n===`desktop`?e.version:null);!c||!xx(c,r)||o.push({component:n,label:hx[n],current:r.trim(),latest:c,url:s?.url?s.url:null,notes:typeof s?.notes==`string`?s.notes:``})}return{available:o.length>0,components:o,version:e.version,channel:e.channel,publishedAt:e.publishedAt,notes:e.notes}}function wx(e,t=null,n=null){return!e||!e.trim()?null:`${e.trim().replace(/\/+$/,``)}${Wc(t,n)}`}function Tx(e){return e.bridge?.appChannel??e.info?.cliChannel??`stable`}function Ex(e,t){return Gc(e,t)}var Dx={phase:`idle`,version:``,percent:0,transferred:0,total:0,bytesPerSecond:0,error:``,notice:``};function Ox(e){return e===`ready`||e===`installing`}function kx(e,t){let n=t.version||e.version;switch(t.phase){case`checking`:return Ox(e.phase)?e:{...Dx,phase:`checking`,version:n};case`available`:return Ox(e.phase)?e:{...Dx,phase:`available`,version:n};case`not-available`:return Ox(e.phase)?e:{...Dx,version:n};case`downloading`:return{...Dx,phase:`downloading`,version:n,percent:Math.max(0,Math.min(100,t.percent)),transferred:t.transferred,total:t.total,bytesPerSecond:t.bytesPerSecond};case`downloaded`:return{...Dx,phase:`ready`,version:n,percent:100};case`installing`:return{...Dx,phase:`installing`,version:n,percent:100,notice:t.message||(e.phase===`installing`?e.notice:``)};case`error`:return{...Dx,phase:`error`,version:n,error:t.message}}}function Ax(e){switch(e.install.phase){case`ready`:case`installing`:return`ready`;case`downloading`:return`downloading`;case`available`:return`available`;default:return e.manifestAvailable?`available`:`idle`}}var jx=[`B`,`KB`,`MB`,`GB`];function Mx(e){if(!Number.isFinite(e)||e<=0)return`0 B`;let t=e,n=0;for(;t>=1024&&n<jx.length-1;)t/=1024,n+=1;return`${t>=10||n===0?Math.round(t):t.toFixed(1)} ${jx[n]}`}function Nx(e){return!Number.isFinite(e)||e<=0?``:`${Mx(e)}/s`}var Px=[`host`,`cli`,`engine`];function Fx(e){let t=e?.platform===`darwin`;return{desktop:typeof e?.installUpdate==`function`&&!t,terminal:typeof e?.updateTerminalInstall==`function`,...t?{desktopViaTerminal:!0}:{}}}function Ix(e,t,n={}){let r=e.length>0,i=t.desktopViaTerminal===!0,a=!i&&(n.shellEngaged===!0||e.includes(`desktop`)||!r&&!n.checked),o=r&&e.some(e=>Px.includes(e)||i&&e===`desktop`),s=a&&t.desktop,c=o&&t.terminal,l=e.filter(e=>e===`desktop`&&!i?a&&!s:o&&!c),u=!a&&!o;return{terminal:c,desktop:s,manual:l,upToDate:u,label:u?`Up to date`:c&&s?`Update everything`:s?`Update and relaunch`:c?`Update now`:`How to update`}}function Lx(e,t){return e===`desktop`?t.desktopViaTerminal?t.terminal?`Replaced by the oona installer — OonaCode closes and reopens`:"Run `oona update` in a terminal":t.desktop?`Downloads here, then OonaCode restarts`:`Run the installer from the website`:t.terminal?`Installed by the oona installer — updated from here`:"Run `oona update` in a terminal"}var Rx={running:!1,message:``,failed:!1};function zx(e,t){switch(e){case`agentFinished`:return t.notifications.agentFinished;case`permissionRequired`:return t.notifications.permissionRequired;case`errorOccurred`:return t.notifications.errorOccurred;default:return!1}}function Bx(e,t){let n=t.sessionTitle||`OonaCode`,r=e=>t.sessionId?{...e,sessionId:t.sessionId}:e;switch(e){case`permissionRequired`:return t.toolName===`AskUserQuestion`?r({title:`Question for you`,body:`${n} — the agent is asking you a question.`,focusOnClick:!0}):r({title:`Permission required`,body:`${n} — the agent wants to run ${t.toolName??`a tool`}.`,focusOnClick:!0});case`errorOccurred`:return r({title:`OonaCode error`,body:`${n} — ${t.detail??`the agent reported an error`}.`,focusOnClick:!0});default:return r({title:t.isError?`Agent needs attention`:`Agent finished`,body:t.isError?`${n} — the turn ended with an error.`:`${n} — turn complete.`,focusOnClick:!0,silent:!t.isError})}}async function Vx(e,t={}){if(t.documentHasFocus?.()===!0)return!1;if(t.bridgeNotify)try{return await t.bridgeNotify(e)}catch{return!1}let n=t.browser;if(!n)return!1;try{if(n.permission===`granted`||n.permission==="default"&&n.requestPermission&&await n.requestPermission()===`granted`)return n.create(e.title,{body:e.body,silent:e.silent===!0}),!0}catch{}return!1}function Hx(){if(typeof window>`u`)return{};let e=window.oonacode,t=globalThis.Notification;return{bridgeNotify:e?.notify?t=>e.notify(t):void 0,browser:t?{permission:t.permission,create:(e,n)=>{new t(e,n)},requestPermission:()=>t.requestPermission()}:void 0,documentHasFocus:()=>typeof document<`u`&&typeof document.hasFocus==`function`&&document.hasFocus()}}var Ux=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),W=o(((e,t)=>{t.exports=Ux()}))(),Wx=2e3,Gx=2500;function Kx(){return{connection:{status:`idle`,detail:null,hostName:null,hostId:null,appVersion:null},info:null,bundleAppVersion:null,hostUpdatedTo:null,sessions:[],sessionLinks:{},sessionsTotal:0,sessionsLoading:!1,sessionsError:null,sessionListLoaded:!1,search:``,projects:[],vaultProjects:[],scheduledTasksVersion:0,conversationsChange:Hp,conversationsSelectId:null,chatConversations:{},chatAboutsChange:Jd,nextPromptsChange:Uy,assignProjectSessionId:null,voiceSummarySessionId:null,projectsStartNew:!1,importOffered:!1,projectsSelectId:null,page:null,pinnedRows:{},currentSessionId:null,tabs:Jv(),layout:ty(),pageGroup:null,windowRole:`main`,elsewhere:{},drafts:{},pendingRouting:{},transcripts:{},transcriptLoading:{},files:{},dirtyFiles:{},unsent:{},composerQuote:null,jumpTo:null,chatSearchRequest:null,windows:{},modelBoundaries:{},providers:[],activeProviderId:null,agentTools:null,settings:null,prefs:{...Fl},prefsBackend:`unknown`,account:null,plan:null,accountLoaded:!1,accountLink:null,emailVerification:null,recoveryKey:null,credentials:[],claudeSubscription:null,claudeLogin:null,oauthLogin:null,engineDownload:null,importProgress:null,toolInstalls:{},mcpServers:null,mcpTesting:{},mcpTestResults:{},doctor:null,remote:{hosts:[],supported:!0,loading:!1,loaded:!1,sessions:{},unreachable:{},sessionOwners:{},tabs:{},reason:null,stale:!1},update:gx,updateChecking:!1,updateInstall:Dx,terminalUpdate:Rx,updateDismissed:null,toasts:[],ui:{sidebarOpen:!0,dialog:`none`,connectProviderId:null,claudeLoginMode:null,oauthLoginProviderId:null,settingsSection:null,sidebarPinnedOverride:null}}}function qx(e,t){if(t===e.layout&&e.tabs.activeId===e.currentSessionId)return e;let n=oy(t),r=sy(n,e.tabs)?e.tabs:n,i=e.drafts;for(let t of e.tabs.ids)r.ids.includes(t)||e.drafts[t]===void 0||(i===e.drafts&&(i={...i}),delete i[t]);return{...e,layout:t,tabs:r,drafts:i,unsent:sb(e.unsent,r.ids),currentSessionId:r.activeId}}function Jx(e,t){return e.windows[t]??Bb(e.prefs.transcriptWindowSize)}function Yx(e,t){let n=Object.entries(e);if(n.length===0)return e;let r=!1,i={};for(let[e,a]of n){let n=Hb(a,t);n!==a&&(r=!0),i[e]=n}return r?i:e}function Xx(e,t){return{...e,prefs:t,windows:Yx(e.windows,t.transcriptWindowSize)}}function Zx(e,t){switch(t.type){case`connection`:return{...e,connection:{...e.connection,status:t.status,detail:t.detail??null}};case`welcome`:return{...e,connection:{...e.connection,hostName:t.hostName,hostId:t.hostId,appVersion:t.appVersion}};case`info`:{let n=t.info.account??null,r=e.bundleAppVersion??t.info.appVersion;return{...e,info:t.info,bundleAppVersion:r,hostUpdatedTo:t.info.appVersion===r?null:t.info.appVersion,activeProviderId:t.info.activeProviderId,account:n??e.account,accountLoaded:e.accountLoaded||n!==null,accountLink:n?.link??e.accountLink,connection:{...e.connection,hostName:t.info.hostName,hostId:t.info.hostId,appVersion:t.info.appVersion}}}case`sessions`:return{...e,sessions:t.sessions,sessionsTotal:t.total,sessionsLoading:!1,sessionsError:null,sessionListLoaded:!0,...t.links?{sessionLinks:Object.fromEntries(t.links.map(e=>[e.sessionId,e]))}:{}};case`session_link`:{let n={...e.sessionLinks};return t.link?n[t.sessionId]=t.link:delete n[t.sessionId],{...e,sessionLinks:n}}case`sessions_loading`:return{...e,sessionsLoading:t.loading};case`sessions_error`:return{...e,sessionsError:t.error,sessionsLoading:!1};case`search`:return{...e,search:t.value};case`session_upsert`:{let n=e.sessions.findIndex(e=>e.id===t.session.id),r=n>=0?e.sessions.map(e=>e.id===t.session.id?t.session:e):[t.session,...e.sessions],i=e.transcripts[t.session.id],a=n>=0?e.sessions[n]:void 0,o=a!==void 0&&a.cwd!==t.session.cwd,s=i&&o?bg(i,{type:`local_system`,subtype:`workspace`,text:`Workspace changed to ${t.session.cwd} — the engine restarts there on your next message; the conversation continues.`}):i,c=s?{...e.transcripts,[t.session.id]:bg(s,{type:`session`,session:t.session})}:e.transcripts,l=e.remote.sessionOwners[t.session.id]??e.remote.tabs[t.session.id]?.hostId??null,u=l?e.remote.sessions[l]:void 0,d=l?{...e.remote.sessions,[l]:u?u.some(e=>e.id===t.session.id)?u.map(e=>e.id===t.session.id?t.session:e):[t.session,...u]:[t.session]}:e.remote.sessions;return{...e,sessions:r,sessionsTotal:n>=0?e.sessionsTotal:e.sessionsTotal+1,transcripts:c,...d===e.remote.sessions?{}:{remote:{...e.remote,sessions:d}},...e.pinnedRows[t.session.id]?{pinnedRows:{...e.pinnedRows,[t.session.id]:t.session}}:{}}}case`files_dirty`:return{...e,dirtyFiles:{...e.dirtyFiles,[t.sessionId]:t.paths}};case`file_open`:{let n=e.files[t.sessionId]??{open:[],active:null},r=n.open.includes(t.path)?n.open:[...n.open,t.path];return{...e,page:null,files:{...e.files,[t.sessionId]:{open:r,active:t.path}}}}case`file_close`:{let n=e.files[t.sessionId];if(!n||!n.open.includes(t.path))return e;let r=n.open.indexOf(t.path),i=n.open.filter(e=>e!==t.path),a=n.active===t.path?i[Math.min(r,i.length-1)]??null:n.active;return{...e,files:{...e.files,[t.sessionId]:{open:i,active:a}}}}case`file_show_chat`:{let n=e.files[t.sessionId];return!n||n.active===null?e:{...e,files:{...e.files,[t.sessionId]:{...n,active:null}}}}case`file_activate`:{let n=e.files[t.sessionId];return!n||!n.open.includes(t.path)?e:n.active===t.path?e.page?{...e,page:null}:e:{...e,page:null,files:{...e.files,[t.sessionId]:{...n,active:t.path}}}}case`session_removed`:{let{[t.id]:n,...r}=e.transcripts,{[t.id]:i,...a}=e.files,{[t.id]:o,...s}=e.windows,{[t.id]:c,...l}=e.pendingRouting,{[t.id]:u,...d}=e.remote.tabs,{[t.id]:f,...p}=e.remote.sessionOwners,{[t.id]:m,...h}=e.prefs.remoteTabs,{[t.id]:g,..._}=e.chatConversations,{[t.id]:v,...y}=e.pinnedRows,b={...e,chatConversations:_,pinnedRows:y,sessions:e.sessions.filter(e=>e.id!==t.id),sessionsTotal:Math.max(0,e.sessionsTotal-1),transcripts:r,windows:s,files:a,pendingRouting:l,remote:{...e.remote,tabs:d,sessionOwners:p,sessions:Object.fromEntries(Object.entries(e.remote.sessions).map(([e,n])=>[e,Array.isArray(n)?n.filter(e=>e.id!==t.id):n]))},prefs:{...e.prefs,remoteTabs:h}};return qx(b,wy(b.layout,t.id))}case`projects`:return{...e,projects:t.projects};case`scheduled_tasks_changed`:return{...e,scheduledTasksVersion:e.scheduledTasksVersion+1};case`conversations_changed`:return{...e,conversationsChange:{seq:e.conversationsChange.seq+1,conversationIds:t.conversationIds,sessionIds:t.sessionIds}};case`conversations_select`:return{...e,conversationsSelectId:t.conversationId};case`chat_abouts_changed`:return{...e,chatAboutsChange:{seq:e.chatAboutsChange.seq+1,sessionIds:t.sessionIds,generateAll:t.generateAll}};case`next_prompts_changed`:return{...e,nextPromptsChange:{seq:e.nextPromptsChange.seq+1,sessionIds:t.sessionIds,...t.review===void 0?{}:{review:t.review}}};case`chat_conversations`:{let n=e.chatConversations[t.sessionId];return n&&JSON.stringify(n)===JSON.stringify(t.conversations)?e:{...e,chatConversations:{...e.chatConversations,[t.sessionId]:t.conversations}}}case`session_status`:{let n=e.sessions.findIndex(e=>e.id===t.sessionId),r=e.pinnedRows[t.sessionId],i=r&&r.status!==t.status?{...e,pinnedRows:{...e.pinnedRows,[t.sessionId]:{...r,status:t.status}}}:e;if(n<0||e.sessions[n].status===t.status)return i;let a=e.sessions.slice();return a[n]={...a[n],status:t.status},{...i,sessions:a}}case`vault_projects`:return{...e,vaultProjects:t.projects};case`voice_summary_dialog`:return{...e,voiceSummarySessionId:t.sessionId,ui:{...e.ui,dialog:t.sessionId?`voice-summary`:`none`}};case`assign_project_dialog`:return{...e,assignProjectSessionId:t.sessionId,ui:{...e.ui,dialog:t.sessionId?`assign-project`:`none`}};case`page`:return e.page===t.page?e:{...e,page:t.page,pageGroup:t.page?e.layout.focused:e.pageGroup};case`pinned_row`:return{...e,pinnedRows:{...e.pinnedRows,[t.session.id]:t.session}};case`select_session`:{let n={...e,ui:{...e.ui,dialog:`none`}};if(t.id===null)return{...n,currentSessionId:null};let r=t.near?iy(n.layout,t.near):null;return qx({...n,page:null},Cy(n.layout,t.id,r??void 0))}case`close_tab`:return qx(e,wy(e.layout,t.id));case`unsent`:{if(!e.tabs.ids.includes(t.sessionId)||t.onlyIfEmpty&&!ib(e.unsent[t.sessionId]))return e;let n=ob(e.unsent,t.sessionId,t.message);return n===e.unsent?e:{...e,unsent:n}}case`composer_quote`:return{...e,composerQuote:{sessionId:t.sessionId,text:t.text,preview:t.preview,itemId:t.itemId,seq:(e.composerQuote?.seq??0)+1}};case`chat_search_request`:return{...e,chatSearchRequest:{sessionId:t.sessionId,query:t.query,seq:(e.chatSearchRequest?.seq??0)+1}};case`chat_search_request_seen`:{let n=e.chatSearchRequest;return!n||n.seq!==t.seq||n.seen?e:{...e,chatSearchRequest:{...n,seen:!0}}}case`jump_to`:return{...e,jumpTo:{sessionId:t.sessionId,itemId:t.itemId,seq:(e.jumpTo?.seq??0)+1}};case`move_tab`:return qx(e,Ty(e.layout,t.groupId??e.layout.focused,t.from,t.to));case`cycle_tab`:return qx({...e,page:null},Ey(e.layout,t.delta));case`layout_focus`:return qx(e,by(e.layout,t.groupId));case`layout_focus_index`:return qx(e,xy(e.layout,t.index));case`layout_drop`:{let n=ky(e.layout,t.tabId,t.target);if(n===e.layout)return e;let r=e.page&&e.pageGroup===t.target.groupId?null:e.page;return qx(r===e.page?e:{...e,page:r},n)}case`layout_resize`:return qx(e,jy(e.layout,t.path,t.sizes));case`layout_equalize`:return qx(e,My(e.layout,t.path));case`elsewhere`:{let n=e.elsewhere,r=t.owners;return Object.keys(n).length===Object.keys(r).length&&Object.entries(r).every(([e,t])=>n[e]===t)?e:{...e,elsewhere:{...r}}}case`sidebar_pinned_override`:return e.ui.sidebarPinnedOverride===t.pinned?e:{...e,ui:{...e.ui,sidebarPinnedOverride:t.pinned}};case`restore_tabs`:{let n=e.tabs.ids.filter(e=>!t.ids.includes(e)),r={...e.drafts},i=new Set(e.sessions.map(e=>e.id));for(let e of t.drafts)!r[e.id]&&!i.has(e.id)&&(r[e.id]=e);let a=e.currentSessionId??t.activeId,o=Jv([...t.ids,...n],a),s=Hy(t.layout??null,o.ids);return o.activeId&&(s=Sy(s,o.activeId)),qx({...e,drafts:r},s)}case`draft_open`:return qx({...e,page:null,drafts:{...e.drafts,[t.draft.id]:t.draft}},Cy(e.layout,t.draft.id));case`draft_patch`:{let n=e.drafts[t.id];return n?{...e,drafts:{...e.drafts,[t.id]:{...n,...t.patch}}}:e}case`draft_materialized`:{if(!e.drafts[t.id])return e;let{[t.id]:n,...r}=e.drafts;return{...e,drafts:r}}case`routing_seen`:{let n=e.pendingRouting[t.session.id];if(!n||!qee(n,t.session,e.providers))return e;let{[t.session.id]:r,...i}=e.pendingRouting;return{...e,pendingRouting:i}}case`pending_routing`:if(t.routing===null){if(!e.pendingRouting[t.sessionId])return e;let{[t.sessionId]:n,...r}=e.pendingRouting;return{...e,pendingRouting:r}}return{...e,pendingRouting:{...e.pendingRouting,[t.sessionId]:t.routing}};case`transcript`:{let n=e.transcripts[t.sessionId]??_g(t.sessionId),r=bg(n,t.action);if(r===n)return e;let i={...e,transcripts:{...e.transcripts,[t.sessionId]:r}};if(r.items.length>n.items.length){let e=Jx(i,t.sessionId),n=Gb(e);if(n!==e||i.windows[t.sessionId]===void 0)return{...i,windows:{...i.windows,[t.sessionId]:n}}}return i}case`transcript_page`:{let n=e.transcripts[t.sessionId];return!n||n.items.length===0?Zx(e,{type:`transcript`,sessionId:t.sessionId,action:{type:`entries`,entries:t.entries}}):Zx(e,{type:`transcript_prepend`,sessionId:t.sessionId,entries:t.entries})}case`transcript_prepend`:{let n=e.transcripts[t.sessionId]??_g(t.sessionId),r=bg(n,{type:`prepend_entries`,entries:t.entries});if(r===n)return e;let i=Jx(e,t.sessionId),a=r.items.length-n.items.length;return{...e,transcripts:{...e.transcripts,[t.sessionId]:r},windows:{...e.windows,[t.sessionId]:Wb(i,Math.max(i.rendered,i.size)+a,r.items.length,!0)}}}case`transcript_loading`:return{...e,transcriptLoading:{...e.transcriptLoading,[t.sessionId]:t.loading}};case`window_grow`:{let n=Jx(e,t.sessionId),r=Ub(n,t.total);return r===n&&e.windows[t.sessionId]!==void 0?e:{...e,windows:{...e.windows,[t.sessionId]:r}}}case`window_reveal`:{let n=Jx(e,t.sessionId),r=Wb(n,t.rendered,t.total,t.hold===!0);return r===n&&e.windows[t.sessionId]!==void 0?e:{...e,windows:{...e.windows,[t.sessionId]:r}}}case`window_trim`:{let n=Jx(e,t.sessionId),r=Gb(n,t.force===!0);return r===n&&e.windows[t.sessionId]!==void 0?e:{...e,windows:{...e.windows,[t.sessionId]:r}}}case`window_size`:{let n={};for(let[r,i]of Object.entries(e.windows))n[r]=Hb(i,t.size);return{...e,windows:n}}case`auto_routed`:{let n=oS(e,t.frame.sessionId);if(!n)return e;let r=t.frame;return Zx(e,{type:`session_upsert`,session:{...n,autoModel:{model:r.model,effort:r.effort,note:r.note,at:new Date(t.receivedAt).toISOString()}}})}case`model_boundary`:return{...e,modelBoundaries:{...e.modelBoundaries,[t.sessionId]:t.boundary}};case`providers`:return{...e,providers:t.providers,activeProviderId:t.activeProviderId};case`active_provider`:return{...e,activeProviderId:t.activeProviderId};case`agent_tools`:return{...e,agentTools:t.catalogue};case`settings`:{let n={...e,settings:t.settings};return t.settings.uiPrefs&&(n=Xx(n,Zl(t.settings.uiPrefs)),n.prefsBackend=`brain`),n}case`prefs`:return Xx(e,t.prefs);case`prefs_backend`:return{...e,prefsBackend:t.backend};case`plan`:return{...e,plan:t.plan};case`account`:return{...e,account:t.account,accountLoaded:!0,accountLink:t.account.link??e.accountLink,emailVerification:t.account.loggedIn?null:e.emailVerification};case`account_unavailable`:return e.accountLoaded?e:{...e,accountLoaded:!0};case`account_link`:return{...e,accountLink:t.link};case`email_verification`:return{...e,emailVerification:t.pending};case`recovery_key`:return{...e,recoveryKey:t.recoveryKey};case`credentials`:return{...e,credentials:t.credentials};case`claude_subscription`:return{...e,claudeSubscription:t.status};case`claude_login`:return{...e,claudeLogin:t.state};case`oauth_login`:return{...e,oauthLogin:t.state};case`oauth_login_provider`:return{...e,ui:{...e.ui,oauthLoginProviderId:t.providerId}};case`engine_download`:return{...e,engineDownload:t.state};case`import_progress`:return{...e,importProgress:t.progress};case`tool_install`:{let{[t.frame.sessionId]:n,...r}=e.toolInstalls;return{...e,toolInstalls:t.frame.phase===`done`?r:{...r,[t.frame.sessionId]:t.frame}}}case`tool_install_dismiss`:{let{[t.sessionId]:n,...r}=e.toolInstalls;return{...e,toolInstalls:r}}case`doctor`:return{...e,doctor:t.checks};case`remote_hosts`:{let n=e.remote.tabs;for(let r of t.hosts){let t=r.label||r.hostName;for(let[i,a]of Object.entries(n))a.hostId===r.hostId&&a.hostName!==t&&(n===e.remote.tabs&&(n={...n}),n[i]={...a,hostName:t})}return{...e,remote:{...e.remote,hosts:t.hosts,tabs:n,loading:!1,loaded:!0,reason:t.reason??null,stale:t.stale??!1}}}case`remote_unsupported`:return{...e,remote:{...e.remote,supported:!1,loading:!1,loaded:!0}};case`remote_loading`:return{...e,remote:{...e.remote,loading:t.loading}};case`remote_loaded`:return{...e,remote:{...e.remote,loading:!1,loaded:!0}};case`remote_sessions`:{let n={...e.remote.sessionOwners};for(let e of t.sessions)n[e.id]=t.hostId;let r={...e.remote.unreachable};return t.unreachable?r[t.hostId]=t.unreachable:delete r[t.hostId],{...e,remote:{...e.remote,sessions:{...e.remote.sessions,[t.hostId]:t.sessions},unreachable:r,sessionOwners:n}}}case`remote_tab`:{let n=e.remote.tabs[t.tab.sessionId],r=n&&n.hostId===t.tab.hostId?n.reach:void 0,i=n&&n.hostId===t.tab.hostId&&e.transcripts[t.tab.sessionId]?n.history:void 0;return{...e,remote:{...e.remote,tabs:{...e.remote.tabs,[t.tab.sessionId]:{...t.tab,...r?{reach:r}:{},...i?{history:i}:{}}},sessionOwners:{...e.remote.sessionOwners,[t.tab.sessionId]:t.tab.hostId}}}}case`remote_tab_state`:{let n=e.remote.tabs[t.sessionId];if(!n)return e;let r={...n,state:t.state,detail:t.detail,live:t.state===`attached`,...t.pairingId===void 0?{}:{pairingId:t.pairingId}};return{...e,remote:{...e.remote,tabs:{...e.remote.tabs,[t.sessionId]:r}}}}case`remote_tab_history`:{let n=e.remote.tabs[t.sessionId];if(!n||t.ifAbsent&&n.history)return e;let r={complete:!1,loading:!1,...n.history,...t.patch};return n.history&&n.history.complete===r.complete&&n.history.loading===r.loading?e:{...e,remote:{...e.remote,tabs:{...e.remote.tabs,[t.sessionId]:{...n,history:r}}}}}case`remote_tab_meta`:{let n=e.remote.tabs[t.sessionId];if(!n)return e;let r={...n,...t.features===void 0?{}:{features:t.features},...t.catalogue===void 0?{}:{catalogue:t.catalogue}};return{...e,remote:{...e.remote,tabs:{...e.remote.tabs,[t.sessionId]:r}}}}case`remote_reach`:{let n=e.remote.tabs[t.sessionId];if(!n)return e;let r=n.reach??{linked:!1,folders:[],refusals:[],asks:[]},i=t.event,a;switch(i.kind){case`state`:a={...r,linked:i.linked,folders:i.folders,refusals:i.refusals??[],asks:i.linked?r.asks:[]};break;case`ask`:a={...r,asks:r.asks.some(e=>e.requestId===i.requestId)?r.asks:[...r.asks,{requestId:i.requestId,summary:i.summary}]};break;case`ask_end`:a={...r,asks:r.asks.filter(e=>e.requestId!==i.requestId)};break;case`ended`:a={linked:!1,folders:[],refusals:[],asks:[]}}return{...e,remote:{...e.remote,tabs:{...e.remote.tabs,[t.sessionId]:{...n,reach:a}}}}}case`remote_tab_closed`:{if(!e.remote.tabs[t.sessionId])return e;let{[t.sessionId]:n,...r}=e.remote.tabs,{[t.sessionId]:i,...a}=e.transcripts,{[t.sessionId]:o,...s}=e.windows;return{...e,transcripts:a,windows:s,remote:{...e.remote,tabs:r}}}case`update_status`:return{...e,update:t.status,updateChecking:!1};case`update_checking`:return{...e,updateChecking:t.checking};case`update_event`:{let n=kx(e.updateInstall,t.event),r=n.phase===`downloading`&&e.ui.dialog===`none`?`update`:e.ui.dialog;return{...e,updateInstall:n,ui:e.ui.dialog===r?e.ui:{...e.ui,dialog:r}}}case`terminal_update`:{let n=t.terminal.running&&e.ui.dialog===`none`?`update`:e.ui.dialog;return{...e,terminalUpdate:t.terminal,ui:e.ui.dialog===n?e.ui:{...e.ui,dialog:n}}}case`update_dismissed`:return{...e,updateDismissed:t.version};case`toast`:{let n=e.toasts.filter(e=>e.id!==t.toast.id);return{...e,toasts:[...n.slice(-4),t.toast]}}case`dismiss_toast`:return{...e,toasts:e.toasts.filter(e=>e.id!==t.id)};case`sidebar`:return{...e,ui:{...e.ui,sidebarOpen:t.open}};case`projects_new`:return{...e,projectsStartNew:!0,projectsSelectId:null};case`import_offer`:return{...e,importOffered:!0};case`projects_select`:return{...e,projectsStartNew:!1,projectsSelectId:t.projectId};case`dialog`:return{...e,projectsStartNew:t.dialog===`projects`&&e.projectsStartNew,importOffered:t.dialog===`import-claude`&&e.importOffered,projectsSelectId:t.dialog===`projects`?e.projectsSelectId:null,conversationsSelectId:t.dialog===`conversations`?e.conversationsSelectId:null,ui:{...e.ui,dialog:t.dialog,claudeLoginMode:t.dialog===`claude-login`?e.ui.claudeLoginMode:null,oauthLoginProviderId:t.dialog===`oauth-login`?e.ui.oauthLoginProviderId:null,connectProviderId:t.connectProviderId??null}};case`connect_provider`:return{...e,ui:{...e.ui,connectProviderId:t.providerId}};case`claude_login_mode`:return{...e,ui:{...e.ui,claudeLoginMode:t.mode}};case`settings_section`:return{...e,ui:{...e.ui,settingsSection:t.section}};case`mcp_servers`:return{...e,mcpServers:t.servers};case`mcp_testing`:return{...e,mcpTesting:{...e.mcpTesting,[t.id]:t.testing}};case`mcp_test_result`:return{...e,mcpTestResults:{...e.mcpTestResults,[t.id]:t.result}}}}function Qx(e){return e.type===`subagent_activity`||e.type===`agent`&&re(e.message)}function $x(){return typeof document<`u`&&document.visibilityState===`hidden`}function eS(e,t){switch(e.type){case`welcome`:return[{type:`welcome`,hostName:e.hostName,hostId:e.hostId,appVersion:e.appVersion}];case`agent`:case`permission_request`:case`permission_resolved`:case`turn_started`:case`turn_finished`:case`prompt_delivered`:case`subagent_activity`:case`prompt_cancelled`:return[{type:`transcript`,sessionId:e.sessionId,action:{type:`frame`,frame:e,receivedAt:t}}];case`session_state`:return[{type:`session_upsert`,session:e.session},{type:`routing_seen`,session:e.session},{type:`transcript`,sessionId:e.session.id,action:{type:`frame`,frame:e,receivedAt:t}}];case`session_status`:return[{type:`session_status`,sessionId:e.sessionId,status:e.status}];case`auto_routed`:return[{type:`auto_routed`,frame:e,receivedAt:t}];case`conversations_changed`:return[{type:`conversations_changed`,conversationIds:e.conversationIds,sessionIds:e.sessionIds}];case`chat_about_changed`:return[{type:`chat_abouts_changed`,sessionIds:e.sessionIds,generateAll:e.generateAll}];case`next_prompt_changed`:return[{type:`next_prompts_changed`,sessionIds:e.sessionIds,review:e.review}];case`claude_login`:return[{type:`claude_login`,state:e.state}];case`engine_download`:return[{type:`engine_download`,state:e.state}];case`import_progress`:return[{type:`import_progress`,progress:e.finished?null:e}];case`tool_pack_install`:return[{type:`tool_install`,frame:e}];case`pool_notice`:{let t=e.retryAfterSec?` Retrying by itself in ${e.retryAfterSec} s.`:``;return[{type:`toast`,toast:{id:`t-pool-${e.code}`,kind:`info`,text:`${e.message}${t}`}}]}case`error`:return e.sessionId?[{type:`transcript`,sessionId:e.sessionId,action:{type:`frame`,frame:e,receivedAt:t}}]:[{type:`toast`,toast:{id:`t-${t}`,kind:`error`,text:`${e.code}: ${e.message}`}}];default:return[]}}var tS=`Removed from the chat — the model no longer remembers them`,nS=36e5,rS=1500;function iS(){return`req-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function aS(e,t,n){if(e.type===`welcome`||e.type===`conversations_changed`||e.type===`chat_about_changed`||e.type===`next_prompt_changed`)return[];let r=`sessionId`in e?e.sessionId:e.type===`session_state`?e.session.id:void 0;return typeof r==`string`&&r!==t?[]:eS(e,n)}function oS(e,t){return e.transcripts[t]?.session??e.sessions.find(e=>e.id===t)}var sS=(0,v.createContext)(null);function G(){let e=(0,v.useContext)(sS);if(!e)throw Error(`useApp must be used inside <AppProvider>`);return e}var cS=(0,v.createContext)(null);function lS({sessionId:e,groupId:t,focused:n,children:r}){let i=(0,v.useMemo)(()=>({sessionId:e,groupId:t,focused:n}),[e,t,n]);return(0,W.jsx)(cS.Provider,{value:i,children:r})}function uS(){let e=(0,v.useContext)(cS),t=(0,v.useContext)(sS);if(e)return e;let n=t?.state;return{sessionId:n?.currentSessionId??null,groupId:n?.layout.focused??`g1`,focused:!0}}function dS(){return uS().sessionId}function fS(){let{state:e}=G(),t=dS();return t?e.transcripts[t]??null:null}function pS(){let{state:e}=G(),t=dS();return t?e.transcripts[t]?.session??e.sessions.find(e=>e.id===t)??null:null}function mS(){let{state:e}=G(),t=dS();return t?e.drafts[t]??null:null}function hS(){return typeof window<`u`&&window.oonacode?`desktop`:`host`}var gS=0;function _S(e){return e.status===401&&/password|credential/i.test(e.message)}function vS(){try{return typeof window<`u`?window.localStorage:null}catch{return null}}function yS({api:e,socket:t,relay:n=null,initialSessionId:r,onUnauthorized:i,storage:a,fetchImpl:o,reportError:s,streamBatchMs:c=Kee(),windowRole:l,children:u}){let d=l??(typeof window<`u`&&window.oonacode?.window?.role===`popout`?`popout`:`main`),[f,p]=(0,v.useReducer)(Zx,d,e=>{let t=Kx();return e===`popout`?{...t,windowRole:e,ui:{...t.ui,sidebarPinnedOverride:!1,sidebarOpen:!1}}:t}),m=(0,v.useRef)(f),h=(0,v.useRef)(!1),g=f.updateInstall.phase,_=f.terminalUpdate.running;(0,v.useEffect)(()=>{_||g!==`downloading`&&g!==`installing`&&(h.current=!1)},[g,_]),m.current=f;let y=(0,v.useRef)(i);y.current=i;let b=(0,v.useRef)(s);b.current=s;let x=(0,v.useRef)(a);x.current=a===void 0?vS():a;let S=(0,v.useRef)(o);S.current=o;let C=(0,v.useRef)(null),w=(0,v.useRef)({tail:Promise.resolve(),latest:0}),T=(0,v.useRef)(new Map),E=(0,v.useRef)(new Map),D=(0,v.useRef)(new Map),O=(0,v.useRef)(new Map),k=(0,v.useRef)(new Set),A=(0,v.useRef)(new Map),j=(0,v.useRef)(new Map),M=(0,v.useRef)({inFlight:new Set,failedAt:new Map}),N=(0,v.useRef)(new Map),te=(0,v.useRef)(new Map),P=(0,v.useRef)(new Map),F=(0,v.useRef)(()=>{}),ne=(0,v.useRef)(null);ne.current===null&&(ne.current=Xb(()=>F.current())),(0,v.useEffect)(()=>()=>ne.current?.dispose(),[]);let I=(0,v.useMemo)(()=>{let r=(e,t)=>{gS+=1,p({type:`toast`,toast:{id:`toast-${gS}`,kind:e,text:t}})},i=(e,t)=>{if(e instanceof sg&&e.isUnauthorized&&!_S(e)){y.current?.();return}let n=t?`${t}: ${ov(e)}`:ov(e);r(`error`,n),b.current?.(e,{source:`action`,...t?{action:t}:{}})},a=e=>r(`error`,`This host build cannot ${e} yet — update OonaCode on this PC`),o=()=>m.current.currentSessionId,s=e=>typeof e==`string`?m.current.drafts[e]??null:null,l=e=>rte(m.current.drafts,e),u=async t=>{p({type:`sessions_loading`,loading:!0});try{let n=(t??m.current.search).trim(),r=await e.listSessions(n?{search:n,limit:200,links:!0}:{limit:200,links:!0});p({type:`sessions`,sessions:r.sessions,total:r.total,...r.links?{links:r.links}:{}})}catch(e){p({type:`sessions_error`,error:ov(e)}),i(e,`Sessions`)}},d=async()=>{try{p({type:`vault_projects`,projects:(await e.listVaultProjects()).projects})}catch{m.current.vaultProjects.length===0&&p({type:`vault_projects`,projects:[]})}},f=async()=>{try{p({type:`projects`,projects:(await e.listProjects()).projects})}catch(e){i(e,`Projects`)}await d()},g=async()=>{try{let t=await e.listProviders();t.privateModels&&Aee(t.privateModels),p({type:`providers`,providers:t.providers,activeProviderId:t.activeProviderId})}catch(e){i(e,`Providers`)}},_=async()=>{if(e.listAgentTools)try{let{catalogue:t}=await e.listAgentTools();t&&p({type:`agent_tools`,catalogue:t})}catch(e){e instanceof sg&&e.isUnauthorized&&y.current?.()}},v=async()=>{if(e.listMcpServers)try{let{servers:t}=await e.listMcpServers();p({type:`mcp_servers`,servers:t})}catch(e){e instanceof sg&&e.isUnauthorized&&y.current?.()}},k=async t=>{if(!e.createMcpServer)return null;try{let n=await e.createMcpServer(t);return r(`success`,`Added MCP server "${n.name}"`),await v(),n}catch(e){return i(e,`MCP Servers`),null}},re=async(t,n)=>{if(!e.updateMcpServer)return null;try{let r=await e.updateMcpServer(t,n);return await v(),r}catch(e){return i(e,`MCP Servers`),null}},ie=async t=>{if(!e.deleteMcpServer)return!1;try{return await e.deleteMcpServer(t),r(`success`,`MCP server removed`),await v(),!0}catch(e){return i(e,`MCP Servers`),!1}},L=async t=>{if(!e.testMcpServer)return null;p({type:`mcp_testing`,id:t,testing:!0});try{let n=await e.testMcpServer(t);return p({type:`mcp_test_result`,id:t,result:n}),n}catch(e){let n={ok:!1,durationMs:0,error:e instanceof Error?e.message:String(e)};return p({type:`mcp_test_result`,id:t,result:n}),n}finally{p({type:`mcp_testing`,id:t,testing:!1})}},R=async t=>{if(!e.testMcpConfig)return null;try{return await e.testMcpConfig(t)}catch(e){return{ok:!1,durationMs:0,error:e instanceof Error?e.message:String(e)}}},z=async(t={})=>{if(!e.listConversations)return`unsupported`;try{return(await e.listConversations(t)).conversations}catch(e){return e instanceof sg&&e.isUnauthorized&&y.current?.(),dg(e)?`unsupported`:null}},ae=async(t,n,r)=>{try{let i=await e.setActiveProvider({providerId:t,...n?{model:n}:{},...r===void 0?{}:{variantId:r}});p({type:`active_provider`,activeProviderId:i.activeProviderId}),await g()}catch(e){i(e,`Provider`)}},oe=async()=>{try{p({type:`settings`,settings:await e.getSettings()})}catch(e){i(e,`Settings`)}},se=async()=>{try{p({type:`account`,account:await e.getAccount()})}catch(e){p({type:`account_unavailable`}),i(e,`Account`)}},ce=async()=>{try{p({type:`credentials`,credentials:(await e.listCredentials()).credentials})}catch(e){if(e instanceof sg&&(e.code===`vault_locked`||e.status===423)){p({type:`credentials`,credentials:[]});return}i(e,`Credentials`)}},le=async()=>{try{p({type:`claude_subscription`,status:await e.claudeSubscriptionStatus()})}catch(e){e instanceof sg&&e.isUnauthorized&&y.current?.(),p({type:`claude_subscription`,status:null})}},ue=async t=>{try{p({type:`oauth_login`,state:await e.oauthLoginStart(t)})}catch(e){r(`error`,`Sign-in: ${ov(e)}`)}},de=async t=>{try{p({type:`oauth_login`,state:await e.oauthLoginState(t)})}catch{}},fe=async t=>{try{p({type:`oauth_login`,state:await e.oauthLoginCancel(t)})}catch(e){r(`error`,`Sign-in: ${ov(e)}`)}},pe=async()=>{try{p({type:`claude_login`,state:await e.claudeLoginState()})}catch{}},me=async()=>{try{let t=await e.claudeSubscriptionLogin();return t.login&&p({type:`claude_login`,state:t.login}),t}catch(e){return r(`error`,`Claude login: ${ov(e)}`),null}},he=async t=>{try{return p({type:`claude_login`,state:await e.claudeLoginCode({code:t})}),!0}catch(e){return r(`error`,`Claude login: ${ov(e)}`),!1}},ge=async()=>{try{p({type:`claude_login`,state:await e.claudeLoginCancel()})}catch(e){r(`error`,`Claude login: ${ov(e)}`)}},_e=async()=>{try{let t=await e.info();C.current=t,p({type:`info`,info:t})}catch(e){i(e,`Host`)}},ve=async()=>{let t=(C.current??m.current.info)?.appVersion??``;for(let n=0;n<8;n++){try{let n=await e.info();if(C.current=n,p({type:`info`,info:n}),n.appVersion!==t)return}catch{}await new Promise(e=>setTimeout(e,rS))}},ye=async()=>{if(e.plan)try{let{plan:t}=await e.plan();p({type:`plan`,plan:t})}catch{p({type:`plan`,plan:null})}};F.current=()=>void ye();let be=()=>{e.plan&&ne.current?.request()},xe=async()=>{if(!e.listHosts||!m.current.remote.supported){p({type:`remote_loaded`});return}p({type:`remote_loading`,loading:!0});try{let t=m.current.remote.unreachable,n=await e.listHosts();p({type:`remote_hosts`,hosts:n.hosts,reason:n.reason??null,stale:n.stale??!1});for(let e of n.hosts)!e.isSelf&&e.online&&t[e.hostId]&&Se(e.hostId)}catch(e){dg(e)?p({type:`remote_unsupported`}):(p({type:`remote_loaded`}),e instanceof sg&&e.isUnauthorized&&y.current?.())}},Se=async t=>{if(!e.listHostSessions)return null;try{let n=await e.listHostSessions(t);return p({type:`remote_sessions`,hostId:t,sessions:n.sessions,unreachable:n.reason?{reason:n.reason,detail:n.detail??null}:null}),n.sessions}catch(e){return dg(e)?p({type:`remote_unsupported`}):i(e,`Remote sessions`),null}},Ce=async e=>{await Se(e)},we=e=>{let t=m.current;if(t.drafts[e]||t.remote.tabs[e]||A.current.has(e))return null;let n=t.remote.sessionOwners[e]??t.prefs.remoteTabs[e];if(!n)return null;let r=t.remote.hosts.find(e=>e.hostId===n);return r&&!r.isSelf?n:null},Ee=e=>{if(e!==null){let t=typeof window<`u`?window.oonacode:void 0,n=m.current;if(n.elsewhere[e]&&!n.tabs.ids.includes(e)&&t?.focusChatElsewhere){t.focusChatElsewhere(e).then(t=>{t||p({type:`select_session`,id:e})},()=>p({type:`select_session`,id:e}));return}let r=we(e);if(r!==null){Ie(r,e);return}}p({type:`select_session`,id:e})},De=e=>e?m.current.remote.tabs[e]??null:null,Oe=(e,t)=>A.current.get(e)?.send(t)??!1,ke=e=>{let t=De(e);r(`error`,`${t?.hostName??`That PC`} is offline — this transcript is read-only until it comes back.`)},Ae=async(e,t,i)=>{let a=i??``,o=a.trim()===``?null:a.trim(),s=m.current,c=s.transcripts[t]?.session??s.sessions.find(e=>e.id===t)??(s.remote.sessions[e]??[]).find(e=>e.id===t);if(De(t)){if(!Oe(t,{type:`set_title`,sessionId:t,title:a})){ke(t);return}c&&p({type:`session_upsert`,session:{...c,title:o}});return}if(!n){r(`error`,`This window cannot bridge to other PCs yet.`);return}c&&p({type:`session_upsert`,session:{...c,title:o}}),await new Promise(i=>{let o=!1,s=!1,c=()=>{o||(o=!0,clearTimeout(l),u.detach(),i())},l=setTimeout(c,5e3),u=n.attach({hostId:e,sessionId:t,onFrame:e=>{e.type===`session_state`&&e.session.id===t?(p({type:`session_upsert`,session:e.session}),c()):e.type===`error`&&(r(`error`,`Rename: ${e.message}`),c())},onState:i=>{if(i.state===`attached`&&!s)s=!0,n.send(i.pairingId,{type:`set_title`,sessionId:t,title:a}),setTimeout(c,800);else if(i.state===`host_offline`||i.state===`error`||i.state===`unavailable`){if(s)return;let t=m.current.remote.hosts.find(t=>t.hostId===e),n=t?.label||t?.hostName||e;r(`error`,`Rename: ${n} is offline or unreachable.`),c()}}})})},je=async(t,n)=>{let r=e.listHostSessionEntries;if(!r)return null;p({type:`transcript_loading`,sessionId:n,loading:!0});try{let e=m.current.transcripts[n]?.lastSeq??0;if(e>0){let i=[],a=e,o=!1;for(let e=0;e<5;e++){let e=await r(t,n,{afterSeq:a,limit:500-i.length});if(e.readOnly){o=!1;break}if(i.push(...e.entries),o=e.entries.length>0&&e.nextSeq!==null&&e.nextSeq>a,!o||i.length>=500)break;a=e.nextSeq}if(!o)return i.length>0&&p({type:`transcript`,sessionId:n,action:{type:`entries`,entries:i}}),i.reduce((e,t)=>t.seq>e?t.seq:e,e);Me(n)}return await Ne(r,t,n)}catch(e){e instanceof sg&&e.isUnauthorized?y.current?.():dg(e)||i(e,`Remote history`);let t=m.current.transcripts[n]?.lastSeq??0;return t>0?t:null}finally{p({type:`transcript_loading`,sessionId:n,loading:!1}),p({type:`remote_tab_history`,sessionId:n,patch:{complete:!1,loading:!1},ifAbsent:!0})}},Me=e=>{let t=m.current.transcripts[e],n=N.current;n.set(e,(n.get(e)??0)+1),p({type:`transcript`,sessionId:e,action:{type:`reset`}}),t?.session&&p({type:`transcript`,sessionId:e,action:{type:`session`,session:t.session}})},Ne=async(e,t,n)=>{let r=await e(t,n,{limit:500,tail:1});if(r.readOnly||r.prevSeq===void 0&&r.nextSeq!==null)return null;let i=r.entries.slice(-500),a=i.length<r.entries.length?i[0]?.seq??null:r.prevSeq??null,o=1;for(;i.length<120&&a!==null&&o<5;){let r=500-i.length,s=await e(t,n,{limit:r,beforeSeq:a});if(s.readOnly||s.entries.length===0)break;let c=s.entries.filter(e=>e.seq<a).slice(-r);if(c.length===0)break;i=[...c,...i];let l=c.length<s.entries.length?c[0]?.seq??null:s.prevSeq??null;if(l!==null&&l>=a)break;a=l,o+=1}return p({type:`remote_tab_history`,sessionId:n,patch:{complete:a===null,loading:!1}}),i.length===0?0:(p({type:`transcript_page`,sessionId:n,entries:i}),i.reduce((e,t)=>t.seq>e?t.seq:e,0))},Pe=async(t,n)=>{let a=m.current.remote.tabs[t],o=e.listHostSessionEntries,s=M.current;if(!a||!o||!a.history||a.history.complete||s.inFlight.has(t)||Date.now()-(s.failedAt.get(t)??0)<5e3)return;let c=h_(m.current.transcripts[t]);if(c===null)return;let l=c;s.inFlight.add(t),p({type:`remote_tab_history`,sessionId:t,patch:{loading:!0}});let u=N.current.get(t)??0,d;try{for(let e=0;e<=3;e++){let e=await o(a.hostId,t,{beforeSeq:l,limit:500});if(e.readOnly){s.failedAt.set(t,Date.now()),r(`error`,`${a.hostName} is not answering — earlier messages can be read once it is.`);return}if(!m.current.remote.tabs[t]||(N.current.get(t)??0)!==u)return;let i=l,c=e.entries.filter(e=>e.seq<i).slice(-500),f=!1;if(c.length>0){let e=m.current.transcripts[t];f=!e||m_(e,c).items.length>e.items.length,f&&n?.(),p({type:`transcript_prepend`,sessionId:t,entries:c}),l=c.reduce((e,t)=>t.seq<e?t.seq:e,l)}if(d=c.length===0||e.prevSeq===null||e.prevSeq===void 0,s.failedAt.delete(t),f||d)break}}catch(e){s.failedAt.set(t,Date.now()),e instanceof sg&&e.isUnauthorized?y.current?.():dg(e)||i(e,`Earlier messages`)}finally{s.inFlight.delete(t),p({type:`remote_tab_history`,sessionId:t,patch:d===void 0?{loading:!1}:{loading:!1,complete:d}})}},Fe=e=>{j.current.get(e)?.dispose(),j.current.delete(e);let t=A.current.get(e);t&&(A.current.delete(e),t.detach(),p({type:`remote_tab_closed`,sessionId:e}))},Ie=async(e,t,i={})=>{let a=m.current;if(!i.draft&&A.current.has(t)){i.focus!==!1&&p({type:`select_session`,id:t});return}let o=a.remote.hosts.find(t=>t.hostId===e)??null,s=o?.label||o?.hostName||e,l=(a.remote.sessions[e]??[]).find(e=>e.id===t);i.draft?a.remote.sessions[e]===void 0&&Se(e):l?p({type:`session_upsert`,session:l}):(async()=>{let n=(await Se(e))?.find(e=>e.id===t);n&&p({type:`session_upsert`,session:n})})(),p({type:`remote_tab`,tab:{sessionId:t,hostId:e,hostName:s,pairingId:null,state:`unavailable`,detail:null,live:!1}}),i.focus!==!1&&p({type:`select_session`,id:t});let u=Promise.resolve(0),d=!0,f=0,h=0,g=()=>{d=!1;let n=je(e,t).then(e=>(n===u&&(d=!0,f=e),e!==null&&e>h&&(h=e),e));return u=n,n};if(i.draft||g(),!n){p({type:`remote_tab_state`,sessionId:t,state:`unavailable`,detail:`This window cannot bridge to other PCs yet.`});return}A.current.get(t)?.detach(),j.current.get(t)?.dispose();let _=fg({isStreamFrame:Qx,deliver:e=>{for(let t of e)x(t)},batchMs:c,isHidden:$x});j.current.set(t,_);let v=e=>{let n=Date.now();if(e.type===`transcript_changed`){if(e.sessionId!==t)return;for(let[e,n]of P.current)n===t&&(P.current.delete(e),r(`success`,tS));Ve(t);return}if(e.type===`error`&&e.requestId!==void 0&&P.current.get(e.requestId)===t){P.current.delete(e.requestId),r(`error`,e.message);return}if(e.type===`welcome`){let n=e.features??[];p({type:`remote_tab_meta`,sessionId:t,features:n}),n.includes(ze.toolPacks)&&Oe(t,{type:`list_tool_packs`,requestId:iS()})}else e.type===`tool_packs`&&p({type:`remote_tab_meta`,sessionId:t,catalogue:e.catalogue});let i=e.type===`session_state`?oS(m.current,e.session.id):void 0;for(let r of aS(e,t,n))p(r);e.type===`session_state`&&m.current.drafts[e.session.id]&&p({type:`draft_materialized`,id:e.session.id}),e.type===`session_state`&&rx(i,e.session)&&be()},y=null,b=()=>{let e=y;if(y=null,!e)return;let t=new Set,n=500;for(let r=e.length-1;r>=0;r--){let i=e[r];i.type===`agent`&&i.seq!==null&&(n>0?--n:t.add(i))}for(let n of e)t.has(n)||v(n)},x=e=>{if(e.type===`error`&&e.code===`replay_windowed`){(m.current.transcripts[t]?.lastSeq??0)>0&&Me(t),p({type:`remote_tab_history`,sessionId:t,patch:{complete:!1}}),y||=[];return}if(y){y.push(e),(e.type===`session_state`||e.type===`error`)&&b();return}v(e)},S=0,C=(e,r,a)=>{if(r!==S||A.current.get(t)?.pairingId!==e)return;let o=r=>{n.send(e,{type:`subscribe`,sessionId:t,...r===void 0?{}:{afterSeq:r}})};if(!d){o(),u.then(()=>C(e,r,a));return}let s=Math.max(h,m.current.transcripts[t]?.lastSeq??0);if(i.draft||s>0){o(s);return}if(f===0){o(0);return}if(!a){g(),C(e,r,!0);return}y=[],o(0)},w=n.attach({hostId:e,sessionId:t,onFrame:e=>_.push(e),onReach:e=>p({type:`remote_reach`,sessionId:t,event:e}),onState:e=>{if(p({type:`remote_tab_state`,sessionId:t,state:e.state,detail:e.detail,pairingId:e.pairingId}),S+=1,e.state!==`attached`&&b(),e.state===`host_offline`&&e.detail===`backpressure`){i.draft||g();return}e.state===`attached`&&C(e.pairingId,S,!1)}});A.current.set(t,w),p({type:`remote_tab_state`,sessionId:t,state:`unavailable`,detail:null,pairingId:w.pairingId})},Le=async t=>{let n=mte(m.current.prefs,t);if(m.current={...m.current,prefs:n},p({type:`prefs`,prefs:n}),t.transcriptWindowSize!==void 0&&p({type:`window_size`,size:n.transcriptWindowSize}),m.current.prefsBackend===`local`){vv(x.current,n);return}let r=w.current,i=++r.latest,a=r.tail.then(async()=>{if(i===r.latest)try{let t=await e.updateSettings({uiPrefs:n});i===r.latest&&p({type:`settings`,settings:t}),t.uiPrefs?p({type:`prefs_backend`,backend:`brain`}):vv(x.current,n)}catch(e){if(hte(e)){p({type:`prefs_backend`,backend:`local`}),vv(x.current,n);return}e instanceof sg&&e.isUnauthorized?y.current?.():vv(x.current,n)}});r.tail=a.catch(()=>void 0),await a},Be=(e,t,n)=>{let r=m.current.prefs.pinned;Yl(r,e,t)!==n&&Le({pinned:Xl(r,e,t,n)})},B=async t=>{let[n,r]=await Promise.all([e.getSession(t),e.listMessages(t)]);p({type:`session_upsert`,session:n}),p({type:`transcript`,sessionId:t,action:{type:`hydrate`,messages:r.messages,session:n,contextTokens:r.contextTokens??null}})},Ve=e=>{let t=te.current.get(e);if(t)return t;let n=(async()=>{let t=De(e);if(t){Me(e),await je(t.hostId,e);return}if(m.current.transcripts[e]){p({type:`transcript`,sessionId:e,action:{type:`reset`}}),p({type:`transcript_loading`,sessionId:e,loading:!0});try{await B(e)}catch(e){e instanceof sg&&e.isUnauthorized?y.current?.():r(`error`,`Could not load session: ${ov(e)}`)}finally{p({type:`transcript_loading`,sessionId:e,loading:!1})}}})().finally(()=>{te.current.get(e)===n&&te.current.delete(e)});return te.current.set(e,n),n},He=e=>{p({type:`session_upsert`,session:e}),Ee(e.id),f()},Ue=async t=>{try{let n=await e.createSession(t);return He(n),n}catch(e){return i(e,`New session`),null}},We=(e={})=>{let t=sv(lv()),n=e.projectId?m.current.vaultProjects.find(t=>t.id===e.projectId):void 0;p({type:`draft_open`,draft:cv({...t,...e.projectId?{projectId:e.projectId}:{}},n?.chatDefaults)})},Ge=async e=>{let t=m.current.remote.hosts.find(t=>t.hostId===e)??null,n=t?.label||t?.hostName||`That PC`;if(t&&!t.online){r(`error`,`${n} is offline — a new chat has to start on a PC that is awake.`);return}let i=sv(lv());p({type:`draft_open`,draft:i}),await Ie(e,i.id,{draft:!0})},Ke=e=>{let t=m.current;return pb({drafts:t.drafts,remoteTabs:t.remote.tabs,unsent:t.unsent,files:t.files},e,ub(e))},qe=e=>{Fe(e),p({type:`close_tab`,id:e})},V=async(e,t)=>{let n=m.current,r=e.draft!==void 0&&!n.sessions.some(t=>t.id===e.id);r&&!n.drafts[e.id]&&p({type:`draft_open`,draft:gb(e)}),e.kind===`remote`&&e.hostId?Ie(e.hostId,e.id,{focus:!0,draft:r}):r||p({type:`select_session`,id:e.id}),e.unsentText&&p({type:`unsent`,sessionId:e.id,message:{text:e.unsentText,attachments:[]},onlyIfEmpty:!0});for(let t of e.files?.open??[])p({type:`file_open`,sessionId:e.id,path:t});e.files&&e.files.open.length>0&&(e.files.active?p({type:`file_activate`,sessionId:e.id,path:e.files.active}):p({type:`file_show_chat`,sessionId:e.id})),t&&p({type:`layout_drop`,tabId:e.id,target:t})},Je=async n=>{let r=m.current,i=Sm(r.providers,{providerId:n.providerId??r.activeProviderId,model:n.model??r.info?.activeModel??null,variantId:n.variantId}),a={sessionId:n.id,...n.projectDir?{cwd:n.projectDir}:{},...n.projectId?{projectId:n.projectId}:{},...n.title?{title:n.title}:{},...i.providerId?{providerId:i.providerId}:{},...i.variantId?{variantId:i.variantId}:{},...i.modelId?{model:i.modelId}:{},permissionMode:n.permissionMode??`default`,...n.posture?{posture:n.posture}:{},...n.effort&&Te(n.effort)?{effort:n.effort}:{},...lm(n.toolPacks),...gte(n.media),...n.mcpSwitches?{mcpSwitches:n.mcpSwitches}:{},...Ah(n.modelSkills),...n.customModel&&i.modelId===n.model?{customModel:!0}:{},...ng(i.providerId,i.modelId)?{autoModel:!0}:{}},o;try{o=await e.createSession(a)}catch(t){let r=await e.getSession(n.id).catch(()=>null);if(!r)throw t;o=r}return p({type:`session_upsert`,session:o}),p({type:`draft_materialized`,id:n.id}),t.subscribe(o.id),f(),o},Ye=async()=>e.scanClaudeSessions(),Xe=async(t,n)=>{if(!e.searchImportChats)return null;try{return await e.searchImportChats(t,n)}catch{return null}},Ze=async(t,n)=>{let r=await e.importClaudeSessions({...t&&t.length>0?{ids:t}:{},...n?{overwrite:!0}:{}});return r.imported.length>0&&(await u(),f()),r},Qe=async t=>{if(!e.sessionLink)return null;try{let{link:n}=await e.sessionLink(t);return p({type:`session_link`,sessionId:t,link:n}),n}catch{return p({type:`session_link`,sessionId:t,link:null}),null}},$e=async t=>{if(!e.syncSessionDown)return null;try{let n=await e.syncSessionDown(t);return p({type:`session_link`,sessionId:t,link:n.link}),n.added>0&&(await u(),m.current.tabs.ids.includes(t)&&await B(t)),n}catch(e){return i(e,`Sync`),null}},et=async(e=!1)=>{let t=m.current,n=t.account?.gatewayUrl??t.settings?.gatewayUrl??null,i=typeof window<`u`?window.oonacode:void 0,a=t.info?.platform??i?.platform??null,o=a?{platform:a,arch:t.info?.arch??null}:null,s=wx(n,Tx({bridge:i,info:t.info}),o),c=e&&i?.checkForUpdates?i.checkForUpdates():null;if(c&&c.catch(()=>void 0),!s){e&&!c&&r(`info`,`Sign in to OonaCode to check for updates`);return}p({type:`update_checking`,checking:!0});try{let a=i?.fetchLatestRelease?await i.fetchLatestRelease(n):await(async()=>{let e=await(S.current??(e=>fetch(e,{credentials:`omit`})))(s);if(!e.ok)throw Error(`release feed returned ${e.status}`);return e.json()})(),o=C.current??t.info,c=Cx(Sx(a),{desktop:i?.appVersion??null,host:o?.appVersion??t.connection.appVersion??null,cli:o?.cliVersion??null,engine:o?.engine.version??null},o?.platform??i?.platform??null);p({type:`update_status`,status:c}),e&&r(c.available?`info`:`success`,c.available?`OonaCode ${c.version} is available (${c.components.length} component${c.components.length===1?``:`s`})`:`Everything is up to date`)}catch(t){p({type:`update_checking`,checking:!1}),e&&r(`error`,`Update check failed: ${ov(t)}`)}};return{refreshInfo:_e,refreshSessions:u,scanClaudeSessions:Ye,importClaudeSessions:Ze,searchImportChats:Xe,refreshSessionLink:Qe,syncSessionDown:$e,refreshProjects:f,refreshProviders:g,refreshAgentTools:_,refreshMcpServers:v,createMcpServer:k,updateMcpServer:re,deleteMcpServer:ie,testMcpServer:L,testMcpConfig:R,refreshSettings:oe,refreshAccount:se,refreshCredentials:ce,refreshClaudeSubscription:le,startClaudeLogin:me,submitClaudeLoginCode:he,cancelClaudeLogin:ge,refreshClaudeLogin:pe,startOauthLogin:ue,refreshOauthLogin:de,cancelOauthLogin:fe,refreshHosts:xe,refreshPlan:ye,refreshPlanSoon:be,refreshHostSessions:Ce,openRemoteSession:Ie,loadOlderRemote:Pe,newRemoteTab:Ge,async renameHost(t,n){if(!e.updateHost){r(`error`,`This host build cannot rename devices yet`);return}try{let i=await e.updateHost(t,{label:n});p({type:`remote_hosts`,hosts:m.current.remote.hosts.map(e=>e.hostId===t?i:e),reason:m.current.remote.reason,stale:m.current.remote.stale}),r(`success`,`Device renamed`)}catch(e){dg(e)?p({type:`remote_unsupported`}):i(e,`Rename device`)}},async runDoctor(){p({type:`doctor`,checks:null});try{p({type:`doctor`,checks:(await e.doctor()).checks})}catch(e){i(e,`Doctor`)}},setSearch(e){p({type:`search`,value:e})},selectSession:Ee,closeTab(e){Fe(e),p({type:`close_tab`,id:e})},rememberUnsent(e,t,n){p({type:`unsent`,sessionId:e,message:t,onlyIfEmpty:n})},quoteIntoComposer(e,t,n){p({type:`composer_quote`,sessionId:e,text:t,preview:n?.preview??xd(t.replace(/^> ?/gm,``)),itemId:n?.itemId??null})},jumpToItem(e,t){p({type:`jump_to`,sessionId:e,itemId:t})},async searchTranscripts(t){if(!e.searchEntries)return null;try{return await e.searchEntries(t)}catch{return null}},openChatWithSearch(e,t){Ee(e),p({type:`chat_search_request`,sessionId:e,query:t})},moveTab(e,t,n){p({type:`move_tab`,from:e,to:t,...n?{groupId:n}:{}})},cycleTab(e){p({type:`cycle_tab`,delta:e})},focusGroup(e){let t=m.current.layout;t.focused===e||!t.groups[e]||p({type:`layout_focus`,groupId:e})},focusGroupAt(e){p({type:`layout_focus_index`,index:e})},dropTab(e,t){p({type:`layout_drop`,tabId:e,target:t})},splitTab(e,t){let n=m.current.layout,r=t??n.groups[n.focused]?.activeId??null,i=r?iy(n,r):null;if(r&&i&&(n.groups[i]?.ids.length??0)>1){p({type:`layout_drop`,tabId:r,target:{groupId:i,zone:e}});return}let a=sv(lv());p({type:`draft_open`,draft:a}),p({type:`layout_drop`,tabId:a.id,target:{groupId:i??n.focused,zone:e}})},moveTabToOtherGroup(e){let t=m.current.layout,n=iy(t,e),r=n?ly(t,n):null;r&&p({type:`layout_drop`,tabId:e,target:{groupId:r,zone:`center`}})},resizeSplit(e,t){p({type:`layout_resize`,path:e,sizes:t})},equalizeSplit(e){p({type:`layout_equalize`,path:e})},async moveTabToNewWindow(e,t){let n=typeof window<`u`?window.oonacode:void 0;if(!n?.openTabsInNewWindow||!m.current.tabs.ids.includes(e))return!1;let i=Ke(e),a=null;try{a=await n.openTabsInNewWindow({tabs:[i],screenX:t?.x??null,screenY:t?.y??null})}catch{a=null}return a?(qe(e),!0):(r(`error`,`OonaCode could not open a new window for this chat`),!1)},async moveTabToMainWindow(e){let t=typeof window<`u`?window.oonacode:void 0;if(!t?.moveTabsToMainWindow||m.current.windowRole!==`popout`||!m.current.tabs.ids.includes(e))return!1;let n=!1;try{n=await t.moveTabsToMainWindow([Ke(e)])}catch{n=!1}return n?qe(e):r(`error`,`The main OonaCode window could not take this chat`),n},adoptTab:V,async tabDraggedOut(e,t){let n=typeof window<`u`?window.oonacode:void 0;if(!(!n?.tabDragEnded||!m.current.tabs.ids.includes(e)))try{(await n.tabDragEnded({tab:Ke(e),...t})).outcome===`moved`&&qe(e)}catch{}},toggleSidebarPinned(){let e=m.current;if(!e.prefs.leftPanelOpen){let t=Nb(e.prefs.leftPanelSection,!0);e.windowRole===`popout`?(p({type:`sidebar_pinned_override`,pinned:!0}),Le(t)):Le({...t,sidebarPinned:!0});return}if(e.windowRole===`popout`){let t=e.ui.sidebarPinnedOverride??e.prefs.sidebarPinned;p({type:`sidebar_pinned_override`,pinned:!t});return}Le({sidebarPinned:!e.prefs.sidebarPinned})},newTab:We,createSession:Ue,reportDiagnostic(e,t){b.current?.(Error(e),{source:`diagnostic`,...t})},async deleteSession(n){if(l(n)){p({type:`close_tab`,id:n});return}try{await e.deleteSession(n),t.unsubscribe(n),p({type:`session_removed`,id:n}),Be(`chat`,n,!1)}catch(e){i(e,`Delete`)}},async deleteRemoteSession(n,r){try{if(!e.deleteHostSession)throw Error(`this PC is running an older OonaCode that cannot delete a chat on another device`);await e.deleteHostSession(n,r),t.unsubscribe(r),p({type:`session_removed`,id:r})}catch(e){i(e,`Delete`)}},async renameRemoteSession(e,t,n){await Ae(e,t,dv(n))},async renameSession(t,n){let r=De(t)?.hostId??m.current.remote.sessionOwners[t]??m.current.prefs.remoteTabs[t]??null;if(r){await Ae(r,t,dv(n));return}try{p({type:`session_upsert`,session:await e.updateSession(t,{title:n})})}catch(e){i(e,`Rename`)}},refreshVaultProjects:d,async createVaultProject(t){try{let n=await e.createVaultProject(t);return await d(),n}catch(e){return i(e,`Project`),null}},async updateVaultProject(t,n){try{let r=await e.updateVaultProject(t,n);return await d(),r}catch(e){return i(e,`Project`),null}},async listScheduledTasks(t){if(!e.listScheduledTasks)return[];try{return(await e.listScheduledTasks(t)).tasks}catch{return[]}},async updateScheduledTask(t,n){if(!e.updateScheduledTask)return!1;try{return await e.updateScheduledTask(t,n),!0}catch(e){return i(e,`Scheduled task`),!1}},async githubLink(t){let n=t===`get`?e.getGithubLink:t===`start`?e.startGithubLink:t===`cancel`?e.cancelGithubLink:e.unlinkGithub;if(!n)return null;try{return await n.call(e)}catch(e){return t!==`get`&&i(e,`GitHub`),null}},async deleteScheduledTask(t){if(!e.deleteScheduledTask)return!1;try{return await e.deleteScheduledTask(t),!0}catch(e){return i(e,`Scheduled task`),!1}},listConversations:e=>z(e),async refreshChatConversations(e){if(l(e)||m.current.remote.tabs[e])return;let t=await z({sessionId:e});Array.isArray(t)&&p({type:`chat_conversations`,sessionId:e,conversations:t})},async conversationHistory(t){if(!e.getConversation)return null;try{return await e.getConversation(t)}catch(e){return e instanceof sg&&e.isUnauthorized&&y.current?.(),null}},async conversationAction(t,n,r){if(!e.conversationAction)return a(`manage conversations`),null;try{return(await e.conversationAction(t,n,r)).conversation}catch(e){return i(e,`Conversation`),null}},async stopAllConversations(){if(!e.stopAllConversations)return a(`stop conversations`),null;try{let t=await e.stopAllConversations();return r(`success`,t.paused===0&&t.interrupted===0?`No conversation was running.`:`Paused ${t.paused} conversation${t.paused===1?``:`s`}`+(t.interrupted>0?` and stopped ${t.interrupted} running turn${t.interrupted===1?``:`s`}.`:`.`)),t}catch(e){return i(e,`Stop all conversations`),null}},async cancelChatMessage(t){if(!e.cancelChatMessage)return a(`withdraw messages between chats`),!1;try{let{cancelled:n}=await e.cancelChatMessage(t);return n||r(`info`,`That message was already delivered, so it stays.`),n}catch(e){return i(e,`Withdraw message`),!1}},openConversations(e){p({type:`conversations_select`,conversationId:e??null}),p({type:`dialog`,dialog:`conversations`})},async listChatAbouts(){if(!e.listChatAbouts)return`unsupported`;try{return await e.listChatAbouts()}catch(e){return e instanceof sg&&e.isUnauthorized&&y.current?.(),dg(e)?`unsupported`:null}},async listCommands(t){if(m.current.remote.tabs[t])return`unsupported`;let n=s(t);try{return n?e.listCommands?await e.listCommands(n.projectDir?{cwd:n.projectDir}:{}):`unsupported`:e.listSessionCommands?await e.listSessionCommands(t):`unsupported`}catch(e){return e instanceof sg&&e.isUnauthorized&&y.current?.(),dg(e)?`unsupported`:null}},async listSkills(){if(!e.listSkills)return`unsupported`;try{return await e.listSkills()}catch(e){return e instanceof sg&&e.isUnauthorized&&y.current?.(),dg(e)?`unsupported`:null}},async removeSkill(t){if(!e.deleteSkill)return a(`remove a skill`),!1;try{return(await e.deleteSkill(t)).removed}catch(e){return i(e,`Remove skill`),!1}},async scanClaudeSkills(){if(!e.scanClaudeSkills)return a(`import skills`),null;try{return await e.scanClaudeSkills()}catch(e){return i(e,`Skills in Claude Code`),null}},async importClaudeSkills(t,n){if(!e.importClaudeSkills)return a(`import skills`),null;try{return await e.importClaudeSkills({keys:t,...n?{overwrite:!0}:{}})}catch(e){return i(e,`Import skills`),null}},async getChatAbout(t){if(l(t)||m.current.remote.tabs[t]||!e.getChatAbout)return`unsupported`;try{return await e.getChatAbout(t)}catch(e){return e instanceof sg&&e.isUnauthorized&&y.current?.(),dg(e)?`unsupported`:null}},async updateChatAbout(t,n){if(!e.updateChatAbout)return a(`edit a chat’s about`),null;let r=n?.trim()??``;try{return await e.updateChatAbout(t,{about:r===``?null:r})}catch(e){return i(e,`About`),null}},async regenerateChatAbout(t){if(!e.regenerateChatAbout)return{ok:!1,error:`OonaCode on this PC is too old to write abouts. Update it first.`,about:null};try{let n=await e.regenerateChatAbout(t);return{ok:n.ok,error:n.ok?null:n.error??`The about could not be written.`,about:n.about}}catch(e){return e instanceof sg&&e.isUnauthorized&&y.current?.(),{ok:!1,error:ov(e),about:null}}},async generateAllChatAbouts(){if(!e.generateAllChatAbouts)return a(`write abouts for every chat`),null;try{return await e.generateAllChatAbouts()}catch(e){return i(e,`Generate for all chats`),null}},async stopGenerateAllChatAbouts(){if(!e.stopGenerateAllChatAbouts)return a(`stop writing abouts`),null;try{return await e.stopGenerateAllChatAbouts()}catch(e){return i(e,`Stop generating abouts`),null}},openChatAbouts(){p({type:`dialog`,dialog:`chat-abouts`})},async listNextPrompts(){if(!e.listNextPrompts)return`unsupported`;try{return await e.listNextPrompts()}catch(e){return e instanceof sg&&e.isUnauthorized&&y.current?.(),dg(e)?`unsupported`:null}},async getNextPrompt(t){if(!e.getNextPrompt||m.current.remote.tabs[t])return`unsupported`;try{return await e.getNextPrompt(t)}catch(e){return e instanceof sg&&e.isUnauthorized&&y.current?.(),dg(e)?`unsupported`:null}},async suggestNextPrompt(t,n){let r={error:`OonaCode on this PC is too old for Suggest. Update it, then try again.`};if(!e.suggestNextPrompt)return r;try{return await e.suggestNextPrompt(t,n)}catch(e){return e instanceof sg&&e.isUnauthorized&&y.current?.(),dg(e)?r:{error:ov(e)}}},async reviewNextPrompts(t,n){if(!e.reviewNextPrompts)return r(`error`,`OonaCode on this PC is too old for the project manager — update it`),null;try{return(await e.reviewNextPrompts({sessionIds:t,...n===void 0?{}:{windowHours:n}})).review}catch(e){return i(e,`Review chats`),null}},async stopNextPromptReview(){if(!e.stopNextPromptReview)return null;try{return(await e.stopNextPromptReview()).review}catch(e){return i(e,`Stop the review`),null}},async markNextPromptSent(t,n,r){if(!e.markNextPromptSent)return!1;try{return await e.markNextPromptSent(t,{suggestionId:n,text:r}),!0}catch{return!1}},async sendToChat(t,n){let r=m.current;if(r.tabs.ids.includes(t)||r.remote.tabs[t])return this.sendPrompt(n,[],void 0,t);try{return await e.prompt(t,{text:n}),!0}catch(e){return i(e,`Send`),!1}},openProjectManager(){p({type:`dialog`,dialog:`project-manager`})},offerImport(){p({type:`import_offer`}),p({type:`dialog`,dialog:`import-claude`})},async deleteVaultProject(t){try{await e.deleteVaultProject(t),Be(`project`,t,!1);let n=m.current.page;return n?.kind===`project`&&n.projectId===t&&p({type:`page`,page:{kind:`projects`}}),await d(),await u(),!0}catch(e){return i(e,`Project`),!1}},async setSessionProject(t,n){if(l(t)){let e=m.current.drafts[t],r=n?m.current.vaultProjects.find(e=>e.id===n):void 0,i=e?cv({...e,projectId:n},r?.chatDefaults):null;return p({type:`draft_patch`,id:t,patch:i?{projectId:n,model:i.model,providerId:i.providerId,variantId:i.variantId,projectDir:i.projectDir,effort:i.effort??null}:{projectId:n}}),!0}let r=De(t)?.hostId??m.current.remote.sessionOwners[t]??m.current.prefs.remoteTabs[t]??null;try{let i=r&&e.updateHostSession?await e.updateHostSession(r,t,{projectId:n}):await e.updateSession(t,{projectId:n});return p({type:`session_upsert`,session:i}),!0}catch(e){return i(e,`Project`),!1}},openNewProject(){p({type:`projects_new`}),p({type:`dialog`,dialog:`projects`})},openProjectSettings(e){p({type:`projects_select`,projectId:e}),p({type:`dialog`,dialog:`projects`})},openPage(e){p({type:`page`,page:e})},closePage(){p({type:`page`,page:null})},setPinned:Be,openVoiceSummary(e){p({type:`voice_summary_dialog`,sessionId:e})},openAssignProject(e){p({type:`assign_project_dialog`,sessionId:e})},renameTab(t,n){let r=dv(n);if(l(t)){p({type:`draft_patch`,id:t,patch:{title:r}}),De(t)&&Oe(t,{type:`set_title`,sessionId:t,title:r??``});return}let a=De(t)?.hostId??m.current.remote.sessionOwners[t]??m.current.prefs.remoteTabs[t]??null;if(a){Ae(a,t,r);return}(async()=>{try{p({type:`session_upsert`,session:await e.updateSession(t,{title:r??``})})}catch(e){i(e,`Rename`)}})()},async forkSession(t){if(l(t)){let e=De(t)?.hostId;e?await Ge(e):We();return}let n=De(t)?.hostId??m.current.remote.sessionOwners[t]??m.current.prefs.remoteTabs[t]??null;try{if(n&&e.forkHostSession){let r=await e.forkHostSession(n,t);p({type:`session_upsert`,session:r}),await Ie(n,r.id);return}let r=await e.forkSession(t,{});p({type:`session_upsert`,session:r}),Ee(r.id)}catch(e){i(e,`Fork`)}},async removeEntries(t,n,a){if(l(t))return!1;let o=De(t);if(o){if(!o.features?.includes(ze.removeEntries))return r(`error`,`${o.hostName} needs updating before messages can be removed from its chats`),!1;let e=iS();return P.current.set(e,t),Oe(t,{type:`remove_entries`,sessionId:t,uuid:n,mode:a,requestId:e})?!0:(P.current.delete(e),ke(t),!1)}try{await e.removeEntries(t,{uuid:n,mode:a})}catch(e){return e instanceof sg&&[`chat_busy`,`not_found`,`bad_request`].includes(e.code)?(r(`error`,ov(e)),e.code===`not_found`&&Ve(t)):i(e,`Remove messages`),!1}return r(`success`,tS),await Ve(t),!0},reloadTranscript:Ve,async sendPrompt(n,r=[],a,c){let l=c??o();if(!l)return!1;let u=`req-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`,d=(e,t)=>(p({type:`transcript`,sessionId:l,action:{type:`frame`,frame:{type:`error`,sessionId:l,requestId:u,code:e,message:t}}}),p({type:`transcript`,sessionId:l,action:{type:`local_prompt_failed`,requestId:u}}),!1);p({type:`transcript`,sessionId:l,action:{type:`local_prompt`,requestId:u,text:n,attachments:r,at:new Date().toISOString()}}),p({type:`window_trim`,sessionId:l,force:!0});let f=s(l);if(f!==null&&De(l)!==null&&f){f.model&&Oe(l,{type:`set_model`,sessionId:l,model:f.model,...f.providerId?{providerId:f.providerId}:{},...f.variantId===null?{}:{variantId:f.variantId}}),f.permissionMode&&Oe(l,{type:`set_permission_mode`,sessionId:l,mode:f.permissionMode,...f.posture?{posture:f.posture}:{}}),f.title&&Oe(l,{type:`set_title`,sessionId:l,title:f.title}),f.effort&&Te(f.effort)&&Oe(l,{type:`set_effort`,sessionId:l,effort:f.effort});let e=lm(f.toolPacks).toolPacks;e&&De(l)?.features?.includes(ze.toolPacks)&&Oe(l,{type:`set_tool_packs`,sessionId:l,requestId:iS(),toolPacks:e})}else if(f)try{await Je(f)}catch(e){return i(e,`New chat`),d(`session_create_failed`,ov(e))}let h=m.current.pendingRouting[l];if(h&&(a={...a,providerId:h.providerId,model:a?.model??h.model,...h.variantId===void 0?{}:{variantId:h.variantId}}),De(l))return Oe(l,{type:`prompt`,sessionId:l,requestId:u,text:n,...r.length>0?{attachments:r}:{},...a?{options:a}:{}})?!0:(ke(l),d(`host_offline`,`That PC is offline — this transcript is read-only.`));try{t.status===`open`?t.prompt(l,n,{attachments:r,options:a,requestId:u}):await e.prompt(l,{text:n,attachments:r,options:a})}catch(e){return i(e,`Send`),d(`send_failed`,ov(e))}return!0},respondPermission(e,n,i){let a=i??o();if(a&&!l(a)){if(!(De(a)?Oe(a,{type:`permission_response`,sessionId:a,requestId:e,decision:n}):t.respondPermission(a,e,n))){r(`error`,`Not connected to the host — cannot answer the permission request`);return}p({type:`transcript`,sessionId:a,action:{type:`local_permission`,requestId:e,behavior:n.behavior}})}},async cancelQueued(t,n){let a=n??o();if(!(!a||l(a))){if(De(a)){r(`info`,`Withdrawing a queued message is done on the PC that runs the chat`);return}try{(await e.cancelQueued(a,t)).cancelled?p({type:`transcript`,sessionId:a,action:{type:`frame`,frame:{type:`prompt_cancelled`,sessionId:a,requestId:t,text:``}}}):r(`info`,`The agent has already read that message`)}catch(e){i(e,`Withdraw`)}}},async sendQueuedNow(t,n){let r=n??o();if(!r||l(r))return null;if(De(r))return`Send now is done on the PC that runs the chat`;try{return(await e.sendQueuedNow(r,t)).sent?null:Re.alreadyRead}catch(e){return e instanceof sg&&e.code===`not_found`?Re.alreadyRead:e instanceof Error?e.message:String(e)}},async sendQueuedNowAll(t){let n=t??o();if(!n||l(n))return null;if(De(n))return`Send now is done on the PC that runs the chat`;try{return await e.sendQueuedNowAll(n),null}catch(e){return e instanceof sg&&e.code===`not_found`?Re.allRead:e instanceof Error?e.message:String(e)}},async interrupt(n){let r=n??o();if(r&&!l(r)){if(De(r)){Oe(r,{type:`interrupt`,sessionId:r})||ke(r);return}if(!t.interrupt(r))try{await e.interrupt(r)}catch(e){i(e,`Interrupt`)}}},setSessionModel(e,n,r,i){let a=i??o();if(!a)return;if(n&&ae(n,e,r),s(a)){p({type:`draft_patch`,id:a,patch:{model:e,...n?{providerId:n}:{},...r===void 0?{}:{variantId:r},customModel:null}});return}p({type:`transcript`,sessionId:a,action:{type:`model_picked`}});let c=m.current.sessions.find(e=>e.id===a),l=m.current.transcripts[a]?.session??c,u=m.current.transcripts[a]?.session?.model??c?.model??null,d=m.current.pendingRouting[a],f=d!==void 0||n!==void 0&&(l===void 0||n!==(l.providerId??null))||r!==void 0&&l!==void 0&&(r??null)!==(l.variantId??null);f?p({type:`pending_routing`,sessionId:a,routing:{providerId:n??d?.providerId??l?.providerId??``,model:e,...r===void 0?{}:{variantId:r}}}):De(a)?Oe(a,{type:`set_model`,sessionId:a,model:e}):t.setModel(a,e);let h=ng(n??l?.providerId??null,e);if(u!==e&&!h&&p({type:`model_boundary`,sessionId:a,boundary:{index:m.current.transcripts[a]?.items.length??0,from:u,to:e}}),c&&h){if(!f&&!c.autoModel){let{customModel:e,...t}=c;p({type:`session_upsert`,session:{...t,autoModel:{model:null}}})}}else if(c){let{customModel:t,autoModel:i,...a}=c;p({type:`session_upsert`,session:{...a,model:e,...n?{providerId:n}:{},...r===void 0?{}:{variantId:r}}})}},async setSessionCustomModel(t,n,a){let c=n??o();if(!c)return!1;let l=s(c);if(l){let e=m.current,n=Sm(e.providers,{providerId:l.providerId??e.activeProviderId,model:l.model??e.info?.activeModel??null,variantId:l.variantId}),r=a?Vh(t,a):Bh(t,{providerId:n.providerId,variantId:n.variantId},e.providers.map(e=>e.definition.id));return p({type:`draft_patch`,id:c,patch:{...r,customModel:{previous:l.customModel?.previous??{providerId:n.providerId,variantId:n.variantId,model:n.modelId}}}}),!0}let u=De(c);if(u){if(!u.features?.includes(ze.customModel))return r(`error`,`OonaCode on ${u.hostName} is too old to set a model typed by hand from here — update it first.`),!1;let e=oS(m.current,c),n=e?.model??null;if(!Oe(c,{type:`set_custom_model`,sessionId:c,customModel:t,...a?{customModelProvider:a}:{}}))return ke(c),!1;if(m.current.pendingRouting[c]!==void 0&&p({type:`pending_routing`,sessionId:c,routing:null}),p({type:`transcript`,sessionId:c,action:{type:`model_picked`}}),e){let{customModel:r,autoModel:i,...o}=e,s={...o,model:t,customModel:!0,...a?{providerId:a.providerId}:{},...a&&a.variantId!==void 0?{variantId:a.variantId}:{}};n!==t&&p({type:`model_boundary`,sessionId:c,boundary:{index:m.current.transcripts[c]?.items.length??0,from:n,to:t}}),p({type:`session_upsert`,session:s})}return!0}try{let n=oS(m.current,c),r=await e.updateSession(c,{customModel:t,...a?{customModelProvider:a}:{}});m.current.pendingRouting[c]!==void 0&&p({type:`pending_routing`,sessionId:c,routing:null}),p({type:`transcript`,sessionId:c,action:{type:`model_picked`}});let i=n?.model??null;return i!==r.model&&r.model&&p({type:`model_boundary`,sessionId:c,boundary:{index:m.current.transcripts[c]?.items.length??0,from:i,to:r.model}}),p({type:`session_upsert`,session:r}),!0}catch(e){return i(e,`Model`),!1}},setSessionPosture(e,n){let r=n??o();if(!r)return;let i=ee(e);if(l(r)){p({type:`draft_patch`,id:r,patch:{permissionMode:i,posture:e}});return}De(r)?Oe(r,{type:`set_permission_mode`,sessionId:r,mode:i,posture:e}):t.setPermissionMode(r,i,e);let a=m.current.sessions.find(e=>e.id===r);a&&p({type:`session_upsert`,session:{...a,permissionMode:i,posture:e}})},setSessionEffort(e,n){let r=n??o();if(!r||l(r))return;De(r)?Oe(r,{type:`set_effort`,sessionId:r,effort:e}):t.setEffort(r,e);let i=m.current.sessions.find(e=>e.id===r);if(i){let{effort:t,...n}=i;p({type:`session_upsert`,session:e?{...n,effort:e}:n})}},async setReach(e,t){let n=De(e),i=A.current.get(e);if(!n||!i?.setReach)return!1;if(!n.features?.includes(ze.reach))return r(`error`,`OonaCode on ${n.hostName} is too old to use this PC's files — update it first.`),!1;if(!n.live)return ke(e),!1;if(!i.setReach(t))return r(`error`,`Not connected to the host.`),!1;if(t&&t.length>0){let t=l(e)?s(e)?.toolPacks:oS(m.current,e)?.toolPacks;t?.reach!==!0&&I.setSessionToolPacks(e,sm(t,jd,!0))}return!0},answerReach(e,t,n){A.current.get(e)?.answerReach?.(t,n),p({type:`remote_reach`,sessionId:e,event:{kind:`ask_end`,requestId:t}})},async setSessionToolPacks(t,n){if(l(t))return p({type:`draft_patch`,id:t,patch:{toolPacks:{...n}}}),!0;let a=De(t);if(a){if(!a.features?.includes(ze.toolPacks))return r(`error`,`OonaCode on ${a.hostName} is too old to change this chat's tools from here — update it first.`),!1;let e=oS(m.current,t),i=e?.toolPacks;if(e&&p({type:`session_upsert`,session:{...e,toolPacks:n}}),!Oe(t,{type:`set_tool_packs`,sessionId:t,requestId:iS(),toolPacks:n})){if(e){let{toolPacks:t,...n}=e;p({type:`session_upsert`,session:i?{...n,toolPacks:i}:n})}return ke(t),!1}return!0}let o=(T.current.get(t)??0)+1;T.current.set(t,o);let s=oS(m.current,t),c=s?.toolPacks;s&&p({type:`session_upsert`,session:{...s,toolPacks:n}});try{let r=await e.updateSession(t,{toolPacks:n});return T.current.get(t)===o&&p({type:`session_upsert`,session:r}),!0}catch(e){if(T.current.get(t)===o){let e=oS(m.current,t);if(e){let{toolPacks:t,...n}=e;p({type:`session_upsert`,session:c?{...n,toolPacks:c}:n})}}return i(e,`Tools`),!1}},async setSessionMedia(t,n){if(l(t))return p({type:`draft_patch`,id:t,patch:{media:{...n}}}),!0;if(De(t))return!1;let r=(E.current.get(t)??0)+1;E.current.set(t,r);let a=oS(m.current,t),o=a?.media;if(a){let{media:e,...t}=a,r=dd(n);p({type:`session_upsert`,session:r?{...t,media:r}:t})}try{let i=await e.updateSession(t,{media:n});return E.current.get(t)===r&&p({type:`session_upsert`,session:i}),!0}catch(e){if(E.current.get(t)===r){let e=oS(m.current,t);if(e){let{media:t,...n}=e;p({type:`session_upsert`,session:o?{...n,media:o}:n})}}return i(e,`Tools`),!1}},async setSessionMcpSwitches(t,n){if(l(t))return p({type:`draft_patch`,id:t,patch:{mcpSwitches:{...n}}}),!0;let a=De(t);if(a)return r(`error`,`This chat runs on ${a.hostName} — switch its MCP servers in OonaCode on that PC.`),!1;let o=(D.current.get(t)??0)+1;D.current.set(t,o);let s=oS(m.current,t),c=s?.mcpSwitches;s&&p({type:`session_upsert`,session:{...s,mcpSwitches:n}});try{let r=await e.updateSession(t,{mcpSwitches:n});return D.current.get(t)===o&&p({type:`session_upsert`,session:r}),!0}catch(e){if(D.current.get(t)===o){let e=oS(m.current,t);if(e){let{mcpSwitches:t,...n}=e;p({type:`session_upsert`,session:c?{...n,mcpSwitches:c}:n})}}return i(e,`MCP`),!1}},async setSessionModelSkills(t,n){let a=[...n];if(l(t))return p({type:`draft_patch`,id:t,patch:{modelSkills:a}}),!0;let o=De(t);if(o)return r(`error`,`This chat runs on ${o.hostName} — switch its skills in OonaCode on that PC.`),!1;let s=(O.current.get(t)??0)+1;O.current.set(t,s);let c=oS(m.current,t),u=c?.modelSkills;c&&p({type:`session_upsert`,session:{...c,modelSkills:a}});try{let n=await e.updateSession(t,{modelSkills:a});return O.current.get(t)===s&&p({type:`session_upsert`,session:n}),!0}catch(e){if(O.current.get(t)===s){let e=oS(m.current,t);if(e){let{modelSkills:t,...n}=e;p({type:`session_upsert`,session:u?{...n,modelSkills:u}:n})}}return i(e,`Skills`),!1}},async listChatSkills(t){if(m.current.remote.tabs[t])return`unsupported`;let n=s(t);try{return n?e.listChatSkills?await e.listChatSkills(n.projectDir?{cwd:n.projectDir}:{}):`unsupported`:e.listSessionChatSkills?await e.listSessionChatSkills(t):`unsupported`}catch(e){return e instanceof sg&&e.isUnauthorized&&y.current?.(),dg(e)?`unsupported`:null}},setActiveProvider:ae,async inspectProject(t){let n=o(),r=n===null?null:De(n)?.hostId??m.current.remote.sessionOwners[n]??null;if(r&&e.inspectHostProject)try{return await e.inspectHostProject(r,t)}catch(e){return dg(e)||(e instanceof sg&&e.isUnauthorized?y.current?.():i(e,`Folder`)),null}if(!e.inspectProject)return null;try{return await e.inspectProject({dir:t})}catch(e){return dg(e)||(e instanceof sg&&e.isUnauthorized?y.current?.():i(e,`Folder`)),null}},async attachProject(t,n){let c=n??o();if(!c)return!1;if(s(c))return p({type:`draft_patch`,id:c,patch:{projectDir:t}}),!0;let l=De(c),u=l?.hostId??m.current.remote.sessionOwners[c]??null;if(u&&e.updateHostSession)try{let n=await e.updateHostSession(u,c,{projectDir:t});return p({type:`session_upsert`,session:n}),r(`success`,`Switched to ${n.cwd} — the engine restarts on your next message.`),!0}catch(e){return i(e,`Folder`),!1}if(l)return r(`error`,`This chat runs on ${l.hostName} — choose its project folder in OonaCode on that PC.`),!1;if(!e.attachSessionProject)return a(`open a chat in one of your project folders`),!1;try{let n=await e.attachSessionProject(c,{dir:t});return p({type:`session_upsert`,session:n.session}),f(),r(`success`,n.appliesOnNextMessage?`Switched to ${n.session.cwd} — the turn in progress finishes where it started, and your next message runs there with that project's CLAUDE.md and settings`:n.restarted?`Switched to ${n.session.cwd} — this chat restarts with that project's CLAUDE.md and settings loaded, and continues where it left off`:`Switched to ${n.session.cwd} — the next message loads that project's CLAUDE.md and settings`),!0}catch(e){return dg(e)?a(`open a chat in one of your project folders`):i(e,`Project folder`),!1}},async saveSettings(t){try{p({type:`settings`,settings:await e.updateSettings(t)}),r(`success`,`Settings saved`)}catch(e){i(e,`Settings`)}},savePrefs:Le,growTranscript(e,t){p({type:`window_grow`,sessionId:e,total:t})},revealTranscript(e,t,n,r){p({type:`window_reveal`,sessionId:e,rendered:t,total:n,...r?{hold:!0}:{}})},trimTranscript(e,t){p({type:`window_trim`,sessionId:e,...t?{force:!0}:{}})},hydrateSession:B,async catchUpEntries(t){if(l(t))return;let n=De(t);if(n){await je(n.hostId,t);return}let r=m.current.transcripts[t],i=r?.lastSeq??void 0;if(i===void 0&&r?.hydrated){try{await B(t)}catch(e){e instanceof sg&&e.isUnauthorized&&y.current?.()}return}for(let n=0;n<200;n++){let n;try{n=await e.listEntries(t,{limit:500,...i===void 0?{}:{afterSeq:i}})}catch(e){e instanceof sg&&e.isUnauthorized&&y.current?.();return}if(n.entries.length>0&&p({type:`transcript`,sessionId:t,action:{type:`entries`,entries:n.entries}}),n.nextSeq===null||n.nextSeq===i)return;i=n.nextSeq}},checkUpdates:et,async installUpdate(){if(h.current)return;h.current=!0;let e=typeof window<`u`?window.oonacode:void 0,t=m.current,n=Ix(t.update.components.map(e=>e.component),Fx(e),{checked:t.update.version!==``,shellEngaged:t.updateInstall.phase!==`idle`&&t.updateInstall.phase!==`checking`});if(n.upToDate){r(`success`,`Everything is up to date`),h.current=!1;return}let i=n.desktop;if(n.terminal&&e?.updateTerminalInstall){p({type:`terminal_update`,terminal:{running:!0,message:``,failed:!1}});try{let t=await e.updateTerminalInstall();if(p({type:`terminal_update`,terminal:{running:!1,message:t.message,failed:!t.ok}}),!t.ok){r(`error`,t.message),h.current=!1;return}if(t.handedOver){r(`info`,t.message);return}t.absent?e.installUpdate&&(i=!0):(r(`success`,t.message),await ve(),await et(!1))}catch(e){let t=ov(e);p({type:`terminal_update`,terminal:{running:!1,message:t,failed:!0}}),r(`error`,`Updating the CLI and host service failed: ${t}`),h.current=!1;return}}if(!i){n.manual.length>0&&r(`info`,`This window cannot install `+n.manual.map(e=>hx[e]).join(`, `)+" — run the installer from the website, or `oona update` in a terminal"),h.current=!1;return}if(!e?.installUpdate){r(`info`,"This window cannot install the app itself — run the installer again, or `oona update` in a terminal"),h.current=!1;return}try{let t=await e.installUpdate();r(t.started?`info`:`error`,t.message),t.started||(h.current=!1)}catch(e){r(`error`,`Update failed: ${ov(e)}`),h.current=!1}},dismissUpdate(){let e=m.current.update.version||null;p({type:`update_dismissed`,version:e}),Le({dismissedUpdateVersion:e}),p({type:`dialog`,dialog:`none`})},async login(t){try{return p({type:`account`,account:await e.login(t)}),r(`success`,t.register?`Account created`:`Logged in`),ce(),g(),xe(),`ok`}catch(e){let n=Zee(e,{email:t.email,registered:t.register===!0});return n?(p({type:`email_verification`,pending:n}),`verification_pending`):(i(e,`Login`),`failed`)}},async startAccountLink(){if(!e.startAccountLink)return a(`sign in through your browser`),null;try{let t=await e.startAccountLink({clientKind:hS()});return p({type:`account_link`,link:t}),t.status===`error`&&r(`error`,t.message??`Could not start the sign-in`),t}catch(e){return dg(e)?a(`sign in through your browser`):i(e,`Sign in`),null}},async refreshAccountLink(){if(e.accountLinkStatus)try{let t=await e.accountLinkStatus();p({type:`account_link`,link:t}),t.status===`approved`&&(se(),ce(),g())}catch(e){dg(e)||i(e,`Sign in`)}},async cancelAccountLink(){if(!e.cancelAccountLink){p({type:`account_link`,link:{status:`idle`}});return}try{p({type:`account_link`,link:await e.cancelAccountLink()})}catch(e){p({type:`account_link`,link:{status:`idle`}}),dg(e)||i(e,`Sign in`)}},async resendVerification(){let t=m.current.emailVerification;if(!t)return!1;try{let n=await e.resendVerification({email:t.email});return p({type:`email_verification`,pending:{...t,verification:`pending`,resendAt:mg(n.resendAfterSec,Date.now())}}),r(`success`,`Confirmation link sent to ${t.displayEmail}`),!0}catch(e){return dg(e)?r(`error`,`This host build cannot resend the link yet — use "Resend" on the website sign-in page`):i(e,`Resend link`),!1}},dismissEmailVerification(){p({type:`email_verification`,pending:null})},async logout(){try{p({type:`account`,account:await e.logout()}),p({type:`credentials`,credentials:[]})}catch(e){i(e,`Logout`)}},async remoteUnlockHost(t,n){try{let i=await e.remoteUnlockHost(t,n);return i.ok?(r(`info`,`Device unlocked — its sessions are available again.`),xe(),!0):(r(`error`,i.error===`host_too_old`?`That PC runs an older OonaCode — update it first.`:i.error===`wrong_keys`?`Wrong password — the device stays locked.`:`Could not unlock: `+(i.error??`unknown`)),!1)}catch(e){return r(`error`,ov(e)),!1}},async lockDevice(){try{let t=await e.lock();p({type:`account`,account:t})}catch(e){r(`error`,ov(e))}},async unlock(t,n={}){try{return p({type:`account`,account:await e.unlock({password:t,...n.keepUnlocked===void 0?{}:{keepUnlocked:n.keepUnlocked}})}),ce(),!0}catch(e){if(!n.onError)return i(e,`Unlock`),!1;let t=e instanceof sg&&e.isUnauthorized&&!_S(e);return t&&y.current?.(),n.onError(e instanceof sg&&_S(e)?`Wrong password — the vault stays locked.`:t?`Reconnecting to the OonaCode host — press Unlock again in a moment.`:`Could not unlock: ${ov(e)}`),e instanceof sg&&e.isUnauthorized||b.current?.(e,{source:`action`,action:`Unlock`}),!1}},async completeVaultRekey(t){if(!e.completeVaultRekey)return a(`finish a password reset`),!1;try{let n=await e.completeVaultRekey({password:t});return p({type:`account`,account:n.account}),p({type:`recovery_key`,recoveryKey:{code:n.recoveryCode,devicesSignedOut:n.devicesSignedOut,warning:n.warning??null}}),r(n.warning?`info`:`success`,n.warning?`Vault moved to your new password — with a warning, see your Recovery Key below`:`Vault moved to your new password`),ce(),g(),!0}catch(e){return dg(e)?a(`finish a password reset`):i(e,`Move vault`),!1}},async revokeVaultRekey(t){if(!e.revokeVaultRekey)return a(`abandon a password reset`),!1;try{let n=await e.revokeVaultRekey({acknowledgeDataLoss:sc,password:t});return p({type:`account`,account:n.account}),p({type:`credentials`,credentials:[]}),r(`info`,`Vault discarded — every saved key is gone; your chats are untouched. Unlock with your new password to start a fresh vault.`),!0}catch(e){return dg(e)?a(`abandon a password reset`):i(e,`Discard vault`),!1}},dismissRecoveryKey(){p({type:`recovery_key`,recoveryKey:null})},async setDeviceUnlock(t,n){if(!e.setDeviceUnlock)return a(`keep itself unlocked`),!1;try{let i=await e.setDeviceUnlock({enabled:t,...n?{password:n}:{}});return p({type:`account`,account:i}),r(`success`,t?`This PC will stay unlocked after a restart`:`This PC will ask for your password after a restart`),!0}catch(e){return dg(e)?a(`keep itself unlocked`):i(e,`Keep me unlocked`),!1}},async probeCredential(t,n){try{let r=await e.probeCredential(t,n);return{ok:r.ok,...r.error?{error:r.error}:{}}}catch(e){return{ok:!1,error:ov(e)}}},async addCredential(t){try{return await e.addCredential(t),r(`success`,`Credential saved to your vault`),await ce(),g(),!0}catch(e){return i(e,`Add credential`),!1}},async deleteCredential(t){try{await e.deleteCredential(t),r(`info`,`Credential revoked on all devices`),await ce(),g()}catch(e){i(e,`Revoke`)}},async testCredential(t){try{let n=await e.testCredential(t);r(n.ok?`success`:`error`,n.ok?`Credential works (${n.latencyMs??`?`} ms)`:`Test failed: ${n.error??`unknown error`}`)}catch(e){i(e,`Test`)}},async testProvider(t){try{let n=await e.testProvider(t);r(n.ok?`success`:`error`,n.ok?`${t} reachable (${n.latencyMs??`?`} ms)`:`${t}: ${n.error??`test failed`}`),g()}catch(e){i(e,`Test`)}},async syncNow(){try{let t=await e.syncNow();r(t.ok?`success`:`error`,t.ok?`Vault synced (rev ${t.rev??`?`})`:`Sync failed: ${t.error??`unknown`}`),se(),ce()}catch(e){i(e,`Sync`)}},toast:r,dismissToast(e){p({type:`dismiss_toast`,id:e})},openDialog(e,t){p({type:`dialog`,dialog:e,connectProviderId:t??null})},openProviderConnect(e){p({type:`connect_provider`,providerId:e})},openSettings(e){p({type:`settings_section`,section:e}),p({type:`dialog`,dialog:`settings`})},openClaudeLogin(e){p({type:`claude_login_mode`,mode:e}),p({type:`connect_provider`,providerId:null}),p({type:`dialog`,dialog:`claude-login`})},openOauthLogin(e){p({type:`connect_provider`,providerId:null}),p({type:`dialog`,dialog:`oauth-login`}),p({type:`oauth_login_provider`,providerId:e})},setSidebar(e){p({type:`sidebar`,open:e})},setMediaPanel(e){I.setRightSection(`media`,e)},setRightSection(e,t){let{rightPanelSections:n,rightPanelCollapsed:r}=m.current.prefs,i=t?Mb(n,r,e):{sections:n.filter(t=>t!==e),collapsed:r};Le(jb(i.sections,i.collapsed))},showLeftSection(e){if(typeof window<`u`&&typeof window.matchMedia==`function`&&!window.matchMedia(`(min-width: 768px)`).matches){let{leftPanelSection:t,explorerOpen:n}=Nb(e,m.current.prefs.leftPanelOpen);Le({leftPanelSection:t,explorerOpen:n}),p({type:`sidebar`,open:!0});return}Le(Nb(e,!0))},async searchSessionNames(t){let n=t.trim();if(!n)return[];try{return(await e.listSessions({search:n,limit:200})).sessions}catch(e){return i(e,`Search`),null}},setDirtyFiles(e,t){p({type:`files_dirty`,sessionId:e,paths:t})},openFile(e,t){let n=t??m.current.currentSessionId;n&&p({type:`file_open`,sessionId:n,path:e})},closeFile(e,t){let n=t??m.current.currentSessionId;n&&p({type:`file_close`,sessionId:n,path:e})},activateFile(e,t){let n=t??m.current.currentSessionId;n&&p({type:`file_activate`,sessionId:n,path:e})},showChat(e){let t=e??m.current.currentSessionId;t&&p({type:`file_show_chat`,sessionId:t})}}},[e,t,n]);(0,v.useEffect)(()=>{let e=pte(x.current);e&&p({type:`prefs`,prefs:e})},[]),(0,v.useEffect)(()=>{let e=!1,n=t.onStatus((t,n)=>{p({type:`connection`,status:t,detail:n??null}),t===`unauthorized`&&y.current?.(),t===`open`&&e&&(I.refreshInfo(),I.refreshVaultProjects(),I.refreshAgentTools(),I.refreshMcpServers(),p({type:`conversations_changed`,conversationIds:null,sessionIds:null}),p({type:`chat_abouts_changed`,sessionIds:null}),p({type:`next_prompts_changed`,sessionIds:null})),t===`open`&&(e=!0)}),r=(e,t)=>{zx(e,m.current.prefs)&&(t.sessionId&&m.current.elsewhere[t.sessionId]||Vx(Bx(e,t),Hx()))},i=e=>{let t=m.current.transcripts[e]?.session??m.current.sessions.find(t=>t.id===e);return t?av(t):`OonaCode session`},a=e=>{let n=Date.now(),a=e.type===`session_state`?oS(m.current,e.session.id):void 0;for(let t of eS(e,n))p(t);if(e.type===`session_state`&&rx(a,e.session)&&I.refreshPlanSoon(),e.type===`transcript_changed`&&I.reloadTranscript(e.sessionId),e.type===`permission_request`){let t=`${e.sessionId}:${e.request.requestId}`;if(k.current.has(t)||(k.current.size>=Wx&&k.current.clear(),k.current.add(t),e.settled===!0))return;r(`permissionRequired`,{sessionTitle:i(e.sessionId),toolName:e.request.toolName,sessionId:e.sessionId})}else if(e.type===`turn_finished`)r(`agentFinished`,{sessionTitle:i(e.sessionId),isError:e.result.isError,sessionId:e.sessionId});else if(e.type===`error`)r(`errorOccurred`,{sessionTitle:e.sessionId?i(e.sessionId):`OonaCode`,detail:e.code,...e.sessionId?{sessionId:e.sessionId}:{}});else if(e.type===`scheduled_tasks_changed`)p({type:`scheduled_tasks_changed`});else if(e.type===`new_chat_started`)oS(m.current,e.newSessionId)||p({type:`session_upsert`,session:e.session}),e.answeredBy!==null&&e.answeredBy===t.clientId&&p({type:`select_session`,id:e.newSessionId,near:e.sessionId});else if(e.type===`session_list_changed`)I.refreshSessions(),e.reason===`deleted`&&(p({type:`session_removed`,id:e.sessionId}),I.setPinned(`chat`,e.sessionId,!1));else if(e.type===`account_changed`&&e.reason===`agent_tools`)I.refreshAgentTools(),I.refreshMcpServers();else if(e.type===`account_changed`)I.refreshAccount(),I.refreshPlan(),I.refreshProviders(),I.refreshAgentTools(),I.refreshMcpServers(),I.refreshInfo(),e.reason!==`provider`&&I.refreshCredentials(),e.reason!==`provider`&&(I.refreshHosts(),I.refreshClaudeSubscription(),I.refreshVaultProjects());else if(e.type===`welcome`){I.refreshSessions();for(let e of cy(m.current.layout))I.catchUpEntries(e)}},o=fg({isStreamFrame:Qx,deliver:e=>{for(let t of e)a(t)},batchMs:c,isHidden:$x}),s=t.onAny(e=>o.push(e)),l=()=>{$x()||o.flush()};return typeof document<`u`&&document.addEventListener(`visibilitychange`,l),t.connect(),()=>{n(),s(),typeof document<`u`&&document.removeEventListener(`visibilitychange`,l),o.dispose(),t.close()}},[t,I,c]),(0,v.useEffect)(()=>{if(typeof window>`u`||typeof document>`u`)return;let e=()=>I.refreshPlanSoon(),t=()=>{document.visibilityState===`visible`&&I.refreshPlanSoon()};return window.addEventListener(`focus`,e),document.addEventListener(`visibilitychange`,t),()=>{window.removeEventListener(`focus`,e),document.removeEventListener(`visibilitychange`,t)}},[I]),(0,v.useEffect)(()=>{I.refreshInfo(),I.refreshPlan(),I.refreshSessions(),I.refreshProjects(),I.refreshProviders(),I.refreshAgentTools(),I.refreshMcpServers(),I.refreshSettings(),I.refreshAccount(),I.refreshCredentials(),I.refreshHosts()},[I]),(0,v.useEffect)(()=>{r&&p({type:`select_session`,id:r})},[r]);let[re,ie]=(0,v.useState)(()=>typeof window<`u`&&window.oonacode?.getWindowInit?void 0:null);(0,v.useEffect)(()=>{let e=typeof window<`u`?window.oonacode:void 0;if(!e?.getWindowInit)return;let t=!0;return e.getWindowInit().then(e=>{t&&ie(e??null)},()=>{t&&ie(null)}),()=>{t=!1}},[]),(0,v.useEffect)(()=>{let e=typeof window<`u`?window.oonacode:void 0;if(e?.onWindowRegistry)return e.onWindowRegistry(e=>p({type:`elsewhere`,owners:e.owners}))},[]),(0,v.useEffect)(()=>{let e=typeof window<`u`?window.oonacode:void 0;if(e?.onAcceptTab)return e.onAcceptTab(e=>{let t=e.x!==null&&e.y!==null&&typeof document<`u`?Tb(document,e.x,e.y):null;I.adoptTab(e.tab,t)})},[I]);let L=f.currentSessionId,R=L?f.drafts[L]:void 0,z=L?oS(f,L)??null:null,ae=R?uv(R):z?av(z):null;(0,v.useEffect)(()=>{typeof document>`u`||(document.title=ae?`${ae} — OonaCode`:`OonaCode`)},[ae]);let oe=f.tabs,se=f.layout,ce=f.drafts,le=f.remote.tabs;(0,v.useEffect)(()=>{let e=typeof window<`u`?window.oonacode:void 0;if(!e?.reportWindowState||(d===`popout`?!xe.current:!fe.current))return;let t={drafts:ce,remoteTabs:le,unsent:{},files:{}};e.reportWindowState({tabs:oe.ids.map(e=>mb(pb(t,e))),layout:By(se),activeId:oe.activeId,title:ae})},[oe,se,ce,le,ae,d]);let ue=(0,v.useRef)(!1),de=f.tabs.ids.length;(0,v.useEffect)(()=>{if(d===`popout`){if(de>0){ue.current=!0;return}!ue.current||typeof window>`u`||window.close()}},[d,de]);let fe=(0,v.useRef)(!1),pe=(0,v.useRef)(!1),me=(0,v.useRef)(null),he=(0,v.useRef)(!0);(0,v.useEffect)(()=>(he.current=!0,()=>{he.current=!1}),[]);let ge=f.sessionListLoaded,_e=f.remote.loaded,ve=f.settings!==null,[ye,be]=(0,v.useState)(!1);(0,v.useEffect)(()=>{if(_e&&ve||ye)return;let e=setTimeout(()=>be(!0),Gx);return()=>clearTimeout(e)},[_e,ve,ye]),(0,v.useEffect)(()=>{if(fe.current||!ge||d===`popout`||re===void 0||!ve||!_e&&!ye)return;fe.current=!0;let t=Hte(f.prefs),n=new Set(f.sessions.map(e=>e.id)),r=Vte(f.prefs).filter(({id:e})=>!n.has(e)).map(({id:e,title:t},n)=>({...sv(e,n),title:t})),i=new Set(r.map(e=>e.id));if(t.ids.length===0)return;let a=Bte(f.prefs),o=t.ids.filter(e=>a[e]!==void 0),s=new Set(re?.heldElsewhere??[]),c=e=>{let n=Rte(t,[...f.sessions.map(e=>e.id),...o,...i,...e].filter(e=>!s.has(e))),c=[...n.ids],l=m.current.currentSessionId;if(l&&!c.includes(l)&&c.push(l),c.length!==0){me.current=m.current.layout,p({type:`restore_tabs`,ids:c,activeId:l??n.activeId,drafts:r.filter(e=>c.includes(e.id)),layout:f.prefs.editorLayout});for(let e of c){let t=a[e];t!==void 0&&I.openRemoteSession(t,e,{focus:!1})}}},l=t.ids.filter(e=>!n.has(e)&&a[e]===void 0&&!i.has(e));if(l.length===0){c([]);return}pe.current=!0,Promise.all(l.map(t=>e.getSession(t).then(()=>t,e=>e instanceof sg&&e.status===404?null:t))).then(e=>{pe.current=!1,he.current&&c(e.filter(e=>e!==null))})},[ge,_e,ye,ve,f.prefs,f.sessions,e,I,d,re]);let xe=(0,v.useRef)(!1);(0,v.useEffect)(()=>{if(d!==`popout`||xe.current||re===void 0||!ge)return;xe.current=!0;let e=re?.tabs??[];if(e.length===0)return;let t=new Set(m.current.sessions.map(e=>e.id));p({type:`restore_tabs`,ids:e.map(e=>e.id),activeId:re?.activeId??e[e.length-1].id,drafts:e.filter(e=>e.draft&&!t.has(e.id)).map(e=>gb(e)),layout:re?.layout??null});for(let n of e){n.kind===`remote`&&n.hostId&&I.openRemoteSession(n.hostId,n.id,{focus:!1,draft:n.draft!==void 0&&!t.has(n.id)}),n.unsentText&&p({type:`unsent`,sessionId:n.id,message:{text:n.unsentText,attachments:[]}});for(let e of n.files?.open??[])p({type:`file_open`,sessionId:n.id,path:e});n.files&&n.files.open.length>0&&(n.files.active?p({type:`file_activate`,sessionId:n.id,path:n.files.active}):p({type:`file_show_chat`,sessionId:n.id}))}},[d,re,ge,I]);let Se=f.tabs,Ce=f.layout,we=f.prefs,Ee=f.remote.tabs,De=f.drafts,Oe=f.settings!==null;(0,v.useEffect)(()=>{if(!Oe||d===`popout`||!fe.current||pe.current)return;if(me.current!==null){if(Ce===me.current)return;me.current=null}let e={};for(let t of Se.ids){let n=Ee[t];n&&(e[t]=n.hostId)}let t=By(Ce),n=!Vy(t,we.editorLayout??null);!Ute(Se,we,e,De)&&!n||I.savePrefs({...Zv(Se,e,De),editorLayout:t})},[Se,Ce,we,Ee,De,Oe,ge,I,d]);let ke=f.prefs.pinned.filter(e=>e.kind===`chat`).map(e=>e.id).join(`,`),Ae=(0,v.useRef)(new Set),je=f.sessions,Me=f.search.trim()!==``;(0,v.useEffect)(()=>{if(!ge||!Oe||Me||ke===``)return;let t=new Set(je.map(e=>e.id));for(let n of ke.split(`,`)){let r=m.current;t.has(n)||r.pinnedRows[n]||r.drafts[n]||r.remote.tabs[n]||Ae.current.has(n)||(Ae.current.add(n),e.getSession(n).then(e=>p({type:`pinned_row`,session:e}),e=>{e instanceof sg&&e.status===404?I.setPinned(`chat`,n,!1):Ae.current.delete(n)}))}},[ke,je,ge,Oe,Me,e,I]);let Ne=f.tabs.ids.join(`,`);(0,v.useEffect)(()=>{let e=Ne?Ne.split(`,`):[];for(let n of e){if(m.current.remote.tabs[n]||m.current.drafts[n])continue;let e=m.current.transcripts[n];t.subscribe(n,e?.lastSeq??void 0),!e?.hydrated&&(p({type:`transcript_loading`,sessionId:n,loading:!0}),(async()=>{try{await I.hydrateSession(n)}catch(e){e instanceof sg&&e.isUnauthorized?y.current?.():I.toast(`error`,`Could not load session: ${ov(e)}`)}finally{p({type:`transcript_loading`,sessionId:n,loading:!1})}})())}return()=>{for(let n of e){if(m.current.tabs.ids.includes(n)||m.current.remote.tabs[n])continue;let e=m.current.transcripts[n];(!e||e.status===`idle`||e.status===`error`)&&t.unsubscribe(n)}}},[Ne,e,t,I]),(0,v.useEffect)(()=>{if(n)return()=>n.close()},[n]);let[Pe,Fe]=(0,v.useState)(()=>rb());(0,v.useEffect)(()=>{if(typeof window>`u`)return;let e=()=>Fe(rb());return window.addEventListener(`focus`,e),window.addEventListener(`blur`,e),document.addEventListener(`visibilitychange`,e),()=>{window.removeEventListener(`focus`,e),window.removeEventListener(`blur`,e),document.removeEventListener(`visibilitychange`,e)}},[]);let Ie=(0,v.useRef)(new Map),Le=f.page===null?null:f.pageGroup&&f.layout.groups[f.pageGroup]?f.pageGroup:f.layout.focused,Be=Pe?tb(f.layout,f.files,Le).filter(e=>!f.remote.tabs[e]&&!f.drafts[e]).map(e=>{let t=f.transcripts[e]?.session??f.sessions.find(t=>t.id===e)??null;return t?.finishedUnseen?`${e}@${t.finishedUnseen.at}`:null}).filter(e=>e!==null).join(`,`):``;(0,v.useEffect)(()=>{if(!Be||!e.markSessionSeen)return;let t=setTimeout(()=>{for(let t of Be.split(`,`)){let n=t.indexOf(`@`),r=t.slice(0,n),i=t.slice(n+1);Ie.current.get(r)!==i&&(Ie.current.set(r,i),e.markSessionSeen(r).catch(()=>{Ie.current.get(r)===i&&Ie.current.delete(r)}))}},400);return()=>clearTimeout(t)},[Be,e]);let B=f.settings?.theme??`system`,Ve=f.prefs.themeColors;(0,v.useEffect)(()=>{if(typeof document>`u`)return;let e=document.documentElement,t=typeof window.matchMedia==`function`?window.matchMedia(`(prefers-color-scheme: dark)`):null,n=window.oonacode?.host===`vscode`,r=()=>{let r=dte(B,t?.matches===!0);if(n){let t=e.getAttribute(`data-theme`);(t===`light`||t===`dark`)&&(r=t)}else e.setAttribute(`data-theme`,r);let i=Ve[r];for(let t of Dl){let n=i[t];n?e.style.setProperty(`--${t}`,n):e.style.removeProperty(`--${t}`)}};if(r(),n){if(typeof MutationObserver>`u`)return;let t=new MutationObserver(r);return t.observe(e,{attributes:!0,attributeFilter:[`data-theme`]}),()=>t.disconnect()}if(!(B!==`system`||!t||typeof t.addEventListener!=`function`))return t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)},[B,Ve]),(0,v.useEffect)(()=>{window.oonacode?.setTheme?.(B)},[B]);let He=f.prefs.fonts;(0,v.useEffect)(()=>{typeof document>`u`||ute(document,He)},[He]);let Ue=f.account?.gatewayUrl??f.settings?.gatewayUrl??null,We=I.checkUpdates,Ge=(0,v.useRef)(0);(0,v.useEffect)(()=>{if(!Ue)return;let e=()=>{Ge.current=Date.now(),We(!1)};e();let t=setInterval(e,nS),n=()=>{typeof document<`u`&&document.visibilityState===`hidden`||Date.now()-Ge.current<3e5||e()};return window.addEventListener(`focus`,n),document.addEventListener(`visibilitychange`,n),()=>{clearInterval(t),window.removeEventListener(`focus`,n),document.removeEventListener(`visibilitychange`,n)}},[Ue,We]);let Ke=I.openDialog,qe=I.newTab,V=I.savePrefs,Je=(0,v.useCallback)(e=>{switch(ux(),e){case`sign-in`:m.current.account?.loggedIn&&Ke(`account`);break;case`settings`:Ke(`settings`);break;case`new-tab`:qe();break;case`new-project`:m.current.account?.loggedIn&&(p({type:`projects_new`}),Ke(`projects`));break;case`check-updates`:We(!0);break;case`import-chats`:m.current.account?.loggedIn&&Ke(`import-claude`);break;case`export-chats`:m.current.account?.loggedIn&&Ke(`export-chats`);break;case`toggle-session-panel`:I.setRightSection(`sessionInfo`,!m.current.prefs.rightPanelSections.includes(`sessionInfo`));break;case`toggle-sidebar`:I.toggleSidebarPinned();break;case`split-right`:I.splitTab(`right`);break;case`split-down`:I.splitTab(`bottom`);break;case`move-to-new-window`:{let e=m.current.currentSessionId;e&&I.moveTabToNewWindow(e);break}case`move-to-main-window`:{let e=m.current.currentSessionId;e&&I.moveTabToMainWindow(e);break}case`conversations`:Ke(`conversations`);break;case`chat-abouts`:Ke(`chat-abouts`);break;case`project-manager`:Ke(`project-manager`)}},[Ke,qe,We,V,I]);(0,v.useEffect)(()=>{let e=typeof window<`u`?window.oonacode:void 0;if(e?.onMenuCommand)return e.onMenuCommand(Je)},[Je]),(0,v.useEffect)(()=>{let e=window.oonacode;if(e?.onOpenSession)return e.onOpenSession(e=>{if(m.current.remote.tabs[e]||m.current.drafts[e]){I.selectSession(e);return}!m.current.sessions.some(t=>t.id===e)&&!m.current.transcripts[e]||I.selectSession(e)})},[I]),(0,v.useEffect)(()=>{let e=typeof window<`u`?window.oonacode:void 0;if(e?.onUpdateEvent)return e.onUpdateEvent(e=>p({type:`update_event`,event:e}))},[]);let Ye=(0,v.useMemo)(()=>({state:f,dispatch:p,actions:I,api:e,socket:t}),[f,I,e,t]);return(0,W.jsx)(sS.Provider,{value:Ye,children:u})}var bS=h(),xS=`inline-block shrink-0`;function SS(e){return!!e&&/(^|\s)(w-|h-|size-|min-w-|min-h-)/.test(e)}var CS=`w-4 h-4`;function wS(e,{className:t,title:n},r=`0 0 24 24`){return(0,W.jsxs)(`svg`,{className:U(xS,SS(t)?``:CS,t),width:`1em`,height:`1em`,viewBox:r,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":!n||void 0,role:n?`img`:void 0,children:[n?(0,W.jsx)(`title`,{children:n}):null,e]})}var K={Menu:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`line`,{x1:`3`,y1:`6`,x2:`21`,y2:`6`}),(0,W.jsx)(`line`,{x1:`3`,y1:`12`,x2:`21`,y2:`12`}),(0,W.jsx)(`line`,{x1:`3`,y1:`18`,x2:`21`,y2:`18`})]}),e),More:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`circle`,{cx:`12`,cy:`5`,r:`1.6`}),(0,W.jsx)(`circle`,{cx:`12`,cy:`12`,r:`1.6`}),(0,W.jsx)(`circle`,{cx:`12`,cy:`19`,r:`1.6`})]}),e),Plus:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`line`,{x1:`12`,y1:`5`,x2:`12`,y2:`19`}),(0,W.jsx)(`line`,{x1:`5`,y1:`12`,x2:`19`,y2:`12`})]}),e),Send:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`line`,{x1:`22`,y1:`2`,x2:`11`,y2:`13`}),(0,W.jsx)(`polygon`,{points:`22 2 15 22 11 13 2 9 22 2`})]}),e),Stop:e=>wS((0,W.jsx)(`rect`,{x:`6`,y:`6`,width:`12`,height:`12`,rx:`2`}),e),Chevron:e=>wS((0,W.jsx)(`polyline`,{points:e.open?`6 9 12 15 18 9`:`9 6 15 12 9 18`}),e),Settings:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`}),(0,W.jsx)(`path`,{d:`M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09a1.65 1.65 0 0 0-1-1.51 1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09a1.65 1.65 0 0 0 1.51-1 1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z`})]}),e),User:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2`}),(0,W.jsx)(`circle`,{cx:`12`,cy:`7`,r:`4`})]}),e),Stethoscope:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M4.8 2.3A.3.3 0 1 0 5 2H4a2 2 0 0 0-2 2v5a6 6 0 0 0 6 6 6 6 0 0 0 6-6V4a2 2 0 0 0-2-2h-1a.2.2 0 1 0 .3.3`}),(0,W.jsx)(`path`,{d:`M8 15v1a6 6 0 0 0 6 6 6 6 0 0 0 6-6v-4`}),(0,W.jsx)(`circle`,{cx:`20`,cy:`10`,r:`2`})]}),e),Copy:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`rect`,{x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`}),(0,W.jsx)(`path`,{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`})]}),e),Check:e=>wS((0,W.jsx)(`polyline`,{points:`20 6 9 17 4 12`}),e),Reply:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`polyline`,{points:`9 17 4 12 9 7`}),(0,W.jsx)(`path`,{d:`M20 18v-2a4 4 0 0 0-4-4H4`})]}),e),Clock:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,W.jsx)(`polyline`,{points:`12 7 12 12 15 14`})]}),e),X:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,W.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]}),e),Alert:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z`}),(0,W.jsx)(`line`,{x1:`12`,y1:`9`,x2:`12`,y2:`13`}),(0,W.jsx)(`line`,{x1:`12`,y1:`17`,x2:`12.01`,y2:`17`})]}),e),Bug:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M8 2l1.88 1.88`}),(0,W.jsx)(`path`,{d:`M14.12 3.88L16 2`}),(0,W.jsx)(`path`,{d:`M9 7.13v-1a3.003 3.003 0 1 1 6 0v1`}),(0,W.jsx)(`path`,{d:`M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6z`}),(0,W.jsx)(`path`,{d:`M12 20v-9`}),(0,W.jsx)(`path`,{d:`M6.53 9C4.6 8.8 3 7.1 3 5`}),(0,W.jsx)(`path`,{d:`M6 13H2`}),(0,W.jsx)(`path`,{d:`M3 21c0-2.1 1.7-3.9 3.8-4`}),(0,W.jsx)(`path`,{d:`M20.97 5c0 2.1-1.6 3.8-3.5 4`}),(0,W.jsx)(`path`,{d:`M22 13h-4`}),(0,W.jsx)(`path`,{d:`M17.2 17c2.1.1 3.8 1.9 3.8 4`})]}),e),Spinner:e=>wS((0,W.jsx)(`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`}),{...e,className:U(`spin`,e.className??`w-4 h-4`)}),Tool:e=>wS((0,W.jsx)(`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z`}),e),Skill:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M12 3l1.9 4.6 4.6 1.9-4.6 1.9L12 16l-1.9-4.6L5.5 9.5l4.6-1.9z`}),(0,W.jsx)(`path`,{d:`M19 15l.8 1.7 1.7.8-1.7.8L19 20l-.8-1.7-1.7-.8 1.7-.8z`})]}),e),Brain:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M9.5 2a2.5 2.5 0 0 1 2.5 2.5V20a2.5 2.5 0 0 1-5 0 2.5 2.5 0 0 1-2.5-2.5v-1A2.5 2.5 0 0 1 2 14v-1a2.5 2.5 0 0 1 2.5-2.5V9A2.5 2.5 0 0 1 7 6.5V4.5A2.5 2.5 0 0 1 9.5 2z`}),(0,W.jsx)(`path`,{d:`M14.5 2A2.5 2.5 0 0 0 12 4.5V20a2.5 2.5 0 0 0 5 0 2.5 2.5 0 0 0 2.5-2.5v-1A2.5 2.5 0 0 0 22 14v-1a2.5 2.5 0 0 0-2.5-2.5V9A2.5 2.5 0 0 0 17 6.5V4.5A2.5 2.5 0 0 0 14.5 2z`})]}),e),ArrowDown:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`line`,{x1:`12`,y1:`5`,x2:`12`,y2:`19`}),(0,W.jsx)(`polyline`,{points:`19 12 12 19 5 12`})]}),e),Paperclip:e=>wS((0,W.jsx)(`path`,{d:`M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48`}),e),Folder:e=>wS((0,W.jsx)(`path`,{d:`M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z`}),e),Project:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`polygon`,{points:`12 2 2 7 12 12 22 7 12 2`}),(0,W.jsx)(`polyline`,{points:`2 17 12 22 22 17`}),(0,W.jsx)(`polyline`,{points:`2 12 12 17 22 12`})]}),e),File:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z`}),(0,W.jsx)(`polyline`,{points:`14 2 14 8 20 8`})]}),e),ChevronRight:e=>wS((0,W.jsx)(`polyline`,{points:`9 18 15 12 9 6`}),e),Play:e=>wS((0,W.jsx)(`polygon`,{points:`6 4 20 12 6 20 6 4`}),e),Pause:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`rect`,{x:`6`,y:`4`,width:`4`,height:`16`,rx:`1`}),(0,W.jsx)(`rect`,{x:`14`,y:`4`,width:`4`,height:`16`,rx:`1`})]}),e),SkipBack:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`polygon`,{points:`19 20 9 12 19 4 19 20`}),(0,W.jsx)(`line`,{x1:`5`,y1:`19`,x2:`5`,y2:`5`})]}),e),SkipForward:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`polygon`,{points:`5 4 15 12 5 20 5 4`}),(0,W.jsx)(`line`,{x1:`19`,y1:`5`,x2:`19`,y2:`19`})]}),e),Music:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M9 18V5l12-2v13`}),(0,W.jsx)(`circle`,{cx:`6`,cy:`18`,r:`3`}),(0,W.jsx)(`circle`,{cx:`18`,cy:`16`,r:`3`})]}),e),Speaker:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M11 5 6 9H2v6h4l5 4V5z`}),(0,W.jsx)(`path`,{d:`M15.54 8.46a5 5 0 0 1 0 7.07`}),(0,W.jsx)(`path`,{d:`M19.07 4.93a10 10 0 0 1 0 14.14`})]}),e),Film:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`rect`,{x:`2`,y:`2`,width:`20`,height:`20`,rx:`2.18`,ry:`2.18`}),(0,W.jsx)(`line`,{x1:`7`,y1:`2`,x2:`7`,y2:`22`}),(0,W.jsx)(`line`,{x1:`17`,y1:`2`,x2:`17`,y2:`22`}),(0,W.jsx)(`line`,{x1:`2`,y1:`12`,x2:`22`,y2:`12`}),(0,W.jsx)(`line`,{x1:`2`,y1:`7`,x2:`7`,y2:`7`}),(0,W.jsx)(`line`,{x1:`2`,y1:`17`,x2:`7`,y2:`17`}),(0,W.jsx)(`line`,{x1:`17`,y1:`17`,x2:`22`,y2:`17`}),(0,W.jsx)(`line`,{x1:`17`,y1:`7`,x2:`22`,y2:`7`})]}),e),Image:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,ry:`2`}),(0,W.jsx)(`circle`,{cx:`8.5`,cy:`8.5`,r:`1.5`}),(0,W.jsx)(`polyline`,{points:`21 15 16 10 5 21`})]}),e),ExternalLink:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`}),(0,W.jsx)(`polyline`,{points:`15 3 21 3 21 9`}),(0,W.jsx)(`line`,{x1:`10`,y1:`14`,x2:`21`,y2:`3`})]}),e),ExpandAll:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`polyline`,{points:`7 5 12 10 17 5`}),(0,W.jsx)(`polyline`,{points:`7 13 12 18 17 13`})]}),e),CollapseAll:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`polyline`,{points:`7 11 12 6 17 11`}),(0,W.jsx)(`polyline`,{points:`7 19 12 14 17 19`})]}),e),Palette:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M12 3a9 9 0 1 0 0 18c.9 0 1.6-.7 1.6-1.6 0-.4-.2-.8-.4-1.1-.3-.3-.4-.7-.4-1.1 0-.9.7-1.6 1.6-1.6H16a5 5 0 0 0 5-5c0-3.9-4-7.6-9-7.6Z`}),(0,W.jsx)(`circle`,{cx:`7.5`,cy:`11.5`,r:`1`}),(0,W.jsx)(`circle`,{cx:`10.5`,cy:`7.5`,r:`1`}),(0,W.jsx)(`circle`,{cx:`15.5`,cy:`8.5`,r:`1`})]}),e),Bot:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`rect`,{x:`3`,y:`11`,width:`18`,height:`10`,rx:`2`}),(0,W.jsx)(`circle`,{cx:`12`,cy:`5`,r:`2`}),(0,W.jsx)(`path`,{d:`M12 7v4`}),(0,W.jsx)(`line`,{x1:`8`,y1:`16`,x2:`8`,y2:`16`}),(0,W.jsx)(`line`,{x1:`16`,y1:`16`,x2:`16`,y2:`16`})]}),e),Trash:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`polyline`,{points:`3 6 5 6 21 6`}),(0,W.jsx)(`path`,{d:`M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6`}),(0,W.jsx)(`path`,{d:`M10 11v6M14 11v6`}),(0,W.jsx)(`path`,{d:`M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2`})]}),e),Refresh:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`polyline`,{points:`23 4 23 10 17 10`}),(0,W.jsx)(`path`,{d:`M20.49 15a9 9 0 1 1-2.12-9.36L23 10`})]}),e),Search:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`circle`,{cx:`11`,cy:`11`,r:`8`}),(0,W.jsx)(`line`,{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`})]}),e),Filter:e=>wS((0,W.jsx)(`polygon`,{points:`22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3`}),e),Shield:e=>wS((0,W.jsx)(`path`,{d:`M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z`}),e),Coins:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`ellipse`,{cx:`8`,cy:`6`,rx:`5`,ry:`2.5`}),(0,W.jsx)(`path`,{d:`M3 6v4c0 1.4 2.2 2.5 5 2.5s5-1.1 5-2.5V6`}),(0,W.jsx)(`path`,{d:`M3 10v4c0 1.4 2.2 2.5 5 2.5 1 0 1.9-.13 2.7-.36`}),(0,W.jsx)(`circle`,{cx:`16`,cy:`15`,r:`5`}),(0,W.jsx)(`path`,{d:`M16 13v4M14.5 15h3`})]}),e),Lock:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`rect`,{x:`5`,y:`11`,width:`14`,height:`9`,rx:`2`}),(0,W.jsx)(`path`,{d:`M8 11V7a4 4 0 0 1 8 0v4`})]}),e),Fork:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`circle`,{cx:`12`,cy:`18`,r:`3`}),(0,W.jsx)(`circle`,{cx:`6`,cy:`6`,r:`3`}),(0,W.jsx)(`circle`,{cx:`18`,cy:`6`,r:`3`}),(0,W.jsx)(`path`,{d:`M18 9a9 9 0 0 1-9 9M6 9a9 9 0 0 0 9 9`})]}),e),Edit:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`}),(0,W.jsx)(`path`,{d:`M18.5 2.5a2.12 2.12 0 0 1 3 3L12 15l-4 1 1-4z`})]}),e),Upload:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`}),(0,W.jsx)(`polyline`,{points:`17 8 12 3 7 8`}),(0,W.jsx)(`line`,{x1:`12`,y1:`3`,x2:`12`,y2:`15`})]}),e),Download:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`}),(0,W.jsx)(`polyline`,{points:`7 10 12 15 17 10`}),(0,W.jsx)(`line`,{x1:`12`,y1:`15`,x2:`12`,y2:`3`})]}),e),Info:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,W.jsx)(`line`,{x1:`12`,y1:`16`,x2:`12`,y2:`12`}),(0,W.jsx)(`line`,{x1:`12`,y1:`8`,x2:`12.01`,y2:`8`})]}),e),Panel:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`}),(0,W.jsx)(`line`,{x1:`15`,y1:`3`,x2:`15`,y2:`21`})]}),e),LogIn:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4`}),(0,W.jsx)(`polyline`,{points:`10 17 15 12 10 7`}),(0,W.jsx)(`line`,{x1:`15`,y1:`12`,x2:`3`,y2:`12`})]}),e),Globe:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,W.jsx)(`line`,{x1:`2`,y1:`12`,x2:`22`,y2:`12`}),(0,W.jsx)(`path`,{d:`M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z`})]}),e),Monitor:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`rect`,{x:`2`,y:`3`,width:`20`,height:`14`,rx:`2`}),(0,W.jsx)(`line`,{x1:`8`,y1:`21`,x2:`16`,y2:`21`}),(0,W.jsx)(`line`,{x1:`12`,y1:`17`,x2:`12`,y2:`21`})]}),e),Bell:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M18 8a6 6 0 0 0-12 0c0 7-3 9-3 9h18s-3-2-3-9`}),(0,W.jsx)(`path`,{d:`M13.73 21a2 2 0 0 1-3.46 0`})]}),e),Sliders:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`line`,{x1:`4`,y1:`21`,x2:`4`,y2:`14`}),(0,W.jsx)(`line`,{x1:`4`,y1:`10`,x2:`4`,y2:`3`}),(0,W.jsx)(`line`,{x1:`12`,y1:`21`,x2:`12`,y2:`12`}),(0,W.jsx)(`line`,{x1:`12`,y1:`8`,x2:`12`,y2:`3`}),(0,W.jsx)(`line`,{x1:`20`,y1:`21`,x2:`20`,y2:`16`}),(0,W.jsx)(`line`,{x1:`20`,y1:`12`,x2:`20`,y2:`3`}),(0,W.jsx)(`line`,{x1:`1`,y1:`14`,x2:`7`,y2:`14`}),(0,W.jsx)(`line`,{x1:`9`,y1:`8`,x2:`15`,y2:`8`}),(0,W.jsx)(`line`,{x1:`17`,y1:`16`,x2:`23`,y2:`16`})]}),e),Pin:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M12 17v5`}),(0,W.jsx)(`path`,{d:`M9 10.76V6h6v4.76a2 2 0 0 0 1.11 1.79l1.78.9A2 2 0 0 1 19 15.24V16H5v-.76a2 2 0 0 1 1.11-1.79l1.78-.9A2 2 0 0 0 9 10.76z`}),(0,W.jsx)(`path`,{d:`M8 3h8`})]}),e),PanelLeft:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`16`,rx:`2`}),(0,W.jsx)(`line`,{x1:`9`,y1:`4`,x2:`9`,y2:`20`})]}),e),Columns:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`16`,rx:`2`}),(0,W.jsx)(`line`,{x1:`12`,y1:`4`,x2:`12`,y2:`20`})]}),e),WindowOut:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M14 4h6v6`}),(0,W.jsx)(`line`,{x1:`20`,y1:`4`,x2:`11`,y2:`13`}),(0,W.jsx)(`path`,{d:`M18 14v4a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4`})]}),e),GitBranch:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`line`,{x1:`6`,y1:`3`,x2:`6`,y2:`15`}),(0,W.jsx)(`circle`,{cx:`18`,cy:`6`,r:`3`}),(0,W.jsx)(`circle`,{cx:`6`,cy:`18`,r:`3`}),(0,W.jsx)(`path`,{d:`M18 9a9 9 0 0 1-9 9`})]}),e),Plug:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M12 22v-5`}),(0,W.jsx)(`path`,{d:`M9 7V2M15 7V2`}),(0,W.jsx)(`path`,{d:`M6 7h12v4a6 6 0 0 1-12 0z`})]}),e),Mail:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`rect`,{x:`3`,y:`5`,width:`18`,height:`14`,rx:`2`}),(0,W.jsx)(`polyline`,{points:`3 7 12 13 21 7`})]}),e),Chats:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M14 9a2 2 0 0 1-2 2H6l-3 3V5a2 2 0 0 1 2-2h7a2 2 0 0 1 2 2z`}),(0,W.jsx)(`path`,{d:`M18 9h1a2 2 0 0 1 2 2v9l-3-3h-6a2 2 0 0 1-2-2v-1`})]}),e),Lightbulb:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M9 18h6`}),(0,W.jsx)(`path`,{d:`M10 22h4`}),(0,W.jsx)(`path`,{d:`M15.09 14c.18-.98.65-1.74 1.41-2.5A4.65 4.65 0 0 0 18 8 6 6 0 0 0 6 8c0 1 .23 2.23 1.5 3.5A4.61 4.61 0 0 1 8.91 14`})]}),e),StickyNote:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M15.5 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8.5L15.5 3z`}),(0,W.jsx)(`path`,{d:`M15 3v6h6`}),(0,W.jsx)(`path`,{d:`M7 13h6`}),(0,W.jsx)(`path`,{d:`M7 17h4`})]}),e),Clipboard:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`rect`,{x:`8`,y:`2`,width:`8`,height:`4`,rx:`1`}),(0,W.jsx)(`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`}),(0,W.jsx)(`path`,{d:`m9 14 2 2 4-4`})]}),e),Link:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`}),(0,W.jsx)(`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`})]}),e),Gallery:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`rect`,{x:`7`,y:`3`,width:`14`,height:`14`,rx:`2`}),(0,W.jsx)(`circle`,{cx:`11.5`,cy:`7.5`,r:`1.2`}),(0,W.jsx)(`path`,{d:`m21 13-3.5-3.5L10 17`}),(0,W.jsx)(`path`,{d:`M3 7v12a2 2 0 0 0 2 2h12`})]}),e)},TS={primary:`bg-accent text-accent-fg hover:opacity-90 border-transparent`,inverse:`bg-inverse-bg text-inverse-fg hover:opacity-90 border-transparent`,secondary:`bg-surface-2 text-fg hover:bg-surface-3 border-border`,ghost:`bg-transparent text-fg-muted hover:bg-surface-2 hover:text-fg border-transparent`,danger:`bg-danger-soft text-danger hover:opacity-90 border-transparent`};function q({variant:e=`secondary`,size:t=`md`,busy:n,className:r,children:i,disabled:a,...o}){return(0,W.jsxs)(`button`,{type:`button`,...o,disabled:a||n,className:U(`inline-flex items-center gap-1.5 rounded-md border font-medium transition-colors disabled:opacity-50 disabled:cursor-not-allowed whitespace-nowrap`,t===`sm`?`px-2 py-1 text-xs`:`px-3 py-1.5 text-sm`,TS[e],r),children:[n?(0,W.jsx)(K.Spinner,{className:`w-3.5 h-3.5`}):null,i]})}function ES({label:e,className:t,children:n,...r}){return(0,W.jsx)(`button`,{type:`button`,"aria-label":e,title:e,...r,className:U(`inline-flex items-center justify-center rounded-md p-1.5 text-fg-muted hover:bg-surface-2 hover:text-fg disabled:opacity-50`,t),children:n})}function DS({label:e,details:t}){let n=(0,v.useRef)(null),[r,i]=(0,v.useState)(null),a=()=>{let e=n.current?.getBoundingClientRect();if(!e||typeof window>`u`)return;let t=Math.max(8,Math.min(e.left-12,window.innerWidth-320-8)),r=e.bottom+6,a=r+180>window.innerHeight?Math.max(8,e.top-186):r;i({left:t,top:a})},o=()=>i(null);return(0,W.jsxs)(`span`,{ref:n,className:`inline-flex align-middle`,onMouseEnter:a,onMouseLeave:o,onFocus:a,onBlur:o,onKeyDown:e=>{e.key!==`Escape`||!r||(e.stopPropagation(),o())},children:[(0,W.jsx)(`span`,{tabIndex:0,role:`button`,"aria-label":`About ${e}`,className:`cursor-help rounded text-fg-faint hover:text-fg focus:text-fg focus:outline-none`,"data-testid":`info-tip`,onClick:e=>{e.preventDefault(),e.stopPropagation(),a()},children:(0,W.jsx)(K.Info,{className:`w-3.5 h-3.5`})}),r&&typeof document<`u`?(0,bS.createPortal)((0,W.jsx)(`div`,{role:`tooltip`,className:`fixed z-[60] w-80 rounded-md border border-border bg-surface px-3 py-2 text-xs leading-snug text-fg shadow-lg`,style:{left:r.left,top:r.top},"data-testid":`info-tip-card`,children:t}),document.body):null]})}function OS({items:e}){return(0,W.jsx)(`ul`,{className:`list-disc space-y-1 pl-4`,children:e.map(e=>(0,W.jsx)(`li`,{children:e},e))})}function kS({label:e,hint:t,details:n,children:r,className:i}){return(0,W.jsxs)(`label`,{className:U(`flex flex-col gap-1 text-sm`,i),children:[(0,W.jsxs)(`span`,{className:`flex items-center gap-1.5 font-medium text-fg`,children:[e,n&&n.length>0?(0,W.jsx)(DS,{label:e,details:(0,W.jsx)(OS,{items:n})}):null]}),r,t?(0,W.jsx)(`span`,{className:`text-xs text-fg-faint`,children:t}):null]})}var AS=`w-full rounded-md border border-border bg-surface px-2.5 py-1.5 text-sm text-fg placeholder:text-fg-faint focus:border-accent focus:outline-none`,jS=AS;function MS({tone:e=`neutral`,children:t,className:n}){return(0,W.jsx)(`span`,{className:U(`inline-flex items-center rounded px-1.5 py-0.5 text-[11px] font-medium leading-4`,{neutral:`bg-surface-2 text-fg-muted`,ok:`bg-ok-soft text-ok`,warn:`bg-warn-soft text-warn`,danger:`bg-danger-soft text-danger`,accent:`bg-accent-soft text-accent`,think:`bg-think-soft text-think`}[e],n),children:t})}function NS({open:e,title:t,onClose:n,children:r,footer:i,wide:a,full:o}){let s=(0,v.useRef)(null);return(0,v.useEffect)(()=>{if(!e)return;let t=document.activeElement,r=s.current;(r?.querySelector(`input, select, textarea, button:not([data-close])`)??r)?.focus();let i=e=>{e.key===`Escape`&&(e.stopPropagation(),n())};return document.addEventListener(`keydown`,i),()=>{document.removeEventListener(`keydown`,i),t?.focus?.()}},[e,n]),e?(0,bS.createPortal)((0,W.jsx)(`div`,{className:`fixed inset-0 z-40 flex items-end sm:items-center justify-center bg-black/40 p-0 sm:p-4`,onMouseDown:e=>e.target===e.currentTarget&&n(),children:(0,W.jsxs)(`div`,{ref:s,role:`dialog`,"aria-modal":`true`,"aria-label":t,tabIndex:-1,className:U(`flex max-h-[95vh] w-full flex-col rounded-t-xl sm:rounded-xl border border-border bg-surface shadow-lg outline-none`,o?`h-[92vh] sm:max-w-[min(96vw,1600px)]`:a?`sm:max-w-3xl`:`sm:max-w-lg`),children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border px-4 py-3`,children:[(0,W.jsx)(`h2`,{className:`text-base font-semibold`,children:t}),(0,W.jsx)(ES,{label:`Close`,"data-close":!0,onClick:n,children:(0,W.jsx)(K.X,{})})]}),(0,W.jsx)(`div`,{className:o?`flex min-h-0 flex-1 flex-col overflow-hidden px-3 py-2`:`flex-1 overflow-y-auto px-4 py-3`,children:r}),i?(0,W.jsx)(`div`,{className:`flex flex-wrap items-center justify-end gap-2 border-t border-border px-4 py-3`,children:i}):null]})}),document.body):null}function PS({checked:e,onChange:t,label:n,hint:r,details:i,disabled:a,testId:o}){return(0,W.jsxs)(`label`,{className:U(`flex items-start justify-between gap-3 py-2`,a&&`opacity-60`),...o?{"data-testid":o}:{},children:[(0,W.jsxs)(`span`,{className:`min-w-0`,children:[(0,W.jsxs)(`span`,{className:`flex items-center gap-1.5 text-sm font-medium text-fg`,children:[n,i&&i.length>0?(0,W.jsx)(DS,{label:n,details:(0,W.jsx)(OS,{items:i})}):null]}),r?(0,W.jsx)(`span`,{className:`mt-0.5 block text-xs text-fg-faint`,children:r}):null]}),(0,W.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e,"aria-label":n,disabled:a,onClick:()=>t(!e),className:U(`relative mt-0.5 h-5 w-9 shrink-0 rounded-full border transition-colors`,e?`border-accent bg-accent`:`border-fg-faint bg-surface-2`),children:(0,W.jsx)(`span`,{className:U(`absolute top-0.5 h-3.5 w-3.5 rounded-full transition-all`,e?`left-[1.15rem] bg-white`:`left-0.5 bg-fg-muted`)})})]})}function FS({value:e,options:t,onChange:n,label:r}){return(0,W.jsx)(`div`,{className:`inline-flex rounded-md border border-border bg-surface-2 p-0.5`,role:`radiogroup`,"aria-label":r,children:t.map(t=>(0,W.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":e===t.value,onClick:()=>n(t.value),className:U(`rounded px-2.5 py-1 text-xs font-medium transition-colors`,e===t.value?`bg-surface text-fg shadow-sm`:`text-fg-muted hover:text-fg`),children:t.label},t.value))})}function IS({icon:e,title:t,hint:n,action:r}){return(0,W.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-2 p-8 text-center text-fg-muted`,children:[e?(0,W.jsx)(`div`,{className:`text-fg-faint`,children:e}):null,(0,W.jsx)(`div`,{className:`text-base font-medium text-fg`,children:t}),n?(0,W.jsx)(`div`,{className:`max-w-md text-sm`,children:n}):null,r?(0,W.jsx)(`div`,{className:`mt-2`,children:r}):null]})}function LS({open:e,title:t,message:n,confirmLabel:r=`Delete`,onConfirm:i,onClose:a}){return(0,W.jsx)(NS,{open:e,title:t,onClose:a,footer:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{"data-close":!0,onClick:a,children:`Cancel`}),(0,W.jsx)(q,{variant:`danger`,"data-testid":`confirm-dialog-accept`,onClick:()=>{i(),a()},children:r})]}),children:(0,W.jsx)(`div`,{className:`text-sm text-fg-muted`,children:n})})}function Gte({open:e,name:t,busy:n=!1,onSave:r,onDiscard:i,onClose:a}){return(0,W.jsx)(NS,{open:e,title:t?`Save changes to ${t}?`:`Save changes?`,onClose:n?()=>void 0:a,footer:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{"data-close":!0,onClick:a,disabled:n,"data-testid":`save-changes-cancel`,children:`Cancel`}),(0,W.jsx)(q,{onClick:i,disabled:n,"data-testid":`save-changes-discard`,children:`Don't save`}),(0,W.jsx)(q,{variant:`primary`,busy:n,onClick:r,"data-testid":`save-changes-save`,children:`Save`})]}),children:(0,W.jsxs)(`div`,{className:`text-sm text-fg-muted`,children:[t?`${t} has unsaved changes.`:`This file has unsaved changes.`,` Save them before closing, or they are lost.`]})})}function RS({open:e,title:t,label:n,initialValue:r=``,password:i=!1,submitLabel:a=`Save`,onSubmit:o,onClose:s}){let[c,l]=(0,v.useState)(r);(0,v.useEffect)(()=>{e&&l(r)},[e,r]);let u=()=>{let e=c.trim();e&&(o(e),s())};return(0,W.jsx)(NS,{open:e,title:t,onClose:s,footer:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{"data-close":!0,onClick:s,children:`Cancel`}),(0,W.jsx)(q,{variant:`primary`,"data-testid":`prompt-dialog-submit`,onClick:u,children:a})]}),children:(0,W.jsx)(kS,{label:n,children:(0,W.jsx)(`input`,{className:AS,type:i?`password`:`text`,value:c,"data-testid":`prompt-dialog-input`,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),u())}})})})}var zS=[{id:`24h`,label:`Last 24 hours`,count:24,unit:`hour`},{id:`7d`,label:`7 days`,count:7,unit:`day`},{id:`30d`,label:`30 days`,count:30,unit:`day`},{id:`90d`,label:`90 days`,count:90,unit:`day`}],Kte=864e5;function BS(e){let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!t)return null;let n=new Date(Number(t[1]),Number(t[2])-1,Number(t[3]));return Number.isFinite(n.getTime())&&n.getDate()===Number(t[3])?n:null}function VS(e){let t=e=>String(e).padStart(2,`0`);return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`}function HS(e){let t=BS(e.from),n=BS(e.to);return!t||!n||n.getTime()<t.getTime()?null:Math.round((n.getTime()-t.getTime())/Kte)+1}function qte(e,t){if(e===`24h`)return[`hour`];if(e===`7d`||e===`30d`)return[`day`,`hour`];if(e===`90d`)return[`day`];let n=t?HS(t):null;return n===null||n>zm.maxHourlyRangeDays?[`day`]:n<=2?[`hour`,`day`]:[`day`,`hour`]}function US(e){let t=BS(e.from),n=BS(e.to);return!t||!n?`Pick a start and an end date.`:n.getTime()<t.getTime()?`The end date is before the start date.`:HS(e)>zm.maxRangeDays?`A range can cover at most ${zm.maxRangeDays} days.`:null}function Jte(e,t,n,r){if(e===`custom`){if(!r||US(r))return null;let e=BS(r.from),n=BS(r.to),i=new Date(n.getFullYear(),n.getMonth(),n.getDate()+1);return{from:e.toISOString(),to:i.toISOString(),bucket:t}}let i=zS.find(t=>t.id===e),a;return i.unit===`hour`?(a=new Date(n.getTime()),a.setMinutes(0,0,0),a=new Date(a.getTime()-(i.count-1)*36e5)):a=new Date(n.getFullYear(),n.getMonth(),n.getDate()-(i.count-1)),{from:a.toISOString(),to:n.toISOString(),bucket:t}}function Yte(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||`UTC`}catch{return`UTC`}}function WS(e){return!Number.isFinite(e)||e===0?`0`:e.toLocaleString(`en-US`,{maximumFractionDigits:3})}function Xte(e){return!Number.isFinite(e)||e===0?`0`:e.toLocaleString(`en-US`,{maximumFractionDigits:Math.abs(e)>=100?0:3})}function GS(e){return Number.isFinite(e)?e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e4?`${Math.round(e/1e3)}k`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(Math.round(e)):`0`}function KS(e,t){if(!(t>0)||!(e>0))return`0%`;let n=e/t*100;return n<1?`<1%`:n>99&&e<t?`>99%`:`${Math.round(n)}%`}function qS(e){return e.inputTokens+e.cacheReadTokens+e.cacheWriteTokens+e.outputTokens}var Zte={image:[`image`,`images`],second:[`second`,`seconds`],video:[`video`,`videos`],character:[`character`,`characters`],voice:[`voice`,`voices`],token:[`token`,`tokens`]};function Qte(e,t){let[n,r]=Zte[e]??[e,`${e}s`];return t===1?`per ${n}`:e===`second`&&t===60?`per minute`:e===`second`&&t===3600?`per hour`:t===1e6?`per 1M ${r}`:t>=1e3&&t%1e3==0?`per ${t/1e3}k ${r}`:`per ${t.toLocaleString(`en-US`)} ${r}`}var JS={textInput:`text in`,cachedTextInput:`cached text in`,audioInput:`audio in`,cachedAudioInput:`cached audio in`,imageInput:`image in`,cachedImageInput:`cached image in`,output:`out`,audioOutput:`audio out`};function $te(e,t){if(!e)return null;let n=e=>e==null||!Number.isFinite(e)?null:Xte(e*t);if(e.kind===`tokens`){if(e.free)return{main:`Free`,detail:[]};let t=[n(e.inputPerMTok)===null?null:`in ${n(e.inputPerMTok)}`,n(e.outputPerMTok)===null?null:`out ${n(e.outputPerMTok)}`].filter(e=>e!==null);if(t.length===0)return null;let r=[n(e.cacheReadPerMTok)===null?null:`cache read ${n(e.cacheReadPerMTok)}`,n(e.cacheWritePerMTok)===null?null:`cache write ${n(e.cacheWritePerMTok)}`,e.cacheWrite1hPerMTok===void 0?null:`1-hour cache write ${n(e.cacheWrite1hPerMTok)}`,e.webSearchPer1k===void 0?null:`web search ${n(e.webSearchPer1k)} per 1,000`,e.cheaperUnderTokens===void 0?null:`cheaper for prompts under ${GS(e.cheaperUnderTokens)} tokens`,e.offPeak?`cheaper off-peak`:null].filter(e=>e!==null);return{main:`${t.join(` · `)} credits per 1M tokens`,detail:r}}let r=Object.entries(e.tiers),i=Qte(e.unit,e.per),a;a=e.unit===`token`&&e.tokens?`${Object.entries(e.tokens).map(([e,t])=>`${JS[e]??e} ${n(t)}`).join(` · `)} credits per 1M tokens`:r.length===1?`${n(r[0][1])} credits ${i}`:`${r.map(([e,t])=>`${e} ${n(t)}`).join(` · `)} credits ${i}`;let o=[e.inputImage===void 0?null:`each input image ${n(e.inputImage)}`,e.perTextInput===void 0?null:`each text message ${n(e.perTextInput)}`,e.unit!==`token`&&e.tokens?`tokens: ${Object.entries(e.tokens).map(([e,t])=>`${JS[e]??e} ${n(t)}`).join(` · `)} per 1M`:null].filter(e=>e!==null);return{main:a,detail:o}}function YS(e){return e.displayName?.trim()||e.model}var XS=`__other__`;function ene(e){return e<7?`var(--viz-${e+1})`:`var(--viz-other)`}function ZS(e,t,n){let r=e=>e?n===`credits`?e.credits:e.requests:0,i=(t===`model`?e.models.map(e=>({key:e.key,label:YS(e),amount:n===`credits`?e.credits:e.requests})):e.purposes.map(t=>({key:t.purpose,label:Rm(t.purpose,e.surface),amount:n===`credits`?t.credits:t.requests}))).filter(e=>e.amount>0),a=i.slice(0,7),o=new Set(i.slice(7).map(e=>e.key)),s=a.map((e,t)=>({key:e.key,label:e.label,color:ene(t)}));o.size>0&&s.push({key:XS,label:`Other (${o.size})`,color:`var(--viz-other)`});let c=0;return{series:s,columns:e.series.map(e=>{let n=t===`model`?e.models:e.purposes,i=[];for(let e of a){let t=r(n[e.key]);t>0&&i.push({series:e.key,value:t})}let s=0;for(let e of o)s+=r(n[e]);s>0&&i.push({series:XS,value:s});let l=i.reduce((e,t)=>e+t.value,0);return l>c&&(c=l),{key:e.key,at:e.at,total:l,requests:e.requests,credits:e.credits,parts:i}}),max:c}}function tne(e,t=4){if(!(e>0))return[0];let n=e/t,r=10**Math.floor(Math.log10(n)),i=[1,2,2.5,5,10].map(e=>e*r).find(e=>e>=n)??n,a=[];for(let t=0;t<e+i*1e-9;t+=i)a.push(Number(t.toPrecision(12)));return a[a.length-1]<e&&a.push(Number((a.length*i).toPrecision(12))),a}var nne=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`];function QS(e,t,n=!0){let r=/^(\d{4})-(\d{2})-(\d{2})(?:T(\d{2}):(\d{2}))?$/.exec(e);if(!r)return e;let i=`${Number(r[3])} ${nne[Number(r[2])-1]??r[2]}`;return t===`day`||r[4]===void 0?i:n?`${i} ${r[4]}:${r[5]}`:`${r[4]}:${r[5]}`}function rne(e,t=4){if(e<=0)return[];if(e<=t)return[...Array(e).keys()];let n=new Set;for(let r=0;r<t;r++)n.add(Math.round(r*(e-1)/(t-1)));return[...n]}function ine(e){return e===`api`?`API`:`Code agent`}function $S(e){return e instanceof sg?e.code===`account_required`||e.isUnauthorized?{title:`Sign in to see your usage`,hint:`Usage belongs to your OonaCode account — sign in on the Account tab.`,retry:!1}:e.code===`gateway_unreachable`||e.code===`network`?{title:`Can’t reach OonaCode’s server`,hint:`Your usage is read from your account on the server. Check the connection and try again.`,retry:!0}:e.status===404||e.code===`not_found`?{title:`Update OonaCode to see your usage`,hint:`This PC’s OonaCode service is older than the Usage tab.`,retry:!1}:{title:`Usage could not be read`,hint:e.message,retry:!0}:{title:`Usage could not be read`,hint:e instanceof Error?e.message:String(e),retry:!0}}var ane={agent:`Everything your PCs ran: the app, the terminal, your phone and Telegram — chats, their subagents and background work.`,api:`Your own code: API keys, the agent API’s runs, images, video and voice.`};function eC(e){return U(`rounded-md border px-2.5 py-1 text-xs font-medium transition-colors`,e?`border-accent bg-accent-soft text-accent`:`border-border text-fg-muted hover:text-fg`)}function one(){let{state:e,api:t}=G(),n=e.account?.loggedIn===!0,r=(0,v.useMemo)(Yte,[]),[i,a]=(0,v.useState)(`agent`),[o,s]=(0,v.useState)(`30d`),[c,l]=(0,v.useState)(()=>{let e=new Date;return{from:VS(new Date(e.getFullYear(),e.getMonth(),e.getDate()-6)),to:VS(e)}}),u=qte(o,c),[d,f]=(0,v.useState)(null),p=d&&u.includes(d)?d:u[0],[m,h]=(0,v.useState)(`model`),[g,_]=(0,v.useState)(`credits`),[y,b]=(0,v.useState)(0),[x,S]=(0,v.useState)(null),[C,w]=(0,v.useState)(!1),[T,E]=(0,v.useState)(null),D=o===`custom`?US(c):null;return(0,v.useEffect)(()=>{if(!n)return;if(!t.accountUsage){E($S(new sg(`not_found`,404,`no usage route`)));return}let e=Jte(o,p,new Date,c);if(!e)return;let a=!0;return w(!0),t.accountUsage({surface:i,...e,tz:r}).then(e=>{a&&(S(e),E(null))},e=>{a&&E($S(e))}).finally(()=>{a&&w(!1)}),()=>{a=!1}},[t,n,i,o,p,c.from,c.to,r,y]),n?(0,W.jsxs)(`section`,{"data-testid":`usage-tab`,className:`min-w-0 space-y-4`,children:[(0,W.jsxs)(`div`,{className:`space-y-2`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,W.jsx)(FS,{label:`Which usage`,value:i,options:[{value:`agent`,label:`Code agent`},{value:`api`,label:`API`}],onChange:a}),(0,W.jsx)(ES,{label:`Refresh`,onClick:()=>b(e=>e+1),disabled:C,"data-testid":`usage-refresh`,children:C?(0,W.jsx)(K.Spinner,{className:`h-3.5 w-3.5`}):(0,W.jsx)(K.Refresh,{className:`h-3.5 w-3.5`})})]}),(0,W.jsx)(`p`,{className:`text-xs text-fg-muted`,"data-testid":`usage-surface-hint`,children:ane[i]}),(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,role:`group`,"aria-label":`Range`,children:[zS.map(e=>(0,W.jsx)(`button`,{type:`button`,className:eC(o===e.id),"aria-pressed":o===e.id,"data-testid":`usage-range-${e.id}`,onClick:()=>s(e.id),children:e.label},e.id)),(0,W.jsx)(`button`,{type:`button`,className:eC(o===`custom`),"aria-pressed":o===`custom`,"data-testid":`usage-range-custom`,onClick:()=>s(`custom`),children:`Custom…`})]}),o===`custom`?(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,W.jsxs)(`label`,{className:`flex min-w-0 items-center gap-1.5 text-xs text-fg-muted`,children:[`From`,(0,W.jsx)(`input`,{type:`date`,className:U(AS,`w-auto min-w-0 py-1 text-xs`),value:c.from,max:c.to||void 0,"data-testid":`usage-from`,onChange:e=>l(t=>({...t,from:e.target.value}))})]}),(0,W.jsxs)(`label`,{className:`flex min-w-0 items-center gap-1.5 text-xs text-fg-muted`,children:[`to`,(0,W.jsx)(`input`,{type:`date`,className:U(AS,`w-auto min-w-0 py-1 text-xs`),value:c.to,min:c.from||void 0,"data-testid":`usage-to`,onChange:e=>l(t=>({...t,to:e.target.value}))})]})]}):null,D?(0,W.jsx)(`p`,{className:`text-xs text-danger`,role:`alert`,children:D}):null,(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[u.length>1?(0,W.jsx)(FS,{label:`Bars`,value:p,options:u.slice().sort().reverse().map(e=>({value:e,label:e===`hour`?`By hour`:`By day`})),onChange:e=>f(e)}):null,(0,W.jsx)(FS,{label:`Stack by`,value:m,options:[{value:`model`,label:`Models`},{value:`purpose`,label:`Purposes`}],onChange:h}),(0,W.jsx)(FS,{label:`Measure`,value:g,options:[{value:`credits`,label:`Credits`},{value:`requests`,label:`Requests`}],onChange:_})]})]}),T?(0,W.jsxs)(`div`,{className:`rounded-md border border-border bg-surface-2 px-3 py-2.5 text-sm`,role:`alert`,"data-testid":`usage-error`,children:[(0,W.jsx)(`div`,{className:`font-medium`,children:T.title}),(0,W.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-muted`,children:T.hint}),T.retry?(0,W.jsx)(q,{size:`sm`,className:`mt-2`,onClick:()=>b(e=>e+1),children:`Try again`}):null]}):null,x===null&&C?(0,W.jsxs)(`div`,{className:`flex items-center gap-2 py-6 text-sm text-fg-muted`,"data-testid":`usage-loading`,children:[(0,W.jsx)(K.Spinner,{className:`h-4 w-4`}),` Reading your usage…`]}):null,x?(0,W.jsx)(`div`,{className:U(`min-w-0 space-y-4 transition-opacity`,C&&`opacity-60`),"aria-busy":C,"data-testid":`usage-body`,children:(0,W.jsx)(sne,{data:x,stackBy:m,metric:g})}):null]}):(0,W.jsxs)(`section`,{"data-testid":`usage-tab`,className:`py-6 text-center`,children:[(0,W.jsx)(`div`,{className:`text-sm font-medium`,children:`Sign in to see your usage`}),(0,W.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:`Usage belongs to your OonaCode account — sign in on the Account tab.`})]})}function sne({data:e,stackBy:t,metric:n}){let r=(0,v.useMemo)(()=>ZS(e,t,n),[e,t,n]),i=(0,v.useMemo)(()=>tC(ZS(e,`model`,n).series),[e,n]),a=(0,v.useMemo)(()=>tC(ZS(e,`purpose`,n).series),[e,n]),o=e.totals,s=o.requests===0;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-4`,"data-testid":`usage-totals`,children:[(0,W.jsx)(nC,{label:`Credits`,value:WS(o.credits),testId:`usage-total-credits`,children:`charged in this range`}),(0,W.jsx)(nC,{label:`Requests`,value:o.requests.toLocaleString(`en-US`),testId:`usage-total-requests`,children:[o.failedRequests>0?`${o.failedRequests.toLocaleString(`en-US`)} not served`:null,o.freeRequests>0?`${o.freeRequests.toLocaleString(`en-US`)} free`:null].filter(Boolean).join(` · `)||`model calls`}),(0,W.jsx)(nC,{label:`Tokens`,value:GS(qS(o)),testId:`usage-total-tokens`,children:`in ${GS(o.inputTokens)} · out ${GS(o.outputTokens)}`}),(0,W.jsx)(nC,{label:`Cache`,value:GS(o.cacheReadTokens+o.cacheWriteTokens),children:`read ${GS(o.cacheReadTokens)} · write ${GS(o.cacheWriteTokens)}`})]}),s?(0,W.jsxs)(`div`,{className:`rounded-md border border-dashed border-border px-3 py-6 text-center`,"data-testid":`usage-empty`,children:[(0,W.jsx)(`div`,{className:`text-sm font-medium`,children:`Nothing in this range`}),(0,W.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[`No `,ine(e.surface),` requests between these dates. Pick a longer range, or the other side above.`]})]}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`rounded-md border border-border p-3`,children:[(0,W.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-baseline justify-between gap-x-3 gap-y-1`,children:[(0,W.jsxs)(`h3`,{className:`text-sm font-semibold`,children:[n===`credits`?`Credits`:`Requests`,` by `,e.bucket]}),(0,W.jsxs)(`span`,{className:`text-[11px] text-fg-muted`,children:[`Times in `,e.tz]})]}),(0,W.jsx)(pne,{series:r.series,columns:r.columns,max:r.max,bucket:e.bucket,metric:n}),r.series.length>0?(0,W.jsx)(`ul`,{className:`mt-2 flex flex-wrap gap-x-3 gap-y-1`,"data-testid":`usage-legend`,children:r.series.map(e=>(0,W.jsxs)(`li`,{className:`inline-flex min-w-0 items-center gap-1.5 text-xs`,children:[(0,W.jsx)(rC,{color:e.color}),(0,W.jsx)(`span`,{className:`truncate text-fg-muted`,children:e.label})]},e.key))}):(0,W.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:n===`credits`?`Nothing charged in this range — every request was free or not served.`:`No requests in this range.`})]}),(0,W.jsx)(cne,{data:e,colors:i}),(0,W.jsx)(une,{data:e,colors:a})]}),(0,W.jsx)(`p`,{className:`text-[11px] text-fg-faint`,"data-testid":`usage-footnote`,children:`Credits are what your account was charged, request by request; a free model shows zero. Prices are today’s, in credits per 1M tokens; a past request settled at the price of its day. Every model and every purpose that ran is listed, and each list adds up to the totals.`})]})}function tC(e){return new Map(e.map(e=>[e.key,e.color]))}function nC({label:e,value:t,children:n,testId:r}){return(0,W.jsxs)(`div`,{className:`min-w-0 rounded-md border border-border px-3 py-2`,children:[(0,W.jsx)(`div`,{className:`text-[11px] text-fg-muted`,children:e}),(0,W.jsx)(`div`,{className:`truncate text-lg font-semibold tabular-nums`,"data-testid":r,children:t}),n?(0,W.jsx)(`div`,{className:`truncate text-[11px] text-fg-faint`,children:n}):null]})}function rC({color:e}){return e?(0,W.jsx)(`span`,{"aria-hidden":!0,className:`inline-block h-2.5 w-2.5 shrink-0 rounded-sm`,style:{background:e}}):(0,W.jsx)(`span`,{"aria-hidden":!0,className:`inline-block h-2.5 w-2.5 shrink-0 rounded-sm border border-border`})}function cne({data:e,colors:t}){return(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`h3`,{className:`mb-1.5 text-sm font-semibold`,children:`Models`}),(0,W.jsx)(`ul`,{className:`divide-y divide-border rounded-md border border-border`,"data-testid":`usage-models`,children:e.models.map(n=>(0,W.jsx)(lne,{m:n,data:e,color:t.get(n.key)??(t.has(`__other__`)&&n.credits>0?t.get(`__other__`):void 0)},n.key))})]})}function lne({m:e,data:t,color:n}){let r=$te(e.price,t.creditsPerUsd),i=YS(e),a=e.modality!==`chat`;return(0,W.jsxs)(`li`,{className:`min-w-0 px-3 py-2`,"data-testid":`usage-model-row`,"data-model":e.key,children:[(0,W.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,W.jsxs)(`div`,{className:`min-w-0`,children:[(0,W.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,W.jsx)(rC,{color:n}),(0,W.jsx)(`span`,{className:`min-w-0 break-words text-sm font-medium`,title:`${e.providerId} / ${e.model}`,children:i}),a?(0,W.jsx)(`span`,{className:`shrink-0 rounded bg-surface-2 px-1 text-[10px] text-fg-muted`,children:e.modality}):null]}),i===e.model?null:(0,W.jsx)(`div`,{className:`break-all pl-[18px] font-mono text-[10px] text-fg-faint`,children:e.model})]}),(0,W.jsxs)(`div`,{className:`shrink-0 text-right`,children:[(0,W.jsx)(`div`,{className:`text-sm font-semibold tabular-nums`,"data-testid":`usage-model-credits`,children:WS(e.credits)}),(0,W.jsx)(`div`,{className:`text-[11px] text-fg-muted`,children:KS(e.credits,t.totals.credits)})]})]}),(0,W.jsxs)(`div`,{className:`mt-1 flex flex-wrap gap-x-3 gap-y-0.5 text-[11px] text-fg-muted`,children:[(0,W.jsxs)(`span`,{children:[e.requests.toLocaleString(`en-US`),` requests`]}),e.failedRequests>0?(0,W.jsxs)(`span`,{children:[e.failedRequests,` not served`]}):null,e.freeRequests>0?(0,W.jsxs)(`span`,{children:[e.freeRequests,` free`]}):null,qS(e)>0?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`span`,{children:[`in `,GS(e.inputTokens)]}),(0,W.jsxs)(`span`,{children:[`cache read `,GS(e.cacheReadTokens)]}),(0,W.jsxs)(`span`,{children:[`cache write `,GS(e.cacheWriteTokens)]}),(0,W.jsxs)(`span`,{children:[`out `,GS(e.outputTokens)]})]}):null]}),(0,W.jsx)(`div`,{className:`mt-0.5 break-words text-[11px] text-fg-faint`,"data-testid":`usage-model-price`,children:r?[r.main,...r.detail].join(` · `):`Price: not in the price list (what it cost is above).`})]})}function une({data:e,colors:t}){let n=e.totals.credits;return(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`h3`,{className:`mb-1.5 text-sm font-semibold`,children:`What it was for`}),(0,W.jsx)(`ul`,{className:`space-y-2`,"data-testid":`usage-purposes`,children:e.purposes.map(r=>{let i=n>0?Math.min(100,r.credits/n*100):0;return(0,W.jsxs)(`li`,{className:`min-w-0`,"data-testid":`usage-purpose-row`,"data-purpose":r.purpose,children:[(0,W.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,W.jsxs)(`div`,{className:`min-w-0`,children:[(0,W.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-sm`,children:[(0,W.jsx)(rC,{color:t.get(r.purpose)??(r.credits>0?t.get(`__other__`):void 0)}),(0,W.jsx)(`span`,{className:`min-w-0 break-words font-medium`,children:Rm(r.purpose,e.surface)})]}),(0,W.jsxs)(`div`,{className:`text-[11px] text-fg-muted`,children:[vee(r.purpose,e.surface),` `,r.requests.toLocaleString(`en-US`),` `,`requests.`]})]}),(0,W.jsxs)(`div`,{className:`shrink-0 text-right`,children:[(0,W.jsx)(`div`,{className:`text-sm font-semibold tabular-nums`,"data-testid":`usage-purpose-credits`,children:WS(r.credits)}),(0,W.jsx)(`div`,{className:`text-[11px] text-fg-muted`,children:KS(r.credits,n)})]})]}),(0,W.jsx)(`div`,{className:`mt-1 h-1.5 overflow-hidden rounded-full bg-surface-2`,"aria-hidden":!0,children:(0,W.jsx)(`div`,{className:`h-full rounded-full bg-accent`,style:{width:`${i}%`}})})]},r.purpose)})})]})}var iC=180,dne=8,fne=2;function pne({series:e,columns:t,max:n,bucket:r,metric:i}){let a=(0,v.useRef)(null),[o,s]=(0,v.useState)(640),[c,l]=(0,v.useState)(null);(0,v.useEffect)(()=>{let e=a.current;if(!e)return;let t=()=>{let t=e.clientWidth;t>0&&s(t)};if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]),(0,v.useEffect)(()=>{c!==null&&c>=t.length&&l(null)},[c,t.length]);let u=tne(n),d=u[u.length-1]||1,f=e=>i===`credits`?WS(e):GS(e),p=Math.max(28,Math.max(...u.map(e=>f(e).length))*6+8),m=Math.max(40,o-p)/Math.max(1,t.length),h=Math.max(1,Math.min(24,m*.72)),g=e=>160-e/d*152,_=new Map(e.map(e=>[e.key,e.color])),y=new Map(e.map(e=>[e.key,e.label])),b=e=>{let n=a.current;if(!n)return;let r=e-n.getBoundingClientRect().left-p,i=Math.floor(r/m);l(i>=0&&i<t.length?i:null)},x=e=>{if(t.length!==0){if(e.key===`ArrowLeft`||e.key===`ArrowRight`){e.preventDefault();let n=e.key===`ArrowLeft`?-1:1;l(e=>Math.min(t.length-1,Math.max(0,(e??t.length)+n)))}else e.key===`Escape`&&c!==null&&(e.stopPropagation(),l(null))}},S=rne(t.length,o<420?3:5),C=c===null?void 0:t[c],w=Math.min(240,o),T=c===null?0:Math.min(Math.max(0,p+(c+.5)*m-w/2),Math.max(0,o-w));return(0,W.jsxs)(`div`,{ref:a,className:`relative min-w-0 select-none outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,tabIndex:0,role:`group`,"aria-label":`${i===`credits`?`Credits`:`Requests`} by ${r}; use the arrow keys to read each bar`,onKeyDown:x,onPointerMove:e=>{e.pointerType===`mouse`&&b(e.clientX)},onPointerDown:e=>b(e.clientX),onPointerLeave:e=>{e.pointerType===`mouse`&&l(null)},onBlur:()=>l(null),"data-testid":`usage-chart`,children:[(0,W.jsxs)(`svg`,{width:o,height:iC,viewBox:`0 0 ${o} ${iC}`,className:`block max-w-full`,"aria-hidden":!0,children:[u.map(e=>(0,W.jsxs)(`g`,{children:[(0,W.jsx)(`line`,{x1:p,x2:o,y1:g(e),y2:g(e),stroke:`var(--border)`,strokeWidth:1,shapeRendering:`crispEdges`}),(0,W.jsx)(`text`,{x:p-6,y:g(e),dy:`0.32em`,textAnchor:`end`,fontSize:10,fill:`var(--fg-muted)`,children:f(e)})]},e)),c===null?null:(0,W.jsx)(`rect`,{x:p+c*m,y:dne,width:m,height:152,fill:`var(--surface-2)`}),t.map((e,t)=>{let n=p+t*m+(m-h)/2,r=g(0);return(0,W.jsx)(`g`,{"data-testid":`usage-chart-column`,"data-total":e.total,children:e.parts.map((t,i)=>{let a=Math.max(t.value/d*152,+(i===e.parts.length-1)),o=i===e.parts.length-1,s=o?a:Math.max(0,a-fne),c=r-a;if(r-=a,s<=0)return null;let l=_.get(t.series)??`var(--viz-other)`;return o?(0,W.jsx)(`path`,{d:mne(n,c,h,s),fill:l},t.series):(0,W.jsx)(`rect`,{x:n,y:c+(a-s),width:h,height:s,fill:l},t.series)})},e.key)}),S.map((e,n)=>{let i=t[e];if(!i)return null;let a=p+(e+.5)*m,s=n===0?`start`:n===S.length-1?`end`:`middle`,c=s===`start`?Math.max(p,a-m/2):s===`end`?Math.min(o,a+m/2):a;return(0,W.jsx)(`text`,{x:c,y:176,textAnchor:s,fontSize:10,fill:`var(--fg-muted)`,children:QS(i.key,r,n===0||r===`day`||!hne(t[S[n-1]]?.key,i.key))},i.key)})]}),C?(0,W.jsxs)(`div`,{className:`pointer-events-none absolute top-0 z-10 rounded-md border border-border bg-surface px-2.5 py-2 text-xs shadow-lg`,style:{left:T,width:w},role:`status`,"data-testid":`usage-tooltip`,children:[(0,W.jsx)(`div`,{className:`text-[11px] text-fg-muted`,children:QS(C.key,r)}),(0,W.jsxs)(`div`,{className:`font-semibold tabular-nums`,children:[WS(C.credits),` credits`,(0,W.jsxs)(`span`,{className:`font-normal text-fg-muted`,children:[` `,`· `,C.requests.toLocaleString(`en-US`),` requests`]})]}),C.parts.length>0?(0,W.jsx)(`ul`,{className:`mt-1 space-y-0.5`,children:[...C.parts].reverse().map(e=>(0,W.jsxs)(`li`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,W.jsx)(`span`,{"aria-hidden":!0,className:`inline-block h-0.5 w-3 shrink-0 rounded`,style:{background:_.get(e.series)}}),(0,W.jsx)(`span`,{className:`shrink-0 font-semibold tabular-nums`,children:f(e.value)}),(0,W.jsx)(`span`,{className:`min-w-0 truncate text-fg-muted`,children:y.get(e.series)})]},e.series))}):(0,W.jsxs)(`div`,{className:`mt-0.5 text-fg-muted`,children:[`Nothing `,i===`credits`?`charged`:`ran`,`.`]})]}):null]})}function mne(e,t,n,r){let i=Math.max(0,Math.min(4,n/2,r));return[`M${e},${t+r}`,`L${e},${t+i}`,`Q${e},${t} ${e+i},${t}`,`L${e+n-i},${t}`,`Q${e+n},${t} ${e+n},${t+i}`,`L${e+n},${t+r}`,`Z`].join(` `)}function hne(e,t){return!!e&&e.slice(0,10)===t.slice(0,10)}function aC({checked:e,onChange:t}){let{state:n}=G();return ig(n.account)===`unavailable`?null:(0,W.jsxs)(`label`,{className:`flex items-start gap-2 text-sm`,children:[(0,W.jsx)(`input`,{type:`checkbox`,className:`mt-1`,checked:e,onChange:e=>t(e.target.checked),"data-testid":`keep-unlocked`}),(0,W.jsxs)(`span`,{children:[(0,W.jsx)(`span`,{className:`block`,children:`Keep me unlocked on this PC`}),(0,W.jsx)(`span`,{className:`block text-xs text-fg-faint`,children:cc})]})]})}function gne({view:e}){let{actions:t}=G(),[n,r]=(0,v.useState)(``),[i,a]=(0,v.useState)(!1),[o,s]=(0,v.useState)(!1),[c,l]=(0,v.useState)(``),[u,d]=(0,v.useState)(``),f=async()=>{if(n){a(!0);try{await t.completeVaultRekey(n)&&r(``)}finally{a(!1)}}},p=async()=>{if(!(c.trim()!==`discard-my-vault-and-history`||!u)){a(!0);try{await t.revokeVaultRekey(u)&&d(``)}finally{a(!1),l(``)}}};return(0,W.jsxs)(`div`,{role:`status`,"data-testid":`vault-rekey-pending`,className:`space-y-3 rounded-md border border-warn/50 bg-warn-soft p-3 text-sm`,children:[(0,W.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,W.jsx)(K.Alert,{className:`mt-0.5 w-4 h-4 shrink-0 text-warn`}),(0,W.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,W.jsx)(`p`,{className:`font-medium text-fg`,children:Vee(e)}),e.canFinishHere?(0,W.jsx)(`p`,{className:`text-xs text-fg-muted`,children:`This PC still holds the key from before the reset, so it can move your vault to the new password. Nothing is lost. Type your new password to confirm; you will get a new vault Recovery Key.`}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`text-xs text-fg-muted`,children:Hee(e)}),(0,W.jsx)(`p`,{className:`text-xs text-fg-muted`,"data-testid":`rekey-recovery-exit`,children:Uee})]})]})]}),e.canFinishHere?(0,W.jsxs)(`form`,{className:`flex items-end gap-2`,onSubmit:e=>{e.preventDefault(),f()},children:[(0,W.jsx)(kS,{label:`New password`,className:`flex-1`,children:(0,W.jsx)(`input`,{className:AS,type:`password`,value:n,onChange:e=>r(e.target.value),autoComplete:`current-password`,"data-testid":`rekey-password`})}),(0,W.jsx)(q,{type:`submit`,variant:`primary`,busy:i,disabled:!n,"data-testid":`rekey-finish`,children:`Move my vault to the new password`})]}):null,o?(0,W.jsxs)(`div`,{className:`space-y-2 rounded-md border border-danger/40 bg-surface p-3`,children:[(0,W.jsxs)(`p`,{className:`text-xs text-danger`,children:[`Discarding permanently deletes every saved provider key and the vault Recovery Key that could still have moved them. Your chats are not touched — they live on your PCs. There is no undo. Type `,(0,W.jsx)(`span`,{className:`font-mono`,children:sc}),` and your current password to confirm.`]}),(0,W.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,W.jsx)(kS,{label:`Your new password`,className:`flex-1`,children:(0,W.jsx)(`input`,{className:AS,type:`password`,value:u,onChange:e=>d(e.target.value),autoComplete:`current-password`,"data-testid":`rekey-discard-password`})}),(0,W.jsx)(kS,{label:`Confirmation`,className:`flex-1`,children:(0,W.jsx)(`input`,{className:AS,value:c,onChange:e=>l(e.target.value),autoComplete:`off`,spellCheck:!1,"data-testid":`rekey-discard-ack`})}),(0,W.jsx)(q,{variant:`danger`,busy:i,disabled:c.trim()!==`discard-my-vault-and-history`||!u,onClick:()=>void p(),"data-testid":`rekey-discard-confirm`,children:`Discard vault`}),(0,W.jsx)(q,{variant:`ghost`,onClick:()=>s(!1),children:`Cancel`})]})]}):(0,W.jsx)(q,{size:`sm`,variant:`ghost`,onClick:()=>s(!0),"data-testid":`rekey-discard`,children:e.canFinishHere?`This was not me — discard the vault instead`:`Last resort: discard the vault`})]})}function _ne(){let{state:e,actions:t}=G(),n=e.recoveryKey,[r,i]=(0,v.useState)(!1);if(!n)return null;let a=async()=>{try{await navigator.clipboard?.writeText(n.code),i(!0)}catch{t.toast(`error`,`Could not copy — select the code and copy it by hand`)}};return(0,W.jsxs)(`div`,{role:`status`,"data-testid":`recovery-key`,className:`space-y-2 rounded-md border border-ok/50 bg-ok-soft p-3 text-sm`,children:[(0,W.jsx)(`p`,{className:`font-medium text-fg`,children:`Your new vault Recovery Key`}),(0,W.jsx)(`p`,{className:`text-xs text-fg-muted`,children:`Write it down now — this is the only copy, and OonaCode does not store it. It unlocks your vault data if you ever forget the password. It is not a 2FA backup code.`}),(0,W.jsx)(`div`,{className:`select-all rounded-md border border-border bg-surface px-3 py-2 font-mono text-base tracking-wider`,"data-testid":`recovery-key-code`,children:n.code}),n.devicesSignedOut>0?(0,W.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[n.devicesSignedOut,` other device`,n.devicesSignedOut===1?` was`:`s were`,` signed out; sign in there with the new password.`]}):null,n.warning?(0,W.jsx)(`p`,{className:`rounded-md border border-warn/50 bg-warn-soft px-2 py-1.5 text-xs text-fg`,"data-testid":`recovery-key-warning`,children:n.warning}):null,(0,W.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,W.jsxs)(q,{size:`sm`,onClick:()=>void a(),children:[(0,W.jsx)(K.Copy,{className:`w-3.5 h-3.5`}),` `,r?`Copied`:`Copy`]}),(0,W.jsx)(q,{size:`sm`,variant:`primary`,onClick:()=>t.dismissRecoveryKey(),"data-testid":`recovery-key-done`,children:`I have saved it`})]})]})}function vne(){let{state:e,actions:t}=G(),[n,r]=(0,v.useState)(!1),[i,a]=(0,v.useState)(``),[o,s]=(0,v.useState)(!1),c=ig(e.account);if(c===`unavailable`||c===`pending_rekey`)return null;let l=async e=>{s(!0);try{await t.setDeviceUnlock(e,e?i:void 0)&&(r(!1),a(``))}finally{s(!1)}};return c===`armed`?(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs`,"data-testid":`device-unlock`,children:[(0,W.jsx)(MS,{tone:`ok`,children:`stays unlocked on this PC`}),(0,W.jsx)(q,{size:`sm`,busy:o,onClick:()=>void l(!1),children:`Turn off`})]}):n?(0,W.jsxs)(`form`,{className:`space-y-2 rounded-md border border-border bg-surface-2 p-3`,"data-testid":`device-unlock`,onSubmit:e=>{e.preventDefault(),l(!0)},children:[(0,W.jsx)(`p`,{className:`text-xs text-fg-faint`,children:cc}),(0,W.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,W.jsx)(kS,{label:`Password`,className:`flex-1`,children:(0,W.jsx)(`input`,{className:AS,type:`password`,value:i,onChange:e=>a(e.target.value),autoComplete:`current-password`})}),(0,W.jsx)(q,{type:`submit`,variant:`primary`,busy:o,disabled:!i,children:`Keep me unlocked`}),(0,W.jsx)(q,{variant:`ghost`,onClick:()=>r(!1),children:`Cancel`})]})]}):(0,W.jsx)(q,{size:`sm`,onClick:()=>r(!0),"data-testid":`device-unlock`,children:`Keep me unlocked on this PC…`})}function yne({pending:e}){let{actions:t}=G(),[n,r]=(0,v.useState)(()=>Date.now()),[i,a]=(0,v.useState)(!1);(0,v.useEffect)(()=>{if(r(Date.now()),e.resendAt<=Date.now())return;let t=setInterval(()=>{let n=Date.now();r(n),n>=e.resendAt&&clearInterval(t)},1e3);return()=>clearInterval(t)},[e.resendAt]);let o=Xee(e,n),s=async()=>{a(!0);try{await t.resendVerification()}finally{a(!1)}};return(0,W.jsxs)(`div`,{role:`status`,"data-testid":`email-verification`,className:`space-y-2 rounded-md border border-warn/50 bg-warn-soft p-3 text-sm`,children:[(0,W.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,W.jsx)(K.Alert,{className:`mt-0.5 w-4 h-4 shrink-0 text-warn`}),(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsx)(`p`,{className:`font-medium text-fg`,children:Qee(e)}),(0,W.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:`Open the link on any device, then log in again here. Check the spam folder if it does not arrive.`})]})]}),(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,W.jsx)(q,{size:`sm`,variant:`primary`,busy:i,disabled:o>0,onClick:()=>void s(),"data-testid":`resend-verification`,children:o>0?`Resend link (${o}s)`:`Resend link`}),(0,W.jsx)(q,{size:`sm`,variant:`ghost`,onClick:()=>t.dismissEmailVerification(),children:`Dismiss`})]})]})}function oC(){let{state:e,actions:t}=G(),[n,r]=(0,v.useState)(e.settings?.gatewayUrl||x),[i,a]=(0,v.useState)(``),[o,s]=(0,v.useState)(``),[c,l]=(0,v.useState)(e.connection.hostName??``),[u,d]=(0,v.useState)(!1),[f,p]=(0,v.useState)(!0),[m,h]=(0,v.useState)(!1);(0,v.useEffect)(()=>{e.settings?.gatewayUrl&&n===x&&r(e.settings.gatewayUrl)},[e.settings?.gatewayUrl,n]);let g=async()=>{if(!(!n.trim()||!i.trim()||!o)){h(!0);try{await t.login({gatewayUrl:n.trim(),email:i.trim(),password:o,register:u,...c.trim()?{deviceName:c.trim()}:{},keepUnlocked:f})!==`verification_pending`&&s(``)}finally{h(!1)}}};return(0,W.jsxs)(`form`,{className:`space-y-3`,onSubmit:e=>{e.preventDefault(),g()},children:[(0,W.jsx)(`p`,{className:`text-sm text-fg-muted`,children:`Log in to use OonaCode and to sync your credentials across your own devices (zero-knowledge: the server only ever sees ciphertext).`}),e.emailVerification?(0,W.jsx)(yne,{pending:e.emailVerification}):null,(0,W.jsx)(kS,{label:`Gateway URL`,children:(0,W.jsx)(`input`,{className:AS,value:n,onChange:e=>r(e.target.value),placeholder:x,autoComplete:`url`,spellCheck:!1})}),(0,W.jsx)(kS,{label:`Email`,children:(0,W.jsx)(`input`,{className:AS,type:`email`,value:i,onChange:e=>a(e.target.value),autoComplete:`username`})}),(0,W.jsx)(kS,{label:`Password`,hint:`Also unlocks your vault. It never leaves this PC; only a derived proof is sent.`,children:(0,W.jsx)(`input`,{className:AS,type:`password`,value:o,onChange:e=>s(e.target.value),autoComplete:u?`new-password`:`current-password`})}),(0,W.jsx)(kS,{label:`Device name`,children:(0,W.jsx)(`input`,{className:AS,value:c,onChange:e=>l(e.target.value),placeholder:`Office PC`})}),(0,W.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,W.jsx)(`input`,{type:`checkbox`,checked:u,onChange:e=>d(e.target.checked)}),` `,`Create a new account`]}),(0,W.jsx)(aC,{checked:f,onChange:p}),(0,W.jsx)(q,{type:`submit`,variant:`primary`,busy:m,disabled:!n.trim()||!i.trim()||!o,children:u?`Register`:`Log in`})]})}function bne(){let{actions:e}=G(),[t,n]=(0,v.useState)(``),[r,i]=(0,v.useState)(!0),[a,o]=(0,v.useState)(!1);return(0,W.jsxs)(`form`,{className:`space-y-2`,onSubmit:i=>{i.preventDefault(),o(!0),e.unlock(t,{keepUnlocked:r}).finally(()=>{o(!1),n(``)})},children:[(0,W.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,W.jsx)(kS,{label:`Vault locked — enter your password`,className:`flex-1`,children:(0,W.jsx)(`input`,{className:AS,type:`password`,value:t,onChange:e=>n(e.target.value),autoComplete:`current-password`})}),(0,W.jsx)(q,{type:`submit`,variant:`primary`,busy:a,disabled:!t,children:`Unlock`})]}),(0,W.jsx)(aC,{checked:r,onChange:i})]})}function xne(){let{state:e}=G(),t=e.plan,n=e=>e.toLocaleString(void 0,{maximumFractionDigits:0});return(0,W.jsxs)(`section`,{className:`space-y-2`,"data-testid":`account-plan`,children:[(0,W.jsx)(`h3`,{className:`text-sm font-semibold`,children:`Plan & credits`}),t===null?(0,W.jsx)(`p`,{className:`text-xs text-fg-muted`,children:`Sign in to see your plan and credit balance.`}):(0,W.jsxs)(`div`,{className:`space-y-2 rounded-md border border-border px-3 py-2.5 text-sm`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsx)(`span`,{className:`text-fg-muted`,children:`Plan`}),(0,W.jsxs)(`span`,{className:`font-medium`,children:[t.planName,t.status===`none`?` (lapsed)`:``]})]}),(0,W.jsx)(`div`,{className:`h-px bg-border`}),(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsx)(`span`,{className:`text-fg-muted`,children:`Plan credits`}),(0,W.jsx)(`span`,{className:`font-semibold tabular-nums`,"data-testid":`account-credits`,children:n(t.credits.balance)})]}),(0,W.jsxs)(`div`,{className:`text-[11px] text-fg-faint`,children:[t.credits.monthlyGrant>0?`Tops up to ${n(t.credits.monthlyGrant)} each 30-day period. `:`No monthly top-up on this plan; the signup gift and anything you buy never expire. `,`Free models never draw on it.`]})]})]})}function Sne({open:e,onClose:t}){let{state:n,actions:r}=G(),i=n.account,a=ag(i),[o,s]=(0,v.useState)(`account`);return(0,v.useEffect)(()=>{e&&(r.refreshAccount(),r.refreshPlan())},[e,r]),(0,W.jsxs)(NS,{open:e,title:`Account`,onClose:t,wide:o===`usage`,children:[(0,W.jsx)(`div`,{className:`-mt-1 mb-4 flex gap-1 border-b border-border`,role:`tablist`,"aria-label":`Account sections`,children:[[`account`,`Account`],[`usage`,`Usage`]].map(([e,t])=>(0,W.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":o===e,"data-testid":`account-tab-${e}`,onClick:()=>s(e),className:o===e?`-mb-px border-b-2 border-accent px-3 py-1.5 text-sm font-medium text-fg`:`-mb-px border-b-2 border-transparent px-3 py-1.5 text-sm text-fg-muted hover:text-fg`,children:t},e))}),o===`usage`?(0,W.jsx)(one,{}):(0,W.jsxs)(`div`,{className:`space-y-5`,children:[i?.loggedIn?(0,W.jsxs)(`section`,{className:`space-y-2`,children:[(0,W.jsx)(_ne,{}),(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,W.jsx)(`span`,{className:`font-medium`,children:i.email}),a?(0,W.jsx)(MS,{tone:`warn`,children:`vault waiting for a password reset to finish`}):(0,W.jsx)(MS,{tone:i.vaultUnlocked?`ok`:`warn`,children:i.vaultUnlocked?`vault unlocked`:`vault locked`}),(0,W.jsxs)(MS,{tone:i.syncStatus===`error`?`danger`:i.syncStatus===`offline`?`warn`:`neutral`,children:[`sync: `,i.syncStatus]}),i.vaultRev===null?null:(0,W.jsxs)(MS,{children:[`rev `,i.vaultRev]})]}),(0,W.jsxs)(`div`,{className:`text-xs text-fg-faint`,children:[i.gatewayUrl,` · device `,i.deviceId?.slice(0,8)??`?`,` · last sync`,` `,i.lastSyncAt?Z_(i.lastSyncAt):`never`,i.syncError?(0,W.jsxs)(`span`,{className:`text-danger`,children:[` · `,i.syncError]}):null]}),a?(0,W.jsx)(gne,{view:a}):null,!a&&!i.vaultUnlocked?(0,W.jsx)(bne,{}):null,i.vaultUnlocked?(0,W.jsx)(vne,{}):null,(0,W.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,W.jsxs)(q,{onClick:()=>void r.syncNow(),disabled:!i.vaultUnlocked,children:[(0,W.jsx)(K.Refresh,{className:`w-3.5 h-3.5`}),` Sync now`]}),(0,W.jsx)(q,{variant:`danger`,onClick:()=>void r.logout(),children:`Log out`})]})]}):(0,W.jsx)(oC,{}),(0,W.jsx)(xne,{})]})]})}function sC(){return typeof window>`u`?null:window.__oonacodeRenderProbe??null}function Cne(e){e&&sC()?.transcript?.(e)}function wne(e,t,n){sC()?.group?.(e,n)}function cC(e,t){return e===null||e===document||e===window||!t?!0:e instanceof Node?e.contains(t):!0}var Tne=30;function lC({open:e,at:t,items:n,onClose:r,label:i,anchorEl:a=null,testId:o=`session-context-menu`}){let s=(0,v.useRef)(null),[c,l]=(0,v.useState)(t),u=n.filter(e=>!e.disabled),[d,f]=(0,v.useState)(0);return(0,v.useEffect)(()=>{e&&f(0)},[e,t.x,t.y]),(0,v.useLayoutEffect)(()=>{if(!e)return;let r=s.current,i=r?.offsetWidth??200,a=r?.offsetHeight??n.length*Tne,o=window.innerWidth-i-8,c=window.innerHeight-a-8;l({x:Math.max(8,Math.min(t.x,o)),y:Math.max(8,Math.min(t.y,c))})},[e,t.x,t.y,n.length]),(0,v.useEffect)(()=>{if(!e)return;let t=e=>{if(e.key===`Escape`){e.stopPropagation(),r();return}if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault(),f(t=>((e.key===`ArrowDown`?t+1:t-1)+u.length)%Math.max(u.length,1));return}if(e.key===`Enter`||e.key===` `){e.preventDefault();let t=u[d];t&&(r(),t.onSelect())}},n=e=>{s.current?.contains(e.target)||(e.preventDefault(),e.stopPropagation(),r())},i=e=>{cC(e.target,a)&&r()};return document.addEventListener(`keydown`,t),window.addEventListener(`mousedown`,n,!0),window.addEventListener(`resize`,r),window.addEventListener(`scroll`,i,!0),()=>{document.removeEventListener(`keydown`,t),window.removeEventListener(`mousedown`,n,!0),window.removeEventListener(`resize`,r),window.removeEventListener(`scroll`,i,!0)}},[e,r,u,d,a]),e?(0,bS.createPortal)((0,W.jsx)(`div`,{ref:s,role:`menu`,"aria-label":i,"data-testid":o,className:`fixed z-50 min-w-[190px] overflow-hidden rounded-md border border-border bg-surface py-1 shadow-lg`,style:{left:c.x,top:c.y},children:n.map(e=>{let t=u.indexOf(e);return(0,W.jsxs)(`div`,{children:[e.separated?(0,W.jsx)(`div`,{className:`my-1 h-px bg-border`}):null,(0,W.jsxs)(`button`,{type:`button`,role:`menuitem`,disabled:e.disabled,title:e.title,"data-testid":e.testId,className:U(`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm`,e.disabled?`cursor-default text-fg-faint`:e.danger?`text-danger hover:bg-danger-soft`:`text-fg hover:bg-surface-2`,!e.disabled&&t===d?`bg-surface-2`:``),onMouseEnter:()=>t>=0&&f(t),onClick:()=>{r(),e.onSelect()},children:[e.icon?(0,W.jsx)(`span`,{className:`w-3.5 shrink-0`,children:e.icon}):null,(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),e.hint?(0,W.jsx)(`span`,{className:`shrink-0 text-[11px] text-fg-faint`,children:e.hint}):null]})]},e.key)})}),document.body):null}function Ene(e){if(!e.supported)return`This PC's OonaCode is too old to list your other devices — update it.`;switch(e.reason){case`logged_out`:return`Sign in to your OonaCode account to see your other PCs here.`;case`gateway_unreachable`:return`Your account server is unreachable — only this PC is listed right now.`;case`vault_locked`:return`Unlock your vault to read the sessions on your other PCs.`;default:return`No other PCs on this account yet. Install OonaCode on another machine and sign in.`}}function Dne({sessions:e,onOpen:t,readOnly:n}){return e.length===0?(0,W.jsx)(`div`,{className:`px-2 py-4 text-center text-xs text-fg-faint`,children:`No sessions here.`}):(0,W.jsx)(`ul`,{className:`divide-y divide-border`,children:e.map(e=>(0,W.jsx)(`li`,{children:(0,W.jsxs)(`button`,{type:`button`,onClick:()=>t(e.id),className:`flex w-full items-center gap-2 px-2 py-2 text-left hover:bg-surface-2`,children:[(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsx)(`div`,{className:`truncate text-sm`,children:av(e)}),(0,W.jsxs)(`div`,{className:`truncate text-[11px] text-fg-faint`,children:[e.cwd,` · `,Z_(e.updatedAt)]})]}),n?(0,W.jsx)(MS,{tone:`warn`,children:`read-only`}):null,(0,W.jsx)(K.Chevron,{className:`w-3.5 h-3.5 shrink-0 text-fg-faint`})]})},e.id))})}function One({open:e,onClose:t}){let{state:n,actions:r}=G(),[i,a]=(0,v.useState)(`local`),[o,s]=(0,v.useState)(``);(0,v.useEffect)(()=>{e&&r.refreshHosts()},[e,r]),(0,v.useEffect)(()=>{!e||i===`local`||r.refreshHostSessions(i)},[e,i,r]);let c=(0,v.useMemo)(()=>n.remote.hosts.filter(e=>!e.isSelf),[n.remote.hosts]),l=c.find(e=>e.hostId===i)??null,u=i===`local`?n.sessions:n.remote.sessions[i]??[],d=l?n.remote.unreachable[l.hostId]:void 0,f=l&&d?Tm(d.reason,l.label||l.hostName,d.detail):null,p=(0,v.useMemo)(()=>{let e=o.trim().toLowerCase();return e?u.filter(t=>av(t).toLowerCase().includes(e)||t.cwd.toLowerCase().includes(e)):u},[u,o]);return(0,W.jsx)(NS,{open:e,title:`Open a session`,onClose:t,wide:!0,children:(0,W.jsxs)(`div`,{className:`flex min-h-[20rem] gap-4`,children:[(0,W.jsxs)(`nav`,{className:`w-44 shrink-0 space-y-0.5`,"aria-label":`Devices`,children:[(0,W.jsxs)(`button`,{type:`button`,onClick:()=>a(`local`),"aria-current":i===`local`?`true`:void 0,className:U(`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm`,i===`local`?`bg-accent-soft font-medium text-accent`:`text-fg-muted hover:bg-surface-2`),children:[(0,W.jsx)(K.Monitor,{className:`w-3.5 h-3.5`}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:n.connection.hostName??`This PC`}),(0,W.jsx)(MS,{tone:`ok`,children:`local`})]}),c.map(e=>(0,W.jsxs)(`button`,{type:`button`,onClick:()=>a(e.hostId),"aria-current":i===e.hostId?`true`:void 0,className:U(`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm`,i===e.hostId?`bg-accent-soft font-medium text-accent`:`text-fg-muted hover:bg-surface-2`),children:[(0,W.jsx)(K.Monitor,{className:`w-3.5 h-3.5`}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label||e.hostName}),(0,W.jsx)(`span`,{className:U(`h-1.5 w-1.5 shrink-0 rounded-full`,e.online?`bg-ok`:`bg-fg-faint`),"aria-label":e.online?`online`:`offline`})]},e.hostId)),c.length===0?(0,W.jsx)(`div`,{className:`px-2 pt-3 text-[11px] text-fg-faint`,children:Ene(n.remote)}):null]}),(0,W.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,W.jsx)(`input`,{className:AS,placeholder:`Filter sessions`,"aria-label":`Filter sessions`,value:o,onChange:e=>s(e.target.value)}),f?(0,W.jsx)(`div`,{className:`mt-2 rounded-md bg-warn-soft px-3 py-2 text-xs text-warn`,"data-testid":`picker-unreachable`,children:f}):null,(0,W.jsx)(`div`,{className:`mt-2 min-h-0 flex-1 overflow-y-auto rounded-md border border-border`,children:(0,W.jsx)(Dne,{sessions:p,readOnly:l!==null&&!l.online,onOpen:e=>{if(l){r.openRemoteSession(l.hostId,e),t();return}r.selectSession(e),t()}})}),(0,W.jsx)(`div`,{className:`mt-2 flex justify-end`,children:(0,W.jsxs)(q,{variant:`primary`,onClick:()=>{r.newTab(),t()},children:[(0,W.jsx)(K.Plus,{className:`w-4 h-4`}),` New chat here`]})})]})]})})}function kne(){let{state:e,actions:t}=G(),n=dS(),r=n?e.remote.tabs[n]:void 0;if(!r)return null;let i=r.detail===`backpressure`;return(0,W.jsxs)(`div`,{className:U(`flex items-center gap-2 px-3 py-1.5 text-xs`,r.live?`bg-accent-soft text-accent`:`bg-warn-soft text-warn`),role:`status`,"data-testid":`remote-banner`,children:[(0,W.jsx)(K.Monitor,{className:`w-3.5 h-3.5 shrink-0`}),r.live?(0,W.jsxs)(`span`,{className:`flex-1`,children:[`This session runs on `,(0,W.jsx)(`strong`,{children:r.hostName}),`. This window is a live view — that PC executes every tool.`]}):i?(0,W.jsxs)(`span`,{className:`flex-1`,children:[(0,W.jsx)(`strong`,{children:r.hostName}),` could not keep up with the stream (backpressure) — reconnecting and catching up…`]}):(0,W.jsxs)(`span`,{className:`flex-1`,children:[(0,W.jsx)(`strong`,{children:r.hostName}),` is not reachable`,r.detail?` (${r.detail})`:``,` — this chat is kept only on that PC, so this view is read-only and shows what was read from it. Bring that PC online to continue.`]}),r.live?null:(0,W.jsx)(`button`,{type:`button`,onClick:()=>void t.openRemoteSession(r.hostId,r.sessionId),className:`shrink-0 rounded border border-current/40 px-2 py-0.5 text-[11px] font-medium hover:bg-black/5`,"data-testid":`remote-reconnect`,children:`Reconnect`})]})}function uC(){let{state:e}=G(),t=dS();if(!t)return!1;let n=e.remote.tabs[t];return n?!n.live:!1}function dC(){let{state:e}=G(),t=pS();if(!t)return null;let n=e.pendingRouting[t.id];if(!n&&t.customModel===!0||(n?ng(n.providerId,n.model):t.autoModel))return null;let r={providerId:n?.providerId??t.providerId,model:n?.model??t.model};return fee(e.providers,r)?r.model??null:null}function Ane(e,t,n){return n?null:t?t.customModel&&t.model?t.model:null:e?.customModel===!0&&e.model?e.model:null}function jne(){let{state:e}=G(),t=pS(),n=mS(),r=dS();return Ane(t,n,r?e.pendingRouting[r]!==void 0:!1)}var Mne=`next message`;function Nne(e){let t=e.now?`Until then this chat keeps running on ${e.now}.`:`Until then this chat keeps running on the model it has now.`,n=e.working?` This chat is working, so that message waits for the current turn to finish — use Send now on it to cut the step and switch at once.`:``;return`${e.pick} is picked but not in use yet: it takes effect with your next message. ${t}${n}`}function Pne(e,t,n){let r=t?.engineSince,i=cl(e,{alive:t==null||r===void 0?null:r!==null,since:r&&Date.parse(r)||null});if(!i)return null;let{fallbackModel:a,originalModel:o,category:s}=i.notice,c=a?ul(a,n):`another model`;return{fallbackModel:a,fallbackName:c,originalName:o?ul(o,n):null,category:s,chipLabel:dl(c),track:i}}function Fne(e,t,n){let r=e.originalName??t??`The chat’s model`,i=e.category?` (${e.category})`:``,a=t??e.originalName??`the chat’s model`;return[`${r}’s safeguards flagged this chat${i}, so the engine moved it to ${e.fallbackName} for the rest of this run.`,n?null:`OonaCode does not offer ${e.fallbackName} for picking — it only runs as this fallback.`,`Pick a model (or send after the agent restarts) to go back to ${a}.`].filter(e=>e!==null).join(` `)}function Ine(){let{state:e}=G(),t=fS(),n=pS(),r=t?.safeguardFallback??null,i=t?.session??n,a=i!=null,o=i?i.engineSince:void 0,s=n?e.pendingRouting[n.id]!==void 0:!1,c=e.providers;return(0,v.useMemo)(()=>s||!r?null:Pne(r,a?{engineSince:o}:null,c),[r,s,a,o,c])}function Lne(e){let{session:t,isDraft:n,staged:r,pick:i}=e;if(r)return ng(r.providerId,r.model)?{routedModel:null,note:null}:null;if(n)return ng(i.providerId,i.modelId)?{routedModel:null,note:null}:null;let a=t?.autoModel;if(a){let e=t?.providerId===`oonacode`&&t.model&&t.model!==`auto`?t.model:null;return{routedModel:a.model??e,note:a.note??null}}return t&&ng(t.providerId,t.model)?{routedModel:null,note:null}:null}function fC(){let{state:e}=G(),t=pS(),n=mS(),r=dS(),i=r?e.pendingRouting[r]:void 0;return(0,v.useMemo)(()=>{let r=Sm(e.providers,{providerId:i?.providerId??n?.providerId??t?.providerId??e.activeProviderId,model:i?.model??n?.model??t?.model??e.info?.activeModel,variantId:i?.variantId??n?.variantId??t?.variantId??null}),a=Lne({session:t,isDraft:n!=null,staged:i,pick:r}),o=a?Sm(e.providers,{providerId:w,model:Lee,variantId:null}):r,s=(e.providers.find(e=>e.definition.id===o.providerId)?.definition)?.models.find(e=>e.id===o.modelId)??null;return{...o,option:s,auto:a}},[e.providers,e.activeProviderId,e.info?.activeModel,i,n,t])}function Rne(e){let t=e.toLowerCase();return t===`#000000`||t===`#000`?void 0:e}function pC({providerId:e,displayName:t,size:n=14,className:r}){let i=Dc(e);if(!i)return(0,W.jsx)(`span`,{"aria-hidden":`true`,"data-provider-mark":e,className:U(`inline-flex flex-shrink-0 items-center justify-center rounded-sm bg-fg/10 font-semibold text-fg-muted`,r),style:{width:n,height:n,fontSize:Math.round(n*.55),lineHeight:1},children:Oc(t)});let a=Rne(i.hex);return(0,W.jsx)(`svg`,{"aria-hidden":`true`,"data-provider-mark":e,viewBox:`0 0 24 24`,width:n,height:n,className:U(`flex-shrink-0`,a?void 0:`text-fg`,r),style:{width:n,height:n},children:(0,W.jsx)(`path`,{d:i.d,fill:a??`currentColor`,fillRule:i.fillRule})})}var zne={ok:`bg-ok`,warn:`bg-warn`,danger:`bg-danger`,neutral:`bg-fg-faint`},Bne={ok:`text-ok`,warn:`text-warn`,danger:`text-danger`,neutral:`text-fg-muted`},Vne={agy:`agy’s own usage report`,"grok-billing":`xAI’s usage report`,"response-headers":`the provider’s last answer`,"subscription-usage":`the provider’s last answer`,"engine-rate-limit":`your plan’s own report`};function Hne(e){let t=e?.message?.trim();if(t)return t;switch(e?.reason){case`no_data_yet`:return`No usage reported yet — send a message first.`;case`unavailable`:return`Usage could not be read right now.`;case`not_linked`:return`No usage to show for this provider.`;default:return`This provider does not report usage that OonaCode can read. If it should, send a message and look again.`}}var mC=new WeakMap,hC=new WeakMap;function gC(e){let t=mC.get(e);return t||(t=new Map,mC.set(e,t)),t}function Une(e,t){if(e?.refreshing)return 0;let n=mc;if(e&&!e.stale&&e.fetchedAt&&e.staleAfterMinutes){let r=Date.parse(e.fetchedAt);Number.isFinite(r)&&(n=Math.min(n,Math.max(0,r+e.staleAfterMinutes*6e4-t)))}return n}var Wne=2500,Gne=8;function Kne(e){let{api:t}=G(),[n,r]=(0,v.useState)({id:null,loading:!1,answer:null}),[i,a]=(0,v.useState)(!1),[o,s]=(0,v.useState)(0),c=(0,v.useRef)(!0);(0,v.useEffect)(()=>(c.current=!0,()=>{c.current=!1}),[]),(0,v.useEffect)(()=>{if(!e||!t.getProviderUsage){r({id:e,loading:!1,answer:null});return}let n=gC(t),i=n.get(e);if(i&&Date.now()-i.at<Une(i.answer,i.at)){r({id:e,loading:!1,answer:i.answer});return}let a=!0,o=null,s=0,c=l=>{l&&r({id:e,loading:!0,answer:i?.answer??null}),t.getProviderUsage(e).then(e=>e,()=>null).then(t=>{t?.refreshing===!0?n.delete(e):n.set(e,{at:Date.now(),answer:t}),a&&(r({id:e,loading:!1,answer:t}),t?.refreshing===!0&&s<Gne&&(s+=1,o=setTimeout(()=>c(!1),Wne)))})};return c(!0),()=>{a=!1,o&&clearTimeout(o)}},[t,e]);let l=(0,v.useCallback)(()=>{if(!e||!t.getProviderUsage)return;let n=hC.get(t);n||(n=new Map,hC.set(t,n));let i=n.get(e)??0;Date.now()-i<6e4||(n.set(e,Date.now()),s(Date.now()+gc),a(!0),t.getProviderUsage(e,{refresh:!0}).then(e=>e,()=>null).then(n=>{n?.refreshing===!0?gC(t).delete(e):gC(t).set(e,{at:Date.now(),answer:n}),c.current&&(a(!1),r({id:e,loading:!1,answer:n}))}))},[t,e]),u=(e?hC.get(t)?.get(e)??0:0)+gc,d=n.id===e?n.answer:null;return{loading:n.id===e?n.loading:e!==null,answer:d,checking:i||d?.refreshing===!0,checkNow:l,checkBlockedUntil:Math.max(o,u>Date.now()?u:0)}}function qne(){let[e,t]=(0,v.useState)(()=>Date.now());return(0,v.useEffect)(()=>{let e=setInterval(()=>t(Date.now()),1e3);return()=>clearInterval(e)},[]),e}function Jne(e,t){let n=Date.parse(e);if(!Number.isFinite(n))return null;let r=Math.round((n-t)/1e3);if(r<=0)return null;if(r<60)return`in ${r}s`;let i=Math.floor(r/60);if(i<60)return`in ${i}m`;let a=Math.floor(i/60);return a<24?`in ${a}h${i%60?` ${i%60}m`:``}`:`in ${Math.floor(a/24)}d${a%24?` ${a%24}h`:``}`}function Yne(e,t){let n=Date.parse(e);if(!Number.isFinite(n))return``;let r=Math.max(0,Math.round((t-n)/1e3));if(r<45)return`seen just now`;let i=Math.round(r/60);if(i<60)return`seen ${Math.max(1,i)} min ago`;let a=Math.floor(i/60);return a<24?`seen ${a} h ago`:`seen ${Math.floor(a/24)} d ago`}function _C(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString(void 0,{weekday:`short`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function vC(e,t){return Js(e).toLowerCase()===Js(t).toLowerCase()}function Xne(e,t){if(t.length===0)return!1;if(e.model)return t.some(t=>vC(t,e.model));let n=e.title.lastIndexOf(` · `);if(n<0)return!1;let r=e.title.slice(n+3);return t.some(e=>vC(e,r))}function Zne(e,t){let n=e.family?.toLowerCase();return!!n&&t.some(e=>e.toLowerCase().includes(n))}function Qne(e,t){let n=t?.ids??[],r=e.map((e,t)=>{let r=e.bars.map(e=>({bar:e,mine:Zne(e,n)})),i=[...r.keys()].sort((e,t)=>Number(r[t].mine)-Number(r[e].mine)||e-t);return{group:{...e,bars:i.map(e=>r[e].bar)},forModel:Xne(e,n),barsForModel:i.map(e=>r[e].mine),index:t}});return r.sort((e,t)=>Number(t.forModel)-Number(e.forModel)||e.index-t.index),r.map(({group:e,forModel:t,barsForModel:n})=>({group:e,forModel:t,barsForModel:n}))}function $ne({bar:e,now:t,forModel:n}){let r=e.usedPct===null?null:Math.max(0,Math.min(100,e.usedPct)),i=pc(r===null?null:100-r),a=e.resetsAt?Jne(e.resetsAt,t):null,o=!!e.resetsAt&&a===null;return(0,W.jsxs)(`div`,{"data-testid":`provider-usage-bar`,"data-tone":i,"data-for-model":n?`true`:void 0,children:[(0,W.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2 text-[11px]`,children:[(0,W.jsxs)(`span`,{className:`truncate text-fg`,children:[e.label,n?(0,W.jsx)(`span`,{className:`ml-1 rounded bg-accent-soft px-1 text-[9px] font-medium text-accent`,children:`this model`}):null]}),(0,W.jsx)(`span`,{className:U(`shrink-0 font-medium tabular-nums`,Bne[i]),children:r===null?`—`:`${Math.round(r)}% used`})]}),(0,W.jsx)(`div`,{className:`mt-1 h-1.5 w-full overflow-hidden rounded-full bg-fg/10`,role:`progressbar`,"aria-label":`${e.label} used`,"aria-valuemin":0,"aria-valuemax":100,...r===null?{}:{"aria-valuenow":Math.round(r)},children:(0,W.jsx)(`div`,{className:U(`h-full rounded-full`,zne[i]),style:{width:`${r??0}%`}})}),e.detail||e.resetsAt?(0,W.jsxs)(`div`,{className:`mt-0.5 flex items-baseline justify-between gap-2 text-[10px] text-fg-faint`,children:[(0,W.jsx)(`span`,{className:`truncate`,children:e.detail??``}),e.resetsAt?(0,W.jsx)(`span`,{className:`shrink-0 tabular-nums`,title:o?`This window reset at ${_C(e.resetsAt)}; the figure beside it was taken before that.`:`Resets ${_C(e.resetsAt)}`,"data-testid":`provider-usage-reset`,children:o?`reset — awaiting new figures`:`resets ${a}`}):null]}):null]})}function yC({providerId:e,label:t,direct:n,side:r,active:i=null,note:a,id:o,anchor:s,onPointerEnter:c,onPointerLeave:l}){let{loading:u,answer:d,checking:f,checkNow:p,checkBlockedUntil:m}=Kne(e),h=qne(),g=d?.groups??[],_=Qne(g,i),v=(d?.source??[]).map(e=>Vne[e]),y=[...new Set(v)].join(` and `),b=h<m,x=s?{left:s.left}:void 0,S=d?.staleAfterMinutes??null;return(0,W.jsxs)(`div`,{id:o,role:`group`,"aria-label":`${t} usage`,"data-testid":`provider-usage-card`,"data-provider":e,"data-anchor":s?s.above?`above`:`below`:void 0,onPointerEnter:c,onPointerLeave:l,style:x,className:U(`absolute max-h-[22rem] w-[19rem] overflow-y-auto rounded-lg border border-border bg-surface p-3 shadow-lg`,s?U(`z-50`,s.above?`bottom-full mb-1`:`top-full mt-1`):U(`top-0 z-10`,r===`right`?`left-full ml-2`:`right-full mr-2`)),children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,W.jsx)(pC,{providerId:e,displayName:t,size:13}),(0,W.jsx)(`span`,{className:`truncate text-xs font-semibold text-fg`,children:t}),(0,W.jsx)(`span`,{className:`ml-auto shrink-0 text-[10px] font-semibold uppercase tracking-wide text-fg-faint`,children:`Usage`})]}),(0,W.jsx)(`div`,{className:`mt-0.5 text-[10px] text-fg-faint`,children:n?`Your own plan — runs straight from this PC, never through our servers.`:`Your own key — sent from this PC straight to the provider.`}),i?(0,W.jsxs)(`div`,{className:`mt-1 text-[11px] text-fg`,"data-testid":`provider-usage-active`,children:[`Active model: `,(0,W.jsx)(`span`,{className:`font-medium`,children:i.label})]}):null,a?(0,W.jsx)(`div`,{className:`mt-1 text-[11px] leading-snug text-fg-muted`,"data-testid":`provider-usage-note`,children:a}):null,g.length>0?(0,W.jsx)(`div`,{className:`mt-2 space-y-3 border-t border-border pt-2`,children:_.map(({group:e,forModel:t,barsForModel:n},r)=>(0,W.jsxs)(`section`,{"data-testid":`provider-usage-group`,"data-for-model":t?`true`:void 0,children:[(0,W.jsxs)(`div`,{className:`mb-1.5 flex items-baseline gap-1 text-[10px] font-semibold uppercase tracking-wide text-fg-muted`,children:[(0,W.jsx)(`span`,{className:`truncate`,children:e.title}),t?(0,W.jsx)(`span`,{className:`shrink-0 rounded bg-accent-soft px-1 text-[9px] font-medium normal-case tracking-normal text-accent`,children:`this model`}):null]}),(0,W.jsx)(`div`,{className:`space-y-2`,children:e.bars.map((e,r)=>(0,W.jsx)($ne,{bar:e,now:h,forModel:t||n[r]===!0},`${e.label}-${r}`))})]},`${e.title}-${r}`))}):(0,W.jsx)(`div`,{className:`mt-2 border-t border-border pt-2 text-[11px] leading-snug text-fg-muted`,"data-testid":`provider-usage-empty`,children:u||f?`Reading usage…`:Hne(d)}),g.length>0&&d?.fetchedAt?(0,W.jsxs)(`div`,{className:U(`mt-2 border-t border-border pt-1.5 text-[10px]`,d.stale&&!f?`text-warn`:`text-fg-faint`),"data-testid":`provider-usage-updated`,"data-stale":d.stale?`true`:void 0,title:new Date(d.fetchedAt).toLocaleString(),children:[Yne(d.fetchedAt,h),d.stale&&!f&&S?` — older than ${S} min`:``,y?` · from ${y}`:``,u||f?` · checking…`:``]}):null,d?.pingNote&&!f?(0,W.jsx)(`div`,{className:`mt-1 text-[10px] leading-snug text-warn`,"data-testid":`provider-usage-ping-note`,children:d.pingNote}):null,d?.pingEnabled?(0,W.jsxs)(`div`,{className:`mt-1.5 flex items-center justify-between gap-2`,children:[(0,W.jsxs)(`span`,{className:`text-[10px] text-fg-faint`,children:[`A check spends a few tokens of your own `,n?`plan`:`key`,`.`]}),(0,W.jsx)(`button`,{type:`button`,className:`shrink-0 rounded border border-border px-1.5 py-0.5 text-[10px] text-fg hover:border-fg-faint disabled:opacity-50`,"data-testid":`provider-usage-check-now`,disabled:f||b,onClick:p,children:f?`Checking…`:`Check now`})]}):null]})}function bC(e){if(e>=1e6){let t=e/1e6;return`${Number.isInteger(t)?t:t.toFixed(1)}M`}return e>=1e3?`${Math.round(e/1e3)}K`:String(e)}function ere({m:e}){if(e.details.auto)return null;let{intelligence:t,coding:n,outputTps:r,contextWindow:i,thinking:a,vision:o}=e.details;return t===void 0&&n===void 0&&r===void 0&&i===void 0&&!a&&!o?null:(0,W.jsxs)(`span`,{className:`ml-auto flex flex-shrink-0 items-center gap-2 pl-3 text-[10px] leading-none tabular-nums`,children:[a?(0,W.jsx)(`span`,{className:`text-think`,title:`Reasoning / extended thinking`,children:`✦`}):null,o?(0,W.jsx)(`span`,{className:`text-fg-faint`,title:`Accepts images`,children:`◉`}):null,i===void 0?null:(0,W.jsx)(`span`,{className:`text-fg-faint`,title:`${i.toLocaleString()} token context`,children:bC(i)}),t===void 0?null:(0,W.jsxs)(`span`,{className:`rounded-sm bg-fg/10 px-1 py-px font-semibold text-fg-muted`,title:`Artificial Analysis intelligence index — their measurement, not ours`,children:[`IQ `,Math.round(t)]}),n===void 0?null:(0,W.jsxs)(`span`,{className:`rounded-sm bg-accent/15 px-1 py-px font-semibold text-accent`,title:`Artificial Analysis coding index — their measurement, not ours`,children:[`</>`,` `,Math.round(n)]}),r===void 0?null:(0,W.jsxs)(`span`,{className:`text-fg-faint`,title:`Artificial Analysis median output speed, tokens per second`,children:[Math.round(r),` t/s`]})]})}var xC=`Credits per 1M tokens. The lower figure is the subscription lane the pool tries first; the higher one applies when the request is served by the pay-as-you-go key instead.`;function SC({label:e,value:t,hint:n}){return t===null?null:(0,W.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,W.jsx)(`span`,{className:`text-fg-faint`,children:e}),(0,W.jsx)(`span`,{className:`text-right font-mono tabular-nums text-fg-muted`,title:n,children:t})]})}function tre({m:e,group:t,side:n}){let r=e.details;if(r.auto)return(0,W.jsx)(nre,{m:e,group:t,side:n});let i=r.creditsPerM,a=[{label:`thinking`,on:r.thinking===!0},{label:`tools`,on:r.tools===!0},{label:`vision`,on:r.vision===!0}],o=r.intelligence!==void 0||r.coding!==void 0||r.outputTps!==void 0||r.ttft!==void 0,s=Object.entries(r.aa?.benchmarks??{}).filter(([e])=>e!==`artificial_analysis_intelligence_index`&&e!==`artificial_analysis_coding_index`).map(([e,t])=>({id:e,value:t,meta:Ns[e]})).sort((e,t)=>(e.meta?.label??e.id).localeCompare(t.meta?.label??t.id)),c=r.aa?.fetchedAt?new Date(r.aa.fetchedAt):null;return(0,W.jsxs)(`div`,{"data-testid":`model-details`,className:U(`absolute top-0 z-10 max-h-[22rem] w-[19rem] overflow-y-auto rounded-lg border border-border bg-surface p-3 shadow-lg`,n===`right`?`left-full ml-2`:`right-full mr-2`),children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,W.jsx)(pC,{providerId:e.providerId,displayName:t,size:13}),(0,W.jsx)(`span`,{className:`truncate text-xs font-semibold text-fg`,children:e.label}),e.free?(0,W.jsx)(wC,{}):null]}),(0,W.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-[10px] text-fg-faint`,title:e.modelId,children:e.modelId}),(0,W.jsxs)(`div`,{className:`text-[10px] text-fg-faint`,children:[t,r.aa?.creator?` · by ${r.aa.creator}`:``,r.aa?.releaseDate?` · released ${r.aa.releaseDate}`:``]}),(0,W.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1 border-t border-border pt-2`,children:a.map(e=>(0,W.jsx)(`span`,{"data-testid":`cap-${e.label}`,"data-on":e.on,className:U(`rounded px-1.5 py-0.5 text-[10px]`,e.on?`bg-ok/15 text-ok`:`bg-fg/5 text-fg-faint line-through`),children:e.label},e.label))}),(0,W.jsxs)(`div`,{className:`mt-2 space-y-1 border-t border-border pt-2 text-[11px]`,children:[(0,W.jsx)(SC,{label:`Context`,value:r.contextWindow===void 0?null:bC(r.contextWindow),hint:r.contextWindow===void 0?void 0:`${r.contextWindow.toLocaleString()} tokens`}),(0,W.jsx)(SC,{label:`Max output`,value:r.maxOutputTokens===void 0?null:bC(r.maxOutputTokens),hint:r.maxOutputTokens===void 0?void 0:`${r.maxOutputTokens.toLocaleString()} tokens`}),(0,W.jsx)(SC,{label:r.providers&&r.providers.length>1?`Providers`:`Provider`,value:r.providers&&r.providers.length>0?r.providers.join(`, `):null,hint:`Which backend the pool sends this model to — the subscription lane first, whichever provider holds it.`}),(0,W.jsx)(SC,{label:`Input / 1M tokens`,value:i?Vd(i.input,i.maxInput):null,hint:i?.maxInput===void 0?void 0:xC}),(0,W.jsx)(SC,{label:`Output / 1M tokens`,value:i?Vd(i.output,i.maxOutput):null,hint:i?.maxOutput===void 0?void 0:xC})]}),o||s.length>0?(0,W.jsxs)(`div`,{className:`mt-2 border-t border-border pt-2`,"data-testid":`model-details-aa`,children:[(0,W.jsxs)(`div`,{className:`mb-1 flex items-baseline justify-between gap-2`,children:[(0,W.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wide text-fg-faint`,children:`Independent ratings`}),(0,W.jsxs)(`span`,{className:`text-[10px] text-fg-faint`,children:[`Artificial Analysis`,c?` · ${c.toLocaleDateString()}`:``]})]}),(0,W.jsx)(CC,{label:`Intelligence`,value:r.intelligence}),(0,W.jsx)(CC,{label:`Coding`,value:r.coding}),(0,W.jsxs)(`div`,{className:`mt-1 space-y-1 text-[11px]`,children:[(0,W.jsx)(SC,{label:`Speed`,value:r.outputTps===void 0?null:`${Math.round(r.outputTps)} tok/s`,hint:`Median output tokens per second`}),(0,W.jsx)(SC,{label:`First answer`,value:r.ttft===void 0?null:`${r.ttft.toFixed(2)}s`,hint:`Median time to the first answer token — after reasoning, which is what you wait for`})]}),s.length>0?(0,W.jsx)(`div`,{className:`mt-1.5 space-y-1 border-t border-border pt-1.5 text-[11px]`,children:s.map(e=>(0,W.jsx)(SC,{label:e.meta?.label??e.id,value:rre(e.value,e.meta?.scale),hint:e.meta?void 0:`Reported by Artificial Analysis as "${e.id}"`},e.id))}):null]}):null,r.notes?(0,W.jsx)(`div`,{className:`mt-2 border-t border-border pt-2 text-[10px] leading-snug text-fg-muted`,children:r.notes}):null]})}function nre({m:e,group:t,side:n}){let r=e.details.notes?.trim()||`Auto picks a model from the OonaCode pool for each new message you send. It weighs how complex the task is, how large this chat has grown, and whether a model already has this chat in its cache — moving to another model can mean reading the whole chat afresh, which costs more — along with each model’s speed and cost. It picks the effort too. The button then names the model it chose, for example “Auto (Qwen3.8 Max)”; pick any other model to leave Auto.`;return(0,W.jsxs)(`div`,{"data-testid":`model-details`,"data-auto":`true`,className:U(`absolute top-0 z-10 max-h-[22rem] w-[19rem] overflow-y-auto rounded-lg border border-border bg-surface p-3 shadow-lg`,n===`right`?`left-full ml-2`:`right-full mr-2`),children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,W.jsx)(pC,{providerId:e.providerId,displayName:t,size:13}),(0,W.jsx)(`span`,{className:`truncate text-xs font-semibold text-fg`,children:e.label})]}),(0,W.jsx)(`div`,{className:`text-[10px] text-fg-faint`,children:t}),(0,W.jsx)(`div`,{className:`mt-2 border-t border-border pt-2 text-[11px] leading-snug text-fg-muted`,"data-testid":`model-details-auto`,children:r})]})}function CC({label:e,value:t}){if(t===void 0)return null;let n=Math.max(0,Math.min(100,t));return(0,W.jsxs)(`div`,{className:`mb-1`,"data-testid":`score-${e.toLowerCase()}`,children:[(0,W.jsxs)(`div`,{className:`flex items-baseline justify-between text-[11px]`,children:[(0,W.jsx)(`span`,{className:`text-fg-faint`,children:e}),(0,W.jsx)(`span`,{className:`font-mono tabular-nums text-fg-muted`,children:t.toFixed(1)})]}),(0,W.jsx)(`div`,{className:`mt-0.5 h-1 w-full overflow-hidden rounded-full bg-fg/10`,children:(0,W.jsx)(`div`,{className:`h-full rounded-full bg-accent`,style:{width:`${n}%`}})})]})}function rre(e,t){return t===`index`?e.toFixed(1):t===`fraction`||e>0&&e<=1?`${(e*100).toFixed(1)}%`:e.toFixed(2)}function wC(){return(0,W.jsx)(`span`,{"data-testid":`model-free-badge`,title:`Free on every plan — served from the operator's own capacity, and never billed to you.`,className:`rounded-sm bg-ok/15 px-1 py-px text-[10px] leading-none font-semibold tracking-wide text-ok uppercase`,children:`Free`})}function ire(e,t){return e===`oonacode`?`Runs on the OonaCode pool. A model the pool does not list may be refused when you send.`:`Sent to ${t} exactly as typed — the provider answers or refuses it.`}function are({sectionKey:e,sectionLabel:t,providerId:n,current:r,initial:i,onApply:a}){let[o,s]=(0,v.useState)(!1),[c,l]=(0,v.useState)(``),[u,d]=(0,v.useState)(null),[f,p]=(0,v.useState)(!1),m=ire(n,t),h=async()=>{let e=c.trim();if(!Rh(e)){d(`One model id — letters, digits and . - _ : / — with no spaces.`);return}p(!0);let t=await a(e);p(!1),t&&s(!1)};return o?(0,W.jsxs)(`div`,{className:`px-2 py-1.5`,"data-testid":`custom-model-form-${e}`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,W.jsx)(`input`,{autoFocus:!0,type:`text`,"data-testid":`custom-model-input-${e}`,"aria-label":`Custom model for ${t}`,placeholder:`Model id, e.g. claude-fable-5-1`,spellCheck:!1,className:`min-w-0 flex-1 rounded border border-border bg-surface-2 px-1.5 py-1 font-mono text-xs text-fg outline-none placeholder:font-sans placeholder:text-fg-faint focus:border-accent`,value:c,disabled:f,onChange:e=>{l(e.target.value),d(null)},onKeyDown:e=>{e.stopPropagation(),e.key===`Enter`?(e.preventDefault(),h()):e.key===`Escape`&&(e.preventDefault(),s(!1))}}),(0,W.jsx)(`button`,{type:`button`,"data-testid":`custom-model-apply-${e}`,className:`rounded bg-accent px-2 py-1 text-[11px] font-semibold text-accent-fg disabled:opacity-50`,disabled:f||c.trim()===``,onClick:()=>void h(),children:`Use`})]}),(0,W.jsx)(`div`,{className:U(`mt-1 text-[10px] leading-snug`,u?`text-danger`:`text-fg-faint`),role:u?`alert`:void 0,children:u??m})]}):(0,W.jsxs)(`button`,{type:`button`,"data-testid":`custom-model-entry-${e}`,className:U(`flex w-full items-center gap-1.5 px-2 py-1.5 text-left text-xs hover:bg-fg/5`,r?`text-danger`:`text-fg-faint`),title:m,onClick:()=>{l(r??i),d(null),s(!0)},children:[(0,W.jsx)(K.Plus,{className:`w-3 h-3 flex-shrink-0`,"aria-hidden":`true`}),(0,W.jsx)(`span`,{className:`truncate`,children:r?Hh(r):`Custom model…`})]})}var TC=120,ore=400,sre=200,cre=304,lre=14,EC=40.25;function ure({m:e,selected:t,active:n,providerLabel:r,onHover:i,onPick:a}){return(0,W.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":t,"data-testid":`model-option-${e.value}`,"data-value":e.value,"data-free":e.free?`true`:void 0,"data-cursor":n?`true`:void 0,className:U(`flex w-full items-center gap-1.5 px-2 py-1.5 text-left text-xs`,n?`bg-accent/10`:`hover:bg-fg/5`,t?`text-accent font-semibold`:`text-fg`),onMouseEnter:i,onClick:a,children:[(0,W.jsx)(`span`,{className:U(`truncate`,e.free||t?`font-semibold`:void 0),children:e.label}),r?(0,W.jsx)(`span`,{"data-testid":`model-option-provider`,className:`min-w-0 flex-shrink truncate text-[10px] font-normal text-fg-faint`,children:r}):null,e.free?(0,W.jsx)(wC,{}):null,(0,W.jsx)(ere,{m:e}),t?(0,W.jsx)(`span`,{className:`ml-auto shrink-0 pl-1 text-xs font-bold text-accent`,title:`Selected`,"aria-hidden":`true`,children:`✓`}):null]})}function dre({keyId:e,label:t,providerId:n,count:r,direct:i,usageCard:a,open:o,walking:s,current:c,onPick:l,onHover:u,onLeave:d}){return(0,W.jsxs)(`button`,{type:`button`,role:`menuitem`,"aria-haspopup":`listbox`,"aria-expanded":o,"data-testid":`model-provider-${e}`,"data-open":o?`true`:void 0,title:a?void 0:i?`${t} — runs straight from this PC to the provider, never through our servers.`:t,className:U(`flex w-full items-center gap-1.5 px-2 py-1.5 text-left text-xs`,o?s?`bg-accent/15`:`bg-fg/10`:`hover:bg-fg/5`,c?`font-semibold text-accent`:`text-fg`),onClick:l,onMouseEnter:u,onMouseLeave:d,children:[n===null?(0,W.jsx)(`span`,{"aria-hidden":`true`,className:`flex-shrink-0 rounded-sm bg-fg/10 px-1 text-[9px] leading-snug font-semibold text-fg-muted`,children:`IQ`}):(0,W.jsx)(pC,{providerId:n,displayName:t,size:12}),(0,W.jsx)(`span`,{className:`truncate`,children:t}),(0,W.jsx)(`span`,{className:`ml-auto flex-shrink-0 pl-2 text-[10px] font-normal text-fg-faint tabular-nums`,children:r}),(0,W.jsx)(`span`,{"aria-hidden":`true`,className:`flex-shrink-0 text-fg-faint`,children:`›`})]})}function fre({disabled:e,className:t}){let{state:n,actions:r,api:i}=G(),a=dS(),[o,s]=(0,v.useState)(!1),[c,l]=(0,v.useState)(null),u=(0,v.useRef)(null),d=typeof i.getProviderUsage==`function`,[f,p]=(0,v.useState)(null),m=(0,v.useRef)(null),h=(0,v.useRef)(null),g=(0,v.useRef)(!1),_=(0,v.useId)(),[y,b]=(0,v.useState)(``),[x,S]=(0,v.useState)({}),[C,w]=(0,v.useState)(``),[T,E]=(0,v.useState)(`models`),[D,O]=(0,v.useState)(0),k=(0,v.useRef)(null),A=(0,v.useRef)(null),j=(0,v.useRef)(null),M=(0,v.useRef)(null),N=(0,v.useRef)(null),ee=(0,v.useRef)(null),te=n.settings?.modelVisibility??null,P=(0,v.useMemo)(()=>bm(n.providers,te),[n.providers,te]),F=n.providers.some(e=>e.definition.id===`google-agy`&&e.definition.enabled&&!e.configured),ne=a?n.pendingRouting[a]:void 0,I=fC(),re=I,ie=I.auto,L=re.providerId&&re.modelId?_m(re.providerId,re.modelId,re.variantId):``,R=P.flatMap(e=>e.models).find(e=>e.value===L)??null,z=!R&&L?re.modelId:null,ae=dC(),oe=Ine(),se=jne(),ce=(0,v.useMemo)(()=>{if(!oe?.fallbackModel)return!1;let e=Js(oe.fallbackModel);return P.some(t=>t.models.some(t=>Js(t.modelId)===e))},[oe?.fallbackModel,P]),le=C.trim().toLowerCase(),ue=(0,v.useMemo)(()=>P.flatMap(e=>{if(!le)return[{g:e,models:e.models}];let t=e.models.filter(e=>e.label.toLowerCase().includes(le)||e.modelId.toLowerCase().includes(le));return t.length>0?[{g:e,models:t}]:[]}),[P,le]),de=(0,v.useMemo)(()=>ue.map(e=>xm(e.g)),[ue]),fe=P.find(e=>e.models.some(e=>e.value===L||Cm(e,re)))??null,pe=de.includes(y)?y:de[0]??``,me=ue.find(e=>xm(e.g)===pe)??null,he=me?.g??null,ge=c?ue.find(e=>xm(e.g)===c)?.g??null:null,_e=x[pe]??``,ve=(0,v.useMemo)(()=>{let e=_e.trim().toLowerCase(),t=(me?[me]:[]).flatMap(e=>e.models.map(t=>({m:t,group:e.g.label,details:t.details})));return pee(e?t.filter(t=>t.m.label.toLowerCase().includes(e)||t.m.modelId.toLowerCase().includes(e)):t)},[ue,me,_e]);(0,v.useEffect)(()=>{if(!o)return;let e=ve.findIndex(e=>e.m.value===L);O(e>=0?e:0)},[o,ve,L]);let ye=()=>{ee.current&&=(clearTimeout(ee.current),null)},be=()=>{u.current&&=(clearTimeout(u.current),null),l(null)};(0,v.useEffect)(()=>()=>{ye(),u.current&&clearTimeout(u.current),m.current&&clearTimeout(m.current),h.current&&clearTimeout(h.current)},[]),(0,v.useEffect)(()=>{if(!o)return;let e=e=>{k.current&&!k.current.contains(e.target)&&s(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[o]);let xe=()=>{b(fe?xm(fe):de[0]??``),S({}),w(``),E(`models`),s(!0)},Se=(e=!0)=>{ye(),be(),s(!1),S({}),w(``),e&&(g.current=!0,A.current?.focus(),g.current=!1)},Ce=e=>{r.setSessionModel(e.modelId,e.providerId,e.variantId,a??void 0),Se()},we=e=>{E(e),(e===`providers`?N:M).current?.focus()},Te=e=>{ye(),b(e),we(`models`)},Ee=e=>{ye(),e!==pe&&(ee.current=setTimeout(()=>{ee.current=null,b(e)},TC))},De=(e,t)=>{be(),!(!d||t===`oonacode`)&&(u.current=setTimeout(()=>{u.current=null,l(e)},TC))},Oe=()=>{m.current&&clearTimeout(m.current),h.current&&clearTimeout(h.current),m.current=null,h.current=null},ke=()=>{Oe(),p(null)},Ae=()=>{let e=k.current?.getBoundingClientRect(),t=!1,n=0;if(e){let r=window.innerHeight-e.bottom;t=r>=360?!1:e.top>r,n=Math.max(Math.min(0,window.innerWidth-8-(e.left+cre)),8-e.left)}p({above:t,left:n})},je=()=>{h.current&&=(clearTimeout(h.current),null),!(f||m.current)&&(m.current=setTimeout(()=>{m.current=null,Ae()},ore))},Me=()=>{m.current&&=(clearTimeout(m.current),null),!(!f||h.current)&&(h.current=setTimeout(()=>{h.current=null,p(null)},sre))},Ne=e=>{if(g.current){g.current=!1;return}let t=!0;try{t=e.matches(`:focus-visible`)}catch{t=!0}t&&je()},Pe=e=>{if(e.key===`Escape`){e.preventDefault(),Se();return}let t=e.target instanceof HTMLElement?e.target:null;if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault();let t=e.key===`ArrowDown`?1:-1;if(T===`providers`){let e=de[(de.indexOf(pe)+t+de.length)%de.length];e&&b(e)}else ve.length>0&&O(e=>(e+t+ve.length)%ve.length);return}if(e.key===`Home`||e.key===`End`){if(e.preventDefault(),T===`providers`){let t=de[e.key===`Home`?0:de.length-1];t&&b(t)}else O(e.key===`Home`?0:Math.max(0,ve.length-1));return}if(e.key===`ArrowLeft`){let n=!(t instanceof HTMLInputElement)||t.selectionStart===0&&t.selectionEnd===0;T===`models`&&n&&(e.preventDefault(),we(`providers`));return}if(e.key===`ArrowRight`){let n=!(t instanceof HTMLInputElement)||t.selectionStart===t.value.length&&t.selectionEnd===t.value.length;T===`providers`&&n&&(e.preventDefault(),we(`models`));return}if(e.key===`Enter`){let n=t?.closest(`[role="option"]`);if(n){e.preventDefault();let t=ve.find(e=>e.m.value===n.getAttribute(`data-value`));t&&Ce(t.m);return}if(t?.closest(`button, a`))return;if(e.preventDefault(),T===`providers`){we(`models`);return}let r=ve[D];r&&Ce(r.m)}},[Fe,Ie]=(0,v.useState)(`right`),[Le,Re]=(0,v.useState)(0),[ze,Be]=(0,v.useState)(!0);(0,v.useLayoutEffect)(()=>{if(!o)return;let e=()=>{let e=k.current?.getBoundingClientRect();if(!e)return;let t=Math.min(EC*16,window.innerWidth-16),n=Math.max(Math.min(0,window.innerWidth-8-(e.left+t)),8-e.left);Re(n);let r=e.left+n;Ie(r+t+312<=window.innerWidth?`right`:`left`);let i=window.innerHeight-e.bottom,a=e.top;Be(i>=420?!1:a>i)};return e(),M.current?.focus({preventScroll:!0}),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[o]),(0,v.useEffect)(()=>{o&&(j.current?.querySelector(`[data-cursor="true"]`))?.scrollIntoView({block:`nearest`})},[o,D]);let B=(()=>{let e=ie?.routedModel?Js(ie.routedModel):null;return e?P.filter(e=>e.providerId===`oonacode`).flatMap(e=>e.models).find(t=>Js(t.modelId)===e)?.label??e:null})(),Ve=(ie?B:null)??R?.label??z??null,He=R?.providerId??re.providerId??``,Ue=P.find(e=>e.providerId===He)?.label??He,We=oe?Fne(oe,Ve,ce):null,Ge=oe!==null&&!ae,Ke=se!==null&&!Ge,qe=ie!==null&&!Ge&&!Ke,V=qe?Ree(B):Ve??`No model`,Je=ne!==void 0&&!Ge&&!Ke&&!ae,Ye=(()=>{if(!Je||!a)return null;let e=n.transcripts[a],t=e?.init?.model??null,r=t?P.flatMap(e=>e.models).find(e=>Js(e.modelId)===Js(t))?.label??t:null;return Nne({pick:V,now:r,working:e?.status===`running`||e?.status===`waiting_permission`})})(),Xe=se?`${se} is not a model OonaCode lists — this chat runs on it as it is. Pick a model to leave it, or type another under any provider's Custom model….`:null,Ze=Ge?We:Ke?Xe:Je?Ye:qe?ie?.note??null:null,Qe=d&&!o&&!e&&!ae&&!qe&&!Ge&&!Ke&&He!==``&&He!==`oonacode`?He:null,$e=Qe===null?null:P.find(e=>e.providerId===Qe&&(e.variantId??null)===(re.variantId??null))??P.find(e=>e.providerId===Qe)??null,et=(()=>{let e=re.modelId;if(!e)return null;let t=n.providers.find(e=>e.definition.id===Qe)?.definition.models.find(t=>t.id===e)?.upstreamId;return{label:Ge||Ke?e:R?.label??e,ids:t&&t!==e?[e,t]:[e]}})();(0,v.useEffect)(()=>{Qe===null&&(m.current&&clearTimeout(m.current),h.current&&clearTimeout(h.current),m.current=null,h.current=null,p(null))},[Qe]);let tt=f!==null&&Qe!==null;return(0,W.jsxs)(`span`,{ref:k,className:`relative inline-flex min-w-0 max-w-full items-center gap-1.5`,onBlur:e=>{k.current?.contains(e.relatedTarget)||ke()},children:[(0,W.jsxs)(`button`,{type:`button`,ref:A,"aria-label":`Model`,"aria-haspopup":`listbox`,"aria-expanded":o,"aria-describedby":tt?_:void 0,"data-testid":`model-picker`,disabled:e,onPointerEnter:e=>{e.pointerType!==`touch`&&e.pointerType!==`pen`&&Qe!==null&&je()},onPointerLeave:Me,onFocus:e=>{Qe!==null&&Ne(e.currentTarget)},className:U(`flex max-w-[min(22rem,100%)] min-w-[min(9rem,100%)] items-center gap-1.5 rounded-md border bg-surface-2 px-1.5 py-0.5 text-xs text-fg disabled:opacity-50`,Ge||Ke?`border-danger/60 hover:border-danger`:Je?`border-warn/60 hover:border-warn`:`border-border hover:border-fg-faint`,t),onClick:()=>{ke(),o?Se():xe()},onKeyDown:e=>{if(e.key===`Escape`&&f){ke();return}!o&&(e.key===`ArrowDown`||e.key===`Enter`||e.key===` `)&&(e.preventDefault(),ke(),xe())},title:Qe===null?Ze??void 0:void 0,"aria-description":Qe===null?void 0:Ze??void 0,children:[He?(0,W.jsx)(pC,{providerId:He,displayName:Ue,size:13}):null,Ge?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(K.Shield,{className:`w-3 h-3 flex-shrink-0 text-danger`,"aria-hidden":`true`}),(0,W.jsx)(`span`,{className:`truncate text-danger`,"data-testid":`model-picker-safeguard`,children:oe.chipLabel})]}):Ke?(0,W.jsx)(`span`,{className:`truncate text-danger`,"data-testid":`model-picker-custom`,children:Hh(se)}):qe?(0,W.jsx)(`span`,{className:`truncate`,"data-testid":`model-picker-auto`,children:V}):(0,W.jsx)(`span`,{className:U(`truncate`,ae?`text-danger`:void 0),"data-testid":ae?`model-picker-withdrawn`:void 0,title:ae?`${ae} is no longer offered — pick another model to continue this chat`:void 0,children:V}),R?.free&&!Ge&&!Ke&&!qe?(0,W.jsx)(wC,{}):null,Je?(0,W.jsx)(`span`,{className:`shrink-0 rounded bg-warn-soft px-1 text-[10px] text-warn`,"data-testid":`model-picker-staged`,children:Mne}):null,(0,W.jsx)(`span`,{"aria-hidden":`true`,className:`text-fg-faint`,children:`▾`})]}),tt&&$e&&f?(0,W.jsx)(yC,{id:_,providerId:$e.providerId,label:$e.label,direct:$e.route===`direct`,side:`right`,active:et,note:Ze,anchor:f,onPointerEnter:je,onPointerLeave:Me}):null,o?(0,W.jsxs)(`div`,{"data-testid":`model-picker-panel`,className:U(`absolute z-50 max-w-[calc(100vw-1rem)]`,ze?`bottom-full mb-1`:`top-full mt-1`),style:{width:`${EC}rem`,left:Le},onKeyDown:Pe,children:[(0,W.jsxs)(`div`,{className:`flex h-[26rem] max-h-[70vh] items-stretch gap-1`,children:[(0,W.jsxs)(`div`,{"data-testid":`model-picker-chrome`,className:`flex flex-shrink-0 flex-col overflow-hidden rounded-lg border border-border bg-surface shadow-lg`,style:{width:`${lre}rem`},children:[Ge&&We?(0,W.jsxs)(`div`,{className:`flex items-start gap-1.5 border-b border-danger/40 bg-danger-soft px-2 py-1.5 text-[11px] leading-snug text-danger`,"data-testid":`model-picker-safeguard-note`,role:`note`,children:[(0,W.jsx)(K.Shield,{className:`mt-px w-3 h-3 flex-shrink-0`,"aria-hidden":`true`}),(0,W.jsx)(`span`,{children:We})]}):null,Ke&&Xe?(0,W.jsx)(`div`,{className:`border-b border-danger/40 bg-danger-soft px-2 py-1.5 text-[11px] leading-snug text-danger`,"data-testid":`model-picker-custom-note`,role:`note`,children:Xe}):null,Je&&Ye?(0,W.jsx)(`div`,{className:`border-b border-warn/40 bg-warn-soft px-2 py-1.5 text-[11px] leading-snug text-warn`,"data-testid":`model-picker-staged-note`,role:`note`,children:Ye}):null,(0,W.jsx)(`div`,{className:`border-b border-border p-1.5`,children:(0,W.jsx)(`input`,{ref:N,type:`text`,"data-testid":`model-provider-search`,"aria-label":`Find a model in any provider`,placeholder:`Find a model in any provider…`,className:`w-full rounded border-0 bg-transparent px-1.5 py-1 text-xs text-fg outline-none placeholder:text-fg-faint`,value:C,onFocus:()=>E(`providers`),onChange:e=>{w(e.target.value),E(`providers`)}})}),(0,W.jsxs)(`div`,{role:`menu`,"aria-label":`Provider`,"data-testid":`model-providers`,className:`min-h-0 flex-1 overflow-y-auto py-1`,children:[P.length===0?(0,W.jsx)(`div`,{className:`px-3 py-6 text-center text-xs text-fg-muted`,children:`No provider configured — add one in Settings → Providers`}):P.length>0&&ue.length===0?(0,W.jsxs)(`div`,{className:`px-3 py-6 text-center text-xs text-fg-muted`,"data-testid":`model-providers-empty`,children:[`No model matches “`,C.trim(),`”`]}):null,ue.map(({g:e,models:t})=>{let n=xm(e);return(0,W.jsx)(dre,{keyId:n,label:e.label,providerId:e.providerId,count:t.length,direct:e.route===`direct`,usageCard:d&&e.providerId!==`oonacode`,open:pe===n,walking:T===`providers`,current:e===fe,onPick:()=>Te(n),onHover:()=>{Ee(n),De(n,e.providerId)},onLeave:()=>{ye(),be()}},n)}),F?(0,W.jsx)(`button`,{type:`button`,"data-testid":`model-agy-setup`,className:`flex w-full items-center px-3 py-2 text-left text-xs text-accent hover:bg-fg/5`,onClick:()=>{Se(!1),r.openProviderConnect(Jh)},children:`Set up Gemini on your Google plan…`}):null]}),(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 border-t border-border px-2 py-1.5 text-[11px]`,children:[(0,W.jsx)(`button`,{type:`button`,"data-testid":`manage-models-entry`,className:`text-fg-muted hover:text-fg`,onClick:()=>{Se(!1),r.openDialog(`manage-models`)},children:`Manage models…`}),(0,W.jsx)(`button`,{type:`button`,"data-testid":`manage-providers-entry`,className:`text-fg-muted hover:text-fg`,onClick:()=>{Se(!1),r.openSettings(`providers`)},children:`Manage providers…`}),(0,W.jsx)(`a`,{href:`https://artificialanalysis.ai/`,target:`_blank`,rel:`noreferrer noopener`,className:`text-fg-faint hover:text-fg-muted`,title:`IQ and coding scores are Artificial Analysis's measurements`,children:`ratings by Artificial Analysis`})]})]}),P.length>0?(0,W.jsxs)(`div`,{"data-testid":`model-picker-flyout`,className:`flex min-w-0 flex-1 flex-col overflow-hidden rounded-lg border border-border bg-surface shadow-lg`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-1.5 border-b border-border bg-surface-2 px-2 py-1 text-[10px] font-semibold tracking-wide text-fg-muted uppercase`,children:[he?(0,W.jsx)(pC,{providerId:he.providerId,displayName:he.label,size:12}):null,(0,W.jsx)(`span`,{className:`truncate`,"data-testid":`model-flyout-title`,children:he?he.label:``}),he?.route===`direct`?(0,W.jsx)(`span`,{className:`flex-shrink-0 font-normal tracking-normal text-fg-faint normal-case`,title:`Runs straight from this PC to the provider — never through our servers.`,children:`· direct`}):null,(0,W.jsx)(`span`,{className:`ml-auto flex-shrink-0 font-normal tracking-normal text-fg-faint normal-case`,title:`Best first by Artificial Analysis's intelligence index; models they do not rate come last.`,children:`sorted by IQ`})]}),(0,W.jsx)(`div`,{className:`border-b border-border p-1.5`,children:(0,W.jsx)(`input`,{ref:M,type:`text`,"data-testid":`model-search`,placeholder:he?`Search ${he.label} models…`:`Search all models…`,className:`w-full rounded border-0 bg-transparent px-1.5 py-1 text-xs text-fg outline-none placeholder:text-fg-faint`,value:_e,onFocus:()=>E(`models`),onChange:e=>{S(t=>({...t,[pe]:e.target.value})),E(`models`)}})}),(0,W.jsxs)(`div`,{ref:j,role:`listbox`,"aria-label":`Model`,className:`min-h-0 flex-1 overflow-y-auto`,children:[ve.length===0?(0,W.jsxs)(`div`,{className:`px-3 py-6 text-center text-xs text-fg-muted`,children:[`Nothing matches “`,_e,`”`]}):null,ve.map((e,t)=>(0,W.jsx)(ure,{m:e.m,selected:e.m.value===L||Cm(e.m,re),active:t===D,...he===null?{providerLabel:e.group}:{},onHover:()=>O(t),onPick:()=>Ce(e.m)},e.m.value)),he?(0,W.jsx)(are,{sectionKey:pe,sectionLabel:he.label,providerId:he.providerId,current:se!==null&&he.providerId===re.providerId&&(he.variantId??null)===(re.variantId??null)?se:null,initial:Rh(_e.trim())?_e.trim():``,onApply:async e=>{let t=await r.setSessionCustomModel(e,a??void 0,{providerId:he.providerId,variantId:he.variantId});return t&&Se(),t}}):null]})]}):null]}),ge?(0,W.jsx)(yC,{providerId:ge.providerId,label:ge.label,direct:ge.route===`direct`,side:Fe}):ve[D]?(0,W.jsx)(tre,{m:ve[D].m,group:ve[D].group,side:Fe}):null]}):null]})}var DC=`Not available on this PC yet`,OC=`Sign in first`,pre=`Off: read-only — the agent can look but not change anything. On: it may change things, and asks you before every change.`;function kC(e){return!!e.connector}function AC(e){return`Sign in on ${e?.trim()||`that PC`} — the sign-in opens a browser on that PC`}function mre(e=typeof window>`u`?null:window.location){if(!e)return!1;let t=e.hostname.replace(/^\[|\]$/g,``).toLowerCase();return e.protocol===`file:`||e.protocol===`app:`||e.protocol===`oonacode:`||t===``||t===`localhost`||t===`127.0.0.1`||t===`::1`?!1:!t.endsWith(`.localhost`)}function hre(e){let t=e.cli;return t?t.installed?`${t.command} ${t.version??``}`.trim()+` installed`:`${t.command} CLI not installed${t.installHint?` — ${t.installHint}`:``}`:null}function gre(e){return`Vendor skills: ${e.skills.installed} of ${e.skills.total} installed`}function jC(e){if(e.toolName!==`ConnectorChange`)return null;let t=e.input;if(!t||typeof t!=`object`||typeof t.connector!=`string`||typeof t.vendor!=`string`||typeof t.tool!=`string`)return null;let n=t.arguments;return{connector:t.connector,vendor:t.vendor,tool:t.tool,description:typeof t.description==`string`?t.description:``,arguments:n&&typeof n==`object`&&!Array.isArray(n)?n:{}}}function _re(e,t){return`${t?`Allowed`:`Denied`} ${e.tool} on ${e.vendor}`}var vre=4e3;function yre(e){let t=!1,n=(e,r)=>{if(typeof e==`string`)return e.length<=300?e:(t=!0,`${e.slice(0,300)}…`);if(Array.isArray(e)){if(r>6)return t=!0,`…`;let i=e.slice(0,12).map(e=>n(e,r+1));return e.length>12&&(t=!0,i.push(`… ${e.length-12} more`)),i}if(e&&typeof e==`object`){if(r>6)return t=!0,`…`;let i={};for(let[t,a]of Object.entries(e))i[t]=n(a,r+1);return i}return e},r=JSON.stringify(n(e,0),null,2)??`{}`;return r.length>4e3&&(r=`${r.slice(0,vre)}…`,t=!0),{text:r,shortened:t}}var bre=2e3;function xre(e){return e instanceof sg?e.message||`The PC refused (${e.status}).`:e instanceof Error?e.message:`Something went wrong.`}function Sre(e,t){let[n,r]=(0,v.useState)(null),[i,a]=(0,v.useState)(!1),[o,s]=(0,v.useState)(null),c=(0,v.useRef)(!0);(0,v.useEffect)(()=>(c.current=!0,()=>{c.current=!1}),[]);let l=(0,v.useCallback)(e=>{!e||typeof e!=`object`||typeof e.slug!=`string`||r(t=>({...t??{},[e.slug]:e}))},[]),u=(0,v.useCallback)(async()=>{if(!e.listConnectors){a(!0);return}try{let t=await e.listConnectors();if(!c.current)return;a(!1),r(Object.fromEntries(t.connectors.map(e=>[e.slug,e])))}catch(e){if(!c.current)return;dg(e)&&a(!0)}},[e]);(0,v.useEffect)(()=>{t&&u()},[t,u]);let d=Object.values(n??{}).some(e=>e.state===`connecting`);(0,v.useEffect)(()=>{if(!t||!d)return;let e=setInterval(()=>void u(),bre);return()=>clearInterval(e)},[t,d,u]);let f=(0,v.useCallback)(async(e,t)=>{if(!t)return a(!0),!1;s(null);try{let e=await t();return!c.current||(e&&typeof e==`object`&&`slug`in e&&`state`in e&&l(e),await u(),!0)}catch(t){return c.current&&(dg(t)?a(!0):s({slug:e,message:xre(t)})),!1}},[l,u]);return{byslug:n,unavailable:i,error:o,refresh:u,signIn:(t,n)=>f(t,e.signInConnector?()=>e.signInConnector(t,n):void 0),signOut:t=>f(t,e.signOutConnector?()=>e.signOutConnector(t):void 0),setAllowChanges:(t,n)=>f(t,e.updateConnector?()=>e.updateConnector(t,{allowChanges:n}):void 0),installSkills:t=>f(t,e.installConnectorSkills?()=>e.installConnectorSkills(t):void 0),clearError:()=>s(null)}}function MC(e){return e&&/^https?:\/\/\S+$/i.test(e)?e:null}var Cre={"signed-out":`text-fg-muted`,connecting:`text-accent`,connected:`text-ok`,expired:`text-warn`,error:`text-danger`};function wre({pack:e,status:t,view:n,remoteName:r,onSignIn:i}){let a=e.connector,[o,s]=(0,v.useState)(!1),[c,l]=(0,v.useState)(null),u=(0,v.useRef)(null);(0,v.useEffect)(()=>()=>{u.current&&clearTimeout(u.current)},[]);let d=async(e,t)=>{l(e);try{await t()}finally{l(null)}};if(n.unavailable)return(0,W.jsx)(`p`,{className:`mt-1 text-[11px] text-fg-faint`,"data-testid":`connector-unavailable-${e.slug}`,children:DC});if(!t)return null;let f=MC(t.signInUrl),p=r!==null,m=hre(t),h=t.cli&&!t.cli.installed?t.cli.installHint:null,g=t.skills.total>0&&t.skills.installed<t.skills.total,_=t.state===`connected`,y=t.state===`signed-out`||t.state===`expired`||t.state===`error`,b=async e=>{try{await navigator.clipboard?.writeText(e),s(!0),u.current&&clearTimeout(u.current),u.current=setTimeout(()=>s(!1),1500)}catch{}};return(0,W.jsxs)(`div`,{className:`mt-1.5 space-y-1.5 text-[11px]`,"data-testid":`connector-${e.slug}`,"data-state":t.state,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,W.jsx)(`span`,{className:U(`font-medium`,Cre[t.state]),"data-testid":`connector-state-${e.slug}`,children:pu(t.state)}),t.account?(0,W.jsx)(`span`,{className:`truncate text-fg-muted`,"data-testid":`connector-account-${e.slug}`,children:t.account}):null,_?(0,W.jsx)(q,{size:`sm`,variant:`ghost`,busy:c===`out`,"data-testid":`connector-sign-out-${e.slug}`,onClick:()=>void d(`out`,()=>n.signOut(e.slug)),children:`Sign out`}):null,y&&!p?(0,W.jsx)(q,{size:`sm`,variant:`inverse`,"data-testid":`connector-sign-in-${e.slug}`,onClick:i,children:t.state===`signed-out`?`Sign in`:`Sign in again`}):null,t.state===`connecting`&&!p?(0,W.jsxs)(W.Fragment,{children:[f?(0,W.jsx)(`a`,{href:f,target:`_blank`,rel:`noreferrer noopener`,className:`text-accent underline`,"data-testid":`connector-sign-in-link-${e.slug}`,children:`Open the sign-in page`}):null,(0,W.jsx)(q,{size:`sm`,variant:`ghost`,busy:c===`cancel`,"data-testid":`connector-cancel-${e.slug}`,onClick:()=>void d(`cancel`,()=>n.signOut(e.slug)),children:`Cancel`})]}):null]}),y&&p?(0,W.jsx)(`p`,{className:`text-fg-muted`,"data-testid":`connector-remote-${e.slug}`,children:AC(r)}):null,t.state===`connecting`&&p?(0,W.jsx)(`p`,{className:`text-fg-muted`,"data-testid":`connector-remote-${e.slug}`,children:AC(r)}):null,(t.state===`error`||t.state===`expired`)&&t.message?(0,W.jsx)(`p`,{className:`text-fg-muted`,"data-testid":`connector-message-${e.slug}`,children:t.message}):null,_?(0,W.jsx)(`div`,{className:`-my-1`,"data-testid":`connector-allow-${e.slug}`,children:(0,W.jsx)(PS,{checked:t.allowChanges,label:`Allow changes`,hint:pre,disabled:c===`allow`,onChange:t=>void d(`allow`,()=>n.setAllowChanges(e.slug,t))})}):null,n.error?.slug===e.slug?(0,W.jsx)(`p`,{className:`text-danger`,role:`alert`,"data-testid":`connector-error-${e.slug}`,children:n.error.message}):null,t.cli||t.skills.total>0?(0,W.jsxs)(`div`,{className:`rounded border border-border bg-surface-2/50 px-2 py-1.5`,"data-testid":`connector-needs-${e.slug}`,children:[(0,W.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wide text-fg-faint`,children:`Needs on this PC`}),m?(0,W.jsxs)(`div`,{className:`mt-1`,"data-testid":`connector-cli-${e.slug}`,children:[(0,W.jsxs)(`div`,{className:`flex items-start gap-1.5`,children:[(0,W.jsx)(`span`,{className:`min-w-0 flex-1 break-words text-fg`,children:m}),h?(0,W.jsxs)(q,{size:`sm`,variant:`ghost`,"data-testid":`connector-copy-${e.slug}`,onClick:()=>void b(h),children:[(0,W.jsx)(K.Copy,{className:`w-3 h-3`}),` `,o?`Copied`:`Copy`]}):null]}),a.cli?.purpose?(0,W.jsx)(`div`,{className:`text-fg-faint`,children:a.cli.purpose}):null]}):null,t.skills.total>0?(0,W.jsxs)(`div`,{className:`mt-1 flex items-center gap-1.5`,"data-testid":`connector-skills-${e.slug}`,children:[(0,W.jsx)(`span`,{className:`min-w-0 flex-1 text-fg`,children:gre(t)}),g?(0,W.jsx)(q,{size:`sm`,variant:`secondary`,busy:c===`skills`,"data-testid":`connector-install-skills-${e.slug}`,onClick:()=>void d(`skills`,()=>n.installSkills(e.slug)),children:`Install skills`}):null]}):null]}):null,MC(a.docsUrl)?(0,W.jsxs)(`a`,{href:a.docsUrl,target:`_blank`,rel:`noreferrer noopener`,className:`text-accent underline`,"data-testid":`connector-docs-${e.slug}`,children:[a.vendor,` documentation`]}):null]})}function Tre({pack:e,status:t,view:n,onDone:r}){let i=e.connector,[a,o]=(0,v.useState)(`choose`),[s,c]=(0,v.useState)(!1),l=(0,v.useRef)(null),u=i.auth.methods.includes(`token`)&&i.auth.token!==null,d=i.auth.methods.includes(`oauth`),f=t?.state===`connected`;(0,v.useEffect)(()=>{f&&r()},[f,r]);let p=t?.state===`connecting`,m=MC(t?.signInUrl),h=async()=>{c(!0),await n.signIn(e.slug,{method:`oauth`}),c(!1)},g=async()=>{let t=l.current,r=t?.value.trim()??``;!t||!r||(t.value=``,c(!0),await n.signIn(e.slug,{method:`token`,token:r}),c(!1))};return p?(0,W.jsxs)(`div`,{className:`space-y-3 text-sm`,"data-testid":`connector-dialog-waiting`,children:[(0,W.jsxs)(`p`,{className:`flex items-center gap-2 text-fg`,children:[(0,W.jsx)(K.Spinner,{className:`w-4 h-4`}),` Waiting for your sign-in…`]}),(0,W.jsxs)(`p`,{className:`text-fg-muted`,children:[`A browser window opened on this PC. Sign in to `,i.vendor,` there and approve OonaCode.`]}),m?(0,W.jsx)(`p`,{className:`break-all`,children:(0,W.jsx)(`a`,{href:m,target:`_blank`,rel:`noreferrer noopener`,className:`text-accent underline`,"data-testid":`connector-dialog-link`,children:m})}):null,(0,W.jsx)(`div`,{className:`flex justify-end`,children:(0,W.jsx)(q,{variant:`ghost`,"data-testid":`connector-dialog-cancel`,onClick:()=>void n.signOut(e.slug).then(()=>{r()}),children:`Cancel`})})]}):(0,W.jsxs)(`div`,{className:`space-y-4 text-sm`,"data-testid":`connector-dialog`,children:[t&&(t.state===`error`||t.state===`expired`)&&t.message?(0,W.jsx)(`p`,{className:`rounded border border-border bg-surface-2 px-2 py-1.5 text-fg-muted`,children:t.message}):null,n.error?.slug===e.slug?(0,W.jsx)(`p`,{className:`text-danger`,role:`alert`,"data-testid":`connector-dialog-error`,children:n.error.message}):null,a===`choose`?(0,W.jsxs)(W.Fragment,{children:[d?(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(q,{variant:`inverse`,busy:s,"data-testid":`connector-dialog-oauth`,onClick:()=>void h(),children:[`Sign in with `,i.vendor]}),(0,W.jsxs)(`p`,{className:`mt-1 text-xs text-fg-faint`,children:[`Opens `,i.vendor,`'s own sign-in page in a browser on this PC. OonaCode never sees your password.`]})]}):null,u?(0,W.jsx)(`div`,{children:(0,W.jsx)(`button`,{type:`button`,className:`text-xs text-accent underline`,"data-testid":`connector-dialog-use-token`,onClick:()=>o(`token`),children:`Use an access token instead`})}):null]}):(0,W.jsxs)(`form`,{className:`space-y-2`,onSubmit:e=>{e.preventDefault(),g()},children:[(0,W.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,W.jsx)(`span`,{className:`font-medium text-fg`,children:i.auth.token?.label??`Access token`}),(0,W.jsx)(`input`,{ref:l,type:`password`,autoComplete:`off`,autoCorrect:`off`,autoCapitalize:`off`,spellCheck:!1,"data-lpignore":`true`,"data-testid":`connector-dialog-token`,className:AS,defaultValue:``,autoFocus:!0})]}),i.auth.token?.createUrl?(0,W.jsx)(`p`,{className:`text-xs`,children:(0,W.jsxs)(`a`,{href:i.auth.token.createUrl,target:`_blank`,rel:`noreferrer noopener`,className:`text-accent underline`,"data-testid":`connector-dialog-create-url`,children:[`Create a token at `,i.vendor]})}):null,i.auth.token?.note?(0,W.jsx)(`p`,{className:`text-xs text-fg-faint`,children:i.auth.token.note}):null,(0,W.jsx)(`p`,{className:`text-xs text-fg-faint`,children:`The token is sealed on this PC and synced to your other PCs only as ciphertext. This window forgets it as soon as it is sent.`}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(q,{type:`submit`,variant:`inverse`,busy:s,"data-testid":`connector-dialog-send`,children:`Sign in`}),d?(0,W.jsx)(`button`,{type:`button`,className:`text-xs text-accent underline`,onClick:()=>o(`choose`),children:`Back`}):null]})]})]})}function Ere(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var Dre=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Ore=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,kre={};function NC(e,t){return((t||kre).jsx?Ore:Dre).test(e)}var Are=/[ \t\n\f\r]/g;function jre(e){return typeof e==`object`?e.type===`text`&&PC(e.value):PC(e)}function PC(e){return e.replace(Are,``)===``}var FC=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};FC.prototype.normal={},FC.prototype.property={},FC.prototype.space=void 0;function IC(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new FC(n,r,t)}function LC(e){return e.toLowerCase()}var RC=class{constructor(e,t){this.attribute=t,this.property=e}};RC.prototype.attribute=``,RC.prototype.booleanish=!1,RC.prototype.boolean=!1,RC.prototype.commaOrSpaceSeparated=!1,RC.prototype.commaSeparated=!1,RC.prototype.defined=!1,RC.prototype.mustUseProperty=!1,RC.prototype.number=!1,RC.prototype.overloadedBoolean=!1,RC.prototype.property=``,RC.prototype.spaceSeparated=!1,RC.prototype.space=void 0;var zC=s({boolean:()=>BC,booleanish:()=>VC,commaOrSpaceSeparated:()=>GC,commaSeparated:()=>WC,number:()=>J,overloadedBoolean:()=>HC,spaceSeparated:()=>UC}),Mre=0,BC=KC(),VC=KC(),HC=KC(),J=KC(),UC=KC(),WC=KC(),GC=KC();function KC(){return 2**++Mre}var qC=Object.keys(zC),JC=class extends RC{constructor(e,t,n,r){let i=-1;if(super(e,t),YC(this,`space`,r),typeof n==`number`)for(;++i<qC.length;){let e=qC[i];YC(this,qC[i],(n&zC[e])===zC[e])}}};JC.prototype.defined=!0;function YC(e,t,n){n&&(e[t]=n)}function XC(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new JC(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[LC(r)]=r,n[LC(a.attribute)]=r}return new FC(t,n,e.space)}var ZC=XC({properties:{ariaActiveDescendant:null,ariaAtomic:VC,ariaAutoComplete:null,ariaBusy:VC,ariaChecked:VC,ariaColCount:J,ariaColIndex:J,ariaColSpan:J,ariaControls:UC,ariaCurrent:null,ariaDescribedBy:UC,ariaDetails:null,ariaDisabled:VC,ariaDropEffect:UC,ariaErrorMessage:null,ariaExpanded:VC,ariaFlowTo:UC,ariaGrabbed:VC,ariaHasPopup:null,ariaHidden:VC,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:UC,ariaLevel:J,ariaLive:null,ariaModal:VC,ariaMultiLine:VC,ariaMultiSelectable:VC,ariaOrientation:null,ariaOwns:UC,ariaPlaceholder:null,ariaPosInSet:J,ariaPressed:VC,ariaReadOnly:VC,ariaRelevant:null,ariaRequired:VC,ariaRoleDescription:UC,ariaRowCount:J,ariaRowIndex:J,ariaRowSpan:J,ariaSelected:VC,ariaSetSize:J,ariaSort:null,ariaValueMax:J,ariaValueMin:J,ariaValueNow:J,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function QC(e,t){return t in e?e[t]:t}function $C(e,t){return QC(e,t.toLowerCase())}var Nre=XC({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:WC,acceptCharset:UC,accessKey:UC,action:null,allow:null,allowFullScreen:BC,allowPaymentRequest:BC,allowUserMedia:BC,alpha:BC,alt:null,as:null,async:BC,autoCapitalize:null,autoComplete:UC,autoFocus:BC,autoPlay:BC,blocking:UC,capture:null,charSet:null,checked:BC,cite:null,className:UC,closedBy:null,colorSpace:null,cols:J,colSpan:J,command:null,commandFor:null,content:null,contentEditable:VC,controls:BC,controlsList:UC,coords:J|WC,crossOrigin:null,data:null,dateTime:null,decoding:null,default:BC,defer:BC,dir:null,dirName:null,disabled:BC,download:HC,draggable:VC,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:BC,formTarget:null,headers:UC,height:J,hidden:HC,high:J,href:null,hrefLang:null,htmlFor:UC,httpEquiv:UC,id:null,imageSizes:null,imageSrcSet:null,inert:BC,inputMode:null,integrity:null,is:null,isMap:BC,itemId:null,itemProp:UC,itemRef:UC,itemScope:BC,itemType:UC,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:BC,low:J,manifest:null,max:null,maxLength:J,media:null,method:null,min:null,minLength:J,multiple:BC,muted:BC,name:null,nonce:null,noModule:BC,noValidate:BC,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:BC,optimum:J,pattern:null,ping:UC,placeholder:null,playsInline:BC,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:BC,referrerPolicy:null,rel:UC,required:BC,reversed:BC,rows:J,rowSpan:J,sandbox:UC,scope:null,scoped:BC,seamless:BC,selected:BC,shadowRootClonable:BC,shadowRootCustomElementRegistry:BC,shadowRootDelegatesFocus:BC,shadowRootMode:null,shadowRootSerializable:BC,shape:null,size:J,sizes:null,slot:null,span:J,spellCheck:VC,src:null,srcDoc:null,srcLang:null,srcSet:null,start:J,step:null,style:null,tabIndex:J,target:null,title:null,translate:null,type:null,typeMustMatch:BC,useMap:null,value:VC,width:J,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:UC,axis:null,background:null,bgColor:null,border:J,borderColor:null,bottomMargin:J,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:BC,declare:BC,event:null,face:null,frame:null,frameBorder:null,hSpace:J,leftMargin:J,link:null,longDesc:null,lowSrc:null,marginHeight:J,marginWidth:J,noResize:BC,noHref:BC,noShade:BC,noWrap:BC,object:null,profile:null,prompt:null,rev:null,rightMargin:J,rules:null,scheme:null,scrolling:VC,standby:null,summary:null,text:null,topMargin:J,valueType:null,version:null,vAlign:null,vLink:null,vSpace:J,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:BC,disablePictureInPicture:BC,disableRemotePlayback:BC,exportParts:WC,part:UC,prefix:null,property:null,results:J,security:null,unselectable:null},space:`html`,transform:$C}),Pre=XC({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,maskType:`mask-type`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:GC,accentHeight:J,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:J,amplitude:J,arabicForm:null,ascent:J,attributeName:null,attributeType:null,azimuth:J,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:J,by:null,calcMode:null,capHeight:J,className:UC,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:J,diffuseConstant:J,direction:null,display:null,dur:null,divisor:J,dominantBaseline:null,download:BC,dx:null,dy:null,edgeMode:null,editable:null,elevation:J,enableBackground:null,end:null,event:null,exponent:J,externalResourcesRequired:null,fill:null,fillOpacity:J,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:WC,g2:WC,glyphName:WC,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:J,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:J,horizOriginX:J,horizOriginY:J,id:null,ideographic:J,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:J,k:J,k1:J,k2:J,k3:J,k4:J,kernelMatrix:GC,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:J,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:J,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:J,overlineThickness:J,paintOrder:null,panose1:null,path:null,pathLength:J,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:UC,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:J,pointsAtY:J,pointsAtZ:J,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:GC,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:GC,rev:GC,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:GC,requiredFeatures:GC,requiredFonts:GC,requiredFormats:GC,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:J,specularExponent:J,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:J,strikethroughThickness:J,string:null,stroke:null,strokeDashArray:GC,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:J,strokeOpacity:J,strokeWidth:null,style:null,surfaceScale:J,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:GC,tabIndex:J,tableValues:null,target:null,targetX:J,targetY:J,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:GC,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:J,underlineThickness:J,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:J,values:null,vAlphabetic:J,vMathematical:J,vectorEffect:null,vHanging:J,vIdeographic:J,version:null,vertAdvY:J,vertOriginX:J,vertOriginY:J,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:J,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:QC}),ew=XC({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),tw=XC({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:$C}),nw=XC({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),Fre={classId:`classID`,dataType:`datatype`,itemId:`itemID`,strokeDashArray:`strokeDasharray`,strokeDashOffset:`strokeDashoffset`,strokeLineCap:`strokeLinecap`,strokeLineJoin:`strokeLinejoin`,strokeMiterLimit:`strokeMiterlimit`,typeOf:`typeof`,xLinkActuate:`xlinkActuate`,xLinkArcRole:`xlinkArcrole`,xLinkHref:`xlinkHref`,xLinkRole:`xlinkRole`,xLinkShow:`xlinkShow`,xLinkTitle:`xlinkTitle`,xLinkType:`xlinkType`,xmlnsXLink:`xmlnsXlink`},Ire=/[A-Z]/g,rw=/-[a-z]/g,Lre=/^data[-\w.:]+$/i;function Rre(e,t){let n=LC(t),r=t,i=RC;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&Lre.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(rw,Bre);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!rw.test(e)){let n=e.replace(Ire,zre);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=JC}return new i(r,t)}function zre(e){return`-`+e.toLowerCase()}function Bre(e){return e.charAt(1).toUpperCase()}var Vre=IC([ZC,Nre,ew,tw,nw],`html`),iw=IC([ZC,Pre,ew,tw,nw],`svg`);function Hre(e){return e.join(` `).trim()}var Ure=o(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g;function u(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,u=1;function f(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(`
125
+ `)}function ute(e,t){let n=lte(t),r=e.getElementById(fv);if(n===``){r?.remove();return}let i=r??e.createElement(`style`);r||(i.id=fv,e.head.appendChild(i)),i.textContent!==n&&(i.textContent=n)}var hv=[{label:`System UI`,family:`system-ui, 'Segoe UI', Roboto, sans-serif`},{label:`Segoe UI`,family:`'Segoe UI', system-ui, sans-serif`},{label:`Arial`,family:`Arial, Helvetica, sans-serif`},{label:`Verdana`,family:`Verdana, Geneva, sans-serif`},{label:`Tahoma`,family:`Tahoma, Verdana, sans-serif`},{label:`Calibri`,family:`Calibri, Carlito, sans-serif`},{label:`Georgia (serif)`,family:`Georgia, 'Times New Roman', serif`},{label:`Times New Roman (serif)`,family:`'Times New Roman', Times, serif`},{label:`Monospace`,family:`ui-monospace, 'Cascadia Code', Consolas, monospace`}];function dte(e,t){return e===`dark`||e===`light`?e:t?`dark`:`light`}function gv(){return typeof document>`u`?`light`:document.documentElement.getAttribute(`data-theme`)===`dark`?`dark`:`light`}function fte(){let[e,t]=(0,v.useState)(gv);return(0,v.useEffect)(()=>{if(typeof document>`u`||typeof MutationObserver>`u`)return;let e=()=>t(gv());e();let n=new MutationObserver(e);return n.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-theme`]}),()=>n.disconnect()},[]),e}var _v=`oonacode.uiPrefs`;function pte(e){if(!e)return null;try{let t=e.getItem(_v);return t?Zl(JSON.parse(t)):null}catch{return null}}function vv(e,t){if(e)try{e.setItem(_v,JSON.stringify(t))}catch{}}function mte(e,t){let n=t.notifications?{...e.notifications,...t.notifications}:e.notifications;return Zl({...e,...t,notifications:n})}function hte(e){let t=e;return!t||typeof t!=`object`?!1:t.status===400||t.status===422||t.code===`bad_request`}function yv(e){let{row:t,panel:n,viewport:r}=e,i=e.gap??6,a=e.margin??8,o=Math.max(0,Math.min(e.width??352,r.width-2*a)),s=Math.max(0,Math.min(e.maxHeight??448,r.height-2*a)),c=Math.min(e.height>0?e.height:200,s),l=Math.max(a,Math.min(t.top,r.height-a-c)),u=n.right+i;if(u+o<=r.width-a)return{left:u,top:l,width:o,maxHeight:s,side:`right`};let d=n.left-i-o;if(d>=a)return{left:d,top:l,width:o,maxHeight:s,side:`left`};let f=Math.max(a,Math.min(t.left,r.width-a-o)),p=r.height-a-(t.bottom+i),m=t.top-i-a;if(p>=c||p>=m)return{left:f,top:t.bottom+i,width:o,maxHeight:Math.max(0,Math.min(s,p)),side:`below`};let h=Math.max(0,Math.min(s,m));return{left:f,top:t.top-i-Math.min(c,h),width:o,maxHeight:h,side:`above`}}function gte(e){let t=dd(e);return t?{media:t}:{}}function _te(e,t,n){let r={...e??{}};return n?r[t]=n:delete r[t],r}function vte(e,t,n){return{...e??{},ask:{...e?.ask??{},[t]:n}}}function bv(e){for(let t of Object.keys(cd))if(cd[t]===e)return t;return null}var xv={language:`en`,localVoice:{},speed:1,words:xf.words},Sv=`oonacode.voiceSummary.v1`;function yte(e){let t=e&&typeof e==`object`?e:{},n=xv,r={};if(t.localVoice&&typeof t.localVoice==`object`)for(let[e,n]of Object.entries(t.localVoice))typeof n==`string`&&n.length<300&&yf(e)&&(r[e]=n);return{language:typeof t.language==`string`&&yf(t.language)?yf(t.language).code:n.language,localVoice:r,speed:wf(t.speed),words:Cf(t.words)}}function Cv(e=Tv()){try{let t=e?.getItem(Sv);return yte(t?JSON.parse(t):null)}catch{return{...xv}}}function wv(e,t=Tv()){try{t?.setItem(Sv,JSON.stringify(e))}catch{}}function Tv(){try{return typeof window<`u`?window.localStorage:null}catch{return null}}function Ev(e){return e.kind===`system`?null:e.key.slice(e.key.indexOf(`:`)+1)}var Dv={zh:[`cmn`]};function Ov(e){return e.toLowerCase().replace(/_/g,`-`)}function kv(e,t){let n=Ov(e);return[t.code,...Dv[t.code]??[]].some(e=>n===e||n.startsWith(`${e}-`))}function bte(e,t){let n=Ov(e);return n===Ov(t.bcp47)?0:n===t.code||(Dv[t.code]??[]).includes(n)?1:2}function xte(e){let t=new Set(e.map(e=>e.name));return e.filter(e=>{let n=e.name.indexOf(`+`);if(n<=0)return!0;let r=e.name.lastIndexOf(` `),i=r>n?e.name.slice(r+1):``,a=i?`${e.name.slice(0,n)} ${i}`:e.name.slice(0,n);return!t.has(a)})}function Av(e,t,n){let r=t.filter(t=>t.language===e.code||(t.locale?kv(t.locale,e):!1)),i=r.filter(e=>e.engine!==`espeak`).map(e=>({key:`sherpa:${e.id}`,label:e.label,kind:`sherpa`})),a=r.filter(e=>e.engine===`espeak`).slice(0,1).map(e=>({key:`espeak:${e.id}`,label:e.label||`eSpeak (robotic)`,kind:`espeak`})),o=xte(n.filter(t=>kv(t.lang,e)&&t.localService!==!1)).map((t,n)=>({v:t,i:n,fit:bte(t.lang,e)})).sort((e,t)=>e.fit-t.fit||e.i-t.i).map(({v:e})=>({key:`system:${e.voiceURI}`,label:`${e.name} (system)`,kind:`system`}));return[...i,...o,...a]}function jv(e,t){return e.find(e=>e.key===t)??e[0]??null}function Mv(e,t){if(e===`win32`||e===`linux`||e===`darwin`)return e;let n=t??``;return/Windows|Win32|Win64/i.test(n)?`win32`:/Android|CrOS/i.test(n)?null:/Linux|X11/i.test(n)?`linux`:/Mac OS X|Macintosh/i.test(n)?`darwin`:null}function Nv(e,t,n=null,r=!1){let i=t?``:` The OonaCode desktop app comes with its own Armenian voices, and eSpeak for every other language.`,a=`No local voice for ${e.name} on this PC.`;return t&&n===`win32`&&r?`${a} The app’s own eSpeak voice, which speaks every language here, could not start — usually because Microsoft’s Visual C++ Redistributable (x64) is not installed: https://aka.ms/vs/17/release/vc_redist.x64.exe. Install it, then open this window again.`:n===`linux`?`${a} Install speech-dispatcher and espeak-ng from your distribution (Debian, Ubuntu, Mint: sudo apt install speech-dispatcher espeak-ng · Fedora: sudo dnf install speech-dispatcher espeak-ng · Arch: sudo pacman -S speech-dispatcher espeak-ng), then restart OonaCode.${i}`:n===`darwin`?`${a} Add a ${e.name} voice in System Settings → Accessibility → Spoken Content → System voice → Manage Voices, then open this window again.${i}`:n===`win32`?`${a} Add a ${e.name} voice in Settings → Time & language → Speech → Add voices, if Windows offers one for ${e.name}, then open this window again.${i}`:`${a} Add a ${e.name} voice in the system's speech settings (Windows: Settings → Time & language → Speech), then open this window again.${i}`}function Pv(e){return e===`linux`?`whole`:`sentences`}var Ste=75;function Fv(e,t){return Math.round(3e3+e.length*120/wf(t))}async function Cte(e,t,n,r){let{signal:i,onItem:a}=r,o=e.getVoices().find(e=>e.voiceURI===r.voiceURI)??null;e.cancel();let s=r.mode===`whole`?[n.join(` `)]:[...n];for(let c=0;c<s.length;c+=1){if(i.aborted)return;let l=s[c],u=await new Promise((s,u)=>{let d=[],f=!1,p=()=>!f&&(f=!0,d.forEach(e=>clearTimeout(e)),i.removeEventListener(`abort`,m),!0),m=()=>{p()&&(e.cancel(),s(`stopped`))},h=t(l);o&&(h.voice=o),h.lang=o?.lang??r.bcp47,h.rate=r.rate,h.onstart=()=>{if(f)return;if(r.mode===`sentences`){a(c);return}a(0);let e=0;for(let t=1;t<n.length;t+=1)e+=(n[t-1].length+1)*Ste/wf(r.rate),d.push(setTimeout(()=>!f&&a(t),e))},h.onend=()=>{p()&&s(`ended`)},h.onerror=e=>{p()&&(i.aborted||e.error===`interrupted`||e.error===`canceled`?s(`stopped`):u(Error(`The system voice failed: ${e.error??`unknown error`}`)))},i.addEventListener(`abort`,m),d.push(setTimeout(()=>{p()&&s(`lost`)},Fv(l,r.rate))),e.speak(h)});if(u===`stopped`)return;u===`lost`&&e.cancel()}}function Iv(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function wte(e,t){let n=new DataView(new ArrayBuffer(44)),r=(e,t)=>{for(let r=0;r<t.length;r+=1)n.setUint8(e+r,t.charCodeAt(r))};return r(0,`RIFF`),n.setUint32(4,36+e,!0),r(8,`WAVE`),r(12,`fmt `),n.setUint32(16,16,!0),n.setUint16(20,1,!0),n.setUint16(22,1,!0),n.setUint32(24,t,!0),n.setUint32(28,t*2,!0),n.setUint16(32,2,!0),n.setUint16(34,16,!0),r(36,`data`),n.setUint32(40,e,!0),n}function Tte(e,t){let n=new Uint8Array(44+e.length);return n.set(new Uint8Array(wte(e.length,t).buffer),0),n.set(e,44),n.buffer}function Lv(e,t){let n=new DataView(new ArrayBuffer(e.length*2));for(let t=0;t<e.length;t+=1){let r=Math.max(-1,Math.min(1,e[t]));n.setInt16(t*2,Math.round(r*32767),!0)}return Tte(new Uint8Array(n.buffer),t)}function Ete(){let e=null,t=()=>{if(!e)return;let t=e;e=null,URL.revokeObjectURL(t.url),t.done()};return{play(n,r){return t(),new Promise(i=>{let a=URL.createObjectURL(new Blob([n],{type:`audio/wav`})),o=new Audio(a);o.preservesPitch=!0,o.playbackRate=r,e={audio:o,url:a,done:i},o.onended=t,o.onerror=t,o.play().catch(t)})},stop(){e&&e.audio.pause(),t()}}}var Dte=Ete;async function Ote(e,t,n,r){if(e.length===0)return;let i=t(e[0],0);for(let a=0;a<e.length;a+=1){if(r.signal.aborted)return;let o=await i;if(r.signal.aborted)return;i=a+1<e.length?t(e[a+1],a+1):null,i?.catch(()=>void 0),r.onItem?.(a),await n.play(o,r.playbackRate??1)}}var Rv={range:`all`,from:``,to:``},zv=`oonacode.aboutBriefing.v1`,Bv=/^\d{4}-\d{2}-\d{2}$/;function Vv(e){let t=e&&typeof e==`object`?e:{};return{range:uf(t.range)?t.range:Rv.range,from:typeof t.from==`string`&&Bv.test(t.from)?t.from:``,to:typeof t.to==`string`&&Bv.test(t.to)?t.to:``}}function kte(){try{let e=window.localStorage.getItem(zv);return Vv(e?JSON.parse(e):null)}catch{return{...Rv}}}function Ate(e){try{window.localStorage.setItem(zv,JSON.stringify(e))}catch{}}function Hv(e,t){if(e.length===0)return`none`;let n=0;for(let r of e)t.has(r)&&(n+=1);return n===0?`none`:n===e.length?`all`:`some`}function Uv(e,t){let n=new Set(t);if(Hv(e,t)===`all`)for(let t of e)n.delete(t);else for(let t of e)n.add(t);return n}function Wv(e,t){let n=new Set(t),r=!1;for(let t of e)n.has(t)||(r=!0);return r?new Set([...e].filter(e=>n.has(e))):e}function jte(e,t){let n=[];if(e>0&&n.push(`${e} of the picked chats ${e===1?`has`:`have`} no about yet`),t>0){let r=e>0?`${t}`:`${t} of the picked chats`;n.push(`${r} ${t===1?`has an about`:`have abouts`} older than the chat’s last change`)}let r=[e>0?`a chat with no about is announced by its name and “no summary yet”`:null,t>0?`an older about is read as it is`:null].filter(Boolean).join(`, and `);return`${n.join(`; `)}. Writing them is one housekeeper call per chat, paid by the chat’s own route — credits for an OonaCode pool chat. Until then ${r}.`}var Gv={status:`idle`,index:-1,total:0,sessionId:null,title:null,part:0,error:null,playlist:[]};function Mte(e){return e.status===`preparing`||e.status===`speaking`||e.status===`paused`}var Kv={afterNameMs:cf.afterNameMs,betweenChatsMs:cf.betweenChatsMs};function Nte(e,t){return new Promise(n=>{if(t.aborted||e<=0){n();return}let r=()=>{clearTimeout(i),t.removeEventListener(`abort`,r),n()},i=setTimeout(r,e);t.addEventListener(`abort`,r,{once:!0})})}function Pte(e,t){return t.aborted?Promise.reject(Error(`stopped`)):new Promise((n,r)=>{let i=()=>r(Error(`stopped`));t.addEventListener(`abort`,i,{once:!0}),e.then(e=>{t.removeEventListener(`abort`,i),n(e)},e=>{t.removeEventListener(`abort`,i),r(e)})})}var Fte=class{#e;#t=[];#n=Gv;#r=null;#i=new Map;#a=new AbortController;constructor(e){this.#e=e}get state(){return this.#n}start(e,t=0){if(this.#t=[...e],this.#i.clear(),this.#t.length===0){this.#o(),this.#s({...Gv});return}this.#l(Math.max(0,Math.min(t,this.#t.length-1)),0)}pause(){(this.#n.status===`preparing`||this.#n.status===`speaking`)&&(this.#o(),this.#s({status:`paused`}))}resume(){let e=this.#n;e.index<0||this.#t.length===0||(e.status===`paused`?this.#l(e.index,e.part):e.status===`error`&&this.#l(e.index,0))}stop(){this.#o(),this.#n.status!==`idle`&&this.#n.status!==`stopped`&&this.#s({status:`stopped`,index:-1,part:0,error:null})}reset(){this.#o(),this.#t=[],this.#i.clear(),this.#n!==Gv&&(this.#n=Gv,this.#e.onState(Gv))}next(){if(this.#t.length===0||this.#n.index<0)return;let e=this.#n.index+1;if(e>=this.#t.length){this.#o(),this.#s({status:`done`,part:0});return}this.#l(e,0)}previous(){this.#t.length===0||this.#n.index<0||this.#l(Math.max(0,this.#n.index-1),0)}jumpTo(e){let t=this.#t.findIndex(t=>t.sessionId===e);t>=0&&this.#l(t,0)}resetWords(){this.#i.clear()}dispose(){this.reset(),this.#a.abort()}#o(){let e=this.#r;if(this.#r=null,e){e.abort();try{this.#e.silence()}catch{}}}#s(e){let t={...this.#n,...e},n=t.index>=0?this.#t[t.index]:void 0;t.total=this.#t.length,t.sessionId=n?.sessionId??null,t.title=n?.title??null,t.playlist=t.playlist.length===this.#t.length&&t.playlist.every((e,t)=>e===this.#t[t].sessionId)?t.playlist:this.#t.map(e=>e.sessionId),this.#n=t,this.#e.onState(t)}#c(e){let t=this.#t[e],n=this.#i.get(t.sessionId);if(n)return n;let r=this.#e.words(t,this.#a.signal);return this.#i.set(t.sessionId,r),r.catch(()=>{this.#i.get(t.sessionId)===r&&this.#i.delete(t.sessionId)}),r}#l(e,t){this.#o();let n=new AbortController;this.#r=n,this.#u(e,t,n.signal)}async#u(e,t,n){let r=this.#e.sleep??Nte,i=this.#e.afterNameMs??Kv.afterNameMs,a=this.#e.betweenChatsMs??Kv.betweenChatsMs,o=e;try{for(;o<this.#t.length;o+=1){let s=o===e?t:0;this.#s({status:`preparing`,index:o,part:s,error:null});let c=await Pte(this.#c(o),n);if(n.aborted)return;o+1<this.#t.length&&this.#c(o+1).catch(()=>void 0);let l=+!!c.name;if(c.name&&s===0&&(this.#s({status:`speaking`,part:0}),await this.#e.speak([c.name],{signal:n,onItem:()=>void 0}),n.aborted||(c.body.length>0&&await r(i,n),n.aborted)))return;let u=Math.max(0,s-l),d=c.body.slice(u);if(d.length>0&&(this.#s({status:`speaking`,part:l+u}),await this.#e.speak(d,{signal:n,onItem:e=>{n.aborted||this.#s({status:`speaking`,part:l+u+e})}}),n.aborted)||o+1<this.#t.length&&(await r(a,n),n.aborted))return}this.#r?.signal===n&&(this.#r=null),this.#s({status:`done`,index:this.#t.length-1,part:0})}catch(e){if(n.aborted)return;this.#r?.signal===n&&(this.#r=null);try{this.#e.silence()}catch{}let t=this.#t[o]?.title??`a chat`,r=e instanceof Error?e.message:String(e);this.#s({status:`error`,index:Math.min(o,this.#t.length-1),part:0,error:`${t}: ${r}`})}}};async function Ite(e,t){let{voice:n,language:r,speed:i,tts:a,signal:o,onItem:s}=t,c=n?Ev(n):null;if(c&&a){await Ote(e,async e=>{let n=await a.speak({voiceId:c,text:t.prepare(e,r.code),speed:i});return Lv(n.samples,n.sampleRate)},t.player,{signal:o,onItem:s});return}if(n?.kind===`system`){if(!t.synth)throw Error(`This window has no system speech.`);await Cte(t.synth,t.makeUtterance,e,{voiceURI:n.key.slice(7),bcp47:r.bcp47,rate:i,mode:Pv(t.platform),signal:o,onItem:s});return}throw Error(Nv(r,!!a,t.platform,t.espeakMissing))}var qv={ids:[],activeId:null};function Jv(e=[],t=null){let n=[];for(let t of e)t&&!n.includes(t)&&n.push(t);let r=n.slice(-20);return{ids:r,activeId:t&&r.includes(t)?t:r[r.length-1]??null}}function Yv(e,t){return!e.ids.includes(t)||e.activeId===t?e:{ids:e.ids,activeId:t}}function Xv(e,t){let n=e.ids.indexOf(t);if(n===-1)return e;let r=e.ids.filter(e=>e!==t);return e.activeId===t?{ids:r,activeId:r[n]??r[n-1]??null}:{ids:r,activeId:e.activeId}}function Lte(e,t,n){if(t===n||t<0||t>=e.ids.length)return e;let r=Math.max(0,Math.min(e.ids.length-1,n));if(r===t)return e;let i=[...e.ids],[a]=i.splice(t,1);return a===void 0?e:(i.splice(r,0,a),{ids:i,activeId:e.activeId})}function Rte(e,t){let n=t instanceof Set?t:new Set(t),r=e.ids.filter(e=>n.has(e));return r.length===e.ids.length?e:{ids:r,activeId:e.activeId&&r.includes(e.activeId)?e.activeId:r[r.length-1]??null}}function zte(e,t){if(e.ids.length===0)return e;let n=e.activeId?e.ids.indexOf(e.activeId):-1,r=n===-1?0:n,i=e.ids.length,a=((r+t)%i+i)%i,o=e.ids[a];return o?Yv(e,o):e}function Zv(e,t={},n={}){let r=[],i=[],a={},o={};for(let s of e.ids){let e=n[s];if(e){i.push(s),e.title&&(a[s]=e.title);continue}r.push(s);let c=t[s];c&&(o[s]=c)}return{openTabs:r,draftTabs:i,draftTitles:a,activeTab:e.activeId,remoteTabs:o}}function Bte(e){let t=e?.remoteTabs;if(!t)return{};let n={};for(let[e,r]of Object.entries(t))typeof r==`string`&&r.length>0&&(n[e]=r);return n}function Vte(e){let t=e?.draftTabs??[],n=e?.draftTitles??{},r=[];for(let e of t){if(typeof e!=`string`||e.length===0)continue;let t=n[e];r.push({id:e,title:typeof t==`string`&&t.length>0?t:null})}return r}function Hte(e){return Jv([...e.openTabs??[],...e.draftTabs??[]],e.activeTab??null)}function Qv(e,t){if(e.length!==t.length)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!0;return!1}function $v(e,t){for(let n of new Set([...Object.keys(e),...Object.keys(t)]))if(e[n]!==t[n])return!0;return!1}function Ute(e,t,n,r={}){let i=Zv(e,n??{},r);return!!(Qv(t.openTabs??[],i.openTabs)||Qv(t.draftTabs??[],i.draftTabs)||$v(t.draftTitles??{},i.draftTitles)||(t.activeTab??null)!==e.activeId||n&&$v(t.remoteTabs??{},i.remoteTabs))}var Wte=.25,ey=`g1`;function ty(e=qv){return{root:{type:`group`,id:ey},groups:{[ey]:e},focused:ey}}function ny(e){let t=[],n=e=>{if(e.type===`group`)t.push(e.id);else for(let t of e.children)n(t)};return n(e.root),t}function ry(e){let t=[];for(let n of ny(e))t.push(...e.groups[n]?.ids??[]);return t}function iy(e,t){for(let n of ny(e))if(e.groups[n]?.ids.includes(t))return n;return null}function ay(e){return e.groups[e.focused]??qv}function oy(e){return{ids:ry(e),activeId:ay(e).activeId}}function sy(e,t){if(e.activeId!==t.activeId||e.ids.length!==t.ids.length)return!1;for(let n=0;n<e.ids.length;n++)if(e.ids[n]!==t.ids[n])return!1;return!0}function cy(e){let t=[];for(let n of ny(e)){let r=e.groups[n]?.activeId;r&&t.push(r)}return t}function ly(e,t){let n=ny(e);return n.length<2?null:n[(n.indexOf(t)+1)%n.length]??null}function uy(e,t){let n=e.root;for(let e of t){if(n.type!==`split`)return null;let t=n.children[e];if(!t)return null;n=t}return n}function dy(e,t=e.length){let n=Array.from({length:t},(t,n)=>{let r=e[n];return typeof r==`number`&&Number.isFinite(r)&&r>0?r:0}),r=n.reduce((e,t)=>e+t,0);if(t===0)return[];if(r<=0)return n.map(()=>1/t);let i=r/n.filter(e=>e>0).length,a=n.map(e=>e>0?e:i),o=a.reduce((e,t)=>e+t,0);return a.map(e=>e/o)}function fy(e){if(e.type===`group`)return e;let t=[],n=[],r=dy(e.sizes,e.children.length);return e.children.forEach((i,a)=>{let o=fy(i);if(!o)return;let s=r[a]??0;o.type===`split`&&o.direction===e.direction?o.children.forEach((e,r)=>{t.push(e),n.push(s*(o.sizes[r]??0))}):(t.push(o),n.push(s))}),t.length===0?null:t.length===1?t[0]:{type:`split`,direction:e.direction,children:t,sizes:dy(n)}}function py(e,t){if(e.type===`group`)return e.id===t?null:e;let n=[],r=[];return e.children.forEach((i,a)=>{let o=py(i,t);o&&(n.push(o),r.push(e.sizes[a]??0))}),n.length===0?null:fy({type:`split`,direction:e.direction,children:n,sizes:r})}function my(e){let t=0;for(let n of Object.keys(e.groups)){let e=/^g(\d+)$/.exec(n);e&&(t=Math.max(t,Number(e[1])))}return`g${t+1}`}function hy(e,t){let n=ny(e);if(n.length<=1||!n.includes(t))return e;let r=n.indexOf(t),i=n.filter(e=>e!==t),a=py(e.root,t)??{type:`group`,id:i[0]},{[t]:o,...s}=e.groups;return{root:a,groups:s,focused:e.focused===t?n[r-1]??n[r+1]??i[0]:e.focused}}function gy(e,t,n){return e.groups[t]===n?e:{...e,groups:{...e.groups,[t]:n}}}function _y(e,t){let n=e.groups[t];return n&&n.ids.length===0?hy(e,t):e}function vy(e,t,n,r){let i=r===`left`||r===`right`?`row`:`column`,a=r===`left`||r===`top`;if(e.type===`group`)return e.id===t?{type:`split`,direction:i,children:a?[n,e]:[e,n],sizes:[.5,.5]}:e;let o=e.children.findIndex(e=>e.type===`group`&&e.id===t);if(o>=0&&e.direction===i){let t=e.sizes[o]??1/e.children.length,r=[...e.children],i=[...e.sizes],s=a?o:o+1;return i[o]=t/2,r.splice(s,0,n),i.splice(s,0,t/2),{...e,children:r,sizes:i}}return{...e,children:e.children.map(e=>vy(e,t,n,r))}}function yy(e,t,n){let r=e;for(let e=0;e<40&&ry(r).length>20;e++){let e=new Set(ny(r).map(e=>r.groups[e]?.activeId??null).filter(Boolean)),i=r=>r.find(r=>r!==t&&r!==n&&!e.has(r)),a=i(r.groups[r.focused]?.ids??[]);if(!a){for(let e of ny(r))if(a=i(r.groups[e]?.ids??[]),a)break}if(!a)break;r=wy(r,a)}return r}function by(e,t){return e.focused===t||!e.groups[t]?e:{...e,focused:t}}function xy(e,t){let n=ny(e)[t];return n?by(e,n):e}function Sy(e,t){let n=iy(e,t);if(!n)return e;let r=e.groups[n];return r.activeId===t&&e.focused===n?e:{...gy(e,n,Yv(r,t)),focused:n}}function Cy(e,t,n=e.focused){if(!t)return e;if(iy(e,t))return Sy(e,t);let r=e.groups[n]?n:e.focused,i=e.groups[r]??qv;return yy({...gy(e,r,{ids:[...i.ids,t],activeId:t}),focused:r},t,i.activeId)}function wy(e,t){let n=iy(e,t);return n?_y(gy(e,n,Xv(e.groups[n],t)),n):e}function Ty(e,t,n,r){let i=e.groups[t];return i?gy(e,t,Lte(i,n,r)):e}function Ey(e,t){let n=e.groups[e.focused];return n?gy(e,e.focused,zte(n,t)):e}function Dy(e,t,n,r){let i=e.groups[n];if(!i)return e;let a=iy(e,t);if(a===n){let a=i.ids.indexOf(t);return Sy(by(r===void 0?e:Ty(e,n,a,r>a?r-1:r),n),t)}let o=[...i.ids],s=r===void 0?o.length:Math.max(0,Math.min(o.length,r));o.splice(s,0,t);let c={...e,focused:n};return c=gy(c,n,{ids:o,activeId:t}),a&&(c=_y(gy(c,a,Xv(c.groups[a],t)),a)),a?c:yy(c,t,i.activeId)}function Oy(e,t,n,r){if(!e.groups[n])return e;let i=iy(e,t);if(i===n&&e.groups[n].ids.length===1||ny(e).length>=8)return e;let a=e;i&&(a=_y(gy(a,i,Xv(a.groups[i],t)),i));let o=my(a),s={root:fy(vy(a.root,n,{type:`group`,id:o},r))??a.root,groups:{...a.groups,[o]:{ids:[t],activeId:t}},focused:o};return i?s:yy(s,t,null)}function ky(e,t,n){return e.groups[n.groupId]?n.zone===`center`?Dy(e,t,n.groupId,n.index):Oy(e,t,n.groupId,n.zone):e}function Ay(e,t,n){return n.zone===`center`&&n.index===void 0?iy(e,t)!==n.groupId:ky(e,t,n)!==e}function jy(e,t,n){let r=uy(e,t);if(!r||r.type!==`split`)return e;let i=dy(n,r.children.length);return i.every((e,t)=>Math.abs(e-(r.sizes[t]??0))<1e-6)?e:{...e,root:Ny(e.root,t,{...r,sizes:i})}}function My(e,t){let n=uy(e,t);return!n||n.type!==`split`?e:jy(e,t,n.children.map(()=>1))}function Ny(e,t,n){if(t.length===0)return n;if(e.type!==`split`)return e;let[r,...i]=t;return{...e,children:e.children.map((e,t)=>t===r?Ny(e,i,n):e)}}function Py(e,t,n=null){let r=new Set(t),i=new Set,a=e;for(let t of ny(e)){let e=a.groups[t],n=e.ids.filter(e=>!r.has(e)||i.has(e)?!1:(i.add(e),!0));if(n.length===e.ids.length)continue;let o=e.activeId&&n.includes(e.activeId)?e.activeId:n.at(-1)??null;a=gy(a,t,{ids:n,activeId:o})}for(let e of ny(a))a=_y(a,e);let o=t.filter(e=>!i.has(e));if(o.length>0){let e=a.groups[a.focused]??qv,t=[...e.ids,...o.filter((e,t)=>o.indexOf(e)===t)];a=gy(a,a.focused,{ids:t,activeId:e.activeId??t.at(-1)??null})}return n&&r.has(n)&&(a=Sy(a,n)),a}function Fy(e){if(e.type===`group`)return{width:380,height:240};let t=e.children.map(Fy);return e.direction===`row`?{width:t.reduce((e,t)=>e+t.width,0),height:Math.max(0,...t.map(e=>e.height))}:{width:Math.max(0,...t.map(e=>e.width)),height:t.reduce((e,t)=>e+t.height,0)}}function Iy(e,t,n){if(e.root.type===`group`)return!1;let r=Fy(e.root);return t<r.width||n<r.height}function Ly(e,t,n,r=Wte){if(e.width<=0||e.height<=0)return`center`;let i=(t-e.left)/e.width,a=(n-e.top)/e.height,o=[[`left`,i],[`right`,1-i],[`top`,a],[`bottom`,1-a]],s=o[0];for(let e of o)e[1]<s[1]&&(s=e);return s[1]<r?s[0]:`center`}function Ry(e,t){for(let n=0;n<e.length;n++){let r=e[n];if(t<r.left+r.width/2)return n}return e.length}function zy(e){switch(e){case`left`:return{left:0,top:0,width:.5,height:1};case`right`:return{left:.5,top:0,width:.5,height:1};case`top`:return{left:0,top:0,width:1,height:.5};case`bottom`:return{left:0,top:.5,width:1,height:.5};default:return{left:0,top:0,width:1,height:1}}}function By(e){if(e.root.type===`group`)return null;let t=n=>{if(n.type===`group`){let t=e.groups[n.id]??qv;return{group:{tabs:[...t.ids],active:t.activeId}}}return{split:n.direction,sizes:n.sizes.map(e=>Math.round(e*1e4)/1e4),children:n.children.map(t)}};return{root:t(e.root),focused:Math.max(0,ny(e).indexOf(e.focused))}}function Vy(e,t){if(!e||!t)return!e&&!t;if(e.focused!==t.focused)return!1;let n=(e,t)=>{if(`group`in e||`group`in t){if(!(`group`in e)||!(`group`in t))return!1;let n=e.group,r=t.group;return n.active===r.active&&n.tabs.length===r.tabs.length&&n.tabs.every((e,t)=>e===r.tabs[t])}return e.split===t.split&&e.children.length===t.children.length&&e.children.every((e,r)=>n(e,t.children[r]))&&e.sizes.every((e,n)=>Math.abs(e-(t.sizes[n]??NaN))<.001)};return n(e.root,t.root)}function Hy(e,t,n=null){let r=ty();if(e&&typeof e==`object`&&e.root){let t={},n=0,i=(e,r)=>{if(r>8||!e||typeof e!=`object`)return null;if(`group`in e&&e.group&&Array.isArray(e.group.tabs)){if(n>=8)return null;n+=1;let r=`g${n}`,i=e.group.tabs.filter(e=>typeof e==`string`),a=typeof e.group.active==`string`&&i.includes(e.group.active)?e.group.active:i.at(-1)??null;return t[r]={ids:i,activeId:a},{type:`group`,id:r}}if(`split`in e&&(e.split===`row`||e.split===`column`)){let t=Array.isArray(e.children)?e.children:[],n=[],a=[];return t.forEach((t,o)=>{let s=i(t,r+1);s&&(n.push(s),a.push(Array.isArray(e.sizes)?e.sizes[o]??0:0))}),n.length===0?null:fy({type:`split`,direction:e.split,children:n,sizes:a})}return null},a=i(e.root,0);if(a&&Object.keys(t).length>0){let n=[],i=e=>{e.type===`group`?n.push(e.id):e.children.forEach(i)};i(a),r={root:a,groups:t,focused:n[typeof e.focused==`number`&&Number.isInteger(e.focused)?e.focused:0]??n[0]}}}return Py(r,t,n)}var Uy={seq:0,sessionIds:null};function Wy(e,t){return e.sessionIds===null||e.sessionIds.includes(t)}var Gy=`oonacode.nextPromptWindow.v1`,Ky=`oonacode.projectManagerFilter.v1`,qy={range:`24h`,from:``,to:``};function Jy(){try{let e=window.localStorage.getItem(Gy);return e===null?Mp.windowHours:Pp(Number(e))}catch{return Mp.windowHours}}function Yy(e){try{window.localStorage.setItem(Gy,String(Pp(e)))}catch{}}function Xy(){try{let e=window.localStorage.getItem(Ky);return e?Vv(JSON.parse(e)):{...qy}}catch{return{...qy}}}function Zy(e){try{window.localStorage.setItem(Ky,JSON.stringify(e))}catch{}}function Qy(e){let t=e.running?`Reviewing ${e.done} of ${e.total}`:e.stopped?`Stopped at ${e.done} of ${e.total}`:`Reviewed ${e.done} of ${e.total}`,n=[`${e.ok} ready`,`${e.failed} failed`];return e.skipped>0&&n.push(`${e.skipped} unchanged`),`${t} — ${n.join(`, `)}`}function $y(e){return e.isError?Fp.finishedUnseenError:Fp.finishedUnseen}function eb(e){let t=new Date(e);return Number.isFinite(t.getTime())?`${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}`:``}function tb(e,t,n){let r=[];for(let i of cy(e))t[i]?.active||(n===null||e.groups[n]?.activeId!==i)&&r.push(i);return r}function nb(e,t){return!e?.finishedUnseen||t===`running`||t===`waiting_permission`?null:e.finishedUnseen}function rb(){return typeof document>`u`||document.visibilityState!==`visible`?!1:typeof document.hasFocus==`function`&&document.hasFocus()}function ib(e){return!e||e.text.length===0&&e.attachments.length===0&&(e.replies?.length??0)===0}function ab(e,t){if(!e||e.text!==t.text||e.attachments.length!==t.attachments.length)return!1;let n=e.replies??[],r=t.replies??[];return n.length!==r.length||!n.every((e,t)=>e===r[t])?!1:e.attachments.every((e,n)=>e===t.attachments[n])}function ob(e,t,n){if(ib(n)){if(e[t]===void 0)return e;let{[t]:n,...r}=e;return r}return ab(e[t],n)?e:{...e,[t]:n}}function sb(e,t){let n=Object.keys(e);if(n.length===0)return e;let r=new Set(t);if(n.every(e=>r.has(e)))return e;let i={};for(let t of n)r.has(t)&&(i[t]=e[t]);return i}var cb=new Map;function lb(e,t){return cb.set(e,t),()=>{cb.get(e)===t&&cb.delete(e)}}function ub(e){return cb.get(e)?.()??null}var db=1e5,fb=50;function pb(e,t,n=null){let r=e.drafts[t],i=e.remoteTabs[t],a={id:t,kind:i?`remote`:r?`draft`:`session`};i&&(a.hostId=i.hostId,a.hostName=i.hostName),r&&(a.draft={title:r.title,providerId:r.providerId,model:r.model,variantId:r.variantId,permissionMode:r.permissionMode,...r.posture?{posture:r.posture}:{},projectDir:r.projectDir,projectId:r.projectId});let o=(n??e.unsent[t])?.text??``;o.length>0&&(a.unsentText=o.slice(0,db));let s=e.files[t];if(s&&s.open.length>0){let e=s.open.slice(0,fb);a.files={open:e,active:s.active&&e.includes(s.active)?s.active:null}}return a}function mb(e){let{unsentText:t,files:n,...r}=e;return r}var hb=[`default`,`acceptEdits`,`plan`,`auto`,`dontAsk`,`bypassPermissions`];function gb(e,t=Date.now()){let n=e.draft??{},r=e=>typeof e==`string`&&e.length>0?e:null,i=r(n.permissionMode);return{...sv(e.id,t),title:r(n.title),providerId:r(n.providerId),model:r(n.model),variantId:r(n.variantId),permissionMode:i&&hb.includes(i)?i:null,...N(n.posture)?{posture:n.posture}:{},projectDir:r(n.projectDir),projectId:r(n.projectId)}}var _b=`application/x-oonacode-tab`,vb=null;function yb(e,t){if(vb={...t},e){e.effectAllowed=`move`;try{e.setData(_b,t.tabId)}catch{}}}function bb(){return vb}function xb(){let e=vb;return vb=null,e}function Sb(e){if(vb)return!0;let t=e?.types;if(!t)return!1;for(let e=0;e<t.length;e++)if(t[e]===`application/x-oonacode-tab`)return!0;return!1}function Cb(e,t){return e.clientX<0||e.clientY<0||e.clientX>t.innerWidth||e.clientY>t.innerHeight}function wb(e,t,n){let r=e.getAttribute(`data-editor-group`);if(!r)return null;let i=e.querySelector(`[data-tab-strip]`),a=i?.getBoundingClientRect();if(i&&a&&a.height>0&&n>=a.top&&n<=a.bottom)return{groupId:r,zone:`center`,index:Ry(Array.from(i.querySelectorAll(`[data-tab-group="${Eb(r)}"]`)).filter(e=>e.hasAttribute(`data-tab-id`)).map(e=>e.getBoundingClientRect()),t)};let o=e.querySelector(`[data-group-body]`)??e;return e.getAttribute(`data-compact`)===`true`?{groupId:r,zone:`center`}:{groupId:r,zone:Ly(o.getBoundingClientRect(),t,n)}}function Tb(e,t,n){let r=(typeof e.elementFromPoint==`function`?e.elementFromPoint(t,n):null)?.closest(`[data-editor-group]`)??null;return r?wb(r,t,n):null}function Eb(e){return typeof CSS<`u`&&typeof CSS.escape==`function`?CSS.escape(e):e.replace(/["\\]/g,`\\$&`)}function Db(e,t){if(e.includes(t))return e.filter(e=>e!==t);let n=e=>wl.indexOf(e),r=e.findIndex(e=>n(e)>n(t)),i=[...e];return i.splice(r===-1?i.length:r,0,t),i}function Ob(e,t){return e.includes(t)?e.filter(e=>e!==t):[...e,t]}function kb(e,t){return e.filter(e=>!t||t(e))}function Ab(e,t){let n={};for(let r of e)n[r]=+!t.includes(r);return n}function jb(e,t){return{rightPanelSections:[...e],rightPanelCollapsed:t.filter(t=>e.includes(t)),sessionPanelOpen:e.includes(`sessionInfo`)}}function Mb(e,t,n){return{sections:e.includes(n)?[...e]:Db(e,n),collapsed:t.filter(e=>e!==n)}}function Nb(e,t=!0){return{leftPanelSection:e,leftPanelOpen:t,explorerOpen:t&&e===`files`}}function Pb(){return typeof window<`u`&&typeof window.matchMedia==`function`&&!window.matchMedia(`(min-width: 768px)`).matches}function Fb(e){Pb()&&e(!1)}function Ib(e,t,n){return t!==e.section||!n?{section:t,open:!0}:{section:t,open:!e.open}}function Lb(e){return e.trim().toLowerCase()}function Rb(e,t,n){let r=Lb(t);return r===``||av(e).toLowerCase().includes(r)?!0:!!n&&n.toLowerCase().includes(r)}function zb(e,t){let n=Lb(t),r=new Set,i=new Set,a=(e,t)=>e?`${e}/${t}`:t,o=t=>{for(let n of e[t]?.entries??[]){let e=a(t,n.name);r.add(e),n.type===`dir`&&o(e)}},s=t=>{let c=!1;for(let l of e[t]?.entries??[]){let e=a(t,l.name);l.name.toLowerCase().includes(n)?(r.add(e),l.type===`dir`&&o(e),c=!0):l.type===`dir`&&s(e)&&(r.add(e),i.add(e),c=!0)}return c};return n!==``&&s(``),{visible:r,open:i}}function Bb(e=500){let t=Vb(e);return{size:t,rendered:t}}function Vb(e){return Number.isFinite(e)?Math.max(1,Math.round(e)):500}function Hb(e,t){let n=Vb(t);return e.size===n&&e.rendered===n?e:{size:n,rendered:n}}function Ub(e,t,n=100){let r=Math.max(0,Math.floor(t)),i=Math.max(1,Math.floor(n));if(e.rendered>=r)return e;let a=Math.min(r,e.rendered+i);return a===e.rendered?e:{size:e.size,rendered:a}}function Wb(e,t,n,r=!1){let i=Math.min(Math.max(0,Math.floor(n)),Math.max(0,Math.floor(t)));return i<=e.rendered?r&&!e.held?{...e,held:!0}:e:{size:e.size,rendered:i,...r||e.held?{held:!0}:{}}}function Gb(e,t=!1){return e.held&&!t||e.rendered===e.size&&!e.held?e:{size:e.size,rendered:e.size}}function Kb(e,t){let n=e.length,r=Math.min(n,Math.max(t.size,t.rendered)),i=Math.max(0,n-r);return{start:i,items:i===0?e.slice():e.slice(i),hiddenAbove:i,hasMore:i>0,total:n}}function qb(e,t=48){return e.scrollHeight-e.scrollTop-e.clientHeight<=t}function Jb(e,t=24){return e.scrollTop<=t}var Yb=2e3;function Xb(e,t=Yb,n=Date.now){let r=-1/0,i=null,a=()=>{i=null,r=n(),e()};return{request(){if(i!==null)return;let e=r+t-n();e<=0?a():i=setTimeout(a,e)},dispose(){i!==null&&(clearTimeout(i),i=null)}}}var Zb=3e3;function Qb(e){let{balance:t}=e.credits;if(typeof e.credits.plan!=`number`&&typeof e.credits.topup!=`number`)return{balance:t,plan:null,topup:null,hasSplit:!1};let n=e.credits.plan??Math.max(0,t-(e.credits.topup??0));return{balance:t,plan:n,topup:e.credits.topup??Math.max(0,t-n),hasSplit:!0}}function $b(e){return e.credits.monthlyGrant>0?e.credits.monthlyGrant:Zb}function ex(e){if(!e)return`ok`;let{balance:t}=e.credits;return t<=0?`empty`:t<=$b(e)*.1?`low`:`ok`}function tx(e){if(!e)return null;let t=ex(e);if(t===`ok`)return null;let n=nx(e.credits.balance);return t===`empty`?{level:t,text:`No credits left — a priced model will be refused. Free models still run, on every plan.`}:{level:t,text:`Running low: ${n} credits left. Free models still run, on every plan.`}}function nx(e){return e.toLocaleString(`en-US`,{maximumFractionDigits:0})}function rx(e,t){return!t||t.providerId!==`oonacode`?!1:(t.poolCredits??0)!==(e?.providerId===`oonacode`?e.poolCredits??0:0)}var ix=new Set([`Alt`,`AltGraph`,`Control`,`Shift`,`Meta`,`OS`,`CapsLock`]),ax=new Set([`Tab`,`Escape`,`ContextMenu`,`Help`]),ox=1500,sx=24,cx=-1/0,lx=()=>Date.now();function ux(){cx=lx()}function dx(e){if(!e)return`none`;if(typeof document<`u`&&e===document.body)return`BODY`;let t=e.tagName??`?`,n=e.getAttribute?.(`data-testid`)??e.getAttribute?.(`aria-label`)??e.getAttribute?.(`role`),r=typeof e.className==`string`?e.className.split(/\s+/).filter(Boolean).slice(0,3):[];return`${t}${n?`[${n.slice(0,60)}]`:``}${r.length>0?`.${r.join(`.`)}`:``}`}function fx(e){return ix.has(e.key)?`modifier`:!(typeof e.getModifierState==`function`&&e.getModifierState(`AltGraph`))&&(e.ctrlKey||e.metaKey||e.altKey)||ax.has(e.key)||/^F\d{1,2}$/.test(e.key)?`shortcut`:e.key.length===1?`text`:e.key.slice(0,20)}function px(e,t){let n=t.now??(()=>Date.now());lx=n;let r=-1/0,i=`none`,a=-1/0,o=-1/0,s=!1,c=[],l=e=>{let t=fx(e);if(t!==`modifier`){if(t===`shortcut`){a=n();return}r=n(),i=t}},u=()=>{o=n(),s=!0},d=()=>{o=n(),s=!1},f=e=>e-r<=2e3&&!s&&e-o>1e3&&e-a>1e3&&(e-cx>1e3||e<cx),p=()=>{let e=n();return c.filter(t=>e-t.t<=ox).map(e=>e.what)},m=a=>{let o=n();if(!f(o))return;let s=a.relatedTarget instanceof Element?a.relatedTarget:null,c=p();setTimeout(()=>{if(typeof document<`u`&&!document.hasFocus()||typeof document<`u`&&document.activeElement===e)return;let n=typeof document<`u`?document.activeElement:null;n&&n!==e&&n.closest?.(`[data-testid="composer"]`)||t.report({activeAfter:dx(n),relatedTarget:dx(s),boxConnected:e.isConnected,boxDisabled:e.disabled,recentlyAdded:c,sinceKeyMs:Math.round(o-r),lastKey:i,unmounted:!e.isConnected})},0)},h=null,g=t.root??(typeof document<`u`?document.body:null);return g&&typeof MutationObserver<`u`&&(h=new MutationObserver(e=>{let t=n();for(let n of e)for(let e of Array.from(n.addedNodes))e.nodeType===1&&(c.push({t,what:dx(e)}),c.length>sx&&c.shift())}),h.observe(g,{childList:!0,subtree:!0})),e.addEventListener(`keydown`,l),e.addEventListener(`blur`,m),typeof document<`u`&&(document.addEventListener(`pointerdown`,u,!0),document.addEventListener(`pointerup`,d,!0),document.addEventListener(`pointercancel`,d,!0)),()=>{let a=n();typeof document<`u`&&document.activeElement===e&&f(a)&&t.report({activeAfter:`unmounting`,relatedTarget:`none`,boxConnected:e.isConnected,boxDisabled:e.disabled,recentlyAdded:p(),sinceKeyMs:Math.round(a-r),lastKey:i,unmounted:!0}),h?.disconnect(),e.removeEventListener(`keydown`,l),e.removeEventListener(`blur`,m),typeof document<`u`&&(document.removeEventListener(`pointerdown`,u,!0),document.removeEventListener(`pointerup`,d,!0),document.removeEventListener(`pointercancel`,d,!0))}}var mx=[`desktop`,`host`,`cli`,`engine`],hx={desktop:`Desktop app`,host:`Host service`,cli:`oona CLI`,engine:`Agent engine`},gx={available:!1,components:[],version:``,channel:``,publishedAt:``,notes:``},_x=/(\d+(?:\.\d+)*(?:[-+][0-9A-Za-z.-]+)?)\s*$/;function vx(e){return typeof e.version==`string`&&e.version.trim()?e.version.trim():_x.exec(e.name??``)?.[1]??null}function yx(e){let[t=``,n=``]=(e.trim().replace(/^v/i,``).split(`+`)[0]??``).split(`-`,2);return{nums:t.split(`.`).map(e=>{let t=Number.parseInt(e,10);return Number.isFinite(t)?t:0}).filter((e,t)=>t<4),pre:n?n.split(`.`):[]}}function bx(e,t){let n=yx(e),r=yx(t),i=Math.max(n.nums.length,r.nums.length);for(let e=0;e<i;e++){let t=n.nums[e]??0,i=r.nums[e]??0;if(t!==i)return t<i?-1:1}if(n.pre.length===0&&r.pre.length===0)return 0;if(n.pre.length===0)return 1;if(r.pre.length===0)return-1;let a=Math.max(n.pre.length,r.pre.length);for(let e=0;e<a;e++){let t=n.pre[e],i=r.pre[e];if(t===i)continue;if(t===void 0)return-1;if(i===void 0)return 1;let a=Number.parseInt(t,10),o=Number.parseInt(i,10);return Number.isFinite(a)&&Number.isFinite(o)&&/^\d+$/.test(t)&&/^\d+$/.test(i)?a<o?-1:1:t<i?-1:1}return 0}function xx(e,t){return!e||!t?!1:bx(e,t)===1}function Sx(e){if(typeof e!=`object`||!e)return null;let t=e,n=typeof t.version==`string`?t.version:``;if(!n)return null;let r=Array.isArray(t.assets)?t.assets.filter(e=>typeof e==`object`&&!!e):[];return{version:n,channel:typeof t.channel==`string`?t.channel:`stable`,publishedAt:typeof t.publishedAt==`string`?t.publishedAt:``,notes:typeof t.notes==`string`?t.notes:``,assets:r}}function Cx(e,t,n){if(!e||!e.version)return gx;let r=(e.assets??[]).filter(e=>typeof e?.kind==`string`&&e.kind),i=new Map;for(let e of r)n&&e.platform&&e.platform!==n||i.has(e.kind)||i.set(e.kind,e);let a=e=>!!n&&!i.has(e)&&r.some(t=>t.kind===e),o=[];for(let n of mx){let r=t[n];if(typeof r!=`string`||!r.trim())continue;let s=i.get(n);if(!s&&a(n))continue;let c=(s?vx(s):null)??(n===`desktop`?e.version:null);!c||!xx(c,r)||o.push({component:n,label:hx[n],current:r.trim(),latest:c,url:s?.url?s.url:null,notes:typeof s?.notes==`string`?s.notes:``})}return{available:o.length>0,components:o,version:e.version,channel:e.channel,publishedAt:e.publishedAt,notes:e.notes}}function wx(e,t=null,n=null){return!e||!e.trim()?null:`${e.trim().replace(/\/+$/,``)}${Wc(t,n)}`}function Tx(e){return e.bridge?.appChannel??e.info?.cliChannel??`stable`}function Ex(e,t){return Gc(e,t)}var Dx={phase:`idle`,version:``,percent:0,transferred:0,total:0,bytesPerSecond:0,error:``,notice:``};function Ox(e){return e===`ready`||e===`installing`}function kx(e,t){let n=t.version||e.version;switch(t.phase){case`checking`:return Ox(e.phase)?e:{...Dx,phase:`checking`,version:n};case`available`:return Ox(e.phase)?e:{...Dx,phase:`available`,version:n};case`not-available`:return Ox(e.phase)?e:{...Dx,version:n};case`downloading`:return{...Dx,phase:`downloading`,version:n,percent:Math.max(0,Math.min(100,t.percent)),transferred:t.transferred,total:t.total,bytesPerSecond:t.bytesPerSecond};case`downloaded`:return{...Dx,phase:`ready`,version:n,percent:100};case`installing`:return{...Dx,phase:`installing`,version:n,percent:100,notice:t.message||(e.phase===`installing`?e.notice:``)};case`error`:return{...Dx,phase:`error`,version:n,error:t.message}}}function Ax(e){switch(e.install.phase){case`ready`:case`installing`:return`ready`;case`downloading`:return`downloading`;case`available`:return`available`;default:return e.manifestAvailable?`available`:`idle`}}var jx=[`B`,`KB`,`MB`,`GB`];function Mx(e){if(!Number.isFinite(e)||e<=0)return`0 B`;let t=e,n=0;for(;t>=1024&&n<jx.length-1;)t/=1024,n+=1;return`${t>=10||n===0?Math.round(t):t.toFixed(1)} ${jx[n]}`}function Nx(e){return!Number.isFinite(e)||e<=0?``:`${Mx(e)}/s`}var Px=[`host`,`cli`,`engine`];function Fx(e){let t=e?.platform===`darwin`;return{desktop:typeof e?.installUpdate==`function`&&!t,terminal:typeof e?.updateTerminalInstall==`function`,...t?{desktopViaTerminal:!0}:{}}}function Ix(e,t,n={}){let r=e.length>0,i=t.desktopViaTerminal===!0,a=!i&&(n.shellEngaged===!0||e.includes(`desktop`)||!r&&!n.checked),o=r&&e.some(e=>Px.includes(e)||i&&e===`desktop`),s=a&&t.desktop,c=o&&t.terminal,l=e.filter(e=>e===`desktop`&&!i?a&&!s:o&&!c),u=!a&&!o;return{terminal:c,desktop:s,manual:l,upToDate:u,label:u?`Up to date`:c&&s?`Update everything`:s?`Update and relaunch`:c?`Update now`:`How to update`}}function Lx(e,t){return e===`desktop`?t.desktopViaTerminal?t.terminal?`Replaced by the oona installer — OonaCode closes and reopens`:"Run `oona update` in a terminal":t.desktop?`Downloads here, then OonaCode restarts`:`Run the installer from the website`:t.terminal?`Installed by the oona installer — updated from here`:"Run `oona update` in a terminal"}var Rx={running:!1,message:``,failed:!1};function zx(e,t){switch(e){case`agentFinished`:return t.notifications.agentFinished;case`permissionRequired`:return t.notifications.permissionRequired;case`errorOccurred`:return t.notifications.errorOccurred;default:return!1}}function Bx(e,t){let n=t.sessionTitle||`OonaCode`,r=e=>t.sessionId?{...e,sessionId:t.sessionId}:e;switch(e){case`permissionRequired`:return t.toolName===`AskUserQuestion`?r({title:`Question for you`,body:`${n} — the agent is asking you a question.`,focusOnClick:!0}):r({title:`Permission required`,body:`${n} — the agent wants to run ${t.toolName??`a tool`}.`,focusOnClick:!0});case`errorOccurred`:return r({title:`OonaCode error`,body:`${n} — ${t.detail??`the agent reported an error`}.`,focusOnClick:!0});default:return r({title:t.isError?`Agent needs attention`:`Agent finished`,body:t.isError?`${n} — the turn ended with an error.`:`${n} — turn complete.`,focusOnClick:!0,silent:!t.isError})}}async function Vx(e,t={}){if(t.documentHasFocus?.()===!0)return!1;if(t.bridgeNotify)try{return await t.bridgeNotify(e)}catch{return!1}let n=t.browser;if(!n)return!1;try{if(n.permission===`granted`||n.permission==="default"&&n.requestPermission&&await n.requestPermission()===`granted`)return n.create(e.title,{body:e.body,silent:e.silent===!0}),!0}catch{}return!1}function Hx(){if(typeof window>`u`)return{};let e=window.oonacode,t=globalThis.Notification;return{bridgeNotify:e?.notify?t=>e.notify(t):void 0,browser:t?{permission:t.permission,create:(e,n)=>{new t(e,n)},requestPermission:()=>t.requestPermission()}:void 0,documentHasFocus:()=>typeof document<`u`&&typeof document.hasFocus==`function`&&document.hasFocus()}}var Ux=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),W=o(((e,t)=>{t.exports=Ux()}))(),Wx=2e3,Gx=2500;function Kx(){return{connection:{status:`idle`,detail:null,hostName:null,hostId:null,appVersion:null},info:null,bundleAppVersion:null,hostUpdatedTo:null,sessions:[],sessionLinks:{},sessionsTotal:0,sessionsLoading:!1,sessionsError:null,sessionListLoaded:!1,search:``,projects:[],vaultProjects:[],scheduledTasksVersion:0,conversationsChange:Hp,conversationsSelectId:null,chatConversations:{},chatAboutsChange:Jd,nextPromptsChange:Uy,assignProjectSessionId:null,voiceSummarySessionId:null,projectsStartNew:!1,importOffered:!1,projectsSelectId:null,page:null,pinnedRows:{},currentSessionId:null,tabs:Jv(),layout:ty(),pageGroup:null,windowRole:`main`,elsewhere:{},drafts:{},pendingRouting:{},transcripts:{},transcriptLoading:{},files:{},dirtyFiles:{},unsent:{},composerQuote:null,jumpTo:null,chatSearchRequest:null,windows:{},modelBoundaries:{},providers:[],activeProviderId:null,agentTools:null,settings:null,prefs:{...Fl},prefsBackend:`unknown`,account:null,plan:null,accountLoaded:!1,accountLink:null,emailVerification:null,recoveryKey:null,credentials:[],claudeSubscription:null,claudeLogin:null,oauthLogin:null,engineDownload:null,importProgress:null,toolInstalls:{},mcpServers:null,mcpTesting:{},mcpTestResults:{},doctor:null,remote:{hosts:[],supported:!0,loading:!1,loaded:!1,sessions:{},unreachable:{},sessionOwners:{},tabs:{},reason:null,stale:!1},update:gx,updateChecking:!1,updateInstall:Dx,terminalUpdate:Rx,updateDismissed:null,toasts:[],ui:{sidebarOpen:!0,dialog:`none`,connectProviderId:null,claudeLoginMode:null,oauthLoginProviderId:null,settingsSection:null,sidebarPinnedOverride:null}}}function qx(e,t){if(t===e.layout&&e.tabs.activeId===e.currentSessionId)return e;let n=oy(t),r=sy(n,e.tabs)?e.tabs:n,i=e.drafts;for(let t of e.tabs.ids)r.ids.includes(t)||e.drafts[t]===void 0||(i===e.drafts&&(i={...i}),delete i[t]);return{...e,layout:t,tabs:r,drafts:i,unsent:sb(e.unsent,r.ids),currentSessionId:r.activeId}}function Jx(e,t){return e.windows[t]??Bb(e.prefs.transcriptWindowSize)}function Yx(e,t){let n=Object.entries(e);if(n.length===0)return e;let r=!1,i={};for(let[e,a]of n){let n=Hb(a,t);n!==a&&(r=!0),i[e]=n}return r?i:e}function Xx(e,t){return{...e,prefs:t,windows:Yx(e.windows,t.transcriptWindowSize)}}function Zx(e,t){switch(t.type){case`connection`:return{...e,connection:{...e.connection,status:t.status,detail:t.detail??null}};case`welcome`:return{...e,connection:{...e.connection,hostName:t.hostName,hostId:t.hostId,appVersion:t.appVersion}};case`info`:{let n=t.info.account??null,r=e.bundleAppVersion??t.info.appVersion;return{...e,info:t.info,bundleAppVersion:r,hostUpdatedTo:t.info.appVersion===r?null:t.info.appVersion,activeProviderId:t.info.activeProviderId,account:n??e.account,accountLoaded:e.accountLoaded||n!==null,accountLink:n?.link??e.accountLink,connection:{...e.connection,hostName:t.info.hostName,hostId:t.info.hostId,appVersion:t.info.appVersion}}}case`sessions`:return{...e,sessions:t.sessions,sessionsTotal:t.total,sessionsLoading:!1,sessionsError:null,sessionListLoaded:!0,...t.links?{sessionLinks:Object.fromEntries(t.links.map(e=>[e.sessionId,e]))}:{}};case`session_link`:{let n={...e.sessionLinks};return t.link?n[t.sessionId]=t.link:delete n[t.sessionId],{...e,sessionLinks:n}}case`sessions_loading`:return{...e,sessionsLoading:t.loading};case`sessions_error`:return{...e,sessionsError:t.error,sessionsLoading:!1};case`search`:return{...e,search:t.value};case`session_upsert`:{let n=e.sessions.findIndex(e=>e.id===t.session.id),r=n>=0?e.sessions.map(e=>e.id===t.session.id?t.session:e):[t.session,...e.sessions],i=e.transcripts[t.session.id],a=n>=0?e.sessions[n]:void 0,o=a!==void 0&&a.cwd!==t.session.cwd,s=i&&o?bg(i,{type:`local_system`,subtype:`workspace`,text:`Workspace changed to ${t.session.cwd} — the engine restarts there on your next message; the conversation continues.`}):i,c=s?{...e.transcripts,[t.session.id]:bg(s,{type:`session`,session:t.session})}:e.transcripts,l=e.remote.sessionOwners[t.session.id]??e.remote.tabs[t.session.id]?.hostId??null,u=l?e.remote.sessions[l]:void 0,d=l?{...e.remote.sessions,[l]:u?u.some(e=>e.id===t.session.id)?u.map(e=>e.id===t.session.id?t.session:e):[t.session,...u]:[t.session]}:e.remote.sessions;return{...e,sessions:r,sessionsTotal:n>=0?e.sessionsTotal:e.sessionsTotal+1,transcripts:c,...d===e.remote.sessions?{}:{remote:{...e.remote,sessions:d}},...e.pinnedRows[t.session.id]?{pinnedRows:{...e.pinnedRows,[t.session.id]:t.session}}:{}}}case`files_dirty`:return{...e,dirtyFiles:{...e.dirtyFiles,[t.sessionId]:t.paths}};case`file_open`:{let n=e.files[t.sessionId]??{open:[],active:null},r=n.open.includes(t.path)?n.open:[...n.open,t.path];return{...e,page:null,files:{...e.files,[t.sessionId]:{open:r,active:t.path}}}}case`file_close`:{let n=e.files[t.sessionId];if(!n||!n.open.includes(t.path))return e;let r=n.open.indexOf(t.path),i=n.open.filter(e=>e!==t.path),a=n.active===t.path?i[Math.min(r,i.length-1)]??null:n.active;return{...e,files:{...e.files,[t.sessionId]:{open:i,active:a}}}}case`file_show_chat`:{let n=e.files[t.sessionId];return!n||n.active===null?e:{...e,files:{...e.files,[t.sessionId]:{...n,active:null}}}}case`file_activate`:{let n=e.files[t.sessionId];return!n||!n.open.includes(t.path)?e:n.active===t.path?e.page?{...e,page:null}:e:{...e,page:null,files:{...e.files,[t.sessionId]:{...n,active:t.path}}}}case`session_removed`:{let{[t.id]:n,...r}=e.transcripts,{[t.id]:i,...a}=e.files,{[t.id]:o,...s}=e.windows,{[t.id]:c,...l}=e.pendingRouting,{[t.id]:u,...d}=e.remote.tabs,{[t.id]:f,...p}=e.remote.sessionOwners,{[t.id]:m,...h}=e.prefs.remoteTabs,{[t.id]:g,..._}=e.chatConversations,{[t.id]:v,...y}=e.pinnedRows,b={...e,chatConversations:_,pinnedRows:y,sessions:e.sessions.filter(e=>e.id!==t.id),sessionsTotal:Math.max(0,e.sessionsTotal-1),transcripts:r,windows:s,files:a,pendingRouting:l,remote:{...e.remote,tabs:d,sessionOwners:p,sessions:Object.fromEntries(Object.entries(e.remote.sessions).map(([e,n])=>[e,Array.isArray(n)?n.filter(e=>e.id!==t.id):n]))},prefs:{...e.prefs,remoteTabs:h}};return qx(b,wy(b.layout,t.id))}case`projects`:return{...e,projects:t.projects};case`scheduled_tasks_changed`:return{...e,scheduledTasksVersion:e.scheduledTasksVersion+1};case`conversations_changed`:return{...e,conversationsChange:{seq:e.conversationsChange.seq+1,conversationIds:t.conversationIds,sessionIds:t.sessionIds}};case`conversations_select`:return{...e,conversationsSelectId:t.conversationId};case`chat_abouts_changed`:return{...e,chatAboutsChange:{seq:e.chatAboutsChange.seq+1,sessionIds:t.sessionIds,generateAll:t.generateAll}};case`next_prompts_changed`:return{...e,nextPromptsChange:{seq:e.nextPromptsChange.seq+1,sessionIds:t.sessionIds,...t.review===void 0?{}:{review:t.review}}};case`chat_conversations`:{let n=e.chatConversations[t.sessionId];return n&&JSON.stringify(n)===JSON.stringify(t.conversations)?e:{...e,chatConversations:{...e.chatConversations,[t.sessionId]:t.conversations}}}case`session_status`:{let n=e.sessions.findIndex(e=>e.id===t.sessionId),r=e.pinnedRows[t.sessionId],i=r&&r.status!==t.status?{...e,pinnedRows:{...e.pinnedRows,[t.sessionId]:{...r,status:t.status}}}:e;if(n<0||e.sessions[n].status===t.status)return i;let a=e.sessions.slice();return a[n]={...a[n],status:t.status},{...i,sessions:a}}case`vault_projects`:return{...e,vaultProjects:t.projects};case`voice_summary_dialog`:return{...e,voiceSummarySessionId:t.sessionId,ui:{...e.ui,dialog:t.sessionId?`voice-summary`:`none`}};case`assign_project_dialog`:return{...e,assignProjectSessionId:t.sessionId,ui:{...e.ui,dialog:t.sessionId?`assign-project`:`none`}};case`page`:return e.page===t.page?e:{...e,page:t.page,pageGroup:t.page?e.layout.focused:e.pageGroup};case`pinned_row`:return{...e,pinnedRows:{...e.pinnedRows,[t.session.id]:t.session}};case`select_session`:{let n={...e,ui:{...e.ui,dialog:`none`}};if(t.id===null)return{...n,currentSessionId:null};let r=t.near?iy(n.layout,t.near):null;return qx({...n,page:null},Cy(n.layout,t.id,r??void 0))}case`close_tab`:return qx(e,wy(e.layout,t.id));case`unsent`:{if(!e.tabs.ids.includes(t.sessionId)||t.onlyIfEmpty&&!ib(e.unsent[t.sessionId]))return e;let n=ob(e.unsent,t.sessionId,t.message);return n===e.unsent?e:{...e,unsent:n}}case`composer_quote`:return{...e,composerQuote:{sessionId:t.sessionId,text:t.text,preview:t.preview,itemId:t.itemId,seq:(e.composerQuote?.seq??0)+1}};case`chat_search_request`:return{...e,chatSearchRequest:{sessionId:t.sessionId,query:t.query,seq:(e.chatSearchRequest?.seq??0)+1}};case`chat_search_request_seen`:{let n=e.chatSearchRequest;return!n||n.seq!==t.seq||n.seen?e:{...e,chatSearchRequest:{...n,seen:!0}}}case`jump_to`:return{...e,jumpTo:{sessionId:t.sessionId,itemId:t.itemId,seq:(e.jumpTo?.seq??0)+1}};case`move_tab`:return qx(e,Ty(e.layout,t.groupId??e.layout.focused,t.from,t.to));case`cycle_tab`:return qx({...e,page:null},Ey(e.layout,t.delta));case`layout_focus`:return qx(e,by(e.layout,t.groupId));case`layout_focus_index`:return qx(e,xy(e.layout,t.index));case`layout_drop`:{let n=ky(e.layout,t.tabId,t.target);if(n===e.layout)return e;let r=e.page&&e.pageGroup===t.target.groupId?null:e.page;return qx(r===e.page?e:{...e,page:r},n)}case`layout_resize`:return qx(e,jy(e.layout,t.path,t.sizes));case`layout_equalize`:return qx(e,My(e.layout,t.path));case`elsewhere`:{let n=e.elsewhere,r=t.owners;return Object.keys(n).length===Object.keys(r).length&&Object.entries(r).every(([e,t])=>n[e]===t)?e:{...e,elsewhere:{...r}}}case`sidebar_pinned_override`:return e.ui.sidebarPinnedOverride===t.pinned?e:{...e,ui:{...e.ui,sidebarPinnedOverride:t.pinned}};case`restore_tabs`:{let n=e.tabs.ids.filter(e=>!t.ids.includes(e)),r={...e.drafts},i=new Set(e.sessions.map(e=>e.id));for(let e of t.drafts)!r[e.id]&&!i.has(e.id)&&(r[e.id]=e);let a=e.currentSessionId??t.activeId,o=Jv([...t.ids,...n],a),s=Hy(t.layout??null,o.ids);return o.activeId&&(s=Sy(s,o.activeId)),qx({...e,drafts:r},s)}case`draft_open`:return qx({...e,page:null,drafts:{...e.drafts,[t.draft.id]:t.draft}},Cy(e.layout,t.draft.id));case`draft_patch`:{let n=e.drafts[t.id];return n?{...e,drafts:{...e.drafts,[t.id]:{...n,...t.patch}}}:e}case`draft_materialized`:{if(!e.drafts[t.id])return e;let{[t.id]:n,...r}=e.drafts;return{...e,drafts:r}}case`routing_seen`:{let n=e.pendingRouting[t.session.id];if(!n||!qee(n,t.session,e.providers))return e;let{[t.session.id]:r,...i}=e.pendingRouting;return{...e,pendingRouting:i}}case`pending_routing`:if(t.routing===null){if(!e.pendingRouting[t.sessionId])return e;let{[t.sessionId]:n,...r}=e.pendingRouting;return{...e,pendingRouting:r}}return{...e,pendingRouting:{...e.pendingRouting,[t.sessionId]:t.routing}};case`transcript`:{let n=e.transcripts[t.sessionId]??_g(t.sessionId),r=bg(n,t.action);if(r===n)return e;let i={...e,transcripts:{...e.transcripts,[t.sessionId]:r}};if(r.items.length>n.items.length){let e=Jx(i,t.sessionId),n=Gb(e);if(n!==e||i.windows[t.sessionId]===void 0)return{...i,windows:{...i.windows,[t.sessionId]:n}}}return i}case`transcript_page`:{let n=e.transcripts[t.sessionId];return!n||n.items.length===0?Zx(e,{type:`transcript`,sessionId:t.sessionId,action:{type:`entries`,entries:t.entries}}):Zx(e,{type:`transcript_prepend`,sessionId:t.sessionId,entries:t.entries})}case`transcript_prepend`:{let n=e.transcripts[t.sessionId]??_g(t.sessionId),r=bg(n,{type:`prepend_entries`,entries:t.entries});if(r===n)return e;let i=Jx(e,t.sessionId),a=r.items.length-n.items.length;return{...e,transcripts:{...e.transcripts,[t.sessionId]:r},windows:{...e.windows,[t.sessionId]:Wb(i,Math.max(i.rendered,i.size)+a,r.items.length,!0)}}}case`transcript_loading`:return{...e,transcriptLoading:{...e.transcriptLoading,[t.sessionId]:t.loading}};case`window_grow`:{let n=Jx(e,t.sessionId),r=Ub(n,t.total);return r===n&&e.windows[t.sessionId]!==void 0?e:{...e,windows:{...e.windows,[t.sessionId]:r}}}case`window_reveal`:{let n=Jx(e,t.sessionId),r=Wb(n,t.rendered,t.total,t.hold===!0);return r===n&&e.windows[t.sessionId]!==void 0?e:{...e,windows:{...e.windows,[t.sessionId]:r}}}case`window_trim`:{let n=Jx(e,t.sessionId),r=Gb(n,t.force===!0);return r===n&&e.windows[t.sessionId]!==void 0?e:{...e,windows:{...e.windows,[t.sessionId]:r}}}case`window_size`:{let n={};for(let[r,i]of Object.entries(e.windows))n[r]=Hb(i,t.size);return{...e,windows:n}}case`auto_routed`:{let n=oS(e,t.frame.sessionId);if(!n)return e;let r=t.frame;return Zx(e,{type:`session_upsert`,session:{...n,autoModel:{model:r.model,effort:r.effort,note:r.note,at:new Date(t.receivedAt).toISOString()}}})}case`model_boundary`:return{...e,modelBoundaries:{...e.modelBoundaries,[t.sessionId]:t.boundary}};case`providers`:return{...e,providers:t.providers,activeProviderId:t.activeProviderId};case`active_provider`:return{...e,activeProviderId:t.activeProviderId};case`agent_tools`:return{...e,agentTools:t.catalogue};case`settings`:{let n={...e,settings:t.settings};return t.settings.uiPrefs&&(n=Xx(n,Zl(t.settings.uiPrefs)),n.prefsBackend=`brain`),n}case`prefs`:return Xx(e,t.prefs);case`prefs_backend`:return{...e,prefsBackend:t.backend};case`plan`:return{...e,plan:t.plan};case`account`:return{...e,account:t.account,accountLoaded:!0,accountLink:t.account.link??e.accountLink,emailVerification:t.account.loggedIn?null:e.emailVerification};case`account_unavailable`:return e.accountLoaded?e:{...e,accountLoaded:!0};case`account_link`:return{...e,accountLink:t.link};case`email_verification`:return{...e,emailVerification:t.pending};case`recovery_key`:return{...e,recoveryKey:t.recoveryKey};case`credentials`:return{...e,credentials:t.credentials};case`claude_subscription`:return{...e,claudeSubscription:t.status};case`claude_login`:return{...e,claudeLogin:t.state};case`oauth_login`:return{...e,oauthLogin:t.state};case`oauth_login_provider`:return{...e,ui:{...e.ui,oauthLoginProviderId:t.providerId}};case`engine_download`:return{...e,engineDownload:t.state};case`import_progress`:return{...e,importProgress:t.progress};case`tool_install`:{let{[t.frame.sessionId]:n,...r}=e.toolInstalls;return{...e,toolInstalls:t.frame.phase===`done`?r:{...r,[t.frame.sessionId]:t.frame}}}case`tool_install_dismiss`:{let{[t.sessionId]:n,...r}=e.toolInstalls;return{...e,toolInstalls:r}}case`doctor`:return{...e,doctor:t.checks};case`remote_hosts`:{let n=e.remote.tabs;for(let r of t.hosts){let t=r.label||r.hostName;for(let[i,a]of Object.entries(n))a.hostId===r.hostId&&a.hostName!==t&&(n===e.remote.tabs&&(n={...n}),n[i]={...a,hostName:t})}return{...e,remote:{...e.remote,hosts:t.hosts,tabs:n,loading:!1,loaded:!0,reason:t.reason??null,stale:t.stale??!1}}}case`remote_unsupported`:return{...e,remote:{...e.remote,supported:!1,loading:!1,loaded:!0}};case`remote_loading`:return{...e,remote:{...e.remote,loading:t.loading}};case`remote_loaded`:return{...e,remote:{...e.remote,loading:!1,loaded:!0}};case`remote_sessions`:{let n={...e.remote.sessionOwners};for(let e of t.sessions)n[e.id]=t.hostId;let r={...e.remote.unreachable};return t.unreachable?r[t.hostId]=t.unreachable:delete r[t.hostId],{...e,remote:{...e.remote,sessions:{...e.remote.sessions,[t.hostId]:t.sessions},unreachable:r,sessionOwners:n}}}case`remote_tab`:{let n=e.remote.tabs[t.tab.sessionId],r=n&&n.hostId===t.tab.hostId?n.reach:void 0,i=n&&n.hostId===t.tab.hostId&&e.transcripts[t.tab.sessionId]?n.history:void 0;return{...e,remote:{...e.remote,tabs:{...e.remote.tabs,[t.tab.sessionId]:{...t.tab,...r?{reach:r}:{},...i?{history:i}:{}}},sessionOwners:{...e.remote.sessionOwners,[t.tab.sessionId]:t.tab.hostId}}}}case`remote_tab_state`:{let n=e.remote.tabs[t.sessionId];if(!n)return e;let r={...n,state:t.state,detail:t.detail,live:t.state===`attached`,...t.pairingId===void 0?{}:{pairingId:t.pairingId}};return{...e,remote:{...e.remote,tabs:{...e.remote.tabs,[t.sessionId]:r}}}}case`remote_tab_history`:{let n=e.remote.tabs[t.sessionId];if(!n||t.ifAbsent&&n.history)return e;let r={complete:!1,loading:!1,...n.history,...t.patch};return n.history&&n.history.complete===r.complete&&n.history.loading===r.loading?e:{...e,remote:{...e.remote,tabs:{...e.remote.tabs,[t.sessionId]:{...n,history:r}}}}}case`remote_tab_meta`:{let n=e.remote.tabs[t.sessionId];if(!n)return e;let r={...n,...t.features===void 0?{}:{features:t.features},...t.catalogue===void 0?{}:{catalogue:t.catalogue}};return{...e,remote:{...e.remote,tabs:{...e.remote.tabs,[t.sessionId]:r}}}}case`remote_reach`:{let n=e.remote.tabs[t.sessionId];if(!n)return e;let r=n.reach??{linked:!1,folders:[],refusals:[],asks:[]},i=t.event,a;switch(i.kind){case`state`:a={...r,linked:i.linked,folders:i.folders,refusals:i.refusals??[],asks:i.linked?r.asks:[]};break;case`ask`:a={...r,asks:r.asks.some(e=>e.requestId===i.requestId)?r.asks:[...r.asks,{requestId:i.requestId,summary:i.summary}]};break;case`ask_end`:a={...r,asks:r.asks.filter(e=>e.requestId!==i.requestId)};break;case`ended`:a={linked:!1,folders:[],refusals:[],asks:[]}}return{...e,remote:{...e.remote,tabs:{...e.remote.tabs,[t.sessionId]:{...n,reach:a}}}}}case`remote_tab_closed`:{if(!e.remote.tabs[t.sessionId])return e;let{[t.sessionId]:n,...r}=e.remote.tabs,{[t.sessionId]:i,...a}=e.transcripts,{[t.sessionId]:o,...s}=e.windows;return{...e,transcripts:a,windows:s,remote:{...e.remote,tabs:r}}}case`update_status`:return{...e,update:t.status,updateChecking:!1};case`update_checking`:return{...e,updateChecking:t.checking};case`update_event`:{let n=kx(e.updateInstall,t.event),r=n.phase===`downloading`&&e.ui.dialog===`none`?`update`:e.ui.dialog;return{...e,updateInstall:n,ui:e.ui.dialog===r?e.ui:{...e.ui,dialog:r}}}case`terminal_update`:{let n=t.terminal.running&&e.ui.dialog===`none`?`update`:e.ui.dialog;return{...e,terminalUpdate:t.terminal,ui:e.ui.dialog===n?e.ui:{...e.ui,dialog:n}}}case`update_dismissed`:return{...e,updateDismissed:t.version};case`toast`:{let n=e.toasts.filter(e=>e.id!==t.toast.id);return{...e,toasts:[...n.slice(-4),t.toast]}}case`dismiss_toast`:return{...e,toasts:e.toasts.filter(e=>e.id!==t.id)};case`sidebar`:return{...e,ui:{...e.ui,sidebarOpen:t.open}};case`projects_new`:return{...e,projectsStartNew:!0,projectsSelectId:null};case`import_offer`:return{...e,importOffered:!0};case`projects_select`:return{...e,projectsStartNew:!1,projectsSelectId:t.projectId};case`dialog`:return{...e,projectsStartNew:t.dialog===`projects`&&e.projectsStartNew,importOffered:t.dialog===`import-claude`&&e.importOffered,projectsSelectId:t.dialog===`projects`?e.projectsSelectId:null,conversationsSelectId:t.dialog===`conversations`?e.conversationsSelectId:null,ui:{...e.ui,dialog:t.dialog,claudeLoginMode:t.dialog===`claude-login`?e.ui.claudeLoginMode:null,oauthLoginProviderId:t.dialog===`oauth-login`?e.ui.oauthLoginProviderId:null,connectProviderId:t.connectProviderId??null}};case`connect_provider`:return{...e,ui:{...e.ui,connectProviderId:t.providerId}};case`claude_login_mode`:return{...e,ui:{...e.ui,claudeLoginMode:t.mode}};case`settings_section`:return{...e,ui:{...e.ui,settingsSection:t.section}};case`mcp_servers`:return{...e,mcpServers:t.servers};case`mcp_testing`:return{...e,mcpTesting:{...e.mcpTesting,[t.id]:t.testing}};case`mcp_test_result`:return{...e,mcpTestResults:{...e.mcpTestResults,[t.id]:t.result}}}}function Qx(e){return e.type===`subagent_activity`||e.type===`agent`&&re(e.message)}function $x(){return typeof document<`u`&&document.visibilityState===`hidden`}function eS(e,t){switch(e.type){case`welcome`:return[{type:`welcome`,hostName:e.hostName,hostId:e.hostId,appVersion:e.appVersion}];case`agent`:case`permission_request`:case`permission_resolved`:case`turn_started`:case`turn_finished`:case`prompt_delivered`:case`subagent_activity`:case`prompt_cancelled`:return[{type:`transcript`,sessionId:e.sessionId,action:{type:`frame`,frame:e,receivedAt:t}}];case`session_state`:return[{type:`session_upsert`,session:e.session},{type:`routing_seen`,session:e.session},{type:`transcript`,sessionId:e.session.id,action:{type:`frame`,frame:e,receivedAt:t}}];case`session_status`:return[{type:`session_status`,sessionId:e.sessionId,status:e.status}];case`auto_routed`:return[{type:`auto_routed`,frame:e,receivedAt:t}];case`conversations_changed`:return[{type:`conversations_changed`,conversationIds:e.conversationIds,sessionIds:e.sessionIds}];case`chat_about_changed`:return[{type:`chat_abouts_changed`,sessionIds:e.sessionIds,generateAll:e.generateAll}];case`next_prompt_changed`:return[{type:`next_prompts_changed`,sessionIds:e.sessionIds,review:e.review}];case`claude_login`:return[{type:`claude_login`,state:e.state}];case`engine_download`:return[{type:`engine_download`,state:e.state}];case`import_progress`:return[{type:`import_progress`,progress:e.finished?null:e}];case`tool_pack_install`:return[{type:`tool_install`,frame:e}];case`pool_notice`:{let t=e.retryAfterSec?` Retrying by itself in ${e.retryAfterSec} s.`:``;return[{type:`toast`,toast:{id:`t-pool-${e.code}`,kind:`info`,text:`${e.message}${t}`}}]}case`error`:return e.sessionId?[{type:`transcript`,sessionId:e.sessionId,action:{type:`frame`,frame:e,receivedAt:t}}]:[{type:`toast`,toast:{id:`t-${t}`,kind:`error`,text:`${e.code}: ${e.message}`}}];default:return[]}}var tS=`Removed from the chat — the model no longer remembers them`,nS=36e5,rS=1500;function iS(){return`req-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function aS(e,t,n){if(e.type===`welcome`||e.type===`conversations_changed`||e.type===`chat_about_changed`||e.type===`next_prompt_changed`)return[];let r=`sessionId`in e?e.sessionId:e.type===`session_state`?e.session.id:void 0;return typeof r==`string`&&r!==t?[]:eS(e,n)}function oS(e,t){return e.transcripts[t]?.session??e.sessions.find(e=>e.id===t)}var sS=(0,v.createContext)(null);function G(){let e=(0,v.useContext)(sS);if(!e)throw Error(`useApp must be used inside <AppProvider>`);return e}var cS=(0,v.createContext)(null);function lS({sessionId:e,groupId:t,focused:n,children:r}){let i=(0,v.useMemo)(()=>({sessionId:e,groupId:t,focused:n}),[e,t,n]);return(0,W.jsx)(cS.Provider,{value:i,children:r})}function uS(){let e=(0,v.useContext)(cS),t=(0,v.useContext)(sS);if(e)return e;let n=t?.state;return{sessionId:n?.currentSessionId??null,groupId:n?.layout.focused??`g1`,focused:!0}}function dS(){return uS().sessionId}function fS(){let{state:e}=G(),t=dS();return t?e.transcripts[t]??null:null}function pS(){let{state:e}=G(),t=dS();return t?e.transcripts[t]?.session??e.sessions.find(e=>e.id===t)??null:null}function mS(){let{state:e}=G(),t=dS();return t?e.drafts[t]??null:null}function hS(){return typeof window<`u`&&window.oonacode?`desktop`:`host`}var gS=0;function _S(e){return e.status===401&&/password|credential/i.test(e.message)}function vS(){try{return typeof window<`u`?window.localStorage:null}catch{return null}}function yS({api:e,socket:t,relay:n=null,initialSessionId:r,onUnauthorized:i,storage:a,fetchImpl:o,reportError:s,streamBatchMs:c=Kee(),windowRole:l,children:u}){let d=l??(typeof window<`u`&&window.oonacode?.window?.role===`popout`?`popout`:`main`),[f,p]=(0,v.useReducer)(Zx,d,e=>{let t=Kx();return e===`popout`?{...t,windowRole:e,ui:{...t.ui,sidebarPinnedOverride:!1,sidebarOpen:!1}}:t}),m=(0,v.useRef)(f),h=(0,v.useRef)(!1),g=f.updateInstall.phase,_=f.terminalUpdate.running;(0,v.useEffect)(()=>{_||g!==`downloading`&&g!==`installing`&&(h.current=!1)},[g,_]),m.current=f;let y=(0,v.useRef)(i);y.current=i;let b=(0,v.useRef)(s);b.current=s;let x=(0,v.useRef)(a);x.current=a===void 0?vS():a;let S=(0,v.useRef)(o);S.current=o;let C=(0,v.useRef)(null),w=(0,v.useRef)({tail:Promise.resolve(),latest:0}),T=(0,v.useRef)(new Map),E=(0,v.useRef)(new Map),D=(0,v.useRef)(new Map),O=(0,v.useRef)(new Map),k=(0,v.useRef)(new Set),A=(0,v.useRef)(new Map),j=(0,v.useRef)(new Map),M=(0,v.useRef)({inFlight:new Set,failedAt:new Map}),N=(0,v.useRef)(new Map),te=(0,v.useRef)(new Map),P=(0,v.useRef)(new Map),F=(0,v.useRef)(()=>{}),ne=(0,v.useRef)(null);ne.current===null&&(ne.current=Xb(()=>F.current())),(0,v.useEffect)(()=>()=>ne.current?.dispose(),[]);let I=(0,v.useMemo)(()=>{let r=(e,t)=>{gS+=1,p({type:`toast`,toast:{id:`toast-${gS}`,kind:e,text:t}})},i=(e,t)=>{if(e instanceof sg&&e.isUnauthorized&&!_S(e)){y.current?.();return}let n=t?`${t}: ${ov(e)}`:ov(e);r(`error`,n),b.current?.(e,{source:`action`,...t?{action:t}:{}})},a=e=>r(`error`,`This host build cannot ${e} yet — update OonaCode on this PC`),o=()=>m.current.currentSessionId,s=e=>typeof e==`string`?m.current.drafts[e]??null:null,l=e=>rte(m.current.drafts,e),u=async t=>{p({type:`sessions_loading`,loading:!0});try{let n=(t??m.current.search).trim(),r=await e.listSessions(n?{search:n,limit:200,links:!0}:{limit:200,links:!0});p({type:`sessions`,sessions:r.sessions,total:r.total,...r.links?{links:r.links}:{}})}catch(e){p({type:`sessions_error`,error:ov(e)}),i(e,`Sessions`)}},d=async()=>{try{p({type:`vault_projects`,projects:(await e.listVaultProjects()).projects})}catch{m.current.vaultProjects.length===0&&p({type:`vault_projects`,projects:[]})}},f=async()=>{try{p({type:`projects`,projects:(await e.listProjects()).projects})}catch(e){i(e,`Projects`)}await d()},g=async()=>{try{let t=await e.listProviders();t.privateModels&&Aee(t.privateModels),p({type:`providers`,providers:t.providers,activeProviderId:t.activeProviderId})}catch(e){i(e,`Providers`)}},_=async()=>{if(e.listAgentTools)try{let{catalogue:t}=await e.listAgentTools();t&&p({type:`agent_tools`,catalogue:t})}catch(e){e instanceof sg&&e.isUnauthorized&&y.current?.()}},v=async()=>{if(e.listMcpServers)try{let{servers:t}=await e.listMcpServers();p({type:`mcp_servers`,servers:t})}catch(e){e instanceof sg&&e.isUnauthorized&&y.current?.()}},k=async t=>{if(!e.createMcpServer)return null;try{let n=await e.createMcpServer(t);return r(`success`,`Added MCP server "${n.name}"`),await v(),n}catch(e){return i(e,`MCP Servers`),null}},re=async(t,n)=>{if(!e.updateMcpServer)return null;try{let r=await e.updateMcpServer(t,n);return await v(),r}catch(e){return i(e,`MCP Servers`),null}},ie=async t=>{if(!e.deleteMcpServer)return!1;try{return await e.deleteMcpServer(t),r(`success`,`MCP server removed`),await v(),!0}catch(e){return i(e,`MCP Servers`),!1}},L=async t=>{if(!e.testMcpServer)return null;p({type:`mcp_testing`,id:t,testing:!0});try{let n=await e.testMcpServer(t);return p({type:`mcp_test_result`,id:t,result:n}),n}catch(e){let n={ok:!1,durationMs:0,error:e instanceof Error?e.message:String(e)};return p({type:`mcp_test_result`,id:t,result:n}),n}finally{p({type:`mcp_testing`,id:t,testing:!1})}},R=async t=>{if(!e.testMcpConfig)return null;try{return await e.testMcpConfig(t)}catch(e){return{ok:!1,durationMs:0,error:e instanceof Error?e.message:String(e)}}},z=async(t={})=>{if(!e.listConversations)return`unsupported`;try{return(await e.listConversations(t)).conversations}catch(e){return e instanceof sg&&e.isUnauthorized&&y.current?.(),dg(e)?`unsupported`:null}},ae=async(t,n,r)=>{try{let i=await e.setActiveProvider({providerId:t,...n?{model:n}:{},...r===void 0?{}:{variantId:r}});p({type:`active_provider`,activeProviderId:i.activeProviderId}),await g()}catch(e){i(e,`Provider`)}},oe=async()=>{try{p({type:`settings`,settings:await e.getSettings()})}catch(e){i(e,`Settings`)}},se=async()=>{try{p({type:`account`,account:await e.getAccount()})}catch(e){p({type:`account_unavailable`}),i(e,`Account`)}},ce=async()=>{try{p({type:`credentials`,credentials:(await e.listCredentials()).credentials})}catch(e){if(e instanceof sg&&(e.code===`vault_locked`||e.status===423)){p({type:`credentials`,credentials:[]});return}i(e,`Credentials`)}},le=async()=>{try{p({type:`claude_subscription`,status:await e.claudeSubscriptionStatus()})}catch(e){e instanceof sg&&e.isUnauthorized&&y.current?.(),p({type:`claude_subscription`,status:null})}},ue=async t=>{try{p({type:`oauth_login`,state:await e.oauthLoginStart(t)})}catch(e){r(`error`,`Sign-in: ${ov(e)}`)}},de=async t=>{try{p({type:`oauth_login`,state:await e.oauthLoginState(t)})}catch{}},fe=async t=>{try{p({type:`oauth_login`,state:await e.oauthLoginCancel(t)})}catch(e){r(`error`,`Sign-in: ${ov(e)}`)}},pe=async()=>{try{p({type:`claude_login`,state:await e.claudeLoginState()})}catch{}},me=async()=>{try{let t=await e.claudeSubscriptionLogin();return t.login&&p({type:`claude_login`,state:t.login}),t}catch(e){return r(`error`,`Claude login: ${ov(e)}`),null}},he=async t=>{try{return p({type:`claude_login`,state:await e.claudeLoginCode({code:t})}),!0}catch(e){return r(`error`,`Claude login: ${ov(e)}`),!1}},ge=async()=>{try{p({type:`claude_login`,state:await e.claudeLoginCancel()})}catch(e){r(`error`,`Claude login: ${ov(e)}`)}},_e=async()=>{try{let t=await e.info();C.current=t,p({type:`info`,info:t})}catch(e){i(e,`Host`)}},ve=async()=>{let t=(C.current??m.current.info)?.appVersion??``;for(let n=0;n<8;n++){try{let n=await e.info();if(C.current=n,p({type:`info`,info:n}),n.appVersion!==t)return}catch{}await new Promise(e=>setTimeout(e,rS))}},ye=async()=>{if(e.plan)try{let{plan:t}=await e.plan();p({type:`plan`,plan:t})}catch{p({type:`plan`,plan:null})}};F.current=()=>void ye();let be=()=>{e.plan&&ne.current?.request()},xe=async()=>{if(!e.listHosts||!m.current.remote.supported){p({type:`remote_loaded`});return}p({type:`remote_loading`,loading:!0});try{let t=m.current.remote.unreachable,n=await e.listHosts();p({type:`remote_hosts`,hosts:n.hosts,reason:n.reason??null,stale:n.stale??!1});for(let e of n.hosts)!e.isSelf&&e.online&&t[e.hostId]&&Se(e.hostId)}catch(e){dg(e)?p({type:`remote_unsupported`}):(p({type:`remote_loaded`}),e instanceof sg&&e.isUnauthorized&&y.current?.())}},Se=async t=>{if(!e.listHostSessions)return null;try{let n=await e.listHostSessions(t);return p({type:`remote_sessions`,hostId:t,sessions:n.sessions,unreachable:n.reason?{reason:n.reason,detail:n.detail??null}:null}),n.sessions}catch(e){return dg(e)?p({type:`remote_unsupported`}):i(e,`Remote sessions`),null}},Ce=async e=>{await Se(e)},we=e=>{let t=m.current;if(t.drafts[e]||t.remote.tabs[e]||A.current.has(e))return null;let n=t.remote.sessionOwners[e]??t.prefs.remoteTabs[e];if(!n)return null;let r=t.remote.hosts.find(e=>e.hostId===n);return r&&!r.isSelf?n:null},Ee=e=>{if(e!==null){let t=typeof window<`u`?window.oonacode:void 0,n=m.current;if(n.elsewhere[e]&&!n.tabs.ids.includes(e)&&t?.focusChatElsewhere){t.focusChatElsewhere(e).then(t=>{t||p({type:`select_session`,id:e})},()=>p({type:`select_session`,id:e}));return}let r=we(e);if(r!==null){Ie(r,e);return}}p({type:`select_session`,id:e})},De=e=>e?m.current.remote.tabs[e]??null:null,Oe=(e,t)=>A.current.get(e)?.send(t)??!1,ke=e=>{let t=De(e);r(`error`,`${t?.hostName??`That PC`} is offline — this transcript is read-only until it comes back.`)},Ae=async(e,t,i)=>{let a=i??``,o=a.trim()===``?null:a.trim(),s=m.current,c=s.transcripts[t]?.session??s.sessions.find(e=>e.id===t)??(s.remote.sessions[e]??[]).find(e=>e.id===t);if(De(t)){if(!Oe(t,{type:`set_title`,sessionId:t,title:a})){ke(t);return}c&&p({type:`session_upsert`,session:{...c,title:o}});return}if(!n){r(`error`,`This window cannot bridge to other PCs yet.`);return}c&&p({type:`session_upsert`,session:{...c,title:o}}),await new Promise(i=>{let o=!1,s=!1,c=()=>{o||(o=!0,clearTimeout(l),u.detach(),i())},l=setTimeout(c,5e3),u=n.attach({hostId:e,sessionId:t,onFrame:e=>{e.type===`session_state`&&e.session.id===t?(p({type:`session_upsert`,session:e.session}),c()):e.type===`error`&&(r(`error`,`Rename: ${e.message}`),c())},onState:i=>{if(i.state===`attached`&&!s)s=!0,n.send(i.pairingId,{type:`set_title`,sessionId:t,title:a}),setTimeout(c,800);else if(i.state===`host_offline`||i.state===`error`||i.state===`unavailable`){if(s)return;let t=m.current.remote.hosts.find(t=>t.hostId===e),n=t?.label||t?.hostName||e;r(`error`,`Rename: ${n} is offline or unreachable.`),c()}}})})},je=async(t,n)=>{let r=e.listHostSessionEntries;if(!r)return null;p({type:`transcript_loading`,sessionId:n,loading:!0});try{let e=m.current.transcripts[n]?.lastSeq??0;if(e>0){let i=[],a=e,o=!1;for(let e=0;e<5;e++){let e=await r(t,n,{afterSeq:a,limit:500-i.length});if(e.readOnly){o=!1;break}if(i.push(...e.entries),o=e.entries.length>0&&e.nextSeq!==null&&e.nextSeq>a,!o||i.length>=500)break;a=e.nextSeq}if(!o)return i.length>0&&p({type:`transcript`,sessionId:n,action:{type:`entries`,entries:i}}),i.reduce((e,t)=>t.seq>e?t.seq:e,e);Me(n)}return await Ne(r,t,n)}catch(e){e instanceof sg&&e.isUnauthorized?y.current?.():dg(e)||i(e,`Remote history`);let t=m.current.transcripts[n]?.lastSeq??0;return t>0?t:null}finally{p({type:`transcript_loading`,sessionId:n,loading:!1}),p({type:`remote_tab_history`,sessionId:n,patch:{complete:!1,loading:!1},ifAbsent:!0})}},Me=e=>{let t=m.current.transcripts[e],n=N.current;n.set(e,(n.get(e)??0)+1),p({type:`transcript`,sessionId:e,action:{type:`reset`}}),t?.session&&p({type:`transcript`,sessionId:e,action:{type:`session`,session:t.session}})},Ne=async(e,t,n)=>{let r=await e(t,n,{limit:500,tail:1});if(r.readOnly||r.prevSeq===void 0&&r.nextSeq!==null)return null;let i=r.entries.slice(-500),a=i.length<r.entries.length?i[0]?.seq??null:r.prevSeq??null,o=1;for(;i.length<120&&a!==null&&o<5;){let r=500-i.length,s=await e(t,n,{limit:r,beforeSeq:a});if(s.readOnly||s.entries.length===0)break;let c=s.entries.filter(e=>e.seq<a).slice(-r);if(c.length===0)break;i=[...c,...i];let l=c.length<s.entries.length?c[0]?.seq??null:s.prevSeq??null;if(l!==null&&l>=a)break;a=l,o+=1}return p({type:`remote_tab_history`,sessionId:n,patch:{complete:a===null,loading:!1}}),i.length===0?0:(p({type:`transcript_page`,sessionId:n,entries:i}),i.reduce((e,t)=>t.seq>e?t.seq:e,0))},Pe=async(t,n)=>{let a=m.current.remote.tabs[t],o=e.listHostSessionEntries,s=M.current;if(!a||!o||!a.history||a.history.complete||s.inFlight.has(t)||Date.now()-(s.failedAt.get(t)??0)<5e3)return;let c=h_(m.current.transcripts[t]);if(c===null)return;let l=c;s.inFlight.add(t),p({type:`remote_tab_history`,sessionId:t,patch:{loading:!0}});let u=N.current.get(t)??0,d;try{for(let e=0;e<=3;e++){let e=await o(a.hostId,t,{beforeSeq:l,limit:500});if(e.readOnly){s.failedAt.set(t,Date.now()),r(`error`,`${a.hostName} is not answering — earlier messages can be read once it is.`);return}if(!m.current.remote.tabs[t]||(N.current.get(t)??0)!==u)return;let i=l,c=e.entries.filter(e=>e.seq<i).slice(-500),f=!1;if(c.length>0){let e=m.current.transcripts[t];f=!e||m_(e,c).items.length>e.items.length,f&&n?.(),p({type:`transcript_prepend`,sessionId:t,entries:c}),l=c.reduce((e,t)=>t.seq<e?t.seq:e,l)}if(d=c.length===0||e.prevSeq===null||e.prevSeq===void 0,s.failedAt.delete(t),f||d)break}}catch(e){s.failedAt.set(t,Date.now()),e instanceof sg&&e.isUnauthorized?y.current?.():dg(e)||i(e,`Earlier messages`)}finally{s.inFlight.delete(t),p({type:`remote_tab_history`,sessionId:t,patch:d===void 0?{loading:!1}:{loading:!1,complete:d}})}},Fe=e=>{j.current.get(e)?.dispose(),j.current.delete(e);let t=A.current.get(e);t&&(A.current.delete(e),t.detach(),p({type:`remote_tab_closed`,sessionId:e}))},Ie=async(e,t,i={})=>{let a=m.current;if(!i.draft&&A.current.has(t)){i.focus!==!1&&p({type:`select_session`,id:t});return}let o=a.remote.hosts.find(t=>t.hostId===e)??null,s=o?.label||o?.hostName||e,l=(a.remote.sessions[e]??[]).find(e=>e.id===t);i.draft?a.remote.sessions[e]===void 0&&Se(e):l?p({type:`session_upsert`,session:l}):(async()=>{let n=(await Se(e))?.find(e=>e.id===t);n&&p({type:`session_upsert`,session:n})})(),p({type:`remote_tab`,tab:{sessionId:t,hostId:e,hostName:s,pairingId:null,state:`unavailable`,detail:null,live:!1}}),i.focus!==!1&&p({type:`select_session`,id:t});let u=Promise.resolve(0),d=!0,f=0,h=0,g=()=>{d=!1;let n=je(e,t).then(e=>(n===u&&(d=!0,f=e),e!==null&&e>h&&(h=e),e));return u=n,n};if(i.draft||g(),!n){p({type:`remote_tab_state`,sessionId:t,state:`unavailable`,detail:`This window cannot bridge to other PCs yet.`});return}A.current.get(t)?.detach(),j.current.get(t)?.dispose();let _=fg({isStreamFrame:Qx,deliver:e=>{for(let t of e)x(t)},batchMs:c,isHidden:$x});j.current.set(t,_);let v=e=>{let n=Date.now();if(e.type===`transcript_changed`){if(e.sessionId!==t)return;for(let[e,n]of P.current)n===t&&(P.current.delete(e),r(`success`,tS));Ve(t);return}if(e.type===`error`&&e.requestId!==void 0&&P.current.get(e.requestId)===t){P.current.delete(e.requestId),r(`error`,e.message);return}if(e.type===`welcome`){let n=e.features??[];p({type:`remote_tab_meta`,sessionId:t,features:n}),n.includes(ze.toolPacks)&&Oe(t,{type:`list_tool_packs`,requestId:iS()})}else e.type===`tool_packs`&&p({type:`remote_tab_meta`,sessionId:t,catalogue:e.catalogue});let i=e.type===`session_state`?oS(m.current,e.session.id):void 0;for(let r of aS(e,t,n))p(r);e.type===`session_state`&&m.current.drafts[e.session.id]&&p({type:`draft_materialized`,id:e.session.id}),e.type===`session_state`&&rx(i,e.session)&&be()},y=null,b=()=>{let e=y;if(y=null,!e)return;let t=new Set,n=500;for(let r=e.length-1;r>=0;r--){let i=e[r];i.type===`agent`&&i.seq!==null&&(n>0?--n:t.add(i))}for(let n of e)t.has(n)||v(n)},x=e=>{if(e.type===`error`&&e.code===`replay_windowed`){(m.current.transcripts[t]?.lastSeq??0)>0&&Me(t),p({type:`remote_tab_history`,sessionId:t,patch:{complete:!1}}),y||=[];return}if(y){y.push(e),(e.type===`session_state`||e.type===`error`)&&b();return}v(e)},S=0,C=(e,r,a)=>{if(r!==S||A.current.get(t)?.pairingId!==e)return;let o=r=>{n.send(e,{type:`subscribe`,sessionId:t,...r===void 0?{}:{afterSeq:r}})};if(!d){o(),u.then(()=>C(e,r,a));return}let s=Math.max(h,m.current.transcripts[t]?.lastSeq??0);if(i.draft||s>0){o(s);return}if(f===0){o(0);return}if(!a){g(),C(e,r,!0);return}y=[],o(0)},w=n.attach({hostId:e,sessionId:t,onFrame:e=>_.push(e),onReach:e=>p({type:`remote_reach`,sessionId:t,event:e}),onState:e=>{if(p({type:`remote_tab_state`,sessionId:t,state:e.state,detail:e.detail,pairingId:e.pairingId}),S+=1,e.state!==`attached`&&b(),e.state===`host_offline`&&e.detail===`backpressure`){i.draft||g();return}e.state===`attached`&&C(e.pairingId,S,!1)}});A.current.set(t,w),p({type:`remote_tab_state`,sessionId:t,state:`unavailable`,detail:null,pairingId:w.pairingId})},Le=async t=>{let n=mte(m.current.prefs,t);if(m.current={...m.current,prefs:n},p({type:`prefs`,prefs:n}),t.transcriptWindowSize!==void 0&&p({type:`window_size`,size:n.transcriptWindowSize}),m.current.prefsBackend===`local`){vv(x.current,n);return}let r=w.current,i=++r.latest,a=r.tail.then(async()=>{if(i===r.latest)try{let t=await e.updateSettings({uiPrefs:n});i===r.latest&&p({type:`settings`,settings:t}),t.uiPrefs?p({type:`prefs_backend`,backend:`brain`}):vv(x.current,n)}catch(e){if(hte(e)){p({type:`prefs_backend`,backend:`local`}),vv(x.current,n);return}e instanceof sg&&e.isUnauthorized?y.current?.():vv(x.current,n)}});r.tail=a.catch(()=>void 0),await a},Be=(e,t,n)=>{let r=m.current.prefs.pinned;Yl(r,e,t)!==n&&Le({pinned:Xl(r,e,t,n)})},B=async t=>{let[n,r]=await Promise.all([e.getSession(t),e.listMessages(t)]);p({type:`session_upsert`,session:n}),p({type:`transcript`,sessionId:t,action:{type:`hydrate`,messages:r.messages,session:n,contextTokens:r.contextTokens??null}})},Ve=e=>{let t=te.current.get(e);if(t)return t;let n=(async()=>{let t=De(e);if(t){Me(e),await je(t.hostId,e);return}if(m.current.transcripts[e]){p({type:`transcript`,sessionId:e,action:{type:`reset`}}),p({type:`transcript_loading`,sessionId:e,loading:!0});try{await B(e)}catch(e){e instanceof sg&&e.isUnauthorized?y.current?.():r(`error`,`Could not load session: ${ov(e)}`)}finally{p({type:`transcript_loading`,sessionId:e,loading:!1})}}})().finally(()=>{te.current.get(e)===n&&te.current.delete(e)});return te.current.set(e,n),n},He=e=>{p({type:`session_upsert`,session:e}),Ee(e.id),f()},Ue=async t=>{try{let n=await e.createSession(t);return He(n),n}catch(e){return i(e,`New session`),null}},We=(e={})=>{let t=sv(lv()),n=e.projectId?m.current.vaultProjects.find(t=>t.id===e.projectId):void 0;p({type:`draft_open`,draft:cv({...t,...e.projectId?{projectId:e.projectId}:{}},n?.chatDefaults)})},Ge=async e=>{let t=m.current.remote.hosts.find(t=>t.hostId===e)??null,n=t?.label||t?.hostName||`That PC`;if(t&&!t.online){r(`error`,`${n} is offline — a new chat has to start on a PC that is awake.`);return}let i=sv(lv());p({type:`draft_open`,draft:i}),await Ie(e,i.id,{draft:!0})},Ke=e=>{let t=m.current;return pb({drafts:t.drafts,remoteTabs:t.remote.tabs,unsent:t.unsent,files:t.files},e,ub(e))},qe=e=>{Fe(e),p({type:`close_tab`,id:e})},V=async(e,t)=>{let n=m.current,r=e.draft!==void 0&&!n.sessions.some(t=>t.id===e.id);r&&!n.drafts[e.id]&&p({type:`draft_open`,draft:gb(e)}),e.kind===`remote`&&e.hostId?Ie(e.hostId,e.id,{focus:!0,draft:r}):r||p({type:`select_session`,id:e.id}),e.unsentText&&p({type:`unsent`,sessionId:e.id,message:{text:e.unsentText,attachments:[]},onlyIfEmpty:!0});for(let t of e.files?.open??[])p({type:`file_open`,sessionId:e.id,path:t});e.files&&e.files.open.length>0&&(e.files.active?p({type:`file_activate`,sessionId:e.id,path:e.files.active}):p({type:`file_show_chat`,sessionId:e.id})),t&&p({type:`layout_drop`,tabId:e.id,target:t})},Je=async n=>{let r=m.current,i=Sm(r.providers,{providerId:n.providerId??r.activeProviderId,model:n.model??r.info?.activeModel??null,variantId:n.variantId}),a={sessionId:n.id,...n.projectDir?{cwd:n.projectDir}:{},...n.projectId?{projectId:n.projectId}:{},...n.title?{title:n.title}:{},...i.providerId?{providerId:i.providerId}:{},...i.variantId?{variantId:i.variantId}:{},...i.modelId?{model:i.modelId}:{},permissionMode:n.permissionMode??`default`,...n.posture?{posture:n.posture}:{},...n.effort&&Te(n.effort)?{effort:n.effort}:{},...lm(n.toolPacks),...gte(n.media),...n.mcpSwitches?{mcpSwitches:n.mcpSwitches}:{},...Ah(n.modelSkills),...n.customModel&&i.modelId===n.model?{customModel:!0}:{},...ng(i.providerId,i.modelId)?{autoModel:!0}:{}},o;try{o=await e.createSession(a)}catch(t){let r=await e.getSession(n.id).catch(()=>null);if(!r)throw t;o=r}return p({type:`session_upsert`,session:o}),p({type:`draft_materialized`,id:n.id}),t.subscribe(o.id),f(),o},Ye=async()=>e.scanClaudeSessions(),Xe=async(t,n)=>{if(!e.searchImportChats)return null;try{return await e.searchImportChats(t,n)}catch{return null}},Ze=async(t,n)=>{let r=await e.importClaudeSessions({...t&&t.length>0?{ids:t}:{},...n?{overwrite:!0}:{}});return r.imported.length>0&&(await u(),f()),r},Qe=async t=>{if(!e.sessionLink)return null;try{let{link:n}=await e.sessionLink(t);return p({type:`session_link`,sessionId:t,link:n}),n}catch{return p({type:`session_link`,sessionId:t,link:null}),null}},$e=async t=>{if(!e.syncSessionDown)return null;try{let n=await e.syncSessionDown(t);return p({type:`session_link`,sessionId:t,link:n.link}),n.added>0&&(await u(),m.current.tabs.ids.includes(t)&&await B(t)),n}catch(e){return i(e,`Sync`),null}},et=async(e=!1)=>{let t=m.current,n=t.account?.gatewayUrl??t.settings?.gatewayUrl??null,i=typeof window<`u`?window.oonacode:void 0,a=t.info?.platform??i?.platform??null,o=a?{platform:a,arch:t.info?.arch??null}:null,s=wx(n,Tx({bridge:i,info:t.info}),o),c=e&&i?.checkForUpdates?i.checkForUpdates():null;if(c&&c.catch(()=>void 0),!s){e&&!c&&r(`info`,`Sign in to OonaCode to check for updates`);return}p({type:`update_checking`,checking:!0});try{let a=i?.fetchLatestRelease?await i.fetchLatestRelease(n):await(async()=>{let e=await(S.current??(e=>fetch(e,{credentials:`omit`})))(s);if(!e.ok)throw Error(`release feed returned ${e.status}`);return e.json()})(),o=C.current??t.info,c=Cx(Sx(a),{desktop:i?.appVersion??null,host:o?.appVersion??t.connection.appVersion??null,cli:o?.cliVersion??null,engine:o?.engine.version??null},o?.platform??i?.platform??null);p({type:`update_status`,status:c}),e&&r(c.available?`info`:`success`,c.available?`OonaCode ${c.version} is available (${c.components.length} component${c.components.length===1?``:`s`})`:`Everything is up to date`)}catch(t){p({type:`update_checking`,checking:!1}),e&&r(`error`,`Update check failed: ${ov(t)}`)}};return{refreshInfo:_e,refreshSessions:u,scanClaudeSessions:Ye,importClaudeSessions:Ze,searchImportChats:Xe,refreshSessionLink:Qe,syncSessionDown:$e,refreshProjects:f,refreshProviders:g,refreshAgentTools:_,refreshMcpServers:v,createMcpServer:k,updateMcpServer:re,deleteMcpServer:ie,testMcpServer:L,testMcpConfig:R,refreshSettings:oe,refreshAccount:se,refreshCredentials:ce,refreshClaudeSubscription:le,startClaudeLogin:me,submitClaudeLoginCode:he,cancelClaudeLogin:ge,refreshClaudeLogin:pe,startOauthLogin:ue,refreshOauthLogin:de,cancelOauthLogin:fe,refreshHosts:xe,refreshPlan:ye,refreshPlanSoon:be,refreshHostSessions:Ce,openRemoteSession:Ie,loadOlderRemote:Pe,newRemoteTab:Ge,async renameHost(t,n){if(!e.updateHost){r(`error`,`This host build cannot rename devices yet`);return}try{let i=await e.updateHost(t,{label:n});p({type:`remote_hosts`,hosts:m.current.remote.hosts.map(e=>e.hostId===t?i:e),reason:m.current.remote.reason,stale:m.current.remote.stale}),r(`success`,`Device renamed`)}catch(e){dg(e)?p({type:`remote_unsupported`}):i(e,`Rename device`)}},async runDoctor(){p({type:`doctor`,checks:null});try{p({type:`doctor`,checks:(await e.doctor()).checks})}catch(e){i(e,`Doctor`)}},setSearch(e){p({type:`search`,value:e})},selectSession:Ee,closeTab(e){Fe(e),p({type:`close_tab`,id:e})},rememberUnsent(e,t,n){p({type:`unsent`,sessionId:e,message:t,onlyIfEmpty:n})},quoteIntoComposer(e,t,n){p({type:`composer_quote`,sessionId:e,text:t,preview:n?.preview??xd(t.replace(/^> ?/gm,``)),itemId:n?.itemId??null})},jumpToItem(e,t){p({type:`jump_to`,sessionId:e,itemId:t})},async searchTranscripts(t){if(!e.searchEntries)return null;try{return await e.searchEntries(t)}catch{return null}},openChatWithSearch(e,t){Ee(e),p({type:`chat_search_request`,sessionId:e,query:t})},moveTab(e,t,n){p({type:`move_tab`,from:e,to:t,...n?{groupId:n}:{}})},cycleTab(e){p({type:`cycle_tab`,delta:e})},focusGroup(e){let t=m.current.layout;t.focused===e||!t.groups[e]||p({type:`layout_focus`,groupId:e})},focusGroupAt(e){p({type:`layout_focus_index`,index:e})},dropTab(e,t){p({type:`layout_drop`,tabId:e,target:t})},splitTab(e,t){let n=m.current.layout,r=t??n.groups[n.focused]?.activeId??null,i=r?iy(n,r):null;if(r&&i&&(n.groups[i]?.ids.length??0)>1){p({type:`layout_drop`,tabId:r,target:{groupId:i,zone:e}});return}let a=sv(lv());p({type:`draft_open`,draft:a}),p({type:`layout_drop`,tabId:a.id,target:{groupId:i??n.focused,zone:e}})},moveTabToOtherGroup(e){let t=m.current.layout,n=iy(t,e),r=n?ly(t,n):null;r&&p({type:`layout_drop`,tabId:e,target:{groupId:r,zone:`center`}})},resizeSplit(e,t){p({type:`layout_resize`,path:e,sizes:t})},equalizeSplit(e){p({type:`layout_equalize`,path:e})},async moveTabToNewWindow(e,t){let n=typeof window<`u`?window.oonacode:void 0;if(!n?.openTabsInNewWindow||!m.current.tabs.ids.includes(e))return!1;let i=Ke(e),a=null;try{a=await n.openTabsInNewWindow({tabs:[i],screenX:t?.x??null,screenY:t?.y??null})}catch{a=null}return a?(qe(e),!0):(r(`error`,`OonaCode could not open a new window for this chat`),!1)},async moveTabToMainWindow(e){let t=typeof window<`u`?window.oonacode:void 0;if(!t?.moveTabsToMainWindow||m.current.windowRole!==`popout`||!m.current.tabs.ids.includes(e))return!1;let n=!1;try{n=await t.moveTabsToMainWindow([Ke(e)])}catch{n=!1}return n?qe(e):r(`error`,`The main OonaCode window could not take this chat`),n},adoptTab:V,async tabDraggedOut(e,t){let n=typeof window<`u`?window.oonacode:void 0;if(!(!n?.tabDragEnded||!m.current.tabs.ids.includes(e)))try{(await n.tabDragEnded({tab:Ke(e),...t})).outcome===`moved`&&qe(e)}catch{}},toggleSidebarPinned(){let e=m.current;if(!e.prefs.leftPanelOpen){let t=Nb(e.prefs.leftPanelSection,!0);e.windowRole===`popout`?(p({type:`sidebar_pinned_override`,pinned:!0}),Le(t)):Le({...t,sidebarPinned:!0});return}if(e.windowRole===`popout`){let t=e.ui.sidebarPinnedOverride??e.prefs.sidebarPinned;p({type:`sidebar_pinned_override`,pinned:!t});return}Le({sidebarPinned:!e.prefs.sidebarPinned})},newTab:We,createSession:Ue,reportDiagnostic(e,t){b.current?.(Error(e),{source:`diagnostic`,...t})},async deleteSession(n){if(l(n)){p({type:`close_tab`,id:n});return}try{await e.deleteSession(n),t.unsubscribe(n),p({type:`session_removed`,id:n}),Be(`chat`,n,!1)}catch(e){i(e,`Delete`)}},async deleteRemoteSession(n,r){try{if(!e.deleteHostSession)throw Error(`this PC is running an older OonaCode that cannot delete a chat on another device`);await e.deleteHostSession(n,r),t.unsubscribe(r),p({type:`session_removed`,id:r})}catch(e){i(e,`Delete`)}},async renameRemoteSession(e,t,n){await Ae(e,t,dv(n))},async renameSession(t,n){let r=De(t)?.hostId??m.current.remote.sessionOwners[t]??m.current.prefs.remoteTabs[t]??null;if(r){await Ae(r,t,dv(n));return}try{p({type:`session_upsert`,session:await e.updateSession(t,{title:n})})}catch(e){i(e,`Rename`)}},refreshVaultProjects:d,async createVaultProject(t){try{let n=await e.createVaultProject(t);return await d(),n}catch(e){return i(e,`Project`),null}},async updateVaultProject(t,n){try{let r=await e.updateVaultProject(t,n);return await d(),r}catch(e){return i(e,`Project`),null}},async listScheduledTasks(t){if(!e.listScheduledTasks)return[];try{return(await e.listScheduledTasks(t)).tasks}catch{return[]}},async updateScheduledTask(t,n){if(!e.updateScheduledTask)return!1;try{return await e.updateScheduledTask(t,n),!0}catch(e){return i(e,`Scheduled task`),!1}},async githubLink(t){let n=t===`get`?e.getGithubLink:t===`start`?e.startGithubLink:t===`cancel`?e.cancelGithubLink:e.unlinkGithub;if(!n)return null;try{return await n.call(e)}catch(e){return t!==`get`&&i(e,`GitHub`),null}},async deleteScheduledTask(t){if(!e.deleteScheduledTask)return!1;try{return await e.deleteScheduledTask(t),!0}catch(e){return i(e,`Scheduled task`),!1}},listConversations:e=>z(e),async refreshChatConversations(e){if(l(e)||m.current.remote.tabs[e])return;let t=await z({sessionId:e});Array.isArray(t)&&p({type:`chat_conversations`,sessionId:e,conversations:t})},async conversationHistory(t){if(!e.getConversation)return null;try{return await e.getConversation(t)}catch(e){return e instanceof sg&&e.isUnauthorized&&y.current?.(),null}},async conversationAction(t,n,r){if(!e.conversationAction)return a(`manage conversations`),null;try{return(await e.conversationAction(t,n,r)).conversation}catch(e){return i(e,`Conversation`),null}},async stopAllConversations(){if(!e.stopAllConversations)return a(`stop conversations`),null;try{let t=await e.stopAllConversations();return r(`success`,t.paused===0&&t.interrupted===0?`No conversation was running.`:`Paused ${t.paused} conversation${t.paused===1?``:`s`}`+(t.interrupted>0?` and stopped ${t.interrupted} running turn${t.interrupted===1?``:`s`}.`:`.`)),t}catch(e){return i(e,`Stop all conversations`),null}},async cancelChatMessage(t){if(!e.cancelChatMessage)return a(`withdraw messages between chats`),!1;try{let{cancelled:n}=await e.cancelChatMessage(t);return n||r(`info`,`That message was already delivered, so it stays.`),n}catch(e){return i(e,`Withdraw message`),!1}},openConversations(e){p({type:`conversations_select`,conversationId:e??null}),p({type:`dialog`,dialog:`conversations`})},async listChatAbouts(){if(!e.listChatAbouts)return`unsupported`;try{return await e.listChatAbouts()}catch(e){return e instanceof sg&&e.isUnauthorized&&y.current?.(),dg(e)?`unsupported`:null}},async listCommands(t){if(m.current.remote.tabs[t])return`unsupported`;let n=s(t);try{return n?e.listCommands?await e.listCommands(n.projectDir?{cwd:n.projectDir}:{}):`unsupported`:e.listSessionCommands?await e.listSessionCommands(t):`unsupported`}catch(e){return e instanceof sg&&e.isUnauthorized&&y.current?.(),dg(e)?`unsupported`:null}},async listSkills(){if(!e.listSkills)return`unsupported`;try{return await e.listSkills()}catch(e){return e instanceof sg&&e.isUnauthorized&&y.current?.(),dg(e)?`unsupported`:null}},async removeSkill(t){if(!e.deleteSkill)return a(`remove a skill`),!1;try{return(await e.deleteSkill(t)).removed}catch(e){return i(e,`Remove skill`),!1}},async scanClaudeSkills(){if(!e.scanClaudeSkills)return a(`import skills`),null;try{return await e.scanClaudeSkills()}catch(e){return i(e,`Skills in Claude Code`),null}},async importClaudeSkills(t,n){if(!e.importClaudeSkills)return a(`import skills`),null;try{return await e.importClaudeSkills({keys:t,...n?{overwrite:!0}:{}})}catch(e){return i(e,`Import skills`),null}},async getChatAbout(t){if(l(t)||m.current.remote.tabs[t]||!e.getChatAbout)return`unsupported`;try{return await e.getChatAbout(t)}catch(e){return e instanceof sg&&e.isUnauthorized&&y.current?.(),dg(e)?`unsupported`:null}},async updateChatAbout(t,n){if(!e.updateChatAbout)return a(`edit a chat’s about`),null;let r=n?.trim()??``;try{return await e.updateChatAbout(t,{about:r===``?null:r})}catch(e){return i(e,`About`),null}},async regenerateChatAbout(t){if(!e.regenerateChatAbout)return{ok:!1,error:`OonaCode on this PC is too old to write abouts. Update it first.`,about:null};try{let n=await e.regenerateChatAbout(t);return{ok:n.ok,error:n.ok?null:n.error??`The about could not be written.`,about:n.about}}catch(e){return e instanceof sg&&e.isUnauthorized&&y.current?.(),{ok:!1,error:ov(e),about:null}}},async generateAllChatAbouts(){if(!e.generateAllChatAbouts)return a(`write abouts for every chat`),null;try{return await e.generateAllChatAbouts()}catch(e){return i(e,`Generate for all chats`),null}},async stopGenerateAllChatAbouts(){if(!e.stopGenerateAllChatAbouts)return a(`stop writing abouts`),null;try{return await e.stopGenerateAllChatAbouts()}catch(e){return i(e,`Stop generating abouts`),null}},openChatAbouts(){p({type:`dialog`,dialog:`chat-abouts`})},async listNextPrompts(){if(!e.listNextPrompts)return`unsupported`;try{return await e.listNextPrompts()}catch(e){return e instanceof sg&&e.isUnauthorized&&y.current?.(),dg(e)?`unsupported`:null}},async getNextPrompt(t){if(!e.getNextPrompt||m.current.remote.tabs[t])return`unsupported`;try{return await e.getNextPrompt(t)}catch(e){return e instanceof sg&&e.isUnauthorized&&y.current?.(),dg(e)?`unsupported`:null}},async suggestNextPrompt(t,n){let r={error:`OonaCode on this PC is too old for Suggest. Update it, then try again.`};if(!e.suggestNextPrompt)return r;try{return await e.suggestNextPrompt(t,n)}catch(e){return e instanceof sg&&e.isUnauthorized&&y.current?.(),dg(e)?r:{error:ov(e)}}},async reviewNextPrompts(t,n){if(!e.reviewNextPrompts)return r(`error`,`OonaCode on this PC is too old for the project manager — update it`),null;try{return(await e.reviewNextPrompts({sessionIds:t,...n===void 0?{}:{windowHours:n}})).review}catch(e){return i(e,`Review chats`),null}},async stopNextPromptReview(){if(!e.stopNextPromptReview)return null;try{return(await e.stopNextPromptReview()).review}catch(e){return i(e,`Stop the review`),null}},async markNextPromptSent(t,n,r){if(!e.markNextPromptSent)return!1;try{return await e.markNextPromptSent(t,{suggestionId:n,text:r}),!0}catch{return!1}},async sendToChat(t,n){let r=m.current;if(r.tabs.ids.includes(t)||r.remote.tabs[t])return this.sendPrompt(n,[],void 0,t);try{return await e.prompt(t,{text:n}),!0}catch(e){return i(e,`Send`),!1}},openProjectManager(){p({type:`dialog`,dialog:`project-manager`})},offerImport(){p({type:`import_offer`}),p({type:`dialog`,dialog:`import-claude`})},async deleteVaultProject(t){try{await e.deleteVaultProject(t),Be(`project`,t,!1);let n=m.current.page;return n?.kind===`project`&&n.projectId===t&&p({type:`page`,page:{kind:`projects`}}),await d(),await u(),!0}catch(e){return i(e,`Project`),!1}},async setSessionProject(t,n){if(l(t)){let e=m.current.drafts[t],r=n?m.current.vaultProjects.find(e=>e.id===n):void 0,i=e?cv({...e,projectId:n},r?.chatDefaults):null;return p({type:`draft_patch`,id:t,patch:i?{projectId:n,model:i.model,providerId:i.providerId,variantId:i.variantId,projectDir:i.projectDir,effort:i.effort??null}:{projectId:n}}),!0}let r=De(t)?.hostId??m.current.remote.sessionOwners[t]??m.current.prefs.remoteTabs[t]??null;try{let i=r&&e.updateHostSession?await e.updateHostSession(r,t,{projectId:n}):await e.updateSession(t,{projectId:n});return p({type:`session_upsert`,session:i}),!0}catch(e){return i(e,`Project`),!1}},openNewProject(){p({type:`projects_new`}),p({type:`dialog`,dialog:`projects`})},openProjectSettings(e){p({type:`projects_select`,projectId:e}),p({type:`dialog`,dialog:`projects`})},openPage(e){p({type:`page`,page:e})},closePage(){p({type:`page`,page:null})},setPinned:Be,openVoiceSummary(e){p({type:`voice_summary_dialog`,sessionId:e})},openAssignProject(e){p({type:`assign_project_dialog`,sessionId:e})},renameTab(t,n){let r=dv(n);if(l(t)){p({type:`draft_patch`,id:t,patch:{title:r}}),De(t)&&Oe(t,{type:`set_title`,sessionId:t,title:r??``});return}let a=De(t)?.hostId??m.current.remote.sessionOwners[t]??m.current.prefs.remoteTabs[t]??null;if(a){Ae(a,t,r);return}(async()=>{try{p({type:`session_upsert`,session:await e.updateSession(t,{title:r??``})})}catch(e){i(e,`Rename`)}})()},async forkSession(t){if(l(t)){let e=De(t)?.hostId;e?await Ge(e):We();return}let n=De(t)?.hostId??m.current.remote.sessionOwners[t]??m.current.prefs.remoteTabs[t]??null;try{if(n&&e.forkHostSession){let r=await e.forkHostSession(n,t);p({type:`session_upsert`,session:r}),await Ie(n,r.id);return}let r=await e.forkSession(t,{});p({type:`session_upsert`,session:r}),Ee(r.id)}catch(e){i(e,`Fork`)}},async removeEntries(t,n,a){if(l(t))return!1;let o=De(t);if(o){if(!o.features?.includes(ze.removeEntries))return r(`error`,`${o.hostName} needs updating before messages can be removed from its chats`),!1;let e=iS();return P.current.set(e,t),Oe(t,{type:`remove_entries`,sessionId:t,uuid:n,mode:a,requestId:e})?!0:(P.current.delete(e),ke(t),!1)}try{await e.removeEntries(t,{uuid:n,mode:a})}catch(e){return e instanceof sg&&[`chat_busy`,`not_found`,`bad_request`].includes(e.code)?(r(`error`,ov(e)),e.code===`not_found`&&Ve(t)):i(e,`Remove messages`),!1}return r(`success`,tS),await Ve(t),!0},reloadTranscript:Ve,async sendPrompt(n,r=[],a,c){let l=c??o();if(!l)return!1;let u=`req-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`,d=(e,t)=>(p({type:`transcript`,sessionId:l,action:{type:`frame`,frame:{type:`error`,sessionId:l,requestId:u,code:e,message:t}}}),p({type:`transcript`,sessionId:l,action:{type:`local_prompt_failed`,requestId:u}}),!1);p({type:`transcript`,sessionId:l,action:{type:`local_prompt`,requestId:u,text:n,attachments:r,at:new Date().toISOString()}}),p({type:`window_trim`,sessionId:l,force:!0});let f=s(l);if(f!==null&&De(l)!==null&&f){f.model&&Oe(l,{type:`set_model`,sessionId:l,model:f.model,...f.providerId?{providerId:f.providerId}:{},...f.variantId===null?{}:{variantId:f.variantId}}),f.permissionMode&&Oe(l,{type:`set_permission_mode`,sessionId:l,mode:f.permissionMode,...f.posture?{posture:f.posture}:{}}),f.title&&Oe(l,{type:`set_title`,sessionId:l,title:f.title}),f.effort&&Te(f.effort)&&Oe(l,{type:`set_effort`,sessionId:l,effort:f.effort});let e=lm(f.toolPacks).toolPacks;e&&De(l)?.features?.includes(ze.toolPacks)&&Oe(l,{type:`set_tool_packs`,sessionId:l,requestId:iS(),toolPacks:e})}else if(f)try{await Je(f)}catch(e){return i(e,`New chat`),d(`session_create_failed`,ov(e))}let h=m.current.pendingRouting[l];if(h&&(a={...a,providerId:h.providerId,model:a?.model??h.model,...h.variantId===void 0?{}:{variantId:h.variantId}}),De(l))return Oe(l,{type:`prompt`,sessionId:l,requestId:u,text:n,...r.length>0?{attachments:r}:{},...a?{options:a}:{}})?!0:(ke(l),d(`host_offline`,`That PC is offline — this transcript is read-only.`));try{t.status===`open`?t.prompt(l,n,{attachments:r,options:a,requestId:u}):await e.prompt(l,{text:n,attachments:r,options:a})}catch(e){return i(e,`Send`),d(`send_failed`,ov(e))}return!0},respondPermission(e,n,i){let a=i??o();if(a&&!l(a)){if(!(De(a)?Oe(a,{type:`permission_response`,sessionId:a,requestId:e,decision:n}):t.respondPermission(a,e,n))){r(`error`,`Not connected to the host — cannot answer the permission request`);return}p({type:`transcript`,sessionId:a,action:{type:`local_permission`,requestId:e,behavior:n.behavior}})}},async cancelQueued(t,n){let a=n??o();if(!(!a||l(a))){if(De(a)){r(`info`,`Withdrawing a queued message is done on the PC that runs the chat`);return}try{(await e.cancelQueued(a,t)).cancelled?p({type:`transcript`,sessionId:a,action:{type:`frame`,frame:{type:`prompt_cancelled`,sessionId:a,requestId:t,text:``}}}):r(`info`,`The agent has already read that message`)}catch(e){i(e,`Withdraw`)}}},async sendQueuedNow(t,n){let r=n??o();if(!r||l(r))return null;if(De(r))return`Send now is done on the PC that runs the chat`;try{return(await e.sendQueuedNow(r,t)).sent?null:Re.alreadyRead}catch(e){return e instanceof sg&&e.code===`not_found`?Re.alreadyRead:e instanceof Error?e.message:String(e)}},async sendQueuedNowAll(t){let n=t??o();if(!n||l(n))return null;if(De(n))return`Send now is done on the PC that runs the chat`;try{return await e.sendQueuedNowAll(n),null}catch(e){return e instanceof sg&&e.code===`not_found`?Re.allRead:e instanceof Error?e.message:String(e)}},async interrupt(n){let r=n??o();if(r&&!l(r)){if(De(r)){Oe(r,{type:`interrupt`,sessionId:r})||ke(r);return}if(!t.interrupt(r))try{await e.interrupt(r)}catch(e){i(e,`Interrupt`)}}},setSessionModel(e,n,r,i){let a=i??o();if(!a)return;if(n&&ae(n,e,r),s(a)){p({type:`draft_patch`,id:a,patch:{model:e,...n?{providerId:n}:{},...r===void 0?{}:{variantId:r},customModel:null}});return}p({type:`transcript`,sessionId:a,action:{type:`model_picked`}});let c=m.current.sessions.find(e=>e.id===a),l=m.current.transcripts[a]?.session??c,u=m.current.transcripts[a]?.session?.model??c?.model??null,d=m.current.pendingRouting[a],f=d!==void 0||n!==void 0&&(l===void 0||n!==(l.providerId??null))||r!==void 0&&l!==void 0&&(r??null)!==(l.variantId??null);f?p({type:`pending_routing`,sessionId:a,routing:{providerId:n??d?.providerId??l?.providerId??``,model:e,...r===void 0?{}:{variantId:r}}}):De(a)?Oe(a,{type:`set_model`,sessionId:a,model:e}):t.setModel(a,e);let h=ng(n??l?.providerId??null,e);if(u!==e&&!h&&p({type:`model_boundary`,sessionId:a,boundary:{index:m.current.transcripts[a]?.items.length??0,from:u,to:e}}),c&&h){if(!f&&!c.autoModel){let{customModel:e,...t}=c;p({type:`session_upsert`,session:{...t,autoModel:{model:null}}})}}else if(c){let{customModel:t,autoModel:i,...a}=c;p({type:`session_upsert`,session:{...a,model:e,...n?{providerId:n}:{},...r===void 0?{}:{variantId:r}}})}},async setSessionCustomModel(t,n,a){let c=n??o();if(!c)return!1;let l=s(c);if(l){let e=m.current,n=Sm(e.providers,{providerId:l.providerId??e.activeProviderId,model:l.model??e.info?.activeModel??null,variantId:l.variantId}),r=a?Vh(t,a):Bh(t,{providerId:n.providerId,variantId:n.variantId},e.providers.map(e=>e.definition.id));return p({type:`draft_patch`,id:c,patch:{...r,customModel:{previous:l.customModel?.previous??{providerId:n.providerId,variantId:n.variantId,model:n.modelId}}}}),!0}let u=De(c);if(u){if(!u.features?.includes(ze.customModel))return r(`error`,`OonaCode on ${u.hostName} is too old to set a model typed by hand from here — update it first.`),!1;let e=oS(m.current,c),n=e?.model??null;if(!Oe(c,{type:`set_custom_model`,sessionId:c,customModel:t,...a?{customModelProvider:a}:{}}))return ke(c),!1;if(m.current.pendingRouting[c]!==void 0&&p({type:`pending_routing`,sessionId:c,routing:null}),p({type:`transcript`,sessionId:c,action:{type:`model_picked`}}),e){let{customModel:r,autoModel:i,...o}=e,s={...o,model:t,customModel:!0,...a?{providerId:a.providerId}:{},...a&&a.variantId!==void 0?{variantId:a.variantId}:{}};n!==t&&p({type:`model_boundary`,sessionId:c,boundary:{index:m.current.transcripts[c]?.items.length??0,from:n,to:t}}),p({type:`session_upsert`,session:s})}return!0}try{let n=oS(m.current,c),r=await e.updateSession(c,{customModel:t,...a?{customModelProvider:a}:{}});m.current.pendingRouting[c]!==void 0&&p({type:`pending_routing`,sessionId:c,routing:null}),p({type:`transcript`,sessionId:c,action:{type:`model_picked`}});let i=n?.model??null;return i!==r.model&&r.model&&p({type:`model_boundary`,sessionId:c,boundary:{index:m.current.transcripts[c]?.items.length??0,from:i,to:r.model}}),p({type:`session_upsert`,session:r}),!0}catch(e){return i(e,`Model`),!1}},setSessionPosture(e,n){let r=n??o();if(!r)return;let i=ee(e);if(l(r)){p({type:`draft_patch`,id:r,patch:{permissionMode:i,posture:e}});return}De(r)?Oe(r,{type:`set_permission_mode`,sessionId:r,mode:i,posture:e}):t.setPermissionMode(r,i,e);let a=m.current.sessions.find(e=>e.id===r);a&&p({type:`session_upsert`,session:{...a,permissionMode:i,posture:e}})},setSessionEffort(e,n){let r=n??o();if(!r||l(r))return;De(r)?Oe(r,{type:`set_effort`,sessionId:r,effort:e}):t.setEffort(r,e);let i=m.current.sessions.find(e=>e.id===r);if(i){let{effort:t,...n}=i;p({type:`session_upsert`,session:e?{...n,effort:e}:n})}},async setReach(e,t){let n=De(e),i=A.current.get(e);if(!n||!i?.setReach)return!1;if(!n.features?.includes(ze.reach))return r(`error`,`OonaCode on ${n.hostName} is too old to use this PC's files — update it first.`),!1;if(!n.live)return ke(e),!1;if(!i.setReach(t))return r(`error`,`Not connected to the host.`),!1;if(t&&t.length>0){let t=l(e)?s(e)?.toolPacks:oS(m.current,e)?.toolPacks;t?.reach!==!0&&I.setSessionToolPacks(e,sm(t,jd,!0))}return!0},answerReach(e,t,n){A.current.get(e)?.answerReach?.(t,n),p({type:`remote_reach`,sessionId:e,event:{kind:`ask_end`,requestId:t}})},async setSessionToolPacks(t,n){if(l(t))return p({type:`draft_patch`,id:t,patch:{toolPacks:{...n}}}),!0;let a=De(t);if(a){if(!a.features?.includes(ze.toolPacks))return r(`error`,`OonaCode on ${a.hostName} is too old to change this chat's tools from here — update it first.`),!1;let e=oS(m.current,t),i=e?.toolPacks;if(e&&p({type:`session_upsert`,session:{...e,toolPacks:n}}),!Oe(t,{type:`set_tool_packs`,sessionId:t,requestId:iS(),toolPacks:n})){if(e){let{toolPacks:t,...n}=e;p({type:`session_upsert`,session:i?{...n,toolPacks:i}:n})}return ke(t),!1}return!0}let o=(T.current.get(t)??0)+1;T.current.set(t,o);let s=oS(m.current,t),c=s?.toolPacks;s&&p({type:`session_upsert`,session:{...s,toolPacks:n}});try{let r=await e.updateSession(t,{toolPacks:n});return T.current.get(t)===o&&p({type:`session_upsert`,session:r}),!0}catch(e){if(T.current.get(t)===o){let e=oS(m.current,t);if(e){let{toolPacks:t,...n}=e;p({type:`session_upsert`,session:c?{...n,toolPacks:c}:n})}}return i(e,`Tools`),!1}},async setSessionMedia(t,n){if(l(t))return p({type:`draft_patch`,id:t,patch:{media:{...n}}}),!0;if(De(t))return!1;let r=(E.current.get(t)??0)+1;E.current.set(t,r);let a=oS(m.current,t),o=a?.media;if(a){let{media:e,...t}=a,r=dd(n);p({type:`session_upsert`,session:r?{...t,media:r}:t})}try{let i=await e.updateSession(t,{media:n});return E.current.get(t)===r&&p({type:`session_upsert`,session:i}),!0}catch(e){if(E.current.get(t)===r){let e=oS(m.current,t);if(e){let{media:t,...n}=e;p({type:`session_upsert`,session:o?{...n,media:o}:n})}}return i(e,`Tools`),!1}},async setSessionMcpSwitches(t,n){if(l(t))return p({type:`draft_patch`,id:t,patch:{mcpSwitches:{...n}}}),!0;let a=De(t);if(a)return r(`error`,`This chat runs on ${a.hostName} — switch its MCP servers in OonaCode on that PC.`),!1;let o=(D.current.get(t)??0)+1;D.current.set(t,o);let s=oS(m.current,t),c=s?.mcpSwitches;s&&p({type:`session_upsert`,session:{...s,mcpSwitches:n}});try{let r=await e.updateSession(t,{mcpSwitches:n});return D.current.get(t)===o&&p({type:`session_upsert`,session:r}),!0}catch(e){if(D.current.get(t)===o){let e=oS(m.current,t);if(e){let{mcpSwitches:t,...n}=e;p({type:`session_upsert`,session:c?{...n,mcpSwitches:c}:n})}}return i(e,`MCP`),!1}},async setSessionModelSkills(t,n){let a=[...n];if(l(t))return p({type:`draft_patch`,id:t,patch:{modelSkills:a}}),!0;let o=De(t);if(o)return r(`error`,`This chat runs on ${o.hostName} — switch its skills in OonaCode on that PC.`),!1;let s=(O.current.get(t)??0)+1;O.current.set(t,s);let c=oS(m.current,t),u=c?.modelSkills;c&&p({type:`session_upsert`,session:{...c,modelSkills:a}});try{let n=await e.updateSession(t,{modelSkills:a});return O.current.get(t)===s&&p({type:`session_upsert`,session:n}),!0}catch(e){if(O.current.get(t)===s){let e=oS(m.current,t);if(e){let{modelSkills:t,...n}=e;p({type:`session_upsert`,session:u?{...n,modelSkills:u}:n})}}return i(e,`Skills`),!1}},async listChatSkills(t){if(m.current.remote.tabs[t])return`unsupported`;let n=s(t);try{return n?e.listChatSkills?await e.listChatSkills(n.projectDir?{cwd:n.projectDir}:{}):`unsupported`:e.listSessionChatSkills?await e.listSessionChatSkills(t):`unsupported`}catch(e){return e instanceof sg&&e.isUnauthorized&&y.current?.(),dg(e)?`unsupported`:null}},setActiveProvider:ae,async inspectProject(t){let n=o(),r=n===null?null:De(n)?.hostId??m.current.remote.sessionOwners[n]??null;if(r&&e.inspectHostProject)try{return await e.inspectHostProject(r,t)}catch(e){return dg(e)||(e instanceof sg&&e.isUnauthorized?y.current?.():i(e,`Folder`)),null}if(!e.inspectProject)return null;try{return await e.inspectProject({dir:t})}catch(e){return dg(e)||(e instanceof sg&&e.isUnauthorized?y.current?.():i(e,`Folder`)),null}},async attachProject(t,n){let c=n??o();if(!c)return!1;if(s(c))return p({type:`draft_patch`,id:c,patch:{projectDir:t}}),!0;let l=De(c),u=l?.hostId??m.current.remote.sessionOwners[c]??null;if(u&&e.updateHostSession)try{let n=await e.updateHostSession(u,c,{projectDir:t});return p({type:`session_upsert`,session:n}),r(`success`,`Switched to ${n.cwd} — the engine restarts on your next message.`),!0}catch(e){return i(e,`Folder`),!1}if(l)return r(`error`,`This chat runs on ${l.hostName} — choose its project folder in OonaCode on that PC.`),!1;if(!e.attachSessionProject)return a(`open a chat in one of your project folders`),!1;try{let n=await e.attachSessionProject(c,{dir:t});return p({type:`session_upsert`,session:n.session}),f(),r(`success`,n.appliesOnNextMessage?`Switched to ${n.session.cwd} — the turn in progress finishes where it started, and your next message runs there with that project's CLAUDE.md and settings`:n.restarted?`Switched to ${n.session.cwd} — this chat restarts with that project's CLAUDE.md and settings loaded, and continues where it left off`:`Switched to ${n.session.cwd} — the next message loads that project's CLAUDE.md and settings`),!0}catch(e){return dg(e)?a(`open a chat in one of your project folders`):i(e,`Project folder`),!1}},async saveSettings(t){try{p({type:`settings`,settings:await e.updateSettings(t)}),r(`success`,`Settings saved`)}catch(e){i(e,`Settings`)}},savePrefs:Le,growTranscript(e,t){p({type:`window_grow`,sessionId:e,total:t})},revealTranscript(e,t,n,r){p({type:`window_reveal`,sessionId:e,rendered:t,total:n,...r?{hold:!0}:{}})},trimTranscript(e,t){p({type:`window_trim`,sessionId:e,...t?{force:!0}:{}})},hydrateSession:B,async catchUpEntries(t){if(l(t))return;let n=De(t);if(n){await je(n.hostId,t);return}let r=m.current.transcripts[t],i=r?.lastSeq??void 0;if(i===void 0&&r?.hydrated){try{await B(t)}catch(e){e instanceof sg&&e.isUnauthorized&&y.current?.()}return}for(let n=0;n<200;n++){let n;try{n=await e.listEntries(t,{limit:500,...i===void 0?{}:{afterSeq:i}})}catch(e){e instanceof sg&&e.isUnauthorized&&y.current?.();return}if(n.entries.length>0&&p({type:`transcript`,sessionId:t,action:{type:`entries`,entries:n.entries}}),n.nextSeq===null||n.nextSeq===i)return;i=n.nextSeq}},checkUpdates:et,async installUpdate(){if(h.current)return;h.current=!0;let e=typeof window<`u`?window.oonacode:void 0,t=m.current,n=Ix(t.update.components.map(e=>e.component),Fx(e),{checked:t.update.version!==``,shellEngaged:t.updateInstall.phase!==`idle`&&t.updateInstall.phase!==`checking`});if(n.upToDate){r(`success`,`Everything is up to date`),h.current=!1;return}let i=n.desktop;if(n.terminal&&e?.updateTerminalInstall){p({type:`terminal_update`,terminal:{running:!0,message:``,failed:!1}});try{let t=await e.updateTerminalInstall();if(p({type:`terminal_update`,terminal:{running:!1,message:t.message,failed:!t.ok}}),!t.ok){r(`error`,t.message),h.current=!1;return}if(t.handedOver){r(`info`,t.message);return}t.absent?e.installUpdate&&(i=!0):(r(`success`,t.message),await ve(),await et(!1))}catch(e){let t=ov(e);p({type:`terminal_update`,terminal:{running:!1,message:t,failed:!0}}),r(`error`,`Updating the CLI and host service failed: ${t}`),h.current=!1;return}}if(!i){n.manual.length>0&&r(`info`,`This window cannot install `+n.manual.map(e=>hx[e]).join(`, `)+" — run the installer from the website, or `oona update` in a terminal"),h.current=!1;return}if(!e?.installUpdate){r(`info`,"This window cannot install the app itself — run the installer again, or `oona update` in a terminal"),h.current=!1;return}try{let t=await e.installUpdate();r(t.started?`info`:`error`,t.message),t.started||(h.current=!1)}catch(e){r(`error`,`Update failed: ${ov(e)}`),h.current=!1}},dismissUpdate(){let e=m.current.update.version||null;p({type:`update_dismissed`,version:e}),Le({dismissedUpdateVersion:e}),p({type:`dialog`,dialog:`none`})},async login(t){try{return p({type:`account`,account:await e.login(t)}),r(`success`,t.register?`Account created`:`Logged in`),ce(),g(),xe(),`ok`}catch(e){let n=Zee(e,{email:t.email,registered:t.register===!0});return n?(p({type:`email_verification`,pending:n}),`verification_pending`):(i(e,`Login`),`failed`)}},async startAccountLink(){if(!e.startAccountLink)return a(`sign in through your browser`),null;try{let t=await e.startAccountLink({clientKind:hS()});return p({type:`account_link`,link:t}),t.status===`error`&&r(`error`,t.message??`Could not start the sign-in`),t}catch(e){return dg(e)?a(`sign in through your browser`):i(e,`Sign in`),null}},async refreshAccountLink(){if(e.accountLinkStatus)try{let t=await e.accountLinkStatus();p({type:`account_link`,link:t}),t.status===`approved`&&(se(),ce(),g())}catch(e){dg(e)||i(e,`Sign in`)}},async cancelAccountLink(){if(!e.cancelAccountLink){p({type:`account_link`,link:{status:`idle`}});return}try{p({type:`account_link`,link:await e.cancelAccountLink()})}catch(e){p({type:`account_link`,link:{status:`idle`}}),dg(e)||i(e,`Sign in`)}},async resendVerification(){let t=m.current.emailVerification;if(!t)return!1;try{let n=await e.resendVerification({email:t.email});return p({type:`email_verification`,pending:{...t,verification:`pending`,resendAt:mg(n.resendAfterSec,Date.now())}}),r(`success`,`Confirmation link sent to ${t.displayEmail}`),!0}catch(e){return dg(e)?r(`error`,`This host build cannot resend the link yet — use "Resend" on the website sign-in page`):i(e,`Resend link`),!1}},dismissEmailVerification(){p({type:`email_verification`,pending:null})},async logout(){try{p({type:`account`,account:await e.logout()}),p({type:`credentials`,credentials:[]})}catch(e){i(e,`Logout`)}},async remoteUnlockHost(t,n){try{let i=await e.remoteUnlockHost(t,n);return i.ok?(r(`info`,`Device unlocked — its sessions are available again.`),xe(),!0):(r(`error`,i.error===`host_too_old`?`That PC runs an older OonaCode — update it first.`:i.error===`wrong_keys`?`Wrong password — the device stays locked.`:`Could not unlock: `+(i.error??`unknown`)),!1)}catch(e){return r(`error`,ov(e)),!1}},async lockDevice(){try{let t=await e.lock();p({type:`account`,account:t})}catch(e){r(`error`,ov(e))}},async unlock(t,n={}){try{return p({type:`account`,account:await e.unlock({password:t,...n.keepUnlocked===void 0?{}:{keepUnlocked:n.keepUnlocked}})}),ce(),!0}catch(e){if(!n.onError)return i(e,`Unlock`),!1;let t=e instanceof sg&&e.isUnauthorized&&!_S(e);return t&&y.current?.(),n.onError(e instanceof sg&&_S(e)?`Wrong password — the vault stays locked.`:t?`Reconnecting to the OonaCode host — press Unlock again in a moment.`:`Could not unlock: ${ov(e)}`),e instanceof sg&&e.isUnauthorized||b.current?.(e,{source:`action`,action:`Unlock`}),!1}},async completeVaultRekey(t){if(!e.completeVaultRekey)return a(`finish a password reset`),!1;try{let n=await e.completeVaultRekey({password:t});return p({type:`account`,account:n.account}),p({type:`recovery_key`,recoveryKey:{code:n.recoveryCode,devicesSignedOut:n.devicesSignedOut,warning:n.warning??null}}),r(n.warning?`info`:`success`,n.warning?`Vault moved to your new password — with a warning, see your Recovery Key below`:`Vault moved to your new password`),ce(),g(),!0}catch(e){return dg(e)?a(`finish a password reset`):i(e,`Move vault`),!1}},async revokeVaultRekey(t){if(!e.revokeVaultRekey)return a(`abandon a password reset`),!1;try{let n=await e.revokeVaultRekey({acknowledgeDataLoss:sc,password:t});return p({type:`account`,account:n.account}),p({type:`credentials`,credentials:[]}),r(`info`,`Vault discarded — every saved key is gone; your chats are untouched. Unlock with your new password to start a fresh vault.`),!0}catch(e){return dg(e)?a(`abandon a password reset`):i(e,`Discard vault`),!1}},dismissRecoveryKey(){p({type:`recovery_key`,recoveryKey:null})},async setDeviceUnlock(t,n){if(!e.setDeviceUnlock)return a(`keep itself unlocked`),!1;try{let i=await e.setDeviceUnlock({enabled:t,...n?{password:n}:{}});return p({type:`account`,account:i}),r(`success`,t?`This PC will stay unlocked after a restart`:`This PC will ask for your password after a restart`),!0}catch(e){return dg(e)?a(`keep itself unlocked`):i(e,`Keep me unlocked`),!1}},async probeCredential(t,n){try{let r=await e.probeCredential(t,n);return{ok:r.ok,...r.error?{error:r.error}:{}}}catch(e){return{ok:!1,error:ov(e)}}},async addCredential(t){try{return await e.addCredential(t),r(`success`,`Credential saved to your vault`),await ce(),g(),!0}catch(e){return i(e,`Add credential`),!1}},async deleteCredential(t){try{await e.deleteCredential(t),r(`info`,`Credential revoked on all devices`),await ce(),g()}catch(e){i(e,`Revoke`)}},async testCredential(t){try{let n=await e.testCredential(t);r(n.ok?`success`:`error`,n.ok?`Credential works (${n.latencyMs??`?`} ms)`:`Test failed: ${n.error??`unknown error`}`)}catch(e){i(e,`Test`)}},async testProvider(t){try{let n=await e.testProvider(t);r(n.ok?`success`:`error`,n.ok?`${t} reachable (${n.latencyMs??`?`} ms)`:`${t}: ${n.error??`test failed`}`),g()}catch(e){i(e,`Test`)}},async syncNow(){try{let t=await e.syncNow();r(t.ok?`success`:`error`,t.ok?`Vault synced (rev ${t.rev??`?`})`:`Sync failed: ${t.error??`unknown`}`),se(),ce()}catch(e){i(e,`Sync`)}},toast:r,dismissToast(e){p({type:`dismiss_toast`,id:e})},openDialog(e,t){p({type:`dialog`,dialog:e,connectProviderId:t??null})},openProviderConnect(e){p({type:`connect_provider`,providerId:e})},openSettings(e){p({type:`settings_section`,section:e}),p({type:`dialog`,dialog:`settings`})},openClaudeLogin(e){p({type:`claude_login_mode`,mode:e}),p({type:`connect_provider`,providerId:null}),p({type:`dialog`,dialog:`claude-login`})},openOauthLogin(e){p({type:`connect_provider`,providerId:null}),p({type:`dialog`,dialog:`oauth-login`}),p({type:`oauth_login_provider`,providerId:e})},setSidebar(e){p({type:`sidebar`,open:e})},setMediaPanel(e){I.setRightSection(`media`,e)},setRightSection(e,t){let{rightPanelSections:n,rightPanelCollapsed:r}=m.current.prefs,i=t?Mb(n,r,e):{sections:n.filter(t=>t!==e),collapsed:r};Le(jb(i.sections,i.collapsed))},showLeftSection(e){if(typeof window<`u`&&typeof window.matchMedia==`function`&&!window.matchMedia(`(min-width: 768px)`).matches){let{leftPanelSection:t,explorerOpen:n}=Nb(e,m.current.prefs.leftPanelOpen);Le({leftPanelSection:t,explorerOpen:n}),p({type:`sidebar`,open:!0});return}Le(Nb(e,!0))},async searchSessionNames(t){let n=t.trim();if(!n)return[];try{return(await e.listSessions({search:n,limit:200})).sessions}catch(e){return i(e,`Search`),null}},setDirtyFiles(e,t){p({type:`files_dirty`,sessionId:e,paths:t})},openFile(e,t){let n=t??m.current.currentSessionId;n&&p({type:`file_open`,sessionId:n,path:e})},closeFile(e,t){let n=t??m.current.currentSessionId;n&&p({type:`file_close`,sessionId:n,path:e})},activateFile(e,t){let n=t??m.current.currentSessionId;n&&p({type:`file_activate`,sessionId:n,path:e})},showChat(e){let t=e??m.current.currentSessionId;t&&p({type:`file_show_chat`,sessionId:t})}}},[e,t,n]);(0,v.useEffect)(()=>{let e=pte(x.current);e&&p({type:`prefs`,prefs:e})},[]),(0,v.useEffect)(()=>{let e=!1,n=t.onStatus((t,n)=>{p({type:`connection`,status:t,detail:n??null}),t===`unauthorized`&&y.current?.(),t===`open`&&e&&(I.refreshInfo(),I.refreshVaultProjects(),I.refreshAgentTools(),I.refreshMcpServers(),p({type:`conversations_changed`,conversationIds:null,sessionIds:null}),p({type:`chat_abouts_changed`,sessionIds:null}),p({type:`next_prompts_changed`,sessionIds:null})),t===`open`&&(e=!0)}),r=(e,t)=>{zx(e,m.current.prefs)&&(t.sessionId&&m.current.elsewhere[t.sessionId]||Vx(Bx(e,t),Hx()))},i=e=>{let t=m.current.transcripts[e]?.session??m.current.sessions.find(t=>t.id===e);return t?av(t):`OonaCode session`},a=e=>{let n=Date.now(),a=e.type===`session_state`?oS(m.current,e.session.id):void 0;for(let t of eS(e,n))p(t);if(e.type===`session_state`&&rx(a,e.session)&&I.refreshPlanSoon(),e.type===`transcript_changed`&&I.reloadTranscript(e.sessionId),e.type===`permission_request`){let t=`${e.sessionId}:${e.request.requestId}`;if(k.current.has(t)||(k.current.size>=Wx&&k.current.clear(),k.current.add(t),e.settled===!0))return;r(`permissionRequired`,{sessionTitle:i(e.sessionId),toolName:e.request.toolName,sessionId:e.sessionId})}else if(e.type===`turn_finished`)r(`agentFinished`,{sessionTitle:i(e.sessionId),isError:e.result.isError,sessionId:e.sessionId});else if(e.type===`error`)r(`errorOccurred`,{sessionTitle:e.sessionId?i(e.sessionId):`OonaCode`,detail:e.code,...e.sessionId?{sessionId:e.sessionId}:{}});else if(e.type===`scheduled_tasks_changed`)p({type:`scheduled_tasks_changed`});else if(e.type===`new_chat_started`)oS(m.current,e.newSessionId)||p({type:`session_upsert`,session:e.session}),e.answeredBy!==null&&e.answeredBy===t.clientId&&p({type:`select_session`,id:e.newSessionId,near:e.sessionId});else if(e.type===`session_list_changed`)I.refreshSessions(),e.reason===`deleted`&&(p({type:`session_removed`,id:e.sessionId}),I.setPinned(`chat`,e.sessionId,!1));else if(e.type===`account_changed`&&e.reason===`agent_tools`)I.refreshAgentTools(),I.refreshMcpServers();else if(e.type===`account_changed`)I.refreshAccount(),I.refreshPlan(),I.refreshProviders(),I.refreshAgentTools(),I.refreshMcpServers(),I.refreshInfo(),e.reason!==`provider`&&I.refreshCredentials(),e.reason!==`provider`&&(I.refreshHosts(),I.refreshClaudeSubscription(),I.refreshVaultProjects());else if(e.type===`welcome`){I.refreshSessions();for(let e of cy(m.current.layout))I.catchUpEntries(e)}},o=fg({isStreamFrame:Qx,deliver:e=>{for(let t of e)a(t)},batchMs:c,isHidden:$x}),s=t.onAny(e=>o.push(e)),l=()=>{$x()||o.flush()};return typeof document<`u`&&document.addEventListener(`visibilitychange`,l),t.connect(),()=>{n(),s(),typeof document<`u`&&document.removeEventListener(`visibilitychange`,l),o.dispose(),t.close()}},[t,I,c]),(0,v.useEffect)(()=>{if(typeof window>`u`||typeof document>`u`)return;let e=()=>I.refreshPlanSoon(),t=()=>{document.visibilityState===`visible`&&I.refreshPlanSoon()};return window.addEventListener(`focus`,e),document.addEventListener(`visibilitychange`,t),()=>{window.removeEventListener(`focus`,e),document.removeEventListener(`visibilitychange`,t)}},[I]),(0,v.useEffect)(()=>{I.refreshInfo(),I.refreshPlan(),I.refreshSessions(),I.refreshProjects(),I.refreshProviders(),I.refreshAgentTools(),I.refreshMcpServers(),I.refreshSettings(),I.refreshAccount(),I.refreshCredentials(),I.refreshHosts()},[I]),(0,v.useEffect)(()=>{r&&p({type:`select_session`,id:r})},[r]);let[re,ie]=(0,v.useState)(()=>typeof window<`u`&&window.oonacode?.getWindowInit?void 0:null);(0,v.useEffect)(()=>{let e=typeof window<`u`?window.oonacode:void 0;if(!e?.getWindowInit)return;let t=!0;return e.getWindowInit().then(e=>{t&&ie(e??null)},()=>{t&&ie(null)}),()=>{t=!1}},[]),(0,v.useEffect)(()=>{let e=typeof window<`u`?window.oonacode:void 0;if(e?.onWindowRegistry)return e.onWindowRegistry(e=>p({type:`elsewhere`,owners:e.owners}))},[]),(0,v.useEffect)(()=>{let e=typeof window<`u`?window.oonacode:void 0;if(e?.onAcceptTab)return e.onAcceptTab(e=>{let t=e.x!==null&&e.y!==null&&typeof document<`u`?Tb(document,e.x,e.y):null;I.adoptTab(e.tab,t)})},[I]);let L=f.currentSessionId,R=L?f.drafts[L]:void 0,z=L?oS(f,L)??null:null,ae=R?uv(R):z?av(z):null;(0,v.useEffect)(()=>{typeof document>`u`||(document.title=ae?`${ae} — OonaCode`:`OonaCode`)},[ae]);let oe=f.tabs,se=f.layout,ce=f.drafts,le=f.remote.tabs;(0,v.useEffect)(()=>{let e=typeof window<`u`?window.oonacode:void 0;if(!e?.reportWindowState||(d===`popout`?!xe.current:!fe.current))return;let t={drafts:ce,remoteTabs:le,unsent:{},files:{}};e.reportWindowState({tabs:oe.ids.map(e=>mb(pb(t,e))),layout:By(se),activeId:oe.activeId,title:ae})},[oe,se,ce,le,ae,d]);let ue=(0,v.useRef)(!1),de=f.tabs.ids.length;(0,v.useEffect)(()=>{if(d===`popout`){if(de>0){ue.current=!0;return}!ue.current||typeof window>`u`||window.close()}},[d,de]);let fe=(0,v.useRef)(!1),pe=(0,v.useRef)(!1),me=(0,v.useRef)(null),he=(0,v.useRef)(!0);(0,v.useEffect)(()=>(he.current=!0,()=>{he.current=!1}),[]);let ge=f.sessionListLoaded,_e=f.remote.loaded,ve=f.settings!==null,[ye,be]=(0,v.useState)(!1);(0,v.useEffect)(()=>{if(_e&&ve||ye)return;let e=setTimeout(()=>be(!0),Gx);return()=>clearTimeout(e)},[_e,ve,ye]),(0,v.useEffect)(()=>{if(fe.current||!ge||d===`popout`||re===void 0||!ve||!_e&&!ye)return;fe.current=!0;let t=Hte(f.prefs),n=new Set(f.sessions.map(e=>e.id)),r=Vte(f.prefs).filter(({id:e})=>!n.has(e)).map(({id:e,title:t},n)=>({...sv(e,n),title:t})),i=new Set(r.map(e=>e.id));if(t.ids.length===0)return;let a=Bte(f.prefs),o=t.ids.filter(e=>a[e]!==void 0),s=new Set(re?.heldElsewhere??[]),c=e=>{let n=Rte(t,[...f.sessions.map(e=>e.id),...o,...i,...e].filter(e=>!s.has(e))),c=[...n.ids],l=m.current.currentSessionId;if(l&&!c.includes(l)&&c.push(l),c.length!==0){me.current=m.current.layout,p({type:`restore_tabs`,ids:c,activeId:l??n.activeId,drafts:r.filter(e=>c.includes(e.id)),layout:f.prefs.editorLayout});for(let e of c){let t=a[e];t!==void 0&&I.openRemoteSession(t,e,{focus:!1})}}},l=t.ids.filter(e=>!n.has(e)&&a[e]===void 0&&!i.has(e));if(l.length===0){c([]);return}pe.current=!0,Promise.all(l.map(t=>e.getSession(t).then(()=>t,e=>e instanceof sg&&e.status===404?null:t))).then(e=>{pe.current=!1,he.current&&c(e.filter(e=>e!==null))})},[ge,_e,ye,ve,f.prefs,f.sessions,e,I,d,re]);let xe=(0,v.useRef)(!1);(0,v.useEffect)(()=>{if(d!==`popout`||xe.current||re===void 0||!ge)return;xe.current=!0;let e=re?.tabs??[];if(e.length===0)return;let t=new Set(m.current.sessions.map(e=>e.id));p({type:`restore_tabs`,ids:e.map(e=>e.id),activeId:re?.activeId??e[e.length-1].id,drafts:e.filter(e=>e.draft&&!t.has(e.id)).map(e=>gb(e)),layout:re?.layout??null});for(let n of e){n.kind===`remote`&&n.hostId&&I.openRemoteSession(n.hostId,n.id,{focus:!1,draft:n.draft!==void 0&&!t.has(n.id)}),n.unsentText&&p({type:`unsent`,sessionId:n.id,message:{text:n.unsentText,attachments:[]}});for(let e of n.files?.open??[])p({type:`file_open`,sessionId:n.id,path:e});n.files&&n.files.open.length>0&&(n.files.active?p({type:`file_activate`,sessionId:n.id,path:n.files.active}):p({type:`file_show_chat`,sessionId:n.id}))}},[d,re,ge,I]);let Se=f.tabs,Ce=f.layout,we=f.prefs,Ee=f.remote.tabs,De=f.drafts,Oe=f.settings!==null;(0,v.useEffect)(()=>{if(!Oe||d===`popout`||!fe.current||pe.current)return;if(me.current!==null){if(Ce===me.current)return;me.current=null}let e={};for(let t of Se.ids){let n=Ee[t];n&&(e[t]=n.hostId)}let t=By(Ce),n=!Vy(t,we.editorLayout??null);!Ute(Se,we,e,De)&&!n||I.savePrefs({...Zv(Se,e,De),editorLayout:t})},[Se,Ce,we,Ee,De,Oe,ge,I,d]);let ke=f.prefs.pinned.filter(e=>e.kind===`chat`).map(e=>e.id).join(`,`),Ae=(0,v.useRef)(new Set),je=f.sessions,Me=f.search.trim()!==``;(0,v.useEffect)(()=>{if(!ge||!Oe||Me||ke===``)return;let t=new Set(je.map(e=>e.id));for(let n of ke.split(`,`)){let r=m.current;t.has(n)||r.pinnedRows[n]||r.drafts[n]||r.remote.tabs[n]||Ae.current.has(n)||(Ae.current.add(n),e.getSession(n).then(e=>p({type:`pinned_row`,session:e}),e=>{e instanceof sg&&e.status===404?I.setPinned(`chat`,n,!1):Ae.current.delete(n)}))}},[ke,je,ge,Oe,Me,e,I]);let Ne=f.tabs.ids.join(`,`);(0,v.useEffect)(()=>{let e=Ne?Ne.split(`,`):[];for(let n of e){if(m.current.remote.tabs[n]||m.current.drafts[n])continue;let e=m.current.transcripts[n];t.subscribe(n,e?.lastSeq??void 0),!e?.hydrated&&(p({type:`transcript_loading`,sessionId:n,loading:!0}),(async()=>{try{await I.hydrateSession(n)}catch(e){e instanceof sg&&e.isUnauthorized?y.current?.():I.toast(`error`,`Could not load session: ${ov(e)}`)}finally{p({type:`transcript_loading`,sessionId:n,loading:!1})}})())}return()=>{for(let n of e){if(m.current.tabs.ids.includes(n)||m.current.remote.tabs[n])continue;let e=m.current.transcripts[n];(!e||e.status===`idle`||e.status===`error`)&&t.unsubscribe(n)}}},[Ne,e,t,I]),(0,v.useEffect)(()=>{if(n)return()=>n.close()},[n]);let[Pe,Fe]=(0,v.useState)(()=>rb());(0,v.useEffect)(()=>{if(typeof window>`u`)return;let e=()=>Fe(rb());return window.addEventListener(`focus`,e),window.addEventListener(`blur`,e),document.addEventListener(`visibilitychange`,e),()=>{window.removeEventListener(`focus`,e),window.removeEventListener(`blur`,e),document.removeEventListener(`visibilitychange`,e)}},[]);let Ie=(0,v.useRef)(new Map),Le=f.page===null?null:f.pageGroup&&f.layout.groups[f.pageGroup]?f.pageGroup:f.layout.focused,Be=Pe?tb(f.layout,f.files,Le).filter(e=>!f.remote.tabs[e]&&!f.drafts[e]).map(e=>{let t=f.transcripts[e]?.session??f.sessions.find(t=>t.id===e)??null;return t?.finishedUnseen?`${e}@${t.finishedUnseen.at}`:null}).filter(e=>e!==null).join(`,`):``;(0,v.useEffect)(()=>{if(!Be||!e.markSessionSeen)return;let t=setTimeout(()=>{for(let t of Be.split(`,`)){let n=t.indexOf(`@`),r=t.slice(0,n),i=t.slice(n+1);Ie.current.get(r)!==i&&(Ie.current.set(r,i),e.markSessionSeen(r).catch(()=>{Ie.current.get(r)===i&&Ie.current.delete(r)}))}},400);return()=>clearTimeout(t)},[Be,e]);let B=f.settings?.theme??`system`,Ve=f.prefs.themeColors;(0,v.useEffect)(()=>{if(typeof document>`u`)return;let e=document.documentElement,t=typeof window.matchMedia==`function`?window.matchMedia(`(prefers-color-scheme: dark)`):null,n=window.oonacode?.host===`vscode`,r=()=>{let r=dte(B,t?.matches===!0);if(n){let t=e.getAttribute(`data-theme`);(t===`light`||t===`dark`)&&(r=t)}else e.setAttribute(`data-theme`,r);let i=Ve[r];for(let t of Dl){let n=i[t];n?e.style.setProperty(`--${t}`,n):e.style.removeProperty(`--${t}`)}};if(r(),n){if(typeof MutationObserver>`u`)return;let t=new MutationObserver(r);return t.observe(e,{attributes:!0,attributeFilter:[`data-theme`]}),()=>t.disconnect()}if(!(B!==`system`||!t||typeof t.addEventListener!=`function`))return t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)},[B,Ve]),(0,v.useEffect)(()=>{window.oonacode?.setTheme?.(B)},[B]);let He=f.prefs.fonts;(0,v.useEffect)(()=>{typeof document>`u`||ute(document,He)},[He]);let Ue=f.account?.gatewayUrl??f.settings?.gatewayUrl??null,We=I.checkUpdates,Ge=(0,v.useRef)(0);(0,v.useEffect)(()=>{if(!Ue)return;let e=()=>{Ge.current=Date.now(),We(!1)};e();let t=setInterval(e,nS),n=()=>{typeof document<`u`&&document.visibilityState===`hidden`||Date.now()-Ge.current<3e5||e()};return window.addEventListener(`focus`,n),document.addEventListener(`visibilitychange`,n),()=>{clearInterval(t),window.removeEventListener(`focus`,n),document.removeEventListener(`visibilitychange`,n)}},[Ue,We]);let Ke=I.openDialog,qe=I.newTab,V=I.savePrefs,Je=(0,v.useCallback)(e=>{switch(ux(),e){case`sign-in`:m.current.account?.loggedIn&&Ke(`account`);break;case`settings`:Ke(`settings`);break;case`new-tab`:qe();break;case`new-project`:m.current.account?.loggedIn&&(p({type:`projects_new`}),Ke(`projects`));break;case`check-updates`:We(!0);break;case`import-chats`:m.current.account?.loggedIn&&Ke(`import-claude`);break;case`export-chats`:m.current.account?.loggedIn&&Ke(`export-chats`);break;case`toggle-session-panel`:I.setRightSection(`sessionInfo`,!m.current.prefs.rightPanelSections.includes(`sessionInfo`));break;case`toggle-sidebar`:I.toggleSidebarPinned();break;case`split-right`:I.splitTab(`right`);break;case`split-down`:I.splitTab(`bottom`);break;case`move-to-new-window`:{let e=m.current.currentSessionId;e&&I.moveTabToNewWindow(e);break}case`move-to-main-window`:{let e=m.current.currentSessionId;e&&I.moveTabToMainWindow(e);break}case`conversations`:Ke(`conversations`);break;case`chat-abouts`:Ke(`chat-abouts`);break;case`project-manager`:Ke(`project-manager`)}},[Ke,qe,We,V,I]);(0,v.useEffect)(()=>{let e=typeof window<`u`?window.oonacode:void 0;if(e?.onMenuCommand)return e.onMenuCommand(Je)},[Je]),(0,v.useEffect)(()=>{let e=window.oonacode;if(e?.onOpenSession)return e.onOpenSession(e=>{if(m.current.remote.tabs[e]||m.current.drafts[e]){I.selectSession(e);return}!m.current.sessions.some(t=>t.id===e)&&!m.current.transcripts[e]||I.selectSession(e)})},[I]),(0,v.useEffect)(()=>{let e=typeof window<`u`?window.oonacode:void 0;if(e?.onUpdateEvent)return e.onUpdateEvent(e=>p({type:`update_event`,event:e}))},[]);let Ye=(0,v.useMemo)(()=>({state:f,dispatch:p,actions:I,api:e,socket:t}),[f,I,e,t]);return(0,W.jsx)(sS.Provider,{value:Ye,children:u})}var bS=h(),xS=`inline-block shrink-0`;function SS(e){return!!e&&/(^|\s)(w-|h-|size-|min-w-|min-h-)/.test(e)}var CS=`w-4 h-4`;function wS(e,{className:t,title:n},r=`0 0 24 24`){return(0,W.jsxs)(`svg`,{className:U(xS,SS(t)?``:CS,t),width:`1em`,height:`1em`,viewBox:r,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":!n||void 0,role:n?`img`:void 0,children:[n?(0,W.jsx)(`title`,{children:n}):null,e]})}var K={Menu:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`line`,{x1:`3`,y1:`6`,x2:`21`,y2:`6`}),(0,W.jsx)(`line`,{x1:`3`,y1:`12`,x2:`21`,y2:`12`}),(0,W.jsx)(`line`,{x1:`3`,y1:`18`,x2:`21`,y2:`18`})]}),e),More:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`circle`,{cx:`12`,cy:`5`,r:`1.6`}),(0,W.jsx)(`circle`,{cx:`12`,cy:`12`,r:`1.6`}),(0,W.jsx)(`circle`,{cx:`12`,cy:`19`,r:`1.6`})]}),e),Plus:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`line`,{x1:`12`,y1:`5`,x2:`12`,y2:`19`}),(0,W.jsx)(`line`,{x1:`5`,y1:`12`,x2:`19`,y2:`12`})]}),e),Send:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`line`,{x1:`22`,y1:`2`,x2:`11`,y2:`13`}),(0,W.jsx)(`polygon`,{points:`22 2 15 22 11 13 2 9 22 2`})]}),e),Stop:e=>wS((0,W.jsx)(`rect`,{x:`6`,y:`6`,width:`12`,height:`12`,rx:`2`}),e),Chevron:e=>wS((0,W.jsx)(`polyline`,{points:e.open?`6 9 12 15 18 9`:`9 6 15 12 9 18`}),e),Settings:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`}),(0,W.jsx)(`path`,{d:`M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09a1.65 1.65 0 0 0-1-1.51 1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09a1.65 1.65 0 0 0 1.51-1 1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z`})]}),e),User:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2`}),(0,W.jsx)(`circle`,{cx:`12`,cy:`7`,r:`4`})]}),e),Stethoscope:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M4.8 2.3A.3.3 0 1 0 5 2H4a2 2 0 0 0-2 2v5a6 6 0 0 0 6 6 6 6 0 0 0 6-6V4a2 2 0 0 0-2-2h-1a.2.2 0 1 0 .3.3`}),(0,W.jsx)(`path`,{d:`M8 15v1a6 6 0 0 0 6 6 6 6 0 0 0 6-6v-4`}),(0,W.jsx)(`circle`,{cx:`20`,cy:`10`,r:`2`})]}),e),Copy:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`rect`,{x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`}),(0,W.jsx)(`path`,{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`})]}),e),Check:e=>wS((0,W.jsx)(`polyline`,{points:`20 6 9 17 4 12`}),e),Reply:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`polyline`,{points:`9 17 4 12 9 7`}),(0,W.jsx)(`path`,{d:`M20 18v-2a4 4 0 0 0-4-4H4`})]}),e),Clock:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,W.jsx)(`polyline`,{points:`12 7 12 12 15 14`})]}),e),X:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,W.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]}),e),Alert:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z`}),(0,W.jsx)(`line`,{x1:`12`,y1:`9`,x2:`12`,y2:`13`}),(0,W.jsx)(`line`,{x1:`12`,y1:`17`,x2:`12.01`,y2:`17`})]}),e),Bug:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M8 2l1.88 1.88`}),(0,W.jsx)(`path`,{d:`M14.12 3.88L16 2`}),(0,W.jsx)(`path`,{d:`M9 7.13v-1a3.003 3.003 0 1 1 6 0v1`}),(0,W.jsx)(`path`,{d:`M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6z`}),(0,W.jsx)(`path`,{d:`M12 20v-9`}),(0,W.jsx)(`path`,{d:`M6.53 9C4.6 8.8 3 7.1 3 5`}),(0,W.jsx)(`path`,{d:`M6 13H2`}),(0,W.jsx)(`path`,{d:`M3 21c0-2.1 1.7-3.9 3.8-4`}),(0,W.jsx)(`path`,{d:`M20.97 5c0 2.1-1.6 3.8-3.5 4`}),(0,W.jsx)(`path`,{d:`M22 13h-4`}),(0,W.jsx)(`path`,{d:`M17.2 17c2.1.1 3.8 1.9 3.8 4`})]}),e),Spinner:e=>wS((0,W.jsx)(`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`}),{...e,className:U(`spin`,e.className??`w-4 h-4`)}),Tool:e=>wS((0,W.jsx)(`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z`}),e),Skill:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M12 3l1.9 4.6 4.6 1.9-4.6 1.9L12 16l-1.9-4.6L5.5 9.5l4.6-1.9z`}),(0,W.jsx)(`path`,{d:`M19 15l.8 1.7 1.7.8-1.7.8L19 20l-.8-1.7-1.7-.8 1.7-.8z`})]}),e),Brain:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M9.5 2a2.5 2.5 0 0 1 2.5 2.5V20a2.5 2.5 0 0 1-5 0 2.5 2.5 0 0 1-2.5-2.5v-1A2.5 2.5 0 0 1 2 14v-1a2.5 2.5 0 0 1 2.5-2.5V9A2.5 2.5 0 0 1 7 6.5V4.5A2.5 2.5 0 0 1 9.5 2z`}),(0,W.jsx)(`path`,{d:`M14.5 2A2.5 2.5 0 0 0 12 4.5V20a2.5 2.5 0 0 0 5 0 2.5 2.5 0 0 0 2.5-2.5v-1A2.5 2.5 0 0 0 22 14v-1a2.5 2.5 0 0 0-2.5-2.5V9A2.5 2.5 0 0 0 17 6.5V4.5A2.5 2.5 0 0 0 14.5 2z`})]}),e),ArrowDown:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`line`,{x1:`12`,y1:`5`,x2:`12`,y2:`19`}),(0,W.jsx)(`polyline`,{points:`19 12 12 19 5 12`})]}),e),Paperclip:e=>wS((0,W.jsx)(`path`,{d:`M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48`}),e),Folder:e=>wS((0,W.jsx)(`path`,{d:`M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z`}),e),Project:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`polygon`,{points:`12 2 2 7 12 12 22 7 12 2`}),(0,W.jsx)(`polyline`,{points:`2 17 12 22 22 17`}),(0,W.jsx)(`polyline`,{points:`2 12 12 17 22 12`})]}),e),File:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z`}),(0,W.jsx)(`polyline`,{points:`14 2 14 8 20 8`})]}),e),ChevronRight:e=>wS((0,W.jsx)(`polyline`,{points:`9 18 15 12 9 6`}),e),Play:e=>wS((0,W.jsx)(`polygon`,{points:`6 4 20 12 6 20 6 4`}),e),Pause:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`rect`,{x:`6`,y:`4`,width:`4`,height:`16`,rx:`1`}),(0,W.jsx)(`rect`,{x:`14`,y:`4`,width:`4`,height:`16`,rx:`1`})]}),e),SkipBack:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`polygon`,{points:`19 20 9 12 19 4 19 20`}),(0,W.jsx)(`line`,{x1:`5`,y1:`19`,x2:`5`,y2:`5`})]}),e),SkipForward:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`polygon`,{points:`5 4 15 12 5 20 5 4`}),(0,W.jsx)(`line`,{x1:`19`,y1:`5`,x2:`19`,y2:`19`})]}),e),Music:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M9 18V5l12-2v13`}),(0,W.jsx)(`circle`,{cx:`6`,cy:`18`,r:`3`}),(0,W.jsx)(`circle`,{cx:`18`,cy:`16`,r:`3`})]}),e),Speaker:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M11 5 6 9H2v6h4l5 4V5z`}),(0,W.jsx)(`path`,{d:`M15.54 8.46a5 5 0 0 1 0 7.07`}),(0,W.jsx)(`path`,{d:`M19.07 4.93a10 10 0 0 1 0 14.14`})]}),e),Film:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`rect`,{x:`2`,y:`2`,width:`20`,height:`20`,rx:`2.18`,ry:`2.18`}),(0,W.jsx)(`line`,{x1:`7`,y1:`2`,x2:`7`,y2:`22`}),(0,W.jsx)(`line`,{x1:`17`,y1:`2`,x2:`17`,y2:`22`}),(0,W.jsx)(`line`,{x1:`2`,y1:`12`,x2:`22`,y2:`12`}),(0,W.jsx)(`line`,{x1:`2`,y1:`7`,x2:`7`,y2:`7`}),(0,W.jsx)(`line`,{x1:`2`,y1:`17`,x2:`7`,y2:`17`}),(0,W.jsx)(`line`,{x1:`17`,y1:`17`,x2:`22`,y2:`17`}),(0,W.jsx)(`line`,{x1:`17`,y1:`7`,x2:`22`,y2:`7`})]}),e),Image:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,ry:`2`}),(0,W.jsx)(`circle`,{cx:`8.5`,cy:`8.5`,r:`1.5`}),(0,W.jsx)(`polyline`,{points:`21 15 16 10 5 21`})]}),e),ExternalLink:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`}),(0,W.jsx)(`polyline`,{points:`15 3 21 3 21 9`}),(0,W.jsx)(`line`,{x1:`10`,y1:`14`,x2:`21`,y2:`3`})]}),e),ExpandAll:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`polyline`,{points:`7 5 12 10 17 5`}),(0,W.jsx)(`polyline`,{points:`7 13 12 18 17 13`})]}),e),CollapseAll:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`polyline`,{points:`7 11 12 6 17 11`}),(0,W.jsx)(`polyline`,{points:`7 19 12 14 17 19`})]}),e),Palette:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M12 3a9 9 0 1 0 0 18c.9 0 1.6-.7 1.6-1.6 0-.4-.2-.8-.4-1.1-.3-.3-.4-.7-.4-1.1 0-.9.7-1.6 1.6-1.6H16a5 5 0 0 0 5-5c0-3.9-4-7.6-9-7.6Z`}),(0,W.jsx)(`circle`,{cx:`7.5`,cy:`11.5`,r:`1`}),(0,W.jsx)(`circle`,{cx:`10.5`,cy:`7.5`,r:`1`}),(0,W.jsx)(`circle`,{cx:`15.5`,cy:`8.5`,r:`1`})]}),e),Bot:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`rect`,{x:`3`,y:`11`,width:`18`,height:`10`,rx:`2`}),(0,W.jsx)(`circle`,{cx:`12`,cy:`5`,r:`2`}),(0,W.jsx)(`path`,{d:`M12 7v4`}),(0,W.jsx)(`line`,{x1:`8`,y1:`16`,x2:`8`,y2:`16`}),(0,W.jsx)(`line`,{x1:`16`,y1:`16`,x2:`16`,y2:`16`})]}),e),Trash:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`polyline`,{points:`3 6 5 6 21 6`}),(0,W.jsx)(`path`,{d:`M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6`}),(0,W.jsx)(`path`,{d:`M10 11v6M14 11v6`}),(0,W.jsx)(`path`,{d:`M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2`})]}),e),Refresh:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`polyline`,{points:`23 4 23 10 17 10`}),(0,W.jsx)(`path`,{d:`M20.49 15a9 9 0 1 1-2.12-9.36L23 10`})]}),e),Search:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`circle`,{cx:`11`,cy:`11`,r:`8`}),(0,W.jsx)(`line`,{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`})]}),e),Filter:e=>wS((0,W.jsx)(`polygon`,{points:`22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3`}),e),Shield:e=>wS((0,W.jsx)(`path`,{d:`M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z`}),e),Coins:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`ellipse`,{cx:`8`,cy:`6`,rx:`5`,ry:`2.5`}),(0,W.jsx)(`path`,{d:`M3 6v4c0 1.4 2.2 2.5 5 2.5s5-1.1 5-2.5V6`}),(0,W.jsx)(`path`,{d:`M3 10v4c0 1.4 2.2 2.5 5 2.5 1 0 1.9-.13 2.7-.36`}),(0,W.jsx)(`circle`,{cx:`16`,cy:`15`,r:`5`}),(0,W.jsx)(`path`,{d:`M16 13v4M14.5 15h3`})]}),e),Lock:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`rect`,{x:`5`,y:`11`,width:`14`,height:`9`,rx:`2`}),(0,W.jsx)(`path`,{d:`M8 11V7a4 4 0 0 1 8 0v4`})]}),e),Fork:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`circle`,{cx:`12`,cy:`18`,r:`3`}),(0,W.jsx)(`circle`,{cx:`6`,cy:`6`,r:`3`}),(0,W.jsx)(`circle`,{cx:`18`,cy:`6`,r:`3`}),(0,W.jsx)(`path`,{d:`M18 9a9 9 0 0 1-9 9M6 9a9 9 0 0 0 9 9`})]}),e),Edit:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`}),(0,W.jsx)(`path`,{d:`M18.5 2.5a2.12 2.12 0 0 1 3 3L12 15l-4 1 1-4z`})]}),e),Upload:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`}),(0,W.jsx)(`polyline`,{points:`17 8 12 3 7 8`}),(0,W.jsx)(`line`,{x1:`12`,y1:`3`,x2:`12`,y2:`15`})]}),e),Download:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`}),(0,W.jsx)(`polyline`,{points:`7 10 12 15 17 10`}),(0,W.jsx)(`line`,{x1:`12`,y1:`15`,x2:`12`,y2:`3`})]}),e),Info:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,W.jsx)(`line`,{x1:`12`,y1:`16`,x2:`12`,y2:`12`}),(0,W.jsx)(`line`,{x1:`12`,y1:`8`,x2:`12.01`,y2:`8`})]}),e),Panel:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`}),(0,W.jsx)(`line`,{x1:`15`,y1:`3`,x2:`15`,y2:`21`})]}),e),LogIn:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4`}),(0,W.jsx)(`polyline`,{points:`10 17 15 12 10 7`}),(0,W.jsx)(`line`,{x1:`15`,y1:`12`,x2:`3`,y2:`12`})]}),e),Globe:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,W.jsx)(`line`,{x1:`2`,y1:`12`,x2:`22`,y2:`12`}),(0,W.jsx)(`path`,{d:`M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z`})]}),e),Monitor:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`rect`,{x:`2`,y:`3`,width:`20`,height:`14`,rx:`2`}),(0,W.jsx)(`line`,{x1:`8`,y1:`21`,x2:`16`,y2:`21`}),(0,W.jsx)(`line`,{x1:`12`,y1:`17`,x2:`12`,y2:`21`})]}),e),Bell:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M18 8a6 6 0 0 0-12 0c0 7-3 9-3 9h18s-3-2-3-9`}),(0,W.jsx)(`path`,{d:`M13.73 21a2 2 0 0 1-3.46 0`})]}),e),Sliders:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`line`,{x1:`4`,y1:`21`,x2:`4`,y2:`14`}),(0,W.jsx)(`line`,{x1:`4`,y1:`10`,x2:`4`,y2:`3`}),(0,W.jsx)(`line`,{x1:`12`,y1:`21`,x2:`12`,y2:`12`}),(0,W.jsx)(`line`,{x1:`12`,y1:`8`,x2:`12`,y2:`3`}),(0,W.jsx)(`line`,{x1:`20`,y1:`21`,x2:`20`,y2:`16`}),(0,W.jsx)(`line`,{x1:`20`,y1:`12`,x2:`20`,y2:`3`}),(0,W.jsx)(`line`,{x1:`1`,y1:`14`,x2:`7`,y2:`14`}),(0,W.jsx)(`line`,{x1:`9`,y1:`8`,x2:`15`,y2:`8`}),(0,W.jsx)(`line`,{x1:`17`,y1:`16`,x2:`23`,y2:`16`})]}),e),Pin:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M12 17v5`}),(0,W.jsx)(`path`,{d:`M9 10.76V6h6v4.76a2 2 0 0 0 1.11 1.79l1.78.9A2 2 0 0 1 19 15.24V16H5v-.76a2 2 0 0 1 1.11-1.79l1.78-.9A2 2 0 0 0 9 10.76z`}),(0,W.jsx)(`path`,{d:`M8 3h8`})]}),e),PanelLeft:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`16`,rx:`2`}),(0,W.jsx)(`line`,{x1:`9`,y1:`4`,x2:`9`,y2:`20`})]}),e),Columns:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`16`,rx:`2`}),(0,W.jsx)(`line`,{x1:`12`,y1:`4`,x2:`12`,y2:`20`})]}),e),WindowOut:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M14 4h6v6`}),(0,W.jsx)(`line`,{x1:`20`,y1:`4`,x2:`11`,y2:`13`}),(0,W.jsx)(`path`,{d:`M18 14v4a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4`})]}),e),GitBranch:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`line`,{x1:`6`,y1:`3`,x2:`6`,y2:`15`}),(0,W.jsx)(`circle`,{cx:`18`,cy:`6`,r:`3`}),(0,W.jsx)(`circle`,{cx:`6`,cy:`18`,r:`3`}),(0,W.jsx)(`path`,{d:`M18 9a9 9 0 0 1-9 9`})]}),e),Plug:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M12 22v-5`}),(0,W.jsx)(`path`,{d:`M9 7V2M15 7V2`}),(0,W.jsx)(`path`,{d:`M6 7h12v4a6 6 0 0 1-12 0z`})]}),e),Mail:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`rect`,{x:`3`,y:`5`,width:`18`,height:`14`,rx:`2`}),(0,W.jsx)(`polyline`,{points:`3 7 12 13 21 7`})]}),e),Chats:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M14 9a2 2 0 0 1-2 2H6l-3 3V5a2 2 0 0 1 2-2h7a2 2 0 0 1 2 2z`}),(0,W.jsx)(`path`,{d:`M18 9h1a2 2 0 0 1 2 2v9l-3-3h-6a2 2 0 0 1-2-2v-1`})]}),e),Lightbulb:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M9 18h6`}),(0,W.jsx)(`path`,{d:`M10 22h4`}),(0,W.jsx)(`path`,{d:`M15.09 14c.18-.98.65-1.74 1.41-2.5A4.65 4.65 0 0 0 18 8 6 6 0 0 0 6 8c0 1 .23 2.23 1.5 3.5A4.61 4.61 0 0 1 8.91 14`})]}),e),StickyNote:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M15.5 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8.5L15.5 3z`}),(0,W.jsx)(`path`,{d:`M15 3v6h6`}),(0,W.jsx)(`path`,{d:`M7 13h6`}),(0,W.jsx)(`path`,{d:`M7 17h4`})]}),e),Clipboard:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`rect`,{x:`8`,y:`2`,width:`8`,height:`4`,rx:`1`}),(0,W.jsx)(`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`}),(0,W.jsx)(`path`,{d:`m9 14 2 2 4-4`})]}),e),Link:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`}),(0,W.jsx)(`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`})]}),e),Gallery:e=>wS((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`rect`,{x:`7`,y:`3`,width:`14`,height:`14`,rx:`2`}),(0,W.jsx)(`circle`,{cx:`11.5`,cy:`7.5`,r:`1.2`}),(0,W.jsx)(`path`,{d:`m21 13-3.5-3.5L10 17`}),(0,W.jsx)(`path`,{d:`M3 7v12a2 2 0 0 0 2 2h12`})]}),e)},TS={primary:`bg-accent text-accent-fg hover:opacity-90 border-transparent`,inverse:`bg-inverse-bg text-inverse-fg hover:opacity-90 border-transparent`,secondary:`bg-surface-2 text-fg hover:bg-surface-3 border-border`,ghost:`bg-transparent text-fg-muted hover:bg-surface-2 hover:text-fg border-transparent`,danger:`bg-danger-soft text-danger hover:opacity-90 border-transparent`};function q({variant:e=`secondary`,size:t=`md`,busy:n,className:r,children:i,disabled:a,...o}){return(0,W.jsxs)(`button`,{type:`button`,...o,disabled:a||n,className:U(`inline-flex items-center gap-1.5 rounded-md border font-medium transition-colors disabled:opacity-50 disabled:cursor-not-allowed whitespace-nowrap`,t===`sm`?`px-2 py-1 text-xs`:`px-3 py-1.5 text-sm`,TS[e],r),children:[n?(0,W.jsx)(K.Spinner,{className:`w-3.5 h-3.5`}):null,i]})}function ES({label:e,className:t,children:n,...r}){return(0,W.jsx)(`button`,{type:`button`,"aria-label":e,title:e,...r,className:U(`inline-flex items-center justify-center rounded-md p-1.5 text-fg-muted hover:bg-surface-2 hover:text-fg disabled:opacity-50`,t),children:n})}function DS({label:e,details:t}){let n=(0,v.useRef)(null),[r,i]=(0,v.useState)(null),a=()=>{let e=n.current?.getBoundingClientRect();if(!e||typeof window>`u`)return;let t=Math.max(8,Math.min(e.left-12,window.innerWidth-320-8)),r=e.bottom+6,a=r+180>window.innerHeight?Math.max(8,e.top-186):r;i({left:t,top:a})},o=()=>i(null);return(0,W.jsxs)(`span`,{ref:n,className:`inline-flex align-middle`,onMouseEnter:a,onMouseLeave:o,onFocus:a,onBlur:o,onKeyDown:e=>{e.key!==`Escape`||!r||(e.stopPropagation(),o())},children:[(0,W.jsx)(`span`,{tabIndex:0,role:`button`,"aria-label":`About ${e}`,className:`cursor-help rounded text-fg-faint hover:text-fg focus:text-fg focus:outline-none`,"data-testid":`info-tip`,onClick:e=>{e.preventDefault(),e.stopPropagation(),a()},children:(0,W.jsx)(K.Info,{className:`w-3.5 h-3.5`})}),r&&typeof document<`u`?(0,bS.createPortal)((0,W.jsx)(`div`,{role:`tooltip`,className:`fixed z-[60] w-80 rounded-md border border-border bg-surface px-3 py-2 text-xs leading-snug text-fg shadow-lg`,style:{left:r.left,top:r.top},"data-testid":`info-tip-card`,children:t}),document.body):null]})}function OS({items:e}){return(0,W.jsx)(`ul`,{className:`list-disc space-y-1 pl-4`,children:e.map(e=>(0,W.jsx)(`li`,{children:e},e))})}function kS({label:e,hint:t,details:n,children:r,className:i}){return(0,W.jsxs)(`label`,{className:U(`flex flex-col gap-1 text-sm`,i),children:[(0,W.jsxs)(`span`,{className:`flex items-center gap-1.5 font-medium text-fg`,children:[e,n&&n.length>0?(0,W.jsx)(DS,{label:e,details:(0,W.jsx)(OS,{items:n})}):null]}),r,t?(0,W.jsx)(`span`,{className:`text-xs text-fg-faint`,children:t}):null]})}var AS=`w-full rounded-md border border-border bg-surface px-2.5 py-1.5 text-sm text-fg placeholder:text-fg-faint focus:border-accent focus:outline-none`,jS=AS;function MS({tone:e=`neutral`,children:t,className:n}){return(0,W.jsx)(`span`,{className:U(`inline-flex items-center rounded px-1.5 py-0.5 text-[11px] font-medium leading-4`,{neutral:`bg-surface-2 text-fg-muted`,ok:`bg-ok-soft text-ok`,warn:`bg-warn-soft text-warn`,danger:`bg-danger-soft text-danger`,accent:`bg-accent-soft text-accent`,think:`bg-think-soft text-think`}[e],n),children:t})}function NS({open:e,title:t,onClose:n,children:r,footer:i,wide:a,full:o}){let s=(0,v.useRef)(null);return(0,v.useEffect)(()=>{if(!e)return;let t=document.activeElement,r=s.current;(r?.querySelector(`input, select, textarea, button:not([data-close])`)??r)?.focus();let i=e=>{e.key===`Escape`&&(e.stopPropagation(),n())};return document.addEventListener(`keydown`,i),()=>{document.removeEventListener(`keydown`,i),t?.focus?.()}},[e,n]),e?(0,bS.createPortal)((0,W.jsx)(`div`,{className:`fixed inset-0 z-40 flex items-end sm:items-center justify-center bg-black/40 p-0 sm:p-4`,onMouseDown:e=>e.target===e.currentTarget&&n(),children:(0,W.jsxs)(`div`,{ref:s,role:`dialog`,"aria-modal":`true`,"aria-label":t,tabIndex:-1,className:U(`flex max-h-[95vh] w-full flex-col rounded-t-xl sm:rounded-xl border border-border bg-surface shadow-lg outline-none`,o?`h-[92vh] sm:max-w-[min(96vw,1600px)]`:a?`sm:max-w-3xl`:`sm:max-w-lg`),children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border px-4 py-3`,children:[(0,W.jsx)(`h2`,{className:`text-base font-semibold`,children:t}),(0,W.jsx)(ES,{label:`Close`,"data-close":!0,onClick:n,children:(0,W.jsx)(K.X,{})})]}),(0,W.jsx)(`div`,{className:o?`flex min-h-0 flex-1 flex-col overflow-hidden px-3 py-2`:`flex-1 overflow-y-auto px-4 py-3`,children:r}),i?(0,W.jsx)(`div`,{className:`flex flex-wrap items-center justify-end gap-2 border-t border-border px-4 py-3`,children:i}):null]})}),document.body):null}function PS({checked:e,onChange:t,label:n,hint:r,details:i,disabled:a,testId:o}){return(0,W.jsxs)(`label`,{className:U(`flex items-start justify-between gap-3 py-2`,a&&`opacity-60`),...o?{"data-testid":o}:{},children:[(0,W.jsxs)(`span`,{className:`min-w-0`,children:[(0,W.jsxs)(`span`,{className:`flex items-center gap-1.5 text-sm font-medium text-fg`,children:[n,i&&i.length>0?(0,W.jsx)(DS,{label:n,details:(0,W.jsx)(OS,{items:i})}):null]}),r?(0,W.jsx)(`span`,{className:`mt-0.5 block text-xs text-fg-faint`,children:r}):null]}),(0,W.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e,"aria-label":n,disabled:a,onClick:()=>t(!e),className:U(`relative mt-0.5 h-5 w-9 shrink-0 rounded-full border transition-colors`,e?`border-accent bg-accent`:`border-fg-faint bg-surface-2`),children:(0,W.jsx)(`span`,{className:U(`absolute top-0.5 h-3.5 w-3.5 rounded-full transition-all`,e?`left-[1.15rem] bg-white`:`left-0.5 bg-fg-muted`)})})]})}function FS({value:e,options:t,onChange:n,label:r}){return(0,W.jsx)(`div`,{className:`inline-flex rounded-md border border-border bg-surface-2 p-0.5`,role:`radiogroup`,"aria-label":r,children:t.map(t=>(0,W.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":e===t.value,onClick:()=>n(t.value),className:U(`rounded px-2.5 py-1 text-xs font-medium transition-colors`,e===t.value?`bg-surface text-fg shadow-sm`:`text-fg-muted hover:text-fg`),children:t.label},t.value))})}function IS({icon:e,title:t,hint:n,action:r}){return(0,W.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-2 p-8 text-center text-fg-muted`,children:[e?(0,W.jsx)(`div`,{className:`text-fg-faint`,children:e}):null,(0,W.jsx)(`div`,{className:`text-base font-medium text-fg`,children:t}),n?(0,W.jsx)(`div`,{className:`max-w-md text-sm`,children:n}):null,r?(0,W.jsx)(`div`,{className:`mt-2`,children:r}):null]})}function LS({open:e,title:t,message:n,confirmLabel:r=`Delete`,onConfirm:i,onClose:a}){return(0,W.jsx)(NS,{open:e,title:t,onClose:a,footer:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{"data-close":!0,onClick:a,children:`Cancel`}),(0,W.jsx)(q,{variant:`danger`,"data-testid":`confirm-dialog-accept`,onClick:()=>{i(),a()},children:r})]}),children:(0,W.jsx)(`div`,{className:`text-sm text-fg-muted`,children:n})})}function Gte({open:e,name:t,busy:n=!1,onSave:r,onDiscard:i,onClose:a}){return(0,W.jsx)(NS,{open:e,title:t?`Save changes to ${t}?`:`Save changes?`,onClose:n?()=>void 0:a,footer:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{"data-close":!0,onClick:a,disabled:n,"data-testid":`save-changes-cancel`,children:`Cancel`}),(0,W.jsx)(q,{onClick:i,disabled:n,"data-testid":`save-changes-discard`,children:`Don't save`}),(0,W.jsx)(q,{variant:`primary`,busy:n,onClick:r,"data-testid":`save-changes-save`,children:`Save`})]}),children:(0,W.jsxs)(`div`,{className:`text-sm text-fg-muted`,children:[t?`${t} has unsaved changes.`:`This file has unsaved changes.`,` Save them before closing, or they are lost.`]})})}function RS({open:e,title:t,label:n,initialValue:r=``,password:i=!1,submitLabel:a=`Save`,onSubmit:o,onClose:s}){let[c,l]=(0,v.useState)(r);(0,v.useEffect)(()=>{e&&l(r)},[e,r]);let u=()=>{let e=c.trim();e&&(o(e),s())};return(0,W.jsx)(NS,{open:e,title:t,onClose:s,footer:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{"data-close":!0,onClick:s,children:`Cancel`}),(0,W.jsx)(q,{variant:`primary`,"data-testid":`prompt-dialog-submit`,onClick:u,children:a})]}),children:(0,W.jsx)(kS,{label:n,children:(0,W.jsx)(`input`,{className:AS,type:i?`password`:`text`,value:c,"data-testid":`prompt-dialog-input`,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),u())}})})})}var zS=[{id:`24h`,label:`Last 24 hours`,count:24,unit:`hour`},{id:`7d`,label:`7 days`,count:7,unit:`day`},{id:`30d`,label:`30 days`,count:30,unit:`day`},{id:`90d`,label:`90 days`,count:90,unit:`day`}],Kte=864e5;function BS(e){let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!t)return null;let n=new Date(Number(t[1]),Number(t[2])-1,Number(t[3]));return Number.isFinite(n.getTime())&&n.getDate()===Number(t[3])?n:null}function VS(e){let t=e=>String(e).padStart(2,`0`);return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`}function HS(e){let t=BS(e.from),n=BS(e.to);return!t||!n||n.getTime()<t.getTime()?null:Math.round((n.getTime()-t.getTime())/Kte)+1}function qte(e,t){if(e===`24h`)return[`hour`];if(e===`7d`||e===`30d`)return[`day`,`hour`];if(e===`90d`)return[`day`];let n=t?HS(t):null;return n===null||n>zm.maxHourlyRangeDays?[`day`]:n<=2?[`hour`,`day`]:[`day`,`hour`]}function US(e){let t=BS(e.from),n=BS(e.to);return!t||!n?`Pick a start and an end date.`:n.getTime()<t.getTime()?`The end date is before the start date.`:HS(e)>zm.maxRangeDays?`A range can cover at most ${zm.maxRangeDays} days.`:null}function Jte(e,t,n,r){if(e===`custom`){if(!r||US(r))return null;let e=BS(r.from),n=BS(r.to),i=new Date(n.getFullYear(),n.getMonth(),n.getDate()+1);return{from:e.toISOString(),to:i.toISOString(),bucket:t}}let i=zS.find(t=>t.id===e),a;return i.unit===`hour`?(a=new Date(n.getTime()),a.setMinutes(0,0,0),a=new Date(a.getTime()-(i.count-1)*36e5)):a=new Date(n.getFullYear(),n.getMonth(),n.getDate()-(i.count-1)),{from:a.toISOString(),to:n.toISOString(),bucket:t}}function Yte(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||`UTC`}catch{return`UTC`}}function WS(e){return!Number.isFinite(e)||e===0?`0`:e.toLocaleString(`en-US`,{maximumFractionDigits:3})}function Xte(e){return!Number.isFinite(e)||e===0?`0`:e.toLocaleString(`en-US`,{maximumFractionDigits:Math.abs(e)>=100?0:3})}function GS(e){return Number.isFinite(e)?e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e4?`${Math.round(e/1e3)}k`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(Math.round(e)):`0`}function KS(e,t){if(!(t>0)||!(e>0))return`0%`;let n=e/t*100;return n<1?`<1%`:n>99&&e<t?`>99%`:`${Math.round(n)}%`}function qS(e){return e.inputTokens+e.cacheReadTokens+e.cacheWriteTokens+e.outputTokens}var Zte={image:[`image`,`images`],second:[`second`,`seconds`],video:[`video`,`videos`],character:[`character`,`characters`],voice:[`voice`,`voices`],token:[`token`,`tokens`]};function Qte(e,t){let[n,r]=Zte[e]??[e,`${e}s`];return t===1?`per ${n}`:e===`second`&&t===60?`per minute`:e===`second`&&t===3600?`per hour`:t===1e6?`per 1M ${r}`:t>=1e3&&t%1e3==0?`per ${t/1e3}k ${r}`:`per ${t.toLocaleString(`en-US`)} ${r}`}var JS={textInput:`text in`,cachedTextInput:`cached text in`,audioInput:`audio in`,cachedAudioInput:`cached audio in`,imageInput:`image in`,cachedImageInput:`cached image in`,output:`out`,audioOutput:`audio out`};function $te(e,t){if(!e)return null;let n=e=>e==null||!Number.isFinite(e)?null:Xte(e*t);if(e.kind===`tokens`){if(e.free)return{main:`Free`,detail:[]};let t=[n(e.inputPerMTok)===null?null:`in ${n(e.inputPerMTok)}`,n(e.outputPerMTok)===null?null:`out ${n(e.outputPerMTok)}`].filter(e=>e!==null);if(t.length===0)return null;let r=[n(e.cacheReadPerMTok)===null?null:`cache read ${n(e.cacheReadPerMTok)}`,n(e.cacheWritePerMTok)===null?null:`cache write ${n(e.cacheWritePerMTok)}`,e.cacheWrite1hPerMTok===void 0?null:`1-hour cache write ${n(e.cacheWrite1hPerMTok)}`,e.webSearchPer1k===void 0?null:`web search ${n(e.webSearchPer1k)} per 1,000`,e.cheaperUnderTokens===void 0?null:`cheaper for prompts under ${GS(e.cheaperUnderTokens)} tokens`,e.offPeak?`cheaper off-peak`:null].filter(e=>e!==null);return{main:`${t.join(` · `)} credits per 1M tokens`,detail:r}}let r=Object.entries(e.tiers),i=Qte(e.unit,e.per),a;a=e.unit===`token`&&e.tokens?`${Object.entries(e.tokens).map(([e,t])=>`${JS[e]??e} ${n(t)}`).join(` · `)} credits per 1M tokens`:r.length===1?`${n(r[0][1])} credits ${i}`:`${r.map(([e,t])=>`${e} ${n(t)}`).join(` · `)} credits ${i}`;let o=[e.inputImage===void 0?null:`each input image ${n(e.inputImage)}`,e.perTextInput===void 0?null:`each text message ${n(e.perTextInput)}`,e.unit!==`token`&&e.tokens?`tokens: ${Object.entries(e.tokens).map(([e,t])=>`${JS[e]??e} ${n(t)}`).join(` · `)} per 1M`:null].filter(e=>e!==null);return{main:a,detail:o}}function YS(e){return e.displayName?.trim()||e.model}var XS=`__other__`;function ene(e){return e<7?`var(--viz-${e+1})`:`var(--viz-other)`}function ZS(e,t,n){let r=e=>e?n===`credits`?e.credits:e.requests:0,i=(t===`model`?e.models.map(e=>({key:e.key,label:YS(e),amount:n===`credits`?e.credits:e.requests})):e.purposes.map(t=>({key:t.purpose,label:Rm(t.purpose,e.surface),amount:n===`credits`?t.credits:t.requests}))).filter(e=>e.amount>0),a=i.slice(0,7),o=new Set(i.slice(7).map(e=>e.key)),s=a.map((e,t)=>({key:e.key,label:e.label,color:ene(t)}));o.size>0&&s.push({key:XS,label:`Other (${o.size})`,color:`var(--viz-other)`});let c=0;return{series:s,columns:e.series.map(e=>{let n=t===`model`?e.models:e.purposes,i=[];for(let e of a){let t=r(n[e.key]);t>0&&i.push({series:e.key,value:t})}let s=0;for(let e of o)s+=r(n[e]);s>0&&i.push({series:XS,value:s});let l=i.reduce((e,t)=>e+t.value,0);return l>c&&(c=l),{key:e.key,at:e.at,total:l,requests:e.requests,credits:e.credits,parts:i}}),max:c}}function tne(e,t=4){if(!(e>0))return[0];let n=e/t,r=10**Math.floor(Math.log10(n)),i=[1,2,2.5,5,10].map(e=>e*r).find(e=>e>=n)??n,a=[];for(let t=0;t<e+i*1e-9;t+=i)a.push(Number(t.toPrecision(12)));return a[a.length-1]<e&&a.push(Number((a.length*i).toPrecision(12))),a}var nne=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`];function QS(e,t,n=!0){let r=/^(\d{4})-(\d{2})-(\d{2})(?:T(\d{2}):(\d{2}))?$/.exec(e);if(!r)return e;let i=`${Number(r[3])} ${nne[Number(r[2])-1]??r[2]}`;return t===`day`||r[4]===void 0?i:n?`${i} ${r[4]}:${r[5]}`:`${r[4]}:${r[5]}`}function rne(e,t=4){if(e<=0)return[];if(e<=t)return[...Array(e).keys()];let n=new Set;for(let r=0;r<t;r++)n.add(Math.round(r*(e-1)/(t-1)));return[...n]}function ine(e){return e===`api`?`API`:`Code agent`}function $S(e){return e instanceof sg?e.code===`account_required`||e.isUnauthorized?{title:`Sign in to see your usage`,hint:`Usage belongs to your OonaCode account — sign in on the Account tab.`,retry:!1}:e.code===`gateway_unreachable`||e.code===`network`?{title:`Can’t reach OonaCode’s server`,hint:`Your usage is read from your account on the server. Check the connection and try again.`,retry:!0}:e.status===404||e.code===`not_found`?{title:`Update OonaCode to see your usage`,hint:`This PC’s OonaCode service is older than the Usage tab.`,retry:!1}:{title:`Usage could not be read`,hint:e.message,retry:!0}:{title:`Usage could not be read`,hint:e instanceof Error?e.message:String(e),retry:!0}}var ane={agent:`Everything your PCs ran: the app, the terminal, your phone and Telegram — chats, their subagents and background work.`,api:`Your own code: API keys, the agent API’s runs, images, video and voice.`};function eC(e){return U(`rounded-md border px-2.5 py-1 text-xs font-medium transition-colors`,e?`border-accent bg-accent-soft text-accent`:`border-border text-fg-muted hover:text-fg`)}function one(){let{state:e,api:t}=G(),n=e.account?.loggedIn===!0,r=(0,v.useMemo)(Yte,[]),[i,a]=(0,v.useState)(`agent`),[o,s]=(0,v.useState)(`30d`),[c,l]=(0,v.useState)(()=>{let e=new Date;return{from:VS(new Date(e.getFullYear(),e.getMonth(),e.getDate()-6)),to:VS(e)}}),u=qte(o,c),[d,f]=(0,v.useState)(null),p=d&&u.includes(d)?d:u[0],[m,h]=(0,v.useState)(`model`),[g,_]=(0,v.useState)(`credits`),[y,b]=(0,v.useState)(0),[x,S]=(0,v.useState)(null),[C,w]=(0,v.useState)(!1),[T,E]=(0,v.useState)(null),D=o===`custom`?US(c):null;return(0,v.useEffect)(()=>{if(!n)return;if(!t.accountUsage){E($S(new sg(`not_found`,404,`no usage route`)));return}let e=Jte(o,p,new Date,c);if(!e)return;let a=!0;return w(!0),t.accountUsage({surface:i,...e,tz:r}).then(e=>{a&&(S(e),E(null))},e=>{a&&E($S(e))}).finally(()=>{a&&w(!1)}),()=>{a=!1}},[t,n,i,o,p,c.from,c.to,r,y]),n?(0,W.jsxs)(`section`,{"data-testid":`usage-tab`,className:`min-w-0 space-y-4`,children:[(0,W.jsxs)(`div`,{className:`space-y-2`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,W.jsx)(FS,{label:`Which usage`,value:i,options:[{value:`agent`,label:`Code agent`},{value:`api`,label:`API`}],onChange:a}),(0,W.jsx)(ES,{label:`Refresh`,onClick:()=>b(e=>e+1),disabled:C,"data-testid":`usage-refresh`,children:C?(0,W.jsx)(K.Spinner,{className:`h-3.5 w-3.5`}):(0,W.jsx)(K.Refresh,{className:`h-3.5 w-3.5`})})]}),(0,W.jsx)(`p`,{className:`text-xs text-fg-muted`,"data-testid":`usage-surface-hint`,children:ane[i]}),(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,role:`group`,"aria-label":`Range`,children:[zS.map(e=>(0,W.jsx)(`button`,{type:`button`,className:eC(o===e.id),"aria-pressed":o===e.id,"data-testid":`usage-range-${e.id}`,onClick:()=>s(e.id),children:e.label},e.id)),(0,W.jsx)(`button`,{type:`button`,className:eC(o===`custom`),"aria-pressed":o===`custom`,"data-testid":`usage-range-custom`,onClick:()=>s(`custom`),children:`Custom…`})]}),o===`custom`?(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,W.jsxs)(`label`,{className:`flex min-w-0 items-center gap-1.5 text-xs text-fg-muted`,children:[`From`,(0,W.jsx)(`input`,{type:`date`,className:U(AS,`w-auto min-w-0 py-1 text-xs`),value:c.from,max:c.to||void 0,"data-testid":`usage-from`,onChange:e=>l(t=>({...t,from:e.target.value}))})]}),(0,W.jsxs)(`label`,{className:`flex min-w-0 items-center gap-1.5 text-xs text-fg-muted`,children:[`to`,(0,W.jsx)(`input`,{type:`date`,className:U(AS,`w-auto min-w-0 py-1 text-xs`),value:c.to,min:c.from||void 0,"data-testid":`usage-to`,onChange:e=>l(t=>({...t,to:e.target.value}))})]})]}):null,D?(0,W.jsx)(`p`,{className:`text-xs text-danger`,role:`alert`,children:D}):null,(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[u.length>1?(0,W.jsx)(FS,{label:`Bars`,value:p,options:u.slice().sort().reverse().map(e=>({value:e,label:e===`hour`?`By hour`:`By day`})),onChange:e=>f(e)}):null,(0,W.jsx)(FS,{label:`Stack by`,value:m,options:[{value:`model`,label:`Models`},{value:`purpose`,label:`Purposes`}],onChange:h}),(0,W.jsx)(FS,{label:`Measure`,value:g,options:[{value:`credits`,label:`Credits`},{value:`requests`,label:`Requests`}],onChange:_})]})]}),T?(0,W.jsxs)(`div`,{className:`rounded-md border border-border bg-surface-2 px-3 py-2.5 text-sm`,role:`alert`,"data-testid":`usage-error`,children:[(0,W.jsx)(`div`,{className:`font-medium`,children:T.title}),(0,W.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-muted`,children:T.hint}),T.retry?(0,W.jsx)(q,{size:`sm`,className:`mt-2`,onClick:()=>b(e=>e+1),children:`Try again`}):null]}):null,x===null&&C?(0,W.jsxs)(`div`,{className:`flex items-center gap-2 py-6 text-sm text-fg-muted`,"data-testid":`usage-loading`,children:[(0,W.jsx)(K.Spinner,{className:`h-4 w-4`}),` Reading your usage…`]}):null,x?(0,W.jsx)(`div`,{className:U(`min-w-0 space-y-4 transition-opacity`,C&&`opacity-60`),"aria-busy":C,"data-testid":`usage-body`,children:(0,W.jsx)(sne,{data:x,stackBy:m,metric:g})}):null]}):(0,W.jsxs)(`section`,{"data-testid":`usage-tab`,className:`py-6 text-center`,children:[(0,W.jsx)(`div`,{className:`text-sm font-medium`,children:`Sign in to see your usage`}),(0,W.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:`Usage belongs to your OonaCode account — sign in on the Account tab.`})]})}function sne({data:e,stackBy:t,metric:n}){let r=(0,v.useMemo)(()=>ZS(e,t,n),[e,t,n]),i=(0,v.useMemo)(()=>tC(ZS(e,`model`,n).series),[e,n]),a=(0,v.useMemo)(()=>tC(ZS(e,`purpose`,n).series),[e,n]),o=e.totals,s=o.requests===0;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-4`,"data-testid":`usage-totals`,children:[(0,W.jsx)(nC,{label:`Credits`,value:WS(o.credits),testId:`usage-total-credits`,children:`charged in this range`}),(0,W.jsx)(nC,{label:`Requests`,value:o.requests.toLocaleString(`en-US`),testId:`usage-total-requests`,children:[o.failedRequests>0?`${o.failedRequests.toLocaleString(`en-US`)} not served`:null,o.freeRequests>0?`${o.freeRequests.toLocaleString(`en-US`)} free`:null].filter(Boolean).join(` · `)||`model calls`}),(0,W.jsx)(nC,{label:`Tokens`,value:GS(qS(o)),testId:`usage-total-tokens`,children:`in ${GS(o.inputTokens)} · out ${GS(o.outputTokens)}`}),(0,W.jsx)(nC,{label:`Cache`,value:GS(o.cacheReadTokens+o.cacheWriteTokens),children:`read ${GS(o.cacheReadTokens)} · write ${GS(o.cacheWriteTokens)}`})]}),s?(0,W.jsxs)(`div`,{className:`rounded-md border border-dashed border-border px-3 py-6 text-center`,"data-testid":`usage-empty`,children:[(0,W.jsx)(`div`,{className:`text-sm font-medium`,children:`Nothing in this range`}),(0,W.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[`No `,ine(e.surface),` requests between these dates. Pick a longer range, or the other side above.`]})]}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`rounded-md border border-border p-3`,children:[(0,W.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-baseline justify-between gap-x-3 gap-y-1`,children:[(0,W.jsxs)(`h3`,{className:`text-sm font-semibold`,children:[n===`credits`?`Credits`:`Requests`,` by `,e.bucket]}),(0,W.jsxs)(`span`,{className:`text-[11px] text-fg-muted`,children:[`Times in `,e.tz]})]}),(0,W.jsx)(pne,{series:r.series,columns:r.columns,max:r.max,bucket:e.bucket,metric:n}),r.series.length>0?(0,W.jsx)(`ul`,{className:`mt-2 flex flex-wrap gap-x-3 gap-y-1`,"data-testid":`usage-legend`,children:r.series.map(e=>(0,W.jsxs)(`li`,{className:`inline-flex min-w-0 items-center gap-1.5 text-xs`,children:[(0,W.jsx)(rC,{color:e.color}),(0,W.jsx)(`span`,{className:`truncate text-fg-muted`,children:e.label})]},e.key))}):(0,W.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:n===`credits`?`Nothing charged in this range — every request was free or not served.`:`No requests in this range.`})]}),(0,W.jsx)(cne,{data:e,colors:i}),(0,W.jsx)(une,{data:e,colors:a})]}),(0,W.jsx)(`p`,{className:`text-[11px] text-fg-faint`,"data-testid":`usage-footnote`,children:`Credits are what your account was charged, request by request; a free model shows zero. Prices are today’s, in credits per 1M tokens; a past request settled at the price of its day. Every model and every purpose that ran is listed, and each list adds up to the totals.`})]})}function tC(e){return new Map(e.map(e=>[e.key,e.color]))}function nC({label:e,value:t,children:n,testId:r}){return(0,W.jsxs)(`div`,{className:`min-w-0 rounded-md border border-border px-3 py-2`,children:[(0,W.jsx)(`div`,{className:`text-[11px] text-fg-muted`,children:e}),(0,W.jsx)(`div`,{className:`truncate text-lg font-semibold tabular-nums`,"data-testid":r,children:t}),n?(0,W.jsx)(`div`,{className:`truncate text-[11px] text-fg-faint`,children:n}):null]})}function rC({color:e}){return e?(0,W.jsx)(`span`,{"aria-hidden":!0,className:`inline-block h-2.5 w-2.5 shrink-0 rounded-sm`,style:{background:e}}):(0,W.jsx)(`span`,{"aria-hidden":!0,className:`inline-block h-2.5 w-2.5 shrink-0 rounded-sm border border-border`})}function cne({data:e,colors:t}){return(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`h3`,{className:`mb-1.5 text-sm font-semibold`,children:`Models`}),(0,W.jsx)(`ul`,{className:`divide-y divide-border rounded-md border border-border`,"data-testid":`usage-models`,children:e.models.map(n=>(0,W.jsx)(lne,{m:n,data:e,color:t.get(n.key)??(t.has(`__other__`)&&n.credits>0?t.get(`__other__`):void 0)},n.key))})]})}function lne({m:e,data:t,color:n}){let r=$te(e.price,t.creditsPerUsd),i=YS(e),a=e.modality!==`chat`;return(0,W.jsxs)(`li`,{className:`min-w-0 px-3 py-2`,"data-testid":`usage-model-row`,"data-model":e.key,children:[(0,W.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,W.jsxs)(`div`,{className:`min-w-0`,children:[(0,W.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,W.jsx)(rC,{color:n}),(0,W.jsx)(`span`,{className:`min-w-0 break-words text-sm font-medium`,title:`${e.providerId} / ${e.model}`,children:i}),a?(0,W.jsx)(`span`,{className:`shrink-0 rounded bg-surface-2 px-1 text-[10px] text-fg-muted`,children:e.modality}):null]}),i===e.model?null:(0,W.jsx)(`div`,{className:`break-all pl-[18px] font-mono text-[10px] text-fg-faint`,children:e.model})]}),(0,W.jsxs)(`div`,{className:`shrink-0 text-right`,children:[(0,W.jsx)(`div`,{className:`text-sm font-semibold tabular-nums`,"data-testid":`usage-model-credits`,children:WS(e.credits)}),(0,W.jsx)(`div`,{className:`text-[11px] text-fg-muted`,children:KS(e.credits,t.totals.credits)})]})]}),(0,W.jsxs)(`div`,{className:`mt-1 flex flex-wrap gap-x-3 gap-y-0.5 text-[11px] text-fg-muted`,children:[(0,W.jsxs)(`span`,{children:[e.requests.toLocaleString(`en-US`),` requests`]}),e.failedRequests>0?(0,W.jsxs)(`span`,{children:[e.failedRequests,` not served`]}):null,e.freeRequests>0?(0,W.jsxs)(`span`,{children:[e.freeRequests,` free`]}):null,qS(e)>0?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`span`,{children:[`in `,GS(e.inputTokens)]}),(0,W.jsxs)(`span`,{children:[`cache read `,GS(e.cacheReadTokens)]}),(0,W.jsxs)(`span`,{children:[`cache write `,GS(e.cacheWriteTokens)]}),(0,W.jsxs)(`span`,{children:[`out `,GS(e.outputTokens)]})]}):null]}),(0,W.jsx)(`div`,{className:`mt-0.5 break-words text-[11px] text-fg-faint`,"data-testid":`usage-model-price`,children:r?[r.main,...r.detail].join(` · `):`Price: not in the price list (what it cost is above).`})]})}function une({data:e,colors:t}){let n=e.totals.credits;return(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`h3`,{className:`mb-1.5 text-sm font-semibold`,children:`What it was for`}),(0,W.jsx)(`ul`,{className:`space-y-2`,"data-testid":`usage-purposes`,children:e.purposes.map(r=>{let i=n>0?Math.min(100,r.credits/n*100):0;return(0,W.jsxs)(`li`,{className:`min-w-0`,"data-testid":`usage-purpose-row`,"data-purpose":r.purpose,children:[(0,W.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,W.jsxs)(`div`,{className:`min-w-0`,children:[(0,W.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-sm`,children:[(0,W.jsx)(rC,{color:t.get(r.purpose)??(r.credits>0?t.get(`__other__`):void 0)}),(0,W.jsx)(`span`,{className:`min-w-0 break-words font-medium`,children:Rm(r.purpose,e.surface)})]}),(0,W.jsxs)(`div`,{className:`text-[11px] text-fg-muted`,children:[vee(r.purpose,e.surface),` `,r.requests.toLocaleString(`en-US`),` `,`requests.`]})]}),(0,W.jsxs)(`div`,{className:`shrink-0 text-right`,children:[(0,W.jsx)(`div`,{className:`text-sm font-semibold tabular-nums`,"data-testid":`usage-purpose-credits`,children:WS(r.credits)}),(0,W.jsx)(`div`,{className:`text-[11px] text-fg-muted`,children:KS(r.credits,n)})]})]}),(0,W.jsx)(`div`,{className:`mt-1 h-1.5 overflow-hidden rounded-full bg-surface-2`,"aria-hidden":!0,children:(0,W.jsx)(`div`,{className:`h-full rounded-full bg-accent`,style:{width:`${i}%`}})})]},r.purpose)})})]})}var iC=180,dne=8,fne=2;function pne({series:e,columns:t,max:n,bucket:r,metric:i}){let a=(0,v.useRef)(null),[o,s]=(0,v.useState)(640),[c,l]=(0,v.useState)(null);(0,v.useEffect)(()=>{let e=a.current;if(!e)return;let t=()=>{let t=e.clientWidth;t>0&&s(t)};if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]),(0,v.useEffect)(()=>{c!==null&&c>=t.length&&l(null)},[c,t.length]);let u=tne(n),d=u[u.length-1]||1,f=e=>i===`credits`?WS(e):GS(e),p=Math.max(28,Math.max(...u.map(e=>f(e).length))*6+8),m=Math.max(40,o-p)/Math.max(1,t.length),h=Math.max(1,Math.min(24,m*.72)),g=e=>160-e/d*152,_=new Map(e.map(e=>[e.key,e.color])),y=new Map(e.map(e=>[e.key,e.label])),b=e=>{let n=a.current;if(!n)return;let r=e-n.getBoundingClientRect().left-p,i=Math.floor(r/m);l(i>=0&&i<t.length?i:null)},x=e=>{if(t.length!==0){if(e.key===`ArrowLeft`||e.key===`ArrowRight`){e.preventDefault();let n=e.key===`ArrowLeft`?-1:1;l(e=>Math.min(t.length-1,Math.max(0,(e??t.length)+n)))}else e.key===`Escape`&&c!==null&&(e.stopPropagation(),l(null))}},S=rne(t.length,o<420?3:5),C=c===null?void 0:t[c],w=Math.min(240,o),T=c===null?0:Math.min(Math.max(0,p+(c+.5)*m-w/2),Math.max(0,o-w));return(0,W.jsxs)(`div`,{ref:a,className:`relative min-w-0 select-none outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,tabIndex:0,role:`group`,"aria-label":`${i===`credits`?`Credits`:`Requests`} by ${r}; use the arrow keys to read each bar`,onKeyDown:x,onPointerMove:e=>{e.pointerType===`mouse`&&b(e.clientX)},onPointerDown:e=>b(e.clientX),onPointerLeave:e=>{e.pointerType===`mouse`&&l(null)},onBlur:()=>l(null),"data-testid":`usage-chart`,children:[(0,W.jsxs)(`svg`,{width:o,height:iC,viewBox:`0 0 ${o} ${iC}`,className:`block max-w-full`,"aria-hidden":!0,children:[u.map(e=>(0,W.jsxs)(`g`,{children:[(0,W.jsx)(`line`,{x1:p,x2:o,y1:g(e),y2:g(e),stroke:`var(--border)`,strokeWidth:1,shapeRendering:`crispEdges`}),(0,W.jsx)(`text`,{x:p-6,y:g(e),dy:`0.32em`,textAnchor:`end`,fontSize:10,fill:`var(--fg-muted)`,children:f(e)})]},e)),c===null?null:(0,W.jsx)(`rect`,{x:p+c*m,y:dne,width:m,height:152,fill:`var(--surface-2)`}),t.map((e,t)=>{let n=p+t*m+(m-h)/2,r=g(0);return(0,W.jsx)(`g`,{"data-testid":`usage-chart-column`,"data-total":e.total,children:e.parts.map((t,i)=>{let a=Math.max(t.value/d*152,+(i===e.parts.length-1)),o=i===e.parts.length-1,s=o?a:Math.max(0,a-fne),c=r-a;if(r-=a,s<=0)return null;let l=_.get(t.series)??`var(--viz-other)`;return o?(0,W.jsx)(`path`,{d:mne(n,c,h,s),fill:l},t.series):(0,W.jsx)(`rect`,{x:n,y:c+(a-s),width:h,height:s,fill:l},t.series)})},e.key)}),S.map((e,n)=>{let i=t[e];if(!i)return null;let a=p+(e+.5)*m,s=n===0?`start`:n===S.length-1?`end`:`middle`,c=s===`start`?Math.max(p,a-m/2):s===`end`?Math.min(o,a+m/2):a;return(0,W.jsx)(`text`,{x:c,y:176,textAnchor:s,fontSize:10,fill:`var(--fg-muted)`,children:QS(i.key,r,n===0||r===`day`||!hne(t[S[n-1]]?.key,i.key))},i.key)})]}),C?(0,W.jsxs)(`div`,{className:`pointer-events-none absolute top-0 z-10 rounded-md border border-border bg-surface px-2.5 py-2 text-xs shadow-lg`,style:{left:T,width:w},role:`status`,"data-testid":`usage-tooltip`,children:[(0,W.jsx)(`div`,{className:`text-[11px] text-fg-muted`,children:QS(C.key,r)}),(0,W.jsxs)(`div`,{className:`font-semibold tabular-nums`,children:[WS(C.credits),` credits`,(0,W.jsxs)(`span`,{className:`font-normal text-fg-muted`,children:[` `,`· `,C.requests.toLocaleString(`en-US`),` requests`]})]}),C.parts.length>0?(0,W.jsx)(`ul`,{className:`mt-1 space-y-0.5`,children:[...C.parts].reverse().map(e=>(0,W.jsxs)(`li`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,W.jsx)(`span`,{"aria-hidden":!0,className:`inline-block h-0.5 w-3 shrink-0 rounded`,style:{background:_.get(e.series)}}),(0,W.jsx)(`span`,{className:`shrink-0 font-semibold tabular-nums`,children:f(e.value)}),(0,W.jsx)(`span`,{className:`min-w-0 truncate text-fg-muted`,children:y.get(e.series)})]},e.series))}):(0,W.jsxs)(`div`,{className:`mt-0.5 text-fg-muted`,children:[`Nothing `,i===`credits`?`charged`:`ran`,`.`]})]}):null]})}function mne(e,t,n,r){let i=Math.max(0,Math.min(4,n/2,r));return[`M${e},${t+r}`,`L${e},${t+i}`,`Q${e},${t} ${e+i},${t}`,`L${e+n-i},${t}`,`Q${e+n},${t} ${e+n},${t+i}`,`L${e+n},${t+r}`,`Z`].join(` `)}function hne(e,t){return!!e&&e.slice(0,10)===t.slice(0,10)}function aC({checked:e,onChange:t}){let{state:n}=G();return ig(n.account)===`unavailable`?null:(0,W.jsxs)(`label`,{className:`flex items-start gap-2 text-sm`,children:[(0,W.jsx)(`input`,{type:`checkbox`,className:`mt-1`,checked:e,onChange:e=>t(e.target.checked),"data-testid":`keep-unlocked`}),(0,W.jsxs)(`span`,{children:[(0,W.jsx)(`span`,{className:`block`,children:`Keep me unlocked on this PC`}),(0,W.jsx)(`span`,{className:`block text-xs text-fg-faint`,children:cc})]})]})}function gne({view:e}){let{actions:t}=G(),[n,r]=(0,v.useState)(``),[i,a]=(0,v.useState)(!1),[o,s]=(0,v.useState)(!1),[c,l]=(0,v.useState)(``),[u,d]=(0,v.useState)(``),f=async()=>{if(n){a(!0);try{await t.completeVaultRekey(n)&&r(``)}finally{a(!1)}}},p=async()=>{if(!(c.trim()!==`discard-my-vault-and-history`||!u)){a(!0);try{await t.revokeVaultRekey(u)&&d(``)}finally{a(!1),l(``)}}};return(0,W.jsxs)(`div`,{role:`status`,"data-testid":`vault-rekey-pending`,className:`space-y-3 rounded-md border border-warn/50 bg-warn-soft p-3 text-sm`,children:[(0,W.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,W.jsx)(K.Alert,{className:`mt-0.5 w-4 h-4 shrink-0 text-warn`}),(0,W.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,W.jsx)(`p`,{className:`font-medium text-fg`,children:Vee(e)}),e.canFinishHere?(0,W.jsx)(`p`,{className:`text-xs text-fg-muted`,children:`This PC still holds the key from before the reset, so it can move your vault to the new password. Nothing is lost. Type your new password to confirm; you will get a new vault Recovery Key.`}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`text-xs text-fg-muted`,children:Hee(e)}),(0,W.jsx)(`p`,{className:`text-xs text-fg-muted`,"data-testid":`rekey-recovery-exit`,children:Uee})]})]})]}),e.canFinishHere?(0,W.jsxs)(`form`,{className:`flex items-end gap-2`,onSubmit:e=>{e.preventDefault(),f()},children:[(0,W.jsx)(kS,{label:`New password`,className:`flex-1`,children:(0,W.jsx)(`input`,{className:AS,type:`password`,value:n,onChange:e=>r(e.target.value),autoComplete:`current-password`,"data-testid":`rekey-password`})}),(0,W.jsx)(q,{type:`submit`,variant:`primary`,busy:i,disabled:!n,"data-testid":`rekey-finish`,children:`Move my vault to the new password`})]}):null,o?(0,W.jsxs)(`div`,{className:`space-y-2 rounded-md border border-danger/40 bg-surface p-3`,children:[(0,W.jsxs)(`p`,{className:`text-xs text-danger`,children:[`Discarding permanently deletes every saved provider key and the vault Recovery Key that could still have moved them. Your chats are not touched — they live on your PCs. There is no undo. Type `,(0,W.jsx)(`span`,{className:`font-mono`,children:sc}),` and your current password to confirm.`]}),(0,W.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,W.jsx)(kS,{label:`Your new password`,className:`flex-1`,children:(0,W.jsx)(`input`,{className:AS,type:`password`,value:u,onChange:e=>d(e.target.value),autoComplete:`current-password`,"data-testid":`rekey-discard-password`})}),(0,W.jsx)(kS,{label:`Confirmation`,className:`flex-1`,children:(0,W.jsx)(`input`,{className:AS,value:c,onChange:e=>l(e.target.value),autoComplete:`off`,spellCheck:!1,"data-testid":`rekey-discard-ack`})}),(0,W.jsx)(q,{variant:`danger`,busy:i,disabled:c.trim()!==`discard-my-vault-and-history`||!u,onClick:()=>void p(),"data-testid":`rekey-discard-confirm`,children:`Discard vault`}),(0,W.jsx)(q,{variant:`ghost`,onClick:()=>s(!1),children:`Cancel`})]})]}):(0,W.jsx)(q,{size:`sm`,variant:`ghost`,onClick:()=>s(!0),"data-testid":`rekey-discard`,children:e.canFinishHere?`This was not me — discard the vault instead`:`Last resort: discard the vault`})]})}function _ne(){let{state:e,actions:t}=G(),n=e.recoveryKey,[r,i]=(0,v.useState)(!1);if(!n)return null;let a=async()=>{try{await navigator.clipboard?.writeText(n.code),i(!0)}catch{t.toast(`error`,`Could not copy — select the code and copy it by hand`)}};return(0,W.jsxs)(`div`,{role:`status`,"data-testid":`recovery-key`,className:`space-y-2 rounded-md border border-ok/50 bg-ok-soft p-3 text-sm`,children:[(0,W.jsx)(`p`,{className:`font-medium text-fg`,children:`Your new vault Recovery Key`}),(0,W.jsx)(`p`,{className:`text-xs text-fg-muted`,children:`Write it down now — this is the only copy, and OonaCode does not store it. It unlocks your vault data if you ever forget the password. It is not a 2FA backup code.`}),(0,W.jsx)(`div`,{className:`select-all rounded-md border border-border bg-surface px-3 py-2 font-mono text-base tracking-wider`,"data-testid":`recovery-key-code`,children:n.code}),n.devicesSignedOut>0?(0,W.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[n.devicesSignedOut,` other device`,n.devicesSignedOut===1?` was`:`s were`,` signed out; sign in there with the new password.`]}):null,n.warning?(0,W.jsx)(`p`,{className:`rounded-md border border-warn/50 bg-warn-soft px-2 py-1.5 text-xs text-fg`,"data-testid":`recovery-key-warning`,children:n.warning}):null,(0,W.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,W.jsxs)(q,{size:`sm`,onClick:()=>void a(),children:[(0,W.jsx)(K.Copy,{className:`w-3.5 h-3.5`}),` `,r?`Copied`:`Copy`]}),(0,W.jsx)(q,{size:`sm`,variant:`primary`,onClick:()=>t.dismissRecoveryKey(),"data-testid":`recovery-key-done`,children:`I have saved it`})]})]})}function vne(){let{state:e,actions:t}=G(),[n,r]=(0,v.useState)(!1),[i,a]=(0,v.useState)(``),[o,s]=(0,v.useState)(!1),c=ig(e.account);if(c===`unavailable`||c===`pending_rekey`)return null;let l=async e=>{s(!0);try{await t.setDeviceUnlock(e,e?i:void 0)&&(r(!1),a(``))}finally{s(!1)}};return c===`armed`?(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs`,"data-testid":`device-unlock`,children:[(0,W.jsx)(MS,{tone:`ok`,children:`stays unlocked on this PC`}),(0,W.jsx)(q,{size:`sm`,busy:o,onClick:()=>void l(!1),children:`Turn off`})]}):n?(0,W.jsxs)(`form`,{className:`space-y-2 rounded-md border border-border bg-surface-2 p-3`,"data-testid":`device-unlock`,onSubmit:e=>{e.preventDefault(),l(!0)},children:[(0,W.jsx)(`p`,{className:`text-xs text-fg-faint`,children:cc}),(0,W.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,W.jsx)(kS,{label:`Password`,className:`flex-1`,children:(0,W.jsx)(`input`,{className:AS,type:`password`,value:i,onChange:e=>a(e.target.value),autoComplete:`current-password`})}),(0,W.jsx)(q,{type:`submit`,variant:`primary`,busy:o,disabled:!i,children:`Keep me unlocked`}),(0,W.jsx)(q,{variant:`ghost`,onClick:()=>r(!1),children:`Cancel`})]})]}):(0,W.jsx)(q,{size:`sm`,onClick:()=>r(!0),"data-testid":`device-unlock`,children:`Keep me unlocked on this PC…`})}function yne({pending:e}){let{actions:t}=G(),[n,r]=(0,v.useState)(()=>Date.now()),[i,a]=(0,v.useState)(!1);(0,v.useEffect)(()=>{if(r(Date.now()),e.resendAt<=Date.now())return;let t=setInterval(()=>{let n=Date.now();r(n),n>=e.resendAt&&clearInterval(t)},1e3);return()=>clearInterval(t)},[e.resendAt]);let o=Xee(e,n),s=async()=>{a(!0);try{await t.resendVerification()}finally{a(!1)}};return(0,W.jsxs)(`div`,{role:`status`,"data-testid":`email-verification`,className:`space-y-2 rounded-md border border-warn/50 bg-warn-soft p-3 text-sm`,children:[(0,W.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,W.jsx)(K.Alert,{className:`mt-0.5 w-4 h-4 shrink-0 text-warn`}),(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsx)(`p`,{className:`font-medium text-fg`,children:Qee(e)}),(0,W.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:`Open the link on any device, then log in again here. Check the spam folder if it does not arrive.`})]})]}),(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,W.jsx)(q,{size:`sm`,variant:`primary`,busy:i,disabled:o>0,onClick:()=>void s(),"data-testid":`resend-verification`,children:o>0?`Resend link (${o}s)`:`Resend link`}),(0,W.jsx)(q,{size:`sm`,variant:`ghost`,onClick:()=>t.dismissEmailVerification(),children:`Dismiss`})]})]})}function oC(){let{state:e,actions:t}=G(),[n,r]=(0,v.useState)(e.settings?.gatewayUrl||x),[i,a]=(0,v.useState)(``),[o,s]=(0,v.useState)(``),[c,l]=(0,v.useState)(e.connection.hostName??``),[u,d]=(0,v.useState)(!1),[f,p]=(0,v.useState)(!0),[m,h]=(0,v.useState)(!1);(0,v.useEffect)(()=>{e.settings?.gatewayUrl&&n===x&&r(e.settings.gatewayUrl)},[e.settings?.gatewayUrl,n]);let g=async()=>{if(!(!n.trim()||!i.trim()||!o)){h(!0);try{await t.login({gatewayUrl:n.trim(),email:i.trim(),password:o,register:u,...c.trim()?{deviceName:c.trim()}:{},keepUnlocked:f})!==`verification_pending`&&s(``)}finally{h(!1)}}};return(0,W.jsxs)(`form`,{className:`space-y-3`,onSubmit:e=>{e.preventDefault(),g()},children:[(0,W.jsx)(`p`,{className:`text-sm text-fg-muted`,children:`Log in to use OonaCode and to sync your credentials across your own devices (zero-knowledge: the server only ever sees ciphertext).`}),e.emailVerification?(0,W.jsx)(yne,{pending:e.emailVerification}):null,(0,W.jsx)(kS,{label:`Gateway URL`,children:(0,W.jsx)(`input`,{className:AS,value:n,onChange:e=>r(e.target.value),placeholder:x,autoComplete:`url`,spellCheck:!1})}),(0,W.jsx)(kS,{label:`Email`,children:(0,W.jsx)(`input`,{className:AS,type:`email`,value:i,onChange:e=>a(e.target.value),autoComplete:`username`})}),(0,W.jsx)(kS,{label:`Password`,hint:`Also unlocks your vault. It never leaves this PC; only a derived proof is sent.`,children:(0,W.jsx)(`input`,{className:AS,type:`password`,value:o,onChange:e=>s(e.target.value),autoComplete:u?`new-password`:`current-password`})}),(0,W.jsx)(kS,{label:`Device name`,children:(0,W.jsx)(`input`,{className:AS,value:c,onChange:e=>l(e.target.value),placeholder:`Office PC`})}),(0,W.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,W.jsx)(`input`,{type:`checkbox`,checked:u,onChange:e=>d(e.target.checked)}),` `,`Create a new account`]}),(0,W.jsx)(aC,{checked:f,onChange:p}),(0,W.jsx)(q,{type:`submit`,variant:`primary`,busy:m,disabled:!n.trim()||!i.trim()||!o,children:u?`Register`:`Log in`})]})}function bne(){let{actions:e}=G(),[t,n]=(0,v.useState)(``),[r,i]=(0,v.useState)(!0),[a,o]=(0,v.useState)(!1);return(0,W.jsxs)(`form`,{className:`space-y-2`,onSubmit:i=>{i.preventDefault(),o(!0),e.unlock(t,{keepUnlocked:r}).finally(()=>{o(!1),n(``)})},children:[(0,W.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,W.jsx)(kS,{label:`Vault locked — enter your password`,className:`flex-1`,children:(0,W.jsx)(`input`,{className:AS,type:`password`,value:t,onChange:e=>n(e.target.value),autoComplete:`current-password`})}),(0,W.jsx)(q,{type:`submit`,variant:`primary`,busy:a,disabled:!t,children:`Unlock`})]}),(0,W.jsx)(aC,{checked:r,onChange:i})]})}function xne(){let{state:e}=G(),t=e.plan,n=e=>e.toLocaleString(void 0,{maximumFractionDigits:0});return(0,W.jsxs)(`section`,{className:`space-y-2`,"data-testid":`account-plan`,children:[(0,W.jsx)(`h3`,{className:`text-sm font-semibold`,children:`Plan & credits`}),t===null?(0,W.jsx)(`p`,{className:`text-xs text-fg-muted`,children:`Sign in to see your plan and credit balance.`}):(0,W.jsxs)(`div`,{className:`space-y-2 rounded-md border border-border px-3 py-2.5 text-sm`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsx)(`span`,{className:`text-fg-muted`,children:`Plan`}),(0,W.jsxs)(`span`,{className:`font-medium`,children:[t.planName,t.status===`none`?` (lapsed)`:``]})]}),(0,W.jsx)(`div`,{className:`h-px bg-border`}),(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsx)(`span`,{className:`text-fg-muted`,children:`Plan credits`}),(0,W.jsx)(`span`,{className:`font-semibold tabular-nums`,"data-testid":`account-credits`,children:n(t.credits.balance)})]}),(0,W.jsxs)(`div`,{className:`text-[11px] text-fg-faint`,children:[t.credits.monthlyGrant>0?`Tops up to ${n(t.credits.monthlyGrant)} each 30-day period. `:`No monthly top-up on this plan; the signup gift and anything you buy never expire. `,`Free models never draw on it.`]})]})]})}function Sne({open:e,onClose:t}){let{state:n,actions:r}=G(),i=n.account,a=ag(i),[o,s]=(0,v.useState)(`account`);return(0,v.useEffect)(()=>{e&&(r.refreshAccount(),r.refreshPlan())},[e,r]),(0,W.jsxs)(NS,{open:e,title:`Account`,onClose:t,wide:o===`usage`,children:[(0,W.jsx)(`div`,{className:`-mt-1 mb-4 flex gap-1 border-b border-border`,role:`tablist`,"aria-label":`Account sections`,children:[[`account`,`Account`],[`usage`,`Usage`]].map(([e,t])=>(0,W.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":o===e,"data-testid":`account-tab-${e}`,onClick:()=>s(e),className:o===e?`-mb-px border-b-2 border-accent px-3 py-1.5 text-sm font-medium text-fg`:`-mb-px border-b-2 border-transparent px-3 py-1.5 text-sm text-fg-muted hover:text-fg`,children:t},e))}),o===`usage`?(0,W.jsx)(one,{}):(0,W.jsxs)(`div`,{className:`space-y-5`,children:[i?.loggedIn?(0,W.jsxs)(`section`,{className:`space-y-2`,children:[(0,W.jsx)(_ne,{}),(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,W.jsx)(`span`,{className:`font-medium`,children:i.email}),a?(0,W.jsx)(MS,{tone:`warn`,children:`vault waiting for a password reset to finish`}):(0,W.jsx)(MS,{tone:i.vaultUnlocked?`ok`:`warn`,children:i.vaultUnlocked?`vault unlocked`:`vault locked`}),(0,W.jsxs)(MS,{tone:i.syncStatus===`error`?`danger`:i.syncStatus===`offline`?`warn`:`neutral`,children:[`sync: `,i.syncStatus]}),i.vaultRev===null?null:(0,W.jsxs)(MS,{children:[`rev `,i.vaultRev]})]}),(0,W.jsxs)(`div`,{className:`text-xs text-fg-faint`,children:[i.gatewayUrl,` · device `,i.deviceId?.slice(0,8)??`?`,` · last sync`,` `,i.lastSyncAt?Z_(i.lastSyncAt):`never`,i.syncError?(0,W.jsxs)(`span`,{className:`text-danger`,children:[` · `,i.syncError]}):null]}),a?(0,W.jsx)(gne,{view:a}):null,!a&&!i.vaultUnlocked?(0,W.jsx)(bne,{}):null,i.vaultUnlocked?(0,W.jsx)(vne,{}):null,(0,W.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,W.jsxs)(q,{onClick:()=>void r.syncNow(),disabled:!i.vaultUnlocked,children:[(0,W.jsx)(K.Refresh,{className:`w-3.5 h-3.5`}),` Sync now`]}),(0,W.jsx)(q,{variant:`danger`,onClick:()=>void r.logout(),children:`Log out`})]})]}):(0,W.jsx)(oC,{}),(0,W.jsx)(xne,{})]})]})}function sC(){return typeof window>`u`?null:window.__oonacodeRenderProbe??null}function Cne(e){e&&sC()?.transcript?.(e)}function wne(e,t,n){sC()?.group?.(e,n)}function cC(e,t){return e===null||e===document||e===window||!t?!0:e instanceof Node?e.contains(t):!0}var Tne=30;function lC({open:e,at:t,items:n,onClose:r,label:i,anchorEl:a=null,testId:o=`session-context-menu`}){let s=(0,v.useRef)(null),[c,l]=(0,v.useState)(t),u=n.filter(e=>!e.disabled),[d,f]=(0,v.useState)(0);return(0,v.useEffect)(()=>{e&&f(0)},[e,t.x,t.y]),(0,v.useLayoutEffect)(()=>{if(!e)return;let r=s.current,i=r?.offsetWidth??200,a=r?.offsetHeight??n.length*Tne,o=window.innerWidth-i-8,c=window.innerHeight-a-8;l({x:Math.max(8,Math.min(t.x,o)),y:Math.max(8,Math.min(t.y,c))})},[e,t.x,t.y,n.length]),(0,v.useEffect)(()=>{if(!e)return;let t=e=>{if(e.key===`Escape`){e.stopPropagation(),r();return}if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault(),f(t=>((e.key===`ArrowDown`?t+1:t-1)+u.length)%Math.max(u.length,1));return}if(e.key===`Enter`||e.key===` `){e.preventDefault();let t=u[d];t&&(r(),t.onSelect())}},n=e=>{s.current?.contains(e.target)||(e.preventDefault(),e.stopPropagation(),r())},i=e=>{cC(e.target,a)&&r()};return document.addEventListener(`keydown`,t),window.addEventListener(`mousedown`,n,!0),window.addEventListener(`resize`,r),window.addEventListener(`scroll`,i,!0),()=>{document.removeEventListener(`keydown`,t),window.removeEventListener(`mousedown`,n,!0),window.removeEventListener(`resize`,r),window.removeEventListener(`scroll`,i,!0)}},[e,r,u,d,a]),e?(0,bS.createPortal)((0,W.jsx)(`div`,{ref:s,role:`menu`,"aria-label":i,"data-testid":o,className:`fixed z-50 min-w-[190px] overflow-hidden rounded-md border border-border bg-surface py-1 shadow-lg`,style:{left:c.x,top:c.y},children:n.map(e=>{let t=u.indexOf(e);return(0,W.jsxs)(`div`,{children:[e.separated?(0,W.jsx)(`div`,{className:`my-1 h-px bg-border`}):null,(0,W.jsxs)(`button`,{type:`button`,role:`menuitem`,disabled:e.disabled,title:e.title,"data-testid":e.testId,className:U(`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm`,e.disabled?`cursor-default text-fg-faint`:e.danger?`text-danger hover:bg-danger-soft`:`text-fg hover:bg-surface-2`,!e.disabled&&t===d?`bg-surface-2`:``),onMouseEnter:()=>t>=0&&f(t),onClick:()=>{r(),e.onSelect()},children:[e.icon?(0,W.jsx)(`span`,{className:`w-3.5 shrink-0`,children:e.icon}):null,(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),e.hint?(0,W.jsx)(`span`,{className:`shrink-0 text-[11px] text-fg-faint`,children:e.hint}):null]})]},e.key)})}),document.body):null}function Ene(e){if(!e.supported)return`This PC's OonaCode is too old to list your other devices — update it.`;switch(e.reason){case`logged_out`:return`Sign in to your OonaCode account to see your other PCs here.`;case`gateway_unreachable`:return`Your account server is unreachable — only this PC is listed right now.`;case`vault_locked`:return`Unlock your vault to read the sessions on your other PCs.`;default:return`No other PCs on this account yet. Install OonaCode on another machine and sign in.`}}function Dne({sessions:e,onOpen:t,readOnly:n}){return e.length===0?(0,W.jsx)(`div`,{className:`px-2 py-4 text-center text-xs text-fg-faint`,children:`No sessions here.`}):(0,W.jsx)(`ul`,{className:`divide-y divide-border`,children:e.map(e=>(0,W.jsx)(`li`,{children:(0,W.jsxs)(`button`,{type:`button`,onClick:()=>t(e.id),className:`flex w-full items-center gap-2 px-2 py-2 text-left hover:bg-surface-2`,children:[(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsx)(`div`,{className:`truncate text-sm`,children:av(e)}),(0,W.jsxs)(`div`,{className:`truncate text-[11px] text-fg-faint`,children:[e.cwd,` · `,Z_(e.updatedAt)]})]}),n?(0,W.jsx)(MS,{tone:`warn`,children:`read-only`}):null,(0,W.jsx)(K.Chevron,{className:`w-3.5 h-3.5 shrink-0 text-fg-faint`})]})},e.id))})}function One({open:e,onClose:t}){let{state:n,actions:r}=G(),[i,a]=(0,v.useState)(`local`),[o,s]=(0,v.useState)(``);(0,v.useEffect)(()=>{e&&r.refreshHosts()},[e,r]),(0,v.useEffect)(()=>{!e||i===`local`||r.refreshHostSessions(i)},[e,i,r]);let c=(0,v.useMemo)(()=>n.remote.hosts.filter(e=>!e.isSelf),[n.remote.hosts]),l=c.find(e=>e.hostId===i)??null,u=i===`local`?n.sessions:n.remote.sessions[i]??[],d=l?n.remote.unreachable[l.hostId]:void 0,f=l&&d?Tm(d.reason,l.label||l.hostName,d.detail):null,p=(0,v.useMemo)(()=>{let e=o.trim().toLowerCase();return e?u.filter(t=>av(t).toLowerCase().includes(e)||t.cwd.toLowerCase().includes(e)):u},[u,o]);return(0,W.jsx)(NS,{open:e,title:`Open a session`,onClose:t,wide:!0,children:(0,W.jsxs)(`div`,{className:`flex min-h-[20rem] gap-4`,children:[(0,W.jsxs)(`nav`,{className:`w-44 shrink-0 space-y-0.5`,"aria-label":`Devices`,children:[(0,W.jsxs)(`button`,{type:`button`,onClick:()=>a(`local`),"aria-current":i===`local`?`true`:void 0,className:U(`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm`,i===`local`?`bg-accent-soft font-medium text-accent`:`text-fg-muted hover:bg-surface-2`),children:[(0,W.jsx)(K.Monitor,{className:`w-3.5 h-3.5`}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:n.connection.hostName??`This PC`}),(0,W.jsx)(MS,{tone:`ok`,children:`local`})]}),c.map(e=>(0,W.jsxs)(`button`,{type:`button`,onClick:()=>a(e.hostId),"aria-current":i===e.hostId?`true`:void 0,className:U(`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm`,i===e.hostId?`bg-accent-soft font-medium text-accent`:`text-fg-muted hover:bg-surface-2`),children:[(0,W.jsx)(K.Monitor,{className:`w-3.5 h-3.5`}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label||e.hostName}),(0,W.jsx)(`span`,{className:U(`h-1.5 w-1.5 shrink-0 rounded-full`,e.online?`bg-ok`:`bg-fg-faint`),"aria-label":e.online?`online`:`offline`})]},e.hostId)),c.length===0?(0,W.jsx)(`div`,{className:`px-2 pt-3 text-[11px] text-fg-faint`,children:Ene(n.remote)}):null]}),(0,W.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,W.jsx)(`input`,{className:AS,placeholder:`Filter sessions`,"aria-label":`Filter sessions`,value:o,onChange:e=>s(e.target.value)}),f?(0,W.jsx)(`div`,{className:`mt-2 rounded-md bg-warn-soft px-3 py-2 text-xs text-warn`,"data-testid":`picker-unreachable`,children:f}):null,(0,W.jsx)(`div`,{className:`mt-2 min-h-0 flex-1 overflow-y-auto rounded-md border border-border`,children:(0,W.jsx)(Dne,{sessions:p,readOnly:l!==null&&!l.online,onOpen:e=>{if(l){r.openRemoteSession(l.hostId,e),t();return}r.selectSession(e),t()}})}),(0,W.jsx)(`div`,{className:`mt-2 flex justify-end`,children:(0,W.jsxs)(q,{variant:`primary`,onClick:()=>{r.newTab(),t()},children:[(0,W.jsx)(K.Plus,{className:`w-4 h-4`}),` New chat here`]})})]})]})})}function kne(){let{state:e,actions:t}=G(),n=dS(),r=n?e.remote.tabs[n]:void 0;if(!r)return null;let i=r.detail===`backpressure`;return(0,W.jsxs)(`div`,{className:U(`flex items-center gap-2 px-3 py-1.5 text-xs`,r.live?`bg-accent-soft text-accent`:`bg-warn-soft text-warn`),role:`status`,"data-testid":`remote-banner`,children:[(0,W.jsx)(K.Monitor,{className:`w-3.5 h-3.5 shrink-0`}),r.live?(0,W.jsxs)(`span`,{className:`flex-1`,children:[`This session runs on `,(0,W.jsx)(`strong`,{children:r.hostName}),`. This window is a live view — that PC executes every tool.`]}):i?(0,W.jsxs)(`span`,{className:`flex-1`,children:[(0,W.jsx)(`strong`,{children:r.hostName}),` could not keep up with the stream (backpressure) — reconnecting and catching up…`]}):(0,W.jsxs)(`span`,{className:`flex-1`,children:[(0,W.jsx)(`strong`,{children:r.hostName}),` is not reachable`,r.detail?` (${r.detail})`:``,` — this chat is kept only on that PC, so this view is read-only and shows what was read from it. Bring that PC online to continue.`]}),r.live?null:(0,W.jsx)(`button`,{type:`button`,onClick:()=>void t.openRemoteSession(r.hostId,r.sessionId),className:`shrink-0 rounded border border-current/40 px-2 py-0.5 text-[11px] font-medium hover:bg-black/5`,"data-testid":`remote-reconnect`,children:`Reconnect`})]})}function uC(){let{state:e}=G(),t=dS();if(!t)return!1;let n=e.remote.tabs[t];return n?!n.live:!1}function dC(){let{state:e}=G(),t=pS();if(!t)return null;let n=e.pendingRouting[t.id];if(!n&&t.customModel===!0||(n?ng(n.providerId,n.model):t.autoModel))return null;let r={providerId:n?.providerId??t.providerId,model:n?.model??t.model};return fee(e.providers,r)?r.model??null:null}function Ane(e,t,n){return n?null:t?t.customModel&&t.model?t.model:null:e?.customModel===!0&&e.model?e.model:null}function jne(){let{state:e}=G(),t=pS(),n=mS(),r=dS();return Ane(t,n,r?e.pendingRouting[r]!==void 0:!1)}var Mne=`next message`;function Nne(e){let t=e.now?`Until then this chat keeps running on ${e.now}.`:`Until then this chat keeps running on the model it has now.`,n=e.working?` This chat is working, so that message waits for the current turn to finish — use Send now on it to cut the step and switch at once.`:``;return`${e.pick} is picked but not in use yet: it takes effect with your next message. ${t}${n}`}function Pne(e,t,n){let r=t?.engineSince,i=cl(e,{alive:t==null||r===void 0?null:r!==null,since:r&&Date.parse(r)||null});if(!i)return null;let{fallbackModel:a,originalModel:o,category:s}=i.notice,c=a?ul(a,n):`another model`;return{fallbackModel:a,fallbackName:c,originalName:o?ul(o,n):null,category:s,chipLabel:dl(c),track:i}}function Fne(e,t,n){let r=e.originalName??t??`The chat’s model`,i=e.category?` (${e.category})`:``,a=t??e.originalName??`the chat’s model`;return[`${r}’s safeguards flagged this chat${i}, so the engine moved it to ${e.fallbackName} for the rest of this run.`,n?null:`OonaCode does not offer ${e.fallbackName} for picking — it only runs as this fallback.`,`Pick a model (or send after the agent restarts) to go back to ${a}.`].filter(e=>e!==null).join(` `)}function Ine(){let{state:e}=G(),t=fS(),n=pS(),r=t?.safeguardFallback??null,i=t?.session??n,a=i!=null,o=i?i.engineSince:void 0,s=n?e.pendingRouting[n.id]!==void 0:!1,c=e.providers;return(0,v.useMemo)(()=>s||!r?null:Pne(r,a?{engineSince:o}:null,c),[r,s,a,o,c])}function Lne(e){let{session:t,isDraft:n,staged:r,pick:i}=e;if(r)return ng(r.providerId,r.model)?{routedModel:null,note:null}:null;if(n)return ng(i.providerId,i.modelId)?{routedModel:null,note:null}:null;let a=t?.autoModel;if(a){let e=t?.providerId===`oonacode`&&t.model&&t.model!==`auto`?t.model:null;return{routedModel:a.model??e,note:a.note??null}}return t&&ng(t.providerId,t.model)?{routedModel:null,note:null}:null}function fC(){let{state:e}=G(),t=pS(),n=mS(),r=dS(),i=r?e.pendingRouting[r]:void 0;return(0,v.useMemo)(()=>{let r=Sm(e.providers,{providerId:i?.providerId??n?.providerId??t?.providerId??e.activeProviderId,model:i?.model??n?.model??t?.model??e.info?.activeModel,variantId:i?.variantId??n?.variantId??t?.variantId??null}),a=Lne({session:t,isDraft:n!=null,staged:i,pick:r}),o=a?Sm(e.providers,{providerId:w,model:Lee,variantId:null}):r,s=(e.providers.find(e=>e.definition.id===o.providerId)?.definition)?.models.find(e=>e.id===o.modelId)??null;return{...o,option:s,auto:a}},[e.providers,e.activeProviderId,e.info?.activeModel,i,n,t])}function Rne(e){let t=e.toLowerCase();return t===`#000000`||t===`#000`?void 0:e}function pC({providerId:e,displayName:t,size:n=14,className:r}){let i=Dc(e);if(!i)return(0,W.jsx)(`span`,{"aria-hidden":`true`,"data-provider-mark":e,className:U(`inline-flex flex-shrink-0 items-center justify-center rounded-sm bg-fg/10 font-semibold text-fg-muted`,r),style:{width:n,height:n,fontSize:Math.round(n*.55),lineHeight:1},children:Oc(t)});let a=Rne(i.hex);return(0,W.jsx)(`svg`,{"aria-hidden":`true`,"data-provider-mark":e,viewBox:`0 0 24 24`,width:n,height:n,className:U(`flex-shrink-0`,a?void 0:`text-fg`,r),style:{width:n,height:n},children:(0,W.jsx)(`path`,{d:i.d,fill:a??`currentColor`,fillRule:i.fillRule})})}var zne={ok:`bg-ok`,warn:`bg-warn`,danger:`bg-danger`,neutral:`bg-fg-faint`},Bne={ok:`text-ok`,warn:`text-warn`,danger:`text-danger`,neutral:`text-fg-muted`},Vne={agy:`agy’s own usage report`,"grok-billing":`xAI’s usage report`,"kimi-usages":`Kimi’s usage report`,"response-headers":`the provider’s last answer`,"subscription-usage":`the provider’s last answer`,"engine-rate-limit":`your plan’s own report`};function Hne(e){let t=e?.message?.trim();if(t)return t;switch(e?.reason){case`no_data_yet`:return`No usage reported yet — send a message first.`;case`unavailable`:return`Usage could not be read right now.`;case`not_linked`:return`No usage to show for this provider.`;default:return`This provider does not report usage that OonaCode can read. If it should, send a message and look again.`}}var mC=new WeakMap,hC=new WeakMap;function gC(e){let t=mC.get(e);return t||(t=new Map,mC.set(e,t)),t}function Une(e,t){if(e?.refreshing)return 0;let n=mc;if(e&&!e.stale&&e.fetchedAt&&e.staleAfterMinutes){let r=Date.parse(e.fetchedAt);Number.isFinite(r)&&(n=Math.min(n,Math.max(0,r+e.staleAfterMinutes*6e4-t)))}return n}var Wne=2500,Gne=8;function Kne(e){let{api:t}=G(),[n,r]=(0,v.useState)({id:null,loading:!1,answer:null}),[i,a]=(0,v.useState)(!1),[o,s]=(0,v.useState)(0),c=(0,v.useRef)(!0);(0,v.useEffect)(()=>(c.current=!0,()=>{c.current=!1}),[]),(0,v.useEffect)(()=>{if(!e||!t.getProviderUsage){r({id:e,loading:!1,answer:null});return}let n=gC(t),i=n.get(e);if(i&&Date.now()-i.at<Une(i.answer,i.at)){r({id:e,loading:!1,answer:i.answer});return}let a=!0,o=null,s=0,c=l=>{l&&r({id:e,loading:!0,answer:i?.answer??null}),t.getProviderUsage(e).then(e=>e,()=>null).then(t=>{t?.refreshing===!0?n.delete(e):n.set(e,{at:Date.now(),answer:t}),a&&(r({id:e,loading:!1,answer:t}),t?.refreshing===!0&&s<Gne&&(s+=1,o=setTimeout(()=>c(!1),Wne)))})};return c(!0),()=>{a=!1,o&&clearTimeout(o)}},[t,e]);let l=(0,v.useCallback)(()=>{if(!e||!t.getProviderUsage)return;let n=hC.get(t);n||(n=new Map,hC.set(t,n));let i=n.get(e)??0;Date.now()-i<6e4||(n.set(e,Date.now()),s(Date.now()+gc),a(!0),t.getProviderUsage(e,{refresh:!0}).then(e=>e,()=>null).then(n=>{n?.refreshing===!0?gC(t).delete(e):gC(t).set(e,{at:Date.now(),answer:n}),c.current&&(a(!1),r({id:e,loading:!1,answer:n}))}))},[t,e]),u=(e?hC.get(t)?.get(e)??0:0)+gc,d=n.id===e?n.answer:null;return{loading:n.id===e?n.loading:e!==null,answer:d,checking:i||d?.refreshing===!0,checkNow:l,checkBlockedUntil:Math.max(o,u>Date.now()?u:0)}}function qne(){let[e,t]=(0,v.useState)(()=>Date.now());return(0,v.useEffect)(()=>{let e=setInterval(()=>t(Date.now()),1e3);return()=>clearInterval(e)},[]),e}function Jne(e,t){let n=Date.parse(e);if(!Number.isFinite(n))return null;let r=Math.round((n-t)/1e3);if(r<=0)return null;if(r<60)return`in ${r}s`;let i=Math.floor(r/60);if(i<60)return`in ${i}m`;let a=Math.floor(i/60);return a<24?`in ${a}h${i%60?` ${i%60}m`:``}`:`in ${Math.floor(a/24)}d${a%24?` ${a%24}h`:``}`}function Yne(e,t){let n=Date.parse(e);if(!Number.isFinite(n))return``;let r=Math.max(0,Math.round((t-n)/1e3));if(r<45)return`seen just now`;let i=Math.round(r/60);if(i<60)return`seen ${Math.max(1,i)} min ago`;let a=Math.floor(i/60);return a<24?`seen ${a} h ago`:`seen ${Math.floor(a/24)} d ago`}function _C(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString(void 0,{weekday:`short`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function vC(e,t){return Js(e).toLowerCase()===Js(t).toLowerCase()}function Xne(e,t){if(t.length===0)return!1;if(e.model)return t.some(t=>vC(t,e.model));let n=e.title.lastIndexOf(` · `);if(n<0)return!1;let r=e.title.slice(n+3);return t.some(e=>vC(e,r))}function Zne(e,t){let n=e.family?.toLowerCase();return!!n&&t.some(e=>e.toLowerCase().includes(n))}function Qne(e,t){let n=t?.ids??[],r=e.map((e,t)=>{let r=e.bars.map(e=>({bar:e,mine:Zne(e,n)})),i=[...r.keys()].sort((e,t)=>Number(r[t].mine)-Number(r[e].mine)||e-t);return{group:{...e,bars:i.map(e=>r[e].bar)},forModel:Xne(e,n),barsForModel:i.map(e=>r[e].mine),index:t}});return r.sort((e,t)=>Number(t.forModel)-Number(e.forModel)||e.index-t.index),r.map(({group:e,forModel:t,barsForModel:n})=>({group:e,forModel:t,barsForModel:n}))}function $ne({bar:e,now:t,forModel:n}){let r=e.usedPct===null?null:Math.max(0,Math.min(100,e.usedPct)),i=pc(r===null?null:100-r),a=e.resetsAt?Jne(e.resetsAt,t):null,o=!!e.resetsAt&&a===null;return(0,W.jsxs)(`div`,{"data-testid":`provider-usage-bar`,"data-tone":i,"data-for-model":n?`true`:void 0,children:[(0,W.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2 text-[11px]`,children:[(0,W.jsxs)(`span`,{className:`truncate text-fg`,children:[e.label,n?(0,W.jsx)(`span`,{className:`ml-1 rounded bg-accent-soft px-1 text-[9px] font-medium text-accent`,children:`this model`}):null]}),(0,W.jsx)(`span`,{className:U(`shrink-0 font-medium tabular-nums`,Bne[i]),children:r===null?`—`:`${Math.round(r)}% used`})]}),(0,W.jsx)(`div`,{className:`mt-1 h-1.5 w-full overflow-hidden rounded-full bg-fg/10`,role:`progressbar`,"aria-label":`${e.label} used`,"aria-valuemin":0,"aria-valuemax":100,...r===null?{}:{"aria-valuenow":Math.round(r)},children:(0,W.jsx)(`div`,{className:U(`h-full rounded-full`,zne[i]),style:{width:`${r??0}%`}})}),e.detail||e.resetsAt?(0,W.jsxs)(`div`,{className:`mt-0.5 flex items-baseline justify-between gap-2 text-[10px] text-fg-faint`,children:[(0,W.jsx)(`span`,{className:`truncate`,children:e.detail??``}),e.resetsAt?(0,W.jsx)(`span`,{className:`shrink-0 tabular-nums`,title:o?`This window reset at ${_C(e.resetsAt)}; the figure beside it was taken before that.`:`Resets ${_C(e.resetsAt)}`,"data-testid":`provider-usage-reset`,children:o?`reset — awaiting new figures`:`resets ${a}`}):null]}):null]})}function yC({providerId:e,label:t,direct:n,side:r,active:i=null,note:a,id:o,anchor:s,onPointerEnter:c,onPointerLeave:l}){let{loading:u,answer:d,checking:f,checkNow:p,checkBlockedUntil:m}=Kne(e),h=qne(),g=d?.groups??[],_=Qne(g,i),v=(d?.source??[]).map(e=>Vne[e]),y=[...new Set(v)].join(` and `),b=h<m,x=s?{left:s.left}:void 0,S=d?.staleAfterMinutes??null;return(0,W.jsxs)(`div`,{id:o,role:`group`,"aria-label":`${t} usage`,"data-testid":`provider-usage-card`,"data-provider":e,"data-anchor":s?s.above?`above`:`below`:void 0,onPointerEnter:c,onPointerLeave:l,style:x,className:U(`absolute max-h-[22rem] w-[19rem] overflow-y-auto rounded-lg border border-border bg-surface p-3 shadow-lg`,s?U(`z-50`,s.above?`bottom-full mb-1`:`top-full mt-1`):U(`top-0 z-10`,r===`right`?`left-full ml-2`:`right-full mr-2`)),children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,W.jsx)(pC,{providerId:e,displayName:t,size:13}),(0,W.jsx)(`span`,{className:`truncate text-xs font-semibold text-fg`,children:t}),(0,W.jsx)(`span`,{className:`ml-auto shrink-0 text-[10px] font-semibold uppercase tracking-wide text-fg-faint`,children:`Usage`})]}),(0,W.jsx)(`div`,{className:`mt-0.5 text-[10px] text-fg-faint`,children:n?`Your own plan — runs straight from this PC, never through our servers.`:`Your own key — sent from this PC straight to the provider.`}),i?(0,W.jsxs)(`div`,{className:`mt-1 text-[11px] text-fg`,"data-testid":`provider-usage-active`,children:[`Active model: `,(0,W.jsx)(`span`,{className:`font-medium`,children:i.label})]}):null,a?(0,W.jsx)(`div`,{className:`mt-1 text-[11px] leading-snug text-fg-muted`,"data-testid":`provider-usage-note`,children:a}):null,g.length>0?(0,W.jsx)(`div`,{className:`mt-2 space-y-3 border-t border-border pt-2`,children:_.map(({group:e,forModel:t,barsForModel:n},r)=>(0,W.jsxs)(`section`,{"data-testid":`provider-usage-group`,"data-for-model":t?`true`:void 0,children:[(0,W.jsxs)(`div`,{className:`mb-1.5 flex items-baseline gap-1 text-[10px] font-semibold uppercase tracking-wide text-fg-muted`,children:[(0,W.jsx)(`span`,{className:`truncate`,children:e.title}),t?(0,W.jsx)(`span`,{className:`shrink-0 rounded bg-accent-soft px-1 text-[9px] font-medium normal-case tracking-normal text-accent`,children:`this model`}):null]}),(0,W.jsx)(`div`,{className:`space-y-2`,children:e.bars.map((e,r)=>(0,W.jsx)($ne,{bar:e,now:h,forModel:t||n[r]===!0},`${e.label}-${r}`))})]},`${e.title}-${r}`))}):(0,W.jsx)(`div`,{className:`mt-2 border-t border-border pt-2 text-[11px] leading-snug text-fg-muted`,"data-testid":`provider-usage-empty`,children:u||f?`Reading usage…`:Hne(d)}),g.length>0&&d?.fetchedAt?(0,W.jsxs)(`div`,{className:U(`mt-2 border-t border-border pt-1.5 text-[10px]`,d.stale&&!f?`text-warn`:`text-fg-faint`),"data-testid":`provider-usage-updated`,"data-stale":d.stale?`true`:void 0,title:new Date(d.fetchedAt).toLocaleString(),children:[Yne(d.fetchedAt,h),d.stale&&!f&&S?` — older than ${S} min`:``,y?` · from ${y}`:``,u||f?` · checking…`:``]}):null,d?.pingNote&&!f?(0,W.jsx)(`div`,{className:`mt-1 text-[10px] leading-snug text-warn`,"data-testid":`provider-usage-ping-note`,children:d.pingNote}):null,d?.pingEnabled?(0,W.jsxs)(`div`,{className:`mt-1.5 flex items-center justify-between gap-2`,children:[(0,W.jsxs)(`span`,{className:`text-[10px] text-fg-faint`,children:[`A check spends a few tokens of your own `,n?`plan`:`key`,`.`]}),(0,W.jsx)(`button`,{type:`button`,className:`shrink-0 rounded border border-border px-1.5 py-0.5 text-[10px] text-fg hover:border-fg-faint disabled:opacity-50`,"data-testid":`provider-usage-check-now`,disabled:f||b,onClick:p,children:f?`Checking…`:`Check now`})]}):null]})}function bC(e){if(e>=1e6){let t=e/1e6;return`${Number.isInteger(t)?t:t.toFixed(1)}M`}return e>=1e3?`${Math.round(e/1e3)}K`:String(e)}function ere({m:e}){if(e.details.auto)return null;let{intelligence:t,coding:n,outputTps:r,contextWindow:i,thinking:a,vision:o}=e.details;return t===void 0&&n===void 0&&r===void 0&&i===void 0&&!a&&!o?null:(0,W.jsxs)(`span`,{className:`ml-auto flex flex-shrink-0 items-center gap-2 pl-3 text-[10px] leading-none tabular-nums`,children:[a?(0,W.jsx)(`span`,{className:`text-think`,title:`Reasoning / extended thinking`,children:`✦`}):null,o?(0,W.jsx)(`span`,{className:`text-fg-faint`,title:`Accepts images`,children:`◉`}):null,i===void 0?null:(0,W.jsx)(`span`,{className:`text-fg-faint`,title:`${i.toLocaleString()} token context`,children:bC(i)}),t===void 0?null:(0,W.jsxs)(`span`,{className:`rounded-sm bg-fg/10 px-1 py-px font-semibold text-fg-muted`,title:`Artificial Analysis intelligence index — their measurement, not ours`,children:[`IQ `,Math.round(t)]}),n===void 0?null:(0,W.jsxs)(`span`,{className:`rounded-sm bg-accent/15 px-1 py-px font-semibold text-accent`,title:`Artificial Analysis coding index — their measurement, not ours`,children:[`</>`,` `,Math.round(n)]}),r===void 0?null:(0,W.jsxs)(`span`,{className:`text-fg-faint`,title:`Artificial Analysis median output speed, tokens per second`,children:[Math.round(r),` t/s`]})]})}var xC=`Credits per 1M tokens. The lower figure is the subscription lane the pool tries first; the higher one applies when the request is served by the pay-as-you-go key instead.`;function SC({label:e,value:t,hint:n}){return t===null?null:(0,W.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,W.jsx)(`span`,{className:`text-fg-faint`,children:e}),(0,W.jsx)(`span`,{className:`text-right font-mono tabular-nums text-fg-muted`,title:n,children:t})]})}function tre({m:e,group:t,side:n}){let r=e.details;if(r.auto)return(0,W.jsx)(nre,{m:e,group:t,side:n});let i=r.creditsPerM,a=[{label:`thinking`,on:r.thinking===!0},{label:`tools`,on:r.tools===!0},{label:`vision`,on:r.vision===!0}],o=r.intelligence!==void 0||r.coding!==void 0||r.outputTps!==void 0||r.ttft!==void 0,s=Object.entries(r.aa?.benchmarks??{}).filter(([e])=>e!==`artificial_analysis_intelligence_index`&&e!==`artificial_analysis_coding_index`).map(([e,t])=>({id:e,value:t,meta:Ns[e]})).sort((e,t)=>(e.meta?.label??e.id).localeCompare(t.meta?.label??t.id)),c=r.aa?.fetchedAt?new Date(r.aa.fetchedAt):null;return(0,W.jsxs)(`div`,{"data-testid":`model-details`,className:U(`absolute top-0 z-10 max-h-[22rem] w-[19rem] overflow-y-auto rounded-lg border border-border bg-surface p-3 shadow-lg`,n===`right`?`left-full ml-2`:`right-full mr-2`),children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,W.jsx)(pC,{providerId:e.providerId,displayName:t,size:13}),(0,W.jsx)(`span`,{className:`truncate text-xs font-semibold text-fg`,children:e.label}),e.free?(0,W.jsx)(wC,{}):null]}),(0,W.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-[10px] text-fg-faint`,title:e.modelId,children:e.modelId}),(0,W.jsxs)(`div`,{className:`text-[10px] text-fg-faint`,children:[t,r.aa?.creator?` · by ${r.aa.creator}`:``,r.aa?.releaseDate?` · released ${r.aa.releaseDate}`:``]}),(0,W.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1 border-t border-border pt-2`,children:a.map(e=>(0,W.jsx)(`span`,{"data-testid":`cap-${e.label}`,"data-on":e.on,className:U(`rounded px-1.5 py-0.5 text-[10px]`,e.on?`bg-ok/15 text-ok`:`bg-fg/5 text-fg-faint line-through`),children:e.label},e.label))}),(0,W.jsxs)(`div`,{className:`mt-2 space-y-1 border-t border-border pt-2 text-[11px]`,children:[(0,W.jsx)(SC,{label:`Context`,value:r.contextWindow===void 0?null:bC(r.contextWindow),hint:r.contextWindow===void 0?void 0:`${r.contextWindow.toLocaleString()} tokens`}),(0,W.jsx)(SC,{label:`Max output`,value:r.maxOutputTokens===void 0?null:bC(r.maxOutputTokens),hint:r.maxOutputTokens===void 0?void 0:`${r.maxOutputTokens.toLocaleString()} tokens`}),(0,W.jsx)(SC,{label:r.providers&&r.providers.length>1?`Providers`:`Provider`,value:r.providers&&r.providers.length>0?r.providers.join(`, `):null,hint:`Which backend the pool sends this model to — the subscription lane first, whichever provider holds it.`}),(0,W.jsx)(SC,{label:`Input / 1M tokens`,value:i?Vd(i.input,i.maxInput):null,hint:i?.maxInput===void 0?void 0:xC}),(0,W.jsx)(SC,{label:`Output / 1M tokens`,value:i?Vd(i.output,i.maxOutput):null,hint:i?.maxOutput===void 0?void 0:xC})]}),o||s.length>0?(0,W.jsxs)(`div`,{className:`mt-2 border-t border-border pt-2`,"data-testid":`model-details-aa`,children:[(0,W.jsxs)(`div`,{className:`mb-1 flex items-baseline justify-between gap-2`,children:[(0,W.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wide text-fg-faint`,children:`Independent ratings`}),(0,W.jsxs)(`span`,{className:`text-[10px] text-fg-faint`,children:[`Artificial Analysis`,c?` · ${c.toLocaleDateString()}`:``]})]}),(0,W.jsx)(CC,{label:`Intelligence`,value:r.intelligence}),(0,W.jsx)(CC,{label:`Coding`,value:r.coding}),(0,W.jsxs)(`div`,{className:`mt-1 space-y-1 text-[11px]`,children:[(0,W.jsx)(SC,{label:`Speed`,value:r.outputTps===void 0?null:`${Math.round(r.outputTps)} tok/s`,hint:`Median output tokens per second`}),(0,W.jsx)(SC,{label:`First answer`,value:r.ttft===void 0?null:`${r.ttft.toFixed(2)}s`,hint:`Median time to the first answer token — after reasoning, which is what you wait for`})]}),s.length>0?(0,W.jsx)(`div`,{className:`mt-1.5 space-y-1 border-t border-border pt-1.5 text-[11px]`,children:s.map(e=>(0,W.jsx)(SC,{label:e.meta?.label??e.id,value:rre(e.value,e.meta?.scale),hint:e.meta?void 0:`Reported by Artificial Analysis as "${e.id}"`},e.id))}):null]}):null,r.notes?(0,W.jsx)(`div`,{className:`mt-2 border-t border-border pt-2 text-[10px] leading-snug text-fg-muted`,children:r.notes}):null]})}function nre({m:e,group:t,side:n}){let r=e.details.notes?.trim()||`Auto picks a model from the OonaCode pool for each new message you send. It weighs how complex the task is, how large this chat has grown, and whether a model already has this chat in its cache — moving to another model can mean reading the whole chat afresh, which costs more — along with each model’s speed and cost. It picks the effort too. The button then names the model it chose, for example “Auto (Qwen3.8 Max)”; pick any other model to leave Auto.`;return(0,W.jsxs)(`div`,{"data-testid":`model-details`,"data-auto":`true`,className:U(`absolute top-0 z-10 max-h-[22rem] w-[19rem] overflow-y-auto rounded-lg border border-border bg-surface p-3 shadow-lg`,n===`right`?`left-full ml-2`:`right-full mr-2`),children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,W.jsx)(pC,{providerId:e.providerId,displayName:t,size:13}),(0,W.jsx)(`span`,{className:`truncate text-xs font-semibold text-fg`,children:e.label})]}),(0,W.jsx)(`div`,{className:`text-[10px] text-fg-faint`,children:t}),(0,W.jsx)(`div`,{className:`mt-2 border-t border-border pt-2 text-[11px] leading-snug text-fg-muted`,"data-testid":`model-details-auto`,children:r})]})}function CC({label:e,value:t}){if(t===void 0)return null;let n=Math.max(0,Math.min(100,t));return(0,W.jsxs)(`div`,{className:`mb-1`,"data-testid":`score-${e.toLowerCase()}`,children:[(0,W.jsxs)(`div`,{className:`flex items-baseline justify-between text-[11px]`,children:[(0,W.jsx)(`span`,{className:`text-fg-faint`,children:e}),(0,W.jsx)(`span`,{className:`font-mono tabular-nums text-fg-muted`,children:t.toFixed(1)})]}),(0,W.jsx)(`div`,{className:`mt-0.5 h-1 w-full overflow-hidden rounded-full bg-fg/10`,children:(0,W.jsx)(`div`,{className:`h-full rounded-full bg-accent`,style:{width:`${n}%`}})})]})}function rre(e,t){return t===`index`?e.toFixed(1):t===`fraction`||e>0&&e<=1?`${(e*100).toFixed(1)}%`:e.toFixed(2)}function wC(){return(0,W.jsx)(`span`,{"data-testid":`model-free-badge`,title:`Free on every plan — served from the operator's own capacity, and never billed to you.`,className:`rounded-sm bg-ok/15 px-1 py-px text-[10px] leading-none font-semibold tracking-wide text-ok uppercase`,children:`Free`})}function ire(e,t){return e===`oonacode`?`Runs on the OonaCode pool. A model the pool does not list may be refused when you send.`:`Sent to ${t} exactly as typed — the provider answers or refuses it.`}function are({sectionKey:e,sectionLabel:t,providerId:n,current:r,initial:i,onApply:a}){let[o,s]=(0,v.useState)(!1),[c,l]=(0,v.useState)(``),[u,d]=(0,v.useState)(null),[f,p]=(0,v.useState)(!1),m=ire(n,t),h=async()=>{let e=c.trim();if(!Rh(e)){d(`One model id — letters, digits and . - _ : / — with no spaces.`);return}p(!0);let t=await a(e);p(!1),t&&s(!1)};return o?(0,W.jsxs)(`div`,{className:`px-2 py-1.5`,"data-testid":`custom-model-form-${e}`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,W.jsx)(`input`,{autoFocus:!0,type:`text`,"data-testid":`custom-model-input-${e}`,"aria-label":`Custom model for ${t}`,placeholder:`Model id, e.g. claude-fable-5-1`,spellCheck:!1,className:`min-w-0 flex-1 rounded border border-border bg-surface-2 px-1.5 py-1 font-mono text-xs text-fg outline-none placeholder:font-sans placeholder:text-fg-faint focus:border-accent`,value:c,disabled:f,onChange:e=>{l(e.target.value),d(null)},onKeyDown:e=>{e.stopPropagation(),e.key===`Enter`?(e.preventDefault(),h()):e.key===`Escape`&&(e.preventDefault(),s(!1))}}),(0,W.jsx)(`button`,{type:`button`,"data-testid":`custom-model-apply-${e}`,className:`rounded bg-accent px-2 py-1 text-[11px] font-semibold text-accent-fg disabled:opacity-50`,disabled:f||c.trim()===``,onClick:()=>void h(),children:`Use`})]}),(0,W.jsx)(`div`,{className:U(`mt-1 text-[10px] leading-snug`,u?`text-danger`:`text-fg-faint`),role:u?`alert`:void 0,children:u??m})]}):(0,W.jsxs)(`button`,{type:`button`,"data-testid":`custom-model-entry-${e}`,className:U(`flex w-full items-center gap-1.5 px-2 py-1.5 text-left text-xs hover:bg-fg/5`,r?`text-danger`:`text-fg-faint`),title:m,onClick:()=>{l(r??i),d(null),s(!0)},children:[(0,W.jsx)(K.Plus,{className:`w-3 h-3 flex-shrink-0`,"aria-hidden":`true`}),(0,W.jsx)(`span`,{className:`truncate`,children:r?Hh(r):`Custom model…`})]})}var TC=120,ore=400,sre=200,cre=304,lre=14,EC=40.25;function ure({m:e,selected:t,active:n,providerLabel:r,onHover:i,onPick:a}){return(0,W.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":t,"data-testid":`model-option-${e.value}`,"data-value":e.value,"data-free":e.free?`true`:void 0,"data-cursor":n?`true`:void 0,className:U(`flex w-full items-center gap-1.5 px-2 py-1.5 text-left text-xs`,n?`bg-accent/10`:`hover:bg-fg/5`,t?`text-accent font-semibold`:`text-fg`),onMouseEnter:i,onClick:a,children:[(0,W.jsx)(`span`,{className:U(`truncate`,e.free||t?`font-semibold`:void 0),children:e.label}),r?(0,W.jsx)(`span`,{"data-testid":`model-option-provider`,className:`min-w-0 flex-shrink truncate text-[10px] font-normal text-fg-faint`,children:r}):null,e.free?(0,W.jsx)(wC,{}):null,(0,W.jsx)(ere,{m:e}),t?(0,W.jsx)(`span`,{className:`ml-auto shrink-0 pl-1 text-xs font-bold text-accent`,title:`Selected`,"aria-hidden":`true`,children:`✓`}):null]})}function dre({keyId:e,label:t,providerId:n,count:r,direct:i,usageCard:a,open:o,walking:s,current:c,onPick:l,onHover:u,onLeave:d}){return(0,W.jsxs)(`button`,{type:`button`,role:`menuitem`,"aria-haspopup":`listbox`,"aria-expanded":o,"data-testid":`model-provider-${e}`,"data-open":o?`true`:void 0,title:a?void 0:i?`${t} — runs straight from this PC to the provider, never through our servers.`:t,className:U(`flex w-full items-center gap-1.5 px-2 py-1.5 text-left text-xs`,o?s?`bg-accent/15`:`bg-fg/10`:`hover:bg-fg/5`,c?`font-semibold text-accent`:`text-fg`),onClick:l,onMouseEnter:u,onMouseLeave:d,children:[n===null?(0,W.jsx)(`span`,{"aria-hidden":`true`,className:`flex-shrink-0 rounded-sm bg-fg/10 px-1 text-[9px] leading-snug font-semibold text-fg-muted`,children:`IQ`}):(0,W.jsx)(pC,{providerId:n,displayName:t,size:12}),(0,W.jsx)(`span`,{className:`truncate`,children:t}),(0,W.jsx)(`span`,{className:`ml-auto flex-shrink-0 pl-2 text-[10px] font-normal text-fg-faint tabular-nums`,children:r}),(0,W.jsx)(`span`,{"aria-hidden":`true`,className:`flex-shrink-0 text-fg-faint`,children:`›`})]})}function fre({disabled:e,className:t}){let{state:n,actions:r,api:i}=G(),a=dS(),[o,s]=(0,v.useState)(!1),[c,l]=(0,v.useState)(null),u=(0,v.useRef)(null),d=typeof i.getProviderUsage==`function`,[f,p]=(0,v.useState)(null),m=(0,v.useRef)(null),h=(0,v.useRef)(null),g=(0,v.useRef)(!1),_=(0,v.useId)(),[y,b]=(0,v.useState)(``),[x,S]=(0,v.useState)({}),[C,w]=(0,v.useState)(``),[T,E]=(0,v.useState)(`models`),[D,O]=(0,v.useState)(0),k=(0,v.useRef)(null),A=(0,v.useRef)(null),j=(0,v.useRef)(null),M=(0,v.useRef)(null),N=(0,v.useRef)(null),ee=(0,v.useRef)(null),te=n.settings?.modelVisibility??null,P=(0,v.useMemo)(()=>bm(n.providers,te),[n.providers,te]),F=n.providers.some(e=>e.definition.id===`google-agy`&&e.definition.enabled&&!e.configured),ne=a?n.pendingRouting[a]:void 0,I=fC(),re=I,ie=I.auto,L=re.providerId&&re.modelId?_m(re.providerId,re.modelId,re.variantId):``,R=P.flatMap(e=>e.models).find(e=>e.value===L)??null,z=!R&&L?re.modelId:null,ae=dC(),oe=Ine(),se=jne(),ce=(0,v.useMemo)(()=>{if(!oe?.fallbackModel)return!1;let e=Js(oe.fallbackModel);return P.some(t=>t.models.some(t=>Js(t.modelId)===e))},[oe?.fallbackModel,P]),le=C.trim().toLowerCase(),ue=(0,v.useMemo)(()=>P.flatMap(e=>{if(!le)return[{g:e,models:e.models}];let t=e.models.filter(e=>e.label.toLowerCase().includes(le)||e.modelId.toLowerCase().includes(le));return t.length>0?[{g:e,models:t}]:[]}),[P,le]),de=(0,v.useMemo)(()=>ue.map(e=>xm(e.g)),[ue]),fe=P.find(e=>e.models.some(e=>e.value===L||Cm(e,re)))??null,pe=de.includes(y)?y:de[0]??``,me=ue.find(e=>xm(e.g)===pe)??null,he=me?.g??null,ge=c?ue.find(e=>xm(e.g)===c)?.g??null:null,_e=x[pe]??``,ve=(0,v.useMemo)(()=>{let e=_e.trim().toLowerCase(),t=(me?[me]:[]).flatMap(e=>e.models.map(t=>({m:t,group:e.g.label,details:t.details})));return pee(e?t.filter(t=>t.m.label.toLowerCase().includes(e)||t.m.modelId.toLowerCase().includes(e)):t)},[ue,me,_e]);(0,v.useEffect)(()=>{if(!o)return;let e=ve.findIndex(e=>e.m.value===L);O(e>=0?e:0)},[o,ve,L]);let ye=()=>{ee.current&&=(clearTimeout(ee.current),null)},be=()=>{u.current&&=(clearTimeout(u.current),null),l(null)};(0,v.useEffect)(()=>()=>{ye(),u.current&&clearTimeout(u.current),m.current&&clearTimeout(m.current),h.current&&clearTimeout(h.current)},[]),(0,v.useEffect)(()=>{if(!o)return;let e=e=>{k.current&&!k.current.contains(e.target)&&s(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[o]);let xe=()=>{b(fe?xm(fe):de[0]??``),S({}),w(``),E(`models`),s(!0)},Se=(e=!0)=>{ye(),be(),s(!1),S({}),w(``),e&&(g.current=!0,A.current?.focus(),g.current=!1)},Ce=e=>{r.setSessionModel(e.modelId,e.providerId,e.variantId,a??void 0),Se()},we=e=>{E(e),(e===`providers`?N:M).current?.focus()},Te=e=>{ye(),b(e),we(`models`)},Ee=e=>{ye(),e!==pe&&(ee.current=setTimeout(()=>{ee.current=null,b(e)},TC))},De=(e,t)=>{be(),!(!d||t===`oonacode`)&&(u.current=setTimeout(()=>{u.current=null,l(e)},TC))},Oe=()=>{m.current&&clearTimeout(m.current),h.current&&clearTimeout(h.current),m.current=null,h.current=null},ke=()=>{Oe(),p(null)},Ae=()=>{let e=k.current?.getBoundingClientRect(),t=!1,n=0;if(e){let r=window.innerHeight-e.bottom;t=r>=360?!1:e.top>r,n=Math.max(Math.min(0,window.innerWidth-8-(e.left+cre)),8-e.left)}p({above:t,left:n})},je=()=>{h.current&&=(clearTimeout(h.current),null),!(f||m.current)&&(m.current=setTimeout(()=>{m.current=null,Ae()},ore))},Me=()=>{m.current&&=(clearTimeout(m.current),null),!(!f||h.current)&&(h.current=setTimeout(()=>{h.current=null,p(null)},sre))},Ne=e=>{if(g.current){g.current=!1;return}let t=!0;try{t=e.matches(`:focus-visible`)}catch{t=!0}t&&je()},Pe=e=>{if(e.key===`Escape`){e.preventDefault(),Se();return}let t=e.target instanceof HTMLElement?e.target:null;if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault();let t=e.key===`ArrowDown`?1:-1;if(T===`providers`){let e=de[(de.indexOf(pe)+t+de.length)%de.length];e&&b(e)}else ve.length>0&&O(e=>(e+t+ve.length)%ve.length);return}if(e.key===`Home`||e.key===`End`){if(e.preventDefault(),T===`providers`){let t=de[e.key===`Home`?0:de.length-1];t&&b(t)}else O(e.key===`Home`?0:Math.max(0,ve.length-1));return}if(e.key===`ArrowLeft`){let n=!(t instanceof HTMLInputElement)||t.selectionStart===0&&t.selectionEnd===0;T===`models`&&n&&(e.preventDefault(),we(`providers`));return}if(e.key===`ArrowRight`){let n=!(t instanceof HTMLInputElement)||t.selectionStart===t.value.length&&t.selectionEnd===t.value.length;T===`providers`&&n&&(e.preventDefault(),we(`models`));return}if(e.key===`Enter`){let n=t?.closest(`[role="option"]`);if(n){e.preventDefault();let t=ve.find(e=>e.m.value===n.getAttribute(`data-value`));t&&Ce(t.m);return}if(t?.closest(`button, a`))return;if(e.preventDefault(),T===`providers`){we(`models`);return}let r=ve[D];r&&Ce(r.m)}},[Fe,Ie]=(0,v.useState)(`right`),[Le,Re]=(0,v.useState)(0),[ze,Be]=(0,v.useState)(!0);(0,v.useLayoutEffect)(()=>{if(!o)return;let e=()=>{let e=k.current?.getBoundingClientRect();if(!e)return;let t=Math.min(EC*16,window.innerWidth-16),n=Math.max(Math.min(0,window.innerWidth-8-(e.left+t)),8-e.left);Re(n);let r=e.left+n;Ie(r+t+312<=window.innerWidth?`right`:`left`);let i=window.innerHeight-e.bottom,a=e.top;Be(i>=420?!1:a>i)};return e(),M.current?.focus({preventScroll:!0}),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[o]),(0,v.useEffect)(()=>{o&&(j.current?.querySelector(`[data-cursor="true"]`))?.scrollIntoView({block:`nearest`})},[o,D]);let B=(()=>{let e=ie?.routedModel?Js(ie.routedModel):null;return e?P.filter(e=>e.providerId===`oonacode`).flatMap(e=>e.models).find(t=>Js(t.modelId)===e)?.label??e:null})(),Ve=(ie?B:null)??R?.label??z??null,He=R?.providerId??re.providerId??``,Ue=P.find(e=>e.providerId===He)?.label??He,We=oe?Fne(oe,Ve,ce):null,Ge=oe!==null&&!ae,Ke=se!==null&&!Ge,qe=ie!==null&&!Ge&&!Ke,V=qe?Ree(B):Ve??`No model`,Je=ne!==void 0&&!Ge&&!Ke&&!ae,Ye=(()=>{if(!Je||!a)return null;let e=n.transcripts[a],t=e?.init?.model??null,r=t?P.flatMap(e=>e.models).find(e=>Js(e.modelId)===Js(t))?.label??t:null;return Nne({pick:V,now:r,working:e?.status===`running`||e?.status===`waiting_permission`})})(),Xe=se?`${se} is not a model OonaCode lists — this chat runs on it as it is. Pick a model to leave it, or type another under any provider's Custom model….`:null,Ze=Ge?We:Ke?Xe:Je?Ye:qe?ie?.note??null:null,Qe=d&&!o&&!e&&!ae&&!qe&&!Ge&&!Ke&&He!==``&&He!==`oonacode`?He:null,$e=Qe===null?null:P.find(e=>e.providerId===Qe&&(e.variantId??null)===(re.variantId??null))??P.find(e=>e.providerId===Qe)??null,et=(()=>{let e=re.modelId;if(!e)return null;let t=n.providers.find(e=>e.definition.id===Qe)?.definition.models.find(t=>t.id===e)?.upstreamId;return{label:Ge||Ke?e:R?.label??e,ids:t&&t!==e?[e,t]:[e]}})();(0,v.useEffect)(()=>{Qe===null&&(m.current&&clearTimeout(m.current),h.current&&clearTimeout(h.current),m.current=null,h.current=null,p(null))},[Qe]);let tt=f!==null&&Qe!==null;return(0,W.jsxs)(`span`,{ref:k,className:`relative inline-flex min-w-0 max-w-full items-center gap-1.5`,onBlur:e=>{k.current?.contains(e.relatedTarget)||ke()},children:[(0,W.jsxs)(`button`,{type:`button`,ref:A,"aria-label":`Model`,"aria-haspopup":`listbox`,"aria-expanded":o,"aria-describedby":tt?_:void 0,"data-testid":`model-picker`,disabled:e,onPointerEnter:e=>{e.pointerType!==`touch`&&e.pointerType!==`pen`&&Qe!==null&&je()},onPointerLeave:Me,onFocus:e=>{Qe!==null&&Ne(e.currentTarget)},className:U(`flex max-w-[min(22rem,100%)] min-w-[min(9rem,100%)] items-center gap-1.5 rounded-md border bg-surface-2 px-1.5 py-0.5 text-xs text-fg disabled:opacity-50`,Ge||Ke?`border-danger/60 hover:border-danger`:Je?`border-warn/60 hover:border-warn`:`border-border hover:border-fg-faint`,t),onClick:()=>{ke(),o?Se():xe()},onKeyDown:e=>{if(e.key===`Escape`&&f){ke();return}!o&&(e.key===`ArrowDown`||e.key===`Enter`||e.key===` `)&&(e.preventDefault(),ke(),xe())},title:Qe===null?Ze??void 0:void 0,"aria-description":Qe===null?void 0:Ze??void 0,children:[He?(0,W.jsx)(pC,{providerId:He,displayName:Ue,size:13}):null,Ge?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(K.Shield,{className:`w-3 h-3 flex-shrink-0 text-danger`,"aria-hidden":`true`}),(0,W.jsx)(`span`,{className:`truncate text-danger`,"data-testid":`model-picker-safeguard`,children:oe.chipLabel})]}):Ke?(0,W.jsx)(`span`,{className:`truncate text-danger`,"data-testid":`model-picker-custom`,children:Hh(se)}):qe?(0,W.jsx)(`span`,{className:`truncate`,"data-testid":`model-picker-auto`,children:V}):(0,W.jsx)(`span`,{className:U(`truncate`,ae?`text-danger`:void 0),"data-testid":ae?`model-picker-withdrawn`:void 0,title:ae?`${ae} is no longer offered — pick another model to continue this chat`:void 0,children:V}),R?.free&&!Ge&&!Ke&&!qe?(0,W.jsx)(wC,{}):null,Je?(0,W.jsx)(`span`,{className:`shrink-0 rounded bg-warn-soft px-1 text-[10px] text-warn`,"data-testid":`model-picker-staged`,children:Mne}):null,(0,W.jsx)(`span`,{"aria-hidden":`true`,className:`text-fg-faint`,children:`▾`})]}),tt&&$e&&f?(0,W.jsx)(yC,{id:_,providerId:$e.providerId,label:$e.label,direct:$e.route===`direct`,side:`right`,active:et,note:Ze,anchor:f,onPointerEnter:je,onPointerLeave:Me}):null,o?(0,W.jsxs)(`div`,{"data-testid":`model-picker-panel`,className:U(`absolute z-50 max-w-[calc(100vw-1rem)]`,ze?`bottom-full mb-1`:`top-full mt-1`),style:{width:`${EC}rem`,left:Le},onKeyDown:Pe,children:[(0,W.jsxs)(`div`,{className:`flex h-[26rem] max-h-[70vh] items-stretch gap-1`,children:[(0,W.jsxs)(`div`,{"data-testid":`model-picker-chrome`,className:`flex flex-shrink-0 flex-col overflow-hidden rounded-lg border border-border bg-surface shadow-lg`,style:{width:`${lre}rem`},children:[Ge&&We?(0,W.jsxs)(`div`,{className:`flex items-start gap-1.5 border-b border-danger/40 bg-danger-soft px-2 py-1.5 text-[11px] leading-snug text-danger`,"data-testid":`model-picker-safeguard-note`,role:`note`,children:[(0,W.jsx)(K.Shield,{className:`mt-px w-3 h-3 flex-shrink-0`,"aria-hidden":`true`}),(0,W.jsx)(`span`,{children:We})]}):null,Ke&&Xe?(0,W.jsx)(`div`,{className:`border-b border-danger/40 bg-danger-soft px-2 py-1.5 text-[11px] leading-snug text-danger`,"data-testid":`model-picker-custom-note`,role:`note`,children:Xe}):null,Je&&Ye?(0,W.jsx)(`div`,{className:`border-b border-warn/40 bg-warn-soft px-2 py-1.5 text-[11px] leading-snug text-warn`,"data-testid":`model-picker-staged-note`,role:`note`,children:Ye}):null,(0,W.jsx)(`div`,{className:`border-b border-border p-1.5`,children:(0,W.jsx)(`input`,{ref:N,type:`text`,"data-testid":`model-provider-search`,"aria-label":`Find a model in any provider`,placeholder:`Find a model in any provider…`,className:`w-full rounded border-0 bg-transparent px-1.5 py-1 text-xs text-fg outline-none placeholder:text-fg-faint`,value:C,onFocus:()=>E(`providers`),onChange:e=>{w(e.target.value),E(`providers`)}})}),(0,W.jsxs)(`div`,{role:`menu`,"aria-label":`Provider`,"data-testid":`model-providers`,className:`min-h-0 flex-1 overflow-y-auto py-1`,children:[P.length===0?(0,W.jsx)(`div`,{className:`px-3 py-6 text-center text-xs text-fg-muted`,children:`No provider configured — add one in Settings → Providers`}):P.length>0&&ue.length===0?(0,W.jsxs)(`div`,{className:`px-3 py-6 text-center text-xs text-fg-muted`,"data-testid":`model-providers-empty`,children:[`No model matches “`,C.trim(),`”`]}):null,ue.map(({g:e,models:t})=>{let n=xm(e);return(0,W.jsx)(dre,{keyId:n,label:e.label,providerId:e.providerId,count:t.length,direct:e.route===`direct`,usageCard:d&&e.providerId!==`oonacode`,open:pe===n,walking:T===`providers`,current:e===fe,onPick:()=>Te(n),onHover:()=>{Ee(n),De(n,e.providerId)},onLeave:()=>{ye(),be()}},n)}),F?(0,W.jsx)(`button`,{type:`button`,"data-testid":`model-agy-setup`,className:`flex w-full items-center px-3 py-2 text-left text-xs text-accent hover:bg-fg/5`,onClick:()=>{Se(!1),r.openProviderConnect(Jh)},children:`Set up Gemini on your Google plan…`}):null]}),(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 border-t border-border px-2 py-1.5 text-[11px]`,children:[(0,W.jsx)(`button`,{type:`button`,"data-testid":`manage-models-entry`,className:`text-fg-muted hover:text-fg`,onClick:()=>{Se(!1),r.openDialog(`manage-models`)},children:`Manage models…`}),(0,W.jsx)(`button`,{type:`button`,"data-testid":`manage-providers-entry`,className:`text-fg-muted hover:text-fg`,onClick:()=>{Se(!1),r.openSettings(`providers`)},children:`Manage providers…`}),(0,W.jsx)(`a`,{href:`https://artificialanalysis.ai/`,target:`_blank`,rel:`noreferrer noopener`,className:`text-fg-faint hover:text-fg-muted`,title:`IQ and coding scores are Artificial Analysis's measurements`,children:`ratings by Artificial Analysis`})]})]}),P.length>0?(0,W.jsxs)(`div`,{"data-testid":`model-picker-flyout`,className:`flex min-w-0 flex-1 flex-col overflow-hidden rounded-lg border border-border bg-surface shadow-lg`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-1.5 border-b border-border bg-surface-2 px-2 py-1 text-[10px] font-semibold tracking-wide text-fg-muted uppercase`,children:[he?(0,W.jsx)(pC,{providerId:he.providerId,displayName:he.label,size:12}):null,(0,W.jsx)(`span`,{className:`truncate`,"data-testid":`model-flyout-title`,children:he?he.label:``}),he?.route===`direct`?(0,W.jsx)(`span`,{className:`flex-shrink-0 font-normal tracking-normal text-fg-faint normal-case`,title:`Runs straight from this PC to the provider — never through our servers.`,children:`· direct`}):null,(0,W.jsx)(`span`,{className:`ml-auto flex-shrink-0 font-normal tracking-normal text-fg-faint normal-case`,title:`Best first by Artificial Analysis's intelligence index; models they do not rate come last.`,children:`sorted by IQ`})]}),(0,W.jsx)(`div`,{className:`border-b border-border p-1.5`,children:(0,W.jsx)(`input`,{ref:M,type:`text`,"data-testid":`model-search`,placeholder:he?`Search ${he.label} models…`:`Search all models…`,className:`w-full rounded border-0 bg-transparent px-1.5 py-1 text-xs text-fg outline-none placeholder:text-fg-faint`,value:_e,onFocus:()=>E(`models`),onChange:e=>{S(t=>({...t,[pe]:e.target.value})),E(`models`)}})}),(0,W.jsxs)(`div`,{ref:j,role:`listbox`,"aria-label":`Model`,className:`min-h-0 flex-1 overflow-y-auto`,children:[ve.length===0?(0,W.jsxs)(`div`,{className:`px-3 py-6 text-center text-xs text-fg-muted`,children:[`Nothing matches “`,_e,`”`]}):null,ve.map((e,t)=>(0,W.jsx)(ure,{m:e.m,selected:e.m.value===L||Cm(e.m,re),active:t===D,...he===null?{providerLabel:e.group}:{},onHover:()=>O(t),onPick:()=>Ce(e.m)},e.m.value)),he?(0,W.jsx)(are,{sectionKey:pe,sectionLabel:he.label,providerId:he.providerId,current:se!==null&&he.providerId===re.providerId&&(he.variantId??null)===(re.variantId??null)?se:null,initial:Rh(_e.trim())?_e.trim():``,onApply:async e=>{let t=await r.setSessionCustomModel(e,a??void 0,{providerId:he.providerId,variantId:he.variantId});return t&&Se(),t}}):null]})]}):null]}),ge?(0,W.jsx)(yC,{providerId:ge.providerId,label:ge.label,direct:ge.route===`direct`,side:Fe}):ve[D]?(0,W.jsx)(tre,{m:ve[D].m,group:ve[D].group,side:Fe}):null]}):null]})}var DC=`Not available on this PC yet`,OC=`Sign in first`,pre=`Off: read-only — the agent can look but not change anything. On: it may change things, and asks you before every change.`;function kC(e){return!!e.connector}function AC(e){return`Sign in on ${e?.trim()||`that PC`} — the sign-in opens a browser on that PC`}function mre(e=typeof window>`u`?null:window.location){if(!e)return!1;let t=e.hostname.replace(/^\[|\]$/g,``).toLowerCase();return e.protocol===`file:`||e.protocol===`app:`||e.protocol===`oonacode:`||t===``||t===`localhost`||t===`127.0.0.1`||t===`::1`?!1:!t.endsWith(`.localhost`)}function hre(e){let t=e.cli;return t?t.installed?`${t.command} ${t.version??``}`.trim()+` installed`:`${t.command} CLI not installed${t.installHint?` — ${t.installHint}`:``}`:null}function gre(e){return`Vendor skills: ${e.skills.installed} of ${e.skills.total} installed`}function jC(e){if(e.toolName!==`ConnectorChange`)return null;let t=e.input;if(!t||typeof t!=`object`||typeof t.connector!=`string`||typeof t.vendor!=`string`||typeof t.tool!=`string`)return null;let n=t.arguments;return{connector:t.connector,vendor:t.vendor,tool:t.tool,description:typeof t.description==`string`?t.description:``,arguments:n&&typeof n==`object`&&!Array.isArray(n)?n:{}}}function _re(e,t){return`${t?`Allowed`:`Denied`} ${e.tool} on ${e.vendor}`}var vre=4e3;function yre(e){let t=!1,n=(e,r)=>{if(typeof e==`string`)return e.length<=300?e:(t=!0,`${e.slice(0,300)}…`);if(Array.isArray(e)){if(r>6)return t=!0,`…`;let i=e.slice(0,12).map(e=>n(e,r+1));return e.length>12&&(t=!0,i.push(`… ${e.length-12} more`)),i}if(e&&typeof e==`object`){if(r>6)return t=!0,`…`;let i={};for(let[t,a]of Object.entries(e))i[t]=n(a,r+1);return i}return e},r=JSON.stringify(n(e,0),null,2)??`{}`;return r.length>4e3&&(r=`${r.slice(0,vre)}…`,t=!0),{text:r,shortened:t}}var bre=2e3;function xre(e){return e instanceof sg?e.message||`The PC refused (${e.status}).`:e instanceof Error?e.message:`Something went wrong.`}function Sre(e,t){let[n,r]=(0,v.useState)(null),[i,a]=(0,v.useState)(!1),[o,s]=(0,v.useState)(null),c=(0,v.useRef)(!0);(0,v.useEffect)(()=>(c.current=!0,()=>{c.current=!1}),[]);let l=(0,v.useCallback)(e=>{!e||typeof e!=`object`||typeof e.slug!=`string`||r(t=>({...t??{},[e.slug]:e}))},[]),u=(0,v.useCallback)(async()=>{if(!e.listConnectors){a(!0);return}try{let t=await e.listConnectors();if(!c.current)return;a(!1),r(Object.fromEntries(t.connectors.map(e=>[e.slug,e])))}catch(e){if(!c.current)return;dg(e)&&a(!0)}},[e]);(0,v.useEffect)(()=>{t&&u()},[t,u]);let d=Object.values(n??{}).some(e=>e.state===`connecting`);(0,v.useEffect)(()=>{if(!t||!d)return;let e=setInterval(()=>void u(),bre);return()=>clearInterval(e)},[t,d,u]);let f=(0,v.useCallback)(async(e,t)=>{if(!t)return a(!0),!1;s(null);try{let e=await t();return!c.current||(e&&typeof e==`object`&&`slug`in e&&`state`in e&&l(e),await u(),!0)}catch(t){return c.current&&(dg(t)?a(!0):s({slug:e,message:xre(t)})),!1}},[l,u]);return{byslug:n,unavailable:i,error:o,refresh:u,signIn:(t,n)=>f(t,e.signInConnector?()=>e.signInConnector(t,n):void 0),signOut:t=>f(t,e.signOutConnector?()=>e.signOutConnector(t):void 0),setAllowChanges:(t,n)=>f(t,e.updateConnector?()=>e.updateConnector(t,{allowChanges:n}):void 0),installSkills:t=>f(t,e.installConnectorSkills?()=>e.installConnectorSkills(t):void 0),clearError:()=>s(null)}}function MC(e){return e&&/^https?:\/\/\S+$/i.test(e)?e:null}var Cre={"signed-out":`text-fg-muted`,connecting:`text-accent`,connected:`text-ok`,expired:`text-warn`,error:`text-danger`};function wre({pack:e,status:t,view:n,remoteName:r,onSignIn:i}){let a=e.connector,[o,s]=(0,v.useState)(!1),[c,l]=(0,v.useState)(null),u=(0,v.useRef)(null);(0,v.useEffect)(()=>()=>{u.current&&clearTimeout(u.current)},[]);let d=async(e,t)=>{l(e);try{await t()}finally{l(null)}};if(n.unavailable)return(0,W.jsx)(`p`,{className:`mt-1 text-[11px] text-fg-faint`,"data-testid":`connector-unavailable-${e.slug}`,children:DC});if(!t)return null;let f=MC(t.signInUrl),p=r!==null,m=hre(t),h=t.cli&&!t.cli.installed?t.cli.installHint:null,g=t.skills.total>0&&t.skills.installed<t.skills.total,_=t.state===`connected`,y=t.state===`signed-out`||t.state===`expired`||t.state===`error`,b=async e=>{try{await navigator.clipboard?.writeText(e),s(!0),u.current&&clearTimeout(u.current),u.current=setTimeout(()=>s(!1),1500)}catch{}};return(0,W.jsxs)(`div`,{className:`mt-1.5 space-y-1.5 text-[11px]`,"data-testid":`connector-${e.slug}`,"data-state":t.state,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,W.jsx)(`span`,{className:U(`font-medium`,Cre[t.state]),"data-testid":`connector-state-${e.slug}`,children:pu(t.state)}),t.account?(0,W.jsx)(`span`,{className:`truncate text-fg-muted`,"data-testid":`connector-account-${e.slug}`,children:t.account}):null,_?(0,W.jsx)(q,{size:`sm`,variant:`ghost`,busy:c===`out`,"data-testid":`connector-sign-out-${e.slug}`,onClick:()=>void d(`out`,()=>n.signOut(e.slug)),children:`Sign out`}):null,y&&!p?(0,W.jsx)(q,{size:`sm`,variant:`inverse`,"data-testid":`connector-sign-in-${e.slug}`,onClick:i,children:t.state===`signed-out`?`Sign in`:`Sign in again`}):null,t.state===`connecting`&&!p?(0,W.jsxs)(W.Fragment,{children:[f?(0,W.jsx)(`a`,{href:f,target:`_blank`,rel:`noreferrer noopener`,className:`text-accent underline`,"data-testid":`connector-sign-in-link-${e.slug}`,children:`Open the sign-in page`}):null,(0,W.jsx)(q,{size:`sm`,variant:`ghost`,busy:c===`cancel`,"data-testid":`connector-cancel-${e.slug}`,onClick:()=>void d(`cancel`,()=>n.signOut(e.slug)),children:`Cancel`})]}):null]}),y&&p?(0,W.jsx)(`p`,{className:`text-fg-muted`,"data-testid":`connector-remote-${e.slug}`,children:AC(r)}):null,t.state===`connecting`&&p?(0,W.jsx)(`p`,{className:`text-fg-muted`,"data-testid":`connector-remote-${e.slug}`,children:AC(r)}):null,(t.state===`error`||t.state===`expired`)&&t.message?(0,W.jsx)(`p`,{className:`text-fg-muted`,"data-testid":`connector-message-${e.slug}`,children:t.message}):null,_?(0,W.jsx)(`div`,{className:`-my-1`,"data-testid":`connector-allow-${e.slug}`,children:(0,W.jsx)(PS,{checked:t.allowChanges,label:`Allow changes`,hint:pre,disabled:c===`allow`,onChange:t=>void d(`allow`,()=>n.setAllowChanges(e.slug,t))})}):null,n.error?.slug===e.slug?(0,W.jsx)(`p`,{className:`text-danger`,role:`alert`,"data-testid":`connector-error-${e.slug}`,children:n.error.message}):null,t.cli||t.skills.total>0?(0,W.jsxs)(`div`,{className:`rounded border border-border bg-surface-2/50 px-2 py-1.5`,"data-testid":`connector-needs-${e.slug}`,children:[(0,W.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wide text-fg-faint`,children:`Needs on this PC`}),m?(0,W.jsxs)(`div`,{className:`mt-1`,"data-testid":`connector-cli-${e.slug}`,children:[(0,W.jsxs)(`div`,{className:`flex items-start gap-1.5`,children:[(0,W.jsx)(`span`,{className:`min-w-0 flex-1 break-words text-fg`,children:m}),h?(0,W.jsxs)(q,{size:`sm`,variant:`ghost`,"data-testid":`connector-copy-${e.slug}`,onClick:()=>void b(h),children:[(0,W.jsx)(K.Copy,{className:`w-3 h-3`}),` `,o?`Copied`:`Copy`]}):null]}),a.cli?.purpose?(0,W.jsx)(`div`,{className:`text-fg-faint`,children:a.cli.purpose}):null]}):null,t.skills.total>0?(0,W.jsxs)(`div`,{className:`mt-1 flex items-center gap-1.5`,"data-testid":`connector-skills-${e.slug}`,children:[(0,W.jsx)(`span`,{className:`min-w-0 flex-1 text-fg`,children:gre(t)}),g?(0,W.jsx)(q,{size:`sm`,variant:`secondary`,busy:c===`skills`,"data-testid":`connector-install-skills-${e.slug}`,onClick:()=>void d(`skills`,()=>n.installSkills(e.slug)),children:`Install skills`}):null]}):null]}):null,MC(a.docsUrl)?(0,W.jsxs)(`a`,{href:a.docsUrl,target:`_blank`,rel:`noreferrer noopener`,className:`text-accent underline`,"data-testid":`connector-docs-${e.slug}`,children:[a.vendor,` documentation`]}):null]})}function Tre({pack:e,status:t,view:n,onDone:r}){let i=e.connector,[a,o]=(0,v.useState)(`choose`),[s,c]=(0,v.useState)(!1),l=(0,v.useRef)(null),u=i.auth.methods.includes(`token`)&&i.auth.token!==null,d=i.auth.methods.includes(`oauth`),f=t?.state===`connected`;(0,v.useEffect)(()=>{f&&r()},[f,r]);let p=t?.state===`connecting`,m=MC(t?.signInUrl),h=async()=>{c(!0),await n.signIn(e.slug,{method:`oauth`}),c(!1)},g=async()=>{let t=l.current,r=t?.value.trim()??``;!t||!r||(t.value=``,c(!0),await n.signIn(e.slug,{method:`token`,token:r}),c(!1))};return p?(0,W.jsxs)(`div`,{className:`space-y-3 text-sm`,"data-testid":`connector-dialog-waiting`,children:[(0,W.jsxs)(`p`,{className:`flex items-center gap-2 text-fg`,children:[(0,W.jsx)(K.Spinner,{className:`w-4 h-4`}),` Waiting for your sign-in…`]}),(0,W.jsxs)(`p`,{className:`text-fg-muted`,children:[`A browser window opened on this PC. Sign in to `,i.vendor,` there and approve OonaCode.`]}),m?(0,W.jsx)(`p`,{className:`break-all`,children:(0,W.jsx)(`a`,{href:m,target:`_blank`,rel:`noreferrer noopener`,className:`text-accent underline`,"data-testid":`connector-dialog-link`,children:m})}):null,(0,W.jsx)(`div`,{className:`flex justify-end`,children:(0,W.jsx)(q,{variant:`ghost`,"data-testid":`connector-dialog-cancel`,onClick:()=>void n.signOut(e.slug).then(()=>{r()}),children:`Cancel`})})]}):(0,W.jsxs)(`div`,{className:`space-y-4 text-sm`,"data-testid":`connector-dialog`,children:[t&&(t.state===`error`||t.state===`expired`)&&t.message?(0,W.jsx)(`p`,{className:`rounded border border-border bg-surface-2 px-2 py-1.5 text-fg-muted`,children:t.message}):null,n.error?.slug===e.slug?(0,W.jsx)(`p`,{className:`text-danger`,role:`alert`,"data-testid":`connector-dialog-error`,children:n.error.message}):null,a===`choose`?(0,W.jsxs)(W.Fragment,{children:[d?(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(q,{variant:`inverse`,busy:s,"data-testid":`connector-dialog-oauth`,onClick:()=>void h(),children:[`Sign in with `,i.vendor]}),(0,W.jsxs)(`p`,{className:`mt-1 text-xs text-fg-faint`,children:[`Opens `,i.vendor,`'s own sign-in page in a browser on this PC. OonaCode never sees your password.`]})]}):null,u?(0,W.jsx)(`div`,{children:(0,W.jsx)(`button`,{type:`button`,className:`text-xs text-accent underline`,"data-testid":`connector-dialog-use-token`,onClick:()=>o(`token`),children:`Use an access token instead`})}):null]}):(0,W.jsxs)(`form`,{className:`space-y-2`,onSubmit:e=>{e.preventDefault(),g()},children:[(0,W.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,W.jsx)(`span`,{className:`font-medium text-fg`,children:i.auth.token?.label??`Access token`}),(0,W.jsx)(`input`,{ref:l,type:`password`,autoComplete:`off`,autoCorrect:`off`,autoCapitalize:`off`,spellCheck:!1,"data-lpignore":`true`,"data-testid":`connector-dialog-token`,className:AS,defaultValue:``,autoFocus:!0})]}),i.auth.token?.createUrl?(0,W.jsx)(`p`,{className:`text-xs`,children:(0,W.jsxs)(`a`,{href:i.auth.token.createUrl,target:`_blank`,rel:`noreferrer noopener`,className:`text-accent underline`,"data-testid":`connector-dialog-create-url`,children:[`Create a token at `,i.vendor]})}):null,i.auth.token?.note?(0,W.jsx)(`p`,{className:`text-xs text-fg-faint`,children:i.auth.token.note}):null,(0,W.jsx)(`p`,{className:`text-xs text-fg-faint`,children:`The token is sealed on this PC and synced to your other PCs only as ciphertext. This window forgets it as soon as it is sent.`}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(q,{type:`submit`,variant:`inverse`,busy:s,"data-testid":`connector-dialog-send`,children:`Sign in`}),d?(0,W.jsx)(`button`,{type:`button`,className:`text-xs text-accent underline`,onClick:()=>o(`choose`),children:`Back`}):null]})]})]})}function Ere(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var Dre=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Ore=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,kre={};function NC(e,t){return((t||kre).jsx?Ore:Dre).test(e)}var Are=/[ \t\n\f\r]/g;function jre(e){return typeof e==`object`?e.type===`text`&&PC(e.value):PC(e)}function PC(e){return e.replace(Are,``)===``}var FC=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};FC.prototype.normal={},FC.prototype.property={},FC.prototype.space=void 0;function IC(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new FC(n,r,t)}function LC(e){return e.toLowerCase()}var RC=class{constructor(e,t){this.attribute=t,this.property=e}};RC.prototype.attribute=``,RC.prototype.booleanish=!1,RC.prototype.boolean=!1,RC.prototype.commaOrSpaceSeparated=!1,RC.prototype.commaSeparated=!1,RC.prototype.defined=!1,RC.prototype.mustUseProperty=!1,RC.prototype.number=!1,RC.prototype.overloadedBoolean=!1,RC.prototype.property=``,RC.prototype.spaceSeparated=!1,RC.prototype.space=void 0;var zC=s({boolean:()=>BC,booleanish:()=>VC,commaOrSpaceSeparated:()=>GC,commaSeparated:()=>WC,number:()=>J,overloadedBoolean:()=>HC,spaceSeparated:()=>UC}),Mre=0,BC=KC(),VC=KC(),HC=KC(),J=KC(),UC=KC(),WC=KC(),GC=KC();function KC(){return 2**++Mre}var qC=Object.keys(zC),JC=class extends RC{constructor(e,t,n,r){let i=-1;if(super(e,t),YC(this,`space`,r),typeof n==`number`)for(;++i<qC.length;){let e=qC[i];YC(this,qC[i],(n&zC[e])===zC[e])}}};JC.prototype.defined=!0;function YC(e,t,n){n&&(e[t]=n)}function XC(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new JC(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[LC(r)]=r,n[LC(a.attribute)]=r}return new FC(t,n,e.space)}var ZC=XC({properties:{ariaActiveDescendant:null,ariaAtomic:VC,ariaAutoComplete:null,ariaBusy:VC,ariaChecked:VC,ariaColCount:J,ariaColIndex:J,ariaColSpan:J,ariaControls:UC,ariaCurrent:null,ariaDescribedBy:UC,ariaDetails:null,ariaDisabled:VC,ariaDropEffect:UC,ariaErrorMessage:null,ariaExpanded:VC,ariaFlowTo:UC,ariaGrabbed:VC,ariaHasPopup:null,ariaHidden:VC,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:UC,ariaLevel:J,ariaLive:null,ariaModal:VC,ariaMultiLine:VC,ariaMultiSelectable:VC,ariaOrientation:null,ariaOwns:UC,ariaPlaceholder:null,ariaPosInSet:J,ariaPressed:VC,ariaReadOnly:VC,ariaRelevant:null,ariaRequired:VC,ariaRoleDescription:UC,ariaRowCount:J,ariaRowIndex:J,ariaRowSpan:J,ariaSelected:VC,ariaSetSize:J,ariaSort:null,ariaValueMax:J,ariaValueMin:J,ariaValueNow:J,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function QC(e,t){return t in e?e[t]:t}function $C(e,t){return QC(e,t.toLowerCase())}var Nre=XC({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:WC,acceptCharset:UC,accessKey:UC,action:null,allow:null,allowFullScreen:BC,allowPaymentRequest:BC,allowUserMedia:BC,alpha:BC,alt:null,as:null,async:BC,autoCapitalize:null,autoComplete:UC,autoFocus:BC,autoPlay:BC,blocking:UC,capture:null,charSet:null,checked:BC,cite:null,className:UC,closedBy:null,colorSpace:null,cols:J,colSpan:J,command:null,commandFor:null,content:null,contentEditable:VC,controls:BC,controlsList:UC,coords:J|WC,crossOrigin:null,data:null,dateTime:null,decoding:null,default:BC,defer:BC,dir:null,dirName:null,disabled:BC,download:HC,draggable:VC,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:BC,formTarget:null,headers:UC,height:J,hidden:HC,high:J,href:null,hrefLang:null,htmlFor:UC,httpEquiv:UC,id:null,imageSizes:null,imageSrcSet:null,inert:BC,inputMode:null,integrity:null,is:null,isMap:BC,itemId:null,itemProp:UC,itemRef:UC,itemScope:BC,itemType:UC,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:BC,low:J,manifest:null,max:null,maxLength:J,media:null,method:null,min:null,minLength:J,multiple:BC,muted:BC,name:null,nonce:null,noModule:BC,noValidate:BC,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:BC,optimum:J,pattern:null,ping:UC,placeholder:null,playsInline:BC,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:BC,referrerPolicy:null,rel:UC,required:BC,reversed:BC,rows:J,rowSpan:J,sandbox:UC,scope:null,scoped:BC,seamless:BC,selected:BC,shadowRootClonable:BC,shadowRootCustomElementRegistry:BC,shadowRootDelegatesFocus:BC,shadowRootMode:null,shadowRootSerializable:BC,shape:null,size:J,sizes:null,slot:null,span:J,spellCheck:VC,src:null,srcDoc:null,srcLang:null,srcSet:null,start:J,step:null,style:null,tabIndex:J,target:null,title:null,translate:null,type:null,typeMustMatch:BC,useMap:null,value:VC,width:J,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:UC,axis:null,background:null,bgColor:null,border:J,borderColor:null,bottomMargin:J,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:BC,declare:BC,event:null,face:null,frame:null,frameBorder:null,hSpace:J,leftMargin:J,link:null,longDesc:null,lowSrc:null,marginHeight:J,marginWidth:J,noResize:BC,noHref:BC,noShade:BC,noWrap:BC,object:null,profile:null,prompt:null,rev:null,rightMargin:J,rules:null,scheme:null,scrolling:VC,standby:null,summary:null,text:null,topMargin:J,valueType:null,version:null,vAlign:null,vLink:null,vSpace:J,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:BC,disablePictureInPicture:BC,disableRemotePlayback:BC,exportParts:WC,part:UC,prefix:null,property:null,results:J,security:null,unselectable:null},space:`html`,transform:$C}),Pre=XC({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,maskType:`mask-type`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:GC,accentHeight:J,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:J,amplitude:J,arabicForm:null,ascent:J,attributeName:null,attributeType:null,azimuth:J,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:J,by:null,calcMode:null,capHeight:J,className:UC,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:J,diffuseConstant:J,direction:null,display:null,dur:null,divisor:J,dominantBaseline:null,download:BC,dx:null,dy:null,edgeMode:null,editable:null,elevation:J,enableBackground:null,end:null,event:null,exponent:J,externalResourcesRequired:null,fill:null,fillOpacity:J,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:WC,g2:WC,glyphName:WC,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:J,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:J,horizOriginX:J,horizOriginY:J,id:null,ideographic:J,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:J,k:J,k1:J,k2:J,k3:J,k4:J,kernelMatrix:GC,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:J,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:J,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:J,overlineThickness:J,paintOrder:null,panose1:null,path:null,pathLength:J,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:UC,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:J,pointsAtY:J,pointsAtZ:J,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:GC,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:GC,rev:GC,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:GC,requiredFeatures:GC,requiredFonts:GC,requiredFormats:GC,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:J,specularExponent:J,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:J,strikethroughThickness:J,string:null,stroke:null,strokeDashArray:GC,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:J,strokeOpacity:J,strokeWidth:null,style:null,surfaceScale:J,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:GC,tabIndex:J,tableValues:null,target:null,targetX:J,targetY:J,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:GC,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:J,underlineThickness:J,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:J,values:null,vAlphabetic:J,vMathematical:J,vectorEffect:null,vHanging:J,vIdeographic:J,version:null,vertAdvY:J,vertOriginX:J,vertOriginY:J,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:J,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:QC}),ew=XC({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),tw=XC({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:$C}),nw=XC({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),Fre={classId:`classID`,dataType:`datatype`,itemId:`itemID`,strokeDashArray:`strokeDasharray`,strokeDashOffset:`strokeDashoffset`,strokeLineCap:`strokeLinecap`,strokeLineJoin:`strokeLinejoin`,strokeMiterLimit:`strokeMiterlimit`,typeOf:`typeof`,xLinkActuate:`xlinkActuate`,xLinkArcRole:`xlinkArcrole`,xLinkHref:`xlinkHref`,xLinkRole:`xlinkRole`,xLinkShow:`xlinkShow`,xLinkTitle:`xlinkTitle`,xLinkType:`xlinkType`,xmlnsXLink:`xmlnsXlink`},Ire=/[A-Z]/g,rw=/-[a-z]/g,Lre=/^data[-\w.:]+$/i;function Rre(e,t){let n=LC(t),r=t,i=RC;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&Lre.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(rw,Bre);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!rw.test(e)){let n=e.replace(Ire,zre);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=JC}return new i(r,t)}function zre(e){return`-`+e.toLowerCase()}function Bre(e){return e.charAt(1).toUpperCase()}var Vre=IC([ZC,Nre,ew,tw,nw],`html`),iw=IC([ZC,Pre,ew,tw,nw],`svg`);function Hre(e){return e.join(` `).trim()}var Ure=o(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g;function u(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,u=1;function f(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(`
126
126
  `);u=~n?e.length-n:u+e.length}function p(){var e={line:l,column:u};return function(t){return t.position=new m(e),_(),t}}function m(e){this.start=e,this.end={line:l,column:u},this.source=t.source}m.prototype.content=e;function h(n){var r=Error(t.source+`:`+l+`:`+u+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=u,r.source=e,!t.silent)throw r}function g(t){var n=t.exec(e);if(n){var r=n[0];return f(r),e=e.slice(r.length),n}}function _(){g(i)}function v(e){var t;for(e||=[];t=y();)t!==!1&&e.push(t);return e}function y(){var t=p();if(e.charAt(0)==`/`&&e.charAt(1)==`*`){for(var n=2;e.charAt(n)!=``&&(e.charAt(n)!=`*`||e.charAt(n+1)!=`/`);)++n;if(n+=2,e.charAt(n-1)===``)return h(`End of comment missing`);var r=e.slice(2,n-2);return u+=2,f(r),e=e.slice(n),u+=2,t({type:`comment`,comment:r})}}function b(){var e=p(),t=g(a);if(t){if(y(),!g(o))return h(`property missing ':'`);var r=g(s),i=e({type:`declaration`,property:d(t[0].replace(n,``)),value:r?d(r[0].replace(n,``)):``});return g(c),i}}function x(){var e=[];v(e);for(var t;t=b();)t!==!1&&(e.push(t),v(e));return e}return _(),x()}function d(e){return e?e.replace(l,``):``}t.exports=u})),Wre=o((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=r;var n=t(Ure());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),Gre=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),Kre=o(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(Wre()),r=Gre();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i})),aw=sw(`end`),ow=sw(`start`);function sw(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function qre(e){let t=ow(e),n=aw(e);if(t&&n)return{start:t,end:n}}function cw(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?uw(e.position):`start`in e||`end`in e?uw(e):`line`in e||`column`in e?lw(e):``}function lw(e){return dw(e&&e.line)+`:`+dw(e&&e.column)}function uw(e){return lw(e&&e.start)+`-`+lw(e&&e.end)}function dw(e){return e&&typeof e==`number`?e:1}var fw=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=cw(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};fw.prototype.file=``,fw.prototype.name=``,fw.prototype.reason=``,fw.prototype.message=``,fw.prototype.stack=``,fw.prototype.column=void 0,fw.prototype.line=void 0,fw.prototype.ancestors=void 0,fw.prototype.cause=void 0,fw.prototype.fatal=void 0,fw.prototype.place=void 0,fw.prototype.ruleId=void 0,fw.prototype.source=void 0;var Jre=l(Kre(),1),pw={}.hasOwnProperty,Yre=new Map,Xre=/[A-Z]/g,Zre=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),Qre=new Set([`td`,`th`]),mw=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function $re(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=sie(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=oie(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?iw:Vre,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=hw(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function hw(e,t,n){if(t.type===`element`)return eie(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return tie(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return rie(e,t,n);if(t.type===`mdxjsEsm`)return nie(e,t);if(t.type===`root`)return iie(e,t,n);if(t.type===`text`)return aie(e,t)}function eie(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=iw,e.schema=i),e.ancestors.push(t);let a=Cw(e,t.tagName,!1),o=vw(e,t),s=bw(e,t);return Zre.has(t.tagName)&&(s=s.filter(function(e){return typeof e!=`string`||!jre(e)})),gw(e,o,a,t),_w(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function tie(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}ww(e,t.position)}function nie(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);ww(e,t.position)}function rie(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=iw,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:Cw(e,t.name,!0),o=yw(e,t),s=bw(e,t);return gw(e,o,a,t),_w(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function iie(e,t,n){let r={};return _w(r,bw(e,t)),e.create(t,e.Fragment,r,n)}function aie(e,t){return t.value}function gw(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function _w(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function oie(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function sie(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=ow(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function vw(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&pw.call(t.properties,i)){let a=xw(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&Qre.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function yw(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`){if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else ww(e,t.position)}else{let i=r.name,a;if(r.value&&typeof r.value==`object`){if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else ww(e,t.position)}else a=r.value===null||r.value;n[i]=a}return n}function bw(e,t){let n=[],r=-1,i=e.passKeys?new Map:Yre;for(;++r<t.children.length;){let a=t.children[r],o;if(e.passKeys){let e=a.type===`element`?a.tagName:a.type===`mdxJsxFlowElement`||a.type===`mdxJsxTextElement`?a.name:void 0;if(e){let t=i.get(e)||0;o=e+`-`+t,i.set(e,t+1)}}let s=hw(e,a,o);s!==void 0&&n.push(s)}return n}function xw(e,t,n){let r=Rre(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Ere(n):Hre(n)),r.property===`style`){let t=typeof n==`object`?n:Sw(e,String(n));return e.stylePropertyNameCase===`css`&&(t=Tw(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?Fre[r.property]||r.property:r.attribute,n]}}function Sw(e,t){try{return(0,Jre.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new fw("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=mw+`#cannot-parse-style-attribute`,r}}function Cw(e,t,n){let r;if(!n)r={type:`Literal`,value:t};else if(t.includes(`.`)){let e=t.split(`.`),n=-1,i;for(;++n<e.length;){let t=NC(e[n])?{type:`Identifier`,name:e[n]}:{type:`Literal`,value:e[n]};i=i?{type:`MemberExpression`,object:i,property:t,computed:!!(n&&t.type===`Literal`),optional:!1}:t}r=i}else r=NC(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return pw.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);ww(e)}function ww(e,t){let n=new fw("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:`mdx-estree`,source:`hast-util-to-jsx-runtime`});throw n.file=e.filePath||void 0,n.url=mw+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function Tw(e){let t={},n;for(n in e)pw.call(e,n)&&(t[Ew(n)]=e[n]);return t}function Ew(e){let t=e.replace(Xre,Dw);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function Dw(e){return`-`+e.toLowerCase()}var Ow={action:[`form`],cite:[`blockquote`,`del`,`ins`,`q`],data:[`object`],formAction:[`button`,`input`],href:[`a`,`area`,`base`,`link`],icon:[`menuitem`],itemId:null,manifest:[`html`],ping:[`a`,`area`],poster:[`video`],src:[`audio`,`embed`,`iframe`,`img`,`input`,`script`,`source`,`track`,`video`]},kw={};function Aw(e,t){let n=t||kw;return jw(e,typeof n.includeImageAlt!=`boolean`||n.includeImageAlt,typeof n.includeHtml!=`boolean`||n.includeHtml)}function jw(e,t,n){if(Nw(e)){if(`value`in e)return e.type===`html`&&!n?``:e.value;if(t&&`alt`in e&&e.alt)return e.alt;if(`children`in e)return Mw(e.children,t,n)}return Array.isArray(e)?Mw(e,t,n):``}function Mw(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=jw(e[i],t,n);return r.join(``)}function Nw(e){return!!(e&&typeof e==`object`)}var Pw=document.createElement(`i`);function Fw(e){let t=`&`+e+`;`;Pw.innerHTML=t;let n=Pw.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`?!1:n!==t&&n}function Iw(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function Lw(e,t){return e.length>0?(Iw(e,e.length,0,t),e):t}var Rw={}.hasOwnProperty;function zw(e){let t={},n=-1;for(;++n<e.length;)Bw(t,e[n]);return t}function Bw(e,t){let n;for(n in t){let r=(Rw.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){Rw.call(r,a)||(r[a]=[]);let e=i[a];Vw(r[a],Array.isArray(e)?e:e?[e]:[])}}}function Vw(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);Iw(e,0,0,r)}function Hw(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}function Uw(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var Ww=nT(/[A-Za-z]/),Gw=nT(/[\dA-Za-z]/),Kw=nT(/[#-'*+\--9=?A-Z^-~]/);function qw(e){return e!==null&&(e<32||e===127)}var Jw=nT(/\d/),Yw=nT(/[\dA-Fa-f]/),Xw=nT(/[!-/:-@[-`{-~]/);function Zw(e){return e!==null&&e<-2}function Qw(e){return e!==null&&(e<0||e===32)}function $w(e){return e===-2||e===-1||e===32}var eT=nT(/\p{P}|\p{S}/u),tT=nT(/\s/);function nT(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function rT(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&Gw(e.charCodeAt(n+1))&&Gw(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function iT(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return $w(r)?(e.enter(n),s(r)):t(r)}function s(r){return $w(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var aT={tokenize:oT};function oT(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),iT(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return Zw(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var sT={tokenize:lT},cT={tokenize:uT};function lT(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;return Iw(t.events,a+1,0,t.events.slice(n)),t.events.length=s,l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(cT,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(cT,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null){i&&v(),_(0),e.consume(n);return}return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null){g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);return}return Zw(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;Iw(t.events,a+1,0,t.events.slice(n)),t.events.length=e}}function _(r){let i=n.length;for(;i-->r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function uT(e,t,n){return iT(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function dT(e){if(e===null||Qw(e)||tT(e))return 1;if(eT(e))return 2}function fT(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}var pT={name:`attention`,resolveAll:mT,tokenize:hT};function mT(e,t){let n=-1,r,i,a,o,s,c,l,u;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){for(r=n;r--;)if(e[r][0]===`exit`&&e[r][1].type===`attentionSequence`&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};gT(d,-c),gT(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=Lw(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=Lw(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=Lw(l,fT(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=Lw(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=Lw(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,Iw(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function hT(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=dT(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=dT(o),u=!l||l===2&&i||n.includes(o),d=!i||i===2&&l||n.includes(r);return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function gT(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var _T={name:`autolink`,tokenize:vT};function vT(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return Ww(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||Gw(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||Gw(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||qw(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):Kw(t)?(e.consume(t),l):n(t)}function u(e){return Gw(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||Gw(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var yT={partial:!0,tokenize:bT};function bT(e,t,n){return r;function r(t){return $w(t)?iT(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||Zw(e)?t(e):n(e)}}var xT={continuation:{tokenize:CT},exit:wT,name:`blockQuote`,tokenize:ST};function ST(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return $w(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function CT(e,t,n){let r=this;return i;function i(t){return $w(t)?iT(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(xT,t,n)(r)}}function wT(e){e.exit(`blockQuote`)}var TT={name:`characterEscape`,tokenize:ET};function ET(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return Xw(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var DT={name:`characterReference`,tokenize:OT};function OT(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=Gw,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=Yw,u):(e.enter(`characterReferenceValue`),a=7,o=Jw,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===Gw&&!Fw(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var kT={partial:!0,tokenize:MT},AT={concrete:!0,name:`codeFenced`,tokenize:jT};function jT(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),$w(t)?iT(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||Zw(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(kT,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||Zw(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):$w(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),iT(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||Zw(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||Zw(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&$w(t)?iT(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||Zw(t)?e.check(kT,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||Zw(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),$w(t)?iT(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),$w(t)?iT(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||Zw(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function MT(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var NT={name:`codeIndented`,tokenize:FT},PT={partial:!0,tokenize:IT};function FT(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),iT(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):Zw(t)?e.attempt(PT,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||Zw(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function IT(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):Zw(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):iT(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):Zw(e)?i(e):n(e)}}var LT={name:`codeText`,previous:zT,resolve:RT,tokenize:BT};function RT(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`codeTextData`){e[n][1].type=`codeTextPadding`,e[t][1].type=`codeTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`codeTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function zT(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function BT(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):Zw(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||Zw(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var VT=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&HT(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),HT(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),HT(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0)){if(e<this.left.length){let t=this.left.splice(e,1/0);HT(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);HT(this.left,t.reverse())}}}};function HT(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function UT(e){let t={},n=-1,r,i,a,o,s,c,l,u=new VT(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,WT(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(o[1].type!==`linePrefix`&&o[1].type!==`listItemIndent`)break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return Iw(e,0,1/0,u.slice(0)),!l}function WT(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var GT={resolve:qT,tokenize:JT},KT={partial:!0,tokenize:YT};function qT(e){return UT(e),e}function JT(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):Zw(t)?e.check(KT,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function YT(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),iT(e,a,`linePrefix`)}function a(i){if(i===null||Zw(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function XT(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||qw(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||Zw(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||Qw(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||qw(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function ZT(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):Zw(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||Zw(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!$w(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function QT(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):Zw(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),iT(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||Zw(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function $T(e,t){let n;return r;function r(i){return Zw(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):$w(i)?iT(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var eE={name:`definition`,tokenize:nE},tE={partial:!0,tokenize:rE};function nE(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return ZT.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=Uw(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return Qw(t)?$T(e,l)(t):l(t)}function l(t){return XT(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(tE,d,d)(t)}function d(t){return $w(t)?iT(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||Zw(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function rE(e,t,n){return r;function r(t){return Qw(t)?$T(e,i)(t):n(t)}function i(t){return QT(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return $w(t)?iT(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||Zw(e)?t(e):n(e)}}var iE={name:`hardBreakEscape`,tokenize:aE};function aE(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return Zw(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var oE={name:`headingAtx`,resolve:sE,tokenize:cE};function sE(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r&&(i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},Iw(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function cE(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||Qw(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||Zw(n)?(e.exit(`atxHeading`),t(n)):$w(n)?iT(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||Qw(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var lE=`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.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),uE=[`pre`,`script`,`style`,`textarea`],dE={concrete:!0,name:`htmlFlow`,resolveTo:mE,tokenize:hE},fE={partial:!0,tokenize:_E},pE={partial:!0,tokenize:gE};function mE(e){let t=e.length;for(;t--&&(e[t][0]!==`enter`||e[t][1].type!==`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function hE(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:P):Ww(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):Ww(a)?(e.consume(a),i=4,r.interrupt?t:P):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:P):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return Ww(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||Qw(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&uE.includes(l)?(i=1,r.interrupt?t(s):O(s)):lE.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||Gw(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):n(i)}function v(t){return $w(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||Ww(t)?(e.consume(t),b):$w(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||Gw(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):$w(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):$w(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||Zw(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||Qw(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||$w(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||Zw(t)?O(t):$w(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),M):t===60&&i===1?(e.consume(t),N):t===62&&i===4?(e.consume(t),F):t===63&&i===3?(e.consume(t),P):t===93&&i===5?(e.consume(t),te):Zw(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(fE,ne,k)(t)):t===null||Zw(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(pE,A,ne)(t)}function A(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),j}function j(t){return t===null||Zw(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function M(t){return t===45?(e.consume(t),P):O(t)}function N(t){return t===47?(e.consume(t),o=``,ee):O(t)}function ee(t){if(t===62){let n=o.toLowerCase();return uE.includes(n)?(e.consume(t),F):O(t)}return Ww(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),ee):O(t)}function te(t){return t===93?(e.consume(t),P):O(t)}function P(t){return t===62?(e.consume(t),F):t===45&&i===2?(e.consume(t),P):O(t)}function F(t){return t===null||Zw(t)?(e.exit(`htmlFlowData`),ne(t)):(e.consume(t),F)}function ne(n){return e.exit(`htmlFlow`),t(n)}}function gE(e,t,n){let r=this;return i;function i(t){return Zw(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function _E(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(yT,t,n)}}var vE={name:`htmlText`,tokenize:yE};function yE(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):Ww(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):Ww(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):Zw(t)?(o=d,N(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?M(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):Zw(t)?(o=h,N(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?M(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?M(t):Zw(t)?(o=v,N(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):Zw(t)?(o=y,N(t)):(e.consume(t),y)}function b(e){return e===62?M(e):y(e)}function x(t){return Ww(t)?(e.consume(t),S):n(t)}function S(t){return t===45||Gw(t)?(e.consume(t),S):C(t)}function C(t){return Zw(t)?(o=C,N(t)):$w(t)?(e.consume(t),C):M(t)}function w(t){return t===45||Gw(t)?(e.consume(t),w):t===47||t===62||Qw(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),M):t===58||t===95||Ww(t)?(e.consume(t),E):Zw(t)?(o=T,N(t)):$w(t)?(e.consume(t),T):M(t)}function E(t){return t===45||t===46||t===58||t===95||Gw(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):Zw(t)?(o=D,N(t)):$w(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,k):Zw(t)?(o=O,N(t)):$w(t)?(e.consume(t),O):(e.consume(t),A)}function k(t){return t===i?(e.consume(t),i=void 0,j):t===null?n(t):Zw(t)?(o=k,N(t)):(e.consume(t),k)}function A(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||Qw(t)?T(t):(e.consume(t),A)}function j(e){return e===47||e===62||Qw(e)?T(e):n(e)}function M(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function N(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),ee}function ee(t){return $w(t)?iT(e,te,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):te(t)}function te(t){return e.enter(`htmlTextData`),o(t)}}var bE={name:`labelEnd`,resolveAll:wE,resolveTo:TE,tokenize:EE},xE={tokenize:DE},SE={tokenize:OE},CE={tokenize:kE};function wE(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&Iw(e,0,e.length,n),e}function TE(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){if(i.type===`link`||i.type===`labelLink`&&i._inactive)break;e[n][0]===`enter`&&i.type===`labelLink`&&(i._inactive=!0)}else if(o){if(e[n][0]===`enter`&&(i.type===`labelImage`||i.type===`labelLink`)&&!i._balanced&&(a=n,i.type!==`labelLink`)){r=2;break}}else i.type===`labelEnd`&&(o=n);let c={type:e[a][1].type===`labelLink`?`link`:`image`,start:{...e[a][1].start},end:{...e[e.length-1][1].end}},l={type:`label`,start:{...e[a][1].start},end:{...e[o][1].end}},u={type:`labelText`,start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[[`enter`,c,t],[`enter`,l,t]],s=Lw(s,e.slice(a+1,a+r+3)),s=Lw(s,[[`enter`,u,t]]),s=Lw(s,fT(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=Lw(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=Lw(s,e.slice(o+1)),s=Lw(s,[[`exit`,c,t]]),Iw(e,a,e.length,s),e}function EE(e,t,n){let r=this,i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type===`labelImage`||r.events[i][1].type===`labelLink`)&&!r.events[i][1]._balanced){a=r.events[i][1];break}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(Uw(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(xE,u,o?u:d)(t):t===91?e.attempt(SE,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(CE,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function DE(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return Qw(t)?$T(e,a)(t):a(t)}function a(t){return t===41?u(t):XT(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return Qw(t)?$T(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?QT(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return Qw(t)?$T(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function OE(e,t,n){let r=this;return i;function i(t){return ZT.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(Uw(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function kE(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var AE={name:`labelStartImage`,resolveAll:bE.resolveAll,tokenize:jE};function jE(e,t,n){let r=this;return i;function i(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),a}function a(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelImage`),o):n(t)}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var ME={name:`labelStartLink`,resolveAll:bE.resolveAll,tokenize:NE};function NE(e,t,n){let r=this;return i;function i(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelLink`),a}function a(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var PE={name:`lineEnding`,tokenize:FE};function FE(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),iT(e,t,`linePrefix`)}}var IE={name:`thematicBreak`,tokenize:LE};function LE(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||Zw(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),$w(t)?iT(e,s,`whitespace`)(t):s(t))}}var RE={continuation:{tokenize:HE},exit:WE,name:`list`,tokenize:VE},zE={partial:!0,tokenize:GE},BE={partial:!0,tokenize:UE};function VE(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:Jw(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(IE,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return Jw(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(yT,r.interrupt?n:u,e.attempt(zE,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return $w(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function HE(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(yT,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,iT(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!$w(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(BE,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,iT(e,e.attempt(RE,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function UE(e,t,n){let r=this;return iT(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function WE(e){e.exit(this.containerState.type)}function GE(e,t,n){let r=this;return iT(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!$w(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var KE={name:`setextUnderline`,resolveTo:qE,tokenize:JE};function qE(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]===`enter`){if(e[n][1].type===`content`){r=n;break}e[n][1].type===`paragraph`&&(i=n)}else e[n][1].type===`content`&&e.splice(n,1),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function JE(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),$w(t)?iT(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||Zw(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var YE={tokenize:XE};function XE(e){let t=this,n=e.attempt(yT,r,e.attempt(this.parser.constructs.flowInitial,i,iT(e,e.attempt(this.parser.constructs.flow,i,e.attempt(GT,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var ZE={resolveAll:tD()},QE=eD(`string`),$E=eD(`text`);function eD(e){return{resolveAll:tD(e===`text`?nD:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function tD(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):(!t[r]||t[r][1].type!==`data`)&&(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function nD(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type===`lineEnding`)&&e[n-1][1].type===`data`){let r=e[n-1][1],i=t.sliceStream(r),a=i.length,o=-1,s=0,c;for(;a--;){let e=i[a];if(typeof e==`string`){for(o=e.length;e.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(e===-2)c=!0,s++;else if(e!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){let i={type:n===e.length||c||s<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:a?o:r.start._bufferIndex+o,_index:r.start._index+a,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...i.start},r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,[`enter`,i,t],[`exit`,i,t]),n+=2)}n++}return e}var rD=s({attentionMarkers:()=>dD,contentInitial:()=>aD,disable:()=>fD,document:()=>iD,flow:()=>sD,flowInitial:()=>oD,insideSpan:()=>uD,string:()=>cD,text:()=>lD}),iD={42:RE,43:RE,45:RE,48:RE,49:RE,50:RE,51:RE,52:RE,53:RE,54:RE,55:RE,56:RE,57:RE,62:xT},aD={91:eE},oD={[-2]:NT,[-1]:NT,32:NT},sD={35:oE,42:IE,45:[KE,IE],60:dE,61:KE,95:IE,96:AT,126:AT},cD={38:DT,92:TT},lD={[-5]:PE,[-4]:PE,[-3]:PE,33:AE,38:DT,42:pT,60:[_T,vE],91:ME,92:[iE,TT],93:bE,95:pT,96:LT},uD={null:[pT,ZE]},dD={null:[42,95]},fD={null:[]};function pD(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=Lw(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=fT(a,l.events,l),l.events):[]}function f(e,t){return hD(p(e),t)}function p(e){return mD(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){let e;for(;r._index<o.length;){let t=o[r._index];if(typeof t==`string`)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)_(t.charCodeAt(r._bufferIndex));else _(t)}}function _(e){u=u(e)}function v(e){Zw(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&Iw(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function T(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function mD(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function hD(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
127
127
  `;break;case-3:o=`\r
128
128
  `;break;case-2:o=t?` `:` `;break;case-1:if(!t&&i)continue;o=` `;break;default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join(``)}function gD(e){let t={constructs:zw([rD,...(e||{}).extensions||[]]),content:n(aT),defined:[],document:n(sT),flow:n(YE),lazy:{},string:n(QE),text:n($E)};return t;function n(e){return n;function n(n){return pD(t,e,n)}}}function _D(e){for(;!UT(e););return e}var vD=/[\0\t\n\r]/g;function yD(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){let s=[],c,l,u,d,f;for(i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i)),u=0,t=``,n&&=(i.charCodeAt(0)===65279&&u++,void 0);u<i.length;){if(vD.lastIndex=u,c=vD.exec(i),d=c&&c.index!==void 0?c.index:i.length,f=i.charCodeAt(d),!c){t=i.slice(u);break}if(f===10&&u===d&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),u<d&&(s.push(i.slice(u,d)),e+=d-u),f){case 0:s.push(65533),e++;break;case 9:for(l=Math.ceil(e/4)*4,s.push(-2);e++<l;)s.push(-1);break;case 10:s.push(-4),e=1;break;default:r=!0,e=1}u=d+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}var bD=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function xD(e){return e.replace(bD,SD)}function SD(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return Hw(n.slice(t?2:1),t?16:10)}return Fw(n)||e}var CD={}.hasOwnProperty;function wD(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),TD(n)(_D(gD(n).document().write(yD()(e,t,!0))))}function TD(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(he),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(de),blockQuote:a(oe),characterEscape:T,characterReference:T,codeFenced:a(se),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(se,o),codeText:a(ce,o),codeTextData:T,data:T,codeFlowValue:T,definition:a(le),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(ue),hardBreakEscape:a(fe),hardBreakTrailing:a(fe),htmlFlow:a(pe,o),htmlFlowData:T,htmlText:a(pe,o),htmlTextData:T,image:a(me),label:o,link:a(he),listItem:a(_e),listItemValue:f,listOrdered:a(ge,d),listUnordered:a(ge),paragraph:a(ve),reference:I,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(de),strong:a(ye),thematicBreak:a(xe)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:ae,autolinkProtocol:z,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:ie,characterReferenceMarkerNumeric:ie,characterReferenceValue:L,characterReference:R,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:c(_),codeText:c(j),codeTextData:E,data:E,definition:c(),definitionDestinationString:b,definitionLabelString:v,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(O),hardBreakTrailing:c(O),htmlFlow:c(k),htmlFlowData:E,htmlText:c(A),htmlTextData:E,image:c(N),label:te,labelText:ee,lineEnding:D,link:c(M),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:re,resourceDestinationString:P,resourceTitleString:F,resource:ne,setextHeading:c(w),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};DD(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(e){let r={type:`root`,children:[]},a={stack:[r],tokenStack:[],config:t,enter:s,exit:l,buffer:o,resume:u,data:n},c=[],d=-1;for(;++d<e.length;)(e[d][1].type===`listOrdered`||e[d][1].type===`listUnordered`)&&(e[d][0]===`enter`?c.push(d):d=i(e,c.pop(),d));for(d=-1;++d<e.length;){let n=t[e[d][0]];CD.call(n,e[d][1].type)&&n[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},a),e[d][1])}if(a.tokenStack.length>0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||kD).call(a,void 0,e[0])}for(r.position={start:ED(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:ED(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)r=t.transforms[d](r)||r;return r}function i(e,t,n){let r=t-1,i=-1,a=!1,o,s,c,l;for(;++r<=n;){let t=e[r];switch(t[1].type){case`listUnordered`:case`listOrdered`:case`blockQuote`:t[0]===`enter`?i++:i--,l=void 0;break;case`lineEndingBlank`:t[0]===`enter`&&(o&&!l&&!i&&!c&&(c=r),l=void 0);break;case`linePrefix`:case`listItemValue`:case`listItemMarker`:case`listItemPrefix`:case`listItemPrefixWhitespace`:break;default:l=void 0}if(!i&&t[0]===`enter`&&t[1].type===`listItemPrefix`||i===-1&&t[0]===`exit`&&(t[1].type===`listUnordered`||t[1].type===`listOrdered`)){if(o){let i=r;for(s=void 0;i--;){let t=e[i];if(t[1].type===`lineEnding`||t[1].type===`lineEndingBlank`){if(t[0]===`exit`)continue;s&&(e[s][1].type=`lineEndingBlank`,a=!0),t[1].type=`lineEnding`,s=i}else if(t[1].type!==`linePrefix`&&t[1].type!==`blockQuotePrefix`&&t[1].type!==`blockQuotePrefixWhitespace`&&t[1].type!==`blockQuoteMarker`&&t[1].type!==`listItemIndent`)break}c&&(!s||c<s)&&(o._spread=!0),o.end=Object.assign({},s?e[s][1].start:t[1].end),e.splice(s||r,0,[`exit`,o,t[2]]),r++,n++}if(t[1].type===`listItemPrefix`){let i={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=i,e.splice(r,0,[`enter`,i,t[2]]),r++,n++,c=void 0,l=!0}}}return e[t][1]._spread=a,n}function a(e,t){return n;function n(n){s.call(this,e(n),n),t&&t.call(this,n)}}function o(){this.stack.push({type:`fragment`,children:[]})}function s(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:ED(t.start),end:void 0}}function c(e){return t;function t(t){e&&e.call(this,t),l.call(this,t)}}function l(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||kD).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+cw({start:e.start,end:e.end})+`): it’s not open`);n.position.end=ED(e.end)}function u(){return Aw(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function p(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function _(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function v(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=Uw(this.sliceSerialize(e)).toLowerCase()}function y(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function b(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function x(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function S(){this.data.setextHeadingSlurpLineEnding=!0}function C(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function w(){this.data.setextHeadingSlurpLineEnding=void 0}function T(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];(!n||n.type!==`text`)&&(n=be(),n.position={start:ED(e.start),end:void 0},t.push(n)),this.stack.push(n)}function E(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=ED(e.end)}function D(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=ED(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(T.call(this,e),E.call(this,e))}function O(){this.data.atHardBreak=!0}function k(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function A(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function j(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function M(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function N(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function ee(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=xD(t),n.identifier=Uw(t).toLowerCase()}function te(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,n.type===`link`?n.children=e.children:n.alt=t}function P(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function F(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function ne(){this.data.inReference=void 0}function I(){this.data.referenceType=`collapsed`}function re(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=Uw(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function ie(e){this.data.characterReferenceType=e.type}function L(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=Hw(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=Fw(t);let i=this.stack[this.stack.length-1];i.value+=r}function R(e){let t=this.stack.pop();t.position.end=ED(e.end)}function z(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function ae(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function oe(){return{type:`blockquote`,children:[]}}function se(){return{type:`code`,lang:null,meta:null,value:``}}function ce(){return{type:`inlineCode`,value:``}}function le(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function ue(){return{type:`emphasis`,children:[]}}function de(){return{type:`heading`,depth:0,children:[]}}function fe(){return{type:`break`}}function pe(){return{type:`html`,value:``}}function me(){return{type:`image`,title:null,url:``,alt:null}}function he(){return{type:`link`,title:null,url:``,children:[]}}function ge(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function _e(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function ve(){return{type:`paragraph`,children:[]}}function ye(){return{type:`strong`,children:[]}}function be(){return{type:`text`,value:``}}function xe(){return{type:`thematicBreak`}}}function ED(e){return{line:e.line,column:e.column,offset:e.offset}}function DD(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?DD(e,r):OD(e,r)}}function OD(e,t){let n;for(n in t)if(CD.call(t,n))switch(n){case`canContainEols`:{let r=t[n];r&&e[n].push(...r);break}case`transforms`:{let r=t[n];r&&e[n].push(...r);break}case`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function kD(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+cw({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+cw({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+cw({start:t.start,end:t.end})+`) is still open`)}function AD(e){let t=this;t.parser=n;function n(n){return wD(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function jD(e,t){let n={type:`element`,tagName:`blockquote`,properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function MD(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`