local-operator-ui 0.31.19 → 0.31.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/out/main/index.js +84 -98
  2. package/out/renderer/assets/{_basePickBy-BjXXwW6E.js → _basePickBy-_G13yD_N.js} +1 -1
  3. package/out/renderer/assets/{_baseUniq-xIg3idQF.js → _baseUniq-cZFY6WR-.js} +1 -1
  4. package/out/renderer/assets/{agent-details-page-D2QdVqJp.js → agent-details-page-DohUpAW5.js} +1 -1
  5. package/out/renderer/assets/{agent-hub-page-BitfELv8.js → agent-hub-page-D2Wo_RcW.js} +1 -1
  6. package/out/renderer/assets/{agents-page-Cl1j7rwO.js → agents-page-Bme3mW2i.js} +2 -2
  7. package/out/renderer/assets/{aida-control-BqbEHtVs.js → aida-control-DVTI-DZP.js} +1 -1
  8. package/out/renderer/assets/{arc-Ceouzeia.js → arc-_ZSLPSD3.js} +1 -1
  9. package/out/renderer/assets/{architectureDiagram-IEHRJDOE-BGSLJh-o.js → architectureDiagram-IEHRJDOE-BMozIO-d.js} +1 -1
  10. package/out/renderer/assets/{blockDiagram-JOT3LUYC-BmQJgCM-.js → blockDiagram-JOT3LUYC-CnCGGby6.js} +1 -1
  11. package/out/renderer/assets/{book-open-tLP18D-k.js → book-open-BWKY7M9P.js} +1 -1
  12. package/out/renderer/assets/browser-page-Ca86jJVo.js +1 -0
  13. package/out/renderer/assets/{browser-webauthn-prompt-k5jzjWeZ.js → browser-webauthn-prompt-Zq7Sensn.js} +1 -1
  14. package/out/renderer/assets/{c4Diagram-VJAJSXHY-Yk9CQYyQ.js → c4Diagram-VJAJSXHY-D6vlxi2G.js} +1 -1
  15. package/out/renderer/assets/channel-DBxTgGZs.js +1 -0
  16. package/out/renderer/assets/{chunk-4BMEZGHF-DizR_fDb.js → chunk-4BMEZGHF-CgxwmKpR.js} +1 -1
  17. package/out/renderer/assets/{chunk-A2AXSNBT-BtTz6zUt.js → chunk-A2AXSNBT-DL4YbfpC.js} +1 -1
  18. package/out/renderer/assets/{chunk-AEK57VVT-D1a4VfuY.js → chunk-AEK57VVT-C7STzYq2.js} +1 -1
  19. package/out/renderer/assets/{chunk-D6G4REZN-bed23kTE.js → chunk-D6G4REZN-BiGlWxbN.js} +1 -1
  20. package/out/renderer/assets/{chunk-RZ5BOZE2-KfGYL-ag.js → chunk-RZ5BOZE2-FPI-zkVi.js} +1 -1
  21. package/out/renderer/assets/{chunk-XZIHB7SX-B1igQQgc.js → chunk-XZIHB7SX-pQtxBw7K.js} +1 -1
  22. package/out/renderer/assets/classDiagram-GIVACNV2-oRXPz12L.js +1 -0
  23. package/out/renderer/assets/classDiagram-v2-COTLJTTW-oRXPz12L.js +1 -0
  24. package/out/renderer/assets/clone-CWgQ1AK5.js +1 -0
  25. package/out/renderer/assets/{console-mirror-CqlxE8VR.js → console-mirror-CG9RcMIb.js} +1 -1
  26. package/out/renderer/assets/{consoleCapture-Bgq6O6hd.js → consoleCapture-CpTo2RAv.js} +1 -1
  27. package/out/renderer/assets/{dagre-OKDRZEBW-BlwfTwwA.js → dagre-OKDRZEBW-BoM7akd9.js} +1 -1
  28. package/out/renderer/assets/{diagram-SSKATNLV-jsDlGkgc.js → diagram-SSKATNLV-D9w1aNay.js} +1 -1
  29. package/out/renderer/assets/{diagram-VNBRO52H-DP8qnarm.js → diagram-VNBRO52H-D6xO4h26.js} +1 -1
  30. package/out/renderer/assets/{erDiagram-Q7BY3M3F-Tc8DPglp.js → erDiagram-Q7BY3M3F-lgEC_hRU.js} +1 -1
  31. package/out/renderer/assets/{error-boundary-X9vF0zez.js → error-boundary-DVk48CIF.js} +1 -1
  32. package/out/renderer/assets/{flowDiagram-4HSFHLVR-C0iWuz_e.js → flowDiagram-4HSFHLVR-B8gXHejR.js} +1 -1
  33. package/out/renderer/assets/{ganttDiagram-APWFNJXF-CXzAhOwO.js → ganttDiagram-APWFNJXF-Ds8ML93J.js} +1 -1
  34. package/out/renderer/assets/{gitGraphDiagram-7IBYFJ6S-c3OKkh69.js → gitGraphDiagram-7IBYFJ6S-D5gdmSVh.js} +1 -1
  35. package/out/renderer/assets/{graph-BNpclJqw.js → graph-DNi4FjaS.js} +1 -1
  36. package/out/renderer/assets/{index-BgDCWTEy.js → index-40tBsZ9r.js} +1 -1
  37. package/out/renderer/assets/{index-BsveCKct.js → index-BhRzR-VW.js} +380 -375
  38. package/out/renderer/assets/{index-D4_JjH_R.js → index-BlalL3ro.js} +1 -1
  39. package/out/renderer/assets/index-FjyWTJXV.css +1 -0
  40. package/out/renderer/assets/infoDiagram-PH2N3AL5-BDTgzxhS.js +2 -0
  41. package/out/renderer/assets/{installer-Durl4Nt6.js → installer-BgW1Tkr8.js} +1 -1
  42. package/out/renderer/assets/{journeyDiagram-U35MCT3I-DdWl9wJG.js → journeyDiagram-U35MCT3I-BdnGNrZc.js} +1 -1
  43. package/out/renderer/assets/{kanban-definition-NDS4AKOZ-D6rkiZvG.js → kanban-definition-NDS4AKOZ-BuQLa1-R.js} +1 -1
  44. package/out/renderer/assets/{layout-BQqWsgv9.js → layout-Pvac8TnM.js} +1 -1
  45. package/out/renderer/assets/{legacy-agents-page-xSUV6wUg.js → legacy-agents-page-BR_oPhtA.js} +1 -1
  46. package/out/renderer/assets/{mermaid.core-DLc2GDBk.js → mermaid.core-Dol6F2oY.js} +5 -5
  47. package/out/renderer/assets/{mesh-page-D1Hn61zc.js → mesh-page-CcSpUIcL.js} +1 -1
  48. package/out/renderer/assets/{mindmap-definition-ALO5MXBD-BPp31SFM.js → mindmap-definition-ALO5MXBD-DDnWPtbR.js} +1 -1
  49. package/out/renderer/assets/{mini-dIYd4lBf.js → mini-D1QQjR0V.js} +1 -1
  50. package/out/renderer/assets/{org-surface-gate-CQZDYvz1.js → org-surface-gate-_kP5Dpsg.js} +1 -1
  51. package/out/renderer/assets/{page-header-Ct_E4hXM.js → page-header-B3RA2AMB.js} +1 -1
  52. package/out/renderer/assets/{pieDiagram-IB7DONF6-InajJAb7.js → pieDiagram-IB7DONF6-Dc1zeStB.js} +1 -1
  53. package/out/renderer/assets/{projects-page-Cq4-43oz.js → projects-page-Cb7bJ1ue.js} +1 -1
  54. package/out/renderer/assets/{quadrantDiagram-7GDLP6J5-DllpcIGZ.js → quadrantDiagram-7GDLP6J5-AlzvyKPw.js} +1 -1
  55. package/out/renderer/assets/{radar-MK3ICKWK-o49sXvJd.js → radar-MK3ICKWK-BLuijs-X.js} +1 -1
  56. package/out/renderer/assets/{radient-auth-buttons-DCKuV_IZ.js → radient-auth-buttons-gtgUk3ts.js} +1 -1
  57. package/out/renderer/assets/{requirementDiagram-KVF5MWMF-DEB_P2Er.js → requirementDiagram-KVF5MWMF-CfgMH9Xy.js} +1 -1
  58. package/out/renderer/assets/{sankeyDiagram-QLVOVGJD-1sqsEoj5.js → sankeyDiagram-QLVOVGJD-CGSaFjvZ.js} +1 -1
  59. package/out/renderer/assets/{schedules-page-D6uKCgBE.js → schedules-page-yCFUUqqb.js} +1 -1
  60. package/out/renderer/assets/{sequenceDiagram-X6HHIX6F-DBKLSCMO.js → sequenceDiagram-X6HHIX6F-BKLpPHnF.js} +1 -1
  61. package/out/renderer/assets/{settings-page-DuO8dHwe.js → settings-page-6S9zTaN7.js} +1 -1
  62. package/out/renderer/assets/{settings-section-yg8wX_kN.js → settings-section-D3WEX0WK.js} +1 -1
  63. package/out/renderer/assets/{stateDiagram-DGXRK772-CirIxYQ4.js → stateDiagram-DGXRK772-CukEj5Ge.js} +1 -1
  64. package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-CaoB6DdD.js +1 -0
  65. package/out/renderer/assets/{textarea-CPyoWJfR.js → textarea-BX6EeK34.js} +1 -1
  66. package/out/renderer/assets/{timeline-definition-BDJGKUSR-HxrDshvA.js → timeline-definition-BDJGKUSR-ZSpHRGCR.js} +1 -1
  67. package/out/renderer/assets/{ui-preferences-store-CyKvDymq.js → ui-preferences-store-DjUQd2R7.js} +1 -1
  68. package/out/renderer/assets/{use-download-agent-mutation-CJP2OhpP.js → use-download-agent-mutation-BwZi8Zfx.js} +1 -1
  69. package/out/renderer/assets/{use-memberships-query-Q96GogTV.js → use-memberships-query-CSOmeH29.js} +1 -1
  70. package/out/renderer/assets/{xychartDiagram-VJFVF3MP-BXsPMfju.js → xychartDiagram-VJFVF3MP-B4P41D_W.js} +1 -1
  71. package/out/renderer/console-capture.html +5 -5
  72. package/out/renderer/index.html +8 -8
  73. package/out/renderer/installer.html +5 -5
  74. package/out/renderer/mini.html +6 -6
  75. package/package.json +2 -2
  76. package/out/renderer/assets/browser-page-ChmnhnuO.js +0 -1
  77. package/out/renderer/assets/channel-CoXp_5DQ.js +0 -1
  78. package/out/renderer/assets/classDiagram-GIVACNV2-DLxyNS1q.js +0 -1
  79. package/out/renderer/assets/classDiagram-v2-COTLJTTW-DLxyNS1q.js +0 -1
  80. package/out/renderer/assets/clone-1ZAhWRhd.js +0 -1
  81. package/out/renderer/assets/index-R0cHU6YS.css +0 -1
  82. package/out/renderer/assets/infoDiagram-PH2N3AL5-C6rpQuUJ.js +0 -2
  83. package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-BektpfMe.js +0 -1
  84. /package/out/renderer/assets/{index-C17iOszj.js → index-VKe88JN9.js} +0 -0
