@getopenpay/openpay-js 0.1.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.
@@ -0,0 +1,44 @@
1
+ (function(Ne,A){typeof exports=="object"&&typeof module<"u"?A(exports):typeof define=="function"&&define.amd?define(["exports"],A):(Ne=typeof globalThis<"u"?globalThis:Ne||self,A(Ne.OpenPay={}))})(this,function(Ne){"use strict";var A;(function(r){r.assertEqual=s=>s;function e(s){}r.assertIs=e;function t(s){throw new Error}r.assertNever=t,r.arrayToEnum=s=>{const o={};for(const u of s)o[u]=u;return o},r.getValidEnumValues=s=>{const o=r.objectKeys(s).filter(l=>typeof s[s[l]]!="number"),u={};for(const l of o)u[l]=s[l];return r.objectValues(u)},r.objectValues=s=>r.objectKeys(s).map(function(o){return s[o]}),r.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const o=[];for(const u in s)Object.prototype.hasOwnProperty.call(s,u)&&o.push(u);return o},r.find=(s,o)=>{for(const u of s)if(o(u))return u},r.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function n(s,o=" | "){return s.map(u=>typeof u=="string"?`'${u}'`:u).join(o)}r.joinValues=n,r.jsonStringifyReplacer=(s,o)=>typeof o=="bigint"?o.toString():o})(A||(A={}));var Yt;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(Yt||(Yt={}));const E=A.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),xe=r=>{switch(typeof r){case"undefined":return E.undefined;case"string":return E.string;case"number":return isNaN(r)?E.nan:E.number;case"boolean":return E.boolean;case"function":return E.function;case"bigint":return E.bigint;case"symbol":return E.symbol;case"object":return Array.isArray(r)?E.array:r===null?E.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?E.promise:typeof Map<"u"&&r instanceof Map?E.map:typeof Set<"u"&&r instanceof Set?E.set:typeof Date<"u"&&r instanceof Date?E.date:E.object;default:return E.unknown}},y=A.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"]),Vn=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:");class fe extends Error{constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(o){return o.message},n={_errors:[]},s=o=>{for(const u of o.issues)if(u.code==="invalid_union")u.unionErrors.map(s);else if(u.code==="invalid_return_type")s(u.returnTypeError);else if(u.code==="invalid_arguments")s(u.argumentsError);else if(u.path.length===0)n._errors.push(t(u));else{let l=n,p=0;for(;p<u.path.length;){const m=u.path[p];p===u.path.length-1?(l[m]=l[m]||{_errors:[]},l[m]._errors.push(t(u))):l[m]=l[m]||{_errors:[]},l=l[m],p++}}};return s(this),n}static assert(e){if(!(e instanceof fe))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,A.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},n=[];for(const s of this.issues)s.path.length>0?(t[s.path[0]]=t[s.path[0]]||[],t[s.path[0]].push(e(s))):n.push(e(s));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}fe.create=r=>new fe(r);const Ve=(r,e)=>{let t;switch(r.code){case y.invalid_type:r.received===E.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case y.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,A.jsonStringifyReplacer)}`;break;case y.unrecognized_keys:t=`Unrecognized key(s) in object: ${A.joinValues(r.keys,", ")}`;break;case y.invalid_union:t="Invalid input";break;case y.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${A.joinValues(r.options)}`;break;case y.invalid_enum_value:t=`Invalid enum value. Expected ${A.joinValues(r.options)}, received '${r.received}'`;break;case y.invalid_arguments:t="Invalid function arguments";break;case y.invalid_return_type:t="Invalid function return type";break;case y.invalid_date:t="Invalid date";break;case y.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:A.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case y.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case y.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case y.custom:t="Invalid input";break;case y.invalid_intersection_types:t="Intersection results could not be merged";break;case y.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case y.not_finite:t="Number must be finite";break;default:t=e.defaultError,A.assertNever(r)}return{message:t}};let br=Ve;function zn(r){br=r}function Tt(){return br}const Ct=r=>{const{data:e,path:t,errorMaps:n,issueData:s}=r,o=[...t,...s.path||[]],u={...s,path:o};if(s.message!==void 0)return{...s,path:o,message:s.message};let l="";const p=n.filter(m=>!!m).slice().reverse();for(const m of p)l=m(u,{data:e,defaultError:l}).message;return{...s,path:o,message:l}},qn=[];function b(r,e){const t=Tt(),n=Ct({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===Ve?void 0:Ve].filter(s=>!!s)});r.common.issues.push(n)}class se{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const s of t){if(s.status==="aborted")return S;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const s of t){const o=await s.key,u=await s.value;n.push({key:o,value:u})}return se.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const s of t){const{key:o,value:u}=s;if(o.status==="aborted"||u.status==="aborted")return S;o.status==="dirty"&&e.dirty(),u.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof u.value<"u"||s.alwaysSet)&&(n[o.value]=u.value)}return{status:e.value,value:n}}}const S=Object.freeze({status:"aborted"}),ze=r=>({status:"dirty",value:r}),ce=r=>({status:"valid",value:r}),Kt=r=>r.status==="aborted",Jt=r=>r.status==="dirty",et=r=>r.status==="valid",tt=r=>typeof Promise<"u"&&r instanceof Promise;function St(r,e,t,n){if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(r)}function Er(r,e,t,n,s){if(typeof e=="function"?r!==e||!s:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(r,t),t}typeof SuppressedError=="function"&&SuppressedError;var k;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(k||(k={}));var rt,nt;class Ee{constructor(e,t,n,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=s}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 wr=(r,e)=>{if(et(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new fe(r.common.issues);return this._error=t,this._error}}};function I(r){if(!r)return{};const{errorMap:e,invalid_type_error:t,required_error:n,description:s}=r;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(u,l)=>{var p,m;const{message:_}=r;return u.code==="invalid_enum_value"?{message:_??l.defaultError}:typeof l.data>"u"?{message:(p=_??n)!==null&&p!==void 0?p:l.defaultError}:u.code!=="invalid_type"?{message:l.defaultError}:{message:(m=_??t)!==null&&m!==void 0?m:l.defaultError}},description:s}}class P{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.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return xe(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:xe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new se,ctx:{common:e.parent.common,data:e.data,parsedType:xe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(tt(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const s={common:{issues:[],async:(n=t==null?void 0:t.async)!==null&&n!==void 0?n:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:xe(e)},o=this._parseSync({data:e,path:s.path,parent:s});return wr(s,o)}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:xe(e)},s=this._parse({data:e,path:n.path,parent:n}),o=await(tt(s)?s:Promise.resolve(s));return wr(n,o)}refine(e,t){const n=s=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(s):t;return this._refinement((s,o)=>{const u=e(s),l=()=>o.addIssue({code:y.custom,...n(s)});return typeof Promise<"u"&&u instanceof Promise?u.then(p=>p?!0:(l(),!1)):u?!0:(l(),!1)})}refinement(e,t){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof t=="function"?t(n,s):t),!1))}_refinement(e){return new _e({schema:this,typeName:T.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return ke.create(this,this._def)}nullable(){return Pe.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ge.create(this,this._def)}promise(){return He.create(this,this._def)}or(e){return it.create([this,e],this._def)}and(e){return ct.create(this,e,this._def)}transform(e){return new _e({...I(this._def),schema:this,typeName:T.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new ht({...I(this._def),innerType:this,defaultValue:t,typeName:T.ZodDefault})}brand(){return new Xt({typeName:T.ZodBranded,type:this,...I(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new pt({...I(this._def),innerType:this,catchValue:t,typeName:T.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return mt.create(this,e)}readonly(){return yt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Wn=/^c[^\s-]{8,}$/i,Bn=/^[0-9a-z]+$/,Hn=/^[0-9A-HJKMNP-TV-Z]{26}$/,Yn=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Kn=/^[a-z0-9_-]{21}$/i,Jn=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Gn=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Qn="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Gt;const Xn=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ea=/^(([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})))$/,ta=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,kr="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",ra=new RegExp(`^${kr}$`);function Tr(r){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`),e}function na(r){return new RegExp(`^${Tr(r)}$`)}function Cr(r){let e=`${kr}T${Tr(r)}`;const t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function aa(r,e){return!!((e==="v4"||!e)&&Xn.test(r)||(e==="v6"||!e)&&ea.test(r))}class ve extends P{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==E.string){const o=this._getOrReturnCtx(e);return b(o,{code:y.invalid_type,expected:E.string,received:o.parsedType}),S}const n=new se;let s;for(const o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(s=this._getOrReturnCtx(e,s),b(s,{code:y.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="max")e.data.length>o.value&&(s=this._getOrReturnCtx(e,s),b(s,{code:y.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){const u=e.data.length>o.value,l=e.data.length<o.value;(u||l)&&(s=this._getOrReturnCtx(e,s),u?b(s,{code:y.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):l&&b(s,{code:y.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),n.dirty())}else if(o.kind==="email")Gn.test(e.data)||(s=this._getOrReturnCtx(e,s),b(s,{validation:"email",code:y.invalid_string,message:o.message}),n.dirty());else if(o.kind==="emoji")Gt||(Gt=new RegExp(Qn,"u")),Gt.test(e.data)||(s=this._getOrReturnCtx(e,s),b(s,{validation:"emoji",code:y.invalid_string,message:o.message}),n.dirty());else if(o.kind==="uuid")Yn.test(e.data)||(s=this._getOrReturnCtx(e,s),b(s,{validation:"uuid",code:y.invalid_string,message:o.message}),n.dirty());else if(o.kind==="nanoid")Kn.test(e.data)||(s=this._getOrReturnCtx(e,s),b(s,{validation:"nanoid",code:y.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid")Wn.test(e.data)||(s=this._getOrReturnCtx(e,s),b(s,{validation:"cuid",code:y.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid2")Bn.test(e.data)||(s=this._getOrReturnCtx(e,s),b(s,{validation:"cuid2",code:y.invalid_string,message:o.message}),n.dirty());else if(o.kind==="ulid")Hn.test(e.data)||(s=this._getOrReturnCtx(e,s),b(s,{validation:"ulid",code:y.invalid_string,message:o.message}),n.dirty());else if(o.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),b(s,{validation:"url",code:y.invalid_string,message:o.message}),n.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),b(s,{validation:"regex",code:y.invalid_string,message:o.message}),n.dirty())):o.kind==="trim"?e.data=e.data.trim():o.kind==="includes"?e.data.includes(o.value,o.position)||(s=this._getOrReturnCtx(e,s),b(s,{code:y.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),n.dirty()):o.kind==="toLowerCase"?e.data=e.data.toLowerCase():o.kind==="toUpperCase"?e.data=e.data.toUpperCase():o.kind==="startsWith"?e.data.startsWith(o.value)||(s=this._getOrReturnCtx(e,s),b(s,{code:y.invalid_string,validation:{startsWith:o.value},message:o.message}),n.dirty()):o.kind==="endsWith"?e.data.endsWith(o.value)||(s=this._getOrReturnCtx(e,s),b(s,{code:y.invalid_string,validation:{endsWith:o.value},message:o.message}),n.dirty()):o.kind==="datetime"?Cr(o).test(e.data)||(s=this._getOrReturnCtx(e,s),b(s,{code:y.invalid_string,validation:"datetime",message:o.message}),n.dirty()):o.kind==="date"?ra.test(e.data)||(s=this._getOrReturnCtx(e,s),b(s,{code:y.invalid_string,validation:"date",message:o.message}),n.dirty()):o.kind==="time"?na(o).test(e.data)||(s=this._getOrReturnCtx(e,s),b(s,{code:y.invalid_string,validation:"time",message:o.message}),n.dirty()):o.kind==="duration"?Jn.test(e.data)||(s=this._getOrReturnCtx(e,s),b(s,{validation:"duration",code:y.invalid_string,message:o.message}),n.dirty()):o.kind==="ip"?aa(e.data,o.version)||(s=this._getOrReturnCtx(e,s),b(s,{validation:"ip",code:y.invalid_string,message:o.message}),n.dirty()):o.kind==="base64"?ta.test(e.data)||(s=this._getOrReturnCtx(e,s),b(s,{validation:"base64",code:y.invalid_string,message:o.message}),n.dirty()):A.assertNever(o);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(s=>e.test(s),{validation:t,code:y.invalid_string,...k.errToObj(n)})}_addCheck(e){return new ve({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...k.errToObj(e)})}url(e){return this._addCheck({kind:"url",...k.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...k.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...k.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...k.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...k.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...k.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...k.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...k.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...k.errToObj(e)})}datetime(e){var t,n;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(t=e==null?void 0:e.offset)!==null&&t!==void 0?t:!1,local:(n=e==null?void 0:e.local)!==null&&n!==void 0?n:!1,...k.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...k.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...k.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...k.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...k.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...k.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...k.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...k.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...k.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...k.errToObj(t)})}nonempty(e){return this.min(1,k.errToObj(e))}trim(){return new ve({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ve({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ve({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}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 isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}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 isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}ve.create=r=>{var e;return new ve({checks:[],typeName:T.ZodString,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...I(r)})};function sa(r,e){const t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=t>n?t:n,o=parseInt(r.toFixed(s).replace(".","")),u=parseInt(e.toFixed(s).replace(".",""));return o%u/Math.pow(10,s)}class Re extends P{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)!==E.number){const o=this._getOrReturnCtx(e);return b(o,{code:y.invalid_type,expected:E.number,received:o.parsedType}),S}let n;const s=new se;for(const o of this._def.checks)o.kind==="int"?A.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{code:y.invalid_type,expected:"integer",received:"float",message:o.message}),s.dirty()):o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(n=this._getOrReturnCtx(e,n),b(n,{code:y.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),s.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(n=this._getOrReturnCtx(e,n),b(n,{code:y.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),s.dirty()):o.kind==="multipleOf"?sa(e.data,o.value)!==0&&(n=this._getOrReturnCtx(e,n),b(n,{code:y.not_multiple_of,multipleOf:o.value,message:o.message}),s.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{code:y.not_finite,message:o.message}),s.dirty()):A.assertNever(o);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,k.toString(t))}gt(e,t){return this.setLimit("min",e,!1,k.toString(t))}lte(e,t){return this.setLimit("max",e,!0,k.toString(t))}lt(e,t){return this.setLimit("max",e,!1,k.toString(t))}setLimit(e,t,n,s){return new Re({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:k.toString(s)}]})}_addCheck(e){return new Re({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:k.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:k.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:k.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:k.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:k.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:k.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:k.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:k.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:k.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&A.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}Re.create=r=>new Re({checks:[],typeName:T.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1,...I(r)});class Oe extends P{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)!==E.bigint){const o=this._getOrReturnCtx(e);return b(o,{code:y.invalid_type,expected:E.bigint,received:o.parsedType}),S}let n;const s=new se;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(n=this._getOrReturnCtx(e,n),b(n,{code:y.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),s.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(n=this._getOrReturnCtx(e,n),b(n,{code:y.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),s.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),b(n,{code:y.not_multiple_of,multipleOf:o.value,message:o.message}),s.dirty()):A.assertNever(o);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,k.toString(t))}gt(e,t){return this.setLimit("min",e,!1,k.toString(t))}lte(e,t){return this.setLimit("max",e,!0,k.toString(t))}lt(e,t){return this.setLimit("max",e,!1,k.toString(t))}setLimit(e,t,n,s){return new Oe({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:k.toString(s)}]})}_addCheck(e){return new Oe({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:k.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:k.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:k.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:k.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:k.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}Oe.create=r=>{var e;return new Oe({checks:[],typeName:T.ZodBigInt,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...I(r)})};class at extends P{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==E.boolean){const n=this._getOrReturnCtx(e);return b(n,{code:y.invalid_type,expected:E.boolean,received:n.parsedType}),S}return ce(e.data)}}at.create=r=>new at({typeName:T.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,...I(r)});class De extends P{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==E.date){const o=this._getOrReturnCtx(e);return b(o,{code:y.invalid_type,expected:E.date,received:o.parsedType}),S}if(isNaN(e.data.getTime())){const o=this._getOrReturnCtx(e);return b(o,{code:y.invalid_date}),S}const n=new se;let s;for(const o of this._def.checks)o.kind==="min"?e.data.getTime()<o.value&&(s=this._getOrReturnCtx(e,s),b(s,{code:y.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),n.dirty()):o.kind==="max"?e.data.getTime()>o.value&&(s=this._getOrReturnCtx(e,s),b(s,{code:y.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):A.assertNever(o);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new De({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:k.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:k.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}De.create=r=>new De({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:T.ZodDate,...I(r)});class xt extends P{_parse(e){if(this._getType(e)!==E.symbol){const n=this._getOrReturnCtx(e);return b(n,{code:y.invalid_type,expected:E.symbol,received:n.parsedType}),S}return ce(e.data)}}xt.create=r=>new xt({typeName:T.ZodSymbol,...I(r)});class st extends P{_parse(e){if(this._getType(e)!==E.undefined){const n=this._getOrReturnCtx(e);return b(n,{code:y.invalid_type,expected:E.undefined,received:n.parsedType}),S}return ce(e.data)}}st.create=r=>new st({typeName:T.ZodUndefined,...I(r)});class ot extends P{_parse(e){if(this._getType(e)!==E.null){const n=this._getOrReturnCtx(e);return b(n,{code:y.invalid_type,expected:E.null,received:n.parsedType}),S}return ce(e.data)}}ot.create=r=>new ot({typeName:T.ZodNull,...I(r)});class qe extends P{constructor(){super(...arguments),this._any=!0}_parse(e){return ce(e.data)}}qe.create=r=>new qe({typeName:T.ZodAny,...I(r)});class $e extends P{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ce(e.data)}}$e.create=r=>new $e({typeName:T.ZodUnknown,...I(r)});class Ce extends P{_parse(e){const t=this._getOrReturnCtx(e);return b(t,{code:y.invalid_type,expected:E.never,received:t.parsedType}),S}}Ce.create=r=>new Ce({typeName:T.ZodNever,...I(r)});class Rt extends P{_parse(e){if(this._getType(e)!==E.undefined){const n=this._getOrReturnCtx(e);return b(n,{code:y.invalid_type,expected:E.void,received:n.parsedType}),S}return ce(e.data)}}Rt.create=r=>new Rt({typeName:T.ZodVoid,...I(r)});class ge extends P{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),s=this._def;if(t.parsedType!==E.array)return b(t,{code:y.invalid_type,expected:E.array,received:t.parsedType}),S;if(s.exactLength!==null){const u=t.data.length>s.exactLength.value,l=t.data.length<s.exactLength.value;(u||l)&&(b(t,{code:u?y.too_big:y.too_small,minimum:l?s.exactLength.value:void 0,maximum:u?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&t.data.length<s.minLength.value&&(b(t,{code:y.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&t.data.length>s.maxLength.value&&(b(t,{code:y.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((u,l)=>s.type._parseAsync(new Ee(t,u,t.path,l)))).then(u=>se.mergeArray(n,u));const o=[...t.data].map((u,l)=>s.type._parseSync(new Ee(t,u,t.path,l)));return se.mergeArray(n,o)}get element(){return this._def.type}min(e,t){return new ge({...this._def,minLength:{value:e,message:k.toString(t)}})}max(e,t){return new ge({...this._def,maxLength:{value:e,message:k.toString(t)}})}length(e,t){return new ge({...this._def,exactLength:{value:e,message:k.toString(t)}})}nonempty(e){return this.min(1,e)}}ge.create=(r,e)=>new ge({type:r,minLength:null,maxLength:null,exactLength:null,typeName:T.ZodArray,...I(e)});function We(r){if(r instanceof W){const e={};for(const t in r.shape){const n=r.shape[t];e[t]=ke.create(We(n))}return new W({...r._def,shape:()=>e})}else return r instanceof ge?new ge({...r._def,type:We(r.element)}):r instanceof ke?ke.create(We(r.unwrap())):r instanceof Pe?Pe.create(We(r.unwrap())):r instanceof we?we.create(r.items.map(e=>We(e))):r}class W extends P{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(),t=A.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==E.object){const m=this._getOrReturnCtx(e);return b(m,{code:y.invalid_type,expected:E.object,received:m.parsedType}),S}const{status:n,ctx:s}=this._processInputParams(e),{shape:o,keys:u}=this._getCached(),l=[];if(!(this._def.catchall instanceof Ce&&this._def.unknownKeys==="strip"))for(const m in s.data)u.includes(m)||l.push(m);const p=[];for(const m of u){const _=o[m],O=s.data[m];p.push({key:{status:"valid",value:m},value:_._parse(new Ee(s,O,s.path,m)),alwaysSet:m in s.data})}if(this._def.catchall instanceof Ce){const m=this._def.unknownKeys;if(m==="passthrough")for(const _ of l)p.push({key:{status:"valid",value:_},value:{status:"valid",value:s.data[_]}});else if(m==="strict")l.length>0&&(b(s,{code:y.unrecognized_keys,keys:l}),n.dirty());else if(m!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const m=this._def.catchall;for(const _ of l){const O=s.data[_];p.push({key:{status:"valid",value:_},value:m._parse(new Ee(s,O,s.path,_)),alwaysSet:_ in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const m=[];for(const _ of p){const O=await _.key,V=await _.value;m.push({key:O,value:V,alwaysSet:_.alwaysSet})}return m}).then(m=>se.mergeObjectSync(n,m)):se.mergeObjectSync(n,p)}get shape(){return this._def.shape()}strict(e){return k.errToObj,new W({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var s,o,u,l;const p=(u=(o=(s=this._def).errorMap)===null||o===void 0?void 0:o.call(s,t,n).message)!==null&&u!==void 0?u:n.defaultError;return t.code==="unrecognized_keys"?{message:(l=k.errToObj(e).message)!==null&&l!==void 0?l:p}:{message:p}}}:{}})}strip(){return new W({...this._def,unknownKeys:"strip"})}passthrough(){return new W({...this._def,unknownKeys:"passthrough"})}extend(e){return new W({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new W({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:T.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new W({...this._def,catchall:e})}pick(e){const t={};return A.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])}),new W({...this._def,shape:()=>t})}omit(e){const t={};return A.objectKeys(this.shape).forEach(n=>{e[n]||(t[n]=this.shape[n])}),new W({...this._def,shape:()=>t})}deepPartial(){return We(this)}partial(e){const t={};return A.objectKeys(this.shape).forEach(n=>{const s=this.shape[n];e&&!e[n]?t[n]=s:t[n]=s.optional()}),new W({...this._def,shape:()=>t})}required(e){const t={};return A.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])t[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof ke;)o=o._def.innerType;t[n]=o}}),new W({...this._def,shape:()=>t})}keyof(){return Sr(A.objectKeys(this.shape))}}W.create=(r,e)=>new W({shape:()=>r,unknownKeys:"strip",catchall:Ce.create(),typeName:T.ZodObject,...I(e)}),W.strictCreate=(r,e)=>new W({shape:()=>r,unknownKeys:"strict",catchall:Ce.create(),typeName:T.ZodObject,...I(e)}),W.lazycreate=(r,e)=>new W({shape:r,unknownKeys:"strip",catchall:Ce.create(),typeName:T.ZodObject,...I(e)});class it extends P{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;function s(o){for(const l of o)if(l.result.status==="valid")return l.result;for(const l of o)if(l.result.status==="dirty")return t.common.issues.push(...l.ctx.common.issues),l.result;const u=o.map(l=>new fe(l.ctx.common.issues));return b(t,{code:y.invalid_union,unionErrors:u}),S}if(t.common.async)return Promise.all(n.map(async o=>{const u={...t,common:{...t.common,issues:[]},parent:null};return{result:await o._parseAsync({data:t.data,path:t.path,parent:u}),ctx:u}})).then(s);{let o;const u=[];for(const p of n){const m={...t,common:{...t.common,issues:[]},parent:null},_=p._parseSync({data:t.data,path:t.path,parent:m});if(_.status==="valid")return _;_.status==="dirty"&&!o&&(o={result:_,ctx:m}),m.common.issues.length&&u.push(m.common.issues)}if(o)return t.common.issues.push(...o.ctx.common.issues),o.result;const l=u.map(p=>new fe(p));return b(t,{code:y.invalid_union,unionErrors:l}),S}}get options(){return this._def.options}}it.create=(r,e)=>new it({options:r,typeName:T.ZodUnion,...I(e)});const Se=r=>r instanceof lt?Se(r.schema):r instanceof _e?Se(r.innerType()):r instanceof dt?[r.value]:r instanceof Ie?r.options:r instanceof ft?A.objectValues(r.enum):r instanceof ht?Se(r._def.innerType):r instanceof st?[void 0]:r instanceof ot?[null]:r instanceof ke?[void 0,...Se(r.unwrap())]:r instanceof Pe?[null,...Se(r.unwrap())]:r instanceof Xt||r instanceof yt?Se(r.unwrap()):r instanceof pt?Se(r._def.innerType):[];class Ot extends P{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==E.object)return b(t,{code:y.invalid_type,expected:E.object,received:t.parsedType}),S;const n=this.discriminator,s=t.data[n],o=this.optionsMap.get(s);return o?t.common.async?o._parseAsync({data:t.data,path:t.path,parent:t}):o._parseSync({data:t.data,path:t.path,parent:t}):(b(t,{code:y.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),S)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const s=new Map;for(const o of t){const u=Se(o.shape[e]);if(!u.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const l of u){if(s.has(l))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(l)}`);s.set(l,o)}}return new Ot({typeName:T.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,...I(n)})}}function Qt(r,e){const t=xe(r),n=xe(e);if(r===e)return{valid:!0,data:r};if(t===E.object&&n===E.object){const s=A.objectKeys(e),o=A.objectKeys(r).filter(l=>s.indexOf(l)!==-1),u={...r,...e};for(const l of o){const p=Qt(r[l],e[l]);if(!p.valid)return{valid:!1};u[l]=p.data}return{valid:!0,data:u}}else if(t===E.array&&n===E.array){if(r.length!==e.length)return{valid:!1};const s=[];for(let o=0;o<r.length;o++){const u=r[o],l=e[o],p=Qt(u,l);if(!p.valid)return{valid:!1};s.push(p.data)}return{valid:!0,data:s}}else return t===E.date&&n===E.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}class ct extends P{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=(o,u)=>{if(Kt(o)||Kt(u))return S;const l=Qt(o.value,u.value);return l.valid?((Jt(o)||Jt(u))&&t.dirty(),{status:t.value,value:l.data}):(b(n,{code:y.invalid_intersection_types}),S)};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(([o,u])=>s(o,u)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}ct.create=(r,e,t)=>new ct({left:r,right:e,typeName:T.ZodIntersection,...I(t)});class we extends P{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==E.array)return b(n,{code:y.invalid_type,expected:E.array,received:n.parsedType}),S;if(n.data.length<this._def.items.length)return b(n,{code:y.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),S;!this._def.rest&&n.data.length>this._def.items.length&&(b(n,{code:y.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const o=[...n.data].map((u,l)=>{const p=this._def.items[l]||this._def.rest;return p?p._parse(new Ee(n,u,n.path,l)):null}).filter(u=>!!u);return n.common.async?Promise.all(o).then(u=>se.mergeArray(t,u)):se.mergeArray(t,o)}get items(){return this._def.items}rest(e){return new we({...this._def,rest:e})}}we.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new we({items:r,typeName:T.ZodTuple,rest:null,...I(e)})};class ut extends P{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==E.object)return b(n,{code:y.invalid_type,expected:E.object,received:n.parsedType}),S;const s=[],o=this._def.keyType,u=this._def.valueType;for(const l in n.data)s.push({key:o._parse(new Ee(n,l,n.path,l)),value:u._parse(new Ee(n,n.data[l],n.path,l)),alwaysSet:l in n.data});return n.common.async?se.mergeObjectAsync(t,s):se.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof P?new ut({keyType:e,valueType:t,typeName:T.ZodRecord,...I(n)}):new ut({keyType:ve.create(),valueType:e,typeName:T.ZodRecord,...I(t)})}}class It extends P{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==E.map)return b(n,{code:y.invalid_type,expected:E.map,received:n.parsedType}),S;const s=this._def.keyType,o=this._def.valueType,u=[...n.data.entries()].map(([l,p],m)=>({key:s._parse(new Ee(n,l,n.path,[m,"key"])),value:o._parse(new Ee(n,p,n.path,[m,"value"]))}));if(n.common.async){const l=new Map;return Promise.resolve().then(async()=>{for(const p of u){const m=await p.key,_=await p.value;if(m.status==="aborted"||_.status==="aborted")return S;(m.status==="dirty"||_.status==="dirty")&&t.dirty(),l.set(m.value,_.value)}return{status:t.value,value:l}})}else{const l=new Map;for(const p of u){const m=p.key,_=p.value;if(m.status==="aborted"||_.status==="aborted")return S;(m.status==="dirty"||_.status==="dirty")&&t.dirty(),l.set(m.value,_.value)}return{status:t.value,value:l}}}}It.create=(r,e,t)=>new It({valueType:e,keyType:r,typeName:T.ZodMap,...I(t)});class Le extends P{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==E.set)return b(n,{code:y.invalid_type,expected:E.set,received:n.parsedType}),S;const s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(b(n,{code:y.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),t.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(b(n,{code:y.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());const o=this._def.valueType;function u(p){const m=new Set;for(const _ of p){if(_.status==="aborted")return S;_.status==="dirty"&&t.dirty(),m.add(_.value)}return{status:t.value,value:m}}const l=[...n.data.values()].map((p,m)=>o._parse(new Ee(n,p,n.path,m)));return n.common.async?Promise.all(l).then(p=>u(p)):u(l)}min(e,t){return new Le({...this._def,minSize:{value:e,message:k.toString(t)}})}max(e,t){return new Le({...this._def,maxSize:{value:e,message:k.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Le.create=(r,e)=>new Le({valueType:r,minSize:null,maxSize:null,typeName:T.ZodSet,...I(e)});class Be extends P{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==E.function)return b(t,{code:y.invalid_type,expected:E.function,received:t.parsedType}),S;function n(l,p){return Ct({data:l,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Tt(),Ve].filter(m=>!!m),issueData:{code:y.invalid_arguments,argumentsError:p}})}function s(l,p){return Ct({data:l,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Tt(),Ve].filter(m=>!!m),issueData:{code:y.invalid_return_type,returnTypeError:p}})}const o={errorMap:t.common.contextualErrorMap},u=t.data;if(this._def.returns instanceof He){const l=this;return ce(async function(...p){const m=new fe([]),_=await l._def.args.parseAsync(p,o).catch($=>{throw m.addIssue(n(p,$)),m}),O=await Reflect.apply(u,this,_);return await l._def.returns._def.type.parseAsync(O,o).catch($=>{throw m.addIssue(s(O,$)),m})})}else{const l=this;return ce(function(...p){const m=l._def.args.safeParse(p,o);if(!m.success)throw new fe([n(p,m.error)]);const _=Reflect.apply(u,this,m.data),O=l._def.returns.safeParse(_,o);if(!O.success)throw new fe([s(_,O.error)]);return O.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Be({...this._def,args:we.create(e).rest($e.create())})}returns(e){return new Be({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new Be({args:e||we.create([]).rest($e.create()),returns:t||$e.create(),typeName:T.ZodFunction,...I(n)})}}class lt extends P{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}lt.create=(r,e)=>new lt({getter:r,typeName:T.ZodLazy,...I(e)});class dt extends P{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return b(t,{received:t.data,code:y.invalid_literal,expected:this._def.value}),S}return{status:"valid",value:e.data}}get value(){return this._def.value}}dt.create=(r,e)=>new dt({value:r,typeName:T.ZodLiteral,...I(e)});function Sr(r,e){return new Ie({values:r,typeName:T.ZodEnum,...I(e)})}class Ie extends P{constructor(){super(...arguments),rt.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return b(t,{expected:A.joinValues(n),received:t.parsedType,code:y.invalid_type}),S}if(St(this,rt)||Er(this,rt,new Set(this._def.values)),!St(this,rt).has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return b(t,{received:t.data,code:y.invalid_enum_value,options:n}),S}return ce(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return Ie.create(e,{...this._def,...t})}exclude(e,t=this._def){return Ie.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}}rt=new WeakMap,Ie.create=Sr;class ft extends P{constructor(){super(...arguments),nt.set(this,void 0)}_parse(e){const t=A.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==E.string&&n.parsedType!==E.number){const s=A.objectValues(t);return b(n,{expected:A.joinValues(s),received:n.parsedType,code:y.invalid_type}),S}if(St(this,nt)||Er(this,nt,new Set(A.getValidEnumValues(this._def.values))),!St(this,nt).has(e.data)){const s=A.objectValues(t);return b(n,{received:n.data,code:y.invalid_enum_value,options:s}),S}return ce(e.data)}get enum(){return this._def.values}}nt=new WeakMap,ft.create=(r,e)=>new ft({values:r,typeName:T.ZodNativeEnum,...I(e)});class He extends P{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==E.promise&&t.common.async===!1)return b(t,{code:y.invalid_type,expected:E.promise,received:t.parsedType}),S;const n=t.parsedType===E.promise?t.data:Promise.resolve(t.data);return ce(n.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}}He.create=(r,e)=>new He({type:r,typeName:T.ZodPromise,...I(e)});class _e extends P{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===T.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=this._def.effect||null,o={addIssue:u=>{b(n,u),u.fatal?t.abort():t.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),s.type==="preprocess"){const u=s.transform(n.data,o);if(n.common.async)return Promise.resolve(u).then(async l=>{if(t.value==="aborted")return S;const p=await this._def.schema._parseAsync({data:l,path:n.path,parent:n});return p.status==="aborted"?S:p.status==="dirty"||t.value==="dirty"?ze(p.value):p});{if(t.value==="aborted")return S;const l=this._def.schema._parseSync({data:u,path:n.path,parent:n});return l.status==="aborted"?S:l.status==="dirty"||t.value==="dirty"?ze(l.value):l}}if(s.type==="refinement"){const u=l=>{const p=s.refinement(l,o);if(n.common.async)return Promise.resolve(p);if(p instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return l};if(n.common.async===!1){const l=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return l.status==="aborted"?S:(l.status==="dirty"&&t.dirty(),u(l.value),{status:t.value,value:l.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(l=>l.status==="aborted"?S:(l.status==="dirty"&&t.dirty(),u(l.value).then(()=>({status:t.value,value:l.value}))))}if(s.type==="transform")if(n.common.async===!1){const u=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!et(u))return u;const l=s.transform(u.value,o);if(l instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:l}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(u=>et(u)?Promise.resolve(s.transform(u.value,o)).then(l=>({status:t.value,value:l})):u);A.assertNever(s)}}_e.create=(r,e,t)=>new _e({schema:r,typeName:T.ZodEffects,effect:e,...I(t)}),_e.createWithPreprocess=(r,e,t)=>new _e({schema:e,effect:{type:"preprocess",transform:r},typeName:T.ZodEffects,...I(t)});class ke extends P{_parse(e){return this._getType(e)===E.undefined?ce(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ke.create=(r,e)=>new ke({innerType:r,typeName:T.ZodOptional,...I(e)});class Pe extends P{_parse(e){return this._getType(e)===E.null?ce(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Pe.create=(r,e)=>new Pe({innerType:r,typeName:T.ZodNullable,...I(e)});class ht extends P{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===E.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}ht.create=(r,e)=>new ht({innerType:r,typeName:T.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...I(e)});class pt extends P{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return tt(s)?s.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new fe(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new fe(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}pt.create=(r,e)=>new pt({innerType:r,typeName:T.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...I(e)});class Pt extends P{_parse(e){if(this._getType(e)!==E.nan){const n=this._getOrReturnCtx(e);return b(n,{code:y.invalid_type,expected:E.nan,received:n.parsedType}),S}return{status:"valid",value:e.data}}}Pt.create=r=>new Pt({typeName:T.ZodNaN,...I(r)});const oa=Symbol("zod_brand");class Xt extends P{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class mt extends P{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const o=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?S:o.status==="dirty"?(t.dirty(),ze(o.value)):this._def.out._parseAsync({data:o.value,path:n.path,parent:n})})();{const s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?S:s.status==="dirty"?(t.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(e,t){return new mt({in:e,out:t,typeName:T.ZodPipeline})}}class yt extends P{_parse(e){const t=this._def.innerType._parse(e),n=s=>(et(s)&&(s.value=Object.freeze(s.value)),s);return tt(t)?t.then(s=>n(s)):n(t)}unwrap(){return this._def.innerType}}yt.create=(r,e)=>new yt({innerType:r,typeName:T.ZodReadonly,...I(e)});function xr(r,e={},t){return r?qe.create().superRefine((n,s)=>{var o,u;if(!r(n)){const l=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,p=(u=(o=l.fatal)!==null&&o!==void 0?o:t)!==null&&u!==void 0?u:!0,m=typeof l=="string"?{message:l}:l;s.addIssue({code:"custom",...m,fatal:p})}}):qe.create()}const ia={object:W.lazycreate};var T;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(T||(T={}));const ca=(r,e={message:`Input not instance of ${r.name}`})=>xr(t=>t instanceof r,e),Rr=ve.create,Or=Re.create,ua=Pt.create,la=Oe.create,Ir=at.create,da=De.create,fa=xt.create,ha=st.create,pa=ot.create,ma=qe.create,ya=$e.create,va=Ce.create,ga=Rt.create,_a=ge.create,ba=W.create,Ea=W.strictCreate,wa=it.create,ka=Ot.create,Ta=ct.create,Ca=we.create,Sa=ut.create,xa=It.create,Ra=Le.create,Oa=Be.create,Ia=lt.create,Pa=dt.create,Aa=Ie.create,Ma=ft.create,ja=He.create,Pr=_e.create,Na=ke.create,Da=Pe.create,$a=_e.createWithPreprocess,La=mt.create;var c=Object.freeze({__proto__:null,defaultErrorMap:Ve,setErrorMap:zn,getErrorMap:Tt,makeIssue:Ct,EMPTY_PATH:qn,addIssueToContext:b,ParseStatus:se,INVALID:S,DIRTY:ze,OK:ce,isAborted:Kt,isDirty:Jt,isValid:et,isAsync:tt,get util(){return A},get objectUtil(){return Yt},ZodParsedType:E,getParsedType:xe,ZodType:P,datetimeRegex:Cr,ZodString:ve,ZodNumber:Re,ZodBigInt:Oe,ZodBoolean:at,ZodDate:De,ZodSymbol:xt,ZodUndefined:st,ZodNull:ot,ZodAny:qe,ZodUnknown:$e,ZodNever:Ce,ZodVoid:Rt,ZodArray:ge,ZodObject:W,ZodUnion:it,ZodDiscriminatedUnion:Ot,ZodIntersection:ct,ZodTuple:we,ZodRecord:ut,ZodMap:It,ZodSet:Le,ZodFunction:Be,ZodLazy:lt,ZodLiteral:dt,ZodEnum:Ie,ZodNativeEnum:ft,ZodPromise:He,ZodEffects:_e,ZodTransformer:_e,ZodOptional:ke,ZodNullable:Pe,ZodDefault:ht,ZodCatch:pt,ZodNaN:Pt,BRAND:oa,ZodBranded:Xt,ZodPipeline:mt,ZodReadonly:yt,custom:xr,Schema:P,ZodSchema:P,late:ia,get ZodFirstPartyTypeKind(){return T},coerce:{string:r=>ve.create({...r,coerce:!0}),number:r=>Re.create({...r,coerce:!0}),boolean:r=>at.create({...r,coerce:!0}),bigint:r=>Oe.create({...r,coerce:!0}),date:r=>De.create({...r,coerce:!0})},any:ma,array:_a,bigint:la,boolean:Ir,date:da,discriminatedUnion:ka,effect:Pr,enum:Aa,function:Oa,instanceof:ca,intersection:Ta,lazy:Ia,literal:Pa,map:xa,nan:ua,nativeEnum:Ma,never:va,null:pa,nullable:Da,number:Or,object:ba,oboolean:()=>Ir().optional(),onumber:()=>Or().optional(),optional:Na,ostring:()=>Rr().optional(),pipeline:La,preprocess:$a,promise:ja,record:Sa,set:Ra,strictObject:Ea,string:Rr,symbol:fa,transformer:Pr,tuple:Ca,undefined:ha,union:wa,unknown:ya,void:ga,NEVER:S,ZodIssueCode:y,quotelessJson:Vn,ZodError:fe});const Za=c.object({type:c.string(),loc:c.array(c.string()),msg:c.string(),url:c.string()}),Ua=c.array(Za),Fa=c.object({code:c.string(),message:c.string(),path:c.array(c.string())}),Va=c.array(Fa),za={"failed to fetch":"Connection error: please double check if you are connected to the internet, then try again"},er=r=>{const e=r.toLowerCase().trim();return za[e]??r},qa=r=>{try{return typeof JSON.parse(r)=="object"}catch{return!1}},Wa=r=>r.length===1?er(r[0].msg):`Please fix the following errors:
2
+ ${r.map(t=>`• ${er(t.msg)}`).join(`
3
+ `)}`,Ba=r=>`Encountered the following errors:
4
+ ${r.map(t=>`- ${t.path.join("/")}: ${t.message}`).join(`
5
+ `)}`,Ar=r=>{if(r instanceof Error)if(qa(r.message)){const e=JSON.parse(r.message);return Ua.safeParse(e).success?Wa(e):Va.safeParse(e).success?Ba(e):(console.warn(`Encountered unknown stringified JSON object:
6
+ ${r.message}`),r.message)}else return er(r.message);if(typeof r=="object")try{return JSON.stringify(r)}catch(e){return e+""}else return r+""},he=c.string().trim().min(1,{message:"Cannot be blank"}),de=c.string().trim().optional(),tr=r=>c.nullable(r.optional());var Ye=(r=>(r.FIRST_NAME="firstName",r.LAST_NAME="lastName",r.EMAIL="email",r.ZIP_CODE="zipCode",r.CITY="city",r.STATE="state",r.COUNTRY="country",r.ADDRESS="address",r.PHONE="phone",r.PROMOTION_CODE="promotionCode",r))(Ye||{});const Mr=c.nativeEnum(Ye);var jr=(r=>(r.CARD_NUMBER="cardNumber",r.CARD_EXPIRY="cardExpiry",r.CARD_CVC="cardCvc",r))(jr||{});const Nr=c.nativeEnum(jr),Ha=c.union([Mr,Nr]),Dr=c.object({provider:c.string(),processor_name:tr(c.string()),metadata:tr(c.record(c.string(),c.any()))}),Ya=c.object({id:c.string()});c.object({cardNumber:de,expiry:de,cvc:de}),c.object({backgroundColor:de,color:de,fontFamily:de,fontSize:de,fontWeight:de,margin:de,padding:de});const ee=c.enum(["LAYOUT","LOADED","BLUR","FOCUS","CHANGE","TOKENIZE_STARTED","CHECKOUT_STARTED","PAYMENT_FLOW_STARTED","TOKENIZE_SUCCESS","CHECKOUT_SUCCESS","LOAD_ERROR","VALIDATION_ERROR","TOKENIZE_ERROR","CHECKOUT_ERROR","SETUP_PAYMENT_METHOD_SUCCESS","TOKENIZE","CHECKOUT","START_PAYMENT_FLOW"]),Ka=ee.extract(["TOKENIZE_STARTED","CHECKOUT_STARTED"]),Ja=c.object({type:Ka}),Ga=ee.extract(["BLUR","FOCUS","CHANGE"]),Qa=c.object({type:Ga,elementType:Nr}),Xa=ee.extract(["LOAD_ERROR","TOKENIZE_ERROR","CHECKOUT_ERROR"]),es=c.object({type:Xa,message:he}),ts=ee.extract(["VALIDATION_ERROR"]),rs=c.object({type:ts,elementType:Ha,errors:c.array(c.string())}),ns=c.object({type:c.literal(ee.enum.LAYOUT),height:he}),as=c.object({type:c.literal(ee.enum.LOADED),sessionId:he,totalAmountAtoms:c.number(),currency:de,checkoutPaymentMethods:c.array(Dr)}),ss=c.object({type:c.literal(ee.enum.PAYMENT_FLOW_STARTED),nextActionMetadata:c.record(c.string(),c.any()),paymentFlowMetadata:c.any().optional(),startPFMetadata:c.optional(c.record(c.string(),c.any()))}),os=c.object({type:c.literal(ee.enum.SETUP_PAYMENT_METHOD_SUCCESS),paymentMethodId:c.string()}),is=c.object({firstName:he,lastName:he,email:he,zipCode:he,country:he,promotionCode:de}),cs=ee.extract(["TOKENIZE","CHECKOUT","START_PAYMENT_FLOW"]),$r=c.object({type:cs,sessionId:he,checkoutPaymentMethod:Dr,paymentFlowMetadata:c.any().optional(),doNotUseLegacyCCFlow:c.boolean().optional(),existingCCPMId:de}).extend(is.shape),us=c.object({type:c.literal(ee.enum.TOKENIZE_SUCCESS),isReadyForCheckout:c.boolean()}),ls=c.object({type:c.literal(ee.enum.CHECKOUT_SUCCESS),invoiceUrls:c.array(c.string()),subscriptionIds:c.array(c.string()),customerId:c.string()}),ds=c.discriminatedUnion("type",[Ja,Qa,es,rs,ns,as,$r,us,ls,ss,os]),fs=c.object({payload:ds,nonce:he,formId:he,elementId:he});c.object({amountAtom:c.number(),currency:he}),c.object({secure_token:c.string(),promotion_code:c.string().optional()}),c.object({secure_token:c.string(),existing_cc_pm_id:tr(c.string())});const hs=c.object({payment_methods:c.array(Ya)}),ps=r=>{const e={};return Object.entries(r).forEach(([t,n])=>{try{const s=Mr.parse(t);Array.isArray(n)?e[s]=n:Array.isArray(n._errors)&&(e[s]=n._errors)}catch{return}}),e},ms={usd:"usd",brl:"brl"},rr=async r=>{for(let t=0;t<10;t++)Zr()||await ys(500);if(!Zr())throw console.log("Stripe JS not found."),new Error("Stripe JS not found.");return new Stripe(r)},Lr=async(r,e,t,n)=>{const s=await rr(r),o=ms[t.toLowerCase().trim()];return s.paymentRequest({country:"US",currency:o,total:{label:"Total",amount:e,pending:n},requestPayerName:!0,requestPayerEmail:!0})},ys=r=>new Promise(e=>{setTimeout(e,r)}),Zr=()=>"Stripe"in window,vs=async r=>new Promise((e,t)=>{try{r.on("paymentmethod",async n=>{e(n)}),r.on("cancel",()=>{t(new Error("Payment cancelled, please click Submit again to pay"))})}catch(n){t(n)}}),gs=r=>{const e=r==null?void 0:r.stripe_pk;if(typeof e!="string")throw new Error("Invalid: stripe_pk not passed in checkout payment method");return e},_s=async(r,e)=>{const t=r.nextActionMetadata;if(!r.paymentFlowMetadata||!r.paymentFlowMetadata.stripePmId)throw new Error(`Invalid payment flow metadata format: ${JSON.stringify(r.paymentFlowMetadata)}`);if(!t.stripe_pk||!t.client_secret)throw new Error(`Invalid next action metadata format: ${JSON.stringify(t)}`);if(e.paymentMethod.id!==r.paymentFlowMetadata.stripePmId)throw new Error(`PM ID mismatch: ${e.paymentMethod.id} != ${r.paymentFlowMetadata.stripePmId}`);const s=await(await rr(t.stripe_pk)).confirmCardSetup(t.client_secret,{payment_method:r.paymentFlowMetadata.stripePmId});if(s.error)throw e.complete("fail"),new Error(`Payment failed: ${s.error.message??"unknown"}`);e.complete("success")},bs=async r=>{var o,u,l,p;const e=r.nextActionMetadata,n=await(await rr(e.stripe_pk)).confirmCardSetup(e.client_secret,{payment_method:e.stripe_pm_id}),s=(o=n.setupIntent)==null?void 0:o.status;if(s==="succeeded")console.log("[3DS] CONFIRMING PM:",e.stripe_pm_id),console.log("[3DS] Setup intent created:",n.setupIntent);else throw s==="canceled"?new Error("Payment cancelled, please click Submit again to pay"):new Error(`${((u=n.error)==null?void 0:u.message)??((p=(l=n.setupIntent)==null?void 0:l.last_setup_error)==null?void 0:p.message)??"Payment failed, please click submit again to pay."}`)},Es=r=>JSON.stringify(r);for(var re=[],nr=0;nr<256;++nr)re.push((nr+256).toString(16).slice(1));function ws(r,e=0){return(re[r[e+0]]+re[r[e+1]]+re[r[e+2]]+re[r[e+3]]+"-"+re[r[e+4]]+re[r[e+5]]+"-"+re[r[e+6]]+re[r[e+7]]+"-"+re[r[e+8]]+re[r[e+9]]+"-"+re[r[e+10]]+re[r[e+11]]+re[r[e+12]]+re[r[e+13]]+re[r[e+14]]+re[r[e+15]]).toLowerCase()}var At,ks=new Uint8Array(16);function Ts(){if(!At&&(At=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!At))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return At(ks)}var Cs=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const Ur={randomUUID:Cs};function Ss(r,e,t){if(Ur.randomUUID&&!e&&!r)return Ur.randomUUID();r=r||{};var n=r.random||(r.rng||Ts)();return n[6]=n[6]&15|64,n[8]=n[8]&63|128,ws(n)}const Fr=(r,e)=>Array.from(r.querySelectorAll("input[data-opid]")??[]).reduce((s,o)=>{const u=o.getAttribute("data-opid");return u?{...s,[u]:o.value}:s},e),Mt=(r,e,t,n,s,o,u)=>{const l=Fr(t,{type:r,sessionId:e,checkoutPaymentMethod:s,paymentFlowMetadata:u,doNotUseLegacyCCFlow:o});console.log(`[form] Constructing ${r} payload:`,JSON.stringify(l)),(s.provider==="apple_pay"||s.provider==="google_pay")&&(l[Ye.ZIP_CODE]||(console.log("[form] Overriding empty zip code (only for google and apple pay)"),l[Ye.ZIP_CODE]="00000"));const p=$r.safeParse(l);if(p.success)return console.log("[form] Constructed payload:",JSON.stringify(p.data)),p.data;{const m=p.error.format(),_=ps(m);for(const[O,V]of Object.entries(_))n(O,V,O);return console.log("[form] Constructed payload in FAIL:",p.data),null}},xs=r=>{try{return fs.parse(r)}catch(e){throw console.error("Error parsing event payload:",r,e),e}},Vr=(r,e,t,n,s)=>{const o={payload:n,nonce:Ss(),formId:e,elementId:t};console.log(`[form ${e}] Sending event to child ${t}:`,o),r.postMessage(JSON.stringify(o),s)};var Te;(function(r){r.Call="call",r.Reply="reply",r.Syn="syn",r.SynAck="synAck",r.Ack="ack"})(Te||(Te={}));var Ze;(function(r){r.Fulfilled="fulfilled",r.Rejected="rejected"})(Ze||(Ze={}));var vt;(function(r){r.ConnectionDestroyed="ConnectionDestroyed",r.ConnectionTimeout="ConnectionTimeout",r.NoIframeSrc="NoIframeSrc"})(vt||(vt={}));var ar;(function(r){r.DataCloneError="DataCloneError"})(ar||(ar={}));var Ae;(function(r){r.Message="message"})(Ae||(Ae={}));const Rs=(r,e)=>{const t=[];let n=!1;return{destroy(s){n||(n=!0,e(`${r}: Destroying connection`),t.forEach(o=>{o(s)}))},onDestroy(s){n?s():t.push(s)}}},Os=r=>(...e)=>{r&&console.log("[Penpal]",...e)},Is={"http:":"80","https:":"443"},Ps=/^(https?:)?\/\/([^/:]+)?(:(\d+))?/,As=["file:","data:"],Ms=r=>{if(r&&As.find(l=>r.startsWith(l)))return"null";const e=document.location,t=Ps.exec(r);let n,s,o;t?(n=t[1]?t[1]:e.protocol,s=t[2],o=t[4]):(n=e.protocol,s=e.hostname,o=e.port);const u=o&&o!==Is[n]?`:${o}`:"";return`${n}//${s}${u}`},zr=({name:r,message:e,stack:t})=>({name:r,message:e,stack:t}),js=r=>{const e=new Error;return Object.keys(r).forEach(t=>e[t]=r[t]),e},Ns=(r,e,t)=>{const{localName:n,local:s,remote:o,originForSending:u,originForReceiving:l}=r;let p=!1;const m=_=>{if(_.source!==o||_.data.penpal!==Te.Call)return;if(l!=="*"&&_.origin!==l){t(`${n} received message from origin ${_.origin} which did not match expected origin ${l}`);return}const O=_.data,{methodName:V,args:$,id:te}=O;t(`${n}: Received ${V}() call`);const pe=J=>me=>{if(t(`${n}: Sending ${V}() reply`),p){t(`${n}: Unable to send ${V}() reply due to destroyed connection`);return}const oe={penpal:Te.Reply,id:te,resolution:J,returnValue:me};J===Ze.Rejected&&me instanceof Error&&(oe.returnValue=zr(me),oe.returnValueIsError=!0);try{o.postMessage(oe,u)}catch(B){if(B.name===ar.DataCloneError){const ie={penpal:Te.Reply,id:te,resolution:Ze.Rejected,returnValue:zr(B),returnValueIsError:!0};o.postMessage(ie,u)}throw B}};new Promise(J=>J(e[V].apply(e,$))).then(pe(Ze.Fulfilled),pe(Ze.Rejected))};return s.addEventListener(Ae.Message,m),()=>{p=!0,s.removeEventListener(Ae.Message,m)}};let Ds=0;const $s=()=>++Ds,qr=".",Wr=r=>r?r.split(qr):[],Ls=r=>r.join(qr),Zs=(r,e)=>{const t=Wr(e||"");return t.push(r),Ls(t)},Us=(r,e,t)=>{const n=Wr(e);return n.reduce((s,o,u)=>(typeof s[o]>"u"&&(s[o]={}),u===n.length-1&&(s[o]=t),s[o]),r),r},Br=(r,e)=>{const t={};return Object.keys(r).forEach(n=>{const s=r[n],o=Zs(n,e);typeof s=="object"&&Object.assign(t,Br(s,o)),typeof s=="function"&&(t[o]=s)}),t},Fs=r=>{const e={};for(const t in r)Us(e,t,r[t]);return e},Vs=(r,e,t,n,s)=>{const{localName:o,local:u,remote:l,originForSending:p,originForReceiving:m}=e;let _=!1;s(`${o}: Connecting call sender`);const O=$=>(...te)=>{s(`${o}: Sending ${$}() call`);let pe;try{l.closed&&(pe=!0)}catch{pe=!0}if(pe&&n(),_){const J=new Error(`Unable to send ${$}() call due to destroyed connection`);throw J.code=vt.ConnectionDestroyed,J}return new Promise((J,me)=>{const oe=$s(),B=U=>{if(U.source!==l||U.data.penpal!==Te.Reply||U.data.id!==oe)return;if(m!=="*"&&U.origin!==m){s(`${o} received message from origin ${U.origin} which did not match expected origin ${m}`);return}const ne=U.data;s(`${o}: Received ${$}() reply`),u.removeEventListener(Ae.Message,B);let ye=ne.returnValue;ne.returnValueIsError&&(ye=js(ye)),(ne.resolution===Ze.Fulfilled?J:me)(ye)};u.addEventListener(Ae.Message,B);const ie={penpal:Te.Call,id:oe,methodName:$,args:te};l.postMessage(ie,p)})},V=t.reduce(($,te)=>($[te]=O(te),$),{});return Object.assign(r,Fs(V)),()=>{_=!0}},zs=(r,e,t,n,s)=>{const{destroy:o,onDestroy:u}=n;let l,p;const m={};return _=>{if(e!=="*"&&_.origin!==e){s(`Parent: Handshake - Received ACK message from origin ${_.origin} which did not match expected origin ${e}`);return}s("Parent: Handshake - Received ACK");const O={localName:"Parent",local:window,remote:_.source,originForSending:t,originForReceiving:e};l&&l(),l=Ns(O,r,s),u(l),p&&p.forEach($=>{delete m[$]}),p=_.data.methodNames;const V=Vs(m,O,p,o,s);return u(V),m}},qs=(r,e,t,n)=>s=>{if(!s.source)return;if(t!=="*"&&s.origin!==t){r(`Parent: Handshake - Received SYN message from origin ${s.origin} which did not match expected origin ${t}`);return}r("Parent: Handshake - Received SYN, responding with SYN-ACK");const o={penpal:Te.SynAck,methodNames:Object.keys(e)};s.source.postMessage(o,n)},Ws=6e4,Bs=(r,e)=>{const{destroy:t,onDestroy:n}=e,s=setInterval(()=>{r.isConnected||(clearInterval(s),t())},Ws);n(()=>{clearInterval(s)})},Hs=(r,e)=>{let t;return r!==void 0&&(t=window.setTimeout(()=>{const n=new Error(`Connection timed out after ${r}ms`);n.code=vt.ConnectionTimeout,e(n)},r)),()=>{clearTimeout(t)}},Ys=r=>{if(!r.src&&!r.srcdoc){const e=new Error("Iframe must have src or srcdoc property defined.");throw e.code=vt.NoIframeSrc,e}},Ks=r=>{let{iframe:e,methods:t={},childOrigin:n,timeout:s,debug:o=!1}=r;const u=Os(o),l=Rs("Parent",u),{onDestroy:p,destroy:m}=l;n||(Ys(e),n=Ms(e.src));const _=n==="null"?"*":n,O=Br(t),V=qs(u,O,n,_),$=zs(O,n,_,l,u);return{promise:new Promise((pe,J)=>{const me=Hs(s,m),oe=B=>{if(!(B.source!==e.contentWindow||!B.data)){if(B.data.penpal===Te.Syn){V(B);return}if(B.data.penpal===Te.Ack){const ie=$(B);ie&&(me(),pe(ie));return}}};window.addEventListener(Ae.Message,oe),u("Parent: Awaiting handshake"),Bs(e,l),p(B=>{window.removeEventListener(Ae.Message,oe),B&&J(B)})}),destroy(){m()}}};var sr={exports:{}},M={};/**
7
+ * @license React
8
+ * react.production.min.js
9
+ *
10
+ * Copyright (c) Facebook, Inc. and its affiliates.
11
+ *
12
+ * This source code is licensed under the MIT license found in the
13
+ * LICENSE file in the root directory of this source tree.
14
+ */var Hr;function Js(){if(Hr)return M;Hr=1;var r=Symbol.for("react.element"),e=Symbol.for("react.portal"),t=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),u=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),_=Symbol.for("react.lazy"),O=Symbol.iterator;function V(d){return d===null||typeof d!="object"?null:(d=O&&d[O]||d["@@iterator"],typeof d=="function"?d:null)}var $={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},te=Object.assign,pe={};function J(d,v,j){this.props=d,this.context=v,this.refs=pe,this.updater=j||$}J.prototype.isReactComponent={},J.prototype.setState=function(d,v){if(typeof d!="object"&&typeof d!="function"&&d!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,d,v,"setState")},J.prototype.forceUpdate=function(d){this.updater.enqueueForceUpdate(this,d,"forceUpdate")};function me(){}me.prototype=J.prototype;function oe(d,v,j){this.props=d,this.context=v,this.refs=pe,this.updater=j||$}var B=oe.prototype=new me;B.constructor=oe,te(B,J.prototype),B.isPureReactComponent=!0;var ie=Array.isArray,U=Object.prototype.hasOwnProperty,ne={current:null},ye={key:!0,ref:!0,__self:!0,__source:!0};function Ue(d,v,j){var D,L={},G=null,H=null;if(v!=null)for(D in v.ref!==void 0&&(H=v.ref),v.key!==void 0&&(G=""+v.key),v)U.call(v,D)&&!ye.hasOwnProperty(D)&&(L[D]=v[D]);var Y=arguments.length-2;if(Y===1)L.children=j;else if(1<Y){for(var F=Array(Y),ue=0;ue<Y;ue++)F[ue]=arguments[ue+2];L.children=F}if(d&&d.defaultProps)for(D in Y=d.defaultProps,Y)L[D]===void 0&&(L[D]=Y[D]);return{$$typeof:r,type:d,key:G,ref:H,props:L,_owner:ne.current}}function jt(d,v){return{$$typeof:r,type:d.type,key:v,ref:d.ref,props:d.props,_owner:d._owner}}function _t(d){return typeof d=="object"&&d!==null&&d.$$typeof===r}function ir(d){var v={"=":"=0",":":"=2"};return"$"+d.replace(/[=:]/g,function(j){return v[j]})}var Nt=/\/+/g;function bt(d,v){return typeof d=="object"&&d!==null&&d.key!=null?ir(""+d.key):v.toString(36)}function Ke(d,v,j,D,L){var G=typeof d;(G==="undefined"||G==="boolean")&&(d=null);var H=!1;if(d===null)H=!0;else switch(G){case"string":case"number":H=!0;break;case"object":switch(d.$$typeof){case r:case e:H=!0}}if(H)return H=d,L=L(H),d=D===""?"."+bt(H,0):D,ie(L)?(j="",d!=null&&(j=d.replace(Nt,"$&/")+"/"),Ke(L,v,j,"",function(ue){return ue})):L!=null&&(_t(L)&&(L=jt(L,j+(!L.key||H&&H.key===L.key?"":(""+L.key).replace(Nt,"$&/")+"/")+d)),v.push(L)),1;if(H=0,D=D===""?".":D+":",ie(d))for(var Y=0;Y<d.length;Y++){G=d[Y];var F=D+bt(G,Y);H+=Ke(G,v,j,F,L)}else if(F=V(d),typeof F=="function")for(d=F.call(d),Y=0;!(G=d.next()).done;)G=G.value,F=D+bt(G,Y++),H+=Ke(G,v,j,F,L);else if(G==="object")throw v=String(d),Error("Objects are not valid as a React child (found: "+(v==="[object Object]"?"object with keys {"+Object.keys(d).join(", ")+"}":v)+"). If you meant to render a collection of children, use an array instead.");return H}function be(d,v,j){if(d==null)return d;var D=[],L=0;return Ke(d,D,"","",function(G){return v.call(j,G,L++)}),D}function Me(d){if(d._status===-1){var v=d._result;v=v(),v.then(function(j){(d._status===0||d._status===-1)&&(d._status=1,d._result=j)},function(j){(d._status===0||d._status===-1)&&(d._status=2,d._result=j)}),d._status===-1&&(d._status=0,d._result=v)}if(d._status===1)return d._result.default;throw d._result}var x={current:null},Fe={transition:null},Dt={ReactCurrentDispatcher:x,ReactCurrentBatchConfig:Fe,ReactCurrentOwner:ne};function Je(){throw Error("act(...) is not supported in production builds of React.")}return M.Children={map:be,forEach:function(d,v,j){be(d,function(){v.apply(this,arguments)},j)},count:function(d){var v=0;return be(d,function(){v++}),v},toArray:function(d){return be(d,function(v){return v})||[]},only:function(d){if(!_t(d))throw Error("React.Children.only expected to receive a single React element child.");return d}},M.Component=J,M.Fragment=t,M.Profiler=s,M.PureComponent=oe,M.StrictMode=n,M.Suspense=p,M.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Dt,M.act=Je,M.cloneElement=function(d,v,j){if(d==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+d+".");var D=te({},d.props),L=d.key,G=d.ref,H=d._owner;if(v!=null){if(v.ref!==void 0&&(G=v.ref,H=ne.current),v.key!==void 0&&(L=""+v.key),d.type&&d.type.defaultProps)var Y=d.type.defaultProps;for(F in v)U.call(v,F)&&!ye.hasOwnProperty(F)&&(D[F]=v[F]===void 0&&Y!==void 0?Y[F]:v[F])}var F=arguments.length-2;if(F===1)D.children=j;else if(1<F){Y=Array(F);for(var ue=0;ue<F;ue++)Y[ue]=arguments[ue+2];D.children=Y}return{$$typeof:r,type:d.type,key:L,ref:G,props:D,_owner:H}},M.createContext=function(d){return d={$$typeof:u,_currentValue:d,_currentValue2:d,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},d.Provider={$$typeof:o,_context:d},d.Consumer=d},M.createElement=Ue,M.createFactory=function(d){var v=Ue.bind(null,d);return v.type=d,v},M.createRef=function(){return{current:null}},M.forwardRef=function(d){return{$$typeof:l,render:d}},M.isValidElement=_t,M.lazy=function(d){return{$$typeof:_,_payload:{_status:-1,_result:d},_init:Me}},M.memo=function(d,v){return{$$typeof:m,type:d,compare:v===void 0?null:v}},M.startTransition=function(d){var v=Fe.transition;Fe.transition={};try{d()}finally{Fe.transition=v}},M.unstable_act=Je,M.useCallback=function(d,v){return x.current.useCallback(d,v)},M.useContext=function(d){return x.current.useContext(d)},M.useDebugValue=function(){},M.useDeferredValue=function(d){return x.current.useDeferredValue(d)},M.useEffect=function(d,v){return x.current.useEffect(d,v)},M.useId=function(){return x.current.useId()},M.useImperativeHandle=function(d,v,j){return x.current.useImperativeHandle(d,v,j)},M.useInsertionEffect=function(d,v){return x.current.useInsertionEffect(d,v)},M.useLayoutEffect=function(d,v){return x.current.useLayoutEffect(d,v)},M.useMemo=function(d,v){return x.current.useMemo(d,v)},M.useReducer=function(d,v,j){return x.current.useReducer(d,v,j)},M.useRef=function(d){return x.current.useRef(d)},M.useState=function(d){return x.current.useState(d)},M.useSyncExternalStore=function(d,v,j){return x.current.useSyncExternalStore(d,v,j)},M.useTransition=function(){return x.current.useTransition()},M.version="18.3.1",M}var gt={exports:{}};/**
15
+ * @license React
16
+ * react.development.js
17
+ *
18
+ * Copyright (c) Facebook, Inc. and its affiliates.
19
+ *
20
+ * This source code is licensed under the MIT license found in the
21
+ * LICENSE file in the root directory of this source tree.
22
+ */gt.exports;var Yr;function Gs(){return Yr||(Yr=1,function(r,e){process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var t="18.3.1",n=Symbol.for("react.element"),s=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),u=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),p=Symbol.for("react.provider"),m=Symbol.for("react.context"),_=Symbol.for("react.forward_ref"),O=Symbol.for("react.suspense"),V=Symbol.for("react.suspense_list"),$=Symbol.for("react.memo"),te=Symbol.for("react.lazy"),pe=Symbol.for("react.offscreen"),J=Symbol.iterator,me="@@iterator";function oe(a){if(a===null||typeof a!="object")return null;var i=J&&a[J]||a[me];return typeof i=="function"?i:null}var B={current:null},ie={transition:null},U={current:null,isBatchingLegacy:!1,didScheduleLegacyUpdate:!1},ne={current:null},ye={},Ue=null;function jt(a){Ue=a}ye.setExtraStackFrame=function(a){Ue=a},ye.getCurrentStack=null,ye.getStackAddendum=function(){var a="";Ue&&(a+=Ue);var i=ye.getCurrentStack;return i&&(a+=i()||""),a};var _t=!1,ir=!1,Nt=!1,bt=!1,Ke=!1,be={ReactCurrentDispatcher:B,ReactCurrentBatchConfig:ie,ReactCurrentOwner:ne};be.ReactDebugCurrentFrame=ye,be.ReactCurrentActQueue=U;function Me(a){{for(var i=arguments.length,f=new Array(i>1?i-1:0),h=1;h<i;h++)f[h-1]=arguments[h];Fe("warn",a,f)}}function x(a){{for(var i=arguments.length,f=new Array(i>1?i-1:0),h=1;h<i;h++)f[h-1]=arguments[h];Fe("error",a,f)}}function Fe(a,i,f){{var h=be.ReactDebugCurrentFrame,g=h.getStackAddendum();g!==""&&(i+="%s",f=f.concat([g]));var C=f.map(function(w){return String(w)});C.unshift("Warning: "+i),Function.prototype.apply.call(console[a],console,C)}}var Dt={};function Je(a,i){{var f=a.constructor,h=f&&(f.displayName||f.name)||"ReactClass",g=h+"."+i;if(Dt[g])return;x("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",i,h),Dt[g]=!0}}var d={isMounted:function(a){return!1},enqueueForceUpdate:function(a,i,f){Je(a,"forceUpdate")},enqueueReplaceState:function(a,i,f,h){Je(a,"replaceState")},enqueueSetState:function(a,i,f,h){Je(a,"setState")}},v=Object.assign,j={};Object.freeze(j);function D(a,i,f){this.props=a,this.context=i,this.refs=j,this.updater=f||d}D.prototype.isReactComponent={},D.prototype.setState=function(a,i){if(typeof a!="object"&&typeof a!="function"&&a!=null)throw new Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,a,i,"setState")},D.prototype.forceUpdate=function(a){this.updater.enqueueForceUpdate(this,a,"forceUpdate")};{var L={isMounted:["isMounted","Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."],replaceState:["replaceState","Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."]},G=function(a,i){Object.defineProperty(D.prototype,a,{get:function(){Me("%s(...) is deprecated in plain JavaScript React classes. %s",i[0],i[1])}})};for(var H in L)L.hasOwnProperty(H)&&G(H,L[H])}function Y(){}Y.prototype=D.prototype;function F(a,i,f){this.props=a,this.context=i,this.refs=j,this.updater=f||d}var ue=F.prototype=new Y;ue.constructor=F,v(ue,D.prototype),ue.isPureReactComponent=!0;function Io(){var a={current:null};return Object.seal(a),a}var Po=Array.isArray;function $t(a){return Po(a)}function Ao(a){{var i=typeof Symbol=="function"&&Symbol.toStringTag,f=i&&a[Symbol.toStringTag]||a.constructor.name||"Object";return f}}function Mo(a){try{return an(a),!1}catch{return!0}}function an(a){return""+a}function Lt(a){if(Mo(a))return x("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ao(a)),an(a)}function jo(a,i,f){var h=a.displayName;if(h)return h;var g=i.displayName||i.name||"";return g!==""?f+"("+g+")":f}function sn(a){return a.displayName||"Context"}function je(a){if(a==null)return null;if(typeof a.tag=="number"&&x("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof a=="function")return a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case o:return"Fragment";case s:return"Portal";case l:return"Profiler";case u:return"StrictMode";case O:return"Suspense";case V:return"SuspenseList"}if(typeof a=="object")switch(a.$$typeof){case m:var i=a;return sn(i)+".Consumer";case p:var f=a;return sn(f._context)+".Provider";case _:return jo(a,a.render,"ForwardRef");case $:var h=a.displayName||null;return h!==null?h:je(a.type)||"Memo";case te:{var g=a,C=g._payload,w=g._init;try{return je(w(C))}catch{return null}}}return null}var Et=Object.prototype.hasOwnProperty,on={key:!0,ref:!0,__self:!0,__source:!0},cn,un,cr;cr={};function ln(a){if(Et.call(a,"ref")){var i=Object.getOwnPropertyDescriptor(a,"ref").get;if(i&&i.isReactWarning)return!1}return a.ref!==void 0}function dn(a){if(Et.call(a,"key")){var i=Object.getOwnPropertyDescriptor(a,"key").get;if(i&&i.isReactWarning)return!1}return a.key!==void 0}function No(a,i){var f=function(){cn||(cn=!0,x("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",i))};f.isReactWarning=!0,Object.defineProperty(a,"key",{get:f,configurable:!0})}function Do(a,i){var f=function(){un||(un=!0,x("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",i))};f.isReactWarning=!0,Object.defineProperty(a,"ref",{get:f,configurable:!0})}function $o(a){if(typeof a.ref=="string"&&ne.current&&a.__self&&ne.current.stateNode!==a.__self){var i=je(ne.current.type);cr[i]||(x('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',i,a.ref),cr[i]=!0)}}var ur=function(a,i,f,h,g,C,w){var R={$$typeof:n,type:a,key:i,ref:f,props:w,_owner:C};return R._store={},Object.defineProperty(R._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(R,"_self",{configurable:!1,enumerable:!1,writable:!1,value:h}),Object.defineProperty(R,"_source",{configurable:!1,enumerable:!1,writable:!1,value:g}),Object.freeze&&(Object.freeze(R.props),Object.freeze(R)),R};function Lo(a,i,f){var h,g={},C=null,w=null,R=null,N=null;if(i!=null){ln(i)&&(w=i.ref,$o(i)),dn(i)&&(Lt(i.key),C=""+i.key),R=i.__self===void 0?null:i.__self,N=i.__source===void 0?null:i.__source;for(h in i)Et.call(i,h)&&!on.hasOwnProperty(h)&&(g[h]=i[h])}var Z=arguments.length-2;if(Z===1)g.children=f;else if(Z>1){for(var z=Array(Z),q=0;q<Z;q++)z[q]=arguments[q+2];Object.freeze&&Object.freeze(z),g.children=z}if(a&&a.defaultProps){var K=a.defaultProps;for(h in K)g[h]===void 0&&(g[h]=K[h])}if(C||w){var Q=typeof a=="function"?a.displayName||a.name||"Unknown":a;C&&No(g,Q),w&&Do(g,Q)}return ur(a,C,w,R,N,ne.current,g)}function Zo(a,i){var f=ur(a.type,i,a.ref,a._self,a._source,a._owner,a.props);return f}function Uo(a,i,f){if(a==null)throw new Error("React.cloneElement(...): The argument must be a React element, but you passed "+a+".");var h,g=v({},a.props),C=a.key,w=a.ref,R=a._self,N=a._source,Z=a._owner;if(i!=null){ln(i)&&(w=i.ref,Z=ne.current),dn(i)&&(Lt(i.key),C=""+i.key);var z;a.type&&a.type.defaultProps&&(z=a.type.defaultProps);for(h in i)Et.call(i,h)&&!on.hasOwnProperty(h)&&(i[h]===void 0&&z!==void 0?g[h]=z[h]:g[h]=i[h])}var q=arguments.length-2;if(q===1)g.children=f;else if(q>1){for(var K=Array(q),Q=0;Q<q;Q++)K[Q]=arguments[Q+2];g.children=K}return ur(a.type,C,w,R,N,Z,g)}function Ge(a){return typeof a=="object"&&a!==null&&a.$$typeof===n}var fn=".",Fo=":";function Vo(a){var i=/[=:]/g,f={"=":"=0",":":"=2"},h=a.replace(i,function(g){return f[g]});return"$"+h}var hn=!1,zo=/\/+/g;function pn(a){return a.replace(zo,"$&/")}function lr(a,i){return typeof a=="object"&&a!==null&&a.key!=null?(Lt(a.key),Vo(""+a.key)):i.toString(36)}function Zt(a,i,f,h,g){var C=typeof a;(C==="undefined"||C==="boolean")&&(a=null);var w=!1;if(a===null)w=!0;else switch(C){case"string":case"number":w=!0;break;case"object":switch(a.$$typeof){case n:case s:w=!0}}if(w){var R=a,N=g(R),Z=h===""?fn+lr(R,0):h;if($t(N)){var z="";Z!=null&&(z=pn(Z)+"/"),Zt(N,i,z,"",function(Ni){return Ni})}else N!=null&&(Ge(N)&&(N.key&&(!R||R.key!==N.key)&&Lt(N.key),N=Zo(N,f+(N.key&&(!R||R.key!==N.key)?pn(""+N.key)+"/":"")+Z)),i.push(N));return 1}var q,K,Q=0,ae=h===""?fn:h+Fo;if($t(a))for(var Ht=0;Ht<a.length;Ht++)q=a[Ht],K=ae+lr(q,Ht),Q+=Zt(q,i,f,K,g);else{var _r=oe(a);if(typeof _r=="function"){var Zn=a;_r===Zn.entries&&(hn||Me("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),hn=!0);for(var Mi=_r.call(Zn),Un,ji=0;!(Un=Mi.next()).done;)q=Un.value,K=ae+lr(q,ji++),Q+=Zt(q,i,f,K,g)}else if(C==="object"){var Fn=String(a);throw new Error("Objects are not valid as a React child (found: "+(Fn==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":Fn)+"). If you meant to render a collection of children, use an array instead.")}}return Q}function Ut(a,i,f){if(a==null)return a;var h=[],g=0;return Zt(a,h,"","",function(C){return i.call(f,C,g++)}),h}function qo(a){var i=0;return Ut(a,function(){i++}),i}function Wo(a,i,f){Ut(a,function(){i.apply(this,arguments)},f)}function Bo(a){return Ut(a,function(i){return i})||[]}function Ho(a){if(!Ge(a))throw new Error("React.Children.only expected to receive a single React element child.");return a}function Yo(a){var i={$$typeof:m,_currentValue:a,_currentValue2:a,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null};i.Provider={$$typeof:p,_context:i};var f=!1,h=!1,g=!1;{var C={$$typeof:m,_context:i};Object.defineProperties(C,{Provider:{get:function(){return h||(h=!0,x("Rendering <Context.Consumer.Provider> is not supported and will be removed in a future major release. Did you mean to render <Context.Provider> instead?")),i.Provider},set:function(w){i.Provider=w}},_currentValue:{get:function(){return i._currentValue},set:function(w){i._currentValue=w}},_currentValue2:{get:function(){return i._currentValue2},set:function(w){i._currentValue2=w}},_threadCount:{get:function(){return i._threadCount},set:function(w){i._threadCount=w}},Consumer:{get:function(){return f||(f=!0,x("Rendering <Context.Consumer.Consumer> is not supported and will be removed in a future major release. Did you mean to render <Context.Consumer> instead?")),i.Consumer}},displayName:{get:function(){return i.displayName},set:function(w){g||(Me("Setting `displayName` on Context.Consumer has no effect. You should set it directly on the context with Context.displayName = '%s'.",w),g=!0)}}}),i.Consumer=C}return i._currentRenderer=null,i._currentRenderer2=null,i}var wt=-1,dr=0,mn=1,Ko=2;function Jo(a){if(a._status===wt){var i=a._result,f=i();if(f.then(function(C){if(a._status===dr||a._status===wt){var w=a;w._status=mn,w._result=C}},function(C){if(a._status===dr||a._status===wt){var w=a;w._status=Ko,w._result=C}}),a._status===wt){var h=a;h._status=dr,h._result=f}}if(a._status===mn){var g=a._result;return g===void 0&&x(`lazy: Expected the result of a dynamic import() call. Instead received: %s
23
+
24
+ Your code should look like:
25
+ const MyComponent = lazy(() => import('./MyComponent'))
26
+
27
+ Did you accidentally put curly braces around the import?`,g),"default"in g||x(`lazy: Expected the result of a dynamic import() call. Instead received: %s
28
+
29
+ Your code should look like:
30
+ const MyComponent = lazy(() => import('./MyComponent'))`,g),g.default}else throw a._result}function Go(a){var i={_status:wt,_result:a},f={$$typeof:te,_payload:i,_init:Jo};{var h,g;Object.defineProperties(f,{defaultProps:{configurable:!0,get:function(){return h},set:function(C){x("React.lazy(...): It is not supported to assign `defaultProps` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it."),h=C,Object.defineProperty(f,"defaultProps",{enumerable:!0})}},propTypes:{configurable:!0,get:function(){return g},set:function(C){x("React.lazy(...): It is not supported to assign `propTypes` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it."),g=C,Object.defineProperty(f,"propTypes",{enumerable:!0})}}})}return f}function Qo(a){a!=null&&a.$$typeof===$?x("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."):typeof a!="function"?x("forwardRef requires a render function but was given %s.",a===null?"null":typeof a):a.length!==0&&a.length!==2&&x("forwardRef render functions accept exactly two parameters: props and ref. %s",a.length===1?"Did you forget to use the ref parameter?":"Any additional parameter will be undefined."),a!=null&&(a.defaultProps!=null||a.propTypes!=null)&&x("forwardRef render functions do not support propTypes or defaultProps. Did you accidentally pass a React component?");var i={$$typeof:_,render:a};{var f;Object.defineProperty(i,"displayName",{enumerable:!1,configurable:!0,get:function(){return f},set:function(h){f=h,!a.name&&!a.displayName&&(a.displayName=h)}})}return i}var yn;yn=Symbol.for("react.module.reference");function vn(a){return!!(typeof a=="string"||typeof a=="function"||a===o||a===l||Ke||a===u||a===O||a===V||bt||a===pe||_t||ir||Nt||typeof a=="object"&&a!==null&&(a.$$typeof===te||a.$$typeof===$||a.$$typeof===p||a.$$typeof===m||a.$$typeof===_||a.$$typeof===yn||a.getModuleId!==void 0))}function Xo(a,i){vn(a)||x("memo: The first argument must be a component. Instead received: %s",a===null?"null":typeof a);var f={$$typeof:$,type:a,compare:i===void 0?null:i};{var h;Object.defineProperty(f,"displayName",{enumerable:!1,configurable:!0,get:function(){return h},set:function(g){h=g,!a.name&&!a.displayName&&(a.displayName=g)}})}return f}function le(){var a=B.current;return a===null&&x(`Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
31
+ 1. You might have mismatching versions of React and the renderer (such as React DOM)
32
+ 2. You might be breaking the Rules of Hooks
33
+ 3. You might have more than one copy of React in the same app
34
+ See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.`),a}function ei(a){var i=le();if(a._context!==void 0){var f=a._context;f.Consumer===a?x("Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be removed in a future major release. Did you mean to call useContext(Context) instead?"):f.Provider===a&&x("Calling useContext(Context.Provider) is not supported. Did you mean to call useContext(Context) instead?")}return i.useContext(a)}function ti(a){var i=le();return i.useState(a)}function ri(a,i,f){var h=le();return h.useReducer(a,i,f)}function ni(a){var i=le();return i.useRef(a)}function ai(a,i){var f=le();return f.useEffect(a,i)}function si(a,i){var f=le();return f.useInsertionEffect(a,i)}function oi(a,i){var f=le();return f.useLayoutEffect(a,i)}function ii(a,i){var f=le();return f.useCallback(a,i)}function ci(a,i){var f=le();return f.useMemo(a,i)}function ui(a,i,f){var h=le();return h.useImperativeHandle(a,i,f)}function li(a,i){{var f=le();return f.useDebugValue(a,i)}}function di(){var a=le();return a.useTransition()}function fi(a){var i=le();return i.useDeferredValue(a)}function hi(){var a=le();return a.useId()}function pi(a,i,f){var h=le();return h.useSyncExternalStore(a,i,f)}var kt=0,gn,_n,bn,En,wn,kn,Tn;function Cn(){}Cn.__reactDisabledLog=!0;function mi(){{if(kt===0){gn=console.log,_n=console.info,bn=console.warn,En=console.error,wn=console.group,kn=console.groupCollapsed,Tn=console.groupEnd;var a={configurable:!0,enumerable:!0,value:Cn,writable:!0};Object.defineProperties(console,{info:a,log:a,warn:a,error:a,group:a,groupCollapsed:a,groupEnd:a})}kt++}}function yi(){{if(kt--,kt===0){var a={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:v({},a,{value:gn}),info:v({},a,{value:_n}),warn:v({},a,{value:bn}),error:v({},a,{value:En}),group:v({},a,{value:wn}),groupCollapsed:v({},a,{value:kn}),groupEnd:v({},a,{value:Tn})})}kt<0&&x("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var fr=be.ReactCurrentDispatcher,hr;function Ft(a,i,f){{if(hr===void 0)try{throw Error()}catch(g){var h=g.stack.trim().match(/\n( *(at )?)/);hr=h&&h[1]||""}return`
35
+ `+hr+a}}var pr=!1,Vt;{var vi=typeof WeakMap=="function"?WeakMap:Map;Vt=new vi}function Sn(a,i){if(!a||pr)return"";{var f=Vt.get(a);if(f!==void 0)return f}var h;pr=!0;var g=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var C;C=fr.current,fr.current=null,mi();try{if(i){var w=function(){throw Error()};if(Object.defineProperty(w.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(w,[])}catch(ae){h=ae}Reflect.construct(a,[],w)}else{try{w.call()}catch(ae){h=ae}a.call(w.prototype)}}else{try{throw Error()}catch(ae){h=ae}a()}}catch(ae){if(ae&&h&&typeof ae.stack=="string"){for(var R=ae.stack.split(`
36
+ `),N=h.stack.split(`
37
+ `),Z=R.length-1,z=N.length-1;Z>=1&&z>=0&&R[Z]!==N[z];)z--;for(;Z>=1&&z>=0;Z--,z--)if(R[Z]!==N[z]){if(Z!==1||z!==1)do if(Z--,z--,z<0||R[Z]!==N[z]){var q=`
38
+ `+R[Z].replace(" at new "," at ");return a.displayName&&q.includes("<anonymous>")&&(q=q.replace("<anonymous>",a.displayName)),typeof a=="function"&&Vt.set(a,q),q}while(Z>=1&&z>=0);break}}}finally{pr=!1,fr.current=C,yi(),Error.prepareStackTrace=g}var K=a?a.displayName||a.name:"",Q=K?Ft(K):"";return typeof a=="function"&&Vt.set(a,Q),Q}function gi(a,i,f){return Sn(a,!1)}function _i(a){var i=a.prototype;return!!(i&&i.isReactComponent)}function zt(a,i,f){if(a==null)return"";if(typeof a=="function")return Sn(a,_i(a));if(typeof a=="string")return Ft(a);switch(a){case O:return Ft("Suspense");case V:return Ft("SuspenseList")}if(typeof a=="object")switch(a.$$typeof){case _:return gi(a.render);case $:return zt(a.type,i,f);case te:{var h=a,g=h._payload,C=h._init;try{return zt(C(g),i,f)}catch{}}}return""}var xn={},Rn=be.ReactDebugCurrentFrame;function qt(a){if(a){var i=a._owner,f=zt(a.type,a._source,i?i.type:null);Rn.setExtraStackFrame(f)}else Rn.setExtraStackFrame(null)}function bi(a,i,f,h,g){{var C=Function.call.bind(Et);for(var w in a)if(C(a,w)){var R=void 0;try{if(typeof a[w]!="function"){var N=Error((h||"React class")+": "+f+" type `"+w+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof a[w]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw N.name="Invariant Violation",N}R=a[w](i,w,h,f,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Z){R=Z}R&&!(R instanceof Error)&&(qt(g),x("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",h||"React class",f,w,typeof R),qt(null)),R instanceof Error&&!(R.message in xn)&&(xn[R.message]=!0,qt(g),x("Failed %s type: %s",f,R.message),qt(null))}}}function Qe(a){if(a){var i=a._owner,f=zt(a.type,a._source,i?i.type:null);jt(f)}else jt(null)}var mr;mr=!1;function On(){if(ne.current){var a=je(ne.current.type);if(a)return`
39
+
40
+ Check the render method of \``+a+"`."}return""}function Ei(a){if(a!==void 0){var i=a.fileName.replace(/^.*[\\\/]/,""),f=a.lineNumber;return`
41
+
42
+ Check your code at `+i+":"+f+"."}return""}function wi(a){return a!=null?Ei(a.__source):""}var In={};function ki(a){var i=On();if(!i){var f=typeof a=="string"?a:a.displayName||a.name;f&&(i=`
43
+
44
+ Check the top-level render call using <`+f+">.")}return i}function Pn(a,i){if(!(!a._store||a._store.validated||a.key!=null)){a._store.validated=!0;var f=ki(i);if(!In[f]){In[f]=!0;var h="";a&&a._owner&&a._owner!==ne.current&&(h=" It was passed a child from "+je(a._owner.type)+"."),Qe(a),x('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',f,h),Qe(null)}}}function An(a,i){if(typeof a=="object"){if($t(a))for(var f=0;f<a.length;f++){var h=a[f];Ge(h)&&Pn(h,i)}else if(Ge(a))a._store&&(a._store.validated=!0);else if(a){var g=oe(a);if(typeof g=="function"&&g!==a.entries)for(var C=g.call(a),w;!(w=C.next()).done;)Ge(w.value)&&Pn(w.value,i)}}}function Mn(a){{var i=a.type;if(i==null||typeof i=="string")return;var f;if(typeof i=="function")f=i.propTypes;else if(typeof i=="object"&&(i.$$typeof===_||i.$$typeof===$))f=i.propTypes;else return;if(f){var h=je(i);bi(f,a.props,"prop",h,a)}else if(i.PropTypes!==void 0&&!mr){mr=!0;var g=je(i);x("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",g||"Unknown")}typeof i.getDefaultProps=="function"&&!i.getDefaultProps.isReactClassApproved&&x("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Ti(a){{for(var i=Object.keys(a.props),f=0;f<i.length;f++){var h=i[f];if(h!=="children"&&h!=="key"){Qe(a),x("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",h),Qe(null);break}}a.ref!==null&&(Qe(a),x("Invalid attribute `ref` supplied to `React.Fragment`."),Qe(null))}}function jn(a,i,f){var h=vn(a);if(!h){var g="";(a===void 0||typeof a=="object"&&a!==null&&Object.keys(a).length===0)&&(g+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var C=wi(i);C?g+=C:g+=On();var w;a===null?w="null":$t(a)?w="array":a!==void 0&&a.$$typeof===n?(w="<"+(je(a.type)||"Unknown")+" />",g=" Did you accidentally export a JSX literal instead of a component?"):w=typeof a,x("React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",w,g)}var R=Lo.apply(this,arguments);if(R==null)return R;if(h)for(var N=2;N<arguments.length;N++)An(arguments[N],a);return a===o?Ti(R):Mn(R),R}var Nn=!1;function Ci(a){var i=jn.bind(null,a);return i.type=a,Nn||(Nn=!0,Me("React.createFactory() is deprecated and will be removed in a future major release. Consider using JSX or use React.createElement() directly instead.")),Object.defineProperty(i,"type",{enumerable:!1,get:function(){return Me("Factory.type is deprecated. Access the class directly before passing it to createFactory."),Object.defineProperty(this,"type",{value:a}),a}}),i}function Si(a,i,f){for(var h=Uo.apply(this,arguments),g=2;g<arguments.length;g++)An(arguments[g],h.type);return Mn(h),h}function xi(a,i){var f=ie.transition;ie.transition={};var h=ie.transition;ie.transition._updatedFibers=new Set;try{a()}finally{if(ie.transition=f,f===null&&h._updatedFibers){var g=h._updatedFibers.size;g>10&&Me("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table."),h._updatedFibers.clear()}}}var Dn=!1,Wt=null;function Ri(a){if(Wt===null)try{var i=("require"+Math.random()).slice(0,7),f=r&&r[i];Wt=f.call(r,"timers").setImmediate}catch{Wt=function(g){Dn===!1&&(Dn=!0,typeof MessageChannel>"u"&&x("This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning."));var C=new MessageChannel;C.port1.onmessage=g,C.port2.postMessage(void 0)}}return Wt(a)}var Xe=0,$n=!1;function Ln(a){{var i=Xe;Xe++,U.current===null&&(U.current=[]);var f=U.isBatchingLegacy,h;try{if(U.isBatchingLegacy=!0,h=a(),!f&&U.didScheduleLegacyUpdate){var g=U.current;g!==null&&(U.didScheduleLegacyUpdate=!1,gr(g))}}catch(K){throw Bt(i),K}finally{U.isBatchingLegacy=f}if(h!==null&&typeof h=="object"&&typeof h.then=="function"){var C=h,w=!1,R={then:function(K,Q){w=!0,C.then(function(ae){Bt(i),Xe===0?yr(ae,K,Q):K(ae)},function(ae){Bt(i),Q(ae)})}};return!$n&&typeof Promise<"u"&&Promise.resolve().then(function(){}).then(function(){w||($n=!0,x("You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"))}),R}else{var N=h;if(Bt(i),Xe===0){var Z=U.current;Z!==null&&(gr(Z),U.current=null);var z={then:function(K,Q){U.current===null?(U.current=[],yr(N,K,Q)):K(N)}};return z}else{var q={then:function(K,Q){K(N)}};return q}}}}function Bt(a){a!==Xe-1&&x("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. "),Xe=a}function yr(a,i,f){{var h=U.current;if(h!==null)try{gr(h),Ri(function(){h.length===0?(U.current=null,i(a)):yr(a,i,f)})}catch(g){f(g)}else i(a)}}var vr=!1;function gr(a){if(!vr){vr=!0;var i=0;try{for(;i<a.length;i++){var f=a[i];do f=f(!0);while(f!==null)}a.length=0}catch(h){throw a=a.slice(i+1),h}finally{vr=!1}}}var Oi=jn,Ii=Si,Pi=Ci,Ai={map:Ut,forEach:Wo,count:qo,toArray:Bo,only:Ho};e.Children=Ai,e.Component=D,e.Fragment=o,e.Profiler=l,e.PureComponent=F,e.StrictMode=u,e.Suspense=O,e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=be,e.act=Ln,e.cloneElement=Ii,e.createContext=Yo,e.createElement=Oi,e.createFactory=Pi,e.createRef=Io,e.forwardRef=Qo,e.isValidElement=Ge,e.lazy=Go,e.memo=Xo,e.startTransition=xi,e.unstable_act=Ln,e.useCallback=ii,e.useContext=ei,e.useDebugValue=li,e.useDeferredValue=fi,e.useEffect=ai,e.useId=hi,e.useImperativeHandle=ui,e.useInsertionEffect=si,e.useLayoutEffect=oi,e.useMemo=ci,e.useReducer=ri,e.useRef=ni,e.useState=ti,e.useSyncExternalStore=pi,e.useTransition=di,e.version=t,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()}(gt,gt.exports)),gt.exports}process.env.NODE_ENV==="production"?sr.exports=Js():sr.exports=Gs();var Qs=sr.exports,Kr={exports:{}},Xs=Qs;function Jr(r,e,t){var n=typeof e=="function";Xs.useEffect(function(){var s,o=!0,u=r(function(){return o});return Promise.resolve(u).then(function(l){s=l}),function(){o=!1,n&&e(s)}},n?t:e)}Kr.exports=Jr,Kr.exports.useAsyncEffect=Jr;const eo=async r=>{if(typeof r!="object"||!r)return!1;try{const e={type:"ping"},t=await r.send(e);if(t!==!0)throw new Error(`Expected 'true' after ping, got ${JSON.stringify(t)}`);return!0}catch(e){return console.error("Invalid CDE connection check:",e),!1}},to=(r,e)=>!!r&&e,X=r=>c.nullable(r.optional());c.string().trim().min(1,{message:"Cannot be blank"});const ro=c.object({cde_response_type:c.literal("error"),message:c.string()}),no=c.enum(["usd","brl"]),Gr=c.object({name:c.string(),amount_atom_off:X(c.number()),percent_off:X(c.number()),currency:X(c.string()),duration:c.string(),duration_in_months:X(c.number())}),ao=c.object({amount_subtotal_atom:c.number().int(),amount_total_atom:c.number().int(),currency:c.string(),description:X(c.string()),price_id:c.string(),billing_interval:X(c.string()),billing_interval_count:X(c.number().int()),quantity:c.number().int()}),so=c.record(c.string(),c.any()),oo=c.object({name:c.string(),settings:X(so)}),io=c.object({provider:c.string(),processor_name:X(c.string()),metadata:X(c.record(c.string(),c.any()))}),co=c.object({quantity:c.number()}),uo=c.object({id:X(c.string()),billing_interval:X(c.string()),billing_interval_count:X(c.number().int()),subscription_items:c.array(co),trial_start:X(c.string()),trial_end:X(c.string())}),Qr=c.object({amount_atom:c.number()}),lo=c.object({amount_atom:c.number(),amount_atom_considering_discount_applied:c.number(),currency:c.string(),discount_amount_atoms:c.array(Qr),subscription_item_id:c.string()}),fo=c.object({coupon:Gr}),ho=c.object({currency:c.string(),discounts:c.array(fo),hosted_invoice_url:X(c.string()),lines:c.array(lo),remaining_amount_atom:c.number(),tax_amount_atom:c.number(),total_amount_atom:c.number(),total_discount_amount_atoms:c.array(Qr)}),Xr=c.object({created:c.array(uo),invoices:c.array(ho)}),en=c.object({preview:Xr,preview_post_trial:X(Xr),coupons:c.array(Gr)}),tn=c.object({status:c.literal("open"),token:c.string(),email:X(c.string()),line_items:c.array(ao),amount_subtotal_atom:c.number().int(),amount_total_atom:c.number().int(),brand:oo,subs_preview:X(en),methods_available:c.array(io)}),rn=c.discriminatedUnion("mode",[c.object({mode:c.literal("setup"),currency:c.nullable(c.undefined())}).extend(tn.shape),c.object({mode:c.enum(["payment","subscription"]),currency:no}).extend(tn.shape)]),po=c.object({status:c.literal("complete")}),mo=c.object({status:c.literal("expired")});c.union([rn,po,mo]),c.object({logo:c.string(),icon:c.string(),primary_color:c.string(),secondary_color:c.string()}),c.object({invoice_urls:c.array(c.string()),subscription_ids:c.array(c.string()),customer_id:c.string()}),c.object({payment_method_id:c.string()}),c.object({id:c.string(),return_url:c.string()});const yo=c.object({type:c.string(),loc:c.array(c.string()),msg:c.string(),url:c.string()});c.array(yo),c.object({required_user_actions:c.array(c.record(c.string(),c.any()))}),c.object({required_user_actions:c.array(c.record(c.string(),c.any())),cc_pm_id:c.string()});const or=async(r,e,t)=>{console.log("[cde-client] Querying CDE with path and connection:",e.type,r);const n=await r.send(e);if(go(n))throw new Error(`[cde-client] Error querying CDE: ${n.message}`);if(console.log("[cde-client] Got response from CDE:",n),!vo(n,t)){const s=t.safeParse(n);throw s.success?new Error("Invalid state"):(console.error("OJS queryApi got a schema error. Expected schema:",t,"Actual:",n),s.error)}return n},vo=(r,e)=>e.safeParse(r).success,go=r=>ro.safeParse(r).success,_o=async(r,e)=>await or(r,{type:"get_checkout_preview",payload:e},en),nn=async r=>await or(r,{type:"get_prefill",payload:{}},rn),bo=async(r,e)=>await or(r,{type:"confirm_payment_flow",payload:e},hs);class Eo{constructor(e){this.formInstance=e,this.config=e.config,this.formId=e.formId,this.eventTargets={},this.nonces=new Set,this.tokenizedData=null,this.tokenized=0,this.connectionManager=e.getConnectionManager()}setTokenizedData(e){this.tokenizedData=e}handleMessage(e){if(e.origin!==this.formInstance.config.baseUrl||!e.source)return;const t=xs(JSON.parse(e.data));if(!this.validateEvent(t))return;const{elementId:s,payload:o}=t,u=o.type;switch(u){case"LAYOUT":this.handleLayoutEvent(o);break;case"FOCUS":this.handleFocusEvent(s);break;case"BLUR":this.handleBlurEvent(s);break;case"CHANGE":this.handleChangeEvent(s);break;case"LOADED":this.handleLoadedEvent(e.source,s,o);break;case"TOKENIZE_STARTED":this.handleTokenizeStartedEvent();break;case"PAYMENT_FLOW_STARTED":this.handlePaymentFlowStartedEvent(o,e.source,s);break;case"TOKENIZE_SUCCESS":this.handleTokenizeSuccessEvent(e.source,s,o);break;case"CHECKOUT_SUCCESS":this.handleCheckoutSuccessEvent(o);break;case"SETUP_PAYMENT_METHOD_SUCCESS":this.handleSetupPaymentMethodSuccessEvent(o);break;case"LOAD_ERROR":this.handleLoadErrorEvent(o);break;case"VALIDATION_ERROR":this.handleValidationErrorEvent(o,s);break;case"TOKENIZE_ERROR":case"CHECKOUT_ERROR":this.handleErrorEvent(o);break;default:console.warn("[form] Unhandled event type:",u)}}validateEvent(e){return e.formId!==this.formInstance.formId||!e.elementId?(console.warn("[form] Ignoring unknown event:",e),!1):this.nonces.has(e.nonce)?(console.warn("[form] Ignoring duplicate event:",e),!1):(this.nonces.add(e.nonce),!0)}handleLayoutEvent(e){const t=e.height?`${e.height}px`:"100%";this.formInstance.setFormHeight(t)}handleFocusEvent(e){this.config.onFocus&&this.config.onFocus(e)}handleBlurEvent(e){this.config.onBlur&&this.config.onBlur(e)}handleChangeEvent(e){this.config.onChange&&this.config.onChange(e)}handleLoadedEvent(e,t,n){this.eventTargets[t]=e,this.formInstance.sessionId||(this.formInstance.sessionId=n.sessionId),this.config.onLoad&&this.config.onLoad(n.totalAmountAtoms,n.currency),this.formInstance.checkoutPaymentMethods=n.checkoutPaymentMethods}handleTokenizeStartedEvent(){this.formInstance.config.onCheckoutStarted&&this.formInstance.config.onCheckoutStarted()}async handlePaymentFlowStartedEvent(e,t,n){var u;if(!this.tokenizedData)throw new Error("tokenizedData not populated");const s=this.connectionManager.getConnection(),o=async()=>{var m;const l=e.nextActionMetadata.type;if(l!==void 0)if(l==="stripe_3ds")await bs(e);else if(l==="stripe_payment_request"){if(!this.formInstance.getStripePm())throw new Error("Stripe PM not set");await _s(e,this.formInstance.getStripePm())}else throw new Error(`Unknown next action type: ${l}`);const p=await nn(s);if(p.mode==="setup"){const{payment_methods:_}=await bo(s,{secure_token:p.token,existing_cc_pm_id:(m=this.tokenizedData)==null?void 0:m.existingCCPMId});if(_.length!==1)throw new Error(`Expected exactly one payment method, got ${_.length}`);return this.tokenized=0,this.formInstance.checkoutFired=!1,this.formInstance.config.onSetupPaymentMethodSuccess&&this.formInstance.config.onSetupPaymentMethodSuccess(_[0].id),{proceedToCheckout:!1}}else return{proceedToCheckout:!0}};try{const{proceedToCheckout:l}=await o();if(!l)return;let p;if(this.tokenizedData.checkoutPaymentMethod.provider==="credit_card"&&(p=(u=e.startPFMetadata)==null?void 0:u.cc_pm_id,!p))throw new Error("CC PM ID not found");Vr(t,this.formInstance.formId,n,{...this.tokenizedData,type:"CHECKOUT",doNotUseLegacyCCFlow:!0,existingCCPMId:p},this.formInstance.config.baseUrl),this.formInstance.checkoutFired=!0,this.tokenizedData=null,this.formInstance.config.onCheckoutStarted&&this.formInstance.config.onCheckoutStarted()}catch(l){const p=Ar(l);this.formInstance.checkoutFired=!1,this.formInstance.config.onCheckoutError&&this.formInstance.config.onCheckoutError(p)}}handleTokenizeSuccessEvent(e,t,n){if(!this.tokenizedData)throw new Error("Tokenized data not found");const s=this.tokenized+1,o=s===Object.keys(this.eventTargets).length;!this.formInstance.checkoutFired&&(o||n.isReadyForCheckout)?(this.tokenizedData.type=this.tokenizedData.type===ee.enum.TOKENIZE?ee.enum.CHECKOUT:ee.enum.START_PAYMENT_FLOW,this.postEventToFrame(e,t,this.tokenizedData),this.tokenizedData=null):this.tokenized=s}handleCheckoutSuccessEvent(e){this.formInstance.config.onCheckoutSuccess&&this.formInstance.config.onCheckoutSuccess(e.invoiceUrls,e.subscriptionIds,e.customerId)}handleSetupPaymentMethodSuccessEvent(e){this.formInstance.config.onSetupPaymentMethodSuccess&&this.formInstance.config.onSetupPaymentMethodSuccess(e.paymentMethodId)}handleLoadErrorEvent(e){this.formInstance.config.onLoadError&&this.formInstance.config.onLoadError(e.message)}handleValidationErrorEvent(e,t){this.formInstance.config.onValidationError&&this.formInstance.config.onValidationError(e.elementType,e.errors,t)}handleErrorEvent(e){var t;if(e.message==="3DS_REQUIRED"){const n=(t=this.formInstance.checkoutPaymentMethods)==null?void 0:t.find(s=>s.provider==="credit_card");if(!this.formInstance.sessionId||!this.formInstance.formTarget||!this.config.onValidationError||!n)return;for(const[s,o]of Object.entries(this.eventTargets)){if(!o)continue;const u=Mt(ee.enum.START_PAYMENT_FLOW,this.formInstance.sessionId,document.querySelector(this.formInstance.formTarget)??document.body,this.config.onValidationError,{...n,processor_name:"stripe"},!1);if(u){this.formInstance.checkoutFired=!0,this.tokenizedData=u,this.postEventToFrame(o,s,u);break}}}else this.formInstance.checkoutFired=!1,this.formInstance.config.onCheckoutError&&this.formInstance.config.onCheckoutError(e.message)}handleFormSubmit(){var n;if(!this.formInstance.sessionId||!((n=this.formInstance.checkoutPaymentMethods)!=null&&n.length)||!this.config.onValidationError)return;const e=this.formInstance.checkoutPaymentMethods.find(s=>s.provider==="credit_card");if(!e)throw new Error("Card not available as a payment method in checkout");const t=Mt(ee.enum.TOKENIZE,this.formInstance.sessionId,document.querySelector(this.formInstance.formTarget)??document.body,this.config.onValidationError,e,!1);if(!t)throw new Error("Error constructing tokenize data");for(const[s,o]of Object.entries(this.eventTargets))o&&this.postEventToFrame(o,s,t);this.tokenizedData=t}postEventToFrame(e,t,n){Vr(e,this.formId,t,n,this.config.baseUrl)}}async function wo(r){const t=await Ks({iframe:r,debug:!0}).promise,n=await eo(t);if(!to(t,n))throw new Error("Got invalid CDE connection object");return t}class ko{constructor(){this.connections=new Map}addConnection(e,t){this.connections.set(e,t)}getConnection(){const e=this.connections.values().next().value;if(!e)throw new Error("Connection not found");return e}}async function To(r,e,t,n,s,o){const u={apple_pay:{isLoading:!0,isAvailable:!1,startFlow:async()=>{}},google_pay:{isLoading:!0,isAvailable:!1,startFlow:async()=>{}}};for(const l of["apple_pay","google_pay"])try{const p=e.find(O=>O.provider===l&&O.processor_name==="stripe");if(!p)throw new Error(`${l} is not available as a checkout method`);const m=gs(p.metadata),_=await Co(m,l);u[l]={isLoading:!1,isAvailable:_,startFlow:O=>So(t,r.checkoutSecureToken,document.querySelector(r.formTarget),p,m,n,s,o,O)}}catch(p){console.error(p),u[l]={isLoading:!1,isAvailable:!1,startFlow:async()=>{console.error(`${l} is not available.`)}}}return u}async function Co(r,e){const n=await Lr(r,1e3,"usd"),s=await n.canMakePayment();if(n.abort(),!s)throw new Error(`Cannot make payment with ${e} for this session`);return s[e==="apple_pay"?"applePay":"googlePay"]}async function So(r,e,t,n,s,o,u,l,p){try{const m=Fr(t,{});if(!xo(t,u,n))return;const O=(await nn(r)).mode==="setup",V=await Ro(O,p,m,r,e),$=await Lr(s,V.amountAtom,V.currency,O);await $.canMakePayment(),$.show();const te=await vs($);o(te,n)}catch(m){console.error(m),l(Ar(m))}}function xo(r,e,t){return!!Mt(ee.enum.START_PAYMENT_FLOW,"dummy",r,e??(()=>{}),t,!1)}async function Ro(r,e,t,n,s){if(r)return(e==null?void 0:e.amountToDisplayForSetupMode)??{amountAtom:0,currency:"usd"};e!=null&&e.amountToDisplayForSetupMode&&console.warn("Warning: amountToDisplayForSetupMode passed in non-setup mode. This parameter will be ignored.");const o=de.safeParse(t[Ye.PROMOTION_CODE]);if(!o.success)throw new Error(`Unknown promo code type: ${o.error.message}`);const u=await _o(n,{secure_token:s,promotion_code:o.data}),l=new Set(u.preview.invoices.map(_=>_.currency));if(l.size!==1)throw new Error(`Expected exactly one currency, got ${l.size}`);const p=l.values().next().value;return{amountAtom:u.preview.invoices.reduce((_,O)=>_+O.remaining_amount_atom,0),currency:p}}class Oo{constructor(e){this.config={...e,baseUrl:e.baseUrl??"https://cde.getopenpay.com"},this.elements=null,this.formId=`opjs-form-${window.crypto.randomUUID()}`,this.referer=window.location.origin,this.formTarget=e.formTarget??"body",this.formProperties={height:"1px"},this.sessionId=null,this.checkoutPaymentMethods=[],this.checkoutFired=!1,this.stripePm=void 0,this.paymentRequests=this.initPaymentRequests(),this.connectionManager=new ko,this.eventHandler=new Eo(this),window.addEventListener("message",this.eventHandler.handleMessage.bind(this.eventHandler))}getStripePm(){return this.stripePm}getConnectionManager(){return this.connectionManager}setFormHeight(e){this.formProperties.height=e,this.elements&&Object.values(this.elements).forEach(t=>{t.node.style.height=e})}initPaymentRequests(){return{apple_pay:{isLoading:!0,isAvailable:!1,startFlow:async()=>{}},google_pay:{isLoading:!0,isAvailable:!1,startFlow:async()=>{}}}}createElement(e,t={}){if(!this.config)throw new Error("OpenPay form not initialized");const n=document.createElement("iframe"),s=this.buildQueryString(t);n.name=`${e}-element`,n.src=`${this.config.baseUrl}/app/v1/${e}-element/?${s.toString()}`,n.style.border="none",n.style.width="100%";const o={type:e,node:n,mount:u=>{var l;return(l=document.querySelector(u))==null?void 0:l.appendChild(n)}};return this.elements?this.elements[e]=o:(this.elements={[e]:o},this.connectToElement(o)),o}buildQueryString(e){const t=new URLSearchParams;return t.append("referer",this.referer),t.append("formId",this.formId),e.styles&&t.append("styles",Es(e.styles)),t.append("secureToken",this.config.checkoutSecureToken),t}connectToElement(e){wo(e.node).then(t=>{this.connectionManager.addConnection(e.type,t),this.initializePaymentRequests()}).catch(t=>console.error("[FORM] Error connecting to CDE iframe",t))}submit(){this.eventHandler.handleFormSubmit()}async onUserCompletePaymentRequestUI(e,t){if(!(!this.config.onValidationError||!this.sessionId||!this.checkoutPaymentMethods))for(const[n,s]of Object.entries(this.eventHandler.eventTargets??{})){const o={stripePmId:e.paymentMethod.id},u=Mt(ee.enum.START_PAYMENT_FLOW,this.sessionId,document.querySelector(this.formTarget)??document.body,this.config.onValidationError,t,!1,o);if(u){this.stripePm=e,this.checkoutFired=!0,this.eventHandler.setTokenizedData(u),this.eventHandler.postEventToFrame(s,n,u);break}}}onPaymentRequestError(e){console.error("[form] Error from payment request:",e),this.checkoutFired=!1,this.config.onCheckoutError&&this.config.onCheckoutError(e)}async initializePaymentRequests(){if(!this.config.checkoutSecureToken||!this.checkoutPaymentMethods||!this.formTarget)return;const e=this.connectionManager.getConnection();if(!e){console.error("[form] CDE connection not established");return}this.paymentRequests=await To(this.config,this.checkoutPaymentMethods,e,this.onUserCompletePaymentRequestUI.bind(this),this.config.onValidationError,this.onPaymentRequestError.bind(this)),this.config.onPaymentRequestLoad&&this.config.onPaymentRequestLoad(this.paymentRequests)}destroy(){window.removeEventListener("message",this.eventHandler.handleMessage.bind(this.eventHandler))}}Ne.FieldName=Ye,Ne.OpenPayForm=Oo,Object.defineProperty(Ne,Symbol.toStringTag,{value:"Module"})});
package/package.json ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "@getopenpay/openpay-js",
3
+ "version": "0.1.0",
4
+ "description": "Accept payments through OpenPay, right on your site",
5
+ "author": "OpenPay <info@getopenpay.com> (https://getopenpay.com)",
6
+ "license": "ISC",
7
+ "type": "module",
8
+ "main": "./dist/index.umd.js",
9
+ "module": "./dist/index.es.js",
10
+ "types": "./dist/index.d.ts",
11
+ "exports": {
12
+ ".": {
13
+ "import": "./dist/index.es.js",
14
+ "default": "./dist/index.umd.js",
15
+ "types": "./dist/index.d.ts"
16
+ }
17
+ },
18
+ "files": [
19
+ "dist"
20
+ ],
21
+ "keywords": [
22
+ "getopenpay",
23
+ "openpay",
24
+ "payments"
25
+ ],
26
+ "scripts": {
27
+ "lint": "eslint . --report-unused-disable-directives --max-warnings 0",
28
+ "lint:fix": "eslint . --fix --report-unused-disable-directives --max-warnings 0",
29
+ "prepare": "husky",
30
+ "build": "tsc -p tsconfig.build.json && vite build",
31
+ "dev": "tsc -p tsconfig.build.json && NODE_ENV=development vite build --mode development --watch"
32
+ },
33
+ "dependencies": {
34
+ "@getopenpay/utils": "*",
35
+ "penpal": "^6.2.2"
36
+ },
37
+ "devDependencies": {
38
+ "@getopenpay/eslint-config": "*",
39
+ "@getopenpay/typescript-config": "*",
40
+ "@stripe/stripe-js": "^4.3.0",
41
+ "@types/node": "^22.0.2",
42
+ "@types/react": "^18.2.0",
43
+ "@types/react-dom": "^18.2.0",
44
+ "@types/uuid": "^10.0.0",
45
+ "@typescript-eslint/eslint-plugin": "^7.15.0",
46
+ "@typescript-eslint/parser": "^7.15.0",
47
+ "@vitejs/plugin-react": "^4.3.1",
48
+ "esbuild": "^0.23.1",
49
+ "eslint": "^8.57.0",
50
+ "eslint-config-prettier": "^9.1.0",
51
+ "eslint-plugin-prettier": "^5.2.1",
52
+ "typescript": "^5.2.2",
53
+ "vite": "^5.3.4",
54
+ "vite-plugin-dts": "^4.0.0-beta.2"
55
+ }
56
+ }