@entrydesk/cli 2.0.0 → 2.1.0-beta.2

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 (81) hide show
  1. package/README.md +296 -1
  2. package/dist/add-DXYghmJz.js +2 -0
  3. package/dist/agents-Drg2ZD85.js +2 -0
  4. package/dist/billing-Bkk1BhAw.js +2 -0
  5. package/dist/{budget-DcULs51p.js → budget-dazpYOON.js} +1 -1
  6. package/dist/build-task-request-config-BDlX-M_P.js +2 -0
  7. package/dist/commands-DUKXJUfr.js +2 -0
  8. package/dist/commands-FVFeS1MV.js +2 -0
  9. package/dist/{config-CI3k8CUK.js → config-CSJx1Xlt.js} +2 -2
  10. package/dist/connectors-CHcopt49.js +3 -0
  11. package/dist/file-upload-BmP4AJY0.js +16 -0
  12. package/dist/format-C3tQC6LL.js +2 -0
  13. package/dist/index.js +84 -10
  14. package/dist/instruction-BXKEUplM.js +2 -0
  15. package/dist/{login-y8SlHgZ4.js → login-ACaFCfsh.js} +1 -1
  16. package/dist/{logout-CGGEe0it.js → logout-BX4YsOqw.js} +1 -1
  17. package/dist/{marketplace-CaIuJP0T.js → marketplace-S_4fkbWt.js} +1 -1
  18. package/dist/{mcp-Yz1qXxIb.js → mcp-DOUHU2_Z.js} +2 -2
  19. package/dist/mcp-client-LcmqajIh.js +2 -0
  20. package/dist/meeting-BG76tnT9.js +3 -0
  21. package/dist/models-CkepW_-c.js +3 -0
  22. package/dist/notifications-BAMcYXhl.js +2 -0
  23. package/dist/options-CgmngSTC.js +2 -0
  24. package/dist/paginate-DUu8qbek.js +2 -0
  25. package/dist/paths-DQh1PdjS.js +2 -0
  26. package/dist/{profile-1uJ5EHdo.js → profile-BzXbLYDw.js} +1 -1
  27. package/dist/profile-storage-DlaupNlV.js +60 -0
  28. package/dist/project-B9uLW5nn.js +2 -0
  29. package/dist/project-context-VlX5GZxr.js +2 -0
  30. package/dist/project-governance-CwVlxGE2.js +2 -0
  31. package/dist/project-sources-BzMkopCj.js +2 -0
  32. package/dist/project-sources-write-D3WzWqet.js +2 -0
  33. package/dist/project-tasks-CnXLm061.js +2 -0
  34. package/dist/push-DWIgzvqe.js +2 -0
  35. package/dist/{recordings-C0Ij3tfP.js → recordings-_HnTtukO.js} +1 -1
  36. package/dist/remove-Cpen9pWn.js +2 -0
  37. package/dist/resolve-7OXPmNrX.js +6 -0
  38. package/dist/resource-grants-D-ImlByb.js +2 -0
  39. package/dist/schedules-DACWrdY_.js +21 -0
  40. package/dist/skills-BenhDHKq.js +2 -0
  41. package/dist/status-BKd81bGK.js +2 -0
  42. package/dist/{status-D6ebFbsw.js → status-ErhWpQxW.js} +1 -1
  43. package/dist/stdin-DzzLUF6W.js +2 -0
  44. package/dist/task-CvQD8Y4d.js +104 -0
  45. package/dist/tasks-C4dAgHmR.js +2 -0
  46. package/dist/tasks-CnncSIan.js +14 -0
  47. package/dist/terminal-text-D04u1hg1.js +2 -0
  48. package/dist/{tool-3NEPlGNR.js → tool-CpSoLUlR.js} +1 -1
  49. package/dist/update-D09UponU.js +2 -0
  50. package/dist/usage-Dibnsgtg.js +3 -0
  51. package/dist/{usage-audit-e6kpW0LZ.js → usage-audit-Be431Kj1.js} +3 -3
  52. package/dist/version-BTqAbDeB.js +2 -0
  53. package/dist/workflow-Dx41WM43.js +6 -0
  54. package/dist/{workspaces-BQiFZ5pV.js → workspaces-rVOwf5zp.js} +1 -1
  55. package/package.json +8 -4
  56. package/dist/add-CDlJBikf.js +0 -2
  57. package/dist/agents-vivPBsWo.js +0 -2
  58. package/dist/billing-BietwbvI.js +0 -2
  59. package/dist/build-task-request-config-Bbffa_rv.js +0 -2
  60. package/dist/commands-BCLJEd6x.js +0 -2
  61. package/dist/commands-CpuinJar.js +0 -2
  62. package/dist/connectors-CbkKDKQQ.js +0 -3
  63. package/dist/custom-connector-CxGNx65S.js +0 -2
  64. package/dist/format-BNEUX5Xv.js +0 -2
  65. package/dist/mcp-client-DdryEToX.js +0 -2
  66. package/dist/meeting-CWv3iUU6.js +0 -3
  67. package/dist/models-DFEIoTPH.js +0 -2
  68. package/dist/notifications-CBLIBZtc.js +0 -2
  69. package/dist/paths-Cqjaa_lJ.js +0 -2
  70. package/dist/profile-storage-DYUIMuP0.js +0 -72
  71. package/dist/push-BBY3QXxO.js +0 -2
  72. package/dist/remove-D-UQJ0IM.js +0 -2
  73. package/dist/schedules-CFjtG3p4.js +0 -21
  74. package/dist/skills-16msznfK.js +0 -2
  75. package/dist/status-kRSNf0Ap.js +0 -2
  76. package/dist/task-DKK82ixE.js +0 -115
  77. package/dist/tasks-DX7CQir8.js +0 -14
  78. package/dist/update-DhNwkiwD.js +0 -2
  79. package/dist/usage-050zvE6Q.js +0 -3
  80. package/dist/version-orM51hu_.js +0 -2
  81. package/dist/workflow-DHTrGTRn.js +0 -6