@@ -1,4 +1,4 @@
1
- import{c as As,p as gi}from"./ui-preferences-store-CyKvDymq.js";import{r as T,j as De}from"./index-C17iOszj.js";import{c as Tn}from"./textarea-CPyoWJfR.js";var B;(function(e){e.assertEqual=r=>r;function t(r){}e.assertIs=t;function n(r){throw new Error}e.assertNever=n,e.arrayToEnum=r=>{const i={};for(const o of r)i[o]=o;return i},e.getValidEnumValues=r=>{const i=e.objectKeys(r).filter(c=>typeof r[r[c]]!="number"),o={};for(const c of i)o[c]=r[c];return e.objectValues(o)},e.objectValues=r=>e.objectKeys(r).map(function(i){return r[i]}),e.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{const i=[];for(const o in r)Object.prototype.hasOwnProperty.call(r,o)&&i.push(o);return i},e.find=(r,i)=>{for(const o of r)if(i(o))return o},e.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&isFinite(r)&&Math.floor(r)===r;function s(r,i=" | "){return r.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}e.joinValues=s,e.jsonStringifyReplacer=(r,i)=>typeof i=="bigint"?i.toString():i})(B||(B={}));var ts;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(ts||(ts={}));const b=B.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Me=e=>{switch(typeof e){case"undefined":return b.undefined;case"string":return b.string;case"number":return isNaN(e)?b.nan:b.number;case"boolean":return b.boolean;case"function":return b.function;case"bigint":return b.bigint;case"symbol":return b.symbol;case"object":return Array.isArray(e)?b.array:e===null?b.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?b.promise:typeof Map<"u"&&e instanceof Map?b.map:typeof Set<"u"&&e instanceof Set?b.set:typeof Date<"u"&&e instanceof Date?b.date:b.object;default:return b.unknown}},m=B.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Wo=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class ye extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){const n=t||function(i){return i.message},s={_errors:[]},r=i=>{for(const o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(r);else if(o.code==="invalid_return_type")r(o.returnTypeError);else if(o.code==="invalid_arguments")r(o.argumentsError);else if(o.path.length===0)s._errors.push(n(o));else{let c=s,l=0;for(;l<o.path.length;){const d=o.path[l];l===o.path.length-1?(c[d]=c[d]||{_errors:[]},c[d]._errors.push(n(o))):c[d]=c[d]||{_errors:[]},c=c[d],l++}}};return r(this),s}static assert(t){if(!(t instanceof ye))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,B.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n={},s=[];for(const r of this.issues)r.path.length>0?(n[r.path[0]]=n[r.path[0]]||[],n[r.path[0]].push(t(r))):s.push(t(r));return{formErrors:s,fieldErrors:n}}get formErrors(){return this.flatten()}}ye.create=e=>new ye(e);const bt=(e,t)=>{let n;switch(e.code){case m.invalid_type:e.received===b.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case m.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,B.jsonStringifyReplacer)}`;break;case m.unrecognized_keys:n=`Unrecognized key(s) in object: ${B.joinValues(e.keys,", ")}`;break;case m.invalid_union:n="Invalid input";break;case m.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${B.joinValues(e.options)}`;break;case m.invalid_enum_value:n=`Invalid enum value. Expected ${B.joinValues(e.options)}, received '${e.received}'`;break;case m.invalid_arguments:n="Invalid function arguments";break;case m.invalid_return_type:n="Invalid function return type";break;case m.invalid_date:n="Invalid date";break;case m.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:B.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case m.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case m.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case m.custom:n="Invalid input";break;case m.invalid_intersection_types:n="Intersection results could not be merged";break;case m.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case m.not_finite:n="Number must be finite";break;default:n=t.defaultError,B.assertNever(e)}return{message:n}};let yi=bt;function Yo(e){yi=e}function pn(){return yi}const hn=e=>{const{data:t,path:n,errorMaps:s,issueData:r}=e,i=[...n,...r.path||[]],o={...r,path:i};if(r.message!==void 0)return{...r,path:i,message:r.message};let c="";const l=s.filter(d=>!!d).slice().reverse();for(const d of l)c=d(o,{data:t,defaultError:c}).message;return{...r,path:i,message:c}},Qo=[];function y(e,t){const n=pn(),s=hn({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===bt?void 0:bt].filter(r=>!!r)});e.common.issues.push(s)}class ue{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const s=[];for(const r of n){if(r.status==="aborted")return A;r.status==="dirty"&&t.dirty(),s.push(r.value)}return{status:t.value,value:s}}static async mergeObjectAsync(t,n){const s=[];for(const r of n){const i=await r.key,o=await r.value;s.push({key:i,value:o})}return ue.mergeObjectSync(t,s)}static mergeObjectSync(t,n){const s={};for(const r of n){const{key:i,value:o}=r;if(i.status==="aborted"||o.status==="aborted")return A;i.status==="dirty"&&t.dirty(),o.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||r.alwaysSet)&&(s[i.value]=o.value)}return{status:t.value,value:s}}}const A=Object.freeze({status:"aborted"}),yt=e=>({status:"dirty",value:e}),pe=e=>({status:"valid",value:e}),ns=e=>e.status==="aborted",ss=e=>e.status==="dirty",it=e=>e.status==="valid",Mt=e=>typeof Promise<"u"&&e instanceof Promise;function mn(e,t,n,s){if(typeof t=="function"?e!==t||!0:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function vi(e,t,n,s,r){if(typeof t=="function"?e!==t||!0:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}var S;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(S||(S={}));var It,Ct;class Oe{constructor(t,n,s,r){this._cachedPath=[],this.parent=t,this.data=n,this._path=s,this._key=r}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Ys=(e,t)=>{if(it(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new ye(e.common.issues);return this._error=n,this._error}}};function D(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:s,description:r}=e;if(t&&(n||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:r}:{errorMap:(o,c)=>{var l,d;const{message:u}=e;return o.code==="invalid_enum_value"?{message:u??c.defaultError}:typeof c.data>"u"?{message:(l=u??s)!==null&&l!==void 0?l:c.defaultError}:o.code!=="invalid_type"?{message:c.defaultError}:{message:(d=u??n)!==null&&d!==void 0?d:c.defaultError}},description:r}}class N{get description(){return this._def.description}_getType(t){return Me(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Me(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new ue,ctx:{common:t.parent.common,data:t.data,parsedType:Me(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(Mt(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const s=this.safeParse(t,n);if(s.success)return s.data;throw s.error}safeParse(t,n){var s;const r={common:{issues:[],async:(s=n?.async)!==null&&s!==void 0?s:!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Me(t)},i=this._parseSync({data:t,path:r.path,parent:r});return Ys(r,i)}"~validate"(t){var n,s;const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Me(t)};if(!this["~standard"].async)try{const i=this._parseSync({data:t,path:[],parent:r});return it(i)?{value:i.value}:{issues:r.common.issues}}catch(i){!((s=(n=i?.message)===null||n===void 0?void 0:n.toLowerCase())===null||s===void 0)&&s.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(i=>it(i)?{value:i.value}:{issues:r.common.issues})}async parseAsync(t,n){const s=await this.safeParseAsync(t,n);if(s.success)return s.data;throw s.error}async safeParseAsync(t,n){const s={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Me(t)},r=this._parse({data:t,path:s.path,parent:s}),i=await(Mt(r)?r:Promise.resolve(r));return Ys(s,i)}refine(t,n){const s=r=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(r):n;return this._refinement((r,i)=>{const o=t(r),c=()=>i.addIssue({code:m.custom,...s(r)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(c(),!1)):o?!0:(c(),!1)})}refinement(t,n){return this._refinement((s,r)=>t(s)?!0:(r.addIssue(typeof n=="function"?n(s,r):n),!1))}_refinement(t){return new ke({schema:this,typeName:C.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return Ae.create(this,this._def)}nullable(){return Ve.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Se.create(this)}promise(){return St.create(this,this._def)}or(t){return Ft.create([this,t],this._def)}and(t){return Bt.create(this,t,this._def)}transform(t){return new ke({...D(this._def),schema:this,typeName:C.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new Vt({...D(this._def),innerType:this,defaultValue:n,typeName:C.ZodDefault})}brand(){return new Os({typeName:C.ZodBranded,type:this,...D(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new Kt({...D(this._def),innerType:this,catchValue:n,typeName:C.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return Yt.create(this,t)}readonly(){return Wt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Xo=/^c[^\s-]{8,}$/i,Jo=/^[0-9a-z]+$/,qo=/^[0-9A-HJKMNP-TV-Z]{26}$/i,ea=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,ta=/^[a-z0-9_-]{21}$/i,na=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,sa=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,ra=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ia="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let jn;const oa=/^(?:(?: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])$/,aa=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,ca=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,la=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,da=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ua=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,_i="((\\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])))",fa=new RegExp(`^${_i}$`);function bi(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`),t}function pa(e){return new RegExp(`^${bi(e)}$`)}function wi(e){let t=`${_i}T${bi(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function ha(e,t){return!!((t==="v4"||!t)&&oa.test(e)||(t==="v6"||!t)&&ca.test(e))}function ma(e,t){if(!na.test(e))return!1;try{const[n]=e.split("."),s=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),r=JSON.parse(atob(s));return!(typeof r!="object"||r===null||!r.typ||!r.alg||t&&r.alg!==t)}catch{return!1}}function ga(e,t){return!!((t==="v4"||!t)&&aa.test(e)||(t==="v6"||!t)&&la.test(e))}class we extends N{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==b.string){const i=this._getOrReturnCtx(t);return y(i,{code:m.invalid_type,expected:b.string,received:i.parsedType}),A}const s=new ue;let r;for(const i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(r=this._getOrReturnCtx(t,r),y(r,{code:m.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),s.dirty());else if(i.kind==="max")t.data.length>i.value&&(r=this._getOrReturnCtx(t,r),y(r,{code:m.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),s.dirty());else if(i.kind==="length"){const o=t.data.length>i.value,c=t.data.length<i.value;(o||c)&&(r=this._getOrReturnCtx(t,r),o?y(r,{code:m.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):c&&y(r,{code:m.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),s.dirty())}else if(i.kind==="email")ra.test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"email",code:m.invalid_string,message:i.message}),s.dirty());else if(i.kind==="emoji")jn||(jn=new RegExp(ia,"u")),jn.test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"emoji",code:m.invalid_string,message:i.message}),s.dirty());else if(i.kind==="uuid")ea.test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"uuid",code:m.invalid_string,message:i.message}),s.dirty());else if(i.kind==="nanoid")ta.test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"nanoid",code:m.invalid_string,message:i.message}),s.dirty());else if(i.kind==="cuid")Xo.test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"cuid",code:m.invalid_string,message:i.message}),s.dirty());else if(i.kind==="cuid2")Jo.test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"cuid2",code:m.invalid_string,message:i.message}),s.dirty());else if(i.kind==="ulid")qo.test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"ulid",code:m.invalid_string,message:i.message}),s.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{r=this._getOrReturnCtx(t,r),y(r,{validation:"url",code:m.invalid_string,message:i.message}),s.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"regex",code:m.invalid_string,message:i.message}),s.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(r=this._getOrReturnCtx(t,r),y(r,{code:m.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),s.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(r=this._getOrReturnCtx(t,r),y(r,{code:m.invalid_string,validation:{startsWith:i.value},message:i.message}),s.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(r=this._getOrReturnCtx(t,r),y(r,{code:m.invalid_string,validation:{endsWith:i.value},message:i.message}),s.dirty()):i.kind==="datetime"?wi(i).test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{code:m.invalid_string,validation:"datetime",message:i.message}),s.dirty()):i.kind==="date"?fa.test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{code:m.invalid_string,validation:"date",message:i.message}),s.dirty()):i.kind==="time"?pa(i).test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{code:m.invalid_string,validation:"time",message:i.message}),s.dirty()):i.kind==="duration"?sa.test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"duration",code:m.invalid_string,message:i.message}),s.dirty()):i.kind==="ip"?ha(t.data,i.version)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"ip",code:m.invalid_string,message:i.message}),s.dirty()):i.kind==="jwt"?ma(t.data,i.alg)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"jwt",code:m.invalid_string,message:i.message}),s.dirty()):i.kind==="cidr"?ga(t.data,i.version)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"cidr",code:m.invalid_string,message:i.message}),s.dirty()):i.kind==="base64"?da.test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"base64",code:m.invalid_string,message:i.message}),s.dirty()):i.kind==="base64url"?ua.test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"base64url",code:m.invalid_string,message:i.message}),s.dirty()):B.assertNever(i);return{status:s.value,value:t.data}}_regex(t,n,s){return this.refinement(r=>t.test(r),{validation:n,code:m.invalid_string,...S.errToObj(s)})}_addCheck(t){return new we({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...S.errToObj(t)})}url(t){return this._addCheck({kind:"url",...S.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...S.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...S.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...S.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...S.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...S.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...S.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...S.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...S.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...S.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...S.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...S.errToObj(t)})}datetime(t){var n,s;return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:(n=t?.offset)!==null&&n!==void 0?n:!1,local:(s=t?.local)!==null&&s!==void 0?s:!1,...S.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...S.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...S.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...S.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n?.position,...S.errToObj(n?.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...S.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...S.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...S.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...S.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...S.errToObj(n)})}nonempty(t){return this.min(1,S.errToObj(t))}trim(){return new we({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new we({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new we({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}we.create=e=>{var t;return new we({checks:[],typeName:C.ZodString,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...D(e)})};function ya(e,t){const n=(e.toString().split(".")[1]||"").length,s=(t.toString().split(".")[1]||"").length,r=n>s?n:s,i=parseInt(e.toFixed(r).replace(".","")),o=parseInt(t.toFixed(r).replace(".",""));return i%o/Math.pow(10,r)}class Ge extends N{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==b.number){const i=this._getOrReturnCtx(t);return y(i,{code:m.invalid_type,expected:b.number,received:i.parsedType}),A}let s;const r=new ue;for(const i of this._def.checks)i.kind==="int"?B.isInteger(t.data)||(s=this._getOrReturnCtx(t,s),y(s,{code:m.invalid_type,expected:"integer",received:"float",message:i.message}),r.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(s=this._getOrReturnCtx(t,s),y(s,{code:m.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),r.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(s=this._getOrReturnCtx(t,s),y(s,{code:m.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),r.dirty()):i.kind==="multipleOf"?ya(t.data,i.value)!==0&&(s=this._getOrReturnCtx(t,s),y(s,{code:m.not_multiple_of,multipleOf:i.value,message:i.message}),r.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(s=this._getOrReturnCtx(t,s),y(s,{code:m.not_finite,message:i.message}),r.dirty()):B.assertNever(i);return{status:r.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,S.toString(n))}gt(t,n){return this.setLimit("min",t,!1,S.toString(n))}lte(t,n){return this.setLimit("max",t,!0,S.toString(n))}lt(t,n){return this.setLimit("max",t,!1,S.toString(n))}setLimit(t,n,s,r){return new Ge({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:s,message:S.toString(r)}]})}_addCheck(t){return new Ge({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:S.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:S.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:S.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:S.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:S.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:S.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:S.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:S.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:S.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&B.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(n===null||s.value>n)&&(n=s.value):s.kind==="max"&&(t===null||s.value<t)&&(t=s.value)}return Number.isFinite(n)&&Number.isFinite(t)}}Ge.create=e=>new Ge({checks:[],typeName:C.ZodNumber,coerce:e?.coerce||!1,...D(e)});class He extends N{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==b.bigint)return this._getInvalidInput(t);let s;const r=new ue;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(s=this._getOrReturnCtx(t,s),y(s,{code:m.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),r.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(s=this._getOrReturnCtx(t,s),y(s,{code:m.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),r.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(s=this._getOrReturnCtx(t,s),y(s,{code:m.not_multiple_of,multipleOf:i.value,message:i.message}),r.dirty()):B.assertNever(i);return{status:r.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return y(n,{code:m.invalid_type,expected:b.bigint,received:n.parsedType}),A}gte(t,n){return this.setLimit("min",t,!0,S.toString(n))}gt(t,n){return this.setLimit("min",t,!1,S.toString(n))}lte(t,n){return this.setLimit("max",t,!0,S.toString(n))}lt(t,n){return this.setLimit("max",t,!1,S.toString(n))}setLimit(t,n,s,r){return new He({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:s,message:S.toString(r)}]})}_addCheck(t){return new He({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:S.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:S.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:S.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:S.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:S.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}He.create=e=>{var t;return new He({checks:[],typeName:C.ZodBigInt,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...D(e)})};class jt extends N{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==b.boolean){const s=this._getOrReturnCtx(t);return y(s,{code:m.invalid_type,expected:b.boolean,received:s.parsedType}),A}return pe(t.data)}}jt.create=e=>new jt({typeName:C.ZodBoolean,coerce:e?.coerce||!1,...D(e)});class ot extends N{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==b.date){const i=this._getOrReturnCtx(t);return y(i,{code:m.invalid_type,expected:b.date,received:i.parsedType}),A}if(isNaN(t.data.getTime())){const i=this._getOrReturnCtx(t);return y(i,{code:m.invalid_date}),A}const s=new ue;let r;for(const i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(r=this._getOrReturnCtx(t,r),y(r,{code:m.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),s.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(r=this._getOrReturnCtx(t,r),y(r,{code:m.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),s.dirty()):B.assertNever(i);return{status:s.value,value:new Date(t.data.getTime())}}_addCheck(t){return new ot({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:S.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:S.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}}ot.create=e=>new ot({checks:[],coerce:e?.coerce||!1,typeName:C.ZodDate,...D(e)});class gn extends N{_parse(t){if(this._getType(t)!==b.symbol){const s=this._getOrReturnCtx(t);return y(s,{code:m.invalid_type,expected:b.symbol,received:s.parsedType}),A}return pe(t.data)}}gn.create=e=>new gn({typeName:C.ZodSymbol,...D(e)});class $t extends N{_parse(t){if(this._getType(t)!==b.undefined){const s=this._getOrReturnCtx(t);return y(s,{code:m.invalid_type,expected:b.undefined,received:s.parsedType}),A}return pe(t.data)}}$t.create=e=>new $t({typeName:C.ZodUndefined,...D(e)});class Ut extends N{_parse(t){if(this._getType(t)!==b.null){const s=this._getOrReturnCtx(t);return y(s,{code:m.invalid_type,expected:b.null,received:s.parsedType}),A}return pe(t.data)}}Ut.create=e=>new Ut({typeName:C.ZodNull,...D(e)});class wt extends N{constructor(){super(...arguments),this._any=!0}_parse(t){return pe(t.data)}}wt.create=e=>new wt({typeName:C.ZodAny,...D(e)});class st extends N{constructor(){super(...arguments),this._unknown=!0}_parse(t){return pe(t.data)}}st.create=e=>new st({typeName:C.ZodUnknown,...D(e)});class $e extends N{_parse(t){const n=this._getOrReturnCtx(t);return y(n,{code:m.invalid_type,expected:b.never,received:n.parsedType}),A}}$e.create=e=>new $e({typeName:C.ZodNever,...D(e)});class yn extends N{_parse(t){if(this._getType(t)!==b.undefined){const s=this._getOrReturnCtx(t);return y(s,{code:m.invalid_type,expected:b.void,received:s.parsedType}),A}return pe(t.data)}}yn.create=e=>new yn({typeName:C.ZodVoid,...D(e)});class Se extends N{_parse(t){const{ctx:n,status:s}=this._processInputParams(t),r=this._def;if(n.parsedType!==b.array)return y(n,{code:m.invalid_type,expected:b.array,received:n.parsedType}),A;if(r.exactLength!==null){const o=n.data.length>r.exactLength.value,c=n.data.length<r.exactLength.value;(o||c)&&(y(n,{code:o?m.too_big:m.too_small,minimum:c?r.exactLength.value:void 0,maximum:o?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),s.dirty())}if(r.minLength!==null&&n.data.length<r.minLength.value&&(y(n,{code:m.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),s.dirty()),r.maxLength!==null&&n.data.length>r.maxLength.value&&(y(n,{code:m.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),s.dirty()),n.common.async)return Promise.all([...n.data].map((o,c)=>r.type._parseAsync(new Oe(n,o,n.path,c)))).then(o=>ue.mergeArray(s,o));const i=[...n.data].map((o,c)=>r.type._parseSync(new Oe(n,o,n.path,c)));return ue.mergeArray(s,i)}get element(){return this._def.type}min(t,n){return new Se({...this._def,minLength:{value:t,message:S.toString(n)}})}max(t,n){return new Se({...this._def,maxLength:{value:t,message:S.toString(n)}})}length(t,n){return new Se({...this._def,exactLength:{value:t,message:S.toString(n)}})}nonempty(t){return this.min(1,t)}}Se.create=(e,t)=>new Se({type:e,minLength:null,maxLength:null,exactLength:null,typeName:C.ZodArray,...D(t)});function gt(e){if(e instanceof Q){const t={};for(const n in e.shape){const s=e.shape[n];t[n]=Ae.create(gt(s))}return new Q({...e._def,shape:()=>t})}else return e instanceof Se?new Se({...e._def,type:gt(e.element)}):e instanceof Ae?Ae.create(gt(e.unwrap())):e instanceof Ve?Ve.create(gt(e.unwrap())):e instanceof Pe?Pe.create(e.items.map(t=>gt(t))):e}class Q extends N{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=B.objectKeys(t);return this._cached={shape:t,keys:n}}_parse(t){if(this._getType(t)!==b.object){const d=this._getOrReturnCtx(t);return y(d,{code:m.invalid_type,expected:b.object,received:d.parsedType}),A}const{status:s,ctx:r}=this._processInputParams(t),{shape:i,keys:o}=this._getCached(),c=[];if(!(this._def.catchall instanceof $e&&this._def.unknownKeys==="strip"))for(const d in r.data)o.includes(d)||c.push(d);const l=[];for(const d of o){const u=i[d],f=r.data[d];l.push({key:{status:"valid",value:d},value:u._parse(new Oe(r,f,r.path,d)),alwaysSet:d in r.data})}if(this._def.catchall instanceof $e){const d=this._def.unknownKeys;if(d==="passthrough")for(const u of c)l.push({key:{status:"valid",value:u},value:{status:"valid",value:r.data[u]}});else if(d==="strict")c.length>0&&(y(r,{code:m.unrecognized_keys,keys:c}),s.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const d=this._def.catchall;for(const u of c){const f=r.data[u];l.push({key:{status:"valid",value:u},value:d._parse(new Oe(r,f,r.path,u)),alwaysSet:u in r.data})}}return r.common.async?Promise.resolve().then(async()=>{const d=[];for(const u of l){const f=await u.key,p=await u.value;d.push({key:f,value:p,alwaysSet:u.alwaysSet})}return d}).then(d=>ue.mergeObjectSync(s,d)):ue.mergeObjectSync(s,l)}get shape(){return this._def.shape()}strict(t){return S.errToObj,new Q({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,s)=>{var r,i,o,c;const l=(o=(i=(r=this._def).errorMap)===null||i===void 0?void 0:i.call(r,n,s).message)!==null&&o!==void 0?o:s.defaultError;return n.code==="unrecognized_keys"?{message:(c=S.errToObj(t).message)!==null&&c!==void 0?c:l}:{message:l}}}:{}})}strip(){return new Q({...this._def,unknownKeys:"strip"})}passthrough(){return new Q({...this._def,unknownKeys:"passthrough"})}extend(t){return new Q({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Q({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:C.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new Q({...this._def,catchall:t})}pick(t){const n={};return B.objectKeys(t).forEach(s=>{t[s]&&this.shape[s]&&(n[s]=this.shape[s])}),new Q({...this._def,shape:()=>n})}omit(t){const n={};return B.objectKeys(this.shape).forEach(s=>{t[s]||(n[s]=this.shape[s])}),new Q({...this._def,shape:()=>n})}deepPartial(){return gt(this)}partial(t){const n={};return B.objectKeys(this.shape).forEach(s=>{const r=this.shape[s];t&&!t[s]?n[s]=r:n[s]=r.optional()}),new Q({...this._def,shape:()=>n})}required(t){const n={};return B.objectKeys(this.shape).forEach(s=>{if(t&&!t[s])n[s]=this.shape[s];else{let i=this.shape[s];for(;i instanceof Ae;)i=i._def.innerType;n[s]=i}}),new Q({...this._def,shape:()=>n})}keyof(){return Si(B.objectKeys(this.shape))}}Q.create=(e,t)=>new Q({shape:()=>e,unknownKeys:"strip",catchall:$e.create(),typeName:C.ZodObject,...D(t)});Q.strictCreate=(e,t)=>new Q({shape:()=>e,unknownKeys:"strict",catchall:$e.create(),typeName:C.ZodObject,...D(t)});Q.lazycreate=(e,t)=>new Q({shape:e,unknownKeys:"strip",catchall:$e.create(),typeName:C.ZodObject,...D(t)});class Ft extends N{_parse(t){const{ctx:n}=this._processInputParams(t),s=this._def.options;function r(i){for(const c of i)if(c.result.status==="valid")return c.result;for(const c of i)if(c.result.status==="dirty")return n.common.issues.push(...c.ctx.common.issues),c.result;const o=i.map(c=>new ye(c.ctx.common.issues));return y(n,{code:m.invalid_union,unionErrors:o}),A}if(n.common.async)return Promise.all(s.map(async i=>{const o={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(r);{let i;const o=[];for(const l of s){const d={...n,common:{...n.common,issues:[]},parent:null},u=l._parseSync({data:n.data,path:n.path,parent:d});if(u.status==="valid")return u;u.status==="dirty"&&!i&&(i={result:u,ctx:d}),d.common.issues.length&&o.push(d.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;const c=o.map(l=>new ye(l));return y(n,{code:m.invalid_union,unionErrors:c}),A}}get options(){return this._def.options}}Ft.create=(e,t)=>new Ft({options:e,typeName:C.ZodUnion,...D(t)});const Le=e=>e instanceof Gt?Le(e.schema):e instanceof ke?Le(e.innerType()):e instanceof Ht?[e.value]:e instanceof ze?e.options:e instanceof zt?B.objectValues(e.enum):e instanceof Vt?Le(e._def.innerType):e instanceof $t?[void 0]:e instanceof Ut?[null]:e instanceof Ae?[void 0,...Le(e.unwrap())]:e instanceof Ve?[null,...Le(e.unwrap())]:e instanceof Os||e instanceof Wt?Le(e.unwrap()):e instanceof Kt?Le(e._def.innerType):[];class En extends N{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==b.object)return y(n,{code:m.invalid_type,expected:b.object,received:n.parsedType}),A;const s=this.discriminator,r=n.data[s],i=this.optionsMap.get(r);return i?n.common.async?i._parseAsync({data:n.data,path:n.path,parent:n}):i._parseSync({data:n.data,path:n.path,parent:n}):(y(n,{code:m.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),A)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,s){const r=new Map;for(const i of n){const o=Le(i.shape[t]);if(!o.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const c of o){if(r.has(c))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(c)}`);r.set(c,i)}}return new En({typeName:C.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:r,...D(s)})}}function rs(e,t){const n=Me(e),s=Me(t);if(e===t)return{valid:!0,data:e};if(n===b.object&&s===b.object){const r=B.objectKeys(t),i=B.objectKeys(e).filter(c=>r.indexOf(c)!==-1),o={...e,...t};for(const c of i){const l=rs(e[c],t[c]);if(!l.valid)return{valid:!1};o[c]=l.data}return{valid:!0,data:o}}else if(n===b.array&&s===b.array){if(e.length!==t.length)return{valid:!1};const r=[];for(let i=0;i<e.length;i++){const o=e[i],c=t[i],l=rs(o,c);if(!l.valid)return{valid:!1};r.push(l.data)}return{valid:!0,data:r}}else return n===b.date&&s===b.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class Bt extends N{_parse(t){const{status:n,ctx:s}=this._processInputParams(t),r=(i,o)=>{if(ns(i)||ns(o))return A;const c=rs(i.value,o.value);return c.valid?((ss(i)||ss(o))&&n.dirty(),{status:n.value,value:c.data}):(y(s,{code:m.invalid_intersection_types}),A)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([i,o])=>r(i,o)):r(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}Bt.create=(e,t,n)=>new Bt({left:e,right:t,typeName:C.ZodIntersection,...D(n)});class Pe extends N{_parse(t){const{status:n,ctx:s}=this._processInputParams(t);if(s.parsedType!==b.array)return y(s,{code:m.invalid_type,expected:b.array,received:s.parsedType}),A;if(s.data.length<this._def.items.length)return y(s,{code:m.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),A;!this._def.rest&&s.data.length>this._def.items.length&&(y(s,{code:m.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const i=[...s.data].map((o,c)=>{const l=this._def.items[c]||this._def.rest;return l?l._parse(new Oe(s,o,s.path,c)):null}).filter(o=>!!o);return s.common.async?Promise.all(i).then(o=>ue.mergeArray(n,o)):ue.mergeArray(n,i)}get items(){return this._def.items}rest(t){return new Pe({...this._def,rest:t})}}Pe.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Pe({items:e,typeName:C.ZodTuple,rest:null,...D(t)})};class Zt extends N{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:s}=this._processInputParams(t);if(s.parsedType!==b.object)return y(s,{code:m.invalid_type,expected:b.object,received:s.parsedType}),A;const r=[],i=this._def.keyType,o=this._def.valueType;for(const c in s.data)r.push({key:i._parse(new Oe(s,c,s.path,c)),value:o._parse(new Oe(s,s.data[c],s.path,c)),alwaysSet:c in s.data});return s.common.async?ue.mergeObjectAsync(n,r):ue.mergeObjectSync(n,r)}get element(){return this._def.valueType}static create(t,n,s){return n instanceof N?new Zt({keyType:t,valueType:n,typeName:C.ZodRecord,...D(s)}):new Zt({keyType:we.create(),valueType:t,typeName:C.ZodRecord,...D(n)})}}class vn extends N{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:s}=this._processInputParams(t);if(s.parsedType!==b.map)return y(s,{code:m.invalid_type,expected:b.map,received:s.parsedType}),A;const r=this._def.keyType,i=this._def.valueType,o=[...s.data.entries()].map(([c,l],d)=>({key:r._parse(new Oe(s,c,s.path,[d,"key"])),value:i._parse(new Oe(s,l,s.path,[d,"value"]))}));if(s.common.async){const c=new Map;return Promise.resolve().then(async()=>{for(const l of o){const d=await l.key,u=await l.value;if(d.status==="aborted"||u.status==="aborted")return A;(d.status==="dirty"||u.status==="dirty")&&n.dirty(),c.set(d.value,u.value)}return{status:n.value,value:c}})}else{const c=new Map;for(const l of o){const d=l.key,u=l.value;if(d.status==="aborted"||u.status==="aborted")return A;(d.status==="dirty"||u.status==="dirty")&&n.dirty(),c.set(d.value,u.value)}return{status:n.value,value:c}}}}vn.create=(e,t,n)=>new vn({valueType:t,keyType:e,typeName:C.ZodMap,...D(n)});class at extends N{_parse(t){const{status:n,ctx:s}=this._processInputParams(t);if(s.parsedType!==b.set)return y(s,{code:m.invalid_type,expected:b.set,received:s.parsedType}),A;const r=this._def;r.minSize!==null&&s.data.size<r.minSize.value&&(y(s,{code:m.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),n.dirty()),r.maxSize!==null&&s.data.size>r.maxSize.value&&(y(s,{code:m.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),n.dirty());const i=this._def.valueType;function o(l){const d=new Set;for(const u of l){if(u.status==="aborted")return A;u.status==="dirty"&&n.dirty(),d.add(u.value)}return{status:n.value,value:d}}const c=[...s.data.values()].map((l,d)=>i._parse(new Oe(s,l,s.path,d)));return s.common.async?Promise.all(c).then(l=>o(l)):o(c)}min(t,n){return new at({...this._def,minSize:{value:t,message:S.toString(n)}})}max(t,n){return new at({...this._def,maxSize:{value:t,message:S.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}at.create=(e,t)=>new at({valueType:e,minSize:null,maxSize:null,typeName:C.ZodSet,...D(t)});class _t extends N{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==b.function)return y(n,{code:m.invalid_type,expected:b.function,received:n.parsedType}),A;function s(c,l){return hn({data:c,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,pn(),bt].filter(d=>!!d),issueData:{code:m.invalid_arguments,argumentsError:l}})}function r(c,l){return hn({data:c,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,pn(),bt].filter(d=>!!d),issueData:{code:m.invalid_return_type,returnTypeError:l}})}const i={errorMap:n.common.contextualErrorMap},o=n.data;if(this._def.returns instanceof St){const c=this;return pe(async function(...l){const d=new ye([]),u=await c._def.args.parseAsync(l,i).catch(w=>{throw d.addIssue(s(l,w)),d}),f=await Reflect.apply(o,this,u);return await c._def.returns._def.type.parseAsync(f,i).catch(w=>{throw d.addIssue(r(f,w)),d})})}else{const c=this;return pe(function(...l){const d=c._def.args.safeParse(l,i);if(!d.success)throw new ye([s(l,d.error)]);const u=Reflect.apply(o,this,d.data),f=c._def.returns.safeParse(u,i);if(!f.success)throw new ye([r(u,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new _t({...this._def,args:Pe.create(t).rest(st.create())})}returns(t){return new _t({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,s){return new _t({args:t||Pe.create([]).rest(st.create()),returns:n||st.create(),typeName:C.ZodFunction,...D(s)})}}class Gt extends N{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}Gt.create=(e,t)=>new Gt({getter:e,typeName:C.ZodLazy,...D(t)});class Ht extends N{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return y(n,{received:n.data,code:m.invalid_literal,expected:this._def.value}),A}return{status:"valid",value:t.data}}get value(){return this._def.value}}Ht.create=(e,t)=>new Ht({value:e,typeName:C.ZodLiteral,...D(t)});function Si(e,t){return new ze({values:e,typeName:C.ZodEnum,...D(t)})}class ze extends N{constructor(){super(...arguments),It.set(this,void 0)}_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),s=this._def.values;return y(n,{expected:B.joinValues(s),received:n.parsedType,code:m.invalid_type}),A}if(mn(this,It)||vi(this,It,new Set(this._def.values)),!mn(this,It).has(t.data)){const n=this._getOrReturnCtx(t),s=this._def.values;return y(n,{received:n.data,code:m.invalid_enum_value,options:s}),A}return pe(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return ze.create(t,{...this._def,...n})}exclude(t,n=this._def){return ze.create(this.options.filter(s=>!t.includes(s)),{...this._def,...n})}}It=new WeakMap;ze.create=Si;class zt extends N{constructor(){super(...arguments),Ct.set(this,void 0)}_parse(t){const n=B.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(t);if(s.parsedType!==b.string&&s.parsedType!==b.number){const r=B.objectValues(n);return y(s,{expected:B.joinValues(r),received:s.parsedType,code:m.invalid_type}),A}if(mn(this,Ct)||vi(this,Ct,new Set(B.getValidEnumValues(this._def.values))),!mn(this,Ct).has(t.data)){const r=B.objectValues(n);return y(s,{received:s.data,code:m.invalid_enum_value,options:r}),A}return pe(t.data)}get enum(){return this._def.values}}Ct=new WeakMap;zt.create=(e,t)=>new zt({values:e,typeName:C.ZodNativeEnum,...D(t)});class St extends N{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==b.promise&&n.common.async===!1)return y(n,{code:m.invalid_type,expected:b.promise,received:n.parsedType}),A;const s=n.parsedType===b.promise?n.data:Promise.resolve(n.data);return pe(s.then(r=>this._def.type.parseAsync(r,{path:n.path,errorMap:n.common.contextualErrorMap})))}}St.create=(e,t)=>new St({type:e,typeName:C.ZodPromise,...D(t)});class ke extends N{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===C.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:s}=this._processInputParams(t),r=this._def.effect||null,i={addIssue:o=>{y(s,o),o.fatal?n.abort():n.dirty()},get path(){return s.path}};if(i.addIssue=i.addIssue.bind(i),r.type==="preprocess"){const o=r.transform(s.data,i);if(s.common.async)return Promise.resolve(o).then(async c=>{if(n.value==="aborted")return A;const l=await this._def.schema._parseAsync({data:c,path:s.path,parent:s});return l.status==="aborted"?A:l.status==="dirty"||n.value==="dirty"?yt(l.value):l});{if(n.value==="aborted")return A;const c=this._def.schema._parseSync({data:o,path:s.path,parent:s});return c.status==="aborted"?A:c.status==="dirty"||n.value==="dirty"?yt(c.value):c}}if(r.type==="refinement"){const o=c=>{const l=r.refinement(c,i);if(s.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c};if(s.common.async===!1){const c=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return c.status==="aborted"?A:(c.status==="dirty"&&n.dirty(),o(c.value),{status:n.value,value:c.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(c=>c.status==="aborted"?A:(c.status==="dirty"&&n.dirty(),o(c.value).then(()=>({status:n.value,value:c.value}))))}if(r.type==="transform")if(s.common.async===!1){const o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!it(o))return o;const c=r.transform(o.value,i);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:c}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>it(o)?Promise.resolve(r.transform(o.value,i)).then(c=>({status:n.value,value:c})):o);B.assertNever(r)}}ke.create=(e,t,n)=>new ke({schema:e,typeName:C.ZodEffects,effect:t,...D(n)});ke.createWithPreprocess=(e,t,n)=>new ke({schema:t,effect:{type:"preprocess",transform:e},typeName:C.ZodEffects,...D(n)});class Ae extends N{_parse(t){return this._getType(t)===b.undefined?pe(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Ae.create=(e,t)=>new Ae({innerType:e,typeName:C.ZodOptional,...D(t)});class Ve extends N{_parse(t){return this._getType(t)===b.null?pe(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Ve.create=(e,t)=>new Ve({innerType:e,typeName:C.ZodNullable,...D(t)});class Vt extends N{_parse(t){const{ctx:n}=this._processInputParams(t);let s=n.data;return n.parsedType===b.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Vt.create=(e,t)=>new Vt({innerType:e,typeName:C.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...D(t)});class Kt extends N{_parse(t){const{ctx:n}=this._processInputParams(t),s={...n,common:{...n.common,issues:[]}},r=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return Mt(r)?r.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new ye(s.common.issues)},input:s.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new ye(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}Kt.create=(e,t)=>new Kt({innerType:e,typeName:C.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...D(t)});class _n extends N{_parse(t){if(this._getType(t)!==b.nan){const s=this._getOrReturnCtx(t);return y(s,{code:m.invalid_type,expected:b.nan,received:s.parsedType}),A}return{status:"valid",value:t.data}}}_n.create=e=>new _n({typeName:C.ZodNaN,...D(e)});const va=Symbol("zod_brand");class Os extends N{_parse(t){const{ctx:n}=this._processInputParams(t),s=n.data;return this._def.type._parse({data:s,path:n.path,parent:n})}unwrap(){return this._def.type}}class Yt extends N{_parse(t){const{status:n,ctx:s}=this._processInputParams(t);if(s.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return i.status==="aborted"?A:i.status==="dirty"?(n.dirty(),yt(i.value)):this._def.out._parseAsync({data:i.value,path:s.path,parent:s})})();{const r=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return r.status==="aborted"?A:r.status==="dirty"?(n.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:s.path,parent:s})}}static create(t,n){return new Yt({in:t,out:n,typeName:C.ZodPipeline})}}class Wt extends N{_parse(t){const n=this._def.innerType._parse(t),s=r=>(it(r)&&(r.value=Object.freeze(r.value)),r);return Mt(n)?n.then(r=>s(r)):s(n)}unwrap(){return this._def.innerType}}Wt.create=(e,t)=>new Wt({innerType:e,typeName:C.ZodReadonly,...D(t)});function Qs(e,t){const n=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof n=="string"?{message:n}:n}function ki(e,t={},n){return e?wt.create().superRefine((s,r)=>{var i,o;const c=e(s);if(c instanceof Promise)return c.then(l=>{var d,u;if(!l){const f=Qs(t,s),p=(u=(d=f.fatal)!==null&&d!==void 0?d:n)!==null&&u!==void 0?u:!0;r.addIssue({code:"custom",...f,fatal:p})}});if(!c){const l=Qs(t,s),d=(o=(i=l.fatal)!==null&&i!==void 0?i:n)!==null&&o!==void 0?o:!0;r.addIssue({code:"custom",...l,fatal:d})}}):wt.create()}const _a={object:Q.lazycreate};var C;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(C||(C={}));const ba=(e,t={message:`Input not instance of ${e.name}`})=>ki(n=>n instanceof e,t),Ti=we.create,Ei=Ge.create,wa=_n.create,Sa=He.create,xi=jt.create,ka=ot.create,Ta=gn.create,Ea=$t.create,xa=Ut.create,Ia=wt.create,Ca=st.create,Ra=$e.create,Aa=yn.create,Oa=Se.create,Pa=Q.create,Da=Q.strictCreate,La=Ft.create,Na=En.create,Ma=Bt.create,ja=Pe.create,$a=Zt.create,Ua=vn.create,Fa=at.create,Ba=_t.create,Za=Gt.create,Ga=Ht.create,Ha=ze.create,za=zt.create,Va=St.create,Xs=ke.create,Ka=Ae.create,Wa=Ve.create,Ya=ke.createWithPreprocess,Qa=Yt.create,Xa=()=>Ti().optional(),Ja=()=>Ei().optional(),qa=()=>xi().optional(),ec={string:e=>we.create({...e,coerce:!0}),number:e=>Ge.create({...e,coerce:!0}),boolean:e=>jt.create({...e,coerce:!0}),bigint:e=>He.create({...e,coerce:!0}),date:e=>ot.create({...e,coerce:!0})},tc=A;var a=Object.freeze({__proto__:null,defaultErrorMap:bt,setErrorMap:Yo,getErrorMap:pn,makeIssue:hn,EMPTY_PATH:Qo,addIssueToContext:y,ParseStatus:ue,INVALID:A,DIRTY:yt,OK:pe,isAborted:ns,isDirty:ss,isValid:it,isAsync:Mt,get util(){return B},get objectUtil(){return ts},ZodParsedType:b,getParsedType:Me,ZodType:N,datetimeRegex:wi,ZodString:we,ZodNumber:Ge,ZodBigInt:He,ZodBoolean:jt,ZodDate:ot,ZodSymbol:gn,ZodUndefined:$t,ZodNull:Ut,ZodAny:wt,ZodUnknown:st,ZodNever:$e,ZodVoid:yn,ZodArray:Se,ZodObject:Q,ZodUnion:Ft,ZodDiscriminatedUnion:En,ZodIntersection:Bt,ZodTuple:Pe,ZodRecord:Zt,ZodMap:vn,ZodSet:at,ZodFunction:_t,ZodLazy:Gt,ZodLiteral:Ht,ZodEnum:ze,ZodNativeEnum:zt,ZodPromise:St,ZodEffects:ke,ZodTransformer:ke,ZodOptional:Ae,ZodNullable:Ve,ZodDefault:Vt,ZodCatch:Kt,ZodNaN:_n,BRAND:va,ZodBranded:Os,ZodPipeline:Yt,ZodReadonly:Wt,custom:ki,Schema:N,ZodSchema:N,late:_a,get ZodFirstPartyTypeKind(){return C},coerce:ec,any:Ia,array:Oa,bigint:Sa,boolean:xi,date:ka,discriminatedUnion:Na,effect:Xs,enum:Ha,function:Ba,instanceof:ba,intersection:Ma,lazy:Za,literal:Ga,map:Ua,nan:wa,nativeEnum:za,never:Ra,null:xa,nullable:Wa,number:Ei,object:Pa,oboolean:qa,onumber:Ja,optional:Ka,ostring:Xa,pipeline:Qa,preprocess:Ya,promise:Va,record:$a,set:Fa,strictObject:Da,string:Ti,symbol:Ta,transformer:Xs,tuple:ja,undefined:Ea,union:La,unknown:Ca,void:Aa,NEVER:tc,ZodIssueCode:m,quotelessJson:Wo,ZodError:ye});const O=a.string().min(1).max(128).regex(/^[a-zA-Z0-9_-]+$/),qt=a.string().min(1).max(256).regex(/^[a-zA-Z0-9_][a-zA-Z0-9_.-]*$/),en=a.string().min(1).max(32768),R=a.string().regex(/^[a-f0-9]{12}$/),$n=a.string().regex(/^[A-Za-z0-9_.:-]{1,100}$/),tn=a.string().regex(/^\$\{[A-Za-z_][A-Za-z0-9_]*\}$/),Js=a.string().regex(/^[a-f0-9]{32}$/),Un=a.string().min(1).max(4096).regex(/^(\/|[A-Za-z]:[\\/])/),qs=/^[a-f0-9]{32}$/,Y=a.string().regex(/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/),Et=a.string().regex(/^[A-Za-z0-9_-]{1,128}$/),er=a.object({data_b64:a.string().min(1).max(1e6),mime_type:a.enum(["image/png","image/jpeg","image/gif","image/webp"])}).strict(),tr=2e5,nc=256,sc=100,nr=16,rc=256,ic=100,oc=200,ac=1e6,je=a.string().min(1).max(128).refine(e=>e!=="."&&e!==".."&&!e.includes("/")&&!e.includes("\\")&&[...e].every(t=>t.charCodeAt(0)>=32&&t.charCodeAt(0)!==127)),nn=a.object({kind:a.enum(["agent","team"]),name:je}).strict(),Fn=a.object({provider:a.string().min(1).max(128),model_id:a.string().min(1).max(512),reasoning_effort:a.string().min(1).max(64).nullable()}).strict(),sr=a.object({kind:a.enum(["role","specialist"]).optional(),description:a.string().max(8e3).optional(),instructions:a.string().max(8e3).optional(),tools:a.array(a.string().min(1).max(128)).max(256).optional(),effort:a.string().max(64).optional(),delegate:a.boolean().optional()}).strict(),rr=a.object({name:a.string().min(1).max(64).optional(),description:a.string().max(8e3).optional(),manager:je.optional(),members:a.array(a.object({role:je,count:a.number().int().min(1).max(16),kind:a.enum(["agent","team"])}).strict()).max(128).optional(),instructions:a.string().max(8e3).optional(),project:a.string().max(8e3).optional()}).strict(),cc=a.record(a.array(a.string().max(1024)).max(100)),ir=a.enum(["minutes","hours","days"]);function lc(e){return!/^\.+$/.test(e)}const uh=e=>cn.safeParse(e).success,cn=a.string().min(1).max(128).refine(e=>[...e].every(t=>t.charCodeAt(0)>=32&&t.charCodeAt(0)!==127&&t!=="/"&&t!=="\\")).refine(lc),or=a.enum(["str","int","float","bool","list","dict"]),ar=a.string().max(16384),dc=2e3,cr=a.string().min(1).max(dc),lr=a.string().min(1).max(64),dr=a.object({is_active:a.boolean().nullish(),one_time:a.boolean().nullish(),start_time_utc:a.string().max(64).nullish(),end_time_utc:a.string().max(64).nullish()}).strict(),uc=a.object({conversation_length:a.number().int().optional(),detail_length:a.number().int().optional(),max_learnings_history:a.number().int().optional(),hosting:a.string().max(256).optional(),model_name:a.string().max(1024).optional(),auto_save_conversation:a.boolean().optional()}).strict(),is=128,ur=2e3,fr=8e3,pr=64,hr=64,xn=e=>[...e].length,os=e=>e>=9&&e<=13||e>=28&&e<=32||e===133||e===160||e===5760||e>=8192&&e<=8202||e===8232||e===8233||e===8239||e===8287||e===12288,fc=e=>e===9||e===10||e===11||e===12||e===13||e===133,pc=e=>e<=31||e>=127&&e<=159,hc=e=>new RegExp("\\p{Cf}","u").test(String.fromCodePoint(e)),mc=e=>e>=8234&&e<=8238||e>=8294&&e<=8297,sn=(e,t)=>{for(const n of e)if(t(n.codePointAt(0)??0))return!0;return!1},Ii=e=>{const t=[...e];let n=0,s=t.length;for(;n<s&&os(t[n].codePointAt(0)??0);)n++;for(;s>n&&os(t[s-1].codePointAt(0)??0);)s--;return t.slice(n,s).join("")},gc=e=>{let t="",n=!1;for(const s of e){if(os(s.codePointAt(0)??0)){n=t.length>0;continue}n&&(t+=" ",n=!1),t+=s}return t};function yc(e){const t=Ii(e);if(!t)return"must not be empty";if(xn(t)>is)return`must be at most ${is} characters`;if(/[/\\:]/.test(t))return'must not contain "/", "\\" or ":"';if(sn(t,mc))return"must not contain Unicode bidirectional override characters";if(sn(t,fc))return"must not contain whitespace";if(sn(t,pc))return"must not contain control characters";if(sn(t,hc))return"must not contain invisible Unicode formatting characters";const n=[...t];return"-.".includes(n[0])||"-.".includes(n[n.length-1])?'must not begin or end with "-" or "."':null}function fh(e){return gc(Ii(e).normalize("NFKC").toLowerCase())}function vc(e){return e.trim()?xn(e)>ur?`must be at most ${ur} characters`:null:"must not be empty"}function _c(e){return e.trim()?xn(e)>fr?`must be at most ${fr} characters`:null:"must not be empty"}function bc(e){if(e.length>hr)return`must hold at most ${hr} items`;for(const t of e)if(!t.trim()||xn(t)>pr)return`must hold items of 1 to ${pr} characters`;return null}const wc=e=>yc(e)===null,Sc=a.string().refine(wc,{message:"That is not a name the hub can publish."}),kc=a.string().refine(e=>_c(e)===null,{message:"That instruction body cannot be published."}),Tc=a.string().refine(e=>vc(e)===null,{message:"That description cannot be published."}),Ec=a.array(a.string()).refine(e=>bc(e)===null,{message:"That tool list cannot be published."}),mr=a.object({name:Sc,description:Tc,instructions:kc,kind:a.enum(["role","specialist"]),when_to_use:a.string(),tools:Ec,effort:a.string(),delegate:a.boolean(),version:a.string(),categories:a.array(a.string()),tags:a.array(a.string())}).partial().strict(),xc=a.enum(["team","agent"]),Ic=a.string().min(1).max(64),Cc=a.string().min(1).max(256),Ci=/^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/,Bn=a.string().regex(Ci,{message:"Letters, digits, dot, underscore and dash; no spaces."}),Rc=["planning","active","qa","validation","done","paused","archived"],gr=a.enum(Rc),rn=a.string().regex(/^$|^\d{4}-\d{2}-\d{2}$/,"Dates are YYYY-MM-DD, or empty to clear."),yr=a.array(a.string().min(1).max(24)).max(8),qe=a.string().min(1).max(64),Ac=1e3,vr=240,_r=80,Oc=/^[a-z0-9][a-z0-9_-]{0,23}$/;function ph(e){return e?Ci.test(e)?null:"Names start with a letter or digit and may use letters, digits, dot, underscore or dash.":"Give the project a name."}function hh(e){return Oc.test(e)?null:"Tags are 1-24 characters of lowercase letters, digits, underscore or dash."}const Pc=a.discriminatedUnion("op",[a.object({op:a.literal("capabilities")}).strict(),a.object({op:a.literal("profiles.list")}).strict(),a.object({op:a.literal("profiles.get"),name:je}).strict(),a.object({op:a.literal("profiles.install"),name:je,requestId:Y}).strict(),a.object({op:a.literal("profiles.create"),name:je,requestId:Y,fields:sr.extend({description:a.string().max(8e3),instructions:a.string().min(1).max(8e3)})}).strict(),a.object({op:a.literal("profiles.update"),name:je,requestId:Y,fields:sr}).strict(),a.object({op:a.literal("teams.list")}).strict(),a.object({op:a.literal("teams.get"),name:je}).strict(),a.object({op:a.literal("teams.create"),requestId:Y,fields:rr.extend({name:a.string().min(1).max(64)})}).strict(),a.object({op:a.literal("teams.update"),name:je,requestId:Y,fields:rr}).strict(),a.object({op:a.literal("sessions.list"),limit:a.number().int().min(1).max(500).optional(),include_archived:a.boolean().optional(),include_peers:a.boolean().optional(),scope_kind:xc.optional(),scope_name:Ic.optional(),cursor:Cc.optional(),with_counts:a.boolean().optional()}).strict(),a.object({op:a.literal("sessions.search"),q:a.string().min(1).max(nc),limit:a.number().int().min(1).max(500).optional(),include_archived:a.boolean().optional()}).strict(),a.object({op:a.literal("sessions.archive"),sessionId:R,archived:a.boolean()}).strict(),a.object({op:a.literal("sessions.delete"),sessionId:R,confirmed:a.literal(!0)}).strict(),a.object({op:a.literal("sessions.create"),requestId:Y,cwd:a.string().min(1).max(4096),target:nn.optional(),model:Fn.optional(),draftId:R.optional()}).strict(),a.object({op:a.literal("sessions.preview"),requestId:Y,cwd:a.string().min(1).max(4096),target:nn.optional(),model:Fn.optional()}).strict(),a.object({op:a.literal("sessions.draft"),requestId:Y,cwd:a.string().min(1).max(4096),target:nn.optional(),model:Fn.optional()}).strict(),a.object({op:a.literal("sessions.get"),sessionId:R}).strict(),a.object({op:a.literal("sessions.history"),sessionId:R,beforeId:O.optional(),limit:a.number().int().min(1).max(500).optional()}).strict(),a.object({op:a.literal("sessions.checkpoints"),sessionId:R}).strict(),a.object({op:a.literal("sessions.checkpoints.warm"),sessionId:R,ids:a.array(O).max(nr).optional(),limit:a.number().int().min(1).max(nr).optional()}).strict(),a.object({op:a.literal("sessions.find"),sessionId:R,q:a.string().min(1).max(rc),limit:a.number().int().min(1).max(oc).optional()}).strict(),a.object({op:a.literal("subagents.transcript"),sessionId:R,childId:R,beforeId:O.optional(),limit:a.number().int().min(1).max(500).optional()}).strict(),a.object({op:a.literal("sessions.message"),sessionId:R,requestId:Y,text:a.string().max(tr),images:a.array(er).max(8).optional(),mode:a.enum(["prompt","steer"]).optional(),inputMode:a.enum(["typed","dictated","mixed"]).optional(),inputPath:a.string().max(1024).optional()}).strict(),a.object({op:a.literal("sessions.command"),sessionId:R,requestId:Y,command:a.string().regex(/^\/?[A-Za-z]+$/).max(64),args:a.string().max(tr).optional(),images:a.array(er).max(8).optional()}).strict(),a.object({op:a.literal("sessions.move"),sessionId:R,requestId:Y,cwd:a.string().min(1).max(4096)}).strict(),a.object({op:a.literal("sessions.answer"),sessionId:R,epoch:O,requestId:O,value:a.string().max(32768).optional(),approved:a.boolean().optional(),questionIndex:a.number().int().min(0).optional()}).strict(),a.object({op:a.literal("sessions.seen"),sessionId:R,completionToken:a.string().uuid()}).strict(),a.object({op:a.literal("attention.seen"),items:a.array(a.object({sessionId:R,completionToken:a.string().uuid()}).strict()).min(1).max(500)}).strict(),a.object({op:a.literal("sessions.notified"),sessionId:R,completionToken:a.string().uuid()}).strict(),a.object({op:a.literal("sessions.pin"),sessionId:R,pinned:a.boolean()}).strict(),a.object({op:a.literal("sessions.watch"),sessionId:R,subscriptionId:a.string().regex(qs),visible:a.boolean(),canNotify:a.boolean()}).strict(),a.object({op:a.literal("sessions.warm"),sessionId:R}).strict(),a.object({op:a.literal("sessions.interrupt"),sessionId:R,requestId:Y}).strict(),a.object({op:a.literal("sessions.variables.list"),sessionId:R}).strict(),a.object({op:a.literal("sessions.variables.create"),sessionId:R,key:cn,value:ar,type:or}).strict(),a.object({op:a.literal("sessions.variables.update"),sessionId:R,key:cn,value:ar,type:or}).strict(),a.object({op:a.literal("sessions.variables.delete"),sessionId:R,key:cn}).strict(),a.object({op:a.literal("sessions.presence"),subscriptionId:a.string().regex(/^[a-f0-9]{1,64}$/),canNotify:a.boolean(),canNotifyKinds:a.array(a.enum(["complete","error"])).max(4),sessionId:a.string().regex(/^([a-f0-9]{12})?$/),window:a.object({exists:a.boolean(),focused:a.boolean(),visible:a.boolean(),minimized:a.boolean()}).strict()}).strict(),a.object({op:a.literal("legacy.models"),provider:a.string().max(128).optional(),sort:a.enum(["id","name","provider","recommended"]).optional(),direction:a.enum(["ascending","descending"]).optional()}).strict(),a.object({op:a.literal("legacy.models.providers")}).strict(),a.object({op:a.literal("auth.probe"),provider:O}).strict(),a.object({op:a.literal("legacy.agent.upload"),agentId:O}).strict(),a.object({op:a.literal("agent.publish"),agentId:O,document:mr.optional(),visibility:a.literal("org").optional(),tenantId:O.optional()}).strict(),a.object({op:a.literal("agent.republish"),agentId:O,hubAgentId:O,document:mr.optional(),visibility:a.literal("org").optional(),tenantId:O.optional()}).strict(),a.object({op:a.literal("team.pull"),teamId:O,tenantId:O.optional()}).strict(),a.object({op:a.literal("agent.nameAvailability"),name:a.string().min(1).max(is)}).strict(),a.object({op:a.literal("legacy.agents.list"),page:a.number().int().min(1).optional(),perPage:a.number().int().min(1).max(500).optional(),name:a.string().max(256).optional(),sort:a.string().max(64).optional(),direction:a.enum(["asc","desc"]).optional()}).strict(),a.object({op:a.literal("legacy.agent.get"),agentId:O}).strict(),a.object({op:a.literal("legacy.agent.history"),agentId:O,page:a.number().int().min(1).optional(),perPage:a.number().int().min(1).max(500).optional()}).strict(),a.object({op:a.literal("legacy.jobs.list"),agentId:O.optional(),status:a.string().max(64).optional()}).strict(),a.object({op:a.literal("legacy.job.get"),jobId:O}).strict(),a.object({op:a.literal("legacy.schedules.list"),page:a.number().int().min(1).optional(),perPage:a.number().int().min(1).max(100).optional()}).strict(),a.object({op:a.literal("legacy.agent.schedules.list"),agentId:O,page:a.number().int().min(1).optional(),perPage:a.number().int().min(1).max(100).optional()}).strict(),a.object({op:a.literal("legacy.agent.schedule.create"),agentId:O,schedule:dr.extend({prompt:a.string().max(64e3),interval:a.number().int().min(1),unit:ir})}).strict(),a.object({op:a.literal("legacy.schedule.get"),scheduleId:O}).strict(),a.object({op:a.literal("legacy.schedule.edit"),scheduleId:O,schedule:dr.extend({prompt:a.string().max(64e3).nullish(),interval:a.number().int().min(1).nullish(),unit:ir.nullish()})}).strict(),a.object({op:a.literal("legacy.schedule.remove"),scheduleId:O}).strict(),a.object({op:a.literal("legacy.agent.create"),agent:a.record(a.unknown())}).strict(),a.object({op:a.literal("legacy.agent.update"),agentId:O,update:a.record(a.unknown())}).strict(),a.object({op:a.literal("legacy.agent.delete"),agentId:O}).strict(),a.object({op:a.literal("legacy.agent.conversation.clear"),agentId:O}).strict(),a.object({op:a.literal("legacy.agent.systemPrompt.get"),agentId:O}).strict(),a.object({op:a.literal("legacy.agent.systemPrompt.update"),agentId:O,systemPrompt:a.string().max(ac)}).strict(),a.object({op:a.literal("legacy.agent.download"),agentId:O}).strict(),a.object({op:a.literal("legacy.job.cancel"),jobId:O}).strict(),a.object({op:a.literal("commands.list")}).strict(),a.object({op:a.literal("commands.entities"),sessionId:R,command:O,name:a.string().max(128).optional()}).strict(),a.object({op:a.literal("models.catalogue"),live:a.boolean().optional()}).strict(),a.object({op:a.literal("usage.get"),provider:O.optional(),live:a.boolean().optional(),refresh:a.boolean().optional()}).strict(),a.object({op:a.literal("analytics.get"),sessionId:R.optional(),sinceMs:a.number().int().nonnegative().optional(),untilMs:a.number().int().nonnegative().optional(),days:a.number().int().min(1).max(366).optional()}).strict(),a.object({op:a.literal("analytics.models"),sessionId:R.optional(),sinceMs:a.number().int().nonnegative().optional(),untilMs:a.number().int().nonnegative().optional(),days:a.number().int().min(1).max(366).optional()}).strict(),a.object({op:a.literal("info.get")}).strict(),a.object({op:a.literal("sessions.report"),sessionId:R,recentLimit:a.number().int().min(0).max(50).optional()}).strict(),a.object({op:a.literal("skills.list"),sessionId:R,name:O.optional()}).strict(),a.object({op:a.literal("sessions.failovers"),sessionId:R}).strict(),a.object({op:a.literal("sessions.credential"),sessionId:R,action:a.enum(["list","store","forget"]),key:qt.optional(),value:en.optional(),confirmed:a.boolean().optional()}).strict(),a.object({op:a.literal("sessions.fork"),sessionId:R,requestId:Y,message:a.string().max(2e5).optional(),boundary:a.literal("next_safe").optional()}).strict(),a.object({op:a.literal("sessions.stop"),requestId:Y,targets:a.array(R).min(1).max(100),confirmed:a.literal(!0)}).strict(),a.object({op:a.literal("sessions.aside"),sessionId:R,requestId:Y,text:a.string().min(1).max(32768),asideId:Y.optional(),subscriptionId:a.string().regex(qs).optional()}).strict(),a.object({op:a.literal("sessions.adopt"),sessionId:R,requestId:Y,asideId:Y,confirmed:a.literal(!0)}).strict(),a.object({op:a.literal("sessions.aside.get"),sessionId:R,asideId:Y}).strict(),a.object({op:a.literal("sessions.aside.close"),sessionId:R,asideId:Y}).strict(),a.object({op:a.literal("wakes.list"),limit:a.number().int().min(1).max(500).optional(),includeDormant:a.boolean().optional()}).strict(),a.object({op:a.literal("wakes.create"),requestId:Y,sessionId:R.optional(),cwd:a.string().min(1).max(4096).optional(),target:nn.optional(),message:cr,in:a.string().min(1).max(64).optional(),at:a.string().min(1).max(64).optional(),every:a.string().min(1).max(64).optional(),until:a.string().min(1).max(64).optional(),limit:a.number().int().min(1).optional(),title:a.string().min(1).max(200).optional()}).strict(),a.object({op:a.literal("wakes.edit"),sessionId:R,wakeId:lr,message:cr.optional(),in:a.string().min(1).max(64).optional(),at:a.string().min(1).max(64).optional(),every:a.string().min(1).max(64).optional(),until:a.string().min(1).max(64).optional(),limit:a.number().int().min(1).optional()}).strict(),a.object({op:a.literal("wakes.remove"),sessionId:R,wakeId:lr}).strict(),a.object({op:a.literal("mcp.list"),sessionId:R}).strict(),a.object({op:a.literal("mcp.credentials.store"),sessionId:R,name:a.string().min(1).max(256),values:a.record(a.string().min(1).max(128),a.string().min(1).max(32768)).refine(e=>Object.keys(e).length<=32&&Object.values(e).reduce((t,n)=>t+n.length,0)<=65536,{message:"Too many secret values, or too much secret text, for one MCP credential write."}),confirmedReplace:a.array(a.string().min(1).max(128)).max(32)}).strict(),a.object({op:a.literal("mcp.control"),sessionId:R,control:a.object({action:a.enum(["list","add","remove","reload","connect","probe","disconnect","login","logout","reauth","status","cancel"]),name:$n.optional(),scope:a.enum(["global","project"]).optional(),command:a.string().min(1).max(4096).optional(),args:a.array(a.string().max(8192)).max(128).optional(),env:a.record(tn).optional(),url:a.string().max(4096).optional(),headers:a.record(tn).optional(),oauth:a.boolean().optional(),confirmed:a.boolean().optional(),operation_id:Js.optional()}).strict()}).strict(),a.object({op:a.literal("mcp.catalog"),cwd:Un.optional(),sessionId:R.optional()}).strict(),a.object({op:a.literal("mcp.catalog.control"),cwd:Un.optional(),control:a.object({action:a.enum(["add","remove","test","login","reauth","logout","status","cancel"]),name:$n.optional(),scope:a.enum(["global","project"]).optional(),command:a.string().min(1).max(4096).optional(),args:a.array(a.string().max(8192)).max(128).optional(),env:a.record(tn).optional(),url:a.string().max(4096).optional(),headers:a.record(tn).optional(),confirmed:a.boolean().optional(),operation_id:Js.optional()}).strict()}).strict(),a.object({op:a.literal("mcp.catalog.credentials"),header:a.string().min(1).max(128).optional(),cwd:Un.optional(),name:$n,values:a.record(a.string().min(1).max(128),a.string().min(1).max(32768)).refine(e=>Object.keys(e).length<=32&&Object.values(e).reduce((t,n)=>t+n.length,0)<=65536,{message:"Too many secret values, or too much secret text, for one MCP credential write."}),confirmedReplace:a.array(a.string().min(1).max(128)).max(32)}).strict(),a.object({op:a.literal("radient.request"),control:a.object({operation:a.enum(["account","prices","credits","usage","provision","application.create","agents.list","agents.get","agents.create","agents.update","agents.delete","agents.like","agents.unlike","agents.liked","agents.like_count","agents.favourite","agents.unfavourite","agents.favourited","agents.favourite_count","agents.download_count","agents.statuses","comments.list","comments.create","comments.update","comments.delete","account.agents","memberships.list","org_agents.list","org_team.get","org_teams.list"]),request_id:Y.optional(),tenant_id:O.optional(),account_id:O.optional(),agent_id:O.optional(),comment_id:O.optional(),team_id:O.optional(),query:a.record(a.union([a.string().max(1024),a.number().int()])).optional(),payload:a.record(a.unknown()).optional(),confirmed:a.boolean().optional()}).strict()}).strict(),a.object({op:a.literal("providers.list")}).strict(),a.object({op:a.literal("accounts.list")}).strict(),a.object({op:a.literal("accounts.remove"),accountId:a.number().int().positive(),confirmed:a.literal(!0)}).strict(),a.object({op:a.literal("auth.start"),provider:O}).strict(),a.object({op:a.literal("auth.status"),id:O}).strict(),a.object({op:a.literal("auth.input"),id:O,promptId:O,value:en}).strict(),a.object({op:a.literal("auth.cancel"),id:O}).strict(),a.object({op:a.literal("auth.key"),provider:O,value:en}).strict(),a.object({op:a.literal("auth.logout"),provider:O}).strict(),a.object({op:a.literal("settings.list")}).strict(),a.object({op:a.literal("settings.edit"),key:qt,value:a.unknown().refine(e=>e!==void 0,"A setting value is required."),base:cc.optional()}).strict(),a.object({op:a.literal("settings.reset"),key:qt}).strict(),a.object({op:a.literal("config.get")}).strict(),a.object({op:a.literal("config.update"),value:uc}).strict(),a.object({op:a.literal("instructions.get")}).strict(),a.object({op:a.literal("instructions.update"),content:a.string().max(64e3)}).strict(),a.object({op:a.literal("credentials.list")}).strict(),a.object({op:a.literal("credentials.update"),key:qt,value:en}).strict(),a.object({op:a.literal("peers.list")}).strict(),a.object({op:a.literal("networks.list")}).strict(),a.object({op:a.literal("networks.invite"),networkId:Et,role:a.enum(["read","drive","admin"]),deviceId:Et.optional()}).strict(),a.object({op:a.literal("networks.member.remove"),networkId:Et,deviceId:Et,confirm:a.string().min(1).max(256)}).strict(),a.object({op:a.literal("sessions.transfer"),sessionId:R,to:a.union([a.literal("local"),Et]),keep:a.boolean().optional(),waitS:a.number().min(0).max(300).optional(),requestId:Y.optional()}).strict(),a.object({op:a.literal("projects.list")}).strict(),a.object({op:a.literal("projects.get"),key:qe}).strict(),a.object({op:a.literal("projects.create"),name:Bn,description:a.string().max(vr).optional(),status:gr.optional(),tags:yr.optional()}).strict(),a.object({op:a.literal("projects.update"),key:qe,fields:a.object({name:Bn.optional(),title:a.string().max(80).optional(),owner:a.string().max(80).optional(),team:a.string().max(80).optional(),description:a.string().max(vr).optional(),status:gr.optional(),progress:a.string().max(Ac).optional(),tags:yr.optional(),start_date:rn.optional(),target_date:rn.optional(),completed_at:rn.optional(),estimate:a.number().positive().max(1e3).optional(),estimate_unit:a.enum(["points","days"]).optional()}).strict()}).strict(),a.object({op:a.literal("projects.delete"),key:qe,confirmed_name:Bn}).strict(),a.object({op:a.literal("projects.link"),key:qe,sessionId:R}).strict(),a.object({op:a.literal("projects.unlink"),key:qe,sessionId:R}).strict(),a.object({op:a.literal("projects.milestone"),key:qe,name:a.string().min(1).max(_r),targetDate:rn.optional(),completed:a.boolean().optional()}).strict(),a.object({op:a.literal("projects.milestone.remove"),key:qe,name:a.string().min(1).max(_r)}).strict(),a.object({op:a.literal("aida.status")}).strict(),a.object({op:a.literal("aida.control"),action:a.enum(["open","pause","resume","greet","status"])}).strict()]);Pc.superRefine((e,t)=>{e.op!=="agent.publish"&&e.op!=="agent.republish"||e.visibility==="org"!=!!e.tenantId&&t.addIssue({code:a.ZodIssueCode.custom,message:'A publication target needs both `visibility: "org"` and `tenantId`, or neither: one half would publish to the public hub.'})});const _e={noCredential:"pairing.no-credential",refused:"pairing.refused",planeClosed:"pairing.plane-closed",transportFailed:"transport.failed"},Dc={runtimeUnreachable:"runtime_unreachable"},Ps="runtime_busy",Ri="runtime_retiring",Ds={[_e.noCredential]:"This app is not paired with the running Local Operator server, so this control is unavailable.",[_e.refused]:"This app's credential for the running Local Operator server was refused, so this control is unavailable.",[_e.planeClosed]:"The running Local Operator server does not accept this app's desktop controls.",[_e.transportFailed]:"The Local Operator server did not answer this request."},as={noCredential:"Restart with a desktop-managed backend to use these controls.",transportFailed:"The backend could not complete this request. Check its connection and try again."};function Ls(e){return e!==void 0&&Object.values(_e).includes(e)}function Lc(e,t){if(e.startsWith("/v1/desktop/")){if(t===401||t===403)return _e.refused;if(t===503)return _e.planeClosed}}const Nc=88e4,Mc=11e5,jc=2e4,$c=9e4,Uc=new Set(["analytics.get","analytics.models","sessions.report"]),Fc=new Set(["usage.get"]),Bc=new Set(["networks.list","peers.list"]),Zc=new Set([...Uc,...Fc,...Bc]),Gc=90,Hc=30,zc=300,Vc=10,Kc=15,Wc=1e4;function Yc(e){const n=e.to==="local"||e.keep?zc:Hc,s=Math.max(0,e.waitS??0);return(Gc+n+Vc+Kc)*1e3+s*1e3}function Qc(e){if(typeof e!="string"&&e.op==="sessions.transfer")return Yc(e)+Wc;const t=typeof e=="string"?e:e.op;return Zc.has(t)?$c:jc}const Xc=5e3;function Ai(e){return Qc(e)+Xc}const Ns="deadline_exceeded",Oi="foreground_required",Pi="View these completions in the foreground before marking them read.",Jc=new Set(["capabilities","accounts.list","analytics.get","analytics.models","commands.entities","commands.list","config.get","credentials.list","info.get","instructions.get","legacy.agent.get","legacy.agent.history","legacy.agent.schedules.list","legacy.agents.list","legacy.job.get","legacy.jobs.list","legacy.models","legacy.models.providers","legacy.schedule.get","legacy.schedules.list","mcp.catalog","mcp.list","models.catalogue","networks.list","peers.list","profiles.get","profiles.list","providers.list","sessions.aside.get","sessions.checkpoints","sessions.failovers","sessions.find","sessions.get","sessions.history","sessions.list","sessions.preview","sessions.report","sessions.search","sessions.variables.list","skills.list","subagents.transcript","teams.get","teams.list","usage.get"]),qc=new Set(["analytics.get","analytics.models","networks.list","peers.list","usage.get","sessions.report","info.get","sessions.failovers"]);function el(e,t){const n=Math.round(t/1e3),s=Ns;return e==="sessions.transfer"?{code:s,message:`The app waits up to ${n} seconds for a move, and it was still running when the app stopped waiting. The move was asked for, so its outcome is unknown from here: read the session again before moving it anywhere else.`}:Jc.has(e)?{code:s,message:qc.has(e)?`The app waits up to ${n} seconds for this panel's data, and the read was still running when the app stopped waiting. Nothing was read; reopen the panel to ask again.`:`The app waits up to ${n} seconds for this read, and it was still running when the app stopped waiting. Nothing was read; ask again.`}:{code:s,message:`The app waits up to ${n} seconds for this request, and it was still running when the app stopped waiting. It may or may not have reached the server; check the result before repeating it.`}}const mh=Nc,gh=Mc;function tl(e){return e.sessionId?{session_id:e.sessionId}:{...e.cwd?{cwd:e.cwd}:{},...e.target?{target:e.target}:{}}}function br(e){return{...e.in!==void 0?{in:e.in}:{},...e.at!==void 0?{at:e.at}:{},...e.every!==void 0?{every:e.every}:{},...e.until!==void 0?{until:e.until}:{},...e.limit!==void 0?{limit:e.limit}:{}}}function wr(e){if(e.visibility==="org"!=!!e.tenantId)throw new Error('A publication target needs both `visibility: "org"` and `tenantId`, or neither: one half would publish to the public hub.')}function nl(e){switch(e.op){case"capabilities":return{path:"/v1/capabilities",method:"GET"};case"peers.list":return{path:"/v1/desktop/peers",method:"GET"};case"networks.list":return{path:"/v1/desktop/networks",method:"GET"};case"networks.invite":return{path:`/v1/desktop/networks/${encodeURIComponent(e.networkId)}/invite`,method:"POST",body:{role:e.role,device:e.deviceId??null}};case"networks.member.remove":return{path:`/v1/desktop/networks/${encodeURIComponent(e.networkId)}/members/${encodeURIComponent(e.deviceId)}`,method:"DELETE",body:{confirm:e.confirm}};case"sessions.transfer":return{path:`/v1/desktop/sessions/${encodeURIComponent(e.sessionId)}/transfer`,method:"POST",body:{to:e.to,keep:e.keep??!1,wait_s:e.waitS??0,...e.requestId?{request_id:e.requestId}:{}}};case"profiles.list":return{path:"/v1/desktop/profiles",method:"GET"};case"profiles.get":return{path:`/v1/desktop/profiles/${encodeURIComponent(e.name)}`,method:"GET"};case"profiles.install":return{path:"/v1/desktop/profiles/install",method:"POST",body:{request_id:e.requestId,name:e.name}};case"profiles.create":return{path:"/v1/desktop/profiles",method:"POST",body:{request_id:e.requestId,name:e.name,...e.fields}};case"profiles.update":return{path:`/v1/desktop/profiles/${encodeURIComponent(e.name)}`,method:"PATCH",body:{request_id:e.requestId,...e.fields}};case"teams.list":return{path:"/v1/desktop/teams",method:"GET"};case"teams.get":return{path:`/v1/desktop/teams/${encodeURIComponent(e.name)}`,method:"GET"};case"teams.create":return{path:"/v1/desktop/teams",method:"POST",body:{request_id:e.requestId,...e.fields}};case"teams.update":return{path:`/v1/desktop/teams/${encodeURIComponent(e.name)}`,method:"PATCH",body:{request_id:e.requestId,...e.fields}};case"sessions.list":{const t=new URLSearchParams;return t.set("limit",String(e.limit??100)),e.include_archived&&t.set("include_archived","true"),e.scope_kind&&t.set("scope_kind",e.scope_kind),e.scope_name&&t.set("scope_name",e.scope_name),e.cursor&&t.set("cursor",e.cursor),e.with_counts&&t.set("with_counts","true"),e.include_peers&&t.set("include_peers","true"),{path:`/v1/desktop/sessions?${t}`,method:"GET"}}case"sessions.search":{const t=new URLSearchParams({q:e.q,limit:String(e.limit??sc)});return e.include_archived&&t.set("include_archived","true"),{path:`/v1/desktop/sessions/search?${t}`,method:"GET"}}case"sessions.archive":return{path:`/v1/desktop/sessions/${e.sessionId}/archive`,method:"POST",body:{archived:e.archived}};case"sessions.delete":return{path:`/v1/desktop/sessions/${e.sessionId}`,method:"DELETE",body:{confirmed:!0}};case"sessions.create":return{path:"/v1/desktop/sessions",method:"POST",body:{request_id:e.requestId,cwd:e.cwd,...e.target?{target:e.target}:{},...e.model?{model:e.model}:{},...e.draftId?{draft_id:e.draftId}:{}}};case"sessions.preview":return{path:"/v1/desktop/sessions/preview",method:"POST",body:{request_id:e.requestId,cwd:e.cwd,...e.target?{target:e.target}:{},...e.model?{model:e.model}:{}}};case"sessions.draft":return{path:"/v1/desktop/sessions/draft",method:"POST",body:{request_id:e.requestId,cwd:e.cwd,...e.target?{target:e.target}:{},...e.model?{model:e.model}:{}}};case"sessions.get":return{path:`/v1/desktop/sessions/${e.sessionId}`,method:"GET"};case"sessions.history":{const t=new URLSearchParams({limit:String(e.limit??100)});return e.beforeId&&t.set("before_id",e.beforeId),{path:`/v1/desktop/sessions/${e.sessionId}/history?${t}`,method:"GET"}}case"sessions.checkpoints":return{path:`/v1/desktop/sessions/${e.sessionId}/checkpoints`,method:"GET"};case"sessions.checkpoints.warm":return{path:`/v1/desktop/sessions/${e.sessionId}/checkpoints/warm`,method:"POST",body:{...e.ids?{ids:e.ids}:{},...e.limit!==void 0?{limit:e.limit}:{}}};case"sessions.find":{const t=new URLSearchParams({q:e.q,limit:String(e.limit??ic)});return{path:`/v1/desktop/sessions/${e.sessionId}/find?${t}`,method:"GET"}}case"subagents.transcript":{const t=new URLSearchParams({limit:String(e.limit??100)});return e.beforeId&&t.set("before_id",e.beforeId),{path:`/v1/desktop/sessions/${e.sessionId}/children/${e.childId}/transcript?${t}`,method:"GET"}}case"sessions.message":return{path:`/v1/desktop/sessions/${e.sessionId}/messages`,method:"POST",body:{request_id:e.requestId,text:e.text,images:e.images??[],mode:e.mode??"prompt",...e.inputMode?{input_mode:e.inputMode}:{},...e.inputPath?{input_path:e.inputPath}:{}}};case"sessions.command":return{path:`/v1/desktop/sessions/${e.sessionId}/commands`,method:"POST",body:{request_id:e.requestId,command:e.command,args:e.args??"",images:e.images??[]}};case"sessions.answer":return{path:`/v1/desktop/sessions/${e.sessionId}/answers`,method:"POST",body:{epoch:e.epoch,request_id:e.requestId,value:e.value,approved:e.approved,question_index:e.questionIndex}};case"sessions.seen":return{path:`/v1/desktop/sessions/${e.sessionId}/seen`,method:"POST",body:{completion_token:e.completionToken}};case"attention.seen":return{path:"/v1/desktop/attention/seen",method:"POST",body:{items:e.items.map(t=>({session_id:t.sessionId,completion_token:t.completionToken}))}};case"sessions.notified":return{path:`/v1/desktop/sessions/${e.sessionId}/notified`,method:"POST",body:{completion_token:e.completionToken}};case"sessions.pin":return{path:`/v1/desktop/sessions/${e.sessionId}/pin`,method:"POST",body:{pinned:e.pinned}};case"sessions.watch":return{path:`/v1/desktop/sessions/${e.sessionId}/watch`,method:"POST",body:{subscription_id:e.subscriptionId,visible:e.visible,can_notify:e.canNotify}};case"sessions.presence":return{path:"/v1/desktop/presence",method:"POST",body:{subscription_id:e.subscriptionId,can_notify_kinds:e.canNotifyKinds,session_id:e.sessionId,window:e.window,can_notify:e.canNotify}};case"sessions.move":return{path:`/v1/desktop/sessions/${e.sessionId}/working-directory`,method:"POST",body:{request_id:e.requestId,cwd:e.cwd}};case"sessions.warm":return{path:`/v1/desktop/sessions/${e.sessionId}/warm`,method:"POST",body:{}};case"sessions.interrupt":return{path:`/v1/desktop/sessions/${e.sessionId}/interrupt`,method:"POST",body:{request_id:e.requestId}};case"sessions.variables.list":return{path:`/v1/desktop/sessions/${e.sessionId}/variables`,method:"GET"};case"sessions.variables.create":return{path:`/v1/desktop/sessions/${e.sessionId}/variables`,method:"POST",body:{key:e.key,value:e.value,type:e.type}};case"sessions.variables.update":return{path:`/v1/desktop/sessions/${e.sessionId}/variables/${encodeURIComponent(e.key)}`,method:"PATCH",body:{value:e.value,type:e.type}};case"sessions.variables.delete":return{path:`/v1/desktop/sessions/${e.sessionId}/variables/${encodeURIComponent(e.key)}`,method:"DELETE"};case"legacy.models":{const t=new URLSearchParams;return e.provider&&t.set("provider",e.provider),e.sort&&t.set("sort",e.sort),e.direction&&t.set("direction",e.direction),{path:t.size>0?`/v1/models?${t}`:"/v1/models",method:"GET"}}case"legacy.models.providers":return{path:"/v1/models/providers",method:"GET"};case"auth.probe":return{path:`/v1/auth/providers/${e.provider}/probe`,method:"POST"};case"legacy.agent.upload":return{path:`/v1/agents/${e.agentId}/upload`,method:"POST"};case"agent.publish":{wr(e);const t=new URLSearchParams;e.visibility==="org"&&e.tenantId&&(t.set("visibility","org"),t.set("tenant_id",e.tenantId));const n=t.toString();return{path:`/v1/agents/${e.agentId}/publish${n?`?${n}`:""}`,method:"POST",body:{document:e.document??{}}}}case"agent.republish":{wr(e);const t=new URLSearchParams;e.visibility==="org"&&e.tenantId&&(t.set("visibility","org"),t.set("tenant_id",e.tenantId));const n=t.toString();return{path:`/v1/agents/${e.agentId}/publish${n?`?${n}`:""}`,method:"PUT",body:{hub_agent_id:e.hubAgentId,document:e.document??{}}}}case"team.pull":{const t=new URLSearchParams;e.tenantId&&t.set("tenant_id",e.tenantId);const n=t.toString();return{path:`/v1/teams/pull/${e.teamId}${n?`?${n}`:""}`,method:"GET"}}case"agent.nameAvailability":return{path:`/v1/agent-name-availability?${new URLSearchParams({name:e.name})}`,method:"GET"};case"legacy.agents.list":{const t=new URLSearchParams({page:String(e.page??1),per_page:String(e.perPage??10)});return e.name&&t.set("name",e.name),e.sort&&t.set("sort",e.sort),e.direction&&t.set("direction",e.direction),{path:`/v1/agents?${t}`,method:"GET"}}case"legacy.agent.get":return{path:`/v1/agents/${e.agentId}`,method:"GET"};case"legacy.agent.history":{const t=new URLSearchParams({page:String(e.page??1),per_page:String(e.perPage??10)});return{path:`/v1/agents/${e.agentId}/history?${t}`,method:"GET"}}case"wakes.list":{const t=new URLSearchParams;return e.limit!==void 0&&t.set("limit",String(e.limit)),e.includeDormant!==void 0&&t.set("include_dormant",String(e.includeDormant)),{path:t.size>0?`/v1/desktop/wakes?${t}`:"/v1/desktop/wakes",method:"GET"}}case"wakes.create":return{path:"/v1/desktop/wakes",method:"POST",body:{request_id:e.requestId,...tl(e),message:e.message,...br(e)}};case"wakes.edit":return{path:`/v1/desktop/wakes/${e.sessionId}/${e.wakeId}`,method:"PATCH",body:{...e.message!==void 0?{message:e.message}:{},...br(e)}};case"wakes.remove":return{path:`/v1/desktop/wakes/${e.sessionId}/${e.wakeId}`,method:"DELETE"};case"legacy.jobs.list":{const t=new URLSearchParams;return e.agentId&&t.set("agent_id",e.agentId),e.status&&t.set("status",e.status),{path:t.size>0?`/v1/jobs?${t}`:"/v1/jobs",method:"GET"}}case"legacy.job.get":return{path:`/v1/jobs/${e.jobId}`,method:"GET"};case"legacy.schedules.list":return{path:`/v1/schedules?${new URLSearchParams({page:String(e.page??1),per_page:String(e.perPage??10)})}`,method:"GET"};case"legacy.agent.schedules.list":{const t=new URLSearchParams({page:String(e.page??1),per_page:String(e.perPage??10)});return{path:`/v1/agents/${e.agentId}/schedules?${t}`,method:"GET"}}case"legacy.agent.schedule.create":return{path:`/v1/agents/${e.agentId}/schedules`,method:"POST",body:e.schedule};case"legacy.schedule.get":return{path:`/v1/schedules/${e.scheduleId}`,method:"GET"};case"legacy.schedule.edit":return{path:`/v1/schedules/${e.scheduleId}`,method:"PATCH",body:e.schedule};case"legacy.schedule.remove":return{path:`/v1/schedules/${e.scheduleId}`,method:"DELETE"};case"legacy.agent.create":return{path:"/v1/agents",method:"POST",body:e.agent};case"legacy.agent.update":return{path:`/v1/agents/${e.agentId}`,method:"PATCH",body:e.update};case"legacy.agent.delete":return{path:`/v1/agents/${e.agentId}`,method:"DELETE"};case"legacy.agent.conversation.clear":return{path:`/v1/agents/${e.agentId}/conversation`,method:"DELETE"};case"legacy.agent.systemPrompt.get":return{path:`/v1/agents/${e.agentId}/system-prompt`,method:"GET"};case"legacy.agent.systemPrompt.update":return{path:`/v1/agents/${e.agentId}/system-prompt`,method:"PUT",body:{system_prompt:e.systemPrompt}};case"legacy.agent.download":return{path:`/v1/agents/${e.agentId}/download`,method:"GET"};case"legacy.job.cancel":return{path:`/v1/jobs/${e.jobId}`,method:"DELETE"};case"commands.list":return{path:"/v1/desktop/commands",method:"GET"};case"commands.entities":return{path:`/v1/desktop/sessions/${e.sessionId}/command-entities?command=${encodeURIComponent(e.command)}${e.name?`&name=${encodeURIComponent(e.name)}`:""}`,method:"GET"};case"models.catalogue":return{path:`/v1/desktop/models?live=${e.live??!1}`,method:"GET"};case"usage.get":{const t=new URLSearchParams({live:String(e.live??!1),refresh:String(e.refresh??!1)});return e.provider&&t.set("provider",e.provider),{path:`/v1/desktop/usage?${t}`,method:"GET"}}case"analytics.get":{const t=new URLSearchParams({days:String(e.days??30)});return e.sessionId&&t.set("session_id",e.sessionId),e.sinceMs!==void 0&&t.set("since_ms",String(e.sinceMs)),e.untilMs!==void 0&&t.set("until_ms",String(e.untilMs)),{path:`/v1/desktop/analytics?${t}`,method:"GET"}}case"analytics.models":{const t=new URLSearchParams({days:String(e.days??30)});return e.sessionId&&t.set("session_id",e.sessionId),e.sinceMs!==void 0&&t.set("since_ms",String(e.sinceMs)),e.untilMs!==void 0&&t.set("until_ms",String(e.untilMs)),{path:`/v1/desktop/analytics/models?${t}`,method:"GET"}}case"info.get":return{path:"/v1/desktop/info",method:"GET"};case"sessions.report":{const t=new URLSearchParams({recent_limit:String(e.recentLimit??12)});return{path:`/v1/desktop/sessions/${e.sessionId}/report?${t}`,method:"GET"}}case"skills.list":return{path:`/v1/desktop/skills?session_id=${e.sessionId}${e.name?`&name=${encodeURIComponent(e.name)}`:""}`,method:"GET"};case"sessions.failovers":return{path:`/v1/desktop/sessions/${e.sessionId}/failovers`,method:"GET"};case"sessions.credential":return{path:`/v1/desktop/sessions/${e.sessionId}/credentials`,method:"POST",body:{action:e.action,key:e.key,value:e.value,confirmed:e.confirmed}};case"sessions.fork":return{path:`/v1/desktop/sessions/${e.sessionId}/fork`,method:"POST",body:{request_id:e.requestId,message:e.message,boundary:e.boundary}};case"sessions.stop":return{path:"/v1/desktop/stop",method:"POST",body:{request_id:e.requestId,targets:e.targets,confirmed:e.confirmed}};case"sessions.aside":return{path:`/v1/desktop/sessions/${e.sessionId}/asides`,method:"POST",body:{request_id:e.requestId,text:e.text,aside_id:e.asideId,subscription_id:e.subscriptionId}};case"sessions.adopt":return{path:`/v1/desktop/sessions/${e.sessionId}/asides/${e.asideId}/adopt`,method:"POST",body:{request_id:e.requestId,confirmed:e.confirmed}};case"sessions.aside.get":case"sessions.aside.close":return{path:`/v1/desktop/sessions/${e.sessionId}/asides/${e.asideId}`,method:e.op==="sessions.aside.get"?"GET":"DELETE"};case"mcp.list":return{path:`/v1/desktop/sessions/${e.sessionId}/mcp`,method:"GET"};case"mcp.credentials.store":return{path:`/v1/desktop/sessions/${e.sessionId}/mcp/credentials`,method:"POST",body:{name:e.name,values:e.values,confirmed_replace:e.confirmedReplace}};case"mcp.control":return{path:`/v1/desktop/sessions/${e.sessionId}/mcp`,method:"POST",body:e.control};case"mcp.catalog":{const t=new URLSearchParams;e.cwd&&t.set("cwd",e.cwd),e.sessionId&&t.set("session_id",e.sessionId);const n=t.toString();return{path:n?`/v1/desktop/mcp?${n}`:"/v1/desktop/mcp",method:"GET"}}case"mcp.catalog.control":return{path:"/v1/desktop/mcp",method:"POST",body:{...e.control,...e.cwd?{cwd:e.cwd}:{}}};case"mcp.catalog.credentials":return{path:"/v1/desktop/mcp/credentials",method:"POST",body:{name:e.name,values:e.values,...e.header?{header:e.header}:{},confirmed_replace:e.confirmedReplace,...e.cwd?{cwd:e.cwd}:{}}};case"radient.request":return{path:"/v1/desktop/radient",method:"POST",body:e.control};case"providers.list":return{path:"/v1/auth/providers",method:"GET"};case"accounts.list":return{path:"/v1/auth/status",method:"GET"};case"accounts.remove":return{path:`/v1/auth/accounts/${e.accountId}`,method:"DELETE"};case"auth.start":return{path:"/v1/auth/login",method:"POST",body:{provider:e.provider}};case"auth.status":return{path:`/v1/auth/operations/${e.id}`,method:"GET"};case"auth.input":return{path:`/v1/auth/operations/${e.id}/input`,method:"POST",body:{prompt_id:e.promptId,value:e.value}};case"auth.cancel":return{path:`/v1/auth/operations/${e.id}`,method:"DELETE"};case"auth.key":return{path:`/v1/auth/providers/${e.provider}/key`,method:"PUT",body:{value:e.value}};case"auth.logout":return{path:`/v1/auth/providers/${e.provider}/credentials`,method:"DELETE"};case"settings.list":return{path:"/v1/settings",method:"GET"};case"settings.edit":return{path:`/v1/settings/${e.key}`,method:"PATCH",body:{value:e.value,base:e.base}};case"settings.reset":return{path:`/v1/settings/${e.key}/reset`,method:"POST"};case"config.get":return{path:"/v1/config",method:"GET"};case"config.update":return{path:"/v1/config",method:"PATCH",body:e.value};case"instructions.get":return{path:"/v1/config/system-prompt",method:"GET"};case"instructions.update":return{path:"/v1/config/system-prompt",method:"PATCH",body:{content:e.content}};case"credentials.list":return{path:"/v1/credentials",method:"GET"};case"credentials.update":return{path:"/v1/credentials",method:"PATCH",body:{key:e.key,value:e.value}};case"projects.list":return{path:"/v1/desktop/projects",method:"GET"};case"projects.get":return{path:`/v1/desktop/projects/${encodeURIComponent(e.key)}`,method:"GET"};case"projects.create":return{path:"/v1/desktop/projects",method:"POST",body:{name:e.name,...e.description!==void 0?{description:e.description}:{},...e.status!==void 0?{status:e.status}:{},...e.tags!==void 0?{tags:e.tags}:{}}};case"projects.update":return{path:`/v1/desktop/projects/${encodeURIComponent(e.key)}`,method:"PATCH",body:{...e.fields}};case"projects.delete":return{path:`/v1/desktop/projects/${encodeURIComponent(e.key)}`,method:"DELETE",body:{confirm:e.confirmed_name}};case"projects.link":return{path:`/v1/desktop/projects/${encodeURIComponent(e.key)}/links`,method:"POST",body:{session_id:e.sessionId}};case"projects.unlink":return{path:`/v1/desktop/projects/${encodeURIComponent(e.key)}/links/${encodeURIComponent(e.sessionId)}`,method:"DELETE"};case"projects.milestone":return{path:`/v1/desktop/projects/${encodeURIComponent(e.key)}/milestones`,method:"POST",body:{name:e.name,...e.targetDate!==void 0?{target_date:e.targetDate}:{},...e.completed!==void 0?{completed:e.completed}:{}}};case"projects.milestone.remove":return{path:`/v1/desktop/projects/${encodeURIComponent(e.key)}/milestones/${encodeURIComponent(e.name)}`,method:"DELETE"};case"aida.status":return{path:"/v1/desktop/aida",method:"GET"};case"aida.control":return{path:"/v1/desktop/aida",method:"POST",body:{op:e.action}}}}const yh=64,vh=64*1024*1024,Pt={notPaired:"This backend was not started with desktop controls.",serverDown:"The Local Operator server is not answering.",frameBudget:"The event stream exceeded its frame budget.",ended:"The event stream ended."},Sr={statement:"Lost the connection to this conversation — reconnect to keep reading.",action:"reconnect"},sl={statement:"The Local Operator server is not running — reconnect once it is back, or restart the app if it stays down.",action:"reconnect"},rl={statement:"This app is not paired with the Local Operator server, so this conversation cannot be read yet.",action:null},il={statement:"Could not load this conversation's history — reconnect to try again.",action:"reconnect"},ol={statement:"This conversation's updates were too large to display — reconnect to try again.",action:"reconnect"};function kr(e){return e?e===Pt.notPaired?rl:e===Pt.serverDown?sl:e===Pt.frameBudget?ol:Sr:Sr}async function Di(e){if(window.api?.desktop)try{return await al(window.api.desktop.request(e),e)}catch(n){throw n instanceof X?n:dl(n)?new Ke(Pi,Oi):new X(null,"Desktop controls could not reach the backend process.",n)}let t;try{t=await fetch("/__desktop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}catch(n){throw new X(null,"Desktop controls could not reach the backend process.",n)}if(!t.ok)throw new X(t.status,"Desktop controls need a compatible backend connection.");return t.json()}function al(e,t){const n=Ai(t);let s;return Promise.race([e,new Promise((r,i)=>{s=setTimeout(()=>{const o=el(t.op,n);i(new X(null,o.message,void 0,o.code))},n)})]).finally(()=>clearTimeout(s))}class X extends Error{status;cause;code;retryAfterMs;constructor(t,n,s,r,i){super(n),this.name="DesktopControlError",this.status=t,this.cause=s,this.code=r,this.retryAfterMs=i}}class Ke extends Error{code;constructor(t,n){super(t),this.name="UserFacingError",this.code=n}}function In(e,t){return e instanceof X||e instanceof Ke?Ls(e.code)?Ds[e.code]:e.message:t}function cl(e,t,n,s){return typeof s=="string"?s:n===as.noCredential?_e.noCredential:n===as.transportFailed?_e.transportFailed:Lc(nl(e).path,t)}async function ce(e){const t=await Di(e),n=t.body;if(t.status<200||t.status>=300){const s=typeof n?.detail=="string"?n.detail:typeof n?.detail?.message=="string"?n.detail.message:null;throw new X(t.status,s??"This server did not answer the request for its desktop controls.",void 0,cl(e,t.status,s,typeof n?.detail=="object"?n.detail?.code:void 0),typeof n?.detail=="object"&&typeof n.detail?.retry_after_ms=="number"&&Number.isFinite(n.detail.retry_after_ms)?n.detail.retry_after_ms:void 0)}return n?.result}function ll(e){return e instanceof X&&e.code===Ns}function _h(e){return e instanceof X?e.status===null||e.status===503:!1}function bh(e){return e instanceof Ke&&e.code===Oi}function dl(e){return e instanceof Error&&e.message.includes(Pi)}async function wh(e){const t=await Di(e);return new Response(t.status===204?null:JSON.stringify(t.body),{status:t.status,headers:{"Content-Type":"application/json"}})}async function Sh(e,t=!1){if(window.api?.desktop)return window.api.desktop.openAuthorization(e,t);const n=await ce({op:"auth.status",id:e});if(!n.auth_url)throw new Error("This sign-in is no longer waiting for a browser.");const s=new URL(n.auth_url);if(s.username||s.password||s.protocol!=="https:"&&!(s.protocol==="http:"&&["127.0.0.1","localhost","[::1]"].includes(s.hostname)))throw new Error("The provider returned an invalid sign-in address.");window.open(s.href,"_blank","noopener,noreferrer")}function ul(e,t){const n=window.api?.desktop?.stream;if(n){const i=n.subscribe(e,t);return()=>i.dispose()}const s=new URLSearchParams({session:e.sessionId});e.epoch&&s.set("epoch",e.epoch),e.afterSeq!==void 0&&s.set("after_seq",String(e.afterSeq)),s.set("frontend_replace","1");const r=new EventSource(`/__desktop/stream?${s}`);return r.onmessage=i=>{t({kind:"data",data:i.data})},r.onerror=()=>{r.readyState===EventSource.CLOSED&&(t({kind:"error",detail:Pt.ended}),r.close())},()=>{r.close(),t({kind:"end"})}}async function fl(e,t){const n=window.api?.desktop?.media;if(n)return n(e,t);const s=await fetch("/__desktop/media",{method:"POST",headers:{"x-desktop-media":JSON.stringify(e),"Content-Type":"application/octet-stream"},body:t?new Blob([t]):void 0}),r=s.headers.get("content-type")??"";if(!s.ok){let i="The media request failed.";if(r.includes("application/json"))try{const o=await s.json();typeof o.detail=="string"&&(i=o.detail)}catch{}return{status:s.status,kind:"error",detail:i,code:i===as.noCredential?_e.noCredential:void 0}}return r.includes("application/json")?{status:s.status,kind:"json",body:await s.json()}:{status:s.status,kind:"bytes",mimeType:r||"application/octet-stream",data:new Uint8Array(await s.arrayBuffer())}}function pl(e){return e.kind==="error"?Ls(e.code)?new Ke(Ds[e.code],e.code):new Error(e.detail):new Error("The media request returned an unexpected response.")}const kh="superseded_completion_token",Th="store_busy";function Eh(e,t,n){if(!e||typeof e!="object")return!1;const s=e;return s.unseen===!1&&s.conversation_id===`session/${t}`&&s.completion_token===n}function vt(e,t,n){return!t||t.conversation_id!==`session/${n}`||!Array.isArray(t.revision)||t.revision.length!==2||!t.revision.every(s=>Number.isSafeInteger(s)&&s>=0)||e?.conversation_id===t.conversation_id&&(t.revision[0]<e.revision[0]||t.revision[1]<e.revision[1])?e:t.supported===void 0&&e?.supported!==void 0?{...t,supported:e.supported}:t}function hl(e){const t=Number(e);return Number.isFinite(t)&&t>0?Math.round(t*1e3):null}const xh=e=>typeof e?.goal_status=="string",Ih=e=>(e?.goal??"").trim().length>0;function ml(e,t,n){return n.session_id!==t||n.payload.frontend.snapshot.session_id!==t||!e?!1:e.epoch===n.epoch&&n.seq>e.seq}const Li=/\s+/,gl=/[\\/]+$/,yl=/[\\/]/,Ni=`
1
+ import{c as As,p as gi}from"./ui-preferences-store-DjUQd2R7.js";import{r as T,j as De}from"./index-VKe88JN9.js";import{c as Tn}from"./textarea-BX6EeK34.js";var B;(function(e){e.assertEqual=r=>r;function t(r){}e.assertIs=t;function n(r){throw new Error}e.assertNever=n,e.arrayToEnum=r=>{const i={};for(const o of r)i[o]=o;return i},e.getValidEnumValues=r=>{const i=e.objectKeys(r).filter(c=>typeof r[r[c]]!="number"),o={};for(const c of i)o[c]=r[c];return e.objectValues(o)},e.objectValues=r=>e.objectKeys(r).map(function(i){return r[i]}),e.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{const i=[];for(const o in r)Object.prototype.hasOwnProperty.call(r,o)&&i.push(o);return i},e.find=(r,i)=>{for(const o of r)if(i(o))return o},e.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&isFinite(r)&&Math.floor(r)===r;function s(r,i=" | "){return r.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}e.joinValues=s,e.jsonStringifyReplacer=(r,i)=>typeof i=="bigint"?i.toString():i})(B||(B={}));var ts;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(ts||(ts={}));const b=B.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Me=e=>{switch(typeof e){case"undefined":return b.undefined;case"string":return b.string;case"number":return isNaN(e)?b.nan:b.number;case"boolean":return b.boolean;case"function":return b.function;case"bigint":return b.bigint;case"symbol":return b.symbol;case"object":return Array.isArray(e)?b.array:e===null?b.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?b.promise:typeof Map<"u"&&e instanceof Map?b.map:typeof Set<"u"&&e instanceof Set?b.set:typeof Date<"u"&&e instanceof Date?b.date:b.object;default:return b.unknown}},m=B.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Wo=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class ye extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){const n=t||function(i){return i.message},s={_errors:[]},r=i=>{for(const o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(r);else if(o.code==="invalid_return_type")r(o.returnTypeError);else if(o.code==="invalid_arguments")r(o.argumentsError);else if(o.path.length===0)s._errors.push(n(o));else{let c=s,l=0;for(;l<o.path.length;){const d=o.path[l];l===o.path.length-1?(c[d]=c[d]||{_errors:[]},c[d]._errors.push(n(o))):c[d]=c[d]||{_errors:[]},c=c[d],l++}}};return r(this),s}static assert(t){if(!(t instanceof ye))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,B.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n={},s=[];for(const r of this.issues)r.path.length>0?(n[r.path[0]]=n[r.path[0]]||[],n[r.path[0]].push(t(r))):s.push(t(r));return{formErrors:s,fieldErrors:n}}get formErrors(){return this.flatten()}}ye.create=e=>new ye(e);const bt=(e,t)=>{let n;switch(e.code){case m.invalid_type:e.received===b.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case m.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,B.jsonStringifyReplacer)}`;break;case m.unrecognized_keys:n=`Unrecognized key(s) in object: ${B.joinValues(e.keys,", ")}`;break;case m.invalid_union:n="Invalid input";break;case m.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${B.joinValues(e.options)}`;break;case m.invalid_enum_value:n=`Invalid enum value. Expected ${B.joinValues(e.options)}, received '${e.received}'`;break;case m.invalid_arguments:n="Invalid function arguments";break;case m.invalid_return_type:n="Invalid function return type";break;case m.invalid_date:n="Invalid date";break;case m.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:B.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case m.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case m.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case m.custom:n="Invalid input";break;case m.invalid_intersection_types:n="Intersection results could not be merged";break;case m.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case m.not_finite:n="Number must be finite";break;default:n=t.defaultError,B.assertNever(e)}return{message:n}};let yi=bt;function Yo(e){yi=e}function pn(){return yi}const hn=e=>{const{data:t,path:n,errorMaps:s,issueData:r}=e,i=[...n,...r.path||[]],o={...r,path:i};if(r.message!==void 0)return{...r,path:i,message:r.message};let c="";const l=s.filter(d=>!!d).slice().reverse();for(const d of l)c=d(o,{data:t,defaultError:c}).message;return{...r,path:i,message:c}},Qo=[];function y(e,t){const n=pn(),s=hn({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===bt?void 0:bt].filter(r=>!!r)});e.common.issues.push(s)}class ue{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const s=[];for(const r of n){if(r.status==="aborted")return A;r.status==="dirty"&&t.dirty(),s.push(r.value)}return{status:t.value,value:s}}static async mergeObjectAsync(t,n){const s=[];for(const r of n){const i=await r.key,o=await r.value;s.push({key:i,value:o})}return ue.mergeObjectSync(t,s)}static mergeObjectSync(t,n){const s={};for(const r of n){const{key:i,value:o}=r;if(i.status==="aborted"||o.status==="aborted")return A;i.status==="dirty"&&t.dirty(),o.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||r.alwaysSet)&&(s[i.value]=o.value)}return{status:t.value,value:s}}}const A=Object.freeze({status:"aborted"}),yt=e=>({status:"dirty",value:e}),pe=e=>({status:"valid",value:e}),ns=e=>e.status==="aborted",ss=e=>e.status==="dirty",it=e=>e.status==="valid",Mt=e=>typeof Promise<"u"&&e instanceof Promise;function mn(e,t,n,s){if(typeof t=="function"?e!==t||!0:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function vi(e,t,n,s,r){if(typeof t=="function"?e!==t||!0:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}var S;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(S||(S={}));var It,Ct;class Oe{constructor(t,n,s,r){this._cachedPath=[],this.parent=t,this.data=n,this._path=s,this._key=r}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Ys=(e,t)=>{if(it(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new ye(e.common.issues);return this._error=n,this._error}}};function D(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:s,description:r}=e;if(t&&(n||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:r}:{errorMap:(o,c)=>{var l,d;const{message:u}=e;return o.code==="invalid_enum_value"?{message:u??c.defaultError}:typeof c.data>"u"?{message:(l=u??s)!==null&&l!==void 0?l:c.defaultError}:o.code!=="invalid_type"?{message:c.defaultError}:{message:(d=u??n)!==null&&d!==void 0?d:c.defaultError}},description:r}}class N{get description(){return this._def.description}_getType(t){return Me(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Me(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new ue,ctx:{common:t.parent.common,data:t.data,parsedType:Me(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(Mt(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const s=this.safeParse(t,n);if(s.success)return s.data;throw s.error}safeParse(t,n){var s;const r={common:{issues:[],async:(s=n?.async)!==null&&s!==void 0?s:!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Me(t)},i=this._parseSync({data:t,path:r.path,parent:r});return Ys(r,i)}"~validate"(t){var n,s;const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Me(t)};if(!this["~standard"].async)try{const i=this._parseSync({data:t,path:[],parent:r});return it(i)?{value:i.value}:{issues:r.common.issues}}catch(i){!((s=(n=i?.message)===null||n===void 0?void 0:n.toLowerCase())===null||s===void 0)&&s.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(i=>it(i)?{value:i.value}:{issues:r.common.issues})}async parseAsync(t,n){const s=await this.safeParseAsync(t,n);if(s.success)return s.data;throw s.error}async safeParseAsync(t,n){const s={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Me(t)},r=this._parse({data:t,path:s.path,parent:s}),i=await(Mt(r)?r:Promise.resolve(r));return Ys(s,i)}refine(t,n){const s=r=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(r):n;return this._refinement((r,i)=>{const o=t(r),c=()=>i.addIssue({code:m.custom,...s(r)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(c(),!1)):o?!0:(c(),!1)})}refinement(t,n){return this._refinement((s,r)=>t(s)?!0:(r.addIssue(typeof n=="function"?n(s,r):n),!1))}_refinement(t){return new ke({schema:this,typeName:C.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return Ae.create(this,this._def)}nullable(){return Ve.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Se.create(this)}promise(){return St.create(this,this._def)}or(t){return Ft.create([this,t],this._def)}and(t){return Bt.create(this,t,this._def)}transform(t){return new ke({...D(this._def),schema:this,typeName:C.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new Vt({...D(this._def),innerType:this,defaultValue:n,typeName:C.ZodDefault})}brand(){return new Os({typeName:C.ZodBranded,type:this,...D(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new Kt({...D(this._def),innerType:this,catchValue:n,typeName:C.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return Yt.create(this,t)}readonly(){return Wt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Xo=/^c[^\s-]{8,}$/i,Jo=/^[0-9a-z]+$/,qo=/^[0-9A-HJKMNP-TV-Z]{26}$/i,ea=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,ta=/^[a-z0-9_-]{21}$/i,na=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,sa=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,ra=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ia="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let jn;const oa=/^(?:(?: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])$/,aa=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,ca=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,la=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,da=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ua=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,_i="((\\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])))",fa=new RegExp(`^${_i}$`);function bi(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`),t}function pa(e){return new RegExp(`^${bi(e)}$`)}function wi(e){let t=`${_i}T${bi(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function ha(e,t){return!!((t==="v4"||!t)&&oa.test(e)||(t==="v6"||!t)&&ca.test(e))}function ma(e,t){if(!na.test(e))return!1;try{const[n]=e.split("."),s=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),r=JSON.parse(atob(s));return!(typeof r!="object"||r===null||!r.typ||!r.alg||t&&r.alg!==t)}catch{return!1}}function ga(e,t){return!!((t==="v4"||!t)&&aa.test(e)||(t==="v6"||!t)&&la.test(e))}class we extends N{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==b.string){const i=this._getOrReturnCtx(t);return y(i,{code:m.invalid_type,expected:b.string,received:i.parsedType}),A}const s=new ue;let r;for(const i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(r=this._getOrReturnCtx(t,r),y(r,{code:m.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),s.dirty());else if(i.kind==="max")t.data.length>i.value&&(r=this._getOrReturnCtx(t,r),y(r,{code:m.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),s.dirty());else if(i.kind==="length"){const o=t.data.length>i.value,c=t.data.length<i.value;(o||c)&&(r=this._getOrReturnCtx(t,r),o?y(r,{code:m.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):c&&y(r,{code:m.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),s.dirty())}else if(i.kind==="email")ra.test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"email",code:m.invalid_string,message:i.message}),s.dirty());else if(i.kind==="emoji")jn||(jn=new RegExp(ia,"u")),jn.test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"emoji",code:m.invalid_string,message:i.message}),s.dirty());else if(i.kind==="uuid")ea.test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"uuid",code:m.invalid_string,message:i.message}),s.dirty());else if(i.kind==="nanoid")ta.test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"nanoid",code:m.invalid_string,message:i.message}),s.dirty());else if(i.kind==="cuid")Xo.test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"cuid",code:m.invalid_string,message:i.message}),s.dirty());else if(i.kind==="cuid2")Jo.test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"cuid2",code:m.invalid_string,message:i.message}),s.dirty());else if(i.kind==="ulid")qo.test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"ulid",code:m.invalid_string,message:i.message}),s.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{r=this._getOrReturnCtx(t,r),y(r,{validation:"url",code:m.invalid_string,message:i.message}),s.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"regex",code:m.invalid_string,message:i.message}),s.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(r=this._getOrReturnCtx(t,r),y(r,{code:m.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),s.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(r=this._getOrReturnCtx(t,r),y(r,{code:m.invalid_string,validation:{startsWith:i.value},message:i.message}),s.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(r=this._getOrReturnCtx(t,r),y(r,{code:m.invalid_string,validation:{endsWith:i.value},message:i.message}),s.dirty()):i.kind==="datetime"?wi(i).test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{code:m.invalid_string,validation:"datetime",message:i.message}),s.dirty()):i.kind==="date"?fa.test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{code:m.invalid_string,validation:"date",message:i.message}),s.dirty()):i.kind==="time"?pa(i).test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{code:m.invalid_string,validation:"time",message:i.message}),s.dirty()):i.kind==="duration"?sa.test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"duration",code:m.invalid_string,message:i.message}),s.dirty()):i.kind==="ip"?ha(t.data,i.version)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"ip",code:m.invalid_string,message:i.message}),s.dirty()):i.kind==="jwt"?ma(t.data,i.alg)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"jwt",code:m.invalid_string,message:i.message}),s.dirty()):i.kind==="cidr"?ga(t.data,i.version)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"cidr",code:m.invalid_string,message:i.message}),s.dirty()):i.kind==="base64"?da.test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"base64",code:m.invalid_string,message:i.message}),s.dirty()):i.kind==="base64url"?ua.test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"base64url",code:m.invalid_string,message:i.message}),s.dirty()):B.assertNever(i);return{status:s.value,value:t.data}}_regex(t,n,s){return this.refinement(r=>t.test(r),{validation:n,code:m.invalid_string,...S.errToObj(s)})}_addCheck(t){return new we({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...S.errToObj(t)})}url(t){return this._addCheck({kind:"url",...S.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...S.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...S.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...S.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...S.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...S.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...S.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...S.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...S.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...S.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...S.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...S.errToObj(t)})}datetime(t){var n,s;return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:(n=t?.offset)!==null&&n!==void 0?n:!1,local:(s=t?.local)!==null&&s!==void 0?s:!1,...S.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...S.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...S.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...S.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n?.position,...S.errToObj(n?.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...S.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...S.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...S.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...S.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...S.errToObj(n)})}nonempty(t){return this.min(1,S.errToObj(t))}trim(){return new we({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new we({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new we({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}we.create=e=>{var t;return new we({checks:[],typeName:C.ZodString,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...D(e)})};function ya(e,t){const n=(e.toString().split(".")[1]||"").length,s=(t.toString().split(".")[1]||"").length,r=n>s?n:s,i=parseInt(e.toFixed(r).replace(".","")),o=parseInt(t.toFixed(r).replace(".",""));return i%o/Math.pow(10,r)}class Ge extends N{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==b.number){const i=this._getOrReturnCtx(t);return y(i,{code:m.invalid_type,expected:b.number,received:i.parsedType}),A}let s;const r=new ue;for(const i of this._def.checks)i.kind==="int"?B.isInteger(t.data)||(s=this._getOrReturnCtx(t,s),y(s,{code:m.invalid_type,expected:"integer",received:"float",message:i.message}),r.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(s=this._getOrReturnCtx(t,s),y(s,{code:m.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),r.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(s=this._getOrReturnCtx(t,s),y(s,{code:m.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),r.dirty()):i.kind==="multipleOf"?ya(t.data,i.value)!==0&&(s=this._getOrReturnCtx(t,s),y(s,{code:m.not_multiple_of,multipleOf:i.value,message:i.message}),r.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(s=this._getOrReturnCtx(t,s),y(s,{code:m.not_finite,message:i.message}),r.dirty()):B.assertNever(i);return{status:r.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,S.toString(n))}gt(t,n){return this.setLimit("min",t,!1,S.toString(n))}lte(t,n){return this.setLimit("max",t,!0,S.toString(n))}lt(t,n){return this.setLimit("max",t,!1,S.toString(n))}setLimit(t,n,s,r){return new Ge({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:s,message:S.toString(r)}]})}_addCheck(t){return new Ge({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:S.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:S.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:S.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:S.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:S.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:S.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:S.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:S.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:S.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&B.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(n===null||s.value>n)&&(n=s.value):s.kind==="max"&&(t===null||s.value<t)&&(t=s.value)}return Number.isFinite(n)&&Number.isFinite(t)}}Ge.create=e=>new Ge({checks:[],typeName:C.ZodNumber,coerce:e?.coerce||!1,...D(e)});class He extends N{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==b.bigint)return this._getInvalidInput(t);let s;const r=new ue;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(s=this._getOrReturnCtx(t,s),y(s,{code:m.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),r.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(s=this._getOrReturnCtx(t,s),y(s,{code:m.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),r.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(s=this._getOrReturnCtx(t,s),y(s,{code:m.not_multiple_of,multipleOf:i.value,message:i.message}),r.dirty()):B.assertNever(i);return{status:r.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return y(n,{code:m.invalid_type,expected:b.bigint,received:n.parsedType}),A}gte(t,n){return this.setLimit("min",t,!0,S.toString(n))}gt(t,n){return this.setLimit("min",t,!1,S.toString(n))}lte(t,n){return this.setLimit("max",t,!0,S.toString(n))}lt(t,n){return this.setLimit("max",t,!1,S.toString(n))}setLimit(t,n,s,r){return new He({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:s,message:S.toString(r)}]})}_addCheck(t){return new He({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:S.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:S.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:S.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:S.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:S.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}He.create=e=>{var t;return new He({checks:[],typeName:C.ZodBigInt,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...D(e)})};class jt extends N{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==b.boolean){const s=this._getOrReturnCtx(t);return y(s,{code:m.invalid_type,expected:b.boolean,received:s.parsedType}),A}return pe(t.data)}}jt.create=e=>new jt({typeName:C.ZodBoolean,coerce:e?.coerce||!1,...D(e)});class ot extends N{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==b.date){const i=this._getOrReturnCtx(t);return y(i,{code:m.invalid_type,expected:b.date,received:i.parsedType}),A}if(isNaN(t.data.getTime())){const i=this._getOrReturnCtx(t);return y(i,{code:m.invalid_date}),A}const s=new ue;let r;for(const i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(r=this._getOrReturnCtx(t,r),y(r,{code:m.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),s.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(r=this._getOrReturnCtx(t,r),y(r,{code:m.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),s.dirty()):B.assertNever(i);return{status:s.value,value:new Date(t.data.getTime())}}_addCheck(t){return new ot({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:S.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:S.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}}ot.create=e=>new ot({checks:[],coerce:e?.coerce||!1,typeName:C.ZodDate,...D(e)});class gn extends N{_parse(t){if(this._getType(t)!==b.symbol){const s=this._getOrReturnCtx(t);return y(s,{code:m.invalid_type,expected:b.symbol,received:s.parsedType}),A}return pe(t.data)}}gn.create=e=>new gn({typeName:C.ZodSymbol,...D(e)});class $t extends N{_parse(t){if(this._getType(t)!==b.undefined){const s=this._getOrReturnCtx(t);return y(s,{code:m.invalid_type,expected:b.undefined,received:s.parsedType}),A}return pe(t.data)}}$t.create=e=>new $t({typeName:C.ZodUndefined,...D(e)});class Ut extends N{_parse(t){if(this._getType(t)!==b.null){const s=this._getOrReturnCtx(t);return y(s,{code:m.invalid_type,expected:b.null,received:s.parsedType}),A}return pe(t.data)}}Ut.create=e=>new Ut({typeName:C.ZodNull,...D(e)});class wt extends N{constructor(){super(...arguments),this._any=!0}_parse(t){return pe(t.data)}}wt.create=e=>new wt({typeName:C.ZodAny,...D(e)});class st extends N{constructor(){super(...arguments),this._unknown=!0}_parse(t){return pe(t.data)}}st.create=e=>new st({typeName:C.ZodUnknown,...D(e)});class $e extends N{_parse(t){const n=this._getOrReturnCtx(t);return y(n,{code:m.invalid_type,expected:b.never,received:n.parsedType}),A}}$e.create=e=>new $e({typeName:C.ZodNever,...D(e)});class yn extends N{_parse(t){if(this._getType(t)!==b.undefined){const s=this._getOrReturnCtx(t);return y(s,{code:m.invalid_type,expected:b.void,received:s.parsedType}),A}return pe(t.data)}}yn.create=e=>new yn({typeName:C.ZodVoid,...D(e)});class Se extends N{_parse(t){const{ctx:n,status:s}=this._processInputParams(t),r=this._def;if(n.parsedType!==b.array)return y(n,{code:m.invalid_type,expected:b.array,received:n.parsedType}),A;if(r.exactLength!==null){const o=n.data.length>r.exactLength.value,c=n.data.length<r.exactLength.value;(o||c)&&(y(n,{code:o?m.too_big:m.too_small,minimum:c?r.exactLength.value:void 0,maximum:o?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),s.dirty())}if(r.minLength!==null&&n.data.length<r.minLength.value&&(y(n,{code:m.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),s.dirty()),r.maxLength!==null&&n.data.length>r.maxLength.value&&(y(n,{code:m.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),s.dirty()),n.common.async)return Promise.all([...n.data].map((o,c)=>r.type._parseAsync(new Oe(n,o,n.path,c)))).then(o=>ue.mergeArray(s,o));const i=[...n.data].map((o,c)=>r.type._parseSync(new Oe(n,o,n.path,c)));return ue.mergeArray(s,i)}get element(){return this._def.type}min(t,n){return new Se({...this._def,minLength:{value:t,message:S.toString(n)}})}max(t,n){return new Se({...this._def,maxLength:{value:t,message:S.toString(n)}})}length(t,n){return new Se({...this._def,exactLength:{value:t,message:S.toString(n)}})}nonempty(t){return this.min(1,t)}}Se.create=(e,t)=>new Se({type:e,minLength:null,maxLength:null,exactLength:null,typeName:C.ZodArray,...D(t)});function gt(e){if(e instanceof Q){const t={};for(const n in e.shape){const s=e.shape[n];t[n]=Ae.create(gt(s))}return new Q({...e._def,shape:()=>t})}else return e instanceof Se?new Se({...e._def,type:gt(e.element)}):e instanceof Ae?Ae.create(gt(e.unwrap())):e instanceof Ve?Ve.create(gt(e.unwrap())):e instanceof Pe?Pe.create(e.items.map(t=>gt(t))):e}class Q extends N{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=B.objectKeys(t);return this._cached={shape:t,keys:n}}_parse(t){if(this._getType(t)!==b.object){const d=this._getOrReturnCtx(t);return y(d,{code:m.invalid_type,expected:b.object,received:d.parsedType}),A}const{status:s,ctx:r}=this._processInputParams(t),{shape:i,keys:o}=this._getCached(),c=[];if(!(this._def.catchall instanceof $e&&this._def.unknownKeys==="strip"))for(const d in r.data)o.includes(d)||c.push(d);const l=[];for(const d of o){const u=i[d],f=r.data[d];l.push({key:{status:"valid",value:d},value:u._parse(new Oe(r,f,r.path,d)),alwaysSet:d in r.data})}if(this._def.catchall instanceof $e){const d=this._def.unknownKeys;if(d==="passthrough")for(const u of c)l.push({key:{status:"valid",value:u},value:{status:"valid",value:r.data[u]}});else if(d==="strict")c.length>0&&(y(r,{code:m.unrecognized_keys,keys:c}),s.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const d=this._def.catchall;for(const u of c){const f=r.data[u];l.push({key:{status:"valid",value:u},value:d._parse(new Oe(r,f,r.path,u)),alwaysSet:u in r.data})}}return r.common.async?Promise.resolve().then(async()=>{const d=[];for(const u of l){const f=await u.key,p=await u.value;d.push({key:f,value:p,alwaysSet:u.alwaysSet})}return d}).then(d=>ue.mergeObjectSync(s,d)):ue.mergeObjectSync(s,l)}get shape(){return this._def.shape()}strict(t){return S.errToObj,new Q({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,s)=>{var r,i,o,c;const l=(o=(i=(r=this._def).errorMap)===null||i===void 0?void 0:i.call(r,n,s).message)!==null&&o!==void 0?o:s.defaultError;return n.code==="unrecognized_keys"?{message:(c=S.errToObj(t).message)!==null&&c!==void 0?c:l}:{message:l}}}:{}})}strip(){return new Q({...this._def,unknownKeys:"strip"})}passthrough(){return new Q({...this._def,unknownKeys:"passthrough"})}extend(t){return new Q({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Q({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:C.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new Q({...this._def,catchall:t})}pick(t){const n={};return B.objectKeys(t).forEach(s=>{t[s]&&this.shape[s]&&(n[s]=this.shape[s])}),new Q({...this._def,shape:()=>n})}omit(t){const n={};return B.objectKeys(this.shape).forEach(s=>{t[s]||(n[s]=this.shape[s])}),new Q({...this._def,shape:()=>n})}deepPartial(){return gt(this)}partial(t){const n={};return B.objectKeys(this.shape).forEach(s=>{const r=this.shape[s];t&&!t[s]?n[s]=r:n[s]=r.optional()}),new Q({...this._def,shape:()=>n})}required(t){const n={};return B.objectKeys(this.shape).forEach(s=>{if(t&&!t[s])n[s]=this.shape[s];else{let i=this.shape[s];for(;i instanceof Ae;)i=i._def.innerType;n[s]=i}}),new Q({...this._def,shape:()=>n})}keyof(){return Si(B.objectKeys(this.shape))}}Q.create=(e,t)=>new Q({shape:()=>e,unknownKeys:"strip",catchall:$e.create(),typeName:C.ZodObject,...D(t)});Q.strictCreate=(e,t)=>new Q({shape:()=>e,unknownKeys:"strict",catchall:$e.create(),typeName:C.ZodObject,...D(t)});Q.lazycreate=(e,t)=>new Q({shape:e,unknownKeys:"strip",catchall:$e.create(),typeName:C.ZodObject,...D(t)});class Ft extends N{_parse(t){const{ctx:n}=this._processInputParams(t),s=this._def.options;function r(i){for(const c of i)if(c.result.status==="valid")return c.result;for(const c of i)if(c.result.status==="dirty")return n.common.issues.push(...c.ctx.common.issues),c.result;const o=i.map(c=>new ye(c.ctx.common.issues));return y(n,{code:m.invalid_union,unionErrors:o}),A}if(n.common.async)return Promise.all(s.map(async i=>{const o={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(r);{let i;const o=[];for(const l of s){const d={...n,common:{...n.common,issues:[]},parent:null},u=l._parseSync({data:n.data,path:n.path,parent:d});if(u.status==="valid")return u;u.status==="dirty"&&!i&&(i={result:u,ctx:d}),d.common.issues.length&&o.push(d.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;const c=o.map(l=>new ye(l));return y(n,{code:m.invalid_union,unionErrors:c}),A}}get options(){return this._def.options}}Ft.create=(e,t)=>new Ft({options:e,typeName:C.ZodUnion,...D(t)});const Le=e=>e instanceof Gt?Le(e.schema):e instanceof ke?Le(e.innerType()):e instanceof Ht?[e.value]:e instanceof ze?e.options:e instanceof zt?B.objectValues(e.enum):e instanceof Vt?Le(e._def.innerType):e instanceof $t?[void 0]:e instanceof Ut?[null]:e instanceof Ae?[void 0,...Le(e.unwrap())]:e instanceof Ve?[null,...Le(e.unwrap())]:e instanceof Os||e instanceof Wt?Le(e.unwrap()):e instanceof Kt?Le(e._def.innerType):[];class En extends N{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==b.object)return y(n,{code:m.invalid_type,expected:b.object,received:n.parsedType}),A;const s=this.discriminator,r=n.data[s],i=this.optionsMap.get(r);return i?n.common.async?i._parseAsync({data:n.data,path:n.path,parent:n}):i._parseSync({data:n.data,path:n.path,parent:n}):(y(n,{code:m.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),A)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,s){const r=new Map;for(const i of n){const o=Le(i.shape[t]);if(!o.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const c of o){if(r.has(c))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(c)}`);r.set(c,i)}}return new En({typeName:C.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:r,...D(s)})}}function rs(e,t){const n=Me(e),s=Me(t);if(e===t)return{valid:!0,data:e};if(n===b.object&&s===b.object){const r=B.objectKeys(t),i=B.objectKeys(e).filter(c=>r.indexOf(c)!==-1),o={...e,...t};for(const c of i){const l=rs(e[c],t[c]);if(!l.valid)return{valid:!1};o[c]=l.data}return{valid:!0,data:o}}else if(n===b.array&&s===b.array){if(e.length!==t.length)return{valid:!1};const r=[];for(let i=0;i<e.length;i++){const o=e[i],c=t[i],l=rs(o,c);if(!l.valid)return{valid:!1};r.push(l.data)}return{valid:!0,data:r}}else return n===b.date&&s===b.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class Bt extends N{_parse(t){const{status:n,ctx:s}=this._processInputParams(t),r=(i,o)=>{if(ns(i)||ns(o))return A;const c=rs(i.value,o.value);return c.valid?((ss(i)||ss(o))&&n.dirty(),{status:n.value,value:c.data}):(y(s,{code:m.invalid_intersection_types}),A)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([i,o])=>r(i,o)):r(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}Bt.create=(e,t,n)=>new Bt({left:e,right:t,typeName:C.ZodIntersection,...D(n)});class Pe extends N{_parse(t){const{status:n,ctx:s}=this._processInputParams(t);if(s.parsedType!==b.array)return y(s,{code:m.invalid_type,expected:b.array,received:s.parsedType}),A;if(s.data.length<this._def.items.length)return y(s,{code:m.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),A;!this._def.rest&&s.data.length>this._def.items.length&&(y(s,{code:m.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const i=[...s.data].map((o,c)=>{const l=this._def.items[c]||this._def.rest;return l?l._parse(new Oe(s,o,s.path,c)):null}).filter(o=>!!o);return s.common.async?Promise.all(i).then(o=>ue.mergeArray(n,o)):ue.mergeArray(n,i)}get items(){return this._def.items}rest(t){return new Pe({...this._def,rest:t})}}Pe.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Pe({items:e,typeName:C.ZodTuple,rest:null,...D(t)})};class Zt extends N{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:s}=this._processInputParams(t);if(s.parsedType!==b.object)return y(s,{code:m.invalid_type,expected:b.object,received:s.parsedType}),A;const r=[],i=this._def.keyType,o=this._def.valueType;for(const c in s.data)r.push({key:i._parse(new Oe(s,c,s.path,c)),value:o._parse(new Oe(s,s.data[c],s.path,c)),alwaysSet:c in s.data});return s.common.async?ue.mergeObjectAsync(n,r):ue.mergeObjectSync(n,r)}get element(){return this._def.valueType}static create(t,n,s){return n instanceof N?new Zt({keyType:t,valueType:n,typeName:C.ZodRecord,...D(s)}):new Zt({keyType:we.create(),valueType:t,typeName:C.ZodRecord,...D(n)})}}class vn extends N{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:s}=this._processInputParams(t);if(s.parsedType!==b.map)return y(s,{code:m.invalid_type,expected:b.map,received:s.parsedType}),A;const r=this._def.keyType,i=this._def.valueType,o=[...s.data.entries()].map(([c,l],d)=>({key:r._parse(new Oe(s,c,s.path,[d,"key"])),value:i._parse(new Oe(s,l,s.path,[d,"value"]))}));if(s.common.async){const c=new Map;return Promise.resolve().then(async()=>{for(const l of o){const d=await l.key,u=await l.value;if(d.status==="aborted"||u.status==="aborted")return A;(d.status==="dirty"||u.status==="dirty")&&n.dirty(),c.set(d.value,u.value)}return{status:n.value,value:c}})}else{const c=new Map;for(const l of o){const d=l.key,u=l.value;if(d.status==="aborted"||u.status==="aborted")return A;(d.status==="dirty"||u.status==="dirty")&&n.dirty(),c.set(d.value,u.value)}return{status:n.value,value:c}}}}vn.create=(e,t,n)=>new vn({valueType:t,keyType:e,typeName:C.ZodMap,...D(n)});class at extends N{_parse(t){const{status:n,ctx:s}=this._processInputParams(t);if(s.parsedType!==b.set)return y(s,{code:m.invalid_type,expected:b.set,received:s.parsedType}),A;const r=this._def;r.minSize!==null&&s.data.size<r.minSize.value&&(y(s,{code:m.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),n.dirty()),r.maxSize!==null&&s.data.size>r.maxSize.value&&(y(s,{code:m.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),n.dirty());const i=this._def.valueType;function o(l){const d=new Set;for(const u of l){if(u.status==="aborted")return A;u.status==="dirty"&&n.dirty(),d.add(u.value)}return{status:n.value,value:d}}const c=[...s.data.values()].map((l,d)=>i._parse(new Oe(s,l,s.path,d)));return s.common.async?Promise.all(c).then(l=>o(l)):o(c)}min(t,n){return new at({...this._def,minSize:{value:t,message:S.toString(n)}})}max(t,n){return new at({...this._def,maxSize:{value:t,message:S.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}at.create=(e,t)=>new at({valueType:e,minSize:null,maxSize:null,typeName:C.ZodSet,...D(t)});class _t extends N{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==b.function)return y(n,{code:m.invalid_type,expected:b.function,received:n.parsedType}),A;function s(c,l){return hn({data:c,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,pn(),bt].filter(d=>!!d),issueData:{code:m.invalid_arguments,argumentsError:l}})}function r(c,l){return hn({data:c,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,pn(),bt].filter(d=>!!d),issueData:{code:m.invalid_return_type,returnTypeError:l}})}const i={errorMap:n.common.contextualErrorMap},o=n.data;if(this._def.returns instanceof St){const c=this;return pe(async function(...l){const d=new ye([]),u=await c._def.args.parseAsync(l,i).catch(w=>{throw d.addIssue(s(l,w)),d}),f=await Reflect.apply(o,this,u);return await c._def.returns._def.type.parseAsync(f,i).catch(w=>{throw d.addIssue(r(f,w)),d})})}else{const c=this;return pe(function(...l){const d=c._def.args.safeParse(l,i);if(!d.success)throw new ye([s(l,d.error)]);const u=Reflect.apply(o,this,d.data),f=c._def.returns.safeParse(u,i);if(!f.success)throw new ye([r(u,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new _t({...this._def,args:Pe.create(t).rest(st.create())})}returns(t){return new _t({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,s){return new _t({args:t||Pe.create([]).rest(st.create()),returns:n||st.create(),typeName:C.ZodFunction,...D(s)})}}class Gt extends N{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}Gt.create=(e,t)=>new Gt({getter:e,typeName:C.ZodLazy,...D(t)});class Ht extends N{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return y(n,{received:n.data,code:m.invalid_literal,expected:this._def.value}),A}return{status:"valid",value:t.data}}get value(){return this._def.value}}Ht.create=(e,t)=>new Ht({value:e,typeName:C.ZodLiteral,...D(t)});function Si(e,t){return new ze({values:e,typeName:C.ZodEnum,...D(t)})}class ze extends N{constructor(){super(...arguments),It.set(this,void 0)}_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),s=this._def.values;return y(n,{expected:B.joinValues(s),received:n.parsedType,code:m.invalid_type}),A}if(mn(this,It)||vi(this,It,new Set(this._def.values)),!mn(this,It).has(t.data)){const n=this._getOrReturnCtx(t),s=this._def.values;return y(n,{received:n.data,code:m.invalid_enum_value,options:s}),A}return pe(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return ze.create(t,{...this._def,...n})}exclude(t,n=this._def){return ze.create(this.options.filter(s=>!t.includes(s)),{...this._def,...n})}}It=new WeakMap;ze.create=Si;class zt extends N{constructor(){super(...arguments),Ct.set(this,void 0)}_parse(t){const n=B.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(t);if(s.parsedType!==b.string&&s.parsedType!==b.number){const r=B.objectValues(n);return y(s,{expected:B.joinValues(r),received:s.parsedType,code:m.invalid_type}),A}if(mn(this,Ct)||vi(this,Ct,new Set(B.getValidEnumValues(this._def.values))),!mn(this,Ct).has(t.data)){const r=B.objectValues(n);return y(s,{received:s.data,code:m.invalid_enum_value,options:r}),A}return pe(t.data)}get enum(){return this._def.values}}Ct=new WeakMap;zt.create=(e,t)=>new zt({values:e,typeName:C.ZodNativeEnum,...D(t)});class St extends N{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==b.promise&&n.common.async===!1)return y(n,{code:m.invalid_type,expected:b.promise,received:n.parsedType}),A;const s=n.parsedType===b.promise?n.data:Promise.resolve(n.data);return pe(s.then(r=>this._def.type.parseAsync(r,{path:n.path,errorMap:n.common.contextualErrorMap})))}}St.create=(e,t)=>new St({type:e,typeName:C.ZodPromise,...D(t)});class ke extends N{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===C.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:s}=this._processInputParams(t),r=this._def.effect||null,i={addIssue:o=>{y(s,o),o.fatal?n.abort():n.dirty()},get path(){return s.path}};if(i.addIssue=i.addIssue.bind(i),r.type==="preprocess"){const o=r.transform(s.data,i);if(s.common.async)return Promise.resolve(o).then(async c=>{if(n.value==="aborted")return A;const l=await this._def.schema._parseAsync({data:c,path:s.path,parent:s});return l.status==="aborted"?A:l.status==="dirty"||n.value==="dirty"?yt(l.value):l});{if(n.value==="aborted")return A;const c=this._def.schema._parseSync({data:o,path:s.path,parent:s});return c.status==="aborted"?A:c.status==="dirty"||n.value==="dirty"?yt(c.value):c}}if(r.type==="refinement"){const o=c=>{const l=r.refinement(c,i);if(s.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c};if(s.common.async===!1){const c=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return c.status==="aborted"?A:(c.status==="dirty"&&n.dirty(),o(c.value),{status:n.value,value:c.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(c=>c.status==="aborted"?A:(c.status==="dirty"&&n.dirty(),o(c.value).then(()=>({status:n.value,value:c.value}))))}if(r.type==="transform")if(s.common.async===!1){const o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!it(o))return o;const c=r.transform(o.value,i);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:c}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>it(o)?Promise.resolve(r.transform(o.value,i)).then(c=>({status:n.value,value:c})):o);B.assertNever(r)}}ke.create=(e,t,n)=>new ke({schema:e,typeName:C.ZodEffects,effect:t,...D(n)});ke.createWithPreprocess=(e,t,n)=>new ke({schema:t,effect:{type:"preprocess",transform:e},typeName:C.ZodEffects,...D(n)});class Ae extends N{_parse(t){return this._getType(t)===b.undefined?pe(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Ae.create=(e,t)=>new Ae({innerType:e,typeName:C.ZodOptional,...D(t)});class Ve extends N{_parse(t){return this._getType(t)===b.null?pe(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Ve.create=(e,t)=>new Ve({innerType:e,typeName:C.ZodNullable,...D(t)});class Vt extends N{_parse(t){const{ctx:n}=this._processInputParams(t);let s=n.data;return n.parsedType===b.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Vt.create=(e,t)=>new Vt({innerType:e,typeName:C.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...D(t)});class Kt extends N{_parse(t){const{ctx:n}=this._processInputParams(t),s={...n,common:{...n.common,issues:[]}},r=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return Mt(r)?r.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new ye(s.common.issues)},input:s.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new ye(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}Kt.create=(e,t)=>new Kt({innerType:e,typeName:C.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...D(t)});class _n extends N{_parse(t){if(this._getType(t)!==b.nan){const s=this._getOrReturnCtx(t);return y(s,{code:m.invalid_type,expected:b.nan,received:s.parsedType}),A}return{status:"valid",value:t.data}}}_n.create=e=>new _n({typeName:C.ZodNaN,...D(e)});const va=Symbol("zod_brand");class Os extends N{_parse(t){const{ctx:n}=this._processInputParams(t),s=n.data;return this._def.type._parse({data:s,path:n.path,parent:n})}unwrap(){return this._def.type}}class Yt extends N{_parse(t){const{status:n,ctx:s}=this._processInputParams(t);if(s.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return i.status==="aborted"?A:i.status==="dirty"?(n.dirty(),yt(i.value)):this._def.out._parseAsync({data:i.value,path:s.path,parent:s})})();{const r=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return r.status==="aborted"?A:r.status==="dirty"?(n.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:s.path,parent:s})}}static create(t,n){return new Yt({in:t,out:n,typeName:C.ZodPipeline})}}class Wt extends N{_parse(t){const n=this._def.innerType._parse(t),s=r=>(it(r)&&(r.value=Object.freeze(r.value)),r);return Mt(n)?n.then(r=>s(r)):s(n)}unwrap(){return this._def.innerType}}Wt.create=(e,t)=>new Wt({innerType:e,typeName:C.ZodReadonly,...D(t)});function Qs(e,t){const n=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof n=="string"?{message:n}:n}function ki(e,t={},n){return e?wt.create().superRefine((s,r)=>{var i,o;const c=e(s);if(c instanceof Promise)return c.then(l=>{var d,u;if(!l){const f=Qs(t,s),p=(u=(d=f.fatal)!==null&&d!==void 0?d:n)!==null&&u!==void 0?u:!0;r.addIssue({code:"custom",...f,fatal:p})}});if(!c){const l=Qs(t,s),d=(o=(i=l.fatal)!==null&&i!==void 0?i:n)!==null&&o!==void 0?o:!0;r.addIssue({code:"custom",...l,fatal:d})}}):wt.create()}const _a={object:Q.lazycreate};var C;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(C||(C={}));const ba=(e,t={message:`Input not instance of ${e.name}`})=>ki(n=>n instanceof e,t),Ti=we.create,Ei=Ge.create,wa=_n.create,Sa=He.create,xi=jt.create,ka=ot.create,Ta=gn.create,Ea=$t.create,xa=Ut.create,Ia=wt.create,Ca=st.create,Ra=$e.create,Aa=yn.create,Oa=Se.create,Pa=Q.create,Da=Q.strictCreate,La=Ft.create,Na=En.create,Ma=Bt.create,ja=Pe.create,$a=Zt.create,Ua=vn.create,Fa=at.create,Ba=_t.create,Za=Gt.create,Ga=Ht.create,Ha=ze.create,za=zt.create,Va=St.create,Xs=ke.create,Ka=Ae.create,Wa=Ve.create,Ya=ke.createWithPreprocess,Qa=Yt.create,Xa=()=>Ti().optional(),Ja=()=>Ei().optional(),qa=()=>xi().optional(),ec={string:e=>we.create({...e,coerce:!0}),number:e=>Ge.create({...e,coerce:!0}),boolean:e=>jt.create({...e,coerce:!0}),bigint:e=>He.create({...e,coerce:!0}),date:e=>ot.create({...e,coerce:!0})},tc=A;var a=Object.freeze({__proto__:null,defaultErrorMap:bt,setErrorMap:Yo,getErrorMap:pn,makeIssue:hn,EMPTY_PATH:Qo,addIssueToContext:y,ParseStatus:ue,INVALID:A,DIRTY:yt,OK:pe,isAborted:ns,isDirty:ss,isValid:it,isAsync:Mt,get util(){return B},get objectUtil(){return ts},ZodParsedType:b,getParsedType:Me,ZodType:N,datetimeRegex:wi,ZodString:we,ZodNumber:Ge,ZodBigInt:He,ZodBoolean:jt,ZodDate:ot,ZodSymbol:gn,ZodUndefined:$t,ZodNull:Ut,ZodAny:wt,ZodUnknown:st,ZodNever:$e,ZodVoid:yn,ZodArray:Se,ZodObject:Q,ZodUnion:Ft,ZodDiscriminatedUnion:En,ZodIntersection:Bt,ZodTuple:Pe,ZodRecord:Zt,ZodMap:vn,ZodSet:at,ZodFunction:_t,ZodLazy:Gt,ZodLiteral:Ht,ZodEnum:ze,ZodNativeEnum:zt,ZodPromise:St,ZodEffects:ke,ZodTransformer:ke,ZodOptional:Ae,ZodNullable:Ve,ZodDefault:Vt,ZodCatch:Kt,ZodNaN:_n,BRAND:va,ZodBranded:Os,ZodPipeline:Yt,ZodReadonly:Wt,custom:ki,Schema:N,ZodSchema:N,late:_a,get ZodFirstPartyTypeKind(){return C},coerce:ec,any:Ia,array:Oa,bigint:Sa,boolean:xi,date:ka,discriminatedUnion:Na,effect:Xs,enum:Ha,function:Ba,instanceof:ba,intersection:Ma,lazy:Za,literal:Ga,map:Ua,nan:wa,nativeEnum:za,never:Ra,null:xa,nullable:Wa,number:Ei,object:Pa,oboolean:qa,onumber:Ja,optional:Ka,ostring:Xa,pipeline:Qa,preprocess:Ya,promise:Va,record:$a,set:Fa,strictObject:Da,string:Ti,symbol:Ta,transformer:Xs,tuple:ja,undefined:Ea,union:La,unknown:Ca,void:Aa,NEVER:tc,ZodIssueCode:m,quotelessJson:Wo,ZodError:ye});const O=a.string().min(1).max(128).regex(/^[a-zA-Z0-9_-]+$/),qt=a.string().min(1).max(256).regex(/^[a-zA-Z0-9_][a-zA-Z0-9_.-]*$/),en=a.string().min(1).max(32768),R=a.string().regex(/^[a-f0-9]{12}$/),$n=a.string().regex(/^[A-Za-z0-9_.:-]{1,100}$/),tn=a.string().regex(/^\$\{[A-Za-z_][A-Za-z0-9_]*\}$/),Js=a.string().regex(/^[a-f0-9]{32}$/),Un=a.string().min(1).max(4096).regex(/^(\/|[A-Za-z]:[\\/])/),qs=/^[a-f0-9]{32}$/,Y=a.string().regex(/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/),Et=a.string().regex(/^[A-Za-z0-9_-]{1,128}$/),er=a.object({data_b64:a.string().min(1).max(1e6),mime_type:a.enum(["image/png","image/jpeg","image/gif","image/webp"])}).strict(),tr=2e5,nc=256,sc=100,nr=16,rc=256,ic=100,oc=200,ac=1e6,je=a.string().min(1).max(128).refine(e=>e!=="."&&e!==".."&&!e.includes("/")&&!e.includes("\\")&&[...e].every(t=>t.charCodeAt(0)>=32&&t.charCodeAt(0)!==127)),nn=a.object({kind:a.enum(["agent","team"]),name:je}).strict(),Fn=a.object({provider:a.string().min(1).max(128),model_id:a.string().min(1).max(512),reasoning_effort:a.string().min(1).max(64).nullable()}).strict(),sr=a.object({kind:a.enum(["role","specialist"]).optional(),description:a.string().max(8e3).optional(),instructions:a.string().max(8e3).optional(),tools:a.array(a.string().min(1).max(128)).max(256).optional(),effort:a.string().max(64).optional(),delegate:a.boolean().optional()}).strict(),rr=a.object({name:a.string().min(1).max(64).optional(),description:a.string().max(8e3).optional(),manager:je.optional(),members:a.array(a.object({role:je,count:a.number().int().min(1).max(16),kind:a.enum(["agent","team"])}).strict()).max(128).optional(),instructions:a.string().max(8e3).optional(),project:a.string().max(8e3).optional()}).strict(),cc=a.record(a.array(a.string().max(1024)).max(100)),ir=a.enum(["minutes","hours","days"]);function lc(e){return!/^\.+$/.test(e)}const uh=e=>cn.safeParse(e).success,cn=a.string().min(1).max(128).refine(e=>[...e].every(t=>t.charCodeAt(0)>=32&&t.charCodeAt(0)!==127&&t!=="/"&&t!=="\\")).refine(lc),or=a.enum(["str","int","float","bool","list","dict"]),ar=a.string().max(16384),dc=2e3,cr=a.string().min(1).max(dc),lr=a.string().min(1).max(64),dr=a.object({is_active:a.boolean().nullish(),one_time:a.boolean().nullish(),start_time_utc:a.string().max(64).nullish(),end_time_utc:a.string().max(64).nullish()}).strict(),uc=a.object({conversation_length:a.number().int().optional(),detail_length:a.number().int().optional(),max_learnings_history:a.number().int().optional(),hosting:a.string().max(256).optional(),model_name:a.string().max(1024).optional(),auto_save_conversation:a.boolean().optional()}).strict(),is=128,ur=2e3,fr=8e3,pr=64,hr=64,xn=e=>[...e].length,os=e=>e>=9&&e<=13||e>=28&&e<=32||e===133||e===160||e===5760||e>=8192&&e<=8202||e===8232||e===8233||e===8239||e===8287||e===12288,fc=e=>e===9||e===10||e===11||e===12||e===13||e===133,pc=e=>e<=31||e>=127&&e<=159,hc=e=>new RegExp("\\p{Cf}","u").test(String.fromCodePoint(e)),mc=e=>e>=8234&&e<=8238||e>=8294&&e<=8297,sn=(e,t)=>{for(const n of e)if(t(n.codePointAt(0)??0))return!0;return!1},Ii=e=>{const t=[...e];let n=0,s=t.length;for(;n<s&&os(t[n].codePointAt(0)??0);)n++;for(;s>n&&os(t[s-1].codePointAt(0)??0);)s--;return t.slice(n,s).join("")},gc=e=>{let t="",n=!1;for(const s of e){if(os(s.codePointAt(0)??0)){n=t.length>0;continue}n&&(t+=" ",n=!1),t+=s}return t};function yc(e){const t=Ii(e);if(!t)return"must not be empty";if(xn(t)>is)return`must be at most ${is} characters`;if(/[/\\:]/.test(t))return'must not contain "/", "\\" or ":"';if(sn(t,mc))return"must not contain Unicode bidirectional override characters";if(sn(t,fc))return"must not contain whitespace";if(sn(t,pc))return"must not contain control characters";if(sn(t,hc))return"must not contain invisible Unicode formatting characters";const n=[...t];return"-.".includes(n[0])||"-.".includes(n[n.length-1])?'must not begin or end with "-" or "."':null}function fh(e){return gc(Ii(e).normalize("NFKC").toLowerCase())}function vc(e){return e.trim()?xn(e)>ur?`must be at most ${ur} characters`:null:"must not be empty"}function _c(e){return e.trim()?xn(e)>fr?`must be at most ${fr} characters`:null:"must not be empty"}function bc(e){if(e.length>hr)return`must hold at most ${hr} items`;for(const t of e)if(!t.trim()||xn(t)>pr)return`must hold items of 1 to ${pr} characters`;return null}const wc=e=>yc(e)===null,Sc=a.string().refine(wc,{message:"That is not a name the hub can publish."}),kc=a.string().refine(e=>_c(e)===null,{message:"That instruction body cannot be published."}),Tc=a.string().refine(e=>vc(e)===null,{message:"That description cannot be published."}),Ec=a.array(a.string()).refine(e=>bc(e)===null,{message:"That tool list cannot be published."}),mr=a.object({name:Sc,description:Tc,instructions:kc,kind:a.enum(["role","specialist"]),when_to_use:a.string(),tools:Ec,effort:a.string(),delegate:a.boolean(),version:a.string(),categories:a.array(a.string()),tags:a.array(a.string())}).partial().strict(),xc=a.enum(["team","agent"]),Ic=a.string().min(1).max(64),Cc=a.string().min(1).max(256),Ci=/^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/,Bn=a.string().regex(Ci,{message:"Letters, digits, dot, underscore and dash; no spaces."}),Rc=["planning","active","qa","validation","done","paused","archived"],gr=a.enum(Rc),rn=a.string().regex(/^$|^\d{4}-\d{2}-\d{2}$/,"Dates are YYYY-MM-DD, or empty to clear."),yr=a.array(a.string().min(1).max(24)).max(8),qe=a.string().min(1).max(64),Ac=1e3,vr=240,_r=80,Oc=/^[a-z0-9][a-z0-9_-]{0,23}$/;function ph(e){return e?Ci.test(e)?null:"Names start with a letter or digit and may use letters, digits, dot, underscore or dash.":"Give the project a name."}function hh(e){return Oc.test(e)?null:"Tags are 1-24 characters of lowercase letters, digits, underscore or dash."}const Pc=a.discriminatedUnion("op",[a.object({op:a.literal("capabilities")}).strict(),a.object({op:a.literal("profiles.list")}).strict(),a.object({op:a.literal("profiles.get"),name:je}).strict(),a.object({op:a.literal("profiles.install"),name:je,requestId:Y}).strict(),a.object({op:a.literal("profiles.create"),name:je,requestId:Y,fields:sr.extend({description:a.string().max(8e3),instructions:a.string().min(1).max(8e3)})}).strict(),a.object({op:a.literal("profiles.update"),name:je,requestId:Y,fields:sr}).strict(),a.object({op:a.literal("teams.list")}).strict(),a.object({op:a.literal("teams.get"),name:je}).strict(),a.object({op:a.literal("teams.create"),requestId:Y,fields:rr.extend({name:a.string().min(1).max(64)})}).strict(),a.object({op:a.literal("teams.update"),name:je,requestId:Y,fields:rr}).strict(),a.object({op:a.literal("sessions.list"),limit:a.number().int().min(1).max(500).optional(),include_archived:a.boolean().optional(),include_peers:a.boolean().optional(),scope_kind:xc.optional(),scope_name:Ic.optional(),cursor:Cc.optional(),with_counts:a.boolean().optional()}).strict(),a.object({op:a.literal("sessions.search"),q:a.string().min(1).max(nc),limit:a.number().int().min(1).max(500).optional(),include_archived:a.boolean().optional()}).strict(),a.object({op:a.literal("sessions.archive"),sessionId:R,archived:a.boolean()}).strict(),a.object({op:a.literal("sessions.delete"),sessionId:R,confirmed:a.literal(!0)}).strict(),a.object({op:a.literal("sessions.create"),requestId:Y,cwd:a.string().min(1).max(4096),target:nn.optional(),model:Fn.optional(),draftId:R.optional()}).strict(),a.object({op:a.literal("sessions.preview"),requestId:Y,cwd:a.string().min(1).max(4096),target:nn.optional(),model:Fn.optional()}).strict(),a.object({op:a.literal("sessions.draft"),requestId:Y,cwd:a.string().min(1).max(4096),target:nn.optional(),model:Fn.optional()}).strict(),a.object({op:a.literal("sessions.get"),sessionId:R}).strict(),a.object({op:a.literal("sessions.history"),sessionId:R,beforeId:O.optional(),limit:a.number().int().min(1).max(500).optional()}).strict(),a.object({op:a.literal("sessions.checkpoints"),sessionId:R}).strict(),a.object({op:a.literal("sessions.checkpoints.warm"),sessionId:R,ids:a.array(O).max(nr).optional(),limit:a.number().int().min(1).max(nr).optional()}).strict(),a.object({op:a.literal("sessions.find"),sessionId:R,q:a.string().min(1).max(rc),limit:a.number().int().min(1).max(oc).optional()}).strict(),a.object({op:a.literal("subagents.transcript"),sessionId:R,childId:R,beforeId:O.optional(),limit:a.number().int().min(1).max(500).optional()}).strict(),a.object({op:a.literal("sessions.message"),sessionId:R,requestId:Y,text:a.string().max(tr),images:a.array(er).max(8).optional(),mode:a.enum(["prompt","steer"]).optional(),inputMode:a.enum(["typed","dictated","mixed"]).optional(),inputPath:a.string().max(1024).optional()}).strict(),a.object({op:a.literal("sessions.command"),sessionId:R,requestId:Y,command:a.string().regex(/^\/?[A-Za-z]+$/).max(64),args:a.string().max(tr).optional(),images:a.array(er).max(8).optional()}).strict(),a.object({op:a.literal("sessions.move"),sessionId:R,requestId:Y,cwd:a.string().min(1).max(4096)}).strict(),a.object({op:a.literal("sessions.answer"),sessionId:R,epoch:O,requestId:O,value:a.string().max(32768).optional(),approved:a.boolean().optional(),questionIndex:a.number().int().min(0).optional()}).strict(),a.object({op:a.literal("sessions.seen"),sessionId:R,completionToken:a.string().uuid()}).strict(),a.object({op:a.literal("attention.seen"),items:a.array(a.object({sessionId:R,completionToken:a.string().uuid()}).strict()).min(1).max(500)}).strict(),a.object({op:a.literal("sessions.notified"),sessionId:R,completionToken:a.string().uuid()}).strict(),a.object({op:a.literal("sessions.pin"),sessionId:R,pinned:a.boolean()}).strict(),a.object({op:a.literal("sessions.watch"),sessionId:R,subscriptionId:a.string().regex(qs),visible:a.boolean(),canNotify:a.boolean()}).strict(),a.object({op:a.literal("sessions.warm"),sessionId:R}).strict(),a.object({op:a.literal("sessions.interrupt"),sessionId:R,requestId:Y}).strict(),a.object({op:a.literal("sessions.variables.list"),sessionId:R}).strict(),a.object({op:a.literal("sessions.variables.create"),sessionId:R,key:cn,value:ar,type:or}).strict(),a.object({op:a.literal("sessions.variables.update"),sessionId:R,key:cn,value:ar,type:or}).strict(),a.object({op:a.literal("sessions.variables.delete"),sessionId:R,key:cn}).strict(),a.object({op:a.literal("sessions.presence"),subscriptionId:a.string().regex(/^[a-f0-9]{1,64}$/),canNotify:a.boolean(),canNotifyKinds:a.array(a.enum(["complete","error"])).max(4),sessionId:a.string().regex(/^([a-f0-9]{12})?$/),window:a.object({exists:a.boolean(),focused:a.boolean(),visible:a.boolean(),minimized:a.boolean()}).strict()}).strict(),a.object({op:a.literal("legacy.models"),provider:a.string().max(128).optional(),sort:a.enum(["id","name","provider","recommended"]).optional(),direction:a.enum(["ascending","descending"]).optional()}).strict(),a.object({op:a.literal("legacy.models.providers")}).strict(),a.object({op:a.literal("auth.probe"),provider:O}).strict(),a.object({op:a.literal("legacy.agent.upload"),agentId:O}).strict(),a.object({op:a.literal("agent.publish"),agentId:O,document:mr.optional(),visibility:a.literal("org").optional(),tenantId:O.optional()}).strict(),a.object({op:a.literal("agent.republish"),agentId:O,hubAgentId:O,document:mr.optional(),visibility:a.literal("org").optional(),tenantId:O.optional()}).strict(),a.object({op:a.literal("team.pull"),teamId:O,tenantId:O.optional()}).strict(),a.object({op:a.literal("agent.nameAvailability"),name:a.string().min(1).max(is)}).strict(),a.object({op:a.literal("legacy.agents.list"),page:a.number().int().min(1).optional(),perPage:a.number().int().min(1).max(500).optional(),name:a.string().max(256).optional(),sort:a.string().max(64).optional(),direction:a.enum(["asc","desc"]).optional()}).strict(),a.object({op:a.literal("legacy.agent.get"),agentId:O}).strict(),a.object({op:a.literal("legacy.agent.history"),agentId:O,page:a.number().int().min(1).optional(),perPage:a.number().int().min(1).max(500).optional()}).strict(),a.object({op:a.literal("legacy.jobs.list"),agentId:O.optional(),status:a.string().max(64).optional()}).strict(),a.object({op:a.literal("legacy.job.get"),jobId:O}).strict(),a.object({op:a.literal("legacy.schedules.list"),page:a.number().int().min(1).optional(),perPage:a.number().int().min(1).max(100).optional()}).strict(),a.object({op:a.literal("legacy.agent.schedules.list"),agentId:O,page:a.number().int().min(1).optional(),perPage:a.number().int().min(1).max(100).optional()}).strict(),a.object({op:a.literal("legacy.agent.schedule.create"),agentId:O,schedule:dr.extend({prompt:a.string().max(64e3),interval:a.number().int().min(1),unit:ir})}).strict(),a.object({op:a.literal("legacy.schedule.get"),scheduleId:O}).strict(),a.object({op:a.literal("legacy.schedule.edit"),scheduleId:O,schedule:dr.extend({prompt:a.string().max(64e3).nullish(),interval:a.number().int().min(1).nullish(),unit:ir.nullish()})}).strict(),a.object({op:a.literal("legacy.schedule.remove"),scheduleId:O}).strict(),a.object({op:a.literal("legacy.agent.create"),agent:a.record(a.unknown())}).strict(),a.object({op:a.literal("legacy.agent.update"),agentId:O,update:a.record(a.unknown())}).strict(),a.object({op:a.literal("legacy.agent.delete"),agentId:O}).strict(),a.object({op:a.literal("legacy.agent.conversation.clear"),agentId:O}).strict(),a.object({op:a.literal("legacy.agent.systemPrompt.get"),agentId:O}).strict(),a.object({op:a.literal("legacy.agent.systemPrompt.update"),agentId:O,systemPrompt:a.string().max(ac)}).strict(),a.object({op:a.literal("legacy.agent.download"),agentId:O}).strict(),a.object({op:a.literal("legacy.job.cancel"),jobId:O}).strict(),a.object({op:a.literal("commands.list")}).strict(),a.object({op:a.literal("commands.entities"),sessionId:R,command:O,name:a.string().max(128).optional()}).strict(),a.object({op:a.literal("models.catalogue"),live:a.boolean().optional()}).strict(),a.object({op:a.literal("usage.get"),provider:O.optional(),live:a.boolean().optional(),refresh:a.boolean().optional()}).strict(),a.object({op:a.literal("analytics.get"),sessionId:R.optional(),sinceMs:a.number().int().nonnegative().optional(),untilMs:a.number().int().nonnegative().optional(),days:a.number().int().min(1).max(366).optional()}).strict(),a.object({op:a.literal("analytics.models"),sessionId:R.optional(),sinceMs:a.number().int().nonnegative().optional(),untilMs:a.number().int().nonnegative().optional(),days:a.number().int().min(1).max(366).optional()}).strict(),a.object({op:a.literal("info.get")}).strict(),a.object({op:a.literal("sessions.report"),sessionId:R,recentLimit:a.number().int().min(0).max(50).optional()}).strict(),a.object({op:a.literal("skills.list"),sessionId:R,name:O.optional()}).strict(),a.object({op:a.literal("sessions.failovers"),sessionId:R}).strict(),a.object({op:a.literal("sessions.credential"),sessionId:R,action:a.enum(["list","store","forget"]),key:qt.optional(),value:en.optional(),confirmed:a.boolean().optional()}).strict(),a.object({op:a.literal("sessions.fork"),sessionId:R,requestId:Y,message:a.string().max(2e5).optional(),boundary:a.literal("next_safe").optional()}).strict(),a.object({op:a.literal("sessions.stop"),requestId:Y,targets:a.array(R).min(1).max(100),confirmed:a.literal(!0)}).strict(),a.object({op:a.literal("sessions.aside"),sessionId:R,requestId:Y,text:a.string().min(1).max(32768),asideId:Y.optional(),subscriptionId:a.string().regex(qs).optional()}).strict(),a.object({op:a.literal("sessions.adopt"),sessionId:R,requestId:Y,asideId:Y,confirmed:a.literal(!0)}).strict(),a.object({op:a.literal("sessions.aside.get"),sessionId:R,asideId:Y}).strict(),a.object({op:a.literal("sessions.aside.close"),sessionId:R,asideId:Y}).strict(),a.object({op:a.literal("wakes.list"),limit:a.number().int().min(1).max(500).optional(),includeDormant:a.boolean().optional()}).strict(),a.object({op:a.literal("wakes.create"),requestId:Y,sessionId:R.optional(),cwd:a.string().min(1).max(4096).optional(),target:nn.optional(),message:cr,in:a.string().min(1).max(64).optional(),at:a.string().min(1).max(64).optional(),every:a.string().min(1).max(64).optional(),until:a.string().min(1).max(64).optional(),limit:a.number().int().min(1).optional(),title:a.string().min(1).max(200).optional()}).strict(),a.object({op:a.literal("wakes.edit"),sessionId:R,wakeId:lr,message:cr.optional(),in:a.string().min(1).max(64).optional(),at:a.string().min(1).max(64).optional(),every:a.string().min(1).max(64).optional(),until:a.string().min(1).max(64).optional(),limit:a.number().int().min(1).optional()}).strict(),a.object({op:a.literal("wakes.remove"),sessionId:R,wakeId:lr}).strict(),a.object({op:a.literal("mcp.list"),sessionId:R}).strict(),a.object({op:a.literal("mcp.credentials.store"),sessionId:R,name:a.string().min(1).max(256),values:a.record(a.string().min(1).max(128),a.string().min(1).max(32768)).refine(e=>Object.keys(e).length<=32&&Object.values(e).reduce((t,n)=>t+n.length,0)<=65536,{message:"Too many secret values, or too much secret text, for one MCP credential write."}),confirmedReplace:a.array(a.string().min(1).max(128)).max(32)}).strict(),a.object({op:a.literal("mcp.control"),sessionId:R,control:a.object({action:a.enum(["list","add","remove","reload","connect","probe","disconnect","login","logout","reauth","status","cancel"]),name:$n.optional(),scope:a.enum(["global","project"]).optional(),command:a.string().min(1).max(4096).optional(),args:a.array(a.string().max(8192)).max(128).optional(),env:a.record(tn).optional(),url:a.string().max(4096).optional(),headers:a.record(tn).optional(),oauth:a.boolean().optional(),confirmed:a.boolean().optional(),operation_id:Js.optional()}).strict()}).strict(),a.object({op:a.literal("mcp.catalog"),cwd:Un.optional(),sessionId:R.optional()}).strict(),a.object({op:a.literal("mcp.catalog.control"),cwd:Un.optional(),control:a.object({action:a.enum(["add","remove","test","login","reauth","logout","status","cancel"]),name:$n.optional(),scope:a.enum(["global","project"]).optional(),command:a.string().min(1).max(4096).optional(),args:a.array(a.string().max(8192)).max(128).optional(),env:a.record(tn).optional(),url:a.string().max(4096).optional(),headers:a.record(tn).optional(),confirmed:a.boolean().optional(),operation_id:Js.optional()}).strict()}).strict(),a.object({op:a.literal("mcp.catalog.credentials"),header:a.string().min(1).max(128).optional(),cwd:Un.optional(),name:$n,values:a.record(a.string().min(1).max(128),a.string().min(1).max(32768)).refine(e=>Object.keys(e).length<=32&&Object.values(e).reduce((t,n)=>t+n.length,0)<=65536,{message:"Too many secret values, or too much secret text, for one MCP credential write."}),confirmedReplace:a.array(a.string().min(1).max(128)).max(32)}).strict(),a.object({op:a.literal("radient.request"),control:a.object({operation:a.enum(["account","prices","credits","usage","provision","application.create","agents.list","agents.get","agents.create","agents.update","agents.delete","agents.like","agents.unlike","agents.liked","agents.like_count","agents.favourite","agents.unfavourite","agents.favourited","agents.favourite_count","agents.download_count","agents.statuses","comments.list","comments.create","comments.update","comments.delete","account.agents","memberships.list","org_agents.list","org_team.get","org_teams.list"]),request_id:Y.optional(),tenant_id:O.optional(),account_id:O.optional(),agent_id:O.optional(),comment_id:O.optional(),team_id:O.optional(),query:a.record(a.union([a.string().max(1024),a.number().int()])).optional(),payload:a.record(a.unknown()).optional(),confirmed:a.boolean().optional()}).strict()}).strict(),a.object({op:a.literal("providers.list")}).strict(),a.object({op:a.literal("accounts.list")}).strict(),a.object({op:a.literal("accounts.remove"),accountId:a.number().int().positive(),confirmed:a.literal(!0)}).strict(),a.object({op:a.literal("auth.start"),provider:O}).strict(),a.object({op:a.literal("auth.status"),id:O}).strict(),a.object({op:a.literal("auth.input"),id:O,promptId:O,value:en}).strict(),a.object({op:a.literal("auth.cancel"),id:O}).strict(),a.object({op:a.literal("auth.key"),provider:O,value:en}).strict(),a.object({op:a.literal("auth.logout"),provider:O}).strict(),a.object({op:a.literal("settings.list")}).strict(),a.object({op:a.literal("settings.edit"),key:qt,value:a.unknown().refine(e=>e!==void 0,"A setting value is required."),base:cc.optional()}).strict(),a.object({op:a.literal("settings.reset"),key:qt}).strict(),a.object({op:a.literal("config.get")}).strict(),a.object({op:a.literal("config.update"),value:uc}).strict(),a.object({op:a.literal("instructions.get")}).strict(),a.object({op:a.literal("instructions.update"),content:a.string().max(64e3)}).strict(),a.object({op:a.literal("credentials.list")}).strict(),a.object({op:a.literal("credentials.update"),key:qt,value:en}).strict(),a.object({op:a.literal("peers.list")}).strict(),a.object({op:a.literal("networks.list")}).strict(),a.object({op:a.literal("networks.invite"),networkId:Et,role:a.enum(["read","drive","admin"]),deviceId:Et.optional()}).strict(),a.object({op:a.literal("networks.member.remove"),networkId:Et,deviceId:Et,confirm:a.string().min(1).max(256)}).strict(),a.object({op:a.literal("sessions.transfer"),sessionId:R,to:a.union([a.literal("local"),Et]),keep:a.boolean().optional(),waitS:a.number().min(0).max(300).optional(),requestId:Y.optional()}).strict(),a.object({op:a.literal("projects.list")}).strict(),a.object({op:a.literal("projects.get"),key:qe}).strict(),a.object({op:a.literal("projects.create"),name:Bn,description:a.string().max(vr).optional(),status:gr.optional(),tags:yr.optional()}).strict(),a.object({op:a.literal("projects.update"),key:qe,fields:a.object({name:Bn.optional(),title:a.string().max(80).optional(),owner:a.string().max(80).optional(),team:a.string().max(80).optional(),description:a.string().max(vr).optional(),status:gr.optional(),progress:a.string().max(Ac).optional(),tags:yr.optional(),start_date:rn.optional(),target_date:rn.optional(),completed_at:rn.optional(),estimate:a.number().positive().max(1e3).optional(),estimate_unit:a.enum(["points","days"]).optional()}).strict()}).strict(),a.object({op:a.literal("projects.delete"),key:qe,confirmed_name:Bn}).strict(),a.object({op:a.literal("projects.link"),key:qe,sessionId:R}).strict(),a.object({op:a.literal("projects.unlink"),key:qe,sessionId:R}).strict(),a.object({op:a.literal("projects.milestone"),key:qe,name:a.string().min(1).max(_r),targetDate:rn.optional(),completed:a.boolean().optional()}).strict(),a.object({op:a.literal("projects.milestone.remove"),key:qe,name:a.string().min(1).max(_r)}).strict(),a.object({op:a.literal("aida.status")}).strict(),a.object({op:a.literal("aida.control"),action:a.enum(["open","pause","resume","greet","status"])}).strict()]);Pc.superRefine((e,t)=>{e.op!=="agent.publish"&&e.op!=="agent.republish"||e.visibility==="org"!=!!e.tenantId&&t.addIssue({code:a.ZodIssueCode.custom,message:'A publication target needs both `visibility: "org"` and `tenantId`, or neither: one half would publish to the public hub.'})});const _e={noCredential:"pairing.no-credential",refused:"pairing.refused",planeClosed:"pairing.plane-closed",transportFailed:"transport.failed"},Dc={runtimeUnreachable:"runtime_unreachable"},Ps="runtime_busy",Ri="runtime_retiring",Ds={[_e.noCredential]:"This app is not paired with the running Local Operator server, so this control is unavailable.",[_e.refused]:"This app's credential for the running Local Operator server was refused, so this control is unavailable.",[_e.planeClosed]:"The running Local Operator server does not accept this app's desktop controls.",[_e.transportFailed]:"The Local Operator server did not answer this request."},as={noCredential:"Restart with a desktop-managed backend to use these controls.",transportFailed:"The backend could not complete this request. Check its connection and try again."};function Ls(e){return e!==void 0&&Object.values(_e).includes(e)}function Lc(e,t){if(e.startsWith("/v1/desktop/")){if(t===401||t===403)return _e.refused;if(t===503)return _e.planeClosed}}const Nc=88e4,Mc=11e5,jc=2e4,$c=9e4,Uc=new Set(["analytics.get","analytics.models","sessions.report"]),Fc=new Set(["usage.get"]),Bc=new Set(["networks.list","peers.list"]),Zc=new Set([...Uc,...Fc,...Bc]),Gc=90,Hc=30,zc=300,Vc=10,Kc=15,Wc=1e4;function Yc(e){const n=e.to==="local"||e.keep?zc:Hc,s=Math.max(0,e.waitS??0);return(Gc+n+Vc+Kc)*1e3+s*1e3}function Qc(e){if(typeof e!="string"&&e.op==="sessions.transfer")return Yc(e)+Wc;const t=typeof e=="string"?e:e.op;return Zc.has(t)?$c:jc}const Xc=5e3;function Ai(e){return Qc(e)+Xc}const Ns="deadline_exceeded",Oi="foreground_required",Pi="View these completions in the foreground before marking them read.",Jc=new Set(["capabilities","accounts.list","analytics.get","analytics.models","commands.entities","commands.list","config.get","credentials.list","info.get","instructions.get","legacy.agent.get","legacy.agent.history","legacy.agent.schedules.list","legacy.agents.list","legacy.job.get","legacy.jobs.list","legacy.models","legacy.models.providers","legacy.schedule.get","legacy.schedules.list","mcp.catalog","mcp.list","models.catalogue","networks.list","peers.list","profiles.get","profiles.list","providers.list","sessions.aside.get","sessions.checkpoints","sessions.failovers","sessions.find","sessions.get","sessions.history","sessions.list","sessions.preview","sessions.report","sessions.search","sessions.variables.list","skills.list","subagents.transcript","teams.get","teams.list","usage.get"]),qc=new Set(["analytics.get","analytics.models","networks.list","peers.list","usage.get","sessions.report","info.get","sessions.failovers"]);function el(e,t){const n=Math.round(t/1e3),s=Ns;return e==="sessions.transfer"?{code:s,message:`The app waits up to ${n} seconds for a move, and it was still running when the app stopped waiting. The move was asked for, so its outcome is unknown from here: read the session again before moving it anywhere else.`}:Jc.has(e)?{code:s,message:qc.has(e)?`The app waits up to ${n} seconds for this panel's data, and the read was still running when the app stopped waiting. Nothing was read; reopen the panel to ask again.`:`The app waits up to ${n} seconds for this read, and it was still running when the app stopped waiting. Nothing was read; ask again.`}:{code:s,message:`The app waits up to ${n} seconds for this request, and it was still running when the app stopped waiting. It may or may not have reached the server; check the result before repeating it.`}}const mh=Nc,gh=Mc;function tl(e){return e.sessionId?{session_id:e.sessionId}:{...e.cwd?{cwd:e.cwd}:{},...e.target?{target:e.target}:{}}}function br(e){return{...e.in!==void 0?{in:e.in}:{},...e.at!==void 0?{at:e.at}:{},...e.every!==void 0?{every:e.every}:{},...e.until!==void 0?{until:e.until}:{},...e.limit!==void 0?{limit:e.limit}:{}}}function wr(e){if(e.visibility==="org"!=!!e.tenantId)throw new Error('A publication target needs both `visibility: "org"` and `tenantId`, or neither: one half would publish to the public hub.')}function nl(e){switch(e.op){case"capabilities":return{path:"/v1/capabilities",method:"GET"};case"peers.list":return{path:"/v1/desktop/peers",method:"GET"};case"networks.list":return{path:"/v1/desktop/networks",method:"GET"};case"networks.invite":return{path:`/v1/desktop/networks/${encodeURIComponent(e.networkId)}/invite`,method:"POST",body:{role:e.role,device:e.deviceId??null}};case"networks.member.remove":return{path:`/v1/desktop/networks/${encodeURIComponent(e.networkId)}/members/${encodeURIComponent(e.deviceId)}`,method:"DELETE",body:{confirm:e.confirm}};case"sessions.transfer":return{path:`/v1/desktop/sessions/${encodeURIComponent(e.sessionId)}/transfer`,method:"POST",body:{to:e.to,keep:e.keep??!1,wait_s:e.waitS??0,...e.requestId?{request_id:e.requestId}:{}}};case"profiles.list":return{path:"/v1/desktop/profiles",method:"GET"};case"profiles.get":return{path:`/v1/desktop/profiles/${encodeURIComponent(e.name)}`,method:"GET"};case"profiles.install":return{path:"/v1/desktop/profiles/install",method:"POST",body:{request_id:e.requestId,name:e.name}};case"profiles.create":return{path:"/v1/desktop/profiles",method:"POST",body:{request_id:e.requestId,name:e.name,...e.fields}};case"profiles.update":return{path:`/v1/desktop/profiles/${encodeURIComponent(e.name)}`,method:"PATCH",body:{request_id:e.requestId,...e.fields}};case"teams.list":return{path:"/v1/desktop/teams",method:"GET"};case"teams.get":return{path:`/v1/desktop/teams/${encodeURIComponent(e.name)}`,method:"GET"};case"teams.create":return{path:"/v1/desktop/teams",method:"POST",body:{request_id:e.requestId,...e.fields}};case"teams.update":return{path:`/v1/desktop/teams/${encodeURIComponent(e.name)}`,method:"PATCH",body:{request_id:e.requestId,...e.fields}};case"sessions.list":{const t=new URLSearchParams;return t.set("limit",String(e.limit??100)),e.include_archived&&t.set("include_archived","true"),e.scope_kind&&t.set("scope_kind",e.scope_kind),e.scope_name&&t.set("scope_name",e.scope_name),e.cursor&&t.set("cursor",e.cursor),e.with_counts&&t.set("with_counts","true"),e.include_peers&&t.set("include_peers","true"),{path:`/v1/desktop/sessions?${t}`,method:"GET"}}case"sessions.search":{const t=new URLSearchParams({q:e.q,limit:String(e.limit??sc)});return e.include_archived&&t.set("include_archived","true"),{path:`/v1/desktop/sessions/search?${t}`,method:"GET"}}case"sessions.archive":return{path:`/v1/desktop/sessions/${e.sessionId}/archive`,method:"POST",body:{archived:e.archived}};case"sessions.delete":return{path:`/v1/desktop/sessions/${e.sessionId}`,method:"DELETE",body:{confirmed:!0}};case"sessions.create":return{path:"/v1/desktop/sessions",method:"POST",body:{request_id:e.requestId,cwd:e.cwd,...e.target?{target:e.target}:{},...e.model?{model:e.model}:{},...e.draftId?{draft_id:e.draftId}:{}}};case"sessions.preview":return{path:"/v1/desktop/sessions/preview",method:"POST",body:{request_id:e.requestId,cwd:e.cwd,...e.target?{target:e.target}:{},...e.model?{model:e.model}:{}}};case"sessions.draft":return{path:"/v1/desktop/sessions/draft",method:"POST",body:{request_id:e.requestId,cwd:e.cwd,...e.target?{target:e.target}:{},...e.model?{model:e.model}:{}}};case"sessions.get":return{path:`/v1/desktop/sessions/${e.sessionId}`,method:"GET"};case"sessions.history":{const t=new URLSearchParams({limit:String(e.limit??100)});return e.beforeId&&t.set("before_id",e.beforeId),{path:`/v1/desktop/sessions/${e.sessionId}/history?${t}`,method:"GET"}}case"sessions.checkpoints":return{path:`/v1/desktop/sessions/${e.sessionId}/checkpoints`,method:"GET"};case"sessions.checkpoints.warm":return{path:`/v1/desktop/sessions/${e.sessionId}/checkpoints/warm`,method:"POST",body:{...e.ids?{ids:e.ids}:{},...e.limit!==void 0?{limit:e.limit}:{}}};case"sessions.find":{const t=new URLSearchParams({q:e.q,limit:String(e.limit??ic)});return{path:`/v1/desktop/sessions/${e.sessionId}/find?${t}`,method:"GET"}}case"subagents.transcript":{const t=new URLSearchParams({limit:String(e.limit??100)});return e.beforeId&&t.set("before_id",e.beforeId),{path:`/v1/desktop/sessions/${e.sessionId}/children/${e.childId}/transcript?${t}`,method:"GET"}}case"sessions.message":return{path:`/v1/desktop/sessions/${e.sessionId}/messages`,method:"POST",body:{request_id:e.requestId,text:e.text,images:e.images??[],mode:e.mode??"prompt",...e.inputMode?{input_mode:e.inputMode}:{},...e.inputPath?{input_path:e.inputPath}:{}}};case"sessions.command":return{path:`/v1/desktop/sessions/${e.sessionId}/commands`,method:"POST",body:{request_id:e.requestId,command:e.command,args:e.args??"",images:e.images??[]}};case"sessions.answer":return{path:`/v1/desktop/sessions/${e.sessionId}/answers`,method:"POST",body:{epoch:e.epoch,request_id:e.requestId,value:e.value,approved:e.approved,question_index:e.questionIndex}};case"sessions.seen":return{path:`/v1/desktop/sessions/${e.sessionId}/seen`,method:"POST",body:{completion_token:e.completionToken}};case"attention.seen":return{path:"/v1/desktop/attention/seen",method:"POST",body:{items:e.items.map(t=>({session_id:t.sessionId,completion_token:t.completionToken}))}};case"sessions.notified":return{path:`/v1/desktop/sessions/${e.sessionId}/notified`,method:"POST",body:{completion_token:e.completionToken}};case"sessions.pin":return{path:`/v1/desktop/sessions/${e.sessionId}/pin`,method:"POST",body:{pinned:e.pinned}};case"sessions.watch":return{path:`/v1/desktop/sessions/${e.sessionId}/watch`,method:"POST",body:{subscription_id:e.subscriptionId,visible:e.visible,can_notify:e.canNotify}};case"sessions.presence":return{path:"/v1/desktop/presence",method:"POST",body:{subscription_id:e.subscriptionId,can_notify_kinds:e.canNotifyKinds,session_id:e.sessionId,window:e.window,can_notify:e.canNotify}};case"sessions.move":return{path:`/v1/desktop/sessions/${e.sessionId}/working-directory`,method:"POST",body:{request_id:e.requestId,cwd:e.cwd}};case"sessions.warm":return{path:`/v1/desktop/sessions/${e.sessionId}/warm`,method:"POST",body:{}};case"sessions.interrupt":return{path:`/v1/desktop/sessions/${e.sessionId}/interrupt`,method:"POST",body:{request_id:e.requestId}};case"sessions.variables.list":return{path:`/v1/desktop/sessions/${e.sessionId}/variables`,method:"GET"};case"sessions.variables.create":return{path:`/v1/desktop/sessions/${e.sessionId}/variables`,method:"POST",body:{key:e.key,value:e.value,type:e.type}};case"sessions.variables.update":return{path:`/v1/desktop/sessions/${e.sessionId}/variables/${encodeURIComponent(e.key)}`,method:"PATCH",body:{value:e.value,type:e.type}};case"sessions.variables.delete":return{path:`/v1/desktop/sessions/${e.sessionId}/variables/${encodeURIComponent(e.key)}`,method:"DELETE"};case"legacy.models":{const t=new URLSearchParams;return e.provider&&t.set("provider",e.provider),e.sort&&t.set("sort",e.sort),e.direction&&t.set("direction",e.direction),{path:t.size>0?`/v1/models?${t}`:"/v1/models",method:"GET"}}case"legacy.models.providers":return{path:"/v1/models/providers",method:"GET"};case"auth.probe":return{path:`/v1/auth/providers/${e.provider}/probe`,method:"POST"};case"legacy.agent.upload":return{path:`/v1/agents/${e.agentId}/upload`,method:"POST"};case"agent.publish":{wr(e);const t=new URLSearchParams;e.visibility==="org"&&e.tenantId&&(t.set("visibility","org"),t.set("tenant_id",e.tenantId));const n=t.toString();return{path:`/v1/agents/${e.agentId}/publish${n?`?${n}`:""}`,method:"POST",body:{document:e.document??{}}}}case"agent.republish":{wr(e);const t=new URLSearchParams;e.visibility==="org"&&e.tenantId&&(t.set("visibility","org"),t.set("tenant_id",e.tenantId));const n=t.toString();return{path:`/v1/agents/${e.agentId}/publish${n?`?${n}`:""}`,method:"PUT",body:{hub_agent_id:e.hubAgentId,document:e.document??{}}}}case"team.pull":{const t=new URLSearchParams;e.tenantId&&t.set("tenant_id",e.tenantId);const n=t.toString();return{path:`/v1/teams/pull/${e.teamId}${n?`?${n}`:""}`,method:"GET"}}case"agent.nameAvailability":return{path:`/v1/agent-name-availability?${new URLSearchParams({name:e.name})}`,method:"GET"};case"legacy.agents.list":{const t=new URLSearchParams({page:String(e.page??1),per_page:String(e.perPage??10)});return e.name&&t.set("name",e.name),e.sort&&t.set("sort",e.sort),e.direction&&t.set("direction",e.direction),{path:`/v1/agents?${t}`,method:"GET"}}case"legacy.agent.get":return{path:`/v1/agents/${e.agentId}`,method:"GET"};case"legacy.agent.history":{const t=new URLSearchParams({page:String(e.page??1),per_page:String(e.perPage??10)});return{path:`/v1/agents/${e.agentId}/history?${t}`,method:"GET"}}case"wakes.list":{const t=new URLSearchParams;return e.limit!==void 0&&t.set("limit",String(e.limit)),e.includeDormant!==void 0&&t.set("include_dormant",String(e.includeDormant)),{path:t.size>0?`/v1/desktop/wakes?${t}`:"/v1/desktop/wakes",method:"GET"}}case"wakes.create":return{path:"/v1/desktop/wakes",method:"POST",body:{request_id:e.requestId,...tl(e),message:e.message,...br(e)}};case"wakes.edit":return{path:`/v1/desktop/wakes/${e.sessionId}/${e.wakeId}`,method:"PATCH",body:{...e.message!==void 0?{message:e.message}:{},...br(e)}};case"wakes.remove":return{path:`/v1/desktop/wakes/${e.sessionId}/${e.wakeId}`,method:"DELETE"};case"legacy.jobs.list":{const t=new URLSearchParams;return e.agentId&&t.set("agent_id",e.agentId),e.status&&t.set("status",e.status),{path:t.size>0?`/v1/jobs?${t}`:"/v1/jobs",method:"GET"}}case"legacy.job.get":return{path:`/v1/jobs/${e.jobId}`,method:"GET"};case"legacy.schedules.list":return{path:`/v1/schedules?${new URLSearchParams({page:String(e.page??1),per_page:String(e.perPage??10)})}`,method:"GET"};case"legacy.agent.schedules.list":{const t=new URLSearchParams({page:String(e.page??1),per_page:String(e.perPage??10)});return{path:`/v1/agents/${e.agentId}/schedules?${t}`,method:"GET"}}case"legacy.agent.schedule.create":return{path:`/v1/agents/${e.agentId}/schedules`,method:"POST",body:e.schedule};case"legacy.schedule.get":return{path:`/v1/schedules/${e.scheduleId}`,method:"GET"};case"legacy.schedule.edit":return{path:`/v1/schedules/${e.scheduleId}`,method:"PATCH",body:e.schedule};case"legacy.schedule.remove":return{path:`/v1/schedules/${e.scheduleId}`,method:"DELETE"};case"legacy.agent.create":return{path:"/v1/agents",method:"POST",body:e.agent};case"legacy.agent.update":return{path:`/v1/agents/${e.agentId}`,method:"PATCH",body:e.update};case"legacy.agent.delete":return{path:`/v1/agents/${e.agentId}`,method:"DELETE"};case"legacy.agent.conversation.clear":return{path:`/v1/agents/${e.agentId}/conversation`,method:"DELETE"};case"legacy.agent.systemPrompt.get":return{path:`/v1/agents/${e.agentId}/system-prompt`,method:"GET"};case"legacy.agent.systemPrompt.update":return{path:`/v1/agents/${e.agentId}/system-prompt`,method:"PUT",body:{system_prompt:e.systemPrompt}};case"legacy.agent.download":return{path:`/v1/agents/${e.agentId}/download`,method:"GET"};case"legacy.job.cancel":return{path:`/v1/jobs/${e.jobId}`,method:"DELETE"};case"commands.list":return{path:"/v1/desktop/commands",method:"GET"};case"commands.entities":return{path:`/v1/desktop/sessions/${e.sessionId}/command-entities?command=${encodeURIComponent(e.command)}${e.name?`&name=${encodeURIComponent(e.name)}`:""}`,method:"GET"};case"models.catalogue":return{path:`/v1/desktop/models?live=${e.live??!1}`,method:"GET"};case"usage.get":{const t=new URLSearchParams({live:String(e.live??!1),refresh:String(e.refresh??!1)});return e.provider&&t.set("provider",e.provider),{path:`/v1/desktop/usage?${t}`,method:"GET"}}case"analytics.get":{const t=new URLSearchParams({days:String(e.days??30)});return e.sessionId&&t.set("session_id",e.sessionId),e.sinceMs!==void 0&&t.set("since_ms",String(e.sinceMs)),e.untilMs!==void 0&&t.set("until_ms",String(e.untilMs)),{path:`/v1/desktop/analytics?${t}`,method:"GET"}}case"analytics.models":{const t=new URLSearchParams({days:String(e.days??30)});return e.sessionId&&t.set("session_id",e.sessionId),e.sinceMs!==void 0&&t.set("since_ms",String(e.sinceMs)),e.untilMs!==void 0&&t.set("until_ms",String(e.untilMs)),{path:`/v1/desktop/analytics/models?${t}`,method:"GET"}}case"info.get":return{path:"/v1/desktop/info",method:"GET"};case"sessions.report":{const t=new URLSearchParams({recent_limit:String(e.recentLimit??12)});return{path:`/v1/desktop/sessions/${e.sessionId}/report?${t}`,method:"GET"}}case"skills.list":return{path:`/v1/desktop/skills?session_id=${e.sessionId}${e.name?`&name=${encodeURIComponent(e.name)}`:""}`,method:"GET"};case"sessions.failovers":return{path:`/v1/desktop/sessions/${e.sessionId}/failovers`,method:"GET"};case"sessions.credential":return{path:`/v1/desktop/sessions/${e.sessionId}/credentials`,method:"POST",body:{action:e.action,key:e.key,value:e.value,confirmed:e.confirmed}};case"sessions.fork":return{path:`/v1/desktop/sessions/${e.sessionId}/fork`,method:"POST",body:{request_id:e.requestId,message:e.message,boundary:e.boundary}};case"sessions.stop":return{path:"/v1/desktop/stop",method:"POST",body:{request_id:e.requestId,targets:e.targets,confirmed:e.confirmed}};case"sessions.aside":return{path:`/v1/desktop/sessions/${e.sessionId}/asides`,method:"POST",body:{request_id:e.requestId,text:e.text,aside_id:e.asideId,subscription_id:e.subscriptionId}};case"sessions.adopt":return{path:`/v1/desktop/sessions/${e.sessionId}/asides/${e.asideId}/adopt`,method:"POST",body:{request_id:e.requestId,confirmed:e.confirmed}};case"sessions.aside.get":case"sessions.aside.close":return{path:`/v1/desktop/sessions/${e.sessionId}/asides/${e.asideId}`,method:e.op==="sessions.aside.get"?"GET":"DELETE"};case"mcp.list":return{path:`/v1/desktop/sessions/${e.sessionId}/mcp`,method:"GET"};case"mcp.credentials.store":return{path:`/v1/desktop/sessions/${e.sessionId}/mcp/credentials`,method:"POST",body:{name:e.name,values:e.values,confirmed_replace:e.confirmedReplace}};case"mcp.control":return{path:`/v1/desktop/sessions/${e.sessionId}/mcp`,method:"POST",body:e.control};case"mcp.catalog":{const t=new URLSearchParams;e.cwd&&t.set("cwd",e.cwd),e.sessionId&&t.set("session_id",e.sessionId);const n=t.toString();return{path:n?`/v1/desktop/mcp?${n}`:"/v1/desktop/mcp",method:"GET"}}case"mcp.catalog.control":return{path:"/v1/desktop/mcp",method:"POST",body:{...e.control,...e.cwd?{cwd:e.cwd}:{}}};case"mcp.catalog.credentials":return{path:"/v1/desktop/mcp/credentials",method:"POST",body:{name:e.name,values:e.values,...e.header?{header:e.header}:{},confirmed_replace:e.confirmedReplace,...e.cwd?{cwd:e.cwd}:{}}};case"radient.request":return{path:"/v1/desktop/radient",method:"POST",body:e.control};case"providers.list":return{path:"/v1/auth/providers",method:"GET"};case"accounts.list":return{path:"/v1/auth/status",method:"GET"};case"accounts.remove":return{path:`/v1/auth/accounts/${e.accountId}`,method:"DELETE"};case"auth.start":return{path:"/v1/auth/login",method:"POST",body:{provider:e.provider}};case"auth.status":return{path:`/v1/auth/operations/${e.id}`,method:"GET"};case"auth.input":return{path:`/v1/auth/operations/${e.id}/input`,method:"POST",body:{prompt_id:e.promptId,value:e.value}};case"auth.cancel":return{path:`/v1/auth/operations/${e.id}`,method:"DELETE"};case"auth.key":return{path:`/v1/auth/providers/${e.provider}/key`,method:"PUT",body:{value:e.value}};case"auth.logout":return{path:`/v1/auth/providers/${e.provider}/credentials`,method:"DELETE"};case"settings.list":return{path:"/v1/settings",method:"GET"};case"settings.edit":return{path:`/v1/settings/${e.key}`,method:"PATCH",body:{value:e.value,base:e.base}};case"settings.reset":return{path:`/v1/settings/${e.key}/reset`,method:"POST"};case"config.get":return{path:"/v1/config",method:"GET"};case"config.update":return{path:"/v1/config",method:"PATCH",body:e.value};case"instructions.get":return{path:"/v1/config/system-prompt",method:"GET"};case"instructions.update":return{path:"/v1/config/system-prompt",method:"PATCH",body:{content:e.content}};case"credentials.list":return{path:"/v1/credentials",method:"GET"};case"credentials.update":return{path:"/v1/credentials",method:"PATCH",body:{key:e.key,value:e.value}};case"projects.list":return{path:"/v1/desktop/projects",method:"GET"};case"projects.get":return{path:`/v1/desktop/projects/${encodeURIComponent(e.key)}`,method:"GET"};case"projects.create":return{path:"/v1/desktop/projects",method:"POST",body:{name:e.name,...e.description!==void 0?{description:e.description}:{},...e.status!==void 0?{status:e.status}:{},...e.tags!==void 0?{tags:e.tags}:{}}};case"projects.update":return{path:`/v1/desktop/projects/${encodeURIComponent(e.key)}`,method:"PATCH",body:{...e.fields}};case"projects.delete":return{path:`/v1/desktop/projects/${encodeURIComponent(e.key)}`,method:"DELETE",body:{confirm:e.confirmed_name}};case"projects.link":return{path:`/v1/desktop/projects/${encodeURIComponent(e.key)}/links`,method:"POST",body:{session_id:e.sessionId}};case"projects.unlink":return{path:`/v1/desktop/projects/${encodeURIComponent(e.key)}/links/${encodeURIComponent(e.sessionId)}`,method:"DELETE"};case"projects.milestone":return{path:`/v1/desktop/projects/${encodeURIComponent(e.key)}/milestones`,method:"POST",body:{name:e.name,...e.targetDate!==void 0?{target_date:e.targetDate}:{},...e.completed!==void 0?{completed:e.completed}:{}}};case"projects.milestone.remove":return{path:`/v1/desktop/projects/${encodeURIComponent(e.key)}/milestones/${encodeURIComponent(e.name)}`,method:"DELETE"};case"aida.status":return{path:"/v1/desktop/aida",method:"GET"};case"aida.control":return{path:"/v1/desktop/aida",method:"POST",body:{op:e.action}}}}const yh=64,vh=64*1024*1024,Pt={notPaired:"This backend was not started with desktop controls.",serverDown:"The Local Operator server is not answering.",frameBudget:"The event stream exceeded its frame budget.",ended:"The event stream ended."},Sr={statement:"Lost the connection to this conversation — reconnect to keep reading.",action:"reconnect"},sl={statement:"The Local Operator server is not running — reconnect once it is back, or restart the app if it stays down.",action:"reconnect"},rl={statement:"This app is not paired with the Local Operator server, so this conversation cannot be read yet.",action:null},il={statement:"Could not load this conversation's history — reconnect to try again.",action:"reconnect"},ol={statement:"This conversation's updates were too large to display — reconnect to try again.",action:"reconnect"};function kr(e){return e?e===Pt.notPaired?rl:e===Pt.serverDown?sl:e===Pt.frameBudget?ol:Sr:Sr}async function Di(e){if(window.api?.desktop)try{return await al(window.api.desktop.request(e),e)}catch(n){throw n instanceof X?n:dl(n)?new Ke(Pi,Oi):new X(null,"Desktop controls could not reach the backend process.",n)}let t;try{t=await fetch("/__desktop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}catch(n){throw new X(null,"Desktop controls could not reach the backend process.",n)}if(!t.ok)throw new X(t.status,"Desktop controls need a compatible backend connection.");return t.json()}function al(e,t){const n=Ai(t);let s;return Promise.race([e,new Promise((r,i)=>{s=setTimeout(()=>{const o=el(t.op,n);i(new X(null,o.message,void 0,o.code))},n)})]).finally(()=>clearTimeout(s))}class X extends Error{status;cause;code;retryAfterMs;constructor(t,n,s,r,i){super(n),this.name="DesktopControlError",this.status=t,this.cause=s,this.code=r,this.retryAfterMs=i}}class Ke extends Error{code;constructor(t,n){super(t),this.name="UserFacingError",this.code=n}}function In(e,t){return e instanceof X||e instanceof Ke?Ls(e.code)?Ds[e.code]:e.message:t}function cl(e,t,n,s){return typeof s=="string"?s:n===as.noCredential?_e.noCredential:n===as.transportFailed?_e.transportFailed:Lc(nl(e).path,t)}async function ce(e){const t=await Di(e),n=t.body;if(t.status<200||t.status>=300){const s=typeof n?.detail=="string"?n.detail:typeof n?.detail?.message=="string"?n.detail.message:null;throw new X(t.status,s??"This server did not answer the request for its desktop controls.",void 0,cl(e,t.status,s,typeof n?.detail=="object"?n.detail?.code:void 0),typeof n?.detail=="object"&&typeof n.detail?.retry_after_ms=="number"&&Number.isFinite(n.detail.retry_after_ms)?n.detail.retry_after_ms:void 0)}return n?.result}function ll(e){return e instanceof X&&e.code===Ns}function _h(e){return e instanceof X?e.status===null||e.status===503:!1}function bh(e){return e instanceof Ke&&e.code===Oi}function dl(e){return e instanceof Error&&e.message.includes(Pi)}async function wh(e){const t=await Di(e);return new Response(t.status===204?null:JSON.stringify(t.body),{status:t.status,headers:{"Content-Type":"application/json"}})}async function Sh(e,t=!1){if(window.api?.desktop)return window.api.desktop.openAuthorization(e,t);const n=await ce({op:"auth.status",id:e});if(!n.auth_url)throw new Error("This sign-in is no longer waiting for a browser.");const s=new URL(n.auth_url);if(s.username||s.password||s.protocol!=="https:"&&!(s.protocol==="http:"&&["127.0.0.1","localhost","[::1]"].includes(s.hostname)))throw new Error("The provider returned an invalid sign-in address.");window.open(s.href,"_blank","noopener,noreferrer")}function ul(e,t){const n=window.api?.desktop?.stream;if(n){const i=n.subscribe(e,t);return()=>i.dispose()}const s=new URLSearchParams({session:e.sessionId});e.epoch&&s.set("epoch",e.epoch),e.afterSeq!==void 0&&s.set("after_seq",String(e.afterSeq)),s.set("frontend_replace","1");const r=new EventSource(`/__desktop/stream?${s}`);return r.onmessage=i=>{t({kind:"data",data:i.data})},r.onerror=()=>{r.readyState===EventSource.CLOSED&&(t({kind:"error",detail:Pt.ended}),r.close())},()=>{r.close(),t({kind:"end"})}}async function fl(e,t){const n=window.api?.desktop?.media;if(n)return n(e,t);const s=await fetch("/__desktop/media",{method:"POST",headers:{"x-desktop-media":JSON.stringify(e),"Content-Type":"application/octet-stream"},body:t?new Blob([t]):void 0}),r=s.headers.get("content-type")??"";if(!s.ok){let i="The media request failed.";if(r.includes("application/json"))try{const o=await s.json();typeof o.detail=="string"&&(i=o.detail)}catch{}return{status:s.status,kind:"error",detail:i,code:i===as.noCredential?_e.noCredential:void 0}}return r.includes("application/json")?{status:s.status,kind:"json",body:await s.json()}:{status:s.status,kind:"bytes",mimeType:r||"application/octet-stream",data:new Uint8Array(await s.arrayBuffer())}}function pl(e){return e.kind==="error"?Ls(e.code)?new Ke(Ds[e.code],e.code):new Error(e.detail):new Error("The media request returned an unexpected response.")}const kh="superseded_completion_token",Th="store_busy";function Eh(e,t,n){if(!e||typeof e!="object")return!1;const s=e;return s.unseen===!1&&s.conversation_id===`session/${t}`&&s.completion_token===n}function vt(e,t,n){return!t||t.conversation_id!==`session/${n}`||!Array.isArray(t.revision)||t.revision.length!==2||!t.revision.every(s=>Number.isSafeInteger(s)&&s>=0)||e?.conversation_id===t.conversation_id&&(t.revision[0]<e.revision[0]||t.revision[1]<e.revision[1])?e:t.supported===void 0&&e?.supported!==void 0?{...t,supported:e.supported}:t}function hl(e){const t=Number(e);return Number.isFinite(t)&&t>0?Math.round(t*1e3):null}const xh=e=>typeof e?.goal_status=="string",Ih=e=>(e?.goal??"").trim().length>0;function ml(e,t,n){return n.session_id!==t||n.payload.frontend.snapshot.session_id!==t||!e?!1:e.epoch===n.epoch&&n.seq>e.seq}const Li=/\s+/,gl=/[\\/]+$/,yl=/[\\/]/,Ni=`
2
2
 
3
3
  `,vl=" — cancel with wake(",_l=120,bl=/(?:\u001b[\]PX^_]|[\u009d\u0090\u0098\u009e\u009f])(?:(?!\u0007|\u001b\\|\u009c)[\s\S])*(?:\u0007|\u001b\\|\u009c|$)|(?:\u001b\[|\u009b)[0-?]*[ -/]*[@-~]|(?:\u001b\[|\u009b)[0-?]*[ -/]*$|\u001b[ -/]+[0-~]|\u001b[@-Z\\-_]|\u001b$|[\u0000-\u0008\u000b-\u001f\u007f-\u009f]/g,wl=new RegExp("\\p{Cf}","gu"),Sl=4096;function cs(e){return e==null?"":(typeof e=="string"?e:String(e)).replace(bl,"").replace(wl,"").split(Li).filter(Boolean).join(" ").slice(0,_l)}function Mi(e){if(e.conversationName)return{name:e.conversationName,quoted:!0};const t=e.cwd.replace(gl,"");if(t){const n=t.split(yl).pop()??"";if(n)return{name:`${n}/`,quoted:!1}}return e.sessionId?{name:e.sessionId.slice(0,8),quoted:!1}:{name:"",quoted:!1}}function ji(e){const{name:t,quoted:n}=Mi(e);return t?n?`"${t}"`:t:e.pid?`pid ${e.pid}`:"another session"}function kl(e){const{name:t,quoted:n}=Mi(e),s=[];return e.pid&&s.push(`pid ${e.pid}`),e.modelLabel&&s.push(e.modelLabel),t?[n?`"${t}"`:t,...s].join(" · "):s.length>0?s.join(" · "):"another session"}function Ch(e,t){return t.trim()?!0:kl(e)!==ji(e)}function Tl(e){for(const t of e.slice(0,Sl).split(`
4
4
  `)){const n=cs(t);if(n)return n}return""}function Rh(e,t){const n=ji(e),s=Tl(t);return s?`${n} · ${s}`:n}function El(e,t){return e.pid===t.pid&&e.conversationName===t.conversationName&&e.cwd===t.cwd&&e.sessionId===t.sessionId&&e.modelLabel===t.modelLabel}const xl=/^<peer-session-message\s+((?:[^>"']|"[^"]*"|'[^']*')*)>([\s\S]*?)<\/peer-session-message>\s*$/,Il=/<\/?peer-session-message(?:[^>"']|"[^"]*"|'[^']*')*>/g,Cl=/^<peer-session-message[^>]*>/,Rl=/([a-zA-Z_]+)\s*=\s*(?:'([^']*)'|"([^"]*)"|([^\s>]+))/g;function Al(e){const t=String(e.text??e.detail??""),n=xl.exec(t.trim()),s={};if(n)for(const d of n[1].matchAll(Rl))s[d[1]]=d[2]??d[3]??d[4]??"";const r=n?n[2]:"",o=(String(e.body??"").trim()||r||(n?"":t.trim().replace(Cl,""))).replace(Il,"").trim(),c=e.sender??{},l=(d,u)=>cs(d)||cs(u);return{body:o,sender:{pid:l(c.pid,s.from_pid),conversationName:l(c.conversation_name,s.conversation),cwd:l(c.cwd,void 0),sessionId:l(c.session_id,void 0),modelLabel:l(c.model_label,s.model)}}}function Ol(e){return!!e.wake_catchup}function Ah(e){let t=e.split(Ni)[0]??"";t=t.split(Li).filter(Boolean).join(" "),t=t.split(vl)[0];const n="(alarm) ";for(;t.startsWith(n);)t=t.slice(n.length);const s="Scheduled wake ";return t.startsWith(s)&&(t=t.slice(s.length)),t.trim()}function Oh(e){const t=e.indexOf(Ni);return t===-1?"":e.slice(t+2).trim()}const Pl=new Set(["command","path","file_path","url","pattern","query","name","target","message","milestone"]),Dl=new Set(["true","yes","y","t","on","1"]),Ll={hub:{steps:e=>{const t=Tr(e);return t!==null&&Number.isInteger(t)&&t>=0?`${t} ${t===1?"step":"steps"}`:""}},wait:{wait_ms:e=>{const t=Tr(e);return t!==null&&t>0?`· ${Ui(t/1e3)}`:""}}};function Tr(e){if(typeof e=="number")return Number.isFinite(e)?e:null;if(typeof e=="string"&&e!==""){const t=Number(e);return Number.isFinite(t)?t:null}return null}const Er="mcp__",Nl=/^\/(?:Users|home)\/[^/]+\//,Ml=/\s+/;function jl(e){return!e.startsWith("/")||e.includes(" ")?e:e.replace(Nl,"~/")}function bn(e){return typeof e=="string"?jl(e.trim()).replace(/\n/g," ").trim():typeof e=="number"||typeof e=="boolean"?String(e):""}function $l(e){return e.now?"now":e.wake===!1?"quiet":"wake"}function Ul(e){const t=e.pid;if(typeof t=="number"&&Number.isFinite(t))return`pid ${t}`;const n=String(e.session??"").trim();return n?`session ${n}`:String(e.target??"").split(Ml).filter(Boolean).join(" ")||"?"}function Fl(e){return[$l(e),bn(Ul(e))||"?",bn(e.message)].filter(Boolean).join(" · ")}function Ph(e,t){const n=e.trim();if(!t)return n;if(n==="send")return Fl(t)||n;const s=Hl(n)?Object.entries(t).filter(([i])=>!Fi.has(i)):Object.entries(t);let r=s.filter(([i])=>Pl.has(i)).map(([,i])=>bn(i)).filter(Boolean);if(r.length===0){const i=Ll[n.toLowerCase()];r=s.map(([o,c])=>i?.[o]?.(c)||bn(c)).filter(Boolean)}return r.slice(0,2).join(" ")||n}function $i(e){const t=e.trim();if(!t.toLowerCase().startsWith(Er))return t;const n=t.slice(Er.length),s=n.indexOf("_");return s<=0?n||t:n.slice(s+1)||n}function Bl(e,t){return e===t||e===$i(t)}const Zl=/^(?:exit code:?\s*-?\d*|\(empty\)|--- (?:stdout|stderr) ---)$/,Gl="… ";function Dh(e,t=!1){if(!e||t)return null;for(const n of e.split(`