twenty 2.61.0 → 2.63.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app-template/yarn.lock +22 -22
- package/dist/app-worker.cjs +1 -1
- package/dist/chunks/{build-source-manifest-DQ5YF5PV.cjs → build-source-manifest-CxHynmsg.cjs} +1 -1
- package/dist/chunks/{build-source-snapshot-DIjGWX_5.cjs → build-source-snapshot-CNYcI3lA.cjs} +7 -7
- package/dist/chunks/{cli-version.constant-Dn-WFWf8.cjs → cli-version.constant-ol3Ctp_7.cjs} +1 -1
- package/dist/chunks/compile-application-translations-H-I23n4l.cjs +58 -0
- package/dist/chunks/create-metadata-client-BITefgbL.cjs +6 -0
- package/dist/chunks/{extract-manifest-from-file-B3pazFD1.cjs → extract-manifest-from-file-KLaAvTnC.cjs} +9 -1
- package/dist/chunks/extract-source-translations-DMxAPQGT.cjs +1 -0
- package/dist/chunks/{fetch-metadata-inspection-DN8am1j0.cjs → fetch-metadata-inspection-BitnLMsU.cjs} +1 -1
- package/dist/chunks/{fetch-signed-in-identity-kgzejZg2.cjs → fetch-signed-in-identity-Chv2DXkd.cjs} +1 -1
- package/dist/chunks/{fetch-workspace-or-throw-BIu0K3A-.cjs → fetch-workspace-or-throw-DI5HKKWN.cjs} +1 -1
- package/dist/chunks/{get-client-generation-skip-reason-C_oaO89K.cjs → get-client-generation-skip-reason-cLYKdg9t.cjs} +1 -1
- package/dist/chunks/{global-flags.constant-JcdNC5G1.cjs → global-flags.constant-jbTPGUzd.cjs} +1 -1
- package/dist/chunks/{is-valid-package-name-o_jWsuUX.cjs → is-valid-package-name-Dsoc-rVq.cjs} +1 -1
- package/dist/chunks/kebab-case-tmo--p0I.cjs +1 -0
- package/dist/chunks/pull-minimum-sdk-version.constant-DJS72Nbz.cjs +6 -0
- package/dist/chunks/{pull-source-B5Hot5CI.cjs → pull-source-BR9wkaXA.cjs} +1 -1
- package/dist/chunks/{read-application-identifier-BlEwa2gR.cjs → read-application-identifier-BFC_sHg4.cjs} +1 -1
- package/dist/chunks/{read-application-identity-CYKNL1g5.cjs → read-application-identity-CxmrWgYf.cjs} +1 -1
- package/dist/chunks/{read-infer-deletion-option-DeyWsiCS.cjs → read-infer-deletion-option-CvBiu59G.cjs} +1 -1
- package/dist/chunks/{read-source-identity-bo4jC2Dh.cjs → read-source-identity-D_wD1tkE.cjs} +1 -1
- package/dist/chunks/{record-pull-base-DKrQDDmc.cjs → record-pull-base-C97pZrKE.cjs} +1 -1
- package/dist/chunks/{resolve-command-target-B9QG8OZs.cjs → resolve-command-target-BcuWptbH.cjs} +1 -1
- package/dist/chunks/{run-app-add-command-De3cIhU0.cjs → run-app-add-command-BuoyG82_.cjs} +1 -1
- package/dist/chunks/{run-app-apply-command-BXVHKrW3.cjs → run-app-apply-command-BFIPn04H.cjs} +1 -1
- package/dist/chunks/{run-app-build-command-BMwzOOov.cjs → run-app-build-command-BL5z2pAy.cjs} +1 -1
- package/dist/chunks/{run-app-dev-command-Bg4zIJnX.cjs → run-app-dev-command-BcfV3DE-.cjs} +1 -1
- package/dist/chunks/{run-app-exec-command-BOhA0aZN.cjs → run-app-exec-command-C17xcKow.cjs} +1 -1
- package/dist/chunks/{run-app-generate-client-command-B7p5M_hN.cjs → run-app-generate-client-command-BV5PTy_i.cjs} +1 -1
- package/dist/chunks/{run-app-init-command-DJ0UipFh.cjs → run-app-init-command-S9bUinGS.cjs} +1 -1
- package/dist/chunks/{run-app-install-command-CsK8l0Ou.cjs → run-app-install-command-Cq9Jobbj.cjs} +1 -1
- package/dist/chunks/{run-app-operation-B4JecUV7.cjs → run-app-operation-CuZ4m1fm.cjs} +1 -1
- package/dist/chunks/{run-app-plan-command-hASkfDaJ.cjs → run-app-plan-command-DaSA-Hil.cjs} +1 -1
- package/dist/chunks/{run-app-publish-command-ClsjL5OP.cjs → run-app-publish-command-2AWr5rt6.cjs} +1 -1
- package/dist/chunks/{run-app-pull-command-BfHIuJ1m.cjs → run-app-pull-command-BESAEuyX.cjs} +1 -1
- package/dist/chunks/{run-app-typecheck-command--4NoTac-.cjs → run-app-typecheck-command-CIFFgU2u.cjs} +1 -1
- package/dist/chunks/{run-app-uninstall-command-ClRoCRjv.cjs → run-app-uninstall-command-Dhfci1zL.cjs} +1 -1
- package/dist/chunks/{run-auth-login-command-p9VHNoqZ.cjs → run-auth-login-command-sYroS-oN.cjs} +1 -1
- package/dist/chunks/{run-auth-status-command-CdqOc2-Q.cjs → run-auth-status-command-DTOLTpcS.cjs} +1 -1
- package/dist/chunks/{run-cli-CgBPkP_r.cjs → run-cli-CtNeoYdv.cjs} +1 -1
- package/dist/chunks/{run-commands-command-BF3y7Dz2.cjs → run-commands-command-Df3vekbG.cjs} +1 -1
- package/dist/chunks/{run-data-export-command-ca_JYOnT.cjs → run-data-export-command-D8bi-_eQ.cjs} +1 -1
- package/dist/chunks/{run-data-get-command-BZTsbTvb.cjs → run-data-get-command-AoCO8VBs.cjs} +1 -1
- package/dist/chunks/{run-data-list-command-UI5hngdt.cjs → run-data-list-command-CMi1OeBV.cjs} +1 -1
- package/dist/chunks/{run-doctor-command-B_bcpjAT.cjs → run-doctor-command-VaRt9-ya.cjs} +1 -1
- package/dist/chunks/{run-metadata-field-describe-command-CH7Yob_y.cjs → run-metadata-field-describe-command-vgmY2Cjn.cjs} +1 -1
- package/dist/chunks/{run-metadata-field-list-command-BzxIj9tX.cjs → run-metadata-field-list-command-CVlFGJBc.cjs} +1 -1
- package/dist/chunks/{run-metadata-object-describe-command-BF9FzF06.cjs → run-metadata-object-describe-command-CjC9TIBb.cjs} +1 -1
- package/dist/chunks/{run-metadata-object-list-command-Tk_Fjfc5.cjs → run-metadata-object-list-command-BkffcdhV.cjs} +1 -1
- package/dist/chunks/{run-open-command-BldBUk02.cjs → run-open-command-DFlEdJCd.cjs} +1 -1
- package/dist/chunks/{run-version-command-B_6F7XYT.cjs → run-version-command-CCBLrCKu.cjs} +1 -1
- package/dist/chunks/{sign-in-to-remote-again-BqU_-38L.cjs → sign-in-to-remote-again-BhnOemXJ.cjs} +1 -1
- package/dist/chunks/standard-object-fields.constant-BxrNzIwQ.cjs +1 -0
- package/dist/cli.cjs +1 -1
- package/package.json +2 -2
- package/dist/chunks/compile-application-translations-CDykMbFf.cjs +0 -58
- package/dist/chunks/create-metadata-client-CrOsu4u3.cjs +0 -6
- package/dist/chunks/extract-source-translations-b9c2CH4w.cjs +0 -1
- package/dist/chunks/kebab-case-B3kq7ANN.cjs +0 -1
- package/dist/chunks/pull-minimum-sdk-version.constant-DOAFtDDD.cjs +0 -6
- package/dist/chunks/standard-object-fields.constant-CA16BdJ2.cjs +0 -1
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
const e=require("./rolldown-runtime-mLOUI7ql.cjs"),t=require("./build--4zYt4wd.cjs"),n=require("./isDefined-CJctgvfE.cjs"),r=require("./isNonEmptyArray-v52xg4Xj.cjs"),i=require("./isPlainObject-fJEJm71P.cjs"),a=require("./get-field-universal-identifier.util-d1401qKf.cjs"),o=require("./standard-object-fields.constant-BxrNzIwQ.cjs"),s=require("./is-supported-locale-DUMI9QQ2.cjs"),c=require("./isValidUniversalIdentifier-DymFerYs.cjs"),l=require("./locale-catalog-format-BD4XDEnl.cjs"),u=require("./fs-utils-BcNux7fF.cjs"),d=require("./AssetDirectory-c_JEwMr2.cjs"),f=require("./TwentyStandardApplicationUniversalIdentifier-Cm4vo0D3.cjs"),p=require("./extract-manifest-from-file-KLaAvTnC.cjs"),m=require("./get-engine-version-range-DZGIWoR6.cjs"),h=require("./constants-Cf5-CwMu.cjs");let ee=require("node:fs/promises"),g=require("node:path");g=e.r(g,1);let te=require("tinyglobby"),_=require("typescript");_=e.r(_);let v=require("path");v=e.r(v);var y=t.t(),ne=(e,t)=>{throw Error(t??`Didn't expect to get here.`)};function re(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 ie(e,t=`|`){return e.map(e=>Oe(e)).join(t)}function ae(e,t){return typeof t==`bigint`?t.toString():t}var oe=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function se(e){return new oe(e)}function ce(e){return e==null}function le(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function ue(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}function de(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function fe(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function pe(e){return fe(e._zod.def)??e._zod.def.shape}function me(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return de(this,t,e),e},enumerable:!0,configurable:!0})}function he(e,t,n){t in e?de(e,t,n):e[t]=n}function ge(e,t,n,r){let i=pe(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?me(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):he(e,a,r?r(n.value,a):n.value))}}function _e(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?me(e,n,()=>t[n]):he(e,n,r.value))}}function b(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function ve(e){return JSON.stringify(e)}function ye(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var be=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function xe(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Se=se(()=>{if(gt.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function Ce(e){if(xe(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(xe(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function we(e){return Ce(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var Te=new Set([`string`,`number`,`symbol`]);function Ee(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function De(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function x(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 Oe(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function ke(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var Ae={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},je={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function Me(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`);let i={};return ge(i,e,Ne(e,t)),De(e,b(n,{shape:i,checks:[]}))}function Ne(e,t){let n=pe(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function Pe(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`);let i=new Set(Ne(e,t)),a={};return ge(a,e,Reflect.ownKeys(pe(e)).filter(e=>!i.has(e))),De(e,b(n,{shape:a,checks:[]}))}function Fe(e,t){if(!Ce(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=pe(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return De(e,b(e._zod.def,{shape:Ie(e,t)}))}function Ie(e,t){let n={};return ge(n,e,Reflect.ownKeys(pe(e))),_e(n,t),n}function Le(e,t){if(!Ce(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return De(e,b(e._zod.def,{shape:Ie(e,t)}))}function Re(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return ge(n,e,Reflect.ownKeys(pe(e))),ge(n,t,Reflect.ownKeys(pe(t))),De(e,b(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function ze(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(Ne(t,n)):void 0,o={};return ge(o,t,Reflect.ownKeys(pe(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),De(t,b(t._zod.def,{shape:o,checks:[]}))}function Be(e,t,n){let r=n?new Set(Ne(t,n)):void 0,i={};return ge(i,t,Reflect.ownKeys(pe(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),De(t,b(t._zod.def,{shape:i}))}function Ve(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 He(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 Ue(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function We(e){return typeof e==`string`?e:e?.message}function Ge(e){let t=[];for(let n of e??[]){let e=n._zod.def;if(!/_(length|size)$|_equals$/.test(e.check))break;let r=e.maximum??e.length??e.size;r>=0&&t.push([r,n])}return t}function Ke(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function qe(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:We(e.inst?._zod.def?.error?.(e))??We(a?.(e))??We(t?.error?.(e))??We(n.customError?.(e))??We(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t===`inst`||t===`schema`||t===`continue`||t===`input`||t===`__proto__`||(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}var Je=/[\uD800-\uDBFF]/;function Ye(e){let t=e.length;if(!Je.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function Xe(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Ze(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function Qe(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function $e(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):nt(e,n,r.value)}}function et(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function tt(e,t,n){return et(e,t,n,!1)}function S(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return et(this,n,r(this))},set(e){et(this,n,e)}})}return t}function nt(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:et(this,t,n.bind(this))},set(e){et(this,t,e)}})}function rt(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var it,at=!1,ot={configurable:!0,get(){at=!0}};function C(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&it!==e._zod){it=void 0;return}it=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,ot);let e=at;at=!1;try{let r=n(this);return at?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),at||=e,r}catch(n){throw delete this[t],at||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}function st(e,t,n,r){let i=rt(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}var ct=`~constantCatch`;function lt(e){let t=()=>e;return t[ct]=!0,t}var ut,dt={value:void 0,enumerable:!1},ft=`captureStackTrace`in Error?Error:null;function pt(e){let t=ft;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return ft=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function w(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){dt.value=new a(r);try{Object.defineProperty(n,"_zod",dt)}finally{dt.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),$e(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?pt(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var mt=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},ht=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(ut=globalThis).__zod_globalConfig??(ut.__zod_globalConfig={});var gt=globalThis.__zod_globalConfig;function _t(e){return e&&Object.assign(gt,e),gt}function vt(){let e=this._zod;return e.message??=JSON.stringify(e.def,ae,2),e.message}function yt(e){this._zod.message=e}var bt={get:vt,set:yt,enumerable:!0,configurable:!0},xt={value:void 0,enumerable:!1},St=new WeakSet([Object.prototype,Error.prototype]),Ct=(e,t)=>{e.name=`$ZodError`,xt.value=t,Object.defineProperty(e,"issues",xt),xt.value=void 0,Object.defineProperty(e,"message",bt);let n=Object.getPrototypeOf(e);St.has(n)||(St.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},wt=w(`$ZodError`,Ct);w(`$ZodError`,Ct,void 0,{Parent:Error});function Tt(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function Et(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?Tt(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Dt(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],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function Ot(e,t){return{callee:t?.callee??e,Err:t?.Err}}var kt=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new mt;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>qe(e,o,_t())));throw be(n,a?.callee??t),n}return s.value};return t},At=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>qe(e,o,_t())));throw be(n,a?.callee??t),n}return s.value};return t},jt=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new mt;return a.issues.length?Mt(e,a.issues,i):{success:!0,data:a.value}};function Mt(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>qe(e,n,_t()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}var Nt=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?Mt(e,a.issues,i):{success:!0,data:a.value}},Pt=Symbol.for(`zod.compile.invalid`),Ft=Symbol.for(`zod.compile.fallback`),It=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==Pt)return!0;if(r.definite===!0&&n===void 0)return!1}return Lt(e,t,n)});function Lt(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[Ft]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new mt;return a.issues.length===0}var Rt=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},zt=e=>{let t=kt(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,Ot(n,a))};return n},Bt=e=>{let t=kt(e),n=(e,r,i,a)=>t(e,r,i,Ot(n,a));return n},Vt=e=>{let t=At(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,Ot(n,a))};return n},Ht=e=>{let t=At(e),n=async(e,r,i,a)=>await t(e,r,i,Ot(n,a));return n},Ut=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return jt(e)(t,n,i)},Wt=e=>(t,n,r)=>jt(e)(t,n,r),Gt=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Nt(e)(t,n,i)},Kt=e=>async(t,n,r)=>Nt(e)(t,n,r),qt=/^[cC][0-9a-z]{6,}$/,Jt=/^[0-9a-z]+$/,Yt=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Xt=/^[0-9a-vA-V]{20}$/,Zt=/^[A-Za-z0-9]{27}$/,Qt=/^[a-zA-Z0-9_-]{21}$/;function $t(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var en=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,tn=/^([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})$/,nn=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)$/,rn=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,an=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function on(){return new RegExp(an,`u`)}var sn=/^(?:(?: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])$/,cn=/^(([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}|:))$/,ln=/^((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])$/,un=/^(([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}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,dn=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,fn=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,pn=/^https?$/,mn=/^\+[1-9]\d{6,14}$/,hn=`(?:(?:\\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])))`;function gn(e){return RegExp(`^${e}$`)}var _n=gn(hn);function vn(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}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function yn(e){return RegExp(`^${vn(e)}$`)}function bn(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${vn({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${vn({precision:e.precision})}`:n;return RegExp(`^${hn}T(?:${r})$`)}var xn=/^[\s\S]{0,}$/,Sn=/^-?\d+(?:\.\d+)?$/,Cn=/^[^A-Z]*$/,wn=/^[^a-z]*$/,Tn=w(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),En=e=>{let t=e.value;return!ce(t)&&t.length!==void 0},Dn={number:`number`,bigint:`bigint`,object:`date`},On=w(`$ZodCheckLessThan`,(e,t)=>{Tn.init(e,t);let n=Dn[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:Dn[typeof r.value]??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})}}),kn=w(`$ZodCheckGreaterThan`,(e,t)=>{Tn.init(e,t);let n=Dn[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:Dn[typeof r.value]??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})}}),An=w(`$ZodCheckMultipleOf`,(e,t)=>{Tn.init(e,t),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`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):ue(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})}}),jn=w(`$ZodCheckNumberFormat`,(e,t)=>{Tn.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Ae[t.format];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})}}),Mn=w(`$ZodCheckMaxLength`,(e,t)=>{var n;Tn.init(e,t),(n=e._zod.def).when??(n.when=En),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?Ye(r):i)<=t.maximum)return;let a=Xe(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Nn=w(`$ZodCheckMinLength`,(e,t)=>{var n;Tn.init(e,t),(n=e._zod.def).when??(n.when=En),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?Ye(r):i)>=t.minimum)return;let a=Xe(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Pn=w(`$ZodCheckLengthEquals`,(e,t)=>{var n;Tn.init(e,t),(n=e._zod.def).when??(n.when=En),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?Ye(r):i;if(a===t.length)return;let o=Xe(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Fn=w(`$ZodCheckStringFormat`,(e,t)=>{var n,r;Tn.init(e,t),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=()=>{})}),In=w(`$ZodCheckRegex`,(e,t)=>{Fn.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})}}),Ln=w(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Cn,Fn.init(e,t)}),Rn=w(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=wn,Fn.init(e,t)}),zn=w(`$ZodCheckIncludes`,(e,t)=>{Tn.init(e,t);let n=Ee(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),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})}}),Bn=w(`$ZodCheckStartsWith`,(e,t)=>{Tn.init(e,t);let n=RegExp(`^${Ee(t.prefix)}.*`);t.pattern??=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})}}),Vn=w(`$ZodCheckEndsWith`,(e,t)=>{Tn.init(e,t);let n=RegExp(`.*${Ee(t.suffix)}$`);t.pattern??=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})}}),Hn=w(`$ZodCheckOverwrite`,(e,t)=>{Tn.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Un=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--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?.content??[``];return new e(...Object.keys(this.closed),`return function (${this.args.join(`, `)}) {\n${t.join(`
|
|
3
|
+
`)}\n};`)(...Object.values(this.closed))}},Wn={major:4,minor:6,patch:7},T=w(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Wn;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];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=(t,n,r)=>{if(t.memo)return t;let i=Ve(t),a;for(let o of n){if(o._zod.def.when){if(He(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new mt;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(Ke(t.issues,n,e),i||=Ve(t,n))});else{if(t.issues.length===n)continue;Ke(t.issues,n,e),i||=Ve(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(Ve(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new mt;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new mt;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return tt(this,`~standard`,qn(this))},set"~standard"(e){et(this,`~standard`,e)}}),Gn=(e,t)=>e.issues.length?{issues:e.issues.map(e=>qe(e,t,_t()))}:{value:e.value};async function Kn(e,t){let n={async:!0};return Gn(await e._zod.run({value:t,issues:[]},n),n)}function qn(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return Gn(r,n)}catch{}return Kn(e,t)},vendor:`zod`,version:1}}var Jn=w(`$ZodString`,(e,t)=>{T.init(e,t),e._zod.pattern=t.pattern??xn,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}}),E=w(`$ZodStringFormat`,(e,t)=>{Fn.init(e,t),Jn.init(e,t)}),Yn=w(`$ZodGUID`,(e,t)=>{t.pattern??=tn,E.init(e,t)}),Xn=w(`$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??=nn(e)}else t.pattern??=nn();E.init(e,t)}),Zn=w(`$ZodEmail`,(e,t)=>{t.pattern??=rn,E.init(e,t)});function Qn(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function $n(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?Qn(e)||2:er(e,t)}function er(e,t){if(!t.normalize&&t.protocol?.source===pn.source&&!/^https?:\/\//i.test(e))return 1;try{if(typeof URL<`u`){let t=URL;if(typeof t.parse==`function`)return t.parse(e)??2}return new URL(e)}catch{return 2}}var tr=/[\t\n\r]/g;function nr(e){return e.replace(tr,``)}function rr(e,t){return t.lastIndex=0,t.test(e.hostname)}function ir(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}var ar=w(`$ZodURL`,(e,t)=>{E.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=$n(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=nr(r);return}t.hostname&&!rr(i,t.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&&!ir(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:nr(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),or=w(`$ZodEmoji`,(e,t)=>{t.pattern??=on(),E.init(e,t)}),sr=w(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?Qt:$t(t.length),E.init(e,t)}),cr=w(`$ZodCUID`,(e,t)=>{t.pattern??=qt,E.init(e,t)}),lr=w(`$ZodCUID2`,(e,t)=>{t.pattern??=Jt,E.init(e,t)}),ur=w(`$ZodULID`,(e,t)=>{t.pattern??=Yt,E.init(e,t)}),dr=w(`$ZodXID`,(e,t)=>{t.pattern??=Xt,E.init(e,t)}),fr=w(`$ZodKSUID`,(e,t)=>{t.pattern??=Zt,E.init(e,t)}),pr=w(`$ZodISODateTime`,(e,t)=>{t.pattern??=bn(t),E.init(e,t)}),mr=w(`$ZodISODate`,(e,t)=>{t.pattern??=_n,E.init(e,t)}),hr=w(`$ZodISOTime`,(e,t)=>{t.pattern??=yn(t),E.init(e,t)}),gr=w(`$ZodISODuration`,(e,t)=>{t.pattern??=en,E.init(e,t)}),_r=w(`$ZodIPv4`,(e,t)=>{t.pattern??=sn,E.init(e,t)}),vr=/^[0-9a-fA-F:.]+$/;function yr(e){return vr.test(e)?Qn(`http://[${e}]`):!1}var br=w(`$ZodIPv6`,(e,t)=>{t.pattern??=cn,E.init(e,t),e._zod.check=n=>{yr(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),xr=w(`$ZodCIDRv4`,(e,t)=>{t.pattern??=ln,E.init(e,t)});function Sr(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:yr(n)}var Cr=w(`$ZodCIDRv6`,(e,t)=>{t.pattern??=un,E.init(e,t),e._zod.check=n=>{Sr(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function wr(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var Tr=/^[0-9a-zA-Z+/]*={0,2}$/,Er=w(`$ZodBase64`,(e,t)=>{t.pattern??=Tr,E.init(e,t),e._zod.check=n=>{wr(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),Dr=/^[A-Za-z0-9_-]*$/;function Or(e){if(!Dr.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return wr(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var kr=w(`$ZodBase64URL`,(e,t)=>{t.pattern??=Dr,E.init(e,t),e._zod.check=n=>{Or(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Ar=w(`$ZodE164`,(e,t)=>{t.pattern??=mn,E.init(e,t)});function jr(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 Mr=w(`$ZodJWT`,(e,t)=>{E.init(e,t),e._zod.check=n=>{jr(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Nr=w(`$ZodNumber`,(e,t)=>{T.init(e,t),e._zod.pattern=Sn,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:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),Pr=w(`$ZodNumberFormat`,(e,t)=>{jn.init(e,t),Nr.init(e,t)}),Fr=w(`$ZodUnknown`,(e,t)=>{T.init(e,t),e._zod.parse=e=>e}),Ir=w(`$ZodNever`,(e,t)=>{T.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function Lr(e,t){let n=Ge(e._zod.def.checks);if(!n.length)return;let r=Math.min(...n.map(e=>e[0])),i=e._zod.parse;e._zod.parse=(n,a)=>{let o=t(n.value);if(o>r&&!a?.skipChecks&&a?.direction!==`backward`){for(let[t,r]of Ge(e._zod.def.checks))if(o>t&&r._zod.def.when(n)){let t=n.issues.length;return r._zod.check(n),n.issues[t].continue=!1,Ke(n.issues,t,e),n}}return i(n,a)}}var Rr=e=>Array.isArray(e)?e.length:-1;function zr(e,t,n){e.issues.length&&t.issues.push(...Ue(n,e.issues)),t.value[n]=e.value}var Br=w(`$ZodArray`,(e,t)=>{T.init(e,t);let n=gt.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;e<a.length;e++){let n=a[e],c=t.element._zod.run({value:n,issues:[]},i);if(c instanceof Promise)o.push(c.then(t=>zr(t,r,e)));else if(zr(c,r,e),s&&c.issues.length!==0&&Ve(c))break}return o.length?Promise.all(o).then(()=>r):r},Lr(e,Rr)});function Vr(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(!(!o&&s&&i===`optional`)){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...Ue(n,e.issues))}if(!o&&i===void 0){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}var Hr=[];function Ur(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:Hr,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=ke(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function Wr(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if(Ve(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>Vr(e,n,i,t,d,f))):Vr(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}var Gr=w(`$ZodObject`,(e,t)=>{T.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}let i=se(()=>Ur(t));C(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||de(n,e,new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let a=xe,o=t.catchall,s,c=gt.memoizer;c?.attach(e),e._zod.parse=(t,n)=>{s??=i.value;let r=t.value;if(!a(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=c?c.alloc(e,t,{},n):{};let l=[],u=s.shape,d=n?.abortEarly,f=t.issues.length;for(let e of s.allKeys){if(d&&t.issues.length!==f){if(Ve(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let i=u[e],a=i._zod.optin,o=i._zod.optout,s=i._zod.run({value:r[e],issues:[]},n);s instanceof Promise?l.push(s.then(n=>Vr(n,t,e,r,a,o))):Vr(s,t,e,r,a,o)}return o?Wr(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}}),Kr=w(`$ZodObjectJIT`,(e,t)=>{Gr.init(e,t);let n=e._zod.parse,r=se(()=>Ur(t)),i=gt.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new Un([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
|
|
4
|
+
let ${e}_ab = false;
|
|
5
|
+
for (let i = 0; i < ${e}.issues.length; i++) {
|
|
6
|
+
const iss = ${e}.issues[i];
|
|
7
|
+
iss.path = iss.path ? [${t}, ...iss.path] : [${t}];
|
|
8
|
+
payload.issues.push(iss);
|
|
9
|
+
if (iss.continue !== true) ${e}_ab = true;
|
|
10
|
+
}
|
|
11
|
+
if (${e}_ab && ctx && ctx.abortEarly) {
|
|
12
|
+
payload.value = newResult;
|
|
13
|
+
return payload;
|
|
14
|
+
}`;o.write(`const input = payload.value;`);let l=Object.create(null),u=0;for(let e of n.allKeys)l[e]=`key_${u++}`;o.write(i?`const newResult = memo.alloc(inst, payload, {}, ctx);`:`const newResult = {};`);for(let e of n.allKeys){if(e===`__proto__`)continue;let n=l[e],r=typeof e==`symbol`?`syms[${a.indexOf(e)}]`:ve(e),i=`${r} in input`,u=t[e],d=u?._zod?.optin,f=d!==void 0,p=u?._zod?.optout===`optional`;if(o.write(`const ${n} = ${s(r)};`),f&&p){let e=d===`optional`?`${n}_present`:`${n}.value !== undefined || ${n}_present`;o.write(`
|
|
15
|
+
const ${n}_present = ${i};
|
|
16
|
+
if (!${n}.issues.length || ${n}_present) {
|
|
17
|
+
if (${n}.issues.length) {${c(n,r)}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (${e}) {
|
|
21
|
+
newResult[${r}] = ${n}.value;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
`)}else f?(o.write(`
|
|
26
|
+
if (${n}.issues.length) {${c(n,r)}
|
|
27
|
+
}
|
|
28
|
+
`),d===`defaulted`?o.write(`newResult[${r}] = ${n}.value;`):o.write(`
|
|
29
|
+
if (${n}.value !== undefined || ${i}) {
|
|
30
|
+
newResult[${r}] = ${n}.value;
|
|
31
|
+
}
|
|
32
|
+
`)):o.write(`
|
|
33
|
+
const ${n}_present = ${i};
|
|
34
|
+
if (${n}.issues.length) {${c(n,r)}
|
|
35
|
+
}
|
|
36
|
+
if (!${n}_present && !${n}.issues.length) {
|
|
37
|
+
payload.issues.push({
|
|
38
|
+
code: "invalid_type",
|
|
39
|
+
expected: "nonoptional",
|
|
40
|
+
input: undefined,
|
|
41
|
+
path: [${r}]
|
|
42
|
+
});
|
|
43
|
+
if (ctx && ctx.abortEarly) {
|
|
44
|
+
payload.value = newResult;
|
|
45
|
+
return payload;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (${n}_present) {
|
|
50
|
+
newResult[${r}] = ${n}.value;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
`)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=xe,c=!gt.jitless,l=c&&Se.value,u=t.catchall,d;e._zod.parse=(i,f)=>{d??=r.value;let p=i.value;return s(p)?c&&l&&f?.async===!1&&f.jitless!==!0?(o||=a(t.shape),i=o(i,f),u?Wr([],p,i,f,d,e,f?.abortEarly===!0):i):n(i,f):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function qr(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=>!Ve(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=>qe(e,r,_t())))}),t)}var Jr=w(`$ZodUnion`,(e,t)=>{T.init(e,t),C(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),C(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),C(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),C(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>le(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=>qr(t,r,e,i)):qr(o,r,e,i)}}),Yr=w(`$ZodIntersection`,(e,t)=>{T.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])=>Zr(e,t,n)):Zr(e,i,a)}});function Xr(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Ce(e)&&Ce(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=Xr(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=Xr(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 Zr(e,t,n){let r=new Map,i,a=new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=Xr(t.value,n.value);if(!c.valid){if(Ve(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var Qr=w(`$ZodEnum`,(e,t)=>{T.init(e,t);let n=re(t.entries),r=new Set(n);e._zod.values=r,C(e,`pattern`,e=>{let t=re(e.def.entries).filter(e=>Te.has(typeof e));return RegExp(t.length?`^(${t.map(e=>Ee(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),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}}),$r=w(`$ZodLiteral`,(e,t)=>{T.init(e,t);let n=new Set(t.values);e._zod.values=n,C(e,`pattern`,e=>{let t=e.def.values;return RegExp(t.length?`^(${t.map(e=>typeof e==`string`?Ee(e):e?Ee(e.toString()):String(e)).join(`|`)})$`:`^[^\\s\\S]$`)}),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}}),ei=w(`$ZodTransform`,(e,t)=>{T.init(e,t),e._zod.optin=`optional`,gt.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new ht(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new mt;return n.value=i,n}});function ti(e,t){return e.value=t.issues.length?void 0:t.value,e}var ni=w(`$ZodOptional`,(e,t)=>{T.init(e,t),C(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,C(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),C(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${le(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>ti(e,t)):ti(e,r)}return t.innerType._zod.run(e,n)}}),ri=w(`$ZodExactOptional`,(e,t)=>{ni.init(e,t),C(e,`values`,e=>e.def.innerType._zod.values),C(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),ii=w(`$ZodNullable`,(e,t)=>{T.init(e,t),C(e,`optin`,e=>e.def.innerType._zod.optin),C(e,`optout`,e=>e.def.innerType._zod.optout),C(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${le(t.source)}|null)$`):void 0}),C(e,`values`,e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),ai=w(`$ZodDefault`,(e,t)=>{T.init(e,t),e._zod.optin=`defaulted`,C(e,`values`,e=>e.def.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=>oi(e,t)):oi(r,t)}});function oi(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var si=w(`$ZodPrefault`,(e,t)=>{T.init(e,t),e._zod.optin=`defaulted`,C(e,`values`,e=>e.def.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))}),ci=w(`$ZodNonOptional`,(e,t)=>{T.init(e,t),C(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].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=>li(t,e)):li(i,e)}});function li(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function ui(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>qe(e,r,_t()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var di=w(`$ZodCatch`,(e,t)=>{T.init(e,t),C(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),C(e,`optout`,e=>e.def.innerType._zod.optout),C(e,`values`,e=>e.def.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({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>ui(e,r,t,n)):ui(e,r,t,n)}}),fi=w(`$ZodPipe`,(e,t)=>{T.init(e,t),C(e,`values`,e=>e.def.in._zod.values),C(e,`optin`,e=>e.def.in._zod.optin),C(e,`optout`,e=>e.def.out._zod.optout),C(e,`propValues`,e=>e.def.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=>pi(e,t.in,n)):pi(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>pi(e,t.out,n)):pi(r,t.out,n)}});function pi(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var mi=w(`$ZodReadonly`,(e,t)=>{T.init(e,t),C(e,`propValues`,e=>e.def.innerType._zod.propValues),C(e,`values`,e=>e.def.innerType._zod.values),C(e,`optin`,e=>e.def.innerType?._zod?.optin),C(e,`optout`,e=>e.def.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(hi):hi(r)}});function hi(e){return e.memo||(e.value=Object.freeze(e.value)),e}var gi=w(`$ZodCustom`,(e,t)=>{Tn.init(e,t),T.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=>_i(t,n,r,e));_i(i,n,r,e)}});function _i(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(Qe(e))}}var vi=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},yi=`~memo`,bi=[];function xi(e){return typeof e==`object`&&!!e}function Si(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var Ci=new WeakMap,wi=0,Ti=1,Ei=2;function Di(e,t,n){let r=Ci.get(e);if(r!==void 0)return r?Ei:wi;if(t.has(e))return Ei;t.add(e);let i=wi,a=e=>{if(i!==Ei&&e?._zod){let r=Di(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=wi;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?Ti:o.value?._zod?Di(o.value,t,n):wi;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=fe(c);s(e?o(e,!0):Ti),a(c.catchall);break}case`array`:a(c.element);break;case`tuple`:for(let e of c.items)a(e);a(c.rest);break;case`record`:case`map`:a(c.keyType),a(c.valueType);break;case`set`:a(c.valueType);break;case`union`:for(let e of c.options)a(e);break;case`intersection`:a(c.left),a(c.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:a(c.innerType);break;case`pipe`:a(c.in),a(c.out);break;case`function`:a(c.input),a(c.output);break;case`lazy`:{let r=c._cachedInner??(n?e._zod.innerType:void 0);s(r?Di(r,t,!1):Ti);break}case`template_literal`:case`string`:case`number`:case`int`:case`boolean`:case`bigint`:case`symbol`:case`undefined`:case`null`:case`void`:case`never`:case`any`:case`unknown`:case`date`:case`nan`:case`enum`:case`literal`:case`file`:case`transform`:case`custom`:break;default:for(let e in c){let t=Object.getOwnPropertyDescriptor(c,e);if(!t||t.get)continue;let n=t.value;if(!(!n||typeof n!=`object`)){if(n._zod)a(n);else if(Array.isArray(n))for(let e of n)a(e)}}}return t.delete(e),Oi(e,i)}function Oi(e,t){return t!==Ti&&Ci.set(e,t===Ei),t}function ki(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}var Ai,ji=[],Mi={alloc(e,t,n){let r=Ai;if(!r)return n;Ai=void 0;let i={value:n,issues:null};return r.set(t.value,i),ji.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&Pi(n,e.value))throw new vi;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r=!1,i,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,o=(s,c)=>{if(n===void 0){let i=Di(e,new Set,!1);if(i===wi)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===Ei||r?n=!0:r=!0}let l=s.value;if(!xi(l))return t(s,c);let u=c[yi];u||(u={buckets:new WeakMap,backEdges:void 0},c[yi]=u);let d;i===c?d=a:(d=ki(u,e),i=c,a=d);let f=d.get(l);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(...Si(f.issues)):(s.memo=!0,u.backEdges??=new WeakSet,u.backEdges.add(f.value)),s;Ai=d;let p=ji.length,m=t(s,c);Ai=void 0;let h=ji.length>p?ji.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?Si(e.issues):bi),e)):(h&&(h.issues=m.issues.length?Si(m.issues):bi),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function Ni(){return Mi}function Pi(e,t){let n=e[yi]?.backEdges;return n!==void 0&&xi(t)&&n.has(t)}var Fi=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,currency_code:`currency code`,credit_card:`credit card number`,iban:`IBAN`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(Ze(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${Oe(e.values[0])}`:`Invalid option: expected one of ${ie(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${ie(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function Ii(){return{localeError:Fi()}}var Li,Ri=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 zi(){return new Ri}(Li=globalThis).__zod_globalRegistry??(Li.__zod_globalRegistry=zi());var Bi=globalThis.__zod_globalRegistry;function Vi(e){return e.checks&&=[...e.checks],e}function Hi(e,t){return new e(Vi({type:`string`,...x(t)}))}function Ui(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...x(t)})}function Wi(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...x(t)})}function Gi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...x(t)})}function Ki(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...x(t)})}function qi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...x(t)})}function Ji(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...x(t)})}function Yi(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...x(t)})}function Xi(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...x(t)})}function Zi(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...x(t)})}function Qi(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...x(t)})}function $i(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...x(t)})}function ea(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...x(t)})}function ta(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...x(t)})}function na(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...x(t)})}function ra(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...x(t)})}function ia(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...x(t)})}function aa(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...x(t)})}function oa(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...x(t)})}function sa(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...x(t)})}function ca(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...x(t)})}function la(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...x(t)})}function ua(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...x(t)})}function da(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...x(t)})}function fa(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...x(t)})}function pa(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...x(t)})}function ma(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...x(t)})}function ha(e,t){return new e(Vi({type:`number`,coerce:!0,checks:[],...x(t)}))}function ga(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...x(t)})}function _a(e){return new e({type:`unknown`})}function va(e,t){return new e({type:`never`,...x(t)})}function ya(e,t){return new On({check:`less_than`,...x(t),value:e,inclusive:!1})}function ba(e,t){return new On({check:`less_than`,...x(t),value:e,inclusive:!0})}function xa(e,t){return new kn({check:`greater_than`,...x(t),value:e,inclusive:!1})}function Sa(e,t){return new kn({check:`greater_than`,...x(t),value:e,inclusive:!0})}function Ca(e,t){return new An({check:`multiple_of`,...x(t),value:e})}function wa(e,t){return new Mn({check:`max_length`,...x(t),maximum:e})}function Ta(e,t){return new Nn({check:`min_length`,...x(t),minimum:e})}function Ea(e,t){return new Pn({check:`length_equals`,...x(t),length:e})}function Da(e,t){return new In({check:`string_format`,format:`regex`,...x(t),pattern:e})}function Oa(e){return new Ln({check:`string_format`,format:`lowercase`,...x(e)})}function ka(e){return new Rn({check:`string_format`,format:`uppercase`,...x(e)})}function Aa(e,t){return new zn({check:`string_format`,format:`includes`,...x(t),includes:e})}function ja(e,t){return new Bn({check:`string_format`,format:`starts_with`,...x(t),prefix:e})}function Ma(e,t){return new Vn({check:`string_format`,format:`ends_with`,...x(t),suffix:e})}function Na(e){return new Hn({check:`overwrite`,tx:e})}function Pa(e){return Na(t=>t.normalize(e))}function Fa(){return Na(e=>e.trim())}function Ia(){return Na(e=>e.toLowerCase())}function La(){return Na(e=>e.toUpperCase())}function Ra(){return Na(e=>ye(e))}function za(e,t,n){return new e({type:`array`,element:t,...x(n)})}function Ba(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...x(n)})}function Va(e,t){let n=Ha(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Qe(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(Qe(r))}},e(t.value,t)),t);return n}function Ha(e,t){let n=new Tn({check:`custom`,...x(t)});return n._zod.check=e,n}function Ua(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&de(e,t,n[t]);return e}function Wa(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??Bi,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function Ga(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function D(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),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;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,D(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Ua(o.schema,c),t.io===`input`&&O(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 Ka(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function qa(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;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}/${Ka(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+Ka(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>
|
|
54
|
+
|
|
55
|
+
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}r.count>1&&e.reused===`ref`&&a(n)}e.external&&(e.sharedDefsExtractedFor=e.external)}function Ja(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;Ja(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var Ya=new Set([`type`,`properties`,`required`,`additionalProperties`]),Xa=[`oneOf`,`anyOf`];function Za(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function Qa(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!Ya.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??Za(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}de(n,r,e.length===1?e[0]:Qa(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=Za(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function $a(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of Ya)if(t in e)return;let n=t.filter(e=>Xa.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=Qa(t);else{let e=n[0],i=Xa.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>Qa([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,Ua(e,r))}function eo(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)):Ua(i,s),Ua(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??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())Ja(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])$a(e)}}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)}Ua(i,n.defId?n.schema: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??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,de(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),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:no(t,`input`,e.processors),output:no(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function O(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 O(r.element,n);if(r.type===`set`)return O(r.valueType,n);if(r.type===`lazy`)return O(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`||r.type===`catch`)return O(r.innerType,n);if(r.type===`intersection`)return O(r.left,n)||O(r.right,n);if(r.type===`record`||r.type===`map`)return O(r.keyType,n)||O(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:O(r.in,n)||O(r.out,n);if(r.type===`object`){for(let e in r.shape)if(O(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(O(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(O(e,n))return!0;return!!(r.rest&&O(r.rest,n))}return!1}var to=(e,t={})=>n=>{let r=Wa({...n,processors:t});return D(e,r),qa(r,e),eo(r,e)},no=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Wa({...i??{},target:a,io:t,processors:n});return D(e,o),qa(o,e),eo(o,e)},ro=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},io=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},ao=(e,t)=>{ro(e,`minimum`,t),io(e,`maximum`,t)},oo=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},so=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},co=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},lo=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},uo=(e,t)=>ro(e,`minimum`,t.minimum),fo=(e,t)=>io(e,`maximum`,t.maximum),po=e=>(t,n)=>{lo(t,n.format);let[r,i]=e[n.format];ro(t,`minimum`,r),io(t,`maximum`,i)},mo={greater_than:(e,t)=>ro(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>io(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>oo(e,t.value),number_format:po(Ae),bigint_format:po(je),min_length:uo,max_length:fo,length_equals:(e,t)=>ao(e,t.length),min_size:uo,max_size:fo,size_equals:(e,t)=>ao(e,t.size),string_format:(e,t)=>{lo(e,t.format),t.pattern&&so(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>co(e,t.mime)};function ho(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)mo[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&ro(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&ro(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&io(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&io(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&oo(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&co(t,i.mime);for(let e of i.patterns??[])so(t,e);return t}var go={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},_o=new Map([[Tr,dn],[Dr,fn]]),vo=e=>_o.get(e)??e,yo=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=ho(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=go[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(vo);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}))])}},bo=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=ho(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):Ga(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},xo=(e,t,n,r)=>{n.not={}},So=(e,t,n,r)=>{let i=e._zod.def,a=re(i.entries);if(a.length===0){n.not={};return}a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Co=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(Ga(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(Ga(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);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},wo=(e,t,n,r)=>{Ga(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},To=(e,t,n,r)=>{Ga(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},Eo=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=ho(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=D(a.element,t,{...r,path:[...r.path,`items`]})};function Do(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?Do(t.out):t.type===`catch`?Do(t.innerType):e._zod.optin}var Oo=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&Ga(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)de(i.properties,e,D(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?Do(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=D(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},ko=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>D(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Ao=(e,t,n,r)=>{let i=e._zod.def,a=D(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=D(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},jo=(e,t,n,r)=>{let i=e._zod.def,a=D(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`}]},Mo=(e,t,n,r)=>{let i=e._zod.def;D(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},No=Symbol();function Po(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(Ga(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),No):JSON.parse(o)}var Fo=(e,t,n,r)=>{let i=e._zod.def;D(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=Po(i.defaultValue,e,t,n,r);o!==No&&(n.default=o)},Io=(e,t,n,r)=>{let i=e._zod.def;D(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=Po(i.defaultValue,e,t,n,r);o!==No&&(n._prefault=o)},Lo=(e,t,n,r)=>{let i=e._zod.def;D(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{Ga(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},Ro=(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;D(o,t,r);let s=t.seen.get(e);s.ref=o},zo=(e,t,n,r)=>{let i=e._zod.def;D(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Bo=(e,t,n,r)=>{let i=e._zod.def;D(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Vo=new WeakSet([Object.prototype,Error.prototype]);function Ho(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var Uo=w(`ZodError`,(e,t)=>{wt.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);Vo.has(n)||(Vo.add(n),Ho(n,`format`,e=>t=>Dt(e,t)),Ho(n,`flatten`,e=>t=>Et(e,t)),Ho(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,ae,2)}),Ho(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,ae,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),Wo=kt(Uo),Go=At(Uo),Ko=jt(Uo),qo=Nt(Uo),Jo=zt(Uo),Yo=Bt(Uo),Xo=Vt(Uo),Zo=Ht(Uo),Qo=Ut(Uo),$o=Wt(Uo),es=Gt(Uo),ts=Kt(Uo);function ns(){gt.localeError||_t(Ii())}function rs(){gt.memoizer||_t({memoizer:Ni()})}var k=w(`ZodType`,(e,t)=>(ns(),T.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(b(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 De(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(gc(e,t))},superRefine(e,t){return this.check(_c(e,t))},overwrite(e){return this.check(Na(e))},optional(){return Qs(this)},exactOptional(){return ec(this)},nullable(){return nc(this)},nullish(){return Qs(nc(this))},nonoptional(e){return cc(this,e)},array(){return Rs(this)},or(e){return Hs([this,e])},and(e){return Ws(this,e)},transform(e){return fc(this,Xs(e))},default(e){return ic(this,e)},prefault(e){return oc(this,e)},catch(e){return uc(this,e)},pipe(e){return fc(this,e)},readonly(){return mc(this)},describe(e){let t=this.clone();return Bi.add(t,{description:e}),t},meta(...e){if(e.length===0)return Bi.get(this);let t=this.clone();return Bi.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return tt(this,`~standard`,{...qn(this),jsonSchema:{input:no(this,`input`),output:no(this,`output`)}})},set"~standard"(e){et(this,`~standard`,e)},parse:function e(t,n){return Wo(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Go(this,t,n,{callee:e})},safeParse(e,t){return Ko(this,e,t)},async safeParseAsync(e,t){return qo(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){et(this,`spa`,e)},validate(e,t){return It(this,e,t)},validateAsync(e,t){return Rt(this,e,t)},encode:function e(t,n){return Jo(this,t,n,{callee:e})},decode:function e(t,n){return Yo(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await Xo(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await Zo(this,t,n,{callee:e})},safeEncode(e,t){return Qo(this,e,t)},safeDecode(e,t){return $o(this,e,t)},async safeEncodeAsync(e,t){return es(this,e,t)},async safeDecodeAsync(e,t){return ts(this,e,t)},toJSONSchema(e){return to(this,{})(e)},get description(){return Bi.get(this)?.description},get _def(){return this._zod.def}}),is=w(`_ZodString`,(e,t)=>{Jn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yo(e,t,n,r)},S({format:e=>ho(e).format??null,minLength:e=>ho(e).minimum??null,maxLength:e=>ho(e).maximum??null},{regex(...e){return this.check(Da(...e))},includes(...e){return this.check(Aa(...e))},startsWith(...e){return this.check(ja(...e))},endsWith(...e){return this.check(Ma(...e))},min(...e){return this.check(Ta(...e))},max(...e){return this.check(wa(...e))},length(...e){return this.check(Ea(...e))},nonempty(...e){return this.check(Ta(1,...e))},lowercase(e){return this.check(Oa(e))},uppercase(e){return this.check(ka(e))},trim(){return this.check(Fa())},normalize(...e){return this.check(Pa(...e))},toLowerCase(){return this.check(Ia())},toUpperCase(){return this.check(La())},slugify(){return this.check(Ra())}})),as=w(`ZodString`,(e,t)=>{Jn.init(e,t),is.init(e,t)},{email(e){return this.check(Ui(ds,e))},url(e){return this.check(Yi(ms,e))},jwt(e){return this.check(ua(ks,e))},emoji(e){return this.check(Xi(hs,e))},guid(e){return this.check(Wi(fs,e))},uuid(e){return this.check(Gi(ps,e))},uuidv4(e){return this.check(Ki(ps,e))},uuidv6(e){return this.check(qi(ps,e))},uuidv7(e){return this.check(Ji(ps,e))},nanoid(e){return this.check(Zi(gs,e))},cuid(e){return this.check(Qi(_s,e))},cuid2(e){return this.check($i(vs,e))},ulid(e){return this.check(ea(ys,e))},base64(e){return this.check(sa(Es,e))},base64url(e){return this.check(ca(Ds,e))},xid(e){return this.check(ta(bs,e))},ksuid(e){return this.check(na(xs,e))},ipv4(e){return this.check(ra(Ss,e))},ipv6(e){return this.check(ia(Cs,e))},cidrv4(e){return this.check(aa(ws,e))},cidrv6(e){return this.check(oa(Ts,e))},e164(e){return this.check(la(Os,e))},datetime(e){return this.check(da(ss,e))},date(e){return this.check(fa(cs,e))},time(e){return this.check(pa(ls,e))},duration(e){return this.check(ma(us,e))}});function os(e){return Hi(as,e)}var A=w(`ZodStringFormat`,(e,t)=>{E.init(e,t),is.init(e,t)}),ss=w(`ZodISODateTime`,(e,t)=>{pr.init(e,t),A.init(e,t)}),cs=w(`ZodISODate`,(e,t)=>{mr.init(e,t),A.init(e,t)}),ls=w(`ZodISOTime`,(e,t)=>{hr.init(e,t),A.init(e,t)}),us=w(`ZodISODuration`,(e,t)=>{gr.init(e,t),A.init(e,t)}),ds=w(`ZodEmail`,(e,t)=>{Zn.init(e,t),A.init(e,t)}),fs=w(`ZodGUID`,(e,t)=>{Yn.init(e,t),A.init(e,t)}),ps=w(`ZodUUID`,(e,t)=>{Xn.init(e,t),A.init(e,t)}),ms=w(`ZodURL`,(e,t)=>{ar.init(e,t),A.init(e,t)}),hs=w(`ZodEmoji`,(e,t)=>{or.init(e,t),A.init(e,t)}),gs=w(`ZodNanoID`,(e,t)=>{sr.init(e,t),A.init(e,t)}),_s=w(`ZodCUID`,(e,t)=>{cr.init(e,t),A.init(e,t)}),vs=w(`ZodCUID2`,(e,t)=>{lr.init(e,t),A.init(e,t)}),ys=w(`ZodULID`,(e,t)=>{ur.init(e,t),A.init(e,t)}),bs=w(`ZodXID`,(e,t)=>{dr.init(e,t),A.init(e,t)}),xs=w(`ZodKSUID`,(e,t)=>{fr.init(e,t),A.init(e,t)}),Ss=w(`ZodIPv4`,(e,t)=>{_r.init(e,t),A.init(e,t)}),Cs=w(`ZodIPv6`,(e,t)=>{br.init(e,t),A.init(e,t)}),ws=w(`ZodCIDRv4`,(e,t)=>{xr.init(e,t),A.init(e,t)}),Ts=w(`ZodCIDRv6`,(e,t)=>{Cr.init(e,t),A.init(e,t)}),Es=w(`ZodBase64`,(e,t)=>{Er.init(e,t),A.init(e,t)}),Ds=w(`ZodBase64URL`,(e,t)=>{kr.init(e,t),A.init(e,t)}),Os=w(`ZodE164`,(e,t)=>{Ar.init(e,t),A.init(e,t)}),ks=w(`ZodJWT`,(e,t)=>{Mr.init(e,t),A.init(e,t)}),As=w(`ZodNumber`,(e,t)=>{Nr.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bo(e,t,n,r),e.isFinite=!0},S({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=ho(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=ho(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=ho(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>ho(e).format??null},{gt(e,t){return this.check(xa(e,t))},gte(e,t){return this.check(Sa(e,t))},min(e,t){return this.check(Sa(e,t))},lt(e,t){return this.check(ya(e,t))},lte(e,t){return this.check(ba(e,t))},max(e,t){return this.check(ba(e,t))},int(e){return this.check(Ms(e))},safe(e){return this.check(Ms(e))},positive(e){return this.check(xa(0,e))},nonnegative(e){return this.check(Sa(0,e))},negative(e){return this.check(ya(0,e))},nonpositive(e){return this.check(ba(0,e))},multipleOf(e,t){return this.check(Ca(e,t))},step(e,t){return this.check(Ca(e,t))},finite(){return this}})),js=w(`ZodNumberFormat`,(e,t)=>{Pr.init(e,t),As.init(e,t)});function Ms(e){return ga(js,e)}var Ns=w(`ZodUnknown`,(e,t)=>{Fr.init(e,t),k.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Ps(){return _a(Ns)}var Fs=w(`ZodNever`,(e,t)=>{Ir.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xo(e,t,n,r)});function Is(e){return va(Fs,e)}var Ls=w(`ZodArray`,(e,t)=>{rs(),Br.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Eo(e,t,n,r),e.element=t.element},{min(e,t){return this.check(Ta(e,t))},nonempty(e){return this.check(Ta(1,e))},max(e,t){return this.check(wa(e,t))},length(e,t){return this.check(Ea(e,t))},unwrap(){return this.element}});function Rs(e,t){return za(Ls,e,t)}var zs=w(`ZodObject`,(e,t)=>{rs(),Kr.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oo(e,t,n,r),st(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return Ks(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(b(this._zod.def,{catchall:e}))},passthrough(){return this.clone(b(this._zod.def,{catchall:Ps()}))},loose(){return this.clone(b(this._zod.def,{catchall:Ps()}))},strict(){return this.clone(b(this._zod.def,{catchall:Is()}))},strip(){return this.clone(b(this._zod.def,{catchall:void 0}))},extend(e){return Fe(this,e)},safeExtend(e){return Le(this,e)},merge(e){return Re(this,e)},pick(e){return Me(this,e)},omit(e){return Pe(this,e)},partial(...e){return ze(Zs,this,e[0])},exactPartial(...e){return ze($s,this,e[0],`exactPartial`)},required(...e){return Be(sc,this,e[0])}});function Bs(e,t){return new zs({type:`object`,shape:e??{},...x(t)})}var Vs=w(`ZodUnion`,(e,t)=>{Jr.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ko(e,t,n,r),e.options=t.options});function Hs(e,t){return new Vs({type:`union`,options:e,...x(t)})}var Us=w(`ZodIntersection`,(e,t)=>{Yr.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ao(e,t,n,r)});function Ws(e,t){return new Us({type:`intersection`,left:e,right:t})}var Gs=w(`ZodEnum`,(e,t)=>{Qr.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>So(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];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 Gs({...t,checks:[],...x(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 Gs({...t,checks:[],...x(r),entries:i})}});function Ks(e,t){return new Gs({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...x(t)})}var qs=w(`ZodLiteral`,(e,t)=>{$r.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Co(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 Js(e,t){return new qs({type:`literal`,values:Array.isArray(e)?e:[e],...x(t)})}var Ys=w(`ZodTransform`,(e,t)=>{rs(),ei.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>To(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new ht(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Qe(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(Qe(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Xs(e){return new Ys({type:`transform`,transform:e})}var Zs=w(`ZodOptional`,(e,t)=>{ni.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Qs(e){return new Zs({type:`optional`,innerType:e})}var $s=w(`ZodExactOptional`,(e,t)=>{ri.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ec(e){return new $s({type:`optional`,innerType:e})}var tc=w(`ZodNullable`,(e,t)=>{ii.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function nc(e){return new tc({type:`nullable`,innerType:e})}var rc=w(`ZodDefault`,(e,t)=>{ai.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function ic(e,t){return new rc({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():we(t)}})}var ac=w(`ZodPrefault`,(e,t)=>{si.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Io(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function oc(e,t){return new ac({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():we(t)}})}var sc=w(`ZodNonOptional`,(e,t)=>{ci.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function cc(e,t){return new sc({type:`nonoptional`,innerType:e,...x(t)})}var lc=w(`ZodCatch`,(e,t)=>{di.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function uc(e,t){return new lc({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:lt(t)})}var dc=w(`ZodPipe`,(e,t)=>{fi.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ro(e,t,n,r),e.in=t.in,e.out=t.out});function fc(e,t){return new dc({type:`pipe`,in:e,out:t})}var pc=w(`ZodReadonly`,(e,t)=>{mi.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function mc(e){return new pc({type:`readonly`,innerType:e})}var hc=w(`ZodCustom`,(e,t)=>{gi.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wo(e,t,n,r)});function gc(e,t={}){return Ba(hc,e,t)}function _c(e,t){return Va(e,t)}function vc(e){return ha(As,e)}var yc=Ks([`SECOND`,`MINUTE`,`HOUR`,`DAY`,`WEEK`,`MONTH`,`QUARTER`,`YEAR`]),bc=class extends Error{constructor(e,t){super(e),this.code=t}},xc=e=>e,Sc=({value:e,kind:t,allowedValues:n})=>{let r=n.map(e=>`'${e}'`);return xc(`${JSON.stringify(e)??String(e)} is not a date ${t}: use ${r.slice(0,-1).join(`, `)} or ${r[r.length-1]}`)},Cc=yc.options.filter(e=>e!==`SECOND`),wc=e=>Cc.some(t=>t===e),Tc=e=>{if(!wc(e))throw new bc(Sc({value:e,kind:`unit`,allowedValues:Cc}),`INVALID_DATE_UNIT`)},Ec=e=>e.isDateOnly?e.date.toString():e.dateTime.toInstant().toString({fractionalSecondDigits:3}),Dc=e=>e.isDateOnly?e.date.toZonedDateTime(`UTC`):e.dateTime,Oc=e=>{let{year:t}=Dc(e);return t>=1&&t<=9999},kc=e=>/^\d{4}-\d{2}-\d{2}$/.test(e);function Ac(e,t,n,r,i){return jc(t,((e,t)=>{let n=e[t];if(n===void 0)throw TypeError(sh(t));return n})(e,t),n,r,i)}function jc(e,t,n,r,i,a){let o=Xc(t,n,r);if(i&&t!==o)throw RangeError(ah(e,t,n,r,a));return o}function Mc(e){return e!==null&&/object|function/.test(typeof e)}function Nc(e,t=Map){let n=new t;return(t,...r)=>{if(n.has(t))return n.get(t);let i=e(t,...r);return n.set(t,i),i}}function Pc(e){return Fc({name:e},1)}function Fc(e,t){return zc((e=>({value:e,configurable:1,writable:!t})),e)}function Ic(e){return zc((e=>({get:e,configurable:1})),e)}function Lc(e){return{[Symbol.toStringTag]:{value:e,configurable:1}}}function Rc(e,t){let n={},r=e.length;for(let i of t)n[e[--r]]=i;return n}function zc(e,t,n){let r={};for(let i in t)r[i]=e(t[i],i,n);return r}function Bc(e,t,n){let r={};for(let i=0;i<t.length;i++){let a=t[i];r[a]=e(a,i,n)}return r}function Vc(e,t,n){let r={};for(let i=0;i<e.length;i++)r[t[i]]=n[e[i]];return r}function Hc(e,t){let n=Object.create(null);for(let r of e)n[r]=t[r];return n}function Uc(e,t){for(let n of t)if(n in e)return 1;return 0}function Wc(e,t,n){for(let r of e)if(t[r]!==n[r])return 0;return 1}function Gc(e,t,n){let r={...n};for(let n=0;n<t;n++)r[e[n]]=0;return r}function j(e,...t){return(...n)=>e(...t,...n)}function Kc(e){return e[0].toUpperCase()+e.substring(1)}function qc(e){return e.slice().sort()}function Jc(e,t){return String(t).padStart(e,`0`)}function Yc(e,t){return Math.sign(e-t)}function Xc(e,t,n){return Math.min(Math.max(e,t),n)}function Zc(e,t){return[Math.floor(e/t),Qc(e,t)]}function Qc(e,t){return(e%t+t)%t}function $c(e,t){return[el(e,t),tl(e,t)]}function el(e,t){return Math.trunc(e/t)||0}function tl(e,t){return e%t||0}function nl(e){return Math.abs(e%1)===.5}function rl(e,t,n){let r=0,i=0;for(let a=0;a<=t;a++){let t=e[n[a]],o=ig[a],[s,c]=$c(t,I/o);r+=c*o,i+=s}let[a,o]=$c(r,I);return[i+a,o]}function il(e,t,n){let r={};for(let i=t;i>=0;i--){let t=ig[i];r[n[i]]=el(e,t),e=tl(e,t)}return r}function al(e){if(e!==void 0)return L(e)}function ol(e){if(e!==void 0)return cl(e)}function sl(e){if(e!==void 0)return ll(e)}function cl(e){return ml(ll(e))}function ll(e){return pl(Ag(e))}function ul(e,t){if(t==null)throw RangeError(sh(e));return t}function dl(e){if(!Mc(e))throw TypeError(ih);return e}function fl(e,t,n=e){if(typeof t!==e)throw TypeError(oh(n,t));return t}function pl(e,t=`number`){if(!Number.isInteger(e))throw RangeError(Qm(t,e));return e||0}function ml(e,t=`number`){if(e<=0)throw RangeError($m(t,e));return e}function hl(e){if(typeof e==`symbol`)throw TypeError(rh);return String(e)}function gl(e,t){return Mc(e)?String(e):L(e,t)}function _l(e){if(typeof e==`string`)return BigInt(e);if(typeof e!=`bigint`)throw TypeError(nh(e));return e}function vl(e,t=`number`){if(typeof e==`bigint`)throw TypeError(th(t));if(e=Number(e),!Number.isFinite(e))throw RangeError(eh(t,e));return e}function yl(e,t){return Math.trunc(vl(e,t))||0}function bl(e,t){return pl(vl(e,t),t)}function xl(e,t){return ml(yl(e,t),t)}function Sl(e,t){let[n,r]=$c(t,I),i=e+n,a=Math.sign(i);return a&&a===-Math.sign(r)&&(i-=a,r+=a*I),[i,r]}function Cl(e,t,n=1){return Sl(e[0]+t[0]*n,e[1]+t[1]*n)}function wl(e,t){return Sl(e[0],e[1]+t)}function Tl(e,t){return Cl(t,e,-1)}function El(e,t){return Yc(e[0],t[0])||Yc(e[1],t[1])}function Dl(e,t,n){return El(e,t)===-1||El(e,n)===1}function Ol(e,t=1){let n=BigInt(I/t);return[Number(e/n),Number(e%n)*t]}function kl(e,t=1){let[n,r]=$c(e,I/t);return[n,r*t]}function Al(e,t=1,n){let[r,i]=e,[a,o]=$c(i,t);return I/t*r+(a+(n?o/t:0))}function jl(e,t,n=Zc){let[r,i]=e,[a,o]=n(i,t);return[I/t*r+a,o]}function Ml(e){return Ac(e,`isoYear`,Zg,Xg,1),e.isoYear===Zg?Ac(e,`isoMonth`,4,12,1):e.isoYear===Xg&&Ac(e,`isoMonth`,1,9,1),e}function Nl(e){return Pl({...e,...Wg,isoHour:12}),e}function Pl(e){let t=Ac(e,`isoYear`,Zg,Xg,1),n=t===Zg?1:t===Xg?-1:0;return n&&Fl(M({...e,isoDay:e.isoDay+n,isoNanosecond:e.isoNanosecond-n})),e}function Fl(e){if(!e||Dl(e,Yg,Jg))throw RangeError(Ph);return e}function Il(e){return rl(e,5,Rg)[1]}function Ll(e){let[t,n]=Zc(e,I);return[il(n,5,Rg),t]}function Rl(e){return jl(e,tg)}function zl(e){return Hl(e.isoYear,e.isoMonth,e.isoDay,e.isoHour,e.isoMinute,e.isoSecond,e.isoMillisecond)}function M(e){let t=zl(e);if(t!==void 0){let[n,r]=$c(t,Zh);return[n,r*eg+(e.isoMicrosecond||0)*$h+(e.isoNanosecond||0)]}}function Bl(e,t){let[n,r]=Ll(Il(e)-t);return Fl(M({...e,isoDay:e.isoDay+r,...n}))}function Vl(...e){return Hl(...e)/Qh}function Hl(...e){let[t,n]=Ul(...e),r=t.valueOf();if(!isNaN(r))return r-n*Zh}function Ul(e,t=1,n=1,r=0,i=0,a=0,o=0){let s=e===Zg?1:e===Xg?-1:0,c=new Date;return c.setUTCHours(r,i,a,o),c.setUTCFullYear(e,t-1,n+s),[c,s]}function Wl(e,t){let[n,r]=wl(e,t);r<0&&(r+=I,--n);let[i,a]=Zc(r,eg),[o,s]=Zc(a,$h);return Gl(n*Zh+i,o,s)}function Gl(e,t=0,n=0){let r=Math.ceil(Math.max(0,Math.abs(e)-qg)/Zh)*Math.sign(e),i=new Date(e-r*Zh);return Rc(Bg,[i.getUTCFullYear(),i.getUTCMonth()+1,i.getUTCDate()+r,i.getUTCHours(),i.getUTCMinutes(),i.getUTCSeconds(),i.getUTCMilliseconds(),t,n])}function Kl(e,t){if(t<-qg)throw RangeError(Ph);let n=e.formatToParts(t),r={};for(let e of n)r[e.type]=e.value;return r}function ql(e){return[e.isoYear,e.isoMonth,e.isoDay]}function Jl(e,t){return[t,0]}function Yl(){return n_}function Xl(e,t){switch(t){case 2:return Ql(e)?29:28;case 4:case 6:case 9:case 11:return 30}return 31}function Zl(e){return Ql(e)?366:365}function Ql(e){return e%4==0&&(e%100!=0||e%400==0)}function $l(e){let[t,n]=Ul(e.isoYear,e.isoMonth,e.isoDay);return Qc(t.getUTCDay()-n,7)||7}function eu(e){return this.id===wg?(({isoYear:e})=>e<1?[`gregory-inverse`,1-e]:[`gregory`,e])(e):this.id===Tg?i_(e):[]}function tu(e){let t=zl(e);if(t<r_){let{isoYear:t}=e;return t<1?[`japanese-inverse`,1-t]:[`japanese`,t]}let{era:n,eraYear:r}=Pp(Kl(pv(Tg),t),Tg);return[n,r]}function nu(e){return ru(e),ou(e,1),e}function ru(e){return au(e,1),e}function iu(e){return Wc(zg,e,au(e))}function au(e,t){let{isoYear:n}=e,r=Ac(e,`isoMonth`,1,Yl(),t);return{isoYear:n,isoMonth:r,isoDay:Ac(e,`isoDay`,1,Xl(n,r),t)}}function ou(e,t){return Rc(Rg,[Ac(e,`isoHour`,0,23,t),Ac(e,`isoMinute`,0,59,t),Ac(e,`isoSecond`,0,59,t),Ac(e,`isoMillisecond`,0,999,t),Ac(e,`isoMicrosecond`,0,999,t),Ac(e,`isoNanosecond`,0,999,t)])}function N(e){return e===void 0?0:C_(dl(e))}function su(e,t=0){e=vu(e);let n=w_(e),r=T_(e,t);return[C_(e),r,n]}function cu(e,t,n,r=9,i=0,a=4){t=vu(t);let o=x_(t,r,i),s=hu(t),c=k_(t,a),l=b_(t,r,i,1);return o==null?o=Math.max(n,l):Cu(o,l),s=gu(s,l,1),e&&(c=(e=>e<4?(e+2)%4:e)(c)),[o,l,s,c]}function lu(e,t=6,n){let r=hu(e=yu(e,a_)),i=k_(e,7),a=b_(e,t);return a=ul(a_,a),r=gu(r,a,void 0,n),[a,r,i]}function uu(e){return E_(vu(e))}function du(e,t){return pu(vu(e),t)}function fu(e){let t=Su(u_,y_,yu(e,u_),0);if(!t)throw RangeError(oh(u_,t));return t}function pu(e,t=4){let n=_u(e);return[k_(e,4),...mu(b_(e,t),n)]}function mu(e,t){return e==null?[t===void 0?1:10**(9-t),t]:[ig[e],e<4?9-3*e:-1]}function hu(e){let t=e[s_];return t===void 0?1:yl(t,s_)}function gu(e,t,n,r){let i=r?I:ig[t+1];if(i){let n=ig[t];if(i%((e=jc(s_,e,1,i/n-+!r,1))*n))throw RangeError(oh(s_,e))}else e=jc(s_,e,1,n?10**9:1,1);return e}function _u(e){let t=e[c_];if(t!==void 0){if(typeof t!=`number`){if(hl(t)===`auto`)return;throw RangeError(oh(c_,t))}t=jc(c_,Math.floor(t),0,9,1)}return t}function vu(e){return e===void 0?{}:dl(e)}function yu(e,t){return typeof e==`string`?{[t]:e}:dl(e)}function bu(e){return{overflow:f_[e]}}function xu(e,t,n=9,r=0,i){let a=t[e];if(a===void 0)return i?r:void 0;if(a=hl(a),a===`auto`)return i?r:null;let o=Yh[a];if(o===void 0&&(o=Fg[a]),o===void 0)throw RangeError(fh(e,a,Yh));return jc(e,o,r,n,1,Xh),o}function Su(e,t,n,r=0){let i=n[e];if(i===void 0)return r;let a=hl(i),o=t[a];if(o===void 0)throw RangeError(fh(e,a,t));return o}function Cu(e,t){if(t>e)throw RangeError(Bh)}function wu(e){return{branding:I_,epochNanoseconds:e}}function Tu(e,t,n){return{branding:F_,calendar:n,timeZone:t,epochNanoseconds:e}}function Eu(e,t=e.calendar){return{branding:N_,calendar:t,...Hc(Ug,e)}}function Du(e,t=e.calendar){return{branding:M_,calendar:t,...Hc(Vg,e)}}function Ou(e,t=e.calendar){return{branding:A_,calendar:t,...Hc(Vg,e)}}function ku(e,t=e.calendar){return{branding:j_,calendar:t,...Hc(Vg,e)}}function Au(e){return{branding:P_,...Hc(Hg,e)}}function P(e){return{branding:L_,sign:tf(e),...Hc(jg,e)}}function ju(e){return jl(e.epochNanoseconds,eg)[0]}function Mu(e){return((e,t=1)=>{let[n,r]=e,i=Math.floor(r/t),a=I/t;return BigInt(n)*BigInt(a)+BigInt(i)})(e.epochNanoseconds)}function Nu(e){return e.epochNanoseconds}function Pu(e,t,n,r,i){let a=cf(r),[o,s]=((e,t)=>{let n=t((e=yu(e,o_))[l_]),r=S_(e);return r=ul(o_,r),[r,n]})(i,e);if(!s&&Jd(Math.max(o,a),s))return Fu(r,o);if(!s)throw RangeError(Lh);if(!r.sign)return 0;let[c,l,u]=Ud(t,n,s),d=Wd(u),f=Gd(u),p=Kd(u),m=f(l,c,r);qd(s)||(Pl(c),Pl(m));let h=p(l,c,m,o);return Jd(o,s)?Fu(h,o):((e,t,n,r,i,a,o)=>{let s=tf(e),[c,l]=Iu(r,Lg(n,e),n,s,i,a,o),u=Lu(t,c,l);return e[R[n]]+u*s})(h,d(m),o,l,c,d,f)}function Fu(e,t){return Al(F(e),ig[t],1)}function Iu(e,t,n,r,i,a,o){let s=R[n],c={...t,[s]:t[s]+r},l=o(e,i,t),u=o(e,i,c);return[a(l),a(u)]}function Lu(e,t,n){let r=Al(Tl(t,n));if(!r)throw RangeError(wh);return Al(Tl(t,e))/r}function Ru(e,t){let[n,r,i]=lu(t,5,1);return wu($u(e.epochNanoseconds,n,r,i,1))}function zu(e,t,n){let{epochNanoseconds:r,timeZone:i,calendar:a}=t,[o,s,c]=lu(n);if(o===0&&s===1)return t;let l=e(i);if(o===6)r=((e,t,n,r)=>{let[i,a]=e(W_(n,t)),o=n.epochNanoseconds,s=Ad(t,i),c=Ad(t,a);if(Dl(o,s,c))throw RangeError(wh);return nd(Lu(o,s,c),r)?c:s})(Yu,l,t,c);else{let e=l.R(r);r=Od(l,Wu(Wl(r,e),o,s,c),e,2,0,1)}return Tu(r,i,a)}function Bu(e,t){return Eu(Wu(e,...lu(t)),e.calendar)}function Vu(e,t){let[n,r,i]=lu(t,5);var a;return Au((a=i,Ku(e,Ju(n,r),a)[0]))}function Hu(e,t){let n=e(t.timeZone),[r,i]=Yu(W_(t,n)),a=Al(Tl(Ad(n,r),Ad(n,i)),rg,1);if(a<=0)throw RangeError(wh);return a}function Uu(e,t){let{timeZone:n,calendar:r}=t;return Tu(((e,t,n)=>Ad(t,e(W_(n,t))))(Xu,e(n),t),n,r)}function Wu(e,t,n,r){return Gu(e,Ju(t,n),r)}function Gu(e,t,n){let[r,i]=Ku(e,t,n);return Pl({...Hd(e,i),...r})}function Ku(e,t,n){return Ll(td(Il(e),t,n))}function qu(e){return td(e,ng,7)}function Ju(e,t){return ig[e]*t}function Yu(e){let t=Xu(e);return[t,Hd(t,1)]}function Xu(e){return Gg(6,e)}function Zu(e,t,n){let r=Math.min(cf(e),6);return af(ed(F(e,r),t,n),r)}function Qu(e,t,n,r,i,a,o,s,c,l){if(r===0&&i===1)return e;let[u,d,f]=(Jd(r,s)?qd(s)&&r<6&&n>=6?id:rd:ad)(e,t,n,r,i,a,o,s,c,l);return f&&r!==7&&(u=((e,t,n,r,i,a,o,s)=>{let c=tf(e);for(let l=r+1;l<=n;l++){if(l===7&&n!==7)continue;let r=Lg(l,e);r[R[l]]+=c;let u=Al(Tl(o(s(i,a,r)),t));if(u&&Math.sign(u)!==c)break;e=r}return e})(u,d,n,Math.max(6,r),o,s,c,l)),u}function $u(e,t,n,r,i){return t===6?[td((e=>e[0]+e[1]/I)(e),n,r),0]:ed(e,Ju(t,n),r,i)}function ed(e,t,n,r){let[i,a]=e;r&&a<0&&(a+=I,--i);let[o,s]=Zc(td(a,t,n),I);return Sl(i+o,s)}function td(e,t,n){return nd(e/t,n)*t}function nd(e,t){return R_[t](e)}function rd(e,t,n,r,i,a){let o=tf(e),s=F(e),c=$u(s,r,i,a),l=Tl(s,c),u=Math.sign(c[0]-s[0])===o,d=af(c,Math.min(n,6));return[{...e,...d},Cl(t,l),u]}function id(e,t,n,r,i,a,o,s,c,l){let u=tf(e)||1,d=Al(F(e,5)),f=Ju(r,i),p=td(d,f,a),[m,h]=Iu(o,{...e,...Ig},6,u,s,c,l),ee=p-Al(Tl(m,h)),g=0;ee&&Math.sign(ee)!==u?t=wl(m,p):(g+=u,p=td(ee,f,a),t=wl(h,p));let te=of(p);return[{...e,...te,days:e.days+g},t,!!g]}function ad(e,t,n,r,i,a,o,s,c,l){let u=tf(e),d=R[r],f=Lg(r,e);r===7&&(e={...e,weeks:e.weeks+Math.trunc(e.days/7)});let p=el(e[d],i)*i;f[d]=p;let[m,h]=Iu(o,f,r,i*u,s,c,l),ee=p+Lu(t,m,h)*u*i,g=td(ee,i,a),te=Math.sign(g-ee)===u;return f[d]=g,[f,te?h:m,te]}function od(e,t,n,r){let[i,a,o,s]=(e=>{let t=pu(e=vu(e));return[e.timeZone,...t]})(r),c=i!==void 0;return((e,t,n,r,i,a)=>{n=ed(n,i,r,1);let o=t.R(n);return gd(Wl(n,o),a)+(e?xd(qu(o)):`Z`)})(c,t(c?e(i):z_),n.epochNanoseconds,a,o,s)}function sd(e,t,n){let[r,i,a,o,s,c]=(e=>{e=vu(e);let t=E_(e),n=_u(e),r=O_(e),i=k_(e,4),a=b_(e,4);return[t,D_(e),r,i,...mu(a,n)]})(n);return((e,t,n,r,i,a,o,s,c,l)=>{r=ed(r,c,s,1);let u=e(n).R(r);return gd(Wl(r,u),l)+xd(qu(u),o)+((e,t)=>t===1?``:`[`+(t===2?`!`:``)+e+`]`)(n,a)+Sd(t,i)})(e,t.calendar,t.timeZone,t.epochNanoseconds,r,i,a,o,s,c)}function cd(e,t){let[n,r,i,a]=(e=>(e=vu(e),[E_(e),...pu(e)]))(t);return o=e.calendar,s=n,c=a,gd(Gu(e,i,r),c)+Sd(o,s);var o,s,c}function ld(e,t){return n=e.calendar,r=e,i=uu(t),_d(r)+Sd(n,i);var n,r,i}function ud(e,t){return md(e.calendar,vd,e,uu(t))}function dd(e,t){return md(e.calendar,yd,e,uu(t))}function fd(e,t){let[n,r,i]=du(t);return a=i,bd(Ku(e,r,n)[0],a);var a}function pd(e,t){let[n,r,i]=du(t,3);return r>1&&nf(e={...e,...Zu(e,r,n)}),((e,t)=>{let{sign:n}=e,r=n===-1?$d(e):e,{hours:i,minutes:a}=r,[o,s]=jl(F(r,3),tg,$c);rf(o);let c=wd(s,t),l=t>=0||!n||c;return(n<0?`-`:``)+`P`+hd({Y:Ed(r.years),M:Ed(r.months),W:Ed(r.weeks),D:Ed(r.days)})+(i||a||o||l?`T`+hd({H:Ed(i),M:Ed(a),S:Ed(o,l)+c}):``)})(e,i)}function md(e,t,n,r){return r===1?e===`iso8601`?t(n):_d(n):r>1||r===0&&e!==`iso8601`?_d(n)+Cd(e,r===2):t(n)}function hd(e){let t=[];for(let n in e){let r=e[n];r&&t.push(r,n)}return t.join(``)}function gd(e,t){return _d(e)+`T`+bd(e,t)}function _d(e){return vd(e)+`-`+Jh(e.isoDay)}function vd(e){let{isoYear:t}=e;return(t<0||t>9999?Td(t)+Jc(6,Math.abs(t)):Jc(4,t))+`-`+Jh(e.isoMonth)}function yd(e){return Jh(e.isoMonth)+`-`+Jh(e.isoDay)}function bd(e,t){let n=[Jh(e.isoHour),Jh(e.isoMinute)];return t!==-1&&n.push(Jh(e.isoSecond)+((e,t,n,r)=>wd(e*1e6+t*$h+n,r))(e.isoMillisecond,e.isoMicrosecond,e.isoNanosecond,t)),n.join(`:`)}function xd(e,t=0){if(t===1)return``;let[n,r]=Zc(Math.abs(e),rg),[i,a]=Zc(r,ng),[o,s]=Zc(a,tg);return Td(e)+Jh(n)+`:`+Jh(i)+(o||s?`:`+Jh(o)+wd(s):``)}function Sd(e,t){return t!==1&&(t>1||t===0&&e!==`iso8601`)?Cd(e,t===2):``}function Cd(e,t){return`[`+(t?`!`:``)+`u-ca=`+e+`]`}function wd(e,t){let n=Jc(9,e);return n=t===void 0?n.replace(U_,``):n.slice(0,t),n?`.`+n:``}function Td(e){return e<0?`-`:`+`}function Ed(e,t){return e||t?e.toLocaleString(`fullwide`,{useGrouping:0}):``}function Dd(e,t){let{epochNanoseconds:n}=e,r=(t.R?t:t(e.timeZone)).R(n),i=Wl(n,r);return{calendar:e.calendar,...i,offsetNanoseconds:r}}function Od(e,t,n,r=0,i=0,a,o){if(n!==void 0&&r===1&&(r===1||o))return Bl(t,n);let s=e.I(t);if(n!==void 0&&r!==3){let e=((e,t,n,r)=>{let i=M(t);r&&(n=qu(n));for(let t of e){let e=Al(Tl(t,i));if(r&&(e=qu(e)),e===n)return t}})(s,t,n,a);if(e!==void 0)return e;if(r===0)throw RangeError(Mh)}return o?M(t):kd(e,t,i,s)}function kd(e,t,n=0,r=e.I(t)){if(r.length===1)return r[0];if(n===1)throw RangeError(Nh);if(r.length)return r[+(n===3)];let i=M(t),a=((e,t)=>{let n=e.R(wl(t,-I));return(e=>{if(e>I)throw RangeError(jh);return e})(e.R(wl(t,I))-n)})(e,i)*(n===2?-1:1);return(r=e.I(Wl(i,a)))[n===2?0:r.length-1]}function Ad(e,t){let n=e.I(t);if(n.length)return n[0];let r=wl(M(t),-I);return e.O(r,1)}function jd(e,t,n){return wu(Fl(Cl(t.epochNanoseconds,(e=>{if(sf(e))throw RangeError(Rh);return F(e,5)})(e?$d(n):n))))}function Md(e,t,n,r,i,a=Object.create(null)){let o=t(r.timeZone),s=e(r.calendar);return{...r,...Ld(o,s,r,n?$d(i):i,a)}}function Nd(e,t,n,r,i=Object.create(null)){let{calendar:a}=n;return Eu(Rd(e(a),n,t?$d(r):r,i),a)}function Pd(e,t,n,r,i){let{calendar:a}=n;return Du(zd(e(a),n,t?$d(r):r,i),a)}function Fd(e,t,n,r,i){let a=n.calendar,o=e(a),s=Nl(Bd(o,n));return t&&(r=Qd(r)),r.sign<0&&(s=o.P(s,{...z,months:1}),s=Hd(s,-1)),Ou(Bd(o,o.P(s,r,i)),a)}function Id(e,t,n){return Au(Vd(t,e?$d(n):n)[0])}function Ld(e,t,n,r,i){let a=F(r,5),o=n.epochNanoseconds;if(sf(r)){let s=W_(n,e);o=Cl(kd(e,{...zd(t,s,{...r,...Ig},i),...Hc(Rg,s)}),a)}else o=Cl(o,a),N(i);return{epochNanoseconds:Fl(o)}}function Rd(e,t,n,r){let[i,a]=Vd(t,n);return Pl({...zd(e,t,{...n,...Ig,days:n.days+a},r),...i})}function zd(e,t,n,r){if(n.years||n.months||n.weeks)return e.P(t,n,r);N(r);let i=n.days+F(n,5)[0];return i?Nl(Hd(t,i)):t}function Bd(e,t,n=1){return Hd(t,n-e.day(t))}function Vd(e,t){let[n,r]=F(t,5),[i,a]=Ll(Il(e)+r);return[i,n+a]}function Hd(e,t){return t?{...e,...Gl(zl(e)+t*Zh)}:e}function Ud(e,t,n){let r=e(n.calendar);return qd(n)?[n,r,t(n.timeZone)]:[{...n,...Wg},r]}function Wd(e){return e?Nu:M}function Gd(e){return e?j(Ld,e):Rd}function Kd(e){return e?j(up,e):dp}function qd(e){return e&&e.epochNanoseconds}function Jd(e,t){return e<=6-!!qd(t)}function Yd(e,t,n,r,i,a,o){let s=e(vu(o).relativeTo),c=Math.max(cf(i),cf(a));if(Jd(c,s))return P(nf(((e,t,n,r)=>{let i=Cl(F(e),F(t),r?-1:1);if(!Number.isFinite(i[0]))throw RangeError(Ph);return{...z,...af(i,n)}})(i,a,c,r)));if(!s)throw RangeError(Lh);r&&(a=$d(a));let[l,u,d]=Ud(t,n,s),f=Gd(d);return P(Kd(d)(u,l,f(u,f(u,l,i),a),c))}function Xd(e,t,n,r,i){let a=cf(r),[o,s,c,l,u]=((e,t,n)=>{e=yu(e,a_);let r=x_(e),i=n(e[l_]),a=hu(e),o=k_(e,7),s=b_(e);if(r===void 0&&s===void 0)throw RangeError(zh);if(s??=0,r??=Math.max(s,t),Cu(r,s),a=gu(a,s,1),a>1&&s>5&&r!==s)throw RangeError(`For calendar units with roundingIncrement > 1, use largestUnit = smallestUnit`);return[r,s,a,o,i]})(i,a,e);if(!u&&Math.max(a,o)<=6)return P(nf(((e,t,n,r,i)=>{let a=$u(F(e),n,r,i);return{...z,...af(a,t)}})(r,o,s,c,l)));if(!qd(u)&&!r.sign)return r;if(!u)throw RangeError(Lh);let[d,f,p]=Ud(t,n,u),m=Wd(p),h=Gd(p),ee=Kd(p),g=h(f,d,r);qd(u)||(Pl(d),Pl(g));let te=ee(f,d,g,o),_=r.sign,v=tf(te);if(_&&v&&_!==v)throw RangeError(wh);return te=Qu(te,m(g),o,s,c,l,f,d,m,h),P(te)}function Zd(e){return e.sign===-1?Qd(e):e}function Qd(e){return P($d(e))}function $d(e){let t={};for(let n of R)t[n]=-1*e[n]||0;return t}function ef(e){return!e.sign}function tf(e,t=R){let n=0;for(let r of t){let t=Math.sign(e[r]);if(t){if(n&&n!==t)throw RangeError(Ih);n=t}}return n}function nf(e){for(let t of Pg)jc(t,e[t],-G_,G_,1);return rf(Al(F(e),tg)),e}function rf(e){if(!Number.isSafeInteger(e))throw RangeError(Fh)}function F(e,t=6){return rl(e,t,R)}function af(e,t=6){let[n,r]=e,i=il(r,t,R);if(i[R[t]]+=n*(I/ig[t]),!Number.isFinite(i[R[t]]))throw RangeError(Ph);return i}function of(e,t=5){return il(e,t,R)}function sf(e){return!!tf(e,Ng)}function cf(e){let t=9;for(;t>0&&!e[R[t]];t--);return t}function lf(e,t){return[e,t]}function uf(e){let t=Math.floor(e/B_)*B_;return[t,t+B_]}function df(e){let t=Of(e=gl(e));if(!t)throw RangeError(Vh(e));let n;if(t.j)n=0;else{if(!t.offset)throw RangeError(Vh(e));n=mf(t.offset)}return t.timeZone&&jf(t.timeZone,1),wu(Bl(nu(t),n))}function ff(e){let t=Of(L(e));if(!t)throw RangeError(Vh(e));if(t.timeZone)return wf(t,t.offset?mf(t.offset):void 0);if(t.j)throw RangeError(Vh(e));return Ef(t)}function pf(e,t){let n=Of(L(e));if(!n||!n.timeZone)throw RangeError(Vh(e));let{offset:r}=n,i=r?mf(r):void 0,[,a,o]=su(t);return wf(n,i,a,o)}function mf(e){let t=jf(e);if(t===void 0)throw RangeError(Vh(e));return t}function hf(e){let t=Of(L(e));if(!t||t.j)throw RangeError(Vh(e));return Eu(Tf(t))}function gf(e,t,n){let r=Of(L(e));if(!r||r.j)throw RangeError(Vh(e));return t?r.calendar===`iso8601`&&(r=r.isoYear===-271821&&r.isoMonth===4?{...r,isoDay:20,...Wg}:{...r,isoDay:1,...Wg}):n&&r.calendar===`iso8601`&&(r={...r,isoYear:t_}),Du(r.C?Tf(r):Ef(r))}function _f(e,t){let n=kf(L(t));if(n)return vf(n),Ou(Ml(ru(n)));let r=gf(t,1);return Ou(Bd(e(r.calendar),r))}function vf(e){if(e.calendar!==`iso8601`)throw RangeError(Hh(e.calendar))}function yf(e,t){let n=Af(L(t));if(n)return vf(n),ku(ru(n));let r=gf(t,0,1),{calendar:i}=r,a=e(i),[o,s,c]=a.v(r),[l,u]=a.q(o,s),[d,f]=a.G(l,u,c);return ku(Nl(a.V(d,f,c)),i)}function bf(e){let t,n=(e=>{let t=iv.exec(e);return t?(Pf(t[10]),Nf(t)):void 0})(L(e));if(!n){if(n=Of(e),!n||!n.C)throw RangeError(Vh(e));if(n.j)throw RangeError(Hh(`Z`));vf(n)}if((t=kf(e))&&iu(t)||(t=Af(e))&&iu(t))throw RangeError(Vh(e));return Au(ou(n,1))}function xf(e){let t=(e=>{let t=sv.exec(e);return t?(e=>{function t(e,t,a){let o=0,s=0;if(a&&([o,i]=Zc(i,ig[a])),e!==void 0){if(r)throw RangeError(Hh(e));s=(e=>{let t=parseInt(e);if(!Number.isFinite(t))throw RangeError(Hh(e));return t})(e),n=1,t&&(i=Ff(t)*(ig[a]/tg),r=1)}return o+s}let n=0,r=0,i=0,a={...Rc(R,[t(e[2]),t(e[3]),t(e[4]),t(e[5]),t(e[6],e[7],5),t(e[8],e[9],4),t(e[10],e[11],3)]),...il(i,2,R)};if(!n)throw RangeError(uh(R));return Lf(e[1])<0&&(a=$d(a)),a})(t):void 0})(L(e));if(!t)throw RangeError(Vh(e));return P(nf(t))}function Sf(e){let t=Of(e)||kf(e)||Af(e);return t?t.calendar:e}function Cf(e){let t=Of(e);return t&&(t.timeZone||t.j&&z_||t.offset)||e}function wf(e,t,n=0,r=0){let i=Bf(e.timeZone),a=B(i),o;return nu(e),o=e.C?Od(a,e,t,n,r,!a.$,e.j):Ad(a,e),Tu(o,i,Kp(e.calendar))}function Tf(e){return Df(Pl(nu(e)))}function Ef(e){return Df(Nl(ru(e)))}function Df(e){return{...e,calendar:Kp(e.calendar)}}function Of(e){let t=rv.exec(e);return t?(e=>{let t=e[10],n=(t||``).toUpperCase()===`Z`;return{isoYear:Mf(e),isoMonth:parseInt(e[4]),isoDay:parseInt(e[5]),...Nf(e.slice(5)),...Pf(e[16]),C:!!e[6],j:n,offset:n?void 0:t}})(t):void 0}function kf(e){let t=tv.exec(e);return t?(e=>({isoYear:Mf(e),isoMonth:parseInt(e[4]),isoDay:1,...Pf(e[5])}))(t):void 0}function Af(e){let t=nv.exec(e);return t?(e=>({isoYear:t_,isoMonth:parseInt(e[1]),isoDay:parseInt(e[2]),...Pf(e[3])}))(t):void 0}function jf(e,t){let n=av.exec(e);return n?((e,t)=>{let n=e[4]||e[5];if(t&&n)throw RangeError(Hh(n));return(e=>{if(Math.abs(e)>=I)throw RangeError(Ah);return e})((Rf(e[2])*rg+Rf(e[3])*ng+Rf(e[4])*tg+Ff(e[5]||``))*Lf(e[1]))})(n,t):void 0}function Mf(e){let t=Lf(e[1]),n=parseInt(e[2]||e[3]);if(t<0&&!n)throw RangeError(Hh(-0));return t*n}function Nf(e){let t=Rf(e[3]);return{...Ll(Ff(e[4]||``))[0],isoHour:Rf(e[1]),isoMinute:Rf(e[2]),isoSecond:t===60?59:t}}function Pf(e){let t,n,r=[];if(e.replace(ov,((e,i,a)=>{let o=!!i,[s,c]=a.split(`=`).reverse();if(c){if(c===`u-ca`)r.push(s),t||=o;else if(o||/[A-Z]/.test(c))throw RangeError(Hh(e))}else{if(n)throw RangeError(Hh(e));n=s}return``})),r.length>1&&t)throw RangeError(Hh(e));return{timeZone:n,calendar:r[0]||`iso8601`}}function Ff(e){return parseInt(e.padEnd(9,`0`))}function If(e){return RegExp(`^${e}$`,`i`)}function Lf(e){return e&&e!==`+`?-1:1}function Rf(e){return e===void 0?0:parseInt(e)}function zf(e){return Bf(L(e))}function Bf(e){let t=Hf(e);return typeof t==`number`?xd(t):t?(e=>{if(uv.test(e))throw RangeError(Dh(e));if(lv.test(e))throw RangeError(kh);return e.toLowerCase().split(`/`).map(((e,t)=>(e.length<=3||/\d/.test(e))&&!/etc|yap/.test(e)?e.toUpperCase():e.replace(/baja|dumont|[a-z]+/g,((e,n)=>e.length<=2&&!t||e===`in`||e===`chat`?e.toUpperCase():e.length>2||!n?Kc(e).replace(/island|noronha|murdo|rivadavia|urville/,Kc):e)))).join(`/`)})(e):z_}function Vf(e){let t=Hf(e);return typeof t==`number`?t:t?t.resolvedOptions().timeZone:z_}function Hf(e){let t=jf(e=e.toUpperCase(),1);return t===void 0?e===z_?void 0:cv(e):t}function Uf(e,t){return El(e.epochNanoseconds,t.epochNanoseconds)}function Wf(e,t){return El(e.epochNanoseconds,t.epochNanoseconds)}function Gf(e,t,n,r,i,a){let o=e(vu(a).relativeTo),s=Math.max(cf(r),cf(i));if(Wc(R,r,i))return 0;if(Jd(s,o))return El(F(r),F(i));if(!o)throw RangeError(Lh);let[c,l,u]=Ud(t,n,o),d=Wd(u),f=Gd(u);return El(d(f(l,c,r)),d(f(l,c,i)))}function Kf(e,t){return qf(e,t)||Jf(e,t)}function qf(e,t){return Yc(zl(e),zl(t))}function Jf(e,t){return Yc(Il(e),Il(t))}function Yf(e,t){return!Uf(e,t)}function Xf(e,t){return!Wf(e,t)&&!!np(e.timeZone,t.timeZone)&&e.calendar===t.calendar}function Zf(e,t){return!Kf(e,t)&&e.calendar===t.calendar}function Qf(e,t){return!qf(e,t)&&e.calendar===t.calendar}function $f(e,t){return!qf(e,t)&&e.calendar===t.calendar}function ep(e,t){return!qf(e,t)&&e.calendar===t.calendar}function tp(e,t){return!Jf(e,t)}function np(e,t){if(e===t)return 1;try{return Vf(e)===Vf(t)}catch{}}function rp(e,t,n,r){let i=cu(e,r,3,5),a=mp(t.epochNanoseconds,n.epochNanoseconds,...i);return P(e?$d(a):a)}function ip(e,t,n,r,i,a){let o=yp(r.calendar,i.calendar),[s,c,l,u]=cu(n,a,5),d=r.epochNanoseconds,f=i.epochNanoseconds,p=El(f,d),m;if(p)if(s<6)m=mp(d,f,s,c,l,u);else{let n=t(((e,t)=>{if(!np(e,t))throw RangeError(Oh);return e})(r.timeZone,i.timeZone)),d=e(o);m=fp(d,n,r,i,p,s,a),m=Qu(m,f,s,c,l,u,d,r,Nu,j(Ld,n))}else m=z;return P(n?$d(m):m)}function ap(e,t,n,r,i){let a=yp(n.calendar,r.calendar),[o,s,c,l]=cu(t,i,6),u=M(n),d=M(r),f=El(d,u),p;if(f)if(o<=6)p=mp(u,d,o,s,c,l);else{let t=e(a);p=pp(t,n,r,f,o,i),p=Qu(p,d,o,s,c,l,t,n,M,Rd)}else p=z;return P(t?$d(p):p)}function op(e,t,n,r,i){let a=yp(n.calendar,r.calendar);return cp(t,(()=>e(a)),n,r,...cu(t,i,6,9,6))}function sp(e,t,n,r,i){let a=yp(n.calendar,r.calendar),o=cu(t,i,9,9,8),s=e(a),c=Bd(s,n),l=Bd(s,r);return c.isoYear===l.isoYear&&c.isoMonth===l.isoMonth&&c.isoDay===l.isoDay?P(z):cp(t,(()=>s),Nl(c),Nl(l),...o,8)}function cp(e,t,n,r,i,a,o,s,c=6){let l=M(n),u=M(r);if(l===void 0||u===void 0)throw RangeError(Ph);let d;if(El(u,l))if(i===6)d=mp(l,u,i,a,o,s);else{let e=t();d=e.N(n,r,i),a===c&&o===1||(d=Qu(d,u,i,a,o,s,e,n,M,zd))}else d=z;return P(e?$d(d):d)}function lp(e,t,n,r){let[i,a,o,s]=cu(e,r,5,5),c=td(vp(t,n),Ju(a,o),s),l={...z,...of(c,i)};return P(e?$d(l):l)}function up(e,t,n,r,i,a){let o=El(r.epochNanoseconds,n.epochNanoseconds);return o?i<6?hp(n.epochNanoseconds,r.epochNanoseconds,i):fp(t,e,n,r,o,i,a):z}function dp(e,t,n,r,i){let a=M(t),o=M(n),s=El(o,a);return s?r<=6?hp(a,o,r):pp(e,t,n,s,r,i):z}function fp(e,t,n,r,i,a,o){let[s,c,l]=((e,t,n,r)=>{function i(){return d={...Hd(s,l++*-r),...o},f=kd(e,d),El(c,f)===-r}let a=W_(t,e),o=Hc(Rg,a),s=W_(n,e),c=n.epochNanoseconds,l=0,u=vp(a,s),d,f;if(Math.sign(u)===-r&&l++,i()&&(r===-1||i()))throw RangeError(wh);let p=Al(Tl(f,c));return[a,d,p]})(t,n,r,i);var u,d;return{...a===6?(u=s,d=c,{...z,days:gp(u,d)}):e.N(s,c,a,o),...of(l)}}function pp(e,t,n,r,i,a){let[o,s,c]=((e,t,n)=>{let r=t,i=vp(e,t);return Math.sign(i)===-n&&(r=Hd(t,-n),i+=I*n),[e,r,i]})(t,n,r);return{...e.N(o,s,i,a),...of(c)}}function mp(e,t,n,r,i,a){return{...z,...af($u(Tl(e,t),r,i,a),n)}}function hp(e,t,n){return{...z,...af(Tl(e,t),n)}}function gp(e,t){return _p(zl(e),zl(t))}function _p(e,t){return Math.trunc((t-e)/Zh)}function vp(e,t){return Il(t)-Il(e)}function yp(e,t){if(e!==t)throw RangeError(Eh);return e}function bp(e){return this.m(e)[0]}function xp(e){return this.m(e)[1]}function Sp(e){let[t]=this.v(e);return _p(this.p(t),zl(e))+1}function Cp(e){let t=dv.exec(e);if(!t)throw RangeError(bh(e));return[parseInt(t[1]),!!t[2]]}function wp(e,t){return`M`+Jh(e)+(t?`L`:``)}function Tp(e,t,n){return e+(t||n&&e>=n?1:0)}function Ep(e,t){return e-(t&&e>=t?1:0)}function Dp(e,t){return(t+e)*(Math.sign(t)||1)||0}function Op(e){return Eg[Ap(e)]}function kp(e){return Og[Ap(e)]}function Ap(e){return qp(e.id||`iso8601`)}function jp(e){function t(e){return((e,t)=>({...Pp(e,t),o:e.month,day:parseInt(e.day)}))(Kl(n,e),r)}let n=pv(e),r=qp(e);return{id:e,h:Mp(t),l:Np(t)}}function Mp(e){return Nc((t=>e(zl(t))),WeakMap)}function Np(e){let t=e(0).year-e_;return Nc((n=>{let r,i=Hl(n-t),a=0,o=[],s=[];do i+=400*Zh;while((r=e(i)).year<=n);do if(i+=(1-r.day)*Zh,r.year===n&&(o.push(i),s.push(r.o)),i-=Zh,++a>100||i<-qg)throw RangeError(wh);while((r=e(i)).year>=n);return{i:o.reverse(),u:Kh(s.reverse())}}))}function Pp(e,t){let n,r,i=Fp(e);if(e.era){let a=Eg[t],o=Dg[t]||{};a!==void 0&&(n=t===`islamic`?`ah`:e.era.normalize(`NFD`).toLowerCase().replace(/[^a-z0-9]/g,``),n===`bc`||n===`b`?n=`bce`:n===`ad`||n===`a`?n=`ce`:n===`beforeroc`&&(n=`broc`),n=o[n]||n,r=i,i=Dp(r,a[n]||0))}return{era:n,eraYear:r,year:i}}function Fp(e){return parseInt(e.relatedYear||e.year)}function Ip(e){let{year:t,o:n,day:r}=this.h(e),{u:i}=this.l(t);return[t,i[n]+1,r]}function Lp(e,t=1,n=1){return this.l(e).i[t-1]+(n-1)*Zh}function Rp(e,t){let n=zp.call(this,e);return[Ep(t,n),n===t]}function zp(e){let t=Wp(this,e),n=Wp(this,e-1),r=t.length;if(r>n.length){let e=kp(this);if(e<0)return-e;for(let e=0;e<r;e++)if(t[e]!==n[e])return e+1}}function Bp(e){return _p(Lp.call(this,e),Lp.call(this,e+1))}function Vp(e,t){let{i:n}=this.l(e),r=t+1,i=n;return r>n.length&&(r=1,i=this.l(e+1).i),_p(n[t-1],i[r-1])}function Hp(e){return this.l(e).i.length}function Up(e){let t=this.h(e);return[t.era,t.eraYear]}function Wp(e,t){return Object.keys(e.l(t).u)}function Gp(e){return Kp(L(e))}function Kp(e){if((e=e.toLowerCase())!==`iso8601`&&e!==wg){let t=pv(e).resolvedOptions().calendar;if(qp(e)!==qp(t))throw RangeError(Th(e));return t}return e}function qp(e){return e===`islamicc`&&(e=`islamic`),e.split(`-`)[0]}function Jp(e,t){return n=>n===`iso8601`?e:n===wg||n===Tg?Object.assign(Object.create(e),{id:n}):Object.assign(Object.create(t),fv(n))}function Yp(e,t,n,r){let i=rm(n,r,yg,[],ug);if(i.timeZone!==void 0){let r=n.F(i),a=am(i),o=e(i.timeZone);return{epochNanoseconds:Od(t(o),{...r,...a},i.offset===void 0?void 0:mf(i.offset)),timeZone:o}}return{...n.F(i),...Wg}}function Xp(e,t,n,r,i,a){let o=rm(n,i,yg,cg,ug),s=e(o.timeZone),[c,l,u]=su(a),d=n.F(o,bu(c)),f=am(o,c);return Tu(Od(t(s),{...d,...f},o.offset===void 0?void 0:mf(o.offset),l,u),s,r)}function Zp(e,t,n){let r=rm(e,t,yg,[],ag),i=N(n);return Eu(Pl({...e.F(r,bu(i)),...am(r,i)}))}function Qp(e,t,n,r=[]){let i=rm(e,t,yg,r);return e.F(i,n)}function $p(e,t,n,r){let i=rm(e,t,_g,r);return e.K(i,n)}function em(e,t,n,r){let i=rm(e,n,yg,gg);return t&&i.month!==void 0&&i.monthCode===void 0&&i.year===void 0&&(i.year=t_),e._(i,r)}function tm(e,t){return Au(am(im(e,og,[],1),N(t)))}function nm(e){let t=im(e,jg);return P(nf({...z,...t}))}function rm(e,t,n,r=[],i=[]){return im(t,[...e.fields(n),...i].sort(),r)}function im(e,t,n,r=!n){let i={},a,o=0;for(let r of t){if(r===a)throw RangeError(lh(r));if(r===`constructor`||r===`__proto__`)throw RangeError(ch(r));let t=e[r];if(t!==void 0)o=1,bv[r]&&(t=bv[r](t,r)),i[r]=t;else if(n){if(n.includes(r))throw TypeError(sh(r));i[r]=Sg[r]}a=r}if(r&&!o)throw TypeError(uh(t));return i}function am(e,t){return ou(xv({...Sg,...e}),t)}function om(e,t,n,r,i){let{calendar:a,timeZone:o}=n,s=e(a),c=t(o),l=[...s.fields(yg),...lg].sort(),u=(e=>{let t=W_(e,B),n=xd(t.offsetNanoseconds),r=yv(e.calendar),[i,a,o]=r.v(t),[s,c]=r.q(i,a),l=wp(s,c);return{...Sv(t),year:i,monthCode:l,day:o,offset:n}})(n),d=im(r,l),f=s.k(u,d),p={...u,...d},[m,h,ee]=su(i,2);return Tu(Od(c,{...s.F(f,bu(m)),...ou(xv(p),m)},mf(p.offset),h,ee),o,a)}function sm(e,t,n,r){let i=e(t.calendar),a=[...i.fields(yg),...ag].sort(),o={...vm(s=t),hour:s.isoHour,minute:s.isoMinute,second:s.isoSecond,millisecond:s.isoMillisecond,microsecond:s.isoMicrosecond,nanosecond:s.isoNanosecond};var s;let c=im(n,a),l=N(r),u=i.k(o,c),d={...o,...c};return Eu(Pl({...i.F(u,bu(l)),...ou(xv(d),l)}))}function cm(e,t,n,r){let i=e(t.calendar),a=i.fields(yg).sort(),o=vm(t),s=im(n,a),c=i.k(o,s);return i.F(c,r)}function lm(e,t,n,r){let i=e(t.calendar),a=i.fields(_g).sort(),o=(e=>{let t=yv(e.calendar),[n,r]=t.v(e),[i,a]=t.q(n,r);return{year:n,monthCode:wp(i,a)}})(t),s=im(n,a),c=i.k(o,s);return i.K(c,r)}function um(e,t,n,r){let i=e(t.calendar),a=i.fields(yg).sort(),o=(e=>{let t=yv(e.calendar),[n,r,i]=t.v(e),[a,o]=t.q(n,r);return{monthCode:wp(a,o),day:i}})(t),s=im(n,a),c=i.k(o,s);return i._(c,r)}function dm(e,t,n){return Au(((e,t,n)=>am({...Hc(og,e),...im(t,og)},N(n)))(e,t,n))}function fm(e,t){return P((n=e,r=t,nf({...n,...im(r,jg)})));var n,r}function pm(e,t,n,r,i){t=Hc(n=e.fields(n),t),r=im(r,i=e.fields(i),[]);let a=e.k(t,r);return a=im(a,[...n,...i].sort(),[]),e.F(a)}function mm(e,t){let n=Op(e),r=Dg[e.id||``]||{},{era:i,eraYear:a,year:o}=t;if(i!==void 0||a!==void 0){if(i===void 0||a===void 0)throw TypeError(gh);if(!n)throw RangeError(hh);let e=n[r[i]||i];if(e===void 0)throw RangeError(vh(i));let t=Dp(a,e);if(o!==void 0&&o!==t)throw RangeError(_h);o=t}else if(o===void 0)throw TypeError(yh(n));return o}function hm(e,t,n,r){let{month:i,monthCode:a}=t;if(a!==void 0){let t=((e,t,n,r)=>{let i=e.L(n),[a,o]=Cp(t),s=Tp(a,o,i);if(o){let t=kp(e);if(t===void 0)throw RangeError(Ch);if(t>0){if(s>t)throw RangeError(Ch);if(i===void 0){if(r===1)throw RangeError(Ch);s--}}else if(s!==-t||i===void 0&&r===1)throw RangeError(Ch)}return s})(e,a,n,r);if(i!==void 0&&i!==t)throw RangeError(xh);i=t,r=1}else if(i===void 0)throw TypeError(Sh);return jc(`month`,i,1,e.B(n),r)}function gm(e,t,n,r,i){return Ac(t,`day`,1,e.U(r,n),i)}function _m(e,t,n,r){let i=0,a=[];for(let e of n)t[e]===void 0?a.push(e):i=1;if(Object.assign(e,t),i)for(let t of r||a)delete e[t]}function vm(e){let t=yv(e.calendar),[n,r,i]=t.v(e),[a,o]=t.q(n,r);return{year:n,monthCode:wp(a,o),day:i}}function ym(e){return wu(Fl(Ol(_l(e))))}function bm(e,t,n,r,i=Cg){return Tu(Fl(Ol(_l(n))),t(r),e(i))}function xm(e,t,n,r,i=0,a=0,o=0,s=0,c=0,l=0,u=Cg){return Eu(Pl(nu(zc(yl,Rc(Bg,[t,n,r,i,a,o,s,c,l])))),e(u))}function Sm(e,t,n,r,i=Cg){return Du(Nl(ru(zc(yl,{isoYear:t,isoMonth:n,isoDay:r}))),e(i))}function Cm(e,t,n,r=Cg,i=1){let a=yl(t),o=yl(n),s=e(r);return Ou(Ml(ru({isoYear:a,isoMonth:o,isoDay:yl(i)})),s)}function wm(e,t,n,r=Cg,i=t_){let a=yl(t),o=yl(n),s=e(r);return ku(Nl(ru({isoYear:yl(i),isoMonth:a,isoDay:o})),s)}function Tm(e=0,t=0,n=0,r=0,i=0,a=0){return Au(ou(zc(yl,Rc(Rg,[e,t,n,r,i,a])),1))}function Em(e=0,t=0,n=0,r=0,i=0,a=0,o=0,s=0,c=0,l=0){return P(nf(zc(bl,Rc(R,[e,t,n,r,i,a,o,s,c,l]))))}function Dm(e,t,n=Cg){return Tu(e.epochNanoseconds,t,n)}function Om(e){return wu(e.epochNanoseconds)}function km(e,t){return Eu(W_(t,e))}function Am(e,t){return Du(W_(t,e))}function jm(e,t){return Au(W_(t,e))}function Mm(e,t,n,r){return Tu(Fl(((e,t,n,r)=>{let i=(e=>w_(vu(e)))(r);return kd(e(t),n,i)})(e,n,t,r)),n,t.calendar)}function Nm(e,t,n,r,i){let a=e(i.timeZone),o=i.plainTime,s=o===void 0?void 0:t(o),c=n(a),l;return l=s?kd(c,{...r,...s}):Ad(c,{...r,...Wg}),Tu(l,a,r.calendar)}function Pm(e,t=Wg){return Eu(Pl({...e,...t}))}function Fm(e,t,n){return((e,t)=>{let n=rm(e,t,vg);return e.K(n,void 0)})(e(t.calendar),n)}function Im(e,t,n){return((e,t)=>{let n=rm(e,t,xg);return e._(n)})(e(t.calendar),n)}function Lm(e,t,n,r){return((e,t,n)=>pm(e,t,vg,dl(n),gg))(e(t.calendar),n,r)}function Rm(e,t,n,r){return((e,t,n)=>pm(e,t,xg,dl(n),pg))(e(t.calendar),n,r)}function zm(e){return wu(Fl(kl(bl(e),eg)))}function Bm(e){return wu(Fl(Ol(_l(e))))}function Vm(e,t,n){let r=new Set(n);return(i,a)=>{let o=n&&Uc(i,n);if(!Uc(i=((e,t)=>{let n={};for(let r in t)e.has(r)||(n[r]=t[r]);return n})(r,i),e)){if(a&&o)throw TypeError(`Invalid formatting options`);i={...t,...i}}return n&&(i.timeZone=z_,[`full`,`long`].includes(i.J)&&(i.J=`medium`)),i}}function Hm(e,t=Um,n=0){let[r,,,i]=e;return(a,o=Qv,...s)=>{let c=t(i&&i(...s),a,o,r,n);return[c,...Wm(e,c.resolvedOptions(),s)]}}function Um(e,t,n,r,i){if(n=r(n,i),e){if(n.timeZone!==void 0)throw TypeError(Gh);n.timeZone=e}return new Qg(t,n)}function Wm(e,t,n){let[,r,i]=e;return n.map((e=>(e.calendar&&((e,t,n)=>{if((n||e!==`iso8601`)&&e!==t)throw RangeError(Eh)})(e.calendar,t.calendar,i),r(e,t))))}function Gm(e,t,n){let r=t.timeZone,i=e(r),a={...W_(t,i),...n||Wg},o;return o=n?Od(i,a,a.offsetNanoseconds,2):Ad(i,a),Tu(o,r,t.calendar)}function Km(e,t=Wg){return Eu(Pl({...e,...t}))}function qm(e,t){return{...e,calendar:t}}function Jm(e,t){return{...e,timeZone:t}}function Ym(e){let t=Xm();return Wl(t,e.R(t))}function Xm(){return kl(Date.now(),eg)}function Zm(){return sy||=new Qg().resolvedOptions().timeZone}var Qm=(e,t)=>`Non-integer ${e}: ${t}`,$m=(e,t)=>`Non-positive ${e}: ${t}`,eh=(e,t)=>`Non-finite ${e}: ${t}`,th=e=>`Cannot convert bigint to ${e}`,nh=e=>`Invalid bigint: ${e}`,rh=`Cannot convert Symbol to string`,ih=`Invalid object`,ah=(e,t,n,r,i)=>i?ah(e,i[t],i[n],i[r]):oh(e,t)+`; must be between ${n}-${r}`,oh=(e,t)=>`Invalid ${e}: ${t}`,sh=e=>`Missing ${e}`,ch=e=>`Invalid field ${e}`,lh=e=>`Duplicate field ${e}`,uh=e=>`No valid fields: `+e.join(),dh=`Invalid bag`,fh=(e,t,n)=>oh(e,t)+`; must be `+Object.keys(n).join(),ph=`Cannot use valueOf`,mh=`Invalid calling context`,hh=`Forbidden era/eraYear`,gh=`Mismatching era/eraYear`,_h=`Mismatching year/eraYear`,vh=e=>`Invalid era: ${e}`,yh=e=>`Missing year`+(e?`/era/eraYear`:``),bh=e=>`Invalid monthCode: ${e}`,xh=`Mismatching month/monthCode`,Sh=`Missing month/monthCode`,Ch=`Invalid leap month`,wh=`Invalid protocol results`,Th=e=>oh(`Calendar`,e),Eh=`Mismatching Calendars`,Dh=e=>oh(`TimeZone`,e),Oh=`Mismatching TimeZones`,kh=`Forbidden ICU TimeZone`,Ah=`Out-of-bounds offset`,jh=`Out-of-bounds TimeZone gap`,Mh=`Invalid TimeZone offset`,Nh=`Ambiguous offset`,Ph=`Out-of-bounds date`,Fh=`Out-of-bounds duration`,Ih=`Cannot mix duration signs`,Lh=`Missing relativeTo`,Rh=`Cannot use large units`,zh=`Required smallestUnit or largestUnit`,Bh=`smallestUnit > largestUnit`,Vh=e=>`Cannot parse: ${e}`,Hh=e=>`Invalid substring: ${e}`,Uh=e=>`Cannot format ${e}`,Wh=`Mismatching types for formatting`,Gh=`Cannot specify TimeZone`,Kh=j(Bc,((e,t)=>t)),qh=j(Bc,((e,t,n)=>n)),Jh=j(Jc,2),Yh={nanosecond:0,microsecond:1,millisecond:2,second:3,minute:4,hour:5,day:6,week:7,month:8,year:9},Xh=Object.keys(Yh),Zh=864e5,Qh=1e3,$h=1e3,eg=1e6,tg=1e9,ng=6e10,rg=36e11,I=864e11,ig=[1,$h,eg,tg,ng,rg,I],ag=Xh.slice(0,6),og=qc(ag),sg=[`offset`],cg=[`timeZone`],lg=ag.concat(sg),ug=lg.concat(cg),dg=[`era`,`eraYear`],fg=dg.concat([`year`]),pg=[`year`],mg=[`monthCode`],hg=[`month`].concat(mg),gg=[`day`],_g=hg.concat(pg),vg=mg.concat(pg),yg=gg.concat(_g),bg=gg.concat(hg),xg=gg.concat(mg),Sg=qh(ag,0),Cg=`iso8601`,wg=`gregory`,Tg=`japanese`,Eg={[wg]:{"gregory-inverse":-1,gregory:0},[Tg]:{"japanese-inverse":-1,japanese:0,meiji:1867,taisho:1911,showa:1925,heisei:1988,reiwa:2018},ethiopic:{ethioaa:0,ethiopic:5500},coptic:{"coptic-inverse":-1,coptic:0},roc:{"roc-inverse":-1,roc:0},buddhist:{be:0},islamic:{ah:0},indian:{saka:0},persian:{ap:0}},Dg={[wg]:{bce:`gregory-inverse`,ce:`gregory`},[Tg]:{bce:`japanese-inverse`,ce:`japanese`},ethiopic:{era0:`ethioaa`,era1:`ethiopic`},coptic:{era0:`coptic-inverse`,era1:`coptic`},roc:{broc:`roc-inverse`,minguo:`roc`}},Og={chinese:13,dangi:13,hebrew:-6},L=j(fl,`string`),kg=j(fl,`boolean`),Ag=j(fl,`number`),R=Xh.map((e=>e+`s`)),jg=qc(R),Mg=R.slice(0,6),Ng=R.slice(6),Pg=Ng.slice(1),Fg=Kh(R),z=qh(R,0),Ig=qh(Mg,0),Lg=j(Gc,R),Rg=[`isoNanosecond`,`isoMicrosecond`,`isoMillisecond`,`isoSecond`,`isoMinute`,`isoHour`],zg=[`isoDay`,`isoMonth`,`isoYear`],Bg=Rg.concat(zg),Vg=qc(zg),Hg=qc(Rg),Ug=qc(Bg),Wg=qh(Hg,0),Gg=j(Gc,Bg),Kg=1e8,qg=Kg*Zh,Jg=[Kg,0],Yg=[-1e8,0],Xg=275760,Zg=-271821,Qg=Intl.DateTimeFormat,$g=`en-GB`,e_=1970,t_=1972,n_=12,r_=Hl(1868,9,8),i_=Nc(tu,WeakMap),a_=`smallestUnit`,o_=`unit`,s_=`roundingIncrement`,c_=`fractionalSecondDigits`,l_=`relativeTo`,u_=`direction`,d_={constrain:0,reject:1},f_=Object.keys(d_),p_={compatible:0,reject:1,earlier:2,later:3},m_={reject:0,use:1,prefer:2,ignore:3},h_={auto:0,never:1,critical:2,always:3},g_={auto:0,never:1,critical:2},__={auto:0,never:1},v_={floor:0,halfFloor:1,ceil:2,halfCeil:3,trunc:4,halfTrunc:5,expand:6,halfExpand:7,halfEven:8},y_={previous:-1,next:1},b_=j(xu,a_),x_=j(xu,`largestUnit`),S_=j(xu,o_),C_=j(Su,`overflow`,d_),w_=j(Su,`disambiguation`,p_),T_=j(Su,`offset`,m_),E_=j(Su,`calendarName`,h_),D_=j(Su,`timeZoneName`,g_),O_=j(Su,`offset`,__),k_=j(Su,`roundingMode`,v_),A_=`PlainYearMonth`,j_=`PlainMonthDay`,M_=`PlainDate`,N_=`PlainDateTime`,P_=`PlainTime`,F_=`ZonedDateTime`,I_=`Instant`,L_=`Duration`,R_=[Math.floor,e=>nl(e)?Math.floor(e):Math.round(e),Math.ceil,e=>nl(e)?Math.ceil(e):Math.round(e),Math.trunc,e=>nl(e)?Math.trunc(e)||0:Math.round(e),e=>e<0?Math.floor(e):Math.ceil(e),e=>Math.sign(e)*Math.round(Math.abs(e))||0,e=>nl(e)?(e=Math.trunc(e)||0)+e%2:Math.round(e)],z_=`UTC`,B_=5184e3,V_=Vl(1847),H_=Vl(new Date().getUTCFullYear()+10),U_=/0+$/,W_=Nc(Dd,WeakMap),G_=2**32-1,B=Nc((e=>{let t=Hf(e);return typeof t==`object`?new q_(t):new K_(t||0)})),K_=class{constructor(e){this.$=e}R(){return this.$}I(e){return(e=>{let t=M({...e,...Wg});if(!t||Math.abs(t[0])>1e8)throw RangeError(Ph)})(e),[Bl(e,this.$)]}O(){}},q_=class{constructor(e){this.nn=(e=>{function t(e){let[t,s]=uf(Xc(e,a,o)),c=r(t),l=r(s);return c===l?c:n(i(t,s),c,l,e)}function n(t,n,r,i){let a,o;for(;(i===void 0||(a=i<t[0]?n:i>=t[1]?r:void 0)===void 0)&&(o=t[1]-t[0]);){let n=t[0]+Math.floor(o/2);e(n)===r?t[1]=n:t[0]=n+1}return a}let r=Nc(e),i=Nc(lf),a=V_,o=H_;return{tn(e){let n=t(e-86400),r=t(e+86400),i=e-n,a=e-r;if(n===r)return[i];let o=t(i);return o===t(a)?[e-o]:n>r?[i,a]:[]},rn:t,O(e,t){let s=Xc(e,a,o),[c,l]=uf(s),u=B_*t,d=t<0?()=>l>a||(a=s,0):()=>c<o||(o=s,0);for(;d();){let a=r(c),o=r(l);if(a!==o){let r=i(c,l);n(r,a,o);let s=r[0];if((Yc(s,e)||1)===t)return s}c+=u,l+=u}}}})((e=>t=>{let n=Kl(e,t*Qh);return Vl(Fp(n),parseInt(n.month),parseInt(n.day),parseInt(n.hour),parseInt(n.minute),parseInt(n.second))-t})(e))}R(e){return this.nn.rn((e=>Rl(e)[0])(e))*tg}I(e){let[t,n]=[Vl((r=e).isoYear,r.isoMonth,r.isoDay,r.isoHour,r.isoMinute,r.isoSecond),r.isoMillisecond*eg+r.isoMicrosecond*$h+r.isoNanosecond];var r;return this.nn.tn(t).map((e=>Fl(wl(kl(e,tg),n))))}O(e,t){let[n,r]=Rl(e),i=this.nn.O(n+(t>0||r?1:0),t);if(i!==void 0)return kl(i,tg)}},J_=`([+-])`,Y_=`(?:[.,](\\d{1,9}))?`,X_=`(?:(?:${J_}(\\d{6}))|(\\d{4}))-?(\\d{2})`,Z_=`([+-])(\\d{2})(?::?(\\d{2})(?::?(\\d{2})(?:[.,](\\d{1,9}))?)?)?`,Q_=X_+`-?(\\d{2})(?:[T ](\\d{2})(?::?(\\d{2})(?::?(\\d{2})(?:[.,](\\d{1,9}))?)?)?(Z|([+-])(\\d{2})(?::?(\\d{2})(?::?(\\d{2})(?:[.,](\\d{1,9}))?)?)?)?)?`,$_=`\\[(!?)([^\\]]*)\\]`,ev=`((?:${$_}){0,9})`,tv=If(X_+ev),nv=If(`(?:--)?(\\d{2})-?(\\d{2})`+ev),rv=If(Q_+ev),iv=If(`T?(\\d{2})(?::?(\\d{2})(?::?(\\d{2})(?:[.,](\\d{1,9}))?)?)?(?:([+-])(\\d{2})(?::?(\\d{2})(?::?(\\d{2})(?:[.,](\\d{1,9}))?)?)?)?`+ev),av=If(Z_),ov=new RegExp($_,`g`),sv=If(`${J_}?P(\\d+Y)?(\\d+M)?(\\d+W)?(\\d+D)?(?:T(?:(\\d+)${Y_}H)?(?:(\\d+)${Y_}M)?(?:(\\d+)${Y_}S)?)?`),cv=Nc((e=>new Qg($g,{timeZone:e,era:`short`,year:`numeric`,month:`numeric`,day:`numeric`,hour:`numeric`,minute:`numeric`,second:`numeric`}))),lv=/^(AC|AE|AG|AR|AS|BE|BS|CA|CN|CS|CT|EA|EC|IE|IS|JS|MI|NE|NS|PL|PN|PR|PS|SS|VS)T$/,uv=/[^\w\/:+-]+/,dv=/^M(\d{2})(L?)$/,fv=Nc(jp),pv=Nc((e=>new Qg($g,{calendar:e,timeZone:z_,era:`short`,year:`numeric`,month:`short`,day:`numeric`}))),mv={P(e,t,n){let r=N(n),i,{years:a,months:o,weeks:s,days:c}=t;if(c+=F(t,5)[0],a||o)i=((e,t,n,r,i)=>{let[a,o,s]=e.v(t);if(n){let[t,r]=e.q(a,o);a+=n,o=Tp(t,r,e.L(a)),o=jc(`month`,o,1,e.B(a),i)}return r&&([a,o]=e.un(a,o,r)),s=jc(`day`,s,1,e.U(a,o),i),e.p(a,o,s)})(this,e,a,o,r);else{if(!s&&!c)return e;i=zl(e)}if(i===void 0)throw RangeError(Ph);return i+=(7*s+c)*Zh,Nl(Gl(i))},N(e,t,n){if(n<=7){let r=0,i=gp({...e,...Wg},{...t,...Wg});return n===7&&([r,i]=$c(i,7)),{...z,weeks:r,days:i}}let r=this.v(e),i=this.v(t),[a,o,s]=((e,t,n,r,i,a,o)=>{let s=i-t,c=a-n,l=o-r;if(s||c){let u=Math.sign(s||c),d=e.U(i,a),f=0;if(Math.sign(l)===-u){let r=d;[i,a]=e.un(i,a,-u),s=i-t,c=a-n,d=e.U(i,a),f=u<0?-r:d}if(l=o-Math.min(r,d)+f,s){let[r,o]=e.q(t,n),[l,d]=e.q(i,a);if(c=l-r||Number(d)-Number(o),Math.sign(c)===-u){let n=u<0&&-e.B(i);s=(i-=u)-t,c=a-Tp(r,o,e.L(i))+(n||e.B(i))}}}return[s,c,l]})(this,...r,...i);return n===8&&(o+=this.cn(a,r[0]),a=0),{...z,years:a,months:o,days:s}},F(e,t){let n=N(t),r=mm(this,e),i=hm(this,e,r,n),a=gm(this,e,i,r,n);return Du(Nl(this.V(r,i,a)),this.id||`iso8601`)},K(e,t){let n=N(t),r=mm(this,e),i=hm(this,e,r,n);return Ou(Ml(this.V(r,i,1)),this.id||`iso8601`)},_(e,t){let n=N(t),r,i,a,o=e.eraYear!==void 0||e.year!==void 0?mm(this,e):void 0,s=!this.id;if(o===void 0&&s&&(o=t_),o!==void 0){let t=hm(this,e,o,n);r=gm(this,e,t,o,n);let s=this.L(o);i=Ep(t,s),a=t===s}else{if(e.monthCode===void 0)throw TypeError(Sh);if([i,a]=Cp(e.monthCode),this.id&&this.id!==wg&&this.id!==Tg)if(this.id&&qp(this.id)===`coptic`&&n===0){let t=a||i!==13?30:6;r=e.day,r=Xc(r,1,t)}else if(this.id&&qp(this.id)===`chinese`&&n===0){let t=!a||i!==1&&i!==9&&i!==10&&i!==11&&i!==12?30:29;r=e.day,r=Xc(r,1,t)}else r=e.day;else r=gm(this,e,hm(this,e,t_,n),t_,n)}let c=this.G(i,a,r);if(!c)throw RangeError(`Cannot guess year`);let[l,u]=c;return ku(Nl(this.V(l,u,r)),this.id||`iso8601`)},fields(e){return Op(this)&&e.includes(`year`)?[...e,...dg]:e},k(e,t){let n=Object.assign(Object.create(null),e);return _m(n,t,hg),Op(this)&&(_m(n,t,fg),this.id===Tg&&_m(n,t,bg,dg)),n},inLeapYear(e){let[t]=this.v(e);return this.sn(t)},monthsInYear(e){let[t]=this.v(e);return this.B(t)},daysInMonth(e){let[t,n]=this.v(e);return this.U(t,n)},daysInYear(e){let[t]=this.v(e);return this.fn(t)},dayOfYear:Sp,era(e){return this.hn(e)[0]},eraYear(e){return this.hn(e)[1]},monthCode(e){let[t,n]=this.v(e),[r,i]=this.q(t,n);return wp(r,i)},dayOfWeek:$l,daysInWeek(){return 7}},hv={v:ql,hn:eu,q:Jl},gv=Object.assign({},mv,Object.assign({},{dayOfYear:Sp,v:ql,p:Hl},{weekOfYear:bp,yearOfWeek:xp,m(e){function t(e){return(7-e<r?7:0)-e}function n(e){let n=Zl(f+e),r=e||1;return u=(n+(t(Qc(c+n*r,7))-l)*r)/7}let r=this.id?1:4,i=$l(e),a=this.dayOfYear(e),o=Qc(i-1,7),s=a-1,c=Qc(o-s,7),l=t(c),u,d=Math.floor((s-l)/7)+1,f=e.isoYear;return d?d>n(0)&&(d=1,f++):(d=n(-1),f--),[d,f,u]}}),{v:ql,hn:eu,q:Jl,G(e,t){if(!t)return[t_,e]},sn:Ql,L(){},B:Yl,cn:e=>e*n_,U:Xl,fn:Zl,V:(e,t,n)=>({isoYear:e,isoMonth:t,isoDay:n}),p:Hl,un:(e,t,n)=>(e+=el(n,n_),(t+=tl(n,n_))<1?(e--,t+=n_):t>n_&&(e++,t-=n_),[e,t]),year(e){return e.isoYear},month(e){return e.isoMonth},day:e=>e.isoDay}),_v={v:Ip,hn:Up,q:Rp},vv=Object.assign({},mv,{dayOfYear:Sp,v:Ip,p:Lp,weekOfYear:bp,yearOfWeek:xp,m(){return[]}},{v:Ip,hn:Up,q:Rp,G(e,t,n){let r=this.id&&qp(this.id)===`chinese`?((e,t,n)=>{if(t)switch(e){case 1:return 1651;case 2:return n<30?1947:1765;case 3:return n<30?1966:1955;case 4:return n<30?1963:1944;case 5:return n<30?1971:1952;case 6:return n<30?1960:1941;case 7:return n<30?1968:1938;case 8:return n<30?1957:1718;case 9:return 1832;case 10:return 1870;case 11:return 1814;case 12:return 1890}return 1972})(e,t,n):t_,[i,a,o]=Ip.call(this,{isoYear:r,isoMonth:n_,isoDay:31}),s=zp.call(this,i),c=a===s;(Yc(e,Ep(a,s))||Yc(Number(t),Number(c))||Yc(n,o))===1&&i--;for(let r=0;r<100;r++){let a=i-r,o=zp.call(this,a),s=Tp(e,t,o);if(t===(s===o)&&n<=Vp.call(this,a,s))return[a,s]}},sn(e){let t=Bp.call(this,e);return t>Bp.call(this,e-1)&&t>Bp.call(this,e+1)},L:zp,B:Hp,cn(e,t){let n=t+e,r=Math.sign(e),i=r<0?-1:0,a=0;for(let e=t;e!==n;e+=r)a+=Hp.call(this,e+i);return a},U:Vp,fn:Bp,V(e,t,n){return Gl(Lp.call(this,e,t,n))},p:Lp,un(e,t,n){if(n){if(t+=n,!Number.isSafeInteger(t))throw RangeError(Ph);if(n<0)for(;t<1;)t+=Hp.call(this,--e);else{let n;for(;t>(n=Hp.call(this,e));)t-=n,e++}}return[e,t]},year(e){return this.h(e).year},month(e){let{year:t,o:n}=this.h(e),{u:r}=this.l(t);return r[n]+1},day(e){return this.h(e).day}}),yv=Jp(hv,_v),V=Jp(gv,vv),bv={era:gl,eraYear:yl,year:yl,month:xl,monthCode(e){let t=gl(e);return Cp(t),t},day:xl,...qh(ag,yl),...qh(R,bl),offset(e){let t=gl(e);return mf(t),t}},xv=j(Vc,ag,Rg),Sv=j(Vc,Rg,ag),Cv=`numeric`,wv=[`timeZoneName`],Tv={month:Cv,day:Cv},Ev={year:Cv,month:Cv},Dv=Object.assign({},Ev,{day:Cv}),Ov={hour:Cv,minute:Cv,second:Cv},kv=Object.assign({},Dv,Ov),Av=Object.assign({},kv,{timeZoneName:`short`}),jv=Object.keys(Ev),Mv=Object.keys(Tv),Nv=Object.keys(Dv),Pv=Object.keys(Ov),Fv=[`dateStyle`],Iv=jv.concat(Fv),Lv=Mv.concat(Fv),Rv=Nv.concat(Fv,[`weekday`]),zv=Pv.concat([`dayPeriod`,`timeStyle`,`fractionalSecondDigits`]),Bv=Rv.concat(zv),Vv=wv.concat(zv),Hv=wv.concat(Rv),Uv=wv.concat([`day`,`weekday`],zv),Wv=wv.concat([`year`,`weekday`],zv),Gv=Vm(Bv,kv),Kv=Vm(Bv,Av),qv=Vm(Bv,kv,wv),Jv=Vm(Rv,Dv,Vv),Yv=Vm(zv,Ov,Hv),Xv=Vm(Iv,Ev,Uv),Zv=Vm(Lv,Tv,Wv),Qv={},$v=new Qg(void 0,{calendar:Cg}).resolvedOptions().calendar===Cg,ey=[Gv,ju],ty=[Kv,ju,0,(e,t)=>{let n=e.timeZone;if(t&&t.timeZone!==n)throw RangeError(Oh);return n}],ny=[qv,zl],ry=[Jv,zl],iy=[Yv,e=>Il(e)/eg],ay=[Xv,zl,$v],oy=[Zv,zl,$v],sy;function cy(e,t,n,r,i){function a(...e){if(!(this instanceof a))throw TypeError(mh);My(this,t(...e))}function o(e,t){return Object.defineProperties((function(...t){return e.call(this,s(this),...t)}),Pc(t))}function s(t){let n=U(t);if(!n||n.branding!==e)throw TypeError(mh);return n}return Object.defineProperties(a.prototype,{...Ic(zc(o,n)),...Fc(zc(o,r)),...Lc(`Temporal.`+e)}),Object.defineProperties(a,{...Fc(i),...Pc(e)}),[a,e=>{let t=Object.create(a.prototype);return My(t,e),t},s]}function ly(e){if(U(e)||e.calendar!==void 0||e.timeZone!==void 0)throw TypeError(dh);return e}function uy(e){return dy(e)||`iso8601`}function dy(e){let{calendar:t}=e;if(t!==void 0)return fy(t)}function fy(e){if(Mc(e)){let{calendar:t}=U(e)||{};if(!t)throw TypeError(Th(e));return t}return(e=>Kp(Sf(L(e))))(e)}function py(e){let t={};for(let n in e)t[n]=e=>{let{calendar:t}=e;return V(t)[n](e)};return t}function my(){throw TypeError(ph)}function hy(e){if(Mc(e)){let{timeZone:t}=U(e)||{};if(!t)throw TypeError(Dh(e));return t}return(e=>Bf(Cf(L(e))))(e)}function H(e){if(Mc(e)){let t=U(e);return t&&t.branding===`Duration`?t:nm(e)}return xf(e)}function gy(e){if(e!==void 0){if(Mc(e)){let t=U(e)||{};switch(t.branding){case F_:case M_:return t;case N_:return Du(t)}let n=uy(e);return{...Yp(hy,B,V(n),e),calendar:n}}return ff(e)}}function _y(e,t){if(Mc(e)){let n=U(e)||{};switch(n.branding){case P_:return N(t),n;case N_:return N(t),Au(n);case F_:return N(t),jm(B,n)}return tm(e,t)}let n=bf(e);return N(t),n}function vy(e){return e===void 0?void 0:_y(e)}function yy(e,t){if(Mc(e)){let n=U(e)||{};switch(n.branding){case N_:return N(t),n;case M_:return N(t),Eu({...n,...Wg});case F_:return N(t),km(B,n)}return Zp(V(uy(e)),e,t)}let n=hf(e);return N(t),n}function by(e,t){if(Mc(e)){let n=U(e);if(n&&n.branding===`PlainMonthDay`)return N(t),n;let r=dy(e);return em(V(r||`iso8601`),!r,e,t)}let n=yf(V,e);return N(t),n}function xy(e,t){if(Mc(e)){let n=U(e);return n&&n.branding===`PlainYearMonth`?(N(t),n):$p(V(uy(e)),e,t)}let n=_f(V,e);return N(t),n}function Sy(e,t){if(Mc(e)){let n=U(e)||{};switch(n.branding){case M_:return N(t),n;case N_:return N(t),Du(n);case F_:return N(t),Am(B,n)}return Qp(V(uy(e)),e,t)}let n=gf(e);return N(t),n}function Cy(e,t){if(Mc(e)){let n=U(e);if(n&&n.branding===`ZonedDateTime`)return su(t),n;let r=uy(e);return Xp(hy,B,V(r),r,e,t)}return pf(e,t)}function wy(e){return zc((e=>t=>e(Ty(t))),e)}function Ty(e){return W_(e,B)}function Ey(e){if(Mc(e)){let t=U(e);if(t)switch(t.branding){case I_:return t;case F_:return wu(t.epochNanoseconds)}}return df(e)}function Dy(){function e(e,n){return new t(e,n)}function t(e,t=Object.create(null)){yb.set(this,((e,t)=>{let n=new Qg(e,t),r=n.resolvedOptions(),i=r.locale,a=Hc(Object.keys(t),r),o=Nc(Ay),s=(e,...t)=>{if(e){if(t.length!==2)throw TypeError(Wh);for(let e of t)if(e===void 0)throw TypeError(Wh)}e||t[0]!==void 0||(t=[]);let r=t.map((e=>U(e)||Number(e))),s,c=0;for(let e of r){let t=typeof e==`object`?e.branding:void 0;if(c++&&t!==s)throw TypeError(Wh);s=t}return s?o(s)(i,a,...r):[n,...r]};return s.X=n,s})(e,t))}let n=Qg.prototype,r=Object.getOwnPropertyDescriptors(n),i=Object.getOwnPropertyDescriptors(Qg);for(let t in r){let n=r[t],i=t.startsWith(`format`)&&Oy(t);typeof n.value==`function`?n.value=t===`constructor`?e:i||ky(t):i&&(n.get=function(){if(!yb.has(this))throw TypeError(`Invalid calling context`);return(...e)=>i.apply(this,e)},Object.defineProperties(n.get,Pc(`get ${t}`)))}return i.prototype.value=t.prototype=Object.create({},r),Object.defineProperties(e,i),e}function Oy(e){return Object.defineProperties((function(...t){let[n,...r]=yb.get(this)(e.includes(`Range`),...t);return n[e](...r)}),Pc(e))}function ky(e){return Object.defineProperties((function(...t){return yb.get(this).X[e](...t)}),Pc(e))}function Ay(e){let t=Gy[e];if(!t)throw TypeError(Uh(e));return Hm(t,Nc(Um),1)}var jy=new WeakMap,U=jy.get.bind(jy),My=jy.set.bind(jy),Ny={era:al,eraYear:sl,year:ll,month:cl,daysInMonth:cl,daysInYear:cl,inLeapYear:kg,monthsInYear:cl},Py={monthCode:L},Fy={day:cl},Iy=py(Object.assign({},Ny,Py,Fy,{dayOfWeek:cl,dayOfYear:cl,weekOfYear:ol,yearOfWeek:sl,daysInWeek:cl})),Ly=py({...Ny,...Py}),Ry=py({...Py,...Fy}),zy={calendarId:e=>e.calendar},By=Bc((e=>t=>t[e]),R.concat(`sign`)),Vy=Bc(((e,t)=>e=>e[Rg[t]]),ag),Hy={epochMilliseconds:ju,epochNanoseconds:Mu},[Uy,W,Wy]=cy(L_,Em,{...By,blank:ef},{with:(e,t)=>W(fm(e,t)),negated:e=>W(Qd(e)),abs:e=>W(Zd(e)),add:(e,t,n)=>W(Yd(gy,V,B,0,e,H(t),n)),subtract:(e,t,n)=>W(Yd(gy,V,B,1,e,H(t),n)),round:(e,t)=>W(Xd(gy,V,B,e,t)),total:(e,t)=>Pu(gy,V,B,e,t),toLocaleString(e,t,n){return Intl.DurationFormat?new Intl.DurationFormat(t,n).format(this):pd(e)},toString:pd,toJSON:e=>pd(e),valueOf:my},{from:e=>W(H(e)),compare:(e,t,n)=>Gf(gy,V,B,H(e),H(t),n)}),Gy={Instant:ey,PlainDateTime:ny,PlainDate:ry,PlainTime:iy,PlainYearMonth:ay,PlainMonthDay:oy},Ky=Hm(ey),qy=Hm(ty),Jy=Hm(ny),Yy=Hm(ry),Xy=Hm(iy),Zy=Hm(ay),Qy=Hm(oy),[$y,eb]=cy(P_,Tm,Vy,{with(e,t,n){return eb(dm(this,ly(t),n))},add:(e,t)=>eb(Id(0,e,H(t))),subtract:(e,t)=>eb(Id(1,e,H(t))),until:(e,t,n)=>W(lp(0,e,_y(t),n)),since:(e,t,n)=>W(lp(1,e,_y(t),n)),round:(e,t)=>eb(Vu(e,t)),equals:(e,t)=>tp(e,_y(t)),toLocaleString(e,t,n){let[r,i]=Xy(t,n,e);return r.format(i)},toString:fd,toJSON:e=>fd(e),valueOf:my},{from:(e,t)=>eb(_y(e,t)),compare:(e,t)=>Jf(_y(e),_y(t))}),[tb,nb]=cy(N_,j(xm,Gp),{...zy,...Iy,...Vy},{with:(e,t,n)=>nb(sm(V,e,ly(t),n)),withCalendar:(e,t)=>nb(qm(e,fy(t))),withPlainTime:(e,t)=>nb(Km(e,vy(t))),add:(e,t,n)=>nb(Nd(V,0,e,H(t),n)),subtract:(e,t,n)=>nb(Nd(V,1,e,H(t),n)),until:(e,t,n)=>W(ap(V,0,e,yy(t),n)),since:(e,t,n)=>W(ap(V,1,e,yy(t),n)),round:(e,t)=>nb(Bu(e,t)),equals:(e,t)=>Zf(e,yy(t)),toZonedDateTime:(e,t,n)=>G(Mm(B,e,hy(t),n)),toPlainDate:e=>ub(Du(e)),toPlainTime:e=>eb(Au(e)),toLocaleString(e,t,n){let[r,i]=Jy(t,n,e);return r.format(i)},toString:cd,toJSON:e=>cd(e),valueOf:my},{from:(e,t)=>nb(yy(e,t)),compare:(e,t)=>Kf(yy(e),yy(t))}),[rb,ib,ab]=cy(j_,j(wm,Gp),{...zy,...Ry},{with:(e,t,n)=>ib(um(V,e,ly(t),n)),equals:(e,t)=>ep(e,by(t)),toPlainDate(e,t){return ub(Rm(V,e,this,t))},toLocaleString(e,t,n){let[r,i]=Qy(t,n,e);return r.format(i)},toString:dd,toJSON:e=>dd(e),valueOf:my},{from:(e,t)=>ib(by(e,t))}),[ob,sb,cb]=cy(A_,j(Cm,Gp),{...zy,...Ly},{with:(e,t,n)=>sb(lm(V,e,ly(t),n)),add:(e,t,n)=>sb(Fd(V,0,e,H(t),n)),subtract:(e,t,n)=>sb(Fd(V,1,e,H(t),n)),until:(e,t,n)=>W(sp(V,0,e,xy(t),n)),since:(e,t,n)=>W(sp(V,1,e,xy(t),n)),equals:(e,t)=>$f(e,xy(t)),toPlainDate(e,t){return ub(Lm(V,e,this,t))},toLocaleString(e,t,n){let[r,i]=Zy(t,n,e);return r.format(i)},toString:ud,toJSON:e=>ud(e),valueOf:my},{from:(e,t)=>sb(xy(e,t)),compare:(e,t)=>qf(xy(e),xy(t))}),[lb,ub,db]=cy(M_,j(Sm,Gp),{...zy,...Iy},{with:(e,t,n)=>ub(cm(V,e,ly(t),n)),withCalendar:(e,t)=>ub(qm(e,fy(t))),add:(e,t,n)=>ub(Pd(V,0,e,H(t),n)),subtract:(e,t,n)=>ub(Pd(V,1,e,H(t),n)),until:(e,t,n)=>W(op(V,0,e,Sy(t),n)),since:(e,t,n)=>W(op(V,1,e,Sy(t),n)),equals:(e,t)=>Qf(e,Sy(t)),toZonedDateTime(e,t){return G(Nm(hy,_y,B,e,Mc(t)?t:{timeZone:t}))},toPlainDateTime:(e,t)=>nb(Pm(e,vy(t))),toPlainYearMonth(e){return sb(Fm(V,e,this))},toPlainMonthDay(e){return ib(Im(V,e,this))},toLocaleString(e,t,n){let[r,i]=Yy(t,n,e);return r.format(i)},toString:ld,toJSON:e=>ld(e),valueOf:my},{from:(e,t)=>ub(Sy(e,t)),compare:(e,t)=>qf(Sy(e),Sy(t))}),[fb,G]=cy(F_,j(bm,Gp,zf),{...Hy,...zy,...wy(Iy),...wy(Vy),offset:e=>xd(Ty(e).offsetNanoseconds),offsetNanoseconds:e=>Ty(e).offsetNanoseconds,timeZoneId:e=>e.timeZone,hoursInDay:e=>Hu(B,e)},{with:(e,t,n)=>G(om(V,B,e,ly(t),n)),withCalendar:(e,t)=>G(qm(e,fy(t))),withTimeZone:(e,t)=>G(Jm(e,hy(t))),withPlainTime:(e,t)=>G(Gm(B,e,vy(t))),add:(e,t,n)=>G(Md(V,B,0,e,H(t),n)),subtract:(e,t,n)=>G(Md(V,B,1,e,H(t),n)),until:(e,t,n)=>W(P(ip(V,B,0,e,Cy(t),n))),since:(e,t,n)=>W(P(ip(V,B,1,e,Cy(t),n))),round:(e,t)=>G(zu(B,e,t)),startOfDay:e=>G(Uu(B,e)),equals:(e,t)=>Xf(e,Cy(t)),toInstant:e=>mb(Om(e)),toPlainDateTime:e=>nb(km(B,e)),toPlainDate:e=>ub(Am(B,e)),toPlainTime:e=>eb(jm(B,e)),toLocaleString(e,t,n={}){let[r,i]=qy(t,n,e);return r.format(i)},toString:(e,t)=>sd(B,e,t),toJSON:e=>sd(B,e),valueOf:my,getTimeZoneTransition(e,t){let{timeZone:n,epochNanoseconds:r}=e,i=fu(t),a=B(n).O(r,i);return a?G({...e,epochNanoseconds:a}):null}},{from:(e,t)=>G(Cy(e,t)),compare:(e,t)=>Wf(Cy(e),Cy(t))}),[pb,mb,hb]=cy(I_,ym,Hy,{add:(e,t)=>mb(jd(0,e,H(t))),subtract:(e,t)=>mb(jd(1,e,H(t))),until:(e,t,n)=>W(rp(0,e,Ey(t),n)),since:(e,t,n)=>W(rp(1,e,Ey(t),n)),round:(e,t)=>mb(Ru(e,t)),equals:(e,t)=>Yf(e,Ey(t)),toZonedDateTimeISO:(e,t)=>G(Dm(e,hy(t))),toLocaleString(e,t,n){let[r,i]=Ky(t,n,e);return r.format(i)},toString:(e,t)=>od(hy,B,e,t),toJSON:e=>od(hy,B,e),valueOf:my},{from:e=>mb(Ey(e)),fromEpochMilliseconds:e=>mb(zm(e)),fromEpochNanoseconds:e=>mb(Bm(e)),compare:(e,t)=>Uf(Ey(e),Ey(t))}),gb=Object.defineProperties({},{...Lc(`Temporal.Now`),...Fc({timeZoneId:()=>Zm(),instant:()=>mb(wu(Xm())),zonedDateTimeISO:(e=Zm())=>G(Tu(Xm(),hy(e),Cg)),plainDateTimeISO:(e=Zm())=>nb(Eu(Ym(B(hy(e))),Cg)),plainDateISO:(e=Zm())=>ub(Du(Ym(B(hy(e))),Cg)),plainTimeISO:(e=Zm())=>eb(Au(Ym(B(hy(e)))))})}),_b=Object.defineProperties({},{...Lc(`Temporal`),...Fc({PlainYearMonth:ob,PlainMonthDay:rb,PlainDate:lb,PlainTime:$y,PlainDateTime:tb,ZonedDateTime:fb,Instant:pb,Duration:Uy,Now:gb})}),vb=Dy(),yb=new WeakMap;Object.create(Intl),Fc({DateTimeFormat:vb});var bb=e=>{if(!(0,y.isString)(e))return null;try{return kc(e)?{isDateOnly:!0,date:_b.PlainDate.from(e)}:{isDateOnly:!1,dateTime:_b.Instant.from(e).toZonedDateTimeISO(`UTC`)}}catch{return null}},xb=e=>Math.trunc(e)+0,Sb=(e,t,n)=>{switch(t){case`DAY`:return e.add({days:n});case`WEEK`:return e.add({weeks:n});case`QUARTER`:return e.add({months:n*3});case`MONTH`:return e.add({months:n});case`YEAR`:return e.add({years:n});case`SECOND`:return e.add({seconds:n});case`MINUTE`:return e.add({minutes:n});case`HOUR`:return e.add({hours:n});default:return ne(t)}},Cb=({expressionDate:e,amount:t,unit:n})=>{try{let r=Sb(Dc(e),n,t);return e.isDateOnly&&n!==`MINUTE`&&n!==`HOUR`?{isDateOnly:!0,date:r.toPlainDate()}:{isDateOnly:!1,dateTime:r}}catch(e){if(e instanceof RangeError)return null;throw e}},wb=(e,t,r)=>{Tc(r);let i=bb(e);if(!n.t(i)||!Oc(i)||!(0,y.isNumber)(t)||!Number.isFinite(t))return null;let a=Cb({expressionDate:i,amount:xb(t),unit:r});return n.t(a)&&Oc(a)?Ec(a):null},Tb=({from:e,to:t})=>{let n=(t.year-e.year)*12+(t.month-e.month);return n>0&&t.day<e.day?n-1:n<0&&t.day>e.day?n+1:n},Eb={MINUTE:6e4,HOUR:36e5},Db=(e,t,r)=>{Tc(r);let i=bb(e),a=bb(t);if(!n.t(i)||!n.t(a))return null;let o=Dc(i),s=Dc(a);switch(r){case`MINUTE`:case`HOUR`:return xb((s.epochMilliseconds-o.epochMilliseconds)/Eb[r]);case`DAY`:case`WEEK`:{let e=o.toPlainDate().until(s.toPlainDate(),{largestUnit:`days`}).days;return r===`DAY`?e:xb(e/7)}case`MONTH`:case`QUARTER`:case`YEAR`:return xb(Tb({from:o.toPlainDate(),to:s.toPlainDate()})/{MONTH:1,QUARTER:3,YEAR:12}[r])}},Ob=({values:e,reduce:t})=>{let n=e.filter(y.isNumber);return r.t(n)?t(...n):null},kb=[`YEAR`,`QUARTER`,`MONTH`,`WEEK`,`DAY`,`DAY_OF_WEEK`,`HOUR`,`MINUTE`],Ab=e=>kb.some(t=>t===e),jb=e=>{if(!Ab(e))throw new bc(Sc({value:e,kind:`part`,allowedValues:kb}),`INVALID_DATE_PART`)},Mb=(e,t)=>{jb(t);let r=bb(e);if(!n.t(r))return null;let i=Dc(r);switch(t){case`YEAR`:return i.year;case`QUARTER`:return Math.floor((i.month-1)/3)+1;case`MONTH`:return i.month;case`WEEK`:return i.weekOfYear??null;case`DAY`:return i.day;case`DAY_OF_WEEK`:return i.dayOfWeek;case`HOUR`:return i.hour;case`MINUTE`:return i.minute}},Nb=function(e){return e.MONDAY=`MONDAY`,e.SUNDAY=`SUNDAY`,e.SATURDAY=`SATURDAY`,e}({}),Pb=e=>{switch(e){case Nb.MONDAY:return 1;case Nb.SATURDAY:return 6;case Nb.SUNDAY:return 7;default:return ne(e)}},Fb=(e,t,r)=>{switch(t){case`DAY`:return e.startOfDay();case`WEEK`:{let t=n.t(r)?Pb(r):1,i=(e.dayOfWeek-t+7)%7;return e.startOfDay().subtract({days:i})}case`QUARTER`:{let t=Math.floor((e.month-1)/3);return e.startOfDay().with({day:1,month:t*3+1})}case`MONTH`:return e.startOfDay().with({day:1});case`YEAR`:return e.startOfDay().with({day:1,month:1});case`SECOND`:return e.with({nanosecond:0,microsecond:0,millisecond:0});case`MINUTE`:return e.with({second:0,nanosecond:0,microsecond:0,millisecond:0});case`HOUR`:return e.with({minute:0,second:0,nanosecond:0,microsecond:0,millisecond:0});default:return ne(t)}},Ib=(e,t,n)=>{switch(t){case`DAY`:return Fb(e,`DAY`).add({days:1});case`WEEK`:return Fb(e,`WEEK`,n).add({weeks:1});case`MONTH`:return Fb(e,`MONTH`,n).add({months:1});case`QUARTER`:return Fb(e,`QUARTER`,n).add({months:3});case`YEAR`:return Fb(e,`YEAR`,n).add({years:1});case`SECOND`:return Fb(e,`SECOND`).add({seconds:1});case`MINUTE`:return Fb(e,`MINUTE`).add({minutes:1});case`HOUR`:return Fb(e,`HOUR`).add({hours:1});default:return ne(t)}},Lb=(e,t)=>{Tc(t);let r=bb(e);if(!n.t(r))return null;let i=Fb(Dc(r),t);return Ec(r.isDateOnly?{isDateOnly:!0,date:i.toPlainDate()}:{isDateOnly:!1,dateTime:i})},Rb=Ks([Nb.MONDAY,Nb.SATURDAY,Nb.SUNDAY]),zb=Hs([vc().int().positive(),Js(`undefined`)]).transform(e=>e===`undefined`?void 0:e),Bb=Bs({direction:Ks([`NEXT`,`THIS`,`PAST`]),amount:zb.nullish(),unit:yc,timezone:os().nullish(),firstDayOfTheWeek:Rb.nullish()}).refine(e=>!(e.amount===void 0&&e.direction!==`THIS`),{error:`Amount cannot be 'undefined' unless direction is 'THIS'`}),Vb=(e,t,n)=>{switch(t){case`DAY`:return e.subtract({days:n});case`WEEK`:return e.subtract({weeks:n});case`QUARTER`:return e.subtract({months:n*3});case`MONTH`:return e.subtract({months:n});case`YEAR`:return e.subtract({years:n});case`SECOND`:return e.subtract({seconds:n});case`MINUTE`:return e.subtract({minutes:n});case`HOUR`:return e.subtract({hours:n});default:return ne(t)}},Hb=(e,t)=>{let{direction:r,amount:i,unit:a,firstDayOfTheWeek:o}=e;switch(r){case`NEXT`:{if(!n.t(i))throw Error(`Amount is required`);let r=Ib(t,a,o);return{...e,start:r,end:Sb(r,a,i)}}case`PAST`:{if(!n.t(i))throw Error(`Amount is required`);let r=Fb(t,a,o);return{...e,start:Vb(r,a,i),end:r}}case`THIS`:return{...e,start:Fb(t,a,o),end:Ib(t,a,o)}}},Ub={},Wb=()=>n.t(Ub.current)?_b.Instant.from(Ub.current).toZonedDateTimeISO(`UTC`):_b.Now.zonedDateTimeISO(`UTC`),Gb=e=>{try{return _b.Instant.from(e)}catch{}try{return _b.PlainDate.from(e).toZonedDateTime({timeZone:`UTC`}).toInstant()}catch{return null}},Kb=(e,t,r,i)=>{if(!(0,y.isString)(e)||t!==`THIS`&&!n.t(r))return!1;let a=Gb(e),o=Bb.safeParse({direction:t,amount:t===`THIS`?void 0:r,unit:i});if(!n.t(a)||!o.success)return!1;let{start:s,end:c}=Hb(o.data,Wb());return _b.Instant.compare(a,s.toInstant())>=0&&_b.Instant.compare(a,c.toInstant())<0},qb=new WeakSet,Jb=new WeakMap,Yb=e=>n.t(e)&&!(typeof e==`object`&&qb.has(e)),Xb={[a.a.CURRENCY]:[`amountMicros`],[a.a.FULL_NAME]:[`firstName`,`lastName`],[a.a.LINKS]:[`primaryLinkUrl`],[a.a.EMAILS]:[`primaryEmail`],[a.a.PHONES]:[`primaryPhoneNumber`]},Zb=e=>{if(!n.t(e)||e===``)return!0;if(Array.isArray(e))return e.length===0;if(!i.t(e)||e instanceof Date)return!1;if(qb.has(e))return!0;let t=Jb.get(e);if(t===a.a.RICH_TEXT)return!(0,y.isNonEmptyString)(e.markdown)||e.markdown.trim().length===0;let r=n.t(t)?Xb[t]:void 0;return(n.t(r)?r.map(t=>e[t]):Object.values(e)).every(Zb)},Qb=function(e){return e.FIT_CONTENT=`FIT_CONTENT`,e.TAB_VIEWPORT=`TAB_VIEWPORT`,e}({}),$b=({widgetType:e,heightBehavior:t})=>{if(n.t(t))return t;switch(e){case o.d.CALENDAR:case o.d.CALL_RECORDING_SUMMARY:case o.d.CALL_RECORDING_TRANSCRIPT:case o.d.CHAT:case o.d.CHAT_THREADS:case o.d.EMAILS:case o.d.EMAIL_THREAD:case o.d.FILES:case o.d.MESSAGE_CAMPAIGN_BODY:case o.d.NOTES:case o.d.TASKS:case o.d.TIMELINE:case o.d.WORKFLOW:case o.d.WORKFLOW_RUN:case o.d.WORKFLOW_VERSION:return Qb.TAB_VIEWPORT;case o.d.IFRAME:case o.d.RECORD_TABLE:case o.d.MESSAGE_CAMPAIGN_DETAILS:case o.d.FIELD:case o.d.FIELDS:case o.d.FORM_FIELD:case o.d.FIELD_RICH_TEXT:case o.d.FRONT_COMPONENT:case o.d.GRAPH:case o.d.STANDALONE_RICH_TEXT:case o.d.VIEW:return Qb.FIT_CONTENT}},ex=({map:e,maxEntries:t,minEvict:r=0,recencyOf:i,matches:a})=>{if(!n.t(a)){if(e.size<=t)return 0;if(!n.t(i)){let n=Math.min(e.size,Math.max(r,e.size-t)),i=e.keys();for(let t=0;t<n;t+=1){let t=i.next();if(t.done)break;e.delete(t.value)}return n}}let o=[];for(let t of e)(!n.t(a)||a(t[0]))&&o.push(t);if(o.length<=t)return 0;n.t(i)&&o.sort((e,t)=>i(e[1])-i(t[1]));let s=Math.min(o.length,Math.max(r,o.length-t));for(let[t]of o.slice(0,s))e.delete(t);return s},tx=({map:e,key:t})=>{let n=e.get(t);if(!(0,y.isUndefined)(n))return e.delete(t),e.set(t,n),n},nx=({map:e,key:t,value:n,maxEntries:r})=>{e.delete(t),e.set(t,n),ex({map:e,maxEntries:r})},rx=({compute:e,maxEntries:t})=>{let r=new Map;return i=>{let a=tx({map:r,key:i});if(n.t(a))return a;let o=e(i);return nx({map:r,key:i,value:o,maxEntries:t}),o}},ix=e=>{try{return _b.Instant.from(e).toZonedDateTimeISO(`UTC`).toPlainDate()}catch{}try{return _b.PlainDate.from(e)}catch{}throw Error(`Cannot parse date string as PlainDate : "${e}"`)},ax=/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*/,ox=/^\d+(?:\.\d+)?/,sx=/^\s+/,cx=[`"`,`'`],lx=(e,t)=>{let n=e[t];for(let r=t+1;r<e.length;r++){if(e[r]===`\\`){r++;continue}if(e[r]===n)return{type:`string`,end:r+1}}return{type:`unclosedString`,end:e.length}},ux=(e,t)=>{let r=e[t]??``;if(cx.includes(r))return lx(e,t);let i=e.slice(t),a=[[`whitespace`,sx],[`number`,ox],[`path`,ax]];for(let[e,r]of a){let a=i.match(r);if(n.t(a))return{type:e,end:t+a[0].length}}return{type:`symbol`,end:t+1}},dx=e=>{let t=[],n=0;for(;n<e.length;){let{type:r,end:i}=ux(e,n);t.push({type:r,text:e.slice(n,i),start:n,end:i}),n=i}return t},fx=/Unknown character "(.+)"/,px=/^unexpected T[A-Z]+: (.+)$/,mx=`Expected )`,hx=`TEOF`,gx=({expression:e,error:t})=>{let r=t instanceof Error?t.message:String(t);if(dx(e).some(e=>e.type===`unclosedString`))return{errorMessage:`A text value is missing its closing quote`,errorCode:`UNCLOSED_TEXT`};if(r.includes(hx)||r.endsWith(mx))return{errorMessage:`Expression is incomplete`,errorCode:`INCOMPLETE_EXPRESSION`};let i=r.match(fx)?.[1]??r.match(px)?.[1];return n.t(i)?{errorMessage:`Unexpected "${i}"`,errorCode:`INVALID_SYNTAX`,errorParams:{token:i}}:{errorMessage:`Expression is not valid`,errorCode:`INVALID_SYNTAX`}},_x,vx=new Uint8Array(16);function yx(){if(!_x){if(typeof crypto>`u`||!crypto.getRandomValues)throw Error(`crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported`);_x=crypto.getRandomValues.bind(crypto)}return _x(vx)}var bx={randomUUID:typeof crypto<`u`&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function xx(e,t,n){if(bx.randomUUID&&!t&&!e)return bx.randomUUID();e||={};let r=e.random??e.rng?.()??yx();if(r.length<16)throw Error(`Random bytes length must be >= 16`);if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){if(n||=0,n<0||n+16>t.length)throw RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[n+e]=r[e];return t}return a.r(r)}var Sx=function(e){return e.EMAIL=`EMAIL`,e.CALENDAR=`CALENDAR`,e.WORKFLOW=`WORKFLOW`,e.AGENT=`AGENT`,e.API=`API`,e.IMPORT=`IMPORT`,e.MANUAL=`MANUAL`,e.SYSTEM=`SYSTEM`,e.WEBHOOK=`WEBHOOK`,e.APPLICATION=`APPLICATION`,e}({}),Cx={type:a.a.ACTOR,properties:[{name:`source`,type:a.a.SELECT,hidden:!1,isRequired:!0,options:Object.keys(Sx).map((e,t)=>({id:xx(),label:`${Sx[e].toLowerCase()}`,value:e,position:t}))},{name:`workspaceMemberId`,type:a.a.UUID,hidden:`input`,isRequired:!1},{name:`name`,type:a.a.TEXT,hidden:`input`,isRequired:!0},{name:`context`,type:a.a.RAW_JSON,hidden:!1,isRequired:!1}]},wx=[o.u.IS_EMPTY,o.u.IS_NOT_EMPTY],Tx={CURRENCY:{currencyCode:[o.u.IS,o.u.IS_NOT,...wx],amountMicros:[o.u.GREATER_THAN_OR_EQUAL,o.u.LESS_THAN_OR_EQUAL,o.u.IS,o.u.IS_NOT,...wx]}},K=[o.u.IS_EMPTY,o.u.IS_NOT_EMPTY],Ex=[o.u.IS,o.u.IS_NOT],Dx={TEXT:[o.u.CONTAINS,o.u.DOES_NOT_CONTAIN,o.u.IS,o.u.IS_NOT,...K],EMAILS:[o.u.CONTAINS,o.u.DOES_NOT_CONTAIN,...K],FULL_NAME:[o.u.CONTAINS,o.u.DOES_NOT_CONTAIN,...K],ADDRESS:[o.u.CONTAINS,o.u.DOES_NOT_CONTAIN,...K],LINKS:[o.u.CONTAINS,o.u.DOES_NOT_CONTAIN,...K],PHONES:[o.u.CONTAINS,o.u.DOES_NOT_CONTAIN,...K],CURRENCY:[o.u.GREATER_THAN_OR_EQUAL,o.u.LESS_THAN_OR_EQUAL,...K],NUMBER:[o.u.IS,o.u.IS_NOT,o.u.GREATER_THAN_OR_EQUAL,o.u.LESS_THAN_OR_EQUAL,...K],RAW_JSON:[o.u.CONTAINS,o.u.DOES_NOT_CONTAIN,...K],FILES:[o.u.CONTAINS,o.u.DOES_NOT_CONTAIN,...K],DATE_TIME:[o.u.IS,o.u.IS_RELATIVE,o.u.IS_IN_PAST,o.u.IS_IN_FUTURE,o.u.IS_TODAY,o.u.IS_BEFORE,o.u.IS_AFTER,...K],DATE:[o.u.IS,o.u.IS_RELATIVE,o.u.IS_IN_PAST,o.u.IS_IN_FUTURE,o.u.IS_TODAY,o.u.IS_BEFORE,o.u.IS_AFTER,...K],RATING:[o.u.IS,o.u.IS_NOT,o.u.GREATER_THAN_OR_EQUAL,o.u.LESS_THAN_OR_EQUAL,...K],RELATION:[...Ex,...K],MULTI_SELECT:[o.u.CONTAINS,o.u.DOES_NOT_CONTAIN,...K],SELECT:[o.u.IS,o.u.IS_NOT,...K],ACTOR:[o.u.CONTAINS,o.u.DOES_NOT_CONTAIN,...K],ARRAY:[o.u.CONTAINS,o.u.DOES_NOT_CONTAIN,...K],BOOLEAN:[o.u.IS],TS_VECTOR:[o.u.VECTOR_SEARCH],UUID:[o.u.IS,o.u.IS_NOT,...K]},Ox=[o.u.IS,o.u.IS_NOT,o.u.IS_EMPTY,o.u.IS_NOT_EMPTY],kx=({filterType:e,subFieldName:t})=>e===`CURRENCY`?t===`currencyCode`?Tx.CURRENCY.currencyCode:Tx.CURRENCY.amountMicros:e===`ACTOR`&&(t===`source`||t===`workspaceMemberId`)?Ox:Dx[e],Ax={type:a.a.ADDRESS,properties:[{name:`addressStreet1`,type:a.a.TEXT,hidden:!1,isRequired:!1},{name:`addressStreet2`,type:a.a.TEXT,hidden:!1,isRequired:!1},{name:`addressCity`,type:a.a.TEXT,hidden:!1,isRequired:!1},{name:`addressPostcode`,type:a.a.TEXT,hidden:!1,isRequired:!1},{name:`addressState`,type:a.a.TEXT,hidden:!1,isRequired:!1},{name:`addressCountry`,type:a.a.TEXT,hidden:!1,isRequired:!1},{name:`addressLat`,type:a.a.NUMERIC,hidden:!1,isRequired:!1},{name:`addressLng`,type:a.a.NUMERIC,hidden:!1,isRequired:!1}]},jx={type:a.a.CURRENCY,properties:[{name:`amountMicros`,type:a.a.NUMERIC,hidden:!1,isRequired:!1},{name:`currencyCode`,type:a.a.TEXT,hidden:!1,isRequired:!1}]},Mx={type:a.a.EMAILS,properties:[{name:`primaryEmail`,type:a.a.TEXT,hidden:!1,isRequired:!1,isIncludedInUniqueConstraint:!0},{name:`additionalEmails`,type:a.a.RAW_JSON,hidden:!1,isRequired:!1}]},Nx={type:a.a.FULL_NAME,properties:[{name:`firstName`,type:a.a.TEXT,hidden:!1,isRequired:!1,isIncludedInUniqueConstraint:!1},{name:`lastName`,type:a.a.TEXT,hidden:!1,isRequired:!1,isIncludedInUniqueConstraint:!1}]},Px={type:a.a.LINKS,properties:[{name:`primaryLinkLabel`,type:a.a.TEXT,hidden:!1,isRequired:!1},{name:`primaryLinkUrl`,type:a.a.TEXT,hidden:!1,isRequired:!1,isIncludedInUniqueConstraint:!0},{name:`secondaryLinks`,type:a.a.RAW_JSON,hidden:!1,isRequired:!1}]},Fx={type:a.a.PHONES,properties:[{name:`primaryPhoneNumber`,type:a.a.TEXT,hidden:!1,isRequired:!1,isIncludedInUniqueConstraint:!0},{name:`primaryPhoneCountryCode`,type:a.a.TEXT,hidden:!1,isRequired:!1,isIncludedInUniqueConstraint:!0},{name:`primaryPhoneCallingCode`,type:a.a.TEXT,hidden:!1,isRequired:!1,isIncludedInUniqueConstraint:!0},{name:`additionalPhones`,type:a.a.RAW_JSON,hidden:!1,isRequired:!1}]},Ix={type:a.a.RICH_TEXT,properties:[{name:`blocknote`,deprecationReason:`Use markdown or tiptap instead. This value is cleared whenever the field is written in another format.`,type:a.a.TEXT,hidden:!1,isRequired:!1},{name:`markdown`,type:a.a.TEXT,hidden:!1,isRequired:!1},{name:`tiptap`,type:a.a.TEXT,hidden:!1,isRequired:!1}]};Bs({tiptap:os().nullable().optional(),markdown:os().nullable().optional(),blocknote:os().nullable().optional()});var Lx=new Map([[a.a.LINKS,Px],[a.a.CURRENCY,jx],[a.a.FULL_NAME,Nx],[a.a.ADDRESS,Ax],[a.a.ACTOR,Cx],[a.a.EMAILS,Mx],[a.a.PHONES,Fx],[a.a.RICH_TEXT,Ix]]),Rx=`previous`,zx=e=>e.startsWith(`${Rx}.`),Bx=e=>zx(e)?e.slice(Rx.length+1):null,Vx=(e,t)=>n.t(e)?e instanceof Date?e.toISOString():e:t?.type!==a.a.BOOLEAN&&null,Hx=e=>i.t(e)&&!(e instanceof Date),Ux=(e,t)=>{n.t(t)&&Hx(e)&&Lx.has(t.type)&&Jb.set(e,t.type)},Wx=(e,t,r)=>{let i=e[t];if(!n.t(i)){let n={};return qb.add(n),r.add(n),e[t]=n,n}if(!Hx(i))return null;if(r.has(i))return i;let a={...i},o=Jb.get(i);return n.t(o)&&Jb.set(a,o),r.add(a),e[t]=a,a},Gx=({record:e,previousRecord:t,fieldByName:r,identifierPaths:i,now:a,isPreviousRecordContext:o=!1})=>{let s={},c=new WeakSet,l=o?[]:i.map(Bx).filter(n.t);l.length>0&&(s.previous=Gx({record:t??{},fieldByName:n.t(t)?r:new Map,identifierPaths:l,now:a,isPreviousRecordContext:!0}));for(let t of i){let i=t.split(`.`),[l]=i;if(!n.t(l))continue;if(!o){if(l===`previous`)continue;if(l===`now`){s.now=a;continue}}let u=r.get(l);if(!(l in s)){let t=Vx(e[l],u);Ux(t,u),s[l]=t}let d=s;for(let[e,t]of i.entries()){if(!n.t(d))break;if(e===i.length-1){d[t]=Vx(d[t],e===0?u:u?.relationTargetFields?.find(e=>e.name===t));break}d=Wx(d,t,c);let r=i[e+1];if(e===0&&n.t(d)&&n.t(r)){let e=u?.relationTargetFields?.find(e=>e.name===r);Ux(d[r],e)}}}return s},Kx=e=>e.some(e=>e.type===`IOP2`?e.value===`[`:e.type===`IEXPR`&&Array.isArray(e.value)&&Kx(e.value)),qx={isDefined:{signature:`isDefined(value)`,evaluate:Yb},isEmpty:{signature:`isEmpty(value)`,evaluate:Zb},isNonEmptyString:{signature:`isNonEmptyString(value)`,evaluate:e=>(0,y.isNonEmptyString)(e)},includes:{signature:`includes(listOrText, value)`,evaluate:(e,t)=>(Array.isArray(e)||(0,y.isString)(e)&&(0,y.isString)(t))&&e.includes(t)},arrayLength:{signature:`arrayLength(list)`,evaluate:e=>Array.isArray(e)?e.length:0},dateDiff:{signature:`dateDiff(from, to, unit)`,evaluate:Db},dateAdd:{signature:`dateAdd(date, amount, unit)`,evaluate:wb},dateTrunc:{signature:`dateTrunc(date, unit)`,evaluate:Lb},datePart:{signature:`datePart(date, part)`,evaluate:Mb},if:{signature:`if(condition, valueIfTrue, valueIfFalse)`,evaluate:(e,t,n)=>e===!0?t:n},coalesce:{signature:`coalesce(value, ...fallbacks)`,evaluate:(...e)=>e.find(Yb)??null},concat:{signature:`concat(value, ...values)`,evaluate:(...e)=>e.filter(Yb).join(``)},lower:{signature:`lower(text)`,evaluate:e=>(0,y.isString)(e)?e.toLowerCase():null},upper:{signature:`upper(text)`,evaluate:e=>(0,y.isString)(e)?e.toUpperCase():null},min:{signature:`min(number, ...numbers)`,evaluate:(...e)=>Ob({values:e,reduce:Math.min})},max:{signature:`max(number, ...numbers)`,evaluate:(...e)=>Ob({values:e,reduce:Math.max})},roundTo:{signature:`roundTo(number, decimals)`,evaluate:(e,t)=>(0,y.isNumber)(e)&&(0,y.isNumber)(t)?Number(e.toFixed(Math.min(Math.max(Math.trunc(t),0),20))):null},isInRelativeDateRange:{signature:`isInRelativeDateRange(date, direction, amount, unit)`,evaluate:Kb}},Jx=`INUMBER`,Yx=`IOP1`,Xx=`IOP2`,Zx=`IOP3`,Qx=`IVAR`,$x=`IVARNAME`,eS=`IFUNCALL`,tS=`IFUNDEF`,nS=`IEXPR`,rS=`IEXPREVAL`,iS=`IMEMBER`,aS=`IENDSTATEMENT`,oS=`IARRAY`;function q(e,t){this.type=e,this.value=t??0}q.prototype.toString=function(){switch(this.type){case Jx:case Yx:case Xx:case Zx:case Qx:case $x:case aS:return this.value;case eS:return`CALL `+this.value;case tS:return`DEF `+this.value;case oS:return`ARRAY `+this.value;case iS:return`.`+this.value;default:return`Invalid Instruction`}};function sS(e){return new q(Yx,e)}function cS(e){return new q(Xx,e)}function lS(e){return new q(Zx,e)}function uS(e,t,n,r,i){for(var a=[],o=[],s,c,l,u,d=0;d<e.length;d++){var f=e[d],p=f.type;if(p===Jx||p===$x)Array.isArray(f.value)?a.push.apply(a,uS(f.value.map(function(e){return new q(Jx,e)}).concat(new q(oS,f.value.length)),t,n,r,i)):a.push(f);else if(p===Qx&&Object.hasOwn(i,f.value))f=new q(Jx,i[f.value]),a.push(f);else if(p===Xx&&a.length>1)c=a.pop(),s=a.pop(),u=n[f.value],f=new q(Jx,u(s.value,c.value)),a.push(f);else if(p===Zx&&a.length>2)l=a.pop(),c=a.pop(),s=a.pop(),f.value===`?`?a.push(s.value?c.value:l.value):(u=r[f.value],f=new q(Jx,u(s.value,c.value,l.value)),a.push(f));else if(p===Yx&&a.length>0)s=a.pop(),u=t[f.value],f=new q(Jx,u(s.value)),a.push(f);else if(p===nS){for(;a.length>0;)o.push(a.shift());o.push(new q(nS,uS(f.value,t,n,r,i)))}else if(p===iS&&a.length>0)s=a.pop(),a.push(new q(Jx,s.value[f.value]));else{for(;a.length>0;)o.push(a.shift());o.push(f)}}for(;a.length>0;)o.push(a.shift());return o}function dS(e,t,n){for(var r=[],i=0;i<e.length;i++){var a=e[i],o=a.type;if(o===Qx&&a.value===t)for(var s=0;s<n.tokens.length;s++){var c=n.tokens[s],l=c.type===Yx?sS(c.value):c.type===Xx?cS(c.value):c.type===Zx?lS(c.value):new q(c.type,c.value);r.push(l)}else o===nS?r.push(new q(nS,dS(a.value,t,n))):r.push(a)}return r}function fS(e,t,n){if(Object.values(t.functions).includes(e))return!0;for(let i of Object.values(n))if(typeof i==`object`&&i){for(let n of Object.values(i))if(n===e){let e=Object.freeze({abs:Math.abs,acos:Math.acos,asin:Math.asin,atan:Math.atan,atan2:Math.atan2,ceil:Math.ceil,clz32:Math.clz32,cos:Math.cos,exp:Math.exp,floor:Math.floor,imul:Math.imul,fround:Math.fround,f16round:Math.f16round,log:Math.log,max:Math.max,min:Math.min,pow:Math.pow,random:Math.random,round:Math.round,sin:Math.sin,sqrt:Math.sqrt,tan:Math.tan,log10:Math.log10,log2:Math.log2,log1p:Math.log1p,expm1:Math.expm1,cosh:Math.cosh,sinh:Math.sinh,tanh:Math.tanh,acosh:Math.acosh,asinh:Math.asinh,atanh:Math.atanh,hypot:Math.hypot,trunc:Math.trunc,sign:Math.sign,cbrt:Math.cbrt});for(var r of Object.getOwnPropertyNames(e))if(e[r]===n)return!0;return Object.values(t.functions).includes(n)}}return!1}function pS(e,t,n){var r=[],i,a,o,s,c,l;if(hS(e))return gS(e,n);for(var u=e.length,d=0;d<u;d++){var f=e[d],p=f.type;if(p===Jx||p===$x)r.push(f.value);else if(p===Xx)a=r.pop(),i=r.pop(),f.value===`and`?r.push(i?!!pS(a,t,n):!1):f.value===`or`?r.push(i?!0:!!pS(a,t,n)):f.value===`=`?(s=t.binaryOps[f.value],r.push(s(i,pS(a,t,n),n))):(s=t.binaryOps[f.value],r.push(s(gS(i,n),gS(a,n))));else if(p===Zx)o=r.pop(),a=r.pop(),i=r.pop(),f.value===`?`?r.push(pS(i?a:o,t,n)):(s=t.ternaryOps[f.value],r.push(s(gS(i,n),gS(a,n),gS(o,n))));else if(p===Qx){if(/^__proto__|prototype|constructor$/.test(f.value))throw Error(`prototype access detected`);if(f.value in t.functions)r.push(t.functions[f.value]);else if(f.value in t.unaryOps&&t.parser.isOperatorEnabled(f.value))r.push(t.unaryOps[f.value]);else{var m=n[f.value];if(m!==void 0){if(typeof m==`function`&&!fS(m,t,n))throw Error(`Variable references an unallowed function: `+f.value);r.push(m)}else throw Error(`undefined variable: `+f.value)}}else if(p===Yx)i=r.pop(),s=t.unaryOps[f.value],r.push(s(gS(i,n)));else if(p===eS){for(l=f.value,c=[];l-->0;)c.unshift(gS(r.pop(),n));if(s=r.pop(),!fS(s,t,n))throw Error(`Is not an allowed function.`);if(s.apply&&s.call)r.push(s.apply(void 0,c));else throw Error(s+` is not a function`)}else if(p===tS)r.push((function(){for(var e=r.pop(),i=[],a=f.value;a-->0;)i.unshift(r.pop());var o=r.pop(),s=function(){for(var r=Object.assign({},n),a=0,o=i.length;a<o;a++)r[i[a]]=arguments[a];return pS(e,t,r)};return t.functions[`lambda_`+t.functions.__counter++]=s,n[o]=s,s})());else if(p===nS)r.push(mS(f,t));else if(p===rS)r.push(f);else if(p===iS){if(i=r.pop(),/^__proto__|prototype|constructor$/.test(f.value))throw Error(`prototype access detected in MEMBER`);if(typeof i==`object`&&typeof i[f.value]==`function`&&!fS(i[f.value],t,n))throw Error(`Is not an allowed function in MEMBER.`);r.push(i[f.value])}else if(p===aS)r.pop();else if(p===oS){for(l=f.value,c=[];l-->0;)c.unshift(r.pop());r.push(c)}else throw Error(`invalid Expression`)}if(r.length>1)throw Error(`invalid Expression (parity)`);return r[0]===0?0:gS(r[0],n)}function mS(e,t,n){return hS(e)?e:{type:rS,value:function(n){return pS(e.value,t,n)}}}function hS(e){return e&&e.type===rS}function gS(e,t){return hS(e)?e.value(t):e}function _S(e,t){for(var n=[],r,i,a,o,s,c,l=0;l<e.length;l++){var u=e[l],d=u.type;if(d===Jx)typeof u.value==`number`&&u.value<0?n.push(`(`+u.value+`)`):Array.isArray(u.value)?n.push(`[`+u.value.map(vS).join(`, `)+`]`):n.push(vS(u.value));else if(d===Xx)i=n.pop(),r=n.pop(),o=u.value,t?o===`^`?n.push(`Math.pow(`+r+`, `+i+`)`):o===`and`?n.push(`(!!`+r+` && !!`+i+`)`):o===`or`?n.push(`(!!`+r+` || !!`+i+`)`):o===`||`?n.push(`(function(a,b){ return Array.isArray(a) && Array.isArray(b) ? a.concat(b) : String(a) + String(b); }((`+r+`),(`+i+`)))`):o===`==`?n.push(`(`+r+` === `+i+`)`):o===`!=`?n.push(`(`+r+` !== `+i+`)`):o===`[`?n.push(r+`[(`+i+`) | 0]`):n.push(`(`+r+` `+o+` `+i+`)`):o===`[`?n.push(r+`[`+i+`]`):n.push(`(`+r+` `+o+` `+i+`)`);else if(d===Zx)if(a=n.pop(),i=n.pop(),r=n.pop(),o=u.value,o===`?`)n.push(`(`+r+` ? `+i+` : `+a+`)`);else throw Error(`invalid Expression`);else if(d===Qx||d===$x)n.push(u.value);else if(d===Yx)r=n.pop(),o=u.value,o===`-`||o===`+`?n.push(`(`+o+r+`)`):t?o===`not`?n.push(`(!`+r+`)`):o===`!`?n.push(`fac(`+r+`)`):n.push(o+`(`+r+`)`):o===`!`?n.push(`(`+r+`!)`):n.push(`(`+o+` `+r+`)`);else if(d===eS){for(c=u.value,s=[];c-->0;)s.unshift(n.pop());o=n.pop(),n.push(o+`(`+s.join(`, `)+`)`)}else if(d===tS){for(i=n.pop(),c=u.value,s=[];c-->0;)s.unshift(n.pop());r=n.pop(),t?n.push(`(`+r+` = function(`+s.join(`, `)+`) { return `+i+` })`):n.push(`(`+r+`(`+s.join(`, `)+`) = `+i+`)`)}else if(d===iS)r=n.pop(),n.push(r+`.`+u.value);else if(d===oS){for(c=u.value,s=[];c-->0;)s.unshift(n.pop());n.push(`[`+s.join(`, `)+`]`)}else if(d===nS)n.push(`(`+_S(u.value,t)+`)`);else if(d!==aS)throw Error(`invalid Expression`)}return n.length>1&&(n=t?[n.join(`,`)]:[n.join(`;`)]),String(n[0])}function vS(e){return typeof e==`string`?JSON.stringify(e).replace(/\u2028/g,`\\u2028`).replace(/\u2029/g,`\\u2029`):e}function yS(e,t){for(var n=0;n<e.length;n++)if(e[n]===t)return!0;return!1}function bS(e,t,n){n||={};for(var r=!!n.withMembers,i=null,a=0;a<e.length;a++){var o=e[a];o.type===Qx||o.type===$x?!r&&!yS(t,o.value)?t.push(o.value):(i===null||yS(t,i)||t.push(i),i=o.value):o.type===iS&&r&&i!==null?i+=`.`+o.value:o.type===nS?bS(o.value,t,n):i!==null&&(yS(t,i)||t.push(i),i=null)}i!==null&&!yS(t,i)&&t.push(i)}function xS(e,t){this.tokens=e,this.parser=t,this.unaryOps=t.unaryOps,this.binaryOps=t.binaryOps,this.ternaryOps=t.ternaryOps,this.functions=t.functions}xS.prototype.simplify=function(e){return e||={},new xS(uS(this.tokens,this.unaryOps,this.binaryOps,this.ternaryOps,e),this.parser)},xS.prototype.substitute=function(e,t){return t instanceof xS||(t=this.parser.parse(String(t))),new xS(dS(this.tokens,e,t),this.parser)},xS.prototype.evaluate=function(e){return e||={},pS(this.tokens,this,e)},xS.prototype.toString=function(){return _S(this.tokens,!1)},xS.prototype.symbols=function(e){e||={};var t=[];return bS(this.tokens,t,e),t},xS.prototype.variables=function(e){e||={};var t=[];bS(this.tokens,t,e);var n=this.functions;return t.filter(function(e){return!(e in n)})},xS.prototype.toJSFunction=function(e,t){var n=this,r=Function(e,`with(this.functions) with (this.ternaryOps) with (this.binaryOps) with (this.unaryOps) { return `+_S(this.simplify(t).tokens,!0)+`; }`);return function(){return r.apply(n,arguments)}};var SS=`TEOF`,J=`TOP`,CS=`TNUMBER`,wS=`TSTRING`,TS=`TPAREN`,ES=`TBRACKET`,DS=`TCOMMA`,OS=`TNAME`,kS=`TSEMICOLON`;function AS(e,t,n){this.type=e,this.value=t,this.index=n}AS.prototype.toString=function(){return this.type+`: `+this.value};function Y(e,t){this.pos=0,this.current=null,this.unaryOps=e.unaryOps,this.binaryOps=e.binaryOps,this.ternaryOps=e.ternaryOps,this.consts=e.consts,this.expression=t,this.savedPosition=0,this.savedCurrent=null,this.options=e.options,this.parser=e}Y.prototype.newToken=function(e,t,n){return new AS(e,t,n??this.pos)},Y.prototype.save=function(){this.savedPosition=this.pos,this.savedCurrent=this.current},Y.prototype.restore=function(){this.pos=this.savedPosition,this.current=this.savedCurrent},Y.prototype.next=function(){if(this.pos>=this.expression.length)return this.newToken(SS,`EOF`);if(this.isWhitespace()||this.isComment())return this.next();if(this.isRadixInteger()||this.isNumber()||this.isOperator()||this.isString()||this.isParen()||this.isBracket()||this.isComma()||this.isSemicolon()||this.isNamedOp()||this.isConst()||this.isName())return this.current;this.parseError(`Unknown character "`+this.expression.charAt(this.pos)+`"`)},Y.prototype.isString=function(){var e=!1,t=this.pos,n=this.expression.charAt(t);if(n===`'`||n===`"`)for(var r=this.expression.indexOf(n,t+1);r>=0&&this.pos<this.expression.length;){if(this.pos=r+1,this.expression.charAt(r-1)!==`\\`){var i=this.expression.substring(t+1,r);this.current=this.newToken(wS,this.unescape(i),t),e=!0;break}r=this.expression.indexOf(n,r+1)}return e},Y.prototype.isParen=function(){var e=this.expression.charAt(this.pos);return e===`(`||e===`)`?(this.current=this.newToken(TS,e),this.pos++,!0):!1},Y.prototype.isBracket=function(){var e=this.expression.charAt(this.pos);return(e===`[`||e===`]`)&&this.isOperatorEnabled(`[`)?(this.current=this.newToken(ES,e),this.pos++,!0):!1},Y.prototype.isComma=function(){return this.expression.charAt(this.pos)===`,`?(this.current=this.newToken(DS,`,`),this.pos++,!0):!1},Y.prototype.isSemicolon=function(){return this.expression.charAt(this.pos)===`;`?(this.current=this.newToken(kS,`;`),this.pos++,!0):!1},Y.prototype.isConst=function(){for(var e=this.pos,t=e;t<this.expression.length;t++){var n=this.expression.charAt(t);if(n.toUpperCase()===n.toLowerCase()&&(t===this.pos||n!==`_`&&n!==`.`&&(n<`0`||n>`9`)))break}if(t>e){var r=this.expression.substring(e,t);if(r in this.consts)return this.current=this.newToken(CS,this.consts[r]),this.pos+=r.length,!0}return!1},Y.prototype.isNamedOp=function(){for(var e=this.pos,t=e;t<this.expression.length;t++){var n=this.expression.charAt(t);if(n.toUpperCase()===n.toLowerCase()&&(t===this.pos||n!==`_`&&(n<`0`||n>`9`)))break}if(t>e){var r=this.expression.substring(e,t);if(this.isOperatorEnabled(r)&&(r in this.binaryOps||r in this.unaryOps||r in this.ternaryOps))return this.current=this.newToken(J,r),this.pos+=r.length,!0}return!1},Y.prototype.isName=function(){for(var e=this.pos,t=e,n=!1;t<this.expression.length;t++){var r=this.expression.charAt(t);if(r.toUpperCase()===r.toLowerCase()){if(t===this.pos&&(r===`$`||r===`_`)){r===`_`&&(n=!0);continue}else if(t===this.pos||!n||r!==`_`&&(r<`0`||r>`9`))break}else n=!0}if(n){var i=this.expression.substring(e,t);return this.current=this.newToken(OS,i),this.pos+=i.length,!0}return!1},Y.prototype.isWhitespace=function(){for(var e=!1,t=this.expression.charAt(this.pos);(t===` `||t===` `||t===`
|
|
56
|
+
`||t===`\r`)&&(e=!0,this.pos++,!(this.pos>=this.expression.length));)t=this.expression.charAt(this.pos);return e};var jS=/^[0-9a-f]{4}$/i;Y.prototype.unescape=function(e){var t=e.indexOf(`\\`);if(t<0)return e;for(var n=e.substring(0,t);t>=0;){var r=e.charAt(++t);switch(r){case`'`:n+=`'`;break;case`"`:n+=`"`;break;case`\\`:n+=`\\`;break;case`/`:n+=`/`;break;case`b`:n+=`\b`;break;case`f`:n+=`\f`;break;case`n`:n+=`
|
|
57
|
+
`;break;case`r`:n+=`\r`;break;case`t`:n+=` `;break;case`u`:var i=e.substring(t+1,t+5);jS.test(i)||this.parseError(`Illegal escape sequence: \\u`+i),n+=String.fromCharCode(parseInt(i,16)),t+=4;break;default:throw this.parseError(`Illegal escape sequence: "\\`+r+`"`)}++t;var a=e.indexOf(`\\`,t);n+=e.substring(t,a<0?e.length:a),t=a}return n},Y.prototype.isComment=function(){return this.expression.charAt(this.pos)===`/`&&this.expression.charAt(this.pos+1)===`*`?(this.pos=this.expression.indexOf(`*/`,this.pos)+2,this.pos===1&&(this.pos=this.expression.length),!0):!1},Y.prototype.isRadixInteger=function(){var e=this.pos;if(e>=this.expression.length-2||this.expression.charAt(e)!==`0`)return!1;++e;var t,n;if(this.expression.charAt(e)===`x`)t=16,n=/^[0-9a-f]$/i,++e;else if(this.expression.charAt(e)===`b`)t=2,n=/^[01]$/i,++e;else return!1;for(var r=!1,i=e;e<this.expression.length;){var a=this.expression.charAt(e);if(n.test(a))e++,r=!0;else break}return r&&(this.current=this.newToken(CS,parseInt(this.expression.substring(i,e),t)),this.pos=e),r},Y.prototype.isNumber=function(){for(var e=!1,t=this.pos,n=t,r=t,i=!1,a=!1,o;t<this.expression.length&&(o=this.expression.charAt(t),o>=`0`&&o<=`9`||!i&&o===`.`);)o===`.`?i=!0:a=!0,t++,e=a;if(e&&(r=t),o===`e`||o===`E`){t++;for(var s=!0,c=!1;t<this.expression.length;){if(o=this.expression.charAt(t),s&&(o===`+`||o===`-`))s=!1;else if(o>=`0`&&o<=`9`)c=!0,s=!1;else break;t++}c||(t=r)}return e?(this.current=this.newToken(CS,parseFloat(this.expression.substring(n,t))),this.pos=t):this.pos=r,e},Y.prototype.isOperator=function(){var e=this.pos,t=this.expression.charAt(this.pos);if(t===`+`||t===`-`||t===`*`||t===`/`||t===`%`||t===`^`||t===`?`||t===`:`||t===`.`)this.current=this.newToken(J,t);else if(t===`∙`||t===`•`)this.current=this.newToken(J,`*`);else if(t===`>`)this.expression.charAt(this.pos+1)===`=`?(this.current=this.newToken(J,`>=`),this.pos++):this.current=this.newToken(J,`>`);else if(t===`<`)this.expression.charAt(this.pos+1)===`=`?(this.current=this.newToken(J,`<=`),this.pos++):this.current=this.newToken(J,`<`);else if(t===`|`)if(this.expression.charAt(this.pos+1)===`|`)this.current=this.newToken(J,`||`),this.pos++;else return!1;else if(t===`=`)this.expression.charAt(this.pos+1)===`=`?(this.current=this.newToken(J,`==`),this.pos++):this.current=this.newToken(J,t);else if(t===`!`)this.expression.charAt(this.pos+1)===`=`?(this.current=this.newToken(J,`!=`),this.pos++):this.current=this.newToken(J,t);else return!1;return this.pos++,this.isOperatorEnabled(this.current.value)?!0:(this.pos=e,!1)},Y.prototype.isOperatorEnabled=function(e){return this.parser.isOperatorEnabled(e)},Y.prototype.getCoordinates=function(){var e=0,t,n=-1;do e++,t=this.pos-n,n=this.expression.indexOf(`
|
|
58
|
+
`,n+1);while(n>=0&&n<this.pos);return{line:e,column:t}},Y.prototype.parseError=function(e){var t=this.getCoordinates();throw Error(`parse error [`+t.line+`:`+t.column+`]: `+e)};function X(e,t,n){this.parser=e,this.tokens=t,this.current=null,this.nextToken=null,this.next(),this.savedCurrent=null,this.savedNextToken=null,this.allowMemberAccess=n.allowMemberAccess!==!1}X.prototype.next=function(){return this.current=this.nextToken,this.nextToken=this.tokens.next()},X.prototype.tokenMatches=function(e,t){return t===void 0?!0:Array.isArray(t)?yS(t,e.value):typeof t==`function`?t(e):e.value===t},X.prototype.save=function(){this.savedCurrent=this.current,this.savedNextToken=this.nextToken,this.tokens.save()},X.prototype.restore=function(){this.tokens.restore(),this.current=this.savedCurrent,this.nextToken=this.savedNextToken},X.prototype.accept=function(e,t){return this.nextToken.type===e&&this.tokenMatches(this.nextToken,t)?(this.next(),!0):!1},X.prototype.expect=function(e,t){if(!this.accept(e,t)){var n=this.tokens.getCoordinates();throw Error(`parse error [`+n.line+`:`+n.column+`]: Expected `+(t||e))}},X.prototype.parseAtom=function(e){var t=this.tokens.unaryOps;function n(e){return e.value in t}if(this.accept(OS)||this.accept(J,n))e.push(new q(Qx,this.current.value));else if(this.accept(CS))e.push(new q(Jx,this.current.value));else if(this.accept(wS))e.push(new q(Jx,this.current.value));else if(this.accept(TS,`(`))this.parseExpression(e),this.expect(TS,`)`);else if(this.accept(ES,`[`))if(this.accept(ES,`]`))e.push(new q(oS,0));else{var r=this.parseArrayList(e);e.push(new q(oS,r))}else throw Error(`unexpected `+this.nextToken)},X.prototype.parseExpression=function(e){var t=[];this.parseUntilEndStatement(e,t)||(this.parseVariableAssignmentExpression(t),!this.parseUntilEndStatement(e,t)&&this.pushExpression(e,t))},X.prototype.pushExpression=function(e,t){for(var n=0,r=t.length;n<r;n++)e.push(t[n])},X.prototype.parseUntilEndStatement=function(e,t){return this.accept(kS)?(this.nextToken&&this.nextToken.type!==SS&&!(this.nextToken.type===TS&&this.nextToken.value===`)`)&&t.push(new q(aS)),this.nextToken.type!==SS&&this.parseExpression(t),e.push(new q(nS,t)),!0):!1},X.prototype.parseArrayList=function(e){for(var t=0;!this.accept(ES,`]`);)for(this.parseExpression(e),++t;this.accept(DS);)this.parseExpression(e),++t;return t},X.prototype.parseVariableAssignmentExpression=function(e){for(this.parseConditionalExpression(e);this.accept(J,`=`);){var t=e.pop(),n=[],r=e.length-1;if(t.type===eS){if(!this.tokens.isOperatorEnabled(`()=`))throw Error(`function definition is not permitted`);for(var i=0,a=t.value+1;i<a;i++){var o=r-i;e[o].type===Qx&&(e[o]=new q($x,e[o].value))}this.parseVariableAssignmentExpression(n),e.push(new q(nS,n)),e.push(new q(tS,t.value));continue}if(t.type!==Qx&&t.type!==iS)throw Error(`expected variable for assignment`);this.parseVariableAssignmentExpression(n),e.push(new q($x,t.value)),e.push(new q(nS,n)),e.push(cS(`=`))}},X.prototype.parseConditionalExpression=function(e){for(this.parseOrExpression(e);this.accept(J,`?`);){var t=[],n=[];this.parseConditionalExpression(t),this.expect(J,`:`),this.parseConditionalExpression(n),e.push(new q(nS,t)),e.push(new q(nS,n)),e.push(lS(`?`))}},X.prototype.parseOrExpression=function(e){for(this.parseAndExpression(e);this.accept(J,`or`);){var t=[];this.parseAndExpression(t),e.push(new q(nS,t)),e.push(cS(`or`))}},X.prototype.parseAndExpression=function(e){for(this.parseComparison(e);this.accept(J,`and`);){var t=[];this.parseComparison(t),e.push(new q(nS,t)),e.push(cS(`and`))}};var MS=[`==`,`!=`,`<`,`<=`,`>=`,`>`,`in`];X.prototype.parseComparison=function(e){for(this.parseAddSub(e);this.accept(J,MS);){var t=this.current;this.parseAddSub(e),e.push(cS(t.value))}};var NS=[`+`,`-`,`||`];X.prototype.parseAddSub=function(e){for(this.parseTerm(e);this.accept(J,NS);){var t=this.current;this.parseTerm(e),e.push(cS(t.value))}};var PS=[`*`,`/`,`%`];X.prototype.parseTerm=function(e){for(this.parseFactor(e);this.accept(J,PS);){var t=this.current;this.parseFactor(e),e.push(cS(t.value))}},X.prototype.parseFactor=function(e){var t=this.tokens.unaryOps;function n(e){return e.value in t}if(this.save(),this.accept(J,n)){if(this.current.value!==`-`&&this.current.value!==`+`){if(this.nextToken.type===TS&&this.nextToken.value===`(`){this.restore(),this.parseExponential(e);return}else if(this.nextToken.type===kS||this.nextToken.type===DS||this.nextToken.type===SS||this.nextToken.type===TS&&this.nextToken.value===`)`){this.restore(),this.parseAtom(e);return}}var r=this.current;this.parseFactor(e),e.push(sS(r.value))}else this.parseExponential(e)},X.prototype.parseExponential=function(e){for(this.parsePostfixExpression(e);this.accept(J,`^`);)this.parseFactor(e),e.push(cS(`^`))},X.prototype.parsePostfixExpression=function(e){for(this.parseFunctionCall(e);this.accept(J,`!`);)e.push(sS(`!`))},X.prototype.parseFunctionCall=function(e){var t=this.tokens.unaryOps;function n(e){return e.value in t}if(this.accept(J,n)){var r=this.current;this.parseAtom(e),e.push(sS(r.value))}else for(this.parseMemberExpression(e);this.accept(TS,`(`);)if(this.accept(TS,`)`))e.push(new q(eS,0));else{var i=this.parseArgumentList(e);e.push(new q(eS,i))}},X.prototype.parseArgumentList=function(e){for(var t=0;!this.accept(TS,`)`);)for(this.parseExpression(e),++t;this.accept(DS);)this.parseExpression(e),++t;return t},X.prototype.parseMemberExpression=function(e){for(this.parseAtom(e);this.accept(J,`.`)||this.accept(ES,`[`);){var t=this.current;if(t.value===`.`){if(!this.allowMemberAccess)throw Error(`unexpected ".", member access is not permitted`);this.expect(OS),e.push(new q(iS,this.current.value))}else if(t.value===`[`){if(!this.tokens.isOperatorEnabled(`[`))throw Error(`unexpected "[]", arrays are disabled`);this.parseExpression(e),this.expect(ES,`]`),e.push(cS(`[`))}else throw Error(`unexpected symbol: `+t.value)}};function FS(e,t){return Number(e)+Number(t)}function IS(e,t){return e-t}function LS(e,t){return e*t}function RS(e,t){return e/t}function zS(e,t){return e%t}function BS(e,t){return Array.isArray(e)&&Array.isArray(t)?e.concat(t):``+e+t}function VS(e,t){return e===t}function HS(e,t){return e!==t}function US(e,t){return e>t}function WS(e,t){return e<t}function GS(e,t){return e>=t}function KS(e,t){return e<=t}function qS(e,t){return!!(e&&t)}function JS(e,t){return!!(e||t)}function YS(e,t){return yS(t,e)}function XS(e){return(Math.exp(e)-Math.exp(-e))/2}function ZS(e){return(Math.exp(e)+Math.exp(-e))/2}function QS(e){return e===1/0?1:e===-1/0?-1:(Math.exp(e)-Math.exp(-e))/(Math.exp(e)+Math.exp(-e))}function $S(e){return e===-1/0?e:Math.log(e+Math.sqrt(e*e+1))}function eC(e){return Math.log(e+Math.sqrt(e*e-1))}function tC(e){return Math.log((1+e)/(1-e))/2}function nC(e){return Math.log(e)*Math.LOG10E}function rC(e){return-e}function iC(e){return!e}function aC(e){return e<0?Math.ceil(e):Math.floor(e)}function oC(e){return Math.random()*(e||1)}function sC(e){return dC(e+1)}function cC(e){return isFinite(e)&&e===Math.round(e)}var lC=4.7421875,uC=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22];function dC(e){var t,n;if(cC(e)){if(e<=0)return isFinite(e)?1/0:NaN;if(e>171)return 1/0;for(var r=e-2,i=e-1;r>1;)i*=r,r--;return i===0&&(i=1),i}if(e<.5)return Math.PI/(Math.sin(Math.PI*e)*dC(1-e));if(e>=171.35)return 1/0;if(e>85){var a=e*e,o=a*e,s=o*e,c=s*e;return Math.sqrt(2*Math.PI/e)*(e/Math.E)**+e*(1+1/(12*e)+1/(288*a)-139/(51840*o)-571/(2488320*s)+163879/(209018880*c)+5246819/(75246796800*c*e))}--e,n=uC[0];for(var l=1;l<uC.length;++l)n+=uC[l]/(e+l);return t=e+lC+.5,Math.sqrt(2*Math.PI)*t**+(e+.5)*Math.exp(-t)*n}function fC(e){return Array.isArray(e)?e.length:String(e).length}function pC(){for(var e=0,t=0,n=0;n<arguments.length;n++){var r=Math.abs(arguments[n]),i;t<r?(i=t/r,e=e*i*i+1,t=r):r>0?(i=r/t,e+=i*i):e+=r}return t===1/0?1/0:t*Math.sqrt(e)}function mC(e,t,n){return e?t:n}function hC(e,t){return t===void 0||+t==0?Math.round(e):(e=+e,t=-+t,isNaN(e)||!(typeof t==`number`&&t%1==0)?NaN:(e=e.toString().split(`e`),e=Math.round(+(e[0]+`e`+(e[1]?+e[1]-t:-t))),e=e.toString().split(`e`),+(e[0]+`e`+(e[1]?+e[1]+t:t))))}function gC(e,t,n){return n&&(n[e]=t),t}function _C(e,t){return e[t|0]}function vC(e){return arguments.length===1&&Array.isArray(e)?Math.max.apply(Math,e):Math.max.apply(Math,arguments)}function yC(e){return arguments.length===1&&Array.isArray(e)?Math.min.apply(Math,e):Math.min.apply(Math,arguments)}function bC(e,t){if(typeof e!=`function`)throw Error(`First argument to map is not a function`);if(!Array.isArray(t))throw Error(`Second argument to map is not an array`);return t.map(function(t,n){return e(t,n)})}function xC(e,t,n){if(typeof e!=`function`)throw Error(`First argument to fold is not a function`);if(!Array.isArray(n))throw Error(`Second argument to fold is not an array`);return n.reduce(function(t,n,r){return e(t,n,r)},t)}function SC(e,t){if(typeof e!=`function`)throw Error(`First argument to filter is not a function`);if(!Array.isArray(t))throw Error(`Second argument to filter is not an array`);return t.filter(function(t,n){return e(t,n)})}function CC(e,t){if(!(Array.isArray(t)||typeof t==`string`))throw Error(`Second argument to indexOf is not a string or array`);return t.indexOf(e)}function wC(e,t){if(!Array.isArray(t))throw Error(`Second argument to join is not an array`);return t.join(e)}function TC(e){return(e>0)-(e<0)||+e}var EC=1/3;function DC(e){return e<0?-((-e)**+EC):e**+EC}function OC(e){return Math.exp(e)-1}function kC(e){return Math.log(1+e)}function AC(e){return Math.log(e)/Math.LN2}function jC(e){if(!Array.isArray(e))throw Error(`Sum argument is not an array`);return e.reduce(function(e,t){return e+Number(t)},0)}function MC(e){this.options=e||{},this.unaryOps={sin:Math.sin,cos:Math.cos,tan:Math.tan,asin:Math.asin,acos:Math.acos,atan:Math.atan,sinh:Math.sinh||XS,cosh:Math.cosh||ZS,tanh:Math.tanh||QS,asinh:Math.asinh||$S,acosh:Math.acosh||eC,atanh:Math.atanh||tC,sqrt:Math.sqrt,cbrt:Math.cbrt||DC,log:Math.log,log2:Math.log2||AC,ln:Math.log,lg:Math.log10||nC,log10:Math.log10||nC,expm1:Math.expm1||OC,log1p:Math.log1p||kC,abs:Math.abs,ceil:Math.ceil,floor:Math.floor,round:Math.round,trunc:Math.trunc||aC,"-":rC,"+":Number,exp:Math.exp,not:iC,length:fC,"!":sC,sign:Math.sign||TC},this.binaryOps={"+":FS,"-":IS,"*":LS,"/":RS,"%":zS,"^":Math.pow,"||":BS,"==":VS,"!=":HS,">":US,"<":WS,">=":GS,"<=":KS,and:qS,or:JS,in:YS,"=":gC,"[":_C},this.ternaryOps={"?":mC},this.functions={random:oC,fac:sC,min:yC,max:vC,hypot:Math.hypot||pC,pyt:Math.hypot||pC,pow:Math.pow,atan2:Math.atan2,if:mC,gamma:dC,roundTo:hC,map:bC,fold:xC,filter:SC,indexOf:CC,join:wC,sum:jC},this.consts={E:Math.E,PI:Math.PI,true:!0,false:!1}}MC.prototype.parse=function(e){var t=[],n=new X(this,new Y(this,e),{allowMemberAccess:this.options.allowMemberAccess});return n.parseExpression(t),n.expect(SS,`EOF`),new xS(t,this)},MC.prototype.evaluate=function(e,t){return this.parse(e).evaluate(t)};var NC=new MC;MC.parse=function(e){return NC.parse(e)},MC.evaluate=function(e,t){return NC.parse(e).evaluate(t)};var PC={"+":`add`,"-":`subtract`,"*":`multiply`,"/":`divide`,"%":`remainder`,"^":`power`,"!":`factorial`,"<":`comparison`,">":`comparison`,"<=":`comparison`,">=":`comparison`,"==":`comparison`,"!=":`comparison`,"||":`concatenate`,and:`logical`,or:`logical`,not:`logical`,"?":`conditional`,":":`conditional`,"=":`assignment`,"[":`array`,"()=":`fndef`};function FC(e){return Object.hasOwn(PC,e)?PC[e]:e}MC.prototype.isOperatorEnabled=function(e){var t=FC(e),n=this.options.operators||{};return!(t in n)||!!n[t]};var IC=new MC({allowMemberAccess:!0,operators:{add:!0,subtract:!0,multiply:!0,divide:!0,remainder:!0,comparison:!0,concatenate:!0,conditional:!1,logical:!0,in:!0,length:!0,abs:!0,ceil:!0,floor:!0,round:!0,trunc:!0,power:!1,factorial:!1,assignment:!1,fndef:!1,random:!1,min:!1,max:!1,sin:!1,cos:!1,tan:!1,asin:!1,acos:!1,atan:!1,sinh:!1,cosh:!1,tanh:!1,asinh:!1,acosh:!1,atanh:!1,sqrt:!1,cbrt:!1,log:!1,log2:!1,ln:!1,lg:!1,log10:!1,expm1:!1,log1p:!1,exp:!1,sign:!1}});IC.consts={true:!0,false:!1};var LC=e=>{try{return ix(e).toString()}catch{return e}},RC=({value:e,otherValue:t})=>{if((0,y.isString)(e)&&(0,y.isString)(t)&&kc(t))return LC(e);if((0,y.isString)(e)&&(0,y.isString)(t)){let r=bb(e),i=bb(t);if(n.t(r)&&n.t(i)&&!r.isDateOnly&&!i.isDateOnly)return r.dateTime.epochNanoseconds}return e},zC=e=>(t,n)=>Yb(t)&&Yb(n)&&e(RC({value:t,otherValue:n}),RC({value:n,otherValue:t})),BC=({left:e,right:t})=>(0,y.isString)(e)&&(0,y.isString)(t)?RC({value:e,otherValue:t})===RC({value:t,otherValue:e}):e===t;IC.binaryOps[`==`]=(e,t)=>BC({left:e,right:t}),IC.binaryOps[`!=`]=(e,t)=>!BC({left:e,right:t}),IC.binaryOps[`<`]=zC((e,t)=>e<t),IC.binaryOps[`<=`]=zC((e,t)=>e<=t),IC.binaryOps[`>`]=zC((e,t)=>e>t),IC.binaryOps[`>=`]=zC((e,t)=>e>=t),IC.binaryOps.in=(e,t)=>Array.isArray(t)&&t.includes(e);var VC=e=>Yb(e)?e:``;IC.binaryOps[`||`]=(e,t)=>Array.isArray(e)&&Array.isArray(t)?[...e,...t]:`${VC(e)}${VC(t)}`,IC.functions=Object.fromEntries(Object.entries(qx).map(([e,{evaluate:t}])=>[e,t]));var HC=rx({compute:e=>IC.parse(e),maxEntries:500}),UC=({now:e,run:t})=>{let n=Ub.current;Ub.current=e;try{return t()}finally{Ub.current=n}},WC=e=>e instanceof Error?e.message:String(e),GC=({expression:e,fields:t})=>{let n;try{n=HC(e)}catch(e){let t=WC(e);return()=>({status:`errored`,errorMessage:t})}let r=n.variables({withMembers:!0}),i=new Map(t.map(e=>[e.name,e]));return({record:e,previousRecord:t,now:a})=>{try{let o=UC({now:a,run:()=>n.evaluate(Gx({record:e,previousRecord:t,fieldByName:i,identifierPaths:r,now:a}))});return typeof o==`boolean`?o?{status:`passed`}:{status:`failed`}:{status:`errored`,errorMessage:`Expression did not return true or false`,errorCode:`NON_BOOLEAN_RESULT`}}catch(e){return e instanceof bc&&(e.code===`INVALID_DATE_UNIT`||e.code===`INVALID_DATE_PART`)?{status:`errored`,errorMessage:e.message,errorCode:e.code}:{status:`errored`,errorMessage:WC(e)}}}},KC=({expression:e,record:t,previousRecord:n,fields:r,now:i})=>GC({expression:e,fields:r})({record:t,previousRecord:n,now:i}),qC=({field:e,subfieldSegments:t,path:r})=>{if(t.length===0)return null;let i=Lx.get(e.type);if(!n.t(i)||t.length>1)return{errorMessage:`"${r}" goes deeper than the field "${e.name}" allows`,errorCode:`SUBFIELD_TOO_DEEP`,errorParams:{path:r,fieldName:e.name}};let a=t[0];return i.properties.some(e=>e.name===a)?null:{errorMessage:`"${a}" is not a subfield of "${e.name}"`,errorCode:`UNKNOWN_SUBFIELD`,errorParams:{subfieldName:a,fieldName:e.name}}},JC=e=>({errorMessage:`"${e}" is not a value`,errorCode:`NOT_A_VALUE`,errorParams:{path:e}}),YC=({path:e,memberSegments:t,fields:r})=>{let[i,...o]=t;if(!n.t(i))return{isResolved:!1,...JC(e)};let s=r.find(e=>e.name===i);if(!n.t(s))return{isResolved:!1,errorMessage:`Unknown field "${i}"`,errorCode:`UNKNOWN_FIELD`,errorParams:{fieldName:i}};if(s.type===a.a.RELATION||s.type===a.a.MORPH_RELATION)return{isResolved:!1,errorMessage:`"${e}" reads a relation, but previous values only cover this record's own fields`,errorCode:`PREVIOUS_VALUE_OF_RELATION`,errorParams:{path:e}};let c=qC({field:s,subfieldSegments:o,path:e});return n.t(c)?{isResolved:!1,...c}:{isResolved:!0,bindings:{[`${Rx}.${i}`]:s.universalIdentifier}}},XC=({path:e,fields:t})=>{let[r,...i]=e.split(`.`);if(!n.t(r))return{isResolved:!1,...JC(e)};if(r===`now`)return i.length===0?{isResolved:!0,bindings:{}}:{isResolved:!1,...JC(e)};if(r===`previous`)return YC({path:e,memberSegments:i,fields:t});let o=t.find(e=>e.name===r);if(!n.t(o))return{isResolved:!1,errorMessage:`Unknown field "${r}"`,errorCode:`UNKNOWN_FIELD`,errorParams:{fieldName:r}};if(!(o.type===a.a.RELATION||o.type===a.a.MORPH_RELATION)){let t=qC({field:o,subfieldSegments:i,path:e});return n.t(t)?{isResolved:!1,...t}:{isResolved:!0,bindings:{[r]:o.universalIdentifier}}}if(o.type===a.a.MORPH_RELATION||o.relationType!==a.i.MANY_TO_ONE||!n.t(o.relationTargetFields))return{isResolved:!1,errorMessage:`"${r}" is not a to-one relation`,errorCode:`NOT_A_TO_ONE_RELATION`,errorParams:{fieldName:r}};let[s,...c]=i;if(!n.t(s))return{isResolved:!0,bindings:{[r]:o.universalIdentifier}};let l=o.relationTargetFields.find(e=>e.name===s);if(!n.t(l))return{isResolved:!1,errorMessage:`Unknown field "${s}" on "${r}"`,errorCode:`UNKNOWN_RELATION_TARGET_FIELD`,errorParams:{fieldName:s,relationFieldName:r}};if(l.type===a.a.RELATION||l.type===a.a.MORPH_RELATION)return{isResolved:!1,errorMessage:`"${e}" goes more than one relation deep`,errorCode:`RELATION_TOO_DEEP`,errorParams:{path:e}};let u=qC({field:l,subfieldSegments:c,path:e});return n.t(u)?{isResolved:!1,...u}:{isResolved:!0,bindings:{[r]:o.universalIdentifier,[`${r}.${s}`]:l.universalIdentifier}}},ZC=2e3,QC=({expression:e,fields:t})=>{if(e.trim().length===0)return{isValid:!1,errorMessage:`Expression is empty`,errorCode:`EMPTY_EXPRESSION`};if(e.length>2e3)return{isValid:!1,errorMessage:`Expression is longer than ${ZC} characters`,errorCode:`EXPRESSION_TOO_LONG`,errorParams:{maxLength:ZC}};let n;try{n=HC(e)}catch(t){return{isValid:!1,...gx({expression:e,error:t})}}if(Kx(n.tokens))return{isValid:!1,errorMessage:`Bracket access is not supported, use dot access instead`,errorCode:`BRACKET_ACCESS`};let r=dx(e).filter(e=>e.type!==`whitespace`),i=r.findIndex((e,t)=>e.type===`symbol`&&e.text===`.`&&r[t-1]?.type===`path`&&r[t+1]?.type===`path`);if(i!==-1){let e=`${r[i-1]?.text}.${r[i+1]?.text}`;return{isValid:!1,errorMessage:`Write ${e} without spaces around the dot`,errorCode:`SPACED_MEMBER_DOT`,errorParams:{path:e}}}let a=n.variables({withMembers:!0}),o={};for(let e of a){let n=XC({path:e,fields:t});if(!n.isResolved)return{isValid:!1,errorMessage:n.errorMessage,errorCode:n.errorCode,errorParams:n.errorParams};o={...o,...n.bindings}}let s=KC({expression:e,record:{},fields:t,now:new Date().toISOString()});return s.status===`errored`?{isValid:!1,errorMessage:s.errorMessage,errorCode:s.errorCode}:{isValid:!0,bindings:o}},$C=[`AGGREGATE_CHART`,`PIE_CHART`,`BAR_CHART`,`LINE_CHART`],ew=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function tw(e){return typeof e==`string`&&ew.test(e)}function nw(e){if(!tw(e))throw TypeError(`Invalid UUID`);let t;return Uint8Array.of((t=parseInt(e.slice(0,8),16))>>>24,t>>>16&255,t>>>8&255,t&255,(t=parseInt(e.slice(9,13),16))>>>8,t&255,(t=parseInt(e.slice(14,18),16))>>>8,t&255,(t=parseInt(e.slice(19,23),16))>>>8,t&255,(t=parseInt(e.slice(24,36),16))/1099511627776&255,t/4294967296&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255)}var Z=[];for(let e=0;e<256;++e)Z.push((e+256).toString(16).slice(1));function rw(e,t=0){return(Z[e[t+0]]+Z[e[t+1]]+Z[e[t+2]]+Z[e[t+3]]+`-`+Z[e[t+4]]+Z[e[t+5]]+`-`+Z[e[t+6]]+Z[e[t+7]]+`-`+Z[e[t+8]]+Z[e[t+9]]+`-`+Z[e[t+10]]+Z[e[t+11]]+Z[e[t+12]]+Z[e[t+13]]+Z[e[t+14]]+Z[e[t+15]]).toLowerCase()}function iw(e){e=unescape(encodeURIComponent(e));let t=new Uint8Array(e.length);for(let n=0;n<e.length;++n)t[n]=e.charCodeAt(n);return t}var aw=`6ba7b810-9dad-11d1-80b4-00c04fd430c8`,ow=`6ba7b811-9dad-11d1-80b4-00c04fd430c8`;function sw(e,t,n,r,i,a){let o=typeof n==`string`?iw(n):n,s=typeof r==`string`?nw(r):r;if(typeof r==`string`&&(r=nw(r)),r?.length!==16)throw TypeError(`Namespace must be array-like (16 iterable integer values, 0-255)`);let c=new Uint8Array(16+o.length);if(c.set(s),c.set(o,s.length),c=t(c),c[6]=c[6]&15|e,c[8]=c[8]&63|128,i){if(a||=0,a<0||a+16>i.length)throw RangeError(`UUID byte range ${a}:${a+15} is out of buffer bounds`);for(let e=0;e<16;++e)i[a+e]=c[e];return i}return rw(c)}function cw(e,t,n,r){switch(e){case 0:return t&n^~t&r;case 1:return t^n^r;case 2:return t&n^t&r^n&r;case 3:return t^n^r}}function lw(e,t){return e<<t|e>>>32-t}function uw(e){let t=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520],r=new Uint8Array(e.length+1);r.set(e),r[e.length]=128,e=r;let i=e.length/4+2,a=Math.ceil(i/16),o=Array(a);for(let t=0;t<a;++t){let n=new Uint32Array(16);for(let r=0;r<16;++r)n[r]=e[t*64+r*4]<<24|e[t*64+r*4+1]<<16|e[t*64+r*4+2]<<8|e[t*64+r*4+3];o[t]=n}o[a-1][14]=(e.length-1)*8/2**32,o[a-1][14]=Math.floor(o[a-1][14]),o[a-1][15]=(e.length-1)*8&4294967295;for(let e=0;e<a;++e){let r=new Uint32Array(80);for(let t=0;t<16;++t)r[t]=o[e][t];for(let e=16;e<80;++e)r[e]=lw(r[e-3]^r[e-8]^r[e-14]^r[e-16],1);let i=n[0],a=n[1],s=n[2],c=n[3],l=n[4];for(let e=0;e<80;++e){let n=Math.floor(e/20),o=lw(i,5)+cw(n,a,s,c)+l+t[n]+r[e]>>>0;l=c,c=s,s=lw(a,30)>>>0,a=i,i=o}n[0]=n[0]+i>>>0,n[1]=n[1]+a>>>0,n[2]=n[2]+s>>>0,n[3]=n[3]+c>>>0,n[4]=n[4]+l>>>0}return Uint8Array.of(n[0]>>24,n[0]>>16,n[0]>>8,n[0],n[1]>>24,n[1]>>16,n[1]>>8,n[1],n[2]>>24,n[2]>>16,n[2]>>8,n[2],n[3]>>24,n[3]>>16,n[3]>>8,n[3],n[4]>>24,n[4]>>16,n[4]>>8,n[4])}function dw(e,t,n,r){return sw(80,uw,e,t,n,r)}dw.DNS=aw,dw.URL=ow;function fw(e){if(!tw(e))throw TypeError(`Invalid UUID`);return parseInt(e.slice(14,15),16)}var pw=`a80ff791-b940-4c47-a522-2bb478515415`,mw=e=>e.type!==a.a.SELECT&&e.type!==a.a.MULTI_SELECT||e.options===void 0||e.options===null?e:{...e,options:e.options.map(t=>({...t,id:t.id??dw(`${t.label}-${e.universalIdentifier}`,pw)}))},hw=({fields:e,labelIdentifierFieldMetadataUniversalIdentifier:t})=>n.t(t)&&!e.some(e=>e.universalIdentifier===t),gw=`front-component-shared-dependencies.mjs`,_w=({objectMetadataApplicationUniversalIdentifier:e,viewUniversalIdentifier:t,name:n})=>a.n({entityNamespace:`viewFieldGroup`,value:`${t}:${n}`,applicationUniversalIdentifier:e}),vw=({fieldMetadataApplicationUniversalIdentifier:e,viewUniversalIdentifier:t,fieldMetadataUniversalIdentifier:n})=>a.n({entityNamespace:`viewField`,value:`${t}:${n}`,applicationUniversalIdentifier:e}),yw={default:{w:4,h:4},minimum:{w:2,h:2}},bw=({pageLayoutTabManifest:e,pageLayoutType:t})=>{let r=e.layoutMode??(t===o.c.STANDALONE_PAGE?o.l.VERTICAL_LIST:o.l.GRID),a=e.widgets??[],s=[];if(!Object.values(o.l).some(e=>e===r))return{status:`fail`,errors:[`Page layout tab "${e.title}" defines unsupported layoutMode "${r}". Expected GRID, VERTICAL_LIST or CANVAS.`]};for(let t of a){let a=[t.heightBehavior,i.t(t.position)&&`heightBehavior`in t.position?t.position.heightBehavior:void 0].filter(n.t);a.length>0&&r!==o.l.VERTICAL_LIST&&s.push(`Page layout widget "${t.title}" defines heightBehavior, but its parent tab "${e.title}" uses ${r}. heightBehavior is only supported for VERTICAL_LIST tabs.`);for(let e of a)Object.values(Qb).some(t=>t===e)||s.push(`Page layout widget "${t.title}" defines unsupported heightBehavior "${e}". Expected FIT_CONTENT or TAB_VIEWPORT.`)}if(s.length>0)return{status:`fail`,errors:s};let c={...e,layoutMode:r,widgets:a.map(({heightBehavior:e,position:t,gridPosition:i,...a},s)=>{if(n.t(t))return{...a,position:t.layoutMode===o.l.VERTICAL_LIST&&n.t(e)?{...t,heightBehavior:e}:t};if(n.t(i))return{...a,position:{layoutMode:o.l.GRID,...i}};switch(r){case o.l.GRID:return{...a,position:{layoutMode:r,row:0,column:0,rowSpan:yw.default.h,columnSpan:yw.default.w}};case o.l.VERTICAL_LIST:return{...a,position:{layoutMode:r,index:s,...n.t(e)?{heightBehavior:e}:{}}};case o.l.CANVAS:return{...a,position:{layoutMode:r}};default:return ne(r)}})};for(let e of c.widgets)e.position.layoutMode!==r&&s.push(`Page layout widget "${e.title}" uses a ${e.position.layoutMode} position, but its parent tab "${c.title}" uses ${r}.`);if(r===o.l.VERTICAL_LIST){let e=c.widgets.filter(({type:e,position:t})=>t.layoutMode===o.l.VERTICAL_LIST&&$b({widgetType:e,heightBehavior:t.heightBehavior})===Qb.TAB_VIEWPORT);e.length>1&&s.push(`Page layout tab "${c.title}" can contain only one TAB_VIEWPORT widget.`);let t=e.length===1?e[0]:void 0;n.t(t)&&c.widgets.some(e=>e!==t&&e.position.layoutMode===o.l.VERTICAL_LIST&&t.position.layoutMode===o.l.VERTICAL_LIST&&e.position.index>=t.position.index)&&s.push(`Page layout tab "${c.title}" must place its TAB_VIEWPORT widget last.`)}return s.length>0?{status:`fail`,errors:s}:{status:`success`,pageLayoutTab:c}},xw=[`canReadObjectRecords`,`canUpdateObjectRecords`,`canSoftDeleteObjectRecords`,`canDestroyObjectRecords`];[...xw];var Sw={canReadObjectRecords:`canReadAllObjectRecords`,canUpdateObjectRecords:`canUpdateAllObjectRecords`,canSoftDeleteObjectRecords:`canSoftDeleteAllObjectRecords`,canDestroyObjectRecords:`canDestroyAllObjectRecords`},Cw=({role:e,objectUniversalIdentifier:t})=>{let n=e.objectPermissions?.find(e=>e.objectUniversalIdentifier===t);return{canReadObjectRecords:n?.canReadObjectRecords??e[Sw.canReadObjectRecords]??!1,canUpdateObjectRecords:n?.canUpdateObjectRecords??e[Sw.canUpdateObjectRecords]??!1,canSoftDeleteObjectRecords:n?.canSoftDeleteObjectRecords??e[Sw.canSoftDeleteObjectRecords]??!1,canDestroyObjectRecords:n?.canDestroyObjectRecords??e[Sw.canDestroyObjectRecords]??!1}},ww=e=>JSON.stringify(e,(e,t)=>i.t(t)?Object.fromEntries(Object.entries(t).sort(([e],[t])=>e.localeCompare(t))):t),Tw=({groupsByUniversalIdentifier:e,predicateGroupUniversalIdentifier:t})=>{let r=[],i=new Set,a=t;for(;n.t(a)&&!i.has(a);){i.add(a);let t=e.get(a);if(!n.t(t))break;r.push(t.logicalOperator),a=t.parentPredicateGroupUniversalIdentifier}return r},Ew=({role:e,objectUniversalIdentifier:t})=>{let n=new Map((e.rowLevelPermissionPredicateGroups??[]).map(e=>[e.universalIdentifier,e]));return(e.rowLevelPermissionPredicates??[]).filter(e=>e.objectUniversalIdentifier===t).map(e=>ww({fieldUniversalIdentifier:e.fieldUniversalIdentifier,subFieldName:e.subFieldName??null,operand:e.operand,value:e.value??null,workspaceMemberFieldUniversalIdentifier:e.workspaceMemberFieldUniversalIdentifier??null,workspaceMemberSubFieldName:e.workspaceMemberSubFieldName??null,groupOperatorPath:Tw({groupsByUniversalIdentifier:n,predicateGroupUniversalIdentifier:e.predicateGroupUniversalIdentifier})})).sort()},Dw=function(e){return e.API_KEYS_AND_WEBHOOKS=`API_KEYS_AND_WEBHOOKS`,e.WORKSPACE=`WORKSPACE`,e.WORKSPACE_MEMBERS=`WORKSPACE_MEMBERS`,e.ROLES=`ROLES`,e.DATA_MODEL=`DATA_MODEL`,e.SECURITY=`SECURITY`,e.WORKFLOWS=`WORKFLOWS`,e.IMPERSONATE=`IMPERSONATE`,e.SSO_BYPASS=`SSO_BYPASS`,e.APPLICATIONS=`APPLICATIONS`,e.MARKETPLACE_APPS=`MARKETPLACE_APPS`,e.LAYOUTS=`LAYOUTS`,e.BILLING=`BILLING`,e.AI_SETTINGS=`AI_SETTINGS`,e.AI=`AI`,e.VIEWS=`VIEWS`,e.UPLOAD_FILE=`UPLOAD_FILE`,e.DOWNLOAD_FILE=`DOWNLOAD_FILE`,e.SEND_EMAIL_TOOL=`SEND_EMAIL_TOOL`,e.CREATE_CALENDAR_EVENT_TOOL=`CREATE_CALENDAR_EVENT_TOOL`,e.HTTP_REQUEST_TOOL=`HTTP_REQUEST_TOOL`,e.CODE_INTERPRETER_TOOL=`CODE_INTERPRETER_TOOL`,e.IMPORT_CSV=`IMPORT_CSV`,e.EXPORT_CSV=`EXPORT_CSV`,e.CONNECTED_ACCOUNTS=`CONNECTED_ACCOUNTS`,e.PROFILE_INFORMATION=`PROFILE_INFORMATION`,e.READ_PRIVATE_CHANNELS=`READ_PRIVATE_CHANNELS`,e}({}),Ow=[Dw.AI,Dw.VIEWS,Dw.UPLOAD_FILE,Dw.DOWNLOAD_FILE,Dw.SEND_EMAIL_TOOL,Dw.CREATE_CALENDAR_EVENT_TOOL,Dw.HTTP_REQUEST_TOOL,Dw.IMPORT_CSV,Dw.EXPORT_CSV,Dw.CONNECTED_ACCOUNTS,Dw.PROFILE_INFORMATION,Dw.CODE_INTERPRETER_TOOL].map(e=>o.r[e]),kw=({roleSignature:e,supersetSignature:t})=>e.length===t.length&&e.every((e,n)=>e===t[n]),Aw=({role:e,superset:t})=>[...xw.filter(n=>{let r=Sw[n];return e[r]&&!t[r]}).map(e=>({type:`ALL_OBJECT_RECORDS`,action:e})),...e.canUpdateAllSettings&&!t.canUpdateAllSettings?[{type:`ALL_SETTINGS`}]:[],...e.canAccessAllTools&&!t.canAccessAllTools?[{type:`ALL_TOOLS`}]:[]],jw=({role:e,superset:t,toolPermissionFlagUniversalIdentifiers:n})=>{let r=new Set([...Ow,...n]),i=new Set(t.permissionFlagUniversalIdentifiers??[]);return[...new Set(e.permissionFlagUniversalIdentifiers??[])].filter(e=>!(r.has(e)?t.canAccessAllTools:t.canUpdateAllSettings)&&!i.has(e)).map(e=>({type:`PERMISSION_FLAG`,permissionFlagUniversalIdentifier:e}))},Mw=({role:e,superset:t})=>[...new Set([...[...e.objectPermissions??[],...t.objectPermissions??[]].map(e=>e.objectUniversalIdentifier),...(t.rowLevelPermissionPredicates??[]).map(e=>e.objectUniversalIdentifier)])].flatMap(n=>{let r=Cw({role:e,objectUniversalIdentifier:n}),i=Cw({role:t,objectUniversalIdentifier:n}),a=xw.filter(e=>r[e]&&!i[e]).map(e=>({type:`OBJECT_RECORDS`,objectUniversalIdentifier:n,action:e})),o=xw.some(e=>r[e]),s=Ew({role:t,objectUniversalIdentifier:n}),c=Ew({role:e,objectUniversalIdentifier:n});return o&&s.length>0&&!kw({roleSignature:c,supersetSignature:s})?[...a,{type:`ROW_LEVEL_RESTRICTION`,objectUniversalIdentifier:n}]:a}),Nw=({role:e,superset:t})=>(t.fieldPermissions??[]).flatMap(t=>{let{objectUniversalIdentifier:n,fieldUniversalIdentifier:r}=t,i=Cw({role:e,objectUniversalIdentifier:n}),a=e.fieldPermissions?.find(e=>e.objectUniversalIdentifier===n&&e.fieldUniversalIdentifier===r),o=t.canReadFieldValue===!1&&i.canReadObjectRecords&&a?.canReadFieldValue!==!1,s=t.canUpdateFieldValue===!1&&i.canUpdateObjectRecords&&a?.canUpdateFieldValue!==!1;return[...o?[{type:`FIELD_VALUE`,objectUniversalIdentifier:n,fieldUniversalIdentifier:r,action:`canReadFieldValue`}]:[],...s?[{type:`FIELD_VALUE`,objectUniversalIdentifier:n,fieldUniversalIdentifier:r,action:`canUpdateFieldValue`}]:[]]}),Pw=({role:e,superset:t,toolPermissionFlagUniversalIdentifiers:n})=>[...Aw({role:e,superset:t}),...jw({role:e,superset:t,toolPermissionFlagUniversalIdentifiers:n}),...Mw({role:e,superset:t}),...Nw({role:e,superset:t})],Fw=({universalIdentifier:e,deprecatedReference:t})=>e??t?.universalIdentifier,Iw=({authorizeLogicFunction:e,callbackLogicFunction:t,...n})=>({...n,authorizeLogicFunctionUniversalIdentifier:Fw({universalIdentifier:n.authorizeLogicFunctionUniversalIdentifier,deprecatedReference:e}),callbackLogicFunctionUniversalIdentifier:Fw({universalIdentifier:n.callbackLogicFunctionUniversalIdentifier,deprecatedReference:t})}),Lw=e=>{let{identifyAccountLogicFunction:t,onConnectLogicFunction:r,onDisconnectLogicFunction:i,...a}=e,o={...a,identifyAccountLogicFunctionUniversalIdentifier:Fw({universalIdentifier:e.identifyAccountLogicFunctionUniversalIdentifier,deprecatedReference:t}),onConnectLogicFunctionUniversalIdentifier:Fw({universalIdentifier:e.onConnectLogicFunctionUniversalIdentifier,deprecatedReference:r}),onDisconnectLogicFunctionUniversalIdentifier:Fw({universalIdentifier:e.onDisconnectLogicFunctionUniversalIdentifier,deprecatedReference:i})};return o.type!==`custom`||!n.t(o.custom)?o:{...o,custom:Iw(o.custom)}},Rw=({connectionProvider:e,...t})=>({...t,connectionProviderUniversalIdentifier:Fw({universalIdentifier:t.connectionProviderUniversalIdentifier,deprecatedReference:e})}),zw=({connectionProvider:e,sendMessageLogicFunction:t,markThreadAsReadLogicFunction:n,...r})=>({...r,connectionProviderUniversalIdentifier:Fw({universalIdentifier:r.connectionProviderUniversalIdentifier,deprecatedReference:e}),sendMessageLogicFunctionUniversalIdentifier:Fw({universalIdentifier:r.sendMessageLogicFunctionUniversalIdentifier,deprecatedReference:t}),markThreadAsReadLogicFunctionUniversalIdentifier:Fw({universalIdentifier:r.markThreadAsReadLogicFunctionUniversalIdentifier,deprecatedReference:n})}),Bw=e=>n.t(e)?{universalIdentifier:e}:void 0,Vw=e=>{let t=Lw(e),r={...t,identifyAccountLogicFunction:Bw(t.identifyAccountLogicFunctionUniversalIdentifier),onConnectLogicFunction:Bw(t.onConnectLogicFunctionUniversalIdentifier),onDisconnectLogicFunction:Bw(t.onDisconnectLogicFunctionUniversalIdentifier)};if(r.type!==`custom`||!n.t(r.custom))return r;let{custom:i}=r;return{...r,custom:{...i,authorizeLogicFunction:Bw(i.authorizeLogicFunctionUniversalIdentifier),callbackLogicFunction:Bw(i.callbackLogicFunctionUniversalIdentifier)}}},Hw=e=>n.t(e)?{universalIdentifier:e}:void 0,Uw=e=>{let t=Rw(e);return{...t,connectionProvider:Hw(t.connectionProviderUniversalIdentifier)}},Ww=e=>n.t(e)?{universalIdentifier:e}:void 0,Gw=e=>{let t=zw(e);return{...t,connectionProvider:Ww(t.connectionProviderUniversalIdentifier),sendMessageLogicFunction:Ww(t.sendMessageLogicFunctionUniversalIdentifier),markThreadAsReadLogicFunction:Ww(t.markThreadAsReadLogicFunctionUniversalIdentifier)}},Kw=({objectConfig:e,applicationUniversalIdentifier:t})=>({name:`name`,label:`Name`,description:`Name`,icon:`IconAbc`,isNullable:!0,defaultValue:null,type:a.a.TEXT,universalIdentifier:a.t({applicationUniversalIdentifier:t,objectUniversalIdentifier:e.universalIdentifier,name:`name`})}),qw=({objectConfig:e,applicationUniversalIdentifier:t})=>{let n=(e.fields??[]).map(e=>e.name),r=[...e.fields??[]],i=Kw({objectConfig:e,applicationUniversalIdentifier:t}),a=hw({fields:e.fields??[],labelIdentifierFieldMetadataUniversalIdentifier:e.labelIdentifierFieldMetadataUniversalIdentifier});return!n.includes(i.name)&&!a&&r.push(i),{objectFields:r}},Jw=({objectConfig:e,applicationUniversalIdentifier:t})=>{let{objectFields:n}=qw({objectConfig:e,applicationUniversalIdentifier:t}),r=e.labelIdentifierFieldMetadataUniversalIdentifier??n.find(e=>e.name===`name`)?.universalIdentifier;return r?{objectManifest:{...e,fields:n.map(mw),labelIdentifierFieldMetadataUniversalIdentifier:r},errors:[]}:{objectManifest:null,errors:[`No label identifier field found for object ${e.nameSingular}. Please add a field with name "name" to your object.`]}},Yw={type:`object`,properties:{}},Xw=e=>{let t={type:`unknown`};switch(e.type){case`string`:t.type=`string`;break;case`number`:case`integer`:t.type=`number`;break;case`boolean`:t.type=`boolean`;break;case`array`:t.type=`array`,e.items&&(t.items=Xw(e.items));break;case`object`:t.type=`object`,e.properties&&(t.properties=Object.fromEntries(Object.entries(e.properties).map(([e,t])=>[e,Xw(t)])));break;case`record`:t.type=`record`;break;case`records`:t.type=`records`;break;default:t.type=`unknown`}return Array.isArray(e.enum)&&(t.enum=e.enum.filter(e=>typeof e==`string`)),e.multiline===!0&&(t.multiline=!0),(0,y.isNonEmptyString)(e.label)&&(t.label=e.label),(0,y.isNonEmptyString)(e.objectUniversalIdentifier)&&(t.objectUniversalIdentifier=e.objectUniversalIdentifier),t},Zw=e=>[Xw(e)],Qw=async e=>{let{getFunctionInputSchema:t}=await Promise.resolve().then(()=>require("./get-function-input-schema-ClPQURr8.cjs")),r=t(e)[0];return r?.type===`object`&&n.t(r.properties)?{type:`object`,properties:r.properties}:Yw},$w=async({logicFunctionConfig:e,sourceCode:t,sourcePath:r})=>{let{handler:i,onJobFailure:a,...o}=e,s=o.toolTriggerSettings&&!o.toolTriggerSettings.inputSchema||o.workflowActionTriggerSettings&&!o.workflowActionTriggerSettings.inputSchema?await Qw(t):null,c=o.toolTriggerSettings?{...o.toolTriggerSettings,inputSchema:o.toolTriggerSettings.inputSchema??s??void 0}:void 0,l=o.workflowActionTriggerSettings?{...o.workflowActionTriggerSettings,inputSchema:o.workflowActionTriggerSettings.inputSchema??(s?Zw(s):void 0)}:void 0;return{...o,...c?{toolTriggerSettings:c}:{},...l?{workflowActionTriggerSettings:l}:{},handlerName:`default.config.handler`,...n.t(a)?{jobFailureHandlerName:`default.config.onJobFailure`}:{},sourceHandlerPath:r,builtHandlerPath:r.replace(/\.tsx?$/,`.mjs`),builtHandlerChecksum:`[default-checksum]`}},eT=({frontComponentConfig:e,sourcePath:t})=>{let{component:n,...r}=e;return{...r,componentName:n.name,sourceComponentPath:t,builtComponentPath:t.replace(/\.tsx?$/,`.mjs`),builtComponentChecksum:``,isHeadless:r.isHeadless??!1}},tT=({roleConfig:e,applicationUniversalIdentifier:t})=>{let{recordsPermissions:r}=e;return n.t(r)?{...e,recordsPermissions:{...r,...n.t(r.objects)?{objects:r.objects.map(n=>({...n,universalIdentifier:n.universalIdentifier??o.o({applicationUniversalIdentifier:t,roleUniversalIdentifier:e.universalIdentifier,objectUniversalIdentifier:n.objectUniversalIdentifier})}))}:{}},permissionFlagUniversalIdentifiers:e.permissionFlagUniversalIdentifiers??[]}:{...e,objectPermissions:(e.objectPermissions??[]).map(n=>({...n,universalIdentifier:n.universalIdentifier??o.o({applicationUniversalIdentifier:t,roleUniversalIdentifier:e.universalIdentifier,objectUniversalIdentifier:n.objectUniversalIdentifier})})),fieldPermissions:(e.fieldPermissions??[]).map(n=>({...n,universalIdentifier:n.universalIdentifier??o.s({applicationUniversalIdentifier:t,roleUniversalIdentifier:e.universalIdentifier,fieldUniversalIdentifier:n.fieldUniversalIdentifier})})),rowLevelPermissionPredicateGroups:e.rowLevelPermissionPredicateGroups??[],rowLevelPermissionPredicates:e.rowLevelPermissionPredicates??[],permissionFlagUniversalIdentifiers:e.permissionFlagUniversalIdentifiers??[]}},nT=[`react`,`react-dom`,`react-dom/client`,`react/jsx-runtime`],rT=[`twenty-ui/primitives/input`,`twenty-ui/primitives/data-display`,`twenty-ui/primitives/feedback`,`twenty-ui/primitives/layout`,`twenty-ui/primitives/navigation`,`twenty-ui/primitives/surfaces`,`twenty-ui/primitives/typography`,`twenty-ui/components/input`,`twenty-ui/icon`,`twenty-ui/theme`,`twenty-ui/style.css`,`twenty-ui/theme-light.css`],iT=[...nT,...rT],aT=({dependencies:e,packageNames:t=[]})=>{let n=new Set([...e,...iT.filter(e=>t.some(t=>e===t||e.startsWith(`${t}/`)))]);return n.has(`react`)&&n.add(`react/jsx-runtime`),[...n].sort()},oT=[`twenty-client-sdk`,`twenty-sdk`],sT=e=>{if(e===void 0)return{errors:[]};if(!Array.isArray(e))return{errors:[`"frontComponentSharedDependencies" in package.json must be an array of package specifiers`]};if(!(0,y.isNonEmptyArray)(e))return{errors:[]};let t=[],n=new Set;for(let r of e){if(!(0,y.isNonEmptyString)(r)){t.push(`"frontComponentSharedDependencies" entries in package.json must be non-empty strings`);continue}if(r.startsWith(`.`)||g.default.posix.isAbsolute(r)||g.default.win32.isAbsolute(r)){t.push(`Shared dependency "${r}" must be a package specifier, not a relative or absolute path`);continue}if(r===`twenty:front-component-shared-dependencies`){t.push(`Shared dependency "${r}" is reserved and cannot be shared`);continue}if(oT.some(e=>r===e||r.startsWith(`${e}/`))){t.push(`Shared dependency "${r}" is already served separately and cannot be shared`);continue}if(n.has(r)){t.push(`Shared dependency "${r}" is declared twice`);continue}n.add(r)}return(0,y.isNonEmptyArray)(t)?{errors:t}:{dependencies:aT({dependencies:[...n]}),errors:[]}},cT=async e=>{let t=v.default.join(e,`package.json`);if(!await u.i(t))return{errors:[]};let{dependencies:r,errors:i}=sT((await u.a(t)).frontComponentSharedDependencies);return n.t(r)?{sharedDependencies:{dependencies:r,builtPath:gw,builtChecksum:null},errors:[]}:{errors:i}},lT=`pageType.isInSidePanel.isDashboardPageLayoutInEditMode.isLayoutCustomizationModeEnabled.favoriteRecordIds.isSelectAll.hasAnySoftDeleteFilterOnView.numberOfSelectedRecords.objectPermissions.selectedRecords.featureFlags.targetObjectReadPermissions.targetObjectWritePermissions.canImpersonate.canAccessFullAdminPanel.objectMetadataItem.objectMetadataLabel.currentView.isDefined.isNonEmptyString.includes.every.everyDefined.everyEquals.some.someDefined.someEquals.none.noneDefined.noneEquals.someNonEmptyString.includesEvery`.split(`.`),uT=`conditionalAvailabilityExpression`,dT=[`twenty-sdk/define`,`twenty-sdk`],fT=new Set(lT),pT=(e,t)=>{let r=[];for(let i of e.statements){if(!_.default.isImportDeclaration(i)||!_.default.isStringLiteral(i.moduleSpecifier)||!dT.includes(i.moduleSpecifier.text))continue;let a=i.importClause;if(!n.t(a)||a.phaseModifier===_.default.SyntaxKind.TypeKeyword)continue;let o=a.namedBindings;if(n.t(o)){if(_.default.isNamespaceImport(o)){let n=t.getSymbolAtLocation(o.name),i=e=>{_.default.isImportDeclaration(e)||_.default.isTypeNode(e)||(_.default.isPropertyAccessExpression(e)&&_.default.isIdentifier(e.expression)&&t.getSymbolAtLocation(e.expression)===n&&fT.has(e.name.text)&&r.push({importedName:e.name.text,node:e}),_.default.forEachChild(e,i))};i(e);continue}if(_.default.isNamedImports(o))for(let i of o.elements){if(i.isTypeOnly)continue;let a=(i.propertyName??i.name).text;if(fT.has(a)){let o=t.getSymbolAtLocation(i.name),s,c=e=>{if(!(n.t(s)||_.default.isImportDeclaration(e)||_.default.isTypeNode(e))){if(_.default.isIdentifier(e)){let r=_.default.isShorthandPropertyAssignment(e.parent)?t.getShorthandAssignmentValueSymbol(e.parent):t.getSymbolAtLocation(e);n.t(o)&&r===o&&(s=e)}_.default.forEachChild(e,c)}};c(e),n.t(s)&&r.push({importedName:a,node:s})}}}}return r},mT=e=>{let t=!1,n=e=>{if(!t){if((_.default.isPropertyAssignment(e)||_.default.isShorthandPropertyAssignment(e))&&(_.default.isIdentifier(e.name)||_.default.isStringLiteral(e.name))&&e.name.text===uT){t=!0;return}_.default.forEachChild(e,n)}};return n(e),t},hT=(e,t)=>{if(!lT.some(t=>e.includes(t)))return[];let n=_.default.createSourceFile(t,e,_.default.ScriptTarget.Latest,!0,t.endsWith(`.tsx`)?_.default.ScriptKind.TSX:_.default.ScriptKind.TS);if(mT(n))return[];let r={noLib:!0,noResolve:!0},i=_.default.createCompilerHost(r);return i.getSourceFile=e=>e===n.fileName?n:void 0,pT(n,_.default.createProgram([n.fileName],r,i).getTypeChecker()).map(({importedName:e,node:r})=>{let{line:i,character:a}=n.getLineAndCharacterOfPosition(r.getStart(n));return`${t}:${i+1}:${a+1} - "${e}" is a conditional-availability expression variable from twenty-sdk but this file has no ${uT}. These variables can only be used inside a command's ${uT}, not at runtime.`})},gT={id:a.a.UUID,createdAt:a.a.DATE_TIME,updatedAt:a.a.DATE_TIME,deletedAt:a.a.DATE_TIME,createdBy:a.a.ACTOR,updatedBy:a.a.ACTOR,position:a.a.POSITION},Q=({objectUniversalIdentifier:e,fields:t,viewFieldNames:n})=>{let r=o.i({objectMetadataApplicationUniversalIdentifier:f.t,objectUniversalIdentifier:e,viewKey:o.a.INDEX});return{universalIdentifier:r,viewFields:Object.fromEntries(n.map(n=>{let i=t[n];if(i===void 0)throw Error(`Missing field "${n}" for the INDEX view of object ${e}`);return[n,{universalIdentifier:vw({fieldMetadataApplicationUniversalIdentifier:f.t,viewUniversalIdentifier:r,fieldMetadataUniversalIdentifier:i.universalIdentifier})}]}))}},$=({objectUniversalIdentifier:e,fields:t,viewFieldNames:n,viewFieldGroupNames:r})=>{let i=o.i({objectMetadataApplicationUniversalIdentifier:f.t,objectUniversalIdentifier:e,viewKey:o.a.FIELDS_WIDGET});return{universalIdentifier:i,viewFields:Object.fromEntries(n.map(n=>{let r=t[n];if(r===void 0)throw Error(`Missing field "${n}" for the record-page view of object ${e}`);return[n,{universalIdentifier:vw({fieldMetadataApplicationUniversalIdentifier:f.t,viewUniversalIdentifier:i,fieldMetadataUniversalIdentifier:r.universalIdentifier})}]})),viewFieldGroups:Object.fromEntries(Object.entries(r).map(([e,t])=>[e,{universalIdentifier:_w({objectMetadataApplicationUniversalIdentifier:f.t,viewUniversalIdentifier:i,name:t})}]))}},_T={attachment:{universalIdentifier:o.n.attachment,fields:o.t.attachment,morphIds:{targetMorphId:{morphId:o.t.attachment.target.universalIdentifier}},indexes:{taskIdIndex:{universalIdentifier:`b8d4f9a3-0c25-4e7b-9f6a-2d3e4c5b6f70`},noteIdIndex:{universalIdentifier:`9d31ea73-13b6-4e06-84ee-c66c72bf7787`},personIdIndex:{universalIdentifier:`55637a5a-1edc-4351-8d76-d40020bf8944`},companyIdIndex:{universalIdentifier:`4137ba06-184d-438f-b484-080f02a97659`},opportunityIdIndex:{universalIdentifier:`8cc162d1-c127-4981-878d-f78622f8f12d`},dashboardIdIndex:{universalIdentifier:`c10eba2d-ff1a-4eab-9285-50481c12a003`},agentChatThreadIdIndex:{universalIdentifier:`69857371-6ff9-48fa-a9de-db4f71593431`},messageIdIndex:{universalIdentifier:`83c77988-2dc4-4575-bac5-f0f50c05568e`}},views:{allAttachments:Q({objectUniversalIdentifier:o.n.attachment,fields:o.t.attachment,viewFieldNames:[`name`,`file`,`createdBy`,`createdAt`,`targetPerson`,`targetCompany`,`targetOpportunity`,`targetTask`,`targetNote`,`targetDashboard`]}),attachmentRecordPageFields:$({objectUniversalIdentifier:o.n.attachment,fields:o.t.attachment,viewFieldNames:[`createdBy`,`createdAt`],viewFieldGroupNames:{}})}},blocklist:{universalIdentifier:o.n.blocklist,fields:o.t.blocklist,indexes:{workspaceMemberIdIndex:{universalIdentifier:`4daf320e-74d0-4f24-a45a-af3a09d741cb`}},views:{allBlocklists:Q({objectUniversalIdentifier:o.n.blocklist,fields:o.t.blocklist,viewFieldNames:[`handle`,`workspaceMember`,`createdAt`]}),blocklistRecordPageFields:$({objectUniversalIdentifier:o.n.blocklist,fields:o.t.blocklist,viewFieldNames:[`workspaceMember`,`createdAt`,`createdBy`],viewFieldGroupNames:{general:`General`,system:`System`}})}},calendarChannelEventAssociation:{universalIdentifier:o.n.calendarChannelEventAssociation,fields:o.t.calendarChannelEventAssociation,indexes:{calendarChannelIdIndex:{universalIdentifier:`ff6b86c1-3112-4dfa-b734-c4789111a716`},calendarEventIdIndex:{universalIdentifier:`47a3c8d2-9f14-4b6e-8c5d-1a2b3f4e5c69`},eventExternalIdIndex:{universalIdentifier:`b14d63d0-c1ab-470f-927d-9c0c05277caa`},accountOwnerIdIndex:{universalIdentifier:`740776d1-fe14-41b9-80b9-11c610765f0c`}},views:{allCalendarChannelEventAssociations:Q({objectUniversalIdentifier:o.n.calendarChannelEventAssociation,fields:o.t.calendarChannelEventAssociation,viewFieldNames:[`calendarChannelId`,`calendarEvent`,`eventExternalId`,`createdAt`]}),calendarChannelEventAssociationRecordPageFields:$({objectUniversalIdentifier:o.n.calendarChannelEventAssociation,fields:o.t.calendarChannelEventAssociation,viewFieldNames:[`calendarChannelId`,`calendarEvent`,`eventExternalId`,`createdAt`,`createdBy`],viewFieldGroupNames:{general:`General`,system:`System`}})}},calendarEventParticipant:{universalIdentifier:o.n.calendarEventParticipant,fields:o.t.calendarEventParticipant,indexes:{calendarEventIdIndex:{universalIdentifier:`c458ad97-8b95-43de-9003-88eb68576049`},personIdIndex:{universalIdentifier:`30e9b75a-881f-4a85-aaf1-f2d2464be1cf`},workspaceMemberIdIndex:{universalIdentifier:`898aa202-428f-4a7a-a3b3-8f0a17a6658e`}},views:{allCalendarEventParticipants:Q({objectUniversalIdentifier:o.n.calendarEventParticipant,fields:o.t.calendarEventParticipant,viewFieldNames:[`calendarEvent`,`handle`,`displayName`,`isOrganizer`,`responseStatus`,`person`,`workspaceMember`,`createdAt`]}),calendarEventParticipantRecordPageFields:$({objectUniversalIdentifier:o.n.calendarEventParticipant,fields:o.t.calendarEventParticipant,viewFieldNames:[`calendarEvent`,`handle`,`displayName`,`isOrganizer`,`responseStatus`,`person`,`workspaceMember`,`createdAt`,`createdBy`],viewFieldGroupNames:{general:`General`,system:`System`}})}},calendarEvent:{universalIdentifier:o.n.calendarEvent,fields:o.t.calendarEvent,indexes:{iCalUidIndex:{universalIdentifier:`e38d1418-f994-4f0d-b0cd-41d4da240ea0`}},views:{allCalendarEvents:Q({objectUniversalIdentifier:o.n.calendarEvent,fields:o.t.calendarEvent,viewFieldNames:[`title`,`startsAt`,`endsAt`,`isFullDay`,`location`,`conferenceLink`,`isCanceled`,`createdAt`]}),calendarEventRecordPageFields:$({objectUniversalIdentifier:o.n.calendarEvent,fields:o.t.calendarEvent,viewFieldNames:[`title`,`startsAt`,`endsAt`,`isFullDay`,`isCanceled`,`conferenceLink`,`location`,`description`,`calendarEventTargets`,`externalCreatedAt`,`externalUpdatedAt`,`iCalUid`,`conferenceSolution`],viewFieldGroupNames:{general:`General`,system:`System`}})}},calendarEventTarget:{universalIdentifier:o.n.calendarEventTarget,fields:o.t.calendarEventTarget,morphIds:{targetMorphId:{morphId:o.t.calendarEventTarget.target.universalIdentifier}},indexes:{calendarEventIdIndex:{universalIdentifier:`ce1c180c-0236-4673-ad1d-359dddf59f93`},personIdIndex:{universalIdentifier:`f151bc84-ba45-40cb-b064-02ef359ac17b`},companyIdIndex:{universalIdentifier:`30413277-505d-4f08-be38-a56257460f9f`},opportunityIdIndex:{universalIdentifier:`7920092d-281f-473a-8ea4-53c209b36a37`},calendarEventPersonUniqueIndex:{universalIdentifier:`15b9e394-d451-4186-aaf0-612f6be1ea91`},calendarEventCompanyUniqueIndex:{universalIdentifier:`3fa22398-6e7d-47a5-95eb-4971f9d62135`},calendarEventOpportunityUniqueIndex:{universalIdentifier:`c8183b17-5dfe-4e02-8d9d-aef8e54ef07d`}},views:{}},callRecording:{universalIdentifier:o.n.callRecording,fields:o.t.callRecording,indexes:{calendarEventIdIndex:{universalIdentifier:`8be3cc47-9352-4a1b-ad19-bb186bc0865d`}},views:{allCallRecordings:Q({objectUniversalIdentifier:o.n.callRecording,fields:o.t.callRecording,viewFieldNames:[`status`,`recordingRequestStatus`,`title`,`startedAt`]}),callRecordingRecordPageFields:$({objectUniversalIdentifier:o.n.callRecording,fields:o.t.callRecording,viewFieldNames:[`title`,`status`,`recordingRequestStatus`,`startedAt`,`endedAt`,`video`,`audio`,`transcript`,`summary`],viewFieldGroupNames:{general:`General`}})}},company:{universalIdentifier:o.n.company,fields:o.t.company,indexes:{accountOwnerIdIndex:{universalIdentifier:`ec2ebfc9-0c9b-4597-a87d-aa295e2d8bfe`},domainNameUniqueIndex:{universalIdentifier:`dd300c61-f422-467a-91f4-de4f83c4175b`},searchVectorGinIndex:{universalIdentifier:`c3eb62df-2cc1-4cc3-b7aa-e96a4d65c633`}},views:{allCompanies:Q({objectUniversalIdentifier:o.n.company,fields:o.t.company,viewFieldNames:[`name`,`domainName`,`createdBy`,`accountOwner`,`createdAt`,`linkedinLink`,`address`]}),companyRecordPageFields:$({objectUniversalIdentifier:o.n.company,fields:o.t.company,viewFieldNames:[`domainName`,`accountOwner`,`annualRevenue`,`linkedinLink`,`address`,`createdAt`,`createdBy`,`updatedAt`,`updatedBy`,`people`,`taskTargets`,`noteTargets`,`opportunities`,`attachments`,`timelineActivities`],viewFieldGroupNames:{general:`General`,business:`Business`,contact:`Contact`,system:`System`}})}},dashboard:{universalIdentifier:o.n.dashboard,fields:o.t.dashboard,indexes:{searchVectorGinIndex:{universalIdentifier:`e69f71aa-de0f-4b70-845f-7a8369c47928`}},views:{allDashboards:Q({objectUniversalIdentifier:o.n.dashboard,fields:o.t.dashboard,viewFieldNames:[`title`,`createdBy`,`createdAt`,`updatedAt`]})}},messageCampaign:{universalIdentifier:o.n.messageCampaign,fields:o.t.messageCampaign,indexes:{unsubscribeTopicIdIndex:{universalIdentifier:`efe8c20e-d12b-4475-969e-e86e0bbfe444`},listIdIndex:{universalIdentifier:`17bffd6a-714a-458d-a547-f9e2183d9520`},searchVectorGinIndex:{universalIdentifier:`975823ad-9b97-4f39-b2c7-fbd7d77f4bd1`}},views:{allMessageCampaigns:Q({objectUniversalIdentifier:o.n.messageCampaign,fields:o.t.messageCampaign,viewFieldNames:[`name`,`subject`,`status`,`list`,`fromAddress`,`scheduledAt`,`sentAt`,`recipients`,`createdAt`]}),messageCampaignList:{universalIdentifier:`99ca5417-e5e0-4fd4-8e64-67acd7b21e25`,viewFields:{name:{universalIdentifier:`fcda0c3b-7ee3-40dd-b280-da3ff4da5452`},subject:{universalIdentifier:`700087d2-bd10-4ab9-b8a9-b0710146927c`},status:{universalIdentifier:`ff29b192-5a52-42a1-8a1e-1a03d26f5464`},list:{universalIdentifier:`8e28bc70-eaa0-4768-bb13-606571e65ac8`},fromAddress:{universalIdentifier:`b9798ecc-de06-4717-8b42-057181437dbc`},scheduledAt:{universalIdentifier:`caba5417-964d-416c-a5a9-b64ef71e5964`},sentAt:{universalIdentifier:`9d546249-b029-4b01-8389-65a88ae583c8`},recipients:{universalIdentifier:`e065a2d1-1352-4869-b527-58e3c37557c0`},createdAt:{universalIdentifier:`27548f0a-5ed4-4412-b23a-718b99eb697e`}}},messageCampaignRecordPageFields:$({objectUniversalIdentifier:o.n.messageCampaign,fields:o.t.messageCampaign,viewFieldNames:[`status`,`scheduledAt`,`sentAt`,`sentCount`,`deliveredCount`,`failedCount`,`skippedCount`,`bouncedCount`,`complainedCount`,`uniqueClickCount`,`clickRate`,`uniqueOpenCount`,`openRate`],viewFieldGroupNames:{stats:`Stats`}})}},messageList:{universalIdentifier:o.n.messageList,fields:o.t.messageList,indexes:{searchVectorGinIndex:{universalIdentifier:`8e205171-ed74-4620-b7d2-674aab85033a`}},views:{allMessageLists:Q({objectUniversalIdentifier:o.n.messageList,fields:o.t.messageList,viewFieldNames:[`name`,`description`,`members`,`campaigns`,`createdAt`]})}},messageListMember:{universalIdentifier:o.n.messageListMember,fields:o.t.messageListMember,indexes:{listIdIndex:{universalIdentifier:`61188470-6dcb-4b2a-b1a9-baeb688bccae`},personListUniqueIndex:{universalIdentifier:`e5497dc2-1d72-418c-a389-a0645ca0195a`}},views:{allMessageListMembers:Q({objectUniversalIdentifier:o.n.messageListMember,fields:o.t.messageListMember,viewFieldNames:[`id`,`person`,`list`,`createdAt`]})}},messageChannelMessageAssociation:{universalIdentifier:o.n.messageChannelMessageAssociation,fields:o.t.messageChannelMessageAssociation,indexes:{messageChannelIdIndex:{universalIdentifier:`9894f9a3-0225-4e7b-9f6a-23d4e2576784`},messageIdIndex:{universalIdentifier:`9bb24d40-60dd-4beb-8c64-a74e8c67f9ee`},messageChannelIdMessageIdUniqueIndex:{universalIdentifier:`1b86ece8-7ce3-4df3-8771-fd4b5d45b2f2`},accountOwnerIdIndex:{universalIdentifier:`0797b417-8f87-4df1-b838-d85fbb663110`}},views:{allMessageChannelMessageAssociations:Q({objectUniversalIdentifier:o.n.messageChannelMessageAssociation,fields:o.t.messageChannelMessageAssociation,viewFieldNames:[`messageChannelId`,`message`,`messageExternalId`,`direction`,`createdAt`]}),messageChannelMessageAssociationRecordPageFields:$({objectUniversalIdentifier:o.n.messageChannelMessageAssociation,fields:o.t.messageChannelMessageAssociation,viewFieldNames:[`messageChannelId`,`message`,`messageExternalId`,`direction`,`createdAt`,`createdBy`],viewFieldGroupNames:{general:`General`,system:`System`}})}},messageChannelMessageAssociationMessageFolder:{universalIdentifier:o.n.messageChannelMessageAssociationMessageFolder,fields:o.t.messageChannelMessageAssociationMessageFolder,indexes:{messageChannelMessageAssociationIdIndex:{universalIdentifier:`8e6038aa-1f79-4a84-87b5-f33caa172e98`},messageFolderIdIndex:{universalIdentifier:`905299c3-ca81-435d-901c-f68b87562516`},messageChannelMessageAssociationIdMessageFolderIdUniqueIndex:{universalIdentifier:`a3de1788-5dff-4849-ac5a-0dabe5fab216`}},views:{allMessageChannelMessageAssociationMessageFolders:Q({objectUniversalIdentifier:o.n.messageChannelMessageAssociationMessageFolder,fields:o.t.messageChannelMessageAssociationMessageFolder,viewFieldNames:[`messageChannelMessageAssociation`,`messageFolderId`,`createdAt`]}),messageChannelMessageAssociationMessageFolderRecordPageFields:$({objectUniversalIdentifier:o.n.messageChannelMessageAssociationMessageFolder,fields:o.t.messageChannelMessageAssociationMessageFolder,viewFieldNames:[`messageChannelMessageAssociation`,`messageFolderId`,`createdAt`,`createdBy`],viewFieldGroupNames:{general:`General`,system:`System`}})}},messageParticipant:{universalIdentifier:o.n.messageParticipant,fields:o.t.messageParticipant,indexes:{messageIdIndex:{universalIdentifier:`ab0863ba-f95e-493c-b86c-56e1bc7e5bc2`},personIdIndex:{universalIdentifier:`df805c2e-3bfe-4d51-8309-75e5eb4052fe`},workspaceMemberIdIndex:{universalIdentifier:`ce1e3a9e-afe9-439d-abb7-6cc98a6fa405`},messageCampaignIdIndex:{universalIdentifier:`e9bcdd77-cc8b-4532-833c-124dfdc8e5ff`}},views:{allMessageParticipants:Q({objectUniversalIdentifier:o.n.messageParticipant,fields:o.t.messageParticipant,viewFieldNames:[`message`,`role`,`handle`,`displayName`,`person`,`workspaceMember`,`createdAt`]}),messageParticipantRecordPageFields:$({objectUniversalIdentifier:o.n.messageParticipant,fields:o.t.messageParticipant,viewFieldNames:[`message`,`role`,`displayName`,`person`,`workspaceMember`,`createdAt`,`createdBy`],viewFieldGroupNames:{general:`General`,system:`System`}})}},messageThread:{universalIdentifier:o.n.messageThread,fields:o.t.messageThread,indexes:{},views:{allMessageThreads:Q({objectUniversalIdentifier:o.n.messageThread,fields:o.t.messageThread,viewFieldNames:[`subject`,`messages`,`updatedAt`,`createdAt`]})}},messageThreadTarget:{universalIdentifier:o.n.messageThreadTarget,fields:o.t.messageThreadTarget,morphIds:{targetMorphId:{morphId:o.t.messageThreadTarget.target.universalIdentifier}},indexes:{messageThreadIdIndex:{universalIdentifier:`222fdd8b-0863-4f2a-816a-29745537b6b6`},personIdIndex:{universalIdentifier:`280ee419-ac3c-4599-bd62-3e5cb268342c`},companyIdIndex:{universalIdentifier:`b98005e4-3811-41b6-82d0-3ccd27757eba`},opportunityIdIndex:{universalIdentifier:`7679ee05-cf6c-40a7-9ee6-c3e8053caca5`},messageThreadPersonUniqueIndex:{universalIdentifier:`087f97cb-8c3c-4ea1-9556-933acde6c83b`},messageThreadCompanyUniqueIndex:{universalIdentifier:`30d4f1af-8b6f-4685-802f-8a7cf29f318b`},messageThreadOpportunityUniqueIndex:{universalIdentifier:`1dc0e37e-afb1-4e90-90b4-052374126a6a`}},views:{}},message:{universalIdentifier:o.n.message,fields:o.t.message,indexes:{messageThreadIdIndex:{universalIdentifier:`7a05b45e-7aa6-4a7e-9bbc-299cbed53c96`},messageCampaignIdIndex:{universalIdentifier:`79e777ca-7008-46c5-b3a6-3108b7c7dfb6`},headerMessageIdIndex:{universalIdentifier:`0904b3e4-6052-4a8d-bf41-f12a27c7e34a`}},views:{allMessages:Q({objectUniversalIdentifier:o.n.message,fields:o.t.message,viewFieldNames:[`subject`,`messageThread`,`messageParticipants`,`receivedAt`,`headerMessageId`,`text`,`createdAt`]}),messageRecordPageFields:$({objectUniversalIdentifier:o.n.message,fields:o.t.message,viewFieldNames:[`messageThread`,`messageParticipants`,`receivedAt`,`text`,`headerMessageId`,`createdAt`,`createdBy`],viewFieldGroupNames:{general:`General`,system:`System`}})}},note:{universalIdentifier:o.n.note,fields:o.t.note,indexes:{searchVectorGinIndex:{universalIdentifier:`8183c8d2-9114-4b6e-8c5d-12a3b14a5a13`}},views:{allNotes:Q({objectUniversalIdentifier:o.n.note,fields:o.t.note,viewFieldNames:[`title`,`noteTargets`,`bodyV2`,`createdBy`,`createdAt`]}),noteRecordPageFields:$({objectUniversalIdentifier:o.n.note,fields:o.t.note,viewFieldNames:[`noteTargets`,`attachments`,`timelineActivities`],viewFieldGroupNames:{general:`General`}})}},noteTarget:{universalIdentifier:o.n.noteTarget,fields:o.t.noteTarget,morphIds:{targetMorphId:{morphId:o.t.noteTarget.target.universalIdentifier}},indexes:{noteIdIndex:{universalIdentifier:`9294d9e3-0225-4c7f-9d6e-23b4c25b6b24`},personIdIndex:{universalIdentifier:`7c069dc0-e83b-4cd5-aaa2-cac7f3e00d80`},companyIdIndex:{universalIdentifier:`2d83909a-a383-4e82-b00a-8b7739f3f906`},opportunityIdIndex:{universalIdentifier:`0d1a59b4-cc87-4b7d-804a-656e8504f371`},notePersonUniqueIndex:{universalIdentifier:`29be76d1-ff4f-4f0f-b05c-f679a234e90a`},noteCompanyUniqueIndex:{universalIdentifier:`e3b92659-04cf-4496-8fd4-4f32c747c26a`},noteOpportunityUniqueIndex:{universalIdentifier:`58002741-8aa7-4812-b7af-f4cf98dd2433`}},views:{allNoteTargets:Q({objectUniversalIdentifier:o.n.noteTarget,fields:o.t.noteTarget,viewFieldNames:[`id`,`note`,`targetPerson`,`targetCompany`,`targetOpportunity`]})}},opportunity:{universalIdentifier:o.n.opportunity,fields:o.t.opportunity,indexes:{pointOfContactIdIndex:{universalIdentifier:`b8c2a673-a981-4357-a43d-313a358e4daa`},companyIdIndex:{universalIdentifier:`e161072d-37b1-477a-b944-ef0d65289574`},stageIndex:{universalIdentifier:`ae60d580-b562-44f2-a24d-7b8040063f83`},searchVectorGinIndex:{universalIdentifier:`f53fdd28-a26b-47ba-81b5-6813ad622720`}},views:{allOpportunities:Q({objectUniversalIdentifier:o.n.opportunity,fields:o.t.opportunity,viewFieldNames:[`name`,`amount`,`createdBy`,`closeDate`,`company`,`pointOfContact`]}),byStage:{universalIdentifier:`20202020-a004-4a04-8a04-0aa0b1ca1ba0`,viewFields:{name:{universalIdentifier:`20202020-af04-4a04-8a04-0aa0b2ca2baf`},amount:{universalIdentifier:`20202020-af04-4a04-8a04-0aa0b2ca2bb0`},createdBy:{universalIdentifier:`20202020-af04-4a04-8a04-0aa0b2ca2bb1`},closeDate:{universalIdentifier:`20202020-af04-4a04-8a04-0aa0b2ca2bb2`},company:{universalIdentifier:`20202020-af04-4a04-8a04-0aa0b2ca2bb3`},pointOfContact:{universalIdentifier:`20202020-af04-4a04-8a04-0aa0b2ca2bb4`}},viewGroups:{new:{universalIdentifier:`20202020-af14-4a04-8a04-0aa0b2ca2bf1`},screening:{universalIdentifier:`20202020-af14-4a04-8a04-0aa0b2ca2bf2`},meeting:{universalIdentifier:`20202020-af14-4a04-8a04-0aa0b2ca2bf3`},proposal:{universalIdentifier:`20202020-af14-4a04-8a04-0aa0b2ca2bf4`},customer:{universalIdentifier:`20202020-af14-4a04-8a04-0aa0b2ca2bf5`}}},opportunityRecordPageFields:$({objectUniversalIdentifier:o.n.opportunity,fields:o.t.opportunity,viewFieldNames:[`amount`,`closeDate`,`stage`,`company`,`pointOfContact`,`owner`,`createdAt`,`createdBy`,`updatedAt`,`updatedBy`,`taskTargets`,`noteTargets`,`attachments`,`timelineActivities`],viewFieldGroupNames:{deal:`Deal`,relations:`Relations`,system:`System`}})}},person:{universalIdentifier:o.n.person,fields:o.t.person,indexes:{companyIdIndex:{universalIdentifier:`8a265a5c-d3ae-47dc-bdf9-b42cfa2ba639`},emailsUniqueIndex:{universalIdentifier:`8183a8b2-9114-4f6c-8a5b-12e3f14e5e13`},searchVectorGinIndex:{universalIdentifier:`9294b9c3-0225-4a7d-9b6c-23f4a25f6f24`}},views:{allPeople:Q({objectUniversalIdentifier:o.n.person,fields:o.t.person,viewFieldNames:[`name`,`emails`,`createdBy`,`company`,`phones`,`createdAt`,`jobTitle`,`linkedinLink`]}),personRecordPageFields:$({objectUniversalIdentifier:o.n.person,fields:o.t.person,viewFieldNames:[`emails`,`phones`,`company`,`jobTitle`,`linkedinLink`,`avatarUrl`,`createdAt`,`createdBy`,`updatedAt`,`updatedBy`,`avatarFile`,`pointOfContactForOpportunities`,`taskTargets`,`noteTargets`,`attachments`,`messageParticipants`,`calendarEventParticipants`,`timelineActivities`],viewFieldGroupNames:{general:`General`,work:`Work`,social:`Social`,system:`System`}}),messageListRecordPageMembers:{universalIdentifier:`bef79e8e-9ef3-4458-81ed-78a299e2566f`,viewFields:{name:{universalIdentifier:`a4f0d7b4-3956-44a6-8bb2-df45a699609b`},emails:{universalIdentifier:`180e9cbb-34c2-4e27-8648-2915be88a50e`},company:{universalIdentifier:`3db54119-df4d-449b-91c9-22fca1e5d599`}},viewFilters:{listMembershipsListIsCurrentRecord:{universalIdentifier:`256dceea-a9b5-42b7-8461-a6ce62e7fa6c`}}}}},accessGroup:{universalIdentifier:o.n.accessGroup,fields:o.t.accessGroup,indexes:{roleIdIndex:{universalIdentifier:`933f2eee-0856-46fd-b144-ffd4bad7e9c8`},groupHashUniqueIndex:{universalIdentifier:`dcb0d254-43ae-442e-9223-8ac052eddb28`},objectMetadataIdIndex:{universalIdentifier:`60e48c2a-a3db-4f11-b25b-49c7e8a385bc`}},views:{}},recordShare:{universalIdentifier:o.n.recordShare,fields:o.t.recordShare,indexes:{recordPrincipalCauseSourceUniqueIndex:{universalIdentifier:`4580f104-47a7-4110-87a8-26cb6f63ce7b`},principalIdIndex:{universalIdentifier:`66fbc3d2-6126-4e29-a306-dbe9995bf062`},sourceIdIndex:{universalIdentifier:`21b84593-c647-40ce-bdf4-a8b4ac658f57`}},views:{}},shortLink:{universalIdentifier:o.n.shortLink,fields:o.t.shortLink,indexes:{templateAndResolvedUrlHashUniqueIndex:{universalIdentifier:`b1330e3c-bd74-4bd1-a9dc-1ecefe41f199`}},views:{}},task:{universalIdentifier:o.n.task,fields:o.t.task,indexes:{assigneeIdIndex:{universalIdentifier:`f48fa3b1-0cec-44da-a9e5-f8a5e766637e`},searchVectorGinIndex:{universalIdentifier:`a86b32b3-01d3-4302-a152-8b7f247db7b4`}},views:{allTasks:Q({objectUniversalIdentifier:o.n.task,fields:o.t.task,viewFieldNames:[`title`,`status`,`taskTargets`,`createdBy`,`dueAt`,`assignee`,`bodyV2`,`createdAt`]}),assignedToMe:{universalIdentifier:`20202020-a007-4a07-8a07-ba5ca551aaed`,viewFields:{title:{universalIdentifier:`20202020-af07-4a07-8a07-ba5ca551aaed`},taskTargets:{universalIdentifier:`20202020-af07-4a07-8a07-ba5ca551aaee`},createdBy:{universalIdentifier:`20202020-af07-4a07-8a07-ba5ca551aaef`},dueAt:{universalIdentifier:`20202020-af07-4a07-8a07-ba5ca551aaf0`},assignee:{universalIdentifier:`20202020-af07-4a07-8a07-ba5ca551aaf1`},bodyV2:{universalIdentifier:`20202020-af07-4a07-8a07-ba5ca551aaf2`},createdAt:{universalIdentifier:`20202020-af07-4a07-8a07-ba5ca551aaf3`}},viewFilters:{assigneeIsMe:{universalIdentifier:`20202020-af17-4a07-8a07-ba5ca551abf1`}},viewGroups:{todo:{universalIdentifier:`20202020-af17-4a07-8a07-ba5ca551abf2`},inProgress:{universalIdentifier:`20202020-af17-4a07-8a07-ba5ca551abf3`},done:{universalIdentifier:`20202020-af17-4a07-8a07-ba5ca551abf4`},empty:{universalIdentifier:`20202020-af17-4a07-8a07-ba5ca551abf5`}}},byStatus:{universalIdentifier:`20202020-a008-4a08-8a08-ba5cba51aba5`,viewFields:{title:{universalIdentifier:`20202020-af08-4a08-8a08-ba5cba5babf0`},status:{universalIdentifier:`20202020-af08-4a08-8a08-ba5cba5babf1`},dueAt:{universalIdentifier:`20202020-af08-4a08-8a08-ba5cba5babf2`},assignee:{universalIdentifier:`20202020-af08-4a08-8a08-ba5cba5babf3`},createdAt:{universalIdentifier:`20202020-af08-4a08-8a08-ba5cba5babf4`}},viewGroups:{todo:{universalIdentifier:`20202020-af18-4a08-8a08-ba5cba5bbf01`},inProgress:{universalIdentifier:`20202020-af18-4a08-8a08-ba5cba5bbf02`},done:{universalIdentifier:`20202020-af18-4a08-8a08-ba5cba5bbf03`}}},taskRecordPageFields:$({objectUniversalIdentifier:o.n.task,fields:o.t.task,viewFieldNames:[`dueAt`,`status`,`assignee`,`taskTargets`,`attachments`,`timelineActivities`],viewFieldGroupNames:{general:`General`}})}},taskTarget:{universalIdentifier:o.n.taskTarget,fields:o.t.taskTarget,morphIds:{targetMorphId:{morphId:o.t.taskTarget.target.universalIdentifier}},indexes:{taskIdIndex:{universalIdentifier:`c882f7a4-b025-4d32-aa26-5ef2595bdbf9`},personIdIndex:{universalIdentifier:`b7d305d1-6fae-4ed6-9bdc-354fe9032c0e`},companyIdIndex:{universalIdentifier:`c0af54c7-751b-4bb2-b102-677cc4e47402`},opportunityIdIndex:{universalIdentifier:`6942e0ba-90f6-4c33-bf40-7f00b1ec35ab`},taskPersonUniqueIndex:{universalIdentifier:`4adf4d5a-ad69-4c5c-bc62-2807816b3aa8`},taskCompanyUniqueIndex:{universalIdentifier:`637dce5e-f609-49f4-89e3-c0ef9e330d3a`},taskOpportunityUniqueIndex:{universalIdentifier:`eb5422ff-7a41-48d2-a2df-3de1cbf7bced`}},views:{allTaskTargets:Q({objectUniversalIdentifier:o.n.taskTarget,fields:o.t.taskTarget,viewFieldNames:[`id`,`task`,`targetPerson`,`targetCompany`,`targetOpportunity`]})}},timelineActivity:{universalIdentifier:o.n.timelineActivity,fields:o.t.timelineActivity,morphIds:{targetMorphId:{morphId:o.t.timelineActivity.target.universalIdentifier}},indexes:{workspaceMemberIdIndex:{universalIdentifier:`5e0b2391-85ca-4a66-aef4-52d74245bec2`},personIdIndex:{universalIdentifier:`3e89a914-7bec-47bd-9cf9-743c6b83d001`},companyIdIndex:{universalIdentifier:`8183e8f2-9114-4d6a-8e5f-12c3d14c5c13`},opportunityIdIndex:{universalIdentifier:`9294f9a3-0225-4e7b-9f6a-23d4e25d6d24`},noteIdIndex:{universalIdentifier:`995db1d8-0d3e-40f7-b0eb-5e6897bc9966`},taskIdIndex:{universalIdentifier:`609cf622-86ef-48d1-812b-e1cab610a46c`},workflowRunIdIndex:{universalIdentifier:`1a2bd046-7c23-4e0a-9f8a-c3ca3a16d3b9`},dashboardIdIndex:{universalIdentifier:`e8821da9-728d-470a-bf5b-5a981fff7880`},messageListIdIndex:{universalIdentifier:`a251f71a-c698-4526-8817-0e7c803c158e`},messageCampaignIdIndex:{universalIdentifier:`e808e721-91cc-4b9b-b24b-806d64b4d5e2`},linkedRecordIdIndex:{universalIdentifier:`00e9bf50-0e98-4105-8cb7-31c94995ff55`}},views:{allTimelineActivities:Q({objectUniversalIdentifier:o.n.timelineActivity,fields:o.t.timelineActivity,viewFieldNames:[`linkedRecordCachedName`,`happensAt`,`workspaceMember`,`targetPerson`,`targetCompany`,`targetOpportunity`,`targetTask`,`targetNote`,`targetWorkflowRun`,`targetDashboard`]})}},workflowRun:{universalIdentifier:o.n.workflowRun,fields:o.t.workflowRun,indexes:{coreWorkflowIdCreatedAtIndex:{universalIdentifier:`5f16fa40-7dd4-4a30-8331-9ad4a106f6be`},searchVectorGinIndex:{universalIdentifier:`e0ac5ad2-d0c8-4f72-b710-8e53b9dc18d9`}},views:{allWorkflowRuns:Q({objectUniversalIdentifier:o.n.workflowRun,fields:o.t.workflowRun,viewFieldNames:[`name`,`coreWorkflowId`,`status`]}),workflowRunRecordPageFields:$({objectUniversalIdentifier:o.n.workflowRun,fields:o.t.workflowRun,viewFieldNames:[`status`,`coreWorkflowId`,`startedAt`,`endedAt`,`createdAt`,`createdBy`,`enqueuedAt`,`state`,`updatedAt`,`updatedBy`,`timelineActivities`],viewFieldGroupNames:{general:`General`,system:`System`}})}},workspaceMember:{universalIdentifier:o.n.workspaceMember,fields:o.t.workspaceMember,indexes:{userEmailUniqueIndex:{universalIdentifier:`76da5f27-523c-44b6-ad06-12954f6b949f`},searchVectorGinIndex:{universalIdentifier:`8678dde9-a804-4a9e-80e3-9af35e471ec5`}},views:{workspaceMemberRecordPageFields:$({objectUniversalIdentifier:o.n.workspaceMember,fields:o.t.workspaceMember,viewFieldNames:[`userEmail`,`jobTitle`,`createdAt`,`updatedAt`,`assignedTasks`,`accountOwnerForCompanies`,`ownedOpportunities`],viewFieldGroupNames:{general:`General`,system:`System`,relations:`Relations`}}),allWorkspaceMembers:Q({objectUniversalIdentifier:o.n.workspaceMember,fields:o.t.workspaceMember,viewFieldNames:[`name`,`createdAt`,`ownedOpportunities`,`assignedTasks`]})}},agentChatThread:{universalIdentifier:o.n.agentChatThread,fields:o.t.agentChatThread,indexes:{directMessagePairUniqueIndex:{universalIdentifier:`365c5b24-cd52-4ebc-98d2-23c5684216d5`},workspaceMemberIndex:{universalIdentifier:`079f2dd7-6c11-4eae-be8a-cce2d1bee0fb`},assigneeIndex:{universalIdentifier:`a65524f8-c999-448b-b9f4-c9ecce15fd13`},channelLastActivityIndex:{universalIdentifier:`bd129bd1-db66-4c74-a64e-819d2edd3062`}}},agentChatThreadParticipant:{universalIdentifier:o.n.agentChatThreadParticipant,fields:o.t.agentChatThreadParticipant,indexes:{threadWorkspaceMemberUniqueIndex:{universalIdentifier:`e5bbe244-cf74-49a3-938a-e6fff7a8710b`},workspaceMemberIndex:{universalIdentifier:`73d8bb5d-18eb-47bb-89e6-12d8f89aecf6`}}},agentChatThreadTarget:{universalIdentifier:o.n.agentChatThreadTarget,fields:o.t.agentChatThreadTarget,morphIds:{targetMorphId:{morphId:o.t.agentChatThreadTarget.target.universalIdentifier}},indexes:{threadIdIndex:{universalIdentifier:`19291d2c-15ab-43a0-91f7-1694b34813dd`},personIdIndex:{universalIdentifier:`fe9c48d0-5b2a-4a51-bd47-f9205ea0c09d`},companyIdIndex:{universalIdentifier:`ab45593a-3614-41c8-aab1-20aa91f1095c`},opportunityIdIndex:{universalIdentifier:`b68e2031-73c6-4bc4-b062-5f795539e452`},threadPersonUniqueIndex:{universalIdentifier:`5a12050f-4de2-4076-aecc-959b863e14b2`},threadCompanyUniqueIndex:{universalIdentifier:`d9067628-fd16-4843-955b-5fd47fea52a9`},threadOpportunityUniqueIndex:{universalIdentifier:`1b9bec10-2788-40be-9435-44937b9f7018`}},views:{}},agentTurn:{universalIdentifier:o.n.agentTurn,fields:o.t.agentTurn,indexes:{agentIndex:{universalIdentifier:`606e8ba3-f322-426b-bef8-2208f67a541a`},agentIdCreatedAtIndex:{universalIdentifier:`39fbc85e-22ec-4279-8c67-f3f0850b68c9`},threadIndex:{universalIdentifier:`7d351559-4546-4307-ba28-de9fc4c40ef4`}}},agentMessage:{universalIdentifier:o.n.agentMessage,fields:o.t.agentMessage,indexes:{agentIndex:{universalIdentifier:`465b20e1-d4cd-4d80-a85b-78bd1f0e70ad`},threadIndex:{universalIdentifier:`2054f1a5-554f-42ac-a41a-b8ccd6ba72ec`},turnIndex:{universalIdentifier:`dc46f804-a55f-4283-884e-9cb938741da3`},senderWorkspaceMemberIndex:{universalIdentifier:`8ecdac01-7bbe-411e-8461-6ff265c90759`}}},agentMessageReaction:{universalIdentifier:o.n.agentMessageReaction,fields:o.t.agentMessageReaction,indexes:{messageWorkspaceMemberEmojiUniqueIndex:{universalIdentifier:`4089a239-e2d0-4e3e-83e8-e9b555a8a31d`},workspaceMemberIndex:{universalIdentifier:`565d89ab-2c11-4ebe-aaaf-8dbc4d79a9e5`}}},agentMessagePart:{universalIdentifier:o.n.agentMessagePart,fields:o.t.agentMessagePart,indexes:{messageOrderIndex:{universalIdentifier:`f5a08f6f-cf91-4996-9c21-2af64a17ca83`}}},campaignDelivery:{universalIdentifier:o.n.campaignDelivery,fields:o.t.campaignDelivery,indexes:{campaignPersonUniqueIndex:{universalIdentifier:`8d719548-d34f-4891-bbc9-e0e09f0e363b`},expiredClaimIndex:{universalIdentifier:`a4d7e8ed-0008-4f6a-a20c-a2b821487481`},countsIndex:{universalIdentifier:`1ea1ae7a-158f-436a-95a0-e9c998ad94f7`},claimTokenIndex:{universalIdentifier:`91640dcd-3f6b-4378-b284-bb02cc8b81ec`},providerMessageIdUniqueIndex:{universalIdentifier:`4de6f73d-ef3a-4c80-b71a-88739213f1c0`}}},messageSuppression:{universalIdentifier:o.n.messageSuppression,fields:o.t.messageSuppression,indexes:{emailAddressTopicUniqueIndex:{universalIdentifier:`a6c1f4dc-d925-49f9-8205-3e7f95545966`}}}},vT={canReadObjectRecords:`read`,canUpdateObjectRecords:`update`,canSoftDeleteObjectRecords:`soft-delete`,canDestroyObjectRecords:`destroy`},yT=e=>{let t=new Map;for(let[n,r]of Object.entries(e))t.has(r)||t.set(r,n);return t},bT=Object.fromEntries(Object.entries(_T).map(([e,{universalIdentifier:t}])=>[t,e])),xT=({grant:e,objects:t,permissionFlags:n,systemPermissionFlagNameByUniversalIdentifier:r})=>{let i=e=>t.find(t=>t.universalIdentifier===e)?.nameSingular??bT[e]??e;switch(e.type){case`ALL_OBJECT_RECORDS`:return`${vT[e.action]} all object records`;case`ALL_SETTINGS`:return`update all settings`;case`ALL_TOOLS`:return`access all tools`;case`PERMISSION_FLAG`:return`permission flag ${n.find(t=>t.universalIdentifier===e.permissionFlagUniversalIdentifier)?.key??r.get(e.permissionFlagUniversalIdentifier)??e.permissionFlagUniversalIdentifier}`;case`OBJECT_RECORDS`:return`${vT[e.action]} ${i(e.objectUniversalIdentifier)} records`;case`FIELD_VALUE`:return`${e.action===`canReadFieldValue`?`read`:`update`} field ${e.fieldUniversalIdentifier} of ${i(e.objectUniversalIdentifier)}`;case`ROW_LEVEL_RESTRICTION`:return`${i(e.objectUniversalIdentifier)} records without the row-level restriction`}},ST=e=>e.map(e=>`"${e}"`).join(`, `),CT=({agents:e,defaultRoleUniversalIdentifier:t})=>{let r=new Map;for(let i of e)!n.t(i.roleUniversalIdentifier)||i.roleUniversalIdentifier===t||r.set(i.roleUniversalIdentifier,[...r.get(i.roleUniversalIdentifier)??[],i.name]);return r},wT=({agentNamesByRoleUniversalIdentifier:e,roles:t})=>[...e].filter(([e])=>!t.some(t=>t.universalIdentifier===e)).map(([e,t])=>`Agent ${ST(t)} references role "${e}", which is not defined by this application.`),TT=({agentNamesByRoleUniversalIdentifier:e,applicationRole:t,roles:r,objects:i,permissionFlags:a,systemPermissionFlagNameByUniversalIdentifier:o})=>{let s=a.filter(e=>(e.permissionType??`tool`)===`tool`).map(e=>e.universalIdentifier);return[...e].flatMap(([e,c])=>{let l=r.find(t=>t.universalIdentifier===e);if(!n.t(l))return[];let u=Pw({role:l,superset:t,toolPermissionFlagUniversalIdentifiers:s});if(u.length===0)return[];let d=u.map(e=>xT({grant:e,objects:i,permissionFlags:a,systemPermissionFlagNameByUniversalIdentifier:o})).join(`, `);return[`Role "${l.label}" used by agent ${ST(c)} grants more than the application role "${t.label}": ${d}. The application role must cover every permission an agent role grants.`]})},ET=({agents:e,roles:t,objects:r,permissionFlags:i,defaultRoleUniversalIdentifier:a,systemPermissionFlag:s=o.r})=>{let c=t.find(e=>e.universalIdentifier===a),l=CT({agents:e,defaultRoleUniversalIdentifier:a});return[...wT({agentNamesByRoleUniversalIdentifier:l,roles:t}),...n.t(c)?TT({agentNamesByRoleUniversalIdentifier:l,applicationRole:c,roles:t,objects:r,permissionFlags:i,systemPermissionFlagNameByUniversalIdentifier:yT(s)}):[]]},DT=({views:e,objects:t,fields:r})=>{let i=[],o=new Map;for(let e of r)o.set(e.universalIdentifier,e);for(let e of t)for(let t of e.fields)o.set(t.universalIdentifier,t);for(let t of e)for(let e of t.filters??[]){let t=o.get(e.fieldMetadataUniversalIdentifier);if(!n.t(t))continue;let r=(t.type===a.a.RELATION||t.type===a.a.MORPH_RELATION)&&n.t(e.relationTargetFieldMetadataUniversalIdentifier)?o.get(e.relationTargetFieldMetadataUniversalIdentifier)?.type??t.type:t.type;if(!(r in Dx))continue;let s=kx({filterType:r,subFieldName:e.subFieldName});s.includes(e.operand)||i.push(`Operand "${e.operand}" is not supported on field "${t.name}" (type "${r}"). Supported operands: ${s.join(`, `)}.`)}return i},OT=e=>p.i(e),kT=async e=>(await(0,te.glob)([`${d.t}/**/*`],{cwd:e,absolute:!0,onlyFiles:!0})).sort(),AT=async e=>{try{let t=await(0,ee.readFile)((0,v.join)(e,`README.md`),`utf-8`);return t.trim().length>0?t:void 0}catch{return}},jT=async e=>{let t=await OT(e),r=await AT(e),i=[],a=[],o,s=[],c=[],u=[],d=[],f=[],h=[],g=[],te=[],_=[],y=[],re=[],ie=[],ae=[],oe=[],se=[],ce=[],le=[],ue=[],de=[],fe=[],pe=[],me=[],he=[],ge=[],_e=[],b=[],ve=[],ye=[],be=[],xe=[],Se=[],Ce=[],we=[],Te=[],Ee=[],De=[],x=[],Oe=[],ke=[],Ae=[],je=[],Me=[],Ne=[],Pe=[],Fe=[],Ie=[],Le=[],Re=[],ze=[],Be=[],Ve=[],He=[],Ue=[],We=[],Ge=[],Ke=[],qe=[],Je=[],Ye=[];for(let r of t){let t=await(0,ee.readFile)(r,`utf-8`),l=(0,v.relative)(e,r);i.push(...hT(t,l));let u=p.r({fileContent:t,filePath:r});if(!u)continue;let m=p.n[u];switch(m){case`application`:{let t=await p.t({appPath:e,filePath:r});o=t.config,i.push(...t.errors),a.push(...t.warnings??[]),Te.push(l);break}case`objects`:{let t=await p.t({appPath:e,filePath:r});s.push(t.config),i.push(...t.errors),a.push(...t.warnings??[]),Ee.push(l);break}case`fields`:{let t=await p.t({appPath:e,filePath:r}),n=mw(t.config);d.push(n),i.push(...t.errors),a.push(...t.warnings??[]),De.push(l);break}case`permissionFlags`:{let t=await p.t({appPath:e,filePath:r});g.push(t.config),i.push(...t.errors),a.push(...t.warnings??[]),ke.push(l);break}case`roles`:{let t=await p.t({appPath:e,filePath:r});c.push(t.config),i.push(...t.errors),a.push(...t.warnings??[]),Ae.push(l),u===`defineApplicationRole`&&we.push(t.config.universalIdentifier);break}case`skills`:{let t=await p.t({appPath:e,filePath:r});_.push(t.config),i.push(...t.errors),a.push(...t.warnings??[]),je.push(l);break}case`agents`:{let t=await p.t({appPath:e,filePath:r});y.push(t.config),i.push(...t.errors),a.push(...t.warnings??[]),Me.push(l);break}case`workflows`:{let t=await p.t({appPath:e,filePath:r});re.push(t.config),i.push(...t.errors),a.push(...t.warnings??[]),Ne.push(l);break}case`connectionProviders`:{let t=await p.t({appPath:e,filePath:r});ie.push(Vw(t.config)),i.push(...t.errors),a.push(...t.warnings??[]),Pe.push(l);break}case`messagingProviders`:{let t=await p.t({appPath:e,filePath:r});ae.push(Gw(t.config)),i.push(...t.errors),a.push(...t.warnings??[]),Fe.push(l);break}case`mcpServers`:{let t=await p.t({appPath:e,filePath:r});oe.push(Uw(t.config)),i.push(...t.errors),a.push(...t.warnings??[]),Ie.push(l);break}case`relatedRecordPaths`:{let t=await p.t({appPath:e,filePath:r});se.push(t.config),i.push(...t.errors),a.push(...t.warnings??[]),Le.push(l);break}case`logicFunctions`:{let o=await p.t({appPath:e,filePath:r});i.push(...o.errors),a.push(...o.warnings??[]),u===`definePreInstallLogicFunction`&&n.t(o.config.serverRouteTriggerSettings)&&i.push(`${l}: pre-install logic functions cannot define serverRouteTriggerSettings.`);let{runOnUserPreferences:s,...c}=o.config,d=await $w({logicFunctionConfig:c,sourceCode:t,sourcePath:l});if(ce.push(d),Re.push(l),u===`definePostInstallLogicFunction`){let e=o.config;ye.push({universalIdentifier:o.config.universalIdentifier,shouldRunOnVersionUpgrade:e.shouldRunOnVersionUpgrade??!1,shouldRunSynchronously:e.shouldRunSynchronously??!1})}if(u===`definePreInstallLogicFunction`){let e=o.config;be.push({universalIdentifier:o.config.universalIdentifier,shouldRunOnVersionUpgrade:e.shouldRunOnVersionUpgrade??!1})}u===`defineUninstallLogicFunction`&&xe.push({universalIdentifier:o.config.universalIdentifier}),u===`defineHealthCheck`&&Se.push({universalIdentifier:o.config.universalIdentifier,...n.t(s)?{runOnUserPreferences:s}:{}});break}case`frontComponents`:{let t=await p.t({appPath:e,filePath:r});i.push(...t.errors),a.push(...t.warnings??[]);let n=eT({frontComponentConfig:t.config,sourcePath:l});le.push(n),ze.push(l),u===`defineSettingsFrontComponent`&&Ce.push(t.config.universalIdentifier);break}case`views`:{let t=await p.t({appPath:e,filePath:r}),n={...t.config};de.push(n),i.push(...t.errors),a.push(...t.warnings??[]),Ve.push(l);break}case`viewFields`:{let t=await p.t({appPath:e,filePath:r});fe.push(t.config),i.push(...t.errors),a.push(...t.warnings??[]),He.push(l);break}case`navigationMenuItems`:{let t=await p.t({appPath:e,filePath:r});pe.push(t.config),i.push(...t.errors),a.push(...t.warnings??[]),Ue.push(l);break}case`pageLayouts`:{let t=await p.t({appPath:e,filePath:r}),n={...t.config};me.push(n),i.push(...t.errors),a.push(...t.warnings??[]),We.push(l);break}case`indexes`:{let t=await p.t({appPath:e,filePath:r}),n={...t.config};f.push(n),i.push(...t.errors),a.push(...t.warnings??[]),x.push(l);break}case`validationRules`:{let t=await p.t({appPath:e,filePath:r});h.push(t.config),i.push(...t.errors),a.push(...t.warnings??[]),Oe.push(l);break}case`pageLayoutTabs`:{let t=await p.t({appPath:e,filePath:r}),n={...t.config};he.push(n),i.push(...t.errors),a.push(...t.warnings??[]),Ge.push(l);break}case`pageLayoutWidgets`:{let t=await p.t({appPath:e,filePath:r});ge.push(t.config),i.push(...t.errors),a.push(...t.warnings??[]),Ke.push(l);break}case`commandMenuItems`:{let t=await p.t({appPath:e,filePath:r});_e.push(t.config),i.push(...t.errors),a.push(...t.warnings??[]),qe.push(l);break}case`timelineActivityTypes`:{let t=await p.t({appPath:e,filePath:r});b.push(t.config),i.push(...t.errors),a.push(...t.warnings??[]),Je.push(l);break}case`settingsMenuItems`:{let t=await p.t({appPath:e,filePath:r});ve.push(t.config),i.push(...t.errors),a.push(...t.warnings??[]),Ye.push(l);break}default:ne(m)}}let Xe=await kT(e);for(let t of Xe){let n=(0,v.relative)(e,t);ue.push({filePath:n,fileName:(0,v.basename)(t),fileType:(0,v.extname)(t).replace(/^\./,``),checksum:null}),Be.push(n)}if(o||i.push(`Cannot build application, please export default defineApplication() to define an application`),o){for(let e of s){let{objectManifest:t,errors:n}=Jw({objectConfig:e,applicationUniversalIdentifier:o.universalIdentifier});i.push(...n),t&&u.push(t)}for(let e of c)te.push(tT({roleConfig:e,applicationUniversalIdentifier:o.universalIdentifier}))}ye.length>1&&i.push(`Only one post install logic function is allowed per application`),be.length>1&&i.push(`Only one pre install logic function is allowed per application`),xe.length>1&&i.push(`Only one uninstall logic function is allowed per application`),Se.length>1&&i.push(`Only one health check is allowed per application`);let[Ze]=Se;Ce.length>1&&i.push(`Only one settings front component is allowed per application`),we.length>1&&i.push(`Only one defineApplicationRole is allowed per application`);let{sharedDependencies:Qe,errors:$e}=await cT(e);i.push(...$e);let et=o?.defaultRoleUniversalIdentifier??(we.length===1?we[0]:void 0);o&&!et&&i.push("Application must declare a default role: either pass `defaultRoleUniversalIdentifier` to defineApplication() or mark a role file with defineApplicationRole()"),i.push(...DT({views:de,objects:u,fields:d})),n.t(o)&&n.t(et)&&i.push(...ET({agents:y,roles:te,objects:u,permissionFlags:g,defaultRoleUniversalIdentifier:et,systemPermissionFlag:l.i(e)}));let tt=o&&et?(()=>{let{logoUrl:t,screenshots:i,...a}=o;return{...a,logo:o.logo,galleryImages:o.galleryImages??[],defaultRoleUniversalIdentifier:et,aboutDescription:r,yarnLockChecksum:null,packageJsonChecksum:``,requiredServerVersionRange:m.t(e),...ye.length>=1?{postInstallLogicFunction:ye[0]}:{},...be.length>=1?{preInstallLogicFunction:be[0]}:{},...xe.length>=1?{uninstallLogicFunction:xe[0]}:{},...n.t(Ze)?{healthCheckLogicFunction:Ze}:{},...Ce.length>=1?{settingsFrontComponent:{universalIdentifier:Ce[0]}}:{},...n.t(Qe)?{frontComponentSharedDependencies:Qe}:{}}})():void 0,S=(e,t)=>e.universalIdentifier.localeCompare(t.universalIdentifier);return{manifest:tt?{application:tt,objects:u.sort(S),fields:d.sort(S),indexes:f.sort(S),permissionFlags:g.sort(S),roles:te.sort(S),skills:_.sort(S),agents:y.sort(S),workflows:re.sort(S),connectionProviders:ie.sort(S),messagingProviders:ae.sort(S),mcpServers:oe.sort(S),logicFunctions:ce.sort(S),frontComponents:le.sort(S),publicAssets:ue.sort((e,t)=>e.filePath.localeCompare(t.filePath)),views:de.sort(S),viewFields:fe.sort(S),navigationMenuItems:pe.sort(S),pageLayouts:me.sort(S),pageLayoutTabs:he.sort(S),pageLayoutWidgets:ge.sort(S),commandMenuItems:_e.sort(S),timelineActivityTypes:b.sort(S),settingsMenuItems:ve.sort(S),validationRules:h.sort(S),relatedRecordPaths:se.sort(S)}:null,filePaths:{application:Te,objects:Ee,fields:De,indexes:x,validationRules:Oe,permissionFlags:ke,roles:Ae,skills:je,agents:Me,workflows:Ne,connectionProviders:Pe,messagingProviders:Fe,mcpServers:Ie,relatedRecordPaths:Le,logicFunctions:Re,frontComponents:ze,publicAssets:Be,views:Ve,viewFields:He,navigationMenuItems:Ue,pageLayouts:We,pageLayoutTabs:Ge,pageLayoutWidgets:Ke,commandMenuItems:qe,timelineActivityTypes:Je,settingsMenuItems:Ye},errors:i,warnings:a}},MT=[a.a.RELATION,a.a.MORPH_RELATION],NT=e=>MT.includes(e.type),PT=e=>{let t=new Set,n=new Set;for(let r of e)t.has(r)?n.add(r):t.add(r);return Array.from(n)},FT=({manifest:e,pageLayoutWidgets:t})=>{let r=new Set([e.application.settingsFrontComponent?.universalIdentifier,...e.settingsMenuItems.map(e=>e.frontComponentUniversalIdentifier),...e.commandMenuItems.map(e=>e.frontComponentUniversalIdentifier),...e.timelineActivityTypes.map(e=>e.frontComponentUniversalIdentifier),...t.map(({configuration:e})=>n.t(e)&&`frontComponentUniversalIdentifier`in e?e.frontComponentUniversalIdentifier:void 0)].filter(n.t));return e.frontComponents.filter(e=>!e.isHeadless&&!n.t(e.widgetAvailability)&&!r.has(e.universalIdentifier)).map(e=>`Front component "${e.name??e.componentName}" declares no widgetAvailability, so it is not offered in any widget picker. Set widgetAvailability to let users add it to record pages or dashboards.`)},IT=e=>{let t=[],r=[...e.pageLayouts.flatMap(({tabs:e})=>e??[]),...e.pageLayoutTabs];for(let e of r){e.layoutMode===o.l.CANVAS&&t.push(`Page layout tab "${e.title}" uses deprecated CANVAS. For a full-height widget, use VERTICAL_LIST and set the widget's heightBehavior to 'TAB_VIEWPORT'. Existing Canvas layouts remain supported and are not converted.`);for(let r of e.widgets??[])r.position?.layoutMode===o.l.VERTICAL_LIST&&t.push(`Page layout widget "${r.title}" uses a deprecated vertical-list position. Order the widgets array by position.index, remove position, and move any position.heightBehavior to heightBehavior. Existing positions remain supported and keep their indices.`),`gridPosition`in r&&n.t(r.gridPosition)&&t.push(`Page layout widget "${r.title}" uses deprecated gridPosition. If position is already set, it takes precedence; remove the ignored gridPosition. Use position with layoutMode: 'GRID' and the same row, column, rowSpan and columnSpan only when position is absent. Existing gridPosition remains supported as a fallback.`)}return t},LT=[`id`,`createdAt`,`createdBy`,`updatedAt`,`updatedBy`,`deletedAt`,`position`,`searchVector`],RT=e=>e.objects.flatMap(t=>{let r=t.labelIdentifierFieldMetadataUniversalIdentifier?.toLowerCase();return n.t(r)?[...(t.fields??[]).map(e=>e.universalIdentifier.toLowerCase()),...e.fields.filter(e=>e.objectUniversalIdentifier.toLowerCase()===t.universalIdentifier.toLowerCase()).map(e=>e.universalIdentifier.toLowerCase()),...LT.map(n=>a.t({applicationUniversalIdentifier:e.application.universalIdentifier,objectUniversalIdentifier:t.universalIdentifier,name:n}))].includes(r)?[]:[`Object "${t.nameSingular}" references label field ${r}, which is not declared in this app or a recognized generated field. Check the identifier; the server must resolve this reference before applying.`]:[]}),zT=e=>PT(e.settingsMenuItems.map(e=>e.slug).filter(n.t)).map(e=>`Settings menu item slug "${e}" is used more than once. Slugs must be unique within an application.`),BT=e=>{let t=[],i=PT(e.timelineActivityTypes.map(e=>e.name)),o=new Set(e.frontComponents.map(e=>e.universalIdentifier));for(let e of i)t.push(`Timeline activity type name "${e}" is used more than once. Names must be unique within an application.`);for(let i of e.timelineActivityTypes){n.t(i.frontComponentUniversalIdentifier)&&!o.has(i.frontComponentUniversalIdentifier)&&t.push(`Timeline activity type "${i.name}" references front component "${i.frontComponentUniversalIdentifier}", which is not defined by this application.`);let s=i.emit,l=i.replacesTimelineActivityTypeUniversalIdentifier;if(!n.t(s)){n.t(l)&&t.push(`Timeline activity type "${i.name}" declares replacesTimelineActivityTypeUniversalIdentifier without an automatic emit contract.`);continue}let u=s.through,d=u?.triggerFieldUniversalIdentifiers,f=c.t(s.objectUniversalIdentifier);f||t.push(`Timeline activity type "${i.name}" references an invalid object universal identifier "${s.objectUniversalIdentifier}".`),(s.on===`linked`||s.on===`unlinked`)&&!n.t(u)&&t.push(`Timeline activity type "${i.name}" must declare emit.through for a ${s.on} event.`),n.t(d)&&(s.on!==`updated`||!r.t(d)||new Set(d).size!==d.length)&&t.push(`Timeline activity type "${i.name}" trigger fields must be a non-empty list of unique fields on an updated through event.`);let p=f?e.objects.find(e=>e.universalIdentifier===s.objectUniversalIdentifier):void 0;if(!n.t(p)){f&&!n.t(l)&&t.push(`Timeline activity type "${i.name}" targets object "${s.objectUniversalIdentifier}", which is not defined by this application. Types targeting another application's object must declare replacesTimelineActivityTypeUniversalIdentifier.`),n.t(l)&&!c.t(l)&&t.push(`Timeline activity type "${i.name}" references an invalid replacement universal identifier "${l}".`),n.t(u)&&!c.t(u.relationFieldUniversalIdentifier)&&t.push(`Timeline activity type "${i.name}" references an invalid through relation field universal identifier "${u.relationFieldUniversalIdentifier}".`);let e=d?.filter(e=>!c.t(e))??[];e.length>0&&t.push(`Timeline activity type "${i.name}" references invalid trigger field universal identifiers: ${e.join(`, `)}.`);continue}n.t(l)&&t.push(`Timeline activity type "${i.name}" targets an object defined by this application and must not replace another application's type.`);let m=[...p.fields,...e.fields.filter(e=>e.objectUniversalIdentifier===p.universalIdentifier)];if(!n.t(u))continue;let h=m.find(e=>e.universalIdentifier===u.relationFieldUniversalIdentifier);if(n.t(h)?NT(h)&&n.t(h.universalSettings)&&(h.universalSettings.relationType===a.i.MANY_TO_ONE||h.universalSettings.relationType===a.i.ONE_TO_MANY&&(0,y.isNonEmptyString)(h.universalSettings.junctionTargetFieldUniversalIdentifier))||t.push(`Timeline activity type "${i.name}" must route through a MANY_TO_ONE relation or a junction-backed ONE_TO_MANY relation.`):t.push(`Timeline activity type "${i.name}" references relation field "${u.relationFieldUniversalIdentifier}", which is not defined on object "${p.nameSingular}".`),n.t(d)){let e=new Set(m.map(e=>e.universalIdentifier)),n=d.filter(t=>!e.has(t));n.length>0&&t.push(`Timeline activity type "${i.name}" references trigger fields that are not defined on object "${p.nameSingular}": ${n.join(`, `)}.`)}}return t},VT=({name:e,errorMessage:t})=>`Validation rule "${e}" has an invalid expression: ${t}`,HT=e=>({name:e.name,type:e.type,universalIdentifier:e.universalIdentifier}),UT=e=>new Map(e.objects.map(t=>[t.universalIdentifier,[...t.fields,...e.fields.filter(e=>e.objectUniversalIdentifier===t.universalIdentifier)]])),WT=({manifest:{application:e},objectUniversalIdentifier:t})=>Object.entries(gT).map(([n,r])=>({name:n,type:r,universalIdentifier:a.t({applicationUniversalIdentifier:e.universalIdentifier,objectUniversalIdentifier:t,name:n})})),GT=({manifest:e,declaredFieldsByObject:t,objectUniversalIdentifier:n})=>[...t.get(n)??[],...WT({manifest:e,objectUniversalIdentifier:n})].map(HT),KT=({manifest:e,declaredFieldsByObject:t,objectUniversalIdentifier:n})=>[...(t.get(n)??[]).map(n=>{if(!NT(n))return HT(n);let r=n.universalSettings?.relationType;return r===a.i.MANY_TO_ONE?{...HT(n),relationType:r,relationTargetFields:GT({manifest:e,declaredFieldsByObject:t,objectUniversalIdentifier:n.relationTargetObjectMetadataUniversalIdentifier})}:{...HT(n),relationType:r}}),...WT({manifest:e,objectUniversalIdentifier:n}).map(HT)],qT=({name:e,expression:t})=>{let n=QC({expression:t,fields:[]});return!n.isValid&&n.errorCode!==`UNKNOWN_FIELD`?[VT({name:e,errorMessage:n.errorMessage})]:[]},JT=({validationRule:{name:e,errorFieldUniversalIdentifier:t},objectFields:r})=>n.t(t)&&!r.some(e=>e.universalIdentifier===t)?[`Validation rule "${e}" shows its error on field "${t}", which does not belong to the rule's object.`]:[],YT=({compilationResult:e,declaredFields:t,declaredFieldsByObject:r})=>{if(e.isValid||e.errorCode!==`UNKNOWN_RELATION_TARGET_FIELD`)return!1;let i=t.find(t=>t.name===e.errorParams?.relationFieldName);return n.t(i)&&NT(i)&&!r.has(i.relationTargetObjectMetadataUniversalIdentifier)},XT=({validationRule:e,manifest:t,declaredFields:n,declaredFieldsByObject:r})=>{let{name:i,expression:a,objectUniversalIdentifier:o}=e,s=JT({validationRule:e,objectFields:GT({manifest:t,declaredFieldsByObject:r,objectUniversalIdentifier:o})}),c=QC({expression:a,fields:KT({manifest:t,declaredFieldsByObject:r,objectUniversalIdentifier:o})});return c.isValid||YT({compilationResult:c,declaredFields:n,declaredFieldsByObject:r})?s:[...s,VT({name:i,errorMessage:c.errorMessage})]},ZT=e=>{let t=UT(e);return(e.validationRules??[]).flatMap(r=>{let i=t.get(r.objectUniversalIdentifier);return n.t(i)?XT({validationRule:r,manifest:e,declaredFields:i,declaredFieldsByObject:t}):qT(r)})},QT=[a.i.MANY_TO_ONE,a.i.ONE_TO_MANY],$T=`aggregateFieldMetadataId`,eE=e=>n.t(e)&&$C.some(t=>t===e.configurationType),tE=e=>{let t=[];if(!e)return[];for(let[n,r]of Object.entries(e))n===`universalIdentifier`&&typeof r==`string`&&t.push(r),!(n===`postInstallLogicFunction`||n===`preInstallLogicFunction`||n===`uninstallLogicFunction`||n===`healthCheckLogicFunction`||n===`identifyAccountLogicFunction`||n===`authorizeLogicFunction`||n===`callbackLogicFunction`||n===`onConnectLogicFunction`||n===`onDisconnectLogicFunction`||n===`sendMessageLogicFunction`||n===`markThreadAsReadLogicFunction`||n===`connectionProvider`||n===`settingsFrontComponent`||n===`input`||n===`expectedBody`||n===`outputSchema`||n===`expectedOutputSchema`)&&typeof r==`object`&&t.push(...tE(r));return t},nE=e=>{let t=[];for(let n of e){if(!NT(n))continue;let e=n.universalSettings;if(!e?.relationType){t.push(`Relation field "${n.name}" is missing relationType. ${n.type} fields must declare a relationType (${QT.join(` or `)}) in universalSettings.`);continue}if(!QT.includes(e.relationType)){t.push(`Relation field "${n.name}" has invalid relationType "${e.relationType}". Expected ${QT.join(` or `)}.`);continue}e.relationType===a.i.MANY_TO_ONE&&!e.joinColumnName&&t.push(`MANY_TO_ONE relation field "${n.name}" is missing joinColumnName. MANY_TO_ONE relations must declare a joinColumnName in universalSettings.`)}return t},rE=e=>{let t=e.pageLayouts.flatMap(e=>e.tabs?.flatMap(e=>e.widgets??[])??[]),n=e.pageLayoutTabs.flatMap(e=>e.widgets??[]);return[...t,...n,...e.pageLayoutWidgets??[]]},iE=e=>{let t=[];for(let n of e){let e=n.configuration;if(eE(e)&&!(0,y.isNonEmptyString)(e.aggregateFieldMetadataUniversalIdentifier)){let r=$T in e?` Reference the aggregate field with "aggregateFieldMetadataUniversalIdentifier" (not "${$T}").`:``;t.push(`Graph widget "${n.title}" is missing aggregateFieldMetadataUniversalIdentifier.${r}`)}}return t},aE=({pageLayoutTab:e,pageLayoutType:t})=>{let n=bw({pageLayoutTabManifest:e,pageLayoutType:t});return n.status===`fail`?n.errors:[]},oE=e=>{let t=new Map(e.pageLayouts.map(e=>[e.universalIdentifier,e.type])),r=e.pageLayouts.flatMap(e=>(e.tabs??[]).flatMap(t=>aE({pageLayoutTab:t,pageLayoutType:e.type}))),i=e.pageLayoutTabs.flatMap(e=>aE({pageLayoutTab:e,pageLayoutType:n.t(e.pageLayoutUniversalIdentifier)?t.get(e.pageLayoutUniversalIdentifier):void 0}));return[...r,...i]},sE=e=>{let t=[],n=new Set;for(let r of e){if(n.has(r))continue;if(n.add(r),!tw(r)){t.push(`Universal identifier "${r}" is not a valid UUID.`);continue}let e=fw(r);c.t(r)||t.push(`Universal identifier "${r}" is UUID version ${e}. Only UUID version 4 or higher is allowed.`)}return t},cE=e=>{let t=[],i=rE(e),o=[...IT(e),...RT(e),...FT({manifest:e,pageLayoutWidgets:i})],s=tE(e),c=PT(s.map(e=>e.toLowerCase()));c.length>0&&t.push(`Duplicate universal identifiers: ${c.join(`, `)}`);let l=sE(s);l.length>0&&t.push(`Invalid universal identifiers: ${l.join(`, `)}`),(e.application.billing?.prices??[]).some(({per:e})=>e===`CONNECTED_ACCOUNT`)&&!r.t(e.connectionProviders)&&t.push(`A billing price per CONNECTED_ACCOUNT needs a connection provider: without one no account is ever connected and the price is never billed.`);let u=[...e.fields,...e.objects.flatMap(e=>e.fields)];for(let e of u)if((e.type===a.a.SELECT||e.type===a.a.MULTI_SELECT||e.type===a.a.RATING)&&n.t(e.options)){e.options.some(({id:e})=>n.t(e)&&!(0,y.isNonEmptyString)(e))&&t.push(`Field "${e.name}" has empty option IDs. Set distinct non-empty IDs on these options.`);let r=PT(e.options.map(e=>e.id).filter(n.t).map(e=>e.toLowerCase()));r.length>0&&t.push(`Field "${e.name}" has duplicate option IDs: ${r.join(`, `)}. Set distinct explicit IDs on these options.`)}return t.push(...nE(u)),t.push(...oE(e)),t.push(...iE(i)),t.push(...BT(e)),t.push(...ZT(e)),t.push(...zT(e)),{errors:t,warnings:o,isValid:t.length===0}},lE={"twenty-sdk":`"twenty-sdk" is listed under "dependencies" in package.json. It is a build-time only tool and should be moved to "devDependencies".`,"twenty-client-sdk":`"twenty-client-sdk" is listed under "dependencies" in package.json. It is provided at runtime by Twenty's injected SDK and should be moved to "devDependencies".`},uE=async e=>{let t=v.default.join(e,`package.json`);if(!await u.i(t))return[];let r=await u.a(t);return[`dependencies`,`optionalDependencies`].flatMap(e=>Object.entries(lE).filter(([t])=>n.t(r[e]?.[t])).map(([,t])=>t.replace(`"dependencies"`,`"${e}"`)))},dE=async e=>await u.i(e)?(await(0,ee.stat)(e)).size===0?[`yarn.lock is empty. Run "yarn install" to regenerate it before building.`]:[]:[`yarn.lock not found. Run "yarn install" to generate it before building.`],fE=e=>dE(v.default.join(e,`yarn.lock`)),pE=async e=>{let t=await jT(e);if(t.errors.length>0||!t.manifest)return{success:!1,errors:t.errors.length>0?t.errors:[`Failed to build manifest.`]};let n=cE(t.manifest);if(!n.isValid)return{success:!1,errors:n.errors};let r=await fE(e);if(r.length>0)return{success:!1,errors:r};let i=await uE(e);return{success:!0,manifest:t.manifest,filePaths:t.filePaths,warnings:[...t.warnings,...n.warnings,...i]}},mE=({catalog:e,onCollision:t})=>{let r={},i=new Map;for(let{message:a,context:o,translation:s}of l.n(e)){if(s.length===0)continue;let e=n.t(o)?`${o} ${a}`:a,c=l.r(a,o),u=i.get(c);n.t(u)&&u!==e&&t?.({messageId:c,keptKey:e,droppedKey:u}),i.set(c,e),r[c]=s}return r},hE=async({filePath:e,onWarning:t})=>{let r;try{r=await u.a(e)}catch{return t(`Skipping translation file "${v.default.basename(e)}": it is not valid JSON.`),null}return!n.t(r)||typeof r!=`object`||Array.isArray(r)?(t(`Skipping translation file "${v.default.basename(e)}": expected a JSON object.`),null):r},gE=async({appPath:e,onWarning:t})=>{let n=v.default.join(e,h.t);if(!await u.i(n))return{};let r={};for(let e of(await(0,ee.readdir)(n)).filter(e=>e.endsWith(`.json`))){let i=v.default.basename(e,`.json`);if(i===`en`)continue;if(!s.t(i)){t(`Skipping compiled translation file "${e}": "${i}" is not a supported locale.`);continue}let a=await hE({filePath:v.default.join(n,e),onWarning:t});if(a===null)continue;let o=Object.fromEntries(Object.entries(a).filter(e=>typeof e[1]==`string`&&e[1].length>0));Object.keys(o).length>0&&(r[i]=o)}return r},_E=async({appPath:e,onWarning:t=e=>console.warn(e)})=>{let n=v.default.join(e,h.n);if(!await u.i(n))return;let r=(await(0,ee.readdir)(n)).filter(e=>e.endsWith(`.json`)),i={};for(let e of r){let r=v.default.basename(e,`.json`);if(r===`en`)continue;if(!s.t(r)){t(`Skipping translation file "${e}": "${r}" is not a supported locale.`);continue}let a=await hE({filePath:v.default.join(n,e),onWarning:t});if(a===null)continue;let o=mE({catalog:a,onCollision:({messageId:n,keptKey:r,droppedKey:i})=>t(`Message id collision in "${e}": "${r}" and "${i}" share id "${n}". Keeping "${r}".`)});Object.keys(o).length>0&&(i[r]=o)}for(let[n,r]of Object.entries(await gE({appPath:e,onWarning:t})))i[n]={...r,...i[n]??{}};return i};Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return bc}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return aT}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return mE}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return pE}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return _E}});
|