@magiclabs.ai/magicbook-client 0.5.6 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
1
  (function(O,Z){typeof exports=="object"&&typeof module<"u"?Z(exports):typeof define=="function"&&define.amd?define(["exports"],Z):(O=typeof globalThis<"u"?globalThis:O||self,Z(O["magicbook-client"]={}))})(this,function(O){"use strict";var ii=Object.defineProperty;var ai=(O,Z,q)=>Z in O?ii(O,Z,{enumerable:!0,configurable:!0,writable:!0,value:q}):O[Z]=q;var b=(O,Z,q)=>(ai(O,typeof Z!="symbol"?Z+"":Z,q),q);function Z(t,e,s){const n=e.pop()||"",r=e.reduce((i,a)=>i[a]=i[a]||{},t);r[n]=s}function q(t,e){return Object.keys(e).map(s=>{typeof t[s]=="object"&&typeof e[s]=="object"?q(t[s],e[s]):t[s]=e[s]}),t}function Os(t){return t.replace(/([a-z])([A-Z])/g,"$1_$2").toLowerCase()}function Nt(t){return Object.keys(t).map(e=>{const s=Os(e);s.includes("_")&&(t[s]=t[e],delete t[e]),typeof t[s]=="object"&&(t[s]=Nt(t[s]))}),t}function Ns(t){return t.replace(/([-_][a-z])/g,e=>e.toUpperCase().replace("-","").replace("_",""))}function Ct(t){return Object.keys(t).map(e=>{const s=Ns(e);s!==e&&(t[s]=t[e],delete t[e]),typeof t[s]=="object"&&(t[s]=Ct(t[s]))}),t}function At(t,e){return function(){return t.apply(e,arguments)}}const{toString:Cs}=Object.prototype,{getPrototypeOf:Qe}=Object,Ce=(t=>e=>{const s=Cs.call(e);return t[s]||(t[s]=s.slice(8,-1).toLowerCase())})(Object.create(null)),z=t=>(t=t.toLowerCase(),e=>Ce(e)===t),Ae=t=>e=>typeof e===t,{isArray:ie}=Array,fe=Ae("undefined");function As(t){return t!==null&&!fe(t)&&t.constructor!==null&&!fe(t.constructor)&&L(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const Rt=z("ArrayBuffer");function Rs(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&Rt(t.buffer),e}const Is=Ae("string"),L=Ae("function"),It=Ae("number"),Re=t=>t!==null&&typeof t=="object",js=t=>t===!0||t===!1,Ie=t=>{if(Ce(t)!=="object")return!1;const e=Qe(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},Zs=z("Date"),Ls=z("File"),Ds=z("Blob"),Ps=z("FileList"),Bs=t=>Re(t)&&L(t.pipe),Ms=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||L(t.append)&&((e=Ce(t))==="formdata"||e==="object"&&L(t.toString)&&t.toString()==="[object FormData]"))},Us=z("URLSearchParams"),zs=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function he(t,e,{allOwnKeys:s=!1}={}){if(t===null||typeof t>"u")return;let n,r;if(typeof t!="object"&&(t=[t]),ie(t))for(n=0,r=t.length;n<r;n++)e.call(null,t[n],n,t);else{const i=s?Object.getOwnPropertyNames(t):Object.keys(t),a=i.length;let o;for(n=0;n<a;n++)o=i[n],e.call(null,t[o],o,t)}}function jt(t,e){e=e.toLowerCase();const s=Object.keys(t);let n=s.length,r;for(;n-- >0;)if(r=s[n],e===r.toLowerCase())return r;return null}const Zt=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),Lt=t=>!fe(t)&&t!==Zt;function et(){const{caseless:t}=Lt(this)&&this||{},e={},s=(n,r)=>{const i=t&&jt(e,r)||r;Ie(e[i])&&Ie(n)?e[i]=et(e[i],n):Ie(n)?e[i]=et({},n):ie(n)?e[i]=n.slice():e[i]=n};for(let n=0,r=arguments.length;n<r;n++)arguments[n]&&he(arguments[n],s);return e}const $s=(t,e,s,{allOwnKeys:n}={})=>(he(e,(r,i)=>{s&&L(r)?t[i]=At(r,s):t[i]=r},{allOwnKeys:n}),t),Vs=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),Fs=(t,e,s,n)=>{t.prototype=Object.create(e.prototype,n),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),s&&Object.assign(t.prototype,s)},Hs=(t,e,s,n)=>{let r,i,a;const o={};if(e=e||{},t==null)return e;do{for(r=Object.getOwnPropertyNames(t),i=r.length;i-- >0;)a=r[i],(!n||n(a,t,e))&&!o[a]&&(e[a]=t[a],o[a]=!0);t=s!==!1&&Qe(t)}while(t&&(!s||s(t,e))&&t!==Object.prototype);return e},Js=(t,e,s)=>{t=String(t),(s===void 0||s>t.length)&&(s=t.length),s-=e.length;const n=t.indexOf(e,s);return n!==-1&&n===s},Ws=t=>{if(!t)return null;if(ie(t))return t;let e=t.length;if(!It(e))return null;const s=new Array(e);for(;e-- >0;)s[e]=t[e];return s},Ks=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&Qe(Uint8Array)),qs=(t,e)=>{const n=(t&&t[Symbol.iterator]).call(t);let r;for(;(r=n.next())&&!r.done;){const i=r.value;e.call(t,i[0],i[1])}},Gs=(t,e)=>{let s;const n=[];for(;(s=t.exec(e))!==null;)n.push(s);return n},Xs=z("HTMLFormElement"),Ys=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(s,n,r){return n.toUpperCase()+r}),Dt=(({hasOwnProperty:t})=>(e,s)=>t.call(e,s))(Object.prototype),Qs=z("RegExp"),Pt=(t,e)=>{const s=Object.getOwnPropertyDescriptors(t),n={};he(s,(r,i)=>{e(r,i,t)!==!1&&(n[i]=r)}),Object.defineProperties(t,n)},en=t=>{Pt(t,(e,s)=>{if(L(t)&&["arguments","caller","callee"].indexOf(s)!==-1)return!1;const n=t[s];if(L(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+s+"'")})}})},tn=(t,e)=>{const s={},n=r=>{r.forEach(i=>{s[i]=!0})};return ie(t)?n(t):n(String(t).split(e)),s},sn=()=>{},nn=(t,e)=>(t=+t,Number.isFinite(t)?t:e),tt="abcdefghijklmnopqrstuvwxyz",Bt="0123456789",Mt={DIGIT:Bt,ALPHA:tt,ALPHA_DIGIT:tt+tt.toUpperCase()+Bt},rn=(t=16,e=Mt.ALPHA_DIGIT)=>{let s="";const{length:n}=e;for(;t--;)s+=e[Math.random()*n|0];return s};function an(t){return!!(t&&L(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}const on=t=>{const e=new Array(10),s=(n,r)=>{if(Re(n)){if(e.indexOf(n)>=0)return;if(!("toJSON"in n)){e[r]=n;const i=ie(n)?[]:{};return he(n,(a,o)=>{const u=s(a,r+1);!fe(u)&&(i[o]=u)}),e[r]=void 0,i}}return n};return s(t,0)},ln=z("AsyncFunction"),c={isArray:ie,isArrayBuffer:Rt,isBuffer:As,isFormData:Ms,isArrayBufferView:Rs,isString:Is,isNumber:It,isBoolean:js,isObject:Re,isPlainObject:Ie,isUndefined:fe,isDate:Zs,isFile:Ls,isBlob:Ds,isRegExp:Qs,isFunction:L,isStream:Bs,isURLSearchParams:Us,isTypedArray:Ks,isFileList:Ps,forEach:he,merge:et,extend:$s,trim:zs,stripBOM:Vs,inherits:Fs,toFlatObject:Hs,kindOf:Ce,kindOfTest:z,endsWith:Js,toArray:Ws,forEachEntry:qs,matchAll:Gs,isHTMLForm:Xs,hasOwnProperty:Dt,hasOwnProp:Dt,reduceDescriptors:Pt,freezeMethods:en,toObjectSet:tn,toCamelCase:Ys,noop:sn,toFiniteNumber:nn,findKey:jt,global:Zt,isContextDefined:Lt,ALPHABET:Mt,generateString:rn,isSpecCompliantForm:an,toJSONObject:on,isAsyncFn:ln,isThenable:t=>t&&(Re(t)||L(t))&&L(t.then)&&L(t.catch)};function T(t,e,s,n,r){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),s&&(this.config=s),n&&(this.request=n),r&&(this.response=r)}c.inherits(T,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:c.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const Ut=T.prototype,zt={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{zt[t]={value:t}}),Object.defineProperties(T,zt),Object.defineProperty(Ut,"isAxiosError",{value:!0}),T.from=(t,e,s,n,r,i)=>{const a=Object.create(Ut);return c.toFlatObject(t,a,function(u){return u!==Error.prototype},o=>o!=="isAxiosError"),T.call(a,t.message,e,s,n,r),a.cause=t,a.name=t.name,i&&Object.assign(a,i),a};const cn=null;function st(t){return c.isPlainObject(t)||c.isArray(t)}function $t(t){return c.endsWith(t,"[]")?t.slice(0,-2):t}function Vt(t,e,s){return t?t.concat(e).map(function(r,i){return r=$t(r),!s&&i?"["+r+"]":r}).join(s?".":""):e}function un(t){return c.isArray(t)&&!t.some(st)}const dn=c.toFlatObject(c,{},null,function(e){return/^is[A-Z]/.test(e)});function je(t,e,s){if(!c.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,s=c.toFlatObject(s,{metaTokens:!0,dots:!1,indexes:!1},!1,function(S,K){return!c.isUndefined(K[S])});const n=s.metaTokens,r=s.visitor||f,i=s.dots,a=s.indexes,u=(s.Blob||typeof Blob<"u"&&Blob)&&c.isSpecCompliantForm(e);if(!c.isFunction(r))throw new TypeError("visitor must be a function");function l(g){if(g===null)return"";if(c.isDate(g))return g.toISOString();if(!u&&c.isBlob(g))throw new T("Blob is not supported. Use a Buffer instead.");return c.isArrayBuffer(g)||c.isTypedArray(g)?u&&typeof Blob=="function"?new Blob([g]):Buffer.from(g):g}function f(g,S,K){let U=g;if(g&&!K&&typeof g=="object"){if(c.endsWith(S,"{}"))S=n?S:S.slice(0,-2),g=JSON.stringify(g);else if(c.isArray(g)&&un(g)||(c.isFileList(g)||c.endsWith(S,"[]"))&&(U=c.toArray(g)))return S=$t(S),U.forEach(function(Ye,ri){!(c.isUndefined(Ye)||Ye===null)&&e.append(a===!0?Vt([S],ri,i):a===null?S:S+"[]",l(Ye))}),!1}return st(g)?!0:(e.append(Vt(K,S,i),l(g)),!1)}const _=[],A=Object.assign(dn,{defaultVisitor:f,convertValue:l,isVisitable:st});function N(g,S){if(!c.isUndefined(g)){if(_.indexOf(g)!==-1)throw Error("Circular reference detected in "+S.join("."));_.push(g),c.forEach(g,function(U,de){(!(c.isUndefined(U)||U===null)&&r.call(e,U,c.isString(de)?de.trim():de,S,A))===!0&&N(U,S?S.concat(de):[de])}),_.pop()}}if(!c.isObject(t))throw new TypeError("data must be an object");return N(t),e}function Ft(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function nt(t,e){this._pairs=[],t&&je(t,this,e)}const Ht=nt.prototype;Ht.append=function(e,s){this._pairs.push([e,s])},Ht.toString=function(e){const s=e?function(n){return e.call(this,n,Ft)}:Ft;return this._pairs.map(function(r){return s(r[0])+"="+s(r[1])},"").join("&")};function fn(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Jt(t,e,s){if(!e)return t;const n=s&&s.encode||fn,r=s&&s.serialize;let i;if(r?i=r(e,s):i=c.isURLSearchParams(e)?e.toString():new nt(e,s).toString(n),i){const a=t.indexOf("#");a!==-1&&(t=t.slice(0,a)),t+=(t.indexOf("?")===-1?"?":"&")+i}return t}class hn{constructor(){this.handlers=[]}use(e,s,n){return this.handlers.push({fulfilled:e,rejected:s,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){c.forEach(this.handlers,function(n){n!==null&&e(n)})}}const Wt=hn,Kt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},pn=typeof URLSearchParams<"u"?URLSearchParams:nt,mn=typeof FormData<"u"?FormData:null,yn=typeof Blob<"u"?Blob:null,gn=(()=>{let t;return typeof navigator<"u"&&((t=navigator.product)==="ReactNative"||t==="NativeScript"||t==="NS")?!1:typeof window<"u"&&typeof document<"u"})(),vn=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),$={isBrowser:!0,classes:{URLSearchParams:pn,FormData:mn,Blob:yn},isStandardBrowserEnv:gn,isStandardBrowserWebWorkerEnv:vn,protocols:["http","https","file","blob","url","data"]};function _n(t,e){return je(t,new $.classes.URLSearchParams,Object.assign({visitor:function(s,n,r,i){return $.isNode&&c.isBuffer(s)?(this.append(n,s.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)}},e))}function bn(t){return c.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function wn(t){const e={},s=Object.keys(t);let n;const r=s.length;let i;for(n=0;n<r;n++)i=s[n],e[i]=t[i];return e}function qt(t){function e(s,n,r,i){let a=s[i++];const o=Number.isFinite(+a),u=i>=s.length;return a=!a&&c.isArray(r)?r.length:a,u?(c.hasOwnProp(r,a)?r[a]=[r[a],n]:r[a]=n,!o):((!r[a]||!c.isObject(r[a]))&&(r[a]=[]),e(s,n,r[a],i)&&c.isArray(r[a])&&(r[a]=wn(r[a])),!o)}if(c.isFormData(t)&&c.isFunction(t.entries)){const s={};return c.forEachEntry(t,(n,r)=>{e(bn(n),r,s,0)}),s}return null}const xn={"Content-Type":void 0};function kn(t,e,s){if(c.isString(t))try{return(e||JSON.parse)(t),c.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(s||JSON.stringify)(t)}const Ze={transitional:Kt,adapter:["xhr","http"],transformRequest:[function(e,s){const n=s.getContentType()||"",r=n.indexOf("application/json")>-1,i=c.isObject(e);if(i&&c.isHTMLForm(e)&&(e=new FormData(e)),c.isFormData(e))return r&&r?JSON.stringify(qt(e)):e;if(c.isArrayBuffer(e)||c.isBuffer(e)||c.isStream(e)||c.isFile(e)||c.isBlob(e))return e;if(c.isArrayBufferView(e))return e.buffer;if(c.isURLSearchParams(e))return s.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(i){if(n.indexOf("application/x-www-form-urlencoded")>-1)return _n(e,this.formSerializer).toString();if((o=c.isFileList(e))||n.indexOf("multipart/form-data")>-1){const u=this.env&&this.env.FormData;return je(o?{"files[]":e}:e,u&&new u,this.formSerializer)}}return i||r?(s.setContentType("application/json",!1),kn(e)):e}],transformResponse:[function(e){const s=this.transitional||Ze.transitional,n=s&&s.forcedJSONParsing,r=this.responseType==="json";if(e&&c.isString(e)&&(n&&!this.responseType||r)){const a=!(s&&s.silentJSONParsing)&&r;try{return JSON.parse(e)}catch(o){if(a)throw o.name==="SyntaxError"?T.from(o,T.ERR_BAD_RESPONSE,this,null,this.response):o}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:$.classes.FormData,Blob:$.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};c.forEach(["delete","get","head"],function(e){Ze.headers[e]={}}),c.forEach(["post","put","patch"],function(e){Ze.headers[e]=c.merge(xn)});const rt=Ze,Sn=c.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Tn=t=>{const e={};let s,n,r;return t&&t.split(`
2
2
  `).forEach(function(a){r=a.indexOf(":"),s=a.substring(0,r).trim().toLowerCase(),n=a.substring(r+1).trim(),!(!s||e[s]&&Sn[s])&&(s==="set-cookie"?e[s]?e[s].push(n):e[s]=[n]:e[s]=e[s]?e[s]+", "+n:n)}),e},Gt=Symbol("internals");function pe(t){return t&&String(t).trim().toLowerCase()}function Le(t){return t===!1||t==null?t:c.isArray(t)?t.map(Le):String(t)}function En(t){const e=Object.create(null),s=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=s.exec(t);)e[n[1]]=n[2];return e}const On=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function it(t,e,s,n,r){if(c.isFunction(n))return n.call(this,e,s);if(r&&(e=s),!!c.isString(e)){if(c.isString(n))return e.indexOf(n)!==-1;if(c.isRegExp(n))return n.test(e)}}function Nn(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,s,n)=>s.toUpperCase()+n)}function Cn(t,e){const s=c.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+s,{value:function(r,i,a){return this[n].call(this,e,r,i,a)},configurable:!0})})}class De{constructor(e){e&&this.set(e)}set(e,s,n){const r=this;function i(o,u,l){const f=pe(u);if(!f)throw new Error("header name must be a non-empty string");const _=c.findKey(r,f);(!_||r[_]===void 0||l===!0||l===void 0&&r[_]!==!1)&&(r[_||u]=Le(o))}const a=(o,u)=>c.forEach(o,(l,f)=>i(l,f,u));return c.isPlainObject(e)||e instanceof this.constructor?a(e,s):c.isString(e)&&(e=e.trim())&&!On(e)?a(Tn(e),s):e!=null&&i(s,e,n),this}get(e,s){if(e=pe(e),e){const n=c.findKey(this,e);if(n){const r=this[n];if(!s)return r;if(s===!0)return En(r);if(c.isFunction(s))return s.call(this,r,n);if(c.isRegExp(s))return s.exec(r);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,s){if(e=pe(e),e){const n=c.findKey(this,e);return!!(n&&this[n]!==void 0&&(!s||it(this,this[n],n,s)))}return!1}delete(e,s){const n=this;let r=!1;function i(a){if(a=pe(a),a){const o=c.findKey(n,a);o&&(!s||it(n,n[o],o,s))&&(delete n[o],r=!0)}}return c.isArray(e)?e.forEach(i):i(e),r}clear(e){const s=Object.keys(this);let n=s.length,r=!1;for(;n--;){const i=s[n];(!e||it(this,this[i],i,e,!0))&&(delete this[i],r=!0)}return r}normalize(e){const s=this,n={};return c.forEach(this,(r,i)=>{const a=c.findKey(n,i);if(a){s[a]=Le(r),delete s[i];return}const o=e?Nn(i):String(i).trim();o!==i&&delete s[i],s[o]=Le(r),n[o]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const s=Object.create(null);return c.forEach(this,(n,r)=>{n!=null&&n!==!1&&(s[r]=e&&c.isArray(n)?n.join(", "):n)}),s}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,s])=>e+": "+s).join(`
3
- `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...s){const n=new this(e);return s.forEach(r=>n.set(r)),n}static accessor(e){const n=(this[Gt]=this[Gt]={accessors:{}}).accessors,r=this.prototype;function i(a){const o=pe(a);n[o]||(Cn(r,a),n[o]=!0)}return c.isArray(e)?e.forEach(i):i(e),this}}De.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),c.freezeMethods(De.prototype),c.freezeMethods(De);const H=De;function at(t,e){const s=this||rt,n=e||s,r=H.from(n.headers);let i=n.data;return c.forEach(t,function(o){i=o.call(s,i,r.normalize(),e?e.status:void 0)}),r.normalize(),i}function Xt(t){return!!(t&&t.__CANCEL__)}function me(t,e,s){T.call(this,t??"canceled",T.ERR_CANCELED,e,s),this.name="CanceledError"}c.inherits(me,T,{__CANCEL__:!0});function An(t,e,s){const n=s.config.validateStatus;!s.status||!n||n(s.status)?t(s):e(new T("Request failed with status code "+s.status,[T.ERR_BAD_REQUEST,T.ERR_BAD_RESPONSE][Math.floor(s.status/100)-4],s.config,s.request,s))}const Rn=$.isStandardBrowserEnv?function(){return{write:function(s,n,r,i,a,o){const u=[];u.push(s+"="+encodeURIComponent(n)),c.isNumber(r)&&u.push("expires="+new Date(r).toGMTString()),c.isString(i)&&u.push("path="+i),c.isString(a)&&u.push("domain="+a),o===!0&&u.push("secure"),document.cookie=u.join("; ")},read:function(s){const n=document.cookie.match(new RegExp("(^|;\\s*)("+s+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function(s){this.write(s,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}();function In(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function jn(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t}function Yt(t,e){return t&&!In(e)?jn(t,e):e}const Zn=$.isStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),s=document.createElement("a");let n;function r(i){let a=i;return e&&(s.setAttribute("href",a),a=s.href),s.setAttribute("href",a),{href:s.href,protocol:s.protocol?s.protocol.replace(/:$/,""):"",host:s.host,search:s.search?s.search.replace(/^\?/,""):"",hash:s.hash?s.hash.replace(/^#/,""):"",hostname:s.hostname,port:s.port,pathname:s.pathname.charAt(0)==="/"?s.pathname:"/"+s.pathname}}return n=r(window.location.href),function(a){const o=c.isString(a)?r(a):a;return o.protocol===n.protocol&&o.host===n.host}}():function(){return function(){return!0}}();function Ln(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function Dn(t,e){t=t||10;const s=new Array(t),n=new Array(t);let r=0,i=0,a;return e=e!==void 0?e:1e3,function(u){const l=Date.now(),f=n[i];a||(a=l),s[r]=u,n[r]=l;let _=i,A=0;for(;_!==r;)A+=s[_++],_=_%t;if(r=(r+1)%t,r===i&&(i=(i+1)%t),l-a<e)return;const N=f&&l-f;return N?Math.round(A*1e3/N):void 0}}function Qt(t,e){let s=0;const n=Dn(50,250);return r=>{const i=r.loaded,a=r.lengthComputable?r.total:void 0,o=i-s,u=n(o),l=i<=a;s=i;const f={loaded:i,total:a,progress:a?i/a:void 0,bytes:o,rate:u||void 0,estimated:u&&a&&l?(a-i)/u:void 0,event:r};f[e?"download":"upload"]=!0,t(f)}}const Pe={http:cn,xhr:typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(s,n){let r=t.data;const i=H.from(t.headers).normalize(),a=t.responseType;let o;function u(){t.cancelToken&&t.cancelToken.unsubscribe(o),t.signal&&t.signal.removeEventListener("abort",o)}c.isFormData(r)&&($.isStandardBrowserEnv||$.isStandardBrowserWebWorkerEnv?i.setContentType(!1):i.setContentType("multipart/form-data;",!1));let l=new XMLHttpRequest;if(t.auth){const N=t.auth.username||"",g=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";i.set("Authorization","Basic "+btoa(N+":"+g))}const f=Yt(t.baseURL,t.url);l.open(t.method.toUpperCase(),Jt(f,t.params,t.paramsSerializer),!0),l.timeout=t.timeout;function _(){if(!l)return;const N=H.from("getAllResponseHeaders"in l&&l.getAllResponseHeaders()),S={data:!a||a==="text"||a==="json"?l.responseText:l.response,status:l.status,statusText:l.statusText,headers:N,config:t,request:l};An(function(U){s(U),u()},function(U){n(U),u()},S),l=null}if("onloadend"in l?l.onloadend=_:l.onreadystatechange=function(){!l||l.readyState!==4||l.status===0&&!(l.responseURL&&l.responseURL.indexOf("file:")===0)||setTimeout(_)},l.onabort=function(){l&&(n(new T("Request aborted",T.ECONNABORTED,t,l)),l=null)},l.onerror=function(){n(new T("Network Error",T.ERR_NETWORK,t,l)),l=null},l.ontimeout=function(){let g=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded";const S=t.transitional||Kt;t.timeoutErrorMessage&&(g=t.timeoutErrorMessage),n(new T(g,S.clarifyTimeoutError?T.ETIMEDOUT:T.ECONNABORTED,t,l)),l=null},$.isStandardBrowserEnv){const N=(t.withCredentials||Zn(f))&&t.xsrfCookieName&&Rn.read(t.xsrfCookieName);N&&i.set(t.xsrfHeaderName,N)}r===void 0&&i.setContentType(null),"setRequestHeader"in l&&c.forEach(i.toJSON(),function(g,S){l.setRequestHeader(S,g)}),c.isUndefined(t.withCredentials)||(l.withCredentials=!!t.withCredentials),a&&a!=="json"&&(l.responseType=t.responseType),typeof t.onDownloadProgress=="function"&&l.addEventListener("progress",Qt(t.onDownloadProgress,!0)),typeof t.onUploadProgress=="function"&&l.upload&&l.upload.addEventListener("progress",Qt(t.onUploadProgress)),(t.cancelToken||t.signal)&&(o=N=>{l&&(n(!N||N.type?new me(null,t,l):N),l.abort(),l=null)},t.cancelToken&&t.cancelToken.subscribe(o),t.signal&&(t.signal.aborted?o():t.signal.addEventListener("abort",o)));const A=Ln(f);if(A&&$.protocols.indexOf(A)===-1){n(new T("Unsupported protocol "+A+":",T.ERR_BAD_REQUEST,t));return}l.send(r||null)})}};c.forEach(Pe,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const Pn={getAdapter:t=>{t=c.isArray(t)?t:[t];const{length:e}=t;let s,n;for(let r=0;r<e&&(s=t[r],!(n=c.isString(s)?Pe[s.toLowerCase()]:s));r++);if(!n)throw n===!1?new T(`Adapter ${s} is not supported by the environment`,"ERR_NOT_SUPPORT"):new Error(c.hasOwnProp(Pe,s)?`Adapter '${s}' is not available in the build`:`Unknown adapter '${s}'`);if(!c.isFunction(n))throw new TypeError("adapter is not a function");return n},adapters:Pe};function ot(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new me(null,t)}function es(t){return ot(t),t.headers=H.from(t.headers),t.data=at.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),Pn.getAdapter(t.adapter||rt.adapter)(t).then(function(n){return ot(t),n.data=at.call(t,t.transformResponse,n),n.headers=H.from(n.headers),n},function(n){return Xt(n)||(ot(t),n&&n.response&&(n.response.data=at.call(t,t.transformResponse,n.response),n.response.headers=H.from(n.response.headers))),Promise.reject(n)})}const ts=t=>t instanceof H?t.toJSON():t;function ae(t,e){e=e||{};const s={};function n(l,f,_){return c.isPlainObject(l)&&c.isPlainObject(f)?c.merge.call({caseless:_},l,f):c.isPlainObject(f)?c.merge({},f):c.isArray(f)?f.slice():f}function r(l,f,_){if(c.isUndefined(f)){if(!c.isUndefined(l))return n(void 0,l,_)}else return n(l,f,_)}function i(l,f){if(!c.isUndefined(f))return n(void 0,f)}function a(l,f){if(c.isUndefined(f)){if(!c.isUndefined(l))return n(void 0,l)}else return n(void 0,f)}function o(l,f,_){if(_ in e)return n(l,f);if(_ in t)return n(void 0,l)}const u={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:o,headers:(l,f)=>r(ts(l),ts(f),!0)};return c.forEach(Object.keys(Object.assign({},t,e)),function(f){const _=u[f]||r,A=_(t[f],e[f],f);c.isUndefined(A)&&_!==o||(s[f]=A)}),s}const ss="1.4.0",lt={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{lt[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});const ns={};lt.transitional=function(e,s,n){function r(i,a){return"[Axios v"+ss+"] Transitional option '"+i+"'"+a+(n?". "+n:"")}return(i,a,o)=>{if(e===!1)throw new T(r(a," has been removed"+(s?" in "+s:"")),T.ERR_DEPRECATED);return s&&!ns[a]&&(ns[a]=!0,console.warn(r(a," has been deprecated since v"+s+" and will be removed in the near future"))),e?e(i,a,o):!0}};function Bn(t,e,s){if(typeof t!="object")throw new T("options must be an object",T.ERR_BAD_OPTION_VALUE);const n=Object.keys(t);let r=n.length;for(;r-- >0;){const i=n[r],a=e[i];if(a){const o=t[i],u=o===void 0||a(o,i,t);if(u!==!0)throw new T("option "+i+" must be "+u,T.ERR_BAD_OPTION_VALUE);continue}if(s!==!0)throw new T("Unknown option "+i,T.ERR_BAD_OPTION)}}const ct={assertOptions:Bn,validators:lt},G=ct.validators;class Be{constructor(e){this.defaults=e,this.interceptors={request:new Wt,response:new Wt}}request(e,s){typeof e=="string"?(s=s||{},s.url=e):s=e||{},s=ae(this.defaults,s);const{transitional:n,paramsSerializer:r,headers:i}=s;n!==void 0&&ct.assertOptions(n,{silentJSONParsing:G.transitional(G.boolean),forcedJSONParsing:G.transitional(G.boolean),clarifyTimeoutError:G.transitional(G.boolean)},!1),r!=null&&(c.isFunction(r)?s.paramsSerializer={serialize:r}:ct.assertOptions(r,{encode:G.function,serialize:G.function},!0)),s.method=(s.method||this.defaults.method||"get").toLowerCase();let a;a=i&&c.merge(i.common,i[s.method]),a&&c.forEach(["delete","get","head","post","put","patch","common"],g=>{delete i[g]}),s.headers=H.concat(a,i);const o=[];let u=!0;this.interceptors.request.forEach(function(S){typeof S.runWhen=="function"&&S.runWhen(s)===!1||(u=u&&S.synchronous,o.unshift(S.fulfilled,S.rejected))});const l=[];this.interceptors.response.forEach(function(S){l.push(S.fulfilled,S.rejected)});let f,_=0,A;if(!u){const g=[es.bind(this),void 0];for(g.unshift.apply(g,o),g.push.apply(g,l),A=g.length,f=Promise.resolve(s);_<A;)f=f.then(g[_++],g[_++]);return f}A=o.length;let N=s;for(_=0;_<A;){const g=o[_++],S=o[_++];try{N=g(N)}catch(K){S.call(this,K);break}}try{f=es.call(this,N)}catch(g){return Promise.reject(g)}for(_=0,A=l.length;_<A;)f=f.then(l[_++],l[_++]);return f}getUri(e){e=ae(this.defaults,e);const s=Yt(e.baseURL,e.url);return Jt(s,e.params,e.paramsSerializer)}}c.forEach(["delete","get","head","options"],function(e){Be.prototype[e]=function(s,n){return this.request(ae(n||{},{method:e,url:s,data:(n||{}).data}))}}),c.forEach(["post","put","patch"],function(e){function s(n){return function(i,a,o){return this.request(ae(o||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:i,data:a}))}}Be.prototype[e]=s(),Be.prototype[e+"Form"]=s(!0)});const Me=Be;class ut{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let s;this.promise=new Promise(function(i){s=i});const n=this;this.promise.then(r=>{if(!n._listeners)return;let i=n._listeners.length;for(;i-- >0;)n._listeners[i](r);n._listeners=null}),this.promise.then=r=>{let i;const a=new Promise(o=>{n.subscribe(o),i=o}).then(r);return a.cancel=function(){n.unsubscribe(i)},a},e(function(i,a,o){n.reason||(n.reason=new me(i,a,o),s(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const s=this._listeners.indexOf(e);s!==-1&&this._listeners.splice(s,1)}static source(){let e;return{token:new ut(function(r){e=r}),cancel:e}}}const Mn=ut;function Un(t){return function(s){return t.apply(null,s)}}function zn(t){return c.isObject(t)&&t.isAxiosError===!0}const dt={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(dt).forEach(([t,e])=>{dt[e]=t});const $n=dt;function rs(t){const e=new Me(t),s=At(Me.prototype.request,e);return c.extend(s,Me.prototype,e,{allOwnKeys:!0}),c.extend(s,e,null,{allOwnKeys:!0}),s.create=function(r){return rs(ae(t,r))},s}const R=rs(rt);R.Axios=Me,R.CanceledError=me,R.CancelToken=Mn,R.isCancel=Xt,R.VERSION=ss,R.toFormData=je,R.AxiosError=T,R.Cancel=R.CanceledError,R.all=function(e){return Promise.all(e)},R.spread=Un,R.isAxiosError=zn,R.mergeConfig=ae,R.AxiosHeaders=H,R.formToJSON=t=>qt(c.isHTMLForm(t)?new FormData(t):t),R.HttpStatusCode=$n,R.default=R;const ft=R;function ht({apiKey:t,options:e}){let s={};return t&&Z(s,["headers","Authorization"],`API-Key ${t}`),e&&(s=q(s,e)),s}async function is({url:t,apiKey:e,options:s}){return await ft.get(t,ht({apiKey:e,options:s}))}async function as({url:t,apiKey:e,options:s,payload:n={}}){return await ft.post(t,n,ht({apiKey:e,options:s}))}async function Vn({url:t,apiKey:e,options:s,payload:n}){return await ft.put(t,n,ht({apiKey:e,options:s}))}async function ye(t){try{return await t()}catch(e){return Promise.reject(e)}}async function Fn({apiKey:t,apiHost:e},s,n){return ye(async()=>{const r=(await as({url:`${e}/api/v1/images/book/${s}`,apiKey:t,payload:n})).data;return vs.parse(r)})}var E;(function(t){t.assertEqual=r=>r;function e(r){}t.assertIs=e;function s(r){throw new Error}t.assertNever=s,t.arrayToEnum=r=>{const i={};for(const a of r)i[a]=a;return i},t.getValidEnumValues=r=>{const i=t.objectKeys(r).filter(o=>typeof r[r[o]]!="number"),a={};for(const o of i)a[o]=r[o];return t.objectValues(a)},t.objectValues=r=>t.objectKeys(r).map(function(i){return r[i]}),t.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{const i=[];for(const a in r)Object.prototype.hasOwnProperty.call(r,a)&&i.push(a);return i},t.find=(r,i)=>{for(const a of r)if(i(a))return a},t.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&isFinite(r)&&Math.floor(r)===r;function n(r,i=" | "){return r.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}t.joinValues=n,t.jsonStringifyReplacer=(r,i)=>typeof i=="bigint"?i.toString():i})(E||(E={}));var pt;(function(t){t.mergeShapes=(e,s)=>({...e,...s})})(pt||(pt={}));const p=E.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),X=t=>{switch(typeof t){case"undefined":return p.undefined;case"string":return p.string;case"number":return isNaN(t)?p.nan:p.number;case"boolean":return p.boolean;case"function":return p.function;case"bigint":return p.bigint;case"symbol":return p.symbol;case"object":return Array.isArray(t)?p.array:t===null?p.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?p.promise:typeof Map<"u"&&t instanceof Map?p.map:typeof Set<"u"&&t instanceof Set?p.set:typeof Date<"u"&&t instanceof Date?p.date:p.object;default:return p.unknown}},h=E.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Hn=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");class D extends Error{constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const s=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,s):this.__proto__=s,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const s=e||function(i){return i.message},n={_errors:[]},r=i=>{for(const a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(r);else if(a.code==="invalid_return_type")r(a.returnTypeError);else if(a.code==="invalid_arguments")r(a.argumentsError);else if(a.path.length===0)n._errors.push(s(a));else{let o=n,u=0;for(;u<a.path.length;){const l=a.path[u];u===a.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(s(a))):o[l]=o[l]||{_errors:[]},o=o[l],u++}}};return r(this),n}toString(){return this.message}get message(){return JSON.stringify(this.issues,E.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=s=>s.message){const s={},n=[];for(const r of this.issues)r.path.length>0?(s[r.path[0]]=s[r.path[0]]||[],s[r.path[0]].push(e(r))):n.push(e(r));return{formErrors:n,fieldErrors:s}}get formErrors(){return this.flatten()}}D.create=t=>new D(t);const ge=(t,e)=>{let s;switch(t.code){case h.invalid_type:t.received===p.undefined?s="Required":s=`Expected ${t.expected}, received ${t.received}`;break;case h.invalid_literal:s=`Invalid literal value, expected ${JSON.stringify(t.expected,E.jsonStringifyReplacer)}`;break;case h.unrecognized_keys:s=`Unrecognized key(s) in object: ${E.joinValues(t.keys,", ")}`;break;case h.invalid_union:s="Invalid input";break;case h.invalid_union_discriminator:s=`Invalid discriminator value. Expected ${E.joinValues(t.options)}`;break;case h.invalid_enum_value:s=`Invalid enum value. Expected ${E.joinValues(t.options)}, received '${t.received}'`;break;case h.invalid_arguments:s="Invalid function arguments";break;case h.invalid_return_type:s="Invalid function return type";break;case h.invalid_date:s="Invalid date";break;case h.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(s=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(s=`${s} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?s=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?s=`Invalid input: must end with "${t.validation.endsWith}"`:E.assertNever(t.validation):t.validation!=="regex"?s=`Invalid ${t.validation}`:s="Invalid";break;case h.too_small:t.type==="array"?s=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?s=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?s=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?s=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:s="Invalid input";break;case h.too_big:t.type==="array"?s=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?s=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?s=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?s=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?s=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:s="Invalid input";break;case h.custom:s="Invalid input";break;case h.invalid_intersection_types:s="Intersection results could not be merged";break;case h.not_multiple_of:s=`Number must be a multiple of ${t.multipleOf}`;break;case h.not_finite:s="Number must be finite";break;default:s=e.defaultError,E.assertNever(t)}return{message:s}};let os=ge;function Jn(t){os=t}function Ue(){return os}const ze=t=>{const{data:e,path:s,errorMaps:n,issueData:r}=t,i=[...s,...r.path||[]],a={...r,path:i};let o="";const u=n.filter(l=>!!l).slice().reverse();for(const l of u)o=l(a,{data:e,defaultError:o}).message;return{...r,path:i,message:r.message||o}},Wn=[];function m(t,e){const s=ze({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ue(),ge].filter(n=>!!n)});t.common.issues.push(s)}class I{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,s){const n=[];for(const r of s){if(r.status==="aborted")return w;r.status==="dirty"&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,s){const n=[];for(const r of s)n.push({key:await r.key,value:await r.value});return I.mergeObjectSync(e,n)}static mergeObjectSync(e,s){const n={};for(const r of s){const{key:i,value:a}=r;if(i.status==="aborted"||a.status==="aborted")return w;i.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),(typeof a.value<"u"||r.alwaysSet)&&(n[i.value]=a.value)}return{status:e.value,value:n}}}const w=Object.freeze({status:"aborted"}),ls=t=>({status:"dirty",value:t}),j=t=>({status:"valid",value:t}),mt=t=>t.status==="aborted",yt=t=>t.status==="dirty",$e=t=>t.status==="valid",Ve=t=>typeof Promise<"u"&&t instanceof Promise;var y;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(y||(y={}));class V{constructor(e,s,n,r){this._cachedPath=[],this.parent=e,this.data=s,this._path=n,this._key=r}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const cs=(t,e)=>{if($e(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const s=new D(t.common.issues);return this._error=s,this._error}}};function x(t){if(!t)return{};const{errorMap:e,invalid_type_error:s,required_error:n,description:r}=t;if(e&&(s||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(a,o)=>a.code!=="invalid_type"?{message:o.defaultError}:typeof o.data>"u"?{message:n??o.defaultError}:{message:s??o.defaultError},description:r}}class k{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return X(e.data)}_getOrReturnCtx(e,s){return s||{common:e.parent.common,data:e.data,parsedType:X(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new I,ctx:{common:e.parent.common,data:e.data,parsedType:X(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const s=this._parse(e);if(Ve(s))throw new Error("Synchronous parse encountered promise.");return s}_parseAsync(e){const s=this._parse(e);return Promise.resolve(s)}parse(e,s){const n=this.safeParse(e,s);if(n.success)return n.data;throw n.error}safeParse(e,s){var n;const r={common:{issues:[],async:(n=s==null?void 0:s.async)!==null&&n!==void 0?n:!1,contextualErrorMap:s==null?void 0:s.errorMap},path:(s==null?void 0:s.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:X(e)},i=this._parseSync({data:e,path:r.path,parent:r});return cs(r,i)}async parseAsync(e,s){const n=await this.safeParseAsync(e,s);if(n.success)return n.data;throw n.error}async safeParseAsync(e,s){const n={common:{issues:[],contextualErrorMap:s==null?void 0:s.errorMap,async:!0},path:(s==null?void 0:s.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:X(e)},r=this._parse({data:e,path:n.path,parent:n}),i=await(Ve(r)?r:Promise.resolve(r));return cs(n,i)}refine(e,s){const n=r=>typeof s=="string"||typeof s>"u"?{message:s}:typeof s=="function"?s(r):s;return this._refinement((r,i)=>{const a=e(r),o=()=>i.addIssue({code:h.custom,...n(r)});return typeof Promise<"u"&&a instanceof Promise?a.then(u=>u?!0:(o(),!1)):a?!0:(o(),!1)})}refinement(e,s){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof s=="function"?s(n,r):s),!1))}_refinement(e){return new M({schema:this,typeName:v.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return W.create(this,this._def)}nullable(){return re.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return B.create(this,this._def)}promise(){return ue.create(this,this._def)}or(e){return we.create([this,e],this._def)}and(e){return xe.create(this,e,this._def)}transform(e){return new M({...x(this._def),schema:this,typeName:v.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const s=typeof e=="function"?e:()=>e;return new Oe({...x(this._def),innerType:this,defaultValue:s,typeName:v.ZodDefault})}brand(){return new ds({typeName:v.ZodBranded,type:this,...x(this._def)})}catch(e){const s=typeof e=="function"?e:()=>e;return new qe({...x(this._def),innerType:this,catchValue:s,typeName:v.ZodCatch})}describe(e){const s=this.constructor;return new s({...this._def,description:e})}pipe(e){return Ne.create(this,e)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Kn=/^c[^\s-]{8,}$/i,qn=/^[a-z][a-z0-9]*$/,Gn=/[0-9A-HJKMNP-TV-Z]{26}/,Xn=/^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i,Yn=/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\])|(\[IPv6:(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))\])|([A-Za-z0-9]([A-Za-z0-9-]*[A-Za-z0-9])*(\.[A-Za-z]{2,})+))$/,Qn=/^(\p{Extended_Pictographic}|\p{Emoji_Component})+$/u,er=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,tr=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,sr=t=>t.precision?t.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${t.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${t.precision}}Z$`):t.precision===0?t.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):t.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function nr(t,e){return!!((e==="v4"||!e)&&er.test(t)||(e==="v6"||!e)&&tr.test(t))}class P extends k{constructor(){super(...arguments),this._regex=(e,s,n)=>this.refinement(r=>e.test(r),{validation:s,code:h.invalid_string,...y.errToObj(n)}),this.nonempty=e=>this.min(1,y.errToObj(e)),this.trim=()=>new P({...this._def,checks:[...this._def.checks,{kind:"trim"}]}),this.toLowerCase=()=>new P({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]}),this.toUpperCase=()=>new P({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==p.string){const i=this._getOrReturnCtx(e);return m(i,{code:h.invalid_type,expected:p.string,received:i.parsedType}),w}const n=new I;let r;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(r=this._getOrReturnCtx(e,r),m(r,{code:h.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")e.data.length>i.value&&(r=this._getOrReturnCtx(e,r),m(r,{code:h.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){const a=e.data.length>i.value,o=e.data.length<i.value;(a||o)&&(r=this._getOrReturnCtx(e,r),a?m(r,{code:h.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):o&&m(r,{code:h.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")Yn.test(e.data)||(r=this._getOrReturnCtx(e,r),m(r,{validation:"email",code:h.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Qn.test(e.data)||(r=this._getOrReturnCtx(e,r),m(r,{validation:"emoji",code:h.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")Xn.test(e.data)||(r=this._getOrReturnCtx(e,r),m(r,{validation:"uuid",code:h.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")Kn.test(e.data)||(r=this._getOrReturnCtx(e,r),m(r,{validation:"cuid",code:h.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")qn.test(e.data)||(r=this._getOrReturnCtx(e,r),m(r,{validation:"cuid2",code:h.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")Gn.test(e.data)||(r=this._getOrReturnCtx(e,r),m(r,{validation:"ulid",code:h.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),m(r,{validation:"url",code:h.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),m(r,{validation:"regex",code:h.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(r=this._getOrReturnCtx(e,r),m(r,{code:h.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(r=this._getOrReturnCtx(e,r),m(r,{code:h.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(r=this._getOrReturnCtx(e,r),m(r,{code:h.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?sr(i).test(e.data)||(r=this._getOrReturnCtx(e,r),m(r,{code:h.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="ip"?nr(e.data,i.version)||(r=this._getOrReturnCtx(e,r),m(r,{validation:"ip",code:h.invalid_string,message:i.message}),n.dirty()):E.assertNever(i);return{status:n.value,value:e.data}}_addCheck(e){return new P({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...y.errToObj(e)})}url(e){return this._addCheck({kind:"url",...y.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...y.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...y.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...y.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...y.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...y.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...y.errToObj(e)})}datetime(e){var s;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(s=e==null?void 0:e.offset)!==null&&s!==void 0?s:!1,...y.errToObj(e==null?void 0:e.message)})}regex(e,s){return this._addCheck({kind:"regex",regex:e,...y.errToObj(s)})}includes(e,s){return this._addCheck({kind:"includes",value:e,position:s==null?void 0:s.position,...y.errToObj(s==null?void 0:s.message)})}startsWith(e,s){return this._addCheck({kind:"startsWith",value:e,...y.errToObj(s)})}endsWith(e,s){return this._addCheck({kind:"endsWith",value:e,...y.errToObj(s)})}min(e,s){return this._addCheck({kind:"min",value:e,...y.errToObj(s)})}max(e,s){return this._addCheck({kind:"max",value:e,...y.errToObj(s)})}length(e,s){return this._addCheck({kind:"length",value:e,...y.errToObj(s)})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get minLength(){let e=null;for(const s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e}get maxLength(){let e=null;for(const s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e}}P.create=t=>{var e;return new P({checks:[],typeName:v.ZodString,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...x(t)})};function rr(t,e){const s=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,r=s>n?s:n,i=parseInt(t.toFixed(r).replace(".","")),a=parseInt(e.toFixed(r).replace(".",""));return i%a/Math.pow(10,r)}class Y extends k{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==p.number){const i=this._getOrReturnCtx(e);return m(i,{code:h.invalid_type,expected:p.number,received:i.parsedType}),w}let n;const r=new I;for(const i of this._def.checks)i.kind==="int"?E.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),m(n,{code:h.invalid_type,expected:"integer",received:"float",message:i.message}),r.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),m(n,{code:h.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),r.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),m(n,{code:h.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),r.dirty()):i.kind==="multipleOf"?rr(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),m(n,{code:h.not_multiple_of,multipleOf:i.value,message:i.message}),r.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),m(n,{code:h.not_finite,message:i.message}),r.dirty()):E.assertNever(i);return{status:r.value,value:e.data}}gte(e,s){return this.setLimit("min",e,!0,y.toString(s))}gt(e,s){return this.setLimit("min",e,!1,y.toString(s))}lte(e,s){return this.setLimit("max",e,!0,y.toString(s))}lt(e,s){return this.setLimit("max",e,!1,y.toString(s))}setLimit(e,s,n,r){return new Y({...this._def,checks:[...this._def.checks,{kind:e,value:s,inclusive:n,message:y.toString(r)}]})}_addCheck(e){return new Y({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:y.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:y.toString(e)})}multipleOf(e,s){return this._addCheck({kind:"multipleOf",value:e,message:y.toString(s)})}finite(e){return this._addCheck({kind:"finite",message:y.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:y.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:y.toString(e)})}get minValue(){let e=null;for(const s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e}get maxValue(){let e=null;for(const s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&E.isInteger(e.value))}get isFinite(){let e=null,s=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(s===null||n.value>s)&&(s=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(s)&&Number.isFinite(e)}}Y.create=t=>new Y({checks:[],typeName:v.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...x(t)});class Q extends k{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==p.bigint){const i=this._getOrReturnCtx(e);return m(i,{code:h.invalid_type,expected:p.bigint,received:i.parsedType}),w}let n;const r=new I;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),m(n,{code:h.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),r.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),m(n,{code:h.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),r.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),m(n,{code:h.not_multiple_of,multipleOf:i.value,message:i.message}),r.dirty()):E.assertNever(i);return{status:r.value,value:e.data}}gte(e,s){return this.setLimit("min",e,!0,y.toString(s))}gt(e,s){return this.setLimit("min",e,!1,y.toString(s))}lte(e,s){return this.setLimit("max",e,!0,y.toString(s))}lt(e,s){return this.setLimit("max",e,!1,y.toString(s))}setLimit(e,s,n,r){return new Q({...this._def,checks:[...this._def.checks,{kind:e,value:s,inclusive:n,message:y.toString(r)}]})}_addCheck(e){return new Q({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:y.toString(e)})}multipleOf(e,s){return this._addCheck({kind:"multipleOf",value:e,message:y.toString(s)})}get minValue(){let e=null;for(const s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e}get maxValue(){let e=null;for(const s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e}}Q.create=t=>{var e;return new Q({checks:[],typeName:v.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...x(t)})};class ve extends k{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==p.boolean){const n=this._getOrReturnCtx(e);return m(n,{code:h.invalid_type,expected:p.boolean,received:n.parsedType}),w}return j(e.data)}}ve.create=t=>new ve({typeName:v.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...x(t)});class te extends k{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==p.date){const i=this._getOrReturnCtx(e);return m(i,{code:h.invalid_type,expected:p.date,received:i.parsedType}),w}if(isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return m(i,{code:h.invalid_date}),w}const n=new I;let r;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(r=this._getOrReturnCtx(e,r),m(r,{code:h.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(r=this._getOrReturnCtx(e,r),m(r,{code:h.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):E.assertNever(i);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new te({...this._def,checks:[...this._def.checks,e]})}min(e,s){return this._addCheck({kind:"min",value:e.getTime(),message:y.toString(s)})}max(e,s){return this._addCheck({kind:"max",value:e.getTime(),message:y.toString(s)})}get minDate(){let e=null;for(const s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e!=null?new Date(e):null}}te.create=t=>new te({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:v.ZodDate,...x(t)});class Fe extends k{_parse(e){if(this._getType(e)!==p.symbol){const n=this._getOrReturnCtx(e);return m(n,{code:h.invalid_type,expected:p.symbol,received:n.parsedType}),w}return j(e.data)}}Fe.create=t=>new Fe({typeName:v.ZodSymbol,...x(t)});class _e extends k{_parse(e){if(this._getType(e)!==p.undefined){const n=this._getOrReturnCtx(e);return m(n,{code:h.invalid_type,expected:p.undefined,received:n.parsedType}),w}return j(e.data)}}_e.create=t=>new _e({typeName:v.ZodUndefined,...x(t)});class be extends k{_parse(e){if(this._getType(e)!==p.null){const n=this._getOrReturnCtx(e);return m(n,{code:h.invalid_type,expected:p.null,received:n.parsedType}),w}return j(e.data)}}be.create=t=>new be({typeName:v.ZodNull,...x(t)});class oe extends k{constructor(){super(...arguments),this._any=!0}_parse(e){return j(e.data)}}oe.create=t=>new oe({typeName:v.ZodAny,...x(t)});class se extends k{constructor(){super(...arguments),this._unknown=!0}_parse(e){return j(e.data)}}se.create=t=>new se({typeName:v.ZodUnknown,...x(t)});class J extends k{_parse(e){const s=this._getOrReturnCtx(e);return m(s,{code:h.invalid_type,expected:p.never,received:s.parsedType}),w}}J.create=t=>new J({typeName:v.ZodNever,...x(t)});class He extends k{_parse(e){if(this._getType(e)!==p.undefined){const n=this._getOrReturnCtx(e);return m(n,{code:h.invalid_type,expected:p.void,received:n.parsedType}),w}return j(e.data)}}He.create=t=>new He({typeName:v.ZodVoid,...x(t)});class B extends k{_parse(e){const{ctx:s,status:n}=this._processInputParams(e),r=this._def;if(s.parsedType!==p.array)return m(s,{code:h.invalid_type,expected:p.array,received:s.parsedType}),w;if(r.exactLength!==null){const a=s.data.length>r.exactLength.value,o=s.data.length<r.exactLength.value;(a||o)&&(m(s,{code:a?h.too_big:h.too_small,minimum:o?r.exactLength.value:void 0,maximum:a?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(r.minLength!==null&&s.data.length<r.minLength.value&&(m(s,{code:h.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),r.maxLength!==null&&s.data.length>r.maxLength.value&&(m(s,{code:h.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),s.common.async)return Promise.all([...s.data].map((a,o)=>r.type._parseAsync(new V(s,a,s.path,o)))).then(a=>I.mergeArray(n,a));const i=[...s.data].map((a,o)=>r.type._parseSync(new V(s,a,s.path,o)));return I.mergeArray(n,i)}get element(){return this._def.type}min(e,s){return new B({...this._def,minLength:{value:e,message:y.toString(s)}})}max(e,s){return new B({...this._def,maxLength:{value:e,message:y.toString(s)}})}length(e,s){return new B({...this._def,exactLength:{value:e,message:y.toString(s)}})}nonempty(e){return this.min(1,e)}}B.create=(t,e)=>new B({type:t,minLength:null,maxLength:null,exactLength:null,typeName:v.ZodArray,...x(e)});function le(t){if(t instanceof C){const e={};for(const s in t.shape){const n=t.shape[s];e[s]=W.create(le(n))}return new C({...t._def,shape:()=>e})}else return t instanceof B?new B({...t._def,type:le(t.element)}):t instanceof W?W.create(le(t.unwrap())):t instanceof re?re.create(le(t.unwrap())):t instanceof F?F.create(t.items.map(e=>le(e))):t}class C extends k{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),s=E.objectKeys(e);return this._cached={shape:e,keys:s}}_parse(e){if(this._getType(e)!==p.object){const l=this._getOrReturnCtx(e);return m(l,{code:h.invalid_type,expected:p.object,received:l.parsedType}),w}const{status:n,ctx:r}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),o=[];if(!(this._def.catchall instanceof J&&this._def.unknownKeys==="strip"))for(const l in r.data)a.includes(l)||o.push(l);const u=[];for(const l of a){const f=i[l],_=r.data[l];u.push({key:{status:"valid",value:l},value:f._parse(new V(r,_,r.path,l)),alwaysSet:l in r.data})}if(this._def.catchall instanceof J){const l=this._def.unknownKeys;if(l==="passthrough")for(const f of o)u.push({key:{status:"valid",value:f},value:{status:"valid",value:r.data[f]}});else if(l==="strict")o.length>0&&(m(r,{code:h.unrecognized_keys,keys:o}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const f of o){const _=r.data[f];u.push({key:{status:"valid",value:f},value:l._parse(new V(r,_,r.path,f)),alwaysSet:f in r.data})}}return r.common.async?Promise.resolve().then(async()=>{const l=[];for(const f of u){const _=await f.key;l.push({key:_,value:await f.value,alwaysSet:f.alwaysSet})}return l}).then(l=>I.mergeObjectSync(n,l)):I.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return y.errToObj,new C({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(s,n)=>{var r,i,a,o;const u=(a=(i=(r=this._def).errorMap)===null||i===void 0?void 0:i.call(r,s,n).message)!==null&&a!==void 0?a:n.defaultError;return s.code==="unrecognized_keys"?{message:(o=y.errToObj(e).message)!==null&&o!==void 0?o:u}:{message:u}}}:{}})}strip(){return new C({...this._def,unknownKeys:"strip"})}passthrough(){return new C({...this._def,unknownKeys:"passthrough"})}extend(e){return new C({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new C({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:v.ZodObject})}setKey(e,s){return this.augment({[e]:s})}catchall(e){return new C({...this._def,catchall:e})}pick(e){const s={};return E.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(s[n]=this.shape[n])}),new C({...this._def,shape:()=>s})}omit(e){const s={};return E.objectKeys(this.shape).forEach(n=>{e[n]||(s[n]=this.shape[n])}),new C({...this._def,shape:()=>s})}deepPartial(){return le(this)}partial(e){const s={};return E.objectKeys(this.shape).forEach(n=>{const r=this.shape[n];e&&!e[n]?s[n]=r:s[n]=r.optional()}),new C({...this._def,shape:()=>s})}required(e){const s={};return E.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])s[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof W;)i=i._def.innerType;s[n]=i}}),new C({...this._def,shape:()=>s})}keyof(){return us(E.objectKeys(this.shape))}}C.create=(t,e)=>new C({shape:()=>t,unknownKeys:"strip",catchall:J.create(),typeName:v.ZodObject,...x(e)}),C.strictCreate=(t,e)=>new C({shape:()=>t,unknownKeys:"strict",catchall:J.create(),typeName:v.ZodObject,...x(e)}),C.lazycreate=(t,e)=>new C({shape:t,unknownKeys:"strip",catchall:J.create(),typeName:v.ZodObject,...x(e)});class we extends k{_parse(e){const{ctx:s}=this._processInputParams(e),n=this._def.options;function r(i){for(const o of i)if(o.result.status==="valid")return o.result;for(const o of i)if(o.result.status==="dirty")return s.common.issues.push(...o.ctx.common.issues),o.result;const a=i.map(o=>new D(o.ctx.common.issues));return m(s,{code:h.invalid_union,unionErrors:a}),w}if(s.common.async)return Promise.all(n.map(async i=>{const a={...s,common:{...s.common,issues:[]},parent:null};return{result:await i._parseAsync({data:s.data,path:s.path,parent:a}),ctx:a}})).then(r);{let i;const a=[];for(const u of n){const l={...s,common:{...s.common,issues:[]},parent:null},f=u._parseSync({data:s.data,path:s.path,parent:l});if(f.status==="valid")return f;f.status==="dirty"&&!i&&(i={result:f,ctx:l}),l.common.issues.length&&a.push(l.common.issues)}if(i)return s.common.issues.push(...i.ctx.common.issues),i.result;const o=a.map(u=>new D(u));return m(s,{code:h.invalid_union,unionErrors:o}),w}}get options(){return this._def.options}}we.create=(t,e)=>new we({options:t,typeName:v.ZodUnion,...x(e)});const Je=t=>t instanceof Se?Je(t.schema):t instanceof M?Je(t.innerType()):t instanceof Te?[t.value]:t instanceof ee?t.options:t instanceof Ee?Object.keys(t.enum):t instanceof Oe?Je(t._def.innerType):t instanceof _e?[void 0]:t instanceof be?[null]:null;class We extends k{_parse(e){const{ctx:s}=this._processInputParams(e);if(s.parsedType!==p.object)return m(s,{code:h.invalid_type,expected:p.object,received:s.parsedType}),w;const n=this.discriminator,r=s.data[n],i=this.optionsMap.get(r);return i?s.common.async?i._parseAsync({data:s.data,path:s.path,parent:s}):i._parseSync({data:s.data,path:s.path,parent:s}):(m(s,{code:h.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),w)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,s,n){const r=new Map;for(const i of s){const a=Je(i.shape[e]);if(!a)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of a){if(r.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);r.set(o,i)}}return new We({typeName:v.ZodDiscriminatedUnion,discriminator:e,options:s,optionsMap:r,...x(n)})}}function gt(t,e){const s=X(t),n=X(e);if(t===e)return{valid:!0,data:t};if(s===p.object&&n===p.object){const r=E.objectKeys(e),i=E.objectKeys(t).filter(o=>r.indexOf(o)!==-1),a={...t,...e};for(const o of i){const u=gt(t[o],e[o]);if(!u.valid)return{valid:!1};a[o]=u.data}return{valid:!0,data:a}}else if(s===p.array&&n===p.array){if(t.length!==e.length)return{valid:!1};const r=[];for(let i=0;i<t.length;i++){const a=t[i],o=e[i],u=gt(a,o);if(!u.valid)return{valid:!1};r.push(u.data)}return{valid:!0,data:r}}else return s===p.date&&n===p.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class xe extends k{_parse(e){const{status:s,ctx:n}=this._processInputParams(e),r=(i,a)=>{if(mt(i)||mt(a))return w;const o=gt(i.value,a.value);return o.valid?((yt(i)||yt(a))&&s.dirty(),{status:s.value,value:o.data}):(m(n,{code:h.invalid_intersection_types}),w)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,a])=>r(i,a)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}xe.create=(t,e,s)=>new xe({left:t,right:e,typeName:v.ZodIntersection,...x(s)});class F extends k{_parse(e){const{status:s,ctx:n}=this._processInputParams(e);if(n.parsedType!==p.array)return m(n,{code:h.invalid_type,expected:p.array,received:n.parsedType}),w;if(n.data.length<this._def.items.length)return m(n,{code:h.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),w;!this._def.rest&&n.data.length>this._def.items.length&&(m(n,{code:h.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),s.dirty());const i=[...n.data].map((a,o)=>{const u=this._def.items[o]||this._def.rest;return u?u._parse(new V(n,a,n.path,o)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>I.mergeArray(s,a)):I.mergeArray(s,i)}get items(){return this._def.items}rest(e){return new F({...this._def,rest:e})}}F.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new F({items:t,typeName:v.ZodTuple,rest:null,...x(e)})};class ke extends k{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:s,ctx:n}=this._processInputParams(e);if(n.parsedType!==p.object)return m(n,{code:h.invalid_type,expected:p.object,received:n.parsedType}),w;const r=[],i=this._def.keyType,a=this._def.valueType;for(const o in n.data)r.push({key:i._parse(new V(n,o,n.path,o)),value:a._parse(new V(n,n.data[o],n.path,o))});return n.common.async?I.mergeObjectAsync(s,r):I.mergeObjectSync(s,r)}get element(){return this._def.valueType}static create(e,s,n){return s instanceof k?new ke({keyType:e,valueType:s,typeName:v.ZodRecord,...x(n)}):new ke({keyType:P.create(),valueType:e,typeName:v.ZodRecord,...x(s)})}}class Ke extends k{_parse(e){const{status:s,ctx:n}=this._processInputParams(e);if(n.parsedType!==p.map)return m(n,{code:h.invalid_type,expected:p.map,received:n.parsedType}),w;const r=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([o,u],l)=>({key:r._parse(new V(n,o,n.path,[l,"key"])),value:i._parse(new V(n,u,n.path,[l,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const u of a){const l=await u.key,f=await u.value;if(l.status==="aborted"||f.status==="aborted")return w;(l.status==="dirty"||f.status==="dirty")&&s.dirty(),o.set(l.value,f.value)}return{status:s.value,value:o}})}else{const o=new Map;for(const u of a){const l=u.key,f=u.value;if(l.status==="aborted"||f.status==="aborted")return w;(l.status==="dirty"||f.status==="dirty")&&s.dirty(),o.set(l.value,f.value)}return{status:s.value,value:o}}}}Ke.create=(t,e,s)=>new Ke({valueType:e,keyType:t,typeName:v.ZodMap,...x(s)});class ne extends k{_parse(e){const{status:s,ctx:n}=this._processInputParams(e);if(n.parsedType!==p.set)return m(n,{code:h.invalid_type,expected:p.set,received:n.parsedType}),w;const r=this._def;r.minSize!==null&&n.data.size<r.minSize.value&&(m(n,{code:h.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),s.dirty()),r.maxSize!==null&&n.data.size>r.maxSize.value&&(m(n,{code:h.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),s.dirty());const i=this._def.valueType;function a(u){const l=new Set;for(const f of u){if(f.status==="aborted")return w;f.status==="dirty"&&s.dirty(),l.add(f.value)}return{status:s.value,value:l}}const o=[...n.data.values()].map((u,l)=>i._parse(new V(n,u,n.path,l)));return n.common.async?Promise.all(o).then(u=>a(u)):a(o)}min(e,s){return new ne({...this._def,minSize:{value:e,message:y.toString(s)}})}max(e,s){return new ne({...this._def,maxSize:{value:e,message:y.toString(s)}})}size(e,s){return this.min(e,s).max(e,s)}nonempty(e){return this.min(1,e)}}ne.create=(t,e)=>new ne({valueType:t,minSize:null,maxSize:null,typeName:v.ZodSet,...x(e)});class ce extends k{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:s}=this._processInputParams(e);if(s.parsedType!==p.function)return m(s,{code:h.invalid_type,expected:p.function,received:s.parsedType}),w;function n(o,u){return ze({data:o,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,Ue(),ge].filter(l=>!!l),issueData:{code:h.invalid_arguments,argumentsError:u}})}function r(o,u){return ze({data:o,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,Ue(),ge].filter(l=>!!l),issueData:{code:h.invalid_return_type,returnTypeError:u}})}const i={errorMap:s.common.contextualErrorMap},a=s.data;return this._def.returns instanceof ue?j(async(...o)=>{const u=new D([]),l=await this._def.args.parseAsync(o,i).catch(A=>{throw u.addIssue(n(o,A)),u}),f=await a(...l);return await this._def.returns._def.type.parseAsync(f,i).catch(A=>{throw u.addIssue(r(f,A)),u})}):j((...o)=>{const u=this._def.args.safeParse(o,i);if(!u.success)throw new D([n(o,u.error)]);const l=a(...u.data),f=this._def.returns.safeParse(l,i);if(!f.success)throw new D([r(l,f.error)]);return f.data})}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new ce({...this._def,args:F.create(e).rest(se.create())})}returns(e){return new ce({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,s,n){return new ce({args:e||F.create([]).rest(se.create()),returns:s||se.create(),typeName:v.ZodFunction,...x(n)})}}class Se extends k{get schema(){return this._def.getter()}_parse(e){const{ctx:s}=this._processInputParams(e);return this._def.getter()._parse({data:s.data,path:s.path,parent:s})}}Se.create=(t,e)=>new Se({getter:t,typeName:v.ZodLazy,...x(e)});class Te extends k{_parse(e){if(e.data!==this._def.value){const s=this._getOrReturnCtx(e);return m(s,{received:s.data,code:h.invalid_literal,expected:this._def.value}),w}return{status:"valid",value:e.data}}get value(){return this._def.value}}Te.create=(t,e)=>new Te({value:t,typeName:v.ZodLiteral,...x(e)});function us(t,e){return new ee({values:t,typeName:v.ZodEnum,...x(e)})}class ee extends k{_parse(e){if(typeof e.data!="string"){const s=this._getOrReturnCtx(e),n=this._def.values;return m(s,{expected:E.joinValues(n),received:s.parsedType,code:h.invalid_type}),w}if(this._def.values.indexOf(e.data)===-1){const s=this._getOrReturnCtx(e),n=this._def.values;return m(s,{received:s.data,code:h.invalid_enum_value,options:n}),w}return j(e.data)}get options(){return this._def.values}get enum(){const e={};for(const s of this._def.values)e[s]=s;return e}get Values(){const e={};for(const s of this._def.values)e[s]=s;return e}get Enum(){const e={};for(const s of this._def.values)e[s]=s;return e}extract(e){return ee.create(e)}exclude(e){return ee.create(this.options.filter(s=>!e.includes(s)))}}ee.create=us;class Ee extends k{_parse(e){const s=E.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==p.string&&n.parsedType!==p.number){const r=E.objectValues(s);return m(n,{expected:E.joinValues(r),received:n.parsedType,code:h.invalid_type}),w}if(s.indexOf(e.data)===-1){const r=E.objectValues(s);return m(n,{received:n.data,code:h.invalid_enum_value,options:r}),w}return j(e.data)}get enum(){return this._def.values}}Ee.create=(t,e)=>new Ee({values:t,typeName:v.ZodNativeEnum,...x(e)});class ue extends k{unwrap(){return this._def.type}_parse(e){const{ctx:s}=this._processInputParams(e);if(s.parsedType!==p.promise&&s.common.async===!1)return m(s,{code:h.invalid_type,expected:p.promise,received:s.parsedType}),w;const n=s.parsedType===p.promise?s.data:Promise.resolve(s.data);return j(n.then(r=>this._def.type.parseAsync(r,{path:s.path,errorMap:s.common.contextualErrorMap})))}}ue.create=(t,e)=>new ue({type:t,typeName:v.ZodPromise,...x(e)});class M extends k{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===v.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:s,ctx:n}=this._processInputParams(e),r=this._def.effect||null;if(r.type==="preprocess"){const a=r.transform(n.data);return n.common.async?Promise.resolve(a).then(o=>this._def.schema._parseAsync({data:o,path:n.path,parent:n})):this._def.schema._parseSync({data:a,path:n.path,parent:n})}const i={addIssue:a=>{m(n,a),a.fatal?s.abort():s.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),r.type==="refinement"){const a=o=>{const u=r.refinement(o,i);if(n.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?w:(o.status==="dirty"&&s.dirty(),a(o.value),{status:s.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?w:(o.status==="dirty"&&s.dirty(),a(o.value).then(()=>({status:s.value,value:o.value}))))}if(r.type==="transform")if(n.common.async===!1){const a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!$e(a))return a;const o=r.transform(a.value,i);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:s.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>$e(a)?Promise.resolve(r.transform(a.value,i)).then(o=>({status:s.value,value:o})):a);E.assertNever(r)}}M.create=(t,e,s)=>new M({schema:t,typeName:v.ZodEffects,effect:e,...x(s)}),M.createWithPreprocess=(t,e,s)=>new M({schema:e,effect:{type:"preprocess",transform:t},typeName:v.ZodEffects,...x(s)});class W extends k{_parse(e){return this._getType(e)===p.undefined?j(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}W.create=(t,e)=>new W({innerType:t,typeName:v.ZodOptional,...x(e)});class re extends k{_parse(e){return this._getType(e)===p.null?j(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}re.create=(t,e)=>new re({innerType:t,typeName:v.ZodNullable,...x(e)});class Oe extends k{_parse(e){const{ctx:s}=this._processInputParams(e);let n=s.data;return s.parsedType===p.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:s.path,parent:s})}removeDefault(){return this._def.innerType}}Oe.create=(t,e)=>new Oe({innerType:t,typeName:v.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...x(e)});class qe extends k{_parse(e){const{ctx:s}=this._processInputParams(e),n={...s,common:{...s.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Ve(r)?r.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new D(n.common.issues)},input:n.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new D(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}qe.create=(t,e)=>new qe({innerType:t,typeName:v.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...x(e)});class Ge extends k{_parse(e){if(this._getType(e)!==p.nan){const n=this._getOrReturnCtx(e);return m(n,{code:h.invalid_type,expected:p.nan,received:n.parsedType}),w}return{status:"valid",value:e.data}}}Ge.create=t=>new Ge({typeName:v.ZodNaN,...x(t)});const ir=Symbol("zod_brand");class ds extends k{_parse(e){const{ctx:s}=this._processInputParams(e),n=s.data;return this._def.type._parse({data:n,path:s.path,parent:s})}unwrap(){return this._def.type}}class Ne extends k{_parse(e){const{status:s,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?w:i.status==="dirty"?(s.dirty(),ls(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{const r=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return r.status==="aborted"?w:r.status==="dirty"?(s.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:n.path,parent:n})}}static create(e,s){return new Ne({in:e,out:s,typeName:v.ZodPipeline})}}const fs=(t,e={},s)=>t?oe.create().superRefine((n,r)=>{var i,a;if(!t(n)){const o=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,u=(a=(i=o.fatal)!==null&&i!==void 0?i:s)!==null&&a!==void 0?a:!0,l=typeof o=="string"?{message:o}:o;r.addIssue({code:"custom",...l,fatal:u})}}):oe.create(),ar={object:C.lazycreate};var v;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline"})(v||(v={}));const or=(t,e={message:`Input not instance of ${t.name}`})=>fs(s=>s instanceof t,e),hs=P.create,ps=Y.create,lr=Ge.create,cr=Q.create,ms=ve.create,ur=te.create,dr=Fe.create,fr=_e.create,hr=be.create,pr=oe.create,mr=se.create,yr=J.create,gr=He.create,vr=B.create,_r=C.create,br=C.strictCreate,wr=we.create,xr=We.create,kr=xe.create,Sr=F.create,Tr=ke.create,Er=Ke.create,Or=ne.create,Nr=ce.create,Cr=Se.create,Ar=Te.create,Rr=ee.create,Ir=Ee.create,jr=ue.create,ys=M.create,Zr=W.create,Lr=re.create,Dr=M.createWithPreprocess,Pr=Ne.create;var d=Object.freeze({__proto__:null,defaultErrorMap:ge,setErrorMap:Jn,getErrorMap:Ue,makeIssue:ze,EMPTY_PATH:Wn,addIssueToContext:m,ParseStatus:I,INVALID:w,DIRTY:ls,OK:j,isAborted:mt,isDirty:yt,isValid:$e,isAsync:Ve,get util(){return E},get objectUtil(){return pt},ZodParsedType:p,getParsedType:X,ZodType:k,ZodString:P,ZodNumber:Y,ZodBigInt:Q,ZodBoolean:ve,ZodDate:te,ZodSymbol:Fe,ZodUndefined:_e,ZodNull:be,ZodAny:oe,ZodUnknown:se,ZodNever:J,ZodVoid:He,ZodArray:B,ZodObject:C,ZodUnion:we,ZodDiscriminatedUnion:We,ZodIntersection:xe,ZodTuple:F,ZodRecord:ke,ZodMap:Ke,ZodSet:ne,ZodFunction:ce,ZodLazy:Se,ZodLiteral:Te,ZodEnum:ee,ZodNativeEnum:Ee,ZodPromise:ue,ZodEffects:M,ZodTransformer:M,ZodOptional:W,ZodNullable:re,ZodDefault:Oe,ZodCatch:qe,ZodNaN:Ge,BRAND:ir,ZodBranded:ds,ZodPipeline:Ne,custom:fs,Schema:k,ZodSchema:k,late:ar,get ZodFirstPartyTypeKind(){return v},coerce:{string:t=>P.create({...t,coerce:!0}),number:t=>Y.create({...t,coerce:!0}),boolean:t=>ve.create({...t,coerce:!0}),bigint:t=>Q.create({...t,coerce:!0}),date:t=>te.create({...t,coerce:!0})},any:pr,array:vr,bigint:cr,boolean:ms,date:ur,discriminatedUnion:xr,effect:ys,enum:Rr,function:Nr,instanceof:or,intersection:kr,lazy:Cr,literal:Ar,map:Er,nan:lr,nativeEnum:Ir,never:yr,null:hr,nullable:Lr,number:ps,object:_r,oboolean:()=>ms().optional(),onumber:()=>ps().optional(),optional:Zr,ostring:()=>hs().optional(),pipeline:Pr,preprocess:Dr,promise:jr,record:Tr,set:Or,strictObject:br,string:hs,symbol:dr,transformer:ys,tuple:Sr,undefined:fr,union:wr,unknown:mr,void:gr,NEVER:w,ZodIssueCode:h,quotelessJson:Hn,ZodError:D});class gs{constructor(e,s){b(this,"client");b(this,"parentId");b(this,"images");b(this,"length");this.client=e,this.parentId=s,this.images=[],this.length=this.images.length}async add(e){return this.images.push(e),this.length=this.images.length,await Fn(this.client,this.parentId,new _s(e)),new Promise(s=>{s(this.length)})}}const vs=d.object({handle:d.string(),url:d.string(),width:d.number(),height:d.number(),orientation:d.number(),taken_at:d.string(),camera_make:d.string().optional(),camera:d.string().optional(),filename:d.string()});class _s{constructor(e){b(this,"handle");b(this,"url");b(this,"width");b(this,"height");b(this,"orientation");b(this,"taken_at");b(this,"camera_make");b(this,"camera");b(this,"filename");this.handle=e.handle,this.url=e.url,this.width=e.width,this.height=e.height,this.orientation=e.rotation,this.taken_at=e.captureTime,this.camera_make=e.cameraMake,this.camera=e.cameraModel,this.filename=e.filename}}const bs=["new","ingesting","submitted","storyboarding","deduplication","image selection","designing","layouting","embellishing","polishing","ready","error"],vt=["baby","birthday","default","everyday","family","kids","life-stories","portfolio","school-memories","seasonal-holidays","special-celebrations","sports-and-hobbies","travel","wedding","year-in-review"],_t={1005:{slug:"modern-black-sfly"},1101:{slug:"bon-voyage-sfly"},1103:{slug:"fun-in-the-sun-sfly"},1201:{slug:"modern-wedding-sfly"},3001:{slug:"digiscrap-sfly"},4034:{slug:"travel-snapshots-sfly"},4035:{slug:"vintage-travel-sfly"},5017:{slug:"natural-neutrals-sfly"},5033:{slug:"chalkboard-chic-sfly"},5079:{slug:"hello-spring-sfly"},5082:{slug:"familygram-sfly"},5085:{slug:"best-day-ever-sfly"},5091:{slug:"little-love-sfly"},5118:{slug:"a-year-in-color-sfly"},5120:{slug:"milestone-anniversaries-sfly"},5121:{slug:"the-travel-bug-sfly"},5122:{slug:"modern-white-sfly"},5127:{slug:"outdoor-wedding-sfly"},5134:{slug:"classic-wedding-sfly"},5138:{slug:"kraft-pop-sfly"},5142:{slug:"simply-black-sfly"},5144:{slug:"autumn-memories-sfly"},5146:{slug:"everyday-sentiments-sfly"},5149:{slug:"everyday-happiness-sfly"},5150:{slug:"its-a-girl-thing-sfly"},5155:{slug:"made-with-love-sfly"},5157:{slug:"high-school-memories-sfly"},5161:{slug:"rustic-wedding-sfly"},5165:{slug:"life-is-grand-sfly"},5167:{slug:"adventure-awaits-sfly"},5168:{slug:"disney-adventure-sfly"},5171:{slug:"world-travel-sfly"},5174:{slug:"hello-summer-sfly"},5183:{slug:"everything-sports-sfly"},5188:{slug:"everyday-watercolor-sfly"},5189:{slug:"holiday-memories-sfly"},5213:{slug:"love-and-thanks-sfly"},5218:{slug:"babys-first-year-sfly"},5219:{slug:"usa-travel-sfly"},5220:{slug:"vintage-wedding-sfly"},5226:{slug:"love-you-because-sfly"},5228:{slug:"reunion-sfly"},5238:{slug:"whimsy-chalkboard-sfly"},5242:{slug:"modern-indigo-sfly"},5250:{slug:"family-yearbook-sfly"},5255:{slug:"elegant-wedding-sfly"},5258:{slug:"family-vacation-sfly"},5259:{slug:"beach-travel-sfly"},5261:{slug:"sparkle-and-shine-sfly"},5262:{slug:"welcome-baby-sfly"},5265:{slug:"vivid-watercolor-sfly"},5266:{slug:"what-i-love-about-you-sfly"},5272:{slug:"love-grows-sfly"},5274:{slug:"painted-seasons-sfly"},5278:{slug:"vintage-disney-sfly"},5292:{slug:"modern-grey-sfly"},5297:{slug:"modern-love-story-sfly"},5299:{slug:"modern-travel-sfly"},5304:{slug:"beach-wedding-sfly"},5305:{slug:"rustic-farmhouse-sfly"},5308:{slug:"tropical-travel-sfly"},6e3:{slug:"travel-abroad-sfly"},6001:{slug:"everyday-rustic-sfly"},6002:{slug:"simply-modern-sfly"},6003:{slug:"modern-baby-sfly"},6004:{slug:"modern-photo-album-sfly"},6005:{slug:"travel-adventures-sfly"},6006:{slug:"watercolor-year-in-review-sfly"},6007:{slug:"beach-bliss-sfly"},6008:{slug:"simply-gray-sfly"},6009:{slug:"family-favorites-by-lure-design-sfly"},6010:{slug:"travel-gallery-sfly"},6011:{slug:"our-wedding-day-sfly"},6012:{slug:"chic-celebrations-by-float-paperie-sfly"},6013:{slug:"simply-bold-type-sfly"},6014:{slug:"colorful-florals-by-potts-design-sfly"},6015:{slug:"softly-rustic-sfly"},6016:{slug:"ombre-watercolor-sfly"},6017:{slug:"forever-love-by-with-merriment-sfly"},6018:{slug:"colorful-memories-by-britt-bass-sfly"},6019:{slug:"celebrate-family-by-float-paperie-sfly"},6020:{slug:"disney-family-adventures-sfly"},6021:{slug:"everyday-neutrals-sfly"},6022:{slug:"colorful-childhood-sfly"},6023:{slug:"everyday-indigo-sfly"},6024:{slug:"shimmer-and-shine-sfly"},6025:{slug:"summertime-fun-sfly"},6026:{slug:"pet-lover-sfly"},6027:{slug:"modern-wedding-story-sfly"},6028:{slug:"family-blessings-by-potts-design-sfly"},6030:{slug:"outdoor-adventures-by-sarah-hawkins-designs-sfly"},6031:{slug:"travel-memories-sfly"},6032:{slug:"tropical-travels-sfly"},6033:{slug:"everyday-chalkboard-by-potts-design-sfly"},6034:{slug:"classic-disney-sfly"},6035:{slug:"cheerful-color-sfly"},6036:{slug:"colorful-birthday-sfly"},6038:{slug:"classic-baby-sfly"},6039:{slug:"bold-year-in-review-by-float-paperie-sfly"},6040:{slug:"colorfully-fun-sfly"},6041:{slug:"colorful-year-in-review-by-sarah-hawkins-designs-sfly"},6042:{slug:"gilded-wedding-sfly"},6043:{slug:"road-trip-travel-by-sarah-hawkins-designs-sfly"},6044:{slug:"rustic-gilded-wedding-sfly"},6045:{slug:"elegantly-scripted-year-in-review-sfly"},6047:{slug:"2020-what-a-year-sfly"},6057:{slug:"best-mom-ever-sfly"},6052:{slug:"celebration-of-life-by-sarah-hawkins-designs-sfly"},6054:{slug:"colorful-school-days-by-float-paperie-sfly"},6051:{slug:"love-is-all-we-need-sfly"},6058:{slug:"graduation-celebration-sfly"},6056:{slug:"our-wedding-day-guestbook-sfly"},6055:{slug:"muted-everyday-abstract-sfly"},6046:{slug:"winter-memories-by-sarah-hawkins-design-sfly"},6053:{slug:"best-dad-ever-sfly"},6050:{slug:"watercolor-greenery-by-sarah-hawkins-designs-sfly"},6063:{slug:"watercolor-floral-wedding-by-kim-thoa-sfly"},6060:{slug:"watercolor-baby-girl-sfly"},6059:{slug:"watercolor-baby-boy-sfly"},6048:{slug:"simple-elegant-wedding-sfly"},6049:{slug:"gilded-wedding-guestbook-sfly"},6037:{slug:"everyday-fairytale-by-jenny-romanski-sfly"},6061:{slug:"best-grandparents-ever-sfly"},6068:{slug:"winter-getaway-sfly"},6067:{slug:"national-parks-travel-by-eiman-design-co-sfly"},6065:{slug:"go-sports-by-lure-design-sfly"},6066:{slug:"elegant-wedding-greenery-by-kim-thoa-sfly"},6064:{slug:"boho-travel-by-umaiana-studio-sfly"},6071:{slug:"modern-dark-neutrals-sfly"},6072:{slug:"modern-light-neutrals-sfly"},6073:{slug:"modern-celebrations-sfly"},6074:{slug:"bright-and-bold-kids-year-in-review-by-sarah-hawkins-designs-sfly"},6085:{slug:"classic-school-yearbook-sfly"},6084:{slug:"colorful-elementary-school-yearbook-sfly"},5402:{slug:"everyday-recipes-by-slightly-stationery-sfly"},6083:{slug:"school-days-yearbook-sfly"},6082:{slug:"the-story-of-me-sfly"},6086:{slug:"whimsical-recipes-by-slightly-stationery-sfly"},6101:{slug:"babys-first-sfly"},6103:{slug:"classic-recipes-sfly"},6104:{slug:"elevated-rustic-sfly"},6105:{slug:"boho-summer-sfly"},6116:{slug:"boho-baby-sfly"},6117:{slug:"simply-gallery-sfly"},6118:{slug:"this-is-love-sfly"},6120:{slug:"wedding-gallery-sfly"},6121:{slug:"watercolorwashes-sfly"},6124:{slug:"graduation-photo-album-sfly"},6125:{slug:"modern-year-in-review-photo-album-sfly"},6126:{slug:"black-white-photo-album-sfly"},6132:{slug:"travel-journal-sfly"},6133:{slug:"rustic-gallery-sfly"},6137:{slug:"summer-adventures-sfly"},6075:{slug:"together-again-sfly"},6078:{slug:"everyday-boho-by-umaiana-studio-sfly"},6089:{slug:"colorful-gradients-sfly"},6096:{slug:"simply-scrapbook-sfly"},6097:{slug:"boho-wedding-sfly"},6098:{slug:"black-and-white-rustic-sfly"},6099:{slug:"bright-color-pop-sfly"}},bt=["8x8","10x10","12x12","8x11","11x8","11x14"],wt=["sc","hc","pl"],xt=["sp","sl","dl"],kt=["low","medium","high"],St=["best","most","all"],Tt=["none","few","lots"],Et=["none","few","lots"],Br="https://zrrpg8wwbe.execute-api.us-east-1.amazonaws.com/sfly-sls",Mr="wss://cwfzk5wg4m.execute-api.us-east-1.amazonaws.com/sfly-sls",Ur=parseInt("300000")||3e5;class zr{constructor(e){b(this,"occasion");b(this,"style");b(this,"book_size");b(this,"cover_type");b(this,"page_type");b(this,"image_density");b(this,"image_filtering_level");b(this,"embellishment_level");b(this,"text_sticker_level");this.occasion=e.occasion,this.style=e.style,this.book_size=e.book_size,this.cover_type=e.cover_type,this.page_type=e.page_type,this.image_density=e.image_density,this.image_filtering_level=e.image_filtering_level,this.embellishment_level=e.embellishment_level,this.text_sticker_level=e.text_sticker_level}}const $r=d.object({occasion:d.enum(vt),style:d.string(),book_size:d.enum(bt),cover_type:d.enum(wt),page_type:d.enum(xt),image_density:d.enum(kt),image_filtering_level:d.enum(St),embellishment_level:d.enum(Tt),text_sticker_level:d.enum(Et)}),ws=d.object({id:d.string(),title:d.string(),design_request:$r,state:d.enum(bs).optional(),guid:d.string().optional()});class Ot{constructor(e){b(this,"id");b(this,"title");b(this,"design_request");b(this,"state");b(this,"guid");this.id=e.id,this.title=e.title,this.design_request=new zr(e.design_request),this.state=e.state,this.guid=e.guid}}function xs(t){const e=_t[t.style].slug,s=Nt(JSON.parse(JSON.stringify(t)));return s.style=e,new Ot({id:t.parentId,guid:t.guid,title:t.title,design_request:s})}const Xe=d.object({maxPageCount:d.number(),minPageCount:d.number(),maxImageCount:d.number(),avgImageCount:d.number(),minImageCount:d.number()}),ks=d.object({high:Xe,medium:Xe,low:Xe}),Ss=d.object({densities:ks});async function Vr({apiKey:t,apiHost:e},s,n){return ye(async()=>{const r=await is({url:`${e}/api/v1/designoptions/booksize/${s}/imagecount/${n}`,apiKey:t}),i=Ct(r.data);return Ss.parse(i)})}const Fr=d.object({photoRefId:d.string(),finalCrop:d.array(d.number())}),Hr=d.object({x:d.number(),y:d.number(),width:d.number().optional(),height:d.number().optional(),rotation:d.number()}),Jr=d.object({id:d.string(),llx:d.number(),lly:d.number(),urx:d.number(),ury:d.number(),data:d.string().nullable(),title:d.string(),width:d.number(),effect:d.string(),height:d.number(),source:d.string(),rotation:d.number(),uploadTime:d.string()}),Wr=d.object({key:d.string(),value:d.union([d.string(),d.number(),d.boolean()]).nullable()}),Kr=d.object({type:d.string(),imageAssignment:Fr.optional(),position:Hr,seqNum:d.number(),z:d.number(),id:d.string().optional(),horizJustification:d.string().optional(),vertJustification:d.string().optional().nullable(),text:d.string().optional(),fontId:d.string().optional(),fontSize:d.number().optional(),fontColor:d.string().optional(),frame:d.string().optional()}),qr=d.object({url:d.string(),encryptId:d.string(),photoRefId:d.string(),photoId:d.string(),photoMetadata:Jr}),Gr=d.object({properties:d.array(Wr)}),Xr=d.object({backgroundId:d.string().nullable(),assets:d.array(Kr).optional()}),Yr=d.object({pageNum:d.number(),type:d.string(),canvas:Xr}),Qr=d.object({pages:d.array(Yr),photoStrip:d.array(qr)}),ei=d.object({title:d.string(),binding:d.string(),coverSpecId:d.string(),styleId:d.number(),userId:d.string(),magicShopBook:Qr,reportingData:Gr});async function ti({apiHost:t,apiKey:e},s){return ye(async()=>{const n=(await as({url:`${t}/api/v1/books`,apiKey:e,payload:s})).data;return ws.safeParse(n),new Ot(n)})}async function Ts({apiHost:t,apiKey:e},s){return ye(async()=>{const n=(await Vn({url:`${t}/api/v1/books/${s.id}`,apiKey:e,payload:s})).data;return ws.safeParse(n),new Ot(n)})}async function si({apiHost:t,apiKey:e},s){return ye(async()=>{const n=(await is({url:`${t}/api/v1/books/${s}/format/galleon`,apiKey:e})).data;return ei.parse(n)})}class Es{constructor(e,s,n){b(this,"client");b(this,"parentId");b(this,"title");b(this,"occasion");b(this,"style");b(this,"bookSize");b(this,"coverType");b(this,"pageType");b(this,"imageDensity");b(this,"imageFilteringLevel");b(this,"embellishmentLevel");b(this,"textStickerLevel");b(this,"images");b(this,"guid");this.client=s,this.parentId=e,this.title=(n==null?void 0:n.title)||"",this.occasion=(n==null?void 0:n.occasion)||vt[0],this.style=(n==null?void 0:n.style)||parseInt(Object.keys(_t)[0]),this.bookSize=(n==null?void 0:n.bookSize)||bt[0],this.coverType=(n==null?void 0:n.coverType)||wt[0],this.pageType=(n==null?void 0:n.pageType)||xt[0],this.imageDensity=(n==null?void 0:n.imageDensity)||kt[0],this.imageFilteringLevel=(n==null?void 0:n.imageFilteringLevel)||St[0],this.embellishmentLevel=(n==null?void 0:n.embellishmentLevel)||Tt[0],this.textStickerLevel=(n==null?void 0:n.textStickerLevel)||Et[0],this.images=new gs(this.client,this.parentId)}async getOptions(e){return await Vr(this.client,this.bookSize,e||this.images.length)}async submit(e){return e&&Object.assign(this,e),this.getProgress(),await Ts(this.client,xs(this)),this}async setGuid(e){return this.guid=e,await Ts(this.client,xs(this)),this.guid}async getJSON(){return await si(this.client,this.parentId)}async getProgress(){let e="new";const s=new WebSocket(`${this.client.webSocketHost}/?book_id=${this.parentId}`),n=setTimeout(()=>{throw s.close(),new Error("Something went wrong. Please try again.")},Ur);s.onmessage=r=>{const i=JSON.parse(r.data);if(e!==i.state){e=i.state;const a=new CustomEvent("MagicBook.designRequestUpdated",{detail:i});["error","ready"].includes(i.state)&&(s.close(),clearTimeout(n)),window.dispatchEvent(a)}}}}class ni{constructor(e,s=Br,n=Mr){b(this,"apiKey");b(this,"apiHost");b(this,"webSocketHost");this.apiKey=e,this.apiHost=s,this.webSocketHost=n}async createDesignRequest(e){const s=await ti(this);return new Es(s.id,this,e)}}O.DesignRequest=Es,O.ImageServer=_s,O.Images=gs,O.MagicBookClient=ni,O.bookSizes=bt,O.coverTypes=wt,O.designOptionsSchema=Ss,O.embellishmentLevels=Tt,O.imageDensities=kt,O.imageDensityOptionSchema=Xe,O.imageDensityOptionsSchema=ks,O.imageFilteringLevels=St,O.imageServerSchema=vs,O.occasions=vt,O.pageTypes=xt,O.states=bs,O.styles=_t,O.textStickerLevels=Et,Object.defineProperty(O,Symbol.toStringTag,{value:"Module"})});
3
+ `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...s){const n=new this(e);return s.forEach(r=>n.set(r)),n}static accessor(e){const n=(this[Gt]=this[Gt]={accessors:{}}).accessors,r=this.prototype;function i(a){const o=pe(a);n[o]||(Cn(r,a),n[o]=!0)}return c.isArray(e)?e.forEach(i):i(e),this}}De.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),c.freezeMethods(De.prototype),c.freezeMethods(De);const H=De;function at(t,e){const s=this||rt,n=e||s,r=H.from(n.headers);let i=n.data;return c.forEach(t,function(o){i=o.call(s,i,r.normalize(),e?e.status:void 0)}),r.normalize(),i}function Xt(t){return!!(t&&t.__CANCEL__)}function me(t,e,s){T.call(this,t??"canceled",T.ERR_CANCELED,e,s),this.name="CanceledError"}c.inherits(me,T,{__CANCEL__:!0});function An(t,e,s){const n=s.config.validateStatus;!s.status||!n||n(s.status)?t(s):e(new T("Request failed with status code "+s.status,[T.ERR_BAD_REQUEST,T.ERR_BAD_RESPONSE][Math.floor(s.status/100)-4],s.config,s.request,s))}const Rn=$.isStandardBrowserEnv?function(){return{write:function(s,n,r,i,a,o){const u=[];u.push(s+"="+encodeURIComponent(n)),c.isNumber(r)&&u.push("expires="+new Date(r).toGMTString()),c.isString(i)&&u.push("path="+i),c.isString(a)&&u.push("domain="+a),o===!0&&u.push("secure"),document.cookie=u.join("; ")},read:function(s){const n=document.cookie.match(new RegExp("(^|;\\s*)("+s+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function(s){this.write(s,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}();function In(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function jn(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t}function Yt(t,e){return t&&!In(e)?jn(t,e):e}const Zn=$.isStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),s=document.createElement("a");let n;function r(i){let a=i;return e&&(s.setAttribute("href",a),a=s.href),s.setAttribute("href",a),{href:s.href,protocol:s.protocol?s.protocol.replace(/:$/,""):"",host:s.host,search:s.search?s.search.replace(/^\?/,""):"",hash:s.hash?s.hash.replace(/^#/,""):"",hostname:s.hostname,port:s.port,pathname:s.pathname.charAt(0)==="/"?s.pathname:"/"+s.pathname}}return n=r(window.location.href),function(a){const o=c.isString(a)?r(a):a;return o.protocol===n.protocol&&o.host===n.host}}():function(){return function(){return!0}}();function Ln(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function Dn(t,e){t=t||10;const s=new Array(t),n=new Array(t);let r=0,i=0,a;return e=e!==void 0?e:1e3,function(u){const l=Date.now(),f=n[i];a||(a=l),s[r]=u,n[r]=l;let _=i,A=0;for(;_!==r;)A+=s[_++],_=_%t;if(r=(r+1)%t,r===i&&(i=(i+1)%t),l-a<e)return;const N=f&&l-f;return N?Math.round(A*1e3/N):void 0}}function Qt(t,e){let s=0;const n=Dn(50,250);return r=>{const i=r.loaded,a=r.lengthComputable?r.total:void 0,o=i-s,u=n(o),l=i<=a;s=i;const f={loaded:i,total:a,progress:a?i/a:void 0,bytes:o,rate:u||void 0,estimated:u&&a&&l?(a-i)/u:void 0,event:r};f[e?"download":"upload"]=!0,t(f)}}const Pe={http:cn,xhr:typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(s,n){let r=t.data;const i=H.from(t.headers).normalize(),a=t.responseType;let o;function u(){t.cancelToken&&t.cancelToken.unsubscribe(o),t.signal&&t.signal.removeEventListener("abort",o)}c.isFormData(r)&&($.isStandardBrowserEnv||$.isStandardBrowserWebWorkerEnv?i.setContentType(!1):i.setContentType("multipart/form-data;",!1));let l=new XMLHttpRequest;if(t.auth){const N=t.auth.username||"",g=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";i.set("Authorization","Basic "+btoa(N+":"+g))}const f=Yt(t.baseURL,t.url);l.open(t.method.toUpperCase(),Jt(f,t.params,t.paramsSerializer),!0),l.timeout=t.timeout;function _(){if(!l)return;const N=H.from("getAllResponseHeaders"in l&&l.getAllResponseHeaders()),S={data:!a||a==="text"||a==="json"?l.responseText:l.response,status:l.status,statusText:l.statusText,headers:N,config:t,request:l};An(function(U){s(U),u()},function(U){n(U),u()},S),l=null}if("onloadend"in l?l.onloadend=_:l.onreadystatechange=function(){!l||l.readyState!==4||l.status===0&&!(l.responseURL&&l.responseURL.indexOf("file:")===0)||setTimeout(_)},l.onabort=function(){l&&(n(new T("Request aborted",T.ECONNABORTED,t,l)),l=null)},l.onerror=function(){n(new T("Network Error",T.ERR_NETWORK,t,l)),l=null},l.ontimeout=function(){let g=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded";const S=t.transitional||Kt;t.timeoutErrorMessage&&(g=t.timeoutErrorMessage),n(new T(g,S.clarifyTimeoutError?T.ETIMEDOUT:T.ECONNABORTED,t,l)),l=null},$.isStandardBrowserEnv){const N=(t.withCredentials||Zn(f))&&t.xsrfCookieName&&Rn.read(t.xsrfCookieName);N&&i.set(t.xsrfHeaderName,N)}r===void 0&&i.setContentType(null),"setRequestHeader"in l&&c.forEach(i.toJSON(),function(g,S){l.setRequestHeader(S,g)}),c.isUndefined(t.withCredentials)||(l.withCredentials=!!t.withCredentials),a&&a!=="json"&&(l.responseType=t.responseType),typeof t.onDownloadProgress=="function"&&l.addEventListener("progress",Qt(t.onDownloadProgress,!0)),typeof t.onUploadProgress=="function"&&l.upload&&l.upload.addEventListener("progress",Qt(t.onUploadProgress)),(t.cancelToken||t.signal)&&(o=N=>{l&&(n(!N||N.type?new me(null,t,l):N),l.abort(),l=null)},t.cancelToken&&t.cancelToken.subscribe(o),t.signal&&(t.signal.aborted?o():t.signal.addEventListener("abort",o)));const A=Ln(f);if(A&&$.protocols.indexOf(A)===-1){n(new T("Unsupported protocol "+A+":",T.ERR_BAD_REQUEST,t));return}l.send(r||null)})}};c.forEach(Pe,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const Pn={getAdapter:t=>{t=c.isArray(t)?t:[t];const{length:e}=t;let s,n;for(let r=0;r<e&&(s=t[r],!(n=c.isString(s)?Pe[s.toLowerCase()]:s));r++);if(!n)throw n===!1?new T(`Adapter ${s} is not supported by the environment`,"ERR_NOT_SUPPORT"):new Error(c.hasOwnProp(Pe,s)?`Adapter '${s}' is not available in the build`:`Unknown adapter '${s}'`);if(!c.isFunction(n))throw new TypeError("adapter is not a function");return n},adapters:Pe};function ot(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new me(null,t)}function es(t){return ot(t),t.headers=H.from(t.headers),t.data=at.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),Pn.getAdapter(t.adapter||rt.adapter)(t).then(function(n){return ot(t),n.data=at.call(t,t.transformResponse,n),n.headers=H.from(n.headers),n},function(n){return Xt(n)||(ot(t),n&&n.response&&(n.response.data=at.call(t,t.transformResponse,n.response),n.response.headers=H.from(n.response.headers))),Promise.reject(n)})}const ts=t=>t instanceof H?t.toJSON():t;function ae(t,e){e=e||{};const s={};function n(l,f,_){return c.isPlainObject(l)&&c.isPlainObject(f)?c.merge.call({caseless:_},l,f):c.isPlainObject(f)?c.merge({},f):c.isArray(f)?f.slice():f}function r(l,f,_){if(c.isUndefined(f)){if(!c.isUndefined(l))return n(void 0,l,_)}else return n(l,f,_)}function i(l,f){if(!c.isUndefined(f))return n(void 0,f)}function a(l,f){if(c.isUndefined(f)){if(!c.isUndefined(l))return n(void 0,l)}else return n(void 0,f)}function o(l,f,_){if(_ in e)return n(l,f);if(_ in t)return n(void 0,l)}const u={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:o,headers:(l,f)=>r(ts(l),ts(f),!0)};return c.forEach(Object.keys(Object.assign({},t,e)),function(f){const _=u[f]||r,A=_(t[f],e[f],f);c.isUndefined(A)&&_!==o||(s[f]=A)}),s}const ss="1.4.0",lt={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{lt[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});const ns={};lt.transitional=function(e,s,n){function r(i,a){return"[Axios v"+ss+"] Transitional option '"+i+"'"+a+(n?". "+n:"")}return(i,a,o)=>{if(e===!1)throw new T(r(a," has been removed"+(s?" in "+s:"")),T.ERR_DEPRECATED);return s&&!ns[a]&&(ns[a]=!0,console.warn(r(a," has been deprecated since v"+s+" and will be removed in the near future"))),e?e(i,a,o):!0}};function Bn(t,e,s){if(typeof t!="object")throw new T("options must be an object",T.ERR_BAD_OPTION_VALUE);const n=Object.keys(t);let r=n.length;for(;r-- >0;){const i=n[r],a=e[i];if(a){const o=t[i],u=o===void 0||a(o,i,t);if(u!==!0)throw new T("option "+i+" must be "+u,T.ERR_BAD_OPTION_VALUE);continue}if(s!==!0)throw new T("Unknown option "+i,T.ERR_BAD_OPTION)}}const ct={assertOptions:Bn,validators:lt},G=ct.validators;class Be{constructor(e){this.defaults=e,this.interceptors={request:new Wt,response:new Wt}}request(e,s){typeof e=="string"?(s=s||{},s.url=e):s=e||{},s=ae(this.defaults,s);const{transitional:n,paramsSerializer:r,headers:i}=s;n!==void 0&&ct.assertOptions(n,{silentJSONParsing:G.transitional(G.boolean),forcedJSONParsing:G.transitional(G.boolean),clarifyTimeoutError:G.transitional(G.boolean)},!1),r!=null&&(c.isFunction(r)?s.paramsSerializer={serialize:r}:ct.assertOptions(r,{encode:G.function,serialize:G.function},!0)),s.method=(s.method||this.defaults.method||"get").toLowerCase();let a;a=i&&c.merge(i.common,i[s.method]),a&&c.forEach(["delete","get","head","post","put","patch","common"],g=>{delete i[g]}),s.headers=H.concat(a,i);const o=[];let u=!0;this.interceptors.request.forEach(function(S){typeof S.runWhen=="function"&&S.runWhen(s)===!1||(u=u&&S.synchronous,o.unshift(S.fulfilled,S.rejected))});const l=[];this.interceptors.response.forEach(function(S){l.push(S.fulfilled,S.rejected)});let f,_=0,A;if(!u){const g=[es.bind(this),void 0];for(g.unshift.apply(g,o),g.push.apply(g,l),A=g.length,f=Promise.resolve(s);_<A;)f=f.then(g[_++],g[_++]);return f}A=o.length;let N=s;for(_=0;_<A;){const g=o[_++],S=o[_++];try{N=g(N)}catch(K){S.call(this,K);break}}try{f=es.call(this,N)}catch(g){return Promise.reject(g)}for(_=0,A=l.length;_<A;)f=f.then(l[_++],l[_++]);return f}getUri(e){e=ae(this.defaults,e);const s=Yt(e.baseURL,e.url);return Jt(s,e.params,e.paramsSerializer)}}c.forEach(["delete","get","head","options"],function(e){Be.prototype[e]=function(s,n){return this.request(ae(n||{},{method:e,url:s,data:(n||{}).data}))}}),c.forEach(["post","put","patch"],function(e){function s(n){return function(i,a,o){return this.request(ae(o||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:i,data:a}))}}Be.prototype[e]=s(),Be.prototype[e+"Form"]=s(!0)});const Me=Be;class ut{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let s;this.promise=new Promise(function(i){s=i});const n=this;this.promise.then(r=>{if(!n._listeners)return;let i=n._listeners.length;for(;i-- >0;)n._listeners[i](r);n._listeners=null}),this.promise.then=r=>{let i;const a=new Promise(o=>{n.subscribe(o),i=o}).then(r);return a.cancel=function(){n.unsubscribe(i)},a},e(function(i,a,o){n.reason||(n.reason=new me(i,a,o),s(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const s=this._listeners.indexOf(e);s!==-1&&this._listeners.splice(s,1)}static source(){let e;return{token:new ut(function(r){e=r}),cancel:e}}}const Mn=ut;function Un(t){return function(s){return t.apply(null,s)}}function zn(t){return c.isObject(t)&&t.isAxiosError===!0}const dt={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(dt).forEach(([t,e])=>{dt[e]=t});const $n=dt;function rs(t){const e=new Me(t),s=At(Me.prototype.request,e);return c.extend(s,Me.prototype,e,{allOwnKeys:!0}),c.extend(s,e,null,{allOwnKeys:!0}),s.create=function(r){return rs(ae(t,r))},s}const R=rs(rt);R.Axios=Me,R.CanceledError=me,R.CancelToken=Mn,R.isCancel=Xt,R.VERSION=ss,R.toFormData=je,R.AxiosError=T,R.Cancel=R.CanceledError,R.all=function(e){return Promise.all(e)},R.spread=Un,R.isAxiosError=zn,R.mergeConfig=ae,R.AxiosHeaders=H,R.formToJSON=t=>qt(c.isHTMLForm(t)?new FormData(t):t),R.HttpStatusCode=$n,R.default=R;const ft=R;function ht({apiKey:t,options:e}){let s={};return t&&Z(s,["headers","Authorization"],`API-Key ${t}`),e&&(s=q(s,e)),s}async function is({url:t,apiKey:e,options:s}){return await ft.get(t,ht({apiKey:e,options:s}))}async function as({url:t,apiKey:e,options:s,payload:n={}}){return await ft.post(t,n,ht({apiKey:e,options:s}))}async function Vn({url:t,apiKey:e,options:s,payload:n}){return await ft.put(t,n,ht({apiKey:e,options:s}))}async function ye(t){try{return await t()}catch(e){return Promise.reject(e)}}async function Fn({apiKey:t,apiHost:e},s,n){return ye(async()=>{const r=(await as({url:`${e}/v1/images/book/${s}`,apiKey:t,payload:n})).data;return vs.parse(r)})}var E;(function(t){t.assertEqual=r=>r;function e(r){}t.assertIs=e;function s(r){throw new Error}t.assertNever=s,t.arrayToEnum=r=>{const i={};for(const a of r)i[a]=a;return i},t.getValidEnumValues=r=>{const i=t.objectKeys(r).filter(o=>typeof r[r[o]]!="number"),a={};for(const o of i)a[o]=r[o];return t.objectValues(a)},t.objectValues=r=>t.objectKeys(r).map(function(i){return r[i]}),t.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{const i=[];for(const a in r)Object.prototype.hasOwnProperty.call(r,a)&&i.push(a);return i},t.find=(r,i)=>{for(const a of r)if(i(a))return a},t.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&isFinite(r)&&Math.floor(r)===r;function n(r,i=" | "){return r.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}t.joinValues=n,t.jsonStringifyReplacer=(r,i)=>typeof i=="bigint"?i.toString():i})(E||(E={}));var pt;(function(t){t.mergeShapes=(e,s)=>({...e,...s})})(pt||(pt={}));const p=E.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),X=t=>{switch(typeof t){case"undefined":return p.undefined;case"string":return p.string;case"number":return isNaN(t)?p.nan:p.number;case"boolean":return p.boolean;case"function":return p.function;case"bigint":return p.bigint;case"symbol":return p.symbol;case"object":return Array.isArray(t)?p.array:t===null?p.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?p.promise:typeof Map<"u"&&t instanceof Map?p.map:typeof Set<"u"&&t instanceof Set?p.set:typeof Date<"u"&&t instanceof Date?p.date:p.object;default:return p.unknown}},h=E.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Hn=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");class D extends Error{constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const s=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,s):this.__proto__=s,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const s=e||function(i){return i.message},n={_errors:[]},r=i=>{for(const a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(r);else if(a.code==="invalid_return_type")r(a.returnTypeError);else if(a.code==="invalid_arguments")r(a.argumentsError);else if(a.path.length===0)n._errors.push(s(a));else{let o=n,u=0;for(;u<a.path.length;){const l=a.path[u];u===a.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(s(a))):o[l]=o[l]||{_errors:[]},o=o[l],u++}}};return r(this),n}toString(){return this.message}get message(){return JSON.stringify(this.issues,E.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=s=>s.message){const s={},n=[];for(const r of this.issues)r.path.length>0?(s[r.path[0]]=s[r.path[0]]||[],s[r.path[0]].push(e(r))):n.push(e(r));return{formErrors:n,fieldErrors:s}}get formErrors(){return this.flatten()}}D.create=t=>new D(t);const ge=(t,e)=>{let s;switch(t.code){case h.invalid_type:t.received===p.undefined?s="Required":s=`Expected ${t.expected}, received ${t.received}`;break;case h.invalid_literal:s=`Invalid literal value, expected ${JSON.stringify(t.expected,E.jsonStringifyReplacer)}`;break;case h.unrecognized_keys:s=`Unrecognized key(s) in object: ${E.joinValues(t.keys,", ")}`;break;case h.invalid_union:s="Invalid input";break;case h.invalid_union_discriminator:s=`Invalid discriminator value. Expected ${E.joinValues(t.options)}`;break;case h.invalid_enum_value:s=`Invalid enum value. Expected ${E.joinValues(t.options)}, received '${t.received}'`;break;case h.invalid_arguments:s="Invalid function arguments";break;case h.invalid_return_type:s="Invalid function return type";break;case h.invalid_date:s="Invalid date";break;case h.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(s=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(s=`${s} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?s=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?s=`Invalid input: must end with "${t.validation.endsWith}"`:E.assertNever(t.validation):t.validation!=="regex"?s=`Invalid ${t.validation}`:s="Invalid";break;case h.too_small:t.type==="array"?s=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?s=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?s=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?s=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:s="Invalid input";break;case h.too_big:t.type==="array"?s=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?s=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?s=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?s=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?s=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:s="Invalid input";break;case h.custom:s="Invalid input";break;case h.invalid_intersection_types:s="Intersection results could not be merged";break;case h.not_multiple_of:s=`Number must be a multiple of ${t.multipleOf}`;break;case h.not_finite:s="Number must be finite";break;default:s=e.defaultError,E.assertNever(t)}return{message:s}};let os=ge;function Jn(t){os=t}function Ue(){return os}const ze=t=>{const{data:e,path:s,errorMaps:n,issueData:r}=t,i=[...s,...r.path||[]],a={...r,path:i};let o="";const u=n.filter(l=>!!l).slice().reverse();for(const l of u)o=l(a,{data:e,defaultError:o}).message;return{...r,path:i,message:r.message||o}},Wn=[];function m(t,e){const s=ze({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ue(),ge].filter(n=>!!n)});t.common.issues.push(s)}class I{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,s){const n=[];for(const r of s){if(r.status==="aborted")return w;r.status==="dirty"&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,s){const n=[];for(const r of s)n.push({key:await r.key,value:await r.value});return I.mergeObjectSync(e,n)}static mergeObjectSync(e,s){const n={};for(const r of s){const{key:i,value:a}=r;if(i.status==="aborted"||a.status==="aborted")return w;i.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),(typeof a.value<"u"||r.alwaysSet)&&(n[i.value]=a.value)}return{status:e.value,value:n}}}const w=Object.freeze({status:"aborted"}),ls=t=>({status:"dirty",value:t}),j=t=>({status:"valid",value:t}),mt=t=>t.status==="aborted",yt=t=>t.status==="dirty",$e=t=>t.status==="valid",Ve=t=>typeof Promise<"u"&&t instanceof Promise;var y;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(y||(y={}));class V{constructor(e,s,n,r){this._cachedPath=[],this.parent=e,this.data=s,this._path=n,this._key=r}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const cs=(t,e)=>{if($e(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const s=new D(t.common.issues);return this._error=s,this._error}}};function x(t){if(!t)return{};const{errorMap:e,invalid_type_error:s,required_error:n,description:r}=t;if(e&&(s||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(a,o)=>a.code!=="invalid_type"?{message:o.defaultError}:typeof o.data>"u"?{message:n??o.defaultError}:{message:s??o.defaultError},description:r}}class k{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return X(e.data)}_getOrReturnCtx(e,s){return s||{common:e.parent.common,data:e.data,parsedType:X(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new I,ctx:{common:e.parent.common,data:e.data,parsedType:X(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const s=this._parse(e);if(Ve(s))throw new Error("Synchronous parse encountered promise.");return s}_parseAsync(e){const s=this._parse(e);return Promise.resolve(s)}parse(e,s){const n=this.safeParse(e,s);if(n.success)return n.data;throw n.error}safeParse(e,s){var n;const r={common:{issues:[],async:(n=s==null?void 0:s.async)!==null&&n!==void 0?n:!1,contextualErrorMap:s==null?void 0:s.errorMap},path:(s==null?void 0:s.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:X(e)},i=this._parseSync({data:e,path:r.path,parent:r});return cs(r,i)}async parseAsync(e,s){const n=await this.safeParseAsync(e,s);if(n.success)return n.data;throw n.error}async safeParseAsync(e,s){const n={common:{issues:[],contextualErrorMap:s==null?void 0:s.errorMap,async:!0},path:(s==null?void 0:s.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:X(e)},r=this._parse({data:e,path:n.path,parent:n}),i=await(Ve(r)?r:Promise.resolve(r));return cs(n,i)}refine(e,s){const n=r=>typeof s=="string"||typeof s>"u"?{message:s}:typeof s=="function"?s(r):s;return this._refinement((r,i)=>{const a=e(r),o=()=>i.addIssue({code:h.custom,...n(r)});return typeof Promise<"u"&&a instanceof Promise?a.then(u=>u?!0:(o(),!1)):a?!0:(o(),!1)})}refinement(e,s){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof s=="function"?s(n,r):s),!1))}_refinement(e){return new M({schema:this,typeName:v.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return W.create(this,this._def)}nullable(){return re.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return B.create(this,this._def)}promise(){return ue.create(this,this._def)}or(e){return we.create([this,e],this._def)}and(e){return xe.create(this,e,this._def)}transform(e){return new M({...x(this._def),schema:this,typeName:v.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const s=typeof e=="function"?e:()=>e;return new Oe({...x(this._def),innerType:this,defaultValue:s,typeName:v.ZodDefault})}brand(){return new ds({typeName:v.ZodBranded,type:this,...x(this._def)})}catch(e){const s=typeof e=="function"?e:()=>e;return new qe({...x(this._def),innerType:this,catchValue:s,typeName:v.ZodCatch})}describe(e){const s=this.constructor;return new s({...this._def,description:e})}pipe(e){return Ne.create(this,e)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Kn=/^c[^\s-]{8,}$/i,qn=/^[a-z][a-z0-9]*$/,Gn=/[0-9A-HJKMNP-TV-Z]{26}/,Xn=/^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i,Yn=/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\])|(\[IPv6:(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))\])|([A-Za-z0-9]([A-Za-z0-9-]*[A-Za-z0-9])*(\.[A-Za-z]{2,})+))$/,Qn=/^(\p{Extended_Pictographic}|\p{Emoji_Component})+$/u,er=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,tr=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,sr=t=>t.precision?t.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${t.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${t.precision}}Z$`):t.precision===0?t.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):t.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function nr(t,e){return!!((e==="v4"||!e)&&er.test(t)||(e==="v6"||!e)&&tr.test(t))}class P extends k{constructor(){super(...arguments),this._regex=(e,s,n)=>this.refinement(r=>e.test(r),{validation:s,code:h.invalid_string,...y.errToObj(n)}),this.nonempty=e=>this.min(1,y.errToObj(e)),this.trim=()=>new P({...this._def,checks:[...this._def.checks,{kind:"trim"}]}),this.toLowerCase=()=>new P({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]}),this.toUpperCase=()=>new P({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==p.string){const i=this._getOrReturnCtx(e);return m(i,{code:h.invalid_type,expected:p.string,received:i.parsedType}),w}const n=new I;let r;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(r=this._getOrReturnCtx(e,r),m(r,{code:h.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")e.data.length>i.value&&(r=this._getOrReturnCtx(e,r),m(r,{code:h.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){const a=e.data.length>i.value,o=e.data.length<i.value;(a||o)&&(r=this._getOrReturnCtx(e,r),a?m(r,{code:h.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):o&&m(r,{code:h.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")Yn.test(e.data)||(r=this._getOrReturnCtx(e,r),m(r,{validation:"email",code:h.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Qn.test(e.data)||(r=this._getOrReturnCtx(e,r),m(r,{validation:"emoji",code:h.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")Xn.test(e.data)||(r=this._getOrReturnCtx(e,r),m(r,{validation:"uuid",code:h.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")Kn.test(e.data)||(r=this._getOrReturnCtx(e,r),m(r,{validation:"cuid",code:h.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")qn.test(e.data)||(r=this._getOrReturnCtx(e,r),m(r,{validation:"cuid2",code:h.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")Gn.test(e.data)||(r=this._getOrReturnCtx(e,r),m(r,{validation:"ulid",code:h.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),m(r,{validation:"url",code:h.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),m(r,{validation:"regex",code:h.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(r=this._getOrReturnCtx(e,r),m(r,{code:h.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(r=this._getOrReturnCtx(e,r),m(r,{code:h.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(r=this._getOrReturnCtx(e,r),m(r,{code:h.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?sr(i).test(e.data)||(r=this._getOrReturnCtx(e,r),m(r,{code:h.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="ip"?nr(e.data,i.version)||(r=this._getOrReturnCtx(e,r),m(r,{validation:"ip",code:h.invalid_string,message:i.message}),n.dirty()):E.assertNever(i);return{status:n.value,value:e.data}}_addCheck(e){return new P({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...y.errToObj(e)})}url(e){return this._addCheck({kind:"url",...y.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...y.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...y.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...y.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...y.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...y.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...y.errToObj(e)})}datetime(e){var s;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(s=e==null?void 0:e.offset)!==null&&s!==void 0?s:!1,...y.errToObj(e==null?void 0:e.message)})}regex(e,s){return this._addCheck({kind:"regex",regex:e,...y.errToObj(s)})}includes(e,s){return this._addCheck({kind:"includes",value:e,position:s==null?void 0:s.position,...y.errToObj(s==null?void 0:s.message)})}startsWith(e,s){return this._addCheck({kind:"startsWith",value:e,...y.errToObj(s)})}endsWith(e,s){return this._addCheck({kind:"endsWith",value:e,...y.errToObj(s)})}min(e,s){return this._addCheck({kind:"min",value:e,...y.errToObj(s)})}max(e,s){return this._addCheck({kind:"max",value:e,...y.errToObj(s)})}length(e,s){return this._addCheck({kind:"length",value:e,...y.errToObj(s)})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get minLength(){let e=null;for(const s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e}get maxLength(){let e=null;for(const s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e}}P.create=t=>{var e;return new P({checks:[],typeName:v.ZodString,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...x(t)})};function rr(t,e){const s=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,r=s>n?s:n,i=parseInt(t.toFixed(r).replace(".","")),a=parseInt(e.toFixed(r).replace(".",""));return i%a/Math.pow(10,r)}class Y extends k{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==p.number){const i=this._getOrReturnCtx(e);return m(i,{code:h.invalid_type,expected:p.number,received:i.parsedType}),w}let n;const r=new I;for(const i of this._def.checks)i.kind==="int"?E.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),m(n,{code:h.invalid_type,expected:"integer",received:"float",message:i.message}),r.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),m(n,{code:h.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),r.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),m(n,{code:h.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),r.dirty()):i.kind==="multipleOf"?rr(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),m(n,{code:h.not_multiple_of,multipleOf:i.value,message:i.message}),r.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),m(n,{code:h.not_finite,message:i.message}),r.dirty()):E.assertNever(i);return{status:r.value,value:e.data}}gte(e,s){return this.setLimit("min",e,!0,y.toString(s))}gt(e,s){return this.setLimit("min",e,!1,y.toString(s))}lte(e,s){return this.setLimit("max",e,!0,y.toString(s))}lt(e,s){return this.setLimit("max",e,!1,y.toString(s))}setLimit(e,s,n,r){return new Y({...this._def,checks:[...this._def.checks,{kind:e,value:s,inclusive:n,message:y.toString(r)}]})}_addCheck(e){return new Y({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:y.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:y.toString(e)})}multipleOf(e,s){return this._addCheck({kind:"multipleOf",value:e,message:y.toString(s)})}finite(e){return this._addCheck({kind:"finite",message:y.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:y.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:y.toString(e)})}get minValue(){let e=null;for(const s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e}get maxValue(){let e=null;for(const s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&E.isInteger(e.value))}get isFinite(){let e=null,s=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(s===null||n.value>s)&&(s=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(s)&&Number.isFinite(e)}}Y.create=t=>new Y({checks:[],typeName:v.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...x(t)});class Q extends k{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==p.bigint){const i=this._getOrReturnCtx(e);return m(i,{code:h.invalid_type,expected:p.bigint,received:i.parsedType}),w}let n;const r=new I;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),m(n,{code:h.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),r.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),m(n,{code:h.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),r.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),m(n,{code:h.not_multiple_of,multipleOf:i.value,message:i.message}),r.dirty()):E.assertNever(i);return{status:r.value,value:e.data}}gte(e,s){return this.setLimit("min",e,!0,y.toString(s))}gt(e,s){return this.setLimit("min",e,!1,y.toString(s))}lte(e,s){return this.setLimit("max",e,!0,y.toString(s))}lt(e,s){return this.setLimit("max",e,!1,y.toString(s))}setLimit(e,s,n,r){return new Q({...this._def,checks:[...this._def.checks,{kind:e,value:s,inclusive:n,message:y.toString(r)}]})}_addCheck(e){return new Q({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:y.toString(e)})}multipleOf(e,s){return this._addCheck({kind:"multipleOf",value:e,message:y.toString(s)})}get minValue(){let e=null;for(const s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e}get maxValue(){let e=null;for(const s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e}}Q.create=t=>{var e;return new Q({checks:[],typeName:v.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...x(t)})};class ve extends k{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==p.boolean){const n=this._getOrReturnCtx(e);return m(n,{code:h.invalid_type,expected:p.boolean,received:n.parsedType}),w}return j(e.data)}}ve.create=t=>new ve({typeName:v.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...x(t)});class te extends k{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==p.date){const i=this._getOrReturnCtx(e);return m(i,{code:h.invalid_type,expected:p.date,received:i.parsedType}),w}if(isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return m(i,{code:h.invalid_date}),w}const n=new I;let r;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(r=this._getOrReturnCtx(e,r),m(r,{code:h.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(r=this._getOrReturnCtx(e,r),m(r,{code:h.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):E.assertNever(i);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new te({...this._def,checks:[...this._def.checks,e]})}min(e,s){return this._addCheck({kind:"min",value:e.getTime(),message:y.toString(s)})}max(e,s){return this._addCheck({kind:"max",value:e.getTime(),message:y.toString(s)})}get minDate(){let e=null;for(const s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e!=null?new Date(e):null}}te.create=t=>new te({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:v.ZodDate,...x(t)});class Fe extends k{_parse(e){if(this._getType(e)!==p.symbol){const n=this._getOrReturnCtx(e);return m(n,{code:h.invalid_type,expected:p.symbol,received:n.parsedType}),w}return j(e.data)}}Fe.create=t=>new Fe({typeName:v.ZodSymbol,...x(t)});class _e extends k{_parse(e){if(this._getType(e)!==p.undefined){const n=this._getOrReturnCtx(e);return m(n,{code:h.invalid_type,expected:p.undefined,received:n.parsedType}),w}return j(e.data)}}_e.create=t=>new _e({typeName:v.ZodUndefined,...x(t)});class be extends k{_parse(e){if(this._getType(e)!==p.null){const n=this._getOrReturnCtx(e);return m(n,{code:h.invalid_type,expected:p.null,received:n.parsedType}),w}return j(e.data)}}be.create=t=>new be({typeName:v.ZodNull,...x(t)});class oe extends k{constructor(){super(...arguments),this._any=!0}_parse(e){return j(e.data)}}oe.create=t=>new oe({typeName:v.ZodAny,...x(t)});class se extends k{constructor(){super(...arguments),this._unknown=!0}_parse(e){return j(e.data)}}se.create=t=>new se({typeName:v.ZodUnknown,...x(t)});class J extends k{_parse(e){const s=this._getOrReturnCtx(e);return m(s,{code:h.invalid_type,expected:p.never,received:s.parsedType}),w}}J.create=t=>new J({typeName:v.ZodNever,...x(t)});class He extends k{_parse(e){if(this._getType(e)!==p.undefined){const n=this._getOrReturnCtx(e);return m(n,{code:h.invalid_type,expected:p.void,received:n.parsedType}),w}return j(e.data)}}He.create=t=>new He({typeName:v.ZodVoid,...x(t)});class B extends k{_parse(e){const{ctx:s,status:n}=this._processInputParams(e),r=this._def;if(s.parsedType!==p.array)return m(s,{code:h.invalid_type,expected:p.array,received:s.parsedType}),w;if(r.exactLength!==null){const a=s.data.length>r.exactLength.value,o=s.data.length<r.exactLength.value;(a||o)&&(m(s,{code:a?h.too_big:h.too_small,minimum:o?r.exactLength.value:void 0,maximum:a?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(r.minLength!==null&&s.data.length<r.minLength.value&&(m(s,{code:h.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),r.maxLength!==null&&s.data.length>r.maxLength.value&&(m(s,{code:h.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),s.common.async)return Promise.all([...s.data].map((a,o)=>r.type._parseAsync(new V(s,a,s.path,o)))).then(a=>I.mergeArray(n,a));const i=[...s.data].map((a,o)=>r.type._parseSync(new V(s,a,s.path,o)));return I.mergeArray(n,i)}get element(){return this._def.type}min(e,s){return new B({...this._def,minLength:{value:e,message:y.toString(s)}})}max(e,s){return new B({...this._def,maxLength:{value:e,message:y.toString(s)}})}length(e,s){return new B({...this._def,exactLength:{value:e,message:y.toString(s)}})}nonempty(e){return this.min(1,e)}}B.create=(t,e)=>new B({type:t,minLength:null,maxLength:null,exactLength:null,typeName:v.ZodArray,...x(e)});function le(t){if(t instanceof C){const e={};for(const s in t.shape){const n=t.shape[s];e[s]=W.create(le(n))}return new C({...t._def,shape:()=>e})}else return t instanceof B?new B({...t._def,type:le(t.element)}):t instanceof W?W.create(le(t.unwrap())):t instanceof re?re.create(le(t.unwrap())):t instanceof F?F.create(t.items.map(e=>le(e))):t}class C extends k{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),s=E.objectKeys(e);return this._cached={shape:e,keys:s}}_parse(e){if(this._getType(e)!==p.object){const l=this._getOrReturnCtx(e);return m(l,{code:h.invalid_type,expected:p.object,received:l.parsedType}),w}const{status:n,ctx:r}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),o=[];if(!(this._def.catchall instanceof J&&this._def.unknownKeys==="strip"))for(const l in r.data)a.includes(l)||o.push(l);const u=[];for(const l of a){const f=i[l],_=r.data[l];u.push({key:{status:"valid",value:l},value:f._parse(new V(r,_,r.path,l)),alwaysSet:l in r.data})}if(this._def.catchall instanceof J){const l=this._def.unknownKeys;if(l==="passthrough")for(const f of o)u.push({key:{status:"valid",value:f},value:{status:"valid",value:r.data[f]}});else if(l==="strict")o.length>0&&(m(r,{code:h.unrecognized_keys,keys:o}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const f of o){const _=r.data[f];u.push({key:{status:"valid",value:f},value:l._parse(new V(r,_,r.path,f)),alwaysSet:f in r.data})}}return r.common.async?Promise.resolve().then(async()=>{const l=[];for(const f of u){const _=await f.key;l.push({key:_,value:await f.value,alwaysSet:f.alwaysSet})}return l}).then(l=>I.mergeObjectSync(n,l)):I.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return y.errToObj,new C({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(s,n)=>{var r,i,a,o;const u=(a=(i=(r=this._def).errorMap)===null||i===void 0?void 0:i.call(r,s,n).message)!==null&&a!==void 0?a:n.defaultError;return s.code==="unrecognized_keys"?{message:(o=y.errToObj(e).message)!==null&&o!==void 0?o:u}:{message:u}}}:{}})}strip(){return new C({...this._def,unknownKeys:"strip"})}passthrough(){return new C({...this._def,unknownKeys:"passthrough"})}extend(e){return new C({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new C({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:v.ZodObject})}setKey(e,s){return this.augment({[e]:s})}catchall(e){return new C({...this._def,catchall:e})}pick(e){const s={};return E.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(s[n]=this.shape[n])}),new C({...this._def,shape:()=>s})}omit(e){const s={};return E.objectKeys(this.shape).forEach(n=>{e[n]||(s[n]=this.shape[n])}),new C({...this._def,shape:()=>s})}deepPartial(){return le(this)}partial(e){const s={};return E.objectKeys(this.shape).forEach(n=>{const r=this.shape[n];e&&!e[n]?s[n]=r:s[n]=r.optional()}),new C({...this._def,shape:()=>s})}required(e){const s={};return E.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])s[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof W;)i=i._def.innerType;s[n]=i}}),new C({...this._def,shape:()=>s})}keyof(){return us(E.objectKeys(this.shape))}}C.create=(t,e)=>new C({shape:()=>t,unknownKeys:"strip",catchall:J.create(),typeName:v.ZodObject,...x(e)}),C.strictCreate=(t,e)=>new C({shape:()=>t,unknownKeys:"strict",catchall:J.create(),typeName:v.ZodObject,...x(e)}),C.lazycreate=(t,e)=>new C({shape:t,unknownKeys:"strip",catchall:J.create(),typeName:v.ZodObject,...x(e)});class we extends k{_parse(e){const{ctx:s}=this._processInputParams(e),n=this._def.options;function r(i){for(const o of i)if(o.result.status==="valid")return o.result;for(const o of i)if(o.result.status==="dirty")return s.common.issues.push(...o.ctx.common.issues),o.result;const a=i.map(o=>new D(o.ctx.common.issues));return m(s,{code:h.invalid_union,unionErrors:a}),w}if(s.common.async)return Promise.all(n.map(async i=>{const a={...s,common:{...s.common,issues:[]},parent:null};return{result:await i._parseAsync({data:s.data,path:s.path,parent:a}),ctx:a}})).then(r);{let i;const a=[];for(const u of n){const l={...s,common:{...s.common,issues:[]},parent:null},f=u._parseSync({data:s.data,path:s.path,parent:l});if(f.status==="valid")return f;f.status==="dirty"&&!i&&(i={result:f,ctx:l}),l.common.issues.length&&a.push(l.common.issues)}if(i)return s.common.issues.push(...i.ctx.common.issues),i.result;const o=a.map(u=>new D(u));return m(s,{code:h.invalid_union,unionErrors:o}),w}}get options(){return this._def.options}}we.create=(t,e)=>new we({options:t,typeName:v.ZodUnion,...x(e)});const Je=t=>t instanceof Se?Je(t.schema):t instanceof M?Je(t.innerType()):t instanceof Te?[t.value]:t instanceof ee?t.options:t instanceof Ee?Object.keys(t.enum):t instanceof Oe?Je(t._def.innerType):t instanceof _e?[void 0]:t instanceof be?[null]:null;class We extends k{_parse(e){const{ctx:s}=this._processInputParams(e);if(s.parsedType!==p.object)return m(s,{code:h.invalid_type,expected:p.object,received:s.parsedType}),w;const n=this.discriminator,r=s.data[n],i=this.optionsMap.get(r);return i?s.common.async?i._parseAsync({data:s.data,path:s.path,parent:s}):i._parseSync({data:s.data,path:s.path,parent:s}):(m(s,{code:h.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),w)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,s,n){const r=new Map;for(const i of s){const a=Je(i.shape[e]);if(!a)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of a){if(r.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);r.set(o,i)}}return new We({typeName:v.ZodDiscriminatedUnion,discriminator:e,options:s,optionsMap:r,...x(n)})}}function gt(t,e){const s=X(t),n=X(e);if(t===e)return{valid:!0,data:t};if(s===p.object&&n===p.object){const r=E.objectKeys(e),i=E.objectKeys(t).filter(o=>r.indexOf(o)!==-1),a={...t,...e};for(const o of i){const u=gt(t[o],e[o]);if(!u.valid)return{valid:!1};a[o]=u.data}return{valid:!0,data:a}}else if(s===p.array&&n===p.array){if(t.length!==e.length)return{valid:!1};const r=[];for(let i=0;i<t.length;i++){const a=t[i],o=e[i],u=gt(a,o);if(!u.valid)return{valid:!1};r.push(u.data)}return{valid:!0,data:r}}else return s===p.date&&n===p.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class xe extends k{_parse(e){const{status:s,ctx:n}=this._processInputParams(e),r=(i,a)=>{if(mt(i)||mt(a))return w;const o=gt(i.value,a.value);return o.valid?((yt(i)||yt(a))&&s.dirty(),{status:s.value,value:o.data}):(m(n,{code:h.invalid_intersection_types}),w)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,a])=>r(i,a)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}xe.create=(t,e,s)=>new xe({left:t,right:e,typeName:v.ZodIntersection,...x(s)});class F extends k{_parse(e){const{status:s,ctx:n}=this._processInputParams(e);if(n.parsedType!==p.array)return m(n,{code:h.invalid_type,expected:p.array,received:n.parsedType}),w;if(n.data.length<this._def.items.length)return m(n,{code:h.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),w;!this._def.rest&&n.data.length>this._def.items.length&&(m(n,{code:h.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),s.dirty());const i=[...n.data].map((a,o)=>{const u=this._def.items[o]||this._def.rest;return u?u._parse(new V(n,a,n.path,o)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>I.mergeArray(s,a)):I.mergeArray(s,i)}get items(){return this._def.items}rest(e){return new F({...this._def,rest:e})}}F.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new F({items:t,typeName:v.ZodTuple,rest:null,...x(e)})};class ke extends k{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:s,ctx:n}=this._processInputParams(e);if(n.parsedType!==p.object)return m(n,{code:h.invalid_type,expected:p.object,received:n.parsedType}),w;const r=[],i=this._def.keyType,a=this._def.valueType;for(const o in n.data)r.push({key:i._parse(new V(n,o,n.path,o)),value:a._parse(new V(n,n.data[o],n.path,o))});return n.common.async?I.mergeObjectAsync(s,r):I.mergeObjectSync(s,r)}get element(){return this._def.valueType}static create(e,s,n){return s instanceof k?new ke({keyType:e,valueType:s,typeName:v.ZodRecord,...x(n)}):new ke({keyType:P.create(),valueType:e,typeName:v.ZodRecord,...x(s)})}}class Ke extends k{_parse(e){const{status:s,ctx:n}=this._processInputParams(e);if(n.parsedType!==p.map)return m(n,{code:h.invalid_type,expected:p.map,received:n.parsedType}),w;const r=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([o,u],l)=>({key:r._parse(new V(n,o,n.path,[l,"key"])),value:i._parse(new V(n,u,n.path,[l,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const u of a){const l=await u.key,f=await u.value;if(l.status==="aborted"||f.status==="aborted")return w;(l.status==="dirty"||f.status==="dirty")&&s.dirty(),o.set(l.value,f.value)}return{status:s.value,value:o}})}else{const o=new Map;for(const u of a){const l=u.key,f=u.value;if(l.status==="aborted"||f.status==="aborted")return w;(l.status==="dirty"||f.status==="dirty")&&s.dirty(),o.set(l.value,f.value)}return{status:s.value,value:o}}}}Ke.create=(t,e,s)=>new Ke({valueType:e,keyType:t,typeName:v.ZodMap,...x(s)});class ne extends k{_parse(e){const{status:s,ctx:n}=this._processInputParams(e);if(n.parsedType!==p.set)return m(n,{code:h.invalid_type,expected:p.set,received:n.parsedType}),w;const r=this._def;r.minSize!==null&&n.data.size<r.minSize.value&&(m(n,{code:h.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),s.dirty()),r.maxSize!==null&&n.data.size>r.maxSize.value&&(m(n,{code:h.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),s.dirty());const i=this._def.valueType;function a(u){const l=new Set;for(const f of u){if(f.status==="aborted")return w;f.status==="dirty"&&s.dirty(),l.add(f.value)}return{status:s.value,value:l}}const o=[...n.data.values()].map((u,l)=>i._parse(new V(n,u,n.path,l)));return n.common.async?Promise.all(o).then(u=>a(u)):a(o)}min(e,s){return new ne({...this._def,minSize:{value:e,message:y.toString(s)}})}max(e,s){return new ne({...this._def,maxSize:{value:e,message:y.toString(s)}})}size(e,s){return this.min(e,s).max(e,s)}nonempty(e){return this.min(1,e)}}ne.create=(t,e)=>new ne({valueType:t,minSize:null,maxSize:null,typeName:v.ZodSet,...x(e)});class ce extends k{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:s}=this._processInputParams(e);if(s.parsedType!==p.function)return m(s,{code:h.invalid_type,expected:p.function,received:s.parsedType}),w;function n(o,u){return ze({data:o,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,Ue(),ge].filter(l=>!!l),issueData:{code:h.invalid_arguments,argumentsError:u}})}function r(o,u){return ze({data:o,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,Ue(),ge].filter(l=>!!l),issueData:{code:h.invalid_return_type,returnTypeError:u}})}const i={errorMap:s.common.contextualErrorMap},a=s.data;return this._def.returns instanceof ue?j(async(...o)=>{const u=new D([]),l=await this._def.args.parseAsync(o,i).catch(A=>{throw u.addIssue(n(o,A)),u}),f=await a(...l);return await this._def.returns._def.type.parseAsync(f,i).catch(A=>{throw u.addIssue(r(f,A)),u})}):j((...o)=>{const u=this._def.args.safeParse(o,i);if(!u.success)throw new D([n(o,u.error)]);const l=a(...u.data),f=this._def.returns.safeParse(l,i);if(!f.success)throw new D([r(l,f.error)]);return f.data})}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new ce({...this._def,args:F.create(e).rest(se.create())})}returns(e){return new ce({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,s,n){return new ce({args:e||F.create([]).rest(se.create()),returns:s||se.create(),typeName:v.ZodFunction,...x(n)})}}class Se extends k{get schema(){return this._def.getter()}_parse(e){const{ctx:s}=this._processInputParams(e);return this._def.getter()._parse({data:s.data,path:s.path,parent:s})}}Se.create=(t,e)=>new Se({getter:t,typeName:v.ZodLazy,...x(e)});class Te extends k{_parse(e){if(e.data!==this._def.value){const s=this._getOrReturnCtx(e);return m(s,{received:s.data,code:h.invalid_literal,expected:this._def.value}),w}return{status:"valid",value:e.data}}get value(){return this._def.value}}Te.create=(t,e)=>new Te({value:t,typeName:v.ZodLiteral,...x(e)});function us(t,e){return new ee({values:t,typeName:v.ZodEnum,...x(e)})}class ee extends k{_parse(e){if(typeof e.data!="string"){const s=this._getOrReturnCtx(e),n=this._def.values;return m(s,{expected:E.joinValues(n),received:s.parsedType,code:h.invalid_type}),w}if(this._def.values.indexOf(e.data)===-1){const s=this._getOrReturnCtx(e),n=this._def.values;return m(s,{received:s.data,code:h.invalid_enum_value,options:n}),w}return j(e.data)}get options(){return this._def.values}get enum(){const e={};for(const s of this._def.values)e[s]=s;return e}get Values(){const e={};for(const s of this._def.values)e[s]=s;return e}get Enum(){const e={};for(const s of this._def.values)e[s]=s;return e}extract(e){return ee.create(e)}exclude(e){return ee.create(this.options.filter(s=>!e.includes(s)))}}ee.create=us;class Ee extends k{_parse(e){const s=E.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==p.string&&n.parsedType!==p.number){const r=E.objectValues(s);return m(n,{expected:E.joinValues(r),received:n.parsedType,code:h.invalid_type}),w}if(s.indexOf(e.data)===-1){const r=E.objectValues(s);return m(n,{received:n.data,code:h.invalid_enum_value,options:r}),w}return j(e.data)}get enum(){return this._def.values}}Ee.create=(t,e)=>new Ee({values:t,typeName:v.ZodNativeEnum,...x(e)});class ue extends k{unwrap(){return this._def.type}_parse(e){const{ctx:s}=this._processInputParams(e);if(s.parsedType!==p.promise&&s.common.async===!1)return m(s,{code:h.invalid_type,expected:p.promise,received:s.parsedType}),w;const n=s.parsedType===p.promise?s.data:Promise.resolve(s.data);return j(n.then(r=>this._def.type.parseAsync(r,{path:s.path,errorMap:s.common.contextualErrorMap})))}}ue.create=(t,e)=>new ue({type:t,typeName:v.ZodPromise,...x(e)});class M extends k{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===v.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:s,ctx:n}=this._processInputParams(e),r=this._def.effect||null;if(r.type==="preprocess"){const a=r.transform(n.data);return n.common.async?Promise.resolve(a).then(o=>this._def.schema._parseAsync({data:o,path:n.path,parent:n})):this._def.schema._parseSync({data:a,path:n.path,parent:n})}const i={addIssue:a=>{m(n,a),a.fatal?s.abort():s.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),r.type==="refinement"){const a=o=>{const u=r.refinement(o,i);if(n.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?w:(o.status==="dirty"&&s.dirty(),a(o.value),{status:s.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?w:(o.status==="dirty"&&s.dirty(),a(o.value).then(()=>({status:s.value,value:o.value}))))}if(r.type==="transform")if(n.common.async===!1){const a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!$e(a))return a;const o=r.transform(a.value,i);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:s.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>$e(a)?Promise.resolve(r.transform(a.value,i)).then(o=>({status:s.value,value:o})):a);E.assertNever(r)}}M.create=(t,e,s)=>new M({schema:t,typeName:v.ZodEffects,effect:e,...x(s)}),M.createWithPreprocess=(t,e,s)=>new M({schema:e,effect:{type:"preprocess",transform:t},typeName:v.ZodEffects,...x(s)});class W extends k{_parse(e){return this._getType(e)===p.undefined?j(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}W.create=(t,e)=>new W({innerType:t,typeName:v.ZodOptional,...x(e)});class re extends k{_parse(e){return this._getType(e)===p.null?j(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}re.create=(t,e)=>new re({innerType:t,typeName:v.ZodNullable,...x(e)});class Oe extends k{_parse(e){const{ctx:s}=this._processInputParams(e);let n=s.data;return s.parsedType===p.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:s.path,parent:s})}removeDefault(){return this._def.innerType}}Oe.create=(t,e)=>new Oe({innerType:t,typeName:v.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...x(e)});class qe extends k{_parse(e){const{ctx:s}=this._processInputParams(e),n={...s,common:{...s.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Ve(r)?r.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new D(n.common.issues)},input:n.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new D(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}qe.create=(t,e)=>new qe({innerType:t,typeName:v.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...x(e)});class Ge extends k{_parse(e){if(this._getType(e)!==p.nan){const n=this._getOrReturnCtx(e);return m(n,{code:h.invalid_type,expected:p.nan,received:n.parsedType}),w}return{status:"valid",value:e.data}}}Ge.create=t=>new Ge({typeName:v.ZodNaN,...x(t)});const ir=Symbol("zod_brand");class ds extends k{_parse(e){const{ctx:s}=this._processInputParams(e),n=s.data;return this._def.type._parse({data:n,path:s.path,parent:s})}unwrap(){return this._def.type}}class Ne extends k{_parse(e){const{status:s,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?w:i.status==="dirty"?(s.dirty(),ls(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{const r=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return r.status==="aborted"?w:r.status==="dirty"?(s.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:n.path,parent:n})}}static create(e,s){return new Ne({in:e,out:s,typeName:v.ZodPipeline})}}const fs=(t,e={},s)=>t?oe.create().superRefine((n,r)=>{var i,a;if(!t(n)){const o=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,u=(a=(i=o.fatal)!==null&&i!==void 0?i:s)!==null&&a!==void 0?a:!0,l=typeof o=="string"?{message:o}:o;r.addIssue({code:"custom",...l,fatal:u})}}):oe.create(),ar={object:C.lazycreate};var v;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline"})(v||(v={}));const or=(t,e={message:`Input not instance of ${t.name}`})=>fs(s=>s instanceof t,e),hs=P.create,ps=Y.create,lr=Ge.create,cr=Q.create,ms=ve.create,ur=te.create,dr=Fe.create,fr=_e.create,hr=be.create,pr=oe.create,mr=se.create,yr=J.create,gr=He.create,vr=B.create,_r=C.create,br=C.strictCreate,wr=we.create,xr=We.create,kr=xe.create,Sr=F.create,Tr=ke.create,Er=Ke.create,Or=ne.create,Nr=ce.create,Cr=Se.create,Ar=Te.create,Rr=ee.create,Ir=Ee.create,jr=ue.create,ys=M.create,Zr=W.create,Lr=re.create,Dr=M.createWithPreprocess,Pr=Ne.create;var d=Object.freeze({__proto__:null,defaultErrorMap:ge,setErrorMap:Jn,getErrorMap:Ue,makeIssue:ze,EMPTY_PATH:Wn,addIssueToContext:m,ParseStatus:I,INVALID:w,DIRTY:ls,OK:j,isAborted:mt,isDirty:yt,isValid:$e,isAsync:Ve,get util(){return E},get objectUtil(){return pt},ZodParsedType:p,getParsedType:X,ZodType:k,ZodString:P,ZodNumber:Y,ZodBigInt:Q,ZodBoolean:ve,ZodDate:te,ZodSymbol:Fe,ZodUndefined:_e,ZodNull:be,ZodAny:oe,ZodUnknown:se,ZodNever:J,ZodVoid:He,ZodArray:B,ZodObject:C,ZodUnion:we,ZodDiscriminatedUnion:We,ZodIntersection:xe,ZodTuple:F,ZodRecord:ke,ZodMap:Ke,ZodSet:ne,ZodFunction:ce,ZodLazy:Se,ZodLiteral:Te,ZodEnum:ee,ZodNativeEnum:Ee,ZodPromise:ue,ZodEffects:M,ZodTransformer:M,ZodOptional:W,ZodNullable:re,ZodDefault:Oe,ZodCatch:qe,ZodNaN:Ge,BRAND:ir,ZodBranded:ds,ZodPipeline:Ne,custom:fs,Schema:k,ZodSchema:k,late:ar,get ZodFirstPartyTypeKind(){return v},coerce:{string:t=>P.create({...t,coerce:!0}),number:t=>Y.create({...t,coerce:!0}),boolean:t=>ve.create({...t,coerce:!0}),bigint:t=>Q.create({...t,coerce:!0}),date:t=>te.create({...t,coerce:!0})},any:pr,array:vr,bigint:cr,boolean:ms,date:ur,discriminatedUnion:xr,effect:ys,enum:Rr,function:Nr,instanceof:or,intersection:kr,lazy:Cr,literal:Ar,map:Er,nan:lr,nativeEnum:Ir,never:yr,null:hr,nullable:Lr,number:ps,object:_r,oboolean:()=>ms().optional(),onumber:()=>ps().optional(),optional:Zr,ostring:()=>hs().optional(),pipeline:Pr,preprocess:Dr,promise:jr,record:Tr,set:Or,strictObject:br,string:hs,symbol:dr,transformer:ys,tuple:Sr,undefined:fr,union:wr,unknown:mr,void:gr,NEVER:w,ZodIssueCode:h,quotelessJson:Hn,ZodError:D});class gs{constructor(e,s){b(this,"client");b(this,"parentId");b(this,"images");b(this,"length");this.client=e,this.parentId=s,this.images=[],this.length=this.images.length}async add(e){return this.images.push(e),this.length=this.images.length,await Fn(this.client,this.parentId,new _s(e)),new Promise(s=>{s(this.length)})}}const vs=d.object({handle:d.string(),url:d.string(),width:d.number(),height:d.number(),orientation:d.number(),taken_at:d.string(),camera_make:d.string().optional(),camera:d.string().optional(),filename:d.string()});class _s{constructor(e){b(this,"handle");b(this,"url");b(this,"width");b(this,"height");b(this,"orientation");b(this,"taken_at");b(this,"camera_make");b(this,"camera");b(this,"filename");this.handle=e.handle,this.url=e.url,this.width=e.width,this.height=e.height,this.orientation=e.rotation,this.taken_at=e.captureTime,this.camera_make=e.cameraMake,this.camera=e.cameraModel,this.filename=e.filename}}const bs=["new","ingesting","submitted","storyboarding","deduplication","image selection","designing","layouting","embellishing","polishing","ready","error"],vt=["baby","birthday","default","everyday","family","kids","life-stories","portfolio","school-memories","seasonal-holidays","special-celebrations","sports-and-hobbies","travel","wedding","year-in-review"],_t={1005:{slug:"modern-black-sfly"},1101:{slug:"bon-voyage-sfly"},1103:{slug:"fun-in-the-sun-sfly"},1201:{slug:"modern-wedding-sfly"},3001:{slug:"digiscrap-sfly"},4034:{slug:"travel-snapshots-sfly"},4035:{slug:"vintage-travel-sfly"},5017:{slug:"natural-neutrals-sfly"},5033:{slug:"chalkboard-chic-sfly"},5079:{slug:"hello-spring-sfly"},5082:{slug:"familygram-sfly"},5085:{slug:"best-day-ever-sfly"},5091:{slug:"little-love-sfly"},5118:{slug:"a-year-in-color-sfly"},5120:{slug:"milestone-anniversaries-sfly"},5121:{slug:"the-travel-bug-sfly"},5122:{slug:"modern-white-sfly"},5127:{slug:"outdoor-wedding-sfly"},5134:{slug:"classic-wedding-sfly"},5138:{slug:"kraft-pop-sfly"},5142:{slug:"simply-black-sfly"},5144:{slug:"autumn-memories-sfly"},5146:{slug:"everyday-sentiments-sfly"},5149:{slug:"everyday-happiness-sfly"},5150:{slug:"its-a-girl-thing-sfly"},5155:{slug:"made-with-love-sfly"},5157:{slug:"high-school-memories-sfly"},5161:{slug:"rustic-wedding-sfly"},5165:{slug:"life-is-grand-sfly"},5167:{slug:"adventure-awaits-sfly"},5168:{slug:"disney-adventure-sfly"},5171:{slug:"world-travel-sfly"},5174:{slug:"hello-summer-sfly"},5183:{slug:"everything-sports-sfly"},5188:{slug:"everyday-watercolor-sfly"},5189:{slug:"holiday-memories-sfly"},5213:{slug:"love-and-thanks-sfly"},5218:{slug:"babys-first-year-sfly"},5219:{slug:"usa-travel-sfly"},5220:{slug:"vintage-wedding-sfly"},5226:{slug:"love-you-because-sfly"},5228:{slug:"reunion-sfly"},5238:{slug:"whimsy-chalkboard-sfly"},5242:{slug:"modern-indigo-sfly"},5250:{slug:"family-yearbook-sfly"},5255:{slug:"elegant-wedding-sfly"},5258:{slug:"family-vacation-sfly"},5259:{slug:"beach-travel-sfly"},5261:{slug:"sparkle-and-shine-sfly"},5262:{slug:"welcome-baby-sfly"},5265:{slug:"vivid-watercolor-sfly"},5266:{slug:"what-i-love-about-you-sfly"},5272:{slug:"love-grows-sfly"},5274:{slug:"painted-seasons-sfly"},5278:{slug:"vintage-disney-sfly"},5292:{slug:"modern-grey-sfly"},5297:{slug:"modern-love-story-sfly"},5299:{slug:"modern-travel-sfly"},5304:{slug:"beach-wedding-sfly"},5305:{slug:"rustic-farmhouse-sfly"},5308:{slug:"tropical-travel-sfly"},6e3:{slug:"travel-abroad-sfly"},6001:{slug:"everyday-rustic-sfly"},6002:{slug:"simply-modern-sfly"},6003:{slug:"modern-baby-sfly"},6004:{slug:"modern-photo-album-sfly"},6005:{slug:"travel-adventures-sfly"},6006:{slug:"watercolor-year-in-review-sfly"},6007:{slug:"beach-bliss-sfly"},6008:{slug:"simply-gray-sfly"},6009:{slug:"family-favorites-by-lure-design-sfly"},6010:{slug:"travel-gallery-sfly"},6011:{slug:"our-wedding-day-sfly"},6012:{slug:"chic-celebrations-by-float-paperie-sfly"},6013:{slug:"simply-bold-type-sfly"},6014:{slug:"colorful-florals-by-potts-design-sfly"},6015:{slug:"softly-rustic-sfly"},6016:{slug:"ombre-watercolor-sfly"},6017:{slug:"forever-love-by-with-merriment-sfly"},6018:{slug:"colorful-memories-by-britt-bass-sfly"},6019:{slug:"celebrate-family-by-float-paperie-sfly"},6020:{slug:"disney-family-adventures-sfly"},6021:{slug:"everyday-neutrals-sfly"},6022:{slug:"colorful-childhood-sfly"},6023:{slug:"everyday-indigo-sfly"},6024:{slug:"shimmer-and-shine-sfly"},6025:{slug:"summertime-fun-sfly"},6026:{slug:"pet-lover-sfly"},6027:{slug:"modern-wedding-story-sfly"},6028:{slug:"family-blessings-by-potts-design-sfly"},6030:{slug:"outdoor-adventures-by-sarah-hawkins-designs-sfly"},6031:{slug:"travel-memories-sfly"},6032:{slug:"tropical-travels-sfly"},6033:{slug:"everyday-chalkboard-by-potts-design-sfly"},6034:{slug:"classic-disney-sfly"},6035:{slug:"cheerful-color-sfly"},6036:{slug:"colorful-birthday-sfly"},6038:{slug:"classic-baby-sfly"},6039:{slug:"bold-year-in-review-by-float-paperie-sfly"},6040:{slug:"colorfully-fun-sfly"},6041:{slug:"colorful-year-in-review-by-sarah-hawkins-designs-sfly"},6042:{slug:"gilded-wedding-sfly"},6043:{slug:"road-trip-travel-by-sarah-hawkins-designs-sfly"},6044:{slug:"rustic-gilded-wedding-sfly"},6045:{slug:"elegantly-scripted-year-in-review-sfly"},6047:{slug:"2020-what-a-year-sfly"},6057:{slug:"best-mom-ever-sfly"},6052:{slug:"celebration-of-life-by-sarah-hawkins-designs-sfly"},6054:{slug:"colorful-school-days-by-float-paperie-sfly"},6051:{slug:"love-is-all-we-need-sfly"},6058:{slug:"graduation-celebration-sfly"},6056:{slug:"our-wedding-day-guestbook-sfly"},6055:{slug:"muted-everyday-abstract-sfly"},6046:{slug:"winter-memories-by-sarah-hawkins-design-sfly"},6053:{slug:"best-dad-ever-sfly"},6050:{slug:"watercolor-greenery-by-sarah-hawkins-designs-sfly"},6063:{slug:"watercolor-floral-wedding-by-kim-thoa-sfly"},6060:{slug:"watercolor-baby-girl-sfly"},6059:{slug:"watercolor-baby-boy-sfly"},6048:{slug:"simple-elegant-wedding-sfly"},6049:{slug:"gilded-wedding-guestbook-sfly"},6037:{slug:"everyday-fairytale-by-jenny-romanski-sfly"},6061:{slug:"best-grandparents-ever-sfly"},6068:{slug:"winter-getaway-sfly"},6067:{slug:"national-parks-travel-by-eiman-design-co-sfly"},6065:{slug:"go-sports-by-lure-design-sfly"},6066:{slug:"elegant-wedding-greenery-by-kim-thoa-sfly"},6064:{slug:"boho-travel-by-umaiana-studio-sfly"},6071:{slug:"modern-dark-neutrals-sfly"},6072:{slug:"modern-light-neutrals-sfly"},6073:{slug:"modern-celebrations-sfly"},6074:{slug:"bright-and-bold-kids-year-in-review-by-sarah-hawkins-designs-sfly"},6085:{slug:"classic-school-yearbook-sfly"},6084:{slug:"colorful-elementary-school-yearbook-sfly"},5402:{slug:"everyday-recipes-by-slightly-stationery-sfly"},6083:{slug:"school-days-yearbook-sfly"},6082:{slug:"the-story-of-me-sfly"},6086:{slug:"whimsical-recipes-by-slightly-stationery-sfly"},6101:{slug:"babys-first-sfly"},6103:{slug:"classic-recipes-sfly"},6104:{slug:"elevated-rustic-sfly"},6105:{slug:"boho-summer-sfly"},6116:{slug:"boho-baby-sfly"},6117:{slug:"simply-gallery-sfly"},6118:{slug:"this-is-love-sfly"},6120:{slug:"wedding-gallery-sfly"},6121:{slug:"watercolorwashes-sfly"},6124:{slug:"graduation-photo-album-sfly"},6125:{slug:"modern-year-in-review-photo-album-sfly"},6126:{slug:"black-white-photo-album-sfly"},6132:{slug:"travel-journal-sfly"},6133:{slug:"rustic-gallery-sfly"},6137:{slug:"summer-adventures-sfly"},6075:{slug:"together-again-sfly"},6078:{slug:"everyday-boho-by-umaiana-studio-sfly"},6089:{slug:"colorful-gradients-sfly"},6096:{slug:"simply-scrapbook-sfly"},6097:{slug:"boho-wedding-sfly"},6098:{slug:"black-and-white-rustic-sfly"},6099:{slug:"bright-color-pop-sfly"}},bt=["8x8","10x10","12x12","8x11","11x8","11x14"],wt=["sc","hc","pl"],xt=["sp","sl","dl"],kt=["low","medium","high"],St=["best","most","all"],Tt=["none","few","lots"],Et=["none","few","lots"],Br="https://api.sfly-sls.magicbook.io",Mr="wss://socket.sfly-sls.magicbook.io",Ur=parseInt("300000")||3e5;class zr{constructor(e){b(this,"occasion");b(this,"style");b(this,"book_size");b(this,"cover_type");b(this,"page_type");b(this,"image_density");b(this,"image_filtering_level");b(this,"embellishment_level");b(this,"text_sticker_level");this.occasion=e.occasion,this.style=e.style,this.book_size=e.book_size,this.cover_type=e.cover_type,this.page_type=e.page_type,this.image_density=e.image_density,this.image_filtering_level=e.image_filtering_level,this.embellishment_level=e.embellishment_level,this.text_sticker_level=e.text_sticker_level}}const $r=d.object({occasion:d.enum(vt),style:d.string(),book_size:d.enum(bt),cover_type:d.enum(wt),page_type:d.enum(xt),image_density:d.enum(kt),image_filtering_level:d.enum(St),embellishment_level:d.enum(Tt),text_sticker_level:d.enum(Et)}),ws=d.object({id:d.string(),title:d.string(),design_request:$r,state:d.enum(bs).optional(),guid:d.string().optional()});class Ot{constructor(e){b(this,"id");b(this,"title");b(this,"design_request");b(this,"state");b(this,"guid");this.id=e.id,this.title=e.title,this.design_request=new zr(e.design_request),this.state=e.state,this.guid=e.guid}}function xs(t){const e=_t[t.style].slug,s=Nt(JSON.parse(JSON.stringify(t)));return s.style=e,new Ot({id:t.parentId,guid:t.guid,title:t.title,design_request:s})}const Xe=d.object({maxPageCount:d.number(),minPageCount:d.number(),maxImageCount:d.number(),avgImageCount:d.number(),minImageCount:d.number()}),ks=d.object({high:Xe,medium:Xe,low:Xe}),Ss=d.object({densities:ks});async function Vr({apiKey:t,apiHost:e},s,n){return ye(async()=>{const r=await is({url:`${e}/v1/designoptions/booksize/${s}/imagecount/${n}`,apiKey:t}),i=Ct(r.data);return Ss.parse(i)})}const Fr=d.object({photoRefId:d.string(),finalCrop:d.array(d.number())}),Hr=d.object({x:d.number(),y:d.number(),width:d.number().optional(),height:d.number().optional(),rotation:d.number()}),Jr=d.object({id:d.string(),llx:d.number(),lly:d.number(),urx:d.number(),ury:d.number(),data:d.string().nullable(),title:d.string(),width:d.number(),effect:d.string(),height:d.number(),source:d.string(),rotation:d.number(),uploadTime:d.string()}),Wr=d.object({key:d.string(),value:d.any()}),Kr=d.object({type:d.string(),imageAssignment:Fr.optional(),position:Hr,seqNum:d.number(),z:d.number(),id:d.string().optional(),horizJustification:d.string().optional(),vertJustification:d.string().optional().nullable(),text:d.string().optional(),fontId:d.string().optional(),fontSize:d.number().optional(),fontColor:d.string().optional(),frame:d.string().optional()}),qr=d.object({url:d.string(),encryptId:d.string(),photoRefId:d.string(),photoId:d.string(),photoMetadata:Jr}),Gr=d.object({properties:d.array(Wr)}),Xr=d.object({backgroundId:d.string().nullable(),assets:d.array(Kr).optional()}),Yr=d.object({pageNum:d.number(),type:d.string(),canvas:Xr}),Qr=d.object({pages:d.array(Yr),photoStrip:d.array(qr)}),ei=d.object({title:d.string(),binding:d.string(),coverSpecId:d.string(),styleId:d.number(),userId:d.string(),magicShopBook:Qr,reportingData:Gr});async function ti({apiHost:t,apiKey:e},s){return ye(async()=>{const n=(await as({url:`${t}/v1/books`,apiKey:e,payload:s})).data;return ws.safeParse(n),new Ot(n)})}async function Ts({apiHost:t,apiKey:e},s){return ye(async()=>{const n=(await Vn({url:`${t}/v1/books/${s.id}`,apiKey:e,payload:s})).data;return ws.safeParse(n),new Ot(n)})}async function si({apiHost:t,apiKey:e},s){return ye(async()=>{const n=(await is({url:`${t}/v1/books/${s}/format/galleon`,apiKey:e})).data;return ei.parse(n)})}class Es{constructor(e,s,n){b(this,"client");b(this,"parentId");b(this,"title");b(this,"occasion");b(this,"style");b(this,"bookSize");b(this,"coverType");b(this,"pageType");b(this,"imageDensity");b(this,"imageFilteringLevel");b(this,"embellishmentLevel");b(this,"textStickerLevel");b(this,"images");b(this,"guid");this.client=s,this.parentId=e,this.title=(n==null?void 0:n.title)||"",this.occasion=(n==null?void 0:n.occasion)||vt[0],this.style=(n==null?void 0:n.style)||parseInt(Object.keys(_t)[0]),this.bookSize=(n==null?void 0:n.bookSize)||bt[0],this.coverType=(n==null?void 0:n.coverType)||wt[0],this.pageType=(n==null?void 0:n.pageType)||xt[0],this.imageDensity=(n==null?void 0:n.imageDensity)||kt[0],this.imageFilteringLevel=(n==null?void 0:n.imageFilteringLevel)||St[0],this.embellishmentLevel=(n==null?void 0:n.embellishmentLevel)||Tt[0],this.textStickerLevel=(n==null?void 0:n.textStickerLevel)||Et[0],this.images=new gs(this.client,this.parentId)}async getOptions(e){return await Vr(this.client,this.bookSize,e||this.images.length)}async submit(e){return e&&Object.assign(this,e),this.getProgress(),await Ts(this.client,xs(this)),this}async setGuid(e){return this.guid=e,await Ts(this.client,xs(this)),this.guid}async getJSON(){return await si(this.client,this.parentId)}async getProgress(){let e="new";const s=new WebSocket(`${this.client.webSocketHost}/?book_id=${this.parentId}`),n=setTimeout(()=>{throw s.close(),new Error("Something went wrong. Please try again.")},Ur);s.onmessage=r=>{const i=JSON.parse(r.data);if(e!==i.state){e=i.state;const a=new CustomEvent("MagicBook.designRequestUpdated",{detail:i});["error","ready"].includes(i.state)&&(s.close(),clearTimeout(n)),window.dispatchEvent(a)}}}}class ni{constructor(e,s=Br,n=Mr){b(this,"apiKey");b(this,"apiHost");b(this,"webSocketHost");this.apiKey=e,this.apiHost=s,this.webSocketHost=n}async createDesignRequest(e){const s=await ti(this);return new Es(s.id,this,e)}}O.DesignRequest=Es,O.ImageServer=_s,O.Images=gs,O.MagicBookClient=ni,O.bookSizes=bt,O.coverTypes=wt,O.designOptionsSchema=Ss,O.embellishmentLevels=Tt,O.imageDensities=kt,O.imageDensityOptionSchema=Xe,O.imageDensityOptionsSchema=ks,O.imageFilteringLevels=St,O.imageServerSchema=vs,O.occasions=vt,O.pageTypes=xt,O.states=bs,O.styles=_t,O.textStickerLevels=Et,Object.defineProperty(O,Symbol.toStringTag,{value:"Module"})});
@@ -28,7 +28,7 @@ export type DesignRequestEventDetail = {
28
28
  };
29
29
  export type DesignRequestEvent = CustomEvent<DesignRequestEventDetail>;
30
30
  export declare class DesignRequest {
31
- client: MagicBookClient;
31
+ private client;
32
32
  parentId: string;
33
33
  title: string;
34
34
  occasion: Occasion;
@@ -132,8 +132,8 @@ export declare class DesignRequest {
132
132
  };
133
133
  reportingData: {
134
134
  properties: {
135
- value: string | number | boolean | null;
136
135
  key: string;
136
+ value?: any;
137
137
  }[];
138
138
  };
139
139
  }>;
@@ -76,13 +76,13 @@ export declare const photoMetadataSchema: z.ZodObject<{
76
76
  export type PhotoMetadata = z.infer<typeof photoMetadataSchema>;
77
77
  export declare const propertySchema: z.ZodObject<{
78
78
  key: z.ZodString;
79
- value: z.ZodNullable<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
79
+ value: z.ZodAny;
80
80
  }, "strip", z.ZodTypeAny, {
81
- value: string | number | boolean | null;
82
81
  key: string;
82
+ value?: any;
83
83
  }, {
84
- value: string | number | boolean | null;
85
84
  key: string;
85
+ value?: any;
86
86
  }>;
87
87
  export type Property = z.infer<typeof propertySchema>;
88
88
  export declare const assetSchema: z.ZodObject<{
@@ -267,23 +267,23 @@ export type PhotoStrip = z.infer<typeof photoStripSchema>;
267
267
  export declare const reportingDataSchema: z.ZodObject<{
268
268
  properties: z.ZodArray<z.ZodObject<{
269
269
  key: z.ZodString;
270
- value: z.ZodNullable<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
270
+ value: z.ZodAny;
271
271
  }, "strip", z.ZodTypeAny, {
272
- value: string | number | boolean | null;
273
272
  key: string;
273
+ value?: any;
274
274
  }, {
275
- value: string | number | boolean | null;
276
275
  key: string;
276
+ value?: any;
277
277
  }>, "many">;
278
278
  }, "strip", z.ZodTypeAny, {
279
279
  properties: {
280
- value: string | number | boolean | null;
281
280
  key: string;
281
+ value?: any;
282
282
  }[];
283
283
  }, {
284
284
  properties: {
285
- value: string | number | boolean | null;
286
285
  key: string;
286
+ value?: any;
287
287
  }[];
288
288
  }>;
289
289
  export type ReportingData = z.infer<typeof reportingDataSchema>;
@@ -1457,23 +1457,23 @@ export declare const bookCreationRequestSchema: z.ZodObject<{
1457
1457
  reportingData: z.ZodObject<{
1458
1458
  properties: z.ZodArray<z.ZodObject<{
1459
1459
  key: z.ZodString;
1460
- value: z.ZodNullable<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
1460
+ value: z.ZodAny;
1461
1461
  }, "strip", z.ZodTypeAny, {
1462
- value: string | number | boolean | null;
1463
1462
  key: string;
1463
+ value?: any;
1464
1464
  }, {
1465
- value: string | number | boolean | null;
1466
1465
  key: string;
1466
+ value?: any;
1467
1467
  }>, "many">;
1468
1468
  }, "strip", z.ZodTypeAny, {
1469
1469
  properties: {
1470
- value: string | number | boolean | null;
1471
1470
  key: string;
1471
+ value?: any;
1472
1472
  }[];
1473
1473
  }, {
1474
1474
  properties: {
1475
- value: string | number | boolean | null;
1476
1475
  key: string;
1476
+ value?: any;
1477
1477
  }[];
1478
1478
  }>;
1479
1479
  }, "strip", z.ZodTypeAny, {
@@ -1538,8 +1538,8 @@ export declare const bookCreationRequestSchema: z.ZodObject<{
1538
1538
  };
1539
1539
  reportingData: {
1540
1540
  properties: {
1541
- value: string | number | boolean | null;
1542
1541
  key: string;
1542
+ value?: any;
1543
1543
  }[];
1544
1544
  };
1545
1545
  }, {
@@ -1604,8 +1604,8 @@ export declare const bookCreationRequestSchema: z.ZodObject<{
1604
1604
  };
1605
1605
  reportingData: {
1606
1606
  properties: {
1607
- value: string | number | boolean | null;
1608
1607
  key: string;
1608
+ value?: any;
1609
1609
  }[];
1610
1610
  };
1611
1611
  }>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@magiclabs.ai/magicbook-client",
3
3
  "private": false,
4
- "version": "0.5.6",
4
+ "version": "0.6.0",
5
5
  "description": "TypeScript package to create photo books with the Magicbook API.",
6
6
  "type": "module",
7
7
  "main": "./magicbook-client.umd.cjs",
@@ -65,8 +65,8 @@ export declare function retrieveGalleon({ apiHost, apiKey }: MagicBookClient, bo
65
65
  };
66
66
  reportingData: {
67
67
  properties: {
68
- value: string | number | boolean | null;
69
68
  key: string;
69
+ value?: any;
70
70
  }[];
71
71
  };
72
72
  }>;