@@ -1,72 +0,0 @@
1
- #!/usr/bin/env node
2
- import{n as e,t}from"./rolldown-runtime-CIdiawuB.js";import n from"node:fs";import r from"node:os";import i from"node:path";import a,{HTTPError as o,TimeoutError as s,isHTTPError as c}from"ky";import{isToolUIPart as l}from"ai";import u from"node:crypto";import{execFile as d}from"node:child_process";import{setTimeout as f}from"node:timers/promises";import{decodeJwt as p}from"jose";var ee;function m(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var te=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},ne=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(ee=globalThis).__zod_globalConfig??(ee.__zod_globalConfig={});const re=globalThis.__zod_globalConfig;function h(e){return e&&Object.assign(re,e),re}function ie(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function ae(e,t){return typeof t==`bigint`?t.toString():t}function oe(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function se(e){return e==null}function ce(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function le(e,t){let n=e/t,r=Math.round(n),i=2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}const ue=Symbol(`evaluating`);function g(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==ue)return r===void 0&&(r=ue,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function de(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function fe(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function pe(e){return JSON.stringify(e)}function me(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}const he=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function ge(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const _e=oe(()=>{if(re.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function ve(e){if(ge(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return ge(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function ye(e){return ve(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const be=new Set([`string`,`number`,`symbol`]);function xe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Se(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function _(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Ce(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}const we={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Te(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return Se(e,fe(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return de(this,`shape`,e),e},checks:[]}))}function Ee(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return Se(e,fe(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return de(this,`shape`,r),r},checks:[]}))}function De(e,t){if(!ve(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return Se(e,fe(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return de(this,`shape`,n),n}}))}function Oe(e,t){if(!ve(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return Se(e,fe(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return de(this,`shape`,n),n}}))}function ke(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return Se(e,fe(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return de(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function Ae(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return Se(t,fe(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return de(this,`shape`,i),i},checks:[]}))}function je(e,t,n){return Se(t,fe(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return de(this,`shape`,i),i}}))}function Me(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Ne(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function Pe(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Fe(e){return typeof e==`string`?e:e?.message}function v(e,t,n){let r=e.message?e.message:Fe(e.inst?._zod.def?.error?.(e))??Fe(t?.error?.(e))??Fe(n.customError?.(e))??Fe(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function Ie(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Le(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}const Re=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,ae,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},ze=m(`$ZodError`,Re),Be=m(`$ZodError`,Re,{Parent:Error});function Ve(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function He(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i];i===e.length-1?(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(a))):r[n]=r[n]||{_errors:[]},r=r[n],i++}}}};return r(e),n}const Ue=e=>(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new te;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>v(e,a,h())));throw he(t,i?.callee),t}return o.value},We=e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>v(e,a,h())));throw he(t,i?.callee),t}return o.value},Ge=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new te;return a.issues.length?{success:!1,error:new(e??ze)(a.issues.map(e=>v(e,i,h())))}:{success:!0,data:a.value}},Ke=Ge(Be),qe=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>v(e,i,h())))}:{success:!0,data:a.value}},Je=qe(Be),Ye=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ue(e)(t,n,i)},Xe=e=>(t,n,r)=>Ue(e)(t,n,r),Ze=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return We(e)(t,n,i)},Qe=e=>async(t,n,r)=>We(e)(t,n,r),$e=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ge(e)(t,n,i)},et=e=>(t,n,r)=>Ge(e)(t,n,r),tt=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return qe(e)(t,n,i)},nt=e=>async(t,n,r)=>qe(e)(t,n,r),rt=/^[cC][0-9a-z]{6,}$/,it=/^[0-9a-z]+$/,at=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,ot=/^[0-9a-vA-V]{20}$/,st=/^[A-Za-z0-9]{27}$/,ct=/^[a-zA-Z0-9_-]{21}$/,lt=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,ut=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,dt=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,ft=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function pt(){return RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`)}const mt=/^(?:(?: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])$/,ht=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,gt=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,_t=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,vt=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,yt=/^[A-Za-z0-9_-]*$/,bt=/^https?$/,xt=/^\+[1-9]\d{6,14}$/,St=`(?:(?:\\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])))`,Ct=RegExp(`^${St}$`);function wt(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Tt(e){return RegExp(`^${wt(e)}$`)}function Et(e){let t=wt({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${St}T(?:${r})$`)}const Dt=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},Ot=/^-?\d+$/,kt=/^-?\d+(?:\.\d+)?$/,At=/^(?:true|false)$/i,jt=/^null$/i,Mt=/^[^A-Z]*$/,Nt=/^[^a-z]*$/,y=m(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Pt={number:`number`,bigint:`bigint`,object:`date`},Ft=m(`$ZodCheckLessThan`,(e,t)=>{y.init(e,t);let n=Pt[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),It=m(`$ZodCheckGreaterThan`,(e,t)=>{y.init(e,t);let n=Pt[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Lt=m(`$ZodCheckMultipleOf`,(e,t)=>{y.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):le(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Rt=m(`$ZodCheckNumberFormat`,(e,t)=>{y.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=we[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=Ot)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),zt=m(`$ZodCheckMaxLength`,(e,t)=>{var n;y.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!se(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=Ie(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Bt=m(`$ZodCheckMinLength`,(e,t)=>{var n;y.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!se(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=Ie(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Vt=m(`$ZodCheckLengthEquals`,(e,t)=>{var n;y.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!se(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=Ie(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Ht=m(`$ZodCheckStringFormat`,(e,t)=>{var n,r;y.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Ut=m(`$ZodCheckRegex`,(e,t)=>{Ht.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Wt=m(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Mt,Ht.init(e,t)}),Gt=m(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Nt,Ht.init(e,t)}),Kt=m(`$ZodCheckIncludes`,(e,t)=>{y.init(e,t);let n=xe(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),qt=m(`$ZodCheckStartsWith`,(e,t)=>{y.init(e,t);let n=RegExp(`^${xe(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Jt=m(`$ZodCheckEndsWith`,(e,t)=>{y.init(e,t);let n=RegExp(`.*${xe(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Yt=m(`$ZodCheckOverwrite`,(e,t)=>{y.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});var Xt=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
3
- `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
4
- `))}};const Zt={major:4,minor:4,patch:3},b=m(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Zt;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=Me(e),i;for(let a of t){if(a._zod.def.when){if(Ne(e)||!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new te;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=Me(e,t))});else{if(e.issues.length===t)continue;r||=Me(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(Me(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new te;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new te;return o.then(e=>t(e,r,a))}return t(o,r,a)}}g(e,`~standard`,()=>({validate:t=>{try{let n=Ke(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return Je(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),Qt=m(`$ZodString`,(e,t)=>{b.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Dt(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),x=m(`$ZodStringFormat`,(e,t)=>{Ht.init(e,t),Qt.init(e,t)}),$t=m(`$ZodGUID`,(e,t)=>{t.pattern??=ut,x.init(e,t)}),en=m(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=dt(e)}else t.pattern??=dt();x.init(e,t)}),tn=m(`$ZodEmail`,(e,t)=>{t.pattern??=ft,x.init(e,t)}),nn=m(`$ZodURL`,(e,t)=>{x.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===bt.source&&!/^https?:\/\//i.test(r)){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}let i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),rn=m(`$ZodEmoji`,(e,t)=>{t.pattern??=pt(),x.init(e,t)}),an=m(`$ZodNanoID`,(e,t)=>{t.pattern??=ct,x.init(e,t)}),on=m(`$ZodCUID`,(e,t)=>{t.pattern??=rt,x.init(e,t)}),sn=m(`$ZodCUID2`,(e,t)=>{t.pattern??=it,x.init(e,t)}),cn=m(`$ZodULID`,(e,t)=>{t.pattern??=at,x.init(e,t)}),ln=m(`$ZodXID`,(e,t)=>{t.pattern??=ot,x.init(e,t)}),un=m(`$ZodKSUID`,(e,t)=>{t.pattern??=st,x.init(e,t)}),dn=m(`$ZodISODateTime`,(e,t)=>{t.pattern??=Et(t),x.init(e,t)}),fn=m(`$ZodISODate`,(e,t)=>{t.pattern??=Ct,x.init(e,t)}),pn=m(`$ZodISOTime`,(e,t)=>{t.pattern??=Tt(t),x.init(e,t)}),mn=m(`$ZodISODuration`,(e,t)=>{t.pattern??=lt,x.init(e,t)}),hn=m(`$ZodIPv4`,(e,t)=>{t.pattern??=mt,x.init(e,t),e._zod.bag.format=`ipv4`}),gn=m(`$ZodIPv6`,(e,t)=>{t.pattern??=ht,x.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),_n=m(`$ZodCIDRv4`,(e,t)=>{t.pattern??=gt,x.init(e,t)}),vn=m(`$ZodCIDRv6`,(e,t)=>{t.pattern??=_t,x.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function yn(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const bn=m(`$ZodBase64`,(e,t)=>{t.pattern??=vt,x.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{yn(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function xn(e){if(!yt.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return yn(t.padEnd(Math.ceil(t.length/4)*4,`=`))}const Sn=m(`$ZodBase64URL`,(e,t)=>{t.pattern??=yt,x.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{xn(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Cn=m(`$ZodE164`,(e,t)=>{t.pattern??=xt,x.init(e,t)});function wn(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}const Tn=m(`$ZodJWT`,(e,t)=>{x.init(e,t),e._zod.check=n=>{wn(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),En=m(`$ZodNumber`,(e,t)=>{b.init(e,t),e._zod.pattern=e._zod.bag.pattern??kt,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),Dn=m(`$ZodNumberFormat`,(e,t)=>{Rt.init(e,t),En.init(e,t)}),On=m(`$ZodBoolean`,(e,t)=>{b.init(e,t),e._zod.pattern=At,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),kn=m(`$ZodNull`,(e,t)=>{b.init(e,t),e._zod.pattern=jt,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),An=m(`$ZodAny`,(e,t)=>{b.init(e,t),e._zod.parse=e=>e}),jn=m(`$ZodUnknown`,(e,t)=>{b.init(e,t),e._zod.parse=e=>e}),Mn=m(`$ZodNever`,(e,t)=>{b.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)}),Nn=m(`$ZodDate`,(e,t)=>{b.init(e,t),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=new Date(n.value)}catch{}let i=n.value,a=i instanceof Date;return a&&!Number.isNaN(i.getTime())||n.issues.push({expected:`date`,code:`invalid_type`,input:i,...a?{received:`Invalid Date`}:{},inst:e}),n}});function Pn(e,t,n){e.issues.length&&t.issues.push(...Pe(n,e.issues)),t.value[n]=e.value}const Fn=m(`$ZodArray`,(e,t)=>{b.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>Pn(t,n,e))):Pn(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function In(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...Pe(n,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}function Ln(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=Ce(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Rn(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin===`optional`,d=c.optout===`optional`;for(let i in t){if(i===`__proto__`||s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>In(e,n,i,t,u,d))):In(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}const zn=m(`$ZodObject`,(e,t)=>{if(b.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}let n=oe(()=>Ln(t));g(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=ge,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optin===`optional`,i=n._zod.optout===`optional`,a=n._zod.run({value:s[e],issues:[]},o);a instanceof Promise?c.push(a.then(n=>In(n,t,e,s,r,i))):In(a,t,e,s,r,i)}return i?Rn(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),Bn=m(`$ZodObjectJIT`,(e,t)=>{zn.init(e,t);let n=e._zod.parse,r=oe(()=>Ln(t)),i=e=>{let t=new Xt([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=pe(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=pe(r),s=e[r],c=s?._zod?.optin===`optional`,l=s?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),c&&l?t.write(`
5
- if (${n}.issues.length) {
6
- if (${o} in input) {
7
- payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
8
- ...iss,
9
- path: iss.path ? [${o}, ...iss.path] : [${o}]
10
- })));
11
- }
12
- }
13
-
14
- if (${n}.value === undefined) {
15
- if (${o} in input) {
16
- newResult[${o}] = undefined;
17
- }
18
- } else {
19
- newResult[${o}] = ${n}.value;
20
- }
21
-
22
- `):c?t.write(`
23
- if (${n}.issues.length) {
24
- payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
25
- ...iss,
26
- path: iss.path ? [${o}, ...iss.path] : [${o}]
27
- })));
28
- }
29
-
30
- if (${n}.value === undefined) {
31
- if (${o} in input) {
32
- newResult[${o}] = undefined;
33
- }
34
- } else {
35
- newResult[${o}] = ${n}.value;
36
- }
37
-
38
- `):t.write(`
39
- const ${n}_present = ${o} in input;
40
- if (${n}.issues.length) {
41
- payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
42
- ...iss,
43
- path: iss.path ? [${o}, ...iss.path] : [${o}]
44
- })));
45
- }
46
- if (!${n}_present && !${n}.issues.length) {
47
- payload.issues.push({
48
- code: "invalid_type",
49
- expected: "nonoptional",
50
- input: undefined,
51
- path: [${o}]
52
- });
53
- }
54
-
55
- if (${n}_present) {
56
- if (${n}.value === undefined) {
57
- newResult[${o}] = undefined;
58
- } else {
59
- newResult[${o}] = ${n}.value;
60
- }
61
- }
62
-
63
- `)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=ge,s=!re.jitless,c=s&&_e.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?Rn([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function Vn(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!Me(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>v(e,r,h())))}),t)}const Hn=m(`$ZodUnion`,(e,t)=>{b.init(e,t),g(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),g(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),g(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),g(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>ce(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>Vn(t,r,e,i)):Vn(o,r,e,i)}}),Un=m(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,Hn.init(e,t);let n=e._zod.parse;g(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=oe(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!ge(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()),input:o,path:[t.discriminator],inst:e}),i)}}),Wn=m(`$ZodIntersection`,(e,t)=>{b.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>Kn(e,t,n)):Kn(e,i,a)}});function Gn(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(ve(e)&&ve(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=Gn(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=Gn(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Kn(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),Me(e))return e;let o=Gn(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}const qn=m(`$ZodTuple`,(e,t)=>{b.init(e,t);let n=t.items;e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({input:a,inst:e,expected:`tuple`,code:`invalid_type`}),r;r.value=[];let o=[],s=Jn(n,`optin`),c=Jn(n,`optout`);if(!t.rest){if(a.length<s)return r.issues.push({code:`too_small`,minimum:s,inclusive:!0,input:a,inst:e,origin:`array`}),r;a.length>n.length&&r.issues.push({code:`too_big`,maximum:n.length,inclusive:!0,input:a,inst:e,origin:`array`})}let l=Array(n.length);for(let e=0;e<n.length;e++){let t=n[e]._zod.run({value:a[e],issues:[]},i);t instanceof Promise?o.push(t.then(t=>{l[e]=t})):l[e]=t}if(t.rest){let e=n.length-1,s=a.slice(n.length);for(let n of s){e++;let a=t.rest._zod.run({value:n,issues:[]},i);a instanceof Promise?o.push(a.then(t=>Yn(t,r,e))):Yn(a,r,e)}}return o.length?Promise.all(o).then(()=>Xn(l,r,n,a,c)):Xn(l,r,n,a,c)}});function Jn(e,t){for(let n=e.length-1;n>=0;n--)if(e[n]._zod[t]!==`optional`)return n+1;return 0}function Yn(e,t,n){e.issues.length&&t.issues.push(...Pe(n,e.issues)),t.value[n]=e.value}function Xn(e,t,n,r,i){for(let a=0;a<n.length;a++){let n=e[a],o=a<r.length;if(n.issues.length){if(!o&&a>=i){t.value.length=a;break}t.issues.push(...Pe(a,n.issues))}t.value[a]=n.value}for(let e=t.value.length-1;e>=r.length&&n[e]._zod.optout===`optional`&&t.value[e]===void 0;e--)t.value.length=e;return t}const Zn=m(`$ZodRecord`,(e,t)=>{b.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!ve(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],o=t.keyType._zod.values;if(o){n.value={};let s=new Set;for(let c of o)if(typeof c==`string`||typeof c==`number`||typeof c==`symbol`){s.add(typeof c==`number`?c.toString():c);let o=t.keyType._zod.run({value:c,issues:[]},r);if(o instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(o.issues.length){n.issues.push({code:`invalid_key`,origin:`record`,issues:o.issues.map(e=>v(e,r,h())),input:c,path:[c],inst:e});continue}let l=o.value,u=t.valueType._zod.run({value:i[c],issues:[]},r);u instanceof Promise?a.push(u.then(e=>{e.issues.length&&n.issues.push(...Pe(c,e.issues)),n.value[l]=e.value})):(u.issues.length&&n.issues.push(...Pe(c,u.issues)),n.value[l]=u.value)}let c;for(let e in i)s.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:c})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`||!Object.prototype.propertyIsEnumerable.call(i,o))continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&kt.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(s=e)}if(s.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>v(e,r,h())),input:o,path:[o],inst:e});continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...Pe(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...Pe(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),Qn=m(`$ZodEnum`,(e,t)=>{b.init(e,t);let n=ie(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>be.has(typeof e)).map(e=>typeof e==`string`?xe(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),$n=m(`$ZodLiteral`,(e,t)=>{if(b.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?xe(e):e?xe(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),er=m(`$ZodTransform`,(e,t)=>{b.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new ne(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n.fallback=!0,n));if(i instanceof Promise)throw new te;return n.value=i,n.fallback=!0,n}});function tr(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}const nr=m(`$ZodOptional`,(e,t)=>{b.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,g(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),g(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${ce(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>tr(e,r)):tr(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),rr=m(`$ZodExactOptional`,(e,t)=>{nr.init(e,t),g(e._zod,`values`,()=>t.innerType._zod.values),g(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),ir=m(`$ZodNullable`,(e,t)=>{b.init(e,t),g(e._zod,`optin`,()=>t.innerType._zod.optin),g(e._zod,`optout`,()=>t.innerType._zod.optout),g(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${ce(e.source)}|null)$`):void 0}),g(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),ar=m(`$ZodDefault`,(e,t)=>{b.init(e,t),e._zod.optin=`optional`,g(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>or(e,t)):or(r,t)}});function or(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const sr=m(`$ZodPrefault`,(e,t)=>{b.init(e,t),e._zod.optin=`optional`,g(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),cr=m(`$ZodNonOptional`,(e,t)=>{b.init(e,t),g(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>lr(t,e)):lr(i,e)}});function lr(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}const ur=m(`$ZodCatch`,(e,t)=>{b.init(e,t),e._zod.optin=`optional`,g(e._zod,`optout`,()=>t.innerType._zod.optout),g(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>v(e,n,h()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>v(e,n,h()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),dr=m(`$ZodPipe`,(e,t)=>{b.init(e,t),g(e._zod,`values`,()=>t.in._zod.values),g(e._zod,`optin`,()=>t.in._zod.optin),g(e._zod,`optout`,()=>t.out._zod.optout),g(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>fr(e,t.in,n)):fr(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>fr(e,t.out,n)):fr(r,t.out,n)}});function fr(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}const pr=m(`$ZodCodec`,(e,t)=>{b.init(e,t),g(e._zod,`values`,()=>t.in._zod.values),g(e._zod,`optin`,()=>t.in._zod.optin),g(e._zod,`optout`,()=>t.out._zod.optout),g(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if((n.direction||`forward`)===`forward`){let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>mr(e,t,n)):mr(r,t,n)}else{let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>mr(e,t,n)):mr(r,t,n)}}});function mr(e,t,n){if(e.issues.length)return e.aborted=!0,e;if((n.direction||`forward`)===`forward`){let r=t.transform(e.value,e);return r instanceof Promise?r.then(r=>hr(e,r,t.out,n)):hr(e,r,t.out,n)}else{let r=t.reverseTransform(e.value,e);return r instanceof Promise?r.then(r=>hr(e,r,t.in,n)):hr(e,r,t.in,n)}}function hr(e,t,n,r){return e.issues.length?(e.aborted=!0,e):n._zod.run({value:t,issues:e.issues},r)}const gr=m(`$ZodPreprocess`,(e,t)=>{dr.init(e,t)}),_r=m(`$ZodReadonly`,(e,t)=>{b.init(e,t),g(e._zod,`propValues`,()=>t.innerType._zod.propValues),g(e._zod,`values`,()=>t.innerType._zod.values),g(e._zod,`optin`,()=>t.innerType?._zod?.optin),g(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(vr):vr(r)}});function vr(e){return e.value=Object.freeze(e.value),e}const yr=m(`$ZodCustom`,(e,t)=>{y.init(e,t),b.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>br(t,n,r,e));br(i,n,r,e)}});function br(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Le(e))}}var xr,Sr=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Cr(){return new Sr}(xr=globalThis).__zod_globalRegistry??(xr.__zod_globalRegistry=Cr());const wr=globalThis.__zod_globalRegistry;function Tr(e,t){return new e({type:`string`,..._(t)})}function Er(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,..._(t)})}function Dr(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,..._(t)})}function Or(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,..._(t)})}function kr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,..._(t)})}function Ar(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,..._(t)})}function jr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,..._(t)})}function Mr(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,..._(t)})}function Nr(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,..._(t)})}function Pr(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,..._(t)})}function Fr(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,..._(t)})}function Ir(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,..._(t)})}function Lr(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,..._(t)})}function Rr(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,..._(t)})}function zr(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,..._(t)})}function Br(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,..._(t)})}function Vr(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,..._(t)})}function Hr(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,..._(t)})}function Ur(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,..._(t)})}function Wr(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,..._(t)})}function Gr(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,..._(t)})}function Kr(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,..._(t)})}function qr(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,..._(t)})}function Jr(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,..._(t)})}function Yr(e,t){return new e({type:`string`,format:`date`,check:`string_format`,..._(t)})}function Xr(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,..._(t)})}function Zr(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,..._(t)})}function Qr(e,t){return new e({type:`number`,checks:[],..._(t)})}function $r(e,t){return new e({type:`number`,coerce:!0,checks:[],..._(t)})}function ei(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,..._(t)})}function ti(e,t){return new e({type:`boolean`,..._(t)})}function ni(e,t){return new e({type:`null`,..._(t)})}function ri(e){return new e({type:`any`})}function ii(e){return new e({type:`unknown`})}function ai(e,t){return new e({type:`never`,..._(t)})}function oi(e,t){return new e({type:`date`,coerce:!0,..._(t)})}function si(e,t){return new Ft({check:`less_than`,..._(t),value:e,inclusive:!1})}function ci(e,t){return new Ft({check:`less_than`,..._(t),value:e,inclusive:!0})}function li(e,t){return new It({check:`greater_than`,..._(t),value:e,inclusive:!1})}function ui(e,t){return new It({check:`greater_than`,..._(t),value:e,inclusive:!0})}function di(e,t){return new Lt({check:`multiple_of`,..._(t),value:e})}function fi(e,t){return new zt({check:`max_length`,..._(t),maximum:e})}function pi(e,t){return new Bt({check:`min_length`,..._(t),minimum:e})}function mi(e,t){return new Vt({check:`length_equals`,..._(t),length:e})}function hi(e,t){return new Ut({check:`string_format`,format:`regex`,..._(t),pattern:e})}function gi(e){return new Wt({check:`string_format`,format:`lowercase`,..._(e)})}function _i(e){return new Gt({check:`string_format`,format:`uppercase`,..._(e)})}function vi(e,t){return new Kt({check:`string_format`,format:`includes`,..._(t),includes:e})}function yi(e,t){return new qt({check:`string_format`,format:`starts_with`,..._(t),prefix:e})}function bi(e,t){return new Jt({check:`string_format`,format:`ends_with`,..._(t),suffix:e})}function xi(e){return new Yt({check:`overwrite`,tx:e})}function Si(e){return xi(t=>t.normalize(e))}function Ci(){return xi(e=>e.trim())}function wi(){return xi(e=>e.toLowerCase())}function Ti(){return xi(e=>e.toUpperCase())}function Ei(){return xi(e=>me(e))}function Di(e,t,n){return new e({type:`array`,element:t,..._(n)})}function Oi(e,t,n){let r=_(n);return r.abort??=!0,new e({type:`custom`,check:`custom`,fn:t,...r})}function ki(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,..._(n)})}function Ai(e,t){let n=ji(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Le(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=t.value,r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(Le(r))}},e(t.value,t)),t);return n}function ji(e,t){let n=new y({check:`custom`,..._(t)});return n._zod.check=e,n}function Mi(e,t){let n=_(t),r=n.truthy??[`true`,`1`,`yes`,`on`,`y`,`enabled`],i=n.falsy??[`false`,`0`,`no`,`off`,`n`,`disabled`];n.case!==`sensitive`&&(r=r.map(e=>typeof e==`string`?e.toLowerCase():e),i=i.map(e=>typeof e==`string`?e.toLowerCase():e));let a=new Set(r),o=new Set(i),s=e.Codec??pr,c=e.Boolean??On,l=new s({type:`pipe`,in:new(e.String??Qt)({type:`string`,error:n.error}),out:new c({type:`boolean`,error:n.error}),transform:((e,t)=>{let r=e;return n.case!==`sensitive`&&(r=r.toLowerCase()),a.has(r)?!0:o.has(r)?!1:(t.issues.push({code:`invalid_value`,expected:`stringbool`,values:[...a,...o],input:t.value,inst:l,continue:!1}),{})}),reverseTransform:((e,t)=>e===!0?r[0]||`true`:i[0]||`false`),error:n.error});return l}function Ni(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??wr,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function S(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,S(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&C(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Pi(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
64
-
65
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function Fi(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:Li(t,`input`,e.processors),output:Li(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function C(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return C(r.element,n);if(r.type===`set`)return C(r.valueType,n);if(r.type===`lazy`)return C(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`)return C(r.innerType,n);if(r.type===`intersection`)return C(r.left,n)||C(r.right,n);if(r.type===`record`||r.type===`map`)return C(r.keyType,n)||C(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:C(r.in,n)||C(r.out,n);if(r.type===`object`){for(let e in r.shape)if(C(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(C(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(C(e,n))return!0;return!!(r.rest&&C(r.rest,n))}return!1}const Ii=(e,t={})=>n=>{let r=Ni({...n,processors:t});return S(e,r),Pi(r,e),Fi(r,e)},Li=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Ni({...i??{},target:a,io:t,processors:n});return S(e,o),Pi(o,e),Fi(o,e)},Ri={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},zi=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Ri[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Bi=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},Vi=(e,t,n,r)=>{n.type=`boolean`},Hi=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},Ui=(e,t,n,r)=>{n.not={}},Wi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Date cannot be represented in JSON Schema`)},Gi=(e,t,n,r)=>{let i=e._zod.def,a=ie(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Ki=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},qi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Ji=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Yi=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=S(a.element,t,{...r,path:[...r.path,`items`]})},Xi=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=S(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=S(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Zi=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>S(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Qi=(e,t,n,r)=>{let i=e._zod.def,a=S(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=S(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},$i=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>S(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?S(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null;t.target===`draft-2020-12`?(i.prefixItems=c,l&&(i.items=l)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),i.minItems=c.length,l||(i.maxItems=c.length)):(i.items=c,l&&(i.additionalItems=l));let{minimum:u,maximum:d}=e._zod.bag;typeof u==`number`&&(i.minItems=u),typeof d==`number`&&(i.maxItems=d)},ea=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=S(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else(t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=S(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=S(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},ta=(e,t,n,r)=>{let i=e._zod.def,a=S(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},na=(e,t,n,r)=>{let i=e._zod.def;S(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ra=(e,t,n,r)=>{let i=e._zod.def;S(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},ia=(e,t,n,r)=>{let i=e._zod.def;S(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},aa=(e,t,n,r)=>{let i=e._zod.def;S(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},oa=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;S(o,t,r);let s=t.seen.get(e);s.ref=o},sa=(e,t,n,r)=>{let i=e._zod.def;S(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},ca=(e,t,n,r)=>{let i=e._zod.def;S(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},la=m(`ZodISODateTime`,(e,t)=>{dn.init(e,t),O.init(e,t)});function w(e){return Jr(la,e)}const ua=m(`ZodISODate`,(e,t)=>{fn.init(e,t),O.init(e,t)});function da(e){return Yr(ua,e)}const fa=m(`ZodISOTime`,(e,t)=>{pn.init(e,t),O.init(e,t)});function pa(e){return Xr(fa,e)}const ma=m(`ZodISODuration`,(e,t)=>{mn.init(e,t),O.init(e,t)});function ha(e){return Zr(ma,e)}const T=m(`ZodError`,(e,t)=>{ze.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>He(e,t)},flatten:{value:t=>Ve(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,ae,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,ae,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),ga=Ue(T),_a=We(T),va=Ge(T),ya=qe(T),ba=Ye(T),xa=Xe(T),Sa=Ze(T),Ca=Qe(T),wa=$e(T),Ta=et(T),Ea=tt(T),Da=nt(T),Oa=new WeakMap;function ka(e,t,n){let r=Object.getPrototypeOf(e),i=Oa.get(r);if(i||(i=new Set,Oa.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}const E=m(`ZodType`,(e,t)=>(b.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:Li(e,`input`),output:Li(e,`output`)}}),e.toJSONSchema=Ii(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>ga(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>va(e,t,n),e.parseAsync=async(t,n)=>_a(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>ya(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>ba(e,t,n),e.decode=(t,n)=>xa(e,t,n),e.encodeAsync=async(t,n)=>Sa(e,t,n),e.decodeAsync=async(t,n)=>Ca(e,t,n),e.safeEncode=(t,n)=>wa(e,t,n),e.safeDecode=(t,n)=>Ta(e,t,n),e.safeEncodeAsync=async(t,n)=>Ea(e,t,n),e.safeDecodeAsync=async(t,n)=>Da(e,t,n),ka(e,`ZodType`,{check(...e){let t=this.def;return this.clone(fe(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Se(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Yo(e,t))},superRefine(e,t){return this.check(Xo(e,t))},overwrite(e){return this.check(xi(e))},optional(){return Oo(this)},exactOptional(){return Ao(this)},nullable(){return Mo(this)},nullish(){return Oo(Mo(this))},nonoptional(e){return Ro(this,e)},array(){return F(this)},or(e){return L([this,e])},and(e){return _o(this,e)},transform(e){return Ho(this,Eo(e))},default(e){return Po(this,e)},prefault(e){return Io(this,e)},catch(e){return Bo(this,e)},pipe(e){return Ho(this,e)},readonly(){return Ko(this)},describe(e){let t=this.clone();return wr.add(t,{description:e}),t},meta(...e){if(e.length===0)return wr.get(this);let t=this.clone();return wr.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){return wr.get(e)?.description},configurable:!0}),e)),Aa=m(`_ZodString`,(e,t)=>{Qt.init(e,t),E.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zi(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,ka(e,`_ZodString`,{regex(...e){return this.check(hi(...e))},includes(...e){return this.check(vi(...e))},startsWith(...e){return this.check(yi(...e))},endsWith(...e){return this.check(bi(...e))},min(...e){return this.check(pi(...e))},max(...e){return this.check(fi(...e))},length(...e){return this.check(mi(...e))},nonempty(...e){return this.check(pi(1,...e))},lowercase(e){return this.check(gi(e))},uppercase(e){return this.check(_i(e))},trim(){return this.check(Ci())},normalize(...e){return this.check(Si(...e))},toLowerCase(){return this.check(wi())},toUpperCase(){return this.check(Ti())},slugify(){return this.check(Ei())}})}),ja=m(`ZodString`,(e,t)=>{Qt.init(e,t),Aa.init(e,t),e.email=t=>e.check(Er(Ma,t)),e.url=t=>e.check(Mr(Fa,t)),e.jwt=t=>e.check(qr(Za,t)),e.emoji=t=>e.check(Nr(Ia,t)),e.guid=t=>e.check(Dr(Na,t)),e.uuid=t=>e.check(Or(Pa,t)),e.uuidv4=t=>e.check(kr(Pa,t)),e.uuidv6=t=>e.check(Ar(Pa,t)),e.uuidv7=t=>e.check(jr(Pa,t)),e.nanoid=t=>e.check(Pr(La,t)),e.guid=t=>e.check(Dr(Na,t)),e.cuid=t=>e.check(Fr(Ra,t)),e.cuid2=t=>e.check(Ir(za,t)),e.ulid=t=>e.check(Lr(Ba,t)),e.base64=t=>e.check(Wr(qa,t)),e.base64url=t=>e.check(Gr(Ya,t)),e.xid=t=>e.check(Rr(Va,t)),e.ksuid=t=>e.check(zr(Ha,t)),e.ipv4=t=>e.check(Br(Ua,t)),e.ipv6=t=>e.check(Vr(Wa,t)),e.cidrv4=t=>e.check(Hr(Ga,t)),e.cidrv6=t=>e.check(Ur(Ka,t)),e.e164=t=>e.check(Kr(Xa,t)),e.datetime=t=>e.check(w(t)),e.date=t=>e.check(da(t)),e.time=t=>e.check(pa(t)),e.duration=t=>e.check(ha(t))});function D(e){return Tr(ja,e)}const O=m(`ZodStringFormat`,(e,t)=>{x.init(e,t),Aa.init(e,t)}),Ma=m(`ZodEmail`,(e,t)=>{tn.init(e,t),O.init(e,t)});function k(e){return Er(Ma,e)}const Na=m(`ZodGUID`,(e,t)=>{$t.init(e,t),O.init(e,t)}),Pa=m(`ZodUUID`,(e,t)=>{en.init(e,t),O.init(e,t)});function A(e){return Or(Pa,e)}const Fa=m(`ZodURL`,(e,t)=>{nn.init(e,t),O.init(e,t)});function j(e){return Mr(Fa,e)}const Ia=m(`ZodEmoji`,(e,t)=>{rn.init(e,t),O.init(e,t)}),La=m(`ZodNanoID`,(e,t)=>{an.init(e,t),O.init(e,t)}),Ra=m(`ZodCUID`,(e,t)=>{on.init(e,t),O.init(e,t)}),za=m(`ZodCUID2`,(e,t)=>{sn.init(e,t),O.init(e,t)}),Ba=m(`ZodULID`,(e,t)=>{cn.init(e,t),O.init(e,t)}),Va=m(`ZodXID`,(e,t)=>{ln.init(e,t),O.init(e,t)}),Ha=m(`ZodKSUID`,(e,t)=>{un.init(e,t),O.init(e,t)}),Ua=m(`ZodIPv4`,(e,t)=>{hn.init(e,t),O.init(e,t)}),Wa=m(`ZodIPv6`,(e,t)=>{gn.init(e,t),O.init(e,t)}),Ga=m(`ZodCIDRv4`,(e,t)=>{_n.init(e,t),O.init(e,t)}),Ka=m(`ZodCIDRv6`,(e,t)=>{vn.init(e,t),O.init(e,t)}),qa=m(`ZodBase64`,(e,t)=>{bn.init(e,t),O.init(e,t)});function Ja(e){return Wr(qa,e)}const Ya=m(`ZodBase64URL`,(e,t)=>{Sn.init(e,t),O.init(e,t)}),Xa=m(`ZodE164`,(e,t)=>{Cn.init(e,t),O.init(e,t)}),Za=m(`ZodJWT`,(e,t)=>{Tn.init(e,t),O.init(e,t)}),Qa=m(`ZodNumber`,(e,t)=>{En.init(e,t),E.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bi(e,t,n,r),ka(e,`ZodNumber`,{gt(e,t){return this.check(li(e,t))},gte(e,t){return this.check(ui(e,t))},min(e,t){return this.check(ui(e,t))},lt(e,t){return this.check(si(e,t))},lte(e,t){return this.check(ci(e,t))},max(e,t){return this.check(ci(e,t))},int(e){return this.check(eo(e))},safe(e){return this.check(eo(e))},positive(e){return this.check(li(0,e))},nonnegative(e){return this.check(ui(0,e))},negative(e){return this.check(si(0,e))},nonpositive(e){return this.check(ci(0,e))},multipleOf(e,t){return this.check(di(e,t))},step(e,t){return this.check(di(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function M(e){return Qr(Qa,e)}const $a=m(`ZodNumberFormat`,(e,t)=>{Dn.init(e,t),Qa.init(e,t)});function eo(e){return ei($a,e)}const to=m(`ZodBoolean`,(e,t)=>{On.init(e,t),E.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vi(e,t,n,r)});function N(e){return ti(to,e)}const no=m(`ZodNull`,(e,t)=>{kn.init(e,t),E.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hi(e,t,n,r)});function ro(e){return ni(no,e)}const io=m(`ZodAny`,(e,t)=>{An.init(e,t),E.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function ao(){return ri(io)}const oo=m(`ZodUnknown`,(e,t)=>{jn.init(e,t),E.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function P(){return ii(oo)}const so=m(`ZodNever`,(e,t)=>{Mn.init(e,t),E.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ui(e,t,n,r)});function co(e){return ai(so,e)}const lo=m(`ZodDate`,(e,t)=>{Nn.init(e,t),E.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wi(e,t,n,r),e.min=(t,n)=>e.check(ui(t,n)),e.max=(t,n)=>e.check(ci(t,n));let n=e._zod.bag;e.minDate=n.minimum?new Date(n.minimum):null,e.maxDate=n.maximum?new Date(n.maximum):null}),uo=m(`ZodArray`,(e,t)=>{Fn.init(e,t),E.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yi(e,t,n,r),e.element=t.element,ka(e,`ZodArray`,{min(e,t){return this.check(pi(e,t))},nonempty(e){return this.check(pi(1,e))},max(e,t){return this.check(fi(e,t))},length(e,t){return this.check(mi(e,t))},unwrap(){return this.element}})});function F(e,t){return Di(uo,e,t)}const fo=m(`ZodObject`,(e,t)=>{Bn.init(e,t),E.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xi(e,t,n,r),g(e,`shape`,()=>t.shape),ka(e,`ZodObject`,{keyof(){return z(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:P()})},loose(){return this.clone({...this._zod.def,catchall:P()})},strict(){return this.clone({...this._zod.def,catchall:co()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return De(this,e)},safeExtend(e){return Oe(this,e)},merge(e){return ke(this,e)},pick(e){return Te(this,e)},omit(e){return Ee(this,e)},partial(...e){return Ae(Do,this,e[0])},required(...e){return je(Lo,this,e[0])}})});function I(e,t){let n={type:`object`,shape:e??{},..._(t)};return new fo(n)}function po(e,t){return new fo({type:`object`,shape:e,catchall:P(),..._(t)})}const mo=m(`ZodUnion`,(e,t)=>{Hn.init(e,t),E.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zi(e,t,n,r),e.options=t.options});function L(e,t){return new mo({type:`union`,options:e,..._(t)})}const ho=m(`ZodDiscriminatedUnion`,(e,t)=>{mo.init(e,t),Un.init(e,t)});function R(e,t,n){return new ho({type:`union`,options:t,discriminator:e,..._(n)})}const go=m(`ZodIntersection`,(e,t)=>{Wn.init(e,t),E.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qi(e,t,n,r)});function _o(e,t){return new go({type:`intersection`,left:e,right:t})}const vo=m(`ZodTuple`,(e,t)=>{qn.init(e,t),E.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$i(e,t,n,r),e.rest=t=>e.clone({...e._zod.def,rest:t})});function yo(e,t,n){let r=t instanceof b;return new vo({type:`tuple`,items:e,rest:r?t:null,..._(r?n:t)})}const bo=m(`ZodRecord`,(e,t)=>{Zn.init(e,t),E.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ea(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function xo(e,t,n){return!t||!t._zod?new bo({type:`record`,keyType:D(),valueType:e,..._(t)}):new bo({type:`record`,keyType:e,valueType:t,..._(n)})}function So(e,t,n){let r=Se(e);return r._zod.values=void 0,new bo({type:`record`,keyType:r,valueType:t,..._(n)})}const Co=m(`ZodEnum`,(e,t)=>{Qn.init(e,t),E.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gi(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new Co({...t,checks:[],..._(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new Co({...t,checks:[],..._(r),entries:i})}});function z(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new Co({type:`enum`,entries:n,..._(t)})}const wo=m(`ZodLiteral`,(e,t)=>{$n.init(e,t),E.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ki(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function B(e,t){return new wo({type:`literal`,values:Array.isArray(e)?e:[e],..._(t)})}const To=m(`ZodTransform`,(e,t)=>{er.init(e,t),E.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ji(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new ne(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Le(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(Le(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function Eo(e){return new To({type:`transform`,transform:e})}const Do=m(`ZodOptional`,(e,t)=>{nr.init(e,t),E.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ca(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Oo(e){return new Do({type:`optional`,innerType:e})}const ko=m(`ZodExactOptional`,(e,t)=>{rr.init(e,t),E.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ca(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ao(e){return new ko({type:`optional`,innerType:e})}const jo=m(`ZodNullable`,(e,t)=>{ir.init(e,t),E.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ta(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Mo(e){return new jo({type:`nullable`,innerType:e})}const No=m(`ZodDefault`,(e,t)=>{ar.init(e,t),E.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ra(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Po(e,t){return new No({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():ye(t)}})}const Fo=m(`ZodPrefault`,(e,t)=>{sr.init(e,t),E.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ia(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Io(e,t){return new Fo({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():ye(t)}})}const Lo=m(`ZodNonOptional`,(e,t)=>{cr.init(e,t),E.init(e,t),e._zod.processJSONSchema=(t,n,r)=>na(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ro(e,t){return new Lo({type:`nonoptional`,innerType:e,..._(t)})}const zo=m(`ZodCatch`,(e,t)=>{ur.init(e,t),E.init(e,t),e._zod.processJSONSchema=(t,n,r)=>aa(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Bo(e,t){return new zo({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}const Vo=m(`ZodPipe`,(e,t)=>{dr.init(e,t),E.init(e,t),e._zod.processJSONSchema=(t,n,r)=>oa(e,t,n,r),e.in=t.in,e.out=t.out});function Ho(e,t){return new Vo({type:`pipe`,in:e,out:t})}const Uo=m(`ZodCodec`,(e,t)=>{Vo.init(e,t),pr.init(e,t)}),Wo=m(`ZodPreprocess`,(e,t)=>{Vo.init(e,t),gr.init(e,t)}),Go=m(`ZodReadonly`,(e,t)=>{_r.init(e,t),E.init(e,t),e._zod.processJSONSchema=(t,n,r)=>sa(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ko(e){return new Go({type:`readonly`,innerType:e})}const qo=m(`ZodCustom`,(e,t)=>{yr.init(e,t),E.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qi(e,t,n,r)});function Jo(e,t){return Oi(qo,e??(()=>!0),t)}function Yo(e,t={}){return ki(qo,e,t)}function Xo(e,t){return Ai(e,t)}const Zo=(...e)=>Mi({Codec:Uo,Boolean:to,String:ja},...e);function Qo(e,t){return new Wo({type:`pipe`,in:Eo(e),out:t})}function V(e){return $r(Qa,e)}function $o(e){return oi(lo,e)}const es=I({limit:V().int().min(1).max(100).default(20),nextKey:D().optional()}),ts=I({limit:V().int().min(1).max(100).default(20),offset:V().int().nonnegative().default(0)}),ns=[`asc`,`desc`],rs=[`en`,`zh-TW`,`de`,`fr`,`es-ES`,`es-419`,`ja`,`ko`,`it`,`pt-BR`],is=z(rs).default(`en`);function as(e){return e?rs.includes(e):!1}function os(e){return as(e)?e:`en`}function ss(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function cs(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?ss(Object(n),!0).forEach(function(t){ls(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ss(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ls(e,t,n){return t=us(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function us(e){var t=ds(e,`string`);return typeof t==`symbol`?t:String(t)}function ds(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}fs({});function fs(e){return t.withOptions=t=>fs(cs(cs({},e),t)),t;function t(t,...n){let r=typeof t==`string`?[t]:t.raw,{alignValues:i=!1,escapeSpecialCharacters:a=Array.isArray(t),trimWhitespace:o=!0}=e,s=``;for(let e=0;e<r.length;e++){let t=r[e];if(a&&(t=t.replace(/\\\n[ \t]*/g,``).replace(/\\`/g,"`").replace(/\\\$/g,`$`).replace(/\\\{/g,`{`)),s+=t,e<n.length){let t=i?ps(n[e],s):n[e];s+=t}}let c=s.split(`
66
- `),l=null;for(let e of c){let t=e.match(/^(\s+)\S+/);if(t){let e=t[1].length;l=l?Math.min(l,e):e}}if(l!==null){let e=l;s=c.map(t=>t[0]===` `||t[0]===` `?t.slice(e):t).join(`
67
- `)}return o&&(s=s.trim()),a&&(s=s.replace(/\\n/g,`
68
- `).replace(/\\t/g,` `).replace(/\\r/g,`\r`).replace(/\\v/g,`\v`).replace(/\\b/g,`\b`).replace(/\\f/g,`\f`).replace(/\\0/g,`\0`).replace(/\\x([\da-fA-F]{2})/g,(e,t)=>String.fromCharCode(parseInt(t,16))).replace(/\\u\{([\da-fA-F]{1,6})\}/g,(e,t)=>String.fromCodePoint(parseInt(t,16))).replace(/\\u([\da-fA-F]{4})/g,(e,t)=>String.fromCharCode(parseInt(t,16)))),typeof Bun<`u`&&(s=s.replace(/\\u(?:\{([\da-fA-F]{1,6})\}|([\da-fA-F]{4}))/g,(e,t,n)=>{let r=t??n??``;return String.fromCodePoint(parseInt(r,16))})),s}}function ps(e,t){if(typeof e!=`string`||!e.includes(`
69
- `))return e;let n=t.slice(t.lastIndexOf(`
70
- `)+1).match(/^(\s+)/);if(n){let t=n[1];return e.replace(/\n/g,`\n${t}`)}return e}const ms={blue:`#0360f0`,yellow:`#ffce25`,cyan:`#00d2ff`},hs=[{tag:`polygon`,points:`893.15 145.4 764.8 145.4 764.8 171.11 816.12 171.11 816.12 265.19 841.83 265.19 841.83 171.11 893.15 171.11 893.15 145.4`},{tag:`path`,commands:`M935.9,183.97c0-7.1,5.76-12.86,12.86-12.86h86.93v-25.71h-95.26c-16.7,0-30.24,13.54-30.24,30.24v59.31c0,16.7,13.54,30.24,30.24,30.24h95.26v-25.71h-86.93c-7.1,0-12.86-5.76-12.86-12.86v-42.65Z`},{tag:`path`,commands:`M717.67,145.14v89.92l-66.31-85.23h0c-2.36-2.86-5.93-4.68-9.92-4.68-.33,0-13.61,0-13.61,0-7.1,0-12.86,5.76-12.86,12.86v107.19h25.71v-89l66.31,84.32h0c2.36,2.86,5.93,4.68,9.92,4.68q1.25,0,0,0h13.62q-2.5,0,0,0c7.04,0,12.75-5.66,12.85-12.68v-107.37h-25.71Z`},{tag:`path`,commands:`M495.48,145.14c-16.7,0-30.24,13.54-30.24,30.24v59.57c0,16.07,12.53,29.2,28.35,30.18h87.25c7.07,0,12.81-5.76,12.81-12.87v-47.1c0-7.11-5.73-12.87-12.81-12.87h-64.29v25.71h51.39v21.44h-64.15c-7.06,0-12.78-5.69-12.86-12.73v-43.1c.07-7.04,5.8-12.73,12.86-12.73l89.85-.02v-25.71h-98.17`}],gs=[{tag:`path`,commands:`M1378.44,219.45c0,30.39-18.05,46.04-44.94,46.04s-44.94-15.47-44.94-46.04v-47.33h21.92v47.33c0,17.31,9.21,25.6,23.02,25.6s23.02-8.29,23.02-25.6v-47.33h21.92v47.33Z`},{tag:`path`,commands:`M1396.49,230.5v-88.22h21.92v32.23h46.96v19.89h-46.96v36.1c0,12.15,6.26,16.94,15.29,16.94s15.29-4.6,15.29-16.94v-2.39h21.92v2.39c0,25.23-15.1,37.39-37.2,37.39s-37.2-12.16-37.2-37.39Z`},{tag:`path`,commands:`M1485.49,218.16c0-30.39,18.05-46.04,44.94-46.04s44.94,15.47,44.94,46.04v47.33h-21.92v-47.33c0-17.31-9.21-25.6-23.02-25.6s-23.02,8.29-23.02,25.6v47.33h-21.92v-47.33Z`},{tag:`rect`,x:`1485.49`,y:`133.11`,width:`21.92`,height:`132.38`},{tag:`path`,commands:`M1172.56,217.04c0-29.54,22.45-48.9,48.41-48.9s48.61,19.36,48.61,48.9-22.64,49.1-48.61,49.1-48.41-19.56-48.41-49.1ZM1248.03,217.04c0-16.77-12.3-28.71-27.06-28.71s-26.85,11.95-26.85,28.71,12.09,28.92,26.85,28.92,27.06-11.74,27.06-28.92Z`},{tag:`rect`,x:`1248.21`,y:`172.2`,width:`21.92`,height:`93.29`},{tag:`rect`,x:`1077.07`,y:`193.92`,width:`55.68`,height:`21.92`}],_s=[{tag:`polygon`,fill:ms.cyan,points:`232.67 341.7 241.66 346.89 250.66 341.68 361.69 277.59 297.18 240.35 297.17 240.35 250.66 267.2 241.66 272.4 232.67 267.21 186.15 240.35 121.63 277.59 232.67 341.7`},{tag:`polygon`,fill:ms.yellow,points:`177.15 224.77 177.15 160.66 186.14 155.47 232.67 128.6 232.67 54.11 121.63 118.23 112.64 123.42 112.64 262.01 177.15 224.77`},{tag:`polygon`,fill:ms.blue,points:`306.17 160.66 306.17 224.77 370.68 262.01 370.68 123.42 361.69 118.23 250.66 54.12 250.66 128.61 297.18 155.47 306.17 160.66`}];[...hs,...gs,..._s],new TextEncoder,new TextDecoder(`utf-8`,{fatal:!1});const vs=z([`starter`,`pro`,`premium`]);z([`pro`,`premium`]).options,z([`basic_window`,`granted_pool`,`purchased_pool`]);const ys=z([`purchased`,`granted`]);z([`task`,`title_generate`,`agent`,`schedule`,`sandbox_llm`,`sandbox_runtime`,`web_search`,`image_generation`,`agent_icon_generation`,`auto_routing`,`chatbot`,`meeting`,`mcp_tool_api_call`]);const H={TASK_MESSAGE:`task_message`,TITLE_GENERATION:`title_generation`,SENSITIVITY_CHECK:`sensitivity_check`,TOOL_CALL_EXTRA_TOKENS:`tool_call_extra_tokens`,TASK_SUMMARY:`task_summary`,SUBAGENT:`subagent`,WORKFLOW_AGENT:`workflow_agent`,LLM_PROXY:`llm_proxy`,IMAGE_GENERATION:`image_generation`,WEB_SEARCH:`web_search`,SANDBOX_RUNTIME:`sandbox_runtime`,MEETING:`meeting`,MEETING_RECORDING_TRANSCRIPTION:`meeting_recording_transcription`,MEETING_RECORDING_SUMMARY:`meeting_recording_summary`,MEETING_RECORDING_REFINE:`meeting_recording_refine`,MEETING_RECORDING_TITLE:`meeting_recording_title`,SCHEDULE_JUDGE:`schedule_judge`,SCHEDULE_JUDGE_REVIEW:`schedule_judge_review`,SCHEDULE_JUDGE_EXTRACT:`schedule_judge_extract`,PROJECT_KNOWLEDGE_DESCRIPTION:`project_knowledge_description`,PROJECT_KNOWLEDGE_EXTRACTION:`project_knowledge_extraction`};H.MEETING,H.MEETING_RECORDING_TRANSCRIPTION,H.MEETING_RECORDING_SUMMARY,H.MEETING_RECORDING_REFINE,H.MEETING_RECORDING_TITLE,H.WORKFLOW_AGENT,H.SCHEDULE_JUDGE_EXTRACT,H.WEB_SEARCH,H.PROJECT_KNOWLEDGE_DESCRIPTION,H.PROJECT_KNOWLEDGE_EXTRACTION,H.SENSITIVITY_CHECK;const bs={WEB_SEARCH:H.WEB_SEARCH,SANDBOX_RUNTIME:H.SANDBOX_RUNTIME};z([bs.WEB_SEARCH,bs.SANDBOX_RUNTIME]);const xs={SEARCH:`search`,SCRAPE:`scrape`};z([xs.SEARCH,xs.SCRAPE]),I({workspaceId:A()});const Ss=I({usedPercent:M().min(0).max(100),resetAt:w().nullable()});I({seatType:vs,hourly:Ss.nullable(),weekly:Ss,trial:I({endsAt:w(),remainingDays:M().int().positive()}).optional(),extraUsage:I({spentUsd:M().nonnegative(),resetAt:w().nullable()}),availability:I({allowed:N(),reason:z([`usage_exhausted`,`budget_exceeded`]).nullable(),resetAt:w().nullable()})});const Cs=I({startAt:w(),endAt:w(),previousStartAt:w().optional()}),ws=I({period:Cs,balanceUsd:M().nonnegative(),nextExpiry:I({amountUsd:M().positive(),expiresAt:w()}).optional(),currentSpentUsd:M().nonnegative(),currentSpentUsedPercent:M().nonnegative().nullable(),monthlyExtraUsageLimitUsd:M().positive().nullable(),memberMonthlyExtraUsageLimitUsd:M().positive().nullable()});I({periodStart:w().optional()}),I({period:Cs,spentUsd:M().nonnegative(),purchasedUsd:M().nonnegative()});const Ts=z([`extraUsage:desc`,`extraUsage:asc`]);I({periodStart:w().optional(),limit:V().int().min(1).max(100).default(20),offset:V().int().nonnegative().default(0),sort:Ts.default(`extraUsage:desc`)}),I({items:F(I({id:A(),user:I({id:A(),name:D(),email:k()}),seatType:vs,extraUsage:M().nonnegative(),monthlyLimitOverride:I({limitUsd:M().positive().nullable()}).nullable().optional()})),total:M().int().nonnegative()}),I({id:A(),poolType:ys,balanceUsd:M().nonnegative(),initialAmountUsd:M().positive(),expiresAt:w().nullable(),isAutoReload:N().nullable(),purchaseId:A().nullable(),createdBy:A(),createdAt:w(),updatedAt:w()}),I({amountUsd:M().positive().max(1e5),expiresAt:w().optional()}),I({id:A(),workspaceId:A(),amountUsd:D(),expiresAt:w().nullable(),createdAt:w()}),I({enabled:N(),thresholdUsd:M().positive(),reloadAmountUsd:M().positive()}).nullable(),I({enabled:N(),thresholdUsd:M().positive(),reloadAmountUsd:M().positive()}),I({checkoutUrl:D().url().nullable()}),I({limitUsd:M().positive().nullable()}),I({limitUsd:M().positive().nullable()});const Es=I({id:A(),name:D(),email:k()});I({items:F(I({user:Es,limitUsd:M().positive().nullable()}))}),I({workspaceId:A(),userId:A()}),I({limitUsd:M().min(.01).max(999999.99).nullable()});const Ds=D().regex(/^\d+(\.\d+)?$/,`Budget must be a valid positive decimal number`).refine(e=>Number(e)>0,{message:`Budget must be a valid positive decimal number`});I({items:F(I({user:Es,budget:D().nullable()}))}),I({workspaceId:A(),userId:A()}),I({budget:Ds.nullable()}),I({periodStart:w().optional()});const Os=I({model:D(),costUsd:M(),tokens:M()}),ks=I({costUsd:M(),totalTokens:M(),tokens:I({input:M(),output:M(),cachedInput:M(),cacheCreation:M()}),byModel:F(Os)});I({taskId:A(),totalCostUsd:M(),totalTokens:M(),tokens:ks.shape.tokens,byModel:ks.shape.byModel}),I({taskId:A(),scheduleId:A(),scheduleRunId:A(),work:ks,extraction:ks,judgePrimary:ks,judgeReview:ks,runTotal:ks,includingExtraction:ks});const As=[`google`,`password`];I({users:F(I({id:A(),name:D(),email:k(),image:D().nullable().optional(),role:D(),loginMethods:F(z(As)),createdAt:w(),seatType:vs.nullable(),pendingSeatType:vs.nullable(),pendingEffectiveAt:w().nullable()})),total:M().int().nonnegative()}),ts.extend({search:D().trim().max(200).optional()});const js=D().min(10,`Password must be at least 10 characters long`).regex(/[a-z]/,`Password must contain at least one lowercase letter`).regex(/[A-Z]/,`Password must contain at least one uppercase letter`).regex(/[0-9]/,`Password must contain at least one number`).regex(/[^a-zA-Z0-9]/,`Password must contain at least one special character`);I({currentPassword:D().min(1,`Current password is required`),newPassword:js}),I({message:D()});const Ms=z(rs);I({email:k(),name:D(),image:D().nullable().optional(),locale:Ms,hasPassword:N()}),I({locale:Ms});const Ns=[`super_admin`,`operator`];z([`vertex/gemini-3.7-flash`,`vertex/gemini-3.5-flash`]),I({provider:B(`gemini`),model:D().min(1),estimatedHourlyCostUsd:M().nonnegative()}),I({model:D().min(1)});const Ps=I({id:A(),email:D()});I({admins:F(I({id:A(),email:D(),role:z(Ns),createdBy:Ps.nullable(),createdAt:w(),updatedAt:w()}))}),I({id:A(),role:z(Ns)}),I({email:k(),role:z(Ns)}),I({adminId:A()});const Fs=z([`owner`,`admin`,`member`]);I({email:k(),name:D().trim().min(1).max(100).optional(),password:js,workspaceId:A().optional(),role:Fs.default(`member`)});const Is=I({id:A(),email:k(),name:D(),createdAt:w()}),Ls=I({resetPasswordUrl:j(),resetPasswordExpiresAt:w()});Is.extend(Ls.shape),I({email:k(),role:Fs.default(`member`)}),I({id:A(),email:k(),name:D(),role:D()}),I({workspaceId:A(),userId:A()}),I({role:z(Ns)});const Rs=[`create`,`update`,`delete`],zs=[`workspace`,`admin`,`user`,`extra_usage`,`marketplace_agent`,`marketplace_skill`,`azure_openai_deployment`,`connector`,`model_tier`],Bs=[`success`,`failure`],Vs=I({adminId:A(),email:D().nullable(),isRemoved:N()}),Hs=I({ipAddress:D().optional(),details:xo(D(),P()).optional(),errorMessage:D().optional()}),Us=I({id:A(),actor:Vs,action:z(Rs),resourceType:z(zs),resourceId:D().nullable(),resourceLabel:D().nullable(),status:z(Bs),metadata:Hs,createdAt:w()});ts.extend({actorAdminId:A().optional(),action:z(Rs).optional(),resourceType:z(zs).optional(),status:z(Bs).optional(),workspaceSearch:D().trim().max(200).optional(),from:w().optional(),to:w().optional()}),I({items:F(Us),total:M().int().nonnegative()});const Ws={"user:read":`Read your profile information`,"user:write":`Update your profile and preferences`,"user:email":`Read your email address`,"workspaces:read":`List and read your workspaces`,"workspaces:write":`Create and modify workspaces`,"tasks:read":`Read your task history and messages`,"tasks:write":`Create and send messages`,"tasks:delete":`Delete your tasks`,"projects:read":`List and read your projects`,"projects:write":`Create and modify projects`,"agents:read":`List and read agents`,"agents:write":`Create and modify agents`,"agents:execute":`Execute agents via the external API`,"connectors:read":`List available connectors`,"connectors:write":`Configure connector settings`,"tools:read":`List available tools`,"tools:execute":`Execute tools`,"skills:read":`List and read skills`,"skills:write":`Create and modify skills`,"meetings:read":`Read meetings and recordings`,"meetings:write":`Create and modify meetings and recordings`,"notifications:read":`Read your notifications`,"notifications:write":`Manage notification state and device registrations`,"publishes:read":`List and read publish requests`,"publishes:write":`Submit, approve, reject, and revoke publishes`,"calendar:read":`Read your calendar accounts and events`,"calendar:write":`Manage calendar accounts and sync settings`,"schedules:read":`Read your schedules`,"schedules:write":`Create and modify schedules`,"subscriptions:read":`Read your personal subscription connections`,"subscriptions:write":`Connect and disconnect personal subscriptions`,"workflows:read":`Read your workflows and their runs`,"workflows:write":`Create, modify, and run workflows`,"chatbot:read":`List and read chatbot installations and configurations`,"chatbot:write":`Manage chatbot installations and configurations`,"llm:chat":`Call LLM models via the proxy endpoint`,offline_access:`Access your data when you are not present`},Gs=[`offline_access`,`user:email`],Ks=Object.keys(Ws).filter(e=>!Gs.includes(e));if(Ks.length===0)throw Error(`PAT_AVAILABLE_SCOPES must not be empty`);const qs=z(Ks),Js=I({id:A(),name:D(),tokenPrefix:D(),scopes:F(D()).nullable(),resources:I({agents:F(D()).optional(),skills:F(D()).optional(),connectors:F(D()).optional()}).nullable(),expiresAt:w().nullable(),lastUsedAt:w().nullable(),createdAt:w()});I({name:D().trim().min(1).max(200),expiresInDays:M().int().min(1).max(3650).nullable(),scopes:F(qs).min(1).transform(e=>[...new Set(e)]).nullable().default(null)}).refine(e=>!e.scopes?.includes(`agents:execute`),{message:`issue execute keys via POST /agents/:agentId/apiKeys`,path:[`scopes`]});const Ys=I({token:D(),data:Js});I({tokens:F(Js)});var Xs=e(t(((e,t)=>{(function(e){let n=`(0?\\d+|0x[a-f0-9]+)`,r={fourOctet:RegExp(`^${n}\\.${n}\\.${n}\\.${n}$`,`i`),threeOctet:RegExp(`^${n}\\.${n}\\.${n}$`,`i`),twoOctet:RegExp(`^${n}\\.${n}$`,`i`),longValue:RegExp(`^${n}$`,`i`)},i=RegExp(`^0[0-7]+$`,`i`),a=RegExp(`^0x[a-f0-9]+$`,`i`),o=`%[0-9a-z]{1,}`,s=`(?:[0-9a-f]+::?)+`,c={zoneIndex:RegExp(o,`i`),native:RegExp(`^(::)?(${s})?([0-9a-f]+)?(::)?(${o})?$`,`i`),deprecatedTransitional:RegExp(`^(?:::)(${n}\\.${n}\\.${n}\\.${n}(${o})?)$`,`i`),transitional:RegExp(`^((?:${s})|(?:::)(?:${s})?)${n}\\.${n}\\.${n}\\.${n}(${o})?$`,`i`)};function l(e,t){if(e.indexOf(`::`)!==e.lastIndexOf(`::`))return null;let n=0,r=-1,i=(e.match(c.zoneIndex)||[])[0],a,o;for(i&&(i=i.substring(1),e=e.replace(/%.+$/,``));(r=e.indexOf(`:`,r+1))>=0;)n++;if(e.substr(0,2)===`::`&&n--,e.substr(-2,2)===`::`&&n--,n>t)return null;for(o=t-n,a=`:`;o--;)a+=`0:`;return e=e.replace(`::`,a),e[0]===`:`&&(e=e.slice(1)),e[e.length-1]===`:`&&(e=e.slice(0,-1)),t=(function(){let t=e.split(`:`),n=[];for(let e=0;e<t.length;e++)n.push(parseInt(t[e],16));return n})(),{parts:t,zoneId:i}}function u(e,t,n,r){if(e.length!==t.length)throw Error(`ipaddr: cannot match CIDR for objects with different lengths`);let i=0,a;for(;r>0;){if(a=n-r,a<0&&(a=0),e[i]>>a!==t[i]>>a)return!1;r-=n,i+=1}return!0}function d(e){if(a.test(e))return parseInt(e,16);if(e[0]===`0`&&!isNaN(parseInt(e[1],10))){if(i.test(e))return parseInt(e,8);throw Error(`ipaddr: cannot parse ${e} as octal`)}return parseInt(e,10)}function f(e,t){for(;e.length<t;)e=`0${e}`;return e}let p={};p.IPv4=(function(){function e(e){if(e.length!==4)throw Error(`ipaddr: ipv4 octet count should be 4`);let t,n;for(t=0;t<e.length;t++)if(n=e[t],!(0<=n&&n<=255))throw Error(`ipaddr: ipv4 octet should fit in 8 bits`);this.octets=e}return e.prototype.SpecialRanges={unspecified:[[new e([0,0,0,0]),8]],broadcast:[[new e([255,255,255,255]),32]],multicast:[[new e([224,0,0,0]),4]],linkLocal:[[new e([169,254,0,0]),16]],loopback:[[new e([127,0,0,0]),8]],carrierGradeNat:[[new e([100,64,0,0]),10]],private:[[new e([10,0,0,0]),8],[new e([172,16,0,0]),12],[new e([192,168,0,0]),16]],reserved:[[new e([192,0,0,0]),24],[new e([192,0,2,0]),24],[new e([192,88,99,0]),24],[new e([198,18,0,0]),15],[new e([198,51,100,0]),24],[new e([203,0,113,0]),24],[new e([240,0,0,0]),4]],as112:[[new e([192,175,48,0]),24],[new e([192,31,196,0]),24]],amt:[[new e([192,52,193,0]),24]]},e.prototype.kind=function(){return`ipv4`},e.prototype.match=function(e,t){let n;if(t===void 0&&(n=e,e=n[0],t=n[1]),e.kind()!==`ipv4`)throw Error(`ipaddr: cannot match ipv4 address with non-ipv4 one`);return u(this.octets,e.octets,8,t)},e.prototype.prefixLengthFromSubnetMask=function(){let e=0,t=!1,n={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0},r,i,a;for(r=3;r>=0;--r)if(i=this.octets[r],i in n){if(a=n[i],t&&a!==0)return null;a!==8&&(t=!0),e+=a}else return null;return 32-e},e.prototype.range=function(){return p.subnetMatch(this,this.SpecialRanges)},e.prototype.toByteArray=function(){return this.octets.slice(0)},e.prototype.toIPv4MappedAddress=function(){return p.IPv6.parse(`::ffff:${this.toString()}`)},e.prototype.toNormalizedString=function(){return this.toString()},e.prototype.toString=function(){return this.octets.join(`.`)},e})(),p.IPv4.broadcastAddressFromCIDR=function(e){try{let t=this.parseCIDR(e),n=t[0].toByteArray(),r=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],a=0;for(;a<4;)i.push(parseInt(n[a],10)|parseInt(r[a],10)^255),a++;return new this(i)}catch{throw Error(`ipaddr: the address does not have IPv4 CIDR format`)}},p.IPv4.isIPv4=function(e){return this.parser(e)!==null},p.IPv4.isValid=function(e){try{return new this(this.parser(e)),!0}catch{return!1}},p.IPv4.isValidCIDR=function(e){try{return this.parseCIDR(e),!0}catch{return!1}},p.IPv4.isValidFourPartDecimal=function(e){return!!(p.IPv4.isValid(e)&&e.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},p.IPv4.isValidCIDRFourPartDecimal=function(e){let t=e.match(/^(.+)\/(\d+)$/);return!p.IPv4.isValidCIDR(e)||!t?!1:p.IPv4.isValidFourPartDecimal(t[1])},p.IPv4.networkAddressFromCIDR=function(e){let t,n,r,i,a;try{for(t=this.parseCIDR(e),r=t[0].toByteArray(),a=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],n=0;n<4;)i.push(parseInt(r[n],10)&parseInt(a[n],10)),n++;return new this(i)}catch{throw Error(`ipaddr: the address does not have IPv4 CIDR format`)}},p.IPv4.parse=function(e){let t=this.parser(e);if(t===null)throw Error(`ipaddr: string is not formatted like an IPv4 Address`);return new this(t)},p.IPv4.parseCIDR=function(e){let t;if(t=e.match(/^(.+)\/(\d+)$/)){let e=parseInt(t[2]);if(e>=0&&e<=32){let n=[this.parse(t[1]),e];return Object.defineProperty(n,"toString",{value:function(){return this.join(`/`)}}),n}}throw Error(`ipaddr: string is not formatted like an IPv4 CIDR range`)},p.IPv4.parser=function(e){let t,n,i;if(t=e.match(r.fourOctet))return(function(){let e=t.slice(1,6),r=[];for(let t=0;t<e.length;t++)n=e[t],r.push(d(n));return r})();if(t=e.match(r.longValue)){if(i=d(t[1]),i>4294967295||i<0)throw Error(`ipaddr: address outside defined range`);return(function(){let e=[],t;for(t=0;t<=24;t+=8)e.push(i>>t&255);return e})().reverse()}else if(t=e.match(r.twoOctet))return(function(){let e=t.slice(1,4),n=[];if(i=d(e[1]),i>16777215||i<0)throw Error(`ipaddr: address outside defined range`);return n.push(d(e[0])),n.push(i>>16&255),n.push(i>>8&255),n.push(i&255),n})();else if(t=e.match(r.threeOctet))return(function(){let e=t.slice(1,5),n=[];if(i=d(e[2]),i>65535||i<0)throw Error(`ipaddr: address outside defined range`);return n.push(d(e[0])),n.push(d(e[1])),n.push(i>>8&255),n.push(i&255),n})();else return null},p.IPv4.subnetMaskFromPrefixLength=function(e){if(e=parseInt(e),e<0||e>32)throw Error(`ipaddr: invalid IPv4 prefix length`);let t=[0,0,0,0],n=0,r=Math.floor(e/8);for(;n<r;)t[n]=255,n++;return r<4&&(t[r]=2**(e%8)-1<<8-e%8),new this(t)},p.IPv6=(function(){function e(e,t){let n,r;if(e.length===16)for(this.parts=[],n=0;n<=14;n+=2)this.parts.push(e[n]<<8|e[n+1]);else if(e.length===8)this.parts=e;else throw Error(`ipaddr: ipv6 part count should be 8 or 16`);for(n=0;n<this.parts.length;n++)if(r=this.parts[n],!(0<=r&&r<=65535))throw Error(`ipaddr: ipv6 part should fit in 16 bits`);t&&(this.zoneId=t)}return e.prototype.SpecialRanges={unspecified:[new e([0,0,0,0,0,0,0,0]),128],linkLocal:[new e([65152,0,0,0,0,0,0,0]),10],multicast:[new e([65280,0,0,0,0,0,0,0]),8],loopback:[new e([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new e([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new e([0,0,0,0,0,65535,0,0]),96],discard:[new e([256,0,0,0,0,0,0,0]),64],rfc6145:[new e([0,0,0,0,65535,0,0,0]),96],rfc6052:[new e([100,65435,0,0,0,0,0,0]),96],"6to4":[new e([8194,0,0,0,0,0,0,0]),16],teredo:[new e([8193,0,0,0,0,0,0,0]),32],benchmarking:[new e([8193,2,0,0,0,0,0,0]),48],amt:[new e([8193,3,0,0,0,0,0,0]),32],as112v6:[[new e([8193,4,274,0,0,0,0,0]),48],[new e([9760,79,32768,0,0,0,0,0]),48]],deprecated:[new e([8193,16,0,0,0,0,0,0]),28],orchid2:[new e([8193,32,0,0,0,0,0,0]),28],droneRemoteIdProtocolEntityTags:[new e([8193,48,0,0,0,0,0,0]),28],reserved:[[new e([8193,0,0,0,0,0,0,0]),23],[new e([8193,3512,0,0,0,0,0,0]),32]]},e.prototype.isIPv4MappedAddress=function(){return this.range()===`ipv4Mapped`},e.prototype.kind=function(){return`ipv6`},e.prototype.match=function(e,t){let n;if(t===void 0&&(n=e,e=n[0],t=n[1]),e.kind()!==`ipv6`)throw Error(`ipaddr: cannot match ipv6 address with non-ipv6 one`);return u(this.parts,e.parts,16,t)},e.prototype.prefixLengthFromSubnetMask=function(){let e=0,t=!1,n={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0},r,i;for(let a=7;a>=0;--a)if(r=this.parts[a],r in n){if(i=n[r],t&&i!==0)return null;i!==16&&(t=!0),e+=i}else return null;return 128-e},e.prototype.range=function(){return p.subnetMatch(this,this.SpecialRanges)},e.prototype.toByteArray=function(){let e,t=[],n=this.parts;for(let r=0;r<n.length;r++)e=n[r],t.push(e>>8),t.push(e&255);return t},e.prototype.toFixedLengthString=function(){let e=(function(){let e=[];for(let t=0;t<this.parts.length;t++)e.push(f(this.parts[t].toString(16),4));return e}).call(this).join(`:`),t=``;return this.zoneId&&(t=`%${this.zoneId}`),e+t},e.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw Error(`ipaddr: trying to convert a generic ipv6 address to ipv4`);let e=this.parts.slice(-2),t=e[0],n=e[1];return new p.IPv4([t>>8,t&255,n>>8,n&255])},e.prototype.toNormalizedString=function(){let e=(function(){let e=[];for(let t=0;t<this.parts.length;t++)e.push(this.parts[t].toString(16));return e}).call(this).join(`:`),t=``;return this.zoneId&&(t=`%${this.zoneId}`),e+t},e.prototype.toRFC5952String=function(){let e=/((^|:)(0(:|$)){2,})/g,t=this.toNormalizedString(),n=0,r=-1,i;for(;i=e.exec(t);)i[0].length>r&&(n=i.index,r=i[0].length);return r<0?t:`${t.substring(0,n)}::${t.substring(n+r)}`},e.prototype.toString=function(){return this.toRFC5952String()},e})(),p.IPv6.broadcastAddressFromCIDR=function(e){try{let t=this.parseCIDR(e),n=t[0].toByteArray(),r=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],a=0;for(;a<16;)i.push(parseInt(n[a],10)|parseInt(r[a],10)^255),a++;return new this(i)}catch(e){throw Error(`ipaddr: the address does not have IPv6 CIDR format (${e})`)}},p.IPv6.isIPv6=function(e){return this.parser(e)!==null},p.IPv6.isValid=function(e){if(typeof e==`string`&&e.indexOf(`:`)===-1)return!1;try{let t=this.parser(e);return new this(t.parts,t.zoneId),!0}catch{return!1}},p.IPv6.isValidCIDR=function(e){if(typeof e==`string`&&e.indexOf(`:`)===-1)return!1;try{return this.parseCIDR(e),!0}catch{return!1}},p.IPv6.networkAddressFromCIDR=function(e){let t,n,r,i,a;try{for(t=this.parseCIDR(e),r=t[0].toByteArray(),a=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],n=0;n<16;)i.push(parseInt(r[n],10)&parseInt(a[n],10)),n++;return new this(i)}catch(e){throw Error(`ipaddr: the address does not have IPv6 CIDR format (${e})`)}},p.IPv6.parse=function(e){let t=this.parser(e);if(t.parts===null)throw Error(`ipaddr: string is not formatted like an IPv6 Address`);return new this(t.parts,t.zoneId)},p.IPv6.parseCIDR=function(e){let t,n,r;if((n=e.match(/^(.+)\/(\d+)$/))&&(t=parseInt(n[2]),t>=0&&t<=128))return r=[this.parse(n[1]),t],Object.defineProperty(r,"toString",{value:function(){return this.join(`/`)}}),r;throw Error(`ipaddr: string is not formatted like an IPv6 CIDR range`)},p.IPv6.parser=function(e){let t,n,r,i,a,o;if(r=e.match(c.deprecatedTransitional))return this.parser(`::ffff:${r[1]}`);if(c.native.test(e))return l(e,8);if((r=e.match(c.transitional))&&(o=r[6]||``,t=r[1],r[1].endsWith(`::`)||(t=t.slice(0,-1)),t=l(t+o,6),t.parts)){for(a=[parseInt(r[2]),parseInt(r[3]),parseInt(r[4]),parseInt(r[5])],n=0;n<a.length;n++)if(i=a[n],!(0<=i&&i<=255))return null;return t.parts.push(a[0]<<8|a[1]),t.parts.push(a[2]<<8|a[3]),{parts:t.parts,zoneId:t.zoneId}}return null},p.IPv6.subnetMaskFromPrefixLength=function(e){if(e=parseInt(e),e<0||e>128)throw Error(`ipaddr: invalid IPv6 prefix length`);let t=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],n=0,r=Math.floor(e/8);for(;n<r;)t[n]=255,n++;return r<16&&(t[r]=2**(e%8)-1<<8-e%8),new this(t)},p.fromByteArray=function(e){let t=e.length;if(t===4)return new p.IPv4(e);if(t===16)return new p.IPv6(e);throw Error(`ipaddr: the binary input is neither an IPv6 nor IPv4 address`)},p.isValid=function(e){return p.IPv6.isValid(e)||p.IPv4.isValid(e)},p.isValidCIDR=function(e){return p.IPv6.isValidCIDR(e)||p.IPv4.isValidCIDR(e)},p.parse=function(e){if(p.IPv6.isValid(e))return p.IPv6.parse(e);if(p.IPv4.isValid(e))return p.IPv4.parse(e);throw Error(`ipaddr: the address has neither IPv6 nor IPv4 format`)},p.parseCIDR=function(e){try{return p.IPv6.parseCIDR(e)}catch{try{return p.IPv4.parseCIDR(e)}catch{throw Error(`ipaddr: the address has neither IPv6 nor IPv4 CIDR format`)}}},p.process=function(e){let t=this.parse(e);return t.kind()===`ipv6`&&t.isIPv4MappedAddress()?t.toIPv4Address():t},p.subnetMatch=function(e,t,n){let r,i,a,o;for(i in n??=`unicast`,t)if(Object.prototype.hasOwnProperty.call(t,i)){for(a=t[i],a[0]&&!(a[0]instanceof Array)&&(a=[a]),r=0;r<a.length;r++)if(o=a[r],e.kind()===o[0].kind()&&e.match.apply(e,o))return i}return n},t!==void 0&&t.exports?t.exports=p:e.ipaddr=p})(e)}))(),1);function Zs(e){return Xs.default.isValid(e)&&Xs.default.parse(e).range()===`unicast`}function Qs(e){try{let{hostname:t}=new URL(e),n=t.toLowerCase().replace(/\.$/u,``);if(n===`localhost`||n.endsWith(`.localhost`))return!1;let r=n.startsWith(`[`)&&n.endsWith(`]`)?n.slice(1,-1):n;return!Xs.default.isValid(r)||Zs(r)}catch{return!1}}const $s=j().min(1).max(4096).refine(e=>{try{return[`http:`,`https:`].includes(new URL(e).protocol)}catch{return!1}},{message:`Only HTTP/HTTPS protocols are allowed`}).refine(Qs,{message:`Access to private network addresses is not allowed`}),ec=z([`queued`,`running`,`completed`,`failed`]),tc=I({tool:D(),connectorId:D().optional(),summary:D(),status:D()});I({executionId:A(),status:ec,output:I({text:D(),structured:P().optional()}).optional(),actions:F(tc).optional(),cost:M().optional()}),I({executionId:A(),status:B(`running`)}),I({input:D().min(1).max(1e5),webhookUrl:$s.optional(),metadata:xo(D().max(100),D().max(1e3)).refine(e=>Object.keys(e).length<=20,{message:`metadata supports at most 20 keys`}).optional()}),I({requestsPerMinute:M().int().min(1).max(1e4).nullable()}),I({requestsPerMinute:M().int().nullable()}),I({items:F(Js.pick({id:!0,name:!0,createdAt:!0,lastUsedAt:!0}))}),I({name:D().trim().min(1).max(200),expiresInDays:M().int().min(1).max(3650).nullable()}),Ys.extend({webhookSecret:D()});const U={AGENT:`agent`,ASSET:`asset`,AUDIT_LOG:`audit_log`,CHART:`chart`,IMAGE_GENERATION:`image_generation`,MEETING:`meeting`,MEMORY:`memory`,PROJECT:`project`,SANDBOX:`sandbox`,SCHEDULE:`schedule`,SKILL:`skill`,SKILL_MANAGEMENT:`skill_management`,SLIDES:`slides`,SUBAGENT:`subagent`,TASK:`task`,WEB_SEARCH:`web_search`,WORKFLOW:`workflow`};Object.values(U);const nc=[U.WEB_SEARCH,U.IMAGE_GENERATION],W={SANDBOX:`sandbox`,MULTITASKING:`multitasking`,HISTORY:`history`,CREATION:`creation`,PROJECT:`project`,WEB_SEARCH:`web_search`,SCHEDULE:`schedule`,AGENTS_AND_SKILLS:`agents_and_skills`,AUDIT_LOG:`audit_log`},rc=Object.values(W);W.SANDBOX,U.SANDBOX,U.SKILL,W.MULTITASKING,U.SUBAGENT,U.WORKFLOW,W.HISTORY,U.TASK,U.MEETING,U.MEMORY,W.CREATION,U.ASSET,U.SLIDES,U.IMAGE_GENERATION,W.PROJECT,U.PROJECT,U.ASSET,W.WEB_SEARCH,U.WEB_SEARCH,W.SCHEDULE,U.SCHEDULE,W.AGENTS_AND_SKILLS,U.AGENT,U.SKILL_MANAGEMENT,W.AUDIT_LOG,U.AUDIT_LOG;const ic=So(z(rc),N());function ac(e,t){return e===void 0?!0:e[t]??t!==W.AUDIT_LOG}function oc(e){return Object.fromEntries(rc.map(t=>[t,e.includes(t)]))}function sc(e){return rc.filter(t=>ac(e,t))}const cc=Object.freeze(oc([W.SANDBOX,W.AGENTS_AND_SKILLS]));U.CHART;const lc=[`updatedAt`,`name`],uc={BUILT_IN:`built_in`,CUSTOM_SOURCE_CODE:`custom_source_code`,CUSTOM_REMOTE_URL:`custom_remote_url`},dc=[uc.BUILT_IN,uc.CUSTOM_SOURCE_CODE,uc.CUSTOM_REMOTE_URL],fc={PENDING:`pending`,APPROVED:`approved`,REJECTED:`rejected`,PENDING_UPDATE:`pending_update`};fc.APPROVED,fc.PENDING_UPDATE,fc.PENDING,fc.PENDING_UPDATE;const pc={CONNECTOR:`connector`,AGENT:`agent`,SKILL:`skill`,MEETING:`meeting`};({...pc});const mc={OWNER:`owner`,MANAGER:`manager`,MEMBER:`member`},hc={VISIBLE:`visible`,HIDDEN:`hidden`},gc={OWNER:`owner`,EDITOR:`editor`,VIEWER:`viewer`},_c=z([gc.OWNER,gc.EDITOR,gc.VIEWER]);gc.OWNER,gc.EDITOR,gc.VIEWER;const vc={USER:`user`,TEAM:`team`},yc=z([vc.USER,vc.TEAM]),G=_c.nullable(),bc=z([pc.CONNECTOR,pc.AGENT,pc.SKILL]),xc=[fc.PENDING,fc.APPROVED,fc.REJECTED,fc.PENDING_UPDATE],Sc=I({id:A(),name:D()}),Cc=I({id:A(),type:bc,name:D(),description:D().optional(),connectorType:z(dc).optional(),iconUrl:D().optional(),provider:D().optional()});I({rejectReason:D().trim().max(500).optional()}),I({search:D().trim().max(200).optional(),status:L([z(xc),F(z(xc)).min(1)]).optional(),resourceType:bc.optional(),limit:V().int().min(1).max(100).default(20),nextKey:D().optional()});const wc=I({id:A(),name:D(),versionNumber:M().int().nullable(),publishId:A(),status:z(xc),rejectReason:D().nullable()}),Tc=I({workspace:I({published:N(),versionNumber:M().int().nullable(),publishId:A().nullable(),status:z(xc).nullable(),rejectReason:D().nullable()}),teams:F(wc)}),Ec=I({type:D(),provider:D().optional(),scopes:F(D()).optional(),tutorial:D().optional()}),Dc=I({type:B(`connector`),id:A(),name:D(),description:D(),iconUrl:D().optional(),toolPrefix:D(),url:D(),transport:D(),authorization:Ec.optional()}),Oc=I({id:A(),name:D(),hasPermission:N()}),kc=I({id:D(),name:D(),available:N()}),Ac=I({type:B(`agent`),id:A(),name:D(),description:D(),iconUrl:D().optional(),systemPrompt:D(),conversationStarters:F(D()),model:kc,connectors:F(Oc),capabilities:ic}),jc=I({id:A(),description:D(),createdBy:I({id:A(),name:D()}),createdAt:w()});R(`type`,[Dc,Ac,I({type:B(`skill`),id:A(),name:D(),description:D(),currentVersion:jc,downloadUrl:D()})]);const Mc=[`private`,`review`,`live`,`rejected`],Nc=I({private:M().int().nonnegative(),review:M().int().nonnegative(),live:M().int().nonnegative(),rejected:M().int().nonnegative()}),Pc=z([`pending`,`ready`,`failed`]),Fc=I({id:A(),projectId:A(),fileId:A(),name:D(),mimeType:D(),size:M().int().nonnegative(),url:D().nullable(),description:D().nullable(),addedBy:A(),createdAt:w(),updatedAt:w()}),Ic=I({id:A(),projectId:A(),url:D(),title:D().nullable(),status:Pc,description:D().nullable(),fetchError:D().nullable(),lastFetchedAt:w().nullable(),addedBy:A(),createdAt:w(),updatedAt:w()});I({fileId:A()}),I({url:$s}),I({description:D().max(2e3)}),I({files:F(Fc)}),I({links:F(Ic)});const Lc=1e4,Rc=z([`owner`,`member`]),zc=I({id:A(),workspaceId:A(),name:D(),description:D().nullable(),instruction:D().nullable(),createdAt:w(),updatedAt:w()}),Bc=I({userId:A(),role:Rc,name:D(),email:k(),image:D().nullable().optional()}),Vc=D().max(Lc,`Instruction is too long: the maximum is ${Lc} characters.`);I({name:D().trim().min(1).max(255),description:D().max(2e3).nullable().optional(),instruction:Vc.nullable().optional()}).partial();const Hc=zc.extend({role:Rc,isShared:N()}),Uc=z([`all`,`mine`,`shared`]);I({limit:V().int().min(1).max(100).default(50),nextKey:D().optional(),filter:Uc.default(`all`)}),I({projects:F(Hc),nextKey:D().optional()});const Wc=I({userId:A(),name:D()});zc.extend({role:Rc,creator:Wc.nullable(),isShared:N(),members:F(Bc),taskCount:M().int().nonnegative(),sourceCount:M().int().nonnegative(),assetCount:M().int().nonnegative(),assetVersionCount:M().int().nonnegative()}),I({userId:A()}),I({role:Rc}),I({projectId:A().nullable(),confirmAssetSharing:N().optional()}),I({taskId:A(),projectId:A().nullable()});const Gc=I({id:A(),name:D()}),Kc=`always_allow`,qc={ALWAYS_ASK:`always_ask`,AUTO:`auto`,ALWAYS_ALLOW:`always_allow`},Jc=z(qc);Jc.exclude([`ALWAYS_ASK`]);const Yc={BY_USER:`The user denied this tool call, so it did not run.`,UNATTENDED:`This tool call needs human approval and this run has no one to ask, so it did not run.`,INSTRUCTION:`Do not call it again unless you are explicitly asked to; continue the task without it.`},Xc={ASK:`ask`,DENY:`deny`,BYPASS:`bypass`},Zc=z(Xc);qc.ALWAYS_ALLOW,qc.AUTO,qc.ALWAYS_ASK,Xc.BYPASS,Xc.ASK,Xc.DENY,z([`allow_all`,`auto_ask`,`auto_deny`]);const Qc=[{id:`allow_all`,toolApprovalMode:qc.ALWAYS_ALLOW,approvalHandling:Xc.BYPASS},{id:`auto_ask`,toolApprovalMode:qc.AUTO,approvalHandling:Xc.ASK},{id:`auto_deny`,toolApprovalMode:qc.AUTO,approvalHandling:Xc.DENY}];function $c(e,t){return Qc.find(n=>n.toolApprovalMode===e&&n.approvalHandling===t)?.id}const el={always_ask:`Always Ask`,auto:`Auto`,always_allow:`Always Allow`},tl={always_ask:`Show approval dialog for every tool execution`,auto:`Ask only before high-risk tools; auto-approve the rest`,always_allow:`Never ask for approval (trust mode)`},nl={ALWAYS_ALLOW:`always_allow`,NEED_APPROVAL:`need_approval`,BLOCK:`block`},rl=z([nl.ALWAYS_ALLOW,nl.NEED_APPROVAL,nl.BLOCK]),il=I({toolName:D().trim().min(1).max(200),policy:rl});F(il).refine(e=>{let t=e.map(e=>e.toolName);return new Set(t).size===t.length},{message:`Duplicate toolName in toolPolicies`});const al={[nl.ALWAYS_ALLOW]:0,[nl.NEED_APPROVAL]:1,[nl.BLOCK]:2};function ol(...e){let t=new Map;for(let n of e)for(let{toolName:e,policy:r}of n??[]){let n=t.get(e);(n===void 0||al[r]>al[n])&&t.set(e,r)}return t}const sl=I({hour:M().int().min(0).max(23),minute:M().int().min(0).max(59)}).describe(`Wall-clock local time in the schedule's own utcOffset timezone (NOT UTC). E.g. { "hour": 9, "minute": 0 } means 9:00 AM in that timezone, regardless of what utcOffset is — do not convert a user-stated local time to UTC before setting this field.`),cl=D().trim().min(1).max(2e3),ll=I({enabled:N().optional(),criteria:cl.optional(),extracted:I({outcomes:F(cl).min(1).max(20),extractedAt:w(),inputFingerprint:D().regex(/^[a-f0-9]{64}$/u).optional(),extractorVersion:M().int().positive().optional()}).optional()});I({completed:B(!1),reason:cl,unmet:F(cl).max(20),criteriaSource:z([`inferred`,`explicit`,`extracted`]),analysis:D().trim().min(1).max(1e3).optional(),escalated:N().optional(),reviewSkipped:N().optional()});const ul=e=>e.hour*60+e.minute,dl=F(I({start:sl,end:sl}).refine(e=>ul(e.end)>ul(e.start),{message:`Run window end must be after start (no cross-midnight)`,path:[`end`]})).min(1).max(5),fl=F(sl).min(1).max(5).refine(e=>new Set(e.map(e=>e.hour*60+e.minute)).size===e.length,{message:`Trigger times must not contain duplicates`}).optional(),pl=F(M().int().min(0).max(6)).min(1);R(`type`,[I({type:B(`no-repeat`)}),I({type:B(`repeat`),interval:R(`unit`,[I({unit:B(`minutes`),every:M().int().min(15,`Minimum interval is 15 minutes`).max(1440,`Maximum interval is 1440 minutes (24 hours)`),dailyWindows:dl.optional(),daysOfWeek:pl.optional()}),I({unit:B(`hours`),every:M().int().min(1),minute:M().int().min(0).max(59),dailyWindows:dl.optional(),daysOfWeek:pl.optional()}),I({unit:B(`days`),every:M().int().min(1),time:sl,times:fl,daysOfWeek:pl.optional()}),I({unit:B(`weeks`),every:M().int().min(1),daysOfWeek:F(M().int().min(0).max(6)).min(1),time:sl}),I({unit:B(`months`),every:M().int().min(1),daysOfMonth:F(M().int().min(1).max(31)),lastDayOfMonth:N(),time:sl})])})]).superRefine((e,t)=>{if(e.type!==`repeat`)return;let n=e.interval;if(n.unit===`months`&&n.daysOfMonth.length===0&&!n.lastDayOfMonth&&t.addIssue({code:`custom`,message:`lastDayOfMonth must be true when daysOfMonth is empty`,path:[`interval`,`daysOfMonth`]}),n.unit===`hours`&&n.every>=24&&(n.daysOfWeek?.length??0)>0&&t.addIssue({code:`custom`,message:`Weekday filter is not available for hourly intervals of 24 hours or more`,path:[`interval`,`daysOfWeek`]}),n.unit===`days`&&n.every%7==0&&(n.daysOfWeek?.length??0)>0&&t.addIssue({code:`custom`,message:`Weekday filter is not supported for day intervals that are a multiple of 7 (the weekday never changes); use the weeks unit instead`,path:[`interval`,`daysOfWeek`]}),n.unit===`hours`&&n.every>=24&&(n.dailyWindows?.length??0)>0&&t.addIssue({code:`custom`,message:`Active windows are not available for hourly intervals of 24 hours or more`,path:[`interval`,`dailyWindows`]}),n.unit!==`minutes`&&n.unit!==`hours`||n.unit===`hours`&&n.every>=24)return;let r=n.dailyWindows;if(!r)return;let i=n.unit===`minutes`?n.every:n.every*60;r.some(e=>ul(e.end)-ul(e.start)<i)&&t.addIssue({code:`custom`,message:`Each run window must be at least as long as the interval`,path:[`interval`,`dailyWindows`]});let a=[...r].toSorted((e,t)=>ul(e.start)-ul(t.start));for(let e=1;e<a.length;e++){let n=a[e],r=a[e-1];if(n&&r&&ul(n.start)<ul(r.end)){t.addIssue({code:`custom`,message:`Run windows must not overlap`,path:[`interval`,`dailyWindows`]});break}}});const ml=I({id:A(),name:D(),iconUrl:D().optional(),deletedAt:w().optional()}),hl=I({id:D(),name:D()}),gl=I({id:A(),title:D(),read:N(),deletedAt:w().nullable()}),_l=I({id:A(),name:D(),isWorkspaceMember:N()}),vl=I({id:A(),name:D(),prompt:D(),user:_l.optional(),agent:ml.optional(),model:hl.optional(),startsAt:w(),isActive:N(),unreadTasks:M().int(),nextRunAt:w().nullable(),utcOffset:D(),config:Jo().meta({type:`object`}),judge:ll.nullish(),toolApprovalMode:Jc.nullish(),approvalHandling:Zc.nullish(),holidayCalendarIds:F(A()).nullish(),recentTasks:F(gl).optional(),createdAt:w(),updatedAt:w()});vl.extend({toolPolicies:F(il)}),I({schedules:F(vl),nextKey:D().optional()}),es.extend({search:D().trim().max(200).optional(),sortBy:z([`nextRunAt`,`name`]).optional(),isActive:Zo().optional(),agentId:A().optional()});const yl=z([`queued`,`running`,`completed`,`failed`,`skipped`]),bl=I({type:D().optional().transform(e=>e===`runtime`||e===`judge`?e:void 0),message:D(),code:D().optional()}),xl=I({id:A(),name:D()}),Sl=z([`approval`]);I({runs:F(I({id:A(),scheduledAt:w(),agent:ml.optional(),model:hl.optional(),task:gl.nullable(),error:bl.nullish(),status:yl.optional(),skipReason:D().nullish(),resolvedAt:w().nullish(),resolvedBy:xl.nullish(),waitingReason:Sl.nullish()})),nextKey:D().optional()}),I({resolvedAt:w(),resolvedBy:xl.nullable()});const K={SELF:`self`,WORKSPACE:`workspace`,PUBLIC:`public`},Cl=z([K.SELF,K.WORKSPACE,K.PUBLIC]);K.SELF,K.WORKSPACE,K.PUBLIC;const wl=z([K.PUBLIC,K.WORKSPACE,`none`]);K.PUBLIC,K.WORKSPACE;const Tl=M().int().positive().optional(),El=A().nullable(),Dl=I({id:A(),name:D(),mimeType:D(),size:M(),url:j()}),Ol=R(`type`,[I({id:A(),type:B(`file`),projectId:El,file:Dl,versionNumber:Tl,createdAt:w(),updatedAt:w()}),I({id:A(),type:B(`website`),projectId:El,url:j(),sandboxId:D().nullable(),title:D().optional(),visibility:Cl.default(K.SELF),source:Dl.optional(),hasUnsavedWork:N().optional(),versionNumber:Tl,createdAt:w(),updatedAt:w()}),I({id:A(),type:B(`deck`),projectId:El,title:D(),pdf:Dl,pptx:Dl.optional(),hasUnsavedWork:N().optional(),versionNumber:Tl,createdAt:w(),updatedAt:w()})]);I({data:F(Ol),nextKey:D().optional()}),I({data:Ol}),I({data:I({webViewLink:j()})}),I({visibility:Cl});const kl=I({id:A(),versionNumber:M().int().positive(),title:D().nullable(),summary:D().nullable(),editor:I({id:A(),name:D(),email:k(),image:D().nullable()}),createdAt:w(),sourceTask:L([I({visible:B(!0),id:A(),title:D().nullable()}),I({visible:B(!1)})]).nullable(),revertedFrom:M().int().positive().nullable()});I({data:I({headVersionId:A(),canRevert:N(),versions:F(kl)})}),I({summary:D().trim().min(1).max(500).optional()}),I({data:R(`status`,[I({status:B(`saved`),versionId:A(),versionNumber:M().int().positive()}),I({status:B(`unchanged`),versionNumber:M().int().positive()})])});const Al=I({id:A(),name:D()});I({assetProjectId:A().nullable(),assetName:D(),assetHasPreviewableVersions:N(),currentVersionNumber:M().int().positive(),currentVersionSavedAt:w(),currentVersionEditor:Al,baseVersionNumber:M().int().positive()}).extend({assetId:A()}),I({expectedHeadVersionId:A()}),I({data:I({versionId:A(),versionNumber:M().int().positive(),revertedFrom:M().int().positive()})});const jl=z([K.SELF,`project`,K.WORKSPACE,K.PUBLIC]);K.SELF,K.WORKSPACE,K.PUBLIC,I({shareId:A(),assetId:A()}),I({data:Ol}),I({visibility:jl}),I({id:A(),visibility:jl,createdAt:w(),updatedAt:w()});const Ml=I({userId:A(),name:D(),email:k(),image:D().nullable().optional(),grantedAt:w()});I({data:F(Ml)}),I({data:Ml}),z([`running`,`completed`,`failed`]);const Nl=I({id:A(),name:D(),iconId:A().optional(),iconUrl:D().optional(),deletedAt:w().optional()}),Pl=[`chat`,`chatbot`,`schedule`,`agent_api`],Fl=z(Pl);I({tasks:F(I({id:A(),title:D(),read:N(),userId:A(),workspaceId:A(),source:Fl,waitingReason:B(`approval`).optional(),share:I({id:A(),visibility:jl}).optional(),agent:Nl.optional(),schedule:I({id:A(),name:D()}).optional(),scheduleRun:I({runId:A(),status:yl,error:bl.nullish(),resolvedAt:w().nullable(),resolvedBy:xl.nullish(),canResolve:N()}).optional(),project:Gc.nullable().optional(),containsSensitiveContent:N().optional(),createdAt:w(),updatedAt:w()})),nextKey:D().optional()}),I({id:A(),title:D(),visibility:jl,workspace:I({id:A()}),agent:Nl.optional(),createdAt:w()}),I({results:F(I({id:A(),title:D(),titleHighlight:D().nullable(),contentSnippet:D().nullable(),project:Gc.nullable().optional(),createdAt:w(),updatedAt:w()})),nextKey:D().optional()});const Il=[`personal`,`managed`],Ll=[`enabled`,`disabled`];I({userId:A()}),I({status:z(Ll)}),I({monthlyCapUsd:M().positive().nullable()}),I({items:F(I({connectorId:A(),name:D(),authorizedBy:I({id:A(),name:D(),disabled:N()}),updatedAt:w()}))});const Rl=Pl,zl=[`completed`,`failed`,`running`];es.extend({limit:V().int().min(1).max(100).default(30),source:z(Rl).optional(),status:z(zl).optional(),initiatorId:A().optional(),from:w().optional(),to:w().optional(),q:D().trim().max(200).optional()}).refine(e=>e.from===void 0||e.to===void 0||new Date(e.from)<=new Date(e.to),{message:`to must be greater than or equal to from`,path:[`to`]}),I({items:F(I({taskId:A(),title:D(),source:z(Rl),initiator:I({userId:A().nullable(),name:D(),unlinked:N()}).nullable(),status:z(zl),actionCount:M().int(),cost:M(),createdAt:w()})),nextKey:D().nullable()});const Bl=I({conversationCount:M().int(),actionCount:M().int(),cost:M(),errorRate:M()});I({today:Bl,week:Bl,monthCost:M(),monthlyCapUsd:M().nullable()}),I({items:F(I({id:A(),name:D(),missingConnectorNames:F(D()),disabled:N()})),nextKey:D().nullable()});const Vl={[W.SANDBOX]:`Sandbox`,[W.MULTITASKING]:`Multitasking`,[W.HISTORY]:`History`,[W.CREATION]:`Content Creation`,[W.PROJECT]:`Project Knowledge`,[W.WEB_SEARCH]:`Web Search`,[W.SCHEDULE]:`Schedules`,[W.AGENTS_AND_SKILLS]:`Agents & Skills`,[W.AUDIT_LOG]:`Audit Logs`};function Hl(e){return Vl[e]??e}I({iconId:A(),url:j()});const Ul=[`updatedAt`,`usedAt`,`name`];I({search:D().trim().max(200).optional(),nextKey:D().optional(),limit:V().int().min(1).max(100).default(20),sortBy:z(Ul).optional()});const Wl=I({id:A(),name:D(),isMe:N()}),Gl=I({id:A()}).nullable();I({agents:F(I({id:A(),name:D(),description:D(),kind:z(Il),managedStatus:z(Ll).optional(),provider:D(),author:Wl,iconUrl:D().optional(),publish:Gl,myRole:G,createdAt:w(),updatedAt:w()})),nextKey:D().optional()}),I({search:D().trim().max(200).optional(),status:z(Mc).optional(),nextKey:D().optional(),limit:V().int().min(1).max(100).default(20),sortBy:z(Ul).optional()}),I({agents:F(I({id:A(),name:D(),description:D(),kind:z(Il),managedStatus:z(Ll).optional(),iconUrl:D().optional(),hasUnpublishedChanges:N(),latestVersionNumber:M().int().nullable(),publishedTo:Tc.optional(),myRole:G,createdAt:w(),updatedAt:w()})),nextKey:D().optional(),totalCount:M().int().nonnegative(),statusCounts:Nc}),I({id:A(),name:D(),deletedAt:w().optional()});const Kl=I({id:D(),name:D(),available:N()}),ql=I({id:A(),name:D(),hasPermission:N(),added:N()}),Jl=I({name:D(),isMe:N()}),Yl=I({sponsor:I({id:A(),name:D(),image:D().nullable().optional()}),monthlyCapUsd:M().nullable(),skills:F(I({id:A(),name:D()})),delegatableAgents:F(I({id:A(),name:D()})),apiRateLimit:M().int().nullable()});I({id:A(),name:D(),description:D(),kind:z(Il),managedStatus:z(Ll).optional(),managed:Yl.optional(),model:Kl.optional(),systemPrompt:D().optional(),conversationStarters:F(D()),connectors:F(ql).optional(),capabilities:ic.optional(),provider:D(),author:Jl,iconId:A().optional(),iconUrl:D().optional(),versionNumber:M().int().nullable(),latestVersionNumber:M().int().nullable().optional(),publishedTo:Tc.optional(),myRole:G,createdAt:w(),updatedAt:w()}),I({agents:F(I({id:A(),name:D(),description:D(),iconUrl:D().optional(),versionNumber:M().int().nullable(),createdAt:w(),updatedAt:w()}))}),I({agents:F(I({id:A(),name:D(),description:D(),kind:z(Il),managedStatus:z(Ll).optional(),conversationStarters:F(D()),provider:D().nullable(),author:Jl,publishedTo:Tc.optional(),team:I({id:A(),name:D()}).optional(),iconUrl:D().optional(),versionNumber:M().int().nullable(),myRole:G,createdAt:w(),updatedAt:w()})),nextKey:D().optional()});const Xl=z([`true`,`false`]).transform(e=>e===`true`);es.extend({createdBy:z([`workspace`,`team`,`me`]).optional(),teamId:A().optional(),search:D().trim().max(200).optional(),executableOnly:Xl.optional(),sortBy:z(Ul).optional()}).refine(e=>!e.teamId||e.createdBy===`team`,{message:`teamId can only be used with createdBy: team`,path:[`teamId`]}),I({workspaceId:A(),agentId:A()}),I({limit:V().int().min(1).max(100).default(20),offset:V().int().nonnegative().default(0)});const Zl=I({taskId:A(),title:D(),source:Fl,amountUsd:M().nonnegative().nullable(),amountCredits:M().nonnegative().nullable(),usageCount:M().int().nonnegative(),lastUsageAt:w(),createdAt:w(),updatedAt:w()}),Ql=I({toolName:D(),input:D().optional(),output:D().optional()}),$l=I({role:z([`user`,`assistant`]),texts:F(D()),toolCalls:F(Ql).optional()}),eu=I({taskId:A(),title:D(),amountUsd:M().nonnegative().nullable(),amountCredits:M().nonnegative().nullable(),promptTexts:F(D()),messages:F($l).optional()});I({agentName:D().optional(),totalAmountUsd:M().nonnegative().nullable(),totalAmountCredits:M().nonnegative().nullable(),runCount:M().int().nonnegative(),total:M().int().nonnegative(),runs:F(Zl),promptSamples:F(eu).optional(),promptSamplesTruncated:N().optional()});const tu=I({agentId:A(),agentName:D(),amountUsd:M().nonnegative().nullable(),amountCredits:M().nonnegative().nullable(),runCount:M().int().nonnegative(),usageCount:M().int().nonnegative(),lastUsageAt:w()});I({periodDays:M().int().positive(),since:w(),totalAmountUsd:M().nonnegative().nullable(),totalAmountCredits:M().nonnegative().nullable(),totalAgents:M().int().nonnegative(),agents:F(tu)});const nu=I({p50AmountUsdPerRun:M().nonnegative().nullable(),p50AmountCreditsPerRun:M().nonnegative().nullable(),percentile:M().min(0).max(100).nullable(),workspaceAgentCount:M().int().nonnegative()}),ru=I({avgInputTokensPerRun:M().nonnegative(),avgOutputTokensPerRun:M().nonnegative(),avgCachedInputTokensPerRun:M().nonnegative(),avgTotalTokensPerRun:M().nonnegative(),inputToOutputRatio:M().nonnegative(),cachedInputRatio:M().min(0).max(1),avgLlmCallsPerRun:M().nonnegative()}),iu=I({usageType:D(),amountUsd:M().nonnegative().nullable(),amountCredits:M().nonnegative().nullable()});I({agentId:A(),agentName:D(),modelId:D(),periodDays:M().int().positive(),since:w(),runCount:M().int().nonnegative(),totalAmountUsd:M().nonnegative().nullable(),totalAmountCredits:M().nonnegative().nullable(),avgAmountUsdPerRun:M().nonnegative().nullable(),avgAmountCreditsPerRun:M().nonnegative().nullable(),scheduleRunCount:M().int().nonnegative(),manualRunCount:M().int().nonnegative(),runsPerDay:M().nonnegative(),benchmark:nu,tokenProfile:ru.nullable(),costByType:F(iu),llmCostRatio:M().min(0).max(1).nullable(),highCostPerRun:N(),highFrequency:N(),systemPrompt:D(),systemPromptLength:M().int().nonnegative()}),I({capabilities:F(z(rc)),workspaceCapabilities:F(z(nc))});const au={invalidInput:`invalid_input`,staleRef:`stale_ref`,noMatch:`no_match`,ambiguousLocator:`ambiguous_locator`,resolutionFailed:`resolution_failed`,permissionDenied:`permission_denied`,userCancelled:`user_cancelled`,navigationFailed:`navigation_failed`,timeout:`timeout`,sensitiveContext:`sensitive_context`,backendFailure:`backend_failure`};au.permissionDenied,au.userCancelled,au.sensitiveContext;const ou={DIRECT:`direct`,HINTED:`hinted`};ou.DIRECT,ou.HINTED;const su=[`single_select`,`multi_select`],cu=I({label:D().min(1).max(200).describe(`Display text for this option`),description:D().max(500).optional().describe(`Optional explanation of what this option means`)});I({questions:F(I({question:D().min(1).max(500).describe(`The question to ask the user`),type:z(su).describe(`single_select: user picks one option. multi_select: user picks one or more options.`),options:F(cu).min(2).max(4).describe(`The available choices (2-4 options)`)})).min(1).max(3).describe(`One to three structured questions to ask the user`)}),I({answers:F(I({questionIndex:M().int().min(0).describe(`Index of the question answered`),type:z(su).describe(`Question type`),selectedOptions:F(D()).describe(`Labels of selected options (empty if skipped)`),customText:D().optional().describe(`Free text if user chose "Something else"`),skipped:N().describe(`Whether the user skipped this question`)})).describe(`Answers for each question`),dismissed:N().describe(`True if the user dismissed the entire wizard without answering`)});const lu=z([`all`,`agent`,`general-task`,`connector`,`skill`,`system`]),uu=z([`workspace_owner`,`agent_owner`]),du=z([`success`,`failure`]),fu=z([`personal`,`managed`]),pu=z([`manual`,`scheduled`]);I({workspaceId:A()}),I({...I({category:lu.optional(),targetId:D().trim().min(1).optional(),agentType:fu.optional(),executionSource:pu.optional(),result:du.optional(),actorId:A().optional(),search:D().trim().max(200).optional()}).shape,category:lu.optional().default(`all`),snapshot:D().min(1).max(2048).optional(),beforeOccurredAt:w().optional(),beforeId:D().min(1).optional(),limit:V().int().min(1).max(100).default(50),offset:V().int().min(0).default(0)}).refine(e=>!!e.beforeOccurredAt==!!e.beforeId,{message:`beforeOccurredAt and beforeId must be provided together`,path:[`beforeOccurredAt`]});const mu=I({id:A(),name:D(),email:D()}),hu=I({type:D(),id:D(),name:D(),agentId:A().optional()}),gu=R(`type`,[I({type:B(`role`),from:D().optional(),to:D()})]),_u=I({type:z([`user`,`team`,`email`]),id:D().optional(),name:D(),email:D().optional(),role:D().optional()}),vu=I({id:D(),occurredAt:w(),actor:mu.nullable(),event:D(),category:lu.exclude([`all`]),result:du,resource:hu,change:gu.optional(),subject:_u.optional(),changedFields:F(D()).optional(),detail:D().optional(),taskUrl:D().optional()}),yu=I({id:D(),name:D(),category:lu.exclude([`all`])}),bu=I({all:M().int().nonnegative(),agent:M().int().nonnegative(),"general-task":M().int().nonnegative(),connector:M().int().nonnegative(),skill:M().int().nonnegative(),system:M().int().nonnegative()});I({items:F(vu),asOf:w(),snapshot:D().min(1),total:M().int().nonnegative(),scope:uu,counts:bu,targets:F(yu),actors:F(mu),retentionDays:M().int().positive()}),I({items:F(vu),asOf:w(),maxRows:M().int().positive()}),I({canAccess:N(),scope:uu.nullable()});const xu=[`openai`,`anthropic`,`vertex-anthropic`,`vertex-google`,`google`,`openrouter`,`selfhosted`],Su=[`none`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`],Cu=[{id:`gpt-5.6-sol`,provider:`openai`,reasoning:{effort:`medium`},name:`GPT-5.6 Sol`,description:`Frontier model for complex professional work`,hiddenInTask:!1,active:!0,contextWindowTokens:105e4,maxOutputTokens:128e3,pricing:{input:`0.000_005`,output:`0.000_030`,cachedInput:`0.000_000_5`,cacheCreation:`0.000_006_25`,longContext:{input:`0.000_010`,output:`0.000_045`,cachedInput:`0.000_001`,cacheCreation:`0.000_012_5`}},capabilities:{reasoning:!0},tokenCalculator:{kind:`input-context`,thresholdTokens:272e3}},{id:`gpt-5.6-terra`,provider:`openai`,reasoning:{effort:`medium`},name:`GPT-5.6 Terra`,description:`GPT-5.6 model that balances intelligence and cost`,hiddenInTask:!1,active:!0,contextWindowTokens:105e4,maxOutputTokens:128e3,pricing:{input:`0.000_002`,output:`0.000_012`,cachedInput:`0.000_000_2`,cacheCreation:`0.000_002_5`,longContext:{input:`0.000_004`,output:`0.000_018`,cachedInput:`0.000_000_4`,cacheCreation:`0.000_005`}},capabilities:{reasoning:!0},tokenCalculator:{kind:`input-context`,thresholdTokens:272e3}},{id:`gpt-5.6-luna`,provider:`openai`,reasoning:{effort:`medium`},name:`GPT-5.6 Luna`,description:`GPT-5.6 model optimized for cost-sensitive workloads`,hiddenInTask:!1,active:!0,contextWindowTokens:105e4,maxOutputTokens:128e3,pricing:{input:`0.000_000_2`,output:`0.000_001_2`,cachedInput:`0.000_000_02`,cacheCreation:`0.000_000_25`,longContext:{input:`0.000_000_4`,output:`0.000_001_8`,cachedInput:`0.000_000_04`,cacheCreation:`0.000_000_5`}},capabilities:{reasoning:!0},tokenCalculator:{kind:`input-context`,thresholdTokens:272e3}},{id:`gpt-5.5`,provider:`openai`,reasoning:{effort:`medium`},name:`GPT-5.5`,description:`A new class of intelligence for coding and professional work`,hiddenInTask:!1,active:!0,contextWindowTokens:272e3,maxOutputTokens:64e3,pricing:{input:`0.000_005`,output:`0.000_030`,cachedInput:`0.000_000_5`,longContext:{input:`0.000_010`,output:`0.000_045`,cachedInput:`0.000_001`}},capabilities:{reasoning:!0},tokenCalculator:{kind:`input-context`,thresholdTokens:272e3}},{id:`gpt-5.4`,provider:`openai`,reasoning:{effort:`medium`},name:`GPT-5.4`,description:`A more affordable model for coding and professional work`,hiddenInTask:!1,active:!0,contextWindowTokens:272e3,maxOutputTokens:64e3,pricing:{input:`0.000_002_5`,output:`0.000_015`,cachedInput:`0.000_000_25`,longContext:{input:`0.000_005`,output:`0.000_022_5`,cachedInput:`0.000_000_5`}},capabilities:{reasoning:!0},tokenCalculator:{kind:`input-context`,thresholdTokens:272e3}},{id:`gpt-5.4-mini`,provider:`openai`,reasoning:{effort:`medium`},name:`GPT-5.4 mini`,description:`Our strongest mini model yet for coding, computer use, and subagents`,hiddenInTask:!1,active:!0,contextWindowTokens:272e3,maxOutputTokens:32e3,pricing:{input:`0.000_000_75`,output:`0.000_004_5`,cachedInput:`0.000_000_075`},capabilities:{reasoning:!0}},{id:`gpt-5.2`,provider:`openai`,reasoning:{effort:`medium`},name:`GPT-5.2`,description:`The most advanced frontier model for professional work and long-running agents`,hiddenInTask:!1,active:!1,contextWindowTokens:272e3,maxOutputTokens:64e3,pricing:{input:`0.000_001_75`,output:`0.000_014`,cachedInput:`0.000_000_175`},capabilities:{reasoning:!0}},{id:`gpt-5.1`,provider:`openai`,reasoning:{effort:`medium`},name:`GPT-5.1`,description:`Smarter, more conversational TaskGPT`,hiddenInTask:!1,active:!1,contextWindowTokens:272e3,maxOutputTokens:64e3,pricing:{input:`0.000_001_25`,output:`0.000_010`,cachedInput:`0.000_000_125`},capabilities:{reasoning:!0}},{id:`gpt-5`,provider:`openai`,reasoning:{effort:`medium`},name:`GPT-5`,description:`Smartest, fastest, most useful model from OpenAI`,hiddenInTask:!1,active:!1,contextWindowTokens:272e3,maxOutputTokens:64e3,pricing:{input:`0.000_001_25`,output:`0.000_010`,cachedInput:`0.000_000_125`},capabilities:{reasoning:!0}},{id:`gpt-5-mini`,provider:`openai`,reasoning:{effort:`medium`},name:`GPT-5 mini`,description:`Fast for everyday tasks in low-cost`,hiddenInTask:!1,active:!1,contextWindowTokens:272e3,maxOutputTokens:32e3,pricing:{input:`0.000_000_25`,output:`0.000_002`,cachedInput:`0.000_000_025`},capabilities:{reasoning:!0}},{id:`o3`,provider:`openai`,reasoning:{effort:`medium`},name:`o3`,description:`Great for advanced reasoning`,hiddenInTask:!1,active:!1,contextWindowTokens:2e5,maxOutputTokens:64e3,pricing:{input:`0.000_002`,output:`0.000_008`,cachedInput:`0.000_000_5`},capabilities:{reasoning:!0}},{id:`gpt-4o`,provider:`openai`,name:`GPT-4o`,description:`Great for most tasks`,hiddenInTask:!1,active:!1,contextWindowTokens:2e5,maxOutputTokens:16e3,pricing:{input:`0.000_002_5`,output:`0.000_010`,cachedInput:`0.000_001_25`}},{id:`gpt-4.1-mini`,provider:`openai`,name:`GPT-4.1 mini`,description:`Fast for everyday tasks in low-cost`,hiddenInTask:!1,active:!1,contextWindowTokens:2e5,maxOutputTokens:32e3,pricing:{input:`0.000_000_4`,output:`0.000_001_6`,cachedInput:`0.000_000_1`}},{id:`gpt-image-2`,provider:`openai`,name:`GPT Image 2`,description:`OpenAI state-of-the-art image generation model. Supports text + image input; outputs images.`,hiddenInTask:!0,active:!0,contextWindowTokens:2e5,pricing:{input:`0.000_005`,output:`0.000_030`},imageGeneration:`gpt-image-2`,imageModel:!0},{id:`claude-haiku-4-5-20251001`,provider:`anthropic`,reasoning:{thinking:{type:`enabled`,budgetTokens:12e3}},name:`Claude Haiku 4.5`,description:`Near-frontier performance with much greater cost-efficiency`,hiddenInTask:!1,active:!0,contextWindowTokens:2e5,maxOutputTokens:64e3,pricing:{input:`0.000_001`,output:`0.000_005`,cachedInput:`0.000_000_1`,cacheCreation:`0.000_001_25`,cacheCreation1h:`0.000_002`}},{id:`claude-sonnet-4-20250514`,provider:`anthropic`,reasoning:{thinking:{type:`enabled`,budgetTokens:12e3}},name:`Claude Sonnet 4`,description:`Smart, efficient model for everyday use`,hiddenInTask:!1,active:!1,contextWindowTokens:2e5,extendedContextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_003`,output:`0.000_015`,cachedInput:`0.000_000_3`,cacheCreation:`0.000_003_75`,cacheCreation1h:`0.000_006`,longContext:{input:`0.000_006`,output:`0.000_022_5`,cachedInput:`0.000_000_6`,cacheCreation:`0.000_007_5`,cacheCreation1h:`0.000_012`}},tokenCalculator:{kind:`long-context`,thresholdTokens:2e5}},{id:`claude-sonnet-4-5-20250929`,provider:`anthropic`,reasoning:{thinking:{type:`enabled`,budgetTokens:12e3}},name:`Claude Sonnet 4.5`,description:`Anthropic's best model for complex agents and coding`,hiddenInTask:!1,active:!0,contextWindowTokens:2e5,extendedContextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_003`,output:`0.000_015`,cachedInput:`0.000_000_3`,cacheCreation:`0.000_003_75`,cacheCreation1h:`0.000_006`,longContext:{input:`0.000_006`,output:`0.000_022_5`,cachedInput:`0.000_000_6`,cacheCreation:`0.000_007_5`,cacheCreation1h:`0.000_012`}},tokenCalculator:{kind:`long-context`,thresholdTokens:2e5}},{id:`claude-sonnet-4-6`,provider:`anthropic`,reasoning:{thinking:{type:`adaptive`},effort:`high`},name:`Claude Sonnet 4.6`,description:`Anthropic's best model for complex agents and coding`,hiddenInTask:!1,active:!0,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_003`,output:`0.000_015`,cachedInput:`0.000_000_3`,cacheCreation:`0.000_003_75`,cacheCreation1h:`0.000_006`}},{id:`claude-sonnet-5`,provider:`anthropic`,reasoning:{thinking:{type:`adaptive`},effort:`high`},name:`Claude Sonnet 5`,description:`Best combination of speed and intelligence for agents and coding`,hiddenInTask:!1,active:!0,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_002`,output:`0.000_010`,cachedInput:`0.000_000_2`,cacheCreation:`0.000_002_5`,cacheCreation1h:`0.000_004`}},{id:`claude-opus-4-1-20250805`,provider:`anthropic`,reasoning:{thinking:{type:`enabled`,budgetTokens:12e3}},name:`Claude Opus 4.1`,description:`Powerful model for complex challenges with 5x money cost`,hiddenInTask:!1,active:!1,contextWindowTokens:2e5,maxOutputTokens:32e3,pricing:{input:`0.000_015`,output:`0.000_075`,cachedInput:`0.000_001_5`,cacheCreation:`0.000_018_75`,cacheCreation1h:`0.000_030`}},{id:`claude-opus-4-6`,provider:`anthropic`,reasoning:{thinking:{type:`adaptive`},effort:`high`},name:`Claude Opus 4.6`,description:`Most powerful model for complex challenges`,hiddenInTask:!1,active:!0,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_005`,output:`0.000_025`,cachedInput:`0.000_000_5`,cacheCreation:`0.000_006_25`,cacheCreation1h:`0.000_010`}},{id:`claude-opus-4-8`,provider:`anthropic`,reasoning:{thinking:{type:`adaptive`},effort:`high`},name:`Claude Opus 4.8`,description:`Most powerful model for complex challenges`,hiddenInTask:!1,active:!0,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_005`,output:`0.000_025`,cachedInput:`0.000_000_5`,cacheCreation:`0.000_006_25`,cacheCreation1h:`0.000_010`}},{id:`claude-opus-5`,provider:`anthropic`,reasoning:{thinking:{type:`adaptive`},effort:`high`},name:`Claude Opus 5`,description:`Most powerful model for complex challenges`,hiddenInTask:!1,active:!0,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_005`,output:`0.000_025`,cachedInput:`0.000_000_5`,cacheCreation:`0.000_006_25`,cacheCreation1h:`0.000_010`}},{id:`claude-haiku-4-5@20251001`,provider:`vertex-anthropic`,reasoning:{thinking:{type:`enabled`,budgetTokens:12e3}},name:`Claude Haiku 4.5`,description:`Near-frontier performance with much greater cost-efficiency (via Vertex AI)`,hiddenInTask:!1,active:!0,contextWindowTokens:2e5,maxOutputTokens:64e3,pricing:{input:`0.000_001`,output:`0.000_005`,cachedInput:`0.000_000_1`,cacheCreation:`0.000_001_25`,cacheCreation1h:`0.000_002`}},{id:`claude-sonnet-4-5@20250929`,provider:`vertex-anthropic`,reasoning:{thinking:{type:`enabled`,budgetTokens:12e3}},name:`Claude Sonnet 4.5`,description:`Anthropic's best model for complex agents and coding (via Vertex AI)`,hiddenInTask:!1,active:!0,contextWindowTokens:2e5,extendedContextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_003`,output:`0.000_015`,cachedInput:`0.000_000_3`,cacheCreation:`0.000_003_75`,cacheCreation1h:`0.000_006`,longContext:{input:`0.000_006`,output:`0.000_022_5`,cachedInput:`0.000_000_6`,cacheCreation:`0.000_007_5`,cacheCreation1h:`0.000_012`}},tokenCalculator:{kind:`long-context`,thresholdTokens:2e5}},{id:`vertex/claude-sonnet-4-6`,provider:`vertex-anthropic`,reasoning:{thinking:{type:`adaptive`},effort:`high`},providerModelId:`claude-sonnet-4-6`,name:`Claude Sonnet 4.6`,description:`Anthropic's best model for complex agents and coding (via Vertex AI)`,hiddenInTask:!1,active:!0,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_003`,output:`0.000_015`,cachedInput:`0.000_000_3`,cacheCreation:`0.000_003_75`,cacheCreation1h:`0.000_006`}},{id:`vertex/claude-sonnet-5`,provider:`vertex-anthropic`,reasoning:{thinking:{type:`adaptive`},effort:`high`},providerModelId:`claude-sonnet-5`,name:`Claude Sonnet 5`,description:`Best combination of speed and intelligence for agents and coding (via Vertex AI)`,hiddenInTask:!1,active:!0,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_002`,output:`0.000_010`,cachedInput:`0.000_000_2`,cacheCreation:`0.000_002_5`,cacheCreation1h:`0.000_004`}},{id:`claude-opus-4-5@20251101`,provider:`vertex-anthropic`,reasoning:{thinking:{type:`enabled`,budgetTokens:12e3}},name:`Claude Opus 4.5`,description:`Latest Opus model for most complex tasks (via Vertex AI)`,hiddenInTask:!1,active:!1,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_015`,output:`0.000_075`,cachedInput:`0.000_001_5`,cacheCreation:`0.000_018_75`,cacheCreation1h:`0.000_030`}},{id:`vertex/claude-opus-4-6`,provider:`vertex-anthropic`,reasoning:{thinking:{type:`adaptive`},effort:`high`},providerModelId:`claude-opus-4-6`,name:`Claude Opus 4.6`,description:`Most powerful model for complex challenges (via Vertex AI)`,hiddenInTask:!1,active:!0,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_005`,output:`0.000_025`,cachedInput:`0.000_000_5`,cacheCreation:`0.000_006_25`,cacheCreation1h:`0.000_010`}},{id:`vertex/claude-opus-4-8`,provider:`vertex-anthropic`,reasoning:{thinking:{type:`adaptive`},effort:`high`},providerModelId:`claude-opus-4-8`,name:`Claude Opus 4.8`,description:`Most powerful model for complex challenges (via Vertex AI)`,hiddenInTask:!1,active:!0,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_005`,output:`0.000_025`,cachedInput:`0.000_000_5`,cacheCreation:`0.000_006_25`,cacheCreation1h:`0.000_010`}},{id:`vertex/claude-opus-5`,provider:`vertex-anthropic`,reasoning:{thinking:{type:`adaptive`},effort:`high`},providerModelId:`claude-opus-5`,name:`Claude Opus 5`,description:`Most powerful model for complex challenges (via Vertex AI)`,hiddenInTask:!1,active:!0,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_005`,output:`0.000_025`,cachedInput:`0.000_000_5`,cacheCreation:`0.000_006_25`,cacheCreation1h:`0.000_010`}},{id:`vertex/gemini-3.7-flash`,provider:`vertex-google`,reasoning:{type:`level`,level:`high`},providerModelId:`gemini-3.7-flash`,name:`Gemini 3.7 Flash (Vertex)`,description:`Fast, efficient model for agentic, multimodal, and coding workflows (via Vertex AI).`,hiddenInTask:!1,active:!0,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_000_75`,output:`0.000_003_75`,cachedInput:`0.000_000_075`}},{id:`vertex/gemini-3.5-flash`,provider:`vertex-google`,reasoning:{type:`level`,level:`medium`},providerModelId:`gemini-3.5-flash`,name:`Gemini 3.5 Flash (Vertex)`,description:`Frontier-level intelligence optimized for fast agentic and coding workflows (via Vertex AI).`,hiddenInTask:!1,active:!0,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_001_5`,output:`0.000_009`,cachedInput:`0.000_000_15`}},{id:`vertex/gemini-3.1-pro-preview`,provider:`vertex-google`,reasoning:{type:`level`,level:`high`},providerModelId:`gemini-3.1-pro-preview`,name:`Gemini 3.1 Pro (Vertex)`,description:`Next-generation model with enhanced reasoning capabilities and improved performance (via Vertex AI).`,hiddenInTask:!1,active:!0,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_002`,cachedInput:`0.000_000_2`,output:`0.000_012`,longContext:{input:`0.000_004`,cachedInput:`0.000_000_4`,output:`0.000_018`}},tokenCalculator:{kind:`long-context`,thresholdTokens:2e5}},{id:`vertex/gemini-3.5-flash-lite`,provider:`vertex-google`,reasoning:{type:`level`,level:`medium`},providerModelId:`gemini-3.5-flash-lite`,name:`Gemini 3.5 Flash Lite (Vertex)`,description:`Most cost-efficient model for high-volume agentic tasks (via Vertex AI).`,hiddenInTask:!1,active:!0,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_000_3`,output:`0.000_002_5`,cachedInput:`0.000_000_03`}},{id:`vertex/gemini-3.1-flash-lite-preview`,provider:`vertex-google`,reasoning:{type:`level`,level:`minimal`},providerModelId:`gemini-3.1-flash-lite-preview`,name:`Gemini 3.1 Flash Lite (Vertex)`,description:`Lightweight and fast (via Vertex AI).`,hiddenInTask:!0,active:!1,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_000_25`,output:`0.000_001_5`,cachedInput:`0.000_000_025`}},{id:`vertex/gemini-3-pro-preview`,provider:`vertex-google`,reasoning:{type:`level`,level:`high`},providerModelId:`gemini-3-pro-preview`,name:`Gemini 3 Pro (Vertex)`,description:`The most powerful agentic model yet combines state-of-the-art reasoning with richer visuals and deep interactivity (via Vertex AI).`,hiddenInTask:!1,active:!1,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_002`,cachedInput:`0.000_000_2`,output:`0.000_012`,longContext:{input:`0.000_004`,cachedInput:`0.000_000_4`,output:`0.000_018`}},tokenCalculator:{kind:`long-context`,thresholdTokens:2e4}},{id:`vertex/gemini-3-pro-image-preview`,provider:`vertex-google`,reasoning:{type:`level`,level:`high`},providerModelId:`gemini-3-pro-image-preview`,name:`Gemini 3 Pro Image Preview (Vertex)`,description:`The most powerful image generation model that lets you generate and edit images conversationally with state-of-the-art quality (via Vertex AI).`,hiddenInTask:!0,active:!0,contextWindowTokens:1e6,maxOutputTokens:32e3,pricing:{input:`0.000_002`,output:`0.000_012`,outputImage:`0.000_12`,cachedInput:`0.000_000_2`},tokenCalculator:{kind:`image-output`},imageGeneration:`gemini-3-pro`},{id:`vertex/gemini-3-flash-preview`,provider:`vertex-google`,reasoning:{type:`level`,level:`high`},providerModelId:`gemini-3-flash-preview`,name:`Gemini 3 Flash (Vertex)`,description:`Fast and efficient preview model (via Vertex AI)`,hiddenInTask:!1,active:!0,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_000_5`,output:`0.000_003`,cachedInput:`0.000_000_05`}},{id:`vertex/gemini-2.5-flash-image`,provider:`vertex-google`,reasoning:{type:`budget`,budgetTokens:12e3},providerModelId:`gemini-2.5-flash-image`,name:`Gemini 2.5 Flash Image (Vertex)`,description:`Latest, fastest, and most efficient natively multimodal model that lets you generate and edit images conversationally (via Vertex AI).`,hiddenInTask:!0,active:!0,contextWindowTokens:1e6,maxOutputTokens:32e3,pricing:{input:`0.000_000_3`,output:`0.000_002_5`,outputImage:`0.000_03`,cachedInput:`0.000_000_03`,cacheCreation:`0.000_001`},tokenCalculator:{kind:`image-output`},imageGeneration:`gemini-2.5-flash`},{id:`vertex/gemini-2.5-flash-lite`,provider:`vertex-google`,reasoning:{type:`budget`,budgetTokens:12e3},providerModelId:`gemini-2.5-flash-lite`,name:`Gemini 2.5 Flash Lite (Vertex)`,description:`Lightweight and fast (via Vertex AI).`,hiddenInTask:!0,active:!0,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_000_1`,output:`0.000_000_4`,cachedInput:`0.000_000_01`,cacheCreation:`0.000_001`}},{id:`gemini-3.7-flash`,provider:`google`,reasoning:{type:`level`,level:`high`},name:`Gemini 3.7 Flash`,description:`Fast, efficient model for agentic, multimodal, and coding workflows`,hiddenInTask:!1,active:!0,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_000_75`,output:`0.000_003_75`,cachedInput:`0.000_000_075`}},{id:`gemini-3.5-flash`,provider:`google`,reasoning:{type:`level`,level:`medium`},name:`Gemini 3.5 Flash`,description:`Frontier-level intelligence optimized for fast agentic and coding workflows`,hiddenInTask:!1,active:!0,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_001_5`,output:`0.000_009`,cachedInput:`0.000_000_15`}},{id:`gemini-3.1-pro-preview`,provider:`google`,reasoning:{type:`level`,level:`high`},name:`Gemini 3.1 Pro`,description:`Next-generation model with enhanced reasoning capabilities and improved performance.`,hiddenInTask:!1,active:!0,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_002`,cachedInput:`0.000_000_2`,output:`0.000_012`,longContext:{input:`0.000_004`,cachedInput:`0.000_000_4`,output:`0.000_018`}},tokenCalculator:{kind:`long-context`,thresholdTokens:2e5}},{id:`gemini-3.5-flash-lite`,provider:`google`,reasoning:{type:`level`,level:`medium`},name:`Gemini 3.5 Flash Lite`,description:`Most cost-efficient model for high-volume agentic tasks`,hiddenInTask:!1,active:!0,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_000_3`,output:`0.000_002_5`,cachedInput:`0.000_000_03`}},{id:`gemini-3.1-flash-lite-preview`,provider:`google`,reasoning:{type:`level`,level:`minimal`},name:`Gemini 3.1 Flash Lite`,description:`Lightweight and fast`,hiddenInTask:!0,active:!1,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_000_25`,output:`0.000_001_5`,cachedInput:`0.000_000_025`}},{id:`gemini-3-pro-preview`,provider:`google`,reasoning:{type:`level`,level:`high`},name:`Gemini 3 Pro`,description:`The most powerful agentic model yet combines state-of-the-art reasoning with richer visuals and deep interactivity.`,hiddenInTask:!1,active:!1,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_002`,cachedInput:`0.000_000_2`,output:`0.000_012`,longContext:{input:`0.000_004`,cachedInput:`0.000_000_4`,output:`0.000_018`}},tokenCalculator:{kind:`long-context`,thresholdTokens:2e4}},{id:`gemini-3-pro-image-preview`,provider:`google`,reasoning:{type:`level`,level:`high`},name:`Gemini 3 Pro Image Preview`,description:`The most powerful image generation model that lets you generate and edit images conversationally with state-of-the-art quality.`,hiddenInTask:!0,active:!0,contextWindowTokens:1e6,maxOutputTokens:32e3,pricing:{input:`0.000_002`,output:`0.000_012`,outputImage:`0.000_12`,cachedInput:`0.000_000_2`},tokenCalculator:{kind:`image-output`},imageGeneration:`gemini-3-pro`},{id:`gemini-3-flash-preview`,provider:`google`,reasoning:{type:`level`,level:`high`},name:`Gemini 3 Flash`,description:`Fast and efficient preview model`,hiddenInTask:!1,active:!0,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_000_5`,output:`0.000_003`,cachedInput:`0.000_000_05`}},{id:`gemini-2.5-pro`,provider:`google`,reasoning:{type:`budget`,budgetTokens:12e3},name:`Gemini 2.5 Pro`,description:`For reasoning, mathematics and programming`,hiddenInTask:!1,active:!0,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_001_25`,output:`0.000_010`,cachedInput:`0.000_000_125`,cacheCreation:`0.000_004_5`,longContext:{input:`0.000_002_5`,output:`0.000_015`,cachedInput:`0.000_000_25`,cacheCreation:`0.000_004_5`}},tokenCalculator:{kind:`long-context`,thresholdTokens:2e5}},{id:`gemini-2.5-flash`,provider:`google`,reasoning:{type:`budget`,budgetTokens:12e3},name:`Gemini 2.5 Flash`,description:`Get quick assistance for various types`,hiddenInTask:!1,active:!0,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_000_3`,output:`0.000_002_5`,cachedInput:`0.000_000_03`,cacheCreation:`0.000_001`}},{id:`gemini-2.5-flash-image`,provider:`google`,reasoning:{type:`budget`,budgetTokens:12e3},name:`Gemini 2.5 Flash Image `,description:`Latest, fastest, and most efficient natively multimodal model that lets you generate and edit images conversationally.`,hiddenInTask:!0,active:!0,contextWindowTokens:1e6,maxOutputTokens:32e3,pricing:{input:`0.000_000_3`,output:`0.000_002_5`,outputImage:`0.000_03`,cachedInput:`0.000_000_03`,cacheCreation:`0.000_001`},tokenCalculator:{kind:`image-output`},imageGeneration:`gemini-2.5-flash`},{id:`gemini-2.5-flash-lite`,provider:`google`,reasoning:{type:`budget`,budgetTokens:12e3},name:`Gemini 2.5 Flash Lite`,description:`Lightweight and fast`,hiddenInTask:!0,active:!0,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_000_1`,output:`0.000_000_4`,cachedInput:`0.000_000_01`,cacheCreation:`0.000_001`}},{id:`openai/gpt-oss-120b`,provider:`openrouter`,reasoning:{type:`effort`,effort:`medium`},name:`GPT-OSS 120B`,description:`Open source model from OpenAI`,hiddenInTask:!1,active:!0,contextWindowTokens:131072,maxOutputTokens:64e3,pricing:{input:`0.000_000_1`,output:`0.000_000_5`}},{id:`z-ai/glm-4.6`,provider:`openrouter`,reasoning:{type:`enabled`},name:`GLM 4.6`,description:`GLM-4.6 with 200K context window, superior coding performance, advanced reasoning, and refined writing`,hiddenInTask:!1,active:!0,contextWindowTokens:2e5,maxOutputTokens:64e3,pricing:{input:`0.000_000_6`,output:`0.000_002_2`,cachedInput:`0.000_000_11`}},{id:`moonshotai/kimi-k2-thinking`,provider:`openrouter`,reasoning:{type:`enabled`},name:`Kimi K2 Thinking`,description:`Moonshot AI's most advanced open reasoning model with 256K context window, optimized for persistent step-by-step thought and complex reasoning workflows`,hiddenInTask:!1,active:!0,contextWindowTokens:2e5,maxOutputTokens:64e3,pricing:{input:`0.000_000_6`,output:`0.000_002_5`,cachedInput:`0.000_000_15`}},{id:`minimax/minimax-m2`,provider:`openrouter`,reasoning:{type:`enabled`},name:`MiniMax M2`,description:`Compact, high-efficiency model optimized for end-to-end coding and agentic workflows with 204.8K context window`,hiddenInTask:!1,active:!0,contextWindowTokens:2e5,maxOutputTokens:64e3,pricing:{input:`0.000_000_3`,output:`0.000_001_2`}},{id:`meta/muse-glimmer-30b`,provider:`openrouter`,reasoning:{type:`effort`,effort:`medium`},name:`Muse Glimmer 30B`,description:`Dense, open-weight multimodal model from Meta Superintelligence Labs, distilled from Muse Spark and optimized for autonomous agents on consumer hardware`,hiddenInTask:!1,active:!0,contextWindowTokens:131072,maxOutputTokens:64e3,pricing:{input:`0.000_000_35`,output:`0.000_001_5`,cachedInput:`0.000_000_04`}},{id:`moonshotai/kimi-k3`,provider:`openrouter`,reasoning:{type:`effort`,effort:`max`},name:`Kimi K3`,description:`Moonshot AI's multimodal reasoning model with a 1M context window, built for long-horizon agentic workflows`,hiddenInTask:!1,active:!0,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_003`,output:`0.000_015`,cachedInput:`0.000_000_3`}},{id:`z-ai/glm-5.2`,provider:`openrouter`,reasoning:{type:`effort`,effort:`high`},name:`GLM 5.2`,description:`GLM-5.2 with strong coding and agentic performance, advanced reasoning, and long-context support`,hiddenInTask:!1,active:!0,contextWindowTokens:262144,maxOutputTokens:64e3,pricing:{input:`0.000_000_76`,output:`0.000_002_42`,cachedInput:`0.000_000_14`}},{id:`deepseek/deepseek-v4-flash-0731`,provider:`openrouter`,reasoning:{type:`effort`,effort:`high`},name:`DeepSeek V4 Flash`,description:`Low-cost, high-throughput DeepSeek model with a 1M context window, suited for high-volume agentic and coding workloads`,hiddenInTask:!1,active:!0,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_000_08`,output:`0.000_000_18`,cachedInput:`0.000_000_016`}},{id:`gpt-oss-120b`,provider:`selfhosted`,name:`GPT-OSS 120B`,description:`Open source model from OpenAI`,hiddenInTask:!1,active:!0,contextWindowTokens:131072,maxOutputTokens:64e3,pricing:{input:`0.000_000_1`,output:`0.000_000_5`}}],wu=z([`chat`,`image`]),Tu=D().refine(e=>{if(e===``)return!1;let t=e.replace(/_/g,``),n=Number(t);return!Number.isNaN(n)&&Number.isFinite(n)&&n>=0},{message:`Invalid decimal string`}),Eu=I({input:D(),output:D(),cachedInput:D().optional(),cacheCreation:D().optional()}),Du=I({input:Tu,output:Tu,cachedInput:Tu.optional(),cacheCreation:Tu.optional()}),Ou=I({effort:z(Su)}),ku=I({modelId:D(),deploymentName:D(),workspaceId:D().nullable(),kind:wu,name:D(),description:D(),pricing:Eu,reasoning:Ou.nullable(),createdAt:w(),updatedAt:w()});I({deployments:F(ku),nextKey:D().optional()}),I({deploymentName:D().min(1),name:D().min(1),description:D().default(``),pricing:Du,reasoning:Ou.nullable().default(null)}),I({name:D().min(1).optional(),description:D().optional(),pricing:Du.optional(),reasoning:Ou.nullable().optional()}),I({deploymentName:D().min(1),kind:wu,name:D().min(1),description:D().default(``),pricing:Du,reasoning:Ou.nullable().default(null)}),I({name:D().min(1).optional(),description:D().optional(),kind:wu.optional(),pricing:Du.optional(),reasoning:Ou.nullable().optional()}),I({deploymentName:D().min(1)}),I({deployments:F(ku)}),I({workspaceId:A()}),I({amountUsd:M().positive().max(1e4)}),I({checkoutUrl:j()}),I({id:A(),workspaceId:A(),amountUsd:D(),purchasedBy:A().nullable(),stripeCheckoutSessionId:D(),stripePaymentIntentId:D().nullable(),isAutoReload:N(),createdAt:w()}),I({workspaceId:A()}),I({checkoutUrl:j()}),z([`incomplete`,`incomplete_expired`,`trialing`,`active`,`past_due`,`canceled`,`unpaid`,`paused`]);const Au=z([`draft`,`open`,`paid`,`uncollectible`,`void`]);z([`upgrade`,`downgrade`,`invite_accept`,`member_join`]),z([`pending`,`processing`,`processed`,`failed`]),z([`seat_change`,`extra_usage_purchase`]),z([`pending`,`processing`,`requires_action`,`succeeded`,`failed`,`expired`,`superseded`]),z([`pending`,`applied`,`failed`,`canceled`]);const ju=z([`subscription`,`extra_usage`]),Mu=I({id:A(),type:ju,status:Au,totalUsd:M().nonnegative(),billingDate:w(),hostedInvoiceUrl:j().nullable()});I({workspaceId:A()}),I({limit:V().int().min(1).max(100).default(20),nextKey:D().optional()}),I({invoices:F(Mu),nextKey:D().optional()});const Nu=z([`pro`,`premium`]),Pu=I({pro:M().int().nonnegative(),premium:M().int().nonnegative()});I({pro:M().int(),premium:M().int()});const Fu=I({lineItems:F(I({seatType:Nu,quantity:M().int(),amountUsd:D()})),subtotalUsd:D(),taxUsd:D(),totalUsd:D()}),Iu=z([`seat_pool_invariant`,`subscription_canceling`,`payment_required`,`unsupported_billing_state`]);I({workspaceId:A()});const Lu=I({targetPurchasedSeats:Pu,seatAssignment:I({userId:A(),seatType:Nu}).optional()});R(`outcome`,[I({outcome:B(`unchanged`),quoteHash:D().min(1),targetPurchasedSeats:Pu,nextMonthlyAmountUsd:D()}),I({outcome:B(`immediate`),quoteHash:D().min(1),targetPurchasedSeats:Pu,nextMonthlyAmountUsd:D(),dueToday:Fu}),I({outcome:B(`scheduled`),quoteHash:D().min(1),targetPurchasedSeats:Pu,nextMonthlyAmountUsd:D(),dueToday:Fu,effectiveAt:w()}),I({outcome:B(`split`),quoteHash:D().min(1),immediatePurchasedSeats:Pu,targetPurchasedSeats:Pu,nextMonthlyAmountUsd:D(),dueToday:Fu,effectiveAt:w()}),I({outcome:B(`blocked`),reason:Iu})]),I({workspaceId:A()}),Lu.extend({expectedQuoteHash:D().min(1)}),R(`kind`,[I({kind:B(`completed`),operationId:A().nullable()}),I({kind:B(`processing`),operationId:A()}),I({kind:B(`redirect`),operationId:A().nullable(),url:j()})]),I({workspaceId:A()});const Ru=I({startAt:w(),endAt:w()}),zu=I({cancelAtPeriodEnd:N(),canceledAt:w().nullable()}),Bu=I({reason:z([`invoice_payment_failed`,`checkout_incomplete`,`subscription_unpaid`,`subscription_paused`,`unsupported_state`]),startedAt:w().nullable(),retryEndsAt:w().nullable(),stripeInvoiceId:D().min(1).nullable(),hostedInvoiceUrl:j().nullable()});I({lifecycle:R(`kind`,[I({kind:B(`default`),period:ro(),cancellation:ro(),paymentIssue:ro()}),I({kind:B(`active`),period:Ru,cancellation:zu,paymentIssue:ro()}),I({kind:B(`payment_required`),period:Ru.nullable(),cancellation:ro(),paymentIssue:Bu}),I({kind:B(`canceled`),period:ro(),cancellation:zu,paymentIssue:ro()}),I({kind:B(`unavailable`),period:Ru.nullable(),cancellation:ro(),paymentIssue:Bu})]),subscription:I({planName:D().min(1),estimatedMonthlyChargeUsd:M().nonnegative(),nextInvoiceDueAt:w().nullable()}).nullable(),seats:I({purchased:Pu,assigned:Pu,available:Pu,totalPurchased:M().int().nonnegative(),totalAssigned:M().int().nonnegative(),totalAvailable:M().int().nonnegative()}),extraUsage:ws.extend({currentPurchasedUsd:M().nonnegative()})}),I({workspaceId:A()}),I({portalUrl:j()}),I({workspaceId:A(),userId:A()}),I({seatType:vs});const Vu=z([`google`,`outlook`,`caldav`]),Hu=z([`confirmed`,`tentative`,`cancelled`]),Uu=I({email:D(),displayName:D().optional(),responseStatus:z([`needsAction`,`declined`,`tentative`,`accepted`]).optional(),organizer:N().optional(),self:N().optional(),resource:N().optional()}),Wu=I({type:z([`hangoutsMeet`,`zoom`,`teams`,`webex`,`other`]),uri:D().optional(),label:D().optional()}),Gu=I({id:A(),providerCalendarId:D(),name:D(),color:D().nullable(),isVisible:N()});I({accounts:F(I({id:A(),provider:Vu,email:D(),isActive:N(),lastSyncAt:D().nullable(),reminderEnabled:N(),reminderMinutesBefore:M(),createdAt:w(),calendars:F(Gu)}))}),I({events:F(I({id:A(),calendarId:A(),calendarName:D(),calendarColor:D().nullable(),provider:Vu,providerEventId:D(),title:D(),description:D().nullable(),location:D().nullable(),startTime:D(),endTime:D(),isAllDay:N(),status:Hu,conferenceLink:D().nullable(),conferenceData:Wu.nullable(),attendees:F(Uu).nullable(),organizerEmail:D().nullable()}).extend({meetingId:A().nullable(),hasRecordings:N(),hasAudioFile:N()})),nextCursor:A().nullable(),hasMore:N()}),I({startTime:w().optional(),endTime:w().optional(),limit:V().int().min(1).max(500).default(50),cursor:A().optional()}).refine(e=>e.startTime&&e.endTime?new Date(e.startTime)<new Date(e.endTime):!0,{message:`endTime must be greater than startTime`,path:[`endTime`]}),I({hours:V().int().min(1).max(168).default(24),limit:V().int().min(1).max(50).default(10),cursor:A().optional()}),I({id:A(),reminderEnabled:N(),reminderMinutesBefore:M()}),I({updated:M()}),U.IMAGE_GENERATION,U.PROJECT,U.SANDBOX,U.WEB_SEARCH,U.SKILL,U.SLIDES,U.WORKFLOW;const Ku=e=>Qo(e=>{let t=e;for(;typeof t==`string`;)try{let e=JSON.parse(t);if(e===t)break;t=e}catch{break}return t},L([e,D()])),qu=I({name:D().describe(`Identifier: file path, resource id, URL, or title.`),detail:D().describe(`What it is plus what was done to it or why it matters — detailed enough to act on again.`)});I({overview:D().describe(`1–3 sentences: what this session is about and where it stands now.`),userRequests:Ku(F(D())).describe(`Every distinct thing the user has asked for, in their own framing, oldest → newest. Never drop an ask — even a completed one (record completion in state). Merge near-duplicate or sub-divided asks into a single entry so this list stays bounded across repeated compactions.`),keyFacts:Ku(F(D())).describe(`Durable facts, decisions made, concepts/constraints discovered, and errors with their fixes. Omit facts later turns made obsolete.`),artifacts:Ku(F(qu)).optional().default([]).describe(`Concrete things touched that may need further action: files, resources, documents, datasets, URLs, IDs.`),constraints:Ku(I({preferences:F(D()).describe(`How the user wants output: format, tone, language, style.`),negativeConstraints:F(D()).describe(`What the user explicitly said NOT to do.`)})).describe(`What the user wants and explicitly does not want.`),state:Ku(I({status:z([`pending_input`,`in_progress`,`completed`]).describe(`Overall task state at the point of truncation.`),currentWork:D().describe(`What was actively in progress at truncation, detailed enough to resume immediately.`),nextStep:D().describe(`The single most logical next action. Empty only if genuinely blocked or awaiting the user.`),pendingQuestions:F(D()).describe(`Questions the agent still needs answered to proceed.`)})).describe(`Resumption state — how to pick the work back up seamlessly.`)});const Ju=I({inputTokens:M().optional(),outputTokens:M().optional(),totalTokens:M().optional(),reasoningTokens:M().optional(),cachedInputTokens:M().optional(),cachedCreationTokens:M().optional()});I({modelId:D().optional(),usage:Ju.optional(),totalUsage:Ju.optional(),platformMessageTs:D().optional(),postedMessageTs:F(D()).optional()}),I({id:A(),name:D(),mimeType:D(),size:M(),url:D().optional().describe(`The signed URL for the file, only available if the file is not expired`),expired:N(),createdAt:w(),updatedAt:w()}),I({phase:z([`running`,`done`])});const Yu=z([`step_limit`,`output_limit`]);I({reason:Yu,toolCallIds:F(D()).optional()});const Xu=I({reason:Yu,sourceMessageId:A()}),Zu=new TextEncoder;function Qu(e){try{let t=JSON.stringify(e);return typeof t==`string`?Zu.encode(t).byteLength:null}catch{return null}}const $u=I({sourceMessageId:A(),action:B(`continueConversation`),values:P().refine(e=>{let t=Qu(e);return t!==null&&t<=65536},`Widget interaction values must be JSON and at most 64 KiB`)});I({context:D()}),I({runs:F(I({runId:D(),kind:z([`subagent`,`workflow`]),status:D(),summary:D()}))});const ed=I({system:M(),tools:M(),history:M()});I({totalTokens:M(),breakdown:ed,contextWindowTokens:M().optional(),compactionTriggerTokens:M().optional()});const td=I({text:D(),type:B(`text`)}),nd=I({type:B(`data-widget-interaction`),data:$u}),rd=I({type:B(`data-task-continuation`),data:Xu}),id=I({id:A(),createdAt:$o().optional(),role:B(`user`),parts:L([yo([td]),yo([nd]),yo([rd])])}),ad=I({id:D(),approved:N(),reason:D().optional()}),od=I({type:D().startsWith(`tool-`),toolCallId:D(),state:B(`approval-responded`),input:ao(),approval:ad}),sd=I({type:D().startsWith(`tool-`),toolCallId:D(),state:B(`output-available`),output:ao(),approval:ad.optional()}),cd=I({type:D().startsWith(`tool-`),toolCallId:D(),state:B(`output-error`),errorText:D(),approval:ad.optional()}),ld=I({id:D(),approved:B(!1),reason:D().optional()}),ud=I({type:D().startsWith(`tool-`),toolCallId:D(),state:B(`output-denied`),errorText:D().optional(),approval:ld.optional()}).refine(e=>e.errorText!==void 0||e.approval!==void 0,{message:`An output-denied part must carry the refusal, as errorText or as approval.reason`,path:[`errorText`]});R(`role`,[id,I({id:A(),createdAt:$o().optional(),role:B(`assistant`),parts:F(R(`state`,[od,sd,cd,ud])).min(1)})]);const dd=[`approval-responded`,`output-available`,`output-error`,`output-denied`],fd=[`output-available`,`output-error`,`output-denied`],pd=dd;function md(e){for(let t=e.length-1;t>=0;--t)if(e[t]?.type===`step-start`)return t;return-1}function hd(e){return dd.includes(e)}function gd(e){return fd.includes(e)}function _d(e){return pd.includes(e)}function vd(e){return e?.role===`assistant`?e.parts.filter(l).filter(e=>!e.providerExecuted):[]}function yd(e){if(e?.role!==`assistant`)return[];let t=md(e.parts);return vd({role:e.role,parts:e.parts.slice(t+1)})}function bd(e){return e.type.startsWith(`tool-`)}function xd(e,t){return t.has(e.toolCallId)||bd(e)}function Sd(e){return new Set(yd(e).map(e=>e.toolCallId))}function Cd(e,t){return t(e)?gd(e.state):hd(e.state)}function wd(e,{submittedToolCallIds:t,isClientTool:n}){let r=Sd(e);return vd(e).filter(e=>Cd(e,n)&&!t.has(e.toolCallId)&&xd(e,r))}function Td(e,t){if(e?.role!==`assistant`)return e;let n=wd(e,t);return{id:e.id,role:e.role,parts:n.length>0?n:yd(e).filter(e=>_d(e.state))}}function Ed({messages:e,isClientTool:t,suppressAutomaticSend:n=!1,submittedToolCallIds:r}){if(n)return!1;let i=e.at(-1),a=e=>Cd(e,t);if(yd(i).some(e=>!a(e)))return!1;let o=Sd(i);return vd(i).some(e=>a(e)&&xd(e,o)&&!r.has(e.toolCallId))}function Dd(e){if(e.reason!==void 0)return e.reason;let t=Error(`The operation was aborted.`);return t.name=`AbortError`,t}function Od(e,t){if(!t)return e;let n=()=>Dd(t),r,i,a=()=>{i&&=(t.removeEventListener(`abort`,i),void 0)};return new ReadableStream({start(a){if(i=()=>{a.error(n()),(r??e).cancel(n()).catch(()=>{})},t.aborted){i();return}t.addEventListener(`abort`,i,{once:!0})},async pull(n){r??=e.getReader();try{let{done:e,value:t}=await r.read();if(e){n.close(),a();return}n.enqueue(t)}catch(e){t.aborted||n.error(e),a()}},cancel(t){a(),(r??e).cancel(t).catch(()=>{})}})}const kd={schemaVersion:B(2),siteKey:D().min(1),assetId:A(),title:D()};R(`state`,[I({...kd,state:B(`working`),revision:D().min(1)}),I({...kd,state:B(`saved`),versionId:A(),versionNumber:M().int().positive()})]);const Ad=z([`pending`,`generating`,`ready`,`error`]),jd=I({page:M().int().positive(),heading:D(),status:Ad,version:M().int().nonnegative().default(0),imageUrl:D().optional(),assetId:D().optional(),note:D().optional()});I({deckId:D().min(1),title:D(),style:D(),aspectRatio:D(),status:z([`generating`,`partial`,`ready`]),outputs:I({pdfUrl:D().optional(),pptxUrl:D().optional(),pdfAssetId:D().optional(),pptxAssetId:D().optional()}).default({}),slides:F(jd)});const Md=I({slideId:A(),position:M().int().positive(),heading:D(),status:Ad,note:D().optional()}),Nd={schemaVersion:B(2),deckKey:D().min(1),assetId:A(),title:D(),style:D(),aspectRatio:D(),slides:F(Md)};R(`state`,[I({...Nd,state:B(`working`),revision:D().min(1)}),I({...Nd,state:B(`saved`),versionId:A(),versionNumber:M().int().positive()})]),I({data:I({assetId:A(),versionId:A(),versionNumber:M().int().positive(),title:D(),style:D(),aspectRatio:D(),slides:F(I({slideId:A(),position:M().int().positive(),heading:D(),imageUrl:j()})),pdfUrl:j(),pptxUrl:j().optional()})});const Pd=[`slack`,`teams`],Fd=[`active`,`inactive`,`needs_reauth`],Id=z(Pd),Ld=z(Fd),Rd=I({id:A(),platform:Id,platformWorkspaceId:D(),platformWorkspaceName:D(),botUserId:D(),status:Ld,autoBindEnabled:N(),createdAt:w(),updatedAt:w()});I({platform:Id.optional(),limit:V().int().min(1).max(100).default(20),cursor:A().optional()}),I({installations:F(Rd),nextKey:D().optional()}),I({status:z([`active`,`inactive`]).optional()});const zd=I({id:A(),workspaceInstallationId:A(),platform:Id,platformWorkspaceName:D(),platformUserId:D(),createdAt:w()});I({installations:F(zd)}),I({workspaceInstallation:Rd.nullable(),userInstallation:zd.nullable(),canManageChatbot:N()}).extend({installUrl:j().nullable()}),I({userInstallation:zd}),I({autoBindEnabled:N()}),I({workspaceInstallation:Rd}),I({bindings:F(I({id:A().nullable(),workspaceInstallationId:A().nullable(),userId:A(),userName:D(),userEmail:k(),platformUserId:D().nullable(),createdAt:w().nullable(),updatedAt:w().nullable()})),total:M().int().nonnegative()}),ts.extend({search:D().trim().max(200).optional()}),I({authorizeUrl:D()});const Bd=2048,Vd=z([`self`,`anyone`]),Hd=I({id:A(),platform:Id,userInstallationId:A(),platformChannelId:D(),channelName:D().nullable(),platformThreadId:D().nullable(),keyword:D().nullable(),triggerScope:Vd,agentId:A().nullable(),agentName:D().nullable(),sourceKeywordListenerIds:F(A()),taskId:A().nullable(),titlePreview:D().nullable(),threadUrl:j().nullable(),lastInteractedAt:w().nullable(),enabled:N(),createdAt:w(),updatedAt:w()});I({installationId:A().optional()}),I({listeners:F(Hd)}),I({installationId:A(),platformChannelId:D().trim().min(1).max(Bd).regex(/^(?:(?:slack:)?[CG][A-Z0-9]+|teams:[A-Za-z0-9_-]+:[A-Za-z0-9_-]+)$/u,`Must be a valid Slack or Microsoft Teams channel id.`),keyword:D().trim().min(1).max(200),triggerScope:Vd.optional(),agentId:A().nullable().optional()}),I({listener:Hd}),I({keyword:D().trim().min(1).max(200).optional(),triggerScope:Vd.optional(),agentId:A().nullable().optional(),enabled:N().optional()}).refine(e=>e.keyword!==void 0||e.triggerScope!==void 0||e.agentId!==void 0||e.enabled!==void 0,{message:`At least one field must be provided`}),I({installationId:A(),platformChannelId:D().trim().min(1).max(Bd),keyword:D().trim().min(1).max(200)}),I({count:M().int().nonnegative()}),I({installationId:A()}),I({channels:F(I({id:D(),name:D(),isPrivate:N()}))}),I({}).optional(),I({ok:B(!0),messageTs:D()}),I({olderThanDays:M().int().min(1).max(365).default(14).optional()}).optional(),I({deletedCount:M().int().min(0)});const Ud=z([`enabled`,`disabled`]);I({items:F(I({agentId:A(),agentName:D(),status:Ud,capReached:N(),connectorNames:F(D())}))}),I({items:F(I({agentId:A(),agentName:D(),connectorNames:F(D())}))}),I({agentId:A()}),I({archiveContext:Zo().optional()}),I({activeConversationCount:M().int(),suppressedListenerCount:M().int()});const Wd=D().regex(/^\d+\.\d+\.\d+(?:[-+][\w.-]+)?$/),Gd=I({minSupportedVersion:Wd,latestVersion:Wd});I({ios:Gd,android:Gd});const q=`usage_audit__`,Kd={GET_DAILY_SUMMARY:`${q}get_daily_summary`,GET_MONTHLY_COSTS:`${q}get_monthly_costs`,GET_USER_BREAKDOWN:`${q}get_user_breakdown`,GET_USER_DAILY_TREND:`${q}get_user_daily_trend`,FIND_USAGE_DROPS:`${q}find_usage_drops`,FIND_STALE_SCHEDULES:`${q}find_stale_schedules`,GET_SCHEDULE_TOOL_CALLS:`${q}get_schedule_tool_calls`,GET_COST_RANKING:`${q}get_cost_ranking`,GET_WORKSPACE_TOTALS:`${q}get_workspace_totals`},qd=`subagent__`,Jd={SPAWN:`${qd}spawn`,GET_RUN:`${qd}get_run`},Yd=[`browser__`,`task__`,`project__`,`asset__`,`agent__`,`connector__`,`filesystem__`,`image__`,`meeting__`,`memory__`,`sandbox__`,`schedule__`,`skill__`,`slides__`,`tool_result__`,`meta_tool__`,q,`audit_log__`,qd,`ui__`,`web__`,`workflow__`].map(e=>e.slice(0,-2)),Xd=z([`pat`,`oauth`,`dcard-dual`,`google-iap`,`credentials`,`mcp-oauth`,`composio`]),Zd=/^[a-z][a-z0-9-]*$/,Qd=[`pat`,`credentials`],$d=I({key:D().regex(Zd).max(32),label:D().min(1).max(50),description:D().max(200).optional(),placeholder:D().max(100).optional(),required:N()}),ef=F($d).max(10).refine(e=>new Set(e.map(e=>e.key)).size===e.length,{message:`config field keys must be unique`});xo(D().regex(Zd).max(32),D().min(1).max(256).regex(/^[\u0020-\u007E]*$/,`must be printable ASCII`));const tf={pat:!1,oauth:!0,"dcard-dual":!0,"google-iap":!0,credentials:!1,"mcp-oauth":!0,composio:!0};function nf(e){let t=Xd.safeParse(e);return t.success&&tf[t.data]}const rf=z([`pending`,`running`,`failed`]),af=z([`pending`,`in_review`,`approved`,`rejected`]),of=I({name:D(),isMe:N()}),sf=I({id:D(),name:D(),configured:N(),builtIn:N()}),cf=I({type:Xd,tutorial:D().optional(),configFields:F($d).optional(),provider:sf.optional().describe(`The OAuth provider, only present for OAuth authorization`)});I({iconId:A(),url:j()}),I({connectors:F(I({id:A(),name:D(),description:D(),provider:D().nullable().describe(`The provider of the connector, either EntryDesk (for built-in connectors) or Workspace name`),author:I(of.shape).optional().describe(`The author of the connector, not available for built-in connectors`),connected:N().describe(`Whether the user has connected the connector to the workspace`),iconUrl:D().optional().describe(`The URL of the connector icon`),team:I({id:A(),name:D()}).optional().describe(`The team this connector is published to, only present when createdBy is team`),hasPermission:N().describe(`Whether the user has permission to use the connector`),added:N().describe(`Whether the connector has a workspace_connectors record. Without one it has no tool registry, so the per-connector tool endpoints answer 404`),hasWorkspaceToken:N().describe(`Whether the workspace has a workspace token configured for this connector`),tokenMode:z([`personal`,`workspace`]).describe(`Token mode: personal (each member connects) or workspace (admin provides shared token)`),reviewStatus:af.optional().describe(`The review status of the connector, not available for built-in connectors`),authorization:cf.optional(),versionNumber:M().int().nullable(),myRole:G,createdAt:w(),updatedAt:w()})),nextKey:D().optional()}),es.extend({reviewStatus:af.optional().describe(`Filter connectors by review status (only applies to custom connectors)`),includeNotAdded:L([B(`true`).transform(()=>!0),B(`false`).transform(()=>!1),N()]).optional().describe(`Include connectors that have not been added to the workspace (no workspace_connectors record)`),type:z(dc).optional().describe(`Filter connectors by type`),sortBy:z(lc).optional()}).refine(e=>!(e.type===uc.BUILT_IN&&e.reviewStatus),{message:`reviewStatus parameter is not applicable when type is built_in`,path:[`reviewStatus`]}),es.extend({createdBy:z([`workspace`,`team`,`me`]).optional(),teamId:A().optional(),connectionStatus:z([`all`,`connected`]).optional().default(`all`).describe(`Filter connectors by connection status`),strict:L([B(`true`).transform(()=>!0),B(`false`).transform(()=>!1),N()]).optional().default(!0).describe(`Whether to filter out connectors that the user does not have permission to use`),search:D().trim().max(200).optional().describe(`Search connectors by name using SQL LIKE query`),connectorIds:L([A(),F(A())]).optional().transform(e=>{if(e!==void 0)return Array.isArray(e)?e:[e]}).describe(`Filter connectors by specific IDs`),sortBy:z(lc).optional()}).refine(e=>!e.teamId||e.createdBy===`team`,{message:`teamId can only be used with createdBy: team`,path:[`teamId`]});const lf=I({id:D(),name:D()}),uf=I({id:A()}).nullable();I({connectors:F(I({id:A(),type:z(dc),name:D(),description:D(),provider:D().describe(`The provider of the connector, either EntryDesk (for built-in connectors) or Workspace name`),iconUrl:D().optional().describe(`The URL of the connector icon`),author:of.optional().describe(`The author of the connector, not available for built-in connectors`),roles:F(lf).describe(`The roles of the user who has access to the connector`),executionStatus:rf.optional().describe(`The execution status of the connector, not available for built-in connectors`),reviewStatus:af.optional().describe(`The review status of the connector, not available for built-in connectors`),hasWorkspaceToken:N().describe(`Whether the workspace has a workspace token configured for this connector`),tokenMode:z([`personal`,`workspace`]).describe(`Token mode: personal (each member connects) or workspace (admin provides shared token)`),added:N().describe(`Whether the connector has been added to the workspace`),toolPrefix:D().optional().describe(`The prefix of the tool name, available when the connector is added to the workspace`),authorization:cf.optional().describe(`The authorization of the connector.`),publish:uf,myRole:G,createdAt:w(),updatedAt:w()})),nextKey:D().optional()});const df=z([`pat`,`oauth`,`google-iap`,`credentials`,`mcp-oauth`]),ff=I({type:df,provider:D().optional(),scopes:F(D()).optional(),tutorial:D().optional(),configFields:F($d).optional()}),pf=I({type:df,provider:D().optional(),scopes:F(D()).optional(),tutorial:j().max(100).optional(),configFields:ef.optional()}).refine(e=>e.type===`oauth`||e.type===`google-iap`?e.provider!==void 0&&e.scopes!==void 0:!0,{message:`provider and scopes are required when type is oauth or google-iap`,path:[`provider`,`scopes`]}).refine(e=>!(e.tutorial&&![`pat`,`credentials`].includes(e.type)),{message:`tutorial is only allowed for PAT and CREDENTIALS authorization types`,path:[`tutorial`]}).refine(e=>!(e.configFields?.length&&!Qd.some(t=>t===e.type)),{message:`configFields is only allowed for PAT and CREDENTIALS authorization types`,path:[`configFields`]}),mf=/^[A-Za-z0-9\s]+$/u,hf=/^[a-z0-9_-]+$/u;function gf(e){return e.toLowerCase().replaceAll(/\s+/gu,`_`)}const _f=z([`streamable_http`,`sse`]);I({id:A(),type:B(uc.CUSTOM_REMOTE_URL),name:D(),description:D(),url:D(),transport:_f,toolPrefix:D(),author:of.optional(),authorization:ff.optional(),executionStatus:rf.optional(),reviewStatus:af.optional(),createdAt:w(),updatedAt:w(),iconId:A().nullable().optional(),iconUrl:D().optional(),publish:I({id:A()}).nullable(),myRole:G}),I({id:A(),type:B(uc.CUSTOM_REMOTE_URL),name:D(),description:D(),transport:_f,url:D(),executionStatus:rf,reviewStatus:af,toolPrefix:D(),createdAt:w(),updatedAt:w()}),I({type:B(uc.CUSTOM_REMOTE_URL),name:D().min(1),description:D().min(1),transport:_f,url:j(),toolPrefix:D().describe(`The tool prefix for the connector`),authorization:pf.optional().nullable(),iconId:A().nullable().optional()}).superRefine((e,t)=>{Yd.includes(e.toolPrefix)&&t.addIssue({code:`custom`,message:`Tool prefix "${e.toolPrefix}" is reserved for a built-in EntryDesk tool namespace`,path:[`toolPrefix`]})});const vf=[`composio`,`mcp`],yf=[`stdio`,`sse`,`streamable_http`];_f.options;const bf=Xd.exclude([`composio`]);bf.options;const xf=[`pat`,`credentials`];I({items:F(I({id:A(),name:D(),description:D(),iconUrl:D().nullable(),kind:z(vf),toolkit:D().nullable(),transport:z(yf),authorizationType:Xd.nullable(),createdAt:w()}))});const Sf=I({kind:B(`composio`),name:D().min(1).max(100),description:D().min(1),toolkit:D().min(1),tools:F(D().min(1)).optional(),extraTools:F(D().min(1)).optional(),composioAuthConfigId:D().min(1).optional()}),Cf=I({kind:B(`mcp`),name:D().min(1).max(100),description:D().min(1),url:j(),transport:_f,authorization:I({type:bf,provider:D().min(1).optional(),scopes:F(D().min(1)).optional(),tutorial:j().max(100).optional(),configFields:ef.optional()}).optional()}).refine(e=>e.authorization?.type!==`oauth`||e.authorization.provider!==void 0&&e.authorization.scopes!==void 0,{message:`provider and scopes are required when type is oauth`,path:[`authorization`]}).refine(e=>!e.authorization?.tutorial||xf.some(t=>t===e.authorization?.type),{message:`tutorial is only allowed for pat and credentials authorization types`,path:[`authorization`,`tutorial`]}).refine(e=>!e.authorization?.configFields?.length||Qd.some(t=>t===e.authorization?.type),{message:`configFields is only allowed for pat and credentials authorization types`,path:[`authorization`,`configFields`]});I({toolkit:D().min(1)});const wf=I({name:D(),mode:D(),scopes:F(D())});I({slug:D(),name:D(),managedAuthSchemes:F(D()),auths:F(wf)}),R(`kind`,[Sf,Cf]);const Tf={en:{authLink:[`auth`,`oauth`,`authorize`,`authorization`,`connect`,`login`,`sign in`,`sign-in`,`signin`],authGlossVerbs:[`authorize`,`connect`,`login`,`sign in`,`sign-in`,`signin`],placement:[`button`,`buttons`,`link`,`links`,`click`,`below`,`following`]},"zh-TW":{authLink:[`授權`,`授权`,`連接`,`连接`,`認證`,`认证`,`登入`,`登录`],authGlossVerbs:[`授權`,`授权`,`連接`,`连接`,`認證`,`认证`,`登入`,`登录`],placement:[`按鈕`,`按钮`,`連結`,`链接`,`點擊`,`点击`,`下方`,`以下`]},de:{authLink:[`autorisieren`,`autorisierung`,`verbinden`,`anmelden`,`login`],authGlossVerbs:[`autorisieren`,`verbinden`,`anmelden`,`login`],placement:[`schaltfläche`,`schaltflächen`,`button`,`buttons`,`link`,`links`,`klicken`,`unten`,`folgende`,`folgenden`]},fr:{authLink:[`autoriser`,`autorisation`,`connecter`,`connexion`,`login`,`se connecter`],authGlossVerbs:[`autoriser`,`connecter`,`connexion`,`login`,`se connecter`],placement:[`bouton`,`boutons`,`lien`,`liens`,`cliquer`,`cliquez`,`ci-dessous`,`suivant`,`suivants`]},"es-ES":{authLink:[`autorizar`,`autorización`,`conectar`,`conexión`,`iniciar sesión`,`login`],authGlossVerbs:[`autorizar`,`conectar`,`iniciar sesión`,`login`],placement:[`botón`,`botones`,`enlace`,`enlaces`,`clic`,`haz clic`,`hacer clic`,`abajo`,`siguiente`,`siguientes`]},"es-419":{authLink:[`autorizar`,`autorización`,`conectar`,`conexión`,`iniciar sesión`,`login`],authGlossVerbs:[`autorizar`,`conectar`,`iniciar sesión`,`login`],placement:[`botón`,`botones`,`enlace`,`enlaces`,`clic`,`haz clic`,`hacer clic`,`abajo`,`siguiente`,`siguientes`]},ja:{authLink:[`認可`,`承認`,`認証`,`接続`,`ログイン`],authGlossVerbs:[`認可`,`承認`,`認証`,`接続`,`ログイン`],placement:[`ボタン`,`リンク`,`クリック`,`下`,`以下`,`次`]},ko:{authLink:[`인증`,`승인`,`권한`,`연결`,`로그인`],authGlossVerbs:[`인증`,`승인`,`연결`,`로그인`],placement:[`버튼`,`링크`,`클릭`,`아래`,`다음`]},it:{authLink:[`autorizza`,`autorizzare`,`autorizzazione`,`connetti`,`connettere`,`accesso`,`login`],authGlossVerbs:[`autorizza`,`autorizzare`,`connetti`,`connettere`,`accedi`,`login`],placement:[`pulsante`,`pulsanti`,`link`,`collegamento`,`collegamenti`,`clic`,`fare clic`,`sotto`,`seguente`,`seguenti`]},"pt-BR":{authLink:[`autorizar`,`autorização`,`conectar`,`conexão`,`entrar`,`login`],authGlossVerbs:[`autorizar`,`conectar`,`entrar`,`login`],placement:[`botão`,`botões`,`link`,`links`,`clicar`,`clique`,`abaixo`,`seguinte`,`seguintes`]}},Ef=/[.*+?^${}()|[\]\\]/g;function Df(e){return e.replace(Ef,`\\$&`)}function Of(e){let t=new Set,n=[];for(let r of e){let e=r.trim();e.length>0&&!t.has(e)&&(t.add(e),n.push(e))}return n}function kf(e){return Of(Object.values(Tf).flatMap(t=>t[e]))}function Af(e){let t=kf(e).toSorted((e,t)=>t.length-e.length).map(Df).join(`|`);return new RegExp(t,`iu`)}function jf(){let e=kf(`authGlossVerbs`).toSorted((e,t)=>t.length-e.length).map(Df).join(`|`);return RegExp(`^(?:${e})(?=\\s|$|[^\\p{Letter}\\p{Number}])`,`iu`)}Af(`authLink`),Af(`placement`),jf(),I({toolkit:D(),tools:F(D()).optional(),extraTools:F(D()).optional()}),I({search:D().trim().max(200).optional(),status:z(Mc).optional(),nextKey:D().optional(),limit:V().int().min(1).max(100).default(20),sortBy:z(lc).optional()}),I({connectors:F(I({id:A(),name:D(),iconUrl:D().optional(),hasUnpublishedChanges:N(),latestVersionNumber:M().int().nullable(),publishedTo:Tc.optional(),myRole:G,createdAt:w(),updatedAt:w()})),nextKey:D().optional(),totalCount:M().int().nonnegative(),statusCounts:Nc});const Mf=z([`user_configurable`,`need_approval`,`block`]),Nf=z([`need_approval`,`always_allow`]),Pf=I({id:A(),name:D(),toolName:D(),description:D(),workspacePolicy:Mf,userPolicy:Nf.nullable()});I({tools:F(Pf)}),I({tools:F(Pf.extend({schedulePolicy:rl.nullable()}))});const Ff=z([`saas`,`on-premises`]),If=z([`mobile_to_desktop`,`desktop_to_mobile`]),Lf=z([`project`,`task`,`asset`,`asset_conflict`]);I({direction:B(`mobile_to_desktop`),target:I({kind:z([`project`,`task`]),id:A()})}),I({workspaceId:A()}),I({workspaceId:A(),notificationId:A()}),I({path:D(),value:P().optional()});const Rf=z([`scheduled`,`in_progress`,`completed`,`cancelled`]),zf=z([`manual`,`calendar`,`recording`]),Bf=z([`local`,`upload`,`zoom`,`youtube`,`media`,`bot`]),Vf=z([`pending`,`extracting_subtitles`,`downloading`,`transcribing`,`refining`,`completed`,`failed`]),Hf=z([`recall`]),Uf=z([`scheduled`,`joining`,`in_call`,`recording`,`done`,`failed`,`removed`]),Wf=z([`manual`,`api`,`connector`,`calendar_subscription`]),Gf=z([`idle`,`queued`,`generating`,`completed`,`failed`]),Kf=z([`generated`,`import`,`user_edit`,`restore`,`migration`]),qf=I({type:z([`hangoutsMeet`,`zoom`,`teams`,`webex`,`other`]),uri:D().optional(),label:D().optional()}),Jf=I({email:D(),displayName:D().nullable().optional(),role:z([`organizer`,`attendee`,`optional`]).optional(),responseStatus:z([`needsAction`,`declined`,`tentative`,`accepted`]).nullable().optional(),userId:A().nullable().optional()}),Yf=I({start:M(),end:M(),text:D()}),Xf=xo(D().regex(/^[A-Z0-9]{1,2}$/u),D().trim().min(1).max(100).regex(/^[^\r\n]+$/u)),Zf=I({description:D(),assignee:D().nullable().optional(),dueDate:D().nullable().optional(),completed:N()}),Qf=z([`private`,`workspace`]),$f=z([`viewer`,`editor`]),ep=z([`owner`,`editor`,`viewer`]),tp=z([`explicit`,`workspace`]),np=I({userId:A(),userName:D(),userEmail:k(),userImage:D().nullable().optional(),role:$f,grantedBy:A().nullable(),createdAt:w()}),rp=I({teamId:A(),teamName:D(),memberCount:M(),role:$f,grantedBy:A().nullable(),createdAt:w()});I({visibility:Qf,userGrants:F(np),teamGrants:F(rp)}),I({role:$f}),I({title:D().trim().min(1).max(500),description:D().optional(),location:D().optional(),startTime:w().optional(),endTime:w().optional(),conferenceLink:j().optional(),conferenceData:qf.optional(),calendarEventId:A().optional(),notes:D().optional()}),I({title:D().trim().min(1).max(500).optional(),description:D().nullable().optional(),location:D().nullable().optional(),startTime:w().nullable().optional(),endTime:w().nullable().optional(),status:Rf.optional(),conferenceLink:j().nullable().optional(),conferenceData:qf.nullable().optional(),notes:D().nullable().optional(),summary:D().nullable().optional(),calendarEventId:A().nullable().optional(),visibility:Qf.optional()});const ip=I({processedChunks:M().int().nonnegative(),totalChunks:M().int().positive()}),ap=z([`preparing`,`queued`,`transcribing`,`validating`,`finalizing`,`falling_back`]),op=I({percentage:M().int().min(0).max(100),batchStage:ap.optional(),batchStartedAt:w().optional(),batchElapsedSeconds:M().int().nonnegative().optional()}),sp=I({provisionalCoverageRatio:M().min(0).max(1),finalTranscription:ip}),cp=I({transcript:D(),transcriptWithTimestamps:D(),segments:F(Yf),summary:D().nullable(),actionItems:F(Zf).nullable().optional(),generatedAt:w(),stability:I({coverageRatio:M().min(0).max(1),eligible:N(),failedChunkCount:M().int().nonnegative(),maxGapSec:M().nonnegative(),missingRangeCount:M().int().nonnegative(),pendingChunkCount:M().int().nonnegative(),reason:D()})}),lp=cp.pick({summary:!0,actionItems:!0});I({id:A(),uploadedBy:A(),meetingId:A(),title:D(),duration:M().nullable(),transcript:D().nullable(),transcriptWithTimestamps:D().nullable(),segments:F(Yf).nullable(),speakerNames:Xf,transcriptRevision:M().int().nonnegative(),needsSummaryRefresh:N(),isSummaryStale:N(),summary:D().nullable(),actionItems:F(Zf).nullable(),summaryStatus:Gf,audioStorageKey:D().nullable(),processingStatus:Vf.nullable(),processingProgress:op.nullable().optional(),hybridProgress:sp.nullable().optional(),provisionalResult:cp.nullable().optional(),transcriptionProgress:ip.nullable().optional(),recordedAt:w().nullable(),createdAt:w(),updatedAt:w()});const up=I({id:A(),title:D(),duration:M().nullable(),hasSummary:N(),hasTranscript:N(),canRetry:N().optional(),needsSummaryRefresh:N(),isSummaryStale:N(),summary:D().nullable().optional(),actionItems:F(Zf).nullable().optional(),summaryStatus:Gf,source:Bf.nullable().optional(),processingStatus:Vf.nullable(),processingProgress:op.nullable().optional(),hybridProgress:sp.nullable().optional(),provisionalResult:lp.nullable().optional(),transcriptionProgress:ip.nullable().optional(),recordedAt:w().nullable(),createdAt:w(),updatedAt:w().optional()}),dp=z([`transcript`,`summary`]),fp=I({id:A(),name:D()}),pp=I({id:A(),versionNumber:M().int().nonnegative(),origin:Kf,restoredFromVersionId:A().nullable(),createdBy:fp.nullable(),createdAt:w(),excerpt:D().nullable()});I({contentType:dp,currentVersionId:A().nullable(),canRestore:N(),versions:F(pp),nextVersionNumber:M().int().nonnegative().nullable()});const mp=pp.omit({excerpt:!0});R(`contentType`,[mp.extend({contentType:B(`transcript`),transcript:D().nullable(),transcriptWithTimestamps:D().nullable(),rawTranscript:D().nullable(),segments:F(Yf).nullable(),speakerNames:Xf}),mp.extend({contentType:B(`summary`),summary:D(),actionItems:F(Zf).nullable(),sourceTranscriptRevision:M().int().nonnegative().nullable()})]),I({expectedHeadVersionId:A()}),I({currentVersionId:A().nullable(),canRestore:N(),versions:F(pp),nextVersionNumber:M().int().positive().nullable()}),mp.extend({summary:D(),actionItems:F(Zf).nullable(),sourceRecordingSummaryVersionIds:F(A())});const hp=I({id:A(),meetingRecordingId:A().nullable(),provider:Hf,meetingUrl:D(),botName:D().nullable(),status:Uf,statusDetail:D().nullable(),dispatchSource:Wf,joinedAt:w().nullable(),endedAt:w().nullable(),recordingReadyAt:w().nullable(),createdAt:w(),updatedAt:w()});I({relatedActiveBot:I({meetingId:A(),status:Uf,dispatchedAt:w(),dispatchedBy:I({id:A(),name:D().nullable()}).nullable(),canAccess:N()}).nullable()});const gp=z([`all`,`matching_rules`,`none`]),_p=I({field:z([`meeting_type`,`meeting_title`]),matchType:z([`is`,`is_not`,`contains`,`does_not_contain`]),value:D().trim().min(1).max(200)}).superRefine((e,t)=>{if(e.field===`meeting_type`){e.matchType!==`is`&&e.matchType!==`is_not`&&t.addIssue({code:`custom`,path:[`matchType`],message:`meeting_type conditions must use is / is_not`}),e.value!==`internal`&&e.value!==`external`&&t.addIssue({code:`custom`,path:[`value`],message:`meeting_type conditions must match internal / external`});return}e.matchType!==`contains`&&e.matchType!==`does_not_contain`&&t.addIssue({code:`custom`,path:[`matchType`],message:`meeting_title conditions must use contains / does_not_contain`})});I({settings:I({recorderAgentName:D().trim().min(1).max(100),recordingPolicy:gp,conditions:F(_p).max(20)}).superRefine((e,t)=>{e.recordingPolicy===`matching_rules`&&e.conditions.length===0&&t.addIssue({code:`custom`,path:[`conditions`],message:`matching_rules requires at least one condition`})}).nullable(),hasCalendarAccounts:N()}),I({policyVersion:D(),segmentSeconds:M().int().positive(),minFlushSegmentSeconds:M().positive(),maxSegmentDurationSeconds:M().int().positive(),idlePollIntervalMs:M().int().positive(),pendingPollBackoffIntervalsMs:F(M().int().positive()).min(1),pendingPollIntervalMs:M().int().positive(),pollJitterRatio:M().min(0).max(1),uploadTimeoutMs:M().int().positive(),liveTranscriptionModelTimeoutMs:M().int().positive(),maxQueuedSegments:M().int().positive(),maxPendingChunks:M().int().positive(),maxUploadBytes:M().int().positive(),displayLagSeconds:M().nonnegative(),timelineCatchUpIntervalMs:M().int().positive(),timelineGapRevealAheadChunks:M().int().nonnegative(),timelineMaxBurstSegments:M().int().positive(),timelineMaxDisplaySegmentDurationSeconds:M().positive(),timelineMinDisplaySegmentDurationSeconds:M().positive(),timelineTypingCriticalBacklogChars:M().int().positive(),timelineTypingCriticalCharsPerSecond:M().int().positive(),timelineTypingHighBacklogChars:M().int().positive(),timelineTypingHighBacklogCharsPerSecond:M().int().positive(),timelineTypingLowBacklogChars:M().int().positive(),timelineTypingLowBacklogCharsPerSecond:M().int().positive(),timelineTypingNormalCharsPerSecond:M().int().positive(),timelineTypingRevealTickMs:M().int().positive()});const vp=I({userId:A(),name:D().nullable(),email:D(),image:D().nullable().optional()});I({id:A(),workspaceId:A(),createdBy:A(),owner:vp.optional(),calendarEventId:A().nullable(),title:D(),description:D().nullable(),location:D().nullable(),startTime:D().nullable(),endTime:D().nullable(),status:Rf,source:zf,conferenceLink:D().nullable(),conferenceData:qf.nullable(),notes:D().nullable(),summary:D().nullable(),actionItems:F(Zf).nullable().optional(),calendarEvent:I({title:D(),providerEventId:D(),calendarId:D(),provider:z([`google`,`outlook`,`caldav`]),providerCalendarId:D(),startTime:D(),endTime:D()}).nullable(),participants:F(Jf).optional(),recordings:F(up).optional(),hasEverRecorded:N().optional(),meetingBots:F(hp).optional(),isOwner:N().optional(),sharedVia:tp.optional(),visibility:Qf,myRole:ep.optional(),createdAt:w(),updatedAt:w()});const yp=I({id:A(),title:D(),sortTime:D(),createdAt:w(),updatedAt:w(),startTime:D().nullable(),endTime:D().nullable(),status:Rf.nullable(),source:zf.nullable(),conferenceLink:D().nullable(),hasRecordings:N(),hasNotes:N().optional(),hasEverRecorded:N().optional(),participantCount:M().nullable(),isOwner:N(),myRole:ep,owner:vp.optional(),sharedVia:tp.optional(),isSharedWithOthers:N().optional(),duration:M().nullable(),hasTranscript:N(),hasSummary:N(),summaryStatus:Gf,recordingSource:Bf.nullable(),processingStatus:Vf.nullable(),hasActiveMeetingBot:N().optional(),activeMeetingBot:hp.optional()}),bp=I({meetingId:D(),userId:D(),userName:D(),userEmail:D(),userImage:D().nullable().optional(),createdAt:w()});I({recordings:F(up),nextKey:D().optional()}),I({meetings:F(yp),nextKey:D().optional()}),I({shares:F(bp)}),I({meetings:F(I({id:D(),title:D(),startTime:D().nullable()}))}),I({photos:xo(D(),D())}),I({previous:I({meetingId:A(),title:D(),startTime:D().nullable(),summary:D(),actionItems:F(Zf)}).nullable()}),es.extend({search:D().trim().max(200).optional(),filter:z([`mine`,`shared`,`all`]).default(`all`),sortBy:z([`updated_at`,`start_time`]).default(`updated_at`),hasContent:Zo().optional(),hasActiveMeetingBot:Zo().optional()});function xp(e){return e.summary?e.summary:e.recordings?.find(e=>e.summary)?.summary||e.recordings?.find(e=>e.provisionalResult?.summary)?.provisionalResult?.summary}const Sp=[`chatgpt`,`claude`],Cp={chatgpt:{modelProvider:`chatgpt-subscription`,modelIdPrefix:`chatgpt-sub/`,connectionFlow:`device-code`},claude:{modelProvider:`claude-subscription`,modelIdPrefix:`claude-sub/`,connectionFlow:`authorization-code`}},wp=z(Sp);I({connections:F(I({provider:wp,status:z([`pending`,`connected`,`expired`,`error`]),accountLabel:D().nullable(),plan:D().nullable(),lastError:D().nullable(),connectedAt:w().nullable()})),connectableProviders:F(wp)}),R(`connectionFlow`,[I({userCode:D(),verificationUrl:j(),expiresAt:w(),pollIntervalSeconds:M().int().positive()}).extend({connectionFlow:B(`device-code`)}),I({connectionFlow:B(`authorization-code`),authorizationUrl:j(),expiresAt:w()})]),I({code:D().trim().min(1).max(4096)}),I({models:F(I({id:D(),name:D(),provider:wp}))});const Tp=[...xu,`azure-openai`],Ep=Sp.map(e=>Cp[e].modelProvider),Dp=[...Tp,...Ep];function Op(e){return Cu.filter(t=>t.provider===e).map(e=>e.id)}Op(`openai`),Op(`anthropic`),Op(`vertex-anthropic`),Op(`vertex-google`),Op(`google`),Op(`openrouter`),Op(`selfhosted`);const kp=[`chatgpt-sub/gpt-5.6-sol`,`chatgpt-sub/gpt-5.6-terra`,`chatgpt-sub/gpt-5.6-luna`,`chatgpt-sub/gpt-5.5`,`claude-sub/opus-5`,`claude-sub/sonnet-5`,`claude-sub/haiku-4-5`],Ap=[`chatgpt-pool/gpt-5.6-sol`,`chatgpt-pool/gpt-5.6-terra`,`chatgpt-pool/gpt-5.6-luna`,`chatgpt-pool/gpt-5.5`],jp=Cu.map(e=>e.id);function Mp(e){return e.startsWith(`azure-`)}const Np=[`lite`,`pro`,`max`],Pp=[`image`,`image-lite`],Fp=[`functionality`],Ip=[...Np,...Pp,...Fp],Lp=L([z(jp),z(Np),D().refine(e=>Mp(e)),z(kp),z(Ap)]),Rp=L([Lp,B(`auto`)]),zp=I({id:D(),name:D(),shortName:D().optional(),description:D(),shortDescription:D().optional(),enabled:N().optional(),tags:F(D()).optional()});I({models:F(zp)}),I({tiers:F(I({tier:D(),model:zp.optional()}))}),I({modelId:D()}),I({providers:F(I({id:D(),name:D(),baseUrl:D().nullable().optional(),verified:N(),models:F(I({id:D(),name:D(),enabled:N().optional(),additional:N().optional()})),options:xo(D(),ao()).optional()}))}),I({models:F(I({id:D(),name:D(),provider:z(Dp),supportsChat:N(),supportsImageGeneration:N(),availableForAdvanced:N()}))}),I({tiers:F(I({tier:z(Ip),modelId:D(),fallbackModelId:D().nullable()}))}),I({tier:z(Ip)}),I({modelId:D().min(1),fallbackModelId:D().min(1).nullable().optional()});const Bp=Object.values({AGENT:`agent`,SKILL:`skill`}),Vp={ROLE:`role`,BADGE:`badge`,USE_CASE:`use_case`},Hp=Object.values(Vp),Up=I({speaker:z([`user`,`assistant`]),text:D()}),Wp=I({id:A(),name:D(),provider:D(),iconUrl:D().nullable(),purpose:D()}),Gp=I({tag:D(),category:z(Hp),label:D()}),Kp=I({slug:D(),type:z(Bp),name:D(),description:D(),iconUrl:D().nullable(),tags:F(Gp)}),qp=D().optional().transform(e=>os(e));I({type:z(Bp).optional(),tag:D().optional(),limit:V().int().min(1).max(100).default(30),cursor:D().optional(),lang:qp}),I({items:F(Kp),nextCursor:D().nullable()}),R(`type`,[I({slug:D(),type:B(`agent`),name:D(),description:D(),iconUrl:D().nullable(),tags:F(Gp),starterPrompts:F(D()),exampleConversation:F(Up),connectors:F(Wp)}),I({slug:D(),type:B(`skill`),name:D(),description:D(),iconUrl:D().nullable(),tags:F(Gp),exampleConversation:F(Up)})]),I({items:F(I({tag:D(),name:D(),tagline:D()}))}),I({toolApprovalMode:Jc.optional()}).default({}),I({resourceId:A(),resourceType:z(Bp),workspaceId:A(),taskId:A().nullable(),resourceSlug:D()}),I({type:z(Bp),slug:D().min(1)}),I({lang:qp});const Jp=/^[a-z0-9]+(?:-[a-z0-9]+)*$/,Yp=I({connectorId:A(),purpose:D().trim().min(1,`Purpose is required`)}),Xp={name:D().trim().min(1).max(120),description:D().trim().min(1).max(2e3),iconId:A().nullable().optional(),tags:F(D()).default([]),model:Rp,systemPrompt:D().trim().min(1),conversationStarters:F(D().trim().min(1)).max(5).default([]),exampleConversation:F(Up).min(1,`At least one example turn is required`),connectors:F(Yp).refine(e=>new Set(e.map(e=>e.connectorId)).size===e.length,{message:`Each connector can only be added once`}).default([])};I({slug:D().trim().regex(Jp,`Use lowercase-kebab-case`).max(120),...Xp}),I(Xp),I({id:A()}),I({type:z(Bp).optional(),limit:V().int().min(1).max(100).default(30),offset:V().int().min(0).default(0)}),I({items:F(I({id:A(),type:z(Bp),slug:D(),name:D(),description:D(),tags:F(D()),isDelisted:N(),createdAt:w(),updatedAt:w()})),total:M().int().min(0)});const Zp=I({connectorId:A(),name:D(),purpose:D()});I({id:A(),slug:D(),name:D(),description:D(),iconId:A().nullable(),tags:F(D()),model:D(),systemPrompt:D(),conversationStarters:F(D()),exampleConversation:F(Up),connectors:F(Zp),isDelisted:N(),createdAt:w(),updatedAt:w()}),I({items:F(I({tag:D(),category:z([Vp.ROLE,Vp.BADGE,Vp.USE_CASE])}))}),I({items:F(I({id:A(),name:D(),description:D()}))});const Qp={description:D().trim().min(1).max(2e3),iconId:A().nullable().optional(),tags:F(D()).default([]),exampleConversation:F(Up).min(1,`At least one example turn is required`)};I({slug:D().trim().regex(Jp,`Use lowercase-kebab-case`).max(120),...Qp}),I(Qp),I({id:A()}),I({id:A(),slug:D(),name:D(),description:D(),iconId:A().nullable(),tags:F(D()),exampleConversation:F(Up),hasPackagedContent:N(),isDelisted:N(),createdAt:w(),updatedAt:w()}),I({name:D(),description:D()});const $p=I({id:M(),content:D(),createdAt:w(),updatedAt:w()});I({limit:V().int().min(1).max(100).default(100),nextKey:D().optional()}),I({memories:F($p),nextKey:D().optional()}),I({workspaceId:A()}),I({workspaceId:A(),memoryId:V().int()});const em=[`usage_exhausted`,`payment_failed`,`auto_reload_threshold_exceeded`,`role_changed`,`schedules_agent_deleted`,`agent_binding_removed`,`schedule_run_completed`,`publish_submitted`,`publish_approved`,`publish_rejected`,`task_complete`,`workspace_join_request`,`access_request`,`meeting_shared`,`meeting_shared_workspace`,`project_member_added`,`task_shared_to_project`,`task_shared_with_member`,`schedules_calendar_auth_expired`,`agent_monthly_cap_threshold`,`handoff_requested`,`announcement`],tm=[`info`,`action`],nm=[`all`,`action`,`info`],rm=[`low`,`medium`,`high`],im=[`web`,`ios`,`android`],J=A(),am=z(rs),om=z(em),sm=z(tm),cm=z(rm),lm=z(im);I({workspaceId:J}),I({workspaceId:J,notificationId:J}),I({workspaceId:J,deviceId:J}),I({tab:z(nm).default(`all`),eventType:L([om,F(om)]).transform(e=>Array.isArray(e)?e:[e]).optional(),cursor:D().optional(),limit:V().int().min(1).max(100).default(20),lang:am.optional()});const um=I({id:D().min(1),labelKey:D().min(1),method:B(`POST`),path:D().min(1),requiresInput:F(I({fieldName:D().min(1),displayNameKey:D().min(1)})).min(1).optional(),style:z([`primary`,`destructive`,`secondary`]).optional()}),dm=I({scope:z([`workspace`,`team`]),scopeName:D(),oldRole:D(),newRole:D(),canManageMember:N()}),fm=I({workspaceName:D().min(1)}),pm=I({workspaceName:D().min(1),invoiceId:D().min(1)}),mm=I({workspaceName:D().min(1),thresholdUsd:D().min(1),reloadAmountUsd:D().min(1)}),hm=I({scheduleName:D().min(1),agentName:D().min(1),scheduleId:J}),gm=I({scheduleName:D().min(1),scheduleId:J}),_m=B([100,80]),vm=I({agentName:D().min(1),agentId:J,threshold:_m,spentUsd:D().min(1),capUsd:D().min(1)}),ym=I({agentName:D().min(1),resourceName:D().min(1),resourceType:z([`model`,`connector`]),agentId:J}),bm=I({requesterName:D().min(1),resourceName:D().min(1),resourceType:z([`agent`,`connector`,`skill`]),scope:z([`team`,`workspace`]),teamId:J.optional(),scopeName:D().min(1),inlineActions:F(um),publishId:J}),xm=I({approverName:D().min(1),resourceName:D().min(1),resourceType:z([`agent`,`connector`,`skill`]),resourceId:J}),Sm=I({approverName:D().min(1),resourceName:D().min(1),resourceType:z([`agent`,`connector`,`skill`]),reason:D(),actions:F(I({id:z([`resubmit`,`viewResource`]),labelKey:D().min(1),href:D().min(1)})),resourceId:J}),Cm=I({workspaceName:D().min(1),requesterEmail:k(),invitationId:J});z([`task`,`preview`,`meeting`]);const wm=I({requesterName:D().min(1),resourceName:D().min(1),resourceId:J}),Tm=R(`resourceType`,[wm.extend({resourceType:B([`task`,`preview`]),parentTaskId:J}),wm.extend({resourceType:B(`meeting`),meetingId:J})]),Em=I({meetingId:J,meetingTitle:D().min(1),sharedByName:D().min(1),role:z([`viewer`,`editor`])}),Dm=I({meetingId:J,meetingTitle:D().min(1),sharedByName:D().min(1)}),Om=I({projectId:J,projectName:D().min(1),addedByName:D().min(1)}),km=I({direction:If,targetKind:Lf,targetId:J}),Am=I({taskId:J,taskTitle:D(),projectId:J,projectName:D().min(1),sharedByName:D().min(1)}),jm=I({taskId:J,taskTitle:D(),projectId:J,projectName:D().min(1),sharedByName:D().min(1)}),Mm=I({name:D(),taskTitle:D(),taskId:J}),Nm=I({aiResponseSnippet:D(),taskId:J}),Pm=I({title:D().min(1).max(200),body:D().min(1).max(2e3),ctaLabel:D().max(80).optional()}),Fm=I({en:Pm}).catchall(Pm),Im=I({notification:B(!0),webPush:N(),mobilePush:N(),email:N()}),Lm=z([`notification`,`popup`]),Rm=I({announcementId:J,contentI18n:Fm,channels:Im,category:sm,ctaUrl:D().optional(),surface:Lm.optional(),mediaKey:D().optional()}),zm=I({id:D().min(1),label:D().min(1),method:B(`POST`),path:D().min(1),style:z([`primary`,`destructive`,`secondary`]).optional(),requiresInput:F(I({fieldName:D().min(1),displayName:D().min(1)})).min(1).optional()}),Bm=D().refine(e=>e.startsWith(`/`)||/^https?:\/\//.test(e),{message:`ctaUrl must be an absolute URL or a path starting with /`}),Vm=I({title:D(),body:D(),ctaLabel:D().optional(),ctaUrl:Bm.optional(),inlineActions:F(zm).optional()}),Hm=I({id:J,urgency:cm,category:sm,relatedEntityId:D().nullable(),rendered:Vm,renderedLocale:am,readAt:w().nullable(),processedAt:w().nullable(),createdAt:w()}),Um=R(`eventType`,[I({eventType:B(`role_changed`),payload:dm}),I({eventType:B(`usage_exhausted`),payload:fm}),I({eventType:B(`payment_failed`),payload:pm}),I({eventType:B(`auto_reload_threshold_exceeded`),payload:mm}),I({eventType:B(`schedules_agent_deleted`),payload:hm}),I({eventType:B(`schedules_calendar_auth_expired`),payload:gm}),I({eventType:B(`agent_binding_removed`),payload:ym}),I({eventType:B(`agent_monthly_cap_threshold`),payload:vm}),I({eventType:B(`schedule_run_completed`),payload:Mm}),I({eventType:B(`publish_submitted`),payload:bm}),I({eventType:B(`publish_approved`),payload:xm}),I({eventType:B(`publish_rejected`),payload:Sm}),I({eventType:B(`task_complete`),payload:Nm}),I({eventType:B(`workspace_join_request`),payload:Cm}),I({eventType:B(`access_request`),payload:Tm}),I({eventType:B(`meeting_shared`),payload:Em}),I({eventType:B(`meeting_shared_workspace`),payload:Dm}),I({eventType:B(`project_member_added`),payload:Om}),I({eventType:B(`task_shared_to_project`),payload:Am}),I({eventType:B(`task_shared_with_member`),payload:jm}),I({eventType:B(`handoff_requested`),payload:km}),I({eventType:B(`announcement`),payload:Rm})]),Wm=Hm.and(Um);I({items:F(Wm),nextKey:D().optional()}),I({item:Wm.nullable()}),I({count:M().int().min(0),capped:N().optional()}),I({deviceType:lm,fcmToken:D().min(1),description:D().max(500).optional()}),I({id:J,createdAt:w()}),I({}).strict();const Gm=R(`kind`,[I({kind:B(`all`)}),I({kind:B(`admins`)}),I({kind:B(`specific`),userIds:F(J).min(1)})]);I({workspaceId:J.nullish(),contentI18n:Fm,ctaUrl:j({protocol:/^https?$/}).max(2e3).optional(),urgency:cm,category:sm,audience:Gm,channels:Im,surface:Lm.default(`notification`),mediaKey:D().min(1).max(100).optional()}).refine(e=>e.audience.kind===`all`||e.workspaceId!=null,{message:`workspaceId is required when audience.kind is 'admins' or 'specific'`,path:[`workspaceId`]}).refine(e=>e.surface!==`popup`||e.ctaUrl!=null,{message:`ctaUrl is required when surface is 'popup'`,path:[`ctaUrl`]}),I({id:J,createdAt:w()}),I({providers:F(I({id:D(),name:D(),clientId:D().nullable(),authUrl:D(),tokenUrl:D(),usePKCE:N(),defaultScopes:F(D()).nullable(),strategy:D(),configured:N(),builtIn:N(),iconUrl:D().optional()}))});const Km={AGENT:`agent`,SKILL:`skill`,WORKFLOW:`workflow`,CONNECTOR:`connector`,SCHEDULE:`schedule`,PROJECT:`project`};function qm({resourceType:e,resourceId:t}){return`${e}:${t}`}const Jm=z([Km.AGENT,Km.SKILL,Km.WORKFLOW,Km.CONNECTOR,Km.SCHEDULE,Km.PROJECT]),Ym=I({resourceType:Jm,resourceId:A(),name:D(),managedAgent:I({channelCount:M().int().nonnegative()}).optional()});I({hash:D().regex(/^[0-9a-f]{64}$/),items:F(Ym)});const Xm=R(`action`,[I({resourceType:Jm,resourceId:A(),action:B(`transfer`),successorUserId:A()}),I({resourceType:Jm,resourceId:A(),action:B(`delete`)})]),Zm=R(`action`,[I({action:B(`transfer`),successorUserId:A()}),I({action:B(`delete`)})]);I({inventoryHash:D().min(1),defaultAction:Zm.optional(),decisions:F(Xm).max(1e3).superRefine((e,t)=>{let n=new Set;for(let[r,i]of e.entries()){let e=qm(i);n.has(e)?t.addIssue({code:`custom`,path:[r],message:`Duplicate decision for resource`}):n.add(e)}})}),I({transferred:M(),deleted:M()});const Y={Access:`access`,ManageWorkspace:`manage_workspace`,ManageRole:`manage_role`,ManageMember:`manage_member`,ManagePayment:`manage_payment`,SubmitCustomConnector:`submit_custom_connector`,ReviewCustomConnector:`review_custom_connector`,ManageConnector:`manage_connector`,ManageModel:`manage_model`,ManageCapability:`manage_capability`,ManageTeam:`manage_team`,ReviewResourcePublish:`review_resource_publish`,CreateAgent:`create_agent`,PublishAgent:`publish_agent`,CreateSkill:`create_skill`,PublishSkill:`publish_skill`,CreateWorkflow:`create_workflow`,CreateCustomConnector:`create_custom_connector`,PublishCustomConnector:`publish_custom_connector`,ManageAllTeams:`manage_all_teams`,ManageChatbot:`manage_chatbot`,ManageChannelAgents:`manage_channel_agents`,ViewAuditLogs:`view_audit_logs`};Y.ManageWorkspace,Y.ManageRole,Y.ManageMember,Y.ManagePayment,Y.ManageModel,Y.ManageCapability,Y.ManageConnector,Y.ManageChatbot,Y.ManageChannelAgents,Y.CreateCustomConnector,Y.PublishCustomConnector,Y.CreateAgent,Y.PublishAgent,Y.CreateSkill,Y.PublishSkill,Y.ReviewResourcePublish,Y.ManageTeam,Y.ManageAllTeams,Y.ViewAuditLogs,Y.ManageMember,Y.ManageCapability,Y.ManageConnector,Y.ManageChatbot,Y.ManageChannelAgents,Y.CreateCustomConnector,Y.PublishCustomConnector,Y.CreateAgent,Y.PublishAgent,Y.CreateSkill,Y.PublishSkill,Y.ManageTeam,Y.CreateCustomConnector,Y.PublishCustomConnector,Y.CreateAgent,Y.PublishAgent,Y.CreateSkill,Y.PublishSkill;const Qm=z([`workspace`,`resource`,`team`]),$m=I({id:z(Object.values(Y)),name:D(),descriptions:F(D()).min(1),category:Qm});I({lang:is}),I({permissions:F($m)});const eh=z([{id:`manage_role`,category:`workspace`},{id:`manage_member`,category:`workspace`},{id:`manage_workspace`,category:`workspace`},{id:`manage_payment`,category:`workspace`},{id:`manage_model`,category:`workspace`},{id:`view_audit_logs`,category:`workspace`},{id:`manage_capability`,category:`resource`},{id:`create_custom_connector`,category:`resource`},{id:`publish_custom_connector`,category:`resource`},{id:`create_agent`,category:`resource`},{id:`publish_agent`,category:`resource`},{id:`create_skill`,category:`resource`},{id:`publish_skill`,category:`resource`},{id:`create_workflow`,category:`resource`},{id:`review_resource_publish`,category:`resource`},{id:`manage_team`,category:`team`},{id:`manage_all_teams`,category:`team`},{id:`manage_chatbot`,category:`workspace`},{id:`manage_channel_agents`,category:`workspace`}].map(e=>e.id));I({permissions:F(eh)});const th=I({en:z([`en-US`,`en-GB`]).optional(),zh:z([`zh-CN`,`zh-HK`,`zh-TW`]).optional(),es:z([`es-MX`,`es-ES`,`es-US`]).optional(),fr:z([`fr-FR`,`fr-CA`]).optional(),pt:z([`pt-PT`,`pt-BR`]).optional()}).strict(),nh=I({displayName:D().nullable(),jobTitle:D().nullable(),language:D().nullable(),customPreferences:D().nullable(),voiceLanguageVariants:th.nullable(),updatedAt:w()});I({displayName:D().trim().max(100).nullable().optional(),jobTitle:D().trim().max(100).nullable().optional(),language:D().trim().max(100).nullable().optional(),customPreferences:D().trim().max(1e3).nullable().optional(),voiceLanguageVariants:th.nullable().optional()}),I({workspaceId:A()}),nh.extend({updatedAt:w().nullable()}),I({workspaceId:A()}),I({workspaceId:A(),teamId:A(),publishId:A()}),I({workspaceId:A(),teamId:A()});const rh=[mc.MEMBER,mc.MANAGER,mc.OWNER];I({resourceType:bc,resourceId:A(),teamIds:F(A()).min(1).max(20).refine(e=>new Set(e).size===e.length,{message:`teamIds must not contain duplicates`}),message:D().trim().max(500).optional()}),I({roles:F(z(rh)).min(1).refine(e=>new Set(e).size===e.length,{message:`Roles must be unique`})}),I({roles:F(z(rh)).min(1).refine(e=>new Set(e).size===e.length,{message:`Roles must be unique`})}),I({items:F(I({id:A(),resource:Cc,author:Sc,requester:Sc,teamId:A(),versionNumber:M().int().nullable(),status:z(xc),message:D().nullable(),roles:F(z(rh)).nullable(),reviewer:Sc.nullable(),reviewedAt:w().nullable(),rejectReason:D().nullable(),createdAt:w(),updatedAt:w()})),nextKey:D().optional()}),I({count:M().int()}),I({workspaceId:A()}),I({workspaceId:A(),publishId:A()}),I({resourceType:bc,resourceId:A(),message:D().trim().max(500).optional()}),I({roleIds:F(A()).min(1).optional()}),I({roleIds:F(A()).nullable().optional()}),I({items:F(I({id:A(),resource:Cc,author:Sc.nullable(),requester:Sc.nullable(),versionNumber:M().int().nullable(),workspaceId:A(),status:z(xc),message:D().nullable(),roleIds:F(A()).nullable(),reviewer:Sc.nullable(),reviewedAt:w().nullable(),rejectReason:D().nullable(),createdAt:w(),updatedAt:w()})),total:M().int().nonnegative(),nextKey:D().optional()}),I({resourceType:bc.optional()}),I({count:M().int()}),[{extension:`mp3`,mimeTypes:[`audio/mpeg`]},{extension:`m4a`,mimeTypes:[`audio/mp4`,`audio/x-m4a`]},{extension:`wav`,mimeTypes:[`audio/wav`,`audio/wave`]},{extension:`mp4`,mimeTypes:[`video/mp4`]},{extension:`webm`,mimeTypes:[`audio/webm`,`video/webm`]},{extension:`aac`,mimeTypes:[`audio/aac`]},{extension:`ogg`,mimeTypes:[`audio/ogg`]},{extension:`flac`,mimeTypes:[`audio/flac`]},{extension:`mpeg`,mimeTypes:[`audio/mpeg`]}].map(({extension:e})=>`.${e}`),I({url:j(),title:D().trim().min(1).max(500).optional(),modelId:Rp.optional(),preferredLanguage:D().trim().min(2).max(10).regex(/^[a-zA-Z]{2,3}(-[a-zA-Z]{2,8})?$/,`Invalid language code format`).optional()}),I({recordingId:A(),source:B(`media`),message:D()}),I({url:j()}),I({url:D(),type:B(`media`),title:D(),duration:M().optional(),thumbnailUrl:D().optional(),contentType:D().optional(),fileSize:M().optional(),extractor:D().optional(),channelName:D().optional(),uploadDate:D().optional()}),I({downloadUrl:D(),playbackPending:N(),url:D()}),I({deploymentMode:Ff,features:I({enableCapability:N(),enableCapabilityProviderSwitch:N(),enableChatbotSlack:N(),enableChatbotTeams:N(),enableProject:N(),enableScheduleActiveWindows:N(),enableScheduleJudge:N(),scheduleJudgeDefaultEnabled:N()})});const ih=I({id:A(),name:D(),email:k(),image:D().nullable().optional()}),ah=I({id:A(),name:D()});I({subjectType:yc,subjectId:A()}),I({grants:F(R(`subjectType`,[I({subjectType:B(vc.USER),subjectId:A(),userId:A(),role:_c,user:ih}),I({subjectType:B(vc.TEAM),subjectId:A(),teamId:A(),role:_c,team:ah})]))}),I({role:_c});function oh(e){return e.subjectType===vc.USER}function sh(e){return e.grants.filter(oh)}I({workspaceId:A(),resourceType:bc}),I({teams:F(I({id:A(),name:D()}))}),I({roles:F(I({id:A(),name:D(),description:D().optional(),isDefault:N(),memberCount:M().int(),permissions:F(D()),createdAt:w(),updatedAt:w()})),nextKey:D().optional()}),I({name:D().trim().min(1).max(100),description:D().trim().max(500).optional(),permissions:F(eh).min(1)}),I({name:D().trim().min(1).max(100),description:D().trim().max(500).optional(),permissions:F(eh).min(1)});const ch={},lh={};function uh(e,t){try{let n=(ch[e]||=new Intl.DateTimeFormat(`en-US`,{timeZone:e,timeZoneName:`longOffset`}).format)(t).split(`GMT`)[1];return n in lh?lh[n]:fh(n,n.split(`:`))}catch{if(e in lh)return lh[e];let t=e?.match(dh);return t?fh(e,t.slice(1)):NaN}}const dh=/([+-]\d\d):?(\d\d)?/;function fh(e,t){let n=+(t[0]||0),r=+(t[1]||0),i=(t[2]||0)/60;return lh[e]=n*60+r>0?n*60+r+i:n*60-r-i}var ph=class e extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]==`string`&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(uh(this.timeZone,this))?this.setTime(NaN):e.length?typeof e[0]==`number`&&(e.length===1||e.length===2&&typeof e[1]!=`number`)?this.setTime(e[0]):typeof e[0]==`string`?this.setTime(+new Date(e[0])):e[0]instanceof Date?this.setTime(+e[0]):(this.setTime(+new Date(...e)),_h(this,e)):this.setTime(Date.now())}static tz(t,...n){return n.length?new e(...n,t):new e(Date.now(),t)}withTimeZone(t){return new e(+this,t)}getTimezoneOffset(){let e=-uh(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),hh(this),+this}[Symbol.for(`constructDateFrom`)](t){return new e(+new Date(t),this.timeZone)}};const mh=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!mh.test(e))return;let t=e.replace(mh,`$1UTC`);ph.prototype[t]&&(e.startsWith(`get`)?ph.prototype[e]=function(){return this.internal[t]()}:(ph.prototype[e]=function(){return Date.prototype[t].apply(this.internal,arguments),gh(this),+this},ph.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),hh(this),+this}))});function hh(e){e.internal.setTime(+e),e.internal.setUTCSeconds(e.internal.getUTCSeconds()-Math.round(-uh(e.timeZone,e)*60))}function gh(e){Date.prototype.setFullYear.call(e,e.internal.getUTCFullYear(),e.internal.getUTCMonth(),e.internal.getUTCDate()),Date.prototype.setHours.call(e,e.internal.getUTCHours(),e.internal.getUTCMinutes(),e.internal.getUTCSeconds(),e.internal.getUTCMilliseconds()),_h(e)}function _h(e,t){let n=Array.isArray(t)?vh(t):+e.internal,r=uh(e.timeZone,e),i=r>0?Math.floor(r):Math.ceil(r),a=new Date(+e);a.setUTCHours(a.getUTCHours()-1);let o=-new Date(+e).getTimezoneOffset(),s=-new Date(+a).getTimezoneOffset(),c=o-s,l=o;if(c&&o!==i&&Date.prototype.getHours.apply(e)!==(Array.isArray(t)?t[3]||0:e.internal.getUTCHours())){let t=new Date(+e),n=o-i;n&&t.setUTCMinutes(t.getUTCMinutes()+n);let r=uh(e.timeZone,t);(r>0?Math.floor(r):Math.ceil(r))===i&&(l=s)}let u=l-i;u&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+u);let d=new Date(+e);d.setUTCSeconds(0);let f=o>0?d.getSeconds():(d.getSeconds()-60)%60,p=Math.round(-(uh(e.timeZone,e)*60))%60;(p||f)&&Date.prototype.setUTCSeconds.call(e,Date.prototype.getUTCSeconds.call(e)+p+f);let ee=uh(e.timeZone,e),m=ee>0?Math.floor(ee):Math.ceil(ee),te=-new Date(+e).getTimezoneOffset()-m,ne=m!==i,re=te-u,h=m-i,ie=n-m*60*1e3,ae=h>0&&yh(e)-n===h*60*1e3&&yh(e,ie)!==n;if(ne&&re&&!ae){Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+re);let t=uh(e.timeZone,e),n=m-(t>0?Math.floor(t):Math.ceil(t));n&&re<0&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+n)}hh(e);let oe=(t?n:n+p*1e3)-+e.internal;oe&&Math.abs(oe)<1800*1e3&&(Date.prototype.setTime.call(e,+e+oe),hh(e))}function vh(e){return Date.UTC(e[0],e.length>1?e[1]:0,e.length>2?e[2]:1,...e.slice(3))}function yh(e,t){let n=new Date(t??+e);return n.setUTCSeconds(n.getUTCSeconds()-Math.round(-uh(e.timeZone,n)*60)),+n}const bh=D().length(12).regex(/^[a-z0-9]+$/u),xh=L([R(`mode`,[I({mode:B(`version`),versionId:A()}),I({mode:B(`work`),taskId:A()})]),I({mode:B(`file`),fileId:A()}),I({mode:B(`live`)})]);po({siteKey:bh,env:D().min(1),serve:xh,iat:M().optional(),exp:M().optional()});const Sh=[`preview_site_ready`,`preview_site_publish`,`preview_site_delete`];function Ch(e,t){let n=new Set;for(let r of e){let e=t(r);if(n.has(e))return e;n.add(e)}}const wh=F(D().min(1)).superRefine((e,t)=>{let n=Ch(e,e=>e);n&&t.addIssue({code:`custom`,message:`Duplicate path: ${n}`})});z(Sh);const Th={env:D().min(1),sandboxDomain:D().min(1),sandboxId:D().min(1)},Eh={...Th,siteDir:D().min(1).default(`app`)},Dh={env:D().min(1),siteKey:bh},Oh={...Dh,serve:xh};R(`op`,[I({op:B(`preview_site_ready`),...Eh}),I({op:B(`preview_site_publish`),...Eh}),I({op:B(`preview_site_delete`),...Th})]),R(`op`,[I({op:B(`preview_site_ready`),...Oh}),I({op:B(`preview_site_publish`),...Oh}),I({op:B(`preview_site_delete`),...Dh})]),I({files:F(I({path:D().min(1),contentBase64:Ja(`Invalid base64 content`),contentType:D().optional()})).max(128).superRefine((e,t)=>{let n=Ch(e,e=>e.path);n&&t.addIssue({code:`custom`,message:`Duplicate path: ${n}`})}),finalize:N().default(!0),manifestFiles:wh.optional()}).superRefine((e,t)=>{if(!e.finalize||!e.manifestFiles)return;let n=new Set(e.manifestFiles);for(let r of e.files)if(!n.has(r.path)){t.addIssue({code:`custom`,message:`Manifest is missing published file: ${r.path}`});return}}),I({filesUploaded:M().int().nonnegative(),filesDeleted:M().int().nonnegative()}),I({files:wh});const kh=Object.values({BUILT_IN:`built_in`,CUSTOM:`custom`}),Ah=[`updatedAt`,`name`];es.extend({createdBy:z([`me`]).optional(),search:D().trim().max(200).optional(),sortBy:z(Ah).optional()});const jh=I({id:A(),name:D(),isMe:N()}),Mh=I({id:A()}).nullable(),Nh=I({id:A(),name:D(),description:D(),type:z(kh).optional(),provider:D().nullable(),author:jh.nullable(),publish:Mh,publishedTo:Tc.optional(),team:I({id:A(),name:D()}).optional().describe(`The team this skill is published to, only present when createdBy is team`),versionNumber:M().int().nullable().optional(),isEnabled:N(),myRole:G,createdAt:w(),updatedAt:w()});I({skills:F(Nh),nextKey:D().optional()}),I({workspaceId:A(),skillId:A(),versionId:A()});const Ph=I({id:A(),name:D()}),Fh=I({id:A(),versionNumber:M().int().min(1),description:D(),createdBy:Ph,createdAt:w()});I({skillId:A(),skillName:D(),versions:F(Fh)}),I({url:j()}),I({search:D().trim().max(200).optional(),status:z(Mc).optional(),nextKey:D().optional(),limit:V().int().min(1).max(100).default(20),sortBy:z(Ah).optional()}),I({skills:F(I({id:A(),name:D(),description:D().optional(),hasUnpublishedChanges:N(),latestVersionNumber:M().int().nullable(),publishedTo:Tc.optional(),myRole:G,createdAt:w(),updatedAt:w()})),nextKey:D().optional(),totalCount:M().int().nonnegative(),statusCounts:Nc}),es.extend({createdBy:z([`workspace`,`team`,`me`]).optional(),teamId:A().optional(),search:D().trim().max(200).optional(),sortBy:z(Ah).optional()}).refine(e=>!e.teamId||e.createdBy===`team`,{message:`teamId can only be used with createdBy: team`,path:[`teamId`]}),I({field:D(),message:D()}),I({workspaceId:A(),skillId:A()}),I({isEnabled:N()}),I({isEnabled:N()}),I({skills:F(Nh),nextKey:D().optional()}),I({workspaceId:A(),skillId:A()});const Ih=I({path:D(),size:M().int().nonnegative()});I({skillId:A(),skillName:D(),description:D(),versionId:A(),files:F(Ih)}),I({workspaceId:A(),skillId:A()}),I({path:D().trim().min(1).max(1024)}),R(`kind`,[I({kind:B(`text`),path:D(),size:M().int().nonnegative(),content:D()}),I({kind:B(`image`),path:D(),size:M().int().nonnegative(),content:D()}),I({kind:B(`binary`),path:D(),size:M().int().nonnegative()}),I({kind:B(`too_large`),path:D(),size:M().int().nonnegative()})]);const Lh=z([`queued`,`running`,`completed`,`failed`,`cancelled`]),Rh=Lh,zh=z([`subagent`,`workflow`]);function Bh(e){return e===`subagent`?`subagentRuns`:`workflowRuns`}const Vh=new Set([`completed`,`failed`,`cancelled`]);function Hh(e){return Vh.has(e)}function Uh(e){return e.at(-1)?.toolCallCount??0}I({runs:F(I({runId:D(),kind:zh,status:Rh,label:D(),startedAt:D().nullable(),createdAt:D()}))}),I({runId:A(),status:Lh,startedAt:D().nullable(),progress:Jo().nullable().meta({type:`object`}),result:Jo().nullable().meta({type:`object`}),error:Jo().nullable().meta({type:`object`})});const Wh=z([`chatgpt`]),Gh=z([`active`,`expired`,`needs_reauth`,`quota_exhausted`,`error`]),Kh=Ss,qh=I({observedAt:w(),windows:xo(D(),Kh)}),Jh=I({id:A(),provider:Wh,label:D(),accountId:D(),status:Gh,quotaResetAt:w().nullable(),quota:qh.nullable(),lastCheckedAt:w().nullable(),createdAt:w()});I({accounts:F(Jh)}),I({accountIds:F(A()).min(1)}),I({provider:Wh,label:D().trim().min(1).max(100).optional()}),I({provider:Wh}),I({status:z([`pending`,`connected`,`error`]),account:Jh.nullable(),lastError:D().nullable()}),I({errorMessage:D().min(1).max(1e3),url:j().max(2e3).optional(),userAgent:D().max(500),workspaceId:A().optional(),sentryEventId:D().max(64).optional(),description:D().max(5e3).nullable()}),I({requestId:M().int()}),I({workspaceId:A()}),I({workspaceId:A(),teamId:A()}),I({workspaceId:A(),teamId:A(),userId:A()});const Yh=[mc.OWNER,mc.MANAGER,mc.MEMBER],Xh=[hc.VISIBLE,hc.HIDDEN],Zh=[mc.OWNER,mc.MANAGER,mc.MEMBER],Qh=I({email:k(),role:z(Zh)});I({name:D().trim().min(1).max(100),description:D().trim().max(500).nullable().default(null),visibility:z(Xh).optional(),requireReview:N().optional(),acceptExternalSubmissions:N().optional(),members:F(Qh).min(1).max(50).optional()}),I({name:D().trim().min(1).max(100).optional(),description:D().trim().max(500).nullable().optional(),visibility:z(Xh).optional(),requireReview:N().optional(),acceptExternalSubmissions:N().optional()}).refine(e=>e.name!==void 0||e.description!==void 0||e.visibility!==void 0||e.requireReview!==void 0||e.acceptExternalSubmissions!==void 0,{message:`At least one field must be provided`}),I({members:F(Qh).min(1).max(50)}),I({role:z(Zh)});const $h=I({id:A(),name:D()});I({teams:F(I({id:A(),name:D(),description:D().nullable(),visibility:z(Xh),requireReview:N(),acceptExternalSubmissions:N(),memberCount:M().int(),currentUserRole:z(Yh).nullable(),createdBy:$h,createdAt:w(),updatedAt:w()}).extend({publishPendingCount:M().int(),published:N().optional()})),nextKey:D().optional()}),es.extend({search:D().trim().max(200).optional(),resourceType:bc.optional(),resourceId:A().optional()}),I({members:F(I({userId:A(),name:D(),email:D(),role:z(Yh),createdAt:w()})),total:M().int().nonnegative()}),ts.extend({search:D().trim().max(200).optional()}),I({platform:z([`posthog`,`sentry`,`zendesk`])}),I({id:A()});const eg={MANUAL:`manual`,AUTO_LEARNED:`auto_learned`},tg=I({id:A(),word:D(),source:z([eg.MANUAL,eg.AUTO_LEARNED]),createdAt:w()});I({word:D().trim().min(1).max(200)}),I({limit:V().int().min(1).max(100).default(100),nextKey:D().optional()}),I({words:F(tg),nextKey:D().optional()}),I({workspaceId:A(),wordId:A()}),I({workspaceId:A()});const ng=xo(D(),P()),rg=D().min(1).max(64).regex(/^[a-z][a-z0-9_]*$/,`node id must be lower_snake_case`),ig=z(Np),ag=L([B(`auto`),ig]),og=z([`routine`,`reasoning`,`judgment`]),sg=z([`implicit_auto`,`fanout_max_excluded`,`only_enabled_tier`,`single_eligible_tier`,`tier_unavailable`]),cg=I({requestedTier:ag,classifiedDemand:og.optional(),selectedTier:ig,source:z([`pinned`,`classified`,`fallback`,`policy`,`chat-router`]),constraints:F(sg),policyVersion:z([`chat-router-v1`,`workflow-v1`])});I({id:rg,label:D().min(1).max(120)}).extend({kind:B(`agent`),promptTemplate:D().min(1),agentId:A().optional(),toolAllowlist:F(D()).optional(),outputSchema:ng.optional(),modelSelection:ag.optional(),maxSteps:M().int().min(1).max(50).optional()}),I({status:z([`queued`,`running`,`done`,`failed`]),output:P().optional(),error:D().optional(),durationMs:M().int().optional(),tokens:M().int().optional(),usage:I({inputTokens:M().int(),outputTokens:M().int(),totalTokens:M().int(),reasoningTokens:M().int(),cachedInputTokens:M().int(),cachedCreationTokens:M().int(),model:D().optional()}).optional(),fanOut:I({total:M().int(),done:M().int(),failed:M().int(),running:M().int()}).optional(),label:D().optional(),kind:z([`agent`,`fan_out`]).optional(),seq:M().int().optional(),prompt:D().optional(),invocation:I({schema:P().optional(),toolAllowlist:F(D()).optional(),agentId:D().optional(),maxSteps:M().int().optional(),model:ag.optional()}).optional(),modelAllocation:cg.optional(),stepCount:M().int().optional(),toolCalls:F(I({name:D(),summary:D()})).optional(),phaseId:D().optional(),phaseSeq:M().int().optional()}),I({workflows:F(I({id:A(),name:D(),description:D().nullable(),scriptSource:D(),isActive:N(),createdAt:w(),updatedAt:w(),myRole:G})),nextKey:D().optional()});const lg=z([`queued`,`running`,`completed`,`failed`,`cancelled`]),ug=I({id:A(),status:lg,startedAt:w().nullable(),completedAt:w().nullable(),error:P().nullable(),createdAt:w()});I({runs:F(ug),nextKey:D().optional()}),ug.extend({workflowId:A(),context:Jo().meta({type:`object`}),scriptSnapshot:D(),args:P().nullable()});const dg=z([`invite-only`,`open`]),fg=D().min(1,`Workspace name is required`).max(50,`Workspace name must be 50 characters or less`).regex(/^[\p{L}\p{N} ._-]+$/u,`Workspace name can only contain letters, numbers, spaces, dashes, underscores, and periods`).refine(e=>e===e.trim(),{message:`Workspace name cannot start or end with spaces`}),pg=I({id:D(),name:D(),userCount:M(),config:I({additionalModelsEnabled:N().optional(),subscriptionModelsEnabled:N().optional(),subscriptionPoolEnabled:N().optional(),managedAgentEnabled:N().optional(),autopilotEnabled:N().optional(),subscriptionPoolFallbackModelId:Lp.nullable().optional()}).optional(),createdAt:w(),updatedAt:w()});I({workspaces:F(pg)}),I({workspaces:F(pg.extend({config:I({joinPolicy:dg})}))}),I({joined:N()}),I({name:fg,ownerId:A()}),I({name:fg});const mg=D().trim().toLowerCase().max(253).regex(/^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,63}$/,`Invalid email domain`);I({hideThinking:N().optional(),joinPolicy:dg.optional(),allowedDomains:F(D()),defaultToolApprovalMode:Jc.optional(),requireReview:N().optional(),shareSensitiveScanEnabled:N().optional(),maxShareVisibility:wl.optional(),maxPreviewVisibility:wl.optional(),disabledModelTiers:F(z(Np)).optional(),additionalModelsEnabled:N().optional(),subscriptionModelsEnabled:N().optional(),subscriptionPoolEnabled:N().optional(),managedAgentEnabled:N().optional(),autopilotEnabled:N().optional(),subscriptionPoolFallbackModelId:Lp.nullable().optional(),autoTierDisabled:N().optional(),chatbotSlackEffectivelyEnabled:N().optional(),chatbotTeamsEffectivelyEnabled:N().optional(),systemPrompt:D().trim().max(1e3).nullable().optional()}),I({email:k(),name:D(),roles:F(D()),permissions:F(eh)});const hg=z([`requested`,`approved`,`rejected`]);I({workspaceId:A(),invitationId:A()}),I({email:k(),status:hg,workspace:I({id:A(),name:D()})}),I({invitations:F(I({id:A(),workspaceId:A(),email:k(),status:hg,role:D(),requestedSeatType:vs,invitedBy:I({email:k(),name:D(),isMe:N()}).optional(),invitedAt:w().optional(),expiresAt:w().optional(),createdAt:w(),updatedAt:w()})),total:M().int().nonnegative()}),ts.extend({status:hg.optional(),search:D().trim().max(200).optional()});const gg=I({starter:M().int().nonnegative(),pro:M().int().nonnegative(),premium:M().int().nonnegative()}),_g=I({id:D(),email:D()}),vg=I({id:D(),name:D(),owners:F(_g),userCount:M().int().nonnegative(),paidSeatCount:M().int().nonnegative(),seatCountsByType:gg,createdAt:w(),updatedAt:w()});ts.extend({search:D().trim().max(200).optional(),exact:Zo().optional(),sortBy:z([`createdAt`,`userCount`,`paidSeatCount`]).default(`createdAt`),order:z(ns).default(`desc`)}),I({workspaces:F(vg),total:M().int().nonnegative()}),I({workspaceId:A()});const yg=I({purchasedUsd:M().nonnegative(),grantedUsd:M().nonnegative(),totalUsd:M().nonnegative(),nextExpiry:I({amountUsd:M().nonnegative(),expiresAt:w()}).nullable()}),bg=I({id:D(),email:D(),name:D(),seatType:vs.nullable(),joinedAt:w(),loginMethods:F(z(As))}),xg=I({enabled:N(),modelIds:F(D())}),Sg=I({id:D(),name:D()}),Cg=I({slackEnabled:N(),slackAvailable:N(),teamsEnabled:N(),teamsAvailable:N(),defaultAgentId:D().nullable(),ownerPanelDisabled:N(),inheritsLegacySettings:N(),agents:F(Sg)});I({slackEnabled:N(),teamsEnabled:N(),defaultAgentId:A().nullable(),ownerPanelDisabled:N()}),I({id:D(),name:D(),owners:F(_g),userCount:M().int().nonnegative(),paidSeatCount:M().int().nonnegative(),seatCountsByType:gg,extraUsage:yg,members:F(bg),allowedDomains:F(D()),advancedModels:xg,chatbotSettings:Cg,managedAgentEnabled:N(),autopilotEnabled:N(),createdAt:w(),updatedAt:w()}),I({allowedDomains:F(mg).max(50)}),I({enabled:N(),modelIds:F(D().trim().min(1).max(200)).max(100)}),I({enabled:N()}),I({enabled:N()}),I({monthlyUsages:F(I({id:A(),userId:A(),workspaceId:A(),year:M(),month:M(),totalCost:D(),operationCount:M(),createdAt:w(),updatedAt:w(),user:I({id:A(),name:D(),email:D()}),budgetOverride:I({budget:D().nullable()}).nullable().optional()})),nextKey:D().optional()});const wg=[`apiUrl`,`hubUrl`];function Tg(e){let t=$.getEffectiveProfileName(e);return $.getProfileConfigFile(t)}function X(e){let t=Tg(e);try{if(!n.existsSync(t))return{};let e=n.readFileSync(t,`utf-8`);return JSON.parse(e)}catch{return{}}}function Z(e,t){let r=$.getEffectiveProfileName(t);$.ensureProfileDir(r);let i=$.getProfileConfigFile(r);n.writeFileSync(i,JSON.stringify(e,null,2),{mode:384});try{n.chmodSync(i,384)}catch{}}const Eg={getApiUrl(e){return X(e).apiUrl??null},setApiUrl(e,t){let n=X(t);n.apiUrl=e,Z(n,t)},clearApiUrl(e){let t=X(e);delete t.apiUrl,Z(t,e)},getHubUrl(e){return X(e).hubUrl??null},setHubUrl(e,t){let n=X(t);n.hubUrl=e,Z(n,t)},getAll(e){return X(e)},setAll(e,t){Z(e,t)},set(e,t,n){let r=X(n);r[e]=t,Z(r,n)},get(e,t){return X(t)[e]},unset(e,t){let n=X(t);delete n[e],Z(n,t)},getDefaultModel(e){return X(e).model?.default??null},setDefaultModel(e,t){let n=X(t);n.model={...n.model,default:e},Z(n,t)},getDefaultConnectorIds(e){return X(e).connectors?.defaults??null},setDefaultConnectorIds(e,t){let n=X(t);n.connectors={...n.connectors,defaults:e},Z(n,t)},getLocalTools(e){return X(e).localTools??null},setLocalTools(e,t){let n=X(t);n.localTools={...n.localTools,...e},Z(n,t)},getToolApprovalMode(e){let t=Jc.safeParse(X(e).toolApprovalMode);return t.success?t.data:null},setToolApprovalMode(e,t){let n=X(t);n.toolApprovalMode=e,Z(n,t)}},Dg=`ENTRYDESK_MCP_TIMEOUT`,Og=`ENTRYDESK_MCP_MAX_TIMEOUT`;function kg(e,t){let n=process.env[e];if(!n)return t;let r=Number(n);return Number.isSafeInteger(r)&&r>0?Math.min(r,2147483647):t}function Ag(e){let t=kg(Dg,3e5);return{apiUrl:process.env.ENTRYDESK_API_URL||Eg.getApiUrl(e)||`https://api.entrydesk.com`,hubUrl:process.env.ENTRYDESK_HUB_URL||Eg.getHubUrl(e)||`https://app.entrydesk.com`,mcp:{httpPort:3100,requestTimeout:t,requestMaxTotalTimeout:Math.max(kg(Og,18e5),t)},auth:{loginTimeout:3e5,ignoreSslErrors:process.env.ENTRYDESK_IGNORE_SSL_ERRORS===`true`||!1}}}function jg(e){return Ag(e).apiUrl}function Mg(e){return Ag(e).hubUrl}function Ng(){return Ag().auth}function Pg(){return Ag().mcp}const Fg=`EntryDesk CLI`,Ig={keychain:!1,permissions:!1,corruptFile:!1,windowsFile:!1};function Lg(e,t){Ig[e]||(Ig[e]=!0,console.error(t))}function Rg(){return process.env.ENTRYDESK_DEBUG?.toLowerCase()===`true`}function zg(e){if(!e||typeof e!=`object`)return!1;let t=e;return!(!(`accessToken`in t||`refreshToken`in t||`email`in t||`workspaceId`in t)||`accessToken`in t&&typeof t.accessToken!=`string`||`refreshToken`in t&&typeof t.refreshToken!=`string`||`email`in t&&typeof t.email!=`string`||`workspaceId`in t&&typeof t.workspaceId!=`string`)}function Bg(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.getPassword==`function`&&typeof t.setPassword==`function`&&typeof t.deletePassword==`function`}function Vg(e){return $.getProfileCredentialsFile(e)}var Hg=class{getKeyFilePath(e){return i.join($.getProfileDir(e),`.credentials.key`)}loadEncryptionKey(e){let t=this.getKeyFilePath(e);try{if(!n.existsSync(t))return null;let e=n.readFileSync(t);return e.length===32?(this.ensureSecureFilePermissions(t),e):null}catch{return null}}createEncryptionKey(e){$.ensureProfileDir(e);let t=this.getKeyFilePath(e),r=u.randomBytes(32);return n.writeFileSync(t,r,{mode:384}),this.ensureSecureFilePermissions(t),r}getOrCreateEncryptionKey(e){return this.loadEncryptionKey(e)||this.createEncryptionKey(e)}encrypt(e,t){let n=u.randomBytes(16),r=u.createCipheriv(`aes-256-gcm`,t,n),i=r.update(e,`utf8`,`hex`);i+=r.final(`hex`);let a=r.getAuthTag();return`${n.toString(`hex`)}:${a.toString(`hex`)}:${i}`}decrypt(e,t){let n=e.split(`:`);if(n.length!==3)throw Error(`Invalid encrypted data format`);let r=Buffer.from(n[0],`hex`),i=Buffer.from(n[1],`hex`),a=n[2],o=u.createDecipheriv(`aes-256-gcm`,t,r,{authTagLength:16});o.setAuthTag(i);let s=o.update(a,`hex`,`utf8`);return s+=o.final(`utf8`),s}tryDecrypt(e,t){try{return this.decrypt(e,t)}catch{return null}}tryParseCredentials(e){try{let t=JSON.parse(e);return zg(t)?t:null}catch{return null}}ensureSecureFilePermissions(e){if(process.platform!==`win32`){try{n.chmodSync(e,384)}catch{Lg(`permissions`,`Warning: Failed to set secure permissions on credentials file.`);return}try{(n.statSync(e).mode&511)!=384&&Lg(`permissions`,`Warning: Credentials file permissions are too permissive.`)}catch{Lg(`permissions`,`Warning: Failed to verify credentials file permissions.`)}}}async getCredentials(e){let t=Vg(e);try{if(!n.existsSync(t))return null;let r=n.readFileSync(t,`utf-8`).trim();if(!r)return null;let i=this.loadEncryptionKey(e),a=i?this.tryDecrypt(r,i):null;if(a){let e=this.tryParseCredentials(a);if(e)return e}return Lg(`corruptFile`,"Warning: Credentials file is unreadable. Run `entrydesk login` again."),null}catch{return null}}async setCredentials(e,t){$.ensureProfileDir(e);let r=Vg(e),i=this.getOrCreateEncryptionKey(e),a=this.encrypt(JSON.stringify(t),i);n.writeFileSync(r,a,{mode:384}),this.ensureSecureFilePermissions(r)}async deleteCredentials(e){let t=Vg(e);try{n.existsSync(t)&&n.unlinkSync(t)}catch{}}},Ug=class{keytarModule=null;keytarLoadAttempted=!1;keychainAvailable=null;async getKeytar(){if(this.keytarLoadAttempted)return this.keytarModule;this.keytarLoadAttempted=!0;try{let e=await import(`keytar`),t=e&&typeof e==`object`&&`default`in e?e.default:e;this.keytarModule=Bg(t)?t:null}catch{this.keytarModule=null}return this.keytarModule}getAccount(e){return`profile:${e}`}async checkKeychainAvailability(){if(this.keychainAvailable!==null)return this.keychainAvailable;try{let e=await this.getKeytar();if(!e)return this.keychainAvailable=!1,!1;let t=`__entrydesk_keychain_test__${u.randomBytes(8).toString(`hex`)}`,n=`test`;await e.setPassword(Fg,t,n);let r=await e.getPassword(Fg,t),i=await e.deletePassword(Fg,t);return this.keychainAvailable=i&&r===n,this.keychainAvailable}catch{return this.keychainAvailable=!1,!1}}async isAvailable(){return this.checkKeychainAvailability()}async getCredentials(e){if(!await this.checkKeychainAvailability())throw Error(`Keychain is not available`);let t=await this.getKeytar();if(!t)throw Error(`Keytar module not available`);let n=await t.getPassword(Fg,this.getAccount(e));if(!n)return null;let r=this.tryParseKeychainPayload(n);return r||Lg(`corruptFile`,`Warning: Keychain entry for profile "${e}" is unreadable.`),r}async setCredentials(e,t){if(!await this.checkKeychainAvailability())throw Error(`Keychain is not available`);let n=await this.getKeytar();if(!n)throw Error(`Keytar module not available`);let r=JSON.stringify(t);await n.setPassword(Fg,this.getAccount(e),r)}async deleteCredentials(e){if(!await this.checkKeychainAvailability())throw Error(`Keychain is not available`);let t=await this.getKeytar();if(!t)throw Error(`Keytar module not available`);await t.deletePassword(Fg,this.getAccount(e))}tryParseKeychainPayload(e){try{let t=JSON.parse(e);return zg(t)?t:null}catch{return null}}};const Q=new class{keychainStorage=null;fileStorage=new Hg;keychainAvailable=null;initPromise=null;shouldForceFileStorage(){return process.env.ENTRYDESK_FORCE_FILE_STORAGE?.toLowerCase()===`true`}async initializeStorage(){if(this.shouldForceFileStorage()){this.keychainAvailable=!1,this.keychainStorage=null;return}try{let e=new Ug,t=await e.isAvailable();this.keychainAvailable=t,this.keychainStorage=t?e:null}catch{this.keychainAvailable=!1,this.keychainStorage=null}!this.keychainAvailable&&!this.shouldForceFileStorage()&&(Rg()&&Lg(`keychain`,`Keychain unavailable. Falling back to file-based credentials.`),process.platform===`win32`&&Lg(`windowsFile`,`Warning: File-based credentials on Windows may be readable by other users.`))}async ensureInitialized(){if(this.shouldForceFileStorage()){this.keychainAvailable=!1,this.keychainStorage=null;return}this.keychainAvailable===null&&(this.initPromise??=this.initializeStorage(),await this.initPromise)}disableKeychain(){this.shouldForceFileStorage()||Lg(`keychain`,`Keychain error encountered. Falling back to file-based credentials.`),this.keychainAvailable=!1,this.keychainStorage=null}async getKeychainStorage(){return await this.ensureInitialized(),this.shouldForceFileStorage()?null:this.keychainAvailable?this.keychainStorage:null}async getCredentials(e){let t=await this.getKeychainStorage();if(!t)return this.fileStorage.getCredentials(e);try{let n=await t.getCredentials(e);if(n)return n}catch{return this.disableKeychain(),this.fileStorage.getCredentials(e)}let n=await this.fileStorage.getCredentials(e);if(n)try{await t.setCredentials(e,n),await this.fileStorage.deleteCredentials(e)}catch{}return n}async setCredentials(e,t){let n=await this.getKeychainStorage();if(!n){await this.fileStorage.setCredentials(e,t);return}try{await n.setCredentials(e,t),await this.fileStorage.deleteCredentials(e)}catch{this.disableKeychain(),await this.fileStorage.setCredentials(e,t)}}async deleteCredentials(e){let t=await this.getKeychainStorage();if(t)try{await t.deleteCredentials(e)}catch{this.disableKeychain()}await this.fileStorage.deleteCredentials(e)}},Wg={async saveAccessToken(e,t){let n=$.getEffectiveProfileName(t),r=await Q.getCredentials(n)??{};r.accessToken=e,await Q.setCredentials(n,r)},async getAccessToken(e){let t=$.getEffectiveProfileName(e);return(await Q.getCredentials(t))?.accessToken??null},async saveRefreshToken(e,t){let n=$.getEffectiveProfileName(t),r=await Q.getCredentials(n)??{};r.refreshToken=e,await Q.setCredentials(n,r)},async getRefreshToken(e){let t=$.getEffectiveProfileName(e);return(await Q.getCredentials(t))?.refreshToken??null},async saveEmail(e,t){let n=$.getEffectiveProfileName(t),r=await Q.getCredentials(n)??{};r.email=e,await Q.setCredentials(n,r)},async getEmail(e){let t=$.getEffectiveProfileName(e);return(await Q.getCredentials(t))?.email??null},async saveWorkspaceId(e,t){let n=$.getEffectiveProfileName(t),r=await Q.getCredentials(n)??{};r.workspaceId=e,await Q.setCredentials(n,r)},async getWorkspaceId(e){let t=$.getEffectiveProfileName(e);return(await Q.getCredentials(t))?.workspaceId??null},async saveAll(e,t){let n=$.getEffectiveProfileName(t);await Q.setCredentials(n,e)},async getAll(e){let t=$.getEffectiveProfileName(e);return Q.getCredentials(t)},async clear(e){let t=$.getEffectiveProfileName(e);await Q.deleteCredentials(t)},async moveProfileCredentials(e,t){let n=await Q.getCredentials(e);n&&(await Q.setCredentials(t,n),await Q.deleteCredentials(e))},async deleteProfileCredentials(e){await Q.deleteCredentials(e)},async isLoggedIn(e){let t=$.getEffectiveProfileName(e);return(await Q.getCredentials(t))?.accessToken!=null}};function Gg(){let e=process.env.X_WEB_PROXY_ID;return e?{"x-web-proxy-id":e}:{}}var Kg=class e{client;baseUrl;runtimeConfigCache;constructor(e,t){this.baseUrl=e||jg(t),Ng().ignoreSslErrors&&(process.env.NODE_TLS_REJECT_UNAUTHORIZED=`0`,process.env.DEBUG&&console.log(`[DEBUG] ApiClient: SSL certificate validation disabled`)),this.client=a.create({baseUrl:this.baseUrl.replace(/\/?$/,`/`),timeout:3e4,headers:Gg(),retry:{limit:3,methods:[`get`,`put`,`head`,`delete`,`options`,`trace`],statusCodes:[408,413,429,500,502,503,504]},hooks:{beforeError:[({error:e})=>(c(e)&&(e.request.headers.delete(`authorization`),e.request.headers.delete(`Authorization`),e.request.headers.delete(`x-web-proxy-id`)),e)]}})}getBaseUrl(){return this.baseUrl}async refreshOAuthToken(e){return this.client.post(`v1/oauth/token`,{json:{grant_type:`refresh_token`,refresh_token:e.refreshToken,client_id:e.clientId}}).json()}async revokeOAuthToken(e){await this.client.post(`v1/oauth/revoke`,{json:{token:e.token,token_type_hint:`refresh_token`,client_id:e.clientId}})}async getWorkspaces(e){try{return process.env.DEBUG&&console.log(`[DEBUG] Calling getWorkspaces API: ${this.baseUrl}/v1/workspaces`),await this.client.get(`v1/workspaces`,{headers:{Authorization:`Bearer ${e}`}}).json()}catch(e){throw process.env.DEBUG&&(console.error(`[DEBUG] getWorkspaces error:`,e),e instanceof Error&&`cause`in e&&console.error(`[DEBUG] Error cause:`,e.cause)),e}}async getAgents(e,t,n){let r={limit:n?.limit??100};return n?.nextKey&&(r.nextKey=n.nextKey),n?.search&&(r.search=n.search),await this.client.get(`v1/workspaces/${t}/availableAgents`,{headers:{Authorization:`Bearer ${e}`},searchParams:r}).json()}async createAgent(e,t,n){return await this.client.post(`v1/workspaces/${t}/agents`,{headers:{Authorization:`Bearer ${e}`},json:n}).json()}async updateAgent(e,t,n,r){await this.client.put(`v1/workspaces/${t}/agents/${n}`,{headers:{Authorization:`Bearer ${e}`},json:r})}async deleteAgent(e,t,n){await this.client.delete(`v1/workspaces/${t}/agents/${n}`,{headers:{Authorization:`Bearer ${e}`}})}async getMyAgents(e,t,n){let r={limit:n?.limit??100};return n?.nextKey&&(r.nextKey=n.nextKey),n?.search&&(r.search=n.search),await this.client.get(`v1/workspaces/${t}/myAgents`,{headers:{Authorization:`Bearer ${e}`},searchParams:r}).json()}async publishAgent(e,t,n){await this.client.post(`v1/workspaces/${t}/agents/${n}/publish`,{headers:{Authorization:`Bearer ${e}`}})}async getAgentGrants(e,t,n){return await this.client.get(`v1/workspaces/${t}/agents/${n}/grants`,{headers:{Authorization:`Bearer ${e}`}}).json()}async upsertAgentGrant(e,t,n,r,i){return await this.client.put(`v1/workspaces/${t}/agents/${n}/grants/${r}`,{headers:{Authorization:`Bearer ${e}`},json:{role:i}}).json()}async removeAgentGrant(e,t,n,r){await this.client.delete(`v1/workspaces/${t}/agents/${n}/grants/${r}`,{headers:{Authorization:`Bearer ${e}`}})}async getMeetings(e,t,n){let r={limit:n?.limit??20};return n?.nextKey&&(r.nextKey=n.nextKey),n?.search&&(r.search=n.search),n?.filter&&(r.filter=n.filter),n?.sortBy&&(r.sortBy=n.sortBy),await this.client.get(`v1/workspaces/${t}/meetings`,{headers:{Authorization:`Bearer ${e}`},searchParams:r}).json()}async getMeeting(e,t,n){return await this.client.get(`v1/workspaces/${t}/meetings/${n}`,{headers:{Authorization:`Bearer ${e}`}}).json()}async createMeeting(e,t,n){return await this.client.post(`v1/workspaces/${t}/meetings`,{headers:{Authorization:`Bearer ${e}`},json:n}).json()}async updateMeeting(e,t,n,r){return await this.client.patch(`v1/workspaces/${t}/meetings/${n}`,{headers:{Authorization:`Bearer ${e}`},json:r}).json()}async deleteMeeting(e,t,n){await this.client.delete(`v1/workspaces/${t}/meetings/${n}`,{headers:{Authorization:`Bearer ${e}`}})}async getMeetingPreviousBrief(e,t,n){return await this.client.get(`v1/workspaces/${t}/meetings/${n}/previous`,{headers:{Authorization:`Bearer ${e}`}}).json()}async getRecording(e,t,n){return await this.client.get(`v1/workspaces/${t}/recordings/${n}`,{headers:{Authorization:`Bearer ${e}`}}).json()}async getMeetingShares(e,t,n){return await this.client.get(`v1/workspaces/${t}/meetings/${n}/shares`,{headers:{Authorization:`Bearer ${e}`}}).json()}async upsertMeetingUserGrant(e,t,n,r,i){return await this.client.put(`v1/workspaces/${t}/meetings/${n}/shares/users/${r}`,{headers:{Authorization:`Bearer ${e}`},json:{role:i}}).json()}async removeMeetingUserGrant(e,t,n,r){await this.client.delete(`v1/workspaces/${t}/meetings/${n}/shares/users/${r}`,{headers:{Authorization:`Bearer ${e}`}})}async upsertMeetingTeamGrant(e,t,n,r,i){return await this.client.put(`v1/workspaces/${t}/meetings/${n}/shares/teams/${r}`,{headers:{Authorization:`Bearer ${e}`},json:{role:i}}).json()}async removeMeetingTeamGrant(e,t,n,r){await this.client.delete(`v1/workspaces/${t}/meetings/${n}/shares/teams/${r}`,{headers:{Authorization:`Bearer ${e}`}})}async getWorkflows(e,t,n){let r={limit:n?.limit??20};return n?.nextKey&&(r.nextKey=n.nextKey),n?.search&&(r.search=n.search),await this.client.get(`v1/workspaces/${t}/workflows`,{headers:{Authorization:`Bearer ${e}`},searchParams:r}).json()}async getWorkflow(e,t,n){return await this.client.get(`v1/workspaces/${t}/workflows/${n}`,{headers:{Authorization:`Bearer ${e}`}}).json()}async createWorkflow(e,t,n){return await this.client.post(`v1/workspaces/${t}/workflows`,{headers:{Authorization:`Bearer ${e}`},json:n}).json()}async updateWorkflow(e,t,n,r){await this.client.put(`v1/workspaces/${t}/workflows/${n}`,{headers:{Authorization:`Bearer ${e}`},json:r})}async triggerWorkflowRun(e,t,n,r){return await this.client.post(`v1/workspaces/${t}/workflows/${n}/runs`,{headers:{Authorization:`Bearer ${e}`},json:r===void 0?{}:{args:r}}).json()}async getWorkflowRuns(e,t,n,r){let i={limit:r?.limit??20};return r?.nextKey&&(i.nextKey=r.nextKey),await this.client.get(`v1/workspaces/${t}/workflows/${n}/runs`,{headers:{Authorization:`Bearer ${e}`},searchParams:i}).json()}async getWorkflowRun(e,t,n,r){return await this.client.get(`v1/workspaces/${t}/workflows/${n}/runs/${r}`,{headers:{Authorization:`Bearer ${e}`}}).json()}async getWorkflowGrants(e,t,n){return await this.client.get(`v1/workspaces/${t}/workflows/${n}/grants`,{headers:{Authorization:`Bearer ${e}`}}).json()}async upsertWorkflowGrant(e,t,n,r,i){return await this.client.put(`v1/workspaces/${t}/workflows/${n}/grants/${r}`,{headers:{Authorization:`Bearer ${e}`},json:{role:i}}).json()}async removeWorkflowGrant(e,t,n,r){await this.client.delete(`v1/workspaces/${t}/workflows/${n}/grants/${r}`,{headers:{Authorization:`Bearer ${e}`}})}async getNotifications(e,t,n){let r={limit:n?.limit??20};return n?.tab&&(r.tab=n.tab),n?.eventType&&(r.eventType=n.eventType),n?.cursor&&(r.cursor=n.cursor),await this.client.get(`v1/workspaces/${t}/notifications`,{headers:{Authorization:`Bearer ${e}`},searchParams:r}).json()}async getNotificationUnreadCount(e,t){return await this.client.get(`v1/workspaces/${t}/notifications/unreadCount`,{headers:{Authorization:`Bearer ${e}`}}).json()}async markNotificationRead(e,t,n){await this.client.post(`v1/workspaces/${t}/notifications/${n}/read`,{headers:{Authorization:`Bearer ${e}`}})}async markAllNotificationsRead(e,t){await this.client.post(`v1/workspaces/${t}/notifications/readAll`,{headers:{Authorization:`Bearer ${e}`}})}async getRuntimeConfig(){if(this.runtimeConfigCache)return this.runtimeConfigCache;let e=await this.client.get(`v1/runtimeConfig`).json();return this.runtimeConfigCache=e,e}async getModels(e,t){return await this.client.get(`v1/workspaces/${t}/models`,{headers:{Authorization:`Bearer ${e}`}}).json()}async getWorkspaceConfig(e,t){return await this.client.get(`v1/workspaces/${t}/config`,{headers:{Authorization:`Bearer ${e}`}}).json()}async getModelTiers(e,t){return await this.client.get(`v1/workspaces/${t}/modelTiers`,{headers:{Authorization:`Bearer ${e}`}}).json()}async listSelectableModels(e,t){let{deploymentMode:n}=await this.getRuntimeConfig(),{models:r}=n===`saas`?await this.getModelTiers(e,t):await this.getModels(e,t);return{models:r.filter(e=>e.enabled!==!1)}}async getConnectors(e,t,n){let r={limit:n?.limit??100,connectionStatus:n?.connectionStatus??`connected`};return n?.search&&(r.search=n.search),n?.nextKey&&(r.nextKey=n.nextKey),await this.client.get(`v1/workspaces/${t}/availableConnectors`,{headers:{Authorization:`Bearer ${e}`},searchParams:r}).json()}async getConnectorTools(e,t,n){return this.client.get(`v1/workspaces/${t}/connectors/${n}/tools`,{headers:{Authorization:`Bearer ${e}`}}).json()}async connectConnectorToken(e,t,n,r){await this.client.put(`v1/workspaces/${t}/connectors/${n}/token`,{headers:{Authorization:`Bearer ${e}`},json:r})}async getConnectorAuthUrl(e,t,n){return this.client.post(`v1/workspaces/${t}/connectors/${n}/authUrl`,{headers:{Authorization:`Bearer ${e}`},json:{}}).json()}async createCustomConnector(e,t,n){return this.client.post(`v1/workspaces/${t}/customConnectors`,{headers:{Authorization:`Bearer ${e}`},json:n}).json()}async disconnectConnector(e,t,n){await this.client.delete(`v1/workspaces/${t}/connectors/${n}/token`,{headers:{Authorization:`Bearer ${e}`}})}async getTasks(e,t,n=20){return await this.client.get(`v1/workspaces/${t}/tasks`,{headers:{Authorization:`Bearer ${e}`},searchParams:{limit:n}}).json()}async searchTasks(e,t,n,r){let i={q:n,limit:r?.limit??20};return r?.nextKey&&(i.nextKey=r.nextKey),await this.client.get(`v1/workspaces/${t}/tasks/search`,{headers:{Authorization:`Bearer ${e}`},searchParams:i}).json()}async getMessages(e,t,n,r=50){return await this.client.get(`v1/workspaces/${t}/tasks/${n}/messages`,{headers:{Authorization:`Bearer ${e}`},searchParams:{limit:r}}).json()}async getAgent(e,t,n){return await this.client.get(`v1/workspaces/${t}/agents/${n}`,{headers:{Authorization:`Bearer ${e}`}}).json()}async listAvailableSkills(e,t,n){return await this.client.get(`v1/workspaces/${t}/availableSkills`,{headers:{Authorization:`Bearer ${e}`},searchParams:{createdBy:n?.createdBy,nextKey:n?.nextKey,limit:n?.limit??20}}).json()}async uploadSkill(e,t,n){return await this.client.post(`v1/workspaces/${t}/skills`,{headers:{Authorization:`Bearer ${e}`},body:n}).json()}async deleteSkill(e,t,n){await this.client.delete(`v1/workspaces/${t}/skills/${n}`,{headers:{Authorization:`Bearer ${e}`}})}async updateSkillPreference(e,t,n,r){return await this.client.patch(`v1/workspaces/${t}/skills/${n}/preference`,{headers:{Authorization:`Bearer ${e}`},json:{isEnabled:r}}).json()}async getSkillVersions(e,t,n){return await this.client.get(`v1/workspaces/${t}/skills/${n}/versions`,{headers:{Authorization:`Bearer ${e}`}}).json()}async getSkillGrants(e,t,n){return await this.client.get(`v1/workspaces/${t}/skills/${n}/grants`,{headers:{Authorization:`Bearer ${e}`}}).json()}async upsertSkillGrant(e,t,n,r,i){return await this.client.put(`v1/workspaces/${t}/skills/${n}/grants/${r}`,{headers:{Authorization:`Bearer ${e}`},json:{role:i}}).json()}async removeSkillGrant(e,t,n,r){await this.client.delete(`v1/workspaces/${t}/skills/${n}/grants/${r}`,{headers:{Authorization:`Bearer ${e}`}})}async downloadSkillCurrent(e,t,n){return await this.client.get(`v1/workspaces/${t}/skills/${n}/download`,{headers:{Authorization:`Bearer ${e}`}}).json()}async task(e,t,n,r){try{let i=await this.client.post(`v1/workspaces/${t}/tasks`,{headers:{Authorization:`Bearer ${e}`},json:n,timeout:6e4,throwHttpErrors:!1});if(!i.ok){let e=await i.text();throw Error(`Task API failed (${i.status}): ${e}`)}let a=await i.json();return r?.(),a.noop||!a.streamId?new Response(`data: [DONE]
71
-
72
- `,{headers:{"Content-Type":`text/event-stream`}}):await this.taskStream(e,t,a.taskId)}catch(e){throw e instanceof s?TypeError(`Request timed out. Check your connection and try again.`,{cause:e}):e}}async taskStream(e,t,n){let r=await this.client.get(`v1/workspaces/${t}/tasks/${n}/stream`,{headers:{Authorization:`Bearer ${e}`,Accept:`text/event-stream`},timeout:!1,throwHttpErrors:!1});if(!r.ok){let e=await r.text();throw Error(`Task stream failed (${r.status}): ${e}`)}return r}resumeTaskStream(e,t,n){return this.taskStream(e,t,n)}async getSubagentRun(e,t,n,r){return this.client.get(`v1/workspaces/${t}/subagentRuns/${n}`,{headers:{Authorization:`Bearer ${e}`},signal:r}).json()}async openSubagentRunEvents(e,t,n,r){let i=await this.client.get(`v1/workspaces/${t}/subagentRuns/${n}/events`,{headers:{Authorization:`Bearer ${e}`,Accept:`text/event-stream`},timeout:!1,throwHttpErrors:!1,signal:r});if(!i.ok){let e=await i.text();throw Error(`Subagent run events stream failed (${i.status}): ${e}`)}return i}async listBackgroundRuns(e,t,n){return this.client.get(`v1/workspaces/${t}/tasks/${n}/backgroundRuns`,{headers:{Authorization:`Bearer ${e}`}}).json()}async stopBackgroundRun(e,t,n,r,i){let a=Bh(i);return(await this.client.post(`v1/workspaces/${t}/tasks/${n}/${a}/${r}/stop`,{headers:{Authorization:`Bearer ${e}`}})).status===202?`stopping`:`already-finished`}async openWakeEvents(e,t,n,r){let i=await this.client.get(`v1/workspaces/${t}/tasks/${n}/wakeEvents`,{headers:{Authorization:`Bearer ${e}`,Accept:`text/event-stream`},timeout:!1,throwHttpErrors:!1,signal:r});if(!i.ok){let e=await i.text();throw Error(`Wake events stream failed (${i.status}): ${e}`)}return i}async getBudget(e,t){return await this.client.get(`v1/workspaces/${t}/budget`,{headers:{Authorization:`Bearer ${e}`}}).json()}async updateBudget(e,t,n){await this.client.put(`v1/workspaces/${t}/budget`,{headers:{Authorization:`Bearer ${e}`},json:{budget:n}})}async getMonthlyUsages(e,t,n){return await this.client.get(`v1/workspaces/${t}/monthlyUsages`,{headers:{Authorization:`Bearer ${e}`},searchParams:{nextKey:n?.nextKey,limit:n?.limit??20}}).json()}async getBillingOverview(e,t){return await this.client.get(`v1/workspaces/${t}/billing/overview`,{headers:{Authorization:`Bearer ${e}`}}).json()}async getBillingInvoices(e,t,n){let r={limit:n?.limit??20};return n?.nextKey&&(r.nextKey=n.nextKey),await this.client.get(`v1/workspaces/${t}/billing/invoices`,{headers:{Authorization:`Bearer ${e}`},searchParams:r}).json()}async getUsageOverview(e,t){return await this.client.get(`v1/workspaces/${t}/usage/overview`,{headers:{Authorization:`Bearer ${e}`}}).json()}async getUsageMe(e,t){return await this.client.get(`v1/workspaces/${t}/usage/me`,{headers:{Authorization:`Bearer ${e}`}}).json()}async getUsageConsumptions(e,t,n){let r={limit:n?.limit??20,offset:n?.offset??0};return n?.periodStart&&(r.periodStart=n.periodStart),await this.client.get(`v1/workspaces/${t}/usage/consumptions`,{headers:{Authorization:`Bearer ${e}`},searchParams:r}).json()}async exportUsageCsv(e,t,n){let r={};return n&&(r.periodStart=n),await this.client.get(`v1/workspaces/${t}/usage/export`,{headers:{Authorization:`Bearer ${e}`},searchParams:r}).text()}async createTaskShare(e,t,n,r=`public`){try{return await this.client.post(`v1/workspaces/${t}/tasks/${n}/shares`,{headers:{Authorization:`Bearer ${e}`},json:{visibility:r}}).json()}catch(e){if(c(e)&&e.response.status===403){let t=await e.response.json().catch(()=>null);if(t?.code===`sharing_disabled`)throw Error(`Sharing is turned off for this workspace by an admin.`,{cause:e});if(t?.code===`share_visibility_not_allowed`)throw Error(`Public sharing is turned off for this workspace by an admin.`,{cause:e})}throw e}}async getSharedTask(e,t){let n={};return t&&(n.Authorization=`Bearer ${t}`),await this.client.get(`v1/shares/${e}`,{headers:n}).json()}async getSharedMessages(e,t=50,n){let r={};return n&&(r.Authorization=`Bearer ${n}`),await this.client.get(`v1/shares/${e}/messages`,{headers:r,searchParams:{limit:t}}).json()}async deleteTask(e,t,n){await this.client.delete(`v1/workspaces/${t}/tasks/${n}`,{headers:{Authorization:`Bearer ${e}`}})}async getModelProviders(e,t){return await this.client.get(`v1/workspaces/${t}/modelProviders`,{headers:{Authorization:`Bearer ${e}`}}).json()}async uploadFile(e,t,n,r){let i=new FormData,a=new Blob([n.buffer],{type:n.mimeType});return i.append(`file`,a,n.filename),i.append(`modelProviderId`,r),await this.client.post(`v1/workspaces/${t}/files`,{headers:{Authorization:`Bearer ${e}`},body:i,timeout:12e4}).json()}async getCalendarAccounts(e,t){return await this.client.get(`v1/workspaces/${t}/calendar/accounts`,{headers:{Authorization:`Bearer ${e}`}}).json()}async getSchedules(e,t,n){let r={limit:n?.limit??20};return n?.nextKey&&(r.nextKey=n.nextKey),n?.search&&(r.search=n.search),await this.client.get(`v1/workspaces/${t}/schedules`,{headers:{Authorization:`Bearer ${e}`},searchParams:r}).json()}async getSchedule(e,t,n){return await this.client.get(`v1/workspaces/${t}/schedules/${n}`,{headers:{Authorization:`Bearer ${e}`}}).json()}async createSchedule(e,t,n){return await this.client.post(`v1/workspaces/${t}/schedules`,{headers:{Authorization:`Bearer ${e}`},json:n}).json()}async updateSchedule(e,t,n,r){await this.client.put(`v1/workspaces/${t}/schedules/${n}`,{headers:{Authorization:`Bearer ${e}`},json:r})}async deleteSchedule(e,t,n){await this.client.delete(`v1/workspaces/${t}/schedules/${n}`,{headers:{Authorization:`Bearer ${e}`}})}async activateSchedule(e,t,n){await this.client.post(`v1/workspaces/${t}/schedules/${n}/activate`,{headers:{Authorization:`Bearer ${e}`}})}async deactivateSchedule(e,t,n){await this.client.post(`v1/workspaces/${t}/schedules/${n}/deactivate`,{headers:{Authorization:`Bearer ${e}`}})}async runScheduleNow(e,t,n){return await this.client.post(`v1/workspaces/${t}/schedules/${n}/run`,{headers:{Authorization:`Bearer ${e}`}}).json()}async getScheduleRuns(e,t,n,r){let i={limit:r?.limit??20};return r?.nextKey&&(i.nextKey=r.nextKey),await this.client.get(`v1/workspaces/${t}/schedules/${n}/runs`,{headers:{Authorization:`Bearer ${e}`},searchParams:i}).json()}async listRecordings(e,t,n){let r={limit:n?.limit??20};return n?.nextKey&&(r.nextKey=n.nextKey),n?.search&&(r.search=n.search),this.client.get(`v1/workspaces/${t}/recordings`,{headers:{Authorization:`Bearer ${e}`},searchParams:r}).json()}async importRecordingMedia(e,t,n){return this.client.post(`v1/workspaces/${t}/recordings/import/media`,{headers:{Authorization:`Bearer ${e}`},json:n}).json()}async previewRecordingMedia(e,t,n){let r={url:n};return this.client.get(`v1/workspaces/${t}/recordings/preview/media`,{headers:{Authorization:`Bearer ${e}`},searchParams:r}).json()}async getRecordingAudioUrl(e,t,n){return this.client.get(`v1/workspaces/${t}/recordings/${n}/audioUrl`,{headers:{Authorization:`Bearer ${e}`}}).json()}async retryRecording(e,t,n){return this.client.post(`v1/workspaces/${t}/recordings/${n}/retry`,{headers:{Authorization:`Bearer ${e}`}}).json()}async deleteRecording(e,t,n){await this.client.delete(`v1/workspaces/${t}/recordings/${n}`,{headers:{Authorization:`Bearer ${e}`}})}async searchMarketplace(e){let t={};return e?.type&&(t.type=e.type),e?.tag&&(t.tag=e.tag),e?.limit&&(t.limit=e.limit),e?.cursor&&(t.cursor=e.cursor),this.client.get(`v1/marketplace/resources`,{searchParams:t}).json()}async getMarketplaceAgent(e){return this.client.get(`v1/marketplace/agents/${encodeURIComponent(e)}`).json()}async getMarketplaceSkill(e){return this.client.get(`v1/marketplace/skills/${encodeURIComponent(e)}`).json()}async listMarketplaceRoles(){return this.client.get(`v1/marketplace/roles`).json()}async installMarketplaceResource(e,t,n,r,i){return this.client.post(`v1/workspaces/${t}/marketplace/${n}s/${encodeURIComponent(r)}/install`,{headers:{Authorization:`Bearer ${e}`},json:{toolApprovalMode:i}}).json()}static async getAuthenticatedClient(t){let n=await Wg.getAll(t);return n?{client:new e(void 0,t),accessToken:n.accessToken,workspaceId:n.workspaceId??null}:null}};function qg(){return process.env.ENTRYDESK_SANDBOX===`true`}function Jg(){if(!qg())return null;let e=process.env.ENTRYDESK_SANDBOX_ACCESS_TOKEN?.trim(),t=process.env.ENTRYDESK_SANDBOX_WORKSPACE_ID?.trim();if(!e||!t){let n=[];throw e||n.push(`ENTRYDESK_SANDBOX_ACCESS_TOKEN`),t||n.push(`ENTRYDESK_SANDBOX_WORKSPACE_ID`),Error(`Sandbox mode enabled but missing credentials: ${n.join(`, `)}`)}return{accessToken:e,workspaceId:t}}function Yg(){return!!process.env.ENTRYDESK_TOKEN?.trim()}function Xg(){let e=process.env.ENTRYDESK_TOKEN?.trim();if(!e)return null;let t=process.env.ENTRYDESK_WORKSPACE_ID?.trim();if(!t)throw Error(`ENTRYDESK_TOKEN is set but ENTRYDESK_WORKSPACE_ID is missing. Both are required for PAT authentication.`);return{accessToken:e,workspaceId:t}}const Zg=`sandbox environment (ENTRYDESK_SANDBOX)`;function Qg(){let e=Jg();if(e)return{authSource:`sandbox-env`,label:Zg,workspaceId:e.workspaceId};let t=Xg();return t?{authSource:`pat-env`,label:`personal access token (ENTRYDESK_TOKEN)`,workspaceId:t.workspaceId}:null}function $g(e){if(typeof e!=`object`||!e)return{error:``};let t=e;return{code:typeof t.code==`string`?t.code:void 0,error:typeof t.error==`string`?t.error:``}}const e_=/^[a-z0-9_.-]{1,64}$/iu;function t_(e){let t=$g(e).code;return t&&e_.test(t)?t:void 0}function n_(e){return[...e].filter(e=>{let t=e.codePointAt(0)??0;return!(t<=31)&&t!==127&&!(t>=128&&t<=159)}).join(``)}const r_=`entrydesk-cli`;function i_(e,t){let n=new Set(t.split(/[\s,]+/).filter(Boolean)),r=e.split(` `).filter(Boolean);return{rejected:r.filter(e=>n.has(e)),remaining:r.filter(e=>!n.has(e))}}async function a_(e,t,n){try{return await e.post(`v1/oauth/device/code`,{json:{client_id:r_,scope:t}}).json()}catch(r){if(!(r instanceof o))throw r;let{code:i,error:a}=$g(r.data);if(i===`invalid_scope`){let{rejected:r,remaining:i}=i_(t,a);if(r.length>0&&i.length>0)return n?.onWarning?.(`This server doesn't support these scopes: ${r.join(`, `)}. Continuing without them — commands that need them may be unavailable.`),e.post(`v1/oauth/device/code`,{json:{client_id:r_,scope:i.join(` `)}}).json()}throw Error(a?`Failed to request device code: ${a}`:`Failed to request device code`,{cause:r})}}const o_=new Set([`localhost`,`0.0.0.0`,`::`,`::1`]);function s_(e){let t=e.replace(/^\[|\]$/gu,``).replace(/\.$/u,``).toLowerCase(),n=t.replace(/^::ffff:/u,``);return o_.has(t)||/^127(?:\.\d{1,3}){3}$/u.test(n)||t.startsWith(`::ffff:7f`)}const c_=/^[A-Za-z0-9\-._~/]*$/u,l_=/^[A-Za-z0-9-]{1,64}$/u;function u_(e,t,n){let r=null;if(e)try{let t=new URL(e);(t.protocol===`https:`||t.protocol===`http:`)&&t.username===``&&t.password===``&&t.hostname!==``&&!s_(t.hostname)&&c_.test(t.pathname)&&(r=new URL(t.pathname,t.origin))}catch{}return r??=new URL(`/oauth/device`,t),l_.test(n)&&r.searchParams.set(`user_code`,n),r.toString()}function d_(e){return new Promise((t,n)=>{let r=process.platform,i,a;switch(r){case`darwin`:i=`open`,a=[e];break;case`win32`:i=`cmd`,a=[`/c`,`start`,``,e];break;default:i=`xdg-open`,a=[e];break}d(i,a,r=>{r?n(Error(`Could not open the browser. Visit this URL to continue: ${e}`,{cause:r})):t()})})}async function f_(e){let t=jg(),n=Mg(),r=Ng(),i=process.env.NODE_TLS_REJECT_UNAUTHORIZED;r.ignoreSslErrors&&(process.env.NODE_TLS_REJECT_UNAUTHORIZED=`0`,console.error(`WARNING: SSL certificate validation is disabled globally for this process during the login flow. All connections in this process will skip TLS verification. Only use ENTRYDESK_IGNORE_SSL_ERRORS for local development.`));try{let r=a.create({baseUrl:t.replace(/\/?$/,`/`),timeout:3e4,headers:Gg(),hooks:{beforeError:[({error:e})=>(c(e)&&(e.request.headers.delete(`authorization`),e.request.headers.delete(`Authorization`),e.request.headers.delete(`x-web-proxy-id`)),e)]}}),i;try{i=await a_(r,`offline_access workspaces:read tasks:read tasks:write tasks:delete agents:read agents:write connectors:read connectors:write tools:read tools:execute skills:read skills:write meetings:read meetings:write workflows:read workflows:write notifications:read notifications:write publishes:read publishes:write calendar:read calendar:write schedules:read schedules:write user:read user:write`,e)}catch(t){let n=t instanceof Error?t:Error(`Failed to request device code`);throw e?.onError?.(n),n}let{device_code:s,user_code:l,expires_in:u,interval:d}=i,ee=u_(i.verification_uri,n,l);e?.onDeviceCodeReceived?.(l,ee),e?.onBrowserOpening?.();try{await d_(ee)}catch(e){process.env.DEBUG&&console.error(`[DEBUG] Failed to open browser:`,e)}e?.onWaitingForAuthorization?.();let m=Math.max(d,5)*1e3,te=Date.now()+u*1e3;for(;Date.now()<te;){await f(m);try{let t=await r.post(`v1/oauth/token`,{json:{grant_type:`urn:ietf:params:oauth:grant-type:device_code`,device_code:s,client_id:r_}}).json();e?.onAuthorized?.();let n={};try{n=p(t.access_token)}catch{}return{accessToken:t.access_token,refreshToken:t.refresh_token??void 0,email:n.email||``,scopes:t.scope.split(` `).filter(e=>e.length>0)}}catch(t){if(t instanceof o){let{code:e,error:n}=$g(t.data),r=e||n;if(!r)continue;switch(r){case`authorization_pending`:continue;case`slow_down`:m+=5e3;continue;case`access_denied`:throw Error(`Authorization denied.`,{cause:t});case`expired_token`:throw Error("Device code expired. Run `entrydesk login` again.",{cause:t});default:throw Error(`Authorization failed: ${r||`Unknown error`}`,{cause:t})}}let n=t instanceof Error?t:Error(`Unknown error during authorization`);throw e?.onError?.(n),n}}throw Error("Device code expired. Run `entrydesk login` again.")}finally{i===void 0?delete process.env.NODE_TLS_REJECT_UNAUTHORIZED:process.env.NODE_TLS_REJECT_UNAUTHORIZED=i}}function p_(e){if(e instanceof o){let t=e.response.status;return t===400||t===401}return!1}var m_=class extends Error{code;constructor(e,t){super(t),this.name=`AuthError`,this.code=e}};function h_(e){try{let t=e.split(`.`);if(t.length<2)return null;let n=t[1].replace(/-/g,`+`).replace(/_/g,`/`),r=(4-n.length%4)%4,i=n.padEnd(n.length+r,`=`),a=Buffer.from(i,`base64`).toString(`utf8`);return JSON.parse(a)}catch{return null}}function g_(e,t=300){let n=h_(e)?.exp;return typeof n==`number`&&n-Math.floor(Date.now()/1e3)<=t}async function __(e){let t=e.accessToken;if(!g_(t))return t;if(!e.refreshToken)throw await Wg.clear(),new m_(`session-expired`,"Session expired. Run `entrydesk login` again.");let n=e.refreshToken;try{let t=await new Kg().refreshOAuthToken({refreshToken:n,clientId:r_}),r=await Wg.getAll();return r?.accessToken&&r.refreshToken&&r.refreshToken!==n?r.accessToken:(await Wg.saveAll({...r??e,accessToken:t.access_token,refreshToken:t.refresh_token??r?.refreshToken??n}),t.access_token)}catch(e){if(!p_(e))throw new m_(`refresh-failed`,`Could not refresh your session — the auth server is unreachable. Try again in a moment.`);let t=await Wg.getAll();if(t?.accessToken&&t.refreshToken&&t.refreshToken!==n)return t.accessToken;throw await Wg.clear(),new m_(`session-expired`,"Session expired. Run `entrydesk login` again.")}}async function v_(){let e=Jg();if(e)return e.accessToken;let t=await Wg.getAll();if(!t?.accessToken)throw new m_(`not-logged-in`,"Not logged in. Run `entrydesk login` first.");return __(t)}async function y_(){let e=Jg();if(e)return{accessToken:e.accessToken,workspaceId:e.workspaceId};let t=Xg();if(t)return t;let n=await Wg.getAll();if(!n?.accessToken)throw new m_(`not-logged-in`,"Not logged in. Run `entrydesk login` first.");if(!n.workspaceId)throw new m_(`no-workspace`,"No workspace selected. Run `entrydesk workspaces` first.");return{accessToken:await __(n),workspaceId:n.workspaceId}}function b_(e){let t=``;try{t=` by ${jg()}`}catch{}let n=t_(e.data),r=n?` (server code: ${n})`:``,i;return i=n===`missing_token`||n===`bearer_not_supported`?process.env.ENTRYDESK_API_URL?`The API did not accept your Authorization header (stripped or refused en route) — the URL likely points at a browser-facing proxy path (such as a Hub "/api" URL). It comes from the ENTRYDESK_API_URL environment variable, which overrides profile config — update or unset ENTRYDESK_API_URL.`:'The API did not accept your Authorization header (stripped or refused en route) — the URL likely points at a browser-facing proxy path (such as a Hub "/api" URL). Set apiUrl to the API server URL with `entrydesk config set apiUrl <url>`.':qg()?`Requests are authenticated via ${Zg} — ask the sandbox owner to issue fresh credentials.`:Yg()?"ENTRYDESK_TOKEN is set and takes priority over `entrydesk login` credentials for workspace commands — unset it or replace it with a valid token; if this command does not use it, run `entrydesk login`.":"Your session may have expired — run `entrydesk login`. If this is not the environment you expect, check `entrydesk config get apiUrl`.",`Not authorized (401)${t}${r}. ${i}`}function x_(e){let t=Math.round(e/1e3);return t%60==0&&t>=60?`${t/60}m`:`${t}s`}function S_(e){return e instanceof Error&&e.name===`SdkError`&&`code`in e&&e.code===`REQUEST_TIMEOUT`}function C_(){let{requestTimeout:e,requestMaxTotalTimeout:t}=Pg();return`The request timed out after ${x_(e)} without a response or progress update (absolute cap ${x_(t)}). Raise the limit with ${Dg}=<milliseconds>, and ${Og}=<milliseconds> for the absolute cap.`}var w_=class extends Error{exitCode;cause;constructor(e,t=1,n){super(e),this.exitCode=t,this.cause=n,this.name=`CLIError`}};function T_(e){let t=!!process.env.DEBUG;if(e instanceof w_&&(console.error(`Error: ${e.message}`),e.cause&&(console.error(`Cause: ${e.cause.message}`),t&&e.cause.stack&&console.error(e.cause.stack)),process.exit(e.exitCode)),e instanceof m_&&(console.error(e.message),t&&e.stack&&console.error(e.stack),process.exit(1)),S_(e)&&(console.error(C_()),t&&e instanceof Error&&e.stack&&console.error(e.stack),process.exit(1)),e instanceof s&&(console.error(`Request timed out. Check your connection and try again.`),t&&e.stack&&console.error(e.stack),process.exit(1)),e instanceof o){let n=e.response.status;if(n===401)console.error(b_(e));else if(n===403)console.error("Forbidden (403). Your account or token lacks permission for this action. If your token predates a recently added feature, run `entrydesk login` to refresh its scopes; otherwise you may lack permission in this workspace.");else{let t=$g(e.data),r=t_(e.data),i=r?` (server code: ${r})`:``,a=n_(t.error),o=n_(e.response.statusText);console.error(`Request failed (${n}): ${a||o}${i}`)}t&&e.stack&&console.error(e.stack),process.exit(1)}e instanceof Error&&(console.error(`Unexpected error: ${e.message}`),t&&e.stack&&console.error(e.stack),process.exit(1)),console.error(`An unknown error occurred`),process.exit(1)}const E_=`default`,D_=/^[A-Za-z0-9_-]+$/;let O_=null;function k_(){return i.join(r.homedir(),`.entrydesk`)}function A_(){return i.join(k_(),`profiles`)}function j_(){return i.join(k_(),`profiles.json`)}function M_(e){return i.join(A_(),e)}function N_(e){if(n.existsSync(e))try{n.chmodSync(e,448)}catch{}else n.mkdirSync(e,{mode:448,recursive:!0})}function P_(){N_(k_())}function F_(){N_(A_())}function I_(){let e=j_();try{if(!n.existsSync(e))return null;let t=n.readFileSync(e,`utf-8`);return JSON.parse(t)}catch{return null}}function L_(e){P_();let t=j_();n.writeFileSync(t,JSON.stringify(e,null,2),{mode:384});try{n.chmodSync(t,384)}catch{}}function R_(e){let t=e.profiles?.length?[...new Set(e.profiles)]:[],n=e.currentProfile&&t.includes(e.currentProfile)?e.currentProfile:t[0]||E_;return t.length===0&&t.push(E_),t.includes(n)||t.unshift(n),{currentProfile:n,profiles:t}}function z_(e){F_(),N_(M_(e))}function B_(){let e=I_();if(!e){let e={currentProfile:E_,profiles:[E_]};return L_(e),F_(),z_(E_),e}let t=R_(e);return(t.currentProfile!==e.currentProfile||t.profiles.length!==e.profiles.length)&&L_(t),F_(),t}function V_(e){if(!e)throw new w_(`Profile name is required.`);if(!D_.test(e))throw new w_(`Invalid profile name. Use letters, numbers, dash, or underscore.`)}function H_(e,t){if(!e.profiles.includes(t))throw new w_(`Profile not found: ${t}`)}function U_(e,t){if(e.profiles.includes(t))throw new w_(`Profile already exists: ${t}`)}const $={DEFAULT_PROFILE:E_,setOverrideProfile(e){O_=e},getOverrideProfile(){return O_},getProfileDir(e){return M_(e)},getProfileConfigFile(e){return i.join($.getProfileDir(e),`config.json`)},getProfileCredentialsFile(e){return i.join($.getProfileDir(e),`credentials.json`)},getProfileNames(){return[...B_().profiles]},getProfileCount(){return $.getProfileNames().length},getCurrentProfileName(){return B_().currentProfile},getEffectiveProfileName(e){let t=B_(),n=e||O_||t.currentProfile;return V_(n),H_(t,n),n},ensureProfileExists(e){let t=B_();V_(e),H_(t,e)},createProfile(e){V_(e);let t=B_();U_(t,e),L_({currentProfile:t.currentProfile,profiles:[...t.profiles,e]}),z_(e)},deleteProfile(e){V_(e);let t=B_();if(H_(t,e),t.profiles.length===1)throw new w_(`Cannot delete the last profile.`);let r=t.profiles.filter(t=>t!==e),i=t.currentProfile;i===e&&(i=r.includes(E_)?E_:r[0]),L_({currentProfile:i,profiles:r});try{n.rmSync($.getProfileDir(e),{recursive:!0,force:!0})}catch{}return{currentProfile:i}},renameProfile(e,t){V_(e),V_(t);let r=B_();H_(r,e),U_(r,t);let i=M_(e),a=M_(t);if(n.existsSync(i))try{n.renameSync(i,a)}catch(e){throw new w_(`Failed to rename profile directory.`,1,e)}else z_(t);let o=r.profiles.map(n=>n===e?t:n),s=r.currentProfile===e?t:r.currentProfile;return L_({currentProfile:s,profiles:o}),{currentProfile:s}},setCurrentProfile(e){V_(e);let t=B_();H_(t,e),L_({currentProfile:e,profiles:t.profiles}),z_(e)},ensureProfileDir:z_};export{Kc as $,Hh as A,df as B,jg as C,wg as D,Pg as E,$f as F,Kd as G,nf as H,Rf as I,Td as J,Od as K,Qf as L,nm as M,Bp as N,Eg as O,xp as P,ol as Q,mf as R,Wg as S,Mg as T,gf as U,_f as V,Jd as W,Hl as X,Ed as Y,nl as Z,Jg as _,T_ as a,$c as at,Kg as b,v_ as c,uc as ct,__ as d,rc as dt,Qc as et,r_ as f,sc as ft,Qg as g,Zg as h,C_ as i,Yc as it,sh as j,Uh as k,y_ as l,cc as lt,n_ as m,k_ as n,tl as nt,S_ as o,Jc as ot,f_ as p,oc as pt,yd as q,w_ as r,el as rt,m_ as s,_c as st,$ as t,qc as tt,g_ as u,W as ut,Xg as v,Ag as w,Gg as x,Yg as y,hf as z};