@michael-joseph-miller/ant-bot 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,21 @@ All notable changes to ant-bot are recorded here. The format follows
4
4
  [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and versions follow
5
5
  [semantic versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [0.1.3] — 2026-08-23
8
+
9
+ ### Fixed
10
+
11
+ - **Takeover now actually receives the keyboard.** Taking over left focus on the button that was
12
+ clicked, so keystrokes went to the button and nothing reached the page — only a click on the
13
+ image made typing work at all. Focus moves to the screencast surface on takeover, and a hint
14
+ appears if it is ever lost.
15
+ - **Ctrl+V pastes your clipboard.** The keydown was being swallowed, which suppressed the
16
+ browser's own paste event; forwarding Ctrl+V instead would have pasted the *headless browser's*
17
+ clipboard, which is not yours. The shortcut is now left alone so the native paste event fires
18
+ and the text is sent verbatim.
19
+ - Named keys (Backspace, arrows, Enter, Tab) and modifier combinations reach the page reliably
20
+ now that focus is where it needs to be — the daemon side always handled them correctly.
21
+
7
22
  ## [0.1.2] — 2026-08-23
8
23
 
9
24
  ### Added
package/README.md CHANGED
@@ -277,9 +277,9 @@ Current totals, as run against this checkout:
277
277
  |---|---|---|
278
278
  | `@antbot/contract` | 1 | 22 |
279
279
  | `@antbot/daemon` | 20 | 468 |
280
- | `@antbot/ui` | 7 | 52 |
280
+ | `@antbot/ui` | 8 | 59 |
281
281
  | `@antbot/cli` | 7 | 116 |
282
- | **Total** | **35** | **658** |
282
+ | **Total** | **36** | **665** |
283
283
 
284
284
  ## Status / not built
285
285
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@michael-joseph-miller/ant-bot",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Local-first daemon and web UI hosting persistent, named Claude agents.",
5
5
  "license": "MIT",
6
6
  "author": "Michael Miller",
@@ -127,4 +127,4 @@ Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error
127
127
 
128
128
  `)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=bn,s=!on.jitless,c=s&&xn.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?zi([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function Hi(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!In(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>Bn(e,r,sn())))}),t)}var Ui=M(`$ZodUnion`,(e,t)=>{ii.init(e,t),N(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),N(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),N(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),N(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>fn(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>Hi(t,r,e,i)):Hi(o,r,e,i)}}),Wi=M(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,Ui.init(e,t);let n=e._zod.parse;N(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=un(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!bn(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()),input:o,path:[t.discriminator],inst:e}),i)}}),Gi=M(`$ZodIntersection`,(e,t)=>{ii.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>qi(e,t,n)):qi(e,i,a)}});function Ki(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Sn(e)&&Sn(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=Ki(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=Ki(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function qi(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),In(e))return e;let o=Ki(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var Ji=M(`$ZodEnum`,(e,t)=>{ii.init(e,t);let n=cn(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>wn.has(typeof e)).map(e=>typeof e==`string`?Tn(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),Yi=M(`$ZodLiteral`,(e,t)=>{if(ii.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?Tn(e):e?Tn(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),Xi=M(`$ZodTransform`,(e,t)=>{ii.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new an(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n.fallback=!0,n));if(i instanceof Promise)throw new rn;return n.value=i,n.fallback=!0,n}});function Zi(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var Qi=M(`$ZodOptional`,(e,t)=>{ii.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,N(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),N(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${fn(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>Zi(e,r)):Zi(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),$i=M(`$ZodExactOptional`,(e,t)=>{Qi.init(e,t),N(e._zod,`values`,()=>t.innerType._zod.values),N(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),ea=M(`$ZodNullable`,(e,t)=>{ii.init(e,t),N(e._zod,`optin`,()=>t.innerType._zod.optin),N(e._zod,`optout`,()=>t.innerType._zod.optout),N(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${fn(e.source)}|null)$`):void 0}),N(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),ta=M(`$ZodDefault`,(e,t)=>{ii.init(e,t),e._zod.optin=`optional`,N(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>na(e,t)):na(r,t)}});function na(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var ra=M(`$ZodPrefault`,(e,t)=>{ii.init(e,t),e._zod.optin=`optional`,N(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),ia=M(`$ZodNonOptional`,(e,t)=>{ii.init(e,t),N(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>aa(t,e)):aa(i,e)}});function aa(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var oa=M(`$ZodCatch`,(e,t)=>{ii.init(e,t),e._zod.optin=`optional`,N(e._zod,`optout`,()=>t.innerType._zod.optout),N(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>Bn(e,n,sn()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>Bn(e,n,sn()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),sa=M(`$ZodPipe`,(e,t)=>{ii.init(e,t),N(e._zod,`values`,()=>t.in._zod.values),N(e._zod,`optin`,()=>t.in._zod.optin),N(e._zod,`optout`,()=>t.out._zod.optout),N(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>ca(e,t.in,n)):ca(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>ca(e,t.out,n)):ca(r,t.out,n)}});function ca(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}var la=M(`$ZodReadonly`,(e,t)=>{ii.init(e,t),N(e._zod,`propValues`,()=>t.innerType._zod.propValues),N(e._zod,`values`,()=>t.innerType._zod.values),N(e._zod,`optin`,()=>t.innerType?._zod?.optin),N(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(ua):ua(r)}});function ua(e){return e.value=Object.freeze(e.value),e}var da=M(`$ZodCustom`,(e,t)=>{zr.init(e,t),ii.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>fa(t,n,r,e));fa(i,n,r,e)}});function fa(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Hn(e))}}var pa,ma=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function ha(){return new ma}(pa=globalThis).__zod_globalRegistry??(pa.__zod_globalRegistry=ha());var ga=globalThis.__zod_globalRegistry;function _a(e,t){return new e({type:`string`,...P(t)})}function va(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...P(t)})}function ya(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...P(t)})}function ba(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...P(t)})}function xa(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...P(t)})}function Sa(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...P(t)})}function Ca(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...P(t)})}function wa(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...P(t)})}function Ta(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...P(t)})}function Ea(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...P(t)})}function Da(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...P(t)})}function Oa(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...P(t)})}function ka(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...P(t)})}function Aa(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...P(t)})}function ja(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...P(t)})}function Ma(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...P(t)})}function Na(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...P(t)})}function Pa(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...P(t)})}function Fa(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...P(t)})}function Ia(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...P(t)})}function La(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...P(t)})}function Ra(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...P(t)})}function za(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...P(t)})}function Ba(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...P(t)})}function Va(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...P(t)})}function Ha(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...P(t)})}function Ua(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...P(t)})}function Wa(e,t){return new e({type:`number`,checks:[],...P(t)})}function Ga(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...P(t)})}function Ka(e,t){return new e({type:`boolean`,...P(t)})}function qa(e){return new e({type:`unknown`})}function Ja(e,t){return new e({type:`never`,...P(t)})}function Ya(e,t){return new Vr({check:`less_than`,...P(t),value:e,inclusive:!1})}function Xa(e,t){return new Vr({check:`less_than`,...P(t),value:e,inclusive:!0})}function Za(e,t){return new Hr({check:`greater_than`,...P(t),value:e,inclusive:!1})}function Qa(e,t){return new Hr({check:`greater_than`,...P(t),value:e,inclusive:!0})}function $a(e,t){return new Ur({check:`multiple_of`,...P(t),value:e})}function eo(e,t){return new Gr({check:`max_length`,...P(t),maximum:e})}function to(e,t){return new Kr({check:`min_length`,...P(t),minimum:e})}function no(e,t){return new qr({check:`length_equals`,...P(t),length:e})}function ro(e,t){return new Yr({check:`string_format`,format:`regex`,...P(t),pattern:e})}function io(e){return new Xr({check:`string_format`,format:`lowercase`,...P(e)})}function ao(e){return new Zr({check:`string_format`,format:`uppercase`,...P(e)})}function oo(e,t){return new Qr({check:`string_format`,format:`includes`,...P(t),includes:e})}function so(e,t){return new $r({check:`string_format`,format:`starts_with`,...P(t),prefix:e})}function co(e,t){return new ei({check:`string_format`,format:`ends_with`,...P(t),suffix:e})}function lo(e){return new ti({check:`overwrite`,tx:e})}function uo(e){return lo(t=>t.normalize(e))}function fo(){return lo(e=>e.trim())}function po(){return lo(e=>e.toLowerCase())}function mo(){return lo(e=>e.toUpperCase())}function ho(){return lo(e=>vn(e))}function R(e,t,n){return new e({type:`array`,element:t,...P(n)})}function z(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...P(n)})}function go(e,t){let n=_o(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Hn(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=t.value,r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(Hn(r))}},e(t.value,t)),t);return n}function _o(e,t){let n=new zr({check:`custom`,...P(t)});return n._zod.check=e,n}function vo(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??ga,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function yo(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,yo(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&So(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function bo(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
129
129
 
130
- 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 xo(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:B(t,`input`,e.processors),output:B(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function So(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 So(r.element,n);if(r.type===`set`)return So(r.valueType,n);if(r.type===`lazy`)return So(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 So(r.innerType,n);if(r.type===`intersection`)return So(r.left,n)||So(r.right,n);if(r.type===`record`||r.type===`map`)return So(r.keyType,n)||So(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:So(r.in,n)||So(r.out,n);if(r.type===`object`){for(let e in r.shape)if(So(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(So(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(So(e,n))return!0;return!!(r.rest&&So(r.rest,n))}return!1}var Co=(e,t={})=>n=>{let r=vo({...n,processors:t});return yo(e,r),bo(r,e),xo(r,e)},B=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=vo({...i??{},target:a,io:t,processors:n});return yo(e,o),bo(o,e),xo(o,e)},wo={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},To=(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=wo[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}))])}},Eo=(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)},Do=(e,t,n,r)=>{n.type=`boolean`},Oo=(e,t,n,r)=>{n.not={}},ko=(e,t,n,r)=>{let i=e._zod.def,a=cn(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Ao=(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}},jo=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Mo=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},No=(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=yo(a.element,t,{...r,path:[...r.path,`items`]})},Po=(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]=yo(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=yo(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Fo=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>yo(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Io=(e,t,n,r)=>{let i=e._zod.def,a=yo(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=yo(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]]},Lo=(e,t,n,r)=>{let i=e._zod.def,a=yo(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`}]},Ro=(e,t,n,r)=>{let i=e._zod.def;yo(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},zo=(e,t,n,r)=>{let i=e._zod.def;yo(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Bo=(e,t,n,r)=>{let i=e._zod.def;yo(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)))},Vo=(e,t,n,r)=>{let i=e._zod.def;yo(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},Ho=(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;yo(o,t,r);let s=t.seen.get(e);s.ref=o},Uo=(e,t,n,r)=>{let i=e._zod.def;yo(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Wo=(e,t,n,r)=>{let i=e._zod.def;yo(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Go=M(`ZodISODateTime`,(e,t)=>{_i.init(e,t),_s.init(e,t)});function Ko(e){return Ba(Go,e)}var qo=M(`ZodISODate`,(e,t)=>{vi.init(e,t),_s.init(e,t)});function Jo(e){return Va(qo,e)}var Yo=M(`ZodISOTime`,(e,t)=>{yi.init(e,t),_s.init(e,t)});function Xo(e){return Ha(Yo,e)}var Zo=M(`ZodISODuration`,(e,t)=>{bi.init(e,t),_s.init(e,t)});function Qo(e){return Ua(Zo,e)}var $o=M(`ZodError`,(e,t)=>{Wn.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>qn(e,t)},flatten:{value:t=>Kn(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,ln,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,ln,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),es=Jn($o),ts=Yn($o),ns=Xn($o),rs=Qn($o),is=er($o),as=tr($o),os=nr($o),ss=rr($o),cs=ir($o),ls=ar($o),us=or($o),ds=sr($o),fs=new WeakMap;function ps(e,t,n){let r=Object.getPrototypeOf(e),i=fs.get(r);if(i||(i=new Set,fs.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 ms=M(`ZodType`,(e,t)=>(ii.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:B(e,`input`),output:B(e,`output`)}}),e.toJSONSchema=Co(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>es(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>ns(e,t,n),e.parseAsync=async(t,n)=>ts(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>rs(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>is(e,t,n),e.decode=(t,n)=>as(e,t,n),e.encodeAsync=async(t,n)=>os(e,t,n),e.decodeAsync=async(t,n)=>ss(e,t,n),e.safeEncode=(t,n)=>cs(e,t,n),e.safeDecode=(t,n)=>ls(e,t,n),e.safeEncodeAsync=async(t,n)=>us(e,t,n),e.safeDecodeAsync=async(t,n)=>ds(e,t,n),ps(e,`ZodType`,{check(...e){let t=this.def;return this.clone(gn(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 En(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(wc(e,t))},superRefine(e,t){return this.check(Tc(e,t))},overwrite(e){return this.check(lo(e))},optional(){return oc(this)},exactOptional(){return cc(this)},nullable(){return uc(this)},nullish(){return oc(uc(this))},nonoptional(e){return gc(this,e)},array(){return qs(this)},or(e){return Xs([this,e])},and(e){return ec(this,e)},transform(e){return bc(this,ic(e))},default(e){return fc(this,e)},prefault(e){return mc(this,e)},catch(e){return vc(this,e)},pipe(e){return bc(this,e)},readonly(){return Sc(this)},describe(e){let t=this.clone();return ga.add(t,{description:e}),t},meta(...e){if(e.length===0)return ga.get(this);let t=this.clone();return ga.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 ga.get(e)?.description},configurable:!0}),e)),hs=M(`_ZodString`,(e,t)=>{ai.init(e,t),ms.init(e,t),e._zod.processJSONSchema=(t,n,r)=>To(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,ps(e,`_ZodString`,{regex(...e){return this.check(ro(...e))},includes(...e){return this.check(oo(...e))},startsWith(...e){return this.check(so(...e))},endsWith(...e){return this.check(co(...e))},min(...e){return this.check(to(...e))},max(...e){return this.check(eo(...e))},length(...e){return this.check(no(...e))},nonempty(...e){return this.check(to(1,...e))},lowercase(e){return this.check(io(e))},uppercase(e){return this.check(ao(e))},trim(){return this.check(fo())},normalize(...e){return this.check(uo(...e))},toLowerCase(){return this.check(po())},toUpperCase(){return this.check(mo())},slugify(){return this.check(ho())}})}),gs=M(`ZodString`,(e,t)=>{ai.init(e,t),hs.init(e,t),e.email=t=>e.check(va(vs,t)),e.url=t=>e.check(wa(xs,t)),e.jwt=t=>e.check(za(Is,t)),e.emoji=t=>e.check(Ta(Ss,t)),e.guid=t=>e.check(ya(ys,t)),e.uuid=t=>e.check(ba(bs,t)),e.uuidv4=t=>e.check(xa(bs,t)),e.uuidv6=t=>e.check(Sa(bs,t)),e.uuidv7=t=>e.check(Ca(bs,t)),e.nanoid=t=>e.check(Ea(Cs,t)),e.guid=t=>e.check(ya(ys,t)),e.cuid=t=>e.check(Da(ws,t)),e.cuid2=t=>e.check(Oa(Ts,t)),e.ulid=t=>e.check(ka(Es,t)),e.base64=t=>e.check(Ia(Ns,t)),e.base64url=t=>e.check(La(Ps,t)),e.xid=t=>e.check(Aa(Ds,t)),e.ksuid=t=>e.check(ja(Os,t)),e.ipv4=t=>e.check(Ma(ks,t)),e.ipv6=t=>e.check(Na(As,t)),e.cidrv4=t=>e.check(Pa(js,t)),e.cidrv6=t=>e.check(Fa(Ms,t)),e.e164=t=>e.check(Ra(Fs,t)),e.datetime=t=>e.check(Ko(t)),e.date=t=>e.check(Jo(t)),e.time=t=>e.check(Xo(t)),e.duration=t=>e.check(Qo(t))});function V(e){return _a(gs,e)}var _s=M(`ZodStringFormat`,(e,t)=>{F.init(e,t),hs.init(e,t)}),vs=M(`ZodEmail`,(e,t)=>{ci.init(e,t),_s.init(e,t)}),ys=M(`ZodGUID`,(e,t)=>{oi.init(e,t),_s.init(e,t)}),bs=M(`ZodUUID`,(e,t)=>{si.init(e,t),_s.init(e,t)}),xs=M(`ZodURL`,(e,t)=>{li.init(e,t),_s.init(e,t)}),Ss=M(`ZodEmoji`,(e,t)=>{ui.init(e,t),_s.init(e,t)}),Cs=M(`ZodNanoID`,(e,t)=>{di.init(e,t),_s.init(e,t)}),ws=M(`ZodCUID`,(e,t)=>{fi.init(e,t),_s.init(e,t)}),Ts=M(`ZodCUID2`,(e,t)=>{pi.init(e,t),_s.init(e,t)}),Es=M(`ZodULID`,(e,t)=>{mi.init(e,t),_s.init(e,t)}),Ds=M(`ZodXID`,(e,t)=>{hi.init(e,t),_s.init(e,t)}),Os=M(`ZodKSUID`,(e,t)=>{gi.init(e,t),_s.init(e,t)}),ks=M(`ZodIPv4`,(e,t)=>{xi.init(e,t),_s.init(e,t)}),As=M(`ZodIPv6`,(e,t)=>{Si.init(e,t),_s.init(e,t)}),js=M(`ZodCIDRv4`,(e,t)=>{Ci.init(e,t),_s.init(e,t)}),Ms=M(`ZodCIDRv6`,(e,t)=>{wi.init(e,t),_s.init(e,t)}),Ns=M(`ZodBase64`,(e,t)=>{Ei.init(e,t),_s.init(e,t)}),Ps=M(`ZodBase64URL`,(e,t)=>{Oi.init(e,t),_s.init(e,t)}),Fs=M(`ZodE164`,(e,t)=>{ki.init(e,t),_s.init(e,t)}),Is=M(`ZodJWT`,(e,t)=>{ji.init(e,t),_s.init(e,t)}),Ls=M(`ZodNumber`,(e,t)=>{Mi.init(e,t),ms.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Eo(e,t,n,r),ps(e,`ZodNumber`,{gt(e,t){return this.check(Za(e,t))},gte(e,t){return this.check(Qa(e,t))},min(e,t){return this.check(Qa(e,t))},lt(e,t){return this.check(Ya(e,t))},lte(e,t){return this.check(Xa(e,t))},max(e,t){return this.check(Xa(e,t))},int(e){return this.check(zs(e))},safe(e){return this.check(zs(e))},positive(e){return this.check(Za(0,e))},nonnegative(e){return this.check(Qa(0,e))},negative(e){return this.check(Ya(0,e))},nonpositive(e){return this.check(Xa(0,e))},multipleOf(e,t){return this.check($a(e,t))},step(e,t){return this.check($a(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 H(e){return Wa(Ls,e)}var Rs=M(`ZodNumberFormat`,(e,t)=>{Ni.init(e,t),Ls.init(e,t)});function zs(e){return Ga(Rs,e)}var Bs=M(`ZodBoolean`,(e,t)=>{Pi.init(e,t),ms.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Do(e,t,n,r)});function Vs(e){return Ka(Bs,e)}var Hs=M(`ZodUnknown`,(e,t)=>{Fi.init(e,t),ms.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Us(){return qa(Hs)}var Ws=M(`ZodNever`,(e,t)=>{Ii.init(e,t),ms.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oo(e,t,n,r)});function Gs(e){return Ja(Ws,e)}var Ks=M(`ZodArray`,(e,t)=>{L.init(e,t),ms.init(e,t),e._zod.processJSONSchema=(t,n,r)=>No(e,t,n,r),e.element=t.element,ps(e,`ZodArray`,{min(e,t){return this.check(to(e,t))},nonempty(e){return this.check(to(1,e))},max(e,t){return this.check(eo(e,t))},length(e,t){return this.check(no(e,t))},unwrap(){return this.element}})});function qs(e,t){return R(Ks,e,t)}var Js=M(`ZodObject`,(e,t)=>{Vi.init(e,t),ms.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Po(e,t,n,r),N(e,`shape`,()=>t.shape),ps(e,`ZodObject`,{keyof(){return W(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:Us()})},loose(){return this.clone({...this._zod.def,catchall:Us()})},strict(){return this.clone({...this._zod.def,catchall:Gs()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return jn(this,e)},safeExtend(e){return Mn(this,e)},merge(e){return Nn(this,e)},pick(e){return kn(this,e)},omit(e){return An(this,e)},partial(...e){return Pn(ac,this,e[0])},required(...e){return Fn(hc,this,e[0])}})});function U(e,t){return new Js({type:`object`,shape:e??{},...P(t)})}var Ys=M(`ZodUnion`,(e,t)=>{Ui.init(e,t),ms.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fo(e,t,n,r),e.options=t.options});function Xs(e,t){return new Ys({type:`union`,options:e,...P(t)})}var Zs=M(`ZodDiscriminatedUnion`,(e,t)=>{Ys.init(e,t),Wi.init(e,t)});function Qs(e,t,n){return new Zs({type:`union`,options:t,discriminator:e,...P(n)})}var $s=M(`ZodIntersection`,(e,t)=>{Gi.init(e,t),ms.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Io(e,t,n,r)});function ec(e,t){return new $s({type:`intersection`,left:e,right:t})}var tc=M(`ZodEnum`,(e,t)=>{Ji.init(e,t),ms.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ko(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 tc({...t,checks:[],...P(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 tc({...t,checks:[],...P(r),entries:i})}});function W(e,t){return new tc({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...P(t)})}var nc=M(`ZodLiteral`,(e,t)=>{Yi.init(e,t),ms.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ao(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 G(e,t){return new nc({type:`literal`,values:Array.isArray(e)?e:[e],...P(t)})}var rc=M(`ZodTransform`,(e,t)=>{Xi.init(e,t),ms.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mo(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new an(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Hn(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(Hn(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 ic(e){return new rc({type:`transform`,transform:e})}var ac=M(`ZodOptional`,(e,t)=>{Qi.init(e,t),ms.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function oc(e){return new ac({type:`optional`,innerType:e})}var sc=M(`ZodExactOptional`,(e,t)=>{$i.init(e,t),ms.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function cc(e){return new sc({type:`optional`,innerType:e})}var lc=M(`ZodNullable`,(e,t)=>{ea.init(e,t),ms.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function uc(e){return new lc({type:`nullable`,innerType:e})}var dc=M(`ZodDefault`,(e,t)=>{ta.init(e,t),ms.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function fc(e,t){return new dc({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Cn(t)}})}var pc=M(`ZodPrefault`,(e,t)=>{ra.init(e,t),ms.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function mc(e,t){return new pc({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Cn(t)}})}var hc=M(`ZodNonOptional`,(e,t)=>{ia.init(e,t),ms.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ro(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function gc(e,t){return new hc({type:`nonoptional`,innerType:e,...P(t)})}var _c=M(`ZodCatch`,(e,t)=>{oa.init(e,t),ms.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function vc(e,t){return new _c({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var yc=M(`ZodPipe`,(e,t)=>{sa.init(e,t),ms.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ho(e,t,n,r),e.in=t.in,e.out=t.out});function bc(e,t){return new yc({type:`pipe`,in:e,out:t})}var xc=M(`ZodReadonly`,(e,t)=>{la.init(e,t),ms.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Uo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Sc(e){return new xc({type:`readonly`,innerType:e})}var Cc=M(`ZodCustom`,(e,t)=>{da.init(e,t),ms.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jo(e,t,n,r)});function wc(e,t={}){return z(Cc,e,t)}function Tc(e,t){return go(e,t)}var Ec=W([`idle`,`queued`,`running`,`waiting_approval`,`waiting_input`,`interrupted`]),Dc=W([`none`,`unread`,`needs_attention`]),Oc=[`fable`,`opus`,`sonnet`,`haiku`],kc=W(Oc);U({id:V(),slug:V().regex(/^[a-z0-9][a-z0-9-]*$/),name:V().min(1).max(60),title:V().max(120).default(``),description:V().max(8e3).default(``),avatarEmoji:V().max(8).default(`🤖`),modelTier:kc.default(`sonnet`),pinned:Vs().default(!1),hidden:Vs().default(!1),notifications:Vs().default(!0),sessionId:V().nullable().default(null),state:Ec.default(`idle`),attention:Dc.default(`none`),threadId:V().nullable().default(null),createdAt:H(),deletedAt:H().nullable().default(null)});var Ac=W([`dm`,`group`]);U({id:V(),kind:Ac,title:V().default(``),memberBotIds:qs(V()).default([]),pinned:Vs().default(!1),hidden:Vs().default(!1),lastReadAt:H().default(0),createdAt:H()});var jc=Qs(`type`,[U({type:G(`tool`),toolName:V(),summary:V(),input:Us().optional(),result:V().optional(),status:W([`running`,`ok`,`error`,`denied`])}),U({type:G(`file`),path:V(),name:V(),mime:V(),bytes:H(),action:W([`created`,`modified`]).default(`created`)}),U({type:G(`approval`),approvalId:V()}),U({type:G(`handoff`),fromBotId:V(),toBotId:V(),note:V()}),U({type:G(`error`),message:V()})]),Mc=W([`user`,`bot`,`system`]),Nc=U({id:V(),threadId:V(),authorKind:Mc,authorBotId:V().nullable().default(null),replyToId:V().nullable().default(null),contentMd:V().default(``),cards:qs(jc).default([]),streaming:Vs().default(!1),createdAt:H()});U({id:V(),messageId:V().nullable(),path:V(),name:V(),mime:V(),bytes:H(),createdAt:H()});var Pc=W([`pending`,`allowed`,`denied`,`expired`]),Fc=U({id:V(),botId:V(),threadId:V(),toolName:V(),inputSummary:V(),rawInput:Us(),status:Pc.default(`pending`),decidedBy:W([`user`,`rule`,`auto_review`]).nullable().default(null),reason:V().default(``),ruleId:V().nullable().default(null),createdAt:H(),decidedAt:H().nullable().default(null)}),Ic=W([`require`,`allow`]);U({id:V(),kind:Ic,toolPattern:V().default(`*`),inputPattern:V().default(``),scopeNote:V().default(``),builtin:Vs().default(!1),enabled:Vs().default(!0),createdAt:H()}),U({id:V(),slug:V(),name:V(),description:V().default(``),path:V(),source:W([`user`,`taught`,`imported`]).default(`user`),createdAt:H()}),U({id:V(),botId:V(),name:V().min(1),cronExpr:V(),timezone:V().default(`UTC`),instructionMd:V(),enabled:Vs().default(!0),lastRunAt:H().nullable().default(null),nextRunAt:H().nullable().default(null),createdAt:H()});var Lc=U({id:V(),routineId:V(),startedAt:H(),finishedAt:H().nullable().default(null),status:W([`running`,`ok`,`failed`,`interrupted`]),summary:V().default(``),threadId:V().nullable().default(null),isTest:Vs().default(!1)});U({id:V(),fromBotId:V(),toBotId:V(),contentMd:V(),hops:H().default(1),delivered:Vs().default(!1),createdAt:H()}),U({id:V(),botId:V(),turnId:V(),model:V(),inputTokens:H().default(0),outputTokens:H().default(0),cacheReadTokens:H().default(0),costEstimate:H().default(0),createdAt:H()}),W([`user`,`bot`,`routine`,`system`]);var Rc={seq:H(),threadId:V().nullable(),botId:V().nullable()};Qs(`type`,[U({...Rc,type:G(`hello`)}),U({...Rc,type:G(`message.created`),message:Nc}),U({...Rc,type:G(`message.delta`),messageId:V(),delta:V()}),U({...Rc,type:G(`message.done`),messageId:V(),contentMd:V()}),U({...Rc,type:G(`message.card`),messageId:V(),card:jc,cardIndex:H()}),U({...Rc,type:G(`bot.state`),state:Ec,attention:Dc}),U({...Rc,type:G(`approval.pending`),approval:Fc}),U({...Rc,type:G(`approval.resolved`),approval:Fc}),U({...Rc,type:G(`routine.run`),run:Lc}),U({...Rc,type:G(`usage.tick`),inputTokens:H(),outputTokens:H(),model:V()}),U({...Rc,type:G(`notify`),title:V(),body:V(),level:W([`info`,`warn`,`error`])}),U({...Rc,type:G(`secret.request`),requestId:V(),name:V(),reason:V()}),U({...Rc,type:G(`thread.updated`),threadId2:V()})]);var zc=Qs(`kind`,[U({kind:G(`mouse`),action:W([`move`,`down`,`up`,`wheel`]),x:H().min(0).max(1),y:H().min(0).max(1),button:W([`left`,`middle`,`right`]).default(`left`),clickCount:H().int().min(0).max(3).default(1),deltaX:H().default(0),deltaY:H().default(0)}),U({kind:G(`key`),action:W([`down`,`up`]),key:V().min(1).max(32)}),U({kind:G(`text`),text:V().min(1).max(4096)})]);U({type:G(`input`),input:zc}),U({name:V().min(1).max(60),title:V().max(120).optional(),description:V().max(8e3).optional(),avatarEmoji:V().max(8).optional(),modelTier:kc.optional()}).partial().extend({pinned:Vs().optional(),hidden:Vs().optional(),notifications:Vs().optional()}),U({kind:W([`dm`,`group`]),title:V().optional(),memberBotIds:qs(V())}),U({contentMd:V(),attachmentIds:qs(V()).optional(),replyToId:V().nullable().optional(),mentionBotIds:qs(V()).optional(),mentionEveryone:Vs().optional()}),U({decision:W([`allow`,`deny`]),alwaysRule:U({toolPattern:V(),inputPattern:V().default(``),scopeNote:V().default(``)}).optional()}),U({kind:W([`require`,`allow`]),toolPattern:V().min(1),inputPattern:V().default(``),scopeNote:V().default(``)}),U({botId:V(),name:V().min(1),cronExpr:V().min(1),timezone:V().optional(),instructionMd:V().min(1),enabled:Vs().optional()}),U({name:V().min(1),description:V().default(``),bodyMd:V().min(1),source:W([`user`,`taught`,`imported`]).optional()});var Bc={timezone:V(),maxConcurrentSessions:H().min(1).max(8),autoReviewEnabled:Vs(),theme:W([`system`,`light`,`dark`]),localExecution:W([`ask`,`always`,`never`]),dailyTokenBudget:H(),notificationsEnabled:Vs(),billingMode:W([`subscription`,`api`]),computerMode:W([`host`,`container`])};U({timezone:Bc.timezone.default(`UTC`),maxConcurrentSessions:Bc.maxConcurrentSessions.default(2),autoReviewEnabled:Bc.autoReviewEnabled.default(!0),theme:Bc.theme.default(`system`),localExecution:Bc.localExecution.default(`ask`),dailyTokenBudget:Bc.dailyTokenBudget.default(0),notificationsEnabled:Bc.notificationsEnabled.default(!0),billingMode:Bc.billingMode.default(`subscription`),computerMode:Bc.computerMode.default(`host`)}),U(Bc).partial(),U({kind:W([`message`,`file`,`routine`,`bot`]),id:V(),threadId:V().nullable(),botId:V().nullable(),title:V(),snippet:V(),createdAt:H()});var Vc=tn.MAX_ATTACHMENTS_PER_MESSAGE;function Hc(e,t){let n=e.slice(0,t),r=/(^|\s)([@/])([\w-]*)$/.exec(n);if(!r)return null;let i=r[2];return i===`/`&&n.trim()!==`/${r[3]}`?null:{prefix:i,query:r[3],start:t-r[3].length-1}}function Uc({onSend:e,bots:t,skills:n,running:r,onStop:i,uploadFile:a}){let[o,s]=(0,_.useState)(``),[c,l]=(0,_.useState)([]),[u,d]=(0,_.useState)(null),f=(0,_.useRef)(null),p=(0,_.useRef)(null),m=(0,_.useRef)(0);(0,_.useEffect)(()=>{m.current=c.length},[c.length]);let h=(0,_.useMemo)(()=>a??(e=>w.attachments.upload(e)),[a]),g=(0,_.useMemo)(()=>{if(!u||u.prefix!==`@`)return[];let e=u.query.toLowerCase();return t.filter(t=>t.bot.name.toLowerCase().includes(e)||t.bot.slug.toLowerCase().includes(e)).slice(0,8)},[u,t]),v=(0,_.useMemo)(()=>{if(!u||u.prefix!==`/`)return[];let e=u.query.toLowerCase();return n.filter(t=>t.slug.toLowerCase().includes(e)||t.name.toLowerCase().includes(e)).slice(0,8)},[u,n]);function y(e){let t=Array.from(e),n=Math.max(0,Vc-m.current),r=t.slice(0,n);m.current=Math.min(Vc,m.current+r.length);for(let e of r)h(e).then(e=>{l(t=>t.length>=Vc?t:[...t,e])}).catch(()=>{m.current=Math.max(0,m.current-1)})}function b(e){l(t=>t.filter(t=>t.id!==e))}function x(){let t=o.trim();t&&(e(t,c.map(e=>e.id)),s(``),l([]),d(null))}function ee(e,t){s(e),d(Hc(e,t))}function te(e){e.key===`Enter`&&!e.shiftKey?(e.preventDefault(),x()):e.key===`Escape`&&d(null)}function S(e){if(!u)return;let t=p.current,n=t?t.selectionStart:o.length,r=o.slice(0,u.start),i=o.slice(n),a=u.prefix===`@`?`@${e} `:`/${e} `,c=`${r}${a}${i}`;s(c),d(null),requestAnimationFrame(()=>{t?.focus();let e=r.length+a.length;t?.setSelectionRange(e,e)})}function ne(e){let t=Array.from(e.clipboardData?.items??[]).filter(e=>e.kind===`file`&&e.type.startsWith(`image/`)).map(e=>e.getAsFile()).filter(e=>!!e);t.length>0&&(e.preventDefault(),y(t))}function re(e){e.preventDefault(),e.dataTransfer.files.length>0&&y(e.dataTransfer.files)}return(0,O.jsxs)(`div`,{className:`shrink-0 border-t border-(--color-border) bg-(--color-bg-elevated) p-3`,onDrop:re,onDragOver:e=>e.preventDefault(),children:[c.length>0&&(0,O.jsx)(`div`,{className:`mb-2 flex flex-wrap gap-2`,children:c.map(e=>(0,O.jsxs)(`span`,{"data-testid":`attachment-chip`,className:`flex items-center gap-1.5 rounded-full border border-(--color-border) bg-(--color-bg) px-2.5 py-1 text-xs`,children:[e.name,(0,O.jsx)(`button`,{type:`button`,"aria-label":`Remove ${e.name}`,className:`text-(--color-text-muted) hover:text-(--color-red)`,onClick:()=>b(e.id),children:`×`})]},e.id))}),u&&(g.length>0||v.length>0)&&(0,O.jsx)(`div`,{className:`mb-2 max-h-40 overflow-auto rounded border border-(--color-border) bg-(--color-bg) text-sm shadow-lg`,children:u.prefix===`@`?g.map(e=>(0,O.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 px-3 py-1.5 text-left hover:bg-(--color-bg-hover)`,onClick:()=>S(e.bot.slug),children:[(0,O.jsx)(`span`,{children:e.bot.avatarEmoji}),(0,O.jsx)(`span`,{children:e.bot.name})]},e.bot.id)):v.map(e=>(0,O.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 px-3 py-1.5 text-left hover:bg-(--color-bg-hover)`,onClick:()=>S(e.slug),children:[(0,O.jsxs)(`span`,{className:`shrink-0 font-mono text-(--color-text-muted)`,children:[`/`,e.slug]}),(0,O.jsx)(`span`,{className:`min-w-0 truncate text-(--color-text-muted)`,title:e.description,children:e.description})]},e.id))}),(0,O.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,O.jsx)(`button`,{type:`button`,"aria-label":`Attach files`,className:`shrink-0 rounded border border-(--color-border) px-2.5 py-2 text-sm hover:bg-(--color-bg-hover)`,onClick:()=>f.current?.click(),children:`+`}),(0,O.jsx)(`input`,{ref:f,"data-testid":`attachment-input`,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{e.target.files&&y(e.target.files),e.target.value=``}}),(0,O.jsx)(`textarea`,{ref:p,value:o,rows:1,placeholder:`Message… (@ to mention, / for a skill)`,className:`max-h-40 min-h-[38px] flex-1 resize-none rounded border border-(--color-border) bg-(--color-bg) px-3 py-2 text-sm outline-none focus:border-(--color-accent)`,onChange:e=>ee(e.target.value,e.target.selectionStart),onKeyDown:te,onPaste:ne}),r&&(0,O.jsx)(`button`,{type:`button`,onClick:i,className:`shrink-0 rounded border border-(--color-red) px-3 py-2 text-sm font-medium text-(--color-red) hover:bg-(--color-red)/10`,children:`Stop`}),(0,O.jsx)(`button`,{type:`button`,onClick:x,disabled:!o.trim(),className:`shrink-0 rounded bg-(--color-accent) px-3 py-2 text-sm font-medium text-(--color-accent-fg) disabled:opacity-40`,children:`Send`})]})]})}j.setOptions({breaks:!0});function Wc(e){return j.parse(e,{async:!1}).replace(/<script[\s\S]*?<\/script>/gi,``)}function Gc(e,t){if(e.authorKind===`user`)return{name:`You`,emoji:`🧑`};if(e.authorKind===`system`)return{name:`System`,emoji:`⚙️`};let n=e.authorBotId?t[e.authorBotId]?.bot:void 0;return{name:n?.name??`Bot`,emoji:n?.avatarEmoji??`🤖`}}function Kc({message:e,botsById:t}){let{name:n,emoji:r}=Gc(e,t),i=e.authorKind===`user`;return(0,O.jsxs)(`div`,{className:b(`flex gap-3 px-4 py-2`,i&&`flex-row-reverse`),children:[(0,O.jsx)(`span`,{className:`mt-0.5 text-lg leading-none`,children:r}),(0,O.jsxs)(`div`,{className:b(`min-w-0 max-w-[75%]`,i&&`items-end text-right`),children:[(0,O.jsxs)(`div`,{className:b(`mb-0.5 flex items-baseline gap-2`,i&&`flex-row-reverse`),children:[(0,O.jsx)(`span`,{className:`text-xs font-semibold text-(--color-text-muted)`,children:n}),(0,O.jsx)(`span`,{className:`text-[11px] text-(--color-text-faint)`,children:new Date(e.createdAt).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})})]}),e.contentMd&&(0,O.jsxs)(`div`,{className:b(`markdown-body inline-block rounded-lg px-3 py-2 text-sm`,i?`bg-(--color-accent) text-(--color-accent-fg)`:`bg-(--color-bg-elevated)`),children:[(0,O.jsx)(`span`,{dangerouslySetInnerHTML:{__html:Wc(e.contentMd)}}),e.streaming&&(0,O.jsx)(`span`,{className:`ml-0.5 inline-block w-1.5 animate-pulse bg-current align-middle`,children:`\xA0`})]}),(0,O.jsx)(en,{cards:e.cards})]})]})}function qc({thread:e,messages:t,botsById:n,bots:r,skills:i,running:a,onSend:o,onStop:s}){let c=(0,_.useRef)(null),[l,u]=(0,_.useState)(!0);(0,_.useEffect)(()=>{if(!l)return;let e=()=>{let e=c.current;e&&(e.scrollTop=e.scrollHeight)};e();let t=requestAnimationFrame(()=>{e(),requestAnimationFrame(e)});return()=>cancelAnimationFrame(t)},[t,l]);function d(){let e=c.current;if(!e)return;let t=e.scrollHeight-e.scrollTop-e.clientHeight;u(t<80)}return e?(0,O.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,O.jsx)(`div`,{ref:c,onScroll:d,className:`min-h-0 flex-1 overflow-y-auto py-2`,children:t.length===0?(0,O.jsx)(`p`,{className:`px-4 py-8 text-center text-sm text-(--color-text-muted)`,children:`No messages yet — say hello and give this bot a job.`}):t.map(e=>(0,O.jsx)(Kc,{message:e,botsById:n},e.id))}),(0,O.jsx)(Uc,{onSend:o,bots:r,skills:i,running:a,onStop:s})]}):(0,O.jsx)(`div`,{className:`flex h-full flex-1 flex-col items-center justify-center text-(--color-text-muted)`,children:(0,O.jsx)(`p`,{className:`text-sm`,children:`Select a bot to start a conversation, or create a new one.`})})}var Jc=`🤖.🧠.🦾.🛰️.🧭.🗂️.📚.🔍.🧮.🧰.🛠️.⚙️.🧪.🧬.📈.📊.💡.🗒️.✍️.📝.📅.⏰.📬.📡.🌐.🔐.🗝️.🧯.🚀.🛎️.🎯.🧵.🧩.🕵️.🧑‍💻.👩‍💻.🧑‍🔬.🐜.🐝.🦉`.split(`.`);function Yc({onCreate:e,onClose:t,busy:n,error:r}){let[i,a]=(0,_.useState)(``),[o,s]=(0,_.useState)(``),[c,l]=(0,_.useState)(``),[u,d]=(0,_.useState)(`🤖`),[f,p]=(0,_.useState)(`sonnet`);function m(){i.trim()&&e({name:i.trim(),title:o.trim(),description:c.trim(),avatarEmoji:u,modelTier:f})}return(0,O.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4`,children:(0,O.jsxs)(`div`,{className:`w-full max-w-md rounded-lg border border-(--color-border) bg-(--color-bg-elevated) p-5 shadow-xl`,children:[(0,O.jsx)(`h2`,{className:`mb-4 text-base font-semibold`,children:`New bot`}),(0,O.jsxs)(`div`,{className:`space-y-3`,children:[(0,O.jsx)(`div`,{className:`flex items-center gap-3`,children:(0,O.jsx)(`div`,{className:`grid grid-cols-8 gap-1 rounded border border-(--color-border) p-1.5`,children:Jc.slice(0,16).map(e=>(0,O.jsx)(`button`,{type:`button`,"aria-pressed":u===e,onClick:()=>d(e),className:`rounded p-1 text-lg ${u===e?`bg-(--color-accent)/25`:`hover:bg-(--color-bg-hover)`}`,children:e},e))})}),(0,O.jsxs)(`label`,{className:`block text-xs`,children:[(0,O.jsx)(`span`,{className:`mb-1 block text-(--color-text-muted)`,children:`Name`}),(0,O.jsx)(`input`,{autoFocus:!0,className:`w-full rounded border border-(--color-border) bg-(--color-bg) px-2 py-1.5 text-sm`,value:i,onChange:e=>a(e.target.value),placeholder:`Scout`})]}),(0,O.jsxs)(`label`,{className:`block text-xs`,children:[(0,O.jsx)(`span`,{className:`mb-1 block text-(--color-text-muted)`,children:`Title`}),(0,O.jsx)(`input`,{className:`w-full rounded border border-(--color-border) bg-(--color-bg) px-2 py-1.5 text-sm`,value:o,onChange:e=>s(e.target.value),placeholder:`Research assistant`})]}),(0,O.jsxs)(`label`,{className:`block text-xs`,children:[(0,O.jsx)(`span`,{className:`mb-1 block text-(--color-text-muted)`,children:`Description`}),(0,O.jsx)(`textarea`,{className:`w-full rounded border border-(--color-border) bg-(--color-bg) px-2 py-1.5 text-sm`,rows:3,value:c,onChange:e=>l(e.target.value),placeholder:`What should this bot do?`})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`span`,{className:`mb-1 block text-xs text-(--color-text-muted)`,children:`Model tier`}),(0,O.jsx)(`div`,{className:`inline-flex rounded border border-(--color-border) p-0.5`,children:Oc.map(e=>(0,O.jsx)(`button`,{type:`button`,onClick:()=>p(e),className:`rounded px-3 py-1 text-xs font-medium capitalize ${f===e?`bg-(--color-accent) text-(--color-accent-fg)`:`text-(--color-text-muted)`}`,children:e},e))})]}),(0,O.jsx)(`p`,{className:`rounded border border-(--color-amber)/40 bg-(--color-amber)/10 p-2 text-xs text-(--color-amber)`,children:`Bots share one computer, workspace, browser profile and logins. Bots are not a security boundary.`}),r&&(0,O.jsx)(`p`,{className:`text-xs text-(--color-red)`,children:r})]}),(0,O.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,O.jsx)(`button`,{type:`button`,onClick:t,className:`rounded px-3 py-1.5 text-sm text-(--color-text-muted) hover:bg-(--color-bg-hover)`,children:`Cancel`}),(0,O.jsx)(`button`,{type:`button`,onClick:m,disabled:!i.trim()||n,className:`rounded bg-(--color-accent) px-3 py-1.5 text-sm font-medium text-(--color-accent-fg) disabled:opacity-40`,children:`Create bot`})]})]})})}var Xc={running:`text-(--color-blue)`,ok:`text-(--color-green)`,failed:`text-(--color-red)`,interrupted:`text-(--color-amber)`};function Zc({botId:e,onCreated:t}){let[n,r]=(0,_.useState)(``),[i,a]=(0,_.useState)(`0 9 * * *`),[o,s]=(0,_.useState)(Intl.DateTimeFormat().resolvedOptions().timeZone||`UTC`),[c,l]=(0,_.useState)(``),[u,d]=(0,_.useState)(!1),[f,p]=(0,_.useState)(null);async function m(){if(!(!n.trim()||!i.trim()||!c.trim())){d(!0),p(null);try{t(await w.routines.create({botId:e,name:n,cronExpr:i,timezone:o,instructionMd:c})),r(``),l(``)}catch(e){p(e instanceof ie?e.message:`Failed to create routine`)}finally{d(!1)}}}return(0,O.jsxs)(`div`,{className:`space-y-2 rounded-md border border-(--color-border) p-3`,children:[(0,O.jsx)(`div`,{className:`text-xs font-semibold text-(--color-text-muted)`,children:`New routine`}),(0,O.jsx)(`input`,{className:`w-full rounded border border-(--color-border) bg-(--color-bg) px-2 py-1 text-sm`,placeholder:`Name`,value:n,onChange:e=>r(e.target.value)}),(0,O.jsxs)(`div`,{className:`flex gap-2`,children:[(0,O.jsx)(`input`,{className:`flex-1 rounded border border-(--color-border) bg-(--color-bg) px-2 py-1 font-mono text-sm`,placeholder:`Cron expression (e.g. 0 9 * * *)`,value:i,onChange:e=>a(e.target.value)}),(0,O.jsx)(`input`,{className:`w-40 rounded border border-(--color-border) bg-(--color-bg) px-2 py-1 text-sm`,placeholder:`Timezone`,value:o,onChange:e=>s(e.target.value)})]}),(0,O.jsx)(`textarea`,{className:`w-full rounded border border-(--color-border) bg-(--color-bg) px-2 py-1 text-sm`,placeholder:`Instructions for this run…`,rows:3,value:c,onChange:e=>l(e.target.value)}),f&&(0,O.jsx)(`p`,{className:`text-xs text-(--color-red)`,children:f}),(0,O.jsx)(`button`,{type:`button`,disabled:u,onClick:m,className:`rounded bg-(--color-accent) px-3 py-1.5 text-sm font-medium text-(--color-accent-fg) disabled:opacity-40`,children:`Create routine`})]})}function Qc({routine:e,onChanged:t,onDeleted:n}){let[r,i]=(0,_.useState)([]),[a,o]=(0,_.useState)(!1),[s,c]=(0,_.useState)(!1),[l,u]=(0,_.useState)(!1);async function d(){let t=await w.routines.runs(e.id);i(t.slice(0,20))}async function f(){let e=!a;o(e),e&&await d()}async function p(){t(await w.routines.update(e.id,{enabled:!e.enabled}))}async function m(){window.confirm(`Delete routine "${e.name}"?`)&&(await w.routines.remove(e.id),n(e.id))}async function h(){u(!0),c(!1);try{await w.routines.testRun(e.id),await d(),o(!0)}finally{u(!1)}}return(0,O.jsxs)(`div`,{className:`rounded-md border border-(--color-border) p-3`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`div`,{className:`text-sm font-medium`,children:e.name}),(0,O.jsxs)(`div`,{className:`font-mono text-xs text-(--color-text-muted)`,children:[e.cronExpr,` · `,e.timezone]}),e.nextRunAt&&(0,O.jsxs)(`div`,{className:`text-xs text-(--color-text-faint)`,children:[`Next run: `,new Date(e.nextRunAt).toLocaleString()]})]}),(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsxs)(`label`,{className:`flex items-center gap-1 text-xs text-(--color-text-muted)`,children:[(0,O.jsx)(`input`,{type:`checkbox`,checked:e.enabled,onChange:p}),`Enabled`]}),(0,O.jsx)(`button`,{type:`button`,onClick:()=>c(!0),disabled:l,className:`rounded border border-(--color-border) px-2 py-1 text-xs hover:bg-(--color-bg-hover)`,children:`Test run`}),(0,O.jsx)(`button`,{type:`button`,onClick:m,className:`rounded border border-(--color-red)/50 px-2 py-1 text-xs text-(--color-red)`,children:`Delete`})]})]}),s&&(0,O.jsxs)(`div`,{className:`mt-2 rounded border border-(--color-amber)/50 bg-(--color-amber)/10 p-2 text-xs`,children:[(0,O.jsx)(`p`,{className:`text-(--color-amber)`,children:`A test run performs real work — it can navigate websites, change files and call connected tools.`}),(0,O.jsxs)(`div`,{className:`mt-2 flex gap-2`,children:[(0,O.jsx)(`button`,{type:`button`,onClick:h,className:`rounded bg-(--color-amber) px-2 py-1 font-medium text-(--color-bg)`,children:`Run anyway`}),(0,O.jsx)(`button`,{type:`button`,onClick:()=>c(!1),className:`rounded px-2 py-1 text-(--color-text-muted)`,children:`Cancel`})]})]}),(0,O.jsx)(`button`,{type:`button`,onClick:f,className:`mt-2 text-xs text-(--color-text-muted) hover:underline`,children:a?`Hide run history`:`Show run history`}),a&&(0,O.jsxs)(`ul`,{className:`mt-1 space-y-1`,children:[r.length===0&&(0,O.jsx)(`li`,{className:`text-xs text-(--color-text-faint)`,children:`No runs yet.`}),r.map(e=>(0,O.jsxs)(`li`,{className:`flex items-center gap-2 text-xs`,children:[(0,O.jsx)(`span`,{className:b(`font-medium`,Xc[e.status]),children:e.status}),(0,O.jsx)(`span`,{className:`text-(--color-text-faint)`,children:new Date(e.startedAt).toLocaleString()}),e.isTest&&(0,O.jsx)(`span`,{className:`rounded bg-(--color-border) px-1 text-[10px]`,children:`test`}),e.summary&&(0,O.jsx)(`span`,{className:`truncate text-(--color-text-muted)`,children:e.summary})]},e.id))]})]})}function $c({botId:e}){let[t,n]=(0,_.useState)([]),[r,i]=(0,_.useState)(!0);return(0,_.useEffect)(()=>{let t=!1;return i(!0),w.routines.list(e).then(e=>{t||n(e)}).finally(()=>{t||i(!1)}),()=>{t=!0}},[e]),(0,O.jsxs)(`div`,{className:`space-y-3`,children:[(0,O.jsx)(Zc,{botId:e,onCreated:e=>n(t=>[e,...t])}),r&&(0,O.jsx)(`p`,{className:`text-xs text-(--color-text-muted)`,children:`Loading routines…`}),!r&&t.length===0&&(0,O.jsx)(`p`,{className:`text-xs text-(--color-text-muted)`,children:`No routines yet.`}),t.map(e=>(0,O.jsx)(Qc,{routine:e,onChanged:e=>n(t=>t.map(t=>t.id===e.id?e:t)),onDeleted:e=>n(t=>t.filter(t=>t.id!==e))},e.id))]})}function el({bot:e,onUpdated:t}){let[n,r]=(0,_.useState)(e.name),[i,a]=(0,_.useState)(e.title),[o,s]=(0,_.useState)(e.description),[c,l]=(0,_.useState)(e.avatarEmoji),[u,d]=(0,_.useState)(e.modelTier),[f,p]=(0,_.useState)(!1),[m,h]=(0,_.useState)(null),[g,v]=(0,_.useState)(!1);async function y(){p(!0),h(null);try{t(await w.bots.update(e.id,{name:n,title:i,description:o,avatarEmoji:c,modelTier:u}))}catch(e){h(e instanceof ie?e.message:`Failed to save`)}finally{p(!1)}}return(0,O.jsxs)(`div`,{className:`space-y-3`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,O.jsx)(`button`,{type:`button`,onClick:()=>v(e=>!e),className:`flex h-12 w-12 items-center justify-center rounded-lg border border-(--color-border) text-2xl hover:bg-(--color-bg-hover)`,children:c}),(0,O.jsx)(`div`,{className:`flex-1`,children:(0,O.jsx)(`input`,{className:`w-full rounded border border-(--color-border) bg-(--color-bg) px-2 py-1.5 text-sm font-medium`,value:n,onChange:e=>r(e.target.value),"aria-label":`Name`})})]}),g&&(0,O.jsx)(`div`,{className:`grid grid-cols-10 gap-1 rounded border border-(--color-border) p-2`,children:Jc.map(e=>(0,O.jsx)(`button`,{type:`button`,onClick:()=>{l(e),v(!1)},className:`rounded p-1 text-lg hover:bg-(--color-bg-hover)`,children:e},e))}),(0,O.jsxs)(`label`,{className:`block text-xs`,children:[(0,O.jsx)(`span`,{className:`mb-1 block text-(--color-text-muted)`,children:`Title`}),(0,O.jsx)(`input`,{className:`w-full rounded border border-(--color-border) bg-(--color-bg) px-2 py-1.5 text-sm`,value:i,onChange:e=>a(e.target.value)})]}),(0,O.jsxs)(`label`,{className:`block text-xs`,children:[(0,O.jsx)(`span`,{className:`mb-1 block text-(--color-text-muted)`,children:`Description / persona`}),(0,O.jsx)(`textarea`,{className:`w-full rounded border border-(--color-border) bg-(--color-bg) px-2 py-1.5 text-sm`,rows:4,value:o,onChange:e=>s(e.target.value)})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`span`,{className:`mb-1 block text-xs text-(--color-text-muted)`,children:`Model tier`}),(0,O.jsx)(`div`,{className:`inline-flex rounded border border-(--color-border) p-0.5`,children:Oc.map(e=>(0,O.jsx)(`button`,{type:`button`,onClick:()=>d(e),className:`rounded px-3 py-1 text-xs font-medium capitalize ${u===e?`bg-(--color-accent) text-(--color-accent-fg)`:`text-(--color-text-muted)`}`,children:e},e))})]}),m&&(0,O.jsx)(`p`,{className:`text-xs text-(--color-red)`,children:m}),(0,O.jsx)(`button`,{type:`button`,onClick:y,disabled:f,className:`rounded bg-(--color-accent) px-3 py-1.5 text-sm font-medium text-(--color-accent-fg) disabled:opacity-40`,children:`Save profile`})]})}function tl({botId:e}){let[t,n]=(0,_.useState)([]),[r,i]=(0,_.useState)(null),[a,o]=(0,_.useState)(``),[s,c]=(0,_.useState)(``);(0,_.useEffect)(()=>{w.bots.memory.list(e).then(n)},[e]);function l(e){i(e),o(t.find(t=>t.name===e)?.content??``)}async function u(){let t=r??s.trim();t&&(await w.bots.memory.save(e,t,a),n(e=>{let n=e.findIndex(e=>e.name===t);return n===-1?[...e,{name:t,content:a}]:e.map((e,r)=>r===n?{name:t,content:a}:e)}),i(t),c(``))}async function d(t){await w.bots.memory.remove(e,t),n(e=>e.filter(e=>e.name!==t)),r===t&&(i(null),o(``))}return(0,O.jsxs)(`div`,{className:`grid grid-cols-[160px_1fr] gap-3`,children:[(0,O.jsxs)(`div`,{className:`space-y-1`,children:[t.map(e=>(0,O.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,O.jsx)(`button`,{type:`button`,onClick:()=>l(e.name),className:`flex-1 truncate rounded px-2 py-1 text-left text-xs ${r===e.name?`bg-(--color-accent)/15`:`hover:bg-(--color-bg-hover)`}`,children:e.name}),(0,O.jsx)(`button`,{type:`button`,onClick:()=>d(e.name),"aria-label":`Delete ${e.name}`,className:`text-xs text-(--color-text-faint) hover:text-(--color-red)`,children:`×`})]},e.name)),(0,O.jsx)(`input`,{className:`w-full rounded border border-(--color-border) bg-(--color-bg) px-2 py-1 text-xs`,placeholder:`new-file.md`,value:s,onChange:e=>{c(e.target.value),i(null),o(``)}})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`textarea`,{className:`h-40 w-full rounded border border-(--color-border) bg-(--color-bg) p-2 font-mono text-xs`,value:a,onChange:e=>o(e.target.value),placeholder:`Durable facts this bot should remember…`}),(0,O.jsx)(`button`,{type:`button`,onClick:u,className:`mt-2 rounded bg-(--color-accent) px-3 py-1.5 text-xs font-medium text-(--color-accent-fg)`,children:`Save memory file`})]})]})}function nl({skill:e,checked:t,onToggle:n}){let[r,i]=(0,_.useState)(!1),a=`skill-${e.id}`;return(0,O.jsxs)(`div`,{className:`flex items-start gap-2 text-sm`,children:[(0,O.jsx)(`input`,{id:a,type:`checkbox`,className:`mt-1 shrink-0`,checked:t,onChange:n}),(0,O.jsx)(`label`,{htmlFor:a,className:`shrink-0 cursor-pointer whitespace-nowrap font-medium`,children:e.name}),e.description&&(0,O.jsxs)(`button`,{type:`button`,onClick:()=>i(e=>!e),"aria-expanded":r,title:r?`Collapse description`:`Show the full description`,className:`min-w-0 flex-1 cursor-pointer text-left text-xs text-(--color-text-muted) hover:text-(--color-text) ${r?`whitespace-pre-wrap break-words`:`truncate`}`,children:[`— `,e.description]})]})}function rl({botId:e}){let[t,n]=(0,_.useState)([]),[r,i]=(0,_.useState)(new Set),[a,o]=(0,_.useState)(!1);(0,_.useEffect)(()=>{w.skills.list().then(n)},[]),(0,_.useEffect)(()=>{w.bots.skills.get(e).then(e=>i(new Set(e.map(e=>e.id))))},[e]);function s(e){i(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),o(!1)}async function c(){await w.bots.skills.set(e,Array.from(r)),o(!0)}return t.length===0?(0,O.jsx)(`p`,{className:`text-xs text-(--color-text-muted)`,children:`No skills taught yet.`}):(0,O.jsxs)(`div`,{className:`space-y-2`,children:[t.map(e=>(0,O.jsx)(nl,{skill:e,checked:r.has(e.id),onToggle:()=>s(e.id)},e.id)),(0,O.jsx)(`button`,{type:`button`,onClick:c,className:`rounded bg-(--color-accent) px-3 py-1.5 text-xs font-medium text-(--color-accent-fg)`,children:`Save skills`}),a&&(0,O.jsx)(`span`,{className:`ml-2 text-xs text-(--color-green)`,children:`Saved`})]})}function il({bot:e,onClose:t,onUpdated:n,onDuplicated:r,onDeleted:i}){let[a,o]=(0,_.useState)(!1);async function s(){n(await w.bots.update(e.id,{pinned:!e.pinned}))}async function c(){n(await w.bots.update(e.id,{hidden:!e.hidden}))}async function l(){n(await w.bots.update(e.id,{notifications:!e.notifications}))}async function u(){r(await w.bots.duplicate(e.id))}async function d(){await w.bots.remove(e.id),i(e.id)}return(0,O.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto p-5`,children:[(0,O.jsxs)(`div`,{className:`mb-4 flex items-center justify-between`,children:[(0,O.jsxs)(`h2`,{className:`text-lg font-semibold`,children:[e.name,` settings`]}),(0,O.jsx)(`button`,{type:`button`,onClick:t,className:`text-sm text-(--color-text-muted) hover:text-(--color-text)`,children:`Close`})]}),(0,O.jsx)(`section`,{className:`mb-6`,children:(0,O.jsx)(el,{bot:e,onUpdated:n})}),(0,O.jsxs)(`section`,{className:`mb-6 flex flex-wrap gap-2 border-t border-(--color-border) pt-4`,children:[(0,O.jsx)(`button`,{type:`button`,onClick:s,className:`rounded border border-(--color-border) px-3 py-1.5 text-xs hover:bg-(--color-bg-hover)`,children:e.pinned?`Unpin`:`Pin`}),(0,O.jsx)(`button`,{type:`button`,onClick:c,className:`rounded border border-(--color-border) px-3 py-1.5 text-xs hover:bg-(--color-bg-hover)`,children:e.hidden?`Unhide`:`Hide`}),(0,O.jsx)(`button`,{type:`button`,onClick:l,className:`rounded border border-(--color-border) px-3 py-1.5 text-xs hover:bg-(--color-bg-hover)`,children:e.notifications?`Mute notifications`:`Unmute notifications`}),(0,O.jsx)(`button`,{type:`button`,onClick:u,className:`rounded border border-(--color-border) px-3 py-1.5 text-xs hover:bg-(--color-bg-hover)`,children:`Duplicate`}),(0,O.jsx)(`button`,{type:`button`,onClick:()=>o(!0),className:`rounded border border-(--color-red)/50 px-3 py-1.5 text-xs text-(--color-red) hover:bg-(--color-red)/10`,children:`Delete`})]}),a&&(0,O.jsxs)(`div`,{className:`mb-6 rounded border border-(--color-red)/50 bg-(--color-red)/10 p-3 text-sm`,children:[(0,O.jsxs)(`p`,{className:`text-(--color-red)`,children:[`Delete `,e.name,`? This removes it from your roster and conversation history, but its workspace files and any browser logins it used survive deletion.`]}),(0,O.jsxs)(`div`,{className:`mt-2 flex gap-2`,children:[(0,O.jsx)(`button`,{type:`button`,onClick:d,className:`rounded bg-(--color-red) px-3 py-1.5 text-xs font-medium text-white`,children:`Delete permanently`}),(0,O.jsx)(`button`,{type:`button`,onClick:()=>o(!1),className:`rounded px-3 py-1.5 text-xs text-(--color-text-muted)`,children:`Cancel`})]})]}),(0,O.jsxs)(`section`,{className:`mb-6 border-t border-(--color-border) pt-4`,children:[(0,O.jsx)(`h3`,{className:`mb-2 text-sm font-semibold`,children:`Memory`}),(0,O.jsx)(tl,{botId:e.id})]}),(0,O.jsxs)(`section`,{className:`mb-6 border-t border-(--color-border) pt-4`,children:[(0,O.jsx)(`h3`,{className:`mb-2 text-sm font-semibold`,children:`Skills`}),(0,O.jsx)(rl,{botId:e.id})]}),(0,O.jsxs)(`section`,{className:`border-t border-(--color-border) pt-4`,children:[(0,O.jsx)(`h3`,{className:`mb-2 text-sm font-semibold`,children:`Routines`}),(0,O.jsx)($c,{botId:e.id})]})]})}function al({kind:e}){return(0,O.jsx)(`span`,{className:b(`rounded px-1.5 py-0.5 text-[11px] font-semibold uppercase tracking-wide`,e===`require`?`bg-(--color-red)/15 text-(--color-red)`:`bg-(--color-green)/15 text-(--color-green)`),children:e===`require`?`Require approval`:`Always allow`})}function ol({onCreated:e}){let[t,n]=(0,_.useState)(`require`),[r,i]=(0,_.useState)(``),[a,o]=(0,_.useState)(``),[s,c]=(0,_.useState)(``),[l,u]=(0,_.useState)(null);async function d(){if(r.trim())try{e(await w.rules.create({kind:t,toolPattern:r.trim(),inputPattern:a,scopeNote:s})),i(``),o(``),c(``),u(null)}catch(e){u(e instanceof ie?e.message:`Failed to create rule`)}}return(0,O.jsxs)(`div`,{className:`mb-4 space-y-2 rounded-md border border-(--color-border) p-3`,children:[(0,O.jsx)(`div`,{className:`flex gap-2`,children:[`require`,`allow`].map(e=>(0,O.jsx)(`button`,{type:`button`,onClick:()=>n(e),className:b(`rounded px-3 py-1 text-xs font-medium`,t===e?`bg-(--color-accent) text-(--color-accent-fg)`:`border border-(--color-border) text-(--color-text-muted)`),children:e===`require`?`Require approval`:`Always allow`},e))}),(0,O.jsx)(`input`,{className:`w-full rounded border border-(--color-border) bg-(--color-bg) px-2 py-1 font-mono text-sm`,placeholder:`Tool pattern (e.g. Bash, browser_*, *)`,value:r,onChange:e=>i(e.target.value)}),(0,O.jsx)(`input`,{className:`w-full rounded border border-(--color-border) bg-(--color-bg) px-2 py-1 font-mono text-sm`,placeholder:`Input pattern (optional regex)`,value:a,onChange:e=>o(e.target.value)}),(0,O.jsx)(`input`,{className:`w-full rounded border border-(--color-border) bg-(--color-bg) px-2 py-1 text-sm`,placeholder:`Scope note (why this rule exists)`,value:s,onChange:e=>c(e.target.value)}),l&&(0,O.jsx)(`p`,{className:`text-xs text-(--color-red)`,children:l}),(0,O.jsx)(`button`,{type:`button`,onClick:d,className:`rounded bg-(--color-accent) px-3 py-1.5 text-sm font-medium text-(--color-accent-fg)`,children:`Add rule`})]})}function sl(){let[e,t]=(0,_.useState)([]),[n,r]=(0,_.useState)(!0);(0,_.useEffect)(()=>{w.rules.list().then(t).finally(()=>r(!1))},[]);async function i(e){let n=await w.rules.update(e.id,!e.enabled);t(e=>e.map(e=>e.id===n.id?n:e))}async function a(e){e.builtin||window.confirm(`Delete rule for "${e.toolPattern}"?`)&&(await w.rules.remove(e.id),t(t=>t.filter(t=>t.id!==e.id)))}return(0,O.jsxs)(`div`,{className:`mx-auto max-w-3xl p-6`,children:[(0,O.jsx)(`h1`,{className:`mb-1 text-lg font-semibold`,children:`Rules`}),(0,O.jsx)(`p`,{className:`mb-4 text-sm text-(--color-text-muted)`,children:`Require Approval always wins over Always Allow.`}),(0,O.jsx)(ol,{onCreated:e=>t(t=>[e,...t])}),n&&(0,O.jsx)(`p`,{className:`text-sm text-(--color-text-muted)`,children:`Loading…`}),!n&&e.length===0&&(0,O.jsx)(`p`,{className:`text-sm text-(--color-text-muted)`,children:`No rules yet.`}),(0,O.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>(0,O.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border border-(--color-border) p-3`,children:[(0,O.jsxs)(`div`,{className:`min-w-0`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(al,{kind:e.kind}),e.builtin&&(0,O.jsx)(`span`,{title:`Built-in rule`,"aria-label":`Built-in rule`,className:`text-(--color-text-faint)`,children:`🔒`}),(0,O.jsx)(`span`,{className:`truncate font-mono text-sm`,children:e.toolPattern})]}),e.inputPattern&&(0,O.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-xs text-(--color-text-muted)`,children:e.inputPattern}),e.scopeNote&&(0,O.jsx)(`div`,{className:`mt-0.5 truncate text-xs text-(--color-text-faint)`,children:e.scopeNote})]}),(0,O.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,O.jsxs)(`label`,{className:`flex items-center gap-1 text-xs text-(--color-text-muted)`,children:[(0,O.jsx)(`input`,{type:`checkbox`,checked:e.enabled,onChange:()=>i(e)}),`Enabled`]}),(0,O.jsx)(`button`,{type:`button`,onClick:()=>a(e),disabled:e.builtin,className:`rounded border border-(--color-red)/50 px-2 py-1 text-xs text-(--color-red) disabled:cursor-not-allowed disabled:opacity-30`,children:`Delete`})]})]},e.id))})]})}function cl({label:e,value:t,max:n,sublabel:r}){let i=n>0?Math.max(2,Math.round(t/n*100)):0;return(0,O.jsxs)(`div`,{className:`mb-2`,children:[(0,O.jsxs)(`div`,{className:`mb-0.5 flex items-baseline justify-between text-xs`,children:[(0,O.jsx)(`span`,{className:`font-medium`,children:e}),(0,O.jsx)(`span`,{className:`text-(--color-text-muted)`,children:r??t.toLocaleString()})]}),(0,O.jsx)(`div`,{className:`h-2 rounded bg-(--color-bg)`,children:(0,O.jsx)(`div`,{className:`h-2 rounded bg-(--color-accent)`,style:{width:`${i}%`}})})]})}function ll(){let[e,t]=(0,_.useState)(null);if((0,_.useEffect)(()=>{w.usage().then(t)},[]),!e)return(0,O.jsx)(`p`,{className:`p-6 text-sm text-(--color-text-muted)`,children:`Loading usage…`});let n=e.totals.inputTokens+e.totals.outputTokens,r=Math.max(1,...e.byBot.map(e=>e.inputTokens+e.outputTokens)),i=Math.max(1,...e.byDay.map(e=>e.inputTokens+e.outputTokens)),a=Math.max(1,...e.byModel.map(e=>e.inputTokens+e.outputTokens));return(0,O.jsxs)(`div`,{className:`mx-auto max-w-3xl p-6`,children:[(0,O.jsx)(`h1`,{className:`mb-4 text-lg font-semibold`,children:`Usage`}),(0,O.jsxs)(`section`,{className:`mb-6 grid grid-cols-3 gap-3`,children:[(0,O.jsxs)(`div`,{className:`rounded-md border border-(--color-border) p-3`,children:[(0,O.jsx)(`div`,{className:`text-xs text-(--color-text-muted)`,children:`Input tokens`}),(0,O.jsx)(`div`,{className:`text-xl font-semibold`,children:e.totals.inputTokens.toLocaleString()})]}),(0,O.jsxs)(`div`,{className:`rounded-md border border-(--color-border) p-3`,children:[(0,O.jsx)(`div`,{className:`text-xs text-(--color-text-muted)`,children:`Output tokens`}),(0,O.jsx)(`div`,{className:`text-xl font-semibold`,children:e.totals.outputTokens.toLocaleString()})]}),(0,O.jsxs)(`div`,{className:`rounded-md border border-(--color-border) p-3`,children:[(0,O.jsx)(`div`,{className:`text-xs text-(--color-text-muted)`,children:`Cache-read tokens`}),(0,O.jsx)(`div`,{className:`text-xl font-semibold`,children:e.totals.cacheReadTokens.toLocaleString()})]})]}),(0,O.jsxs)(`section`,{className:`mb-6`,children:[(0,O.jsx)(`h2`,{className:`mb-2 text-sm font-semibold`,children:`By bot`}),e.byBot.length===0&&(0,O.jsx)(`p`,{className:`text-xs text-(--color-text-muted)`,children:`No usage yet.`}),e.byBot.map(e=>(0,O.jsx)(cl,{label:e.botName,value:e.inputTokens+e.outputTokens,max:r},e.botId))]}),(0,O.jsxs)(`section`,{className:`mb-6`,children:[(0,O.jsx)(`h2`,{className:`mb-2 text-sm font-semibold`,children:`By day`}),(0,O.jsx)(`div`,{className:`flex items-end gap-1`,style:{height:96},children:e.byDay.map(e=>{let t=e.inputTokens+e.outputTokens,n=Math.max(2,Math.round(t/i*88));return(0,O.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-end`,title:`${e.day}: ${t.toLocaleString()} tokens`,children:[(0,O.jsx)(`div`,{className:`w-full rounded-t bg-(--color-accent)`,style:{height:n}}),(0,O.jsx)(`span`,{className:`mt-1 rotate-0 text-[9px] text-(--color-text-faint)`,children:e.day.slice(5)})]},e.day)})}),e.byDay.length===0&&(0,O.jsx)(`p`,{className:`text-xs text-(--color-text-muted)`,children:`No usage yet.`})]}),(0,O.jsxs)(`section`,{children:[(0,O.jsx)(`h2`,{className:`mb-2 text-sm font-semibold`,children:`By model`}),e.byModel.length===0&&(0,O.jsx)(`p`,{className:`text-xs text-(--color-text-muted)`,children:`No usage yet.`}),e.byModel.map(e=>(0,O.jsx)(cl,{label:e.model,value:e.inputTokens+e.outputTokens,max:a,sublabel:n>0?`${Math.round((e.inputTokens+e.outputTokens)/n*100)}%`:`0%`},e.model))]})]})}function ul({label:e,children:t}){return(0,O.jsxs)(`label`,{className:`mb-3 flex items-center justify-between gap-4 border-b border-(--color-border) py-2 text-sm`,children:[(0,O.jsx)(`span`,{className:`text-(--color-text-muted)`,children:e}),t]})}function dl({onSettingsChange:e}){let[t,n]=(0,_.useState)(null),[r,i]=(0,_.useState)(!1);(0,_.useEffect)(()=>{w.settings.get().then(t=>{n(t),e?.(t)})},[]);async function a(r){if(!t)return;let a={...t,...r};n(a),i(!0);try{let t=await w.settings.update(r);n(t),e?.(t)}finally{i(!1)}}return t?(0,O.jsxs)(`div`,{className:`mx-auto max-w-xl p-6`,children:[(0,O.jsxs)(`div`,{className:`mb-4 flex items-center justify-between`,children:[(0,O.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Settings`}),r&&(0,O.jsx)(`span`,{className:`text-xs text-(--color-text-muted)`,children:`Saving…`})]}),(0,O.jsx)(ul,{label:`Timezone`,children:(0,O.jsx)(`input`,{className:`w-48 rounded border border-(--color-border) bg-(--color-bg) px-2 py-1 text-sm`,value:t.timezone,onChange:e=>a({timezone:e.target.value})})}),(0,O.jsx)(ul,{label:`Max concurrent sessions`,children:(0,O.jsx)(`input`,{type:`number`,min:1,max:8,className:`w-20 rounded border border-(--color-border) bg-(--color-bg) px-2 py-1 text-sm`,value:t.maxConcurrentSessions,onChange:e=>a({maxConcurrentSessions:Math.min(8,Math.max(1,Number(e.target.value)||1))})})}),(0,O.jsx)(ul,{label:`Auto-review (Haiku triage of tool calls)`,children:(0,O.jsx)(`input`,{type:`checkbox`,checked:t.autoReviewEnabled,onChange:e=>a({autoReviewEnabled:e.target.checked})})}),(0,O.jsx)(ul,{label:`Theme`,children:(0,O.jsxs)(`select`,{className:`rounded border border-(--color-border) bg-(--color-bg) px-2 py-1 text-sm`,value:t.theme,onChange:e=>a({theme:e.target.value}),children:[(0,O.jsx)(`option`,{value:`system`,children:`System`}),(0,O.jsx)(`option`,{value:`light`,children:`Light`}),(0,O.jsx)(`option`,{value:`dark`,children:`Dark`})]})}),(0,O.jsx)(ul,{label:`Local execution (run commands on this machine)`,children:(0,O.jsxs)(`select`,{className:`rounded border border-(--color-border) bg-(--color-bg) px-2 py-1 text-sm`,value:t.localExecution,onChange:e=>a({localExecution:e.target.value}),children:[(0,O.jsx)(`option`,{value:`ask`,children:`Ask`}),(0,O.jsx)(`option`,{value:`always`,children:`Always`}),(0,O.jsx)(`option`,{value:`never`,children:`Never`})]})}),(0,O.jsx)(ul,{label:`Daily token budget (0 = unlimited)`,children:(0,O.jsx)(`input`,{type:`number`,min:0,className:`w-32 rounded border border-(--color-border) bg-(--color-bg) px-2 py-1 text-sm`,value:t.dailyTokenBudget,onChange:e=>a({dailyTokenBudget:Math.max(0,Number(e.target.value)||0)})})}),(0,O.jsx)(ul,{label:`Desktop notifications`,children:(0,O.jsx)(`input`,{type:`checkbox`,checked:t.notificationsEnabled,onChange:e=>a({notificationsEnabled:e.target.checked})})}),(0,O.jsx)(ul,{label:`Billing mode`,children:(0,O.jsxs)(`select`,{className:`rounded border border-(--color-border) bg-(--color-bg) px-2 py-1 text-sm`,value:t.billingMode,onChange:e=>a({billingMode:e.target.value}),children:[(0,O.jsx)(`option`,{value:`subscription`,children:`Subscription`}),(0,O.jsx)(`option`,{value:`api`,children:`API (metered)`})]})}),(0,O.jsx)(ul,{label:`Computer mode`,children:(0,O.jsxs)(`select`,{className:`rounded border border-(--color-border) bg-(--color-bg) px-2 py-1 text-sm`,value:t.computerMode,onChange:e=>a({computerMode:e.target.value}),children:[(0,O.jsx)(`option`,{value:`host`,children:`Host`}),(0,O.jsx)(`option`,{value:`container`,children:`Container`})]})})]}):(0,O.jsx)(`p`,{className:`p-6 text-sm text-(--color-text-muted)`,children:`Loading settings…`})}var fl=/\.(png|jpe?g|gif|webp|svg|bmp)$/i,pl=/\.(md|markdown|txt|json|ya?ml|csv|log|ts|tsx|js|jsx|py|sh|css|html)$/i;function ml(e){return e.startsWith(`.`)}function hl({entry:e,depth:t,showHidden:n,onOpenFile:r}){let[i,a]=(0,_.useState)(!1),[o,s]=(0,_.useState)(null),[c,l]=(0,_.useState)(!1);async function u(){if(!e.dir){r(e.path);return}if(!i&&o===null){l(!0);let t=await w.workspace.tree(e.path);s(t),l(!1)}a(e=>!e)}return(0,O.jsxs)(`div`,{children:[(0,O.jsxs)(`button`,{type:`button`,onClick:u,className:`flex w-full items-center gap-1.5 rounded px-1.5 py-1 text-left text-sm hover:bg-(--color-bg-hover)`,style:{paddingLeft:`${t*14+6}px`},children:[(0,O.jsx)(`span`,{className:`w-3 shrink-0 text-(--color-text-faint)`,children:e.dir?i?`▾`:`▸`:``}),(0,O.jsx)(`span`,{className:`shrink-0`,children:e.dir?`📁`:`📄`}),(0,O.jsx)(`span`,{className:`truncate`,children:e.name}),!e.dir&&(0,O.jsxs)(`span`,{className:`ml-auto shrink-0 text-xs text-(--color-text-faint)`,children:[e.bytes,`B`]})]}),i&&(0,O.jsxs)(`div`,{children:[c&&(0,O.jsx)(`div`,{style:{paddingLeft:`${(t+1)*14+6}px`},className:`py-1 text-xs text-(--color-text-faint)`,children:`Loading…`}),o?.filter(e=>n||!ml(e.name)).map(e=>(0,O.jsx)(hl,{entry:e,depth:t+1,showHidden:n,onOpenFile:r},e.path))]})]})}function gl({path:e,onClose:t}){let[n,r]=(0,_.useState)(null),i=e.split(`/`).pop()??e,a=fl.test(i),o=pl.test(i);return(0,_.useEffect)(()=>{r(null),o&&fetch(w.workspace.fileUrl(e)).then(e=>e.text()).then(r).catch(()=>r(`(failed to load preview)`))},[e,o]),(0,O.jsxs)(`div`,{className:`flex h-full flex-col border-l border-(--color-border)`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between border-b border-(--color-border) p-2`,children:[(0,O.jsx)(`span`,{className:`truncate text-sm font-medium`,children:i}),(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(`a`,{href:w.workspace.fileUrl(e),download:i,className:`text-xs text-(--color-accent) hover:underline`,children:`Download`}),(0,O.jsx)(`button`,{type:`button`,onClick:t,className:`text-xs text-(--color-text-muted) hover:text-(--color-text)`,children:`Close`})]})]}),(0,O.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto p-2`,children:[a&&(0,O.jsx)(`img`,{src:w.workspace.fileUrl(e),alt:i,className:`max-w-full`}),o&&(0,O.jsx)(`pre`,{className:`whitespace-pre-wrap font-mono text-xs`,children:n??`Loading…`}),!a&&!o&&(0,O.jsx)(`p`,{className:`text-sm text-(--color-text-muted)`,children:`No inline preview available — use Download.`})]})]})}function _l(){let[e,t]=(0,_.useState)([]),[n,r]=(0,_.useState)(!1),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(!0);return(0,_.useEffect)(()=>{w.workspace.tree(``).then(t).finally(()=>s(!1))},[]),(0,O.jsxs)(`div`,{className:`flex h-full`,children:[(0,O.jsxs)(`div`,{className:`flex w-80 shrink-0 flex-col border-r border-(--color-border)`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between border-b border-(--color-border) p-2`,children:[(0,O.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Workspace`}),(0,O.jsxs)(`label`,{className:`flex items-center gap-1 text-xs text-(--color-text-muted)`,children:[(0,O.jsx)(`input`,{type:`checkbox`,checked:n,onChange:e=>r(e.target.checked)}),`Hidden files`]})]}),(0,O.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-1`,children:[o&&(0,O.jsx)(`p`,{className:`p-2 text-xs text-(--color-text-muted)`,children:`Loading…`}),!o&&e.length===0&&(0,O.jsx)(`p`,{className:`p-2 text-xs text-(--color-text-muted)`,children:`Workspace is empty.`}),e.filter(e=>n||!ml(e.name)).map(e=>(0,O.jsx)(hl,{entry:e,depth:0,showHidden:n,onOpenFile:a},e.path))]})]}),i&&(0,O.jsx)(`div`,{className:`w-96 shrink-0`,children:(0,O.jsx)(gl,{path:i,onClose:()=>a(null)})})]})}function vl(){let[e,t]=(0,_.useState)(null),[n,r]=(0,_.useState)(null),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(!1),[c,l]=(0,_.useState)(null),u=(0,_.useRef)(null);(0,_.useEffect)(()=>{w.computer.status().then(e=>{t(e),e.pages.length>0&&r(e.pages[0].botId)})},[]),(0,_.useEffect)(()=>{if(a(null),u.current?.close(),!n||!e?.available)return;let t=window.location.protocol===`https:`?`wss`:`ws`,r=new WebSocket(`${t}://${window.location.host}/api/computer/screencast/${n}`);return u.current=r,r.onmessage=e=>{try{let t=JSON.parse(e.data);t.type===`frame`&&a({data:t.data,w:t.w,h:t.h})}catch{}},()=>r.close()},[n,e?.available]);async function d(){if(!n)return;let e=await w.computer.takeover(n);s(e.ok),l(e.message??null)}async function f(){n&&(await w.computer.returnControl(n),s(!1),l(null))}function p(e){let t=u.current;if(!(!o||!t||t.readyState!==WebSocket.OPEN))try{t.send(JSON.stringify({type:`input`,input:e}))}catch{}}function m(e){let t=e.currentTarget.getBoundingClientRect();return t.width<=0||t.height<=0?null:{x:(e.clientX-t.left)/t.width,y:(e.clientY-t.top)/t.height}}let h=[`left`,`middle`,`right`];return e?e.available?(0,O.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-(--color-border) p-3`,children:[(0,O.jsxs)(`select`,{className:`rounded border border-(--color-border) bg-(--color-bg) px-2 py-1 text-sm`,value:n??``,onChange:e=>r(e.target.value||null),children:[e.pages.length===0&&(0,O.jsx)(`option`,{value:``,children:`No active pages`}),e.pages.map(e=>(0,O.jsx)(`option`,{value:e.botId,children:e.title||e.url},e.botId))]}),(0,O.jsx)(`div`,{className:`flex items-center gap-2`,children:o?(0,O.jsx)(`button`,{type:`button`,onClick:f,className:`rounded bg-(--color-accent) px-3 py-1.5 text-xs font-medium text-(--color-accent-fg)`,children:`Return control`}):(0,O.jsx)(`button`,{type:`button`,onClick:d,disabled:!n,className:`rounded border border-(--color-border) px-3 py-1.5 text-xs font-medium hover:bg-(--color-bg-hover) disabled:opacity-40`,children:`Take over`})})]}),(0,O.jsx)(`p`,{className:`border-b border-(--color-border) bg-(--color-amber)/10 px-3 py-2 text-xs text-(--color-amber)`,children:`Never paste passwords or one-time codes into chat — use takeover.`}),c&&(0,O.jsx)(`p`,{className:`border-b border-(--color-border) bg-(--color-bg-elevated) px-3 py-2 text-xs text-(--color-text-muted)`,children:c}),(0,O.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-auto bg-black/20 p-3`,children:i?(0,O.jsx)(`img`,{src:`data:image/jpeg;base64,${i.data}`,width:i.w,height:i.h,alt:`Agent computer screencast`,tabIndex:o?0:-1,draggable:!1,onPointerMove:e=>{let t=m(e);t&&p({kind:`mouse`,action:`move`,...t,button:`left`,clickCount:1,deltaX:0,deltaY:0})},onPointerDown:e=>{let t=m(e);t&&(e.currentTarget.focus(),p({kind:`mouse`,action:`down`,...t,button:h[e.button]??`left`,clickCount:e.detail||1,deltaX:0,deltaY:0}))},onPointerUp:e=>{let t=m(e);t&&p({kind:`mouse`,action:`up`,...t,button:h[e.button]??`left`,clickCount:e.detail||1,deltaX:0,deltaY:0})},onWheel:e=>{let t=m(e);t&&p({kind:`mouse`,action:`wheel`,...t,button:`left`,clickCount:1,deltaX:e.deltaX,deltaY:e.deltaY})},onContextMenu:e=>{o&&e.preventDefault()},onKeyDown:e=>{o&&(e.preventDefault(),e.key.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey?p({kind:`text`,text:e.key}):p({kind:`key`,action:`down`,key:e.key}))},onKeyUp:e=>{o&&(e.preventDefault(),e.key.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey||p({kind:`key`,action:`up`,key:e.key}))},onPaste:e=>{if(!o)return;e.preventDefault();let t=e.clipboardData.getData(`text`);t&&p({kind:`text`,text:t.slice(0,4096)})},className:`max-h-full max-w-full rounded border border-(--color-border) ${o?`cursor-crosshair outline-2 outline-(--color-accent)`:`pointer-events-none select-none`}`}):(0,O.jsx)(`p`,{className:`text-sm text-(--color-text-muted)`,children:`Waiting for a screencast frame…`})})]}):(0,O.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-2 p-6 text-center`,children:[(0,O.jsx)(`p`,{className:`text-sm font-medium`,children:`The agent computer isn't available right now.`}),(0,O.jsx)(`p`,{className:`max-w-sm text-xs text-(--color-text-muted)`,children:`Bots can still browse the web and use tools — you just won't see a live screencast until the computer service starts.`})]}):(0,O.jsx)(`p`,{className:`p-6 text-sm text-(--color-text-muted)`,children:`Checking the computer service…`})}var yl=[{label:`New bot`,target:{kind:`newBot`}},{label:`Open settings`,target:{kind:`settings`}},{label:`Open rules`,target:{kind:`rules`}},{label:`Open usage`,target:{kind:`usage`}},{label:`Open workspace`,target:{kind:`workspace`}}];function bl({open:e,onClose:t,onNavigate:n}){let[r,i]=(0,_.useState)(``),[a,o]=(0,_.useState)([]);if((0,_.useEffect)(()=>{e||(i(``),o([]))},[e]),(0,_.useEffect)(()=>{if(!r.trim()){o([]);return}let e=!1,t=setTimeout(()=>{w.search(r).then(t=>{e||o(t)})},150);return()=>{e=!0,clearTimeout(t)}},[r]),!e)return null;let s=yl.filter(e=>e.label.toLowerCase().includes(r.toLowerCase()));function c(e){n(e),t()}return(0,O.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-start justify-center bg-black/50 pt-24`,onClick:t,children:(0,O.jsxs)(`div`,{className:`w-full max-w-lg rounded-lg border border-(--color-border) bg-(--color-bg-elevated) shadow-2xl`,onClick:e=>e.stopPropagation(),children:[(0,O.jsx)(`input`,{autoFocus:!0,value:r,onChange:e=>i(e.target.value),onKeyDown:e=>e.key===`Escape`&&t(),placeholder:`Search bots, threads, messages, files… or run a command`,className:`w-full border-b border-(--color-border) bg-transparent px-4 py-3 text-sm outline-none`}),(0,O.jsxs)(`div`,{className:`max-h-96 overflow-y-auto p-1.5`,children:[s.length>0&&(0,O.jsxs)(`div`,{className:`mb-1`,children:[(0,O.jsx)(`div`,{className:`px-2 py-1 text-[11px] font-semibold uppercase tracking-wide text-(--color-text-faint)`,children:`Actions`}),s.map(e=>(0,O.jsx)(`button`,{type:`button`,onClick:()=>c(e.target),className:`flex w-full items-center rounded px-2.5 py-1.5 text-left text-sm hover:bg-(--color-bg-hover)`,children:e.label},e.label))]}),a.length>0&&(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`div`,{className:`px-2 py-1 text-[11px] font-semibold uppercase tracking-wide text-(--color-text-faint)`,children:`Results`}),a.map(e=>(0,O.jsxs)(`button`,{type:`button`,onClick:()=>e.threadId&&c({kind:`thread`,id:e.threadId}),className:`flex w-full flex-col items-start rounded px-2.5 py-1.5 text-left text-sm hover:bg-(--color-bg-hover)`,children:[(0,O.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(`span`,{className:`rounded bg-(--color-border) px-1 text-[10px] uppercase text-(--color-text-muted)`,children:e.kind}),(0,O.jsx)(`span`,{className:`truncate font-medium`,children:e.title})]}),e.snippet&&(0,O.jsx)(`span`,{className:`truncate text-xs text-(--color-text-muted)`,children:e.snippet})]},`${e.kind}-${e.id}`))]}),r.trim()&&s.length===0&&a.length===0&&(0,O.jsx)(`p`,{className:`px-2.5 py-4 text-center text-sm text-(--color-text-muted)`,children:`No results.`})]})]})})}var xl=[{view:`thread`,label:`Chats`},{view:`workspace`,label:`Workspace`},{view:`computer`,label:`Computer`},{view:`rules`,label:`Rules`},{view:`usage`,label:`Usage`},{view:`settings`,label:`Settings`}],Sl={connecting:`Connecting…`,open:`Connected`,closed:`Disconnected`},Cl={connecting:`bg-(--color-amber) animate-pulse`,open:`bg-(--color-green)`,closed:`bg-(--color-red)`};function wl({connection:e,pendingCount:t,view:n,onChangeView:r,onOpenPalette:i}){return(0,O.jsxs)(`header`,{className:`flex h-12 shrink-0 items-center justify-between border-b border-(--color-border) bg-(--color-bg-elevated) px-3`,children:[(0,O.jsx)(`nav`,{className:`flex items-center gap-1`,children:xl.map(e=>(0,O.jsxs)(`button`,{type:`button`,onClick:()=>r(e.view),className:b(`rounded px-2.5 py-1 text-xs font-medium`,n===e.view?`bg-(--color-accent)/15 text-(--color-accent)`:`text-(--color-text-muted) hover:bg-(--color-bg-hover)`),children:[e.label,e.view===`rules`&&t>0&&(0,O.jsx)(`span`,{className:`ml-1.5 rounded-full bg-(--color-amber) px-1.5 py-0.5 text-[10px] font-semibold text-(--color-bg)`,children:t})]},e.view))}),(0,O.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,O.jsxs)(`button`,{type:`button`,onClick:i,className:`rounded border border-(--color-border) px-2.5 py-1 text-xs text-(--color-text-muted) hover:bg-(--color-bg-hover)`,children:[`Search… `,(0,O.jsx)(`span`,{className:`ml-1 opacity-60`,children:`⌘K`})]}),t>0&&(0,O.jsxs)(`span`,{className:`flex items-center gap-1 rounded-full bg-(--color-amber)/15 px-2 py-0.5 text-xs font-medium text-(--color-amber)`,children:[t,` pending approval`,t===1?``:`s`]}),(0,O.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs text-(--color-text-muted)`,children:[(0,O.jsx)(`span`,{className:b(`h-1.5 w-1.5 rounded-full`,Cl[e])}),Sl[e]]})]})]})}function Tl({children:e}){return(0,O.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:e})}function El({children:e}){return(0,O.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:e})}function Dl(){let e=T(e=>e.bots),t=T(e=>e.threads),n=T(e=>e.activeThreadId),r=T(e=>e.messagesByThread),i=T(e=>e.pendingApprovals),a=T(e=>e.connection),o=T(e=>e.notifications),s=T(e=>e.setBots),c=T(e=>e.setThreads),l=T(e=>e.setThreadMessages),u=T(e=>e.setActiveThreadId),d=T(e=>e.appendLocalMessage),f=T(e=>e.dismissNotification),p=T(e=>e.setPendingApprovals),[m,h]=(0,_.useState)(`thread`),[g,v]=(0,_.useState)(!1),[y,x]=(0,_.useState)(!1),[ee,te]=(0,_.useState)(null),[S,ne]=(0,_.useState)(null),[re,ie]=(0,_.useState)(!1),[C,ae]=(0,_.useState)([]),[oe,se]=(0,_.useState)(`system`);(0,_.useEffect)(()=>{let e=document.documentElement,t=window.matchMedia(`(prefers-color-scheme: dark)`);function n(){let n=oe===`light`||oe===`system`&&!t.matches;e.classList.toggle(`light`,n)}return n(),t.addEventListener(`change`,n),()=>t.removeEventListener(`change`,n)},[oe]),(0,_.useEffect)(()=>{w.bots.list().then(s),w.threads.list().then(c),w.skills.list().then(ae),w.approvals.list().then(p).catch(()=>{});let e=E();return()=>e.close()},[s,c,p]),(0,_.useEffect)(()=>{n&&(w.threads.get(n).then(({messages:e})=>{l(n,e)}),w.threads.markRead(n).catch(()=>{}))},[n,l]),(0,_.useEffect)(()=>{function e(e){let t=e.metaKey||e.ctrlKey;t&&e.key.toLowerCase()===`n`?(e.preventDefault(),v(!0)):t&&e.key.toLowerCase()===`k`&&(e.preventDefault(),ie(!0))}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let ce=(0,_.useMemo)(()=>{let t={};for(let n of e)t[n.bot.id]=n;return t},[e]),le=(0,_.useMemo)(()=>Object.values(t).filter(e=>e.kind===`group`),[t]),D=n?t[n]??null:null,ue=n?r[n]??[]:[],de=D?e.find(e=>e.thread?.id===D.id):void 0,fe=S?ce[S]?.bot??null:null;async function pe(){s(await w.bots.list())}async function k(e){x(!0),te(null);try{let t=await w.bots.create(e);await pe(),v(!1),t.threadId&&(c(await w.threads.list()),u(t.threadId),h(`thread`))}catch(e){te(e instanceof Error?e.message:`Failed to create bot`)}finally{x(!1)}}async function me(e,t){if(!n)return;let r=await w.threads.postMessage(n,{contentMd:e,attachmentIds:t});d(n,r)}async function he(){de&&await w.bots.stop(de.bot.id)}function _e(e){u(e),ne(null),h(`thread`)}function ve(e){e.kind===`thread`?_e(e.id):e.kind===`newBot`?v(!0):h(e.kind)}return(0,O.jsxs)(`div`,{className:`flex h-dvh flex-col overflow-hidden`,children:[(0,O.jsx)(wl,{connection:a,pendingCount:i.length,view:m,onChangeView:e=>{ne(null),h(e)},onOpenPalette:()=>ie(!0)}),(0,O.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,O.jsx)(ge,{entries:e,groupThreads:le,botsById:ce,activeThreadId:n,onSelectThread:_e,onNewBot:()=>v(!0)}),(0,O.jsxs)(`main`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[m===`thread`&&(fe?(0,O.jsx)(il,{bot:fe,onClose:()=>ne(null),onUpdated:t=>s(e.map(e=>e.bot.id===t.id?{...e,bot:t}:e)),onDuplicated:e=>{pe(),ne(e.id)},onDeleted:()=>{ne(null),pe()}}):(0,O.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[de&&(0,O.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-(--color-border) px-4 py-2`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(`span`,{className:`text-lg leading-none`,children:de.bot.avatarEmoji}),(0,O.jsx)(`span`,{className:`text-sm font-semibold`,children:de.bot.name}),de.bot.title&&(0,O.jsx)(`span`,{className:`text-xs text-(--color-text-muted)`,children:de.bot.title})]}),(0,O.jsx)(`button`,{type:`button`,onClick:()=>ne(de.bot.id),className:`text-xs text-(--color-text-muted) hover:text-(--color-text)`,children:`Bot settings`})]}),(0,O.jsx)(qc,{thread:D,messages:ue,botsById:ce,bots:e,skills:C,running:de?.bot.state===`running`||de?.bot.state===`queued`,onSend:me,onStop:he})]})),m===`rules`&&(0,O.jsx)(Tl,{children:(0,O.jsx)(sl,{})}),m===`usage`&&(0,O.jsx)(Tl,{children:(0,O.jsx)(ll,{})}),m===`settings`&&(0,O.jsx)(Tl,{children:(0,O.jsx)(dl,{onSettingsChange:e=>se(e.theme)})}),m===`workspace`&&(0,O.jsx)(El,{children:(0,O.jsx)(_l,{})}),m===`computer`&&(0,O.jsx)(El,{children:(0,O.jsx)(vl,{})})]})]}),o.length>0&&(0,O.jsx)(`div`,{className:`pointer-events-none fixed bottom-24 right-4 z-50 flex flex-col gap-2`,children:o.slice(-4).map(e=>(0,O.jsxs)(`div`,{className:b(`pointer-events-auto w-72 rounded-md border p-3 text-sm shadow-lg`,e.level===`error`&&`border-(--color-red)/50 bg-(--color-bg-elevated)`,e.level===`warn`&&`border-(--color-amber)/50 bg-(--color-bg-elevated)`,e.level===`info`&&`border-(--color-border) bg-(--color-bg-elevated)`),children:[(0,O.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,O.jsx)(`span`,{className:`font-medium`,children:e.title}),(0,O.jsx)(`button`,{type:`button`,onClick:()=>f(e.id),className:`text-(--color-text-faint) hover:text-(--color-text)`,children:`×`})]}),e.body&&(0,O.jsx)(`p`,{className:`mt-0.5 text-xs text-(--color-text-muted)`,children:e.body})]},e.id))}),g&&(0,O.jsx)(Yc,{onCreate:k,onClose:()=>v(!1),busy:y,error:ee}),(0,O.jsx)(bl,{open:re,onClose:()=>ie(!1),onNavigate:ve})]})}var Ol=document.getElementById(`root`);if(!Ol)throw Error(`#root not found`);(0,v.createRoot)(Ol).render((0,O.jsx)(_.StrictMode,{children:(0,O.jsx)(Dl,{})}));
130
+ 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 xo(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:B(t,`input`,e.processors),output:B(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function So(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 So(r.element,n);if(r.type===`set`)return So(r.valueType,n);if(r.type===`lazy`)return So(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 So(r.innerType,n);if(r.type===`intersection`)return So(r.left,n)||So(r.right,n);if(r.type===`record`||r.type===`map`)return So(r.keyType,n)||So(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:So(r.in,n)||So(r.out,n);if(r.type===`object`){for(let e in r.shape)if(So(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(So(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(So(e,n))return!0;return!!(r.rest&&So(r.rest,n))}return!1}var Co=(e,t={})=>n=>{let r=vo({...n,processors:t});return yo(e,r),bo(r,e),xo(r,e)},B=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=vo({...i??{},target:a,io:t,processors:n});return yo(e,o),bo(o,e),xo(o,e)},wo={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},To=(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=wo[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}))])}},Eo=(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)},Do=(e,t,n,r)=>{n.type=`boolean`},Oo=(e,t,n,r)=>{n.not={}},ko=(e,t,n,r)=>{let i=e._zod.def,a=cn(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Ao=(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}},jo=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Mo=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},No=(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=yo(a.element,t,{...r,path:[...r.path,`items`]})},Po=(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]=yo(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=yo(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Fo=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>yo(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Io=(e,t,n,r)=>{let i=e._zod.def,a=yo(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=yo(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]]},Lo=(e,t,n,r)=>{let i=e._zod.def,a=yo(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`}]},Ro=(e,t,n,r)=>{let i=e._zod.def;yo(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},zo=(e,t,n,r)=>{let i=e._zod.def;yo(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Bo=(e,t,n,r)=>{let i=e._zod.def;yo(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)))},Vo=(e,t,n,r)=>{let i=e._zod.def;yo(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},Ho=(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;yo(o,t,r);let s=t.seen.get(e);s.ref=o},Uo=(e,t,n,r)=>{let i=e._zod.def;yo(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Wo=(e,t,n,r)=>{let i=e._zod.def;yo(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Go=M(`ZodISODateTime`,(e,t)=>{_i.init(e,t),_s.init(e,t)});function Ko(e){return Ba(Go,e)}var qo=M(`ZodISODate`,(e,t)=>{vi.init(e,t),_s.init(e,t)});function Jo(e){return Va(qo,e)}var Yo=M(`ZodISOTime`,(e,t)=>{yi.init(e,t),_s.init(e,t)});function Xo(e){return Ha(Yo,e)}var Zo=M(`ZodISODuration`,(e,t)=>{bi.init(e,t),_s.init(e,t)});function Qo(e){return Ua(Zo,e)}var $o=M(`ZodError`,(e,t)=>{Wn.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>qn(e,t)},flatten:{value:t=>Kn(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,ln,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,ln,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),es=Jn($o),ts=Yn($o),ns=Xn($o),rs=Qn($o),is=er($o),as=tr($o),os=nr($o),ss=rr($o),cs=ir($o),ls=ar($o),us=or($o),ds=sr($o),fs=new WeakMap;function ps(e,t,n){let r=Object.getPrototypeOf(e),i=fs.get(r);if(i||(i=new Set,fs.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 ms=M(`ZodType`,(e,t)=>(ii.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:B(e,`input`),output:B(e,`output`)}}),e.toJSONSchema=Co(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>es(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>ns(e,t,n),e.parseAsync=async(t,n)=>ts(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>rs(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>is(e,t,n),e.decode=(t,n)=>as(e,t,n),e.encodeAsync=async(t,n)=>os(e,t,n),e.decodeAsync=async(t,n)=>ss(e,t,n),e.safeEncode=(t,n)=>cs(e,t,n),e.safeDecode=(t,n)=>ls(e,t,n),e.safeEncodeAsync=async(t,n)=>us(e,t,n),e.safeDecodeAsync=async(t,n)=>ds(e,t,n),ps(e,`ZodType`,{check(...e){let t=this.def;return this.clone(gn(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 En(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(wc(e,t))},superRefine(e,t){return this.check(Tc(e,t))},overwrite(e){return this.check(lo(e))},optional(){return oc(this)},exactOptional(){return cc(this)},nullable(){return uc(this)},nullish(){return oc(uc(this))},nonoptional(e){return gc(this,e)},array(){return qs(this)},or(e){return Xs([this,e])},and(e){return ec(this,e)},transform(e){return bc(this,ic(e))},default(e){return fc(this,e)},prefault(e){return mc(this,e)},catch(e){return vc(this,e)},pipe(e){return bc(this,e)},readonly(){return Sc(this)},describe(e){let t=this.clone();return ga.add(t,{description:e}),t},meta(...e){if(e.length===0)return ga.get(this);let t=this.clone();return ga.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 ga.get(e)?.description},configurable:!0}),e)),hs=M(`_ZodString`,(e,t)=>{ai.init(e,t),ms.init(e,t),e._zod.processJSONSchema=(t,n,r)=>To(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,ps(e,`_ZodString`,{regex(...e){return this.check(ro(...e))},includes(...e){return this.check(oo(...e))},startsWith(...e){return this.check(so(...e))},endsWith(...e){return this.check(co(...e))},min(...e){return this.check(to(...e))},max(...e){return this.check(eo(...e))},length(...e){return this.check(no(...e))},nonempty(...e){return this.check(to(1,...e))},lowercase(e){return this.check(io(e))},uppercase(e){return this.check(ao(e))},trim(){return this.check(fo())},normalize(...e){return this.check(uo(...e))},toLowerCase(){return this.check(po())},toUpperCase(){return this.check(mo())},slugify(){return this.check(ho())}})}),gs=M(`ZodString`,(e,t)=>{ai.init(e,t),hs.init(e,t),e.email=t=>e.check(va(vs,t)),e.url=t=>e.check(wa(xs,t)),e.jwt=t=>e.check(za(Is,t)),e.emoji=t=>e.check(Ta(Ss,t)),e.guid=t=>e.check(ya(ys,t)),e.uuid=t=>e.check(ba(bs,t)),e.uuidv4=t=>e.check(xa(bs,t)),e.uuidv6=t=>e.check(Sa(bs,t)),e.uuidv7=t=>e.check(Ca(bs,t)),e.nanoid=t=>e.check(Ea(Cs,t)),e.guid=t=>e.check(ya(ys,t)),e.cuid=t=>e.check(Da(ws,t)),e.cuid2=t=>e.check(Oa(Ts,t)),e.ulid=t=>e.check(ka(Es,t)),e.base64=t=>e.check(Ia(Ns,t)),e.base64url=t=>e.check(La(Ps,t)),e.xid=t=>e.check(Aa(Ds,t)),e.ksuid=t=>e.check(ja(Os,t)),e.ipv4=t=>e.check(Ma(ks,t)),e.ipv6=t=>e.check(Na(As,t)),e.cidrv4=t=>e.check(Pa(js,t)),e.cidrv6=t=>e.check(Fa(Ms,t)),e.e164=t=>e.check(Ra(Fs,t)),e.datetime=t=>e.check(Ko(t)),e.date=t=>e.check(Jo(t)),e.time=t=>e.check(Xo(t)),e.duration=t=>e.check(Qo(t))});function V(e){return _a(gs,e)}var _s=M(`ZodStringFormat`,(e,t)=>{F.init(e,t),hs.init(e,t)}),vs=M(`ZodEmail`,(e,t)=>{ci.init(e,t),_s.init(e,t)}),ys=M(`ZodGUID`,(e,t)=>{oi.init(e,t),_s.init(e,t)}),bs=M(`ZodUUID`,(e,t)=>{si.init(e,t),_s.init(e,t)}),xs=M(`ZodURL`,(e,t)=>{li.init(e,t),_s.init(e,t)}),Ss=M(`ZodEmoji`,(e,t)=>{ui.init(e,t),_s.init(e,t)}),Cs=M(`ZodNanoID`,(e,t)=>{di.init(e,t),_s.init(e,t)}),ws=M(`ZodCUID`,(e,t)=>{fi.init(e,t),_s.init(e,t)}),Ts=M(`ZodCUID2`,(e,t)=>{pi.init(e,t),_s.init(e,t)}),Es=M(`ZodULID`,(e,t)=>{mi.init(e,t),_s.init(e,t)}),Ds=M(`ZodXID`,(e,t)=>{hi.init(e,t),_s.init(e,t)}),Os=M(`ZodKSUID`,(e,t)=>{gi.init(e,t),_s.init(e,t)}),ks=M(`ZodIPv4`,(e,t)=>{xi.init(e,t),_s.init(e,t)}),As=M(`ZodIPv6`,(e,t)=>{Si.init(e,t),_s.init(e,t)}),js=M(`ZodCIDRv4`,(e,t)=>{Ci.init(e,t),_s.init(e,t)}),Ms=M(`ZodCIDRv6`,(e,t)=>{wi.init(e,t),_s.init(e,t)}),Ns=M(`ZodBase64`,(e,t)=>{Ei.init(e,t),_s.init(e,t)}),Ps=M(`ZodBase64URL`,(e,t)=>{Oi.init(e,t),_s.init(e,t)}),Fs=M(`ZodE164`,(e,t)=>{ki.init(e,t),_s.init(e,t)}),Is=M(`ZodJWT`,(e,t)=>{ji.init(e,t),_s.init(e,t)}),Ls=M(`ZodNumber`,(e,t)=>{Mi.init(e,t),ms.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Eo(e,t,n,r),ps(e,`ZodNumber`,{gt(e,t){return this.check(Za(e,t))},gte(e,t){return this.check(Qa(e,t))},min(e,t){return this.check(Qa(e,t))},lt(e,t){return this.check(Ya(e,t))},lte(e,t){return this.check(Xa(e,t))},max(e,t){return this.check(Xa(e,t))},int(e){return this.check(zs(e))},safe(e){return this.check(zs(e))},positive(e){return this.check(Za(0,e))},nonnegative(e){return this.check(Qa(0,e))},negative(e){return this.check(Ya(0,e))},nonpositive(e){return this.check(Xa(0,e))},multipleOf(e,t){return this.check($a(e,t))},step(e,t){return this.check($a(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 H(e){return Wa(Ls,e)}var Rs=M(`ZodNumberFormat`,(e,t)=>{Ni.init(e,t),Ls.init(e,t)});function zs(e){return Ga(Rs,e)}var Bs=M(`ZodBoolean`,(e,t)=>{Pi.init(e,t),ms.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Do(e,t,n,r)});function Vs(e){return Ka(Bs,e)}var Hs=M(`ZodUnknown`,(e,t)=>{Fi.init(e,t),ms.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Us(){return qa(Hs)}var Ws=M(`ZodNever`,(e,t)=>{Ii.init(e,t),ms.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oo(e,t,n,r)});function Gs(e){return Ja(Ws,e)}var Ks=M(`ZodArray`,(e,t)=>{L.init(e,t),ms.init(e,t),e._zod.processJSONSchema=(t,n,r)=>No(e,t,n,r),e.element=t.element,ps(e,`ZodArray`,{min(e,t){return this.check(to(e,t))},nonempty(e){return this.check(to(1,e))},max(e,t){return this.check(eo(e,t))},length(e,t){return this.check(no(e,t))},unwrap(){return this.element}})});function qs(e,t){return R(Ks,e,t)}var Js=M(`ZodObject`,(e,t)=>{Vi.init(e,t),ms.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Po(e,t,n,r),N(e,`shape`,()=>t.shape),ps(e,`ZodObject`,{keyof(){return W(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:Us()})},loose(){return this.clone({...this._zod.def,catchall:Us()})},strict(){return this.clone({...this._zod.def,catchall:Gs()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return jn(this,e)},safeExtend(e){return Mn(this,e)},merge(e){return Nn(this,e)},pick(e){return kn(this,e)},omit(e){return An(this,e)},partial(...e){return Pn(ac,this,e[0])},required(...e){return Fn(hc,this,e[0])}})});function U(e,t){return new Js({type:`object`,shape:e??{},...P(t)})}var Ys=M(`ZodUnion`,(e,t)=>{Ui.init(e,t),ms.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fo(e,t,n,r),e.options=t.options});function Xs(e,t){return new Ys({type:`union`,options:e,...P(t)})}var Zs=M(`ZodDiscriminatedUnion`,(e,t)=>{Ys.init(e,t),Wi.init(e,t)});function Qs(e,t,n){return new Zs({type:`union`,options:t,discriminator:e,...P(n)})}var $s=M(`ZodIntersection`,(e,t)=>{Gi.init(e,t),ms.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Io(e,t,n,r)});function ec(e,t){return new $s({type:`intersection`,left:e,right:t})}var tc=M(`ZodEnum`,(e,t)=>{Ji.init(e,t),ms.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ko(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 tc({...t,checks:[],...P(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 tc({...t,checks:[],...P(r),entries:i})}});function W(e,t){return new tc({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...P(t)})}var nc=M(`ZodLiteral`,(e,t)=>{Yi.init(e,t),ms.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ao(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 G(e,t){return new nc({type:`literal`,values:Array.isArray(e)?e:[e],...P(t)})}var rc=M(`ZodTransform`,(e,t)=>{Xi.init(e,t),ms.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mo(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new an(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Hn(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(Hn(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 ic(e){return new rc({type:`transform`,transform:e})}var ac=M(`ZodOptional`,(e,t)=>{Qi.init(e,t),ms.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function oc(e){return new ac({type:`optional`,innerType:e})}var sc=M(`ZodExactOptional`,(e,t)=>{$i.init(e,t),ms.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function cc(e){return new sc({type:`optional`,innerType:e})}var lc=M(`ZodNullable`,(e,t)=>{ea.init(e,t),ms.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function uc(e){return new lc({type:`nullable`,innerType:e})}var dc=M(`ZodDefault`,(e,t)=>{ta.init(e,t),ms.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function fc(e,t){return new dc({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Cn(t)}})}var pc=M(`ZodPrefault`,(e,t)=>{ra.init(e,t),ms.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function mc(e,t){return new pc({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Cn(t)}})}var hc=M(`ZodNonOptional`,(e,t)=>{ia.init(e,t),ms.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ro(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function gc(e,t){return new hc({type:`nonoptional`,innerType:e,...P(t)})}var _c=M(`ZodCatch`,(e,t)=>{oa.init(e,t),ms.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function vc(e,t){return new _c({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var yc=M(`ZodPipe`,(e,t)=>{sa.init(e,t),ms.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ho(e,t,n,r),e.in=t.in,e.out=t.out});function bc(e,t){return new yc({type:`pipe`,in:e,out:t})}var xc=M(`ZodReadonly`,(e,t)=>{la.init(e,t),ms.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Uo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Sc(e){return new xc({type:`readonly`,innerType:e})}var Cc=M(`ZodCustom`,(e,t)=>{da.init(e,t),ms.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jo(e,t,n,r)});function wc(e,t={}){return z(Cc,e,t)}function Tc(e,t){return go(e,t)}var Ec=W([`idle`,`queued`,`running`,`waiting_approval`,`waiting_input`,`interrupted`]),Dc=W([`none`,`unread`,`needs_attention`]),Oc=[`fable`,`opus`,`sonnet`,`haiku`],kc=W(Oc);U({id:V(),slug:V().regex(/^[a-z0-9][a-z0-9-]*$/),name:V().min(1).max(60),title:V().max(120).default(``),description:V().max(8e3).default(``),avatarEmoji:V().max(8).default(`🤖`),modelTier:kc.default(`sonnet`),pinned:Vs().default(!1),hidden:Vs().default(!1),notifications:Vs().default(!0),sessionId:V().nullable().default(null),state:Ec.default(`idle`),attention:Dc.default(`none`),threadId:V().nullable().default(null),createdAt:H(),deletedAt:H().nullable().default(null)});var Ac=W([`dm`,`group`]);U({id:V(),kind:Ac,title:V().default(``),memberBotIds:qs(V()).default([]),pinned:Vs().default(!1),hidden:Vs().default(!1),lastReadAt:H().default(0),createdAt:H()});var jc=Qs(`type`,[U({type:G(`tool`),toolName:V(),summary:V(),input:Us().optional(),result:V().optional(),status:W([`running`,`ok`,`error`,`denied`])}),U({type:G(`file`),path:V(),name:V(),mime:V(),bytes:H(),action:W([`created`,`modified`]).default(`created`)}),U({type:G(`approval`),approvalId:V()}),U({type:G(`handoff`),fromBotId:V(),toBotId:V(),note:V()}),U({type:G(`error`),message:V()})]),Mc=W([`user`,`bot`,`system`]),Nc=U({id:V(),threadId:V(),authorKind:Mc,authorBotId:V().nullable().default(null),replyToId:V().nullable().default(null),contentMd:V().default(``),cards:qs(jc).default([]),streaming:Vs().default(!1),createdAt:H()});U({id:V(),messageId:V().nullable(),path:V(),name:V(),mime:V(),bytes:H(),createdAt:H()});var Pc=W([`pending`,`allowed`,`denied`,`expired`]),Fc=U({id:V(),botId:V(),threadId:V(),toolName:V(),inputSummary:V(),rawInput:Us(),status:Pc.default(`pending`),decidedBy:W([`user`,`rule`,`auto_review`]).nullable().default(null),reason:V().default(``),ruleId:V().nullable().default(null),createdAt:H(),decidedAt:H().nullable().default(null)}),Ic=W([`require`,`allow`]);U({id:V(),kind:Ic,toolPattern:V().default(`*`),inputPattern:V().default(``),scopeNote:V().default(``),builtin:Vs().default(!1),enabled:Vs().default(!0),createdAt:H()}),U({id:V(),slug:V(),name:V(),description:V().default(``),path:V(),source:W([`user`,`taught`,`imported`]).default(`user`),createdAt:H()}),U({id:V(),botId:V(),name:V().min(1),cronExpr:V(),timezone:V().default(`UTC`),instructionMd:V(),enabled:Vs().default(!0),lastRunAt:H().nullable().default(null),nextRunAt:H().nullable().default(null),createdAt:H()});var Lc=U({id:V(),routineId:V(),startedAt:H(),finishedAt:H().nullable().default(null),status:W([`running`,`ok`,`failed`,`interrupted`]),summary:V().default(``),threadId:V().nullable().default(null),isTest:Vs().default(!1)});U({id:V(),fromBotId:V(),toBotId:V(),contentMd:V(),hops:H().default(1),delivered:Vs().default(!1),createdAt:H()}),U({id:V(),botId:V(),turnId:V(),model:V(),inputTokens:H().default(0),outputTokens:H().default(0),cacheReadTokens:H().default(0),costEstimate:H().default(0),createdAt:H()}),W([`user`,`bot`,`routine`,`system`]);var Rc={seq:H(),threadId:V().nullable(),botId:V().nullable()};Qs(`type`,[U({...Rc,type:G(`hello`)}),U({...Rc,type:G(`message.created`),message:Nc}),U({...Rc,type:G(`message.delta`),messageId:V(),delta:V()}),U({...Rc,type:G(`message.done`),messageId:V(),contentMd:V()}),U({...Rc,type:G(`message.card`),messageId:V(),card:jc,cardIndex:H()}),U({...Rc,type:G(`bot.state`),state:Ec,attention:Dc}),U({...Rc,type:G(`approval.pending`),approval:Fc}),U({...Rc,type:G(`approval.resolved`),approval:Fc}),U({...Rc,type:G(`routine.run`),run:Lc}),U({...Rc,type:G(`usage.tick`),inputTokens:H(),outputTokens:H(),model:V()}),U({...Rc,type:G(`notify`),title:V(),body:V(),level:W([`info`,`warn`,`error`])}),U({...Rc,type:G(`secret.request`),requestId:V(),name:V(),reason:V()}),U({...Rc,type:G(`thread.updated`),threadId2:V()})]);var zc=Qs(`kind`,[U({kind:G(`mouse`),action:W([`move`,`down`,`up`,`wheel`]),x:H().min(0).max(1),y:H().min(0).max(1),button:W([`left`,`middle`,`right`]).default(`left`),clickCount:H().int().min(0).max(3).default(1),deltaX:H().default(0),deltaY:H().default(0)}),U({kind:G(`key`),action:W([`down`,`up`]),key:V().min(1).max(32)}),U({kind:G(`text`),text:V().min(1).max(4096)})]);U({type:G(`input`),input:zc}),U({name:V().min(1).max(60),title:V().max(120).optional(),description:V().max(8e3).optional(),avatarEmoji:V().max(8).optional(),modelTier:kc.optional()}).partial().extend({pinned:Vs().optional(),hidden:Vs().optional(),notifications:Vs().optional()}),U({kind:W([`dm`,`group`]),title:V().optional(),memberBotIds:qs(V())}),U({contentMd:V(),attachmentIds:qs(V()).optional(),replyToId:V().nullable().optional(),mentionBotIds:qs(V()).optional(),mentionEveryone:Vs().optional()}),U({decision:W([`allow`,`deny`]),alwaysRule:U({toolPattern:V(),inputPattern:V().default(``),scopeNote:V().default(``)}).optional()}),U({kind:W([`require`,`allow`]),toolPattern:V().min(1),inputPattern:V().default(``),scopeNote:V().default(``)}),U({botId:V(),name:V().min(1),cronExpr:V().min(1),timezone:V().optional(),instructionMd:V().min(1),enabled:Vs().optional()}),U({name:V().min(1),description:V().default(``),bodyMd:V().min(1),source:W([`user`,`taught`,`imported`]).optional()});var Bc={timezone:V(),maxConcurrentSessions:H().min(1).max(8),autoReviewEnabled:Vs(),theme:W([`system`,`light`,`dark`]),localExecution:W([`ask`,`always`,`never`]),dailyTokenBudget:H(),notificationsEnabled:Vs(),billingMode:W([`subscription`,`api`]),computerMode:W([`host`,`container`])};U({timezone:Bc.timezone.default(`UTC`),maxConcurrentSessions:Bc.maxConcurrentSessions.default(2),autoReviewEnabled:Bc.autoReviewEnabled.default(!0),theme:Bc.theme.default(`system`),localExecution:Bc.localExecution.default(`ask`),dailyTokenBudget:Bc.dailyTokenBudget.default(0),notificationsEnabled:Bc.notificationsEnabled.default(!0),billingMode:Bc.billingMode.default(`subscription`),computerMode:Bc.computerMode.default(`host`)}),U(Bc).partial(),U({kind:W([`message`,`file`,`routine`,`bot`]),id:V(),threadId:V().nullable(),botId:V().nullable(),title:V(),snippet:V(),createdAt:H()});var Vc=tn.MAX_ATTACHMENTS_PER_MESSAGE;function Hc(e,t){let n=e.slice(0,t),r=/(^|\s)([@/])([\w-]*)$/.exec(n);if(!r)return null;let i=r[2];return i===`/`&&n.trim()!==`/${r[3]}`?null:{prefix:i,query:r[3],start:t-r[3].length-1}}function Uc({onSend:e,bots:t,skills:n,running:r,onStop:i,uploadFile:a}){let[o,s]=(0,_.useState)(``),[c,l]=(0,_.useState)([]),[u,d]=(0,_.useState)(null),f=(0,_.useRef)(null),p=(0,_.useRef)(null),m=(0,_.useRef)(0);(0,_.useEffect)(()=>{m.current=c.length},[c.length]);let h=(0,_.useMemo)(()=>a??(e=>w.attachments.upload(e)),[a]),g=(0,_.useMemo)(()=>{if(!u||u.prefix!==`@`)return[];let e=u.query.toLowerCase();return t.filter(t=>t.bot.name.toLowerCase().includes(e)||t.bot.slug.toLowerCase().includes(e)).slice(0,8)},[u,t]),v=(0,_.useMemo)(()=>{if(!u||u.prefix!==`/`)return[];let e=u.query.toLowerCase();return n.filter(t=>t.slug.toLowerCase().includes(e)||t.name.toLowerCase().includes(e)).slice(0,8)},[u,n]);function y(e){let t=Array.from(e),n=Math.max(0,Vc-m.current),r=t.slice(0,n);m.current=Math.min(Vc,m.current+r.length);for(let e of r)h(e).then(e=>{l(t=>t.length>=Vc?t:[...t,e])}).catch(()=>{m.current=Math.max(0,m.current-1)})}function b(e){l(t=>t.filter(t=>t.id!==e))}function x(){let t=o.trim();t&&(e(t,c.map(e=>e.id)),s(``),l([]),d(null))}function ee(e,t){s(e),d(Hc(e,t))}function te(e){e.key===`Enter`&&!e.shiftKey?(e.preventDefault(),x()):e.key===`Escape`&&d(null)}function S(e){if(!u)return;let t=p.current,n=t?t.selectionStart:o.length,r=o.slice(0,u.start),i=o.slice(n),a=u.prefix===`@`?`@${e} `:`/${e} `,c=`${r}${a}${i}`;s(c),d(null),requestAnimationFrame(()=>{t?.focus();let e=r.length+a.length;t?.setSelectionRange(e,e)})}function ne(e){let t=Array.from(e.clipboardData?.items??[]).filter(e=>e.kind===`file`&&e.type.startsWith(`image/`)).map(e=>e.getAsFile()).filter(e=>!!e);t.length>0&&(e.preventDefault(),y(t))}function re(e){e.preventDefault(),e.dataTransfer.files.length>0&&y(e.dataTransfer.files)}return(0,O.jsxs)(`div`,{className:`shrink-0 border-t border-(--color-border) bg-(--color-bg-elevated) p-3`,onDrop:re,onDragOver:e=>e.preventDefault(),children:[c.length>0&&(0,O.jsx)(`div`,{className:`mb-2 flex flex-wrap gap-2`,children:c.map(e=>(0,O.jsxs)(`span`,{"data-testid":`attachment-chip`,className:`flex items-center gap-1.5 rounded-full border border-(--color-border) bg-(--color-bg) px-2.5 py-1 text-xs`,children:[e.name,(0,O.jsx)(`button`,{type:`button`,"aria-label":`Remove ${e.name}`,className:`text-(--color-text-muted) hover:text-(--color-red)`,onClick:()=>b(e.id),children:`×`})]},e.id))}),u&&(g.length>0||v.length>0)&&(0,O.jsx)(`div`,{className:`mb-2 max-h-40 overflow-auto rounded border border-(--color-border) bg-(--color-bg) text-sm shadow-lg`,children:u.prefix===`@`?g.map(e=>(0,O.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 px-3 py-1.5 text-left hover:bg-(--color-bg-hover)`,onClick:()=>S(e.bot.slug),children:[(0,O.jsx)(`span`,{children:e.bot.avatarEmoji}),(0,O.jsx)(`span`,{children:e.bot.name})]},e.bot.id)):v.map(e=>(0,O.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 px-3 py-1.5 text-left hover:bg-(--color-bg-hover)`,onClick:()=>S(e.slug),children:[(0,O.jsxs)(`span`,{className:`shrink-0 font-mono text-(--color-text-muted)`,children:[`/`,e.slug]}),(0,O.jsx)(`span`,{className:`min-w-0 truncate text-(--color-text-muted)`,title:e.description,children:e.description})]},e.id))}),(0,O.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,O.jsx)(`button`,{type:`button`,"aria-label":`Attach files`,className:`shrink-0 rounded border border-(--color-border) px-2.5 py-2 text-sm hover:bg-(--color-bg-hover)`,onClick:()=>f.current?.click(),children:`+`}),(0,O.jsx)(`input`,{ref:f,"data-testid":`attachment-input`,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{e.target.files&&y(e.target.files),e.target.value=``}}),(0,O.jsx)(`textarea`,{ref:p,value:o,rows:1,placeholder:`Message… (@ to mention, / for a skill)`,className:`max-h-40 min-h-[38px] flex-1 resize-none rounded border border-(--color-border) bg-(--color-bg) px-3 py-2 text-sm outline-none focus:border-(--color-accent)`,onChange:e=>ee(e.target.value,e.target.selectionStart),onKeyDown:te,onPaste:ne}),r&&(0,O.jsx)(`button`,{type:`button`,onClick:i,className:`shrink-0 rounded border border-(--color-red) px-3 py-2 text-sm font-medium text-(--color-red) hover:bg-(--color-red)/10`,children:`Stop`}),(0,O.jsx)(`button`,{type:`button`,onClick:x,disabled:!o.trim(),className:`shrink-0 rounded bg-(--color-accent) px-3 py-2 text-sm font-medium text-(--color-accent-fg) disabled:opacity-40`,children:`Send`})]})]})}j.setOptions({breaks:!0});function Wc(e){return j.parse(e,{async:!1}).replace(/<script[\s\S]*?<\/script>/gi,``)}function Gc(e,t){if(e.authorKind===`user`)return{name:`You`,emoji:`🧑`};if(e.authorKind===`system`)return{name:`System`,emoji:`⚙️`};let n=e.authorBotId?t[e.authorBotId]?.bot:void 0;return{name:n?.name??`Bot`,emoji:n?.avatarEmoji??`🤖`}}function Kc({message:e,botsById:t}){let{name:n,emoji:r}=Gc(e,t),i=e.authorKind===`user`;return(0,O.jsxs)(`div`,{className:b(`flex gap-3 px-4 py-2`,i&&`flex-row-reverse`),children:[(0,O.jsx)(`span`,{className:`mt-0.5 text-lg leading-none`,children:r}),(0,O.jsxs)(`div`,{className:b(`min-w-0 max-w-[75%]`,i&&`items-end text-right`),children:[(0,O.jsxs)(`div`,{className:b(`mb-0.5 flex items-baseline gap-2`,i&&`flex-row-reverse`),children:[(0,O.jsx)(`span`,{className:`text-xs font-semibold text-(--color-text-muted)`,children:n}),(0,O.jsx)(`span`,{className:`text-[11px] text-(--color-text-faint)`,children:new Date(e.createdAt).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})})]}),e.contentMd&&(0,O.jsxs)(`div`,{className:b(`markdown-body inline-block rounded-lg px-3 py-2 text-sm`,i?`bg-(--color-accent) text-(--color-accent-fg)`:`bg-(--color-bg-elevated)`),children:[(0,O.jsx)(`span`,{dangerouslySetInnerHTML:{__html:Wc(e.contentMd)}}),e.streaming&&(0,O.jsx)(`span`,{className:`ml-0.5 inline-block w-1.5 animate-pulse bg-current align-middle`,children:`\xA0`})]}),(0,O.jsx)(en,{cards:e.cards})]})]})}function qc({thread:e,messages:t,botsById:n,bots:r,skills:i,running:a,onSend:o,onStop:s}){let c=(0,_.useRef)(null),[l,u]=(0,_.useState)(!0);(0,_.useEffect)(()=>{if(!l)return;let e=()=>{let e=c.current;e&&(e.scrollTop=e.scrollHeight)};e();let t=requestAnimationFrame(()=>{e(),requestAnimationFrame(e)});return()=>cancelAnimationFrame(t)},[t,l]);function d(){let e=c.current;if(!e)return;let t=e.scrollHeight-e.scrollTop-e.clientHeight;u(t<80)}return e?(0,O.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,O.jsx)(`div`,{ref:c,onScroll:d,className:`min-h-0 flex-1 overflow-y-auto py-2`,children:t.length===0?(0,O.jsx)(`p`,{className:`px-4 py-8 text-center text-sm text-(--color-text-muted)`,children:`No messages yet — say hello and give this bot a job.`}):t.map(e=>(0,O.jsx)(Kc,{message:e,botsById:n},e.id))}),(0,O.jsx)(Uc,{onSend:o,bots:r,skills:i,running:a,onStop:s})]}):(0,O.jsx)(`div`,{className:`flex h-full flex-1 flex-col items-center justify-center text-(--color-text-muted)`,children:(0,O.jsx)(`p`,{className:`text-sm`,children:`Select a bot to start a conversation, or create a new one.`})})}var Jc=`🤖.🧠.🦾.🛰️.🧭.🗂️.📚.🔍.🧮.🧰.🛠️.⚙️.🧪.🧬.📈.📊.💡.🗒️.✍️.📝.📅.⏰.📬.📡.🌐.🔐.🗝️.🧯.🚀.🛎️.🎯.🧵.🧩.🕵️.🧑‍💻.👩‍💻.🧑‍🔬.🐜.🐝.🦉`.split(`.`);function Yc({onCreate:e,onClose:t,busy:n,error:r}){let[i,a]=(0,_.useState)(``),[o,s]=(0,_.useState)(``),[c,l]=(0,_.useState)(``),[u,d]=(0,_.useState)(`🤖`),[f,p]=(0,_.useState)(`sonnet`);function m(){i.trim()&&e({name:i.trim(),title:o.trim(),description:c.trim(),avatarEmoji:u,modelTier:f})}return(0,O.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4`,children:(0,O.jsxs)(`div`,{className:`w-full max-w-md rounded-lg border border-(--color-border) bg-(--color-bg-elevated) p-5 shadow-xl`,children:[(0,O.jsx)(`h2`,{className:`mb-4 text-base font-semibold`,children:`New bot`}),(0,O.jsxs)(`div`,{className:`space-y-3`,children:[(0,O.jsx)(`div`,{className:`flex items-center gap-3`,children:(0,O.jsx)(`div`,{className:`grid grid-cols-8 gap-1 rounded border border-(--color-border) p-1.5`,children:Jc.slice(0,16).map(e=>(0,O.jsx)(`button`,{type:`button`,"aria-pressed":u===e,onClick:()=>d(e),className:`rounded p-1 text-lg ${u===e?`bg-(--color-accent)/25`:`hover:bg-(--color-bg-hover)`}`,children:e},e))})}),(0,O.jsxs)(`label`,{className:`block text-xs`,children:[(0,O.jsx)(`span`,{className:`mb-1 block text-(--color-text-muted)`,children:`Name`}),(0,O.jsx)(`input`,{autoFocus:!0,className:`w-full rounded border border-(--color-border) bg-(--color-bg) px-2 py-1.5 text-sm`,value:i,onChange:e=>a(e.target.value),placeholder:`Scout`})]}),(0,O.jsxs)(`label`,{className:`block text-xs`,children:[(0,O.jsx)(`span`,{className:`mb-1 block text-(--color-text-muted)`,children:`Title`}),(0,O.jsx)(`input`,{className:`w-full rounded border border-(--color-border) bg-(--color-bg) px-2 py-1.5 text-sm`,value:o,onChange:e=>s(e.target.value),placeholder:`Research assistant`})]}),(0,O.jsxs)(`label`,{className:`block text-xs`,children:[(0,O.jsx)(`span`,{className:`mb-1 block text-(--color-text-muted)`,children:`Description`}),(0,O.jsx)(`textarea`,{className:`w-full rounded border border-(--color-border) bg-(--color-bg) px-2 py-1.5 text-sm`,rows:3,value:c,onChange:e=>l(e.target.value),placeholder:`What should this bot do?`})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`span`,{className:`mb-1 block text-xs text-(--color-text-muted)`,children:`Model tier`}),(0,O.jsx)(`div`,{className:`inline-flex rounded border border-(--color-border) p-0.5`,children:Oc.map(e=>(0,O.jsx)(`button`,{type:`button`,onClick:()=>p(e),className:`rounded px-3 py-1 text-xs font-medium capitalize ${f===e?`bg-(--color-accent) text-(--color-accent-fg)`:`text-(--color-text-muted)`}`,children:e},e))})]}),(0,O.jsx)(`p`,{className:`rounded border border-(--color-amber)/40 bg-(--color-amber)/10 p-2 text-xs text-(--color-amber)`,children:`Bots share one computer, workspace, browser profile and logins. Bots are not a security boundary.`}),r&&(0,O.jsx)(`p`,{className:`text-xs text-(--color-red)`,children:r})]}),(0,O.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,O.jsx)(`button`,{type:`button`,onClick:t,className:`rounded px-3 py-1.5 text-sm text-(--color-text-muted) hover:bg-(--color-bg-hover)`,children:`Cancel`}),(0,O.jsx)(`button`,{type:`button`,onClick:m,disabled:!i.trim()||n,className:`rounded bg-(--color-accent) px-3 py-1.5 text-sm font-medium text-(--color-accent-fg) disabled:opacity-40`,children:`Create bot`})]})]})})}var Xc={running:`text-(--color-blue)`,ok:`text-(--color-green)`,failed:`text-(--color-red)`,interrupted:`text-(--color-amber)`};function Zc({botId:e,onCreated:t}){let[n,r]=(0,_.useState)(``),[i,a]=(0,_.useState)(`0 9 * * *`),[o,s]=(0,_.useState)(Intl.DateTimeFormat().resolvedOptions().timeZone||`UTC`),[c,l]=(0,_.useState)(``),[u,d]=(0,_.useState)(!1),[f,p]=(0,_.useState)(null);async function m(){if(!(!n.trim()||!i.trim()||!c.trim())){d(!0),p(null);try{t(await w.routines.create({botId:e,name:n,cronExpr:i,timezone:o,instructionMd:c})),r(``),l(``)}catch(e){p(e instanceof ie?e.message:`Failed to create routine`)}finally{d(!1)}}}return(0,O.jsxs)(`div`,{className:`space-y-2 rounded-md border border-(--color-border) p-3`,children:[(0,O.jsx)(`div`,{className:`text-xs font-semibold text-(--color-text-muted)`,children:`New routine`}),(0,O.jsx)(`input`,{className:`w-full rounded border border-(--color-border) bg-(--color-bg) px-2 py-1 text-sm`,placeholder:`Name`,value:n,onChange:e=>r(e.target.value)}),(0,O.jsxs)(`div`,{className:`flex gap-2`,children:[(0,O.jsx)(`input`,{className:`flex-1 rounded border border-(--color-border) bg-(--color-bg) px-2 py-1 font-mono text-sm`,placeholder:`Cron expression (e.g. 0 9 * * *)`,value:i,onChange:e=>a(e.target.value)}),(0,O.jsx)(`input`,{className:`w-40 rounded border border-(--color-border) bg-(--color-bg) px-2 py-1 text-sm`,placeholder:`Timezone`,value:o,onChange:e=>s(e.target.value)})]}),(0,O.jsx)(`textarea`,{className:`w-full rounded border border-(--color-border) bg-(--color-bg) px-2 py-1 text-sm`,placeholder:`Instructions for this run…`,rows:3,value:c,onChange:e=>l(e.target.value)}),f&&(0,O.jsx)(`p`,{className:`text-xs text-(--color-red)`,children:f}),(0,O.jsx)(`button`,{type:`button`,disabled:u,onClick:m,className:`rounded bg-(--color-accent) px-3 py-1.5 text-sm font-medium text-(--color-accent-fg) disabled:opacity-40`,children:`Create routine`})]})}function Qc({routine:e,onChanged:t,onDeleted:n}){let[r,i]=(0,_.useState)([]),[a,o]=(0,_.useState)(!1),[s,c]=(0,_.useState)(!1),[l,u]=(0,_.useState)(!1);async function d(){let t=await w.routines.runs(e.id);i(t.slice(0,20))}async function f(){let e=!a;o(e),e&&await d()}async function p(){t(await w.routines.update(e.id,{enabled:!e.enabled}))}async function m(){window.confirm(`Delete routine "${e.name}"?`)&&(await w.routines.remove(e.id),n(e.id))}async function h(){u(!0),c(!1);try{await w.routines.testRun(e.id),await d(),o(!0)}finally{u(!1)}}return(0,O.jsxs)(`div`,{className:`rounded-md border border-(--color-border) p-3`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`div`,{className:`text-sm font-medium`,children:e.name}),(0,O.jsxs)(`div`,{className:`font-mono text-xs text-(--color-text-muted)`,children:[e.cronExpr,` · `,e.timezone]}),e.nextRunAt&&(0,O.jsxs)(`div`,{className:`text-xs text-(--color-text-faint)`,children:[`Next run: `,new Date(e.nextRunAt).toLocaleString()]})]}),(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsxs)(`label`,{className:`flex items-center gap-1 text-xs text-(--color-text-muted)`,children:[(0,O.jsx)(`input`,{type:`checkbox`,checked:e.enabled,onChange:p}),`Enabled`]}),(0,O.jsx)(`button`,{type:`button`,onClick:()=>c(!0),disabled:l,className:`rounded border border-(--color-border) px-2 py-1 text-xs hover:bg-(--color-bg-hover)`,children:`Test run`}),(0,O.jsx)(`button`,{type:`button`,onClick:m,className:`rounded border border-(--color-red)/50 px-2 py-1 text-xs text-(--color-red)`,children:`Delete`})]})]}),s&&(0,O.jsxs)(`div`,{className:`mt-2 rounded border border-(--color-amber)/50 bg-(--color-amber)/10 p-2 text-xs`,children:[(0,O.jsx)(`p`,{className:`text-(--color-amber)`,children:`A test run performs real work — it can navigate websites, change files and call connected tools.`}),(0,O.jsxs)(`div`,{className:`mt-2 flex gap-2`,children:[(0,O.jsx)(`button`,{type:`button`,onClick:h,className:`rounded bg-(--color-amber) px-2 py-1 font-medium text-(--color-bg)`,children:`Run anyway`}),(0,O.jsx)(`button`,{type:`button`,onClick:()=>c(!1),className:`rounded px-2 py-1 text-(--color-text-muted)`,children:`Cancel`})]})]}),(0,O.jsx)(`button`,{type:`button`,onClick:f,className:`mt-2 text-xs text-(--color-text-muted) hover:underline`,children:a?`Hide run history`:`Show run history`}),a&&(0,O.jsxs)(`ul`,{className:`mt-1 space-y-1`,children:[r.length===0&&(0,O.jsx)(`li`,{className:`text-xs text-(--color-text-faint)`,children:`No runs yet.`}),r.map(e=>(0,O.jsxs)(`li`,{className:`flex items-center gap-2 text-xs`,children:[(0,O.jsx)(`span`,{className:b(`font-medium`,Xc[e.status]),children:e.status}),(0,O.jsx)(`span`,{className:`text-(--color-text-faint)`,children:new Date(e.startedAt).toLocaleString()}),e.isTest&&(0,O.jsx)(`span`,{className:`rounded bg-(--color-border) px-1 text-[10px]`,children:`test`}),e.summary&&(0,O.jsx)(`span`,{className:`truncate text-(--color-text-muted)`,children:e.summary})]},e.id))]})]})}function $c({botId:e}){let[t,n]=(0,_.useState)([]),[r,i]=(0,_.useState)(!0);return(0,_.useEffect)(()=>{let t=!1;return i(!0),w.routines.list(e).then(e=>{t||n(e)}).finally(()=>{t||i(!1)}),()=>{t=!0}},[e]),(0,O.jsxs)(`div`,{className:`space-y-3`,children:[(0,O.jsx)(Zc,{botId:e,onCreated:e=>n(t=>[e,...t])}),r&&(0,O.jsx)(`p`,{className:`text-xs text-(--color-text-muted)`,children:`Loading routines…`}),!r&&t.length===0&&(0,O.jsx)(`p`,{className:`text-xs text-(--color-text-muted)`,children:`No routines yet.`}),t.map(e=>(0,O.jsx)(Qc,{routine:e,onChanged:e=>n(t=>t.map(t=>t.id===e.id?e:t)),onDeleted:e=>n(t=>t.filter(t=>t.id!==e))},e.id))]})}function el({bot:e,onUpdated:t}){let[n,r]=(0,_.useState)(e.name),[i,a]=(0,_.useState)(e.title),[o,s]=(0,_.useState)(e.description),[c,l]=(0,_.useState)(e.avatarEmoji),[u,d]=(0,_.useState)(e.modelTier),[f,p]=(0,_.useState)(!1),[m,h]=(0,_.useState)(null),[g,v]=(0,_.useState)(!1);async function y(){p(!0),h(null);try{t(await w.bots.update(e.id,{name:n,title:i,description:o,avatarEmoji:c,modelTier:u}))}catch(e){h(e instanceof ie?e.message:`Failed to save`)}finally{p(!1)}}return(0,O.jsxs)(`div`,{className:`space-y-3`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,O.jsx)(`button`,{type:`button`,onClick:()=>v(e=>!e),className:`flex h-12 w-12 items-center justify-center rounded-lg border border-(--color-border) text-2xl hover:bg-(--color-bg-hover)`,children:c}),(0,O.jsx)(`div`,{className:`flex-1`,children:(0,O.jsx)(`input`,{className:`w-full rounded border border-(--color-border) bg-(--color-bg) px-2 py-1.5 text-sm font-medium`,value:n,onChange:e=>r(e.target.value),"aria-label":`Name`})})]}),g&&(0,O.jsx)(`div`,{className:`grid grid-cols-10 gap-1 rounded border border-(--color-border) p-2`,children:Jc.map(e=>(0,O.jsx)(`button`,{type:`button`,onClick:()=>{l(e),v(!1)},className:`rounded p-1 text-lg hover:bg-(--color-bg-hover)`,children:e},e))}),(0,O.jsxs)(`label`,{className:`block text-xs`,children:[(0,O.jsx)(`span`,{className:`mb-1 block text-(--color-text-muted)`,children:`Title`}),(0,O.jsx)(`input`,{className:`w-full rounded border border-(--color-border) bg-(--color-bg) px-2 py-1.5 text-sm`,value:i,onChange:e=>a(e.target.value)})]}),(0,O.jsxs)(`label`,{className:`block text-xs`,children:[(0,O.jsx)(`span`,{className:`mb-1 block text-(--color-text-muted)`,children:`Description / persona`}),(0,O.jsx)(`textarea`,{className:`w-full rounded border border-(--color-border) bg-(--color-bg) px-2 py-1.5 text-sm`,rows:4,value:o,onChange:e=>s(e.target.value)})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`span`,{className:`mb-1 block text-xs text-(--color-text-muted)`,children:`Model tier`}),(0,O.jsx)(`div`,{className:`inline-flex rounded border border-(--color-border) p-0.5`,children:Oc.map(e=>(0,O.jsx)(`button`,{type:`button`,onClick:()=>d(e),className:`rounded px-3 py-1 text-xs font-medium capitalize ${u===e?`bg-(--color-accent) text-(--color-accent-fg)`:`text-(--color-text-muted)`}`,children:e},e))})]}),m&&(0,O.jsx)(`p`,{className:`text-xs text-(--color-red)`,children:m}),(0,O.jsx)(`button`,{type:`button`,onClick:y,disabled:f,className:`rounded bg-(--color-accent) px-3 py-1.5 text-sm font-medium text-(--color-accent-fg) disabled:opacity-40`,children:`Save profile`})]})}function tl({botId:e}){let[t,n]=(0,_.useState)([]),[r,i]=(0,_.useState)(null),[a,o]=(0,_.useState)(``),[s,c]=(0,_.useState)(``);(0,_.useEffect)(()=>{w.bots.memory.list(e).then(n)},[e]);function l(e){i(e),o(t.find(t=>t.name===e)?.content??``)}async function u(){let t=r??s.trim();t&&(await w.bots.memory.save(e,t,a),n(e=>{let n=e.findIndex(e=>e.name===t);return n===-1?[...e,{name:t,content:a}]:e.map((e,r)=>r===n?{name:t,content:a}:e)}),i(t),c(``))}async function d(t){await w.bots.memory.remove(e,t),n(e=>e.filter(e=>e.name!==t)),r===t&&(i(null),o(``))}return(0,O.jsxs)(`div`,{className:`grid grid-cols-[160px_1fr] gap-3`,children:[(0,O.jsxs)(`div`,{className:`space-y-1`,children:[t.map(e=>(0,O.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,O.jsx)(`button`,{type:`button`,onClick:()=>l(e.name),className:`flex-1 truncate rounded px-2 py-1 text-left text-xs ${r===e.name?`bg-(--color-accent)/15`:`hover:bg-(--color-bg-hover)`}`,children:e.name}),(0,O.jsx)(`button`,{type:`button`,onClick:()=>d(e.name),"aria-label":`Delete ${e.name}`,className:`text-xs text-(--color-text-faint) hover:text-(--color-red)`,children:`×`})]},e.name)),(0,O.jsx)(`input`,{className:`w-full rounded border border-(--color-border) bg-(--color-bg) px-2 py-1 text-xs`,placeholder:`new-file.md`,value:s,onChange:e=>{c(e.target.value),i(null),o(``)}})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`textarea`,{className:`h-40 w-full rounded border border-(--color-border) bg-(--color-bg) p-2 font-mono text-xs`,value:a,onChange:e=>o(e.target.value),placeholder:`Durable facts this bot should remember…`}),(0,O.jsx)(`button`,{type:`button`,onClick:u,className:`mt-2 rounded bg-(--color-accent) px-3 py-1.5 text-xs font-medium text-(--color-accent-fg)`,children:`Save memory file`})]})]})}function nl({skill:e,checked:t,onToggle:n}){let[r,i]=(0,_.useState)(!1),a=`skill-${e.id}`;return(0,O.jsxs)(`div`,{className:`flex items-start gap-2 text-sm`,children:[(0,O.jsx)(`input`,{id:a,type:`checkbox`,className:`mt-1 shrink-0`,checked:t,onChange:n}),(0,O.jsx)(`label`,{htmlFor:a,className:`shrink-0 cursor-pointer whitespace-nowrap font-medium`,children:e.name}),e.description&&(0,O.jsxs)(`button`,{type:`button`,onClick:()=>i(e=>!e),"aria-expanded":r,title:r?`Collapse description`:`Show the full description`,className:`min-w-0 flex-1 cursor-pointer text-left text-xs text-(--color-text-muted) hover:text-(--color-text) ${r?`whitespace-pre-wrap break-words`:`truncate`}`,children:[`— `,e.description]})]})}function rl({botId:e}){let[t,n]=(0,_.useState)([]),[r,i]=(0,_.useState)(new Set),[a,o]=(0,_.useState)(!1);(0,_.useEffect)(()=>{w.skills.list().then(n)},[]),(0,_.useEffect)(()=>{w.bots.skills.get(e).then(e=>i(new Set(e.map(e=>e.id))))},[e]);function s(e){i(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),o(!1)}async function c(){await w.bots.skills.set(e,Array.from(r)),o(!0)}return t.length===0?(0,O.jsx)(`p`,{className:`text-xs text-(--color-text-muted)`,children:`No skills taught yet.`}):(0,O.jsxs)(`div`,{className:`space-y-2`,children:[t.map(e=>(0,O.jsx)(nl,{skill:e,checked:r.has(e.id),onToggle:()=>s(e.id)},e.id)),(0,O.jsx)(`button`,{type:`button`,onClick:c,className:`rounded bg-(--color-accent) px-3 py-1.5 text-xs font-medium text-(--color-accent-fg)`,children:`Save skills`}),a&&(0,O.jsx)(`span`,{className:`ml-2 text-xs text-(--color-green)`,children:`Saved`})]})}function il({bot:e,onClose:t,onUpdated:n,onDuplicated:r,onDeleted:i}){let[a,o]=(0,_.useState)(!1);async function s(){n(await w.bots.update(e.id,{pinned:!e.pinned}))}async function c(){n(await w.bots.update(e.id,{hidden:!e.hidden}))}async function l(){n(await w.bots.update(e.id,{notifications:!e.notifications}))}async function u(){r(await w.bots.duplicate(e.id))}async function d(){await w.bots.remove(e.id),i(e.id)}return(0,O.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto p-5`,children:[(0,O.jsxs)(`div`,{className:`mb-4 flex items-center justify-between`,children:[(0,O.jsxs)(`h2`,{className:`text-lg font-semibold`,children:[e.name,` settings`]}),(0,O.jsx)(`button`,{type:`button`,onClick:t,className:`text-sm text-(--color-text-muted) hover:text-(--color-text)`,children:`Close`})]}),(0,O.jsx)(`section`,{className:`mb-6`,children:(0,O.jsx)(el,{bot:e,onUpdated:n})}),(0,O.jsxs)(`section`,{className:`mb-6 flex flex-wrap gap-2 border-t border-(--color-border) pt-4`,children:[(0,O.jsx)(`button`,{type:`button`,onClick:s,className:`rounded border border-(--color-border) px-3 py-1.5 text-xs hover:bg-(--color-bg-hover)`,children:e.pinned?`Unpin`:`Pin`}),(0,O.jsx)(`button`,{type:`button`,onClick:c,className:`rounded border border-(--color-border) px-3 py-1.5 text-xs hover:bg-(--color-bg-hover)`,children:e.hidden?`Unhide`:`Hide`}),(0,O.jsx)(`button`,{type:`button`,onClick:l,className:`rounded border border-(--color-border) px-3 py-1.5 text-xs hover:bg-(--color-bg-hover)`,children:e.notifications?`Mute notifications`:`Unmute notifications`}),(0,O.jsx)(`button`,{type:`button`,onClick:u,className:`rounded border border-(--color-border) px-3 py-1.5 text-xs hover:bg-(--color-bg-hover)`,children:`Duplicate`}),(0,O.jsx)(`button`,{type:`button`,onClick:()=>o(!0),className:`rounded border border-(--color-red)/50 px-3 py-1.5 text-xs text-(--color-red) hover:bg-(--color-red)/10`,children:`Delete`})]}),a&&(0,O.jsxs)(`div`,{className:`mb-6 rounded border border-(--color-red)/50 bg-(--color-red)/10 p-3 text-sm`,children:[(0,O.jsxs)(`p`,{className:`text-(--color-red)`,children:[`Delete `,e.name,`? This removes it from your roster and conversation history, but its workspace files and any browser logins it used survive deletion.`]}),(0,O.jsxs)(`div`,{className:`mt-2 flex gap-2`,children:[(0,O.jsx)(`button`,{type:`button`,onClick:d,className:`rounded bg-(--color-red) px-3 py-1.5 text-xs font-medium text-white`,children:`Delete permanently`}),(0,O.jsx)(`button`,{type:`button`,onClick:()=>o(!1),className:`rounded px-3 py-1.5 text-xs text-(--color-text-muted)`,children:`Cancel`})]})]}),(0,O.jsxs)(`section`,{className:`mb-6 border-t border-(--color-border) pt-4`,children:[(0,O.jsx)(`h3`,{className:`mb-2 text-sm font-semibold`,children:`Memory`}),(0,O.jsx)(tl,{botId:e.id})]}),(0,O.jsxs)(`section`,{className:`mb-6 border-t border-(--color-border) pt-4`,children:[(0,O.jsx)(`h3`,{className:`mb-2 text-sm font-semibold`,children:`Skills`}),(0,O.jsx)(rl,{botId:e.id})]}),(0,O.jsxs)(`section`,{className:`border-t border-(--color-border) pt-4`,children:[(0,O.jsx)(`h3`,{className:`mb-2 text-sm font-semibold`,children:`Routines`}),(0,O.jsx)($c,{botId:e.id})]})]})}function al({kind:e}){return(0,O.jsx)(`span`,{className:b(`rounded px-1.5 py-0.5 text-[11px] font-semibold uppercase tracking-wide`,e===`require`?`bg-(--color-red)/15 text-(--color-red)`:`bg-(--color-green)/15 text-(--color-green)`),children:e===`require`?`Require approval`:`Always allow`})}function ol({onCreated:e}){let[t,n]=(0,_.useState)(`require`),[r,i]=(0,_.useState)(``),[a,o]=(0,_.useState)(``),[s,c]=(0,_.useState)(``),[l,u]=(0,_.useState)(null);async function d(){if(r.trim())try{e(await w.rules.create({kind:t,toolPattern:r.trim(),inputPattern:a,scopeNote:s})),i(``),o(``),c(``),u(null)}catch(e){u(e instanceof ie?e.message:`Failed to create rule`)}}return(0,O.jsxs)(`div`,{className:`mb-4 space-y-2 rounded-md border border-(--color-border) p-3`,children:[(0,O.jsx)(`div`,{className:`flex gap-2`,children:[`require`,`allow`].map(e=>(0,O.jsx)(`button`,{type:`button`,onClick:()=>n(e),className:b(`rounded px-3 py-1 text-xs font-medium`,t===e?`bg-(--color-accent) text-(--color-accent-fg)`:`border border-(--color-border) text-(--color-text-muted)`),children:e===`require`?`Require approval`:`Always allow`},e))}),(0,O.jsx)(`input`,{className:`w-full rounded border border-(--color-border) bg-(--color-bg) px-2 py-1 font-mono text-sm`,placeholder:`Tool pattern (e.g. Bash, browser_*, *)`,value:r,onChange:e=>i(e.target.value)}),(0,O.jsx)(`input`,{className:`w-full rounded border border-(--color-border) bg-(--color-bg) px-2 py-1 font-mono text-sm`,placeholder:`Input pattern (optional regex)`,value:a,onChange:e=>o(e.target.value)}),(0,O.jsx)(`input`,{className:`w-full rounded border border-(--color-border) bg-(--color-bg) px-2 py-1 text-sm`,placeholder:`Scope note (why this rule exists)`,value:s,onChange:e=>c(e.target.value)}),l&&(0,O.jsx)(`p`,{className:`text-xs text-(--color-red)`,children:l}),(0,O.jsx)(`button`,{type:`button`,onClick:d,className:`rounded bg-(--color-accent) px-3 py-1.5 text-sm font-medium text-(--color-accent-fg)`,children:`Add rule`})]})}function sl(){let[e,t]=(0,_.useState)([]),[n,r]=(0,_.useState)(!0);(0,_.useEffect)(()=>{w.rules.list().then(t).finally(()=>r(!1))},[]);async function i(e){let n=await w.rules.update(e.id,!e.enabled);t(e=>e.map(e=>e.id===n.id?n:e))}async function a(e){e.builtin||window.confirm(`Delete rule for "${e.toolPattern}"?`)&&(await w.rules.remove(e.id),t(t=>t.filter(t=>t.id!==e.id)))}return(0,O.jsxs)(`div`,{className:`mx-auto max-w-3xl p-6`,children:[(0,O.jsx)(`h1`,{className:`mb-1 text-lg font-semibold`,children:`Rules`}),(0,O.jsx)(`p`,{className:`mb-4 text-sm text-(--color-text-muted)`,children:`Require Approval always wins over Always Allow.`}),(0,O.jsx)(ol,{onCreated:e=>t(t=>[e,...t])}),n&&(0,O.jsx)(`p`,{className:`text-sm text-(--color-text-muted)`,children:`Loading…`}),!n&&e.length===0&&(0,O.jsx)(`p`,{className:`text-sm text-(--color-text-muted)`,children:`No rules yet.`}),(0,O.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>(0,O.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border border-(--color-border) p-3`,children:[(0,O.jsxs)(`div`,{className:`min-w-0`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(al,{kind:e.kind}),e.builtin&&(0,O.jsx)(`span`,{title:`Built-in rule`,"aria-label":`Built-in rule`,className:`text-(--color-text-faint)`,children:`🔒`}),(0,O.jsx)(`span`,{className:`truncate font-mono text-sm`,children:e.toolPattern})]}),e.inputPattern&&(0,O.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-xs text-(--color-text-muted)`,children:e.inputPattern}),e.scopeNote&&(0,O.jsx)(`div`,{className:`mt-0.5 truncate text-xs text-(--color-text-faint)`,children:e.scopeNote})]}),(0,O.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,O.jsxs)(`label`,{className:`flex items-center gap-1 text-xs text-(--color-text-muted)`,children:[(0,O.jsx)(`input`,{type:`checkbox`,checked:e.enabled,onChange:()=>i(e)}),`Enabled`]}),(0,O.jsx)(`button`,{type:`button`,onClick:()=>a(e),disabled:e.builtin,className:`rounded border border-(--color-red)/50 px-2 py-1 text-xs text-(--color-red) disabled:cursor-not-allowed disabled:opacity-30`,children:`Delete`})]})]},e.id))})]})}function cl({label:e,value:t,max:n,sublabel:r}){let i=n>0?Math.max(2,Math.round(t/n*100)):0;return(0,O.jsxs)(`div`,{className:`mb-2`,children:[(0,O.jsxs)(`div`,{className:`mb-0.5 flex items-baseline justify-between text-xs`,children:[(0,O.jsx)(`span`,{className:`font-medium`,children:e}),(0,O.jsx)(`span`,{className:`text-(--color-text-muted)`,children:r??t.toLocaleString()})]}),(0,O.jsx)(`div`,{className:`h-2 rounded bg-(--color-bg)`,children:(0,O.jsx)(`div`,{className:`h-2 rounded bg-(--color-accent)`,style:{width:`${i}%`}})})]})}function ll(){let[e,t]=(0,_.useState)(null);if((0,_.useEffect)(()=>{w.usage().then(t)},[]),!e)return(0,O.jsx)(`p`,{className:`p-6 text-sm text-(--color-text-muted)`,children:`Loading usage…`});let n=e.totals.inputTokens+e.totals.outputTokens,r=Math.max(1,...e.byBot.map(e=>e.inputTokens+e.outputTokens)),i=Math.max(1,...e.byDay.map(e=>e.inputTokens+e.outputTokens)),a=Math.max(1,...e.byModel.map(e=>e.inputTokens+e.outputTokens));return(0,O.jsxs)(`div`,{className:`mx-auto max-w-3xl p-6`,children:[(0,O.jsx)(`h1`,{className:`mb-4 text-lg font-semibold`,children:`Usage`}),(0,O.jsxs)(`section`,{className:`mb-6 grid grid-cols-3 gap-3`,children:[(0,O.jsxs)(`div`,{className:`rounded-md border border-(--color-border) p-3`,children:[(0,O.jsx)(`div`,{className:`text-xs text-(--color-text-muted)`,children:`Input tokens`}),(0,O.jsx)(`div`,{className:`text-xl font-semibold`,children:e.totals.inputTokens.toLocaleString()})]}),(0,O.jsxs)(`div`,{className:`rounded-md border border-(--color-border) p-3`,children:[(0,O.jsx)(`div`,{className:`text-xs text-(--color-text-muted)`,children:`Output tokens`}),(0,O.jsx)(`div`,{className:`text-xl font-semibold`,children:e.totals.outputTokens.toLocaleString()})]}),(0,O.jsxs)(`div`,{className:`rounded-md border border-(--color-border) p-3`,children:[(0,O.jsx)(`div`,{className:`text-xs text-(--color-text-muted)`,children:`Cache-read tokens`}),(0,O.jsx)(`div`,{className:`text-xl font-semibold`,children:e.totals.cacheReadTokens.toLocaleString()})]})]}),(0,O.jsxs)(`section`,{className:`mb-6`,children:[(0,O.jsx)(`h2`,{className:`mb-2 text-sm font-semibold`,children:`By bot`}),e.byBot.length===0&&(0,O.jsx)(`p`,{className:`text-xs text-(--color-text-muted)`,children:`No usage yet.`}),e.byBot.map(e=>(0,O.jsx)(cl,{label:e.botName,value:e.inputTokens+e.outputTokens,max:r},e.botId))]}),(0,O.jsxs)(`section`,{className:`mb-6`,children:[(0,O.jsx)(`h2`,{className:`mb-2 text-sm font-semibold`,children:`By day`}),(0,O.jsx)(`div`,{className:`flex items-end gap-1`,style:{height:96},children:e.byDay.map(e=>{let t=e.inputTokens+e.outputTokens,n=Math.max(2,Math.round(t/i*88));return(0,O.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-end`,title:`${e.day}: ${t.toLocaleString()} tokens`,children:[(0,O.jsx)(`div`,{className:`w-full rounded-t bg-(--color-accent)`,style:{height:n}}),(0,O.jsx)(`span`,{className:`mt-1 rotate-0 text-[9px] text-(--color-text-faint)`,children:e.day.slice(5)})]},e.day)})}),e.byDay.length===0&&(0,O.jsx)(`p`,{className:`text-xs text-(--color-text-muted)`,children:`No usage yet.`})]}),(0,O.jsxs)(`section`,{children:[(0,O.jsx)(`h2`,{className:`mb-2 text-sm font-semibold`,children:`By model`}),e.byModel.length===0&&(0,O.jsx)(`p`,{className:`text-xs text-(--color-text-muted)`,children:`No usage yet.`}),e.byModel.map(e=>(0,O.jsx)(cl,{label:e.model,value:e.inputTokens+e.outputTokens,max:a,sublabel:n>0?`${Math.round((e.inputTokens+e.outputTokens)/n*100)}%`:`0%`},e.model))]})]})}function ul({label:e,children:t}){return(0,O.jsxs)(`label`,{className:`mb-3 flex items-center justify-between gap-4 border-b border-(--color-border) py-2 text-sm`,children:[(0,O.jsx)(`span`,{className:`text-(--color-text-muted)`,children:e}),t]})}function dl({onSettingsChange:e}){let[t,n]=(0,_.useState)(null),[r,i]=(0,_.useState)(!1);(0,_.useEffect)(()=>{w.settings.get().then(t=>{n(t),e?.(t)})},[]);async function a(r){if(!t)return;let a={...t,...r};n(a),i(!0);try{let t=await w.settings.update(r);n(t),e?.(t)}finally{i(!1)}}return t?(0,O.jsxs)(`div`,{className:`mx-auto max-w-xl p-6`,children:[(0,O.jsxs)(`div`,{className:`mb-4 flex items-center justify-between`,children:[(0,O.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Settings`}),r&&(0,O.jsx)(`span`,{className:`text-xs text-(--color-text-muted)`,children:`Saving…`})]}),(0,O.jsx)(ul,{label:`Timezone`,children:(0,O.jsx)(`input`,{className:`w-48 rounded border border-(--color-border) bg-(--color-bg) px-2 py-1 text-sm`,value:t.timezone,onChange:e=>a({timezone:e.target.value})})}),(0,O.jsx)(ul,{label:`Max concurrent sessions`,children:(0,O.jsx)(`input`,{type:`number`,min:1,max:8,className:`w-20 rounded border border-(--color-border) bg-(--color-bg) px-2 py-1 text-sm`,value:t.maxConcurrentSessions,onChange:e=>a({maxConcurrentSessions:Math.min(8,Math.max(1,Number(e.target.value)||1))})})}),(0,O.jsx)(ul,{label:`Auto-review (Haiku triage of tool calls)`,children:(0,O.jsx)(`input`,{type:`checkbox`,checked:t.autoReviewEnabled,onChange:e=>a({autoReviewEnabled:e.target.checked})})}),(0,O.jsx)(ul,{label:`Theme`,children:(0,O.jsxs)(`select`,{className:`rounded border border-(--color-border) bg-(--color-bg) px-2 py-1 text-sm`,value:t.theme,onChange:e=>a({theme:e.target.value}),children:[(0,O.jsx)(`option`,{value:`system`,children:`System`}),(0,O.jsx)(`option`,{value:`light`,children:`Light`}),(0,O.jsx)(`option`,{value:`dark`,children:`Dark`})]})}),(0,O.jsx)(ul,{label:`Local execution (run commands on this machine)`,children:(0,O.jsxs)(`select`,{className:`rounded border border-(--color-border) bg-(--color-bg) px-2 py-1 text-sm`,value:t.localExecution,onChange:e=>a({localExecution:e.target.value}),children:[(0,O.jsx)(`option`,{value:`ask`,children:`Ask`}),(0,O.jsx)(`option`,{value:`always`,children:`Always`}),(0,O.jsx)(`option`,{value:`never`,children:`Never`})]})}),(0,O.jsx)(ul,{label:`Daily token budget (0 = unlimited)`,children:(0,O.jsx)(`input`,{type:`number`,min:0,className:`w-32 rounded border border-(--color-border) bg-(--color-bg) px-2 py-1 text-sm`,value:t.dailyTokenBudget,onChange:e=>a({dailyTokenBudget:Math.max(0,Number(e.target.value)||0)})})}),(0,O.jsx)(ul,{label:`Desktop notifications`,children:(0,O.jsx)(`input`,{type:`checkbox`,checked:t.notificationsEnabled,onChange:e=>a({notificationsEnabled:e.target.checked})})}),(0,O.jsx)(ul,{label:`Billing mode`,children:(0,O.jsxs)(`select`,{className:`rounded border border-(--color-border) bg-(--color-bg) px-2 py-1 text-sm`,value:t.billingMode,onChange:e=>a({billingMode:e.target.value}),children:[(0,O.jsx)(`option`,{value:`subscription`,children:`Subscription`}),(0,O.jsx)(`option`,{value:`api`,children:`API (metered)`})]})}),(0,O.jsx)(ul,{label:`Computer mode`,children:(0,O.jsxs)(`select`,{className:`rounded border border-(--color-border) bg-(--color-bg) px-2 py-1 text-sm`,value:t.computerMode,onChange:e=>a({computerMode:e.target.value}),children:[(0,O.jsx)(`option`,{value:`host`,children:`Host`}),(0,O.jsx)(`option`,{value:`container`,children:`Container`})]})})]}):(0,O.jsx)(`p`,{className:`p-6 text-sm text-(--color-text-muted)`,children:`Loading settings…`})}var fl=/\.(png|jpe?g|gif|webp|svg|bmp)$/i,pl=/\.(md|markdown|txt|json|ya?ml|csv|log|ts|tsx|js|jsx|py|sh|css|html)$/i;function ml(e){return e.startsWith(`.`)}function hl({entry:e,depth:t,showHidden:n,onOpenFile:r}){let[i,a]=(0,_.useState)(!1),[o,s]=(0,_.useState)(null),[c,l]=(0,_.useState)(!1);async function u(){if(!e.dir){r(e.path);return}if(!i&&o===null){l(!0);let t=await w.workspace.tree(e.path);s(t),l(!1)}a(e=>!e)}return(0,O.jsxs)(`div`,{children:[(0,O.jsxs)(`button`,{type:`button`,onClick:u,className:`flex w-full items-center gap-1.5 rounded px-1.5 py-1 text-left text-sm hover:bg-(--color-bg-hover)`,style:{paddingLeft:`${t*14+6}px`},children:[(0,O.jsx)(`span`,{className:`w-3 shrink-0 text-(--color-text-faint)`,children:e.dir?i?`▾`:`▸`:``}),(0,O.jsx)(`span`,{className:`shrink-0`,children:e.dir?`📁`:`📄`}),(0,O.jsx)(`span`,{className:`truncate`,children:e.name}),!e.dir&&(0,O.jsxs)(`span`,{className:`ml-auto shrink-0 text-xs text-(--color-text-faint)`,children:[e.bytes,`B`]})]}),i&&(0,O.jsxs)(`div`,{children:[c&&(0,O.jsx)(`div`,{style:{paddingLeft:`${(t+1)*14+6}px`},className:`py-1 text-xs text-(--color-text-faint)`,children:`Loading…`}),o?.filter(e=>n||!ml(e.name)).map(e=>(0,O.jsx)(hl,{entry:e,depth:t+1,showHidden:n,onOpenFile:r},e.path))]})]})}function gl({path:e,onClose:t}){let[n,r]=(0,_.useState)(null),i=e.split(`/`).pop()??e,a=fl.test(i),o=pl.test(i);return(0,_.useEffect)(()=>{r(null),o&&fetch(w.workspace.fileUrl(e)).then(e=>e.text()).then(r).catch(()=>r(`(failed to load preview)`))},[e,o]),(0,O.jsxs)(`div`,{className:`flex h-full flex-col border-l border-(--color-border)`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between border-b border-(--color-border) p-2`,children:[(0,O.jsx)(`span`,{className:`truncate text-sm font-medium`,children:i}),(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(`a`,{href:w.workspace.fileUrl(e),download:i,className:`text-xs text-(--color-accent) hover:underline`,children:`Download`}),(0,O.jsx)(`button`,{type:`button`,onClick:t,className:`text-xs text-(--color-text-muted) hover:text-(--color-text)`,children:`Close`})]})]}),(0,O.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto p-2`,children:[a&&(0,O.jsx)(`img`,{src:w.workspace.fileUrl(e),alt:i,className:`max-w-full`}),o&&(0,O.jsx)(`pre`,{className:`whitespace-pre-wrap font-mono text-xs`,children:n??`Loading…`}),!a&&!o&&(0,O.jsx)(`p`,{className:`text-sm text-(--color-text-muted)`,children:`No inline preview available — use Download.`})]})]})}function _l(){let[e,t]=(0,_.useState)([]),[n,r]=(0,_.useState)(!1),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(!0);return(0,_.useEffect)(()=>{w.workspace.tree(``).then(t).finally(()=>s(!1))},[]),(0,O.jsxs)(`div`,{className:`flex h-full`,children:[(0,O.jsxs)(`div`,{className:`flex w-80 shrink-0 flex-col border-r border-(--color-border)`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between border-b border-(--color-border) p-2`,children:[(0,O.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Workspace`}),(0,O.jsxs)(`label`,{className:`flex items-center gap-1 text-xs text-(--color-text-muted)`,children:[(0,O.jsx)(`input`,{type:`checkbox`,checked:n,onChange:e=>r(e.target.checked)}),`Hidden files`]})]}),(0,O.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-1`,children:[o&&(0,O.jsx)(`p`,{className:`p-2 text-xs text-(--color-text-muted)`,children:`Loading…`}),!o&&e.length===0&&(0,O.jsx)(`p`,{className:`p-2 text-xs text-(--color-text-muted)`,children:`Workspace is empty.`}),e.filter(e=>n||!ml(e.name)).map(e=>(0,O.jsx)(hl,{entry:e,depth:0,showHidden:n,onOpenFile:a},e.path))]})]}),i&&(0,O.jsx)(`div`,{className:`w-96 shrink-0`,children:(0,O.jsx)(gl,{path:i,onClose:()=>a(null)})})]})}function vl(){let[e,t]=(0,_.useState)(null),[n,r]=(0,_.useState)(null),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(!1),[c,l]=(0,_.useState)(null),u=(0,_.useRef)(null),d=(0,_.useRef)(null),[f,p]=(0,_.useState)(!1);(0,_.useEffect)(()=>{w.computer.status().then(e=>{t(e),e.pages.length>0&&r(e.pages[0].botId)})},[]),(0,_.useEffect)(()=>{if(a(null),u.current?.close(),!n||!e?.available)return;let t=window.location.protocol===`https:`?`wss`:`ws`,r=new WebSocket(`${t}://${window.location.host}/api/computer/screencast/${n}`);return u.current=r,r.onmessage=e=>{try{let t=JSON.parse(e.data);t.type===`frame`&&a({data:t.data,w:t.w,h:t.h})}catch{}},()=>r.close()},[n,e?.available]),(0,_.useEffect)(()=>{o&&d.current?.focus()},[o]);async function m(){if(!n)return;let e=await w.computer.takeover(n);s(e.ok),l(e.message??null)}async function h(){n&&(await w.computer.returnControl(n),s(!1),l(null))}function g(e){let t=u.current;if(!(!o||!t||t.readyState!==WebSocket.OPEN))try{t.send(JSON.stringify({type:`input`,input:e}))}catch{}}function v(e){let t=e.currentTarget.getBoundingClientRect();return t.width<=0||t.height<=0?null:{x:(e.clientX-t.left)/t.width,y:(e.clientY-t.top)/t.height}}let y=[`left`,`middle`,`right`];return e?e.available?(0,O.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-(--color-border) p-3`,children:[(0,O.jsxs)(`select`,{className:`rounded border border-(--color-border) bg-(--color-bg) px-2 py-1 text-sm`,value:n??``,onChange:e=>r(e.target.value||null),children:[e.pages.length===0&&(0,O.jsx)(`option`,{value:``,children:`No active pages`}),e.pages.map(e=>(0,O.jsx)(`option`,{value:e.botId,children:e.title||e.url},e.botId))]}),(0,O.jsx)(`div`,{className:`flex items-center gap-2`,children:o?(0,O.jsx)(`button`,{type:`button`,onClick:h,className:`rounded bg-(--color-accent) px-3 py-1.5 text-xs font-medium text-(--color-accent-fg)`,children:`Return control`}):(0,O.jsx)(`button`,{type:`button`,onClick:m,disabled:!n,className:`rounded border border-(--color-border) px-3 py-1.5 text-xs font-medium hover:bg-(--color-bg-hover) disabled:opacity-40`,children:`Take over`})})]}),(0,O.jsx)(`p`,{className:`border-b border-(--color-border) bg-(--color-amber)/10 px-3 py-2 text-xs text-(--color-amber)`,children:`Never paste passwords or one-time codes into chat — use takeover.`}),c&&(0,O.jsx)(`p`,{className:`border-b border-(--color-border) bg-(--color-bg-elevated) px-3 py-2 text-xs text-(--color-text-muted)`,children:c}),(0,O.jsx)(`div`,{ref:d,tabIndex:o?0:-1,onFocus:()=>p(!0),onBlur:()=>p(!1),onKeyDown:e=>{o&&((e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`v`||(e.preventDefault(),e.key.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey?g({kind:`text`,text:e.key}):g({kind:`key`,action:`down`,key:e.key})))},onKeyUp:e=>{o&&((e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`v`||(e.preventDefault(),e.key.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey||g({kind:`key`,action:`up`,key:e.key})))},onPaste:e=>{if(!o)return;e.preventDefault();let t=e.clipboardData.getData(`text`);t&&g({kind:`text`,text:t.slice(0,4096)})},className:`flex min-h-0 flex-1 items-center justify-center overflow-auto bg-black/20 p-3 outline-none ${o&&!f?`ring-2 ring-(--color-amber) ring-inset`:``}`,children:i?(0,O.jsx)(`img`,{src:`data:image/jpeg;base64,${i.data}`,width:i.w,height:i.h,alt:`Agent computer screencast`,draggable:!1,onPointerMove:e=>{let t=v(e);t&&g({kind:`mouse`,action:`move`,...t,button:`left`,clickCount:1,deltaX:0,deltaY:0})},onPointerDown:e=>{let t=v(e);t&&(d.current?.focus(),g({kind:`mouse`,action:`down`,...t,button:y[e.button]??`left`,clickCount:e.detail||1,deltaX:0,deltaY:0}))},onPointerUp:e=>{let t=v(e);t&&g({kind:`mouse`,action:`up`,...t,button:y[e.button]??`left`,clickCount:e.detail||1,deltaX:0,deltaY:0})},onWheel:e=>{let t=v(e);t&&g({kind:`mouse`,action:`wheel`,...t,button:`left`,clickCount:1,deltaX:e.deltaX,deltaY:e.deltaY})},onContextMenu:e=>{o&&e.preventDefault()},className:`max-h-full max-w-full rounded border border-(--color-border) ${o?`cursor-crosshair`:`pointer-events-none select-none`}`}):(0,O.jsx)(`p`,{className:`text-sm text-(--color-text-muted)`,children:`Waiting for a screencast frame…`})}),o&&!f&&(0,O.jsx)(`p`,{className:`border-t border-(--color-border) bg-(--color-amber)/10 px-3 py-2 text-xs text-(--color-amber)`,children:`Click the screen to send keystrokes to it.`})]}):(0,O.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-2 p-6 text-center`,children:[(0,O.jsx)(`p`,{className:`text-sm font-medium`,children:`The agent computer isn't available right now.`}),(0,O.jsx)(`p`,{className:`max-w-sm text-xs text-(--color-text-muted)`,children:`Bots can still browse the web and use tools — you just won't see a live screencast until the computer service starts.`})]}):(0,O.jsx)(`p`,{className:`p-6 text-sm text-(--color-text-muted)`,children:`Checking the computer service…`})}var yl=[{label:`New bot`,target:{kind:`newBot`}},{label:`Open settings`,target:{kind:`settings`}},{label:`Open rules`,target:{kind:`rules`}},{label:`Open usage`,target:{kind:`usage`}},{label:`Open workspace`,target:{kind:`workspace`}}];function bl({open:e,onClose:t,onNavigate:n}){let[r,i]=(0,_.useState)(``),[a,o]=(0,_.useState)([]);if((0,_.useEffect)(()=>{e||(i(``),o([]))},[e]),(0,_.useEffect)(()=>{if(!r.trim()){o([]);return}let e=!1,t=setTimeout(()=>{w.search(r).then(t=>{e||o(t)})},150);return()=>{e=!0,clearTimeout(t)}},[r]),!e)return null;let s=yl.filter(e=>e.label.toLowerCase().includes(r.toLowerCase()));function c(e){n(e),t()}return(0,O.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-start justify-center bg-black/50 pt-24`,onClick:t,children:(0,O.jsxs)(`div`,{className:`w-full max-w-lg rounded-lg border border-(--color-border) bg-(--color-bg-elevated) shadow-2xl`,onClick:e=>e.stopPropagation(),children:[(0,O.jsx)(`input`,{autoFocus:!0,value:r,onChange:e=>i(e.target.value),onKeyDown:e=>e.key===`Escape`&&t(),placeholder:`Search bots, threads, messages, files… or run a command`,className:`w-full border-b border-(--color-border) bg-transparent px-4 py-3 text-sm outline-none`}),(0,O.jsxs)(`div`,{className:`max-h-96 overflow-y-auto p-1.5`,children:[s.length>0&&(0,O.jsxs)(`div`,{className:`mb-1`,children:[(0,O.jsx)(`div`,{className:`px-2 py-1 text-[11px] font-semibold uppercase tracking-wide text-(--color-text-faint)`,children:`Actions`}),s.map(e=>(0,O.jsx)(`button`,{type:`button`,onClick:()=>c(e.target),className:`flex w-full items-center rounded px-2.5 py-1.5 text-left text-sm hover:bg-(--color-bg-hover)`,children:e.label},e.label))]}),a.length>0&&(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`div`,{className:`px-2 py-1 text-[11px] font-semibold uppercase tracking-wide text-(--color-text-faint)`,children:`Results`}),a.map(e=>(0,O.jsxs)(`button`,{type:`button`,onClick:()=>e.threadId&&c({kind:`thread`,id:e.threadId}),className:`flex w-full flex-col items-start rounded px-2.5 py-1.5 text-left text-sm hover:bg-(--color-bg-hover)`,children:[(0,O.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(`span`,{className:`rounded bg-(--color-border) px-1 text-[10px] uppercase text-(--color-text-muted)`,children:e.kind}),(0,O.jsx)(`span`,{className:`truncate font-medium`,children:e.title})]}),e.snippet&&(0,O.jsx)(`span`,{className:`truncate text-xs text-(--color-text-muted)`,children:e.snippet})]},`${e.kind}-${e.id}`))]}),r.trim()&&s.length===0&&a.length===0&&(0,O.jsx)(`p`,{className:`px-2.5 py-4 text-center text-sm text-(--color-text-muted)`,children:`No results.`})]})]})})}var xl=[{view:`thread`,label:`Chats`},{view:`workspace`,label:`Workspace`},{view:`computer`,label:`Computer`},{view:`rules`,label:`Rules`},{view:`usage`,label:`Usage`},{view:`settings`,label:`Settings`}],Sl={connecting:`Connecting…`,open:`Connected`,closed:`Disconnected`},Cl={connecting:`bg-(--color-amber) animate-pulse`,open:`bg-(--color-green)`,closed:`bg-(--color-red)`};function wl({connection:e,pendingCount:t,view:n,onChangeView:r,onOpenPalette:i}){return(0,O.jsxs)(`header`,{className:`flex h-12 shrink-0 items-center justify-between border-b border-(--color-border) bg-(--color-bg-elevated) px-3`,children:[(0,O.jsx)(`nav`,{className:`flex items-center gap-1`,children:xl.map(e=>(0,O.jsxs)(`button`,{type:`button`,onClick:()=>r(e.view),className:b(`rounded px-2.5 py-1 text-xs font-medium`,n===e.view?`bg-(--color-accent)/15 text-(--color-accent)`:`text-(--color-text-muted) hover:bg-(--color-bg-hover)`),children:[e.label,e.view===`rules`&&t>0&&(0,O.jsx)(`span`,{className:`ml-1.5 rounded-full bg-(--color-amber) px-1.5 py-0.5 text-[10px] font-semibold text-(--color-bg)`,children:t})]},e.view))}),(0,O.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,O.jsxs)(`button`,{type:`button`,onClick:i,className:`rounded border border-(--color-border) px-2.5 py-1 text-xs text-(--color-text-muted) hover:bg-(--color-bg-hover)`,children:[`Search… `,(0,O.jsx)(`span`,{className:`ml-1 opacity-60`,children:`⌘K`})]}),t>0&&(0,O.jsxs)(`span`,{className:`flex items-center gap-1 rounded-full bg-(--color-amber)/15 px-2 py-0.5 text-xs font-medium text-(--color-amber)`,children:[t,` pending approval`,t===1?``:`s`]}),(0,O.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs text-(--color-text-muted)`,children:[(0,O.jsx)(`span`,{className:b(`h-1.5 w-1.5 rounded-full`,Cl[e])}),Sl[e]]})]})]})}function Tl({children:e}){return(0,O.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:e})}function El({children:e}){return(0,O.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:e})}function Dl(){let e=T(e=>e.bots),t=T(e=>e.threads),n=T(e=>e.activeThreadId),r=T(e=>e.messagesByThread),i=T(e=>e.pendingApprovals),a=T(e=>e.connection),o=T(e=>e.notifications),s=T(e=>e.setBots),c=T(e=>e.setThreads),l=T(e=>e.setThreadMessages),u=T(e=>e.setActiveThreadId),d=T(e=>e.appendLocalMessage),f=T(e=>e.dismissNotification),p=T(e=>e.setPendingApprovals),[m,h]=(0,_.useState)(`thread`),[g,v]=(0,_.useState)(!1),[y,x]=(0,_.useState)(!1),[ee,te]=(0,_.useState)(null),[S,ne]=(0,_.useState)(null),[re,ie]=(0,_.useState)(!1),[C,ae]=(0,_.useState)([]),[oe,se]=(0,_.useState)(`system`);(0,_.useEffect)(()=>{let e=document.documentElement,t=window.matchMedia(`(prefers-color-scheme: dark)`);function n(){let n=oe===`light`||oe===`system`&&!t.matches;e.classList.toggle(`light`,n)}return n(),t.addEventListener(`change`,n),()=>t.removeEventListener(`change`,n)},[oe]),(0,_.useEffect)(()=>{w.bots.list().then(s),w.threads.list().then(c),w.skills.list().then(ae),w.approvals.list().then(p).catch(()=>{});let e=E();return()=>e.close()},[s,c,p]),(0,_.useEffect)(()=>{n&&(w.threads.get(n).then(({messages:e})=>{l(n,e)}),w.threads.markRead(n).catch(()=>{}))},[n,l]),(0,_.useEffect)(()=>{function e(e){let t=e.metaKey||e.ctrlKey;t&&e.key.toLowerCase()===`n`?(e.preventDefault(),v(!0)):t&&e.key.toLowerCase()===`k`&&(e.preventDefault(),ie(!0))}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let ce=(0,_.useMemo)(()=>{let t={};for(let n of e)t[n.bot.id]=n;return t},[e]),le=(0,_.useMemo)(()=>Object.values(t).filter(e=>e.kind===`group`),[t]),D=n?t[n]??null:null,ue=n?r[n]??[]:[],de=D?e.find(e=>e.thread?.id===D.id):void 0,fe=S?ce[S]?.bot??null:null;async function pe(){s(await w.bots.list())}async function k(e){x(!0),te(null);try{let t=await w.bots.create(e);await pe(),v(!1),t.threadId&&(c(await w.threads.list()),u(t.threadId),h(`thread`))}catch(e){te(e instanceof Error?e.message:`Failed to create bot`)}finally{x(!1)}}async function me(e,t){if(!n)return;let r=await w.threads.postMessage(n,{contentMd:e,attachmentIds:t});d(n,r)}async function he(){de&&await w.bots.stop(de.bot.id)}function _e(e){u(e),ne(null),h(`thread`)}function ve(e){e.kind===`thread`?_e(e.id):e.kind===`newBot`?v(!0):h(e.kind)}return(0,O.jsxs)(`div`,{className:`flex h-dvh flex-col overflow-hidden`,children:[(0,O.jsx)(wl,{connection:a,pendingCount:i.length,view:m,onChangeView:e=>{ne(null),h(e)},onOpenPalette:()=>ie(!0)}),(0,O.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,O.jsx)(ge,{entries:e,groupThreads:le,botsById:ce,activeThreadId:n,onSelectThread:_e,onNewBot:()=>v(!0)}),(0,O.jsxs)(`main`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[m===`thread`&&(fe?(0,O.jsx)(il,{bot:fe,onClose:()=>ne(null),onUpdated:t=>s(e.map(e=>e.bot.id===t.id?{...e,bot:t}:e)),onDuplicated:e=>{pe(),ne(e.id)},onDeleted:()=>{ne(null),pe()}}):(0,O.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[de&&(0,O.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-(--color-border) px-4 py-2`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(`span`,{className:`text-lg leading-none`,children:de.bot.avatarEmoji}),(0,O.jsx)(`span`,{className:`text-sm font-semibold`,children:de.bot.name}),de.bot.title&&(0,O.jsx)(`span`,{className:`text-xs text-(--color-text-muted)`,children:de.bot.title})]}),(0,O.jsx)(`button`,{type:`button`,onClick:()=>ne(de.bot.id),className:`text-xs text-(--color-text-muted) hover:text-(--color-text)`,children:`Bot settings`})]}),(0,O.jsx)(qc,{thread:D,messages:ue,botsById:ce,bots:e,skills:C,running:de?.bot.state===`running`||de?.bot.state===`queued`,onSend:me,onStop:he})]})),m===`rules`&&(0,O.jsx)(Tl,{children:(0,O.jsx)(sl,{})}),m===`usage`&&(0,O.jsx)(Tl,{children:(0,O.jsx)(ll,{})}),m===`settings`&&(0,O.jsx)(Tl,{children:(0,O.jsx)(dl,{onSettingsChange:e=>se(e.theme)})}),m===`workspace`&&(0,O.jsx)(El,{children:(0,O.jsx)(_l,{})}),m===`computer`&&(0,O.jsx)(El,{children:(0,O.jsx)(vl,{})})]})]}),o.length>0&&(0,O.jsx)(`div`,{className:`pointer-events-none fixed bottom-24 right-4 z-50 flex flex-col gap-2`,children:o.slice(-4).map(e=>(0,O.jsxs)(`div`,{className:b(`pointer-events-auto w-72 rounded-md border p-3 text-sm shadow-lg`,e.level===`error`&&`border-(--color-red)/50 bg-(--color-bg-elevated)`,e.level===`warn`&&`border-(--color-amber)/50 bg-(--color-bg-elevated)`,e.level===`info`&&`border-(--color-border) bg-(--color-bg-elevated)`),children:[(0,O.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,O.jsx)(`span`,{className:`font-medium`,children:e.title}),(0,O.jsx)(`button`,{type:`button`,onClick:()=>f(e.id),className:`text-(--color-text-faint) hover:text-(--color-text)`,children:`×`})]}),e.body&&(0,O.jsx)(`p`,{className:`mt-0.5 text-xs text-(--color-text-muted)`,children:e.body})]},e.id))}),g&&(0,O.jsx)(Yc,{onCreate:k,onClose:()=>v(!1),busy:y,error:ee}),(0,O.jsx)(bl,{open:re,onClose:()=>ie(!1),onNavigate:ve})]})}var Ol=document.getElementById(`root`);if(!Ol)throw Error(`#root not found`);(0,v.createRoot)(Ol).render((0,O.jsx)(_.StrictMode,{children:(0,O.jsx)(Dl,{})}));
@@ -0,0 +1,2 @@
1
+ /*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
2
+ @layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-space-y-reverse:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000}}}@layer theme{:root,:host{--font-sans:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-sm:24rem;--container-md:28rem;--container-lg:32rem;--container-xl:36rem;--container-3xl:48rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height:calc(1.5 / 1);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--font-weight-medium:500;--font-weight-semibold:600;--tracking-wide:.025em;--radius-md:.375rem;--radius-lg:.5rem;--animate-ping:ping 1s cubic-bezier(0, 0, .2, 1) infinite;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring:where(:not(iframe)){outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.invisible{visibility:hidden}.visible{visibility:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.inset-0{inset:0}.right-4{right:calc(var(--spacing) * 4)}.bottom-24{bottom:calc(var(--spacing) * 24)}.z-50{z-index:50}.container{width:100%}@media (width>=40rem){.container{max-width:40rem}}@media (width>=48rem){.container{max-width:48rem}}@media (width>=64rem){.container{max-width:64rem}}@media (width>=80rem){.container{max-width:80rem}}@media (width>=96rem){.container{max-width:96rem}}.mx-auto{margin-inline:auto}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:var(--spacing)}.mt-1\.5{margin-top:calc(var(--spacing) * 1.5)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mb-0\.5{margin-bottom:calc(var(--spacing) * .5)}.mb-1{margin-bottom:var(--spacing)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.mb-6{margin-bottom:calc(var(--spacing) * 6)}.ml-0\.5{margin-left:calc(var(--spacing) * .5)}.ml-1{margin-left:var(--spacing)}.ml-1\.5{margin-left:calc(var(--spacing) * 1.5)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-auto{margin-left:auto}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.h-1\.5{height:calc(var(--spacing) * 1.5)}.h-2{height:calc(var(--spacing) * 2)}.h-12{height:calc(var(--spacing) * 12)}.h-40{height:calc(var(--spacing) * 40)}.h-dvh{height:100dvh}.h-full{height:100%}.max-h-40{max-height:calc(var(--spacing) * 40)}.max-h-48{max-height:calc(var(--spacing) * 48)}.max-h-64{max-height:calc(var(--spacing) * 64)}.max-h-96{max-height:calc(var(--spacing) * 96)}.max-h-full{max-height:100%}.min-h-0{min-height:0}.min-h-\[38px\]{min-height:38px}.w-1\.5{width:calc(var(--spacing) * 1.5)}.w-2{width:calc(var(--spacing) * 2)}.w-3{width:calc(var(--spacing) * 3)}.w-12{width:calc(var(--spacing) * 12)}.w-20{width:calc(var(--spacing) * 20)}.w-32{width:calc(var(--spacing) * 32)}.w-40{width:calc(var(--spacing) * 40)}.w-48{width:calc(var(--spacing) * 48)}.w-64{width:calc(var(--spacing) * 64)}.w-72{width:calc(var(--spacing) * 72)}.w-80{width:calc(var(--spacing) * 80)}.w-96{width:calc(var(--spacing) * 96)}.w-full{width:100%}.max-w-3xl{max-width:var(--container-3xl)}.max-w-\[75\%\]{max-width:75%}.max-w-full{max-width:100%}.max-w-lg{max-width:var(--container-lg)}.max-w-md{max-width:var(--container-md)}.max-w-sm{max-width:var(--container-sm)}.max-w-xl{max-width:var(--container-xl)}.min-w-0{min-width:0}.flex-1{flex:1}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.rotate-0{rotate:0deg}.animate-ping{animation:var(--animate-ping)}.animate-pulse{animation:var(--animate-pulse)}.cursor-crosshair{cursor:crosshair}.cursor-pointer{cursor:pointer}.resize-none{resize:none}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}.grid-cols-10{grid-template-columns:repeat(10,minmax(0,1fr))}.grid-cols-\[160px_1fr\]{grid-template-columns:160px 1fr}.flex-col{flex-direction:column}.flex-row-reverse{flex-direction:row-reverse}.flex-wrap{flex-wrap:wrap}.items-baseline{align-items:baseline}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-0\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:var(--spacing)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(var(--spacing) * var(--tw-space-y-reverse));margin-block-end:calc(var(--spacing) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-full{border-radius:2147483647px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-t{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.border{border-style:var(--tw-border-style);border-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-l-4{border-left-style:var(--tw-border-style);border-left-width:4px}.border-\(--color-amber\)\/40{border-color:var(--color-amber)}@supports (color:color-mix(in lab, red, red)){.border-\(--color-amber\)\/40{border-color:color-mix(in oklab, var(--color-amber) 40%, transparent)}}.border-\(--color-amber\)\/50{border-color:var(--color-amber)}@supports (color:color-mix(in lab, red, red)){.border-\(--color-amber\)\/50{border-color:color-mix(in oklab, var(--color-amber) 50%, transparent)}}.border-\(--color-border\){border-color:var(--color-border)}.border-\(--color-red\),.border-\(--color-red\)\/40{border-color:var(--color-red)}@supports (color:color-mix(in lab, red, red)){.border-\(--color-red\)\/40{border-color:color-mix(in oklab, var(--color-red) 40%, transparent)}}.border-\(--color-red\)\/50{border-color:var(--color-red)}@supports (color:color-mix(in lab, red, red)){.border-\(--color-red\)\/50{border-color:color-mix(in oklab, var(--color-red) 50%, transparent)}}.border-l-\(--color-amber\){border-left-color:var(--color-amber)}.bg-\(--color-accent\),.bg-\(--color-accent\)\/15{background-color:var(--color-accent)}@supports (color:color-mix(in lab, red, red)){.bg-\(--color-accent\)\/15{background-color:color-mix(in oklab, var(--color-accent) 15%, transparent)}}.bg-\(--color-accent\)\/25{background-color:var(--color-accent)}@supports (color:color-mix(in lab, red, red)){.bg-\(--color-accent\)\/25{background-color:color-mix(in oklab, var(--color-accent) 25%, transparent)}}.bg-\(--color-amber\),.bg-\(--color-amber\)\/10{background-color:var(--color-amber)}@supports (color:color-mix(in lab, red, red)){.bg-\(--color-amber\)\/10{background-color:color-mix(in oklab, var(--color-amber) 10%, transparent)}}.bg-\(--color-amber\)\/15{background-color:var(--color-amber)}@supports (color:color-mix(in lab, red, red)){.bg-\(--color-amber\)\/15{background-color:color-mix(in oklab, var(--color-amber) 15%, transparent)}}.bg-\(--color-bg\){background-color:var(--color-bg)}.bg-\(--color-bg-elevated\){background-color:var(--color-bg-elevated)}.bg-\(--color-blue\),.bg-\(--color-blue\)\/15{background-color:var(--color-blue)}@supports (color:color-mix(in lab, red, red)){.bg-\(--color-blue\)\/15{background-color:color-mix(in oklab, var(--color-blue) 15%, transparent)}}.bg-\(--color-border\){background-color:var(--color-border)}.bg-\(--color-green\),.bg-\(--color-green\)\/15{background-color:var(--color-green)}@supports (color:color-mix(in lab, red, red)){.bg-\(--color-green\)\/15{background-color:color-mix(in oklab, var(--color-green) 15%, transparent)}}.bg-\(--color-red\),.bg-\(--color-red\)\/10{background-color:var(--color-red)}@supports (color:color-mix(in lab, red, red)){.bg-\(--color-red\)\/10{background-color:color-mix(in oklab, var(--color-red) 10%, transparent)}}.bg-\(--color-red\)\/15{background-color:var(--color-red)}@supports (color:color-mix(in lab, red, red)){.bg-\(--color-red\)\/15{background-color:color-mix(in oklab, var(--color-red) 15%, transparent)}}.bg-\(--color-text-faint\){background-color:var(--color-text-faint)}.bg-black\/20{background-color:#0003}@supports (color:color-mix(in lab, red, red)){.bg-black\/20{background-color:color-mix(in oklab, var(--color-black) 20%, transparent)}}.bg-black\/50{background-color:#00000080}@supports (color:color-mix(in lab, red, red)){.bg-black\/50{background-color:color-mix(in oklab, var(--color-black) 50%, transparent)}}.bg-current{background-color:currentColor}.bg-transparent{background-color:#0000}.p-0\.5{padding:calc(var(--spacing) * .5)}.p-1{padding:var(--spacing)}.p-1\.5{padding:calc(var(--spacing) * 1.5)}.p-2{padding:calc(var(--spacing) * 2)}.p-2\.5{padding:calc(var(--spacing) * 2.5)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-5{padding:calc(var(--spacing) * 5)}.p-6{padding:calc(var(--spacing) * 6)}.px-1{padding-inline:var(--spacing)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:var(--spacing)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-6{padding-block:calc(var(--spacing) * 6)}.py-8{padding-block:calc(var(--spacing) * 8)}.pt-1{padding-top:var(--spacing)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pt-24{padding-top:calc(var(--spacing) * 24)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.align-middle{vertical-align:middle}.font-mono{font-family:var(--font-mono)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[9px\]{font-size:9px}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.leading-none{--tw-leading:1;line-height:1}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.break-words{overflow-wrap:break-word}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.text-\(--color-accent\){color:var(--color-accent)}.text-\(--color-accent-fg\){color:var(--color-accent-fg)}.text-\(--color-amber\){color:var(--color-amber)}.text-\(--color-bg\){color:var(--color-bg)}.text-\(--color-blue\){color:var(--color-blue)}.text-\(--color-green\){color:var(--color-green)}.text-\(--color-red\){color:var(--color-red)}.text-\(--color-text\){color:var(--color-text)}.text-\(--color-text-faint\){color:var(--color-text-faint)}.text-\(--color-text-muted\){color:var(--color-text-muted)}.text-white{color:var(--color-white)}.capitalize{text-transform:capitalize}.uppercase{text-transform:uppercase}.opacity-60{opacity:.6}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a), 0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring-2{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring-\(--color-amber\){--tw-ring-color:var(--color-amber)}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}.ring-inset{--tw-ring-inset:inset}@media (hover:hover){.hover\:bg-\(--color-bg-hover\):hover{background-color:var(--color-bg-hover)}.hover\:bg-\(--color-red\)\/10:hover{background-color:var(--color-red)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-\(--color-red\)\/10:hover{background-color:color-mix(in oklab, var(--color-red) 10%, transparent)}}.hover\:text-\(--color-red\):hover{color:var(--color-red)}.hover\:text-\(--color-text\):hover{color:var(--color-text)}.hover\:text-\(--color-text-muted\):hover{color:var(--color-text-muted)}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-90:hover{opacity:.9}}.focus\:border-\(--color-accent\):focus{border-color:var(--color-accent)}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-30:disabled{opacity:.3}.disabled\:opacity-40:disabled{opacity:.4}}:root{--color-bg:#0b0d10;--color-bg-elevated:#14171c;--color-bg-hover:#1b1f26;--color-border:#262b33;--color-text:#e6e9ef;--color-text-muted:#8b93a1;--color-text-faint:#5a616e;--color-accent:#6c8cff;--color-accent-fg:#0b0d10;--color-amber:#f0b429;--color-red:#f2545b;--color-green:#3fb950;--color-blue:#58a6ff}:root.light{--color-bg:#f6f7f9;--color-bg-elevated:#fff;--color-bg-hover:#eef0f3;--color-border:#dde1e7;--color-text:#14171c;--color-text-muted:#565e6b;--color-text-faint:#8b93a1;--color-accent:#3358e0;--color-accent-fg:#fff;--color-amber:#b3760a;--color-red:#c8323a;--color-green:#22863a;--color-blue:#0969da}*{box-sizing:border-box}html,body,#root{height:100%}body{background:var(--color-bg);color:var(--color-text);-webkit-font-smoothing:antialiased;margin:0;font-family:Inter,ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,sans-serif;font-size:14px;overflow:hidden}code,pre,.font-mono{font-family:ui-monospace,SF Mono,Menlo,Consolas,Liberation Mono,monospace}::-webkit-scrollbar{width:10px;height:10px}::-webkit-scrollbar-thumb{background:var(--color-border);border-radius:8px}::-webkit-scrollbar-track{background:0 0}.markdown-body p{margin:0 0 .5em}.markdown-body p:last-child{margin-bottom:0}.markdown-body pre{background:var(--color-bg);border:1px solid var(--color-border);border-radius:6px;padding:.6em .8em;overflow-x:auto}.markdown-body code{background:var(--color-bg);border-radius:4px;padding:.1em .3em}.markdown-body pre code{background:0 0;padding:0}.markdown-body a{color:var(--color-blue)}.markdown-body ul,.markdown-body ol{margin:0 0 .5em;padding-left:1.4em}.markdown-body h1,.markdown-body h2,.markdown-body h3{margin:.6em 0 .3em;font-weight:600}.markdown-body blockquote{border-left:3px solid var(--color-border);color:var(--color-text-muted);margin:.5em 0;padding-left:.8em}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@keyframes ping{75%,to{opacity:0;transform:scale(2)}}@keyframes pulse{50%{opacity:.5}}
@@ -4,8 +4,8 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>ant-bot</title>
7
- <script type="module" crossorigin src="/assets/index-BBZbK10k.js"></script>
8
- <link rel="stylesheet" crossorigin href="/assets/index-BKrFsCQD.css">
7
+ <script type="module" crossorigin src="/assets/index-DD-wEGT9.js"></script>
8
+ <link rel="stylesheet" crossorigin href="/assets/index-e3_GBdXi.css">
9
9
  </head>
10
10
  <body>
11
11
  <div id="root"></div>
@@ -1,2 +0,0 @@
1
- /*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
2
- @layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-space-y-reverse:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid}}}@layer theme{:root,:host{--font-sans:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-sm:24rem;--container-md:28rem;--container-lg:32rem;--container-xl:36rem;--container-3xl:48rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height:calc(1.5 / 1);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--font-weight-medium:500;--font-weight-semibold:600;--tracking-wide:.025em;--radius-md:.375rem;--radius-lg:.5rem;--animate-ping:ping 1s cubic-bezier(0, 0, .2, 1) infinite;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring:where(:not(iframe)){outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.invisible{visibility:hidden}.visible{visibility:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.inset-0{inset:0}.right-4{right:calc(var(--spacing) * 4)}.bottom-24{bottom:calc(var(--spacing) * 24)}.z-50{z-index:50}.container{width:100%}@media (width>=40rem){.container{max-width:40rem}}@media (width>=48rem){.container{max-width:48rem}}@media (width>=64rem){.container{max-width:64rem}}@media (width>=80rem){.container{max-width:80rem}}@media (width>=96rem){.container{max-width:96rem}}.mx-auto{margin-inline:auto}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:var(--spacing)}.mt-1\.5{margin-top:calc(var(--spacing) * 1.5)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mb-0\.5{margin-bottom:calc(var(--spacing) * .5)}.mb-1{margin-bottom:var(--spacing)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.mb-6{margin-bottom:calc(var(--spacing) * 6)}.ml-0\.5{margin-left:calc(var(--spacing) * .5)}.ml-1{margin-left:var(--spacing)}.ml-1\.5{margin-left:calc(var(--spacing) * 1.5)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-auto{margin-left:auto}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.h-1\.5{height:calc(var(--spacing) * 1.5)}.h-2{height:calc(var(--spacing) * 2)}.h-12{height:calc(var(--spacing) * 12)}.h-40{height:calc(var(--spacing) * 40)}.h-dvh{height:100dvh}.h-full{height:100%}.max-h-40{max-height:calc(var(--spacing) * 40)}.max-h-48{max-height:calc(var(--spacing) * 48)}.max-h-64{max-height:calc(var(--spacing) * 64)}.max-h-96{max-height:calc(var(--spacing) * 96)}.max-h-full{max-height:100%}.min-h-0{min-height:0}.min-h-\[38px\]{min-height:38px}.w-1\.5{width:calc(var(--spacing) * 1.5)}.w-2{width:calc(var(--spacing) * 2)}.w-3{width:calc(var(--spacing) * 3)}.w-12{width:calc(var(--spacing) * 12)}.w-20{width:calc(var(--spacing) * 20)}.w-32{width:calc(var(--spacing) * 32)}.w-40{width:calc(var(--spacing) * 40)}.w-48{width:calc(var(--spacing) * 48)}.w-64{width:calc(var(--spacing) * 64)}.w-72{width:calc(var(--spacing) * 72)}.w-80{width:calc(var(--spacing) * 80)}.w-96{width:calc(var(--spacing) * 96)}.w-full{width:100%}.max-w-3xl{max-width:var(--container-3xl)}.max-w-\[75\%\]{max-width:75%}.max-w-full{max-width:100%}.max-w-lg{max-width:var(--container-lg)}.max-w-md{max-width:var(--container-md)}.max-w-sm{max-width:var(--container-sm)}.max-w-xl{max-width:var(--container-xl)}.min-w-0{min-width:0}.flex-1{flex:1}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.rotate-0{rotate:0deg}.animate-ping{animation:var(--animate-ping)}.animate-pulse{animation:var(--animate-pulse)}.cursor-crosshair{cursor:crosshair}.cursor-pointer{cursor:pointer}.resize-none{resize:none}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}.grid-cols-10{grid-template-columns:repeat(10,minmax(0,1fr))}.grid-cols-\[160px_1fr\]{grid-template-columns:160px 1fr}.flex-col{flex-direction:column}.flex-row-reverse{flex-direction:row-reverse}.flex-wrap{flex-wrap:wrap}.items-baseline{align-items:baseline}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-0\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:var(--spacing)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(var(--spacing) * var(--tw-space-y-reverse));margin-block-end:calc(var(--spacing) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-full{border-radius:2147483647px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-t{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.border{border-style:var(--tw-border-style);border-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-l-4{border-left-style:var(--tw-border-style);border-left-width:4px}.border-\(--color-amber\)\/40{border-color:var(--color-amber)}@supports (color:color-mix(in lab, red, red)){.border-\(--color-amber\)\/40{border-color:color-mix(in oklab, var(--color-amber) 40%, transparent)}}.border-\(--color-amber\)\/50{border-color:var(--color-amber)}@supports (color:color-mix(in lab, red, red)){.border-\(--color-amber\)\/50{border-color:color-mix(in oklab, var(--color-amber) 50%, transparent)}}.border-\(--color-border\){border-color:var(--color-border)}.border-\(--color-red\),.border-\(--color-red\)\/40{border-color:var(--color-red)}@supports (color:color-mix(in lab, red, red)){.border-\(--color-red\)\/40{border-color:color-mix(in oklab, var(--color-red) 40%, transparent)}}.border-\(--color-red\)\/50{border-color:var(--color-red)}@supports (color:color-mix(in lab, red, red)){.border-\(--color-red\)\/50{border-color:color-mix(in oklab, var(--color-red) 50%, transparent)}}.border-l-\(--color-amber\){border-left-color:var(--color-amber)}.bg-\(--color-accent\),.bg-\(--color-accent\)\/15{background-color:var(--color-accent)}@supports (color:color-mix(in lab, red, red)){.bg-\(--color-accent\)\/15{background-color:color-mix(in oklab, var(--color-accent) 15%, transparent)}}.bg-\(--color-accent\)\/25{background-color:var(--color-accent)}@supports (color:color-mix(in lab, red, red)){.bg-\(--color-accent\)\/25{background-color:color-mix(in oklab, var(--color-accent) 25%, transparent)}}.bg-\(--color-amber\),.bg-\(--color-amber\)\/10{background-color:var(--color-amber)}@supports (color:color-mix(in lab, red, red)){.bg-\(--color-amber\)\/10{background-color:color-mix(in oklab, var(--color-amber) 10%, transparent)}}.bg-\(--color-amber\)\/15{background-color:var(--color-amber)}@supports (color:color-mix(in lab, red, red)){.bg-\(--color-amber\)\/15{background-color:color-mix(in oklab, var(--color-amber) 15%, transparent)}}.bg-\(--color-bg\){background-color:var(--color-bg)}.bg-\(--color-bg-elevated\){background-color:var(--color-bg-elevated)}.bg-\(--color-blue\),.bg-\(--color-blue\)\/15{background-color:var(--color-blue)}@supports (color:color-mix(in lab, red, red)){.bg-\(--color-blue\)\/15{background-color:color-mix(in oklab, var(--color-blue) 15%, transparent)}}.bg-\(--color-border\){background-color:var(--color-border)}.bg-\(--color-green\),.bg-\(--color-green\)\/15{background-color:var(--color-green)}@supports (color:color-mix(in lab, red, red)){.bg-\(--color-green\)\/15{background-color:color-mix(in oklab, var(--color-green) 15%, transparent)}}.bg-\(--color-red\),.bg-\(--color-red\)\/10{background-color:var(--color-red)}@supports (color:color-mix(in lab, red, red)){.bg-\(--color-red\)\/10{background-color:color-mix(in oklab, var(--color-red) 10%, transparent)}}.bg-\(--color-red\)\/15{background-color:var(--color-red)}@supports (color:color-mix(in lab, red, red)){.bg-\(--color-red\)\/15{background-color:color-mix(in oklab, var(--color-red) 15%, transparent)}}.bg-\(--color-text-faint\){background-color:var(--color-text-faint)}.bg-black\/20{background-color:#0003}@supports (color:color-mix(in lab, red, red)){.bg-black\/20{background-color:color-mix(in oklab, var(--color-black) 20%, transparent)}}.bg-black\/50{background-color:#00000080}@supports (color:color-mix(in lab, red, red)){.bg-black\/50{background-color:color-mix(in oklab, var(--color-black) 50%, transparent)}}.bg-current{background-color:currentColor}.bg-transparent{background-color:#0000}.p-0\.5{padding:calc(var(--spacing) * .5)}.p-1{padding:var(--spacing)}.p-1\.5{padding:calc(var(--spacing) * 1.5)}.p-2{padding:calc(var(--spacing) * 2)}.p-2\.5{padding:calc(var(--spacing) * 2.5)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-5{padding:calc(var(--spacing) * 5)}.p-6{padding:calc(var(--spacing) * 6)}.px-1{padding-inline:var(--spacing)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:var(--spacing)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-6{padding-block:calc(var(--spacing) * 6)}.py-8{padding-block:calc(var(--spacing) * 8)}.pt-1{padding-top:var(--spacing)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pt-24{padding-top:calc(var(--spacing) * 24)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.align-middle{vertical-align:middle}.font-mono{font-family:var(--font-mono)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[9px\]{font-size:9px}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.leading-none{--tw-leading:1;line-height:1}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.break-words{overflow-wrap:break-word}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.text-\(--color-accent\){color:var(--color-accent)}.text-\(--color-accent-fg\){color:var(--color-accent-fg)}.text-\(--color-amber\){color:var(--color-amber)}.text-\(--color-bg\){color:var(--color-bg)}.text-\(--color-blue\){color:var(--color-blue)}.text-\(--color-green\){color:var(--color-green)}.text-\(--color-red\){color:var(--color-red)}.text-\(--color-text\){color:var(--color-text)}.text-\(--color-text-faint\){color:var(--color-text-faint)}.text-\(--color-text-muted\){color:var(--color-text-muted)}.text-white{color:var(--color-white)}.capitalize{text-transform:capitalize}.uppercase{text-transform:uppercase}.opacity-60{opacity:.6}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a), 0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.outline-2{outline-style:var(--tw-outline-style);outline-width:2px}.outline-\(--color-accent\){outline-color:var(--color-accent)}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}@media (hover:hover){.hover\:bg-\(--color-bg-hover\):hover{background-color:var(--color-bg-hover)}.hover\:bg-\(--color-red\)\/10:hover{background-color:var(--color-red)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-\(--color-red\)\/10:hover{background-color:color-mix(in oklab, var(--color-red) 10%, transparent)}}.hover\:text-\(--color-red\):hover{color:var(--color-red)}.hover\:text-\(--color-text\):hover{color:var(--color-text)}.hover\:text-\(--color-text-muted\):hover{color:var(--color-text-muted)}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-90:hover{opacity:.9}}.focus\:border-\(--color-accent\):focus{border-color:var(--color-accent)}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-30:disabled{opacity:.3}.disabled\:opacity-40:disabled{opacity:.4}}:root{--color-bg:#0b0d10;--color-bg-elevated:#14171c;--color-bg-hover:#1b1f26;--color-border:#262b33;--color-text:#e6e9ef;--color-text-muted:#8b93a1;--color-text-faint:#5a616e;--color-accent:#6c8cff;--color-accent-fg:#0b0d10;--color-amber:#f0b429;--color-red:#f2545b;--color-green:#3fb950;--color-blue:#58a6ff}:root.light{--color-bg:#f6f7f9;--color-bg-elevated:#fff;--color-bg-hover:#eef0f3;--color-border:#dde1e7;--color-text:#14171c;--color-text-muted:#565e6b;--color-text-faint:#8b93a1;--color-accent:#3358e0;--color-accent-fg:#fff;--color-amber:#b3760a;--color-red:#c8323a;--color-green:#22863a;--color-blue:#0969da}*{box-sizing:border-box}html,body,#root{height:100%}body{background:var(--color-bg);color:var(--color-text);-webkit-font-smoothing:antialiased;margin:0;font-family:Inter,ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,sans-serif;font-size:14px;overflow:hidden}code,pre,.font-mono{font-family:ui-monospace,SF Mono,Menlo,Consolas,Liberation Mono,monospace}::-webkit-scrollbar{width:10px;height:10px}::-webkit-scrollbar-thumb{background:var(--color-border);border-radius:8px}::-webkit-scrollbar-track{background:0 0}.markdown-body p{margin:0 0 .5em}.markdown-body p:last-child{margin-bottom:0}.markdown-body pre{background:var(--color-bg);border:1px solid var(--color-border);border-radius:6px;padding:.6em .8em;overflow-x:auto}.markdown-body code{background:var(--color-bg);border-radius:4px;padding:.1em .3em}.markdown-body pre code{background:0 0;padding:0}.markdown-body a{color:var(--color-blue)}.markdown-body ul,.markdown-body ol{margin:0 0 .5em;padding-left:1.4em}.markdown-body h1,.markdown-body h2,.markdown-body h3{margin:.6em 0 .3em;font-weight:600}.markdown-body blockquote{border-left:3px solid var(--color-border);color:var(--color-text-muted);margin:.5em 0;padding-left:.8em}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@keyframes ping{75%,to{opacity:0;transform:scale(2)}}@keyframes pulse{50%{opacity:.5}}