@shoppexio/storefront 1.0.57 → 1.0.59
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/CHANGELOG.md +99 -0
- package/LICENSE +21 -0
- package/README.md +96 -180
- package/dist/chunk-ZVOFFURI.js +15364 -0
- package/dist/chunk-ZVOFFURI.js.map +1 -0
- package/dist/customer.cjs +16013 -1
- package/dist/customer.cjs.map +1 -1
- package/dist/{headless-customer.d.ts → customer.d.cts} +74 -61
- package/dist/customer.d.ts +336 -10
- package/dist/customer.js +726 -2
- package/dist/customer.js.map +1 -1
- package/dist/index.cjs +21533 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1979 -0
- package/dist/index.d.ts +1859 -49
- package/dist/index.js +6139 -0
- package/dist/index.js.map +1 -0
- package/package.json +18 -37
- package/dist/core/attribution.d.ts +0 -26
- package/dist/core/attribution.d.ts.map +0 -1
- package/dist/core/cache.d.ts +0 -26
- package/dist/core/cache.d.ts.map +0 -1
- package/dist/core/client.d.ts +0 -18
- package/dist/core/client.d.ts.map +0 -1
- package/dist/core/config.d.ts +0 -10
- package/dist/core/config.d.ts.map +0 -1
- package/dist/core/endpoint.d.ts +0 -2
- package/dist/core/endpoint.d.ts.map +0 -1
- package/dist/core/errors.d.ts +0 -34
- package/dist/core/errors.d.ts.map +0 -1
- package/dist/core/telemetry.d.ts +0 -20
- package/dist/core/telemetry.d.ts.map +0 -1
- package/dist/core/typed-client.d.ts +0 -15
- package/dist/core/typed-client.d.ts.map +0 -1
- package/dist/customer.d.ts.map +0 -1
- package/dist/headless-customer.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/modules/affiliates.d.ts +0 -15
- package/dist/modules/affiliates.d.ts.map +0 -1
- package/dist/modules/analytics.d.ts +0 -2
- package/dist/modules/analytics.d.ts.map +0 -1
- package/dist/modules/cart.d.ts +0 -62
- package/dist/modules/cart.d.ts.map +0 -1
- package/dist/modules/checkout.d.ts +0 -133
- package/dist/modules/checkout.d.ts.map +0 -1
- package/dist/modules/coupons.d.ts +0 -3
- package/dist/modules/coupons.d.ts.map +0 -1
- package/dist/modules/customer.d.ts +0 -147
- package/dist/modules/customer.d.ts.map +0 -1
- package/dist/modules/invoices.d.ts +0 -6
- package/dist/modules/invoices.d.ts.map +0 -1
- package/dist/modules/navigation.d.ts +0 -20
- package/dist/modules/navigation.d.ts.map +0 -1
- package/dist/modules/pages.d.ts +0 -10
- package/dist/modules/pages.d.ts.map +0 -1
- package/dist/modules/presence.d.ts +0 -12
- package/dist/modules/presence.d.ts.map +0 -1
- package/dist/modules/products.d.ts +0 -16
- package/dist/modules/products.d.ts.map +0 -1
- package/dist/modules/reviews.d.ts +0 -4
- package/dist/modules/reviews.d.ts.map +0 -1
- package/dist/modules/search.d.ts +0 -10
- package/dist/modules/search.d.ts.map +0 -1
- package/dist/modules/store.d.ts +0 -11
- package/dist/modules/store.d.ts.map +0 -1
- package/dist/modules/theme.d.ts +0 -27
- package/dist/modules/theme.d.ts.map +0 -1
- package/dist/shoppex.esm.js +0 -3
- package/dist/shoppex.esm.js.map +0 -1
- package/dist/shoppex.umd.js +0 -2
- package/dist/shoppex.umd.js.map +0 -1
- package/dist/types/api.d.ts +0 -757
- package/dist/types/api.d.ts.map +0 -1
- package/dist/types/cart.d.ts +0 -239
- package/dist/types/cart.d.ts.map +0 -1
- package/dist/types/config.d.ts +0 -18
- package/dist/types/config.d.ts.map +0 -1
- package/dist/types/index.d.ts +0 -7
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/theme-config.d.ts +0 -109
- package/dist/types/theme-config.d.ts.map +0 -1
- package/dist/utils/cart-line-id.d.ts +0 -5
- package/dist/utils/cart-line-id.d.ts.map +0 -1
- package/dist/utils/format.d.ts +0 -6
- package/dist/utils/format.d.ts.map +0 -1
- package/dist/utils/requested-currency.d.ts +0 -3
- package/dist/utils/requested-currency.d.ts.map +0 -1
- package/dist/utils/storage.d.ts +0 -10
- package/dist/utils/storage.d.ts.map +0 -1
- package/dist/utils/storefront-catalog.d.ts +0 -5
- package/dist/utils/storefront-catalog.d.ts.map +0 -1
- package/dist/utils/storefront-contact.d.ts +0 -32
- package/dist/utils/storefront-contact.d.ts.map +0 -1
- package/dist/utils/storefront-custom-fields.d.ts +0 -13
- package/dist/utils/storefront-custom-fields.d.ts.map +0 -1
- package/dist/utils/storefront-search.d.ts +0 -22
- package/dist/utils/storefront-search.d.ts.map +0 -1
- package/dist/utils/storefront-stock.d.ts +0 -14
- package/dist/utils/storefront-stock.d.ts.map +0 -1
package/dist/customer.js
CHANGED
|
@@ -1,3 +1,727 @@
|
|
|
1
|
-
var e;function t(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:o,traits:/* @__PURE__ */new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);const i=o.prototype,s=Object.keys(i);for(let e=0;e<s.length;e++){const t=s[e];t in n||(n[t]=i[t].bind(n))}}const i=n?.Parent??Object;class s extends i{}function o(e){var t;const i=n?.Parent?new s:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(const n of i._zod.deferred)n();return i}return Object.defineProperty(s,"name",{value:e}),Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>!!(n?.Parent&&t instanceof n.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var n=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},r=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}};(e=globalThis).__zod_globalConfig??(e.__zod_globalConfig={});var i=globalThis.__zod_globalConfig;function s(e){return e&&Object.assign(i,e),i}function o(e){const t=Object.values(e).filter(e=>"number"==typeof e);return Object.entries(e).filter(([e,n])=>-1===t.indexOf(+e)).map(([e,t])=>t)}function a(e,t){return"bigint"==typeof t?t.toString():t}function u(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function c(e){return null==e}function d(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}var l=/* @__PURE__*/Symbol("evaluating");function p(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==l)return void 0===r&&(r=l,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function h(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function f(...e){const t={};for(const n of e){const e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function m(e){return JSON.stringify(e)}var _="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function v(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}var y=/* @__PURE__*/u(()=>{if(i.jitless)return!1;if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function g(e){if(!1===v(e))return!1;const t=e.constructor;if(void 0===t)return!0;if("function"!=typeof t)return!0;const n=t.prototype;return!1!==v(n)&&!1!==Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")}function b(e){return g(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var w=/* @__PURE__*/new Set(["string","number","symbol"]);function z(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function k(e,t,n){const r=new e._zod.constr(t??e._zod.def);return t&&!n?.parent||(r._zod.parent=e),r}function S(e){const t=e;if(!t)return{};if("string"==typeof t)return{error:()=>t};if(void 0!==t?.message){if(void 0!==t?.error)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,"string"==typeof t.error?{...t,error:()=>t.error}:t}var E={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function $(e,t=0){if(!0===e.aborted)return!0;for(let n=t;n<e.issues.length;n++)if(!0!==e.issues[n]?.continue)return!0;return!1}function I(e,t=0){if(!0===e.aborted)return!0;for(let n=t;n<e.issues.length;n++)if(!1===e.issues[n]?.continue)return!0;return!1}function T(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function O(e){return"string"==typeof e?e:e?.message}function P(e,t,n){const r=e.message?e.message:O(e.inst?._zod.def?.error?.(e))??O(t?.error?.(e))??O(n.customError?.(e))??O(n.localeError?.(e))??"Invalid input",{inst:i,continue:s,input:o,...a}=e;return a.path??(a.path=[]),a.message=r,t?.reportInput&&(a.input=o),a}function x(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function N(...e){const[t,n,r]=e;return"string"==typeof t?{message:t,code:"custom",input:n,inst:r}:{...t}}var A=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,a,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Z=t("$ZodError",A),q=t("$ZodError",A,{Parent:Error});var j=e=>(t,r,i,o)=>{const a=i?{...i,async:!1}:{async:!1},u=t._zod.run({value:r,issues:[]},a);if(u instanceof Promise)throw new n;if(u.issues.length){const t=new(o?.Err??e)(u.issues.map(e=>P(e,a,s())));throw _(t,o?.callee),t}return u.value},D=e=>async(t,n,r,i)=>{const o=r?{...r,async:!0}:{async:!0};let a=t._zod.run({value:n,issues:[]},o);if(a instanceof Promise&&(a=await a),a.issues.length){const t=new(i?.Err??e)(a.issues.map(e=>P(e,o,s())));throw _(t,i?.callee),t}return a.value},R=e=>(t,r,i)=>{const o=i?{...i,async:!1}:{async:!1},a=t._zod.run({value:r,issues:[]},o);if(a instanceof Promise)throw new n;return a.issues.length?{success:!1,error:new(e??Z)(a.issues.map(e=>P(e,o,s())))}:{success:!0,data:a.value}},C=/* @__PURE__*/R(q),U=e=>async(t,n,r)=>{const i=r?{...r,async:!0}:{async:!0};let o=t._zod.run({value:n,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(e=>P(e,i,s())))}:{success:!0,data:o.value}},F=/* @__PURE__*/U(q),J=e=>(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return j(e)(t,n,i)},L=e=>(t,n,r)=>j(e)(t,n,r),M=e=>async(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return D(e)(t,n,i)},V=e=>async(t,n,r)=>D(e)(t,n,r),K=e=>(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return R(e)(t,n,i)},W=e=>(t,n,r)=>R(e)(t,n,r),B=e=>async(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return U(e)(t,n,i)},G=e=>async(t,n,r)=>U(e)(t,n,r),H=/^[cC][0-9a-z]{6,}$/,Y=/^[0-9a-z]+$/,X=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Q=/^[0-9a-vA-V]{20}$/,ee=/^[A-Za-z0-9]{27}$/,te=/^[a-zA-Z0-9_-]{21}$/,ne=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,re=/^([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})$/,ie=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,se=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var oe=/^(?:(?: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])$/,ae=/^(([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}|:))$/,ue=/^((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])$/,ce=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,de=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,le=/^[A-Za-z0-9_-]*$/,pe=/^https?$/,he=/^\+[1-9]\d{6,14}$/,fe="(?:(?:\\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])))",me=/*@__PURE__*/new RegExp(`^${fe}$`);function _e(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}var ve=/^-?\d+$/,ye=/^-?\d+(?:\.\d+)?$/,ge=/^(?:true|false)$/i,be=/^[^A-Z]*$/,we=/^[^a-z]*$/,ze=/*@__PURE__*/t("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),ke={number:"number",bigint:"bigint",object:"date"},Se=/*@__PURE__*/t("$ZodCheckLessThan",(e,t)=>{ze.init(e,t);const n=ke[typeof t.value];e._zod.onattach.push(e=>{const n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:"object"==typeof t.value?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ee=/*@__PURE__*/t("$ZodCheckGreaterThan",(e,t)=>{ze.init(e,t);const n=ke[typeof t.value];e._zod.onattach.push(e=>{const n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:"object"==typeof t.value?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),$e=/*@__PURE__*/t("$ZodCheckMultipleOf",(e,t)=>{ze.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof n.value?n.value%t.value!==BigInt(0):0!==function(e,t){const n=e/t,r=Math.round(n),i=Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}(n.value,t.value))&&n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Ie=/*@__PURE__*/t("$ZodCheckNumberFormat",(e,t)=>{ze.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),r=n?"int":"number",[i,s]=E[t.format];e._zod.onattach.push(e=>{const r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=s,n&&(r.pattern=ve)}),e._zod.check=o=>{const a=o.value;if(n){if(!Number.isInteger(a))return void o.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});if(!Number.isSafeInteger(a))return void(a>0?o.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}))}a<i&&o.issues.push({origin:"number",input:a,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),a>s&&o.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}}),Te=/*@__PURE__*/t("$ZodCheckMaxLength",(e,t)=>{var n;ze.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!c(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{const r=n.value;if(r.length<=t.maximum)return;const i=x(r);n.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Oe=/*@__PURE__*/t("$ZodCheckMinLength",(e,t)=>{var n;ze.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!c(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{const r=n.value;if(r.length>=t.minimum)return;const i=x(r);n.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Pe=/*@__PURE__*/t("$ZodCheckLengthEquals",(e,t)=>{var n;ze.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!c(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{const r=n.value,i=r.length;if(i===t.length)return;const s=x(r),o=i>t.length;n.issues.push({origin:s,...o?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),xe=/*@__PURE__*/t("$ZodCheckStringFormat",(e,t)=>{var n,r;ze.init(e,t),e._zod.onattach.push(e=>{const n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??(n.patterns=/* @__PURE__ */new Set),n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Ne=/*@__PURE__*/t("$ZodCheckRegex",(e,t)=>{xe.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})}}),Ae=/*@__PURE__*/t("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=be),xe.init(e,t)}),Ze=/*@__PURE__*/t("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=we),xe.init(e,t)}),qe=/*@__PURE__*/t("$ZodCheckIncludes",(e,t)=>{ze.init(e,t);const n=z(t.includes),r=new RegExp("number"==typeof t.position?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=/* @__PURE__ */new Set),t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),je=/*@__PURE__*/t("$ZodCheckStartsWith",(e,t)=>{ze.init(e,t);const n=new RegExp(`^${z(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=/* @__PURE__ */new Set),t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),De=/*@__PURE__*/t("$ZodCheckEndsWith",(e,t)=>{ze.init(e,t);const n=new RegExp(`.*${z(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=/* @__PURE__ */new Set),t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Re=/*@__PURE__*/t("$ZodCheckOverwrite",(e,t)=>{ze.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Ce=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e)return e(this,{execution:"sync"}),void e(this,{execution:"async"});const t=e.split("\n").filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>" ".repeat(2*this.indent)+e);for(const i of r)this.content.push(i)}compile(){const e=Function,t=this?.args;return new e(...t,[...(this?.content??[""]).map(e=>` ${e}`)].join("\n"))}},Ue={major:4,minor:4,patch:3},Fe=/*@__PURE__*/t("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ue;const i=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&i.unshift(e);for(const n of i)for(const t of n._zod.onattach)t(e);if(0===i.length)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const t=(e,t,r)=>{let i,s=$(e);for(const o of t){if(o._zod.def.when){if(I(e))continue;if(!o._zod.def.when(e))continue}else if(s)continue;const t=e.issues.length,a=o._zod.check(e);if(a instanceof Promise&&!1===r?.async)throw new n;if(i||a instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await a,e.issues.length!==t&&(s||(s=$(e,t)))});else{if(e.issues.length===t)continue;s||(s=$(e,t))}}return i?i.then(()=>e):e},r=(r,s,o)=>{if($(r))return r.aborted=!0,r;const a=t(s,i,o);if(a instanceof Promise){if(!1===o.async)throw new n;return a.then(t=>e._zod.parse(t,o))}return e._zod.parse(a,o)};e._zod.run=(s,o)=>{if(o.skipChecks)return e._zod.parse(s,o);if("backward"===o.direction){const t=e._zod.parse({value:s.value,issues:[]},{...o,skipChecks:!0});return t instanceof Promise?t.then(e=>r(e,s,o)):r(t,s,o)}const a=e._zod.parse(s,o);if(a instanceof Promise){if(!1===o.async)throw new n;return a.then(e=>t(e,i,o))}return t(a,i,o)}}p(e,"~standard",()=>({validate:t=>{try{const n=C(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch(n){return F(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}))}),Je=/*@__PURE__*/t("$ZodString",(e,t)=>{var n;Fe.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(n=e._zod.bag,new RegExp(`^${n?`[\\s\\S]{${n?.minimum??0},${n?.maximum??""}}`:"[\\s\\S]*"}$`)),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch(r){}return"string"==typeof n.value||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),Le=/*@__PURE__*/t("$ZodStringFormat",(e,t)=>{xe.init(e,t),Je.init(e,t)}),Me=/*@__PURE__*/t("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=re),Le.init(e,t)}),Ve=/*@__PURE__*/t("$ZodUUID",(e,t)=>{if(t.version){const e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=ie(e))}else t.pattern??(t.pattern=ie());Le.init(e,t)}),Ke=/*@__PURE__*/t("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=se),Le.init(e,t)}),We=/*@__PURE__*/t("$ZodURL",(e,t)=>{Le.init(e,t),e._zod.check=n=>{try{const r=n.value.trim();if(!t.normalize&&t.protocol?.source===pe.source&&!/^https?:\/\//i.test(r))return void n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});const i=new URL(r);return t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),void(t.normalize?n.value=i.href:n.value=r)}catch(r){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),Be=/*@__PURE__*/t("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Le.init(e,t)}),Ge=/*@__PURE__*/t("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=te),Le.init(e,t)}),He=/*@__PURE__*/t("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=H),Le.init(e,t)}),Ye=/*@__PURE__*/t("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Y),Le.init(e,t)}),Xe=/*@__PURE__*/t("$ZodULID",(e,t)=>{t.pattern??(t.pattern=X),Le.init(e,t)}),Qe=/*@__PURE__*/t("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Q),Le.init(e,t)}),et=/*@__PURE__*/t("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=ee),Le.init(e,t)}),tt=/*@__PURE__*/t("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=function(e){const t=_e({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${fe}T(?:${r})$`)}(t)),Le.init(e,t)}),nt=/*@__PURE__*/t("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=me),Le.init(e,t)}),rt=/*@__PURE__*/t("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=new RegExp(`^${_e(t)}$`)),Le.init(e,t)}),it=/*@__PURE__*/t("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=ne),Le.init(e,t)}),st=/*@__PURE__*/t("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=oe),Le.init(e,t),e._zod.bag.format="ipv4"}),ot=/*@__PURE__*/t("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=ae),Le.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),at=/*@__PURE__*/t("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=ue),Le.init(e,t)}),ut=/*@__PURE__*/t("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=ce),Le.init(e,t),e._zod.check=n=>{const r=n.value.split("/");try{if(2!==r.length)throw new Error;const[e,t]=r;if(!t)throw new Error;const n=Number(t);if(`${n}`!==t)throw new Error;if(n<0||n>128)throw new Error;new URL(`http://[${e}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function ct(e){if(""===e)return!0;if(/\s/.test(e))return!1;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var dt=/*@__PURE__*/t("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=de),Le.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{ct(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});var lt=/*@__PURE__*/t("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=le),Le.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{(function(e){if(!le.test(e))return!1;const t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return ct(t.padEnd(4*Math.ceil(t.length/4),"="))})(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),pt=/*@__PURE__*/t("$ZodE164",(e,t)=>{t.pattern??(t.pattern=he),Le.init(e,t)});var ht=/*@__PURE__*/t("$ZodJWT",(e,t)=>{Le.init(e,t),e._zod.check=n=>{(function(e,t=null){try{const n=e.split(".");if(3!==n.length)return!1;const[r]=n;if(!r)return!1;const i=JSON.parse(atob(r));return!("typ"in i&&"JWT"!==i?.typ||!i.alg||t&&(!("alg"in i)||i.alg!==t))}catch{return!1}})(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),ft=/*@__PURE__*/t("$ZodNumber",(e,t)=>{Fe.init(e,t),e._zod.pattern=e._zod.bag.pattern??ye,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch(o){}const i=n.value;if("number"==typeof i&&!Number.isNaN(i)&&Number.isFinite(i))return n;const s="number"==typeof i?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...s?{received:s}:{}}),n}}),mt=/*@__PURE__*/t("$ZodNumberFormat",(e,t)=>{Ie.init(e,t),ft.init(e,t)}),_t=/*@__PURE__*/t("$ZodBoolean",(e,t)=>{Fe.init(e,t),e._zod.pattern=ge,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Boolean(n.value)}catch(s){}const i=n.value;return"boolean"==typeof i||n.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),n}}),vt=/*@__PURE__*/t("$ZodUnknown",(e,t)=>{Fe.init(e,t),e._zod.parse=e=>e}),yt=/*@__PURE__*/t("$ZodNever",(e,t)=>{Fe.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});function gt(e,t,n){e.issues.length&&t.issues.push(...T(n,e.issues)),t.value[n]=e.value}var bt=/*@__PURE__*/t("$ZodArray",(e,t)=>{Fe.init(e,t),e._zod.parse=(n,r)=>{const i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),n;n.value=Array(i.length);const s=[];for(let e=0;e<i.length;e++){const o=i[e],a=t.element._zod.run({value:o,issues:[]},r);a instanceof Promise?s.push(a.then(t=>gt(t,n,e))):gt(a,n,e)}return s.length?Promise.all(s).then(()=>n):n}});function wt(e,t,n,r,i,s){const o=n in r;if(e.issues.length){if(i&&s&&!o)return;t.issues.push(...T(n,e.issues))}o||i?void 0===e.value?o&&(t.value[n]=void 0):t.value[n]=e.value:e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]})}function zt(e){const t=Object.keys(e.shape);for(const i of t)if(!e.shape?.[i]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${i}": expected a Zod schema`);const n=(r=e.shape,Object.keys(r).filter(e=>"optional"===r[e]._zod.optin&&"optional"===r[e]._zod.optout));var r;return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function kt(e,t,n,r,i,s){const o=[],a=i.keySet,u=i.catchall._zod,c=u.def.type,d="optional"===u.optin,l="optional"===u.optout;for(const p in t){if("__proto__"===p)continue;if(a.has(p))continue;if("never"===c){o.push(p);continue}const i=u.run({value:t[p],issues:[]},r);i instanceof Promise?e.push(i.then(e=>wt(e,n,p,t,d,l))):wt(i,n,p,t,d,l)}return o.length&&n.issues.push({code:"unrecognized_keys",keys:o,input:t,inst:s}),e.length?Promise.all(e).then(()=>n):n}var St=/*@__PURE__*/t("$ZodObject",(e,t)=>{if(Fe.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const e=t.shape;Object.defineProperty(t,"shape",{get:()=>{const n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}const n=u(()=>zt(t));p(e._zod,"propValues",()=>{const e=t.shape,n={};for(const t in e){const r=e[t]._zod;if(r.values){n[t]??(n[t]=/* @__PURE__ */new Set);for(const e of r.values)n[t].add(e)}}return n});const r=v,i=t.catchall;let s;e._zod.parse=(t,o)=>{s??(s=n.value);const a=t.value;if(!r(a))return t.issues.push({expected:"object",code:"invalid_type",input:a,inst:e}),t;t.value={};const u=[],c=s.shape;for(const e of s.keys){const n=c[e],r="optional"===n._zod.optin,i="optional"===n._zod.optout,s=n._zod.run({value:a[e],issues:[]},o);s instanceof Promise?u.push(s.then(n=>wt(n,t,e,a,r,i))):wt(s,t,e,a,r,i)}return i?kt(u,a,t,o,n.value,e):u.length?Promise.all(u).then(()=>t):t}}),Et=/*@__PURE__*/t("$ZodObjectJIT",(e,t)=>{St.init(e,t);const n=e._zod.parse,r=u(()=>zt(t));let s;const o=v,a=!i.jitless,c=a&&y.value,d=t.catchall;let l;e._zod.parse=(i,u)=>{l??(l=r.value);const p=i.value;return o(p)?a&&c&&!1===u?.async&&!0!==u.jitless?(s||(s=(e=>{const t=new Ce(["shape","payload","ctx"]),n=r.value,i=e=>{const t=m(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const s=Object.create(null);let o=0;for(const r of n.keys)s[r]="key_"+o++;t.write("const newResult = {};");for(const r of n.keys){const n=s[r],o=m(r),a=e[r],u="optional"===a?._zod?.optin,c="optional"===a?._zod?.optout;t.write(`const ${n} = ${i(r)};`),u&&c?t.write(`\n if (${n}.issues.length) {\n if (${o} in input) {\n payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${o}, ...iss.path] : [${o}]\n })));\n }\n }\n \n if (${n}.value === undefined) {\n if (${o} in input) {\n newResult[${o}] = undefined;\n }\n } else {\n newResult[${o}] = ${n}.value;\n }\n \n `):u?t.write(`\n if (${n}.issues.length) {\n payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${o}, ...iss.path] : [${o}]\n })));\n }\n \n if (${n}.value === undefined) {\n if (${o} in input) {\n newResult[${o}] = undefined;\n }\n } else {\n newResult[${o}] = ${n}.value;\n }\n \n `):t.write(`\n const ${n}_present = ${o} in input;\n if (${n}.issues.length) {\n payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${o}, ...iss.path] : [${o}]\n })));\n }\n if (!${n}_present && !${n}.issues.length) {\n payload.issues.push({\n code: "invalid_type",\n expected: "nonoptional",\n input: undefined,\n path: [${o}]\n });\n }\n\n if (${n}_present) {\n if (${n}.value === undefined) {\n newResult[${o}] = undefined;\n } else {\n newResult[${o}] = ${n}.value;\n }\n }\n\n `)}t.write("payload.value = newResult;"),t.write("return payload;");const a=t.compile();return(t,n)=>a(e,t,n)})(t.shape)),i=s(i,u),d?kt([],p,i,u,l,e):i):n(i,u):(i.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),i)}});function $t(e,t,n,r){for(const s of e)if(0===s.issues.length)return t.value=s.value,t;const i=e.filter(e=>!$(e));return 1===i.length?(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=>P(e,r,s())))}),t)}var It=/*@__PURE__*/t("$ZodUnion",(e,t)=>{Fe.init(e,t),p(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),p(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),p(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),p(e._zod,"pattern",()=>{if(t.options.every(e=>e._zod.pattern)){const e=t.options.map(e=>e._zod.pattern);return new RegExp(`^(${e.map(e=>d(e.source)).join("|")})$`)}});const n=1===t.options.length?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let s=!1;const o=[];for(const e of t.options){const t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),s=!0;else{if(0===t.issues.length)return t;o.push(t)}}return s?Promise.all(o).then(t=>$t(t,r,e,i)):$t(o,r,e,i)}}),Tt=/*@__PURE__*/t("$ZodIntersection",(e,t)=>{Fe.init(e,t),e._zod.parse=(e,n)=>{const r=e.value,i=t.left._zod.run({value:r,issues:[]},n),s=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||s instanceof Promise?Promise.all([i,s]).then(([t,n])=>Pt(e,t,n)):Pt(e,i,s)}});function Ot(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(g(e)&&g(t)){const n=Object.keys(t),r=Object.keys(e).filter(e=>-1!==n.indexOf(e)),i={...e,...t};for(const s of r){const n=Ot(e[s],t[s]);if(!n.valid)return{valid:!1,mergeErrorPath:[s,...n.mergeErrorPath]};i[s]=n.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const i=Ot(e[r],t[r]);if(!i.valid)return{valid:!1,mergeErrorPath:[r,...i.mergeErrorPath]};n.push(i.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Pt(e,t,n){const r=/* @__PURE__ */new Map;let i;for(const a of t.issues)if("unrecognized_keys"===a.code){i??(i=a);for(const e of a.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(a);for(const a of n.issues)if("unrecognized_keys"===a.code)for(const e of a.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(a);const s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length&&i&&e.issues.push({...i,keys:s}),$(e))return e;const o=Ot(t.value,n.value);if(!o.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var xt=/*@__PURE__*/t("$ZodRecord",(e,t)=>{Fe.init(e,t),e._zod.parse=(n,r)=>{const i=n.value;if(!g(i))return n.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),n;const o=[],a=t.keyType._zod.values;if(a){n.value={};const u=/* @__PURE__ */new Set;for(const d of a)if("string"==typeof d||"number"==typeof d||"symbol"==typeof d){u.add("number"==typeof d?d.toString():d);const a=t.keyType._zod.run({value:d,issues:[]},r);if(a instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(a.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:a.issues.map(e=>P(e,r,s())),input:d,path:[d],inst:e});continue}const c=a.value,l=t.valueType._zod.run({value:i[d],issues:[]},r);l instanceof Promise?o.push(l.then(e=>{e.issues.length&&n.issues.push(...T(d,e.issues)),n.value[c]=e.value})):(l.issues.length&&n.issues.push(...T(d,l.issues)),n.value[c]=l.value)}let c;for(const e in i)u.has(e)||(c=c??[],c.push(e));c&&c.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:c})}else{n.value={};for(const a of Reflect.ownKeys(i)){if("__proto__"===a)continue;if(!Object.prototype.propertyIsEnumerable.call(i,a))continue;let u=t.keyType._zod.run({value:a,issues:[]},r);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if("string"==typeof a&&ye.test(a)&&u.issues.length){const e=t.keyType._zod.run({value:Number(a),issues:[]},r);if(e instanceof Promise)throw new Error("Async schemas not supported in object keys currently");0===e.issues.length&&(u=e)}if(u.issues.length){"loose"===t.mode?n.value[a]=i[a]:n.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map(e=>P(e,r,s())),input:a,path:[a],inst:e});continue}const c=t.valueType._zod.run({value:i[a],issues:[]},r);c instanceof Promise?o.push(c.then(e=>{e.issues.length&&n.issues.push(...T(a,e.issues)),n.value[u.value]=e.value})):(c.issues.length&&n.issues.push(...T(a,c.issues)),n.value[u.value]=c.value)}}return o.length?Promise.all(o).then(()=>n):n}}),Nt=/*@__PURE__*/t("$ZodEnum",(e,t)=>{Fe.init(e,t);const n=o(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(e=>w.has(typeof e)).map(e=>"string"==typeof e?z(e):e.toString()).join("|")})$`),e._zod.parse=(t,i)=>{const s=t.value;return r.has(s)||t.issues.push({code:"invalid_value",values:n,input:s,inst:e}),t}}),At=/*@__PURE__*/t("$ZodLiteral",(e,t)=>{if(Fe.init(e,t),0===t.values.length)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(e=>"string"==typeof e?z(e):e?z(e.toString()):String(e)).join("|")})$`),e._zod.parse=(r,i)=>{const s=r.value;return n.has(s)||r.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),r}}),Zt=/*@__PURE__*/t("$ZodTransform",(e,t)=>{Fe.init(e,t),e._zod.optin="optional",e._zod.parse=(i,s)=>{if("backward"===s.direction)throw new r(e.constructor.name);const o=t.transform(i.value,i);if(s.async)return(o instanceof Promise?o:Promise.resolve(o)).then(e=>(i.value=e,i.fallback=!0,i));if(o instanceof Promise)throw new n;return i.value=o,i.fallback=!0,i}});function qt(e,t){return void 0===t&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var jt=/*@__PURE__*/t("$ZodOptional",(e,t)=>{Fe.init(e,t),e._zod.optin="optional",e._zod.optout="optional",p(e._zod,"values",()=>t.innerType._zod.values?/* @__PURE__ */new Set([...t.innerType._zod.values,void 0]):void 0),p(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${d(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if("optional"===t.innerType._zod.optin){const r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>qt(e,r)):qt(i,r)}return void 0===e.value?e:t.innerType._zod.run(e,n)}}),Dt=/*@__PURE__*/t("$ZodExactOptional",(e,t)=>{jt.init(e,t),p(e._zod,"values",()=>t.innerType._zod.values),p(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Rt=/*@__PURE__*/t("$ZodNullable",(e,t)=>{Fe.init(e,t),p(e._zod,"optin",()=>t.innerType._zod.optin),p(e._zod,"optout",()=>t.innerType._zod.optout),p(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${d(e.source)}|null)$`):void 0}),p(e._zod,"values",()=>t.innerType._zod.values?/* @__PURE__ */new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>null===e.value?e:t.innerType._zod.run(e,n)}),Ct=/*@__PURE__*/t("$ZodDefault",(e,t)=>{Fe.init(e,t),e._zod.optin="optional",p(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);if(void 0===e.value)return e.value=t.defaultValue,e;const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Ut(e,t)):Ut(r,t)}});function Ut(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}var Ft=/*@__PURE__*/t("$ZodPrefault",(e,t)=>{Fe.init(e,t),e._zod.optin="optional",p(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>("backward"===n.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Jt=/*@__PURE__*/t("$ZodNonOptional",(e,t)=>{Fe.init(e,t),p(e._zod,"values",()=>{const e=t.innerType._zod.values;return e?new Set([...e].filter(e=>void 0!==e)):void 0}),e._zod.parse=(n,r)=>{const i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Lt(t,e)):Lt(i,e)}});function Lt(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}var Mt=/*@__PURE__*/t("$ZodCatch",(e,t)=>{Fe.init(e,t),e._zod.optin="optional",p(e._zod,"optout",()=>t.innerType._zod.optout),p(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>P(e,n,s()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>P(e,n,s()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),Vt=/*@__PURE__*/t("$ZodPipe",(e,t)=>{Fe.init(e,t),p(e._zod,"values",()=>t.in._zod.values),p(e._zod,"optin",()=>t.in._zod.optin),p(e._zod,"optout",()=>t.out._zod.optout),p(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if("backward"===n.direction){const r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Kt(e,t.in,n)):Kt(r,t.in,n)}const r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Kt(e,t.out,n)):Kt(r,t.out,n)}});function Kt(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}var Wt=/*@__PURE__*/t("$ZodReadonly",(e,t)=>{Fe.init(e,t),p(e._zod,"propValues",()=>t.innerType._zod.propValues),p(e._zod,"values",()=>t.innerType._zod.values),p(e._zod,"optin",()=>t.innerType?._zod?.optin),p(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Bt):Bt(r)}});function Bt(e){return e.value=Object.freeze(e.value),e}var Gt,Ht=/*@__PURE__*/t("$ZodCustom",(e,t)=>{ze.init(e,t),Fe.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{const r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Yt(t,n,r,e));Yt(i,n,r,e)}});function Yt(e,t,n,r){if(!e){const 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(N(e))}}var Xt=class{constructor(){this._map=/* @__PURE__ */new WeakMap,this._idmap=/* @__PURE__ */new Map}add(e,...t){const n=t[0];return this._map.set(e,n),n&&"object"==typeof n&&"id"in n&&this._idmap.set(n.id,e),this}clear(){return this._map=/* @__PURE__ */new WeakMap,this._idmap=/* @__PURE__ */new Map,this}remove(e){const t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const n={...this.get(t)??{}};delete n.id;const 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)}};(Gt=globalThis).__zod_globalRegistry??(Gt.__zod_globalRegistry=new Xt);var Qt=globalThis.__zod_globalRegistry;function en(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...S(t)})}function tn(e,t){return new Se({check:"less_than",...S(t),value:e,inclusive:!1})}function nn(e,t){return new Se({check:"less_than",...S(t),value:e,inclusive:!0})}function rn(e,t){return new Ee({check:"greater_than",...S(t),value:e,inclusive:!1})}function sn(e,t){return new Ee({check:"greater_than",...S(t),value:e,inclusive:!0})}function on(e,t){return new $e({check:"multiple_of",...S(t),value:e})}function an(e,t){return new Te({check:"max_length",...S(t),maximum:e})}function un(e,t){return new Oe({check:"min_length",...S(t),minimum:e})}function cn(e,t){return new Pe({check:"length_equals",...S(t),length:e})}function dn(e){return new Re({check:"overwrite",tx:e})}function ln(e,t){const n=new ze({check:"custom",...S(t)});return n._zod.check=e,n}function pn(e){let t=e?.target??"draft-2020-12";return"draft-4"===t&&(t="draft-04"),"draft-7"===t&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??Qt,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:/* @__PURE__ */new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function hn(e,t,n={path:[],schemaPath:[]}){var r;const i=e._zod.def,s=t.seen.get(e);if(s)return s.count++,n.schemaPath.includes(e)&&(s.cycle=n.path),s.schema;const o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);const a=e._zod.toJSONSchema?.();if(a)o.schema=a;else{const r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{const n=o.schema,s=t.processors[i.type];if(!s)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);s(e,t,n,r)}const s=e._zod.parent;s&&(o.ref||(o.ref=s),hn(s,t,r),t.seen.get(s).isParent=!0)}const u=t.metadataRegistry.get(e);return u&&Object.assign(o.schema,u),"input"===t.io&&_n(e)&&(delete o.schema.examples,delete o.schema.default),"input"===t.io&&"_prefault"in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function fn(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=/* @__PURE__ */new Map;for(const s of e.seen.entries()){const t=e.metadataRegistry.get(s[0])?.id;if(t){const e=r.get(t);if(e&&e!==s[0])throw new Error(`Duplicate schema id "${t}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(t,s[0])}}const i=t=>{if(t[1].schema.$ref)return;const r=t[1],{ref:i,defId:s}=(t=>{const r="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){const n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};const s=t[1].defId??t[1].schema.id??"schema"+e.counter++;return t[1].defId=s,{defId:s,ref:`${i("__shared")}#/${r}/${s}`}}if(t[1]===n)return{ref:"#"};const i=`#/${r}/`,s=t[1].schema.id??"__schema"+e.counter++;return{defId:s,ref:i+s}})(t);r.def={...r.schema},s&&(r.defId=s);const o=r.schema;for(const e in o)delete o[e];o.$ref=i};if("throw"===e.cycles)for(const s of e.seen.entries()){const e=s[1];if(e.cycle)throw new Error(`Cycle detected: #/${e.cycle?.join("/")}/<root>\n\nSet the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const s of e.seen.entries()){const n=s[1];if(t!==s[0]){if(e.external){const n=e.external.registry.get(s[0])?.id;if(t!==s[0]&&n){i(s);continue}}(e.metadataRegistry.get(s[0])?.id||n.cycle||n.count>1&&"ref"===e.reused)&&i(s)}else i(s)}}function mn(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=t=>{const n=e.seen.get(t);if(null===n.ref)return;const i=n.def??n.schema,s={...i},o=n.ref;if(n.ref=null,o){r(o);const n=e.seen.get(o),a=n.schema;if(!a.$ref||"draft-07"!==e.target&&"draft-04"!==e.target&&"openapi-3.0"!==e.target?Object.assign(i,a):(i.allOf=i.allOf??[],i.allOf.push(a)),Object.assign(i,s),t._zod.parent===o)for(const e in i)"$ref"!==e&&"allOf"!==e&&(e in s||delete i[e]);if(a.$ref&&n.def)for(const e in i)"$ref"!==e&&"allOf"!==e&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}const a=t._zod.parent;if(a&&a!==o){r(a);const t=e.seen.get(a);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(const e in i)"$ref"!==e&&"allOf"!==e&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(const u of[...e.seen.entries()].reverse())r(u[0]);const i={};if("draft-2020-12"===e.target?i.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?i.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?i.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const n=e.external.registry.get(t)?.id;if(!n)throw new Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);const s=e.metadataRegistry.get(t)?.id;void 0!==s&&i.id===s&&delete i.id;const o=e.external?.defs??{};for(const u of e.seen.entries()){const e=u[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&("draft-2020-12"===e.target?i.$defs=o:i.definitions=o);try{const n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t["~standard"],jsonSchema:{input:vn(t,"input",e.processors),output:vn(t,"output",e.processors)}},enumerable:!1,writable:!1}),n}catch(a){throw new Error("Error converting schema to JSON.")}}function _n(e,t){const n=t??{seen:/* @__PURE__ */new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if("transform"===r.type)return!0;if("array"===r.type)return _n(r.element,n);if("set"===r.type)return _n(r.valueType,n);if("lazy"===r.type)return _n(r.getter(),n);if("promise"===r.type||"optional"===r.type||"nonoptional"===r.type||"nullable"===r.type||"readonly"===r.type||"default"===r.type||"prefault"===r.type)return _n(r.innerType,n);if("intersection"===r.type)return _n(r.left,n)||_n(r.right,n);if("record"===r.type||"map"===r.type)return _n(r.keyType,n)||_n(r.valueType,n);if("pipe"===r.type)return!!e._zod.traits.has("$ZodCodec")||(_n(r.in,n)||_n(r.out,n));if("object"===r.type){for(const e in r.shape)if(_n(r.shape[e],n))return!0;return!1}if("union"===r.type){for(const e of r.options)if(_n(e,n))return!0;return!1}if("tuple"===r.type){for(const e of r.items)if(_n(e,n))return!0;return!(!r.rest||!_n(r.rest,n))}return!1}var vn=(e,t,n={})=>r=>{const{libraryOptions:i,target:s}=r??{},o=pn({...i??{},target:s,io:t,processors:n});return hn(e,o),fn(o,e),mn(o,e)},yn={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},gn=(e,t,n,r)=>{const i=e._zod.def;hn(i.innerType,t,r);t.seen.get(e).ref=i.innerType},bn=/*@__PURE__*/t("ZodISODateTime",(e,t)=>{tt.init(e,t),Bn.init(e,t)});function wn(e){return function(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...S(t)})}(bn,e)}var zn=/*@__PURE__*/t("ZodISODate",(e,t)=>{nt.init(e,t),Bn.init(e,t)});function kn(e){return function(e,t){return new e({type:"string",format:"date",check:"string_format",...S(t)})}(zn,e)}var Sn=/*@__PURE__*/t("ZodISOTime",(e,t)=>{rt.init(e,t),Bn.init(e,t)});function En(e){return function(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...S(t)})}(Sn,e)}var $n=/*@__PURE__*/t("ZodISODuration",(e,t)=>{it.init(e,t),Bn.init(e,t)});function In(e){return function(e,t){return new e({type:"string",format:"duration",check:"string_format",...S(t)})}($n,e)}var Tn=(e,t)=>{Z.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>function(e,t=e=>e.message){const n={_errors:[]},r=(e,i=[])=>{for(const s of e.issues)if("invalid_union"===s.code&&s.errors.length)s.errors.map(e=>r({issues:e},[...i,...s.path]));else if("invalid_key"===s.code)r({issues:s.issues},[...i,...s.path]);else if("invalid_element"===s.code)r({issues:s.issues},[...i,...s.path]);else{const e=[...i,...s.path];if(0===e.length)n._errors.push(t(s));else{let r=n,i=0;for(;i<e.length;){const n=e[i];i!==e.length-1?r[n]=r[n]||{_errors:[]}:(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(s))),r=r[n],i++}}}};return r(e),n}(e,t)},flatten:{value:t=>function(e,t=e=>e.message){const n={},r=[];for(const i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,a,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,a,2)}},isEmpty:{get:()=>0===e.issues.length}})},On=/*@__PURE__*/t("ZodError",Tn,{Parent:Error}),Pn=/* @__PURE__ */j(On),xn=/* @__PURE__ */D(On),Nn=/* @__PURE__ */R(On),An=/* @__PURE__ */U(On),Zn=/* @__PURE__ */J(On),qn=/* @__PURE__ */L(On),jn=/* @__PURE__ */M(On),Dn=/* @__PURE__ */V(On),Rn=/* @__PURE__ */K(On),Cn=/* @__PURE__ */W(On),Un=/* @__PURE__ */B(On),Fn=/* @__PURE__ */G(On),Jn=/* @__PURE__ */new WeakMap;function Ln(e,t,n){const r=Object.getPrototypeOf(e);let i=Jn.get(r);if(i||(i=/* @__PURE__ */new Set,Jn.set(r,i)),!i.has(t)){i.add(t);for(const e in n){const t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){const n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}var Mn=/*@__PURE__*/t("ZodType",(e,t)=>(Fe.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:vn(e,"input"),output:vn(e,"output")}}),e.toJSONSchema=((e,t={})=>n=>{const r=pn({...n,processors:t});return hn(e,r),fn(r,e),mn(r,e)})(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>Pn(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Nn(e,t,n),e.parseAsync=async(t,n)=>xn(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>An(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Zn(e,t,n),e.decode=(t,n)=>qn(e,t,n),e.encodeAsync=async(t,n)=>jn(e,t,n),e.decodeAsync=async(t,n)=>Dn(e,t,n),e.safeEncode=(t,n)=>Rn(e,t,n),e.safeDecode=(t,n)=>Cn(e,t,n),e.safeEncodeAsync=async(t,n)=>Un(e,t,n),e.safeDecodeAsync=async(t,n)=>Fn(e,t,n),Ln(e,"ZodType",{check(...e){const t=this.def;return this.clone(f(t,{checks:[...t.checks??[],...e.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return k(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(function(e,t={}){return function(e,t,n){return new e({type:"custom",check:"custom",fn:t,...S(n)})}(Gr,e,t)}(e,t))},superRefine(e,t){return this.check(function(e,t){return function(e,t){const n=/* @__PURE__ */ln(t=>(t.addIssue=e=>{if("string"==typeof e)t.issues.push(N(e,t.value,n._zod.def));else{const r=e;r.fatal&&(r.continue=!1),r.code??(r.code="custom"),r.input??(r.input=t.value),r.inst??(r.inst=n),r.continue??(r.continue=!n._zod.def.abort),t.issues.push(N(r))}},e(t.value,t)),t);return n}(e,t)}(e,t))},overwrite(e){return this.check(dn(e))},optional(){return Rr(this)},exactOptional(){return new Cr({type:"optional",innerType:this})},nullable(){return Fr(this)},nullish(){return Rr(Fr(this))},nonoptional(e){return function(e,t){return new Mr({type:"nonoptional",innerType:e,...S(t)})}(this,e)},array(){return Er(this)},or(e){return Or([this,e])},and(e){return new Pr({type:"intersection",left:this,right:e})},transform(e){return Wr(this,new jr({type:"transform",transform:e}))},default(e){return t=e,new Jr({type:"default",innerType:this,get defaultValue(){return"function"==typeof t?t():b(t)}});var t},prefault(e){return t=e,new Lr({type:"prefault",innerType:this,get defaultValue(){return"function"==typeof t?t():b(t)}});var t},catch(e){return new Vr({type:"catch",innerType:this,catchValue:"function"==typeof(t=e)?t:()=>t});var t},pipe(e){return Wr(this,e)},readonly(){return new Br({type:"readonly",innerType:this})},describe(e){const t=this.clone();return Qt.add(t,{description:e}),t},meta(...e){if(0===e.length)return Qt.get(this);const t=this.clone();return Qt.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get:()=>Qt.get(e)?.description,configurable:!0}),e)),Vn=/*@__PURE__*/t("_ZodString",(e,t)=>{Je.init(e,t),Mn.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n)=>{const r=n;r.type="string";const{minimum:i,maximum:s,format:o,patterns:a,contentEncoding:u}=e._zod.bag;if("number"==typeof i&&(r.minLength=i),"number"==typeof s&&(r.maxLength=s),o&&(r.format=yn[o]??o,""===r.format&&delete r.format,"time"===o&&delete r.format),u&&(r.contentEncoding=u),a&&a.size>0){const e=[...a];1===e.length?r.pattern=e[0].source:e.length>1&&(r.allOf=[...e.map(e=>({..."draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target?{type:"string"}:{},pattern:e.source}))])}})(e,t,n);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,Ln(e,"_ZodString",{regex(...e){return this.check(function(e,t){return new Ne({check:"string_format",format:"regex",...S(t),pattern:e})}(...e))},includes(...e){return this.check(function(e,t){return new qe({check:"string_format",format:"includes",...S(t),includes:e})}(...e))},startsWith(...e){return this.check(function(e,t){return new je({check:"string_format",format:"starts_with",...S(t),prefix:e})}(...e))},endsWith(...e){return this.check(function(e,t){return new De({check:"string_format",format:"ends_with",...S(t),suffix:e})}(...e))},min(...e){return this.check(un(...e))},max(...e){return this.check(an(...e))},length(...e){return this.check(cn(...e))},nonempty(...e){return this.check(un(1,...e))},lowercase(e){return this.check(function(e){return new Ae({check:"string_format",format:"lowercase",...S(e)})}(e))},uppercase(e){return this.check(function(e){return new Ze({check:"string_format",format:"uppercase",...S(e)})}(e))},trim(){return this.check(/* @__PURE__ */dn(e=>e.trim()))},normalize(...e){return this.check(function(e){/* @__PURE__ */
|
|
2
|
-
return dn(t=>t.normalize(e))}(...e))},toLowerCase(){return this.check(/* @__PURE__ */dn(e=>e.toLowerCase()))},toUpperCase(){return this.check(/* @__PURE__ */dn(e=>e.toUpperCase()))},slugify(){return this.check(/* @__PURE__ */dn(e=>function(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}(e)))}})}),Kn=/*@__PURE__*/t("ZodString",(e,t)=>{Je.init(e,t),Vn.init(e,t),e.email=t=>e.check(function(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...S(t)})}(Gn,t)),e.url=t=>e.check(function(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...S(t)})}(Xn,t)),e.jwt=t=>e.check(function(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...S(t)})}(hr,t)),e.emoji=t=>e.check(function(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...S(t)})}(Qn,t)),e.guid=t=>e.check(en(Hn,t)),e.uuid=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...S(t)})}(Yn,t)),e.uuidv4=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...S(t)})}(Yn,t)),e.uuidv6=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...S(t)})}(Yn,t)),e.uuidv7=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...S(t)})}(Yn,t)),e.nanoid=t=>e.check(function(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...S(t)})}(er,t)),e.guid=t=>e.check(en(Hn,t)),e.cuid=t=>e.check(function(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...S(t)})}(tr,t)),e.cuid2=t=>e.check(function(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...S(t)})}(nr,t)),e.ulid=t=>e.check(function(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...S(t)})}(rr,t)),e.base64=t=>e.check(function(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...S(t)})}(dr,t)),e.base64url=t=>e.check(function(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...S(t)})}(lr,t)),e.xid=t=>e.check(function(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...S(t)})}(ir,t)),e.ksuid=t=>e.check(function(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...S(t)})}(sr,t)),e.ipv4=t=>e.check(function(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...S(t)})}(or,t)),e.ipv6=t=>e.check(function(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...S(t)})}(ar,t)),e.cidrv4=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...S(t)})}(ur,t)),e.cidrv6=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...S(t)})}(cr,t)),e.e164=t=>e.check(function(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...S(t)})}(pr,t)),e.datetime=t=>e.check(wn(t)),e.date=t=>e.check(kn(t)),e.time=t=>e.check(En(t)),e.duration=t=>e.check(In(t))});function Wn(e){return function(e,t){return new e({type:"string",...S(t)})}(Kn,e)}var Bn=/*@__PURE__*/t("ZodStringFormat",(e,t)=>{Le.init(e,t),Vn.init(e,t)}),Gn=/*@__PURE__*/t("ZodEmail",(e,t)=>{Ke.init(e,t),Bn.init(e,t)}),Hn=/*@__PURE__*/t("ZodGUID",(e,t)=>{Me.init(e,t),Bn.init(e,t)}),Yn=/*@__PURE__*/t("ZodUUID",(e,t)=>{Ve.init(e,t),Bn.init(e,t)}),Xn=/*@__PURE__*/t("ZodURL",(e,t)=>{We.init(e,t),Bn.init(e,t)}),Qn=/*@__PURE__*/t("ZodEmoji",(e,t)=>{Be.init(e,t),Bn.init(e,t)}),er=/*@__PURE__*/t("ZodNanoID",(e,t)=>{Ge.init(e,t),Bn.init(e,t)}),tr=/*@__PURE__*/t("ZodCUID",(e,t)=>{He.init(e,t),Bn.init(e,t)}),nr=/*@__PURE__*/t("ZodCUID2",(e,t)=>{Ye.init(e,t),Bn.init(e,t)}),rr=/*@__PURE__*/t("ZodULID",(e,t)=>{Xe.init(e,t),Bn.init(e,t)}),ir=/*@__PURE__*/t("ZodXID",(e,t)=>{Qe.init(e,t),Bn.init(e,t)}),sr=/*@__PURE__*/t("ZodKSUID",(e,t)=>{et.init(e,t),Bn.init(e,t)}),or=/*@__PURE__*/t("ZodIPv4",(e,t)=>{st.init(e,t),Bn.init(e,t)}),ar=/*@__PURE__*/t("ZodIPv6",(e,t)=>{ot.init(e,t),Bn.init(e,t)}),ur=/*@__PURE__*/t("ZodCIDRv4",(e,t)=>{at.init(e,t),Bn.init(e,t)}),cr=/*@__PURE__*/t("ZodCIDRv6",(e,t)=>{ut.init(e,t),Bn.init(e,t)}),dr=/*@__PURE__*/t("ZodBase64",(e,t)=>{dt.init(e,t),Bn.init(e,t)}),lr=/*@__PURE__*/t("ZodBase64URL",(e,t)=>{lt.init(e,t),Bn.init(e,t)}),pr=/*@__PURE__*/t("ZodE164",(e,t)=>{pt.init(e,t),Bn.init(e,t)}),hr=/*@__PURE__*/t("ZodJWT",(e,t)=>{ht.init(e,t),Bn.init(e,t)}),fr=/*@__PURE__*/t("ZodNumber",(e,t)=>{ft.init(e,t),Mn.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n)=>{const r=n,{minimum:i,maximum:s,format:o,multipleOf:a,exclusiveMaximum:u,exclusiveMinimum:c}=e._zod.bag;"string"==typeof o&&o.includes("int")?r.type="integer":r.type="number";const d="number"==typeof c&&c>=(i??Number.NEGATIVE_INFINITY),l="number"==typeof u&&u<=(s??Number.POSITIVE_INFINITY),p="draft-04"===t.target||"openapi-3.0"===t.target;d?p?(r.minimum=c,r.exclusiveMinimum=!0):r.exclusiveMinimum=c:"number"==typeof i&&(r.minimum=i),l?p?(r.maximum=u,r.exclusiveMaximum=!0):r.exclusiveMaximum=u:"number"==typeof s&&(r.maximum=s),"number"==typeof a&&(r.multipleOf=a)})(e,t,n),Ln(e,"ZodNumber",{gt(e,t){return this.check(rn(e,t))},gte(e,t){return this.check(sn(e,t))},min(e,t){return this.check(sn(e,t))},lt(e,t){return this.check(tn(e,t))},lte(e,t){return this.check(nn(e,t))},max(e,t){return this.check(nn(e,t))},int(e){return this.check(vr(e))},safe(e){return this.check(vr(e))},positive(e){return this.check(rn(0,e))},nonnegative(e){return this.check(sn(0,e))},negative(e){return this.check(tn(0,e))},nonpositive(e){return this.check(nn(0,e))},multipleOf(e,t){return this.check(on(e,t))},step(e,t){return this.check(on(e,t))},finite(){return this}});const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function mr(e){return function(e,t){return new e({type:"number",checks:[],...S(t)})}(fr,e)}var _r=/*@__PURE__*/t("ZodNumberFormat",(e,t)=>{mt.init(e,t),fr.init(e,t)});function vr(e){return function(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...S(t)})}(_r,e)}var yr=/*@__PURE__*/t("ZodBoolean",(e,t)=>{_t.init(e,t),Mn.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t,n)=>{n.type="boolean"})(0,0,t)});function gr(e){return function(e,t){return new e({type:"boolean",...S(t)})}(yr,e)}var br=/*@__PURE__*/t("ZodUnknown",(e,t)=>{vt.init(e,t),Mn.init(e,t),e._zod.processJSONSchema=(e,t,n)=>{}});function wr(){return new br({type:"unknown"})}var zr=/*@__PURE__*/t("ZodNever",(e,t)=>{yt.init(e,t),Mn.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t,n)=>{n.not={}})(0,0,t)});function kr(e){return function(e,t){return new e({type:"never",...S(t)})}(zr,e)}var Sr=/*@__PURE__*/t("ZodArray",(e,t)=>{bt.init(e,t),Mn.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=n,s=e._zod.def,{minimum:o,maximum:a}=e._zod.bag;"number"==typeof o&&(i.minItems=o),"number"==typeof a&&(i.maxItems=a),i.type="array",i.items=hn(s.element,t,{...r,path:[...r.path,"items"]})})(e,t,n,r),e.element=t.element,Ln(e,"ZodArray",{min(e,t){return this.check(un(e,t))},nonempty(e){return this.check(un(1,e))},max(e,t){return this.check(an(e,t))},length(e,t){return this.check(cn(e,t))},unwrap(){return this.element}})});function Er(e,t){return function(e,t,n){return new e({type:"array",element:t,...S(n)})}(Sr,e,t)}var $r=/*@__PURE__*/t("ZodObject",(e,t)=>{Et.init(e,t),Mn.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=n,s=e._zod.def;i.type="object",i.properties={};const o=s.shape;for(const c in o)i.properties[c]=hn(o[c],t,{...r,path:[...r.path,"properties",c]});const a=new Set(Object.keys(o)),u=new Set([...a].filter(e=>{const n=s.shape[e]._zod;return"input"===t.io?void 0===n.optin:void 0===n.optout}));u.size>0&&(i.required=Array.from(u)),"never"===s.catchall?._zod.def.type?i.additionalProperties=!1:s.catchall?s.catchall&&(i.additionalProperties=hn(s.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):"output"===t.io&&(i.additionalProperties=!1)})(e,t,n,r),p(e,"shape",()=>t.shape),Ln(e,"ZodObject",{keyof(){return Ar(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:wr()})},loose(){return this.clone({...this._zod.def,catchall:wr()})},strict(){return this.clone({...this._zod.def,catchall:kr()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return function(e,t){if(!g(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const n=e._zod.def.shape;for(const e in t)if(void 0!==Object.getOwnPropertyDescriptor(n,e))throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return k(e,f(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return h(this,"shape",n),n}}))}(this,e)},safeExtend(e){return function(e,t){if(!g(t))throw new Error("Invalid input to safeExtend: expected a plain object");return k(e,f(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return h(this,"shape",n),n}}))}(this,e)},merge(e){return function(e,t){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");return k(e,f(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return h(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}(this,e)},pick(e){return function(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");return k(e,f(e._zod.def,{get shape(){const e={};for(const r in t){if(!(r in n.shape))throw new Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return h(this,"shape",e),e},checks:[]}))}(this,e)},omit(e){return function(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");return k(e,f(e._zod.def,{get shape(){const r={...e._zod.def.shape};for(const e in t){if(!(e in n.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return h(this,"shape",r),r},checks:[]}))}(this,e)},partial(...e){return function(e,t,n){const r=t._zod.def.checks;if(r&&r.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");return k(t,f(t._zod.def,{get shape(){const r=t._zod.def.shape,i={...r};if(n)for(const t in n){if(!(t in r))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:"optional",innerType:r[t]}):r[t])}else for(const t in r)i[t]=e?new e({type:"optional",innerType:r[t]}):r[t];return h(this,"shape",i),i},checks:[]}))}(Dr,this,e[0])},required(...e){return t=Mr,n=this,r=e[0],k(n,f(n._zod.def,{get shape(){const e=n._zod.def.shape,i={...e};if(r)for(const n in r){if(!(n in i))throw new Error(`Unrecognized key: "${n}"`);r[n]&&(i[n]=new t({type:"nonoptional",innerType:e[n]}))}else for(const n in e)i[n]=new t({type:"nonoptional",innerType:e[n]});return h(this,"shape",i),i}}));var t,n,r}})});function Ir(e,t){const n={type:"object",shape:e??{},...S(t)};return new $r(n)}var Tr=/*@__PURE__*/t("ZodUnion",(e,t)=>{It.init(e,t),Mn.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def,s=!1===i.inclusive,o=i.options.map((e,n)=>hn(e,t,{...r,path:[...r.path,s?"oneOf":"anyOf",n]}));s?n.oneOf=o:n.anyOf=o})(e,t,n,r),e.options=t.options});function Or(e,t){return new Tr({type:"union",options:e,...S(t)})}var Pr=/*@__PURE__*/t("ZodIntersection",(e,t)=>{Tt.init(e,t),Mn.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def,s=hn(i.left,t,{...r,path:[...r.path,"allOf",0]}),o=hn(i.right,t,{...r,path:[...r.path,"allOf",1]}),a=e=>"allOf"in e&&1===Object.keys(e).length;n.allOf=[...a(s)?s.allOf:[s],...a(o)?o.allOf:[o]]})(e,t,n,r)});var xr=/*@__PURE__*/t("ZodRecord",(e,t)=>{xt.init(e,t),Mn.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=n,s=e._zod.def;i.type="object";const o=s.keyType,a=o._zod.bag?.patterns;if("loose"===s.mode&&a&&a.size>0){const e=hn(s.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});i.patternProperties={};for(const t of a)i.patternProperties[t.source]=e}else"draft-07"!==t.target&&"draft-2020-12"!==t.target||(i.propertyNames=hn(s.keyType,t,{...r,path:[...r.path,"propertyNames"]})),i.additionalProperties=hn(s.valueType,t,{...r,path:[...r.path,"additionalProperties"]});const u=o._zod.values;if(u){const e=[...u].filter(e=>"string"==typeof e||"number"==typeof e);e.length>0&&(i.required=e)}})(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});var Nr=/*@__PURE__*/t("ZodEnum",(e,t)=>{Nt.init(e,t),Mn.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n)=>{const r=o(e._zod.def.entries);r.every(e=>"number"==typeof e)&&(n.type="number"),r.every(e=>"string"==typeof e)&&(n.type="string"),n.enum=r})(e,0,n),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{const i={};for(const s of e){if(!n.has(s))throw new Error(`Key ${s} not found in enum`);i[s]=t.entries[s]}return new Nr({...t,checks:[],...S(r),entries:i})},e.exclude=(e,r)=>{const i={...t.entries};for(const t of e){if(!n.has(t))throw new Error(`Key ${t} not found in enum`);delete i[t]}return new Nr({...t,checks:[],...S(r),entries:i})}});function Ar(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new Nr({type:"enum",entries:n,...S(t)})}var Zr=/*@__PURE__*/t("ZodLiteral",(e,t)=>{At.init(e,t),Mn.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n)=>{const r=e._zod.def,i=[];for(const s of r.values)if(void 0===s){if("throw"===t.unrepresentable)throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if("bigint"==typeof s){if("throw"===t.unrepresentable)throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(s))}else i.push(s);if(0===i.length);else if(1===i.length){const e=i[0];n.type=null===e?"null":typeof e,"draft-04"===t.target||"openapi-3.0"===t.target?n.enum=[e]:n.const=e}else i.every(e=>"number"==typeof e)&&(n.type="number"),i.every(e=>"string"==typeof e)&&(n.type="string"),i.every(e=>"boolean"==typeof e)&&(n.type="boolean"),i.every(e=>null===e)&&(n.type="null"),n.enum=i})(e,t,n),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function qr(e,t){return new Zr({type:"literal",values:Array.isArray(e)?e:[e],...S(t)})}var jr=/*@__PURE__*/t("ZodTransform",(e,t)=>{Zt.init(e,t),Mn.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Transforms cannot be represented in JSON Schema")})(0,e),e._zod.parse=(n,i)=>{if("backward"===i.direction)throw new r(e.constructor.name);n.addIssue=r=>{if("string"==typeof r)n.issues.push(N(r,n.value,t));else{const t=r;t.fatal&&(t.continue=!1),t.code??(t.code="custom"),t.input??(t.input=n.value),t.inst??(t.inst=e),n.issues.push(N(t))}};const s=t.transform(n.value,n);return s instanceof Promise?s.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=s,n.fallback=!0,n)}});var Dr=/*@__PURE__*/t("ZodOptional",(e,t)=>{jt.init(e,t),Mn.init(e,t),e._zod.processJSONSchema=(t,n,r)=>gn(e,t,0,r),e.unwrap=()=>e._zod.def.innerType});function Rr(e){return new Dr({type:"optional",innerType:e})}var Cr=/*@__PURE__*/t("ZodExactOptional",(e,t)=>{Dt.init(e,t),Mn.init(e,t),e._zod.processJSONSchema=(t,n,r)=>gn(e,t,0,r),e.unwrap=()=>e._zod.def.innerType});var Ur=/*@__PURE__*/t("ZodNullable",(e,t)=>{Rt.init(e,t),Mn.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def,s=hn(i.innerType,t,r),o=t.seen.get(e);"openapi-3.0"===t.target?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[s,{type:"null"}]})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Fr(e){return new Ur({type:"nullable",innerType:e})}var Jr=/*@__PURE__*/t("ZodDefault",(e,t)=>{Ct.init(e,t),Mn.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;hn(i.innerType,t,r),t.seen.get(e).ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});var Lr=/*@__PURE__*/t("ZodPrefault",(e,t)=>{Ft.init(e,t),Mn.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;hn(i.innerType,t,r),t.seen.get(e).ref=i.innerType,"input"===t.io&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});var Mr=/*@__PURE__*/t("ZodNonOptional",(e,t)=>{Jt.init(e,t),Mn.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;hn(i.innerType,t,r),t.seen.get(e).ref=i.innerType})(e,t,0,r),e.unwrap=()=>e._zod.def.innerType});var Vr=/*@__PURE__*/t("ZodCatch",(e,t)=>{Mt.init(e,t),Mn.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;let s;hn(i.innerType,t,r),t.seen.get(e).ref=i.innerType;try{s=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=s})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});var Kr=/*@__PURE__*/t("ZodPipe",(e,t)=>{Vt.init(e,t),Mn.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def,s=i.in._zod.traits.has("$ZodTransform"),o="input"===t.io?s?i.out:i.in:i.out;hn(o,t,r),t.seen.get(e).ref=o})(e,t,0,r),e.in=t.in,e.out=t.out});function Wr(e,t){return new Kr({type:"pipe",in:e,out:t})}var Br=/*@__PURE__*/t("ZodReadonly",(e,t)=>{Wt.init(e,t),Mn.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;hn(i.innerType,t,r),t.seen.get(e).ref=i.innerType,n.readOnly=!0})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});var Gr=/*@__PURE__*/t("ZodCustom",(e,t)=>{Ht.init(e,t),Mn.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Custom types cannot be represented in JSON Schema")})(0,e)});var Hr,Yr,Xr,Qr=Wn().nullable(),ei=(Hr=Wn(),(Yr=wr())&&Yr._zod?new xr({type:"record",keyType:Hr,valueType:Yr,...S(Xr)}):new xr({type:"record",keyType:Wn(),valueType:Hr,...S(Yr)})),ti=Ir({logo_url:Qr,primary_color:Wn(),secondary_color:Wn(),accent_color:Wn()}),ni=Ir({customer:Ir({id:Qr,email:Wn(),name:Wn(),avatar_url:Qr,joined_at:Qr}),shop:Ir({id:Wn(),slug:Wn(),name:Wn(),currency:Wn(),branding:ti}),token:Qr}),ri=Ir({attachment_image_id:Ir({cloudflare_image_id:Qr}).nullable()}),ii=Ir({attachment_imageId:Ir({cloudflareImageId:Qr}).nullable()}),si=Ir({uniqid:Wn(),status:Wn(),total:Wn(),total_display:Qr,currency:Wn(),created_at:Wn(),line_items:Er(Ir({product_title:Qr,quantity:mr(),product:ri.nullable()}))}),oi=Ir({uniqid:Wn(),status:Wn(),total:Wn(),totalDisplay:Qr,currency:Wn(),createdAt:Wn(),lineItems:Er(Ir({productTitle:Qr,quantity:mr(),product:ii.nullable()}))}),ai=Ir({invoices:Er(oi),pagination:Ir({page:mr(),limit:mr(),total:mr(),has_more:gr()})}),ui=Ir({can_review:gr(),already_submitted:gr(),feedback_uniqid:Qr,product_title:Qr,score:Or([qr(1),qr(3),qr(5)]).nullable(),is_automated:gr(),message:Qr,submitted_at:Qr}),ci=Ir({gateway:Wn(),displayName:Qr,cryptoGateway:Qr.optional(),blockchain:Qr,cryptoAddress:Qr,apmMethod:Qr}),di=Ir({id:Wn(),uniqid:Wn(),status:Wn(),statusDetails:Qr,total:Wn(),totalDisplay:Qr,subtotal:Wn(),discount:Wn(),discountDisplay:Qr,tax:Wn(),taxPercentage:Wn(),currency:Wn(),createdAt:Wn(),updatedAt:Wn(),gatewayUpdatedAt:Qr,customFields:ei.nullable(),balancePaidAmount:Wn(),tipAmountDisplay:Wn(),pricingBreakdown:Ir({subtotal:Wn(),discount:Wn(),volume_discount:Wn(),discount_label:Ar(["Coupon","Discount"]),affiliate_code:Qr,tip:Wn(),gateway_fee:Wn(),platform_fee:Wn(),processing_fee:Wn(),already_paid:Wn(),total:Wn(),amount_due:Wn(),currency:Wn()}),currentPaymentAttemptId:Qr,lineItems:Er(Ir({id:Wn(),productTitle:Wn(),productType:Wn(),variantTitle:Qr,unitPrice:Wn(),quantity:mr(),total:Wn(),deliveryText:Qr,deliverySummary:Ir({codes:Er(Wn()),links:Er(Ir({label:Wn(),value:Wn(),href:Qr.optional()})),notes:Er(Wn()),serials:Er(Ir({value:Wn(),is_replacement:gr(),is_replaced:gr()}))}).nullable(),deliveredAt:Qr,deliveryStatus:Ar(["PENDING","AWAITING_FULFILLMENT","DELIVERED","FAILED"]),customFields:ei.nullable(),product:Ir({uniqid:Wn(),slug:Qr,serviceText:Qr,attachment_imageId:Ir({cloudflareImageId:Qr}).nullable()}).nullable()})),currentPayment:ci.nullable(),payments:Er(ci)}),li=Ir({quote:Ir({enabled:gr(),currency:Wn(),min_amount:Wn(),max_amount:Qr,bonus_tiers:Er(Ir({min_amount:Wn(),bonus_percent:mr()}))})}),pi=Ir({invoice_id:Wn(),url:Wn()}),hi=Ir({id:Wn(),type:Wn(),status:Wn(),amount:Qr,currency:Qr,coupon_code:Qr,reason:Wn(),trigger_reference_type:Wn(),trigger_reference_id:Wn(),created_at:mr(),fulfilled_at:mr().nullable(),expires_at:mr().nullable()}),fi=Ir({summary:Ir({available:Wn(),pending:Wn(),lifetime_earned:Wn(),redeemed:Qr,currency:Wn()}),activity:Er(hi),earned_after_invoice:Er(hi),pending_after_invoice:Er(hi)}),mi=Ir({id:Wn(),uniqid:Wn(),label:Qr,code:Wn(),url:Qr,status:Ar(["pending","active","inactive","rejected"]),is_primary:gr(),total_clicks:mr(),total_sales:mr(),total_revenue:Wn(),is_active:gr(),is_approved:gr(),requested_affiliate_revenue_percent:mr().nullable(),requested_affiliate_customer_discount_percent:mr().nullable(),affiliate_revenue_percent_override:mr().nullable(),affiliate_customer_discount_percent_override:mr().nullable(),effective_commission_percent:mr(),effective_customer_discount_percent:mr(),commission_shareback_percent:mr(),commission_shareback_enabled:gr(),max_commission_shareback_percent:mr(),created_at:Qr,updated_at:Qr}),_i=Ir({customer:Ir({id:Wn(),email:Wn(),name:Qr}).nullable(),state:Wn(),can_create_custom_links:gr(),custom_link_request_disabled_reason:Qr,custom_links_require_approval:gr(),affiliate_codes_accepted_at_checkout:gr(),cash_payout_enabled:gr(),links:Er(mi),preferred_payout:Ir({asset:Wn(),network:Wn(),address:Wn()}).nullable(),balance_currency:Wn(),balances:Ir({pending:Wn(),available:Wn(),requested:Wn(),converted:Wn(),paid:Wn(),approved_total:Wn()}),commissions:Er(Ir({id:Wn(),invoice_id:Wn(),commission_amount:Wn(),base_amount:Wn(),discount_amount:Wn(),status:Wn(),created_at:Qr,paid_at:Qr,converted_at:Qr})),claims:Er(Ir({id:Wn(),type:Wn(),status:Wn(),amount:Wn(),currency:Wn(),allocations:Er(Ir({source_type:Wn(),commission_id:Qr,adjustment_id:Qr,amount:Wn()})),wallet_transaction_id:Qr,payout_asset:Qr,payout_network:Qr,payout_address:Qr,note:Qr,metadata:wr(),completed_at:Qr,rejected_at:Qr,cancelled_at:Qr,created_at:Qr,updated_at:Qr}))}),vi=Ir({uniqid:Wn(),status:Wn(),gateway:Wn(),current_period_start:Wn(),current_period_end:Wn(),trial_end:Qr,cancel_at_period_end:gr(),canceled_at:Qr,created_at:Wn(),plan:Ir({id:Wn(),uniqid:Wn(),name:Wn(),price:Wn(),currency:Wn(),interval:Wn(),interval_count:mr(),trial_days:mr()}).nullable(),payment_method:Ir({id:Wn(),gateway:Wn(),type:Wn(),card_brand:Qr,card_last4:Qr,card_exp_month:mr().nullable(),card_exp_year:mr().nullable(),is_default:gr()}).nullable(),actions:Ir({can_pause:gr(),can_resume:gr(),can_cancel:gr(),can_manage_payment_method:gr()})}),yi=Ir({enabled:gr(),account:Ir({points_balance:mr(),lifetime_points:mr()}).nullable(),settings:Ir({earn_rate_per_usd:mr(),redeem_value_per_point:mr(),min_redeem_points:mr()}).nullable(),transactions:Er(Ir({type:Ar(["EARN_ORDER","EARN_REVIEW","REDEEM","ADJUST"]),points:mr(),balance_after:mr(),description:Qr,created_at:Wn()}))}),gi=Ir({redeemed_points:mr(),wallet_amount:Wn(),currency:Wn(),points_balance:mr(),replayed:gr()}),bi=Ir({uniqid:Wn(),invoice_uniqid:Wn(),product_title:Wn(),period_days:mr(),starts_at:Wn(),expires_at:Wn(),status:Ar(["ACTIVE","EXPIRED","VOIDED"]),claim_status:Ar(["REQUESTED","APPROVED","DENIED"]).nullable(),created_at:Wn()}),wi=Ir({warranties:Er(bi)}),zi=Ir({warranty:bi.extend({claim_status:qr("REQUESTED")})}),ki=Ir({customer:Ir({id:Wn(),email:Wn(),name:Wn(),joined_at:Qr})}),Si=Ir({avatar_url:Qr}),Ei=Ir({global_unsubscribed:gr(),lists:Er(Ir({id:Wn(),name:Wn(),description:Qr,subscribed:gr()}))}),$i=Ir({updated:gr()}),Ii=Ir({order_created_emails:gr(),order_completed_emails:gr(),payment_issue_emails:gr()}),Ti=Ir({favorites:Er(Ir({product_uniqid:Wn(),title:Wn(),slug:Qr,image_url:Qr,price_display:mr(),unavailable:gr(),created_at:Wn()}))}),Oi=Or([Ir({added:qr(!0)}),Ir({removed:qr(!0)})]),Pi=Ir({license:Ir({uniqid:Wn(),hardware_id:Qr})}),xi=Ir({invoice_id:Wn(),checkout_url:Wn(),preferred_gateways:Er(Wn()),license:Ir({uniqid:Wn(),product_title:Wn()})}),Ni=Ir({invoices:Er(Ir({id:Wn(),uniqid:Wn(),total:Wn(),currency:Wn(),status:Wn(),gateway:Wn(),created_at:Wn(),completed_at:Wn()}))}),Ai=Ir({subscription:Ir({id:Wn(),status:Wn(),cancel_at_period_end:gr(),cancel_reason:Qr,canceled_at:Qr})}),Zi=Ir({subscription:Ir({id:Wn(),status:Wn()})}),qi=Ir({ticket:Ir({uniqid:Wn(),title:Wn(),status:Wn(),invoice_id:Qr,created_at:Wn(),updated_at:Wn(),messages:Er(Ir({id:Wn(),role:Ar(["CUSTOMER","SHOP","SYSTEM"]),message:Wn(),created_at:Wn()}))})}),ji=Ir({uniqid:Wn()}),Di=Ir({affiliate_link:Ir({id:Wn(),customer_id:Wn(),label:Qr,code:Wn(),url:Qr,status:Ar(["pending","approved","rejected"]),requested_affiliate_revenue_percent:mr().nullable(),requested_affiliate_customer_discount_percent:mr().nullable(),created_at:Wn(),updated_at:Wn()})}),Ri=Ir({check:Wn(),passed:gr(),reason:Qr.optional()}),Ci=Ir({eligible:gr(),decision:Ar(["ELIGIBLE","DENIED","NO_RULE"]),reason:Qr,eligibility_checks:Er(Ri)}),Ui=Ir({request_id:Wn(),event_id:Qr,decision:Ar(["ISSUED_REPLACEMENT","FALLBACK_REFUND","FALLBACK_CREDIT","QUEUED_MANUAL","DENIED","EXHAUSTED","FAILED"]),status_label:Ar(["ISSUED","REFUNDED","CREDITED","QUEUED_MANUAL","DENIED","EXHAUSTED","FAILED","PENDING"]),reason:Qr,eligibility_checks:Er(Ri)}),Fi=Ir({id:Wn(),name:Qr,discount_percent:mr().nullable()}),Ji=Ir({id:Wn(),status:Ar(["INVITED","APPLIED","ACTIVE","SUSPENDED","REJECTED"]),tier:Fi.nullable(),application_note:Qr,lifetime_revenue:Wn(),lifetime_orders:mr(),approved_at:Qr,created_at:Wn()}),Li=Ir({program_enabled:gr(),enrollment_mode:Ar(["MANUAL","APPLICATION","OPEN"]),application_message:Qr,require_application_note:gr(),reseller:Ji.nullable()}),Mi=Ir({reseller:Ji}),Vi=Ar(["variant","product","tier"]),Ki=Ir({variant_id:Wn(),title:Wn(),stock:mr(),supplier_backed:gr(),orderable:gr(),base_price:Wn(),unit_price:Wn(),discount_percent:mr(),applied_override:Vi}),Wi=Ir({tier:Fi,catalog:Ir({currency:Wn(),total:mr(),page:mr(),per_page:mr(),items:Er(Ir({product_id:Wn(),uniqid:Wn(),title:Wn(),type:Wn(),stock:mr(),supplier_backed:gr(),orderable:gr(),volume_discount_enabled:gr(),base_price:Wn(),unit_price:Wn(),discount_percent:mr(),applied_override:Vi,variants:Er(Ki)}))})}),Bi=Ir({quote:Ir({currency:Wn(),tier:Fi,items:Er(Ir({product_id:Wn(),product_title:Wn(),product_type:Wn(),variant_id:Qr,variant_title:Qr,quantity:mr(),base_price:Wn(),discount_percent:mr(),unit_price:Wn(),line_total:Wn(),applied_override:Vi,volume_discount_applied:Wn()})),subtotal:Wn(),volume_discount_total:Wn(),total:Wn(),savings:Wn()})}),Gi=Ir({orders:Ir({total:mr(),page:mr(),per_page:mr(),items:Er(Ir({uniqid:Wn(),status:Wn(),currency:Wn(),total:Wn(),item_count:mr(),created_at:Wn()}))})}),Hi=Ir({order:Ir({uniqid:Wn(),status:Wn(),currency:Wn(),total:Wn(),item_count:mr(),created_at:Wn(),tier_name:Wn(),tier_discount_percent:mr(),partially_delivered:gr(),refunded_amount:Qr,lines:Er(Ir({product_id:Qr,product_title:Wn(),variant_id:Qr,variant_title:Qr,quantity:mr(),unit_price:Wn(),total:Wn(),delivered:gr(),delivered_at:Qr,serials:Er(Wn())}))})}),Yi=Ir({wallet:Ir({currency:Wn(),balance:Wn(),hold_balance:Wn(),available:Wn(),is_active:gr()})}),Xi=Ir({api_keys:Er(Ir({id:Wn(),name:Wn(),key_last4:Wn(),last_used_at:Qr,revoked_at:Qr,created_at:Wn()}))}),Qi=Ir({topup:Ir({uniqid:Wn(),url:Wn()})}),es=Ir({shop:Ir({id:Wn(),slug:Wn(),name:Wn(),currency:Wn(),branding:ti}),customer:Ir({email:Wn(),name:Wn()}),stats:Ir({invoices_count:mr(),licenses_count:mr(),deliverables_count:mr(),tickets_count:mr()}),wallet:Ir({available:Wn(),total:Wn(),hold:Wn(),currency:Wn(),enabled:gr()}).nullable(),rewards:fi,affiliate:_i,invoices:Er(si),subscriptions:Er(vi),licenses:Er(Ir({uniqid:Wn(),invoice_id:Wn(),status:Wn(),license_key:Wn(),hardware_id:Qr,expires_at:mr().nullable(),renewable:gr(),product:Ir({title:Wn().optional()}).optional()})),deliverables:Er(Ir({id:Wn(),invoice_uniqid:Wn(),product_title:Wn(),kind:Ar(["file","serial","license"]),label:Wn(),value:Wn(),href:Qr,created_at:Wn()})),tickets:Er(Ir({uniqid:Wn(),title:Wn(),status:Wn(),updated_at:Wn(),created_at:Qr}))}),ts=class extends Error{constructor(e,t,n){super(t),this.status=e,this.code=n,this.name="HeadlessCustomerError"}};function ns(e){if(!e)return null;try{const t=JSON.parse(e);if(!function(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}(t)||"string"!=typeof t.accessToken||!t.accessToken.startsWith("hcs_")||"string"!=typeof t.expiresAt||"number"!=typeof t.savedAt||!Number.isFinite(t.savedAt))return null;const n=Date.parse(t.expiresAt);return!Number.isFinite(n)||n<=Date.now()?null:{accessToken:t.accessToken,expiresAt:t.expiresAt,savedAt:t.savedAt}}catch{return null}}function rs(e){if(!e)return null;const t=e.match(/filename\*=UTF-8''([^;]+)/i);if(t?.[1])try{return decodeURIComponent(t[1])}catch{return t[1]}return e.match(/filename="([^"]+)"/i)?.[1]??null}function is(e){if(!e?.startsWith("/api/customer/"))return null;try{const t=new URL(e,"https://headless-customer.invalid");if(!/^\/api\/customer\/invoice\/[^/]+\/download$/.test(t.pathname))return null;const n=t.searchParams.get("file_index");if(null===n||!/^\d+$/.test(n))return null;const r=Number(n);return Number.isSafeInteger(r)?r:null}catch{return null}}function ss(e){try{return"undefined"==typeof window?null:window[e]}catch{return null}}var os=class{constructor(e){if(this.memorySession=null,!e.shop.trim())throw new Error("HeadlessCustomerClient requires a shop.");if(!e.publishableKey.trim())throw new Error("HeadlessCustomerClient requires a publishableKey.");if(this.shop=e.shop.trim(),this.publishableKey=e.publishableKey.trim(),this.base=(e.apiBaseUrl??"https://api.shoppex.io").replace(/\/+$/,""),this.fetchImpl=e.fetchImpl??globalThis.fetch?.bind(globalThis),!this.fetchImpl)throw new Error("No fetch implementation available; pass fetchImpl.");this.storage=e.storage??ss("sessionStorage"),this.persistentStorage=e.persistentStorage??ss("localStorage"),this.storageKey=`shoppex_headless_customer_session:${this.shop}`}getSession(){const e=this.memorySession?[this.memorySession]:[];if(this.storage)try{const t=ns(this.storage.getItem(this.storageKey));t&&e.push(t)}catch{}if(this.persistentStorage)try{const t=ns(this.persistentStorage.getItem(this.storageKey));t&&e.push(t)}catch{}const t=e.sort((e,t)=>t.savedAt-e.savedAt)[0]??null;return t?(this.memorySession=t,{accessToken:t.accessToken,expiresAt:t.expiresAt}):(this.clearSession(),null)}clearSession(){this.memorySession=null;try{this.storage?.removeItem(this.storageKey)}catch{}try{this.persistentStorage?.removeItem(this.storageKey)}catch{}}saveSession(e,t){const n={...e,savedAt:Date.now()};this.memorySession=n;const r=t?this.persistentStorage:this.storage,i=t?this.storage:this.persistentStorage;try{r?.setItem(this.storageKey,JSON.stringify(n))}catch{}try{i?.removeItem(this.storageKey)}catch{}}url(e,t={}){const n=new URL(`${this.base}/v1/customer${e}`);n.searchParams.set("shop",this.shop);for(const[r,i]of Object.entries(t))void 0!==i&&""!==i&&n.searchParams.set(r,i);return n.toString()}async request(e,t={}){if(void 0!==t.body&&void 0!==t.formData)throw new Error("Customer requests cannot send JSON and FormData together.");const n=t.authenticated?this.getSession():null;if(t.authenticated&&!n)throw new ts(401,"Customer session is missing or expired.","UNAUTHORIZED");const r={accept:"application/json","x-shoppex-publishable-key":this.publishableKey,...void 0===t.body?{}:{"content-type":"application/json"},...n?{authorization:`Bearer ${n.accessToken}`}:{}},i=t.formData??(void 0===t.body?void 0:JSON.stringify(t.body)),s=await this.fetchImpl(this.url(e,t.query),{method:t.method??"GET",headers:r,...void 0===i?{}:{body:i},cache:"no-store"});let o=null;try{o=await s.json()}catch{}if(!s.ok||!o||o.error)throw 401===s.status&&t.authenticated&&this.clearSession(),new ts(s.status,o?.error??`Request failed (${s.status})`,o?.error_code??null);if(!t.schema)return o.data;const a=t.schema.safeParse(o.data);if(!a.success)throw new ts(s.status,"Customer API response did not match the expected contract.");return a.data}async requestFile(e,t={},n={}){const r=this.getSession();if(!r)throw new ts(401,"Customer session is missing or expired.","UNAUTHORIZED");const i=await this.fetchImpl(this.url(e,t),{method:"GET",headers:{"x-shoppex-publishable-key":this.publishableKey,authorization:`Bearer ${r.accessToken}`},cache:"no-store"});if(!i.ok){401===i.status&&this.clearSession();let e=`Download failed (${i.status})`;try{const t=await i.json();t.error&&(e=t.error)}catch{}throw new ts(i.status,e)}const s=i.headers.get("content-type");if(n.rejectHtml&&s?.toLowerCase().startsWith("text/html"))throw new ts(502,"Shoppex returned an unsafe aggregate download response.","UNSAFE_DOWNLOAD_RESPONSE");return{blob:await i.blob(),filename:rs(i.headers.get("content-disposition")),contentType:s}}requestOtp(e){return this.request("/auth/otp/request",{method:"POST",body:{shop:this.shop,email:e}})}async verifyOtp(e,t,n={}){const r=await this.request("/auth/otp/verify",{method:"POST",body:{shop:this.shop,email:e,otp:t,remember_me:n.rememberMe??!1}}),i="string"==typeof r?.expires_at?Date.parse(r.expires_at):NaN;if("string"!=typeof r?.access_token||!r.access_token.startsWith("hcs_")||"string"!=typeof r.expires_at||!Number.isFinite(i)||i<=Date.now())throw new ts(200,"Customer API response did not match the expected contract.");const s={accessToken:r.access_token,expiresAt:r.expires_at};return this.saveSession(s,n.rememberMe??!1),s}async me(){const e=await this.request("/me",{authenticated:!0,schema:ni});if(null!==e.token)throw new ts(200,"Customer API response did not match the expected contract.");return{customer:e.customer,shop:e.shop}}async dashboard(){const e=await this.request("/dashboard",{authenticated:!0,schema:es});return{...e,deliverables:e.deliverables.map(e=>{const t=is(e.href);return null===t?e:{...e,href:null,downloadIndex:t}})}}updateProfile(e){return this.request("/profile",{method:"POST",authenticated:!0,body:{name:e.name},schema:ki})}updateAvatar(e){const t=new FormData;return t.append("file",e),this.request("/profile/avatar",{method:"POST",authenticated:!0,formData:t,schema:Si})}removeAvatar(){return this.request("/profile/avatar",{method:"DELETE",authenticated:!0,schema:Si})}emailPreferences(){return this.request("/email-marketing/preferences",{authenticated:!0,schema:Ei})}updateEmailPreferences(e){return this.request("/email-marketing/preferences",{method:"PATCH",authenticated:!0,body:{...void 0===e.globalUnsubscribed?{}:{global_unsubscribed:e.globalUnsubscribed},list_subscriptions:(e.listSubscriptions??[]).map(e=>({list_id:e.listId,subscribed:e.subscribed}))},schema:$i})}notificationPreferences(){return this.request("/notification-preferences",{authenticated:!0,schema:Ii})}updateNotificationPreferences(e){return this.request("/notification-preferences",{method:"PATCH",authenticated:!0,body:{...void 0===e.orderCreatedEmails?{}:{order_created_emails:e.orderCreatedEmails},...void 0===e.orderCompletedEmails?{}:{order_completed_emails:e.orderCompletedEmails},...void 0===e.paymentIssueEmails?{}:{payment_issue_emails:e.paymentIssueEmails}},schema:Ii})}orders(e={}){return this.request("/invoices",{authenticated:!0,schema:ai,query:{page:void 0===e.page?void 0:String(e.page),limit:void 0===e.limit?void 0:String(e.limit),status:e.status,q:e.search}})}async order(e){const t=await this.request(`/invoice/${encodeURIComponent(e)}`,{authenticated:!0,schema:di});return{...t,lineItems:t.lineItems.map(e=>({...e,deliverySummary:e.deliverySummary?{...e.deliverySummary,links:e.deliverySummary.links.map(e=>{const t=is(e.href);return null===t?e:{...e,href:null,downloadIndex:t}})}:null}))}}orderReview(e){return this.request(`/invoices/${encodeURIComponent(e)}/review`,{authenticated:!0,schema:ui})}submitOrderReview(e,t){return this.request(`/invoices/${encodeURIComponent(e)}/review`,{method:"POST",authenticated:!0,body:{score:t.score,message:t.message},schema:ui})}invoicePdf(e){return this.requestFile(`/invoices/${encodeURIComponent(e)}/pdf`)}replacementEligibility(e,t){return this.request(`/invoices/${encodeURIComponent(e)}/replacement-eligibility`,{authenticated:!0,query:{line_item_id:t},schema:Ci})}requestReplacement(e,t){return this.request(`/invoices/${encodeURIComponent(e)}/replacement-requests`,{method:"POST",authenticated:!0,body:{line_item_id:t.lineItemId??null,reason:t.reason,...t.idempotencyKey?{idempotency_key:t.idempotencyKey}:{}},schema:Ui})}async download(e,t){if(!Number.isSafeInteger(t)||t<0)throw new ts(400,"download requires a non-negative integer fileIndex from order().deliverySummary.links.","INVALID_FILE_INDEX");return this.requestFile(`/invoice/${encodeURIComponent(e)}/download`,{file_index:String(t)},{rejectHtml:!0})}resetLicenseHwid(e){return this.request(`/licenses/${encodeURIComponent(e)}/reset-hwid`,{method:"POST",authenticated:!0,body:{},schema:Pi})}renewLicense(e){return this.request(`/licenses/${encodeURIComponent(e)}/renew`,{method:"POST",authenticated:!0,body:{shop:this.shop},schema:xi})}walletTopupQuote(){return this.request("/wallet/topup-quote",{authenticated:!0,schema:li})}createWalletTopup(e){return this.request("/wallet/topup",{method:"POST",authenticated:!0,body:{amount:e},schema:pi})}subscriptionBillingHistory(e){return this.request(`/subscriptions/${encodeURIComponent(e)}/billing-history`,{authenticated:!0,schema:Ni})}cancelSubscription(e,t={}){return this.request(`/subscriptions/${encodeURIComponent(e)}/cancel`,{method:"POST",authenticated:!0,body:{...void 0===t.cancelAtPeriodEnd?{}:{cancel_at_period_end:t.cancelAtPeriodEnd},...void 0===t.reason?{}:{reason:t.reason}},schema:Ai})}pauseSubscription(e){return this.request(`/subscriptions/${encodeURIComponent(e)}/pause`,{method:"POST",authenticated:!0,body:{},schema:Zi})}resumeSubscription(e){return this.request(`/subscriptions/${encodeURIComponent(e)}/resume`,{method:"POST",authenticated:!0,body:{},schema:Zi})}loyalty(){return this.request("/loyalty",{authenticated:!0,schema:yi})}redeemLoyaltyPoints(e){return this.request("/loyalty/redeem",{method:"POST",authenticated:!0,body:{points:e.points,idempotency_key:e.idempotencyKey},schema:gi})}warranties(e){return this.request("/warranties",{authenticated:!0,query:{invoice:e},schema:wi})}claimWarranty(e,t){return this.request(`/warranties/${encodeURIComponent(e)}/claim`,{method:"POST",authenticated:!0,body:t?{message:t}:{},schema:zi})}favorites(){return this.request("/favorites",{authenticated:!0,schema:Ti})}addFavorite(e){return this.request(`/favorites/${encodeURIComponent(e)}`,{method:"PUT",authenticated:!0,schema:Oi})}removeFavorite(e){return this.request(`/favorites/${encodeURIComponent(e)}`,{method:"DELETE",authenticated:!0,schema:Oi})}affiliate(){return this.request("/affiliate",{authenticated:!0,schema:_i})}createAffiliateLink(e){return this.request("/affiliate/links",{method:"POST",authenticated:!0,body:{shop:this.shop,code:e.code,label:e.label,...void 0===e.requestedRevenuePercent?{}:{requested_affiliate_revenue_percent:e.requestedRevenuePercent},...void 0===e.requestedCustomerDiscountPercent?{}:{requested_affiliate_customer_discount_percent:e.requestedCustomerDiscountPercent}},schema:Di})}createTicket(e){return this.request("/tickets",{method:"POST",authenticated:!0,body:{...void 0===e.title?{}:{title:e.title},message:e.message,...void 0===e.invoiceId?{}:{invoice_id:e.invoiceId}},schema:ji})}ticket(e){return this.request(`/tickets/${encodeURIComponent(e)}`,{authenticated:!0,schema:qi})}async replyToTicket(e,t){await this.request(`/tickets/${encodeURIComponent(e)}/reply`,{method:"POST",authenticated:!0,body:{message:t}})}reseller(){return this.request("/reseller",{authenticated:!0,schema:Li})}applyForReseller(e){return this.request("/reseller/apply",{method:"POST",authenticated:!0,body:void 0===e?{}:{note:e},schema:Mi})}enrollAsReseller(){return this.request("/reseller/enroll",{method:"POST",authenticated:!0,body:{},schema:Mi})}acceptResellerInvite(e){return this.request("/reseller/accept-invite",{method:"POST",authenticated:!0,body:{token:e},schema:Mi})}resellerCatalog(e={}){return this.request("/reseller/catalog",{authenticated:!0,query:{search:e.search,page:void 0===e.page?void 0:String(e.page),per_page:void 0===e.perPage?void 0:String(e.perPage)},schema:Wi})}quoteResellerOrder(e){return this.request("/reseller/orders/quote",{method:"POST",authenticated:!0,body:{items:e.map(e=>({product_id:e.productId,...void 0===e.variantId?{}:{variant_id:e.variantId},quantity:e.quantity}))},schema:Bi})}resellerOrders(e={}){return this.request("/reseller/orders",{authenticated:!0,query:{page:void 0===e.page?void 0:String(e.page),per_page:void 0===e.perPage?void 0:String(e.perPage)},schema:Gi})}resellerOrder(e){return this.request(`/reseller/orders/${encodeURIComponent(e)}`,{authenticated:!0,schema:Hi})}resellerWallet(){return this.request("/reseller/wallet",{authenticated:!0,schema:Yi})}resellerTopupQuote(){return this.request("/reseller/wallet/topup-quote",{authenticated:!0,schema:li})}createResellerTopup(e){return this.request("/reseller/wallet/topup",{method:"POST",authenticated:!0,body:{amount:e},schema:Qi})}resellerApiKeys(){return this.request("/reseller/api-keys",{authenticated:!0,schema:Xi})}async logout(){if(this.getSession()){try{await this.request("/auth/logout",{method:"POST",authenticated:!0})}catch(e){if(e instanceof ts&&401===e.status)return;throw e}this.clearSession()}}};function as(e){return new os(e)}export{os as HeadlessCustomerClient,ts as HeadlessCustomerError,as as createCustomerClient};
|
|
1
|
+
import {
|
|
2
|
+
customerLoyaltyRedeemSchema,
|
|
3
|
+
customerLoyaltySchema,
|
|
4
|
+
customerPortalAffiliateCreateLinkSchema,
|
|
5
|
+
customerPortalAffiliateStatsSchema,
|
|
6
|
+
customerPortalAffiliateSummarySchema,
|
|
7
|
+
customerPortalAvatarSchema,
|
|
8
|
+
customerPortalDashboardSchema,
|
|
9
|
+
customerPortalEmailPreferencesSchema,
|
|
10
|
+
customerPortalEmailPreferencesUpdateSchema,
|
|
11
|
+
customerPortalFavoriteMutationSchema,
|
|
12
|
+
customerPortalFavoritesSchema,
|
|
13
|
+
customerPortalInvoiceDetailSchema,
|
|
14
|
+
customerPortalLicenseRenewalSchema,
|
|
15
|
+
customerPortalLicenseResetSchema,
|
|
16
|
+
customerPortalMeSchema,
|
|
17
|
+
customerPortalNotificationPreferencesSchema,
|
|
18
|
+
customerPortalOrderReviewSchema,
|
|
19
|
+
customerPortalPaginatedInvoicesSchema,
|
|
20
|
+
customerPortalProfileUpdateSchema,
|
|
21
|
+
customerPortalSubscriptionBillingHistorySchema,
|
|
22
|
+
customerPortalSubscriptionCancelSchema,
|
|
23
|
+
customerPortalSubscriptionStatusSchema,
|
|
24
|
+
customerPortalSupportCreateSchema,
|
|
25
|
+
customerPortalSupportTicketDetailSchema,
|
|
26
|
+
customerPortalWalletTopupQuoteSchema,
|
|
27
|
+
customerPortalWalletTopupResultSchema,
|
|
28
|
+
customerReplacementEligibilitySchema,
|
|
29
|
+
customerReplacementRequestSchema,
|
|
30
|
+
customerResellerApiKeysSchema,
|
|
31
|
+
customerResellerCatalogSchema,
|
|
32
|
+
customerResellerEnrollmentSchema,
|
|
33
|
+
customerResellerOrderSchema,
|
|
34
|
+
customerResellerOrdersSchema,
|
|
35
|
+
customerResellerQuoteSchema,
|
|
36
|
+
customerResellerSummarySchema,
|
|
37
|
+
customerResellerTopupSchema,
|
|
38
|
+
customerResellerWalletSchema,
|
|
39
|
+
customerWarrantyClaimSchema,
|
|
40
|
+
customerWarrantyListSchema
|
|
41
|
+
} from "./chunk-ZVOFFURI.js";
|
|
42
|
+
|
|
43
|
+
// ../sdk/src/headless-customer.ts
|
|
44
|
+
var DEFAULT_API_ORIGIN = "https://api.shoppex.io";
|
|
45
|
+
var SESSION_STORAGE_PREFIX = "shoppex_headless_customer_session:";
|
|
46
|
+
var HeadlessCustomerError = class extends Error {
|
|
47
|
+
constructor(status, message, code) {
|
|
48
|
+
super(message);
|
|
49
|
+
this.status = status;
|
|
50
|
+
this.code = code;
|
|
51
|
+
this.name = "HeadlessCustomerError";
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
function isRecord(value) {
|
|
55
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
56
|
+
}
|
|
57
|
+
function parseStoredSession(value) {
|
|
58
|
+
if (!value) return null;
|
|
59
|
+
try {
|
|
60
|
+
const parsed = JSON.parse(value);
|
|
61
|
+
if (!isRecord(parsed) || typeof parsed.accessToken !== "string" || !parsed.accessToken.startsWith("hcs_") || typeof parsed.expiresAt !== "string" || typeof parsed.savedAt !== "number" || !Number.isFinite(parsed.savedAt)) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
const expiresAtMs = Date.parse(parsed.expiresAt);
|
|
65
|
+
if (!Number.isFinite(expiresAtMs) || expiresAtMs <= Date.now()) return null;
|
|
66
|
+
return { accessToken: parsed.accessToken, expiresAt: parsed.expiresAt, savedAt: parsed.savedAt };
|
|
67
|
+
} catch {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
function readFilename(header) {
|
|
72
|
+
if (!header) return null;
|
|
73
|
+
const utf8Match = header.match(/filename\*=UTF-8''([^;]+)/i);
|
|
74
|
+
if (utf8Match?.[1]) {
|
|
75
|
+
try {
|
|
76
|
+
return decodeURIComponent(utf8Match[1]);
|
|
77
|
+
} catch {
|
|
78
|
+
return utf8Match[1];
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return header.match(/filename="([^"]+)"/i)?.[1] ?? null;
|
|
82
|
+
}
|
|
83
|
+
function readPortalDownloadIndex(href) {
|
|
84
|
+
if (!href?.startsWith("/api/customer/")) return null;
|
|
85
|
+
try {
|
|
86
|
+
const url = new URL(href, "https://headless-customer.invalid");
|
|
87
|
+
if (!/^\/api\/customer\/invoice\/[^/]+\/download$/.test(url.pathname)) return null;
|
|
88
|
+
const rawIndex = url.searchParams.get("file_index");
|
|
89
|
+
if (rawIndex === null || !/^\d+$/.test(rawIndex)) return null;
|
|
90
|
+
const index = Number(rawIndex);
|
|
91
|
+
return Number.isSafeInteger(index) ? index : null;
|
|
92
|
+
} catch {
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
function readBrowserStorage(name) {
|
|
97
|
+
try {
|
|
98
|
+
return typeof window === "undefined" ? null : window[name];
|
|
99
|
+
} catch {
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
var HeadlessCustomerClient = class {
|
|
104
|
+
constructor(config) {
|
|
105
|
+
this.memorySession = null;
|
|
106
|
+
if (!config.shop.trim()) throw new Error("HeadlessCustomerClient requires a shop.");
|
|
107
|
+
if (!config.publishableKey.trim()) {
|
|
108
|
+
throw new Error("HeadlessCustomerClient requires a publishableKey.");
|
|
109
|
+
}
|
|
110
|
+
this.shop = config.shop.trim();
|
|
111
|
+
this.publishableKey = config.publishableKey.trim();
|
|
112
|
+
this.base = (config.apiBaseUrl ?? DEFAULT_API_ORIGIN).replace(/\/+$/, "");
|
|
113
|
+
this.fetchImpl = config.fetchImpl ?? globalThis.fetch?.bind(globalThis);
|
|
114
|
+
if (!this.fetchImpl) throw new Error("No fetch implementation available; pass fetchImpl.");
|
|
115
|
+
this.storage = config.storage ?? readBrowserStorage("sessionStorage");
|
|
116
|
+
this.persistentStorage = config.persistentStorage ?? readBrowserStorage("localStorage");
|
|
117
|
+
this.storageKey = `${SESSION_STORAGE_PREFIX}${this.shop}`;
|
|
118
|
+
}
|
|
119
|
+
getSession() {
|
|
120
|
+
const candidates = this.memorySession ? [this.memorySession] : [];
|
|
121
|
+
if (this.storage) {
|
|
122
|
+
try {
|
|
123
|
+
const stored2 = parseStoredSession(this.storage.getItem(this.storageKey));
|
|
124
|
+
if (stored2) candidates.push(stored2);
|
|
125
|
+
} catch {
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
if (this.persistentStorage) {
|
|
129
|
+
try {
|
|
130
|
+
const stored2 = parseStoredSession(this.persistentStorage.getItem(this.storageKey));
|
|
131
|
+
if (stored2) candidates.push(stored2);
|
|
132
|
+
} catch {
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
const stored = candidates.sort((left, right) => right.savedAt - left.savedAt)[0] ?? null;
|
|
136
|
+
if (!stored) {
|
|
137
|
+
this.clearSession();
|
|
138
|
+
return null;
|
|
139
|
+
}
|
|
140
|
+
this.memorySession = stored;
|
|
141
|
+
return { accessToken: stored.accessToken, expiresAt: stored.expiresAt };
|
|
142
|
+
}
|
|
143
|
+
clearSession() {
|
|
144
|
+
this.memorySession = null;
|
|
145
|
+
try {
|
|
146
|
+
this.storage?.removeItem(this.storageKey);
|
|
147
|
+
} catch {
|
|
148
|
+
}
|
|
149
|
+
try {
|
|
150
|
+
this.persistentStorage?.removeItem(this.storageKey);
|
|
151
|
+
} catch {
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
saveSession(session, rememberMe) {
|
|
155
|
+
const storedSession = { ...session, savedAt: Date.now() };
|
|
156
|
+
this.memorySession = storedSession;
|
|
157
|
+
const target = rememberMe ? this.persistentStorage : this.storage;
|
|
158
|
+
const other = rememberMe ? this.storage : this.persistentStorage;
|
|
159
|
+
try {
|
|
160
|
+
target?.setItem(this.storageKey, JSON.stringify(storedSession));
|
|
161
|
+
} catch {
|
|
162
|
+
}
|
|
163
|
+
try {
|
|
164
|
+
other?.removeItem(this.storageKey);
|
|
165
|
+
} catch {
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
url(path, query = {}) {
|
|
169
|
+
const url = new URL(`${this.base}/v1/customer${path}`);
|
|
170
|
+
url.searchParams.set("shop", this.shop);
|
|
171
|
+
for (const [key, value] of Object.entries(query)) {
|
|
172
|
+
if (value !== void 0 && value !== "") url.searchParams.set(key, value);
|
|
173
|
+
}
|
|
174
|
+
return url.toString();
|
|
175
|
+
}
|
|
176
|
+
async request(path, options = {}) {
|
|
177
|
+
if (options.body !== void 0 && options.formData !== void 0) {
|
|
178
|
+
throw new Error("Customer requests cannot send JSON and FormData together.");
|
|
179
|
+
}
|
|
180
|
+
const session = options.authenticated ? this.getSession() : null;
|
|
181
|
+
if (options.authenticated && !session) {
|
|
182
|
+
throw new HeadlessCustomerError(401, "Customer session is missing or expired.", "UNAUTHORIZED");
|
|
183
|
+
}
|
|
184
|
+
const headers = {
|
|
185
|
+
accept: "application/json",
|
|
186
|
+
"x-shoppex-publishable-key": this.publishableKey,
|
|
187
|
+
...options.body === void 0 ? {} : { "content-type": "application/json" },
|
|
188
|
+
...session ? { authorization: `Bearer ${session.accessToken}` } : {}
|
|
189
|
+
};
|
|
190
|
+
const requestBody = options.formData ?? (options.body === void 0 ? void 0 : JSON.stringify(options.body));
|
|
191
|
+
const response = await this.fetchImpl(this.url(path, options.query), {
|
|
192
|
+
method: options.method ?? "GET",
|
|
193
|
+
headers,
|
|
194
|
+
...requestBody === void 0 ? {} : { body: requestBody },
|
|
195
|
+
cache: "no-store"
|
|
196
|
+
});
|
|
197
|
+
let envelope = null;
|
|
198
|
+
try {
|
|
199
|
+
envelope = await response.json();
|
|
200
|
+
} catch {
|
|
201
|
+
}
|
|
202
|
+
if (!response.ok || !envelope || envelope.error) {
|
|
203
|
+
if (response.status === 401 && options.authenticated) this.clearSession();
|
|
204
|
+
throw new HeadlessCustomerError(
|
|
205
|
+
response.status,
|
|
206
|
+
envelope?.error ?? `Request failed (${response.status})`,
|
|
207
|
+
envelope?.error_code ?? null
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
if (!options.schema) return envelope.data;
|
|
211
|
+
const parsed = options.schema.safeParse(envelope.data);
|
|
212
|
+
if (!parsed.success) {
|
|
213
|
+
throw new HeadlessCustomerError(response.status, "Customer API response did not match the expected contract.");
|
|
214
|
+
}
|
|
215
|
+
return parsed.data;
|
|
216
|
+
}
|
|
217
|
+
async requestFile(path, query = {}, options = {}) {
|
|
218
|
+
const session = this.getSession();
|
|
219
|
+
if (!session) {
|
|
220
|
+
throw new HeadlessCustomerError(401, "Customer session is missing or expired.", "UNAUTHORIZED");
|
|
221
|
+
}
|
|
222
|
+
const response = await this.fetchImpl(this.url(path, query), {
|
|
223
|
+
method: "GET",
|
|
224
|
+
headers: {
|
|
225
|
+
"x-shoppex-publishable-key": this.publishableKey,
|
|
226
|
+
authorization: `Bearer ${session.accessToken}`
|
|
227
|
+
},
|
|
228
|
+
cache: "no-store"
|
|
229
|
+
});
|
|
230
|
+
if (!response.ok) {
|
|
231
|
+
if (response.status === 401) this.clearSession();
|
|
232
|
+
let message = `Download failed (${response.status})`;
|
|
233
|
+
try {
|
|
234
|
+
const body = await response.json();
|
|
235
|
+
if (body.error) message = body.error;
|
|
236
|
+
} catch {
|
|
237
|
+
}
|
|
238
|
+
throw new HeadlessCustomerError(response.status, message);
|
|
239
|
+
}
|
|
240
|
+
const contentType = response.headers.get("content-type");
|
|
241
|
+
if (options.rejectHtml && contentType?.toLowerCase().startsWith("text/html")) {
|
|
242
|
+
throw new HeadlessCustomerError(
|
|
243
|
+
502,
|
|
244
|
+
"Shoppex returned an unsafe aggregate download response.",
|
|
245
|
+
"UNSAFE_DOWNLOAD_RESPONSE"
|
|
246
|
+
);
|
|
247
|
+
}
|
|
248
|
+
return {
|
|
249
|
+
blob: await response.blob(),
|
|
250
|
+
filename: readFilename(response.headers.get("content-disposition")),
|
|
251
|
+
contentType
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
requestOtp(email) {
|
|
255
|
+
return this.request("/auth/otp/request", {
|
|
256
|
+
method: "POST",
|
|
257
|
+
body: { shop: this.shop, email }
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
async verifyOtp(email, otp, options = {}) {
|
|
261
|
+
const data = await this.request("/auth/otp/verify", {
|
|
262
|
+
method: "POST",
|
|
263
|
+
body: { shop: this.shop, email, otp, remember_me: options.rememberMe ?? false }
|
|
264
|
+
});
|
|
265
|
+
const expiresAtMs = typeof data?.expires_at === "string" ? Date.parse(data.expires_at) : Number.NaN;
|
|
266
|
+
if (typeof data?.access_token !== "string" || !data.access_token.startsWith("hcs_") || typeof data.expires_at !== "string" || !Number.isFinite(expiresAtMs) || expiresAtMs <= Date.now()) {
|
|
267
|
+
throw new HeadlessCustomerError(200, "Customer API response did not match the expected contract.");
|
|
268
|
+
}
|
|
269
|
+
const session = { accessToken: data.access_token, expiresAt: data.expires_at };
|
|
270
|
+
this.saveSession(session, options.rememberMe ?? false);
|
|
271
|
+
return session;
|
|
272
|
+
}
|
|
273
|
+
async me() {
|
|
274
|
+
const data = await this.request("/me", {
|
|
275
|
+
authenticated: true,
|
|
276
|
+
schema: customerPortalMeSchema
|
|
277
|
+
});
|
|
278
|
+
if (data.token !== null) {
|
|
279
|
+
throw new HeadlessCustomerError(200, "Customer API response did not match the expected contract.");
|
|
280
|
+
}
|
|
281
|
+
return { customer: data.customer, shop: data.shop };
|
|
282
|
+
}
|
|
283
|
+
async dashboard() {
|
|
284
|
+
const dashboard = await this.request("/dashboard", {
|
|
285
|
+
authenticated: true,
|
|
286
|
+
schema: customerPortalDashboardSchema
|
|
287
|
+
});
|
|
288
|
+
return {
|
|
289
|
+
...dashboard,
|
|
290
|
+
deliverables: dashboard.deliverables.map((deliverable) => {
|
|
291
|
+
const downloadIndex = readPortalDownloadIndex(deliverable.href);
|
|
292
|
+
return downloadIndex === null ? deliverable : { ...deliverable, href: null, downloadIndex };
|
|
293
|
+
})
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
updateProfile(input) {
|
|
297
|
+
return this.request("/profile", {
|
|
298
|
+
method: "POST",
|
|
299
|
+
authenticated: true,
|
|
300
|
+
body: { name: input.name },
|
|
301
|
+
schema: customerPortalProfileUpdateSchema
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
updateAvatar(file) {
|
|
305
|
+
const formData = new FormData();
|
|
306
|
+
formData.append("file", file);
|
|
307
|
+
return this.request("/profile/avatar", {
|
|
308
|
+
method: "POST",
|
|
309
|
+
authenticated: true,
|
|
310
|
+
formData,
|
|
311
|
+
schema: customerPortalAvatarSchema
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
removeAvatar() {
|
|
315
|
+
return this.request("/profile/avatar", {
|
|
316
|
+
method: "DELETE",
|
|
317
|
+
authenticated: true,
|
|
318
|
+
schema: customerPortalAvatarSchema
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
emailPreferences() {
|
|
322
|
+
return this.request("/email-marketing/preferences", {
|
|
323
|
+
authenticated: true,
|
|
324
|
+
schema: customerPortalEmailPreferencesSchema
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
updateEmailPreferences(patch) {
|
|
328
|
+
return this.request("/email-marketing/preferences", {
|
|
329
|
+
method: "PATCH",
|
|
330
|
+
authenticated: true,
|
|
331
|
+
body: {
|
|
332
|
+
...patch.globalUnsubscribed === void 0 ? {} : { global_unsubscribed: patch.globalUnsubscribed },
|
|
333
|
+
list_subscriptions: (patch.listSubscriptions ?? []).map((item) => ({
|
|
334
|
+
list_id: item.listId,
|
|
335
|
+
subscribed: item.subscribed
|
|
336
|
+
}))
|
|
337
|
+
},
|
|
338
|
+
schema: customerPortalEmailPreferencesUpdateSchema
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
notificationPreferences() {
|
|
342
|
+
return this.request("/notification-preferences", {
|
|
343
|
+
authenticated: true,
|
|
344
|
+
schema: customerPortalNotificationPreferencesSchema
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
updateNotificationPreferences(patch) {
|
|
348
|
+
return this.request("/notification-preferences", {
|
|
349
|
+
method: "PATCH",
|
|
350
|
+
authenticated: true,
|
|
351
|
+
body: {
|
|
352
|
+
...patch.orderCreatedEmails === void 0 ? {} : { order_created_emails: patch.orderCreatedEmails },
|
|
353
|
+
...patch.orderCompletedEmails === void 0 ? {} : { order_completed_emails: patch.orderCompletedEmails },
|
|
354
|
+
...patch.paymentIssueEmails === void 0 ? {} : { payment_issue_emails: patch.paymentIssueEmails }
|
|
355
|
+
},
|
|
356
|
+
schema: customerPortalNotificationPreferencesSchema
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
orders(options = {}) {
|
|
360
|
+
return this.request("/invoices", {
|
|
361
|
+
authenticated: true,
|
|
362
|
+
schema: customerPortalPaginatedInvoicesSchema,
|
|
363
|
+
query: {
|
|
364
|
+
page: options.page === void 0 ? void 0 : String(options.page),
|
|
365
|
+
limit: options.limit === void 0 ? void 0 : String(options.limit),
|
|
366
|
+
status: options.status,
|
|
367
|
+
q: options.search
|
|
368
|
+
}
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
async order(id) {
|
|
372
|
+
const order = await this.request(`/invoice/${encodeURIComponent(id)}`, {
|
|
373
|
+
authenticated: true,
|
|
374
|
+
schema: customerPortalInvoiceDetailSchema
|
|
375
|
+
});
|
|
376
|
+
return {
|
|
377
|
+
...order,
|
|
378
|
+
lineItems: order.lineItems.map((lineItem) => ({
|
|
379
|
+
...lineItem,
|
|
380
|
+
deliverySummary: lineItem.deliverySummary ? {
|
|
381
|
+
...lineItem.deliverySummary,
|
|
382
|
+
links: lineItem.deliverySummary.links.map((link) => {
|
|
383
|
+
const downloadIndex = readPortalDownloadIndex(link.href);
|
|
384
|
+
return downloadIndex === null ? link : { ...link, href: null, downloadIndex };
|
|
385
|
+
})
|
|
386
|
+
} : null
|
|
387
|
+
}))
|
|
388
|
+
};
|
|
389
|
+
}
|
|
390
|
+
orderReview(orderId) {
|
|
391
|
+
return this.request(`/invoices/${encodeURIComponent(orderId)}/review`, {
|
|
392
|
+
authenticated: true,
|
|
393
|
+
schema: customerPortalOrderReviewSchema
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
submitOrderReview(orderId, input) {
|
|
397
|
+
return this.request(`/invoices/${encodeURIComponent(orderId)}/review`, {
|
|
398
|
+
method: "POST",
|
|
399
|
+
authenticated: true,
|
|
400
|
+
body: {
|
|
401
|
+
score: input.score,
|
|
402
|
+
message: input.message
|
|
403
|
+
},
|
|
404
|
+
schema: customerPortalOrderReviewSchema
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
invoicePdf(orderId) {
|
|
408
|
+
return this.requestFile(`/invoices/${encodeURIComponent(orderId)}/pdf`);
|
|
409
|
+
}
|
|
410
|
+
replacementEligibility(orderId, lineItemId) {
|
|
411
|
+
return this.request(`/invoices/${encodeURIComponent(orderId)}/replacement-eligibility`, {
|
|
412
|
+
authenticated: true,
|
|
413
|
+
query: { line_item_id: lineItemId },
|
|
414
|
+
schema: customerReplacementEligibilitySchema
|
|
415
|
+
});
|
|
416
|
+
}
|
|
417
|
+
requestReplacement(orderId, options) {
|
|
418
|
+
return this.request(`/invoices/${encodeURIComponent(orderId)}/replacement-requests`, {
|
|
419
|
+
method: "POST",
|
|
420
|
+
authenticated: true,
|
|
421
|
+
body: {
|
|
422
|
+
line_item_id: options.lineItemId ?? null,
|
|
423
|
+
reason: options.reason,
|
|
424
|
+
...options.idempotencyKey ? { idempotency_key: options.idempotencyKey } : {}
|
|
425
|
+
},
|
|
426
|
+
schema: customerReplacementRequestSchema
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
async download(orderId, fileIndex) {
|
|
430
|
+
if (!Number.isSafeInteger(fileIndex) || fileIndex < 0) {
|
|
431
|
+
throw new HeadlessCustomerError(
|
|
432
|
+
400,
|
|
433
|
+
"download requires a non-negative integer fileIndex from order().deliverySummary.links.",
|
|
434
|
+
"INVALID_FILE_INDEX"
|
|
435
|
+
);
|
|
436
|
+
}
|
|
437
|
+
return this.requestFile(
|
|
438
|
+
`/invoice/${encodeURIComponent(orderId)}/download`,
|
|
439
|
+
{ file_index: String(fileIndex) },
|
|
440
|
+
{ rejectHtml: true }
|
|
441
|
+
);
|
|
442
|
+
}
|
|
443
|
+
resetLicenseHwid(licenseId) {
|
|
444
|
+
return this.request(`/licenses/${encodeURIComponent(licenseId)}/reset-hwid`, {
|
|
445
|
+
method: "POST",
|
|
446
|
+
authenticated: true,
|
|
447
|
+
body: {},
|
|
448
|
+
schema: customerPortalLicenseResetSchema
|
|
449
|
+
});
|
|
450
|
+
}
|
|
451
|
+
renewLicense(licenseId) {
|
|
452
|
+
return this.request(`/licenses/${encodeURIComponent(licenseId)}/renew`, {
|
|
453
|
+
method: "POST",
|
|
454
|
+
authenticated: true,
|
|
455
|
+
// This established route requires shop in the body. The shared headless
|
|
456
|
+
// gate independently verifies the same shop from the query and key.
|
|
457
|
+
body: { shop: this.shop },
|
|
458
|
+
schema: customerPortalLicenseRenewalSchema
|
|
459
|
+
});
|
|
460
|
+
}
|
|
461
|
+
walletTopupQuote() {
|
|
462
|
+
return this.request("/wallet/topup-quote", {
|
|
463
|
+
authenticated: true,
|
|
464
|
+
schema: customerPortalWalletTopupQuoteSchema
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
createWalletTopup(amount) {
|
|
468
|
+
return this.request("/wallet/topup", {
|
|
469
|
+
method: "POST",
|
|
470
|
+
authenticated: true,
|
|
471
|
+
body: { amount },
|
|
472
|
+
schema: customerPortalWalletTopupResultSchema
|
|
473
|
+
});
|
|
474
|
+
}
|
|
475
|
+
subscriptionBillingHistory(subscriptionId) {
|
|
476
|
+
return this.request(`/subscriptions/${encodeURIComponent(subscriptionId)}/billing-history`, {
|
|
477
|
+
authenticated: true,
|
|
478
|
+
schema: customerPortalSubscriptionBillingHistorySchema
|
|
479
|
+
});
|
|
480
|
+
}
|
|
481
|
+
cancelSubscription(subscriptionId, options = {}) {
|
|
482
|
+
return this.request(`/subscriptions/${encodeURIComponent(subscriptionId)}/cancel`, {
|
|
483
|
+
method: "POST",
|
|
484
|
+
authenticated: true,
|
|
485
|
+
body: {
|
|
486
|
+
...options.cancelAtPeriodEnd === void 0 ? {} : { cancel_at_period_end: options.cancelAtPeriodEnd },
|
|
487
|
+
...options.reason === void 0 ? {} : { reason: options.reason }
|
|
488
|
+
},
|
|
489
|
+
schema: customerPortalSubscriptionCancelSchema
|
|
490
|
+
});
|
|
491
|
+
}
|
|
492
|
+
pauseSubscription(subscriptionId) {
|
|
493
|
+
return this.request(`/subscriptions/${encodeURIComponent(subscriptionId)}/pause`, {
|
|
494
|
+
method: "POST",
|
|
495
|
+
authenticated: true,
|
|
496
|
+
body: {},
|
|
497
|
+
schema: customerPortalSubscriptionStatusSchema
|
|
498
|
+
});
|
|
499
|
+
}
|
|
500
|
+
resumeSubscription(subscriptionId) {
|
|
501
|
+
return this.request(`/subscriptions/${encodeURIComponent(subscriptionId)}/resume`, {
|
|
502
|
+
method: "POST",
|
|
503
|
+
authenticated: true,
|
|
504
|
+
body: {},
|
|
505
|
+
schema: customerPortalSubscriptionStatusSchema
|
|
506
|
+
});
|
|
507
|
+
}
|
|
508
|
+
loyalty() {
|
|
509
|
+
return this.request("/loyalty", {
|
|
510
|
+
authenticated: true,
|
|
511
|
+
schema: customerLoyaltySchema
|
|
512
|
+
});
|
|
513
|
+
}
|
|
514
|
+
redeemLoyaltyPoints(input) {
|
|
515
|
+
return this.request("/loyalty/redeem", {
|
|
516
|
+
method: "POST",
|
|
517
|
+
authenticated: true,
|
|
518
|
+
body: { points: input.points, idempotency_key: input.idempotencyKey },
|
|
519
|
+
schema: customerLoyaltyRedeemSchema
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
warranties(invoiceId) {
|
|
523
|
+
return this.request("/warranties", {
|
|
524
|
+
authenticated: true,
|
|
525
|
+
query: { invoice: invoiceId },
|
|
526
|
+
schema: customerWarrantyListSchema
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
claimWarranty(warrantyId, message) {
|
|
530
|
+
return this.request(`/warranties/${encodeURIComponent(warrantyId)}/claim`, {
|
|
531
|
+
method: "POST",
|
|
532
|
+
authenticated: true,
|
|
533
|
+
body: message ? { message } : {},
|
|
534
|
+
schema: customerWarrantyClaimSchema
|
|
535
|
+
});
|
|
536
|
+
}
|
|
537
|
+
favorites() {
|
|
538
|
+
return this.request("/favorites", {
|
|
539
|
+
authenticated: true,
|
|
540
|
+
schema: customerPortalFavoritesSchema
|
|
541
|
+
});
|
|
542
|
+
}
|
|
543
|
+
addFavorite(productId) {
|
|
544
|
+
return this.request(`/favorites/${encodeURIComponent(productId)}`, {
|
|
545
|
+
method: "PUT",
|
|
546
|
+
authenticated: true,
|
|
547
|
+
schema: customerPortalFavoriteMutationSchema
|
|
548
|
+
});
|
|
549
|
+
}
|
|
550
|
+
removeFavorite(productId) {
|
|
551
|
+
return this.request(`/favorites/${encodeURIComponent(productId)}`, {
|
|
552
|
+
method: "DELETE",
|
|
553
|
+
authenticated: true,
|
|
554
|
+
schema: customerPortalFavoriteMutationSchema
|
|
555
|
+
});
|
|
556
|
+
}
|
|
557
|
+
affiliate() {
|
|
558
|
+
return this.request("/affiliate", {
|
|
559
|
+
authenticated: true,
|
|
560
|
+
schema: customerPortalAffiliateSummarySchema
|
|
561
|
+
});
|
|
562
|
+
}
|
|
563
|
+
affiliateStats(input) {
|
|
564
|
+
return this.request("/affiliate/stats", {
|
|
565
|
+
authenticated: true,
|
|
566
|
+
schema: customerPortalAffiliateStatsSchema,
|
|
567
|
+
query: input?.days === void 0 ? {} : { days: String(input.days) }
|
|
568
|
+
});
|
|
569
|
+
}
|
|
570
|
+
createAffiliateLink(input) {
|
|
571
|
+
return this.request("/affiliate/links", {
|
|
572
|
+
method: "POST",
|
|
573
|
+
authenticated: true,
|
|
574
|
+
body: {
|
|
575
|
+
shop: this.shop,
|
|
576
|
+
code: input.code,
|
|
577
|
+
label: input.label,
|
|
578
|
+
...input.requestedRevenuePercent === void 0 ? {} : { requested_affiliate_revenue_percent: input.requestedRevenuePercent },
|
|
579
|
+
...input.requestedCustomerDiscountPercent === void 0 ? {} : { requested_affiliate_customer_discount_percent: input.requestedCustomerDiscountPercent }
|
|
580
|
+
},
|
|
581
|
+
schema: customerPortalAffiliateCreateLinkSchema
|
|
582
|
+
});
|
|
583
|
+
}
|
|
584
|
+
createTicket(input) {
|
|
585
|
+
return this.request("/tickets", {
|
|
586
|
+
method: "POST",
|
|
587
|
+
authenticated: true,
|
|
588
|
+
body: {
|
|
589
|
+
...input.title === void 0 ? {} : { title: input.title },
|
|
590
|
+
message: input.message,
|
|
591
|
+
...input.invoiceId === void 0 ? {} : { invoice_id: input.invoiceId }
|
|
592
|
+
},
|
|
593
|
+
schema: customerPortalSupportCreateSchema
|
|
594
|
+
});
|
|
595
|
+
}
|
|
596
|
+
ticket(ticketId) {
|
|
597
|
+
return this.request(`/tickets/${encodeURIComponent(ticketId)}`, {
|
|
598
|
+
authenticated: true,
|
|
599
|
+
schema: customerPortalSupportTicketDetailSchema
|
|
600
|
+
});
|
|
601
|
+
}
|
|
602
|
+
async replyToTicket(ticketId, message) {
|
|
603
|
+
await this.request(`/tickets/${encodeURIComponent(ticketId)}/reply`, {
|
|
604
|
+
method: "POST",
|
|
605
|
+
authenticated: true,
|
|
606
|
+
body: { message }
|
|
607
|
+
});
|
|
608
|
+
}
|
|
609
|
+
reseller() {
|
|
610
|
+
return this.request("/reseller", {
|
|
611
|
+
authenticated: true,
|
|
612
|
+
schema: customerResellerSummarySchema
|
|
613
|
+
});
|
|
614
|
+
}
|
|
615
|
+
applyForReseller(note) {
|
|
616
|
+
return this.request("/reseller/apply", {
|
|
617
|
+
method: "POST",
|
|
618
|
+
authenticated: true,
|
|
619
|
+
body: note === void 0 ? {} : { note },
|
|
620
|
+
schema: customerResellerEnrollmentSchema
|
|
621
|
+
});
|
|
622
|
+
}
|
|
623
|
+
enrollAsReseller() {
|
|
624
|
+
return this.request("/reseller/enroll", {
|
|
625
|
+
method: "POST",
|
|
626
|
+
authenticated: true,
|
|
627
|
+
body: {},
|
|
628
|
+
schema: customerResellerEnrollmentSchema
|
|
629
|
+
});
|
|
630
|
+
}
|
|
631
|
+
acceptResellerInvite(token) {
|
|
632
|
+
return this.request("/reseller/accept-invite", {
|
|
633
|
+
method: "POST",
|
|
634
|
+
authenticated: true,
|
|
635
|
+
body: { token },
|
|
636
|
+
schema: customerResellerEnrollmentSchema
|
|
637
|
+
});
|
|
638
|
+
}
|
|
639
|
+
resellerCatalog(options = {}) {
|
|
640
|
+
return this.request("/reseller/catalog", {
|
|
641
|
+
authenticated: true,
|
|
642
|
+
query: {
|
|
643
|
+
search: options.search,
|
|
644
|
+
page: options.page === void 0 ? void 0 : String(options.page),
|
|
645
|
+
per_page: options.perPage === void 0 ? void 0 : String(options.perPage)
|
|
646
|
+
},
|
|
647
|
+
schema: customerResellerCatalogSchema
|
|
648
|
+
});
|
|
649
|
+
}
|
|
650
|
+
quoteResellerOrder(items) {
|
|
651
|
+
return this.request("/reseller/orders/quote", {
|
|
652
|
+
method: "POST",
|
|
653
|
+
authenticated: true,
|
|
654
|
+
body: {
|
|
655
|
+
items: items.map((item) => ({
|
|
656
|
+
product_id: item.productId,
|
|
657
|
+
...item.variantId === void 0 ? {} : { variant_id: item.variantId },
|
|
658
|
+
quantity: item.quantity
|
|
659
|
+
}))
|
|
660
|
+
},
|
|
661
|
+
schema: customerResellerQuoteSchema
|
|
662
|
+
});
|
|
663
|
+
}
|
|
664
|
+
resellerOrders(options = {}) {
|
|
665
|
+
return this.request("/reseller/orders", {
|
|
666
|
+
authenticated: true,
|
|
667
|
+
query: {
|
|
668
|
+
page: options.page === void 0 ? void 0 : String(options.page),
|
|
669
|
+
per_page: options.perPage === void 0 ? void 0 : String(options.perPage)
|
|
670
|
+
},
|
|
671
|
+
schema: customerResellerOrdersSchema
|
|
672
|
+
});
|
|
673
|
+
}
|
|
674
|
+
resellerOrder(orderId) {
|
|
675
|
+
return this.request(`/reseller/orders/${encodeURIComponent(orderId)}`, {
|
|
676
|
+
authenticated: true,
|
|
677
|
+
schema: customerResellerOrderSchema
|
|
678
|
+
});
|
|
679
|
+
}
|
|
680
|
+
resellerWallet() {
|
|
681
|
+
return this.request("/reseller/wallet", {
|
|
682
|
+
authenticated: true,
|
|
683
|
+
schema: customerResellerWalletSchema
|
|
684
|
+
});
|
|
685
|
+
}
|
|
686
|
+
resellerTopupQuote() {
|
|
687
|
+
return this.request("/reseller/wallet/topup-quote", {
|
|
688
|
+
authenticated: true,
|
|
689
|
+
schema: customerPortalWalletTopupQuoteSchema
|
|
690
|
+
});
|
|
691
|
+
}
|
|
692
|
+
createResellerTopup(amount) {
|
|
693
|
+
return this.request("/reseller/wallet/topup", {
|
|
694
|
+
method: "POST",
|
|
695
|
+
authenticated: true,
|
|
696
|
+
body: { amount },
|
|
697
|
+
schema: customerResellerTopupSchema
|
|
698
|
+
});
|
|
699
|
+
}
|
|
700
|
+
resellerApiKeys() {
|
|
701
|
+
return this.request("/reseller/api-keys", {
|
|
702
|
+
authenticated: true,
|
|
703
|
+
schema: customerResellerApiKeysSchema
|
|
704
|
+
});
|
|
705
|
+
}
|
|
706
|
+
async logout() {
|
|
707
|
+
if (!this.getSession()) return;
|
|
708
|
+
try {
|
|
709
|
+
await this.request("/auth/logout", { method: "POST", authenticated: true });
|
|
710
|
+
} catch (error) {
|
|
711
|
+
if (error instanceof HeadlessCustomerError && error.status === 401) {
|
|
712
|
+
return;
|
|
713
|
+
}
|
|
714
|
+
throw error;
|
|
715
|
+
}
|
|
716
|
+
this.clearSession();
|
|
717
|
+
}
|
|
718
|
+
};
|
|
719
|
+
function createCustomerClient(config) {
|
|
720
|
+
return new HeadlessCustomerClient(config);
|
|
721
|
+
}
|
|
722
|
+
export {
|
|
723
|
+
HeadlessCustomerClient,
|
|
724
|
+
HeadlessCustomerError,
|
|
725
|
+
createCustomerClient
|
|
726
|
+
};
|
|
3
727
|
//# sourceMappingURL=customer.js.map
|