@objectstack/console 7.1.0 → 7.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/dist/assets/{AiPendingActionsPage-DfPQB-bV.js → AiPendingActionsPage-DYX4ANzZ.js} +1 -1
  2. package/dist/assets/ApiConsolePage-C70S6MYv.js +1 -0
  3. package/dist/assets/{AppManagementPage-DuIaI8a2.js → AppManagementPage-BnwBNW_m.js} +1 -1
  4. package/dist/assets/ApprovalsInboxPage-CQQmK4Pz.js +1 -0
  5. package/dist/assets/{AuditLogPage-CDXmY4Lg.js → AuditLogPage-C1CgKWC8.js} +1 -1
  6. package/dist/assets/ComponentNavView-g_X1YUdk.js +1 -0
  7. package/dist/assets/{ConsoleFloatingChatbot-c1A9X4w7.js → ConsoleFloatingChatbot-DJW7zeKU.js} +1 -1
  8. package/dist/assets/{DeveloperHubPage-E4ydudW4.js → DeveloperHubPage-CcV4mWRr.js} +1 -1
  9. package/dist/assets/FlowRunsPage-Rtd6u1e_.js +1 -0
  10. package/dist/assets/MonacoImpl-DcAVOHcx.js +1 -0
  11. package/dist/assets/{ProfilePage-4wnWye8l.js → ProfilePage-DPGkAZWG.js} +1 -1
  12. package/dist/assets/PublicFormsPage-BNIOSFr1.js +1 -0
  13. package/dist/assets/RecentItemsProvider-Dt0K6V1V.js +1 -0
  14. package/dist/assets/{SettingsHub-B4d9Pn8t.js → SettingsHub-4RDkAyKq.js} +1 -1
  15. package/dist/assets/{SettingsView-cRQBVn6H.js → SettingsView-_5h2mExc.js} +1 -1
  16. package/dist/assets/{SystemHubPage-DIKmhwy1.js → SystemHubPage-DRRxgNWV.js} +1 -1
  17. package/dist/assets/data-adapter-Bi1Re1fK.js +1 -0
  18. package/dist/assets/dist-Dal4BOHf.js +11 -0
  19. package/dist/assets/{framework-ClI3DbWX.js → framework-DVkqUSPj.js} +4 -4
  20. package/dist/assets/{highlighted-body-OFNGDK62-Dynkkk0t.js → highlighted-body-OFNGDK62-Dp9QBuY-.js} +1 -1
  21. package/dist/assets/index-DWtLSzKK.js +33 -0
  22. package/dist/assets/index-JLLCOoA3.css +2 -0
  23. package/dist/assets/infrastructure-IQKE4Vv8.js +3 -0
  24. package/dist/assets/mermaid-GHXKKRXX-PDO-QkSF.js +1 -0
  25. package/dist/assets/plugin-calendar-D1wyyvEx.js +1 -0
  26. package/dist/assets/{plugin-charts-Mt2y8Sdm.js → plugin-charts-DrCI3cJo.js} +2 -2
  27. package/dist/assets/{plugin-chatbot-DXGXTdLU.js → plugin-chatbot-CiVctLlf.js} +8 -8
  28. package/dist/assets/plugin-dashboard-BRn9AjyQ.js +3 -0
  29. package/dist/assets/{plugin-form-BBc-xwrZ.js → plugin-form-KOOMD5ZY.js} +1 -1
  30. package/dist/assets/plugin-gantt-D3OFukY1.js +1 -0
  31. package/dist/assets/plugin-grid-DGQxmfxn.js +6 -0
  32. package/dist/assets/plugin-kanban-C-qMP4VL.js +1 -0
  33. package/dist/assets/plugin-map-DRf0LmJy.js +1 -0
  34. package/dist/assets/plugin-markdown-BVFW0U6V.js +7 -0
  35. package/dist/assets/plugin-report-CJSBthhg.js +59 -0
  36. package/dist/assets/plugin-timeline-RAn1F_nX.js +1 -0
  37. package/dist/assets/plugin-view-DspcF1Mc.js +1 -0
  38. package/dist/assets/plugins-views-DUx-xpiH.js +4 -0
  39. package/dist/assets/src-DL8N52oz.js +2 -0
  40. package/dist/assets/{types-BsFD2pPK.js → types-CbmNTewl.js} +1 -1
  41. package/dist/assets/ui-components-CIdYg6m3.js +41 -0
  42. package/dist/assets/ui-layout-DGPxy1gI.js +1 -0
  43. package/dist/assets/{vendor-charts-vh1WJI0j.js → vendor-charts-Ba_-W-di.js} +3 -3
  44. package/dist/assets/{vendor-dndkit-0jp7h5ty.js → vendor-dndkit-CucFgdMa.js} +1 -1
  45. package/dist/assets/{vendor-i18n-CnFu8bdi.js → vendor-i18n-DPyFo2xM.js} +1 -1
  46. package/dist/assets/{vendor-icons-core-D5MicM14.js → vendor-icons-core-Cx2WYOuR.js} +1 -1
  47. package/dist/assets/{vendor-markdown-CvMSBmgq.js → vendor-markdown-B0mCB2Nu.js} +2 -2
  48. package/dist/assets/vendor-objectstack-B3zP6Fz_.js +65 -0
  49. package/dist/assets/{vendor-radix-BNWIlSsV.js → vendor-radix-thTS_QfF.js} +1 -1
  50. package/dist/assets/vendor-react-CyVA1SE-.js +13 -0
  51. package/dist/assets/{vendor-sentry-D5yZpZ5X.js → vendor-sentry-DjMgMAaz.js} +1 -1
  52. package/dist/assets/{vendor-ui-utils-D3GsyZyi.js → vendor-ui-utils-BbOuugky.js} +1 -1
  53. package/dist/favicon.svg +11 -0
  54. package/dist/index.html +7 -7
  55. package/dist/logo.svg +15 -0
  56. package/dist/manifest.json +2 -2
  57. package/package.json +1 -1
  58. package/dist/assets/ApiConsolePage-CVt86JW9.js +0 -1
  59. package/dist/assets/ApprovalsInboxPage-BRv2RqN4.js +0 -1
  60. package/dist/assets/ComponentNavView-B2VAx_8W.js +0 -1
  61. package/dist/assets/FlowRunsPage-CF-nkx9E.js +0 -1
  62. package/dist/assets/MonacoImpl-CKoKq1tG.js +0 -11
  63. package/dist/assets/PublicFormsPage-B1cdfwoQ.js +0 -1
  64. package/dist/assets/data-adapter-Be-s1kWX.js +0 -1
  65. package/dist/assets/index-D7iz-IIn.js +0 -24
  66. package/dist/assets/index-Db8Nmh4R.css +0 -2
  67. package/dist/assets/infrastructure-ezj3FgNE.js +0 -3
  68. package/dist/assets/mermaid-GHXKKRXX-DJsGdxYj.js +0 -1
  69. package/dist/assets/plugin-calendar-wl24Whh9.js +0 -1
  70. package/dist/assets/plugin-dashboard-DqF5vvlQ.js +0 -3
  71. package/dist/assets/plugin-gantt-scBgVq2Q.js +0 -1
  72. package/dist/assets/plugin-grid-u5JmW5Ui.js +0 -6
  73. package/dist/assets/plugin-kanban-0qj1Kr3T.js +0 -1
  74. package/dist/assets/plugin-map-CjA33cHV.js +0 -1
  75. package/dist/assets/plugin-markdown-BPsaoDf-.js +0 -7
  76. package/dist/assets/plugin-report-C35V4A8F.js +0 -59
  77. package/dist/assets/plugin-timeline-Bmy8v-AN.js +0 -1
  78. package/dist/assets/plugin-view-tV_8MnpT.js +0 -1
  79. package/dist/assets/plugins-views-DM6-O61C.js +0 -4
  80. package/dist/assets/src-BJJhwsID.js +0 -2
  81. package/dist/assets/ui-components-DYQ4Pai7.js +0 -41
  82. package/dist/assets/ui-layout-Dmw4Ab7P.js +0 -1
  83. package/dist/assets/vendor-objectstack-CwZ3saTl.js +0 -65
  84. package/dist/assets/vendor-react-CIpZOxG3.js +0 -13
@@ -1,65 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-CMxvf4Kt.js";var t;function n(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 r=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},i=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(t=globalThis).__zod_globalConfig??(t.__zod_globalConfig={});var a=globalThis.__zod_globalConfig;function o(e){return e&&Object.assign(a,e),a}function s(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 c(e,t){return typeof t==`bigint`?t.toString():t}function l(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}throw Error(`cached value already set`)}}}function u(e){return e==null}function d(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function ee(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}var te=Symbol(`evaluating`);function f(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==te)return r===void 0&&(r=te,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function ne(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function re(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function ie(e){return JSON.stringify(e)}function ae(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var oe=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function se(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var ce=l(()=>{if(a.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function le(e){if(se(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(se(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function ue(e){return le(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var de=new Set([`string`,`number`,`symbol`]);function fe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function pe(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function p(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 me(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var he={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function ge(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 pe(e,re(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 ne(this,`shape`,e),e},checks:[]}))}function _e(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 pe(e,re(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 ne(this,`shape`,r),r},checks:[]}))}function ve(e,t){if(!le(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 pe(e,re(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return ne(this,`shape`,n),n}}))}function ye(e,t){if(!le(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return pe(e,re(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return ne(this,`shape`,n),n}}))}function be(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return pe(e,re(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return ne(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function xe(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 pe(t,re(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 ne(this,`shape`,i),i},checks:[]}))}function Se(e,t,n){return pe(t,re(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 ne(this,`shape`,i),i}}))}function Ce(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 we(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 Te(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Ee(e){return typeof e==`string`?e:e?.message}function De(e,t,n){let r=e.message?e.message:Ee(e.inst?._zod.def?.error?.(e))??Ee(t?.error?.(e))??Ee(n.customError?.(e))??Ee(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 Oe(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function ke(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var Ae=(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,c,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},je=n(`$ZodError`,Ae),Me=n(`$ZodError`,Ae,{Parent:Error});function Ne(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 Pe(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}var Fe=e=>(t,n,i,a)=>{let s=i?{...i,async:!1}:{async:!1},c=t._zod.run({value:n,issues:[]},s);if(c instanceof Promise)throw new r;if(c.issues.length){let t=new(a?.Err??e)(c.issues.map(e=>De(e,s,o())));throw oe(t,a?.callee),t}return c.value},Ie=Fe(Me),Le=e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},s=t._zod.run({value:n,issues:[]},a);if(s instanceof Promise&&(s=await s),s.issues.length){let t=new(i?.Err??e)(s.issues.map(e=>De(e,a,o())));throw oe(t,i?.callee),t}return s.value},Re=Le(Me),ze=e=>(t,n,i)=>{let a=i?{...i,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},a);if(s instanceof Promise)throw new r;return s.issues.length?{success:!1,error:new(e??je)(s.issues.map(e=>De(e,a,o())))}:{success:!0,data:s.value}},Be=ze(Me),Ve=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=>De(e,i,o())))}:{success:!0,data:a.value}},He=Ve(Me),Ue=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Fe(e)(t,n,i)},We=e=>(t,n,r)=>Fe(e)(t,n,r),Ge=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Le(e)(t,n,i)},Ke=e=>async(t,n,r)=>Le(e)(t,n,r),qe=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return ze(e)(t,n,i)},Je=e=>(t,n,r)=>ze(e)(t,n,r),Ye=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ve(e)(t,n,i)},Xe=e=>async(t,n,r)=>Ve(e)(t,n,r),Ze=/^[cC][0-9a-z]{6,}$/,Qe=/^[0-9a-z]+$/,$e=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,et=/^[0-9a-vA-V]{20}$/,tt=/^[A-Za-z0-9]{27}$/,nt=/^[a-zA-Z0-9_-]{21}$/,rt=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,it=/^([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})$/,at=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)$/,ot=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,st=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function ct(){return new RegExp(st,`u`)}var lt=/^(?:(?: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])$/,ut=/^(([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}|:))$/,dt=/^((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])$/,ft=/^(([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])$/,pt=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,mt=/^[A-Za-z0-9_-]*$/,ht=/^https?$/,gt=/^\+[1-9]\d{6,14}$/,_t=`(?:(?:\\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])))`,vt=RegExp(`^${_t}$`);function yt(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 bt(e){return RegExp(`^${yt(e)}$`)}function xt(e){let t=yt({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(`^${_t}T(?:${r})$`)}var St=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},Ct=/^-?\d+$/,wt=/^-?\d+(?:\.\d+)?$/,Tt=/^(?:true|false)$/i,Et=/^null$/i,Dt=/^[^A-Z]*$/,Ot=/^[^a-z]*$/,m=n(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),kt={number:`number`,bigint:`bigint`,object:`date`},At=n(`$ZodCheckLessThan`,(e,t)=>{m.init(e,t);let n=kt[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})}}),jt=n(`$ZodCheckGreaterThan`,(e,t)=>{m.init(e,t);let n=kt[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})}}),Mt=n(`$ZodCheckMultipleOf`,(e,t)=>{m.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):ee(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})}}),Nt=n(`$ZodCheckNumberFormat`,(e,t)=>{m.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=he[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=Ct)}),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})}}),Pt=n(`$ZodCheckMaxLength`,(e,t)=>{var n;m.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!u(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=Oe(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Ft=n(`$ZodCheckMinLength`,(e,t)=>{var n;m.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!u(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=Oe(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),It=n(`$ZodCheckLengthEquals`,(e,t)=>{var n;m.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!u(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=Oe(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})}}),Lt=n(`$ZodCheckStringFormat`,(e,t)=>{var n,r;m.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=()=>{})}),Rt=n(`$ZodCheckRegex`,(e,t)=>{Lt.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})}}),zt=n(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Dt,Lt.init(e,t)}),Bt=n(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Ot,Lt.init(e,t)}),Vt=n(`$ZodCheckIncludes`,(e,t)=>{m.init(e,t);let n=fe(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})}}),Ht=n(`$ZodCheckStartsWith`,(e,t)=>{m.init(e,t);let n=RegExp(`^${fe(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})}}),Ut=n(`$ZodCheckEndsWith`,(e,t)=>{m.init(e,t);let n=RegExp(`.*${fe(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})}}),Wt=n(`$ZodCheckOverwrite`,(e,t)=>{m.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Gt=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(`
2
- `).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(`
3
- `))}},Kt={major:4,minor:4,patch:3},h=n(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Kt;let i=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&i.unshift(e);for(let t of i)for(let n of t._zod.onattach)n(e);if(i.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 i=Ce(e),a;for(let o of t){if(o._zod.def.when){if(we(e)||!o._zod.def.when(e))continue}else if(i)continue;let t=e.issues.length,s=o._zod.check(e);if(s instanceof Promise&&n?.async===!1)throw new r;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,e.issues.length!==t&&(i||=Ce(e,t))});else{if(e.issues.length===t)continue;i||=Ce(e,t)}}return a?a.then(()=>e):e},n=(n,a,o)=>{if(Ce(n))return n.aborted=!0,n;let s=t(a,i,o);if(s instanceof Promise){if(o.async===!1)throw new r;return s.then(t=>e._zod.parse(t,o))}return e._zod.parse(s,o)};e._zod.run=(a,o)=>{if(o.skipChecks)return e._zod.parse(a,o);if(o.direction===`backward`){let t=e._zod.parse({value:a.value,issues:[]},{...o,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,a,o)):n(t,a,o)}let s=e._zod.parse(a,o);if(s instanceof Promise){if(o.async===!1)throw new r;return s.then(e=>t(e,i,o))}return t(s,i,o)}}f(e,`~standard`,()=>({validate:t=>{try{let n=Be(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return He(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),qt=n(`$ZodString`,(e,t)=>{h.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??St(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}}),g=n(`$ZodStringFormat`,(e,t)=>{Lt.init(e,t),qt.init(e,t)}),Jt=n(`$ZodGUID`,(e,t)=>{t.pattern??=it,g.init(e,t)}),Yt=n(`$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??=at(e)}else t.pattern??=at();g.init(e,t)}),Xt=n(`$ZodEmail`,(e,t)=>{t.pattern??=ot,g.init(e,t)}),Zt=n(`$ZodURL`,(e,t)=>{g.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===ht.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})}}}),Qt=n(`$ZodEmoji`,(e,t)=>{t.pattern??=ct(),g.init(e,t)}),$t=n(`$ZodNanoID`,(e,t)=>{t.pattern??=nt,g.init(e,t)}),en=n(`$ZodCUID`,(e,t)=>{t.pattern??=Ze,g.init(e,t)}),tn=n(`$ZodCUID2`,(e,t)=>{t.pattern??=Qe,g.init(e,t)}),nn=n(`$ZodULID`,(e,t)=>{t.pattern??=$e,g.init(e,t)}),rn=n(`$ZodXID`,(e,t)=>{t.pattern??=et,g.init(e,t)}),an=n(`$ZodKSUID`,(e,t)=>{t.pattern??=tt,g.init(e,t)}),on=n(`$ZodISODateTime`,(e,t)=>{t.pattern??=xt(t),g.init(e,t)}),sn=n(`$ZodISODate`,(e,t)=>{t.pattern??=vt,g.init(e,t)}),cn=n(`$ZodISOTime`,(e,t)=>{t.pattern??=bt(t),g.init(e,t)}),ln=n(`$ZodISODuration`,(e,t)=>{t.pattern??=rt,g.init(e,t)}),un=n(`$ZodIPv4`,(e,t)=>{t.pattern??=lt,g.init(e,t),e._zod.bag.format=`ipv4`}),dn=n(`$ZodIPv6`,(e,t)=>{t.pattern??=ut,g.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})}}}),fn=n(`$ZodCIDRv4`,(e,t)=>{t.pattern??=dt,g.init(e,t)}),pn=n(`$ZodCIDRv6`,(e,t)=>{t.pattern??=ft,g.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 mn(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var hn=n(`$ZodBase64`,(e,t)=>{t.pattern??=pt,g.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{mn(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function gn(e){if(!mt.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return mn(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var _n=n(`$ZodBase64URL`,(e,t)=>{t.pattern??=mt,g.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{gn(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),vn=n(`$ZodE164`,(e,t)=>{t.pattern??=gt,g.init(e,t)});function yn(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}}var bn=n(`$ZodJWT`,(e,t)=>{g.init(e,t),e._zod.check=n=>{yn(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),xn=n(`$ZodNumber`,(e,t)=>{h.init(e,t),e._zod.pattern=e._zod.bag.pattern??wt,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}}),Sn=n(`$ZodNumberFormat`,(e,t)=>{Nt.init(e,t),xn.init(e,t)}),Cn=n(`$ZodBoolean`,(e,t)=>{h.init(e,t),e._zod.pattern=Tt,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}}),wn=n(`$ZodNull`,(e,t)=>{h.init(e,t),e._zod.pattern=Et,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}}),Tn=n(`$ZodAny`,(e,t)=>{h.init(e,t),e._zod.parse=e=>e}),En=n(`$ZodUnknown`,(e,t)=>{h.init(e,t),e._zod.parse=e=>e}),Dn=n(`$ZodNever`,(e,t)=>{h.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)}),On=n(`$ZodVoid`,(e,t)=>{h.init(e,t),e._zod.parse=(t,n)=>{let r=t.value;return r===void 0||t.issues.push({expected:`void`,code:`invalid_type`,input:r,inst:e}),t}}),kn=n(`$ZodDate`,(e,t)=>{h.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 An(e,t,n){e.issues.length&&t.issues.push(...Te(n,e.issues)),t.value[n]=e.value}var jn=n(`$ZodArray`,(e,t)=>{h.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=>An(t,n,e))):An(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function Mn(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...Te(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 Nn(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=me(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Pn(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=>Mn(e,n,i,t,u,d))):Mn(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}var Fn=n(`$ZodObject`,(e,t)=>{if(h.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=l(()=>Nn(t));f(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=se,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=>Mn(n,t,e,s,r,i))):Mn(a,t,e,s,r,i)}return i?Pn(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),In=n(`$ZodObjectJIT`,(e,t)=>{Fn.init(e,t);let n=e._zod.parse,r=l(()=>Nn(t)),i=e=>{let t=new Gt([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=ie(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=ie(r),s=e[r],c=s?._zod?.optin===`optional`,l=s?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),c&&l?t.write(`
4
- if (${n}.issues.length) {
5
- if (${o} in input) {
6
- payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
7
- ...iss,
8
- path: iss.path ? [${o}, ...iss.path] : [${o}]
9
- })));
10
- }
11
- }
12
-
13
- if (${n}.value === undefined) {
14
- if (${o} in input) {
15
- newResult[${o}] = undefined;
16
- }
17
- } else {
18
- newResult[${o}] = ${n}.value;
19
- }
20
-
21
- `):c?t.write(`
22
- if (${n}.issues.length) {
23
- payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
24
- ...iss,
25
- path: iss.path ? [${o}, ...iss.path] : [${o}]
26
- })));
27
- }
28
-
29
- if (${n}.value === undefined) {
30
- if (${o} in input) {
31
- newResult[${o}] = undefined;
32
- }
33
- } else {
34
- newResult[${o}] = ${n}.value;
35
- }
36
-
37
- `):t.write(`
38
- const ${n}_present = ${o} in input;
39
- if (${n}.issues.length) {
40
- payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
41
- ...iss,
42
- path: iss.path ? [${o}, ...iss.path] : [${o}]
43
- })));
44
- }
45
- if (!${n}_present && !${n}.issues.length) {
46
- payload.issues.push({
47
- code: "invalid_type",
48
- expected: "nonoptional",
49
- input: undefined,
50
- path: [${o}]
51
- });
52
- }
53
-
54
- if (${n}_present) {
55
- if (${n}.value === undefined) {
56
- newResult[${o}] = undefined;
57
- } else {
58
- newResult[${o}] = ${n}.value;
59
- }
60
- }
61
-
62
- `)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},o,s=se,c=!a.jitless,u=c&&ce.value,d=t.catchall,ee;e._zod.parse=(a,l)=>{ee??=r.value;let te=a.value;return s(te)?c&&u&&l?.async===!1&&l.jitless!==!0?(o||=i(t.shape),a=o(a,l),d?Pn([],te,a,l,ee,e):a):n(a,l):(a.issues.push({expected:`object`,code:`invalid_type`,input:te,inst:e}),a)}});function Ln(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=>!Ce(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=>De(e,r,o())))}),t)}var Rn=n(`$ZodUnion`,(e,t)=>{h.init(e,t),f(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),f(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),f(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),f(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=>d(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=>Ln(t,r,e,i)):Ln(o,r,e,i)}}),zn=n(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,Rn.init(e,t);let n=e._zod.parse;f(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=l(()=>{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(!se(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)}}),Bn=n(`$ZodIntersection`,(e,t)=>{h.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])=>Hn(e,t,n)):Hn(e,i,a)}});function Vn(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(le(e)&&le(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=Vn(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=Vn(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 Hn(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}),Ce(e))return e;let o=Vn(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var Un=n(`$ZodTuple`,(e,t)=>{h.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=Wn(n,`optin`),c=Wn(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=>Gn(t,r,e))):Gn(a,r,e)}}return o.length?Promise.all(o).then(()=>Kn(l,r,n,a,c)):Kn(l,r,n,a,c)}});function Wn(e,t){for(let n=e.length-1;n>=0;n--)if(e[n]._zod[t]!==`optional`)return n+1;return 0}function Gn(e,t,n){e.issues.length&&t.issues.push(...Te(n,e.issues)),t.value[n]=e.value}function Kn(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(...Te(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}var qn=n(`$ZodRecord`,(e,t)=>{h.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!le(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],s=t.keyType._zod.values;if(s){n.value={};let c=new Set;for(let l of s)if(typeof l==`string`||typeof l==`number`||typeof l==`symbol`){c.add(typeof l==`number`?l.toString():l);let s=t.keyType._zod.run({value:l,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>De(e,r,o())),input:l,path:[l],inst:e});continue}let u=s.value,d=t.valueType._zod.run({value:i[l],issues:[]},r);d instanceof Promise?a.push(d.then(e=>{e.issues.length&&n.issues.push(...Te(l,e.issues)),n.value[u]=e.value})):(d.issues.length&&n.issues.push(...Te(l,d.issues)),n.value[u]=d.value)}let l;for(let e in i)c.has(e)||(l??=[],l.push(e));l&&l.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:l})}else{n.value={};for(let s of Reflect.ownKeys(i)){if(s===`__proto__`||!Object.prototype.propertyIsEnumerable.call(i,s))continue;let c=t.keyType._zod.run({value:s,issues:[]},r);if(c instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof s==`string`&&wt.test(s)&&c.issues.length){let e=t.keyType._zod.run({value:Number(s),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(c=e)}if(c.issues.length){t.mode===`loose`?n.value[s]=i[s]:n.issues.push({code:`invalid_key`,origin:`record`,issues:c.issues.map(e=>De(e,r,o())),input:s,path:[s],inst:e});continue}let l=t.valueType._zod.run({value:i[s],issues:[]},r);l instanceof Promise?a.push(l.then(e=>{e.issues.length&&n.issues.push(...Te(s,e.issues)),n.value[c.value]=e.value})):(l.issues.length&&n.issues.push(...Te(s,l.issues)),n.value[c.value]=l.value)}}return a.length?Promise.all(a).then(()=>n):n}}),Jn=n(`$ZodEnum`,(e,t)=>{h.init(e,t);let n=s(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>de.has(typeof e)).map(e=>typeof e==`string`?fe(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}}),Yn=n(`$ZodLiteral`,(e,t)=>{if(h.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`?fe(e):e?fe(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}}),Xn=n(`$ZodTransform`,(e,t)=>{h.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,a)=>{if(a.direction===`backward`)throw new i(e.constructor.name);let o=t.transform(n.value,n);if(a.async)return(o instanceof Promise?o:Promise.resolve(o)).then(e=>(n.value=e,n.fallback=!0,n));if(o instanceof Promise)throw new r;return n.value=o,n.fallback=!0,n}});function Zn(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var Qn=n(`$ZodOptional`,(e,t)=>{h.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,f(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),f(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${d(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=>Zn(e,r)):Zn(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),$n=n(`$ZodExactOptional`,(e,t)=>{Qn.init(e,t),f(e._zod,`values`,()=>t.innerType._zod.values),f(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),er=n(`$ZodNullable`,(e,t)=>{h.init(e,t),f(e._zod,`optin`,()=>t.innerType._zod.optin),f(e._zod,`optout`,()=>t.innerType._zod.optout),f(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${d(e.source)}|null)$`):void 0}),f(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)}),tr=n(`$ZodDefault`,(e,t)=>{h.init(e,t),e._zod.optin=`optional`,f(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=>nr(e,t)):nr(r,t)}});function nr(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var rr=n(`$ZodPrefault`,(e,t)=>{h.init(e,t),e._zod.optin=`optional`,f(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))}),ir=n(`$ZodNonOptional`,(e,t)=>{h.init(e,t),f(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=>ar(t,e)):ar(i,e)}});function ar(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var or=n(`$ZodCatch`,(e,t)=>{h.init(e,t),e._zod.optin=`optional`,f(e._zod,`optout`,()=>t.innerType._zod.optout),f(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=>De(e,n,o()))},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=>De(e,n,o()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),sr=n(`$ZodPipe`,(e,t)=>{h.init(e,t),f(e._zod,`values`,()=>t.in._zod.values),f(e._zod,`optin`,()=>t.in._zod.optin),f(e._zod,`optout`,()=>t.out._zod.optout),f(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=>cr(e,t.in,n)):cr(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>cr(e,t.out,n)):cr(r,t.out,n)}});function cr(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}var lr=n(`$ZodReadonly`,(e,t)=>{h.init(e,t),f(e._zod,`propValues`,()=>t.innerType._zod.propValues),f(e._zod,`values`,()=>t.innerType._zod.values),f(e._zod,`optin`,()=>t.innerType?._zod?.optin),f(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(ur):ur(r)}});function ur(e){return e.value=Object.freeze(e.value),e}var dr=n(`$ZodFunction`,(e,t)=>(h.init(e,t),e._def=t,e._zod.def=t,e.implement=t=>{if(typeof t!=`function`)throw Error(`implement() must be called with a function`);return function(...n){let r=e._def.input?Ie(e._def.input,n):n,i=Reflect.apply(t,this,r);return e._def.output?Ie(e._def.output,i):i}},e.implementAsync=t=>{if(typeof t!=`function`)throw Error(`implementAsync() must be called with a function`);return async function(...n){let r=e._def.input?await Re(e._def.input,n):n,i=await Reflect.apply(t,this,r);return e._def.output?await Re(e._def.output,i):i}},e._zod.parse=(t,n)=>typeof t.value==`function`?(e._def.output&&e._def.output._zod.def.type===`promise`?t.value=e.implementAsync(t.value):t.value=e.implement(t.value),t):(t.issues.push({code:`invalid_type`,expected:`function`,input:t.value,inst:e}),t),e.input=(...t)=>{let n=e.constructor;return Array.isArray(t[0])?new n({type:`function`,input:new Un({type:`tuple`,items:t[0],rest:t[1]}),output:e._def.output}):new n({type:`function`,input:t[0],output:e._def.output})},e.output=t=>{let n=e.constructor;return new n({type:`function`,input:e._def.input,output:t})},e)),fr=n(`$ZodPromise`,(e,t)=>{h.init(e,t),e._zod.parse=(e,n)=>Promise.resolve(e.value).then(e=>t.innerType._zod.run({value:e,issues:[]},n))}),pr=n(`$ZodLazy`,(e,t)=>{h.init(e,t),f(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),f(e._zod,`pattern`,()=>e._zod.innerType?._zod?.pattern),f(e._zod,`propValues`,()=>e._zod.innerType?._zod?.propValues),f(e._zod,`optin`,()=>e._zod.innerType?._zod?.optin??void 0),f(e._zod,`optout`,()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),mr=n(`$ZodCustom`,(e,t)=>{m.init(e,t),h.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=>hr(t,n,r,e));hr(i,n,r,e)}});function hr(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(ke(e))}}var gr,_r=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 vr(){return new _r}(gr=globalThis).__zod_globalRegistry??(gr.__zod_globalRegistry=vr());var yr=globalThis.__zod_globalRegistry;function br(e,t){return new e({type:`string`,...p(t)})}function xr(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...p(t)})}function Sr(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...p(t)})}function Cr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...p(t)})}function wr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...p(t)})}function Tr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...p(t)})}function Er(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...p(t)})}function Dr(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...p(t)})}function Or(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...p(t)})}function kr(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...p(t)})}function Ar(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...p(t)})}function jr(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...p(t)})}function Mr(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...p(t)})}function Nr(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...p(t)})}function Pr(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...p(t)})}function Fr(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...p(t)})}function Ir(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...p(t)})}function Lr(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...p(t)})}function Rr(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...p(t)})}function zr(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...p(t)})}function Br(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...p(t)})}function Vr(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...p(t)})}function Hr(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...p(t)})}function Ur(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...p(t)})}function Wr(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...p(t)})}function Gr(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...p(t)})}function Kr(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...p(t)})}function qr(e,t){return new e({type:`number`,checks:[],...p(t)})}function Jr(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...p(t)})}function Yr(e,t){return new e({type:`boolean`,...p(t)})}function Xr(e,t){return new e({type:`null`,...p(t)})}function Zr(e){return new e({type:`any`})}function Qr(e){return new e({type:`unknown`})}function $r(e,t){return new e({type:`never`,...p(t)})}function ei(e,t){return new e({type:`void`,...p(t)})}function ti(e,t){return new e({type:`date`,...p(t)})}function ni(e,t){return new At({check:`less_than`,...p(t),value:e,inclusive:!1})}function ri(e,t){return new At({check:`less_than`,...p(t),value:e,inclusive:!0})}function ii(e,t){return new jt({check:`greater_than`,...p(t),value:e,inclusive:!1})}function ai(e,t){return new jt({check:`greater_than`,...p(t),value:e,inclusive:!0})}function oi(e,t){return new Mt({check:`multiple_of`,...p(t),value:e})}function si(e,t){return new Pt({check:`max_length`,...p(t),maximum:e})}function ci(e,t){return new Ft({check:`min_length`,...p(t),minimum:e})}function li(e,t){return new It({check:`length_equals`,...p(t),length:e})}function ui(e,t){return new Rt({check:`string_format`,format:`regex`,...p(t),pattern:e})}function di(e){return new zt({check:`string_format`,format:`lowercase`,...p(e)})}function fi(e){return new Bt({check:`string_format`,format:`uppercase`,...p(e)})}function pi(e,t){return new Vt({check:`string_format`,format:`includes`,...p(t),includes:e})}function mi(e,t){return new Ht({check:`string_format`,format:`starts_with`,...p(t),prefix:e})}function hi(e,t){return new Ut({check:`string_format`,format:`ends_with`,...p(t),suffix:e})}function gi(e){return new Wt({check:`overwrite`,tx:e})}function _i(e){return gi(t=>t.normalize(e))}function vi(){return gi(e=>e.trim())}function yi(){return gi(e=>e.toLowerCase())}function bi(){return gi(e=>e.toUpperCase())}function xi(){return gi(e=>ae(e))}function Si(e,t,n){return new e({type:`array`,element:t,...p(n)})}function Ci(e,t,n){let r=p(n);return r.abort??=!0,new e({type:`custom`,check:`custom`,fn:t,...r})}function wi(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...p(n)})}function Ti(e,t){let n=Ei(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(ke(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(ke(r))}},e(t.value,t)),t);return n}function Ei(e,t){let n=new m({check:`custom`,...p(t)});return n._zod.check=e,n}function Di(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??yr,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 _(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,_(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`&&v(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 Oi(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>
63
-
64
- 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 ki(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:ji(t,`input`,e.processors),output:ji(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function v(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 v(r.element,n);if(r.type===`set`)return v(r.valueType,n);if(r.type===`lazy`)return v(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 v(r.innerType,n);if(r.type===`intersection`)return v(r.left,n)||v(r.right,n);if(r.type===`record`||r.type===`map`)return v(r.keyType,n)||v(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:v(r.in,n)||v(r.out,n);if(r.type===`object`){for(let e in r.shape)if(v(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(v(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(v(e,n))return!0;return!!(r.rest&&v(r.rest,n))}return!1}var Ai=(e,t={})=>n=>{let r=Di({...n,processors:t});return _(e,r),Oi(r,e),ki(r,e)},ji=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Di({...i??{},target:a,io:t,processors:n});return _(e,o),Oi(o,e),ki(o,e)},Mi={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Ni=(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=Mi[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}))])}},Pi=(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),ee=typeof l==`number`&&l<=(o??1/0),te=t.target===`draft-04`||t.target===`openapi-3.0`;d?te?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),ee?te?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},Fi=(e,t,n,r)=>{n.type=`boolean`},Ii=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`BigInt cannot be represented in JSON Schema`)},Li=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Symbols cannot be represented in JSON Schema`)},Ri=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},zi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Undefined cannot be represented in JSON Schema`)},Bi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Void cannot be represented in JSON Schema`)},Vi=(e,t,n,r)=>{n.not={}},Hi=(e,t,n,r)=>{},Ui=(e,t,n,r)=>{},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=s(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(`NaN cannot be represented in JSON Schema`)},Ji=(e,t,n,r)=>{let i=n,a=e._zod.pattern;if(!a)throw Error(`Pattern not found in template literal`);i.type=`string`,i.pattern=a.source},Yi=(e,t,n,r)=>{let i=n,a={type:`string`,format:`binary`,contentEncoding:`binary`},{minimum:o,maximum:s,mime:c}=e._zod.bag;o!==void 0&&(a.minLength=o),s!==void 0&&(a.maxLength=s),c?c.length===1?(a.contentMediaType=c[0],Object.assign(i,a)):(Object.assign(i,a),i.anyOf=c.map(e=>({contentMediaType:e}))):Object.assign(i,a)},Xi=(e,t,n,r)=>{n.type=`boolean`},Zi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Qi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Function types cannot be represented in JSON Schema`)},$i=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},ea=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Map cannot be represented in JSON Schema`)},ta=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Set cannot be represented in JSON Schema`)},na=(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=_(a.element,t,{...r,path:[...r.path,`items`]})},ra=(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]=_(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=_(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},ia=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>_(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},aa=(e,t,n,r)=>{let i=e._zod.def,a=_(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=_(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]]},oa=(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)=>_(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?_(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)},sa=(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=_(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=_(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=_(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)}},ca=(e,t,n,r)=>{let i=e._zod.def,a=_(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`}]},la=(e,t,n,r)=>{let i=e._zod.def;_(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ua=(e,t,n,r)=>{let i=e._zod.def;_(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},da=(e,t,n,r)=>{let i=e._zod.def;_(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)))},fa=(e,t,n,r)=>{let i=e._zod.def;_(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},pa=(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;_(o,t,r);let s=t.seen.get(e);s.ref=o},ma=(e,t,n,r)=>{let i=e._zod.def;_(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},ha=(e,t,n,r)=>{let i=e._zod.def;_(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ga=(e,t,n,r)=>{let i=e._zod.def;_(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},_a=(e,t,n,r)=>{let i=e._zod.innerType;_(i,t,r);let a=t.seen.get(e);a.ref=i},va={string:Ni,number:Pi,boolean:Fi,bigint:Ii,symbol:Li,null:Ri,undefined:zi,void:Bi,never:Vi,any:Hi,unknown:Ui,date:Wi,enum:Gi,literal:Ki,nan:qi,template_literal:Ji,file:Yi,success:Xi,custom:Zi,function:Qi,transform:$i,map:ea,set:ta,array:na,object:ra,union:ia,intersection:aa,tuple:oa,record:sa,nullable:ca,nonoptional:la,default:ua,prefault:da,catch:fa,pipe:pa,readonly:ma,promise:ha,optional:ga,lazy:_a};function ya(e,t){if(`_idmap`in e){let n=e,r=Di({...t,processors:va}),i={};for(let e of n._idmap.entries()){let[t,n]=e;_(n,r)}let a={};r.external={registry:n,uri:t?.uri,defs:i};for(let e of n._idmap.entries()){let[t,n]=e;Oi(r,n),a[t]=ki(r,n)}return Object.keys(i).length>0&&(a.__shared={[r.target===`draft-2020-12`?`$defs`:`definitions`]:i}),{schemas:a}}let n=Di({...t,processors:va});return _(e,n),Oi(n,e),ki(n,e)}var ba=n(`ZodISODateTime`,(e,t)=>{on.init(e,t),S.init(e,t)});function xa(e){return Ur(ba,e)}var Sa=n(`ZodISODate`,(e,t)=>{sn.init(e,t),S.init(e,t)});function Ca(e){return Wr(Sa,e)}var wa=n(`ZodISOTime`,(e,t)=>{cn.init(e,t),S.init(e,t)});function Ta(e){return Gr(wa,e)}var Ea=n(`ZodISODuration`,(e,t)=>{ln.init(e,t),S.init(e,t)});function Da(e){return Kr(Ea,e)}var y=n(`ZodError`,(e,t)=>{je.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Pe(e,t)},flatten:{value:t=>Ne(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,c,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,c,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),Oa=Fe(y),ka=Le(y),Aa=ze(y),ja=Ve(y),Ma=Ue(y),Na=We(y),Pa=Ge(y),Fa=Ke(y),Ia=qe(y),La=Je(y),Ra=Ye(y),za=Xe(y),Ba=new WeakMap;function Va(e,t,n){let r=Object.getPrototypeOf(e),i=Ba.get(r);if(i||(i=new Set,Ba.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}var b=n(`ZodType`,(e,t)=>(h.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:ji(e,`input`),output:ji(e,`output`)}}),e.toJSONSchema=Ai(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>Oa(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Aa(e,t,n),e.parseAsync=async(t,n)=>ka(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>ja(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Ma(e,t,n),e.decode=(t,n)=>Na(e,t,n),e.encodeAsync=async(t,n)=>Pa(e,t,n),e.decodeAsync=async(t,n)=>Fa(e,t,n),e.safeEncode=(t,n)=>Ia(e,t,n),e.safeDecode=(t,n)=>La(e,t,n),e.safeEncodeAsync=async(t,n)=>Ra(e,t,n),e.safeDecodeAsync=async(t,n)=>za(e,t,n),Va(e,`ZodType`,{check(...e){let t=this.def;return this.clone(re(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 pe(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(as(e,t))},superRefine(e,t){return this.check(os(e,t))},overwrite(e){return this.check(gi(e))},optional(){return Lo(this)},exactOptional(){return zo(this)},nullable(){return Vo(this)},nullish(){return Lo(Vo(this))},nonoptional(e){return qo(this,e)},array(){return O(this)},or(e){return A([this,e])},and(e){return ko(this,e)},transform(e){return Zo(this,Fo(e))},default(e){return Uo(this,e)},prefault(e){return Go(this,e)},catch(e){return Yo(this,e)},pipe(e){return Zo(this,e)},readonly(){return $o(this)},describe(e){let t=this.clone();return yr.add(t,{description:e}),t},meta(...e){if(e.length===0)return yr.get(this);let t=this.clone();return yr.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 yr.get(e)?.description},configurable:!0}),e)),Ha=n(`_ZodString`,(e,t)=>{qt.init(e,t),b.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ni(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,Va(e,`_ZodString`,{regex(...e){return this.check(ui(...e))},includes(...e){return this.check(pi(...e))},startsWith(...e){return this.check(mi(...e))},endsWith(...e){return this.check(hi(...e))},min(...e){return this.check(ci(...e))},max(...e){return this.check(si(...e))},length(...e){return this.check(li(...e))},nonempty(...e){return this.check(ci(1,...e))},lowercase(e){return this.check(di(e))},uppercase(e){return this.check(fi(e))},trim(){return this.check(vi())},normalize(...e){return this.check(_i(...e))},toLowerCase(){return this.check(yi())},toUpperCase(){return this.check(bi())},slugify(){return this.check(xi())}})}),Ua=n(`ZodString`,(e,t)=>{qt.init(e,t),Ha.init(e,t),e.email=t=>e.check(xr(Wa,t)),e.url=t=>e.check(Dr(qa,t)),e.jwt=t=>e.check(Hr(co,t)),e.emoji=t=>e.check(Or(Ja,t)),e.guid=t=>e.check(Sr(Ga,t)),e.uuid=t=>e.check(Cr(Ka,t)),e.uuidv4=t=>e.check(wr(Ka,t)),e.uuidv6=t=>e.check(Tr(Ka,t)),e.uuidv7=t=>e.check(Er(Ka,t)),e.nanoid=t=>e.check(kr(Ya,t)),e.guid=t=>e.check(Sr(Ga,t)),e.cuid=t=>e.check(Ar(Xa,t)),e.cuid2=t=>e.check(jr(Za,t)),e.ulid=t=>e.check(Mr(Qa,t)),e.base64=t=>e.check(zr(ao,t)),e.base64url=t=>e.check(Br(oo,t)),e.xid=t=>e.check(Nr($a,t)),e.ksuid=t=>e.check(Pr(eo,t)),e.ipv4=t=>e.check(Fr(to,t)),e.ipv6=t=>e.check(Ir(no,t)),e.cidrv4=t=>e.check(Lr(ro,t)),e.cidrv6=t=>e.check(Rr(io,t)),e.e164=t=>e.check(Vr(so,t)),e.datetime=t=>e.check(xa(t)),e.date=t=>e.check(Ca(t)),e.time=t=>e.check(Ta(t)),e.duration=t=>e.check(Da(t))});function x(e){return br(Ua,e)}var S=n(`ZodStringFormat`,(e,t)=>{g.init(e,t),Ha.init(e,t)}),Wa=n(`ZodEmail`,(e,t)=>{Xt.init(e,t),S.init(e,t)}),Ga=n(`ZodGUID`,(e,t)=>{Jt.init(e,t),S.init(e,t)}),Ka=n(`ZodUUID`,(e,t)=>{Yt.init(e,t),S.init(e,t)}),qa=n(`ZodURL`,(e,t)=>{Zt.init(e,t),S.init(e,t)}),Ja=n(`ZodEmoji`,(e,t)=>{Qt.init(e,t),S.init(e,t)}),Ya=n(`ZodNanoID`,(e,t)=>{$t.init(e,t),S.init(e,t)}),Xa=n(`ZodCUID`,(e,t)=>{en.init(e,t),S.init(e,t)}),Za=n(`ZodCUID2`,(e,t)=>{tn.init(e,t),S.init(e,t)}),Qa=n(`ZodULID`,(e,t)=>{nn.init(e,t),S.init(e,t)}),$a=n(`ZodXID`,(e,t)=>{rn.init(e,t),S.init(e,t)}),eo=n(`ZodKSUID`,(e,t)=>{an.init(e,t),S.init(e,t)}),to=n(`ZodIPv4`,(e,t)=>{un.init(e,t),S.init(e,t)}),no=n(`ZodIPv6`,(e,t)=>{dn.init(e,t),S.init(e,t)}),ro=n(`ZodCIDRv4`,(e,t)=>{fn.init(e,t),S.init(e,t)}),io=n(`ZodCIDRv6`,(e,t)=>{pn.init(e,t),S.init(e,t)}),ao=n(`ZodBase64`,(e,t)=>{hn.init(e,t),S.init(e,t)}),oo=n(`ZodBase64URL`,(e,t)=>{_n.init(e,t),S.init(e,t)}),so=n(`ZodE164`,(e,t)=>{vn.init(e,t),S.init(e,t)}),co=n(`ZodJWT`,(e,t)=>{bn.init(e,t),S.init(e,t)}),lo=n(`ZodNumber`,(e,t)=>{xn.init(e,t),b.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pi(e,t,n,r),Va(e,`ZodNumber`,{gt(e,t){return this.check(ii(e,t))},gte(e,t){return this.check(ai(e,t))},min(e,t){return this.check(ai(e,t))},lt(e,t){return this.check(ni(e,t))},lte(e,t){return this.check(ri(e,t))},max(e,t){return this.check(ri(e,t))},int(e){return this.check(fo(e))},safe(e){return this.check(fo(e))},positive(e){return this.check(ii(0,e))},nonnegative(e){return this.check(ai(0,e))},negative(e){return this.check(ni(0,e))},nonpositive(e){return this.check(ri(0,e))},multipleOf(e,t){return this.check(oi(e,t))},step(e,t){return this.check(oi(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 C(e){return qr(lo,e)}var uo=n(`ZodNumberFormat`,(e,t)=>{Sn.init(e,t),lo.init(e,t)});function fo(e){return Jr(uo,e)}var po=n(`ZodBoolean`,(e,t)=>{Cn.init(e,t),b.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fi(e,t,n,r)});function w(e){return Yr(po,e)}var mo=n(`ZodNull`,(e,t)=>{wn.init(e,t),b.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ri(e,t,n,r)});function ho(e){return Xr(mo,e)}var go=n(`ZodAny`,(e,t)=>{Tn.init(e,t),b.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function T(){return Zr(go)}var _o=n(`ZodUnknown`,(e,t)=>{En.init(e,t),b.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function E(){return Qr(_o)}var vo=n(`ZodNever`,(e,t)=>{Dn.init(e,t),b.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vi(e,t,n,r)});function yo(e){return $r(vo,e)}var bo=n(`ZodVoid`,(e,t)=>{On.init(e,t),b.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bi(e,t,n,r)});function xo(e){return ei(bo,e)}var So=n(`ZodDate`,(e,t)=>{kn.init(e,t),b.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wi(e,t,n,r),e.min=(t,n)=>e.check(ai(t,n)),e.max=(t,n)=>e.check(ri(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});function D(e){return ti(So,e)}var Co=n(`ZodArray`,(e,t)=>{jn.init(e,t),b.init(e,t),e._zod.processJSONSchema=(t,n,r)=>na(e,t,n,r),e.element=t.element,Va(e,`ZodArray`,{min(e,t){return this.check(ci(e,t))},nonempty(e){return this.check(ci(1,e))},max(e,t){return this.check(si(e,t))},length(e,t){return this.check(li(e,t))},unwrap(){return this.element}})});function O(e,t){return Si(Co,e,t)}var wo=n(`ZodObject`,(e,t)=>{In.init(e,t),b.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ra(e,t,n,r),f(e,`shape`,()=>t.shape),Va(e,`ZodObject`,{keyof(){return P(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:E()})},loose(){return this.clone({...this._zod.def,catchall:E()})},strict(){return this.clone({...this._zod.def,catchall:yo()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return ve(this,e)},safeExtend(e){return ye(this,e)},merge(e){return be(this,e)},pick(e){return ge(this,e)},omit(e){return _e(this,e)},partial(...e){return xe(Io,this,e[0])},required(...e){return Se(Ko,this,e[0])}})});function k(e,t){return new wo({type:`object`,shape:e??{},...p(t)})}function To(e,t){return new wo({type:`object`,shape:e,catchall:yo(),...p(t)})}var Eo=n(`ZodUnion`,(e,t)=>{Rn.init(e,t),b.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ia(e,t,n,r),e.options=t.options});function A(e,t){return new Eo({type:`union`,options:e,...p(t)})}var Do=n(`ZodDiscriminatedUnion`,(e,t)=>{Eo.init(e,t),zn.init(e,t)});function j(e,t,n){return new Do({type:`union`,options:t,discriminator:e,...p(n)})}var Oo=n(`ZodIntersection`,(e,t)=>{Bn.init(e,t),b.init(e,t),e._zod.processJSONSchema=(t,n,r)=>aa(e,t,n,r)});function ko(e,t){return new Oo({type:`intersection`,left:e,right:t})}var Ao=n(`ZodTuple`,(e,t)=>{Un.init(e,t),b.init(e,t),e._zod.processJSONSchema=(t,n,r)=>oa(e,t,n,r),e.rest=t=>e.clone({...e._zod.def,rest:t})});function M(e,t,n){let r=t instanceof h;return new Ao({type:`tuple`,items:e,rest:r?t:null,...p(r?n:t)})}var jo=n(`ZodRecord`,(e,t)=>{qn.init(e,t),b.init(e,t),e._zod.processJSONSchema=(t,n,r)=>sa(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function N(e,t,n){return!t||!t._zod?new jo({type:`record`,keyType:x(),valueType:e,...p(t)}):new jo({type:`record`,keyType:e,valueType:t,...p(n)})}var Mo=n(`ZodEnum`,(e,t)=>{Jn.init(e,t),b.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 Mo({...t,checks:[],...p(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new Mo({...t,checks:[],...p(r),entries:i})}});function P(e,t){return new Mo({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...p(t)})}var No=n(`ZodLiteral`,(e,t)=>{Yn.init(e,t),b.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 F(e,t){return new No({type:`literal`,values:Array.isArray(e)?e:[e],...p(t)})}var Po=n(`ZodTransform`,(e,t)=>{Xn.init(e,t),b.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$i(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new i(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(ke(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(ke(t))}};let a=t.transform(n.value,n);return a instanceof Promise?a.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=a,n.fallback=!0,n)}});function Fo(e){return new Po({type:`transform`,transform:e})}var Io=n(`ZodOptional`,(e,t)=>{Qn.init(e,t),b.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ga(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Lo(e){return new Io({type:`optional`,innerType:e})}var Ro=n(`ZodExactOptional`,(e,t)=>{$n.init(e,t),b.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ga(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function zo(e){return new Ro({type:`optional`,innerType:e})}var Bo=n(`ZodNullable`,(e,t)=>{er.init(e,t),b.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ca(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Vo(e){return new Bo({type:`nullable`,innerType:e})}var Ho=n(`ZodDefault`,(e,t)=>{tr.init(e,t),b.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ua(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Uo(e,t){return new Ho({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():ue(t)}})}var Wo=n(`ZodPrefault`,(e,t)=>{rr.init(e,t),b.init(e,t),e._zod.processJSONSchema=(t,n,r)=>da(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Go(e,t){return new Wo({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():ue(t)}})}var Ko=n(`ZodNonOptional`,(e,t)=>{ir.init(e,t),b.init(e,t),e._zod.processJSONSchema=(t,n,r)=>la(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function qo(e,t){return new Ko({type:`nonoptional`,innerType:e,...p(t)})}var Jo=n(`ZodCatch`,(e,t)=>{or.init(e,t),b.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fa(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Yo(e,t){return new Jo({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var Xo=n(`ZodPipe`,(e,t)=>{sr.init(e,t),b.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pa(e,t,n,r),e.in=t.in,e.out=t.out});function Zo(e,t){return new Xo({type:`pipe`,in:e,out:t})}var Qo=n(`ZodReadonly`,(e,t)=>{lr.init(e,t),b.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ma(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function $o(e){return new Qo({type:`readonly`,innerType:e})}var es=n(`ZodLazy`,(e,t)=>{pr.init(e,t),b.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_a(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function I(e){return new es({type:`lazy`,getter:e})}var ts=n(`ZodPromise`,(e,t)=>{fr.init(e,t),b.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ha(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function L(e){return new ts({type:`promise`,innerType:e})}var ns=n(`ZodFunction`,(e,t)=>{dr.init(e,t),b.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qi(e,t,n,r)});function R(e){return new ns({type:`function`,input:Array.isArray(e?.input)?M(e?.input):e?.input??O(E()),output:e?.output??E()})}var rs=n(`ZodCustom`,(e,t)=>{mr.init(e,t),b.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zi(e,t,n,r)});function is(e,t){return Ci(rs,e??(()=>!0),t)}function as(e,t={}){return wi(rs,e,t)}function os(e,t){return Ti(e,t)}function ss(e,t={}){let n=new rs({type:`custom`,check:`custom`,fn:t=>t instanceof e,abort:!0,...p(t)});return n._zod.bag.Class=e,n._zod.check=t=>{t.value instanceof e||t.issues.push({code:`invalid_type`,expected:e.name,input:t.value,inst:n,path:[...n._zod.def.path??[]]})},n}var cs={invalid_type:`invalid_type`,too_big:`too_big`,too_small:`too_small`,invalid_format:`invalid_format`,not_multiple_of:`not_multiple_of`,unrecognized_keys:`unrecognized_keys`,invalid_union:`invalid_union`,invalid_key:`invalid_key`,invalid_element:`invalid_element`,invalid_value:`invalid_value`,custom:`custom`},ls;(function(e){})(ls||={});function z(e){if(typeof process<`u`&&{}.OS_EAGER_SCHEMAS===`1`)return e();let t,n=()=>(t===void 0&&(t=e()),t);return new Proxy(function(){},{get(e,t){let r=n(),i=r[t];return typeof i==`function`?i.bind(r):i},set(e,t,r){let i=n();return i[t]=r,!0},has(e,t){return t in n()},ownKeys(){return Reflect.ownKeys(n())},getOwnPropertyDescriptor(e,t){return Reflect.getOwnPropertyDescriptor(n(),t)},getPrototypeOf(){return Reflect.getPrototypeOf(n())}})}var B=z(()=>k({$field:x().describe(`Field Reference/Column Name`)}));z(()=>k({$eq:T().optional(),$ne:T().optional()})),z(()=>k({$gt:A([C(),D(),B]).optional(),$gte:A([C(),D(),B]).optional(),$lt:A([C(),D(),B]).optional(),$lte:A([C(),D(),B]).optional()})),z(()=>k({$in:O(T()).optional(),$nin:O(T()).optional()})),z(()=>k({$between:M([A([C(),D(),B]),A([C(),D(),B])]).optional()})),z(()=>k({$contains:x().optional(),$notContains:x().optional(),$startsWith:x().optional(),$endsWith:x().optional()})),z(()=>k({$null:w().optional(),$exists:w().optional()}));var us=z(()=>k({$eq:T().optional(),$ne:T().optional(),$gt:A([C(),D(),B]).optional(),$gte:A([C(),D(),B]).optional(),$lt:A([C(),D(),B]).optional(),$lte:A([C(),D(),B]).optional(),$in:O(T()).optional(),$nin:O(T()).optional(),$between:M([A([C(),D(),B]),A([C(),D(),B])]).optional(),$contains:x().optional(),$notContains:x().optional(),$startsWith:x().optional(),$endsWith:x().optional(),$null:w().optional(),$exists:w().optional()})),V=I(()=>N(x(),E()).and(k({$and:O(V).optional(),$or:O(V).optional(),$not:V.optional()})));z(()=>k({where:V.optional()}));var ds=I(()=>k({$and:O(A([N(x(),us),ds])).optional(),$or:O(A([N(x(),us),ds])).optional(),$not:A([N(x(),us),ds]).optional()})),fs=new Set([`=`,`==`,`!=`,`<>`,`>`,`>=`,`<`,`<=`,`in`,`nin`,`not_in`,`contains`,`notcontains`,`not_contains`,`like`,`startswith`,`starts_with`,`endswith`,`ends_with`,`between`,`is_null`,`is_not_null`]);function ps(e){if(!Array.isArray(e)||e.length===0)return!1;let t=e[0];if(typeof t==`string`){let n=t.toLowerCase();if(n===`and`||n===`or`)return e.length>=2&&e.slice(1).every(e=>ps(e));if(e.length>=2&&typeof e[1]==`string`)return fs.has(e[1].toLowerCase())}return e.every(e=>ps(e))?e.length>0:!1}var ms=[`$eq`,`$ne`,`$gt`,`$gte`,`$lt`,`$lte`,`$in`,`$nin`,`$between`,`$contains`,`$notContains`,`$startsWith`,`$endsWith`,`$null`,`$exists`],hs=[`$and`,`$or`,`$not`];[...ms,...hs];var gs=z(()=>k({field:x(),order:P([`asc`,`desc`]).default(`asc`)})),_s=P([`count`,`sum`,`avg`,`min`,`max`,`count_distinct`,`array_agg`,`string_agg`]),vs=P([`day`,`week`,`month`,`quarter`,`year`]),ys=z(()=>A([x(),k({field:x().describe(`Field to group by`),dateGranularity:vs.optional().describe(`Bucket date values into uniform periods (day/week/month/quarter/year)`),alias:x().optional().describe(`Alias for the projected group value`)})])),bs=z(()=>k({function:_s.describe(`Aggregation function`),field:x().optional().describe(`Field to aggregate (optional for COUNT(*))`),alias:x().describe(`Result column alias`),distinct:w().optional().describe(`Apply DISTINCT before aggregation`),filter:V.optional().describe(`Filter/Condition to apply to the aggregation (FILTER WHERE clause)`)})),xs=P([`inner`,`left`,`right`,`full`]),Ss=P([`auto`,`database`,`hash`,`loop`]),Cs=I(()=>k({type:xs.describe(`Join type`),strategy:Ss.optional().describe(`Execution strategy hint`),object:x().describe(`Object/table to join`),alias:x().optional().describe(`Table alias`),on:V.describe(`Join condition`),subquery:I(()=>H).optional().describe(`Subquery instead of object`)})),ws=P([`row_number`,`rank`,`dense_rank`,`percent_rank`,`lag`,`lead`,`first_value`,`last_value`,`sum`,`avg`,`count`,`min`,`max`]),Ts=z(()=>k({partitionBy:O(x()).optional().describe(`PARTITION BY fields`),orderBy:O(gs).optional().describe(`ORDER BY specification`),frame:k({type:P([`rows`,`range`]).optional(),start:x().optional().describe(`Frame start (e.g., "UNBOUNDED PRECEDING", "1 PRECEDING")`),end:x().optional().describe(`Frame end (e.g., "CURRENT ROW", "1 FOLLOWING")`)}).optional().describe(`Window frame specification`)})),Es=z(()=>k({function:ws.describe(`Window function name`),field:x().optional().describe(`Field to operate on (for aggregate window functions)`),alias:x().describe(`Result column alias`),over:Ts.describe(`Window specification (OVER clause)`)})),Ds=I(()=>A([x(),k({field:x(),fields:O(Ds).optional(),alias:x().optional()})])),Os=z(()=>k({query:x().describe(`Search query text`),fields:O(x()).optional().describe(`Fields to search in (if not specified, searches all text fields)`),fuzzy:w().optional().default(!1).describe(`Enable fuzzy matching (tolerates typos)`),operator:P([`and`,`or`]).optional().default(`or`).describe(`Logical operator between terms`),boost:N(x(),C()).optional().describe(`Field-specific relevance boosting (field name -> boost factor)`),minScore:C().optional().describe(`Minimum relevance score threshold`),language:x().optional().describe(`Language for text analysis (e.g., "en", "zh", "es")`),highlight:w().optional().default(!1).describe(`Enable search result highlighting`)})),ks=k({object:x().describe(`Object name (e.g. account)`),fields:O(Ds).optional().describe(`Fields to retrieve`),where:V.optional().describe(`Filtering criteria (WHERE)`),search:Os.optional().describe(`Full-text search configuration ($search parameter)`),orderBy:O(gs).optional().describe(`Sorting instructions (ORDER BY)`),limit:C().optional().describe(`Max records to return (LIMIT)`),offset:C().optional().describe(`Records to skip (OFFSET)`),top:C().optional().describe(`Alias for limit (OData compatibility)`),cursor:N(x(),E()).optional().describe(`Cursor for keyset pagination`),joins:O(Cs).optional().describe(`Explicit Table Joins`),aggregations:O(bs).optional().describe(`Aggregation functions`),groupBy:O(ys).optional().describe("GROUP BY targets (strings or `{field, dateGranularity?}` objects for date bucketing)"),having:V.optional().describe(`HAVING clause for aggregation filtering`),windowFunctions:O(Es).optional().describe(`Window functions with OVER clause`),distinct:w().optional().describe(`SELECT DISTINCT flag`)}),H=z(()=>ks.extend({expand:I(()=>N(x(),H)).optional().describe(`Recursive relation loading map. Keys are lookup/master_detail field names; values are nested QueryAST objects that control select, filter, sort, and further expansion on the related object. The engine resolves expand via batch $in queries (driver-agnostic) with a default max depth of 3.`)})),As=[`today`,`yesterday`,`tomorrow`,`now`],js=[`current_week_start`,`current_week_end`,`current_month_start`,`current_month_end`,`current_quarter_start`,`current_quarter_end`,`current_year_start`,`current_year_end`,`last_week_start`,`last_week_end`,`last_month_start`,`last_month_end`,`last_quarter_start`,`last_quarter_end`,`last_year_start`,`last_year_end`,`next_week_start`,`next_week_end`,`next_month_start`,`next_month_end`,`next_quarter_start`,`next_quarter_end`,`next_year_start`,`next_year_end`],Ms=[`week_start`,`week_end`,`month_start`,`month_end`,`quarter_start`,`quarter_end`,`year_start`,`year_end`],Ns=[...As,...js,...Ms],Ps=/^(\d+)_(minutes?|hours?|days?|weeks?|months?|years?)_(ago|from_now)$/,Fs=[`minute`,`hour`,`day`,`week`,`month`,`year`];function Is(e){return Ns.includes(e)||Ps.test(e)}x().refine(Is,{message:`Unknown date macro. Must be a fixed token (see DATE_MACRO_TOKENS) or match {N_<unit>_(ago|from_now)} where unit is one of: `+Fs.join(`, `)});var Ls=/^\$?\{([a-zA-Z0-9_]+)\}$/;x().refine(e=>{let t=e.match(Ls);return!!t&&Is(t[1])},{message:`Not a recognised {date-macro} placeholder`});var Rs=z(()=>x().min(2,{message:`System identifier must be at least 2 characters`}).regex(/^[a-z][a-z0-9_.]*$/,{message:`System identifier must be lowercase, starting with a letter, and may contain letters, numbers, underscores, or dots (e.g., "user_profile" or "order.created")`}).describe(`System identifier (lowercase with underscores or dots)`)),zs=z(()=>x().min(2,{message:`Identifier must be at least 2 characters`}).regex(/^[a-z][a-z0-9_]*$/,{message:`Identifier must be lowercase snake_case, starting with a letter, and may contain only letters, numbers, and underscores (e.g., "user_profile")`}).describe(`Snake case identifier (lowercase with underscores only)`));z(()=>x().min(3,{message:`Event name must be at least 3 characters`}).regex(/^[a-z][a-z0-9_.]*$/,{message:`Event name must be lowercase with dots for namespacing (e.g., "user.created", "order.paid")`}).describe(`Event name (lowercase with dot notation for namespacing)`));var Bs=P([`cel`,`js`,`cron`,`template`]),Vs=k({rationale:x().optional(),generatedBy:x().optional()}),Hs=k({dialect:Bs,source:x().min(1).optional(),ast:E().optional(),meta:Vs.optional()}).refine(e=>e.source!==void 0||e.ast!==void 0,{message:"Expression requires at least one of `source` or `ast`"}),U=A([x().min(1).transform(e=>({dialect:`cel`,source:e})),Hs]);A([x().min(1).transform(e=>({dialect:`cron`,source:e})),Hs]);var Us=A([x().min(1).transform(e=>({dialect:`template`,source:e})),Hs]),Ws=z(()=>P([`aes-256-gcm`,`aes-256-cbc`,`chacha20-poly1305`]).describe(`Supported encryption algorithm`)),Gs=z(()=>P([`local`,`aws-kms`,`azure-key-vault`,`gcp-kms`,`hashicorp-vault`]).describe(`Key management service provider`)),Ks=z(()=>k({enabled:w().default(!1).describe(`Enable automatic key rotation`),frequencyDays:C().min(1).default(90).describe(`Rotation frequency in days`),retainOldVersions:C().default(3).describe(`Number of old key versions to retain`),autoRotate:w().default(!0).describe(`Automatically rotate without manual approval`)}).describe(`Policy for automatic encryption key rotation`)),qs=z(()=>k({enabled:w().default(!1).describe(`Enable field-level encryption`),algorithm:Ws.default(`aes-256-gcm`).describe(`Encryption algorithm`),keyManagement:k({provider:Gs.describe(`Key management service provider`),keyId:x().optional().describe(`Key identifier in the provider`),rotationPolicy:Ks.optional().describe(`Key rotation policy`)}).describe(`Key management configuration`),scope:P([`field`,`record`,`table`,`database`]).describe(`Encryption scope level`),deterministicEncryption:w().default(!1).describe(`Allows equality queries on encrypted data`),searchableEncryption:w().default(!1).describe(`Allows search on encrypted data`)}).describe(`Field-level encryption configuration`));z(()=>k({fieldName:x().describe(`Name of the field to encrypt`),encryptionConfig:qs.describe(`Encryption settings for this field`),indexable:w().default(!1).describe(`Allow indexing on encrypted field`)}).describe(`Per-field encryption assignment`));var Js=z(()=>P([`redact`,`partial`,`hash`,`tokenize`,`randomize`,`nullify`,`substitute`]).describe(`Data masking strategy for PII protection`)),Ys=z(()=>k({field:x().describe(`Field name to apply masking to`),strategy:Js.describe(`Masking strategy to use`),pattern:x().optional().describe(`Regex pattern for partial masking`),preserveFormat:w().default(!0).describe(`Keep the original data format after masking`),preserveLength:w().default(!0).describe(`Keep the original data length after masking`),roles:O(x()).optional().describe(`Roles that see masked data`),exemptRoles:O(x()).optional().describe(`Roles that see unmasked data`)}).describe(`Masking rule for a single field`));z(()=>k({enabled:w().default(!1).describe(`Enable data masking`),rules:O(Ys).describe(`List of field-level masking rules`),auditUnmasking:w().default(!0).describe(`Log when masked data is accessed unmasked`)}).describe(`Top-level data masking configuration for PII protection`));var Xs=P(`text.textarea.email.url.phone.password.markdown.html.richtext.number.currency.percent.date.datetime.time.boolean.toggle.select.multiselect.radio.checkboxes.lookup.master_detail.tree.image.file.avatar.video.audio.formula.summary.autonumber.location.address.code.json.color.rating.slider.signature.qrcode.progress.tags.vector`.split(`.`)),Zs=z(()=>k({label:x().describe(`Display label (human-readable, any case allowed)`),value:Rs.describe(`Stored value (lowercase machine identifier)`),color:x().optional().describe(`Color code for badges/charts`),default:w().optional().describe(`Is default option`)}));z(()=>k({latitude:C().min(-90).max(90).describe(`Latitude coordinate`),longitude:C().min(-180).max(180).describe(`Longitude coordinate`),altitude:C().optional().describe(`Altitude in meters`),accuracy:C().optional().describe(`Accuracy in meters`)}));var Qs=z(()=>k({precision:C().int().min(0).max(10).default(2).describe(`Decimal precision (default: 2)`),currencyMode:P([`dynamic`,`fixed`]).default(`dynamic`).describe(`Currency mode: dynamic (user selectable) or fixed (single currency)`),defaultCurrency:x().length(3).default(`CNY`).describe(`Default or fixed currency code (ISO 4217, e.g., USD, CNY, EUR)`)}));z(()=>k({value:C().describe(`Monetary amount`),currency:x().length(3).describe(`Currency code (ISO 4217)`)})),z(()=>k({street:x().optional().describe(`Street address`),city:x().optional().describe(`City name`),state:x().optional().describe(`State/Province`),postalCode:x().optional().describe(`Postal/ZIP code`),country:x().optional().describe(`Country name or code`),countryCode:x().optional().describe(`ISO country code (e.g., US, GB)`),formatted:x().optional().describe(`Formatted address string`)}));var $s=z(()=>k({dimensions:C().int().min(1).max(1e4).describe(`Vector dimensionality (e.g., 1536 for OpenAI embeddings)`),distanceMetric:P([`cosine`,`euclidean`,`dotProduct`,`manhattan`]).default(`cosine`).describe(`Distance/similarity metric for vector search`),normalized:w().default(!1).describe(`Whether vectors are normalized (unit length)`),indexed:w().default(!0).describe(`Whether to create a vector index for fast similarity search`),indexType:P([`hnsw`,`ivfflat`,`flat`]).optional().describe(`Vector index algorithm (HNSW for high accuracy, IVFFlat for large datasets)`)})),ec=z(()=>k({minSize:C().min(0).optional().describe(`Minimum file size in bytes`),maxSize:C().min(1).optional().describe(`Maximum file size in bytes (e.g., 10485760 = 10MB)`),allowedTypes:O(x()).optional().describe(`Allowed file extensions (e.g., [".pdf", ".docx", ".jpg"])`),blockedTypes:O(x()).optional().describe(`Blocked file extensions (e.g., [".exe", ".bat", ".sh"])`),allowedMimeTypes:O(x()).optional().describe(`Allowed MIME types (e.g., ["image/jpeg", "application/pdf"])`),blockedMimeTypes:O(x()).optional().describe(`Blocked MIME types`),virusScan:w().default(!1).describe(`Enable virus scanning for uploaded files`),virusScanProvider:P([`clamav`,`virustotal`,`metadefender`,`custom`]).optional().describe(`Virus scanning service provider`),virusScanOnUpload:w().default(!0).describe(`Scan files immediately on upload`),quarantineOnThreat:w().default(!0).describe(`Quarantine files if threat detected`),storageProvider:x().optional().describe(`Object storage provider name (references ObjectStorageConfig)`),storageBucket:x().optional().describe(`Target bucket name`),storagePrefix:x().optional().describe(`Storage path prefix (e.g., "uploads/documents/")`),imageValidation:k({minWidth:C().min(1).optional().describe(`Minimum image width in pixels`),maxWidth:C().min(1).optional().describe(`Maximum image width in pixels`),minHeight:C().min(1).optional().describe(`Minimum image height in pixels`),maxHeight:C().min(1).optional().describe(`Maximum image height in pixels`),aspectRatio:x().optional().describe(`Required aspect ratio (e.g., "16:9", "1:1")`),generateThumbnails:w().default(!1).describe(`Auto-generate thumbnails`),thumbnailSizes:O(k({name:x().describe(`Thumbnail variant name (e.g., "small", "medium", "large")`),width:C().min(1).describe(`Thumbnail width in pixels`),height:C().min(1).describe(`Thumbnail height in pixels`),crop:w().default(!1).describe(`Crop to exact dimensions`)})).optional().describe(`Thumbnail size configurations`),preserveMetadata:w().default(!1).describe(`Preserve EXIF metadata`),autoRotate:w().default(!0).describe(`Auto-rotate based on EXIF orientation`)}).optional().describe(`Image-specific validation rules`),allowMultiple:w().default(!1).describe(`Allow multiple file uploads (overrides field.multiple)`),allowReplace:w().default(!0).describe(`Allow replacing existing files`),allowDelete:w().default(!0).describe(`Allow deleting uploaded files`),requireUpload:w().default(!1).describe(`Require at least one file when field is required`),extractMetadata:w().default(!0).describe(`Extract file metadata (name, size, type, etc.)`),extractText:w().default(!1).describe(`Extract text content from documents (OCR/parsing)`),versioningEnabled:w().default(!1).describe(`Keep previous versions of replaced files`),maxVersions:C().min(1).optional().describe(`Maximum number of versions to retain`),publicRead:w().default(!1).describe(`Allow public read access to uploaded files`),presignedUrlExpiry:C().min(60).max(604800).default(3600).describe(`Presigned URL expiration in seconds (default: 1 hour)`)}).refine(e=>!(e.minSize!==void 0&&e.maxSize!==void 0&&e.minSize>e.maxSize),{message:`minSize must be less than or equal to maxSize`}).refine(e=>!(e.virusScanProvider!==void 0&&e.virusScan!==!0),{message:`virusScanProvider requires virusScan to be enabled`})),tc=z(()=>k({uniqueness:w().default(!1).describe(`Enforce unique values across all records`),completeness:C().min(0).max(1).default(0).describe(`Minimum ratio of non-null values (0-1, default: 0 = no requirement)`),accuracy:k({source:x().describe(`Reference data source for validation (e.g., "api.verify.com", "master_data")`),threshold:C().min(0).max(1).describe(`Minimum accuracy threshold (0-1, e.g., 0.95 = 95% match required)`)}).optional().describe(`Accuracy validation configuration`)})),nc=z(()=>k({enabled:w().describe(`Enable caching for computed field results`),ttl:C().min(0).describe(`Cache TTL in seconds (0 = no expiration)`),invalidateOn:O(x()).describe(`Field paths that invalidate cache (e.g., ["inventory.quantity", "pricing.base_price"])`)})),rc=z(()=>k({name:x().regex(/^[a-z_][a-z0-9_]*$/).describe(`Machine name (snake_case)`).optional(),label:x().optional().describe(`Human readable label`),type:Xs.describe(`Field Data Type`),description:x().optional().describe(`Tooltip/Help text`),format:x().optional().describe(`Format string (e.g. email, phone)`),columnName:x().optional().describe(`Physical column name in the target datasource. Defaults to the field key when not set.`),required:w().default(!1).describe(`Is required`),searchable:w().default(!1).describe(`Is searchable`),multiple:w().default(!1).describe(`Allow multiple values (Stores as Array/JSON). Applicable for select, lookup, file, image.`),unique:w().default(!1).describe(`Is unique constraint`),defaultValue:E().optional().describe(`Default value`),maxLength:C().optional().describe(`Max character length`),minLength:C().optional().describe(`Min character length`),precision:C().optional().describe(`Total digits`),scale:C().optional().describe(`Decimal places`),min:C().optional().describe(`Minimum value`),max:C().optional().describe(`Maximum value`),options:O(Zs).optional().describe(`Static options for select/multiselect`),reference:x().optional().describe(`Target object name (snake_case) for lookup/master_detail fields. Required for relationship types. Used by $expand to resolve foreign key IDs into full objects.`),referenceFilters:O(x()).optional().describe(`Filters applied to lookup dialogs (e.g. "active = true")`),writeRequiresMasterRead:w().optional().describe(`If true, user needs read access to master record to edit this field`),deleteBehavior:P([`set_null`,`cascade`,`restrict`]).optional().default(`set_null`).describe(`What happens if referenced record is deleted`),expression:U.optional().describe("Formula expression (CEL). e.g. F`record.amount * 0.1`"),summaryOperations:k({object:x().describe(`Source child object name for roll-up`),field:x().describe(`Field on child object to aggregate`),function:P([`count`,`sum`,`min`,`max`,`avg`]).describe(`Aggregation function to apply`)}).optional().describe(`Roll-up summary definition`),language:x().optional().describe(`Programming language for syntax highlighting (e.g., javascript, python, sql)`),theme:x().optional().describe(`Code editor theme (e.g., dark, light, monokai)`),lineNumbers:w().optional().describe(`Show line numbers in code editor`),maxRating:C().optional().describe(`Maximum rating value (default: 5)`),allowHalf:w().optional().describe(`Allow half-star ratings`),displayMap:w().optional().describe(`Display map widget for location field`),allowGeocoding:w().optional().describe(`Allow address-to-coordinate conversion`),addressFormat:P([`us`,`uk`,`international`]).optional().describe(`Address format template`),colorFormat:P([`hex`,`rgb`,`rgba`,`hsl`]).optional().describe(`Color value format`),allowAlpha:w().optional().describe(`Allow transparency/alpha channel`),presetColors:O(x()).optional().describe(`Preset color options`),step:C().optional().describe(`Step increment for slider (default: 1)`),showValue:w().optional().describe(`Display current value on slider`),marks:N(x(),x()).optional().describe(`Custom marks/labels at specific values (e.g., {0: "Low", 50: "Medium", 100: "High"})`),barcodeFormat:P([`qr`,`ean13`,`ean8`,`code128`,`code39`,`upca`,`upce`]).optional().describe(`Barcode format type`),qrErrorCorrection:P([`L`,`M`,`Q`,`H`]).optional().describe(`QR code error correction level (L=7%, M=15%, Q=25%, H=30%). Only applicable when barcodeFormat is "qr"`),displayValue:w().optional().describe(`Display human-readable value below barcode/QR code`),allowScanning:w().optional().describe(`Enable camera scanning for barcode/QR code input`),currencyConfig:Qs.optional().describe(`Configuration for currency field type`),vectorConfig:$s.optional().describe(`Configuration for vector field type (AI/ML embeddings)`),fileAttachmentConfig:ec.optional().describe(`Configuration for file and attachment field types`),encryptionConfig:qs.optional().describe(`Field-level encryption configuration for sensitive data (GDPR/HIPAA/PCI-DSS)`),maskingRule:Ys.optional().describe(`Data masking rules for PII protection`),auditTrail:w().default(!1).describe(`Enable detailed audit trail for this field (tracks all changes with user and timestamp)`),dependencies:O(x()).optional().describe(`Array of field names that this field depends on (for formulas, visibility rules, etc.)`),cached:nc.optional().describe(`Caching configuration for computed/formula fields`),dataQuality:tc.optional().describe(`Data quality validation and monitoring rules`),group:x().optional().describe(`Field group name for organizing fields in forms and layouts (e.g., "contact_info", "billing", "system")`),conditionalRequired:U.optional().describe("Predicate (CEL) — field is required when TRUE. e.g. P`record.status == 'closed_won'`"),hidden:w().default(!1).describe(`Hidden from default UI`),readonly:w().default(!1).describe(`Read-only in UI`),system:w().optional().describe(`Auto-injected system/audit field (e.g. created_at, updated_by, organization_id). Tools that surface system fields separately from author-declared business fields should branch on this flag.`),sortable:w().optional().default(!0).describe(`Whether field is sortable in list views`),inlineHelpText:x().optional().describe(`Help text displayed below the field in forms`),trackFeedHistory:w().optional().describe(`Track field changes in Chatter/activity feed (Salesforce pattern)`),caseSensitive:w().optional().describe(`Whether text comparisons are case-sensitive`),autonumberFormat:x().optional().describe(`Auto-number display format pattern (e.g., "CASE-{0000}")`),index:w().default(!1).describe(`Create standard database index`),externalId:w().default(!1).describe(`Is external ID for upsert operations`)})),ic=k({name:x().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique rule name (snake_case)`),label:x().optional().describe(`Human-readable label for the rule listing`),description:x().optional().describe(`Administrative notes explaining the business reason`),active:w().default(!0),events:O(P([`insert`,`update`,`delete`])).default([`insert`,`update`]).describe(`Validation contexts`),priority:C().int().min(0).max(9999).default(100).describe(`Execution priority (lower runs first, default: 100)`),tags:O(x()).optional().describe(`Categorization tags (e.g., "compliance", "billing")`),severity:P([`error`,`warning`,`info`]).default(`error`),message:x().describe(`Error message to display to the user`)}),ac=z(()=>ic.extend({type:F(`script`),condition:U.describe("Predicate (CEL). If TRUE, validation fails. e.g. P`record.amount < 0`")})),oc=z(()=>ic.extend({type:F(`unique`),fields:O(x()).describe(`Fields that must be combined unique`),scope:U.optional().describe("Predicate (CEL) limiting uniqueness scope. e.g. P`record.active == true`"),caseSensitive:w().default(!0)})),sc=z(()=>ic.extend({type:F(`state_machine`),field:x().describe(`State field (e.g. status)`),transitions:N(x(),O(x())).describe(`Map of { OldState: [AllowedNewStates] }`)})),cc=z(()=>ic.extend({type:F(`format`),field:x(),regex:x().optional(),format:P([`email`,`url`,`phone`,`json`]).optional()})),lc=z(()=>ic.extend({type:F(`cross_field`),condition:U.describe("Predicate (CEL) comparing fields. e.g. P`record.end_date > record.start_date`"),fields:O(x()).describe(`Fields involved in the validation`)})),uc=z(()=>ic.extend({type:F(`json_schema`),field:x().describe(`JSON field to validate`),schema:N(x(),E()).describe(`JSON Schema object definition`)})),dc=z(()=>ic.extend({type:F(`async`),field:x().describe(`Field to validate`),validatorUrl:x().optional().describe(`External API endpoint for validation`),method:P([`GET`,`POST`]).default(`GET`).describe(`HTTP method for external call`),headers:N(x(),x()).optional().describe(`Custom headers for the request`),validatorFunction:x().optional().describe(`Reference to custom validator function`),timeout:C().optional().default(5e3).describe(`Timeout in milliseconds`),debounce:C().optional().describe(`Debounce delay in milliseconds`),params:N(x(),E()).optional().describe(`Additional parameters to pass to validator`)})),fc=z(()=>ic.extend({type:F(`custom`),handler:x().describe(`Name of the custom validation function registered in the system`),params:N(x(),E()).optional().describe(`Parameters passed to the custom handler`)})),pc=I(()=>j(`type`,[ac,oc,sc,cc,lc,uc,dc,fc,mc])),mc=z(()=>ic.extend({type:F(`conditional`),when:U.describe("Predicate (CEL). e.g. P`record.type == 'enterprise'`"),then:pc.describe(`Validation rule to apply when condition is true`),otherwise:pc.optional().describe(`Validation rule to apply when condition is false`)})),hc=z(()=>A([x().describe(`Action Name`),k({type:x(),params:N(x(),E()).optional()})])),gc=z(()=>A([x().describe(`Guard Name (e.g., "isManager", "amountGT1000")`),k({type:x(),params:N(x(),E()).optional()})])),_c=z(()=>k({target:x().optional().describe(`Target State ID`),cond:gc.optional().describe(`Condition (Guard) required to take this path`),actions:O(hc).optional().describe(`Actions to execute during transition`),description:x().optional().describe(`Human readable description of this rule`)}));z(()=>k({type:x().describe(`Event Type (e.g. "APPROVE", "REJECT", "Submit")`),schema:N(x(),E()).optional().describe(`Expected event payload structure`)}));var vc=I(()=>k({type:P([`atomic`,`compound`,`parallel`,`final`,`history`]).default(`atomic`),entry:O(hc).optional().describe(`Actions to run when entering this state`),exit:O(hc).optional().describe(`Actions to run when leaving this state`),on:N(x(),A([x(),_c,O(_c)])).optional().describe(`Map of Event Type -> Transition Definition`),always:O(_c).optional(),initial:x().optional().describe(`Initial child state (if compound)`),states:N(x(),vc).optional(),meta:k({label:x().optional(),description:x().optional(),color:x().optional(),aiInstructions:x().optional().describe(`Specific instructions for AI when in this state`)}).optional()})),yc=z(()=>k({id:zs.describe(`Unique Machine ID`),description:x().optional(),contextSchema:N(x(),E()).optional().describe(`Zod Schema for the machine context/memory`),initial:x().describe(`Initial State ID`),states:N(x(),vc).describe(`State Nodes`),on:N(x(),A([x(),_c,O(_c)])).optional()}));z(()=>k({key:x().describe(`Translation key (e.g., "views.task_list.label")`),defaultValue:x().optional().describe(`Fallback value when translation key is not found`),params:N(x(),A([x(),C(),w()])).optional().describe(`Interpolation parameters (e.g., { count: 5 })`)}));var W=z(()=>x().describe(`Display label (plain string; i18n keys are auto-generated by the framework)`)),bc=z(()=>k({ariaLabel:W.optional().describe(`Accessible label for screen readers (WAI-ARIA aria-label)`),ariaDescribedBy:x().optional().describe(`ID of element providing additional description (WAI-ARIA aria-describedby)`),role:x().optional().describe(`WAI-ARIA role attribute (e.g., "dialog", "navigation", "alert")`)}).describe(`ARIA accessibility attributes`));z(()=>k({key:x().describe(`Translation key`),zero:x().optional().describe(`Zero form (e.g., "No items")`),one:x().optional().describe(`Singular form (e.g., "{count} item")`),two:x().optional().describe(`Dual form (e.g., "{count} items" for exactly 2)`),few:x().optional().describe(`Few form (e.g., for 2-4 in some languages)`),many:x().optional().describe(`Many form (e.g., for 5+ in some languages)`),other:x().describe(`Default plural form (e.g., "{count} items")`)}).describe(`ICU plural rules for a translation key`));var xc=z(()=>k({style:P([`decimal`,`currency`,`percent`,`unit`]).default(`decimal`).describe(`Number formatting style`),currency:x().optional().describe(`ISO 4217 currency code (e.g., "USD", "EUR")`),unit:x().optional().describe(`Unit for unit formatting (e.g., "kilometer", "liter")`),minimumFractionDigits:C().optional().describe(`Minimum number of fraction digits`),maximumFractionDigits:C().optional().describe(`Maximum number of fraction digits`),useGrouping:w().optional().describe(`Whether to use grouping separators (e.g., 1,000)`)}).describe(`Number formatting rules`)),Sc=z(()=>k({dateStyle:P([`full`,`long`,`medium`,`short`]).optional().describe(`Date display style`),timeStyle:P([`full`,`long`,`medium`,`short`]).optional().describe(`Time display style`),timeZone:x().optional().describe(`IANA time zone (e.g., "America/New_York")`),hour12:w().optional().describe(`Use 12-hour format`)}).describe(`Date/time formatting rules`));z(()=>k({code:x().describe(`BCP 47 language code (e.g., "en-US", "zh-CN")`),fallbackChain:O(x()).optional().describe(`Fallback language codes in priority order (e.g., ["zh-TW", "en"])`),direction:P([`ltr`,`rtl`]).default(`ltr`).describe(`Text direction: left-to-right or right-to-left`),numberFormat:xc.optional().describe(`Default number formatting rules`),dateFormat:Sc.optional().describe(`Default date/time formatting rules`)}).describe(`Locale configuration`));var Cc=P([`api.read`,`api.write`,`crypto.uuid`,`crypto.hash`,`log`]),wc=j(`language`,[k({language:F(`expression`),source:x().min(1).describe(`Formula expression source`)}).describe(`L1 expression body — pure formula, no IO`),k({language:F(`js`),source:x().min(1).describe(`Function body source`),capabilities:O(Cc).default([]).describe(`Granted capability tokens`),timeoutMs:C().int().positive().max(3e4).optional().describe(`Per-invocation timeout (ms)`),memoryMb:C().int().positive().max(256).optional().describe(`Per-invocation memory cap (MB)`)}).describe(`L2 sandboxed JS body — runs inside an isolated VM with declared capabilities`)]).describe(`Hook/Action body — expression (L1) or sandboxed JS (L2)`),Tc=z(()=>k({name:x().optional(),field:zs.optional(),objectOverride:zs.optional(),label:W.optional(),type:Xs.optional(),required:w().optional().default(!1),options:O(k({label:W,value:x()})).optional(),placeholder:x().optional(),helpText:x().optional(),defaultValue:E().optional(),defaultFromRow:w().optional()}).refine(e=>!!e.name||!!e.field,{message:`ActionParam requires either "name" or "field"`})),Ec=P([`script`,`url`,`modal`,`flow`,`api`,`form`]),Dc=new Set(Ec.options.filter(e=>e!==`script`)),Oc=z(()=>k({name:zs.describe(`Machine name (lowercase snake_case)`),label:W.describe(`Display label`),objectName:x().regex(/^[a-z_][a-z0-9_]*$/).optional().describe(`Target object this action belongs to. When set, the action is auto-merged into the object's actions array by defineStack().`),icon:x().optional().describe(`Icon name`),locations:O(P([`list_toolbar`,`list_item`,`record_header`,`record_more`,`record_related`,`global_nav`])).optional().describe(`Locations where this action is visible`),component:P([`action:button`,`action:icon`,`action:menu`,`action:group`]).optional().describe(`Visual component override`),type:Ec.default(`script`).describe(`Action functionality type`),target:x().optional().describe(`URL, Script Name, Flow ID, or API Endpoint`),body:wc.optional().describe("Action body — expression (L1) or sandboxed JS (L2). Only used when type is `script`."),execute:x().optional().describe(`@deprecated — Use target instead. Auto-migrated to target during parsing.`),params:O(Tc).optional().describe(`Input parameters required from user`),variant:P([`primary`,`secondary`,`danger`,`ghost`,`link`]).optional().describe(`Button visual variant for styling (primary = highlighted, danger = destructive, ghost = transparent)`),confirmText:W.optional().describe(`Confirmation message before execution`),successMessage:W.optional().describe(`Success message to show after execution`),refreshAfter:w().default(!1).describe(`Refresh view after execution`),visible:U.optional().describe(`Visibility predicate (CEL).`),disabled:A([w(),U]).optional().describe(`Boolean or predicate (CEL) — action is disabled when TRUE.`),shortcut:x().optional().describe(`Keyboard shortcut to trigger this action (e.g., "Ctrl+S")`),bulkEnabled:w().optional().describe(`Whether this action can be applied to multiple selected records`),aiExposed:w().optional().describe(`Set to false to keep this action out of the AI tool registry.`),recordIdParam:x().optional().describe(`Body key to inject the row id into when running from a list_item context.`),recordIdField:x().optional().describe(`Row field whose value seeds recordIdParam. Defaults to "id".`),bodyShape:A([F(`flat`),k({wrap:x()})]).optional().describe(`Body wrapping: flat (default) or { wrap: key } to nest user-collected params under a key.`),method:P([`POST`,`PATCH`,`PUT`,`DELETE`]).optional().describe(`HTTP method for type:"api" actions. Defaults to POST.`),bodyExtra:N(x(),E()).optional().describe(`Constant body fields merged into the API request (applied last; overrides user params).`),mode:P([`create`,`edit`,`delete`,`custom`]).optional().describe(`Semantic mode of the action.`),timeout:C().optional().describe(`Maximum execution time in milliseconds for the action`),aria:bc.optional().describe(`ARIA accessibility attributes`)}).transform(e=>e.execute&&!e.target?{...e,target:e.execute}:e).refine(e=>!(Dc.has(e.type)&&!e.target),{message:`Action 'target' is required when type is 'url', 'flow', 'modal', 'api', or 'form'.`,path:[`target`]})),kc=z(()=>k({enabled:w().default(!1).describe(`Enable public sharing`),publicLink:x().optional().describe(`Generated public share URL`),password:x().optional().describe(`Password required to access shared link`),allowedDomains:O(x()).optional().describe(`Restrict access to specific email domains (e.g. ["example.com"])`),expiresAt:x().optional().describe(`Expiration date/time in ISO 8601 format`),allowAnonymous:w().optional().default(!1).describe(`Allow access without authentication`)}));z(()=>k({enabled:w().default(!1).describe(`Enable iframe embedding`),allowedOrigins:O(x()).optional().describe(`Allowed iframe parent origins (e.g. ["https://example.com"])`),width:x().optional().default(`100%`).describe(`Embed width (CSS value)`),height:x().optional().default(`600px`).describe(`Embed height (CSS value)`),showHeader:w().optional().default(!0).describe(`Show interface header in embed`),showNavigation:w().optional().default(!1).describe(`Show navigation in embed`),responsive:w().optional().default(!0).describe(`Enable responsive resizing`)}));var Ac=P([`xs`,`sm`,`md`,`lg`,`xl`,`2xl`]),jc=z(()=>k({xs:C().min(1).max(12).optional(),sm:C().min(1).max(12).optional(),md:C().min(1).max(12).optional(),lg:C().min(1).max(12).optional(),xl:C().min(1).max(12).optional(),"2xl":C().min(1).max(12).optional()}).describe(`Grid columns per breakpoint (1-12)`)),Mc=z(()=>k({xs:C().optional(),sm:C().optional(),md:C().optional(),lg:C().optional(),xl:C().optional(),"2xl":C().optional()}).describe(`Display order per breakpoint`)),Nc=z(()=>k({breakpoint:Ac.optional().describe(`Minimum breakpoint for visibility`),hiddenOn:O(Ac).optional().describe(`Hide on these breakpoints`),columns:jc.optional().describe(`Grid columns per breakpoint`),order:Mc.optional().describe(`Display order per breakpoint`)}).describe(`Responsive layout configuration`)),Pc=z(()=>k({lazyLoad:w().optional().describe(`Enable lazy loading (defer rendering until visible)`),virtualScroll:k({enabled:w().default(!1).describe(`Enable virtual scrolling`),itemHeight:C().optional().describe(`Fixed item height in pixels (for estimation)`),overscan:C().optional().describe(`Number of extra items to render outside viewport`)}).optional().describe(`Virtual scrolling configuration`),cacheStrategy:P([`none`,`cache-first`,`network-first`,`stale-while-revalidate`]).optional().describe(`Client-side data caching strategy`),prefetch:w().optional().describe(`Prefetch data before component is visible`),pageSize:C().optional().describe(`Number of items per page for pagination`),debounceMs:C().optional().describe(`Debounce interval for user interactions in milliseconds`)}).describe(`Performance optimization configuration`)),Fc=P([`GET`,`POST`,`PUT`,`DELETE`,`PATCH`,`HEAD`,`OPTIONS`]),Ic=z(()=>P([`GET`,`POST`,`PUT`,`PATCH`,`DELETE`])),Lc=z(()=>k({url:x().describe(`API endpoint URL`),method:Ic.optional().default(`GET`).describe(`HTTP method`),headers:N(x(),x()).optional().describe(`Custom HTTP headers`),params:N(x(),E()).optional().describe(`Query parameters`),body:E().optional().describe(`Request body for POST/PUT/PATCH`)}));z(()=>k({enabled:w().default(!0).describe(`Enable CORS`),origins:A([x(),O(x())]).default(`*`).describe(`Allowed origins (* for all)`),methods:O(Fc).optional().describe(`Allowed HTTP methods`),credentials:w().default(!1).describe(`Allow credentials (cookies, authorization headers)`),maxAge:C().int().optional().describe(`Preflight cache duration in seconds`)})),z(()=>k({enabled:w().default(!1).describe(`Enable rate limiting`),windowMs:C().int().default(6e4).describe(`Time window in milliseconds`),maxRequests:C().int().default(100).describe(`Max requests per window`)})),z(()=>k({path:x().describe(`URL path to serve from`),directory:x().describe(`Physical directory to serve`),cacheControl:x().optional().describe(`Cache-Control header value`)}));var Rc=z(()=>j(`provider`,[k({provider:F(`object`),object:x().describe(`Target object name`)}),k({provider:F(`api`),read:Lc.optional().describe(`Configuration for fetching data`),write:Lc.optional().describe(`Configuration for submitting data (for forms/editable tables)`)}),k({provider:F(`value`),items:O(E()).describe(`Static data array`)})])),zc=z(()=>k({field:x().describe(`Field name to filter on`),operator:x().describe(`Filter operator (e.g. equals, not_equals, contains, this_quarter)`),value:A([x(),C(),w(),ho(),O(A([x(),C()]))]).optional().describe(`Filter value`)}).describe(`View filter rule`)),Bc=z(()=>P([`none`,`count`,`count_empty`,`count_filled`,`count_unique`,`percent_empty`,`percent_filled`,`sum`,`avg`,`min`,`max`]).describe(`Aggregation function for column footer summary`)),Vc=z(()=>k({field:x().describe(`Field name (snake_case)`),label:W.optional().describe(`Display label override`),width:C().positive().optional().describe(`Column width in pixels`),align:P([`left`,`center`,`right`]).optional().describe(`Text alignment`),hidden:w().optional().describe(`Hide column by default`),sortable:w().optional().describe(`Allow sorting by this column`),resizable:w().optional().describe(`Allow resizing this column`),wrap:w().optional().describe(`Allow text wrapping`),type:x().optional().describe(`Renderer type override (e.g., "currency", "date")`),pinned:P([`left`,`right`]).optional().describe(`Pin/freeze column to left or right side`),summary:Bc.optional().describe(`Footer aggregation function for this column`),link:w().optional().describe(`Functions as the primary navigation link (triggers View navigation)`),action:x().optional().describe(`Registered Action ID to execute when clicked`)})),Hc=z(()=>k({type:P([`none`,`single`,`multiple`]).default(`none`).describe(`Selection mode`)})),Uc=z(()=>k({pageSize:C().int().positive().default(25).describe(`Number of records per page`),pageSizeOptions:O(C().int().positive()).optional().describe(`Available page size options`)})),Wc=z(()=>P([`compact`,`short`,`medium`,`tall`,`extra_tall`]).describe(`Row height / density setting for list view`)),Gc=z(()=>k({field:x().describe(`Field name to group by`),order:P([`asc`,`desc`]).default(`asc`).describe(`Group sort order`),collapsed:w().default(!1).describe(`Collapse groups by default`)})),Kc=z(()=>k({fields:O(Gc).min(1).describe(`Fields to group by (supports up to 3 levels)`)}).describe(`Record grouping configuration`)),qc=z(()=>k({coverField:x().optional().describe(`Attachment/image field to display as card cover`),coverFit:P([`cover`,`contain`]).default(`cover`).describe(`Image fit mode for card cover`),cardSize:P([`small`,`medium`,`large`]).default(`medium`).describe(`Card size in gallery view`),titleField:x().optional().describe(`Field to display as card title`),visibleFields:O(x()).optional().describe(`Fields to display on card body`)}).describe(`Gallery/card view configuration`)),Jc=z(()=>k({startDateField:x().describe(`Field for timeline item start date`),endDateField:x().optional().describe(`Field for timeline item end date`),titleField:x().describe(`Field to display as timeline item title`),groupByField:x().optional().describe(`Field to group timeline rows`),colorField:x().optional().describe(`Field to determine item color`),scale:P([`hour`,`day`,`week`,`month`,`quarter`,`year`]).default(`week`).describe(`Default timeline scale`)}).describe(`Timeline view configuration`)),Yc=z(()=>k({type:P([`personal`,`collaborative`]).default(`collaborative`).describe(`View ownership type`),lockedBy:x().optional().describe(`User who locked the view configuration`)}).describe(`View sharing and access configuration`)),Xc=z(()=>k({field:x().describe(`Field to derive color from (typically a select/status field)`),colors:N(x(),x()).optional().describe(`Map of field value to color (hex/token)`)}).describe(`Row color configuration based on field values`)),Zc=z(()=>P([`grid`,`kanban`,`gallery`,`calendar`,`timeline`,`gantt`,`map`]).describe(`Visualization type that users can switch to`)),Qc=z(()=>k({sort:w().default(!0).describe(`Allow users to sort records`),search:w().default(!0).describe(`Allow users to search records`),filter:w().default(!0).describe(`Allow users to filter records`),rowHeight:w().default(!0).describe(`Allow users to toggle row height/density`),addRecordForm:w().default(!1).describe(`Add records through a form instead of inline`),buttons:O(x()).optional().describe(`Custom action button IDs to show in the toolbar`)}).describe(`User action toggles for the view toolbar`)),$c=z(()=>k({showDescription:w().default(!0).describe(`Show the view description text`),allowedVisualizations:O(Zc).optional().describe(`Whitelist of visualization types users can switch between (e.g. ["grid", "gallery", "kanban"])`)}).describe(`Appearance and visualization configuration`)),el=z(()=>k({name:zs.describe(`Tab identifier (snake_case)`),label:W.optional().describe(`Display label`),icon:x().optional().describe(`Tab icon name`),view:x().optional().describe(`Referenced list view name from listViews`),filter:O(zc).optional().describe(`Tab-specific filter criteria`),order:C().int().min(0).optional().describe(`Tab display order`),pinned:w().default(!1).describe(`Pin tab (cannot be removed by users)`),isDefault:w().default(!1).describe(`Set as the default active tab`),visible:w().default(!0).describe(`Tab visibility`)}).describe(`Tab configuration for multi-tab view interface`)),tl=z(()=>k({enabled:w().default(!0).describe(`Show the add record entry point`),position:P([`top`,`bottom`,`both`]).default(`bottom`).describe(`Position of the add record button`),mode:P([`inline`,`form`,`modal`]).default(`inline`).describe(`How to add a new record`),formView:x().optional().describe(`Named form view to use when mode is "form" or "modal"`)}).describe(`Add record entry point configuration`)),nl=z(()=>k({groupByField:x().describe(`Field to group columns by (usually status/select)`),summarizeField:x().optional().describe(`Field to sum at top of column (e.g. amount)`),columns:O(x()).describe(`Fields to show on cards`)})),rl=z(()=>k({chartType:P([`bar`,`line`,`pie`,`area`,`scatter`]).default(`bar`).describe(`Chart visualisation type`),xAxisField:x().describe(`Field used as the X axis / category dimension`),yAxisFields:O(x()).min(1).describe(`Field(s) used as the Y axis / measures`),aggregation:P([`sum`,`avg`,`count`,`min`,`max`]).optional().describe(`Aggregation function applied to Y axis fields`),groupByField:x().optional().describe(`Optional field used to split / stack the chart`)}).describe(`List chart view configuration`)),il=z(()=>k({startDateField:x(),endDateField:x().optional(),titleField:x(),colorField:x().optional()})),al=z(()=>k({startDateField:x(),endDateField:x(),titleField:x(),progressField:x().optional(),dependenciesField:x().optional()})),ol=z(()=>P([`page`,`drawer`,`modal`,`split`,`popover`,`new_window`,`none`])),sl=z(()=>k({mode:ol.default(`page`),view:x().optional().describe(`Name of the form view to use for details (e.g. "summary_view", "edit_form")`),preventNavigation:w().default(!1).describe(`Disable standard navigation entirely`),openNewTab:w().default(!1).describe(`Force open in new tab (applies to page mode)`),width:A([x(),C()]).optional().describe(`Width of the drawer/modal (e.g. "600px", "50%")`)})),cl=z(()=>k({name:zs.optional().describe(`Internal view name (lowercase snake_case)`),label:W.optional(),type:P([`grid`,`kanban`,`gallery`,`calendar`,`timeline`,`gantt`,`map`,`chart`]).default(`grid`),data:Rc.optional().describe(`Data source configuration (defaults to "object" provider)`),columns:A([O(x()),O(Vc)]).describe(`Fields to display as columns`),filter:O(zc).optional().describe(`Filter criteria (JSON Rules)`),sort:A([x(),O(k({field:x(),order:P([`asc`,`desc`])}))]).optional(),searchableFields:O(x()).optional().describe(`Fields enabled for search`),filterableFields:O(x()).optional().describe(`Fields enabled for end-user filtering in the top bar`),resizable:w().optional().describe(`Enable column resizing`),striped:w().optional().describe(`Striped row styling`),bordered:w().optional().describe(`Show borders`),compactToolbar:w().optional().describe(`Collapse Group/Color/Density/Hide-fields into a single View settings popover`),selection:Hc.optional().describe(`Row selection configuration`),navigation:sl.optional().describe(`Configuration for item click navigation (page, drawer, modal, etc.)`),pagination:Uc.optional().describe(`Pagination configuration`),kanban:nl.optional(),calendar:il.optional(),gantt:al.optional(),gallery:qc.optional(),timeline:Jc.optional(),chart:rl.optional(),description:W.optional().describe(`View description for documentation/tooltips`),sharing:Yc.optional().describe(`View sharing and access configuration`),rowHeight:Wc.optional().describe(`Row height / density setting`),grouping:Kc.optional().describe(`Group records by one or more fields`),rowColor:Xc.optional().describe(`Color rows based on field value`),hiddenFields:O(x()).optional().describe(`Fields to hide in this specific view`),fieldOrder:O(x()).optional().describe(`Explicit field display order for this view`),rowActions:O(x()).optional().describe(`Actions available for individual row items`),bulkActions:O(x()).optional().describe(`Actions available when multiple rows are selected`),bulkActionDefs:O(N(x(),T())).optional().describe(`Rich bulk action definitions (schema-driven, executed via BulkActionDialog)`),virtualScroll:w().optional().describe(`Enable virtual scrolling for large datasets`),conditionalFormatting:O(k({condition:U.describe(`Predicate (CEL) to evaluate.`),style:N(x(),x()).describe(`CSS styles to apply when condition is true`)})).optional().describe(`Conditional formatting rules for list rows`),inlineEdit:w().optional().describe(`Allow inline editing of records directly in the list view`),exportOptions:O(P([`csv`,`xlsx`,`pdf`,`json`])).optional().describe(`Available export format options`),userActions:Qc.optional().describe(`User action toggles for the view toolbar`),appearance:$c.optional().describe(`Appearance and visualization configuration`),tabs:O(el).optional().describe(`Tab definitions for multi-tab view interface`),addRecord:tl.optional().describe(`Add record entry point configuration`),showRecordCount:w().optional().describe(`Show record count at the bottom of the list`),allowPrinting:w().optional().describe(`Allow users to print the view`),emptyState:k({title:W.optional(),message:W.optional(),icon:x().optional()}).optional().describe(`Empty state configuration when no records found`),aria:bc.optional().describe(`ARIA accessibility attributes for the list view`),responsive:Nc.optional().describe(`Responsive layout configuration`),performance:Pc.optional().describe(`Performance optimization settings`)})),ll=z(()=>k({field:x().describe(`Field name (snake_case)`),label:W.optional().describe(`Display label override`),placeholder:W.optional().describe(`Placeholder text`),helpText:W.optional().describe(`Help/hint text`),readonly:w().optional().describe(`Read-only override`),required:w().optional().describe(`Required override`),hidden:w().optional().describe(`Hidden override`),colSpan:C().int().min(1).max(4).optional().describe(`Column span in grid layout (1-4)`),widget:x().optional().describe(`Custom widget/component name`),dependsOn:x().optional().describe(`Parent field name for cascading`),visibleOn:U.optional().describe(`Visibility predicate (CEL).`)})),ul=z(()=>k({label:W.optional(),collapsible:w().default(!1),collapsed:w().default(!1),columns:A([P([`1`,`2`,`3`,`4`]),F(1),F(2),F(3),F(4)]).default(2).transform(e=>typeof e==`string`?parseInt(e):e),fields:O(A([x(),ll]))})),dl=z(()=>k({type:P([`simple`,`tabbed`,`wizard`,`split`,`drawer`,`modal`]).default(`simple`),data:Rc.optional().describe(`Data source configuration (defaults to "object" provider)`),sections:O(ul).optional(),groups:O(ul).optional(),defaultSort:O(k({field:x().describe(`Field name to sort by`),order:P([`asc`,`desc`]).default(`desc`).describe(`Sort direction`)})).optional().describe(`Default sort order for related list views within this form`),sharing:kc.optional().describe(`Public sharing configuration for this form`),submitBehavior:A([k({kind:F(`thank-you`),title:x().optional(),message:x().optional()}),k({kind:F(`redirect`),url:x(),delayMs:C().int().min(0).optional()}),k({kind:F(`continue`)}),k({kind:F(`next-record`)})]).optional().describe(`Post-submit behavior`),aria:bc.optional().describe(`ARIA accessibility attributes for the form view`)}));z(()=>k({list:cl.optional(),form:dl.optional(),listViews:N(x(),cl).optional().describe(`Additional named list views`),formViews:N(x(),dl).optional().describe(`Additional named form views`)}));var fl=P([`get`,`list`,`create`,`update`,`delete`,`upsert`,`bulk`,`aggregate`,`history`,`search`,`restore`,`purge`,`import`,`export`]),pl=k({trackHistory:w().default(!1).describe(`Enable field history tracking for audit compliance`),searchable:w().default(!0).describe(`Index records for global search`),apiEnabled:w().default(!0).describe(`Expose object via automatic APIs`),apiMethods:O(fl).optional().describe(`Whitelist of allowed API operations`),files:w().default(!1).describe(`Enable file attachments and document management`),feeds:w().default(!1).describe(`Enable social feed, comments, and mentions (Chatter-like)`),activities:w().default(!1).describe(`Enable standard tasks and events tracking`),trash:w().default(!0).describe(`Enable soft-delete with restore capability`),mru:w().default(!0).describe(`Track Most Recently Used (MRU) list for users`),clone:w().default(!0).describe(`Allow record deep cloning`)}),ml=z(()=>k({name:x().optional().describe(`Index name (auto-generated if not provided)`),fields:O(x()).describe(`Fields included in the index`),type:P([`btree`,`hash`,`gin`,`gist`,`fulltext`]).optional().default(`btree`).describe(`Index algorithm type`),unique:w().optional().default(!1).describe(`Whether the index enforces uniqueness`),partial:x().optional().describe(`Partial index condition (SQL WHERE clause for conditional indexes)`)})),hl=z(()=>k({fields:O(x()).describe(`Fields to index for full-text search weighting`),displayFields:O(x()).optional().describe(`Fields to display in search result cards`),filters:O(x()).optional().describe(`Default filters for search results`)})),gl=z(()=>k({enabled:w().describe(`Enable multi-tenancy for this object`),strategy:P([`shared`,`isolated`,`hybrid`]).describe(`Tenant isolation strategy: shared (single DB, row-level), isolated (separate DB per tenant), hybrid (mix)`),tenantField:x().default(`tenant_id`).describe(`Field name for tenant identifier`),crossTenantAccess:w().default(!1).describe(`Allow cross-tenant data access (with explicit permission)`)})),_l=z(()=>k({enabled:w().describe(`Enable soft delete (trash/recycle bin)`),field:x().default(`deleted_at`).describe(`Field name for soft delete timestamp`),cascadeDelete:w().default(!1).describe(`Cascade soft delete to related records`)})),vl=z(()=>k({enabled:w().describe(`Enable record versioning`),strategy:P([`snapshot`,`delta`,`event-sourcing`]).describe(`Versioning strategy: snapshot (full copy), delta (changes only), event-sourcing (event log)`),retentionDays:C().min(1).optional().describe(`Number of days to retain old versions (undefined = infinite)`),versionField:x().default(`version`).describe(`Field name for version number/timestamp`)})),yl=z(()=>k({enabled:w().describe(`Enable table partitioning`),strategy:P([`range`,`hash`,`list`]).describe(`Partitioning strategy: range (date ranges), hash (consistent hashing), list (predefined values)`),key:x().describe(`Field name to partition by`),interval:x().optional().describe(`Partition interval for range strategy (e.g., "1 month", "1 year")`)}).refine(e=>!(e.strategy===`range`&&!e.interval),{message:`interval is required when strategy is "range"`})),bl=z(()=>k({enabled:w().describe(`Enable Change Data Capture`),events:O(P([`insert`,`update`,`delete`])).describe(`Event types to capture`),destination:x().describe(`Destination endpoint (e.g., "kafka://topic", "webhook://url")`)})),xl=z(()=>k({key:x().regex(/^[a-z_][a-z0-9_]*$/,{message:`Field group key must be lowercase snake_case (e.g., "contact_info", "billing", "system")`}).describe(`Group machine key (snake_case). Referenced by Field.group.`),label:x().describe(`Group display label`),icon:x().optional().describe(`Icon name (Lucide/Material) for the group header`),description:x().optional().describe(`Optional description shown under the group header`),defaultExpanded:w().optional().default(!0).describe(`Whether the group is expanded by default`),visibleOn:U.optional().describe(`Visibility predicate (CEL); group is hidden when FALSE.`)})),Sl=k({name:x().regex(/^[a-z_][a-z0-9_]*$/).describe(`Machine unique key (snake_case). Immutable.`),label:x().optional().describe(`Human readable singular label (e.g. "Account")`),pluralLabel:x().optional().describe(`Human readable plural label (e.g. "Accounts")`),description:x().optional().describe(`Developer documentation / description`),icon:x().optional().describe(`Icon name (Lucide/Material) for UI representation`),tags:O(x()).optional().describe(`Categorization tags (e.g. "sales", "system", "reference")`),active:w().optional().default(!0).describe(`Is the object active and usable`),isSystem:w().optional().default(!1).describe(`Is system object (protected from deletion)`),abstract:w().optional().default(!1).describe(`Is abstract base object (cannot be instantiated)`),managedBy:P([`platform`,`config`,`system`,`append-only`,`better-auth`]).optional().describe(`Lifecycle bucket — platform (user CRUD) | config (admin authored) | system (engine-managed) | append-only (audit) | better-auth (identity). UI clients honour the resolved affordance matrix.`),userActions:k({create:w().optional().describe(`Show generic "New" button.`),import:w().optional().describe(`Show CSV import wizard entry.`),edit:w().optional().describe(`Allow inline / form edit of existing rows.`),delete:w().optional().describe(`Show row-level delete + bulk delete.`),exportCsv:w().optional().describe(`Show CSV export entry.`)}).optional().describe(`Per-object override of the resolved CRUD affordance matrix.`),systemFields:A([F(!1),k({tenant:w().optional().describe(`Inject organization_id (multi-tenant only). Default true.`),owner:w().optional().describe(`Reserved for future owner_id auto-injection.`),audit:w().optional().describe(`Reserved for future created_by/updated_by auto-injection.`)})]).optional().describe(`Opt out of, or selectively disable, registry-level system-field auto-injection.`),datasource:x().optional().default(`default`).describe(`Target Datasource ID. "default" is the primary DB.`),fields:N(x().regex(/^[a-z_][a-z0-9_]*$/,{message:`Field names must be lowercase snake_case (e.g., "first_name", "company", "annual_revenue")`}),rc).describe(`Field definitions map. Keys must be snake_case identifiers.`),indexes:O(ml).optional().describe(`Database performance indexes`),fieldGroups:O(xl).refine(e=>new Set(e.map(e=>e.key)).size===e.length,{message:`fieldGroups[].key must be unique within an object`}).optional().describe(`Ordered list of field groups (array order = display order). See ObjectFieldGroupSchema.`),tenancy:gl.optional().describe(`Multi-tenancy configuration for SaaS applications`),softDelete:_l.optional().describe(`Soft delete (trash/recycle bin) configuration`),versioning:vl.optional().describe(`Record versioning and history tracking configuration`),partitioning:yl.optional().describe(`Table partitioning configuration for performance`),cdc:bl.optional().describe(`Change Data Capture (CDC) configuration for real-time data streaming`),validations:O(pc).optional().describe(`Object-level validation rules`),stateMachines:N(x(),yc).optional().describe(`Named state machines for parallel lifecycles (e.g., status, payment, approval)`),displayNameField:x().optional().describe(`Field to use as the record display name (e.g., "name", "title"). Defaults to "name" if present.`),recordName:k({type:P([`text`,`autonumber`]).describe(`Record name type: text (user-entered) or autonumber (system-generated)`),displayFormat:x().optional().describe(`Auto-number format pattern (e.g., "CASE-{0000}", "INV-{YYYY}-{0000}")`),startNumber:C().int().min(0).optional().describe(`Starting number for autonumber (default: 1)`)}).optional().describe(`Record name generation configuration (Salesforce pattern)`),titleFormat:Us.optional().describe(`Title template — supports {{record.field}} interpolation. Overrides displayNameField.`),compactLayout:O(x()).optional().describe(`Primary fields for hover/cards/lookups`),listViews:N(x(),cl).optional().describe(`Built-in named list views (segmented tabs) shipped with the object schema`),defaultDetailForm:x().optional().describe(`Name of the default FormView for record detail / edit screens`),search:hl.optional().describe(`Search engine configuration`),enable:pl.optional().describe(`Enabled system features modules`),recordTypes:O(x()).optional().describe(`Record type names for this object`),sharingModel:P([`private`,`read`,`read_write`,`full`]).optional().describe(`Default sharing model`),keyPrefix:x().max(5).optional().describe(`Short prefix for record IDs (e.g., "001" for Account)`),detail:k({renderViaSchema:w().optional().describe(`Opt this object out of the schema-driven detail renderer`),hideReferenceRail:w().optional().describe(`Suppress the right-hand reference-rail on the detail page`),hideRelatedTab:w().optional().describe(`Suppress the Related tab on the detail page`)}).passthrough().optional().describe(`Detail-page UI hints consumed by @object-ui/plugin-detail synth`),actions:O(Oc).optional().describe(`Actions associated with this object (auto-populated from top-level actions via objectName)`)});function Cl(e){return e.split(`_`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}z(()=>Object.assign(Sl,{create:e=>{let t={...e,label:e.label??Cl(e.name)};return Sl.parse(t)}})),P([`own`,`extend`]),z(()=>k({extend:x().describe(`Target object name (FQN) to extend`),fields:N(x(),rc).optional().describe(`Fields to add/override`),label:x().optional().describe(`Override label for the extended object`),pluralLabel:x().optional().describe(`Override plural label for the extended object`),description:x().optional().describe(`Override description for the extended object`),validations:O(pc).optional().describe(`Additional validation rules to merge into the target object`),indexes:O(ml).optional().describe(`Additional indexes to merge into the target object`),priority:C().int().min(0).max(999).default(200).describe(`Merge priority (higher = applied later)`)}));var wl=P([`beforeFind`,`afterFind`,`beforeFindOne`,`afterFindOne`,`beforeCount`,`afterCount`,`beforeAggregate`,`afterAggregate`,`beforeInsert`,`afterInsert`,`beforeUpdate`,`afterUpdate`,`beforeDelete`,`afterDelete`,`beforeUpdateMany`,`afterUpdateMany`,`beforeDeleteMany`,`afterDeleteMany`]);z(()=>k({name:x().regex(/^[a-z_][a-z0-9_]*$/).describe(`Hook unique name (snake_case)`),label:x().optional().describe(`Description of what this hook does`),object:A([x(),O(x())]).describe(`Target object(s)`),events:O(wl).describe(`Lifecycle events`),handler:A([x(),is(e=>typeof e==`function`,{message:`Expected function`})]).optional().describe("Handler function name (string, post-build) or inline function (pre-build) — DEPRECATED, prefer `body`"),body:wc.optional().describe(`Hook body — expression (L1) or sandboxed JS (L2)`),priority:C().default(100).describe(`Execution priority`),async:w().default(!1).describe(`Run specifically as fire-and-forget`),condition:U.optional().describe('Predicate (CEL); hook runs only when TRUE. e.g. P`record.status == "closed" && record.amount > 1000`'),description:x().optional().describe(`Human-readable description of what this hook does`),retryPolicy:k({maxRetries:C().default(3).describe(`Maximum retry attempts on failure`),backoffMs:C().default(1e3).describe(`Backoff delay between retries in milliseconds`)}).optional().describe(`Retry policy for failed hook executions`),timeout:C().optional().describe(`Maximum execution time in milliseconds before the hook is aborted`),onError:P([`abort`,`log`]).default(`abort`).describe(`Error handling strategy`)})),z(()=>k({id:x().optional().describe(`Unique execution ID for tracing`),object:x(),event:wl,input:N(x(),E()).describe(`Mutable input parameters`),result:E().optional().describe(`Operation result (After hooks only)`),previous:N(x(),E()).optional().describe(`Record state before operation`),session:k({userId:x().optional(),tenantId:x().optional(),roles:O(x()).optional(),accessToken:x().optional(),isSystem:w().optional().describe(`True when the call was made with an elevated system context (engine self-writes)`)}).optional().describe(`Current session context`),transaction:E().optional().describe(`Database transaction handle`),ql:E().describe(`ObjectQL Engine Reference`),api:E().optional().describe(`Cross-object data access (ScopedContext)`),user:k({id:x().optional(),name:x().optional(),email:x().optional()}).optional().describe(`Current user info shortcut`)}));var Tl=P([`none`,`constant`,`lookup`,`split`,`join`,`javascript`,`map`]),El=z(()=>k({source:A([x(),O(x())]).describe(`Source column header(s)`),target:A([x(),O(x())]).describe(`Target object field(s)`),transform:Tl.default(`none`),params:k({value:E().optional(),object:x().optional(),fromField:x().optional(),toField:x().optional(),autoCreate:w().optional(),valueMap:N(x(),E()).optional(),separator:x().optional()}).optional()}));z(()=>k({name:zs.describe(`Mapping unique name (lowercase snake_case)`),label:x().optional(),sourceFormat:P([`csv`,`json`,`xml`,`sql`]).default(`csv`),targetObject:x().describe(`Target Object Name`),fieldMapping:O(El),mode:P([`insert`,`update`,`upsert`]).default(`insert`),upsertKey:O(x()).optional().describe(`Fields to match for upsert (e.g. email)`),extractQuery:H.optional().describe(`Query to run for export only`),errorPolicy:P([`skip`,`abort`,`retry`]).default(`skip`),batchSize:C().default(1e3)}));var Dl=z(()=>k({userId:x().optional(),tenantId:x().optional(),roles:O(x()).default([]),permissions:O(x()).default([]),org_user_ids:O(x()).optional(),isSystem:w().default(!1),accessToken:x().optional(),transaction:E().optional(),traceId:x().optional()})),Ol=z(()=>A([N(x(),E()),V]).describe(`Data Engine query filter conditions`)),kl=z(()=>A([N(x(),P([`asc`,`desc`])),N(x(),A([F(1),F(-1)])),O(gs)]).describe(`Sort order definition`)),G=z(()=>k({context:Dl.optional()})),Al=z(()=>G.extend({where:A([N(x(),E()),V]).optional(),fields:O(Ds).optional(),orderBy:O(gs).optional(),limit:C().optional(),offset:C().optional(),top:C().optional(),cursor:N(x(),E()).optional(),search:Os.optional(),expand:I(()=>N(x(),H)).optional(),distinct:w().optional()}).describe(`QueryAST-aligned query options for IDataEngine.find() operations`));z(()=>G.extend({filter:Ol.optional(),select:O(x()).optional(),sort:kl.optional(),limit:C().int().min(1).optional(),skip:C().int().min(0).optional(),top:C().int().min(1).optional(),populate:O(x()).optional()}).describe(`Query options for IDataEngine.find() operations`));var jl=z(()=>G.extend({returning:w().default(!0).optional()}).describe(`Options for DataEngine.insert operations`)),Ml=z(()=>G.extend({where:A([N(x(),E()),V]).optional(),upsert:w().default(!1).optional(),multi:w().default(!1).optional(),returning:w().default(!1).optional()}).describe(`QueryAST-aligned options for DataEngine.update operations`));z(()=>G.extend({filter:Ol.optional(),upsert:w().default(!1).optional(),multi:w().default(!1).optional(),returning:w().default(!1).optional()}).describe(`Options for DataEngine.update operations`));var Nl=z(()=>G.extend({where:A([N(x(),E()),V]).optional(),multi:w().default(!1).optional()}).describe(`QueryAST-aligned options for DataEngine.delete operations`));z(()=>G.extend({filter:Ol.optional(),multi:w().default(!1).optional()}).describe(`Options for DataEngine.delete operations`));var Pl=z(()=>G.extend({where:A([N(x(),E()),V]).optional(),groupBy:O(x()).optional(),aggregations:O(bs).optional()}).describe(`QueryAST-aligned options for DataEngine.aggregate operations`));z(()=>G.extend({filter:Ol.optional(),groupBy:O(x()).optional(),aggregations:O(k({field:x(),method:P([`count`,`sum`,`avg`,`min`,`max`,`count_distinct`]),alias:x().optional()})).optional()}).describe(`Options for DataEngine.aggregate operations`));var Fl=z(()=>G.extend({where:A([N(x(),E()),V]).optional()}).describe(`QueryAST-aligned options for DataEngine.count operations`));z(()=>G.extend({filter:Ol.optional()}).describe(`Options for DataEngine.count operations`)),z(()=>k({find:R().input(M([x(),Al.optional()])).output(L(O(E()))),findOne:R().input(M([x(),Al.optional()])).output(L(E())),insert:R().input(M([x(),A([N(x(),E()),O(N(x(),E()))]),jl.optional()])).output(L(E())),update:R().input(M([x(),N(x(),E()),Ml.optional()])).output(L(E())),delete:R().input(M([x(),Nl.optional()])).output(L(E())),count:R().input(M([x(),Fl.optional()])).output(L(C())),aggregate:R().input(M([x(),Pl])).output(L(O(E())))}).describe(`Standard Data Engine Contract`));var Il={filter:Ol.optional()},Ll=Al.extend({...Il,select:O(x()).optional(),sort:kl.optional(),skip:C().int().min(0).optional(),populate:O(x()).optional()}),Rl=z(()=>k({method:F(`find`),object:x(),query:Ll.optional()})),zl=z(()=>k({method:F(`findOne`),object:x(),query:Ll.optional()})),Bl=z(()=>k({method:F(`insert`),object:x(),data:A([N(x(),E()),O(N(x(),E()))]),options:jl.optional()})),Vl=z(()=>k({method:F(`update`),object:x(),data:N(x(),E()),id:A([x(),C()]).optional().describe(`ID for single update, or use where in options`),options:Ml.extend(Il).optional()})),Hl=z(()=>k({method:F(`delete`),object:x(),id:A([x(),C()]).optional().describe(`ID for single delete, or use where in options`),options:Nl.extend(Il).optional()})),Ul=z(()=>k({method:F(`count`),object:x(),query:Fl.extend(Il).optional()})),Wl=z(()=>k({method:F(`aggregate`),object:x(),query:Pl.extend(Il)})),Gl=z(()=>k({method:F(`execute`),command:E(),options:N(x(),E()).optional()})),Kl=z(()=>k({method:F(`vectorFind`),object:x(),vector:O(C()),where:A([N(x(),E()),V]).optional(),fields:O(x()).optional(),limit:C().int().default(5).optional(),threshold:C().optional()})),ql=z(()=>k({method:F(`batch`),requests:O(j(`method`,[Rl,zl,Bl,Vl,Hl,Ul,Wl,Gl,Kl])),transaction:w().default(!0).optional()}));z(()=>j(`method`,[Rl,zl,Bl,Vl,Hl,Ul,Wl,ql,Gl,Kl]).describe(`Virtual ObjectQL Request Protocol`)),P([`count`,`sum`,`avg`,`min`,`max`,`count_distinct`,`percentile`,`median`,`stddev`,`variance`]).describe(`Standard aggregation functions`);var Jl=P([`asc`,`desc`]).describe(`Sort order direction`);z(()=>k({field:x().describe(`Field name to sort by`),order:Jl.describe(`Sort direction`)}).describe(`Sort field and direction pair`)),P([`insert`,`update`,`delete`,`upsert`]).describe(`Data mutation event types`);var Yl=P([`read_uncommitted`,`read_committed`,`repeatable_read`,`serializable`,`snapshot`]).describe(`Transaction isolation levels (snake_case standard)`);P([`lru`,`lfu`,`ttl`,`fifo`]).describe(`Cache eviction strategy`);var K=z(()=>k({transaction:E().optional().describe(`Transaction handle`),timeout:C().optional().describe(`Timeout in ms`),skipCache:w().optional().describe(`Bypass cache`),traceContext:N(x(),x()).optional().describe(`OpenTelemetry context or request ID`),tenantId:x().optional().describe(`Tenant Isolation identifier`)})),Xl=z(()=>k({create:w().default(!0).describe(`Supports CREATE operations`),read:w().default(!0).describe(`Supports READ operations`),update:w().default(!0).describe(`Supports UPDATE operations`),delete:w().default(!0).describe(`Supports DELETE operations`),bulkCreate:w().default(!1).describe(`Supports bulk CREATE operations`),bulkUpdate:w().default(!1).describe(`Supports bulk UPDATE operations`),bulkDelete:w().default(!1).describe(`Supports bulk DELETE operations`),transactions:w().default(!1).describe(`Supports ACID transactions`),savepoints:w().default(!1).describe(`Supports transaction savepoints`),isolationLevels:O(Yl).optional().describe(`Supported isolation levels`),queryFilters:w().default(!0).describe(`Supports WHERE clause filtering`),queryAggregations:w().default(!1).describe(`Supports GROUP BY and aggregation functions`),queryDateGranularity:N(vs,w()).optional().describe(`Per-granularity native date bucketing (day/week/month/quarter/year). Missing keys fall back to in-memory bucketing.`),querySorting:w().default(!0).describe(`Supports ORDER BY sorting`),queryPagination:w().default(!0).describe(`Supports LIMIT/OFFSET pagination`),queryWindowFunctions:w().default(!1).describe(`Supports window functions with OVER clause`),querySubqueries:w().default(!1).describe(`Supports subqueries`),queryCTE:w().default(!1).describe(`Supports Common Table Expressions (WITH clause)`),joins:w().default(!1).describe(`Supports SQL joins`),fullTextSearch:w().default(!1).describe(`Supports full-text search`),jsonQuery:w().default(!1).describe(`Supports JSON field querying`),geospatialQuery:w().default(!1).describe(`Supports geospatial queries`),streaming:w().default(!1).describe(`Supports result streaming (cursors/iterators)`),jsonFields:w().default(!1).describe(`Supports JSON field types`),arrayFields:w().default(!1).describe(`Supports array field types`),vectorSearch:w().default(!1).describe(`Supports vector embeddings and similarity search`),schemaSync:w().default(!1).describe(`Supports automatic schema synchronization`),batchSchemaSync:w().default(!1).describe(`Supports batched schema sync to reduce schema DDL round-trips`),migrations:w().default(!1).describe(`Supports database migrations`),indexes:w().default(!1).describe(`Supports index creation and management`),connectionPooling:w().default(!1).describe(`Supports connection pooling`),preparedStatements:w().default(!1).describe(`Supports prepared statements (SQL injection prevention)`),queryCache:w().default(!1).describe(`Supports query result caching`)}));z(()=>k({name:x().describe(`Driver unique name`),version:x().describe(`Driver version`),supports:Xl,connect:R().input(M([])).output(L(xo())).describe(`Establish connection`),disconnect:R().input(M([])).output(L(xo())).describe(`Close connection`),checkHealth:R().input(M([])).output(L(w())).describe(`Health check`),getPoolStats:R().input(M([])).output(k({total:C(),idle:C(),active:C(),waiting:C()}).optional()).optional().describe(`Get connection pool statistics`),execute:R().input(M([E(),O(E()).optional(),K.optional()])).output(L(E())).describe(`Execute raw command`),find:R().input(M([x(),H,K.optional()])).output(L(O(N(x(),E())))).describe(`Find records`),findStream:R().input(M([x(),H,K.optional()])).output(E()).describe(`Stream records (AsyncIterable)`),findOne:R().input(M([x(),H,K.optional()])).output(L(N(x(),E()).nullable())).describe(`Find one record`),create:R().input(M([x(),N(x(),E()),K.optional()])).output(L(N(x(),E()))).describe(`Create record`),update:R().input(M([x(),x().or(C()),N(x(),E()),K.optional()])).output(L(N(x(),E()))).describe(`Update record`),upsert:R().input(M([x(),N(x(),E()),O(x()).optional(),K.optional()])).output(L(N(x(),E()))).describe(`Upsert record`),delete:R().input(M([x(),x().or(C()),K.optional()])).output(L(w())).describe(`Delete record`),count:R().input(M([x(),H.optional(),K.optional()])).output(L(C())).describe(`Count records`),bulkCreate:R().input(M([x(),O(N(x(),E())),K.optional()])).output(L(O(N(x(),E())))),bulkUpdate:R().input(M([x(),O(k({id:x().or(C()),data:N(x(),E())})),K.optional()])).output(L(O(N(x(),E())))),bulkDelete:R().input(M([x(),O(x().or(C())),K.optional()])).output(L(xo())),updateMany:R().input(M([x(),H,N(x(),E()),K.optional()])).output(L(C())).optional(),deleteMany:R().input(M([x(),H,K.optional()])).output(L(C())).optional(),beginTransaction:R().input(M([k({isolationLevel:Yl.optional()}).optional()])).output(L(E())).describe(`Start transaction`),commit:R().input(M([E()])).output(L(xo())).describe(`Commit transaction`),rollback:R().input(M([E()])).output(L(xo())).describe(`Rollback transaction`),syncSchema:R().input(M([x(),E(),K.optional()])).output(L(xo())).describe(`Sync object schema to DB`),syncSchemasBatch:R().input(M([O(k({object:x(),schema:E()})),K.optional()])).output(L(xo())).optional().describe(`Batch sync multiple schemas in one round-trip`),dropTable:R().input(M([x(),K.optional()])).output(L(xo())),explain:R().input(M([x(),H,K.optional()])).output(L(E())).optional()}));var Zl=z(()=>k({min:C().min(0).default(2).describe(`Minimum number of connections in pool`),max:C().min(1).default(10).describe(`Maximum number of connections in pool`),idleTimeoutMillis:C().min(0).default(3e4).describe(`Time in ms before idle connection is closed`),connectionTimeoutMillis:C().min(0).default(5e3).describe(`Time in ms to wait for available connection`)})),Ql=z(()=>k({name:x().describe(`Driver instance name`),type:P([`sql`,`nosql`,`cache`,`search`,`graph`,`timeseries`]).describe(`Driver type category`),capabilities:Xl.describe(`Driver capability flags`),connectionString:x().optional().describe(`Database connection string (driver-specific format)`),poolConfig:Zl.optional().describe(`Connection pool configuration`)})),$l=z(()=>P([`postgresql`,`mysql`,`sqlite`,`mssql`,`oracle`,`mariadb`])),eu=z(()=>k({text:x().describe(`SQL type for text fields (e.g., VARCHAR, TEXT)`),number:x().describe(`SQL type for number fields (e.g., NUMERIC, DECIMAL, INT)`),boolean:x().describe(`SQL type for boolean fields (e.g., BOOLEAN, BIT)`),date:x().describe(`SQL type for date fields (e.g., DATE)`),datetime:x().describe(`SQL type for datetime fields (e.g., TIMESTAMP, DATETIME)`),json:x().optional().describe(`SQL type for JSON fields (e.g., JSON, JSONB)`),uuid:x().optional().describe(`SQL type for UUID fields (e.g., UUID, CHAR(36))`),binary:x().optional().describe(`SQL type for binary fields (e.g., BLOB, BYTEA)`)})),tu=z(()=>k({rejectUnauthorized:w().default(!0).describe(`Reject connections with invalid certificates`),ca:x().optional().describe(`CA certificate file path or content`),cert:x().optional().describe(`Client certificate file path or content`),key:x().optional().describe(`Client private key file path or content`)}).refine(e=>e.cert!==void 0==(e.key!==void 0),{message:`Client certificate (cert) and private key (key) must be provided together`}));z(()=>Ql.extend({type:F(`sql`).describe(`Driver type must be "sql"`),dialect:$l.describe(`SQL database dialect`),dataTypeMapping:eu.describe(`SQL data type mapping configuration`),ssl:w().default(!1).describe(`Enable SSL/TLS connection`),sslConfig:tu.optional().describe(`SSL/TLS configuration (required when ssl is true)`)}).refine(e=>!(e.ssl&&!e.sslConfig),{message:`sslConfig is required when ssl is true`}));var nu=z(()=>P([`mongodb`,`couchdb`,`dynamodb`,`cassandra`,`redis`,`elasticsearch`,`neo4j`,`orientdb`]));z(()=>P([`find`,`findOne`,`insert`,`update`,`delete`,`aggregate`,`mapReduce`,`count`,`distinct`,`createIndex`,`dropIndex`]));var ru=z(()=>P([`all`,`quorum`,`one`,`local_quorum`,`each_quorum`,`eventual`])),iu=z(()=>P([`single`,`compound`,`unique`,`text`,`geospatial`,`hashed`,`ttl`,`sparse`])),au=z(()=>k({enabled:w().default(!1).describe(`Enable sharding`),shardKey:x().optional().describe(`Field to use as shard key`),shardingStrategy:P([`hash`,`range`,`zone`]).optional().describe(`Sharding strategy`),numShards:C().int().positive().optional().describe(`Number of shards`)})),ou=z(()=>k({enabled:w().default(!1).describe(`Enable replication`),replicaSetName:x().optional().describe(`Replica set name`),replicas:C().int().positive().optional().describe(`Number of replicas`),readPreference:P([`primary`,`primaryPreferred`,`secondary`,`secondaryPreferred`,`nearest`]).optional().describe(`Read preference for replica set`),writeConcern:P([`majority`,`acknowledged`,`unacknowledged`]).optional().describe(`Write concern level`)})),su=z(()=>k({enabled:w().default(!1).describe(`Enable schema validation`),validationLevel:P([`strict`,`moderate`,`off`]).optional().describe(`Validation strictness`),validationAction:P([`error`,`warn`]).optional().describe(`Action on validation failure`),jsonSchema:N(x(),E()).optional().describe(`JSON Schema for validation`)})),cu=z(()=>k({text:x().describe(`NoSQL type for text fields`),number:x().describe(`NoSQL type for number fields`),boolean:x().describe(`NoSQL type for boolean fields`),date:x().describe(`NoSQL type for date fields`),datetime:x().describe(`NoSQL type for datetime fields`),json:x().optional().describe(`NoSQL type for JSON/object fields`),uuid:x().optional().describe(`NoSQL type for UUID fields`),binary:x().optional().describe(`NoSQL type for binary fields`),array:x().optional().describe(`NoSQL type for array fields`),objectId:x().optional().describe(`NoSQL type for ObjectID fields (MongoDB)`),geopoint:x().optional().describe(`NoSQL type for geospatial point fields`)}));z(()=>Ql.extend({type:F(`nosql`).describe(`Driver type must be "nosql"`),databaseType:nu.describe(`Specific NoSQL database type`),dataTypeMapping:cu.describe(`NoSQL data type mapping configuration`),consistency:ru.optional().describe(`Consistency level for operations`),replication:ou.optional().describe(`Replication configuration`),sharding:au.optional().describe(`Sharding configuration`),schemaValidation:su.optional().describe(`Document schema validation`),region:x().optional().describe(`AWS region (for managed NoSQL services)`),accessKeyId:x().optional().describe(`AWS access key ID`),secretAccessKey:x().optional().describe(`AWS secret access key`),ttlField:x().optional().describe(`Field name for TTL (auto-deletion)`),maxDocumentSize:C().int().positive().optional().describe(`Maximum document size in bytes`),collectionPrefix:x().optional().describe(`Prefix for collection/table names`)}));var lu=z(()=>k({consistency:ru.optional().describe(`Consistency level override`),readFromSecondary:w().optional().describe(`Allow reading from secondary replicas`),projection:N(x(),A([F(0),F(1)])).optional().describe(`Field projection`),timeout:C().int().positive().optional().describe(`Query timeout (ms)`),useCursor:w().optional().describe(`Use cursor instead of loading all results`),batchSize:C().int().positive().optional().describe(`Cursor batch size`),profile:w().optional().describe(`Enable query profiling`),hint:x().optional().describe(`Index hint for query optimization`)})),uu=z(()=>k({operator:x().describe(`Aggregation operator (e.g., $match, $group, $sort)`),options:N(x(),E()).describe(`Stage-specific options`)}));z(()=>k({collection:x().describe(`Collection/table name`),stages:O(uu).describe(`Aggregation pipeline stages`),options:lu.optional().describe(`Query options`)})),z(()=>k({name:x().describe(`Index name`),type:iu.describe(`Index type`),fields:O(k({field:x().describe(`Field name`),order:P([`asc`,`desc`,`text`,`2dsphere`]).optional().describe(`Index order or type`)})).describe(`Fields to index`),unique:w().default(!1).describe(`Enforce uniqueness`),sparse:w().default(!1).describe(`Sparse index`),expireAfterSeconds:C().int().positive().optional().describe(`TTL in seconds`),partialFilterExpression:N(x(),E()).optional().describe(`Partial index filter`),background:w().default(!1).describe(`Create index in background`)})),z(()=>k({readConcern:P([`local`,`majority`,`linearizable`,`snapshot`]).optional().describe(`Read concern level`),writeConcern:P([`majority`,`acknowledged`,`unacknowledged`]).optional().describe(`Write concern level`),readPreference:P([`primary`,`primaryPreferred`,`secondary`,`secondaryPreferred`,`nearest`]).optional().describe(`Read preference`),maxCommitTimeMS:C().int().positive().optional().describe(`Transaction commit timeout (ms)`)}));var du=P([`insert`,`update`,`upsert`,`replace`,`ignore`]),fu=z(()=>k({object:x().regex(/^[a-z_][a-z0-9_]*$/).describe(`Target Object Name`),externalId:x().default(`name`).describe(`Field match for uniqueness check`),mode:du.default(`upsert`).describe(`Conflict resolution strategy`),env:O(P([`prod`,`dev`,`test`])).default([`prod`,`dev`,`test`]).describe(`Applicable environments`),records:O(N(x(),E())).describe(`Data records`)})),pu=z(()=>k({field:x().describe(`Source field name containing the reference value`),targetObject:x().regex(/^[a-z_][a-z0-9_]*$/).describe(`Target object name (snake_case)`),targetField:x().default(`name`).describe(`Field on target object used for matching`),fieldType:P([`lookup`,`master_detail`]).describe(`Relationship field type`)}).describe(`Describes how a field reference is resolved during seed loading`)),mu=z(()=>k({object:x().regex(/^[a-z_][a-z0-9_]*$/).describe(`Object name (snake_case)`),dependsOn:O(x()).describe(`Objects this object depends on`),references:O(pu).describe(`Field-level reference details`)}).describe(`Object node in the seed data dependency graph`)),hu=z(()=>k({nodes:O(mu).describe(`All objects in the dependency graph`),insertOrder:O(x()).describe(`Topologically sorted insert order`),circularDependencies:O(O(x())).default([]).describe(`Circular dependency chains (e.g., [["a", "b", "a"]])`)}).describe(`Complete object dependency graph for seed data loading`)),gu=z(()=>k({sourceObject:x().describe(`Object with the broken reference`),field:x().describe(`Field name with unresolved reference`),targetObject:x().describe(`Target object searched for the reference`),targetField:x().describe(`ExternalId field used for matching`),attemptedValue:E().describe(`Value that failed to resolve`),recordIndex:C().int().min(0).describe(`Index of the record in the dataset`),message:x().describe(`Human-readable error description`)}).describe(`Actionable error for a failed reference resolution`)),_u=z(()=>k({dryRun:w().default(!1).describe(`Validate references without writing data`),haltOnError:w().default(!1).describe(`Stop on first reference resolution error`),multiPass:w().default(!0).describe(`Enable multi-pass loading for circular dependencies`),defaultMode:du.default(`upsert`).describe(`Default conflict resolution strategy`),batchSize:C().int().min(1).default(1e3).describe(`Maximum records per batch insert/upsert`),transaction:w().default(!1).describe(`Wrap entire load in a transaction (all-or-nothing)`),env:P([`prod`,`dev`,`test`]).optional().describe(`Only load datasets matching this environment`),organizationId:x().min(1).optional().describe(`Target organization id for per-tenant seed replay`)}).describe(`Seed data loader configuration`)),vu=z(()=>k({object:x().describe(`Object that was loaded`),mode:du.describe(`Import mode used`),inserted:C().int().min(0).describe(`Records inserted`),updated:C().int().min(0).describe(`Records updated`),skipped:C().int().min(0).describe(`Records skipped`),errored:C().int().min(0).describe(`Records with errors`),total:C().int().min(0).describe(`Total records in dataset`),referencesResolved:C().int().min(0).describe(`References resolved via externalId`),referencesDeferred:C().int().min(0).describe(`References deferred to second pass`),errors:O(gu).default([]).describe(`Reference resolution errors`)}).describe(`Result of loading a single dataset`));z(()=>k({success:w().describe(`Overall success status`),dryRun:w().describe(`Whether this was a dry-run`),dependencyGraph:hu.describe(`Object dependency graph`),results:O(vu).describe(`Per-object load results`),errors:O(gu).describe(`All reference resolution errors`),summary:k({objectsProcessed:C().int().min(0).describe(`Total objects processed`),totalRecords:C().int().min(0).describe(`Total records across all objects`),totalInserted:C().int().min(0).describe(`Total records inserted`),totalUpdated:C().int().min(0).describe(`Total records updated`),totalSkipped:C().int().min(0).describe(`Total records skipped`),totalErrored:C().int().min(0).describe(`Total records with errors`),totalReferencesResolved:C().int().min(0).describe(`Total references resolved`),totalReferencesDeferred:C().int().min(0).describe(`Total references deferred`),circularDependencyCount:C().int().min(0).describe(`Circular dependency chains detected`),durationMs:C().min(0).describe(`Load duration in milliseconds`)}).describe(`Summary statistics`)}).describe(`Complete seed loader result`)),z(()=>k({datasets:O(fu).min(1).describe(`Datasets to load`),config:_u.default(()=>_u.parse({})).describe(`Loader configuration`)}).describe(`Seed loader request with datasets and configuration`));var yu=z(()=>k({versionNumber:C().describe(`Version number`),createdAt:C().describe(`Creation timestamp`),createdBy:x().describe(`Creator user ID`),size:C().describe(`File size in bytes`),checksum:x().describe(`File checksum`),downloadUrl:x().url().describe(`Download URL`),isLatest:w().optional().default(!1).describe(`Is latest version`)})),bu=z(()=>k({id:x().describe(`Template ID`),name:x().describe(`Template name`),description:x().optional().describe(`Template description`),fileUrl:x().url().describe(`Template file URL`),fileType:x().describe(`File MIME type`),placeholders:O(k({key:x().describe(`Placeholder key`),label:x().describe(`Placeholder label`),type:P([`text`,`number`,`date`,`image`]).describe(`Placeholder type`),required:w().optional().default(!1).describe(`Is required`)})).describe(`Template placeholders`)})),xu=z(()=>k({provider:P([`docusign`,`adobe-sign`,`hellosign`,`custom`]).describe(`E-signature provider`),enabled:w().optional().default(!1).describe(`E-signature enabled`),signers:O(k({email:x().email().describe(`Signer email`),name:x().describe(`Signer name`),role:x().describe(`Signer role`),order:C().describe(`Signing order`)})).describe(`Document signers`),expirationDays:C().optional().default(30).describe(`Expiration days`),reminderDays:C().optional().default(7).describe(`Reminder interval days`)}));z(()=>k({id:x().describe(`Document ID`),name:x().describe(`Document name`),description:x().optional().describe(`Document description`),fileType:x().describe(`File MIME type`),fileSize:C().describe(`File size in bytes`),category:x().optional().describe(`Document category`),tags:O(x()).optional().describe(`Document tags`),versioning:k({enabled:w().describe(`Versioning enabled`),versions:O(yu).describe(`Version history`),majorVersion:C().describe(`Major version`),minorVersion:C().describe(`Minor version`)}).optional().describe(`Version control`),template:bu.optional().describe(`Document template`),eSignature:xu.optional().describe(`E-signature config`),access:k({isPublic:w().optional().default(!1).describe(`Public access`),sharedWith:O(x()).optional().describe(`Shared with`),expiresAt:C().optional().describe(`Access expiration`)}).optional().describe(`Access control`),metadata:N(x(),E()).optional().describe(`Custom metadata`)}));var Su=z(()=>j(`type`,[k({type:F(`constant`),value:E().describe(`Constant value to use`)}).describe(`Set a constant value`),k({type:F(`cast`),targetType:P([`string`,`number`,`boolean`,`date`]).describe(`Target data type`)}).describe(`Cast to a specific data type`),k({type:F(`lookup`),table:x().describe(`Lookup table name`),keyField:x().describe(`Field to match on`),valueField:x().describe(`Field to retrieve`)}).describe(`Lookup value from another table`),k({type:F(`javascript`),expression:U.describe(`JS expression (dialect="js" recommended). e.g. value.toUpperCase()`)}).describe(`Custom JavaScript transformation`),k({type:F(`map`),mappings:N(x(),E()).describe(`Value mappings (e.g., {"Active": "active"})`)}).describe(`Map values using a dictionary`)])),Cu=z(()=>k({source:x().describe(`Source field name`),target:x().describe(`Target field name`),transform:Su.optional().describe(`Transformation to apply`),defaultValue:E().optional().describe(`Default if source is null/undefined`)})),wu=z(()=>k({id:x().describe(`Data source ID`),name:x().describe(`Data source name`),type:P([`odata`,`rest-api`,`graphql`,`custom`]).describe(`Protocol type`),endpoint:x().url().describe(`API endpoint URL`),authentication:k({type:P([`oauth2`,`api-key`,`basic`,`none`]).describe(`Auth type`),config:N(x(),E()).describe(`Auth configuration`)}).describe(`Authentication`)})),Tu=z(()=>Cu.extend({type:x().optional().describe(`Field type`),readonly:w().optional().default(!0).describe(`Read-only field`)}));z(()=>k({fieldName:x().describe(`Field name`),dataSource:wu.describe(`External data source`),query:k({endpoint:x().describe(`Query endpoint path`),method:P([`GET`,`POST`]).optional().default(`GET`).describe(`HTTP method`),parameters:N(x(),E()).optional().describe(`Query parameters`)}).describe(`Query configuration`),fieldMappings:O(Tu).describe(`Field mappings`),caching:k({enabled:w().optional().default(!0).describe(`Cache enabled`),ttl:C().optional().default(300).describe(`Cache TTL (seconds)`),strategy:P([`lru`,`lfu`,`ttl`]).optional().default(`ttl`).describe(`Cache strategy`)}).optional().describe(`Caching configuration`),fallback:k({enabled:w().optional().default(!0).describe(`Fallback enabled`),defaultValue:E().optional().describe(`Default fallback value`),showError:w().optional().default(!0).describe(`Show error to user`)}).optional().describe(`Fallback configuration`),rateLimit:k({requestsPerSecond:C().describe(`Requests per second limit`),burstSize:C().optional().describe(`Burst size`)}).optional().describe(`Rate limiting`),retry:k({maxRetries:C().min(0).default(3).describe(`Maximum retry attempts`),initialDelayMs:C().default(1e3).describe(`Initial retry delay in milliseconds`),maxDelayMs:C().default(3e4).describe(`Maximum retry delay in milliseconds`),backoffMultiplier:C().default(2).describe(`Exponential backoff multiplier`),retryableStatusCodes:O(C()).default([429,500,502,503,504]).describe(`HTTP status codes that are retryable`)}).optional().describe(`Retry configuration with exponential backoff`),transform:k({request:k({headers:N(x(),x()).optional().describe(`Additional request headers`),queryParams:N(x(),x()).optional().describe(`Additional query parameters`)}).optional().describe(`Request transformation`),response:k({dataPath:x().optional().describe(`JSONPath to extract data (e.g., "$.data.results")`),totalPath:x().optional().describe(`JSONPath to extract total count (e.g., "$.meta.total")`)}).optional().describe(`Response transformation`)}).optional().describe(`Request/response transformation pipeline`),pagination:k({type:P([`offset`,`cursor`,`page`]).default(`offset`).describe(`Pagination type`),pageSize:C().default(100).describe(`Items per page`),maxPages:C().optional().describe(`Maximum number of pages to fetch`)}).optional().describe(`Pagination configuration for external data`)}));var Eu=x().describe(`Underlying driver identifier`);z(()=>k({id:x().describe(`Unique driver identifier (e.g. "postgres")`),label:x().describe(`Display label (e.g. "PostgreSQL")`),description:x().optional(),icon:x().optional(),configSchema:N(x(),E()).describe(`JSON Schema for connection configuration`),capabilities:I(()=>Du).optional()}));var Du=k({transactions:w().default(!1),queryFilters:w().default(!1),queryAggregations:w().default(!1),querySorting:w().default(!1),queryPagination:w().default(!1),queryWindowFunctions:w().default(!1),querySubqueries:w().default(!1),joins:w().default(!1),fullTextSearch:w().default(!1),readOnly:w().default(!1),dynamicSchema:w().default(!1)});z(()=>k({name:x().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique datasource identifier`),label:x().optional().describe(`Display label`),driver:Eu.describe(`Underlying driver type`),config:N(x(),E()).describe(`Driver specific configuration`),pool:k({min:C().default(0).describe(`Minimum connections`),max:C().default(10).describe(`Maximum connections`),idleTimeoutMillis:C().default(3e4).describe(`Idle timeout`),connectionTimeoutMillis:C().default(3e3).describe(`Connection establishment timeout`)}).optional().describe(`Connection pool settings`),readReplicas:O(N(x(),E())).optional().describe(`Read-only replica configurations`),capabilities:Du.optional().describe(`Capability overrides`),healthCheck:k({enabled:w().default(!0).describe(`Enable health check endpoint`),intervalMs:C().default(3e4).describe(`Health check interval in milliseconds`),timeoutMs:C().default(5e3).describe(`Health check timeout in milliseconds`)}).optional().describe(`Datasource health check configuration`),ssl:k({enabled:w().default(!1).describe(`Enable SSL/TLS for database connection`),rejectUnauthorized:w().default(!0).describe(`Reject connections with invalid/self-signed certificates`),ca:x().optional().describe(`CA certificate (PEM format or path to file)`),cert:x().optional().describe(`Client certificate (PEM format or path to file)`),key:x().optional().describe(`Client private key (PEM format or path to file)`)}).optional().describe(`SSL/TLS configuration for secure database connections`),retryPolicy:k({maxRetries:C().default(3).describe(`Maximum number of retry attempts`),baseDelayMs:C().default(1e3).describe(`Base delay between retries in milliseconds`),maxDelayMs:C().default(3e4).describe(`Maximum delay between retries in milliseconds`),backoffMultiplier:C().default(2).describe(`Exponential backoff multiplier`)}).optional().describe(`Connection retry policy for transient failures`),description:x().optional().describe(`Internal description`),active:w().default(!0).describe(`Is datasource enabled`)}));var Ou=P([`count`,`sum`,`avg`,`min`,`max`,`count_distinct`,`number`,`string`,`boolean`]),ku=P([`string`,`number`,`boolean`,`time`,`geo`]),Au=P([`second`,`minute`,`hour`,`day`,`week`,`month`,`quarter`,`year`]),ju=z(()=>k({name:x().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique metric ID`),label:x().describe(`Human readable label`),description:x().optional(),type:Ou,sql:x().describe(`SQL expression or field reference`),filters:O(k({sql:x()})).optional(),format:x().optional()})),Mu=z(()=>k({name:x().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique dimension ID`),label:x().describe(`Human readable label`),description:x().optional(),type:ku,sql:x().describe(`SQL expression or column reference`),granularities:O(Au).optional()})),Nu=z(()=>k({name:x().describe(`Target cube name`),relationship:P([`one_to_one`,`one_to_many`,`many_to_one`]).default(`many_to_one`),sql:x().describe(`Join condition (ON clause)`)}));z(()=>k({name:x().regex(/^[a-z_][a-z0-9_]*$/).describe(`Cube name (snake_case)`),title:x().optional(),description:x().optional(),sql:x().describe(`Base SQL statement or Table Name`),measures:N(x(),ju).describe(`Quantitative metrics`),dimensions:N(x(),Mu).describe(`Qualitative attributes`),joins:N(x(),Nu).optional(),refreshKey:k({every:x().optional(),sql:x().optional()}).optional(),public:w().default(!1)})),z(()=>k({cube:x().optional().describe(`Target cube name (optional when provided externally, e.g. in API request wrapper)`),measures:O(x()).describe(`List of metrics to calculate`),dimensions:O(x()).optional().describe(`List of dimensions to group by`),where:V.optional().describe(`Filtering criteria (canonical Query DSL FilterCondition)`),timeDimensions:O(k({dimension:x(),granularity:Au.optional(),dateRange:A([x(),O(x())]).optional()})).optional(),order:N(x(),P([`asc`,`desc`])).optional(),limit:C().optional(),offset:C().optional(),timezone:x().optional().default(`UTC`)}));var Pu=P([`comment`,`field_change`,`task`,`event`,`email`,`call`,`note`,`file`,`record_create`,`record_delete`,`approval`,`sharing`,`system`]),Fu=z(()=>k({type:P([`user`,`team`,`record`]).describe(`Mention target type`),id:x().describe(`Target ID`),name:x().describe(`Display name for rendering`),offset:C().int().min(0).describe(`Character offset in body text`),length:C().int().min(1).describe(`Length of mention token in body text`)})),Iu=z(()=>k({field:x().describe(`Field machine name`),fieldLabel:x().optional().describe(`Field display label`),oldValue:E().optional().describe(`Previous value`),newValue:E().optional().describe(`New value`),oldDisplayValue:x().optional().describe(`Human-readable old value`),newDisplayValue:x().optional().describe(`Human-readable new value`)})),Lu=z(()=>k({emoji:x().describe(`Emoji character or shortcode (e.g., "👍", ":thumbsup:")`),userIds:O(x()).describe(`Users who reacted`),count:C().int().min(1).describe(`Total reaction count`)})),Ru=z(()=>k({type:P([`user`,`system`,`service`,`automation`]).describe(`Actor type`),id:x().describe(`Actor ID`),name:x().optional().describe(`Actor display name`),avatarUrl:x().url().optional().describe(`Actor avatar URL`),source:x().optional().describe(`Source application (e.g., "Omni", "API", "Studio")`)})),zu=P([`public`,`internal`,`private`]);z(()=>k({id:x().describe(`Feed item ID`),type:Pu.describe(`Activity type`),object:x().describe(`Object name (e.g., "account")`),recordId:x().describe(`Record ID this feed item belongs to`),actor:Ru.describe(`Who performed this action`),body:x().optional().describe(`Rich text body (Markdown supported)`),mentions:O(Fu).optional().describe(`Mentioned users/teams/records`),changes:O(Iu).optional().describe(`Field-level changes`),reactions:O(Lu).optional().describe(`Emoji reactions on this item`),parentId:x().optional().describe(`Parent feed item ID for threaded replies`),replyCount:C().int().min(0).default(0).describe(`Number of replies`),pinned:w().default(!1).describe(`Whether the feed item is pinned to the top of the timeline`),pinnedAt:x().datetime().optional().describe(`Timestamp when the item was pinned`),pinnedBy:x().optional().describe(`User ID who pinned the item`),starred:w().default(!1).describe(`Whether the feed item is starred/bookmarked by the current user`),starredAt:x().datetime().optional().describe(`Timestamp when the item was starred`),visibility:zu.default(`public`).describe(`Visibility: public (all users), internal (team only), private (author + mentioned)`),createdAt:x().datetime().describe(`Creation timestamp`),updatedAt:x().datetime().optional().describe(`Last update timestamp`),editedAt:x().datetime().optional().describe(`When comment was last edited`),isEdited:w().default(!1).describe(`Whether comment has been edited`)})),P([`all`,`comments_only`,`changes_only`,`tasks_only`]);var Bu=P([`comment`,`mention`,`field_change`,`task`,`approval`,`all`]),Vu=P([`in_app`,`email`,`push`,`slack`]);z(()=>k({object:x().describe(`Object name`),recordId:x().describe(`Record ID`),userId:x().describe(`Subscribing user ID`),events:O(Bu).default([`all`]).describe(`Event types to receive notifications for`),channels:O(Vu).default([`in_app`]).describe(`Notification delivery channels`),active:w().default(!0).describe(`Whether the subscription is active`),createdAt:x().datetime().describe(`Subscription creation timestamp`)}));var Hu=z(()=>P([`header`,`subdomain`,`path`,`token`,`lookup`]).describe(`Strategy for resolving tenant identity from request context`)),Uu=z(()=>k({name:x().min(1).describe(`Turso database group name`),primaryLocation:x().min(2).describe(`Primary Turso region code (e.g., iad, lhr, nrt)`),replicaLocations:O(x().min(2)).default([]).describe(`Additional replica region codes`),schemaDatabase:x().optional().describe(`Schema database name for multi-db schemas`)}).describe(`Turso database group configuration`)),Wu=z(()=>k({onTenantCreate:k({autoCreate:w().default(!0).describe(`Auto-create database on tenant registration`),group:x().optional().describe(`Turso group for the new database`),applyGroupSchema:w().default(!0).describe(`Apply shared schema from group`),seedData:w().default(!1).describe(`Populate seed data on creation`)}).describe(`Tenant creation hook`),onTenantDelete:k({immediate:w().default(!1).describe(`Destroy database immediately`),gracePeriodHours:C().int().min(0).default(72).describe(`Grace period before permanent deletion`),createBackup:w().default(!0).describe(`Create backup before deletion`)}).describe(`Tenant deletion hook`),onTenantSuspend:k({revokeTokens:w().default(!0).describe(`Revoke auth tokens on suspension`),readOnly:w().default(!0).describe(`Set database to read-only on suspension`)}).describe(`Tenant suspension hook`)}).describe(`Tenant database lifecycle hooks`));z(()=>k({organizationSlug:x().min(1).describe(`Turso organization slug`),urlTemplate:x().min(1).describe(`URL template with {tenant_id} placeholder`),groupAuthToken:x().min(1).describe(`Group-level auth token for platform operations`),tenantResolverStrategy:Hu.default(`token`),group:Uu.optional().describe(`Database group configuration`),lifecycle:Wu.optional().describe(`Lifecycle hooks`),maxCachedConnections:C().int().min(1).default(100).describe(`Max cached tenant connections (LRU)`),connectionCacheTTL:C().int().min(0).default(300).describe(`Connection cache TTL in seconds`)}).describe(`Turso multi-tenant router configuration`));var Gu=(t=>e===void 0?typeof Proxy<`u`?new Proxy(t,{get:(t,n)=>(e===void 0?t:e)[n]}):t:e)(function(t){if(e!==void 0)return e.apply(this,arguments);throw Error(`Dynamic require of "`+t+`" is not supported`)}),Ku={debug:0,info:1,warn:2,error:3,fatal:4,silent:5},qu={debug:`\x1B[36m`,info:`\x1B[32m`,warn:`\x1B[33m`,error:`\x1B[31m`,fatal:`\x1B[35m`,silent:``},Ju=`\x1B[0m`,Yu=class e{constructor(e={},t={}){this.config={name:e.name,level:e.level??`info`,format:e.format??`pretty`,redact:e.redact??[`password`,`token`,`secret`,`key`],sourceLocation:e.sourceLocation??!1,file:e.file,rotation:e.rotation??{maxSize:`10m`,maxFiles:5}},this.bindings=t,this.config.file&&typeof process<`u`&&this.openFileStream(this.config.file)}openFileStream(e){try{let t=Gu(`fs`),n=Gu(`path`).dirname(e);t.mkdirSync(n,{recursive:!0}),this.fileStream=t.createWriteStream(e,{flags:`a`})}catch{}}isEnabled(e){return Ku[e]>=Ku[this.config.level]}redactSensitive(e){if(!e||typeof e!=`object`)return e;let t=Array.isArray(e)?[...e]:{...e};for(let e in t){let n=e.toLowerCase();this.config.redact.some(e=>n.includes(e.toLowerCase()))?t[e]=`***REDACTED***`:typeof t[e]==`object`&&t[e]!==null&&(t[e]=this.redactSensitive(t[e]))}return t}write(e,t,n,r){if(!this.isEnabled(e))return;let i=this.redactSensitive({...this.bindings,...n,...r?{error:{message:r.message,stack:r.stack}}:{}}),a=Object.keys(i).length>0,o=new Date().toISOString(),s;if(this.config.format===`json`)s=JSON.stringify({time:o,level:e,...this.config.name?{name:this.config.name}:{},msg:t,...i});else if(this.config.format===`text`){let n=[o,e.toUpperCase(),t];a&&n.push(JSON.stringify(i)),s=n.join(` | `)}else{let n=qu[e]||``,r=this.config.name?`[${this.config.name}] `:``;s=`${n}${o} ${e.toUpperCase()}${Ju} ${r}${t}`,a&&(s+=` ${JSON.stringify(i)}`)}let c=s+`
65
- `;typeof process<`u`&&process.stderr?e===`error`||e===`fatal`?process.stderr.write(c):process.stdout?.write(c):typeof console<`u`&&(e===`error`||e===`fatal`?console.error:e===`warn`?console.warn:e===`debug`?console.debug:console.log)(s),this.fileStream&&this.fileStream.write(c)}debug(e,t){this.write(`debug`,e,t)}info(e,t){this.write(`info`,e,t)}warn(e,t){this.write(`warn`,e,t)}error(e,t,n){t instanceof Error?this.write(`error`,e,n,t):this.write(`error`,e,t)}fatal(e,t,n){t instanceof Error?this.write(`fatal`,e,n,t):this.write(`fatal`,e,t)}log(e,...t){this.info(e,t.length>0?{args:t}:void 0)}child(t){let n=new e(this.config,{...this.bindings,...t});return n.fileStream=this.fileStream,n}withTrace(e,t){return this.child({traceId:e,spanId:t})}async destroy(){this.fileStream&&=(await new Promise(e=>this.fileStream.end(e)),void 0)}};function Xu(e){return new Yu(e)}var Zu=class{constructor(e,t){this.subscriptions=new Map,this.eventBuffer=[],this._baseUrl=e,this._token=t}subscribeMetadata(e,t,n){let r=`metadata-${e}-${Date.now()}`;return this.subscriptions.set(r,{filter:{type:e,packageId:n?.packageId,eventTypes:[`metadata.${e}.created`,`metadata.${e}.updated`,`metadata.${e}.deleted`]},handler:e=>{e.type.startsWith(`metadata.`)&&t(e)}}),this.startPolling(),()=>{this.subscriptions.delete(r),this.subscriptions.size===0&&this.stopPolling()}}subscribeData(e,t,n){let r=`data-${e}-${Date.now()}`;return this.subscriptions.set(r,{filter:{type:e,recordId:n?.recordId,eventTypes:[`data.record.created`,`data.record.updated`,`data.record.deleted`]},handler:r=>{r.type.startsWith(`data.`)&&r.object===e&&(!n?.recordId||r.payload?.recordId===n.recordId)&&t(r)}}),this.startPolling(),()=>{this.subscriptions.delete(r),this.subscriptions.size===0&&this.stopPolling()}}emitEvent(e){for(let t of this.subscriptions.values()){let n=!t.filter.type||e.type.includes(t.filter.type)||e.object===t.filter.type,r=!t.filter.eventTypes?.length||t.filter.eventTypes.includes(e.type),i=!t.filter.packageId||e.payload?.packageId===t.filter.packageId;if(n&&r&&i)try{t.handler(e)}catch(e){console.error(`Error in realtime event handler:`,e)}}}startPolling(){this.pollInterval||=setInterval(()=>{for(;this.eventBuffer.length>0;){let e=this.eventBuffer.shift();e&&this.emitEvent(e)}},2e3)}stopPolling(){this.pollInterval&&=(clearInterval(this.pollInterval),void 0)}_bufferEvent(e){this.eventBuffer.push(e)}disconnect(){this.stopPolling(),this.subscriptions.clear(),this.eventBuffer=[]}},Qu=class{constructor(e){this.meta={getTypes:async()=>{let e=this.getRoute(`metadata`),t=await this.fetch(`${this.baseUrl}${e}`);return this.unwrapResponse(t)},getItems:async(e,t)=>{let n=this.getRoute(`metadata`),r=new URLSearchParams;t?.packageId&&r.set(`package`,t.packageId);let i=r.toString(),a=`${this.baseUrl}${n}/${e}${i?`?${i}`:``}`,o=await this.fetch(a);return this.unwrapResponse(o)},getItem:async(e,t,n)=>{let r=this.getRoute(`metadata`),i=new URLSearchParams;n?.packageId&&i.set(`package`,n.packageId);let a=i.toString(),o=`${this.baseUrl}${r}/${e}/${t}${a?`?${a}`:``}`,s=await this.fetch(o);return this.unwrapResponse(s)},saveItem:async(e,t,n)=>{let r=this.getRoute(`metadata`),i=await this.fetch(`${this.baseUrl}${r}/${e}/${t}`,{method:`PUT`,body:JSON.stringify(n)});return this.unwrapResponse(i)},deleteItem:async(e,t)=>{let n=this.getRoute(`metadata`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,{method:`DELETE`});return this.unwrapResponse(r)},getHistory:async(e,t,n)=>{let r=this.getRoute(`metadata`),i=new URLSearchParams;n?.sinceSeq!==void 0&&i.set(`sinceSeq`,String(n.sinceSeq)),n?.limit!==void 0&&i.set(`limit`,String(n.limit));let a=i.toString(),o=`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/history${a?`?${a}`:``}`,s=await this.fetch(o);return this.unwrapResponse(s)},getCached:async(e,t)=>{let n=this.getRoute(`metadata`),r={};t?.ifNoneMatch&&(r[`If-None-Match`]=t.ifNoneMatch),t?.ifModifiedSince&&(r[`If-Modified-Since`]=t.ifModifiedSince);let i=await this.fetch(`${this.baseUrl}${n}/object/${e}`,{headers:r});if(i.status===304)return{notModified:!0,etag:t?.ifNoneMatch?{value:t.ifNoneMatch.replace(/^W\/|"/g,``),weak:t.ifNoneMatch.startsWith(`W/`)}:void 0};let a=await i.json(),o=i.headers.get(`ETag`),s=i.headers.get(`Last-Modified`);return{data:a,etag:o?{value:o.replace(/^W\/|"/g,``),weak:o.startsWith(`W/`)}:void 0,lastModified:s||void 0,notModified:!1}},getView:async(e,t=`list`)=>{let n=this.getRoute(`ui`),r=await this.fetch(`${this.baseUrl}${n}/view/${e}?type=${t}`);return this.unwrapResponse(r)}},this.analytics={query:async e=>{let t=this.getRoute(`analytics`);return(await this.fetch(`${this.baseUrl}${t}/query`,{method:`POST`,body:JSON.stringify(e)})).json()},meta:async e=>{let t=this.getRoute(`analytics`);return(await this.fetch(`${this.baseUrl}${t}/meta/${e}`)).json()},explain:async e=>{let t=this.getRoute(`analytics`);return(await this.fetch(`${this.baseUrl}${t}/explain`,{method:`POST`,body:JSON.stringify(e)})).json()}},this.packages={list:async e=>{let t=this.getRoute(`packages`),n=new URLSearchParams;e?.status&&n.set(`status`,e.status),e?.type&&n.set(`type`,e.type),e?.enabled!==void 0&&n.set(`enabled`,String(e.enabled));let r=n.toString(),i=`${this.baseUrl}${t}${r?`?`+r:``}`,a=await this.fetch(i);return this.unwrapResponse(a)},get:async e=>{let t=this.getRoute(`packages`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e)}`);return this.unwrapResponse(n)},install:async(e,t)=>{let n=this.getRoute(`packages`),r=await this.fetch(`${this.baseUrl}${n}`,{method:`POST`,body:JSON.stringify({manifest:e,settings:t?.settings,enableOnInstall:t?.enableOnInstall})});return this.unwrapResponse(r)},uninstall:async e=>{let t=this.getRoute(`packages`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e)}`,{method:`DELETE`});return this.unwrapResponse(n)},enable:async e=>{let t=this.getRoute(`packages`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e)}/enable`,{method:`PATCH`});return this.unwrapResponse(n)},disable:async e=>{let t=this.getRoute(`packages`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e)}/disable`,{method:`PATCH`});return this.unwrapResponse(n)}},this.projects={list:async e=>{let t=new URLSearchParams;e?.organization_id&&t.set(`organizationId`,e.organization_id),e?.env_type&&t.set(`envType`,e.env_type),e?.status&&t.set(`status`,e.status);let n=t.toString(),r=`${this.baseUrl}/api/v1/cloud/environments${n?`?`+n:``}`,i=await this.fetch(r);return this.unwrapResponse(i)},get:async e=>{let t=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}`);return this.unwrapResponse(t)},create:async e=>{let t=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments`,{method:`POST`,body:JSON.stringify(e)});return this.unwrapResponse(t)},update:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}`,{method:`PATCH`,body:JSON.stringify(t)});return this.unwrapResponse(n)},delete:async(e,t)=>{let n=t?.force?`?force=1`:``,r=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}${n}`,{method:`DELETE`});return this.unwrapResponse(r)},activate:async e=>{let t=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/activate`,{method:`POST`});return this.unwrapResponse(t)},rotateCredential:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/credentials/rotate`,{method:`POST`,body:JSON.stringify({plaintext:t})});return this.unwrapResponse(n)},updateHostname:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/hostname`,{method:`POST`,body:JSON.stringify({hostname:t})});return this.unwrapResponse(n)},updateVisibility:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}`,{method:`PATCH`,body:JSON.stringify({visibility:t})});return this.unwrapResponse(n)},listRevisions:async(e,t)=>{let n=new URLSearchParams;t?.limit&&n.set(`limit`,String(t.limit)),t?.cursor&&n.set(`cursor`,t.cursor),t?.branch&&n.set(`branch`,t.branch);let r=n.toString(),i=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/revisions${r?`?${r}`:``}`);return this.unwrapResponse(i)},listBranches:async e=>{let t=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/branches`);return this.unwrapResponse(t)},renameBranch:async(e,t,n)=>{let r=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/branches/${encodeURIComponent(t)}/rename`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({newName:n})});return this.unwrapResponse(r)},deleteBranch:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/branches/${encodeURIComponent(t)}`,{method:`DELETE`});return this.unwrapResponse(n)},activateRevision:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/revisions/${encodeURIComponent(t)}/activate`,{method:`POST`});return this.unwrapResponse(n)},retryProvisioning:async e=>{let t=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/retry`,{method:`POST`});return this.unwrapResponse(t)},listMembers:async e=>{let t=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/members`);return this.unwrapResponse(t)},addMember:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/members`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(t)});return this.unwrapResponse(n)},updateMemberRole:async(e,t,n)=>{let r=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/members/${encodeURIComponent(t)}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({role:n})});return this.unwrapResponse(r)},removeMember:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/members/${encodeURIComponent(t)}`,{method:`DELETE`});return this.unwrapResponse(n)},listDrivers:async()=>{let e=await this.fetch(`${this.baseUrl}/api/v1/cloud/drivers`);return this.unwrapResponse(e)},listTemplates:async()=>{let e=await this.fetch(`${this.baseUrl}/api/v1/cloud/templates`);return this.unwrapResponse(e)},packages:{list:async e=>{let t=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/packages`);return this.unwrapResponse(t)},install:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/packages`,{method:`POST`,body:JSON.stringify(t)});return this.unwrapResponse(n)},get:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/packages/${encodeURIComponent(t)}`);return this.unwrapResponse(n)},enable:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/packages/${encodeURIComponent(t)}/enable`,{method:`PATCH`});return this.unwrapResponse(n)},disable:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/packages/${encodeURIComponent(t)}/disable`,{method:`PATCH`});return this.unwrapResponse(n)},uninstall:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/packages/${encodeURIComponent(t)}`,{method:`DELETE`});return this.unwrapResponse(n)},upgrade:async(e,t,n)=>{let r=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/packages/${encodeURIComponent(t)}/upgrade`,{method:`POST`,body:JSON.stringify({targetVersion:n})});return this.unwrapResponse(r)}}},this.organizations={list:async()=>{let e=this.getRoute(`auth`),t=await(await this.fetch(`${this.baseUrl}${e}/organization/list`)).json();return{organizations:Array.isArray(t)?t:t?.data??[]}},create:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/create`,{method:`POST`,body:JSON.stringify(e)})).json()},update:async(e,t)=>{let n=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${n}/organization/update`,{method:`POST`,body:JSON.stringify({organizationId:e,data:t})})).json()},setActive:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/set-active`,{method:`POST`,body:JSON.stringify({organizationId:e})})).json()},get:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/get-full-organization?organizationId=${encodeURIComponent(e)}`)).json()},listMembers:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/list-members?organizationId=${encodeURIComponent(e)}`)).json()},invite:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/invite-member`,{method:`POST`,body:JSON.stringify(e)})).json()},leave:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/leave`,{method:`POST`,body:JSON.stringify({organizationId:e})})).json()},delete:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/delete`,{method:`POST`,body:JSON.stringify({organizationId:e})})).json()},removeMember:async(e,t)=>{let n=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${n}/organization/remove-member`,{method:`POST`,body:JSON.stringify({memberIdOrEmail:t.memberIdOrEmail,organizationId:e})})).json()},updateMemberRole:async(e,t)=>{let n=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${n}/organization/update-member-role`,{method:`POST`,body:JSON.stringify({memberId:t.memberId,role:t.role,organizationId:e})})).json()},getActiveMember:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/get-active-member?organizationId=${encodeURIComponent(e)}`)).json()},invitations:{list:async e=>{let t=this.getRoute(`auth`),n=await(await this.fetch(`${this.baseUrl}${t}/organization/list-invitations?organizationId=${encodeURIComponent(e)}`)).json();return{invitations:Array.isArray(n)?n:n?.data??n?.invitations??[]}},listMine:async()=>{let e=this.getRoute(`auth`),t=await(await this.fetch(`${this.baseUrl}${e}/organization/list-user-invitations`)).json();return{invitations:Array.isArray(t)?t:t?.data??t?.invitations??[]}},cancel:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/cancel-invitation`,{method:`POST`,body:JSON.stringify({invitationId:e})})).json()},accept:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/accept-invitation`,{method:`POST`,body:JSON.stringify({invitationId:e})})).json()},reject:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/reject-invitation`,{method:`POST`,body:JSON.stringify({invitationId:e})})).json()},resend:async e=>{if(e.id)try{await this.organizations.invitations.cancel(e.id)}catch{}return this.organizations.invite({email:e.email,role:e.role??`member`,organizationId:e.organizationId})}},teams:{list:async e=>{let t=this.getRoute(`auth`),n=await(await this.fetch(`${this.baseUrl}${t}/organization/list-teams?organizationId=${encodeURIComponent(e)}`)).json();return{teams:Array.isArray(n)?n:n?.data??n?.teams??[]}},create:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/create-team`,{method:`POST`,body:JSON.stringify(e)})).json()},update:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/update-team`,{method:`POST`,body:JSON.stringify(e)})).json()},delete:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/remove-team`,{method:`POST`,body:JSON.stringify(e)})).json()},listMembers:async e=>{let t=this.getRoute(`auth`),n=await(await this.fetch(`${this.baseUrl}${t}/organization/list-team-members?teamId=${encodeURIComponent(e)}`)).json();return{members:Array.isArray(n)?n:n?.data??n?.members??[]}},addMember:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/add-team-member`,{method:`POST`,body:JSON.stringify(e)})).json()},removeMember:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/remove-team-member`,{method:`POST`,body:JSON.stringify(e)})).json()}}},this.oauth={applications:{register:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/oauth2/create-client`,{method:`POST`,body:JSON.stringify(e)})).json()},get:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/oauth2/get-client?client_id=${encodeURIComponent(e)}`)).json()},getPublic:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/oauth2/public-client?client_id=${encodeURIComponent(e)}`)).json()},list:async()=>{let e=this.getRoute(`auth`),t=await(await this.fetch(`${this.baseUrl}${e}/oauth2/get-clients`)).json();return{applications:Array.isArray(t)?t:t?.clients??t?.data??[]}},delete:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/oauth2/delete-client`,{method:`POST`,body:JSON.stringify({client_id:e})})).json()}},consent:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/oauth2/consent`,{method:`POST`,body:JSON.stringify(e)})).json()}},this.auth={getConfig:async()=>{let e=this.getRoute(`auth`),t=await this.fetch(`${this.baseUrl}${e}/config`);return this.unwrapResponse(t)},login:async e=>{let t=this.getRoute(`auth`),n=await(await this.fetch(`${this.baseUrl}${t}/sign-in/email`,{method:`POST`,headers:{Origin:this.baseUrl},body:JSON.stringify(e)})).json(),r=n&&(n.data??(n.token||n.user?{token:n.token,user:n.user}:void 0)),i=r?{...n,data:r}:n;return i.data?.token&&(this.token=i.data.token),i},logout:async()=>{let e=this.getRoute(`auth`);await this.fetch(`${this.baseUrl}${e}/sign-out`,{method:`POST`,headers:{"Content-Type":`application/json`,Origin:this.baseUrl},body:`{}`}),this.token=void 0},me:async()=>{let e=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${e}/get-session`,{headers:{Origin:this.baseUrl}})).json()},register:async e=>{let t=this.getRoute(`auth`),n=await(await this.fetch(`${this.baseUrl}${t}/sign-up/email`,{method:`POST`,headers:{Origin:this.baseUrl},body:JSON.stringify(e)})).json(),r=n&&(n.data??(n.token||n.user?{token:n.token,user:n.user}:void 0)),i=r?{...n,data:r}:n;return i.data?.token&&(this.token=i.data.token),i},signInWithProvider:async(e,t)=>{if(typeof window>`u`)throw Error(`signInWithProvider requires a browser environment`);let n=this.getRoute(`auth`),r=t?.callbackURL??window.location.origin+`/login`,i=t?.type===`oidc`,a=i?`/sign-in/oauth2`:`/sign-in/social`,o=i?{providerId:e,callbackURL:r}:{provider:e,callbackURL:r};t?.errorCallbackURL&&(o.errorCallbackURL=t.errorCallbackURL);let s=await(await this.fetch(`${this.baseUrl}${n}${a}`,{method:`POST`,body:JSON.stringify(o)})).json(),c=s?.url??s?.data?.url;if(c)window.location.assign(c);else throw Error(`signInWithProvider: no redirect URL returned for provider "${e}"`)},refreshToken:async e=>{let t=this.getRoute(`auth`),n=await(await this.fetch(`${this.baseUrl}${t}/get-session`,{method:`GET`})).json();return n.data?.token&&(this.token=n.data.token),n},bootstrapStatus:async()=>{let e=this.getRoute(`auth`),t=await(await this.fetch(`${this.baseUrl}${e}/bootstrap-status`)).json();return{hasOwner:!!(t?.data??t)?.hasOwner}},updateUser:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/update-user`,{method:`POST`,body:JSON.stringify(e)})).json()},changePassword:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/change-password`,{method:`POST`,body:JSON.stringify(e)})).json()},changeEmail:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/change-email`,{method:`POST`,body:JSON.stringify(e)})).json()},sendVerificationEmail:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/send-verification-email`,{method:`POST`,body:JSON.stringify(e)})).json()},verifyEmail:async e=>{let t=this.getRoute(`auth`),n=new URL(`${this.baseUrl}${t}/verify-email`);return n.searchParams.set(`token`,e.token),e.callbackURL&&n.searchParams.set(`callbackURL`,e.callbackURL),(await this.fetch(n.toString())).json()},deleteUser:async e=>{let t=this.getRoute(`auth`),n=await this.fetch(`${this.baseUrl}${t}/delete-user`,{method:`POST`,body:JSON.stringify(e)});return this.token=void 0,n.json()},sessions:{list:async()=>{let e=this.getRoute(`auth`),t=await(await this.fetch(`${this.baseUrl}${e}/list-sessions`)).json();return{sessions:Array.isArray(t)?t:t?.data??t?.sessions??[]}},revoke:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/revoke-session`,{method:`POST`,body:JSON.stringify({token:e})})).json()},revokeOthers:async()=>{let e=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${e}/revoke-other-sessions`,{method:`POST`,body:`{}`})).json()},revokeAll:async()=>{let e=this.getRoute(`auth`),t=await this.fetch(`${this.baseUrl}${e}/revoke-sessions`,{method:`POST`,body:`{}`});return this.token=void 0,t.json()}},twoFactor:{enable:async e=>{let t=this.getRoute(`auth`),n=await(await this.fetch(`${this.baseUrl}${t}/two-factor/enable`,{method:`POST`,body:JSON.stringify(e)})).json();return n?.data??n},verifyTotp:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/two-factor/verify-totp`,{method:`POST`,body:JSON.stringify(e)})).json()},disable:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/two-factor/disable`,{method:`POST`,body:JSON.stringify(e)})).json()},generateBackupCodes:async e=>{let t=this.getRoute(`auth`),n=await(await this.fetch(`${this.baseUrl}${t}/two-factor/generate-backup-codes`,{method:`POST`,body:JSON.stringify(e)})).json();return n?.data??n},verifyBackupCode:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/two-factor/verify-backup-code`,{method:`POST`,body:JSON.stringify(e)})).json()}},accounts:{list:async()=>{let e=this.getRoute(`auth`),t=await(await this.fetch(`${this.baseUrl}${e}/list-accounts`)).json();return{accounts:Array.isArray(t)?t:t?.data??t?.accounts??[]}},unlink:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/unlink-account`,{method:`POST`,body:JSON.stringify(e)})).json()},linkSocial:async e=>{let t=this.getRoute(`auth`),n=e.callbackURL??(typeof window<`u`?window.location.href:void 0),r=await(await this.fetch(`${this.baseUrl}${t}/link-social`,{method:`POST`,body:JSON.stringify({provider:e.provider,callbackURL:n})})).json();return r?.data??r}}},this.storage={upload:async(e,t=`user`)=>{let n={filename:e.name,mimeType:e.type,size:e.size,scope:t},r=this.getRoute(`storage`),{data:i}=await(await this.fetch(`${this.baseUrl}${r}/upload/presigned`,{method:`POST`,body:JSON.stringify(n)})).json(),a=await this.fetchImpl(i.uploadUrl,{method:i.method,headers:i.headers,body:e});if(!a.ok)throw Error(`Storage Upload Failed: ${a.statusText}`);let o={fileId:i.fileId};return(await this.fetch(`${this.baseUrl}${r}/upload/complete`,{method:`POST`,body:JSON.stringify(o)})).json()},getDownloadUrl:async e=>{let t=this.getRoute(`storage`);return(await(await this.fetch(`${this.baseUrl}${t}/files/${e}/url`)).json()).url},getPresignedUrl:async e=>{let t=this.getRoute(`storage`);return(await this.fetch(`${this.baseUrl}${t}/upload/presigned`,{method:`POST`,body:JSON.stringify(e)})).json()},initChunkedUpload:async e=>{let t=this.getRoute(`storage`);return(await this.fetch(`${this.baseUrl}${t}/upload/chunked`,{method:`POST`,body:JSON.stringify(e)})).json()},uploadPart:async(e,t,n,r)=>{let i=this.getRoute(`storage`);return(await this.fetch(`${this.baseUrl}${i}/upload/chunked/${e}/chunk/${t}`,{method:`PUT`,headers:{"x-resume-token":n},body:r})).json()},completeChunkedUpload:async e=>{let t=this.getRoute(`storage`);return(await this.fetch(`${this.baseUrl}${t}/upload/chunked/${e.uploadId}/complete`,{method:`POST`,body:JSON.stringify(e)})).json()},resumeUpload:async(e,t,n,r)=>{let i=this.getRoute(`storage`),{totalChunks:a,uploadedChunks:o}=(await(await this.fetch(`${this.baseUrl}${i}/upload/chunked/${e}/progress`)).json()).data,s=[],c=t instanceof ArrayBuffer?t:await t.arrayBuffer();for(let t=o;t<a;t++){let i=t*n,a=Math.min(i+n,c.byteLength),o=new Blob([c.slice(i,a)]),l=await this.storage.uploadPart(e,t,r,o);s.push({chunkIndex:t,eTag:l.data.eTag})}return this.storage.completeChunkedUpload({uploadId:e,parts:s})}},this.automation={trigger:async(e,t)=>{let n=this.getRoute(`automation`);return(await this.fetch(`${this.baseUrl}${n}/trigger/${e}`,{method:`POST`,body:JSON.stringify(t)})).json()},list:async()=>{let e=this.getRoute(`automation`),t=await this.fetch(`${this.baseUrl}${e}`);return this.unwrapResponse(t)},get:async e=>{let t=this.getRoute(`automation`),n=await this.fetch(`${this.baseUrl}${t}/${e}`);return this.unwrapResponse(n)},create:async(e,t)=>{let n=this.getRoute(`automation`),r=await this.fetch(`${this.baseUrl}${n}`,{method:`POST`,body:JSON.stringify({name:e,...t})});return this.unwrapResponse(r)},update:async(e,t)=>{let n=this.getRoute(`automation`),r=await this.fetch(`${this.baseUrl}${n}/${e}`,{method:`PUT`,body:JSON.stringify({definition:t})});return this.unwrapResponse(r)},delete:async e=>{let t=this.getRoute(`automation`),n=await this.fetch(`${this.baseUrl}${t}/${e}`,{method:`DELETE`});return this.unwrapResponse(n)},toggle:async(e,t)=>{let n=this.getRoute(`automation`),r=await this.fetch(`${this.baseUrl}${n}/${e}/toggle`,{method:`POST`,body:JSON.stringify({enabled:t})});return this.unwrapResponse(r)},runs:{list:async(e,t)=>{let n=this.getRoute(`automation`),r=new URLSearchParams;t?.limit&&r.set(`limit`,String(t.limit)),t?.cursor&&r.set(`cursor`,t.cursor);let i=r.toString(),a=await this.fetch(`${this.baseUrl}${n}/${e}/runs${i?`?${i}`:``}`);return this.unwrapResponse(a)},get:async(e,t)=>{let n=this.getRoute(`automation`),r=await this.fetch(`${this.baseUrl}${n}/${e}/runs/${t}`);return this.unwrapResponse(r)}},getFlow:async e=>{let t=this.getRoute(`automation`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e)}`);return this.unwrapResponse(n)},execute:async(e,t)=>{let n=this.getRoute(`automation`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/trigger`,{method:`POST`,body:JSON.stringify(t??{})});return this.unwrapResponse(r)},listRuns:async(e,t)=>{let n=this.getRoute(`automation`),r=new URLSearchParams;t?.limit!=null&&r.set(`limit`,String(t.limit)),t?.cursor&&r.set(`cursor`,t.cursor);let i=r.toString(),a=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/runs${i?`?${i}`:``}`);return this.unwrapResponse(a)},getRun:async(e,t)=>{let n=this.getRoute(`automation`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/runs/${encodeURIComponent(t)}`);return this.unwrapResponse(r)}},this.permissions={check:async e=>{let t=this.getRoute(`permissions`),n=new URLSearchParams({object:e.object,action:e.action});e.recordId!==void 0&&n.set(`recordId`,e.recordId),e.field!==void 0&&n.set(`field`,e.field);let r=await this.fetch(`${this.baseUrl}${t}/check?${n.toString()}`);return this.unwrapResponse(r)},getObjectPermissions:async e=>{let t=this.getRoute(`permissions`),n=await this.fetch(`${this.baseUrl}${t}/objects/${encodeURIComponent(e)}`);return this.unwrapResponse(n)},getEffectivePermissions:async()=>{let e=this.getRoute(`permissions`),t=await this.fetch(`${this.baseUrl}${e}/effective`);return this.unwrapResponse(t)}},this.realtime={connect:async e=>{let t=this.getRoute(`realtime`),n=await this.fetch(`${this.baseUrl}${t}/connect`,{method:`POST`,body:JSON.stringify(e||{})});return this.unwrapResponse(n)},disconnect:async()=>{let e=this.getRoute(`realtime`);await this.fetch(`${this.baseUrl}${e}/disconnect`,{method:`POST`})},subscribe:async e=>{let t=this.getRoute(`realtime`),n=await this.fetch(`${this.baseUrl}${t}/subscribe`,{method:`POST`,body:JSON.stringify(e)});return this.unwrapResponse(n)},unsubscribe:async e=>{let t=this.getRoute(`realtime`);await this.fetch(`${this.baseUrl}${t}/unsubscribe`,{method:`POST`,body:JSON.stringify({subscriptionId:e})})},setPresence:async(e,t)=>{let n=this.getRoute(`realtime`);await this.fetch(`${this.baseUrl}${n}/presence`,{method:`PUT`,body:JSON.stringify({channel:e,state:t})})},getPresence:async e=>{let t=this.getRoute(`realtime`),n=await this.fetch(`${this.baseUrl}${t}/presence/${encodeURIComponent(e)}`);return this.unwrapResponse(n)}},this.workflow={getConfig:async e=>{let t=this.getRoute(`workflow`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e)}/config`);return this.unwrapResponse(n)},getState:async(e,t)=>{let n=this.getRoute(`workflow`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/state`);return this.unwrapResponse(r)},transition:async e=>{let t=this.getRoute(`workflow`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e.object)}/${encodeURIComponent(e.recordId)}/transition`,{method:`POST`,body:JSON.stringify({transition:e.transition,comment:e.comment,data:e.data})});return this.unwrapResponse(n)},approve:async e=>{let t=this.getRoute(`workflow`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e.object)}/${encodeURIComponent(e.recordId)}/approve`,{method:`POST`,body:JSON.stringify({comment:e.comment,data:e.data})});return this.unwrapResponse(n)},reject:async e=>{let t=this.getRoute(`workflow`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e.object)}/${encodeURIComponent(e.recordId)}/reject`,{method:`POST`,body:JSON.stringify({reason:e.reason,comment:e.comment})});return this.unwrapResponse(n)}},this.views={list:async(e,t)=>{let n=this.getRoute(`views`),r=new URLSearchParams;t&&r.set(`type`,t);let i=r.toString(),a=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}${i?`?${i}`:``}`);return this.unwrapResponse(a)},get:async(e,t)=>{let n=this.getRoute(`views`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/${encodeURIComponent(t)}`);return this.unwrapResponse(r)},create:async(e,t)=>{let n=this.getRoute(`views`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}`,{method:`POST`,body:JSON.stringify({object:e,data:t})});return this.unwrapResponse(r)},update:async(e,t,n)=>{let r=this.getRoute(`views`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,{method:`PUT`,body:JSON.stringify({object:e,viewId:t,data:n})});return this.unwrapResponse(i)},delete:async(e,t)=>{let n=this.getRoute(`views`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,{method:`DELETE`});return this.unwrapResponse(r)}},this.notifications={registerDevice:async e=>{let t=this.getRoute(`notifications`),n=await this.fetch(`${this.baseUrl}${t}/devices`,{method:`POST`,body:JSON.stringify(e)});return this.unwrapResponse(n)},unregisterDevice:async e=>{let t=this.getRoute(`notifications`),n=await this.fetch(`${this.baseUrl}${t}/devices/${encodeURIComponent(e)}`,{method:`DELETE`});return this.unwrapResponse(n)},getPreferences:async()=>{let e=this.getRoute(`notifications`),t=await this.fetch(`${this.baseUrl}${e}/preferences`);return this.unwrapResponse(t)},updatePreferences:async e=>{let t=this.getRoute(`notifications`),n=await this.fetch(`${this.baseUrl}${t}/preferences`,{method:`PUT`,body:JSON.stringify({preferences:e})});return this.unwrapResponse(n)},list:async e=>{let t=this.getRoute(`notifications`),n=new URLSearchParams;e?.read!==void 0&&n.set(`read`,String(e.read)),e?.type&&n.set(`type`,e.type),e?.limit&&n.set(`limit`,String(e.limit)),e?.cursor&&n.set(`cursor`,e.cursor);let r=n.toString(),i=await this.fetch(`${this.baseUrl}${t}${r?`?${r}`:``}`);return this.unwrapResponse(i)},markRead:async e=>{let t=this.getRoute(`notifications`),n=await this.fetch(`${this.baseUrl}${t}/read`,{method:`POST`,body:JSON.stringify({ids:e})});return this.unwrapResponse(n)},markAllRead:async()=>{let e=this.getRoute(`notifications`),t=await this.fetch(`${this.baseUrl}${e}/read/all`,{method:`POST`});return this.unwrapResponse(t)}},this.ai={nlq:async e=>{let t=this.getRoute(`ai`),n=await this.fetch(`${this.baseUrl}${t}/nlq`,{method:`POST`,body:JSON.stringify(e)});return this.unwrapResponse(n)},suggest:async e=>{let t=this.getRoute(`ai`),n=await this.fetch(`${this.baseUrl}${t}/suggest`,{method:`POST`,body:JSON.stringify(e)});return this.unwrapResponse(n)},insights:async e=>{let t=this.getRoute(`ai`),n=await this.fetch(`${this.baseUrl}${t}/insights`,{method:`POST`,body:JSON.stringify(e)});return this.unwrapResponse(n)}},this.i18n={getLocales:async()=>{let e=this.getRoute(`i18n`),t=await this.fetch(`${this.baseUrl}${e}/locales`);return this.unwrapResponse(t)},getTranslations:async(e,t)=>{let n=this.getRoute(`i18n`),r=new URLSearchParams;r.set(`locale`,e),t?.namespace&&r.set(`namespace`,t.namespace),t?.keys&&r.set(`keys`,t.keys.join(`,`));let i=await this.fetch(`${this.baseUrl}${n}/translations?${r.toString()}`);return this.unwrapResponse(i)},getFieldLabels:async(e,t)=>{let n=this.getRoute(`i18n`),r=await this.fetch(`${this.baseUrl}${n}/labels/${encodeURIComponent(e)}?locale=${encodeURIComponent(t)}`);return this.unwrapResponse(r)}},this.feed={list:async(e,t,n)=>{let r=this.getRoute(`data`),i=new URLSearchParams;n?.type&&i.set(`type`,n.type),n?.limit&&i.set(`limit`,String(n.limit)),n?.cursor&&i.set(`cursor`,n.cursor);let a=i.toString(),o=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed${a?`?${a}`:``}`);return this.unwrapResponse(o)},create:async(e,t,n)=>{let r=this.getRoute(`data`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed`,{method:`POST`,body:JSON.stringify(n)});return this.unwrapResponse(i)},update:async(e,t,n,r)=>{let i=this.getRoute(`data`),a=await this.fetch(`${this.baseUrl}${i}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/${encodeURIComponent(n)}`,{method:`PUT`,body:JSON.stringify(r)});return this.unwrapResponse(a)},delete:async(e,t,n)=>{let r=this.getRoute(`data`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/${encodeURIComponent(n)}`,{method:`DELETE`});return this.unwrapResponse(i)},addReaction:async(e,t,n,r)=>{let i=this.getRoute(`data`),a=await this.fetch(`${this.baseUrl}${i}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/${encodeURIComponent(n)}/reactions`,{method:`POST`,body:JSON.stringify({emoji:r})});return this.unwrapResponse(a)},removeReaction:async(e,t,n,r)=>{let i=this.getRoute(`data`),a=await this.fetch(`${this.baseUrl}${i}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/${encodeURIComponent(n)}/reactions/${encodeURIComponent(r)}`,{method:`DELETE`});return this.unwrapResponse(a)},pin:async(e,t,n)=>{let r=this.getRoute(`data`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/${encodeURIComponent(n)}/pin`,{method:`POST`});return this.unwrapResponse(i)},unpin:async(e,t,n)=>{let r=this.getRoute(`data`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/${encodeURIComponent(n)}/pin`,{method:`DELETE`});return this.unwrapResponse(i)},star:async(e,t,n)=>{let r=this.getRoute(`data`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/${encodeURIComponent(n)}/star`,{method:`POST`});return this.unwrapResponse(i)},unstar:async(e,t,n)=>{let r=this.getRoute(`data`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/${encodeURIComponent(n)}/star`,{method:`DELETE`});return this.unwrapResponse(i)},search:async(e,t,n,r)=>{let i=this.getRoute(`data`),a=new URLSearchParams;a.set(`query`,n),r?.type&&a.set(`type`,r.type),r?.actorId&&a.set(`actorId`,r.actorId),r?.dateFrom&&a.set(`dateFrom`,r.dateFrom),r?.dateTo&&a.set(`dateTo`,r.dateTo),r?.limit&&a.set(`limit`,String(r.limit)),r?.cursor&&a.set(`cursor`,r.cursor);let o=await this.fetch(`${this.baseUrl}${i}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/search?${a.toString()}`);return this.unwrapResponse(o)},getChangelog:async(e,t,n)=>{let r=this.getRoute(`data`),i=new URLSearchParams;n?.field&&i.set(`field`,n.field),n?.actorId&&i.set(`actorId`,n.actorId),n?.dateFrom&&i.set(`dateFrom`,n.dateFrom),n?.dateTo&&i.set(`dateTo`,n.dateTo),n?.limit&&i.set(`limit`,String(n.limit)),n?.cursor&&i.set(`cursor`,n.cursor);let a=i.toString(),o=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/changelog${a?`?${a}`:``}`);return this.unwrapResponse(o)},subscribe:async(e,t,n)=>{let r=this.getRoute(`data`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/subscribe`,{method:`POST`,body:JSON.stringify(n||{})});return this.unwrapResponse(i)},unsubscribe:async(e,t)=>{let n=this.getRoute(`data`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/subscribe`,{method:`DELETE`});return this.unwrapResponse(r)}},this.data={query:async(e,t)=>{let n=this.getRoute(`data`),r=await this.fetch(`${this.baseUrl}${n}/${e}/query`,{method:`POST`,body:JSON.stringify(t)});return this.unwrapResponse(r)},find:async(e,t={})=>{let n=this.getRoute(`data`),r=new URLSearchParams,i=t,a={};if(`where`in t||`fields`in t||`orderBy`in t||`offset`in t?(i.where&&(a.filter=i.where),i.fields&&(a.select=i.fields),i.orderBy&&(a.sort=i.orderBy),i.limit!=null&&(a.top=i.limit),i.offset!=null&&(a.skip=i.offset),i.aggregations&&(a.aggregations=i.aggregations),i.groupBy&&(a.groupBy=i.groupBy)):Object.assign(a,t),a.top&&r.set(`top`,a.top.toString()),a.skip&&r.set(`skip`,a.skip.toString()),a.sort)if(Array.isArray(a.sort)&&typeof a.sort[0]==`object`)r.set(`sort`,JSON.stringify(a.sort));else{let e=Array.isArray(a.sort)?a.sort.join(`,`):a.sort;r.set(`sort`,e)}a.select&&r.set(`select`,a.select.join(`,`));let o=a.filter??a.filters;o&&(this.isFilterAST(o)||Array.isArray(o)?r.set(`filter`,JSON.stringify(o)):typeof o==`object`&&o&&Object.entries(o).forEach(([e,t])=>{t!=null&&r.append(e,String(t))})),a.aggregations&&r.set(`aggregations`,JSON.stringify(a.aggregations)),a.groupBy&&r.set(`groupBy`,a.groupBy.join(`,`));let s=await this.fetch(`${this.baseUrl}${n}/${e}?${r.toString()}`);return this.unwrapResponse(s)},get:async(e,t)=>{let n=this.getRoute(`data`),r=await this.fetch(`${this.baseUrl}${n}/${e}/${t}`);return this.unwrapResponse(r)},create:async(e,t)=>{let n=this.getRoute(`data`),r=await this.fetch(`${this.baseUrl}${n}/${e}`,{method:`POST`,body:JSON.stringify(t)});return this.unwrapResponse(r)},createMany:async(e,t)=>{let n=this.getRoute(`data`),r=await this.fetch(`${this.baseUrl}${n}/${e}/createMany`,{method:`POST`,body:JSON.stringify(t)});return this.unwrapResponse(r)},update:async(e,t,n,r)=>{let i=this.getRoute(`data`),a={};r?.ifMatch&&(a[`If-Match`]=String(r.ifMatch));let o=await this.fetch(`${this.baseUrl}${i}/${e}/${t}`,{method:`PATCH`,body:JSON.stringify(n),...Object.keys(a).length?{headers:a}:{}});return this.unwrapResponse(o)},batch:async(e,t)=>{let n=this.getRoute(`data`),r=await this.fetch(`${this.baseUrl}${n}/${e}/batch`,{method:`POST`,body:JSON.stringify(t)});return this.unwrapResponse(r)},updateMany:async(e,t,n)=>{let r=this.getRoute(`data`),i={records:t,options:n},a=await this.fetch(`${this.baseUrl}${r}/${e}/updateMany`,{method:`POST`,body:JSON.stringify(i)});return this.unwrapResponse(a)},delete:async(e,t,n)=>{let r=this.getRoute(`data`),i={};n?.ifMatch&&(i[`If-Match`]=String(n.ifMatch));let a=await this.fetch(`${this.baseUrl}${r}/${e}/${t}`,{method:`DELETE`,...Object.keys(i).length?{headers:i}:{}});return this.unwrapResponse(a)},deleteMany:async(e,t,n)=>{let r=this.getRoute(`data`),i={ids:t,options:n},a=await this.fetch(`${this.baseUrl}${r}/${e}/deleteMany`,{method:`POST`,body:JSON.stringify(i)});return this.unwrapResponse(a)}},this.baseUrl=e.baseUrl.replace(/\/$/,``),this.token=e.token,this.environmentId=e.environmentId,this.fetchImpl=e.fetch||globalThis.fetch.bind(globalThis),this.logger=e.logger||Xu({level:e.debug?`debug`:`info`,format:`pretty`}),this.realtimeAPI=new Zu(this.baseUrl,this.token),this.logger.debug(`ObjectStack client created`,{baseUrl:this.baseUrl})}async connect(){this.logger.debug(`Connecting to ObjectStack server`,{baseUrl:this.baseUrl});try{let e;try{let t=`${this.baseUrl}/api/v1/discovery`;this.logger.debug(`Probing protocol-standard discovery endpoint`,{url:t});let n=await this.fetchImpl(t);if(n.ok){let t=await n.json();e=t.data||t,this.logger.debug(`Discovered via /api/v1/discovery`)}}catch(e){this.logger.debug(`Protocol-standard discovery probe failed`,{error:e.message})}if(!e){let t;try{t=`${new URL(this.baseUrl).origin}/.well-known/objectstack`}catch{t=`/.well-known/objectstack`}this.logger.debug(`Falling back to .well-known discovery`,{url:t});let n=await this.fetchImpl(t);if(!n.ok)throw Error(`Failed to connect to ${t}: ${n.statusText}`);let r=await n.json();e=r.data||r}if(!e)throw Error(`Connection failed: No discovery data returned`);return this.discoveryInfo=e,this.logger.info(`Connected to ObjectStack server`,{version:e.version,apiName:e.apiName,services:e.services}),e}catch(e){throw this.logger.error(`Failed to connect to ObjectStack server`,e,{baseUrl:this.baseUrl}),e}}get capabilities(){let e=this.discoveryInfo?.capabilities;if(!e)return;let t={};for(let[n,r]of Object.entries(e))t[n]=typeof r==`object`&&r?!!r.enabled:!!r;return t}project(e){if(!e)throw Error(`[ObjectStack] project(id): environmentId is required`);return new $u(this,e)}_baseUrl(){return this.baseUrl}_fetch(e,t){return this.fetch(e,t)}_unwrap(e){return this.unwrapResponse(e)}_isFilterAST(e){return this.isFilterAST(e)}setProjectId(e){this.environmentId=e,this.logger.debug(`Active project changed`,{environmentId:e})}getProjectId(){return this.environmentId}get events(){return this.realtimeAPI}isFilterAST(e){return ps(e)}async unwrapResponse(e){let t=await e.json();return t&&typeof t.success==`boolean`&&`data`in t?t.data:t}async fetch(e,t={}){this.logger.debug(`HTTP request`,{method:t.method||`GET`,url:e,hasBody:!!t.body});let n={"Content-Type":`application/json`,...t.headers||{}};this.token&&(n.Authorization=`Bearer ${this.token}`),this.environmentId&&(n[`X-Environment-Id`]=this.environmentId);let r=await this.fetchImpl(e,{...t,headers:n});if(this.logger.debug(`HTTP response`,{method:t.method||`GET`,url:e,status:r.status,ok:r.ok}),!r.ok){let n;try{n=await r.json()}catch{n={message:r.statusText}}this.logger.error(`HTTP request failed`,void 0,{method:t.method||`GET`,url:e,status:r.status,error:n});let i=n?.message??n?.error?.message??(typeof n?.error==`string`?n.error:void 0)??r.statusText,a=n?.code||n?.error?.code,o=Error(`[ObjectStack] ${a?`${a}: `:``}${i}`);throw o.code=a,o.category=n?.category,o.httpStatus=r.status,o.retryable=n?.retryable,o.details=n?.details||n,o}return r}getRoute(e){let t=this.discoveryInfo?.routes;if(t){let n=t[e];if(n)return n}return{data:`/api/v1/data`,metadata:`/api/v1/meta`,discovery:`/api/v1/discovery`,ui:`/api/v1/ui`,auth:`/api/v1/auth`,analytics:`/api/v1/analytics`,storage:`/api/v1/storage`,automation:`/api/v1/automation`,packages:`/api/v1/packages`,permissions:`/api/v1/permissions`,realtime:`/api/v1/realtime`,workflow:`/api/v1/workflow`,views:`/api/v1/ui/views`,notifications:`/api/v1/notifications`,ai:`/api/v1/ai`,i18n:`/api/v1/i18n`,feed:`/api/v1/feed`,graphql:`/graphql`}[e]||`/api/v1/${e}`}},$u=class{constructor(e,t){this.meta={getTypes:async()=>{let e=await this.parent._fetch(this.url(`/meta`));return this.parent._unwrap(e)},getItems:async(e,t)=>{let n=new URLSearchParams;t?.packageId&&n.set(`package`,t.packageId);let r=n.toString(),i=await this.parent._fetch(this.url(`/meta/${e}${r?`?${r}`:``}`));return this.parent._unwrap(i)},getItem:async(e,t,n)=>{let r=new URLSearchParams;n?.packageId&&r.set(`package`,n.packageId);let i=r.toString(),a=await this.parent._fetch(this.url(`/meta/${e}/${t}${i?`?${i}`:``}`));return this.parent._unwrap(a)},saveItem:async(e,t,n)=>{let r=await this.parent._fetch(this.url(`/meta/${e}/${t}`),{method:`PUT`,body:JSON.stringify(n)});return this.parent._unwrap(r)},deleteItem:async(e,t)=>{let n=await this.parent._fetch(this.url(`/meta/${encodeURIComponent(e)}/${encodeURIComponent(t)}`),{method:`DELETE`});return this.parent._unwrap(n)},getHistory:async(e,t,n)=>{let r=new URLSearchParams;n?.sinceSeq!==void 0&&r.set(`sinceSeq`,String(n.sinceSeq)),n?.limit!==void 0&&r.set(`limit`,String(n.limit));let i=r.toString(),a=await this.parent._fetch(this.url(`/meta/${encodeURIComponent(e)}/${encodeURIComponent(t)}/history${i?`?${i}`:``}`));return this.parent._unwrap(a)}},this.data={query:async(e,t)=>{let n=await this.parent._fetch(this.url(`/data/${e}/query`),{method:`POST`,body:JSON.stringify(t)});return this.parent._unwrap(n)},find:async(e,t={})=>{let n=new URLSearchParams,r=t,i={};if(`where`in t||`fields`in t||`orderBy`in t||`offset`in t?(r.where&&(i.filter=r.where),r.fields&&(i.select=r.fields),r.orderBy&&(i.sort=r.orderBy),r.limit!=null&&(i.top=r.limit),r.offset!=null&&(i.skip=r.offset),r.aggregations&&(i.aggregations=r.aggregations),r.groupBy&&(i.groupBy=r.groupBy)):Object.assign(i,t),i.top&&n.set(`top`,i.top.toString()),i.skip&&n.set(`skip`,i.skip.toString()),i.sort)if(Array.isArray(i.sort)&&typeof i.sort[0]==`object`)n.set(`sort`,JSON.stringify(i.sort));else{let e=Array.isArray(i.sort)?i.sort.join(`,`):i.sort;n.set(`sort`,e)}i.select&&n.set(`select`,i.select.join(`,`));let a=i.filter??i.filters;a&&(this.parent._isFilterAST(a)||Array.isArray(a)?n.set(`filter`,JSON.stringify(a)):typeof a==`object`&&a&&Object.entries(a).forEach(([e,t])=>{t!=null&&n.append(e,String(t))})),i.aggregations&&n.set(`aggregations`,JSON.stringify(i.aggregations)),i.groupBy&&n.set(`groupBy`,i.groupBy.join(`,`));let o=n.toString(),s=await this.parent._fetch(this.url(`/data/${e}${o?`?${o}`:``}`));return this.parent._unwrap(s)},get:async(e,t)=>{let n=await this.parent._fetch(this.url(`/data/${e}/${t}`));return this.parent._unwrap(n)},create:async(e,t)=>{let n=await this.parent._fetch(this.url(`/data/${e}`),{method:`POST`,body:JSON.stringify(t)});return this.parent._unwrap(n)},createMany:async(e,t)=>{let n=await this.parent._fetch(this.url(`/data/${e}/createMany`),{method:`POST`,body:JSON.stringify(t)});return this.parent._unwrap(n)},update:async(e,t,n)=>{let r=await this.parent._fetch(this.url(`/data/${e}/${t}`),{method:`PATCH`,body:JSON.stringify(n)});return this.parent._unwrap(r)},batch:async(e,t)=>{let n=await this.parent._fetch(this.url(`/data/${e}/batch`),{method:`POST`,body:JSON.stringify(t)});return this.parent._unwrap(n)},updateMany:async(e,t,n)=>{let r={records:t,options:n},i=await this.parent._fetch(this.url(`/data/${e}/updateMany`),{method:`POST`,body:JSON.stringify(r)});return this.parent._unwrap(i)},delete:async(e,t)=>{let n=await this.parent._fetch(this.url(`/data/${e}/${t}`),{method:`DELETE`});return this.parent._unwrap(n)},deleteMany:async(e,t,n)=>{let r={ids:t,options:n},i=await this.parent._fetch(this.url(`/data/${e}/deleteMany`),{method:`POST`,body:JSON.stringify(r)});return this.parent._unwrap(i)}},this.packages={list:async()=>{let e=await this.parent._fetch(this.url(`/packages`));return this.parent._unwrap(e)},get:async(e,t)=>{let n=t?`?version=${encodeURIComponent(t)}`:``,r=await this.parent._fetch(this.url(`/packages/${encodeURIComponent(e)}${n}`));return this.parent._unwrap(r)}},this.automation={getFlow:async e=>{let t=await this.parent._fetch(this.url(`/automation/${encodeURIComponent(e)}`));return this.parent._unwrap(t)},execute:async(e,t)=>{let n=await this.parent._fetch(this.url(`/automation/${encodeURIComponent(e)}/trigger`),{method:`POST`,body:JSON.stringify(t??{})});return this.parent._unwrap(n)},listRuns:async(e,t)=>{let n=new URLSearchParams;t?.limit!=null&&n.set(`limit`,String(t.limit)),t?.cursor&&n.set(`cursor`,t.cursor);let r=n.toString(),i=await this.parent._fetch(this.url(`/automation/${encodeURIComponent(e)}/runs${r?`?${r}`:``}`));return this.parent._unwrap(i)},getRun:async(e,t)=>{let n=await this.parent._fetch(this.url(`/automation/${encodeURIComponent(e)}/runs/${encodeURIComponent(t)}`));return this.parent._unwrap(n)}},this.parent=e,this.environmentId=t}getProjectId(){return this.environmentId}scope(){return`/api/v1/environments/${encodeURIComponent(this.environmentId)}`}url(e){return`${this.parent._baseUrl()}${this.scope()}${e}`}};function q(e){if(typeof process<`u`&&{}.OS_EAGER_SCHEMAS===`1`)return e();let t,n=()=>(t===void 0&&(t=e()),t);return new Proxy(function(){},{get(e,t){let r=n(),i=r[t];return typeof i==`function`?i.bind(r):i},set(e,t,r){let i=n();return i[t]=r,!0},has(e,t){return t in n()},ownKeys(){return Reflect.ownKeys(n())},getOwnPropertyDescriptor(e,t){return Reflect.getOwnPropertyDescriptor(n(),t)},getPrototypeOf(){return Reflect.getPrototypeOf(n())}})}q(()=>k({key:x().describe(`Translation key (e.g., "views.task_list.label")`),defaultValue:x().optional().describe(`Fallback value when translation key is not found`),params:N(x(),A([x(),C(),w()])).optional().describe(`Interpolation parameters (e.g., { count: 5 })`)}));var J=q(()=>x().describe(`Display label (plain string; i18n keys are auto-generated by the framework)`)),Y=q(()=>k({ariaLabel:J.optional().describe(`Accessible label for screen readers (WAI-ARIA aria-label)`),ariaDescribedBy:x().optional().describe(`ID of element providing additional description (WAI-ARIA aria-describedby)`),role:x().optional().describe(`WAI-ARIA role attribute (e.g., "dialog", "navigation", "alert")`)}).describe(`ARIA accessibility attributes`));q(()=>k({key:x().describe(`Translation key`),zero:x().optional().describe(`Zero form (e.g., "No items")`),one:x().optional().describe(`Singular form (e.g., "{count} item")`),two:x().optional().describe(`Dual form (e.g., "{count} items" for exactly 2)`),few:x().optional().describe(`Few form (e.g., for 2-4 in some languages)`),many:x().optional().describe(`Many form (e.g., for 5+ in some languages)`),other:x().describe(`Default plural form (e.g., "{count} items")`)}).describe(`ICU plural rules for a translation key`));var ed=q(()=>k({style:P([`decimal`,`currency`,`percent`,`unit`]).default(`decimal`).describe(`Number formatting style`),currency:x().optional().describe(`ISO 4217 currency code (e.g., "USD", "EUR")`),unit:x().optional().describe(`Unit for unit formatting (e.g., "kilometer", "liter")`),minimumFractionDigits:C().optional().describe(`Minimum number of fraction digits`),maximumFractionDigits:C().optional().describe(`Maximum number of fraction digits`),useGrouping:w().optional().describe(`Whether to use grouping separators (e.g., 1,000)`)}).describe(`Number formatting rules`)),td=q(()=>k({dateStyle:P([`full`,`long`,`medium`,`short`]).optional().describe(`Date display style`),timeStyle:P([`full`,`long`,`medium`,`short`]).optional().describe(`Time display style`),timeZone:x().optional().describe(`IANA time zone (e.g., "America/New_York")`),hour12:w().optional().describe(`Use 12-hour format`)}).describe(`Date/time formatting rules`));q(()=>k({code:x().describe(`BCP 47 language code (e.g., "en-US", "zh-CN")`),fallbackChain:O(x()).optional().describe(`Fallback language codes in priority order (e.g., ["zh-TW", "en"])`),direction:P([`ltr`,`rtl`]).default(`ltr`).describe(`Text direction: left-to-right or right-to-left`),numberFormat:ed.optional().describe(`Default number formatting rules`),dateFormat:td.optional().describe(`Default date/time formatting rules`)}).describe(`Locale configuration`));var nd=q(()=>P(`bar.horizontal-bar.column.grouped-bar.stacked-bar.bi-polar-bar.line.area.stacked-area.step-line.spline.pie.donut.funnel.pyramid.scatter.bubble.treemap.sunburst.sankey.word-cloud.gauge.solid-gauge.metric.kpi.bullet.choropleth.bubble-map.gl-map.heatmap.radar.waterfall.box-plot.violin.candlestick.stock.table.pivot`.split(`.`))),rd=q(()=>k({field:x().describe(`Data field key`),title:J.optional().describe(`Axis display title`),format:x().optional().describe(`Value format string (e.g., "$0,0.00")`),min:C().optional().describe(`Minimum value`),max:C().optional().describe(`Maximum value`),stepSize:C().optional().describe(`Step size for ticks`),showGridLines:w().default(!0),position:P([`left`,`right`,`top`,`bottom`]).optional().describe(`Axis position`),logarithmic:w().default(!1)})),id=q(()=>k({name:x().describe(`Field name or series identifier`),label:J.optional().describe(`Series display label`),type:nd.optional().describe(`Override chart type for this series`),color:x().optional().describe(`Series color (hex/rgb/token)`),stack:x().optional().describe(`Stack identifier to group series`),yAxis:P([`left`,`right`]).default(`left`).describe(`Bind to specific Y-Axis`),variant:P([`primary`,`comparison`]).default(`primary`).optional().describe(`Series visual role`),dashArray:x().optional().describe(`SVG stroke-dasharray override`),opacity:C().min(0).max(1).optional().describe(`Series opacity override`)})),ad=q(()=>k({type:P([`line`,`region`]).default(`line`),axis:P([`x`,`y`]).default(`y`),value:A([C(),x()]).describe(`Start value`),endValue:A([C(),x()]).optional().describe(`End value for regions`),color:x().optional(),label:J.optional(),style:P([`solid`,`dashed`,`dotted`]).default(`dashed`)})),od=q(()=>k({tooltips:w().default(!0),zoom:w().default(!1),brush:w().default(!1),clickAction:x().optional().describe(`Action ID to trigger on click`)})),sd=q(()=>k({type:nd,title:J.optional().describe(`Chart title`),subtitle:J.optional().describe(`Chart subtitle`),description:J.optional().describe(`Accessibility description`),xAxis:rd.optional().describe(`X-Axis configuration`),yAxis:O(rd).optional().describe(`Y-Axis configuration (support dual axis)`),series:O(id).optional().describe(`Defined series configuration`),colors:O(x()).optional().describe(`Color palette`),height:C().optional().describe(`Fixed height in pixels`),showLegend:w().default(!0).describe(`Display legend`),showDataLabels:w().default(!1).describe(`Display data labels`),annotations:O(ad).optional(),interaction:od.optional(),aria:Y.optional().describe(`ARIA accessibility attributes`)})),cd=P([`xs`,`sm`,`md`,`lg`,`xl`,`2xl`]),ld=q(()=>k({xs:C().min(1).max(12).optional(),sm:C().min(1).max(12).optional(),md:C().min(1).max(12).optional(),lg:C().min(1).max(12).optional(),xl:C().min(1).max(12).optional(),"2xl":C().min(1).max(12).optional()}).describe(`Grid columns per breakpoint (1-12)`)),ud=q(()=>k({xs:C().optional(),sm:C().optional(),md:C().optional(),lg:C().optional(),xl:C().optional(),"2xl":C().optional()}).describe(`Display order per breakpoint`)),dd=q(()=>k({breakpoint:cd.optional().describe(`Minimum breakpoint for visibility`),hiddenOn:O(cd).optional().describe(`Hide on these breakpoints`),columns:ld.optional().describe(`Grid columns per breakpoint`),order:ud.optional().describe(`Display order per breakpoint`)}).describe(`Responsive layout configuration`)),fd=q(()=>k({lazyLoad:w().optional().describe(`Enable lazy loading (defer rendering until visible)`),virtualScroll:k({enabled:w().default(!1).describe(`Enable virtual scrolling`),itemHeight:C().optional().describe(`Fixed item height in pixels (for estimation)`),overscan:C().optional().describe(`Number of extra items to render outside viewport`)}).optional().describe(`Virtual scrolling configuration`),cacheStrategy:P([`none`,`cache-first`,`network-first`,`stale-while-revalidate`]).optional().describe(`Client-side data caching strategy`),prefetch:w().optional().describe(`Prefetch data before component is visible`),pageSize:C().optional().describe(`Number of items per page for pagination`),debounceMs:C().optional().describe(`Debounce interval for user interactions in milliseconds`)}).describe(`Performance optimization configuration`)),pd=q(()=>x().min(2,{message:`System identifier must be at least 2 characters`}).regex(/^[a-z][a-z0-9_.]*$/,{message:`System identifier must be lowercase, starting with a letter, and may contain letters, numbers, underscores, or dots (e.g., "user_profile" or "order.created")`}).describe(`System identifier (lowercase with underscores or dots)`)),X=q(()=>x().min(2,{message:`Identifier must be at least 2 characters`}).regex(/^[a-z][a-z0-9_]*$/,{message:`Identifier must be lowercase snake_case, starting with a letter, and may contain only letters, numbers, and underscores (e.g., "user_profile")`}).describe(`Snake case identifier (lowercase with underscores only)`));q(()=>x().min(3,{message:`Event name must be at least 3 characters`}).regex(/^[a-z][a-z0-9_.]*$/,{message:`Event name must be lowercase with dots for namespacing (e.g., "user.created", "order.paid")`}).describe(`Event name (lowercase with dot notation for namespacing)`));var md=P([`cel`,`js`,`cron`,`template`]),hd=k({rationale:x().optional(),generatedBy:x().optional()}),gd=k({dialect:md,source:x().min(1).optional(),ast:E().optional(),meta:hd.optional()}).refine(e=>e.source!==void 0||e.ast!==void 0,{message:"Expression requires at least one of `source` or `ast`"}),_d=A([x().min(1).transform(e=>({dialect:`cel`,source:e})),gd]);A([x().min(1).transform(e=>({dialect:`cron`,source:e})),gd]),A([x().min(1).transform(e=>({dialect:`template`,source:e})),gd]);var vd=q(()=>k({enabled:w().default(!1).describe(`Enable public sharing`),publicLink:x().optional().describe(`Generated public share URL`),password:x().optional().describe(`Password required to access shared link`),allowedDomains:O(x()).optional().describe(`Restrict access to specific email domains (e.g. ["example.com"])`),expiresAt:x().optional().describe(`Expiration date/time in ISO 8601 format`),allowAnonymous:w().optional().default(!1).describe(`Allow access without authentication`)})),yd=q(()=>k({enabled:w().default(!1).describe(`Enable iframe embedding`),allowedOrigins:O(x()).optional().describe(`Allowed iframe parent origins (e.g. ["https://example.com"])`),width:x().optional().default(`100%`).describe(`Embed width (CSS value)`),height:x().optional().default(`600px`).describe(`Embed height (CSS value)`),showHeader:w().optional().default(!0).describe(`Show interface header in embed`),showNavigation:w().optional().default(!1).describe(`Show navigation in embed`),responsive:w().optional().default(!0).describe(`Enable responsive resizing`)})),bd=k({id:X.describe(`Unique identifier for this navigation item (lowercase snake_case)`),label:J.describe(`Display proper label`),icon:x().optional().describe(`Icon name`),order:C().optional().describe(`Sort order within the same level (lower = first)`),badge:A([x(),C()]).optional().describe(`Badge text or count displayed on the item`),visible:_d.optional().describe('Visibility predicate (CEL). e.g. P`os.user.role == "admin"`'),requiredPermissions:O(x()).optional().describe(`Permissions required to access this item`),requiresObject:x().optional().describe(`Hide/disable this entry unless the named object is registered in the runtime`),requiresService:x().optional().describe(`Hide/disable this entry unless the named kernel service is registered`)}),xd=q(()=>bd.extend({type:F(`object`),objectName:x().describe(`Target object name`),viewName:x().optional().describe(`Default list view to open. Defaults to "all"`)})),Sd=q(()=>bd.extend({type:F(`dashboard`),dashboardName:x().describe(`Target dashboard name`)})),Cd=q(()=>bd.extend({type:F(`page`),pageName:x().describe(`Target custom page component name`),params:N(x(),E()).optional().describe(`Parameters passed to the page context`)})),wd=q(()=>bd.extend({type:F(`url`),url:x().describe(`Target external URL`),target:P([`_self`,`_blank`]).default(`_self`).describe(`Link target window`)})),Td=q(()=>bd.extend({type:F(`report`),reportName:x().describe(`Target report name`)})),Ed=q(()=>bd.extend({type:F(`action`),actionDef:k({actionName:x().describe(`Action machine name to execute`),params:N(x(),E()).optional().describe(`Parameters passed to the action`)}).describe(`Action definition to execute when clicked`)})),Dd=q(()=>bd.extend({type:F(`component`),componentRef:x().describe(`Component registry key (e.g. "metadata:directory")`),params:N(x(),E()).optional().describe(`Props passed to the component`)})),Od=q(()=>bd.extend({type:F(`group`),expanded:w().default(!1).describe(`Default expansion state in sidebar`)})),kd=I(()=>A([xd.extend({children:O(kd).optional().describe(`Child navigation items (e.g. specific views)`)}),Sd,Cd,wd,Td,Ed,Dd,Od.extend({children:O(kd).describe(`Child navigation items`)})])),Ad=q(()=>k({primaryColor:x().optional().describe(`Primary theme color hex code`),logo:x().optional().describe(`Custom logo URL for this app`),favicon:x().optional().describe(`Custom favicon URL for this app`)})),jd=q(()=>k({id:X.describe(`Unique area identifier (lowercase snake_case)`),label:J.describe(`Area display label`),icon:x().optional().describe(`Area icon name`),order:C().optional().describe(`Sort order among areas (lower = first)`),description:J.optional().describe(`Area description`),visible:_d.optional().describe(`Visibility predicate (CEL) for this area.`),requiredPermissions:O(x()).optional().describe(`Permissions required to access this area`),navigation:O(kd).describe(`Navigation items within this area`)}));q(()=>k({name:X.describe(`App unique machine name (lowercase snake_case)`),label:J.describe(`App display label`),version:x().optional().describe(`App version`),description:J.optional().describe(`App description`),icon:x().optional().describe(`App icon used in the App Launcher`),branding:Ad.optional().describe(`App-specific branding`),active:w().optional().default(!0).describe(`Whether the app is enabled`),isDefault:w().optional().default(!1).describe(`Is default app`),navigation:O(kd).optional().describe(`Full navigation tree for the app sidebar`),areas:O(jd).optional().describe(`Navigation areas for partitioning navigation by business domain`),homePageId:x().optional().describe(`ID of the navigation item to serve as landing page`),requiredPermissions:O(x()).optional().describe(`Permissions required to access this app`),objects:O(E()).optional().describe(`Objects belonging to this app`),apis:O(E()).optional().describe(`Custom APIs belonging to this app`),sharing:vd.optional().describe(`Public sharing configuration`),embed:yd.optional().describe(`Iframe embedding configuration`),mobileNavigation:k({mode:P([`drawer`,`bottom_nav`,`hamburger`]).default(`drawer`).describe(`Mobile navigation mode: drawer sidebar, bottom navigation bar, or hamburger menu`),bottomNavItems:O(x()).optional().describe(`Navigation item IDs to show in bottom nav (max 5)`)}).optional().describe(`Mobile-specific navigation configuration`),defaultAgent:X.optional().describe(`Name of the default AI agent for this app (used by the ambient chat endpoint)`),aria:Y.optional().describe(`ARIA accessibility attributes for the application`)}));var Md=q(()=>P([`aes-256-gcm`,`aes-256-cbc`,`chacha20-poly1305`]).describe(`Supported encryption algorithm`)),Nd=q(()=>P([`local`,`aws-kms`,`azure-key-vault`,`gcp-kms`,`hashicorp-vault`]).describe(`Key management service provider`)),Pd=q(()=>k({enabled:w().default(!1).describe(`Enable automatic key rotation`),frequencyDays:C().min(1).default(90).describe(`Rotation frequency in days`),retainOldVersions:C().default(3).describe(`Number of old key versions to retain`),autoRotate:w().default(!0).describe(`Automatically rotate without manual approval`)}).describe(`Policy for automatic encryption key rotation`)),Fd=q(()=>k({enabled:w().default(!1).describe(`Enable field-level encryption`),algorithm:Md.default(`aes-256-gcm`).describe(`Encryption algorithm`),keyManagement:k({provider:Nd.describe(`Key management service provider`),keyId:x().optional().describe(`Key identifier in the provider`),rotationPolicy:Pd.optional().describe(`Key rotation policy`)}).describe(`Key management configuration`),scope:P([`field`,`record`,`table`,`database`]).describe(`Encryption scope level`),deterministicEncryption:w().default(!1).describe(`Allows equality queries on encrypted data`),searchableEncryption:w().default(!1).describe(`Allows search on encrypted data`)}).describe(`Field-level encryption configuration`));q(()=>k({fieldName:x().describe(`Name of the field to encrypt`),encryptionConfig:Fd.describe(`Encryption settings for this field`),indexable:w().default(!1).describe(`Allow indexing on encrypted field`)}).describe(`Per-field encryption assignment`));var Id=q(()=>P([`redact`,`partial`,`hash`,`tokenize`,`randomize`,`nullify`,`substitute`]).describe(`Data masking strategy for PII protection`)),Ld=q(()=>k({field:x().describe(`Field name to apply masking to`),strategy:Id.describe(`Masking strategy to use`),pattern:x().optional().describe(`Regex pattern for partial masking`),preserveFormat:w().default(!0).describe(`Keep the original data format after masking`),preserveLength:w().default(!0).describe(`Keep the original data length after masking`),roles:O(x()).optional().describe(`Roles that see masked data`),exemptRoles:O(x()).optional().describe(`Roles that see unmasked data`)}).describe(`Masking rule for a single field`));q(()=>k({enabled:w().default(!1).describe(`Enable data masking`),rules:O(Ld).describe(`List of field-level masking rules`),auditUnmasking:w().default(!0).describe(`Log when masked data is accessed unmasked`)}).describe(`Top-level data masking configuration for PII protection`));var Rd=P(`text.textarea.email.url.phone.password.markdown.html.richtext.number.currency.percent.date.datetime.time.boolean.toggle.select.multiselect.radio.checkboxes.lookup.master_detail.tree.image.file.avatar.video.audio.formula.summary.autonumber.composite.repeater.location.address.code.json.color.rating.slider.signature.qrcode.progress.tags.vector`.split(`.`)),zd=q(()=>k({label:x().describe(`Display label (human-readable, any case allowed)`),value:pd.describe(`Stored value (lowercase machine identifier)`),color:x().optional().describe(`Color code for badges/charts`),default:w().optional().describe(`Is default option`)}));q(()=>k({latitude:C().min(-90).max(90).describe(`Latitude coordinate`),longitude:C().min(-180).max(180).describe(`Longitude coordinate`),altitude:C().optional().describe(`Altitude in meters`),accuracy:C().optional().describe(`Accuracy in meters`)}));var Bd=q(()=>k({precision:C().int().min(0).max(10).default(2).describe(`Decimal precision (default: 2)`),currencyMode:P([`dynamic`,`fixed`]).default(`dynamic`).describe(`Currency mode: dynamic (user selectable) or fixed (single currency)`),defaultCurrency:x().length(3).default(`CNY`).describe(`Default or fixed currency code (ISO 4217, e.g., USD, CNY, EUR)`)}));q(()=>k({value:C().describe(`Monetary amount`),currency:x().length(3).describe(`Currency code (ISO 4217)`)})),q(()=>k({street:x().optional().describe(`Street address`),city:x().optional().describe(`City name`),state:x().optional().describe(`State/Province`),postalCode:x().optional().describe(`Postal/ZIP code`),country:x().optional().describe(`Country name or code`),countryCode:x().optional().describe(`ISO country code (e.g., US, GB)`),formatted:x().optional().describe(`Formatted address string`)}));var Vd=q(()=>k({dimensions:C().int().min(1).max(1e4).describe(`Vector dimensionality (e.g., 1536 for OpenAI embeddings)`),distanceMetric:P([`cosine`,`euclidean`,`dotProduct`,`manhattan`]).default(`cosine`).describe(`Distance/similarity metric for vector search`),normalized:w().default(!1).describe(`Whether vectors are normalized (unit length)`),indexed:w().default(!0).describe(`Whether to create a vector index for fast similarity search`),indexType:P([`hnsw`,`ivfflat`,`flat`]).optional().describe(`Vector index algorithm (HNSW for high accuracy, IVFFlat for large datasets)`)})),Hd=q(()=>k({minSize:C().min(0).optional().describe(`Minimum file size in bytes`),maxSize:C().min(1).optional().describe(`Maximum file size in bytes (e.g., 10485760 = 10MB)`),allowedTypes:O(x()).optional().describe(`Allowed file extensions (e.g., [".pdf", ".docx", ".jpg"])`),blockedTypes:O(x()).optional().describe(`Blocked file extensions (e.g., [".exe", ".bat", ".sh"])`),allowedMimeTypes:O(x()).optional().describe(`Allowed MIME types (e.g., ["image/jpeg", "application/pdf"])`),blockedMimeTypes:O(x()).optional().describe(`Blocked MIME types`),virusScan:w().default(!1).describe(`Enable virus scanning for uploaded files`),virusScanProvider:P([`clamav`,`virustotal`,`metadefender`,`custom`]).optional().describe(`Virus scanning service provider`),virusScanOnUpload:w().default(!0).describe(`Scan files immediately on upload`),quarantineOnThreat:w().default(!0).describe(`Quarantine files if threat detected`),storageProvider:x().optional().describe(`Object storage provider name (references ObjectStorageConfig)`),storageBucket:x().optional().describe(`Target bucket name`),storagePrefix:x().optional().describe(`Storage path prefix (e.g., "uploads/documents/")`),imageValidation:k({minWidth:C().min(1).optional().describe(`Minimum image width in pixels`),maxWidth:C().min(1).optional().describe(`Maximum image width in pixels`),minHeight:C().min(1).optional().describe(`Minimum image height in pixels`),maxHeight:C().min(1).optional().describe(`Maximum image height in pixels`),aspectRatio:x().optional().describe(`Required aspect ratio (e.g., "16:9", "1:1")`),generateThumbnails:w().default(!1).describe(`Auto-generate thumbnails`),thumbnailSizes:O(k({name:x().describe(`Thumbnail variant name (e.g., "small", "medium", "large")`),width:C().min(1).describe(`Thumbnail width in pixels`),height:C().min(1).describe(`Thumbnail height in pixels`),crop:w().default(!1).describe(`Crop to exact dimensions`)})).optional().describe(`Thumbnail size configurations`),preserveMetadata:w().default(!1).describe(`Preserve EXIF metadata`),autoRotate:w().default(!0).describe(`Auto-rotate based on EXIF orientation`)}).optional().describe(`Image-specific validation rules`),allowMultiple:w().default(!1).describe(`Allow multiple file uploads (overrides field.multiple)`),allowReplace:w().default(!0).describe(`Allow replacing existing files`),allowDelete:w().default(!0).describe(`Allow deleting uploaded files`),requireUpload:w().default(!1).describe(`Require at least one file when field is required`),extractMetadata:w().default(!0).describe(`Extract file metadata (name, size, type, etc.)`),extractText:w().default(!1).describe(`Extract text content from documents (OCR/parsing)`),versioningEnabled:w().default(!1).describe(`Keep previous versions of replaced files`),maxVersions:C().min(1).optional().describe(`Maximum number of versions to retain`),publicRead:w().default(!1).describe(`Allow public read access to uploaded files`),presignedUrlExpiry:C().min(60).max(604800).default(3600).describe(`Presigned URL expiration in seconds (default: 1 hour)`)}).refine(e=>!(e.minSize!==void 0&&e.maxSize!==void 0&&e.minSize>e.maxSize),{message:`minSize must be less than or equal to maxSize`}).refine(e=>!(e.virusScanProvider!==void 0&&e.virusScan!==!0),{message:`virusScanProvider requires virusScan to be enabled`})),Ud=q(()=>k({uniqueness:w().default(!1).describe(`Enforce unique values across all records`),completeness:C().min(0).max(1).default(0).describe(`Minimum ratio of non-null values (0-1, default: 0 = no requirement)`),accuracy:k({source:x().describe(`Reference data source for validation (e.g., "api.verify.com", "master_data")`),threshold:C().min(0).max(1).describe(`Minimum accuracy threshold (0-1, e.g., 0.95 = 95% match required)`)}).optional().describe(`Accuracy validation configuration`)})),Wd=q(()=>k({enabled:w().describe(`Enable caching for computed field results`),ttl:C().min(0).describe(`Cache TTL in seconds (0 = no expiration)`),invalidateOn:O(x()).describe(`Field paths that invalidate cache (e.g., ["inventory.quantity", "pricing.base_price"])`)})),Gd=q(()=>k({name:x().regex(/^[a-z_][a-z0-9_]*$/).describe(`Machine name (snake_case)`).optional(),label:x().optional().describe(`Human readable label`),type:Rd.describe(`Field Data Type`),description:x().optional().describe(`Tooltip/Help text`),format:x().optional().describe(`Format string (e.g. email, phone)`),columnName:x().optional().describe(`Physical column name in the target datasource. Defaults to the field key when not set.`),required:w().default(!1).describe(`Is required`),searchable:w().default(!1).describe(`Is searchable`),multiple:w().default(!1).describe(`Allow multiple values (Stores as Array/JSON). Applicable for select, lookup, file, image.`),unique:w().default(!1).describe(`Is unique constraint`),defaultValue:E().optional().describe(`Default value`),maxLength:C().optional().describe(`Max character length`),minLength:C().optional().describe(`Min character length`),precision:C().optional().describe(`Total digits`),scale:C().optional().describe(`Decimal places`),min:C().optional().describe(`Minimum value`),max:C().optional().describe(`Maximum value`),options:O(zd).optional().describe(`Static options for select/multiselect`),reference:x().optional().describe(`Target object name (snake_case) for lookup/master_detail fields. Required for relationship types. Used by $expand to resolve foreign key IDs into full objects.`),referenceFilters:O(x()).optional().describe(`Filters applied to lookup dialogs (e.g. "active = true")`),writeRequiresMasterRead:w().optional().describe(`If true, user needs read access to master record to edit this field`),deleteBehavior:P([`set_null`,`cascade`,`restrict`]).optional().default(`set_null`).describe(`What happens if referenced record is deleted`),expression:_d.optional().describe("Formula expression (CEL). e.g. F`record.amount * 0.1`"),summaryOperations:k({object:x().describe(`Source child object name for roll-up`),field:x().describe(`Field on child object to aggregate`),function:P([`count`,`sum`,`min`,`max`,`avg`]).describe(`Aggregation function to apply`)}).optional().describe(`Roll-up summary definition`),language:x().optional().describe(`Programming language for syntax highlighting (e.g., javascript, python, sql)`),theme:x().optional().describe(`Code editor theme (e.g., dark, light, monokai)`),lineNumbers:w().optional().describe(`Show line numbers in code editor`),maxRating:C().optional().describe(`Maximum rating value (default: 5)`),allowHalf:w().optional().describe(`Allow half-star ratings`),displayMap:w().optional().describe(`Display map widget for location field`),allowGeocoding:w().optional().describe(`Allow address-to-coordinate conversion`),addressFormat:P([`us`,`uk`,`international`]).optional().describe(`Address format template`),colorFormat:P([`hex`,`rgb`,`rgba`,`hsl`]).optional().describe(`Color value format`),allowAlpha:w().optional().describe(`Allow transparency/alpha channel`),presetColors:O(x()).optional().describe(`Preset color options`),step:C().optional().describe(`Step increment for slider (default: 1)`),showValue:w().optional().describe(`Display current value on slider`),marks:N(x(),x()).optional().describe(`Custom marks/labels at specific values (e.g., {0: "Low", 50: "Medium", 100: "High"})`),barcodeFormat:P([`qr`,`ean13`,`ean8`,`code128`,`code39`,`upca`,`upce`]).optional().describe(`Barcode format type`),qrErrorCorrection:P([`L`,`M`,`Q`,`H`]).optional().describe(`QR code error correction level (L=7%, M=15%, Q=25%, H=30%). Only applicable when barcodeFormat is "qr"`),displayValue:w().optional().describe(`Display human-readable value below barcode/QR code`),allowScanning:w().optional().describe(`Enable camera scanning for barcode/QR code input`),currencyConfig:Bd.optional().describe(`Configuration for currency field type`),vectorConfig:Vd.optional().describe(`Configuration for vector field type (AI/ML embeddings)`),fileAttachmentConfig:Hd.optional().describe(`Configuration for file and attachment field types`),encryptionConfig:Fd.optional().describe(`Field-level encryption configuration for sensitive data (GDPR/HIPAA/PCI-DSS)`),maskingRule:Ld.optional().describe(`Data masking rules for PII protection`),auditTrail:w().default(!1).describe(`Enable detailed audit trail for this field (tracks all changes with user and timestamp)`),dependencies:O(x()).optional().describe(`Array of field names that this field depends on (for formulas, visibility rules, etc.)`),cached:Wd.optional().describe(`Caching configuration for computed/formula fields`),dataQuality:Ud.optional().describe(`Data quality validation and monitoring rules`),group:x().optional().describe(`Field group name for organizing fields in forms and layouts (e.g., "contact_info", "billing", "system")`),conditionalRequired:_d.optional().describe("Predicate (CEL) — field is required when TRUE. e.g. P`record.status == 'closed_won'`"),hidden:w().default(!1).describe(`Hidden from default UI`),readonly:w().default(!1).describe(`Read-only in UI`),system:w().optional().describe(`Auto-injected system/audit field (e.g. created_at, updated_by, organization_id). Tools that surface system fields separately from author-declared business fields should branch on this flag.`),sortable:w().optional().default(!0).describe(`Whether field is sortable in list views`),inlineHelpText:x().optional().describe(`Help text displayed below the field in forms`),trackFeedHistory:w().optional().describe(`Track field changes in Chatter/activity feed (Salesforce pattern)`),caseSensitive:w().optional().describe(`Whether text comparisons are case-sensitive`),autonumberFormat:x().optional().describe(`Auto-number display format pattern (e.g., "CASE-{0000}")`),index:w().default(!1).describe(`Create standard database index`),externalId:w().default(!1).describe(`Is external ID for upsert operations`)})),Kd=P([`GET`,`POST`,`PUT`,`DELETE`,`PATCH`,`HEAD`,`OPTIONS`]),qd=q(()=>P([`GET`,`POST`,`PUT`,`PATCH`,`DELETE`])),Jd=q(()=>k({url:x().describe(`API endpoint URL`),method:qd.optional().default(`GET`).describe(`HTTP method`),headers:N(x(),x()).optional().describe(`Custom HTTP headers`),params:N(x(),E()).optional().describe(`Query parameters`),body:E().optional().describe(`Request body for POST/PUT/PATCH`)}));q(()=>k({enabled:w().default(!0).describe(`Enable CORS`),origins:A([x(),O(x())]).default(`*`).describe(`Allowed origins (* for all)`),methods:O(Kd).optional().describe(`Allowed HTTP methods`),credentials:w().default(!1).describe(`Allow credentials (cookies, authorization headers)`),maxAge:C().int().optional().describe(`Preflight cache duration in seconds`)})),q(()=>k({enabled:w().default(!1).describe(`Enable rate limiting`),windowMs:C().int().default(6e4).describe(`Time window in milliseconds`),maxRequests:C().int().default(100).describe(`Max requests per window`)})),q(()=>k({path:x().describe(`URL path to serve from`),directory:x().describe(`Physical directory to serve`),cacheControl:x().optional().describe(`Cache-Control header value`)}));var Yd=q(()=>j(`provider`,[k({provider:F(`object`),object:x().describe(`Target object name`)}),k({provider:F(`api`),read:Jd.optional().describe(`Configuration for fetching data`),write:Jd.optional().describe(`Configuration for submitting data (for forms/editable tables)`)}),k({provider:F(`value`),items:O(E()).describe(`Static data array`)}),k({provider:F(`schema`),schemaId:x().describe(`Schema identifier — typically the metadata type name`),schema:N(x(),E()).optional().describe(`Inline JSON Schema (Draft 2020-12). Optional when schemaId is resolvable.`)})])),Xd=q(()=>k({field:x().describe(`Field name to filter on`),operator:x().describe(`Filter operator (e.g. equals, not_equals, contains, this_quarter)`),value:A([x(),C(),w(),ho(),O(A([x(),C()]))]).optional().describe(`Filter value`)}).describe(`View filter rule`)),Zd=q(()=>P([`none`,`count`,`count_empty`,`count_filled`,`count_unique`,`percent_empty`,`percent_filled`,`sum`,`avg`,`min`,`max`]).describe(`Aggregation function for column footer summary`)),Qd=q(()=>k({field:x().describe(`Field name (snake_case)`),label:J.optional().describe(`Display label override`),width:C().positive().optional().describe(`Column width in pixels`),align:P([`left`,`center`,`right`]).optional().describe(`Text alignment`),hidden:w().optional().describe(`Hide column by default`),sortable:w().optional().describe(`Allow sorting by this column`),resizable:w().optional().describe(`Allow resizing this column`),wrap:w().optional().describe(`Allow text wrapping`),type:x().optional().describe(`Renderer type override (e.g., "currency", "date")`),pinned:P([`left`,`right`]).optional().describe(`Pin/freeze column to left or right side`),summary:Zd.optional().describe(`Footer aggregation function for this column`),link:w().optional().describe(`Functions as the primary navigation link (triggers View navigation)`),action:x().optional().describe(`Registered Action ID to execute when clicked`)})),$d=q(()=>k({type:P([`none`,`single`,`multiple`]).default(`none`).describe(`Selection mode`)})),ef=q(()=>k({pageSize:C().int().positive().default(25).describe(`Number of records per page`),pageSizeOptions:O(C().int().positive()).optional().describe(`Available page size options`)})),tf=q(()=>P([`compact`,`short`,`medium`,`tall`,`extra_tall`]).describe(`Row height / density setting for list view`)),nf=q(()=>k({field:x().describe(`Field name to group by`),order:P([`asc`,`desc`]).default(`asc`).describe(`Group sort order`),collapsed:w().default(!1).describe(`Collapse groups by default`)})),rf=q(()=>k({fields:O(nf).min(1).describe(`Fields to group by (supports up to 3 levels)`)}).describe(`Record grouping configuration`)),af=q(()=>k({coverField:x().optional().describe(`Attachment/image field to display as card cover`),coverFit:P([`cover`,`contain`]).default(`cover`).describe(`Image fit mode for card cover`),cardSize:P([`small`,`medium`,`large`]).default(`medium`).describe(`Card size in gallery view`),titleField:x().optional().describe(`Field to display as card title`),visibleFields:O(x()).optional().describe(`Fields to display on card body`)}).describe(`Gallery/card view configuration`)),of=q(()=>k({startDateField:x().describe(`Field for timeline item start date`),endDateField:x().optional().describe(`Field for timeline item end date`),titleField:x().describe(`Field to display as timeline item title`),groupByField:x().optional().describe(`Field to group timeline rows`),colorField:x().optional().describe(`Field to determine item color`),scale:P([`hour`,`day`,`week`,`month`,`quarter`,`year`]).default(`week`).describe(`Default timeline scale`)}).describe(`Timeline view configuration`)),sf=q(()=>k({type:P([`personal`,`collaborative`]).default(`collaborative`).describe(`View ownership type`),lockedBy:x().optional().describe(`User who locked the view configuration`)}).describe(`View sharing and access configuration`)),cf=q(()=>k({field:x().describe(`Field to derive color from (typically a select/status field)`),colors:N(x(),x()).optional().describe(`Map of field value to color (hex/token)`)}).describe(`Row color configuration based on field values`)),lf=q(()=>P([`grid`,`kanban`,`gallery`,`calendar`,`timeline`,`gantt`,`map`]).describe(`Visualization type that users can switch to`)),uf=q(()=>k({sort:w().default(!0).describe(`Allow users to sort records`),search:w().default(!0).describe(`Allow users to search records`),filter:w().default(!0).describe(`Allow users to filter records`),rowHeight:w().default(!0).describe(`Allow users to toggle row height/density`),addRecordForm:w().default(!1).describe(`Add records through a form instead of inline`),buttons:O(x()).optional().describe(`Custom action button IDs to show in the toolbar`)}).describe(`User action toggles for the view toolbar`)),df=q(()=>k({showDescription:w().default(!0).describe(`Show the view description text`),allowedVisualizations:O(lf).optional().describe(`Whitelist of visualization types users can switch between (e.g. ["grid", "gallery", "kanban"])`)}).describe(`Appearance and visualization configuration`)),ff=q(()=>k({name:X.describe(`Tab identifier (snake_case)`),label:J.optional().describe(`Display label`),icon:x().optional().describe(`Tab icon name`),view:x().optional().describe(`Referenced list view name from listViews`),filter:O(Xd).optional().describe(`Tab-specific filter criteria`),order:C().int().min(0).optional().describe(`Tab display order`),pinned:w().default(!1).describe(`Pin tab (cannot be removed by users)`),isDefault:w().default(!1).describe(`Set as the default active tab`),visible:w().default(!0).describe(`Tab visibility`)}).describe(`Tab configuration for multi-tab view interface`)),pf=q(()=>k({enabled:w().default(!0).describe(`Show the add record entry point`),position:P([`top`,`bottom`,`both`]).default(`bottom`).describe(`Position of the add record button`),mode:P([`inline`,`form`,`modal`]).default(`inline`).describe(`How to add a new record`),formView:x().optional().describe(`Named form view to use when mode is "form" or "modal"`)}).describe(`Add record entry point configuration`)),mf=q(()=>k({groupByField:x().describe(`Field to group columns by (usually status/select)`),summarizeField:x().optional().describe(`Field to sum at top of column (e.g. amount)`),columns:O(x()).describe(`Fields to show on cards`)})),hf=q(()=>k({chartType:P([`bar`,`line`,`pie`,`area`,`scatter`]).default(`bar`).describe(`Chart visualisation type`),xAxisField:x().describe(`Field used as the X axis / category dimension`),yAxisFields:O(x()).min(1).describe(`Field(s) used as the Y axis / measures`),aggregation:P([`sum`,`avg`,`count`,`min`,`max`]).optional().describe(`Aggregation function applied to Y axis fields`),groupByField:x().optional().describe(`Optional field used to split / stack the chart`)}).describe(`List chart view configuration`)),gf=q(()=>k({startDateField:x(),endDateField:x().optional(),titleField:x(),colorField:x().optional()})),_f=q(()=>k({startDateField:x(),endDateField:x(),titleField:x(),progressField:x().optional(),dependenciesField:x().optional()})),vf=q(()=>P([`page`,`drawer`,`modal`,`split`,`popover`,`new_window`,`none`])),yf=q(()=>k({mode:vf.default(`page`),view:x().optional().describe(`Name of the form view to use for details (e.g. "summary_view", "edit_form")`),preventNavigation:w().default(!1).describe(`Disable standard navigation entirely`),openNewTab:w().default(!1).describe(`Force open in new tab (applies to page mode)`),width:A([x(),C()]).optional().describe(`Width of the drawer/modal (e.g. "600px", "50%")`)})),bf=q(()=>k({name:X.optional().describe(`Internal view name (lowercase snake_case)`),label:J.optional(),type:P([`grid`,`kanban`,`gallery`,`calendar`,`timeline`,`gantt`,`map`,`chart`]).default(`grid`),data:Yd.optional().describe(`Data source configuration (defaults to "object" provider)`),columns:A([O(x()),O(Qd)]).describe(`Fields to display as columns`),filter:O(Xd).optional().describe(`Filter criteria (JSON Rules)`),sort:A([x(),O(k({field:x(),order:P([`asc`,`desc`])}))]).optional(),searchableFields:O(x()).optional().describe(`Fields enabled for search`),filterableFields:O(x()).optional().describe(`Fields enabled for end-user filtering in the top bar`),resizable:w().optional().describe(`Enable column resizing`),striped:w().optional().describe(`Striped row styling`),bordered:w().optional().describe(`Show borders`),compactToolbar:w().optional().describe(`Collapse Group/Color/Density/Hide-fields into a single View settings popover`),selection:$d.optional().describe(`Row selection configuration`),navigation:yf.optional().describe(`Configuration for item click navigation (page, drawer, modal, etc.)`),pagination:ef.optional().describe(`Pagination configuration`),kanban:mf.optional(),calendar:gf.optional(),gantt:_f.optional(),gallery:af.optional(),timeline:of.optional(),chart:hf.optional(),description:J.optional().describe(`View description for documentation/tooltips`),sharing:sf.optional().describe(`View sharing and access configuration`),rowHeight:tf.optional().describe(`Row height / density setting`),grouping:rf.optional().describe(`Group records by one or more fields`),rowColor:cf.optional().describe(`Color rows based on field value`),hiddenFields:O(x()).optional().describe(`Fields to hide in this specific view`),fieldOrder:O(x()).optional().describe(`Explicit field display order for this view`),rowActions:O(x()).optional().describe(`Actions available for individual row items`),bulkActions:O(x()).optional().describe(`Actions available when multiple rows are selected`),bulkActionDefs:O(N(x(),T())).optional().describe(`Rich bulk action definitions (schema-driven, executed via BulkActionDialog)`),virtualScroll:w().optional().describe(`Enable virtual scrolling for large datasets`),conditionalFormatting:O(k({condition:_d.describe(`Predicate (CEL) to evaluate.`),style:N(x(),x()).describe(`CSS styles to apply when condition is true`)})).optional().describe(`Conditional formatting rules for list rows`),inlineEdit:w().optional().describe(`Allow inline editing of records directly in the list view`),exportOptions:O(P([`csv`,`xlsx`,`pdf`,`json`])).optional().describe(`Available export format options`),userActions:uf.optional().describe(`User action toggles for the view toolbar`),appearance:df.optional().describe(`Appearance and visualization configuration`),tabs:O(ff).optional().describe(`Tab definitions for multi-tab view interface`),addRecord:pf.optional().describe(`Add record entry point configuration`),showRecordCount:w().optional().describe(`Show record count at the bottom of the list`),allowPrinting:w().optional().describe(`Allow users to print the view`),emptyState:k({title:J.optional(),message:J.optional(),icon:x().optional()}).optional().describe(`Empty state configuration when no records found`),aria:Y.optional().describe(`ARIA accessibility attributes for the list view`),responsive:dd.optional().describe(`Responsive layout configuration`),performance:fd.optional().describe(`Performance optimization settings`)})),xf=q(()=>k({field:x().describe(`Field name (snake_case)`),type:Rd.optional().describe(`Field type (auto-infers widget if omitted)`),options:O(zd).optional().describe(`Options for select/multiselect/radio/checkboxes fields`),reference:x().optional().describe(`Target object name for lookup/master_detail fields`),maxLength:C().optional().describe(`Maximum character length (for text/textarea/email/url/phone)`),minLength:C().optional().describe(`Minimum character length`),min:C().optional().describe(`Minimum value (for number/currency/percent/slider)`),max:C().optional().describe(`Maximum value`),precision:C().optional().describe(`Total digits (for number/currency)`),scale:C().optional().describe(`Decimal places`),multiple:w().optional().describe(`Allow multiple values (for select/lookup/file/image)`),label:J.optional().describe(`Display label override`),placeholder:J.optional().describe(`Placeholder text`),helpText:J.optional().describe(`Help/hint text`),readonly:w().optional().describe(`Read-only override`),immutable:w().optional().describe(`Editable on create, locked once the record exists (e.g. machine names).`),required:w().optional().describe(`Required override`),hidden:w().optional().describe(`Hidden override`),colSpan:C().int().min(1).max(4).optional().describe(`Column span in grid layout (1-4)`),widget:x().optional().describe(`Custom widget/component name (overrides type-based inference)`),language:x().optional().describe(`Code editor language (for type=code)`),fields:O(I(()=>xf)).optional().describe(`Sub-fields for composite/repeater types`),dependsOn:x().optional().describe(`Parent field name for cascading`),visibleOn:_d.optional().describe(`Visibility predicate (CEL).`)})),Sf=q(()=>k({label:J.optional(),description:x().optional().describe(`Optional description rendered under the section header.`),collapsible:w().default(!1),collapsed:w().default(!1),visibleOn:_d.optional().describe(`Visibility predicate (CEL). Hides the whole section when false.`),columns:A([P([`1`,`2`,`3`,`4`]),F(1),F(2),F(3),F(4)]).default(1).transform(e=>typeof e==`string`?parseInt(e):e),fields:O(A([x(),xf]))})),Cf=q(()=>k({type:P([`simple`,`tabbed`,`wizard`,`split`,`drawer`,`modal`]).default(`simple`),data:Yd.optional().describe(`Data source configuration (defaults to "object" provider)`),sections:O(Sf).optional(),groups:O(Sf).optional(),defaultSort:O(k({field:x().describe(`Field name to sort by`),order:P([`asc`,`desc`]).default(`desc`).describe(`Sort direction`)})).optional().describe(`Default sort order for related list views within this form`),sharing:vd.optional().describe(`Public sharing configuration for this form`),submitBehavior:A([k({kind:F(`thank-you`),title:x().optional(),message:x().optional()}),k({kind:F(`redirect`),url:x(),delayMs:C().int().min(0).optional()}),k({kind:F(`continue`)}),k({kind:F(`next-record`)})]).optional().describe(`Post-submit behavior`),aria:Y.optional().describe(`ARIA accessibility attributes for the form view`)}));q(()=>k({list:bf.optional(),form:Cf.optional(),listViews:N(x(),bf).optional().describe(`Additional named list views`),formViews:N(x(),Cf).optional().describe(`Additional named form views`)}));function wf(e){let{schemaId:t,...n}=e;return Cf.parse({...n,data:{provider:`schema`,schemaId:t}})}var Z=q(()=>k({$field:x().describe(`Field Reference/Column Name`)}));q(()=>k({$eq:T().optional(),$ne:T().optional()})),q(()=>k({$gt:A([C(),D(),Z]).optional(),$gte:A([C(),D(),Z]).optional(),$lt:A([C(),D(),Z]).optional(),$lte:A([C(),D(),Z]).optional()})),q(()=>k({$in:O(T()).optional(),$nin:O(T()).optional()})),q(()=>k({$between:M([A([C(),D(),Z]),A([C(),D(),Z])]).optional()})),q(()=>k({$contains:x().optional(),$notContains:x().optional(),$startsWith:x().optional(),$endsWith:x().optional()})),q(()=>k({$null:w().optional(),$exists:w().optional()}));var Tf=q(()=>k({$eq:T().optional(),$ne:T().optional(),$gt:A([C(),D(),Z]).optional(),$gte:A([C(),D(),Z]).optional(),$lt:A([C(),D(),Z]).optional(),$lte:A([C(),D(),Z]).optional(),$in:O(T()).optional(),$nin:O(T()).optional(),$between:M([A([C(),D(),Z]),A([C(),D(),Z])]).optional(),$contains:x().optional(),$notContains:x().optional(),$startsWith:x().optional(),$endsWith:x().optional(),$null:w().optional(),$exists:w().optional()})),Q=I(()=>N(x(),E()).and(k({$and:O(Q).optional(),$or:O(Q).optional(),$not:Q.optional()})));q(()=>k({where:Q.optional()}));var Ef=I(()=>k({$and:O(A([N(x(),Tf),Ef])).optional(),$or:O(A([N(x(),Tf),Ef])).optional(),$not:A([N(x(),Tf),Ef]).optional()})),Df=q(()=>k({field:x(),order:P([`asc`,`desc`]).default(`asc`)})),Of=P([`count`,`sum`,`avg`,`min`,`max`,`count_distinct`,`array_agg`,`string_agg`]),kf=P([`day`,`week`,`month`,`quarter`,`year`]),Af=q(()=>A([x(),k({field:x().describe(`Field to group by`),dateGranularity:kf.optional().describe(`Bucket date values into uniform periods (day/week/month/quarter/year)`),alias:x().optional().describe(`Alias for the projected group value`)})])),jf=q(()=>k({function:Of.describe(`Aggregation function`),field:x().optional().describe(`Field to aggregate (optional for COUNT(*))`),alias:x().describe(`Result column alias`),distinct:w().optional().describe(`Apply DISTINCT before aggregation`),filter:Q.optional().describe(`Filter/Condition to apply to the aggregation (FILTER WHERE clause)`)})),Mf=P([`inner`,`left`,`right`,`full`]),Nf=P([`auto`,`database`,`hash`,`loop`]),Pf=I(()=>k({type:Mf.describe(`Join type`),strategy:Nf.optional().describe(`Execution strategy hint`),object:x().describe(`Object/table to join`),alias:x().optional().describe(`Table alias`),on:Q.describe(`Join condition`),subquery:I(()=>Vf).optional().describe(`Subquery instead of object`)})),Ff=P([`row_number`,`rank`,`dense_rank`,`percent_rank`,`lag`,`lead`,`first_value`,`last_value`,`sum`,`avg`,`count`,`min`,`max`]),If=q(()=>k({partitionBy:O(x()).optional().describe(`PARTITION BY fields`),orderBy:O(Df).optional().describe(`ORDER BY specification`),frame:k({type:P([`rows`,`range`]).optional(),start:x().optional().describe(`Frame start (e.g., "UNBOUNDED PRECEDING", "1 PRECEDING")`),end:x().optional().describe(`Frame end (e.g., "CURRENT ROW", "1 FOLLOWING")`)}).optional().describe(`Window frame specification`)})),Lf=q(()=>k({function:Ff.describe(`Window function name`),field:x().optional().describe(`Field to operate on (for aggregate window functions)`),alias:x().describe(`Result column alias`),over:If.describe(`Window specification (OVER clause)`)})),Rf=I(()=>A([x(),k({field:x(),fields:O(Rf).optional(),alias:x().optional()})])),zf=q(()=>k({query:x().describe(`Search query text`),fields:O(x()).optional().describe(`Fields to search in (if not specified, searches all text fields)`),fuzzy:w().optional().default(!1).describe(`Enable fuzzy matching (tolerates typos)`),operator:P([`and`,`or`]).optional().default(`or`).describe(`Logical operator between terms`),boost:N(x(),C()).optional().describe(`Field-specific relevance boosting (field name -> boost factor)`),minScore:C().optional().describe(`Minimum relevance score threshold`),language:x().optional().describe(`Language for text analysis (e.g., "en", "zh", "es")`),highlight:w().optional().default(!1).describe(`Enable search result highlighting`)})),Bf=k({object:x().describe(`Object name (e.g. account)`),fields:O(Rf).optional().describe(`Fields to retrieve`),where:Q.optional().describe(`Filtering criteria (WHERE)`),search:zf.optional().describe(`Full-text search configuration ($search parameter)`),orderBy:O(Df).optional().describe(`Sorting instructions (ORDER BY)`),limit:C().optional().describe(`Max records to return (LIMIT)`),offset:C().optional().describe(`Records to skip (OFFSET)`),top:C().optional().describe(`Alias for limit (OData compatibility)`),cursor:N(x(),E()).optional().describe(`Cursor for keyset pagination`),joins:O(Pf).optional().describe(`Explicit Table Joins`),aggregations:O(jf).optional().describe(`Aggregation functions`),groupBy:O(Af).optional().describe("GROUP BY targets (strings or `{field, dateGranularity?}` objects for date bucketing)"),having:Q.optional().describe(`HAVING clause for aggregation filtering`),windowFunctions:O(Lf).optional().describe(`Window functions with OVER clause`),distinct:w().optional().describe(`SELECT DISTINCT flag`)}),Vf=q(()=>Bf.extend({expand:I(()=>N(x(),Vf)).optional().describe(`Recursive relation loading map. Keys are lookup/master_detail field names; values are nested QueryAST objects that control select, filter, sort, and further expansion on the related object. The engine resolves expand via batch $in queries (driver-agnostic) with a default max depth of 3.`)})),Hf=q(()=>P([`default`,`blue`,`teal`,`orange`,`purple`,`success`,`warning`,`danger`]).describe(`Widget color variant`)),Uf=q(()=>P([`script`,`url`,`modal`,`flow`,`api`]).describe(`Widget action type`)),Wf=q(()=>k({label:J.describe(`Action button label`),actionUrl:x().describe(`URL or target for the action`),actionType:Uf.optional().describe(`Type of action`),icon:x().optional().describe(`Icon identifier for the action button`)}).describe(`Dashboard header action`)),Gf=q(()=>k({showTitle:w().default(!0).describe(`Show dashboard title in header`),showDescription:w().default(!0).describe(`Show dashboard description in header`),actions:O(Wf).optional().describe(`Header action buttons`)}).describe(`Dashboard header configuration`)),Kf=q(()=>k({valueField:x().describe(`Field to aggregate`),aggregate:P([`count`,`sum`,`avg`,`min`,`max`]).default(`count`).describe(`Aggregate function`),label:J.optional().describe(`Measure display label`),format:x().optional().describe(`Number format string`)}).describe(`Widget measure definition`)),qf=q(()=>k({id:X.describe(`Unique widget identifier (snake_case)`),title:J.optional().describe(`Widget title`),description:J.optional().describe(`Widget description text below the header`),type:nd.default(`metric`).describe(`Visualization type`),chartConfig:sd.optional().describe(`Chart visualization configuration`),colorVariant:Hf.optional().describe(`Widget color variant for theming`),requiresObject:x().optional().describe(`Hide the widget unless the named object is registered`),requiresService:x().optional().describe(`Hide the widget unless the named kernel service is registered`),actionUrl:x().optional().describe(`URL or target for the widget action button`),actionType:Uf.optional().describe(`Type of action for the widget action button`),actionIcon:x().optional().describe(`Icon identifier for the widget action button`),object:x().optional().describe(`Data source object name`),filter:Q.optional().describe(`Data filter criteria`),compareTo:A([F(`previousPeriod`),F(`previousYear`),k({offset:x().regex(/^\d+[dwMy]$/,`Offset must match <N>(d|w|M|y), e.g. "7d", "1M", "1y"`)})]).optional().describe(`Period-over-period comparison window`),categoryField:x().optional().describe(`Field for grouping (X-Axis)`),categoryGranularity:kf.optional().describe(`Bucket categoryField date values into day/week/month/quarter/year periods`),valueField:x().optional().describe(`Field for values (Y-Axis)`),aggregate:P([`count`,`sum`,`avg`,`min`,`max`]).optional().default(`count`).describe(`Aggregate function`),measures:O(Kf).optional().describe(`Multiple measures for pivot/matrix analysis`),layout:k({x:C(),y:C(),w:C(),h:C()}).describe(`Grid layout position`),options:E().optional().describe(`Widget specific configuration`),responsive:dd.optional().describe(`Responsive layout configuration`),aria:Y.optional().describe(`ARIA accessibility attributes`)})),Jf=q(()=>k({object:x().describe(`Source object name`),valueField:x().describe(`Field to use as option value`),labelField:x().describe(`Field to use as option label`),filter:Q.optional().describe(`Filter to apply to source object`)}).describe(`Dynamic filter options from object`)),Yf=q(()=>k({field:x().describe(`Field name to filter on`),label:J.optional().describe(`Display label for the filter`),type:P([`text`,`select`,`date`,`number`,`lookup`]).optional().describe(`Filter input type`),options:O(k({value:A([x(),C(),w()]).describe(`Option value`),label:J})).optional().describe(`Static filter options`),optionsFrom:Jf.optional().describe(`Dynamic filter options from object`),defaultValue:A([x(),C(),w()]).optional().describe(`Default filter value`),scope:P([`dashboard`,`widget`]).default(`dashboard`).describe(`Filter application scope`),targetWidgets:O(x()).optional().describe(`Widget IDs to apply this filter to`)}));q(()=>k({name:X.describe(`Dashboard unique name`),label:J.describe(`Dashboard label`),description:J.optional().describe(`Dashboard description`),header:Gf.optional().describe(`Dashboard header configuration`),widgets:O(qf).describe(`Widgets to display`),columns:C().int().min(1).max(24).optional().describe(`Number of grid columns (default 12)`),gap:C().int().min(0).optional().describe(`Grid gap in Tailwind spacing units`),refreshInterval:C().optional().describe(`Auto-refresh interval in seconds`),dateRange:k({field:x().optional().describe(`Default date field name for time-based filtering`),defaultRange:P([`today`,`yesterday`,`this_week`,`last_week`,`this_month`,`last_month`,`this_quarter`,`last_quarter`,`this_year`,`last_year`,`last_7_days`,`last_30_days`,`last_90_days`,`custom`]).default(`this_month`).describe(`Default date range preset`),allowCustomRange:w().default(!0).describe(`Allow users to pick a custom date range`)}).optional().describe(`Global dashboard date range filter configuration`),globalFilters:O(Yf).optional().describe(`Global filters that apply to all widgets in the dashboard`),aria:Y.optional().describe(`ARIA accessibility attributes`),performance:fd.optional().describe(`Performance optimization settings`)}));var Xf=P([`tabular`,`summary`,`matrix`,`joined`]),Zf=q(()=>k({field:x().describe(`Field name`),label:J.optional().describe(`Override label`),aggregate:P([`sum`,`avg`,`max`,`min`,`count`,`unique`]).optional().describe(`Aggregation function`),responsive:dd.optional().describe(`Responsive visibility for this column`)})),Qf=q(()=>k({field:x().describe(`Field to group by`),sortOrder:P([`asc`,`desc`]).default(`asc`),dateGranularity:P([`day`,`week`,`month`,`quarter`,`year`]).optional().describe(`For date fields`)})),$f=q(()=>sd.extend({xAxis:x().describe(`Grouping field for X-Axis`),yAxis:x().describe(`Summary field for Y-Axis`),groupBy:x().optional().describe(`Additional grouping field`)})),ep=q(()=>k({name:X,label:J.optional(),description:J.optional(),type:P([`tabular`,`summary`,`matrix`]).default(`tabular`),objectName:x().optional(),columns:O(Zf),groupingsDown:O(Qf).optional(),groupingsAcross:O(Qf).optional(),filter:Q.optional(),chart:$f.optional()}));q(()=>k({name:X.describe(`Report unique name`),label:J.describe(`Report label`),description:J.optional(),objectName:x().describe(`Primary object`),type:Xf.default(`tabular`).describe(`Report format type`),columns:O(Zf).describe(`Columns to display`),groupingsDown:O(Qf).optional().describe(`Row groupings`),groupingsAcross:O(Qf).optional().describe(`Column groupings (Matrix only)`),filter:Q.optional().describe(`Filter criteria`),chart:$f.optional().describe(`Embedded chart configuration`),aria:Y.optional().describe(`ARIA accessibility attributes`),performance:fd.optional().describe(`Performance optimization settings`),blocks:O(ep).optional().describe(`Sub-reports for type=joined`)})),wf({schemaId:`report`,type:`simple`,sections:[{label:`Basics`,description:`Identity and data source.`,columns:2,fields:[{field:`name`,type:`text`,colSpan:1,required:!0,helpText:`snake_case unique identifier`},{field:`label`,type:`text`,colSpan:1,required:!0},{field:`description`,type:`textarea`,colSpan:2},{field:`objectName`,widget:`ref:object`,colSpan:1,helpText:`Data source object`},{field:`type`,colSpan:1,helpText:`Report type: tabular/summary/matrix/joined`}]},{label:`Columns`,description:`Columns shown in the report output.`,fields:[{field:`columns`,type:`repeater`,helpText:`Columns to display in the report`}]},{label:`Groupings`,description:`How rows (and columns, for matrix reports) are grouped.`,fields:[{field:`groupingsDown`,type:`repeater`,helpText:`Row grouping levels`},{field:`groupingsAcross`,type:`repeater`,visibleOn:`data.type == 'matrix'`,helpText:`Column grouping levels (matrix only)`}]},{label:`Joined blocks`,description:`Additional blocks joined into a single report (joined reports only).`,visibleOn:`data.type == 'joined'`,fields:[{field:`blocks`,type:`repeater`,helpText:`Join multiple objects (joined report only)`}]},{label:`Filter & chart`,description:`Report-level filters and chart presentation.`,collapsible:!0,collapsed:!0,fields:[{field:`filter`,type:`repeater`,helpText:`Report-level filters`},{field:`chart`,type:`composite`,helpText:`Chart config (type, legend, colors)`}]},{label:`Advanced`,description:`Accessibility and performance tuning.`,collapsible:!0,collapsed:!0,fields:[{field:`aria`,type:`composite`,helpText:`Accessibility labels`},{field:`performance`,type:`composite`,helpText:`Caching and optimization`}]}]}),wf({schemaId:`view`,type:`simple`,sections:[{label:`Basics`,description:`Identity and primary surface.`,columns:2,fields:[{field:`name`,type:`text`,required:!0,colSpan:1,helpText:`snake_case, unique per environment`},{field:`label`,type:`text`,required:!0,colSpan:1},{field:`description`,type:`textarea`,colSpan:2},{field:`type`,required:!0,colSpan:1,helpText:`Primary view surface`},{field:`data`,widget:`json`,colSpan:2,helpText:`Data source — e.g. {"provider":"object","object":"task"}`}]},{label:`Columns & filters`,description:`What rows show and how users filter them.`,fields:[{field:`columns`,type:`repeater`,required:!0,helpText:`Columns to display (field names from selected object)`},{field:`filter`,type:`repeater`,helpText:`Filter conditions`},{field:`sort`,type:`repeater`,helpText:`Default sort order`},{field:`searchableFields`,widget:`string-tags`,helpText:`Field names available for quick search`},{field:`filterableFields`,widget:`string-tags`,helpText:`Field names available for filtering`}]},{label:`Table options`,description:`Grid-only display options.`,visibleOn:`data.type == 'grid' || data.type == null`,collapsible:!0,collapsed:!0,columns:2,fields:[{field:`resizable`,colSpan:1},{field:`striped`,colSpan:1},{field:`bordered`,colSpan:1},{field:`compactToolbar`,colSpan:1},{field:`rowHeight`,colSpan:1},{field:`selection`,type:`composite`,colSpan:2},{field:`pagination`,type:`composite`,colSpan:2}]},{label:`Kanban`,description:`Kanban-specific board configuration.`,visibleOn:`data.type == 'kanban'`,fields:[{field:`kanban`,type:`composite`}]},{label:`Calendar`,description:`Calendar-specific configuration.`,visibleOn:`data.type == 'calendar'`,fields:[{field:`calendar`,type:`composite`}]},{label:`Gantt`,description:`Gantt-specific configuration.`,visibleOn:`data.type == 'gantt'`,fields:[{field:`gantt`,type:`composite`}]},{label:`Gallery`,description:`Gallery-specific configuration.`,visibleOn:`data.type == 'gallery'`,fields:[{field:`gallery`,type:`composite`}]},{label:`Timeline`,description:`Timeline-specific configuration.`,visibleOn:`data.type == 'timeline'`,fields:[{field:`timeline`,type:`composite`}]},{label:`Chart`,description:`Chart-specific configuration.`,visibleOn:`data.type == 'chart'`,fields:[{field:`chart`,type:`composite`}]},{label:`Navigation & sharing`,description:`Where this view appears and who can see it.`,collapsible:!0,collapsed:!0,fields:[{field:`navigation`,type:`composite`},{field:`sharing`,type:`composite`}]}]}),wf({schemaId:`app`,type:`simple`,sections:[{label:`Basics`,description:`App identity and activation.`,columns:2,fields:[{field:`name`,type:`text`,required:!0,colSpan:1,helpText:`snake_case, unique`},{field:`label`,type:`text`,required:!0,colSpan:1},{field:`description`,type:`textarea`,colSpan:2},{field:`version`,type:`text`,colSpan:1},{field:`icon`,type:`text`,colSpan:1,helpText:`Lucide icon name (e.g. "users", "briefcase")`},{field:`active`,type:`boolean`,colSpan:1},{field:`isDefault`,type:`boolean`,colSpan:1,helpText:`Make this the default app for new users`}]},{label:`Navigation`,description:`Sidebar items and area grouping.`,fields:[{field:`navigation`,type:`composite`,helpText:`Nav tree — recursive structure`},{field:`areas`,type:`repeater`,helpText:`Group items into collapsible areas`},{field:`homePageId`,type:`text`,helpText:`Landing page when app opens`},{field:`mobileNavigation`,type:`composite`,helpText:`Bottom tab bar config for mobile`}]},{label:`Content`,description:`Objects and APIs this app uses.`,fields:[{field:`objects`,widget:`object-selector`,multiple:!0,helpText:`Object names this app exposes`},{field:`apis`,type:`composite`,helpText:`API endpoint definitions`},{field:`defaultAgent`,type:`text`,helpText:`AI agent for the ambient assistant button`}]},{label:`Branding`,description:`Theme colors and logo.`,collapsible:!0,collapsed:!0,fields:[{field:`branding`,type:`composite`,helpText:`Primary/secondary colors, logo, theme`}]},{label:`Access & sharing`,description:`Who can access this app and how it can be embedded.`,collapsible:!0,collapsed:!0,fields:[{field:`requiredPermissions`,widget:`string-tags`,helpText:`Permissions needed to access this app`},{field:`sharing`,type:`composite`,helpText:`Public/internal/restricted access control`},{field:`embed`,type:`composite`,helpText:`iFrame embed configuration`},{field:`aria`,type:`composite`,helpText:`Accessibility labels`}]}]}),wf({schemaId:`dashboard`,type:`simple`,sections:[{label:`Basics`,description:`Dashboard identity and description.`,columns:2,fields:[{field:`name`,type:`text`,required:!0,colSpan:1,helpText:`snake_case unique identifier`},{field:`label`,type:`text`,required:!0,colSpan:1,helpText:`Display name`},{field:`description`,type:`textarea`,colSpan:2}]},{label:`Layout`,description:`Grid sizing and refresh cadence.`,columns:3,fields:[{field:`columns`,type:`number`,colSpan:1,helpText:`Grid columns (default 12)`},{field:`gap`,type:`number`,colSpan:1,helpText:`Grid gap (Tailwind units)`},{field:`refreshInterval`,type:`number`,colSpan:1,helpText:`Auto-refresh (seconds)`},{field:`header`,type:`composite`,colSpan:3,helpText:`Dashboard header config (title, subtitle, actions)`}]},{label:`Widgets`,description:`Cards and charts placed on the grid.`,fields:[{field:`widgets`,type:`repeater`,required:!0,helpText:`Dashboard widgets with position and sizing`}]},{label:`Filters`,description:`Default and global filters applied across widgets.`,collapsible:!0,collapsed:!0,fields:[{field:`dateRange`,type:`composite`,helpText:`Default date range selector`},{field:`globalFilters`,type:`repeater`,helpText:`Filters applied to all widgets`}]},{label:`Advanced`,description:`Accessibility and performance tuning.`,collapsible:!0,collapsed:!0,fields:[{field:`aria`,type:`composite`,helpText:`Accessibility labels`},{field:`performance`,type:`composite`,helpText:`Caching and optimization config`}]}]}),wf({schemaId:`action`,type:`simple`,sections:[{label:`Basics`,description:`Action identity and presentation.`,columns:2,fields:[{field:`name`,required:!0,colSpan:1,helpText:`Unique identifier (snake_case)`},{field:`label`,required:!0,colSpan:1,helpText:`Button text shown to users`},{field:`objectName`,widget:`ref:object`,colSpan:1,helpText:`Object this action belongs to (optional)`},{field:`icon`,colSpan:1,helpText:`Lucide icon name (e.g., "check", "x-circle")`},{field:`type`,required:!0,colSpan:1,helpText:`What happens when clicked`},{field:`variant`,colSpan:1,helpText:`Button style (primary=blue, danger=red, ghost=transparent)`}]},{label:`Behavior`,description:`Configure what happens when the action is triggered.`,fields:[{field:`target`,visibleOn:`data.type != 'script'`,helpText:`URL, flow name, or API endpoint to call`},{field:`method`,visibleOn:`data.type == 'api'`,helpText:`HTTP method (GET, POST, PUT, DELETE)`},{field:`body`,widget:`code`,visibleOn:`data.type == 'script'`,helpText:`JavaScript code to execute`},{field:`params`,type:`repeater`,helpText:`User input parameters (show form before executing)`},{field:`confirmText`,helpText:`Confirmation message (e.g., "Are you sure?")`},{field:`successMessage`,helpText:`Success message after completion`},{field:`refreshAfter`,helpText:`Refresh the list/page after action completes`}]},{label:`Placement`,description:`Where and when the action button appears.`,collapsible:!0,collapsed:!0,fields:[{field:`locations`,type:`repeater`,helpText:`Where to show this action (toolbar, row menu, etc.)`},{field:`component`,helpText:`How to render (button, icon, menu item)`},{field:`visible`,widget:`textarea`,helpText:`CEL expression: show only when condition is true`},{field:`disabled`,widget:`textarea`,helpText:`CEL expression: disable when condition is true`},{field:`shortcut`,helpText:`Keyboard shortcut (e.g., "Ctrl+S", "Cmd+Enter")`}]},{label:`Advanced`,description:`Bulk operations, AI exposure, and API request shape.`,collapsible:!0,collapsed:!0,columns:2,fields:[{field:`bulkEnabled`,colSpan:1,helpText:`Allow applying to multiple selected records`},{field:`aiExposed`,colSpan:1,helpText:`Allow AI agents to call this action`},{field:`recordIdParam`,visibleOn:`data.type == 'api'`,colSpan:1,helpText:`Body parameter name for record ID`},{field:`recordIdField`,visibleOn:`data.type == 'api' && data.recordIdParam`,colSpan:1,helpText:`Field to use as record ID (default: "id")`},{field:`bodyShape`,visibleOn:`data.type == 'api'`,colSpan:2,helpText:`Request body structure (flat or nested)`}]}]}),wf({schemaId:`page`,type:`simple`,sections:[{label:`Basics`,description:`Page identity and template.`,columns:2,fields:[{field:`name`,required:!0,colSpan:1,helpText:`Unique identifier (snake_case)`},{field:`label`,required:!0,colSpan:1,helpText:`Page title shown to users`},{field:`icon`,colSpan:1,helpText:`Icon for navigation menu`},{field:`type`,colSpan:1,helpText:`Page type (record, home, app, dashboard, etc.)`},{field:`template`,colSpan:2,helpText:`Layout template (e.g., "header-sidebar-main")`},{field:`description`,widget:`textarea`,colSpan:2,helpText:`Page description for navigation`}]},{label:`Data Context`,description:`Record binding and page-local state.`,fields:[{field:`object`,widget:`ref:object`,helpText:`Bound object (for Record pages)`},{field:`variables`,type:`repeater`,helpText:`Local page state variables`}]},{label:`Layout`,description:`Page regions and components placed within them.`,fields:[{field:`regions`,type:`repeater`,required:!0,helpText:`Layout regions (header, main, sidebar, footer) with components`}]},{label:`Advanced`,description:`Activation, audience, and accessibility.`,collapsible:!0,collapsed:!0,fields:[{field:`isDefault`,helpText:`Set as default page for this page type`},{field:`kind`,helpText:`Page override mode: full or slotted (for record pages)`},{field:`assignedProfiles`,widget:`string-tags`,helpText:`Profiles that can access this page`},{field:`aria`,type:`composite`,helpText:`Accessibility attributes (ARIA labels, roles)`}]}]});var tp=P([`api.read`,`api.write`,`crypto.uuid`,`crypto.hash`,`log`]),np=j(`language`,[k({language:F(`expression`),source:x().min(1).describe(`Formula expression source`)}).describe(`L1 expression body — pure formula, no IO`),k({language:F(`js`),source:x().min(1).describe(`Function body source`),capabilities:O(tp).default([]).describe(`Granted capability tokens`),timeoutMs:C().int().positive().max(3e4).optional().describe(`Per-invocation timeout (ms)`),memoryMb:C().int().positive().max(256).optional().describe(`Per-invocation memory cap (MB)`)}).describe(`L2 sandboxed JS body — runs inside an isolated VM with declared capabilities`)]).describe(`Hook/Action body — expression (L1) or sandboxed JS (L2)`),rp=q(()=>k({name:x().optional(),field:X.optional(),objectOverride:X.optional(),label:J.optional(),type:Rd.optional(),required:w().optional().default(!1),options:O(k({label:J,value:x()})).optional(),placeholder:x().optional(),helpText:x().optional(),defaultValue:E().optional(),defaultFromRow:w().optional()}).refine(e=>!!e.name||!!e.field,{message:`ActionParam requires either "name" or "field"`})),ip=P([`script`,`url`,`modal`,`flow`,`api`,`form`]),ap=new Set(ip.options.filter(e=>e!==`script`));q(()=>k({name:X.describe(`Machine name (lowercase snake_case)`),label:J.describe(`Display label`),objectName:x().regex(/^[a-z_][a-z0-9_]*$/).optional().describe(`Target object this action belongs to. When set, the action is auto-merged into the object's actions array by defineStack().`),icon:x().optional().describe(`Icon name`),locations:O(P([`list_toolbar`,`list_item`,`record_header`,`record_more`,`record_related`,`global_nav`])).optional().describe(`Locations where this action is visible`),component:P([`action:button`,`action:icon`,`action:menu`,`action:group`]).optional().describe(`Visual component override`),type:ip.default(`script`).describe(`Action functionality type`),target:x().optional().describe(`URL, Script Name, Flow ID, or API Endpoint`),body:np.optional().describe("Action body — expression (L1) or sandboxed JS (L2). Only used when type is `script`."),execute:x().optional().describe(`@deprecated — Use target instead. Auto-migrated to target during parsing.`),params:O(rp).optional().describe(`Input parameters required from user`),variant:P([`primary`,`secondary`,`danger`,`ghost`,`link`]).optional().describe(`Button visual variant for styling (primary = highlighted, danger = destructive, ghost = transparent)`),confirmText:J.optional().describe(`Confirmation message before execution`),successMessage:J.optional().describe(`Success message to show after execution`),refreshAfter:w().default(!1).describe(`Refresh view after execution`),visible:_d.optional().describe(`Visibility predicate (CEL).`),disabled:A([w(),_d]).optional().describe(`Boolean or predicate (CEL) — action is disabled when TRUE.`),shortcut:x().optional().describe(`Keyboard shortcut to trigger this action (e.g., "Ctrl+S")`),bulkEnabled:w().optional().describe(`Whether this action can be applied to multiple selected records`),aiExposed:w().optional().describe(`Set to false to keep this action out of the AI tool registry.`),recordIdParam:x().optional().describe(`Body key to inject the row id into when running from a list_item context.`),recordIdField:x().optional().describe(`Row field whose value seeds recordIdParam. Defaults to "id".`),bodyShape:A([F(`flat`),k({wrap:x()})]).optional().describe(`Body wrapping: flat (default) or { wrap: key } to nest user-collected params under a key.`),method:P([`POST`,`PATCH`,`PUT`,`DELETE`]).optional().describe(`HTTP method for type:"api" actions. Defaults to POST.`),bodyExtra:N(x(),E()).optional().describe(`Constant body fields merged into the API request (applied last; overrides user params).`),mode:P([`create`,`edit`,`delete`,`custom`]).optional().describe(`Semantic mode of the action.`),timeout:C().optional().describe(`Maximum execution time in milliseconds for the action`),aria:Y.optional().describe(`ARIA accessibility attributes`)}).transform(e=>e.execute&&!e.target?{...e,target:e.execute}:e).refine(e=>!(ap.has(e.type)&&!e.target),{message:`Action 'target' is required when type is 'url', 'flow', 'modal', 'api', or 'form'.`,path:[`target`]})),P([`count`,`sum`,`avg`,`min`,`max`,`count_distinct`,`percentile`,`median`,`stddev`,`variance`]).describe(`Standard aggregation functions`);var op=P([`asc`,`desc`]).describe(`Sort order direction`),sp=q(()=>k({field:x().describe(`Field name to sort by`),order:op.describe(`Sort direction`)}).describe(`Sort field and direction pair`));P([`insert`,`update`,`delete`,`upsert`]).describe(`Data mutation event types`),P([`read_uncommitted`,`read_committed`,`repeatable_read`,`serializable`,`snapshot`]).describe(`Transaction isolation levels (snake_case standard)`),P([`lru`,`lfu`,`ttl`,`fifo`]).describe(`Cache eviction strategy`);var cp=q(()=>k({name:x().describe(`Region name (e.g. "sidebar", "main", "header")`),width:P([`small`,`medium`,`large`,`full`]).optional(),components:O(I(()=>$)).describe(`Components in this region`)})),lp=P(`page:header.page:footer.page:sidebar.page:tabs.page:accordion.page:card.page:section.record:details.record:highlights.record:related_list.record:activity.record:chatter.record:path.app:launcher.nav:menu.nav:breadcrumb.global:search.global:notifications.user:profile.ai:chat_window.ai:suggestion.element:text.element:number.element:image.element:divider.element:button.element:filter.element:form.element:record_picker`.split(`.`)),up=q(()=>k({object:x().describe(`Object to query`),view:x().optional().describe(`Named view to apply`),filter:Q.optional().describe(`Additional filter criteria`),sort:O(sp).optional().describe(`Sort order`),limit:C().int().positive().optional().describe(`Max records to display`)})),$=q(()=>k({type:A([lp,x()]).describe(`Component Type (Standard enum or custom string)`),id:x().optional().describe(`Unique instance ID`),label:J.optional(),properties:N(x(),E()).describe(`Component props passed to the widget. See component.zod.ts for schemas.`),events:N(x(),x()).optional().describe(`Event handlers map`),style:N(x(),x()).optional().describe(`Inline styles or utility classes`),className:x().optional().describe(`CSS class names`),visibility:_d.optional().describe(`Visibility predicate (CEL).`),dataSource:up.optional().describe(`Per-element data binding for multi-object pages`),responsive:dd.optional().describe(`Responsive layout configuration`),aria:Y.optional().describe(`ARIA accessibility attributes`)})),dp=q(()=>k({name:x().describe(`Variable name`),type:P([`string`,`number`,`boolean`,`object`,`array`,`record_id`]).default(`string`),defaultValue:E().optional(),source:x().optional().describe(`Component ID that writes to this variable`)})),fp=q(()=>k({componentId:x().describe(`Reference to a PageComponent.id in the page`),x:C().int().min(0).describe(`Grid column position (0-based)`),y:C().int().min(0).describe(`Grid row position (0-based)`),width:C().int().min(1).describe(`Width in grid columns`),height:C().int().min(1).describe(`Height in grid rows`)})),pp=q(()=>k({columns:C().int().min(1).default(12).describe(`Number of grid columns`),rowHeight:C().int().min(1).default(40).describe(`Height of each grid row in pixels`),gap:C().int().min(0).default(8).describe(`Gap between grid items in pixels`),items:O(fp).describe(`Positioned components on the canvas`)})),mp=q(()=>P([`record`,`home`,`app`,`utility`,`dashboard`,`grid`,`list`,`gallery`,`kanban`,`calendar`,`timeline`,`form`,`record_detail`,`record_review`,`overview`,`blank`]).describe(`Page type — platform or interface page types`)),hp=q(()=>k({object:x().describe(`Target object for review`),filter:Q.optional().describe(`Filter criteria for review queue`),sort:O(sp).optional().describe(`Sort order for review queue`),displayFields:O(x()).optional().describe(`Fields to display on the review page`),actions:O(k({label:x().describe(`Action button label`),type:P([`approve`,`reject`,`skip`,`custom`]).describe(`Action type`),field:x().optional().describe(`Field to update on action`),value:A([x(),C(),w()]).optional().describe(`Value to set on action`),nextRecord:w().optional().default(!0).describe(`Auto-advance to next record after action`)})).describe(`Review actions`),navigation:P([`sequential`,`random`,`filtered`]).optional().default(`sequential`).describe(`Record navigation mode`),showProgress:w().optional().default(!0).describe(`Show review progress indicator`)})),gp=q(()=>k({source:x().optional().describe(`Source object name for the page`),levels:C().int().min(1).optional().describe(`Number of hierarchy levels to display`),filterBy:O(Xd).optional().describe(`Page-level filter criteria`),appearance:df.optional().describe(`Appearance and visualization configuration`),userFilters:k({elements:O(P([`grid`,`gallery`,`kanban`])).optional().describe(`Visualization element types available in user filter bar`),tabs:O(ff).optional().describe(`User-configurable tabs`)}).optional().describe(`User filter configuration`),userActions:uf.optional().describe(`User action toggles`),addRecord:pf.optional().describe(`Add record entry point configuration`),showRecordCount:w().optional().describe(`Show record count at page bottom`),allowPrinting:w().optional().describe(`Allow users to print the page`)}).describe(`Interface-level page configuration (Airtable parity)`));q(()=>k({name:X.describe(`Page unique name (lowercase snake_case)`),label:J,description:J.optional(),icon:x().optional().describe(`Page icon name`),type:mp.default(`record`).describe(`Page type`),variables:O(dp).optional().describe(`Local page state variables`),object:x().optional().describe(`Bound object (for Record pages)`),recordReview:hp.optional().describe(`Record review configuration (required when type is "record_review")`),blankLayout:pp.optional().describe(`Free-form grid layout for blank pages (used when type is "blank")`),template:x().default(`default`).describe(`Layout template name (e.g. "header-sidebar-main")`),regions:O(cp).describe(`Defined regions with components`),isDefault:w().default(!1),assignedProfiles:O(x()).optional(),interfaceConfig:gp.optional().describe(`Interface-level page configuration (for Airtable-style interface pages)`),aria:Y.optional().describe(`ARIA accessibility attributes`),kind:P([`full`,`slotted`]).default(`full`).describe(`Page override mode: full (default) or slotted (partial overrides)`),slots:k({header:A([$,O($)]).optional(),actions:A([$,O($)]).optional(),highlights:A([$,O($)]).optional(),details:A([$,O($)]).optional(),tabs:A([$,O($)]).optional(),discussion:A([$,O($)]).optional()}).optional().describe(`Slot override map for slotted pages`)}).superRefine((e,t)=>{e.type===`record_review`&&!e.recordReview&&t.addIssue({code:cs.custom,path:[`recordReview`],message:`recordReview is required when type is "record_review"`}),e.type===`blank`&&!e.blankLayout&&t.addIssue({code:cs.custom,path:[`blankLayout`],message:`blankLayout is required when type is "blank"`}),e.kind===`slotted`&&!e.slots&&t.addIssue({code:cs.custom,path:[`slots`],message:`slots is required when kind is "slotted"`})}));var _p=q(()=>k({onMount:x().optional().describe(`Initialization code when widget mounts`),onUpdate:x().optional().describe(`Code to run when props change`),onUnmount:x().optional().describe(`Cleanup code when widget unmounts`),onValidate:x().optional().describe(`Custom validation logic`),onFocus:x().optional().describe(`Code to run on focus`),onBlur:x().optional().describe(`Code to run on blur`),onError:x().optional().describe(`Error handling code`)})),vp=q(()=>k({name:x().describe(`Event name`),label:J.optional().describe(`Human-readable event label`),description:J.optional().describe(`Event description and usage`),bubbles:w().default(!1).describe(`Whether event bubbles`),cancelable:w().default(!1).describe(`Whether event is cancelable`),payload:N(x(),E()).optional().describe(`Event payload schema`)})),yp=q(()=>k({name:x().describe(`Property name (camelCase)`),label:J.optional().describe(`Human-readable label`),type:P([`string`,`number`,`boolean`,`array`,`object`,`function`,`any`]).describe(`TypeScript type`),required:w().default(!1).describe(`Whether property is required`),default:E().optional().describe(`Default value`),description:J.optional().describe(`Property description`),validation:N(x(),E()).optional().describe(`Validation rules`),category:x().optional().describe(`Property category`)})),bp=q(()=>j(`type`,[k({type:F(`npm`),packageName:x().describe(`NPM package name`),version:x().default(`latest`),exportName:x().optional().describe(`Named export (default: default)`)}),k({type:F(`remote`),url:x().url().describe(`Remote entry URL (.js)`),moduleName:x().describe(`Exposed module name`),scope:x().describe(`Remote scope name`)}),k({type:F(`inline`),code:x().describe(`JavaScript code body`)})]));q(()=>k({name:X.describe(`Widget identifier (snake_case)`),label:J.describe(`Widget display name`),description:J.optional().describe(`Widget description`),version:x().optional().describe(`Widget version (semver)`),author:x().optional().describe(`Widget author`),icon:x().optional().describe(`Widget icon`),fieldTypes:O(x()).optional().describe(`Supported field types`),category:P([`input`,`display`,`picker`,`editor`,`custom`]).default(`custom`).describe(`Widget category`),lifecycle:_p.optional().describe(`Lifecycle hooks`),events:O(vp).optional().describe(`Custom events`),properties:O(yp).optional().describe(`Configuration properties`),implementation:bp.optional().describe(`Widget implementation source`),dependencies:O(k({name:x(),version:x().optional(),url:x().url().optional()})).optional().describe(`Widget dependencies`),screenshots:O(x().url()).optional().describe(`Screenshot URLs`),documentation:x().url().optional().describe(`Documentation URL`),license:x().optional().describe(`License (SPDX identifier)`),tags:O(x()).optional().describe(`Tags for categorization`),aria:Y.optional().describe(`ARIA accessibility attributes`),performance:fd.optional().describe(`Performance optimization settings`)})),q(()=>k({value:E().describe(`Current field value`),onChange:R().input(M([E()])).output(xo()).describe(`Callback to update field value`),readonly:w().default(!1).describe(`Read-only mode flag`),required:w().default(!1).describe(`Required field flag`),error:x().optional().describe(`Validation error message`),field:Gd.describe(`Field schema definition`),record:N(x(),E()).optional().describe(`Complete record data`),options:N(x(),E()).optional().describe(`Custom widget options`)}));var xp=P([`comment`,`field_change`,`task`,`event`,`email`,`call`,`note`,`file`,`record_create`,`record_delete`,`approval`,`sharing`,`system`]),Sp=q(()=>k({type:P([`user`,`team`,`record`]).describe(`Mention target type`),id:x().describe(`Target ID`),name:x().describe(`Display name for rendering`),offset:C().int().min(0).describe(`Character offset in body text`),length:C().int().min(1).describe(`Length of mention token in body text`)})),Cp=q(()=>k({field:x().describe(`Field machine name`),fieldLabel:x().optional().describe(`Field display label`),oldValue:E().optional().describe(`Previous value`),newValue:E().optional().describe(`New value`),oldDisplayValue:x().optional().describe(`Human-readable old value`),newDisplayValue:x().optional().describe(`Human-readable new value`)})),wp=q(()=>k({emoji:x().describe(`Emoji character or shortcode (e.g., "👍", ":thumbsup:")`),userIds:O(x()).describe(`Users who reacted`),count:C().int().min(1).describe(`Total reaction count`)})),Tp=q(()=>k({type:P([`user`,`system`,`service`,`automation`]).describe(`Actor type`),id:x().describe(`Actor ID`),name:x().optional().describe(`Actor display name`),avatarUrl:x().url().optional().describe(`Actor avatar URL`),source:x().optional().describe(`Source application (e.g., "Omni", "API", "Studio")`)})),Ep=P([`public`,`internal`,`private`]);q(()=>k({id:x().describe(`Feed item ID`),type:xp.describe(`Activity type`),object:x().describe(`Object name (e.g., "account")`),recordId:x().describe(`Record ID this feed item belongs to`),actor:Tp.describe(`Who performed this action`),body:x().optional().describe(`Rich text body (Markdown supported)`),mentions:O(Sp).optional().describe(`Mentioned users/teams/records`),changes:O(Cp).optional().describe(`Field-level changes`),reactions:O(wp).optional().describe(`Emoji reactions on this item`),parentId:x().optional().describe(`Parent feed item ID for threaded replies`),replyCount:C().int().min(0).default(0).describe(`Number of replies`),pinned:w().default(!1).describe(`Whether the feed item is pinned to the top of the timeline`),pinnedAt:x().datetime().optional().describe(`Timestamp when the item was pinned`),pinnedBy:x().optional().describe(`User ID who pinned the item`),starred:w().default(!1).describe(`Whether the feed item is starred/bookmarked by the current user`),starredAt:x().datetime().optional().describe(`Timestamp when the item was starred`),visibility:Ep.default(`public`).describe(`Visibility: public (all users), internal (team only), private (author + mentioned)`),createdAt:x().datetime().describe(`Creation timestamp`),updatedAt:x().datetime().optional().describe(`Last update timestamp`),editedAt:x().datetime().optional().describe(`When comment was last edited`),isEdited:w().default(!1).describe(`Whether comment has been edited`)}));var Dp=P([`all`,`comments_only`,`changes_only`,`tasks_only`]);k({}),k({title:J.describe(`Page title`),subtitle:J.optional().describe(`Page subtitle`),icon:x().optional().describe(`Icon name`),breadcrumb:w().default(!0).describe(`Show breadcrumb`),actions:O(x()).optional().describe(`Action IDs to show in header`),aria:Y.optional().describe(`ARIA accessibility attributes`)}),k({type:P([`line`,`card`,`pill`]).default(`line`),position:P([`top`,`left`]).default(`top`),items:O(k({label:J,icon:x().optional(),children:O(E()).describe(`Child components`)})),aria:Y.optional().describe(`ARIA accessibility attributes`)}),k({title:J.optional(),bordered:w().default(!0),actions:O(x()).optional(),body:O(E()).optional().describe(`Card content components (slot)`),footer:O(E()).optional().describe(`Card footer components (slot)`),aria:Y.optional().describe(`ARIA accessibility attributes`)}),k({columns:P([`1`,`2`,`3`,`4`]).default(`2`).describe(`Number of columns for field layout (1-4)`),layout:P([`auto`,`custom`]).default(`auto`).describe(`Layout mode: auto uses object compactLayout, custom uses explicit sections`),sections:O(x()).optional().describe(`Section IDs to show (required when layout is "custom")`),fields:O(x()).optional().describe(`Explicit field list to display (optional, overrides compactLayout)`),aria:Y.optional().describe(`ARIA accessibility attributes`)}),k({objectName:x().describe(`Related object name (e.g., "task", "opportunity")`),relationshipField:x().describe(`Field on related object that points to this record (e.g., "account_id")`),columns:O(x()).describe(`Fields to display in the related list`),sort:A([x(),O(k({field:x(),order:P([`asc`,`desc`])}))]).optional().describe(`Sort order for related records`),limit:C().int().positive().default(5).describe(`Number of records to display initially`),filter:O(Xd).optional().describe(`Additional filter criteria for related records`),title:J.optional().describe(`Custom title for the related list`),showViewAll:w().default(!0).describe(`Show "View All" link to see all related records`),actions:O(x()).optional().describe(`Action IDs available for related records`),aria:Y.optional().describe(`ARIA accessibility attributes`)}),k({fields:O(A([x(),k({name:x().describe(`Field name on the record`),label:x().optional().describe(`Display label (overrides schema label)`),icon:x().optional().describe(`Icon name (lucide icon key)`),type:x().optional().describe(`Override cell renderer type (rare)`)})]).describe(`Highlight field: bare name, or {name,label?,icon?,type?}`)).min(1).max(7).describe(`Key fields to highlight (1-7 fields max, typically displayed as prominent cards). Each item may be a bare field name or {name, label?, icon?, type?} for inline overrides.`),layout:P([`horizontal`,`vertical`]).default(`horizontal`).describe(`Layout orientation for highlight fields`),aria:Y.optional().describe(`ARIA accessibility attributes`)});var Op=k({types:O(xp).optional().describe(`Feed item types to show (default: all)`),filterMode:Dp.default(`all`).describe(`Default activity filter`),showFilterToggle:w().default(!0).describe(`Show filter dropdown in panel header`),limit:C().int().positive().default(20).describe(`Number of items to load per page`),showCompleted:w().default(!1).describe(`Include completed activities`),unifiedTimeline:w().default(!0).describe(`Mix field changes and comments in one timeline (Airtable style)`),showCommentInput:w().default(!0).describe(`Show "Leave a comment" input at the bottom`),enableMentions:w().default(!0).describe(`Enable @mentions in comments`),enableReactions:w().default(!1).describe(`Enable emoji reactions on feed items`),enableThreading:w().default(!1).describe(`Enable threaded replies on comments`),showSubscriptionToggle:w().default(!0).describe(`Show bell icon for record-level notification subscription`),aria:Y.optional().describe(`ARIA accessibility attributes`)});k({position:P([`sidebar`,`inline`,`drawer`]).default(`sidebar`).describe(`Where to render the chatter panel`),width:A([x(),C()]).optional().describe(`Panel width (e.g., "350px", "30%")`),collapsible:w().default(!0).describe(`Whether the panel can be collapsed`),defaultCollapsed:w().default(!1).describe(`Whether the panel starts collapsed`),feed:Op.optional().describe(`Embedded activity feed configuration`),aria:Y.optional().describe(`ARIA accessibility attributes`)}),k({statusField:x().describe(`Field name representing the current status/stage`),stages:O(k({value:x(),label:J})).optional().describe(`Explicit stage definitions (if not using field metadata)`),aria:Y.optional().describe(`ARIA accessibility attributes`)}),k({items:O(k({label:J,icon:x().optional(),collapsed:w().default(!1),children:O(E()).describe(`Child components`)})),allowMultiple:w().default(!1).describe(`Allow multiple panels to be expanded simultaneously`),aria:Y.optional().describe(`ARIA accessibility attributes`)}),k({mode:P([`float`,`sidebar`,`inline`]).default(`float`).describe(`Display mode for the chat window`),agentId:x().optional().describe(`Specific AI agent to use`),context:N(x(),E()).optional().describe(`Contextual data to pass to the AI`),aria:Y.optional().describe(`ARIA accessibility attributes`)}),q(()=>k({content:x().describe(`Text or Markdown content`),variant:P([`heading`,`subheading`,`body`,`caption`]).optional().default(`body`).describe(`Text style variant`),align:P([`left`,`center`,`right`]).optional().default(`left`).describe(`Text alignment`),aria:Y.optional().describe(`ARIA accessibility attributes`)})),q(()=>k({object:x().describe(`Source object`),field:x().optional().describe(`Field to aggregate`),aggregate:P([`count`,`sum`,`avg`,`min`,`max`]).describe(`Aggregation function`),filter:Q.optional().describe(`Filter criteria`),format:P([`number`,`currency`,`percent`]).optional().describe(`Number display format`),prefix:x().optional().describe(`Prefix text (e.g. "$")`),suffix:x().optional().describe(`Suffix text (e.g. "%")`),aria:Y.optional().describe(`ARIA accessibility attributes`)})),q(()=>k({src:x().describe(`Image URL or attachment field`),alt:x().optional().describe(`Alt text for accessibility`),fit:P([`cover`,`contain`,`fill`]).optional().default(`cover`).describe(`Image object-fit mode`),height:C().optional().describe(`Fixed height in pixels`),aria:Y.optional().describe(`ARIA accessibility attributes`)})),q(()=>k({label:J.describe(`Button display label`),variant:P([`primary`,`secondary`,`danger`,`ghost`,`link`]).optional().default(`primary`).describe(`Button visual variant`),size:P([`small`,`medium`,`large`]).optional().default(`medium`).describe(`Button size`),icon:x().optional().describe(`Icon name (Lucide icon)`),iconPosition:P([`left`,`right`]).optional().default(`left`).describe(`Icon position relative to label`),disabled:w().optional().default(!1).describe(`Disable the button`),aria:Y.optional().describe(`ARIA accessibility attributes`)})),q(()=>k({object:x().describe(`Object to filter`),fields:O(x()).describe(`Filterable field names`),targetVariable:x().optional().describe(`Page variable to store filter state`),layout:P([`inline`,`dropdown`,`sidebar`]).optional().default(`inline`).describe(`Filter display layout`),showSearch:w().optional().default(!0).describe(`Show search input`),aria:Y.optional().describe(`ARIA accessibility attributes`)})),q(()=>k({object:x().describe(`Object for the form`),fields:O(x()).optional().describe(`Fields to display (defaults to all editable fields)`),mode:P([`create`,`edit`]).optional().default(`create`).describe(`Form mode`),submitLabel:J.optional().describe(`Submit button label`),onSubmit:_d.optional().describe(`Action expression on form submit (CEL)`),aria:Y.optional().describe(`ARIA accessibility attributes`)})),q(()=>k({object:x().describe(`Object to pick records from`),displayField:x().describe(`Field to display as the record label`),searchFields:O(x()).optional().describe(`Fields to search against`),filter:Q.optional().describe(`Filter criteria for available records`),multiple:w().optional().default(!1).describe(`Allow multiple record selection`),targetVariable:x().optional().describe(`Page variable to bind selected record ID(s)`),placeholder:J.optional().describe(`Placeholder text`),aria:Y.optional().describe(`ARIA accessibility attributes`)})),k({context:x().optional()});var kp=q(()=>k({minWidth:C().default(44).describe(`Minimum touch target width in pixels (WCAG 2.5.5: 44px)`),minHeight:C().default(44).describe(`Minimum touch target height in pixels (WCAG 2.5.5: 44px)`),padding:C().optional().describe(`Additional padding around touch target in pixels`),hitSlop:k({top:C().optional().describe(`Extra hit area above the element`),right:C().optional().describe(`Extra hit area to the right of the element`),bottom:C().optional().describe(`Extra hit area below the element`),left:C().optional().describe(`Extra hit area to the left of the element`)}).optional().describe(`Invisible hit area extension beyond the visible bounds`)}).describe(`Touch target sizing configuration (WCAG accessible)`)),Ap=q(()=>P([`swipe`,`pinch`,`long_press`,`double_tap`,`drag`,`rotate`,`pan`]).describe(`Touch gesture type`)),jp=q(()=>P([`up`,`down`,`left`,`right`])),Mp=q(()=>k({direction:O(jp).describe(`Allowed swipe directions`),threshold:C().optional().describe(`Minimum distance in pixels to recognize swipe`),velocity:C().optional().describe(`Minimum velocity (px/ms) to trigger swipe`)}).describe(`Swipe gesture recognition settings`)),Np=q(()=>k({minScale:C().optional().describe(`Minimum scale factor (e.g., 0.5 for 50%)`),maxScale:C().optional().describe(`Maximum scale factor (e.g., 3.0 for 300%)`)}).describe(`Pinch/zoom gesture recognition settings`)),Pp=q(()=>k({duration:C().default(500).describe(`Hold duration in milliseconds to trigger long press`),moveTolerance:C().optional().describe(`Max movement in pixels allowed during press`)}).describe(`Long press gesture recognition settings`)),Fp=q(()=>k({type:Ap.describe(`Gesture type to configure`),label:J.optional().describe(`Descriptive label for the gesture action`),enabled:w().default(!0).describe(`Whether this gesture is active`),swipe:Mp.optional().describe(`Swipe gesture settings (when type is swipe)`),pinch:Np.optional().describe(`Pinch gesture settings (when type is pinch)`),longPress:Pp.optional().describe(`Long press settings (when type is long_press)`)}).describe(`Per-gesture configuration`));q(()=>k({gestures:O(Fp).optional().describe(`Configured gesture recognizers`),touchTarget:kp.optional().describe(`Touch target sizing and hit area`),hapticFeedback:w().optional().describe(`Enable haptic feedback on touch interactions`)}).merge(Y.partial()).describe(`Touch and gesture interaction configuration`));var Ip=q(()=>k({enabled:w().default(!1).describe(`Enable focus trapping within this container`),initialFocus:x().optional().describe(`CSS selector for the element to focus on activation`),returnFocus:w().default(!0).describe(`Return focus to trigger element on deactivation`),escapeDeactivates:w().default(!0).describe(`Allow Escape key to deactivate the focus trap`)}).describe(`Focus trap configuration for modal-like containers`)),Lp=q(()=>k({key:x().describe(`Key combination (e.g., "Ctrl+S", "Alt+N", "Escape")`),action:x().describe(`Action identifier to invoke when shortcut is triggered`),description:J.optional().describe(`Human-readable description of what the shortcut does`),scope:P([`global`,`view`,`form`,`modal`,`list`]).default(`global`).describe(`Scope in which this shortcut is active`)}).describe(`Keyboard shortcut binding`)),Rp=q(()=>k({tabOrder:P([`auto`,`manual`]).default(`auto`).describe(`Tab order strategy: auto (DOM order) or manual (explicit tabIndex)`),skipLinks:w().default(!1).describe(`Provide skip-to-content navigation links`),focusVisible:w().default(!0).describe(`Show visible focus indicators for keyboard users`),focusTrap:Ip.optional().describe(`Focus trap settings`),arrowNavigation:w().default(!1).describe(`Enable arrow key navigation between focusable items`)}).describe(`Focus and tab navigation management`));q(()=>k({shortcuts:O(Lp).optional().describe(`Registered keyboard shortcuts`),focusManagement:Rp.optional().describe(`Focus and tab order management`),rovingTabindex:w().default(!1).describe(`Enable roving tabindex pattern for composite widgets`)}).merge(Y.partial()).describe(`Keyboard navigation and shortcut configuration`));var zp=q(()=>k({primary:x().describe(`Primary brand color (hex, rgb, or hsl)`),secondary:x().optional().describe(`Secondary brand color`),accent:x().optional().describe(`Accent color for highlights`),success:x().optional().describe(`Success state color (default: green)`),warning:x().optional().describe(`Warning state color (default: yellow)`),error:x().optional().describe(`Error state color (default: red)`),info:x().optional().describe(`Info state color (default: blue)`),background:x().optional().describe(`Background color`),surface:x().optional().describe(`Surface/card background color`),text:x().optional().describe(`Primary text color`),textSecondary:x().optional().describe(`Secondary text color`),border:x().optional().describe(`Border color`),disabled:x().optional().describe(`Disabled state color`),primaryLight:x().optional().describe(`Lighter shade of primary`),primaryDark:x().optional().describe(`Darker shade of primary`),secondaryLight:x().optional().describe(`Lighter shade of secondary`),secondaryDark:x().optional().describe(`Darker shade of secondary`)})),Bp=q(()=>k({fontFamily:k({base:x().optional().describe(`Base font family (default: system fonts)`),heading:x().optional().describe(`Heading font family`),mono:x().optional().describe(`Monospace font family for code`)}).optional(),fontSize:k({xs:x().optional().describe(`Extra small font size (e.g., 0.75rem)`),sm:x().optional().describe(`Small font size (e.g., 0.875rem)`),base:x().optional().describe(`Base font size (e.g., 1rem)`),lg:x().optional().describe(`Large font size (e.g., 1.125rem)`),xl:x().optional().describe(`Extra large font size (e.g., 1.25rem)`),"2xl":x().optional().describe(`2X large font size (e.g., 1.5rem)`),"3xl":x().optional().describe(`3X large font size (e.g., 1.875rem)`),"4xl":x().optional().describe(`4X large font size (e.g., 2.25rem)`)}).optional(),fontWeight:k({light:C().optional().describe(`Light weight (default: 300)`),normal:C().optional().describe(`Normal weight (default: 400)`),medium:C().optional().describe(`Medium weight (default: 500)`),semibold:C().optional().describe(`Semibold weight (default: 600)`),bold:C().optional().describe(`Bold weight (default: 700)`)}).optional(),lineHeight:k({tight:x().optional().describe(`Tight line height (e.g., 1.25)`),normal:x().optional().describe(`Normal line height (e.g., 1.5)`),relaxed:x().optional().describe(`Relaxed line height (e.g., 1.75)`),loose:x().optional().describe(`Loose line height (e.g., 2)`)}).optional(),letterSpacing:k({tighter:x().optional().describe(`Tighter letter spacing (e.g., -0.05em)`),tight:x().optional().describe(`Tight letter spacing (e.g., -0.025em)`),normal:x().optional().describe(`Normal letter spacing (e.g., 0)`),wide:x().optional().describe(`Wide letter spacing (e.g., 0.025em)`),wider:x().optional().describe(`Wider letter spacing (e.g., 0.05em)`)}).optional()})),Vp=q(()=>k({0:x().optional().describe(`0 spacing (0)`),1:x().optional().describe(`Spacing unit 1 (e.g., 0.25rem)`),2:x().optional().describe(`Spacing unit 2 (e.g., 0.5rem)`),3:x().optional().describe(`Spacing unit 3 (e.g., 0.75rem)`),4:x().optional().describe(`Spacing unit 4 (e.g., 1rem)`),5:x().optional().describe(`Spacing unit 5 (e.g., 1.25rem)`),6:x().optional().describe(`Spacing unit 6 (e.g., 1.5rem)`),8:x().optional().describe(`Spacing unit 8 (e.g., 2rem)`),10:x().optional().describe(`Spacing unit 10 (e.g., 2.5rem)`),12:x().optional().describe(`Spacing unit 12 (e.g., 3rem)`),16:x().optional().describe(`Spacing unit 16 (e.g., 4rem)`),20:x().optional().describe(`Spacing unit 20 (e.g., 5rem)`),24:x().optional().describe(`Spacing unit 24 (e.g., 6rem)`)})),Hp=q(()=>k({none:x().optional().describe(`No border radius (0)`),sm:x().optional().describe(`Small border radius (e.g., 0.125rem)`),base:x().optional().describe(`Base border radius (e.g., 0.25rem)`),md:x().optional().describe(`Medium border radius (e.g., 0.375rem)`),lg:x().optional().describe(`Large border radius (e.g., 0.5rem)`),xl:x().optional().describe(`Extra large border radius (e.g., 0.75rem)`),"2xl":x().optional().describe(`2X large border radius (e.g., 1rem)`),full:x().optional().describe(`Full border radius (50%)`)})),Up=q(()=>k({none:x().optional().describe(`No shadow`),sm:x().optional().describe(`Small shadow`),base:x().optional().describe(`Base shadow`),md:x().optional().describe(`Medium shadow`),lg:x().optional().describe(`Large shadow`),xl:x().optional().describe(`Extra large shadow`),"2xl":x().optional().describe(`2X large shadow`),inner:x().optional().describe(`Inner shadow (inset)`)})),Wp=q(()=>k({xs:x().optional().describe(`Extra small breakpoint (e.g., 480px)`),sm:x().optional().describe(`Small breakpoint (e.g., 640px)`),md:x().optional().describe(`Medium breakpoint (e.g., 768px)`),lg:x().optional().describe(`Large breakpoint (e.g., 1024px)`),xl:x().optional().describe(`Extra large breakpoint (e.g., 1280px)`),"2xl":x().optional().describe(`2X large breakpoint (e.g., 1536px)`)})),Gp=q(()=>k({duration:k({fast:x().optional().describe(`Fast animation (e.g., 150ms)`),base:x().optional().describe(`Base animation (e.g., 300ms)`),slow:x().optional().describe(`Slow animation (e.g., 500ms)`)}).optional(),timing:k({linear:x().optional().describe(`Linear timing function`),ease:x().optional().describe(`Ease timing function`),ease_in:x().optional().describe(`Ease-in timing function`),ease_out:x().optional().describe(`Ease-out timing function`),ease_in_out:x().optional().describe(`Ease-in-out timing function`)}).optional()})),Kp=q(()=>k({base:C().optional().describe(`Base z-index (e.g., 0)`),dropdown:C().optional().describe(`Dropdown z-index (e.g., 1000)`),sticky:C().optional().describe(`Sticky z-index (e.g., 1020)`),fixed:C().optional().describe(`Fixed z-index (e.g., 1030)`),modalBackdrop:C().optional().describe(`Modal backdrop z-index (e.g., 1040)`),modal:C().optional().describe(`Modal z-index (e.g., 1050)`),popover:C().optional().describe(`Popover z-index (e.g., 1060)`),tooltip:C().optional().describe(`Tooltip z-index (e.g., 1070)`)})),qp=q(()=>P([`light`,`dark`,`auto`])),Jp=q(()=>P([`compact`,`regular`,`spacious`])),Yp=q(()=>P([`AA`,`AAA`]));q(()=>k({name:X.describe(`Unique theme identifier (snake_case)`),label:x().describe(`Human-readable theme name`),description:x().optional().describe(`Theme description`),mode:qp.default(`light`).describe(`Theme mode (light, dark, or auto)`),colors:zp.describe(`Color palette configuration`),typography:Bp.optional().describe(`Typography settings`),spacing:Vp.optional().describe(`Spacing scale`),borderRadius:Hp.optional().describe(`Border radius scale`),shadows:Up.optional().describe(`Box shadow effects`),breakpoints:Wp.optional().describe(`Responsive breakpoints`),animation:Gp.optional().describe(`Animation settings`),zIndex:Kp.optional().describe(`Z-index scale for layering`),customVars:N(x(),x()).optional().describe(`Custom CSS variables (key-value pairs)`),logo:k({light:x().optional().describe(`Logo URL for light mode`),dark:x().optional().describe(`Logo URL for dark mode`),favicon:x().optional().describe(`Favicon URL`)}).optional().describe(`Logo assets`),extends:x().optional().describe(`Base theme to extend from`),density:Jp.optional().describe(`Display density: compact, regular, or spacious`),wcagContrast:Yp.optional().describe(`WCAG color contrast level (AA or AAA)`),rtl:w().optional().describe(`Enable right-to-left layout direction`),touchTarget:kp.optional().describe(`Touch target sizing defaults`),keyboardNavigation:Rp.optional().describe(`Keyboard focus management settings`)}));var Xp=q(()=>P([`cache_first`,`network_first`,`stale_while_revalidate`,`network_only`,`cache_only`]).describe(`Data fetching strategy for offline/online transitions`)),Zp=q(()=>P([`client_wins`,`server_wins`,`manual`,`last_write_wins`]).describe(`How to resolve conflicts when syncing offline changes`)),Qp=q(()=>k({strategy:Xp.default(`network_first`).describe(`Sync fetch strategy`),conflictResolution:Zp.default(`last_write_wins`).describe(`Conflict resolution policy`),retryInterval:C().optional().describe(`Retry interval in milliseconds between sync attempts`),maxRetries:C().optional().describe(`Maximum number of sync retry attempts`),batchSize:C().optional().describe(`Number of mutations to sync per batch`)}).describe(`Offline-to-online synchronization configuration`)),$p=q(()=>P([`indexeddb`,`localstorage`,`sqlite`]).describe(`Client-side storage backend for offline cache`)),em=q(()=>P([`lru`,`lfu`,`fifo`]).describe(`Cache eviction policy`)),tm=q(()=>k({maxSize:C().optional().describe(`Maximum cache size in bytes`),ttl:C().optional().describe(`Time-to-live for cached entries in milliseconds`),persistStorage:$p.default(`indexeddb`).describe(`Storage backend`),evictionPolicy:em.default(`lru`).describe(`Cache eviction policy when full`)}).describe(`Client-side offline cache configuration`));q(()=>k({enabled:w().default(!1).describe(`Enable offline support`),strategy:Xp.default(`network_first`).describe(`Default offline fetch strategy`),cache:tm.optional().describe(`Cache settings for offline data`),sync:Qp.optional().describe(`Sync settings for offline mutations`),offlineIndicator:w().default(!0).describe(`Show a visual indicator when offline`),offlineMessage:J.optional().describe(`Customizable offline status message shown to users`),queueMaxSize:C().optional().describe(`Maximum number of queued offline mutations`)}).describe(`Offline support configuration`));var nm=q(()=>P([`fade`,`slide_up`,`slide_down`,`slide_left`,`slide_right`,`scale`,`rotate`,`flip`,`none`]).describe(`Transition preset type`)),rm=q(()=>P([`linear`,`ease`,`ease_in`,`ease_out`,`ease_in_out`,`spring`]).describe(`Animation easing function`)),im=q(()=>k({preset:nm.optional().describe(`Transition preset to apply`),duration:C().optional().describe(`Transition duration in milliseconds`),easing:rm.optional().describe(`Easing function for the transition`),delay:C().optional().describe(`Delay before transition starts in milliseconds`),customKeyframes:x().optional().describe(`CSS @keyframes name for custom animations`),themeToken:x().optional().describe(`Reference to a theme animation token (e.g. "animation.duration.fast")`)}).describe(`Animation transition configuration`)),am=q(()=>P([`on_mount`,`on_unmount`,`on_hover`,`on_focus`,`on_click`,`on_scroll`,`on_visible`]).describe(`Event that triggers the animation`)),om=q(()=>k({label:J.optional().describe(`Descriptive label for this animation configuration`),enter:im.optional().describe(`Enter/mount animation`),exit:im.optional().describe(`Exit/unmount animation`),hover:im.optional().describe(`Hover state animation`),trigger:am.optional().describe(`When to trigger the animation`),reducedMotion:P([`respect`,`disable`,`alternative`]).default(`respect`).describe(`Accessibility: how to handle prefers-reduced-motion`)}).merge(Y.partial()).describe(`Component-level animation configuration`)),sm=q(()=>k({type:nm.default(`fade`).describe(`Page transition type`),duration:C().default(300).describe(`Transition duration in milliseconds`),easing:rm.default(`ease_in_out`).describe(`Easing function for the transition`),crossFade:w().default(!1).describe(`Whether to cross-fade between pages`)}).describe(`Page-level transition configuration`));q(()=>k({label:J.optional().describe(`Descriptive label for the motion configuration`),defaultTransition:im.optional().describe(`Default transition applied to all animations`),pageTransitions:sm.optional().describe(`Page navigation transition settings`),componentAnimations:N(x(),om).optional().describe(`Component name to animation configuration mapping`),reducedMotion:w().default(!1).describe(`When true, respect prefers-reduced-motion and suppress animations globally`),enabled:w().default(!0).describe(`Enable or disable all animations globally`)}).describe(`Top-level motion and animation design configuration`));var cm=q(()=>P([`toast`,`snackbar`,`banner`,`alert`,`inline`]).describe(`Notification presentation style`)),lm=q(()=>P([`info`,`success`,`warning`,`error`]).describe(`Notification severity level`)),um=q(()=>P([`top_left`,`top_center`,`top_right`,`bottom_left`,`bottom_center`,`bottom_right`]).describe(`Screen position for notification placement`)),dm=q(()=>k({label:J.describe(`Action button label`),action:x().describe(`Action identifier to execute`),variant:P([`primary`,`secondary`,`link`]).default(`primary`).describe(`Button variant style`)}).describe(`Notification action button`));q(()=>k({type:cm.default(`toast`).describe(`Notification presentation style`),severity:lm.default(`info`).describe(`Notification severity level`),title:J.optional().describe(`Notification title`),message:J.describe(`Notification message body`),icon:x().optional().describe(`Icon name override`),duration:C().optional().describe(`Auto-dismiss duration in ms, omit for persistent`),dismissible:w().default(!0).describe(`Allow user to dismiss the notification`),actions:O(dm).optional().describe(`Action buttons`),position:um.optional().describe(`Override default position`)}).merge(Y.partial()).describe(`Notification instance definition`)),q(()=>k({defaultPosition:um.default(`top_right`).describe(`Default screen position for notifications`),defaultDuration:C().default(5e3).describe(`Default auto-dismiss duration in ms`),maxVisible:C().default(5).describe(`Maximum number of notifications visible at once`),stackDirection:P([`up`,`down`]).default(`down`).describe(`Stack direction for multiple notifications`),pauseOnHover:w().default(!0).describe(`Pause auto-dismiss timer on hover`)}).describe(`Global notification system configuration`));var fm=q(()=>P([`element`,`handle`,`grip_icon`]).describe(`Drag initiation method`)),pm=q(()=>P([`move`,`copy`,`link`,`none`]).describe(`Drop operation effect`)),mm=q(()=>k({axis:P([`x`,`y`,`both`]).default(`both`).describe(`Constrain drag axis`),bounds:P([`parent`,`viewport`,`none`]).default(`none`).describe(`Constrain within bounds`),grid:M([C(),C()]).optional().describe(`Snap to grid [x, y] in pixels`)}).describe(`Drag movement constraints`)),hm=q(()=>k({label:J.optional().describe(`Accessible label for the drop zone`),accept:O(x()).describe(`Accepted drag item types`),maxItems:C().optional().describe(`Maximum items allowed in drop zone`),highlightOnDragOver:w().default(!0).describe(`Highlight drop zone when dragging over`),dropEffect:pm.default(`move`).describe(`Visual effect on drop`)}).merge(Y.partial()).describe(`Drop zone configuration`)),gm=q(()=>k({type:x().describe(`Drag item type identifier for matching with drop zones`),label:J.optional().describe(`Accessible label describing the draggable item`),handle:fm.default(`element`).describe(`How to initiate drag`),constraint:mm.optional().describe(`Drag movement constraints`),preview:P([`element`,`custom`,`none`]).default(`element`).describe(`Drag preview type`),disabled:w().default(!1).describe(`Disable dragging`)}).merge(Y.partial()).describe(`Draggable item configuration`));q(()=>k({enabled:w().default(!1).describe(`Enable drag and drop`),dragItem:gm.optional().describe(`Configuration for draggable item`),dropZone:hm.optional().describe(`Configuration for drop target`),sortable:w().default(!1).describe(`Enable sortable list behavior`),autoScroll:w().default(!0).describe(`Auto-scroll during drag near edges`),touchDelay:C().default(200).describe(`Delay in ms before drag starts on touch devices`)}).describe(`Drag and drop interaction configuration`));var _m=q(()=>k({primaryColor:x().optional().describe(`Primary brand color (hex, rgb, hsl). Mapped to --portal-primary.`),accentColor:x().optional().describe(`Accent color used for highlights and CTAs.`),backgroundColor:x().optional().describe(`Page background color.`),surfaceColor:x().optional().describe(`Card / surface background color.`),textColor:x().optional().describe(`Primary text color.`),logoUrl:x().optional().describe(`Absolute or relative URL to the portal header logo (SVG or PNG).`),faviconUrl:x().optional().describe(`Absolute or relative URL to the portal favicon.`),fontFamily:x().optional().describe(`CSS font-family stack for the portal.`),customCss:x().optional().describe(`OPTIONAL escape hatch: raw CSS appended last. Discouraged; prefer tokens.`)})),vm=k({id:X.describe(`Unique identifier for this portal nav item (lowercase snake_case).`),label:J.describe(`Display label.`),icon:x().optional().describe(`Icon name (Lucide).`),order:C().optional().describe(`Sort order; lower appears first.`),badge:A([x(),C()]).optional().describe(`Optional badge (e.g. unread count).`)}),ym=j(`type`,[vm.extend({type:F(`view`),viewRef:x().describe(`Reference to an existing view, e.g. "helpdesk_ticket.list.my_tickets".`)}),vm.extend({type:F(`action`),actionRef:x().describe(`Reference to an existing action, e.g. "helpdesk_ticket.create".`)}),vm.extend({type:F(`dashboard`),dashboardName:X.describe(`Existing dashboard id.`)}),vm.extend({type:F(`url`),url:x().describe(`Absolute or root-relative URL.`),target:P([`_self`,`_blank`]).optional().default(`_self`)})]),bm=q(()=>k({rule:x().describe(`Rate-limit rule string, e.g. "5/hour/ip", "100/day/tenant".`),scope:P([`ip`,`tenant`,`route`]).default(`ip`).describe(`Counter scope. "ip" buckets per requester; "tenant" per portal owner; "route" global per route.`)})),xm=q(()=>k({path:x().describe(`Path within the portal, e.g. "/submit" or "/kb".`),viewRef:x().optional().describe(`Reference to a public view (read-only).`),actionRef:x().optional().describe(`Reference to an action to perform anonymously (mutation).`),rateLimit:bm.optional().describe(`Rate-limit for anonymous traffic on this route.`),captcha:w().optional().default(!1).describe(`Require CAPTCHA / proof-of-work challenge before invoking.`),bindIdentityFromField:x().optional().describe(`Field name on the action input to use for magic-link identity binding (e.g. "customer_email").`)})),Sm=q(()=>k({routes:O(xm).describe(`List of anonymous-accessible routes.`),defaultRateLimit:bm.optional()})),Cm=q(()=>k({title:x().optional().describe(`Default <title>.`),description:x().optional().describe(`Default <meta name="description">.`),openGraphImage:x().optional().describe(`Default og:image URL.`),robots:P([`index`,`noindex`]).optional().default(`index`)})),wm=q(()=>A([F(`authenticated`),F(`magic-link`),F(`anonymous`),x().regex(/^sso:[a-z][a-z0-9_-]*(?::[a-z0-9_-]+)?$/i,`SSO mode must be "sso:<provider>" or "sso:<protocol>:<idp-id>"`)])),Tm=q(()=>A([F(`console`),F(`minimal`),F(`embedded`),x().regex(/^custom:[a-z][a-z0-9_-]*(?:\/[a-z0-9_-]+)?$/i,`Custom layout must be "custom:<plugin-id>" or "custom:<plugin-id>/<layout-id>"`)]));q(()=>k({kind:F(`portal`).describe(`Metadata kind discriminator.`),id:X.describe(`Portal unique machine name (lowercase snake_case).`),label:J.describe(`Portal display label.`),description:J.optional(),routePrefix:x().regex(/^\/[a-z0-9/_-]*$/i,`routePrefix must start with "/" and be url-safe`).describe(`Root URL path for the portal (must start with "/").`),domain:x().optional().describe(`Optional vanity domain (e.g. "support.acme.com").`),layout:Tm.default(`minimal`).describe(`Shell layout for the portal.`),theme:_m.optional().describe(`Theme tokens.`),locale:A([F(`auto`),x()]).optional().default(`auto`).describe(`Locale resolution strategy.`),seo:Cm.optional(),authMode:wm.default(`authenticated`).describe(`Authentication mode for the portal.`),profiles:O(X).min(1,`A portal must admit at least one profile (use a dedicated profile for "anonymous-only" portals).`).describe(`Profiles admitted to the portal.`),anonymousEntry:Sm.optional(),navigation:O(ym).describe(`Flat list of portal entry points (references to existing metadata).`),defaultRoute:k({viewRef:x().optional(),actionRef:x().optional(),dashboardName:X.optional()}).optional().describe(`Landing surface when the user hits the portal root.`),embeddable:w().optional().default(!1),allowedEmbedOrigins:O(x()).optional(),active:w().optional().default(!0)}));export{ya as S,x as _,ho as a,E as b,is as c,F as d,yo as f,To as g,N as h,ss as i,j as l,k as m,Qu as n,O as o,C as p,P as r,w as s,_f as t,I as u,M as v,ja as x,A as y};