morpheus-cli 0.9.8 → 0.9.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config/manager.js +10 -1
- package/dist/config/schemas.js +1 -0
- package/dist/runtime/apoc.js +2 -1
- package/dist/runtime/memory/sati/service.js +1 -1
- package/dist/runtime/memory/sqlite.js +56 -1
- package/dist/runtime/neo.js +1 -1
- package/dist/runtime/oracle.js +1 -1
- package/dist/runtime/skills/schema.js +1 -2
- package/dist/runtime/smiths/delegator.js +1 -1
- package/dist/runtime/trinity.js +1 -1
- package/dist/types/config.js +1 -0
- package/dist/ui/assets/{AuditDashboard-93LCGHG1.js → AuditDashboard-ZPJ5Pfwi.js} +1 -1
- package/dist/ui/assets/{Chat-CK5sNcQ1.js → Chat-BAivCJ5N.js} +1 -1
- package/dist/ui/assets/{Chronos-m2h--GEe.js → Chronos-buCS0uuh.js} +1 -1
- package/dist/ui/assets/{ConfirmationModal-Dd5pUJme.js → ConfirmationModal-Bud3Ur7D.js} +1 -1
- package/dist/ui/assets/{Dashboard-ODwl7d-a.js → Dashboard-CR6pBg6o.js} +1 -1
- package/dist/ui/assets/{DeleteConfirmationModal-CCcojDmr.js → DeleteConfirmationModal-Cz1jfXgq.js} +1 -1
- package/dist/ui/assets/{Documents-dWnSoxFO.js → Documents-CYW79d8T.js} +1 -1
- package/dist/ui/assets/{Logs-Dc9Z2LBj.js → Logs-BgDEdckr.js} +1 -1
- package/dist/ui/assets/{MCPManager-CMkb8vMn.js → MCPManager-yupmREOG.js} +1 -1
- package/dist/ui/assets/{ModelPricing-DtHPPbEQ.js → ModelPricing-CbKHyj9P.js} +1 -1
- package/dist/ui/assets/{Notifications-BPvo-DWP.js → Notifications-DpabYsn5.js} +1 -1
- package/dist/ui/assets/{SatiMemories-BUPu1Lxr.js → SatiMemories-D75MAyPU.js} +1 -1
- package/dist/ui/assets/{SessionAudit-CFKF4DA8.js → SessionAudit-B3N9C1NR.js} +1 -1
- package/dist/ui/assets/Settings-B1qZ-teD.js +49 -0
- package/dist/ui/assets/{Skills-BUlvJgJ4.js → Skills-BmqC0xkq.js} +1 -1
- package/dist/ui/assets/{Smiths-CDtJdY0I.js → Smiths-DdAcvxg6.js} +1 -1
- package/dist/ui/assets/{Tasks-DK_cOsNK.js → Tasks-D7SrOMOn.js} +1 -1
- package/dist/ui/assets/{TrinityDatabases-X07by-19.js → TrinityDatabases-cyhanIXu.js} +1 -1
- package/dist/ui/assets/{UsageStats-dYcgckLq.js → UsageStats-DOgOQ4YN.js} +1 -1
- package/dist/ui/assets/{WebhookManager-DDw5eX2R.js → WebhookManager-D2TdZ5kD.js} +1 -1
- package/dist/ui/assets/{audit-DZ5WLUEm.js → audit-CZVCVFw_.js} +1 -1
- package/dist/ui/assets/{chronos-B_HI4mlq.js → chronos-DWSd5JMm.js} +1 -1
- package/dist/ui/assets/{config-B-YxlVrc.js → config-C2GB18ML.js} +1 -1
- package/dist/ui/assets/{index-DfJwcKqG.js → index-BiMscUrn.js} +2 -2
- package/dist/ui/assets/index-U7hzqcK_.css +1 -0
- package/dist/ui/assets/{mcp-k-_pwbqA.js → mcp-JmpcV6nl.js} +1 -1
- package/dist/ui/assets/{skills-xMXangks.js → skills-D2stQj7i.js} +1 -1
- package/dist/ui/assets/{stats-C4QZIv5O.js → stats-cDmpngPQ.js} +1 -1
- package/dist/ui/index.html +2 -2
- package/dist/ui/sw.js +1 -1
- package/package.json +2 -2
- package/dist/ui/assets/Settings-C4JrXfsR.js +0 -47
- package/dist/ui/assets/index-DVjwJ8jT.css +0 -1
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import{j as s}from"./vendor-motion-C3CZ8ZlO.js";import{r as E}from"./vendor-react-DikRIOlj.js";import{t as wr,u as ce,Z as zr,m as ue}from"./vendor-utils-D4NnWbOU.js";import{u as jr,c as Sr}from"./chronos-DWSd5JMm.js";import{T as w,S as K}from"./SelectInput-KVLsnfra.js";import{c as q,N as C,S as re}from"./config-C2GB18ML.js";import{h as qe}from"./index-BiMscUrn.js";import{C as Nr}from"./ConfirmationModal-Bud3Ur7D.js";import{d as Or,X as Cr,O as $r}from"./vendor-icons-NHF9HNeN.js";function F({title:e,description:t,children:r}){return s.jsxs("div",{className:"border border-azure-border dark:border-matrix-primary rounded-lg p-6 bg-azure-surface/50 dark:bg-matrix-base/50",children:[s.jsxs("div",{className:"mb-4",children:[s.jsx("h3",{className:"text-lg font-medium text-azure-text-primary dark:text-matrix-highlight",children:e}),t&&s.jsx("p",{className:"text-sm text-azure-text-secondary dark:text-matrix-secondary mt-1",children:t})]}),s.jsx("div",{className:"space-y-4",children:r})]})}function ct({label:e,error:t,helperText:r,className:n,...o}){return s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx("label",{className:"text-sm font-medium text-azure-text-primary/80 dark:text-matrix-secondary",children:e}),s.jsx("textarea",{className:wr("bg-azure-bg dark:bg-black border border-azure-border dark:border-matrix-primary text-azure-text-primary dark:text-matrix-secondary placeholder-azure-text-secondary/50 dark:placeholder-matrix-secondary/50 rounded-md px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-azure-primary dark:focus:ring-matrix-highlight focus:border-azure-primary dark:focus:border-matrix-highlight transition-colors resize-y min-h-[80px]",t&&"border-red-500 focus:border-red-500 focus:ring-red-500",n),rows:10,...o}),r&&!t&&s.jsx("p",{className:"text-xs text-azure-text-secondary dark:text-matrix-secondary",children:r}),t&&s.jsx("p",{className:"text-xs text-red-500",children:t})]})}function m(e,t,r){function n(c,d){if(c._zod||Object.defineProperty(c,"_zod",{value:{def:d,constr:a,traits:new Set},enumerable:!1}),c._zod.traits.has(e))return;c._zod.traits.add(e),t(c,d);const p=a.prototype,f=Object.keys(p);for(let h=0;h<f.length;h++){const u=f[h];u in c||(c[u]=p[u].bind(c))}}const o=r?.Parent??Object;class i extends o{}Object.defineProperty(i,"name",{value:e});function a(c){var d;const p=r?.Parent?new i:this;n(p,c),(d=p._zod).deferred??(d.deferred=[]);for(const f of p._zod.deferred)f();return p}return Object.defineProperty(a,"init",{value:n}),Object.defineProperty(a,Symbol.hasInstance,{value:c=>r?.Parent&&c instanceof r.Parent?!0:c?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}class ke extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Tt extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const Et={};function de(e){return Et}function It(e){const t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function Ye(e,t){return typeof t=="bigint"?t.toString():t}function Je(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Qe(e){return e==null}function et(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Zr(e,t){const r=(e.toString().split(".")[1]||"").length,n=t.toString();let o=(n.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(n)){const d=n.match(/\d?e-(\d?)/);d?.[1]&&(o=Number.parseInt(d[1]))}const i=r>o?r:o,a=Number.parseInt(e.toFixed(i).replace(".","")),c=Number.parseInt(t.toFixed(i).replace(".",""));return a%c/10**i}const ut=Symbol("evaluating");function j(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==ut)return n===void 0&&(n=ut,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function ge(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function pe(...e){const t={};for(const r of e){const n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function dt(e){return JSON.stringify(e)}function Ar(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Pt="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Ze(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Tr=Je(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function we(e){if(Ze(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const r=t.prototype;return!(Ze(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Rt(e){return we(e)?{...e}:Array.isArray(e)?[...e]:e}const Er=new Set(["string","number","symbol"]);function ze(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function fe(e,t,r){const n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function g(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function Ir(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const Pr={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Rr(e,t){const r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const i=pe(e._zod.def,{get shape(){const a={};for(const c in t){if(!(c in r.shape))throw new Error(`Unrecognized key: "${c}"`);t[c]&&(a[c]=r.shape[c])}return ge(this,"shape",a),a},checks:[]});return fe(e,i)}function Dr(e,t){const r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const i=pe(e._zod.def,{get shape(){const a={...e._zod.def.shape};for(const c in t){if(!(c in r.shape))throw new Error(`Unrecognized key: "${c}"`);t[c]&&delete a[c]}return ge(this,"shape",a),a},checks:[]});return fe(e,i)}function Mr(e,t){if(!we(t))throw new Error("Invalid input to extend: expected a plain object");const r=e._zod.def.checks;if(r&&r.length>0){const i=e._zod.def.shape;for(const a in t)if(Object.getOwnPropertyDescriptor(i,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=pe(e._zod.def,{get shape(){const i={...e._zod.def.shape,...t};return ge(this,"shape",i),i}});return fe(e,o)}function Lr(e,t){if(!we(t))throw new Error("Invalid input to safeExtend: expected a plain object");const r=pe(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return ge(this,"shape",n),n}});return fe(e,r)}function Jr(e,t){const r=pe(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return ge(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return fe(e,r)}function Ur(e,t,r){const o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const a=pe(t._zod.def,{get shape(){const c=t._zod.def.shape,d={...c};if(r)for(const p in r){if(!(p in c))throw new Error(`Unrecognized key: "${p}"`);r[p]&&(d[p]=e?new e({type:"optional",innerType:c[p]}):c[p])}else for(const p in c)d[p]=e?new e({type:"optional",innerType:c[p]}):c[p];return ge(this,"shape",d),d},checks:[]});return fe(t,a)}function Fr(e,t,r){const n=pe(t._zod.def,{get shape(){const o=t._zod.def.shape,i={...o};if(r)for(const a in r){if(!(a in i))throw new Error(`Unrecognized key: "${a}"`);r[a]&&(i[a]=new e({type:"nonoptional",innerType:o[a]}))}else for(const a in o)i[a]=new e({type:"nonoptional",innerType:o[a]});return ge(this,"shape",i),i}});return fe(t,n)}function ye(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function _e(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Ee(e){return typeof e=="string"?e:e?.message}function me(e,t,r){const n={...e,path:e.path??[]};if(!e.message){const o=Ee(e.inst?._zod.def?.error?.(e))??Ee(t?.error?.(e))??Ee(r.customError?.(e))??Ee(r.localeError?.(e))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function tt(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Ae(...e){const[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}const Dt=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Ye,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Mt=m("$ZodError",Dt),Lt=m("$ZodError",Dt,{Parent:Error});function Br(e,t=r=>r.message){const r={},n=[];for(const o of e.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o))):n.push(t(o));return{formErrors:n,fieldErrors:r}}function Kr(e,t=r=>r.message){const r={_errors:[]},n=o=>{for(const i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>n({issues:a}));else if(i.code==="invalid_key")n({issues:i.issues});else if(i.code==="invalid_element")n({issues:i.issues});else if(i.path.length===0)r._errors.push(t(i));else{let a=r,c=0;for(;c<i.path.length;){const d=i.path[c];c===i.path.length-1?(a[d]=a[d]||{_errors:[]},a[d]._errors.push(t(i))):a[d]=a[d]||{_errors:[]},a=a[d],c++}}};return n(e),r}const rt=e=>(t,r,n,o)=>{const i=n?Object.assign(n,{async:!1}):{async:!1},a=t._zod.run({value:r,issues:[]},i);if(a instanceof Promise)throw new ke;if(a.issues.length){const c=new(o?.Err??e)(a.issues.map(d=>me(d,i,de())));throw Pt(c,o?.callee),c}return a.value},nt=e=>async(t,r,n,o)=>{const i=n?Object.assign(n,{async:!0}):{async:!0};let a=t._zod.run({value:r,issues:[]},i);if(a instanceof Promise&&(a=await a),a.issues.length){const c=new(o?.Err??e)(a.issues.map(d=>me(d,i,de())));throw Pt(c,o?.callee),c}return a.value},Ue=e=>(t,r,n)=>{const o=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new ke;return i.issues.length?{success:!1,error:new(e??Mt)(i.issues.map(a=>me(a,o,de())))}:{success:!0,data:i.value}},Vr=Ue(Lt),Fe=e=>async(t,r,n)=>{const o=n?Object.assign(n,{async:!0}):{async:!0};let i=t._zod.run({value:r,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(a=>me(a,o,de())))}:{success:!0,data:i.value}},Wr=Fe(Lt),Gr=e=>(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return rt(e)(t,r,o)},qr=e=>(t,r,n)=>rt(e)(t,r,n),Yr=e=>async(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return nt(e)(t,r,o)},Hr=e=>async(t,r,n)=>nt(e)(t,r,n),Xr=e=>(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Ue(e)(t,r,o)},Qr=e=>(t,r,n)=>Ue(e)(t,r,n),en=e=>async(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Fe(e)(t,r,o)},tn=e=>async(t,r,n)=>Fe(e)(t,r,n),rn=/^[cC][^\s-]{8,}$/,nn=/^[0-9a-z]+$/,on=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,an=/^[0-9a-vA-V]{20}$/,sn=/^[A-Za-z0-9]{27}$/,ln=/^[a-zA-Z0-9_-]{21}$/,cn=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,un=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,mt=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,dn=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,mn="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function pn(){return new RegExp(mn,"u")}const fn=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,hn=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,gn=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,bn=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,vn=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Jt=/^[A-Za-z0-9_-]*$/,xn=/^\+[1-9]\d{6,14}$/,Ut="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",yn=new RegExp(`^${Ut}$`);function Ft(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function _n(e){return new RegExp(`^${Ft(e)}$`)}function kn(e){const t=Ft({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const n=`${t}(?:${r.join("|")})`;return new RegExp(`^${Ut}T(?:${n})$`)}const wn=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},zn=/^-?\d+$/,Bt=/^-?\d+(?:\.\d+)?$/,jn=/^(?:true|false)$/i,Sn=/^[^A-Z]*$/,Nn=/^[^a-z]*$/,W=m("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Kt={number:"number",bigint:"bigint",object:"date"},Vt=m("$ZodCheckLessThan",(e,t)=>{W.init(e,t);const r=Kt[typeof t.value];e._zod.onattach.push(n=>{const o=n._zod.bag,i=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<i&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Wt=m("$ZodCheckGreaterThan",(e,t)=>{W.init(e,t);const r=Kt[typeof t.value];e._zod.onattach.push(n=>{const o=n._zod.bag,i=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),On=m("$ZodCheckMultipleOf",(e,t)=>{W.init(e,t),e._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):Zr(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Cn=m("$ZodCheckNumberFormat",(e,t)=>{W.init(e,t),t.format=t.format||"float64";const r=t.format?.includes("int"),n=r?"int":"number",[o,i]=Pr[t.format];e._zod.onattach.push(a=>{const c=a._zod.bag;c.format=t.format,c.minimum=o,c.maximum=i,r&&(c.pattern=zn)}),e._zod.check=a=>{const c=a.value;if(r){if(!Number.isInteger(c)){a.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){c>0?a.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):a.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}c<o&&a.issues.push({origin:"number",input:c,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),c>i&&a.issues.push({origin:"number",input:c,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),$n=m("$ZodCheckMaxLength",(e,t)=>{var r;W.init(e,t),(r=e._zod.def).when??(r.when=n=>{const o=n.value;return!Qe(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{const o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{const o=n.value;if(o.length<=t.maximum)return;const a=tt(o);n.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Zn=m("$ZodCheckMinLength",(e,t)=>{var r;W.init(e,t),(r=e._zod.def).when??(r.when=n=>{const o=n.value;return!Qe(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{const o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{const o=n.value;if(o.length>=t.minimum)return;const a=tt(o);n.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),An=m("$ZodCheckLengthEquals",(e,t)=>{var r;W.init(e,t),(r=e._zod.def).when??(r.when=n=>{const o=n.value;return!Qe(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{const o=n._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=n=>{const o=n.value,i=o.length;if(i===t.length)return;const a=tt(o),c=i>t.length;n.issues.push({origin:a,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Be=m("$ZodCheckStringFormat",(e,t)=>{var r,n;W.init(e,t),e._zod.onattach.push(o=>{const i=o._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),Tn=m("$ZodCheckRegex",(e,t)=>{Be.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),En=m("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Sn),Be.init(e,t)}),In=m("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Nn),Be.init(e,t)}),Pn=m("$ZodCheckIncludes",(e,t)=>{W.init(e,t);const r=ze(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(o=>{const i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Rn=m("$ZodCheckStartsWith",(e,t)=>{W.init(e,t);const r=new RegExp(`^${ze(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Dn=m("$ZodCheckEndsWith",(e,t)=>{W.init(e,t);const r=new RegExp(`.*${ze(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Mn=m("$ZodCheckOverwrite",(e,t)=>{W.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});class Ln{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const n=t.split(`
|
|
2
|
+
`).filter(a=>a),o=Math.min(...n.map(a=>a.length-a.trimStart().length)),i=n.map(a=>a.slice(o)).map(a=>" ".repeat(this.indent*2)+a);for(const a of i)this.content.push(a)}compile(){const t=Function,r=this?.args,o=[...(this?.content??[""]).map(i=>` ${i}`)];return new t(...r,o.join(`
|
|
3
|
+
`))}}const Jn={major:4,minor:3,patch:6},I=m("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Jn;const n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(const o of n)for(const i of o._zod.onattach)i(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const o=(a,c,d)=>{let p=ye(a),f;for(const h of c){if(h._zod.def.when){if(!h._zod.def.when(a))continue}else if(p)continue;const u=a.issues.length,b=h._zod.check(a);if(b instanceof Promise&&d?.async===!1)throw new ke;if(f||b instanceof Promise)f=(f??Promise.resolve()).then(async()=>{await b,a.issues.length!==u&&(p||(p=ye(a,u)))});else{if(a.issues.length===u)continue;p||(p=ye(a,u))}}return f?f.then(()=>a):a},i=(a,c,d)=>{if(ye(a))return a.aborted=!0,a;const p=o(c,n,d);if(p instanceof Promise){if(d.async===!1)throw new ke;return p.then(f=>e._zod.parse(f,d))}return e._zod.parse(p,d)};e._zod.run=(a,c)=>{if(c.skipChecks)return e._zod.parse(a,c);if(c.direction==="backward"){const p=e._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});return p instanceof Promise?p.then(f=>i(f,a,c)):i(p,a,c)}const d=e._zod.parse(a,c);if(d instanceof Promise){if(c.async===!1)throw new ke;return d.then(p=>o(p,n,c))}return o(d,n,c)}}j(e,"~standard",()=>({validate:o=>{try{const i=Vr(e,o);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return Wr(e,o).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),ot=m("$ZodString",(e,t)=>{I.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??wn(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),A=m("$ZodStringFormat",(e,t)=>{Be.init(e,t),ot.init(e,t)}),Un=m("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=un),A.init(e,t)}),Fn=m("$ZodUUID",(e,t)=>{if(t.version){const n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=mt(n))}else t.pattern??(t.pattern=mt());A.init(e,t)}),Bn=m("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=dn),A.init(e,t)}),Kn=m("$ZodURL",(e,t)=>{A.init(e,t),e._zod.check=r=>{try{const n=r.value.trim(),o=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=o.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Vn=m("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=pn()),A.init(e,t)}),Wn=m("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=ln),A.init(e,t)}),Gn=m("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=rn),A.init(e,t)}),qn=m("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=nn),A.init(e,t)}),Yn=m("$ZodULID",(e,t)=>{t.pattern??(t.pattern=on),A.init(e,t)}),Hn=m("$ZodXID",(e,t)=>{t.pattern??(t.pattern=an),A.init(e,t)}),Xn=m("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=sn),A.init(e,t)}),Qn=m("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=kn(t)),A.init(e,t)}),eo=m("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=yn),A.init(e,t)}),to=m("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=_n(t)),A.init(e,t)}),ro=m("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=cn),A.init(e,t)}),no=m("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=fn),A.init(e,t),e._zod.bag.format="ipv4"}),oo=m("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=hn),A.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),ao=m("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=gn),A.init(e,t)}),io=m("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=bn),A.init(e,t),e._zod.check=r=>{const n=r.value.split("/");try{if(n.length!==2)throw new Error;const[o,i]=n;if(!i)throw new Error;const a=Number(i);if(`${a}`!==i)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function Gt(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const so=m("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=vn),A.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{Gt(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function lo(e){if(!Jt.test(e))return!1;const t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Gt(r)}const co=m("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Jt),A.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{lo(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),uo=m("$ZodE164",(e,t)=>{t.pattern??(t.pattern=xn),A.init(e,t)});function mo(e,t=null){try{const r=e.split(".");if(r.length!==3)return!1;const[n]=r;if(!n)return!1;const o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}const po=m("$ZodJWT",(e,t)=>{A.init(e,t),e._zod.check=r=>{mo(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),qt=m("$ZodNumber",(e,t)=>{I.init(e,t),e._zod.pattern=e._zod.bag.pattern??Bt,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}const o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;const i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),r}}),fo=m("$ZodNumberFormat",(e,t)=>{Cn.init(e,t),qt.init(e,t)}),ho=m("$ZodBoolean",(e,t)=>{I.init(e,t),e._zod.pattern=jn,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}const o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}}),go=m("$ZodUnknown",(e,t)=>{I.init(e,t),e._zod.parse=r=>r}),bo=m("$ZodNever",(e,t)=>{I.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function pt(e,t,r){e.issues.length&&t.issues.push(..._e(r,e.issues)),t.value[r]=e.value}const vo=m("$ZodArray",(e,t)=>{I.init(e,t),e._zod.parse=(r,n)=>{const o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),r;r.value=Array(o.length);const i=[];for(let a=0;a<o.length;a++){const c=o[a],d=t.element._zod.run({value:c,issues:[]},n);d instanceof Promise?i.push(d.then(p=>pt(p,r,a))):pt(d,r,a)}return i.length?Promise.all(i).then(()=>r):r}});function De(e,t,r,n,o){if(e.issues.length){if(o&&!(r in n))return;t.issues.push(..._e(r,e.issues))}e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function Yt(e){const t=Object.keys(e.shape);for(const n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);const r=Ir(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function Ht(e,t,r,n,o,i){const a=[],c=o.keySet,d=o.catchall._zod,p=d.def.type,f=d.optout==="optional";for(const h in t){if(c.has(h))continue;if(p==="never"){a.push(h);continue}const u=d.run({value:t[h],issues:[]},n);u instanceof Promise?e.push(u.then(b=>De(b,r,h,t,f))):De(u,r,h,t,f)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:i}),e.length?Promise.all(e).then(()=>r):r}const xo=m("$ZodObject",(e,t)=>{if(I.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const c=t.shape;Object.defineProperty(t,"shape",{get:()=>{const d={...c};return Object.defineProperty(t,"shape",{value:d}),d}})}const n=Je(()=>Yt(t));j(e._zod,"propValues",()=>{const c=t.shape,d={};for(const p in c){const f=c[p]._zod;if(f.values){d[p]??(d[p]=new Set);for(const h of f.values)d[p].add(h)}}return d});const o=Ze,i=t.catchall;let a;e._zod.parse=(c,d)=>{a??(a=n.value);const p=c.value;if(!o(p))return c.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),c;c.value={};const f=[],h=a.shape;for(const u of a.keys){const b=h[u],v=b._zod.optout==="optional",D=b._zod.run({value:p[u],issues:[]},d);D instanceof Promise?f.push(D.then(N=>De(N,c,u,p,v))):De(D,c,u,p,v)}return i?Ht(f,p,c,d,n.value,e):f.length?Promise.all(f).then(()=>c):c}}),yo=m("$ZodObjectJIT",(e,t)=>{xo.init(e,t);const r=e._zod.parse,n=Je(()=>Yt(t)),o=u=>{const b=new Ln(["shape","payload","ctx"]),v=n.value,D=B=>{const y=dt(B);return`shape[${y}]._zod.run({ value: input[${y}], issues: [] }, ctx)`};b.write("const input = payload.value;");const N=Object.create(null);let be=0;for(const B of v.keys)N[B]=`key_${be++}`;b.write("const newResult = {};");for(const B of v.keys){const y=N[B],U=dt(B),Ne=u[B]?._zod?.optout==="optional";b.write(`const ${y} = ${D(B)};`),Ne?b.write(`
|
|
4
|
+
if (${y}.issues.length) {
|
|
5
|
+
if (${U} in input) {
|
|
6
|
+
payload.issues = payload.issues.concat(${y}.issues.map(iss => ({
|
|
7
|
+
...iss,
|
|
8
|
+
path: iss.path ? [${U}, ...iss.path] : [${U}]
|
|
9
|
+
})));
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
if (${y}.value === undefined) {
|
|
14
|
+
if (${U} in input) {
|
|
15
|
+
newResult[${U}] = undefined;
|
|
16
|
+
}
|
|
17
|
+
} else {
|
|
18
|
+
newResult[${U}] = ${y}.value;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
`):b.write(`
|
|
22
|
+
if (${y}.issues.length) {
|
|
23
|
+
payload.issues = payload.issues.concat(${y}.issues.map(iss => ({
|
|
24
|
+
...iss,
|
|
25
|
+
path: iss.path ? [${U}, ...iss.path] : [${U}]
|
|
26
|
+
})));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (${y}.value === undefined) {
|
|
30
|
+
if (${U} in input) {
|
|
31
|
+
newResult[${U}] = undefined;
|
|
32
|
+
}
|
|
33
|
+
} else {
|
|
34
|
+
newResult[${U}] = ${y}.value;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
`)}b.write("payload.value = newResult;"),b.write("return payload;");const T=b.compile();return(B,y)=>T(u,B,y)};let i;const a=Ze,c=!Et.jitless,p=c&&Tr.value,f=t.catchall;let h;e._zod.parse=(u,b)=>{h??(h=n.value);const v=u.value;return a(v)?c&&p&&b?.async===!1&&b.jitless!==!0?(i||(i=o(t.shape)),u=i(u,b),f?Ht([],v,u,b,h,e):u):r(u,b):(u.issues.push({expected:"object",code:"invalid_type",input:v,inst:e}),u)}});function ft(e,t,r,n){for(const i of e)if(i.issues.length===0)return t.value=i.value,t;const o=e.filter(i=>!ye(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(a=>me(a,n,de())))}),t)}const Xt=m("$ZodUnion",(e,t)=>{I.init(e,t),j(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),j(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),j(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),j(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=>et(i.source)).join("|")})$`)}});const r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(o,i)=>{if(r)return n(o,i);let a=!1;const c=[];for(const d of t.options){const p=d._zod.run({value:o.value,issues:[]},i);if(p instanceof Promise)c.push(p),a=!0;else{if(p.issues.length===0)return p;c.push(p)}}return a?Promise.all(c).then(d=>ft(d,o,e,i)):ft(c,o,e,i)}}),_o=m("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Xt.init(e,t);const r=e._zod.parse;j(e._zod,"propValues",()=>{const o={};for(const i of t.options){const a=i._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(const[c,d]of Object.entries(a)){o[c]||(o[c]=new Set);for(const p of d)o[c].add(p)}}return o});const n=Je(()=>{const o=t.options,i=new Map;for(const a of o){const c=a._zod.propValues?.[t.discriminator];if(!c||c.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(const d of c){if(i.has(d))throw new Error(`Duplicate discriminator value "${String(d)}"`);i.set(d,a)}}return i});e._zod.parse=(o,i)=>{const a=o.value;if(!Ze(a))return o.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),o;const c=n.value.get(a?.[t.discriminator]);return c?c._zod.run(o,i):t.unionFallback?r(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:a,path:[t.discriminator],inst:e}),o)}}),ko=m("$ZodIntersection",(e,t)=>{I.init(e,t),e._zod.parse=(r,n)=>{const o=r.value,i=t.left._zod.run({value:o,issues:[]},n),a=t.right._zod.run({value:o,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([d,p])=>ht(r,d,p)):ht(r,i,a)}});function He(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(we(e)&&we(t)){const r=Object.keys(t),n=Object.keys(e).filter(i=>r.indexOf(i)!==-1),o={...e,...t};for(const i of n){const a=He(e[i],t[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};o[i]=a.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let n=0;n<e.length;n++){const o=e[n],i=t[n],a=He(o,i);if(!a.valid)return{valid:!1,mergeErrorPath:[n,...a.mergeErrorPath]};r.push(a.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function ht(e,t,r){const n=new Map;let o;for(const c of t.issues)if(c.code==="unrecognized_keys"){o??(o=c);for(const d of c.keys)n.has(d)||n.set(d,{}),n.get(d).l=!0}else e.issues.push(c);for(const c of r.issues)if(c.code==="unrecognized_keys")for(const d of c.keys)n.has(d)||n.set(d,{}),n.get(d).r=!0;else e.issues.push(c);const i=[...n].filter(([,c])=>c.l&&c.r).map(([c])=>c);if(i.length&&o&&e.issues.push({...o,keys:i}),ye(e))return e;const a=He(t.value,r.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}const wo=m("$ZodRecord",(e,t)=>{I.init(e,t),e._zod.parse=(r,n)=>{const o=r.value;if(!we(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),r;const i=[],a=t.keyType._zod.values;if(a){r.value={};const c=new Set;for(const p of a)if(typeof p=="string"||typeof p=="number"||typeof p=="symbol"){c.add(typeof p=="number"?p.toString():p);const f=t.valueType._zod.run({value:o[p],issues:[]},n);f instanceof Promise?i.push(f.then(h=>{h.issues.length&&r.issues.push(..._e(p,h.issues)),r.value[p]=h.value})):(f.issues.length&&r.issues.push(..._e(p,f.issues)),r.value[p]=f.value)}let d;for(const p in o)c.has(p)||(d=d??[],d.push(p));d&&d.length>0&&r.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:d})}else{r.value={};for(const c of Reflect.ownKeys(o)){if(c==="__proto__")continue;let d=t.keyType._zod.run({value:c,issues:[]},n);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof c=="string"&&Bt.test(c)&&d.issues.length){const h=t.keyType._zod.run({value:Number(c),issues:[]},n);if(h instanceof Promise)throw new Error("Async schemas not supported in object keys currently");h.issues.length===0&&(d=h)}if(d.issues.length){t.mode==="loose"?r.value[c]=o[c]:r.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map(h=>me(h,n,de())),input:c,path:[c],inst:e});continue}const f=t.valueType._zod.run({value:o[c],issues:[]},n);f instanceof Promise?i.push(f.then(h=>{h.issues.length&&r.issues.push(..._e(c,h.issues)),r.value[d.value]=h.value})):(f.issues.length&&r.issues.push(..._e(c,f.issues)),r.value[d.value]=f.value)}}return i.length?Promise.all(i).then(()=>r):r}}),zo=m("$ZodEnum",(e,t)=>{I.init(e,t);const r=It(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(o=>Er.has(typeof o)).map(o=>typeof o=="string"?ze(o):o.toString()).join("|")})$`),e._zod.parse=(o,i)=>{const a=o.value;return n.has(a)||o.issues.push({code:"invalid_value",values:r,input:a,inst:e}),o}}),jo=m("$ZodLiteral",(e,t)=>{if(I.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map(n=>typeof n=="string"?ze(n):n?ze(n.toString()):String(n)).join("|")})$`),e._zod.parse=(n,o)=>{const i=n.value;return r.has(i)||n.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),n}}),So=m("$ZodTransform",(e,t)=>{I.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Tt(e.constructor.name);const o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(a=>(r.value=a,r));if(o instanceof Promise)throw new ke;return r.value=o,r}});function gt(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const Qt=m("$ZodOptional",(e,t)=>{I.init(e,t),e._zod.optin="optional",e._zod.optout="optional",j(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),j(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${et(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>gt(i,r.value)):gt(o,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}}),No=m("$ZodExactOptional",(e,t)=>{Qt.init(e,t),j(e._zod,"values",()=>t.innerType._zod.values),j(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),Oo=m("$ZodNullable",(e,t)=>{I.init(e,t),j(e._zod,"optin",()=>t.innerType._zod.optin),j(e._zod,"optout",()=>t.innerType._zod.optout),j(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${et(r.source)}|null)$`):void 0}),j(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),Co=m("$ZodDefault",(e,t)=>{I.init(e,t),e._zod.optin="optional",j(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>bt(i,t)):bt(o,t)}});function bt(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const $o=m("$ZodPrefault",(e,t)=>{I.init(e,t),e._zod.optin="optional",j(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),Zo=m("$ZodNonOptional",(e,t)=>{I.init(e,t),j(e._zod,"values",()=>{const r=t.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),e._zod.parse=(r,n)=>{const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>vt(i,e)):vt(o,e)}});function vt(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 Ao=m("$ZodCatch",(e,t)=>{I.init(e,t),j(e._zod,"optin",()=>t.innerType._zod.optin),j(e._zod,"optout",()=>t.innerType._zod.optout),j(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.value,i.issues.length&&(r.value=t.catchValue({...r,error:{issues:i.issues.map(a=>me(a,n,de()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=t.catchValue({...r,error:{issues:o.issues.map(i=>me(i,n,de()))},input:r.value}),r.issues=[]),r)}}),To=m("$ZodPipe",(e,t)=>{I.init(e,t),j(e._zod,"values",()=>t.in._zod.values),j(e._zod,"optin",()=>t.in._zod.optin),j(e._zod,"optout",()=>t.out._zod.optout),j(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){const i=t.out._zod.run(r,n);return i instanceof Promise?i.then(a=>Ie(a,t.in,n)):Ie(i,t.in,n)}const o=t.in._zod.run(r,n);return o instanceof Promise?o.then(i=>Ie(i,t.out,n)):Ie(o,t.out,n)}});function Ie(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const Eo=m("$ZodReadonly",(e,t)=>{I.init(e,t),j(e._zod,"propValues",()=>t.innerType._zod.propValues),j(e._zod,"values",()=>t.innerType._zod.values),j(e._zod,"optin",()=>t.innerType?._zod?.optin),j(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(xt):xt(o)}});function xt(e){return e.value=Object.freeze(e.value),e}const Io=m("$ZodCustom",(e,t)=>{W.init(e,t),I.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{const n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(i=>yt(i,r,n,e));yt(o,r,n,e)}});function yt(e,t,r,n){if(!e){const o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),t.issues.push(Ae(o))}}var _t;class Po{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){const n=r[0];return this._map.set(t,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){const r=t._zod.parent;if(r){const n={...this.get(r)??{}};delete n.id;const o={...n,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function Ro(){return new Po}(_t=globalThis).__zod_globalRegistry??(_t.__zod_globalRegistry=Ro());const $e=globalThis.__zod_globalRegistry;function Do(e,t){return new e({type:"string",...g(t)})}function Mo(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...g(t)})}function kt(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...g(t)})}function Lo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...g(t)})}function Jo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...g(t)})}function Uo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...g(t)})}function Fo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...g(t)})}function Bo(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...g(t)})}function Ko(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...g(t)})}function Vo(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...g(t)})}function Wo(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...g(t)})}function Go(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...g(t)})}function qo(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...g(t)})}function Yo(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...g(t)})}function Ho(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...g(t)})}function Xo(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...g(t)})}function Qo(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...g(t)})}function ea(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...g(t)})}function ta(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...g(t)})}function ra(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...g(t)})}function na(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...g(t)})}function oa(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...g(t)})}function aa(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...g(t)})}function ia(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...g(t)})}function sa(e,t){return new e({type:"string",format:"date",check:"string_format",...g(t)})}function la(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...g(t)})}function ca(e,t){return new e({type:"string",format:"duration",check:"string_format",...g(t)})}function ua(e,t){return new e({type:"number",checks:[],...g(t)})}function da(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...g(t)})}function ma(e,t){return new e({type:"boolean",...g(t)})}function pa(e){return new e({type:"unknown"})}function fa(e,t){return new e({type:"never",...g(t)})}function wt(e,t){return new Vt({check:"less_than",...g(t),value:e,inclusive:!1})}function We(e,t){return new Vt({check:"less_than",...g(t),value:e,inclusive:!0})}function zt(e,t){return new Wt({check:"greater_than",...g(t),value:e,inclusive:!1})}function Ge(e,t){return new Wt({check:"greater_than",...g(t),value:e,inclusive:!0})}function jt(e,t){return new On({check:"multiple_of",...g(t),value:e})}function er(e,t){return new $n({check:"max_length",...g(t),maximum:e})}function Me(e,t){return new Zn({check:"min_length",...g(t),minimum:e})}function tr(e,t){return new An({check:"length_equals",...g(t),length:e})}function ha(e,t){return new Tn({check:"string_format",format:"regex",...g(t),pattern:e})}function ga(e){return new En({check:"string_format",format:"lowercase",...g(e)})}function ba(e){return new In({check:"string_format",format:"uppercase",...g(e)})}function va(e,t){return new Pn({check:"string_format",format:"includes",...g(t),includes:e})}function xa(e,t){return new Rn({check:"string_format",format:"starts_with",...g(t),prefix:e})}function ya(e,t){return new Dn({check:"string_format",format:"ends_with",...g(t),suffix:e})}function je(e){return new Mn({check:"overwrite",tx:e})}function _a(e){return je(t=>t.normalize(e))}function ka(){return je(e=>e.trim())}function wa(){return je(e=>e.toLowerCase())}function za(){return je(e=>e.toUpperCase())}function ja(){return je(e=>Ar(e))}function Sa(e,t,r){return new e({type:"array",element:t,...g(r)})}function Na(e,t,r){return new e({type:"custom",check:"custom",fn:t,...g(r)})}function Oa(e){const t=Ca(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(Ae(n,r.value,t._zod.def));else{const o=n;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),r.issues.push(Ae(o))}},e(r.value,r)));return t}function Ca(e,t){const r=new W({check:"custom",...g(t)});return r._zod.check=e,r}function rr(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??$e,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 L(e,t,r={path:[],schemaPath:[]}){var n;const o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,r.schemaPath.includes(e)&&(i.cycle=r.path),i.schema;const a={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,a);const c=e._zod.toJSONSchema?.();if(c)a.schema=c;else{const f={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,f);else{const u=a.schema,b=t.processors[o.type];if(!b)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);b(e,t,u,f)}const h=e._zod.parent;h&&(a.ref||(a.ref=h),L(h,t,f),t.seen.get(h).isParent=!0)}const d=t.metadataRegistry.get(e);return d&&Object.assign(a.schema,d),t.io==="input"&&V(e)&&(delete a.schema.examples,delete a.schema.default),t.io==="input"&&a.schema._prefault&&((n=a.schema).default??(n.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function nr(e,t){const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const n=new Map;for(const a of e.seen.entries()){const c=e.metadataRegistry.get(a[0])?.id;if(c){const d=n.get(c);if(d&&d!==a[0])throw new Error(`Duplicate schema id "${c}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(c,a[0])}}const o=a=>{const c=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const h=e.external.registry.get(a[0])?.id,u=e.external.uri??(v=>v);if(h)return{ref:u(h)};const b=a[1].defId??a[1].schema.id??`schema${e.counter++}`;return a[1].defId=b,{defId:b,ref:`${u("__shared")}#/${c}/${b}`}}if(a[1]===r)return{ref:"#"};const p=`#/${c}/`,f=a[1].schema.id??`__schema${e.counter++}`;return{defId:f,ref:p+f}},i=a=>{if(a[1].schema.$ref)return;const c=a[1],{ref:d,defId:p}=o(a);c.def={...c.schema},p&&(c.defId=p);const f=c.schema;for(const h in f)delete f[h];f.$ref=d};if(e.cycles==="throw")for(const a of e.seen.entries()){const c=a[1];if(c.cycle)throw new Error(`Cycle detected: #/${c.cycle?.join("/")}/<root>
|
|
38
|
+
|
|
39
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const a of e.seen.entries()){const c=a[1];if(t===a[0]){i(a);continue}if(e.external){const p=e.external.registry.get(a[0])?.id;if(t!==a[0]&&p){i(a);continue}}if(e.metadataRegistry.get(a[0])?.id){i(a);continue}if(c.cycle){i(a);continue}if(c.count>1&&e.reused==="ref"){i(a);continue}}}function or(e,t){const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const n=a=>{const c=e.seen.get(a);if(c.ref===null)return;const d=c.def??c.schema,p={...d},f=c.ref;if(c.ref=null,f){n(f);const u=e.seen.get(f),b=u.schema;if(b.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(d.allOf=d.allOf??[],d.allOf.push(b)):Object.assign(d,b),Object.assign(d,p),a._zod.parent===f)for(const D in d)D==="$ref"||D==="allOf"||D in p||delete d[D];if(b.$ref&&u.def)for(const D in d)D==="$ref"||D==="allOf"||D in u.def&&JSON.stringify(d[D])===JSON.stringify(u.def[D])&&delete d[D]}const h=a._zod.parent;if(h&&h!==f){n(h);const u=e.seen.get(h);if(u?.schema.$ref&&(d.$ref=u.schema.$ref,u.def))for(const b in d)b==="$ref"||b==="allOf"||b in u.def&&JSON.stringify(d[b])===JSON.stringify(u.def[b])&&delete d[b]}e.override({zodSchema:a,jsonSchema:d,path:c.path??[]})};for(const a of[...e.seen.entries()].reverse())n(a[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(a)}Object.assign(o,r.def??r.schema);const i=e.external?.defs??{};for(const a of e.seen.entries()){const c=a[1];c.def&&c.defId&&(i[c.defId]=c.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{const a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:Le(t,"input",e.processors),output:Le(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function V(e,t){const r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);const n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return V(n.element,r);if(n.type==="set")return V(n.valueType,r);if(n.type==="lazy")return V(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return V(n.innerType,r);if(n.type==="intersection")return V(n.left,r)||V(n.right,r);if(n.type==="record"||n.type==="map")return V(n.keyType,r)||V(n.valueType,r);if(n.type==="pipe")return V(n.in,r)||V(n.out,r);if(n.type==="object"){for(const o in n.shape)if(V(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(const o of n.options)if(V(o,r))return!0;return!1}if(n.type==="tuple"){for(const o of n.items)if(V(o,r))return!0;return!!(n.rest&&V(n.rest,r))}return!1}const $a=(e,t={})=>r=>{const n=rr({...r,processors:t});return L(e,n),nr(n,e),or(n,e)},Le=(e,t,r={})=>n=>{const{libraryOptions:o,target:i}=n??{},a=rr({...o??{},target:i,io:t,processors:r});return L(e,a),nr(a,e),or(a,e)},Za={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Aa=(e,t,r,n)=>{const o=r;o.type="string";const{minimum:i,maximum:a,format:c,patterns:d,contentEncoding:p}=e._zod.bag;if(typeof i=="number"&&(o.minLength=i),typeof a=="number"&&(o.maxLength=a),c&&(o.format=Za[c]??c,o.format===""&&delete o.format,c==="time"&&delete o.format),p&&(o.contentEncoding=p),d&&d.size>0){const f=[...d];f.length===1?o.pattern=f[0].source:f.length>1&&(o.allOf=[...f.map(h=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:h.source}))])}},Ta=(e,t,r,n)=>{const o=r,{minimum:i,maximum:a,format:c,multipleOf:d,exclusiveMaximum:p,exclusiveMinimum:f}=e._zod.bag;typeof c=="string"&&c.includes("int")?o.type="integer":o.type="number",typeof f=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.minimum=f,o.exclusiveMinimum=!0):o.exclusiveMinimum=f),typeof i=="number"&&(o.minimum=i,typeof f=="number"&&t.target!=="draft-04"&&(f>=i?delete o.minimum:delete o.exclusiveMinimum)),typeof p=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.maximum=p,o.exclusiveMaximum=!0):o.exclusiveMaximum=p),typeof a=="number"&&(o.maximum=a,typeof p=="number"&&t.target!=="draft-04"&&(p<=a?delete o.maximum:delete o.exclusiveMaximum)),typeof d=="number"&&(o.multipleOf=d)},Ea=(e,t,r,n)=>{r.type="boolean"},Ia=(e,t,r,n)=>{r.not={}},Pa=(e,t,r,n)=>{},Ra=(e,t,r,n)=>{const o=e._zod.def,i=It(o.entries);i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),r.enum=i},Da=(e,t,r,n)=>{const o=e._zod.def,i=[];for(const a of o.values)if(a===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(a))}else i.push(a);if(i.length!==0)if(i.length===1){const a=i[0];r.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[a]:r.const=a}else i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),i.every(a=>typeof a=="boolean")&&(r.type="boolean"),i.every(a=>a===null)&&(r.type="null"),r.enum=i},Ma=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},La=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Ja=(e,t,r,n)=>{const o=r,i=e._zod.def,{minimum:a,maximum:c}=e._zod.bag;typeof a=="number"&&(o.minItems=a),typeof c=="number"&&(o.maxItems=c),o.type="array",o.items=L(i.element,t,{...n,path:[...n.path,"items"]})},Ua=(e,t,r,n)=>{const o=r,i=e._zod.def;o.type="object",o.properties={};const a=i.shape;for(const p in a)o.properties[p]=L(a[p],t,{...n,path:[...n.path,"properties",p]});const c=new Set(Object.keys(a)),d=new Set([...c].filter(p=>{const f=i.shape[p]._zod;return t.io==="input"?f.optin===void 0:f.optout===void 0}));d.size>0&&(o.required=Array.from(d)),i.catchall?._zod.def.type==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=L(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},Fa=(e,t,r,n)=>{const o=e._zod.def,i=o.inclusive===!1,a=o.options.map((c,d)=>L(c,t,{...n,path:[...n.path,i?"oneOf":"anyOf",d]}));i?r.oneOf=a:r.anyOf=a},Ba=(e,t,r,n)=>{const o=e._zod.def,i=L(o.left,t,{...n,path:[...n.path,"allOf",0]}),a=L(o.right,t,{...n,path:[...n.path,"allOf",1]}),c=p=>"allOf"in p&&Object.keys(p).length===1,d=[...c(i)?i.allOf:[i],...c(a)?a.allOf:[a]];r.allOf=d},Ka=(e,t,r,n)=>{const o=r,i=e._zod.def;o.type="object";const a=i.keyType,d=a._zod.bag?.patterns;if(i.mode==="loose"&&d&&d.size>0){const f=L(i.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(const h of d)o.patternProperties[h.source]=f}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=L(i.keyType,t,{...n,path:[...n.path,"propertyNames"]})),o.additionalProperties=L(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]});const p=a._zod.values;if(p){const f=[...p].filter(h=>typeof h=="string"||typeof h=="number");f.length>0&&(o.required=f)}},Va=(e,t,r,n)=>{const o=e._zod.def,i=L(o.innerType,t,n),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=o.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},Wa=(e,t,r,n)=>{const o=e._zod.def;L(o.innerType,t,n);const i=t.seen.get(e);i.ref=o.innerType},Ga=(e,t,r,n)=>{const o=e._zod.def;L(o.innerType,t,n);const i=t.seen.get(e);i.ref=o.innerType,r.default=JSON.parse(JSON.stringify(o.defaultValue))},qa=(e,t,r,n)=>{const o=e._zod.def;L(o.innerType,t,n);const i=t.seen.get(e);i.ref=o.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},Ya=(e,t,r,n)=>{const o=e._zod.def;L(o.innerType,t,n);const i=t.seen.get(e);i.ref=o.innerType;let a;try{a=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=a},Ha=(e,t,r,n)=>{const o=e._zod.def,i=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;L(i,t,n);const a=t.seen.get(e);a.ref=i},Xa=(e,t,r,n)=>{const o=e._zod.def;L(o.innerType,t,n);const i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0},ar=(e,t,r,n)=>{const o=e._zod.def;L(o.innerType,t,n);const i=t.seen.get(e);i.ref=o.innerType},Qa=m("ZodISODateTime",(e,t)=>{Qn.init(e,t),R.init(e,t)});function ei(e){return ia(Qa,e)}const ti=m("ZodISODate",(e,t)=>{eo.init(e,t),R.init(e,t)});function ri(e){return sa(ti,e)}const ni=m("ZodISOTime",(e,t)=>{to.init(e,t),R.init(e,t)});function oi(e){return la(ni,e)}const ai=m("ZodISODuration",(e,t)=>{ro.init(e,t),R.init(e,t)});function ii(e){return ca(ai,e)}const si=(e,t)=>{Mt.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>Kr(e,r)},flatten:{value:r=>Br(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Ye,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Ye,2)}},isEmpty:{get(){return e.issues.length===0}}})},Y=m("ZodError",si,{Parent:Error}),li=rt(Y),ci=nt(Y),ui=Ue(Y),di=Fe(Y),mi=Gr(Y),pi=qr(Y),fi=Yr(Y),hi=Hr(Y),gi=Xr(Y),bi=Qr(Y),vi=en(Y),xi=tn(Y),P=m("ZodType",(e,t)=>(I.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Le(e,"input"),output:Le(e,"output")}}),e.toJSONSchema=$a(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(pe(t,{checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0}),e.with=e.check,e.clone=(r,n)=>fe(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.parse=(r,n)=>li(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>ui(e,r,n),e.parseAsync=async(r,n)=>ci(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>di(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>mi(e,r,n),e.decode=(r,n)=>pi(e,r,n),e.encodeAsync=async(r,n)=>fi(e,r,n),e.decodeAsync=async(r,n)=>hi(e,r,n),e.safeEncode=(r,n)=>gi(e,r,n),e.safeDecode=(r,n)=>bi(e,r,n),e.safeEncodeAsync=async(r,n)=>vi(e,r,n),e.safeDecodeAsync=async(r,n)=>xi(e,r,n),e.refine=(r,n)=>e.check(ps(r,n)),e.superRefine=r=>e.check(fs(r)),e.overwrite=r=>e.check(je(r)),e.optional=()=>$t(e),e.exactOptional=()=>es(e),e.nullable=()=>Zt(e),e.nullish=()=>$t(Zt(e)),e.nonoptional=r=>is(e,r),e.array=()=>ne(e),e.or=r=>cr([e,r]),e.and=r=>Gi(e,r),e.transform=r=>At(e,Xi(r)),e.default=r=>ns(e,r),e.prefault=r=>as(e,r),e.catch=r=>ls(e,r),e.pipe=r=>At(e,r),e.readonly=()=>ds(e),e.describe=r=>{const n=e.clone();return $e.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return $e.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return $e.get(e);const n=e.clone();return $e.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=r=>r(e),e)),ir=m("_ZodString",(e,t)=>{ot.init(e,t),P.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Aa(e,n,o);const r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...n)=>e.check(ha(...n)),e.includes=(...n)=>e.check(va(...n)),e.startsWith=(...n)=>e.check(xa(...n)),e.endsWith=(...n)=>e.check(ya(...n)),e.min=(...n)=>e.check(Me(...n)),e.max=(...n)=>e.check(er(...n)),e.length=(...n)=>e.check(tr(...n)),e.nonempty=(...n)=>e.check(Me(1,...n)),e.lowercase=n=>e.check(ga(n)),e.uppercase=n=>e.check(ba(n)),e.trim=()=>e.check(ka()),e.normalize=(...n)=>e.check(_a(...n)),e.toLowerCase=()=>e.check(wa()),e.toUpperCase=()=>e.check(za()),e.slugify=()=>e.check(ja())}),yi=m("ZodString",(e,t)=>{ot.init(e,t),ir.init(e,t),e.email=r=>e.check(Mo(_i,r)),e.url=r=>e.check(Bo(ki,r)),e.jwt=r=>e.check(aa(Ri,r)),e.emoji=r=>e.check(Ko(wi,r)),e.guid=r=>e.check(kt(St,r)),e.uuid=r=>e.check(Lo(Pe,r)),e.uuidv4=r=>e.check(Jo(Pe,r)),e.uuidv6=r=>e.check(Uo(Pe,r)),e.uuidv7=r=>e.check(Fo(Pe,r)),e.nanoid=r=>e.check(Vo(zi,r)),e.guid=r=>e.check(kt(St,r)),e.cuid=r=>e.check(Wo(ji,r)),e.cuid2=r=>e.check(Go(Si,r)),e.ulid=r=>e.check(qo(Ni,r)),e.base64=r=>e.check(ra(Ei,r)),e.base64url=r=>e.check(na(Ii,r)),e.xid=r=>e.check(Yo(Oi,r)),e.ksuid=r=>e.check(Ho(Ci,r)),e.ipv4=r=>e.check(Xo($i,r)),e.ipv6=r=>e.check(Qo(Zi,r)),e.cidrv4=r=>e.check(ea(Ai,r)),e.cidrv6=r=>e.check(ta(Ti,r)),e.e164=r=>e.check(oa(Pi,r)),e.datetime=r=>e.check(ei(r)),e.date=r=>e.check(ri(r)),e.time=r=>e.check(oi(r)),e.duration=r=>e.check(ii(r))});function x(e){return Do(yi,e)}const R=m("ZodStringFormat",(e,t)=>{A.init(e,t),ir.init(e,t)}),_i=m("ZodEmail",(e,t)=>{Bn.init(e,t),R.init(e,t)}),St=m("ZodGUID",(e,t)=>{Un.init(e,t),R.init(e,t)}),Pe=m("ZodUUID",(e,t)=>{Fn.init(e,t),R.init(e,t)}),ki=m("ZodURL",(e,t)=>{Kn.init(e,t),R.init(e,t)}),wi=m("ZodEmoji",(e,t)=>{Vn.init(e,t),R.init(e,t)}),zi=m("ZodNanoID",(e,t)=>{Wn.init(e,t),R.init(e,t)}),ji=m("ZodCUID",(e,t)=>{Gn.init(e,t),R.init(e,t)}),Si=m("ZodCUID2",(e,t)=>{qn.init(e,t),R.init(e,t)}),Ni=m("ZodULID",(e,t)=>{Yn.init(e,t),R.init(e,t)}),Oi=m("ZodXID",(e,t)=>{Hn.init(e,t),R.init(e,t)}),Ci=m("ZodKSUID",(e,t)=>{Xn.init(e,t),R.init(e,t)}),$i=m("ZodIPv4",(e,t)=>{no.init(e,t),R.init(e,t)}),Zi=m("ZodIPv6",(e,t)=>{oo.init(e,t),R.init(e,t)}),Ai=m("ZodCIDRv4",(e,t)=>{ao.init(e,t),R.init(e,t)}),Ti=m("ZodCIDRv6",(e,t)=>{io.init(e,t),R.init(e,t)}),Ei=m("ZodBase64",(e,t)=>{so.init(e,t),R.init(e,t)}),Ii=m("ZodBase64URL",(e,t)=>{co.init(e,t),R.init(e,t)}),Pi=m("ZodE164",(e,t)=>{uo.init(e,t),R.init(e,t)}),Ri=m("ZodJWT",(e,t)=>{po.init(e,t),R.init(e,t)}),sr=m("ZodNumber",(e,t)=>{qt.init(e,t),P.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Ta(e,n,o),e.gt=(n,o)=>e.check(zt(n,o)),e.gte=(n,o)=>e.check(Ge(n,o)),e.min=(n,o)=>e.check(Ge(n,o)),e.lt=(n,o)=>e.check(wt(n,o)),e.lte=(n,o)=>e.check(We(n,o)),e.max=(n,o)=>e.check(We(n,o)),e.int=n=>e.check(Nt(n)),e.safe=n=>e.check(Nt(n)),e.positive=n=>e.check(zt(0,n)),e.nonnegative=n=>e.check(Ge(0,n)),e.negative=n=>e.check(wt(0,n)),e.nonpositive=n=>e.check(We(0,n)),e.multipleOf=(n,o)=>e.check(jt(n,o)),e.step=(n,o)=>e.check(jt(n,o)),e.finite=()=>e;const r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function Z(e){return ua(sr,e)}const Di=m("ZodNumberFormat",(e,t)=>{fo.init(e,t),sr.init(e,t)});function Nt(e){return da(Di,e)}const Mi=m("ZodBoolean",(e,t)=>{ho.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ea(e,r,n)});function J(e){return ma(Mi,e)}const Li=m("ZodUnknown",(e,t)=>{go.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Pa()});function Ot(){return pa(Li)}const Ji=m("ZodNever",(e,t)=>{bo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ia(e,r,n)});function Ui(e){return fa(Ji,e)}const Fi=m("ZodArray",(e,t)=>{vo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ja(e,r,n,o),e.element=t.element,e.min=(r,n)=>e.check(Me(r,n)),e.nonempty=r=>e.check(Me(1,r)),e.max=(r,n)=>e.check(er(r,n)),e.length=(r,n)=>e.check(tr(r,n)),e.unwrap=()=>e.element});function ne(e,t){return Sa(Fi,e,t)}const Bi=m("ZodObject",(e,t)=>{yo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ua(e,r,n,o),j(e,"shape",()=>t.shape),e.keyof=()=>ae(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Ot()}),e.loose=()=>e.clone({...e._zod.def,catchall:Ot()}),e.strict=()=>e.clone({...e._zod.def,catchall:Ui()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>Mr(e,r),e.safeExtend=r=>Lr(e,r),e.merge=r=>Jr(e,r),e.pick=r=>Rr(e,r),e.omit=r=>Dr(e,r),e.partial=(...r)=>Ur(ur,e,r[0]),e.required=(...r)=>Fr(dr,e,r[0])});function M(e,t){const r={type:"object",shape:e??{},...g(t)};return new Bi(r)}const lr=m("ZodUnion",(e,t)=>{Xt.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Fa(e,r,n,o),e.options=t.options});function cr(e,t){return new lr({type:"union",options:e,...g(t)})}const Ki=m("ZodDiscriminatedUnion",(e,t)=>{lr.init(e,t),_o.init(e,t)});function Vi(e,t,r){return new Ki({type:"union",options:t,discriminator:e,...g(r)})}const Wi=m("ZodIntersection",(e,t)=>{ko.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ba(e,r,n,o)});function Gi(e,t){return new Wi({type:"intersection",left:e,right:t})}const qi=m("ZodRecord",(e,t)=>{wo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ka(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function Re(e,t,r){return new qi({type:"record",keyType:e,valueType:t,...g(r)})}const Xe=m("ZodEnum",(e,t)=>{zo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Ra(e,n,o),e.enum=t.entries,e.options=Object.values(t.entries);const r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{const i={};for(const a of n)if(r.has(a))i[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new Xe({...t,checks:[],...g(o),entries:i})},e.exclude=(n,o)=>{const i={...t.entries};for(const a of n)if(r.has(a))delete i[a];else throw new Error(`Key ${a} not found in enum`);return new Xe({...t,checks:[],...g(o),entries:i})}});function ae(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Xe({type:"enum",entries:r,...g(t)})}const Yi=m("ZodLiteral",(e,t)=>{jo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Da(e,r,n),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 Ct(e,t){return new Yi({type:"literal",values:Array.isArray(e)?e:[e],...g(t)})}const Hi=m("ZodTransform",(e,t)=>{So.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>La(e,r),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Tt(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(Ae(i,r.value,t));else{const a=i;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=e),r.issues.push(Ae(a))}};const o=t.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});function Xi(e){return new Hi({type:"transform",transform:e})}const ur=m("ZodOptional",(e,t)=>{Qt.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ar(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function $t(e){return new ur({type:"optional",innerType:e})}const Qi=m("ZodExactOptional",(e,t)=>{No.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ar(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function es(e){return new Qi({type:"optional",innerType:e})}const ts=m("ZodNullable",(e,t)=>{Oo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Va(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Zt(e){return new ts({type:"nullable",innerType:e})}const rs=m("ZodDefault",(e,t)=>{Co.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ga(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function ns(e,t){return new rs({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Rt(t)}})}const os=m("ZodPrefault",(e,t)=>{$o.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>qa(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function as(e,t){return new os({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Rt(t)}})}const dr=m("ZodNonOptional",(e,t)=>{Zo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Wa(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function is(e,t){return new dr({type:"nonoptional",innerType:e,...g(t)})}const ss=m("ZodCatch",(e,t)=>{Ao.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ya(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function ls(e,t){return new ss({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const cs=m("ZodPipe",(e,t)=>{To.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ha(e,r,n,o),e.in=t.in,e.out=t.out});function At(e,t){return new cs({type:"pipe",in:e,out:t})}const us=m("ZodReadonly",(e,t)=>{Eo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Xa(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ds(e){return new us({type:"readonly",innerType:e})}const ms=m("ZodCustom",(e,t)=>{Io.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ma(e,r)});function ps(e,t={}){return Na(ms,e,t)}function fs(e){return Oa(e)}const O={agent:{name:"morpheus",personality:"helpful_dev"},logging:{enabled:!0,level:"info",retention:"14d"},audio:{provider:"google",model:"gemini-2.5-flash-lite",enabled:!0,maxDurationSeconds:300,supportedMimeTypes:["audio/ogg","audio/mp3","audio/mpeg","audio/wav"]},memory:{limit:100},runtime:{async_tasks:{enabled:!0}},llm:{provider:"openai",model:"gpt-4",temperature:.7,context_window:100},channels:{telegram:{enabled:!1,allowedUsers:[]},discord:{enabled:!1,allowedUsers:[]}},ui:{enabled:!0,port:3333}},hs=M({provider:ae(["google","openai","openrouter","ollama"]).default(O.audio.provider),model:x().min(1).default(O.audio.model),enabled:J().default(O.audio.enabled),apiKey:x().optional(),base_url:x().optional(),maxDurationSeconds:Z().default(O.audio.maxDurationSeconds),supportedMimeTypes:ne(x()).default(O.audio.supportedMimeTypes)}),Se=M({provider:ae(["openai","anthropic","openrouter","ollama","gemini"]).default(O.llm.provider),model:x().min(1).default(O.llm.model),temperature:Z().min(0).max(1).default(O.llm.temperature),max_tokens:Z().int().positive().optional(),api_key:x().optional(),base_url:x().optional(),context_window:Z().int().positive().optional()}),gs=Se.extend({memory_limit:Z().int().positive().optional(),enabled_archived_sessions:J().default(!0),similarity_threshold:Z().min(0).max(1).default(.9),evaluation_interval:Z().int().min(1).default(1)}),bs=Se.extend({working_dir:x().optional(),timeout_ms:Z().int().positive().optional(),execution_mode:ae(["sync","async"]).default("async")}),vs=Se.extend({execution_mode:ae(["sync","async"]).default("async")}),xs=Se.extend({execution_mode:ae(["sync","async"]).default("async")}),ys=Se.extend({personality:x().optional(),chunk_size:Z().int().positive().default(500),score_threshold:Z().min(0).max(1).default(.5),max_results:Z().int().positive().default(10),execution_mode:ae(["sync","async"]).default("async"),scan_interval_ms:Z().int().min(5e3).default(3e4),max_file_size_mb:Z().int().positive().default(50),vector_weight:Z().min(0).max(1).default(.8),bm25_weight:Z().min(0).max(1).default(.2)}),_s=M({telegram_notify_all:J().optional()}).optional(),ks=M({timezone:x().default("UTC"),check_interval_ms:Z().min(6e4).default(6e4),max_active_jobs:Z().min(1).max(1e3).default(100)}),ws=M({sandbox_dir:x().optional(),readonly_mode:J().default(!1),allowed_shell_commands:ne(x()).default([]),allowed_paths:ne(x()).default([]),enable_filesystem:J().default(!0),enable_shell:J().default(!0),enable_git:J().default(!0),enable_network:J().default(!0),timeout_ms:Z().int().positive().default(3e4)}),zs=M({name:x().min(1).max(64).regex(/^[a-z0-9][a-z0-9_-]*$/,"Smith name must be lowercase alphanumeric with hyphens/underscores"),host:x().min(1),port:Z().int().min(1).max(65535).default(7900),auth_token:x().min(1),tls:J().default(!1)}),js=M({enabled:J().default(!0),fields:ne(x()).default(["name","timezone","preferred_language"])}),Ss=M({enabled:J().default(!1),execution_mode:ae(["sync","async"]).default("async"),heartbeat_interval_ms:Z().int().min(5e3).default(3e4),connection_timeout_ms:Z().int().min(1e3).default(1e4),task_timeout_ms:Z().int().min(1e3).default(6e4),entries:ne(zs).default([])}),Ns=M({agent:M({name:x().default(O.agent.name),personality:x().default(O.agent.personality)}).default(O.agent),llm:Se.default(O.llm),sati:gs.optional(),neo:vs.optional(),apoc:bs.optional(),trinity:xs.optional(),link:ys.optional(),webhooks:_s,audio:hs.default(O.audio),memory:M({limit:Z().int().positive().optional()}).default(O.memory),runtime:M({async_tasks:M({enabled:J().default(O.runtime?.async_tasks.enabled)}).default(O.runtime?.async_tasks??{enabled:!0})}).optional(),chronos:ks.optional(),devkit:ws.optional(),smiths:Ss.optional(),setup:js.optional(),verbose_mode:J().default(!0),channels:M({telegram:M({enabled:J().default(!1),token:x().optional(),allowedUsers:ne(x()).default([])}).default(O.channels.telegram),discord:M({enabled:J().default(!1),token:x().optional(),allowedUsers:ne(x()).default([])}).default(O.channels.discord)}).default(O.channels),ui:M({enabled:J().default(O.ui.enabled),port:Z().default(O.ui.port)}).default(O.ui),logging:M({enabled:J().default(O.logging.enabled),level:ae(["debug","info","warn","error"]).default(O.logging.level),retention:x().default(O.logging.retention)}).default(O.logging)}),Os=Vi("transport",[M({transport:Ct("stdio"),command:x().min(1,"Command is required for stdio transport"),args:ne(x()).optional().default([]),env:Re(x(),x()).optional().default({}),_comment:x().optional()}),M({transport:Ct("http"),url:x().url("Valid URL is required for http transport"),headers:Re(x(),x()).optional().default({}),args:ne(x()).optional().default([]),env:Re(x(),x()).optional().default({}),_comment:x().optional()})]);Re(x(),cr([Os,x()]));const Cs={resetData:async e=>qe.delete("/danger/reset",{categories:e})},$s=[{id:"general",label:"General"},{id:"agents",label:"Agents"},{id:"devkit",label:"DevKit"},{id:"audio",label:"Audio"},{id:"channels",label:"Channels"},{id:"chronos",label:"Chronos"},{id:"danger",label:"Danger Zone"}],Zs=[{id:"oracle",label:"Oracle"},{id:"sati",label:"Sati"},{id:"neo",label:"Neo"},{id:"apoc",label:"Apoc"},{id:"trinity",label:"Trinity"},{id:"link",label:"Link"}],Ce=[{label:"OpenAI",value:"openai"},{label:"Anthropic",value:"anthropic"},{label:"OpenRouter",value:"openrouter"},{label:"Ollama",value:"ollama"},{label:"Google Gemini",value:"gemini"}];function Us(){const{data:e,error:t}=ce("/api/config",q.fetchConfig),{data:r}=ce("/api/config/sati",q.getSatiConfig),{data:n}=ce("/api/config/apoc",q.getApocConfig),{data:o}=ce("/api/config/neo",q.getNeoConfig),{data:i}=ce("/api/config/trinity",q.getTrinityConfig),{data:a}=ce("/api/link/config",()=>qe.get("/link/config")),{data:c}=ce("/api/config/encryption-status",()=>q.getEncryptionStatus()),{data:d}=ce("/api/config/env-overrides",()=>q.getEnvOverrides()),{data:p}=jr(),[f,h]=E.useState(null),[u,b]=E.useState(null),[v,D]=E.useState(null),[N,be]=E.useState(null),[T,B]=E.useState(null),[y,U]=E.useState(null),[$,Ne]=E.useState(null),[X,mr]=E.useState("general"),[he,pr]=E.useState("oracle"),[at,it]=E.useState(!1),[Q,Te]=E.useState({}),[Ke,Oe]=E.useState(null);E.useEffect(()=>{e&&!u&&b(e)},[e]),E.useEffect(()=>{r&&!v&&D(r)},[r]),E.useEffect(()=>{n&&!T?B(n):!n&&!T&&u&&B({...u.apoc??u.llm,temperature:u.apoc?.temperature??.2,timeout_ms:u.apoc?.timeout_ms??3e4})},[n,u]),E.useEffect(()=>{o&&!N?be(o):!o&&!N&&u&&be({...u.neo??u.llm,temperature:u.neo?.temperature??.2})},[o,u]),E.useEffect(()=>{i&&!y?U(i):!i&&!y&&u&&U({...u.trinity??u.llm,temperature:u.trinity?.temperature??.2})},[i,u]),E.useEffect(()=>{p&&!f&&h(p)},[p]),E.useEffect(()=>{a&&!$&&Ne(a)},[a]);const st=JSON.stringify(e)!==JSON.stringify(u)||JSON.stringify(r)!==JSON.stringify(v)||JSON.stringify(o)!==JSON.stringify(N)||JSON.stringify(n)!==JSON.stringify(T)||JSON.stringify(i)!==JSON.stringify(y)||JSON.stringify(p)!==JSON.stringify(f)||JSON.stringify(a)!==JSON.stringify($),fr={general:JSON.stringify(e?.agent)!==JSON.stringify(u?.agent)||e?.verbose_mode!==u?.verbose_mode,agents:JSON.stringify(e?.llm)!==JSON.stringify(u?.llm)||JSON.stringify(r)!==JSON.stringify(v)||JSON.stringify(o)!==JSON.stringify(N)||JSON.stringify(n)!==JSON.stringify(T)||JSON.stringify(i)!==JSON.stringify(y)||JSON.stringify(a)!==JSON.stringify($),devkit:JSON.stringify(e?.devkit)!==JSON.stringify(u?.devkit),audio:JSON.stringify(e?.audio)!==JSON.stringify(u?.audio),channels:JSON.stringify(e?.channels?.telegram)!==JSON.stringify(u?.channels?.telegram)||JSON.stringify(e?.channels?.discord)!==JSON.stringify(u?.channels?.discord)||JSON.stringify(e?.webhooks)!==JSON.stringify(u?.webhooks),ui:JSON.stringify(e?.ui)!==JSON.stringify(u?.ui),logging:JSON.stringify(e?.logging)!==JSON.stringify(u?.logging),chronos:JSON.stringify(p)!==JSON.stringify(f)},ve=(l,z)=>{if(!c?.apiKeysEncrypted)return null;const{morpheusSecretSet:ee,apiKeysEncrypted:te}=c,H=te[l];return!z?s.jsx("span",{className:"inline-flex items-center px-2 py-1 text-xs rounded bg-azure-surface border border-azure-border text-azure-text-secondary dark:bg-matrix-primary/10 dark:border-matrix-primary dark:text-matrix-tertiary",children:"No API key"}):d&&d[hr(l)]?null:ee?H?s.jsx("span",{className:"inline-flex items-center px-2 py-1 text-xs rounded bg-emerald-100 border border-emerald-300 text-emerald-800 dark:bg-emerald-900/30 dark:border-emerald-700 dark:text-emerald-400",title:"API key encrypted with AES-256-GCM",children:"🔒 Encrypted"}):s.jsx("span",{className:"inline-flex items-center px-2 py-1 text-xs rounded bg-amber-100 border border-amber-300 text-amber-800 dark:bg-amber-900/30 dark:border-amber-700 dark:text-amber-400",title:"Re-save this configuration to encrypt the API key",children:"⚠️ Re-save to encrypt"}):s.jsx("span",{className:"inline-flex items-center px-2 py-1 text-xs rounded bg-amber-100 border border-amber-300 text-amber-800 dark:bg-amber-900/30 dark:border-amber-700 dark:text-amber-400",title:"Set MORPHEUS_SECRET to enable encryption",children:"⚠️ Plaintext"})},hr=l=>({oracle:"llm.api_key",sati:"sati.api_key",neo:"neo.api_key",apoc:"apoc.api_key",trinity:"trinity.api_key",audio:"audio.apiKey"})[l],S=l=>!d||!d[l]?null:s.jsx("span",{className:"inline-flex items-center px-2 py-1 text-xs rounded bg-blue-100 border border-blue-300 text-blue-800 dark:bg-blue-900/30 dark:border-blue-700 dark:text-blue-400",title:"This field is set by an environment variable and cannot be edited",children:"🔒 Env Var"}),k=l=>!!(d&&d[l]),_=(l,z)=>{if(!u)return;const ee=JSON.parse(JSON.stringify(u));let te=ee;for(let H=0;H<l.length-1;H++)(te[l[H]]===void 0||te[l[H]]===null)&&(te[l[H]]={}),te=te[l[H]];te[l[l.length-1]]=z,b(ee);try{Ns.parse(ee),Te({})}catch(H){if(H instanceof zr){const Ve={};H.errors.forEach(lt=>{const kr=lt.path.join(".");Ve[kr]=lt.message}),Te(Ve)}}},ie=(l,z)=>{v&&D({...v,[l]:z})},se=(l,z)=>{T&&B({...T,[l]:z})},oe=(l,z)=>{N&&be({...N,[l]:z})},le=(l,z)=>{y&&U({...y,[l]:z})},gr=()=>{!u||!y||U({...y,provider:u.llm.provider,model:u.llm.model,api_key:u.llm.api_key})},br=()=>{!u||!v||D({...v,provider:u.llm.provider,model:u.llm.model,api_key:u.llm.api_key})},vr=()=>{!u||!T||B({...T,provider:u.llm.provider,model:u.llm.model,api_key:u.llm.api_key})},xr=()=>{!u||!N||be({...N,provider:u.llm.provider,model:u.llm.model,api_key:u.llm.api_key})},G=(l,z)=>{$&&Ne({...$,[l]:z})},yr=()=>{!u||!$||Ne({...$,provider:u.llm.provider,model:u.llm.model,api_key:u.llm.api_key})},_r=async()=>{if(u){it(!0),Oe(null);try{const l=await q.updateConfig(u);v&&await q.updateSatiConfig(v),N&&await q.updateNeoConfig(N),T&&await q.updateApocConfig(T),y&&await q.updateTrinityConfig(y),f&&await Sr.updateConfig(f),$&&await qe.post("/link/config",$),ue("/api/config"),ue("/api/config/sati"),ue("/api/config/neo"),ue("/api/config/apoc"),ue("/api/config/trinity"),ue("/api/config/chronos"),ue("/api/link/config"),Te({});const z=l._restartRequired||[],ee=z.length>0?`Settings saved and applied. Some changes require restart: ${z.join(", ")}`:"Settings saved and applied successfully.";Oe({type:"success",message:ee}),setTimeout(()=>Oe(null),5e3)}catch(l){if(Oe({type:"error",message:l.message}),l.details&&Array.isArray(l.details)){const z={};l.details.forEach(ee=>{const te=ee.path.join(".");z[te]=ee.message}),Te(z)}}finally{it(!1)}}};return t?s.jsx("div",{className:"p-8 text-red-500",children:"Failed to load configuration"}):u?s.jsxs("div",{className:"max-w-4xl mx-auto p-0 md:p-6 space-y-6",children:[s.jsxs("div",{className:"flex justify-between items-center flex-wrap gap-3",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-10 h-10 rounded-lg bg-azure-primary/10 dark:bg-matrix-highlight/10 border border-azure-primary/20 dark:border-matrix-highlight/30 flex items-center justify-center",children:s.jsx(Or,{className:"w-5 h-5 text-azure-primary dark:text-matrix-highlight"})}),s.jsxs("div",{children:[s.jsx("h1",{className:"text-xl font-bold text-azure-text dark:text-matrix-highlight",children:"Zaion Settings"}),s.jsx("p",{className:"text-sm text-azure-text-secondary dark:text-matrix-tertiary",children:"Configure agents, models, channels, and runtime behavior."})]})]}),s.jsx("button",{onClick:_r,disabled:!st||Object.keys(Q).length>0||at,className:`px-4 py-2 rounded font-medium transition-colors ${st&&Object.keys(Q).length===0?"bg-azure-primary text-white hover:bg-azure-active dark:bg-matrix-highlight dark:text-black dark:hover:bg-matrix-highlight/90":"bg-azure-border text-azure-text-secondary cursor-not-allowed dark:bg-matrix-primary/50 dark:text-matrix-highlight/50"}`,children:at?"Saving...":"Save Changes"})]}),Ke&&s.jsxs("div",{className:`flex items-start justify-between gap-3 p-4 rounded border ${Ke.type==="success"?"border-azure-primary text-azure-primary bg-azure-primary/10 dark:border-matrix-highlight dark:text-matrix-highlight dark:bg-matrix-highlight/10":"border-red-500 text-red-500 bg-red-900/10"}`,children:[s.jsx("span",{className:"text-sm",children:Ke.message}),s.jsx("button",{type:"button",onClick:()=>Oe(null),className:"shrink-0 opacity-60 hover:opacity-100 transition-opacity","aria-label":"Dismiss",children:s.jsx(Cr,{className:"w-4 h-4"})})]}),s.jsx("div",{className:"overflow-x-auto py-1 hide-scrollbar",children:s.jsx("div",{className:"flex space-x-1 border-b border-azure-border dark:border-matrix-primary pb-px min-w-max",children:$s.map(l=>s.jsxs("button",{onClick:()=>mr(l.id),className:`px-4 py-2 text-sm font-medium rounded-t-md transition-colors flex-shrink-0 flex items-center gap-1.5 ${X===l.id?"bg-azure-surface/50 text-azure-primary border-t border-x border-azure-border dark:bg-matrix-primary/20 dark:text-matrix-highlight dark:border-t dark:border-x dark:border-matrix-primary":"text-azure-text-secondary hover:text-azure-primary dark:text-matrix-secondary dark:hover:text-matrix-highlight"}`,children:[l.label,fr[l.id]&&s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 shrink-0"})]},l.id))})}),s.jsxs("div",{className:"space-y-6",children:[X==="general"&&s.jsxs(F,{title:"Agent Identity",children:[s.jsx(w,{label:"Agent Name",value:u.agent.name,onChange:l=>_(["agent","name"],l.target.value),error:Q["agent.name"]}),s.jsx(ct,{label:"Personality",value:u.agent.personality,onChange:l=>_(["agent","personality"],l.target.value),error:Q["agent.personality"],placeholder:"Describe the agent's personality or description..."}),s.jsx(K,{label:"Verbose Mode",value:u.verbose_mode!==!1?"true":"false",onChange:l=>_(["verbose_mode"],l.target.value==="true"),options:[{value:"true",label:"Enabled (notify tool execution on channels)"},{value:"false",label:"Disabled"}],helperText:"When enabled, channels like Telegram/Discord show which tools are being executed in real-time."})]}),X==="agents"&&s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"flex space-x-1 border-b border-azure-border dark:border-matrix-primary pb-px",children:Zs.map(l=>s.jsx("button",{onClick:()=>pr(l.id),className:`px-4 py-2 text-sm font-medium rounded-t-md transition-colors ${he===l.id?"bg-azure-primary/10 text-azure-primary border-b-2 border-azure-primary dark:bg-matrix-highlight/10 dark:text-matrix-highlight dark:border-matrix-highlight":"text-azure-text-secondary hover:text-azure-primary dark:text-matrix-secondary dark:hover:text-matrix-highlight"}`,children:l.label},l.id))}),he==="oracle"&&s.jsxs(F,{title:"Oracle Agent",children:[s.jsx("p",{className:"text-sm text-azure-text-secondary dark:text-matrix-secondary mb-4",children:"Main orchestration agent — handles user requests and delegates to subagents"}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("label",{className:"block text-sm font-medium text-azure-text-primary dark:text-matrix-secondary",children:"Provider"}),S("llm.provider")]}),s.jsx(K,{label:"",value:u.llm.provider,onChange:l=>_(["llm","provider"],l.target.value),options:Ce,error:Q["llm.provider"],disabled:k("llm.provider")}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("label",{className:"block text-sm font-medium text-azure-text-primary dark:text-matrix-secondary",children:"Model Name"}),S("llm.model")]}),s.jsx(w,{label:"",value:u.llm.model,onChange:l=>_(["llm","model"],l.target.value),disabled:k("llm.model")}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("label",{className:"block text-sm font-medium text-azure-text-primary dark:text-matrix-secondary",children:"Temperature"}),S("llm.temperature")]}),s.jsx(C,{label:"",value:u.llm.temperature,onChange:l=>_(["llm","temperature"],parseFloat(l.target.value)),step:.1,min:0,max:1,error:Q["llm.temperature"],disabled:k("llm.temperature")}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("label",{className:"block text-sm font-medium text-azure-text-primary dark:text-matrix-secondary",children:"Max Tokens"}),S("llm.max_tokens")]}),s.jsx(C,{label:"",value:u.llm.max_tokens??"",onChange:l=>_(["llm","max_tokens"],l.target.value?parseInt(l.target.value):void 0),min:1,error:Q["llm.max_tokens"],helperText:"Maximum tokens per response. Leave empty for model default.",disabled:k("llm.max_tokens")}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("label",{className:"block text-sm font-medium text-azure-text-primary dark:text-matrix-secondary",children:"Context Window (Messages)"}),S("llm.context_window")]}),s.jsx(C,{label:"",value:u.llm.context_window??100,onChange:l=>_(["llm","context_window"],parseInt(l.target.value)),min:1,step:1,error:Q["llm.context_window"],helperText:"Number of past interactions to load into LLM context (e.g., 100).",disabled:k("llm.context_window")}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("label",{className:"block text-sm font-medium text-azure-text-primary dark:text-matrix-secondary",children:"API Key"}),s.jsxs("div",{className:"flex items-center gap-2",children:[S("llm.api_key"),ve("oracle",u.llm.api_key)]})]}),s.jsx(w,{label:"",type:"password",value:u.llm.api_key||"",onChange:l=>_(["llm","api_key"],l.target.value),placeholder:"sk-...",helperText:"Stored locally.",disabled:k("llm.api_key")}),u.llm.provider==="openrouter"&&s.jsx(w,{label:"Base URL",value:u.llm.base_url||"https://openrouter.ai/api/v1",onChange:l=>_(["llm","base_url"],l.target.value),placeholder:"https://openrouter.ai/api/v1",helperText:"Base URL for OpenRouter API"})]}),he==="sati"&&s.jsxs(F,{title:"Sati Agent",children:[s.jsx("p",{className:"text-sm text-azure-text-secondary dark:text-matrix-secondary mb-4",children:"Background memory consolidation agent — evaluates conversations and persists important context"}),s.jsxs("div",{className:"mb-4",children:[s.jsx("button",{type:"button",onClick:br,className:"px-3 py-1.5 text-sm bg-azure-surface border border-azure-border rounded hover:bg-azure-primary/10 dark:bg-matrix-primary/20 dark:border-matrix-primary dark:hover:bg-matrix-highlight/10 text-azure-primary dark:text-matrix-highlight transition-colors",children:"Copy from Oracle Agent"}),s.jsx("p",{className:"text-xs text-azure-text-secondary dark:text-matrix-secondary mt-1",children:"Copy Provider, Model, and API Key from Oracle Agent configuration"})]}),v&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("label",{className:"block text-sm font-medium text-azure-text-primary dark:text-matrix-secondary",children:"Provider"}),S("sati.provider")]}),s.jsx(K,{label:"",value:v.provider,onChange:l=>ie("provider",l.target.value),options:Ce,disabled:k("sati.provider")}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("label",{className:"block text-sm font-medium text-azure-text-primary dark:text-matrix-secondary",children:"Model Name"}),S("sati.model")]}),s.jsx(w,{label:"",value:v.model,onChange:l=>ie("model",l.target.value),disabled:k("sati.model")}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("label",{className:"block text-sm font-medium text-azure-text-primary dark:text-matrix-secondary",children:"API Key"}),s.jsxs("div",{className:"flex items-center gap-2",children:[S("sati.api_key"),ve("sati",v.api_key)]})]}),s.jsx(w,{label:"",type:"password",value:v.api_key||"",onChange:l=>ie("api_key",l.target.value),placeholder:"sk-...",helperText:"Stored locally.",disabled:k("sati.api_key")}),v.provider==="openrouter"&&s.jsx(w,{label:"Base URL",value:v.base_url||"https://openrouter.ai/api/v1",onChange:l=>ie("base_url",l.target.value),placeholder:"https://openrouter.ai/api/v1",helperText:"Base URL for OpenRouter API"}),s.jsx(C,{label:"Memory Limit",value:v.memory_limit??10,onChange:l=>ie("memory_limit",parseInt(l.target.value)),min:1,step:1,helperText:"Number of memory items to retrieve from long-term storage."}),s.jsx(C,{label:"Evaluation Interval",value:v.evaluation_interval??1,onChange:l=>ie("evaluation_interval",parseInt(l.target.value)),min:1,step:1,helperText:"Oracle turns between memory evaluations. Default: 1 (every turn). *If Evaluation interval is more than context window, this value will be ignored."}),s.jsx(re,{label:"Enable Archived Sessions in Memory Retrieval",checked:v.enabled_archived_sessions??!0,onChange:l=>ie("enabled_archived_sessions",l)}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between mb-1",children:[s.jsx("label",{className:"block text-sm font-medium text-azure-text-primary dark:text-matrix-secondary",children:"Similarity Threshold"}),s.jsx("span",{className:"text-sm font-mono text-azure-text-primary dark:text-matrix-highlight",children:(v.similarity_threshold??.9).toFixed(2)})]}),s.jsx("input",{type:"range",min:0,max:1,step:.01,value:v.similarity_threshold??.9,onChange:l=>ie("similarity_threshold",parseFloat(l.target.value)),className:`w-full h-1.5 rounded-full appearance-none cursor-pointer
|
|
40
|
+
bg-gray-200 dark:bg-matrix-primary/30
|
|
41
|
+
accent-azure-primary dark:accent-matrix-highlight`}),s.jsx("p",{className:"mt-1.5 text-xs text-gray-400 dark:text-matrix-secondary",children:"Minimum cosine similarity to consider a memory relevant (0–1). Lower values retrieve more memories, but may increase token consumption."})]})]})]}),he==="neo"&&s.jsxs(F,{title:"Neo Agent",children:[s.jsx("p",{className:"text-sm text-azure-text-secondary dark:text-matrix-secondary mb-4",children:"MCP + internal tools subagent — executes analytical and operational tasks delegated by Oracle"}),s.jsxs("div",{className:"mb-4",children:[s.jsx("button",{type:"button",onClick:xr,className:"px-3 py-1.5 text-sm bg-azure-surface border border-azure-border rounded hover:bg-azure-primary/10 dark:bg-matrix-primary/20 dark:border-matrix-primary dark:hover:bg-matrix-highlight/10 text-azure-primary dark:text-matrix-highlight transition-colors",children:"Copy from Oracle Agent"}),s.jsx("p",{className:"text-xs text-azure-text-secondary dark:text-matrix-secondary mt-1",children:"Copy Provider, Model, and API Key from Oracle Agent configuration"})]}),N&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("label",{className:"block text-sm font-medium text-azure-text-primary dark:text-matrix-secondary",children:"Provider"}),S("neo.provider")]}),s.jsx(K,{label:"",value:N.provider,onChange:l=>oe("provider",l.target.value),options:Ce,disabled:k("neo.provider")}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("label",{className:"block text-sm font-medium text-azure-text-primary dark:text-matrix-secondary",children:"Model Name"}),S("neo.model")]}),s.jsx(w,{label:"",value:N.model,onChange:l=>oe("model",l.target.value),disabled:k("neo.model")}),s.jsx(w,{label:"Personality",value:N.personality||"analytical_engineer",onChange:l=>oe("personality",l.target.value),placeholder:"analytical_engineer",helperText:"e.g., analytical_engineer, meticulous_auditor, systems_thinker"}),s.jsx(K,{label:"Execution Mode",value:N.execution_mode||"async",onChange:l=>oe("execution_mode",l.target.value),options:[{value:"async",label:"Async (background task)"},{value:"sync",label:"Sync (inline response)"}]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("label",{className:"block text-sm font-medium text-azure-text-primary dark:text-matrix-secondary",children:"Temperature"}),S("neo.temperature")]}),s.jsx(C,{label:"",value:N.temperature,onChange:l=>oe("temperature",parseFloat(l.target.value)),step:.1,min:0,max:1,disabled:k("neo.temperature")}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("label",{className:"block text-sm font-medium text-azure-text-primary dark:text-matrix-secondary",children:"Max Tokens"}),S("neo.max_tokens")]}),s.jsx(C,{label:"",value:N.max_tokens??"",onChange:l=>oe("max_tokens",l.target.value?parseInt(l.target.value):void 0),min:1,helperText:"Maximum tokens per response. Leave empty for model default.",disabled:k("neo.max_tokens")}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("label",{className:"block text-sm font-medium text-azure-text-primary dark:text-matrix-secondary",children:"Context Window (Messages)"}),S("neo.context_window")]}),s.jsx(C,{label:"",value:N.context_window??100,onChange:l=>oe("context_window",parseInt(l.target.value)),min:1,step:1,disabled:k("neo.context_window")}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("label",{className:"block text-sm font-medium text-azure-text-primary dark:text-matrix-secondary",children:"API Key"}),s.jsxs("div",{className:"flex items-center gap-2",children:[S("neo.api_key"),ve("neo",N.api_key)]})]}),s.jsx(w,{label:"",type:"password",value:N.api_key||"",onChange:l=>oe("api_key",l.target.value),placeholder:"sk-...",helperText:"Stored locally.",disabled:k("neo.api_key")}),N.provider==="openrouter"&&s.jsx(w,{label:"Base URL",value:N.base_url||"https://openrouter.ai/api/v1",onChange:l=>oe("base_url",l.target.value),placeholder:"https://openrouter.ai/api/v1",helperText:"Base URL for OpenRouter API"})]})]}),he==="trinity"&&s.jsxs(F,{title:"Trinity Agent",children:[s.jsx("p",{className:"text-sm text-azure-text-secondary dark:text-matrix-secondary mb-4",children:"Database subagent — interprets natural language queries and executes them against registered databases (PostgreSQL, MySQL, SQLite, MongoDB)"}),s.jsxs("div",{className:"mb-4",children:[s.jsx("button",{type:"button",onClick:gr,className:"px-3 py-1.5 text-sm bg-azure-surface border border-azure-border rounded hover:bg-azure-primary/10 dark:bg-matrix-primary/20 dark:border-matrix-primary dark:hover:bg-matrix-highlight/10 text-azure-primary dark:text-matrix-highlight transition-colors",children:"Copy from Oracle Agent"}),s.jsx("p",{className:"text-xs text-azure-text-secondary dark:text-matrix-secondary mt-1",children:"Copy Provider, Model, and API Key from Oracle Agent configuration"})]}),y&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("label",{className:"block text-sm font-medium text-azure-text-primary dark:text-matrix-secondary",children:"Provider"}),S("trinity.provider")]}),s.jsx(K,{label:"",value:y.provider,onChange:l=>le("provider",l.target.value),options:Ce,disabled:k("trinity.provider")}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("label",{className:"block text-sm font-medium text-azure-text-primary dark:text-matrix-secondary",children:"Model Name"}),S("trinity.model")]}),s.jsx(w,{label:"",value:y.model,onChange:l=>le("model",l.target.value),disabled:k("trinity.model")}),s.jsx(w,{label:"Personality",value:y.personality||"data_specialist",onChange:l=>le("personality",l.target.value),placeholder:"data_specialist",helperText:"e.g., data_specialist, query_optimizer, db_architect"}),s.jsx(K,{label:"Execution Mode",value:y.execution_mode||"async",onChange:l=>le("execution_mode",l.target.value),options:[{value:"async",label:"Async (background task)"},{value:"sync",label:"Sync (inline response)"}]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("label",{className:"block text-sm font-medium text-azure-text-primary dark:text-matrix-secondary",children:"Temperature"}),S("trinity.temperature")]}),s.jsx(C,{label:"",value:y.temperature,onChange:l=>le("temperature",parseFloat(l.target.value)),step:.1,min:0,max:1,disabled:k("trinity.temperature")}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("label",{className:"block text-sm font-medium text-azure-text-primary dark:text-matrix-secondary",children:"Max Tokens"}),S("trinity.max_tokens")]}),s.jsx(C,{label:"",value:y.max_tokens??"",onChange:l=>le("max_tokens",l.target.value?parseInt(l.target.value):void 0),min:1,helperText:"Maximum tokens per response. Leave empty for model default.",disabled:k("trinity.max_tokens")}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("label",{className:"block text-sm font-medium text-azure-text-primary dark:text-matrix-secondary",children:"API Key"}),s.jsxs("div",{className:"flex items-center gap-2",children:[S("trinity.api_key"),ve("trinity",y.api_key)]})]}),s.jsx(w,{label:"",type:"password",value:y.api_key||"",onChange:l=>le("api_key",l.target.value),placeholder:"sk-...",helperText:"Stored locally.",disabled:k("trinity.api_key")}),y.provider==="openrouter"&&s.jsx(w,{label:"Base URL",value:y.base_url||"https://openrouter.ai/api/v1",onChange:l=>le("base_url",l.target.value),placeholder:"https://openrouter.ai/api/v1",helperText:"Base URL for OpenRouter API"})]})]}),he==="link"&&s.jsxs(F,{title:"Link Agent",children:[s.jsx("p",{className:"text-sm text-azure-text-secondary dark:text-matrix-secondary mb-4",children:"Documentation specialist — indexes documents from ~/.morpheus/docs, uses an LLM to reason over search results and synthesize intelligent answers"}),$&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"mb-4",children:s.jsx("button",{type:"button",onClick:yr,className:"px-3 py-1.5 text-sm bg-azure-surface border border-azure-border rounded hover:bg-azure-primary/10 dark:bg-matrix-primary/20 dark:border-matrix-primary dark:hover:bg-matrix-highlight/10 text-azure-primary dark:text-matrix-highlight transition-colors",children:"Copy from Oracle Agent"})}),s.jsx(K,{label:"Provider",value:$.provider||"openai",onChange:l=>G("provider",l.target.value),options:[{value:"openai",label:"OpenAI"},{value:"anthropic",label:"Anthropic"},{value:"openrouter",label:"OpenRouter"},{value:"ollama",label:"Ollama"},{value:"gemini",label:"Gemini"}]}),s.jsx(w,{label:"Model Name",value:$.model||"",onChange:l=>G("model",l.target.value),placeholder:"e.g., gpt-4"}),s.jsx(w,{label:"Personality",value:$.personality||"",onChange:l=>G("personality",l.target.value),placeholder:"documentation_specialist"}),s.jsx(K,{label:"Execution Mode",value:$.execution_mode||"async",onChange:l=>G("execution_mode",l.target.value),options:[{value:"async",label:"Async (background task)"},{value:"sync",label:"Sync (inline response)"}]}),s.jsx(C,{label:"Temperature",value:$.temperature??.2,onChange:l=>G("temperature",parseFloat(l.target.value)),step:.1,min:0,max:1}),s.jsx(w,{label:"API Key (optional — falls back to Oracle)",value:$.api_key||"",onChange:l=>G("api_key",l.target.value||void 0),type:"password",placeholder:"Leave empty to use Oracle's API key"}),s.jsx("h4",{className:"text-sm font-medium text-azure-text dark:text-matrix-highlight mt-6 mb-3",children:"RAG Settings"}),s.jsx(C,{label:"Chunk Size",value:$.chunk_size,onChange:l=>G("chunk_size",parseInt(l.target.value)||500),min:100,max:2e3,helperText:"Character count per document chunk (default: 500)"}),s.jsx(C,{label:"Score Threshold",value:$.score_threshold,onChange:l=>G("score_threshold",parseFloat(l.target.value)||.5),step:.1,min:0,max:1,helperText:"Minimum similarity score to include in results (0-1, default: 0.5)"}),s.jsx(C,{label:"Max Results",value:$.max_results,onChange:l=>G("max_results",parseInt(l.target.value)||10),min:1,max:50,helperText:"Maximum number of chunks to return per search (default: 10)"}),s.jsx(C,{label:"Scan Interval (ms)",value:$.scan_interval_ms,onChange:l=>G("scan_interval_ms",parseInt(l.target.value)||3e4),min:5e3,max:3e5,helperText:"How often to scan docs folder for changes (default: 30000ms = 30s)"}),s.jsx(C,{label:"Max File Size (MB)",value:$.max_file_size_mb,onChange:l=>G("max_file_size_mb",parseInt(l.target.value)||50),min:1,max:100,helperText:"Maximum file size to process (default: 50MB)"}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsx(C,{label:"Vector Weight",value:$.vector_weight,onChange:l=>G("vector_weight",parseFloat(l.target.value)||.8),step:.1,min:0,max:1,helperText:"Weight for vector similarity (default: 0.8)"}),s.jsx(C,{label:"BM25 Weight",value:$.bm25_weight,onChange:l=>G("bm25_weight",parseFloat(l.target.value)||.2),step:.1,min:0,max:1,helperText:"Weight for keyword matching (default: 0.2)"})]}),s.jsx("p",{className:"text-xs text-azure-text-secondary dark:text-matrix-secondary mt-2",children:"Note: Vector weight + BM25 weight should equal 1.0 for balanced results"})]})]}),he==="apoc"&&s.jsxs(F,{title:"Apoc Agent",children:[s.jsx("p",{className:"text-sm text-azure-text-secondary dark:text-matrix-secondary mb-4",children:"DevTools subagent — executes file, shell, git, network, and system operations on behalf of Oracle"}),s.jsxs("div",{className:"mb-4",children:[s.jsx("button",{type:"button",onClick:vr,className:"px-3 py-1.5 text-sm bg-azure-surface border border-azure-border rounded hover:bg-azure-primary/10 dark:bg-matrix-primary/20 dark:border-matrix-primary dark:hover:bg-matrix-highlight/10 text-azure-primary dark:text-matrix-highlight transition-colors",children:"Copy from Oracle Agent"}),s.jsx("p",{className:"text-xs text-azure-text-secondary dark:text-matrix-secondary mt-1",children:"Copy Provider, Model, and API Key from Oracle Agent configuration"})]}),T&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("label",{className:"block text-sm font-medium text-azure-text-primary dark:text-matrix-secondary",children:"Provider"}),S("apoc.provider")]}),s.jsx(K,{label:"",value:T.provider,onChange:l=>se("provider",l.target.value),options:Ce,disabled:k("apoc.provider")}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("label",{className:"block text-sm font-medium text-azure-text-primary dark:text-matrix-secondary",children:"Model Name"}),S("apoc.model")]}),s.jsx(w,{label:"",value:T.model,onChange:l=>se("model",l.target.value),disabled:k("apoc.model")}),s.jsx(w,{label:"Personality",value:T.personality||"pragmatic_dev",onChange:l=>se("personality",l.target.value),placeholder:"pragmatic_dev",helperText:"e.g., pragmatic_dev, cautious_admin, automation_specialist"}),s.jsx(K,{label:"Execution Mode",value:T.execution_mode||"async",onChange:l=>se("execution_mode",l.target.value),options:[{value:"async",label:"Async (background task)"},{value:"sync",label:"Sync (inline response)"}]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("label",{className:"block text-sm font-medium text-azure-text-primary dark:text-matrix-secondary",children:"Temperature"}),S("apoc.temperature")]}),s.jsx(C,{label:"",value:T.temperature,onChange:l=>se("temperature",parseFloat(l.target.value)),step:.1,min:0,max:1,disabled:k("apoc.temperature")}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("label",{className:"block text-sm font-medium text-azure-text-primary dark:text-matrix-secondary",children:"API Key"}),s.jsxs("div",{className:"flex items-center gap-2",children:[S("apoc.api_key"),ve("apoc",T.api_key)]})]}),s.jsx(w,{label:"",type:"password",value:T.api_key||"",onChange:l=>se("api_key",l.target.value),placeholder:"sk-...",helperText:"Stored locally.",disabled:k("apoc.api_key")}),T.provider==="openrouter"&&s.jsx(w,{label:"Base URL",value:T.base_url||"https://openrouter.ai/api/v1",onChange:l=>se("base_url",l.target.value),placeholder:"https://openrouter.ai/api/v1",helperText:"Base URL for OpenRouter API"}),s.jsx(C,{label:"Timeout (ms)",value:T.timeout_ms??3e4,onChange:l=>se("timeout_ms",parseInt(l.target.value)),min:1e3,step:1e3,helperText:"Maximum execution time for shell and system operations in milliseconds."})]})]})]}),X==="devkit"&&s.jsxs(s.Fragment,{children:[s.jsxs(F,{title:"DevKit Security",children:[s.jsx("p",{className:"text-sm text-azure-text-secondary dark:text-matrix-secondary mb-4",children:"Shared security configuration for DevKit tools used by Apoc. Controls path sandboxing, shell command restrictions, and tool category access."}),s.jsx(w,{label:"Sandbox Directory",value:u.devkit?.sandbox_dir||"",onChange:l=>_(["devkit","sandbox_dir"],l.target.value),placeholder:typeof window<"u"?"(defaults to process.cwd())":"",helperText:"Root directory for all DevKit operations. All file, shell, and git paths are confined here.",disabled:k("devkit.sandbox_dir")}),s.jsx(ct,{label:"Allowed Paths",value:u.devkit?.allowed_paths?.join(`
|
|
42
|
+
`)||"",onChange:l=>_(["devkit","allowed_paths"],l.target.value.split(`
|
|
43
|
+
`).map(z=>z.trim()).filter(Boolean)),placeholder:"~/.morpheus/docs",helperText:"Additional paths outside sandbox_dir that DevKit can access (one per line).",rows:4}),s.jsx(K,{label:"Read-Only Mode",value:u.devkit?.readonly_mode?"true":"false",onChange:l=>_(["devkit","readonly_mode"],l.target.value==="true"),options:[{value:"false",label:"Disabled (read + write)"},{value:"true",label:"Enabled (read-only, blocks writes/deletes)"}],helperText:"When enabled, blocks all write, delete, and create operations on the filesystem.",disabled:k("devkit.readonly_mode")}),s.jsx(C,{label:"Timeout (ms)",value:u.devkit?.timeout_ms??3e4,onChange:l=>_(["devkit","timeout_ms"],parseInt(l.target.value)),min:1e3,step:1e3,helperText:"Default timeout for shell and system operations in milliseconds.",disabled:k("devkit.timeout_ms")})]}),s.jsxs(F,{title:"Tool Categories",children:[s.jsx("p",{className:"text-sm text-azure-text-secondary dark:text-matrix-secondary mb-4",children:"Enable or disable entire categories of DevKit tools."}),s.jsx(re,{label:"Filesystem (read, write, list, copy, move, delete files)",checked:u.devkit?.enable_filesystem!==!1,onChange:l=>_(["devkit","enable_filesystem"],l)}),s.jsx(re,{label:"Shell (run_command, run_script, which)",checked:u.devkit?.enable_shell!==!1,onChange:l=>_(["devkit","enable_shell"],l)}),s.jsx(re,{label:"Git (status, diff, commit, push, pull, clone, branch)",checked:u.devkit?.enable_git!==!1,onChange:l=>_(["devkit","enable_git"],l)}),s.jsx(re,{label:"Network (http_request, ping, dns_lookup, download_file)",checked:u.devkit?.enable_network!==!1,onChange:l=>_(["devkit","enable_network"],l)})]}),s.jsxs(F,{title:"Shell Command Allowlist",children:[s.jsx("p",{className:"text-sm text-azure-text-secondary dark:text-matrix-secondary mb-4",children:"Restrict which shell commands Apoc can execute. Leave empty to allow all commands (default)."}),s.jsx(w,{label:"Allowed Commands",value:(u.devkit?.allowed_shell_commands||[]).join(", "),onChange:l=>_(["devkit","allowed_shell_commands"],l.target.value.split(",").map(z=>z.trim()).filter(Boolean)),placeholder:"e.g. node, npm, git, python, cargo",helperText:"Comma-separated list of allowed binary names. Empty = all commands allowed.",disabled:k("devkit.allowed_shell_commands")})]})]}),X==="audio"&&s.jsxs(F,{title:"Audio Transcription",children:[s.jsx(re,{label:"Enable Audio",checked:u.audio.enabled,onChange:l=>_(["audio","enabled"],l)}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("label",{className:"block text-sm font-medium text-azure-text-primary dark:text-matrix-secondary",children:"Provider"}),S("audio.provider")]}),s.jsx(K,{label:"",value:u.audio.provider||"google",onChange:l=>_(["audio","provider"],l.target.value),options:[{label:"Google Gemini",value:"google"},{label:"OpenAI (Whisper)",value:"openai"},{label:"OpenRouter (multimodal)",value:"openrouter"},{label:"Ollama (Whisper local)",value:"ollama"}],error:Q["audio.provider"],disabled:k("audio.provider")}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("label",{className:"block text-sm font-medium text-azure-text-primary dark:text-matrix-secondary",children:"Model"}),S("audio.model")]}),s.jsx(w,{label:"",value:u.audio.model,onChange:l=>_(["audio","model"],l.target.value),placeholder:"e.g. whisper-1, gemini-2.5-flash-lite...",helperText:"Model to use for audio transcription.",error:Q["audio.model"],disabled:k("audio.model")}),u.audio.provider==="ollama"&&s.jsx(w,{label:"Base URL",value:u.audio.base_url||"",onChange:l=>_(["audio","base_url"],l.target.value),placeholder:"http://localhost:11434",helperText:"Ollama base URL. Requires a Whisper model loaded (ollama pull whisper)."}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("label",{className:"block text-sm font-medium text-azure-text-primary dark:text-matrix-secondary",children:"API Key"}),s.jsxs("div",{className:"flex items-center gap-2",children:[S("audio.apiKey"),ve("audio",u.audio.apiKey)]})]}),s.jsx(w,{label:"",type:"password",value:u.audio.apiKey||"",onChange:l=>_(["audio","apiKey"],l.target.value),placeholder:"If different from LLM key...",helperText:"Leave empty to use LLM API key if using the same provider.",disabled:k("audio.apiKey")}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("label",{className:"block text-sm font-medium text-azure-text-primary dark:text-matrix-secondary",children:"Max Duration (Seconds)"}),S("audio.maxDurationSeconds")]}),s.jsx(C,{label:"",value:u.audio.maxDurationSeconds,onChange:l=>_(["audio","maxDurationSeconds"],parseInt(l.target.value)),min:1,disabled:k("audio.maxDurationSeconds")}),s.jsx(w,{label:"Supported Mime Types",value:u.audio.supportedMimeTypes.join(", "),onChange:l=>_(["audio","supportedMimeTypes"],l.target.value.split(",").map(z=>z.trim()).filter(Boolean)),helperText:"Comma separated list (e.g. audio/ogg, audio/mp3)"})]}),X==="channels"&&s.jsxs(s.Fragment,{children:[s.jsxs(F,{title:"Telegram",children:[s.jsx(re,{label:"Enable Telegram",checked:u.channels.telegram.enabled,onChange:l=>_(["channels","telegram","enabled"],l)}),u.channels.telegram.enabled&&s.jsxs("div",{className:"space-y-4 mt-4 pl-4 border-l border-matrix-primary",children:[s.jsx(w,{label:"Bot Token",type:"password",value:u.channels.telegram.token||"",onChange:l=>_(["channels","telegram","token"],l.target.value)}),s.jsx(w,{label:"Allowed Users (comma separated)",value:u.channels.telegram.allowedUsers.join(", "),onChange:l=>_(["channels","telegram","allowedUsers"],l.target.value.split(",").map(z=>z.trim()).filter(Boolean)),helperText:"User IDs allowed to interact with the bot"})]})]}),s.jsxs(F,{title:"Discord",children:[s.jsx(re,{label:"Enable Discord",checked:u.channels.discord.enabled,onChange:l=>_(["channels","discord","enabled"],l)}),u.channels.discord.enabled&&s.jsxs("div",{className:"space-y-4 mt-4 pl-4 border-l border-matrix-primary",children:[s.jsx(w,{label:"Bot Token",type:"password",value:u.channels.discord.token||"",onChange:l=>_(["channels","discord","token"],l.target.value)}),s.jsx(w,{label:"Allowed Users (comma separated)",value:(u.channels.discord.allowedUsers??[]).join(", "),onChange:l=>_(["channels","discord","allowedUsers"],l.target.value.split(",").map(z=>z.trim()).filter(Boolean)),helperText:"Discord user IDs allowed to interact with the bot"})]})]})]}),X==="ui"&&s.jsxs(F,{title:"Dashboard",children:[s.jsx(re,{label:"Enable Web UI",checked:u.ui.enabled,onChange:l=>_(["ui","enabled"],l)}),s.jsx(C,{label:"Port",value:u.ui.port,onChange:l=>_(["ui","port"],parseInt(l.target.value)),disabled:!0,helperText:"Port changes require daemon restart."})]}),X==="logging"&&s.jsxs(F,{title:"Logging",children:[s.jsx(re,{label:"Enable Logging",checked:u.logging.enabled,onChange:l=>_(["logging","enabled"],l)}),s.jsx(K,{label:"Log Level",value:u.logging.level,onChange:l=>_(["logging","level"],l.target.value),options:[{label:"Debug",value:"debug"},{label:"Info",value:"info"},{label:"Warning",value:"warn"},{label:"Error",value:"error"}]})]}),X==="chronos"&&f&&s.jsxs(F,{title:"Chronos — Temporal Intent Engine",children:[s.jsx(K,{label:"Timezone",value:f.timezone,onChange:l=>h({...f,timezone:l.target.value}),options:[{label:"UTC",value:"UTC"},{label:"America/New_York",value:"America/New_York"},{label:"America/Chicago",value:"America/Chicago"},{label:"America/Denver",value:"America/Denver"},{label:"America/Los_Angeles",value:"America/Los_Angeles"},{label:"America/Sao_Paulo",value:"America/Sao_Paulo"},{label:"America/Buenos_Aires",value:"America/Buenos_Aires"},{label:"America/Bogota",value:"America/Bogota"},{label:"America/Lima",value:"America/Lima"},{label:"America/Santiago",value:"America/Santiago"},{label:"America/Mexico_City",value:"America/Mexico_City"},{label:"America/Toronto",value:"America/Toronto"},{label:"America/Vancouver",value:"America/Vancouver"},{label:"Europe/London",value:"Europe/London"},{label:"Europe/Paris",value:"Europe/Paris"},{label:"Europe/Berlin",value:"Europe/Berlin"},{label:"Europe/Madrid",value:"Europe/Madrid"},{label:"Europe/Rome",value:"Europe/Rome"},{label:"Europe/Amsterdam",value:"Europe/Amsterdam"},{label:"Europe/Brussels",value:"Europe/Brussels"},{label:"Europe/Zurich",value:"Europe/Zurich"},{label:"Europe/Lisbon",value:"Europe/Lisbon"},{label:"Europe/Warsaw",value:"Europe/Warsaw"},{label:"Europe/Stockholm",value:"Europe/Stockholm"},{label:"Europe/Helsinki",value:"Europe/Helsinki"},{label:"Europe/Moscow",value:"Europe/Moscow"},{label:"Asia/Dubai",value:"Asia/Dubai"},{label:"Asia/Kolkata",value:"Asia/Kolkata"},{label:"Asia/Bangkok",value:"Asia/Bangkok"},{label:"Asia/Singapore",value:"Asia/Singapore"},{label:"Asia/Hong_Kong",value:"Asia/Hong_Kong"},{label:"Asia/Shanghai",value:"Asia/Shanghai"},{label:"Asia/Tokyo",value:"Asia/Tokyo"},{label:"Asia/Seoul",value:"Asia/Seoul"},{label:"Australia/Sydney",value:"Australia/Sydney"},{label:"Australia/Melbourne",value:"Australia/Melbourne"},{label:"Pacific/Auckland",value:"Pacific/Auckland"},{label:"Africa/Cairo",value:"Africa/Cairo"},{label:"Africa/Johannesburg",value:"Africa/Johannesburg"}]}),s.jsx(C,{label:"Check Interval (seconds)",value:Math.round(f.check_interval_ms/1e3),onChange:l=>h({...f,check_interval_ms:Number(l.target.value)*1e3}),min:60}),s.jsx(C,{label:"Max Active Jobs",value:f.max_active_jobs,onChange:l=>h({...f,max_active_jobs:Number(l.target.value)}),min:1,max:1e3})]}),X==="danger"&&s.jsx(As,{})]})]}):s.jsx("div",{className:"p-8 text-azure-primary dark:text-matrix-highlight",children:"Loading settings..."})}const xe=[{id:"sessions",label:"Sessions & Messages",description:"All chat sessions and their messages"},{id:"memories",label:"Long-term Memories",description:"Sati knowledge base, embeddings, and archived session chunks"},{id:"tasks",label:"Tasks",description:"Background task queue and execution results"},{id:"audit",label:"Audit Logs",description:"All agent and tool audit events"},{id:"chronos",label:"Chronos Jobs",description:"Scheduled jobs and their execution history"},{id:"webhooks",label:"Webhooks",description:"Webhook definitions and notification history"}];function As(){const[e,t]=E.useState(new Set),[r,n]=E.useState(!1),[o,i]=E.useState(!1),[a,c]=E.useState(null),d=u=>{t(b=>{const v=new Set(b);return v.has(u)?v.delete(u):v.add(u),v})},p=()=>{e.size===xe.length?t(new Set):t(new Set(xe.map(u=>u.id)))},f=async()=>{if(e.size!==0){i(!0),c(null);try{const u=await Cs.resetData([...e]);c({success:!0,message:u.message}),t(new Set),ue(()=>!0,void 0,{revalidate:!0})}catch(u){c({success:!1,message:u instanceof Error?u.message:"Failed to reset data"})}finally{i(!1)}}},h=xe.filter(u=>e.has(u.id)).map(u=>u.label);return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"rounded-lg border-2 border-red-300 dark:border-red-900 bg-red-50 dark:bg-red-950/20 p-6 space-y-5",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx($r,{className:"w-6 h-6 text-red-500 dark:text-red-400 shrink-0"}),s.jsx("h3",{className:"text-lg font-semibold text-red-700 dark:text-red-400",children:"Danger Zone"})]}),s.jsxs("p",{className:"text-sm text-red-600 dark:text-red-300/80",children:["Select the data you want to permanently delete. These actions are ",s.jsx("strong",{children:"irreversible"}),"."]}),s.jsxs("div",{className:"rounded-md border border-red-200 dark:border-red-900/60 bg-white dark:bg-black p-4 space-y-3",children:[s.jsxs("label",{className:"flex items-center gap-3 pb-2 border-b border-red-100 dark:border-red-900/40 cursor-pointer select-none",children:[s.jsx("input",{type:"checkbox",checked:e.size===xe.length,onChange:p,className:`w-4 h-4 rounded border-red-300 text-red-600 focus:ring-red-500
|
|
44
|
+
dark:border-red-800 dark:bg-black dark:checked:bg-red-600`}),s.jsx("span",{className:"text-sm font-medium text-red-700 dark:text-red-400",children:"Select all"})]}),xe.map(u=>s.jsxs("label",{className:"flex items-start gap-3 cursor-pointer select-none",children:[s.jsx("input",{type:"checkbox",checked:e.has(u.id),onChange:()=>d(u.id),className:`w-4 h-4 mt-0.5 rounded border-red-300 text-red-600 focus:ring-red-500
|
|
45
|
+
dark:border-red-800 dark:bg-black dark:checked:bg-red-600`}),s.jsxs("div",{children:[s.jsx("span",{className:"text-sm font-medium text-red-700 dark:text-red-300",children:u.label}),s.jsx("p",{className:"text-xs text-red-500 dark:text-red-300/60",children:u.description})]})]},u.id))]}),s.jsxs("div",{className:"flex items-center justify-between gap-4",children:[s.jsx("p",{className:"text-xs text-red-500 dark:text-red-300/50",children:e.size===0?"No categories selected":`${e.size} of ${xe.length} selected`}),s.jsx("button",{onClick:()=>n(!0),disabled:o||e.size===0,className:`shrink-0 px-4 py-2 text-sm font-medium rounded-md
|
|
46
|
+
bg-red-600 text-white hover:bg-red-700
|
|
47
|
+
dark:bg-red-900/50 dark:text-red-200 dark:hover:bg-red-800/60
|
|
48
|
+
disabled:opacity-50 disabled:cursor-not-allowed
|
|
49
|
+
transition-colors`,children:o?"Resetting...":"Reset selected data"})]}),a&&s.jsx("div",{className:`rounded-md p-3 text-sm ${a.success?"bg-green-50 text-green-700 dark:bg-green-950/30 dark:text-green-400 border border-green-200 dark:border-green-900":"bg-red-100 text-red-700 dark:bg-red-950/40 dark:text-red-300 border border-red-300 dark:border-red-800"}`,children:a.message})]}),s.jsx(Nr,{isOpen:r,onClose:()=>n(!1),onConfirm:f,title:"Reset selected data?",description:`This will permanently delete: ${h.join(", ")}. This action cannot be undone.`,confirmJson:"Yes, delete permanently",variant:"destructive"})]})}export{Us as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e,m as n}from"./vendor-motion-C3CZ8ZlO.js";import{r as s}from"./vendor-react-DikRIOlj.js";import{u as Z}from"./vendor-utils-D4NnWbOU.js";import{s as l}from"./skills-xMXangks.js";import{D as K,e as O,j as V}from"./index-DfJwcKqG.js";import{W as y,ak as u,Q as b,a2 as W,G as F,V as L,U as I,_ as q,a3 as A,a4 as B,X as G,al as H}from"./vendor-icons-NHF9HNeN.js";const U={hidden:{opacity:0},show:{opacity:1,transition:{staggerChildren:.05}}},g={hidden:{opacity:0,y:8},show:{opacity:1,y:0}};function M({skill:r,onToggle:i,onView:d}){return e.jsxs(n.div,{variants:g,className:`rounded-lg border flex flex-col transition-all ${r.enabled?"border-azure-primary/50 dark:border-matrix-primary bg-white dark:bg-zinc-900 shadow-sm":"border-azure-border dark:border-matrix-primary/30 bg-azure-surface/50 dark:bg-zinc-900 shadow-sm"}`,children:[e.jsxs("div",{className:"p-4 flex items-start gap-3 flex-1",children:[e.jsx("div",{className:`w-9 h-9 rounded-lg flex items-center justify-center shrink-0 ${r.enabled?"bg-azure-primary/10 dark:bg-matrix-highlight/10":"bg-azure-surface dark:bg-zinc-900"}`,children:e.jsx(y,{className:`w-4 h-4 ${r.enabled?"text-azure-primary dark:text-matrix-highlight":"text-azure-text-secondary dark:text-matrix-tertiary"}`})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h3",{className:`font-semibold truncate ${r.enabled?"text-azure-text dark:text-matrix-highlight":"text-azure-text-secondary dark:text-matrix-secondary"}`,children:r.name}),r.version&&e.jsxs("span",{className:"text-[10px] font-mono text-azure-text-secondary dark:text-matrix-tertiary bg-azure-surface dark:bg-zinc-900 border border-azure-border dark:border-matrix-primary/40 rounded px-1.5 py-0.5 shrink-0",children:["v",r.version]}),!r.enabled&&e.jsx("span",{className:"text-[10px] font-medium text-zinc-400 dark:text-zinc-500 bg-zinc-100 dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-700 rounded px-1.5 py-0.5 shrink-0",children:"disabled"})]}),e.jsx("p",{className:`text-sm mt-1.5 line-clamp-2 leading-relaxed ${r.enabled?"text-azure-text-secondary dark:text-matrix-secondary":"text-azure-text-secondary/70 dark:text-matrix-tertiary"}`,children:r.description}),r.tags&&r.tags.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5 mt-3",children:r.tags.map(t=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 text-[10px] font-medium rounded border border-azure-primary/20 dark:border-matrix-primary/40 bg-azure-primary/5 dark:bg-matrix-primary/10 text-azure-primary dark:text-matrix-secondary",children:[e.jsx(L,{className:"w-2.5 h-2.5"}),t]},t))})]})]}),e.jsxs("div",{className:"px-4 py-3 border-t border-azure-border dark:border-matrix-primary/30 flex items-center justify-between gap-2",children:[r.author?e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-azure-text-secondary dark:text-matrix-tertiary min-w-0",children:[e.jsx(I,{className:"w-3 h-3 shrink-0"}),e.jsx("span",{className:"truncate",children:r.author})]}):e.jsx("div",{}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[e.jsx("button",{onClick:d,className:"p-1.5 rounded border border-azure-border dark:border-matrix-primary/50 text-azure-text-secondary dark:text-matrix-tertiary hover:text-azure-primary dark:hover:text-matrix-highlight hover:border-azure-primary dark:hover:border-matrix-highlight transition-colors",title:"View details",children:e.jsx(q,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:i,className:`p-1.5 rounded border transition-colors ${r.enabled?"border-emerald-300 dark:border-emerald-700/60 text-emerald-500 dark:text-emerald-400 hover:bg-emerald-50 dark:hover:bg-emerald-900/20":"border-azure-border dark:border-matrix-primary/40 text-zinc-400 dark:text-zinc-600 hover:text-azure-text dark:hover:text-matrix-secondary hover:border-azure-border dark:hover:border-matrix-primary"}`,title:r.enabled?"Disable skill":"Enable skill",children:r.enabled?e.jsx(A,{className:"w-4 h-4"}):e.jsx(B,{className:"w-4 h-4"})})]})]})]})}function Q({skill:r,open:i,onOpenChange:d}){return!i||!r?null:e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm",onClick:()=>d(!1)}),e.jsxs("div",{className:"relative bg-white dark:bg-black border border-azure-border dark:border-matrix-primary rounded-lg shadow-xl w-full max-w-2xl max-h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 px-5 py-4 border-b border-azure-border dark:border-matrix-primary shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("div",{className:"w-9 h-9 rounded-lg bg-azure-primary/10 dark:bg-matrix-highlight/10 flex items-center justify-center shrink-0",children:e.jsx(y,{className:"w-4 h-4 text-azure-primary dark:text-matrix-highlight"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h2",{className:"text-base font-semibold text-azure-text dark:text-matrix-highlight truncate",children:r.name}),r.version&&e.jsxs("span",{className:"text-[10px] font-mono text-azure-text-secondary dark:text-matrix-tertiary bg-azure-surface dark:bg-zinc-900 border border-azure-border dark:border-matrix-primary/40 rounded px-1.5 py-0.5 shrink-0",children:["v",r.version]})]}),r.author&&e.jsxs("div",{className:"flex items-center gap-1 mt-0.5 text-xs text-azure-text-secondary dark:text-matrix-tertiary",children:[e.jsx(I,{className:"w-3 h-3 shrink-0"}),r.author]})]})]}),e.jsx("button",{onClick:()=>d(!1),className:"p-1.5 rounded text-azure-text-secondary dark:text-matrix-tertiary hover:text-azure-text dark:hover:text-matrix-highlight hover:bg-azure-surface dark:hover:bg-zinc-900 transition-colors shrink-0",children:e.jsx(G,{className:"w-4 h-4"})})]}),e.jsxs("div",{className:"overflow-y-auto flex-1 p-5 space-y-5",children:[r.description&&e.jsx("p",{className:"text-sm text-azure-text-secondary dark:text-matrix-secondary leading-relaxed",children:r.description}),e.jsx("div",{className:"flex flex-col gap-2",children:e.jsxs("div",{className:"flex items-start gap-2 text-xs text-azure-text-secondary dark:text-matrix-tertiary",children:[e.jsx(H,{className:"w-3.5 h-3.5 shrink-0 mt-0.5"}),e.jsx("span",{className:"break-all font-mono text-azure-text dark:text-matrix-secondary bg-azure-surface dark:bg-zinc-900 border border-azure-border dark:border-matrix-primary/40 rounded px-2 py-0.5",children:r.path})]})}),r.tags&&r.tags.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-azure-text-secondary dark:text-matrix-tertiary mb-2",children:"Tags"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:r.tags.map(t=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 text-[10px] font-medium rounded border border-azure-primary/20 dark:border-matrix-primary/40 bg-azure-primary/5 dark:bg-matrix-primary/10 text-azure-primary dark:text-matrix-secondary",children:[e.jsx(L,{className:"w-2.5 h-2.5"}),t]},t))})]}),r.examples&&r.examples.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-azure-text-secondary dark:text-matrix-tertiary mb-2",children:"Examples"}),e.jsx("ul",{className:"space-y-1.5",children:r.examples.map((t,x)=>e.jsxs("li",{className:"flex items-start gap-2 text-sm text-azure-text-secondary dark:text-matrix-secondary bg-azure-surface dark:bg-zinc-900 border border-azure-border dark:border-matrix-primary/30 rounded px-3 py-2",children:[e.jsxs("span",{className:"text-azure-text-secondary dark:text-matrix-tertiary font-mono text-xs mt-0.5 shrink-0",children:[x+1,"."]}),t]},x))})]}),r.content&&e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-azure-text-secondary dark:text-matrix-tertiary mb-2",children:"SKILL.md"}),e.jsx("pre",{className:"rounded-lg bg-azure-surface dark:bg-zinc-900 border border-azure-border dark:border-matrix-primary/40 p-4 text-xs text-azure-text-secondary dark:text-matrix-secondary overflow-auto max-h-72 whitespace-pre-wrap leading-relaxed font-mono",children:r.content})]})]})]})]})}function ae(){const[r,i]=s.useState(null),[d,t]=s.useState(!1),[x,N]=s.useState(!1),[o,v]=s.useState(!1),[c,k]=s.useState(null),[w,f]=s.useState(null),j=s.useRef(null),{data:S,mutate:z,isLoading:D}=Z("/skills",()=>l.fetchSkills(),{refreshInterval:1e4}),m=S?.skills??[],E=S?.enabled??0,R=async()=>{await l.reloadSkills(),z()},T=async a=>{a.enabled?await l.disableSkill(a.name):await l.enableSkill(a.name),z()},$=async a=>{t(!0);try{const p=await l.fetchSkill(a.name);i(p)}finally{t(!1)}},P=async a=>{const p=a.target.files?.[0];if(p){k(null),f(null),v(!0);try{const h=await l.uploadSkill(p);f(`Skill "${h.skill.name}" uploaded successfully!`),z(),j.current&&(j.current.value="")}catch(h){k({error:h.message||"Upload failed",details:h.details})}finally{v(!1)}}},C=()=>{k(null),f(null),N(!0)};return e.jsxs(n.div,{variants:U,initial:"hidden",animate:"show",className:"space-y-6",children:[e.jsxs(n.div,{variants:g,className:"flex items-center justify-between flex-wrap gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-azure-primary/10 dark:bg-matrix-highlight/10 border border-azure-primary/20 dark:border-matrix-highlight/30 flex items-center justify-center",children:e.jsx(y,{className:"w-5 h-5 text-azure-primary dark:text-matrix-highlight"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold text-azure-text dark:text-matrix-highlight",children:"Skills"}),e.jsxs("p",{className:"text-sm text-azure-text-secondary dark:text-matrix-tertiary",children:[m.length," skill",m.length!==1?"s":"",", ",E," enabled"]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:C,className:"flex items-center gap-2 px-4 py-2 rounded-lg border border-azure-primary dark:border-matrix-primary text-azure-primary dark:text-matrix-primary font-medium hover:bg-azure-primary/10 dark:hover:bg-matrix-primary/10 transition-colors",children:[e.jsx(u,{className:"w-4 h-4"}),"Upload"]}),e.jsxs("button",{onClick:R,className:"flex items-center gap-2 px-4 py-2 rounded-lg bg-azure-primary dark:bg-matrix-primary text-white dark:text-black font-medium hover:opacity-90 transition-opacity",children:[e.jsx(b,{className:"w-4 h-4"}),"Reload"]})]})]}),D?e.jsxs(n.div,{variants:g,className:"text-center py-12",children:[e.jsx(b,{className:"w-8 h-8 animate-spin mx-auto text-azure-text-secondary dark:text-matrix-dim"}),e.jsx("p",{className:"mt-2 text-azure-text-secondary dark:text-matrix-dim",children:"Loading skills..."})]}):m.length===0?e.jsxs(n.div,{variants:g,className:"rounded-lg border border-dashed border-azure-border dark:border-matrix-primary p-8 text-center",children:[e.jsx(y,{className:"w-12 h-12 mx-auto text-azure-text-tertiary dark:text-matrix-dim"}),e.jsx("h3",{className:"mt-4 text-lg font-medium text-azure-text-primary dark:text-matrix-highlight",children:"No skills found"}),e.jsxs("p",{className:"mt-2 text-azure-text-secondary dark:text-matrix-secondary max-w-md mx-auto",children:["Upload a skill ZIP or add skills manually to"," ",e.jsx("code",{className:"bg-azure-hover dark:bg-zinc-800 px-1 rounded",children:"~/.morpheus/skills/"}),". Each skill folder must contain a"," ",e.jsx("code",{className:"bg-azure-hover dark:bg-zinc-800 px-1 rounded",children:"SKILL.md"})," file with frontmatter."]}),e.jsxs("button",{onClick:C,className:"mt-4 inline-flex items-center gap-2 px-4 py-2 rounded-lg bg-azure-primary dark:bg-matrix-primary text-white dark:text-black font-medium hover:opacity-90 transition-opacity",children:[e.jsx(u,{className:"w-4 h-4"}),"Upload Skill"]})]}):e.jsx(n.div,{variants:U,initial:"hidden",animate:"show",className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:m.map(a=>e.jsx(M,{skill:a,onToggle:()=>T(a),onView:()=>$(a)},a.name))}),e.jsx(Q,{skill:r,open:!!r,onOpenChange:a=>!a&&i(null)}),e.jsxs(K,{open:x,onOpenChange:N,children:[e.jsx(O,{children:e.jsx(V,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(u,{className:"w-5 h-5"}),"Upload Skill"]})})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("p",{className:"text-azure-text-secondary dark:text-matrix-secondary text-sm",children:["Upload a ZIP file containing your skill folder. The ZIP must have exactly one folder at root level with a valid ",e.jsx("code",{className:"bg-azure-hover dark:bg-zinc-800 px-1 rounded",children:"SKILL.md"})," file."]}),e.jsxs("div",{className:"border-2 border-dashed border-azure-border dark:border-matrix-primary rounded-lg p-6",children:[e.jsx("input",{ref:j,type:"file",accept:".zip,application/zip,application/x-zip-compressed",onChange:P,disabled:o,className:"hidden",id:"skill-upload-input"}),e.jsxs("label",{htmlFor:"skill-upload-input",className:`flex flex-col items-center gap-2 cursor-pointer ${o?"opacity-50 cursor-not-allowed":""}`,children:[o?e.jsx(b,{className:"w-8 h-8 animate-spin text-azure-primary dark:text-matrix-primary"}):e.jsx(u,{className:"w-8 h-8 text-azure-text-tertiary dark:text-matrix-dim"}),e.jsx("span",{className:"text-azure-text-secondary dark:text-matrix-secondary",children:o?"Uploading...":"Click to select ZIP file"})]})]}),c&&e.jsxs("div",{className:"flex items-start gap-2 p-3 rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800",children:[e.jsx(W,{className:"w-5 h-5 text-red-600 dark:text-red-400 flex-shrink-0 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-red-800 dark:text-red-200",children:c.error}),c.details&&e.jsx("p",{className:"text-xs text-red-600 dark:text-red-300 mt-1",children:c.details})]})]}),w&&e.jsxs("div",{className:"flex items-center gap-2 p-3 rounded-lg bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800",children:[e.jsx(F,{className:"w-5 h-5 text-green-600 dark:text-green-400"}),e.jsx("p",{className:"text-sm text-green-800 dark:text-green-200",children:w})]}),e.jsxs("div",{className:"rounded-lg bg-azure-hover dark:bg-zinc-900 p-3",children:[e.jsx("h4",{className:"text-sm font-medium text-azure-text-primary dark:text-matrix-highlight mb-2",children:"ZIP Structure Example"}),e.jsx("pre",{className:"text-xs text-azure-text-secondary dark:text-matrix-secondary",children:`my-skill.zip
|
|
1
|
+
import{j as e,m as n}from"./vendor-motion-C3CZ8ZlO.js";import{r as s}from"./vendor-react-DikRIOlj.js";import{u as Z}from"./vendor-utils-D4NnWbOU.js";import{s as l}from"./skills-D2stQj7i.js";import{D as K,e as O,j as V}from"./index-BiMscUrn.js";import{W as y,ak as u,Q as b,a2 as W,G as F,V as L,U as I,_ as q,a3 as A,a4 as B,X as G,al as H}from"./vendor-icons-NHF9HNeN.js";const U={hidden:{opacity:0},show:{opacity:1,transition:{staggerChildren:.05}}},g={hidden:{opacity:0,y:8},show:{opacity:1,y:0}};function M({skill:r,onToggle:i,onView:d}){return e.jsxs(n.div,{variants:g,className:`rounded-lg border flex flex-col transition-all ${r.enabled?"border-azure-primary/50 dark:border-matrix-primary bg-white dark:bg-zinc-900 shadow-sm":"border-azure-border dark:border-matrix-primary/30 bg-azure-surface/50 dark:bg-zinc-900 shadow-sm"}`,children:[e.jsxs("div",{className:"p-4 flex items-start gap-3 flex-1",children:[e.jsx("div",{className:`w-9 h-9 rounded-lg flex items-center justify-center shrink-0 ${r.enabled?"bg-azure-primary/10 dark:bg-matrix-highlight/10":"bg-azure-surface dark:bg-zinc-900"}`,children:e.jsx(y,{className:`w-4 h-4 ${r.enabled?"text-azure-primary dark:text-matrix-highlight":"text-azure-text-secondary dark:text-matrix-tertiary"}`})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h3",{className:`font-semibold truncate ${r.enabled?"text-azure-text dark:text-matrix-highlight":"text-azure-text-secondary dark:text-matrix-secondary"}`,children:r.name}),r.version&&e.jsxs("span",{className:"text-[10px] font-mono text-azure-text-secondary dark:text-matrix-tertiary bg-azure-surface dark:bg-zinc-900 border border-azure-border dark:border-matrix-primary/40 rounded px-1.5 py-0.5 shrink-0",children:["v",r.version]}),!r.enabled&&e.jsx("span",{className:"text-[10px] font-medium text-zinc-400 dark:text-zinc-500 bg-zinc-100 dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-700 rounded px-1.5 py-0.5 shrink-0",children:"disabled"})]}),e.jsx("p",{className:`text-sm mt-1.5 line-clamp-2 leading-relaxed ${r.enabled?"text-azure-text-secondary dark:text-matrix-secondary":"text-azure-text-secondary/70 dark:text-matrix-tertiary"}`,children:r.description}),r.tags&&r.tags.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5 mt-3",children:r.tags.map(t=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 text-[10px] font-medium rounded border border-azure-primary/20 dark:border-matrix-primary/40 bg-azure-primary/5 dark:bg-matrix-primary/10 text-azure-primary dark:text-matrix-secondary",children:[e.jsx(L,{className:"w-2.5 h-2.5"}),t]},t))})]})]}),e.jsxs("div",{className:"px-4 py-3 border-t border-azure-border dark:border-matrix-primary/30 flex items-center justify-between gap-2",children:[r.author?e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-azure-text-secondary dark:text-matrix-tertiary min-w-0",children:[e.jsx(I,{className:"w-3 h-3 shrink-0"}),e.jsx("span",{className:"truncate",children:r.author})]}):e.jsx("div",{}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[e.jsx("button",{onClick:d,className:"p-1.5 rounded border border-azure-border dark:border-matrix-primary/50 text-azure-text-secondary dark:text-matrix-tertiary hover:text-azure-primary dark:hover:text-matrix-highlight hover:border-azure-primary dark:hover:border-matrix-highlight transition-colors",title:"View details",children:e.jsx(q,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:i,className:`p-1.5 rounded border transition-colors ${r.enabled?"border-emerald-300 dark:border-emerald-700/60 text-emerald-500 dark:text-emerald-400 hover:bg-emerald-50 dark:hover:bg-emerald-900/20":"border-azure-border dark:border-matrix-primary/40 text-zinc-400 dark:text-zinc-600 hover:text-azure-text dark:hover:text-matrix-secondary hover:border-azure-border dark:hover:border-matrix-primary"}`,title:r.enabled?"Disable skill":"Enable skill",children:r.enabled?e.jsx(A,{className:"w-4 h-4"}):e.jsx(B,{className:"w-4 h-4"})})]})]})]})}function Q({skill:r,open:i,onOpenChange:d}){return!i||!r?null:e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm",onClick:()=>d(!1)}),e.jsxs("div",{className:"relative bg-white dark:bg-black border border-azure-border dark:border-matrix-primary rounded-lg shadow-xl w-full max-w-2xl max-h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 px-5 py-4 border-b border-azure-border dark:border-matrix-primary shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("div",{className:"w-9 h-9 rounded-lg bg-azure-primary/10 dark:bg-matrix-highlight/10 flex items-center justify-center shrink-0",children:e.jsx(y,{className:"w-4 h-4 text-azure-primary dark:text-matrix-highlight"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h2",{className:"text-base font-semibold text-azure-text dark:text-matrix-highlight truncate",children:r.name}),r.version&&e.jsxs("span",{className:"text-[10px] font-mono text-azure-text-secondary dark:text-matrix-tertiary bg-azure-surface dark:bg-zinc-900 border border-azure-border dark:border-matrix-primary/40 rounded px-1.5 py-0.5 shrink-0",children:["v",r.version]})]}),r.author&&e.jsxs("div",{className:"flex items-center gap-1 mt-0.5 text-xs text-azure-text-secondary dark:text-matrix-tertiary",children:[e.jsx(I,{className:"w-3 h-3 shrink-0"}),r.author]})]})]}),e.jsx("button",{onClick:()=>d(!1),className:"p-1.5 rounded text-azure-text-secondary dark:text-matrix-tertiary hover:text-azure-text dark:hover:text-matrix-highlight hover:bg-azure-surface dark:hover:bg-zinc-900 transition-colors shrink-0",children:e.jsx(G,{className:"w-4 h-4"})})]}),e.jsxs("div",{className:"overflow-y-auto flex-1 p-5 space-y-5",children:[r.description&&e.jsx("p",{className:"text-sm text-azure-text-secondary dark:text-matrix-secondary leading-relaxed",children:r.description}),e.jsx("div",{className:"flex flex-col gap-2",children:e.jsxs("div",{className:"flex items-start gap-2 text-xs text-azure-text-secondary dark:text-matrix-tertiary",children:[e.jsx(H,{className:"w-3.5 h-3.5 shrink-0 mt-0.5"}),e.jsx("span",{className:"break-all font-mono text-azure-text dark:text-matrix-secondary bg-azure-surface dark:bg-zinc-900 border border-azure-border dark:border-matrix-primary/40 rounded px-2 py-0.5",children:r.path})]})}),r.tags&&r.tags.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-azure-text-secondary dark:text-matrix-tertiary mb-2",children:"Tags"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:r.tags.map(t=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 text-[10px] font-medium rounded border border-azure-primary/20 dark:border-matrix-primary/40 bg-azure-primary/5 dark:bg-matrix-primary/10 text-azure-primary dark:text-matrix-secondary",children:[e.jsx(L,{className:"w-2.5 h-2.5"}),t]},t))})]}),r.examples&&r.examples.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-azure-text-secondary dark:text-matrix-tertiary mb-2",children:"Examples"}),e.jsx("ul",{className:"space-y-1.5",children:r.examples.map((t,x)=>e.jsxs("li",{className:"flex items-start gap-2 text-sm text-azure-text-secondary dark:text-matrix-secondary bg-azure-surface dark:bg-zinc-900 border border-azure-border dark:border-matrix-primary/30 rounded px-3 py-2",children:[e.jsxs("span",{className:"text-azure-text-secondary dark:text-matrix-tertiary font-mono text-xs mt-0.5 shrink-0",children:[x+1,"."]}),t]},x))})]}),r.content&&e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-azure-text-secondary dark:text-matrix-tertiary mb-2",children:"SKILL.md"}),e.jsx("pre",{className:"rounded-lg bg-azure-surface dark:bg-zinc-900 border border-azure-border dark:border-matrix-primary/40 p-4 text-xs text-azure-text-secondary dark:text-matrix-secondary overflow-auto max-h-72 whitespace-pre-wrap leading-relaxed font-mono",children:r.content})]})]})]})]})}function ae(){const[r,i]=s.useState(null),[d,t]=s.useState(!1),[x,N]=s.useState(!1),[o,v]=s.useState(!1),[c,k]=s.useState(null),[w,f]=s.useState(null),j=s.useRef(null),{data:S,mutate:z,isLoading:D}=Z("/skills",()=>l.fetchSkills(),{refreshInterval:1e4}),m=S?.skills??[],E=S?.enabled??0,R=async()=>{await l.reloadSkills(),z()},T=async a=>{a.enabled?await l.disableSkill(a.name):await l.enableSkill(a.name),z()},$=async a=>{t(!0);try{const p=await l.fetchSkill(a.name);i(p)}finally{t(!1)}},P=async a=>{const p=a.target.files?.[0];if(p){k(null),f(null),v(!0);try{const h=await l.uploadSkill(p);f(`Skill "${h.skill.name}" uploaded successfully!`),z(),j.current&&(j.current.value="")}catch(h){k({error:h.message||"Upload failed",details:h.details})}finally{v(!1)}}},C=()=>{k(null),f(null),N(!0)};return e.jsxs(n.div,{variants:U,initial:"hidden",animate:"show",className:"space-y-6",children:[e.jsxs(n.div,{variants:g,className:"flex items-center justify-between flex-wrap gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-azure-primary/10 dark:bg-matrix-highlight/10 border border-azure-primary/20 dark:border-matrix-highlight/30 flex items-center justify-center",children:e.jsx(y,{className:"w-5 h-5 text-azure-primary dark:text-matrix-highlight"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold text-azure-text dark:text-matrix-highlight",children:"Skills"}),e.jsxs("p",{className:"text-sm text-azure-text-secondary dark:text-matrix-tertiary",children:[m.length," skill",m.length!==1?"s":"",", ",E," enabled"]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:C,className:"flex items-center gap-2 px-4 py-2 rounded-lg border border-azure-primary dark:border-matrix-primary text-azure-primary dark:text-matrix-primary font-medium hover:bg-azure-primary/10 dark:hover:bg-matrix-primary/10 transition-colors",children:[e.jsx(u,{className:"w-4 h-4"}),"Upload"]}),e.jsxs("button",{onClick:R,className:"flex items-center gap-2 px-4 py-2 rounded-lg bg-azure-primary dark:bg-matrix-primary text-white dark:text-black font-medium hover:opacity-90 transition-opacity",children:[e.jsx(b,{className:"w-4 h-4"}),"Reload"]})]})]}),D?e.jsxs(n.div,{variants:g,className:"text-center py-12",children:[e.jsx(b,{className:"w-8 h-8 animate-spin mx-auto text-azure-text-secondary dark:text-matrix-dim"}),e.jsx("p",{className:"mt-2 text-azure-text-secondary dark:text-matrix-dim",children:"Loading skills..."})]}):m.length===0?e.jsxs(n.div,{variants:g,className:"rounded-lg border border-dashed border-azure-border dark:border-matrix-primary p-8 text-center",children:[e.jsx(y,{className:"w-12 h-12 mx-auto text-azure-text-tertiary dark:text-matrix-dim"}),e.jsx("h3",{className:"mt-4 text-lg font-medium text-azure-text-primary dark:text-matrix-highlight",children:"No skills found"}),e.jsxs("p",{className:"mt-2 text-azure-text-secondary dark:text-matrix-secondary max-w-md mx-auto",children:["Upload a skill ZIP or add skills manually to"," ",e.jsx("code",{className:"bg-azure-hover dark:bg-zinc-800 px-1 rounded",children:"~/.morpheus/skills/"}),". Each skill folder must contain a"," ",e.jsx("code",{className:"bg-azure-hover dark:bg-zinc-800 px-1 rounded",children:"SKILL.md"})," file with frontmatter."]}),e.jsxs("button",{onClick:C,className:"mt-4 inline-flex items-center gap-2 px-4 py-2 rounded-lg bg-azure-primary dark:bg-matrix-primary text-white dark:text-black font-medium hover:opacity-90 transition-opacity",children:[e.jsx(u,{className:"w-4 h-4"}),"Upload Skill"]})]}):e.jsx(n.div,{variants:U,initial:"hidden",animate:"show",className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:m.map(a=>e.jsx(M,{skill:a,onToggle:()=>T(a),onView:()=>$(a)},a.name))}),e.jsx(Q,{skill:r,open:!!r,onOpenChange:a=>!a&&i(null)}),e.jsxs(K,{open:x,onOpenChange:N,children:[e.jsx(O,{children:e.jsx(V,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(u,{className:"w-5 h-5"}),"Upload Skill"]})})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("p",{className:"text-azure-text-secondary dark:text-matrix-secondary text-sm",children:["Upload a ZIP file containing your skill folder. The ZIP must have exactly one folder at root level with a valid ",e.jsx("code",{className:"bg-azure-hover dark:bg-zinc-800 px-1 rounded",children:"SKILL.md"})," file."]}),e.jsxs("div",{className:"border-2 border-dashed border-azure-border dark:border-matrix-primary rounded-lg p-6",children:[e.jsx("input",{ref:j,type:"file",accept:".zip,application/zip,application/x-zip-compressed",onChange:P,disabled:o,className:"hidden",id:"skill-upload-input"}),e.jsxs("label",{htmlFor:"skill-upload-input",className:`flex flex-col items-center gap-2 cursor-pointer ${o?"opacity-50 cursor-not-allowed":""}`,children:[o?e.jsx(b,{className:"w-8 h-8 animate-spin text-azure-primary dark:text-matrix-primary"}):e.jsx(u,{className:"w-8 h-8 text-azure-text-tertiary dark:text-matrix-dim"}),e.jsx("span",{className:"text-azure-text-secondary dark:text-matrix-secondary",children:o?"Uploading...":"Click to select ZIP file"})]})]}),c&&e.jsxs("div",{className:"flex items-start gap-2 p-3 rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800",children:[e.jsx(W,{className:"w-5 h-5 text-red-600 dark:text-red-400 flex-shrink-0 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-red-800 dark:text-red-200",children:c.error}),c.details&&e.jsx("p",{className:"text-xs text-red-600 dark:text-red-300 mt-1",children:c.details})]})]}),w&&e.jsxs("div",{className:"flex items-center gap-2 p-3 rounded-lg bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800",children:[e.jsx(F,{className:"w-5 h-5 text-green-600 dark:text-green-400"}),e.jsx("p",{className:"text-sm text-green-800 dark:text-green-200",children:w})]}),e.jsxs("div",{className:"rounded-lg bg-azure-hover dark:bg-zinc-900 p-3",children:[e.jsx("h4",{className:"text-sm font-medium text-azure-text-primary dark:text-matrix-highlight mb-2",children:"ZIP Structure Example"}),e.jsx("pre",{className:"text-xs text-azure-text-secondary dark:text-matrix-secondary",children:`my-skill.zip
|
|
2
2
|
└── my-skill/
|
|
3
3
|
├── SKILL.md (required)
|
|
4
4
|
├── scripts/ (optional)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./vendor-motion-C3CZ8ZlO.js";import{r as c}from"./vendor-react-DikRIOlj.js";import{u as O}from"./vendor-utils-D4NnWbOU.js";import{c as b,S as Y,N as w}from"./config-B-YxlVrc.js";import{S as V,T as C}from"./SelectInput-KVLsnfra.js";import{C as Z}from"./ConfirmationModal-Dd5pUJme.js";import{h as ee,a2 as $,H as _,Q as te,am as H,a6 as I,ac as re,an as q,ad as ae,ao as se,ap as ie,aq as ne,w as le,z as de,l as oe,ar as ce,g as me,ae as xe,I as he,X as ue}from"./vendor-icons-NHF9HNeN.js";import"./index-DfJwcKqG.js";const ge={name:"",host:"",port:7900,auth_token:"",tls:!1};function be(t){const n=Math.floor(t/86400),i=Math.floor(t%86400/3600),o=Math.floor(t%3600/60);return n>0?`${n}d ${i}h`:i>0?`${i}h ${o}m`:`${o}m`}function pe(t,n){const i=t>=1024?`${(t/1024).toFixed(1)}GB`:`${Math.round(t)}MB`,o=n>=1024?`${(n/1024).toFixed(1)}GB`:`${Math.round(n)}MB`;return`${i} / ${o}`}function fe({state:t}){return t==="online"?e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs font-medium text-emerald-500 bg-emerald-500/10 border border-emerald-500/30 rounded-full px-2 py-0.5",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-500 animate-pulse"}),"online"]}):t==="connecting"?e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs font-medium text-amber-500 bg-amber-500/10 border border-amber-500/30 rounded-full px-2 py-0.5",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-500 animate-pulse"}),"connecting"]}):t==="error"?e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs font-medium text-red-500 bg-red-500/10 border border-red-500/30 rounded-full px-2 py-0.5",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-red-500"}),"error"]}):e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs font-medium text-zinc-500 bg-zinc-500/10 border border-zinc-500/30 rounded-full px-2 py-0.5",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-zinc-500"}),"offline"]})}function je({cap:t}){const i={filesystem:"text-blue-400 bg-blue-400/10 border-blue-400/30",shell:"text-yellow-400 bg-yellow-400/10 border-yellow-400/30",git:"text-orange-400 bg-orange-400/10 border-orange-400/30",browser:"text-purple-400 bg-purple-400/10 border-purple-400/30",network:"text-cyan-400 bg-cyan-400/10 border-cyan-400/30",packages:"text-green-400 bg-green-400/10 border-green-400/30",processes:"text-pink-400 bg-pink-400/10 border-pink-400/30",system:"text-indigo-400 bg-indigo-400/10 border-indigo-400/30"}[t]??"text-zinc-400 bg-zinc-400/10 border-zinc-400/30";return e.jsx("span",{className:`text-[10px] font-medium border rounded px-1.5 py-0.5 ${i}`,children:t})}function ye({status:t,entry:n,onPing:i,onEdit:o,onDelete:a}){const[l,h]=c.useState(!1),s=t.state==="online";return e.jsxs("div",{className:`rounded-lg border bg-white dark:bg-zinc-900 shadow-sm transition-all ${s?"border-emerald-500/40 dark:border-emerald-500/30":t.state==="error"?"border-red-500/40 dark:border-red-500/30":t.state==="connecting"?"border-amber-500/40 dark:border-amber-500/30":"border-azure-border dark:border-matrix-primary"}`,children:[e.jsxs("div",{className:"p-4 bg-white dark:bg-zinc-900 shadow-sm rounded-tl-lg rounded-tr-lg",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("div",{className:`w-9 h-9 rounded-lg flex items-center justify-center shrink-0 ${s?"bg-emerald-500/10":"bg-zinc-100 dark:bg-zinc-900"}`,children:e.jsx(ie,{className:`w-4 h-4 ${s?"text-emerald-500":"text-zinc-400 dark:text-matrix-tertiary"}`})}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"font-semibold text-azure-text dark:text-matrix-highlight truncate",children:t.name}),e.jsx(fe,{state:t.state}),n?.tls&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] text-emerald-500 bg-emerald-500/10 border border-emerald-500/30 rounded px-1.5 py-0.5",children:[e.jsx(ne,{className:"w-2.5 h-2.5"}),"TLS"]})]}),e.jsxs("div",{className:"text-xs text-azure-text-secondary dark:text-matrix-tertiary mt-0.5",children:[t.host,":",t.port]})]})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[e.jsx("button",{onClick:()=>i(t.name),className:"p-1.5 rounded border border-azure-border dark:border-matrix-primary text-azure-text-secondary dark:text-matrix-secondary hover:text-azure-primary dark:hover:text-matrix-highlight hover:border-azure-primary dark:hover:border-matrix-highlight transition-colors",title:"Ping",children:e.jsx(q,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:()=>o(n??{name:t.name,host:t.host,port:t.port,auth_token:"",tls:!1}),className:"p-1.5 rounded border border-azure-border dark:border-matrix-primary text-azure-text-secondary dark:text-matrix-secondary hover:text-azure-primary dark:hover:text-matrix-highlight hover:border-azure-primary dark:hover:border-matrix-highlight transition-colors",title:"Edit",children:e.jsx(le,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:()=>a(t.name),className:"p-1.5 rounded border border-red-200 dark:border-red-800/50 text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20 hover:text-red-500 transition-colors",title:"Remove",children:e.jsx(de,{className:"w-3.5 h-3.5"})})]})]}),t.error&&e.jsxs("div",{className:"mt-3 flex items-start gap-2 text-xs text-red-500 bg-red-500/10 border border-red-500/20 rounded p-2",children:[e.jsx($,{className:"w-3.5 h-3.5 shrink-0 mt-0.5"}),e.jsx("span",{children:t.error})]}),s&&t.stats&&e.jsx("div",{className:"mt-3 space-y-2",children:e.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1 text-xs",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-azure-text-secondary dark:text-matrix-tertiary",children:"OS"}),e.jsx("span",{className:"text-azure-text dark:text-matrix-secondary font-mono",children:t.stats.os})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-azure-text-secondary dark:text-matrix-tertiary",children:"Hostname"}),e.jsx("span",{className:"text-azure-text dark:text-matrix-secondary font-mono truncate max-w-[120px]",children:t.stats.hostname})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("span",{className:"text-azure-text-secondary dark:text-matrix-tertiary flex items-center gap-1",children:[e.jsx(oe,{className:"w-3 h-3"})," CPU"]}),e.jsxs("span",{className:"text-azure-text dark:text-matrix-secondary font-mono",children:[t.stats.cpu_percent.toFixed(1),"%"]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("span",{className:"text-azure-text-secondary dark:text-matrix-tertiary flex items-center gap-1",children:[e.jsx(ce,{className:"w-3 h-3"})," RAM"]}),e.jsx("span",{className:"text-azure-text dark:text-matrix-secondary font-mono",children:pe(t.stats.memory_used_mb,t.stats.memory_total_mb)})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("span",{className:"text-azure-text-secondary dark:text-matrix-tertiary flex items-center gap-1",children:[e.jsx(me,{className:"w-3 h-3"})," Uptime"]}),e.jsx("span",{className:"text-azure-text dark:text-matrix-secondary font-mono",children:be(t.stats.uptime_seconds)})]}),t.config?.sandbox_dir&&e.jsxs("div",{className:"flex justify-between col-span-2",children:[e.jsx("span",{className:"text-azure-text-secondary dark:text-matrix-tertiary shrink-0",children:"Sandbox"}),e.jsx("span",{className:"text-azure-text dark:text-matrix-secondary font-mono truncate text-right ml-2",children:t.config.sandbox_dir})]}),t.config&&e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-azure-text-secondary dark:text-matrix-tertiary",children:"Read-only"}),e.jsx("span",{className:`font-medium ${t.config.readonly_mode?"text-amber-500":"text-emerald-500"}`,children:t.config.readonly_mode?"yes":"no"})]})]})}),!s&&t.lastSeen&&e.jsxs("div",{className:"mt-2 text-xs text-azure-text-secondary dark:text-matrix-tertiary",children:["Last seen: ",new Date(t.lastSeen).toLocaleString()]})]}),t.capabilities.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>h(!l),className:"w-full flex items-center justify-between px-4 py-2 border-t border-azure-border dark:border-matrix-primary/30 text-xs text-azure-text-secondary dark:text-matrix-tertiary hover:text-azure-text dark:hover:text-matrix-secondary hover:bg-azure-surface/50 dark:hover:bg-zinc-900/50 transition-colors",children:[e.jsxs("span",{children:["Capabilities (",t.capabilities.length,")"]}),l?e.jsx(xe,{className:"w-3.5 h-3.5"}):e.jsx(he,{className:"w-3.5 h-3.5"})]}),l&&e.jsxs("div",{className:"px-4 pb-4 pt-3 border-t border-azure-border dark:border-matrix-primary/30 bg-azure-surface/30 dark:bg-zinc-900/30",children:[e.jsx("div",{className:"flex flex-wrap gap-1.5",children:t.capabilities.map(x=>e.jsx(je,{cap:x},x))}),t.lastSeen&&e.jsxs("div",{className:"text-xs text-azure-text-secondary dark:text-matrix-tertiary mt-3",children:["Last seen: ",new Date(t.lastSeen).toLocaleString()]})]})]})]})}function U({title:t,initial:n,isEdit:i,onSave:o,onClose:a,saving:l,error:h}){const[s,x]=c.useState(n),[j,p]=c.useState(null),f=()=>{if(!s.name.trim()){p("Name is required.");return}if(!s.host.trim()){p("Host is required.");return}if(!i&&!s.auth_token.trim()){p("Auth token is required.");return}p(null),o(s)};return e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm z-50 flex items-center justify-center p-4",children:e.jsxs("div",{className:"bg-white dark:bg-black border border-azure-border dark:border-matrix-primary rounded-lg shadow-xl w-full max-w-md",children:[e.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-azure-border dark:border-matrix-primary",children:[e.jsxs("h2",{className:"text-base font-semibold text-azure-text dark:text-matrix-highlight flex items-center gap-2",children:[e.jsx(_,{className:"w-4 h-4"}),t]}),e.jsx("button",{onClick:a,className:"text-azure-text-secondary dark:text-matrix-tertiary hover:text-azure-text dark:hover:text-matrix-highlight transition-colors",children:e.jsx(ue,{className:"w-4 h-4"})})]}),e.jsxs("div",{className:"p-5 space-y-3",children:[(j||h)&&e.jsxs("div",{className:"flex items-start gap-2 text-sm text-red-500 bg-red-500/10 border border-red-500/20 rounded p-3",children:[e.jsx($,{className:"w-4 h-4 shrink-0 mt-0.5"}),e.jsx("span",{children:j||h})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx("div",{className:"col-span-2",children:e.jsx(C,{label:"Name",value:s.name,onChange:m=>x({...s,name:m.target.value}),disabled:i,helperText:i?"Name cannot be changed after creation.":"Unique identifier (lowercase, hyphens ok)."})}),e.jsx(C,{label:"Host",value:s.host,onChange:m=>x({...s,host:m.target.value}),placeholder:"localhost"}),e.jsx(w,{label:"Port",value:s.port,onChange:m=>x({...s,port:Number(m.target.value)}),min:1,max:65535}),e.jsx("div",{className:"col-span-2",children:e.jsx(C,{label:"Auth Token",value:s.auth_token,onChange:m=>x({...s,auth_token:m.target.value}),placeholder:i?"Leave blank to keep existing token":"Shared secret",helperText:i?"Leave blank to keep the current token.":void 0})})]}),e.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[e.jsx("input",{type:"checkbox",id:"smith-tls",checked:s.tls??!1,onChange:m=>x({...s,tls:m.target.checked}),className:"w-4 h-4 accent-azure-primary dark:accent-matrix-highlight"}),e.jsxs("label",{htmlFor:"smith-tls",className:"text-sm text-azure-text-secondary dark:text-matrix-secondary cursor-pointer",children:["Use TLS (",e.jsx("code",{className:"text-xs font-mono",children:"wss://"}),")"]})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 px-5 py-4 border-t border-azure-border dark:border-matrix-primary",children:[e.jsx("button",{onClick:a,className:"px-4 py-2 rounded text-sm text-azure-text-secondary dark:text-matrix-tertiary hover:text-azure-text dark:hover:text-matrix-highlight transition-colors",children:"Cancel"}),e.jsx("button",{onClick:f,disabled:l,className:"px-4 py-2 rounded text-sm font-medium bg-azure-primary text-white hover:bg-azure-active dark:bg-matrix-highlight dark:text-black dark:hover:bg-matrix-highlight/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:l?"Saving…":i?"Update Smith":"Add Smith"})]})]})})}function $e(){const{data:t,mutate:n}=O("/api/smiths",b.getSmithsList,{refreshInterval:1e4}),{data:i,mutate:o}=O("/api/smiths/config",b.getSmithsConfig),[a,l]=c.useState(null),[h,s]=c.useState(!1),[x,j]=c.useState(!1),[p,f]=c.useState(!1),[m,z]=c.useState(null),[T,v]=c.useState(!1),[M,u]=c.useState(null),[N,A]=c.useState(null),[B,L]=c.useState(!1),[y,S]=c.useState(null);i&&!a&&l(i);const g=(r,d)=>{A({type:r,message:d}),setTimeout(()=>A(null),4e3)},G=async r=>{try{const d=await b.pingSmith(r);g("success",`Ping ${r}: ${d.latency_ms}ms`)}catch(d){g("error",`Ping failed: ${d.message}`)}},W=r=>{S(r)},K=async()=>{if(y)try{await b.removeSmith(y),n(),o(),l(null),g("success",`Smith "${y}" removed.`)}catch(r){g("error",`Failed to remove: ${r.message}`)}finally{S(null)}},J=async r=>{if(a){if(a.entries.some(d=>d.name===r.name)){u(`Smith "${r.name}" already exists.`);return}v(!0),u(null);try{const d={...a,entries:[...a.entries,r]};await b.updateSmithsConfig(d),f(!1),l(null),n(),o(),g("success",`Smith "${r.name}" added.`)}catch(d){u(d.message)}finally{v(!1)}}},Q=async r=>{if(a){v(!0),u(null);try{const d={...a,entries:a.entries.map(F=>F.name===r.name?r:F)};await b.updateSmithsConfig(d),z(null),l(null),n(),o(),g("success",`Smith "${r.name}" updated.`)}catch(d){u(d.message)}finally{v(!1)}}},X=async()=>{if(a){j(!0);try{await b.updateSmithsConfig(a),n(),o(),g("success","Settings saved."),s(!1)}catch(r){g("error",r.message)}finally{j(!1)}}},k=t?.smiths??[],P=k.filter(r=>r.state==="online").length,E=k.filter(r=>r.state==="offline"||r.state==="error").length,R=k.filter(r=>r.state==="connecting").length,D={};return(a??i)?.entries?.forEach(r=>{D[r.name]=r}),e.jsxs("div",{className:"space-y-6",children:[N&&e.jsxs("div",{className:`fixed top-4 right-4 z-50 flex items-center gap-2 px-4 py-3 rounded-lg shadow-xl text-sm border ${N.type==="success"?"bg-emerald-50 dark:bg-emerald-900/30 border-emerald-300 dark:border-emerald-500/50 text-emerald-700 dark:text-emerald-400":"bg-red-50 dark:bg-red-900/30 border-red-300 dark:border-red-500/50 text-red-700 dark:text-red-400"}`,children:[N.type==="success"?e.jsx(ee,{className:"w-4 h-4"}):e.jsx($,{className:"w-4 h-4"}),N.message]}),e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-azure-primary/10 dark:bg-matrix-highlight/10 border border-azure-primary/20 dark:border-matrix-highlight/30 flex items-center justify-center",children:e.jsx(_,{className:"w-5 h-5 text-azure-primary dark:text-matrix-highlight"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold text-azure-text dark:text-matrix-highlight",children:"Smiths"}),e.jsx("p",{className:"text-sm text-azure-text-secondary dark:text-matrix-tertiary",children:"Remote DevKit agents via WebSocket"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:async()=>{L(!0),await Promise.all([n(),o(),new Promise(r=>setTimeout(r,500))]),L(!1)},className:"p-2 rounded border border-azure-border dark:border-matrix-primary text-azure-text-secondary dark:text-matrix-secondary hover:text-azure-primary dark:hover:text-matrix-highlight transition-colors",title:"Refresh",children:e.jsx(te,{className:`w-4 h-4 transition-transform ${B?"animate-spin":""}`})}),e.jsxs("button",{onClick:()=>{s(!h),!a&&i&&l(i)},className:`flex items-center gap-1.5 px-3 py-2 rounded border text-sm transition-colors ${h?"bg-azure-primary/10 border-azure-primary dark:bg-matrix-highlight/10 dark:border-matrix-highlight text-azure-primary dark:text-matrix-highlight":"border-azure-border dark:border-matrix-primary text-azure-text-secondary dark:text-matrix-secondary hover:text-azure-primary dark:hover:text-matrix-highlight"}`,children:[e.jsx(H,{className:"w-4 h-4"}),"Settings"]}),e.jsxs("button",{onClick:()=>{f(!0),u(null)},className:"flex items-center gap-1.5 px-3 py-2 rounded bg-azure-primary text-white hover:bg-azure-active dark:bg-matrix-highlight dark:text-black dark:hover:bg-matrix-highlight/90 text-sm font-medium transition-colors",children:[e.jsx(I,{className:"w-4 h-4"}),"Add Smith"]})]})]}),t&&e.jsxs("div",{className:"flex flex-wrap items-center gap-4",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-sm",children:[e.jsx("span",{className:"text-azure-text-secondary dark:text-matrix-tertiary",children:"Total"}),e.jsx("span",{className:"font-semibold text-azure-text dark:text-matrix-secondary",children:t.total})]}),P>0&&e.jsxs("div",{className:"flex items-center gap-1.5 text-sm",children:[e.jsx(re,{className:"w-3.5 h-3.5 text-emerald-500"}),e.jsxs("span",{className:"font-semibold text-emerald-500",children:[P," online"]})]}),R>0&&e.jsxs("div",{className:"flex items-center gap-1.5 text-sm",children:[e.jsx(q,{className:"w-3.5 h-3.5 text-amber-500"}),e.jsxs("span",{className:"font-semibold text-amber-500",children:[R," connecting"]})]}),E>0&&e.jsxs("div",{className:"flex items-center gap-1.5 text-sm",children:[e.jsx(ae,{className:"w-3.5 h-3.5 text-zinc-400 dark:text-matrix-tertiary"}),e.jsxs("span",{className:"font-semibold text-zinc-500 dark:text-matrix-tertiary",children:[E," offline"]})]}),!t.enabled&&e.jsxs("div",{className:"flex items-center gap-1.5 text-sm text-amber-500 bg-amber-500/10 border border-amber-500/30 rounded-full px-2.5 py-0.5",children:[e.jsx(se,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"Smiths subsystem disabled"})]})]}),h&&a&&e.jsxs("div",{className:"rounded-lg border border-azure-border dark:border-matrix-primary bg-white dark:bg-black p-5 space-y-4",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("h2",{className:"text-sm font-semibold text-azure-text dark:text-matrix-highlight flex items-center gap-2",children:[e.jsx(H,{className:"w-4 h-4"}),"Global Settings"]})}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsx("div",{className:"sm:col-span-2",children:e.jsx(Y,{label:"Enable Smiths",checked:a.enabled,onChange:r=>l({...a,enabled:r}),helperText:"Master switch — disabling stops all Smith connections."})}),e.jsx(V,{label:"Execution Mode",value:a.execution_mode,onChange:r=>l({...a,execution_mode:r.target.value}),options:[{label:"Sync — inline result",value:"sync"},{label:"Async — background task",value:"async"}]}),e.jsx(w,{label:"Heartbeat Interval (s)",value:Math.round(a.heartbeat_interval_ms/1e3),onChange:r=>l({...a,heartbeat_interval_ms:Number(r.target.value)*1e3}),min:5}),e.jsx(w,{label:"Connection Timeout (s)",value:Math.round(a.connection_timeout_ms/1e3),onChange:r=>l({...a,connection_timeout_ms:Number(r.target.value)*1e3}),min:1}),e.jsx(w,{label:"Task Timeout (s)",value:Math.round(a.task_timeout_ms/1e3),onChange:r=>l({...a,task_timeout_ms:Number(r.target.value)*1e3}),min:5})]}),e.jsx("div",{className:"flex justify-end pt-1",children:e.jsx("button",{onClick:X,disabled:x,className:"px-4 py-2 rounded text-sm font-medium bg-azure-primary text-white hover:bg-azure-active dark:bg-matrix-highlight dark:text-black dark:hover:bg-matrix-highlight/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:x?"Saving…":"Save Settings"})})]}),k.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-20 text-center",children:[e.jsx("div",{className:"w-16 h-16 rounded-full bg-azure-surface dark:bg-zinc-900 border border-azure-border dark:border-matrix-primary flex items-center justify-center mb-4",children:e.jsx(_,{className:"w-7 h-7 text-azure-text-secondary dark:text-matrix-tertiary"})}),e.jsx("h3",{className:"text-base font-semibold text-azure-text dark:text-matrix-highlight mb-1",children:"No Smiths configured"}),e.jsx("p",{className:"text-sm text-azure-text-secondary dark:text-matrix-tertiary mb-4",children:"Add a remote agent to delegate DevKit tasks to isolated environments."}),e.jsxs("button",{onClick:()=>{f(!0),u(null)},className:"flex items-center gap-2 px-4 py-2 rounded bg-azure-primary text-white hover:bg-azure-active dark:bg-matrix-highlight dark:text-black text-sm font-medium transition-colors",children:[e.jsx(I,{className:"w-4 h-4"}),"Add First Smith"]})]}):e.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:k.map(r=>e.jsx(ye,{status:r,entry:D[r.name],onPing:G,onEdit:d=>{z({...d,auth_token:""}),u(null)},onDelete:W},r.name))}),p&&e.jsx(U,{title:"Add Smith",initial:ge,onSave:J,onClose:()=>f(!1),saving:T,error:M}),m&&e.jsx(U,{title:"Edit Smith",initial:m,isEdit:!0,onSave:Q,onClose:()=>z(null),saving:T,error:M}),e.jsx(Z,{isOpen:!!y,onClose:()=>S(null),onConfirm:K,title:"Remove Smith",description:`Are you sure you want to remove "${y}" from the registry? This action cannot be undone.`,confirmJson:"Remove",variant:"destructive"})]})}export{$e as SmithsPage};
|
|
1
|
+
import{j as e}from"./vendor-motion-C3CZ8ZlO.js";import{r as c}from"./vendor-react-DikRIOlj.js";import{u as O}from"./vendor-utils-D4NnWbOU.js";import{c as b,S as Y,N as w}from"./config-C2GB18ML.js";import{S as V,T as C}from"./SelectInput-KVLsnfra.js";import{C as Z}from"./ConfirmationModal-Bud3Ur7D.js";import{h as ee,a2 as $,H as _,Q as te,am as H,a6 as I,ac as re,an as q,ad as ae,ao as se,ap as ie,aq as ne,w as le,z as de,l as oe,ar as ce,g as me,ae as xe,I as he,X as ue}from"./vendor-icons-NHF9HNeN.js";import"./index-BiMscUrn.js";const ge={name:"",host:"",port:7900,auth_token:"",tls:!1};function be(t){const n=Math.floor(t/86400),i=Math.floor(t%86400/3600),o=Math.floor(t%3600/60);return n>0?`${n}d ${i}h`:i>0?`${i}h ${o}m`:`${o}m`}function pe(t,n){const i=t>=1024?`${(t/1024).toFixed(1)}GB`:`${Math.round(t)}MB`,o=n>=1024?`${(n/1024).toFixed(1)}GB`:`${Math.round(n)}MB`;return`${i} / ${o}`}function fe({state:t}){return t==="online"?e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs font-medium text-emerald-500 bg-emerald-500/10 border border-emerald-500/30 rounded-full px-2 py-0.5",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-500 animate-pulse"}),"online"]}):t==="connecting"?e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs font-medium text-amber-500 bg-amber-500/10 border border-amber-500/30 rounded-full px-2 py-0.5",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-500 animate-pulse"}),"connecting"]}):t==="error"?e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs font-medium text-red-500 bg-red-500/10 border border-red-500/30 rounded-full px-2 py-0.5",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-red-500"}),"error"]}):e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs font-medium text-zinc-500 bg-zinc-500/10 border border-zinc-500/30 rounded-full px-2 py-0.5",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-zinc-500"}),"offline"]})}function je({cap:t}){const i={filesystem:"text-blue-400 bg-blue-400/10 border-blue-400/30",shell:"text-yellow-400 bg-yellow-400/10 border-yellow-400/30",git:"text-orange-400 bg-orange-400/10 border-orange-400/30",browser:"text-purple-400 bg-purple-400/10 border-purple-400/30",network:"text-cyan-400 bg-cyan-400/10 border-cyan-400/30",packages:"text-green-400 bg-green-400/10 border-green-400/30",processes:"text-pink-400 bg-pink-400/10 border-pink-400/30",system:"text-indigo-400 bg-indigo-400/10 border-indigo-400/30"}[t]??"text-zinc-400 bg-zinc-400/10 border-zinc-400/30";return e.jsx("span",{className:`text-[10px] font-medium border rounded px-1.5 py-0.5 ${i}`,children:t})}function ye({status:t,entry:n,onPing:i,onEdit:o,onDelete:a}){const[l,h]=c.useState(!1),s=t.state==="online";return e.jsxs("div",{className:`rounded-lg border bg-white dark:bg-zinc-900 shadow-sm transition-all ${s?"border-emerald-500/40 dark:border-emerald-500/30":t.state==="error"?"border-red-500/40 dark:border-red-500/30":t.state==="connecting"?"border-amber-500/40 dark:border-amber-500/30":"border-azure-border dark:border-matrix-primary"}`,children:[e.jsxs("div",{className:"p-4 bg-white dark:bg-zinc-900 shadow-sm rounded-tl-lg rounded-tr-lg",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("div",{className:`w-9 h-9 rounded-lg flex items-center justify-center shrink-0 ${s?"bg-emerald-500/10":"bg-zinc-100 dark:bg-zinc-900"}`,children:e.jsx(ie,{className:`w-4 h-4 ${s?"text-emerald-500":"text-zinc-400 dark:text-matrix-tertiary"}`})}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"font-semibold text-azure-text dark:text-matrix-highlight truncate",children:t.name}),e.jsx(fe,{state:t.state}),n?.tls&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] text-emerald-500 bg-emerald-500/10 border border-emerald-500/30 rounded px-1.5 py-0.5",children:[e.jsx(ne,{className:"w-2.5 h-2.5"}),"TLS"]})]}),e.jsxs("div",{className:"text-xs text-azure-text-secondary dark:text-matrix-tertiary mt-0.5",children:[t.host,":",t.port]})]})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[e.jsx("button",{onClick:()=>i(t.name),className:"p-1.5 rounded border border-azure-border dark:border-matrix-primary text-azure-text-secondary dark:text-matrix-secondary hover:text-azure-primary dark:hover:text-matrix-highlight hover:border-azure-primary dark:hover:border-matrix-highlight transition-colors",title:"Ping",children:e.jsx(q,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:()=>o(n??{name:t.name,host:t.host,port:t.port,auth_token:"",tls:!1}),className:"p-1.5 rounded border border-azure-border dark:border-matrix-primary text-azure-text-secondary dark:text-matrix-secondary hover:text-azure-primary dark:hover:text-matrix-highlight hover:border-azure-primary dark:hover:border-matrix-highlight transition-colors",title:"Edit",children:e.jsx(le,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:()=>a(t.name),className:"p-1.5 rounded border border-red-200 dark:border-red-800/50 text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20 hover:text-red-500 transition-colors",title:"Remove",children:e.jsx(de,{className:"w-3.5 h-3.5"})})]})]}),t.error&&e.jsxs("div",{className:"mt-3 flex items-start gap-2 text-xs text-red-500 bg-red-500/10 border border-red-500/20 rounded p-2",children:[e.jsx($,{className:"w-3.5 h-3.5 shrink-0 mt-0.5"}),e.jsx("span",{children:t.error})]}),s&&t.stats&&e.jsx("div",{className:"mt-3 space-y-2",children:e.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1 text-xs",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-azure-text-secondary dark:text-matrix-tertiary",children:"OS"}),e.jsx("span",{className:"text-azure-text dark:text-matrix-secondary font-mono",children:t.stats.os})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-azure-text-secondary dark:text-matrix-tertiary",children:"Hostname"}),e.jsx("span",{className:"text-azure-text dark:text-matrix-secondary font-mono truncate max-w-[120px]",children:t.stats.hostname})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("span",{className:"text-azure-text-secondary dark:text-matrix-tertiary flex items-center gap-1",children:[e.jsx(oe,{className:"w-3 h-3"})," CPU"]}),e.jsxs("span",{className:"text-azure-text dark:text-matrix-secondary font-mono",children:[t.stats.cpu_percent.toFixed(1),"%"]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("span",{className:"text-azure-text-secondary dark:text-matrix-tertiary flex items-center gap-1",children:[e.jsx(ce,{className:"w-3 h-3"})," RAM"]}),e.jsx("span",{className:"text-azure-text dark:text-matrix-secondary font-mono",children:pe(t.stats.memory_used_mb,t.stats.memory_total_mb)})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("span",{className:"text-azure-text-secondary dark:text-matrix-tertiary flex items-center gap-1",children:[e.jsx(me,{className:"w-3 h-3"})," Uptime"]}),e.jsx("span",{className:"text-azure-text dark:text-matrix-secondary font-mono",children:be(t.stats.uptime_seconds)})]}),t.config?.sandbox_dir&&e.jsxs("div",{className:"flex justify-between col-span-2",children:[e.jsx("span",{className:"text-azure-text-secondary dark:text-matrix-tertiary shrink-0",children:"Sandbox"}),e.jsx("span",{className:"text-azure-text dark:text-matrix-secondary font-mono truncate text-right ml-2",children:t.config.sandbox_dir})]}),t.config&&e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-azure-text-secondary dark:text-matrix-tertiary",children:"Read-only"}),e.jsx("span",{className:`font-medium ${t.config.readonly_mode?"text-amber-500":"text-emerald-500"}`,children:t.config.readonly_mode?"yes":"no"})]})]})}),!s&&t.lastSeen&&e.jsxs("div",{className:"mt-2 text-xs text-azure-text-secondary dark:text-matrix-tertiary",children:["Last seen: ",new Date(t.lastSeen).toLocaleString()]})]}),t.capabilities.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>h(!l),className:"w-full flex items-center justify-between px-4 py-2 border-t border-azure-border dark:border-matrix-primary/30 text-xs text-azure-text-secondary dark:text-matrix-tertiary hover:text-azure-text dark:hover:text-matrix-secondary hover:bg-azure-surface/50 dark:hover:bg-zinc-900/50 transition-colors",children:[e.jsxs("span",{children:["Capabilities (",t.capabilities.length,")"]}),l?e.jsx(xe,{className:"w-3.5 h-3.5"}):e.jsx(he,{className:"w-3.5 h-3.5"})]}),l&&e.jsxs("div",{className:"px-4 pb-4 pt-3 border-t border-azure-border dark:border-matrix-primary/30 bg-azure-surface/30 dark:bg-zinc-900/30",children:[e.jsx("div",{className:"flex flex-wrap gap-1.5",children:t.capabilities.map(x=>e.jsx(je,{cap:x},x))}),t.lastSeen&&e.jsxs("div",{className:"text-xs text-azure-text-secondary dark:text-matrix-tertiary mt-3",children:["Last seen: ",new Date(t.lastSeen).toLocaleString()]})]})]})]})}function U({title:t,initial:n,isEdit:i,onSave:o,onClose:a,saving:l,error:h}){const[s,x]=c.useState(n),[j,p]=c.useState(null),f=()=>{if(!s.name.trim()){p("Name is required.");return}if(!s.host.trim()){p("Host is required.");return}if(!i&&!s.auth_token.trim()){p("Auth token is required.");return}p(null),o(s)};return e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm z-50 flex items-center justify-center p-4",children:e.jsxs("div",{className:"bg-white dark:bg-black border border-azure-border dark:border-matrix-primary rounded-lg shadow-xl w-full max-w-md",children:[e.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-azure-border dark:border-matrix-primary",children:[e.jsxs("h2",{className:"text-base font-semibold text-azure-text dark:text-matrix-highlight flex items-center gap-2",children:[e.jsx(_,{className:"w-4 h-4"}),t]}),e.jsx("button",{onClick:a,className:"text-azure-text-secondary dark:text-matrix-tertiary hover:text-azure-text dark:hover:text-matrix-highlight transition-colors",children:e.jsx(ue,{className:"w-4 h-4"})})]}),e.jsxs("div",{className:"p-5 space-y-3",children:[(j||h)&&e.jsxs("div",{className:"flex items-start gap-2 text-sm text-red-500 bg-red-500/10 border border-red-500/20 rounded p-3",children:[e.jsx($,{className:"w-4 h-4 shrink-0 mt-0.5"}),e.jsx("span",{children:j||h})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx("div",{className:"col-span-2",children:e.jsx(C,{label:"Name",value:s.name,onChange:m=>x({...s,name:m.target.value}),disabled:i,helperText:i?"Name cannot be changed after creation.":"Unique identifier (lowercase, hyphens ok)."})}),e.jsx(C,{label:"Host",value:s.host,onChange:m=>x({...s,host:m.target.value}),placeholder:"localhost"}),e.jsx(w,{label:"Port",value:s.port,onChange:m=>x({...s,port:Number(m.target.value)}),min:1,max:65535}),e.jsx("div",{className:"col-span-2",children:e.jsx(C,{label:"Auth Token",value:s.auth_token,onChange:m=>x({...s,auth_token:m.target.value}),placeholder:i?"Leave blank to keep existing token":"Shared secret",helperText:i?"Leave blank to keep the current token.":void 0})})]}),e.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[e.jsx("input",{type:"checkbox",id:"smith-tls",checked:s.tls??!1,onChange:m=>x({...s,tls:m.target.checked}),className:"w-4 h-4 accent-azure-primary dark:accent-matrix-highlight"}),e.jsxs("label",{htmlFor:"smith-tls",className:"text-sm text-azure-text-secondary dark:text-matrix-secondary cursor-pointer",children:["Use TLS (",e.jsx("code",{className:"text-xs font-mono",children:"wss://"}),")"]})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 px-5 py-4 border-t border-azure-border dark:border-matrix-primary",children:[e.jsx("button",{onClick:a,className:"px-4 py-2 rounded text-sm text-azure-text-secondary dark:text-matrix-tertiary hover:text-azure-text dark:hover:text-matrix-highlight transition-colors",children:"Cancel"}),e.jsx("button",{onClick:f,disabled:l,className:"px-4 py-2 rounded text-sm font-medium bg-azure-primary text-white hover:bg-azure-active dark:bg-matrix-highlight dark:text-black dark:hover:bg-matrix-highlight/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:l?"Saving…":i?"Update Smith":"Add Smith"})]})]})})}function $e(){const{data:t,mutate:n}=O("/api/smiths",b.getSmithsList,{refreshInterval:1e4}),{data:i,mutate:o}=O("/api/smiths/config",b.getSmithsConfig),[a,l]=c.useState(null),[h,s]=c.useState(!1),[x,j]=c.useState(!1),[p,f]=c.useState(!1),[m,z]=c.useState(null),[T,v]=c.useState(!1),[M,u]=c.useState(null),[N,A]=c.useState(null),[B,L]=c.useState(!1),[y,S]=c.useState(null);i&&!a&&l(i);const g=(r,d)=>{A({type:r,message:d}),setTimeout(()=>A(null),4e3)},G=async r=>{try{const d=await b.pingSmith(r);g("success",`Ping ${r}: ${d.latency_ms}ms`)}catch(d){g("error",`Ping failed: ${d.message}`)}},W=r=>{S(r)},K=async()=>{if(y)try{await b.removeSmith(y),n(),o(),l(null),g("success",`Smith "${y}" removed.`)}catch(r){g("error",`Failed to remove: ${r.message}`)}finally{S(null)}},J=async r=>{if(a){if(a.entries.some(d=>d.name===r.name)){u(`Smith "${r.name}" already exists.`);return}v(!0),u(null);try{const d={...a,entries:[...a.entries,r]};await b.updateSmithsConfig(d),f(!1),l(null),n(),o(),g("success",`Smith "${r.name}" added.`)}catch(d){u(d.message)}finally{v(!1)}}},Q=async r=>{if(a){v(!0),u(null);try{const d={...a,entries:a.entries.map(F=>F.name===r.name?r:F)};await b.updateSmithsConfig(d),z(null),l(null),n(),o(),g("success",`Smith "${r.name}" updated.`)}catch(d){u(d.message)}finally{v(!1)}}},X=async()=>{if(a){j(!0);try{await b.updateSmithsConfig(a),n(),o(),g("success","Settings saved."),s(!1)}catch(r){g("error",r.message)}finally{j(!1)}}},k=t?.smiths??[],P=k.filter(r=>r.state==="online").length,E=k.filter(r=>r.state==="offline"||r.state==="error").length,R=k.filter(r=>r.state==="connecting").length,D={};return(a??i)?.entries?.forEach(r=>{D[r.name]=r}),e.jsxs("div",{className:"space-y-6",children:[N&&e.jsxs("div",{className:`fixed top-4 right-4 z-50 flex items-center gap-2 px-4 py-3 rounded-lg shadow-xl text-sm border ${N.type==="success"?"bg-emerald-50 dark:bg-emerald-900/30 border-emerald-300 dark:border-emerald-500/50 text-emerald-700 dark:text-emerald-400":"bg-red-50 dark:bg-red-900/30 border-red-300 dark:border-red-500/50 text-red-700 dark:text-red-400"}`,children:[N.type==="success"?e.jsx(ee,{className:"w-4 h-4"}):e.jsx($,{className:"w-4 h-4"}),N.message]}),e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-azure-primary/10 dark:bg-matrix-highlight/10 border border-azure-primary/20 dark:border-matrix-highlight/30 flex items-center justify-center",children:e.jsx(_,{className:"w-5 h-5 text-azure-primary dark:text-matrix-highlight"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold text-azure-text dark:text-matrix-highlight",children:"Smiths"}),e.jsx("p",{className:"text-sm text-azure-text-secondary dark:text-matrix-tertiary",children:"Remote DevKit agents via WebSocket"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:async()=>{L(!0),await Promise.all([n(),o(),new Promise(r=>setTimeout(r,500))]),L(!1)},className:"p-2 rounded border border-azure-border dark:border-matrix-primary text-azure-text-secondary dark:text-matrix-secondary hover:text-azure-primary dark:hover:text-matrix-highlight transition-colors",title:"Refresh",children:e.jsx(te,{className:`w-4 h-4 transition-transform ${B?"animate-spin":""}`})}),e.jsxs("button",{onClick:()=>{s(!h),!a&&i&&l(i)},className:`flex items-center gap-1.5 px-3 py-2 rounded border text-sm transition-colors ${h?"bg-azure-primary/10 border-azure-primary dark:bg-matrix-highlight/10 dark:border-matrix-highlight text-azure-primary dark:text-matrix-highlight":"border-azure-border dark:border-matrix-primary text-azure-text-secondary dark:text-matrix-secondary hover:text-azure-primary dark:hover:text-matrix-highlight"}`,children:[e.jsx(H,{className:"w-4 h-4"}),"Settings"]}),e.jsxs("button",{onClick:()=>{f(!0),u(null)},className:"flex items-center gap-1.5 px-3 py-2 rounded bg-azure-primary text-white hover:bg-azure-active dark:bg-matrix-highlight dark:text-black dark:hover:bg-matrix-highlight/90 text-sm font-medium transition-colors",children:[e.jsx(I,{className:"w-4 h-4"}),"Add Smith"]})]})]}),t&&e.jsxs("div",{className:"flex flex-wrap items-center gap-4",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-sm",children:[e.jsx("span",{className:"text-azure-text-secondary dark:text-matrix-tertiary",children:"Total"}),e.jsx("span",{className:"font-semibold text-azure-text dark:text-matrix-secondary",children:t.total})]}),P>0&&e.jsxs("div",{className:"flex items-center gap-1.5 text-sm",children:[e.jsx(re,{className:"w-3.5 h-3.5 text-emerald-500"}),e.jsxs("span",{className:"font-semibold text-emerald-500",children:[P," online"]})]}),R>0&&e.jsxs("div",{className:"flex items-center gap-1.5 text-sm",children:[e.jsx(q,{className:"w-3.5 h-3.5 text-amber-500"}),e.jsxs("span",{className:"font-semibold text-amber-500",children:[R," connecting"]})]}),E>0&&e.jsxs("div",{className:"flex items-center gap-1.5 text-sm",children:[e.jsx(ae,{className:"w-3.5 h-3.5 text-zinc-400 dark:text-matrix-tertiary"}),e.jsxs("span",{className:"font-semibold text-zinc-500 dark:text-matrix-tertiary",children:[E," offline"]})]}),!t.enabled&&e.jsxs("div",{className:"flex items-center gap-1.5 text-sm text-amber-500 bg-amber-500/10 border border-amber-500/30 rounded-full px-2.5 py-0.5",children:[e.jsx(se,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"Smiths subsystem disabled"})]})]}),h&&a&&e.jsxs("div",{className:"rounded-lg border border-azure-border dark:border-matrix-primary bg-white dark:bg-black p-5 space-y-4",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("h2",{className:"text-sm font-semibold text-azure-text dark:text-matrix-highlight flex items-center gap-2",children:[e.jsx(H,{className:"w-4 h-4"}),"Global Settings"]})}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsx("div",{className:"sm:col-span-2",children:e.jsx(Y,{label:"Enable Smiths",checked:a.enabled,onChange:r=>l({...a,enabled:r}),helperText:"Master switch — disabling stops all Smith connections."})}),e.jsx(V,{label:"Execution Mode",value:a.execution_mode,onChange:r=>l({...a,execution_mode:r.target.value}),options:[{label:"Sync — inline result",value:"sync"},{label:"Async — background task",value:"async"}]}),e.jsx(w,{label:"Heartbeat Interval (s)",value:Math.round(a.heartbeat_interval_ms/1e3),onChange:r=>l({...a,heartbeat_interval_ms:Number(r.target.value)*1e3}),min:5}),e.jsx(w,{label:"Connection Timeout (s)",value:Math.round(a.connection_timeout_ms/1e3),onChange:r=>l({...a,connection_timeout_ms:Number(r.target.value)*1e3}),min:1}),e.jsx(w,{label:"Task Timeout (s)",value:Math.round(a.task_timeout_ms/1e3),onChange:r=>l({...a,task_timeout_ms:Number(r.target.value)*1e3}),min:5})]}),e.jsx("div",{className:"flex justify-end pt-1",children:e.jsx("button",{onClick:X,disabled:x,className:"px-4 py-2 rounded text-sm font-medium bg-azure-primary text-white hover:bg-azure-active dark:bg-matrix-highlight dark:text-black dark:hover:bg-matrix-highlight/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:x?"Saving…":"Save Settings"})})]}),k.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-20 text-center",children:[e.jsx("div",{className:"w-16 h-16 rounded-full bg-azure-surface dark:bg-zinc-900 border border-azure-border dark:border-matrix-primary flex items-center justify-center mb-4",children:e.jsx(_,{className:"w-7 h-7 text-azure-text-secondary dark:text-matrix-tertiary"})}),e.jsx("h3",{className:"text-base font-semibold text-azure-text dark:text-matrix-highlight mb-1",children:"No Smiths configured"}),e.jsx("p",{className:"text-sm text-azure-text-secondary dark:text-matrix-tertiary mb-4",children:"Add a remote agent to delegate DevKit tasks to isolated environments."}),e.jsxs("button",{onClick:()=>{f(!0),u(null)},className:"flex items-center gap-2 px-4 py-2 rounded bg-azure-primary text-white hover:bg-azure-active dark:bg-matrix-highlight dark:text-black text-sm font-medium transition-colors",children:[e.jsx(I,{className:"w-4 h-4"}),"Add First Smith"]})]}):e.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:k.map(r=>e.jsx(ye,{status:r,entry:D[r.name],onPing:G,onEdit:d=>{z({...d,auth_token:""}),u(null)},onDelete:W},r.name))}),p&&e.jsx(U,{title:"Add Smith",initial:ge,onSave:J,onClose:()=>f(!1),saving:T,error:M}),m&&e.jsx(U,{title:"Edit Smith",initial:m,isEdit:!0,onSave:Q,onClose:()=>z(null),saving:T,error:M}),e.jsx(Z,{isOpen:!!y,onClose:()=>S(null),onConfirm:K,title:"Remove Smith",description:`Are you sure you want to remove "${y}" from the registry? This action cannot be undone.`,confirmJson:"Remove",variant:"destructive"})]})}export{$e as SmithsPage};
|