@chibitek/chibi 0.1.176 → 0.1.177

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.
Files changed (66) hide show
  1. package/dist/assets/{abnfDiagram-O67JEVCF-sRKEv3Mr.js → abnfDiagram-O67JEVCF-D66KKLXq.js} +1 -1
  2. package/dist/assets/{arc-BmpSdaQx.js → arc-Chl6g0yq.js} +1 -1
  3. package/dist/assets/{architectureDiagram-NJMV4G6O-D7wISetH.js → architectureDiagram-NJMV4G6O-ChT8017v.js} +1 -1
  4. package/dist/assets/{blockDiagram-BEXU5L5S-DNgLsg2M.js → blockDiagram-BEXU5L5S-DSOAtPXh.js} +1 -1
  5. package/dist/assets/{c4Diagram-YGBWAQC7-Bx9bZh8W.js → c4Diagram-YGBWAQC7-CAyzcis4.js} +1 -1
  6. package/dist/assets/channel-DGEfaLnD.js +1 -0
  7. package/dist/assets/{chunk-2Q5K7J3B-D3fVaZ4m.js → chunk-2Q5K7J3B-DG7zWvl1.js} +1 -1
  8. package/dist/assets/{chunk-3FUC2YCW-CwGz6Ha8.js → chunk-3FUC2YCW-CNQ37WCV.js} +2 -2
  9. package/dist/assets/{chunk-5VM5RSS4-B6OEecjg.js → chunk-5VM5RSS4-Dvv3U9Ci.js} +1 -1
  10. package/dist/assets/{chunk-GTNCS2PH-BQcidIif.js → chunk-GTNCS2PH-DyQrY0Ij.js} +1 -1
  11. package/dist/assets/{chunk-GWA4HPMP-k9aUZSoo.js → chunk-GWA4HPMP-BLgrTe-Y.js} +1 -1
  12. package/dist/assets/{chunk-JWPE2WC7-h3JmRvjC.js → chunk-JWPE2WC7-Bi7RU6mT.js} +1 -1
  13. package/dist/assets/{chunk-NETBCI7D-neWbjUzw.js → chunk-NETBCI7D-bBBVBfAd.js} +1 -1
  14. package/dist/assets/{chunk-WEXAMYUT-5CvO78xu.js → chunk-WEXAMYUT-CE_h60fU.js} +1 -1
  15. package/dist/assets/{chunk-XXDRQBXY-WB5mOypF.js → chunk-XXDRQBXY-f6P9rCRq.js} +1 -1
  16. package/dist/assets/{classDiagram-v2-NBCMYWYE-BTPH5g_T.js → classDiagram-v2-NBCMYWYE-6Uq3JzmJ.js} +1 -1
  17. package/dist/assets/{cose-bilkent-JH36ORCC-D3vHHTSV.js → cose-bilkent-JH36ORCC-BxvkL31E.js} +1 -1
  18. package/dist/assets/{cynefin-OW5HDTMX-DgqNPGWZ.js → cynefin-OW5HDTMX-Dlcwlw2F.js} +1 -1
  19. package/dist/assets/{cynefinDiagram-VND7K2PF-R5Tq_pW2.js → cynefinDiagram-VND7K2PF-D3NOeWUy.js} +1 -1
  20. package/dist/assets/{dagre-6A5THRUB-CxOlFmnC.js → dagre-6A5THRUB-IGmT7nsP.js} +1 -1
  21. package/dist/assets/{diagram-22UHCM2B-CR0cl7m3.js → diagram-22UHCM2B-D0K8tG3k.js} +1 -1
  22. package/dist/assets/{diagram-3UASUU5V-CbKL4FKO.js → diagram-3UASUU5V-CSkDkOvw.js} +1 -1
  23. package/dist/assets/{diagram-ATOU4E4O-CrJLqyZe.js → diagram-ATOU4E4O-CX5EXBJ_.js} +1 -1
  24. package/dist/assets/{diagram-CDSNMT55-B9Yv89qV.js → diagram-CDSNMT55-D0FQ7x1J.js} +1 -1
  25. package/dist/assets/{diagram-MLGK6HIB-DmiwzM_2.js → diagram-MLGK6HIB-BymN_w7h.js} +1 -1
  26. package/dist/assets/{diagram-MPIPVDR6-CcOb0oW2.js → diagram-MPIPVDR6-ugKqp8yy.js} +1 -1
  27. package/dist/assets/{ebnfDiagram-ZINNZB2B-CBPLHI7_.js → ebnfDiagram-ZINNZB2B-DROFb0r3.js} +1 -1
  28. package/dist/assets/{elk-276RUBZZ-6FqNvi_J.js → elk-276RUBZZ-CNVCU2l7.js} +1 -1
  29. package/dist/assets/{erDiagram-OPXOYQCR-DMzFBP5h.js → erDiagram-OPXOYQCR-BQj5bZ7y.js} +1 -1
  30. package/dist/assets/{flowDiagram-KWPJA3E3-DPy8GVYu.js → flowDiagram-KWPJA3E3-C3cBXKRL.js} +1 -1
  31. package/dist/assets/{ganttDiagram-FUAMR5RP-BQd_gAGi.js → ganttDiagram-FUAMR5RP-CdNdC_Vp.js} +1 -1
  32. package/dist/assets/{gitGraphDiagram-X574FWY7-DJfl14ff.js → gitGraphDiagram-X574FWY7-v_LM9fGO.js} +1 -1
  33. package/dist/assets/{index-CiUkZ0_j.js → index-UICHeO5x.js} +4 -4
  34. package/dist/assets/{index-BgeuRd0K.js → index-fnHp_1ly.js} +1 -1
  35. package/dist/assets/{infoDiagram-VRGFBTTK-BV8yVtja.js → infoDiagram-VRGFBTTK-0fzWO21Z.js} +1 -1
  36. package/dist/assets/{ishikawaDiagram-OU5B5YK6-DyDmA3-6.js → ishikawaDiagram-OU5B5YK6-BmqyKWCK.js} +1 -1
  37. package/dist/assets/{journeyDiagram-ZHPQQLJL-Bm31t8C8.js → journeyDiagram-ZHPQQLJL-BSihTjOI.js} +1 -1
  38. package/dist/assets/{kanban-definition-PNTS6WVX-DJHtOiRR.js → kanban-definition-PNTS6WVX-LAP03jiI.js} +1 -1
  39. package/dist/assets/{linear-CfkoYheD.js → linear-BoSfZT4X.js} +1 -1
  40. package/dist/assets/{mermaid.core-BjvwttN3.js → mermaid.core-KciMRs_R.js} +5 -5
  41. package/dist/assets/{mindmap-definition-NLK3R4M7-9Qb6NZdz.js → mindmap-definition-NLK3R4M7-CEGLBEfc.js} +1 -1
  42. package/dist/assets/{pegDiagram-GJSIUBJH-CkmUVrtf.js → pegDiagram-GJSIUBJH-DLwMHvoR.js} +1 -1
  43. package/dist/assets/{pieDiagram-5QR66LMP-DslnXTwg.js → pieDiagram-5QR66LMP-DHnlu96s.js} +1 -1
  44. package/dist/assets/{quadrantDiagram-O4NWA36T-ezbFZDsw.js → quadrantDiagram-O4NWA36T-C_aIseXA.js} +1 -1
  45. package/dist/assets/{railroadDiagram-XR7U4H2S-D4BEU9x6.js → railroadDiagram-XR7U4H2S-DOXDQ14n.js} +1 -1
  46. package/dist/assets/{requirementDiagram-PLB6GJNP-BbzX7pvK.js → requirementDiagram-PLB6GJNP-C49u1hle.js} +1 -1
  47. package/dist/assets/{sankeyDiagram-IPEJSGJF-3CkqEiXd.js → sankeyDiagram-IPEJSGJF-TO8i3aYk.js} +1 -1
  48. package/dist/assets/{sequenceDiagram-PO4LG4MO-CgCGVT2m.js → sequenceDiagram-PO4LG4MO-CqByM3om.js} +1 -1
  49. package/dist/assets/{sizeCapture-INFHLROL-3WvzT1S8.js → sizeCapture-INFHLROL-BVsTiKjg.js} +1 -1
  50. package/dist/assets/{stateDiagram-v2-GCMORJYK-DJLDdpcK.js → stateDiagram-v2-GCMORJYK-0AUlHnV-.js} +1 -1
  51. package/dist/assets/{swimlanes-2SLR337P-D91mFQnO.js → swimlanes-2SLR337P-D_wUrvq4.js} +1 -1
  52. package/dist/assets/swimlanesDiagram-TC7HE7FX-HihkzjzX.js +8 -0
  53. package/dist/assets/{timeline-definition-EJHVYXUP-BjIDeT1V.js → timeline-definition-EJHVYXUP-qf2wxQef.js} +1 -1
  54. package/dist/assets/{usecaseDiagram-POWQR4AR-B0Ai3gPB.js → usecaseDiagram-POWQR4AR-Blqc8FjE.js} +1 -1
  55. package/dist/assets/{vennDiagram-UO4OBE2U-CwfOPn1H.js → vennDiagram-UO4OBE2U-Df3HJl0f.js} +1 -1
  56. package/dist/assets/{wardleyDiagram-VNRHLVJA-Dpw6_U0p.js → wardleyDiagram-VNRHLVJA-B-QhMirM.js} +1 -1
  57. package/dist/assets/{xychartDiagram-PMCCYNJV-DqXC0ReF.js → xychartDiagram-PMCCYNJV-DsZdyUlm.js} +1 -1
  58. package/dist/index.html +1 -1
  59. package/dist-server/index.js +29 -14
  60. package/dist-server/server/attachment-mimes.js +31 -7
  61. package/dist-server/server/attachments.js +16 -20
  62. package/dist-server/server/harness-import/history.js +1 -1
  63. package/dist-server/src/lib/composer-attachments.js +5 -6
  64. package/package.json +1 -1
  65. package/dist/assets/channel-hUu8lOok.js +0 -1
  66. package/dist/assets/swimlanesDiagram-TC7HE7FX--A9LvTBi.js +0 -8
@@ -83,11 +83,11 @@ Mochii`,"dictation.apps.title":"Застосунки","dictation.apps.subtitle":
83
83
 
84
84
  `)}x.write("payload.value = newResult;"),x.write("return payload;");const C=x.compile();return(j,M)=>C(b,j,M)};let s;const r=Gh,c=!J4.jitless,p=c&&_te.value,h=t.catchall;let g;e._zod.parse=(b,x)=>{g??(g=o.value);const v=b.value;return r(v)?c&&p&&x?.async===!1&&x.jitless!==!0?(s||(s=i(t.shape)),b=s(b,x),h?rD([],v,b,x,g,e):b):a(b,x):(b.issues.push({expected:"object",code:"invalid_type",input:v,inst:e}),b)}});function p7(e,t,a,o){for(const s of e)if(s.issues.length===0)return t.value=s.value,t;const i=e.filter(s=>!ku(s));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:a,errors:e.map(s=>s.issues.map(r=>td(r,o,ed())))}),t)}const lD=Ze("$ZodUnion",(e,t)=>{ma.init(e,t),Pn(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),Pn(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),Pn(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),Pn(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>Z4(i.source)).join("|")})$`)}});const a=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(o,i)=>{if(a)return a(o,i);let s=!1;const r=[];for(const c of t.options){const d=c._zod.run({value:o.value,issues:[]},i);if(d instanceof Promise)r.push(d),s=!0;else{if(d.issues.length===0)return d;r.push(d)}}return s?Promise.all(r).then(c=>p7(c,o,e,i)):p7(r,o,e,i)}}),Iae=Ze("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,lD.init(e,t);const a=e._zod.parse;Pn(e._zod,"propValues",()=>{const i={};for(const s of t.options){const r=s._zod.propValues;if(!r||Object.keys(r).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(const[c,d]of Object.entries(r)){i[c]||(i[c]=new Set);for(const p of d)i[c].add(p)}}return i});const o=b0(()=>{const i=t.options,s=new Map;for(const r of i){const c=r._zod.propValues?.[t.discriminator];if(!c||c.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(const d of c){if(s.has(d))throw new Error(`Duplicate discriminator value "${String(d)}"`);s.set(d,r)}}return s});e._zod.parse=(i,s)=>{const r=i.value;if(!Gh(r))return i.issues.push({code:"invalid_type",expected:"object",input:r,inst:e}),i;const c=o.value.get(r?.[t.discriminator]);return c?c._zod.run(i,s):t.unionFallback||s.direction==="backward"?a(i,s):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(o.value.keys()),input:r,path:[t.discriminator],inst:e}),i)}}),Pae=Ze("$ZodIntersection",(e,t)=>{ma.init(e,t),e._zod.parse=(a,o)=>{const i=a.value,s=t.left._zod.run({value:i,issues:[]},o),r=t.right._zod.run({value:i,issues:[]},o);return s instanceof Promise||r instanceof Promise?Promise.all([s,r]).then(([d,p])=>m7(a,d,p)):m7(a,s,r)}});function Y2(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if($h(e)&&$h(t)){const a=Object.keys(t),o=Object.keys(e).filter(s=>a.indexOf(s)!==-1),i={...e,...t};for(const s of o){const r=Y2(e[s],t[s]);if(!r.valid)return{valid:!1,mergeErrorPath:[s,...r.mergeErrorPath]};i[s]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const a=[];for(let o=0;o<e.length;o++){const i=e[o],s=t[o],r=Y2(i,s);if(!r.valid)return{valid:!1,mergeErrorPath:[o,...r.mergeErrorPath]};a.push(r.data)}return{valid:!0,data:a}}return{valid:!1,mergeErrorPath:[]}}function m7(e,t,a){const o=new Map;let i;for(const c of t.issues)if(c.code==="unrecognized_keys"){i??(i=c);for(const d of c.keys)o.has(d)||o.set(d,{}),o.get(d).l=!0}else e.issues.push(c);for(const c of a.issues)if(c.code==="unrecognized_keys")for(const d of c.keys)o.has(d)||o.set(d,{}),o.get(d).r=!0;else e.issues.push(c);const s=[...o].filter(([,c])=>c.l&&c.r).map(([c])=>c);if(s.length&&i&&e.issues.push({...i,keys:s}),ku(e))return e;const r=Y2(t.value,a.value);if(!r.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(r.mergeErrorPath)}`);return e.value=r.data,e}const Tae=Ze("$ZodEnum",(e,t)=>{ma.init(e,t);const a=GR(t.entries),o=new Set(a);e._zod.values=o,e._zod.pattern=new RegExp(`^(${a.filter(i=>qte.has(typeof i)).map(i=>typeof i=="string"?Gu(i):i.toString()).join("|")})$`),e._zod.parse=(i,s)=>{const r=i.value;return o.has(r)||i.issues.push({code:"invalid_value",values:a,input:r,inst:e}),i}}),Bae=Ze("$ZodLiteral",(e,t)=>{if(ma.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const a=new Set(t.values);e._zod.values=a,e._zod.pattern=new RegExp(`^(${t.values.map(o=>typeof o=="string"?Gu(o):o?Gu(o.toString()):String(o)).join("|")})$`),e._zod.parse=(o,i)=>{const s=o.value;return a.has(s)||o.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),o}}),Eae=Ze("$ZodTransform",(e,t)=>{ma.init(e,t),e._zod.optin="optional",e._zod.parse=(a,o)=>{if(o.direction==="backward")throw new HR(e.constructor.name);const i=t.transform(a.value,a);if(o.async)return(i instanceof Promise?i:Promise.resolve(i)).then(r=>(a.value=r,a.fallback=!0,a));if(i instanceof Promise)throw new Bu;return a.value=i,a.fallback=!0,a}});function h7(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}const cD=Ze("$ZodOptional",(e,t)=>{ma.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Pn(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Pn(e._zod,"pattern",()=>{const a=t.innerType._zod.pattern;return a?new RegExp(`^(${Z4(a.source)})?$`):void 0}),e._zod.parse=(a,o)=>{if(t.innerType._zod.optin==="optional"){const i=a.value,s=t.innerType._zod.run(a,o);return s instanceof Promise?s.then(r=>h7(r,i)):h7(s,i)}return a.value===void 0?a:t.innerType._zod.run(a,o)}}),Rae=Ze("$ZodExactOptional",(e,t)=>{cD.init(e,t),Pn(e._zod,"values",()=>t.innerType._zod.values),Pn(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(a,o)=>t.innerType._zod.run(a,o)}),Dae=Ze("$ZodNullable",(e,t)=>{ma.init(e,t),Pn(e._zod,"optin",()=>t.innerType._zod.optin),Pn(e._zod,"optout",()=>t.innerType._zod.optout),Pn(e._zod,"pattern",()=>{const a=t.innerType._zod.pattern;return a?new RegExp(`^(${Z4(a.source)}|null)$`):void 0}),Pn(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(a,o)=>a.value===null?a:t.innerType._zod.run(a,o)}),Oae=Ze("$ZodDefault",(e,t)=>{ma.init(e,t),e._zod.optin="optional",Pn(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(a,o)=>{if(o.direction==="backward")return t.innerType._zod.run(a,o);if(a.value===void 0)return a.value=t.defaultValue,a;const i=t.innerType._zod.run(a,o);return i instanceof Promise?i.then(s=>g7(s,t)):g7(i,t)}});function g7(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const zae=Ze("$ZodPrefault",(e,t)=>{ma.init(e,t),e._zod.optin="optional",Pn(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(a,o)=>(o.direction==="backward"||a.value===void 0&&(a.value=t.defaultValue),t.innerType._zod.run(a,o))}),Lae=Ze("$ZodNonOptional",(e,t)=>{ma.init(e,t),Pn(e._zod,"values",()=>{const a=t.innerType._zod.values;return a?new Set([...a].filter(o=>o!==void 0)):void 0}),e._zod.parse=(a,o)=>{const i=t.innerType._zod.run(a,o);return i instanceof Promise?i.then(s=>f7(s,e)):f7(i,e)}});function f7(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const Fae=Ze("$ZodCatch",(e,t)=>{ma.init(e,t),e._zod.optin="optional",Pn(e._zod,"optout",()=>t.innerType._zod.optout),Pn(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(a,o)=>{if(o.direction==="backward")return t.innerType._zod.run(a,o);const i=t.innerType._zod.run(a,o);return i instanceof Promise?i.then(s=>(a.value=s.value,s.issues.length&&(a.value=t.catchValue({...a,error:{issues:s.issues.map(r=>td(r,o,ed()))},input:a.value}),a.issues=[],a.fallback=!0),a)):(a.value=i.value,i.issues.length&&(a.value=t.catchValue({...a,error:{issues:i.issues.map(s=>td(s,o,ed()))},input:a.value}),a.issues=[],a.fallback=!0),a)}}),_ae=Ze("$ZodPipe",(e,t)=>{ma.init(e,t),Pn(e._zod,"values",()=>t.in._zod.values),Pn(e._zod,"optin",()=>t.in._zod.optin),Pn(e._zod,"optout",()=>t.out._zod.optout),Pn(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(a,o)=>{if(o.direction==="backward"){const s=t.out._zod.run(a,o);return s instanceof Promise?s.then(r=>pb(r,t.in,o)):pb(s,t.in,o)}const i=t.in._zod.run(a,o);return i instanceof Promise?i.then(s=>pb(s,t.out,o)):pb(i,t.out,o)}});function pb(e,t,a){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},a)}const qae=Ze("$ZodReadonly",(e,t)=>{ma.init(e,t),Pn(e._zod,"propValues",()=>t.innerType._zod.propValues),Pn(e._zod,"values",()=>t.innerType._zod.values),Pn(e._zod,"optin",()=>t.innerType?._zod?.optin),Pn(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(a,o)=>{if(o.direction==="backward")return t.innerType._zod.run(a,o);const i=t.innerType._zod.run(a,o);return i instanceof Promise?i.then(b7):b7(i)}});function b7(e){return e.value=Object.freeze(e.value),e}const Uae=Ze("$ZodCustom",(e,t)=>{Qo.init(e,t),ma.init(e,t),e._zod.parse=(a,o)=>a,e._zod.check=a=>{const o=a.value,i=t.fn(o);if(i instanceof Promise)return i.then(s=>y7(s,a,o,e));y7(i,a,o,e)}});function y7(e,t,a,o){if(!e){const i={code:"custom",input:a,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(i.params=o._zod.def.params),t.issues.push(Kh(i))}}var x7;class Vae{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...a){const o=a[0];return this._map.set(t,o),o&&typeof o=="object"&&"id"in o&&this._idmap.set(o.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const a=this._map.get(t);return a&&typeof a=="object"&&"id"in a&&this._idmap.delete(a.id),this._map.delete(t),this}get(t){const a=t._zod.parent;if(a){const o={...this.get(a)??{}};delete o.id;const i={...o,...this._map.get(t)};return Object.keys(i).length?i:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function Hae(){return new Vae}(x7=globalThis).__zod_globalRegistry??(x7.__zod_globalRegistry=Hae());const Ym=globalThis.__zod_globalRegistry;function Gae(e,t){return new e({type:"string",...Et(t)})}function $ae(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Et(t)})}function v7(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Et(t)})}function Kae(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Et(t)})}function Wae(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Et(t)})}function Jae(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Et(t)})}function Yae(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Et(t)})}function Zae(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Et(t)})}function Qae(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Et(t)})}function Xae(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Et(t)})}function eoe(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Et(t)})}function toe(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Et(t)})}function noe(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Et(t)})}function aoe(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Et(t)})}function ooe(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Et(t)})}function ioe(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Et(t)})}function soe(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Et(t)})}function roe(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Et(t)})}function loe(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Et(t)})}function coe(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Et(t)})}function doe(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Et(t)})}function uoe(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Et(t)})}function poe(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Et(t)})}function moe(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Et(t)})}function hoe(e,t){return new e({type:"string",format:"date",check:"string_format",...Et(t)})}function goe(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Et(t)})}function foe(e,t){return new e({type:"string",format:"duration",check:"string_format",...Et(t)})}function boe(e,t){return new e({type:"number",checks:[],...Et(t)})}function yoe(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Et(t)})}function xoe(e,t){return new e({type:"boolean",...Et(t)})}function voe(e){return new e({type:"unknown"})}function koe(e,t){return new e({type:"never",...Et(t)})}function k7(e,t){return new nD({check:"less_than",...Et(t),value:e,inclusive:!1})}function _k(e,t){return new nD({check:"less_than",...Et(t),value:e,inclusive:!0})}function w7(e,t){return new aD({check:"greater_than",...Et(t),value:e,inclusive:!1})}function qk(e,t){return new aD({check:"greater_than",...Et(t),value:e,inclusive:!0})}function S7(e,t){return new zne({check:"multiple_of",...Et(t),value:e})}function dD(e,t){return new Fne({check:"max_length",...Et(t),maximum:e})}function Xy(e,t){return new _ne({check:"min_length",...Et(t),minimum:e})}function uD(e,t){return new qne({check:"length_equals",...Et(t),length:e})}function woe(e,t){return new Une({check:"string_format",format:"regex",...Et(t),pattern:e})}function Soe(e){return new Vne({check:"string_format",format:"lowercase",...Et(e)})}function Coe(e){return new Hne({check:"string_format",format:"uppercase",...Et(e)})}function joe(e,t){return new Gne({check:"string_format",format:"includes",...Et(t),includes:e})}function Noe(e,t){return new $ne({check:"string_format",format:"starts_with",...Et(t),prefix:e})}function Aoe(e,t){return new Kne({check:"string_format",format:"ends_with",...Et(t),suffix:e})}function pp(e){return new Wne({check:"overwrite",tx:e})}function Moe(e){return pp(t=>t.normalize(e))}function Ioe(){return pp(e=>e.trim())}function Poe(){return pp(e=>e.toLowerCase())}function Toe(){return pp(e=>e.toUpperCase())}function Boe(){return pp(e=>Fte(e))}function Eoe(e,t,a){return new e({type:"array",element:t,...Et(a)})}function Roe(e,t,a){return new e({type:"custom",check:"custom",fn:t,...Et(a)})}function Doe(e,t){const a=Ooe(o=>(o.addIssue=i=>{if(typeof i=="string")o.issues.push(Kh(i,o.value,a._zod.def));else{const s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=o.value),s.inst??(s.inst=a),s.continue??(s.continue=!a._zod.def.abort),o.issues.push(Kh(s))}},e(o.value,o)),t);return a}function Ooe(e,t){const a=new Qo({check:"custom",...Et(t)});return a._zod.check=e,a}function pD(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??Ym,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 fo(e,t,a={path:[],schemaPath:[]}){var o;const i=e._zod.def,s=t.seen.get(e);if(s)return s.count++,a.schemaPath.includes(e)&&(s.cycle=a.path),s.schema;const r={schema:{},count:1,cycle:void 0,path:a.path};t.seen.set(e,r);const c=e._zod.toJSONSchema?.();if(c)r.schema=c;else{const h={...a,schemaPath:[...a.schemaPath,e],path:a.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,r.schema,h);else{const b=r.schema,x=t.processors[i.type];if(!x)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);x(e,t,b,h)}const g=e._zod.parent;g&&(r.ref||(r.ref=g),fo(g,t,h),t.seen.get(g).isParent=!0)}const d=t.metadataRegistry.get(e);return d&&Object.assign(r.schema,d),t.io==="input"&&Mo(e)&&(delete r.schema.examples,delete r.schema.default),t.io==="input"&&"_prefault"in r.schema&&((o=r.schema).default??(o.default=r.schema._prefault)),delete r.schema._prefault,t.seen.get(e).schema}function mD(e,t){const a=e.seen.get(t);if(!a)throw new Error("Unprocessed schema. This is a bug in Zod.");const o=new Map;for(const r of e.seen.entries()){const c=e.metadataRegistry.get(r[0])?.id;if(c){const d=o.get(c);if(d&&d!==r[0])throw new Error(`Duplicate schema id "${c}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(c,r[0])}}const i=r=>{const c=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const g=e.external.registry.get(r[0])?.id,b=e.external.uri??(v=>v);if(g)return{ref:b(g)};const x=r[1].defId??r[1].schema.id??`schema${e.counter++}`;return r[1].defId=x,{defId:x,ref:`${b("__shared")}#/${c}/${x}`}}if(r[1]===a)return{ref:"#"};const p=`#/${c}/`,h=r[1].schema.id??`__schema${e.counter++}`;return{defId:h,ref:p+h}},s=r=>{if(r[1].schema.$ref)return;const c=r[1],{ref:d,defId:p}=i(r);c.def={...c.schema},p&&(c.defId=p);const h=c.schema;for(const g in h)delete h[g];h.$ref=d};if(e.cycles==="throw")for(const r of e.seen.entries()){const c=r[1];if(c.cycle)throw new Error(`Cycle detected: #/${c.cycle?.join("/")}/<root>
85
85
 
86
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const r of e.seen.entries()){const c=r[1];if(t===r[0]){s(r);continue}if(e.external){const p=e.external.registry.get(r[0])?.id;if(t!==r[0]&&p){s(r);continue}}if(e.metadataRegistry.get(r[0])?.id){s(r);continue}if(c.cycle){s(r);continue}if(c.count>1&&e.reused==="ref"){s(r);continue}}}function hD(e,t){const a=e.seen.get(t);if(!a)throw new Error("Unprocessed schema. This is a bug in Zod.");const o=c=>{const d=e.seen.get(c);if(d.ref===null)return;const p=d.def??d.schema,h={...p},g=d.ref;if(d.ref=null,g){o(g);const x=e.seen.get(g),v=x.schema;if(v.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(p.allOf=p.allOf??[],p.allOf.push(v)):Object.assign(p,v),Object.assign(p,h),c._zod.parent===g)for(const S in p)S==="$ref"||S==="allOf"||S in h||delete p[S];if(v.$ref&&x.def)for(const S in p)S==="$ref"||S==="allOf"||S in x.def&&JSON.stringify(p[S])===JSON.stringify(x.def[S])&&delete p[S]}const b=c._zod.parent;if(b&&b!==g){o(b);const x=e.seen.get(b);if(x?.schema.$ref&&(p.$ref=x.schema.$ref,x.def))for(const v in p)v==="$ref"||v==="allOf"||v in x.def&&JSON.stringify(p[v])===JSON.stringify(x.def[v])&&delete p[v]}e.override({zodSchema:c,jsonSchema:p,path:d.path??[]})};for(const c of[...e.seen.entries()].reverse())o(c[0]);const 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){const c=e.external.registry.get(t)?.id;if(!c)throw new Error("Schema is missing an `id` property");i.$id=e.external.uri(c)}Object.assign(i,a.def??a.schema);const s=e.metadataRegistry.get(t)?.id;s!==void 0&&i.id===s&&delete i.id;const r=e.external?.defs??{};for(const c of e.seen.entries()){const d=c[1];d.def&&d.defId&&(d.def.id===d.defId&&delete d.def.id,r[d.defId]=d.def)}e.external||Object.keys(r).length>0&&(e.target==="draft-2020-12"?i.$defs=r:i.definitions=r);try{const c=JSON.parse(JSON.stringify(i));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input:ex(t,"input",e.processors),output:ex(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch{throw new Error("Error converting schema to JSON.")}}function Mo(e,t){const a=t??{seen:new Set};if(a.seen.has(e))return!1;a.seen.add(e);const o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return Mo(o.element,a);if(o.type==="set")return Mo(o.valueType,a);if(o.type==="lazy")return Mo(o.getter(),a);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault")return Mo(o.innerType,a);if(o.type==="intersection")return Mo(o.left,a)||Mo(o.right,a);if(o.type==="record"||o.type==="map")return Mo(o.keyType,a)||Mo(o.valueType,a);if(o.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:Mo(o.in,a)||Mo(o.out,a);if(o.type==="object"){for(const i in o.shape)if(Mo(o.shape[i],a))return!0;return!1}if(o.type==="union"){for(const i of o.options)if(Mo(i,a))return!0;return!1}if(o.type==="tuple"){for(const i of o.items)if(Mo(i,a))return!0;return!!(o.rest&&Mo(o.rest,a))}return!1}const zoe=(e,t={})=>a=>{const o=pD({...a,processors:t});return fo(e,o),mD(o,e),hD(o,e)},ex=(e,t,a={})=>o=>{const{libraryOptions:i,target:s}=o??{},r=pD({...i??{},target:s,io:t,processors:a});return fo(e,r),mD(r,e),hD(r,e)},Loe={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Foe=(e,t,a,o)=>{const i=a;i.type="string";const{minimum:s,maximum:r,format:c,patterns:d,contentEncoding:p}=e._zod.bag;if(typeof s=="number"&&(i.minLength=s),typeof r=="number"&&(i.maxLength=r),c&&(i.format=Loe[c]??c,i.format===""&&delete i.format,c==="time"&&delete i.format),p&&(i.contentEncoding=p),d&&d.size>0){const h=[...d];h.length===1?i.pattern=h[0].source:h.length>1&&(i.allOf=[...h.map(g=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:g.source}))])}},_oe=(e,t,a,o)=>{const i=a,{minimum:s,maximum:r,format:c,multipleOf:d,exclusiveMaximum:p,exclusiveMinimum:h}=e._zod.bag;typeof c=="string"&&c.includes("int")?i.type="integer":i.type="number";const g=typeof h=="number"&&h>=(s??Number.NEGATIVE_INFINITY),b=typeof p=="number"&&p<=(r??Number.POSITIVE_INFINITY),x=t.target==="draft-04"||t.target==="openapi-3.0";g?x?(i.minimum=h,i.exclusiveMinimum=!0):i.exclusiveMinimum=h:typeof s=="number"&&(i.minimum=s),b?x?(i.maximum=p,i.exclusiveMaximum=!0):i.exclusiveMaximum=p:typeof r=="number"&&(i.maximum=r),typeof d=="number"&&(i.multipleOf=d)},qoe=(e,t,a,o)=>{a.type="boolean"},Uoe=(e,t,a,o)=>{a.not={}},Voe=(e,t,a,o)=>{},Hoe=(e,t,a,o)=>{const i=e._zod.def,s=GR(i.entries);s.every(r=>typeof r=="number")&&(a.type="number"),s.every(r=>typeof r=="string")&&(a.type="string"),a.enum=s},Goe=(e,t,a,o)=>{const i=e._zod.def,s=[];for(const r of i.values)if(r===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof r=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(r))}else s.push(r);if(s.length!==0)if(s.length===1){const r=s[0];a.type=r===null?"null":typeof r,t.target==="draft-04"||t.target==="openapi-3.0"?a.enum=[r]:a.const=r}else s.every(r=>typeof r=="number")&&(a.type="number"),s.every(r=>typeof r=="string")&&(a.type="string"),s.every(r=>typeof r=="boolean")&&(a.type="boolean"),s.every(r=>r===null)&&(a.type="null"),a.enum=s},$oe=(e,t,a,o)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Koe=(e,t,a,o)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Woe=(e,t,a,o)=>{const i=a,s=e._zod.def,{minimum:r,maximum:c}=e._zod.bag;typeof r=="number"&&(i.minItems=r),typeof c=="number"&&(i.maxItems=c),i.type="array",i.items=fo(s.element,t,{...o,path:[...o.path,"items"]})},Joe=(e,t,a,o)=>{const i=a,s=e._zod.def;i.type="object",i.properties={};const r=s.shape;for(const p in r)i.properties[p]=fo(r[p],t,{...o,path:[...o.path,"properties",p]});const c=new Set(Object.keys(r)),d=new Set([...c].filter(p=>{const h=s.shape[p]._zod;return t.io==="input"?h.optin===void 0:h.optout===void 0}));d.size>0&&(i.required=Array.from(d)),s.catchall?._zod.def.type==="never"?i.additionalProperties=!1:s.catchall?s.catchall&&(i.additionalProperties=fo(s.catchall,t,{...o,path:[...o.path,"additionalProperties"]})):t.io==="output"&&(i.additionalProperties=!1)},Yoe=(e,t,a,o)=>{const i=e._zod.def,s=i.inclusive===!1,r=i.options.map((c,d)=>fo(c,t,{...o,path:[...o.path,s?"oneOf":"anyOf",d]}));s?a.oneOf=r:a.anyOf=r},Zoe=(e,t,a,o)=>{const i=e._zod.def,s=fo(i.left,t,{...o,path:[...o.path,"allOf",0]}),r=fo(i.right,t,{...o,path:[...o.path,"allOf",1]}),c=p=>"allOf"in p&&Object.keys(p).length===1,d=[...c(s)?s.allOf:[s],...c(r)?r.allOf:[r]];a.allOf=d},Qoe=(e,t,a,o)=>{const i=e._zod.def,s=fo(i.innerType,t,o),r=t.seen.get(e);t.target==="openapi-3.0"?(r.ref=i.innerType,a.nullable=!0):a.anyOf=[s,{type:"null"}]},Xoe=(e,t,a,o)=>{const i=e._zod.def;fo(i.innerType,t,o);const s=t.seen.get(e);s.ref=i.innerType},eie=(e,t,a,o)=>{const i=e._zod.def;fo(i.innerType,t,o);const s=t.seen.get(e);s.ref=i.innerType,a.default=JSON.parse(JSON.stringify(i.defaultValue))},tie=(e,t,a,o)=>{const i=e._zod.def;fo(i.innerType,t,o);const s=t.seen.get(e);s.ref=i.innerType,t.io==="input"&&(a._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},nie=(e,t,a,o)=>{const i=e._zod.def;fo(i.innerType,t,o);const s=t.seen.get(e);s.ref=i.innerType;let r;try{r=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}a.default=r},aie=(e,t,a,o)=>{const i=e._zod.def,s=i.in._zod.traits.has("$ZodTransform"),r=t.io==="input"?s?i.out:i.in:i.out;fo(r,t,o);const c=t.seen.get(e);c.ref=r},oie=(e,t,a,o)=>{const i=e._zod.def;fo(i.innerType,t,o);const s=t.seen.get(e);s.ref=i.innerType,a.readOnly=!0},gD=(e,t,a,o)=>{const i=e._zod.def;fo(i.innerType,t,o);const s=t.seen.get(e);s.ref=i.innerType},iie=Ze("ZodISODateTime",(e,t)=>{lae.init(e,t),ra.init(e,t)});function sie(e){return moe(iie,e)}const rie=Ze("ZodISODate",(e,t)=>{cae.init(e,t),ra.init(e,t)});function lie(e){return hoe(rie,e)}const cie=Ze("ZodISOTime",(e,t)=>{dae.init(e,t),ra.init(e,t)});function die(e){return goe(cie,e)}const uie=Ze("ZodISODuration",(e,t)=>{uae.init(e,t),ra.init(e,t)});function pie(e){return foe(uie,e)}const mie=(e,t)=>{YR.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:a=>Xte(e,a)},flatten:{value:a=>Qte(e,a)},addIssue:{value:a=>{e.issues.push(a),e.message=JSON.stringify(e.issues,J2,2)}},addIssues:{value:a=>{e.issues.push(...a),e.message=JSON.stringify(e.issues,J2,2)}},isEmpty:{get(){return e.issues.length===0}}})},Ki=Ze("ZodError",mie,{Parent:Error}),hie=X4(Ki),gie=eS(Ki),fie=y0(Ki),bie=x0(Ki),yie=nne(Ki),xie=ane(Ki),vie=one(Ki),kie=ine(Ki),wie=sne(Ki),Sie=rne(Ki),Cie=lne(Ki),jie=cne(Ki),C7=new WeakMap;function Cg(e,t,a){const o=Object.getPrototypeOf(e);let i=C7.get(o);if(i||(i=new Set,C7.set(o,i)),!i.has(t)){i.add(t);for(const s in a){const r=a[s];Object.defineProperty(o,s,{configurable:!0,enumerable:!1,get(){const c=r.bind(this);return Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:c}),c},set(c){Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:c})}})}}}const ha=Ze("ZodType",(e,t)=>(ma.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:ex(e,"input"),output:ex(e,"output")}}),e.toJSONSchema=zoe(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(a,o)=>hie(e,a,o,{callee:e.parse}),e.safeParse=(a,o)=>fie(e,a,o),e.parseAsync=async(a,o)=>gie(e,a,o,{callee:e.parseAsync}),e.safeParseAsync=async(a,o)=>bie(e,a,o),e.spa=e.safeParseAsync,e.encode=(a,o)=>yie(e,a,o),e.decode=(a,o)=>xie(e,a,o),e.encodeAsync=async(a,o)=>vie(e,a,o),e.decodeAsync=async(a,o)=>kie(e,a,o),e.safeEncode=(a,o)=>wie(e,a,o),e.safeDecode=(a,o)=>Sie(e,a,o),e.safeEncodeAsync=async(a,o)=>Cie(e,a,o),e.safeDecodeAsync=async(a,o)=>jie(e,a,o),Cg(e,"ZodType",{check(...a){const o=this.def;return this.clone(Ul(o,{checks:[...o.checks??[],...a.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),{parent:!0})},with(...a){return this.check(...a)},clone(a,o){return Vl(this,a,o)},brand(){return this},register(a,o){return a.add(this,o),this},refine(a,o){return this.check(yse(a,o))},superRefine(a,o){return this.check(xse(a,o))},overwrite(a){return this.check(pp(a))},optional(){return M7(this)},exactOptional(){return ise(this)},nullable(){return I7(this)},nullish(){return M7(I7(this))},nonoptional(a){return use(this,a)},array(){return Yo(this)},or(a){return Zie([this,a])},and(a){return ese(this,a)},transform(a){return P7(this,ase(a))},default(a){return lse(this,a)},prefault(a){return dse(this,a)},catch(a){return mse(this,a)},pipe(a){return P7(this,a)},readonly(){return fse(this)},describe(a){const o=this.clone();return Ym.add(o,{description:a}),o},meta(...a){if(a.length===0)return Ym.get(this);const o=this.clone();return Ym.add(o,a[0]),o},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(a){return a(this)}}),Object.defineProperty(e,"description",{get(){return Ym.get(e)?.description},configurable:!0}),e)),fD=Ze("_ZodString",(e,t)=>{tS.init(e,t),ha.init(e,t),e._zod.processJSONSchema=(o,i,s)=>Foe(e,o,i);const a=e._zod.bag;e.format=a.format??null,e.minLength=a.minimum??null,e.maxLength=a.maximum??null,Cg(e,"_ZodString",{regex(...o){return this.check(woe(...o))},includes(...o){return this.check(joe(...o))},startsWith(...o){return this.check(Noe(...o))},endsWith(...o){return this.check(Aoe(...o))},min(...o){return this.check(Xy(...o))},max(...o){return this.check(dD(...o))},length(...o){return this.check(uD(...o))},nonempty(...o){return this.check(Xy(1,...o))},lowercase(o){return this.check(Soe(o))},uppercase(o){return this.check(Coe(o))},trim(){return this.check(Ioe())},normalize(...o){return this.check(Moe(...o))},toLowerCase(){return this.check(Poe())},toUpperCase(){return this.check(Toe())},slugify(){return this.check(Boe())}})}),Nie=Ze("ZodString",(e,t)=>{tS.init(e,t),fD.init(e,t),e.email=a=>e.check($ae(Aie,a)),e.url=a=>e.check(Zae(Mie,a)),e.jwt=a=>e.check(poe(Vie,a)),e.emoji=a=>e.check(Qae(Iie,a)),e.guid=a=>e.check(v7(j7,a)),e.uuid=a=>e.check(Kae(mb,a)),e.uuidv4=a=>e.check(Wae(mb,a)),e.uuidv6=a=>e.check(Jae(mb,a)),e.uuidv7=a=>e.check(Yae(mb,a)),e.nanoid=a=>e.check(Xae(Pie,a)),e.guid=a=>e.check(v7(j7,a)),e.cuid=a=>e.check(eoe(Tie,a)),e.cuid2=a=>e.check(toe(Bie,a)),e.ulid=a=>e.check(noe(Eie,a)),e.base64=a=>e.check(coe(_ie,a)),e.base64url=a=>e.check(doe(qie,a)),e.xid=a=>e.check(aoe(Rie,a)),e.ksuid=a=>e.check(ooe(Die,a)),e.ipv4=a=>e.check(ioe(Oie,a)),e.ipv6=a=>e.check(soe(zie,a)),e.cidrv4=a=>e.check(roe(Lie,a)),e.cidrv6=a=>e.check(loe(Fie,a)),e.e164=a=>e.check(uoe(Uie,a)),e.datetime=a=>e.check(sie(a)),e.date=a=>e.check(lie(a)),e.time=a=>e.check(die(a)),e.duration=a=>e.check(pie(a))});function Un(e){return Gae(Nie,e)}const ra=Ze("ZodStringFormat",(e,t)=>{ea.init(e,t),fD.init(e,t)}),Aie=Ze("ZodEmail",(e,t)=>{Xne.init(e,t),ra.init(e,t)}),j7=Ze("ZodGUID",(e,t)=>{Zne.init(e,t),ra.init(e,t)}),mb=Ze("ZodUUID",(e,t)=>{Qne.init(e,t),ra.init(e,t)}),Mie=Ze("ZodURL",(e,t)=>{eae.init(e,t),ra.init(e,t)}),Iie=Ze("ZodEmoji",(e,t)=>{tae.init(e,t),ra.init(e,t)}),Pie=Ze("ZodNanoID",(e,t)=>{nae.init(e,t),ra.init(e,t)}),Tie=Ze("ZodCUID",(e,t)=>{aae.init(e,t),ra.init(e,t)}),Bie=Ze("ZodCUID2",(e,t)=>{oae.init(e,t),ra.init(e,t)}),Eie=Ze("ZodULID",(e,t)=>{iae.init(e,t),ra.init(e,t)}),Rie=Ze("ZodXID",(e,t)=>{sae.init(e,t),ra.init(e,t)}),Die=Ze("ZodKSUID",(e,t)=>{rae.init(e,t),ra.init(e,t)}),Oie=Ze("ZodIPv4",(e,t)=>{pae.init(e,t),ra.init(e,t)}),zie=Ze("ZodIPv6",(e,t)=>{mae.init(e,t),ra.init(e,t)}),Lie=Ze("ZodCIDRv4",(e,t)=>{hae.init(e,t),ra.init(e,t)}),Fie=Ze("ZodCIDRv6",(e,t)=>{gae.init(e,t),ra.init(e,t)}),_ie=Ze("ZodBase64",(e,t)=>{fae.init(e,t),ra.init(e,t)}),qie=Ze("ZodBase64URL",(e,t)=>{yae.init(e,t),ra.init(e,t)}),Uie=Ze("ZodE164",(e,t)=>{xae.init(e,t),ra.init(e,t)}),Vie=Ze("ZodJWT",(e,t)=>{kae.init(e,t),ra.init(e,t)}),bD=Ze("ZodNumber",(e,t)=>{iD.init(e,t),ha.init(e,t),e._zod.processJSONSchema=(o,i,s)=>_oe(e,o,i),Cg(e,"ZodNumber",{gt(o,i){return this.check(w7(o,i))},gte(o,i){return this.check(qk(o,i))},min(o,i){return this.check(qk(o,i))},lt(o,i){return this.check(k7(o,i))},lte(o,i){return this.check(_k(o,i))},max(o,i){return this.check(_k(o,i))},int(o){return this.check(N7(o))},safe(o){return this.check(N7(o))},positive(o){return this.check(w7(0,o))},nonnegative(o){return this.check(qk(0,o))},negative(o){return this.check(k7(0,o))},nonpositive(o){return this.check(_k(0,o))},multipleOf(o,i){return this.check(S7(o,i))},step(o,i){return this.check(S7(o,i))},finite(){return this}});const a=e._zod.bag;e.minValue=Math.max(a.minimum??Number.NEGATIVE_INFINITY,a.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(a.maximum??Number.POSITIVE_INFINITY,a.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(a.format??"").includes("int")||Number.isSafeInteger(a.multipleOf??.5),e.isFinite=!0,e.format=a.format??null});function qc(e){return boe(bD,e)}const Hie=Ze("ZodNumberFormat",(e,t)=>{wae.init(e,t),bD.init(e,t)});function N7(e){return yoe(Hie,e)}const Gie=Ze("ZodBoolean",(e,t)=>{Sae.init(e,t),ha.init(e,t),e._zod.processJSONSchema=(a,o,i)=>qoe(e,a,o)});function os(e){return xoe(Gie,e)}const $ie=Ze("ZodUnknown",(e,t)=>{Cae.init(e,t),ha.init(e,t),e._zod.processJSONSchema=(a,o,i)=>Voe()});function A7(){return voe($ie)}const Kie=Ze("ZodNever",(e,t)=>{jae.init(e,t),ha.init(e,t),e._zod.processJSONSchema=(a,o,i)=>Uoe(e,a,o)});function Wie(e){return koe(Kie,e)}const Jie=Ze("ZodArray",(e,t)=>{Nae.init(e,t),ha.init(e,t),e._zod.processJSONSchema=(a,o,i)=>Woe(e,a,o,i),e.element=t.element,Cg(e,"ZodArray",{min(a,o){return this.check(Xy(a,o))},nonempty(a){return this.check(Xy(1,a))},max(a,o){return this.check(dD(a,o))},length(a,o){return this.check(uD(a,o))},unwrap(){return this.element}})});function Yo(e,t){return Eoe(Jie,e,t)}const Yie=Ze("ZodObject",(e,t)=>{Mae.init(e,t),ha.init(e,t),e._zod.processJSONSchema=(a,o,i)=>Joe(e,a,o,i),Pn(e,"shape",()=>t.shape),Cg(e,"ZodObject",{keyof(){return ui(Object.keys(this._zod.def.shape))},catchall(a){return this.clone({...this._zod.def,catchall:a})},passthrough(){return this.clone({...this._zod.def,catchall:A7()})},loose(){return this.clone({...this._zod.def,catchall:A7()})},strict(){return this.clone({...this._zod.def,catchall:Wie()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(a){return $te(this,a)},safeExtend(a){return Kte(this,a)},merge(a){return Wte(this,a)},pick(a){return Hte(this,a)},omit(a){return Gte(this,a)},partial(...a){return Jte(vD,this,a[0])},required(...a){return Yte(kD,this,a[0])}})});function aa(e,t){const a={type:"object",shape:e??{},...Et(t)};return new Yie(a)}const yD=Ze("ZodUnion",(e,t)=>{lD.init(e,t),ha.init(e,t),e._zod.processJSONSchema=(a,o,i)=>Yoe(e,a,o,i),e.options=t.options});function Zie(e,t){return new yD({type:"union",options:e,...Et(t)})}const Qie=Ze("ZodDiscriminatedUnion",(e,t)=>{yD.init(e,t),Iae.init(e,t)});function xD(e,t,a){return new Qie({type:"union",options:t,discriminator:e,...Et(a)})}const Xie=Ze("ZodIntersection",(e,t)=>{Pae.init(e,t),ha.init(e,t),e._zod.processJSONSchema=(a,o,i)=>Zoe(e,a,o,i)});function ese(e,t){return new Xie({type:"intersection",left:e,right:t})}const Z2=Ze("ZodEnum",(e,t)=>{Tae.init(e,t),ha.init(e,t),e._zod.processJSONSchema=(o,i,s)=>Hoe(e,o,i),e.enum=t.entries,e.options=Object.values(t.entries);const a=new Set(Object.keys(t.entries));e.extract=(o,i)=>{const s={};for(const r of o)if(a.has(r))s[r]=t.entries[r];else throw new Error(`Key ${r} not found in enum`);return new Z2({...t,checks:[],...Et(i),entries:s})},e.exclude=(o,i)=>{const s={...t.entries};for(const r of o)if(a.has(r))delete s[r];else throw new Error(`Key ${r} not found in enum`);return new Z2({...t,checks:[],...Et(i),entries:s})}});function ui(e,t){const a=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new Z2({type:"enum",entries:a,...Et(t)})}const tse=Ze("ZodLiteral",(e,t)=>{Bae.init(e,t),ha.init(e,t),e._zod.processJSONSchema=(a,o,i)=>Goe(e,a,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function as(e,t){return new tse({type:"literal",values:Array.isArray(e)?e:[e],...Et(t)})}const nse=Ze("ZodTransform",(e,t)=>{Eae.init(e,t),ha.init(e,t),e._zod.processJSONSchema=(a,o,i)=>Koe(e,a),e._zod.parse=(a,o)=>{if(o.direction==="backward")throw new HR(e.constructor.name);a.addIssue=s=>{if(typeof s=="string")a.issues.push(Kh(s,a.value,t));else{const r=s;r.fatal&&(r.continue=!1),r.code??(r.code="custom"),r.input??(r.input=a.value),r.inst??(r.inst=e),a.issues.push(Kh(r))}};const i=t.transform(a.value,a);return i instanceof Promise?i.then(s=>(a.value=s,a.fallback=!0,a)):(a.value=i,a.fallback=!0,a)}});function ase(e){return new nse({type:"transform",transform:e})}const vD=Ze("ZodOptional",(e,t)=>{cD.init(e,t),ha.init(e,t),e._zod.processJSONSchema=(a,o,i)=>gD(e,a,o,i),e.unwrap=()=>e._zod.def.innerType});function M7(e){return new vD({type:"optional",innerType:e})}const ose=Ze("ZodExactOptional",(e,t)=>{Rae.init(e,t),ha.init(e,t),e._zod.processJSONSchema=(a,o,i)=>gD(e,a,o,i),e.unwrap=()=>e._zod.def.innerType});function ise(e){return new ose({type:"optional",innerType:e})}const sse=Ze("ZodNullable",(e,t)=>{Dae.init(e,t),ha.init(e,t),e._zod.processJSONSchema=(a,o,i)=>Qoe(e,a,o,i),e.unwrap=()=>e._zod.def.innerType});function I7(e){return new sse({type:"nullable",innerType:e})}const rse=Ze("ZodDefault",(e,t)=>{Oae.init(e,t),ha.init(e,t),e._zod.processJSONSchema=(a,o,i)=>eie(e,a,o,i),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function lse(e,t){return new rse({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():KR(t)}})}const cse=Ze("ZodPrefault",(e,t)=>{zae.init(e,t),ha.init(e,t),e._zod.processJSONSchema=(a,o,i)=>tie(e,a,o,i),e.unwrap=()=>e._zod.def.innerType});function dse(e,t){return new cse({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():KR(t)}})}const kD=Ze("ZodNonOptional",(e,t)=>{Lae.init(e,t),ha.init(e,t),e._zod.processJSONSchema=(a,o,i)=>Xoe(e,a,o,i),e.unwrap=()=>e._zod.def.innerType});function use(e,t){return new kD({type:"nonoptional",innerType:e,...Et(t)})}const pse=Ze("ZodCatch",(e,t)=>{Fae.init(e,t),ha.init(e,t),e._zod.processJSONSchema=(a,o,i)=>nie(e,a,o,i),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function mse(e,t){return new pse({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const hse=Ze("ZodPipe",(e,t)=>{_ae.init(e,t),ha.init(e,t),e._zod.processJSONSchema=(a,o,i)=>aie(e,a,o,i),e.in=t.in,e.out=t.out});function P7(e,t){return new hse({type:"pipe",in:e,out:t})}const gse=Ze("ZodReadonly",(e,t)=>{qae.init(e,t),ha.init(e,t),e._zod.processJSONSchema=(a,o,i)=>oie(e,a,o,i),e.unwrap=()=>e._zod.def.innerType});function fse(e){return new gse({type:"readonly",innerType:e})}const bse=Ze("ZodCustom",(e,t)=>{Uae.init(e,t),ha.init(e,t),e._zod.processJSONSchema=(a,o,i)=>$oe(e,a)});function yse(e,t={}){return Roe(bse,e,t)}function xse(e,t){return Doe(e,t)}const wD=["cursor","blob","circle","squircle","capsule","drop","shield","hexagon","diamond","star","panes"],vse=ui(wD),kse="cursor",nS={cursor:{id:"cursor",name:"Cursor",fit:"translate(68.1612 9.8302) scale(0.593918)",body:'<path fill="{{GRADIENT}}" d="M0 0 C1.12815992 0.94880479 2.25705591 1.89673511 3.38671875 2.84375 C5.57657936 4.68528228 7.75793952 6.53624249 9.93359375 8.39453125 C13.5602214 11.48647103 17.25022962 14.49819427 20.9453125 17.5078125 C25.41301487 21.15281776 29.86103386 24.8215994 34.31054688 28.48876953 C38.00933931 31.5370903 41.70951059 34.58367973 45.4140625 37.625 C52.50037463 43.44570076 59.55669812 49.29508834 66.54003906 55.23901367 C70.43289872 58.54377434 74.40406577 61.73568847 78.40625 64.90625 C82.05401433 67.85083084 85.6145398 70.89451533 89.18359375 73.93359375 C92.41424312 76.67774533 95.67698054 79.36747809 99 82 C103.47931906 85.54855146 107.83340036 89.22936876 112.18359375 92.93359375 C115.41424312 95.67774533 118.67698054 98.36747809 122 101 C125.9014198 104.09073517 129.71091352 107.27378506 133.5 110.5 C137.99002543 114.32092614 142.53350963 118.0537239 147.15234375 121.71875 C156.74255328 129.40144186 166.1812645 137.27326897 175.53833008 145.23754883 C179.4317456 148.54281661 183.40347641 151.73522157 187.40625 154.90625 C191.05401433 157.85083084 194.6145398 160.89451533 198.18359375 163.93359375 C201.41424312 166.67774533 204.67698054 169.36747809 208 172 C236.43637507 194.63776677 236.43637507 194.63776677 238.27050781 209.13867188 C239.19944445 221.27193361 237.57124038 231.13444436 230 241 C223.66050278 247.82715086 215.75482398 254.47140646 206.04764748 255.13307858 C205.3615811 255.13693349 204.67551472 255.1407884 203.96865845 255.14476013 C203.17563324 255.15165863 202.38260803 255.15855713 201.56555176 255.16566467 C200.27360901 255.16958473 200.27360901 255.16958473 198.95556641 255.17358398 C198.04112762 255.180271 197.12668884 255.18695801 196.18453979 255.19384766 C194.19843498 255.20789156 192.21231409 255.21978771 190.22618484 255.22979546 C187.07149762 255.24625057 183.91692738 255.26949556 180.76229858 255.29469299 C171.79227585 255.36530712 162.82220292 255.42526708 153.85205078 255.47680664 C148.36195434 255.5088283 142.87198905 255.55017011 137.38199997 255.59700203 C135.30028042 255.61289593 133.21853066 255.62527474 131.13676834 255.63390923 C104.46972494 255.74602279 80.75351522 259.19455182 60.52978516 278.41845703 C55.75259196 283.35727885 51.81217213 289.04473423 47.77441406 294.5859375 C44.62107661 298.87600364 41.36381878 303.08685058 38.125 307.3125 C32.82026548 314.26649347 27.55386673 321.24815866 22.3125 328.25 C21.07690581 329.89589556 19.84122979 331.5417297 18.60546875 333.1875 C16.22002164 336.36552908 13.84996009 339.55428087 11.48828125 342.75 C3.0450311 354.10095576 -5.25712203 365.22607871 -20 368 C-33.42903027 368.85957067 -44.2929604 367.90032788 -55 358.9140625 C-63.51513963 350.76480778 -67.79688328 340.99527428 -68.37686157 329.29350281 C-68.43541887 328.1487851 -68.49397617 327.00406738 -68.55430794 325.82466125 C-68.61453573 324.57243271 -68.67476353 323.32020416 -68.73681641 322.0300293 C-68.80423726 320.68369989 -68.87198477 319.33738681 -68.94003105 317.99108887 C-69.12569162 314.29881586 -69.30666938 310.60632592 -69.48688698 306.91378379 C-69.68142908 302.94481208 -69.88036562 298.97606035 -70.07873535 295.00727844 C-70.55465828 285.46711948 -71.02377004 275.92663022 -71.49235249 266.3861084 C-71.71278092 261.90166682 -71.93398876 257.41726373 -72.1552124 252.93286133 C-72.22122149 251.59460763 -72.22122149 251.59460763 -72.28856409 250.2293185 C-72.37783973 248.41936974 -72.46711776 246.6094211 -72.55639815 244.79947257 C-72.7821203 240.22326204 -73.00777832 235.64704836 -73.23336792 231.0708313 C-73.2783997 230.15734865 -73.32343148 229.24386601 -73.36982787 228.30270207 C-73.64581049 222.70253299 -73.92113412 217.10233189 -74.19602597 211.50210917 C-75.35713101 187.85146938 -76.54638525 164.20245932 -77.76320994 140.55462319 C-78.3174362 129.77404232 -78.86176258 118.9929594 -79.40472984 108.2118063 C-79.83986282 99.58021501 -80.28322749 90.94912395 -80.73695588 82.31848997 C-81.04621068 76.42094211 -81.34513355 70.52292566 -81.63612723 64.62444884 C-81.8031421 61.24551841 -81.97612174 57.86718776 -82.15861511 54.48903847 C-84.29931862 14.73242483 -84.29931862 14.73242483 -72.03125 -1.625 C-50.89854752 -24.96559677 -21.34867451 -18.24899383 0 0 Z "/>',clip:'<path d="M0 0 C1.12815992 0.94880479 2.25705591 1.89673511 3.38671875 2.84375 C5.57657936 4.68528228 7.75793952 6.53624249 9.93359375 8.39453125 C13.5602214 11.48647103 17.25022962 14.49819427 20.9453125 17.5078125 C25.41301487 21.15281776 29.86103386 24.8215994 34.31054688 28.48876953 C38.00933931 31.5370903 41.70951059 34.58367973 45.4140625 37.625 C52.50037463 43.44570076 59.55669812 49.29508834 66.54003906 55.23901367 C70.43289872 58.54377434 74.40406577 61.73568847 78.40625 64.90625 C82.05401433 67.85083084 85.6145398 70.89451533 89.18359375 73.93359375 C92.41424312 76.67774533 95.67698054 79.36747809 99 82 C103.47931906 85.54855146 107.83340036 89.22936876 112.18359375 92.93359375 C115.41424312 95.67774533 118.67698054 98.36747809 122 101 C125.9014198 104.09073517 129.71091352 107.27378506 133.5 110.5 C137.99002543 114.32092614 142.53350963 118.0537239 147.15234375 121.71875 C156.74255328 129.40144186 166.1812645 137.27326897 175.53833008 145.23754883 C179.4317456 148.54281661 183.40347641 151.73522157 187.40625 154.90625 C191.05401433 157.85083084 194.6145398 160.89451533 198.18359375 163.93359375 C201.41424312 166.67774533 204.67698054 169.36747809 208 172 C236.43637507 194.63776677 236.43637507 194.63776677 238.27050781 209.13867188 C239.19944445 221.27193361 237.57124038 231.13444436 230 241 C223.66050278 247.82715086 215.75482398 254.47140646 206.04764748 255.13307858 C205.3615811 255.13693349 204.67551472 255.1407884 203.96865845 255.14476013 C203.17563324 255.15165863 202.38260803 255.15855713 201.56555176 255.16566467 C200.27360901 255.16958473 200.27360901 255.16958473 198.95556641 255.17358398 C198.04112762 255.180271 197.12668884 255.18695801 196.18453979 255.19384766 C194.19843498 255.20789156 192.21231409 255.21978771 190.22618484 255.22979546 C187.07149762 255.24625057 183.91692738 255.26949556 180.76229858 255.29469299 C171.79227585 255.36530712 162.82220292 255.42526708 153.85205078 255.47680664 C148.36195434 255.5088283 142.87198905 255.55017011 137.38199997 255.59700203 C135.30028042 255.61289593 133.21853066 255.62527474 131.13676834 255.63390923 C104.46972494 255.74602279 80.75351522 259.19455182 60.52978516 278.41845703 C55.75259196 283.35727885 51.81217213 289.04473423 47.77441406 294.5859375 C44.62107661 298.87600364 41.36381878 303.08685058 38.125 307.3125 C32.82026548 314.26649347 27.55386673 321.24815866 22.3125 328.25 C21.07690581 329.89589556 19.84122979 331.5417297 18.60546875 333.1875 C16.22002164 336.36552908 13.84996009 339.55428087 11.48828125 342.75 C3.0450311 354.10095576 -5.25712203 365.22607871 -20 368 C-33.42903027 368.85957067 -44.2929604 367.90032788 -55 358.9140625 C-63.51513963 350.76480778 -67.79688328 340.99527428 -68.37686157 329.29350281 C-68.43541887 328.1487851 -68.49397617 327.00406738 -68.55430794 325.82466125 C-68.61453573 324.57243271 -68.67476353 323.32020416 -68.73681641 322.0300293 C-68.80423726 320.68369989 -68.87198477 319.33738681 -68.94003105 317.99108887 C-69.12569162 314.29881586 -69.30666938 310.60632592 -69.48688698 306.91378379 C-69.68142908 302.94481208 -69.88036562 298.97606035 -70.07873535 295.00727844 C-70.55465828 285.46711948 -71.02377004 275.92663022 -71.49235249 266.3861084 C-71.71278092 261.90166682 -71.93398876 257.41726373 -72.1552124 252.93286133 C-72.22122149 251.59460763 -72.22122149 251.59460763 -72.28856409 250.2293185 C-72.37783973 248.41936974 -72.46711776 246.6094211 -72.55639815 244.79947257 C-72.7821203 240.22326204 -73.00777832 235.64704836 -73.23336792 231.0708313 C-73.2783997 230.15734865 -73.32343148 229.24386601 -73.36982787 228.30270207 C-73.64581049 222.70253299 -73.92113412 217.10233189 -74.19602597 211.50210917 C-75.35713101 187.85146938 -76.54638525 164.20245932 -77.76320994 140.55462319 C-78.3174362 129.77404232 -78.86176258 118.9929594 -79.40472984 108.2118063 C-79.83986282 99.58021501 -80.28322749 90.94912395 -80.73695588 82.31848997 C-81.04621068 76.42094211 -81.34513355 70.52292566 -81.63612723 64.62444884 C-81.8031421 61.24551841 -81.97612174 57.86718776 -82.15861511 54.48903847 C-84.29931862 14.73242483 -84.29931862 14.73242483 -72.03125 -1.625 C-50.89854752 -24.96559677 -21.34867451 -18.24899383 0 0 Z "/>',anchor:{x:85.54,y:106.35,scale:.791}},blob:{id:"blob",name:"Blob",fit:"translate(-0.7217 2.9555) scale(1.134706)",body:'<path fill="{{GRADIENT}}" d="M198.91052 113.12915C198.30169 121.88191 196.37668 130.37605 193.1355 138.61157C189.89431 146.84709 185.49332 154.4026 179.93252 161.27809C174.37172 168.15358 167.99976 174.1053 160.81663 179.13325C153.6335 184.1612 145.98678 188.22176 137.87645 191.31491C129.76613 194.40806 121.42581 196.55178 112.85548 197.74609C104.28516 198.94039 95.66469 199.12755 86.99407 198.30758C78.32344 197.4876 69.86713 195.54477 61.62513 192.47909C53.38313 189.41341 45.74309 185.20915 38.70501 179.86633C31.66693 174.52351 25.60941 168.25632 20.53243 161.06476C15.45546 153.87319 11.54067 146.15559 8.78808 137.91195C6.03549 129.66831 4.37316 121.28874 3.80109 112.77325C3.22902 104.25775 3.5616 95.83136 4.79882 87.49409C6.03604 79.15682 8.08364 70.99969 10.94163 63.0227C13.79962 55.04571 17.53174 47.38891 22.13799 40.0523C26.74425 32.71568 32.30193 26.0276 38.81103 19.98806C45.32014 13.94852 52.65266 9.00619 60.80862 5.16109C68.96458 1.31599 77.53546 -1.10241 86.52128 -2.09412C95.50709 -3.08583 104.37427 -2.64309 113.12282 -0.76589C121.87137 1.11131 130.09712 4.12751 137.80007 8.28271C145.50302 12.43791 152.53652 17.35515 158.90058 23.03443C165.26463 28.7137 170.969 34.91856 176.01368 41.649C181.05836 48.37944 185.3953 55.56843 189.02451 63.21597C192.65372 70.86352 195.3609 78.90607 197.14605 87.34364C198.93119 95.78121 199.51935 104.37638 198.91052 113.12915Z"/>',clip:'<path d="M198.91052 113.12915C198.30169 121.88191 196.37668 130.37605 193.1355 138.61157C189.89431 146.84709 185.49332 154.4026 179.93252 161.27809C174.37172 168.15358 167.99976 174.1053 160.81663 179.13325C153.6335 184.1612 145.98678 188.22176 137.87645 191.31491C129.76613 194.40806 121.42581 196.55178 112.85548 197.74609C104.28516 198.94039 95.66469 199.12755 86.99407 198.30758C78.32344 197.4876 69.86713 195.54477 61.62513 192.47909C53.38313 189.41341 45.74309 185.20915 38.70501 179.86633C31.66693 174.52351 25.60941 168.25632 20.53243 161.06476C15.45546 153.87319 11.54067 146.15559 8.78808 137.91195C6.03549 129.66831 4.37316 121.28874 3.80109 112.77325C3.22902 104.25775 3.5616 95.83136 4.79882 87.49409C6.03604 79.15682 8.08364 70.99969 10.94163 63.0227C13.79962 55.04571 17.53174 47.38891 22.13799 40.0523C26.74425 32.71568 32.30193 26.0276 38.81103 19.98806C45.32014 13.94852 52.65266 9.00619 60.80862 5.16109C68.96458 1.31599 77.53546 -1.10241 86.52128 -2.09412C95.50709 -3.08583 104.37427 -2.64309 113.12282 -0.76589C121.87137 1.11131 130.09712 4.12751 137.80007 8.28271C145.50302 12.43791 152.53652 17.35515 158.90058 23.03443C165.26463 28.7137 170.969 34.91856 176.01368 41.649C181.05836 48.37944 185.3953 55.56843 189.02451 63.21597C192.65372 70.86352 195.3609 78.90607 197.14605 87.34364C198.93119 95.78121 199.51935 104.37638 198.91052 113.12915Z"/>',anchor:{x:111.22,y:116.58,scale:.791}},circle:{id:"circle",name:"Circle",fit:"translate(0 0) scale(1.142705)",body:'<path fill="{{GRADIENT}}" d="M200 100C200 155.22847 155.22847 200 100 200C44.77153 200 0 155.22847 0 100C0 44.77153 44.77153 0 100 0C155.22847 0 200 44.77153 200 100Z"/>',clip:'<path d="M200 100C200 155.22847 155.22847 200 100 200C44.77153 200 0 155.22847 0 100C0 44.77153 44.77153 0 100 0C155.22847 0 200 44.77153 200 100Z"/>',anchor:{x:113.82,y:110.27,scale:.791}},squircle:{id:"squircle",name:"Squircle",fit:"translate(0 0) scale(1.142705)",body:'<path fill="{{GRADIENT}}" d="M50 0C83.33333 0 116.66667 0 150 0C177.61424 0 200 22.38576 200 50C200 83.33333 200 116.66667 200 150C200 177.61424 177.61424 200 150 200C116.66667 200 83.33333 200 50 200C22.38576 200 0 177.61424 0 150C0 116.66667 0 83.33333 0 50C0 22.38576 22.38576 0 50 0Z"/>',clip:'<path d="M50 0C83.33333 0 116.66667 0 150 0C177.61424 0 200 22.38576 200 50C200 83.33333 200 116.66667 200 150C200 177.61424 177.61424 200 150 200C116.66667 200 83.33333 200 50 200C22.38576 200 0 177.61424 0 150C0 116.66667 0 83.33333 0 50C0 22.38576 22.38576 0 50 0Z"/>',anchor:{x:111.78,y:111.79,scale:.791}},capsule:{id:"capsule",name:"Capsule",fit:"translate(0 0) scale(1.142705)",body:'<path fill="{{GRADIENT}}" d="M100 0C141.42136 0 175 33.57864 175 75C175 91.66667 175 108.33333 175 125C175 166.42136 141.42136 200 100 200C58.57864 200 25 166.42136 25 125C25 108.33333 25 91.66667 25 75C25 33.57864 58.57864 0 100 0Z"/>',clip:'<path d="M100 0C141.42136 0 175 33.57864 175 75C175 91.66667 175 108.33333 175 125C175 166.42136 141.42136 200 100 200C58.57864 200 25 166.42136 25 125C25 108.33333 25 91.66667 25 75C25 33.57864 58.57864 0 100 0Z"/>',anchor:{x:113.82,y:131.68,scale:.791}},drop:{id:"drop",name:"Drop",fit:"translate(-3.5341 -3.5341) scale(1.178046)",body:'<path fill="{{GRADIENT}}" d="M100 3C160.84 78.2235 178 103.298 178 119C178 162.07821 143.07821 197 100 197C56.92179 197 22 162.07821 22 119C22 103.298 39.16 78.2235 100 3Z"/>',clip:'<path d="M100 3C160.84 78.2235 178 103.298 178 119C178 162.07821 143.07821 197 100 197C56.92179 197 22 162.07821 22 119C22 103.298 39.16 78.2235 100 3Z"/>',anchor:{x:112.47,y:138.8,scale:.791}},shield:{id:"shield",name:"Shield",fit:"translate(-12.1611 -24.3222) scale(1.264316)",body:'<path fill="{{GRADIENT}}" d="M57.25 38.475C85.75 12.825 114.25 12.825 142.75 38.475C153.89667 76.64167 165.04333 114.80833 176.19 152.975C188.73 184.325 179.325 200 147.975 200C115.99167 200 84.00833 200 52.025 200C20.675 200 11.27 184.325 23.81 152.975C34.95667 114.80833 46.10333 76.64167 57.25 38.475Z"/>',clip:'<path d="M57.25 38.475C85.75 12.825 114.25 12.825 142.75 38.475C153.89667 76.64167 165.04333 114.80833 176.19 152.975C188.73 184.325 179.325 200 147.975 200C115.99167 200 84.00833 200 52.025 200C20.675 200 11.27 184.325 23.81 152.975C34.95667 114.80833 46.10333 76.64167 57.25 38.475Z"/>',anchor:{x:112.38,y:170.61,scale:.791}},hexagon:{id:"hexagon",name:"Hexagon",fit:"translate(-4.1077 -4.1077) scale(1.183782)",body:'<path fill="{{GRADIENT}}" d="M94.90777 4.94C98.30259 2.98 101.69741 2.98 105.09223 4.94C129.98757 19.31333 154.88292 33.68667 179.77826 48.06C183.17308 50.02 184.87049 52.96 184.87049 56.88C184.87049 85.62667 184.87049 114.37333 184.87049 143.12C184.87049 147.04 183.17308 149.98 179.77826 151.94C154.88292 166.31333 129.98757 180.68667 105.09223 195.06C101.69741 197.02 98.30259 197.02 94.90777 195.06C70.01243 180.68667 45.11708 166.31333 20.22174 151.94C16.82692 149.98 15.12951 147.04 15.12951 143.12C15.12951 114.37333 15.12951 85.62667 15.12951 56.88C15.12951 52.96 16.82692 50.02 20.22174 48.06C45.11708 33.68667 70.01243 19.31333 94.90777 4.94Z"/>',clip:'<path d="M94.90777 4.94C98.30259 2.98 101.69741 2.98 105.09223 4.94C129.98757 19.31333 154.88292 33.68667 179.77826 48.06C183.17308 50.02 184.87049 52.96 184.87049 56.88C184.87049 85.62667 184.87049 114.37333 184.87049 143.12C184.87049 147.04 183.17308 149.98 179.77826 151.94C154.88292 166.31333 129.98757 180.68667 105.09223 195.06C101.69741 197.02 98.30259 197.02 94.90777 195.06C70.01243 180.68667 45.11708 166.31333 20.22174 151.94C16.82692 149.98 15.12951 147.04 15.12951 143.12C15.12951 114.37333 15.12951 85.62667 15.12951 56.88C15.12951 52.96 16.82692 50.02 20.22174 48.06C45.11708 33.68667 70.01243 19.31333 94.90777 4.94Z"/>',anchor:{x:112.26,y:110.7,scale:.791}},diamond:{id:"diamond",name:"Diamond",fit:"translate(-5.9383 -5.9383) scale(1.202088)",body:'<path fill="{{GRADIENT}}" d="M94.12 7.88C98.04 3.96 101.96 3.96 105.88 7.88C134.62667 36.62667 163.37333 65.37333 192.12 94.12C196.04 98.04 196.04 101.96 192.12 105.88C163.37333 134.62667 134.62667 163.37333 105.88 192.12C101.96 196.04 98.04 196.04 94.12 192.12C65.37333 163.37333 36.62667 134.62667 7.88 105.88C3.96 101.96 3.96 98.04 7.88 94.12C36.62667 65.37333 65.37333 36.62667 94.12 7.88Z"/>',clip:'<path d="M94.12 7.88C98.04 3.96 101.96 3.96 105.88 7.88C134.62667 36.62667 163.37333 65.37333 192.12 94.12C196.04 98.04 196.04 101.96 192.12 105.88C163.37333 134.62667 134.62667 163.37333 105.88 192.12C101.96 196.04 98.04 196.04 94.12 192.12C65.37333 163.37333 36.62667 134.62667 7.88 105.88C3.96 101.96 3.96 98.04 7.88 94.12C36.62667 65.37333 65.37333 36.62667 94.12 7.88Z"/>',anchor:{x:112.53,y:109.95,scale:.791}},star:{id:"star",name:"Star",fit:"translate(-8.3327 3.1407) scale(1.226032)",body:'<path fill="{{GRADIENT}}" d="M100 2C110.56054 20.13133 121.12108 38.26266 131.68163 56.39398C152.18893 60.83477 172.69623 65.27555 193.20354 69.71633C179.22301 85.3629 165.24248 101.00946 151.26195 116.65602C153.37562 137.5319 155.48929 158.40778 157.60295 179.28367C138.40197 170.82244 119.20098 162.36122 100 153.9C80.79902 162.36122 61.59803 170.82244 42.39705 179.28367C44.51071 158.40778 46.62438 137.5319 48.73805 116.65602C34.75752 101.00946 20.77699 85.3629 6.79646 69.71633C27.30377 65.27555 47.81107 60.83477 68.31837 56.39398C78.87892 38.26266 89.43946 20.13133 100 2Z"/>',clip:'<path d="M100 2C110.56054 20.13133 121.12108 38.26266 131.68163 56.39398C152.18893 60.83477 172.69623 65.27555 193.20354 69.71633C179.22301 85.3629 165.24248 101.00946 151.26195 116.65602C153.37562 137.5319 155.48929 158.40778 157.60295 179.28367C138.40197 170.82244 119.20098 162.36122 100 153.9C80.79902 162.36122 61.59803 170.82244 42.39705 179.28367C44.51071 158.40778 46.62438 137.5319 48.73805 116.65602C34.75752 101.00946 20.77699 85.3629 6.79646 69.71633C27.30377 65.27555 47.81107 60.83477 68.31837 56.39398C78.87892 38.26266 89.43946 20.13133 100 2Z"/>',anchor:{x:113.82,y:125.43,scale:.791}},panes:{id:"panes",name:"Panes",fit:"translate(-2.3321 -2.3321) scale(1.166026)",body:'<path fill="{{GRADIENT}}" d="M42 2C56 2 70 2 84 2C92 2 92 32 100 32C108 32 108 2 116 2C130 2 144 2 158 2C180.09139 2 198 19.90861 198 42C198 56 198 70 198 84C198 92 168 92 168 100C168 108 198 108 198 116C198 130 198 144 198 158C198 180.09139 180.09139 198 158 198C144 198 130 198 116 198C108 198 108 168 100 168C92 168 92 198 84 198C70 198 56 198 42 198C19.90861 198 2 180.09139 2 158C2 144 2 130 2 116C2 108 32 108 32 100C32 92 2 92 2 84C2 70 2 56 2 42C2 19.90861 19.90861 2 42 2Z"/>',clip:'<path d="M42 2C56 2 70 2 84 2C92 2 92 32 100 32C108 32 108 2 116 2C130 2 144 2 158 2C180.09139 2 198 19.90861 198 42C198 56 198 70 198 84C198 92 168 92 168 100C168 108 198 108 198 116C198 130 198 144 198 158C198 180.09139 180.09139 198 158 198C144 198 130 198 116 198C108 198 108 168 100 168C92 168 92 198 84 198C70 198 56 198 42 198C19.90861 198 2 180.09139 2 158C2 144 2 130 2 116C2 108 32 108 32 100C32 92 2 92 2 84C2 70 2 56 2 42C2 19.90861 19.90861 2 42 2Z"/>',anchor:{x:113.82,y:102.65,scale:.791}}};function wse(e){return vse.safeParse(e).data??kse}const $u=228.541,T7=[120,122.5],B7={x:13.2,y:8.4},Sse=["130.36,45.98 132.71,46.19 134.98,46.81 137.11,47.83 138.97,49.28 140.47,51.09 141.68,53.12 142.73,55.23 143.76,57.36 144.78,59.49 145.79,61.62 146.79,63.76 147.76,65.91 148.71,68.07 149.63,70.25 150.52,72.43 151.37,74.63 151.99,76.91 152.1,79.26 151.64,81.57 150.59,83.68 149.04,85.45 147.1,86.78 144.9,87.62 142.56,87.93 140.22,87.71 137.98,86.99 135.93,85.82 134.17,84.24 132.78,82.34 131.69,80.25 130.77,78.08 129.87,75.89 128.94,73.72 128,71.56 127.03,69.4 126.05,67.26 125.05,65.12 124.03,62.99 122.93,60.9 121.87,58.79 121.03,56.59 120.72,54.26 121.1,51.93 122.15,49.83 123.75,48.1 125.76,46.89 128.01,46.19|176.61,37.08 178.72,37.59 180.7,38.48 182.52,39.65 184.2,41.03 185.71,42.59 187.03,44.31 188.2,46.14 189.26,48.03 190.27,49.96 191.26,51.89 192.23,53.84 193.16,55.8 194.05,57.78 194.92,59.77 195.74,61.78 196.53,63.8 197.27,65.84 197.97,67.9 198.47,70.01 198.63,72.18 198.4,74.33 197.58,76.33 195.95,77.72 193.83,78.08 191.71,77.65 189.76,76.69 188.03,75.38 186.53,73.82 185.28,72.05 184.25,70.13 183.4,68.14 182.63,66.11 181.87,64.07 181.07,62.05 180.25,60.04 179.39,58.05 178.49,56.07 177.57,54.1 176.61,52.15 175.62,50.22 174.59,48.31 173.53,46.41 172.54,44.48 171.86,42.42 171.76,40.26 172.62,38.3 174.45,37.19","86.14,124.79 89.16,124.92 92.06,125.76 94.68,127.27 96.86,129.36 98.48,131.92 99.51,134.76 100.12,137.73 100.56,140.72 101.01,143.72 101.52,146.71 102.06,149.69 102.62,152.67 103.2,155.64 103.81,158.61 104.44,161.57 105.11,164.52 105.81,167.47 106.49,170.42 106.72,173.44 106.01,176.37 104.37,178.9 102.03,180.81 99.26,181.99 96.27,182.46 93.25,182.25 90.34,181.43 87.65,180.04 85.32,178.11 83.51,175.7 82.37,172.9 81.66,169.96 80.98,167 80.32,164.05 79.69,161.08 79.08,158.12 78.5,155.14 77.94,152.16 77.4,149.18 76.89,146.2 76.4,143.21 75.93,140.21 75.56,137.21 75.7,134.19 76.6,131.3 78.22,128.76 80.47,126.74 83.18,125.4|147.23,112.87 150.24,113.13 153.07,114.19 155.53,115.94 157.46,118.26 158.73,121.01 159.53,123.93 160.21,126.88 160.88,129.84 161.52,132.8 162.15,135.76 162.74,138.73 163.32,141.71 163.87,144.69 164.39,147.67 164.9,150.66 165.39,153.65 165.8,156.65 165.76,159.67 164.98,162.59 163.56,165.26 161.61,167.58 159.23,169.45 156.52,170.77 153.57,171.46 150.55,171.4 147.67,170.52 145.19,168.79 143.45,166.33 142.57,163.44 142.08,160.45 141.61,157.46 141.11,154.47 140.59,151.48 140.04,148.5 139.47,145.53 138.87,142.56 138.25,139.59 137.6,136.63 136.94,133.68 136.25,130.72 135.59,127.77 135.47,124.75 136.07,121.78 137.34,119.04 139.19,116.65 141.53,114.74 144.26,113.44","104.84,104.08 109.39,104.89 113.63,106.73 117.32,109.5 120.25,113.08 122.22,117.25 123.15,121.77 122.92,126.39 121.86,130.89 120.61,135.35 119.37,139.81 118.15,144.27 116.94,148.74 115.74,153.21 114.56,157.69 113.39,162.17 112.24,166.65 111.13,171.15 110.04,175.65 108.89,180.13 106.98,184.33 103.8,187.67 99.75,189.87 95.25,190.93 90.63,190.93 86.11,189.97 81.86,188.16 78.05,185.54 74.89,182.18 72.62,178.16 71.54,173.67 71.94,169.08 73.01,164.57 74.13,160.08 75.26,155.59 76.42,151.11 77.59,146.63 78.77,142.15 79.97,137.68 81.18,133.22 82.41,128.75 83.65,124.29 84.87,119.83 86.33,115.43 88.67,111.46 91.9,108.15 95.83,105.72 100.23,104.35|174.26,115.55 178.59,116.54 182.37,118.86 185.31,122.2 187.23,126.21 188.12,130.57 188.06,135.02 187.52,139.44 186.86,143.85 186.11,148.25 185.25,152.62 184.3,156.98 183.24,161.31 182.07,165.61 180.79,169.88 179.39,174.12 177.89,178.31 176.27,182.47 174.47,186.55 172.17,190.35 169.21,193.68 165.73,196.46 161.84,198.64 157.66,200.16 153.27,200.91 148.83,200.69 144.65,199.19 141.47,196.14 140.18,191.91 140.82,187.53 142.46,183.38 144.16,179.26 145.73,175.09 147.18,170.87 148.51,166.62 149.73,162.33 150.84,158.01 151.84,153.67 152.74,149.3 153.54,144.91 154.24,140.51 154.85,136.1 155.58,131.7 156.93,127.46 159.15,123.6 162.12,120.29 165.73,117.68 169.84,116","44.72,103.35 47.95,103.93 51.04,105.05 53.93,106.62 56.58,108.57 58.97,110.83 61.09,113.35 62.93,116.07 64.5,118.97 65.79,121.99 66.8,125.13 67.52,128.34 67.94,131.6 68.08,134.89 67.9,138.17 67.4,141.42 66.56,144.6 65.33,147.66 63.71,150.52 61.69,153.11 59.3,155.36 56.54,157.16 53.51,158.42 50.29,159.07 47,159.09 43.76,158.5 40.67,157.39 37.78,155.82 35.13,153.87 32.75,151.6 30.63,149.09 28.78,146.36 27.21,143.47 25.92,140.44 24.92,137.31 24.2,134.1 23.77,130.84 23.64,127.55 23.81,124.27 24.31,121.01 25.16,117.84 26.38,114.78 28,111.92 30.02,109.33 32.42,107.08 35.17,105.28 38.21,104.02 41.43,103.37|114.62,83.64 118.31,83.88 121.94,84.6 125.44,85.77 128.77,87.38 131.86,89.4 134.67,91.81 137.13,94.56 139.2,97.62 140.85,100.93 142.05,104.42 142.79,108.05 143.05,111.73 142.83,115.42 142.13,119.05 140.95,122.55 139.34,125.88 137.3,128.96 134.88,131.75 132.11,134.2 129.05,136.27 125.75,137.93 122.25,139.13 118.63,139.86 114.94,140.1 111.25,139.86 107.63,139.14 104.12,137.97 100.8,136.36 97.7,134.34 94.9,131.93 92.44,129.18 90.36,126.12 88.72,122.81 87.51,119.31 86.78,115.69 86.52,112.01 86.74,108.32 87.44,104.69 88.61,101.18 90.23,97.86 92.27,94.78 94.69,91.99 97.45,89.54 100.51,87.47 103.82,85.81 107.31,84.61 110.94,83.88","90.44,99.25 93.11,99.26 95.74,99.79 98.37,100.3 101,100.82 103.64,101.33 106.27,101.85 108.9,102.37 111.53,102.89 114.16,103.41 116.79,103.94 119.42,104.47 122.06,105 124.69,105.53 127.32,106.06 129.94,106.6 132.57,107.14 135.2,107.68 137.65,108.73 139.5,110.65 140.44,113.14 140.36,115.81 139.35,118.28 137.48,120.18 135,121.14 132.32,121.11 129.7,120.56 127.08,120 124.45,119.46 121.82,118.93 119.19,118.4 116.56,117.87 113.93,117.35 111.29,116.83 108.66,116.32 106.02,115.82 103.39,115.31 100.76,114.79 98.12,114.28 95.49,113.75 92.86,113.22 90.23,112.68 87.77,111.66 85.93,109.74 85.01,107.24 85.06,104.57 86.07,102.1 87.96,100.22|156.6,112.56 158.91,112.66 161.18,113.15 163.45,113.64 165.72,114.13 167.99,114.62 170.26,115.12 172.53,115.62 174.8,116.12 177.07,116.62 179.34,117.13 181.6,117.64 183.87,118.15 186.14,118.67 188.4,119.18 190.67,119.7 192.94,120.2 195.12,120.96 196.7,122.63 197.45,124.82 197.53,127.14 197.07,129.41 196.08,131.51 194.49,133.18 192.33,133.97 190.04,133.68 187.79,133.09 185.52,132.57 183.26,132.05 180.99,131.54 178.72,131.03 176.45,130.53 174.18,130.03 171.91,129.54 169.64,129.05 167.37,128.56 165.1,128.07 162.83,127.58 160.56,127.08 158.29,126.57 156.02,126.05 153.9,125.14 152.26,123.51 151.32,121.4 151.08,119.1 151.53,116.82 152.65,114.8 154.41,113.31","79.94,130.44 83.08,130.57 86.11,131.41 88.89,132.89 91.27,134.94 93.15,137.46 94.39,140.35 95.11,143.42 95.65,146.52 96.2,149.62 96.78,152.72 97.39,155.81 98.04,158.89 98.72,161.97 99.43,165.04 100.18,168.1 100.97,171.15 101.81,174.18 102.64,177.22 103.01,180.34 102.35,183.4 100.66,186.04 98.19,187.98 95.28,189.16 92.17,189.6 89.03,189.37 85.99,188.56 83.16,187.2 80.63,185.33 78.55,182.97 77.05,180.21 76.1,177.21 75.28,174.17 74.5,171.11 73.74,168.06 73.02,164.99 72.33,161.92 71.68,158.83 71.06,155.75 70.47,152.65 69.91,149.55 69.37,146.45 68.97,143.32 69.12,140.18 70.04,137.18 71.7,134.51 74.03,132.41 76.86,131.04|168.95,136.28 171.31,136.97 172.99,138.76 173.66,141.13 173.36,143.58 172.24,145.79 170.45,147.49 168.22,148.58 165.89,149.43 163.57,150.31 161.24,151.18 158.9,152.02 156.56,152.85 154.21,153.65 151.85,154.44 149.48,155.2 147.11,155.94 144.73,156.65 142.34,157.34 139.95,158.01 137.55,158.66 135.14,159.27 132.73,159.86 130.31,160.43 127.84,160.54 125.53,159.69 123.77,157.96 122.89,155.66 123.09,153.21 124.36,151.09 126.34,149.61 128.69,148.83 131.1,148.24 133.51,147.62 135.91,146.98 138.31,146.32 140.7,145.65 143.08,144.95 145.46,144.23 147.83,143.49 150.2,142.73 152.56,141.95 154.91,141.15 157.25,140.32 159.59,139.48 161.92,138.61 164.24,137.72 166.54,136.78","119.79,105.35 121.94,105.42 124.03,105.87 126,106.72 127.77,107.93 129.27,109.47 130.45,111.26 131.29,113.23 131.73,115.33 131.79,117.47 131.53,119.6 131.11,121.71 130.66,123.81 130.27,125.92 129.88,128.03 129.49,130.14 129.07,132.25 128.62,134.35 127.96,136.39 126.96,138.29 125.62,139.96 123.99,141.36 122.13,142.43 120.11,143.15 118,143.5 115.85,143.45 113.75,143 111.79,142.15 110.03,140.93 108.54,139.38 107.36,137.59 106.53,135.61 106.1,133.51 106.07,131.37 106.35,129.24 106.77,127.14 107.22,125.04 107.64,122.93 108.05,120.82 108.45,118.71 108.84,116.6 109.25,114.49 109.86,112.44 110.83,110.52 112.16,108.84 113.78,107.44 115.65,106.38 117.67,105.68|174.73,114.1 176.71,114.59 178.5,115.55 180.04,116.88 181.27,118.5 182.17,120.33 182.71,122.29 182.9,124.32 182.82,126.36 182.56,128.38 182.23,130.39 181.89,132.4 181.53,134.41 181.16,136.41 180.75,138.41 180.3,140.4 179.82,142.38 179.18,144.31 178.28,146.15 177.14,147.83 175.74,149.31 174.11,150.53 172.29,151.44 170.32,151.97 168.29,152.07 166.29,151.69 164.45,150.83 162.87,149.54 161.66,147.91 160.83,146.06 160.38,144.07 160.29,142.04 160.53,140.01 160.98,138.02 161.43,136.03 161.84,134.04 162.24,132.04 162.62,130.03 162.93,128.02 163.24,126 163.6,124 164.11,122.03 164.91,120.15 165.99,118.43 167.35,116.91 168.94,115.64 170.74,114.69 172.7,114.15","105.72,72.58 108.82,72.78 111.75,73.82 114.27,75.64 116.39,77.92 118.42,80.29 120.45,82.66 122.47,85.03 124.48,87.41 126.49,89.8 128.48,92.2 130.47,94.6 132.45,97.01 134.43,99.42 136.4,101.83 138.37,104.25 140.3,106.7 141.85,109.39 142.65,112.4 142.63,115.51 141.8,118.5 140.21,121.17 137.95,123.31 135.17,124.7 132.11,125.26 129.02,124.98 126.12,123.86 123.67,121.94 121.61,119.6 119.66,117.17 117.69,114.75 115.73,112.33 113.75,109.92 111.77,107.52 109.77,105.12 107.77,102.73 105.76,100.34 103.75,97.96 101.72,95.59 99.68,93.23 97.63,90.89 95.91,88.3 94.95,85.34 94.92,82.24 95.84,79.27 97.56,76.68 99.9,74.63 102.67,73.22|176.73,63.75 179.52,64.43 182.02,65.85 184.15,67.78 185.85,70.1 187.08,72.7 187.76,75.5 187.76,78.37 187.23,81.2 186.58,84.01 185.89,86.8 185.16,89.59 184.39,92.36 183.59,95.13 182.76,97.89 181.88,100.64 180.98,103.37 180.02,106.09 179.03,108.79 177.99,111.48 176.9,114.15 175.5,116.66 173.51,118.72 171,120.11 168.18,120.66 165.34,120.29 162.75,119.04 160.62,117.12 159.02,114.73 158,112.04 157.63,109.19 157.98,106.34 158.83,103.59 159.86,100.9 160.87,98.2 161.85,95.49 162.79,92.76 163.7,90.03 164.57,87.29 165.41,84.53 166.21,81.76 166.98,78.99 167.7,76.2 168.38,73.4 169,70.58 169.79,67.82 171.41,65.46 173.88,64.03","64.12,83.43 66.69,84.08 68.9,85.53 70.57,87.6 71.56,90.05 71.86,92.69 71.53,95.32 70.55,97.78 69.06,99.99 67.36,102.03 65.64,104.06 63.95,106.11 62.28,108.18 60.63,110.27 59,112.38 57.41,114.5 55.84,116.65 54.29,118.82 52.78,121 51.31,123.22 49.86,125.45 48.42,127.69 46.67,129.68 44.36,130.96 41.73,131.22 39.22,130.38 37.16,128.72 35.64,126.55 34.65,124.08 34.2,121.46 34.29,118.81 34.94,116.24 36.12,113.86 37.54,111.61 39.04,109.41 40.54,107.21 42.06,105.03 43.61,102.87 45.18,100.73 46.79,98.6 48.41,96.5 50.07,94.42 51.74,92.35 53.45,90.31 55.17,88.28 56.94,86.3 59.04,84.67 61.48,83.65|104.23,93.09 106.97,93.77 109.4,95.24 111.32,97.31 112.59,99.85 113.4,102.57 114.13,105.32 114.87,108.06 115.62,110.8 116.37,113.54 117.14,116.28 117.9,119.02 118.67,121.75 119.45,124.49 120.23,127.22 121.03,129.95 121.83,132.68 122.6,135.41 122.98,138.22 122.57,141.02 121.34,143.57 119.44,145.67 117.05,147.19 114.34,148.04 111.51,148.14 108.77,147.45 106.33,146.01 104.38,143.96 103.07,141.44 102.21,138.73 101.43,136 100.65,133.27 99.87,130.53 99.09,127.8 98.32,125.06 97.55,122.33 96.79,119.59 96.04,116.85 95.28,114.11 94.53,111.37 93.79,108.62 93.05,105.88 92.73,103.07 93.18,100.27 94.42,97.72 96.32,95.62 98.7,94.08 101.4,93.21","108.14,135.9 111.13,136.06 114.08,136.56 116.95,137.39 119.71,138.55 122.31,140.03 124.71,141.81 126.86,143.89 128.73,146.23 130.27,148.8 131.44,151.55 132.22,154.44 132.56,157.41 132.47,160.4 131.93,163.34 130.96,166.17 129.6,168.83 127.87,171.28 125.83,173.46 123.51,175.35 120.96,176.91 118.23,178.13 115.36,179 112.42,179.52 109.43,179.7 106.44,179.54 103.49,179.04 100.62,178.21 97.86,177.06 95.26,175.58 92.86,173.79 90.71,171.71 88.84,169.37 87.3,166.81 86.13,164.06 85.35,161.17 85.01,158.2 85.11,155.21 85.64,152.26 86.61,149.43 87.97,146.77 89.7,144.33 91.74,142.14 94.06,140.25 96.61,138.69 99.34,137.47 102.21,136.6 105.15,136.08|175.67,128.81 177.16,128.85 178.62,129.14 180.01,129.67 181.28,130.44 182.41,131.42 183.36,132.57 184.12,133.85 184.68,135.23 185.05,136.68 185.24,138.15 185.27,139.64 185.13,141.13 184.85,142.59 184.42,144.02 183.85,145.4 183.15,146.72 182.33,147.96 181.38,149.11 180.32,150.16 179.15,151.08 177.88,151.87 176.53,152.49 175.1,152.91 173.62,153.11 172.13,153.07 170.67,152.78 169.28,152.24 168.01,151.47 166.88,150.49 165.93,149.35 165.18,148.06 164.61,146.68 164.24,145.24 164.05,143.76 164.02,142.27 164.16,140.78 164.44,139.32 164.87,137.89 165.44,136.51 166.14,135.2 166.96,133.95 167.91,132.8 168.97,131.75 170.14,130.83 171.4,130.04 172.76,129.43 174.19,129.01","103.39,78.25 106.56,78.38 109.59,79.28 112.29,80.94 114.43,83.28 115.86,86.1 116.52,89.2 116.32,92.37 115.62,95.46 114.86,98.55 114.1,101.63 113.36,104.72 112.63,107.81 111.91,110.91 111.2,114.01 110.51,117.1 109.82,120.21 109.16,123.31 108.52,126.42 107.84,129.53 106.8,132.52 105.04,135.16 102.66,137.25 99.81,138.63 96.7,139.2 93.54,138.96 90.53,137.95 87.87,136.24 85.71,133.92 84.21,131.13 83.48,128.05 83.5,124.88 84,121.74 84.7,118.64 85.4,115.54 86.08,112.44 86.77,109.34 87.48,106.24 88.19,103.15 88.92,100.05 89.66,96.96 90.41,93.88 91.18,90.8 91.95,87.71 93.1,84.76 94.95,82.19 97.4,80.19 100.28,78.86|161.99,91.57 165.07,92 167.9,93.28 170.32,95.23 172.22,97.69 173.49,100.53 174.05,103.59 173.93,106.7 173.45,109.78 172.9,112.85 172.33,115.91 171.71,118.97 171.06,122.02 170.38,125.06 169.66,128.09 168.91,131.12 168.13,134.14 167.33,137.15 166.5,140.16 165.58,143.14 164.33,145.98 162.5,148.5 160.15,150.53 157.38,151.95 154.34,152.61 151.24,152.43 148.32,151.38 145.83,149.52 143.99,147.01 142.95,144.08 142.73,140.98 143.25,137.91 144.09,134.91 144.94,131.91 145.76,128.9 146.54,125.89 147.29,122.86 148.01,119.83 148.69,116.79 149.34,113.74 149.95,110.68 150.54,107.62 151.09,104.55 151.6,101.47 152.44,98.48 154,95.79 156.21,93.6 158.94,92.12","47.23,91.05 51.61,92.47 55.26,95.29 57.96,99.03 59.7,103.31 60.56,107.85 61.28,112.42 62.11,116.97 63.06,121.51 64.11,126.01 65.28,130.49 66.56,134.94 67.95,139.35 69.44,143.73 71.05,148.07 72.77,152.37 74.62,156.61 76.52,160.83 78.06,165.19 78.52,169.78 77.62,174.3 75.2,178.22 71.44,180.86 66.96,181.91 62.36,181.55 57.99,180.06 54.03,177.68 50.59,174.58 47.77,170.92 45.62,166.83 43.74,162.6 41.96,158.33 40.29,154.01 38.72,149.66 37.27,145.26 35.93,140.83 34.69,136.37 33.56,131.88 32.55,127.37 31.65,122.83 30.85,118.27 30.2,113.69 30.08,109.07 30.85,104.51 32.49,100.19 35.01,96.32 38.44,93.24 42.64,91.35|108.93,73.38 113.76,73.6 118.38,75.01 122.49,77.56 125.82,81.07 128.1,85.34 129.65,89.93 131.04,94.58 132.43,99.22 133.82,103.87 135.22,108.51 136.6,113.16 137.99,117.81 139.36,122.46 140.73,127.11 142.13,131.76 143.51,136.41 144.82,141.08 145.51,145.86 144.91,150.66 143.09,155.14 140.17,158.99 136.38,162.01 132,164.05 127.26,165.03 122.42,164.86 117.79,163.48 113.67,160.95 110.36,157.43 108.17,153.11 106.72,148.49 105.36,143.83 103.99,139.18 102.62,134.53 101.24,129.88 99.87,125.23 98.48,120.58 97.09,115.93 95.7,111.29 94.29,106.64 92.89,102 91.49,97.36 90.81,92.57 91.38,87.77 93.14,83.26 96.02,79.37 99.79,76.34 104.18,74.32","102.86,129.56 106.39,129.96 109.85,130.76 113.21,131.94 116.4,133.5 119.39,135.42 122.13,137.69 124.56,140.28 126.64,143.16 128.33,146.29 129.59,149.61 130.37,153.08 130.66,156.62 130.43,160.16 129.68,163.63 128.42,166.96 126.7,170.07 124.54,172.89 122.02,175.39 119.18,177.52 116.07,179.25 112.76,180.54 109.31,181.4 105.78,181.82 102.23,181.83 98.7,181.42 95.24,180.62 91.88,179.44 88.69,177.88 85.7,175.96 82.96,173.69 80.53,171.1 78.45,168.22 76.76,165.1 75.5,161.77 74.72,158.31 74.44,154.77 74.67,151.22 75.41,147.75 76.67,144.42 78.39,141.32 80.55,138.49 83.07,135.99 85.91,133.86 89.02,132.14 92.33,130.84 95.78,129.99 99.31,129.56|180.44,141.06 183.61,141.1 186.72,141.68 189.66,142.86 192.28,144.63 194.43,146.96 196,149.71 197,152.72 197.48,155.86 197.51,159.03 197.15,162.18 196.43,165.27 195.38,168.26 194.07,171.15 192.52,173.92 190.74,176.55 188.77,179.03 186.6,181.35 184.25,183.48 181.74,185.41 179.06,187.12 176.23,188.56 173.28,189.71 170.21,190.52 167.07,190.95 163.9,190.91 160.78,190.33 157.84,189.15 155.22,187.37 153.08,185.04 151.51,182.29 150.51,179.28 150.03,176.15 150,172.98 150.36,169.83 151.07,166.74 152.12,163.74 153.43,160.85 154.99,158.09 156.76,155.46 158.74,152.98 160.91,150.66 163.25,148.53 165.77,146.59 168.45,144.89 171.27,143.45 174.23,142.3 177.29,141.48","86.02,131.33 88.42,131.69 90.54,132.87 92.12,134.71 93.03,136.97 93.17,139.39 92.41,141.69 90.78,143.48 88.59,144.52 86.19,144.97 83.78,145.34 81.37,145.72 78.96,146.09 76.54,146.45 74.13,146.81 71.72,147.16 69.3,147.5 66.88,147.84 64.47,148.16 62.05,148.47 59.62,148.76 57.2,149.03 54.77,149.27 52.34,149.49 49.91,149.68 47.53,149.28 45.52,147.92 44.04,145.99 43.12,143.74 42.85,141.32 43.44,138.97 45.04,137.17 47.33,136.4 49.76,136.2 52.19,135.96 54.62,135.7 57.04,135.43 59.46,135.15 61.89,134.85 64.31,134.54 66.72,134.22 69.14,133.89 71.56,133.54 73.97,133.19 76.38,132.83 78.79,132.45 81.2,132.06 83.61,131.67|153.42,116.84 155.92,117.69 157.78,119.56 158.72,122.03 158.73,124.68 157.84,127.18 156.08,129.15 153.71,130.33 151.13,131 148.55,131.65 145.98,132.32 143.4,132.98 140.82,133.63 138.23,134.27 135.65,134.9 133.06,135.53 130.47,136.15 127.88,136.76 125.29,137.36 122.69,137.94 120.09,138.51 117.49,139.06 114.88,139.59 112.27,140.1 109.62,140.12 107.17,139.14 105.28,137.29 104.18,134.88 104.06,132.23 105.03,129.78 106.92,127.93 109.35,126.87 111.96,126.34 114.57,125.8 117.17,125.24 119.77,124.67 122.37,124.09 124.96,123.5 127.56,122.9 130.15,122.29 132.74,121.68 135.32,121.05 137.91,120.41 140.49,119.76 143.07,119.11 145.65,118.44 148.22,117.76 150.78,117.03","83.36,65.84 86.61,66.42 89.57,67.88 92,70.12 93.67,72.97 94.46,76.17 94.31,79.47 93.61,82.71 92.8,85.92 92.02,89.14 91.27,92.36 90.56,95.6 89.88,98.84 89.23,102.09 88.62,105.34 88.03,108.61 87.51,111.88 87.01,115.15 86.5,118.42 85.65,121.62 84.11,124.54 81.9,126.99 79.13,128.79 75.98,129.8 72.68,129.91 69.47,129.13 66.6,127.49 64.24,125.18 62.49,122.38 61.42,119.25 61.08,115.97 61.36,112.67 61.87,109.4 62.45,106.13 63.01,102.87 63.61,99.61 64.24,96.36 64.9,93.11 65.6,89.87 66.33,86.64 67.09,83.42 67.89,80.2 68.73,77 69.89,73.9 71.7,71.14 74.1,68.86 76.93,67.16 80.07,66.12|119.49,99.16 121.99,99.28 124.44,99.82 126.9,100.34 129.36,100.86 131.81,101.38 134.27,101.91 136.72,102.44 139.17,102.98 141.62,103.52 144.08,104.07 146.52,104.62 148.97,105.18 151.42,105.74 153.86,106.31 156.31,106.89 158.75,107.47 161.2,108.02 163.49,109.03 165.16,110.87 165.95,113.24 165.87,115.74 164.94,118.05 163.17,119.8 160.79,120.55 158.31,120.29 155.88,119.65 153.44,119.06 150.99,118.49 148.55,117.92 146.1,117.36 143.65,116.81 141.2,116.26 138.75,115.73 136.29,115.2 133.84,114.67 131.38,114.15 128.93,113.62 126.47,113.1 124.02,112.57 121.56,112.04 119.11,111.5 116.81,110.53 115.08,108.73 114.22,106.39 114.29,103.9 115.28,101.61 117.12,99.93","168.71,85.67 170.73,86 172.64,86.75 174.37,87.85 175.88,89.24 177.11,90.88 178.04,92.71 178.71,94.65 179.21,96.64 179.64,98.65 180.05,100.66 180.45,102.67 180.83,104.69 181.18,106.71 181.5,108.74 181.77,110.78 181.88,112.82 181.71,114.87 181.22,116.86 180.41,118.74 179.27,120.45 177.83,121.91 176.12,123.03 174.2,123.74 172.16,123.99 170.13,123.75 168.21,123.04 166.49,121.93 165.03,120.48 163.88,118.79 163.02,116.93 162.49,114.95 162.17,112.92 161.85,110.89 161.51,108.87 161.14,106.84 160.77,104.83 160.37,102.81 159.96,100.8 159.52,98.79 159.24,96.76 159.3,94.71 159.71,92.7 160.48,90.8 161.58,89.08 163.01,87.61 164.73,86.49 166.67,85.83|206.57,78.24 208.3,78.8 209.77,79.87 210.99,81.22 212.01,82.73 212.85,84.34 213.53,86.03 214.08,87.77 214.54,89.54 214.95,91.31 215.34,93.09 215.7,94.88 216.04,96.67 216.36,98.46 216.64,100.26 216.89,102.07 217.11,103.88 217.25,105.7 217.26,107.52 217.1,109.33 216.75,111.12 216.16,112.84 215.3,114.44 214.04,115.75 212.34,116.35 210.58,115.96 209.11,114.89 207.97,113.48 207.1,111.88 206.44,110.18 205.97,108.42 205.62,106.63 205.35,104.83 205.11,103.02 204.85,101.22 204.55,99.42 204.22,97.63 203.87,95.84 203.49,94.05 203.09,92.28 202.67,90.5 202.32,88.71 202.1,86.91 202.1,85.08 202.32,83.28 202.77,81.51 203.54,79.86 204.82,78.59","39.78,104.3 42.64,105.01 45.03,106.74 46.73,109.15 47.75,111.93 48.35,114.83 48.81,117.76 49.31,120.68 49.87,123.6 50.48,126.5 51.15,129.39 51.86,132.27 52.63,135.13 53.44,137.98 54.3,140.82 55.19,143.65 56.13,146.46 57.1,149.26 58.1,152.05 58.86,154.92 58.96,157.87 58.18,160.72 56.43,163.09 53.84,164.48 50.9,164.62 48.08,163.75 45.58,162.16 43.51,160.05 41.89,157.57 40.67,154.87 39.67,152.08 38.73,149.26 37.81,146.44 36.94,143.61 36.11,140.76 35.34,137.9 34.61,135.03 33.92,132.14 33.28,129.24 32.7,126.34 32.16,123.42 31.67,120.5 31.23,117.57 31.14,114.61 31.65,111.69 32.74,108.94 34.47,106.54 36.89,104.86|108.97,125.73 111.9,126.2 114.63,127.37 117,129.16 118.84,131.49 119.99,134.23 120.32,137.18 119.85,140.11 118.59,142.8 116.78,145.16 114.84,147.42 112.89,149.67 110.93,151.92 108.97,154.16 107.01,156.39 105.03,158.62 103.05,160.85 101.07,163.06 99.07,165.28 97.09,167.5 95.09,169.71 93.05,171.88 90.69,173.67 87.89,174.66 84.93,174.81 82.02,174.22 79.31,173 76.92,171.24 74.99,168.98 73.7,166.3 73.26,163.37 73.74,160.45 75.2,157.86 77.17,155.63 79.18,153.43 81.18,151.23 83.17,149.02 85.16,146.8 87.14,144.58 89.11,142.35 91.08,140.11 93.04,137.87 95,135.63 96.95,133.38 98.89,131.12 100.87,128.89 103.25,127.12 106.02,126.04","115.43,87.59 118.19,88.24 120.69,89.59 122.69,91.59 124.03,94.09 124.63,96.87 124.41,99.7 123.7,102.45 122.9,105.18 122.12,107.92 121.34,110.65 120.57,113.39 119.79,116.13 119.02,118.87 118.25,121.61 117.48,124.35 116.72,127.09 115.97,129.83 115.23,132.58 114.45,135.32 113.3,137.91 111.49,140.09 109.13,141.65 106.41,142.48 103.58,142.56 100.82,141.91 98.33,140.54 96.33,138.53 94.99,136.03 94.38,133.26 94.57,130.43 95.25,127.67 96.02,124.93 96.79,122.19 97.55,119.45 98.31,116.7 99.08,113.96 99.85,111.22 100.62,108.49 101.4,105.75 102.18,103.01 102.95,100.27 103.74,97.54 104.51,94.8 105.68,92.21 107.5,90.04 109.88,88.5 112.59,87.67|155.37,78.64 158.04,79.15 160.48,80.37 162.53,82.16 164.33,84.22 166.1,86.3 167.85,88.4 169.58,90.51 171.29,92.64 172.98,94.78 174.65,96.94 176.3,99.12 177.92,101.32 179.51,103.54 181.06,105.79 182.57,108.07 184.03,110.37 185.2,112.83 185.77,115.5 185.73,118.23 185.07,120.87 183.8,123.28 181.94,125.26 179.57,126.6 176.89,127.03 174.24,126.43 171.99,124.92 170.26,122.8 168.75,120.53 167.22,118.27 165.66,116.03 164.07,113.81 162.45,111.6 160.82,109.41 159.16,107.25 157.47,105.1 155.76,102.97 154.03,100.85 152.28,98.76 150.51,96.68 148.74,94.6 147.29,92.29 146.49,89.69 146.36,86.97 146.94,84.31 148.23,81.91 150.19,80.02 152.66,78.89","92.71,76.24 95.76,76.59 98.73,77.35 101.56,78.53 104.21,80.08 106.63,81.96 108.78,84.16 110.61,86.62 112.09,89.31 113.19,92.17 113.91,95.15 114.24,98.2 114.18,101.27 113.73,104.31 112.9,107.26 111.7,110.09 110.15,112.73 108.28,115.17 106.12,117.35 103.71,119.24 101.08,120.83 98.27,122.07 95.33,122.95 92.3,123.44 89.23,123.51 86.18,123.17 83.21,122.41 80.38,121.23 77.73,119.69 75.31,117.8 73.16,115.61 71.33,113.14 69.86,110.45 68.75,107.59 68.02,104.61 67.7,101.56 67.76,98.49 68.22,95.46 69.05,92.5 70.25,89.68 71.8,87.03 73.67,84.59 75.83,82.41 78.24,80.52 80.87,78.93 83.67,77.69 86.61,76.81 89.64,76.32|157.73,102.08 159.31,102.13 160.86,102.42 162.35,102.95 163.74,103.69 165.01,104.62 166.15,105.72 167.13,106.95 167.96,108.29 168.63,109.72 169.13,111.22 169.45,112.76 169.59,114.34 169.55,115.91 169.31,117.47 168.88,118.99 168.28,120.45 167.52,121.83 166.58,123.1 165.48,124.23 164.25,125.22 162.89,126.02 161.43,126.63 159.91,127.02 158.34,127.2 156.76,127.14 155.21,126.85 153.73,126.33 152.33,125.59 151.06,124.65 149.93,123.56 148.94,122.33 148.11,120.99 147.44,119.56 146.95,118.06 146.62,116.51 146.48,114.94 146.52,113.37 146.76,111.8 147.18,110.28 147.78,108.83 148.56,107.45 149.5,106.18 150.59,105.05 151.83,104.07 153.18,103.26 154.64,102.65 156.17,102.26","57.98,112.03 61.01,112.26 63.82,113.41 66.22,115.27 68.09,117.67 69.36,120.44 70.14,123.39 70.64,126.39 71.07,129.41 71.58,132.42 72.15,135.41 72.76,138.4 73.4,141.38 74.09,144.35 74.82,147.31 75.59,150.26 76.42,153.2 77.3,156.12 78.16,159.04 78.68,162.04 78.42,165.07 77.28,167.88 75.25,170.13 72.54,171.49 69.52,171.87 66.51,171.44 63.69,170.32 61.16,168.61 59.03,166.44 57.38,163.89 56.23,161.06 55.34,158.15 54.53,155.21 53.73,152.27 52.97,149.31 52.25,146.35 51.57,143.38 50.93,140.4 50.34,137.41 49.78,134.41 49.26,131.4 48.78,128.39 48.37,125.37 48.37,122.33 49.06,119.36 50.44,116.65 52.47,114.39 55.04,112.78|117.45,101.46 120.57,101.84 123.48,103.02 125.99,104.91 127.97,107.35 129.25,110.23 130.05,113.27 130.76,116.34 131.46,119.41 132.15,122.49 132.85,125.56 133.55,128.63 134.24,131.71 134.93,134.78 135.61,137.86 136.32,140.93 137.01,144 137.66,147.09 137.87,150.22 137.25,153.3 135.83,156.1 133.73,158.45 131.15,160.23 128.22,161.38 125.11,161.83 121.98,161.5 119.05,160.37 116.52,158.51 114.57,156.05 113.37,153.14 112.64,150.08 111.95,147 111.27,143.93 110.58,140.85 109.89,137.78 109.2,134.7 108.51,131.63 107.81,128.56 107.12,125.48 106.42,122.41 105.71,119.34 105.02,116.27 104.83,113.13 105.42,110.04 106.79,107.22 108.84,104.83 111.41,103.02 114.33,101.87","113.75,120.08 118.16,120.78 122.31,122.43 125.98,124.96 128.94,128.29 131.02,132.23 132.12,136.56 132.1,141.02 131.16,145.38 129.94,149.68 128.69,153.98 127.44,158.27 126.19,162.56 124.92,166.85 123.64,171.14 122.35,175.42 121.05,179.69 119.76,183.97 118.46,188.25 117.05,192.49 114.84,196.36 111.47,199.27 107.42,201.12 103.04,201.99 98.58,201.97 94.18,201.19 89.97,199.7 86.1,197.48 82.8,194.48 80.41,190.72 79.31,186.41 79.87,182 81.24,177.74 82.57,173.47 83.88,169.2 85.19,164.92 86.48,160.64 87.75,156.36 89.02,152.07 90.28,147.78 91.53,143.49 92.77,139.19 93.97,134.88 95.5,130.69 97.93,126.95 101.16,123.87 105.02,121.64 109.3,120.36|181.19,127.71 185.4,128.03 189.23,129.79 192.19,132.8 194.06,136.59 194.87,140.74 194.76,144.98 194.21,149.18 193.55,153.37 192.79,157.55 191.91,161.69 190.91,165.82 189.8,169.91 188.57,173.97 187.22,177.99 185.72,181.96 184.07,185.87 182.26,189.7 180.26,193.44 177.85,196.92 174.93,199.99 171.62,202.64 168,204.85 164.13,206.59 160.07,207.78 155.86,208.24 151.69,207.6 148.31,205.16 147.33,201.11 148.48,197.06 150.4,193.28 152.24,189.46 153.93,185.56 155.48,181.61 156.89,177.62 158.17,173.57 159.32,169.49 160.35,165.38 161.26,161.23 162.06,157.07 162.7,152.87 163.29,148.67 164.12,144.52 165.46,140.5 167.49,136.78 170.16,133.49 173.37,130.73 177.08,128.7","52.43,111.88 55.76,112.3 59,113.21 62.08,114.57 64.96,116.3 67.61,118.36 70.01,120.71 72.16,123.3 74.02,126.1 75.61,129.06 76.9,132.17 77.89,135.38 78.56,138.68 78.89,142.02 78.86,145.39 78.45,148.72 77.63,151.98 76.39,155.11 74.74,158.03 72.67,160.68 70.2,162.96 67.38,164.79 64.28,166.08 61,166.78 57.64,166.91 54.3,166.49 51.07,165.57 47.99,164.22 45.11,162.49 42.46,160.42 40.05,158.07 37.91,155.48 36.04,152.68 34.46,149.72 33.16,146.62 32.17,143.4 31.51,140.11 31.18,136.76 31.21,133.4 31.62,130.06 32.44,126.8 33.67,123.68 35.33,120.75 37.4,118.1 39.86,115.82 42.68,114 45.79,112.71 49.07,112.01|126.89,95.19 130.56,95.44 134.16,96.17 137.64,97.36 140.94,98.99 143.98,101.06 146.73,103.5 149.13,106.29 151.14,109.37 152.72,112.69 153.86,116.19 154.54,119.8 154.74,123.47 154.45,127.14 153.67,130.74 152.43,134.2 150.76,137.48 148.69,140.51 146.25,143.27 143.48,145.69 140.43,147.75 137.14,149.39 133.66,150.59 130.06,151.32 126.39,151.56 122.72,151.31 119.11,150.59 115.63,149.4 112.34,147.76 109.29,145.7 106.54,143.26 104.14,140.47 102.13,137.39 100.55,134.07 99.41,130.57 98.73,126.96 98.53,123.28 98.83,119.62 99.6,116.02 100.84,112.56 102.51,109.28 104.59,106.25 107.03,103.49 109.79,101.07 112.84,99.01 116.13,97.36 119.61,96.16 123.22,95.43","72.34,79.33 74.93,79.64 77.52,79.94 80.12,80.25 82.71,80.57 85.3,80.91 87.88,81.26 90.47,81.63 93.05,82 95.63,82.39 98.21,82.79 100.79,83.21 103.37,83.63 105.94,84.07 108.51,84.52 111.09,84.92 113.65,85.44 115.99,86.56 117.75,88.47 118.68,90.89 118.57,93.48 117.47,95.83 115.57,97.6 113.16,98.56 110.56,98.58 108,98.1 105.43,97.64 102.85,97.19 100.28,96.76 97.7,96.33 95.12,95.93 92.54,95.53 89.96,95.14 87.38,94.77 84.79,94.4 82.2,94.06 79.62,93.72 77.02,93.41 74.43,93.11 71.84,92.81 69.24,92.5 66.78,91.69 64.99,89.83 64.25,87.35 64.5,84.76 65.58,82.39 67.38,80.53 69.74,79.45|136.83,90.25 139.33,90.71 141.8,91.34 144.28,91.93 146.75,92.53 149.22,93.14 151.69,93.77 154.15,94.4 156.62,95.05 159.08,95.71 161.53,96.38 163.98,97.07 166.43,97.76 168.88,98.47 171.32,99.2 173.75,99.94 176.19,100.67 178.49,101.74 180.18,103.62 181.12,105.98 181.31,108.51 180.69,110.96 179.21,113.01 176.98,114.19 174.46,114.13 172.02,113.41 169.58,112.66 167.14,111.93 164.7,111.22 162.25,110.52 159.8,109.84 157.34,109.17 154.88,108.52 152.42,107.88 149.95,107.26 147.48,106.64 145.01,106.03 142.54,105.42 140.06,104.81 137.59,104.21 135.12,103.61 132.78,102.62 130.96,100.86 129.93,98.55 129.77,96.02 130.49,93.59 132.06,91.61 134.31,90.46","107.05,116.19 110.26,116.71 113.26,118 115.85,119.97 117.92,122.49 119.29,125.45 120.04,128.63 120.54,131.86 121.04,135.09 121.54,138.31 122.06,141.54 122.59,144.77 123.12,147.99 123.67,151.21 124.22,154.43 124.8,157.65 125.4,160.86 125.95,164.08 126.04,167.34 125.2,170.49 123.53,173.28 121.14,175.49 118.26,177.02 115.11,177.87 111.85,178.04 108.63,177.56 105.58,176.41 102.87,174.58 100.72,172.14 99.35,169.18 98.61,166 98.04,162.78 97.47,159.57 96.91,156.35 96.36,153.13 95.83,149.9 95.3,146.68 94.78,143.45 94.27,140.22 93.76,137 93.26,133.77 92.82,130.53 92.96,127.27 93.87,124.15 95.55,121.35 97.88,119.07 100.68,117.41 103.79,116.44|189.21,121.96 191.36,122.71 192.8,124.5 193.41,126.73 193.32,129.04 192.59,131.23 191.22,133.09 189.28,134.34 187.12,135.19 184.95,136 182.78,136.83 180.61,137.63 178.43,138.43 176.24,139.2 174.05,139.95 171.85,140.69 169.64,141.4 167.43,142.09 165.21,142.76 162.98,143.42 160.75,144.05 158.51,144.66 156.27,145.25 154.02,145.81 151.72,145.98 149.57,145.18 148.01,143.49 147.25,141.31 147.31,139 148.16,136.86 149.7,135.14 151.74,134.05 153.97,133.43 156.21,132.84 158.45,132.22 160.68,131.59 162.91,130.93 165.13,130.26 167.34,129.58 169.55,128.87 171.76,128.15 173.95,127.41 176.15,126.65 178.33,125.87 180.51,125.08 182.68,124.26 184.84,123.41 186.98,122.53","98.62,121.53 100.72,121.6 102.78,122.03 104.72,122.83 106.49,123.97 108.01,125.42 109.24,127.12 110.15,129.02 110.66,131.05 110.78,133.15 110.62,135.25 110.34,137.33 110.04,139.42 109.76,141.5 109.49,143.59 109.21,145.68 108.92,147.76 108.6,149.84 108.08,151.88 107.18,153.78 105.92,155.45 104.34,156.83 102.51,157.86 100.51,158.52 98.43,158.81 96.33,158.72 94.28,158.27 92.33,157.47 90.57,156.33 89.03,154.89 87.78,153.21 86.85,151.32 86.29,149.3 86.13,147.2 86.28,145.11 86.57,143.02 86.9,140.94 87.2,138.86 87.49,136.78 87.79,134.69 88.08,132.61 88.4,130.53 88.96,128.5 89.88,126.61 91.15,124.94 92.73,123.56 94.56,122.52 96.54,121.84|155.31,127.29 157.36,127.43 159.33,127.99 161.14,128.96 162.7,130.29 163.95,131.92 164.84,133.77 165.35,135.75 165.49,137.8 165.35,139.85 165.07,141.89 164.79,143.92 164.53,145.96 164.26,148 163.97,150.04 163.65,152.06 163.27,154.09 162.7,156.06 161.83,157.92 160.68,159.62 159.29,161.13 157.69,162.41 155.9,163.42 153.97,164.1 151.94,164.41 149.89,164.32 147.9,163.82 146.06,162.92 144.47,161.62 143.24,159.98 142.41,158.1 142,156.09 142.01,154.04 142.32,152.01 142.64,149.98 142.96,147.95 143.25,145.92 143.51,143.88 143.73,141.83 143.97,139.79 144.27,137.76 144.74,135.76 145.53,133.87 146.62,132.13 147.98,130.59 149.57,129.28 151.35,128.27 153.28,127.58"],SD=Sse.map(e=>e.split("|").map(t=>t.split(" ").map(a=>{const[o,i]=a.split(",");return[Number(o),Number(i)]}))),tx=e=>{let t=0,a=0;for(const o of e)t+=o[0],a+=o[1];return[t/e.length,a/e.length]},ch=SD.map(e=>{const t=tx(e[0]),a=tx(e[1]);return[(t[0]+a[0])/2-T7[0],(t[1]+a[1])/2-T7[1]]}),xy=SD.map((e,t)=>e.map(a=>a.map(o=>[o[0]-ch[t][0],o[1]-ch[t][1]]))),Uk=xy.length,Vk=[[14,3,20,0],[13,1,20,0],[25,14,13,0],[11,4,18,0],[16,-2,22,0],[15,-3,20,6],[12,2,20,0],[17,-7,18,0],[15,5,20,0],[12,3,20,0],[14,1,20,0],[23,12,13,0],[12,2,20,0],[16,-3,22,0],[15,-2,20,-6],[12,5,20,0],[16,-4,18,0],[20,11,18,0],[11,2,20,0],[17,8,20,0],[15,5,10,0],[12,4,18,0],[16,-3,22,0],[15,-5,20,7],[11,6,20,0]],Cse=7.5;function jse(e,t){const a=tx(e[0]),o=tx(e[1]),i=Math.atan2(o[1]-a[1],o[0]-a[0]);let s=0;for(const c of e){let d=1/0,p=-1/0;for(const h of c)h[1]<d&&(d=h[1]),h[1]>p&&(p=h[1]);s=Math.max(s,(p-d)/2)}const r=s+t[2];return{x:(a[0]+o[0])/2-Math.sin(i)*r,y:(a[1]+o[1])/2+Math.cos(i)*r,angle:i+t[3]*Math.PI/180}}const{id:lEe,...Nse}=nS.cursor,Ase=Nse,Mse=["#9FE6B5","#3FAE6E","#1C7A4C"],Ise=`-15 -15 ${$u+30} ${$u+30}`,hb=114.2705,gb=105,Pse={sleeping:{pulse:[.028,4600],tilt:2},waking:{enter:[.92,700],pulse:[.03,2200]},idle:{pulse:[.014,3600]},listening:{bob:[2,2600],pulse:[.012,2600]},thinking:{sway:[1.6,3e3],pulse:[.01,3e3]},searching:{bob:[3,1400],sway:[2.2,1400]},working:{bob:[2.5,900],squash:.22},excited:{bob:[9,520],sway:[3,1040],squash:.35},surprised:{enter:[1.14,340],jitter:[.8,120]},suspicious:{sway:[2.4,2600],tilt:-3},angry:{jitter:[1.3,95],tilt:2},drowsy:{pulse:[.026,5e3],tilt:3},happy:{bob:[5,820],squash:.28},curious:{sway:[3.4,1900],tilt:-4},confused:{sway:[3,2200]},bored:{pulse:[.016,5200],tilt:2},proud:{bob:[1.6,2400],pulse:[.02,2400]},shy:{pulse:[.016,3e3],tilt:4},sad:{pulse:[.02,4600],tilt:3},laughing:{bob:[7,430],squash:.4},scared:{jitter:[2.2,75]},playful:{bob:[6,620],sway:[5,1240],squash:.3},celebrate:{bob:[10,480],sway:[4,960],squash:.35},orbit:{circle:[6,3200]},radar:{sway:[6,2400],pulse:[.012,2400]},progress:{pulse:[.022,1600]},spawning:{enter:[.02,820],pulse:[.014,3600]},humming:{pulse:[.016,2800]},loading:{sway:[2.2,1500],pulse:[.012,1500]},dictating:{bob:[2,2e3]},writing:{bob:[1.6,1100]},sending:{bob:[3,900]},receiving:{bob:[3,900]},uploading:{bob:[3,1e3]},notifying:{bob:[4,700],sway:[2.5,700]},alerting:{jitter:[2.6,85]},dragging:{tilt:-6,sway:[2,900]},bouncing:{bob:[12,560],squash:.45},"powering-down":{settle:.05,tilt:4}},Tse=1400,Q2=Math.PI*2,dh=e=>{const t=Math.sin(e*127.1+311.7)*43758.5453;return t-Math.floor(t)},E7=["#F472B6","#C084FC","#818CF8","#38BDF8","#34D399","#FACC15","#FB7185"],R7=["#4ADE80","#34D399","#22D3EE","#60A5FA"],D7='<path fill="{{GRADIENT}}" d="M99 58 Q99 43 114.3 43 Q129.6 43 129.6 58 L123 150 Q122 161 114.3 161 Q106.6 161 105.6 150 Z"/><circle fill="{{GRADIENT}}" cx="114.3" cy="188" r="15"/>',Bse='<path fill="none" stroke="{{GRADIENT}}" stroke-width="19" stroke-linecap="round" d="M88 76 A27 27 0 1 1 114.3 112 L114.3 132"/><circle fill="{{GRADIENT}}" cx="114.3" cy="170" r="13"/>',Ese={celebrate:{confetti:{count:16,period:1500,life:1300,origin:74,spread:54}},excited:{confetti:{count:9,period:2e3,life:1100,origin:72,spread:44}},laughing:{confetti:{count:7,period:2400,life:1e3,origin:70,spread:38}},orbit:{trails:{count:3,period:2600,radius:128}},radar:{trails:{count:2,period:2e3,radius:132}},progress:{trails:{count:3,period:1800,radius:124}},loading:{trails:{count:2,period:2200,radius:126}},uploading:{trails:{count:2,period:1700,radius:122}},sending:{trails:{count:2,period:1500,radius:120}},receiving:{trails:{count:2,period:1500,radius:120}},alerting:{glyph:{markup:D7,period:2600,hold:1100}},notifying:{glyph:{markup:D7,period:4200,hold:900}},confused:{glyph:{markup:Bse,period:5200,hold:1200}}},Rse="http://www.w3.org/2000/svg";function CD(e,t){for(;e.childNodes.length>t;)e.removeChild(e.lastChild);for(;e.childNodes.length<t;){const a=document.createElementNS(Rse,"path");a.setAttribute("stroke-linecap","round"),a.setAttribute("fill","none"),e.appendChild(a)}return Array.from(e.querySelectorAll(":scope > path"))}function Dse(e,t,a,o,i,s){const r=CD(e,t.count);for(let c=0;c<t.count;c++){const d=r[c],p=dh(c+1),h=dh(c+41),g=dh(c+91),b=(a+g*t.period)%t.period/t.life*1;if(b>1){d.setAttribute("opacity","0");continue}const x=p*Q2,v=t.spread*(.45+h*.55)*(1-(1-b)*(1-b)),k=(t.origin+v)*o,S=34*o*b*b,N=i+Math.cos(x)*k,C=s+Math.sin(x)*k+S,j=11+h*12,M=x+(g-.5)*5*b,D=N+Math.cos(M)*j,A=C+Math.sin(M)*j,R=(p-.5)*j*.7,P=(N+D)/2-Math.sin(M)*R,O=(C+A)/2+Math.cos(M)*R;d.setAttribute("d",`M${N.toFixed(1)} ${C.toFixed(1)} Q${P.toFixed(1)} ${O.toFixed(1)} ${D.toFixed(1)} ${A.toFixed(1)}`),d.setAttribute("stroke",E7[c%E7.length]),d.setAttribute("stroke-width",(4+h*2.4).toFixed(1)),d.setAttribute("opacity",(b<.12?b/.12:1-(b-.12)/.88).toFixed(3))}}function Ose(e,t,a,o,i,s){const r=CD(e,t.count),c=12;for(let d=0;d<t.count;d++){const p=r[d],h=dh(d+3),g=dh(d+29),b=d%2===0?1:-1,x=t.period*(.8+h*.5),v=t.radius*o*(.78+g*.4),k=b*(a/x)*Q2+h*Q2,S=.85+g*.7;let N="";for(let C=0;C<=c;C++){const j=C/c,M=k+S*j,D=v*(1+Math.sin(j*Math.PI)*.14),A=i+Math.cos(M)*D,R=s+Math.sin(M)*D*.78;N+=(C===0?"M":"L")+A.toFixed(1)+" "+R.toFixed(1)}p.setAttribute("d",N),p.setAttribute("stroke",R7[d%R7.length]),p.setAttribute("stroke-width",(5+h*3).toFixed(1)),p.setAttribute("opacity","0.85")}}function zse(e,t){const a=t%e.period,o=e.period-e.hold;if(a<o)return 0;const i=a-o,s=e.hold-i;return Math.max(0,Math.min(1,Math.min(i,s)/200))}function Lse(e){const t=Ese[e.state],a=$u/2,o=e.strength;if(e.trails&&(t?.trails&&e.showEffects&&o>0?Ose(e.trails,t.trails,e.elapsed,o,a,a):e.trails.childNodes.length&&e.trails.replaceChildren()),e.confetti&&(t?.confetti&&e.showEffects&&o>0?Dse(e.confetti,t.confetti,e.elapsed,o,a,a):e.confetti.childNodes.length&&e.confetti.replaceChildren()),e.glyph&&e.bodyContent)if(t?.glyph&&e.showGlyphs){const i=zse(t.glyph,e.elapsed),s=t.glyph.markup.replace(/\{\{GRADIENT\}\}/g,e.paint);e.glyph.getAttribute("data-glyph")!==s&&(e.glyph.setAttribute("data-glyph",s),e.glyph.innerHTML=s),e.glyph.style.opacity=String(i);const r=.72+.28*i;e.glyph.setAttribute("transform",`translate(${a} ${a}) scale(${r.toFixed(3)}) translate(${-a} ${-a})`),e.bodyContent.style.opacity=String(1-i)}else e.glyph.getAttribute("data-glyph")&&(e.glyph.removeAttribute("data-glyph"),e.glyph.replaceChildren()),e.glyph.style.opacity="0",e.bodyContent.style.opacity="1"}const nx={sleeping:[22,13,4],waking:[13],idle:[6,0,8],listening:[1,10,19],thinking:[17,8,16,14,5],searching:[20,15,9,3,12,18],working:[10,7,16,11],excited:[2,17,21,3,11],surprised:[21,3],suspicious:[5,14,23],angry:[7,16],drowsy:[22,4,13],happy:[19,2,11,17],curious:[21,3,0,15],confused:[8,14,5],bored:[0,4,22],proud:[2,15,8],shy:[24,0,13],sad:[22,4,13],laughing:[2,11,17],scared:[21,3],playful:[2,17,11,8],celebrate:[2,8,17],orbit:[6,0,8],radar:[6,0,8],progress:[6,0,8],spawning:[3,0],humming:[6,0,8],loading:[6,0,8],dictating:[1,10,19],sending:[6,0,8],receiving:[19,0,8],uploading:[15,9,8],writing:[15,9],notifying:[21,3,0],alerting:[21,3],bouncing:[2,17],dragging:[3,15,0],"powering-down":[22,13]},Fse={sleeping:[6e3,1e4],waking:[800,800],idle:[9e3,16e3],listening:[2800,5e3],thinking:[2e3,3600],searching:[1e3,1800],working:[1800,3200],excited:[1100,2e3],surprised:[2500,4e3],suspicious:[2600,4500],angry:[2200,3800],drowsy:[4e3,8e3],happy:[2500,4500],curious:[1800,3200],confused:[2200,3800],bored:[3500,6e3],proud:[3500,6e3],shy:[3e3,5500],sad:[4e3,7e3],laughing:[1200,2400],scared:[900,1800],playful:[1500,3e3],celebrate:[1400,2600],orbit:[4e3,8e3],radar:[4e3,8e3],progress:[4e3,8e3],spawning:[1200,1200],humming:[5e3,9e3],loading:[6e3,1e4],dictating:[4e3,8e3],sending:[4e3,8e3],receiving:[4e3,8e3],uploading:[4e3,8e3],writing:[4e3,8e3],notifying:[1500,2600],alerting:[2e3,3600],bouncing:[3e3,6e3],dragging:[1600,3e3],"powering-down":[6e3,9e3]},_se={sleeping:null,waking:null,idle:[6e3,14e3],listening:[3e3,7e3],thinking:[3500,7e3],searching:[1600,4e3],working:[2800,5500],excited:[2e3,4e3],surprised:[1800,3500],suspicious:[4500,8e3],angry:[3500,7e3],drowsy:null,happy:[2500,5e3],curious:[2500,5500],confused:[2800,5500],bored:[4e3,8e3],proud:[3500,7e3],shy:[3e3,6e3],sad:[4e3,8e3],laughing:[2500,5e3],scared:[1200,3e3],playful:[2e3,4500],celebrate:[2200,4500],orbit:null,radar:null,progress:null,spawning:null,humming:[4e3,8e3],loading:null,dictating:null,sending:null,receiving:null,uploading:null,writing:null,notifying:[2e3,4e3],alerting:null,bouncing:null,dragging:[2200,4500],"powering-down":null},qse=e=>e in nx,Use=Object.keys(nx).filter(qse),ys=(e,t,a)=>Math.max(t,Math.min(a,e)),O7=()=>null,Vse=e=>"M"+e.map(t=>t[0].toFixed(2)+" "+t[1].toFixed(2)).join("L")+"Z",Hse=e=>e.map(t=>t.map(a=>[a[0],a[1]])),Gse=e=>{let t=0,a=0;for(const o of e)t+=o[0],a+=o[1];return[t/e.length,a/e.length]};function $se(e,t){const a=Math.cos(e.angle),o=Math.sin(e.angle),i=(d,p)=>[e.x+d*a-p*o,e.y+d*o+p*a],s=i(-t[0],0),r=i(0,t[1]),c=i(t[0],0);return"M"+s[0].toFixed(2)+" "+s[1].toFixed(2)+" Q"+r[0].toFixed(2)+" "+r[1].toFixed(2)+" "+c[0].toFixed(2)+" "+c[1].toFixed(2)}const Kse=e=>`translate(${e.x} ${e.y}) scale(${e.scale}) translate(-120 ${-122.5})`,Wse=e=>{const a=e-1;return 1+(1.7+1)*a*a*a+1.7*a*a},Jse=e=>e<.5?2*e*e:1-2*(1-e)*(1-e);function Yse(e,t,a){if(a<=0)return"";const o=$u/2,i=$u,s=(x,v=0)=>Math.sin(t/x*Math.PI*2+v);let r=0,c=0,d=e.tilt?e.tilt*a:0,p=1,h=1,g=1;if(e.bob){const[x,v]=e.bob,k=s(v);if(c-=x*a*k,e.squash){const S=e.squash*a*Math.max(0,-k);g=1-S*.5,h=1+S*.5}}if(e.circle){const[x,v]=e.circle;r+=x*a*s(v),c+=x*a*s(v,Math.PI/2)}if(e.sway){const[x,v]=e.sway;d+=x*a*s(v)}if(e.pulse){const[x,v]=e.pulse;p*=1+x*a*s(v)}if(e.jitter){const[x,v]=e.jitter;r+=x*a*s(v),c+=x*a*s(v*.63,1.1)}if(e.enter){const[x,v]=e.enter,k=t/v;p*=k>=1?1:x+(1-x)*Wse(Math.max(k,0))}if(e.settle!==void 0){const x=Math.min(Math.max(t/Tse,0),1);p*=1+(e.settle-1)*Jse(x)*a}const b=[];return(r||c)&&b.push(`translate(${r.toFixed(2)} ${c.toFixed(2)})`),d&&b.push(`rotate(${d.toFixed(2)} ${o} ${o})`),p!==1&&b.push(`translate(${o} ${o}) scale(${p.toFixed(4)}) translate(${-o} ${-o})`),(h!==1||g!==1)&&b.push(`translate(${o} ${i}) scale(${h.toFixed(4)} ${g.toFixed(4)}) translate(${-o} ${-i})`),b.join(" ")}const Zse=xa.forwardRef(function({state:t="idle",expression:a,size:o=160,gaze:i,turn:s=0,lookAround:r=.5,flip:c=!1,spring:d=7,eyeScale:p=1,showMouth:h=!0,mouthStroke:g=Cse,motion:b,effects:x=!0,glyphs:v=!0,autoBlink:k=!0,autoExpression:S=!0,paused:N=!1,silhouette:C=Ase,gradient:j=Mse,eyeColor:M="#ffffff",title:D,className:A,style:R},P){const O=f.useId(),T=f.useMemo(()=>"mascot"+O.replace(/[^a-zA-Z0-9]/g,""),[O]),z=f.useRef(null),B=f.useRef(null),L=f.useRef(null),G=f.useRef(null),K=f.useRef(null),H=f.useRef(null),U=f.useRef(null),Q=f.useRef(null),W=f.useMemo(()=>globalThis.window?.matchMedia?.("(prefers-reduced-motion: reduce)").matches??!1,[]),q=b??(W?0:1),Z=t,oe=f.useRef({current:Hse(xy[0]),target:xy[0],currentMouth:Vk[0].slice(),targetMouth:Vk[0],currentGaze:[...ch[0]],targetGaze:[...ch[0]],expression:0,morph:1,velocity:0,blinkStart:O7(),spinStart:O7(),spinDuration:900,last:0,stateStart:0,lastState:Z,lastBodyTransform:"",pausedPaint:"",props:{state:t,expression:a,gaze:i,turn:s,spring:d,eyeScale:p,paused:N,lookAround:r,motionStrength:q,effects:x,glyphs:v}});oe.current.props={state:t,expression:a,gaze:i,turn:s,spring:d,eyeScale:p,paused:N,lookAround:r,motionStrength:q,effects:x,glyphs:v};const _=ne=>{const ae=oe.current,je=(ne%Uk+Uk)%Uk;je===ae.expression&&ae.morph>=1||(ae.current=z7(ae),ae.currentMouth=L7(ae),ae.currentGaze=F7(ae),ae.target=xy[je],ae.targetMouth=Vk[je],ae.targetGaze=ch[je],ae.expression=je,ae.morph=0,ae.velocity=0)};xa.useImperativeHandle(P,()=>({blink:()=>{oe.current.blinkStart=performance.now()},spin:(ne=900)=>{oe.current.spinDuration=ne,oe.current.spinStart=performance.now()},setExpression:_}),[]),f.useEffect(()=>{_(a??nx[t][0])},[t,a]),f.useEffect(()=>{if(!S||a!==void 0||N)return;let ne;const ae=()=>{const[je,xe]=Fse[t];ne=setTimeout(()=>{const re=nx[t],Se=re.filter(Be=>Be!==oe.current.expression);_(Se.length?Se[Math.floor(Math.random()*Se.length)]:re[0]),ae()},je+Math.random()*(xe-je))};return ae(),()=>clearTimeout(ne)},[t,S,a,N]),f.useEffect(()=>{const ne=_se[t];if(!k||!ne||N)return;let ae;const je=()=>{ae=setTimeout(()=>{oe.current.blinkStart=performance.now(),je()},ne[0]+Math.random()*(ne[1]-ne[0]))};return je(),()=>clearTimeout(ae)},[t,k,N]),f.useEffect(()=>{let ne=0,ae;oe.current.last=performance.now();const je=(re,Se,Be)=>{const nt=re.props,ge=F7(re),Qe=nt.lookAround??.35,de=ge[0]*Qe,pe=ge[1]*Qe,ke=z7(re).map(st=>st.map(Ne=>[Ne[0]+de,Ne[1]+pe])),Ge=ys(nt.gaze?.x??0,-1,1)*B7.x,Ee=ys(nt.gaze?.y??0,-1,1)*B7.y,ce=((nt.turn??0)+Be)*Math.PI/180,Ue=nt.eyeScale??1,le=Qse(re,Se);ke.forEach((st,Ne)=>{const Je=Ne===0?z.current:B.current;if(!Je)return;const Me=Gse(st),et=Math.asin(ys((Me[0]-hb)/gb,-1,1)),ft=et+ce,yt=Math.cos(ft),At=Math.max(yt,.02)/Math.max(Math.cos(et),.02);Je.setAttribute("d",Vse(st)),Je.setAttribute("transform",`translate(${(hb+gb*Math.sin(ft)+Ge).toFixed(2)} ${(Me[1]+Ee).toFixed(2)}) scale(${ys(At*Ue,.02,2.4).toFixed(4)} ${ys(le*Ue,.02,2.4).toFixed(4)}) translate(${(-Me[0]).toFixed(2)} ${(-Me[1]).toFixed(2)})`),Je.style.opacity=yt>.02?"1":"0"});const Fe=L.current;if(Fe){const st=L7(re),Ne=jse(ke,st),Je=Math.asin(ys((Ne.x-hb)/gb,-1,1)),Me=Je+ce,et=Math.cos(Me),ft=Math.max(et,.02)/Math.max(Math.cos(Je),.02);Fe.setAttribute("d",$se(Ne,st)),Fe.setAttribute("transform",`translate(${(hb+gb*Math.sin(Me)+Ge).toFixed(2)} ${(Ne.y+Ee).toFixed(2)}) scale(${ys(ft,.02,2.4).toFixed(4)} 1) translate(${(-Ne.x).toFixed(2)} ${(-Ne.y).toFixed(2)})`),Fe.style.opacity=et>.02?"1":"0"}const tt=G.current;if(tt){nt.state!==re.lastState&&(re.lastState=nt.state,re.stateStart=Se);const st=Yse(Pse[nt.state]??{},Se-re.stateStart,nt.motionStrength??1);st!==re.lastBodyTransform&&(re.lastBodyTransform=st,st?tt.setAttribute("transform",st):tt.removeAttribute("transform"))}Lse({trails:H.current,confetti:U.current,glyph:Q.current,bodyContent:K.current,state:nt.state,elapsed:Se-re.stateStart,strength:nt.motionStrength??1,paint:he.current,showEffects:nt.effects!==!1,showGlyphs:nt.glyphs!==!1})},xe=re=>{const Se=oe.current,Be=Se.props;if(Be.paused){Se.last=re;const de=`${Be.state}|${Be.expression??""}|${he.current}`;Se.pausedPaint!==de&&(Se.pausedPaint=de,je(Se,re,0)),ae=setTimeout(()=>{ne=requestAnimationFrame(xe)},250);return}Se.pausedPaint="",ne=requestAnimationFrame(xe);const nt=Math.min((re-Se.last)/1e3,.1);Se.last=re;const ge=Be.spring??7;Se.velocity+=(-2*ge*Se.velocity-ge*ge*(Se.morph-1))*nt,Se.morph+=Se.velocity*nt,Number.isFinite(Se.morph)||(Se.morph=1,Se.velocity=0);let Qe=0;if(Se.spinStart!==null){const de=(re-Se.spinStart)/Se.spinDuration;de>=1?Se.spinStart=null:Qe=360*de}je(Se,re,Qe)};return ne=requestAnimationFrame(xe),()=>{cancelAnimationFrame(ne),ae!==void 0&&clearTimeout(ae)}},[]);const ue=`url(#${T}-grad)`,he=f.useRef(ue);he.current=ue;const we=o.constructor===Number?`${o}px`:o,ee=D===void 0?`${C.name} mascot`:D,Y=C.body.replace(/\{\{GRADIENT\}\}/g,`url(#${T}-grad)`);return n.jsxs("svg",{viewBox:Ise,width:we,height:we,className:A,style:R,role:ee?"img":void 0,"aria-label":ee??void 0,"aria-hidden":ee?void 0:!0,children:[n.jsxs("defs",{children:[n.jsxs("linearGradient",{id:`${T}-grad`,x1:"1",y1:"0",x2:"0",y2:"1",children:[n.jsx("stop",{offset:"0%",stopColor:j[0]}),n.jsx("stop",{offset:"55%",stopColor:j[1]}),n.jsx("stop",{offset:"100%",stopColor:j[2]})]}),n.jsx("clipPath",{id:`${T}-clip`,transform:C.fit||void 0,dangerouslySetInnerHTML:{__html:C.clip}})]}),n.jsxs("g",{transform:c?`translate(${$u} 0) scale(-1 1)`:void 0,children:[n.jsx("g",{ref:H}),n.jsxs("g",{ref:G,children:[n.jsxs("g",{ref:K,children:[n.jsx("g",{transform:C.fit||void 0,dangerouslySetInnerHTML:{__html:Y}}),n.jsx("g",{clipPath:`url(#${T}-clip)`,children:n.jsxs("g",{transform:Kse(C.anchor),children:[n.jsx("path",{ref:z,fill:M}),n.jsx("path",{ref:B,fill:M}),h&&n.jsx("path",{ref:L,fill:"none",stroke:M,strokeWidth:g,strokeLinecap:"round"})]})})]}),n.jsx("g",{ref:Q,style:{opacity:0}})]}),n.jsx("g",{ref:U})]})]})});function z7(e){const t=ys(e.morph,0,1);return e.current.map((a,o)=>a.map((i,s)=>[i[0]+(e.target[o][s][0]-i[0])*t,i[1]+(e.target[o][s][1]-i[1])*t]))}function L7(e){const t=ys(e.morph,0,1);return e.currentMouth.map((a,o)=>a+(e.targetMouth[o]-a)*t)}function F7(e){const t=ys(e.morph,0,1);return e.currentGaze.map((a,o)=>a+(e.targetGaze[o]-a)*t)}function Qse(e,t){if(e.blinkStart===null)return 1;const a=(t-e.blinkStart)/320;return a>=1?(e.blinkStart=null,1):Math.max(a<.42?1-a/.42:(a-.42)/.58,.04)}function Xse(e){return e.kind==="digest"||e.kind==="compaction"||e.kind==="session-divider"}function aS(e){if(e){for(let t=e.length-1;t>=0;t-=1)if(!Xse(e[t]))return e[t]}}const ere=Use,jD=["green","blue","red","orange","purple","cyan","pink","yellow","teal","coral"],nd={green:"#009957",blue:"#377FE6",red:"#D94B52",orange:"#E78531",purple:"#8057C8",cyan:"#0EA5C6",pink:"#D84F8B",yellow:"#D8A729",teal:"#01A492",coral:"#E5634E"},tre={deadpan:"idle",friendly:"happy",focused:"working",thinking:"thinking",excited:"excited",sleepy:"drowsy",surprised:"surprised",skeptical:"suspicious",worried:"scared",mischievous:"playful"},nre=new Set(ere);function Hl(e){return e?nre.has(e)?e:tre[e]??null:null}const are=["idle","happy","curious","drowsy","working","thinking","listening","sleeping","suspicious","proud"];function k0(e){const t=Hl(e.mascotExpression);if(t)return t;const a=aS(e.messages);if(a?.kind==="activity"&&a.tool?.ok===!1)return"alerting";if(e.busy)return"working";if(e.unread)return"notifying";if(a?.kind==="options")return"curious";const o=`${e.name} ${e.title??""} ${e.description??""}`.toLowerCase(),i=s=>s.test(o);return i(/\b(code|coding|developer|development|engineer|engineering|build|debug|program|software)\b/)?"working":i(/\b(research|researcher|search|investigate|strategy|strategist|study|learn|knowledge)\b/)?"searching":i(/\b(marketing|growth|launch|campaign|social|sales|outreach|brand)\b/)?"excited":i(/\b(overnight|night|background|async|queue|batch|long-running)\b/)?"drowsy":i(/\b(monitor|monitoring|incident|alert|watch|status|uptime)\b/)?"radar":i(/\b(review|reviewer|audit|critic|critique|quality|qa|test|legal)\b/)?"suspicious":i(/\b(security|secure|compliance|risk|privacy|finance|financial)\b/)?"scared":i(/\b(design|designer|creative|brainstorm|art|illustration|music|story)\b/)?"playful":i(/\b(support|help|success|onboarding|coach|teacher|guide|welcome)\b/)?"happy":"idle"}const ND=["mascot","circle","rounded","square"],ore=ui(ND),AD=Un().regex(/^\/api\/attachments\/[A-Za-z0-9-]+\.(?:png|jpg|gif|webp)$/,"must be a stored PNG, JPEG, GIF, or WebP attachment"),MD=N4,ire=[MD];function oS(e){const t=e.replaceAll("\\","/").split("/").pop();if(!t)return null;const a=`/api/attachments/${t}`;return AD.safeParse(a).success?a:null}function sre(e){const t={avatarCrop:ore.safeParse(e.avatarCrop).data??"mascot"},a=AD.safeParse(e.avatarUrl);return a.success?t.avatarUrl=a.data:typeof e.avatarUrl=="string"&&ire.includes(e.avatarUrl)&&(t.avatarUrl=e.avatarUrl),t}const uh=[{rotation:-18,color:"rgb(252 184 34)",period:4.6,phase:0},{rotation:46,color:"rgb(5 205 196)",period:5.4,phase:.33},{rotation:108,color:"rgb(247 75 32)",period:5,phase:.66}],fb=50,Hk=19,rre=2.75,bb=60,ID="(prefers-reduced-motion: reduce)";function _7(){try{return globalThis.window?.matchMedia?.(ID).matches??!1}catch{return!1}}function lre(e){const t=globalThis.window?.matchMedia?.(ID);return t?(t.addEventListener?.("change",e),()=>t.removeEventListener?.("change",e)):()=>{}}function PD(){return f.useSyncExternalStore(lre,_7,_7)}function cre(e){return uh.map(({period:t,phase:a})=>-((e/1e3/t+a)%1)*t)}function w0({size:e=100,className:t}){const a=PD(),[o]=f.useState(()=>cre(Date.now())),i=2.5*Math.min(1,e/100),s=6*Math.min(1,100/e);return n.jsxs("svg",{className:V("chibi-mark shrink-0 overflow-visible",t),width:e,height:e,viewBox:"-50 -50 100 100","aria-hidden":"true",focusable:"false","data-chibi-mark":a?"static":"animated",children:[!a&&uh.map((r,c)=>n.jsxs("g",{className:"chibi-mark-orbit",transform:`rotate(${r.rotation})`,children:[n.jsx("ellipse",{rx:fb,ry:Hk,fill:"none",stroke:r.color,strokeOpacity:.3,strokeWidth:i,vectorEffect:"non-scaling-stroke"}),n.jsx("g",{transform:`scale(1 ${Hk/fb})`,children:n.jsx("g",{className:"chibi-mark-spin",style:{animationDuration:`${r.period}s`,animationDelay:`${o[c]}s`},children:n.jsx("g",{transform:`translate(${fb} 0)`,children:n.jsx("g",{className:"chibi-mark-counter",style:{animationDuration:`${r.period}s`,animationDelay:`${o[c]}s`},children:n.jsx("g",{transform:`scale(1 ${fb/Hk})`,children:n.jsx("circle",{r:rre,fill:r.color,style:{filter:`drop-shadow(0 0 ${s}px color-mix(in srgb, ${r.color} 85%, transparent))`}})})})})})})]},r.rotation)),n.jsx("image",{href:N4,x:-bb/2,y:-bb/2,width:bb,height:bb,preserveAspectRatio:"xMidYMid meet"})]})}const dre=new Set(["thinking","working","searching","loading","orbit","radar","progress","humming","receiving","uploading"]),ure=new Set(["writing","sending","dictating"]);function pre(e){return e?dre.has(e)?"thinking":ure.has(e)?"speaking":"idle":"idle"}function mre(){return globalThis.document?.documentElement?.dataset?.reducedMotion==="true"}const hre=24,gre={idle:7,thinking:1.8,speaking:1.2};function fre({provider:e,size:t,label:a,state:o,animated:i=!0}){const s=PD()||mre(),r=pre(o),c=t>=hre,d=c&&i&&!s,p=wR(e),h=c?Math.round(t*.74):t,g=Math.round(h*(p.kind==="official"?.6:.62)),b=r==="thinking"?uh:uh.slice(0,1),x=gre[r];return n.jsxs("span",{role:"img","aria-label":a,"data-subscription-avatar":e,"data-provider-logo-kind":p.kind,"data-activity":r,"data-motion":d?"animated":"static",className:"provider-avatar relative flex shrink-0 items-center justify-center",style:{width:t,height:t},children:[c&&n.jsxs("svg",{className:"provider-ring pointer-events-none absolute inset-0 overflow-visible",width:t,height:t,viewBox:"-50 -50 100 100","aria-hidden":"true",focusable:"false",children:[n.jsx("circle",{className:d&&r==="speaking"?"provider-ring-track provider-ring-breathe":"provider-ring-track",r:46,fill:"none",stroke:"var(--color-accent)",strokeOpacity:r==="idle"?.22:.5,strokeWidth:r==="idle"?1.25:2,vectorEffect:"non-scaling-stroke",style:d&&r==="speaking"?{animationDuration:`${x}s`}:void 0}),b.map((v,k)=>n.jsx("g",{transform:`rotate(${uh[0].rotation+k*120})`,children:n.jsx("g",{className:d?"provider-ring-spin":void 0,style:d?{animationDuration:`${x}s`}:void 0,children:n.jsx("circle",{cx:46,cy:0,r:r==="thinking"?4.2:3.6,fill:v.color,style:{filter:`drop-shadow(0 0 3px color-mix(in srgb, ${v.color} 80%, transparent))`}})})},v.rotation))]}),n.jsx("span",{className:"relative flex items-center justify-center rounded-full border border-hairline/60 bg-raised",style:{width:h,height:h},children:n.jsx(SR,{provider:e,size:g})})]})}const q7={forward:1,authored:.25},bre={arrive:{state:"spawning",spin:900},switch:{state:"waking",spin:620},customize:{state:"proud",blink:!0},alert:{state:"alerting"},thinking:{state:"thinking"},working:{state:"working"},launch:{state:"loading"},success:{state:"happy",blink:!0},celebrate:{state:"celebrate",spin:700},blink:{blink:!0},surprise:{state:"surprised",blink:!0},failure:{state:"sad"}},yre=1400;function U7(e,t,a){const o=Number.parseInt(e.slice(1),16),i=Number.parseInt(t.slice(1),16),s=r=>{const c=o>>r&255,d=i>>r&255;return Math.round(c+(d-c)*a)};return`#${[s(16),s(8),s(0)].map(r=>r.toString(16).padStart(2,"0")).join("")}`}const xre=e=>{const t=nd[e]??nd.green;return[U7(t,"#ffffff",.55),t,U7(t,"#000000",.42)]};function vre({color:e,state:t="idle",expression:a,size:o=44,label:i,motion:s="none",motionKey:r=0,turn:c,gaze:d,spring:p,eyeScale:h,showMouth:g,mouthStroke:b,forward:x=!0,lookAround:v,trackPointer:k=!0,animated:S=!0,bodyId:N},C){const j=nS[wse(N)],M=f.useRef(null);f.useImperativeHandle(C,()=>({blink:()=>M.current?.blink(),spin:B=>M.current?.spin(B),setExpression:B=>M.current?.setExpression(B)}));const[D,A]=f.useState(null);f.useEffect(()=>{if(s==="none"||!S)return;const B=bre[s];if(!B||(B.blink&&M.current?.blink(),B.spin&&M.current?.spin(B.spin),!B.state))return;A(B.state);const L=setTimeout(()=>A(null),yre);return()=>clearTimeout(L)},[s,r,S]);const[R,P]=f.useState({x:0,y:0}),O=x?q7.forward:q7.authored,T=B=>{if(!k||!S)return;const L=B.currentTarget.getBoundingClientRect();P({x:Math.max(-1,Math.min(1,(B.clientX-L.left)/L.width*2-1))*O,y:Math.max(-1,Math.min(1,(B.clientY-L.top)/L.height*2-1))*O})},z=()=>P({x:0,y:0});return n.jsx("span",{className:"inline-flex shrink-0",onPointerMove:k&&S?T:void 0,onPointerLeave:k&&S?z:void 0,children:n.jsx(Zse,{ref:M,state:D??t,expression:a,size:o,silhouette:j,gradient:xre(e),title:i??null,lookAround:v??(x?0:1),gaze:{x:(d?.x??0)+R.x,y:(d?.y??0)+R.y},turn:c,spring:p,eyeScale:h,showMouth:g,mouthStroke:b,paused:!S})})}const ia=f.memo(f.forwardRef(vre));function kre(e){const{avatarCrop:t,hasUrl:a,imageFailed:o}=e;return!a||t==="mascot"||o?"gradientMascot":"flatImage"}function Jt({bot:e,size:t=44,label:a,...o}){const i=sre(e),[s,r]=f.useState(!1);if(f.useEffect(()=>r(!1),[i.avatarUrl]),i.avatarUrl===MD)return n.jsx("span",{role:"img","aria-label":a??e.name??"Chibi",className:"inline-flex shrink-0",children:n.jsx(w0,{size:t})});const c=kre({avatarCrop:i.avatarCrop,hasUrl:!!i.avatarUrl,imageFailed:s});if(c!=="flatImage"&&e.subscription&&!e.mascotBody&&!i.avatarUrl)return n.jsx(fre,{provider:e.subscription.provider,size:t,label:a??e.name??"",state:o.state,animated:o.animated??!0});if(c!=="flatImage")return n.jsx(ia,{bodyId:e.mascotBody??void 0,...o,color:e.color,size:t,label:a??e.name});const d=i.avatarCrop==="circle"?"50%":i.avatarCrop==="rounded"?"22%":"0";return n.jsx("img",{src:i.avatarUrl,alt:a??(e.name?`${e.name} avatar`:"Bot avatar"),width:t,height:t,draggable:!1,onError:()=>r(!0),className:"block shrink-0 bg-raised object-cover",style:{width:t,height:t,borderRadius:d}})}function TD({initials:e,size:t=32}){return n.jsx("div",{className:"flex shrink-0 items-center justify-center rounded-full bg-raised text-ink-secondary font-medium",style:{width:t,height:t,fontSize:t*.38},children:e})}function S0({className:e}){return n.jsxs("span",{"data-personal-badge":!0,title:l("personalBot.badgeHint"),className:V("inline-flex shrink-0 items-center gap-1 rounded-full bg-accent/15 px-1.5 py-px text-[10.5px] font-medium leading-4 text-accent",e),children:[n.jsx(v4,{size:10,"aria-hidden":!0}),l("personalBot.badge")]})}const yb="rounded-2xl border border-hairline/40 bg-card/80 backdrop-blur-xl backdrop-saturate-150";function wre(){const{dispatch:e}=ve(),{view:t}=BR(),a=typeof window<"u"&&window.ogb?.remoteClient?.active===!0;return rte(t,a)?n.jsxs("button",{type:"button","data-create-personal-bot":!0,title:l("personalBot.createHint"),"aria-describedby":"create-private-bot-hint",onClick:()=>e({type:"openBotInterview",launch:{mode:"personal"}}),className:"flex min-h-10 w-full items-center gap-3 rounded-xl px-3 py-2 text-left text-ink hover:bg-raised/50",children:[n.jsx(So,{size:20,className:"text-accent","aria-hidden":!0}),n.jsx("span",{className:"text-[14px]",children:l("personalBot.create")}),n.jsx("span",{id:"create-private-bot-hint",className:"sr-only",children:l("personalBot.createHint")})]}):null}function Sre(e){const t=e.availableAccounts??e.personalAccounts;return t<=0?l("personalBot.accounts.none"):l("personalBot.accounts.count",{count:String(t),subscriptions:String(e.subscriptionAccounts??0),personal:String(e.personalAccounts)})}function Cre(){const{view:e,reload:t}=BR(),{state:a,dispatch:o}=ve(),[i,s]=f.useState(!1),[r,c]=f.useState("");if(!e)return n.jsx(ut,{title:l("personalBot.title"),subtitle:l("personalBot.subtitle"),children:n.jsx("p",{className:"text-[12px] text-ink-secondary",children:l("personalBot.loading")})});const d=e.botId?a.bots.find(x=>x.id===e.botId):void 0,p=async()=>{s(!0),c("");try{await X("/api/personal-bot/settings",{method:"PUT",body:JSON.stringify({useLocalModels:!e.useLocalModels})}),await t()}catch(x){c(x instanceof Error?x.message:String(x))}finally{s(!1)}},h=async()=>{s(!0),c("");try{await X("/api/personal-bot/settings",{method:"PUT",body:JSON.stringify({chibiLink:!e.chibiLink})}),await t()}catch(x){c(x instanceof Error?x.message:String(x))}finally{s(!1)}},g=e.chibiLink&&e.chibiLinkAllowed,b=async()=>{s(!0),c("");try{await X("/api/personal-bot/settings",{method:"PUT",body:JSON.stringify({readWorkMemory:!e.readWorkMemory})}),await t()}catch(x){c(x instanceof Error?x.message:String(x))}finally{s(!1)}};return n.jsxs("div",{className:"flex flex-col gap-4",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-[22px] font-semibold tracking-tight text-ink",children:l("personalBot.title")}),n.jsx("p",{className:"mt-2 max-w-lg text-[13px] leading-relaxed text-ink-secondary",children:l("personalBot.subtitle")})]}),e.allowed?d?n.jsxs("div",{className:V(yb,"flex items-center gap-3 p-4"),children:[n.jsx(Jt,{bot:d,size:44}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"truncate text-[15px] font-medium text-ink",children:d.name}),n.jsx(S0,{})]}),n.jsx("p",{className:"mt-0.5 text-[12.5px] text-ink-secondary",children:l("personalBot.editHint")})]}),n.jsxs("div",{className:"flex shrink-0 flex-col gap-1.5 sm:flex-row",children:[n.jsx("button",{type:"button",onClick:()=>{o({type:"toggleAppSettings",open:!1}),o(sa(d))},className:"rounded-lg bg-accent px-3 py-1.5 text-[13px] font-medium text-white",children:l("personalBot.open")}),n.jsx("button",{type:"button",onClick:()=>{o({type:"toggleAppSettings",open:!1}),o({type:"select",id:d.id}),o({type:"toggleSettings",open:!0,section:"identity"})},className:"rounded-lg bg-control px-3 py-1.5 text-[13px] text-ink hover:bg-raised-hover",children:l("personalBot.edit")})]})]}):n.jsxs("div",{className:V(yb,"flex flex-col items-start gap-2 p-4"),children:[n.jsx("div",{className:"text-[15px] font-medium text-ink",children:l("personalBot.create")}),n.jsx("p",{className:"text-[12.5px] leading-relaxed text-ink-secondary",children:(e.availableAccounts??e.personalAccounts)===0?l("personalBot.form.noAccounts"):l("personalBot.interviewHint")}),n.jsxs("button",{type:"button","data-create-personal-bot-interview":!0,onClick:()=>o({type:"openBotInterview",launch:{mode:"personal"}}),className:"mt-1 flex items-center gap-1.5 rounded-lg bg-accent px-4 py-2 text-[13px] font-medium text-white",children:[n.jsx(So,{size:14,"aria-hidden":!0}),l("personalBot.startInterview")]})]}):n.jsxs("div",{className:V(yb,"p-4"),children:[n.jsxs("div",{className:"flex items-center gap-2 text-[14px] font-medium text-ink",children:[n.jsx(dd,{size:14,"aria-hidden":!0}),l("personalBot.disabled")]}),n.jsx("p",{className:"mt-1 text-[12.5px] leading-relaxed text-ink-secondary",children:l("personalBot.disabledHint")}),n.jsx("div",{className:"mt-2",children:n.jsx(jr,{})})]}),e.allowed&&n.jsxs(ut,{children:[n.jsx(Wt,{title:l("personalBot.local.title"),subtitle:l("personalBot.local.subtitle"),children:n.jsx(Dt,{checked:e.useLocalModels,disabled:i,"aria-label":l("personalBot.local.title"),onClick:()=>{p()}})}),n.jsx(Wt,{title:l("personalBot.workMemory.title"),subtitle:l("personalBot.workMemory.subtitle"),children:n.jsx(Dt,{checked:e.readWorkMemory,disabled:i,"aria-label":l("personalBot.workMemory.title"),onClick:()=>{b()}})}),n.jsx(Wt,{title:l("personalBot.chibiLink.title"),subtitle:l(e.chibiLinkAllowed?"personalBot.chibiLink.subtitle":"personalBot.chibiLink.managed"),children:e.chibiLinkAllowed?n.jsx(Dt,{checked:e.chibiLink,disabled:i,"aria-label":l("personalBot.chibiLink.title"),onClick:()=>{h()}}):n.jsxs("span",{className:"flex items-center gap-2","data-chibi-link-managed":!0,children:[n.jsx(Dt,{checked:!1,disabled:!0,"aria-label":l("personalBot.chibiLink.title")}),n.jsx(jr,{})]})}),n.jsx(Wt,{title:l("personalBot.accounts.title"),subtitle:Sre(e),children:n.jsx("button",{type:"button",onClick:()=>o({type:"toggleAppSettings",open:!0,section:"engines"}),className:"rounded-lg bg-control px-3 py-1.5 text-[13px] text-ink hover:bg-raised-hover",children:l("personalBot.accounts.open")})}),r&&n.jsx("p",{role:"alert",className:"mt-2 text-[12px] text-danger",children:r})]}),n.jsxs("div",{className:V(yb,"p-4"),children:[n.jsx("div",{className:"text-[13px] font-medium text-ink",children:l("personalBot.rules.title")}),n.jsxs("ul",{className:"mt-2 flex list-disc flex-col gap-1 pl-5 text-[12.5px] leading-relaxed text-ink-secondary",children:[n.jsx("li",{children:l("personalBot.rules.private")}),n.jsx("li",{children:l("personalBot.rules.workMemory")}),n.jsx("li",{children:l("personalBot.rules.accounts")}),n.jsx("li",{children:l("personalBot.rules.company")}),n.jsx("li",{children:l("personalBot.rules.connections")}),n.jsx("li",{children:l(g?"personalBot.rules.chibiLink":"personalBot.rules.delegation")}),n.jsx("li",{children:l("personalBot.rules.resting")})]})]})]})}function BD({instanceId:e,owner:t,locked:a,onChanged:o}){const[i,s]=f.useState(!1),[r,c]=f.useState("");if(!t)return null;if(a)return n.jsxs("span",{"data-engine-owner":"company",className:"inline-flex items-center gap-1 rounded-full bg-control px-2 py-0.5 text-[11.5px] font-medium text-ink-secondary",title:l("owner.lockedHint"),children:[n.jsx(dd,{size:11,"aria-hidden":!0}),l("owner.company")]});const d=async p=>{if(!(i||p===t)){s(!0),c("");try{await ER(e,p),await Promise.resolve(o?.()).catch(()=>{})}catch(h){c(h instanceof Error?h.message:String(h))}finally{s(!1)}}};return n.jsxs("span",{className:"inline-flex flex-col items-start gap-1",children:[n.jsx("span",{role:"radiogroup","aria-label":l("owner.label"),title:l("owner.hint"),"data-engine-owner":t,className:"inline-flex rounded-full border border-hairline/40 bg-inset/70 p-0.5 backdrop-blur-xl",children:["company","personal"].map(p=>n.jsx("button",{type:"button",role:"radio","aria-checked":t===p,disabled:i,onClick:()=>{d(p)},className:V("rounded-full px-2.5 py-0.5 text-[11.5px] font-medium transition-colors disabled:opacity-60",t===p?p==="personal"?"bg-accent text-white":"bg-raised text-ink":"text-ink-secondary hover:text-ink"),children:l(p==="company"?"owner.company":"owner.personal")},p))}),r&&n.jsx("span",{role:"alert",className:"text-[11.5px] text-danger",children:l("owner.failed",{error:r})})]})}function ED({instance:e}){const{refreshInstances:t}=ve();return n.jsx(BD,{instanceId:e.instanceId,owner:e.owner,locked:e.ownerLocked,onChanged:t})}const X2="w-full rounded-lg border border-hairline/40 bg-inset px-3 py-2 text-[13px] text-ink placeholder:text-ink-secondary focus:border-hairline focus:outline-none disabled:opacity-50",wu="rounded-lg border border-hairline/40 px-3 py-1.5 text-[12px] text-ink-secondary hover:bg-raised/50 hover:text-ink disabled:cursor-not-allowed disabled:opacity-50";function iS(e,t){return window.ogb?.setInstanceKey?window.ogb.setInstanceKey(e,t):X(`/api/provider-accounts/${encodeURIComponent(e)}/key`,{method:"PUT",body:JSON.stringify({key:t})})}async function RD(e,t,a){const o=e.kind==="apiKey",i=o&&!!window.ogb?.setInstanceKey,s=await X("/api/provider-accounts",{method:"POST",body:JSON.stringify({provider:e.id,displayName:t,...o&&!i?{key:a}:{}})});return i&&await iS(s.instanceId,a),s}function DD(e){return e.ok?l("providerAccounts.testOk"):e.reason==="rejected"?l("providerAccounts.testRejected"):e.reason==="unreachable"?l("providerAccounts.testUnreachable"):l("providerAccounts.testUnexpected")}function jre({provider:e}){return e.icon?n.jsx(wg,{preset:e.icon,size:18}):n.jsx(hd,{driverKind:e.driver,size:18})}function Nre({value:e,onChange:t,disabled:a}){return n.jsxs("fieldset",{className:"flex flex-col gap-1.5",disabled:a,children:[n.jsx("legend",{className:"mb-1 text-[12px] text-ink-secondary",children:l("owner.label")}),n.jsx("div",{role:"radiogroup","aria-label":l("owner.label"),className:"flex w-fit rounded-lg bg-inset p-0.5","data-owner-choice":!0,children:["company","personal"].map(o=>n.jsx("button",{type:"button",role:"radio","aria-checked":e===o,onClick:()=>t(o),"data-owner":o,className:V("rounded-md px-3 py-1 text-[12.5px]",e===o?"bg-raised font-medium text-ink shadow-sm":"text-ink-secondary hover:text-ink"),children:l(o==="company"?"owner.company":"owner.personal")},o))}),n.jsx("p",{className:"text-[11.5px] leading-relaxed text-ink-secondary",children:l(e==="personal"?"owner.addToggleHint":"owner.companyHint")})]})}function OD({provider:e,onDone:t,onCancel:a}){const[o,i]=f.useState(""),[s,r]=f.useState(""),[c,d]=f.useState(null),[p,h]=f.useState(null),[g,b]=f.useState(null),[x,v]=f.useState("company"),k=e.kind==="apiKey",S=async()=>{if(!(!e.keyTest||!s.trim()||c)){d("test"),b(null);try{const C=await X("/api/keys/test",{method:"POST",body:JSON.stringify({provider:e.keyTest.provider,key:s.trim(),...e.keyTest.url?{url:e.keyTest.url}:{}})});b(DD(C))}catch(C){b(C instanceof Error?C.message:String(C))}finally{d(null)}}},N=async()=>{if(!(c||!o.trim()||k&&!s.trim())){d("save"),h(null);try{const C=k&&!!window.ogb?.setInstanceKey,j=await X("/api/provider-accounts",{method:"POST",body:JSON.stringify({provider:e.id,displayName:o.trim(),owner:x,...k&&!C?{key:s.trim()}:{}})});C&&await iS(j.instanceId,s.trim()),await t()}catch(C){h(C instanceof Error?C.message:String(C))}finally{d(null)}}};return n.jsxs("form",{className:"mt-3 flex flex-col gap-2 rounded-xl border border-hairline/40 p-3",onSubmit:C=>{C.preventDefault(),N()},children:[n.jsxs("label",{className:"flex flex-col gap-1 text-[12px] text-ink-secondary",children:[l("providerAccounts.name"),n.jsx("input",{value:o,onChange:C=>i(C.target.value),maxLength:80,required:!0,disabled:c!==null,placeholder:l("providerAccounts.namePlaceholder"),className:X2})]}),k&&n.jsxs("label",{className:"flex flex-col gap-1 text-[12px] text-ink-secondary",children:[l("providerAccounts.key"),n.jsx("input",{type:"password",value:s,onChange:C=>{r(C.target.value),b(null)},autoComplete:"off",disabled:c!==null,placeholder:l("providerAccounts.keyPlaceholder"),className:X2})]}),k&&e.keyUrl&&n.jsx("a",{href:e.keyUrl,target:"_blank",rel:"noopener noreferrer",className:"w-fit text-[12px] text-accent hover:underline",children:l("providerAccounts.getKey",{provider:e.label})}),!k&&n.jsx("p",{className:"text-[12px] leading-relaxed text-ink-secondary",children:l("providerAccounts.signInHint")}),n.jsx(Nre,{value:x,onChange:v,disabled:c!==null}),g&&n.jsx("p",{role:"status",className:"text-[12px] text-ink-secondary",children:g}),p&&n.jsx("p",{role:"alert",className:"text-[12px] text-danger",children:p}),n.jsxs("div",{className:"flex justify-end gap-2",children:[n.jsx("button",{type:"button",onClick:a,disabled:c!==null,className:"rounded-lg px-3 py-1.5 text-[12px] text-ink-secondary hover:bg-raised/50 disabled:opacity-50",children:l("common.cancel")}),k&&e.keyTest&&n.jsx("button",{type:"button",onClick:()=>{S()},disabled:c!==null||!s.trim(),className:wu,children:l(c==="test"?"keys.testing":"keys.test")}),n.jsxs("button",{type:"submit",disabled:c!==null||!o.trim()||k&&!s.trim(),className:"flex items-center gap-1.5 rounded-lg bg-raised px-3 py-1.5 text-[12px] text-ink hover:bg-raised-hover disabled:opacity-50",children:[c==="save"&&n.jsx(Ie,{size:13,className:"animate-spin"}),l("providerAccounts.add")]})]})]})}function zD({provider:e,account:t,onChanged:a}){const{state:o}=ve(),[i,s]=f.useState(null),[r,c]=f.useState(""),[d,p]=f.useState(!1),[h,g]=f.useState(!1),[b,x]=f.useState(null),[v,k]=f.useState(null),[S,N]=f.useState(!1),C=o.instances.find(z=>z.instanceId===t.instanceId),j=e.kind==="signIn"&&C!==void 0&&(C.snapshot.state!=="available"||C.authentication!==void 0||C.claudeAccount!==void 0||!t.signInCommand),M=o.bots.filter(z=>z.modelSelection.instanceId===t.instanceId).length,D=e.kind==="apiKey"?t.keyConfigured?l("providerAccounts.keySaved"):l("providerAccounts.noKey"):t.signedIn===!0?l("providerAccounts.signedIn"):t.signedIn===!1?l("providerAccounts.notSignedIn"):t.available===!1?l("onboarding.engines.needsSetup"):l("providerAccounts.statusUnknown"),A=e.kind==="apiKey"?t.keyConfigured===!0:t.signedIn===!0,R=async z=>{if(!d){p(!0),x(null);try{await z(),s(null),c(""),await a()}catch(B){x(B instanceof Error?B.message:String(B))}finally{p(!1)}}},P=()=>{const z=r.trim();z&&(i==="rename"?R(()=>X(`/api/provider-accounts/${encodeURIComponent(t.instanceId)}`,{method:"PATCH",body:JSON.stringify({displayName:z})})):i==="key"&&R(()=>iS(t.instanceId,z)))},O=async()=>{if(!d){p(!0),k(null);try{const z=await X(`/api/provider-accounts/${encodeURIComponent(t.instanceId)}/test`,{method:"POST",body:"{}"});k(DD(z))}catch(z){k(z instanceof Error?z.message:String(z))}finally{p(!1)}}},T=()=>{g(!1),R(async()=>{await X(`/api/provider-accounts/${encodeURIComponent(t.instanceId)}`,{method:"DELETE"}),e.kind==="apiKey"&&window.ogb?.setInstanceKey&&await window.ogb.setInstanceKey(t.instanceId,"")})};return n.jsxs("li",{className:"border-t border-hairline/30 py-2.5 first:border-t-0",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1.5 text-[13px]",children:[n.jsx("span",{className:"min-w-0 break-words font-medium text-ink",children:t.displayName}),n.jsx("span",{className:V("text-[12px]",A?"text-success":"text-ink-secondary"),children:D}),n.jsx(BD,{instanceId:t.instanceId,owner:t.owner,locked:t.ownerLocked,onChanged:a}),n.jsx("span",{className:"flex-1"}),n.jsx("button",{type:"button",disabled:d,onClick:()=>{s(i==="rename"?null:"rename"),c(t.displayName)},className:wu,children:l("providerAccounts.rename")}),e.kind==="apiKey"&&n.jsx("button",{type:"button",disabled:d,onClick:()=>{s(i==="key"?null:"key"),c("")},className:wu,children:t.keyConfigured?l("providerAccounts.replaceKey"):l("providerAccounts.addKey")}),e.kind==="apiKey"&&e.keyTest&&t.keyConfigured&&n.jsx("button",{type:"button",disabled:d,onClick:()=>{O()},className:wu,children:l("keys.test")}),t.removable&&n.jsx("button",{type:"button",disabled:d||M>0,onClick:()=>g(!0),className:V(wu,"text-danger hover:text-danger"),children:l("providerAccounts.remove")})]}),t.removable&&M>0&&n.jsx("p",{className:"mt-1 text-[11.5px] text-ink-secondary",children:l("providerAccounts.assigned",{count:String(M)})}),i&&n.jsxs("form",{className:"mt-2 flex gap-2",onSubmit:z=>{z.preventDefault(),P()},children:[n.jsx("input",{type:i==="key"?"password":"text",value:r,onChange:z=>c(z.target.value),autoComplete:"off",maxLength:i==="rename"?80:4096,"aria-label":l(i==="rename"?"providerAccounts.name":"providerAccounts.key"),placeholder:i==="key"?l("providerAccounts.keyPlaceholder"):void 0,disabled:d,className:X2}),n.jsx("button",{type:"submit",disabled:d||!r.trim(),className:"flex w-[72px] shrink-0 items-center justify-center rounded-lg bg-control py-2 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-50",children:d?n.jsx(Ie,{size:13,className:"animate-spin"}):l("common.save")})]}),t.signedIn!==!0&&j&&C&&(S?n.jsx("div",{className:"mt-2","data-account-sign-in":t.instanceId,children:n.jsx(Pr,{instance:C,unframed:!0})}):n.jsx("button",{type:"button",onClick:()=>N(!0),className:"mt-2 rounded-lg bg-accent px-3 py-1.5 text-[12.5px] font-medium text-white hover:opacity-90","data-account-sign-in-button":t.instanceId,children:l("subscriptions.signIn")})),e.kind==="signIn"&&t.signedIn!==!0&&!j&&t.signInCommand&&n.jsxs("div",{className:"mt-2 space-y-1.5",children:[n.jsx("p",{className:"text-[12px] leading-relaxed text-ink-secondary",children:l("providerAccounts.signInSteps")}),n.jsx(Pc,{command:t.signInCommand,copyLabel:l("engineSetup.copyCommand")})]}),v&&n.jsx("p",{role:"status",className:"mt-1 text-[12px] text-ink-secondary",children:v}),b&&n.jsx("p",{role:"alert",className:"mt-1 text-[12px] text-danger",children:b}),n.jsx(Oa,{open:h,title:l("providerAccounts.removeTitle",{name:t.displayName}),body:e.kind==="apiKey"?l("providerAccounts.removeKeyHint"):l("providerAccounts.removeSignInHint"),confirmLabel:l("providerAccounts.remove"),tone:"neutral",onCancel:()=>g(!1),onConfirm:T})]})}function Are({provider:e,onChanged:t}){const[a,o]=f.useState(!1),i=e.kind==="apiKey"?LR(e.id):void 0;return n.jsxs("div",{className:"rounded-2xl border border-hairline/50 bg-card px-4 py-3 sm:px-5",children:[n.jsxs("div",{className:"flex items-center gap-2.5",children:[n.jsx("span",{className:"flex size-7 shrink-0 items-center justify-center rounded-lg bg-control",children:n.jsx(jre,{provider:e})}),n.jsx("span",{className:"min-w-0 flex-1 text-[14px] font-medium text-ink",children:e.label}),e.signupUrl&&n.jsx("a",{href:e.signupUrl,target:"_blank",rel:"noopener noreferrer",className:"shrink-0 text-[12px] text-accent hover:underline",children:l(e.kind==="signIn"?"providerAccounts.getSubscription":"providerAccounts.getPlan")}),e.kind==="apiKey"&&e.keyUrl&&n.jsx("a",{href:e.keyUrl,target:"_blank",rel:"noopener noreferrer",className:"shrink-0 text-[12px] text-accent hover:underline",children:l(e.billing==="subscription"?"providerAccounts.getPlanKey":"providerAccounts.getApiKey")}),!a&&n.jsxs("button",{type:"button",onClick:()=>o(!0),className:V(wu,"flex items-center gap-1.5"),children:[n.jsx(vn,{size:13}),l("providerAccounts.add")]})]}),n.jsxs("p",{className:"mt-1.5 text-[12px] leading-relaxed text-ink-secondary",children:[OR(e.billing,e.kind),e.billing==="subscription"&&W2(e.id)?` · ${W2(e.id)}`:""]}),(i||e.accounts.length>0)&&n.jsxs("ul",{className:"mt-2",children:[i&&n.jsx("li",{className:"py-2.5","data-main-key":i.section,children:n.jsx(Sg,{section:i.section,testProvider:i.test,mainKey:!0})}),e.accounts.map(s=>n.jsx(zD,{provider:e,account:s,onChanged:t},s.instanceId))]}),a&&n.jsx(OD,{provider:e,onCancel:()=>o(!1),onDone:async()=>{o(!1),await t()}})]})}function Mre({providers:e,billing:t,onChanged:a}){return n.jsx(n.Fragment,{children:e.filter(o=>o.billing===t&&o.id!=="claude").map(o=>n.jsx(Are,{provider:o,onChanged:a},o.id))})}function Ire({billing:e}){const{refreshInstances:t}=ve(),[a,o]=f.useState(null),[i,s]=f.useState(null),r=f.useCallback(async()=>{try{const d=await X("/api/provider-accounts");o(d.providers),s(null)}catch(d){s(d instanceof Error?d.message:String(d))}},[]);f.useEffect(()=>{r()},[r]);const c=f.useCallback(async()=>{await Promise.all([r(),Promise.resolve(t()).catch(()=>{})])},[r,t]);return n.jsxs("section",{className:"flex flex-col gap-3","aria-labelledby":`provider-accounts-${e}`,children:[n.jsxs("div",{children:[n.jsx("h2",{id:`provider-accounts-${e}`,className:"text-[16px] font-semibold text-ink",children:l(e==="subscription"?"providerAccounts.subscriptionTitle":"providerAccounts.payPerUseTitle")}),n.jsx("p",{className:"mt-1 max-w-lg text-[12.5px] leading-relaxed text-ink-secondary",children:l(e==="subscription"?"providerAccounts.subscriptionIntro":"providerAccounts.payPerUseIntro")})]}),i&&n.jsx("p",{role:"alert",className:"text-[12px] text-danger",children:i}),a===null&&!i&&n.jsx(Ie,{size:14,className:"animate-spin text-ink-secondary"}),a&&n.jsx(Mre,{providers:a,billing:e,onChanged:c})]})}const fr="w-full rounded-lg border border-hairline/40 bg-inset px-3 py-2.5 text-[15px] text-ink placeholder:text-ink-secondary focus:border-hairline focus:outline-none";function Ua(e){return{"--i":e}}function Ku({children:e,className:t,...a}){return n.jsx("button",{"data-primary":"",...a,className:V("w-full shrink-0 rounded-lg bg-accent py-2.5 text-[15px] font-medium text-white transition-[transform,opacity] duration-150 active:scale-[0.98] disabled:opacity-40",t),children:e})}function Wh({children:e,className:t,...a}){return n.jsx("button",{...a,className:V("text-[12px] text-ink-secondary transition-colors hover:text-ink",t),children:e})}const Pre={claude:"claudeAgent",chatgpt:"codex",gemini:"antigravityAgent",grok:"grokAgent",cursor:"cursorAgent",museCode:"museCode",ollama:"ollamaCloud",kimi:"kimiAgent",qwen:"qwenAgent",opencodeGo:"opencodeGo"};function ad(e,t){return t&&e3.includes(e)?l(`setup.plan.${e}.chibitekName`):l(`setup.plan.${e}.name`)}const e3=$y;function Tre(e){const t=Pre[e];return t?n.jsx(hd,{driverKind:t,size:26}):e==="apiKey"?n.jsx(Eh,{size:24,className:"text-ink-secondary","aria-hidden":"true"}):n.jsx(yg,{size:24,className:"text-ink-secondary","aria-hidden":"true"})}function Bre({picks:e,chibitek:t,onToggle:a}){const o=MX(e,t);return n.jsxs("div",{className:"flex flex-col",children:[n.jsx("p",{className:"text-[14px] leading-relaxed text-ink-secondary",children:l("setup.plans.intro")}),n.jsx("p",{className:"mt-1.5 text-[12.5px] leading-relaxed text-ink-secondary",children:l("setup.plans.billing")}),t?n.jsxs(n.Fragment,{children:[n.jsx("h2",{className:"mt-4 text-[12px] font-semibold uppercase tracking-wide text-ink-secondary",children:l("setup.plans.chibitekTitle")}),n.jsx(Gk,{plans:e3,picks:e,chibitek:!0,onToggle:a,label:l("setup.plans.chibitekTitle")}),n.jsx("p",{className:"mt-2 text-[12.5px] leading-relaxed text-ink-secondary",children:l("setup.plans.chibitekNotSure",{email:_c})}),n.jsx("h2",{className:"mt-5 text-[12px] font-semibold uppercase tracking-wide text-ink-secondary",children:l("setup.plans.otherTitle")}),n.jsx(Gk,{plans:q2.filter(i=>!e3.includes(i)),picks:e,onToggle:a,label:l("setup.plans.otherTitle")})]}):n.jsx(Gk,{plans:q2,picks:e,onToggle:a,label:l("setup.plans.groupLabel")}),n.jsxs("div",{className:"mt-4 rounded-xl border border-hairline/40 bg-card px-3.5 py-3","aria-live":"polite",children:[n.jsx("div",{className:"text-[11.5px] font-semibold uppercase tracking-wide text-ink-secondary",children:l("setup.plans.recommendedTitle")}),n.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink",children:o.kind==="askErick"?l("setup.plans.askErick",{email:_c}):o.kind==="plan"&&o.plan==="gemini"?l("setup.plans.mainGemini"):o.kind==="startLocal"?l("setup.plans.startLocal"):o.localBackup?l("setup.plans.mainWithBackup",{plan:ad(o.plan,t)}):l("setup.plans.main",{plan:ad(o.plan,t)})})]}),n.jsxs($i,{children:[n.jsx("p",{children:l("setup.plans.what1")}),n.jsx("p",{children:l("setup.plans.what2")})]})]})}function Gk({plans:e,picks:t,chibitek:a=!1,onToggle:o,label:i}){return n.jsx("div",{role:"group","aria-label":i,className:"mt-2 grid grid-cols-2 gap-2 sm:grid-cols-3",children:e.map(s=>{const r=t.includes(s);return n.jsxs("button",{type:"button",role:"checkbox","aria-checked":r,"aria-label":ad(s,a),"aria-describedby":`plan-detail-${s}`,"data-plan":s,onClick:()=>o(s),className:V("relative flex min-h-[92px] flex-col items-start gap-2 rounded-xl border p-3 text-left transition-[border-color,background-color,transform] active:scale-[0.98]",r?"border-accent bg-accent/10":"border-hairline/50 bg-card hover:bg-raised/40"),children:[n.jsx("span",{className:"flex size-9 items-center justify-center rounded-lg bg-inset",children:Tre(s)}),n.jsx("span",{className:"text-[13px] font-semibold leading-tight text-ink",children:ad(s,a)}),n.jsx("span",{id:`plan-detail-${s}`,className:"text-[11.5px] leading-snug text-ink-secondary",children:l(a?`setup.plan.${s}.chibitekDetail`:`setup.plan.${s}.detail`)}),r&&n.jsx("span",{className:"absolute right-2 top-2 flex size-5 items-center justify-center rounded-full bg-accent text-white","aria-hidden":"true",children:n.jsx(gt,{size:12,strokeWidth:3})})]},s)})})}function sS(e,t){const a=e.filter(o=>o.driverKind===t&&!o.managed&&!o.readOnly);return a.find(o=>!o.providerAccount)??a[0]}function Ere(e){return e.loaded?e.instance?e.job?.kind==="engine-install"&&e.job.state==="running"?"installing":e.instance.snapshot.state!=="available"?e.job?.kind==="engine-install"&&e.job.state==="failed"?"installFailed":"notInstalled":e.instance.access!=="custom"&&e.instance.snapshot.authenticated===!1?"needsSignIn":e.test==="passed"?"tested":e.test==="failed"?"testFailed":"testing":e.checkFailed?"checkFailed":"unavailable":"checking"}const Rre={downloading:"setup.connect.phase.downloading",installing:"setup.connect.phase.installing",checking:"setup.connect.phase.checking"};function Dre({name:e,phase:t,job:a,terminalCommand:o,onInstall:i,onRetryTest:s,onRecheck:r,signIn:c,testDetail:d,startError:p,windows:h=!1,notOnWindows:g=!1}){return n.jsxs("div",{className:"mt-4 rounded-xl border border-hairline/40 bg-card p-3.5","data-phase":t,children:[t==="checking"&&n.jsxs("p",{role:"status",className:"flex items-center gap-2 text-[13px] text-ink-secondary",children:[n.jsx(Ie,{size:14,className:"animate-spin","aria-hidden":"true"}),l("setup.connect.checking",{name:e})]}),t==="checkFailed"&&n.jsx(ho,{message:l("setup.connect.checkFailed",{name:e}),onRetry:r}),t==="unavailable"&&n.jsx("p",{className:"text-[13px] leading-relaxed text-ink-secondary",children:l("setup.connect.unavailable",{name:e})}),t==="notInstalled"&&g&&n.jsx("p",{className:"text-[13px] leading-relaxed text-ink-secondary",children:l("setup.connect.notOnWindows",{name:e})}),t==="notInstalled"&&!g&&n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"text-[13px] leading-relaxed text-ink",children:l(h?"setup.connect.installIntroWindows":"setup.connect.installIntro",{name:e})}),n.jsxs("button",{type:"button",onClick:i,className:V(Ha,"mt-3 w-full"),children:[n.jsx(pa,{size:14,"aria-hidden":"true"}),l("setup.connect.install",{name:e})]}),p&&n.jsx(ho,{message:l("setup.error.failed"),detail:p,onRetry:i})]}),t==="installing"&&n.jsxs(n.Fragment,{children:[n.jsx(Oi,{label:l(Rre[a?.phase??""]??"setup.connect.phase.installing",{name:e}),received:a?.phase==="downloading"?a.received:void 0,total:a?.phase==="downloading"?a.total:void 0}),n.jsx(md,{detail:a?.detail})]}),t==="installFailed"&&n.jsxs(n.Fragment,{children:[n.jsx(ho,{message:h&&a?.reason==="no-installer"?l("setup.error.noInstallerWindows"):Ml(a),detail:a?.detail,onRetry:i}),o&&n.jsxs("details",{className:"mt-3 rounded-lg border border-hairline/40 bg-app px-2.5 py-2 text-[12px] text-ink-secondary",children:[n.jsx("summary",{className:"cursor-pointer select-none outline-none hover:text-ink focus-visible:text-ink",children:l(h?"setup.connect.terminalFallbackWindows":"setup.connect.terminalFallback")}),n.jsx("p",{className:"mt-2 leading-relaxed",children:l(h?"setup.connect.terminalFallbackHelpWindows":"setup.connect.terminalFallbackHelp")}),n.jsx(f0,{command:o,actionLabel:l(h?"engineSetup.openInstallWindows":"engineSetup.openInstall"),compact:!0})]})]}),t==="needsSignIn"&&n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"text-[13px] leading-relaxed text-ink",children:l("setup.connect.signInIntro",{name:e})}),c]}),t==="testing"&&n.jsxs("p",{role:"status",className:"flex items-center gap-2 text-[13px] text-ink-secondary",children:[n.jsx(Ie,{size:14,className:"animate-spin","aria-hidden":"true"}),l("setup.connect.testing",{name:e})]}),t==="tested"&&n.jsx(Xc,{children:l("setup.connect.tested",{name:e})}),t==="testFailed"&&n.jsx(ho,{message:l("setup.connect.testFailed",{name:e}),detail:d,onRetry:s})]})}function Ore({name:e,job:t,startError:a,onStart:o,onCancel:i}){const[s,r]=f.useState(!1),c=t?.state==="running";return n.jsxs("div",{className:"mt-3",children:[!c&&n.jsxs("button",{type:"button",onClick:o,className:V(Ha,"w-full"),children:[n.jsx(wr,{size:14,"aria-hidden":"true"}),t?.state==="failed"||t?.state==="cancelled"?l("setup.connect.signInAgain"):l("setup.connect.signIn",{name:e})]}),c&&!t.url&&n.jsx(Oi,{label:l("setup.connect.signInStarting",{name:e})}),c&&t.url&&n.jsxs("div",{className:"space-y-2.5",children:[n.jsx("p",{className:"text-[12.5px] leading-relaxed text-ink-secondary",children:t.code?l("setup.connect.signInWithCode"):l("setup.connect.signInBrowser")}),t.code&&n.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-lg bg-inset px-3 py-2",children:[n.jsx("code",{dir:"ltr","aria-label":l("setup.connect.codeLabel"),className:"select-all font-mono text-[17px] tracking-[0.2em] text-ink",children:t.code}),n.jsxs("button",{type:"button",onClick:()=>{navigator.clipboard?.writeText(t.code).then(()=>r(!0)).catch(()=>{})},className:Za,children:[n.jsx(Ya,{size:13,"aria-hidden":"true"}),l(s?"engineSetup.copied":"engineSetup.copy")]})]}),n.jsxs("button",{type:"button",onClick:()=>m0(t.url),className:V(Ha,"w-full"),children:[n.jsx(An,{size:14,"aria-hidden":"true"}),l("setup.connect.openSignIn")]}),n.jsxs("p",{role:"status",className:"flex items-center gap-2 text-[12px] text-ink-secondary",children:[n.jsx(Ie,{size:12,className:"animate-spin","aria-hidden":"true"}),l("setup.connect.waitingForSignIn")]}),n.jsx("button",{type:"button",onClick:i,className:"text-[12px] text-ink-secondary hover:text-ink",children:l("common.cancel")})]}),a&&n.jsx(ho,{message:l("setup.error.failed"),detail:a}),t&&(t.state==="failed"||t.state==="cancelled")&&t.reason!==void 0&&n.jsx(ho,{message:Ml(t),detail:t.detail})]})}function zre({instanceId:e,name:t,onSignedIn:a}){const{job:o,start:i,cancel:s,startError:r}=Cr(c=>{c.state==="succeeded"&&a()});return n.jsx(Ore,{name:t,job:o,startError:r,onStart:()=>{i("engine-login",e)},onCancel:()=>{s()}})}function Lre({instanceId:e,chibitek:t,domain:a,onSkip:o}){const i=FD(e,a);return i.state==="failed"?n.jsx(_D,{chibitek:t,onRetry:()=>{i.start()},onContinueLocal:o}):n.jsx("div",{className:"mt-3",children:i.state==="waiting"?n.jsxs("p",{role:"status",className:"flex items-center gap-2 text-[13px] text-ink-secondary",children:[n.jsx(Ie,{size:14,className:"animate-spin","aria-hidden":"true"}),l("setup.google.geminiWaiting")]}):n.jsxs("button",{type:"button",onClick:()=>{i.start()},className:V(Ha,"w-full"),children:[n.jsx(wr,{size:14,"aria-hidden":"true"}),a?l("setup.google.useDomain",{domain:a}):l("setup.connect.signIn",{name:"Gemini"})]})})}function Fre({plan:e,chibitek:t,domain:a,onTested:o,onSkip:i}){const{state:s,refreshInstances:r}=ve(),c=q4[e],[d,p]=f.useState(s.instances.length>0),[h,g]=f.useState(!1),[b,x]=f.useState("idle"),[v,k]=f.useState(null),S=sS(s.instances,c.driverKind),N=ad(e),C=f.useRef(o);C.current=o;const{job:j,start:M,startError:D}=Cr(()=>{r().catch(()=>{})}),A=f.useCallback(()=>{g(!1),r().then(z=>g(!z),()=>g(!0)).finally(()=>p(!0))},[r]);f.useEffect(()=>{A()},[]);const R=f.useCallback(async()=>{if(S){x("running"),k(null);try{const z=await X("/api/setup/engine-test",{method:"POST",body:JSON.stringify({instanceId:S.instanceId}),timeoutMs:6e4});x(z.ok?"passed":"failed"),k(z.detail??null),C.current(z.ok),z.ok||r().catch(()=>{})}catch(z){x("failed"),k(z instanceof Error?z.message:String(z)),C.current(!1)}}},[S,r]),P=Ere({loaded:d,instance:S,job:j,test:b,checkFailed:h}),O=qR()==="win32";f.useEffect(()=>{P==="testing"&&b==="idle"&&R()},[P,b,R]);let T=null;return S&&P==="needsSignIn"&&(c.signIn==="claude"?T=n.jsx("div",{className:"mt-3",children:n.jsx(DR,{instanceId:S.instanceId})}):c.signIn==="codex"?T=n.jsx("div",{className:"mt-3",children:n.jsx(K2,{instanceId:S.instanceId})}):c.signIn==="meta"?T=n.jsx("div",{className:"mt-3",children:n.jsx(K2,{instanceId:S.instanceId,provider:"meta"})}):c.signIn==="cli"?T=n.jsx(zre,{instanceId:S.instanceId,name:N,onSignedIn:()=>{r()}}):e==="gemini"?T=n.jsx(Lre,{instanceId:S.instanceId,chibitek:t,domain:a,onSkip:i}):T=n.jsx(Pr,{instance:S,unframed:!0,className:"mt-2"})),n.jsx(Dre,{name:N,phase:P,job:j,terminalCommand:j?.reason==="no-installer"||j?.state==="failed"?Hu(S?.install):null,windows:O,notOnWindows:O&&!!S?.install?.command&&!Hu(S?.install)&&!S?.install?.server&&!S?.install?.managed,onInstall:()=>S&&void M("engine-install",S.instanceId),onRecheck:()=>{p(!1),A()},startError:D,onRetryTest:()=>{x("idle"),r().catch(()=>{})},signIn:T,testDetail:v})}function LD({name:e,phase:t,value:a,onChange:o,onSave:i,keyUrl:s,signupUrl:r,error:c,job:d}){if(t==="tested")return n.jsx("div",{className:"mt-4 rounded-xl border border-hairline/40 bg-card p-3.5",children:n.jsx(Xc,{children:l("setup.key.tested",{name:e})})});if(t==="checking")return n.jsxs("p",{role:"status",className:"mt-4 flex items-center gap-2 text-[13px] text-ink-secondary",children:[n.jsx(Ie,{size:14,className:"animate-spin","aria-hidden":"true"}),l("setup.connect.checking",{name:e})]});if(t==="installing")return n.jsxs("div",{className:"mt-4 rounded-xl border border-hairline/40 bg-card p-3.5",children:[n.jsx(Oi,{label:l("setup.connect.phase.installing",{name:e})}),n.jsx(md,{detail:d?.detail})]});const p=t==="saving";return n.jsxs("form",{className:"mt-4 rounded-xl border border-hairline/40 bg-card p-3.5",onSubmit:h=>{h.preventDefault(),i()},children:[n.jsx("label",{htmlFor:"setup-plan-key",className:"text-[12px] font-medium text-ink-secondary",children:l("setup.key.label",{name:e})}),n.jsx("input",{id:"setup-plan-key",type:"password",autoComplete:"off",spellCheck:!1,value:a,disabled:p,onChange:h=>o(h.target.value),placeholder:l("setup.key.placeholder"),className:V("mt-1.5",fr)}),n.jsxs("div",{className:"mt-2 flex flex-wrap gap-2",children:[s&&n.jsx(Wy,{href:s,label:l("setup.key.getKey")}),r&&n.jsx(Wy,{href:r,label:l("setup.key.noPlan")})]}),n.jsxs("button",{type:"submit",disabled:!a.trim()||p,className:V(Ha,"mt-3 w-full"),children:[p&&n.jsx(Ie,{size:14,className:"animate-spin","aria-hidden":"true"}),l(p?"setup.key.testing":"setup.key.save")]}),t==="rejected"&&n.jsx(ho,{message:l("setup.key.rejected",{name:e})}),t==="unreachable"&&n.jsx(ho,{message:l("setup.key.unreachable")}),t==="failed"&&n.jsx(ho,{message:l("setup.key.failed"),detail:c??d?.detail})]})}function V7({plan:e,onTested:t}){const{refreshInstances:a}=ve(),o=q4[e],i=ad(e),[s,r]=f.useState(null),[c,d]=f.useState("checking"),[p,h]=f.useState(""),[g,b]=f.useState(null),x=f.useRef(t);x.current=t;const v=f.useCallback(async C=>{const j=await X("/api/setup/engine-test",{method:"POST",body:JSON.stringify({instanceId:C}),timeoutMs:6e4});j.ok?(d("tested"),x.current(!0)):(b(j.detail??null),d("failed"))},[]),k=f.useRef(null),S=Cr(C=>{a().catch(()=>{}),C.state==="succeeded"&&k.current?v(k.current).catch(()=>d("failed")):d("failed")});f.useEffect(()=>{let C=!0;return X("/api/provider-accounts",{timeoutMs:1e4}).then(async({providers:j})=>{if(!C)return;const M=j.find(R=>R.id===o.provider)??null;r(M);const D=M?.accounts.find(R=>R.keyConfigured);if(!D){d("entering");return}const A=await X(`/api/provider-accounts/${encodeURIComponent(D.instanceId)}/test`,{method:"POST",body:"{}"}).catch(()=>({ok:!1}));C&&(A.ok?(d("tested"),x.current(!0)):d("entering"))}).catch(()=>C&&d("entering")),()=>{C=!1}},[o.provider]);const N=async()=>{const C=p.trim();if(!(!C||!s)){d("saving"),b(null);try{if(s.keyTest){const M=await X("/api/keys/test",{method:"POST",body:JSON.stringify({provider:s.keyTest.provider,key:C,...s.keyTest.url?{url:s.keyTest.url}:{}}),timeoutMs:3e4});if(!M.ok){d(M.reason==="rejected"?"rejected":M.reason==="unreachable"?"unreachable":"failed");return}}const j=await RD(s,s.label,C);if(h(""),await a().catch(()=>{}),k.current=j.instanceId,o.method==="engineAndKey"){d("installing"),await S.start("engine-install",j.instanceId);return}s.keyTest?(d("tested"),x.current(!0)):await v(j.instanceId)}catch(j){b(j instanceof Error?j.message:String(j)),d("failed")}}};return n.jsx(LD,{name:i,phase:c,value:p,onChange:C=>{h(C),c!=="entering"&&c!=="saving"&&d("entering")},onSave:()=>{N()},keyUrl:s?.keyUrl,signupUrl:s?.signupUrl,error:g,job:S.job})}function _re({plan:e,onTested:t,chibitek:a=!1,domain:o=null,onSkip:i}){const[s,r]=f.useState(null),c=ad(e),d=q4[e],{state:p,refreshInstances:h}=ve(),g=IX(e,a),[b,x]=f.useState(g.personal),v=f.useRef(!1),k=async C=>{const j=await X("/api/instances").then(D=>D.instances,()=>p.instances),M=d.method==="engine"?sS(j,d.driverKind):j.filter(D=>D.providerAccount?.provider===d.provider).at(-1);M&&!M.ownerLocked&&await ER(M.instanceId,C?"personal":"company").catch(()=>{}),await Promise.resolve(h()).catch(()=>{})},S=C=>{v.current=C,C&&!(e==="ollama"&&s==="local")&&k(b),t(C)},N=()=>{const C=!b;x(C),v.current&&k(C)};return n.jsxs("div",{className:"flex flex-col",children:[n.jsx("p",{className:"text-[14px] leading-relaxed text-ink-secondary",children:l(`setup.plan.${e}.connect`)}),e==="ollama"?n.jsxs(n.Fragment,{children:[n.jsx("div",{role:"radiogroup","aria-label":l("setup.ollama.question"),className:"mt-4 grid grid-cols-2 gap-2",children:["cloud","local"].map(C=>n.jsxs("button",{type:"button",role:"radio","aria-checked":s===C,"aria-label":l(`setup.ollama.${C}`),onClick:()=>{r(C),C==="local"&&t(!0)},className:V("rounded-xl border px-3 py-2.5 text-left text-[13px] transition-colors",s===C?"border-accent bg-accent/10 text-ink":"border-hairline/50 bg-card text-ink-secondary hover:bg-raised/40"),children:[n.jsx("span",{className:"block font-semibold text-ink",children:l(`setup.ollama.${C}`)}),n.jsx("span",{className:"mt-0.5 block text-[11.5px]",children:l(`setup.ollama.${C}Detail`)})]},C))}),s==="cloud"&&n.jsx(V7,{plan:"ollama",onTested:S}),s==="local"&&n.jsx("p",{className:"mt-3 text-[12.5px] leading-relaxed text-ink-secondary",children:l("setup.ollama.localNext")})]}):d.method==="engine"?n.jsx(Fre,{plan:e,chibitek:a,domain:o,onTested:S,onSkip:i}):n.jsx(V7,{plan:e,onTested:S}),!(e==="ollama"&&s!=="cloud")&&(g.fixed?n.jsx("p",{"data-plan-owner":"company",className:"mt-3 text-[12.5px] leading-relaxed text-ink-secondary",children:l("setup.owner.company")}):n.jsxs("div",{"data-plan-owner":b?"personal":"company",className:"mt-3 flex items-start justify-between gap-3 rounded-xl border border-hairline/40 bg-card/80 px-3.5 py-3 backdrop-blur-xl",children:[n.jsxs("span",{className:"min-w-0",children:[n.jsx("span",{className:"block text-[13px] font-medium text-ink",children:l("setup.owner.toggle")}),n.jsx("span",{className:"mt-0.5 block text-[12px] leading-relaxed text-ink-secondary",children:l("setup.owner.toggleHint")})]}),n.jsx(Dt,{checked:b,"aria-label":l("setup.owner.toggle"),onClick:N})]})),n.jsx($i,{children:n.jsx("p",{children:l(`setup.plan.${e}.what`,{name:c})})})]})}const qre="antigravityAgent";function FD(e,t){const{refreshInstances:a}=ve(),[o,i]=f.useState("idle"),s=f.useRef(null),r=()=>{s.current!==null&&window.clearInterval(s.current),s.current=null};f.useEffect(()=>r,[]);const c=f.useCallback(async()=>{if(!e)return;r(),i("waiting");const d=`/api/instances/${encodeURIComponent(e)}/auth`;try{const{auth:p}=await X(`${d}/start`,{method:"POST",body:"{}",timeoutMs:12e4});if(p.phase==="succeeded"){await a().catch(()=>{});return}if(!p.flowId||!p.authorizationUrl)throw new Error("no sign-in page");m0(JE(p.authorizationUrl,t)),s.current=window.setInterval(()=>{a().catch(()=>{}),X(`${d}/status?flowId=${encodeURIComponent(p.flowId)}`,{timeoutMs:1e4}).then(({auth:h})=>{(h.phase==="failed"||h.phase==="expired"||h.phase==="cancelled")&&(r(),i("failed"))}).catch(()=>{})},2e3)}catch{r(),i("failed")}},[e,t,a]);return{state:o,start:c,reset:()=>{r(),i("idle")}}}function _D({chibitek:e,onRetry:t,onContinueLocal:a}){return n.jsxs("div",{role:"alert",className:"mt-3 rounded-xl border border-warning/30 bg-warning/10 px-3 py-2.5",children:[n.jsxs("div",{className:"flex items-start gap-2 text-[12.5px] leading-relaxed text-ink",children:[n.jsx(Zn,{size:14,className:"mt-0.5 shrink-0 text-warning","aria-hidden":"true"}),n.jsx("span",{children:e?l("setup.google.geminiNotOnChibitek",{email:_c}):l("setup.google.geminiNotOn")})]}),n.jsxs("div",{className:"mt-2 flex flex-wrap gap-2",children:[n.jsx("button",{type:"button",onClick:t,className:Za,children:l("setup.tryAgain")}),a&&n.jsx("button",{type:"button",onClick:a,className:Za,children:l("setup.google.continueLocal")})]})]})}function Ure({stage:e,required:t,domain:a,accountEmail:o,geminiWorks:i,error:s,onStart:r,onRetryGemini:c,onSkipGemini:d,onUseOtherAccount:p,onSkip:h}){const g=a?l("setup.google.useDomain",{domain:a}):l("setup.google.useCompany");return n.jsxs("div",{className:"flex flex-col",children:[n.jsx("p",{className:"text-[14px] leading-relaxed text-ink-secondary",children:l("setup.google.intro")}),n.jsx("p",{className:"mt-1.5 text-[13px] font-medium text-ink",children:g}),t&&n.jsx("p",{className:"mt-1.5 text-[12.5px] text-ink-secondary",children:l("setup.google.required")}),n.jsxs("div",{className:"mt-4 rounded-xl border border-accent/40 bg-accent/5 p-3.5","data-stage":e,children:[e==="start"&&n.jsxs("button",{type:"button",onClick:r,className:V(Ha,"w-full"),children:[n.jsx(wr,{size:14,"aria-hidden":"true"}),l("setup.google.button")]}),e==="installing"&&n.jsx(Oi,{label:l("setup.google.installing")}),e==="geminiSignIn"&&n.jsxs("p",{role:"status",className:"flex items-center gap-2 text-[13px] text-ink",children:[n.jsx(Ie,{size:14,className:"animate-spin","aria-hidden":"true"}),l("setup.google.geminiWaiting")]}),e==="geminiOff"&&n.jsx(_D,{chibitek:!0,onRetry:c,onContinueLocal:d}),e==="account"&&n.jsxs(n.Fragment,{children:[n.jsxs("p",{role:"status",className:"flex items-center gap-2 text-[13px] text-ink",children:[n.jsx(Ie,{size:14,className:"animate-spin","aria-hidden":"true"}),l("setup.google.accountWaiting")]}),h&&n.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-[12.5px] text-ink-secondary",children:[n.jsx("span",{children:l("setup.google.stuckHint")}),n.jsx("button",{type:"button",onClick:h,className:Za,"data-google-continue-without":!0,children:l("setup.google.continueWithout")})]})]}),e==="wrongDomain"&&n.jsxs("div",{role:"alert",className:"rounded-xl border border-danger/25 bg-danger/10 px-3 py-2.5",children:[n.jsx("p",{className:"text-[12.5px] leading-relaxed text-ink",children:l("setup.google.wrongDomain",{domain:a??"",email:o??""})}),n.jsx("button",{type:"button",onClick:p,className:V(Za,"mt-2"),children:l("setup.google.useOther")})]}),e==="testing"&&n.jsxs("p",{role:"status",className:"flex items-center gap-2 text-[13px] text-ink-secondary",children:[n.jsx(Ie,{size:14,className:"animate-spin","aria-hidden":"true"}),l("setup.connect.testing",{name:"Gemini"})]}),e==="done"&&n.jsxs(n.Fragment,{children:[n.jsx(Xc,{children:l("setup.google.done",{email:o??""})}),n.jsx("p",{className:"mt-1 text-[12.5px] text-ink-secondary",children:l(i?"setup.google.geminiReady":"setup.google.geminiLater")})]}),e==="failed"&&(h?n.jsxs("div",{role:"alert",className:"rounded-xl border border-warning/30 bg-warning/10 px-3 py-2.5","data-google-unavailable":!0,children:[n.jsxs("div",{className:"flex items-start gap-2 text-[12.5px] leading-relaxed text-ink",children:[n.jsx(Zn,{size:14,className:"mt-0.5 shrink-0 text-warning","aria-hidden":"true"}),n.jsx("span",{children:l("setup.google.unavailable")})]}),n.jsxs("div",{className:"mt-2 flex flex-wrap gap-2",children:[n.jsx("button",{type:"button",onClick:h,className:Ha,children:l("setup.continue")}),n.jsx("button",{type:"button",onClick:r,className:Za,children:l("setup.tryAgain")})]})]}):n.jsx(ho,{message:l("setup.error.failed"),detail:s,onRetry:r}))]}),n.jsx($i,{children:n.jsx("p",{children:l("setup.google.what")})})]})}function Vre(e){return e?.snapshot.state==="available"&&e.snapshot.authenticated!==!1}function Hre({required:e,domain:t,onDone:a,onSkip:o}){const{state:i,refreshInstances:s}=ve(),r=sS(i.instances,qre),[c,d]=f.useState("start"),[p,h]=f.useState(null),[g,b]=f.useState(null),[x,v]=f.useState(!1),k=FD(r?.instanceId,t),S=Cr(D=>{s().catch(()=>{}),D.state==="succeeded"?d("geminiSignIn"):d("geminiOff")}),N=f.useRef(null);f.useEffect(()=>()=>{N.current!==null&&window.clearInterval(N.current)},[]),f.useEffect(()=>{if(c==="geminiSignIn"){if(Vre(r)){v(!0),d("account");return}k.state==="idle"&&k.start(),k.state==="failed"&&d("geminiOff")}},[c,r,k]);const C=f.useCallback(async()=>{b(null);try{const D=await X("/api/accounts/connect",{method:"POST",body:JSON.stringify({provider:"google"})});D.url&&m0(JE(D.url,t)),N.current!==null&&window.clearInterval(N.current),N.current=window.setInterval(()=>{X(`/api/accounts/connect/${encodeURIComponent(D.id)}`).then(A=>{if(!(A.state==="waiting"||A.state==="finishing")){if(N.current!==null&&window.clearInterval(N.current),N.current=null,A.state!=="connected"){b(A.error??A.state),d("failed");return}h(A.email??null),WE(A.email,t)?d("testing"):d("wrongDomain")}}).catch(A=>{N.current!==null&&window.clearInterval(N.current),b(A instanceof Error?A.message:String(A)),d("failed")})},2e3)}catch(D){b(D instanceof Error?D.message:String(D)),d("failed")}},[t]);f.useEffect(()=>{c==="account"&&C()},[c]),f.useEffect(()=>{if(c==="testing"){if(!x||!r){d("done"),a(!1);return}X("/api/setup/engine-test",{method:"POST",body:JSON.stringify({instanceId:r.instanceId}),timeoutMs:6e4}).then(D=>{v(D.ok),d("done"),a(D.ok)}).catch(()=>{v(!1),d("done"),a(!1)})}},[c]);const j=()=>{if(b(null),k.reset(),!r){d("account");return}if(r.snapshot.state!=="available"){d("installing"),S.start("engine-install",r.instanceId);return}d("geminiSignIn")},M=async()=>{const A=(await X("/api/accounts").catch(()=>null))?.providers.find(R=>R.id==="google")?.accounts.find(R=>R.email===p);A&&await X(`/api/accounts/${encodeURIComponent(A.id)}`,{method:"DELETE"}).catch(()=>{}),h(null),d("account")};return n.jsx(Ure,{stage:c,required:e,domain:t,accountEmail:p,geminiWorks:x,error:g,onStart:j,onRetryGemini:()=>{k.reset(),d(r?.snapshot.state==="available"?"geminiSignIn":"installing"),r&&r.snapshot.state!=="available"&&S.start("engine-install",r.instanceId)},onSkipGemini:()=>{v(!1),d("account")},onUseOtherAccount:()=>{M()},onSkip:o&&(()=>{N.current!==null&&window.clearInterval(N.current),N.current=null,o()})})}const xb={gmail:"https://www.googleapis.com/auth/gmail.readonly",gmailSend:"https://www.googleapis.com/auth/gmail.compose",calendar:"https://www.googleapis.com/auth/calendar.events",drive:"https://www.googleapis.com/auth/drive.readonly"},Gre=["openid","email","profile"],mc={mailReadWrite:"Mail.ReadWrite",mailSend:"Mail.Send",calendars:"Calendars.ReadWrite",files:"Files.Read.All"},$re={google:{id:"google",label:"Google",authorizeUrl:"https://accounts.google.com/o/oauth2/v2/auth",tokenUrl:"https://oauth2.googleapis.com/token",redirectHost:"127.0.0.1",scopes:Gre,incremental:!0,authorizeParams:{access_type:"offline",prompt:"consent select_account",include_granted_scopes:"true"},clientIdEnv:"ATOMIC_GOOGLE_OAUTH_CLIENT_ID",clientSecretEnv:"ATOMIC_GOOGLE_OAUTH_CLIENT_SECRET",families:{gmail:xb.gmail,gmailSend:xb.gmailSend,calendar:xb.calendar,drive:xb.drive}},microsoft:{id:"microsoft",label:"Microsoft",authorizeUrl:"https://login.microsoftonline.com/common/oauth2/v2.0/authorize",tokenUrl:"https://login.microsoftonline.com/common/oauth2/v2.0/token",redirectHost:"localhost",scopes:["offline_access","openid","profile","email","User.Read",mc.mailReadWrite,mc.mailSend,mc.calendars,mc.files],incremental:!1,authorizeParams:{prompt:"select_account",response_mode:"query"},clientIdEnv:"ATOMIC_MICROSOFT_OAUTH_CLIENT_ID",families:{outlook:mc.mailReadWrite,outlookCalendar:mc.calendars,onedrive:mc.files}}};function qD(e){const t=$re[e];return t.incremental?Object.keys(t.families):[]}const Kre="Atomic",jg="https://github.com/chibitek/atomic",H7="/handbook/atomic-handbook.html",Wre=`${jg}/blob/main/docs/approval-levels.md`,Jre=`${jg}/issues`,Yre=`${jg}/releases`,Zre=`${jg}/blob/main/LICENSE`;function rS(){return"0.1.176"}const Qre={darwin:"macOS",win32:"Windows",linux:"Linux"};function Xre(e){return(e&&Qre[e])??null}async function Pl(e){if(window.ogb?.openExternal){await window.ogb.openExternal(e);return}window.open(e,"_blank","noopener,noreferrer")}const ele=2e3,UD={google:{title:"accounts.google.title",subtitle:"accounts.google.subtitle",badge:"G",badgeClass:"bg-[#4285F4]"},microsoft:{title:"accounts.microsoft.title",subtitle:"accounts.microsoft.subtitle",badge:"M",badgeClass:"bg-[#0078D4]"}},VD={gmail:"accounts.family.gmail",gmailSend:"accounts.family.gmailSend",calendar:"accounts.family.calendar",drive:"accounts.family.drive",outlook:"accounts.family.outlook",outlookCalendar:"accounts.family.outlookCalendar",onedrive:"accounts.family.onedrive"},tle={gmail:"accounts.why.gmail",gmailSend:"accounts.why.gmailSend",calendar:"accounts.why.calendar",drive:"accounts.why.drive"};function nle({account:e,busy:t,onTurnOn:a}){const o=qD(e.provider);if(!o.length)return null;const i=new Set(e.missing??[]);return n.jsx("ul",{className:"mt-2 flex flex-col gap-1.5","data-account-families":!0,children:o.map(s=>{const r=!i.has(s),c=tle[s];return n.jsxs("li",{className:"flex items-start gap-2 text-[11.5px] leading-relaxed",children:[n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("span",{className:"text-ink",children:l(VD[s])}),c&&n.jsxs("span",{className:"text-ink-secondary",children:[" · ",l(c)]})]}),r?n.jsx("span",{className:"shrink-0 text-success",children:l("accounts.familyOn")}):n.jsx("button",{type:"button",onClick:()=>a(s),disabled:t||e.status!=="ok",className:"shrink-0 text-accent hover:underline disabled:no-underline disabled:opacity-50","data-account-turn-on":s,children:l("accounts.turnOn")})]},s)})})}function lS(){const[e,t]=f.useState(null),[a,o]=f.useState(null),i=f.useCallback(async()=>{try{t(await X("/api/accounts",{timeoutMs:3e4})),o(null)}catch(s){o(s instanceof Error?s.message:String(s))}},[]);return f.useEffect(()=>{i();const s=()=>{i()};return window.addEventListener("focus",s),()=>window.removeEventListener("focus",s)},[i]),{status:e,error:a,refresh:i}}function HD({provider:e}){const t=UD[e];return n.jsx("span",{"aria-hidden":!0,className:V("flex size-6 shrink-0 items-center justify-center rounded-full text-[11px] font-semibold text-white",t.badgeClass),children:t.badge})}function ale({account:e,busy:t,onReconnect:a,onTurnOn:o,onRemove:i,personal:s,onPersonal:r}){const c=new Date(e.addedAt).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"}),d=qD(e.provider).length>0,p=d?[]:e.missing??[];return n.jsxs("div",{className:"flex items-start gap-3 px-3 py-2.5",children:[n.jsx(HD,{provider:e.provider}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"truncate text-[13px] text-ink",children:e.email}),n.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-x-2 text-[11.5px] text-ink-secondary",children:[n.jsx("span",{children:l("accounts.connectedOn",{date:c})}),n.jsx("span",{className:e.status==="ok"?"text-success":"text-warning",children:e.status==="ok"?l("accounts.status.ok"):l("accounts.status.reauth")})]}),p.length?n.jsx("div",{className:"mt-1 text-[11.5px] leading-relaxed text-warning",children:l("accounts.missing",{services:p.map(h=>l(VD[h])).join(", ")})}):null,d&&n.jsx(nle,{account:e,busy:t,onTurnOn:o})]}),n.jsxs("div",{className:"flex shrink-0 items-center gap-2 text-[12px]",children:[r&&n.jsxs("label",{className:"flex items-center gap-1.5 text-ink-secondary",title:l("owner.connectionHint"),children:[n.jsx("span",{children:l("owner.personal")}),n.jsx(Dt,{checked:!!s,disabled:t,"aria-label":l("owner.connectionToggle",{name:e.email}),onClick:()=>r(!s)})]}),(e.status==="reauth"||p.length>0)&&n.jsx("button",{type:"button",onClick:a,disabled:t,className:"text-ink-secondary hover:text-ink disabled:opacity-50",children:l("accounts.signInAgain")}),n.jsx("button",{type:"button",onClick:i,disabled:t,className:"text-danger hover:underline disabled:no-underline disabled:opacity-50",children:l("accounts.remove")})]})]})}function GD({provider:e,storageReady:t,onChanged:a,personalIds:o,onPersonal:i,onGiveUp:s}){const r=UD[e.id],[c,d]=f.useState(null),[p,h]=f.useState(null),[g,b]=f.useState(null),[x,v]=f.useState(!1),[k,S]=f.useState(null),[N,C]=f.useState(!1),j=f.useRef(null),M=()=>{j.current!==null&&window.clearInterval(j.current),j.current=null};f.useEffect(()=>M,[]);const D=O=>{M(),j.current=window.setInterval(()=>{X(`/api/accounts/connect/${O}`).then(async T=>{T.state==="waiting"||T.state==="finishing"||(M(),d(null),T.state==="connected"?(b(l("accounts.connected",{email:T.email??""})),await a()):s&&T.state!=="cancelled"?h(l(e.id==="microsoft"?"setup.accounts.microsoftUnavailable":"setup.accounts.googleUnavailable")):T.state==="expired"?h(l("accounts.expired")):T.state==="failed"&&h(T.error??l("accounts.failed")))}).catch(T=>{M(),d(null),h(T instanceof Error?T.message:String(T))})},ele)},A=async O=>{if(!(x||c)){v(!0),h(null),b(null);try{const T=await X("/api/accounts/connect",{method:"POST",body:JSON.stringify({provider:e.id,...O})});d(T),D(T.id),T.url&&await Pl(T.url)}catch(T){h(T instanceof Error?T.message:String(T))}finally{v(!1)}}},R=async()=>{const O=c;M(),d(null),O&&await X(`/api/accounts/connect/${O.id}`,{method:"DELETE"}).catch(()=>{})},P=async()=>{const O=k;if(S(null),!(!O||N)){C(!0),h(null),b(null);try{await X(`/api/accounts/${encodeURIComponent(O.id)}`,{method:"DELETE"}),await a()}catch(T){h(T instanceof Error?T.message:String(T))}finally{C(!1)}}};return n.jsxs(ut,{title:l(r.title),subtitle:l(r.subtitle),children:[n.jsxs("div",{className:"flex flex-col gap-3",children:[e.configured?n.jsxs(n.Fragment,{children:[e.accounts.length>0&&n.jsx("div",{className:"divide-y divide-hairline/40 overflow-hidden rounded-lg border border-hairline/40",children:e.accounts.map(O=>n.jsx(ale,{account:O,busy:N||!!c,onReconnect:()=>{A()},onRemove:()=>S(O),onTurnOn:T=>{A({families:[T],accountId:O.id})},personal:o?.includes(O.id),onPersonal:i&&(T=>i(O.id,T))},O.id))}),c?n.jsxs("div",{role:"status",className:"flex flex-wrap items-center gap-3 rounded-lg bg-inset px-3 py-2.5 text-[12.5px] text-ink",children:[n.jsx(Ie,{size:14,className:"animate-spin text-ink-secondary"}),n.jsx("span",{className:"min-w-0 flex-1",children:l("accounts.waiting",{provider:e.label})}),c.url&&n.jsx("button",{type:"button",onClick:()=>{Pl(c.url)},className:"text-ink-secondary hover:text-ink",children:l("accounts.openAgain")}),n.jsx("button",{type:"button",onClick:()=>{R()},className:"rounded-lg px-2 py-1 text-ink-secondary hover:bg-raised/50 hover:text-ink",children:l("common.cancel")}),s&&n.jsx("button",{type:"button",onClick:()=>{R(),s()},className:"rounded-lg px-2 py-1 font-medium text-ink hover:bg-raised/50","data-account-continue-without":!0,children:l("setup.google.continueWithout")})]}):n.jsxs("button",{type:"button",onClick:()=>{A()},disabled:x||N||!t,className:"flex w-fit items-center gap-1.5 rounded-lg bg-control px-3 py-2 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-50",children:[x?n.jsx(Ie,{size:14,className:"animate-spin"}):n.jsx(vn,{size:14}),e.accounts.length?l("accounts.connectAnother"):l("accounts.connect")]})]}):n.jsx("div",{className:"rounded-lg bg-inset px-3 py-2 text-[12.5px] text-ink-secondary",children:l("accounts.notConfigured")}),g&&n.jsx("p",{role:"status",className:"text-[12px] text-success",children:g}),p&&(s?n.jsxs("div",{role:"alert",className:"flex flex-wrap items-center gap-2 rounded-lg bg-warning/10 px-3 py-2 text-[12.5px] text-ink","data-account-unavailable":!0,children:[n.jsx("span",{className:"min-w-0 flex-1",children:p}),n.jsx("button",{type:"button",onClick:s,className:"rounded-lg bg-accent px-3 py-1.5 text-[12.5px] font-medium text-white",children:l("setup.continue")})]}):n.jsx("p",{role:"alert",className:"text-[12px] text-danger",children:p}))]}),n.jsx(Oa,{open:k!==null,title:l("accounts.removeTitle",{email:k?.email??""}),body:l("accounts.removeBody"),confirmLabel:l("accounts.remove"),tone:"neutral",onCancel:()=>S(null),onConfirm:()=>{P()}})]})}function ole(){const{dispatch:e}=ve();return n.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 rounded-lg border border-hairline/40 px-3 py-2 text-[12.5px] leading-relaxed text-ink-secondary","data-not-the-ai":!0,children:[n.jsx("span",{className:"min-w-0 flex-1 basis-60",children:l("accounts.notTheAi")}),n.jsx("button",{type:"button",onClick:()=>e({type:"toggleAppSettings",open:!0,section:"engines"}),className:"shrink-0 font-medium text-accent hover:underline",children:l("accounts.openSubscriptions")})]})}function ile(){const{status:e,error:t,refresh:a}=lS(),o=h0(),[i,s]=f.useState("");if(!e)return t?n.jsx("p",{role:"alert",className:"text-[12.5px] text-danger",children:t}):n.jsx("p",{className:"text-[12.5px] text-ink-secondary",children:l("accounts.loading")});const r=e.storage!=="unavailable";return n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"text-[13px] leading-relaxed text-ink-secondary",children:l("accounts.intro")}),n.jsx(ole,{}),!r&&n.jsx("div",{role:"alert",className:"rounded-lg border border-warning/30 bg-warning/10 px-3 py-2 text-[12.5px] text-warning",children:l("accounts.storageUnavailable")}),n.jsx("p",{className:"text-[12px] leading-relaxed text-ink-secondary",children:l("owner.connectionsIntro")}),i&&n.jsx("p",{role:"alert",className:"text-[12px] text-danger",children:l("owner.failed",{error:i})}),e.providers.map(c=>n.jsx(GD,{provider:c,storageReady:r,onChanged:a,personalIds:o.connections.accounts,onPersonal:(d,p)=>{s(""),o.set("accounts",d,p).catch(h=>s(h instanceof Error?h.message:String(h)))}},c.id))]})}function sle({onConnected:e,onSkip:t,sameAsGemini:a=!1,domain:o=null}){const{status:i,error:s,refresh:r}=lS(),c=(g,b)=>g!=="google"||WE(b,o),d=i?.providers.some(g=>g.accounts.some(b=>c(g.id,b.email)))??!1,p=i?.providers.flatMap(g=>g.accounts.filter(b=>!c(g.id,b.email)))??[];f.useEffect(()=>{d&&e()},[d]);const h=i?.storage!=="unavailable";return n.jsxs("div",{className:"flex flex-col",children:[n.jsx("p",{className:"text-[14px] leading-relaxed text-ink-secondary",children:l("setup.accounts.intro")}),a&&n.jsx("p",{className:"mt-1.5 text-[13px] font-medium leading-relaxed text-ink",children:o?l("setup.accounts.sameAccountDomain",{domain:o}):l("setup.accounts.sameAccount")}),n.jsx("p",{className:"mt-1.5 text-[12.5px] leading-relaxed text-ink-secondary",children:l("setup.accounts.perBot")}),p.length>0&&o&&n.jsx("p",{role:"alert",className:"mt-3 rounded-xl border border-danger/25 bg-danger/10 px-3 py-2.5 text-[12.5px] leading-relaxed text-ink",children:l("setup.google.wrongDomain",{domain:o,email:p[0].email})}),n.jsxs("div",{className:"mt-4 flex flex-col gap-3",children:[!i&&(s?n.jsx("p",{role:"alert",className:"text-[12.5px] text-danger",children:l("setup.accounts.loadFailed")}):n.jsx("p",{className:"text-[12.5px] text-ink-secondary",children:l("accounts.loading")})),i?.providers.map(g=>n.jsx(GD,{provider:g,storageReady:h,onChanged:r,onGiveUp:t},g.id))]}),t&&n.jsx("p",{className:"mt-3 text-[12.5px] text-ink-secondary",children:l("setup.accounts.optional")}),n.jsx($i,{children:n.jsx("p",{children:l("setup.accounts.what")})})]})}function rle(e){return e.filter(t=>t.kind==="apiKey"&&t.billing==="payPerUse")}function lle({onSaved:e}){const{refreshInstances:t}=ve(),[a,o]=f.useState([]),[i,s]=f.useState(null),[r,c]=f.useState(""),[d,p]=f.useState("entering"),[h,g]=f.useState(null),[b,x]=f.useState([]);f.useEffect(()=>{X("/api/provider-accounts",{timeoutMs:1e4}).then(({providers:S})=>{const N=rle(S);o(N),x(N.filter(C=>C.accounts.some(j=>j.keyConfigured)).map(C=>C.id))}).catch(()=>o([]))},[]);const v=a.find(S=>S.id===i)??null,k=async()=>{const S=r.trim();if(!(!v||!S)){p("saving"),g(null);try{if(v.keyTest){const N=await X("/api/keys/test",{method:"POST",body:JSON.stringify({provider:v.keyTest.provider,key:S,...v.keyTest.url?{url:v.keyTest.url}:{}}),timeoutMs:3e4});if(!N.ok){p(N.reason==="rejected"?"rejected":N.reason==="unreachable"?"unreachable":"failed");return}}await RD(v,v.label,S),c(""),x(N=>[...new Set([...N,v.id])]),p("tested"),e(),await t().catch(()=>{})}catch(N){g(N instanceof Error?N.message:String(N)),p("failed")}}};return n.jsxs("div",{className:"flex flex-col",children:[n.jsx("p",{className:"text-[14px] leading-relaxed text-ink-secondary",children:l("setup.apiKeys.intro")}),n.jsx("p",{className:"mt-1.5 text-[12.5px] leading-relaxed text-ink-secondary",children:l("setup.apiKeys.costs")}),n.jsx("div",{role:"radiogroup","aria-label":l("setup.apiKeys.pick"),className:"mt-4 grid grid-cols-2 gap-2 sm:grid-cols-3",children:a.map(S=>n.jsxs("button",{type:"button",role:"radio","aria-checked":i===S.id,onClick:()=>{s(S.id),c(""),p("entering")},className:V("flex items-center gap-2 rounded-xl border px-3 py-2.5 text-left text-[13px] transition-colors",i===S.id?"border-accent bg-accent/10 text-ink":"border-hairline/50 bg-card text-ink-secondary hover:bg-raised/40"),children:[S.icon?n.jsx(wg,{preset:S.icon,size:18}):n.jsx(hd,{driverKind:S.driver,size:18}),n.jsx("span",{className:"min-w-0 flex-1 truncate font-medium text-ink",children:S.label}),b.includes(S.id)&&n.jsx("span",{className:"text-[11px] text-success",children:l("setup.apiKeys.saved")})]},S.id))}),v&&n.jsx(LD,{name:v.label,phase:d,value:r,onChange:S=>{c(S),d!=="saving"&&p("entering")},onSave:()=>{k()},keyUrl:v.keyUrl,error:h}),n.jsxs($i,{children:[n.jsx("p",{children:l("setup.apiKeys.what1")}),n.jsx("p",{children:l("setup.apiKeys.what2")})]})]})}const G7="atomic-engine";function cle(e,t,a=null){return e?t?t.snapshot.state==="available"?"ready":a?.kind==="engine-install"&&a.state==="running"?"installing":a?.kind==="engine-install"&&a.state==="failed"?"installFailed":t.install?.managed?"installable":"notInstalled":"absent":"checking"}function dle({phase:e,chibitek:t,checking:a,onCheck:o,onInstall:i,job:s,downloadBytes:r}){return n.jsxs("div",{className:"flex flex-col",children:[n.jsx("p",{className:"text-[14px] leading-relaxed text-ink-secondary",children:l("setup.atomicEngine.intro")}),n.jsxs("div",{className:"mt-4 rounded-xl border border-hairline/40 bg-card p-3.5","data-phase":e,children:[e==="checking"&&n.jsxs("p",{role:"status",className:"flex items-center gap-2 text-[13px] text-ink-secondary",children:[n.jsx(Ie,{size:14,className:"animate-spin","aria-hidden":"true"}),l("setup.atomicEngine.checking")]}),e==="ready"&&n.jsx(Xc,{children:l("setup.atomicEngine.ready")}),e==="installable"&&n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"text-[13px] leading-relaxed text-ink",children:l("setup.atomicEngine.installIntro",{size:G2(r??0)})}),n.jsxs("button",{type:"button",onClick:i,className:V(Ha,"mt-3 w-full"),children:[n.jsx(pa,{size:14,"aria-hidden":"true"}),l("setup.atomicEngine.install")]})]}),e==="installing"&&n.jsxs(n.Fragment,{children:[n.jsx(Oi,{label:l("setup.atomicEngine.installing")}),n.jsx(md,{detail:s?.detail})]}),e==="installFailed"&&n.jsx(ho,{message:Ml(s),detail:s?.detail,onRetry:i}),(e==="notInstalled"||e==="absent")&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"inline-flex rounded-full bg-raised px-2 py-0.5 text-[11px] font-medium text-ink-secondary",children:l("setup.optional")}),n.jsx("p",{className:"mt-2 text-[13px] leading-relaxed text-ink",children:l("setup.atomicEngine.notYet")}),n.jsx("p",{className:"mt-1.5 text-[12.5px] leading-relaxed text-ink-secondary",children:l(t?"setup.atomicEngine.askChibitek":"setup.atomicEngine.others")}),e==="notInstalled"&&n.jsxs("button",{type:"button",onClick:o,disabled:a,className:`${Za} mt-3`,children:[n.jsx(fn,{size:13,className:a?"animate-spin":"","aria-hidden":"true"}),l(a?"common.checking":"common.checkAgain")]})]})]}),n.jsx($i,{children:n.jsx("p",{children:l("setup.atomicEngine.what")})})]})}function ule({chibitek:e,onReady:t}){const{state:a,refreshInstances:o}=ve(),[i,s]=f.useState(a.instances.length>0),[r,c]=f.useState(!1),{job:d,start:p}=Cr(()=>{o().catch(()=>{})}),h=a.instances.find(x=>x.instanceId===G7),g=cle(i,h,d),b=()=>{c(!0),o().catch(()=>{}).finally(()=>{c(!1),s(!0)})};return f.useEffect(b,[]),f.useEffect(()=>{g==="ready"&&t()},[g]),n.jsx(dle,{phase:g,chibitek:e,checking:r,onCheck:b,onInstall:()=>{p("engine-install",G7)},job:d,downloadBytes:h?.install?.managed?.downloadBytes})}function ple({chibi:e,connected:t,items:a}){const o=a.filter(i=>i.status!=="done");return n.jsxs("div",{className:"flex flex-col",children:[n.jsxs("div",{className:"rounded-xl border border-hairline/40 bg-card px-3.5 py-3",children:[n.jsx("div",{className:"text-[11.5px] font-semibold uppercase tracking-wide text-ink-secondary",children:l("setup.chibi.connectedTitle")}),t.length?n.jsx("ul",{className:"mt-1.5 space-y-1",children:t.map(i=>n.jsxs("li",{className:"flex items-center gap-2 text-[13px] text-ink",children:[n.jsx(rs,{size:14,className:"shrink-0 text-success","aria-hidden":"true"}),i]},i))}):n.jsx("p",{className:"mt-1.5 text-[13px] leading-relaxed text-ink",children:l("setup.chibi.nothingConnected")}),o.length>0&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"mt-3 text-[11.5px] font-semibold uppercase tracking-wide text-ink-secondary",children:l("setup.chibi.laterTitle")}),n.jsx("ul",{className:"mt-1.5 space-y-1",children:o.map(i=>n.jsxs("li",{className:"flex items-center gap-2 text-[12.5px] text-ink-secondary",children:[i.status==="skipped"?n.jsx(BB,{size:13,"aria-hidden":"true"}):n.jsx(TB,{size:13,"aria-hidden":"true"}),Yy(i.screen)]},i.key))}),n.jsx("p",{className:"mt-2 text-[12px] text-ink-secondary",children:l("setup.chibi.laterHint")})]})]}),n.jsxs("div",{className:"mt-4 flex items-center gap-4 rounded-xl border border-hairline/40 bg-card p-3.5",children:[e&&n.jsx(Jt,{bot:e,state:"happy",size:56}),n.jsxs("div",{className:"min-w-0",children:[n.jsx("div",{className:"text-[14px] font-semibold text-ink",children:l("setup.chibi.meet")}),n.jsx("p",{className:"mt-0.5 text-[12.5px] leading-relaxed text-ink-secondary",children:l("setup.chibi.intro")})]})]})]})}function mle({podman:e,wantsLocal:t,download:a,machine:o,onChooseLocal:i,onLater:s,onDownload:r,onCheck:c,onStart:d}){return t?e?e.platform!=="darwin"||e.arch!=="arm64"?n.jsx("p",{className:"mt-4 rounded-xl border border-hairline/40 bg-card p-3.5 text-[13px] leading-relaxed text-ink",children:l("setup.computers.unsupported")}):n.jsxs("div",{className:"mt-4 rounded-xl border border-hairline/40 bg-card p-3.5","data-podman":e.installed?e.running?"running":"installed":"missing",children:[!e.installed&&a?.state!=="running"&&a?.state!=="succeeded"&&a?.state!=="failed"&&n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"text-[13px] leading-relaxed text-ink",children:l("setup.computers.podmanIntro")}),n.jsxs("button",{type:"button",onClick:r,className:V(Ha,"mt-3 w-full"),children:[n.jsx(pa,{size:14,"aria-hidden":"true"}),l("setup.computers.download")]}),n.jsx("p",{className:"mt-1.5 text-center text-[11px] text-ink-secondary",children:l("setup.computers.downloadNote")})]}),a?.state==="running"&&n.jsxs(n.Fragment,{children:[n.jsx(Oi,{label:l(a.phase==="downloading"?"setup.computers.phase.downloading":a.phase==="verifying"?"setup.computers.phase.verifying":"setup.computers.phase.opening"),received:a.received,total:a.total}),n.jsx(md,{detail:a.detail})]}),!e.installed&&a?.state==="succeeded"&&n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"text-[13px] leading-relaxed text-ink",children:l("setup.computers.finishInstaller")}),n.jsxs("button",{type:"button",onClick:c,className:V(Za,"mt-3"),children:[n.jsx(fn,{size:13,"aria-hidden":"true"}),l("setup.computers.installedCheck")]})]}),!e.installed&&a?.state==="failed"&&n.jsx(ho,{message:Ml(a),detail:a.detail,onRetry:r}),e.installed&&!e.running&&o?.state!=="running"&&n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"text-[13px] leading-relaxed text-ink",children:l("setup.computers.startIntro")}),n.jsx("button",{type:"button",onClick:d,className:V(Ha,"mt-3 w-full"),children:l("setup.computers.start")}),o?.state==="failed"&&n.jsx(ho,{message:Ml(o),detail:o.detail,onRetry:d})]}),o?.state==="running"&&n.jsx(Oi,{label:l("setup.computers.starting")}),e.installed&&e.running&&n.jsx(Xc,{children:l("setup.computers.ready")})]}):n.jsx(Oi,{label:l("setup.computers.checking")}):n.jsxs("div",{className:"mt-4 grid gap-2 sm:grid-cols-2",children:[n.jsxs("button",{type:"button","data-primary":"",onClick:s,"aria-label":l("setup.computers.later"),"aria-describedby":"computers-later-detail",className:"flex flex-col items-start gap-1.5 rounded-xl border border-accent bg-accent/10 p-3.5 text-left",children:[n.jsx(Es,{size:18,className:"text-ink-secondary","aria-hidden":"true"}),n.jsx("span",{className:"text-[13.5px] font-semibold text-ink",children:l("setup.computers.later")}),n.jsx("span",{id:"computers-later-detail",className:"text-[12px] leading-snug text-ink-secondary",children:l("setup.computers.laterDetail")})]}),n.jsxs("button",{type:"button",onClick:i,"aria-label":l("setup.computers.local"),"aria-describedby":"computers-local-detail",className:"flex flex-col items-start gap-1.5 rounded-xl border border-hairline/50 bg-card p-3.5 text-left hover:bg-raised/40",children:[n.jsx(Ba,{size:18,className:"text-ink-secondary","aria-hidden":"true"}),n.jsx("span",{className:"text-[13.5px] font-semibold text-ink",children:l("setup.computers.local")}),n.jsx("span",{id:"computers-local-detail",className:"text-[12px] leading-snug text-ink-secondary",children:l("setup.computers.localDetail")})]})]})}function hle({onReady:e,onLater:t}){const[a,o]=f.useState(!1),[i,s]=f.useState(null),r=f.useCallback(async()=>{const p=await X("/api/setup/machine",{timeoutMs:15e3}).catch(()=>null);p&&s({platform:p.platform,arch:p.arch,...p.podman})},[]),c=Cr(()=>{r()}),d=Cr(()=>{r()});return f.useEffect(()=>{a&&r()},[a,r]),f.useEffect(()=>{i?.installed&&i.running&&e()},[i?.installed,i?.running]),n.jsxs("div",{className:"flex flex-col",children:[n.jsx("p",{className:"text-[14px] leading-relaxed text-ink-secondary",children:l("setup.computers.intro")}),n.jsx(mle,{podman:i,wantsLocal:a,download:c.job,machine:d.job,onChooseLocal:()=>o(!0),onLater:t,onDownload:()=>{c.start("podman-download")},onCheck:()=>{r()},onStart:()=>{d.start("podman-machine")}}),n.jsx($i,{children:n.jsx("p",{children:l("setup.computers.what")})})]})}const gle=[{tag:"gemma4:e4b",label:"Gemma 4",sizeGb:6.6,note:"Google's model. Atomic's pick for Macs with 16 GB or more."},{tag:"gemma4:e2b-it-qat",label:"Gemma 4 (small)",sizeGb:4.3,note:"A lighter Gemma 4 for light tasks on 8 GB Macs."},{tag:"qwen3:4b",label:"Qwen 3 (4B)",sizeGb:2.5,note:"Small and quick. Good for simple tasks."},{tag:"qwen3:8b",label:"Qwen 3 (8B)",sizeGb:5.2,note:"A good everyday model for most Macs."},{tag:"llama3.1:8b",label:"Llama 3.1 (8B)",sizeGb:4.9,note:"Meta's general model. Steady with tools."},{tag:"granite3.3:8b",label:"Granite 3.3 (8B)",sizeGb:4.9,note:"IBM's business-focused model."},{tag:"qwen3:14b",label:"Qwen 3 (14B)",sizeGb:9.3,note:"Noticeably smarter. Needs 16 GB or more."},{tag:"gpt-oss:20b",label:"gpt-oss (20B)",sizeGb:14,note:"OpenAI's open model. Strong reasoning."},{tag:"devstral:24b",label:"Devstral (24B)",sizeGb:14,note:"Mistral's model for coding work."},{tag:"mistral-small3.2:24b",label:"Mistral Small 3.2 (24B)",sizeGb:15,note:"Mistral's general model."},{tag:"qwen3-coder:30b",label:"Qwen 3 Coder (30B)",sizeGb:19,note:"Built for coding and tools. Fast for its size."},{tag:"qwen3:32b",label:"Qwen 3 (32B)",sizeGb:20,note:"Qwen's largest dense model."},{tag:"gpt-oss:120b",label:"gpt-oss (120B)",sizeGb:65,note:"OpenAI's large open model. Needs 96 GB or more."}],t3=1024**3;function fle(e,t){return!(t>0)||e*1.25+6*t3<=t?"fits":e+3*t3<=t?"tight":"tooBig"}function ble(e){return Math.round(e.sizeGb*t3)}const yle=/^[a-z0-9][a-z0-9._/-]*(?::[a-z0-9][a-z0-9._-]*)?$/i;function xle(e){return typeof e=="string"&&e.length<=200&&yle.test(e)&&!e.includes("..")&&!e.includes("//")}function vle(e){return e.enabled?e.custom?"settings.localModels.memory.statusCustom":e.applied?"settings.localModels.memory.statusOn":"settings.localModels.memory.statusFailed":"settings.localModels.memory.statusOff"}function kle(){const e=typeof window<"u"?window.ogb?.ollamaMemory:void 0,[t,a]=f.useState(null),[o,i]=f.useState(!1);if(f.useEffect(()=>{if(!e)return;let r=!1;return e.state().then(c=>{r||a(c)}).catch(()=>{}),()=>{r=!0}},[e]),!e||!t?.supported)return null;const s=vle(t);return n.jsx("div",{className:"mt-4 border-t border-hairline/30 pt-1",children:n.jsx(Wt,{title:l("settings.localModels.memory.title"),subtitle:l("settings.localModels.memory.subtitle"),message:n.jsx("span",{className:s==="settings.localModels.memory.statusFailed"?"text-danger":"text-ink-secondary",children:l(s)}),children:n.jsx(Dt,{checked:t.enabled,disabled:o,"aria-label":l("settings.localModels.memory.title"),onClick:()=>{i(!0),e.set(!t.enabled).then(a).catch(()=>{}).finally(()=>i(!1))},className:"disabled:cursor-wait disabled:opacity-50"})})})}function wle({state:e,onDone:t}){const{job:a,start:o}=Cr(t);return a?.state==="running"?n.jsx("div",{className:"basis-full",children:n.jsx(Oi,{label:l(a.kind==="ollama-start"?"setup.localAi.phase.starting":"setup.localAi.phase.installing"),received:a.received,total:a.total})}):n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",onClick:()=>{o(e==="missing"?"ollama-install":"ollama-start")},className:"text-[12px] font-medium text-accent hover:underline",children:l(e==="missing"?"setup.localAi.installOllama":"setup.localAi.openOllama")}),a?.state==="failed"&&n.jsx("div",{className:"basis-full",children:n.jsx(ho,{message:Ml(a),detail:a.detail})})]})}const n3=1024**3,Wu="rounded-lg border border-hairline/40 px-3 py-1.5 text-[12px] text-ink-secondary hover:bg-raised/50 hover:text-ink disabled:cursor-not-allowed disabled:opacity-50",Sle="min-w-0 flex-1 rounded-lg border border-hairline/40 bg-inset px-3 py-2 text-[13px] text-ink placeholder:text-ink-secondary focus:border-hairline focus:outline-none disabled:opacity-50";function ax(e){return e>=n3?`${(e/n3).toFixed(1)} GB`:`${Math.max(1,Math.round(e/1024**2))} MB`}function Cle(e){const t=e.modifiedAt?new Date(e.modifiedAt):null;return[e.parameterSize,e.quantization,e.family,e.cloud?void 0:ax(e.sizeBytes),t&&!Number.isNaN(t.getTime())?t.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"}):void 0].filter(Boolean).join(" · ")}function jle(e){return e.total?Math.min(100,Math.round((e.completed??0)/e.total*100)):null}const Nle={fits:"settings.localModels.fit.fits",tight:"settings.localModels.fit.tight",tooBig:"settings.localModels.fit.tooBig"};function Ale(e,t){const a=[];for(const o of t){if(o.snapshot.state!=="available"||o.policy||o.readOnly)continue;const i=o.models.options.find(s=>s.id===`ollama::${e}`||s.id===`local_ollama::${e}`);i&&a.push({instance:o,modelId:i.id})}return a}async function $D(e,t){const a=e.getReader(),o=new TextDecoder;let i="";for(;;){const{value:s,done:r}=await a.read();i+=r?`${o.decode()}
86
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const r of e.seen.entries()){const c=r[1];if(t===r[0]){s(r);continue}if(e.external){const p=e.external.registry.get(r[0])?.id;if(t!==r[0]&&p){s(r);continue}}if(e.metadataRegistry.get(r[0])?.id){s(r);continue}if(c.cycle){s(r);continue}if(c.count>1&&e.reused==="ref"){s(r);continue}}}function hD(e,t){const a=e.seen.get(t);if(!a)throw new Error("Unprocessed schema. This is a bug in Zod.");const o=c=>{const d=e.seen.get(c);if(d.ref===null)return;const p=d.def??d.schema,h={...p},g=d.ref;if(d.ref=null,g){o(g);const x=e.seen.get(g),v=x.schema;if(v.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(p.allOf=p.allOf??[],p.allOf.push(v)):Object.assign(p,v),Object.assign(p,h),c._zod.parent===g)for(const S in p)S==="$ref"||S==="allOf"||S in h||delete p[S];if(v.$ref&&x.def)for(const S in p)S==="$ref"||S==="allOf"||S in x.def&&JSON.stringify(p[S])===JSON.stringify(x.def[S])&&delete p[S]}const b=c._zod.parent;if(b&&b!==g){o(b);const x=e.seen.get(b);if(x?.schema.$ref&&(p.$ref=x.schema.$ref,x.def))for(const v in p)v==="$ref"||v==="allOf"||v in x.def&&JSON.stringify(p[v])===JSON.stringify(x.def[v])&&delete p[v]}e.override({zodSchema:c,jsonSchema:p,path:d.path??[]})};for(const c of[...e.seen.entries()].reverse())o(c[0]);const 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){const c=e.external.registry.get(t)?.id;if(!c)throw new Error("Schema is missing an `id` property");i.$id=e.external.uri(c)}Object.assign(i,a.def??a.schema);const s=e.metadataRegistry.get(t)?.id;s!==void 0&&i.id===s&&delete i.id;const r=e.external?.defs??{};for(const c of e.seen.entries()){const d=c[1];d.def&&d.defId&&(d.def.id===d.defId&&delete d.def.id,r[d.defId]=d.def)}e.external||Object.keys(r).length>0&&(e.target==="draft-2020-12"?i.$defs=r:i.definitions=r);try{const c=JSON.parse(JSON.stringify(i));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input:ex(t,"input",e.processors),output:ex(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch{throw new Error("Error converting schema to JSON.")}}function Mo(e,t){const a=t??{seen:new Set};if(a.seen.has(e))return!1;a.seen.add(e);const o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return Mo(o.element,a);if(o.type==="set")return Mo(o.valueType,a);if(o.type==="lazy")return Mo(o.getter(),a);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault")return Mo(o.innerType,a);if(o.type==="intersection")return Mo(o.left,a)||Mo(o.right,a);if(o.type==="record"||o.type==="map")return Mo(o.keyType,a)||Mo(o.valueType,a);if(o.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:Mo(o.in,a)||Mo(o.out,a);if(o.type==="object"){for(const i in o.shape)if(Mo(o.shape[i],a))return!0;return!1}if(o.type==="union"){for(const i of o.options)if(Mo(i,a))return!0;return!1}if(o.type==="tuple"){for(const i of o.items)if(Mo(i,a))return!0;return!!(o.rest&&Mo(o.rest,a))}return!1}const zoe=(e,t={})=>a=>{const o=pD({...a,processors:t});return fo(e,o),mD(o,e),hD(o,e)},ex=(e,t,a={})=>o=>{const{libraryOptions:i,target:s}=o??{},r=pD({...i??{},target:s,io:t,processors:a});return fo(e,r),mD(r,e),hD(r,e)},Loe={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Foe=(e,t,a,o)=>{const i=a;i.type="string";const{minimum:s,maximum:r,format:c,patterns:d,contentEncoding:p}=e._zod.bag;if(typeof s=="number"&&(i.minLength=s),typeof r=="number"&&(i.maxLength=r),c&&(i.format=Loe[c]??c,i.format===""&&delete i.format,c==="time"&&delete i.format),p&&(i.contentEncoding=p),d&&d.size>0){const h=[...d];h.length===1?i.pattern=h[0].source:h.length>1&&(i.allOf=[...h.map(g=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:g.source}))])}},_oe=(e,t,a,o)=>{const i=a,{minimum:s,maximum:r,format:c,multipleOf:d,exclusiveMaximum:p,exclusiveMinimum:h}=e._zod.bag;typeof c=="string"&&c.includes("int")?i.type="integer":i.type="number";const g=typeof h=="number"&&h>=(s??Number.NEGATIVE_INFINITY),b=typeof p=="number"&&p<=(r??Number.POSITIVE_INFINITY),x=t.target==="draft-04"||t.target==="openapi-3.0";g?x?(i.minimum=h,i.exclusiveMinimum=!0):i.exclusiveMinimum=h:typeof s=="number"&&(i.minimum=s),b?x?(i.maximum=p,i.exclusiveMaximum=!0):i.exclusiveMaximum=p:typeof r=="number"&&(i.maximum=r),typeof d=="number"&&(i.multipleOf=d)},qoe=(e,t,a,o)=>{a.type="boolean"},Uoe=(e,t,a,o)=>{a.not={}},Voe=(e,t,a,o)=>{},Hoe=(e,t,a,o)=>{const i=e._zod.def,s=GR(i.entries);s.every(r=>typeof r=="number")&&(a.type="number"),s.every(r=>typeof r=="string")&&(a.type="string"),a.enum=s},Goe=(e,t,a,o)=>{const i=e._zod.def,s=[];for(const r of i.values)if(r===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof r=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(r))}else s.push(r);if(s.length!==0)if(s.length===1){const r=s[0];a.type=r===null?"null":typeof r,t.target==="draft-04"||t.target==="openapi-3.0"?a.enum=[r]:a.const=r}else s.every(r=>typeof r=="number")&&(a.type="number"),s.every(r=>typeof r=="string")&&(a.type="string"),s.every(r=>typeof r=="boolean")&&(a.type="boolean"),s.every(r=>r===null)&&(a.type="null"),a.enum=s},$oe=(e,t,a,o)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Koe=(e,t,a,o)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Woe=(e,t,a,o)=>{const i=a,s=e._zod.def,{minimum:r,maximum:c}=e._zod.bag;typeof r=="number"&&(i.minItems=r),typeof c=="number"&&(i.maxItems=c),i.type="array",i.items=fo(s.element,t,{...o,path:[...o.path,"items"]})},Joe=(e,t,a,o)=>{const i=a,s=e._zod.def;i.type="object",i.properties={};const r=s.shape;for(const p in r)i.properties[p]=fo(r[p],t,{...o,path:[...o.path,"properties",p]});const c=new Set(Object.keys(r)),d=new Set([...c].filter(p=>{const h=s.shape[p]._zod;return t.io==="input"?h.optin===void 0:h.optout===void 0}));d.size>0&&(i.required=Array.from(d)),s.catchall?._zod.def.type==="never"?i.additionalProperties=!1:s.catchall?s.catchall&&(i.additionalProperties=fo(s.catchall,t,{...o,path:[...o.path,"additionalProperties"]})):t.io==="output"&&(i.additionalProperties=!1)},Yoe=(e,t,a,o)=>{const i=e._zod.def,s=i.inclusive===!1,r=i.options.map((c,d)=>fo(c,t,{...o,path:[...o.path,s?"oneOf":"anyOf",d]}));s?a.oneOf=r:a.anyOf=r},Zoe=(e,t,a,o)=>{const i=e._zod.def,s=fo(i.left,t,{...o,path:[...o.path,"allOf",0]}),r=fo(i.right,t,{...o,path:[...o.path,"allOf",1]}),c=p=>"allOf"in p&&Object.keys(p).length===1,d=[...c(s)?s.allOf:[s],...c(r)?r.allOf:[r]];a.allOf=d},Qoe=(e,t,a,o)=>{const i=e._zod.def,s=fo(i.innerType,t,o),r=t.seen.get(e);t.target==="openapi-3.0"?(r.ref=i.innerType,a.nullable=!0):a.anyOf=[s,{type:"null"}]},Xoe=(e,t,a,o)=>{const i=e._zod.def;fo(i.innerType,t,o);const s=t.seen.get(e);s.ref=i.innerType},eie=(e,t,a,o)=>{const i=e._zod.def;fo(i.innerType,t,o);const s=t.seen.get(e);s.ref=i.innerType,a.default=JSON.parse(JSON.stringify(i.defaultValue))},tie=(e,t,a,o)=>{const i=e._zod.def;fo(i.innerType,t,o);const s=t.seen.get(e);s.ref=i.innerType,t.io==="input"&&(a._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},nie=(e,t,a,o)=>{const i=e._zod.def;fo(i.innerType,t,o);const s=t.seen.get(e);s.ref=i.innerType;let r;try{r=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}a.default=r},aie=(e,t,a,o)=>{const i=e._zod.def,s=i.in._zod.traits.has("$ZodTransform"),r=t.io==="input"?s?i.out:i.in:i.out;fo(r,t,o);const c=t.seen.get(e);c.ref=r},oie=(e,t,a,o)=>{const i=e._zod.def;fo(i.innerType,t,o);const s=t.seen.get(e);s.ref=i.innerType,a.readOnly=!0},gD=(e,t,a,o)=>{const i=e._zod.def;fo(i.innerType,t,o);const s=t.seen.get(e);s.ref=i.innerType},iie=Ze("ZodISODateTime",(e,t)=>{lae.init(e,t),ra.init(e,t)});function sie(e){return moe(iie,e)}const rie=Ze("ZodISODate",(e,t)=>{cae.init(e,t),ra.init(e,t)});function lie(e){return hoe(rie,e)}const cie=Ze("ZodISOTime",(e,t)=>{dae.init(e,t),ra.init(e,t)});function die(e){return goe(cie,e)}const uie=Ze("ZodISODuration",(e,t)=>{uae.init(e,t),ra.init(e,t)});function pie(e){return foe(uie,e)}const mie=(e,t)=>{YR.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:a=>Xte(e,a)},flatten:{value:a=>Qte(e,a)},addIssue:{value:a=>{e.issues.push(a),e.message=JSON.stringify(e.issues,J2,2)}},addIssues:{value:a=>{e.issues.push(...a),e.message=JSON.stringify(e.issues,J2,2)}},isEmpty:{get(){return e.issues.length===0}}})},Ki=Ze("ZodError",mie,{Parent:Error}),hie=X4(Ki),gie=eS(Ki),fie=y0(Ki),bie=x0(Ki),yie=nne(Ki),xie=ane(Ki),vie=one(Ki),kie=ine(Ki),wie=sne(Ki),Sie=rne(Ki),Cie=lne(Ki),jie=cne(Ki),C7=new WeakMap;function Cg(e,t,a){const o=Object.getPrototypeOf(e);let i=C7.get(o);if(i||(i=new Set,C7.set(o,i)),!i.has(t)){i.add(t);for(const s in a){const r=a[s];Object.defineProperty(o,s,{configurable:!0,enumerable:!1,get(){const c=r.bind(this);return Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:c}),c},set(c){Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:c})}})}}}const ha=Ze("ZodType",(e,t)=>(ma.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:ex(e,"input"),output:ex(e,"output")}}),e.toJSONSchema=zoe(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(a,o)=>hie(e,a,o,{callee:e.parse}),e.safeParse=(a,o)=>fie(e,a,o),e.parseAsync=async(a,o)=>gie(e,a,o,{callee:e.parseAsync}),e.safeParseAsync=async(a,o)=>bie(e,a,o),e.spa=e.safeParseAsync,e.encode=(a,o)=>yie(e,a,o),e.decode=(a,o)=>xie(e,a,o),e.encodeAsync=async(a,o)=>vie(e,a,o),e.decodeAsync=async(a,o)=>kie(e,a,o),e.safeEncode=(a,o)=>wie(e,a,o),e.safeDecode=(a,o)=>Sie(e,a,o),e.safeEncodeAsync=async(a,o)=>Cie(e,a,o),e.safeDecodeAsync=async(a,o)=>jie(e,a,o),Cg(e,"ZodType",{check(...a){const o=this.def;return this.clone(Ul(o,{checks:[...o.checks??[],...a.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),{parent:!0})},with(...a){return this.check(...a)},clone(a,o){return Vl(this,a,o)},brand(){return this},register(a,o){return a.add(this,o),this},refine(a,o){return this.check(yse(a,o))},superRefine(a,o){return this.check(xse(a,o))},overwrite(a){return this.check(pp(a))},optional(){return M7(this)},exactOptional(){return ise(this)},nullable(){return I7(this)},nullish(){return M7(I7(this))},nonoptional(a){return use(this,a)},array(){return Yo(this)},or(a){return Zie([this,a])},and(a){return ese(this,a)},transform(a){return P7(this,ase(a))},default(a){return lse(this,a)},prefault(a){return dse(this,a)},catch(a){return mse(this,a)},pipe(a){return P7(this,a)},readonly(){return fse(this)},describe(a){const o=this.clone();return Ym.add(o,{description:a}),o},meta(...a){if(a.length===0)return Ym.get(this);const o=this.clone();return Ym.add(o,a[0]),o},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(a){return a(this)}}),Object.defineProperty(e,"description",{get(){return Ym.get(e)?.description},configurable:!0}),e)),fD=Ze("_ZodString",(e,t)=>{tS.init(e,t),ha.init(e,t),e._zod.processJSONSchema=(o,i,s)=>Foe(e,o,i);const a=e._zod.bag;e.format=a.format??null,e.minLength=a.minimum??null,e.maxLength=a.maximum??null,Cg(e,"_ZodString",{regex(...o){return this.check(woe(...o))},includes(...o){return this.check(joe(...o))},startsWith(...o){return this.check(Noe(...o))},endsWith(...o){return this.check(Aoe(...o))},min(...o){return this.check(Xy(...o))},max(...o){return this.check(dD(...o))},length(...o){return this.check(uD(...o))},nonempty(...o){return this.check(Xy(1,...o))},lowercase(o){return this.check(Soe(o))},uppercase(o){return this.check(Coe(o))},trim(){return this.check(Ioe())},normalize(...o){return this.check(Moe(...o))},toLowerCase(){return this.check(Poe())},toUpperCase(){return this.check(Toe())},slugify(){return this.check(Boe())}})}),Nie=Ze("ZodString",(e,t)=>{tS.init(e,t),fD.init(e,t),e.email=a=>e.check($ae(Aie,a)),e.url=a=>e.check(Zae(Mie,a)),e.jwt=a=>e.check(poe(Vie,a)),e.emoji=a=>e.check(Qae(Iie,a)),e.guid=a=>e.check(v7(j7,a)),e.uuid=a=>e.check(Kae(mb,a)),e.uuidv4=a=>e.check(Wae(mb,a)),e.uuidv6=a=>e.check(Jae(mb,a)),e.uuidv7=a=>e.check(Yae(mb,a)),e.nanoid=a=>e.check(Xae(Pie,a)),e.guid=a=>e.check(v7(j7,a)),e.cuid=a=>e.check(eoe(Tie,a)),e.cuid2=a=>e.check(toe(Bie,a)),e.ulid=a=>e.check(noe(Eie,a)),e.base64=a=>e.check(coe(_ie,a)),e.base64url=a=>e.check(doe(qie,a)),e.xid=a=>e.check(aoe(Rie,a)),e.ksuid=a=>e.check(ooe(Die,a)),e.ipv4=a=>e.check(ioe(Oie,a)),e.ipv6=a=>e.check(soe(zie,a)),e.cidrv4=a=>e.check(roe(Lie,a)),e.cidrv6=a=>e.check(loe(Fie,a)),e.e164=a=>e.check(uoe(Uie,a)),e.datetime=a=>e.check(sie(a)),e.date=a=>e.check(lie(a)),e.time=a=>e.check(die(a)),e.duration=a=>e.check(pie(a))});function Un(e){return Gae(Nie,e)}const ra=Ze("ZodStringFormat",(e,t)=>{ea.init(e,t),fD.init(e,t)}),Aie=Ze("ZodEmail",(e,t)=>{Xne.init(e,t),ra.init(e,t)}),j7=Ze("ZodGUID",(e,t)=>{Zne.init(e,t),ra.init(e,t)}),mb=Ze("ZodUUID",(e,t)=>{Qne.init(e,t),ra.init(e,t)}),Mie=Ze("ZodURL",(e,t)=>{eae.init(e,t),ra.init(e,t)}),Iie=Ze("ZodEmoji",(e,t)=>{tae.init(e,t),ra.init(e,t)}),Pie=Ze("ZodNanoID",(e,t)=>{nae.init(e,t),ra.init(e,t)}),Tie=Ze("ZodCUID",(e,t)=>{aae.init(e,t),ra.init(e,t)}),Bie=Ze("ZodCUID2",(e,t)=>{oae.init(e,t),ra.init(e,t)}),Eie=Ze("ZodULID",(e,t)=>{iae.init(e,t),ra.init(e,t)}),Rie=Ze("ZodXID",(e,t)=>{sae.init(e,t),ra.init(e,t)}),Die=Ze("ZodKSUID",(e,t)=>{rae.init(e,t),ra.init(e,t)}),Oie=Ze("ZodIPv4",(e,t)=>{pae.init(e,t),ra.init(e,t)}),zie=Ze("ZodIPv6",(e,t)=>{mae.init(e,t),ra.init(e,t)}),Lie=Ze("ZodCIDRv4",(e,t)=>{hae.init(e,t),ra.init(e,t)}),Fie=Ze("ZodCIDRv6",(e,t)=>{gae.init(e,t),ra.init(e,t)}),_ie=Ze("ZodBase64",(e,t)=>{fae.init(e,t),ra.init(e,t)}),qie=Ze("ZodBase64URL",(e,t)=>{yae.init(e,t),ra.init(e,t)}),Uie=Ze("ZodE164",(e,t)=>{xae.init(e,t),ra.init(e,t)}),Vie=Ze("ZodJWT",(e,t)=>{kae.init(e,t),ra.init(e,t)}),bD=Ze("ZodNumber",(e,t)=>{iD.init(e,t),ha.init(e,t),e._zod.processJSONSchema=(o,i,s)=>_oe(e,o,i),Cg(e,"ZodNumber",{gt(o,i){return this.check(w7(o,i))},gte(o,i){return this.check(qk(o,i))},min(o,i){return this.check(qk(o,i))},lt(o,i){return this.check(k7(o,i))},lte(o,i){return this.check(_k(o,i))},max(o,i){return this.check(_k(o,i))},int(o){return this.check(N7(o))},safe(o){return this.check(N7(o))},positive(o){return this.check(w7(0,o))},nonnegative(o){return this.check(qk(0,o))},negative(o){return this.check(k7(0,o))},nonpositive(o){return this.check(_k(0,o))},multipleOf(o,i){return this.check(S7(o,i))},step(o,i){return this.check(S7(o,i))},finite(){return this}});const a=e._zod.bag;e.minValue=Math.max(a.minimum??Number.NEGATIVE_INFINITY,a.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(a.maximum??Number.POSITIVE_INFINITY,a.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(a.format??"").includes("int")||Number.isSafeInteger(a.multipleOf??.5),e.isFinite=!0,e.format=a.format??null});function qc(e){return boe(bD,e)}const Hie=Ze("ZodNumberFormat",(e,t)=>{wae.init(e,t),bD.init(e,t)});function N7(e){return yoe(Hie,e)}const Gie=Ze("ZodBoolean",(e,t)=>{Sae.init(e,t),ha.init(e,t),e._zod.processJSONSchema=(a,o,i)=>qoe(e,a,o)});function os(e){return xoe(Gie,e)}const $ie=Ze("ZodUnknown",(e,t)=>{Cae.init(e,t),ha.init(e,t),e._zod.processJSONSchema=(a,o,i)=>Voe()});function A7(){return voe($ie)}const Kie=Ze("ZodNever",(e,t)=>{jae.init(e,t),ha.init(e,t),e._zod.processJSONSchema=(a,o,i)=>Uoe(e,a,o)});function Wie(e){return koe(Kie,e)}const Jie=Ze("ZodArray",(e,t)=>{Nae.init(e,t),ha.init(e,t),e._zod.processJSONSchema=(a,o,i)=>Woe(e,a,o,i),e.element=t.element,Cg(e,"ZodArray",{min(a,o){return this.check(Xy(a,o))},nonempty(a){return this.check(Xy(1,a))},max(a,o){return this.check(dD(a,o))},length(a,o){return this.check(uD(a,o))},unwrap(){return this.element}})});function Yo(e,t){return Eoe(Jie,e,t)}const Yie=Ze("ZodObject",(e,t)=>{Mae.init(e,t),ha.init(e,t),e._zod.processJSONSchema=(a,o,i)=>Joe(e,a,o,i),Pn(e,"shape",()=>t.shape),Cg(e,"ZodObject",{keyof(){return ui(Object.keys(this._zod.def.shape))},catchall(a){return this.clone({...this._zod.def,catchall:a})},passthrough(){return this.clone({...this._zod.def,catchall:A7()})},loose(){return this.clone({...this._zod.def,catchall:A7()})},strict(){return this.clone({...this._zod.def,catchall:Wie()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(a){return $te(this,a)},safeExtend(a){return Kte(this,a)},merge(a){return Wte(this,a)},pick(a){return Hte(this,a)},omit(a){return Gte(this,a)},partial(...a){return Jte(vD,this,a[0])},required(...a){return Yte(kD,this,a[0])}})});function aa(e,t){const a={type:"object",shape:e??{},...Et(t)};return new Yie(a)}const yD=Ze("ZodUnion",(e,t)=>{lD.init(e,t),ha.init(e,t),e._zod.processJSONSchema=(a,o,i)=>Yoe(e,a,o,i),e.options=t.options});function Zie(e,t){return new yD({type:"union",options:e,...Et(t)})}const Qie=Ze("ZodDiscriminatedUnion",(e,t)=>{yD.init(e,t),Iae.init(e,t)});function xD(e,t,a){return new Qie({type:"union",options:t,discriminator:e,...Et(a)})}const Xie=Ze("ZodIntersection",(e,t)=>{Pae.init(e,t),ha.init(e,t),e._zod.processJSONSchema=(a,o,i)=>Zoe(e,a,o,i)});function ese(e,t){return new Xie({type:"intersection",left:e,right:t})}const Z2=Ze("ZodEnum",(e,t)=>{Tae.init(e,t),ha.init(e,t),e._zod.processJSONSchema=(o,i,s)=>Hoe(e,o,i),e.enum=t.entries,e.options=Object.values(t.entries);const a=new Set(Object.keys(t.entries));e.extract=(o,i)=>{const s={};for(const r of o)if(a.has(r))s[r]=t.entries[r];else throw new Error(`Key ${r} not found in enum`);return new Z2({...t,checks:[],...Et(i),entries:s})},e.exclude=(o,i)=>{const s={...t.entries};for(const r of o)if(a.has(r))delete s[r];else throw new Error(`Key ${r} not found in enum`);return new Z2({...t,checks:[],...Et(i),entries:s})}});function ui(e,t){const a=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new Z2({type:"enum",entries:a,...Et(t)})}const tse=Ze("ZodLiteral",(e,t)=>{Bae.init(e,t),ha.init(e,t),e._zod.processJSONSchema=(a,o,i)=>Goe(e,a,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function as(e,t){return new tse({type:"literal",values:Array.isArray(e)?e:[e],...Et(t)})}const nse=Ze("ZodTransform",(e,t)=>{Eae.init(e,t),ha.init(e,t),e._zod.processJSONSchema=(a,o,i)=>Koe(e,a),e._zod.parse=(a,o)=>{if(o.direction==="backward")throw new HR(e.constructor.name);a.addIssue=s=>{if(typeof s=="string")a.issues.push(Kh(s,a.value,t));else{const r=s;r.fatal&&(r.continue=!1),r.code??(r.code="custom"),r.input??(r.input=a.value),r.inst??(r.inst=e),a.issues.push(Kh(r))}};const i=t.transform(a.value,a);return i instanceof Promise?i.then(s=>(a.value=s,a.fallback=!0,a)):(a.value=i,a.fallback=!0,a)}});function ase(e){return new nse({type:"transform",transform:e})}const vD=Ze("ZodOptional",(e,t)=>{cD.init(e,t),ha.init(e,t),e._zod.processJSONSchema=(a,o,i)=>gD(e,a,o,i),e.unwrap=()=>e._zod.def.innerType});function M7(e){return new vD({type:"optional",innerType:e})}const ose=Ze("ZodExactOptional",(e,t)=>{Rae.init(e,t),ha.init(e,t),e._zod.processJSONSchema=(a,o,i)=>gD(e,a,o,i),e.unwrap=()=>e._zod.def.innerType});function ise(e){return new ose({type:"optional",innerType:e})}const sse=Ze("ZodNullable",(e,t)=>{Dae.init(e,t),ha.init(e,t),e._zod.processJSONSchema=(a,o,i)=>Qoe(e,a,o,i),e.unwrap=()=>e._zod.def.innerType});function I7(e){return new sse({type:"nullable",innerType:e})}const rse=Ze("ZodDefault",(e,t)=>{Oae.init(e,t),ha.init(e,t),e._zod.processJSONSchema=(a,o,i)=>eie(e,a,o,i),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function lse(e,t){return new rse({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():KR(t)}})}const cse=Ze("ZodPrefault",(e,t)=>{zae.init(e,t),ha.init(e,t),e._zod.processJSONSchema=(a,o,i)=>tie(e,a,o,i),e.unwrap=()=>e._zod.def.innerType});function dse(e,t){return new cse({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():KR(t)}})}const kD=Ze("ZodNonOptional",(e,t)=>{Lae.init(e,t),ha.init(e,t),e._zod.processJSONSchema=(a,o,i)=>Xoe(e,a,o,i),e.unwrap=()=>e._zod.def.innerType});function use(e,t){return new kD({type:"nonoptional",innerType:e,...Et(t)})}const pse=Ze("ZodCatch",(e,t)=>{Fae.init(e,t),ha.init(e,t),e._zod.processJSONSchema=(a,o,i)=>nie(e,a,o,i),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function mse(e,t){return new pse({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const hse=Ze("ZodPipe",(e,t)=>{_ae.init(e,t),ha.init(e,t),e._zod.processJSONSchema=(a,o,i)=>aie(e,a,o,i),e.in=t.in,e.out=t.out});function P7(e,t){return new hse({type:"pipe",in:e,out:t})}const gse=Ze("ZodReadonly",(e,t)=>{qae.init(e,t),ha.init(e,t),e._zod.processJSONSchema=(a,o,i)=>oie(e,a,o,i),e.unwrap=()=>e._zod.def.innerType});function fse(e){return new gse({type:"readonly",innerType:e})}const bse=Ze("ZodCustom",(e,t)=>{Uae.init(e,t),ha.init(e,t),e._zod.processJSONSchema=(a,o,i)=>$oe(e,a)});function yse(e,t={}){return Roe(bse,e,t)}function xse(e,t){return Doe(e,t)}const wD=["cursor","blob","circle","squircle","capsule","drop","shield","hexagon","diamond","star","panes"],vse=ui(wD),kse="cursor",nS={cursor:{id:"cursor",name:"Cursor",fit:"translate(68.1612 9.8302) scale(0.593918)",body:'<path fill="{{GRADIENT}}" d="M0 0 C1.12815992 0.94880479 2.25705591 1.89673511 3.38671875 2.84375 C5.57657936 4.68528228 7.75793952 6.53624249 9.93359375 8.39453125 C13.5602214 11.48647103 17.25022962 14.49819427 20.9453125 17.5078125 C25.41301487 21.15281776 29.86103386 24.8215994 34.31054688 28.48876953 C38.00933931 31.5370903 41.70951059 34.58367973 45.4140625 37.625 C52.50037463 43.44570076 59.55669812 49.29508834 66.54003906 55.23901367 C70.43289872 58.54377434 74.40406577 61.73568847 78.40625 64.90625 C82.05401433 67.85083084 85.6145398 70.89451533 89.18359375 73.93359375 C92.41424312 76.67774533 95.67698054 79.36747809 99 82 C103.47931906 85.54855146 107.83340036 89.22936876 112.18359375 92.93359375 C115.41424312 95.67774533 118.67698054 98.36747809 122 101 C125.9014198 104.09073517 129.71091352 107.27378506 133.5 110.5 C137.99002543 114.32092614 142.53350963 118.0537239 147.15234375 121.71875 C156.74255328 129.40144186 166.1812645 137.27326897 175.53833008 145.23754883 C179.4317456 148.54281661 183.40347641 151.73522157 187.40625 154.90625 C191.05401433 157.85083084 194.6145398 160.89451533 198.18359375 163.93359375 C201.41424312 166.67774533 204.67698054 169.36747809 208 172 C236.43637507 194.63776677 236.43637507 194.63776677 238.27050781 209.13867188 C239.19944445 221.27193361 237.57124038 231.13444436 230 241 C223.66050278 247.82715086 215.75482398 254.47140646 206.04764748 255.13307858 C205.3615811 255.13693349 204.67551472 255.1407884 203.96865845 255.14476013 C203.17563324 255.15165863 202.38260803 255.15855713 201.56555176 255.16566467 C200.27360901 255.16958473 200.27360901 255.16958473 198.95556641 255.17358398 C198.04112762 255.180271 197.12668884 255.18695801 196.18453979 255.19384766 C194.19843498 255.20789156 192.21231409 255.21978771 190.22618484 255.22979546 C187.07149762 255.24625057 183.91692738 255.26949556 180.76229858 255.29469299 C171.79227585 255.36530712 162.82220292 255.42526708 153.85205078 255.47680664 C148.36195434 255.5088283 142.87198905 255.55017011 137.38199997 255.59700203 C135.30028042 255.61289593 133.21853066 255.62527474 131.13676834 255.63390923 C104.46972494 255.74602279 80.75351522 259.19455182 60.52978516 278.41845703 C55.75259196 283.35727885 51.81217213 289.04473423 47.77441406 294.5859375 C44.62107661 298.87600364 41.36381878 303.08685058 38.125 307.3125 C32.82026548 314.26649347 27.55386673 321.24815866 22.3125 328.25 C21.07690581 329.89589556 19.84122979 331.5417297 18.60546875 333.1875 C16.22002164 336.36552908 13.84996009 339.55428087 11.48828125 342.75 C3.0450311 354.10095576 -5.25712203 365.22607871 -20 368 C-33.42903027 368.85957067 -44.2929604 367.90032788 -55 358.9140625 C-63.51513963 350.76480778 -67.79688328 340.99527428 -68.37686157 329.29350281 C-68.43541887 328.1487851 -68.49397617 327.00406738 -68.55430794 325.82466125 C-68.61453573 324.57243271 -68.67476353 323.32020416 -68.73681641 322.0300293 C-68.80423726 320.68369989 -68.87198477 319.33738681 -68.94003105 317.99108887 C-69.12569162 314.29881586 -69.30666938 310.60632592 -69.48688698 306.91378379 C-69.68142908 302.94481208 -69.88036562 298.97606035 -70.07873535 295.00727844 C-70.55465828 285.46711948 -71.02377004 275.92663022 -71.49235249 266.3861084 C-71.71278092 261.90166682 -71.93398876 257.41726373 -72.1552124 252.93286133 C-72.22122149 251.59460763 -72.22122149 251.59460763 -72.28856409 250.2293185 C-72.37783973 248.41936974 -72.46711776 246.6094211 -72.55639815 244.79947257 C-72.7821203 240.22326204 -73.00777832 235.64704836 -73.23336792 231.0708313 C-73.2783997 230.15734865 -73.32343148 229.24386601 -73.36982787 228.30270207 C-73.64581049 222.70253299 -73.92113412 217.10233189 -74.19602597 211.50210917 C-75.35713101 187.85146938 -76.54638525 164.20245932 -77.76320994 140.55462319 C-78.3174362 129.77404232 -78.86176258 118.9929594 -79.40472984 108.2118063 C-79.83986282 99.58021501 -80.28322749 90.94912395 -80.73695588 82.31848997 C-81.04621068 76.42094211 -81.34513355 70.52292566 -81.63612723 64.62444884 C-81.8031421 61.24551841 -81.97612174 57.86718776 -82.15861511 54.48903847 C-84.29931862 14.73242483 -84.29931862 14.73242483 -72.03125 -1.625 C-50.89854752 -24.96559677 -21.34867451 -18.24899383 0 0 Z "/>',clip:'<path d="M0 0 C1.12815992 0.94880479 2.25705591 1.89673511 3.38671875 2.84375 C5.57657936 4.68528228 7.75793952 6.53624249 9.93359375 8.39453125 C13.5602214 11.48647103 17.25022962 14.49819427 20.9453125 17.5078125 C25.41301487 21.15281776 29.86103386 24.8215994 34.31054688 28.48876953 C38.00933931 31.5370903 41.70951059 34.58367973 45.4140625 37.625 C52.50037463 43.44570076 59.55669812 49.29508834 66.54003906 55.23901367 C70.43289872 58.54377434 74.40406577 61.73568847 78.40625 64.90625 C82.05401433 67.85083084 85.6145398 70.89451533 89.18359375 73.93359375 C92.41424312 76.67774533 95.67698054 79.36747809 99 82 C103.47931906 85.54855146 107.83340036 89.22936876 112.18359375 92.93359375 C115.41424312 95.67774533 118.67698054 98.36747809 122 101 C125.9014198 104.09073517 129.71091352 107.27378506 133.5 110.5 C137.99002543 114.32092614 142.53350963 118.0537239 147.15234375 121.71875 C156.74255328 129.40144186 166.1812645 137.27326897 175.53833008 145.23754883 C179.4317456 148.54281661 183.40347641 151.73522157 187.40625 154.90625 C191.05401433 157.85083084 194.6145398 160.89451533 198.18359375 163.93359375 C201.41424312 166.67774533 204.67698054 169.36747809 208 172 C236.43637507 194.63776677 236.43637507 194.63776677 238.27050781 209.13867188 C239.19944445 221.27193361 237.57124038 231.13444436 230 241 C223.66050278 247.82715086 215.75482398 254.47140646 206.04764748 255.13307858 C205.3615811 255.13693349 204.67551472 255.1407884 203.96865845 255.14476013 C203.17563324 255.15165863 202.38260803 255.15855713 201.56555176 255.16566467 C200.27360901 255.16958473 200.27360901 255.16958473 198.95556641 255.17358398 C198.04112762 255.180271 197.12668884 255.18695801 196.18453979 255.19384766 C194.19843498 255.20789156 192.21231409 255.21978771 190.22618484 255.22979546 C187.07149762 255.24625057 183.91692738 255.26949556 180.76229858 255.29469299 C171.79227585 255.36530712 162.82220292 255.42526708 153.85205078 255.47680664 C148.36195434 255.5088283 142.87198905 255.55017011 137.38199997 255.59700203 C135.30028042 255.61289593 133.21853066 255.62527474 131.13676834 255.63390923 C104.46972494 255.74602279 80.75351522 259.19455182 60.52978516 278.41845703 C55.75259196 283.35727885 51.81217213 289.04473423 47.77441406 294.5859375 C44.62107661 298.87600364 41.36381878 303.08685058 38.125 307.3125 C32.82026548 314.26649347 27.55386673 321.24815866 22.3125 328.25 C21.07690581 329.89589556 19.84122979 331.5417297 18.60546875 333.1875 C16.22002164 336.36552908 13.84996009 339.55428087 11.48828125 342.75 C3.0450311 354.10095576 -5.25712203 365.22607871 -20 368 C-33.42903027 368.85957067 -44.2929604 367.90032788 -55 358.9140625 C-63.51513963 350.76480778 -67.79688328 340.99527428 -68.37686157 329.29350281 C-68.43541887 328.1487851 -68.49397617 327.00406738 -68.55430794 325.82466125 C-68.61453573 324.57243271 -68.67476353 323.32020416 -68.73681641 322.0300293 C-68.80423726 320.68369989 -68.87198477 319.33738681 -68.94003105 317.99108887 C-69.12569162 314.29881586 -69.30666938 310.60632592 -69.48688698 306.91378379 C-69.68142908 302.94481208 -69.88036562 298.97606035 -70.07873535 295.00727844 C-70.55465828 285.46711948 -71.02377004 275.92663022 -71.49235249 266.3861084 C-71.71278092 261.90166682 -71.93398876 257.41726373 -72.1552124 252.93286133 C-72.22122149 251.59460763 -72.22122149 251.59460763 -72.28856409 250.2293185 C-72.37783973 248.41936974 -72.46711776 246.6094211 -72.55639815 244.79947257 C-72.7821203 240.22326204 -73.00777832 235.64704836 -73.23336792 231.0708313 C-73.2783997 230.15734865 -73.32343148 229.24386601 -73.36982787 228.30270207 C-73.64581049 222.70253299 -73.92113412 217.10233189 -74.19602597 211.50210917 C-75.35713101 187.85146938 -76.54638525 164.20245932 -77.76320994 140.55462319 C-78.3174362 129.77404232 -78.86176258 118.9929594 -79.40472984 108.2118063 C-79.83986282 99.58021501 -80.28322749 90.94912395 -80.73695588 82.31848997 C-81.04621068 76.42094211 -81.34513355 70.52292566 -81.63612723 64.62444884 C-81.8031421 61.24551841 -81.97612174 57.86718776 -82.15861511 54.48903847 C-84.29931862 14.73242483 -84.29931862 14.73242483 -72.03125 -1.625 C-50.89854752 -24.96559677 -21.34867451 -18.24899383 0 0 Z "/>',anchor:{x:85.54,y:106.35,scale:.791}},blob:{id:"blob",name:"Blob",fit:"translate(-0.7217 2.9555) scale(1.134706)",body:'<path fill="{{GRADIENT}}" d="M198.91052 113.12915C198.30169 121.88191 196.37668 130.37605 193.1355 138.61157C189.89431 146.84709 185.49332 154.4026 179.93252 161.27809C174.37172 168.15358 167.99976 174.1053 160.81663 179.13325C153.6335 184.1612 145.98678 188.22176 137.87645 191.31491C129.76613 194.40806 121.42581 196.55178 112.85548 197.74609C104.28516 198.94039 95.66469 199.12755 86.99407 198.30758C78.32344 197.4876 69.86713 195.54477 61.62513 192.47909C53.38313 189.41341 45.74309 185.20915 38.70501 179.86633C31.66693 174.52351 25.60941 168.25632 20.53243 161.06476C15.45546 153.87319 11.54067 146.15559 8.78808 137.91195C6.03549 129.66831 4.37316 121.28874 3.80109 112.77325C3.22902 104.25775 3.5616 95.83136 4.79882 87.49409C6.03604 79.15682 8.08364 70.99969 10.94163 63.0227C13.79962 55.04571 17.53174 47.38891 22.13799 40.0523C26.74425 32.71568 32.30193 26.0276 38.81103 19.98806C45.32014 13.94852 52.65266 9.00619 60.80862 5.16109C68.96458 1.31599 77.53546 -1.10241 86.52128 -2.09412C95.50709 -3.08583 104.37427 -2.64309 113.12282 -0.76589C121.87137 1.11131 130.09712 4.12751 137.80007 8.28271C145.50302 12.43791 152.53652 17.35515 158.90058 23.03443C165.26463 28.7137 170.969 34.91856 176.01368 41.649C181.05836 48.37944 185.3953 55.56843 189.02451 63.21597C192.65372 70.86352 195.3609 78.90607 197.14605 87.34364C198.93119 95.78121 199.51935 104.37638 198.91052 113.12915Z"/>',clip:'<path d="M198.91052 113.12915C198.30169 121.88191 196.37668 130.37605 193.1355 138.61157C189.89431 146.84709 185.49332 154.4026 179.93252 161.27809C174.37172 168.15358 167.99976 174.1053 160.81663 179.13325C153.6335 184.1612 145.98678 188.22176 137.87645 191.31491C129.76613 194.40806 121.42581 196.55178 112.85548 197.74609C104.28516 198.94039 95.66469 199.12755 86.99407 198.30758C78.32344 197.4876 69.86713 195.54477 61.62513 192.47909C53.38313 189.41341 45.74309 185.20915 38.70501 179.86633C31.66693 174.52351 25.60941 168.25632 20.53243 161.06476C15.45546 153.87319 11.54067 146.15559 8.78808 137.91195C6.03549 129.66831 4.37316 121.28874 3.80109 112.77325C3.22902 104.25775 3.5616 95.83136 4.79882 87.49409C6.03604 79.15682 8.08364 70.99969 10.94163 63.0227C13.79962 55.04571 17.53174 47.38891 22.13799 40.0523C26.74425 32.71568 32.30193 26.0276 38.81103 19.98806C45.32014 13.94852 52.65266 9.00619 60.80862 5.16109C68.96458 1.31599 77.53546 -1.10241 86.52128 -2.09412C95.50709 -3.08583 104.37427 -2.64309 113.12282 -0.76589C121.87137 1.11131 130.09712 4.12751 137.80007 8.28271C145.50302 12.43791 152.53652 17.35515 158.90058 23.03443C165.26463 28.7137 170.969 34.91856 176.01368 41.649C181.05836 48.37944 185.3953 55.56843 189.02451 63.21597C192.65372 70.86352 195.3609 78.90607 197.14605 87.34364C198.93119 95.78121 199.51935 104.37638 198.91052 113.12915Z"/>',anchor:{x:111.22,y:116.58,scale:.791}},circle:{id:"circle",name:"Circle",fit:"translate(0 0) scale(1.142705)",body:'<path fill="{{GRADIENT}}" d="M200 100C200 155.22847 155.22847 200 100 200C44.77153 200 0 155.22847 0 100C0 44.77153 44.77153 0 100 0C155.22847 0 200 44.77153 200 100Z"/>',clip:'<path d="M200 100C200 155.22847 155.22847 200 100 200C44.77153 200 0 155.22847 0 100C0 44.77153 44.77153 0 100 0C155.22847 0 200 44.77153 200 100Z"/>',anchor:{x:113.82,y:110.27,scale:.791}},squircle:{id:"squircle",name:"Squircle",fit:"translate(0 0) scale(1.142705)",body:'<path fill="{{GRADIENT}}" d="M50 0C83.33333 0 116.66667 0 150 0C177.61424 0 200 22.38576 200 50C200 83.33333 200 116.66667 200 150C200 177.61424 177.61424 200 150 200C116.66667 200 83.33333 200 50 200C22.38576 200 0 177.61424 0 150C0 116.66667 0 83.33333 0 50C0 22.38576 22.38576 0 50 0Z"/>',clip:'<path d="M50 0C83.33333 0 116.66667 0 150 0C177.61424 0 200 22.38576 200 50C200 83.33333 200 116.66667 200 150C200 177.61424 177.61424 200 150 200C116.66667 200 83.33333 200 50 200C22.38576 200 0 177.61424 0 150C0 116.66667 0 83.33333 0 50C0 22.38576 22.38576 0 50 0Z"/>',anchor:{x:111.78,y:111.79,scale:.791}},capsule:{id:"capsule",name:"Capsule",fit:"translate(0 0) scale(1.142705)",body:'<path fill="{{GRADIENT}}" d="M100 0C141.42136 0 175 33.57864 175 75C175 91.66667 175 108.33333 175 125C175 166.42136 141.42136 200 100 200C58.57864 200 25 166.42136 25 125C25 108.33333 25 91.66667 25 75C25 33.57864 58.57864 0 100 0Z"/>',clip:'<path d="M100 0C141.42136 0 175 33.57864 175 75C175 91.66667 175 108.33333 175 125C175 166.42136 141.42136 200 100 200C58.57864 200 25 166.42136 25 125C25 108.33333 25 91.66667 25 75C25 33.57864 58.57864 0 100 0Z"/>',anchor:{x:113.82,y:131.68,scale:.791}},drop:{id:"drop",name:"Drop",fit:"translate(-3.5341 -3.5341) scale(1.178046)",body:'<path fill="{{GRADIENT}}" d="M100 3C160.84 78.2235 178 103.298 178 119C178 162.07821 143.07821 197 100 197C56.92179 197 22 162.07821 22 119C22 103.298 39.16 78.2235 100 3Z"/>',clip:'<path d="M100 3C160.84 78.2235 178 103.298 178 119C178 162.07821 143.07821 197 100 197C56.92179 197 22 162.07821 22 119C22 103.298 39.16 78.2235 100 3Z"/>',anchor:{x:112.47,y:138.8,scale:.791}},shield:{id:"shield",name:"Shield",fit:"translate(-12.1611 -24.3222) scale(1.264316)",body:'<path fill="{{GRADIENT}}" d="M57.25 38.475C85.75 12.825 114.25 12.825 142.75 38.475C153.89667 76.64167 165.04333 114.80833 176.19 152.975C188.73 184.325 179.325 200 147.975 200C115.99167 200 84.00833 200 52.025 200C20.675 200 11.27 184.325 23.81 152.975C34.95667 114.80833 46.10333 76.64167 57.25 38.475Z"/>',clip:'<path d="M57.25 38.475C85.75 12.825 114.25 12.825 142.75 38.475C153.89667 76.64167 165.04333 114.80833 176.19 152.975C188.73 184.325 179.325 200 147.975 200C115.99167 200 84.00833 200 52.025 200C20.675 200 11.27 184.325 23.81 152.975C34.95667 114.80833 46.10333 76.64167 57.25 38.475Z"/>',anchor:{x:112.38,y:170.61,scale:.791}},hexagon:{id:"hexagon",name:"Hexagon",fit:"translate(-4.1077 -4.1077) scale(1.183782)",body:'<path fill="{{GRADIENT}}" d="M94.90777 4.94C98.30259 2.98 101.69741 2.98 105.09223 4.94C129.98757 19.31333 154.88292 33.68667 179.77826 48.06C183.17308 50.02 184.87049 52.96 184.87049 56.88C184.87049 85.62667 184.87049 114.37333 184.87049 143.12C184.87049 147.04 183.17308 149.98 179.77826 151.94C154.88292 166.31333 129.98757 180.68667 105.09223 195.06C101.69741 197.02 98.30259 197.02 94.90777 195.06C70.01243 180.68667 45.11708 166.31333 20.22174 151.94C16.82692 149.98 15.12951 147.04 15.12951 143.12C15.12951 114.37333 15.12951 85.62667 15.12951 56.88C15.12951 52.96 16.82692 50.02 20.22174 48.06C45.11708 33.68667 70.01243 19.31333 94.90777 4.94Z"/>',clip:'<path d="M94.90777 4.94C98.30259 2.98 101.69741 2.98 105.09223 4.94C129.98757 19.31333 154.88292 33.68667 179.77826 48.06C183.17308 50.02 184.87049 52.96 184.87049 56.88C184.87049 85.62667 184.87049 114.37333 184.87049 143.12C184.87049 147.04 183.17308 149.98 179.77826 151.94C154.88292 166.31333 129.98757 180.68667 105.09223 195.06C101.69741 197.02 98.30259 197.02 94.90777 195.06C70.01243 180.68667 45.11708 166.31333 20.22174 151.94C16.82692 149.98 15.12951 147.04 15.12951 143.12C15.12951 114.37333 15.12951 85.62667 15.12951 56.88C15.12951 52.96 16.82692 50.02 20.22174 48.06C45.11708 33.68667 70.01243 19.31333 94.90777 4.94Z"/>',anchor:{x:112.26,y:110.7,scale:.791}},diamond:{id:"diamond",name:"Diamond",fit:"translate(-5.9383 -5.9383) scale(1.202088)",body:'<path fill="{{GRADIENT}}" d="M94.12 7.88C98.04 3.96 101.96 3.96 105.88 7.88C134.62667 36.62667 163.37333 65.37333 192.12 94.12C196.04 98.04 196.04 101.96 192.12 105.88C163.37333 134.62667 134.62667 163.37333 105.88 192.12C101.96 196.04 98.04 196.04 94.12 192.12C65.37333 163.37333 36.62667 134.62667 7.88 105.88C3.96 101.96 3.96 98.04 7.88 94.12C36.62667 65.37333 65.37333 36.62667 94.12 7.88Z"/>',clip:'<path d="M94.12 7.88C98.04 3.96 101.96 3.96 105.88 7.88C134.62667 36.62667 163.37333 65.37333 192.12 94.12C196.04 98.04 196.04 101.96 192.12 105.88C163.37333 134.62667 134.62667 163.37333 105.88 192.12C101.96 196.04 98.04 196.04 94.12 192.12C65.37333 163.37333 36.62667 134.62667 7.88 105.88C3.96 101.96 3.96 98.04 7.88 94.12C36.62667 65.37333 65.37333 36.62667 94.12 7.88Z"/>',anchor:{x:112.53,y:109.95,scale:.791}},star:{id:"star",name:"Star",fit:"translate(-8.3327 3.1407) scale(1.226032)",body:'<path fill="{{GRADIENT}}" d="M100 2C110.56054 20.13133 121.12108 38.26266 131.68163 56.39398C152.18893 60.83477 172.69623 65.27555 193.20354 69.71633C179.22301 85.3629 165.24248 101.00946 151.26195 116.65602C153.37562 137.5319 155.48929 158.40778 157.60295 179.28367C138.40197 170.82244 119.20098 162.36122 100 153.9C80.79902 162.36122 61.59803 170.82244 42.39705 179.28367C44.51071 158.40778 46.62438 137.5319 48.73805 116.65602C34.75752 101.00946 20.77699 85.3629 6.79646 69.71633C27.30377 65.27555 47.81107 60.83477 68.31837 56.39398C78.87892 38.26266 89.43946 20.13133 100 2Z"/>',clip:'<path d="M100 2C110.56054 20.13133 121.12108 38.26266 131.68163 56.39398C152.18893 60.83477 172.69623 65.27555 193.20354 69.71633C179.22301 85.3629 165.24248 101.00946 151.26195 116.65602C153.37562 137.5319 155.48929 158.40778 157.60295 179.28367C138.40197 170.82244 119.20098 162.36122 100 153.9C80.79902 162.36122 61.59803 170.82244 42.39705 179.28367C44.51071 158.40778 46.62438 137.5319 48.73805 116.65602C34.75752 101.00946 20.77699 85.3629 6.79646 69.71633C27.30377 65.27555 47.81107 60.83477 68.31837 56.39398C78.87892 38.26266 89.43946 20.13133 100 2Z"/>',anchor:{x:113.82,y:125.43,scale:.791}},panes:{id:"panes",name:"Panes",fit:"translate(-2.3321 -2.3321) scale(1.166026)",body:'<path fill="{{GRADIENT}}" d="M42 2C56 2 70 2 84 2C92 2 92 32 100 32C108 32 108 2 116 2C130 2 144 2 158 2C180.09139 2 198 19.90861 198 42C198 56 198 70 198 84C198 92 168 92 168 100C168 108 198 108 198 116C198 130 198 144 198 158C198 180.09139 180.09139 198 158 198C144 198 130 198 116 198C108 198 108 168 100 168C92 168 92 198 84 198C70 198 56 198 42 198C19.90861 198 2 180.09139 2 158C2 144 2 130 2 116C2 108 32 108 32 100C32 92 2 92 2 84C2 70 2 56 2 42C2 19.90861 19.90861 2 42 2Z"/>',clip:'<path d="M42 2C56 2 70 2 84 2C92 2 92 32 100 32C108 32 108 2 116 2C130 2 144 2 158 2C180.09139 2 198 19.90861 198 42C198 56 198 70 198 84C198 92 168 92 168 100C168 108 198 108 198 116C198 130 198 144 198 158C198 180.09139 180.09139 198 158 198C144 198 130 198 116 198C108 198 108 168 100 168C92 168 92 198 84 198C70 198 56 198 42 198C19.90861 198 2 180.09139 2 158C2 144 2 130 2 116C2 108 32 108 32 100C32 92 2 92 2 84C2 70 2 56 2 42C2 19.90861 19.90861 2 42 2Z"/>',anchor:{x:113.82,y:102.65,scale:.791}}};function wse(e){return vse.safeParse(e).data??kse}const $u=228.541,T7=[120,122.5],B7={x:13.2,y:8.4},Sse=["130.36,45.98 132.71,46.19 134.98,46.81 137.11,47.83 138.97,49.28 140.47,51.09 141.68,53.12 142.73,55.23 143.76,57.36 144.78,59.49 145.79,61.62 146.79,63.76 147.76,65.91 148.71,68.07 149.63,70.25 150.52,72.43 151.37,74.63 151.99,76.91 152.1,79.26 151.64,81.57 150.59,83.68 149.04,85.45 147.1,86.78 144.9,87.62 142.56,87.93 140.22,87.71 137.98,86.99 135.93,85.82 134.17,84.24 132.78,82.34 131.69,80.25 130.77,78.08 129.87,75.89 128.94,73.72 128,71.56 127.03,69.4 126.05,67.26 125.05,65.12 124.03,62.99 122.93,60.9 121.87,58.79 121.03,56.59 120.72,54.26 121.1,51.93 122.15,49.83 123.75,48.1 125.76,46.89 128.01,46.19|176.61,37.08 178.72,37.59 180.7,38.48 182.52,39.65 184.2,41.03 185.71,42.59 187.03,44.31 188.2,46.14 189.26,48.03 190.27,49.96 191.26,51.89 192.23,53.84 193.16,55.8 194.05,57.78 194.92,59.77 195.74,61.78 196.53,63.8 197.27,65.84 197.97,67.9 198.47,70.01 198.63,72.18 198.4,74.33 197.58,76.33 195.95,77.72 193.83,78.08 191.71,77.65 189.76,76.69 188.03,75.38 186.53,73.82 185.28,72.05 184.25,70.13 183.4,68.14 182.63,66.11 181.87,64.07 181.07,62.05 180.25,60.04 179.39,58.05 178.49,56.07 177.57,54.1 176.61,52.15 175.62,50.22 174.59,48.31 173.53,46.41 172.54,44.48 171.86,42.42 171.76,40.26 172.62,38.3 174.45,37.19","86.14,124.79 89.16,124.92 92.06,125.76 94.68,127.27 96.86,129.36 98.48,131.92 99.51,134.76 100.12,137.73 100.56,140.72 101.01,143.72 101.52,146.71 102.06,149.69 102.62,152.67 103.2,155.64 103.81,158.61 104.44,161.57 105.11,164.52 105.81,167.47 106.49,170.42 106.72,173.44 106.01,176.37 104.37,178.9 102.03,180.81 99.26,181.99 96.27,182.46 93.25,182.25 90.34,181.43 87.65,180.04 85.32,178.11 83.51,175.7 82.37,172.9 81.66,169.96 80.98,167 80.32,164.05 79.69,161.08 79.08,158.12 78.5,155.14 77.94,152.16 77.4,149.18 76.89,146.2 76.4,143.21 75.93,140.21 75.56,137.21 75.7,134.19 76.6,131.3 78.22,128.76 80.47,126.74 83.18,125.4|147.23,112.87 150.24,113.13 153.07,114.19 155.53,115.94 157.46,118.26 158.73,121.01 159.53,123.93 160.21,126.88 160.88,129.84 161.52,132.8 162.15,135.76 162.74,138.73 163.32,141.71 163.87,144.69 164.39,147.67 164.9,150.66 165.39,153.65 165.8,156.65 165.76,159.67 164.98,162.59 163.56,165.26 161.61,167.58 159.23,169.45 156.52,170.77 153.57,171.46 150.55,171.4 147.67,170.52 145.19,168.79 143.45,166.33 142.57,163.44 142.08,160.45 141.61,157.46 141.11,154.47 140.59,151.48 140.04,148.5 139.47,145.53 138.87,142.56 138.25,139.59 137.6,136.63 136.94,133.68 136.25,130.72 135.59,127.77 135.47,124.75 136.07,121.78 137.34,119.04 139.19,116.65 141.53,114.74 144.26,113.44","104.84,104.08 109.39,104.89 113.63,106.73 117.32,109.5 120.25,113.08 122.22,117.25 123.15,121.77 122.92,126.39 121.86,130.89 120.61,135.35 119.37,139.81 118.15,144.27 116.94,148.74 115.74,153.21 114.56,157.69 113.39,162.17 112.24,166.65 111.13,171.15 110.04,175.65 108.89,180.13 106.98,184.33 103.8,187.67 99.75,189.87 95.25,190.93 90.63,190.93 86.11,189.97 81.86,188.16 78.05,185.54 74.89,182.18 72.62,178.16 71.54,173.67 71.94,169.08 73.01,164.57 74.13,160.08 75.26,155.59 76.42,151.11 77.59,146.63 78.77,142.15 79.97,137.68 81.18,133.22 82.41,128.75 83.65,124.29 84.87,119.83 86.33,115.43 88.67,111.46 91.9,108.15 95.83,105.72 100.23,104.35|174.26,115.55 178.59,116.54 182.37,118.86 185.31,122.2 187.23,126.21 188.12,130.57 188.06,135.02 187.52,139.44 186.86,143.85 186.11,148.25 185.25,152.62 184.3,156.98 183.24,161.31 182.07,165.61 180.79,169.88 179.39,174.12 177.89,178.31 176.27,182.47 174.47,186.55 172.17,190.35 169.21,193.68 165.73,196.46 161.84,198.64 157.66,200.16 153.27,200.91 148.83,200.69 144.65,199.19 141.47,196.14 140.18,191.91 140.82,187.53 142.46,183.38 144.16,179.26 145.73,175.09 147.18,170.87 148.51,166.62 149.73,162.33 150.84,158.01 151.84,153.67 152.74,149.3 153.54,144.91 154.24,140.51 154.85,136.1 155.58,131.7 156.93,127.46 159.15,123.6 162.12,120.29 165.73,117.68 169.84,116","44.72,103.35 47.95,103.93 51.04,105.05 53.93,106.62 56.58,108.57 58.97,110.83 61.09,113.35 62.93,116.07 64.5,118.97 65.79,121.99 66.8,125.13 67.52,128.34 67.94,131.6 68.08,134.89 67.9,138.17 67.4,141.42 66.56,144.6 65.33,147.66 63.71,150.52 61.69,153.11 59.3,155.36 56.54,157.16 53.51,158.42 50.29,159.07 47,159.09 43.76,158.5 40.67,157.39 37.78,155.82 35.13,153.87 32.75,151.6 30.63,149.09 28.78,146.36 27.21,143.47 25.92,140.44 24.92,137.31 24.2,134.1 23.77,130.84 23.64,127.55 23.81,124.27 24.31,121.01 25.16,117.84 26.38,114.78 28,111.92 30.02,109.33 32.42,107.08 35.17,105.28 38.21,104.02 41.43,103.37|114.62,83.64 118.31,83.88 121.94,84.6 125.44,85.77 128.77,87.38 131.86,89.4 134.67,91.81 137.13,94.56 139.2,97.62 140.85,100.93 142.05,104.42 142.79,108.05 143.05,111.73 142.83,115.42 142.13,119.05 140.95,122.55 139.34,125.88 137.3,128.96 134.88,131.75 132.11,134.2 129.05,136.27 125.75,137.93 122.25,139.13 118.63,139.86 114.94,140.1 111.25,139.86 107.63,139.14 104.12,137.97 100.8,136.36 97.7,134.34 94.9,131.93 92.44,129.18 90.36,126.12 88.72,122.81 87.51,119.31 86.78,115.69 86.52,112.01 86.74,108.32 87.44,104.69 88.61,101.18 90.23,97.86 92.27,94.78 94.69,91.99 97.45,89.54 100.51,87.47 103.82,85.81 107.31,84.61 110.94,83.88","90.44,99.25 93.11,99.26 95.74,99.79 98.37,100.3 101,100.82 103.64,101.33 106.27,101.85 108.9,102.37 111.53,102.89 114.16,103.41 116.79,103.94 119.42,104.47 122.06,105 124.69,105.53 127.32,106.06 129.94,106.6 132.57,107.14 135.2,107.68 137.65,108.73 139.5,110.65 140.44,113.14 140.36,115.81 139.35,118.28 137.48,120.18 135,121.14 132.32,121.11 129.7,120.56 127.08,120 124.45,119.46 121.82,118.93 119.19,118.4 116.56,117.87 113.93,117.35 111.29,116.83 108.66,116.32 106.02,115.82 103.39,115.31 100.76,114.79 98.12,114.28 95.49,113.75 92.86,113.22 90.23,112.68 87.77,111.66 85.93,109.74 85.01,107.24 85.06,104.57 86.07,102.1 87.96,100.22|156.6,112.56 158.91,112.66 161.18,113.15 163.45,113.64 165.72,114.13 167.99,114.62 170.26,115.12 172.53,115.62 174.8,116.12 177.07,116.62 179.34,117.13 181.6,117.64 183.87,118.15 186.14,118.67 188.4,119.18 190.67,119.7 192.94,120.2 195.12,120.96 196.7,122.63 197.45,124.82 197.53,127.14 197.07,129.41 196.08,131.51 194.49,133.18 192.33,133.97 190.04,133.68 187.79,133.09 185.52,132.57 183.26,132.05 180.99,131.54 178.72,131.03 176.45,130.53 174.18,130.03 171.91,129.54 169.64,129.05 167.37,128.56 165.1,128.07 162.83,127.58 160.56,127.08 158.29,126.57 156.02,126.05 153.9,125.14 152.26,123.51 151.32,121.4 151.08,119.1 151.53,116.82 152.65,114.8 154.41,113.31","79.94,130.44 83.08,130.57 86.11,131.41 88.89,132.89 91.27,134.94 93.15,137.46 94.39,140.35 95.11,143.42 95.65,146.52 96.2,149.62 96.78,152.72 97.39,155.81 98.04,158.89 98.72,161.97 99.43,165.04 100.18,168.1 100.97,171.15 101.81,174.18 102.64,177.22 103.01,180.34 102.35,183.4 100.66,186.04 98.19,187.98 95.28,189.16 92.17,189.6 89.03,189.37 85.99,188.56 83.16,187.2 80.63,185.33 78.55,182.97 77.05,180.21 76.1,177.21 75.28,174.17 74.5,171.11 73.74,168.06 73.02,164.99 72.33,161.92 71.68,158.83 71.06,155.75 70.47,152.65 69.91,149.55 69.37,146.45 68.97,143.32 69.12,140.18 70.04,137.18 71.7,134.51 74.03,132.41 76.86,131.04|168.95,136.28 171.31,136.97 172.99,138.76 173.66,141.13 173.36,143.58 172.24,145.79 170.45,147.49 168.22,148.58 165.89,149.43 163.57,150.31 161.24,151.18 158.9,152.02 156.56,152.85 154.21,153.65 151.85,154.44 149.48,155.2 147.11,155.94 144.73,156.65 142.34,157.34 139.95,158.01 137.55,158.66 135.14,159.27 132.73,159.86 130.31,160.43 127.84,160.54 125.53,159.69 123.77,157.96 122.89,155.66 123.09,153.21 124.36,151.09 126.34,149.61 128.69,148.83 131.1,148.24 133.51,147.62 135.91,146.98 138.31,146.32 140.7,145.65 143.08,144.95 145.46,144.23 147.83,143.49 150.2,142.73 152.56,141.95 154.91,141.15 157.25,140.32 159.59,139.48 161.92,138.61 164.24,137.72 166.54,136.78","119.79,105.35 121.94,105.42 124.03,105.87 126,106.72 127.77,107.93 129.27,109.47 130.45,111.26 131.29,113.23 131.73,115.33 131.79,117.47 131.53,119.6 131.11,121.71 130.66,123.81 130.27,125.92 129.88,128.03 129.49,130.14 129.07,132.25 128.62,134.35 127.96,136.39 126.96,138.29 125.62,139.96 123.99,141.36 122.13,142.43 120.11,143.15 118,143.5 115.85,143.45 113.75,143 111.79,142.15 110.03,140.93 108.54,139.38 107.36,137.59 106.53,135.61 106.1,133.51 106.07,131.37 106.35,129.24 106.77,127.14 107.22,125.04 107.64,122.93 108.05,120.82 108.45,118.71 108.84,116.6 109.25,114.49 109.86,112.44 110.83,110.52 112.16,108.84 113.78,107.44 115.65,106.38 117.67,105.68|174.73,114.1 176.71,114.59 178.5,115.55 180.04,116.88 181.27,118.5 182.17,120.33 182.71,122.29 182.9,124.32 182.82,126.36 182.56,128.38 182.23,130.39 181.89,132.4 181.53,134.41 181.16,136.41 180.75,138.41 180.3,140.4 179.82,142.38 179.18,144.31 178.28,146.15 177.14,147.83 175.74,149.31 174.11,150.53 172.29,151.44 170.32,151.97 168.29,152.07 166.29,151.69 164.45,150.83 162.87,149.54 161.66,147.91 160.83,146.06 160.38,144.07 160.29,142.04 160.53,140.01 160.98,138.02 161.43,136.03 161.84,134.04 162.24,132.04 162.62,130.03 162.93,128.02 163.24,126 163.6,124 164.11,122.03 164.91,120.15 165.99,118.43 167.35,116.91 168.94,115.64 170.74,114.69 172.7,114.15","105.72,72.58 108.82,72.78 111.75,73.82 114.27,75.64 116.39,77.92 118.42,80.29 120.45,82.66 122.47,85.03 124.48,87.41 126.49,89.8 128.48,92.2 130.47,94.6 132.45,97.01 134.43,99.42 136.4,101.83 138.37,104.25 140.3,106.7 141.85,109.39 142.65,112.4 142.63,115.51 141.8,118.5 140.21,121.17 137.95,123.31 135.17,124.7 132.11,125.26 129.02,124.98 126.12,123.86 123.67,121.94 121.61,119.6 119.66,117.17 117.69,114.75 115.73,112.33 113.75,109.92 111.77,107.52 109.77,105.12 107.77,102.73 105.76,100.34 103.75,97.96 101.72,95.59 99.68,93.23 97.63,90.89 95.91,88.3 94.95,85.34 94.92,82.24 95.84,79.27 97.56,76.68 99.9,74.63 102.67,73.22|176.73,63.75 179.52,64.43 182.02,65.85 184.15,67.78 185.85,70.1 187.08,72.7 187.76,75.5 187.76,78.37 187.23,81.2 186.58,84.01 185.89,86.8 185.16,89.59 184.39,92.36 183.59,95.13 182.76,97.89 181.88,100.64 180.98,103.37 180.02,106.09 179.03,108.79 177.99,111.48 176.9,114.15 175.5,116.66 173.51,118.72 171,120.11 168.18,120.66 165.34,120.29 162.75,119.04 160.62,117.12 159.02,114.73 158,112.04 157.63,109.19 157.98,106.34 158.83,103.59 159.86,100.9 160.87,98.2 161.85,95.49 162.79,92.76 163.7,90.03 164.57,87.29 165.41,84.53 166.21,81.76 166.98,78.99 167.7,76.2 168.38,73.4 169,70.58 169.79,67.82 171.41,65.46 173.88,64.03","64.12,83.43 66.69,84.08 68.9,85.53 70.57,87.6 71.56,90.05 71.86,92.69 71.53,95.32 70.55,97.78 69.06,99.99 67.36,102.03 65.64,104.06 63.95,106.11 62.28,108.18 60.63,110.27 59,112.38 57.41,114.5 55.84,116.65 54.29,118.82 52.78,121 51.31,123.22 49.86,125.45 48.42,127.69 46.67,129.68 44.36,130.96 41.73,131.22 39.22,130.38 37.16,128.72 35.64,126.55 34.65,124.08 34.2,121.46 34.29,118.81 34.94,116.24 36.12,113.86 37.54,111.61 39.04,109.41 40.54,107.21 42.06,105.03 43.61,102.87 45.18,100.73 46.79,98.6 48.41,96.5 50.07,94.42 51.74,92.35 53.45,90.31 55.17,88.28 56.94,86.3 59.04,84.67 61.48,83.65|104.23,93.09 106.97,93.77 109.4,95.24 111.32,97.31 112.59,99.85 113.4,102.57 114.13,105.32 114.87,108.06 115.62,110.8 116.37,113.54 117.14,116.28 117.9,119.02 118.67,121.75 119.45,124.49 120.23,127.22 121.03,129.95 121.83,132.68 122.6,135.41 122.98,138.22 122.57,141.02 121.34,143.57 119.44,145.67 117.05,147.19 114.34,148.04 111.51,148.14 108.77,147.45 106.33,146.01 104.38,143.96 103.07,141.44 102.21,138.73 101.43,136 100.65,133.27 99.87,130.53 99.09,127.8 98.32,125.06 97.55,122.33 96.79,119.59 96.04,116.85 95.28,114.11 94.53,111.37 93.79,108.62 93.05,105.88 92.73,103.07 93.18,100.27 94.42,97.72 96.32,95.62 98.7,94.08 101.4,93.21","108.14,135.9 111.13,136.06 114.08,136.56 116.95,137.39 119.71,138.55 122.31,140.03 124.71,141.81 126.86,143.89 128.73,146.23 130.27,148.8 131.44,151.55 132.22,154.44 132.56,157.41 132.47,160.4 131.93,163.34 130.96,166.17 129.6,168.83 127.87,171.28 125.83,173.46 123.51,175.35 120.96,176.91 118.23,178.13 115.36,179 112.42,179.52 109.43,179.7 106.44,179.54 103.49,179.04 100.62,178.21 97.86,177.06 95.26,175.58 92.86,173.79 90.71,171.71 88.84,169.37 87.3,166.81 86.13,164.06 85.35,161.17 85.01,158.2 85.11,155.21 85.64,152.26 86.61,149.43 87.97,146.77 89.7,144.33 91.74,142.14 94.06,140.25 96.61,138.69 99.34,137.47 102.21,136.6 105.15,136.08|175.67,128.81 177.16,128.85 178.62,129.14 180.01,129.67 181.28,130.44 182.41,131.42 183.36,132.57 184.12,133.85 184.68,135.23 185.05,136.68 185.24,138.15 185.27,139.64 185.13,141.13 184.85,142.59 184.42,144.02 183.85,145.4 183.15,146.72 182.33,147.96 181.38,149.11 180.32,150.16 179.15,151.08 177.88,151.87 176.53,152.49 175.1,152.91 173.62,153.11 172.13,153.07 170.67,152.78 169.28,152.24 168.01,151.47 166.88,150.49 165.93,149.35 165.18,148.06 164.61,146.68 164.24,145.24 164.05,143.76 164.02,142.27 164.16,140.78 164.44,139.32 164.87,137.89 165.44,136.51 166.14,135.2 166.96,133.95 167.91,132.8 168.97,131.75 170.14,130.83 171.4,130.04 172.76,129.43 174.19,129.01","103.39,78.25 106.56,78.38 109.59,79.28 112.29,80.94 114.43,83.28 115.86,86.1 116.52,89.2 116.32,92.37 115.62,95.46 114.86,98.55 114.1,101.63 113.36,104.72 112.63,107.81 111.91,110.91 111.2,114.01 110.51,117.1 109.82,120.21 109.16,123.31 108.52,126.42 107.84,129.53 106.8,132.52 105.04,135.16 102.66,137.25 99.81,138.63 96.7,139.2 93.54,138.96 90.53,137.95 87.87,136.24 85.71,133.92 84.21,131.13 83.48,128.05 83.5,124.88 84,121.74 84.7,118.64 85.4,115.54 86.08,112.44 86.77,109.34 87.48,106.24 88.19,103.15 88.92,100.05 89.66,96.96 90.41,93.88 91.18,90.8 91.95,87.71 93.1,84.76 94.95,82.19 97.4,80.19 100.28,78.86|161.99,91.57 165.07,92 167.9,93.28 170.32,95.23 172.22,97.69 173.49,100.53 174.05,103.59 173.93,106.7 173.45,109.78 172.9,112.85 172.33,115.91 171.71,118.97 171.06,122.02 170.38,125.06 169.66,128.09 168.91,131.12 168.13,134.14 167.33,137.15 166.5,140.16 165.58,143.14 164.33,145.98 162.5,148.5 160.15,150.53 157.38,151.95 154.34,152.61 151.24,152.43 148.32,151.38 145.83,149.52 143.99,147.01 142.95,144.08 142.73,140.98 143.25,137.91 144.09,134.91 144.94,131.91 145.76,128.9 146.54,125.89 147.29,122.86 148.01,119.83 148.69,116.79 149.34,113.74 149.95,110.68 150.54,107.62 151.09,104.55 151.6,101.47 152.44,98.48 154,95.79 156.21,93.6 158.94,92.12","47.23,91.05 51.61,92.47 55.26,95.29 57.96,99.03 59.7,103.31 60.56,107.85 61.28,112.42 62.11,116.97 63.06,121.51 64.11,126.01 65.28,130.49 66.56,134.94 67.95,139.35 69.44,143.73 71.05,148.07 72.77,152.37 74.62,156.61 76.52,160.83 78.06,165.19 78.52,169.78 77.62,174.3 75.2,178.22 71.44,180.86 66.96,181.91 62.36,181.55 57.99,180.06 54.03,177.68 50.59,174.58 47.77,170.92 45.62,166.83 43.74,162.6 41.96,158.33 40.29,154.01 38.72,149.66 37.27,145.26 35.93,140.83 34.69,136.37 33.56,131.88 32.55,127.37 31.65,122.83 30.85,118.27 30.2,113.69 30.08,109.07 30.85,104.51 32.49,100.19 35.01,96.32 38.44,93.24 42.64,91.35|108.93,73.38 113.76,73.6 118.38,75.01 122.49,77.56 125.82,81.07 128.1,85.34 129.65,89.93 131.04,94.58 132.43,99.22 133.82,103.87 135.22,108.51 136.6,113.16 137.99,117.81 139.36,122.46 140.73,127.11 142.13,131.76 143.51,136.41 144.82,141.08 145.51,145.86 144.91,150.66 143.09,155.14 140.17,158.99 136.38,162.01 132,164.05 127.26,165.03 122.42,164.86 117.79,163.48 113.67,160.95 110.36,157.43 108.17,153.11 106.72,148.49 105.36,143.83 103.99,139.18 102.62,134.53 101.24,129.88 99.87,125.23 98.48,120.58 97.09,115.93 95.7,111.29 94.29,106.64 92.89,102 91.49,97.36 90.81,92.57 91.38,87.77 93.14,83.26 96.02,79.37 99.79,76.34 104.18,74.32","102.86,129.56 106.39,129.96 109.85,130.76 113.21,131.94 116.4,133.5 119.39,135.42 122.13,137.69 124.56,140.28 126.64,143.16 128.33,146.29 129.59,149.61 130.37,153.08 130.66,156.62 130.43,160.16 129.68,163.63 128.42,166.96 126.7,170.07 124.54,172.89 122.02,175.39 119.18,177.52 116.07,179.25 112.76,180.54 109.31,181.4 105.78,181.82 102.23,181.83 98.7,181.42 95.24,180.62 91.88,179.44 88.69,177.88 85.7,175.96 82.96,173.69 80.53,171.1 78.45,168.22 76.76,165.1 75.5,161.77 74.72,158.31 74.44,154.77 74.67,151.22 75.41,147.75 76.67,144.42 78.39,141.32 80.55,138.49 83.07,135.99 85.91,133.86 89.02,132.14 92.33,130.84 95.78,129.99 99.31,129.56|180.44,141.06 183.61,141.1 186.72,141.68 189.66,142.86 192.28,144.63 194.43,146.96 196,149.71 197,152.72 197.48,155.86 197.51,159.03 197.15,162.18 196.43,165.27 195.38,168.26 194.07,171.15 192.52,173.92 190.74,176.55 188.77,179.03 186.6,181.35 184.25,183.48 181.74,185.41 179.06,187.12 176.23,188.56 173.28,189.71 170.21,190.52 167.07,190.95 163.9,190.91 160.78,190.33 157.84,189.15 155.22,187.37 153.08,185.04 151.51,182.29 150.51,179.28 150.03,176.15 150,172.98 150.36,169.83 151.07,166.74 152.12,163.74 153.43,160.85 154.99,158.09 156.76,155.46 158.74,152.98 160.91,150.66 163.25,148.53 165.77,146.59 168.45,144.89 171.27,143.45 174.23,142.3 177.29,141.48","86.02,131.33 88.42,131.69 90.54,132.87 92.12,134.71 93.03,136.97 93.17,139.39 92.41,141.69 90.78,143.48 88.59,144.52 86.19,144.97 83.78,145.34 81.37,145.72 78.96,146.09 76.54,146.45 74.13,146.81 71.72,147.16 69.3,147.5 66.88,147.84 64.47,148.16 62.05,148.47 59.62,148.76 57.2,149.03 54.77,149.27 52.34,149.49 49.91,149.68 47.53,149.28 45.52,147.92 44.04,145.99 43.12,143.74 42.85,141.32 43.44,138.97 45.04,137.17 47.33,136.4 49.76,136.2 52.19,135.96 54.62,135.7 57.04,135.43 59.46,135.15 61.89,134.85 64.31,134.54 66.72,134.22 69.14,133.89 71.56,133.54 73.97,133.19 76.38,132.83 78.79,132.45 81.2,132.06 83.61,131.67|153.42,116.84 155.92,117.69 157.78,119.56 158.72,122.03 158.73,124.68 157.84,127.18 156.08,129.15 153.71,130.33 151.13,131 148.55,131.65 145.98,132.32 143.4,132.98 140.82,133.63 138.23,134.27 135.65,134.9 133.06,135.53 130.47,136.15 127.88,136.76 125.29,137.36 122.69,137.94 120.09,138.51 117.49,139.06 114.88,139.59 112.27,140.1 109.62,140.12 107.17,139.14 105.28,137.29 104.18,134.88 104.06,132.23 105.03,129.78 106.92,127.93 109.35,126.87 111.96,126.34 114.57,125.8 117.17,125.24 119.77,124.67 122.37,124.09 124.96,123.5 127.56,122.9 130.15,122.29 132.74,121.68 135.32,121.05 137.91,120.41 140.49,119.76 143.07,119.11 145.65,118.44 148.22,117.76 150.78,117.03","83.36,65.84 86.61,66.42 89.57,67.88 92,70.12 93.67,72.97 94.46,76.17 94.31,79.47 93.61,82.71 92.8,85.92 92.02,89.14 91.27,92.36 90.56,95.6 89.88,98.84 89.23,102.09 88.62,105.34 88.03,108.61 87.51,111.88 87.01,115.15 86.5,118.42 85.65,121.62 84.11,124.54 81.9,126.99 79.13,128.79 75.98,129.8 72.68,129.91 69.47,129.13 66.6,127.49 64.24,125.18 62.49,122.38 61.42,119.25 61.08,115.97 61.36,112.67 61.87,109.4 62.45,106.13 63.01,102.87 63.61,99.61 64.24,96.36 64.9,93.11 65.6,89.87 66.33,86.64 67.09,83.42 67.89,80.2 68.73,77 69.89,73.9 71.7,71.14 74.1,68.86 76.93,67.16 80.07,66.12|119.49,99.16 121.99,99.28 124.44,99.82 126.9,100.34 129.36,100.86 131.81,101.38 134.27,101.91 136.72,102.44 139.17,102.98 141.62,103.52 144.08,104.07 146.52,104.62 148.97,105.18 151.42,105.74 153.86,106.31 156.31,106.89 158.75,107.47 161.2,108.02 163.49,109.03 165.16,110.87 165.95,113.24 165.87,115.74 164.94,118.05 163.17,119.8 160.79,120.55 158.31,120.29 155.88,119.65 153.44,119.06 150.99,118.49 148.55,117.92 146.1,117.36 143.65,116.81 141.2,116.26 138.75,115.73 136.29,115.2 133.84,114.67 131.38,114.15 128.93,113.62 126.47,113.1 124.02,112.57 121.56,112.04 119.11,111.5 116.81,110.53 115.08,108.73 114.22,106.39 114.29,103.9 115.28,101.61 117.12,99.93","168.71,85.67 170.73,86 172.64,86.75 174.37,87.85 175.88,89.24 177.11,90.88 178.04,92.71 178.71,94.65 179.21,96.64 179.64,98.65 180.05,100.66 180.45,102.67 180.83,104.69 181.18,106.71 181.5,108.74 181.77,110.78 181.88,112.82 181.71,114.87 181.22,116.86 180.41,118.74 179.27,120.45 177.83,121.91 176.12,123.03 174.2,123.74 172.16,123.99 170.13,123.75 168.21,123.04 166.49,121.93 165.03,120.48 163.88,118.79 163.02,116.93 162.49,114.95 162.17,112.92 161.85,110.89 161.51,108.87 161.14,106.84 160.77,104.83 160.37,102.81 159.96,100.8 159.52,98.79 159.24,96.76 159.3,94.71 159.71,92.7 160.48,90.8 161.58,89.08 163.01,87.61 164.73,86.49 166.67,85.83|206.57,78.24 208.3,78.8 209.77,79.87 210.99,81.22 212.01,82.73 212.85,84.34 213.53,86.03 214.08,87.77 214.54,89.54 214.95,91.31 215.34,93.09 215.7,94.88 216.04,96.67 216.36,98.46 216.64,100.26 216.89,102.07 217.11,103.88 217.25,105.7 217.26,107.52 217.1,109.33 216.75,111.12 216.16,112.84 215.3,114.44 214.04,115.75 212.34,116.35 210.58,115.96 209.11,114.89 207.97,113.48 207.1,111.88 206.44,110.18 205.97,108.42 205.62,106.63 205.35,104.83 205.11,103.02 204.85,101.22 204.55,99.42 204.22,97.63 203.87,95.84 203.49,94.05 203.09,92.28 202.67,90.5 202.32,88.71 202.1,86.91 202.1,85.08 202.32,83.28 202.77,81.51 203.54,79.86 204.82,78.59","39.78,104.3 42.64,105.01 45.03,106.74 46.73,109.15 47.75,111.93 48.35,114.83 48.81,117.76 49.31,120.68 49.87,123.6 50.48,126.5 51.15,129.39 51.86,132.27 52.63,135.13 53.44,137.98 54.3,140.82 55.19,143.65 56.13,146.46 57.1,149.26 58.1,152.05 58.86,154.92 58.96,157.87 58.18,160.72 56.43,163.09 53.84,164.48 50.9,164.62 48.08,163.75 45.58,162.16 43.51,160.05 41.89,157.57 40.67,154.87 39.67,152.08 38.73,149.26 37.81,146.44 36.94,143.61 36.11,140.76 35.34,137.9 34.61,135.03 33.92,132.14 33.28,129.24 32.7,126.34 32.16,123.42 31.67,120.5 31.23,117.57 31.14,114.61 31.65,111.69 32.74,108.94 34.47,106.54 36.89,104.86|108.97,125.73 111.9,126.2 114.63,127.37 117,129.16 118.84,131.49 119.99,134.23 120.32,137.18 119.85,140.11 118.59,142.8 116.78,145.16 114.84,147.42 112.89,149.67 110.93,151.92 108.97,154.16 107.01,156.39 105.03,158.62 103.05,160.85 101.07,163.06 99.07,165.28 97.09,167.5 95.09,169.71 93.05,171.88 90.69,173.67 87.89,174.66 84.93,174.81 82.02,174.22 79.31,173 76.92,171.24 74.99,168.98 73.7,166.3 73.26,163.37 73.74,160.45 75.2,157.86 77.17,155.63 79.18,153.43 81.18,151.23 83.17,149.02 85.16,146.8 87.14,144.58 89.11,142.35 91.08,140.11 93.04,137.87 95,135.63 96.95,133.38 98.89,131.12 100.87,128.89 103.25,127.12 106.02,126.04","115.43,87.59 118.19,88.24 120.69,89.59 122.69,91.59 124.03,94.09 124.63,96.87 124.41,99.7 123.7,102.45 122.9,105.18 122.12,107.92 121.34,110.65 120.57,113.39 119.79,116.13 119.02,118.87 118.25,121.61 117.48,124.35 116.72,127.09 115.97,129.83 115.23,132.58 114.45,135.32 113.3,137.91 111.49,140.09 109.13,141.65 106.41,142.48 103.58,142.56 100.82,141.91 98.33,140.54 96.33,138.53 94.99,136.03 94.38,133.26 94.57,130.43 95.25,127.67 96.02,124.93 96.79,122.19 97.55,119.45 98.31,116.7 99.08,113.96 99.85,111.22 100.62,108.49 101.4,105.75 102.18,103.01 102.95,100.27 103.74,97.54 104.51,94.8 105.68,92.21 107.5,90.04 109.88,88.5 112.59,87.67|155.37,78.64 158.04,79.15 160.48,80.37 162.53,82.16 164.33,84.22 166.1,86.3 167.85,88.4 169.58,90.51 171.29,92.64 172.98,94.78 174.65,96.94 176.3,99.12 177.92,101.32 179.51,103.54 181.06,105.79 182.57,108.07 184.03,110.37 185.2,112.83 185.77,115.5 185.73,118.23 185.07,120.87 183.8,123.28 181.94,125.26 179.57,126.6 176.89,127.03 174.24,126.43 171.99,124.92 170.26,122.8 168.75,120.53 167.22,118.27 165.66,116.03 164.07,113.81 162.45,111.6 160.82,109.41 159.16,107.25 157.47,105.1 155.76,102.97 154.03,100.85 152.28,98.76 150.51,96.68 148.74,94.6 147.29,92.29 146.49,89.69 146.36,86.97 146.94,84.31 148.23,81.91 150.19,80.02 152.66,78.89","92.71,76.24 95.76,76.59 98.73,77.35 101.56,78.53 104.21,80.08 106.63,81.96 108.78,84.16 110.61,86.62 112.09,89.31 113.19,92.17 113.91,95.15 114.24,98.2 114.18,101.27 113.73,104.31 112.9,107.26 111.7,110.09 110.15,112.73 108.28,115.17 106.12,117.35 103.71,119.24 101.08,120.83 98.27,122.07 95.33,122.95 92.3,123.44 89.23,123.51 86.18,123.17 83.21,122.41 80.38,121.23 77.73,119.69 75.31,117.8 73.16,115.61 71.33,113.14 69.86,110.45 68.75,107.59 68.02,104.61 67.7,101.56 67.76,98.49 68.22,95.46 69.05,92.5 70.25,89.68 71.8,87.03 73.67,84.59 75.83,82.41 78.24,80.52 80.87,78.93 83.67,77.69 86.61,76.81 89.64,76.32|157.73,102.08 159.31,102.13 160.86,102.42 162.35,102.95 163.74,103.69 165.01,104.62 166.15,105.72 167.13,106.95 167.96,108.29 168.63,109.72 169.13,111.22 169.45,112.76 169.59,114.34 169.55,115.91 169.31,117.47 168.88,118.99 168.28,120.45 167.52,121.83 166.58,123.1 165.48,124.23 164.25,125.22 162.89,126.02 161.43,126.63 159.91,127.02 158.34,127.2 156.76,127.14 155.21,126.85 153.73,126.33 152.33,125.59 151.06,124.65 149.93,123.56 148.94,122.33 148.11,120.99 147.44,119.56 146.95,118.06 146.62,116.51 146.48,114.94 146.52,113.37 146.76,111.8 147.18,110.28 147.78,108.83 148.56,107.45 149.5,106.18 150.59,105.05 151.83,104.07 153.18,103.26 154.64,102.65 156.17,102.26","57.98,112.03 61.01,112.26 63.82,113.41 66.22,115.27 68.09,117.67 69.36,120.44 70.14,123.39 70.64,126.39 71.07,129.41 71.58,132.42 72.15,135.41 72.76,138.4 73.4,141.38 74.09,144.35 74.82,147.31 75.59,150.26 76.42,153.2 77.3,156.12 78.16,159.04 78.68,162.04 78.42,165.07 77.28,167.88 75.25,170.13 72.54,171.49 69.52,171.87 66.51,171.44 63.69,170.32 61.16,168.61 59.03,166.44 57.38,163.89 56.23,161.06 55.34,158.15 54.53,155.21 53.73,152.27 52.97,149.31 52.25,146.35 51.57,143.38 50.93,140.4 50.34,137.41 49.78,134.41 49.26,131.4 48.78,128.39 48.37,125.37 48.37,122.33 49.06,119.36 50.44,116.65 52.47,114.39 55.04,112.78|117.45,101.46 120.57,101.84 123.48,103.02 125.99,104.91 127.97,107.35 129.25,110.23 130.05,113.27 130.76,116.34 131.46,119.41 132.15,122.49 132.85,125.56 133.55,128.63 134.24,131.71 134.93,134.78 135.61,137.86 136.32,140.93 137.01,144 137.66,147.09 137.87,150.22 137.25,153.3 135.83,156.1 133.73,158.45 131.15,160.23 128.22,161.38 125.11,161.83 121.98,161.5 119.05,160.37 116.52,158.51 114.57,156.05 113.37,153.14 112.64,150.08 111.95,147 111.27,143.93 110.58,140.85 109.89,137.78 109.2,134.7 108.51,131.63 107.81,128.56 107.12,125.48 106.42,122.41 105.71,119.34 105.02,116.27 104.83,113.13 105.42,110.04 106.79,107.22 108.84,104.83 111.41,103.02 114.33,101.87","113.75,120.08 118.16,120.78 122.31,122.43 125.98,124.96 128.94,128.29 131.02,132.23 132.12,136.56 132.1,141.02 131.16,145.38 129.94,149.68 128.69,153.98 127.44,158.27 126.19,162.56 124.92,166.85 123.64,171.14 122.35,175.42 121.05,179.69 119.76,183.97 118.46,188.25 117.05,192.49 114.84,196.36 111.47,199.27 107.42,201.12 103.04,201.99 98.58,201.97 94.18,201.19 89.97,199.7 86.1,197.48 82.8,194.48 80.41,190.72 79.31,186.41 79.87,182 81.24,177.74 82.57,173.47 83.88,169.2 85.19,164.92 86.48,160.64 87.75,156.36 89.02,152.07 90.28,147.78 91.53,143.49 92.77,139.19 93.97,134.88 95.5,130.69 97.93,126.95 101.16,123.87 105.02,121.64 109.3,120.36|181.19,127.71 185.4,128.03 189.23,129.79 192.19,132.8 194.06,136.59 194.87,140.74 194.76,144.98 194.21,149.18 193.55,153.37 192.79,157.55 191.91,161.69 190.91,165.82 189.8,169.91 188.57,173.97 187.22,177.99 185.72,181.96 184.07,185.87 182.26,189.7 180.26,193.44 177.85,196.92 174.93,199.99 171.62,202.64 168,204.85 164.13,206.59 160.07,207.78 155.86,208.24 151.69,207.6 148.31,205.16 147.33,201.11 148.48,197.06 150.4,193.28 152.24,189.46 153.93,185.56 155.48,181.61 156.89,177.62 158.17,173.57 159.32,169.49 160.35,165.38 161.26,161.23 162.06,157.07 162.7,152.87 163.29,148.67 164.12,144.52 165.46,140.5 167.49,136.78 170.16,133.49 173.37,130.73 177.08,128.7","52.43,111.88 55.76,112.3 59,113.21 62.08,114.57 64.96,116.3 67.61,118.36 70.01,120.71 72.16,123.3 74.02,126.1 75.61,129.06 76.9,132.17 77.89,135.38 78.56,138.68 78.89,142.02 78.86,145.39 78.45,148.72 77.63,151.98 76.39,155.11 74.74,158.03 72.67,160.68 70.2,162.96 67.38,164.79 64.28,166.08 61,166.78 57.64,166.91 54.3,166.49 51.07,165.57 47.99,164.22 45.11,162.49 42.46,160.42 40.05,158.07 37.91,155.48 36.04,152.68 34.46,149.72 33.16,146.62 32.17,143.4 31.51,140.11 31.18,136.76 31.21,133.4 31.62,130.06 32.44,126.8 33.67,123.68 35.33,120.75 37.4,118.1 39.86,115.82 42.68,114 45.79,112.71 49.07,112.01|126.89,95.19 130.56,95.44 134.16,96.17 137.64,97.36 140.94,98.99 143.98,101.06 146.73,103.5 149.13,106.29 151.14,109.37 152.72,112.69 153.86,116.19 154.54,119.8 154.74,123.47 154.45,127.14 153.67,130.74 152.43,134.2 150.76,137.48 148.69,140.51 146.25,143.27 143.48,145.69 140.43,147.75 137.14,149.39 133.66,150.59 130.06,151.32 126.39,151.56 122.72,151.31 119.11,150.59 115.63,149.4 112.34,147.76 109.29,145.7 106.54,143.26 104.14,140.47 102.13,137.39 100.55,134.07 99.41,130.57 98.73,126.96 98.53,123.28 98.83,119.62 99.6,116.02 100.84,112.56 102.51,109.28 104.59,106.25 107.03,103.49 109.79,101.07 112.84,99.01 116.13,97.36 119.61,96.16 123.22,95.43","72.34,79.33 74.93,79.64 77.52,79.94 80.12,80.25 82.71,80.57 85.3,80.91 87.88,81.26 90.47,81.63 93.05,82 95.63,82.39 98.21,82.79 100.79,83.21 103.37,83.63 105.94,84.07 108.51,84.52 111.09,84.92 113.65,85.44 115.99,86.56 117.75,88.47 118.68,90.89 118.57,93.48 117.47,95.83 115.57,97.6 113.16,98.56 110.56,98.58 108,98.1 105.43,97.64 102.85,97.19 100.28,96.76 97.7,96.33 95.12,95.93 92.54,95.53 89.96,95.14 87.38,94.77 84.79,94.4 82.2,94.06 79.62,93.72 77.02,93.41 74.43,93.11 71.84,92.81 69.24,92.5 66.78,91.69 64.99,89.83 64.25,87.35 64.5,84.76 65.58,82.39 67.38,80.53 69.74,79.45|136.83,90.25 139.33,90.71 141.8,91.34 144.28,91.93 146.75,92.53 149.22,93.14 151.69,93.77 154.15,94.4 156.62,95.05 159.08,95.71 161.53,96.38 163.98,97.07 166.43,97.76 168.88,98.47 171.32,99.2 173.75,99.94 176.19,100.67 178.49,101.74 180.18,103.62 181.12,105.98 181.31,108.51 180.69,110.96 179.21,113.01 176.98,114.19 174.46,114.13 172.02,113.41 169.58,112.66 167.14,111.93 164.7,111.22 162.25,110.52 159.8,109.84 157.34,109.17 154.88,108.52 152.42,107.88 149.95,107.26 147.48,106.64 145.01,106.03 142.54,105.42 140.06,104.81 137.59,104.21 135.12,103.61 132.78,102.62 130.96,100.86 129.93,98.55 129.77,96.02 130.49,93.59 132.06,91.61 134.31,90.46","107.05,116.19 110.26,116.71 113.26,118 115.85,119.97 117.92,122.49 119.29,125.45 120.04,128.63 120.54,131.86 121.04,135.09 121.54,138.31 122.06,141.54 122.59,144.77 123.12,147.99 123.67,151.21 124.22,154.43 124.8,157.65 125.4,160.86 125.95,164.08 126.04,167.34 125.2,170.49 123.53,173.28 121.14,175.49 118.26,177.02 115.11,177.87 111.85,178.04 108.63,177.56 105.58,176.41 102.87,174.58 100.72,172.14 99.35,169.18 98.61,166 98.04,162.78 97.47,159.57 96.91,156.35 96.36,153.13 95.83,149.9 95.3,146.68 94.78,143.45 94.27,140.22 93.76,137 93.26,133.77 92.82,130.53 92.96,127.27 93.87,124.15 95.55,121.35 97.88,119.07 100.68,117.41 103.79,116.44|189.21,121.96 191.36,122.71 192.8,124.5 193.41,126.73 193.32,129.04 192.59,131.23 191.22,133.09 189.28,134.34 187.12,135.19 184.95,136 182.78,136.83 180.61,137.63 178.43,138.43 176.24,139.2 174.05,139.95 171.85,140.69 169.64,141.4 167.43,142.09 165.21,142.76 162.98,143.42 160.75,144.05 158.51,144.66 156.27,145.25 154.02,145.81 151.72,145.98 149.57,145.18 148.01,143.49 147.25,141.31 147.31,139 148.16,136.86 149.7,135.14 151.74,134.05 153.97,133.43 156.21,132.84 158.45,132.22 160.68,131.59 162.91,130.93 165.13,130.26 167.34,129.58 169.55,128.87 171.76,128.15 173.95,127.41 176.15,126.65 178.33,125.87 180.51,125.08 182.68,124.26 184.84,123.41 186.98,122.53","98.62,121.53 100.72,121.6 102.78,122.03 104.72,122.83 106.49,123.97 108.01,125.42 109.24,127.12 110.15,129.02 110.66,131.05 110.78,133.15 110.62,135.25 110.34,137.33 110.04,139.42 109.76,141.5 109.49,143.59 109.21,145.68 108.92,147.76 108.6,149.84 108.08,151.88 107.18,153.78 105.92,155.45 104.34,156.83 102.51,157.86 100.51,158.52 98.43,158.81 96.33,158.72 94.28,158.27 92.33,157.47 90.57,156.33 89.03,154.89 87.78,153.21 86.85,151.32 86.29,149.3 86.13,147.2 86.28,145.11 86.57,143.02 86.9,140.94 87.2,138.86 87.49,136.78 87.79,134.69 88.08,132.61 88.4,130.53 88.96,128.5 89.88,126.61 91.15,124.94 92.73,123.56 94.56,122.52 96.54,121.84|155.31,127.29 157.36,127.43 159.33,127.99 161.14,128.96 162.7,130.29 163.95,131.92 164.84,133.77 165.35,135.75 165.49,137.8 165.35,139.85 165.07,141.89 164.79,143.92 164.53,145.96 164.26,148 163.97,150.04 163.65,152.06 163.27,154.09 162.7,156.06 161.83,157.92 160.68,159.62 159.29,161.13 157.69,162.41 155.9,163.42 153.97,164.1 151.94,164.41 149.89,164.32 147.9,163.82 146.06,162.92 144.47,161.62 143.24,159.98 142.41,158.1 142,156.09 142.01,154.04 142.32,152.01 142.64,149.98 142.96,147.95 143.25,145.92 143.51,143.88 143.73,141.83 143.97,139.79 144.27,137.76 144.74,135.76 145.53,133.87 146.62,132.13 147.98,130.59 149.57,129.28 151.35,128.27 153.28,127.58"],SD=Sse.map(e=>e.split("|").map(t=>t.split(" ").map(a=>{const[o,i]=a.split(",");return[Number(o),Number(i)]}))),tx=e=>{let t=0,a=0;for(const o of e)t+=o[0],a+=o[1];return[t/e.length,a/e.length]},ch=SD.map(e=>{const t=tx(e[0]),a=tx(e[1]);return[(t[0]+a[0])/2-T7[0],(t[1]+a[1])/2-T7[1]]}),xy=SD.map((e,t)=>e.map(a=>a.map(o=>[o[0]-ch[t][0],o[1]-ch[t][1]]))),Uk=xy.length,Vk=[[14,3,20,0],[13,1,20,0],[25,14,13,0],[11,4,18,0],[16,-2,22,0],[15,-3,20,6],[12,2,20,0],[17,-7,18,0],[15,5,20,0],[12,3,20,0],[14,1,20,0],[23,12,13,0],[12,2,20,0],[16,-3,22,0],[15,-2,20,-6],[12,5,20,0],[16,-4,18,0],[20,11,18,0],[11,2,20,0],[17,8,20,0],[15,5,10,0],[12,4,18,0],[16,-3,22,0],[15,-5,20,7],[11,6,20,0]],Cse=7.5;function jse(e,t){const a=tx(e[0]),o=tx(e[1]),i=Math.atan2(o[1]-a[1],o[0]-a[0]);let s=0;for(const c of e){let d=1/0,p=-1/0;for(const h of c)h[1]<d&&(d=h[1]),h[1]>p&&(p=h[1]);s=Math.max(s,(p-d)/2)}const r=s+t[2];return{x:(a[0]+o[0])/2-Math.sin(i)*r,y:(a[1]+o[1])/2+Math.cos(i)*r,angle:i+t[3]*Math.PI/180}}const{id:lEe,...Nse}=nS.cursor,Ase=Nse,Mse=["#9FE6B5","#3FAE6E","#1C7A4C"],Ise=`-15 -15 ${$u+30} ${$u+30}`,hb=114.2705,gb=105,Pse={sleeping:{pulse:[.028,4600],tilt:2},waking:{enter:[.92,700],pulse:[.03,2200]},idle:{pulse:[.014,3600]},listening:{bob:[2,2600],pulse:[.012,2600]},thinking:{sway:[1.6,3e3],pulse:[.01,3e3]},searching:{bob:[3,1400],sway:[2.2,1400]},working:{bob:[2.5,900],squash:.22},excited:{bob:[9,520],sway:[3,1040],squash:.35},surprised:{enter:[1.14,340],jitter:[.8,120]},suspicious:{sway:[2.4,2600],tilt:-3},angry:{jitter:[1.3,95],tilt:2},drowsy:{pulse:[.026,5e3],tilt:3},happy:{bob:[5,820],squash:.28},curious:{sway:[3.4,1900],tilt:-4},confused:{sway:[3,2200]},bored:{pulse:[.016,5200],tilt:2},proud:{bob:[1.6,2400],pulse:[.02,2400]},shy:{pulse:[.016,3e3],tilt:4},sad:{pulse:[.02,4600],tilt:3},laughing:{bob:[7,430],squash:.4},scared:{jitter:[2.2,75]},playful:{bob:[6,620],sway:[5,1240],squash:.3},celebrate:{bob:[10,480],sway:[4,960],squash:.35},orbit:{circle:[6,3200]},radar:{sway:[6,2400],pulse:[.012,2400]},progress:{pulse:[.022,1600]},spawning:{enter:[.02,820],pulse:[.014,3600]},humming:{pulse:[.016,2800]},loading:{sway:[2.2,1500],pulse:[.012,1500]},dictating:{bob:[2,2e3]},writing:{bob:[1.6,1100]},sending:{bob:[3,900]},receiving:{bob:[3,900]},uploading:{bob:[3,1e3]},notifying:{bob:[4,700],sway:[2.5,700]},alerting:{jitter:[2.6,85]},dragging:{tilt:-6,sway:[2,900]},bouncing:{bob:[12,560],squash:.45},"powering-down":{settle:.05,tilt:4}},Tse=1400,Q2=Math.PI*2,dh=e=>{const t=Math.sin(e*127.1+311.7)*43758.5453;return t-Math.floor(t)},E7=["#F472B6","#C084FC","#818CF8","#38BDF8","#34D399","#FACC15","#FB7185"],R7=["#4ADE80","#34D399","#22D3EE","#60A5FA"],D7='<path fill="{{GRADIENT}}" d="M99 58 Q99 43 114.3 43 Q129.6 43 129.6 58 L123 150 Q122 161 114.3 161 Q106.6 161 105.6 150 Z"/><circle fill="{{GRADIENT}}" cx="114.3" cy="188" r="15"/>',Bse='<path fill="none" stroke="{{GRADIENT}}" stroke-width="19" stroke-linecap="round" d="M88 76 A27 27 0 1 1 114.3 112 L114.3 132"/><circle fill="{{GRADIENT}}" cx="114.3" cy="170" r="13"/>',Ese={celebrate:{confetti:{count:16,period:1500,life:1300,origin:74,spread:54}},excited:{confetti:{count:9,period:2e3,life:1100,origin:72,spread:44}},laughing:{confetti:{count:7,period:2400,life:1e3,origin:70,spread:38}},orbit:{trails:{count:3,period:2600,radius:128}},radar:{trails:{count:2,period:2e3,radius:132}},progress:{trails:{count:3,period:1800,radius:124}},loading:{trails:{count:2,period:2200,radius:126}},uploading:{trails:{count:2,period:1700,radius:122}},sending:{trails:{count:2,period:1500,radius:120}},receiving:{trails:{count:2,period:1500,radius:120}},alerting:{glyph:{markup:D7,period:2600,hold:1100}},notifying:{glyph:{markup:D7,period:4200,hold:900}},confused:{glyph:{markup:Bse,period:5200,hold:1200}}},Rse="http://www.w3.org/2000/svg";function CD(e,t){for(;e.childNodes.length>t;)e.removeChild(e.lastChild);for(;e.childNodes.length<t;){const a=document.createElementNS(Rse,"path");a.setAttribute("stroke-linecap","round"),a.setAttribute("fill","none"),e.appendChild(a)}return Array.from(e.querySelectorAll(":scope > path"))}function Dse(e,t,a,o,i,s){const r=CD(e,t.count);for(let c=0;c<t.count;c++){const d=r[c],p=dh(c+1),h=dh(c+41),g=dh(c+91),b=(a+g*t.period)%t.period/t.life*1;if(b>1){d.setAttribute("opacity","0");continue}const x=p*Q2,v=t.spread*(.45+h*.55)*(1-(1-b)*(1-b)),k=(t.origin+v)*o,S=34*o*b*b,N=i+Math.cos(x)*k,C=s+Math.sin(x)*k+S,j=11+h*12,M=x+(g-.5)*5*b,D=N+Math.cos(M)*j,A=C+Math.sin(M)*j,R=(p-.5)*j*.7,P=(N+D)/2-Math.sin(M)*R,O=(C+A)/2+Math.cos(M)*R;d.setAttribute("d",`M${N.toFixed(1)} ${C.toFixed(1)} Q${P.toFixed(1)} ${O.toFixed(1)} ${D.toFixed(1)} ${A.toFixed(1)}`),d.setAttribute("stroke",E7[c%E7.length]),d.setAttribute("stroke-width",(4+h*2.4).toFixed(1)),d.setAttribute("opacity",(b<.12?b/.12:1-(b-.12)/.88).toFixed(3))}}function Ose(e,t,a,o,i,s){const r=CD(e,t.count),c=12;for(let d=0;d<t.count;d++){const p=r[d],h=dh(d+3),g=dh(d+29),b=d%2===0?1:-1,x=t.period*(.8+h*.5),v=t.radius*o*(.78+g*.4),k=b*(a/x)*Q2+h*Q2,S=.85+g*.7;let N="";for(let C=0;C<=c;C++){const j=C/c,M=k+S*j,D=v*(1+Math.sin(j*Math.PI)*.14),A=i+Math.cos(M)*D,R=s+Math.sin(M)*D*.78;N+=(C===0?"M":"L")+A.toFixed(1)+" "+R.toFixed(1)}p.setAttribute("d",N),p.setAttribute("stroke",R7[d%R7.length]),p.setAttribute("stroke-width",(5+h*3).toFixed(1)),p.setAttribute("opacity","0.85")}}function zse(e,t){const a=t%e.period,o=e.period-e.hold;if(a<o)return 0;const i=a-o,s=e.hold-i;return Math.max(0,Math.min(1,Math.min(i,s)/200))}function Lse(e){const t=Ese[e.state],a=$u/2,o=e.strength;if(e.trails&&(t?.trails&&e.showEffects&&o>0?Ose(e.trails,t.trails,e.elapsed,o,a,a):e.trails.childNodes.length&&e.trails.replaceChildren()),e.confetti&&(t?.confetti&&e.showEffects&&o>0?Dse(e.confetti,t.confetti,e.elapsed,o,a,a):e.confetti.childNodes.length&&e.confetti.replaceChildren()),e.glyph&&e.bodyContent)if(t?.glyph&&e.showGlyphs){const i=zse(t.glyph,e.elapsed),s=t.glyph.markup.replace(/\{\{GRADIENT\}\}/g,e.paint);e.glyph.getAttribute("data-glyph")!==s&&(e.glyph.setAttribute("data-glyph",s),e.glyph.innerHTML=s),e.glyph.style.opacity=String(i);const r=.72+.28*i;e.glyph.setAttribute("transform",`translate(${a} ${a}) scale(${r.toFixed(3)}) translate(${-a} ${-a})`),e.bodyContent.style.opacity=String(1-i)}else e.glyph.getAttribute("data-glyph")&&(e.glyph.removeAttribute("data-glyph"),e.glyph.replaceChildren()),e.glyph.style.opacity="0",e.bodyContent.style.opacity="1"}const nx={sleeping:[22,13,4],waking:[13],idle:[6,0,8],listening:[1,10,19],thinking:[17,8,16,14,5],searching:[20,15,9,3,12,18],working:[10,7,16,11],excited:[2,17,21,3,11],surprised:[21,3],suspicious:[5,14,23],angry:[7,16],drowsy:[22,4,13],happy:[19,2,11,17],curious:[21,3,0,15],confused:[8,14,5],bored:[0,4,22],proud:[2,15,8],shy:[24,0,13],sad:[22,4,13],laughing:[2,11,17],scared:[21,3],playful:[2,17,11,8],celebrate:[2,8,17],orbit:[6,0,8],radar:[6,0,8],progress:[6,0,8],spawning:[3,0],humming:[6,0,8],loading:[6,0,8],dictating:[1,10,19],sending:[6,0,8],receiving:[19,0,8],uploading:[15,9,8],writing:[15,9],notifying:[21,3,0],alerting:[21,3],bouncing:[2,17],dragging:[3,15,0],"powering-down":[22,13]},Fse={sleeping:[6e3,1e4],waking:[800,800],idle:[9e3,16e3],listening:[2800,5e3],thinking:[2e3,3600],searching:[1e3,1800],working:[1800,3200],excited:[1100,2e3],surprised:[2500,4e3],suspicious:[2600,4500],angry:[2200,3800],drowsy:[4e3,8e3],happy:[2500,4500],curious:[1800,3200],confused:[2200,3800],bored:[3500,6e3],proud:[3500,6e3],shy:[3e3,5500],sad:[4e3,7e3],laughing:[1200,2400],scared:[900,1800],playful:[1500,3e3],celebrate:[1400,2600],orbit:[4e3,8e3],radar:[4e3,8e3],progress:[4e3,8e3],spawning:[1200,1200],humming:[5e3,9e3],loading:[6e3,1e4],dictating:[4e3,8e3],sending:[4e3,8e3],receiving:[4e3,8e3],uploading:[4e3,8e3],writing:[4e3,8e3],notifying:[1500,2600],alerting:[2e3,3600],bouncing:[3e3,6e3],dragging:[1600,3e3],"powering-down":[6e3,9e3]},_se={sleeping:null,waking:null,idle:[6e3,14e3],listening:[3e3,7e3],thinking:[3500,7e3],searching:[1600,4e3],working:[2800,5500],excited:[2e3,4e3],surprised:[1800,3500],suspicious:[4500,8e3],angry:[3500,7e3],drowsy:null,happy:[2500,5e3],curious:[2500,5500],confused:[2800,5500],bored:[4e3,8e3],proud:[3500,7e3],shy:[3e3,6e3],sad:[4e3,8e3],laughing:[2500,5e3],scared:[1200,3e3],playful:[2e3,4500],celebrate:[2200,4500],orbit:null,radar:null,progress:null,spawning:null,humming:[4e3,8e3],loading:null,dictating:null,sending:null,receiving:null,uploading:null,writing:null,notifying:[2e3,4e3],alerting:null,bouncing:null,dragging:[2200,4500],"powering-down":null},qse=e=>e in nx,Use=Object.keys(nx).filter(qse),ys=(e,t,a)=>Math.max(t,Math.min(a,e)),O7=()=>null,Vse=e=>"M"+e.map(t=>t[0].toFixed(2)+" "+t[1].toFixed(2)).join("L")+"Z",Hse=e=>e.map(t=>t.map(a=>[a[0],a[1]])),Gse=e=>{let t=0,a=0;for(const o of e)t+=o[0],a+=o[1];return[t/e.length,a/e.length]};function $se(e,t){const a=Math.cos(e.angle),o=Math.sin(e.angle),i=(d,p)=>[e.x+d*a-p*o,e.y+d*o+p*a],s=i(-t[0],0),r=i(0,t[1]),c=i(t[0],0);return"M"+s[0].toFixed(2)+" "+s[1].toFixed(2)+" Q"+r[0].toFixed(2)+" "+r[1].toFixed(2)+" "+c[0].toFixed(2)+" "+c[1].toFixed(2)}const Kse=e=>`translate(${e.x} ${e.y}) scale(${e.scale}) translate(-120 ${-122.5})`,Wse=e=>{const a=e-1;return 1+(1.7+1)*a*a*a+1.7*a*a},Jse=e=>e<.5?2*e*e:1-2*(1-e)*(1-e);function Yse(e,t,a){if(a<=0)return"";const o=$u/2,i=$u,s=(x,v=0)=>Math.sin(t/x*Math.PI*2+v);let r=0,c=0,d=e.tilt?e.tilt*a:0,p=1,h=1,g=1;if(e.bob){const[x,v]=e.bob,k=s(v);if(c-=x*a*k,e.squash){const S=e.squash*a*Math.max(0,-k);g=1-S*.5,h=1+S*.5}}if(e.circle){const[x,v]=e.circle;r+=x*a*s(v),c+=x*a*s(v,Math.PI/2)}if(e.sway){const[x,v]=e.sway;d+=x*a*s(v)}if(e.pulse){const[x,v]=e.pulse;p*=1+x*a*s(v)}if(e.jitter){const[x,v]=e.jitter;r+=x*a*s(v),c+=x*a*s(v*.63,1.1)}if(e.enter){const[x,v]=e.enter,k=t/v;p*=k>=1?1:x+(1-x)*Wse(Math.max(k,0))}if(e.settle!==void 0){const x=Math.min(Math.max(t/Tse,0),1);p*=1+(e.settle-1)*Jse(x)*a}const b=[];return(r||c)&&b.push(`translate(${r.toFixed(2)} ${c.toFixed(2)})`),d&&b.push(`rotate(${d.toFixed(2)} ${o} ${o})`),p!==1&&b.push(`translate(${o} ${o}) scale(${p.toFixed(4)}) translate(${-o} ${-o})`),(h!==1||g!==1)&&b.push(`translate(${o} ${i}) scale(${h.toFixed(4)} ${g.toFixed(4)}) translate(${-o} ${-i})`),b.join(" ")}const Zse=xa.forwardRef(function({state:t="idle",expression:a,size:o=160,gaze:i,turn:s=0,lookAround:r=.5,flip:c=!1,spring:d=7,eyeScale:p=1,showMouth:h=!0,mouthStroke:g=Cse,motion:b,effects:x=!0,glyphs:v=!0,autoBlink:k=!0,autoExpression:S=!0,paused:N=!1,silhouette:C=Ase,gradient:j=Mse,eyeColor:M="#ffffff",title:D,className:A,style:R},P){const O=f.useId(),T=f.useMemo(()=>"mascot"+O.replace(/[^a-zA-Z0-9]/g,""),[O]),z=f.useRef(null),B=f.useRef(null),L=f.useRef(null),G=f.useRef(null),K=f.useRef(null),H=f.useRef(null),U=f.useRef(null),Q=f.useRef(null),W=f.useMemo(()=>globalThis.window?.matchMedia?.("(prefers-reduced-motion: reduce)").matches??!1,[]),q=b??(W?0:1),Z=t,oe=f.useRef({current:Hse(xy[0]),target:xy[0],currentMouth:Vk[0].slice(),targetMouth:Vk[0],currentGaze:[...ch[0]],targetGaze:[...ch[0]],expression:0,morph:1,velocity:0,blinkStart:O7(),spinStart:O7(),spinDuration:900,last:0,stateStart:0,lastState:Z,lastBodyTransform:"",pausedPaint:"",props:{state:t,expression:a,gaze:i,turn:s,spring:d,eyeScale:p,paused:N,lookAround:r,motionStrength:q,effects:x,glyphs:v}});oe.current.props={state:t,expression:a,gaze:i,turn:s,spring:d,eyeScale:p,paused:N,lookAround:r,motionStrength:q,effects:x,glyphs:v};const _=ne=>{const ae=oe.current,je=(ne%Uk+Uk)%Uk;je===ae.expression&&ae.morph>=1||(ae.current=z7(ae),ae.currentMouth=L7(ae),ae.currentGaze=F7(ae),ae.target=xy[je],ae.targetMouth=Vk[je],ae.targetGaze=ch[je],ae.expression=je,ae.morph=0,ae.velocity=0)};xa.useImperativeHandle(P,()=>({blink:()=>{oe.current.blinkStart=performance.now()},spin:(ne=900)=>{oe.current.spinDuration=ne,oe.current.spinStart=performance.now()},setExpression:_}),[]),f.useEffect(()=>{_(a??nx[t][0])},[t,a]),f.useEffect(()=>{if(!S||a!==void 0||N)return;let ne;const ae=()=>{const[je,xe]=Fse[t];ne=setTimeout(()=>{const re=nx[t],Se=re.filter(Be=>Be!==oe.current.expression);_(Se.length?Se[Math.floor(Math.random()*Se.length)]:re[0]),ae()},je+Math.random()*(xe-je))};return ae(),()=>clearTimeout(ne)},[t,S,a,N]),f.useEffect(()=>{const ne=_se[t];if(!k||!ne||N)return;let ae;const je=()=>{ae=setTimeout(()=>{oe.current.blinkStart=performance.now(),je()},ne[0]+Math.random()*(ne[1]-ne[0]))};return je(),()=>clearTimeout(ae)},[t,k,N]),f.useEffect(()=>{let ne=0,ae;oe.current.last=performance.now();const je=(re,Se,Be)=>{const nt=re.props,ge=F7(re),Qe=nt.lookAround??.35,de=ge[0]*Qe,pe=ge[1]*Qe,ke=z7(re).map(st=>st.map(Ne=>[Ne[0]+de,Ne[1]+pe])),Ge=ys(nt.gaze?.x??0,-1,1)*B7.x,Ee=ys(nt.gaze?.y??0,-1,1)*B7.y,ce=((nt.turn??0)+Be)*Math.PI/180,Ue=nt.eyeScale??1,le=Qse(re,Se);ke.forEach((st,Ne)=>{const Je=Ne===0?z.current:B.current;if(!Je)return;const Me=Gse(st),et=Math.asin(ys((Me[0]-hb)/gb,-1,1)),ft=et+ce,yt=Math.cos(ft),At=Math.max(yt,.02)/Math.max(Math.cos(et),.02);Je.setAttribute("d",Vse(st)),Je.setAttribute("transform",`translate(${(hb+gb*Math.sin(ft)+Ge).toFixed(2)} ${(Me[1]+Ee).toFixed(2)}) scale(${ys(At*Ue,.02,2.4).toFixed(4)} ${ys(le*Ue,.02,2.4).toFixed(4)}) translate(${(-Me[0]).toFixed(2)} ${(-Me[1]).toFixed(2)})`),Je.style.opacity=yt>.02?"1":"0"});const Fe=L.current;if(Fe){const st=L7(re),Ne=jse(ke,st),Je=Math.asin(ys((Ne.x-hb)/gb,-1,1)),Me=Je+ce,et=Math.cos(Me),ft=Math.max(et,.02)/Math.max(Math.cos(Je),.02);Fe.setAttribute("d",$se(Ne,st)),Fe.setAttribute("transform",`translate(${(hb+gb*Math.sin(Me)+Ge).toFixed(2)} ${(Ne.y+Ee).toFixed(2)}) scale(${ys(ft,.02,2.4).toFixed(4)} 1) translate(${(-Ne.x).toFixed(2)} ${(-Ne.y).toFixed(2)})`),Fe.style.opacity=et>.02?"1":"0"}const tt=G.current;if(tt){nt.state!==re.lastState&&(re.lastState=nt.state,re.stateStart=Se);const st=Yse(Pse[nt.state]??{},Se-re.stateStart,nt.motionStrength??1);st!==re.lastBodyTransform&&(re.lastBodyTransform=st,st?tt.setAttribute("transform",st):tt.removeAttribute("transform"))}Lse({trails:H.current,confetti:U.current,glyph:Q.current,bodyContent:K.current,state:nt.state,elapsed:Se-re.stateStart,strength:nt.motionStrength??1,paint:he.current,showEffects:nt.effects!==!1,showGlyphs:nt.glyphs!==!1})},xe=re=>{const Se=oe.current,Be=Se.props;if(Be.paused){Se.last=re;const de=`${Be.state}|${Be.expression??""}|${he.current}`;Se.pausedPaint!==de&&(Se.pausedPaint=de,je(Se,re,0)),ae=setTimeout(()=>{ne=requestAnimationFrame(xe)},250);return}Se.pausedPaint="",ne=requestAnimationFrame(xe);const nt=Math.min((re-Se.last)/1e3,.1);Se.last=re;const ge=Be.spring??7;Se.velocity+=(-2*ge*Se.velocity-ge*ge*(Se.morph-1))*nt,Se.morph+=Se.velocity*nt,Number.isFinite(Se.morph)||(Se.morph=1,Se.velocity=0);let Qe=0;if(Se.spinStart!==null){const de=(re-Se.spinStart)/Se.spinDuration;de>=1?Se.spinStart=null:Qe=360*de}je(Se,re,Qe)};return ne=requestAnimationFrame(xe),()=>{cancelAnimationFrame(ne),ae!==void 0&&clearTimeout(ae)}},[]);const ue=`url(#${T}-grad)`,he=f.useRef(ue);he.current=ue;const we=o.constructor===Number?`${o}px`:o,ee=D===void 0?`${C.name} mascot`:D,Y=C.body.replace(/\{\{GRADIENT\}\}/g,`url(#${T}-grad)`);return n.jsxs("svg",{viewBox:Ise,width:we,height:we,className:A,style:R,role:ee?"img":void 0,"aria-label":ee??void 0,"aria-hidden":ee?void 0:!0,children:[n.jsxs("defs",{children:[n.jsxs("linearGradient",{id:`${T}-grad`,x1:"1",y1:"0",x2:"0",y2:"1",children:[n.jsx("stop",{offset:"0%",stopColor:j[0]}),n.jsx("stop",{offset:"55%",stopColor:j[1]}),n.jsx("stop",{offset:"100%",stopColor:j[2]})]}),n.jsx("clipPath",{id:`${T}-clip`,transform:C.fit||void 0,dangerouslySetInnerHTML:{__html:C.clip}})]}),n.jsxs("g",{transform:c?`translate(${$u} 0) scale(-1 1)`:void 0,children:[n.jsx("g",{ref:H}),n.jsxs("g",{ref:G,children:[n.jsxs("g",{ref:K,children:[n.jsx("g",{transform:C.fit||void 0,dangerouslySetInnerHTML:{__html:Y}}),n.jsx("g",{clipPath:`url(#${T}-clip)`,children:n.jsxs("g",{transform:Kse(C.anchor),children:[n.jsx("path",{ref:z,fill:M}),n.jsx("path",{ref:B,fill:M}),h&&n.jsx("path",{ref:L,fill:"none",stroke:M,strokeWidth:g,strokeLinecap:"round"})]})})]}),n.jsx("g",{ref:Q,style:{opacity:0}})]}),n.jsx("g",{ref:U})]})]})});function z7(e){const t=ys(e.morph,0,1);return e.current.map((a,o)=>a.map((i,s)=>[i[0]+(e.target[o][s][0]-i[0])*t,i[1]+(e.target[o][s][1]-i[1])*t]))}function L7(e){const t=ys(e.morph,0,1);return e.currentMouth.map((a,o)=>a+(e.targetMouth[o]-a)*t)}function F7(e){const t=ys(e.morph,0,1);return e.currentGaze.map((a,o)=>a+(e.targetGaze[o]-a)*t)}function Qse(e,t){if(e.blinkStart===null)return 1;const a=(t-e.blinkStart)/320;return a>=1?(e.blinkStart=null,1):Math.max(a<.42?1-a/.42:(a-.42)/.58,.04)}function Xse(e){return e.kind==="digest"||e.kind==="compaction"||e.kind==="session-divider"}function aS(e){if(e){for(let t=e.length-1;t>=0;t-=1)if(!Xse(e[t]))return e[t]}}const ere=Use,jD=["green","blue","red","orange","purple","cyan","pink","yellow","teal","coral"],nd={green:"#009957",blue:"#377FE6",red:"#D94B52",orange:"#E78531",purple:"#8057C8",cyan:"#0EA5C6",pink:"#D84F8B",yellow:"#D8A729",teal:"#01A492",coral:"#E5634E"},tre={deadpan:"idle",friendly:"happy",focused:"working",thinking:"thinking",excited:"excited",sleepy:"drowsy",surprised:"surprised",skeptical:"suspicious",worried:"scared",mischievous:"playful"},nre=new Set(ere);function Hl(e){return e?nre.has(e)?e:tre[e]??null:null}const are=["idle","happy","curious","drowsy","working","thinking","listening","sleeping","suspicious","proud"];function k0(e){const t=Hl(e.mascotExpression);if(t)return t;const a=aS(e.messages);if(a?.kind==="activity"&&a.tool?.ok===!1)return"alerting";if(e.busy)return"working";if(e.unread)return"notifying";if(a?.kind==="options")return"curious";const o=`${e.name} ${e.title??""} ${e.description??""}`.toLowerCase(),i=s=>s.test(o);return i(/\b(code|coding|developer|development|engineer|engineering|build|debug|program|software)\b/)?"working":i(/\b(research|researcher|search|investigate|strategy|strategist|study|learn|knowledge)\b/)?"searching":i(/\b(marketing|growth|launch|campaign|social|sales|outreach|brand)\b/)?"excited":i(/\b(overnight|night|background|async|queue|batch|long-running)\b/)?"drowsy":i(/\b(monitor|monitoring|incident|alert|watch|status|uptime)\b/)?"radar":i(/\b(review|reviewer|audit|critic|critique|quality|qa|test|legal)\b/)?"suspicious":i(/\b(security|secure|compliance|risk|privacy|finance|financial)\b/)?"scared":i(/\b(design|designer|creative|brainstorm|art|illustration|music|story)\b/)?"playful":i(/\b(support|help|success|onboarding|coach|teacher|guide|welcome)\b/)?"happy":"idle"}const ND=["mascot","circle","rounded","square"],ore=ui(ND),AD=Un().regex(/^\/api\/attachments\/[A-Za-z0-9-]+\.(?:png|jpg|gif|webp)$/,"must be a stored PNG, JPEG, GIF, or WebP attachment"),MD=N4,ire=[MD];function oS(e){const t=e.replaceAll("\\","/").split("/").pop();if(!t)return null;const a=`/api/attachments/${t}`;return AD.safeParse(a).success?a:null}function sre(e){const t={avatarCrop:ore.safeParse(e.avatarCrop).data??"mascot"},a=AD.safeParse(e.avatarUrl);return a.success?t.avatarUrl=a.data:typeof e.avatarUrl=="string"&&ire.includes(e.avatarUrl)&&(t.avatarUrl=e.avatarUrl),t}const uh=[{rotation:-18,color:"rgb(252 184 34)",period:4.6,phase:0},{rotation:46,color:"rgb(5 205 196)",period:5.4,phase:.33},{rotation:108,color:"rgb(247 75 32)",period:5,phase:.66}],fb=50,Hk=19,rre=2.75,bb=60,ID="(prefers-reduced-motion: reduce)";function _7(){try{return globalThis.window?.matchMedia?.(ID).matches??!1}catch{return!1}}function lre(e){const t=globalThis.window?.matchMedia?.(ID);return t?(t.addEventListener?.("change",e),()=>t.removeEventListener?.("change",e)):()=>{}}function PD(){return f.useSyncExternalStore(lre,_7,_7)}function cre(e){return uh.map(({period:t,phase:a})=>-((e/1e3/t+a)%1)*t)}function w0({size:e=100,className:t}){const a=PD(),[o]=f.useState(()=>cre(Date.now())),i=2.5*Math.min(1,e/100),s=6*Math.min(1,100/e);return n.jsxs("svg",{className:V("chibi-mark shrink-0 overflow-visible",t),width:e,height:e,viewBox:"-50 -50 100 100","aria-hidden":"true",focusable:"false","data-chibi-mark":a?"static":"animated",children:[!a&&uh.map((r,c)=>n.jsxs("g",{className:"chibi-mark-orbit",transform:`rotate(${r.rotation})`,children:[n.jsx("ellipse",{rx:fb,ry:Hk,fill:"none",stroke:r.color,strokeOpacity:.3,strokeWidth:i,vectorEffect:"non-scaling-stroke"}),n.jsx("g",{transform:`scale(1 ${Hk/fb})`,children:n.jsx("g",{className:"chibi-mark-spin",style:{animationDuration:`${r.period}s`,animationDelay:`${o[c]}s`},children:n.jsx("g",{transform:`translate(${fb} 0)`,children:n.jsx("g",{className:"chibi-mark-counter",style:{animationDuration:`${r.period}s`,animationDelay:`${o[c]}s`},children:n.jsx("g",{transform:`scale(1 ${fb/Hk})`,children:n.jsx("circle",{r:rre,fill:r.color,style:{filter:`drop-shadow(0 0 ${s}px color-mix(in srgb, ${r.color} 85%, transparent))`}})})})})})})]},r.rotation)),n.jsx("image",{href:N4,x:-bb/2,y:-bb/2,width:bb,height:bb,preserveAspectRatio:"xMidYMid meet"})]})}const dre=new Set(["thinking","working","searching","loading","orbit","radar","progress","humming","receiving","uploading"]),ure=new Set(["writing","sending","dictating"]);function pre(e){return e?dre.has(e)?"thinking":ure.has(e)?"speaking":"idle":"idle"}function mre(){return globalThis.document?.documentElement?.dataset?.reducedMotion==="true"}const hre=24,gre={idle:7,thinking:1.8,speaking:1.2};function fre({provider:e,size:t,label:a,state:o,animated:i=!0}){const s=PD()||mre(),r=pre(o),c=t>=hre,d=c&&i&&!s,p=wR(e),h=c?Math.round(t*.74):t,g=Math.round(h*(p.kind==="official"?.6:.62)),b=r==="thinking"?uh:uh.slice(0,1),x=gre[r];return n.jsxs("span",{role:"img","aria-label":a,"data-subscription-avatar":e,"data-provider-logo-kind":p.kind,"data-activity":r,"data-motion":d?"animated":"static",className:"provider-avatar relative flex shrink-0 items-center justify-center",style:{width:t,height:t},children:[c&&n.jsxs("svg",{className:"provider-ring pointer-events-none absolute inset-0 overflow-visible",width:t,height:t,viewBox:"-50 -50 100 100","aria-hidden":"true",focusable:"false",children:[n.jsx("circle",{className:d&&r==="speaking"?"provider-ring-track provider-ring-breathe":"provider-ring-track",r:46,fill:"none",stroke:"var(--color-accent)",strokeOpacity:r==="idle"?.22:.5,strokeWidth:r==="idle"?1.25:2,vectorEffect:"non-scaling-stroke",style:d&&r==="speaking"?{animationDuration:`${x}s`}:void 0}),b.map((v,k)=>n.jsx("g",{transform:`rotate(${uh[0].rotation+k*120})`,children:n.jsx("g",{className:d?"provider-ring-spin":void 0,style:d?{animationDuration:`${x}s`}:void 0,children:n.jsx("circle",{cx:46,cy:0,r:r==="thinking"?4.2:3.6,fill:v.color,style:{filter:`drop-shadow(0 0 3px color-mix(in srgb, ${v.color} 80%, transparent))`}})})},v.rotation))]}),n.jsx("span",{className:"relative flex items-center justify-center rounded-full border border-hairline/60 bg-raised",style:{width:h,height:h},children:n.jsx(SR,{provider:e,size:g})})]})}const q7={forward:1,authored:.25},bre={arrive:{state:"spawning",spin:900},switch:{state:"waking",spin:620},customize:{state:"proud",blink:!0},alert:{state:"alerting"},thinking:{state:"thinking"},working:{state:"working"},launch:{state:"loading"},success:{state:"happy",blink:!0},celebrate:{state:"celebrate",spin:700},blink:{blink:!0},surprise:{state:"surprised",blink:!0},failure:{state:"sad"}},yre=1400;function U7(e,t,a){const o=Number.parseInt(e.slice(1),16),i=Number.parseInt(t.slice(1),16),s=r=>{const c=o>>r&255,d=i>>r&255;return Math.round(c+(d-c)*a)};return`#${[s(16),s(8),s(0)].map(r=>r.toString(16).padStart(2,"0")).join("")}`}const xre=e=>{const t=nd[e]??nd.green;return[U7(t,"#ffffff",.55),t,U7(t,"#000000",.42)]};function vre({color:e,state:t="idle",expression:a,size:o=44,label:i,motion:s="none",motionKey:r=0,turn:c,gaze:d,spring:p,eyeScale:h,showMouth:g,mouthStroke:b,forward:x=!0,lookAround:v,trackPointer:k=!0,animated:S=!0,bodyId:N},C){const j=nS[wse(N)],M=f.useRef(null);f.useImperativeHandle(C,()=>({blink:()=>M.current?.blink(),spin:B=>M.current?.spin(B),setExpression:B=>M.current?.setExpression(B)}));const[D,A]=f.useState(null);f.useEffect(()=>{if(s==="none"||!S)return;const B=bre[s];if(!B||(B.blink&&M.current?.blink(),B.spin&&M.current?.spin(B.spin),!B.state))return;A(B.state);const L=setTimeout(()=>A(null),yre);return()=>clearTimeout(L)},[s,r,S]);const[R,P]=f.useState({x:0,y:0}),O=x?q7.forward:q7.authored,T=B=>{if(!k||!S)return;const L=B.currentTarget.getBoundingClientRect();P({x:Math.max(-1,Math.min(1,(B.clientX-L.left)/L.width*2-1))*O,y:Math.max(-1,Math.min(1,(B.clientY-L.top)/L.height*2-1))*O})},z=()=>P({x:0,y:0});return n.jsx("span",{className:"inline-flex shrink-0",onPointerMove:k&&S?T:void 0,onPointerLeave:k&&S?z:void 0,children:n.jsx(Zse,{ref:M,state:D??t,expression:a,size:o,silhouette:j,gradient:xre(e),title:i??null,lookAround:v??(x?0:1),gaze:{x:(d?.x??0)+R.x,y:(d?.y??0)+R.y},turn:c,spring:p,eyeScale:h,showMouth:g,mouthStroke:b,paused:!S})})}const ia=f.memo(f.forwardRef(vre));function kre(e){const{avatarCrop:t,hasUrl:a,imageFailed:o}=e;return!a||t==="mascot"||o?"gradientMascot":"flatImage"}function Jt({bot:e,size:t=44,label:a,...o}){const i=sre(e),[s,r]=f.useState(!1);if(f.useEffect(()=>r(!1),[i.avatarUrl]),i.avatarUrl===MD)return n.jsx("span",{role:"img","aria-label":a??e.name??"Chibi",className:"inline-flex shrink-0",children:n.jsx(w0,{size:t})});const c=kre({avatarCrop:i.avatarCrop,hasUrl:!!i.avatarUrl,imageFailed:s});if(c!=="flatImage"&&e.subscription&&!e.mascotBody&&!i.avatarUrl)return n.jsx(fre,{provider:e.subscription.provider,size:t,label:a??e.name??"",state:o.state,animated:o.animated??!0});if(c!=="flatImage")return n.jsx(ia,{bodyId:e.mascotBody??void 0,...o,color:e.color,size:t,label:a??e.name});const d=i.avatarCrop==="circle"?"50%":i.avatarCrop==="rounded"?"22%":"0";return n.jsx("img",{src:i.avatarUrl,alt:a??(e.name?`${e.name} avatar`:"Bot avatar"),width:t,height:t,draggable:!1,onError:()=>r(!0),className:"block shrink-0 bg-raised object-cover",style:{width:t,height:t,borderRadius:d}})}function TD({initials:e,size:t=32}){return n.jsx("div",{className:"flex shrink-0 items-center justify-center rounded-full bg-raised text-ink-secondary font-medium",style:{width:t,height:t,fontSize:t*.38},children:e})}function S0({className:e}){return n.jsxs("span",{"data-personal-badge":!0,title:l("personalBot.badgeHint"),className:V("inline-flex shrink-0 items-center gap-1 rounded-full bg-accent/15 px-1.5 py-px text-[10.5px] font-medium leading-4 text-accent",e),children:[n.jsx(v4,{size:10,"aria-hidden":!0}),l("personalBot.badge")]})}const yb="rounded-2xl border border-hairline/40 bg-card/80 backdrop-blur-xl backdrop-saturate-150";function wre(){const{dispatch:e}=ve(),{view:t}=BR(),a=typeof window<"u"&&window.ogb?.remoteClient?.active===!0;return rte(t,a)?n.jsxs("button",{type:"button","data-create-personal-bot":!0,title:l("personalBot.createHint"),"aria-describedby":"create-private-bot-hint",onClick:()=>e({type:"openBotInterview",launch:{mode:"personal"}}),className:"flex min-h-10 w-full items-center gap-3 rounded-xl px-3 py-2 text-left text-ink hover:bg-raised/50",children:[n.jsx(So,{size:20,className:"text-accent","aria-hidden":!0}),n.jsx("span",{className:"text-[14px]",children:l("personalBot.create")}),n.jsx("span",{id:"create-private-bot-hint",className:"sr-only",children:l("personalBot.createHint")})]}):null}function Sre(e){const t=e.availableAccounts??e.personalAccounts;return t<=0?l("personalBot.accounts.none"):l("personalBot.accounts.count",{count:String(t),subscriptions:String(e.subscriptionAccounts??0),personal:String(e.personalAccounts)})}function Cre(){const{view:e,reload:t}=BR(),{state:a,dispatch:o}=ve(),[i,s]=f.useState(!1),[r,c]=f.useState("");if(!e)return n.jsx(ut,{title:l("personalBot.title"),subtitle:l("personalBot.subtitle"),children:n.jsx("p",{className:"text-[12px] text-ink-secondary",children:l("personalBot.loading")})});const d=e.botId?a.bots.find(x=>x.id===e.botId):void 0,p=async()=>{s(!0),c("");try{await X("/api/personal-bot/settings",{method:"PUT",body:JSON.stringify({useLocalModels:!e.useLocalModels})}),await t()}catch(x){c(x instanceof Error?x.message:String(x))}finally{s(!1)}},h=async()=>{s(!0),c("");try{await X("/api/personal-bot/settings",{method:"PUT",body:JSON.stringify({chibiLink:!e.chibiLink})}),await t()}catch(x){c(x instanceof Error?x.message:String(x))}finally{s(!1)}},g=e.chibiLink&&e.chibiLinkAllowed,b=async()=>{s(!0),c("");try{await X("/api/personal-bot/settings",{method:"PUT",body:JSON.stringify({readWorkMemory:!e.readWorkMemory})}),await t()}catch(x){c(x instanceof Error?x.message:String(x))}finally{s(!1)}};return n.jsxs("div",{className:"flex flex-col gap-4",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-[22px] font-semibold tracking-tight text-ink",children:l("personalBot.title")}),n.jsx("p",{className:"mt-2 max-w-lg text-[13px] leading-relaxed text-ink-secondary",children:l("personalBot.subtitle")})]}),e.allowed?d?n.jsxs("div",{className:V(yb,"flex items-center gap-3 p-4"),children:[n.jsx(Jt,{bot:d,size:44}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"truncate text-[15px] font-medium text-ink",children:d.name}),n.jsx(S0,{})]}),n.jsx("p",{className:"mt-0.5 text-[12.5px] text-ink-secondary",children:l("personalBot.editHint")})]}),n.jsxs("div",{className:"flex shrink-0 flex-col gap-1.5 sm:flex-row",children:[n.jsx("button",{type:"button",onClick:()=>{o({type:"toggleAppSettings",open:!1}),o(sa(d))},className:"rounded-lg bg-accent px-3 py-1.5 text-[13px] font-medium text-white",children:l("personalBot.open")}),n.jsx("button",{type:"button",onClick:()=>{o({type:"toggleAppSettings",open:!1}),o({type:"select",id:d.id}),o({type:"toggleSettings",open:!0,section:"identity"})},className:"rounded-lg bg-control px-3 py-1.5 text-[13px] text-ink hover:bg-raised-hover",children:l("personalBot.edit")})]})]}):n.jsxs("div",{className:V(yb,"flex flex-col items-start gap-2 p-4"),children:[n.jsx("div",{className:"text-[15px] font-medium text-ink",children:l("personalBot.create")}),n.jsx("p",{className:"text-[12.5px] leading-relaxed text-ink-secondary",children:(e.availableAccounts??e.personalAccounts)===0?l("personalBot.form.noAccounts"):l("personalBot.interviewHint")}),n.jsxs("button",{type:"button","data-create-personal-bot-interview":!0,onClick:()=>o({type:"openBotInterview",launch:{mode:"personal"}}),className:"mt-1 flex items-center gap-1.5 rounded-lg bg-accent px-4 py-2 text-[13px] font-medium text-white",children:[n.jsx(So,{size:14,"aria-hidden":!0}),l("personalBot.startInterview")]})]}):n.jsxs("div",{className:V(yb,"p-4"),children:[n.jsxs("div",{className:"flex items-center gap-2 text-[14px] font-medium text-ink",children:[n.jsx(dd,{size:14,"aria-hidden":!0}),l("personalBot.disabled")]}),n.jsx("p",{className:"mt-1 text-[12.5px] leading-relaxed text-ink-secondary",children:l("personalBot.disabledHint")}),n.jsx("div",{className:"mt-2",children:n.jsx(jr,{})})]}),e.allowed&&n.jsxs(ut,{children:[n.jsx(Wt,{title:l("personalBot.local.title"),subtitle:l("personalBot.local.subtitle"),children:n.jsx(Dt,{checked:e.useLocalModels,disabled:i,"aria-label":l("personalBot.local.title"),onClick:()=>{p()}})}),n.jsx(Wt,{title:l("personalBot.workMemory.title"),subtitle:l("personalBot.workMemory.subtitle"),children:n.jsx(Dt,{checked:e.readWorkMemory,disabled:i,"aria-label":l("personalBot.workMemory.title"),onClick:()=>{b()}})}),n.jsx(Wt,{title:l("personalBot.chibiLink.title"),subtitle:l(e.chibiLinkAllowed?"personalBot.chibiLink.subtitle":"personalBot.chibiLink.managed"),children:e.chibiLinkAllowed?n.jsx(Dt,{checked:e.chibiLink,disabled:i,"aria-label":l("personalBot.chibiLink.title"),onClick:()=>{h()}}):n.jsxs("span",{className:"flex items-center gap-2","data-chibi-link-managed":!0,children:[n.jsx(Dt,{checked:!1,disabled:!0,"aria-label":l("personalBot.chibiLink.title")}),n.jsx(jr,{})]})}),n.jsx(Wt,{title:l("personalBot.accounts.title"),subtitle:Sre(e),children:n.jsx("button",{type:"button",onClick:()=>o({type:"toggleAppSettings",open:!0,section:"engines"}),className:"rounded-lg bg-control px-3 py-1.5 text-[13px] text-ink hover:bg-raised-hover",children:l("personalBot.accounts.open")})}),r&&n.jsx("p",{role:"alert",className:"mt-2 text-[12px] text-danger",children:r})]}),n.jsxs("div",{className:V(yb,"p-4"),children:[n.jsx("div",{className:"text-[13px] font-medium text-ink",children:l("personalBot.rules.title")}),n.jsxs("ul",{className:"mt-2 flex list-disc flex-col gap-1 pl-5 text-[12.5px] leading-relaxed text-ink-secondary",children:[n.jsx("li",{children:l("personalBot.rules.private")}),n.jsx("li",{children:l("personalBot.rules.workMemory")}),n.jsx("li",{children:l("personalBot.rules.accounts")}),n.jsx("li",{children:l("personalBot.rules.company")}),n.jsx("li",{children:l("personalBot.rules.connections")}),n.jsx("li",{children:l(g?"personalBot.rules.chibiLink":"personalBot.rules.delegation")}),n.jsx("li",{children:l("personalBot.rules.resting")})]})]})]})}function BD({instanceId:e,owner:t,locked:a,onChanged:o}){const[i,s]=f.useState(!1),[r,c]=f.useState("");if(!t)return null;if(a)return n.jsxs("span",{"data-engine-owner":"company",className:"inline-flex items-center gap-1 rounded-full bg-control px-2 py-0.5 text-[11.5px] font-medium text-ink-secondary",title:l("owner.lockedHint"),children:[n.jsx(dd,{size:11,"aria-hidden":!0}),l("owner.company")]});const d=async p=>{if(!(i||p===t)){s(!0),c("");try{await ER(e,p),await Promise.resolve(o?.()).catch(()=>{})}catch(h){c(h instanceof Error?h.message:String(h))}finally{s(!1)}}};return n.jsxs("span",{className:"inline-flex flex-col items-start gap-1",children:[n.jsx("span",{role:"radiogroup","aria-label":l("owner.label"),title:l("owner.hint"),"data-engine-owner":t,className:"inline-flex rounded-full border border-hairline/40 bg-inset/70 p-0.5 backdrop-blur-xl",children:["company","personal"].map(p=>n.jsx("button",{type:"button",role:"radio","aria-checked":t===p,disabled:i,onClick:()=>{d(p)},className:V("rounded-full px-2.5 py-0.5 text-[11.5px] font-medium transition-colors disabled:opacity-60",t===p?p==="personal"?"bg-accent text-white":"bg-raised text-ink":"text-ink-secondary hover:text-ink"),children:l(p==="company"?"owner.company":"owner.personal")},p))}),r&&n.jsx("span",{role:"alert",className:"text-[11.5px] text-danger",children:l("owner.failed",{error:r})})]})}function ED({instance:e}){const{refreshInstances:t}=ve();return n.jsx(BD,{instanceId:e.instanceId,owner:e.owner,locked:e.ownerLocked,onChanged:t})}const X2="w-full rounded-lg border border-hairline/40 bg-inset px-3 py-2 text-[13px] text-ink placeholder:text-ink-secondary focus:border-hairline focus:outline-none disabled:opacity-50",wu="rounded-lg border border-hairline/40 px-3 py-1.5 text-[12px] text-ink-secondary hover:bg-raised/50 hover:text-ink disabled:cursor-not-allowed disabled:opacity-50";function iS(e,t){return window.ogb?.setInstanceKey?window.ogb.setInstanceKey(e,t):X(`/api/provider-accounts/${encodeURIComponent(e)}/key`,{method:"PUT",body:JSON.stringify({key:t})})}async function RD(e,t,a){const o=e.kind==="apiKey",i=o&&!!window.ogb?.setInstanceKey,s=await X("/api/provider-accounts",{method:"POST",body:JSON.stringify({provider:e.id,displayName:t,...o&&!i?{key:a}:{}})});return i&&await iS(s.instanceId,a),s}function DD(e){return e.ok?l("providerAccounts.testOk"):e.reason==="rejected"?l("providerAccounts.testRejected"):e.reason==="unreachable"?l("providerAccounts.testUnreachable"):l("providerAccounts.testUnexpected")}function jre({provider:e}){return e.icon?n.jsx(wg,{preset:e.icon,size:18}):n.jsx(hd,{driverKind:e.driver,size:18})}function Nre({value:e,onChange:t,disabled:a}){return n.jsxs("fieldset",{className:"flex flex-col gap-1.5",disabled:a,children:[n.jsx("legend",{className:"mb-1 text-[12px] text-ink-secondary",children:l("owner.label")}),n.jsx("div",{role:"radiogroup","aria-label":l("owner.label"),className:"flex w-fit rounded-lg bg-inset p-0.5","data-owner-choice":!0,children:["company","personal"].map(o=>n.jsx("button",{type:"button",role:"radio","aria-checked":e===o,onClick:()=>t(o),"data-owner":o,className:V("rounded-md px-3 py-1 text-[12.5px]",e===o?"bg-raised font-medium text-ink shadow-sm":"text-ink-secondary hover:text-ink"),children:l(o==="company"?"owner.company":"owner.personal")},o))}),n.jsx("p",{className:"text-[11.5px] leading-relaxed text-ink-secondary",children:l(e==="personal"?"owner.addToggleHint":"owner.companyHint")})]})}function OD({provider:e,onDone:t,onCancel:a}){const[o,i]=f.useState(""),[s,r]=f.useState(""),[c,d]=f.useState(null),[p,h]=f.useState(null),[g,b]=f.useState(null),[x,v]=f.useState("company"),k=e.kind==="apiKey",S=async()=>{if(!(!e.keyTest||!s.trim()||c)){d("test"),b(null);try{const C=await X("/api/keys/test",{method:"POST",body:JSON.stringify({provider:e.keyTest.provider,key:s.trim(),...e.keyTest.url?{url:e.keyTest.url}:{}})});b(DD(C))}catch(C){b(C instanceof Error?C.message:String(C))}finally{d(null)}}},N=async()=>{if(!(c||!o.trim()||k&&!s.trim())){d("save"),h(null);try{const C=k&&!!window.ogb?.setInstanceKey,j=await X("/api/provider-accounts",{method:"POST",body:JSON.stringify({provider:e.id,displayName:o.trim(),owner:x,...k&&!C?{key:s.trim()}:{}})});C&&await iS(j.instanceId,s.trim()),await t()}catch(C){h(C instanceof Error?C.message:String(C))}finally{d(null)}}};return n.jsxs("form",{className:"mt-3 flex flex-col gap-2 rounded-xl border border-hairline/40 p-3",onSubmit:C=>{C.preventDefault(),N()},children:[n.jsxs("label",{className:"flex flex-col gap-1 text-[12px] text-ink-secondary",children:[l("providerAccounts.name"),n.jsx("input",{value:o,onChange:C=>i(C.target.value),maxLength:80,required:!0,disabled:c!==null,placeholder:l("providerAccounts.namePlaceholder"),className:X2})]}),k&&n.jsxs("label",{className:"flex flex-col gap-1 text-[12px] text-ink-secondary",children:[l("providerAccounts.key"),n.jsx("input",{type:"password",value:s,onChange:C=>{r(C.target.value),b(null)},autoComplete:"off",disabled:c!==null,placeholder:l("providerAccounts.keyPlaceholder"),className:X2})]}),k&&e.keyUrl&&n.jsx("a",{href:e.keyUrl,target:"_blank",rel:"noopener noreferrer",className:"w-fit text-[12px] text-accent hover:underline",children:l("providerAccounts.getKey",{provider:e.label})}),!k&&n.jsx("p",{className:"text-[12px] leading-relaxed text-ink-secondary",children:l("providerAccounts.signInHint")}),n.jsx(Nre,{value:x,onChange:v,disabled:c!==null}),g&&n.jsx("p",{role:"status",className:"text-[12px] text-ink-secondary",children:g}),p&&n.jsx("p",{role:"alert",className:"text-[12px] text-danger",children:p}),n.jsxs("div",{className:"flex justify-end gap-2",children:[n.jsx("button",{type:"button",onClick:a,disabled:c!==null,className:"rounded-lg px-3 py-1.5 text-[12px] text-ink-secondary hover:bg-raised/50 disabled:opacity-50",children:l("common.cancel")}),k&&e.keyTest&&n.jsx("button",{type:"button",onClick:()=>{S()},disabled:c!==null||!s.trim(),className:wu,children:l(c==="test"?"keys.testing":"keys.test")}),n.jsxs("button",{type:"submit",disabled:c!==null||!o.trim()||k&&!s.trim(),className:"flex items-center gap-1.5 rounded-lg bg-raised px-3 py-1.5 text-[12px] text-ink hover:bg-raised-hover disabled:opacity-50",children:[c==="save"&&n.jsx(Ie,{size:13,className:"animate-spin"}),l("providerAccounts.add")]})]})]})}function zD({provider:e,account:t,onChanged:a}){const{state:o}=ve(),[i,s]=f.useState(null),[r,c]=f.useState(""),[d,p]=f.useState(!1),[h,g]=f.useState(!1),[b,x]=f.useState(null),[v,k]=f.useState(null),[S,N]=f.useState(!1),C=o.instances.find(z=>z.instanceId===t.instanceId),j=e.kind==="signIn"&&C!==void 0&&(C.snapshot.state!=="available"||C.authentication!==void 0||C.claudeAccount!==void 0||!t.signInCommand),M=o.bots.filter(z=>z.modelSelection.instanceId===t.instanceId).length,D=e.kind==="apiKey"?t.keyConfigured?l("providerAccounts.keySaved"):l("providerAccounts.noKey"):t.signedIn===!0?l("providerAccounts.signedIn"):t.signedIn===!1?l("providerAccounts.notSignedIn"):t.available===!1?l("onboarding.engines.needsSetup"):l("providerAccounts.statusUnknown"),A=e.kind==="apiKey"?t.keyConfigured===!0:t.signedIn===!0,R=async z=>{if(!d){p(!0),x(null);try{await z(),s(null),c(""),await a()}catch(B){x(B instanceof Error?B.message:String(B))}finally{p(!1)}}},P=()=>{const z=r.trim();z&&(i==="rename"?R(()=>X(`/api/provider-accounts/${encodeURIComponent(t.instanceId)}`,{method:"PATCH",body:JSON.stringify({displayName:z})})):i==="key"&&R(()=>iS(t.instanceId,z)))},O=async()=>{if(!d){p(!0),k(null);try{const z=await X(`/api/provider-accounts/${encodeURIComponent(t.instanceId)}/test`,{method:"POST",body:"{}"});k(DD(z))}catch(z){k(z instanceof Error?z.message:String(z))}finally{p(!1)}}},T=()=>{g(!1),R(async()=>{await X(`/api/provider-accounts/${encodeURIComponent(t.instanceId)}`,{method:"DELETE"}),e.kind==="apiKey"&&window.ogb?.setInstanceKey&&await window.ogb.setInstanceKey(t.instanceId,"")})};return n.jsxs("li",{className:"border-t border-hairline/30 py-2.5 first:border-t-0",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1.5 text-[13px]",children:[n.jsx("span",{className:"min-w-0 break-words font-medium text-ink",children:t.displayName}),n.jsx("span",{className:V("text-[12px]",A?"text-success":"text-ink-secondary"),children:D}),n.jsx(BD,{instanceId:t.instanceId,owner:t.owner,locked:t.ownerLocked,onChanged:a}),n.jsx("span",{className:"flex-1"}),n.jsx("button",{type:"button",disabled:d,onClick:()=>{s(i==="rename"?null:"rename"),c(t.displayName)},className:wu,children:l("providerAccounts.rename")}),e.kind==="apiKey"&&n.jsx("button",{type:"button",disabled:d,onClick:()=>{s(i==="key"?null:"key"),c("")},className:wu,children:t.keyConfigured?l("providerAccounts.replaceKey"):l("providerAccounts.addKey")}),e.kind==="apiKey"&&e.keyTest&&t.keyConfigured&&n.jsx("button",{type:"button",disabled:d,onClick:()=>{O()},className:wu,children:l("keys.test")}),t.removable&&n.jsx("button",{type:"button",disabled:d||M>0,onClick:()=>g(!0),className:V(wu,"text-danger hover:text-danger"),children:l("providerAccounts.remove")})]}),t.removable&&M>0&&n.jsx("p",{className:"mt-1 text-[11.5px] text-ink-secondary",children:l("providerAccounts.assigned",{count:String(M)})}),i&&n.jsxs("form",{className:"mt-2 flex gap-2",onSubmit:z=>{z.preventDefault(),P()},children:[n.jsx("input",{type:i==="key"?"password":"text",value:r,onChange:z=>c(z.target.value),autoComplete:"off",maxLength:i==="rename"?80:4096,"aria-label":l(i==="rename"?"providerAccounts.name":"providerAccounts.key"),placeholder:i==="key"?l("providerAccounts.keyPlaceholder"):void 0,disabled:d,className:X2}),n.jsx("button",{type:"submit",disabled:d||!r.trim(),className:"flex w-[72px] shrink-0 items-center justify-center rounded-lg bg-control py-2 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-50",children:d?n.jsx(Ie,{size:13,className:"animate-spin"}):l("common.save")})]}),t.signedIn!==!0&&j&&C&&(S?n.jsx("div",{className:"mt-2","data-account-sign-in":t.instanceId,children:n.jsx(Pr,{instance:C,unframed:!0})}):n.jsx("button",{type:"button",onClick:()=>N(!0),className:"mt-2 rounded-lg bg-accent px-3 py-1.5 text-[12.5px] font-medium text-white hover:opacity-90","data-account-sign-in-button":t.instanceId,children:l("subscriptions.signIn")})),e.kind==="signIn"&&t.signedIn!==!0&&!j&&t.signInCommand&&n.jsxs("div",{className:"mt-2 space-y-1.5",children:[n.jsx("p",{className:"text-[12px] leading-relaxed text-ink-secondary",children:l("providerAccounts.signInSteps")}),n.jsx(Pc,{command:t.signInCommand,copyLabel:l("engineSetup.copyCommand")})]}),v&&n.jsx("p",{role:"status",className:"mt-1 text-[12px] text-ink-secondary",children:v}),b&&n.jsx("p",{role:"alert",className:"mt-1 text-[12px] text-danger",children:b}),n.jsx(Oa,{open:h,title:l("providerAccounts.removeTitle",{name:t.displayName}),body:e.kind==="apiKey"?l("providerAccounts.removeKeyHint"):l("providerAccounts.removeSignInHint"),confirmLabel:l("providerAccounts.remove"),tone:"neutral",onCancel:()=>g(!1),onConfirm:T})]})}function Are({provider:e,onChanged:t}){const[a,o]=f.useState(!1),i=e.kind==="apiKey"?LR(e.id):void 0;return n.jsxs("div",{className:"rounded-2xl border border-hairline/50 bg-card px-4 py-3 sm:px-5",children:[n.jsxs("div",{className:"flex items-center gap-2.5",children:[n.jsx("span",{className:"flex size-7 shrink-0 items-center justify-center rounded-lg bg-control",children:n.jsx(jre,{provider:e})}),n.jsx("span",{className:"min-w-0 flex-1 text-[14px] font-medium text-ink",children:e.label}),e.signupUrl&&n.jsx("a",{href:e.signupUrl,target:"_blank",rel:"noopener noreferrer",className:"shrink-0 text-[12px] text-accent hover:underline",children:l(e.kind==="signIn"?"providerAccounts.getSubscription":"providerAccounts.getPlan")}),e.kind==="apiKey"&&e.keyUrl&&n.jsx("a",{href:e.keyUrl,target:"_blank",rel:"noopener noreferrer",className:"shrink-0 text-[12px] text-accent hover:underline",children:l(e.billing==="subscription"?"providerAccounts.getPlanKey":"providerAccounts.getApiKey")}),!a&&n.jsxs("button",{type:"button",onClick:()=>o(!0),className:V(wu,"flex items-center gap-1.5"),children:[n.jsx(vn,{size:13}),l("providerAccounts.add")]})]}),n.jsxs("p",{className:"mt-1.5 text-[12px] leading-relaxed text-ink-secondary",children:[OR(e.billing,e.kind),e.billing==="subscription"&&W2(e.id)?` · ${W2(e.id)}`:""]}),(i||e.accounts.length>0)&&n.jsxs("ul",{className:"mt-2",children:[i&&n.jsx("li",{className:"py-2.5","data-main-key":i.section,children:n.jsx(Sg,{section:i.section,testProvider:i.test,mainKey:!0})}),e.accounts.map(s=>n.jsx(zD,{provider:e,account:s,onChanged:t},s.instanceId))]}),a&&n.jsx(OD,{provider:e,onCancel:()=>o(!1),onDone:async()=>{o(!1),await t()}})]})}function Mre({providers:e,billing:t,onChanged:a}){return n.jsx(n.Fragment,{children:e.filter(o=>o.billing===t&&o.id!=="claude").map(o=>n.jsx(Are,{provider:o,onChanged:a},o.id))})}function Ire({billing:e}){const{refreshInstances:t}=ve(),[a,o]=f.useState(null),[i,s]=f.useState(null),r=f.useCallback(async()=>{try{const d=await X("/api/provider-accounts");o(d.providers),s(null)}catch(d){s(d instanceof Error?d.message:String(d))}},[]);f.useEffect(()=>{r()},[r]);const c=f.useCallback(async()=>{await Promise.all([r(),Promise.resolve(t()).catch(()=>{})])},[r,t]);return n.jsxs("section",{className:"flex flex-col gap-3","aria-labelledby":`provider-accounts-${e}`,children:[n.jsxs("div",{children:[n.jsx("h2",{id:`provider-accounts-${e}`,className:"text-[16px] font-semibold text-ink",children:l(e==="subscription"?"providerAccounts.subscriptionTitle":"providerAccounts.payPerUseTitle")}),n.jsx("p",{className:"mt-1 max-w-lg text-[12.5px] leading-relaxed text-ink-secondary",children:l(e==="subscription"?"providerAccounts.subscriptionIntro":"providerAccounts.payPerUseIntro")})]}),i&&n.jsx("p",{role:"alert",className:"text-[12px] text-danger",children:i}),a===null&&!i&&n.jsx(Ie,{size:14,className:"animate-spin text-ink-secondary"}),a&&n.jsx(Mre,{providers:a,billing:e,onChanged:c})]})}const fr="w-full rounded-lg border border-hairline/40 bg-inset px-3 py-2.5 text-[15px] text-ink placeholder:text-ink-secondary focus:border-hairline focus:outline-none";function Ua(e){return{"--i":e}}function Ku({children:e,className:t,...a}){return n.jsx("button",{"data-primary":"",...a,className:V("w-full shrink-0 rounded-lg bg-accent py-2.5 text-[15px] font-medium text-white transition-[transform,opacity] duration-150 active:scale-[0.98] disabled:opacity-40",t),children:e})}function Wh({children:e,className:t,...a}){return n.jsx("button",{...a,className:V("text-[12px] text-ink-secondary transition-colors hover:text-ink",t),children:e})}const Pre={claude:"claudeAgent",chatgpt:"codex",gemini:"antigravityAgent",grok:"grokAgent",cursor:"cursorAgent",museCode:"museCode",ollama:"ollamaCloud",kimi:"kimiAgent",qwen:"qwenAgent",opencodeGo:"opencodeGo"};function ad(e,t){return t&&e3.includes(e)?l(`setup.plan.${e}.chibitekName`):l(`setup.plan.${e}.name`)}const e3=$y;function Tre(e){const t=Pre[e];return t?n.jsx(hd,{driverKind:t,size:26}):e==="apiKey"?n.jsx(Eh,{size:24,className:"text-ink-secondary","aria-hidden":"true"}):n.jsx(yg,{size:24,className:"text-ink-secondary","aria-hidden":"true"})}function Bre({picks:e,chibitek:t,onToggle:a}){const o=MX(e,t);return n.jsxs("div",{className:"flex flex-col",children:[n.jsx("p",{className:"text-[14px] leading-relaxed text-ink-secondary",children:l("setup.plans.intro")}),n.jsx("p",{className:"mt-1.5 text-[12.5px] leading-relaxed text-ink-secondary",children:l("setup.plans.billing")}),t?n.jsxs(n.Fragment,{children:[n.jsx("h2",{className:"mt-4 text-[12px] font-semibold uppercase tracking-wide text-ink-secondary",children:l("setup.plans.chibitekTitle")}),n.jsx(Gk,{plans:e3,picks:e,chibitek:!0,onToggle:a,label:l("setup.plans.chibitekTitle")}),n.jsx("p",{className:"mt-2 text-[12.5px] leading-relaxed text-ink-secondary",children:l("setup.plans.chibitekNotSure",{email:_c})}),n.jsx("h2",{className:"mt-5 text-[12px] font-semibold uppercase tracking-wide text-ink-secondary",children:l("setup.plans.otherTitle")}),n.jsx(Gk,{plans:q2.filter(i=>!e3.includes(i)),picks:e,onToggle:a,label:l("setup.plans.otherTitle")})]}):n.jsx(Gk,{plans:q2,picks:e,onToggle:a,label:l("setup.plans.groupLabel")}),n.jsxs("div",{className:"mt-4 rounded-xl border border-hairline/40 bg-card px-3.5 py-3","aria-live":"polite",children:[n.jsx("div",{className:"text-[11.5px] font-semibold uppercase tracking-wide text-ink-secondary",children:l("setup.plans.recommendedTitle")}),n.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink",children:o.kind==="askErick"?l("setup.plans.askErick",{email:_c}):o.kind==="plan"&&o.plan==="gemini"?l("setup.plans.mainGemini"):o.kind==="startLocal"?l("setup.plans.startLocal"):o.localBackup?l("setup.plans.mainWithBackup",{plan:ad(o.plan,t)}):l("setup.plans.main",{plan:ad(o.plan,t)})})]}),n.jsxs($i,{children:[n.jsx("p",{children:l("setup.plans.what1")}),n.jsx("p",{children:l("setup.plans.what2")})]})]})}function Gk({plans:e,picks:t,chibitek:a=!1,onToggle:o,label:i}){return n.jsx("div",{role:"group","aria-label":i,className:"mt-2 grid grid-cols-2 gap-2 sm:grid-cols-3",children:e.map(s=>{const r=t.includes(s);return n.jsxs("button",{type:"button",role:"checkbox","aria-checked":r,"aria-label":ad(s,a),"aria-describedby":`plan-detail-${s}`,"data-plan":s,onClick:()=>o(s),className:V("relative flex min-h-[92px] flex-col items-start gap-2 rounded-xl border p-3 text-left transition-[border-color,background-color,transform] active:scale-[0.98]",r?"border-accent bg-accent/10":"border-hairline/50 bg-card hover:bg-raised/40"),children:[n.jsx("span",{className:"flex size-9 items-center justify-center rounded-lg bg-inset",children:Tre(s)}),n.jsx("span",{className:"text-[13px] font-semibold leading-tight text-ink",children:ad(s,a)}),n.jsx("span",{id:`plan-detail-${s}`,className:"text-[11.5px] leading-snug text-ink-secondary",children:l(a?`setup.plan.${s}.chibitekDetail`:`setup.plan.${s}.detail`)}),r&&n.jsx("span",{className:"absolute right-2 top-2 flex size-5 items-center justify-center rounded-full bg-accent text-white","aria-hidden":"true",children:n.jsx(gt,{size:12,strokeWidth:3})})]},s)})})}function sS(e,t){const a=e.filter(o=>o.driverKind===t&&!o.managed&&!o.readOnly);return a.find(o=>!o.providerAccount)??a[0]}function Ere(e){return e.loaded?e.instance?e.job?.kind==="engine-install"&&e.job.state==="running"?"installing":e.instance.snapshot.state!=="available"?e.job?.kind==="engine-install"&&e.job.state==="failed"?"installFailed":"notInstalled":e.instance.access!=="custom"&&e.instance.snapshot.authenticated===!1?"needsSignIn":e.test==="passed"?"tested":e.test==="failed"?"testFailed":"testing":e.checkFailed?"checkFailed":"unavailable":"checking"}const Rre={downloading:"setup.connect.phase.downloading",installing:"setup.connect.phase.installing",checking:"setup.connect.phase.checking"};function Dre({name:e,phase:t,job:a,terminalCommand:o,onInstall:i,onRetryTest:s,onRecheck:r,signIn:c,testDetail:d,startError:p,windows:h=!1,notOnWindows:g=!1}){return n.jsxs("div",{className:"mt-4 rounded-xl border border-hairline/40 bg-card p-3.5","data-phase":t,children:[t==="checking"&&n.jsxs("p",{role:"status",className:"flex items-center gap-2 text-[13px] text-ink-secondary",children:[n.jsx(Ie,{size:14,className:"animate-spin","aria-hidden":"true"}),l("setup.connect.checking",{name:e})]}),t==="checkFailed"&&n.jsx(ho,{message:l("setup.connect.checkFailed",{name:e}),onRetry:r}),t==="unavailable"&&n.jsx("p",{className:"text-[13px] leading-relaxed text-ink-secondary",children:l("setup.connect.unavailable",{name:e})}),t==="notInstalled"&&g&&n.jsx("p",{className:"text-[13px] leading-relaxed text-ink-secondary",children:l("setup.connect.notOnWindows",{name:e})}),t==="notInstalled"&&!g&&n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"text-[13px] leading-relaxed text-ink",children:l(h?"setup.connect.installIntroWindows":"setup.connect.installIntro",{name:e})}),n.jsxs("button",{type:"button",onClick:i,className:V(Ha,"mt-3 w-full"),children:[n.jsx(pa,{size:14,"aria-hidden":"true"}),l("setup.connect.install",{name:e})]}),p&&n.jsx(ho,{message:l("setup.error.failed"),detail:p,onRetry:i})]}),t==="installing"&&n.jsxs(n.Fragment,{children:[n.jsx(Oi,{label:l(Rre[a?.phase??""]??"setup.connect.phase.installing",{name:e}),received:a?.phase==="downloading"?a.received:void 0,total:a?.phase==="downloading"?a.total:void 0}),n.jsx(md,{detail:a?.detail})]}),t==="installFailed"&&n.jsxs(n.Fragment,{children:[n.jsx(ho,{message:h&&a?.reason==="no-installer"?l("setup.error.noInstallerWindows"):Ml(a),detail:a?.detail,onRetry:i}),o&&n.jsxs("details",{className:"mt-3 rounded-lg border border-hairline/40 bg-app px-2.5 py-2 text-[12px] text-ink-secondary",children:[n.jsx("summary",{className:"cursor-pointer select-none outline-none hover:text-ink focus-visible:text-ink",children:l(h?"setup.connect.terminalFallbackWindows":"setup.connect.terminalFallback")}),n.jsx("p",{className:"mt-2 leading-relaxed",children:l(h?"setup.connect.terminalFallbackHelpWindows":"setup.connect.terminalFallbackHelp")}),n.jsx(f0,{command:o,actionLabel:l(h?"engineSetup.openInstallWindows":"engineSetup.openInstall"),compact:!0})]})]}),t==="needsSignIn"&&n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"text-[13px] leading-relaxed text-ink",children:l("setup.connect.signInIntro",{name:e})}),c]}),t==="testing"&&n.jsxs("p",{role:"status",className:"flex items-center gap-2 text-[13px] text-ink-secondary",children:[n.jsx(Ie,{size:14,className:"animate-spin","aria-hidden":"true"}),l("setup.connect.testing",{name:e})]}),t==="tested"&&n.jsx(Xc,{children:l("setup.connect.tested",{name:e})}),t==="testFailed"&&n.jsx(ho,{message:l("setup.connect.testFailed",{name:e}),detail:d,onRetry:s})]})}function Ore({name:e,job:t,startError:a,onStart:o,onCancel:i}){const[s,r]=f.useState(!1),c=t?.state==="running";return n.jsxs("div",{className:"mt-3",children:[!c&&n.jsxs("button",{type:"button",onClick:o,className:V(Ha,"w-full"),children:[n.jsx(wr,{size:14,"aria-hidden":"true"}),t?.state==="failed"||t?.state==="cancelled"?l("setup.connect.signInAgain"):l("setup.connect.signIn",{name:e})]}),c&&!t.url&&n.jsx(Oi,{label:l("setup.connect.signInStarting",{name:e})}),c&&t.url&&n.jsxs("div",{className:"space-y-2.5",children:[n.jsx("p",{className:"text-[12.5px] leading-relaxed text-ink-secondary",children:t.code?l("setup.connect.signInWithCode"):l("setup.connect.signInBrowser")}),t.code&&n.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-lg bg-inset px-3 py-2",children:[n.jsx("code",{dir:"ltr","aria-label":l("setup.connect.codeLabel"),className:"select-all font-mono text-[17px] tracking-[0.2em] text-ink",children:t.code}),n.jsxs("button",{type:"button",onClick:()=>{navigator.clipboard?.writeText(t.code).then(()=>r(!0)).catch(()=>{})},className:Za,children:[n.jsx(Ya,{size:13,"aria-hidden":"true"}),l(s?"engineSetup.copied":"engineSetup.copy")]})]}),n.jsxs("button",{type:"button",onClick:()=>m0(t.url),className:V(Ha,"w-full"),children:[n.jsx(An,{size:14,"aria-hidden":"true"}),l("setup.connect.openSignIn")]}),n.jsxs("p",{role:"status",className:"flex items-center gap-2 text-[12px] text-ink-secondary",children:[n.jsx(Ie,{size:12,className:"animate-spin","aria-hidden":"true"}),l("setup.connect.waitingForSignIn")]}),n.jsx("button",{type:"button",onClick:i,className:"text-[12px] text-ink-secondary hover:text-ink",children:l("common.cancel")})]}),a&&n.jsx(ho,{message:l("setup.error.failed"),detail:a}),t&&(t.state==="failed"||t.state==="cancelled")&&t.reason!==void 0&&n.jsx(ho,{message:Ml(t),detail:t.detail})]})}function zre({instanceId:e,name:t,onSignedIn:a}){const{job:o,start:i,cancel:s,startError:r}=Cr(c=>{c.state==="succeeded"&&a()});return n.jsx(Ore,{name:t,job:o,startError:r,onStart:()=>{i("engine-login",e)},onCancel:()=>{s()}})}function Lre({instanceId:e,chibitek:t,domain:a,onSkip:o}){const i=FD(e,a);return i.state==="failed"?n.jsx(_D,{chibitek:t,onRetry:()=>{i.start()},onContinueLocal:o}):n.jsx("div",{className:"mt-3",children:i.state==="waiting"?n.jsxs("p",{role:"status",className:"flex items-center gap-2 text-[13px] text-ink-secondary",children:[n.jsx(Ie,{size:14,className:"animate-spin","aria-hidden":"true"}),l("setup.google.geminiWaiting")]}):n.jsxs("button",{type:"button",onClick:()=>{i.start()},className:V(Ha,"w-full"),children:[n.jsx(wr,{size:14,"aria-hidden":"true"}),a?l("setup.google.useDomain",{domain:a}):l("setup.connect.signIn",{name:"Gemini"})]})})}function Fre({plan:e,chibitek:t,domain:a,onTested:o,onSkip:i}){const{state:s,refreshInstances:r}=ve(),c=q4[e],[d,p]=f.useState(s.instances.length>0),[h,g]=f.useState(!1),[b,x]=f.useState("idle"),[v,k]=f.useState(null),S=sS(s.instances,c.driverKind),N=ad(e),C=f.useRef(o);C.current=o;const{job:j,start:M,startError:D}=Cr(()=>{r().catch(()=>{})}),A=f.useCallback(()=>{g(!1),r().then(z=>g(!z),()=>g(!0)).finally(()=>p(!0))},[r]);f.useEffect(()=>{A()},[]);const R=f.useCallback(async()=>{if(S){x("running"),k(null);try{const z=await X("/api/setup/engine-test",{method:"POST",body:JSON.stringify({instanceId:S.instanceId}),timeoutMs:6e4});x(z.ok?"passed":"failed"),k(z.detail??null),C.current(z.ok),z.ok||r().catch(()=>{})}catch(z){x("failed"),k(z instanceof Error?z.message:String(z)),C.current(!1)}}},[S,r]),P=Ere({loaded:d,instance:S,job:j,test:b,checkFailed:h}),O=qR()==="win32";f.useEffect(()=>{P==="testing"&&b==="idle"&&R()},[P,b,R]);let T=null;return S&&P==="needsSignIn"&&(c.signIn==="claude"?T=n.jsx("div",{className:"mt-3",children:n.jsx(DR,{instanceId:S.instanceId})}):c.signIn==="codex"?T=n.jsx("div",{className:"mt-3",children:n.jsx(K2,{instanceId:S.instanceId})}):c.signIn==="meta"?T=n.jsx("div",{className:"mt-3",children:n.jsx(K2,{instanceId:S.instanceId,provider:"meta"})}):c.signIn==="cli"?T=n.jsx(zre,{instanceId:S.instanceId,name:N,onSignedIn:()=>{r()}}):e==="gemini"?T=n.jsx(Lre,{instanceId:S.instanceId,chibitek:t,domain:a,onSkip:i}):T=n.jsx(Pr,{instance:S,unframed:!0,className:"mt-2"})),n.jsx(Dre,{name:N,phase:P,job:j,terminalCommand:j?.reason==="no-installer"||j?.state==="failed"?Hu(S?.install):null,windows:O,notOnWindows:O&&!!S?.install?.command&&!Hu(S?.install)&&!S?.install?.server&&!S?.install?.managed,onInstall:()=>S&&void M("engine-install",S.instanceId),onRecheck:()=>{p(!1),A()},startError:D,onRetryTest:()=>{x("idle"),r().catch(()=>{})},signIn:T,testDetail:v})}function LD({name:e,phase:t,value:a,onChange:o,onSave:i,keyUrl:s,signupUrl:r,error:c,job:d}){if(t==="tested")return n.jsx("div",{className:"mt-4 rounded-xl border border-hairline/40 bg-card p-3.5",children:n.jsx(Xc,{children:l("setup.key.tested",{name:e})})});if(t==="checking")return n.jsxs("p",{role:"status",className:"mt-4 flex items-center gap-2 text-[13px] text-ink-secondary",children:[n.jsx(Ie,{size:14,className:"animate-spin","aria-hidden":"true"}),l("setup.connect.checking",{name:e})]});if(t==="installing")return n.jsxs("div",{className:"mt-4 rounded-xl border border-hairline/40 bg-card p-3.5",children:[n.jsx(Oi,{label:l("setup.connect.phase.installing",{name:e})}),n.jsx(md,{detail:d?.detail})]});const p=t==="saving";return n.jsxs("form",{className:"mt-4 rounded-xl border border-hairline/40 bg-card p-3.5",onSubmit:h=>{h.preventDefault(),i()},children:[n.jsx("label",{htmlFor:"setup-plan-key",className:"text-[12px] font-medium text-ink-secondary",children:l("setup.key.label",{name:e})}),n.jsx("input",{id:"setup-plan-key",type:"password",autoComplete:"off",spellCheck:!1,value:a,disabled:p,onChange:h=>o(h.target.value),placeholder:l("setup.key.placeholder"),className:V("mt-1.5",fr)}),n.jsxs("div",{className:"mt-2 flex flex-wrap gap-2",children:[s&&n.jsx(Wy,{href:s,label:l("setup.key.getKey")}),r&&n.jsx(Wy,{href:r,label:l("setup.key.noPlan")})]}),n.jsxs("button",{type:"submit",disabled:!a.trim()||p,className:V(Ha,"mt-3 w-full"),children:[p&&n.jsx(Ie,{size:14,className:"animate-spin","aria-hidden":"true"}),l(p?"setup.key.testing":"setup.key.save")]}),t==="rejected"&&n.jsx(ho,{message:l("setup.key.rejected",{name:e})}),t==="unreachable"&&n.jsx(ho,{message:l("setup.key.unreachable")}),t==="failed"&&n.jsx(ho,{message:l("setup.key.failed"),detail:c??d?.detail})]})}function V7({plan:e,onTested:t}){const{refreshInstances:a}=ve(),o=q4[e],i=ad(e),[s,r]=f.useState(null),[c,d]=f.useState("checking"),[p,h]=f.useState(""),[g,b]=f.useState(null),x=f.useRef(t);x.current=t;const v=f.useCallback(async C=>{const j=await X("/api/setup/engine-test",{method:"POST",body:JSON.stringify({instanceId:C}),timeoutMs:6e4});j.ok?(d("tested"),x.current(!0)):(b(j.detail??null),d("failed"))},[]),k=f.useRef(null),S=Cr(C=>{a().catch(()=>{}),C.state==="succeeded"&&k.current?v(k.current).catch(()=>d("failed")):d("failed")});f.useEffect(()=>{let C=!0;return X("/api/provider-accounts",{timeoutMs:1e4}).then(async({providers:j})=>{if(!C)return;const M=j.find(R=>R.id===o.provider)??null;r(M);const D=M?.accounts.find(R=>R.keyConfigured);if(!D){d("entering");return}const A=await X(`/api/provider-accounts/${encodeURIComponent(D.instanceId)}/test`,{method:"POST",body:"{}"}).catch(()=>({ok:!1}));C&&(A.ok?(d("tested"),x.current(!0)):d("entering"))}).catch(()=>C&&d("entering")),()=>{C=!1}},[o.provider]);const N=async()=>{const C=p.trim();if(!(!C||!s)){d("saving"),b(null);try{if(s.keyTest){const M=await X("/api/keys/test",{method:"POST",body:JSON.stringify({provider:s.keyTest.provider,key:C,...s.keyTest.url?{url:s.keyTest.url}:{}}),timeoutMs:3e4});if(!M.ok){d(M.reason==="rejected"?"rejected":M.reason==="unreachable"?"unreachable":"failed");return}}const j=await RD(s,s.label,C);if(h(""),await a().catch(()=>{}),k.current=j.instanceId,o.method==="engineAndKey"){d("installing"),await S.start("engine-install",j.instanceId);return}s.keyTest?(d("tested"),x.current(!0)):await v(j.instanceId)}catch(j){b(j instanceof Error?j.message:String(j)),d("failed")}}};return n.jsx(LD,{name:i,phase:c,value:p,onChange:C=>{h(C),c!=="entering"&&c!=="saving"&&d("entering")},onSave:()=>{N()},keyUrl:s?.keyUrl,signupUrl:s?.signupUrl,error:g,job:S.job})}function _re({plan:e,onTested:t,chibitek:a=!1,domain:o=null,onSkip:i}){const[s,r]=f.useState(null),c=ad(e),d=q4[e],{state:p,refreshInstances:h}=ve(),g=IX(e,a),[b,x]=f.useState(g.personal),v=f.useRef(!1),k=async C=>{const j=await X("/api/instances").then(D=>D.instances,()=>p.instances),M=d.method==="engine"?sS(j,d.driverKind):j.filter(D=>D.providerAccount?.provider===d.provider).at(-1);M&&!M.ownerLocked&&await ER(M.instanceId,C?"personal":"company").catch(()=>{}),await Promise.resolve(h()).catch(()=>{})},S=C=>{v.current=C,C&&!(e==="ollama"&&s==="local")&&k(b),t(C)},N=()=>{const C=!b;x(C),v.current&&k(C)};return n.jsxs("div",{className:"flex flex-col",children:[n.jsx("p",{className:"text-[14px] leading-relaxed text-ink-secondary",children:l(`setup.plan.${e}.connect`)}),e==="ollama"?n.jsxs(n.Fragment,{children:[n.jsx("div",{role:"radiogroup","aria-label":l("setup.ollama.question"),className:"mt-4 grid grid-cols-2 gap-2",children:["cloud","local"].map(C=>n.jsxs("button",{type:"button",role:"radio","aria-checked":s===C,"aria-label":l(`setup.ollama.${C}`),onClick:()=>{r(C),C==="local"&&t(!0)},className:V("rounded-xl border px-3 py-2.5 text-left text-[13px] transition-colors",s===C?"border-accent bg-accent/10 text-ink":"border-hairline/50 bg-card text-ink-secondary hover:bg-raised/40"),children:[n.jsx("span",{className:"block font-semibold text-ink",children:l(`setup.ollama.${C}`)}),n.jsx("span",{className:"mt-0.5 block text-[11.5px]",children:l(`setup.ollama.${C}Detail`)})]},C))}),s==="cloud"&&n.jsx(V7,{plan:"ollama",onTested:S}),s==="local"&&n.jsx("p",{className:"mt-3 text-[12.5px] leading-relaxed text-ink-secondary",children:l("setup.ollama.localNext")})]}):d.method==="engine"?n.jsx(Fre,{plan:e,chibitek:a,domain:o,onTested:S,onSkip:i}):n.jsx(V7,{plan:e,onTested:S}),!(e==="ollama"&&s!=="cloud")&&(g.fixed?n.jsx("p",{"data-plan-owner":"company",className:"mt-3 text-[12.5px] leading-relaxed text-ink-secondary",children:l("setup.owner.company")}):n.jsxs("div",{"data-plan-owner":b?"personal":"company",className:"mt-3 flex items-start justify-between gap-3 rounded-xl border border-hairline/40 bg-card/80 px-3.5 py-3 backdrop-blur-xl",children:[n.jsxs("span",{className:"min-w-0",children:[n.jsx("span",{className:"block text-[13px] font-medium text-ink",children:l("setup.owner.toggle")}),n.jsx("span",{className:"mt-0.5 block text-[12px] leading-relaxed text-ink-secondary",children:l("setup.owner.toggleHint")})]}),n.jsx(Dt,{checked:b,"aria-label":l("setup.owner.toggle"),onClick:N})]})),n.jsx($i,{children:n.jsx("p",{children:l(`setup.plan.${e}.what`,{name:c})})})]})}const qre="antigravityAgent";function FD(e,t){const{refreshInstances:a}=ve(),[o,i]=f.useState("idle"),s=f.useRef(null),r=()=>{s.current!==null&&window.clearInterval(s.current),s.current=null};f.useEffect(()=>r,[]);const c=f.useCallback(async()=>{if(!e)return;r(),i("waiting");const d=`/api/instances/${encodeURIComponent(e)}/auth`;try{const{auth:p}=await X(`${d}/start`,{method:"POST",body:"{}",timeoutMs:12e4});if(p.phase==="succeeded"){await a().catch(()=>{});return}if(!p.flowId||!p.authorizationUrl)throw new Error("no sign-in page");m0(JE(p.authorizationUrl,t)),s.current=window.setInterval(()=>{a().catch(()=>{}),X(`${d}/status?flowId=${encodeURIComponent(p.flowId)}`,{timeoutMs:1e4}).then(({auth:h})=>{(h.phase==="failed"||h.phase==="expired"||h.phase==="cancelled")&&(r(),i("failed"))}).catch(()=>{})},2e3)}catch{r(),i("failed")}},[e,t,a]);return{state:o,start:c,reset:()=>{r(),i("idle")}}}function _D({chibitek:e,onRetry:t,onContinueLocal:a}){return n.jsxs("div",{role:"alert",className:"mt-3 rounded-xl border border-warning/30 bg-warning/10 px-3 py-2.5",children:[n.jsxs("div",{className:"flex items-start gap-2 text-[12.5px] leading-relaxed text-ink",children:[n.jsx(Zn,{size:14,className:"mt-0.5 shrink-0 text-warning","aria-hidden":"true"}),n.jsx("span",{children:e?l("setup.google.geminiNotOnChibitek",{email:_c}):l("setup.google.geminiNotOn")})]}),n.jsxs("div",{className:"mt-2 flex flex-wrap gap-2",children:[n.jsx("button",{type:"button",onClick:t,className:Za,children:l("setup.tryAgain")}),a&&n.jsx("button",{type:"button",onClick:a,className:Za,children:l("setup.google.continueLocal")})]})]})}function Ure({stage:e,required:t,domain:a,accountEmail:o,geminiWorks:i,error:s,onStart:r,onRetryGemini:c,onSkipGemini:d,onUseOtherAccount:p,onSkip:h}){const g=a?l("setup.google.useDomain",{domain:a}):l("setup.google.useCompany");return n.jsxs("div",{className:"flex flex-col",children:[n.jsx("p",{className:"text-[14px] leading-relaxed text-ink-secondary",children:l("setup.google.intro")}),n.jsx("p",{className:"mt-1.5 text-[13px] font-medium text-ink",children:g}),t&&n.jsx("p",{className:"mt-1.5 text-[12.5px] text-ink-secondary",children:l("setup.google.required")}),n.jsxs("div",{className:"mt-4 rounded-xl border border-accent/40 bg-accent/5 p-3.5","data-stage":e,children:[e==="start"&&n.jsxs("button",{type:"button",onClick:r,className:V(Ha,"w-full"),children:[n.jsx(wr,{size:14,"aria-hidden":"true"}),l("setup.google.button")]}),e==="installing"&&n.jsx(Oi,{label:l("setup.google.installing")}),e==="geminiSignIn"&&n.jsxs("p",{role:"status",className:"flex items-center gap-2 text-[13px] text-ink",children:[n.jsx(Ie,{size:14,className:"animate-spin","aria-hidden":"true"}),l("setup.google.geminiWaiting")]}),e==="geminiOff"&&n.jsx(_D,{chibitek:!0,onRetry:c,onContinueLocal:d}),e==="account"&&n.jsxs(n.Fragment,{children:[n.jsxs("p",{role:"status",className:"flex items-center gap-2 text-[13px] text-ink",children:[n.jsx(Ie,{size:14,className:"animate-spin","aria-hidden":"true"}),l("setup.google.accountWaiting")]}),h&&n.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-[12.5px] text-ink-secondary",children:[n.jsx("span",{children:l("setup.google.stuckHint")}),n.jsx("button",{type:"button",onClick:h,className:Za,"data-google-continue-without":!0,children:l("setup.google.continueWithout")})]})]}),e==="wrongDomain"&&n.jsxs("div",{role:"alert",className:"rounded-xl border border-danger/25 bg-danger/10 px-3 py-2.5",children:[n.jsx("p",{className:"text-[12.5px] leading-relaxed text-ink",children:l("setup.google.wrongDomain",{domain:a??"",email:o??""})}),n.jsx("button",{type:"button",onClick:p,className:V(Za,"mt-2"),children:l("setup.google.useOther")})]}),e==="testing"&&n.jsxs("p",{role:"status",className:"flex items-center gap-2 text-[13px] text-ink-secondary",children:[n.jsx(Ie,{size:14,className:"animate-spin","aria-hidden":"true"}),l("setup.connect.testing",{name:"Gemini"})]}),e==="done"&&n.jsxs(n.Fragment,{children:[n.jsx(Xc,{children:l("setup.google.done",{email:o??""})}),n.jsx("p",{className:"mt-1 text-[12.5px] text-ink-secondary",children:l(i?"setup.google.geminiReady":"setup.google.geminiLater")})]}),e==="failed"&&(h?n.jsxs("div",{role:"alert",className:"rounded-xl border border-warning/30 bg-warning/10 px-3 py-2.5","data-google-unavailable":!0,children:[n.jsxs("div",{className:"flex items-start gap-2 text-[12.5px] leading-relaxed text-ink",children:[n.jsx(Zn,{size:14,className:"mt-0.5 shrink-0 text-warning","aria-hidden":"true"}),n.jsx("span",{children:l("setup.google.unavailable")})]}),n.jsxs("div",{className:"mt-2 flex flex-wrap gap-2",children:[n.jsx("button",{type:"button",onClick:h,className:Ha,children:l("setup.continue")}),n.jsx("button",{type:"button",onClick:r,className:Za,children:l("setup.tryAgain")})]})]}):n.jsx(ho,{message:l("setup.error.failed"),detail:s,onRetry:r}))]}),n.jsx($i,{children:n.jsx("p",{children:l("setup.google.what")})})]})}function Vre(e){return e?.snapshot.state==="available"&&e.snapshot.authenticated!==!1}function Hre({required:e,domain:t,onDone:a,onSkip:o}){const{state:i,refreshInstances:s}=ve(),r=sS(i.instances,qre),[c,d]=f.useState("start"),[p,h]=f.useState(null),[g,b]=f.useState(null),[x,v]=f.useState(!1),k=FD(r?.instanceId,t),S=Cr(D=>{s().catch(()=>{}),D.state==="succeeded"?d("geminiSignIn"):d("geminiOff")}),N=f.useRef(null);f.useEffect(()=>()=>{N.current!==null&&window.clearInterval(N.current)},[]),f.useEffect(()=>{if(c==="geminiSignIn"){if(Vre(r)){v(!0),d("account");return}k.state==="idle"&&k.start(),k.state==="failed"&&d("geminiOff")}},[c,r,k]);const C=f.useCallback(async()=>{b(null);try{const D=await X("/api/accounts/connect",{method:"POST",body:JSON.stringify({provider:"google"})});D.url&&m0(JE(D.url,t)),N.current!==null&&window.clearInterval(N.current),N.current=window.setInterval(()=>{X(`/api/accounts/connect/${encodeURIComponent(D.id)}`).then(A=>{if(!(A.state==="waiting"||A.state==="finishing")){if(N.current!==null&&window.clearInterval(N.current),N.current=null,A.state!=="connected"){b(A.error??A.state),d("failed");return}h(A.email??null),WE(A.email,t)?d("testing"):d("wrongDomain")}}).catch(A=>{N.current!==null&&window.clearInterval(N.current),b(A instanceof Error?A.message:String(A)),d("failed")})},2e3)}catch(D){b(D instanceof Error?D.message:String(D)),d("failed")}},[t]);f.useEffect(()=>{c==="account"&&C()},[c]),f.useEffect(()=>{if(c==="testing"){if(!x||!r){d("done"),a(!1);return}X("/api/setup/engine-test",{method:"POST",body:JSON.stringify({instanceId:r.instanceId}),timeoutMs:6e4}).then(D=>{v(D.ok),d("done"),a(D.ok)}).catch(()=>{v(!1),d("done"),a(!1)})}},[c]);const j=()=>{if(b(null),k.reset(),!r){d("account");return}if(r.snapshot.state!=="available"){d("installing"),S.start("engine-install",r.instanceId);return}d("geminiSignIn")},M=async()=>{const A=(await X("/api/accounts").catch(()=>null))?.providers.find(R=>R.id==="google")?.accounts.find(R=>R.email===p);A&&await X(`/api/accounts/${encodeURIComponent(A.id)}`,{method:"DELETE"}).catch(()=>{}),h(null),d("account")};return n.jsx(Ure,{stage:c,required:e,domain:t,accountEmail:p,geminiWorks:x,error:g,onStart:j,onRetryGemini:()=>{k.reset(),d(r?.snapshot.state==="available"?"geminiSignIn":"installing"),r&&r.snapshot.state!=="available"&&S.start("engine-install",r.instanceId)},onSkipGemini:()=>{v(!1),d("account")},onUseOtherAccount:()=>{M()},onSkip:o&&(()=>{N.current!==null&&window.clearInterval(N.current),N.current=null,o()})})}const xb={gmail:"https://www.googleapis.com/auth/gmail.readonly",gmailSend:"https://www.googleapis.com/auth/gmail.compose",calendar:"https://www.googleapis.com/auth/calendar.events",drive:"https://www.googleapis.com/auth/drive.readonly"},Gre=["openid","email","profile"],mc={mailReadWrite:"Mail.ReadWrite",mailSend:"Mail.Send",calendars:"Calendars.ReadWrite",files:"Files.Read.All"},$re={google:{id:"google",label:"Google",authorizeUrl:"https://accounts.google.com/o/oauth2/v2/auth",tokenUrl:"https://oauth2.googleapis.com/token",redirectHost:"127.0.0.1",scopes:Gre,incremental:!0,authorizeParams:{access_type:"offline",prompt:"consent select_account",include_granted_scopes:"true"},clientIdEnv:"ATOMIC_GOOGLE_OAUTH_CLIENT_ID",clientSecretEnv:"ATOMIC_GOOGLE_OAUTH_CLIENT_SECRET",families:{gmail:xb.gmail,gmailSend:xb.gmailSend,calendar:xb.calendar,drive:xb.drive}},microsoft:{id:"microsoft",label:"Microsoft",authorizeUrl:"https://login.microsoftonline.com/common/oauth2/v2.0/authorize",tokenUrl:"https://login.microsoftonline.com/common/oauth2/v2.0/token",redirectHost:"localhost",scopes:["offline_access","openid","profile","email","User.Read",mc.mailReadWrite,mc.mailSend,mc.calendars,mc.files],incremental:!1,authorizeParams:{prompt:"select_account",response_mode:"query"},clientIdEnv:"ATOMIC_MICROSOFT_OAUTH_CLIENT_ID",families:{outlook:mc.mailReadWrite,outlookCalendar:mc.calendars,onedrive:mc.files}}};function qD(e){const t=$re[e];return t.incremental?Object.keys(t.families):[]}const Kre="Atomic",jg="https://github.com/chibitek/atomic",H7="/handbook/atomic-handbook.html",Wre=`${jg}/blob/main/docs/approval-levels.md`,Jre=`${jg}/issues`,Yre=`${jg}/releases`,Zre=`${jg}/blob/main/LICENSE`;function rS(){return"0.1.177"}const Qre={darwin:"macOS",win32:"Windows",linux:"Linux"};function Xre(e){return(e&&Qre[e])??null}async function Pl(e){if(window.ogb?.openExternal){await window.ogb.openExternal(e);return}window.open(e,"_blank","noopener,noreferrer")}const ele=2e3,UD={google:{title:"accounts.google.title",subtitle:"accounts.google.subtitle",badge:"G",badgeClass:"bg-[#4285F4]"},microsoft:{title:"accounts.microsoft.title",subtitle:"accounts.microsoft.subtitle",badge:"M",badgeClass:"bg-[#0078D4]"}},VD={gmail:"accounts.family.gmail",gmailSend:"accounts.family.gmailSend",calendar:"accounts.family.calendar",drive:"accounts.family.drive",outlook:"accounts.family.outlook",outlookCalendar:"accounts.family.outlookCalendar",onedrive:"accounts.family.onedrive"},tle={gmail:"accounts.why.gmail",gmailSend:"accounts.why.gmailSend",calendar:"accounts.why.calendar",drive:"accounts.why.drive"};function nle({account:e,busy:t,onTurnOn:a}){const o=qD(e.provider);if(!o.length)return null;const i=new Set(e.missing??[]);return n.jsx("ul",{className:"mt-2 flex flex-col gap-1.5","data-account-families":!0,children:o.map(s=>{const r=!i.has(s),c=tle[s];return n.jsxs("li",{className:"flex items-start gap-2 text-[11.5px] leading-relaxed",children:[n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("span",{className:"text-ink",children:l(VD[s])}),c&&n.jsxs("span",{className:"text-ink-secondary",children:[" · ",l(c)]})]}),r?n.jsx("span",{className:"shrink-0 text-success",children:l("accounts.familyOn")}):n.jsx("button",{type:"button",onClick:()=>a(s),disabled:t||e.status!=="ok",className:"shrink-0 text-accent hover:underline disabled:no-underline disabled:opacity-50","data-account-turn-on":s,children:l("accounts.turnOn")})]},s)})})}function lS(){const[e,t]=f.useState(null),[a,o]=f.useState(null),i=f.useCallback(async()=>{try{t(await X("/api/accounts",{timeoutMs:3e4})),o(null)}catch(s){o(s instanceof Error?s.message:String(s))}},[]);return f.useEffect(()=>{i();const s=()=>{i()};return window.addEventListener("focus",s),()=>window.removeEventListener("focus",s)},[i]),{status:e,error:a,refresh:i}}function HD({provider:e}){const t=UD[e];return n.jsx("span",{"aria-hidden":!0,className:V("flex size-6 shrink-0 items-center justify-center rounded-full text-[11px] font-semibold text-white",t.badgeClass),children:t.badge})}function ale({account:e,busy:t,onReconnect:a,onTurnOn:o,onRemove:i,personal:s,onPersonal:r}){const c=new Date(e.addedAt).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"}),d=qD(e.provider).length>0,p=d?[]:e.missing??[];return n.jsxs("div",{className:"flex items-start gap-3 px-3 py-2.5",children:[n.jsx(HD,{provider:e.provider}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"truncate text-[13px] text-ink",children:e.email}),n.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-x-2 text-[11.5px] text-ink-secondary",children:[n.jsx("span",{children:l("accounts.connectedOn",{date:c})}),n.jsx("span",{className:e.status==="ok"?"text-success":"text-warning",children:e.status==="ok"?l("accounts.status.ok"):l("accounts.status.reauth")})]}),p.length?n.jsx("div",{className:"mt-1 text-[11.5px] leading-relaxed text-warning",children:l("accounts.missing",{services:p.map(h=>l(VD[h])).join(", ")})}):null,d&&n.jsx(nle,{account:e,busy:t,onTurnOn:o})]}),n.jsxs("div",{className:"flex shrink-0 items-center gap-2 text-[12px]",children:[r&&n.jsxs("label",{className:"flex items-center gap-1.5 text-ink-secondary",title:l("owner.connectionHint"),children:[n.jsx("span",{children:l("owner.personal")}),n.jsx(Dt,{checked:!!s,disabled:t,"aria-label":l("owner.connectionToggle",{name:e.email}),onClick:()=>r(!s)})]}),(e.status==="reauth"||p.length>0)&&n.jsx("button",{type:"button",onClick:a,disabled:t,className:"text-ink-secondary hover:text-ink disabled:opacity-50",children:l("accounts.signInAgain")}),n.jsx("button",{type:"button",onClick:i,disabled:t,className:"text-danger hover:underline disabled:no-underline disabled:opacity-50",children:l("accounts.remove")})]})]})}function GD({provider:e,storageReady:t,onChanged:a,personalIds:o,onPersonal:i,onGiveUp:s}){const r=UD[e.id],[c,d]=f.useState(null),[p,h]=f.useState(null),[g,b]=f.useState(null),[x,v]=f.useState(!1),[k,S]=f.useState(null),[N,C]=f.useState(!1),j=f.useRef(null),M=()=>{j.current!==null&&window.clearInterval(j.current),j.current=null};f.useEffect(()=>M,[]);const D=O=>{M(),j.current=window.setInterval(()=>{X(`/api/accounts/connect/${O}`).then(async T=>{T.state==="waiting"||T.state==="finishing"||(M(),d(null),T.state==="connected"?(b(l("accounts.connected",{email:T.email??""})),await a()):s&&T.state!=="cancelled"?h(l(e.id==="microsoft"?"setup.accounts.microsoftUnavailable":"setup.accounts.googleUnavailable")):T.state==="expired"?h(l("accounts.expired")):T.state==="failed"&&h(T.error??l("accounts.failed")))}).catch(T=>{M(),d(null),h(T instanceof Error?T.message:String(T))})},ele)},A=async O=>{if(!(x||c)){v(!0),h(null),b(null);try{const T=await X("/api/accounts/connect",{method:"POST",body:JSON.stringify({provider:e.id,...O})});d(T),D(T.id),T.url&&await Pl(T.url)}catch(T){h(T instanceof Error?T.message:String(T))}finally{v(!1)}}},R=async()=>{const O=c;M(),d(null),O&&await X(`/api/accounts/connect/${O.id}`,{method:"DELETE"}).catch(()=>{})},P=async()=>{const O=k;if(S(null),!(!O||N)){C(!0),h(null),b(null);try{await X(`/api/accounts/${encodeURIComponent(O.id)}`,{method:"DELETE"}),await a()}catch(T){h(T instanceof Error?T.message:String(T))}finally{C(!1)}}};return n.jsxs(ut,{title:l(r.title),subtitle:l(r.subtitle),children:[n.jsxs("div",{className:"flex flex-col gap-3",children:[e.configured?n.jsxs(n.Fragment,{children:[e.accounts.length>0&&n.jsx("div",{className:"divide-y divide-hairline/40 overflow-hidden rounded-lg border border-hairline/40",children:e.accounts.map(O=>n.jsx(ale,{account:O,busy:N||!!c,onReconnect:()=>{A()},onRemove:()=>S(O),onTurnOn:T=>{A({families:[T],accountId:O.id})},personal:o?.includes(O.id),onPersonal:i&&(T=>i(O.id,T))},O.id))}),c?n.jsxs("div",{role:"status",className:"flex flex-wrap items-center gap-3 rounded-lg bg-inset px-3 py-2.5 text-[12.5px] text-ink",children:[n.jsx(Ie,{size:14,className:"animate-spin text-ink-secondary"}),n.jsx("span",{className:"min-w-0 flex-1",children:l("accounts.waiting",{provider:e.label})}),c.url&&n.jsx("button",{type:"button",onClick:()=>{Pl(c.url)},className:"text-ink-secondary hover:text-ink",children:l("accounts.openAgain")}),n.jsx("button",{type:"button",onClick:()=>{R()},className:"rounded-lg px-2 py-1 text-ink-secondary hover:bg-raised/50 hover:text-ink",children:l("common.cancel")}),s&&n.jsx("button",{type:"button",onClick:()=>{R(),s()},className:"rounded-lg px-2 py-1 font-medium text-ink hover:bg-raised/50","data-account-continue-without":!0,children:l("setup.google.continueWithout")})]}):n.jsxs("button",{type:"button",onClick:()=>{A()},disabled:x||N||!t,className:"flex w-fit items-center gap-1.5 rounded-lg bg-control px-3 py-2 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-50",children:[x?n.jsx(Ie,{size:14,className:"animate-spin"}):n.jsx(vn,{size:14}),e.accounts.length?l("accounts.connectAnother"):l("accounts.connect")]})]}):n.jsx("div",{className:"rounded-lg bg-inset px-3 py-2 text-[12.5px] text-ink-secondary",children:l("accounts.notConfigured")}),g&&n.jsx("p",{role:"status",className:"text-[12px] text-success",children:g}),p&&(s?n.jsxs("div",{role:"alert",className:"flex flex-wrap items-center gap-2 rounded-lg bg-warning/10 px-3 py-2 text-[12.5px] text-ink","data-account-unavailable":!0,children:[n.jsx("span",{className:"min-w-0 flex-1",children:p}),n.jsx("button",{type:"button",onClick:s,className:"rounded-lg bg-accent px-3 py-1.5 text-[12.5px] font-medium text-white",children:l("setup.continue")})]}):n.jsx("p",{role:"alert",className:"text-[12px] text-danger",children:p}))]}),n.jsx(Oa,{open:k!==null,title:l("accounts.removeTitle",{email:k?.email??""}),body:l("accounts.removeBody"),confirmLabel:l("accounts.remove"),tone:"neutral",onCancel:()=>S(null),onConfirm:()=>{P()}})]})}function ole(){const{dispatch:e}=ve();return n.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 rounded-lg border border-hairline/40 px-3 py-2 text-[12.5px] leading-relaxed text-ink-secondary","data-not-the-ai":!0,children:[n.jsx("span",{className:"min-w-0 flex-1 basis-60",children:l("accounts.notTheAi")}),n.jsx("button",{type:"button",onClick:()=>e({type:"toggleAppSettings",open:!0,section:"engines"}),className:"shrink-0 font-medium text-accent hover:underline",children:l("accounts.openSubscriptions")})]})}function ile(){const{status:e,error:t,refresh:a}=lS(),o=h0(),[i,s]=f.useState("");if(!e)return t?n.jsx("p",{role:"alert",className:"text-[12.5px] text-danger",children:t}):n.jsx("p",{className:"text-[12.5px] text-ink-secondary",children:l("accounts.loading")});const r=e.storage!=="unavailable";return n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"text-[13px] leading-relaxed text-ink-secondary",children:l("accounts.intro")}),n.jsx(ole,{}),!r&&n.jsx("div",{role:"alert",className:"rounded-lg border border-warning/30 bg-warning/10 px-3 py-2 text-[12.5px] text-warning",children:l("accounts.storageUnavailable")}),n.jsx("p",{className:"text-[12px] leading-relaxed text-ink-secondary",children:l("owner.connectionsIntro")}),i&&n.jsx("p",{role:"alert",className:"text-[12px] text-danger",children:l("owner.failed",{error:i})}),e.providers.map(c=>n.jsx(GD,{provider:c,storageReady:r,onChanged:a,personalIds:o.connections.accounts,onPersonal:(d,p)=>{s(""),o.set("accounts",d,p).catch(h=>s(h instanceof Error?h.message:String(h)))}},c.id))]})}function sle({onConnected:e,onSkip:t,sameAsGemini:a=!1,domain:o=null}){const{status:i,error:s,refresh:r}=lS(),c=(g,b)=>g!=="google"||WE(b,o),d=i?.providers.some(g=>g.accounts.some(b=>c(g.id,b.email)))??!1,p=i?.providers.flatMap(g=>g.accounts.filter(b=>!c(g.id,b.email)))??[];f.useEffect(()=>{d&&e()},[d]);const h=i?.storage!=="unavailable";return n.jsxs("div",{className:"flex flex-col",children:[n.jsx("p",{className:"text-[14px] leading-relaxed text-ink-secondary",children:l("setup.accounts.intro")}),a&&n.jsx("p",{className:"mt-1.5 text-[13px] font-medium leading-relaxed text-ink",children:o?l("setup.accounts.sameAccountDomain",{domain:o}):l("setup.accounts.sameAccount")}),n.jsx("p",{className:"mt-1.5 text-[12.5px] leading-relaxed text-ink-secondary",children:l("setup.accounts.perBot")}),p.length>0&&o&&n.jsx("p",{role:"alert",className:"mt-3 rounded-xl border border-danger/25 bg-danger/10 px-3 py-2.5 text-[12.5px] leading-relaxed text-ink",children:l("setup.google.wrongDomain",{domain:o,email:p[0].email})}),n.jsxs("div",{className:"mt-4 flex flex-col gap-3",children:[!i&&(s?n.jsx("p",{role:"alert",className:"text-[12.5px] text-danger",children:l("setup.accounts.loadFailed")}):n.jsx("p",{className:"text-[12.5px] text-ink-secondary",children:l("accounts.loading")})),i?.providers.map(g=>n.jsx(GD,{provider:g,storageReady:h,onChanged:r,onGiveUp:t},g.id))]}),t&&n.jsx("p",{className:"mt-3 text-[12.5px] text-ink-secondary",children:l("setup.accounts.optional")}),n.jsx($i,{children:n.jsx("p",{children:l("setup.accounts.what")})})]})}function rle(e){return e.filter(t=>t.kind==="apiKey"&&t.billing==="payPerUse")}function lle({onSaved:e}){const{refreshInstances:t}=ve(),[a,o]=f.useState([]),[i,s]=f.useState(null),[r,c]=f.useState(""),[d,p]=f.useState("entering"),[h,g]=f.useState(null),[b,x]=f.useState([]);f.useEffect(()=>{X("/api/provider-accounts",{timeoutMs:1e4}).then(({providers:S})=>{const N=rle(S);o(N),x(N.filter(C=>C.accounts.some(j=>j.keyConfigured)).map(C=>C.id))}).catch(()=>o([]))},[]);const v=a.find(S=>S.id===i)??null,k=async()=>{const S=r.trim();if(!(!v||!S)){p("saving"),g(null);try{if(v.keyTest){const N=await X("/api/keys/test",{method:"POST",body:JSON.stringify({provider:v.keyTest.provider,key:S,...v.keyTest.url?{url:v.keyTest.url}:{}}),timeoutMs:3e4});if(!N.ok){p(N.reason==="rejected"?"rejected":N.reason==="unreachable"?"unreachable":"failed");return}}await RD(v,v.label,S),c(""),x(N=>[...new Set([...N,v.id])]),p("tested"),e(),await t().catch(()=>{})}catch(N){g(N instanceof Error?N.message:String(N)),p("failed")}}};return n.jsxs("div",{className:"flex flex-col",children:[n.jsx("p",{className:"text-[14px] leading-relaxed text-ink-secondary",children:l("setup.apiKeys.intro")}),n.jsx("p",{className:"mt-1.5 text-[12.5px] leading-relaxed text-ink-secondary",children:l("setup.apiKeys.costs")}),n.jsx("div",{role:"radiogroup","aria-label":l("setup.apiKeys.pick"),className:"mt-4 grid grid-cols-2 gap-2 sm:grid-cols-3",children:a.map(S=>n.jsxs("button",{type:"button",role:"radio","aria-checked":i===S.id,onClick:()=>{s(S.id),c(""),p("entering")},className:V("flex items-center gap-2 rounded-xl border px-3 py-2.5 text-left text-[13px] transition-colors",i===S.id?"border-accent bg-accent/10 text-ink":"border-hairline/50 bg-card text-ink-secondary hover:bg-raised/40"),children:[S.icon?n.jsx(wg,{preset:S.icon,size:18}):n.jsx(hd,{driverKind:S.driver,size:18}),n.jsx("span",{className:"min-w-0 flex-1 truncate font-medium text-ink",children:S.label}),b.includes(S.id)&&n.jsx("span",{className:"text-[11px] text-success",children:l("setup.apiKeys.saved")})]},S.id))}),v&&n.jsx(LD,{name:v.label,phase:d,value:r,onChange:S=>{c(S),d!=="saving"&&p("entering")},onSave:()=>{k()},keyUrl:v.keyUrl,error:h}),n.jsxs($i,{children:[n.jsx("p",{children:l("setup.apiKeys.what1")}),n.jsx("p",{children:l("setup.apiKeys.what2")})]})]})}const G7="atomic-engine";function cle(e,t,a=null){return e?t?t.snapshot.state==="available"?"ready":a?.kind==="engine-install"&&a.state==="running"?"installing":a?.kind==="engine-install"&&a.state==="failed"?"installFailed":t.install?.managed?"installable":"notInstalled":"absent":"checking"}function dle({phase:e,chibitek:t,checking:a,onCheck:o,onInstall:i,job:s,downloadBytes:r}){return n.jsxs("div",{className:"flex flex-col",children:[n.jsx("p",{className:"text-[14px] leading-relaxed text-ink-secondary",children:l("setup.atomicEngine.intro")}),n.jsxs("div",{className:"mt-4 rounded-xl border border-hairline/40 bg-card p-3.5","data-phase":e,children:[e==="checking"&&n.jsxs("p",{role:"status",className:"flex items-center gap-2 text-[13px] text-ink-secondary",children:[n.jsx(Ie,{size:14,className:"animate-spin","aria-hidden":"true"}),l("setup.atomicEngine.checking")]}),e==="ready"&&n.jsx(Xc,{children:l("setup.atomicEngine.ready")}),e==="installable"&&n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"text-[13px] leading-relaxed text-ink",children:l("setup.atomicEngine.installIntro",{size:G2(r??0)})}),n.jsxs("button",{type:"button",onClick:i,className:V(Ha,"mt-3 w-full"),children:[n.jsx(pa,{size:14,"aria-hidden":"true"}),l("setup.atomicEngine.install")]})]}),e==="installing"&&n.jsxs(n.Fragment,{children:[n.jsx(Oi,{label:l("setup.atomicEngine.installing")}),n.jsx(md,{detail:s?.detail})]}),e==="installFailed"&&n.jsx(ho,{message:Ml(s),detail:s?.detail,onRetry:i}),(e==="notInstalled"||e==="absent")&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"inline-flex rounded-full bg-raised px-2 py-0.5 text-[11px] font-medium text-ink-secondary",children:l("setup.optional")}),n.jsx("p",{className:"mt-2 text-[13px] leading-relaxed text-ink",children:l("setup.atomicEngine.notYet")}),n.jsx("p",{className:"mt-1.5 text-[12.5px] leading-relaxed text-ink-secondary",children:l(t?"setup.atomicEngine.askChibitek":"setup.atomicEngine.others")}),e==="notInstalled"&&n.jsxs("button",{type:"button",onClick:o,disabled:a,className:`${Za} mt-3`,children:[n.jsx(fn,{size:13,className:a?"animate-spin":"","aria-hidden":"true"}),l(a?"common.checking":"common.checkAgain")]})]})]}),n.jsx($i,{children:n.jsx("p",{children:l("setup.atomicEngine.what")})})]})}function ule({chibitek:e,onReady:t}){const{state:a,refreshInstances:o}=ve(),[i,s]=f.useState(a.instances.length>0),[r,c]=f.useState(!1),{job:d,start:p}=Cr(()=>{o().catch(()=>{})}),h=a.instances.find(x=>x.instanceId===G7),g=cle(i,h,d),b=()=>{c(!0),o().catch(()=>{}).finally(()=>{c(!1),s(!0)})};return f.useEffect(b,[]),f.useEffect(()=>{g==="ready"&&t()},[g]),n.jsx(dle,{phase:g,chibitek:e,checking:r,onCheck:b,onInstall:()=>{p("engine-install",G7)},job:d,downloadBytes:h?.install?.managed?.downloadBytes})}function ple({chibi:e,connected:t,items:a}){const o=a.filter(i=>i.status!=="done");return n.jsxs("div",{className:"flex flex-col",children:[n.jsxs("div",{className:"rounded-xl border border-hairline/40 bg-card px-3.5 py-3",children:[n.jsx("div",{className:"text-[11.5px] font-semibold uppercase tracking-wide text-ink-secondary",children:l("setup.chibi.connectedTitle")}),t.length?n.jsx("ul",{className:"mt-1.5 space-y-1",children:t.map(i=>n.jsxs("li",{className:"flex items-center gap-2 text-[13px] text-ink",children:[n.jsx(rs,{size:14,className:"shrink-0 text-success","aria-hidden":"true"}),i]},i))}):n.jsx("p",{className:"mt-1.5 text-[13px] leading-relaxed text-ink",children:l("setup.chibi.nothingConnected")}),o.length>0&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"mt-3 text-[11.5px] font-semibold uppercase tracking-wide text-ink-secondary",children:l("setup.chibi.laterTitle")}),n.jsx("ul",{className:"mt-1.5 space-y-1",children:o.map(i=>n.jsxs("li",{className:"flex items-center gap-2 text-[12.5px] text-ink-secondary",children:[i.status==="skipped"?n.jsx(BB,{size:13,"aria-hidden":"true"}):n.jsx(TB,{size:13,"aria-hidden":"true"}),Yy(i.screen)]},i.key))}),n.jsx("p",{className:"mt-2 text-[12px] text-ink-secondary",children:l("setup.chibi.laterHint")})]})]}),n.jsxs("div",{className:"mt-4 flex items-center gap-4 rounded-xl border border-hairline/40 bg-card p-3.5",children:[e&&n.jsx(Jt,{bot:e,state:"happy",size:56}),n.jsxs("div",{className:"min-w-0",children:[n.jsx("div",{className:"text-[14px] font-semibold text-ink",children:l("setup.chibi.meet")}),n.jsx("p",{className:"mt-0.5 text-[12.5px] leading-relaxed text-ink-secondary",children:l("setup.chibi.intro")})]})]})]})}function mle({podman:e,wantsLocal:t,download:a,machine:o,onChooseLocal:i,onLater:s,onDownload:r,onCheck:c,onStart:d}){return t?e?e.platform!=="darwin"||e.arch!=="arm64"?n.jsx("p",{className:"mt-4 rounded-xl border border-hairline/40 bg-card p-3.5 text-[13px] leading-relaxed text-ink",children:l("setup.computers.unsupported")}):n.jsxs("div",{className:"mt-4 rounded-xl border border-hairline/40 bg-card p-3.5","data-podman":e.installed?e.running?"running":"installed":"missing",children:[!e.installed&&a?.state!=="running"&&a?.state!=="succeeded"&&a?.state!=="failed"&&n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"text-[13px] leading-relaxed text-ink",children:l("setup.computers.podmanIntro")}),n.jsxs("button",{type:"button",onClick:r,className:V(Ha,"mt-3 w-full"),children:[n.jsx(pa,{size:14,"aria-hidden":"true"}),l("setup.computers.download")]}),n.jsx("p",{className:"mt-1.5 text-center text-[11px] text-ink-secondary",children:l("setup.computers.downloadNote")})]}),a?.state==="running"&&n.jsxs(n.Fragment,{children:[n.jsx(Oi,{label:l(a.phase==="downloading"?"setup.computers.phase.downloading":a.phase==="verifying"?"setup.computers.phase.verifying":"setup.computers.phase.opening"),received:a.received,total:a.total}),n.jsx(md,{detail:a.detail})]}),!e.installed&&a?.state==="succeeded"&&n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"text-[13px] leading-relaxed text-ink",children:l("setup.computers.finishInstaller")}),n.jsxs("button",{type:"button",onClick:c,className:V(Za,"mt-3"),children:[n.jsx(fn,{size:13,"aria-hidden":"true"}),l("setup.computers.installedCheck")]})]}),!e.installed&&a?.state==="failed"&&n.jsx(ho,{message:Ml(a),detail:a.detail,onRetry:r}),e.installed&&!e.running&&o?.state!=="running"&&n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"text-[13px] leading-relaxed text-ink",children:l("setup.computers.startIntro")}),n.jsx("button",{type:"button",onClick:d,className:V(Ha,"mt-3 w-full"),children:l("setup.computers.start")}),o?.state==="failed"&&n.jsx(ho,{message:Ml(o),detail:o.detail,onRetry:d})]}),o?.state==="running"&&n.jsx(Oi,{label:l("setup.computers.starting")}),e.installed&&e.running&&n.jsx(Xc,{children:l("setup.computers.ready")})]}):n.jsx(Oi,{label:l("setup.computers.checking")}):n.jsxs("div",{className:"mt-4 grid gap-2 sm:grid-cols-2",children:[n.jsxs("button",{type:"button","data-primary":"",onClick:s,"aria-label":l("setup.computers.later"),"aria-describedby":"computers-later-detail",className:"flex flex-col items-start gap-1.5 rounded-xl border border-accent bg-accent/10 p-3.5 text-left",children:[n.jsx(Es,{size:18,className:"text-ink-secondary","aria-hidden":"true"}),n.jsx("span",{className:"text-[13.5px] font-semibold text-ink",children:l("setup.computers.later")}),n.jsx("span",{id:"computers-later-detail",className:"text-[12px] leading-snug text-ink-secondary",children:l("setup.computers.laterDetail")})]}),n.jsxs("button",{type:"button",onClick:i,"aria-label":l("setup.computers.local"),"aria-describedby":"computers-local-detail",className:"flex flex-col items-start gap-1.5 rounded-xl border border-hairline/50 bg-card p-3.5 text-left hover:bg-raised/40",children:[n.jsx(Ba,{size:18,className:"text-ink-secondary","aria-hidden":"true"}),n.jsx("span",{className:"text-[13.5px] font-semibold text-ink",children:l("setup.computers.local")}),n.jsx("span",{id:"computers-local-detail",className:"text-[12px] leading-snug text-ink-secondary",children:l("setup.computers.localDetail")})]})]})}function hle({onReady:e,onLater:t}){const[a,o]=f.useState(!1),[i,s]=f.useState(null),r=f.useCallback(async()=>{const p=await X("/api/setup/machine",{timeoutMs:15e3}).catch(()=>null);p&&s({platform:p.platform,arch:p.arch,...p.podman})},[]),c=Cr(()=>{r()}),d=Cr(()=>{r()});return f.useEffect(()=>{a&&r()},[a,r]),f.useEffect(()=>{i?.installed&&i.running&&e()},[i?.installed,i?.running]),n.jsxs("div",{className:"flex flex-col",children:[n.jsx("p",{className:"text-[14px] leading-relaxed text-ink-secondary",children:l("setup.computers.intro")}),n.jsx(mle,{podman:i,wantsLocal:a,download:c.job,machine:d.job,onChooseLocal:()=>o(!0),onLater:t,onDownload:()=>{c.start("podman-download")},onCheck:()=>{r()},onStart:()=>{d.start("podman-machine")}}),n.jsx($i,{children:n.jsx("p",{children:l("setup.computers.what")})})]})}const gle=[{tag:"gemma4:e4b",label:"Gemma 4",sizeGb:6.6,note:"Google's model. Atomic's pick for Macs with 16 GB or more."},{tag:"gemma4:e2b-it-qat",label:"Gemma 4 (small)",sizeGb:4.3,note:"A lighter Gemma 4 for light tasks on 8 GB Macs."},{tag:"qwen3:4b",label:"Qwen 3 (4B)",sizeGb:2.5,note:"Small and quick. Good for simple tasks."},{tag:"qwen3:8b",label:"Qwen 3 (8B)",sizeGb:5.2,note:"A good everyday model for most Macs."},{tag:"llama3.1:8b",label:"Llama 3.1 (8B)",sizeGb:4.9,note:"Meta's general model. Steady with tools."},{tag:"granite3.3:8b",label:"Granite 3.3 (8B)",sizeGb:4.9,note:"IBM's business-focused model."},{tag:"qwen3:14b",label:"Qwen 3 (14B)",sizeGb:9.3,note:"Noticeably smarter. Needs 16 GB or more."},{tag:"gpt-oss:20b",label:"gpt-oss (20B)",sizeGb:14,note:"OpenAI's open model. Strong reasoning."},{tag:"devstral:24b",label:"Devstral (24B)",sizeGb:14,note:"Mistral's model for coding work."},{tag:"mistral-small3.2:24b",label:"Mistral Small 3.2 (24B)",sizeGb:15,note:"Mistral's general model."},{tag:"qwen3-coder:30b",label:"Qwen 3 Coder (30B)",sizeGb:19,note:"Built for coding and tools. Fast for its size."},{tag:"qwen3:32b",label:"Qwen 3 (32B)",sizeGb:20,note:"Qwen's largest dense model."},{tag:"gpt-oss:120b",label:"gpt-oss (120B)",sizeGb:65,note:"OpenAI's large open model. Needs 96 GB or more."}],t3=1024**3;function fle(e,t){return!(t>0)||e*1.25+6*t3<=t?"fits":e+3*t3<=t?"tight":"tooBig"}function ble(e){return Math.round(e.sizeGb*t3)}const yle=/^[a-z0-9][a-z0-9._/-]*(?::[a-z0-9][a-z0-9._-]*)?$/i;function xle(e){return typeof e=="string"&&e.length<=200&&yle.test(e)&&!e.includes("..")&&!e.includes("//")}function vle(e){return e.enabled?e.custom?"settings.localModels.memory.statusCustom":e.applied?"settings.localModels.memory.statusOn":"settings.localModels.memory.statusFailed":"settings.localModels.memory.statusOff"}function kle(){const e=typeof window<"u"?window.ogb?.ollamaMemory:void 0,[t,a]=f.useState(null),[o,i]=f.useState(!1);if(f.useEffect(()=>{if(!e)return;let r=!1;return e.state().then(c=>{r||a(c)}).catch(()=>{}),()=>{r=!0}},[e]),!e||!t?.supported)return null;const s=vle(t);return n.jsx("div",{className:"mt-4 border-t border-hairline/30 pt-1",children:n.jsx(Wt,{title:l("settings.localModels.memory.title"),subtitle:l("settings.localModels.memory.subtitle"),message:n.jsx("span",{className:s==="settings.localModels.memory.statusFailed"?"text-danger":"text-ink-secondary",children:l(s)}),children:n.jsx(Dt,{checked:t.enabled,disabled:o,"aria-label":l("settings.localModels.memory.title"),onClick:()=>{i(!0),e.set(!t.enabled).then(a).catch(()=>{}).finally(()=>i(!1))},className:"disabled:cursor-wait disabled:opacity-50"})})})}function wle({state:e,onDone:t}){const{job:a,start:o}=Cr(t);return a?.state==="running"?n.jsx("div",{className:"basis-full",children:n.jsx(Oi,{label:l(a.kind==="ollama-start"?"setup.localAi.phase.starting":"setup.localAi.phase.installing"),received:a.received,total:a.total})}):n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",onClick:()=>{o(e==="missing"?"ollama-install":"ollama-start")},className:"text-[12px] font-medium text-accent hover:underline",children:l(e==="missing"?"setup.localAi.installOllama":"setup.localAi.openOllama")}),a?.state==="failed"&&n.jsx("div",{className:"basis-full",children:n.jsx(ho,{message:Ml(a),detail:a.detail})})]})}const n3=1024**3,Wu="rounded-lg border border-hairline/40 px-3 py-1.5 text-[12px] text-ink-secondary hover:bg-raised/50 hover:text-ink disabled:cursor-not-allowed disabled:opacity-50",Sle="min-w-0 flex-1 rounded-lg border border-hairline/40 bg-inset px-3 py-2 text-[13px] text-ink placeholder:text-ink-secondary focus:border-hairline focus:outline-none disabled:opacity-50";function ax(e){return e>=n3?`${(e/n3).toFixed(1)} GB`:`${Math.max(1,Math.round(e/1024**2))} MB`}function Cle(e){const t=e.modifiedAt?new Date(e.modifiedAt):null;return[e.parameterSize,e.quantization,e.family,e.cloud?void 0:ax(e.sizeBytes),t&&!Number.isNaN(t.getTime())?t.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"}):void 0].filter(Boolean).join(" · ")}function jle(e){return e.total?Math.min(100,Math.round((e.completed??0)/e.total*100)):null}const Nle={fits:"settings.localModels.fit.fits",tight:"settings.localModels.fit.tight",tooBig:"settings.localModels.fit.tooBig"};function Ale(e,t){const a=[];for(const o of t){if(o.snapshot.state!=="available"||o.policy||o.readOnly)continue;const i=o.models.options.find(s=>s.id===`ollama::${e}`||s.id===`local_ollama::${e}`);i&&a.push({instance:o,modelId:i.id})}return a}async function $D(e,t){const a=e.getReader(),o=new TextDecoder;let i="";for(;;){const{value:s,done:r}=await a.read();i+=r?`${o.decode()}
87
87
  `:o.decode(s,{stream:!0});let c=i.indexOf(`
88
88
  `);for(;c>=0;){const d=i.slice(0,c).trim();if(i=i.slice(c+1),d)try{t(JSON.parse(d))}catch{}c=i.indexOf(`
89
89
  `)}if(r)return}}function Mle({model:e}){const{state:t,dispatch:a}=ve(),[o,i]=f.useState(!1),[s,r]=f.useState(""),[c,d]=f.useState(""),[p,h]=f.useState(null),g=Ale(e.name,t.instances),b=t.bots;if(!o)return n.jsx("button",{type:"button",onClick:()=>{i(!0),h(null)},className:Wu,children:l("settings.localModels.useForBot")});const x=g.find(k=>k.instance.instanceId===c)??g[0],v=b.find(k=>k.id===s)??b[0];return n.jsxs("div",{className:"mt-2 flex w-full flex-col gap-2 rounded-xl border border-hairline/40 p-3",children:[g.length===0||b.length===0?n.jsx("p",{className:"text-[12px] leading-relaxed text-ink-secondary",children:b.length===0?l("settings.localModels.useNoBots"):l("settings.localModels.useNoEngine")}):n.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[12px] text-ink-secondary",children:[n.jsxs("label",{className:"flex items-center gap-1.5",children:[l("settings.localModels.useBot"),n.jsx("select",{value:v?.id??"",onChange:k=>r(k.target.value),className:"rounded-lg border border-hairline/40 bg-inset px-2 py-1.5 text-[12px] text-ink",children:b.map(k=>n.jsx("option",{value:k.id,children:k.name},k.id))})]}),n.jsxs("label",{className:"flex items-center gap-1.5",children:[l("settings.localModels.useEngine"),n.jsx("select",{value:x?.instance.instanceId??"",onChange:k=>d(k.target.value),className:"rounded-lg border border-hairline/40 bg-inset px-2 py-1.5 text-[12px] text-ink",children:g.map(k=>n.jsx("option",{value:k.instance.instanceId,children:k.instance.displayName},k.instance.instanceId))})]}),n.jsx("button",{type:"button",disabled:!v||!x,onClick:()=>{!v||!x||(a({type:"setModel",botId:v.id,selection:{instanceId:x.instance.instanceId,model:x.modelId}}),h(l("settings.localModels.useDone",{bot:v.name,model:e.name})))},className:"rounded-lg bg-raised px-3 py-1.5 text-[12px] text-ink hover:bg-raised-hover disabled:opacity-50",children:l("settings.localModels.useConfirm")})]}),p&&n.jsx("p",{role:"status",className:"text-[12px] text-success",children:p}),n.jsx("button",{type:"button",onClick:()=>i(!1),className:"w-fit text-[12px] text-ink-secondary hover:text-ink",children:l("common.close")})]})}function Ile({model:e,onRemove:t,busy:a}){const o=e.usedBy.map(i=>i.name).join(", ");return n.jsxs("li",{className:"border-t border-hairline/30 py-2.5 first:border-t-0","data-local-model":e.name,children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1.5",children:[n.jsx("span",{className:"min-w-0 break-all font-mono text-[13px] text-ink",children:e.name}),e.cloud&&n.jsx("span",{className:"rounded bg-control px-1.5 py-0.5 text-[10.5px] font-medium text-ink-secondary",children:l("settings.localModels.cloud")}),n.jsx("span",{className:"flex-1"}),n.jsx(Mle,{model:e}),n.jsx("button",{type:"button",onClick:t,disabled:a||e.usedBy.length>0,title:e.usedBy.length?l("settings.localModels.removeInUse"):void 0,className:V(Wu,"text-danger hover:text-danger"),children:l("settings.localModels.remove")})]}),n.jsx("p",{className:"mt-0.5 text-[12px] text-ink-secondary",children:Cle(e)}),n.jsx("p",{className:"mt-0.5 text-[12px] text-ink-secondary",children:o?l("settings.localModels.usedBy",{names:o}):l("settings.localModels.unused")})]})}function Ple({pull:e,onCancel:t}){const a=jle(e),o=!e.done&&!e.error;return n.jsxs("div",{className:"mt-3 rounded-xl border border-hairline/40 p-3","aria-live":"polite",children:[n.jsxs("div",{className:"flex items-center gap-2 text-[12.5px] text-ink",children:[o&&n.jsx(Ie,{size:13,className:"animate-spin text-ink-secondary"}),n.jsx("span",{className:"min-w-0 flex-1 truncate",children:e.done?l("settings.localModels.pullDone",{name:e.name}):e.error?l("settings.localModels.pullFailed",{name:e.name}):l("settings.localModels.pulling",{name:e.name})}),o&&n.jsx("button",{type:"button",onClick:t,className:Wu,children:l("common.cancel")})]}),o&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"mt-2 h-1.5 overflow-hidden rounded-full bg-control",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":a??void 0,"aria-label":l("settings.localModels.pulling",{name:e.name}),children:n.jsx("div",{className:"h-full rounded-full bg-accent transition-[width] motion-reduce:transition-none",style:{width:`${a??0}%`}})}),n.jsx("p",{className:"mt-1 text-[11.5px] text-ink-secondary",children:a===null?e.status:l("settings.localModels.pullProgress",{percent:String(a),done:ax(e.completed??0),total:ax(e.total??0)})})]}),e.error&&n.jsx("p",{role:"alert",className:"mt-1 text-[12px] text-danger",children:e.error})]})}function Tle({listing:e,pulling:t,onPull:a}){const[o,i]=f.useState(""),s=new Set(e.ollama.models.map(c=>c.name)),r=xle(o.trim());return n.jsxs("div",{className:"mt-3 rounded-xl border border-hairline/40 p-3",children:[n.jsx("p",{className:"text-[12px] leading-relaxed text-ink-secondary",children:e.memoryBytes>0?l("settings.localModels.getIntroMemory",{memory:`${Math.round(e.memoryBytes/n3)} GB`}):l("settings.localModels.getIntro")}),n.jsx("ul",{className:"mt-2",children:gle.map(c=>{const d=fle(ble(c),e.memoryBytes),p=s.has(c.tag);return n.jsxs("li",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 border-t border-hairline/30 py-2 first:border-t-0","data-suggested-model":c.tag,children:[n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsxs("div",{className:"text-[13px] text-ink",children:[c.label," ",n.jsx("span",{className:"font-mono text-[12px] text-ink-secondary",children:c.tag})]}),n.jsxs("div",{className:"text-[12px] text-ink-secondary",children:[l("settings.localModels.about",{size:`${c.sizeGb} GB`})," · ",c.note]})]}),n.jsx("span",{className:V("text-[11.5px]",d==="fits"?"text-success":d==="tight"?"text-warning":"text-danger"),children:l(Nle[d])}),n.jsx("button",{type:"button",disabled:t||p,onClick:()=>a(c.tag),className:V(Wu,"flex items-center gap-1.5"),children:p?l("settings.localModels.installed"):n.jsxs(n.Fragment,{children:[n.jsx(pa,{size:12}),l("settings.localModels.download")]})})]},c.tag)})}),n.jsxs("form",{className:"mt-3 flex gap-2",onSubmit:c=>{c.preventDefault(),!(!r||t)&&(a(o.trim()),i(""))},children:[n.jsx("input",{value:o,onChange:c=>i(c.target.value),placeholder:l("settings.localModels.customPlaceholder"),"aria-label":l("settings.localModels.customLabel"),autoComplete:"off",spellCheck:!1,disabled:t,className:Sle}),n.jsxs("button",{type:"submit",disabled:t||!r,className:V(Wu,"flex shrink-0 items-center gap-1.5"),children:[n.jsx(pa,{size:12}),l("settings.localModels.download")]})]}),n.jsxs("a",{href:"https://ollama.com/search?c=tools",target:"_blank",rel:"noopener noreferrer",className:"mt-2 inline-flex items-center gap-1 text-[12px] text-accent hover:underline",children:[l("settings.localModels.browseOllama"),n.jsx(An,{size:11,"aria-hidden":"true"})]})]})}function Ble({listing:e,loadError:t,pull:a,removing:o,onRefresh:i,onPull:s,onCancelPull:r,onRemove:c}){const[d,p]=f.useState(!1),h=e?.ollama,g=!!(a&&!a.done&&!a.error);return n.jsxs(ut,{title:l("settings.localModels.title"),subtitle:l("settings.localModels.subtitle"),children:[n.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2 text-[12.5px]",children:[n.jsx("span",{className:V("size-1.5 rounded-full",h?.state==="running"?"bg-success":"bg-raised-hover")}),n.jsx("span",{className:"min-w-0 flex-1 text-ink-secondary",children:e?h?.state==="running"?h.version?l("settings.localModels.runningVersion",{version:h.version}):l("settings.localModels.running"):h?.state==="stopped"?l("settings.localModels.stopped"):l("settings.localModels.missing"):t??l("settings.localModels.checking")}),(h?.state==="missing"||h?.state==="stopped")&&n.jsx(wle,{state:h.state,onDone:i}),n.jsx("button",{type:"button",onClick:i,className:"rounded-lg p-1.5 text-ink-secondary hover:bg-raised hover:text-ink","aria-label":l("settings.localModels.refresh"),title:l("settings.localModels.refresh"),children:n.jsx(fn,{size:14})})]}),h?.error&&n.jsx("p",{role:"alert",className:"mt-1 text-[12px] text-danger",children:h.error}),h?.state==="running"&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"mt-3 text-[11.5px] font-medium uppercase tracking-wide text-ink-secondary",children:l("settings.localModels.installedTitle")}),h.models.length===0?n.jsx("p",{className:"mt-1 text-[12.5px] text-ink-secondary",children:l("settings.localModels.none")}):n.jsx("ul",{className:"mt-1",children:h.models.map(b=>n.jsx(Ile,{model:b,busy:o===b.name,onRemove:()=>c(b)},b.name))}),a&&n.jsx(Ple,{pull:a,onCancel:r}),n.jsxs("button",{type:"button",onClick:()=>p(!d),"aria-expanded":d,className:V(Wu,"mt-3 flex items-center gap-1.5"),children:[n.jsx(pa,{size:13}),l("settings.localModels.getModels")]}),d&&e&&n.jsx(Tle,{listing:e,pulling:g,onPull:s})]}),e&&e.others.length>0&&n.jsxs("div",{className:"mt-4",children:[n.jsx("div",{className:"text-[11.5px] font-medium uppercase tracking-wide text-ink-secondary",children:l("settings.localModels.othersTitle")}),e.others.map(b=>n.jsxs("p",{className:"mt-1 text-[12.5px] text-ink-secondary",children:[n.jsx("span",{className:"font-medium text-ink",children:b.label}),": ",b.models.join(", ")]},b.label))]}),n.jsx(kle,{})]})}function Ele(){const{refreshInstances:e}=ve(),[t,a]=f.useState(null),[o,i]=f.useState(null),[s,r]=f.useState(null),[c,d]=f.useState(null),[p,h]=f.useState(null),[g,b]=f.useState(null),x=f.useRef(null),v=f.useCallback(async()=>{try{a(await X("/api/local-models")),i(null)}catch(N){i(N instanceof Error?N.message:String(N))}},[]);f.useEffect(()=>{v()},[v]),f.useEffect(()=>()=>x.current?.abort(),[]);const k=async N=>{if(x.current)return;const C=new AbortController;x.current=C,r({name:N,status:""});try{const j=await fetch("/api/local-models/pull",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({name:N}),signal:C.signal});if(!j.ok||!j.body){const D=await j.json().catch(()=>({}));throw new Error(D.error??`${j.status} ${j.statusText}`)}let M={name:N,status:""};await $D(j.body,D=>{M={name:N,status:typeof D.status=="string"?D.status:M.status,total:typeof D.total=="number"?D.total:M.total,completed:typeof D.completed=="number"?D.completed:M.completed,...typeof D.error=="string"?{error:D.error}:{},...D.done===!0?{done:!0}:{}},r(M)}),!M.done&&!M.error&&r({...M,error:l("settings.localModels.pullStopped")}),M.done&&await Promise.all([v(),Promise.resolve(e()).catch(()=>{})])}catch(j){C.signal.aborted?r(null):r({name:N,status:"",error:j instanceof Error?j.message:String(j)})}finally{x.current=null}},S=async N=>{h(null),d(N.name),b(null);try{await X(`/api/local-models?name=${encodeURIComponent(N.name)}`,{method:"DELETE"}),await Promise.all([v(),Promise.resolve(e()).catch(()=>{})])}catch(C){b(C instanceof Error?C.message:String(C))}finally{d(null)}};return n.jsxs(n.Fragment,{children:[n.jsx(Ble,{listing:t,loadError:o,pull:s,removing:c,onRefresh:()=>{v()},onPull:N=>{k(N)},onCancelPull:()=>x.current?.abort(),onRemove:N=>h(N)}),g&&n.jsx("p",{role:"alert",className:"-mt-2 px-1 text-[12px] text-danger",children:g}),n.jsx(Oa,{open:p!==null,title:l("settings.localModels.removeTitle",{name:p?.name??""}),body:p?.cloud?l("settings.localModels.removeCloudBody"):l("settings.localModels.removeBody",{size:ax(p?.sizeBytes??0)}),confirmLabel:l("settings.localModels.remove"),onCancel:()=>h(null),onConfirm:()=>{p&&S(p)}})]})}function Rle({machine:e,backupFor:t=null,appleIntelligence:a=!1,installed:o,tools:i,ollamaJob:s,pull:r,onInstallOllama:c,onStartOllama:d,onCheck:p,onDownload:h,onCancelDownload:g}){if(!e)return n.jsx(Oi,{label:l("setup.localAi.checking")});const b=n.jsxs(n.Fragment,{children:[t&&n.jsx("p",{className:"mt-3 text-[13px] leading-relaxed text-ink",children:l("setup.localAi.backupFor",{plan:t})}),a&&e.platform==="darwin"&&n.jsx("p",{className:"mt-2 text-[12.5px] leading-relaxed text-ink-secondary",children:l("setup.localAi.appleIntelligence")})]}),x=e.localModel,v=Math.round(e.memoryBytes/1024**3);if(x.kind==="none")return n.jsxs(n.Fragment,{children:[b,n.jsxs("div",{className:"mt-4 rounded-xl border border-hairline/40 bg-card p-3.5",children:[n.jsx("span",{className:"inline-flex rounded-full bg-raised px-2 py-0.5 text-[11px] font-medium text-ink-secondary",children:l("setup.optional")}),n.jsx("p",{className:"mt-2 text-[13px] leading-relaxed text-ink",children:x.reason==="intel"?l("setup.localAi.intel"):l("setup.localAi.lowMemory",{gb:v})})]})]});const k=s?.state==="running",S=x.model,N=r&&r.error===void 0&&!r.cancelled&&!(r.total&&r.received===r.total);return n.jsxs(n.Fragment,{children:[b,n.jsxs("div",{className:"mt-4 space-y-3",children:[n.jsxs("div",{className:"rounded-xl border border-hairline/40 bg-card p-3.5","data-ollama":e.ollama,children:[n.jsx("div",{className:"text-[12px] font-semibold uppercase tracking-wide text-ink-secondary",children:l("setup.localAi.ollamaTitle")}),e.ollama==="running"&&n.jsx(Xc,{children:l("setup.localAi.ollamaReady")}),e.ollama==="stopped"&&s?.state!=="running"&&n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"mt-1.5 text-[13px] leading-relaxed text-ink",children:l("setup.localAi.ollamaStopped")}),n.jsxs("div",{className:"mt-2 flex flex-wrap gap-2",children:[n.jsx("button",{type:"button",onClick:d,className:Ha,children:l("setup.localAi.openOllama")}),n.jsxs("button",{type:"button",onClick:p,className:Za,children:[n.jsx(fn,{size:13,"aria-hidden":"true"}),l("common.checkAgain")]})]}),s?.kind==="ollama-start"&&s.state==="failed"&&n.jsx(ho,{message:Ml(s),detail:s.detail,onRetry:d})]}),e.ollama==="missing"&&!k&&s?.state!=="failed"&&n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"mt-1.5 text-[13px] leading-relaxed text-ink",children:l("setup.localAi.ollamaMissing")}),n.jsxs("button",{type:"button",onClick:c,className:V(Ha,"mt-3 w-full"),children:[n.jsx(pa,{size:14,"aria-hidden":"true"}),l("setup.localAi.installOllama")]}),n.jsx("p",{className:"mt-1.5 text-center text-[11px] text-ink-secondary",children:l("setup.localAi.installOllamaNote")})]}),k&&n.jsxs(n.Fragment,{children:[n.jsx(Oi,{label:l(s.kind==="ollama-start"?"setup.localAi.phase.starting":s.phase==="downloading"?"setup.localAi.phase.downloading":s.phase==="verifying"?"setup.localAi.phase.verifying":s.phase==="starting"?"setup.localAi.phase.starting":"setup.localAi.phase.installing"),received:s.received,total:s.total}),n.jsx(md,{detail:s.detail})]}),e.ollama==="missing"&&s?.state==="failed"&&n.jsx(ho,{message:Ml(s),detail:s.detail,onRetry:c})]}),n.jsxs("div",{className:V("rounded-xl border border-hairline/40 bg-card p-3.5",e.ollama!=="running"&&"opacity-60"),"data-model":S.tag,children:[n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-lg bg-inset text-ink-secondary",children:n.jsx(DB,{size:18,"aria-hidden":"true"})}),n.jsxs("div",{className:"min-w-0",children:[n.jsx("p",{className:"text-[13.5px] font-semibold text-ink",children:x.kind==="default"?l("setup.localAi.recommendDefault",{gb:v}):l("setup.localAi.recommendOptional",{gb:v})}),n.jsx("p",{className:"mt-0.5 text-[12.5px] leading-relaxed text-ink-secondary",children:l(x.kind==="default"?"setup.localAi.modelLine":"setup.localAi.modelLineLight",{name:S.label,size:String(S.sizeGb)})})]})]}),o?n.jsxs(n.Fragment,{children:[n.jsx(Xc,{children:l("setup.localAi.modelReady",{name:S.label})}),i===!1&&n.jsx("p",{className:"mt-1.5 text-[12px] text-ink-secondary",children:l("setup.localAi.chatOnly")})]}):N?n.jsxs(n.Fragment,{children:[n.jsx(Oi,{label:l("setup.localAi.downloadingModel",{name:S.label}),received:r.received,total:r.total}),n.jsx("button",{type:"button",onClick:g,className:V(Za,"mt-2"),children:l("common.cancel")})]}):n.jsxs(n.Fragment,{children:[n.jsxs("button",{type:"button",disabled:e.ollama!=="running",onClick:h,className:V(x.kind==="default"?Ha:Za,"mt-3 w-full"),children:[n.jsx(pa,{size:14,"aria-hidden":"true"}),l("setup.localAi.download",{name:S.label,size:String(S.sizeGb)})]}),r?.cancelled&&n.jsx("p",{className:"mt-1.5 text-[12px] text-ink-secondary",children:l("setup.localAi.cancelled")}),r?.error&&n.jsx(ho,{message:l("setup.localAi.pullFailed"),detail:r.error,onRetry:h})]})]})]})]})}function Dle({onReady:e,backupFor:t=null}){const{state:a,refreshInstances:o}=ve(),i=a.instances.some(j=>j.driverKind==="appleIntelligence"&&j.snapshot.state==="available"),[s,r]=f.useState(null),[c,d]=f.useState(null),[p,h]=f.useState(null),[g,b]=f.useState(null),x=f.useRef(null),v=f.useCallback(async()=>{const[j,M]=await Promise.all([X("/api/setup/machine",{timeoutMs:15e3}).catch(()=>null),X("/api/local-models",{timeoutMs:15e3}).catch(()=>null)]);j&&r(j),d(M)},[]);f.useEffect(()=>(v(),()=>x.current?.abort()),[v]);const k=Cr(()=>{v()}),S=s&&s.localModel.kind!=="none"?s.localModel.model.tag:null,N=!!(S&&c?.ollama.models.some(j=>j.name===S));f.useEffect(()=>{!N||!S||(e(),X(`/api/setup/model-capabilities?name=${encodeURIComponent(S)}`,{timeoutMs:1e4}).then(j=>h(j.tools)).catch(()=>h(null)))},[N,S]);const C=async()=>{if(!S)return;x.current?.abort();const j=new AbortController;x.current=j,b({});try{const M=await fetch("/api/local-models/pull",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({name:S}),signal:j.signal});if(!M.ok||!M.body){const A=await M.json().catch(()=>({}));b({error:A.error??`${M.status}`});return}let D;await $D(M.body,A=>{typeof A.error=="string"?D=A.error:typeof A.total=="number"&&b({total:A.total,received:typeof A.completed=="number"?A.completed:0})}),D?b({error:D}):(b(null),await v(),await o().catch(()=>{}))}catch(M){j.signal.aborted?b({cancelled:!0}):b({error:M instanceof Error?M.message:String(M)})}};return n.jsxs("div",{className:"flex flex-col",children:[n.jsx("p",{className:"text-[14px] leading-relaxed text-ink-secondary",children:l("setup.localAi.intro")}),n.jsx(Rle,{backupFor:t,appleIntelligence:i,machine:s&&c?{...s,ollama:c.ollama.state}:s,installed:N,tools:p,ollamaJob:k.job,pull:g,onInstallOllama:()=>{k.start("ollama-install")},onStartOllama:()=>{k.start("ollama-start")},onCheck:()=>{v()},onDownload:()=>{C()},onCancelDownload:()=>x.current?.abort()}),n.jsxs($i,{children:[n.jsx("p",{children:l("setup.localAi.what1")}),n.jsx("p",{children:l("setup.localAi.what2")})]})]})}function $7(e){return e==="granted"?"granted":e==="denied"||e==="restricted"?"denied":e==="not-determined"?"not-determined":"unknown"}function K7({pane:e}){const t=l(e==="mic"?"setup.permissions.pictureMic":"setup.permissions.pictureScreen");return n.jsxs("figure",{className:"mt-3",children:[n.jsxs("svg",{viewBox:"0 0 320 150",role:"img","aria-label":t,className:"w-full rounded-lg border border-hairline/40 bg-app",children:[n.jsx("rect",{x:"0",y:"0",width:"320",height:"150",rx:"8",className:"fill-panel"}),n.jsx("rect",{x:"0",y:"0",width:"92",height:"150",rx:"8",className:"fill-inset"}),n.jsx("circle",{cx:"12",cy:"12",r:"3.5",fill:"#ff5f57"}),n.jsx("circle",{cx:"23",cy:"12",r:"3.5",fill:"#febc2e"}),n.jsx("circle",{cx:"34",cy:"12",r:"3.5",fill:"#28c840"}),n.jsx("text",{x:"10",y:"40",fontSize:"8",className:"fill-ink-secondary",children:l("setup.permissions.pictureGeneral")}),n.jsx("rect",{x:"6",y:"52",width:"80",height:"16",rx:"4",className:"fill-accent",opacity:"0.18"}),n.jsx("text",{x:"10",y:"63",fontSize:"8",fontWeight:"600",className:"fill-ink",children:l("setup.permissions.picturePrivacy")}),n.jsx("text",{x:"10",y:"84",fontSize:"8",className:"fill-ink-secondary",children:l("setup.permissions.pictureNotifications")}),n.jsx("text",{x:"104",y:"24",fontSize:"10",fontWeight:"700",className:"fill-ink",children:l(e==="mic"?"setup.permissions.mic":"setup.permissions.screen")}),[0,1,2].map(a=>n.jsxs("g",{transform:`translate(104 ${40+a*30})`,children:[n.jsx("rect",{width:"204",height:"24",rx:"5",className:a===1?"fill-accent":"fill-inset",opacity:a===1?.12:1}),n.jsx("rect",{x:"8",y:"6",width:"12",height:"12",rx:"3",className:a===1?"fill-accent":"fill-hairline"}),n.jsx("text",{x:"26",y:"16",fontSize:"8.5",fontWeight:a===1?700:400,className:"fill-ink",children:a===1?"Atomic":a===0?"Notes":"Zoom"}),n.jsx("rect",{x:"172",y:"6",width:"22",height:"12",rx:"6",fill:a===1?"#34c759":"#8e8e93",opacity:a===1?1:.4}),n.jsx("circle",{cx:a===1?188:178,cy:"12",r:"5",fill:"#fff"})]},a)),n.jsx("circle",{cx:"287",cy:"82",r:"15",fill:"none",stroke:"#ff3b30",strokeWidth:"2"})]}),n.jsx("figcaption",{className:"mt-1.5 text-[11.5px] leading-relaxed text-ink-secondary",children:l(e==="mic"?"setup.permissions.captionMic":"setup.permissions.captionScreen")})]})}function Ole({mic:e,why:t,onWhy:a,onAllowMic:o,onOpenSettings:i,screenOpened:s}){return n.jsxs("div",{className:"mt-4 flex flex-col gap-3",children:[n.jsxs("div",{className:"rounded-xl border border-hairline/40 bg-card p-3.5","data-permission":"mic","data-status":e,children:[n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx(vg,{size:18,className:"mt-0.5 shrink-0 text-ink-secondary","aria-hidden":"true"}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsxs("div",{className:"flex items-center gap-2 text-[14px] font-semibold text-ink",children:[l("setup.permissions.mic"),e==="granted"&&n.jsx(gt,{size:15,className:"text-success","aria-label":l("setup.permissions.on")})]}),n.jsx("p",{className:"mt-0.5 text-[12.5px] leading-relaxed text-ink-secondary",children:l("setup.permissions.micWhy")})]})]}),e!=="granted"&&t!=="mic"&&e!=="denied"&&n.jsx("button",{type:"button",onClick:()=>a("mic"),className:V(Za,"mt-3"),children:l("setup.permissions.turnOn")}),t==="mic"&&e==="not-determined"&&n.jsxs("div",{className:"mt-3 rounded-lg bg-inset p-3",children:[n.jsx("p",{className:"text-[12.5px] leading-relaxed text-ink",children:l("setup.permissions.micBeforeAsk")}),n.jsx("button",{type:"button",onClick:o,className:V(Ha,"mt-2.5"),children:l("setup.permissions.askMac")})]}),(e==="denied"||t==="mic"&&e==="unknown")&&n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"mt-3 text-[12.5px] leading-relaxed text-ink",children:l("setup.permissions.micDenied")}),n.jsx(K7,{pane:"mic"}),n.jsxs("button",{type:"button",onClick:()=>i("mic"),className:V(Ha,"mt-2.5"),children:[n.jsx(Oh,{size:14,"aria-hidden":"true"}),l("setup.permissions.openSettings")]})]})]}),n.jsxs("div",{className:"rounded-xl border border-hairline/40 bg-card p-3.5","data-permission":"screen",children:[n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx(KJ,{size:18,className:"mt-0.5 shrink-0 text-ink-secondary","aria-hidden":"true"}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"text-[14px] font-semibold text-ink",children:l("setup.permissions.screen")}),n.jsx("p",{className:"mt-0.5 text-[12.5px] leading-relaxed text-ink-secondary",children:l("setup.permissions.screenWhy")})]})]}),t!=="screen"?n.jsx("button",{type:"button",onClick:()=>a("screen"),className:V(Za,"mt-3"),children:l("setup.permissions.turnOn")}):n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"mt-3 text-[12.5px] leading-relaxed text-ink",children:l("setup.permissions.screenHow")}),n.jsx(K7,{pane:"screen"}),n.jsxs("button",{type:"button",onClick:()=>i("screen"),className:V(Ha,"mt-2.5"),children:[n.jsx(Oh,{size:14,"aria-hidden":"true"}),l("setup.permissions.openSettings")]}),s&&n.jsx("p",{role:"status",className:"mt-2 text-[12px] text-ink-secondary",children:l("setup.permissions.screenAfter")})]})]})]})}function zle({onGranted:e}){const[t,a]=f.useState("unknown"),[o,i]=f.useState(null),[s,r]=f.useState(!1);return f.useEffect(()=>{const c=()=>window.ogb?.permStatus?.().then(p=>a($7(p.mic))).catch(()=>{});c();const d=window.setInterval(c,2e3);return()=>window.clearInterval(d)},[]),f.useEffect(()=>{t==="granted"&&e()},[t]),n.jsxs("div",{className:"flex flex-col",children:[n.jsx("p",{className:"text-[14px] leading-relaxed text-ink-secondary",children:l("setup.permissions.intro")}),n.jsx(Ole,{mic:t,why:o,onWhy:i,onAllowMic:()=>{window.ogb?.permRequestMic?.().then(()=>window.ogb?.permStatus?.().then(c=>a($7(c.mic))))},onOpenSettings:c=>{window.ogb?.permOpenSettings?.(c),c==="screen"&&r(!0)},screenOpened:s}),n.jsx($i,{children:n.jsx("p",{children:l("setup.permissions.what")})})]})}function Lle({className:e}){return n.jsxs("div",{className:V("relative",e),"aria-hidden":"true",children:[n.jsx("div",{className:"absolute inset-x-6 bottom-2 top-6 rounded-[40px] bg-accent/20 blur-2xl"}),n.jsx("div",{className:"relative mx-auto w-[168px] rounded-[30px] border border-hairline/60 bg-panel p-[6px] shadow-[0_28px_60px_-24px_rgba(0,0,0,0.6),0_1px_0_rgba(255,255,255,0.06)_inset]",children:n.jsxs("div",{className:"overflow-hidden rounded-[24px] bg-app",children:[n.jsxs("div",{className:"relative flex h-7 items-center justify-between px-4 text-[8px] font-medium tabular-nums text-ink",children:[n.jsx("span",{children:"9:41"}),n.jsx("span",{className:"absolute left-1/2 top-1.5 h-3.5 w-12 -translate-x-1/2 rounded-full bg-panel"}),n.jsx("span",{className:"flex items-center gap-0.5",children:n.jsx("span",{className:"h-1.5 w-2.5 rounded-[2px] border border-ink/70"})})]}),n.jsxs("div",{className:"flex items-center gap-1.5 border-b border-hairline/40 px-3 py-1.5",children:[n.jsx(ia,{color:"green",state:"happy",size:16,animated:!1,trackPointer:!1}),n.jsx("span",{className:"text-[9.5px] font-semibold text-ink",children:"Chibi"}),n.jsx("span",{className:"ml-auto size-1.5 rounded-full bg-success"})]}),n.jsxs("div",{className:"flex flex-col gap-1.5 px-2.5 py-2.5",children:[n.jsx("div",{className:"max-w-[112px] self-end rounded-xl rounded-br-sm bg-bubble-user px-2 py-1.5 text-[8.5px] leading-snug text-ink",children:"Book the 3 pm slot"}),n.jsx("div",{className:"max-w-[124px] rounded-xl rounded-tl-sm bg-card px-2 py-1.5 text-[8.5px] leading-snug text-ink",children:"Found it. Confirm the booking?"}),n.jsxs("div",{className:"rounded-lg border border-hairline/50 bg-card p-2",children:[n.jsx("div",{className:"text-[8px] font-medium text-ink",children:"Run: book-slot"}),n.jsx("div",{className:"mt-0.5 text-[7.5px] text-ink-secondary",children:"clinic.example · 3:00 pm"}),n.jsxs("div",{className:"mt-1.5 flex gap-1",children:[n.jsxs("span",{className:"flex flex-1 items-center justify-center gap-0.5 rounded-md bg-accent py-1 text-[8px] font-semibold text-white",children:[n.jsx(gt,{size:8,strokeWidth:3})," Allow"]}),n.jsxs("span",{className:"flex flex-1 items-center justify-center gap-0.5 rounded-md bg-raised py-1 text-[8px] font-medium text-ink",children:[n.jsx(Nt,{size:8,strokeWidth:3})," Deny"]})]})]})]}),n.jsxs("div",{className:"mx-2.5 mb-2.5 rounded-full border border-hairline/40 bg-inset px-2.5 py-1.5 text-[8px] text-ink-secondary",children:["Message ",Ga().name==="Atomic"?"Chibi":Ga().name]})]})})]})}var Fle=Object.defineProperty,ox=Object.getOwnPropertySymbols,KD=Object.prototype.hasOwnProperty,WD=Object.prototype.propertyIsEnumerable,W7=(e,t,a)=>t in e?Fle(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,a3=(e,t)=>{for(var a in t||(t={}))KD.call(t,a)&&W7(e,a,t[a]);if(ox)for(var a of ox(t))WD.call(t,a)&&W7(e,a,t[a]);return e},o3=(e,t)=>{var a={};for(var o in e)KD.call(e,o)&&t.indexOf(o)<0&&(a[o]=e[o]);if(e!=null&&ox)for(var o of ox(e))t.indexOf(o)<0&&WD.call(e,o)&&(a[o]=e[o]);return a};var od;(e=>{const t=class ln{constructor(d,p,h,g){if(this.version=d,this.errorCorrectionLevel=p,this.modules=[],this.isFunction=[],d<ln.MIN_VERSION||d>ln.MAX_VERSION)throw new RangeError("Version value out of range");if(g<-1||g>7)throw new RangeError("Mask value out of range");this.size=d*4+17;let b=[];for(let v=0;v<this.size;v++)b.push(!1);for(let v=0;v<this.size;v++)this.modules.push(b.slice()),this.isFunction.push(b.slice());this.drawFunctionPatterns();const x=this.addEccAndInterleave(h);if(this.drawCodewords(x),g==-1){let v=1e9;for(let k=0;k<8;k++){this.applyMask(k),this.drawFormatBits(k);const S=this.getPenaltyScore();S<v&&(g=k,v=S),this.applyMask(k)}}i(0<=g&&g<=7),this.mask=g,this.applyMask(g),this.drawFormatBits(g),this.isFunction=[]}static encodeText(d,p){const h=e.QrSegment.makeSegments(d);return ln.encodeSegments(h,p)}static encodeBinary(d,p){const h=e.QrSegment.makeBytes(d);return ln.encodeSegments([h],p)}static encodeSegments(d,p,h=1,g=40,b=-1,x=!0){if(!(ln.MIN_VERSION<=h&&h<=g&&g<=ln.MAX_VERSION)||b<-1||b>7)throw new RangeError("Invalid value");let v,k;for(v=h;;v++){const j=ln.getNumDataCodewords(v,p)*8,M=r.getTotalBits(d,v);if(M<=j){k=M;break}if(v>=g)throw new RangeError("Data too long")}for(const j of[ln.Ecc.MEDIUM,ln.Ecc.QUARTILE,ln.Ecc.HIGH])x&&k<=ln.getNumDataCodewords(v,j)*8&&(p=j);let S=[];for(const j of d){a(j.mode.modeBits,4,S),a(j.numChars,j.mode.numCharCountBits(v),S);for(const M of j.getData())S.push(M)}i(S.length==k);const N=ln.getNumDataCodewords(v,p)*8;i(S.length<=N),a(0,Math.min(4,N-S.length),S),a(0,(8-S.length%8)%8,S),i(S.length%8==0);for(let j=236;S.length<N;j^=253)a(j,8,S);let C=[];for(;C.length*8<S.length;)C.push(0);return S.forEach((j,M)=>C[M>>>3]|=j<<7-(M&7)),new ln(v,p,C,b)}getModule(d,p){return 0<=d&&d<this.size&&0<=p&&p<this.size&&this.modules[p][d]}getModules(){return this.modules}drawFunctionPatterns(){for(let h=0;h<this.size;h++)this.setFunctionModule(6,h,h%2==0),this.setFunctionModule(h,6,h%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const d=this.getAlignmentPatternPositions(),p=d.length;for(let h=0;h<p;h++)for(let g=0;g<p;g++)h==0&&g==0||h==0&&g==p-1||h==p-1&&g==0||this.drawAlignmentPattern(d[h],d[g]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(d){const p=this.errorCorrectionLevel.formatBits<<3|d;let h=p;for(let b=0;b<10;b++)h=h<<1^(h>>>9)*1335;const g=(p<<10|h)^21522;i(g>>>15==0);for(let b=0;b<=5;b++)this.setFunctionModule(8,b,o(g,b));this.setFunctionModule(8,7,o(g,6)),this.setFunctionModule(8,8,o(g,7)),this.setFunctionModule(7,8,o(g,8));for(let b=9;b<15;b++)this.setFunctionModule(14-b,8,o(g,b));for(let b=0;b<8;b++)this.setFunctionModule(this.size-1-b,8,o(g,b));for(let b=8;b<15;b++)this.setFunctionModule(8,this.size-15+b,o(g,b));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let d=this.version;for(let h=0;h<12;h++)d=d<<1^(d>>>11)*7973;const p=this.version<<12|d;i(p>>>18==0);for(let h=0;h<18;h++){const g=o(p,h),b=this.size-11+h%3,x=Math.floor(h/3);this.setFunctionModule(b,x,g),this.setFunctionModule(x,b,g)}}drawFinderPattern(d,p){for(let h=-4;h<=4;h++)for(let g=-4;g<=4;g++){const b=Math.max(Math.abs(g),Math.abs(h)),x=d+g,v=p+h;0<=x&&x<this.size&&0<=v&&v<this.size&&this.setFunctionModule(x,v,b!=2&&b!=4)}}drawAlignmentPattern(d,p){for(let h=-2;h<=2;h++)for(let g=-2;g<=2;g++)this.setFunctionModule(d+g,p+h,Math.max(Math.abs(g),Math.abs(h))!=1)}setFunctionModule(d,p,h){this.modules[p][d]=h,this.isFunction[p][d]=!0}addEccAndInterleave(d){const p=this.version,h=this.errorCorrectionLevel;if(d.length!=ln.getNumDataCodewords(p,h))throw new RangeError("Invalid argument");const g=ln.NUM_ERROR_CORRECTION_BLOCKS[h.ordinal][p],b=ln.ECC_CODEWORDS_PER_BLOCK[h.ordinal][p],x=Math.floor(ln.getNumRawDataModules(p)/8),v=g-x%g,k=Math.floor(x/g);let S=[];const N=ln.reedSolomonComputeDivisor(b);for(let j=0,M=0;j<g;j++){let D=d.slice(M,M+k-b+(j<v?0:1));M+=D.length;const A=ln.reedSolomonComputeRemainder(D,N);j<v&&D.push(0),S.push(D.concat(A))}let C=[];for(let j=0;j<S[0].length;j++)S.forEach((M,D)=>{(j!=k-b||D>=v)&&C.push(M[j])});return i(C.length==x),C}drawCodewords(d){if(d.length!=Math.floor(ln.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let p=0;for(let h=this.size-1;h>=1;h-=2){h==6&&(h=5);for(let g=0;g<this.size;g++)for(let b=0;b<2;b++){const x=h-b,k=(h+1&2)==0?this.size-1-g:g;!this.isFunction[k][x]&&p<d.length*8&&(this.modules[k][x]=o(d[p>>>3],7-(p&7)),p++)}}i(p==d.length*8)}applyMask(d){if(d<0||d>7)throw new RangeError("Mask value out of range");for(let p=0;p<this.size;p++)for(let h=0;h<this.size;h++){let g;switch(d){case 0:g=(h+p)%2==0;break;case 1:g=p%2==0;break;case 2:g=h%3==0;break;case 3:g=(h+p)%3==0;break;case 4:g=(Math.floor(h/3)+Math.floor(p/2))%2==0;break;case 5:g=h*p%2+h*p%3==0;break;case 6:g=(h*p%2+h*p%3)%2==0;break;case 7:g=((h+p)%2+h*p%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[p][h]&&g&&(this.modules[p][h]=!this.modules[p][h])}}getPenaltyScore(){let d=0;for(let b=0;b<this.size;b++){let x=!1,v=0,k=[0,0,0,0,0,0,0];for(let S=0;S<this.size;S++)this.modules[b][S]==x?(v++,v==5?d+=ln.PENALTY_N1:v>5&&d++):(this.finderPenaltyAddHistory(v,k),x||(d+=this.finderPenaltyCountPatterns(k)*ln.PENALTY_N3),x=this.modules[b][S],v=1);d+=this.finderPenaltyTerminateAndCount(x,v,k)*ln.PENALTY_N3}for(let b=0;b<this.size;b++){let x=!1,v=0,k=[0,0,0,0,0,0,0];for(let S=0;S<this.size;S++)this.modules[S][b]==x?(v++,v==5?d+=ln.PENALTY_N1:v>5&&d++):(this.finderPenaltyAddHistory(v,k),x||(d+=this.finderPenaltyCountPatterns(k)*ln.PENALTY_N3),x=this.modules[S][b],v=1);d+=this.finderPenaltyTerminateAndCount(x,v,k)*ln.PENALTY_N3}for(let b=0;b<this.size-1;b++)for(let x=0;x<this.size-1;x++){const v=this.modules[b][x];v==this.modules[b][x+1]&&v==this.modules[b+1][x]&&v==this.modules[b+1][x+1]&&(d+=ln.PENALTY_N2)}let p=0;for(const b of this.modules)p=b.reduce((x,v)=>x+(v?1:0),p);const h=this.size*this.size,g=Math.ceil(Math.abs(p*20-h*10)/h)-1;return i(0<=g&&g<=9),d+=g*ln.PENALTY_N4,i(0<=d&&d<=2568888),d}getAlignmentPatternPositions(){if(this.version==1)return[];{const d=Math.floor(this.version/7)+2,p=this.version==32?26:Math.ceil((this.version*4+4)/(d*2-2))*2;let h=[6];for(let g=this.size-7;h.length<d;g-=p)h.splice(1,0,g);return h}}static getNumRawDataModules(d){if(d<ln.MIN_VERSION||d>ln.MAX_VERSION)throw new RangeError("Version number out of range");let p=(16*d+128)*d+64;if(d>=2){const h=Math.floor(d/7)+2;p-=(25*h-10)*h-55,d>=7&&(p-=36)}return i(208<=p&&p<=29648),p}static getNumDataCodewords(d,p){return Math.floor(ln.getNumRawDataModules(d)/8)-ln.ECC_CODEWORDS_PER_BLOCK[p.ordinal][d]*ln.NUM_ERROR_CORRECTION_BLOCKS[p.ordinal][d]}static reedSolomonComputeDivisor(d){if(d<1||d>255)throw new RangeError("Degree out of range");let p=[];for(let g=0;g<d-1;g++)p.push(0);p.push(1);let h=1;for(let g=0;g<d;g++){for(let b=0;b<p.length;b++)p[b]=ln.reedSolomonMultiply(p[b],h),b+1<p.length&&(p[b]^=p[b+1]);h=ln.reedSolomonMultiply(h,2)}return p}static reedSolomonComputeRemainder(d,p){let h=p.map(g=>0);for(const g of d){const b=g^h.shift();h.push(0),p.forEach((x,v)=>h[v]^=ln.reedSolomonMultiply(x,b))}return h}static reedSolomonMultiply(d,p){if(d>>>8||p>>>8)throw new RangeError("Byte out of range");let h=0;for(let g=7;g>=0;g--)h=h<<1^(h>>>7)*285,h^=(p>>>g&1)*d;return i(h>>>8==0),h}finderPenaltyCountPatterns(d){const p=d[1];i(p<=this.size*3);const h=p>0&&d[2]==p&&d[3]==p*3&&d[4]==p&&d[5]==p;return(h&&d[0]>=p*4&&d[6]>=p?1:0)+(h&&d[6]>=p*4&&d[0]>=p?1:0)}finderPenaltyTerminateAndCount(d,p,h){return d&&(this.finderPenaltyAddHistory(p,h),p=0),p+=this.size,this.finderPenaltyAddHistory(p,h),this.finderPenaltyCountPatterns(h)}finderPenaltyAddHistory(d,p){p[0]==0&&(d+=this.size),p.pop(),p.unshift(d)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function a(c,d,p){if(d<0||d>31||c>>>d)throw new RangeError("Value out of range");for(let h=d-1;h>=0;h--)p.push(c>>>h&1)}function o(c,d){return(c>>>d&1)!=0}function i(c){if(!c)throw new Error("Assertion error")}const s=class ua{constructor(d,p,h){if(this.mode=d,this.numChars=p,this.bitData=h,p<0)throw new RangeError("Invalid argument");this.bitData=h.slice()}static makeBytes(d){let p=[];for(const h of d)a(h,8,p);return new ua(ua.Mode.BYTE,d.length,p)}static makeNumeric(d){if(!ua.isNumeric(d))throw new RangeError("String contains non-numeric characters");let p=[];for(let h=0;h<d.length;){const g=Math.min(d.length-h,3);a(parseInt(d.substring(h,h+g),10),g*3+1,p),h+=g}return new ua(ua.Mode.NUMERIC,d.length,p)}static makeAlphanumeric(d){if(!ua.isAlphanumeric(d))throw new RangeError("String contains unencodable characters in alphanumeric mode");let p=[],h;for(h=0;h+2<=d.length;h+=2){let g=ua.ALPHANUMERIC_CHARSET.indexOf(d.charAt(h))*45;g+=ua.ALPHANUMERIC_CHARSET.indexOf(d.charAt(h+1)),a(g,11,p)}return h<d.length&&a(ua.ALPHANUMERIC_CHARSET.indexOf(d.charAt(h)),6,p),new ua(ua.Mode.ALPHANUMERIC,d.length,p)}static makeSegments(d){return d==""?[]:ua.isNumeric(d)?[ua.makeNumeric(d)]:ua.isAlphanumeric(d)?[ua.makeAlphanumeric(d)]:[ua.makeBytes(ua.toUtf8ByteArray(d))]}static makeEci(d){let p=[];if(d<0)throw new RangeError("ECI assignment value out of range");if(d<128)a(d,8,p);else if(d<16384)a(2,2,p),a(d,14,p);else if(d<1e6)a(6,3,p),a(d,21,p);else throw new RangeError("ECI assignment value out of range");return new ua(ua.Mode.ECI,0,p)}static isNumeric(d){return ua.NUMERIC_REGEX.test(d)}static isAlphanumeric(d){return ua.ALPHANUMERIC_REGEX.test(d)}getData(){return this.bitData.slice()}static getTotalBits(d,p){let h=0;for(const g of d){const b=g.mode.numCharCountBits(p);if(g.numChars>=1<<b)return 1/0;h+=4+b+g.bitData.length}return h}static toUtf8ByteArray(d){d=encodeURI(d);let p=[];for(let h=0;h<d.length;h++)d.charAt(h)!="%"?p.push(d.charCodeAt(h)):(p.push(parseInt(d.substring(h+1,h+3),16)),h+=2);return p}};s.NUMERIC_REGEX=/^[0-9]*$/,s.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,s.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let r=s;e.QrSegment=s})(od||(od={}));(e=>{(t=>{const a=class{constructor(i,s){this.ordinal=i,this.formatBits=s}};a.LOW=new a(0,1),a.MEDIUM=new a(1,0),a.QUARTILE=new a(2,3),a.HIGH=new a(3,2),t.Ecc=a})(e.QrCode||(e.QrCode={}))})(od||(od={}));(e=>{(t=>{const a=class{constructor(i,s){this.modeBits=i,this.numBitsCharCount=s}numCharCountBits(i){return this.numBitsCharCount[Math.floor((i+7)/17)]}};a.NUMERIC=new a(1,[10,12,14]),a.ALPHANUMERIC=new a(2,[9,11,13]),a.BYTE=new a(4,[8,16,16]),a.KANJI=new a(8,[8,10,12]),a.ECI=new a(7,[0,0,0]),t.Mode=a})(e.QrSegment||(e.QrSegment={}))})(od||(od={}));var Su=od;var _le={L:Su.QrCode.Ecc.LOW,M:Su.QrCode.Ecc.MEDIUM,Q:Su.QrCode.Ecc.QUARTILE,H:Su.QrCode.Ecc.HIGH},JD=128,YD="L",ZD="#FFFFFF",QD="#000000",XD=!1,eO=1,qle=4,Ule=0,Vle=.1;function tO(e,t=0){const a=[];return e.forEach(function(o,i){let s=null;o.forEach(function(r,c){if(!r&&s!==null){a.push(`M${s+t} ${i+t}h${c-s}v1H${s+t}z`),s=null;return}if(c===o.length-1){if(!r)return;s===null?a.push(`M${c+t},${i+t} h1v1H${c+t}z`):a.push(`M${s+t},${i+t} h${c+1-s}v1H${s+t}z`);return}r&&s===null&&(s=c)})}),a.join("")}function nO(e,t){return e.slice().map((a,o)=>o<t.y||o>=t.y+t.h?a:a.map((i,s)=>s<t.x||s>=t.x+t.w?i:!1))}function Hle(e,t,a,o){if(o==null)return null;const i=e.length+a*2,s=Math.floor(t*Vle),r=i/t,c=(o.width||s)*r,d=(o.height||s)*r,p=o.x==null?e.length/2-c/2:o.x*r,h=o.y==null?e.length/2-d/2:o.y*r,g=o.opacity==null?1:o.opacity;let b=null;if(o.excavate){let v=Math.floor(p),k=Math.floor(h),S=Math.ceil(c+p-v),N=Math.ceil(d+h-k);b={x:v,y:k,w:S,h:N}}const x=o.crossOrigin;return{x:p,y:h,h:d,w:c,excavation:b,opacity:g,crossOrigin:x}}function Gle(e,t){return t!=null?Math.max(Math.floor(t),0):e?qle:Ule}function aO({value:e,level:t,minVersion:a,includeMargin:o,marginSize:i,imageSettings:s,size:r,boostLevel:c}){let d=xa.useMemo(()=>{const v=(Array.isArray(e)?e:[e]).reduce((k,S)=>(k.push(...Su.QrSegment.makeSegments(S)),k),[]);return Su.QrCode.encodeSegments(v,_le[t],a,void 0,void 0,c)},[e,t,a,c]);const{cells:p,margin:h,numCells:g,calculatedImageSettings:b}=xa.useMemo(()=>{let x=d.getModules();const v=Gle(o,i),k=x.length+v*2,S=Hle(x,r,v,s);return{cells:x,margin:v,numCells:k,calculatedImageSettings:S}},[d,r,s,o,i]);return{qrcode:d,margin:h,cells:p,numCells:g,calculatedImageSettings:b}}var $le=(function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0})(),Kle=xa.forwardRef(function(t,a){const o=t,{value:i,size:s=JD,level:r=YD,bgColor:c=ZD,fgColor:d=QD,includeMargin:p=XD,minVersion:h=eO,boostLevel:g,marginSize:b,imageSettings:x}=o,k=o3(o,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:S}=k,N=o3(k,["style"]),C=x?.src,j=xa.useRef(null),M=xa.useRef(null),D=xa.useCallback(G=>{j.current=G,typeof a=="function"?a(G):a&&(a.current=G)},[a]),[A,R]=xa.useState(!1),{margin:P,cells:O,numCells:T,calculatedImageSettings:z}=aO({value:i,level:r,minVersion:h,boostLevel:g,includeMargin:p,marginSize:b,imageSettings:x,size:s});xa.useEffect(()=>{if(j.current!=null){const G=j.current,K=G.getContext("2d");if(!K)return;let H=O;const U=M.current,Q=z!=null&&U!==null&&U.complete&&U.naturalHeight!==0&&U.naturalWidth!==0;Q&&z.excavation!=null&&(H=nO(O,z.excavation));const W=window.devicePixelRatio||1;G.height=G.width=s*W;const q=s/T*W;K.scale(q,q),K.fillStyle=c,K.fillRect(0,0,T,T),K.fillStyle=d,$le?K.fill(new Path2D(tO(H,P))):O.forEach(function(Z,oe){Z.forEach(function(_,ue){_&&K.fillRect(ue+P,oe+P,1,1)})}),z&&(K.globalAlpha=z.opacity),Q&&K.drawImage(U,z.x+P,z.y+P,z.w,z.h)}}),xa.useEffect(()=>{R(!1)},[C]);const B=a3({height:s,width:s},S);let L=null;return C!=null&&(L=xa.createElement("img",{src:C,key:C,style:{display:"none"},onLoad:()=>{R(!0)},ref:M,crossOrigin:z?.crossOrigin})),xa.createElement(xa.Fragment,null,xa.createElement("canvas",a3({style:B,height:s,width:s,ref:D,role:"img"},N)),L)});Kle.displayName="QRCodeCanvas";var cS=xa.forwardRef(function(t,a){const o=t,{value:i,size:s=JD,level:r=YD,bgColor:c=ZD,fgColor:d=QD,includeMargin:p=XD,minVersion:h=eO,boostLevel:g,title:b,marginSize:x,imageSettings:v}=o,k=o3(o,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:S,cells:N,numCells:C,calculatedImageSettings:j}=aO({value:i,level:r,minVersion:h,boostLevel:g,includeMargin:p,marginSize:x,imageSettings:v,size:s});let M=N,D=null;v!=null&&j!=null&&(j.excavation!=null&&(M=nO(N,j.excavation)),D=xa.createElement("image",{href:v.src,height:j.h,width:j.w,x:j.x+S,y:j.y+S,preserveAspectRatio:"none",opacity:j.opacity,crossOrigin:j.crossOrigin}));const A=tO(M,S);return xa.createElement("svg",a3({height:s,width:s,viewBox:`0 0 ${C} ${C}`,ref:a,role:"img"},k),!!b&&xa.createElement("title",null,b),xa.createElement("path",{fill:c,d:`M0,0 h${C}v${C}H0z`,shapeRendering:"crispEdges"}),xa.createElement("path",{fill:d,d:A,shapeRendering:"crispEdges"}),D)});cS.displayName="QRCodeSVG";function oO(e){const t=e?.trim().split(".")??[];if(t.length!==4||!t.every(i=>/^\d{1,3}$/.test(i)&&Number(i)<=255))return!1;const[a,o]=t.map(Number);return a===100&&o>=64&&o<=127}function i3(e){return/^chibi:\/\/pair\?\S+$/i.test(e?.trim()??"")}const iO=8,Wle=new Set(["hosted","tailnet","lan","bonjour"]);function Tc(e){const t=new Set,a=[];for(const o of e??[])if(!(!o||!Wle.has(o.kind)||!Number.isInteger(o.priority)||o.priority<0||o.priority>1e6))try{const i=new URL(o.url),s=o.kind==="hosted"?"https:":"http:",r=i.port?Number(i.port):null,c=i.hostname.toLowerCase().replace(/\.$/,"");if(i.protocol!==s||o.kind==="tailnet"&&!c.endsWith(".ts.net")||r!==null&&(!Number.isInteger(r)||r<1||r>65535)||i.username||i.password||i.pathname!=="/"||i.search||i.hash||t.has(i.origin))continue;t.add(i.origin),a.push({url:i.origin,kind:o.kind,priority:o.priority})}catch{}return a.sort((o,i)=>o.priority-i.priority).slice(0,iO)}const $k=e=>{const t=new Set,a=[];for(const o of e){const i=o.trim();!i||t.has(i)||(t.add(i),a.push(i))}return a},J7=(e,t)=>`http://${e.includes(":")&&!e.startsWith("[")?`[${e}]`:e}:${t}`;function vy(e,t){if(t==="automatic"){const g=Tc(e.endpoints).filter(S=>S.kind==="hosted"),b=g[0]??null;if(!b)return null;const x=new URL(b.url),v=x.hostname,k=x.port?Number(x.port):443;return{address:v,port:k,hosts:$k([v,...g.map(S=>new URL(S.url).hostname)]),endpoints:g}}const a=Tc(e.endpoints);if(t==="tailscale"){let g=a.find(N=>N.kind==="tailnet")??null;if(!g&&e.tailnetName?.trim()&&(g=Tc([{url:J7(e.tailnetName.trim(),e.port),kind:"tailnet",priority:0}])[0]??null),!g)return null;const b=new URL(g.url),x=b.hostname,v=b.port?Number(b.port):80,k=a.filter(N=>N.url!==g.url&&["hosted","tailnet"].includes(N.kind)),S=[g,...k].map((N,C)=>({...N,priority:C*100}));return{address:x,port:v,hosts:$k([x,...(e.hosts??[]).filter(N=>N.trim().toLowerCase().replace(/\.$/,"").endsWith(".ts.net"))]),endpoints:S}}let o=a.find(g=>g.kind==="lan")??(e.discovery?.advertising?a.find(g=>g.kind==="bonjour"):null)??null;if(!o){const g=e.lan?.trim()||(e.discovery?.advertising?e.hosts?.find(b=>b.trim().toLowerCase().endsWith(".local")):null);if(!g)return null;o=Tc([{url:J7(g.trim(),e.port),kind:g.trim().toLowerCase().endsWith(".local")?"bonjour":"lan",priority:0}])[0]??null}if(!o)return null;const i=new URL(o.url),s=i.hostname,r=i.port?Number(i.port):80,c=a.filter(g=>g.url!==o.url&&g.kind==="hosted"),d=a.filter(g=>g.url!==o.url&&g.kind==="tailnet"),p=a.filter(g=>g.url!==o.url&&!["hosted","tailnet"].includes(g.kind)),h=[o,...c,...d,...p].map((g,b)=>({...g,priority:b*100}));return{address:s,port:r,hosts:$k([s,...(e.hosts??[]).filter(g=>!g.trim().toLowerCase().replace(/\.$/,"").endsWith(".ts.net"))]),endpoints:h}}function Jle(e,t){const a=vy(e,t);if(!a)return null;const o=Tc(a.endpoints),i=o[0]??null,s=t==="local"?null:t==="tailscale"?o.find(r=>r.kind==="tailnet")??null:i?.kind==="hosted"?i:null;return t!=="local"&&!s?null:{route:{...a,endpoints:o},protectedEndpoint:s}}function Yle(e,t){return t.protectedEndpoint?Tc(e.endpoints).some(a=>a.kind===t.protectedEndpoint?.kind&&a.url===t.protectedEndpoint.url):!0}function Zle(e){const t=new TextEncoder().encode(JSON.stringify(e));let a="";for(const o of t)a+=String.fromCharCode(o);return btoa(a).replaceAll("+","-").replaceAll("/","_").replace(/=+$/,"")}function Qle(e){if(!e||!/^[A-Za-z0-9_-]{87}$/.test(e))return null;try{const t=e.replaceAll("-","+").replaceAll("_","/")+"=",a=atob(t);if(a.length!==65||a.charCodeAt(0)!==4)return null;let o="";for(let i=0;i<a.length;i+=1)o+=a[i];return btoa(o).replaceAll("+","-").replaceAll("/","_").replace(/=+$/,"")===e?e:null}catch{return null}}function Xle({address:e,port:t,code:a,token:o,name:i,hosts:s,endpoints:r,secretPublicKey:c,tailnetAddress:d}){const p=e.trim();if(!p||!/^\d{6}$/.test(a)||!/^omb_pair_[A-Za-z0-9_-]{43}$/.test(o)||!Number.isInteger(t)||t<1||t>65535)return null;const h=p.includes(":")&&!p.startsWith("[")?`[${p}]`:p,g=new URL("chibi://pair");g.searchParams.set("address",`${h}:${t}`),g.searchParams.set("token",o),g.searchParams.set("code",a),i?.trim()&&g.searchParams.set("name",i.trim());const b=(s??[]).map(k=>k.trim()).filter(k=>k&&!/[\s/?#,[\]]/.test(k)).slice(0,iO);b.length&&g.searchParams.set("hosts",b.join(","));const x=Tc(r);x.length&&g.searchParams.set("endpoints",Zle(x));const v=Qle(c);return v&&g.searchParams.set("secretKey",v),d&&oO(d)&&g.searchParams.set("tailnetAddress",d.trim()),g.toString().replace(/\+/g,"%20")}const s3={active:!1,localFallback:!1,tailscaleFallback:!1,baselineDeviceIds:[],pairingAttempted:!1,pairedDeviceName:null,skipped:!1};function ece(e,t){switch(t.type){case"start":case"resume":return{active:!0,localFallback:!1,tailscaleFallback:!1,baselineDeviceIds:[...t.deviceIds],pairingAttempted:!1,pairedDeviceName:null,skipped:!1};case"use-local":return{...e,active:!0,localFallback:!0,tailscaleFallback:!1,pairingAttempted:!1};case"use-tailscale":return{...e,active:!0,localFallback:!1,tailscaleFallback:!0,pairingAttempted:!1};case"pairing-opened":return{...e,baselineDeviceIds:[...t.deviceIds],pairingAttempted:!0};case"paired":return{...e,active:!0,pairedDeviceName:t.deviceName};case"skip":return{...s3,skipped:!0};case"reset":return s3}}const tce=3e4;function nce(e,t){return e.pairedDeviceName?"success":e.active?t.pairingOpen||e.pairingAttempted?"qr":t.provisioningTimedOut?"sign-in":e.localFallback||e.tailscaleFallback?"verifying":t.accountStatus==="signed-out"||t.accountStatus==="unavailable"||t.accountStatus==="error"?"sign-in":(t.accountBusy||t.provisioning,"verifying"):"intro"}async function ace(e,t,a){let o=await(t?a.read():a.start());return t&&!o.enabled&&(a.shouldContinue?.()??!0)&&(o=await a.start()),e==="tailscale"&&o.enabled&&!o.error&&(a.shouldContinue?.()??!0)&&(o=await a.refreshTailscale()),o}const oce=(e,t)=>t?.endpoints?.some(a=>a.kind==="hosted")?"hosted-ready":!e?.available||e.status==="signed-out"||e.status==="error"?"local-only":e.status==="ready"&&!t?.enabled?"hosted-startable":"hosted-connecting";function Kk(e,t,a){if(a)return"open";switch(oce(e,t)){case"hosted-ready":return"open";case"hosted-startable":return"start";case"hosted-connecting":return"wait";case"local-only":return"account-required"}}function ice(e,t){const a=new Set(e);return t.find(o=>!a.has(o.id))??null}function sce(e,t){return!e.active||!e.pairingAttempted||e.pairedDeviceName?null:ice(e.baselineDeviceIds,t)}function vb(e){return e?e.map(t=>t.id):null}function rce(e,t){return e.active&&t.provisioning&&!t.provisioningTimedOut}function lce(e,t){return e.generation===t?!1:(e.generation=t,!0)}function Xd(e,t){return e.generation!==t?!1:(e.generation=null,!0)}function cce(e,t){return e.active?.generation===t.generation||e.pending?.generation===t.generation?"duplicate":e.active?(e.pending=t,"queued"):(e.active=t,"start")}function dce(e,t){if(e.active?.generation!==t)return null;const a=e.pending;return e.active=a,e.pending=null,a}function Sm(e,t){e.pending?.generation===t&&(e.pending=null)}const uce="Device pairing did not open. Open Advanced & troubleshooting, confirm Remote access is on, then try again.";function pce(e,t=null,a=Date.now()){const o=sO(e);if(o)return o;const i=e.pairing;return!i||i.token===t||!/^omb_pair_[A-Za-z0-9_-]{43}$/.test(i.token)||!/^\d{6}$/.test(i.code??"")||!Number.isFinite(i.expiresAt)||(i.expiresAt??0)<=a?uce:null}async function kb(e,t,a,o){const i=e.pairing?.token;if(!i||!o())return!1;let s;try{s=await t()}catch{return!1}if(!o()||s.pairing?.token!==i)return!1;try{return await a(),!0}catch{return!1}}async function mce(e,t,a){const o=await e();return a()?o:(await t(o).catch(()=>{}),null)}function hce(e,t,a={set:(o,i)=>setTimeout(o,i),clear:o=>clearTimeout(o)}){let o=!1,i=null;const s=()=>{o||(i=a.set(()=>{Promise.resolve().then(e).catch(()=>{}).finally(s)},t))};return s(),()=>{o=!0,i!==null&&a.clear(i)}}const gce="Remote access could not start. Open Advanced & troubleshooting, then try turning Remote access on again.";function sO(e){return e.enabled&&!e.error?null:e.error?.trim()||gce}const Y7=/\bReference:\s*([0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12})\.?/i,fce=/^Error invoking remote method ['"][^'"\r\n]+['"]:\s*(?:Error:\s*)?/i,bce=[/^Enter a valid email address\.$/,/^The secure connection request (?:was not accepted|was not allowed)\./,/^That code (?:is not valid|expired)\./,/^Your sign-in expired\./,/^Atomic could not reach its secure connection service\./,/^Too many attempts were made\./,/^This computer was reconnected too often\./,/^This account has reached its computer limit\./,/^This computer is already connected\./,/^The secure connection (?:is still being prepared|service could not finish setup|is still being removed)\./,/^Secure access is not available right now\./,/^The secure connection service (?:had a problem|returned an unexpected response)\./,/^The secure connection request could not be completed\./];function eu(e,t){const a=e instanceof Error?e.message:"",o=a.replace(fce,"").replace(/^Error:\s*/i,"").trim(),i=o.match(Y7)?.[1]??"",s=o.replace(Y7,"").trim(),c=!(/remote method ['"]companion-account:request-code['"]/i.test(a)&&s.startsWith("The secure connection request was not allowed."))&&bce.some(d=>d.test(s))?s:t;return i?l("phone.error.reference",{message:c,reference:i}):c}const yce=e=>e.length<=3?"…":e.length<10?`${e.slice(0,3)}…`:e.length<17?`${e.slice(0,4)}…${e.slice(-3)}`:`${e.slice(0,10)}…${e.slice(-6)}`;function ix({label:e,value:t}){const[a,o]=f.useState(!1),[i,s]=f.useState(!1),r=f.useRef(null);f.useEffect(()=>()=>{r.current!==null&&window.clearTimeout(r.current)},[]);const c=async()=>{try{await navigator.clipboard.writeText(t),s(!0),r.current!==null&&window.clearTimeout(r.current),r.current=window.setTimeout(()=>s(!1),1200)}catch{}};return n.jsxs("div",{className:"flex items-center gap-3 rounded-lg bg-inset px-3 py-2",children:[n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"text-[11px] font-medium uppercase tracking-wide text-ink-secondary",children:e}),n.jsx("div",{className:"mt-0.5 truncate font-mono text-[11.5px] text-ink",children:a?t:yce(t)})]}),n.jsx("button",{onClick:()=>o(d=>!d),className:"shrink-0 rounded px-2 py-1 text-[11px] text-ink-secondary hover:bg-control hover:text-ink",children:a?"Hide":"Reveal"}),n.jsx("button",{onClick:()=>{c()},"aria-label":`Copy ${e}`,className:"shrink-0 rounded p-1.5 text-ink-secondary hover:bg-control hover:text-ink",children:i?n.jsx(gt,{size:13,className:"text-success"}):n.jsx(Ya,{size:13})})]})}function xce(e,t,a){const o=[];t&&oO(t)&&o.push(`${t.trim()}:${a}`);const i=e?.trim().replace(/\.$/,"");return i&&i.toLowerCase().endsWith(".ts.net")&&o.push(`${i}:${a}`),o}function vce({link:e,addresses:t}){const[a,o]=f.useState(!1),i=f.useRef(null);f.useEffect(()=>()=>{i.current!==null&&window.clearTimeout(i.current)},[]);const s=async()=>{try{await navigator.clipboard.writeText(e),o(!0),i.current!==null&&window.clearTimeout(i.current),i.current=window.setTimeout(()=>o(!1),2e3)}catch{o(!1)}};return n.jsxs("div",{"data-desktop-pairing-link":!0,className:"mt-4 w-full max-w-[390px] rounded-xl border border-hairline/40 px-3 py-3 text-left",children:[n.jsxs("div",{className:"flex items-center gap-2 text-[13px] font-medium text-ink",children:[n.jsx(Al,{size:15,className:"shrink-0 text-ink-secondary"})," ",l("remote.desktopLink.title")]}),n.jsx("p",{className:"mt-1 text-[11.5px] leading-relaxed text-ink-secondary",children:l("remote.desktopLink.detail")}),n.jsx("code",{className:"mt-2 block max-h-16 select-all overflow-y-auto break-all rounded-lg bg-inset px-2 py-1.5 font-mono text-[11px] text-ink",children:e}),n.jsxs("button",{type:"button",onClick:()=>{s()},className:"mt-2 flex items-center gap-1.5 rounded-lg bg-accent px-3 py-1.5 text-[12.5px] font-medium text-white hover:brightness-110",children:[a?n.jsx(gt,{size:13}):n.jsx(Ya,{size:13}),l(a?"remote.serverPairing.copied":"remote.serverPairing.copyLink")]}),t.length>0&&n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"mt-3 text-[11.5px] leading-relaxed text-ink-secondary",children:l("remote.desktopLink.manual")}),n.jsx("div",{className:"mt-1.5 flex flex-col gap-1.5",children:t.map(r=>n.jsx(ix,{label:l("phone.code.address"),value:r},r))})]})]})}const Z7=()=>l("phone.error.directUnavailable"),Q7=()=>l("phone.error.protectedUnavailable"),jc=()=>globalThis.ogb?.companion??null,Cm=()=>globalThis.ogb?.companionAccount??null,kce=async(e,t)=>{const[a,o]=await Promise.allSettled([e?Promise.resolve().then(()=>e.state()):Promise.resolve(null),t?Promise.resolve().then(()=>t.state()):Promise.resolve(null)]);return{companion:a.status==="fulfilled"?a.value:null,account:o.status==="fulfilled"?o.value:null}},Xi=async(e,t)=>{e.current+=1;try{return await t()}finally{e.current+=1}},wce=(e,t)=>e.current===t,Sce=(e,t)=>!e&&!!t.email,rO=(e,t)=>t||(e?.status==="signed-out"?e.message??null:null),Cce=(e,t)=>e?t?"details":"direct":"hidden";function lO(e=""){const[t,a]=f.useState(null),[o,i]=f.useState(null),[s,r]=f.useState(e),[c,d]=f.useState(""),[p,h]=f.useState(!1),[g,b]=f.useState(!1),[x,v]=f.useState(!1),[k,S]=f.useState(!1),[N,C]=f.useState(!1),[j,M]=f.useState(!1),[D,A]=f.useState(null),[R,P]=f.useState(null),[O,T]=f.useState(()=>Date.now()),[z,B]=f.useReducer(ece,s3),L=f.useRef(!1),G=f.useRef({generation:null}),K=f.useRef({active:null,pending:null}),H=f.useRef(async()=>{}),U=f.useRef(null),[Q,W]=f.useState(null),q=f.useRef(0),Z=f.useRef(!0),oe=f.useRef(0),_=f.useRef(null),ue=f.useCallback(Ee=>{U.current=Ee,W(Ee)},[]);f.useEffect(()=>(Z.current=!0,()=>{Z.current=!1,q.current+=1}),[]);const he=f.useCallback(()=>{if(_.current)return _.current;const Ee=oe.current,ce=(async()=>{const Ue=await kce(jc(),Cm());Z.current&&(Ue.companion&&wce(oe,Ee)&&a(Ue.companion),Ue.account&&(i(Ue.account),Sce(L.current,Ue.account)&&r(Ue.account.email??"")))})().finally(()=>{_.current===ce&&(_.current=null)});return _.current=ce,ce},[]);f.useEffect(()=>{he()},[he]),f.useEffect(()=>{!L.current&&e&&r(e)},[e]);const we=f.useCallback(async Ee=>{const ce=jc();if(ce){b(!0),A(null);try{const Ue=await Xi(oe,()=>Ee(ce));Z.current&&a(Ue)}catch(Ue){Z.current&&A(eu(Ue,l("phone.error.remoteUpdate")))}finally{Z.current&&b(!1)}}},[]),ee=f.useCallback(async Ee=>{const ce=Cm();if(ce){S(!0),P(null);try{const Ue=await Xi(oe,()=>Ee(ce));if(!Z.current)return;i(Ue),await he()}catch(Ue){Z.current&&P(eu(Ue,l("phone.error.secureUpdate")))}finally{Z.current&&S(!1)}}},[he]),Y=f.useCallback(async({routeMode:Ee,accountOverride:ce,generation:Ue})=>{const le=()=>{Xd(G.current,Ue)&&Z.current&&v(!1);const Je=dce(K.current,Ue);Je&&H.current(Je)},Fe=()=>Z.current&&q.current===Ue;if(!Fe()){le();return}const tt=jc();if(!tt){Z.current&&q.current===Ue&&A(l("phone.error.desktopOnly")),le();return}const st=()=>{const Je=U.current;return!Je||Je.generation===Ue},Ne=U.current;Ne&&Ne.generation!==Ue&&(ue(null),a(Je=>Je?.pairing?.token===Ne.token?{...Je,pairing:null}:Je)),A(null);try{const Je=await ace(Ee,!!t?.enabled,{read:()=>tt.state(),start:()=>Xi(oe,()=>tt.start()),refreshTailscale:()=>Xi(oe,()=>tt.refreshTailscale()),shouldContinue:Fe});if(!Fe())return;a(Je);const Me=sO(Je);if(Me){C(!1),A(Me),B({type:"reset"});return}const et=Ee!=="automatic",ft=Kk(ce??o,Je,et);if(ft!=="open"){C(ft==="wait"||ft==="start");return}if(et&&!vy(Je,Ee)){C(!1),A(Ee==="tailscale"?l("phone.error.tailscaleUnavailable"):Z7()),B({type:"reset"});return}const yt=await mce(()=>Xi(oe,()=>tt.pairing(!0)),Tn=>kb(Tn,()=>tt.state(),()=>Xi(oe,()=>tt.pairing(!1,Tn.pairing?.token)),st),Fe);if(!yt)return;const At=yt.pairing,tn=pce(yt,Je.pairing?.token??null),dn=tn?null:Jle(yt,Ee);if(tn||!dn||!At){if(await kb(yt,()=>tt.state(),()=>Xi(oe,()=>tt.pairing(!1,yt.pairing?.token)),Fe),!Fe())return;ue(null),a({...yt,pairing:null}),C(!1),A(tn??(Ee==="local"?Z7():Ee==="tailscale"?l("phone.error.tailscaleUnavailable"):Q7())),B({type:"reset"});return}ue({...dn,generation:Ue,token:At.token}),a(yt),C(!1),M(!1),B({type:"pairing-opened",deviceIds:yt.devices.map(Tn=>Tn.id)})}catch(Je){if(!Fe())return;ue(null),C(!1),A(eu(Je,l("phone.error.pairingPrepare"))),B({type:"reset"})}finally{le()}},[o,ue,t]);f.useLayoutEffect(()=>{H.current=Y},[Y]);const ne=f.useCallback((Ee,ce,Ue=q.current)=>{const le={routeMode:Ee,accountOverride:ce,generation:Ue},Fe=cce(K.current,le);Fe!=="duplicate"&&(lce(G.current,Ue),v(!0),Fe==="start"&&H.current(le))},[]),ae=f.useCallback(()=>{const Ee=vb(t?.devices??null);if(!Ee)return;const ce=++q.current;B({type:"start",deviceIds:Ee}),A(null),P(null),M(!1),(Kk(o,t,!1)==="open"||o?.available&&(o.status==="ready"||o.status==="connecting"))&&(C(!0),ne("automatic",o,ce))},[o,ne,t]),je=f.useCallback(()=>{const Ee=vb(t?.devices??null);if(!Ee)return;z.active||B({type:"start",deviceIds:Ee});const ce=++q.current;B({type:"use-local"}),C(!0),M(!1),P(null),ne("local",void 0,ce)},[z.active,ne,t?.devices]),xe=f.useCallback(()=>{const Ee=vb(t?.devices??null);if(!Ee)return;z.active||B({type:"start",deviceIds:Ee});const ce=++q.current;B({type:"use-tailscale"}),C(!0),M(!1),P(null),ne("tailscale",void 0,ce)},[z.active,ne,t?.devices]),re=f.useCallback(()=>{we(Ee=>Ee.refreshTailscale())},[we]),Se=f.useCallback(()=>{const Ee=Cm(),ce=s.trim().toLowerCase();if(!Ee||!ce)return;const Ue=q.current;S(!0),P(null),Ee.requestCode(ce).then(le=>{!Z.current||q.current!==Ue||(i(le),h(!0))}).catch(le=>{!Z.current||q.current!==Ue||P(eu(le,l("phone.error.sendCode")))}).finally(()=>{Z.current&&q.current===Ue&&S(!1)})},[s]),Be=f.useCallback(()=>{const Ee=Cm(),ce=s.trim().toLowerCase();if(!Ee||c.length!==8)return;const Ue=q.current;S(!0),C(!0),M(!1),P(null),Xi(oe,()=>Ee.verifyCode(ce,c)).then(async le=>{!Z.current||q.current!==Ue||(i(le),d(""),h(!1),await ne("automatic",le,Ue))}).catch(le=>{!Z.current||q.current!==Ue||(C(!1),P(eu(le,l("phone.error.verifyCode"))))}).finally(()=>{Z.current&&q.current===Ue&&S(!1)})},[c,s,ne]),nt=f.useCallback(()=>{const Ee=Cm();if(!Ee)return;const ce=z.active?vb(t?.devices??null):null,Ue=++q.current;ce&&B({type:"start",deviceIds:ce}),S(!0),C(!0),M(!1),P(null),Xi(oe,()=>Ee.retry()).then(async le=>{!Z.current||q.current!==Ue||(i(le),z.active?await ne("automatic",le,Ue):(await he(),Z.current&&q.current===Ue&&C(!1)))}).catch(le=>{!Z.current||q.current!==Ue||(C(!1),P(eu(le,l("phone.error.restore"))))}).finally(()=>{Z.current&&q.current===Ue&&S(!1)})},[z.active,he,ne,t?.devices]),ge=nce(z,{accountStatus:o?.available?o.status:"unavailable",accountBusy:k,provisioning:N,provisioningTimedOut:j,pairingOpen:!!(t?.pairing&&Q?.token===t.pairing.token)});f.useEffect(()=>{!z.active||z.localFallback||z.tailscaleFallback||!o||o.available&&o.status!=="signed-out"&&o.status!=="error"||C(!1)},[o,z.active,z.localFallback,z.tailscaleFallback]),f.useEffect(()=>{if(!rce(z,{provisioning:N,provisioningTimedOut:j}))return;const Ee=window.setTimeout(()=>{const ce=q.current;q.current+=1,Sm(K.current,ce),Xd(G.current,ce),v(!1),S(!1),C(!1),M(!0)},tce);return()=>window.clearTimeout(Ee)},[z,N,j]),f.useEffect(()=>{const Ee=Q;if(!Ee||!t)return;if(!t.pairing){ue(null);return}const ce=t.pairing.token===Ee.token,Ue=Yle(t,Ee);if(ce&&Ue)return;const le=jc();q.current===Ee.generation&&(q.current+=1),Sm(K.current,Ee.generation),Xd(G.current,Ee.generation),v(!1),ue(null),a(Fe=>Fe&&{...Fe,pairing:null}),C(!1),M(!1),A(ce?Q7():l("phone.error.codeChanged")),B({type:"reset"}),ce&&le&&kb(t,()=>le.state(),()=>Xi(oe,()=>le.pairing(!1,t.pairing?.token)),()=>{const Fe=U.current;return!Fe||Fe.generation===Ee.generation})},[Q,ue,t]),f.useEffect(()=>{if(!t)return;const Ee=sce(z,t.devices);Ee&&B({type:"paired",deviceName:Ee.name})},[z,t]),f.useEffect(()=>{!z.active||z.localFallback||z.tailscaleFallback||z.pairingAttempted||j||!t||Kk(o,t,!1)!=="open"||ne("automatic")},[o,z.active,z.localFallback,z.pairingAttempted,z.tailscaleFallback,ne,j,t]);const Qe=z.active||!!t?.pairing;f.useEffect(()=>hce(()=>(T(Date.now()),he()),Qe?1e3:1e4),[he,Qe]);const de=z.localFallback?"local":z.tailscaleFallback?"tailscale":"automatic",pe=f.useMemo(()=>t?t.pairing?Q?.token===t.pairing.token?Q.route:null:vy(t,de):null,[de,Q,t]),ke=f.useMemo(()=>!t?.pairing||!pe?null:Xle({...pe,code:t.pairing.code,token:t.pairing.token,name:t.discovery?.name,secretPublicKey:t.secretPublicKey,tailnetAddress:pe.endpoints?.some(Ee=>Ee.kind==="tailnet")?t.tailscale:void 0}),[pe,t]),Ge=f.useCallback(()=>{const Ee=q.current;q.current+=1,Sm(K.current,Ee),Xd(G.current,Ee),v(!1);const ce=t,Ue=jc();ue(null),a(le=>le&&{...le,pairing:null}),Ue&&ce?.pairing&&kb(ce,()=>Ue.state(),()=>Xi(oe,()=>Ue.pairing(!1,ce.pairing?.token)),()=>U.current===null),C(!1),S(!1),M(!1),h(!1),d(""),B({type:"reset"})},[ue,t]);return{state:t,account:o,phase:ge,email:s,code:c,codeSent:p,busy:g||x,accountBusy:k,error:D,accountError:R,pairingLink:ke,secondsLeft:t?.pairing?Math.max(0,Math.round((t.pairing.expiresAt-O)/1e3)):0,address:pe?.address,pairingPort:pe?.port??t?.port??8810,hostedReady:!!t?.endpoints?.some(Ee=>Ee.kind==="hosted"),localFallback:z.localFallback,tailscaleFallback:z.tailscaleFallback,tailscaleAvailable:!!(t&&vy(t,"tailscale")),pairingExpired:z.pairingAttempted&&!t?.pairing,setupTimedOut:j,setEmail:Ee=>{L.current=!0,r(Ee)},setCode:Ee=>d(Ee.replaceAll(/\D/g,"").slice(0,8)),changeEmail:()=>{d(""),h(!1),P(null)},start:ae,useLocal:je,useTailscale:xe,refreshTailscale:re,requestCode:Se,verifyCode:Be,retryAccount:nt,cancel:Ge,refreshCode:()=>{const Ee=++q.current;ne(de,void 0,Ee)},finish:()=>{const Ee=q.current;q.current+=1,Sm(K.current,Ee),Xd(G.current,Ee),v(!1),ue(null),M(!1),B({type:"reset"})},skip:()=>{const Ee=q.current;q.current+=1,Sm(K.current,Ee),Xd(G.current,Ee),v(!1),ue(null),B({type:"skip"})},act:we,accountAct:ee}}function jce(){const e=[{Icon:Yc,title:l("phone.value.chats"),detail:l("phone.value.chatsDetail")},{Icon:gt,title:l("phone.value.approvals"),detail:l("phone.value.approvalsDetail")},{Icon:Ps,title:l("phone.value.private"),detail:l("phone.value.privateDetail")}];return n.jsx("div",{className:"mt-5 grid w-full gap-2 sm:grid-cols-3",children:e.map(({Icon:t,title:a,detail:o})=>n.jsxs("div",{className:"rounded-xl bg-inset px-3 py-3 text-left",children:[n.jsx(t,{size:16,className:"text-accent"}),n.jsx("div",{className:"mt-2 text-[13px] font-medium text-ink",children:a}),n.jsx("div",{className:"mt-0.5 text-[11.5px] leading-relaxed text-ink-secondary",children:o})]},a))})}function cO({controller:e,variant:t,onSkip:a,onComplete:o,compactHeader:i=!1}){const s=e,r=rO(s.account,s.accountError),c=/^\S+@\S+\.\S+$/.test(s.email.trim()),d=Cce(!!s.state?.pairing,s.pairingLink);if(s.phase==="intro"&&i){const p=[{Icon:Yc,title:l("phone.value.chats"),detail:l("phone.value.chatsDetail")},{Icon:gt,title:l("phone.value.approvals"),detail:l("phone.value.approvalsDetail")},{Icon:Ps,title:l("phone.value.private"),detail:l("phone.value.privateDetail")}];return n.jsxs("div",{className:"flex flex-col",children:[n.jsx("p",{className:"mt-1 text-[13.5px] leading-relaxed text-ink-secondary",children:l("phone.intro.detail")}),n.jsxs("div",{className:"mt-4 grid grid-cols-[200px_1fr] items-center gap-6",children:[n.jsx(Lle,{}),n.jsx("ul",{className:"flex flex-col gap-3.5",children:p.map(({Icon:h,title:g,detail:b})=>n.jsxs("li",{className:"flex items-start gap-3",children:[n.jsx("span",{className:"mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-lg bg-accent/12 text-accent",children:n.jsx(h,{size:14})}),n.jsxs("span",{children:[n.jsx("span",{className:"block text-[13.5px] font-medium text-ink",children:g}),n.jsx("span",{className:"block text-[12px] leading-relaxed text-ink-secondary",children:b})]})]},g))})]}),n.jsx("button",{onClick:s.start,disabled:!s.state||s.busy||s.accountBusy,className:"mt-5 w-full rounded-lg bg-accent py-2.5 text-[14px] font-medium text-white hover:opacity-90 disabled:cursor-wait disabled:opacity-40",children:l("phone.intro.setUp")}),s.error&&n.jsx("p",{role:"alert",className:"mt-3 text-[12.5px] text-danger",children:s.error}),n.jsx("button",{onClick:()=>{s.skip(),a?.()},className:"mt-3 self-center text-[12.5px] text-ink-secondary hover:text-ink",children:l("phone.intro.notNow")}),n.jsx("p",{className:"mt-1.5 self-center text-[11.5px] text-ink-secondary",children:l("phone.intro.resume")})]})}if(s.phase==="intro")return n.jsxs("div",{className:i?"flex flex-col items-start":"flex flex-col items-center text-center",children:[!i&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"flex size-14 items-center justify-center rounded-2xl bg-accent/12 text-accent",children:n.jsx(Yc,{size:26})}),n.jsx("h2",{className:"mt-4 text-[19px] font-semibold text-ink",children:l("phone.intro.title",{app:Ga().name})})]}),n.jsx("p",{className:i?"mt-1 text-[13.5px] leading-relaxed text-ink-secondary":"mt-1.5 max-w-[460px] text-[13.5px] leading-relaxed text-ink-secondary",children:l("phone.intro.detail")}),n.jsx(jce,{}),n.jsx("button",{onClick:s.start,disabled:!s.state||s.busy||s.accountBusy,className:i?"mt-5 w-full rounded-lg bg-accent py-2.5 text-[14px] font-medium text-white hover:opacity-90 disabled:cursor-wait disabled:opacity-40":"mt-5 w-full max-w-[320px] rounded-lg bg-accent py-2.5 text-[14px] font-medium text-white hover:opacity-90 disabled:cursor-wait disabled:opacity-40",children:t==="settings"?s.state?.devices.length?l("phone.intro.pairAnother"):l("phone.intro.pair"):l("phone.intro.setUp")}),s.error&&n.jsx("p",{role:"alert",className:"mt-3 max-w-[390px] text-[12.5px] text-danger",children:s.error}),t==="onboarding"&&n.jsxs(n.Fragment,{children:[n.jsx("button",{onClick:()=>{s.skip(),a?.()},className:i?"mt-3 self-center text-[12.5px] text-ink-secondary hover:text-ink":"mt-2.5 text-[12.5px] text-ink-secondary hover:text-ink",children:l("phone.intro.notNow")}),n.jsx("p",{className:i?"mt-2 self-center text-[11.5px] text-ink-secondary":"mt-2 text-[11.5px] text-ink-secondary",children:l("phone.intro.resume")})]})]});if(s.phase==="sign-in"){const p=!s.account?.available,h=s.account?.status==="error"||s.setupTimedOut;return n.jsxs("div",{className:"mx-auto flex w-full max-w-[430px] flex-col",children:[n.jsxs("button",{onClick:s.cancel,className:"mb-4 flex w-fit items-center gap-1.5 text-[12px] text-ink-secondary hover:text-ink",children:[n.jsx(Ll,{size:13})," ",l("phone.back")]}),n.jsx("div",{className:"flex size-11 items-center justify-center rounded-xl bg-accent/12 text-accent",children:n.jsx(HB,{size:20})}),n.jsx("h2",{className:"mt-3 text-[18px] font-semibold text-ink",children:l(p||h?"phone.signIn.attention":"phone.signIn.title")}),n.jsx("p",{role:s.setupTimedOut?"alert":void 0,className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:p?l("phone.signIn.unavailable"):s.setupTimedOut?l("phone.signIn.timedOut"):h?s.account?.message??l("phone.signIn.failed"):l("phone.signIn.emailPrompt")}),!p&&!h&&n.jsxs("div",{className:"mt-5 flex flex-col gap-3",children:[n.jsxs("label",{className:"flex flex-col gap-1.5",children:[n.jsx("span",{className:"text-[12px] font-medium text-ink-secondary",children:l("phone.signIn.email")}),n.jsx("input",{autoFocus:!0,autoComplete:"email",inputMode:"email",value:s.email,disabled:s.accountBusy||s.codeSent,onChange:g=>s.setEmail(g.target.value),onKeyDown:g=>{g.key==="Enter"&&!s.codeSent&&c&&s.requestCode()},placeholder:"you@example.com",className:"rounded-lg border border-hairline/50 bg-inset px-3 py-2.5 text-[14px] text-ink outline-none placeholder:text-ink-secondary/60 focus:border-accent disabled:opacity-50"})]}),s.codeSent&&n.jsxs("label",{className:"flex flex-col gap-1.5",children:[n.jsx("span",{className:"text-[12px] font-medium text-ink-secondary",children:l("phone.signIn.code")}),n.jsx("input",{autoFocus:!0,autoComplete:"one-time-code",inputMode:"numeric",value:s.code,disabled:s.accountBusy,onChange:g=>s.setCode(g.target.value),onKeyDown:g=>{g.key==="Enter"&&s.code.length===8&&s.verifyCode()},placeholder:"12345678",className:"rounded-lg border border-hairline/50 bg-inset px-3 py-2.5 font-mono text-[16px] tracking-[0.18em] text-ink outline-none placeholder:tracking-normal placeholder:text-ink-secondary/60 focus:border-accent disabled:opacity-50"})]}),n.jsx("button",{disabled:s.accountBusy||!s.codeSent&&!c||s.codeSent&&s.code.length!==8,onClick:s.codeSent?s.verifyCode:s.requestCode,className:"rounded-lg bg-accent py-2.5 text-[14px] font-medium text-white hover:opacity-90 disabled:opacity-40",children:s.accountBusy?l("phone.signIn.working"):s.codeSent?l("phone.signIn.verify"):l("phone.signIn.sendCode")}),s.codeSent&&n.jsx("button",{disabled:s.accountBusy,onClick:s.changeEmail,className:"text-[12px] text-ink-secondary hover:text-ink disabled:opacity-40",children:l("phone.signIn.otherEmail")}),s.codeSent&&!r&&n.jsx("p",{className:"text-[11.5px] text-ink-secondary",children:l("phone.signIn.expires")})]}),(p||h)&&!s.account?.unconfigured&&n.jsx("button",{disabled:s.accountBusy,onClick:s.retryAccount,className:"mt-5 rounded-lg bg-accent py-2.5 text-[14px] font-medium text-white disabled:opacity-40",children:s.accountBusy?l("remote.account.retrying"):l("phone.signIn.retry")}),r&&n.jsx("p",{role:"alert",className:"mt-3 text-[12.5px] text-danger",children:r}),n.jsxs("div",{className:"my-4 flex items-center gap-3 text-[11px] text-ink-secondary",children:[n.jsx("span",{className:"h-px flex-1 bg-hairline/40"})," ",l("phone.signIn.or")," ",n.jsx("span",{className:"h-px flex-1 bg-hairline/40"})]}),t==="onboarding"&&s.tailscaleAvailable&&n.jsxs(n.Fragment,{children:[n.jsxs("button",{disabled:s.busy||s.accountBusy,onClick:s.useTailscale,className:"flex items-center justify-center gap-2 rounded-lg border border-hairline/50 py-2.5 text-[13px] text-ink hover:bg-control disabled:opacity-40",children:[n.jsx(Ps,{size:15})," ",l("remote.pairOverTailscale")]}),n.jsx("p",{className:"mt-2 text-center text-[11px] leading-relaxed text-ink-secondary",children:l("phone.signIn.tailnetNote")})]}),n.jsxs("button",{disabled:s.busy||s.accountBusy,onClick:s.useLocal,className:`${t==="onboarding"&&s.tailscaleAvailable?"mt-3":""} flex items-center justify-center gap-2 rounded-lg border border-hairline/50 py-2.5 text-[13px] text-ink hover:bg-control disabled:opacity-40`,children:[n.jsx(tE,{size:15})," ",l("phone.signIn.wifiInstead")]}),n.jsx("p",{className:"mt-2 text-center text-[11px] leading-relaxed text-ink-secondary",children:l("phone.signIn.wifiNote")})]})}return s.phase==="verifying"?n.jsxs("div",{className:"flex flex-col items-center py-8 text-center",children:[n.jsx("div",{className:"flex size-14 items-center justify-center rounded-2xl bg-accent/12 text-accent",children:n.jsx(Ie,{size:25,className:"animate-spin"})}),n.jsx("h2",{className:"mt-4 text-[18px] font-semibold text-ink",children:s.localFallback?l("phone.verifying.local"):s.tailscaleFallback?l("phone.verifying.tailscale"):l("phone.verifying.secure")}),n.jsx("p",{className:"mt-1.5 max-w-[360px] text-[13px] leading-relaxed text-ink-secondary",children:s.localFallback?l("phone.verifying.localDetail"):s.tailscaleFallback?l("phone.verifying.tailscaleDetail"):l("phone.verifying.secureDetail")}),(s.error||s.accountError)&&n.jsx("p",{role:"alert",className:"mt-3 max-w-[380px] text-[12.5px] text-danger",children:s.error??s.accountError}),n.jsx("button",{onClick:s.cancel,className:"mt-5 text-[12px] text-ink-secondary hover:text-ink",children:l("common.cancel")})]}):s.phase==="success"?n.jsxs("div",{className:"flex flex-col items-center py-6 text-center",children:[n.jsx("div",{className:"flex size-14 items-center justify-center rounded-full bg-success/15 text-success",children:n.jsx(gt,{size:28})}),n.jsx("h2",{className:"mt-4 text-[19px] font-semibold text-ink",children:l("phone.success.title")}),n.jsx("p",{className:"mt-1.5 text-[13px] text-ink-secondary",children:l("phone.success.detail")}),n.jsx("button",{onClick:()=>{s.finish(),o?.()},className:"mt-5 w-full max-w-[280px] rounded-lg bg-accent py-2.5 text-[14px] font-medium text-white",children:t==="onboarding"?l("phone.success.start",{app:Ga().name}):l("phone.success.done")})]}):n.jsxs("div",{className:"flex flex-col items-center text-center",children:[n.jsx("div",{className:"flex size-12 items-center justify-center rounded-xl bg-white text-black",children:n.jsx(wY,{size:23})}),n.jsx("h2",{className:"mt-3 text-[18px] font-semibold text-ink",children:s.pairingExpired?l("phone.code.expired"):l("phone.code.title")}),n.jsx("p",{className:"mt-1 text-[13px] text-ink-secondary",children:s.pairingExpired?l("phone.code.expiredDetail"):l("phone.code.detail")}),!s.pairingExpired&&s.pairingLink&&n.jsx("div",{className:"mt-4 rounded-2xl bg-white p-3.5","aria-label":l("phone.code.qrAria"),children:n.jsx(cS,{value:s.pairingLink,size:180,level:"M",bgColor:"#ffffff",fgColor:"#111111"})}),!s.pairingExpired&&d==="direct"&&s.state?.pairing&&n.jsxs("div",{className:"mt-4 w-full max-w-[320px] rounded-xl bg-inset px-4 py-3 text-[12.5px] text-ink-secondary",children:[n.jsx("div",{children:l("phone.code.manualIntro")}),n.jsx("div",{className:"mt-2 font-mono text-[22px] tracking-[0.25em] text-ink",children:s.state.pairing.code})]}),!s.pairingExpired&&d==="details"&&s.state?.pairing&&n.jsx("p",{className:"mt-3 text-[11.5px] text-ink-secondary",children:l("phone.code.expiresIn",{seconds:s.secondsLeft})}),!s.pairingExpired&&t==="settings"&&s.tailscaleFallback&&s.pairingLink&&n.jsx(vce,{link:s.pairingLink,addresses:xce(s.state?.tailnetName,s.state?.tailscale,s.pairingPort)}),s.pairingExpired&&n.jsx("button",{onClick:s.refreshCode,className:"mt-5 rounded-lg bg-accent px-5 py-2.5 text-[14px] font-medium text-white",children:l("phone.code.createNew")}),!s.pairingExpired&&s.state?.pairing&&n.jsxs("details",{className:"mt-4 w-full max-w-[390px] rounded-lg border border-hairline/40 px-3 py-2 text-left",children:[n.jsx("summary",{className:"cursor-pointer text-[12px] text-ink-secondary",children:l("phone.code.trouble")}),n.jsxs("div",{className:"mt-3 text-[12px] text-ink-secondary",children:[l("phone.code.manual"),n.jsx("div",{className:"mt-1 font-mono text-[22px] tracking-[0.25em] text-ink",children:s.state.pairing.code}),s.address&&n.jsx("div",{className:"mt-3",children:n.jsx(ix,{label:l("phone.code.address"),value:`${s.address}:${s.pairingPort}`})})]})]}),n.jsx("button",{onClick:s.cancel,className:"mt-4 text-[12px] text-ink-secondary hover:text-ink",children:l("common.cancel")})]})}function dO({profileEmail:e,variant:t,onSkip:a,onComplete:o,compactHeader:i}){const s=lO(e);return n.jsx(cO,{controller:s,variant:t,onSkip:a,onComplete:o,compactHeader:i})}const Nce="https://apps.apple.com/us/app/tailscale/id1470499037",Ace="https://apps.apple.com/us/app/tailscale/id1475387142";function Mce(){return n.jsxs("div",{className:"mt-3 rounded-xl border border-hairline/40 bg-card px-3.5 py-3",children:[n.jsx("p",{className:"text-[12.5px] leading-relaxed text-ink",children:l("setup.phone.tailscale")}),n.jsxs("div",{className:"mt-2 flex flex-wrap gap-2",children:[n.jsx(Wy,{href:Nce,label:l("setup.phone.tailscaleIphone")}),n.jsx(Wy,{href:Ace,label:l("setup.phone.tailscaleMac")})]})]})}function Ice({onPaired:e,onSkip:t}){const{state:a}=ve();return n.jsxs("div",{className:"flex min-h-0 flex-col",children:[n.jsx("p",{className:"text-[14px] leading-relaxed text-ink-secondary",children:l("setup.phone.intro")}),n.jsx(Mce,{}),n.jsx("div",{className:"mt-3 min-h-0",children:n.jsx(dO,{variant:"onboarding",compactHeader:!0,profileEmail:a.config?.profile?.email??"",onSkip:t,onComplete:e})}),n.jsx($i,{children:n.jsx("p",{children:l("setup.phone.what")})})]})}function Pce({name:e,chibitek:t,identity:a={},onName:o,onChibitek:i}){return n.jsxs("div",{className:"flex flex-col",children:[a.companyLogo?n.jsx("img",{src:a.companyLogo,alt:a.company??"",className:"mb-3 h-24 max-w-[260px] self-center object-contain"}):n.jsx(w0,{size:96,className:"mb-3 self-center"}),a.company&&n.jsx("p",{className:"mb-2 text-[15px] font-medium text-ink",children:l("setup.welcome.team",{company:a.company})}),n.jsx("p",{className:"text-[14px] leading-relaxed text-ink-secondary",children:l("setup.welcome.intro")}),n.jsx("label",{htmlFor:"setup-name",className:"mt-5 text-[12px] font-medium text-ink-secondary",children:l("setup.welcome.nameLabel")}),n.jsx("input",{id:"setup-name",autoFocus:!0,type:"text",value:e,maxLength:80,autoComplete:"name",onChange:s=>o(s.target.value),placeholder:l("onboarding.name"),className:V("mt-1.5",fr)}),a.chibitek===void 0&&n.jsxs("fieldset",{className:"mt-5",children:[n.jsx("legend",{className:"text-[12px] font-medium text-ink-secondary",children:l("setup.welcome.chibitekQuestion")}),n.jsx("div",{role:"radiogroup","aria-label":l("setup.welcome.chibitekQuestion"),className:"mt-2 grid grid-cols-2 gap-2",children:[!0,!1].map(s=>n.jsx("button",{type:"button",role:"radio","aria-checked":t===s,onClick:()=>i(s),className:V("rounded-xl border px-3 py-2.5 text-[13.5px] font-medium transition-colors",t===s?"border-accent bg-accent/10 text-ink":"border-hairline/50 bg-card text-ink-secondary hover:bg-raised/50 hover:text-ink"),children:l(s?"setup.welcome.yes":"setup.welcome.no")},String(s)))}),t&&n.jsx("p",{className:"mt-2 text-[12px] text-ink-secondary",children:l("setup.welcome.chibitekYes")})]}),n.jsx($i,{children:n.jsx("p",{children:l("setup.welcome.what")})})]})}const Tce=[{id:"service-desk",name:"Service Desk"},{id:"development",name:"Development"},{id:"back-office",name:"Back Office"},{id:"creative",name:"Creative"},{id:"sales-and-marketing",name:"Sales and Marketing"}],Bce="min-h-[72px] resize-y";function Ece({answers:e,chibitek:t,company:a,onChange:o}){const i=r=>c=>o({...e,[r]:c}),s=(r,c,d,p=!1)=>{const h=`paw-${r}`;return n.jsxs("div",{className:"mt-4 flex flex-col",children:[n.jsx("label",{htmlFor:h,className:"text-[12px] font-medium text-ink-secondary",children:c}),p?n.jsx("textarea",{id:h,rows:3,maxLength:2e3,value:e[r]??"",placeholder:d,onChange:g=>i(r)(g.target.value),className:V("mt-1.5",fr,Bce)}):n.jsx("input",{id:h,type:"text",maxLength:120,value:e[r]??"",placeholder:d,onChange:g=>i(r)(g.target.value),className:V("mt-1.5",fr)})]})};return n.jsxs("div",{className:"flex flex-col","data-testid":"paw-interview",children:[n.jsx("p",{className:"text-[14px] leading-relaxed text-ink-secondary",children:l("setup.about.intro")}),s("role",a?l("setup.about.roleAt",{company:a}):l("setup.about.role"),l("setup.about.roleHint")),t?n.jsxs("div",{className:"mt-4 flex flex-col",children:[n.jsx("label",{htmlFor:"paw-department",className:"text-[12px] font-medium text-ink-secondary",children:l("setup.about.department")}),n.jsxs("select",{id:"paw-department",value:e.department??"",onChange:r=>i("department")(r.target.value),className:V("mt-1.5",fr),children:[n.jsx("option",{value:"",children:l("setup.about.departmentPick")}),Tce.map(r=>n.jsx("option",{value:r.id,children:r.name},r.id))]})]}):n.jsxs(n.Fragment,{children:[s("department",l("setup.about.department"),l("setup.about.departmentHint")),!a&&s("company",l("setup.about.company"),l("setup.about.companyHint"))]}),s("goals",l("setup.about.goals"),l("setup.about.goalsHint"),!0),s("workingStyle",l("setup.about.style"),l("setup.about.styleHint"),!0),n.jsxs($i,{children:[n.jsx("p",{children:l("setup.about.what")}),n.jsx("p",{children:l("paw.about")})]})]})}const Rce={profile:{},memory:{},skills:[],routines:[]},Dce=e=>({name:e.name,prompt:e.prompt,schedule:e.schedule,enabled:e.enabled,runOn:e.runOn,durationMinutes:e.durationMinutes,timeoutMinutes:e.timeoutMinutes,overlap:e.overlap,attachments:e.attachments});class X7{constructor(t,a,o=X){this.changed=a,this.network=o,this.template=structuredClone(t),this.routines=t.routines.map(i=>this.routine({...i,botId:this.id}))}changed;network;id=`draft-${crypto.randomUUID()}`;template;consent={};routines;avatarFile;avatarObjectUrl;get bot(){const{computer:t,cwd:a,peers:o,...i}=this.template.profile;return{id:this.id,threadId:this.id,name:"",title:"",description:"",soul:"",color:"green",notifications:!0,unread:!1,messages:[],modelSelection:{instanceId:"",model:""},...i,computer:t??void 0,cwd:a??void 0,peers:o??void 0}}patch(t){const{confirmFullAccess:a,acknowledgeLocalAuto:o,acknowledgePeerScope:i,applyToAllThreads:s,autoApprove:r,...c}=t;a!==void 0&&(this.consent.confirmFullAccess=a),o!==void 0&&(this.consent.acknowledgeLocalAuto=o),i!==void 0&&(this.consent.acknowledgePeerScope=i),r!==void 0&&c.approvalMode===void 0&&(c.approvalMode=r?"auto":"ask"),this.template.profile={...this.template.profile,...c},this.changed()}modelChosen=!1;setModel(t){this.modelChosen=!0,this.patch({modelSelection:t})}setMemory(t,a){a===null?delete this.template.memory[t]:this.template.memory[t]=a,this.changed()}setRoutineEnabled(t,a){this.routines=this.routines.map(o=>o.id===t?{...o,enabled:a}:o),this.changed()}removeRoutine(t){this.routines=this.routines.filter(a=>a.id!==t),this.changed()}export(){return structuredClone({...this.template,routines:this.routines.map(Dce)})}uploadAvatar=async t=>{if(!["image/png","image/jpeg","image/gif","image/webp"].includes(t.type))throw new Error("Choose a PNG, JPEG, GIF, or WebP image");if(t.size>10*1024*1024)throw new Error("Choose an image smaller than 10 MiB");return this.avatarObjectUrl&&URL.revokeObjectURL(this.avatarObjectUrl),this.avatarFile=t,this.avatarObjectUrl=URL.createObjectURL(t),this.avatarObjectUrl};dispose(){this.avatarObjectUrl&&URL.revokeObjectURL(this.avatarObjectUrl)}routine(t,a){const{groupId:o,resultsThreadId:i,schedule:s,...r}=t,c=s.type==="interval"?{...s,weekdays:s.weekdays??void 0,window:s.window??void 0,endsAt:s.endsAt??void 0}:s;return{id:a?.id??`draft-${crypto.randomUUID()}`,createdAt:a?.createdAt??Date.now(),updatedAt:Date.now(),nextRunAt:null,runOn:"maus",...a,...r,enabled:t.enabled??a?.enabled??!0,target:"bot",botId:this.id,timeoutMinutes:t.timeoutMinutes??void 0,durationMinutes:t.durationMinutes??a?.durationMinutes??30,schedule:c}}request=async(t,a)=>{const o=a?.method??"GET",i=typeof a?.body=="string"?JSON.parse(a.body):{},s=`/api/bots/${this.id}`;let r;if(t===s&&o==="PATCH")this.patch(i),r={bot:this.bot};else if(t===`${s}/soul`&&o==="GET")r={soul:this.bot.soul,revision:"draft",bytes:new TextEncoder().encode(this.bot.soul).length,limit:24e3,file:"",drift:!1};else if(t===`${s}/skills`&&o==="GET")r={skills:this.template.skills,staged:[]};else if(t===`${s}/skills`&&o==="POST"){const c=await this.network("/api/bot-defaults/skills/preview",{method:"POST",body:JSON.stringify(i)}),d=new Set(this.template.skills.map(p=>p.name));if(c.skills.some(p=>d.has(p.name)))throw new Error("A skill with this name is already in the draft");this.template.skills.push(...c.skills),this.changed(),r={installed:c.skills}}else if(t.startsWith(`${s}/skills/`)){const c=decodeURIComponent(t.slice(`${s}/skills/`.length)),d=this.template.skills.find(p=>p.name===c);if(!d)throw new Error("No such draft skill");if(o==="GET")r={text:d.text};else if(o==="PATCH"&&typeof i.enabled=="boolean")d.enabled=i.enabled,this.changed(),r={ok:!0};else if(o==="DELETE")this.template.skills=this.template.skills.filter(p=>p!==d),this.changed(),r={ok:!0};else throw new Error("Unsupported draft skill operation")}else if(t===`${s}/avatar/generate`&&o==="POST"){const{name:c,title:d,description:p}=this.bot,{dataUrl:h}=await this.network("/api/bot-defaults/avatar",{method:"POST",body:JSON.stringify({profile:{name:c,title:d,description:p},prompt:i.prompt,source:i.source})}),g=await(await fetch(h)).blob(),b=await this.uploadAvatar(new File([g],"avatar.png",{type:g.type}));r={avatarUrl:b,bot:{...this.bot,avatarUrl:b,avatarCrop:"circle"}}}else if(t==="/api/routines"&&o==="POST"||t.startsWith("/api/routines/draft-")&&o==="PATCH"){if(i.target&&i.target!=="bot")throw new Error("A new bot's routine must target that bot");if(i.botId!==this.id)throw new Error("Routine belongs to another bot");const c=this.routines.find(p=>t===`/api/routines/${p.id}`);if(o==="PATCH"&&!c)throw new Error("No such draft routine");const d=this.routine(i,c);this.routines=[...this.routines.filter(p=>p.id!==d.id),d],this.changed(),r={routine:d}}else throw new Error("This operation requires a created bot");return r}}function Oce(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.id!="string"||!zce(t.size)?!1:t.kind==="paste"?typeof t.text=="string"&&typeof t.lines=="number"&&Number.isInteger(t.lines)&&t.lines>=1:t.kind==="file"?typeof t.path=="string"&&t.path.length>0&&typeof t.name=="string":t.kind==="image"?typeof t.path=="string"&&t.path.length>0&&typeof t.name=="string"&&typeof t.mime=="string"&&t.mime.startsWith("image/"):!1}function zce(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0}const Lce=900,Fce=12;function _ce(e){return e.length>=Lce||uO(e)>=Fce}function uO(e){return e.split(`
90
- `).length}function C0(){return globalThis.crypto?.randomUUID?.()??`a${Math.random().toString(36).slice(2)}`}function pO(){if(globalThis.crypto?.randomUUID)return globalThis.crypto.randomUUID();const e=new Uint8Array(16);if(globalThis.crypto?.getRandomValues)globalThis.crypto.getRandomValues(e);else for(let a=0;a<e.length;a+=1)e[a]=Math.floor(Math.random()*256);e[6]=e[6]&15|64,e[8]=e[8]&63|128;const t=Array.from(e,a=>a.toString(16).padStart(2,"0"));return`${t.slice(0,4).join("")}-${t.slice(4,6).join("")}-${t.slice(6,8).join("")}-${t.slice(8,10).join("")}-${t.slice(10).join("")}`}function mO(e,t,a){return{kind:"file",id:C0(),path:t,name:e,size:a}}const hO=10*1024*1024,r3=25*1024*1024,gO={txt:"text/plain",md:"text/markdown",markdown:"text/markdown",csv:"text/csv",tsv:"text/tab-separated-values",json:"application/json",pdf:"application/pdf",rtf:"application/rtf",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",xls:"application/vnd.ms-excel",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",ppt:"application/vnd.ms-powerpoint",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",odt:"application/vnd.oasis.opendocument.text",ods:"application/vnd.oasis.opendocument.spreadsheet",odp:"application/vnd.oasis.opendocument.presentation"},qce=new Set(Object.values(gO)),fO={opus:"audio/opus",ogg:"audio/ogg",mp3:"audio/mpeg",m4a:"audio/mp4",aac:"audio/aac",wav:"audio/wav",flac:"audio/flac",webm:"audio/webm"},Uce=new Set([...Object.values(fO),"audio/x-m4a","audio/x-wav","audio/wave","audio/x-flac"]);function Vce(e){const t=e.type.split(";",1)[0].trim().toLowerCase();if(qce.has(t))return t;const a=e.name.split(".").at(-1)?.toLowerCase()??"";return gO[a]??null}function Ju(e){return e.type.startsWith("image/")&&["image/png","image/jpeg","image/gif","image/webp"].includes(e.type.split(";")[0].trim().toLowerCase())}function Hce(e){if(!e)return[];if(e.items){const t=[];for(const a of e.items)if(a.kind==="file"&&a.type.startsWith("image/")){const o=a.getAsFile();o&&Ju(o)&&t.push(o)}if(t.length>0)return t}return e.files?Array.from(e.files).filter(Ju):[]}function Gce(e){if(!e)return!1;if(e.items){for(const t of e.items)if(t.kind==="file"&&t.type.startsWith("image/"))return!0}if(e.files){for(const t of e.files)if(Ju(t))return!0}return!1}const $ce={"image/png":".png","image/jpeg":".jpg","image/gif":".gif","image/webp":".webp"},wb=2;function Kce(e){return e===408||e===425||e===429||e>=500}async function bO(e,t){for(let a=0;a<wb;a+=1){let o;try{o=await fetch(e,t)}catch(i){if(typeof i=="object"&&i!==null&&"name"in i&&i.name==="AbortError"||a===wb-1)throw i;continue}if(!o.ok){if(Kce(o.status)&&a<wb-1){await o.body?.cancel().catch(()=>{});continue}const i=await o.json().catch(()=>({error:o.statusText}));throw Object.assign(new Error(i.error??"upload failed"),{status:o.status})}try{return await o.json()}catch(i){if(a===wb-1)throw new Error("upload returned an invalid response",{cause:i})}}throw new Error("upload failed")}function Wce(e,t,a){const o=a.split(";",1)[0].trim().toLowerCase(),i=$ce[o],s=is(t);if(!i||!s.toLowerCase().endsWith(i))throw new Error("upload returned invalid image metadata");const r=is(e.trim()),c=r.lastIndexOf(".");return`${(c>0?r.slice(0,c):r).trim()||"pasted image"}${i}`}function Jce(e){if(!Ju(e))return null;if(e.size>hO)throw Object.assign(new Error(`${e.name} exceeds 10 MB`),{status:413});const t=e.type.split(";",1)[0].trim().toLowerCase(),a=typeof URL.createObjectURL=="function"?URL.createObjectURL(e):void 0;return{kind:"image",id:C0(),path:"",name:e.name||"image",size:e.size,mime:t,...a?{previewUrl:a}:{},uploading:!0}}async function Ng(e,t){if(!Ju(e))return null;if(e.size>hO)throw Object.assign(new Error(`${e.name} exceeds 10 MB`),{status:413});const a=new Uint8Array(await e.arrayBuffer()),o=pO(),i=await bO(`/api/attachments?uploadId=${encodeURIComponent(o)}`,{method:"POST",headers:{"content-type":e.type},body:a});return{kind:"image",id:t?.id??C0(),path:i.path,name:Wce(e.name,i.path,i.mime),size:i.bytes,mime:i.mime,...t?.previewUrl?{previewUrl:t.previewUrl}:{}}}async function Yce(e){const t=e.type.split(";",1)[0].trim().toLowerCase(),a=e.name.split(".").at(-1)?.toLowerCase()??"",o=Vce(e)??(Uce.has(t)?t:fO[a]);if(!o)return null;if(e.size>r3)throw Object.assign(new Error(`${e.name} exceeds 25 MB`),{status:413});const i=pO(),s=await bO(`/api/files?name=${encodeURIComponent(e.name)}&uploadId=${encodeURIComponent(i)}`,{method:"POST",headers:{"content-type":o},body:e});return mO(s.name||e.name,s.path,s.bytes)}function yO(e){return{kind:"paste",id:C0(),text:e,size:tde(e),lines:uO(e)}}function Zce(e,t){return e?`${e}${e.endsWith(`
90
+ `).length}function C0(){return globalThis.crypto?.randomUUID?.()??`a${Math.random().toString(36).slice(2)}`}function pO(){if(globalThis.crypto?.randomUUID)return globalThis.crypto.randomUUID();const e=new Uint8Array(16);if(globalThis.crypto?.getRandomValues)globalThis.crypto.getRandomValues(e);else for(let a=0;a<e.length;a+=1)e[a]=Math.floor(Math.random()*256);e[6]=e[6]&15|64,e[8]=e[8]&63|128;const t=Array.from(e,a=>a.toString(16).padStart(2,"0"));return`${t.slice(0,4).join("")}-${t.slice(4,6).join("")}-${t.slice(6,8).join("")}-${t.slice(8,10).join("")}-${t.slice(10).join("")}`}function mO(e,t,a){return{kind:"file",id:C0(),path:t,name:e,size:a}}const hO=10*1024*1024,r3=25*1024*1024,gO={txt:"text/plain",md:"text/markdown",markdown:"text/markdown",html:"text/html",htm:"text/html",csv:"text/csv",tsv:"text/tab-separated-values",json:"application/json",pdf:"application/pdf",rtf:"application/rtf",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",xls:"application/vnd.ms-excel",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",ppt:"application/vnd.ms-powerpoint",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",odt:"application/vnd.oasis.opendocument.text",ods:"application/vnd.oasis.opendocument.spreadsheet",odp:"application/vnd.oasis.opendocument.presentation"},qce=new Set(Object.values(gO)),fO={opus:"audio/opus",ogg:"audio/ogg",mp3:"audio/mpeg",m4a:"audio/mp4",aac:"audio/aac",wav:"audio/wav",flac:"audio/flac",webm:"audio/webm"},Uce=new Set([...Object.values(fO),"audio/x-m4a","audio/x-wav","audio/wave","audio/x-flac"]);function Vce(e){const t=e.type.split(";",1)[0].trim().toLowerCase();if(qce.has(t))return t;const a=e.name.split(".").at(-1)?.toLowerCase()??"";return gO[a]??null}function Ju(e){return e.type.startsWith("image/")&&["image/png","image/jpeg","image/gif","image/webp"].includes(e.type.split(";")[0].trim().toLowerCase())}function Hce(e){if(!e)return[];if(e.items){const t=[];for(const a of e.items)if(a.kind==="file"&&a.type.startsWith("image/")){const o=a.getAsFile();o&&Ju(o)&&t.push(o)}if(t.length>0)return t}return e.files?Array.from(e.files).filter(Ju):[]}function Gce(e){if(!e)return!1;if(e.items){for(const t of e.items)if(t.kind==="file"&&t.type.startsWith("image/"))return!0}if(e.files){for(const t of e.files)if(Ju(t))return!0}return!1}const $ce={"image/png":".png","image/jpeg":".jpg","image/gif":".gif","image/webp":".webp"},wb=2;function Kce(e){return e===408||e===425||e===429||e>=500}async function bO(e,t){for(let a=0;a<wb;a+=1){let o;try{o=await fetch(e,t)}catch(i){if(typeof i=="object"&&i!==null&&"name"in i&&i.name==="AbortError"||a===wb-1)throw i;continue}if(!o.ok){if(Kce(o.status)&&a<wb-1){await o.body?.cancel().catch(()=>{});continue}const i=await o.json().catch(()=>({error:o.statusText}));throw Object.assign(new Error(i.error??"upload failed"),{status:o.status})}try{return await o.json()}catch(i){if(a===wb-1)throw new Error("upload returned an invalid response",{cause:i})}}throw new Error("upload failed")}function Wce(e,t,a){const o=a.split(";",1)[0].trim().toLowerCase(),i=$ce[o],s=is(t);if(!i||!s.toLowerCase().endsWith(i))throw new Error("upload returned invalid image metadata");const r=is(e.trim()),c=r.lastIndexOf(".");return`${(c>0?r.slice(0,c):r).trim()||"pasted image"}${i}`}function Jce(e){if(!Ju(e))return null;if(e.size>hO)throw Object.assign(new Error(`${e.name} exceeds 10 MB`),{status:413});const t=e.type.split(";",1)[0].trim().toLowerCase(),a=typeof URL.createObjectURL=="function"?URL.createObjectURL(e):void 0;return{kind:"image",id:C0(),path:"",name:e.name||"image",size:e.size,mime:t,...a?{previewUrl:a}:{},uploading:!0}}async function Ng(e,t){if(!Ju(e))return null;if(e.size>hO)throw Object.assign(new Error(`${e.name} exceeds 10 MB`),{status:413});const a=new Uint8Array(await e.arrayBuffer()),o=pO(),i=await bO(`/api/attachments?uploadId=${encodeURIComponent(o)}`,{method:"POST",headers:{"content-type":e.type},body:a});return{kind:"image",id:t?.id??C0(),path:i.path,name:Wce(e.name,i.path,i.mime),size:i.bytes,mime:i.mime,...t?.previewUrl?{previewUrl:t.previewUrl}:{}}}async function Yce(e){const t=e.type.split(";",1)[0].trim().toLowerCase(),a=e.name.split(".").at(-1)?.toLowerCase()??"",o=Vce(e)??(Uce.has(t)?t:fO[a])??(/^[\w.+-]+\/[\w.+-]+$/.test(t)?t:"application/octet-stream");if(e.size>r3)throw Object.assign(new Error(`${e.name} exceeds 25 MB`),{status:413});const i=pO(),s=await bO(`/api/files?name=${encodeURIComponent(e.name)}&uploadId=${encodeURIComponent(i)}`,{method:"POST",headers:{"content-type":o},body:e});return mO(s.name||e.name,s.path,s.bytes)}function yO(e){return{kind:"paste",id:C0(),text:e,size:tde(e),lines:uO(e)}}function Zce(e,t){return e?`${e}${e.endsWith(`
91
91
  `)?"":`
92
92
 
93
93
  `}${t}`:t}const Qce=512*1024;async function Xce(e,t){const a=await Promise.all(e.map(async o=>{let i="";try{i=t(o)}catch{}if(i)return{attachment:mO(o.name,i,o.size)};if(ede(o)&&o.size<=Qce)try{return{attachment:yO(await o.text())}}catch{}return{rejectedName:o.name}}));return{attachments:a.flatMap(o=>"attachment"in o&&o.attachment?[o.attachment]:[]),rejectedNames:a.flatMap(o=>"rejectedName"in o&&o.rejectedName?[o.rejectedName]:[])}}function ede(e){return e.type.startsWith("text/")||e.type==="application/json"}function tde(e){return new TextEncoder().encode(e).length}function nde(e){return`${e.lines} lines, ${l3(e.size)}`}function l3(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function e9(e,t){const a=[e.trim()];return t.forEach((o,i)=>{o.kind==="paste"?a.push(`<pasted-text index="${i+1}">
@@ -544,7 +544,7 @@ l0,-`+(a+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
544
544
  `.repeat(p)||" "),p=-1,d.push(h))}return d.join("")}function jU(e,t,a){return e.type==="element"?ECe(e,t,a):e.type==="text"?a.whitespace==="normal"?NU(e,a):RCe(e):[]}function ECe(e,t,a){const o=AU(e,a),i=e.children||[];let s=-1,r=[];if(TCe(e))return r;let c,d;for(M5(e)||MP(e)&&CP(t,e,MP)?d=`
545
545
  `:PCe(e)?(c=2,d=2):CU(e)&&(c=1,d=1);++s<i.length;)r=r.concat(jU(i[s],e,{whitespace:o,breakBefore:s?void 0:c,breakAfter:s<i.length-1?M5(i[s+1]):d}));return AP(e)&&CP(t,e,AP)&&r.push(" "),c&&r.unshift(c),d&&r.push(d),r}function NU(e,t){const a=String(e.value),o=[],i=[];let s=0;for(;s<=a.length;){jP.lastIndex=s;const d=jP.exec(a),p=d&&"index"in d?d.index:a.length;o.push(DCe(a.slice(s,p).replace(/[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,""),s===0?t.breakBefore:!0,p===a.length?t.breakAfter:!0)),s=p+1}let r=-1,c;for(;++r<o.length;)o[r].charCodeAt(o[r].length-1)===8203||r<o.length-1&&o[r+1].charCodeAt(0)===8203?(i.push(o[r]),c=void 0):o[r]?(typeof c=="number"&&i.push(c),i.push(o[r]),c=0):(r===0||r===o.length-1)&&i.push(0);return i}function RCe(e){return[String(e.value)]}function DCe(e,t,a){const o=[];let i=0,s;for(;i<e.length;){NP.lastIndex=i;const r=NP.exec(e);s=r?r.index:e.length,!i&&!s&&r&&!t&&o.push(""),i!==s&&o.push(e.slice(i,s)),i=r?s+r[0].length:s}return i!==s&&!a&&o.push(""),o.join(" ")}function AU(e,t){if(e.type==="element"){const a=e.properties||{};switch(e.tagName){case"listing":case"plaintext":case"xmp":return"pre";case"nobr":return"nowrap";case"pre":return a.wrap?"pre-wrap":"pre";case"td":case"th":return a.noWrap?"nowrap":t.whitespace;case"textarea":return"pre-wrap"}}return t.whitespace}function OCe(e){return!!(e.properties||{}).hidden}function zCe(e){return e.tagName==="td"||e.tagName==="th"}function LCe(e){return e.tagName==="dialog"&&!(e.properties||{}).open}const FCe={},_Ce=[];function qCe(e){const t=e||FCe;return function(a,o){RC(a,"element",function(i,s){const r=Array.isArray(i.properties.className)?i.properties.className:_Ce,c=r.includes("language-math"),d=r.includes("math-display"),p=r.includes("math-inline");let h=d;if(!c&&!d&&!p)return;let g=s[s.length-1],b=i;if(i.tagName==="code"&&c&&g&&g.type==="element"&&g.tagName==="pre"&&(b=g,g=s[s.length-2],h=!0),!g)return;const x=BCe(b,{whitespace:"pre"});let v;try{v=N5.renderToString(x,{...t,displayMode:h,throwOnError:!0})}catch(S){const N=S,C=N.name.toLowerCase();o.message("Could not render math with KaTeX",{ancestors:[...s,i],cause:N,place:i.position,ruleId:C,source:"rehype-katex"});try{v=N5.renderToString(x,{...t,displayMode:h,strict:"ignore",throwOnError:!1})}catch{v=[{type:"element",tagName:"span",properties:{className:["katex-error"],style:"color:"+(t.errorColor||"#cc0000"),title:String(S)},children:[{type:"text",value:x}]}]}}typeof v=="string"&&(v=CCe(v).children);const k=g.children.indexOf(b);return g.children.splice(k,1,...v),K_})}}const IP={js:"JavaScript",javascript:"JavaScript",jsx:"JavaScript (JSX)",ts:"TypeScript",typescript:"TypeScript",tsx:"TypeScript (TSX)",node:"Node.js",html:"HTML",htm:"HTML",css:"CSS",scss:"SCSS",sass:"Sass",less:"Less",json:"JSON",jsonc:"JSON",json5:"JSON5",xml:"XML",svg:"SVG",md:"Markdown",markdown:"Markdown",mdx:"MDX",yaml:"YAML",yml:"YAML",toml:"TOML",sh:"Bash",bash:"Bash",zsh:"Bash",shell:"Shell",ps1:"PowerShell",powershell:"PowerShell",fish:"Fish",c:"C",cpp:"C++","c++":"C++",cc:"C++",cxx:"C++",cs:"C#",csharp:"C#","c#":"C#",rs:"Rust",rust:"Rust",go:"Go",golang:"Go",py:"Python",python:"Python",rb:"Ruby",ruby:"Ruby",php:"PHP",java:"Java",kt:"Kotlin",kotlin:"Kotlin",swift:"Swift",dart:"Dart",r:"R",lua:"Lua",sql:"SQL",graphql:"GraphQL",gql:"GraphQL",proto:"Protobuf",protobuf:"Protobuf",docker:"Dockerfile",dockerfile:"Dockerfile",makefile:"Makefile",make:"Makefile",diff:"Diff",wasm:"WebAssembly"};function UCe(e){if(!e||!e.trim())return"Code";const t=e.trim().toLowerCase();return Object.prototype.hasOwnProperty.call(IP,t)?IP[t]??t:t.charAt(0).toUpperCase()+t.slice(1)}function VCe(e){return e?e.split(/\r\n|\r|\n/).length:0}function HCe(e){return e===1?"1 line":`${e} lines`}const PP={js:"js",javascript:"js",jsx:"jsx",ts:"ts",typescript:"ts",tsx:"tsx",node:"js",html:"html",htm:"html",css:"css",scss:"scss",sass:"sass",less:"less",json:"json",jsonc:"json",json5:"json5",xml:"xml",svg:"svg",md:"md",markdown:"md",mdx:"mdx",yaml:"yaml",yml:"yaml",toml:"toml",sh:"sh",bash:"sh",zsh:"zsh",shell:"sh",ps1:"ps1",powershell:"ps1",fish:"fish",c:"c",cpp:"cpp","c++":"cpp",cc:"cpp",cxx:"cpp",cs:"cs",csharp:"cs","c#":"cs",rs:"rs",rust:"rs",go:"go",golang:"go",py:"py",python:"py",rb:"rb",ruby:"rb",php:"php",java:"java",kt:"kt",kotlin:"kt",swift:"swift",dart:"dart",r:"r",lua:"lua",sql:"sql",graphql:"graphql",gql:"graphql",proto:"proto",protobuf:"proto",docker:"dockerfile",dockerfile:"dockerfile",makefile:"makefile",make:"makefile",diff:"diff",wasm:"wasm"};function GCe(e){if(!e||!e.trim())return"txt";const t=e.trim().toLowerCase();return Object.prototype.hasOwnProperty.call(PP,t)?PP[t]??"txt":/^[a-z0-9_-]{1,8}$/.test(t)?t:"txt"}function $Ce(e){const t=GCe(e);return t==="dockerfile"||t==="makefile"?t:`snippet.${t}`}function KCe(e,t){if(typeof document>"u"||typeof URL>"u")return;const a=new Blob([t],{type:"text/plain;charset=utf-8"}),o=URL.createObjectURL(a),i=document.createElement("a");i.href=o,i.download=e;try{document.body.appendChild(i),i.click()}finally{i.remove(),setTimeout(()=>URL.revokeObjectURL(o),1e3)}}const WCe=/^:?-+:?$/,MU=/\|(?:\s*:?-+:?\s*\|)+/;function ld(e){const t=e.trim().split("|");return t[0]?.trim()===""&&t.shift(),t.at(-1)?.trim()===""&&t.pop(),t.map(a=>a.trim())}const Ey=e=>`| ${e.join(" | ")} |`;function i2(e){if(!e.includes("|"))return!1;const t=ld(e);return t.length>0&&t.every(a=>WCe.test(a))}const s2=e=>ld(e).length>=2&&e.includes("|");function IU(e,t){const a=ld(e);return Ey(Array.from({length:t},(o,i)=>a[i]??"---"))}function JCe(e){if(!/^ {0,3}\|/.test(e))return null;const t=MU.exec(e);if(!t)return null;const a=e.slice(0,t.index),o=e.slice(t.index+t[0].length),i=ld(a);if(i.length<2||!a.trimEnd().endsWith("|")||o.trim()!==""&&!o.trimStart().startsWith("|"))return null;const s=[Ey(i),IU(t[0],i.length)];let r=[],c=!1;for(const d of ld(o))c&&(c=!1,d==="")||(r.push(d),r.length===i.length&&(s.push(Ey(r)),r=[],c=!0));if(r.length>0){for(;r.length<i.length;)r.push("");s.push(Ey(r))}return s}function YCe(e){const t=e.split(`
546
546
  `),a=[];let o=!1;for(const[i,s]of t.entries()){if(o&&s.includes("|")){a.push(s);continue}if(o=!1,MU.exec(s)&&!i2(s)&&!i2(t[i+1]??"")){const c=JCe(s);if(c){a.length>0&&a.at(-1)?.trim()!==""&&!s2(a.at(-1)??"")&&a.push(""),a.push(...c);continue}}if(i2(s)){const c=a.at(-1)??"";if(s2(c)){o=!0;const d=a.at(-2);d!==void 0&&d.trim()!==""&&!s2(d)&&a.splice(a.length-1,0,"");const p=ld(c).length;if(ld(s).length!==p){a.push(IU(s,p));continue}}}a.push(s)}return a.join(`
547
- `)}function ZCe(e){if(!e.includes("|"))return e;const t=[];let a=0;for(const o of IC(e).children){if(o.type!=="paragraph")continue;const i=o.position?.start.offset,s=o.position?.end.offset;if(i===void 0||s===void 0)continue;const r=e.slice(i,s);/[`\\]/.test(r)||(t.push(e.slice(a,i),YCe(r)),a=s)}return t.push(e.slice(a)),t.join("")}const PU=new WeakSet,QCe=/^[A-Za-z]:(?:[\\/]|$)/,XCe=new Set(["\\","(",")","<",">"]);function TP(){this.buffer(),PU.add(this.stack[this.stack.length-1])}function e6e(e){const t=this.stack.pop(),a=this.sliceSerialize(e),o=PU.has(this.stack[this.stack.length-1])&&QCe.test(t.value)&&!XCe.has(a);t.value+=o?`\\${a}`:a,t.position.end={line:e.end.line,column:e.end.column,offset:e.end.offset}}const TU={enter:{resourceDestinationString:TP,definitionDestinationString:TP},exit:{characterEscapeValue:e6e}},a6=Object.freeze([{id:"github",name:"GitHub",description:"Read code, issues and pull requests in your repositories.",category:"dev",url:"https://api.githubcopilot.com/mcp/",transport:"http"},{id:"notion",name:"Notion",description:"Search, read and write pages in your Notion workspace.",category:"productivity",url:"https://mcp.notion.com/mcp",transport:"http"},{id:"linear",name:"Linear",description:"Find, create and update Linear issues and projects.",category:"productivity",url:"https://mcp.linear.app/mcp",transport:"http"},{id:"atlassian",name:"Atlassian",description:"Work with Jira issues and Confluence pages.",category:"productivity",url:"https://mcp.atlassian.com/v2/mcp",transport:"http",aliases:["jira","confluence"]},{id:"asana",name:"Asana",description:"See and update tasks and projects in Asana.",category:"productivity",url:"https://mcp.asana.com/v2/mcp",transport:"http"},{id:"sentry",name:"Sentry",description:"Look into errors and issues from your Sentry projects.",category:"dev",url:"https://mcp.sentry.dev/mcp",transport:"http"},{id:"vercel",name:"Vercel",description:"Check deployments, logs and projects on Vercel.",category:"dev",url:"https://mcp.vercel.com",transport:"http"},{id:"supabase",name:"Supabase",description:"Manage Supabase projects, tables and edge functions.",category:"data",url:"https://mcp.supabase.com/mcp",transport:"http"},{id:"cloudflare",name:"Cloudflare Docs",description:"Search Cloudflare's developer documentation. No sign-in.",category:"dev",url:"https://docs.mcp.cloudflare.com/mcp",transport:"http"},{id:"huggingface",name:"Hugging Face",description:"Search models, datasets, Spaces and papers.",category:"data",url:"https://huggingface.co/mcp",transport:"http"},{id:"canva",name:"Canva",description:"Find, create and export Canva designs.",category:"design",url:"https://mcp.canva.com/mcp",transport:"http"},{id:"webflow",name:"Webflow",description:"Edit Webflow sites, pages and CMS content.",category:"design",url:"https://mcp.webflow.com/mcp",transport:"http"},{id:"hubspot",name:"HubSpot",description:"Look up contacts, companies and deals in HubSpot.",category:"data",url:"https://mcp.hubspot.com/",transport:"http"},{id:"stripe",name:"Stripe",description:"Look up customers, payments and invoices in Stripe.",category:"payments",url:"https://mcp.stripe.com",transport:"http"},{id:"paypal",name:"PayPal",description:"Work with PayPal invoices, orders and transactions.",category:"payments",url:"https://mcp.paypal.com/mcp",transport:"http"},{id:"dropbox",name:"Dropbox",description:"Search, organize and share files in your Dropbox.",category:"productivity",url:"https://mcp.dropbox.com/mcp",transport:"http"},{id:"granola",name:"Granola",description:"Search your Granola meeting notes and transcripts.",category:"productivity",url:"https://mcp.granola.ai/mcp",transport:"http",aliases:["granola ai"]},{id:"square",name:"Square",description:"See Square payments, orders, catalog and customers.",category:"payments",url:"https://mcp.squareup.com/sse",transport:"sse"},{id:"pax8",name:"Pax8",description:"Look up Pax8 products, subscriptions and client companies.",category:"msp",url:"https://mcp.pax8.com/v1/mcp",transport:"http",aliases:["pax 8"]},{id:"huntress",name:"Huntress",description:"Review Huntress agents, incidents, signals and reports.",category:"security",url:"https://api.huntress.io/v1/mcp",transport:"http"},{id:"jumpcloud",name:"JumpCloud",description:"Look up JumpCloud users, devices and groups as an administrator.",category:"security",url:"https://mcp.jumpcloud.com/v1",transport:"http",aliases:["jump cloud"]},{id:"vanta",name:"Vanta",description:"Check compliance tests, controls and vendor risk in Vanta.",category:"security",url:"https://mcp.vanta.com/mcp",transport:"http"},{id:"semgrep",name:"Semgrep",description:"Scan code for security issues with Semgrep.",category:"security",url:"https://mcp.semgrep.ai/mcp",transport:"http"},{id:"socket",name:"Socket",description:"Check open source packages for supply chain risk. No sign-in.",category:"security",url:"https://mcp.socket.dev/",transport:"http",aliases:["socket.dev"]},{id:"zapier",name:"Zapier",description:"Run actions in the apps you have connected to your Zapier account.",category:"productivity",url:"https://mcp.zapier.com/api/v1/connect",transport:"http",aliases:["zaps"]},{id:"monday",name:"monday.com",description:"See and update boards, items and updates in monday.com.",category:"productivity",url:"https://mcp.monday.com/mcp",transport:"http",aliases:["monday"]},{id:"clickup",name:"ClickUp",description:"Find, create and update ClickUp tasks and docs.",category:"productivity",url:"https://mcp.clickup.com/mcp",transport:"http",aliases:["click up"]},{id:"calendly",name:"Calendly",description:"See Calendly event types, bookings and availability.",category:"productivity",url:"https://mcp.calendly.com",transport:"http"},{id:"fireflies",name:"Fireflies",description:"Search Fireflies meeting transcripts and summaries.",category:"productivity",url:"https://api.fireflies.ai/mcp",transport:"http",aliases:["fireflies.ai"]},{id:"otter",name:"Otter",description:"Search Otter meeting notes and transcripts.",category:"productivity",url:"https://mcp.otter.ai/mcp",transport:"http",aliases:["otter.ai","otter ai"]},{id:"todoist",name:"Todoist",description:"Add, find and complete tasks in Todoist.",category:"productivity",url:"https://ai.todoist.net/mcp",transport:"http"},{id:"jotform",name:"Jotform",description:"Build Jotform forms and read their submissions.",category:"productivity",url:"https://mcp.jotform.com/",transport:"http"},{id:"egnyte",name:"Egnyte",description:"Search and read files stored in Egnyte.",category:"productivity",url:"https://mcp-server.egnyte.com/mcp",transport:"http"},{id:"intercom",name:"Intercom",description:"Search Intercom conversations, contacts and tickets.",category:"crm",url:"https://mcp.intercom.com/mcp",transport:"http"},{id:"pipedrive",name:"Pipedrive",description:"Work with deals, contacts and activities in Pipedrive.",category:"crm",url:"https://mcp.pipedrive.ai/mcp",transport:"http"},{id:"apollo",name:"Apollo.io",description:"Find and enrich people and companies in Apollo.",category:"crm",url:"https://mcp.apollo.io/mcp",transport:"http",aliases:["apollo"]},{id:"attio",name:"Attio",description:"Look up and update records and lists in Attio.",category:"crm",url:"https://mcp.attio.com/mcp",transport:"http"},{id:"close",name:"Close",description:"Work with leads, contacts and opportunities in Close.",category:"crm",url:"https://mcp.close.com/mcp",transport:"http",aliases:["close crm","close.com"]},{id:"zoominfo",name:"ZoomInfo",description:"Search ZoomInfo company and contact data.",category:"crm",url:"https://mcp.zoominfo.com/mcp",transport:"http",aliases:["zoom info"]},{id:"gong",name:"Gong",description:"Search Gong calls, deals and conversation insights.",category:"crm",url:"https://mcp.gong.io/mcp",transport:"http"},{id:"klaviyo",name:"Klaviyo",description:"See Klaviyo campaigns, flows, lists and results.",category:"crm",url:"https://mcp.klaviyo.com/mcp",transport:"http"},{id:"ramp",name:"Ramp",description:"Look up Ramp card transactions, bills and spend.",category:"finance",url:"https://mcp.ramp.com/mcp",transport:"http"},{id:"mercury",name:"Mercury",description:"See Mercury bank accounts, balances and transactions.",category:"finance",url:"https://mcp.mercury.com/mcp",transport:"http"},{id:"brex",name:"Brex",description:"See Brex expenses, cards and spend.",category:"finance",url:"https://api.brex.com/mcp",transport:"http"},{id:"expensify",name:"Expensify",description:"Work with Expensify expense reports and expenses.",category:"finance",url:"https://mcp.expensify.com/mcp/",transport:"http"},{id:"paddle",name:"Paddle",description:"Look up Paddle products, subscriptions and transactions.",category:"payments",url:"https://mcp.paddle.com/mcp",transport:"http"},{id:"miro",name:"Miro",description:"Read and create boards, diagrams and sticky notes in Miro.",category:"design",url:"https://mcp.miro.com/",transport:"http"},{id:"gamma",name:"Gamma",description:"Create presentations, documents and web pages with Gamma.",category:"design",url:"https://mcp.gamma.app/mcp",transport:"http"},{id:"wix",name:"Wix",description:"Manage Wix sites, content and business apps.",category:"design",url:"https://mcp.wix.com/mcp",transport:"http"},{id:"heygen",name:"HeyGen",description:"Create AI avatar videos with HeyGen.",category:"design",url:"https://mcp.heygen.com/mcp/v1/",transport:"http",aliases:["hey gen"]},{id:"squarespace",name:"Squarespace Domains",description:"Check which domain names are free to register. No sign-in.",category:"design",url:"https://mcp.squarespace.com/mcp",transport:"http",aliases:["squarespace"]},{id:"airtable",name:"Airtable",description:"Read and update records in your Airtable bases.",category:"data",url:"https://mcp.airtable.com/mcp",transport:"http"},{id:"posthog",name:"PostHog",description:"Query product analytics, feature flags and errors in PostHog.",category:"data",url:"https://mcp.posthog.com/mcp",transport:"http",aliases:["post hog"]},{id:"perplexity",name:"Perplexity",description:"Search the web with Perplexity and get cited answers.",category:"data",url:"https://api.perplexity.ai/mcp",transport:"http"},{id:"exa",name:"Exa",description:"Search the web and read pages with Exa. No sign-in.",category:"data",url:"https://mcp.exa.ai/mcp",transport:"http",aliases:["exa search","exa ai"]},{id:"tavily",name:"Tavily",description:"Search the web and pull content from pages with Tavily.",category:"data",url:"https://mcp.tavily.com/mcp/",transport:"http"},{id:"microsoft-learn",name:"Microsoft Learn",description:"Search Microsoft's official docs and code samples. No sign-in.",category:"dev",url:"https://learn.microsoft.com/api/mcp",transport:"http",aliases:["microsoft docs","azure docs","intune docs","ms learn"]},{id:"cloudflare-api",name:"Cloudflare",description:"Manage Cloudflare accounts, DNS, Workers and more.",category:"dev",url:"https://mcp.cloudflare.com/mcp",transport:"http",aliases:["cloudflare api"]},{id:"gitlab",name:"GitLab",description:"Work with GitLab issues, merge requests and pipelines.",category:"dev",url:"https://gitlab.com/api/v4/mcp",transport:"http",aliases:["git lab"]},{id:"netlify",name:"Netlify",description:"Deploy and manage Netlify sites and projects.",category:"dev",url:"https://netlify-mcp.netlify.app/mcp",transport:"http"},{id:"railway",name:"Railway",description:"Check Railway projects, deployments and logs.",category:"dev",url:"https://mcp.railway.com",transport:"http"},{id:"neon",name:"Neon",description:"Manage Neon Postgres projects, branches and queries.",category:"dev",url:"https://mcp.neon.tech/mcp",transport:"http",aliases:["neon postgres"]},{id:"prisma",name:"Prisma",description:"Manage Prisma Postgres databases.",category:"dev",url:"https://mcp.prisma.io/mcp",transport:"http"},{id:"postman",name:"Postman",description:"Work with Postman collections, APIs and workspaces.",category:"dev",url:"https://mcp.postman.com/mcp",transport:"http"},{id:"datadog",name:"Datadog",description:"Search Datadog logs, metrics, monitors and incidents.",category:"dev",url:"https://mcp.datadoghq.com/api/unstable/mcp-server/mcp",transport:"http"},{id:"grafana",name:"Grafana Cloud",description:"Query dashboards, metrics and logs in Grafana Cloud.",category:"dev",url:"https://mcp.grafana.com/mcp",transport:"http",aliases:["grafana"]},{id:"honeycomb",name:"Honeycomb",description:"Query traces and events in Honeycomb.",category:"dev",url:"https://mcp.honeycomb.io/mcp",transport:"http"},{id:"buildkite",name:"Buildkite",description:"Check Buildkite pipelines, builds and jobs.",category:"dev",url:"https://mcp.buildkite.com/mcp",transport:"http"},{id:"sanity",name:"Sanity",description:"Query and edit content in Sanity.",category:"dev",url:"https://mcp.sanity.io",transport:"http"},{id:"resend",name:"Resend",description:"Send email and manage domains and audiences in Resend.",category:"dev",url:"https://mcp.resend.com/mcp",transport:"http"},{id:"stytch",name:"Stytch",description:"Manage Stytch projects and sign-in settings.",category:"dev",url:"https://mcp.stytch.dev/mcp",transport:"http"}]);function t6e(e){return a6.find(t=>t.id===e)}function o6(e){return`/mcp-icons/${e}.svg`}function BP(e){return e.toLowerCase().replace(/[^\p{L}\p{N}.]+/gu," ").replace(/\s+/g," ").trim()}function i6(e,t){const a=BP(e);if(a.length<2)return!1;const o=` ${a} `;return t.some(i=>{const s=BP(i);return s?s===a||o.includes(` ${s} `)?!0:a.length>=3&&` ${s} `.includes(o):!1})}function n6e(e){return a6.filter(t=>i6(e,[t.id,t.name,...t.aliases??[]]))}function a6e(e){return JO.filter(t=>i6(e,[t.id,t.name,...t.aliases]))}const o6e=Object.freeze([{name:"QuickBooks",claude:"quickbooks"},{name:"Granola",featured:"granola"},{name:"Gmail",claude:"gmail"},{name:"Google Calendar",claude:"google-calendar"},{name:"Google Drive",claude:"google-drive"},{name:"Microsoft 365",claude:"microsoft-365"},{name:"Slack",claude:"slack"},{name:"Zoom",claude:"zoom"},{name:"Docusign",claude:"docusign"},{name:"HubSpot",featured:"hubspot"},{name:"Stripe",featured:"stripe"},{name:"Canva",featured:"canva"},{name:"Notion",featured:"notion"},{name:"Asana",featured:"asana"}]);function i6e(e){const t=e.featured?t6e(e.featured):void 0;if(t)return{kind:"direct",server:t};const a=e.claude?Fue(e.claude):void 0;return a?{kind:"claude",connector:a}:{kind:"none"}}function s6e(e=X){const[t,a]=f.useState(null);return f.useEffect(()=>{let o=!0;return e("/api/marketplace/claude-connectors").then(i=>o&&a(i)).catch(()=>o&&a("error")),()=>{o=!1}},[e]),t}function r6e(e,t){return!t||t==="error"?[]:t.engines.filter(a=>a.connectors.some(o=>o.state==="connected"&&i6(o.name.replace(/^claude\.ai\s+/i,""),[e.name,...e.aliases])))}function BU({connector:e,data:t}){return r6e(e,t).length?n.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-success/10 px-2 py-0.5 text-[10.5px] font-medium text-success","data-testid":"connected-via-claude",children:[n.jsx(gt,{size:11})," ",l("mcpMarket.claude.connected")]}):null}function s6({label:e}){return n.jsxs("button",{type:"button",onClick:()=>{Pl(WO)},className:"inline-flex items-center gap-1.5 rounded-full bg-raised px-3 py-1.5 text-[12.5px] font-medium text-ink hover:bg-raised-hover",children:[n.jsx(An,{size:13})," ",e??l("mcpMarket.claude.open")]})}function l6e({name:e}){return n.jsxs("button",{type:"button",onClick:()=>Dg("idea",l("feedback.connectionIdea",{name:e})),"aria-label":l("mcpMarket.suggestAria",{name:e}),className:"inline-flex items-center gap-1.5 rounded-full bg-raised px-3 py-1.5 text-[12.5px] font-medium text-ink hover:bg-raised-hover",children:[n.jsx(u4,{size:13})," ",l("mcpMarket.suggest")]})}function c6e({connector:e,data:t,highlight:a=!1}){return n.jsxs("div",{className:V("flex flex-col rounded-2xl border bg-card/80 p-4",a?"border-accent/60":"border-hairline/50"),"data-testid":"claude-connector","data-connector":e.id,children:[n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx(cg,{name:e.name}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"truncate text-[14px] font-semibold text-ink",children:e.name}),n.jsxs("div",{className:"mt-1 flex flex-wrap gap-1.5",children:[n.jsx("span",{className:"inline-block rounded-full bg-raised px-2 py-0.5 text-[10.5px] font-medium text-ink-secondary",children:l("mcpMarket.path.claude")}),n.jsx(BU,{connector:e,data:t})]})]})]}),n.jsx("p",{className:"mt-2.5 flex-1 text-[12.5px] leading-snug text-ink-secondary",children:e.description}),n.jsx("div",{className:"mt-3",children:n.jsx(s6,{})})]})}function d6e({query:e,data:t,renderFeatured:a}){const o=e.trim();if(!o)return null;const i=n6e(o),s=i.length?[]:a6e(o);return n.jsxs("section",{"aria-labelledby":"mcp-best-title",className:"mb-9","data-testid":"marketplace-best-match",children:[n.jsx("h3",{id:"mcp-best-title",className:"text-[15px] font-semibold text-ink",children:l("mcpMarket.best.title",{query:o})}),i.length||s.length?n.jsxs("div",{className:"mt-4 grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3",children:[i.map(r=>n.jsx("div",{className:"contents",children:a(r)},r.id)),s.map(r=>n.jsx(c6e,{connector:r,data:t,highlight:!0},r.id))]}):n.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-3 rounded-2xl border border-hairline/50 bg-raised/35 px-4 py-3",children:[n.jsx("p",{className:"min-w-0 flex-1 text-[12.5px] text-ink-secondary",children:l("mcpMarket.best.none",{query:o})}),n.jsx(l6e,{name:o})]})]})}function u6e({data:e,renderAdd:t}){return n.jsxs("section",{"aria-labelledby":"mcp-recommended-title",className:"mb-9","data-testid":"marketplace-recommended",children:[n.jsx("h3",{id:"mcp-recommended-title",className:"text-[15px] font-semibold text-ink",children:l("mcpMarket.recommended.title")}),n.jsx("p",{className:"mt-1 max-w-[640px] text-[12.5px] leading-relaxed text-ink-secondary",children:l("mcpMarket.recommended.subtitle")}),n.jsx("ul",{className:"mt-4 grid grid-cols-1 gap-2 md:grid-cols-2",children:o6e.map(a=>{const o=i6e(a);return o.kind==="none"?null:n.jsxs("li",{className:"flex items-center gap-3 rounded-xl border border-hairline/40 bg-card/70 px-3 py-2.5","data-path":o.kind,children:[n.jsx(cg,{src:o.kind==="direct"?o6(o.server.id):void 0,name:a.name,className:"size-8"}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"truncate text-[13.5px] font-medium text-ink",children:a.name}),n.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-1.5 text-[11px] text-ink-secondary",children:[l(o.kind==="direct"?"mcpMarket.path.direct":"mcpMarket.path.claude"),o.kind==="claude"&&n.jsx(BU,{connector:o.connector,data:e})]})]}),n.jsx("div",{className:"shrink-0",children:o.kind==="direct"?t(o.server):n.jsx(s6,{label:l("mcpMarket.claude.turnOn")})})]},a.name)})})]})}const p6e=e=>e==="personal"?"mcpMarket.claude.owner.personal":"mcpMarket.claude.owner.company";function m6e({data:e,claudeSwitch:t}){return n.jsxs("section",{"aria-labelledby":"mcp-claude-title",className:"mt-9","data-testid":"marketplace-claude",children:[n.jsx("h3",{id:"mcp-claude-title",className:"text-[15px] font-semibold text-ink",children:l("mcpMarket.claude.title")}),n.jsx("p",{className:"mt-1 max-w-[640px] text-[12.5px] leading-relaxed text-ink-secondary",children:l("mcpMarket.claude.subtitle")}),n.jsx("div",{className:"mt-3",children:n.jsx(s6,{})}),t,n.jsx("div",{className:"mt-4","aria-live":"polite",children:e===null?n.jsxs("div",{className:"flex items-center gap-2 text-[12.5px] text-ink-secondary",children:[n.jsx(Ie,{size:13,className:"animate-spin"})," ",l("mcpMarket.claude.loading")]}):e==="error"?null:e.engines.length===0?n.jsx("p",{className:"text-[12.5px] text-ink-secondary",children:l("mcpMarket.claude.noEngine")}):n.jsx("div",{className:"flex flex-col gap-3",children:e.engines.map(a=>{const o=l("mcpMarket.claude.engine",{engine:a.displayName,owner:l(p6e(a.owner))}),i=a.connectors.filter(s=>s.state==="connected");return n.jsxs("div",{className:"rounded-xl border border-hairline/40 bg-card/70 px-3 py-2.5","data-testid":"claude-engine",children:[n.jsx("div",{className:"text-[13px] font-medium text-ink",children:o}),n.jsx("p",{className:"mt-1 text-[12px] text-ink-secondary",children:a.state==="api-key"?l("mcpMarket.claude.apiKey",{engine:a.displayName}):a.state==="signed-out"?l("mcpMarket.claude.signedOut",{engine:a.displayName}):a.state==="error"?l("mcpMarket.claude.error",{engine:a.displayName}):i.length===0?l("mcpMarket.claude.none"):i.map(s=>s.name.replace(/^claude\.ai\s+/i,"")).join(", ")})]},a.instanceId)})})})]})}async function h6e(e,t=X,a=!1){try{const o=await t("/api/mcp/registry/add",{method:"POST",body:JSON.stringify({id:e,...a?{overrideThreatScan:!0}:{}})});return o.threatScan&&o.threatScan.verdict!=="clean"?{kind:"added",name:o.added,threatScan:o.threatScan}:{kind:"added",name:o.added}}catch(o){const i=N0(o),s=o instanceof Error?o.message:String(o);return i?{kind:"blocked",error:s,threatScan:i}:{kind:"error",error:s}}}function g6e(e,t){const a=s=>s.replace(/\/+$/,"").toLowerCase(),o=new Set(t.urls.map(a));return e.find(s=>s.url&&o.has(a(s.url))?!0:(s.args??[]).some(r=>o.has(a(r))||t.packages.some(c=>r===c||r.startsWith(`${c}@`)||r.startsWith(`${c}==`))))?.name}function f6e(e){let t=0;for(const a of e)t=t*31+a.charCodeAt(0)|0;return`hsl(${Math.abs(t)%360} 55% 45%)`}function cg({src:e,name:t,className:a="size-11"}){const[o,i]=f.useState(!1);return e&&!o?n.jsx("img",{src:e,alt:"",loading:"lazy",className:V("shrink-0 rounded-xl object-contain",a),onError:()=>i(!0)}):n.jsx("div",{"aria-hidden":"true",className:V("flex shrink-0 items-center justify-center rounded-xl text-[16px] font-semibold text-white",a),style:{backgroundColor:f6e(t)},children:(t.trim()[0]??"?").toUpperCase()})}function b6e({state:e,onAddAnyway:t}){return n.jsxs(n.Fragment,{children:[n.jsx("p",{role:"alert",className:"mt-2 text-[11.5px] text-danger",children:e.error}),e.threatScan&&n.jsx(Tl,{result:e.threatScan}),e.threatScan&&t&&n.jsx("button",{type:"button",onClick:t,className:"mt-2 rounded-lg bg-danger px-3 py-1.5 text-[12px] font-semibold text-white",children:l("threatScan.addAnyway")})]})}function y6e({onOpenMcp:e}){return n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.jsxs("span",{role:"status",className:"flex items-center gap-1 text-[12px] font-medium text-success",children:[n.jsx(gt,{size:13})," ",l("mcpMarket.added")]}),n.jsx("button",{type:"button",onClick:e,className:"rounded-full bg-accent px-3 py-1.5 text-[12px] font-medium text-accent-ink hover:opacity-90",children:l("mcpMarket.openMcp")})]})}function EU({name:e,busy:t,onClick:a,large:o=!1}){return n.jsx("button",{type:"button",disabled:t,onClick:a,"aria-label":l("mcpMarket.addAria",{name:e}),className:V("flex items-center justify-center gap-1.5 rounded-full bg-accent font-medium text-accent-ink transition-opacity hover:opacity-90 disabled:opacity-50",o?"min-w-[92px] px-4 py-2 text-[13px]":"min-w-[76px] px-3 py-1.5 text-[12.5px]"),children:t?n.jsx(Ie,{size:14,className:"animate-spin"}):n.jsxs(n.Fragment,{children:[n.jsx(vn,{size:14}),l("mcpMarket.add")]})})}function x6e({server:e,state:t,onAdd:a,onOpenMcp:o,onAddAnyway:i}){return n.jsxs("div",{className:"flex flex-col rounded-2xl border border-hairline/50 bg-card/80 p-4 shadow-sm shadow-black/5 backdrop-blur-sm transition-colors hover:border-hairline",children:[n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx(cg,{src:o6(e.id),name:e.name}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"truncate text-[14px] font-semibold text-ink",children:e.name}),n.jsx("span",{className:"mt-1 inline-block rounded-full bg-raised px-2 py-0.5 text-[10.5px] font-medium text-ink-secondary",children:l(`mcpMarket.category.${e.category}`)})]})]}),n.jsx("p",{className:"mt-2.5 min-h-[34px] flex-1 text-[12.5px] leading-snug text-ink-secondary",children:e.description}),n.jsxs("div",{className:"mt-3",children:[t.phase==="added"?n.jsx(y6e,{onOpenMcp:o}):n.jsx(EU,{name:e.name,busy:t.phase==="adding",onClick:a,large:!0}),t.phase==="error"&&n.jsx(b6e,{state:t,onAddAnyway:i}),t.phase==="added"&&t.threatScan&&n.jsx(Tl,{result:t.threatScan,compact:!0})]})]})}function v6e({query:e,onQueryChange:t,onOpenMcp:a,request:o=X,claudeSwitch:i}){const[s,r]=f.useState({}),[c,d]=f.useState([]),p=s6e(o),h=f.useCallback((S,N)=>r(C=>({...C,[S]:N})),[]);f.useEffect(()=>{let S=!0;return o("/api/mcp/servers").then(N=>S&&d(N.servers??[])).catch(()=>{}),()=>{S=!1}},[o]);const g=f.useRef(new Set),b=async(S,N=!1)=>{const C=`featured:${S.id}`;h(C,{phase:"adding"});const j=await h6e(C,o,N);j.kind==="added"?(g.current.delete(C),h(C,j.threatScan?{phase:"added",name:j.name,threatScan:j.threatScan}:{phase:"added",name:j.name}),d(M=>[...M,{name:j.name}])):j.kind==="blocked"?(g.current.add(C),h(C,{phase:"error",error:j.error,threatScan:j.threatScan})):h(C,{phase:"error",error:j.error||S.name})},x=S=>{const N=s[`featured:${S.id}`];if(N&&N.phase!=="idle")return N;const C=g6e(c,{urls:[S.url],packages:[]});return C?{phase:"added",name:C}:{phase:"idle"}},v=S=>n.jsx(x6e,{server:S,state:x(S),onAdd:()=>{b(S)},onOpenMcp:a,onAddAnyway:()=>g.current.has(`featured:${S.id}`)&&void b(S,!0)},S.id),k=S=>{const N=x(S);return N.phase==="added"?n.jsxs("span",{className:"inline-flex items-center gap-1 text-[12px] font-medium text-success",children:[n.jsx(gt,{size:13}),l("mcpMarket.addedShort")]}):n.jsx(EU,{name:S.name,busy:N.phase==="adding",onClick:()=>{b(S)}})};return n.jsxs("div",{children:[n.jsxs("label",{className:"mb-6 flex h-11 w-full items-center gap-2.5 rounded-xl border border-hairline/50 bg-raised/70 px-3.5 sm:max-w-[480px]",children:[n.jsx(za,{size:17,className:"shrink-0 text-ink-secondary"}),n.jsx("input",{type:"search",value:e,onChange:S=>t(S.target.value),placeholder:l("mcpMarket.search.officialPlaceholder"),"aria-label":l("mcpMarket.search.officialPlaceholder"),className:"min-w-0 flex-1 bg-transparent text-[14px] text-ink placeholder:text-ink-secondary focus:outline-none"})]}),n.jsx(d6e,{query:e,data:p,renderFeatured:v}),n.jsx(u6e,{data:p,renderAdd:k}),n.jsxs("section",{"aria-labelledby":"mcp-featured-title",children:[n.jsx("h3",{id:"mcp-featured-title",className:"text-[15px] font-semibold text-ink",children:l("mcpMarket.featured.title")}),n.jsx("p",{className:"mt-1 max-w-[640px] text-[12.5px] leading-relaxed text-ink-secondary",children:l("mcpMarket.featured.subtitle")}),n.jsx("div",{className:"mt-4 grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3",children:a6.map(v)})]}),n.jsx(m6e,{data:p,claudeSwitch:i}),n.jsxs("p",{className:"mt-8 max-w-[640px] text-[12px] leading-relaxed text-ink-secondary","data-testid":"marketplace-official-note",children:[l("mcpMarket.officialOnly")," ",n.jsx("button",{type:"button",className:"font-medium text-accent underline-offset-2 hover:underline",onClick:a,children:l("mcpMarket.officialOnlyLink")})]})]})}function RU({message:e}){const{dispatch:t}=ve(),a=e.marketplace;if(!a)return null;const o=()=>t({type:"openMarketplace",query:a.query,...a.serverId?{serverId:a.serverId}:{}}),i=a.source==="featured"&&a.serverId?.startsWith("featured:")?a.serverId.slice(9):void 0;return a.source==="none"?n.jsx("div",{className:"w-[min(30rem,100%)] rounded-2xl border border-hairline/50 bg-card px-4 py-3.5","data-testid":"marketplace-card","data-source":"none",children:n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-xl bg-raised text-ink-secondary",children:n.jsx(u4,{size:17})}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"text-[14px] font-medium text-ink",children:l("chat.marketplace.none",{name:a.name})}),n.jsx("p",{className:"mt-0.5 text-[12.5px] leading-relaxed text-ink-secondary",children:l("chat.marketplace.noneHint")}),n.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[n.jsx("button",{type:"button",className:"rounded-lg bg-accent px-3 py-1.5 text-[12.5px] font-medium text-white hover:opacity-90",onClick:()=>Dg("idea",l("feedback.connectionIdea",{name:a.name})),children:l("chat.marketplace.suggest")}),n.jsx("button",{type:"button",className:"ui-button",onClick:o,children:l("chat.marketplace.open")})]})]})]})}):n.jsx("div",{className:"w-[min(30rem,100%)] rounded-2xl border border-hairline/50 bg-card px-4 py-3.5","data-testid":"marketplace-card","data-source":a.source,children:n.jsxs("div",{className:"flex items-start gap-3",children:[i?n.jsx(cg,{src:o6(i),name:a.name,className:"size-9"}):n.jsx(cg,{name:a.name,className:"size-9"}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"text-[14px] font-medium text-ink",children:a.name}),n.jsx("p",{className:"mt-0.5 text-[12.5px] leading-relaxed text-ink-secondary",children:a.source==="claude"?l("chat.marketplace.claudeHint"):l("chat.marketplace.directHint")}),n.jsx("button",{type:"button",className:"mt-3 rounded-lg bg-accent px-3 py-1.5 text-[12.5px] font-medium text-white hover:opacity-90",onClick:o,children:a.source==="claude"?l("chat.marketplace.connectClaude",{name:a.name}):l("chat.marketplace.connect",{name:a.name})})]})]})})}function k6e({query:e,serverId:t,children:a}){const{dispatch:o}=ve();return n.jsxs("button",{type:"button",onClick:()=>o({type:"openMarketplace",query:e,...t?{serverId:t}:{}}),className:"inline-flex items-center gap-1 rounded-md bg-accent/10 px-1.5 py-0.5 align-baseline text-[13.5px] font-medium text-accent hover:bg-accent/15","data-testid":"marketplace-link",children:[n.jsx(s0,{size:13,"aria-hidden":"true"}),a??l("chat.marketplace.open")]})}const w6e="chibi://marketplace";function r6(e){return e.trim().toLowerCase().startsWith(w6e)}function S6e(e){if(!r6(e))return null;let t;try{t=new URL(e.trim())}catch{return null}if(t.hostname.toLowerCase()!=="marketplace"||t.pathname&&t.pathname!=="/")return null;const a=(t.searchParams.get("q")??"").replace(/\s+/g," ").trim().slice(0,80),o=(t.searchParams.get("server")??"").trim().slice(0,300);return{query:a,...o?{serverId:o}:{}}}const _m=new Map,C6e=200,qm=new Map,j6e=50;let EP=0;const DU=250,OU=e=>{let t=2166136261;for(let a=0;a<e.length;a++)t^=e.charCodeAt(a),t=Math.imul(t,16777619);return(t>>>0).toString(36)},zU=/^[a-zA-Z]:[\\/]/,RP=e=>e.startsWith("/")||zU.test(e)?e:null,dg=e=>{if(!e)return null;if(/^file:\/\//i.test(e))try{const a=new URL(e);if(a.username||a.password||a.port||a.search||a.hash)return null;const o=decodeURIComponent(a.pathname);return a.hostname&&a.hostname!=="localhost"?`//${a.hostname}${o}`:/^\/[a-z]:[\\/]/i.test(o)?o.slice(1):RP(o)}catch{return null}if(e.startsWith("\\\\"))return e;if(e.startsWith("//"))return null;const t=RP(e);return t||(e.startsWith("#")||/^[a-z][a-z\d+.-]*:/i.test(e)?null:e)};function N6e(e){if(eL(e)||r6(e))return e;const t=/^[a-zA-Z]:%5C/i.test(e)?e.replace(/%5C/gi,"\\"):e;return/^file:\/\//i.test(t)||zU.test(t)||t.startsWith("\\\\")?dg(t)?t:"":J_(e)}function A6e(){const e=this.data();(e.fromMarkdownExtensions??=[]).push(TU)}function M6e(){return e=>{const t=a=>{a.children&&(a.children=a.children.map(o=>{if(o?.type==="link"&&o.children?.length===1&&o.children[0]?.type==="image"){const i=o.children[0];return{...i,data:{...i.data,hProperties:{...i.data?.hProperties,"data-open-url":o.url}}}}return t(o),o}))};t(e)}}const I6e=/[\u0590-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFF\u{10800}-\u{10FFF}\u{1E800}-\u{1EFFF}]/u;function P6e(e){const t=new RegExp("\\p{Letter}","u").exec(e);return t&&I6e.test(t[0])?"rtl":"ltr"}function LU(e){return e?e.type==="text"?e.value??"":e.tagName==="code"||e.tagName==="pre"?"":(e.children??[]).map(LU).join(""):""}function ts(e){return P6e(LU(e))}function T6e({code:e,lang:t,streaming:a}){const[o,i]=f.useState(null),[s,r]=f.useState(!1),[c,d]=f.useState(!1),p=f.useRef(null);f.useEffect(()=>()=>{p.current!==null&&clearTimeout(p.current)},[]),f.useEffect(()=>{const v=`${t}:${OU(e)}`,k=_m.get(v);if(k)return i(k);let S=!0,N;const C=()=>{d_(()=>import("./index-BgeuRd0K.js"),[]).then(j=>j.codeToHtml(e,{lang:t||"text",themes:{light:"github-light-default",dark:"github-dark-default"},defaultColor:"light-dark()"})).then(j=>{if(S){if(_m.size>=C6e){const M=_m.keys().next().value;M&&_m.delete(M)}_m.set(v,j),i(j)}}).catch(()=>{})};return a?(i(null),N=setTimeout(C,DU)):C(),()=>{S=!1,N!==void 0&&clearTimeout(N)}},[e,t,a]);const h=()=>{navigator.clipboard?.writeText&&navigator.clipboard.writeText(e).then(()=>{r(!0),p.current!==null&&clearTimeout(p.current),p.current=setTimeout(()=>r(!1),1500)}).catch(()=>{})},g=()=>{const v=$Ce(t);KCe(v,e)},b=UCe(t),x=VCe(e);return n.jsxs("div",{dir:"ltr",className:"my-2 overflow-hidden rounded-lg border border-hairline/40 bg-inset",children:[n.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-hairline/30 bg-raised/30 px-3 py-1.5 text-xs",children:[n.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[n.jsx("span",{title:b,className:"min-w-0 truncate rounded border border-hairline/40 bg-raised px-1.5 py-0.5 text-[11px] font-medium tracking-wide text-ink select-none",children:b}),x>0&&n.jsx("span",{className:"shrink-0 whitespace-nowrap text-[11px] text-ink-secondary select-none",children:HCe(x)})]}),n.jsxs("div",{className:"flex shrink-0 items-center gap-1 whitespace-nowrap",children:[n.jsxs("button",{type:"button",onClick:()=>d(v=>!v),className:`inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[11px] transition-colors ${c?"bg-accent/15 text-accent font-medium":"text-ink-secondary hover:bg-raised hover:text-ink"}`,title:c?"Disable line wrapping":"Wrap long lines","aria-label":c?"Disable line wrapping":"Wrap long lines","aria-pressed":c,children:[n.jsx(nE,{size:12,"aria-hidden":"true"}),n.jsx("span",{className:"hidden sm:inline",children:c?"Unwrap":"Wrap"})]}),n.jsxs("button",{type:"button",onClick:g,className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[11px] text-ink-secondary hover:bg-raised hover:text-ink transition-colors",title:"Download snippet as file","aria-label":"Download snippet as file",children:[n.jsx(pa,{size:12,"aria-hidden":"true"}),n.jsx("span",{className:"hidden sm:inline",children:"Save"})]}),n.jsx("button",{type:"button",onClick:h,className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[11px] text-ink-secondary hover:bg-raised hover:text-ink transition-colors",title:s?"Copied to clipboard":"Copy code","aria-label":s?"Code copied to clipboard":"Copy code to clipboard",children:s?n.jsxs(n.Fragment,{children:[n.jsx(gt,{size:12,className:"text-success","aria-hidden":"true"}),n.jsx("span",{className:"text-success font-medium hidden sm:inline",children:"Copied!"})]}):n.jsxs(n.Fragment,{children:[n.jsx(Ya,{size:12,"aria-hidden":"true"}),n.jsx("span",{className:"hidden sm:inline",children:"Copy"})]})})]})]}),o?n.jsx("div",{className:`text-[13px] leading-relaxed [&_pre]:!bg-transparent [&_pre]:m-0 [&_pre]:p-3 ${c?"whitespace-pre-wrap break-words overflow-x-hidden [&_pre]:!whitespace-pre-wrap [&_pre]:!break-words [&_code]:!whitespace-pre-wrap [&_code]:!break-words":"overflow-x-auto"}`,dangerouslySetInnerHTML:{__html:o}}):n.jsx("pre",{className:`p-3 text-[13px] leading-relaxed text-ink ${c?"whitespace-pre-wrap break-words overflow-x-hidden":"overflow-x-auto"}`,children:e})]})}function B6e(e){if(!e||typeof window>"u"||typeof window.getComputedStyle!="function")return"dark";try{return window.getComputedStyle(e).getPropertyValue("--code-color-scheme").trim()==="light"?"light":"dark"}catch{return"dark"}}const E6e='"Inter", -apple-system, BlinkMacSystemFont, "SF UI Text", "Segoe UI", system-ui, sans-serif';function R6e({code:e,streaming:t}){const a=f.useRef(null),[o,i]=f.useState(0),[s,r]=f.useState(null),[c,d]=f.useState(null),[p,h]=f.useState(!1),[g,b]=f.useState(!1),x=f.useRef(null);f.useEffect(()=>{if(typeof MutationObserver>"u"||typeof document>"u")return;const k=new MutationObserver(()=>i(S=>S+1));return k.observe(document.documentElement,{subtree:!0,attributeFilter:["data-skin"]}),()=>k.disconnect()},[]),f.useEffect(()=>{const k=B6e(a.current),S=`${k}:${OU(e)}`,N=qm.get(S);if(N){r(N),d(null);return}let C=!0,j;const M=()=>{d_(()=>import("./mermaid.core-BjvwttN3.js").then(D=>D.bz),[]).then(D=>(EP+=1,D.default.initialize({startOnLoad:!1,securityLevel:"strict",suppressErrorRendering:!0,theme:k==="light"?"default":"dark",fontFamily:E6e}),D.default.render(`omb-mermaid-${EP}`,e))).then(D=>{if(C){if(qm.size>=j6e){const A=qm.keys().next().value;A&&qm.delete(A)}qm.set(S,D.svg),r(D.svg),d(null)}}).catch(D=>{if(!C||t)return;const A=D instanceof Error?D.message:String(D);d(A.length>300?`${A.slice(0,300)}…`:A)})};return t?(r(null),d(null),j=setTimeout(M,DU)):M(),()=>{C=!1,j!==void 0&&clearTimeout(j)}},[e,t,o]),f.useEffect(()=>()=>{x.current!==null&&clearTimeout(x.current)},[]);const v=()=>{navigator.clipboard?.writeText&&navigator.clipboard.writeText(e).then(()=>{b(!0),x.current!==null&&clearTimeout(x.current),x.current=setTimeout(()=>b(!1),1500)}).catch(()=>{})};return n.jsxs("div",{ref:a,dir:"ltr",className:"my-2 overflow-hidden rounded-lg border border-hairline/40 bg-inset",children:[n.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-hairline/30 bg-raised/30 px-3 py-1.5 text-xs",children:[n.jsx("span",{title:"Mermaid diagram",className:"min-w-0 truncate rounded border border-hairline/40 bg-raised px-1.5 py-0.5 text-[11px] font-medium tracking-wide text-ink select-none",children:"Mermaid diagram"}),n.jsxs("div",{className:"flex shrink-0 items-center gap-1 whitespace-nowrap",children:[n.jsxs("button",{type:"button",onClick:()=>h(k=>!k),className:`inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[11px] transition-colors ${p?"bg-accent/15 text-accent font-medium":"text-ink-secondary hover:bg-raised hover:text-ink"}`,title:p?"Hide diagram source":"Show diagram source","aria-label":p?"Hide diagram source":"Show diagram source","aria-pressed":p,children:[n.jsx(nE,{size:12,"aria-hidden":"true"}),n.jsx("span",{className:"hidden sm:inline",children:p?"Hide source":"Show source"})]}),n.jsx("button",{type:"button",onClick:v,className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[11px] text-ink-secondary hover:bg-raised hover:text-ink transition-colors",title:g?"Copied to clipboard":"Copy diagram source","aria-label":g?"Diagram source copied to clipboard":"Copy diagram source to clipboard",children:g?n.jsxs(n.Fragment,{children:[n.jsx(gt,{size:12,className:"text-success","aria-hidden":"true"}),n.jsx("span",{className:"text-success font-medium hidden sm:inline",children:"Copied!"})]}):n.jsxs(n.Fragment,{children:[n.jsx(Ya,{size:12,"aria-hidden":"true"}),n.jsx("span",{className:"hidden sm:inline",children:"Copy"})]})})]})]}),c&&n.jsxs("p",{role:"alert",className:"px-3 pt-2 text-[12px] text-danger",children:["Diagram could not be rendered: ",c]}),s&&n.jsx("div",{className:"overflow-x-auto p-3 [&_svg]:!max-w-full",dangerouslySetInnerHTML:{__html:s}}),(p||!s||c)&&n.jsx("pre",{className:"overflow-x-auto p-3 text-[13px] leading-relaxed text-ink",children:e})]})}function D6e({filePath:e,children:t,message:a}){const o=Cz(e,void 0,a);if(!a)return n.jsx("span",{title:"Unavailable legacy file reference",className:"break-words text-ink-secondary",children:t});const i=o.state==="saving"?"Saving…":o.state==="saved"?"Saved":o.state==="failed"?"Retry":null;return n.jsxs("span",{dir:"ltr",className:"inline-flex flex-wrap items-center gap-x-1.5 [unicode-bidi:isolate]",children:[n.jsxs("button",{type:"button",onClick:()=>{o.save()},disabled:o.state==="saving",title:"Save a copy",className:"inline-flex items-center gap-1 break-words text-start text-accent underline decoration-accent/40 hover:decoration-accent disabled:cursor-wait",children:[t,o.state==="saving"?n.jsx(Ie,{size:12,className:"shrink-0 animate-spin","aria-hidden":"true"}):o.state==="saved"?n.jsx(gt,{size:12,className:"shrink-0 text-success","aria-hidden":"true"}):o.state==="failed"?n.jsx(Rs,{size:12,className:"shrink-0","aria-hidden":"true"}):n.jsx(pa,{size:12,className:"shrink-0","aria-hidden":"true"})]}),i&&n.jsx("span",{role:o.state==="failed"?"alert":"status",title:o.state==="saved"?o.savedTo:void 0,className:`text-[12px] ${o.state==="saved"?"text-success":o.state==="failed"?"text-danger":"text-ink-secondary"}`,children:o.state==="failed"?o.reason:i})]})}function O6e(e,t){const a=t?.trim();if(a)return a;try{const i=decodeURIComponent(new URL(e,"https://openmausbot.invalid").pathname).split(/[\\/]/).filter(Boolean).at(-1)?.trim();if(i)return i}catch{}return"Image"}function z6e(e){try{const t=new URL(e.startsWith("//")?`https:${e}`:e);return t.protocol==="https:"||t.protocol==="http:"?t.toString():void 0}catch{return}}function L6e({children:e}){const[t,a]=f.useState(!1);return t?n.jsxs("span",{className:"mx-px inline rounded px-1 py-px text-[13px] leading-relaxed text-ink underline decoration-dotted decoration-hairline underline-offset-2",children:[e,n.jsx("button",{type:"button","aria-label":"Hide spoiler",title:"Hide spoiler",onClick:()=>a(!1),className:"ms-1 rounded px-0.5 text-[11px] text-ink-secondary hover:text-ink",children:"Hide"})]}):n.jsxs("span",{className:"relative mx-px inline-block rounded px-1 py-px",children:[n.jsx("span",{"aria-hidden":"true",className:"pointer-events-none select-none bg-raised text-transparent [&_*]:!text-transparent [&_a]:!no-underline",children:e}),n.jsx("button",{type:"button","aria-label":"Reveal spoiler",title:"Reveal spoiler",onClick:()=>a(!0),className:"absolute inset-0 rounded bg-raised/90"})]})}const I5=[],F6e="![";function _6e(e,t){const a=/(^|\r?\n)((?: {0,3}>[ \t]?)* {0,3})(?:(`{3,})([^`\r\n]*)|(~{3,})([^\r\n]*))(?:\r?\n|$)/g;let o=0,i="",s;for(;(s=a.exec(e))!==null;){const r=s[3]??s[5],c=r[0],d=new RegExp(`(^|\\r?\\n)(?: {0,3}>[ \\t]?)* {0,3}${c}{${r.length},}[ \\t]*(?=\\r?\\n|$)`,"g");d.lastIndex=a.lastIndex;const p=d.exec(e),h=p===null?e.length:p.index+p[0].length;i+=e.slice(o,s.index),i+=t(e.slice(s.index,h)),o=h,a.lastIndex=h}return i+e.slice(o)}function q6e(e){const t=[],a=s=>{const r=`\0OMB_CODE_${t.length}\0`;return t.push(s),r};let i=_6e(e,a).replace(/(`+)[\s\S]*?\1/g,a).replace(/\\\[([\s\S]*?)\\\]/g,(s,r)=>`$$
547
+ `)}function ZCe(e){if(!e.includes("|"))return e;const t=[];let a=0;for(const o of IC(e).children){if(o.type!=="paragraph")continue;const i=o.position?.start.offset,s=o.position?.end.offset;if(i===void 0||s===void 0)continue;const r=e.slice(i,s);/[`\\]/.test(r)||(t.push(e.slice(a,i),YCe(r)),a=s)}return t.push(e.slice(a)),t.join("")}const PU=new WeakSet,QCe=/^[A-Za-z]:(?:[\\/]|$)/,XCe=new Set(["\\","(",")","<",">"]);function TP(){this.buffer(),PU.add(this.stack[this.stack.length-1])}function e6e(e){const t=this.stack.pop(),a=this.sliceSerialize(e),o=PU.has(this.stack[this.stack.length-1])&&QCe.test(t.value)&&!XCe.has(a);t.value+=o?`\\${a}`:a,t.position.end={line:e.end.line,column:e.end.column,offset:e.end.offset}}const TU={enter:{resourceDestinationString:TP,definitionDestinationString:TP},exit:{characterEscapeValue:e6e}},a6=Object.freeze([{id:"github",name:"GitHub",description:"Read code, issues and pull requests in your repositories.",category:"dev",url:"https://api.githubcopilot.com/mcp/",transport:"http"},{id:"notion",name:"Notion",description:"Search, read and write pages in your Notion workspace.",category:"productivity",url:"https://mcp.notion.com/mcp",transport:"http"},{id:"linear",name:"Linear",description:"Find, create and update Linear issues and projects.",category:"productivity",url:"https://mcp.linear.app/mcp",transport:"http"},{id:"atlassian",name:"Atlassian",description:"Work with Jira issues and Confluence pages.",category:"productivity",url:"https://mcp.atlassian.com/v2/mcp",transport:"http",aliases:["jira","confluence"]},{id:"asana",name:"Asana",description:"See and update tasks and projects in Asana.",category:"productivity",url:"https://mcp.asana.com/v2/mcp",transport:"http"},{id:"sentry",name:"Sentry",description:"Look into errors and issues from your Sentry projects.",category:"dev",url:"https://mcp.sentry.dev/mcp",transport:"http"},{id:"vercel",name:"Vercel",description:"Check deployments, logs and projects on Vercel.",category:"dev",url:"https://mcp.vercel.com",transport:"http"},{id:"supabase",name:"Supabase",description:"Manage Supabase projects, tables and edge functions.",category:"data",url:"https://mcp.supabase.com/mcp",transport:"http"},{id:"cloudflare",name:"Cloudflare Docs",description:"Search Cloudflare's developer documentation. No sign-in.",category:"dev",url:"https://docs.mcp.cloudflare.com/mcp",transport:"http"},{id:"huggingface",name:"Hugging Face",description:"Search models, datasets, Spaces and papers.",category:"data",url:"https://huggingface.co/mcp",transport:"http"},{id:"canva",name:"Canva",description:"Find, create and export Canva designs.",category:"design",url:"https://mcp.canva.com/mcp",transport:"http"},{id:"webflow",name:"Webflow",description:"Edit Webflow sites, pages and CMS content.",category:"design",url:"https://mcp.webflow.com/mcp",transport:"http"},{id:"hubspot",name:"HubSpot",description:"Look up contacts, companies and deals in HubSpot.",category:"data",url:"https://mcp.hubspot.com/",transport:"http"},{id:"stripe",name:"Stripe",description:"Look up customers, payments and invoices in Stripe.",category:"payments",url:"https://mcp.stripe.com",transport:"http"},{id:"paypal",name:"PayPal",description:"Work with PayPal invoices, orders and transactions.",category:"payments",url:"https://mcp.paypal.com/mcp",transport:"http"},{id:"dropbox",name:"Dropbox",description:"Search, organize and share files in your Dropbox.",category:"productivity",url:"https://mcp.dropbox.com/mcp",transport:"http"},{id:"granola",name:"Granola",description:"Search your Granola meeting notes and transcripts.",category:"productivity",url:"https://mcp.granola.ai/mcp",transport:"http",aliases:["granola ai"]},{id:"square",name:"Square",description:"See Square payments, orders, catalog and customers.",category:"payments",url:"https://mcp.squareup.com/sse",transport:"sse"},{id:"pax8",name:"Pax8",description:"Look up Pax8 products, subscriptions and client companies.",category:"msp",url:"https://mcp.pax8.com/v1/mcp",transport:"http",aliases:["pax 8"]},{id:"huntress",name:"Huntress",description:"Review Huntress agents, incidents, signals and reports.",category:"security",url:"https://api.huntress.io/v1/mcp",transport:"http"},{id:"jumpcloud",name:"JumpCloud",description:"Look up JumpCloud users, devices and groups as an administrator.",category:"security",url:"https://mcp.jumpcloud.com/v1",transport:"http",aliases:["jump cloud"]},{id:"vanta",name:"Vanta",description:"Check compliance tests, controls and vendor risk in Vanta.",category:"security",url:"https://mcp.vanta.com/mcp",transport:"http"},{id:"semgrep",name:"Semgrep",description:"Scan code for security issues with Semgrep.",category:"security",url:"https://mcp.semgrep.ai/mcp",transport:"http"},{id:"socket",name:"Socket",description:"Check open source packages for supply chain risk. No sign-in.",category:"security",url:"https://mcp.socket.dev/",transport:"http",aliases:["socket.dev"]},{id:"zapier",name:"Zapier",description:"Run actions in the apps you have connected to your Zapier account.",category:"productivity",url:"https://mcp.zapier.com/api/v1/connect",transport:"http",aliases:["zaps"]},{id:"monday",name:"monday.com",description:"See and update boards, items and updates in monday.com.",category:"productivity",url:"https://mcp.monday.com/mcp",transport:"http",aliases:["monday"]},{id:"clickup",name:"ClickUp",description:"Find, create and update ClickUp tasks and docs.",category:"productivity",url:"https://mcp.clickup.com/mcp",transport:"http",aliases:["click up"]},{id:"calendly",name:"Calendly",description:"See Calendly event types, bookings and availability.",category:"productivity",url:"https://mcp.calendly.com",transport:"http"},{id:"fireflies",name:"Fireflies",description:"Search Fireflies meeting transcripts and summaries.",category:"productivity",url:"https://api.fireflies.ai/mcp",transport:"http",aliases:["fireflies.ai"]},{id:"otter",name:"Otter",description:"Search Otter meeting notes and transcripts.",category:"productivity",url:"https://mcp.otter.ai/mcp",transport:"http",aliases:["otter.ai","otter ai"]},{id:"todoist",name:"Todoist",description:"Add, find and complete tasks in Todoist.",category:"productivity",url:"https://ai.todoist.net/mcp",transport:"http"},{id:"jotform",name:"Jotform",description:"Build Jotform forms and read their submissions.",category:"productivity",url:"https://mcp.jotform.com/",transport:"http"},{id:"egnyte",name:"Egnyte",description:"Search and read files stored in Egnyte.",category:"productivity",url:"https://mcp-server.egnyte.com/mcp",transport:"http"},{id:"intercom",name:"Intercom",description:"Search Intercom conversations, contacts and tickets.",category:"crm",url:"https://mcp.intercom.com/mcp",transport:"http"},{id:"pipedrive",name:"Pipedrive",description:"Work with deals, contacts and activities in Pipedrive.",category:"crm",url:"https://mcp.pipedrive.ai/mcp",transport:"http"},{id:"apollo",name:"Apollo.io",description:"Find and enrich people and companies in Apollo.",category:"crm",url:"https://mcp.apollo.io/mcp",transport:"http",aliases:["apollo"]},{id:"attio",name:"Attio",description:"Look up and update records and lists in Attio.",category:"crm",url:"https://mcp.attio.com/mcp",transport:"http"},{id:"close",name:"Close",description:"Work with leads, contacts and opportunities in Close.",category:"crm",url:"https://mcp.close.com/mcp",transport:"http",aliases:["close crm","close.com"]},{id:"zoominfo",name:"ZoomInfo",description:"Search ZoomInfo company and contact data.",category:"crm",url:"https://mcp.zoominfo.com/mcp",transport:"http",aliases:["zoom info"]},{id:"gong",name:"Gong",description:"Search Gong calls, deals and conversation insights.",category:"crm",url:"https://mcp.gong.io/mcp",transport:"http"},{id:"klaviyo",name:"Klaviyo",description:"See Klaviyo campaigns, flows, lists and results.",category:"crm",url:"https://mcp.klaviyo.com/mcp",transport:"http"},{id:"ramp",name:"Ramp",description:"Look up Ramp card transactions, bills and spend.",category:"finance",url:"https://mcp.ramp.com/mcp",transport:"http"},{id:"mercury",name:"Mercury",description:"See Mercury bank accounts, balances and transactions.",category:"finance",url:"https://mcp.mercury.com/mcp",transport:"http"},{id:"brex",name:"Brex",description:"See Brex expenses, cards and spend.",category:"finance",url:"https://api.brex.com/mcp",transport:"http"},{id:"expensify",name:"Expensify",description:"Work with Expensify expense reports and expenses.",category:"finance",url:"https://mcp.expensify.com/mcp/",transport:"http"},{id:"paddle",name:"Paddle",description:"Look up Paddle products, subscriptions and transactions.",category:"payments",url:"https://mcp.paddle.com/mcp",transport:"http"},{id:"miro",name:"Miro",description:"Read and create boards, diagrams and sticky notes in Miro.",category:"design",url:"https://mcp.miro.com/",transport:"http"},{id:"gamma",name:"Gamma",description:"Create presentations, documents and web pages with Gamma.",category:"design",url:"https://mcp.gamma.app/mcp",transport:"http"},{id:"wix",name:"Wix",description:"Manage Wix sites, content and business apps.",category:"design",url:"https://mcp.wix.com/mcp",transport:"http"},{id:"heygen",name:"HeyGen",description:"Create AI avatar videos with HeyGen.",category:"design",url:"https://mcp.heygen.com/mcp/v1/",transport:"http",aliases:["hey gen"]},{id:"squarespace",name:"Squarespace Domains",description:"Check which domain names are free to register. No sign-in.",category:"design",url:"https://mcp.squarespace.com/mcp",transport:"http",aliases:["squarespace"]},{id:"airtable",name:"Airtable",description:"Read and update records in your Airtable bases.",category:"data",url:"https://mcp.airtable.com/mcp",transport:"http"},{id:"posthog",name:"PostHog",description:"Query product analytics, feature flags and errors in PostHog.",category:"data",url:"https://mcp.posthog.com/mcp",transport:"http",aliases:["post hog"]},{id:"perplexity",name:"Perplexity",description:"Search the web with Perplexity and get cited answers.",category:"data",url:"https://api.perplexity.ai/mcp",transport:"http"},{id:"exa",name:"Exa",description:"Search the web and read pages with Exa. No sign-in.",category:"data",url:"https://mcp.exa.ai/mcp",transport:"http",aliases:["exa search","exa ai"]},{id:"tavily",name:"Tavily",description:"Search the web and pull content from pages with Tavily.",category:"data",url:"https://mcp.tavily.com/mcp/",transport:"http"},{id:"microsoft-learn",name:"Microsoft Learn",description:"Search Microsoft's official docs and code samples. No sign-in.",category:"dev",url:"https://learn.microsoft.com/api/mcp",transport:"http",aliases:["microsoft docs","azure docs","intune docs","ms learn"]},{id:"cloudflare-api",name:"Cloudflare",description:"Manage Cloudflare accounts, DNS, Workers and more.",category:"dev",url:"https://mcp.cloudflare.com/mcp",transport:"http",aliases:["cloudflare api"]},{id:"gitlab",name:"GitLab",description:"Work with GitLab issues, merge requests and pipelines.",category:"dev",url:"https://gitlab.com/api/v4/mcp",transport:"http",aliases:["git lab"]},{id:"netlify",name:"Netlify",description:"Deploy and manage Netlify sites and projects.",category:"dev",url:"https://netlify-mcp.netlify.app/mcp",transport:"http"},{id:"railway",name:"Railway",description:"Check Railway projects, deployments and logs.",category:"dev",url:"https://mcp.railway.com",transport:"http"},{id:"neon",name:"Neon",description:"Manage Neon Postgres projects, branches and queries.",category:"dev",url:"https://mcp.neon.tech/mcp",transport:"http",aliases:["neon postgres"]},{id:"prisma",name:"Prisma",description:"Manage Prisma Postgres databases.",category:"dev",url:"https://mcp.prisma.io/mcp",transport:"http"},{id:"postman",name:"Postman",description:"Work with Postman collections, APIs and workspaces.",category:"dev",url:"https://mcp.postman.com/mcp",transport:"http"},{id:"datadog",name:"Datadog",description:"Search Datadog logs, metrics, monitors and incidents.",category:"dev",url:"https://mcp.datadoghq.com/api/unstable/mcp-server/mcp",transport:"http"},{id:"grafana",name:"Grafana Cloud",description:"Query dashboards, metrics and logs in Grafana Cloud.",category:"dev",url:"https://mcp.grafana.com/mcp",transport:"http",aliases:["grafana"]},{id:"honeycomb",name:"Honeycomb",description:"Query traces and events in Honeycomb.",category:"dev",url:"https://mcp.honeycomb.io/mcp",transport:"http"},{id:"buildkite",name:"Buildkite",description:"Check Buildkite pipelines, builds and jobs.",category:"dev",url:"https://mcp.buildkite.com/mcp",transport:"http"},{id:"sanity",name:"Sanity",description:"Query and edit content in Sanity.",category:"dev",url:"https://mcp.sanity.io",transport:"http"},{id:"resend",name:"Resend",description:"Send email and manage domains and audiences in Resend.",category:"dev",url:"https://mcp.resend.com/mcp",transport:"http"},{id:"stytch",name:"Stytch",description:"Manage Stytch projects and sign-in settings.",category:"dev",url:"https://mcp.stytch.dev/mcp",transport:"http"}]);function t6e(e){return a6.find(t=>t.id===e)}function o6(e){return`/mcp-icons/${e}.svg`}function BP(e){return e.toLowerCase().replace(/[^\p{L}\p{N}.]+/gu," ").replace(/\s+/g," ").trim()}function i6(e,t){const a=BP(e);if(a.length<2)return!1;const o=` ${a} `;return t.some(i=>{const s=BP(i);return s?s===a||o.includes(` ${s} `)?!0:a.length>=3&&` ${s} `.includes(o):!1})}function n6e(e){return a6.filter(t=>i6(e,[t.id,t.name,...t.aliases??[]]))}function a6e(e){return JO.filter(t=>i6(e,[t.id,t.name,...t.aliases]))}const o6e=Object.freeze([{name:"QuickBooks",claude:"quickbooks"},{name:"Granola",featured:"granola"},{name:"Gmail",claude:"gmail"},{name:"Google Calendar",claude:"google-calendar"},{name:"Google Drive",claude:"google-drive"},{name:"Microsoft 365",claude:"microsoft-365"},{name:"Slack",claude:"slack"},{name:"Zoom",claude:"zoom"},{name:"Docusign",claude:"docusign"},{name:"HubSpot",featured:"hubspot"},{name:"Stripe",featured:"stripe"},{name:"Canva",featured:"canva"},{name:"Notion",featured:"notion"},{name:"Asana",featured:"asana"}]);function i6e(e){const t=e.featured?t6e(e.featured):void 0;if(t)return{kind:"direct",server:t};const a=e.claude?Fue(e.claude):void 0;return a?{kind:"claude",connector:a}:{kind:"none"}}function s6e(e=X){const[t,a]=f.useState(null);return f.useEffect(()=>{let o=!0;return e("/api/marketplace/claude-connectors").then(i=>o&&a(i)).catch(()=>o&&a("error")),()=>{o=!1}},[e]),t}function r6e(e,t){return!t||t==="error"?[]:t.engines.filter(a=>a.connectors.some(o=>o.state==="connected"&&i6(o.name.replace(/^claude\.ai\s+/i,""),[e.name,...e.aliases])))}function BU({connector:e,data:t}){return r6e(e,t).length?n.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-success/10 px-2 py-0.5 text-[10.5px] font-medium text-success","data-testid":"connected-via-claude",children:[n.jsx(gt,{size:11})," ",l("mcpMarket.claude.connected")]}):null}function s6({label:e}){return n.jsxs("button",{type:"button",onClick:()=>{Pl(WO)},className:"inline-flex items-center gap-1.5 rounded-full bg-raised px-3 py-1.5 text-[12.5px] font-medium text-ink hover:bg-raised-hover",children:[n.jsx(An,{size:13})," ",e??l("mcpMarket.claude.open")]})}function l6e({name:e}){return n.jsxs("button",{type:"button",onClick:()=>Dg("idea",l("feedback.connectionIdea",{name:e})),"aria-label":l("mcpMarket.suggestAria",{name:e}),className:"inline-flex items-center gap-1.5 rounded-full bg-raised px-3 py-1.5 text-[12.5px] font-medium text-ink hover:bg-raised-hover",children:[n.jsx(u4,{size:13})," ",l("mcpMarket.suggest")]})}function c6e({connector:e,data:t,highlight:a=!1}){return n.jsxs("div",{className:V("flex flex-col rounded-2xl border bg-card/80 p-4",a?"border-accent/60":"border-hairline/50"),"data-testid":"claude-connector","data-connector":e.id,children:[n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx(cg,{name:e.name}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"truncate text-[14px] font-semibold text-ink",children:e.name}),n.jsxs("div",{className:"mt-1 flex flex-wrap gap-1.5",children:[n.jsx("span",{className:"inline-block rounded-full bg-raised px-2 py-0.5 text-[10.5px] font-medium text-ink-secondary",children:l("mcpMarket.path.claude")}),n.jsx(BU,{connector:e,data:t})]})]})]}),n.jsx("p",{className:"mt-2.5 flex-1 text-[12.5px] leading-snug text-ink-secondary",children:e.description}),n.jsx("div",{className:"mt-3",children:n.jsx(s6,{})})]})}function d6e({query:e,data:t,renderFeatured:a}){const o=e.trim();if(!o)return null;const i=n6e(o),s=i.length?[]:a6e(o);return n.jsxs("section",{"aria-labelledby":"mcp-best-title",className:"mb-9","data-testid":"marketplace-best-match",children:[n.jsx("h3",{id:"mcp-best-title",className:"text-[15px] font-semibold text-ink",children:l("mcpMarket.best.title",{query:o})}),i.length||s.length?n.jsxs("div",{className:"mt-4 grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3",children:[i.map(r=>n.jsx("div",{className:"contents",children:a(r)},r.id)),s.map(r=>n.jsx(c6e,{connector:r,data:t,highlight:!0},r.id))]}):n.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-3 rounded-2xl border border-hairline/50 bg-raised/35 px-4 py-3",children:[n.jsx("p",{className:"min-w-0 flex-1 text-[12.5px] text-ink-secondary",children:l("mcpMarket.best.none",{query:o})}),n.jsx(l6e,{name:o})]})]})}function u6e({data:e,renderAdd:t}){return n.jsxs("section",{"aria-labelledby":"mcp-recommended-title",className:"mb-9","data-testid":"marketplace-recommended",children:[n.jsx("h3",{id:"mcp-recommended-title",className:"text-[15px] font-semibold text-ink",children:l("mcpMarket.recommended.title")}),n.jsx("p",{className:"mt-1 max-w-[640px] text-[12.5px] leading-relaxed text-ink-secondary",children:l("mcpMarket.recommended.subtitle")}),n.jsx("ul",{className:"mt-4 grid grid-cols-1 gap-2 md:grid-cols-2",children:o6e.map(a=>{const o=i6e(a);return o.kind==="none"?null:n.jsxs("li",{className:"flex items-center gap-3 rounded-xl border border-hairline/40 bg-card/70 px-3 py-2.5","data-path":o.kind,children:[n.jsx(cg,{src:o.kind==="direct"?o6(o.server.id):void 0,name:a.name,className:"size-8"}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"truncate text-[13.5px] font-medium text-ink",children:a.name}),n.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-1.5 text-[11px] text-ink-secondary",children:[l(o.kind==="direct"?"mcpMarket.path.direct":"mcpMarket.path.claude"),o.kind==="claude"&&n.jsx(BU,{connector:o.connector,data:e})]})]}),n.jsx("div",{className:"shrink-0",children:o.kind==="direct"?t(o.server):n.jsx(s6,{label:l("mcpMarket.claude.turnOn")})})]},a.name)})})]})}const p6e=e=>e==="personal"?"mcpMarket.claude.owner.personal":"mcpMarket.claude.owner.company";function m6e({data:e,claudeSwitch:t}){return n.jsxs("section",{"aria-labelledby":"mcp-claude-title",className:"mt-9","data-testid":"marketplace-claude",children:[n.jsx("h3",{id:"mcp-claude-title",className:"text-[15px] font-semibold text-ink",children:l("mcpMarket.claude.title")}),n.jsx("p",{className:"mt-1 max-w-[640px] text-[12.5px] leading-relaxed text-ink-secondary",children:l("mcpMarket.claude.subtitle")}),n.jsx("div",{className:"mt-3",children:n.jsx(s6,{})}),t,n.jsx("div",{className:"mt-4","aria-live":"polite",children:e===null?n.jsxs("div",{className:"flex items-center gap-2 text-[12.5px] text-ink-secondary",children:[n.jsx(Ie,{size:13,className:"animate-spin"})," ",l("mcpMarket.claude.loading")]}):e==="error"?null:e.engines.length===0?n.jsx("p",{className:"text-[12.5px] text-ink-secondary",children:l("mcpMarket.claude.noEngine")}):n.jsx("div",{className:"flex flex-col gap-3",children:e.engines.map(a=>{const o=l("mcpMarket.claude.engine",{engine:a.displayName,owner:l(p6e(a.owner))}),i=a.connectors.filter(s=>s.state==="connected");return n.jsxs("div",{className:"rounded-xl border border-hairline/40 bg-card/70 px-3 py-2.5","data-testid":"claude-engine",children:[n.jsx("div",{className:"text-[13px] font-medium text-ink",children:o}),n.jsx("p",{className:"mt-1 text-[12px] text-ink-secondary",children:a.state==="api-key"?l("mcpMarket.claude.apiKey",{engine:a.displayName}):a.state==="signed-out"?l("mcpMarket.claude.signedOut",{engine:a.displayName}):a.state==="error"?l("mcpMarket.claude.error",{engine:a.displayName}):i.length===0?l("mcpMarket.claude.none"):i.map(s=>s.name.replace(/^claude\.ai\s+/i,"")).join(", ")})]},a.instanceId)})})})]})}async function h6e(e,t=X,a=!1){try{const o=await t("/api/mcp/registry/add",{method:"POST",body:JSON.stringify({id:e,...a?{overrideThreatScan:!0}:{}})});return o.threatScan&&o.threatScan.verdict!=="clean"?{kind:"added",name:o.added,threatScan:o.threatScan}:{kind:"added",name:o.added}}catch(o){const i=N0(o),s=o instanceof Error?o.message:String(o);return i?{kind:"blocked",error:s,threatScan:i}:{kind:"error",error:s}}}function g6e(e,t){const a=s=>s.replace(/\/+$/,"").toLowerCase(),o=new Set(t.urls.map(a));return e.find(s=>s.url&&o.has(a(s.url))?!0:(s.args??[]).some(r=>o.has(a(r))||t.packages.some(c=>r===c||r.startsWith(`${c}@`)||r.startsWith(`${c}==`))))?.name}function f6e(e){let t=0;for(const a of e)t=t*31+a.charCodeAt(0)|0;return`hsl(${Math.abs(t)%360} 55% 45%)`}function cg({src:e,name:t,className:a="size-11"}){const[o,i]=f.useState(!1);return e&&!o?n.jsx("img",{src:e,alt:"",loading:"lazy",className:V("shrink-0 rounded-xl object-contain",a),onError:()=>i(!0)}):n.jsx("div",{"aria-hidden":"true",className:V("flex shrink-0 items-center justify-center rounded-xl text-[16px] font-semibold text-white",a),style:{backgroundColor:f6e(t)},children:(t.trim()[0]??"?").toUpperCase()})}function b6e({state:e,onAddAnyway:t}){return n.jsxs(n.Fragment,{children:[n.jsx("p",{role:"alert",className:"mt-2 text-[11.5px] text-danger",children:e.error}),e.threatScan&&n.jsx(Tl,{result:e.threatScan}),e.threatScan&&t&&n.jsx("button",{type:"button",onClick:t,className:"mt-2 rounded-lg bg-danger px-3 py-1.5 text-[12px] font-semibold text-white",children:l("threatScan.addAnyway")})]})}function y6e({onOpenMcp:e}){return n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.jsxs("span",{role:"status",className:"flex items-center gap-1 text-[12px] font-medium text-success",children:[n.jsx(gt,{size:13})," ",l("mcpMarket.added")]}),n.jsx("button",{type:"button",onClick:e,className:"rounded-full bg-accent px-3 py-1.5 text-[12px] font-medium text-accent-ink hover:opacity-90",children:l("mcpMarket.openMcp")})]})}function EU({name:e,busy:t,onClick:a,large:o=!1}){return n.jsx("button",{type:"button",disabled:t,onClick:a,"aria-label":l("mcpMarket.addAria",{name:e}),className:V("flex items-center justify-center gap-1.5 rounded-full bg-accent font-medium text-accent-ink transition-opacity hover:opacity-90 disabled:opacity-50",o?"min-w-[92px] px-4 py-2 text-[13px]":"min-w-[76px] px-3 py-1.5 text-[12.5px]"),children:t?n.jsx(Ie,{size:14,className:"animate-spin"}):n.jsxs(n.Fragment,{children:[n.jsx(vn,{size:14}),l("mcpMarket.add")]})})}function x6e({server:e,state:t,onAdd:a,onOpenMcp:o,onAddAnyway:i}){return n.jsxs("div",{className:"flex flex-col rounded-2xl border border-hairline/50 bg-card/80 p-4 shadow-sm shadow-black/5 backdrop-blur-sm transition-colors hover:border-hairline",children:[n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx(cg,{src:o6(e.id),name:e.name}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"truncate text-[14px] font-semibold text-ink",children:e.name}),n.jsx("span",{className:"mt-1 inline-block rounded-full bg-raised px-2 py-0.5 text-[10.5px] font-medium text-ink-secondary",children:l(`mcpMarket.category.${e.category}`)})]})]}),n.jsx("p",{className:"mt-2.5 min-h-[34px] flex-1 text-[12.5px] leading-snug text-ink-secondary",children:e.description}),n.jsxs("div",{className:"mt-3",children:[t.phase==="added"?n.jsx(y6e,{onOpenMcp:o}):n.jsx(EU,{name:e.name,busy:t.phase==="adding",onClick:a,large:!0}),t.phase==="error"&&n.jsx(b6e,{state:t,onAddAnyway:i}),t.phase==="added"&&t.threatScan&&n.jsx(Tl,{result:t.threatScan,compact:!0})]})]})}function v6e({query:e,onQueryChange:t,onOpenMcp:a,request:o=X,claudeSwitch:i}){const[s,r]=f.useState({}),[c,d]=f.useState([]),p=s6e(o),h=f.useCallback((S,N)=>r(C=>({...C,[S]:N})),[]);f.useEffect(()=>{let S=!0;return o("/api/mcp/servers").then(N=>S&&d(N.servers??[])).catch(()=>{}),()=>{S=!1}},[o]);const g=f.useRef(new Set),b=async(S,N=!1)=>{const C=`featured:${S.id}`;h(C,{phase:"adding"});const j=await h6e(C,o,N);j.kind==="added"?(g.current.delete(C),h(C,j.threatScan?{phase:"added",name:j.name,threatScan:j.threatScan}:{phase:"added",name:j.name}),d(M=>[...M,{name:j.name}])):j.kind==="blocked"?(g.current.add(C),h(C,{phase:"error",error:j.error,threatScan:j.threatScan})):h(C,{phase:"error",error:j.error||S.name})},x=S=>{const N=s[`featured:${S.id}`];if(N&&N.phase!=="idle")return N;const C=g6e(c,{urls:[S.url],packages:[]});return C?{phase:"added",name:C}:{phase:"idle"}},v=S=>n.jsx(x6e,{server:S,state:x(S),onAdd:()=>{b(S)},onOpenMcp:a,onAddAnyway:()=>g.current.has(`featured:${S.id}`)&&void b(S,!0)},S.id),k=S=>{const N=x(S);return N.phase==="added"?n.jsxs("span",{className:"inline-flex items-center gap-1 text-[12px] font-medium text-success",children:[n.jsx(gt,{size:13}),l("mcpMarket.addedShort")]}):n.jsx(EU,{name:S.name,busy:N.phase==="adding",onClick:()=>{b(S)}})};return n.jsxs("div",{children:[n.jsxs("label",{className:"mb-6 flex h-11 w-full items-center gap-2.5 rounded-xl border border-hairline/50 bg-raised/70 px-3.5 sm:max-w-[480px]",children:[n.jsx(za,{size:17,className:"shrink-0 text-ink-secondary"}),n.jsx("input",{type:"search",value:e,onChange:S=>t(S.target.value),placeholder:l("mcpMarket.search.officialPlaceholder"),"aria-label":l("mcpMarket.search.officialPlaceholder"),className:"min-w-0 flex-1 bg-transparent text-[14px] text-ink placeholder:text-ink-secondary focus:outline-none"})]}),n.jsx(d6e,{query:e,data:p,renderFeatured:v}),n.jsx(u6e,{data:p,renderAdd:k}),n.jsxs("section",{"aria-labelledby":"mcp-featured-title",children:[n.jsx("h3",{id:"mcp-featured-title",className:"text-[15px] font-semibold text-ink",children:l("mcpMarket.featured.title")}),n.jsx("p",{className:"mt-1 max-w-[640px] text-[12.5px] leading-relaxed text-ink-secondary",children:l("mcpMarket.featured.subtitle")}),n.jsx("div",{className:"mt-4 grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3",children:a6.map(v)})]}),n.jsx(m6e,{data:p,claudeSwitch:i}),n.jsxs("p",{className:"mt-8 max-w-[640px] text-[12px] leading-relaxed text-ink-secondary","data-testid":"marketplace-official-note",children:[l("mcpMarket.officialOnly")," ",n.jsx("button",{type:"button",className:"font-medium text-accent underline-offset-2 hover:underline",onClick:a,children:l("mcpMarket.officialOnlyLink")})]})]})}function RU({message:e}){const{dispatch:t}=ve(),a=e.marketplace;if(!a)return null;const o=()=>t({type:"openMarketplace",query:a.query,...a.serverId?{serverId:a.serverId}:{}}),i=a.source==="featured"&&a.serverId?.startsWith("featured:")?a.serverId.slice(9):void 0;return a.source==="none"?n.jsx("div",{className:"w-[min(30rem,100%)] rounded-2xl border border-hairline/50 bg-card px-4 py-3.5","data-testid":"marketplace-card","data-source":"none",children:n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-xl bg-raised text-ink-secondary",children:n.jsx(u4,{size:17})}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"text-[14px] font-medium text-ink",children:l("chat.marketplace.none",{name:a.name})}),n.jsx("p",{className:"mt-0.5 text-[12.5px] leading-relaxed text-ink-secondary",children:l("chat.marketplace.noneHint")}),n.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[n.jsx("button",{type:"button",className:"rounded-lg bg-accent px-3 py-1.5 text-[12.5px] font-medium text-white hover:opacity-90",onClick:()=>Dg("idea",l("feedback.connectionIdea",{name:a.name})),children:l("chat.marketplace.suggest")}),n.jsx("button",{type:"button",className:"ui-button",onClick:o,children:l("chat.marketplace.open")})]})]})]})}):n.jsx("div",{className:"w-[min(30rem,100%)] rounded-2xl border border-hairline/50 bg-card px-4 py-3.5","data-testid":"marketplace-card","data-source":a.source,children:n.jsxs("div",{className:"flex items-start gap-3",children:[i?n.jsx(cg,{src:o6(i),name:a.name,className:"size-9"}):n.jsx(cg,{name:a.name,className:"size-9"}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"text-[14px] font-medium text-ink",children:a.name}),n.jsx("p",{className:"mt-0.5 text-[12.5px] leading-relaxed text-ink-secondary",children:a.source==="claude"?l("chat.marketplace.claudeHint"):l("chat.marketplace.directHint")}),n.jsx("button",{type:"button",className:"mt-3 rounded-lg bg-accent px-3 py-1.5 text-[12.5px] font-medium text-white hover:opacity-90",onClick:o,children:a.source==="claude"?l("chat.marketplace.connectClaude",{name:a.name}):l("chat.marketplace.connect",{name:a.name})})]})]})})}function k6e({query:e,serverId:t,children:a}){const{dispatch:o}=ve();return n.jsxs("button",{type:"button",onClick:()=>o({type:"openMarketplace",query:e,...t?{serverId:t}:{}}),className:"inline-flex items-center gap-1 rounded-md bg-accent/10 px-1.5 py-0.5 align-baseline text-[13.5px] font-medium text-accent hover:bg-accent/15","data-testid":"marketplace-link",children:[n.jsx(s0,{size:13,"aria-hidden":"true"}),a??l("chat.marketplace.open")]})}const w6e="chibi://marketplace";function r6(e){return e.trim().toLowerCase().startsWith(w6e)}function S6e(e){if(!r6(e))return null;let t;try{t=new URL(e.trim())}catch{return null}if(t.hostname.toLowerCase()!=="marketplace"||t.pathname&&t.pathname!=="/")return null;const a=(t.searchParams.get("q")??"").replace(/\s+/g," ").trim().slice(0,80),o=(t.searchParams.get("server")??"").trim().slice(0,300);return{query:a,...o?{serverId:o}:{}}}const _m=new Map,C6e=200,qm=new Map,j6e=50;let EP=0;const DU=250,OU=e=>{let t=2166136261;for(let a=0;a<e.length;a++)t^=e.charCodeAt(a),t=Math.imul(t,16777619);return(t>>>0).toString(36)},zU=/^[a-zA-Z]:[\\/]/,RP=e=>e.startsWith("/")||zU.test(e)?e:null,dg=e=>{if(!e)return null;if(/^file:\/\//i.test(e))try{const a=new URL(e);if(a.username||a.password||a.port||a.search||a.hash)return null;const o=decodeURIComponent(a.pathname);return a.hostname&&a.hostname!=="localhost"?`//${a.hostname}${o}`:/^\/[a-z]:[\\/]/i.test(o)?o.slice(1):RP(o)}catch{return null}if(e.startsWith("\\\\"))return e;if(e.startsWith("//"))return null;const t=RP(e);return t||(e.startsWith("#")||/^[a-z][a-z\d+.-]*:/i.test(e)?null:e)};function N6e(e){if(eL(e)||r6(e))return e;const t=/^[a-zA-Z]:%5C/i.test(e)?e.replace(/%5C/gi,"\\"):e;return/^file:\/\//i.test(t)||zU.test(t)||t.startsWith("\\\\")?dg(t)?t:"":J_(e)}function A6e(){const e=this.data();(e.fromMarkdownExtensions??=[]).push(TU)}function M6e(){return e=>{const t=a=>{a.children&&(a.children=a.children.map(o=>{if(o?.type==="link"&&o.children?.length===1&&o.children[0]?.type==="image"){const i=o.children[0];return{...i,data:{...i.data,hProperties:{...i.data?.hProperties,"data-open-url":o.url}}}}return t(o),o}))};t(e)}}const I6e=/[\u0590-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFF\u{10800}-\u{10FFF}\u{1E800}-\u{1EFFF}]/u;function P6e(e){const t=new RegExp("\\p{Letter}","u").exec(e);return t&&I6e.test(t[0])?"rtl":"ltr"}function LU(e){return e?e.type==="text"?e.value??"":e.tagName==="code"||e.tagName==="pre"?"":(e.children??[]).map(LU).join(""):""}function ts(e){return P6e(LU(e))}function T6e({code:e,lang:t,streaming:a}){const[o,i]=f.useState(null),[s,r]=f.useState(!1),[c,d]=f.useState(!1),p=f.useRef(null);f.useEffect(()=>()=>{p.current!==null&&clearTimeout(p.current)},[]),f.useEffect(()=>{const v=`${t}:${OU(e)}`,k=_m.get(v);if(k)return i(k);let S=!0,N;const C=()=>{d_(()=>import("./index-fnHp_1ly.js"),[]).then(j=>j.codeToHtml(e,{lang:t||"text",themes:{light:"github-light-default",dark:"github-dark-default"},defaultColor:"light-dark()"})).then(j=>{if(S){if(_m.size>=C6e){const M=_m.keys().next().value;M&&_m.delete(M)}_m.set(v,j),i(j)}}).catch(()=>{})};return a?(i(null),N=setTimeout(C,DU)):C(),()=>{S=!1,N!==void 0&&clearTimeout(N)}},[e,t,a]);const h=()=>{navigator.clipboard?.writeText&&navigator.clipboard.writeText(e).then(()=>{r(!0),p.current!==null&&clearTimeout(p.current),p.current=setTimeout(()=>r(!1),1500)}).catch(()=>{})},g=()=>{const v=$Ce(t);KCe(v,e)},b=UCe(t),x=VCe(e);return n.jsxs("div",{dir:"ltr",className:"my-2 overflow-hidden rounded-lg border border-hairline/40 bg-inset",children:[n.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-hairline/30 bg-raised/30 px-3 py-1.5 text-xs",children:[n.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[n.jsx("span",{title:b,className:"min-w-0 truncate rounded border border-hairline/40 bg-raised px-1.5 py-0.5 text-[11px] font-medium tracking-wide text-ink select-none",children:b}),x>0&&n.jsx("span",{className:"shrink-0 whitespace-nowrap text-[11px] text-ink-secondary select-none",children:HCe(x)})]}),n.jsxs("div",{className:"flex shrink-0 items-center gap-1 whitespace-nowrap",children:[n.jsxs("button",{type:"button",onClick:()=>d(v=>!v),className:`inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[11px] transition-colors ${c?"bg-accent/15 text-accent font-medium":"text-ink-secondary hover:bg-raised hover:text-ink"}`,title:c?"Disable line wrapping":"Wrap long lines","aria-label":c?"Disable line wrapping":"Wrap long lines","aria-pressed":c,children:[n.jsx(nE,{size:12,"aria-hidden":"true"}),n.jsx("span",{className:"hidden sm:inline",children:c?"Unwrap":"Wrap"})]}),n.jsxs("button",{type:"button",onClick:g,className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[11px] text-ink-secondary hover:bg-raised hover:text-ink transition-colors",title:"Download snippet as file","aria-label":"Download snippet as file",children:[n.jsx(pa,{size:12,"aria-hidden":"true"}),n.jsx("span",{className:"hidden sm:inline",children:"Save"})]}),n.jsx("button",{type:"button",onClick:h,className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[11px] text-ink-secondary hover:bg-raised hover:text-ink transition-colors",title:s?"Copied to clipboard":"Copy code","aria-label":s?"Code copied to clipboard":"Copy code to clipboard",children:s?n.jsxs(n.Fragment,{children:[n.jsx(gt,{size:12,className:"text-success","aria-hidden":"true"}),n.jsx("span",{className:"text-success font-medium hidden sm:inline",children:"Copied!"})]}):n.jsxs(n.Fragment,{children:[n.jsx(Ya,{size:12,"aria-hidden":"true"}),n.jsx("span",{className:"hidden sm:inline",children:"Copy"})]})})]})]}),o?n.jsx("div",{className:`text-[13px] leading-relaxed [&_pre]:!bg-transparent [&_pre]:m-0 [&_pre]:p-3 ${c?"whitespace-pre-wrap break-words overflow-x-hidden [&_pre]:!whitespace-pre-wrap [&_pre]:!break-words [&_code]:!whitespace-pre-wrap [&_code]:!break-words":"overflow-x-auto"}`,dangerouslySetInnerHTML:{__html:o}}):n.jsx("pre",{className:`p-3 text-[13px] leading-relaxed text-ink ${c?"whitespace-pre-wrap break-words overflow-x-hidden":"overflow-x-auto"}`,children:e})]})}function B6e(e){if(!e||typeof window>"u"||typeof window.getComputedStyle!="function")return"dark";try{return window.getComputedStyle(e).getPropertyValue("--code-color-scheme").trim()==="light"?"light":"dark"}catch{return"dark"}}const E6e='"Inter", -apple-system, BlinkMacSystemFont, "SF UI Text", "Segoe UI", system-ui, sans-serif';function R6e({code:e,streaming:t}){const a=f.useRef(null),[o,i]=f.useState(0),[s,r]=f.useState(null),[c,d]=f.useState(null),[p,h]=f.useState(!1),[g,b]=f.useState(!1),x=f.useRef(null);f.useEffect(()=>{if(typeof MutationObserver>"u"||typeof document>"u")return;const k=new MutationObserver(()=>i(S=>S+1));return k.observe(document.documentElement,{subtree:!0,attributeFilter:["data-skin"]}),()=>k.disconnect()},[]),f.useEffect(()=>{const k=B6e(a.current),S=`${k}:${OU(e)}`,N=qm.get(S);if(N){r(N),d(null);return}let C=!0,j;const M=()=>{d_(()=>import("./mermaid.core-KciMRs_R.js").then(D=>D.bz),[]).then(D=>(EP+=1,D.default.initialize({startOnLoad:!1,securityLevel:"strict",suppressErrorRendering:!0,theme:k==="light"?"default":"dark",fontFamily:E6e}),D.default.render(`omb-mermaid-${EP}`,e))).then(D=>{if(C){if(qm.size>=j6e){const A=qm.keys().next().value;A&&qm.delete(A)}qm.set(S,D.svg),r(D.svg),d(null)}}).catch(D=>{if(!C||t)return;const A=D instanceof Error?D.message:String(D);d(A.length>300?`${A.slice(0,300)}…`:A)})};return t?(r(null),d(null),j=setTimeout(M,DU)):M(),()=>{C=!1,j!==void 0&&clearTimeout(j)}},[e,t,o]),f.useEffect(()=>()=>{x.current!==null&&clearTimeout(x.current)},[]);const v=()=>{navigator.clipboard?.writeText&&navigator.clipboard.writeText(e).then(()=>{b(!0),x.current!==null&&clearTimeout(x.current),x.current=setTimeout(()=>b(!1),1500)}).catch(()=>{})};return n.jsxs("div",{ref:a,dir:"ltr",className:"my-2 overflow-hidden rounded-lg border border-hairline/40 bg-inset",children:[n.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-hairline/30 bg-raised/30 px-3 py-1.5 text-xs",children:[n.jsx("span",{title:"Mermaid diagram",className:"min-w-0 truncate rounded border border-hairline/40 bg-raised px-1.5 py-0.5 text-[11px] font-medium tracking-wide text-ink select-none",children:"Mermaid diagram"}),n.jsxs("div",{className:"flex shrink-0 items-center gap-1 whitespace-nowrap",children:[n.jsxs("button",{type:"button",onClick:()=>h(k=>!k),className:`inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[11px] transition-colors ${p?"bg-accent/15 text-accent font-medium":"text-ink-secondary hover:bg-raised hover:text-ink"}`,title:p?"Hide diagram source":"Show diagram source","aria-label":p?"Hide diagram source":"Show diagram source","aria-pressed":p,children:[n.jsx(nE,{size:12,"aria-hidden":"true"}),n.jsx("span",{className:"hidden sm:inline",children:p?"Hide source":"Show source"})]}),n.jsx("button",{type:"button",onClick:v,className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[11px] text-ink-secondary hover:bg-raised hover:text-ink transition-colors",title:g?"Copied to clipboard":"Copy diagram source","aria-label":g?"Diagram source copied to clipboard":"Copy diagram source to clipboard",children:g?n.jsxs(n.Fragment,{children:[n.jsx(gt,{size:12,className:"text-success","aria-hidden":"true"}),n.jsx("span",{className:"text-success font-medium hidden sm:inline",children:"Copied!"})]}):n.jsxs(n.Fragment,{children:[n.jsx(Ya,{size:12,"aria-hidden":"true"}),n.jsx("span",{className:"hidden sm:inline",children:"Copy"})]})})]})]}),c&&n.jsxs("p",{role:"alert",className:"px-3 pt-2 text-[12px] text-danger",children:["Diagram could not be rendered: ",c]}),s&&n.jsx("div",{className:"overflow-x-auto p-3 [&_svg]:!max-w-full",dangerouslySetInnerHTML:{__html:s}}),(p||!s||c)&&n.jsx("pre",{className:"overflow-x-auto p-3 text-[13px] leading-relaxed text-ink",children:e})]})}function D6e({filePath:e,children:t,message:a}){const o=Cz(e,void 0,a);if(!a)return n.jsx("span",{title:"Unavailable legacy file reference",className:"break-words text-ink-secondary",children:t});const i=o.state==="saving"?"Saving…":o.state==="saved"?"Saved":o.state==="failed"?"Retry":null;return n.jsxs("span",{dir:"ltr",className:"inline-flex flex-wrap items-center gap-x-1.5 [unicode-bidi:isolate]",children:[n.jsxs("button",{type:"button",onClick:()=>{o.save()},disabled:o.state==="saving",title:"Save a copy",className:"inline-flex items-center gap-1 break-words text-start text-accent underline decoration-accent/40 hover:decoration-accent disabled:cursor-wait",children:[t,o.state==="saving"?n.jsx(Ie,{size:12,className:"shrink-0 animate-spin","aria-hidden":"true"}):o.state==="saved"?n.jsx(gt,{size:12,className:"shrink-0 text-success","aria-hidden":"true"}):o.state==="failed"?n.jsx(Rs,{size:12,className:"shrink-0","aria-hidden":"true"}):n.jsx(pa,{size:12,className:"shrink-0","aria-hidden":"true"})]}),i&&n.jsx("span",{role:o.state==="failed"?"alert":"status",title:o.state==="saved"?o.savedTo:void 0,className:`text-[12px] ${o.state==="saved"?"text-success":o.state==="failed"?"text-danger":"text-ink-secondary"}`,children:o.state==="failed"?o.reason:i})]})}function O6e(e,t){const a=t?.trim();if(a)return a;try{const i=decodeURIComponent(new URL(e,"https://openmausbot.invalid").pathname).split(/[\\/]/).filter(Boolean).at(-1)?.trim();if(i)return i}catch{}return"Image"}function z6e(e){try{const t=new URL(e.startsWith("//")?`https:${e}`:e);return t.protocol==="https:"||t.protocol==="http:"?t.toString():void 0}catch{return}}function L6e({children:e}){const[t,a]=f.useState(!1);return t?n.jsxs("span",{className:"mx-px inline rounded px-1 py-px text-[13px] leading-relaxed text-ink underline decoration-dotted decoration-hairline underline-offset-2",children:[e,n.jsx("button",{type:"button","aria-label":"Hide spoiler",title:"Hide spoiler",onClick:()=>a(!1),className:"ms-1 rounded px-0.5 text-[11px] text-ink-secondary hover:text-ink",children:"Hide"})]}):n.jsxs("span",{className:"relative mx-px inline-block rounded px-1 py-px",children:[n.jsx("span",{"aria-hidden":"true",className:"pointer-events-none select-none bg-raised text-transparent [&_*]:!text-transparent [&_a]:!no-underline",children:e}),n.jsx("button",{type:"button","aria-label":"Reveal spoiler",title:"Reveal spoiler",onClick:()=>a(!0),className:"absolute inset-0 rounded bg-raised/90"})]})}const I5=[],F6e="![";function _6e(e,t){const a=/(^|\r?\n)((?: {0,3}>[ \t]?)* {0,3})(?:(`{3,})([^`\r\n]*)|(~{3,})([^\r\n]*))(?:\r?\n|$)/g;let o=0,i="",s;for(;(s=a.exec(e))!==null;){const r=s[3]??s[5],c=r[0],d=new RegExp(`(^|\\r?\\n)(?: {0,3}>[ \\t]?)* {0,3}${c}{${r.length},}[ \\t]*(?=\\r?\\n|$)`,"g");d.lastIndex=a.lastIndex;const p=d.exec(e),h=p===null?e.length:p.index+p[0].length;i+=e.slice(o,s.index),i+=t(e.slice(s.index,h)),o=h,a.lastIndex=h}return i+e.slice(o)}function q6e(e){const t=[],a=s=>{const r=`\0OMB_CODE_${t.length}\0`;return t.push(s),r};let i=_6e(e,a).replace(/(`+)[\s\S]*?\1/g,a).replace(/\\\[([\s\S]*?)\\\]/g,(s,r)=>`$$
548
548
  ${r}
549
549
  $$`).replace(/\\\(([\s\S]*?)\\\)/g,(s,r)=>`$${r}$`).replace(/\$\$[ \t]*([^\n][\s\S]*?)[ \t]*\$\$/g,(s,r)=>`$$
550
550
  ${r}
@@ -600,7 +600,7 @@ ${s}`);for(const a of B9e)t=t.replace(a,o=>yc(o));return t=t.replace(E9e,(a,o,i)
600
600
  `),className:ci,rows:2})]}),e==="card"&&n.jsxs(n.Fragment,{children:[n.jsxs("label",{className:"text-sm text-ink-secondary",children:[l("vault.number"),n.jsx("input",{name:"number",type:"password",inputMode:"numeric",required:!t,maxLength:25,autoComplete:"off",className:ci,"aria-describedby":"vault-hidden-help"})]}),n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsxs("label",{className:"text-sm text-ink-secondary",children:[l("vault.expiryMonth"),n.jsx("input",{name:"expiryMonth",type:"number",required:!0,min:1,max:12,defaultValue:t?.expiryMonth,className:ci})]}),n.jsxs("label",{className:"text-sm text-ink-secondary",children:[l("vault.expiryYear"),n.jsx("input",{name:"expiryYear",type:"number",required:!0,min:2e3,max:9999,defaultValue:t?.expiryYear,className:ci})]})]})]}),n.jsxs("fieldset",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[n.jsx("legend",{className:"mb-2 text-sm font-medium text-ink",children:l("vault.address")}),sB.map(b=>n.jsxs("label",{className:"text-sm text-ink-secondary",children:[l(`vault.address.${b}`),n.jsx("input",{name:b,maxLength:b==="postalCode"?40:b==="country"?100:b==="line1"||b==="line2"?300:200,defaultValue:g?.[b],className:ci})]},b))]}),e==="contact"&&n.jsxs(n.Fragment,{children:[n.jsxs("label",{className:"text-sm text-ink-secondary",children:[l("vault.email"),n.jsx("input",{name:"email",type:"email",maxLength:320,defaultValue:t?.email,className:ci})]}),n.jsxs("label",{className:"text-sm text-ink-secondary",children:[l("vault.phone"),n.jsx("input",{name:"phone",type:"tel",maxLength:80,defaultValue:t?.phone,className:ci})]})]})]}),e!=="contact"&&n.jsx("p",{id:"vault-hidden-help",className:"text-xs text-ink-secondary",children:l(t?"vault.keepSecret":"vault.hiddenSecret")}),n.jsxs("label",{className:"text-sm text-ink-secondary",children:[l("vault.hints"),n.jsx("textarea",{name:"hints",maxLength:1e3,defaultValue:t?.hints,className:ci})]}),n.jsxs("fieldset",{className:"flex flex-col gap-2 rounded-lg border border-hairline p-3",children:[n.jsx("legend",{className:"px-1 text-sm font-medium text-ink",children:l("vault.allowedBots")}),n.jsx("p",{className:"text-xs text-ink-secondary",children:l("vault.grantsHelp")}),a.map(b=>n.jsxs("label",{className:"flex items-center gap-2 text-sm text-ink",children:[n.jsx("input",{type:"checkbox",name:"botIds",value:b.id,defaultChecked:t?.botIds.includes(b.id)}),b.name]},b.id))]}),n.jsxs("label",{className:"text-sm text-ink-secondary",children:[l("vault.expiresAt"),n.jsx("input",{name:"expiresAt",type:"datetime-local",defaultValue:HPe(t?.expiresAt),className:ci})]}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx("button",{type:"submit",disabled:r,className:"rounded-lg bg-accent px-4 py-2 text-sm text-white disabled:opacity-50",children:l(r?"vault.saving":"vault.save")}),n.jsx("button",{type:"button",disabled:r,onClick:o,className:"rounded-lg bg-control px-4 py-2 text-sm text-ink",children:l("vault.cancel")})]})]})})}const $Pe=["all","login","card","contact"],Hm="rounded-lg bg-control px-3 py-2 text-sm text-ink focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent disabled:opacity-50";function KPe(){const{state:e}=ve(),[t,a]=f.useState([]),[o,i]=f.useState("all"),[s,r]=f.useState(""),[c,d]=f.useState(""),[p,h]=f.useState(!1),[g,b]=f.useState(!1),[x,v]=f.useState(null),[k,S]=f.useState(null),[N,C]=f.useState(""),j=f.useRef(0),M=f.useCallback(async()=>{const P=++j.current;try{const O=await X("/api/vault",{timeoutMs:15e3});if(P!==j.current)return;a(O.items),h(!0),d("")}catch(O){P===j.current&&(d(O instanceof Error?O.message:l("vault.error")),h(!1))}},[]);f.useEffect(()=>(M(),()=>{j.current++}),[M]);async function D(){if(!(!k||g)){b(!0);try{await X(`/api/vault/${k.id}`,{method:"DELETE",timeoutMs:15e3}),S(null),await M()}catch{d(l("vault.error"))}finally{b(!1)}}}async function A(P){if(!(!P||g)){b(!0),C(""),d("");try{const O=await X("/api/vault/import",{method:"POST",body:JSON.stringify({csv:await P.text()}),timeoutMs:6e4});C(l("vault.imported",{added:O.added,duplicates:O.duplicates,skipped:O.skipped})),await M()}catch(O){d(O instanceof Error?O.message:l("vault.error"))}finally{b(!1)}}}if(x)return n.jsx(GPe,{item:typeof x=="string"?void 0:x,kind:typeof x=="string"?x:x.kind,bots:e.bots,onCancel:()=>v(null),onSaved:()=>{v(null),M()}});const R=t.filter(P=>(o==="all"||P.kind===o)&&[P.label,P.username??"",P.hints,...P.origins].join(" ").toLocaleLowerCase().includes(s.toLocaleLowerCase()));return n.jsxs("div",{className:"flex flex-col gap-4","aria-busy":g,children:[n.jsxs(ut,{title:l("vault.title"),subtitle:l("vault.description"),children:[c&&n.jsx("p",{role:"alert",className:"mb-3 text-sm text-danger",children:c}),n.jsxs("div",{className:"flex flex-wrap gap-2",children:[["login","card","contact"].map(P=>n.jsx("button",{type:"button",className:Hm,disabled:!p||g,onClick:()=>v(P),children:l(`vault.add.${P}`)},P)),n.jsxs("label",{className:`${Hm} cursor-pointer has-[:disabled]:opacity-50`,children:[l("vault.importCsv"),n.jsx("input",{type:"file",accept:".csv,text/csv",className:"sr-only",disabled:!p||g,onChange:P=>{A(P.target.files?.[0]),P.target.value=""}})]}),n.jsx("button",{type:"button",className:Hm,onClick:()=>{M()},children:l("vault.refresh")})]}),n.jsx("p",{className:"mt-2 text-xs text-ink-secondary",children:l("vault.importHelp")}),N&&n.jsx("p",{role:"status",className:"mt-2 text-sm text-ink",children:N}),!p&&!c&&n.jsx("p",{role:"status",className:"mt-3 text-sm text-ink-secondary",children:l("vault.loading")}),p&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"my-4 flex flex-wrap gap-2",role:"group","aria-label":l("vault.categories"),children:$Pe.map(P=>n.jsxs("button",{type:"button",className:Hm,"aria-pressed":o===P,onClick:()=>i(P),children:[l(`vault.category.${P}`)," ",t.filter(O=>P==="all"||O.kind===P).length]},P))}),n.jsxs("label",{className:"flex flex-col gap-1 text-sm text-ink-secondary",children:[l("vault.search"),n.jsx("input",{type:"search",value:s,onChange:P=>r(P.target.value),className:"rounded-lg border border-hairline bg-field px-3 py-2 text-ink"})]}),!R.length&&n.jsx("p",{role:"status",className:"py-8 text-center text-sm text-ink-secondary",children:t.length?l("vault.noMatches"):l("vault.empty")}),n.jsx("ul",{className:"mt-3 divide-y divide-hairline",children:R.map(P=>n.jsxs("li",{className:"flex flex-wrap items-center gap-2 py-3",children:[n.jsxs("button",{type:"button",onClick:()=>v(P),className:"min-w-0 flex-1 rounded-lg p-2 text-left text-ink hover:bg-control focus-visible:outline focus-visible:outline-accent",children:[n.jsx("span",{className:"block truncate font-medium",children:P.label}),n.jsx("span",{className:"block truncate text-xs text-ink-secondary",children:P.username??(P.lastFour?`•••• ${P.lastFour}`:l(`vault.category.${P.kind}`))})]}),n.jsx("button",{type:"button",className:Hm,onClick:()=>S(P),"aria-label":`${l("vault.remove")} ${P.label}`,children:l("vault.remove")})]},P.id))})]})]}),n.jsx("p",{className:"text-xs leading-relaxed text-ink-secondary",children:l("vault.privacy")}),n.jsx(Oa,{open:k!==null,title:l("vault.remove"),body:l("vault.removeBody"),confirmLabel:l("vault.remove"),onCancel:()=>S(null),onConfirm:()=>{D()},pending:g})]})}function WPe(){const e=window.ogb?.clipboardSettings,[t,a]=f.useState(null),[o,i]=f.useState(""),[s,r]=f.useState(""),[c,d]=f.useState(!1);f.useEffect(()=>{let h=!0;return e?.get().then(g=>{h&&(a(g),i(g.excludedApps.join(", ")))}).catch(()=>{h&&r("Clipboard history is unavailable. It requires the Mac or Windows desktop app and an unlocked operating-system keychain.")}),()=>{h=!1}},[e]);const p="rounded-lg border border-hairline bg-inset px-3 py-2 text-ink";return n.jsxs(ut,{title:"Clipboard",subtitle:"Private clipboard history on this Mac or Windows PC. Open the picker with Command+Shift+V on Mac or Control+Shift+V on Windows.",children:[!e&&n.jsx("p",{children:"Clipboard settings are available in the Mac and Windows desktop apps."}),s&&n.jsx("p",{role:"status",className:"mb-3 text-sm",children:s}),t&&n.jsx("form",{className:"flex flex-col gap-4",onSubmit:async h=>{h.preventDefault(),d(!0),r("");try{const g=await e.save({...t,excludedApps:o.split(",").map(b=>b.trim()).filter(Boolean)});a(g),i(g.excludedApps.join(", ")),r("Clipboard settings saved.")}catch{r("Settings could not be saved. Your edits are kept; try again.")}finally{d(!1)}},children:n.jsxs("fieldset",{disabled:c,className:"flex flex-col gap-4",children:[n.jsxs("label",{className:"flex items-center gap-2",children:[n.jsx("input",{type:"checkbox",checked:!t.paused,onChange:h=>a({...t,paused:!h.target.checked})}),"Capture clipboard history"]}),n.jsxs("label",{className:"flex flex-col gap-1",children:["Keep unpinned clips for (days)",n.jsx("input",{className:p,type:"number",required:!0,min:1,max:365,value:t.retentionDays,onChange:h=>a({...t,retentionDays:Number(h.target.value)})})]}),n.jsxs("label",{className:"flex flex-col gap-1",children:["Storage limit (MB)",n.jsx("input",{className:p,type:"number",required:!0,min:1,max:512,value:Math.round(t.maxBytes/1048576),onChange:h=>a({...t,maxBytes:Number(h.target.value)*1048576})})]}),n.jsxs("label",{className:"flex flex-col gap-1",children:["Excluded apps",n.jsx("input",{className:p,value:o,onChange:h=>i(h.target.value),"aria-describedby":"clipboard-excluded-help"})]}),n.jsx("p",{id:"clipboard-excluded-help",className:"text-sm text-ink-secondary",children:"Comma-separated Mac bundle identifiers or Windows process names. Password managers and protected copies are always excluded."}),n.jsx("p",{className:"text-sm text-ink-secondary",children:"Pinned clips stay until you delete them. Reducing retention or the storage limit removes older unpinned clips when you save. Nexus sync and bot access remain off."}),n.jsx("button",{type:"submit",className:"ui-button self-start",children:c?"Saving…":"Save settings"})]})})]})}const k2="Mod+D";function JPe(e=h6){try{return e()||Ar}catch{return Ar}}function lh(e){return e?.platform==="win32"?"win32":"darwin"}function YPe(e,t="darwin"){return p6(e,t!=="win32")}function ur(e,t="darwin"){return Kc(e,t!=="win32")}function ZPe(e,t="darwin"){switch(/\((\w+)\)/.exec(e)?.[1]){case"needsControlOrOption":return"dictation.shortcut.needsControlOrOption";case"reserved":return t==="win32"?"dictation.shortcut.reservedWindows":"dictation.shortcut.reserved";case"altGr":return"dictation.shortcut.altGr";default:return"dictation.shortcut.invalid"}}const QPe=["listening","listeningHipaa","transcribing","correcting","cancelled","tooShort","nothingHeard","busy","micDenied","accessibilityDenied","inputMonitoringDenied","secureField","appDisabled","engineDownload","engineDownloading","engineUnsupported","engineFailed","pasteFailed","correctSkipped","pausedOtherApp","pausedHeldText","undone"];function XPe(){return Object.fromEntries(QPe.map(e=>[e,l(`dictation.hud.${e}`)]))}function qH(){window.ogb?.dictation?.setStrings(XPe()).catch(()=>{})}function eTe(e){const t=lh(e);if(e.support!=="ok")return{key:t==="win32"&&e.support==="not-built"?"dictation.support.windowsNotBuilt":`dictation.support.${e.support}`,tone:"off"};const a=e.settings;if(!a?.enabled)return{key:"dictation.status.off",tone:"off"};if(!e.connected||!e.status)return{key:"dictation.status.starting",tone:"busy"};const{permissions:o,engine:i,hotkey:s}=e.status;return t==="win32"?o.microphone==="denied"?{key:"dictation.status.needsMicrophoneWindows",tone:"warn"}:s.error==="taken"?{key:"dictation.status.shortcutTakenWindows",tone:"warn"}:s.error?{key:"dictation.status.shortcutFailed",tone:"warn"}:i.unsupported?{key:"dictation.status.windowsSpeechMissing",tone:"warn"}:s.passThrough&&e.status.phase!=="recording"?{key:"dictation.status.passThrough",tone:"off",params:{shortcut:ur(a.shortcut,t)}}:e.status.phase==="recording"?{key:"dictation.status.listening",tone:"ok"}:{key:"dictation.status.readyWindows",tone:"ok",params:{shortcut:ur(a.shortcut,t)}}:o.microphone!=="granted"?{key:"dictation.status.needsMicrophone",tone:"warn"}:o.accessibility!=="granted"?{key:"dictation.status.needsAccessibility",tone:"warn"}:a.trigger==="rightOption"&&o.inputMonitoring!=="granted"?{key:"dictation.status.needsInputMonitoring",tone:"warn"}:s.error==="taken"?{key:"dictation.status.shortcutTaken",tone:"warn"}:s.error?{key:"dictation.status.shortcutFailed",tone:"warn"}:s.passThrough&&e.status.phase!=="recording"?{key:"dictation.status.passThrough",tone:"off",params:{shortcut:ur(a.shortcut)}}:i.downloading?{key:"dictation.status.downloading",tone:"busy",params:{percent:Math.round(i.downloading.fraction*100)}}:i.unsupported?{key:"dictation.status.engineUnsupported",tone:"warn"}:i.needsDownload?{key:"dictation.status.needsDownload",tone:"warn"}:e.status.phase==="recording"?{key:"dictation.status.listening",tone:"ok"}:a.trigger==="rightOption"?{key:"dictation.status.readyHold",tone:"ok"}:{key:"dictation.status.ready",tone:"ok",params:{shortcut:ur(a.shortcut)}}}const tTe=["microphone-denied","microphone-failed","accessibility-denied","paste-failed","secure-field","app-disabled","engine-failed","engine-missing","engine-unsupported","engine-downloading","download-failed","held-on-clipboard"];function nTe(e){return tTe.includes(e)?`dictation.error.${e}`:"dictation.error.unknown"}function aTe(e){return`dictation.shortcut.conflict.${e}`}const UH="w-full rounded-lg border border-hairline/40 bg-inset px-3 py-2 text-[13px] text-ink placeholder:text-ink-secondary focus:border-hairline focus:outline-none disabled:opacity-50";function oTe(){const e=typeof window<"u"?window.ogb?.dictation:void 0,[t,a]=f.useState(null);return f.useEffect(()=>{if(!e)return;let o=!0;const i=()=>e.state().then(c=>{o&&a(c)}).catch(()=>{});i(),qH();const s=e.onState(c=>a(c)),r=window.setInterval(i,4e3);return()=>{o=!1,s(),window.clearInterval(r)}},[e]),{bridge:e,state:t,setState:a}}function iTe(){const{bridge:e,state:t,setState:a}=oTe(),[o,i]=f.useState(null),s=t?.settings??null,r=async c=>{if(!e)return!1;i(null);try{return a(await e.set(c)),!0}catch(d){const p=d instanceof Error?d.message:String(d);return i("shortcut"in c?l(ZPe(p,lh(t))):p.replace(/^Error invoking remote method '[^']*':\s*(?:Error:\s*)?/,"")),!1}};return n.jsxs(n.Fragment,{children:[n.jsx(hTe,{onChange:()=>{e?.state().then(a).catch(()=>{})}}),e?t?n.jsxs(n.Fragment,{children:[n.jsxs(ut,{title:l("dictation.title"),subtitle:l("dictation.subtitle"),children:[n.jsx(Wt,{title:l("dictation.enable.title"),subtitle:l("dictation.enable.subtitle"),message:n.jsx(sTe,{state:t}),children:n.jsx(Dt,{checked:s?.enabled===!0,disabled:t.support!=="ok","aria-label":l("dictation.enable.title"),onClick:()=>{r({enabled:!s?.enabled})}})}),o&&n.jsx("p",{role:"alert",className:"mt-2 text-[12px] text-danger",children:o})]}),t.support==="ok"&&s?.enabled&&n.jsxs(n.Fragment,{children:[lh(t)==="win32"?n.jsx(dTe,{state:t}):n.jsx(rTe,{state:t}),n.jsx(lTe,{settings:s,conflicts:t.conflicts??[],change:r,platform:lh(t)}),lh(t)==="win32"?n.jsx(uTe,{state:t}):n.jsx(cTe,{state:t,change:r}),n.jsx(pTe,{state:t,change:r}),n.jsx(mTe,{settings:s,change:r})]})]}):null:n.jsx(ut,{title:l("dictation.title"),subtitle:l("dictation.support.platform")})]})}function sTe({state:e}){const t=eTe(e),a=t.tone==="ok"?"text-success":t.tone==="warn"?"text-danger":"text-ink-secondary",o=e.lastError?.code;return n.jsxs("div",{className:"space-y-1",children:[n.jsx("p",{role:"status",className:a,children:l(t.key,t.params)}),o&&e.settings?.enabled&&n.jsx("p",{className:"text-ink-secondary",children:l("dictation.lastError",{problem:l(nTe(o))})})]})}const rB={microphone:{title:"dictation.permission.microphone",why:"dictation.permission.microphoneWhy"},accessibility:{title:"dictation.permission.accessibility",why:"dictation.permission.accessibilityWhy"},inputMonitoring:{title:"dictation.permission.inputMonitoring",why:"dictation.permission.inputMonitoringWhy"}};function rTe({state:e}){const t=window.ogb?.dictation,a=e.settings?.trigger==="rightOption"?["microphone","accessibility","inputMonitoring"]:["microphone","accessibility"];return n.jsx(ut,{title:l("dictation.permissions.title"),subtitle:l("dictation.permissions.subtitle"),children:a.map(o=>{const i=e.status?.permissions?.[o],s=i==="granted";return n.jsx(Wt,{title:l(rB[o].title),subtitle:l(rB[o].why),message:n.jsx("span",{className:s?"text-success":"text-ink-secondary",children:l(s?"dictation.permission.granted":i==="denied"?"dictation.permission.denied":"dictation.permission.notAsked")}),children:!s&&n.jsxs("div",{className:"flex flex-wrap justify-end gap-2",children:[n.jsx("button",{type:"button",className:"ui-button",onClick:()=>{t?.requestPermission(o).catch(()=>{})},children:l("dictation.permission.allow")}),n.jsx("button",{type:"button",className:"ui-button",onClick:()=>{t?.openPrivacySettings(o)},children:l("dictation.permission.openSettings")})]})},o)})})}function lTe({settings:e,conflicts:t,change:a,platform:o}){const[i,s]=f.useState(!1);f.useEffect(()=>{if(!i)return;const c=d=>{if(d.preventDefault(),d.stopPropagation(),d.key==="Escape")return s(!1);const p=YPe(d,o);p&&(s(!1),a({shortcut:p,trigger:"chord"}))};return window.addEventListener("keydown",c,!0),()=>window.removeEventListener("keydown",c,!0)},[i,a,o]);const r=(c,d,p)=>n.jsxs("label",{className:V("flex cursor-pointer gap-3 rounded-lg p-3",e.trigger===c?"bg-control":"hover:bg-control/50"),children:[n.jsx("input",{type:"radio",name:"dictation-trigger",className:"mt-1",checked:e.trigger===c,onChange:()=>{a({trigger:c})}}),n.jsxs("span",{className:"min-w-0",children:[n.jsx("span",{className:"block text-[14px] font-medium text-ink",children:d}),n.jsx("span",{className:"mt-0.5 block text-[12px] leading-relaxed text-ink-secondary",children:p})]})]});return n.jsx(ut,{title:l("dictation.shortcut.title"),subtitle:l("dictation.shortcut.subtitle",{inApp:ur(JPe(),o)}),children:n.jsxs("div",{className:"space-y-2",children:[r("chord",l("dictation.shortcut.chord",{shortcut:ur(e.shortcut,o)}),l(o==="win32"?"dictation.shortcut.chordWhyWindows":"dictation.shortcut.chordWhy")),e.trigger==="chord"&&n.jsxs("div",{className:"flex items-center gap-2 pl-9",children:[n.jsxs("button",{type:"button",className:"ui-button",onClick:()=>s(!i),"aria-pressed":i,children:[n.jsx(c4,{size:13,"aria-hidden":!0}),l(i?"dictation.shortcut.recording":"dictation.shortcut.change")]}),e.shortcut!==k2&&n.jsx("button",{type:"button",className:"ui-button",onClick:()=>{a({shortcut:k2})},children:l("dictation.shortcut.reset",{shortcut:ur(k2,o)})})]}),e.trigger==="chord"&&t.length>0&&n.jsxs("div",{className:"ml-9 rounded-lg border border-hairline/40 p-3",children:[n.jsx("p",{className:"text-[13px] font-medium text-ink",children:l("dictation.shortcut.conflictsTitle",{shortcut:ur(e.shortcut,o)})}),n.jsx("p",{className:"mt-0.5 text-[12px] leading-relaxed text-ink-secondary",children:l("dictation.shortcut.conflictsWhy",{shortcut:ur(e.shortcut,o)})}),n.jsx("div",{className:"mt-2 space-y-1",children:t.map(c=>{const d=!e.disabledApps.includes(c.bundleId);return n.jsx(Wt,{title:c.name,subtitle:l(aTe(c.action)),children:n.jsx(Dt,{checked:d,"aria-label":l("dictation.apps.toggle",{app:c.name}),onClick:()=>{a({appEnabled:{bundleId:c.bundleId,enabled:!d}})}})},c.bundleId)})})]}),o!=="win32"&&r("rightOption",l("dictation.shortcut.rightOption"),l("dictation.shortcut.rightOptionWhy"))]})})}function cTe({state:e,change:t}){const a=e.settings,o=e.status?.engine??{},i=window.ogb?.dictation,s=r=>{const c=o[r];return o.downloading?.engine===r?l("dictation.engine.downloading",{percent:Math.round(o.downloading.fraction*100)}):c?.supported?l(c.installed?"dictation.engine.ready":"dictation.engine.notDownloaded"):l(r==="apple"?"dictation.engine.appleUnsupported":"dictation.engine.parakeetUnsupported")};return n.jsxs(ut,{title:l("dictation.engine.title"),subtitle:l("dictation.engine.subtitle"),children:[n.jsx(Wt,{title:l("dictation.engine.choice"),children:n.jsxs("select",{className:UH,value:a.engine,"aria-label":l("dictation.engine.choice"),onChange:r=>{t({engine:r.target.value})},children:[n.jsx("option",{value:"auto",children:l("dictation.engine.auto")}),n.jsx("option",{value:"apple",children:l("dictation.engine.apple")}),n.jsx("option",{value:"parakeet",children:l("dictation.engine.parakeet")})]})}),n.jsx(Wt,{title:l("dictation.engine.apple"),subtitle:l("dictation.engine.appleWhy"),message:n.jsx("span",{className:"text-ink-secondary",children:s("apple")}),children:o.active==="apple"&&n.jsx("span",{className:"text-[12px] text-success",children:l("dictation.engine.inUse")})}),n.jsx(Wt,{title:l("dictation.engine.parakeet"),subtitle:l("dictation.engine.parakeetWhy"),message:n.jsx("span",{className:"text-ink-secondary",children:s("parakeet")}),children:o.active==="parakeet"?n.jsx("span",{className:"text-[12px] text-success",children:l("dictation.engine.inUse")}):o.parakeet?.supported&&!o.parakeet.installed&&!o.downloading?n.jsx("button",{type:"button",className:"ui-button",onClick:()=>{i?.downloadEngine("parakeet").catch(()=>{})},children:l("dictation.engine.download")}):null})]})}function dTe({state:e}){const t=window.ogb?.dictation,a=e.status?.permissions?.microphone==="denied";return n.jsx(ut,{title:l("dictation.permissions.title"),children:n.jsx(Wt,{title:l("dictation.permission.microphone"),subtitle:l("dictation.permission.microphoneWhyWindows"),message:n.jsx("span",{className:a?"text-danger":"text-success",children:l(a?"dictation.permission.windowsBlocked":"dictation.permission.windowsOk")}),children:n.jsx("button",{type:"button",className:"ui-button",onClick:()=>{t?.openPrivacySettings("microphone")},children:l("dictation.permission.openWindowsSettings")})})})}function uTe({state:e}){const t=window.ogb?.dictation,a=e.status?.engine?.windows?.languages??[],o=e.status?.engine?.unsupported===!0;return n.jsx(ut,{title:l("dictation.engine.title"),children:n.jsx(Wt,{title:l("dictation.engine.windows"),subtitle:l("dictation.engine.windowsWhy"),message:n.jsx("span",{className:o?"text-danger":"text-ink-secondary",children:o?l("dictation.engine.windowsMissing"):a.length?l("dictation.engine.windowsLanguages",{languages:a.join(", ")}):null}),children:n.jsx("button",{type:"button",className:"ui-button",onClick:()=>{t?.downloadEngine("windows").catch(()=>{})},children:l("dictation.engine.windowsAddLanguage")})})})}function pTe({state:e,change:t}){const a=e.settings,o=e.hipaa?.enabled===!0,[i,s]=f.useState(null),r=i??a.vocabulary.join(`
601
601
  `);return n.jsxs(ut,{title:l("dictation.correct.title"),subtitle:l("dictation.correct.subtitle"),children:[n.jsx(Wt,{title:l("dictation.correct.enable"),subtitle:l("dictation.correct.enableWhy"),children:n.jsx(Dt,{checked:a.autoCorrect,"aria-label":l("dictation.correct.enable"),onClick:()=>{t({autoCorrect:!a.autoCorrect})}})}),n.jsx(Wt,{title:l("dictation.correct.subscriptions"),subtitle:l(o?"dictation.correct.subscriptionsHipaa":"dictation.correct.subscriptionsWhy"),children:n.jsx(Dt,{checked:a.useSubscriptions&&!o,disabled:o||!a.autoCorrect,"aria-label":l("dictation.correct.subscriptions"),onClick:()=>{t({useSubscriptions:!a.useSubscriptions})}})}),n.jsxs("div",{className:"border-t border-hairline/40 pt-4",children:[n.jsx("label",{className:"block text-[14px] font-medium text-ink",htmlFor:"dictation-words",children:l("dictation.words.title")}),n.jsx("p",{className:"mt-1 text-[12px] leading-relaxed text-ink-secondary",children:l("dictation.words.subtitle")}),n.jsx("textarea",{id:"dictation-words",className:`${UH} mt-2 h-24 resize-y font-mono text-[12px]`,value:r,placeholder:l("dictation.words.placeholder"),onChange:c=>s(c.target.value),onBlur:async()=>{if(i===null)return;const c=i;await t({vocabulary:c.split(`
602
602
  `).map(p=>p.trim()).filter(Boolean)})&&s(p=>p===c?null:p)}})]})]})}function mTe({settings:e,change:t}){return n.jsx(ut,{title:l("dictation.apps.title"),subtitle:l("dictation.apps.subtitle"),children:e.recentApps.length===0?n.jsx("p",{className:"text-[13px] text-ink-secondary",children:l("dictation.apps.empty")}):e.recentApps.map(a=>{const o=!e.disabledApps.includes(a.bundleId);return n.jsx(Wt,{title:a.name,subtitle:a.bundleId,children:n.jsx(Dt,{checked:o,"aria-label":l("dictation.apps.toggle",{app:a.name}),onClick:()=>{t({appEnabled:{bundleId:a.bundleId,enabled:!o}})}})},a.bundleId)})})}function hTe({onChange:e}){const t=Gl(),[a,o]=f.useState(null),[i,s]=f.useState(null);if(f.useEffect(()=>{let d=!0;return X("/api/hipaa").then(p=>{d&&o(p)}).catch(()=>{}),()=>{d=!1}},[]),!a)return null;const r=async()=>{s(null);try{o(await X("/api/hipaa",{method:"PUT",body:JSON.stringify({enabled:!a.enabled})})),e()}catch(d){s(d instanceof Error?d.message:String(d))}},c=a.source==="mdm"?null:a.source==="environment"?l("dictation.hipaa.environment"):t===!1?l("dictation.hipaa.adminOnly"):null;return n.jsx(ut,{children:n.jsx(Wt,{title:l("dictation.hipaa.title"),subtitle:n.jsxs("span",{className:"inline-flex items-start gap-1.5",children:[n.jsx(Ps,{size:13,className:"mt-0.5 shrink-0","aria-hidden":!0}),l("dictation.hipaa.subtitle")]}),message:c||i?n.jsx("span",{className:i?"text-danger":"text-ink-secondary",children:i??c}):void 0,children:n.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.source==="mdm"&&n.jsx(jr,{}),n.jsx(Dt,{checked:a.enabled,disabled:a.locked||t!==!0,"aria-label":l("dictation.hipaa.title"),onClick:()=>{r()}})]})})})}const gTe=[{id:"publicTranscript",title:"watch.settings.publicTranscript.title",subtitle:"watch.settings.publicTranscript.subtitle"},{id:"allowAppClient",title:"watch.settings.appClient.title",subtitle:"watch.settings.appClient.subtitle"},{id:"onDeviceSpeech",title:"watch.settings.onDevice.title",subtitle:"watch.settings.onDevice.subtitle"}];function fTe(e,t,a){return e.managed[t]!==void 0?null:e.remote[t]===!1?"watch.settings.remoteOff":e.hipaa&&t!=="onDeviceSpeech"?"watch.settings.hipaa":t==="allowAppClient"&&!e.effective.publicTranscript?"watch.settings.needsPage":a===!1?"watch.settings.adminOnly":null}function bTe(){const e=Gl(),[t,a]=f.useState(null),[o,i]=f.useState(null);if(f.useEffect(()=>{let r=!0;return X("/api/watch-along/settings").then(c=>{r&&a(c)}).catch(()=>{}),()=>{r=!1}},[]),!t?.access.allowed)return null;const s=async r=>{i(null);try{a(await X("/api/watch-along/settings",{method:"PUT",body:JSON.stringify({[r]:!t.effective[r]})}))}catch(c){i(c instanceof Error?c.message:String(c))}};return n.jsxs(ut,{title:l("settings.section.watchAlong"),subtitle:l("watch.settings.intro"),children:[gTe.map(({id:r,title:c,subtitle:d})=>{const p=t.managed[r]!==void 0,h=fTe(t,r,e),g=p||t.remote[r]===!1||t.hipaa&&r!=="onDeviceSpeech"||r==="allowAppClient"&&!t.effective.publicTranscript;return n.jsx(Wt,{title:l(c),subtitle:l(d),message:h?n.jsx("span",{className:"text-ink-secondary",children:l(h)}):void 0,children:n.jsxs("div",{className:"flex items-center justify-end gap-2",children:[p&&n.jsx(jr,{}),n.jsx(Dt,{checked:t.effective[r],disabled:g||e!==!0,"aria-label":l(c),onClick:()=>{s(r)}})]})},r)}),o&&n.jsx("p",{role:"alert",className:"mt-2 text-[12px] text-danger",children:o})]})}const yTe=.7,xTe=1.6,lB=.1,VH="atomic.appZoom",J5="atomic.settingsZoom",HH="atomic.settingsSize",Y5="atomic:settings-zoom";function Z5(e){return Number.isFinite(e)?Math.min(xTe,Math.max(yTe,Math.round(e*10)/10)):1}function vTe(e,t){return t==="reset"?1:Z5(Z5(e)+(t==="in"?lB:-lB))}function Qx(e){try{const t=globalThis.localStorage?.getItem(e);return Z5(t==null?1:Number(t))}catch{return 1}}function GH(e,t){try{globalThis.localStorage?.setItem(e,t)}catch{}}function kTe(e,t,a){const o=t?J5:VH,i=vTe(Qx(o),e);return GH(o,String(i)),(t?a.settings:a.app)(i),i}function wTe(){try{const e=globalThis.localStorage?.getItem(HH);if(!e)return null;const t=JSON.parse(e),a=Number(t.w),o=Number(t.h);return Number.isFinite(a)&&Number.isFinite(o)&&a>=320&&o>=280?{w:Math.round(a),h:Math.round(o)}:null}catch{return null}}function STe(e){if(!e)return()=>{};const t=()=>{e.style.zoom=String(Qx(J5))};t(),window.addEventListener(Y5,t),e.style.resize="both",e.style.minWidth="320px",e.style.minHeight="280px";const a=wTe();a&&(e.style.width=`${a.w}px`,e.style.height=`${a.h}px`,e.style.maxWidth="calc(100vw - 24px)",e.style.maxHeight="calc(100dvh - 24px)");const o=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>{if(window.innerWidth<640)return;const i=e.getBoundingClientRect(),s=Qx(J5);GH(HH,JSON.stringify({w:Math.round(i.width/s),h:Math.round(i.height/s)}))});return o?.observe(e),()=>{window.removeEventListener(Y5,t),o?.disconnect()}}function CTe(){const{state:e,dispatch:t}=ve(),[a,o]=f.useState(e.config?.profile?.name??""),[i,s]=f.useState(e.config?.profile?.email??"");f.useEffect(()=>{o(e.config?.profile?.name??""),s(e.config?.profile?.email??"")},[e.config?.profile?.name,e.config?.profile?.email]);const r=()=>{fetch("/api/config",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({profile:{name:a.trim(),email:i.trim().toLowerCase()}})}).then(d=>{if(!d.ok)throw new Error("Profile save failed");return d.json()}).then(d=>{d.profile&&t({type:"profileSaved",profile:{name:d.profile.name,email:d.profile.email}})}).catch(()=>{})},c="w-full rounded-lg border border-hairline/40 bg-inset px-3 py-2 text-[14px] text-ink placeholder:text-ink-secondary focus:border-hairline focus:outline-none";return n.jsxs("div",{className:"flex flex-col gap-3",children:[n.jsx("input",{"aria-label":l("settings.profile.name"),value:a,onChange:d=>o(d.target.value),onBlur:r,placeholder:l("settings.profile.name"),className:c}),n.jsx("input",{type:"email","aria-label":l("phone.signIn.email"),value:i,onChange:d=>s(d.target.value),onBlur:r,placeholder:"you@example.com",className:c}),n.jsx(vPe,{})]})}function jTe({channel:e}){return n.jsxs(n.Fragment,{children:[n.jsx(Wt,{title:l("settings.updates.title"),subtitle:l("settings.updates.managed"),children:n.jsx(jr,{})}),e&&n.jsx($H,{channel:e==="beta"?"beta":"latest",managedChannel:e})]})}function NTe(){const e=sC();if(!window.ogb?.updater)return null;const t=window.ogb.updater;if(e?.updatesManaged)return n.jsx(jTe,{channel:e.managedChannel??null});const a=e?.status==="checking"?l("settings.updates.checking"):e?.status==="available"?l("settings.updates.available",{version:e.version??""}):e?.status==="downloading"?e.percent==null?l("settings.updates.startingDownload"):l("settings.updates.downloading",{percent:Math.round(e.percent)}):e?.status==="preparing"?l("settings.updates.preparing"):e?.status==="downloaded"?e.installMode==="handoff"?l("settings.updates.readyInstall",{version:e.version??""}):l("settings.updates.ready",{version:e.version??""}):e?.status==="installing"?e.message||(e.installMode==="handoff"?l("settings.updates.openingTerminal"):l("settings.updates.restarting")):e?.status==="handed-off"?l("settings.updates.handedOff"):e?.status==="error"?l("settings.updates.failed",{message:e.message??l("settings.updates.unknownError")}):l("settings.updates.latest"),o=e?.appVersion?l("settings.updates.versionChannel",{version:e.appVersion,channel:l(e.channel==="beta"?"settings.updates.channel.beta":"settings.updates.channel.latest")}):"";return n.jsxs(n.Fragment,{children:[n.jsx(Wt,{title:l("settings.updates.title"),subtitle:o?n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"block",children:o}),a]}):a,children:n.jsx("button",{onClick:()=>{if(e?.status==="available")return void t.download();if(e?.status==="downloaded")return void t.install();t.check()},disabled:e?.status==="checking"||e?.status==="downloading"||e?.status==="preparing"||e?.status==="installing"||e?.retryable===!1,className:"ui-button",children:e?.retryable===!1?l("settings.updates.quitReopen"):e?.status==="available"?l("settings.updates.download"):e?.status==="downloaded"?e.installMode==="handoff"?l("settings.updates.install"):l("settings.updates.restart"):e?.status==="preparing"?l("settings.updates.preparingShort"):e?.status==="installing"?e.installMode==="handoff"?l("settings.updates.opening"):l("settings.updates.restartingShort"):l("settings.updates.check")})}),e?.channelsAvailable&&t.setChannel&&n.jsx($H,{channel:e.channel??"latest",managedChannel:e.managedChannel??null})]})}function $H({channel:e,managedChannel:t=null}){const[a,o]=f.useState(!1),[i,s]=f.useState(""),r=e==="beta";if(t)return n.jsx(Wt,{title:l("settings.updates.early.title"),subtitle:l(typeof window<"u"&&window.ogb?.platform&&window.ogb.platform!=="darwin"?"settings.updates.early.managedComputer":"settings.updates.early.managed",{channel:l(t==="beta"?"settings.updates.channelBeta":"settings.updates.channelStable")}),children:n.jsx(jr,{})});const c=()=>{o(!0),s(""),window.ogb?.updater?.setChannel?.(r?"latest":"beta").catch(()=>s(l("settings.updates.early.failed"))).finally(()=>o(!1))};return n.jsx(Wt,{title:l("settings.updates.early.title"),subtitle:l("settings.updates.early.subtitle"),message:i?n.jsx("p",{role:"alert",className:"text-danger",children:i}):null,children:n.jsx(Dt,{checked:r,disabled:a,"aria-label":l("settings.updates.early.title"),onClick:c})})}function ATe(){const{state:e,dispatch:t}=ve(),a=e.config?.newBots?.effort??"",[o,i]=f.useState(!1),[s,r]=f.useState(""),c=async d=>{if(!o){i(!0),r("");try{const p=await X("/api/config",{method:"PATCH",body:JSON.stringify({newBots:{effort:BIe(d)?d:null}})});t({type:"configStatus",config:p})}catch(p){r(p instanceof Error?p.message:l("settings.newBotEffort.error"))}finally{i(!1)}}};return n.jsx(Wt,{title:l("settings.newBotEffort.title"),subtitle:l("settings.newBotEffort.subtitle"),message:s?n.jsx("p",{role:"alert",className:"text-danger",children:s}):null,children:n.jsxs("select",{value:a,disabled:o,"aria-label":l("settings.newBotEffort.aria"),onChange:d=>{c(d.target.value)},className:"min-h-8 w-full max-w-[240px] rounded-lg border border-hairline/40 bg-inset px-2.5 py-1.5 text-[13px] text-ink focus:border-focus disabled:cursor-wait disabled:opacity-50",children:[n.jsx("option",{value:"",children:l("settings.newBotEffort.default")}),PH.map(d=>n.jsx("option",{value:d,children:wl(d)},d))]})})}function MTe(){const{state:e,dispatch:t}=ve(),[a,o]=f.useState(!1),[i,s]=f.useState(!1);return n.jsxs("div",{children:[n.jsx("button",{disabled:a,onClick:()=>{o(!0),s(!1),X("/api/config",{method:"PUT",body:JSON.stringify({onboarding:{...e.config?.onboarding?.completedAt?{}:L4().onboarding,hintsSeen:ffe(e.config?.onboarding)}}),signal:AbortSignal.timeout(1e4)}).then(r=>{t({type:"configStatus",config:r}),t({type:"toggleTour",open:!0})}).catch(()=>s(!0)).finally(()=>o(!1))},className:"ui-button",children:l("settings.welcome.appTour")}),i&&n.jsx("p",{role:"alert",className:"mt-2 text-[13px] text-danger",children:l("onboarding.tour.error")})]})}function ITe(){const{dispatch:e}=ve();return n.jsx(Wt,{title:l("settings.welcome.title"),subtitle:l("settings.welcome.subtitle"),children:n.jsxs("div",{className:"flex flex-wrap gap-2",children:[n.jsx(MTe,{}),n.jsx("button",{onClick:()=>e({type:"toggleWelcome",open:!0}),className:"ui-button",children:l("settings.welcome.replay")})]})})}function PTe(){const{state:e,dispatch:t}=ve(),a=e.config?.language??"",[o,i]=f.useState(!1),[s,r]=f.useState(""),c=async d=>{if(!o){i(!0),r("");try{const p=await X("/api/config",{method:"PATCH",body:JSON.stringify({language:d})});t({type:"configStatus",config:p})}catch(p){r(p instanceof Error?p.message:l("settings.language.error"))}finally{i(!1)}}};return n.jsx(Wt,{title:l("settings.language.title"),subtitle:l("settings.language.subtitle"),message:s?n.jsx("p",{role:"alert",className:"text-danger",children:s}):null,children:n.jsxs("select",{value:a,disabled:o,"aria-label":l("settings.language.aria"),onChange:d=>{c(d.target.value)},className:"min-h-8 w-full max-w-[240px] rounded-lg border border-hairline/40 bg-inset px-2.5 py-1.5 text-[13px] text-ink focus:border-focus disabled:cursor-wait disabled:opacity-50",children:[n.jsx("option",{value:"",children:l("settings.language.system")}),oQ.map(({code:d,label:p})=>n.jsx("option",{value:d,children:p},d))]})})}function TTe(){const e=Tr();return n.jsx(Wt,{title:l("settings.threadDisplay.title"),subtitle:l("settings.threadDisplay.subtitle"),children:n.jsx(Dt,{checked:e,"aria-label":l("settings.threadDisplay.show"),onClick:()=>i0e(!e)})})}function BTe(){const{state:e,dispatch:t}=ve(),a=pS(e.config),[o,i]=f.useState(!1),[s,r]=f.useState(""),c=async()=>{if(!o){i(!0),r("");try{const d=await X("/api/config",{method:"PATCH",body:JSON.stringify({features:{showToolCalls:!a}})});t({type:"configStatus",config:d})}catch(d){r(d instanceof Error?d.message:l("settings.toolCalls.error"))}finally{i(!1)}}};return n.jsx(Wt,{title:l("settings.toolCalls.title"),subtitle:n.jsxs(n.Fragment,{children:[l("settings.toolCalls.subtitle")," ",l("settings.toolCalls.detail")]}),message:s?n.jsx("p",{role:"alert",className:"text-danger",children:s}):null,children:n.jsx(Dt,{checked:a,"aria-label":l("settings.toolCalls.aria"),disabled:o,onClick:()=>{c()},className:"disabled:cursor-wait disabled:opacity-50"})})}function ETe({remoteActive:e}){const{state:t,dispatch:a}=ve(),o=ph(t.config),i=t.config?.godMode?.available!==!1,s=!e&&!!window.ogb?.approvals?.setGodMode,[r,c]=f.useState(!1),[d,p]=f.useState(!1),[h,g]=f.useState(""),b=async v=>{if(!d){c(!1),p(!0),g("");try{a({type:"configStatus",config:await WQ(v)})}catch(k){g(k instanceof Error?k.message:l("settings.godMode.error"))}finally{p(!1)}}},x=l(i?!o&&!s?"settings.godMode.desktopOnly":o?"settings.godMode.on":"settings.godMode.off":"settings.godMode.unavailable");return n.jsxs(ut,{title:l("settings.godMode.title"),subtitle:l("settings.godMode.subtitle"),children:[n.jsxs("div",{className:"flex items-center justify-between gap-4",children:[n.jsx("div",{className:V("min-w-0 text-[12px] leading-relaxed",o?"text-danger":"text-ink-secondary"),children:x}),n.jsx(Dt,{checked:o,"aria-label":l("settings.godMode.aria"),disabled:d||!o&&(!i||!s),onClick:()=>o?void b(!1):c(!0),className:V("disabled:cursor-not-allowed disabled:opacity-50",o&&"bg-danger")})]}),h?n.jsx("p",{role:"alert",className:"mt-2 text-[12px] text-danger",children:h}):null,n.jsx(I0,{open:r,scope:"workspace",onCancel:()=>c(!1),onConfirm:()=>{b(!0)}})]})}function RTe(){const{state:e,dispatch:t}=ve(),a=M0(e.config),o=Uc(e.config),i=A0(e.config),s=e.config?.browserEngine?.installable===!0,r=window.ogb?.platform==="win32"&&!i&&!s,[c,d]=f.useState(null),[p,h]=f.useState(""),g=async(b,x)=>{if(!c){d(b),h("");try{const v=await X("/api/config",{method:"PATCH",body:JSON.stringify({features:{[b]:x}})});t({type:"configStatus",config:v})}catch(v){h(v instanceof Error?v.message:l("settings.experimental.error"))}finally{d(null)}}};return n.jsxs(ut,{title:l("settings.experimental.title"),subtitle:l("settings.experimental.subtitle"),children:[n.jsxs("div",{className:"flex items-center justify-between gap-4",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("div",{className:"text-[14px] font-medium text-ink",children:l("settings.experimental.skillAuthoring")}),n.jsx("div",{className:"mt-0.5 text-[12px] leading-relaxed text-ink-secondary",children:l("settings.experimental.skillAuthoringDetail")})]}),n.jsx(Dt,{checked:a,"aria-label":l("settings.experimental.skillAuthoringAria"),disabled:c!==null,onClick:()=>{g("skillAuthoring",!a)},className:"disabled:cursor-wait disabled:opacity-50"})]}),n.jsxs("div",{className:"mt-4 flex items-center justify-between gap-4 border-t border-hairline/30 pt-4",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("div",{className:"text-[14px] font-medium text-ink",children:l("settings.experimental.browser")}),n.jsx("div",{className:"mt-0.5 text-[12px] leading-relaxed text-ink-secondary",children:i?l(o?"settings.experimental.browserOn":"settings.experimental.browserOff"):r?l("settings.experimental.browserWindows"):Ag(e.config)})]}),n.jsx(Dt,{checked:o,"aria-label":l("settings.experimental.browserAria"),disabled:c!==null||!o&&!i&&!s,onClick:()=>{g("browser",!o)},className:"disabled:cursor-wait disabled:opacity-50"})]}),p?n.jsx("p",{role:"alert",className:"mt-2 text-[12px] text-danger",children:p}):null]})}function DTe(){const{state:e}=ve(),t=e.config?.browserProfiles??[];return!Uc(e.config)&&t.length===0?null:n.jsx(ut,{title:l("settings.profiles.title"),subtitle:l("settings.profiles.sharedSubtitle"),children:n.jsx(pH,{})})}function OTe(){const[e,t]=f.useState(!1),[a,o]=f.useState(null),i=async()=>{if(!(!window.ogb?.exportDiagnostics||e)){t(!0),o(null);try{const s=await window.ogb.exportDiagnostics();s&&o({kind:"success",message:l("settings.diagnostics.saved",{path:s})})}catch(s){o({kind:"error",message:s instanceof Error?s.message:String(s)})}finally{t(!1)}}};return n.jsx(Wt,{title:l("settings.diagnostics.title"),subtitle:l("settings.diagnostics.subtitle"),message:a?n.jsx("p",{role:a.kind==="error"?"alert":"status",className:V("break-all",a.kind==="error"?"text-danger":"text-success"),children:a.message}):null,children:n.jsx("button",{onClick:()=>{i()},disabled:e,"aria-label":l("settings.diagnostics.aria"),className:"ui-button",children:l(e?"settings.diagnostics.exporting":"settings.diagnostics.export")})})}function zTe(){return iC()?n.jsx(Wt,{title:l("settings.feedback.title"),subtitle:l("settings.feedback.subtitle"),children:n.jsx("button",{onClick:()=>Dg("idea"),className:"ui-button",children:l("settings.feedback.button")})}):null}const cB={general:k4,marketplace:s0,personalBot:v4,ai:So,devices:XB,projects:a0,admin:RB,experimental:LB},LTe=new Set(["companion","appearance","desktopWorkspaces","marketplace","mcpServers"]);function FTe(){return n.jsxs(n.Fragment,{children:[n.jsx(ut,{title:l("settings.aiProviders.keysTitle"),subtitle:l("settings.aiProviders.keysSubtitle"),children:n.jsxs("div",{className:"flex flex-col gap-4",children:[n.jsx("div",{className:"text-[11.5px] font-medium uppercase tracking-wide text-ink-secondary",children:l("keys.providers.title")}),n.jsx("p",{className:"-mt-3 text-[12px] leading-relaxed text-ink-secondary",children:l("keys.providers.subtitle")}),n.jsx(kte,{billing:"payPerUse"})]})}),n.jsx(bMe,{})]})}function dB(e){const t=mg.find(a=>a.id===e.id);return t&&t.tabs.length>1?e.tabs[0].labelKey:e.labelKey}function _Te(){const{state:e,dispatch:t}=ve(),a=window.ogb?.remoteClient?.active===!0,o=f.useRef(null),[i,s]=f.useState("");f.useEffect(()=>window.ogb?.environments?.onOpenSettings?.(()=>s("")),[]),f.useEffect(()=>window.ogb?.onOpenAppSettings?.(()=>s("")),[]);const r=i.trim().toLowerCase(),c=Gl(),d=M=>t({type:"toggleAppSettings",open:!0,section:M}),p=M=>{if(a&&!LTe.has(M))return!1;switch(M){case"desktopWorkspaces":return!!window.ogb?.environments;case"organization":return!!window.ogb?.organization&&!a;case"workspaces":return BH(e.config);case"people":return!window.ogb;case"assistants":return!!window.ogb;case"activity":return!window.ogb&&c===!0;case"setup":return c!==!1;case"personalBot":return c!==!1;case"memory":return c!==!1;case"watchAlong":return e.config?.watchAlong?.access===!0;default:return!0}},h=mg.map(M=>({...M,tabs:M.tabs.filter(D=>p(D.id))})).filter(M=>M.tabs.length>0),g=h.map(M=>({...M,tabs:M.tabs.filter(D=>TIe(M,D,r,l))})).filter(M=>M.tabs.length>0),b=M6(e.appSettingsSection),x=h.find(M=>M.id===PIe(b).id),v=h.some(M=>M.tabs.some(D=>D.id===b))?b:x?.tabs[0]?.id??(a?"companion":h[0]?.tabs[0]?.id??"general"),k=h.find(M=>M.tabs.some(D=>D.id===v))??h[0],S=k?cB[k.id]:k4,N=g.flatMap(M=>M.tabs),C=r&&!N.some(M=>M.id===v)?N[0]?.id:void 0,j=k?.id==="ai"||k?.id==="marketplace";return f.useEffect(()=>{C&&t({type:"toggleAppSettings",open:!0,section:C})},[t,C]),f.useEffect(()=>{const M=document.activeElement instanceof HTMLElement?document.activeElement:null,D=o.current,A=STe(D),R=D?.querySelector("[data-settings-search]");R?.checkVisibility()?R.focus():D?.focus();const P=O=>{if(O.defaultPrevented||D&&[...D.querySelectorAll('[role="dialog"], [role="alertdialog"]')].some(G=>G.getClientRects().length))return;if(O.key==="Escape"){O.preventDefault(),t({type:"toggleAppSettings",open:!1});return}if(O.key!=="Tab"||!D)return;const T=Array.from(D.querySelectorAll('button:not([disabled]), a[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), summary, [tabindex]:not([tabindex="-1"])')).filter(G=>G.checkVisibility()&&G.tabIndex!==-1);if(T.length===0){O.preventDefault(),D.focus();return}const z=T[0],B=T[T.length-1],L=document.activeElement;O.shiftKey&&(L===z||!D.contains(L))?(O.preventDefault(),B.focus()):!O.shiftKey&&L===B&&(O.preventDefault(),z.focus())};return window.addEventListener("keydown",P),()=>{window.removeEventListener("keydown",P),A(),M?.focus()}},[t]),n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-3 sm:p-6",onMouseDown:M=>M.target===M.currentTarget&&t({type:"toggleAppSettings",open:!1}),children:n.jsxs("div",{ref:o,role:"dialog","aria-modal":"true","aria-labelledby":"app-settings-title",tabIndex:-1,className:V("flex max-h-[calc(100dvh-24px)] w-full overflow-hidden rounded-2xl border border-hairline/50 bg-panel shadow-2xl outline-none",j?"h-[720px] max-w-[1040px]":"h-[600px] max-w-[880px]"),children:[n.jsx("span",{id:"app-settings-title",className:"sr-only",children:l("settings.title")}),n.jsxs("nav",{"aria-label":l("settings.title"),className:"hidden min-h-0 w-[200px] shrink-0 flex-col gap-1 overflow-y-auto border-r border-hairline/40 bg-app/30 p-3 backdrop-blur-xl sm:flex",children:[n.jsx("div",{className:"shrink-0 px-2 py-3 text-[15px] font-semibold text-ink",children:l("settings.title")}),n.jsxs("div",{className:"mb-2 mt-1 flex min-h-8 shrink-0 items-center gap-2 rounded-lg border border-transparent bg-control/70 px-2.5 py-2 focus-within:border-focus",children:[n.jsx(za,{size:14,className:"shrink-0 text-ink-secondary"}),n.jsx("input",{"data-settings-search":!0,value:i,onChange:M=>s(M.target.value),onKeyDown:M=>{M.key==="Escape"&&(M.stopPropagation(),i?s(""):t({type:"toggleAppSettings",open:!1}))},placeholder:l("settings.search"),"aria-label":l("settings.searchAria"),className:"w-full bg-transparent text-[13px] text-ink placeholder:text-ink-secondary focus:outline-none"})]}),g.length===0&&n.jsx("div",{className:"px-2.5 py-4 text-[12.5px] leading-relaxed text-ink-secondary",children:l("settings.noMatch",{query:i.trim()})}),g.map(M=>{const D=cB[M.id],A=M.id===k?.id,R=M.id==="marketplace",P=!!r&&h.find(O=>O.id===M.id).tabs.length>1;return n.jsxs("div",{className:"flex flex-col gap-0.5",children:[n.jsxs("button",{"data-settings-group":M.id,onClick:()=>d(M.tabs[0].id),"aria-current":A?"page":void 0,className:V("flex min-h-9 items-center gap-2.5 rounded-lg px-2.5 py-2 text-left text-[13px] transition-colors motion-reduce:transition-none",A?"bg-control text-ink":"text-ink-secondary hover:bg-control/50 hover:text-ink",R&&!A&&"text-ink"),children:[n.jsx(D,{size:15,className:V("shrink-0",R&&"text-accent")}),n.jsx("span",{className:"min-w-0 flex-1 leading-snug",children:l(M.labelKey)})]}),P&&M.tabs.map(O=>n.jsx("button",{onClick:()=>d(O.id),"aria-current":v===O.id?"true":void 0,className:V("ml-7 rounded-md px-2 py-1 text-left text-[12px] transition-colors motion-reduce:transition-none",v===O.id?"bg-control/70 text-ink":"text-ink-secondary hover:text-ink"),children:l(O.labelKey)},O.id))]},M.id)})]}),n.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[n.jsxs("div",{className:"flex shrink-0 flex-col gap-3 border-b border-hairline/30 px-3 py-3 sm:px-5",children:[n.jsxs("div",{className:"flex items-center justify-between gap-3",children:[n.jsx("select",{"aria-label":l("settings.title"),value:v,onChange:M=>{s(""),d(M.target.value)},className:"min-w-0 flex-1 rounded-lg bg-control px-3 py-2 text-[14px] text-ink sm:hidden",children:h.map(M=>M.tabs.length===1?n.jsx("option",{value:M.tabs[0].id,children:l(dB(M))},M.id):n.jsx("optgroup",{label:l(M.labelKey),children:M.tabs.map(D=>n.jsx("option",{value:D.id,children:l(D.labelKey)},D.id))},M.id))}),n.jsxs("span",{className:"hidden min-w-0 items-center gap-2 text-[15px] font-semibold text-ink sm:flex",children:[n.jsx(S,{size:16,className:V("shrink-0",k?.id==="marketplace"?"text-accent":"text-ink-secondary")}),n.jsx("span",{className:"truncate",children:k?l(k.tabs.length===1?dB(k):k.labelKey):null})]}),n.jsx("button",{onClick:()=>t({type:"toggleAppSettings",open:!1}),"aria-label":l("settings.close"),title:`${l("settings.close")} (${NF("close-panel")})`,className:"ui-icon-button shrink-0",children:n.jsx(Nt,{size:18})})]}),k&&k.tabs.length>1&&n.jsx("div",{className:"hidden sm:block",children:n.jsx(cte,{label:l(k.labelKey),tabs:k.tabs.map(M=>({id:M.id,label:l(M.labelKey)})),value:v,onChange:d})})]}),n.jsxs("div",{role:k&&k.tabs.length>1?"tabpanel":void 0,"aria-label":VT(v)?l(VT(v).labelKey):void 0,"data-settings-tab":v,"data-tour":v==="marketplace"?"apps-panel":void 0,className:"flex flex-1 flex-col gap-4 overflow-y-auto px-3 py-4 sm:px-5 sm:pb-5",children:[n.jsx(GIe,{config:e.config}),v==="general"&&n.jsxs(n.Fragment,{children:[n.jsx(ETe,{remoteActive:a}),n.jsx(ut,{title:l("settings.profile.title"),subtitle:l("settings.profile.sharedSubtitle"),children:n.jsx(CTe,{})}),!a&&n.jsx(SPe,{}),n.jsx(G9e,{}),n.jsx(NPe,{}),n.jsx(MPe,{}),n.jsxs("div",{children:[n.jsx(PTe,{}),n.jsx(vMe,{}),!a&&n.jsx(ITe,{}),n.jsx(NTe,{}),n.jsx(OTe,{}),n.jsx(zTe,{})]})]}),v==="appearance"&&n.jsxs(n.Fragment,{children:[n.jsx(ut,{title:l("settings.skin.title"),subtitle:l("settings.skin.subtitle"),children:n.jsx(nPe,{})}),n.jsxs("div",{children:[n.jsx(TTe,{}),!a&&n.jsx(BTe,{})]})]}),v==="botDefaults"&&n.jsxs(n.Fragment,{children:[n.jsx(hPe,{}),n.jsxs("div",{children:[n.jsx(ATe,{}),n.jsx(Yhe,{})]}),n.jsx(ut,{title:l("settings.roomTurns.title"),subtitle:l("settings.roomTurns.subtitle"),children:n.jsx(oPe,{})}),n.jsx(APe,{}),n.jsx(TPe,{})]}),v==="setup"&&n.jsx(VPe,{}),v==="clipboard"&&n.jsx(WPe,{}),v==="dictation"&&n.jsx(iTe,{}),v==="voice"&&n.jsx(fPe,{}),v==="watchAlong"&&n.jsx(bTe,{}),v==="marketplace"&&n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"text-[13px] leading-relaxed text-ink-secondary",children:l("settings.marketplace.intro")}),n.jsx(uH,{embedded:!0,onOpenMcp:()=>d("mcpServers")})]}),v==="mcpServers"&&n.jsx(cH,{embedded:!0}),v==="addons"&&n.jsx(cme,{}),v==="personalBot"&&n.jsx(Cre,{}),v==="memory"&&n.jsx(yPe,{}),v==="engines"&&n.jsxs(n.Fragment,{children:[n.jsx(fMe,{}),n.jsx(Ele,{})]}),v==="connections"&&n.jsx(FTe,{}),v==="engineTiers"&&n.jsx(Qpe,{}),v==="accounts"&&n.jsx(ile,{}),v==="vault"&&n.jsx(KPe,{}),v==="assistants"&&n.jsx(XMe,{}),v==="companion"&&n.jsxs(n.Fragment,{children:[n.jsx(xIe,{}),!a&&n.jsx(bIe,{}),n.jsx(UMe,{phonePairingBelow:!a}),!a&&n.jsx(ZMe,{profileEmail:e.config?.profile?.email})]}),v==="computer"&&n.jsxs(n.Fragment,{children:[n.jsx(ut,{title:l("settings.computers.hosted"),subtitle:l("settings.computers.hostedSubtitle"),children:n.jsxs("div",{className:"flex flex-col gap-4",children:[n.jsx(Sg,{section:"box"}),n.jsx(wte,{})]})}),n.jsx(FMe,{})]}),v==="repos"&&n.jsx(fue,{}),v==="desktopWorkspaces"&&n.jsx(kIe,{}),v==="backups"&&n.jsxs(n.Fragment,{children:[n.jsx(EPe,{}),n.jsx(LPe,{})]}),v==="usage"&&n.jsx(VIe,{}),v==="people"&&n.jsx(sIe,{}),v==="activity"&&n.jsx(pIe,{}),v==="workspaces"&&n.jsx(YIe,{}),v==="organization"&&window.ogb?.organization&&!a&&n.jsx(MIe,{}),v==="experimental"&&n.jsxs(n.Fragment,{children:[n.jsx(RTe,{}),n.jsx(DTe,{})]})]})]})]})})}const uB="flex flex-1 items-center justify-center gap-1.5 rounded-lg bg-accent py-1.5 text-[13px] font-medium text-white transition-colors disabled:cursor-default disabled:bg-control disabled:text-ink-secondary";function pB(e){return e?/cannot find .*\.yml|404/i.test(e)?"No update has been published for this platform yet.":/ENOTFOUND|ECONNREFUSED|ETIMEDOUT|net::/i.test(e)?"Couldn't reach the update server.":e.split(`
603
- `)[0].slice(0,140):"Something went wrong."}function qTe({state:e,onOpen:t}){return n.jsxs("button",{type:"button",onClick:t,"data-update-reminder":!0,className:"animate-panel-in fixed bottom-4 left-4 z-50 flex items-center gap-1.5 rounded-full border border-accent/40 bg-panel px-3 py-1.5 text-[12.5px] font-medium text-accent shadow-lg shadow-black/30 hover:bg-control",children:[n.jsx(So,{size:13}),e.status==="downloaded"?`Restart to update${e.version?` to ${e.version}`:""}`:`Update available${e.version?`: ${e.version}`:""}`]})}function UTe(){const e=sC(),[t,a]=f.useState(null),[o,i]=f.useState(null),s=e?.status;if(f.useEffect(()=>i(null),[s]),!e||e.status==="idle"||e.status==="checking")return null;const r=`${e.status}:${e.version??""}`;if(t===r)return e.status!=="available"&&e.status!=="downloaded"?null:n.jsx(qTe,{state:e,onOpen:()=>a(null)});const c=window.ogb.updater,d=e.status==="installing",p=e.status==="preparing",h=e.status==="downloading"||p||d,g=e.installMode==="handoff",b=e.status==="available"?`${Ga().name} ${e.version} is available`:e.status==="downloading"?`Downloading ${e.version??"update"}…`:p?"Preparing update…":e.status==="downloaded"?`${e.version} is ready`:d?g?"Opening a terminal…":"Restarting to update…":e.status==="handed-off"?"Finish in a terminal":"Update failed",x=e.status==="available"?"A newer version is ready to download.":e.status==="downloading"?e.percent==null?"Starting download…":`${Math.round(e.percent)}%`:p?"Download complete. macOS is preparing the update.":e.status==="downloaded"?g?"Copy the install command and open a terminal.":"Restart to finish updating.":d?g?"Copying the command…":e.message||`${Ga().name} will reopen in a moment.`:e.status==="handed-off"?e.terminalOpened?"Command copied — paste it in the terminal that opened.":"Command copied — paste it in a terminal to finish.":e.retryable===!1?`${pB(e.message?.split(" Quit and reopen ")[0])} Quit and reopen ${Ga().name} before trying the update again.`:pB(e.message);return n.jsxs("div",{className:"animate-panel-in fixed bottom-4 left-4 z-50 w-[300px] rounded-xl border border-hairline/40 bg-panel p-3.5 shadow-2xl shadow-black/50",children:[n.jsxs("div",{className:"flex items-start gap-2.5",children:[n.jsx("span",{className:"mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-full bg-accent/15 text-accent",children:n.jsx(So,{size:14})}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"text-[13.5px] font-semibold text-ink",children:b}),n.jsx("div",{className:"mt-0.5 text-[12.5px] text-ink-secondary",title:x,children:x})]}),!h&&n.jsx("button",{onClick:()=>a(r),className:"shrink-0 rounded-md p-1 text-ink-secondary hover:bg-control hover:text-ink",title:"Dismiss",children:n.jsx(Nt,{size:14})})]}),e.status==="handed-off"&&e.command&&n.jsx("code",{className:"mt-2.5 block overflow-x-auto rounded-lg bg-control px-2 py-1.5 font-mono text-[11.5px] whitespace-pre text-ink-secondary",children:e.command}),e.status==="downloading"&&n.jsx("div",{className:"mt-2.5 h-1 overflow-hidden rounded-full bg-control",children:n.jsx("div",{className:V("h-full rounded-full bg-accent transition-[width]",e.percent==null&&"w-1/4 animate-pulse"),style:e.percent==null?void 0:{width:`${Math.min(100,Math.max(0,e.percent))}%`}})}),(p||d)&&n.jsx("div",{className:"mt-2.5 flex gap-2",children:n.jsxs("button",{disabled:!0,className:"flex flex-1 items-center justify-center gap-1.5 rounded-lg bg-control py-1.5 text-[13px] font-medium text-ink-secondary",children:[n.jsx(Ie,{size:13,className:"animate-spin"})," ",p?"Preparing…":g?"Opening…":"Restarting…"]})}),!h&&n.jsxs("div",{className:"mt-2.5 flex gap-2",children:[e.status==="available"&&n.jsx("button",{onClick:()=>{i("download"),c.download()},disabled:o!==null,className:uB,children:o==="download"?n.jsxs(n.Fragment,{children:[n.jsx(Ie,{size:13,className:"animate-spin"})," Starting…"]}):n.jsxs(n.Fragment,{children:[n.jsx(MB,{size:13})," Download"]})}),e.status==="downloaded"&&n.jsx("button",{onClick:()=>{i("install"),c.install()},disabled:o!==null,className:uB,children:o==="install"?n.jsxs(n.Fragment,{children:[n.jsx(Ie,{size:13,className:"animate-spin"})," ",g?"Opening…":"Restarting…"]}):g?n.jsxs(n.Fragment,{children:[n.jsx(XJ,{size:13})," Install"]}):n.jsxs(n.Fragment,{children:[n.jsx(fn,{size:13})," Restart to update"]})}),e.status==="error"&&e.retryable!==!1&&n.jsx("button",{onClick:()=>{i("check"),c.check()},disabled:o!==null,className:"flex flex-1 items-center justify-center gap-1.5 rounded-lg bg-control py-1.5 text-[13px] text-ink hover:bg-raised-hover disabled:text-ink-secondary disabled:hover:bg-control",children:o==="check"?n.jsxs(n.Fragment,{children:[n.jsx(Ie,{size:13,className:"animate-spin"})," Checking…"]}):"Try again"}),n.jsx("button",{onClick:()=>a(r),disabled:o!==null,className:"rounded-lg px-3 py-1.5 text-[13px] text-ink-secondary hover:bg-control hover:text-ink disabled:opacity-50 disabled:hover:bg-transparent",children:e.status==="handed-off"||e.retryable===!1?"Dismiss":"Later"})]})]})}const VTe=JSON.parse(`[{"version":"0.1.176","added":["On iPhone and iPad, the model menu in a chat now has Choose a model. It lists every provider your subscriptions and API keys give you, with each provider's models and reasoning effort, and pins your pick to that thread."],"fixed":["On iPhone and iPad, the model menu in a chat no longer jumps back to the top while you scroll it. The model classes and the modes now open as their own short lists."]},{"version":"0.1.175","added":["Settings > Vault can import the logins you export from a password manager as a CSV file. Exports from Chrome, Edge, Safari, Firefox, 1Password, Bitwarden, LastPass, Dashlane, Proton Pass, NordPass and RoboForm all work.","About me now stays in step across Atomic, your PAW workspace and Nexus. A change in one place reaches the others, and if two places disagree, Settings > About me lets you pick which version to keep."],"fixed":["Dictation in the chat box works again after you use system-wide dictation. Since 0.1.174 the system-wide dictation kept the microphone in its echo-cancelling mode, so the chat box heard almost nothing.","When dictation hears nothing, Atomic now says so instead of asking you to check your Microphone and Speech Recognition permissions. A refused microphone is named as soon as dictation starts."]},{"version":"0.1.174","added":["Bots can now read, change and cancel existing Google and Outlook calendar events: title, description, location, time, guests and room, for one occurrence, this and following, or a whole recurring series. Changes that email guests ask for your approval first."],"fixed":["Claude no longer fails on every message on Macs with an older Claude Code. Atomic was passing it an option that only newer versions understand.","Dictation no longer types words you did not say. The microphone now filters out sound from your own speakers, such as Atomic reading aloud, a call or a video.","A dictation started with the shortcut now stops on its own after 20 seconds of silence, and after 10 minutes at most, so a take left running cannot pick up the room.","Words heard while you were in another app are no longer typed in a burst when you come back. They go on the clipboard, so you can paste them if they are yours.","Auto-correct can no longer add words to your dictation, and words the speech engine is unsure of are left out."]},{"version":"0.1.173","added":["Back up and restore your whole Atomic setup to another Mac (Settings), encrypted by default.","When you control This Mac from an iPhone or iPad, taps, touch and hold, drags and scrolls now reach the Mac. This is the desktop side of phone pointer control.","Settings > Engines and tiers can include free models in Auto. It is off by default, free models are tried only after your subscriptions and keys, and a bot marked as handling client data never uses them.","On iPhone and iPad, Atomic opens on the device you used last, either the iPhone or a computer. If that computer is no longer paired, it opens on the iPhone.","On iPhone and iPad, Home shows an icon for the iPhone and each connected computer. Tap one to switch to it, or touch and hold it to rename it. Names are saved on the phone only."],"fixed":["A task handed to a teammate whose working folder is busy now waits in the queue instead of failing right away.","New installs: Chibi logs every feature request you mention as a Mochii task. Existing Chibis keep their own instructions."]},{"version":"0.1.172","added":["On iPhone and iPad, touch and hold a link in a bot's reply to open it in your default browser or copy it. A normal tap works as before.","On iPhone and iPad, touch and hold a word in a bot's reply to select just that part, drag the handles to expand it, then copy, look up or share it.","On iPhone and iPad, pinch to zoom a computer screen from 1x to 8x, drag to pan, and double-tap to zoom in or back out. It works on a bot's computer and on This Mac.","On iPhone and iPad, when you are controlling This Mac, a tap clicks instantly, touch and hold right-clicks, touch and hold then drag moves things, and swiping scrolls. The Mac must run a desktop Atomic update that includes phone pointer control.","On iPhone and iPad, type / in a bot chat and pick /goal to give the bot an objective it keeps working on until it is done. /goal status, pause, resume and stop control it."],"fixed":["On iPhone and iPad, the mode menu works again: Ask, Auto edits, God Mode and Plan can be read and changed from a paired phone. Changes still need an Administrator's paired device, and every mode above Ask asks you to confirm.","On iPhone and iPad, a bot's question with three or more answers, or long ones, shows each answer as its own full-width button instead of squeezing them into one row (TestFlight build 69).","Tools from Atomic Engine no longer go missing when two copies of its tool lookup start at once.","The Linux downloads list shows a new release right away instead of an older cached copy."]},{"version":"0.1.171","added":["On iPhone and iPad, open a bot's computer view and tap Control this Mac to watch this Mac's screen. Take control, confirmed with Face ID, lets you tap, scroll and type on the Mac while the bot's computer use is paused.","/skills and /skill commands in the composer list a bot's skills and run one on a task.","On iPhone and iPad, skills and remote MCP servers can be added, edited and removed for chats that run on the phone. Servers that need a sign-in open it in the browser, and every tool call asks for approval with Face ID or passcode.","Chat links to saved deliverables in shared folders open from any conversation you can see. Settings > General sets which folders are shared."],"improved":["On iPhone and iPad, typing and streaming replies no longer redraw the whole chat, so the composer stays steady and the app feels faster.","On iPhone and iPad, AI & accounts is in Settings and works without pairing a computer. Provider sign-up links go to the right pages.","From a paired iPhone or iPad you can pin and unpin bots and rooms and add Marketplace apps. A phone can only change the pin on a bot or room, nothing else."],"fixed":["Subscription bots fall back to the next model in the same class when the top model is resting after a usage limit, instead of reporting nothing ready.","On iPhone and iPad, mode controls reload after a reconnect, offer a retry, and say why they are unavailable.","On iPhone and iPad, the workspace opens even when one saved item cannot be read, and its + menu offers New thread."]},{"version":"0.1.170","added":["Plan mode keeps a bot to reading and planning until you approve the plan. It is enforced for Claude, Atomic Engine and the shared chat tools, and it holds through reconnects.","On iPhone and iPad, you can choose each bot's work mode from the model picker."],"improved":["The Most Current button takes you to the newest message in a conversation.","The bot list on iPhone and iPad loads faster."],"fixed":["Unread indicators clear when an open conversation is restored after a reload or reconnect. Pending approvals still require your response.","On iPhone and iPad, every approval prompt asks for Face ID or Touch ID before your answer is sent."]},{"version":"0.1.169","improved":["Desktop conversations show the active approval mode as a readable label beside its icon. Select the label to review or change the conversation’s permission level."]},{"version":"0.1.168","added":["Offline Atomic handbook with platform differences, setup, dictation, backups and troubleshooting. Open Help Center or About on desktop, or Settings on mobile."],"improved":["Desktop update safeguards retain dictation preferences and refuse to overwrite unreadable settings. Stopped Local VM disks are kept; existing images still require manual recovery before recreation.","Desktop clipboard picker shows a compact recent list and a full preview before pasting. Settings below the list opens Clipboard in the main Settings popup."],"fixed":["Desktop dictation Names and words no longer loses unsaved text when status refreshes. Failed saves keep your draft for retry."]},{"version":"0.1.167","fixed":["Windows: the helper that lets bots use your computer is now signed by Chibitek Inc. too, so every program Atomic installs carries Chibitek's or its maker's signature. 0.1.164 to 0.1.166 were never released."]},{"version":"0.1.166","added":["Early access: Atomic can connect to Addigy's hosted MCP server. When a bot asks Addigy to change something, you get a card to confirm or decline first. Signing in to Addigy this way has not been verified yet."]},{"version":"0.1.165","fixed":["Windows: the uninstaller is signed by Chibitek Inc. again. 0.1.164 was never released."],"improved":["iPhone and iPad build 57: the on-device model can stay loaded between messages, with a setting for where it runs. Speed gains have not been measured on an iPhone yet.","iPhone and iPad build 56: desktop conversation updates are grouped into 50 ms batches to reduce redraws. Notification pictures no longer hold up streaming replies.","The desktop companion compresses startup snapshots with gzip. This requires a desktop build containing the latency fix; the iPhone update alone does not enable compression."]},{"version":"0.1.164","added":["Early access: bots can ask you to enter a key for a secure MCP connection, such as Addigy, on a protected card. The key is saved in Atomic's encrypted store and never appears in chat. Signing in to Addigy this way has not been verified yet."],"fixed":["The Vault opens again after you restart Atomic.","Windows: every program in the installer, including the one that builds the uninstaller, is signed by Chibitek Inc. before it runs."],"improved":["Setup welcomes you by name with your company's logo when you sign in with Chibitek.","Bots on different teams now message each other through their team's Chief of Staff."]},{"version":"0.1.163","fixed":["Dictation on iPhone, iPad and Mac keeps earlier sentences and avoids repeating completed phrases. On iPhone and iPad, listening continues when the recognizer starts a new session. Please test a two-minute dictation with pauses and intentional repeated phrases."],"improved":["Windows: Qwen is turned off for now while its installer is unreliable from here. It still works on macOS and Linux, and any Qwen setup you saved is kept."]},{"version":"0.1.162","added":["Clipboard history on macOS and Windows.","Setup asks what you do and suggests starter bots that fit your work.","Each routine now has a private Mochii task that stays in sync."],"fixed":["Mac dictation keeps earlier lines instead of starting over, and stops listening when you send."]},{"version":"0.1.161","fixed":["Recover from an Antigravity checkpoint error on your next message while keeping your conversation history. Failed requests are not automatically repeated."]},{"version":"0.1.160","added":["Model details shows which model actually answered each turn, with history and counts."],"improved":["Attachments no longer stop at 512 MB. Uploads are refused only when your disk is nearly full, and nothing is deleted automatically."]},{"version":"0.1.159","added":["React to messages on iPhone with emoji, including skin-tone choices.","Choose the Panes mascot body."],"improved":["Expand the iPhone message composer into a half-height sheet.","Generate bot avatars with an eligible signed-in Codex subscription, without entering an API key.","API image generation is an explicit choice. A failed subscription never silently switches to API billing."]},{"version":"0.1.158","added":["When a company subscription bot's provider can't answer, that one conversation keeps going on the same class from another provider for up to 50 turns, with a handoff you can download or pass to another bot.","Vault in Settings keeps saved logins, cards and contacts encrypted on this computer, with search, categories and add, edit and remove.","Dictate into Brain dump.","A quiet banner says when a turn switched engines and when the first one resets. You can turn it off in Settings."],"improved":["A turn tries at most two engines, then stops with one plain line saying what to fix.","Local VM uses only Colima on the Mac and never opens Docker Desktop."],"fixed":["The terminal app picks a free port when its usual one is busy."]},{"version":"0.1.157","added":["Personal goals with pause, resume, completion criteria and token limits, available in chat and the chibi CLI.","Open-model setup on Windows and Linux, with Ollama Cloud models in the picker.","iPhone shows what changed after an update.","Import a Markdown skill file with the file picker, then review and enable it."],"fixed":["Waiting bots no longer look selected when another conversation is open.","Expired Claude sign-ins use an eligible fallback instead of stopping at the final error."]},{"version":"0.1.156","added":["Brain dump: paste a list of tasks, press Sort into tasks, and each line gets a suggested bot from your own roster. Nothing is sent until you press Send on a row.","Personal goals: type /goal followed by an objective in a one-to-one chat and the bot keeps working across turns until it's done, needs you, or hits a limit. /goal status, pause, resume and stop control it; the same commands work from the terminal."],"improved":["Default model ladders and class floors are tuned for better results out of the box.","The Settings dialog can be resized and remembers its size. View > Zoom now scales just the Settings dialog while it's open, and the whole window otherwise.","An approval request now goes to whichever device you're actually using (desktop or phone), and Face ID or your passcode is required to approve it on iPhone and iPad, so work doesn't stall waiting for a Mac you've stepped away from."],"fixed":["The sidebar no longer highlights the wrong bot's conversation."]},{"version":"0.1.155","improved":["A bot keeps working when one of its tools is down. If a tool server (an MCP server) will not start, times out or stops during a turn, Atomic leaves only that server's tools out, tells the bot in one line which server is missing, and tries it again on a later turn. The rest of the turn runs as normal.","When a tool server fails, Chibi gets one quiet Team incident naming the server, the same way a model fallback is reported. Raw startup errors never reach your chat."],"fixed":["On the Codex engine, a custom tool server that tried to set a protected environment variable used to end the whole turn. Atomic now skips just that server and logs it once."]},{"version":"0.1.154","added":["Pinned bots can be put in any order: drag them in the sidebar (or use Alt with the arrow keys, or Move left / Move right in a tile's menu). On iPhone and iPad 1.0.1 (50), long-press a pinned bot to move it.","Connect one Atomic desktop to another over Tailscale. On the other computer, open Settings > Devices & remote access > Remote access > Pair over Tailscale and copy the link; paste it on this computer under Connect to another computer."],"improved":["Accounts marked Personal and your subscriptions can now be used by company bots as well as your Private Bot. Company or Personal only says who owns the account.","Your Private Bot works through Chibi: it hands work for other bots to Chibi and never creates bots itself.","Atomic's bots use only Chibitek Nexus, PAW and Omi for memory. Other memory add-ons for Hermes stay switched off."],"fixed":["Claude accounts that have no sign-in of their own no longer show as signed in. They used to borrow an old, expired Anthropic login, which made bots answer \\"Login expired\\". Sign in to each account you want to use.","When Hermes answers \\"Login expired\\", the turn now moves to the next engine in the bot's class.","A chat pinned to an Ollama model no longer jumps to another Claude account when one account hits its limit.","The Private Bot's subscription list no longer says \\"None yet\\" when you have subscriptions."]},{"version":"0.1.153","added":["Team Rooms are on. Sign in with Chibitek in Settings > General > Basics, then open Tools > Team Rooms to start a room or join one with a link."],"improved":["One broken MCP server no longer stops a bot. Atomic sets that server aside for a while and the bot keeps working with its other tools; Settings shows which server is failing."],"fixed":["When Claude says \\"Login expired\\", or answers with a connection error, the turn now moves to the next engine in the bot's class instead of showing that message as the reply.","When a provider cannot be reached, API engines, Muse Code and Apple Intelligence now hand the turn to the next engine instead of stopping.","Marking a \\"Ready for you\\" result as reviewed now works from the iPhone app. Before, the phone showed a \\"no route\\" error.","Bots that Atomic runs now use only Atomic's own memory, not memory left over from other tools on the same Mac.","Pairing help in Settings now points to Remote access instead of a command that could not be installed."]},{"version":"0.1.152","added":["Sign in with Chibitek in Settings > General > Basics. It signs you in through your browser with your Chibitek Google or Microsoft account, and Team Rooms use it to know who you are."],"fixed":["\\"Always allow this session\\" on a Claude bot now really lasts for the session. Atomic remembers it and stops asking again for the same tool, instead of showing the same permission card on the next request."]},{"version":"0.1.151","added":["Mistral Vibe is now a subscription. Le Chat Pro and Team are now Mistral's Vibe Pro and Team plans. In Settings > AI & accounts > Subscriptions, install Mistral Vibe and choose Sign in with Mistral to approve on Mistral's own page. A Mistral bot is created that uses only your Vibe plan, and Mistral Vibe joins your failover ladders. It works on Mac and Linux; on Windows, install Vibe with Mistral's instructions first.","The MiniMax M Plan (formerly the Coding Plan) is now a subscription. Paste your M Plan key (it starts with sk-cp-) on the MiniMax card in Settings > AI & accounts > Subscriptions. A MiniMax bot is created, MiniMax M3.1 Flash is added, and your plan joins your failover ladders as a subscription instead of a pay-per-use key.","The Z.ai GLM Coding Plan is now a subscription, through Hermes Agent. Z.ai lets the plan run only in the tools it lists, and Hermes is one of them. Run Hermes setup, choose Z.AI / GLM and paste your plan key. A Z.ai GLM bot is created that uses only GLM 5.3 and GLM 5.3 Flash, and those models count as part of your plan, not pay per use."],"improved":["The Perplexity card now says plainly why Pro and Max cannot be used here: they include no API credits, and the Perplexity API is billed separately.","Mistral now shows Mistral's own full-colour logo.","Atomic on ARM Linux (such as the NVIDIA DGX Spark) now gets updates from Settings > Updates. Download the update, then run the install command Atomic opens a terminal for."]},{"version":"0.1.150","added":["Watch-Along: watch a YouTube video inside Atomic with Chibi commenting as it plays. Paste a single YouTube link in a message box and choose Watch along, or use Watch a video in the sidebar's compose menu or the command palette. For now it is offered only on computers enrolled in Chibitek's organization."],"improved":["Bots in a team room now switch engines quietly when one fails. A resting or signed-out engine is skipped, and a provider error (such as an expired API key) moves the turn to the next engine instead of showing in the room."],"fixed":["On Windows, Atomic no longer jumps back to the front after you minimize it. A tool that started Atomic's program to run a script was being treated as a second launch of Atomic, which brought the window forward and stopped the script from running.","iPhone and iPad 1.0.1 (47): when a DNS filter or DNS profile (Scout DNS, for example) looks up your computer's Tailscale name through public DNS, Atomic now says so and tells you which domain to forward to Tailscale, instead of saying Phone access looks off."]},{"version":"0.1.149","improved":["The Development pack's Chibitek Developer Playbook is updated to v2026.10.23.1, with current guidance on build runners and releases."],"fixed":["Windows release checks now include the Meta Muse Code command-line tool, so Windows builds that ship Muse Code pass their checks."]},{"version":"0.1.148","added":["Meta Muse Code is now a subscription. In Settings > AI & accounts > Subscriptions, install Muse Code with Meta's installer and choose Sign in with Meta to approve with your own Meta account. A Muse Code bot is created, and Muse Code joins your failover ladders after Claude and ChatGPT. It works on Mac, Windows and Linux; on iPhone and iPad you can see its status and start the sign-in on your paired computer. Meta's use of your content for training is turned off.","Meta Muse Code and the Meta Muse API key now show Meta's official logo."]},{"version":"0.1.147","fixed":["A Hermes signed in to Nous Portal now shows as signed in under Settings > AI & accounts > Subscriptions even when another provider is your Hermes default. Atomic reads Hermes's own sign-in record instead of only its default provider."],"improved":["The Nous Research bot can use any model on your Nous Portal plan, not only Nous's own Hermes models. It starts on your Hermes default when that runs through Nous, and its model menu lists only Nous models."]},{"version":"0.1.146","improved":["MCP server secrets (API keys, tokens and Authorization headers) are now kept in your computer's secure store, the Keychain on Mac and Windows' built-in encryption on Windows, instead of in plain text in Atomic's settings file. Each server gets its secrets only when it starts. Secrets already in your settings move over automatically when you update. If a server had a token typed into its command, Settings > Marketplace > MCP servers asks which setting name it reads, then passes the token that way."]},{"version":"0.1.145","added":["Nous Research is now its own subscription. A Hermes signed in to Nous Portal shows as Nous Research in Settings > AI & accounts > Subscriptions, and gets its own bot that uses only Nous's models."],"improved":["Provider menus are organized into Subscriptions, Flat plans, API keys, On this computer and Atomic, with plain names and no duplicates. Two accounts of one provider are labelled Company and Personal, and Atomic asks you to name them when there are more. Each provider's model menu now lists only the models that provider hosts.","Bots now put all your AI subscriptions to work. In Settings > AI & accounts > Classes & failover, each tier's automatic ladder keeps Claude or ChatGPT in the first two places (Chibi still starts on Claude), then takes one model from each of your other plans in turn (Gemini, Grok, Kimi, Qwen, Cursor, Ollama Cloud, OpenCode Go and the rest) before more Claude or ChatGPT models. Pay-per-use API keys stay last, and a ladder you edited yourself is kept as you set it."]},{"version":"0.1.144","added":["Ready for you lists conversations across your bots on desktop and iPhone. Waiting decisions and new completed responses appear first. Opening a completed response saves its review status across paired devices without clearing a newer response or an unanswered approval."],"improved":["Chibi check-ins now show short, actionable cards with large Open and Dismiss buttons on iPhone and desktop. Three items appear first, with Show more for the rest. Internal bot failures stay with the Chief of Staff; unfinished work reaches you only after two failed retries. Quiet hours and delivery history prevent repeated interruptions."]},{"version":"0.1.143","improved":["iPhone and iPad 1.0.1 (38): local model downloads show received-byte progress during each file transfer, with the active download and Cancel control above the model list. Keep Atomic open until completion; cancelling restarts the download next time."],"added":["Claude Sonnet 5.5 and Haiku 5.5 are now available when choosing a Claude bot model, including Chief of Staff team setup."],"fixed":["A model the engine no longer offers (for example Grok 4.6 after the grok CLI retired it) no longer stops the run. The turn continues on the engine's default model, the thread shows one quiet line saying so, and your Chief of Staff gets an incident asking you to change the model setting. The Grok picker now lists what the installed CLI offers.","Any bot can now hand work or a question up to Chibi, and to the Chief of Staff that manages its team, from its own conversation, even across sections. Before, the roster listed Chibi but the handoff was refused with \\"Room work cannot cross the sender's section boundary\\". Handoffs between specialists keep their section rules, and rooms keep theirs."]},{"version":"0.1.142","added":["Windows: dictate into any app with Ctrl+D (rebindable in Settings > General > Dictation), the same as Cmd+D on the Mac.","iPhone and iPad: Atomic's dictation now comes to the mobile app."],"fixed":["Settings has a Voice tab again, under General. It opens on Chibi's spoken-reply voice, and you can switch to any other bot. Each bot's own settings still have the same picker under Voice & alerts."]},{"version":"0.1.141","improved":["Settings > AI & accounts now opens on Subscriptions, with a card and a Sign in button for every AI plan: Claude, ChatGPT, Google Gemini, Grok, Cursor, Kimi, Qwen, OpenCode Go, Ollama Cloud (including Team) and Factory Droid. Microsoft Copilot, GitHub Copilot, Meta AI, Mistral Le Chat, Perplexity, MiniMax and Z.ai GLM are listed too, each with a plain reason it cannot be used yet.","You can add more than one account for a plan and mark each one Company or Personal, for example your company Google Workspace and your personal Google account for Gemini. Each account gets its own bot, and Personal accounts are used only by your Private Bot."],"fixed":["Stopping dictation in the chat box now waits for the final recognized words instead of cancelling them. Escape still cancels recording. Known issue: live-microphone dictation can listen without producing words; a fix is planned for 0.1.142.","Google sign-in now requests Gmail, Calendar and Drive together. Permissions you approve turn on automatically, without a second Turn on step. After updating, reconnect your Google account once in Settings > Accounts.","Bots use Google and Microsoft through Atomic Accounts, with your account-access settings respected. Bots without access explain what is missing. Settings refreshes when you return and shows sign-in status separately from mail, calendar and file permissions.","Signing in to Gemini with a Google account is now easy to find: it is the Google Gemini card under Subscriptions, not hidden inside the Antigravity engine. Connecting Gmail, Calendar and Drive stays under Google & Microsoft, and each place links to the other."]},{"version":"0.1.140","added":["Chibi can now reach and manage every company bot in every team, including bots you add later, as if it were each team's Chief: it can hand them work, fix their setup, manage their rooms and retry their stuck work. Your Private Bot, personal subscription bots and bots hidden from you stay out of its reach.","When you approve something in Chibi's conversation, the bots Chibi hands that work to can do the same thing without asking you again, for a limited time. Questions, credentials, spending and destructive actions still always ask you, and a bot saying you approved something never counts."],"fixed":["On Windows, Claude bots no longer stop with \\"Failed to refresh OAuth token\\" when several of them renew their sign-in at once, a Claude engine that fails to start is tried again before it is reported, and Chibi's check-ins say what went wrong in plain words.","Chibi no longer fails every message with \\"Internal error: Bad Request\\". Your own messages in Chibi's Primary Bot sweeps conversation now run on the model you picked (Plata by default) instead of the cheapest free one, connected apps such as Vercel and this computer no longer make Gemini refuse the whole request, and if a model refuses a request without saying why, the message moves to the next model."]},{"version":"0.1.139","improved":["Opening a bot now takes you back to the conversation you used most recently with it, on your iPhone and on the desktop.","Atomic now starts Colima or Docker Desktop for your Local VM when it is installed but stopped, and a Local VM that simply stopped is replaced on its next use without asking."],"fixed":["Auto conversations no longer stop with \\"Start docker first\\" when the Local VM they last used is unavailable. They continue on the next available place and say where they moved.","Codex no longer fails with \\"invalid transport\\" because of MCP servers in your own Codex settings.","On iPhone, the model class menu and the pay-per-use choices work again."]},{"version":"0.1.138","improved":["Atomic for Windows is now signed by Chibitek Inc., so Windows no longer blocks the download or the installer."],"fixed":["On Windows, Kimi, Grok, Cursor and Qwen no longer show as not installed right after Atomic installs them, while Windows is still scanning the new program."]},{"version":"0.1.137","improved":["Chibi now runs on Claude by default, at the Plata class. It uses another provider only when every Claude account is busy or out of usage."],"fixed":["A click on the model chip at the top of a chat now always offers the model classes, even when the current model has no class.","The specific-model picker now shows the latest suggested models immediately. Search still refines the list, while update, effort and local-model controls follow after the model choices instead of hiding them."]},{"version":"0.1.136","improved":["Settings > Classes & failover now lets you drag providers into order or jump one directly to any position. Provider and model choices are separate, every configured provider remains available, and Save order confirms when the change is stored.","The Orchestrator now defaults to the latest Sonnet model on the company Claude subscription, with the usual automatic fallback when Claude is unavailable."],"fixed":["iPhone and iPad now load the model-class menu even when the current model has not been graded on the phone yet, so class choices can be changed and saved from mobile.","When a bot's model needs you to sign in again or runs out of usage, Atomic now moves it only to a model that can work on the bot's computer, instead of failing every message. If none is free, the message says which models were skipped and why."]},{"version":"0.1.135","improved":["Pick a model class for a bot, or for one thread, right from the model chip at the top of a chat. A click offers Automatic and the four classes, Mezcal, Plata, Reposado and Añejo, each with the model it would run on now. Atomic then picks the best ready model in that class and falls back as usual.","To choose a specific provider and model, Command-click the chip on a Mac (Ctrl-click on Windows), or choose Choose a specific model at the bottom of the class menu. That view now has Save as default, which makes the thread's model the bot's default, and Reset to default, which puts the thread and the bot back on Automatic."]},{"version":"0.1.134","added":["Settings > Marketplace > MCP servers lists 53 more apps, each connecting through the vendor's own MCP server, including QuickBooks, HubSpot, Stripe, Atlassian, Notion, Canva, Monday.com and Zapier."],"improved":["Composio has been removed. Connect apps with the vendor's own MCP server in Settings, Marketplace, MCP servers.","Settings > Marketplace now has three tabs: Discover, MCP servers and Add-ons. The Connected apps tab is gone, and bots that need an app point you to the vendor's own MCP server."]},{"version":"0.1.133","added":["Your Private Bot and Chibi can now talk to each other. Ask your Private Bot to check something with Chibi, or ask Chibi to ask your Private Bot. Chibi never sees your private chats or memories: your Private Bot decides what to tell it. No other bot can reach your Private Bot.","Settings > Private Bot has a new switch, Let my Private Bot and Chibi talk. It is on by default; turn it off to keep them apart as before. Your organization can also keep them apart on its Macs."]},{"version":"0.1.132","fixed":["When you ask your Private Bot to share a chat with Chibi, it now points you to Share with Chibi in the chat's menu instead of searching for a Chief of Staff it cannot reach."]},{"version":"0.1.131","added":["Share with Chibi: open the menu on any of your Private Bot's threads and choose Share with Chibi. Chibi gets a new thread with a readable copy of that one conversation. The original stays private, and so do your other private chats and your private memory."]},{"version":"0.1.130","added":["Atomic now opens on your Chief of Staff: the first time you open it, in every new window, and when the bot or room you had open is deleted. New conversation lists the Chief of Staff first."],"fixed":["On a Mac, the Local VM keeps its saved workspace after Docker Desktop restarts, instead of asking you to recreate it on every message."]},{"version":"0.1.129","added":["Dictate in any app on your Mac: press Command+D and talk, and Atomic types into the app in front. Turn it on in Settings > General > Dictation. You can pick another shortcut, and Settings tells you when another app already uses it.","Apps that use Command+D in their own menus, such as Bookmark in Safari or Duplicate in Finder, are listed under the shortcut with a switch for each. Switch an app off and its own Command+D works there while dictation stays on everywhere else.","New subscription bots start on each company's newest flagship model at medium effort when your account offers it: Claude Opus 5.5, ChatGPT GPT-6 Astra, Gemini 3.8 Flash, Grok 4.7 and Kimi K3. Your own model choices are never replaced.","iPhone and iPad: Settings > Frontier models shows each AI's default model, whether it is signed in on your computer, and what each company allows on a phone. Settings > PAW lets you check your PAW, edit About me, run the setup interview and suggest changes through your paired computer.","Mochii and Nexus are now on by default on Mac, Windows and Linux, signed in through Chibitek. If you removed one before, it stays removed.","Spec to Ship and the house writing check now run as part of Atomic's own checks, so specs, plans and reviews are held to the same rules every time."],"improved":["Settings > AI & accounts: the Open button now takes you straight to the right key field. Key-only AI cards now have a masked key field with Save and Test, and keys are kept in Atomic's secure store, backed by the Keychain on a Mac. Choose Company or Personal and each key is saved separately.","Atomic finds each AI's command line tool on its own, and you can point it at another copy if you need to.","On a Mac, Open install in Terminal now opens Terminal and runs the install command for you. Ollama Cloud has a key field and a Get a key link instead of a Terminal button."],"fixed":["Messages that pointed to Settings > AI providers now name the real place: Settings > AI & accounts > Subscriptions or API keys.","The model picker returns to the official model list once it loads, instead of staying on the placeholder list."]},{"version":"0.1.128","added":["iPhone and iPad: local chat, downloadable models, model selection, and download and removal controls on supported devices.","Provider bots use their official logos on desktop, iPhone and iPad."],"improved":["Private Bots can use company models when personal accounts are unavailable, with confirmation before premium model costs.","Nexus work summaries retain safe task and output links while excluding credential-bearing links."],"fixed":["Windows setup now selects the declared automatic installers for Grok, Cursor, Kimi and Qwen, without relying on the wording of a terminal command.","Supported Windows provider installers run in the background with progress in Atomic. Setup checks availability after installation; sign-in remains interactive when needed."]},{"version":"0.1.127","added":["A bot for every AI account you sign in to: sign in to Claude, ChatGPT, Gemini, Grok, Kimi, Qwen or Cursor (in setup or Settings > AI & accounts) and Atomic adds a bot named after it, such as \\"Claude\\", \\"Claude (Personal)\\" or \\"ChatGPT\\", wearing that company's icon. It uses only that account and that company's models, picking the best one for the job unless you choose another. Two accounts of the same AI get two bots. Rename, hide or delete them like any bot; a deleted one is not made again.","When a subscription bot's account is out of usage, it moves to your other account of the same AI without a word. If none is free, it says when it will be back and offers to hand your request to Chibi. It never switches to a different AI on its own.","Bots made from a Personal account follow the Private Bot's rules: they run only on your own account, stay off Chibi's team and never see company connections. Your organization can turn off making these bots with the SubscriptionBots setting.","A bot's Access settings now list the apps turned on in its Claude account, each marked Connected via Claude, with an On/Off for that bot. Bots on another AI say why they have none.","Chibi says hello in your code editor and your terminal. The Atomic panel in VS Code (and Cursor, Windsurf and Antigravity) opens with Chibi, a short greeting, a What's new card for the latest release that you can close, and quick tips such as /bot to switch bots and Send Selection to Bot. In the terminal, chibi start, setup and login show Chibi with your version, who you are signed in as and a tip. Add --quiet to skip it; it never shows when the output goes to a file or another program, and NO_COLOR shows it in plain text.","The window Atomic shows while it opens now has Chibi's animated mark on Windows, Mac and Linux, and the iPhone app shows it while your workspace first loads. With Reduce Motion on, Chibi stays still.","Your Personal Bot is now your Private Bot. In the sidebar it reads Create your Private Bot; hold the pointer over it to see what that means: your company can't read it, and nothing you say there is shared with your work bots.","Private Bot chats stay private. Chibi, your work bots, connected assistants and Administrators never see its conversations, memories or files, and they are never mentioned anywhere else. Usage, activity and exports that others can see leave it out, and backups kept by your company do not include it.","Your Private Bot can read your work memories to help you, read only. Turn this off in Settings > Private Bot.","If you attach or paste something into your Private Bot that looks like a company document (from a company drive or shared folder, Mochii or Nexus, marked confidential, or with your company's name), Chibi asks first: keep it private, move it to Chibi or another work bot, or cancel. This check runs on your computer; nothing is sent anywhere to decide.","Your Private Bot now saves to your Nexus as private memory: only it can read it, and every save and lookup is signed with a key that stays on your computer. Chibi, your work bots, your company and Administrators never see it.","New bots set themselves up: + New bot, Create your Private Bot, and asking Chibi for a new bot all open a short interview. It asks one simple question at a time (what it should help with, its name, which clients or projects, which connected tools, when to check in with a morning brief, wrap-up or weekly review, and how it should talk), then shows a plain summary with Create and Change. Atomic writes the bot's instructions, picks its icon and AI, connects its tools and creates its routines, then opens it. Nothing to fill in or paste into Settings. Every question can be skipped, and an interview closed halfway picks up where you left off.","Chibi no longer answers \\"set up a bot for me\\" with instructions to copy. It shows a Set up your new bot card in the chat, already filled in with what you told it."],"fixed":["Fixed: the Reticle web-app testing connection could fail before starting because Atomic supplied an environment setting reserved for its own runtime.","Fixed: setup could leave you stuck when Google refused the sign-in (for example \\"Atomic has not completed the Google verification process\\") or the browser was closed. The Google and Accounts steps now always have Continue without it, and a refused sign-in says plainly that you can continue and connect it later.","Fixed: Mochii and Nexus connect as you, so they show your own company's tasks and memory, and when Nexus is not turned on for your company yet, Settings and the new-bot interview show its own calm note (your organization's memory space is being set up) instead of an error, and bots stop trying to reach it until it is ready.","Fixed: Chibi no longer passes on technical messages such as a tool that timed out on connect. It mentions a tool only when your request needs it, in one plain sentence, and offers to try again or help you connect it."],"improved":["Subscription bots now wear each company's official logo (Claude, ChatGPT, Gemini, Grok, Qwen and Cursor) inside a Chibitek ring: a particle drifts round it while the bot rests, three race round while it thinks, and the ring pulses while it replies. The logo itself never moves or changes colour. With Reduce Motion on, the ring stays still. Kimi shows a plain K, because Moonshot allows its logo only in editorial and non-commercial use. The same logos appear in setup and Settings, on the Mac, on Windows and on iPhone.","Mac dictation now types as you talk: each sentence or phrase is typed when you finish it or pause for about a second, instead of everything at the end. If you talk without stopping, Atomic types what it has every 15 to 20 seconds.","While you talk, the words being recognized show in a small bubble next to your cursor. They are only typed once they are final and cleaned up, and a sentence that has been typed is never changed again.","Auto-correct now looks at the one or two sentences before each new one, so a phrase is corrected as part of its sentence.","Press Command+Z while dictating, or right after, to remove just the last sentence. Saying \\"scratch that\\" on its own does the same.","If you switch to another app while dictating, Atomic pauses typing and says so. Go back and it carries on; nothing is ever typed into the wrong app.","Connected apps no longer take new apps. Apps you connected before keep working, and you can sign one in again if it expires or disconnect it, under Settings > Marketplace > Connected apps. New apps connect in the Marketplace through each company's official connector, and bots point you there instead of offering a connection card."]},{"version":"0.1.126","added":["Team Rooms (coming soon; off until Chibitek sign-in arrives in Atomic): share a bot conversation or start a New Team Room, then invite people from your company or other companies with a link (7 days and 10 uses by default; only the room owner makes links and can turn them off). Everyone brings their own bots with Add my bot, except their Private Bot. A bot answers only when someone @mentions it, runs on its owner's computer and subscriptions, and asks its owner before anything that commits them. A room with other companies shows a banner, and each bot shares nothing from its owner's memories, accounts or files there unless the owner turns it on for that room. Your iPhone reads and replies in rooms through your computer.","Ask any bot to connect an app, like \\"connect my QuickBooks\\", and it now checks the Marketplace for you. If the app is there, it gives you a Connect button that opens Settings > Marketplace with that app selected. If it isn't there yet, it says so and offers a button to send it to Chibitek as an idea. Bots no longer suggest building a connection themselves.","Marketplace: \\"Recommended for your business\\" lists the apps most companies connect first and that you can connect today (QuickBooks, Granola, Gmail, Google Calendar and Drive, Microsoft 365, Slack, Zoom, Docusign, HubSpot, Stripe, Canva, Notion and Asana), each with the best way to connect it.","The Marketplace now lists only official connections: servers run by the company behind each app, and their official connectors in your Claude account. Servers made by other people or independent developers are no longer offered, and bots never suggest them, because Atomic can't tell where they send your data. You can still add a server you trust by hand under MCP servers.","Marketplace: \\"Through your Claude account\\" shows the apps you turned on at claude.ai (such as QuickBooks, which only connects that way) and marks them Connected via Claude. Turn on \\"Also use my Claude Code MCP servers\\" there and your bots on Claude can use them.","Marketplace: Granola and Dropbox are now featured, using their official servers.","Atomic Engine, Chibitek's own AI engine, now installs from Atomic on Windows and on Macs, Apple silicon and Intel: one click in setup or in Settings > Engines. Atomic downloads it, checks it against its published checksum, and starts it once before using it. No terminal needed.","Mac: dictate in any app. Turn it on in Settings > General > Dictation, then press Control+Option+Space in Mail, Slack, your browser or any other app, talk, and press it again. Your words are typed where your cursor is. You can also hold Right Option while you talk instead.","Dictation turns your voice into text on your Mac only: Apple's speech recognition on macOS 26 and later, or Parakeet on macOS 14 and 15. It removes \\"um\\" and \\"uh\\", understands \\"comma\\" and \\"new line\\", and Auto-correct fixes spelling and grammar with Apple Intelligence on your Mac without changing your words. Using your AI subscriptions for Auto-correct is optional and off by default.","Settings > General > Dictation explains each permission (Microphone, Accessibility, and Input Monitoring only for Right Option), lets you change the shortcut, download the speech model, add names Atomic should spell your way, and switch dictation off for single apps.","HIPAA mode: an Administrator can turn it on for the whole workspace in Settings > General > Dictation, and organizations can set it with the HipaaMode MDM key. In HIPAA mode nothing you dictate or type leaves your Mac.","Setup: when a step fails, Save diagnostics sits next to Get help. The file now includes what setup did on this computer: every AI app check that failed or was slow, each install with its output, and each sign-in, with passwords and keys removed. Settings > General > Export Diagnostics saves the same file.","Atomic now saves your work to Nexus, so Chibi remembers you on every device and in every Chibitek app. After every bot reply it saves a short summary: what you asked, what was done, decisions, next steps, and links to pull requests and Mochii tasks.","Handoffs, reports and briefs your bots write are saved to Nexus too, and so are the images, audio and video your bots make or you attach.","Every saved item says where it came from: the app (Mac, Windows, iPhone, VS Code, the command line or Slack), the bot, the conversation and the time.","When you start a conversation, your bot gets a short note of your recent work and files from Nexus. Bots can also search Nexus and open a saved file when you ask about earlier work.","Settings > Memory: Always save to Nexus is on by default. Choose whether to save media and the largest file to save, see what Nexus remembers, and forget any item.","Your Personal Bot never saves to or reads from the company's Nexus. Its memory stays on your computer, unless you mark your own Nexus connection Personal.","Company-managed computers: your organization can keep Always save to Nexus on, and can turn on HIPAA mode so nothing marked as patient data is saved.","A bot's Memory settings are new. Memory saved to Nexus shows who you are connected as and what the bot remembers about you and your work, with search, edit and forget. When a bot's memory can't go to Nexus (not connected, HIPAA, or your Personal Bot), it says plainly that it is kept on this computer.","Workspace knowledge (PAW) in a bot's Memory settings shows which layers it reads (your organization, your department and you) and how fresh they are, with Open PAW and Suggest a change. A suggestion goes to the file's owner for approval in Mochii."],"improved":["Windows: Atomic now follows Early updates unless you or your organisation chose otherwise, so Windows computers keep getting updates before the first stable Windows release.","Signing in with Google now shares only your name and email. Gmail, Calendar and Drive each stay off until you turn them on in Settings > Accounts, and Google asks about each one on its own, with a plain note on what it lets bots do. Reading mail and writing drafts are separate, and Atomic no longer asks for permission to change or delete email. Accounts you already connected keep working.","Setup: the Google step can always be skipped. If Google shows an error page or you choose not to allow something, Atomic carries on and you can connect later.","Setup: installing an AI app shows what it is doing: the download with its size for Gemini, then unpacking and the first start, and npm's latest lines under Show details.","Checking which AI apps are installed can no longer hold up the list. Each app gets a time limit; one that does not answer shows as not ready, with the reason, while the others carry on.","When an AI app is installed but does not start, setup says what Atomic ran and what happened (not found, the exit code with its error, or no answer in time), instead of \\"CLI not found\\".","Nothing that looks like a password or key is ever uploaded: a file that contains one stays on your computer, and a summary has it hidden.","If you are offline or Nexus can't be reached, saves wait on your computer and are sent when it is back, each one exactly once.","A bot's notes file on this computer is now its offline copy and is saved to Nexus too. The file, its size meter and Open in Obsidian moved under Advanced, so you no longer see folder paths unless you look for them."],"fixed":["Fixed: on Windows, installing a new Atomic could leave the old one installed beside it (one \\"for everyone\\", one \\"only for me\\"). The installer now updates the copy that is already there, and removes any other copy of Atomic it finds, keeping your workspace and settings.","Fixed: on Windows, Atomic flashed a console window when it started, and another when the computer-control helper was checked.","Fixed: on Windows, installing Gemini (Antigravity) could fail at the end with \\"EPERM: operation not permitted, rename\\". Atomic now moves the download into place before starting it for the first time, waits out the antivirus scan, and never leaves a half-installed copy. Atomic Engine installs the same way.","Fixed: when a bot was set to an AI that is not installed on this computer, its next chat now runs on your next AI that is ready instead of failing. An AI that is set up wrongly still says so, instead of being swapped silently.","Fixed: on Windows, setup could stay on ChatGPT (Codex) without ever finishing its check, and installing it could fail with no useful message. A check that does not answer now stops the whole program it started, including the codex.exe helper that kept running and blocked the next install, and the install checks that Codex really starts before saying it is done.","Fixed: on Windows, installing Gemini or ChatGPT flashed black console windows. Programs that AI apps start through Atomic's own Node.js are now started hidden.","Fixed: setup could spin forever if Atomic restarted or stopped answering during an install. It now says so and offers Try again."]},{"version":"0.1.125","added":["Send feedback from inside Atomic: Help > Send Feedback or Report a Bug, Settings > General > Basics, the profile menu, or the small Feedback button next to the version in the sidebar. Pick Bug or Idea, describe it, and choose whether to attach a screenshot of the window and diagnostics (passwords, keys and tokens are removed first). It goes straight to the Chibitek team; a person reviews every bug before it is fixed. On iPhone: Settings > Send Feedback.","Windows: Grok can now be installed on Windows. Setup shows its Windows install line for PowerShell.","Press Command-D (Ctrl+D on Windows) to dictate into the chat box, like in Claude and ChatGPT. Press it again or Esc to stop; your words stay in the box to edit or send. The mic button shows it is listening the whole time.","Settings > General > Basics > Dictation shortcut lets you pick a different shortcut: click it, press the keys you want, or reset to Command-D. Atomic refuses shortcuts the system or Atomic already uses."],"improved":["Your iPhone reconnects to your Mac by itself as soon as its network changes, for example when you leave Wi-Fi, switch to cellular, or Tailscale on the iPhone turns back on. It no longer waits out a retry timer first.","When your iPhone can't reach your Mac, it now says why: Tailscale on this iPhone isn't connected (open Tailscale and turn it on), your Mac isn't answering over Tailscale (asleep, offline, or Atomic isn't running), or this iPhone needs to be paired again.","Settings > Remote access on the Mac shows, under Tailscale pairing: this Mac's Tailscale name and IP, whether it answers on its Tailscale name, and when your phone was last seen.","Windows: setup now says PowerShell and Enter, not Terminal and Return, and says when an AI is not available on Windows yet instead of offering an install that cannot work.","Windows: Atomic finds Cursor, Kimi, Qwen and Hermes right after you install them, without restarting Atomic.","Windows: Atomic Engine is not available on Windows yet, so Windows no longer offers it in setup or picks it for Chibi.","Settings is simpler: eight items with tabs instead of a long list. Marketplace is now in Settings, second from the top, with everything you can add in one place: featured tools, the MCP Registry search, connected apps, MCP servers and add-ons. Tools > Marketplace opens it.","Settings > General now has Basics, Appearance, Bots & threads, and Setup, so you can rerun setup steps from there. AI providers, Accounts and Connected assistants are together under AI & accounts; Remote access and Computers under Devices & remote access; Repos, Connected workspaces and Backups under Workspaces & repos.","Searching Settings also finds settings inside tabs, and lists the matching tabs under each item.","When dictation is missing Microphone or Speech Recognition access, the message now has an Open System Settings button that goes straight to the right privacy page."],"fixed":["Fixed: renaming your Mac in Tailscale broke remote access from your iPhone until Atomic was restarted. Atomic now notices the new name within a minute, and the iPhone finds the Mac under its new name by itself.","Fixed: on Windows, connecting ChatGPT (Codex) failed with \\"spawn EINVAL\\". Atomic now starts every AI and tool it installs on Windows the right way, including on a PC without Node.js: Claude Code, Codex, OpenCode, Pi, MiniMax, Gemini, Grok, Cursor, Kimi, Qwen, Droid and Hermes.","Fixed: on Windows, connecting Claude Code to Atomic and MCP servers started with npx could fail the same way.","Fixed: a chat could fail with \\"\`atomic acp\` isn't installed\\" when its bot was set to an AI that is not on this computer. The turn now runs on your next AI that is ready, such as Claude, and the bot keeps its setting for when that AI is installed."]},{"version":"0.1.124","added":["PAW (Personal AI Workspace): Atomic now creates one folder for your AI context by itself, in your home folder under workspace/PAW (on Mac and Windows). Your company's files, your department's files and your own notes live there, and every bot reads only what a job needs.","Setup asks a few plain questions about you (your role, department, company, goals and how you like to work) and saves them as your About me in PAW. Chibitek staff join their department: Service Desk, Development, Back Office, Creative, or Sales and Marketing.","Settings > General > PAW shows where your PAW is, your department, how many files each layer has, when it last synced, and has Edit about me.","Company and department files are locked. If you or a bot change one, Atomic puts the original back and sends the change to its owner as a PAW change request in Mochii.","Chibi's regular check now tells the owner about company files nobody has reviewed in 90 days. This check is free.","Your Personal Bot reads only your own personal notes in PAW; company bots never see them."],"improved":["The old \\"Set up your AI context\\" form is gone. You never pick a folder or build one by hand. An existing ICM folder still works and bots still read it, after PAW.","Company-managed computers: your organization can choose the PAW template new installs start from."],"fixed":["Fixed: when one of your AI subscriptions runs out partway through a turn, even when the provider calls it a rate limit, the bot now finishes the turn on your next subscription without showing an error, and goes back to its usual AI as soon as that subscription has room again."]},{"version":"0.1.123","fixed":["Fixed: setup could not install Claude, Codex or OpenCode on a computer without Node.js (the copy of npm inside Atomic was incomplete). Atomic now ships npm as one checked archive and unpacks it on first use.","Fixed: Check for updates no longer says the update files are missing when there is simply nothing newer yet."]},{"version":"0.1.122","added":["The animated Chibi logo now also appears on the Mac while Atomic starts, on the first setup screen, and while Chibi is thinking.","Atomic for Windows, for Chibitek in-house testing. It is not signed yet, so Windows asks before the first install: choose More info, then Run anyway.","The Windows installer asks who Atomic is for: Only for me (no administrator needed) or Anyone who uses this computer. IT can also install it for everyone on a PC with Datto RMM.","Windows has the same update rings as the Mac: Early updates (internal testers) in Settings > General > Updates gets new Windows builds first. Your organization can set the ring, or manage updates for you, the same way it can on a Mac.","Your Personal Bot: one bot that is only yours. Create it from the sidebar or Settings > Personal Bot, and give it its own name, persona and icon, including a picture. You can change them any time.","Every AI account in Settings > AI providers is now marked Company or Personal. Accounts you already had stay Company, so nothing changes for your company bots. Mark an account you pay for yourself as Personal.","Your Personal Bot runs only on your Personal accounts and never on company AI. Company bots never use your Personal accounts.","When your personal subscriptions are resting, your Personal Bot stops and tells you when they are back. It can use free local AI on this Mac if you turn that on, and your own pay-per-use key only after you say yes.","Your Personal Bot starts with no company connections. Mark your own Google or Microsoft accounts and MCP servers as Personal to give them to it; company bots can't see or use them.","Chibi and company bots can't hand your Personal Bot work, and it can't hand them work. It carries a small Personal badge, and so do its conversations. Your iPhone shows it with the badge too; create it on your Mac.","The setup wizard asks once whether a plan you connect is your own. Chibitek company plans are always Company.","Company-managed Macs: your organization can turn the Personal Bot off. An existing one is then hidden, not deleted."],"improved":["On Windows, setup only shows what applies there: free local AI points you to ollama.com to install Ollama, and the Mac-only steps (macOS permissions and the Podman computer) are left out.","On Windows, Settings > Add-ons says RTK is not on Windows yet, instead of saying this copy is missing it. Apple Intelligence and dictation stay Mac-only and do not appear on Windows.","Usage reports can leave out your Personal Bot's usage, so company reports show only company work."]},{"version":"0.1.121","added":["Chibi is now your Primary Bot. It works on its own: it checks your team every 30 minutes, when Atomic starts and when your Mac wakes, and fixes what it can, like retrying a run that crashed or a routine that failed.","Chibi checks in only when it needs you: one short message in its main conversation, with links to the threads waiting on you. It never repeats itself about the same thing and stays quiet from 10 PM to 7 AM.","The check is free. Chibi only uses a model when something needs unblocking, and then on your cheapest plan, never pay-per-use unless you chose Keep going.","Settings > General > Primary Bot (Chibi): turn it on or off, choose how often it checks, set quiet hours, run a check now, and see what recent checks found and cost.","Move into Chibi: a bot you used as your go-to can move into Chibi from its menu. Its instructions, memory, skills, routines and conversations come along, Chibi keeps its own name and look, and the old bot is archived, not deleted. Importing from Grok Bot does the same for its Primary Bot.","Company-managed Macs: your organization can decide how Atomic updates through its device management (Addigy). When it manages updates, Atomic stops updating itself and Settings > Updates says \\"Updates are managed by your organization\\". It can also set your update channel, shown as Managed by your organization.","Settings > General > Updates shows your version and update channel, and has a new Early updates (internal testers) switch. It is off for everyone; testers who turn it on get new versions before they reach the rest of Chibitek.","A new setup wizard walks you through everything Atomic needs, one step at a time, with no Terminal: your name, which AI plans you have, connecting each one, free local AI, API keys, Google and Microsoft accounts, a computer for your bots, permissions, your iPhone, and meeting Chibi.","Atomic now installs Claude Code, Codex and OpenCode for you with one click, even on a Mac that has never had Node.js.","Grok, Cursor, Kimi and Qwen install from inside Atomic, and Grok, Cursor and Kimi sign in from inside Atomic: the sign-in page opens in your browser, with the code to type when there is one.","Free local AI: Atomic can install Ollama for you and recommends one model sized to your Mac, Gemma 4 on Apple silicon Macs with 16 GB or more, with the size shown before it downloads.","A computer for your bots: Atomic can download Podman's official installer, open it for you, and start the separate computer, with no command line.","Settings > Setup lists every setup step as done, skipped or not done, with Continue to pick up where you left off.","Chibi says hello in your first chat with three easy things to try."],"improved":["If you already use Atomic, a small Finish setting up Atomic card offers the new setup instead of a full-screen welcome.","The Ollama Cloud and Mistral setup cards now say they only need an API key and take you to AI providers, instead of showing a command."],"fixed":["Fixed: on a brand-new install, What's new no longer opens on top of the welcome.","Fixed: while Atomic starts, the window now says Starting Atomic instead of a developer command.","Fixed: the guided tour no longer waits invisibly when no AI plan is set up; it offers to set one up."]},{"version":"0.1.120","fixed":["Fixed: phone pairing over Tailscale now recovers automatically if Tailscale wasn't fully signed in when the app started, and refreshes when the Mac wakes from sleep."]},{"version":"0.1.118","added":["Settings > AI providers > Local models now lists the models Ollama has on this computer, with their size and which bots use them, and can give a model to a bot.","Get models suggests local models that can use tools, says which fit your computer's memory, and downloads any model with a progress bar you can cancel. Remove deletes one you no longer need.","New add-on: RTK shortens long command output (tests, builds, git, logs) before a bot reads it, so bots use fewer tokens. It is on for Engineering bots, and approvals still show the exact command the bot wrote.","New add-on: GitHub threat review. Before Atomic installs a skill, an MCP server or an add-on, it scans the code for backdoors, hidden instructions and supply-chain tricks, and stops the install when it finds clear signs of harm. You see what it found and can still go ahead. The scan runs inside Atomic and uses no AI tokens.","Bots have a new threat_scan tool that checks a folder, a GitHub repository or an npm package before they install or run it. A bot reads the full threat review only when a scan finds something worth a closer look, or when you ask for a deep review.","When a Claude bot clones a repository, Atomic scans it right away and tells the bot only if something turned up.","New add-on: Reticle lets bots check that a web or Electron app they changed really works. It is off until you turn it on, and Atomic installs it on your Mac the first time.","New add-on: a reviewed library of UI design skills bots can load for design and front-end work, following Apple's design guidelines and Liquid Glass first. Off until you turn it on.","Settings > Add-ons has a new option, Scan skills before install (SkillSpector). It is off, and scanning itself arrives in a later update.","When every subscription has hit its limit, Atomic keeps your bots working on your pay-per-use API keys and tells you once, with when a subscription is back. You can keep going, use your local models for free, or pause pay-per-use until then.","Settings > Engines and tiers now shows when each engine hit its limit, the reset time the provider gave in your own time zone, and when it came back."],"improved":["Greyed-out switches in a bot's Access settings now say why, with a link to fix it.","\\"Connected apps\\" is now \\"More apps\\"; Gmail, Calendar, Drive and Outlook come from Google and Microsoft accounts.","Chibi is always your Chief of Staff; its name and look are fixed so Atomic stays recognizable.","The MCP Marketplace is back in plain sight: Tools > Marketplace in the sidebar always opens it, and Settings > Add-ons links to it.","Ollama Cloud and OpenCode Go keys now appear once, as the Main key inside each provider's card, instead of a second row further down.","Atomic now uses your flat-price plans before anything billed per use: Claude, ChatGPT, Grok and Cursor first, then Ollama Cloud, then other plans like the Qwen Coding Plan, Kimi and OpenCode Go.","Switching a bot to another engine when one runs out now happens quietly, with no message in the chat.","An engine that runs out is not tried again until the time its provider said it resets.","Local models from Ollama can be given to any bot in Settings. When a bot cannot use one, it is shown greyed out with the reason."],"fixed":["Fixed: a bot could fail to save to its memory with an \\"unauthorized\\" error after its settings changed mid-conversation.","The Plugins window no longer reopens on MCP servers after you visited that tab, which hid the Marketplace.","Fixed: when a provider was out of credits, a bot could post the provider's billing error as its reply. The turn now finishes on the next engine instead.","Fixed: a model billed per use (like DeepInfra through Atomic Engine) could be picked ahead of a flat-price plan that offers the same model.","Fixed: Atomic Engine showed None for local models even when Ollama had models installed."]},{"version":"0.1.117","added":["In the iPhone app, a new animated Chibi logo plays while the app connects to your computer."]},{"version":"0.1.116","added":["Add-ons like Ponytail now work with every AI engine, not just Claude, and you can switch each one on or off (Settings > Add-ons), for all bots or per bot.","Settings > Add-ons tells you when a newer version of an add-on is out. Atomic includes it in a later update after it has been reviewed; nothing installs by itself."],"improved":["Every AI provider in Settings now links to where you get it: Get a subscription for Claude, ChatGPT and Grok, and Get an API key or See plans for the others.","Settings > AI providers now separates Subscriptions (flat monthly plans, including plans that use a key like the Qwen Coding Plan) from API keys (billed per use).","Each bot now shows a short summary of what it can do.","Opening a bot takes you straight to its latest conversation; older ones are under History."]},{"version":"0.1.115","added":["Add your Qwen Coding Plan as an AI provider account (Settings > Engines > AI provider accounts). Bots can then run on its flat-price models, like Qwen 3.7 Plus, GLM-5 and Kimi K2.5."]},{"version":"0.1.114","added":["Local models can use less memory in long chats. Turn on \\"Use less memory for long chats\\" in Settings > AI providers, then quit Ollama and open it again. Long conversations fit on your Mac with answers that stay practically the same."]},{"version":"0.1.113","added":["Connect Xcode as a code editor (Settings > Connected assistants > Code editors), so Xcode's Claude, Codex and Gemini agents can work with your Atomic team."],"fixed":["Saving a backup no longer fails on project folders your bots worked in. Reinstallable folders like node_modules are left out; reinstall them in each project after restoring."],"improved":["The Atomic iPhone app now shows this computer by its own name, so two computers are easy to tell apart."]},{"version":"0.1.112","added":["Google's Antigravity IDE is now a code editor you can connect (Settings > Connected assistants > Code editors), separate from the older Antigravity app."],"fixed":["Each code editor row now says which editor to restart, instead of always naming Claude Code."]},{"version":"0.1.111","added":["Stop a bot from your code editor: the Atomic extension for VS Code and Cursor shows a Stop button while a bot works, and stops only that chat.","Send images from your code editor and see the images in its chats: paste, drop or pick up to 4 per message."],"improved":["Every bot's past conversations are one click away: a History button in the chat header, and an empty chat now lists recent conversations, including work Chibi handed over.","Chats started from a code editor are recognized in your history, so the editor lists them as its own."]},{"version":"0.1.110","added":["Connect as many Google and Microsoft accounts as you like (Settings > Accounts). Bots can read and draft email, check and add calendar events, and find files in Gmail, Google Calendar, Drive, Outlook and OneDrive, only for the accounts you tick in each bot's Access settings.","Add more than one account per AI provider (Settings > Engines): two Perplexity keys, a second ChatGPT or Grok sign-in, and so on. Each account is its own engine, so a bot can use a specific one, and work moves to your other account when one runs out.","Perplexity is now an AI provider."],"fixed":["An extra Claude subscription account no longer switches to pay-as-you-go billing when an Anthropic API key is also saved."]},{"version":"0.1.109","fixed":["Apple Intelligence now actually ships in the Mac app. Earlier updates left out the small helper it needs, so it showed as unavailable."]},{"version":"0.1.108","added":["Import your Hermes agents: each Hermes profile becomes an Atomic bot with its instructions, memory, skills, scheduled jobs and MCP servers (Team library > Import)."]},{"version":"0.1.107","added":["Apple Intelligence runs on this Mac as a free, private Añejo engine, and writes thread titles without using your subscriptions.","Each bot now opens to one ongoing conversation, like Grok Bot. When the model starts a fresh session, a quiet divider marks it and earlier messages stay above. Separate threads are still there in the ⋯ menu."]},{"version":"0.1.106","improved":["Bots named after an engine run on it by default: Codex on ChatGPT models, Grok on Grok, Claude on Claude, and so on. Existing Codex and Grok bots were moved once; change them any time."]},{"version":"0.1.105","added":["Connect Atomic to VS Code, Cursor, Windsurf, Antigravity and OpenCode in one click (Settings > Connected assistants > Code editors). Each editor's AI chat can then ask Chibi or any bot for work, and each editor gets its own access you can disconnect."],"fixed":["Notifications on your iPhone now show the bot's avatar, or Chibi's mascot when the bot has no avatar, instead of the generic system icon."]},{"version":"0.1.104","added":["This \\"What's new\\" window, shown the first time you open Atomic after an update.","When an update is available, closing its pop-up leaves an \\"Update available\\" button in the bottom-left corner until you install it."],"fixed":["The iPhone pairing screen shows your computer's name with spaces instead of plus signs."]},{"version":"0.1.103","added":["Chibi's assignments now count as real work orders for the rest of the team.","For high-stakes steps (deploys, merges to main, new cloud resources, secrets), Chibi can attach your own message, and Atomic shows it to the specialist stamped as verified."],"improved":["Every bot can report back and escalate to the Chief of Staff that manages its team.","After an update, the Local VM's desktop image rebuilds itself instead of asking you to prepare it again."],"fixed":["Specialists no longer refuse work you already approved in your conversation with Chibi."]},{"version":"0.1.102","added":["A free Marketplace in Plugins: 16 featured services with their own icons, and search across the public MCP Registry. No paid key needed.","Saved backups in Settings > Backups: everything in ~/atomic_backup with Show in Finder, and Import for full backups.","Settings > AI providers brings subscriptions, API keys, and classes and failover together in one place."],"improved":["Settings > Computers now holds cloud computers and your own servers next to the Local VM.","Remote access sends you to Tailscale pairing when this computer has no public web address."],"fixed":["Downloading an update no longer crashes the app on networks that block the newer web protocol (QUIC)."]},{"version":"0.1.101","improved":["The Local VM keeps Firefox signed in with its history when its desktop is replaced.","Browser logins and history on each Local VM are backed up every hour to ~/atomic_backup, keeping the two latest copies."],"fixed":["The macOS menu says Settings…, matching the window it opens."]},{"version":"0.1.100","improved":["Every model your engines offer now gets a class (Mezcal, Plata, Reposado or Añejo), so the chat header never shows a model name."]},{"version":"0.1.99","added":["A new sidebar with one row per bot, and its threads inside the chat."],"improved":["The model chip shows only the class and effort, such as \\"Mezcal (Med)\\". Click it to see the model."]}]`),HTe=VTe;function w2(e,t){const a=s=>s.split(/[.+-]/).map(r=>Number.parseInt(r,10)||0),o=a(e),i=a(t);for(let s=0;s<Math.max(o.length,i.length);s++){const r=(o[s]??0)-(i[s]??0);if(r!==0)return r}return 0}function mB(e,t,a=HTe){return a.filter(o=>w2(o.version,e)>0&&w2(o.version,t)<=0).sort((o,i)=>w2(i.version,o.version))}const KH="atomic.whatsNew.lastSeen";function GTe(){try{return localStorage.getItem(KH)}catch{return null}}function hB(e){try{localStorage.setItem(KH,e)}catch{}}function $Te(e,t,a={}){return t===null?a.firstRun?[]:mB("0",e).filter(o=>o.version===e):mB(t,e)}function KTe(e){const t=e?.onboarding;return!t?.completedAt&&!t?.setup?.deferredAt&&!Object.keys(t?.setup?.steps??{}).length}function S2({icon:e,title:t,items:a}){return a?.length?n.jsxs("div",{className:"mt-3",children:[n.jsxs("div",{className:"flex items-center gap-1.5 text-[12px] font-semibold uppercase tracking-wide text-ink-secondary",children:[e,t]}),n.jsx("ul",{className:"mt-1.5 flex list-disc flex-col gap-1 pl-5 text-[13px] leading-relaxed text-ink",children:a.map(o=>n.jsx("li",{children:o},o))})]}):null}function WTe({initialNotes:e}){const t=rS(),[a,o]=f.useState(()=>e??[]),{state:i}=ve(),s=i.config,r=f.useRef(!1);if(f.useEffect(()=>{if(e||!window.ogb||!s||r.current)return;r.current=!0;const d=$Te(t,GTe(),{firstRun:KTe(s)});d.length?o(d):hB(t)},[t,e,s]),!a.length)return null;const c=()=>{hB(t),o([])};return n.jsx("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/40 p-4",onClick:c,children:n.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"whats-new-title",onClick:d=>d.stopPropagation(),className:"animate-panel-in flex max-h-[80vh] w-full max-w-[520px] flex-col rounded-2xl border border-hairline/50 bg-panel shadow-2xl shadow-black/50",children:[n.jsxs("div",{className:"flex items-start justify-between gap-3 border-b border-hairline/30 px-5 py-4",children:[n.jsxs("div",{children:[n.jsx("h2",{id:"whats-new-title",className:"text-[16px] font-semibold text-ink",children:l("whatsNew.title",{app:Ga().name})}),n.jsx("p",{className:"mt-0.5 text-[12.5px] text-ink-secondary",children:l("whatsNew.subtitle",{version:t})})]}),n.jsx("button",{type:"button",onClick:c,className:"rounded-md p-1 text-ink-secondary hover:bg-control hover:text-ink","aria-label":l("whatsNew.close"),children:n.jsx(Nt,{size:15})})]}),n.jsx("div",{className:"min-h-0 overflow-y-auto px-5 pb-4",children:a.map(d=>n.jsxs("section",{className:"border-b border-hairline/20 py-3 last:border-b-0",children:[n.jsx("h3",{className:"text-[13.5px] font-semibold text-ink",children:l("whatsNew.version",{version:d.version})}),n.jsx(S2,{icon:n.jsx(So,{size:13}),title:l("whatsNew.added"),items:d.added}),n.jsx(S2,{icon:n.jsx(w4,{size:13}),title:l("whatsNew.improved"),items:d.improved}),n.jsx(S2,{icon:n.jsx(n0,{size:13}),title:l("whatsNew.fixed"),items:d.fixed})]},d.version))}),n.jsx("div",{className:"flex justify-end border-t border-hairline/30 px-5 py-3",children:n.jsx("button",{type:"button",onClick:c,className:"rounded-lg bg-accent px-4 py-1.5 text-[13px] font-medium text-white",children:l("whatsNew.gotIt")})})]})})}function JTe(){const[e,t]=f.useState(!1),[a,o]=f.useState("idea"),[i,s]=f.useState(""),[r,c]=f.useState(""),[d,p]=f.useState(null),[h,g]=f.useState(!0),[b,x]=f.useState(!0),[v,k]=f.useState("editing"),[S,N]=f.useState(null),C=f.useRef(!1),{state:j}=ve(),M=j.bots.find(z=>z.id===j.selectedId)?.personal===!0,D=f.useRef(M);D.current=M;const A=f.useRef(null),R=f.useCallback(async(z,B="")=>{if(C.current)return;C.current=!0;let L=null;try{L=await window.ogb?.captureFeedbackScreenshot?.()??null}catch{L=null}o(z),B&&s(B),p(L),g(!!L&&!D.current),x(z==="bug"),k("editing"),N(null),t(!0),C.current=!1},[]);f.useEffect(()=>{const z=L=>{const G=L.detail;R(CM(G),Gxe(G))};window.addEventListener(G3,z);const B=window.ogb?.onOpenFeedback?.(L=>{R(CM(L))});return()=>{window.removeEventListener(G3,z),B?.()}},[R]),f.useEffect(()=>{e&&v==="editing"&&A.current?.focus()},[e,v]);const P=f.useCallback(()=>{v!=="sending"&&(t(!1),v==="sent"&&(s(""),c("")))},[v]);if(f.useEffect(()=>{if(!e)return;const z=B=>{B.key==="Escape"&&P()};return window.addEventListener("keydown",z),()=>window.removeEventListener("keydown",z)},[e,P]),!e)return null;const O=async()=>{if(!(v!=="editing"||i.trim().length<3||!window.ogb?.submitFeedback)){k("sending"),N(null);try{await window.ogb.submitFeedback({type:a,description:i,email:r.trim()||void 0,includeScreenshot:h&&!!d,screenshotDataUrl:h?d:null,includeDiagnostics:b}),k("sent")}catch(z){N(l("feedback.error",{message:z instanceof Error?z.message:String(z)})),k("editing")}}},T=[{id:"bug",label:l("feedback.kind.bug"),icon:n.jsx(n0,{size:14})},{id:"idea",label:l("feedback.kind.idea"),icon:n.jsx(u4,{size:14})}];return n.jsx("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/40 p-4",onClick:P,children:n.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"feedback-title",onClick:z=>z.stopPropagation(),className:"animate-panel-in flex max-h-[85vh] w-full max-w-[520px] flex-col rounded-2xl border border-hairline/50 bg-panel shadow-2xl shadow-black/50",children:[n.jsxs("div",{className:"flex items-start justify-between gap-3 border-b border-hairline/30 px-5 py-4",children:[n.jsxs("div",{children:[n.jsx("h2",{id:"feedback-title",className:"text-[16px] font-semibold text-ink",children:l("feedback.title")}),n.jsx("p",{className:"mt-0.5 text-[12.5px] text-ink-secondary",children:l("feedback.subtitle")})]}),n.jsx("button",{type:"button",onClick:P,className:"rounded-md p-1 text-ink-secondary hover:bg-control hover:text-ink","aria-label":l("feedback.close"),children:n.jsx(Nt,{size:15})})]}),v==="sent"?n.jsxs("div",{className:"px-5 py-6",role:"status",children:[n.jsx("p",{className:"text-[14px] font-semibold text-ink",children:l("feedback.sent.title")}),n.jsx("p",{className:"mt-1 text-[13px] text-ink-secondary",children:l("feedback.sent.body")})]}):n.jsxs("div",{className:"flex min-h-0 flex-col gap-3 overflow-y-auto px-5 py-4",children:[n.jsx("div",{role:"radiogroup","aria-label":l("feedback.kind.label"),className:"flex gap-2",children:T.map(z=>n.jsxs("button",{type:"button",role:"radio","aria-checked":a===z.id,onClick:()=>{o(z.id),z.id==="bug"&&x(!0)},className:V("flex items-center gap-1.5 rounded-lg border px-3 py-1.5 text-[13px]",a===z.id?"border-accent bg-accent/15 text-ink":"border-hairline/50 text-ink-secondary hover:bg-raised/50"),children:[z.icon,z.label]},z.id))}),n.jsxs("label",{className:"flex flex-col gap-1 text-[13px] text-ink",children:[l(a==="bug"?"feedback.description.bug":"feedback.description.idea"),n.jsx("textarea",{ref:A,value:i,onChange:z=>s(z.target.value),rows:6,maxLength:8e3,placeholder:l(a==="bug"?"feedback.placeholder.bug":"feedback.placeholder.idea"),className:"min-h-[120px] w-full resize-y rounded-lg border border-hairline/40 bg-inset px-3 py-2 text-[13px] text-ink focus:border-hairline focus:outline-none"})]}),n.jsxs("label",{className:"flex flex-col gap-1 text-[13px] text-ink",children:[l("feedback.email.label"),n.jsx("input",{type:"email",value:r,onChange:z=>c(z.target.value),autoComplete:"email",className:"w-full rounded-lg border border-hairline/40 bg-inset px-3 py-1.5 text-[13px] text-ink focus:border-hairline focus:outline-none"}),n.jsx("span",{className:"text-[12px] text-ink-secondary",children:l("feedback.email.hint")})]}),n.jsxs("label",{className:V("flex items-start gap-2 text-[13px]",d?"text-ink":"text-ink-secondary"),children:[n.jsx("input",{type:"checkbox",className:"mt-0.5",checked:h&&!!d,disabled:!d,onChange:z=>g(z.target.checked)}),n.jsxs("span",{className:"flex flex-col gap-1.5",children:[l(d?"feedback.screenshot.label":"feedback.screenshot.unavailable"),d&&h&&n.jsx("img",{src:d,alt:l("feedback.screenshot.alt"),className:"max-h-28 w-auto self-start rounded-md border border-hairline/50"})]})]}),n.jsxs("label",{className:"flex items-start gap-2 text-[13px] text-ink",children:[n.jsx("input",{type:"checkbox",className:"mt-0.5",checked:b,onChange:z=>x(z.target.checked)}),n.jsxs("span",{className:"flex flex-col",children:[l("feedback.diagnostics.label"),n.jsx("span",{className:"text-[12px] text-ink-secondary",children:l("feedback.diagnostics.hint")})]})]}),S&&n.jsx("p",{role:"alert",className:"text-[12.5px] text-danger",children:S})]}),n.jsx("div",{className:"flex justify-end gap-2 border-t border-hairline/30 px-5 py-3",children:v==="sent"?n.jsx("button",{type:"button",onClick:P,className:"rounded-lg bg-accent px-4 py-1.5 text-[13px] font-medium text-white",children:l("feedback.close")}):n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",onClick:P,disabled:v==="sending",className:"ui-button",children:l("feedback.cancel")}),n.jsx("button",{type:"button",onClick:()=>{O()},disabled:v==="sending"||i.trim().length<3,className:"rounded-lg bg-accent px-4 py-1.5 text-[13px] font-medium text-white disabled:opacity-50",children:l(v==="sending"?"feedback.sending":"feedback.send")})]})})]})})}function YTe({episode:e,busy:t,error:a,onKeepGoing:o,onChoose:i}){const s=f.useRef(null);f.useEffect(()=>{const c=document.activeElement instanceof HTMLElement?document.activeElement:null;return s.current?.focus(),()=>c?.focus()},[]);const r="flex items-center justify-center gap-1.5 rounded-lg bg-control px-3 py-1.5 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-50";return n.jsxs("div",{role:"dialog","aria-modal":"false","aria-labelledby":"pay-per-use-title","aria-describedby":"pay-per-use-body","data-pay-per-use-notice":!0,onKeyDown:c=>{c.key==="Escape"&&!t&&(c.stopPropagation(),o())},className:"animate-panel-in fixed bottom-4 right-4 z-50 w-[340px] max-w-[calc(100vw-32px)] rounded-2xl border border-hairline/40 bg-panel/85 p-4 shadow-2xl shadow-black/40 backdrop-blur-xl backdrop-saturate-150",children:[n.jsxs("div",{className:"flex items-start gap-2.5",children:[n.jsx("span",{className:"mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-full bg-accent/15 text-accent","aria-hidden":!0,children:n.jsx(Eh,{size:14})}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("h2",{id:"pay-per-use-title",className:"text-[13.5px] font-semibold text-ink",children:Hy(e).title}),n.jsx("p",{id:"pay-per-use-body",className:"mt-1 text-[12.5px] leading-relaxed text-ink-secondary",children:dQ(e)})]})]}),a&&n.jsx("p",{role:"alert",className:"mt-2 text-[12.5px] text-danger",children:l("payPerUse.failed",{error:a})}),n.jsxs("div",{className:"mt-3 flex flex-col gap-1.5",children:[n.jsx("button",{ref:s,type:"button",disabled:t!==null,onClick:o,className:"rounded-lg bg-accent px-3 py-1.5 text-[13px] font-medium text-white disabled:opacity-50",children:Hy(e).keepGoing}),n.jsxs("div",{className:"flex gap-1.5",children:[n.jsxs("button",{type:"button",disabled:t!==null,onClick:()=>i("local"),className:`${r} flex-1`,children:[t==="local"&&n.jsx(Ie,{size:13,className:"animate-spin","aria-hidden":!0}),l("payPerUse.useLocal")]}),n.jsxs("button",{type:"button",disabled:t!==null,onClick:()=>i("pause"),className:`${r} flex-1`,children:[t==="pause"&&n.jsx(Ie,{size:13,className:"animate-spin","aria-hidden":!0}),uQ(e)]})]})]})]})}function ZTe(){const{state:e,dispatch:t}=ve(),a=e.payPerUseNotice,[o,i]=f.useState(null),[s,r]=f.useState(null);if(f.useEffect(()=>{i(null),r(null)},[a?.id]),!a)return null;const c=async d=>{i(d),r(null);try{await X(`${Hy(a).base}/${d==="local"?"local":"pause"}`,{method:"POST"}),t({type:"dismissPayPerUse"})}catch(p){r(p instanceof Error?p.message:String(p)),i(null)}};return n.jsx(YTe,{episode:a,busy:o,error:s,onKeepGoing:()=>{t({type:"dismissPayPerUse"}),X(`${Hy(a).base}/keep-going`,{method:"POST"}).catch(()=>{})},onChoose:d=>{c(d)}},a.id)}function QTe({onGotIt:e,onSettings:t}){const a=f.useRef(null);return f.useEffect(()=>{const o=document.activeElement instanceof HTMLElement?document.activeElement:null;return a.current?.focus(),()=>o?.focus()},[]),n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/30 p-4","data-primary-bot-intro":!0,children:n.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"primary-bot-intro-title","aria-describedby":"primary-bot-intro-body",onKeyDown:o=>{o.key==="Escape"&&(o.stopPropagation(),e())},className:"animate-panel-in w-full max-w-[380px] rounded-3xl border border-white/15 bg-panel/70 p-6 text-center shadow-2xl shadow-black/40 backdrop-blur-2xl backdrop-saturate-150",children:[n.jsxs("div",{className:"relative mx-auto size-[72px]",children:[n.jsx("img",{src:N4,alt:j4,className:"size-[72px] rounded-full object-cover ring-1 ring-white/20"}),n.jsx("span",{className:"absolute -bottom-0.5 -right-0.5 flex size-6 items-center justify-center rounded-full bg-accent text-white shadow-md ring-2 ring-panel","aria-hidden":!0,children:n.jsx(eZ,{size:13,fill:"currentColor"})})]}),n.jsx("h2",{id:"primary-bot-intro-title",className:"mt-4 text-[17px] font-semibold text-ink",children:l("primaryBot.intro.title")}),n.jsx("p",{id:"primary-bot-intro-body",className:"mt-2 text-[13.5px] leading-relaxed text-ink-secondary",children:l("primaryBot.intro.body")}),n.jsxs("div",{className:"mt-5 flex gap-2",children:[n.jsx("button",{type:"button",onClick:t,className:"flex-1 rounded-xl bg-control px-3 py-2 text-[13px] text-ink hover:bg-raised-hover",children:l("primaryBot.intro.settings")}),n.jsx("button",{ref:a,type:"button",onClick:e,className:"flex-1 rounded-xl bg-accent px-3 py-2 text-[13px] font-medium text-white",children:l("primaryBot.intro.gotIt")})]})]})})}function XTe(){const{state:e,dispatch:t}=ve(),a=Gl()===!0,[o,i]=f.useState(sPe),[s,r]=f.useState(null);f.useEffect(()=>{if(!a||o||!window.ogb)return;let g=!0;return X("/api/primary-bot").then(b=>{g&&r(b.introSeenAt)}).catch(()=>{}),()=>{g=!1}},[a,o]);const c=window.ogb?.remoteClient?.active===!0,d=!!window.ogb&&!c,p=!!e.config&&!e.welcomeOpen&&!e.tourOpen&&!z4(e.config,{remoteClient:c,legacyDone:O4()});if(!d||s===null||!lPe({seenLocally:o,serverSeenAt:s,canManage:a,welcomeDone:p}))return null;const h=()=>{rPe(),i(!0),X("/api/primary-bot/intro",{method:"POST"}).catch(()=>{})};return n.jsx(QTe,{onGotIt:h,onSettings:()=>{h(),t({type:"toggleAppSettings",open:!0,section:"general"})}})}function eBe({visible:e}){const[t,a]=f.useState(!1);if(f.useEffect(()=>{const r=window.ogb?.windowControls;if(!r)return;let c=!0;r.state().then(({maximized:p})=>{c&&a(p)});const d=r.onMaximizedChanged(p=>a(p));return()=>{c=!1,d()}},[]),!e)return null;const o=window.ogb?.windowControls,i={WebkitAppRegion:"no-drag"},s=V("flex h-[26px] w-11 items-center justify-center text-ink-secondary","hover:bg-raised hover:text-ink active:bg-raised/60");return n.jsxs("div",{"aria-hidden":!0,style:i,className:"absolute right-0 top-0 z-40 flex items-stretch",children:[n.jsx("button",{type:"button","aria-label":l("window.minimize"),title:l("window.minimize"),className:s,onClick:()=>{o?.minimize()},children:n.jsx($B,{size:14})}),n.jsx("button",{type:"button","aria-label":l(t?"window.restore":"window.maximize"),title:l(t?"window.restore":"window.maximize"),className:s,onClick:()=>{o?.toggleMaximize()},children:t?n.jsx(Ya,{size:11}):n.jsx(ud,{size:11})}),n.jsx("button",{type:"button","aria-label":l("window.close"),title:l("window.close"),className:V(s,"hover:bg-danger/25 hover:text-danger"),onClick:()=>{o?.close()},children:n.jsx(Nt,{size:15})})]})}function tBe(){const{state:e,refreshInstances:t}=ve(),a=window.ogb?.remoteClient?.active===!0,[o,i]=f.useState(!1),s=async()=>{i(!0);try{await t()}finally{i(!1)}};if(a)return n.jsx("main",{className:"flex h-full min-w-0 flex-1 items-center justify-center bg-app px-6",children:n.jsxs("div",{className:"max-w-[520px] rounded-2xl border border-hairline/40 bg-card p-6 text-center",children:[n.jsx("h1",{className:"text-[20px] font-semibold text-ink",children:"The host needs an agent engine"}),n.jsx("p",{className:"mt-2 text-[13.5px] leading-relaxed text-ink-secondary",children:"Configure Claude, ACP, or another supported engine in Atomic on the host computer, then return here."}),n.jsx("button",{onClick:()=>{s()},disabled:o,className:"mt-5 rounded-lg bg-raised px-3 py-2 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-60",children:o?"Checking…":"Check again"})]})});const r=e.instances.filter(c=>c.install).sort((c,d)=>{const p=Hu(c.install)?0:1,h=Hu(d.install)?0:1;return p-h});return n.jsx("main",{className:"flex h-full min-w-0 flex-1 flex-col overflow-y-auto bg-app",children:n.jsxs("div",{className:"mx-auto w-full max-w-[560px] px-6 py-12",children:[n.jsx("h1",{className:"text-[20px] font-semibold text-ink",children:l("noEngines.title")}),n.jsx("p",{className:"mt-1.5 text-[13.5px] leading-relaxed text-ink-secondary",children:l("noEngines.intro",{app:Ga().name})}),n.jsx("div",{className:"mt-6 flex flex-col gap-2.5",children:(()=>{const{subscription:c,custom:d}=ZO(r),p=h=>n.jsxs("div",{className:"rounded-xl border border-hairline/40 bg-card p-3.5",children:[n.jsxs("div",{className:"flex items-center gap-2 text-[14px] font-medium text-ink",children:[n.jsx(Il,{instance:h,size:16}),h.displayName]}),n.jsx(Pr,{instance:h,intent:h.access==="custom"?"inject":"cloud",className:"mt-0.5"})]},h.instanceId);return n.jsxs(n.Fragment,{children:[c.length>0&&n.jsx(Yu,{className:"px-1",children:l("engines.cloud")}),c.map(p),d.length>0&&n.jsx(Yu,{className:"px-1 pt-1",children:l("engines.local")}),d.map(p)]})})()}),n.jsxs("button",{onClick:s,disabled:o,className:"mt-6 flex items-center gap-2 rounded-lg bg-raised px-3 py-2 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-60",children:[o?n.jsx(Ie,{size:14,className:"animate-spin"}):n.jsx(fn,{size:14}),l(o?"common.checking":"common.checkAgain")]})]})})}function gB(e,t){const a=t.trim().toLowerCase();if(!a)return[...e];const o=[],i=[];for(const s of e){const r=s.name.toLowerCase();r.startsWith(a)?o.push(s):r.includes(a)&&i.push(s)}return[...o,...i]}const nBe=["watch","video","youtube"];function aBe({onOpenChange:e}){const{state:t,dispatch:a}=ve(),o=J0(),[i,s]=f.useState(!1),[r,c]=f.useState(""),[d,p]=f.useState([]),[h,g]=f.useState(0),b=f.useRef(null);f.useEffect(()=>{const T=z=>{(z.metaKey||z.ctrlKey)&&z.key.toLowerCase()==="k"&&!z.shiftKey&&!z.altKey&&(z.preventDefault(),s(B=>!B))};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[]),f.useEffect(()=>{i&&(c(""),p([]),g(0))},[i]),f.useEffect(()=>{e?.(i)},[e,i]);const x=r.trim().toLowerCase();if(f.useEffect(()=>{if(!i||!x){p([]);return}p([]);let T=!0;const z=setTimeout(()=>{X(`/api/search?q=${encodeURIComponent(x)}&limit=12`).then(B=>T&&p(B.hits??[])).catch(()=>T&&p([]))},150);return()=>{T=!1,clearTimeout(z)}},[i,x]),f.useEffect(()=>g(0),[x]),f.useEffect(()=>{b.current?.scrollIntoView({block:"nearest"})},[h,d]),!i)return null;const v=gB(t.bots.filter(T=>!T.hidden),x),k=gB(t.groups,x),S=o?qF(r):null,N=o?S?{kind:"watch",video:S}:x.length>=3&&nBe.some(T=>T.startsWith(x)||x.startsWith(T))?{kind:"watch",video:null}:null:null,C=[...N?[N]:[],...v.map(T=>({kind:"bot",bot:T})),...k.map(T=>({kind:"room",group:T})),...x?d.map(T=>({kind:"message",hit:T})):[]],j=C.length?Math.min(h,C.length-1):0,M=async T=>{if(T.kind==="watch")T.video?await hC(a,T.video).catch(z=>a({type:"error",message:z instanceof Error?z.message:String(z)})):UF();else if(T.kind==="message"){const z=T.hit;try{await FS(z,t,a)}catch(B){a({type:"error",message:B instanceof Error?B.message:String(B)})}}else a(T.kind==="bot"?sa(T.bot):{type:"select",id:T.group.id});s(!1)},D=T=>{if(T.key==="Escape")T.preventDefault(),T.stopPropagation(),s(!1);else if(T.key==="ArrowDown")T.preventDefault(),g(C.length?(j+1)%C.length:0);else if(T.key==="ArrowUp")T.preventDefault(),g(C.length?(j-1+C.length)%C.length:0);else if(T.key==="Enter"){T.preventDefault();const z=C[j];z&&M(z)}},A=N?1:0,R=A+v.length,P=A+v.length+k.length,O=(T,z,B,L,G=!1)=>n.jsx("button",{ref:z===j?b:void 0,onClick:B,onMouseMove:()=>g(z),className:V("flex w-full items-center gap-3 rounded-xl px-3 py-2 text-left",G&&"flex-col items-stretch gap-0.5",z===j?"bg-raised":"hover:bg-raised/50"),children:L},T);return n.jsx("div",{className:"fixed inset-0 z-50 flex items-start justify-center bg-black/50 p-6 pt-[14vh]",onMouseDown:T=>T.target===T.currentTarget&&s(!1),onKeyDown:D,children:n.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Command palette",className:"flex max-h-[min(480px,70vh)] w-full max-w-[560px] flex-col overflow-hidden rounded-xl border border-hairline/50 bg-card shadow-2xl shadow-black/60",children:[n.jsxs("div",{className:"flex items-center gap-3 border-b border-hairline/40 px-4 py-3",children:[n.jsx(za,{size:16,className:"shrink-0 text-ink-secondary"}),n.jsx("input",{autoFocus:!0,value:r,onChange:T=>c(T.target.value),placeholder:"Search bots, channels, messages…",className:"w-full bg-transparent text-[14px] text-ink placeholder:text-ink-secondary focus:outline-none"}),n.jsx("kbd",{className:"shrink-0 rounded-md border border-hairline/40 px-1.5 py-0.5 text-[11px] text-ink-secondary",children:"esc"})]}),n.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto p-2",children:[C.length===0&&n.jsx("div",{className:"px-3 py-6 text-center text-[13px] text-ink-secondary",children:x?`Nothing matches “${r}”`:"Nothing to switch to yet"}),v.length>0&&n.jsx("div",{className:"px-3 pb-1 pt-1.5 text-[11px] font-medium uppercase tracking-[0.08em] text-ink-secondary",children:"Bots"}),N&&O("watch",0,()=>{M(N)},n.jsxs(n.Fragment,{children:[n.jsx(s4,{size:16,className:"shrink-0 text-ink-secondary"}),n.jsx("span",{className:"truncate text-[14px] text-ink",children:l(S?"watch.entry.paletteLink":"watch.entry.menu")})]})),v.map((T,z)=>O(`bot:${T.id}`,A+z,()=>{M({kind:"bot",bot:T})},n.jsxs(n.Fragment,{children:[n.jsx(o4,{size:16,className:"shrink-0 text-ink-secondary"}),n.jsx("span",{className:"truncate text-[14px] text-ink",children:T.name}),T.title&&n.jsx("span",{className:"min-w-0 truncate text-[12.5px] text-ink-secondary",children:T.title})]}))),k.length>0&&n.jsx("div",{className:"px-3 pb-1 pt-2 text-[11px] font-medium uppercase tracking-[0.08em] text-ink-secondary",children:"Groups"}),k.map((T,z)=>O(`room:${T.id}`,R+z,()=>{M({kind:"room",group:T})},n.jsxs(n.Fragment,{children:[n.jsx(bi,{size:16,className:"shrink-0 text-ink-secondary"}),n.jsx("span",{className:"truncate text-[14px] text-ink",children:T.name})]}))),x&&d.length>0&&n.jsx("div",{className:"px-3 pb-1 pt-2 text-[11px] font-medium uppercase tracking-[0.08em] text-ink-secondary",children:"Messages"}),x&&d.map((T,z)=>{const B=T.snippet.slice(0,T.matchStart),L=T.snippet.slice(T.matchStart,T.matchStart+T.matchLength),G=T.snippet.slice(T.matchStart+T.matchLength);return O(`msg:${T.threadId}:${T.messageId}`,P+z,()=>{M({kind:"message",hit:T})},n.jsxs(n.Fragment,{children:[n.jsxs("span",{className:"flex items-center gap-2 truncate text-[13px] font-medium text-ink",children:[n.jsx(h4,{size:13,className:"shrink-0 text-ink-secondary"}),T.name,T.task?n.jsxs("span",{className:"font-normal text-ink-secondary",children:[" · ",T.task]}):null]}),n.jsxs("span",{className:"line-clamp-2 text-[12.5px] text-ink-secondary",children:[B,n.jsx("mark",{className:"rounded-sm bg-accent/25 px-0.5 text-ink",children:L}),G]})]}),!0)})]})]})})}function oBe({item:e,isMac:t}){const a=fv(),o=e.id==="dictation"?sV(a,t):kS(e,t);return n.jsxs("div",{className:"flex items-center justify-between gap-4 py-1.5",children:[n.jsx("span",{className:"text-[13px] text-ink",children:e.description}),n.jsx("div",{className:"flex shrink-0 items-center gap-1",children:o.map((i,s)=>n.jsx("kbd",{className:"inline-flex min-w-[22px] items-center justify-center rounded-md border border-hairline/60 bg-control px-1.5 py-0.5 font-mono text-[11.5px] font-semibold text-ink shadow-xs",children:i},s))})]})}function iBe({open:e,onClose:t}){const[a,o]=f.useState(""),i=f.useRef(null),s=f.useRef(null),r=ls();if(f.useLayoutEffect(()=>{const d=i.current;if(!(!e||!d))return o(""),d.showModal(),s.current?.focus(),()=>d.close()},[e]),!e)return null;const c=gpe(iz,a,r);return n.jsx("dialog",{ref:i,"aria-labelledby":"shortcuts-dialog-title",className:"m-auto w-[min(500px,calc(100%-32px))] max-h-[85vh] overflow-hidden rounded-2xl border border-hairline/50 bg-panel p-0 text-ink shadow-2xl backdrop:bg-black/60 backdrop:backdrop-blur-xs",onCancel:d=>{d.preventDefault(),t()},onKeyDown:d=>d.stopPropagation(),onMouseDown:d=>d.target===d.currentTarget&&t(),children:n.jsxs("div",{className:"flex max-h-[85vh] flex-col",children:[n.jsxs("div",{className:"flex items-center justify-between border-b border-hairline/40 px-5 py-4",children:[n.jsxs("div",{className:"flex items-center gap-2.5",children:[n.jsx("span",{className:"flex size-8 shrink-0 items-center justify-center rounded-lg bg-accent/15 text-accent",children:n.jsx(c4,{size:18})}),n.jsxs("div",{children:[n.jsx("h2",{id:"shortcuts-dialog-title",className:"text-[16px] font-semibold text-ink",children:"Keyboard Shortcuts"}),n.jsx("p",{className:"text-[12px] text-ink-secondary",children:"Quick commands and navigation"})]})]}),n.jsx("button",{type:"button",onClick:t,"aria-label":"Close keyboard shortcuts",className:"rounded-lg p-1.5 text-ink-secondary hover:bg-raised hover:text-ink",children:n.jsx(Nt,{size:18})})]}),n.jsx("div",{className:"border-b border-hairline/30 px-5 py-2.5",children:n.jsxs("div",{className:"flex items-center gap-2 rounded-xl border border-hairline/40 bg-inset px-3 py-1.5 focus-within:border-accent/60",children:[n.jsx(za,{size:14,className:"shrink-0 text-ink-secondary"}),n.jsx("input",{ref:s,value:a,onChange:d=>o(d.target.value),placeholder:"Search shortcuts…","aria-label":"Search shortcuts",className:"w-full bg-transparent text-[13px] text-ink placeholder:text-ink-secondary focus:outline-none"})]})}),n.jsx("div",{className:"flex-1 overflow-y-auto px-5 py-3 space-y-4",children:c.length===0?n.jsxs("div",{className:"py-8 text-center text-[13px] text-ink-secondary",children:["No shortcuts found for “",a,"”"]}):c.map(d=>n.jsxs("div",{className:"space-y-1",children:[n.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider text-ink-secondary/70",children:d.category}),n.jsx("div",{className:"divide-y divide-hairline/20 rounded-xl bg-card/40 px-3 py-1 border border-hairline/30",children:d.items.map(p=>n.jsx(oBe,{item:p,isMac:r},p.id))})]},d.category))}),n.jsxs("div",{className:"flex items-center justify-between border-t border-hairline/40 bg-card/30 px-5 py-2.5 text-[11.5px] text-ink-secondary",children:[n.jsxs("span",{children:["Press ",n.jsx("kbd",{className:"rounded bg-control px-1 py-0.5 font-mono text-[10.5px]",children:"?"})," when not typing to open"]}),n.jsx("button",{type:"button",onClick:t,className:"rounded-lg bg-raised px-3 py-1 font-medium text-ink hover:brightness-110",children:"Done"})]})]})})}function sBe(e,t){const a=(o,i)=>o.left<i.right&&o.right>i.left&&o.top<i.bottom&&o.bottom>i.top;return t.some(o=>o.visible&&o.rect.width>0&&o.rect.height>0&&(o.explicit||o.zIndex!==null&&o.zIndex>=10)&&e.some(i=>a(o.rect,i)))}async function rBe(e,t,a,o){t&&t!==a&&(await e.setInteractive(null),await e.release(t));const i=await e.take(a);if(!i.held)throw new Error("The Local VM control hold was not acquired");if(i.owned!==!0)return{status:"held-elsewhere",botId:a,snapshot:i};try{await e.setInteractive(o)}catch(s){throw await e.setInteractive(null).catch(()=>{}),await e.release(a).catch(()=>{}),s}return{status:"controlled",botId:a,snapshot:i}}async function C2(e,t){return t?(await e.setInteractive(null).catch(()=>{}),e.release(t)):null}function WH(e){return e.filter(t=>t.computer==="vm"&&t.hidden!==!0).map(t=>t.id)}function lBe(e,t){const a=WH(e),o=a.includes(t)?t:a[0]??null;return[o,a.find(i=>i!==o)??null]}function cBe(e,t,a){const o=[...e],i=t===0?1:0;return a&&o[i]===a&&(o[i]=o[t]),o[t]=a,o}function dBe(e,t){const a=WH(t),o=new Set(a),i=[null,null];for(const s of[0,1]){const r=e[s];r&&o.delete(r)&&(i[s]=r)}for(const s of[0,1]){if(i[s])continue;const r=[...o][0];r&&(i[s]=r,o.delete(r))}return i}const uBe=aa({mode:ui(["shared","per-bot"]).optional(),max_instances:qc().int().positive().optional(),container:ui(["running","stopped","missing"]).optional(),network:ui(["loopback","unsafe","unknown"]).optional(),security:ui(["hardened","unsafe","unknown"]).optional(),persistence:ui(["durable","unsafe","unknown"]).optional(),desktopReady:os().optional(),ready:os().optional(),viewer_url:Un().min(1).optional()});function JH(e){const t=uBe.safeParse(e);return t.success?t.data:null}function Q5(e){const t=JH(e),a=t?.mode??"unknown",o=t?.container??"unknown",i=t?.network??"unknown",s=t?.security??"unknown",r=t?.persistence??"unknown",c=t?.max_instances??0,d=t?.desktopReady===!0,p=!!(t?.ready===!0&&o==="running"&&i==="loopback"&&s==="hardened"&&r==="durable"&&d);return{mode:a,maxInstances:c,container:o,network:i,security:s,persistence:r,desktopReady:d,ready:p}}function pBe(e){const t=JH(e);return!t||!Q5(e).ready?null:t.viewer_url??null}const X5=["local-vm-workspace:left","local-vm-workspace:right"],YH=aa({held:os(),helpReason:Un().nullable(),owned:os().optional(),acquired:os().optional(),released:os().optional()});async function fB(e,t,a){const o=await X(`/api/bots/${e}/computer/control`,{method:"POST",body:JSON.stringify({action:t,controlLeaseId:a})}),i=YH.safeParse(o);if(!i.success)throw new Error("invalid-control-snapshot");return i.data}async function mBe(e){const t=YH.safeParse(await X(`/api/bots/${e}/computer/control`));if(!t.success)throw new Error("invalid-control-snapshot");return t.data}function bB(e,t){fetch(`/api/bots/${e}/computer/control`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"release",controlLeaseId:t}),keepalive:!0}).then(async a=>{a.ok}).catch(()=>{})}async function yB(e,t){return!0}function j2(e,t,a){e({type:"computerControl",botId:t,held:a.held,helpReason:a.helpReason})}function xB(e){const t=e.current?.getBoundingClientRect();return!t||t.width<1||t.height<1?null:{x:Math.round(t.left),y:Math.round(t.top),width:Math.round(t.width),height:Math.round(t.height)}}const hBe=['[aria-modal="true"]','[role="dialog"]','[role="menu"]',"[popover]","[data-native-view-overlay]",".fixed",".absolute"].join(",");function gBe(){const e=[...document.querySelectorAll("[data-native-view-host]")],t=e.map(o=>o.getBoundingClientRect()).filter(o=>o.width>0&&o.height>0);if(t.length===0)return!1;const a=[...document.querySelectorAll(hBe)].filter(o=>!e.some(i=>o===i||o.contains(i)||i.contains(o))).map(o=>{const i=window.getComputedStyle(o),s=o.matches('[aria-modal="true"], [role="dialog"], [role="menu"], [popover], [data-native-view-overlay]'),r=Number.parseInt(i.zIndex,10);return{rect:o.getBoundingClientRect(),explicit:s,visible:i.display!=="none"&&i.visibility!=="hidden"&&Number(i.opacity)!==0,zIndex:Number.isFinite(r)?r:null}});return sBe(t,a)}function fBe(e){const[t,a]=f.useState(!1);return f.useEffect(()=>{let o=0;const i=()=>a(gBe()),s=()=>{o||(o=requestAnimationFrame(()=>{o=0,i()}))};i();const r=new MutationObserver(s);r.observe(document.body,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["class","style","aria-hidden","aria-modal","role","open","popover"]});const c=new ResizeObserver(s);c.observe(document.body);for(const p of document.querySelectorAll("[data-native-view-host]"))c.observe(p);const d=["toggle","animationstart","animationend","transitionstart","transitionend"];for(const p of d)document.addEventListener(p,s,!0);return window.addEventListener("resize",s),window.addEventListener("scroll",s,!0),()=>{o&&cancelAnimationFrame(o),r.disconnect(),c.disconnect();for(const p of d)document.removeEventListener(p,s,!0);window.removeEventListener("resize",s),window.removeEventListener("scroll",s,!0)}},[]),e||t}function bBe(e,t){return e?e.container==="missing"?"VM not created":e.container==="stopped"?"VM stopped":e.ready?t==="error"?"Viewer unavailable":t!=="ready"?"Connecting viewer":"Live · watch-only":"VM unavailable":"Checking VM"}function yBe({index:e,bot:t,bots:a,otherBotId:o,obscured:i,active:s,heldElsewhere:r,controlPending:c,onSelect:d,onTake:p,onRelease:h,onOpenComputer:g}){const b=X5[e],x=t?.id??null,v=t?.name??"Local VM",k=f.useRef(null),S=f.useRef(Promise.resolve()),N=f.useRef(i),[C,j]=f.useState(0),[M,D]=f.useState(null),[A,R]=f.useState({contextId:b,open:!1,status:"closed",interactive:!1}),[P,O]=f.useState(null),T=f.useCallback(async K=>{if(x)try{const H=await X(`/api/bots/${x}/local-computer`,{signal:K});K?.aborted||D(Q5(H))}catch{}},[x]),z=f.useRef(T);f.useEffect(()=>{z.current=T},[T]),f.useEffect(()=>{N.current=i},[i]),f.useEffect(()=>window.ogb?.desktopWorkspace?.onState(H=>{H.contextId===b&&(R(H),(H.status==="error"||H.status==="closed")&&z.current())}),[b]),f.useEffect(()=>{const K=window.ogb?.desktopWorkspace;let H=!0;const U=new AbortController;D(null),O(null),R({contextId:b,open:!1,status:"closed",interactive:!1});const Q=async()=>{if(K&&await K.close(b).catch(()=>{}),!(!H||!x)){if(!K){O("The two-desktop workspace requires the Atomic desktop app.");return}try{const W=await X(`/api/bots/${x}/local-computer`,{signal:U.signal});if(!H)return;const q=Q5(W);D(q);const Z=pBe(W);if(!q.ready||!Z||(await new Promise(ue=>{let he=!1;const we=()=>{he||(he=!0,ue())},ee=setTimeout(we,100);requestAnimationFrame(()=>{clearTimeout(ee),we()})}),!H))return;const oe=xB(k);if(!oe)throw new Error("layout-unavailable");const _=await K.open({contextId:b,url:Z,title:`${v}'s Local VM`,bounds:oe});if(!H){await K.close(b).catch(()=>{});return}R(_),await K.layout([{contextId:b,bounds:oe,visible:!N.current&&_.open}])}catch(W){if(!H||U.signal.aborted)return;O(W instanceof Error&&W.message==="layout-unavailable"?"The viewer area is not laid out yet. Retry after resizing the window.":"Atomic could not connect this Local VM viewer.")}}};return S.current=S.current.catch(()=>{}).then(Q),()=>{H=!1,U.abort(),K&&(S.current=S.current.catch(()=>{}).then(()=>K.close(b).then(()=>{}).catch(()=>{})))}},[x,v,b,C]),f.useEffect(()=>{if(!x)return;const K=new AbortController,H=window.setInterval(()=>{T(K.signal)},3e4);return()=>{K.abort(),window.clearInterval(H)}},[x,T]);const B=f.useCallback(()=>{const K=window.ogb?.desktopWorkspace,H=xB(k);!K||!H||!A.open||K.layout([{contextId:b,bounds:H,visible:!i}]).catch(()=>O("Atomic could not position this Local VM viewer."))},[b,A.open,i]);f.useEffect(()=>{const K=k.current;if(!K)return;const H=new ResizeObserver(B);H.observe(K),window.addEventListener("resize",B);const U=requestAnimationFrame(B);return()=>{cancelAnimationFrame(U),H.disconnect(),window.removeEventListener("resize",B)}},[B]);const L=bBe(M,A.status),G=!!(t&&M?.ready&&A.status==="ready"&&A.open);return n.jsxs("section",{className:V("flex min-h-0 min-w-0 flex-col overflow-hidden rounded-xl border bg-panel",s?"border-accent/80 shadow-[0_0_0_1px_rgb(var(--accent)/0.35)]":"border-hairline/50"),children:[n.jsxs("div",{className:"flex min-h-[68px] items-center gap-3 border-b border-hairline/40 px-3 py-2.5",children:[n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsxs("label",{className:"sr-only",htmlFor:`local-vm-slot-${e}`,children:["Local VM for pane ",e+1]}),n.jsxs("select",{id:`local-vm-slot-${e}`,value:t?.id??"",onChange:K=>d(K.target.value||null),disabled:c,className:"w-full truncate rounded-lg border border-hairline/50 bg-card px-2.5 py-1.5 text-[13px] font-medium text-ink outline-none focus:border-accent/70",children:[n.jsx("option",{value:"",children:"Choose a Local VM bot"}),a.map(K=>n.jsx("option",{value:K.id,disabled:K.id===o,children:K.name},K.id))]}),n.jsxs("div",{className:"mt-1 flex items-center gap-1.5 text-[11px] text-ink-secondary",children:[n.jsx("span",{className:V("h-1.5 w-1.5 rounded-full",s?"bg-accent":A.status==="ready"?"bg-success":A.status==="error"?"bg-danger":"bg-ink-secondary/50")}),s?"You have control":r?"Control held elsewhere":L]})]}),t&&s?n.jsxs("button",{type:"button",onClick:h,disabled:c,className:"flex shrink-0 items-center gap-1.5 rounded-lg bg-accent px-2.5 py-2 text-[12px] font-medium text-white hover:brightness-110 disabled:opacity-50",children:[c?n.jsx(Ie,{size:13,className:"animate-spin"}):n.jsx(Ri,{size:13}),"Hand back"]}):t?n.jsxs("button",{type:"button",onClick:()=>p(t.id),disabled:!G||c||r,className:"flex shrink-0 items-center gap-1.5 rounded-lg bg-raised px-2.5 py-2 text-[12px] text-ink hover:bg-raised-hover disabled:opacity-45",title:"Pause only this bot and enable keyboard and pointer input in this pane",children:[c?n.jsx(Ie,{size:13,className:"animate-spin"}):n.jsx(Ri,{size:13}),r?"Held elsewhere":"Take control"]}):null]}),n.jsx("div",{ref:k,"data-native-view-host":!0,className:"relative min-h-0 flex-1 bg-[#070707]",children:n.jsx("div",{className:"absolute inset-0 flex items-center justify-center p-6 text-center",children:t?!M&&!P?n.jsxs("div",{className:"flex items-center gap-2 text-[12px] text-ink-secondary",children:[n.jsx(Ie,{size:15,className:"animate-spin"})," Checking ",t.name,"'s VM…"]}):M?.ready&&A.status!=="error"&&!P?n.jsxs("div",{className:"flex items-center gap-2 text-[12px] text-ink-secondary",children:[n.jsx(Ie,{size:15,className:"animate-spin"})," Connecting live view…"]}):n.jsxs("div",{className:"flex max-w-[300px] flex-col items-center gap-3 text-ink-secondary",children:[n.jsx(Zn,{size:21,className:"text-warning"}),n.jsx("div",{className:"text-[12px] leading-relaxed",children:P??(M?.container==="missing"?`${t.name}'s Local VM has not been created.`:M?.container==="stopped"?`${t.name}'s Local VM is stopped.`:`${t.name}'s Local VM is not ready for a live view.`)}),n.jsxs("div",{className:"flex gap-2",children:[n.jsxs("button",{type:"button",onClick:()=>j(K=>K+1),className:"flex items-center gap-1.5 rounded-lg bg-raised px-3 py-2 text-[12px] text-ink hover:bg-raised-hover",children:[n.jsx(fn,{size:13})," Retry status"]}),n.jsx("button",{type:"button",onClick:()=>g(t.id),className:"rounded-lg bg-raised px-3 py-2 text-[12px] text-ink hover:bg-raised-hover",children:"Open Computer"})]})]}):n.jsxs("div",{className:"flex max-w-[260px] flex-col items-center gap-2 text-ink-secondary",children:[n.jsx(Ba,{size:22}),n.jsx("span",{className:"text-[12px]",children:"Choose another bot configured for a Local VM."})]})})})]})}function xBe({primaryBotId:e,overlayOpen:t,onClose:a,onOpenComputer:o}){const{state:i,dispatch:s}=ve(),r=f.useMemo(()=>i.bots.filter(L=>L.computer==="vm"&&!L.hidden),[i.bots]),[c,d]=f.useState(()=>lBe(i.bots,e)),p=f.useRef(c),[h,g]=f.useState(null),b=f.useRef(null),x=f.useRef(null),v=x.current??crypto.randomUUID();x.current=v;const k=f.useRef(!1),S=f.useRef(!0),[N,C]=f.useState(!1),[j,M]=f.useState(null),D=fBe(t);f.useEffect(()=>{p.current=c},[c]);const A=f.useMemo(()=>({async take(L){const G=await U5({action:"take",syncNativeBrowser:!0,requestControl:K=>fB(L,K,v),setNativeBrowserControl:K=>yB()});return j2(s,L,G),G.held&&G.owned===!0?b.current=L:b.current===L&&(b.current=null),G},async release(L){const G=await U5({action:"release",syncNativeBrowser:!0,requestControl:K=>fB(L,K,v),setNativeBrowserControl:K=>yB()});return j2(s,L,G),b.current===L&&(b.current=null),G},async setInteractive(L){const G=window.ogb?.desktopWorkspace;if(!G)throw new Error("The desktop workspace bridge is unavailable");return G.setInteractive(L)}}),[v,s]);f.useEffect(()=>{d(L=>{const G=dBe(L,i.bots);return G[0]===L[0]&&G[1]===L[1]?L:G})},[i.bots]),f.useEffect(()=>{let L=!0;return(async()=>{for(const K of c)if(K)try{const H=await mBe(K);L&&j2(s,K,H)}catch{}})(),()=>{L=!1}},[s,c]),f.useEffect(()=>{const L=b.current;!L||c.includes(L)||C2(A,L).then(()=>{g(null)}).catch(()=>{M("The removed pane could not hand control back safely.")})},[A,c]),f.useEffect(()=>(S.current=!0,()=>{S.current=!1;const L=b.current,G=window.ogb?.desktopWorkspace;if(!G){L&&bB(L,v);return}G.setInteractive(null).catch(()=>{}).then(()=>(L&&bB(L,v),G.close())).catch(()=>{})}),[v]);const R=f.useCallback(L=>{const G=p.current.indexOf(L);return G<0?null:X5[G]},[]),P=f.useCallback(async()=>{const L=b.current;if(!L)return!0;if(k.current)return!1;k.current=!0,C(!0),M(null);try{return await C2(A,L),g(null),!0}catch{return M("Atomic could not hand control back. The workspace stayed open."),!1}finally{k.current=!1,C(!1)}},[A]),O=f.useCallback(async L=>{if(k.current||b.current===L)return;const G=window.ogb?.desktopWorkspace,K=R(L);if(!(!G||!K)){k.current=!0,C(!0),M(null);try{const H={...A,async setInteractive(Q){if(Q&&R(L)!==Q)throw new Error("The Local VM pane changed during control acquisition");return A.setInteractive(Q)}},U=await rBe(H,b.current,L,K);if(g(null),U.status==="held-elsewhere"){M("This VM is already controlled in another viewer. Hand it back there first.");return}if(!S.current){await C2(A,L).catch(()=>{});return}g(L)}catch{g(b.current),M("Control could not switch safely. Any remaining hold stayed paused.")}finally{k.current=!1,C(!1)}}},[R,A]),T=f.useCallback(async(L,G)=>{if(k.current)return;const K=p.current[L];K!==G&&(K&&b.current===K&&!await P()||d(H=>cBe(H,L,G)))},[P]),z=f.useCallback(async()=>{b.current&&!await P()||a()},[P,a]),B=f.useCallback(async L=>{b.current&&!await P()||o(L)},[P,o]);return n.jsxs("main",{className:"flex h-full min-w-0 flex-1 flex-col bg-app",children:[n.jsxs("header",{className:"flex min-h-[60px] items-center gap-3 border-b border-hairline/40 px-5 py-3",children:[n.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-accent/15 text-accent",children:n.jsx(Ba,{size:18})}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("h1",{className:"truncate text-[14px] font-semibold text-ink",children:"Local VM workspace"}),n.jsx("p",{className:"truncate text-[11.5px] text-ink-secondary",children:"Two live desktops · one active controller · watch-only by default"})]}),n.jsx("button",{type:"button",onClick:()=>{z()},disabled:N,className:"rounded-md p-1.5 text-ink-secondary hover:bg-raised hover:text-ink disabled:opacity-50","aria-label":"Close Local VM workspace",children:n.jsx(Nt,{size:18})})]}),j&&n.jsxs("div",{className:"mx-3 mt-3 flex items-center gap-2 rounded-lg border border-danger/30 bg-danger/10 px-3 py-2 text-[12px] text-danger",children:[n.jsx(Zn,{size:14,className:"shrink-0"})," ",j]}),n.jsx("div",{className:"grid min-h-0 flex-1 grid-cols-2 gap-3 p-3",children:[0,1].map(L=>{const G=c[L],K=r.find(H=>H.id===G)??null;return n.jsx(yBe,{index:L,bot:K,bots:r,otherBotId:c[L===0?1:0],obscured:D,active:!!(K&&h===K.id),heldElsewhere:!!(K&&i.computerControl[K.id]?.held&&h!==K.id),controlPending:N,onSelect:H=>{T(L,H)},onTake:H=>{O(H)},onRelease:()=>{P()},onOpenComputer:H=>{B(H)}},X5[L])})})]})}const vBe={collaborations:[],queued:[],running:[]};function kBe(e,t=[]){const a=new Map;for(const o of e){if(o.hidden)continue;const i=o.section?.trim()||"";a.set(i,[...a.get(i)??[],o])}for(const o of t){const i=o.trim();i&&!a.has(i)&&a.set(i,[])}return[...a].map(([o,i])=>({key:o,name:o||"General",chiefs:i.filter(s=>s.chiefOfStaff),members:i.filter(s=>!s.chiefOfStaff)}))}function wBe(e,t){const a=new Set(e.filter(s=>!s.hidden).map(s=>s.id)),o=new Map,i=(s,r)=>[s,r].sort().join(":");for(const s of t.collaborations){const[r,c]=s.botIds;!a.has(r)||!a.has(c)||o.set(i(r,c),{sourceBotId:r,targetBotId:c,state:"connected",groupId:s.groupId,lastAt:s.lastAt})}for(const s of t.queued)!a.has(s.sourceBotId)||!a.has(s.targetBotId)||o.set(i(s.sourceBotId,s.targetBotId),{sourceBotId:s.sourceBotId,targetBotId:s.targetBotId,state:"queued",reason:s.reason});for(const s of t.running)!a.has(s.sourceBotId)||!a.has(s.targetBotId)||o.set(i(s.sourceBotId,s.targetBotId),{sourceBotId:s.sourceBotId,targetBotId:s.targetBotId,state:"running",groupId:s.groupId});return[...o.values()].sort((s,r)=>{const c={running:0,queued:1,connected:2};return c[s.state]-c[r.state]||(r.lastAt??0)-(s.lastAt??0)})}function SBe(e){return e.activity==="waiting-on-you"?{label:"Waiting for you",tone:"warning"}:e.activity==="dead"||e.activity==="no-signal"?{label:"No signal",tone:"danger"}:e.busy||e.activity==="working"?{label:"Working",tone:"success"}:{label:"Ready",tone:"idle"}}const CBe=236,jBe=126,vB=16,kB=20,NBe=64,N2="application/x-omb-computer";function Gm(e,t=[]){const a=new Map(t.map((o,i)=>[o,i]));return[...e].sort((o,i)=>(a.get(o.id)??1/0)-(a.get(i.id)??1/0))}function ABe(e,t,a){const o=e.map(s=>s.id);if(!o.includes(t))return o;const i=o.filter(s=>s!==t);return i.splice(Math.max(0,Math.min(i.length,a)),0,t),i}function MBe(e){try{const t=JSON.parse(e??"null");return t===null||typeof t!="object"||Array.isArray(t)?{}:Object.fromEntries(Object.entries(t).flatMap(([a,o])=>Array.isArray(o)?[[a,[...new Set(o.filter(i=>typeof i=="string"&&i.length>0))]]]:[]))}catch{return{}}}function IBe(e){const t=e.chiefs.length>0&&e.members.length>0,a=t?Math.max(e.chiefs.length,e.members.length):Math.max(1,e.chiefs.length+e.members.length);return{width:CBe*(t?2:1)+kB*2+(t?40:0),height:NBe+kB+a*(jBe+vB)-vB}}function PBe(e,t){const a=e.map(IBe),o=Math.max(0,...a.filter((s,r)=>r%2===0).map(s=>s.width));let i=40;return e.map((s,r)=>{r>0&&r%2===0&&(i+=Math.max(a[r-2].height,a[r-1].height)+56);const c=Object.hasOwn(t,s.key)?t[s.key]:void 0;return{key:s.key,x:c?.x??(r%2===0?40:40+o+56),y:c?.y??i,...a[r]}})}function TBe(e,t,a){if(!e.length)return{x:0,y:0,scale:1};const o=Math.min(...e.map(d=>d.x)),i=Math.min(...e.map(d=>d.y)),s=Math.max(...e.map(d=>d.x+d.width))-o,r=Math.max(...e.map(d=>d.y+d.height))-i,c=Math.max(.3,Math.min(1,(t-80)/s,(a-80)/r));return{x:(t-s*c)/2-o*c,y:(a-r*c)/2-i*c,scale:c}}function wB(e,t,a){const o=t/e.scale;return{x:a.x-(a.x-e.x)*o,y:a.y-(a.y-e.y)*o,scale:t}}function BBe(e){try{const t=JSON.parse(e??"null");return t===null||typeof t!="object"||Array.isArray(t)?{}:Object.fromEntries(Object.entries(t).flatMap(([a,o])=>{if(o===null||typeof o!="object"||Array.isArray(o))return[];const{x:i,y:s}=o;return typeof i=="number"&&Number.isFinite(i)&&Math.abs(i)<1e5&&typeof s=="number"&&Number.isFinite(s)&&Math.abs(s)<1e5?[[a,{x:i,y:s}]]:[]}))}catch{return{}}}const Mh="flex size-9 shrink-0 items-center justify-center rounded-lg text-ink-secondary hover:bg-control hover:text-ink focus-visible:outline-2 focus-visible:outline-accent",gy="flex w-full items-center gap-2 rounded-lg px-3 py-2.5 text-left text-[12px] text-ink-secondary hover:bg-control hover:text-ink";function EBe({bot:e,selected:t,moving:a,connected:o,onComputer:i,onArrange:s}){const{state:r,dispatch:c}=ve(),d=SBe(e),p=r.instances.find(g=>g.instanceId===e.modelSelection.instanceId),h=p?.models.options.find(g=>g.id===e.modelSelection.model)?.label??e.modelSelection.model;return n.jsxs("article",{className:V("relative h-[126px] w-[236px] shrink-0 rounded-xl border bg-card shadow-sm transition-colors",t?"border-accent/60 ring-1 ring-accent/15":o?"border-accent/40":"border-hairline/50 hover:border-ink-secondary/40",a&&"opacity-35"),children:[n.jsxs("button",{"data-bot-id":e.id,"aria-label":l("canvas.editBot",{name:e.name}),onClick:()=>c({type:"toggleSettings",botId:e.id,section:"identity",open:!0}),title:s?l("canvas.reorderHint"):void 0,onKeyDown:g=>{!s||!g.altKey||g.key!=="ArrowUp"&&g.key!=="ArrowDown"||(g.preventDefault(),g.stopPropagation(),s(e,g.key==="ArrowUp"?-1:1))},className:"flex h-[82px] w-full cursor-grab items-center gap-3 rounded-t-xl px-4 text-left active:cursor-grabbing focus-visible:outline-2 focus-visible:outline-accent",children:[n.jsx(Jt,{bot:e,size:38,motion:"none",motionKey:0,animated:!1}),n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"truncate text-[14px] font-semibold",children:e.name}),e.chiefOfStaff&&n.jsx(cp,{size:12,className:"shrink-0 text-warning","aria-label":l("chat.chiefOfStaff")})]}),n.jsx("span",{className:"mt-1 block truncate text-[11px] text-ink-secondary",children:e.title||(e.chiefOfStaff?l("chat.chiefOfStaff"):l("canvas.bot"))})]})]}),n.jsxs("div",{className:"flex h-[43px] items-center gap-1 border-t border-hairline/30 px-2",children:[n.jsx("button",{className:V(Mh,"size-8"),"aria-label":l("canvas.openBotChat",{name:e.name}),title:l("canvas.openChat"),onClick:()=>c(sa(e)),children:n.jsx(RJ,{size:13})}),d.tone!=="idle"&&n.jsxs("span",{className:"flex items-center gap-1.5 text-[10px] text-ink-secondary",title:d.label,children:[n.jsx("span",{className:V("size-1.5 rounded-full",d.tone==="success"?"bg-success":d.tone==="warning"?"bg-warning":d.tone==="danger"?"bg-danger":"bg-ink-secondary/35")}),d.label]}),t&&i&&n.jsx("button",{className:V(Mh,"size-8"),"aria-label":l("canvas.botComputer",{name:e.name}),title:l("computer.tab.computer"),onClick:()=>i(e),children:n.jsx(Ba,{size:13})}),n.jsxs("button",{"aria-label":l("canvas.changeModel",{name:e.name}),title:`${l("canvas.defaultModel")}: ${h}`,onClick:()=>c({type:"toggleSettings",botId:e.id,section:"model",open:!0}),className:"ml-auto flex h-8 min-w-0 max-w-[130px] items-center gap-1.5 rounded-md px-2 text-[10px] text-ink-secondary hover:bg-control hover:text-ink focus-visible:outline-2 focus-visible:outline-accent",children:[n.jsx("span",{className:"flex size-3.5 shrink-0 items-center justify-center",children:p?n.jsx(Il,{instance:p,size:13}):n.jsx(hd,{driverKind:"",size:13})}),n.jsx("span",{className:"truncate",children:h||l("canvas.defaultModel")})]})]})]})}function RBe({sections:e,canManage:t,onMove:a,onInstructions:o,onEditTeam:i,onDeleteTeam:s,onComputer:r,onComputerDrop:c,onTeamComputer:d,teamComputers:p={},connectedBotIds:h=[]}){const{state:g}=ve(),b=f.useRef(null),x=f.useRef(null),v=f.useRef(!1),k=f.useRef(!1),S=f.useRef(null),[N,C]=f.useState({}),[j,M]=f.useState({}),[D,A]=f.useState({x:40,y:40,scale:1}),[R,P]=f.useState(null),[O,T]=f.useState(null),[z,B]=f.useState(null),[L,G]=f.useState(null),[K,H]=f.useState(null),[U,Q]=f.useState(""),[W,q]=f.useState(!1),[Z,oe]=f.useState(null),_=f.useMemo(()=>PBe(e,N),[e,N]),ue=f.useRef({view:D,positions:N,tiles:_,selectedId:g.selectedId,settingsOpen:g.settingsOpen});ue.current={view:D,positions:N,tiles:_,selectedId:g.selectedId,settingsOpen:g.settingsOpen},f.useEffect(()=>{let de=!0;return X("/.well-known/openmausbot/environment",{signal:AbortSignal.timeout(5e3)}).then(pe=>{if(!(!de||typeof pe.environmentId!="string")){S.current=`omb-team-canvas:${pe.environmentId}`;try{const ke=BBe(localStorage.getItem(S.current));C(Ge=>({...ke,...Ge})),M(MBe(localStorage.getItem(`${S.current}:bot-order`)))}catch{}}}).catch(()=>{}).finally(()=>{de&&q(!0)}),()=>{de=!1}},[]);const he=de=>{if(C(de),!!S.current)try{localStorage.setItem(S.current,JSON.stringify(Object.fromEntries(e.filter(pe=>Object.hasOwn(de,pe.key)).map(pe=>[pe.key,de[pe.key]]))))}catch{}},we=de=>Object.hasOwn(j,de)?j[de]:[],ee=(de,pe,ke,Ge)=>{const Ee={...j,[de.key]:[...ABe(pe,ke.id,Ge),...Gm(ke.chiefOfStaff?de.members:de.chiefs,we(de.key)).map(ce=>ce.id)]};if(M(Ee),S.current)try{localStorage.setItem(`${S.current}:bot-order`,JSON.stringify(Ee))}catch{}Q(l("canvas.arrangedBot",{name:ke.name,team:de.name}))},Y=(de,pe)=>{const ke=e.find(Ee=>Ee.key===(de.section?.trim()??""));if(!ke)return;const Ge=Gm(de.chiefOfStaff?ke.chiefs:ke.members,we(ke.key));ee(ke,Ge,de,Ge.findIndex(Ee=>Ee.id===de.id)+pe)},ne=f.useCallback(()=>{const de=b.current?.getBoundingClientRect();de&&A(TBe(ue.current.tiles,de.width,de.height))},[]);f.useEffect(()=>{const de=b.current;if(!de)return;let pe=null;const ke=new ResizeObserver(()=>{const Ge=de.getBoundingClientRect();if(!pe)ne();else{const Ee=ue.current.settingsOpen?[...de.querySelectorAll("[data-bot-id]")].find(le=>le.dataset.botId===ue.current.selectedId)?.getBoundingClientRect():void 0,ce=Ee?Ge.width/2-(Ee.left-Ge.left+Ee.width/2):(Ge.width-pe.width)/2,Ue=Ee?Ge.height/2-(Ee.top-Ge.top+Ee.height/2):(Ge.height-pe.height)/2;A(le=>({...le,x:le.x+ce,y:le.y+Ue}))}pe={width:Ge.width,height:Ge.height}});return ke.observe(de),()=>ke.disconnect()},[ne]);const ae=JSON.stringify(_.map(({key:de,width:pe,height:ke})=>[de,pe,ke]));f.useEffect(()=>{ne()},[ne,ae,W]),f.useEffect(()=>{const de=b.current?.querySelector("details[open]"),pe=b.current?.getBoundingClientRect();de&&pe&&oe(de.getBoundingClientRect().bottom>pe.bottom-210*D.scale?de.closest("[data-team-key]")?.dataset.teamKey??null:null)},[D,ae]),f.useEffect(()=>{const de=b.current;if(!de)return;const pe=ke=>{if(ke.target.closest("details[open]")||(ke.preventDefault(),x.current))return;const Ge=ue.current.view,Ee=de.getBoundingClientRect();if(ke.ctrlKey||ke.metaKey){const ce=Math.min(1.5,Math.max(.3,Ge.scale*Math.exp(-ke.deltaY*.006)));A(wB(Ge,ce,{x:ke.clientX-Ee.left,y:ke.clientY-Ee.top}))}else{const ce=ke.deltaMode===1?16:ke.deltaMode===2?Ee.height:1;A({...Ge,x:Ge.x-ke.deltaX*ce,y:Ge.y-ke.deltaY*ce})}};return de.addEventListener("wheel",pe,{passive:!1}),()=>de.removeEventListener("wheel",pe)},[]);const je=de=>{if(de.button!==0||!de.isPrimary||x.current)return;const pe=de.target,ke=pe.closest("[data-bot-id]")?.dataset.botId,Ge=pe.closest("[data-arrange-team]")?.dataset.arrangeTeam,Ee=ke?e.flatMap(le=>[...le.chiefs,...le.members]).find(le=>le.id===ke):void 0;if(!Ee&&Ge===void 0&&pe.closest("button, details, a, input, [data-team-key]")||Ee&&(K||!W)||Ge!==void 0&&!W)return;const ce={id:de.pointerId,start:{x:de.clientX,y:de.clientY},view:D,positions:N,moved:!1},Ue=Ge===void 0?void 0:_.find(le=>le.key===Ge);x.current=Ee?{...ce,kind:"bot",bot:Ee}:Ue?{...ce,kind:"team",key:Ue.key,origin:Ue}:{...ce,kind:"pan"},v.current=!1},xe=(de,pe)=>{const ke=document.elementFromPoint(de,pe)?.closest("[data-team-key]");return ke&&b.current?.contains(ke)?ke.dataset.teamKey??null:null},re=(de,pe)=>{const ke=e.find(le=>le.key===(de.section?.trim()??""));if(!ke)return null;const Ge=Gm(de.chiefOfStaff?ke.chiefs:ke.members,we(ke.key)),Ee=Ge.filter(le=>le.id!==de.id),ce=[...b.current?.querySelectorAll("[data-bot-id]")??[]],Ue=Ee.findIndex(le=>{const Fe=ce.find(tt=>tt.dataset.botId===le.id)?.closest("article")?.getBoundingClientRect();return Fe?pe<Fe.top+Fe.height/2:!1});return{section:ke,lane:Ge,remaining:Ee,index:Ue<0?Ee.length:Ue}},Se=de=>{const pe=x.current;if(!pe||pe.id!==de.pointerId)return;if(de.buttons===0){Be(de,!0);return}const ke=de.clientX-pe.start.x,Ge=de.clientY-pe.start.y;if(!(!pe.moved&&Math.hypot(ke,Ge)<5)&&(pe.moved=!0,de.currentTarget.setPointerCapture(de.pointerId),pe.kind==="pan"&&A({...pe.view,x:pe.view.x+ke,y:pe.view.y+Ge}),pe.kind==="team"&&C({...pe.positions,[pe.key]:{x:pe.origin.x+ke/D.scale,y:pe.origin.y+Ge/D.scale}}),pe.kind==="bot")){const Ee=de.currentTarget.getBoundingClientRect();P({bot:pe.bot,point:{x:de.clientX-Ee.left,y:de.clientY-Ee.top}});const ce=xe(de.clientX,de.clientY),Ue=ce===(pe.bot.section?.trim()??"");T(Ue||t?ce:null);const le=Ue?re(pe.bot,de.clientY):null,Fe=le?.remaining[le.index]??le?.remaining.at(-1);G(le&&Fe?{botId:Fe.id,after:le.index===le.remaining.length}:null)}},Be=(de,pe=!1)=>{const ke=x.current;if(!(!ke||de&&ke.id!==de.pointerId)){if(x.current=null,v.current=ke.moved,window.setTimeout(()=>{v.current=!1},0),P(null),T(null),G(null),b.current?.hasPointerCapture(ke.id)&&b.current.releasePointerCapture(ke.id),pe){C(ke.positions),A(ke.view);return}if(ke.moved&&(ke.kind==="team"&&de&&he({...ke.positions,[ke.key]:{x:ke.origin.x+(de.clientX-ke.start.x)/ke.view.scale,y:ke.origin.y+(de.clientY-ke.start.y)/ke.view.scale}}),ke.kind==="bot"&&de)){const Ge=xe(de.clientX,de.clientY);if(Ge===null)return;if(Ge===(ke.bot.section?.trim()??"")){const Ee=re(ke.bot,de.clientY);Ee&&ee(Ee.section,Ee.lane,ke.bot,Ee.index);return}if(!t)return;H(ke.bot.id),Q(l("canvas.reviewMove",{name:ke.bot.name,team:Ge||l("settings.section.general")})),a(ke.bot,Ge).then(Ee=>{Q(Ee===!1?l("canvas.moveCancelled"):l("canvas.moved",{name:ke.bot.name,team:Ge||l("settings.section.general")}))}).catch(Ee=>{Q(Ee instanceof Error?Ee.message:String(Ee))}).finally(()=>H(null))}}},nt=de=>{const pe=b.current?.getBoundingClientRect();pe&&A(wB(D,Math.max(.3,Math.min(1.5,D.scale*de)),{x:pe.width/2,y:pe.height/2}))},ge=e.find(de=>de.key===O),Qe=z!==null?l("canvas.assignComputer",{team:e.find(de=>de.key===z)?.name??z}):R&&ge?(R.bot.section?.trim()??"")===ge.key?l("canvas.arrangeBot",{name:R.bot.name,team:ge.name}):l("canvas.moveBot",{name:R.bot.name,team:ge.name}):null;return n.jsxs("div",{ref:b,role:"region","aria-label":l("canvas.region"),tabIndex:0,"data-team-canvas":!0,className:"relative min-h-0 flex-1 touch-none overflow-clip outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent/40",style:{backgroundImage:"radial-gradient(circle, color-mix(in srgb, var(--color-ink-secondary) 18%, transparent) 1px, transparent 1px)",backgroundSize:`${24*D.scale}px ${24*D.scale}px`,backgroundPosition:`${D.x}px ${D.y}px`},onPointerDown:je,onPointerMove:Se,onPointerUp:de=>Be(de),onPointerCancel:de=>Be(de,!0),onDragOver:de=>{if(!t||!c||!de.dataTransfer.types.includes(N2))return;const pe=de.target.closest("[data-team-key]"),ke=pe&&de.currentTarget.contains(pe)?pe.dataset.teamKey??null:null;B(ke),ke!==null&&(de.preventDefault(),de.dataTransfer.dropEffect="link")},onDragLeave:de=>{(!(de.relatedTarget instanceof Node)||!de.currentTarget.contains(de.relatedTarget))&&B(null)},onDrop:de=>{if(B(null),!t||!c||!de.dataTransfer.types.includes(N2))return;const pe=de.target.closest("[data-team-key]"),ke=pe&&de.currentTarget.contains(pe)?pe.dataset.teamKey:void 0,Ge=de.dataTransfer.getData(N2);ke===void 0||!e.some(Ee=>Ee.key===ke)||!Ge||(de.preventDefault(),c(Ge,ke))},onDragEnd:()=>B(null),onPointerDownCapture:de=>{k.current=!1,de.target.closest("details")||de.currentTarget.querySelectorAll("details[open]").forEach(pe=>pe.removeAttribute("open"))},onKeyDownCapture:de=>{de.key==="Tab"&&(k.current=!0)},onPointerLeave:()=>{x.current&&!x.current.moved&&Be(void 0,!0)},onLostPointerCapture:()=>{x.current&&Be(void 0,!0)},onFocusCapture:de=>{if(!k.current||!(de.target instanceof HTMLElement)||!de.target.closest("[data-canvas-world]"))return;const pe=de.currentTarget.getBoundingClientRect(),ke=de.target.getBoundingClientRect(),Ge=ke.left<pe.left+16?pe.left+16-ke.left:ke.right>pe.right-16?pe.right-16-ke.right:0,Ee=ke.top<pe.top+16?pe.top+16-ke.top:ke.bottom>pe.bottom-70?pe.bottom-70-ke.bottom:0;(Ge||Ee)&&A(ce=>({...ce,x:ce.x+Ge,y:ce.y+Ee}))},onClickCapture:de=>{v.current&&(v.current=!1,de.preventDefault(),de.stopPropagation())},onKeyDown:de=>{if(de.key==="Escape"&&(Be(void 0,!0),de.currentTarget.querySelectorAll("details[open]").forEach(Ge=>{Ge.querySelector("summary")?.focus({preventScroll:!0}),Ge.removeAttribute("open")})),de.target!==de.currentTarget)return;const ke={ArrowLeft:{x:60,y:0},ArrowRight:{x:-60,y:0},ArrowUp:{x:0,y:60},ArrowDown:{x:0,y:-60}}[de.key];ke&&(de.preventDefault(),A({...D,x:D.x+ke.x,y:D.y+ke.y})),(de.key==="+"||de.key==="=")&&(de.preventDefault(),nt(1.2)),de.key==="-"&&(de.preventDefault(),nt(1/1.2)),de.key==="0"&&(de.preventDefault(),ne())},children:[n.jsx("div",{"data-canvas-world":!0,className:"absolute left-0 top-0 origin-top-left",style:{transform:`translate(${D.x}px, ${D.y}px) scale(${D.scale})`},children:e.map((de,pe)=>{const ke=_[pe],Ge=de.chiefs.length>0&&de.members.length>0,Ee=z===de.key||R&&O===de.key&&(R.bot.section?.trim()??"")!==de.key,ce=Object.hasOwn(p,de.key)?p[de.key]:void 0,Ue=le=>n.jsxs("div",{className:"relative",children:[L?.botId===le.id&&n.jsx("div",{className:V("pointer-events-none absolute inset-x-1 h-0.5 rounded bg-accent",L.after?"-bottom-[9px]":"-top-[9px]")}),n.jsx(EBe,{bot:le,selected:g.selectedId===le.id&&g.settingsOpen,moving:R?.bot.id===le.id||K===le.id,connected:h.includes(le.id),onComputer:r,onArrange:W?Y:void 0})]},le.id);return n.jsxs("section",{"data-team-key":de.key,"aria-label":l("canvas.teamRegion",{name:de.name}),className:V("absolute rounded-2xl border bg-panel/90 shadow-sm has-[details[open]]:z-20 data-[computer-dropping=true]:border-accent data-[computer-dropping=true]:ring-2 data-[computer-dropping=true]:ring-accent/25",Ee?"border-accent ring-2 ring-accent/25":"border-hairline/50"),style:{left:ke.x,top:ke.y,width:ke.width,height:ke.height},children:[n.jsxs("header",{className:"flex h-16 items-center gap-2 px-5",children:[n.jsx("button",{"data-arrange-team":de.key,disabled:!W,"aria-label":l("canvas.arrange",{name:de.name}),title:l("canvas.arrangeHint"),className:"min-w-0 flex-1 cursor-grab rounded-md py-2 text-left active:cursor-grabbing focus-visible:outline-2 focus-visible:outline-accent",onKeyDown:le=>{const Fe={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,-1],ArrowDown:[0,1]}[le.key];if(!Fe)return;le.preventDefault(),le.stopPropagation();const tt=le.shiftKey?40:10;he({...N,[de.key]:{x:ke.x+Fe[0]*tt,y:ke.y+Fe[1]*tt}})},children:n.jsx("h2",{className:"truncate text-[13px] font-semibold tracking-tight",children:de.name})}),ce&&n.jsxs("button",{"aria-label":l("canvas.teamComputer",{team:de.name,name:ce.name}),title:`${ce.name}${ce.state?` · ${ce.state}`:""}`,disabled:!d,onClick:()=>d?.(de.key),className:"flex min-w-0 max-w-[120px] shrink items-center gap-1.5 rounded-md px-1.5 py-2 text-[10px] text-ink-secondary hover:bg-control hover:text-ink focus-visible:outline-2 focus-visible:outline-accent disabled:pointer-events-none",children:[n.jsx(Ba,{size:12,className:"shrink-0"}),n.jsx("span",{className:"truncate",children:ce.name})]}),n.jsx("span",{className:"text-[11px] tabular-nums text-ink-secondary",children:de.chiefs.length+de.members.length}),t&&n.jsxs("details",{className:"relative",onToggle:le=>{if(le.currentTarget.open){const Fe=b.current?.getBoundingClientRect();oe(Fe&&le.currentTarget.getBoundingClientRect().bottom>Fe.bottom-210*D.scale?de.key:null),b.current?.querySelectorAll("details[open]").forEach(tt=>{tt!==le.currentTarget&&tt.removeAttribute("open")})}},children:[n.jsx("summary",{"aria-label":l("canvas.manageTeam",{name:de.name}),className:V(Mh,"cursor-pointer list-none [&::-webkit-details-marker]:hidden"),children:n.jsx(Fl,{size:17})}),n.jsxs("div",{className:V("absolute right-0 z-30 w-[220px] rounded-xl border border-hairline bg-panel p-1.5 shadow-xl",Z===de.key?"bottom-10":"top-10"),onClick:le=>{const Fe=le.currentTarget.closest("details");Fe?.querySelector("summary")?.focus(),Fe?.removeAttribute("open")},children:[n.jsxs("button",{className:gy,onClick:()=>i(de.key),"aria-label":l("team.moveTo",{name:de.name}),children:[n.jsx(bi,{size:14}),l("team.moveTo",{name:de.name})]}),n.jsxs("button",{className:gy,onClick:()=>o(de.key,de.name),"aria-label":l("team.instructionsEdit",{name:de.name}),children:[n.jsx(Ms,{size:14}),l("team.instructions")]}),de.key&&n.jsxs("button",{className:gy,onClick:()=>i(de.key,!0),"aria-label":l("team.renameAria",{name:de.name}),children:[n.jsx(qi,{size:14}),l("team.rename")]}),de.key&&n.jsxs("button",{className:V(gy,"hover:text-danger"),onClick:()=>s(de.key),"aria-label":l("team.deleteAria",{name:de.name}),children:[n.jsx(xn,{size:14}),l("team.delete")]})]})]})]}),Ee&&n.jsx("div",{className:"pointer-events-none absolute -top-7 left-2 z-30 max-w-[calc(100%-16px)] truncate rounded-md bg-accent px-2 py-1 text-[10px] text-white shadow-sm",children:Qe}),n.jsxs("div",{className:"flex items-center px-5 pb-5",children:[de.chiefs.length>0&&n.jsx("div",{className:"flex flex-col gap-4",children:Gm(de.chiefs,we(de.key)).map(Ue)}),Ge&&n.jsx("div",{className:"flex w-10 shrink-0 justify-center text-ink-secondary/35","aria-hidden":"true",children:n.jsx(fg,{size:22,strokeWidth:1})}),de.members.length>0&&n.jsx("div",{className:"flex flex-col gap-4",children:Gm(de.members,we(de.key)).map(Ue)}),de.chiefs.length+de.members.length===0&&n.jsx("p",{className:"flex h-[126px] w-[236px] items-center justify-center rounded-xl border border-dashed border-hairline/70 px-6 text-center text-[12px] leading-relaxed text-ink-secondary",children:l("canvas.dropHere")})]})]},de.key)})}),R&&n.jsxs("div",{className:"pointer-events-none absolute z-40 rounded-xl border border-accent/40 bg-card px-4 py-3 text-[13px] shadow-lg",style:{left:R.point.x+16,top:R.point.y+16},children:[n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(Jt,{bot:R.bot,size:24,animated:!1}),R.bot.name]}),Qe&&n.jsx("p",{className:"mt-1 text-[10px] text-ink-secondary",children:Qe})]}),n.jsxs("div",{className:"pointer-events-none absolute inset-x-5 bottom-5 flex items-end justify-between gap-3",children:[n.jsxs("div",{className:"min-w-0 rounded-lg bg-app/90 px-2 py-1.5 text-[11px] text-ink-secondary",children:[n.jsx("p",{className:"max-sm:hidden",children:l("canvas.hint")}),n.jsx("p",{role:"status","aria-live":"polite",className:"max-w-[440px]",children:Qe??U})]}),n.jsxs("div",{className:"pointer-events-auto flex shrink-0 items-center gap-0.5 rounded-xl border border-hairline/60 bg-panel p-1 shadow-sm",children:[n.jsx("button",{className:Mh,"aria-label":l("canvas.zoomOut"),onClick:()=>nt(1/1.2),children:n.jsx($B,{size:15})}),n.jsxs("button",{className:"min-w-12 rounded-md px-1 py-2 text-[11px] tabular-nums text-ink-secondary hover:bg-control","aria-label":l("canvas.fit"),title:l("canvas.fitHint"),onClick:ne,children:[Math.round(D.scale*100),"%"]}),n.jsx("button",{className:Mh,"aria-label":l("canvas.zoomIn"),onClick:()=>nt(1.2),children:n.jsx(vn,{size:15})})]})]})]})}const fs="rounded-lg px-3 py-2 text-[12px] text-ink-secondary hover:bg-control hover:text-ink disabled:opacity-40",SB="w-full rounded-lg border border-hairline/60 bg-inset px-3 py-2 text-[12px] text-ink outline-none focus:border-accent";function DBe({open:e,createRequest:t,drop:a,sections:o,onClose:i,onDropHandled:s,onChange:r}){const{dispatch:c}=ve(),[d,p]=f.useState(null),[h,g]=f.useState(!1),[b,x]=f.useState(""),[v,k]=f.useState(""),[S,N]=f.useState(null),[C,j]=f.useState(!1),[M,D]=f.useState(""),A=f.useRef(crypto.randomUUID()),R=f.useRef(null),P=f.useRef(null),O=f.useRef(null),T=f.useRef(!1),z=f.useRef(!0),B=f.useRef(null),L=f.useRef(r);L.current=r;const[G,K]=f.useState(null),[H,U]=f.useState(null),[Q,W]=f.useState(null),q=f.useRef(crypto.randomUUID()),Z=f.useRef(null),oe=f.useRef(null),_=f.useRef(null),ue=f.useRef(null),[he,we]=f.useState(null),ee=f.useCallback(()=>{const ge=_.current;_.current=null,ue.current?.removeAttribute("data-computer-dropping"),ue.current=null,ge?.handle.hasPointerCapture(ge.id)&&ge.handle.releasePointerCapture(ge.id),we(null)},[]);f.useEffect(()=>(e||ee(),()=>{ue.current?.removeAttribute("data-computer-dropping")}),[e,ee]),f.useEffect(()=>{Z.current=Q},[Q]),f.useEffect(()=>()=>{const ge=Z.current;ge&&fetch(`/api/team-computers/${encodeURIComponent(ge)}/control`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"release",controlLeaseId:q.current}),keepalive:!0}).catch(()=>{})},[]);const Y=f.useCallback((ge,Qe)=>{if(!(T.current||ge.section===Qe)){if(ge.section!==null&&Qe!==null){x(`Unassign ${ge.name} from ${ge.section||"General"} before moving it to another team. Its files and signed-in accounts stay on the computer.`);return}x(""),K({computer:ge,section:Qe})}},[]),ne=(ge,Qe)=>{const de=oe.current?.parentElement?.querySelector("[data-team-canvas]"),pe=document.elementFromPoint(ge,Qe)?.closest("[data-team-key]");return pe&&de?.contains(pe)&&o.some(ke=>ke.key===pe.dataset.teamKey)?pe:null},ae=ge=>{const Qe=_.current;if(!Qe||ge.pointerId!==Qe.id)return;if(ge.buttons===0){ee();return}if(!Qe.moved&&Math.hypot(ge.clientX-Qe.x,ge.clientY-Qe.y)<5)return;Qe.moved=!0,ge.currentTarget.setPointerCapture(ge.pointerId);const de=ne(ge.clientX,ge.clientY);ue.current!==de&&(ue.current?.removeAttribute("data-computer-dropping"),de?.setAttribute("data-computer-dropping","true"),ue.current=de);const pe=de?o.find(ke=>ke.key===de.dataset.teamKey):null;we({name:Qe.computer.name,x:ge.clientX,y:ge.clientY,hint:pe?Qe.computer.section!==null&&Qe.computer.section!==pe.key?"Unassign before moving to another team":`Assign to ${pe.name}`:"Drop onto a team"})},je=ge=>{const Qe=_.current;if(!Qe||Qe.id!==ge.pointerId)return;const de=Qe.moved?ne(ge.clientX,ge.clientY)?.dataset.teamKey:void 0;ee(),de!==void 0&&Y(Qe.computer,de)},xe=f.useCallback(async()=>{B.current?.abort();const ge=new AbortController;B.current=ge,g(!0);try{const Qe=await X("/api/team-computers",{signal:AbortSignal.any([ge.signal,AbortSignal.timeout(3e4)])});if(ge.signal.aborted||!z.current)return;p(Qe),k(""),L.current(Qe.computers)}catch(Qe){!ge.signal.aborted&&z.current&&k(Qe instanceof Error?Qe.message:String(Qe))}finally{!ge.signal.aborted&&z.current&&g(!1)}},[]);f.useEffect(()=>(z.current=!0,xe(),()=>{z.current=!1,B.current?.abort()}),[xe]),f.useEffect(()=>{if(!e)return;xe();const ge=window.setInterval(()=>{!T.current&&document.visibilityState==="visible"&&xe()},2e4);return()=>window.clearInterval(ge)},[e,xe]),f.useEffect(()=>{t>0&&j(!0)},[t]),f.useEffect(()=>{if(!e)return;const ge=document.activeElement instanceof HTMLElement?document.activeElement:null;return O.current?.focus(),()=>{ge?.isConnected&&ge.focus()}},[e]),f.useEffect(()=>{e&&C&&P.current?.focus()},[e,C]),f.useEffect(()=>{if(!a)return;const ge=d?.computers.find(Qe=>Qe.id===a.id);ge&&Y(ge,a.section),s()},[a,d,s,Y]);const re=async(ge,Qe,de,pe)=>{if(!T.current){T.current=!0,N(ge),x(""),B.current?.abort();try{const ke=await Qe();z.current&&de?.(ke)}catch(ke){z.current&&(x(ke instanceof Error?ke.message:String(ke)),pe?.())}finally{T.current=!1,z.current&&(N(null),await xe())}}},Se=f.useCallback(()=>K(null),[]),Be=(ge,Qe,de={})=>X(`/api/team-computers/${encodeURIComponent(ge)}/${Qe}`,{method:"POST",body:JSON.stringify(de)}),nt=()=>{i(),c({type:"toggleAppSettings",open:!0,section:"computer"})};return n.jsxs(n.Fragment,{children:[e&&n.jsxs("aside",{ref:oe,"aria-label":"Team computers",onKeyDown:ge=>{ge.key==="Escape"&&!G&&(ge.stopPropagation(),_.current?ee():i())},className:"flex w-[300px] max-w-[90vw] shrink-0 flex-col border-l border-hairline/50 bg-panel max-sm:absolute max-sm:inset-y-0 max-sm:right-0 max-sm:z-30 max-sm:shadow-xl",children:[n.jsxs("header",{className:"flex items-center gap-2 border-b border-hairline/40 px-4 py-3",children:[n.jsx(Ba,{size:16,className:"text-ink-secondary"}),n.jsx("h2",{className:"flex-1 text-[13px] font-semibold",children:"Computers"}),n.jsx("button",{"aria-label":"Refresh computers",className:fs,disabled:h||S!==null,onClick:()=>{x(""),xe()},children:n.jsx(fn,{size:14,className:h?"animate-spin":""})}),n.jsx("button",{ref:O,"aria-label":"Close computers",className:fs,onClick:i,children:n.jsx(Nt,{size:15})})]}),n.jsxs("div",{className:"min-h-0 flex-1 space-y-3 overflow-y-auto p-4",children:[n.jsx("p",{className:"text-[12px] leading-relaxed text-ink-secondary",children:"Drag a computer onto a team, or choose its team below. Bots on Auto will use it."}),(b||v||d?.problem)&&n.jsx("p",{role:"alert",className:"rounded-lg bg-danger/10 p-3 text-[12px] text-danger",children:b||v||d?.problem}),d&&!d.configured&&n.jsxs("div",{className:"rounded-xl border border-hairline/50 p-3 text-[12px]",children:[n.jsx("p",{className:"text-ink-secondary",children:"Connect your Box account before creating a cloud computer."}),n.jsx("button",{className:`${fs} mt-2 border border-hairline/50`,onClick:nt,children:"Connect Box"})]}),C?n.jsxs("form",{className:"space-y-3 rounded-xl border border-hairline/60 bg-card p-3",onSubmit:ge=>{ge.preventDefault();const Qe=R.current??M.trim();!Qe||!d?.configured||(R.current=Qe,re("create",()=>X("/api/team-computers",{method:"POST",body:JSON.stringify({name:Qe,requestId:A.current,acknowledgeCost:!0})}),()=>{D(""),j(!1),A.current=crypto.randomUUID(),R.current=null},()=>{R.current=null}))},children:[n.jsx("label",{className:"block text-[12px] font-medium",htmlFor:"canvas-computer-name",children:"New Box computer"}),n.jsx("input",{ref:P,id:"canvas-computer-name",className:SB,value:M,maxLength:60,placeholder:"e.g. Engineering desktop",disabled:S!==null||R.current!==null,onChange:ge=>D(ge.target.value)}),n.jsx("p",{className:"text-[11px] leading-relaxed text-ink-secondary",children:"Creates a cloud machine in your connected boat.dev account. Your Box plan and usage charges apply. It stays unassigned until you choose a team."}),n.jsxs("div",{className:"flex justify-end gap-1",children:[n.jsx("button",{type:"button",className:fs,disabled:S!==null,onClick:()=>j(!1),children:"Cancel"}),n.jsxs("button",{type:"submit",className:"flex items-center gap-2 rounded-lg bg-accent px-3 py-2 text-[12px] font-medium text-white disabled:opacity-40",disabled:!d?.configured||!M.trim()||S!==null,children:[S==="create"&&n.jsx(Ie,{size:13,className:"animate-spin"}),"Create Box"]})]})]}):n.jsxs("button",{className:"flex w-full items-center justify-center gap-2 rounded-xl border border-dashed border-hairline/60 px-3 py-3 text-[12px] text-ink-secondary hover:bg-control hover:text-ink",disabled:S!==null,onClick:()=>j(!0),children:[n.jsx(vn,{size:14})," New Box computer"]}),d?.computers.map(ge=>{const Qe=["idle","ready","running"].includes(ge.state),de=["init","provisioning","provisioned","cloning","starting"].includes(ge.state),pe=Q===ge.id,ke=ge.held||pe;return n.jsxs("article",{"data-computer-id":ge.id,className:"rounded-xl border border-hairline/60 bg-card p-3",children:[n.jsxs("div",{"data-computer-drag-id":ge.id,role:"group",tabIndex:-1,"aria-label":`Drag ${ge.name} to a team`,onPointerDown:Ge=>{T.current||_.current||Ge.button!==0||!Ge.isPrimary||(Ge.currentTarget.focus({preventScroll:!0}),_.current={id:Ge.pointerId,x:Ge.clientX,y:Ge.clientY,moved:!1,computer:ge,handle:Ge.currentTarget},Ge.currentTarget.setPointerCapture(Ge.pointerId))},onPointerMove:ae,onPointerUp:je,onPointerCancel:ee,onLostPointerCapture:()=>{_.current&&ee()},className:"flex touch-none select-none cursor-grab items-center gap-2.5 rounded-lg py-1 outline-none active:cursor-grabbing",children:[n.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-lg bg-control text-ink-secondary",children:n.jsx(Ph,{size:18})}),n.jsxs("span",{className:"min-w-0",children:[n.jsx("span",{className:"block truncate text-[13px] font-medium",children:ge.name}),n.jsxs("span",{className:"block text-[11px] text-ink-secondary",children:["Box · ",S===ge.id?"Updating…":ge.state]})]})]}),ge.problem&&n.jsx("p",{className:"mt-2 text-[11px] text-danger",children:ge.problem}),n.jsxs("label",{className:"sr-only",htmlFor:`computer-team-${ge.id}`,children:["Team for ",ge.name]}),n.jsxs("select",{id:`computer-team-${ge.id}`,className:`${SB} mt-3`,disabled:S!==null,value:ge.section===null?"unassigned":`team:${ge.section}`,onChange:Ge=>Y(ge,Ge.target.value==="unassigned"?null:Ge.target.value.slice(5)),children:[n.jsx("option",{value:"unassigned",children:"Not assigned"}),o.filter(Ge=>ge.section===null||Ge.key===ge.section).map(Ge=>n.jsx("option",{value:`team:${Ge.key}`,children:Ge.name},Ge.key))]}),ge.section!==null&&n.jsx("p",{className:"mt-1.5 text-[10px] text-ink-secondary",children:"Unassign to move to another team."}),n.jsxs("div",{className:"mt-2 flex flex-wrap gap-1",children:[!Qe&&!de&&n.jsx("button",{className:fs,title:"Starts this Box; your provider's usage charges apply",disabled:S!==null||ke,onClick:()=>{re(ge.id,()=>Be(ge.id,"provision",{acknowledgeCost:!0}))},children:"Start / retry"}),Qe&&!ke&&n.jsx("button",{className:fs,disabled:S!==null,onClick:()=>{re(ge.id,()=>Be(ge.id,"sleep"))},children:"Sleep"}),Qe&&n.jsxs("button",{className:`${fs} flex items-center gap-1.5`,title:"Pauses bot control while you use the desktop",disabled:S!==null,onClick:()=>{re(ge.id,async()=>(await Be(ge.id,"control",{action:"take",controlLeaseId:q.current}),W(ge.id),Be(ge.id,"join")),Ge=>{typeof Ge.joinUrl=="string"&&Ge.joinUrl.startsWith("https://")&&U({id:ge.id,url:Ge.joinUrl})})},children:["Open desktop ",n.jsx(An,{size:11})]}),pe&&n.jsx("button",{className:`${fs} text-accent`,disabled:S!==null,onClick:()=>{re(ge.id,()=>Be(ge.id,"control",{action:"release",controlLeaseId:q.current}),()=>{W(null),U(null)})},children:"Return to bots"}),ge.held&&!pe&&n.jsx("button",{className:fs,disabled:!0,title:"Another viewer has paused bot control on this desktop",children:"In use"})]}),H?.id===ge.id&&n.jsx("a",{href:H.url,target:"_blank",rel:"noopener noreferrer",className:"mt-2 block rounded-lg px-3 py-2 text-[12px] text-accent hover:bg-control",children:"Open secure desktop ↗"})]},ge.id)})]}),n.jsx("footer",{className:"border-t border-hairline/40 p-3",children:n.jsx("button",{className:`${fs} w-full text-left`,onClick:nt,children:"Local VM and other computers…"})})]}),he&&Xn.createPortal(n.jsxs("div",{role:"status",className:"pointer-events-none fixed z-[70] rounded-xl border border-accent/40 bg-card px-4 py-3 text-[12px] text-ink shadow-xl",style:{left:he.x+14,top:he.y+14},children:[n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(Ph,{size:15}),he.name]}),n.jsx("p",{className:"mt-1 text-[10px] text-ink-secondary",children:he.hint})]}),document.body),n.jsx(Oa,{open:G!==null,tone:"neutral",title:G?.section===null?`Unassign ${G?.computer.name??"computer"}?`:`Assign ${G?.computer.name??"computer"} to ${G?.section||"General"}?`,body:G?.section===null?"This removes the team default. It does not stop or delete the machine, its files, or its logins. Review the bots' Auto routing before their next task.":"Bots on Auto in this team will share this computer's files and signed-in accounts. Explicit bot computer settings stay unchanged. Only one bot can use the desktop at a time. This does not move the OMB server or enable 24/7 hosting.",confirmLabel:G?.section===null?"Unassign computer":"Assign computer",onCancel:Se,onConfirm:()=>{const ge=G;ge&&(K(null),U(null),re(ge.computer.id,()=>X(`/api/team-computers/${encodeURIComponent(ge.computer.id)}`,{method:"PATCH",body:JSON.stringify({section:ge.section,acknowledgeSharedAccess:!0})})))}})]})}function OBe({edge:e,bots:t}){const{dispatch:a}=ve(),o=t.find(r=>r.id===e.sourceBotId),i=t.find(r=>r.id===e.targetBotId);if(!o||!i)return null;const s=e.state!=="connected";return n.jsxs("button",{onClick:()=>a(e.groupId?{type:"select",id:e.groupId}:sa(i)),className:"flex w-full items-center gap-3 rounded-xl border border-hairline/40 bg-card px-3 py-2.5 text-left transition hover:bg-raised/50",children:[n.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[n.jsx("span",{className:"truncate text-[13px] font-medium text-ink",children:o.name}),n.jsx(fg,{size:13,className:V("shrink-0",s?"text-accent":"text-ink-secondary")}),n.jsx("span",{className:"truncate text-[13px] font-medium text-ink",children:i.name})]}),e.reason&&n.jsx("span",{className:"max-w-[220px] truncate text-[11.5px] text-ink-secondary",children:e.reason}),n.jsx("span",{className:V("rounded-full px-2 py-0.5 text-[10.5px] font-medium",e.state==="running"?"bg-success/15 text-success":e.state==="queued"?"bg-warning/15 text-warning":"bg-control text-ink-secondary"),children:e.state==="running"?"Running":e.state==="queued"?"Queued":e.lastAt?Cs(e.lastAt):"Connected"})]})}function zBe({section:e,label:t,onClose:a}){const o=f.useRef(null),i=f.useRef(null),s=f.useRef(a),r=f.useRef(!1),c=f.useRef(!1),[d,p]=f.useState(""),[h,g]=f.useState(""),[b,x]=f.useState(24e3),[v,k]=f.useState(null),[S,N]=f.useState(!0),[C,j]=f.useState(!1),[M,D]=f.useState(null),A=d!==h,R=f.useMemo(()=>new TextEncoder().encode(d).byteLength,[d]);s.current=a,r.current=C,c.current=A;const P=f.useCallback(()=>{r.current||c.current&&!window.confirm(l("team.instructionsDiscard"))||s.current()},[]);f.useEffect(()=>{const T=document.activeElement instanceof HTMLElement?document.activeElement:null;o.current?.focus();const z=B=>{if(B.key==="Escape"&&!r.current){B.preventDefault(),P();return}if(B.key!=="Tab")return;const L=o.current;if(!L)return;const G=[...L.querySelectorAll('button:not([disabled]), textarea:not([disabled]), input:not([disabled]), [href], [tabindex]:not([tabindex="-1"])')];if(G.length===0){B.preventDefault(),L.focus();return}const K=G[0],H=G[G.length-1];B.shiftKey&&document.activeElement===K?(B.preventDefault(),H.focus()):!B.shiftKey&&document.activeElement===H&&(B.preventDefault(),K.focus())};return window.addEventListener("keydown",z),()=>{window.removeEventListener("keydown",z),T?.focus()}},[P]),f.useEffect(()=>{let T=!1;return N(!0),D(null),X(`/api/section-context?section=${encodeURIComponent(e)}`).then(z=>{T||(p(z.text),g(z.text),k(z.updatedAt),x(z.maxBytes),window.setTimeout(()=>i.current?.focus(),0))}).catch(z=>{T||D(z instanceof Error?z.message:String(z))}).finally(()=>{T||N(!1)}),()=>{T=!0}},[e]);const O=async()=>{if(!(R>b)){j(!0),D(null);try{const T=await X(`/api/section-context?section=${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify({text:d})});g(T.text),p(T.text),k(T.updatedAt),x(T.maxBytes)}catch(T){D(T instanceof Error?T.message:String(T))}finally{j(!1)}}};return Xn.createPortal(n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/55 p-4 backdrop-blur-[2px] sm:p-6",onMouseDown:T=>T.target===T.currentTarget&&P(),children:n.jsxs("div",{ref:o,role:"dialog","aria-modal":"true","aria-labelledby":"section-context-title",tabIndex:-1,className:"animate-pop-in flex max-h-[min(680px,calc(100dvh-2rem))] w-full max-w-[680px] flex-col overflow-hidden rounded-[24px] border border-hairline/50 bg-panel shadow-2xl shadow-black/50 outline-none",children:[n.jsxs("header",{className:"flex items-start justify-between gap-4 border-b border-hairline/40 px-6 pb-4 pt-6 sm:px-8 sm:pt-7",children:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Ms,{size:19,className:"text-accent"}),n.jsx("h2",{id:"section-context-title",className:"text-[20px] font-semibold tracking-[-0.01em] text-ink",children:l("team.instructionsTitle",{name:t})})]}),n.jsx("p",{className:"mt-1.5 max-w-[520px] text-[12.5px] leading-relaxed text-ink-secondary",children:l("team.instructionsHint")})]}),n.jsx("button",{onClick:P,disabled:C,"aria-label":l("team.instructionsClose"),className:"flex size-9 shrink-0 items-center justify-center rounded-lg text-ink-secondary hover:bg-raised hover:text-ink disabled:opacity-40",children:n.jsx(Nt,{size:19})})]}),n.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-6 py-5 sm:px-8",children:[S?n.jsx("div",{className:"flex min-h-[260px] items-center justify-center text-ink-secondary",children:n.jsx(Ie,{size:20,className:"animate-spin","aria-label":l("team.instructionsLoading")})}):n.jsxs(n.Fragment,{children:[n.jsx("textarea",{ref:i,value:d,onChange:T=>p(T.target.value),placeholder:`Goals
603
+ `)[0].slice(0,140):"Something went wrong."}function qTe({state:e,onOpen:t}){return n.jsxs("button",{type:"button",onClick:t,"data-update-reminder":!0,className:"animate-panel-in fixed bottom-4 left-4 z-50 flex items-center gap-1.5 rounded-full border border-accent/40 bg-panel px-3 py-1.5 text-[12.5px] font-medium text-accent shadow-lg shadow-black/30 hover:bg-control",children:[n.jsx(So,{size:13}),e.status==="downloaded"?`Restart to update${e.version?` to ${e.version}`:""}`:`Update available${e.version?`: ${e.version}`:""}`]})}function UTe(){const e=sC(),[t,a]=f.useState(null),[o,i]=f.useState(null),s=e?.status;if(f.useEffect(()=>i(null),[s]),!e||e.status==="idle"||e.status==="checking")return null;const r=`${e.status}:${e.version??""}`;if(t===r)return e.status!=="available"&&e.status!=="downloaded"?null:n.jsx(qTe,{state:e,onOpen:()=>a(null)});const c=window.ogb.updater,d=e.status==="installing",p=e.status==="preparing",h=e.status==="downloading"||p||d,g=e.installMode==="handoff",b=e.status==="available"?`${Ga().name} ${e.version} is available`:e.status==="downloading"?`Downloading ${e.version??"update"}…`:p?"Preparing update…":e.status==="downloaded"?`${e.version} is ready`:d?g?"Opening a terminal…":"Restarting to update…":e.status==="handed-off"?"Finish in a terminal":"Update failed",x=e.status==="available"?"A newer version is ready to download.":e.status==="downloading"?e.percent==null?"Starting download…":`${Math.round(e.percent)}%`:p?"Download complete. macOS is preparing the update.":e.status==="downloaded"?g?"Copy the install command and open a terminal.":"Restart to finish updating.":d?g?"Copying the command…":e.message||`${Ga().name} will reopen in a moment.`:e.status==="handed-off"?e.terminalOpened?"Command copied — paste it in the terminal that opened.":"Command copied — paste it in a terminal to finish.":e.retryable===!1?`${pB(e.message?.split(" Quit and reopen ")[0])} Quit and reopen ${Ga().name} before trying the update again.`:pB(e.message);return n.jsxs("div",{className:"animate-panel-in fixed bottom-4 left-4 z-50 w-[300px] rounded-xl border border-hairline/40 bg-panel p-3.5 shadow-2xl shadow-black/50",children:[n.jsxs("div",{className:"flex items-start gap-2.5",children:[n.jsx("span",{className:"mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-full bg-accent/15 text-accent",children:n.jsx(So,{size:14})}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"text-[13.5px] font-semibold text-ink",children:b}),n.jsx("div",{className:"mt-0.5 text-[12.5px] text-ink-secondary",title:x,children:x})]}),!h&&n.jsx("button",{onClick:()=>a(r),className:"shrink-0 rounded-md p-1 text-ink-secondary hover:bg-control hover:text-ink",title:"Dismiss",children:n.jsx(Nt,{size:14})})]}),e.status==="handed-off"&&e.command&&n.jsx("code",{className:"mt-2.5 block overflow-x-auto rounded-lg bg-control px-2 py-1.5 font-mono text-[11.5px] whitespace-pre text-ink-secondary",children:e.command}),e.status==="downloading"&&n.jsx("div",{className:"mt-2.5 h-1 overflow-hidden rounded-full bg-control",children:n.jsx("div",{className:V("h-full rounded-full bg-accent transition-[width]",e.percent==null&&"w-1/4 animate-pulse"),style:e.percent==null?void 0:{width:`${Math.min(100,Math.max(0,e.percent))}%`}})}),(p||d)&&n.jsx("div",{className:"mt-2.5 flex gap-2",children:n.jsxs("button",{disabled:!0,className:"flex flex-1 items-center justify-center gap-1.5 rounded-lg bg-control py-1.5 text-[13px] font-medium text-ink-secondary",children:[n.jsx(Ie,{size:13,className:"animate-spin"})," ",p?"Preparing…":g?"Opening…":"Restarting…"]})}),!h&&n.jsxs("div",{className:"mt-2.5 flex gap-2",children:[e.status==="available"&&n.jsx("button",{onClick:()=>{i("download"),c.download()},disabled:o!==null,className:uB,children:o==="download"?n.jsxs(n.Fragment,{children:[n.jsx(Ie,{size:13,className:"animate-spin"})," Starting…"]}):n.jsxs(n.Fragment,{children:[n.jsx(MB,{size:13})," Download"]})}),e.status==="downloaded"&&n.jsx("button",{onClick:()=>{i("install"),c.install()},disabled:o!==null,className:uB,children:o==="install"?n.jsxs(n.Fragment,{children:[n.jsx(Ie,{size:13,className:"animate-spin"})," ",g?"Opening…":"Restarting…"]}):g?n.jsxs(n.Fragment,{children:[n.jsx(XJ,{size:13})," Install"]}):n.jsxs(n.Fragment,{children:[n.jsx(fn,{size:13})," Restart to update"]})}),e.status==="error"&&e.retryable!==!1&&n.jsx("button",{onClick:()=>{i("check"),c.check()},disabled:o!==null,className:"flex flex-1 items-center justify-center gap-1.5 rounded-lg bg-control py-1.5 text-[13px] text-ink hover:bg-raised-hover disabled:text-ink-secondary disabled:hover:bg-control",children:o==="check"?n.jsxs(n.Fragment,{children:[n.jsx(Ie,{size:13,className:"animate-spin"})," Checking…"]}):"Try again"}),n.jsx("button",{onClick:()=>a(r),disabled:o!==null,className:"rounded-lg px-3 py-1.5 text-[13px] text-ink-secondary hover:bg-control hover:text-ink disabled:opacity-50 disabled:hover:bg-transparent",children:e.status==="handed-off"||e.retryable===!1?"Dismiss":"Later"})]})]})}const VTe=JSON.parse(`[{"version":"0.1.177","added":["You can attach any kind of file to a message, on the Mac, iPhone, iPad, Android, Windows and Linux. HTML and Markdown files go in as readable documents, and other files such as zips travel with the message as downloads."]},{"version":"0.1.176","added":["On iPhone and iPad, the model menu in a chat now has Choose a model. It lists every provider your subscriptions and API keys give you, with each provider's models and reasoning effort, and pins your pick to that thread."],"fixed":["On iPhone and iPad, the model menu in a chat no longer jumps back to the top while you scroll it. The model classes and the modes now open as their own short lists."]},{"version":"0.1.175","added":["Settings > Vault can import the logins you export from a password manager as a CSV file. Exports from Chrome, Edge, Safari, Firefox, 1Password, Bitwarden, LastPass, Dashlane, Proton Pass, NordPass and RoboForm all work.","About me now stays in step across Atomic, your PAW workspace and Nexus. A change in one place reaches the others, and if two places disagree, Settings > About me lets you pick which version to keep."],"fixed":["Dictation in the chat box works again after you use system-wide dictation. Since 0.1.174 the system-wide dictation kept the microphone in its echo-cancelling mode, so the chat box heard almost nothing.","When dictation hears nothing, Atomic now says so instead of asking you to check your Microphone and Speech Recognition permissions. A refused microphone is named as soon as dictation starts."]},{"version":"0.1.174","added":["Bots can now read, change and cancel existing Google and Outlook calendar events: title, description, location, time, guests and room, for one occurrence, this and following, or a whole recurring series. Changes that email guests ask for your approval first."],"fixed":["Claude no longer fails on every message on Macs with an older Claude Code. Atomic was passing it an option that only newer versions understand.","Dictation no longer types words you did not say. The microphone now filters out sound from your own speakers, such as Atomic reading aloud, a call or a video.","A dictation started with the shortcut now stops on its own after 20 seconds of silence, and after 10 minutes at most, so a take left running cannot pick up the room.","Words heard while you were in another app are no longer typed in a burst when you come back. They go on the clipboard, so you can paste them if they are yours.","Auto-correct can no longer add words to your dictation, and words the speech engine is unsure of are left out."]},{"version":"0.1.173","added":["Back up and restore your whole Atomic setup to another Mac (Settings), encrypted by default.","When you control This Mac from an iPhone or iPad, taps, touch and hold, drags and scrolls now reach the Mac. This is the desktop side of phone pointer control.","Settings > Engines and tiers can include free models in Auto. It is off by default, free models are tried only after your subscriptions and keys, and a bot marked as handling client data never uses them.","On iPhone and iPad, Atomic opens on the device you used last, either the iPhone or a computer. If that computer is no longer paired, it opens on the iPhone.","On iPhone and iPad, Home shows an icon for the iPhone and each connected computer. Tap one to switch to it, or touch and hold it to rename it. Names are saved on the phone only."],"fixed":["A task handed to a teammate whose working folder is busy now waits in the queue instead of failing right away.","New installs: Chibi logs every feature request you mention as a Mochii task. Existing Chibis keep their own instructions."]},{"version":"0.1.172","added":["On iPhone and iPad, touch and hold a link in a bot's reply to open it in your default browser or copy it. A normal tap works as before.","On iPhone and iPad, touch and hold a word in a bot's reply to select just that part, drag the handles to expand it, then copy, look up or share it.","On iPhone and iPad, pinch to zoom a computer screen from 1x to 8x, drag to pan, and double-tap to zoom in or back out. It works on a bot's computer and on This Mac.","On iPhone and iPad, when you are controlling This Mac, a tap clicks instantly, touch and hold right-clicks, touch and hold then drag moves things, and swiping scrolls. The Mac must run a desktop Atomic update that includes phone pointer control.","On iPhone and iPad, type / in a bot chat and pick /goal to give the bot an objective it keeps working on until it is done. /goal status, pause, resume and stop control it."],"fixed":["On iPhone and iPad, the mode menu works again: Ask, Auto edits, God Mode and Plan can be read and changed from a paired phone. Changes still need an Administrator's paired device, and every mode above Ask asks you to confirm.","On iPhone and iPad, a bot's question with three or more answers, or long ones, shows each answer as its own full-width button instead of squeezing them into one row (TestFlight build 69).","Tools from Atomic Engine no longer go missing when two copies of its tool lookup start at once.","The Linux downloads list shows a new release right away instead of an older cached copy."]},{"version":"0.1.171","added":["On iPhone and iPad, open a bot's computer view and tap Control this Mac to watch this Mac's screen. Take control, confirmed with Face ID, lets you tap, scroll and type on the Mac while the bot's computer use is paused.","/skills and /skill commands in the composer list a bot's skills and run one on a task.","On iPhone and iPad, skills and remote MCP servers can be added, edited and removed for chats that run on the phone. Servers that need a sign-in open it in the browser, and every tool call asks for approval with Face ID or passcode.","Chat links to saved deliverables in shared folders open from any conversation you can see. Settings > General sets which folders are shared."],"improved":["On iPhone and iPad, typing and streaming replies no longer redraw the whole chat, so the composer stays steady and the app feels faster.","On iPhone and iPad, AI & accounts is in Settings and works without pairing a computer. Provider sign-up links go to the right pages.","From a paired iPhone or iPad you can pin and unpin bots and rooms and add Marketplace apps. A phone can only change the pin on a bot or room, nothing else."],"fixed":["Subscription bots fall back to the next model in the same class when the top model is resting after a usage limit, instead of reporting nothing ready.","On iPhone and iPad, mode controls reload after a reconnect, offer a retry, and say why they are unavailable.","On iPhone and iPad, the workspace opens even when one saved item cannot be read, and its + menu offers New thread."]},{"version":"0.1.170","added":["Plan mode keeps a bot to reading and planning until you approve the plan. It is enforced for Claude, Atomic Engine and the shared chat tools, and it holds through reconnects.","On iPhone and iPad, you can choose each bot's work mode from the model picker."],"improved":["The Most Current button takes you to the newest message in a conversation.","The bot list on iPhone and iPad loads faster."],"fixed":["Unread indicators clear when an open conversation is restored after a reload or reconnect. Pending approvals still require your response.","On iPhone and iPad, every approval prompt asks for Face ID or Touch ID before your answer is sent."]},{"version":"0.1.169","improved":["Desktop conversations show the active approval mode as a readable label beside its icon. Select the label to review or change the conversation’s permission level."]},{"version":"0.1.168","added":["Offline Atomic handbook with platform differences, setup, dictation, backups and troubleshooting. Open Help Center or About on desktop, or Settings on mobile."],"improved":["Desktop update safeguards retain dictation preferences and refuse to overwrite unreadable settings. Stopped Local VM disks are kept; existing images still require manual recovery before recreation.","Desktop clipboard picker shows a compact recent list and a full preview before pasting. Settings below the list opens Clipboard in the main Settings popup."],"fixed":["Desktop dictation Names and words no longer loses unsaved text when status refreshes. Failed saves keep your draft for retry."]},{"version":"0.1.167","fixed":["Windows: the helper that lets bots use your computer is now signed by Chibitek Inc. too, so every program Atomic installs carries Chibitek's or its maker's signature. 0.1.164 to 0.1.166 were never released."]},{"version":"0.1.166","added":["Early access: Atomic can connect to Addigy's hosted MCP server. When a bot asks Addigy to change something, you get a card to confirm or decline first. Signing in to Addigy this way has not been verified yet."]},{"version":"0.1.165","fixed":["Windows: the uninstaller is signed by Chibitek Inc. again. 0.1.164 was never released."],"improved":["iPhone and iPad build 57: the on-device model can stay loaded between messages, with a setting for where it runs. Speed gains have not been measured on an iPhone yet.","iPhone and iPad build 56: desktop conversation updates are grouped into 50 ms batches to reduce redraws. Notification pictures no longer hold up streaming replies.","The desktop companion compresses startup snapshots with gzip. This requires a desktop build containing the latency fix; the iPhone update alone does not enable compression."]},{"version":"0.1.164","added":["Early access: bots can ask you to enter a key for a secure MCP connection, such as Addigy, on a protected card. The key is saved in Atomic's encrypted store and never appears in chat. Signing in to Addigy this way has not been verified yet."],"fixed":["The Vault opens again after you restart Atomic.","Windows: every program in the installer, including the one that builds the uninstaller, is signed by Chibitek Inc. before it runs."],"improved":["Setup welcomes you by name with your company's logo when you sign in with Chibitek.","Bots on different teams now message each other through their team's Chief of Staff."]},{"version":"0.1.163","fixed":["Dictation on iPhone, iPad and Mac keeps earlier sentences and avoids repeating completed phrases. On iPhone and iPad, listening continues when the recognizer starts a new session. Please test a two-minute dictation with pauses and intentional repeated phrases."],"improved":["Windows: Qwen is turned off for now while its installer is unreliable from here. It still works on macOS and Linux, and any Qwen setup you saved is kept."]},{"version":"0.1.162","added":["Clipboard history on macOS and Windows.","Setup asks what you do and suggests starter bots that fit your work.","Each routine now has a private Mochii task that stays in sync."],"fixed":["Mac dictation keeps earlier lines instead of starting over, and stops listening when you send."]},{"version":"0.1.161","fixed":["Recover from an Antigravity checkpoint error on your next message while keeping your conversation history. Failed requests are not automatically repeated."]},{"version":"0.1.160","added":["Model details shows which model actually answered each turn, with history and counts."],"improved":["Attachments no longer stop at 512 MB. Uploads are refused only when your disk is nearly full, and nothing is deleted automatically."]},{"version":"0.1.159","added":["React to messages on iPhone with emoji, including skin-tone choices.","Choose the Panes mascot body."],"improved":["Expand the iPhone message composer into a half-height sheet.","Generate bot avatars with an eligible signed-in Codex subscription, without entering an API key.","API image generation is an explicit choice. A failed subscription never silently switches to API billing."]},{"version":"0.1.158","added":["When a company subscription bot's provider can't answer, that one conversation keeps going on the same class from another provider for up to 50 turns, with a handoff you can download or pass to another bot.","Vault in Settings keeps saved logins, cards and contacts encrypted on this computer, with search, categories and add, edit and remove.","Dictate into Brain dump.","A quiet banner says when a turn switched engines and when the first one resets. You can turn it off in Settings."],"improved":["A turn tries at most two engines, then stops with one plain line saying what to fix.","Local VM uses only Colima on the Mac and never opens Docker Desktop."],"fixed":["The terminal app picks a free port when its usual one is busy."]},{"version":"0.1.157","added":["Personal goals with pause, resume, completion criteria and token limits, available in chat and the chibi CLI.","Open-model setup on Windows and Linux, with Ollama Cloud models in the picker.","iPhone shows what changed after an update.","Import a Markdown skill file with the file picker, then review and enable it."],"fixed":["Waiting bots no longer look selected when another conversation is open.","Expired Claude sign-ins use an eligible fallback instead of stopping at the final error."]},{"version":"0.1.156","added":["Brain dump: paste a list of tasks, press Sort into tasks, and each line gets a suggested bot from your own roster. Nothing is sent until you press Send on a row.","Personal goals: type /goal followed by an objective in a one-to-one chat and the bot keeps working across turns until it's done, needs you, or hits a limit. /goal status, pause, resume and stop control it; the same commands work from the terminal."],"improved":["Default model ladders and class floors are tuned for better results out of the box.","The Settings dialog can be resized and remembers its size. View > Zoom now scales just the Settings dialog while it's open, and the whole window otherwise.","An approval request now goes to whichever device you're actually using (desktop or phone), and Face ID or your passcode is required to approve it on iPhone and iPad, so work doesn't stall waiting for a Mac you've stepped away from."],"fixed":["The sidebar no longer highlights the wrong bot's conversation."]},{"version":"0.1.155","improved":["A bot keeps working when one of its tools is down. If a tool server (an MCP server) will not start, times out or stops during a turn, Atomic leaves only that server's tools out, tells the bot in one line which server is missing, and tries it again on a later turn. The rest of the turn runs as normal.","When a tool server fails, Chibi gets one quiet Team incident naming the server, the same way a model fallback is reported. Raw startup errors never reach your chat."],"fixed":["On the Codex engine, a custom tool server that tried to set a protected environment variable used to end the whole turn. Atomic now skips just that server and logs it once."]},{"version":"0.1.154","added":["Pinned bots can be put in any order: drag them in the sidebar (or use Alt with the arrow keys, or Move left / Move right in a tile's menu). On iPhone and iPad 1.0.1 (50), long-press a pinned bot to move it.","Connect one Atomic desktop to another over Tailscale. On the other computer, open Settings > Devices & remote access > Remote access > Pair over Tailscale and copy the link; paste it on this computer under Connect to another computer."],"improved":["Accounts marked Personal and your subscriptions can now be used by company bots as well as your Private Bot. Company or Personal only says who owns the account.","Your Private Bot works through Chibi: it hands work for other bots to Chibi and never creates bots itself.","Atomic's bots use only Chibitek Nexus, PAW and Omi for memory. Other memory add-ons for Hermes stay switched off."],"fixed":["Claude accounts that have no sign-in of their own no longer show as signed in. They used to borrow an old, expired Anthropic login, which made bots answer \\"Login expired\\". Sign in to each account you want to use.","When Hermes answers \\"Login expired\\", the turn now moves to the next engine in the bot's class.","A chat pinned to an Ollama model no longer jumps to another Claude account when one account hits its limit.","The Private Bot's subscription list no longer says \\"None yet\\" when you have subscriptions."]},{"version":"0.1.153","added":["Team Rooms are on. Sign in with Chibitek in Settings > General > Basics, then open Tools > Team Rooms to start a room or join one with a link."],"improved":["One broken MCP server no longer stops a bot. Atomic sets that server aside for a while and the bot keeps working with its other tools; Settings shows which server is failing."],"fixed":["When Claude says \\"Login expired\\", or answers with a connection error, the turn now moves to the next engine in the bot's class instead of showing that message as the reply.","When a provider cannot be reached, API engines, Muse Code and Apple Intelligence now hand the turn to the next engine instead of stopping.","Marking a \\"Ready for you\\" result as reviewed now works from the iPhone app. Before, the phone showed a \\"no route\\" error.","Bots that Atomic runs now use only Atomic's own memory, not memory left over from other tools on the same Mac.","Pairing help in Settings now points to Remote access instead of a command that could not be installed."]},{"version":"0.1.152","added":["Sign in with Chibitek in Settings > General > Basics. It signs you in through your browser with your Chibitek Google or Microsoft account, and Team Rooms use it to know who you are."],"fixed":["\\"Always allow this session\\" on a Claude bot now really lasts for the session. Atomic remembers it and stops asking again for the same tool, instead of showing the same permission card on the next request."]},{"version":"0.1.151","added":["Mistral Vibe is now a subscription. Le Chat Pro and Team are now Mistral's Vibe Pro and Team plans. In Settings > AI & accounts > Subscriptions, install Mistral Vibe and choose Sign in with Mistral to approve on Mistral's own page. A Mistral bot is created that uses only your Vibe plan, and Mistral Vibe joins your failover ladders. It works on Mac and Linux; on Windows, install Vibe with Mistral's instructions first.","The MiniMax M Plan (formerly the Coding Plan) is now a subscription. Paste your M Plan key (it starts with sk-cp-) on the MiniMax card in Settings > AI & accounts > Subscriptions. A MiniMax bot is created, MiniMax M3.1 Flash is added, and your plan joins your failover ladders as a subscription instead of a pay-per-use key.","The Z.ai GLM Coding Plan is now a subscription, through Hermes Agent. Z.ai lets the plan run only in the tools it lists, and Hermes is one of them. Run Hermes setup, choose Z.AI / GLM and paste your plan key. A Z.ai GLM bot is created that uses only GLM 5.3 and GLM 5.3 Flash, and those models count as part of your plan, not pay per use."],"improved":["The Perplexity card now says plainly why Pro and Max cannot be used here: they include no API credits, and the Perplexity API is billed separately.","Mistral now shows Mistral's own full-colour logo.","Atomic on ARM Linux (such as the NVIDIA DGX Spark) now gets updates from Settings > Updates. Download the update, then run the install command Atomic opens a terminal for."]},{"version":"0.1.150","added":["Watch-Along: watch a YouTube video inside Atomic with Chibi commenting as it plays. Paste a single YouTube link in a message box and choose Watch along, or use Watch a video in the sidebar's compose menu or the command palette. For now it is offered only on computers enrolled in Chibitek's organization."],"improved":["Bots in a team room now switch engines quietly when one fails. A resting or signed-out engine is skipped, and a provider error (such as an expired API key) moves the turn to the next engine instead of showing in the room."],"fixed":["On Windows, Atomic no longer jumps back to the front after you minimize it. A tool that started Atomic's program to run a script was being treated as a second launch of Atomic, which brought the window forward and stopped the script from running.","iPhone and iPad 1.0.1 (47): when a DNS filter or DNS profile (Scout DNS, for example) looks up your computer's Tailscale name through public DNS, Atomic now says so and tells you which domain to forward to Tailscale, instead of saying Phone access looks off."]},{"version":"0.1.149","improved":["The Development pack's Chibitek Developer Playbook is updated to v2026.10.23.1, with current guidance on build runners and releases."],"fixed":["Windows release checks now include the Meta Muse Code command-line tool, so Windows builds that ship Muse Code pass their checks."]},{"version":"0.1.148","added":["Meta Muse Code is now a subscription. In Settings > AI & accounts > Subscriptions, install Muse Code with Meta's installer and choose Sign in with Meta to approve with your own Meta account. A Muse Code bot is created, and Muse Code joins your failover ladders after Claude and ChatGPT. It works on Mac, Windows and Linux; on iPhone and iPad you can see its status and start the sign-in on your paired computer. Meta's use of your content for training is turned off.","Meta Muse Code and the Meta Muse API key now show Meta's official logo."]},{"version":"0.1.147","fixed":["A Hermes signed in to Nous Portal now shows as signed in under Settings > AI & accounts > Subscriptions even when another provider is your Hermes default. Atomic reads Hermes's own sign-in record instead of only its default provider."],"improved":["The Nous Research bot can use any model on your Nous Portal plan, not only Nous's own Hermes models. It starts on your Hermes default when that runs through Nous, and its model menu lists only Nous models."]},{"version":"0.1.146","improved":["MCP server secrets (API keys, tokens and Authorization headers) are now kept in your computer's secure store, the Keychain on Mac and Windows' built-in encryption on Windows, instead of in plain text in Atomic's settings file. Each server gets its secrets only when it starts. Secrets already in your settings move over automatically when you update. If a server had a token typed into its command, Settings > Marketplace > MCP servers asks which setting name it reads, then passes the token that way."]},{"version":"0.1.145","added":["Nous Research is now its own subscription. A Hermes signed in to Nous Portal shows as Nous Research in Settings > AI & accounts > Subscriptions, and gets its own bot that uses only Nous's models."],"improved":["Provider menus are organized into Subscriptions, Flat plans, API keys, On this computer and Atomic, with plain names and no duplicates. Two accounts of one provider are labelled Company and Personal, and Atomic asks you to name them when there are more. Each provider's model menu now lists only the models that provider hosts.","Bots now put all your AI subscriptions to work. In Settings > AI & accounts > Classes & failover, each tier's automatic ladder keeps Claude or ChatGPT in the first two places (Chibi still starts on Claude), then takes one model from each of your other plans in turn (Gemini, Grok, Kimi, Qwen, Cursor, Ollama Cloud, OpenCode Go and the rest) before more Claude or ChatGPT models. Pay-per-use API keys stay last, and a ladder you edited yourself is kept as you set it."]},{"version":"0.1.144","added":["Ready for you lists conversations across your bots on desktop and iPhone. Waiting decisions and new completed responses appear first. Opening a completed response saves its review status across paired devices without clearing a newer response or an unanswered approval."],"improved":["Chibi check-ins now show short, actionable cards with large Open and Dismiss buttons on iPhone and desktop. Three items appear first, with Show more for the rest. Internal bot failures stay with the Chief of Staff; unfinished work reaches you only after two failed retries. Quiet hours and delivery history prevent repeated interruptions."]},{"version":"0.1.143","improved":["iPhone and iPad 1.0.1 (38): local model downloads show received-byte progress during each file transfer, with the active download and Cancel control above the model list. Keep Atomic open until completion; cancelling restarts the download next time."],"added":["Claude Sonnet 5.5 and Haiku 5.5 are now available when choosing a Claude bot model, including Chief of Staff team setup."],"fixed":["A model the engine no longer offers (for example Grok 4.6 after the grok CLI retired it) no longer stops the run. The turn continues on the engine's default model, the thread shows one quiet line saying so, and your Chief of Staff gets an incident asking you to change the model setting. The Grok picker now lists what the installed CLI offers.","Any bot can now hand work or a question up to Chibi, and to the Chief of Staff that manages its team, from its own conversation, even across sections. Before, the roster listed Chibi but the handoff was refused with \\"Room work cannot cross the sender's section boundary\\". Handoffs between specialists keep their section rules, and rooms keep theirs."]},{"version":"0.1.142","added":["Windows: dictate into any app with Ctrl+D (rebindable in Settings > General > Dictation), the same as Cmd+D on the Mac.","iPhone and iPad: Atomic's dictation now comes to the mobile app."],"fixed":["Settings has a Voice tab again, under General. It opens on Chibi's spoken-reply voice, and you can switch to any other bot. Each bot's own settings still have the same picker under Voice & alerts."]},{"version":"0.1.141","improved":["Settings > AI & accounts now opens on Subscriptions, with a card and a Sign in button for every AI plan: Claude, ChatGPT, Google Gemini, Grok, Cursor, Kimi, Qwen, OpenCode Go, Ollama Cloud (including Team) and Factory Droid. Microsoft Copilot, GitHub Copilot, Meta AI, Mistral Le Chat, Perplexity, MiniMax and Z.ai GLM are listed too, each with a plain reason it cannot be used yet.","You can add more than one account for a plan and mark each one Company or Personal, for example your company Google Workspace and your personal Google account for Gemini. Each account gets its own bot, and Personal accounts are used only by your Private Bot."],"fixed":["Stopping dictation in the chat box now waits for the final recognized words instead of cancelling them. Escape still cancels recording. Known issue: live-microphone dictation can listen without producing words; a fix is planned for 0.1.142.","Google sign-in now requests Gmail, Calendar and Drive together. Permissions you approve turn on automatically, without a second Turn on step. After updating, reconnect your Google account once in Settings > Accounts.","Bots use Google and Microsoft through Atomic Accounts, with your account-access settings respected. Bots without access explain what is missing. Settings refreshes when you return and shows sign-in status separately from mail, calendar and file permissions.","Signing in to Gemini with a Google account is now easy to find: it is the Google Gemini card under Subscriptions, not hidden inside the Antigravity engine. Connecting Gmail, Calendar and Drive stays under Google & Microsoft, and each place links to the other."]},{"version":"0.1.140","added":["Chibi can now reach and manage every company bot in every team, including bots you add later, as if it were each team's Chief: it can hand them work, fix their setup, manage their rooms and retry their stuck work. Your Private Bot, personal subscription bots and bots hidden from you stay out of its reach.","When you approve something in Chibi's conversation, the bots Chibi hands that work to can do the same thing without asking you again, for a limited time. Questions, credentials, spending and destructive actions still always ask you, and a bot saying you approved something never counts."],"fixed":["On Windows, Claude bots no longer stop with \\"Failed to refresh OAuth token\\" when several of them renew their sign-in at once, a Claude engine that fails to start is tried again before it is reported, and Chibi's check-ins say what went wrong in plain words.","Chibi no longer fails every message with \\"Internal error: Bad Request\\". Your own messages in Chibi's Primary Bot sweeps conversation now run on the model you picked (Plata by default) instead of the cheapest free one, connected apps such as Vercel and this computer no longer make Gemini refuse the whole request, and if a model refuses a request without saying why, the message moves to the next model."]},{"version":"0.1.139","improved":["Opening a bot now takes you back to the conversation you used most recently with it, on your iPhone and on the desktop.","Atomic now starts Colima or Docker Desktop for your Local VM when it is installed but stopped, and a Local VM that simply stopped is replaced on its next use without asking."],"fixed":["Auto conversations no longer stop with \\"Start docker first\\" when the Local VM they last used is unavailable. They continue on the next available place and say where they moved.","Codex no longer fails with \\"invalid transport\\" because of MCP servers in your own Codex settings.","On iPhone, the model class menu and the pay-per-use choices work again."]},{"version":"0.1.138","improved":["Atomic for Windows is now signed by Chibitek Inc., so Windows no longer blocks the download or the installer."],"fixed":["On Windows, Kimi, Grok, Cursor and Qwen no longer show as not installed right after Atomic installs them, while Windows is still scanning the new program."]},{"version":"0.1.137","improved":["Chibi now runs on Claude by default, at the Plata class. It uses another provider only when every Claude account is busy or out of usage."],"fixed":["A click on the model chip at the top of a chat now always offers the model classes, even when the current model has no class.","The specific-model picker now shows the latest suggested models immediately. Search still refines the list, while update, effort and local-model controls follow after the model choices instead of hiding them."]},{"version":"0.1.136","improved":["Settings > Classes & failover now lets you drag providers into order or jump one directly to any position. Provider and model choices are separate, every configured provider remains available, and Save order confirms when the change is stored.","The Orchestrator now defaults to the latest Sonnet model on the company Claude subscription, with the usual automatic fallback when Claude is unavailable."],"fixed":["iPhone and iPad now load the model-class menu even when the current model has not been graded on the phone yet, so class choices can be changed and saved from mobile.","When a bot's model needs you to sign in again or runs out of usage, Atomic now moves it only to a model that can work on the bot's computer, instead of failing every message. If none is free, the message says which models were skipped and why."]},{"version":"0.1.135","improved":["Pick a model class for a bot, or for one thread, right from the model chip at the top of a chat. A click offers Automatic and the four classes, Mezcal, Plata, Reposado and Añejo, each with the model it would run on now. Atomic then picks the best ready model in that class and falls back as usual.","To choose a specific provider and model, Command-click the chip on a Mac (Ctrl-click on Windows), or choose Choose a specific model at the bottom of the class menu. That view now has Save as default, which makes the thread's model the bot's default, and Reset to default, which puts the thread and the bot back on Automatic."]},{"version":"0.1.134","added":["Settings > Marketplace > MCP servers lists 53 more apps, each connecting through the vendor's own MCP server, including QuickBooks, HubSpot, Stripe, Atlassian, Notion, Canva, Monday.com and Zapier."],"improved":["Composio has been removed. Connect apps with the vendor's own MCP server in Settings, Marketplace, MCP servers.","Settings > Marketplace now has three tabs: Discover, MCP servers and Add-ons. The Connected apps tab is gone, and bots that need an app point you to the vendor's own MCP server."]},{"version":"0.1.133","added":["Your Private Bot and Chibi can now talk to each other. Ask your Private Bot to check something with Chibi, or ask Chibi to ask your Private Bot. Chibi never sees your private chats or memories: your Private Bot decides what to tell it. No other bot can reach your Private Bot.","Settings > Private Bot has a new switch, Let my Private Bot and Chibi talk. It is on by default; turn it off to keep them apart as before. Your organization can also keep them apart on its Macs."]},{"version":"0.1.132","fixed":["When you ask your Private Bot to share a chat with Chibi, it now points you to Share with Chibi in the chat's menu instead of searching for a Chief of Staff it cannot reach."]},{"version":"0.1.131","added":["Share with Chibi: open the menu on any of your Private Bot's threads and choose Share with Chibi. Chibi gets a new thread with a readable copy of that one conversation. The original stays private, and so do your other private chats and your private memory."]},{"version":"0.1.130","added":["Atomic now opens on your Chief of Staff: the first time you open it, in every new window, and when the bot or room you had open is deleted. New conversation lists the Chief of Staff first."],"fixed":["On a Mac, the Local VM keeps its saved workspace after Docker Desktop restarts, instead of asking you to recreate it on every message."]},{"version":"0.1.129","added":["Dictate in any app on your Mac: press Command+D and talk, and Atomic types into the app in front. Turn it on in Settings > General > Dictation. You can pick another shortcut, and Settings tells you when another app already uses it.","Apps that use Command+D in their own menus, such as Bookmark in Safari or Duplicate in Finder, are listed under the shortcut with a switch for each. Switch an app off and its own Command+D works there while dictation stays on everywhere else.","New subscription bots start on each company's newest flagship model at medium effort when your account offers it: Claude Opus 5.5, ChatGPT GPT-6 Astra, Gemini 3.8 Flash, Grok 4.7 and Kimi K3. Your own model choices are never replaced.","iPhone and iPad: Settings > Frontier models shows each AI's default model, whether it is signed in on your computer, and what each company allows on a phone. Settings > PAW lets you check your PAW, edit About me, run the setup interview and suggest changes through your paired computer.","Mochii and Nexus are now on by default on Mac, Windows and Linux, signed in through Chibitek. If you removed one before, it stays removed.","Spec to Ship and the house writing check now run as part of Atomic's own checks, so specs, plans and reviews are held to the same rules every time."],"improved":["Settings > AI & accounts: the Open button now takes you straight to the right key field. Key-only AI cards now have a masked key field with Save and Test, and keys are kept in Atomic's secure store, backed by the Keychain on a Mac. Choose Company or Personal and each key is saved separately.","Atomic finds each AI's command line tool on its own, and you can point it at another copy if you need to.","On a Mac, Open install in Terminal now opens Terminal and runs the install command for you. Ollama Cloud has a key field and a Get a key link instead of a Terminal button."],"fixed":["Messages that pointed to Settings > AI providers now name the real place: Settings > AI & accounts > Subscriptions or API keys.","The model picker returns to the official model list once it loads, instead of staying on the placeholder list."]},{"version":"0.1.128","added":["iPhone and iPad: local chat, downloadable models, model selection, and download and removal controls on supported devices.","Provider bots use their official logos on desktop, iPhone and iPad."],"improved":["Private Bots can use company models when personal accounts are unavailable, with confirmation before premium model costs.","Nexus work summaries retain safe task and output links while excluding credential-bearing links."],"fixed":["Windows setup now selects the declared automatic installers for Grok, Cursor, Kimi and Qwen, without relying on the wording of a terminal command.","Supported Windows provider installers run in the background with progress in Atomic. Setup checks availability after installation; sign-in remains interactive when needed."]},{"version":"0.1.127","added":["A bot for every AI account you sign in to: sign in to Claude, ChatGPT, Gemini, Grok, Kimi, Qwen or Cursor (in setup or Settings > AI & accounts) and Atomic adds a bot named after it, such as \\"Claude\\", \\"Claude (Personal)\\" or \\"ChatGPT\\", wearing that company's icon. It uses only that account and that company's models, picking the best one for the job unless you choose another. Two accounts of the same AI get two bots. Rename, hide or delete them like any bot; a deleted one is not made again.","When a subscription bot's account is out of usage, it moves to your other account of the same AI without a word. If none is free, it says when it will be back and offers to hand your request to Chibi. It never switches to a different AI on its own.","Bots made from a Personal account follow the Private Bot's rules: they run only on your own account, stay off Chibi's team and never see company connections. Your organization can turn off making these bots with the SubscriptionBots setting.","A bot's Access settings now list the apps turned on in its Claude account, each marked Connected via Claude, with an On/Off for that bot. Bots on another AI say why they have none.","Chibi says hello in your code editor and your terminal. The Atomic panel in VS Code (and Cursor, Windsurf and Antigravity) opens with Chibi, a short greeting, a What's new card for the latest release that you can close, and quick tips such as /bot to switch bots and Send Selection to Bot. In the terminal, chibi start, setup and login show Chibi with your version, who you are signed in as and a tip. Add --quiet to skip it; it never shows when the output goes to a file or another program, and NO_COLOR shows it in plain text.","The window Atomic shows while it opens now has Chibi's animated mark on Windows, Mac and Linux, and the iPhone app shows it while your workspace first loads. With Reduce Motion on, Chibi stays still.","Your Personal Bot is now your Private Bot. In the sidebar it reads Create your Private Bot; hold the pointer over it to see what that means: your company can't read it, and nothing you say there is shared with your work bots.","Private Bot chats stay private. Chibi, your work bots, connected assistants and Administrators never see its conversations, memories or files, and they are never mentioned anywhere else. Usage, activity and exports that others can see leave it out, and backups kept by your company do not include it.","Your Private Bot can read your work memories to help you, read only. Turn this off in Settings > Private Bot.","If you attach or paste something into your Private Bot that looks like a company document (from a company drive or shared folder, Mochii or Nexus, marked confidential, or with your company's name), Chibi asks first: keep it private, move it to Chibi or another work bot, or cancel. This check runs on your computer; nothing is sent anywhere to decide.","Your Private Bot now saves to your Nexus as private memory: only it can read it, and every save and lookup is signed with a key that stays on your computer. Chibi, your work bots, your company and Administrators never see it.","New bots set themselves up: + New bot, Create your Private Bot, and asking Chibi for a new bot all open a short interview. It asks one simple question at a time (what it should help with, its name, which clients or projects, which connected tools, when to check in with a morning brief, wrap-up or weekly review, and how it should talk), then shows a plain summary with Create and Change. Atomic writes the bot's instructions, picks its icon and AI, connects its tools and creates its routines, then opens it. Nothing to fill in or paste into Settings. Every question can be skipped, and an interview closed halfway picks up where you left off.","Chibi no longer answers \\"set up a bot for me\\" with instructions to copy. It shows a Set up your new bot card in the chat, already filled in with what you told it."],"fixed":["Fixed: the Reticle web-app testing connection could fail before starting because Atomic supplied an environment setting reserved for its own runtime.","Fixed: setup could leave you stuck when Google refused the sign-in (for example \\"Atomic has not completed the Google verification process\\") or the browser was closed. The Google and Accounts steps now always have Continue without it, and a refused sign-in says plainly that you can continue and connect it later.","Fixed: Mochii and Nexus connect as you, so they show your own company's tasks and memory, and when Nexus is not turned on for your company yet, Settings and the new-bot interview show its own calm note (your organization's memory space is being set up) instead of an error, and bots stop trying to reach it until it is ready.","Fixed: Chibi no longer passes on technical messages such as a tool that timed out on connect. It mentions a tool only when your request needs it, in one plain sentence, and offers to try again or help you connect it."],"improved":["Subscription bots now wear each company's official logo (Claude, ChatGPT, Gemini, Grok, Qwen and Cursor) inside a Chibitek ring: a particle drifts round it while the bot rests, three race round while it thinks, and the ring pulses while it replies. The logo itself never moves or changes colour. With Reduce Motion on, the ring stays still. Kimi shows a plain K, because Moonshot allows its logo only in editorial and non-commercial use. The same logos appear in setup and Settings, on the Mac, on Windows and on iPhone.","Mac dictation now types as you talk: each sentence or phrase is typed when you finish it or pause for about a second, instead of everything at the end. If you talk without stopping, Atomic types what it has every 15 to 20 seconds.","While you talk, the words being recognized show in a small bubble next to your cursor. They are only typed once they are final and cleaned up, and a sentence that has been typed is never changed again.","Auto-correct now looks at the one or two sentences before each new one, so a phrase is corrected as part of its sentence.","Press Command+Z while dictating, or right after, to remove just the last sentence. Saying \\"scratch that\\" on its own does the same.","If you switch to another app while dictating, Atomic pauses typing and says so. Go back and it carries on; nothing is ever typed into the wrong app.","Connected apps no longer take new apps. Apps you connected before keep working, and you can sign one in again if it expires or disconnect it, under Settings > Marketplace > Connected apps. New apps connect in the Marketplace through each company's official connector, and bots point you there instead of offering a connection card."]},{"version":"0.1.126","added":["Team Rooms (coming soon; off until Chibitek sign-in arrives in Atomic): share a bot conversation or start a New Team Room, then invite people from your company or other companies with a link (7 days and 10 uses by default; only the room owner makes links and can turn them off). Everyone brings their own bots with Add my bot, except their Private Bot. A bot answers only when someone @mentions it, runs on its owner's computer and subscriptions, and asks its owner before anything that commits them. A room with other companies shows a banner, and each bot shares nothing from its owner's memories, accounts or files there unless the owner turns it on for that room. Your iPhone reads and replies in rooms through your computer.","Ask any bot to connect an app, like \\"connect my QuickBooks\\", and it now checks the Marketplace for you. If the app is there, it gives you a Connect button that opens Settings > Marketplace with that app selected. If it isn't there yet, it says so and offers a button to send it to Chibitek as an idea. Bots no longer suggest building a connection themselves.","Marketplace: \\"Recommended for your business\\" lists the apps most companies connect first and that you can connect today (QuickBooks, Granola, Gmail, Google Calendar and Drive, Microsoft 365, Slack, Zoom, Docusign, HubSpot, Stripe, Canva, Notion and Asana), each with the best way to connect it.","The Marketplace now lists only official connections: servers run by the company behind each app, and their official connectors in your Claude account. Servers made by other people or independent developers are no longer offered, and bots never suggest them, because Atomic can't tell where they send your data. You can still add a server you trust by hand under MCP servers.","Marketplace: \\"Through your Claude account\\" shows the apps you turned on at claude.ai (such as QuickBooks, which only connects that way) and marks them Connected via Claude. Turn on \\"Also use my Claude Code MCP servers\\" there and your bots on Claude can use them.","Marketplace: Granola and Dropbox are now featured, using their official servers.","Atomic Engine, Chibitek's own AI engine, now installs from Atomic on Windows and on Macs, Apple silicon and Intel: one click in setup or in Settings > Engines. Atomic downloads it, checks it against its published checksum, and starts it once before using it. No terminal needed.","Mac: dictate in any app. Turn it on in Settings > General > Dictation, then press Control+Option+Space in Mail, Slack, your browser or any other app, talk, and press it again. Your words are typed where your cursor is. You can also hold Right Option while you talk instead.","Dictation turns your voice into text on your Mac only: Apple's speech recognition on macOS 26 and later, or Parakeet on macOS 14 and 15. It removes \\"um\\" and \\"uh\\", understands \\"comma\\" and \\"new line\\", and Auto-correct fixes spelling and grammar with Apple Intelligence on your Mac without changing your words. Using your AI subscriptions for Auto-correct is optional and off by default.","Settings > General > Dictation explains each permission (Microphone, Accessibility, and Input Monitoring only for Right Option), lets you change the shortcut, download the speech model, add names Atomic should spell your way, and switch dictation off for single apps.","HIPAA mode: an Administrator can turn it on for the whole workspace in Settings > General > Dictation, and organizations can set it with the HipaaMode MDM key. In HIPAA mode nothing you dictate or type leaves your Mac.","Setup: when a step fails, Save diagnostics sits next to Get help. The file now includes what setup did on this computer: every AI app check that failed or was slow, each install with its output, and each sign-in, with passwords and keys removed. Settings > General > Export Diagnostics saves the same file.","Atomic now saves your work to Nexus, so Chibi remembers you on every device and in every Chibitek app. After every bot reply it saves a short summary: what you asked, what was done, decisions, next steps, and links to pull requests and Mochii tasks.","Handoffs, reports and briefs your bots write are saved to Nexus too, and so are the images, audio and video your bots make or you attach.","Every saved item says where it came from: the app (Mac, Windows, iPhone, VS Code, the command line or Slack), the bot, the conversation and the time.","When you start a conversation, your bot gets a short note of your recent work and files from Nexus. Bots can also search Nexus and open a saved file when you ask about earlier work.","Settings > Memory: Always save to Nexus is on by default. Choose whether to save media and the largest file to save, see what Nexus remembers, and forget any item.","Your Personal Bot never saves to or reads from the company's Nexus. Its memory stays on your computer, unless you mark your own Nexus connection Personal.","Company-managed computers: your organization can keep Always save to Nexus on, and can turn on HIPAA mode so nothing marked as patient data is saved.","A bot's Memory settings are new. Memory saved to Nexus shows who you are connected as and what the bot remembers about you and your work, with search, edit and forget. When a bot's memory can't go to Nexus (not connected, HIPAA, or your Personal Bot), it says plainly that it is kept on this computer.","Workspace knowledge (PAW) in a bot's Memory settings shows which layers it reads (your organization, your department and you) and how fresh they are, with Open PAW and Suggest a change. A suggestion goes to the file's owner for approval in Mochii."],"improved":["Windows: Atomic now follows Early updates unless you or your organisation chose otherwise, so Windows computers keep getting updates before the first stable Windows release.","Signing in with Google now shares only your name and email. Gmail, Calendar and Drive each stay off until you turn them on in Settings > Accounts, and Google asks about each one on its own, with a plain note on what it lets bots do. Reading mail and writing drafts are separate, and Atomic no longer asks for permission to change or delete email. Accounts you already connected keep working.","Setup: the Google step can always be skipped. If Google shows an error page or you choose not to allow something, Atomic carries on and you can connect later.","Setup: installing an AI app shows what it is doing: the download with its size for Gemini, then unpacking and the first start, and npm's latest lines under Show details.","Checking which AI apps are installed can no longer hold up the list. Each app gets a time limit; one that does not answer shows as not ready, with the reason, while the others carry on.","When an AI app is installed but does not start, setup says what Atomic ran and what happened (not found, the exit code with its error, or no answer in time), instead of \\"CLI not found\\".","Nothing that looks like a password or key is ever uploaded: a file that contains one stays on your computer, and a summary has it hidden.","If you are offline or Nexus can't be reached, saves wait on your computer and are sent when it is back, each one exactly once.","A bot's notes file on this computer is now its offline copy and is saved to Nexus too. The file, its size meter and Open in Obsidian moved under Advanced, so you no longer see folder paths unless you look for them."],"fixed":["Fixed: on Windows, installing a new Atomic could leave the old one installed beside it (one \\"for everyone\\", one \\"only for me\\"). The installer now updates the copy that is already there, and removes any other copy of Atomic it finds, keeping your workspace and settings.","Fixed: on Windows, Atomic flashed a console window when it started, and another when the computer-control helper was checked.","Fixed: on Windows, installing Gemini (Antigravity) could fail at the end with \\"EPERM: operation not permitted, rename\\". Atomic now moves the download into place before starting it for the first time, waits out the antivirus scan, and never leaves a half-installed copy. Atomic Engine installs the same way.","Fixed: when a bot was set to an AI that is not installed on this computer, its next chat now runs on your next AI that is ready instead of failing. An AI that is set up wrongly still says so, instead of being swapped silently.","Fixed: on Windows, setup could stay on ChatGPT (Codex) without ever finishing its check, and installing it could fail with no useful message. A check that does not answer now stops the whole program it started, including the codex.exe helper that kept running and blocked the next install, and the install checks that Codex really starts before saying it is done.","Fixed: on Windows, installing Gemini or ChatGPT flashed black console windows. Programs that AI apps start through Atomic's own Node.js are now started hidden.","Fixed: setup could spin forever if Atomic restarted or stopped answering during an install. It now says so and offers Try again."]},{"version":"0.1.125","added":["Send feedback from inside Atomic: Help > Send Feedback or Report a Bug, Settings > General > Basics, the profile menu, or the small Feedback button next to the version in the sidebar. Pick Bug or Idea, describe it, and choose whether to attach a screenshot of the window and diagnostics (passwords, keys and tokens are removed first). It goes straight to the Chibitek team; a person reviews every bug before it is fixed. On iPhone: Settings > Send Feedback.","Windows: Grok can now be installed on Windows. Setup shows its Windows install line for PowerShell.","Press Command-D (Ctrl+D on Windows) to dictate into the chat box, like in Claude and ChatGPT. Press it again or Esc to stop; your words stay in the box to edit or send. The mic button shows it is listening the whole time.","Settings > General > Basics > Dictation shortcut lets you pick a different shortcut: click it, press the keys you want, or reset to Command-D. Atomic refuses shortcuts the system or Atomic already uses."],"improved":["Your iPhone reconnects to your Mac by itself as soon as its network changes, for example when you leave Wi-Fi, switch to cellular, or Tailscale on the iPhone turns back on. It no longer waits out a retry timer first.","When your iPhone can't reach your Mac, it now says why: Tailscale on this iPhone isn't connected (open Tailscale and turn it on), your Mac isn't answering over Tailscale (asleep, offline, or Atomic isn't running), or this iPhone needs to be paired again.","Settings > Remote access on the Mac shows, under Tailscale pairing: this Mac's Tailscale name and IP, whether it answers on its Tailscale name, and when your phone was last seen.","Windows: setup now says PowerShell and Enter, not Terminal and Return, and says when an AI is not available on Windows yet instead of offering an install that cannot work.","Windows: Atomic finds Cursor, Kimi, Qwen and Hermes right after you install them, without restarting Atomic.","Windows: Atomic Engine is not available on Windows yet, so Windows no longer offers it in setup or picks it for Chibi.","Settings is simpler: eight items with tabs instead of a long list. Marketplace is now in Settings, second from the top, with everything you can add in one place: featured tools, the MCP Registry search, connected apps, MCP servers and add-ons. Tools > Marketplace opens it.","Settings > General now has Basics, Appearance, Bots & threads, and Setup, so you can rerun setup steps from there. AI providers, Accounts and Connected assistants are together under AI & accounts; Remote access and Computers under Devices & remote access; Repos, Connected workspaces and Backups under Workspaces & repos.","Searching Settings also finds settings inside tabs, and lists the matching tabs under each item.","When dictation is missing Microphone or Speech Recognition access, the message now has an Open System Settings button that goes straight to the right privacy page."],"fixed":["Fixed: renaming your Mac in Tailscale broke remote access from your iPhone until Atomic was restarted. Atomic now notices the new name within a minute, and the iPhone finds the Mac under its new name by itself.","Fixed: on Windows, connecting ChatGPT (Codex) failed with \\"spawn EINVAL\\". Atomic now starts every AI and tool it installs on Windows the right way, including on a PC without Node.js: Claude Code, Codex, OpenCode, Pi, MiniMax, Gemini, Grok, Cursor, Kimi, Qwen, Droid and Hermes.","Fixed: on Windows, connecting Claude Code to Atomic and MCP servers started with npx could fail the same way.","Fixed: a chat could fail with \\"\`atomic acp\` isn't installed\\" when its bot was set to an AI that is not on this computer. The turn now runs on your next AI that is ready, such as Claude, and the bot keeps its setting for when that AI is installed."]},{"version":"0.1.124","added":["PAW (Personal AI Workspace): Atomic now creates one folder for your AI context by itself, in your home folder under workspace/PAW (on Mac and Windows). Your company's files, your department's files and your own notes live there, and every bot reads only what a job needs.","Setup asks a few plain questions about you (your role, department, company, goals and how you like to work) and saves them as your About me in PAW. Chibitek staff join their department: Service Desk, Development, Back Office, Creative, or Sales and Marketing.","Settings > General > PAW shows where your PAW is, your department, how many files each layer has, when it last synced, and has Edit about me.","Company and department files are locked. If you or a bot change one, Atomic puts the original back and sends the change to its owner as a PAW change request in Mochii.","Chibi's regular check now tells the owner about company files nobody has reviewed in 90 days. This check is free.","Your Personal Bot reads only your own personal notes in PAW; company bots never see them."],"improved":["The old \\"Set up your AI context\\" form is gone. You never pick a folder or build one by hand. An existing ICM folder still works and bots still read it, after PAW.","Company-managed computers: your organization can choose the PAW template new installs start from."],"fixed":["Fixed: when one of your AI subscriptions runs out partway through a turn, even when the provider calls it a rate limit, the bot now finishes the turn on your next subscription without showing an error, and goes back to its usual AI as soon as that subscription has room again."]},{"version":"0.1.123","fixed":["Fixed: setup could not install Claude, Codex or OpenCode on a computer without Node.js (the copy of npm inside Atomic was incomplete). Atomic now ships npm as one checked archive and unpacks it on first use.","Fixed: Check for updates no longer says the update files are missing when there is simply nothing newer yet."]},{"version":"0.1.122","added":["The animated Chibi logo now also appears on the Mac while Atomic starts, on the first setup screen, and while Chibi is thinking.","Atomic for Windows, for Chibitek in-house testing. It is not signed yet, so Windows asks before the first install: choose More info, then Run anyway.","The Windows installer asks who Atomic is for: Only for me (no administrator needed) or Anyone who uses this computer. IT can also install it for everyone on a PC with Datto RMM.","Windows has the same update rings as the Mac: Early updates (internal testers) in Settings > General > Updates gets new Windows builds first. Your organization can set the ring, or manage updates for you, the same way it can on a Mac.","Your Personal Bot: one bot that is only yours. Create it from the sidebar or Settings > Personal Bot, and give it its own name, persona and icon, including a picture. You can change them any time.","Every AI account in Settings > AI providers is now marked Company or Personal. Accounts you already had stay Company, so nothing changes for your company bots. Mark an account you pay for yourself as Personal.","Your Personal Bot runs only on your Personal accounts and never on company AI. Company bots never use your Personal accounts.","When your personal subscriptions are resting, your Personal Bot stops and tells you when they are back. It can use free local AI on this Mac if you turn that on, and your own pay-per-use key only after you say yes.","Your Personal Bot starts with no company connections. Mark your own Google or Microsoft accounts and MCP servers as Personal to give them to it; company bots can't see or use them.","Chibi and company bots can't hand your Personal Bot work, and it can't hand them work. It carries a small Personal badge, and so do its conversations. Your iPhone shows it with the badge too; create it on your Mac.","The setup wizard asks once whether a plan you connect is your own. Chibitek company plans are always Company.","Company-managed Macs: your organization can turn the Personal Bot off. An existing one is then hidden, not deleted."],"improved":["On Windows, setup only shows what applies there: free local AI points you to ollama.com to install Ollama, and the Mac-only steps (macOS permissions and the Podman computer) are left out.","On Windows, Settings > Add-ons says RTK is not on Windows yet, instead of saying this copy is missing it. Apple Intelligence and dictation stay Mac-only and do not appear on Windows.","Usage reports can leave out your Personal Bot's usage, so company reports show only company work."]},{"version":"0.1.121","added":["Chibi is now your Primary Bot. It works on its own: it checks your team every 30 minutes, when Atomic starts and when your Mac wakes, and fixes what it can, like retrying a run that crashed or a routine that failed.","Chibi checks in only when it needs you: one short message in its main conversation, with links to the threads waiting on you. It never repeats itself about the same thing and stays quiet from 10 PM to 7 AM.","The check is free. Chibi only uses a model when something needs unblocking, and then on your cheapest plan, never pay-per-use unless you chose Keep going.","Settings > General > Primary Bot (Chibi): turn it on or off, choose how often it checks, set quiet hours, run a check now, and see what recent checks found and cost.","Move into Chibi: a bot you used as your go-to can move into Chibi from its menu. Its instructions, memory, skills, routines and conversations come along, Chibi keeps its own name and look, and the old bot is archived, not deleted. Importing from Grok Bot does the same for its Primary Bot.","Company-managed Macs: your organization can decide how Atomic updates through its device management (Addigy). When it manages updates, Atomic stops updating itself and Settings > Updates says \\"Updates are managed by your organization\\". It can also set your update channel, shown as Managed by your organization.","Settings > General > Updates shows your version and update channel, and has a new Early updates (internal testers) switch. It is off for everyone; testers who turn it on get new versions before they reach the rest of Chibitek.","A new setup wizard walks you through everything Atomic needs, one step at a time, with no Terminal: your name, which AI plans you have, connecting each one, free local AI, API keys, Google and Microsoft accounts, a computer for your bots, permissions, your iPhone, and meeting Chibi.","Atomic now installs Claude Code, Codex and OpenCode for you with one click, even on a Mac that has never had Node.js.","Grok, Cursor, Kimi and Qwen install from inside Atomic, and Grok, Cursor and Kimi sign in from inside Atomic: the sign-in page opens in your browser, with the code to type when there is one.","Free local AI: Atomic can install Ollama for you and recommends one model sized to your Mac, Gemma 4 on Apple silicon Macs with 16 GB or more, with the size shown before it downloads.","A computer for your bots: Atomic can download Podman's official installer, open it for you, and start the separate computer, with no command line.","Settings > Setup lists every setup step as done, skipped or not done, with Continue to pick up where you left off.","Chibi says hello in your first chat with three easy things to try."],"improved":["If you already use Atomic, a small Finish setting up Atomic card offers the new setup instead of a full-screen welcome.","The Ollama Cloud and Mistral setup cards now say they only need an API key and take you to AI providers, instead of showing a command."],"fixed":["Fixed: on a brand-new install, What's new no longer opens on top of the welcome.","Fixed: while Atomic starts, the window now says Starting Atomic instead of a developer command.","Fixed: the guided tour no longer waits invisibly when no AI plan is set up; it offers to set one up."]},{"version":"0.1.120","fixed":["Fixed: phone pairing over Tailscale now recovers automatically if Tailscale wasn't fully signed in when the app started, and refreshes when the Mac wakes from sleep."]},{"version":"0.1.118","added":["Settings > AI providers > Local models now lists the models Ollama has on this computer, with their size and which bots use them, and can give a model to a bot.","Get models suggests local models that can use tools, says which fit your computer's memory, and downloads any model with a progress bar you can cancel. Remove deletes one you no longer need.","New add-on: RTK shortens long command output (tests, builds, git, logs) before a bot reads it, so bots use fewer tokens. It is on for Engineering bots, and approvals still show the exact command the bot wrote.","New add-on: GitHub threat review. Before Atomic installs a skill, an MCP server or an add-on, it scans the code for backdoors, hidden instructions and supply-chain tricks, and stops the install when it finds clear signs of harm. You see what it found and can still go ahead. The scan runs inside Atomic and uses no AI tokens.","Bots have a new threat_scan tool that checks a folder, a GitHub repository or an npm package before they install or run it. A bot reads the full threat review only when a scan finds something worth a closer look, or when you ask for a deep review.","When a Claude bot clones a repository, Atomic scans it right away and tells the bot only if something turned up.","New add-on: Reticle lets bots check that a web or Electron app they changed really works. It is off until you turn it on, and Atomic installs it on your Mac the first time.","New add-on: a reviewed library of UI design skills bots can load for design and front-end work, following Apple's design guidelines and Liquid Glass first. Off until you turn it on.","Settings > Add-ons has a new option, Scan skills before install (SkillSpector). It is off, and scanning itself arrives in a later update.","When every subscription has hit its limit, Atomic keeps your bots working on your pay-per-use API keys and tells you once, with when a subscription is back. You can keep going, use your local models for free, or pause pay-per-use until then.","Settings > Engines and tiers now shows when each engine hit its limit, the reset time the provider gave in your own time zone, and when it came back."],"improved":["Greyed-out switches in a bot's Access settings now say why, with a link to fix it.","\\"Connected apps\\" is now \\"More apps\\"; Gmail, Calendar, Drive and Outlook come from Google and Microsoft accounts.","Chibi is always your Chief of Staff; its name and look are fixed so Atomic stays recognizable.","The MCP Marketplace is back in plain sight: Tools > Marketplace in the sidebar always opens it, and Settings > Add-ons links to it.","Ollama Cloud and OpenCode Go keys now appear once, as the Main key inside each provider's card, instead of a second row further down.","Atomic now uses your flat-price plans before anything billed per use: Claude, ChatGPT, Grok and Cursor first, then Ollama Cloud, then other plans like the Qwen Coding Plan, Kimi and OpenCode Go.","Switching a bot to another engine when one runs out now happens quietly, with no message in the chat.","An engine that runs out is not tried again until the time its provider said it resets.","Local models from Ollama can be given to any bot in Settings. When a bot cannot use one, it is shown greyed out with the reason."],"fixed":["Fixed: a bot could fail to save to its memory with an \\"unauthorized\\" error after its settings changed mid-conversation.","The Plugins window no longer reopens on MCP servers after you visited that tab, which hid the Marketplace.","Fixed: when a provider was out of credits, a bot could post the provider's billing error as its reply. The turn now finishes on the next engine instead.","Fixed: a model billed per use (like DeepInfra through Atomic Engine) could be picked ahead of a flat-price plan that offers the same model.","Fixed: Atomic Engine showed None for local models even when Ollama had models installed."]},{"version":"0.1.117","added":["In the iPhone app, a new animated Chibi logo plays while the app connects to your computer."]},{"version":"0.1.116","added":["Add-ons like Ponytail now work with every AI engine, not just Claude, and you can switch each one on or off (Settings > Add-ons), for all bots or per bot.","Settings > Add-ons tells you when a newer version of an add-on is out. Atomic includes it in a later update after it has been reviewed; nothing installs by itself."],"improved":["Every AI provider in Settings now links to where you get it: Get a subscription for Claude, ChatGPT and Grok, and Get an API key or See plans for the others.","Settings > AI providers now separates Subscriptions (flat monthly plans, including plans that use a key like the Qwen Coding Plan) from API keys (billed per use).","Each bot now shows a short summary of what it can do.","Opening a bot takes you straight to its latest conversation; older ones are under History."]},{"version":"0.1.115","added":["Add your Qwen Coding Plan as an AI provider account (Settings > Engines > AI provider accounts). Bots can then run on its flat-price models, like Qwen 3.7 Plus, GLM-5 and Kimi K2.5."]},{"version":"0.1.114","added":["Local models can use less memory in long chats. Turn on \\"Use less memory for long chats\\" in Settings > AI providers, then quit Ollama and open it again. Long conversations fit on your Mac with answers that stay practically the same."]},{"version":"0.1.113","added":["Connect Xcode as a code editor (Settings > Connected assistants > Code editors), so Xcode's Claude, Codex and Gemini agents can work with your Atomic team."],"fixed":["Saving a backup no longer fails on project folders your bots worked in. Reinstallable folders like node_modules are left out; reinstall them in each project after restoring."],"improved":["The Atomic iPhone app now shows this computer by its own name, so two computers are easy to tell apart."]},{"version":"0.1.112","added":["Google's Antigravity IDE is now a code editor you can connect (Settings > Connected assistants > Code editors), separate from the older Antigravity app."],"fixed":["Each code editor row now says which editor to restart, instead of always naming Claude Code."]},{"version":"0.1.111","added":["Stop a bot from your code editor: the Atomic extension for VS Code and Cursor shows a Stop button while a bot works, and stops only that chat.","Send images from your code editor and see the images in its chats: paste, drop or pick up to 4 per message."],"improved":["Every bot's past conversations are one click away: a History button in the chat header, and an empty chat now lists recent conversations, including work Chibi handed over.","Chats started from a code editor are recognized in your history, so the editor lists them as its own."]},{"version":"0.1.110","added":["Connect as many Google and Microsoft accounts as you like (Settings > Accounts). Bots can read and draft email, check and add calendar events, and find files in Gmail, Google Calendar, Drive, Outlook and OneDrive, only for the accounts you tick in each bot's Access settings.","Add more than one account per AI provider (Settings > Engines): two Perplexity keys, a second ChatGPT or Grok sign-in, and so on. Each account is its own engine, so a bot can use a specific one, and work moves to your other account when one runs out.","Perplexity is now an AI provider."],"fixed":["An extra Claude subscription account no longer switches to pay-as-you-go billing when an Anthropic API key is also saved."]},{"version":"0.1.109","fixed":["Apple Intelligence now actually ships in the Mac app. Earlier updates left out the small helper it needs, so it showed as unavailable."]},{"version":"0.1.108","added":["Import your Hermes agents: each Hermes profile becomes an Atomic bot with its instructions, memory, skills, scheduled jobs and MCP servers (Team library > Import)."]},{"version":"0.1.107","added":["Apple Intelligence runs on this Mac as a free, private Añejo engine, and writes thread titles without using your subscriptions.","Each bot now opens to one ongoing conversation, like Grok Bot. When the model starts a fresh session, a quiet divider marks it and earlier messages stay above. Separate threads are still there in the ⋯ menu."]},{"version":"0.1.106","improved":["Bots named after an engine run on it by default: Codex on ChatGPT models, Grok on Grok, Claude on Claude, and so on. Existing Codex and Grok bots were moved once; change them any time."]},{"version":"0.1.105","added":["Connect Atomic to VS Code, Cursor, Windsurf, Antigravity and OpenCode in one click (Settings > Connected assistants > Code editors). Each editor's AI chat can then ask Chibi or any bot for work, and each editor gets its own access you can disconnect."],"fixed":["Notifications on your iPhone now show the bot's avatar, or Chibi's mascot when the bot has no avatar, instead of the generic system icon."]},{"version":"0.1.104","added":["This \\"What's new\\" window, shown the first time you open Atomic after an update.","When an update is available, closing its pop-up leaves an \\"Update available\\" button in the bottom-left corner until you install it."],"fixed":["The iPhone pairing screen shows your computer's name with spaces instead of plus signs."]},{"version":"0.1.103","added":["Chibi's assignments now count as real work orders for the rest of the team.","For high-stakes steps (deploys, merges to main, new cloud resources, secrets), Chibi can attach your own message, and Atomic shows it to the specialist stamped as verified."],"improved":["Every bot can report back and escalate to the Chief of Staff that manages its team.","After an update, the Local VM's desktop image rebuilds itself instead of asking you to prepare it again."],"fixed":["Specialists no longer refuse work you already approved in your conversation with Chibi."]},{"version":"0.1.102","added":["A free Marketplace in Plugins: 16 featured services with their own icons, and search across the public MCP Registry. No paid key needed.","Saved backups in Settings > Backups: everything in ~/atomic_backup with Show in Finder, and Import for full backups.","Settings > AI providers brings subscriptions, API keys, and classes and failover together in one place."],"improved":["Settings > Computers now holds cloud computers and your own servers next to the Local VM.","Remote access sends you to Tailscale pairing when this computer has no public web address."],"fixed":["Downloading an update no longer crashes the app on networks that block the newer web protocol (QUIC)."]},{"version":"0.1.101","improved":["The Local VM keeps Firefox signed in with its history when its desktop is replaced.","Browser logins and history on each Local VM are backed up every hour to ~/atomic_backup, keeping the two latest copies."],"fixed":["The macOS menu says Settings…, matching the window it opens."]},{"version":"0.1.100","improved":["Every model your engines offer now gets a class (Mezcal, Plata, Reposado or Añejo), so the chat header never shows a model name."]},{"version":"0.1.99","added":["A new sidebar with one row per bot, and its threads inside the chat."],"improved":["The model chip shows only the class and effort, such as \\"Mezcal (Med)\\". Click it to see the model."]}]`),HTe=VTe;function w2(e,t){const a=s=>s.split(/[.+-]/).map(r=>Number.parseInt(r,10)||0),o=a(e),i=a(t);for(let s=0;s<Math.max(o.length,i.length);s++){const r=(o[s]??0)-(i[s]??0);if(r!==0)return r}return 0}function mB(e,t,a=HTe){return a.filter(o=>w2(o.version,e)>0&&w2(o.version,t)<=0).sort((o,i)=>w2(i.version,o.version))}const KH="atomic.whatsNew.lastSeen";function GTe(){try{return localStorage.getItem(KH)}catch{return null}}function hB(e){try{localStorage.setItem(KH,e)}catch{}}function $Te(e,t,a={}){return t===null?a.firstRun?[]:mB("0",e).filter(o=>o.version===e):mB(t,e)}function KTe(e){const t=e?.onboarding;return!t?.completedAt&&!t?.setup?.deferredAt&&!Object.keys(t?.setup?.steps??{}).length}function S2({icon:e,title:t,items:a}){return a?.length?n.jsxs("div",{className:"mt-3",children:[n.jsxs("div",{className:"flex items-center gap-1.5 text-[12px] font-semibold uppercase tracking-wide text-ink-secondary",children:[e,t]}),n.jsx("ul",{className:"mt-1.5 flex list-disc flex-col gap-1 pl-5 text-[13px] leading-relaxed text-ink",children:a.map(o=>n.jsx("li",{children:o},o))})]}):null}function WTe({initialNotes:e}){const t=rS(),[a,o]=f.useState(()=>e??[]),{state:i}=ve(),s=i.config,r=f.useRef(!1);if(f.useEffect(()=>{if(e||!window.ogb||!s||r.current)return;r.current=!0;const d=$Te(t,GTe(),{firstRun:KTe(s)});d.length?o(d):hB(t)},[t,e,s]),!a.length)return null;const c=()=>{hB(t),o([])};return n.jsx("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/40 p-4",onClick:c,children:n.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"whats-new-title",onClick:d=>d.stopPropagation(),className:"animate-panel-in flex max-h-[80vh] w-full max-w-[520px] flex-col rounded-2xl border border-hairline/50 bg-panel shadow-2xl shadow-black/50",children:[n.jsxs("div",{className:"flex items-start justify-between gap-3 border-b border-hairline/30 px-5 py-4",children:[n.jsxs("div",{children:[n.jsx("h2",{id:"whats-new-title",className:"text-[16px] font-semibold text-ink",children:l("whatsNew.title",{app:Ga().name})}),n.jsx("p",{className:"mt-0.5 text-[12.5px] text-ink-secondary",children:l("whatsNew.subtitle",{version:t})})]}),n.jsx("button",{type:"button",onClick:c,className:"rounded-md p-1 text-ink-secondary hover:bg-control hover:text-ink","aria-label":l("whatsNew.close"),children:n.jsx(Nt,{size:15})})]}),n.jsx("div",{className:"min-h-0 overflow-y-auto px-5 pb-4",children:a.map(d=>n.jsxs("section",{className:"border-b border-hairline/20 py-3 last:border-b-0",children:[n.jsx("h3",{className:"text-[13.5px] font-semibold text-ink",children:l("whatsNew.version",{version:d.version})}),n.jsx(S2,{icon:n.jsx(So,{size:13}),title:l("whatsNew.added"),items:d.added}),n.jsx(S2,{icon:n.jsx(w4,{size:13}),title:l("whatsNew.improved"),items:d.improved}),n.jsx(S2,{icon:n.jsx(n0,{size:13}),title:l("whatsNew.fixed"),items:d.fixed})]},d.version))}),n.jsx("div",{className:"flex justify-end border-t border-hairline/30 px-5 py-3",children:n.jsx("button",{type:"button",onClick:c,className:"rounded-lg bg-accent px-4 py-1.5 text-[13px] font-medium text-white",children:l("whatsNew.gotIt")})})]})})}function JTe(){const[e,t]=f.useState(!1),[a,o]=f.useState("idea"),[i,s]=f.useState(""),[r,c]=f.useState(""),[d,p]=f.useState(null),[h,g]=f.useState(!0),[b,x]=f.useState(!0),[v,k]=f.useState("editing"),[S,N]=f.useState(null),C=f.useRef(!1),{state:j}=ve(),M=j.bots.find(z=>z.id===j.selectedId)?.personal===!0,D=f.useRef(M);D.current=M;const A=f.useRef(null),R=f.useCallback(async(z,B="")=>{if(C.current)return;C.current=!0;let L=null;try{L=await window.ogb?.captureFeedbackScreenshot?.()??null}catch{L=null}o(z),B&&s(B),p(L),g(!!L&&!D.current),x(z==="bug"),k("editing"),N(null),t(!0),C.current=!1},[]);f.useEffect(()=>{const z=L=>{const G=L.detail;R(CM(G),Gxe(G))};window.addEventListener(G3,z);const B=window.ogb?.onOpenFeedback?.(L=>{R(CM(L))});return()=>{window.removeEventListener(G3,z),B?.()}},[R]),f.useEffect(()=>{e&&v==="editing"&&A.current?.focus()},[e,v]);const P=f.useCallback(()=>{v!=="sending"&&(t(!1),v==="sent"&&(s(""),c("")))},[v]);if(f.useEffect(()=>{if(!e)return;const z=B=>{B.key==="Escape"&&P()};return window.addEventListener("keydown",z),()=>window.removeEventListener("keydown",z)},[e,P]),!e)return null;const O=async()=>{if(!(v!=="editing"||i.trim().length<3||!window.ogb?.submitFeedback)){k("sending"),N(null);try{await window.ogb.submitFeedback({type:a,description:i,email:r.trim()||void 0,includeScreenshot:h&&!!d,screenshotDataUrl:h?d:null,includeDiagnostics:b}),k("sent")}catch(z){N(l("feedback.error",{message:z instanceof Error?z.message:String(z)})),k("editing")}}},T=[{id:"bug",label:l("feedback.kind.bug"),icon:n.jsx(n0,{size:14})},{id:"idea",label:l("feedback.kind.idea"),icon:n.jsx(u4,{size:14})}];return n.jsx("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/40 p-4",onClick:P,children:n.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"feedback-title",onClick:z=>z.stopPropagation(),className:"animate-panel-in flex max-h-[85vh] w-full max-w-[520px] flex-col rounded-2xl border border-hairline/50 bg-panel shadow-2xl shadow-black/50",children:[n.jsxs("div",{className:"flex items-start justify-between gap-3 border-b border-hairline/30 px-5 py-4",children:[n.jsxs("div",{children:[n.jsx("h2",{id:"feedback-title",className:"text-[16px] font-semibold text-ink",children:l("feedback.title")}),n.jsx("p",{className:"mt-0.5 text-[12.5px] text-ink-secondary",children:l("feedback.subtitle")})]}),n.jsx("button",{type:"button",onClick:P,className:"rounded-md p-1 text-ink-secondary hover:bg-control hover:text-ink","aria-label":l("feedback.close"),children:n.jsx(Nt,{size:15})})]}),v==="sent"?n.jsxs("div",{className:"px-5 py-6",role:"status",children:[n.jsx("p",{className:"text-[14px] font-semibold text-ink",children:l("feedback.sent.title")}),n.jsx("p",{className:"mt-1 text-[13px] text-ink-secondary",children:l("feedback.sent.body")})]}):n.jsxs("div",{className:"flex min-h-0 flex-col gap-3 overflow-y-auto px-5 py-4",children:[n.jsx("div",{role:"radiogroup","aria-label":l("feedback.kind.label"),className:"flex gap-2",children:T.map(z=>n.jsxs("button",{type:"button",role:"radio","aria-checked":a===z.id,onClick:()=>{o(z.id),z.id==="bug"&&x(!0)},className:V("flex items-center gap-1.5 rounded-lg border px-3 py-1.5 text-[13px]",a===z.id?"border-accent bg-accent/15 text-ink":"border-hairline/50 text-ink-secondary hover:bg-raised/50"),children:[z.icon,z.label]},z.id))}),n.jsxs("label",{className:"flex flex-col gap-1 text-[13px] text-ink",children:[l(a==="bug"?"feedback.description.bug":"feedback.description.idea"),n.jsx("textarea",{ref:A,value:i,onChange:z=>s(z.target.value),rows:6,maxLength:8e3,placeholder:l(a==="bug"?"feedback.placeholder.bug":"feedback.placeholder.idea"),className:"min-h-[120px] w-full resize-y rounded-lg border border-hairline/40 bg-inset px-3 py-2 text-[13px] text-ink focus:border-hairline focus:outline-none"})]}),n.jsxs("label",{className:"flex flex-col gap-1 text-[13px] text-ink",children:[l("feedback.email.label"),n.jsx("input",{type:"email",value:r,onChange:z=>c(z.target.value),autoComplete:"email",className:"w-full rounded-lg border border-hairline/40 bg-inset px-3 py-1.5 text-[13px] text-ink focus:border-hairline focus:outline-none"}),n.jsx("span",{className:"text-[12px] text-ink-secondary",children:l("feedback.email.hint")})]}),n.jsxs("label",{className:V("flex items-start gap-2 text-[13px]",d?"text-ink":"text-ink-secondary"),children:[n.jsx("input",{type:"checkbox",className:"mt-0.5",checked:h&&!!d,disabled:!d,onChange:z=>g(z.target.checked)}),n.jsxs("span",{className:"flex flex-col gap-1.5",children:[l(d?"feedback.screenshot.label":"feedback.screenshot.unavailable"),d&&h&&n.jsx("img",{src:d,alt:l("feedback.screenshot.alt"),className:"max-h-28 w-auto self-start rounded-md border border-hairline/50"})]})]}),n.jsxs("label",{className:"flex items-start gap-2 text-[13px] text-ink",children:[n.jsx("input",{type:"checkbox",className:"mt-0.5",checked:b,onChange:z=>x(z.target.checked)}),n.jsxs("span",{className:"flex flex-col",children:[l("feedback.diagnostics.label"),n.jsx("span",{className:"text-[12px] text-ink-secondary",children:l("feedback.diagnostics.hint")})]})]}),S&&n.jsx("p",{role:"alert",className:"text-[12.5px] text-danger",children:S})]}),n.jsx("div",{className:"flex justify-end gap-2 border-t border-hairline/30 px-5 py-3",children:v==="sent"?n.jsx("button",{type:"button",onClick:P,className:"rounded-lg bg-accent px-4 py-1.5 text-[13px] font-medium text-white",children:l("feedback.close")}):n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",onClick:P,disabled:v==="sending",className:"ui-button",children:l("feedback.cancel")}),n.jsx("button",{type:"button",onClick:()=>{O()},disabled:v==="sending"||i.trim().length<3,className:"rounded-lg bg-accent px-4 py-1.5 text-[13px] font-medium text-white disabled:opacity-50",children:l(v==="sending"?"feedback.sending":"feedback.send")})]})})]})})}function YTe({episode:e,busy:t,error:a,onKeepGoing:o,onChoose:i}){const s=f.useRef(null);f.useEffect(()=>{const c=document.activeElement instanceof HTMLElement?document.activeElement:null;return s.current?.focus(),()=>c?.focus()},[]);const r="flex items-center justify-center gap-1.5 rounded-lg bg-control px-3 py-1.5 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-50";return n.jsxs("div",{role:"dialog","aria-modal":"false","aria-labelledby":"pay-per-use-title","aria-describedby":"pay-per-use-body","data-pay-per-use-notice":!0,onKeyDown:c=>{c.key==="Escape"&&!t&&(c.stopPropagation(),o())},className:"animate-panel-in fixed bottom-4 right-4 z-50 w-[340px] max-w-[calc(100vw-32px)] rounded-2xl border border-hairline/40 bg-panel/85 p-4 shadow-2xl shadow-black/40 backdrop-blur-xl backdrop-saturate-150",children:[n.jsxs("div",{className:"flex items-start gap-2.5",children:[n.jsx("span",{className:"mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-full bg-accent/15 text-accent","aria-hidden":!0,children:n.jsx(Eh,{size:14})}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("h2",{id:"pay-per-use-title",className:"text-[13.5px] font-semibold text-ink",children:Hy(e).title}),n.jsx("p",{id:"pay-per-use-body",className:"mt-1 text-[12.5px] leading-relaxed text-ink-secondary",children:dQ(e)})]})]}),a&&n.jsx("p",{role:"alert",className:"mt-2 text-[12.5px] text-danger",children:l("payPerUse.failed",{error:a})}),n.jsxs("div",{className:"mt-3 flex flex-col gap-1.5",children:[n.jsx("button",{ref:s,type:"button",disabled:t!==null,onClick:o,className:"rounded-lg bg-accent px-3 py-1.5 text-[13px] font-medium text-white disabled:opacity-50",children:Hy(e).keepGoing}),n.jsxs("div",{className:"flex gap-1.5",children:[n.jsxs("button",{type:"button",disabled:t!==null,onClick:()=>i("local"),className:`${r} flex-1`,children:[t==="local"&&n.jsx(Ie,{size:13,className:"animate-spin","aria-hidden":!0}),l("payPerUse.useLocal")]}),n.jsxs("button",{type:"button",disabled:t!==null,onClick:()=>i("pause"),className:`${r} flex-1`,children:[t==="pause"&&n.jsx(Ie,{size:13,className:"animate-spin","aria-hidden":!0}),uQ(e)]})]})]})]})}function ZTe(){const{state:e,dispatch:t}=ve(),a=e.payPerUseNotice,[o,i]=f.useState(null),[s,r]=f.useState(null);if(f.useEffect(()=>{i(null),r(null)},[a?.id]),!a)return null;const c=async d=>{i(d),r(null);try{await X(`${Hy(a).base}/${d==="local"?"local":"pause"}`,{method:"POST"}),t({type:"dismissPayPerUse"})}catch(p){r(p instanceof Error?p.message:String(p)),i(null)}};return n.jsx(YTe,{episode:a,busy:o,error:s,onKeepGoing:()=>{t({type:"dismissPayPerUse"}),X(`${Hy(a).base}/keep-going`,{method:"POST"}).catch(()=>{})},onChoose:d=>{c(d)}},a.id)}function QTe({onGotIt:e,onSettings:t}){const a=f.useRef(null);return f.useEffect(()=>{const o=document.activeElement instanceof HTMLElement?document.activeElement:null;return a.current?.focus(),()=>o?.focus()},[]),n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/30 p-4","data-primary-bot-intro":!0,children:n.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"primary-bot-intro-title","aria-describedby":"primary-bot-intro-body",onKeyDown:o=>{o.key==="Escape"&&(o.stopPropagation(),e())},className:"animate-panel-in w-full max-w-[380px] rounded-3xl border border-white/15 bg-panel/70 p-6 text-center shadow-2xl shadow-black/40 backdrop-blur-2xl backdrop-saturate-150",children:[n.jsxs("div",{className:"relative mx-auto size-[72px]",children:[n.jsx("img",{src:N4,alt:j4,className:"size-[72px] rounded-full object-cover ring-1 ring-white/20"}),n.jsx("span",{className:"absolute -bottom-0.5 -right-0.5 flex size-6 items-center justify-center rounded-full bg-accent text-white shadow-md ring-2 ring-panel","aria-hidden":!0,children:n.jsx(eZ,{size:13,fill:"currentColor"})})]}),n.jsx("h2",{id:"primary-bot-intro-title",className:"mt-4 text-[17px] font-semibold text-ink",children:l("primaryBot.intro.title")}),n.jsx("p",{id:"primary-bot-intro-body",className:"mt-2 text-[13.5px] leading-relaxed text-ink-secondary",children:l("primaryBot.intro.body")}),n.jsxs("div",{className:"mt-5 flex gap-2",children:[n.jsx("button",{type:"button",onClick:t,className:"flex-1 rounded-xl bg-control px-3 py-2 text-[13px] text-ink hover:bg-raised-hover",children:l("primaryBot.intro.settings")}),n.jsx("button",{ref:a,type:"button",onClick:e,className:"flex-1 rounded-xl bg-accent px-3 py-2 text-[13px] font-medium text-white",children:l("primaryBot.intro.gotIt")})]})]})})}function XTe(){const{state:e,dispatch:t}=ve(),a=Gl()===!0,[o,i]=f.useState(sPe),[s,r]=f.useState(null);f.useEffect(()=>{if(!a||o||!window.ogb)return;let g=!0;return X("/api/primary-bot").then(b=>{g&&r(b.introSeenAt)}).catch(()=>{}),()=>{g=!1}},[a,o]);const c=window.ogb?.remoteClient?.active===!0,d=!!window.ogb&&!c,p=!!e.config&&!e.welcomeOpen&&!e.tourOpen&&!z4(e.config,{remoteClient:c,legacyDone:O4()});if(!d||s===null||!lPe({seenLocally:o,serverSeenAt:s,canManage:a,welcomeDone:p}))return null;const h=()=>{rPe(),i(!0),X("/api/primary-bot/intro",{method:"POST"}).catch(()=>{})};return n.jsx(QTe,{onGotIt:h,onSettings:()=>{h(),t({type:"toggleAppSettings",open:!0,section:"general"})}})}function eBe({visible:e}){const[t,a]=f.useState(!1);if(f.useEffect(()=>{const r=window.ogb?.windowControls;if(!r)return;let c=!0;r.state().then(({maximized:p})=>{c&&a(p)});const d=r.onMaximizedChanged(p=>a(p));return()=>{c=!1,d()}},[]),!e)return null;const o=window.ogb?.windowControls,i={WebkitAppRegion:"no-drag"},s=V("flex h-[26px] w-11 items-center justify-center text-ink-secondary","hover:bg-raised hover:text-ink active:bg-raised/60");return n.jsxs("div",{"aria-hidden":!0,style:i,className:"absolute right-0 top-0 z-40 flex items-stretch",children:[n.jsx("button",{type:"button","aria-label":l("window.minimize"),title:l("window.minimize"),className:s,onClick:()=>{o?.minimize()},children:n.jsx($B,{size:14})}),n.jsx("button",{type:"button","aria-label":l(t?"window.restore":"window.maximize"),title:l(t?"window.restore":"window.maximize"),className:s,onClick:()=>{o?.toggleMaximize()},children:t?n.jsx(Ya,{size:11}):n.jsx(ud,{size:11})}),n.jsx("button",{type:"button","aria-label":l("window.close"),title:l("window.close"),className:V(s,"hover:bg-danger/25 hover:text-danger"),onClick:()=>{o?.close()},children:n.jsx(Nt,{size:15})})]})}function tBe(){const{state:e,refreshInstances:t}=ve(),a=window.ogb?.remoteClient?.active===!0,[o,i]=f.useState(!1),s=async()=>{i(!0);try{await t()}finally{i(!1)}};if(a)return n.jsx("main",{className:"flex h-full min-w-0 flex-1 items-center justify-center bg-app px-6",children:n.jsxs("div",{className:"max-w-[520px] rounded-2xl border border-hairline/40 bg-card p-6 text-center",children:[n.jsx("h1",{className:"text-[20px] font-semibold text-ink",children:"The host needs an agent engine"}),n.jsx("p",{className:"mt-2 text-[13.5px] leading-relaxed text-ink-secondary",children:"Configure Claude, ACP, or another supported engine in Atomic on the host computer, then return here."}),n.jsx("button",{onClick:()=>{s()},disabled:o,className:"mt-5 rounded-lg bg-raised px-3 py-2 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-60",children:o?"Checking…":"Check again"})]})});const r=e.instances.filter(c=>c.install).sort((c,d)=>{const p=Hu(c.install)?0:1,h=Hu(d.install)?0:1;return p-h});return n.jsx("main",{className:"flex h-full min-w-0 flex-1 flex-col overflow-y-auto bg-app",children:n.jsxs("div",{className:"mx-auto w-full max-w-[560px] px-6 py-12",children:[n.jsx("h1",{className:"text-[20px] font-semibold text-ink",children:l("noEngines.title")}),n.jsx("p",{className:"mt-1.5 text-[13.5px] leading-relaxed text-ink-secondary",children:l("noEngines.intro",{app:Ga().name})}),n.jsx("div",{className:"mt-6 flex flex-col gap-2.5",children:(()=>{const{subscription:c,custom:d}=ZO(r),p=h=>n.jsxs("div",{className:"rounded-xl border border-hairline/40 bg-card p-3.5",children:[n.jsxs("div",{className:"flex items-center gap-2 text-[14px] font-medium text-ink",children:[n.jsx(Il,{instance:h,size:16}),h.displayName]}),n.jsx(Pr,{instance:h,intent:h.access==="custom"?"inject":"cloud",className:"mt-0.5"})]},h.instanceId);return n.jsxs(n.Fragment,{children:[c.length>0&&n.jsx(Yu,{className:"px-1",children:l("engines.cloud")}),c.map(p),d.length>0&&n.jsx(Yu,{className:"px-1 pt-1",children:l("engines.local")}),d.map(p)]})})()}),n.jsxs("button",{onClick:s,disabled:o,className:"mt-6 flex items-center gap-2 rounded-lg bg-raised px-3 py-2 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-60",children:[o?n.jsx(Ie,{size:14,className:"animate-spin"}):n.jsx(fn,{size:14}),l(o?"common.checking":"common.checkAgain")]})]})})}function gB(e,t){const a=t.trim().toLowerCase();if(!a)return[...e];const o=[],i=[];for(const s of e){const r=s.name.toLowerCase();r.startsWith(a)?o.push(s):r.includes(a)&&i.push(s)}return[...o,...i]}const nBe=["watch","video","youtube"];function aBe({onOpenChange:e}){const{state:t,dispatch:a}=ve(),o=J0(),[i,s]=f.useState(!1),[r,c]=f.useState(""),[d,p]=f.useState([]),[h,g]=f.useState(0),b=f.useRef(null);f.useEffect(()=>{const T=z=>{(z.metaKey||z.ctrlKey)&&z.key.toLowerCase()==="k"&&!z.shiftKey&&!z.altKey&&(z.preventDefault(),s(B=>!B))};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[]),f.useEffect(()=>{i&&(c(""),p([]),g(0))},[i]),f.useEffect(()=>{e?.(i)},[e,i]);const x=r.trim().toLowerCase();if(f.useEffect(()=>{if(!i||!x){p([]);return}p([]);let T=!0;const z=setTimeout(()=>{X(`/api/search?q=${encodeURIComponent(x)}&limit=12`).then(B=>T&&p(B.hits??[])).catch(()=>T&&p([]))},150);return()=>{T=!1,clearTimeout(z)}},[i,x]),f.useEffect(()=>g(0),[x]),f.useEffect(()=>{b.current?.scrollIntoView({block:"nearest"})},[h,d]),!i)return null;const v=gB(t.bots.filter(T=>!T.hidden),x),k=gB(t.groups,x),S=o?qF(r):null,N=o?S?{kind:"watch",video:S}:x.length>=3&&nBe.some(T=>T.startsWith(x)||x.startsWith(T))?{kind:"watch",video:null}:null:null,C=[...N?[N]:[],...v.map(T=>({kind:"bot",bot:T})),...k.map(T=>({kind:"room",group:T})),...x?d.map(T=>({kind:"message",hit:T})):[]],j=C.length?Math.min(h,C.length-1):0,M=async T=>{if(T.kind==="watch")T.video?await hC(a,T.video).catch(z=>a({type:"error",message:z instanceof Error?z.message:String(z)})):UF();else if(T.kind==="message"){const z=T.hit;try{await FS(z,t,a)}catch(B){a({type:"error",message:B instanceof Error?B.message:String(B)})}}else a(T.kind==="bot"?sa(T.bot):{type:"select",id:T.group.id});s(!1)},D=T=>{if(T.key==="Escape")T.preventDefault(),T.stopPropagation(),s(!1);else if(T.key==="ArrowDown")T.preventDefault(),g(C.length?(j+1)%C.length:0);else if(T.key==="ArrowUp")T.preventDefault(),g(C.length?(j-1+C.length)%C.length:0);else if(T.key==="Enter"){T.preventDefault();const z=C[j];z&&M(z)}},A=N?1:0,R=A+v.length,P=A+v.length+k.length,O=(T,z,B,L,G=!1)=>n.jsx("button",{ref:z===j?b:void 0,onClick:B,onMouseMove:()=>g(z),className:V("flex w-full items-center gap-3 rounded-xl px-3 py-2 text-left",G&&"flex-col items-stretch gap-0.5",z===j?"bg-raised":"hover:bg-raised/50"),children:L},T);return n.jsx("div",{className:"fixed inset-0 z-50 flex items-start justify-center bg-black/50 p-6 pt-[14vh]",onMouseDown:T=>T.target===T.currentTarget&&s(!1),onKeyDown:D,children:n.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Command palette",className:"flex max-h-[min(480px,70vh)] w-full max-w-[560px] flex-col overflow-hidden rounded-xl border border-hairline/50 bg-card shadow-2xl shadow-black/60",children:[n.jsxs("div",{className:"flex items-center gap-3 border-b border-hairline/40 px-4 py-3",children:[n.jsx(za,{size:16,className:"shrink-0 text-ink-secondary"}),n.jsx("input",{autoFocus:!0,value:r,onChange:T=>c(T.target.value),placeholder:"Search bots, channels, messages…",className:"w-full bg-transparent text-[14px] text-ink placeholder:text-ink-secondary focus:outline-none"}),n.jsx("kbd",{className:"shrink-0 rounded-md border border-hairline/40 px-1.5 py-0.5 text-[11px] text-ink-secondary",children:"esc"})]}),n.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto p-2",children:[C.length===0&&n.jsx("div",{className:"px-3 py-6 text-center text-[13px] text-ink-secondary",children:x?`Nothing matches “${r}”`:"Nothing to switch to yet"}),v.length>0&&n.jsx("div",{className:"px-3 pb-1 pt-1.5 text-[11px] font-medium uppercase tracking-[0.08em] text-ink-secondary",children:"Bots"}),N&&O("watch",0,()=>{M(N)},n.jsxs(n.Fragment,{children:[n.jsx(s4,{size:16,className:"shrink-0 text-ink-secondary"}),n.jsx("span",{className:"truncate text-[14px] text-ink",children:l(S?"watch.entry.paletteLink":"watch.entry.menu")})]})),v.map((T,z)=>O(`bot:${T.id}`,A+z,()=>{M({kind:"bot",bot:T})},n.jsxs(n.Fragment,{children:[n.jsx(o4,{size:16,className:"shrink-0 text-ink-secondary"}),n.jsx("span",{className:"truncate text-[14px] text-ink",children:T.name}),T.title&&n.jsx("span",{className:"min-w-0 truncate text-[12.5px] text-ink-secondary",children:T.title})]}))),k.length>0&&n.jsx("div",{className:"px-3 pb-1 pt-2 text-[11px] font-medium uppercase tracking-[0.08em] text-ink-secondary",children:"Groups"}),k.map((T,z)=>O(`room:${T.id}`,R+z,()=>{M({kind:"room",group:T})},n.jsxs(n.Fragment,{children:[n.jsx(bi,{size:16,className:"shrink-0 text-ink-secondary"}),n.jsx("span",{className:"truncate text-[14px] text-ink",children:T.name})]}))),x&&d.length>0&&n.jsx("div",{className:"px-3 pb-1 pt-2 text-[11px] font-medium uppercase tracking-[0.08em] text-ink-secondary",children:"Messages"}),x&&d.map((T,z)=>{const B=T.snippet.slice(0,T.matchStart),L=T.snippet.slice(T.matchStart,T.matchStart+T.matchLength),G=T.snippet.slice(T.matchStart+T.matchLength);return O(`msg:${T.threadId}:${T.messageId}`,P+z,()=>{M({kind:"message",hit:T})},n.jsxs(n.Fragment,{children:[n.jsxs("span",{className:"flex items-center gap-2 truncate text-[13px] font-medium text-ink",children:[n.jsx(h4,{size:13,className:"shrink-0 text-ink-secondary"}),T.name,T.task?n.jsxs("span",{className:"font-normal text-ink-secondary",children:[" · ",T.task]}):null]}),n.jsxs("span",{className:"line-clamp-2 text-[12.5px] text-ink-secondary",children:[B,n.jsx("mark",{className:"rounded-sm bg-accent/25 px-0.5 text-ink",children:L}),G]})]}),!0)})]})]})})}function oBe({item:e,isMac:t}){const a=fv(),o=e.id==="dictation"?sV(a,t):kS(e,t);return n.jsxs("div",{className:"flex items-center justify-between gap-4 py-1.5",children:[n.jsx("span",{className:"text-[13px] text-ink",children:e.description}),n.jsx("div",{className:"flex shrink-0 items-center gap-1",children:o.map((i,s)=>n.jsx("kbd",{className:"inline-flex min-w-[22px] items-center justify-center rounded-md border border-hairline/60 bg-control px-1.5 py-0.5 font-mono text-[11.5px] font-semibold text-ink shadow-xs",children:i},s))})]})}function iBe({open:e,onClose:t}){const[a,o]=f.useState(""),i=f.useRef(null),s=f.useRef(null),r=ls();if(f.useLayoutEffect(()=>{const d=i.current;if(!(!e||!d))return o(""),d.showModal(),s.current?.focus(),()=>d.close()},[e]),!e)return null;const c=gpe(iz,a,r);return n.jsx("dialog",{ref:i,"aria-labelledby":"shortcuts-dialog-title",className:"m-auto w-[min(500px,calc(100%-32px))] max-h-[85vh] overflow-hidden rounded-2xl border border-hairline/50 bg-panel p-0 text-ink shadow-2xl backdrop:bg-black/60 backdrop:backdrop-blur-xs",onCancel:d=>{d.preventDefault(),t()},onKeyDown:d=>d.stopPropagation(),onMouseDown:d=>d.target===d.currentTarget&&t(),children:n.jsxs("div",{className:"flex max-h-[85vh] flex-col",children:[n.jsxs("div",{className:"flex items-center justify-between border-b border-hairline/40 px-5 py-4",children:[n.jsxs("div",{className:"flex items-center gap-2.5",children:[n.jsx("span",{className:"flex size-8 shrink-0 items-center justify-center rounded-lg bg-accent/15 text-accent",children:n.jsx(c4,{size:18})}),n.jsxs("div",{children:[n.jsx("h2",{id:"shortcuts-dialog-title",className:"text-[16px] font-semibold text-ink",children:"Keyboard Shortcuts"}),n.jsx("p",{className:"text-[12px] text-ink-secondary",children:"Quick commands and navigation"})]})]}),n.jsx("button",{type:"button",onClick:t,"aria-label":"Close keyboard shortcuts",className:"rounded-lg p-1.5 text-ink-secondary hover:bg-raised hover:text-ink",children:n.jsx(Nt,{size:18})})]}),n.jsx("div",{className:"border-b border-hairline/30 px-5 py-2.5",children:n.jsxs("div",{className:"flex items-center gap-2 rounded-xl border border-hairline/40 bg-inset px-3 py-1.5 focus-within:border-accent/60",children:[n.jsx(za,{size:14,className:"shrink-0 text-ink-secondary"}),n.jsx("input",{ref:s,value:a,onChange:d=>o(d.target.value),placeholder:"Search shortcuts…","aria-label":"Search shortcuts",className:"w-full bg-transparent text-[13px] text-ink placeholder:text-ink-secondary focus:outline-none"})]})}),n.jsx("div",{className:"flex-1 overflow-y-auto px-5 py-3 space-y-4",children:c.length===0?n.jsxs("div",{className:"py-8 text-center text-[13px] text-ink-secondary",children:["No shortcuts found for “",a,"”"]}):c.map(d=>n.jsxs("div",{className:"space-y-1",children:[n.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider text-ink-secondary/70",children:d.category}),n.jsx("div",{className:"divide-y divide-hairline/20 rounded-xl bg-card/40 px-3 py-1 border border-hairline/30",children:d.items.map(p=>n.jsx(oBe,{item:p,isMac:r},p.id))})]},d.category))}),n.jsxs("div",{className:"flex items-center justify-between border-t border-hairline/40 bg-card/30 px-5 py-2.5 text-[11.5px] text-ink-secondary",children:[n.jsxs("span",{children:["Press ",n.jsx("kbd",{className:"rounded bg-control px-1 py-0.5 font-mono text-[10.5px]",children:"?"})," when not typing to open"]}),n.jsx("button",{type:"button",onClick:t,className:"rounded-lg bg-raised px-3 py-1 font-medium text-ink hover:brightness-110",children:"Done"})]})]})})}function sBe(e,t){const a=(o,i)=>o.left<i.right&&o.right>i.left&&o.top<i.bottom&&o.bottom>i.top;return t.some(o=>o.visible&&o.rect.width>0&&o.rect.height>0&&(o.explicit||o.zIndex!==null&&o.zIndex>=10)&&e.some(i=>a(o.rect,i)))}async function rBe(e,t,a,o){t&&t!==a&&(await e.setInteractive(null),await e.release(t));const i=await e.take(a);if(!i.held)throw new Error("The Local VM control hold was not acquired");if(i.owned!==!0)return{status:"held-elsewhere",botId:a,snapshot:i};try{await e.setInteractive(o)}catch(s){throw await e.setInteractive(null).catch(()=>{}),await e.release(a).catch(()=>{}),s}return{status:"controlled",botId:a,snapshot:i}}async function C2(e,t){return t?(await e.setInteractive(null).catch(()=>{}),e.release(t)):null}function WH(e){return e.filter(t=>t.computer==="vm"&&t.hidden!==!0).map(t=>t.id)}function lBe(e,t){const a=WH(e),o=a.includes(t)?t:a[0]??null;return[o,a.find(i=>i!==o)??null]}function cBe(e,t,a){const o=[...e],i=t===0?1:0;return a&&o[i]===a&&(o[i]=o[t]),o[t]=a,o}function dBe(e,t){const a=WH(t),o=new Set(a),i=[null,null];for(const s of[0,1]){const r=e[s];r&&o.delete(r)&&(i[s]=r)}for(const s of[0,1]){if(i[s])continue;const r=[...o][0];r&&(i[s]=r,o.delete(r))}return i}const uBe=aa({mode:ui(["shared","per-bot"]).optional(),max_instances:qc().int().positive().optional(),container:ui(["running","stopped","missing"]).optional(),network:ui(["loopback","unsafe","unknown"]).optional(),security:ui(["hardened","unsafe","unknown"]).optional(),persistence:ui(["durable","unsafe","unknown"]).optional(),desktopReady:os().optional(),ready:os().optional(),viewer_url:Un().min(1).optional()});function JH(e){const t=uBe.safeParse(e);return t.success?t.data:null}function Q5(e){const t=JH(e),a=t?.mode??"unknown",o=t?.container??"unknown",i=t?.network??"unknown",s=t?.security??"unknown",r=t?.persistence??"unknown",c=t?.max_instances??0,d=t?.desktopReady===!0,p=!!(t?.ready===!0&&o==="running"&&i==="loopback"&&s==="hardened"&&r==="durable"&&d);return{mode:a,maxInstances:c,container:o,network:i,security:s,persistence:r,desktopReady:d,ready:p}}function pBe(e){const t=JH(e);return!t||!Q5(e).ready?null:t.viewer_url??null}const X5=["local-vm-workspace:left","local-vm-workspace:right"],YH=aa({held:os(),helpReason:Un().nullable(),owned:os().optional(),acquired:os().optional(),released:os().optional()});async function fB(e,t,a){const o=await X(`/api/bots/${e}/computer/control`,{method:"POST",body:JSON.stringify({action:t,controlLeaseId:a})}),i=YH.safeParse(o);if(!i.success)throw new Error("invalid-control-snapshot");return i.data}async function mBe(e){const t=YH.safeParse(await X(`/api/bots/${e}/computer/control`));if(!t.success)throw new Error("invalid-control-snapshot");return t.data}function bB(e,t){fetch(`/api/bots/${e}/computer/control`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"release",controlLeaseId:t}),keepalive:!0}).then(async a=>{a.ok}).catch(()=>{})}async function yB(e,t){return!0}function j2(e,t,a){e({type:"computerControl",botId:t,held:a.held,helpReason:a.helpReason})}function xB(e){const t=e.current?.getBoundingClientRect();return!t||t.width<1||t.height<1?null:{x:Math.round(t.left),y:Math.round(t.top),width:Math.round(t.width),height:Math.round(t.height)}}const hBe=['[aria-modal="true"]','[role="dialog"]','[role="menu"]',"[popover]","[data-native-view-overlay]",".fixed",".absolute"].join(",");function gBe(){const e=[...document.querySelectorAll("[data-native-view-host]")],t=e.map(o=>o.getBoundingClientRect()).filter(o=>o.width>0&&o.height>0);if(t.length===0)return!1;const a=[...document.querySelectorAll(hBe)].filter(o=>!e.some(i=>o===i||o.contains(i)||i.contains(o))).map(o=>{const i=window.getComputedStyle(o),s=o.matches('[aria-modal="true"], [role="dialog"], [role="menu"], [popover], [data-native-view-overlay]'),r=Number.parseInt(i.zIndex,10);return{rect:o.getBoundingClientRect(),explicit:s,visible:i.display!=="none"&&i.visibility!=="hidden"&&Number(i.opacity)!==0,zIndex:Number.isFinite(r)?r:null}});return sBe(t,a)}function fBe(e){const[t,a]=f.useState(!1);return f.useEffect(()=>{let o=0;const i=()=>a(gBe()),s=()=>{o||(o=requestAnimationFrame(()=>{o=0,i()}))};i();const r=new MutationObserver(s);r.observe(document.body,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["class","style","aria-hidden","aria-modal","role","open","popover"]});const c=new ResizeObserver(s);c.observe(document.body);for(const p of document.querySelectorAll("[data-native-view-host]"))c.observe(p);const d=["toggle","animationstart","animationend","transitionstart","transitionend"];for(const p of d)document.addEventListener(p,s,!0);return window.addEventListener("resize",s),window.addEventListener("scroll",s,!0),()=>{o&&cancelAnimationFrame(o),r.disconnect(),c.disconnect();for(const p of d)document.removeEventListener(p,s,!0);window.removeEventListener("resize",s),window.removeEventListener("scroll",s,!0)}},[]),e||t}function bBe(e,t){return e?e.container==="missing"?"VM not created":e.container==="stopped"?"VM stopped":e.ready?t==="error"?"Viewer unavailable":t!=="ready"?"Connecting viewer":"Live · watch-only":"VM unavailable":"Checking VM"}function yBe({index:e,bot:t,bots:a,otherBotId:o,obscured:i,active:s,heldElsewhere:r,controlPending:c,onSelect:d,onTake:p,onRelease:h,onOpenComputer:g}){const b=X5[e],x=t?.id??null,v=t?.name??"Local VM",k=f.useRef(null),S=f.useRef(Promise.resolve()),N=f.useRef(i),[C,j]=f.useState(0),[M,D]=f.useState(null),[A,R]=f.useState({contextId:b,open:!1,status:"closed",interactive:!1}),[P,O]=f.useState(null),T=f.useCallback(async K=>{if(x)try{const H=await X(`/api/bots/${x}/local-computer`,{signal:K});K?.aborted||D(Q5(H))}catch{}},[x]),z=f.useRef(T);f.useEffect(()=>{z.current=T},[T]),f.useEffect(()=>{N.current=i},[i]),f.useEffect(()=>window.ogb?.desktopWorkspace?.onState(H=>{H.contextId===b&&(R(H),(H.status==="error"||H.status==="closed")&&z.current())}),[b]),f.useEffect(()=>{const K=window.ogb?.desktopWorkspace;let H=!0;const U=new AbortController;D(null),O(null),R({contextId:b,open:!1,status:"closed",interactive:!1});const Q=async()=>{if(K&&await K.close(b).catch(()=>{}),!(!H||!x)){if(!K){O("The two-desktop workspace requires the Atomic desktop app.");return}try{const W=await X(`/api/bots/${x}/local-computer`,{signal:U.signal});if(!H)return;const q=Q5(W);D(q);const Z=pBe(W);if(!q.ready||!Z||(await new Promise(ue=>{let he=!1;const we=()=>{he||(he=!0,ue())},ee=setTimeout(we,100);requestAnimationFrame(()=>{clearTimeout(ee),we()})}),!H))return;const oe=xB(k);if(!oe)throw new Error("layout-unavailable");const _=await K.open({contextId:b,url:Z,title:`${v}'s Local VM`,bounds:oe});if(!H){await K.close(b).catch(()=>{});return}R(_),await K.layout([{contextId:b,bounds:oe,visible:!N.current&&_.open}])}catch(W){if(!H||U.signal.aborted)return;O(W instanceof Error&&W.message==="layout-unavailable"?"The viewer area is not laid out yet. Retry after resizing the window.":"Atomic could not connect this Local VM viewer.")}}};return S.current=S.current.catch(()=>{}).then(Q),()=>{H=!1,U.abort(),K&&(S.current=S.current.catch(()=>{}).then(()=>K.close(b).then(()=>{}).catch(()=>{})))}},[x,v,b,C]),f.useEffect(()=>{if(!x)return;const K=new AbortController,H=window.setInterval(()=>{T(K.signal)},3e4);return()=>{K.abort(),window.clearInterval(H)}},[x,T]);const B=f.useCallback(()=>{const K=window.ogb?.desktopWorkspace,H=xB(k);!K||!H||!A.open||K.layout([{contextId:b,bounds:H,visible:!i}]).catch(()=>O("Atomic could not position this Local VM viewer."))},[b,A.open,i]);f.useEffect(()=>{const K=k.current;if(!K)return;const H=new ResizeObserver(B);H.observe(K),window.addEventListener("resize",B);const U=requestAnimationFrame(B);return()=>{cancelAnimationFrame(U),H.disconnect(),window.removeEventListener("resize",B)}},[B]);const L=bBe(M,A.status),G=!!(t&&M?.ready&&A.status==="ready"&&A.open);return n.jsxs("section",{className:V("flex min-h-0 min-w-0 flex-col overflow-hidden rounded-xl border bg-panel",s?"border-accent/80 shadow-[0_0_0_1px_rgb(var(--accent)/0.35)]":"border-hairline/50"),children:[n.jsxs("div",{className:"flex min-h-[68px] items-center gap-3 border-b border-hairline/40 px-3 py-2.5",children:[n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsxs("label",{className:"sr-only",htmlFor:`local-vm-slot-${e}`,children:["Local VM for pane ",e+1]}),n.jsxs("select",{id:`local-vm-slot-${e}`,value:t?.id??"",onChange:K=>d(K.target.value||null),disabled:c,className:"w-full truncate rounded-lg border border-hairline/50 bg-card px-2.5 py-1.5 text-[13px] font-medium text-ink outline-none focus:border-accent/70",children:[n.jsx("option",{value:"",children:"Choose a Local VM bot"}),a.map(K=>n.jsx("option",{value:K.id,disabled:K.id===o,children:K.name},K.id))]}),n.jsxs("div",{className:"mt-1 flex items-center gap-1.5 text-[11px] text-ink-secondary",children:[n.jsx("span",{className:V("h-1.5 w-1.5 rounded-full",s?"bg-accent":A.status==="ready"?"bg-success":A.status==="error"?"bg-danger":"bg-ink-secondary/50")}),s?"You have control":r?"Control held elsewhere":L]})]}),t&&s?n.jsxs("button",{type:"button",onClick:h,disabled:c,className:"flex shrink-0 items-center gap-1.5 rounded-lg bg-accent px-2.5 py-2 text-[12px] font-medium text-white hover:brightness-110 disabled:opacity-50",children:[c?n.jsx(Ie,{size:13,className:"animate-spin"}):n.jsx(Ri,{size:13}),"Hand back"]}):t?n.jsxs("button",{type:"button",onClick:()=>p(t.id),disabled:!G||c||r,className:"flex shrink-0 items-center gap-1.5 rounded-lg bg-raised px-2.5 py-2 text-[12px] text-ink hover:bg-raised-hover disabled:opacity-45",title:"Pause only this bot and enable keyboard and pointer input in this pane",children:[c?n.jsx(Ie,{size:13,className:"animate-spin"}):n.jsx(Ri,{size:13}),r?"Held elsewhere":"Take control"]}):null]}),n.jsx("div",{ref:k,"data-native-view-host":!0,className:"relative min-h-0 flex-1 bg-[#070707]",children:n.jsx("div",{className:"absolute inset-0 flex items-center justify-center p-6 text-center",children:t?!M&&!P?n.jsxs("div",{className:"flex items-center gap-2 text-[12px] text-ink-secondary",children:[n.jsx(Ie,{size:15,className:"animate-spin"})," Checking ",t.name,"'s VM…"]}):M?.ready&&A.status!=="error"&&!P?n.jsxs("div",{className:"flex items-center gap-2 text-[12px] text-ink-secondary",children:[n.jsx(Ie,{size:15,className:"animate-spin"})," Connecting live view…"]}):n.jsxs("div",{className:"flex max-w-[300px] flex-col items-center gap-3 text-ink-secondary",children:[n.jsx(Zn,{size:21,className:"text-warning"}),n.jsx("div",{className:"text-[12px] leading-relaxed",children:P??(M?.container==="missing"?`${t.name}'s Local VM has not been created.`:M?.container==="stopped"?`${t.name}'s Local VM is stopped.`:`${t.name}'s Local VM is not ready for a live view.`)}),n.jsxs("div",{className:"flex gap-2",children:[n.jsxs("button",{type:"button",onClick:()=>j(K=>K+1),className:"flex items-center gap-1.5 rounded-lg bg-raised px-3 py-2 text-[12px] text-ink hover:bg-raised-hover",children:[n.jsx(fn,{size:13})," Retry status"]}),n.jsx("button",{type:"button",onClick:()=>g(t.id),className:"rounded-lg bg-raised px-3 py-2 text-[12px] text-ink hover:bg-raised-hover",children:"Open Computer"})]})]}):n.jsxs("div",{className:"flex max-w-[260px] flex-col items-center gap-2 text-ink-secondary",children:[n.jsx(Ba,{size:22}),n.jsx("span",{className:"text-[12px]",children:"Choose another bot configured for a Local VM."})]})})})]})}function xBe({primaryBotId:e,overlayOpen:t,onClose:a,onOpenComputer:o}){const{state:i,dispatch:s}=ve(),r=f.useMemo(()=>i.bots.filter(L=>L.computer==="vm"&&!L.hidden),[i.bots]),[c,d]=f.useState(()=>lBe(i.bots,e)),p=f.useRef(c),[h,g]=f.useState(null),b=f.useRef(null),x=f.useRef(null),v=x.current??crypto.randomUUID();x.current=v;const k=f.useRef(!1),S=f.useRef(!0),[N,C]=f.useState(!1),[j,M]=f.useState(null),D=fBe(t);f.useEffect(()=>{p.current=c},[c]);const A=f.useMemo(()=>({async take(L){const G=await U5({action:"take",syncNativeBrowser:!0,requestControl:K=>fB(L,K,v),setNativeBrowserControl:K=>yB()});return j2(s,L,G),G.held&&G.owned===!0?b.current=L:b.current===L&&(b.current=null),G},async release(L){const G=await U5({action:"release",syncNativeBrowser:!0,requestControl:K=>fB(L,K,v),setNativeBrowserControl:K=>yB()});return j2(s,L,G),b.current===L&&(b.current=null),G},async setInteractive(L){const G=window.ogb?.desktopWorkspace;if(!G)throw new Error("The desktop workspace bridge is unavailable");return G.setInteractive(L)}}),[v,s]);f.useEffect(()=>{d(L=>{const G=dBe(L,i.bots);return G[0]===L[0]&&G[1]===L[1]?L:G})},[i.bots]),f.useEffect(()=>{let L=!0;return(async()=>{for(const K of c)if(K)try{const H=await mBe(K);L&&j2(s,K,H)}catch{}})(),()=>{L=!1}},[s,c]),f.useEffect(()=>{const L=b.current;!L||c.includes(L)||C2(A,L).then(()=>{g(null)}).catch(()=>{M("The removed pane could not hand control back safely.")})},[A,c]),f.useEffect(()=>(S.current=!0,()=>{S.current=!1;const L=b.current,G=window.ogb?.desktopWorkspace;if(!G){L&&bB(L,v);return}G.setInteractive(null).catch(()=>{}).then(()=>(L&&bB(L,v),G.close())).catch(()=>{})}),[v]);const R=f.useCallback(L=>{const G=p.current.indexOf(L);return G<0?null:X5[G]},[]),P=f.useCallback(async()=>{const L=b.current;if(!L)return!0;if(k.current)return!1;k.current=!0,C(!0),M(null);try{return await C2(A,L),g(null),!0}catch{return M("Atomic could not hand control back. The workspace stayed open."),!1}finally{k.current=!1,C(!1)}},[A]),O=f.useCallback(async L=>{if(k.current||b.current===L)return;const G=window.ogb?.desktopWorkspace,K=R(L);if(!(!G||!K)){k.current=!0,C(!0),M(null);try{const H={...A,async setInteractive(Q){if(Q&&R(L)!==Q)throw new Error("The Local VM pane changed during control acquisition");return A.setInteractive(Q)}},U=await rBe(H,b.current,L,K);if(g(null),U.status==="held-elsewhere"){M("This VM is already controlled in another viewer. Hand it back there first.");return}if(!S.current){await C2(A,L).catch(()=>{});return}g(L)}catch{g(b.current),M("Control could not switch safely. Any remaining hold stayed paused.")}finally{k.current=!1,C(!1)}}},[R,A]),T=f.useCallback(async(L,G)=>{if(k.current)return;const K=p.current[L];K!==G&&(K&&b.current===K&&!await P()||d(H=>cBe(H,L,G)))},[P]),z=f.useCallback(async()=>{b.current&&!await P()||a()},[P,a]),B=f.useCallback(async L=>{b.current&&!await P()||o(L)},[P,o]);return n.jsxs("main",{className:"flex h-full min-w-0 flex-1 flex-col bg-app",children:[n.jsxs("header",{className:"flex min-h-[60px] items-center gap-3 border-b border-hairline/40 px-5 py-3",children:[n.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-accent/15 text-accent",children:n.jsx(Ba,{size:18})}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("h1",{className:"truncate text-[14px] font-semibold text-ink",children:"Local VM workspace"}),n.jsx("p",{className:"truncate text-[11.5px] text-ink-secondary",children:"Two live desktops · one active controller · watch-only by default"})]}),n.jsx("button",{type:"button",onClick:()=>{z()},disabled:N,className:"rounded-md p-1.5 text-ink-secondary hover:bg-raised hover:text-ink disabled:opacity-50","aria-label":"Close Local VM workspace",children:n.jsx(Nt,{size:18})})]}),j&&n.jsxs("div",{className:"mx-3 mt-3 flex items-center gap-2 rounded-lg border border-danger/30 bg-danger/10 px-3 py-2 text-[12px] text-danger",children:[n.jsx(Zn,{size:14,className:"shrink-0"})," ",j]}),n.jsx("div",{className:"grid min-h-0 flex-1 grid-cols-2 gap-3 p-3",children:[0,1].map(L=>{const G=c[L],K=r.find(H=>H.id===G)??null;return n.jsx(yBe,{index:L,bot:K,bots:r,otherBotId:c[L===0?1:0],obscured:D,active:!!(K&&h===K.id),heldElsewhere:!!(K&&i.computerControl[K.id]?.held&&h!==K.id),controlPending:N,onSelect:H=>{T(L,H)},onTake:H=>{O(H)},onRelease:()=>{P()},onOpenComputer:H=>{B(H)}},X5[L])})})]})}const vBe={collaborations:[],queued:[],running:[]};function kBe(e,t=[]){const a=new Map;for(const o of e){if(o.hidden)continue;const i=o.section?.trim()||"";a.set(i,[...a.get(i)??[],o])}for(const o of t){const i=o.trim();i&&!a.has(i)&&a.set(i,[])}return[...a].map(([o,i])=>({key:o,name:o||"General",chiefs:i.filter(s=>s.chiefOfStaff),members:i.filter(s=>!s.chiefOfStaff)}))}function wBe(e,t){const a=new Set(e.filter(s=>!s.hidden).map(s=>s.id)),o=new Map,i=(s,r)=>[s,r].sort().join(":");for(const s of t.collaborations){const[r,c]=s.botIds;!a.has(r)||!a.has(c)||o.set(i(r,c),{sourceBotId:r,targetBotId:c,state:"connected",groupId:s.groupId,lastAt:s.lastAt})}for(const s of t.queued)!a.has(s.sourceBotId)||!a.has(s.targetBotId)||o.set(i(s.sourceBotId,s.targetBotId),{sourceBotId:s.sourceBotId,targetBotId:s.targetBotId,state:"queued",reason:s.reason});for(const s of t.running)!a.has(s.sourceBotId)||!a.has(s.targetBotId)||o.set(i(s.sourceBotId,s.targetBotId),{sourceBotId:s.sourceBotId,targetBotId:s.targetBotId,state:"running",groupId:s.groupId});return[...o.values()].sort((s,r)=>{const c={running:0,queued:1,connected:2};return c[s.state]-c[r.state]||(r.lastAt??0)-(s.lastAt??0)})}function SBe(e){return e.activity==="waiting-on-you"?{label:"Waiting for you",tone:"warning"}:e.activity==="dead"||e.activity==="no-signal"?{label:"No signal",tone:"danger"}:e.busy||e.activity==="working"?{label:"Working",tone:"success"}:{label:"Ready",tone:"idle"}}const CBe=236,jBe=126,vB=16,kB=20,NBe=64,N2="application/x-omb-computer";function Gm(e,t=[]){const a=new Map(t.map((o,i)=>[o,i]));return[...e].sort((o,i)=>(a.get(o.id)??1/0)-(a.get(i.id)??1/0))}function ABe(e,t,a){const o=e.map(s=>s.id);if(!o.includes(t))return o;const i=o.filter(s=>s!==t);return i.splice(Math.max(0,Math.min(i.length,a)),0,t),i}function MBe(e){try{const t=JSON.parse(e??"null");return t===null||typeof t!="object"||Array.isArray(t)?{}:Object.fromEntries(Object.entries(t).flatMap(([a,o])=>Array.isArray(o)?[[a,[...new Set(o.filter(i=>typeof i=="string"&&i.length>0))]]]:[]))}catch{return{}}}function IBe(e){const t=e.chiefs.length>0&&e.members.length>0,a=t?Math.max(e.chiefs.length,e.members.length):Math.max(1,e.chiefs.length+e.members.length);return{width:CBe*(t?2:1)+kB*2+(t?40:0),height:NBe+kB+a*(jBe+vB)-vB}}function PBe(e,t){const a=e.map(IBe),o=Math.max(0,...a.filter((s,r)=>r%2===0).map(s=>s.width));let i=40;return e.map((s,r)=>{r>0&&r%2===0&&(i+=Math.max(a[r-2].height,a[r-1].height)+56);const c=Object.hasOwn(t,s.key)?t[s.key]:void 0;return{key:s.key,x:c?.x??(r%2===0?40:40+o+56),y:c?.y??i,...a[r]}})}function TBe(e,t,a){if(!e.length)return{x:0,y:0,scale:1};const o=Math.min(...e.map(d=>d.x)),i=Math.min(...e.map(d=>d.y)),s=Math.max(...e.map(d=>d.x+d.width))-o,r=Math.max(...e.map(d=>d.y+d.height))-i,c=Math.max(.3,Math.min(1,(t-80)/s,(a-80)/r));return{x:(t-s*c)/2-o*c,y:(a-r*c)/2-i*c,scale:c}}function wB(e,t,a){const o=t/e.scale;return{x:a.x-(a.x-e.x)*o,y:a.y-(a.y-e.y)*o,scale:t}}function BBe(e){try{const t=JSON.parse(e??"null");return t===null||typeof t!="object"||Array.isArray(t)?{}:Object.fromEntries(Object.entries(t).flatMap(([a,o])=>{if(o===null||typeof o!="object"||Array.isArray(o))return[];const{x:i,y:s}=o;return typeof i=="number"&&Number.isFinite(i)&&Math.abs(i)<1e5&&typeof s=="number"&&Number.isFinite(s)&&Math.abs(s)<1e5?[[a,{x:i,y:s}]]:[]}))}catch{return{}}}const Mh="flex size-9 shrink-0 items-center justify-center rounded-lg text-ink-secondary hover:bg-control hover:text-ink focus-visible:outline-2 focus-visible:outline-accent",gy="flex w-full items-center gap-2 rounded-lg px-3 py-2.5 text-left text-[12px] text-ink-secondary hover:bg-control hover:text-ink";function EBe({bot:e,selected:t,moving:a,connected:o,onComputer:i,onArrange:s}){const{state:r,dispatch:c}=ve(),d=SBe(e),p=r.instances.find(g=>g.instanceId===e.modelSelection.instanceId),h=p?.models.options.find(g=>g.id===e.modelSelection.model)?.label??e.modelSelection.model;return n.jsxs("article",{className:V("relative h-[126px] w-[236px] shrink-0 rounded-xl border bg-card shadow-sm transition-colors",t?"border-accent/60 ring-1 ring-accent/15":o?"border-accent/40":"border-hairline/50 hover:border-ink-secondary/40",a&&"opacity-35"),children:[n.jsxs("button",{"data-bot-id":e.id,"aria-label":l("canvas.editBot",{name:e.name}),onClick:()=>c({type:"toggleSettings",botId:e.id,section:"identity",open:!0}),title:s?l("canvas.reorderHint"):void 0,onKeyDown:g=>{!s||!g.altKey||g.key!=="ArrowUp"&&g.key!=="ArrowDown"||(g.preventDefault(),g.stopPropagation(),s(e,g.key==="ArrowUp"?-1:1))},className:"flex h-[82px] w-full cursor-grab items-center gap-3 rounded-t-xl px-4 text-left active:cursor-grabbing focus-visible:outline-2 focus-visible:outline-accent",children:[n.jsx(Jt,{bot:e,size:38,motion:"none",motionKey:0,animated:!1}),n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"truncate text-[14px] font-semibold",children:e.name}),e.chiefOfStaff&&n.jsx(cp,{size:12,className:"shrink-0 text-warning","aria-label":l("chat.chiefOfStaff")})]}),n.jsx("span",{className:"mt-1 block truncate text-[11px] text-ink-secondary",children:e.title||(e.chiefOfStaff?l("chat.chiefOfStaff"):l("canvas.bot"))})]})]}),n.jsxs("div",{className:"flex h-[43px] items-center gap-1 border-t border-hairline/30 px-2",children:[n.jsx("button",{className:V(Mh,"size-8"),"aria-label":l("canvas.openBotChat",{name:e.name}),title:l("canvas.openChat"),onClick:()=>c(sa(e)),children:n.jsx(RJ,{size:13})}),d.tone!=="idle"&&n.jsxs("span",{className:"flex items-center gap-1.5 text-[10px] text-ink-secondary",title:d.label,children:[n.jsx("span",{className:V("size-1.5 rounded-full",d.tone==="success"?"bg-success":d.tone==="warning"?"bg-warning":d.tone==="danger"?"bg-danger":"bg-ink-secondary/35")}),d.label]}),t&&i&&n.jsx("button",{className:V(Mh,"size-8"),"aria-label":l("canvas.botComputer",{name:e.name}),title:l("computer.tab.computer"),onClick:()=>i(e),children:n.jsx(Ba,{size:13})}),n.jsxs("button",{"aria-label":l("canvas.changeModel",{name:e.name}),title:`${l("canvas.defaultModel")}: ${h}`,onClick:()=>c({type:"toggleSettings",botId:e.id,section:"model",open:!0}),className:"ml-auto flex h-8 min-w-0 max-w-[130px] items-center gap-1.5 rounded-md px-2 text-[10px] text-ink-secondary hover:bg-control hover:text-ink focus-visible:outline-2 focus-visible:outline-accent",children:[n.jsx("span",{className:"flex size-3.5 shrink-0 items-center justify-center",children:p?n.jsx(Il,{instance:p,size:13}):n.jsx(hd,{driverKind:"",size:13})}),n.jsx("span",{className:"truncate",children:h||l("canvas.defaultModel")})]})]})]})}function RBe({sections:e,canManage:t,onMove:a,onInstructions:o,onEditTeam:i,onDeleteTeam:s,onComputer:r,onComputerDrop:c,onTeamComputer:d,teamComputers:p={},connectedBotIds:h=[]}){const{state:g}=ve(),b=f.useRef(null),x=f.useRef(null),v=f.useRef(!1),k=f.useRef(!1),S=f.useRef(null),[N,C]=f.useState({}),[j,M]=f.useState({}),[D,A]=f.useState({x:40,y:40,scale:1}),[R,P]=f.useState(null),[O,T]=f.useState(null),[z,B]=f.useState(null),[L,G]=f.useState(null),[K,H]=f.useState(null),[U,Q]=f.useState(""),[W,q]=f.useState(!1),[Z,oe]=f.useState(null),_=f.useMemo(()=>PBe(e,N),[e,N]),ue=f.useRef({view:D,positions:N,tiles:_,selectedId:g.selectedId,settingsOpen:g.settingsOpen});ue.current={view:D,positions:N,tiles:_,selectedId:g.selectedId,settingsOpen:g.settingsOpen},f.useEffect(()=>{let de=!0;return X("/.well-known/openmausbot/environment",{signal:AbortSignal.timeout(5e3)}).then(pe=>{if(!(!de||typeof pe.environmentId!="string")){S.current=`omb-team-canvas:${pe.environmentId}`;try{const ke=BBe(localStorage.getItem(S.current));C(Ge=>({...ke,...Ge})),M(MBe(localStorage.getItem(`${S.current}:bot-order`)))}catch{}}}).catch(()=>{}).finally(()=>{de&&q(!0)}),()=>{de=!1}},[]);const he=de=>{if(C(de),!!S.current)try{localStorage.setItem(S.current,JSON.stringify(Object.fromEntries(e.filter(pe=>Object.hasOwn(de,pe.key)).map(pe=>[pe.key,de[pe.key]]))))}catch{}},we=de=>Object.hasOwn(j,de)?j[de]:[],ee=(de,pe,ke,Ge)=>{const Ee={...j,[de.key]:[...ABe(pe,ke.id,Ge),...Gm(ke.chiefOfStaff?de.members:de.chiefs,we(de.key)).map(ce=>ce.id)]};if(M(Ee),S.current)try{localStorage.setItem(`${S.current}:bot-order`,JSON.stringify(Ee))}catch{}Q(l("canvas.arrangedBot",{name:ke.name,team:de.name}))},Y=(de,pe)=>{const ke=e.find(Ee=>Ee.key===(de.section?.trim()??""));if(!ke)return;const Ge=Gm(de.chiefOfStaff?ke.chiefs:ke.members,we(ke.key));ee(ke,Ge,de,Ge.findIndex(Ee=>Ee.id===de.id)+pe)},ne=f.useCallback(()=>{const de=b.current?.getBoundingClientRect();de&&A(TBe(ue.current.tiles,de.width,de.height))},[]);f.useEffect(()=>{const de=b.current;if(!de)return;let pe=null;const ke=new ResizeObserver(()=>{const Ge=de.getBoundingClientRect();if(!pe)ne();else{const Ee=ue.current.settingsOpen?[...de.querySelectorAll("[data-bot-id]")].find(le=>le.dataset.botId===ue.current.selectedId)?.getBoundingClientRect():void 0,ce=Ee?Ge.width/2-(Ee.left-Ge.left+Ee.width/2):(Ge.width-pe.width)/2,Ue=Ee?Ge.height/2-(Ee.top-Ge.top+Ee.height/2):(Ge.height-pe.height)/2;A(le=>({...le,x:le.x+ce,y:le.y+Ue}))}pe={width:Ge.width,height:Ge.height}});return ke.observe(de),()=>ke.disconnect()},[ne]);const ae=JSON.stringify(_.map(({key:de,width:pe,height:ke})=>[de,pe,ke]));f.useEffect(()=>{ne()},[ne,ae,W]),f.useEffect(()=>{const de=b.current?.querySelector("details[open]"),pe=b.current?.getBoundingClientRect();de&&pe&&oe(de.getBoundingClientRect().bottom>pe.bottom-210*D.scale?de.closest("[data-team-key]")?.dataset.teamKey??null:null)},[D,ae]),f.useEffect(()=>{const de=b.current;if(!de)return;const pe=ke=>{if(ke.target.closest("details[open]")||(ke.preventDefault(),x.current))return;const Ge=ue.current.view,Ee=de.getBoundingClientRect();if(ke.ctrlKey||ke.metaKey){const ce=Math.min(1.5,Math.max(.3,Ge.scale*Math.exp(-ke.deltaY*.006)));A(wB(Ge,ce,{x:ke.clientX-Ee.left,y:ke.clientY-Ee.top}))}else{const ce=ke.deltaMode===1?16:ke.deltaMode===2?Ee.height:1;A({...Ge,x:Ge.x-ke.deltaX*ce,y:Ge.y-ke.deltaY*ce})}};return de.addEventListener("wheel",pe,{passive:!1}),()=>de.removeEventListener("wheel",pe)},[]);const je=de=>{if(de.button!==0||!de.isPrimary||x.current)return;const pe=de.target,ke=pe.closest("[data-bot-id]")?.dataset.botId,Ge=pe.closest("[data-arrange-team]")?.dataset.arrangeTeam,Ee=ke?e.flatMap(le=>[...le.chiefs,...le.members]).find(le=>le.id===ke):void 0;if(!Ee&&Ge===void 0&&pe.closest("button, details, a, input, [data-team-key]")||Ee&&(K||!W)||Ge!==void 0&&!W)return;const ce={id:de.pointerId,start:{x:de.clientX,y:de.clientY},view:D,positions:N,moved:!1},Ue=Ge===void 0?void 0:_.find(le=>le.key===Ge);x.current=Ee?{...ce,kind:"bot",bot:Ee}:Ue?{...ce,kind:"team",key:Ue.key,origin:Ue}:{...ce,kind:"pan"},v.current=!1},xe=(de,pe)=>{const ke=document.elementFromPoint(de,pe)?.closest("[data-team-key]");return ke&&b.current?.contains(ke)?ke.dataset.teamKey??null:null},re=(de,pe)=>{const ke=e.find(le=>le.key===(de.section?.trim()??""));if(!ke)return null;const Ge=Gm(de.chiefOfStaff?ke.chiefs:ke.members,we(ke.key)),Ee=Ge.filter(le=>le.id!==de.id),ce=[...b.current?.querySelectorAll("[data-bot-id]")??[]],Ue=Ee.findIndex(le=>{const Fe=ce.find(tt=>tt.dataset.botId===le.id)?.closest("article")?.getBoundingClientRect();return Fe?pe<Fe.top+Fe.height/2:!1});return{section:ke,lane:Ge,remaining:Ee,index:Ue<0?Ee.length:Ue}},Se=de=>{const pe=x.current;if(!pe||pe.id!==de.pointerId)return;if(de.buttons===0){Be(de,!0);return}const ke=de.clientX-pe.start.x,Ge=de.clientY-pe.start.y;if(!(!pe.moved&&Math.hypot(ke,Ge)<5)&&(pe.moved=!0,de.currentTarget.setPointerCapture(de.pointerId),pe.kind==="pan"&&A({...pe.view,x:pe.view.x+ke,y:pe.view.y+Ge}),pe.kind==="team"&&C({...pe.positions,[pe.key]:{x:pe.origin.x+ke/D.scale,y:pe.origin.y+Ge/D.scale}}),pe.kind==="bot")){const Ee=de.currentTarget.getBoundingClientRect();P({bot:pe.bot,point:{x:de.clientX-Ee.left,y:de.clientY-Ee.top}});const ce=xe(de.clientX,de.clientY),Ue=ce===(pe.bot.section?.trim()??"");T(Ue||t?ce:null);const le=Ue?re(pe.bot,de.clientY):null,Fe=le?.remaining[le.index]??le?.remaining.at(-1);G(le&&Fe?{botId:Fe.id,after:le.index===le.remaining.length}:null)}},Be=(de,pe=!1)=>{const ke=x.current;if(!(!ke||de&&ke.id!==de.pointerId)){if(x.current=null,v.current=ke.moved,window.setTimeout(()=>{v.current=!1},0),P(null),T(null),G(null),b.current?.hasPointerCapture(ke.id)&&b.current.releasePointerCapture(ke.id),pe){C(ke.positions),A(ke.view);return}if(ke.moved&&(ke.kind==="team"&&de&&he({...ke.positions,[ke.key]:{x:ke.origin.x+(de.clientX-ke.start.x)/ke.view.scale,y:ke.origin.y+(de.clientY-ke.start.y)/ke.view.scale}}),ke.kind==="bot"&&de)){const Ge=xe(de.clientX,de.clientY);if(Ge===null)return;if(Ge===(ke.bot.section?.trim()??"")){const Ee=re(ke.bot,de.clientY);Ee&&ee(Ee.section,Ee.lane,ke.bot,Ee.index);return}if(!t)return;H(ke.bot.id),Q(l("canvas.reviewMove",{name:ke.bot.name,team:Ge||l("settings.section.general")})),a(ke.bot,Ge).then(Ee=>{Q(Ee===!1?l("canvas.moveCancelled"):l("canvas.moved",{name:ke.bot.name,team:Ge||l("settings.section.general")}))}).catch(Ee=>{Q(Ee instanceof Error?Ee.message:String(Ee))}).finally(()=>H(null))}}},nt=de=>{const pe=b.current?.getBoundingClientRect();pe&&A(wB(D,Math.max(.3,Math.min(1.5,D.scale*de)),{x:pe.width/2,y:pe.height/2}))},ge=e.find(de=>de.key===O),Qe=z!==null?l("canvas.assignComputer",{team:e.find(de=>de.key===z)?.name??z}):R&&ge?(R.bot.section?.trim()??"")===ge.key?l("canvas.arrangeBot",{name:R.bot.name,team:ge.name}):l("canvas.moveBot",{name:R.bot.name,team:ge.name}):null;return n.jsxs("div",{ref:b,role:"region","aria-label":l("canvas.region"),tabIndex:0,"data-team-canvas":!0,className:"relative min-h-0 flex-1 touch-none overflow-clip outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent/40",style:{backgroundImage:"radial-gradient(circle, color-mix(in srgb, var(--color-ink-secondary) 18%, transparent) 1px, transparent 1px)",backgroundSize:`${24*D.scale}px ${24*D.scale}px`,backgroundPosition:`${D.x}px ${D.y}px`},onPointerDown:je,onPointerMove:Se,onPointerUp:de=>Be(de),onPointerCancel:de=>Be(de,!0),onDragOver:de=>{if(!t||!c||!de.dataTransfer.types.includes(N2))return;const pe=de.target.closest("[data-team-key]"),ke=pe&&de.currentTarget.contains(pe)?pe.dataset.teamKey??null:null;B(ke),ke!==null&&(de.preventDefault(),de.dataTransfer.dropEffect="link")},onDragLeave:de=>{(!(de.relatedTarget instanceof Node)||!de.currentTarget.contains(de.relatedTarget))&&B(null)},onDrop:de=>{if(B(null),!t||!c||!de.dataTransfer.types.includes(N2))return;const pe=de.target.closest("[data-team-key]"),ke=pe&&de.currentTarget.contains(pe)?pe.dataset.teamKey:void 0,Ge=de.dataTransfer.getData(N2);ke===void 0||!e.some(Ee=>Ee.key===ke)||!Ge||(de.preventDefault(),c(Ge,ke))},onDragEnd:()=>B(null),onPointerDownCapture:de=>{k.current=!1,de.target.closest("details")||de.currentTarget.querySelectorAll("details[open]").forEach(pe=>pe.removeAttribute("open"))},onKeyDownCapture:de=>{de.key==="Tab"&&(k.current=!0)},onPointerLeave:()=>{x.current&&!x.current.moved&&Be(void 0,!0)},onLostPointerCapture:()=>{x.current&&Be(void 0,!0)},onFocusCapture:de=>{if(!k.current||!(de.target instanceof HTMLElement)||!de.target.closest("[data-canvas-world]"))return;const pe=de.currentTarget.getBoundingClientRect(),ke=de.target.getBoundingClientRect(),Ge=ke.left<pe.left+16?pe.left+16-ke.left:ke.right>pe.right-16?pe.right-16-ke.right:0,Ee=ke.top<pe.top+16?pe.top+16-ke.top:ke.bottom>pe.bottom-70?pe.bottom-70-ke.bottom:0;(Ge||Ee)&&A(ce=>({...ce,x:ce.x+Ge,y:ce.y+Ee}))},onClickCapture:de=>{v.current&&(v.current=!1,de.preventDefault(),de.stopPropagation())},onKeyDown:de=>{if(de.key==="Escape"&&(Be(void 0,!0),de.currentTarget.querySelectorAll("details[open]").forEach(Ge=>{Ge.querySelector("summary")?.focus({preventScroll:!0}),Ge.removeAttribute("open")})),de.target!==de.currentTarget)return;const ke={ArrowLeft:{x:60,y:0},ArrowRight:{x:-60,y:0},ArrowUp:{x:0,y:60},ArrowDown:{x:0,y:-60}}[de.key];ke&&(de.preventDefault(),A({...D,x:D.x+ke.x,y:D.y+ke.y})),(de.key==="+"||de.key==="=")&&(de.preventDefault(),nt(1.2)),de.key==="-"&&(de.preventDefault(),nt(1/1.2)),de.key==="0"&&(de.preventDefault(),ne())},children:[n.jsx("div",{"data-canvas-world":!0,className:"absolute left-0 top-0 origin-top-left",style:{transform:`translate(${D.x}px, ${D.y}px) scale(${D.scale})`},children:e.map((de,pe)=>{const ke=_[pe],Ge=de.chiefs.length>0&&de.members.length>0,Ee=z===de.key||R&&O===de.key&&(R.bot.section?.trim()??"")!==de.key,ce=Object.hasOwn(p,de.key)?p[de.key]:void 0,Ue=le=>n.jsxs("div",{className:"relative",children:[L?.botId===le.id&&n.jsx("div",{className:V("pointer-events-none absolute inset-x-1 h-0.5 rounded bg-accent",L.after?"-bottom-[9px]":"-top-[9px]")}),n.jsx(EBe,{bot:le,selected:g.selectedId===le.id&&g.settingsOpen,moving:R?.bot.id===le.id||K===le.id,connected:h.includes(le.id),onComputer:r,onArrange:W?Y:void 0})]},le.id);return n.jsxs("section",{"data-team-key":de.key,"aria-label":l("canvas.teamRegion",{name:de.name}),className:V("absolute rounded-2xl border bg-panel/90 shadow-sm has-[details[open]]:z-20 data-[computer-dropping=true]:border-accent data-[computer-dropping=true]:ring-2 data-[computer-dropping=true]:ring-accent/25",Ee?"border-accent ring-2 ring-accent/25":"border-hairline/50"),style:{left:ke.x,top:ke.y,width:ke.width,height:ke.height},children:[n.jsxs("header",{className:"flex h-16 items-center gap-2 px-5",children:[n.jsx("button",{"data-arrange-team":de.key,disabled:!W,"aria-label":l("canvas.arrange",{name:de.name}),title:l("canvas.arrangeHint"),className:"min-w-0 flex-1 cursor-grab rounded-md py-2 text-left active:cursor-grabbing focus-visible:outline-2 focus-visible:outline-accent",onKeyDown:le=>{const Fe={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,-1],ArrowDown:[0,1]}[le.key];if(!Fe)return;le.preventDefault(),le.stopPropagation();const tt=le.shiftKey?40:10;he({...N,[de.key]:{x:ke.x+Fe[0]*tt,y:ke.y+Fe[1]*tt}})},children:n.jsx("h2",{className:"truncate text-[13px] font-semibold tracking-tight",children:de.name})}),ce&&n.jsxs("button",{"aria-label":l("canvas.teamComputer",{team:de.name,name:ce.name}),title:`${ce.name}${ce.state?` · ${ce.state}`:""}`,disabled:!d,onClick:()=>d?.(de.key),className:"flex min-w-0 max-w-[120px] shrink items-center gap-1.5 rounded-md px-1.5 py-2 text-[10px] text-ink-secondary hover:bg-control hover:text-ink focus-visible:outline-2 focus-visible:outline-accent disabled:pointer-events-none",children:[n.jsx(Ba,{size:12,className:"shrink-0"}),n.jsx("span",{className:"truncate",children:ce.name})]}),n.jsx("span",{className:"text-[11px] tabular-nums text-ink-secondary",children:de.chiefs.length+de.members.length}),t&&n.jsxs("details",{className:"relative",onToggle:le=>{if(le.currentTarget.open){const Fe=b.current?.getBoundingClientRect();oe(Fe&&le.currentTarget.getBoundingClientRect().bottom>Fe.bottom-210*D.scale?de.key:null),b.current?.querySelectorAll("details[open]").forEach(tt=>{tt!==le.currentTarget&&tt.removeAttribute("open")})}},children:[n.jsx("summary",{"aria-label":l("canvas.manageTeam",{name:de.name}),className:V(Mh,"cursor-pointer list-none [&::-webkit-details-marker]:hidden"),children:n.jsx(Fl,{size:17})}),n.jsxs("div",{className:V("absolute right-0 z-30 w-[220px] rounded-xl border border-hairline bg-panel p-1.5 shadow-xl",Z===de.key?"bottom-10":"top-10"),onClick:le=>{const Fe=le.currentTarget.closest("details");Fe?.querySelector("summary")?.focus(),Fe?.removeAttribute("open")},children:[n.jsxs("button",{className:gy,onClick:()=>i(de.key),"aria-label":l("team.moveTo",{name:de.name}),children:[n.jsx(bi,{size:14}),l("team.moveTo",{name:de.name})]}),n.jsxs("button",{className:gy,onClick:()=>o(de.key,de.name),"aria-label":l("team.instructionsEdit",{name:de.name}),children:[n.jsx(Ms,{size:14}),l("team.instructions")]}),de.key&&n.jsxs("button",{className:gy,onClick:()=>i(de.key,!0),"aria-label":l("team.renameAria",{name:de.name}),children:[n.jsx(qi,{size:14}),l("team.rename")]}),de.key&&n.jsxs("button",{className:V(gy,"hover:text-danger"),onClick:()=>s(de.key),"aria-label":l("team.deleteAria",{name:de.name}),children:[n.jsx(xn,{size:14}),l("team.delete")]})]})]})]}),Ee&&n.jsx("div",{className:"pointer-events-none absolute -top-7 left-2 z-30 max-w-[calc(100%-16px)] truncate rounded-md bg-accent px-2 py-1 text-[10px] text-white shadow-sm",children:Qe}),n.jsxs("div",{className:"flex items-center px-5 pb-5",children:[de.chiefs.length>0&&n.jsx("div",{className:"flex flex-col gap-4",children:Gm(de.chiefs,we(de.key)).map(Ue)}),Ge&&n.jsx("div",{className:"flex w-10 shrink-0 justify-center text-ink-secondary/35","aria-hidden":"true",children:n.jsx(fg,{size:22,strokeWidth:1})}),de.members.length>0&&n.jsx("div",{className:"flex flex-col gap-4",children:Gm(de.members,we(de.key)).map(Ue)}),de.chiefs.length+de.members.length===0&&n.jsx("p",{className:"flex h-[126px] w-[236px] items-center justify-center rounded-xl border border-dashed border-hairline/70 px-6 text-center text-[12px] leading-relaxed text-ink-secondary",children:l("canvas.dropHere")})]})]},de.key)})}),R&&n.jsxs("div",{className:"pointer-events-none absolute z-40 rounded-xl border border-accent/40 bg-card px-4 py-3 text-[13px] shadow-lg",style:{left:R.point.x+16,top:R.point.y+16},children:[n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(Jt,{bot:R.bot,size:24,animated:!1}),R.bot.name]}),Qe&&n.jsx("p",{className:"mt-1 text-[10px] text-ink-secondary",children:Qe})]}),n.jsxs("div",{className:"pointer-events-none absolute inset-x-5 bottom-5 flex items-end justify-between gap-3",children:[n.jsxs("div",{className:"min-w-0 rounded-lg bg-app/90 px-2 py-1.5 text-[11px] text-ink-secondary",children:[n.jsx("p",{className:"max-sm:hidden",children:l("canvas.hint")}),n.jsx("p",{role:"status","aria-live":"polite",className:"max-w-[440px]",children:Qe??U})]}),n.jsxs("div",{className:"pointer-events-auto flex shrink-0 items-center gap-0.5 rounded-xl border border-hairline/60 bg-panel p-1 shadow-sm",children:[n.jsx("button",{className:Mh,"aria-label":l("canvas.zoomOut"),onClick:()=>nt(1/1.2),children:n.jsx($B,{size:15})}),n.jsxs("button",{className:"min-w-12 rounded-md px-1 py-2 text-[11px] tabular-nums text-ink-secondary hover:bg-control","aria-label":l("canvas.fit"),title:l("canvas.fitHint"),onClick:ne,children:[Math.round(D.scale*100),"%"]}),n.jsx("button",{className:Mh,"aria-label":l("canvas.zoomIn"),onClick:()=>nt(1.2),children:n.jsx(vn,{size:15})})]})]})]})}const fs="rounded-lg px-3 py-2 text-[12px] text-ink-secondary hover:bg-control hover:text-ink disabled:opacity-40",SB="w-full rounded-lg border border-hairline/60 bg-inset px-3 py-2 text-[12px] text-ink outline-none focus:border-accent";function DBe({open:e,createRequest:t,drop:a,sections:o,onClose:i,onDropHandled:s,onChange:r}){const{dispatch:c}=ve(),[d,p]=f.useState(null),[h,g]=f.useState(!1),[b,x]=f.useState(""),[v,k]=f.useState(""),[S,N]=f.useState(null),[C,j]=f.useState(!1),[M,D]=f.useState(""),A=f.useRef(crypto.randomUUID()),R=f.useRef(null),P=f.useRef(null),O=f.useRef(null),T=f.useRef(!1),z=f.useRef(!0),B=f.useRef(null),L=f.useRef(r);L.current=r;const[G,K]=f.useState(null),[H,U]=f.useState(null),[Q,W]=f.useState(null),q=f.useRef(crypto.randomUUID()),Z=f.useRef(null),oe=f.useRef(null),_=f.useRef(null),ue=f.useRef(null),[he,we]=f.useState(null),ee=f.useCallback(()=>{const ge=_.current;_.current=null,ue.current?.removeAttribute("data-computer-dropping"),ue.current=null,ge?.handle.hasPointerCapture(ge.id)&&ge.handle.releasePointerCapture(ge.id),we(null)},[]);f.useEffect(()=>(e||ee(),()=>{ue.current?.removeAttribute("data-computer-dropping")}),[e,ee]),f.useEffect(()=>{Z.current=Q},[Q]),f.useEffect(()=>()=>{const ge=Z.current;ge&&fetch(`/api/team-computers/${encodeURIComponent(ge)}/control`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"release",controlLeaseId:q.current}),keepalive:!0}).catch(()=>{})},[]);const Y=f.useCallback((ge,Qe)=>{if(!(T.current||ge.section===Qe)){if(ge.section!==null&&Qe!==null){x(`Unassign ${ge.name} from ${ge.section||"General"} before moving it to another team. Its files and signed-in accounts stay on the computer.`);return}x(""),K({computer:ge,section:Qe})}},[]),ne=(ge,Qe)=>{const de=oe.current?.parentElement?.querySelector("[data-team-canvas]"),pe=document.elementFromPoint(ge,Qe)?.closest("[data-team-key]");return pe&&de?.contains(pe)&&o.some(ke=>ke.key===pe.dataset.teamKey)?pe:null},ae=ge=>{const Qe=_.current;if(!Qe||ge.pointerId!==Qe.id)return;if(ge.buttons===0){ee();return}if(!Qe.moved&&Math.hypot(ge.clientX-Qe.x,ge.clientY-Qe.y)<5)return;Qe.moved=!0,ge.currentTarget.setPointerCapture(ge.pointerId);const de=ne(ge.clientX,ge.clientY);ue.current!==de&&(ue.current?.removeAttribute("data-computer-dropping"),de?.setAttribute("data-computer-dropping","true"),ue.current=de);const pe=de?o.find(ke=>ke.key===de.dataset.teamKey):null;we({name:Qe.computer.name,x:ge.clientX,y:ge.clientY,hint:pe?Qe.computer.section!==null&&Qe.computer.section!==pe.key?"Unassign before moving to another team":`Assign to ${pe.name}`:"Drop onto a team"})},je=ge=>{const Qe=_.current;if(!Qe||Qe.id!==ge.pointerId)return;const de=Qe.moved?ne(ge.clientX,ge.clientY)?.dataset.teamKey:void 0;ee(),de!==void 0&&Y(Qe.computer,de)},xe=f.useCallback(async()=>{B.current?.abort();const ge=new AbortController;B.current=ge,g(!0);try{const Qe=await X("/api/team-computers",{signal:AbortSignal.any([ge.signal,AbortSignal.timeout(3e4)])});if(ge.signal.aborted||!z.current)return;p(Qe),k(""),L.current(Qe.computers)}catch(Qe){!ge.signal.aborted&&z.current&&k(Qe instanceof Error?Qe.message:String(Qe))}finally{!ge.signal.aborted&&z.current&&g(!1)}},[]);f.useEffect(()=>(z.current=!0,xe(),()=>{z.current=!1,B.current?.abort()}),[xe]),f.useEffect(()=>{if(!e)return;xe();const ge=window.setInterval(()=>{!T.current&&document.visibilityState==="visible"&&xe()},2e4);return()=>window.clearInterval(ge)},[e,xe]),f.useEffect(()=>{t>0&&j(!0)},[t]),f.useEffect(()=>{if(!e)return;const ge=document.activeElement instanceof HTMLElement?document.activeElement:null;return O.current?.focus(),()=>{ge?.isConnected&&ge.focus()}},[e]),f.useEffect(()=>{e&&C&&P.current?.focus()},[e,C]),f.useEffect(()=>{if(!a)return;const ge=d?.computers.find(Qe=>Qe.id===a.id);ge&&Y(ge,a.section),s()},[a,d,s,Y]);const re=async(ge,Qe,de,pe)=>{if(!T.current){T.current=!0,N(ge),x(""),B.current?.abort();try{const ke=await Qe();z.current&&de?.(ke)}catch(ke){z.current&&(x(ke instanceof Error?ke.message:String(ke)),pe?.())}finally{T.current=!1,z.current&&(N(null),await xe())}}},Se=f.useCallback(()=>K(null),[]),Be=(ge,Qe,de={})=>X(`/api/team-computers/${encodeURIComponent(ge)}/${Qe}`,{method:"POST",body:JSON.stringify(de)}),nt=()=>{i(),c({type:"toggleAppSettings",open:!0,section:"computer"})};return n.jsxs(n.Fragment,{children:[e&&n.jsxs("aside",{ref:oe,"aria-label":"Team computers",onKeyDown:ge=>{ge.key==="Escape"&&!G&&(ge.stopPropagation(),_.current?ee():i())},className:"flex w-[300px] max-w-[90vw] shrink-0 flex-col border-l border-hairline/50 bg-panel max-sm:absolute max-sm:inset-y-0 max-sm:right-0 max-sm:z-30 max-sm:shadow-xl",children:[n.jsxs("header",{className:"flex items-center gap-2 border-b border-hairline/40 px-4 py-3",children:[n.jsx(Ba,{size:16,className:"text-ink-secondary"}),n.jsx("h2",{className:"flex-1 text-[13px] font-semibold",children:"Computers"}),n.jsx("button",{"aria-label":"Refresh computers",className:fs,disabled:h||S!==null,onClick:()=>{x(""),xe()},children:n.jsx(fn,{size:14,className:h?"animate-spin":""})}),n.jsx("button",{ref:O,"aria-label":"Close computers",className:fs,onClick:i,children:n.jsx(Nt,{size:15})})]}),n.jsxs("div",{className:"min-h-0 flex-1 space-y-3 overflow-y-auto p-4",children:[n.jsx("p",{className:"text-[12px] leading-relaxed text-ink-secondary",children:"Drag a computer onto a team, or choose its team below. Bots on Auto will use it."}),(b||v||d?.problem)&&n.jsx("p",{role:"alert",className:"rounded-lg bg-danger/10 p-3 text-[12px] text-danger",children:b||v||d?.problem}),d&&!d.configured&&n.jsxs("div",{className:"rounded-xl border border-hairline/50 p-3 text-[12px]",children:[n.jsx("p",{className:"text-ink-secondary",children:"Connect your Box account before creating a cloud computer."}),n.jsx("button",{className:`${fs} mt-2 border border-hairline/50`,onClick:nt,children:"Connect Box"})]}),C?n.jsxs("form",{className:"space-y-3 rounded-xl border border-hairline/60 bg-card p-3",onSubmit:ge=>{ge.preventDefault();const Qe=R.current??M.trim();!Qe||!d?.configured||(R.current=Qe,re("create",()=>X("/api/team-computers",{method:"POST",body:JSON.stringify({name:Qe,requestId:A.current,acknowledgeCost:!0})}),()=>{D(""),j(!1),A.current=crypto.randomUUID(),R.current=null},()=>{R.current=null}))},children:[n.jsx("label",{className:"block text-[12px] font-medium",htmlFor:"canvas-computer-name",children:"New Box computer"}),n.jsx("input",{ref:P,id:"canvas-computer-name",className:SB,value:M,maxLength:60,placeholder:"e.g. Engineering desktop",disabled:S!==null||R.current!==null,onChange:ge=>D(ge.target.value)}),n.jsx("p",{className:"text-[11px] leading-relaxed text-ink-secondary",children:"Creates a cloud machine in your connected boat.dev account. Your Box plan and usage charges apply. It stays unassigned until you choose a team."}),n.jsxs("div",{className:"flex justify-end gap-1",children:[n.jsx("button",{type:"button",className:fs,disabled:S!==null,onClick:()=>j(!1),children:"Cancel"}),n.jsxs("button",{type:"submit",className:"flex items-center gap-2 rounded-lg bg-accent px-3 py-2 text-[12px] font-medium text-white disabled:opacity-40",disabled:!d?.configured||!M.trim()||S!==null,children:[S==="create"&&n.jsx(Ie,{size:13,className:"animate-spin"}),"Create Box"]})]})]}):n.jsxs("button",{className:"flex w-full items-center justify-center gap-2 rounded-xl border border-dashed border-hairline/60 px-3 py-3 text-[12px] text-ink-secondary hover:bg-control hover:text-ink",disabled:S!==null,onClick:()=>j(!0),children:[n.jsx(vn,{size:14})," New Box computer"]}),d?.computers.map(ge=>{const Qe=["idle","ready","running"].includes(ge.state),de=["init","provisioning","provisioned","cloning","starting"].includes(ge.state),pe=Q===ge.id,ke=ge.held||pe;return n.jsxs("article",{"data-computer-id":ge.id,className:"rounded-xl border border-hairline/60 bg-card p-3",children:[n.jsxs("div",{"data-computer-drag-id":ge.id,role:"group",tabIndex:-1,"aria-label":`Drag ${ge.name} to a team`,onPointerDown:Ge=>{T.current||_.current||Ge.button!==0||!Ge.isPrimary||(Ge.currentTarget.focus({preventScroll:!0}),_.current={id:Ge.pointerId,x:Ge.clientX,y:Ge.clientY,moved:!1,computer:ge,handle:Ge.currentTarget},Ge.currentTarget.setPointerCapture(Ge.pointerId))},onPointerMove:ae,onPointerUp:je,onPointerCancel:ee,onLostPointerCapture:()=>{_.current&&ee()},className:"flex touch-none select-none cursor-grab items-center gap-2.5 rounded-lg py-1 outline-none active:cursor-grabbing",children:[n.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-lg bg-control text-ink-secondary",children:n.jsx(Ph,{size:18})}),n.jsxs("span",{className:"min-w-0",children:[n.jsx("span",{className:"block truncate text-[13px] font-medium",children:ge.name}),n.jsxs("span",{className:"block text-[11px] text-ink-secondary",children:["Box · ",S===ge.id?"Updating…":ge.state]})]})]}),ge.problem&&n.jsx("p",{className:"mt-2 text-[11px] text-danger",children:ge.problem}),n.jsxs("label",{className:"sr-only",htmlFor:`computer-team-${ge.id}`,children:["Team for ",ge.name]}),n.jsxs("select",{id:`computer-team-${ge.id}`,className:`${SB} mt-3`,disabled:S!==null,value:ge.section===null?"unassigned":`team:${ge.section}`,onChange:Ge=>Y(ge,Ge.target.value==="unassigned"?null:Ge.target.value.slice(5)),children:[n.jsx("option",{value:"unassigned",children:"Not assigned"}),o.filter(Ge=>ge.section===null||Ge.key===ge.section).map(Ge=>n.jsx("option",{value:`team:${Ge.key}`,children:Ge.name},Ge.key))]}),ge.section!==null&&n.jsx("p",{className:"mt-1.5 text-[10px] text-ink-secondary",children:"Unassign to move to another team."}),n.jsxs("div",{className:"mt-2 flex flex-wrap gap-1",children:[!Qe&&!de&&n.jsx("button",{className:fs,title:"Starts this Box; your provider's usage charges apply",disabled:S!==null||ke,onClick:()=>{re(ge.id,()=>Be(ge.id,"provision",{acknowledgeCost:!0}))},children:"Start / retry"}),Qe&&!ke&&n.jsx("button",{className:fs,disabled:S!==null,onClick:()=>{re(ge.id,()=>Be(ge.id,"sleep"))},children:"Sleep"}),Qe&&n.jsxs("button",{className:`${fs} flex items-center gap-1.5`,title:"Pauses bot control while you use the desktop",disabled:S!==null,onClick:()=>{re(ge.id,async()=>(await Be(ge.id,"control",{action:"take",controlLeaseId:q.current}),W(ge.id),Be(ge.id,"join")),Ge=>{typeof Ge.joinUrl=="string"&&Ge.joinUrl.startsWith("https://")&&U({id:ge.id,url:Ge.joinUrl})})},children:["Open desktop ",n.jsx(An,{size:11})]}),pe&&n.jsx("button",{className:`${fs} text-accent`,disabled:S!==null,onClick:()=>{re(ge.id,()=>Be(ge.id,"control",{action:"release",controlLeaseId:q.current}),()=>{W(null),U(null)})},children:"Return to bots"}),ge.held&&!pe&&n.jsx("button",{className:fs,disabled:!0,title:"Another viewer has paused bot control on this desktop",children:"In use"})]}),H?.id===ge.id&&n.jsx("a",{href:H.url,target:"_blank",rel:"noopener noreferrer",className:"mt-2 block rounded-lg px-3 py-2 text-[12px] text-accent hover:bg-control",children:"Open secure desktop ↗"})]},ge.id)})]}),n.jsx("footer",{className:"border-t border-hairline/40 p-3",children:n.jsx("button",{className:`${fs} w-full text-left`,onClick:nt,children:"Local VM and other computers…"})})]}),he&&Xn.createPortal(n.jsxs("div",{role:"status",className:"pointer-events-none fixed z-[70] rounded-xl border border-accent/40 bg-card px-4 py-3 text-[12px] text-ink shadow-xl",style:{left:he.x+14,top:he.y+14},children:[n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(Ph,{size:15}),he.name]}),n.jsx("p",{className:"mt-1 text-[10px] text-ink-secondary",children:he.hint})]}),document.body),n.jsx(Oa,{open:G!==null,tone:"neutral",title:G?.section===null?`Unassign ${G?.computer.name??"computer"}?`:`Assign ${G?.computer.name??"computer"} to ${G?.section||"General"}?`,body:G?.section===null?"This removes the team default. It does not stop or delete the machine, its files, or its logins. Review the bots' Auto routing before their next task.":"Bots on Auto in this team will share this computer's files and signed-in accounts. Explicit bot computer settings stay unchanged. Only one bot can use the desktop at a time. This does not move the OMB server or enable 24/7 hosting.",confirmLabel:G?.section===null?"Unassign computer":"Assign computer",onCancel:Se,onConfirm:()=>{const ge=G;ge&&(K(null),U(null),re(ge.computer.id,()=>X(`/api/team-computers/${encodeURIComponent(ge.computer.id)}`,{method:"PATCH",body:JSON.stringify({section:ge.section,acknowledgeSharedAccess:!0})})))}})]})}function OBe({edge:e,bots:t}){const{dispatch:a}=ve(),o=t.find(r=>r.id===e.sourceBotId),i=t.find(r=>r.id===e.targetBotId);if(!o||!i)return null;const s=e.state!=="connected";return n.jsxs("button",{onClick:()=>a(e.groupId?{type:"select",id:e.groupId}:sa(i)),className:"flex w-full items-center gap-3 rounded-xl border border-hairline/40 bg-card px-3 py-2.5 text-left transition hover:bg-raised/50",children:[n.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[n.jsx("span",{className:"truncate text-[13px] font-medium text-ink",children:o.name}),n.jsx(fg,{size:13,className:V("shrink-0",s?"text-accent":"text-ink-secondary")}),n.jsx("span",{className:"truncate text-[13px] font-medium text-ink",children:i.name})]}),e.reason&&n.jsx("span",{className:"max-w-[220px] truncate text-[11.5px] text-ink-secondary",children:e.reason}),n.jsx("span",{className:V("rounded-full px-2 py-0.5 text-[10.5px] font-medium",e.state==="running"?"bg-success/15 text-success":e.state==="queued"?"bg-warning/15 text-warning":"bg-control text-ink-secondary"),children:e.state==="running"?"Running":e.state==="queued"?"Queued":e.lastAt?Cs(e.lastAt):"Connected"})]})}function zBe({section:e,label:t,onClose:a}){const o=f.useRef(null),i=f.useRef(null),s=f.useRef(a),r=f.useRef(!1),c=f.useRef(!1),[d,p]=f.useState(""),[h,g]=f.useState(""),[b,x]=f.useState(24e3),[v,k]=f.useState(null),[S,N]=f.useState(!0),[C,j]=f.useState(!1),[M,D]=f.useState(null),A=d!==h,R=f.useMemo(()=>new TextEncoder().encode(d).byteLength,[d]);s.current=a,r.current=C,c.current=A;const P=f.useCallback(()=>{r.current||c.current&&!window.confirm(l("team.instructionsDiscard"))||s.current()},[]);f.useEffect(()=>{const T=document.activeElement instanceof HTMLElement?document.activeElement:null;o.current?.focus();const z=B=>{if(B.key==="Escape"&&!r.current){B.preventDefault(),P();return}if(B.key!=="Tab")return;const L=o.current;if(!L)return;const G=[...L.querySelectorAll('button:not([disabled]), textarea:not([disabled]), input:not([disabled]), [href], [tabindex]:not([tabindex="-1"])')];if(G.length===0){B.preventDefault(),L.focus();return}const K=G[0],H=G[G.length-1];B.shiftKey&&document.activeElement===K?(B.preventDefault(),H.focus()):!B.shiftKey&&document.activeElement===H&&(B.preventDefault(),K.focus())};return window.addEventListener("keydown",z),()=>{window.removeEventListener("keydown",z),T?.focus()}},[P]),f.useEffect(()=>{let T=!1;return N(!0),D(null),X(`/api/section-context?section=${encodeURIComponent(e)}`).then(z=>{T||(p(z.text),g(z.text),k(z.updatedAt),x(z.maxBytes),window.setTimeout(()=>i.current?.focus(),0))}).catch(z=>{T||D(z instanceof Error?z.message:String(z))}).finally(()=>{T||N(!1)}),()=>{T=!0}},[e]);const O=async()=>{if(!(R>b)){j(!0),D(null);try{const T=await X(`/api/section-context?section=${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify({text:d})});g(T.text),p(T.text),k(T.updatedAt),x(T.maxBytes)}catch(T){D(T instanceof Error?T.message:String(T))}finally{j(!1)}}};return Xn.createPortal(n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/55 p-4 backdrop-blur-[2px] sm:p-6",onMouseDown:T=>T.target===T.currentTarget&&P(),children:n.jsxs("div",{ref:o,role:"dialog","aria-modal":"true","aria-labelledby":"section-context-title",tabIndex:-1,className:"animate-pop-in flex max-h-[min(680px,calc(100dvh-2rem))] w-full max-w-[680px] flex-col overflow-hidden rounded-[24px] border border-hairline/50 bg-panel shadow-2xl shadow-black/50 outline-none",children:[n.jsxs("header",{className:"flex items-start justify-between gap-4 border-b border-hairline/40 px-6 pb-4 pt-6 sm:px-8 sm:pt-7",children:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Ms,{size:19,className:"text-accent"}),n.jsx("h2",{id:"section-context-title",className:"text-[20px] font-semibold tracking-[-0.01em] text-ink",children:l("team.instructionsTitle",{name:t})})]}),n.jsx("p",{className:"mt-1.5 max-w-[520px] text-[12.5px] leading-relaxed text-ink-secondary",children:l("team.instructionsHint")})]}),n.jsx("button",{onClick:P,disabled:C,"aria-label":l("team.instructionsClose"),className:"flex size-9 shrink-0 items-center justify-center rounded-lg text-ink-secondary hover:bg-raised hover:text-ink disabled:opacity-40",children:n.jsx(Nt,{size:19})})]}),n.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-6 py-5 sm:px-8",children:[S?n.jsx("div",{className:"flex min-h-[260px] items-center justify-center text-ink-secondary",children:n.jsx(Ie,{size:20,className:"animate-spin","aria-label":l("team.instructionsLoading")})}):n.jsxs(n.Fragment,{children:[n.jsx("textarea",{ref:i,value:d,onChange:T=>p(T.target.value),placeholder:`Goals
604
604
  - Ship the Windows onboarding refresh
605
605
 
606
606
  Decisions