@getopenpay/openpay-js 0.1.1-alpha.2 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -1,8 +1,4 @@
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 i={};for(const u of s)i[u]=u;return i},r.getValidEnumValues=s=>{const i=r.objectKeys(s).filter(l=>typeof s[s[l]]!="number"),u={};for(const l of i)u[l]=s[l];return r.objectValues(u)},r.objectValues=s=>r.objectKeys(s).map(function(i){return s[i]}),r.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const i=[];for(const u in s)Object.prototype.hasOwnProperty.call(s,u)&&i.push(u);return i},r.find=(s,i)=>{for(const u of s)if(i(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,i=" | "){return s.map(u=>typeof u=="string"?`'${u}'`:u).join(i)}r.joinValues=n,r.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(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(i){return i.message},n={_errors:[]},s=i=>{for(const u of i.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,i=[...t,...s.path||[]],u={...s,path:i};if(s.message!==void 0)return{...s,path:i,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:i,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 i=await s.key,u=await s.value;n.push({key:i,value:u})}return se.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const s of t){const{key:i,value:u}=s;if(i.status==="aborted"||u.status==="aborted")return S;i.status==="dirty"&&e.dirty(),u.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof u.value<"u"||s.alwaysSet)&&(n[i.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",Gt=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)},i=this._parseSync({data:e,path:s.path,parent:s});return wr(s,i)}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}),i=await(tt(s)?s:Promise.resolve(s));return wr(n,i)}refine(e,t){const n=s=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(s):t;return this._refinement((s,i)=>{const u=e(s),l=()=>i.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 ot.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,Gn=/^[-+]?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)?)??$/,Jn=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Qn="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Jt;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 i=this._getOrReturnCtx(e);return b(i,{code:y.invalid_type,expected:E.string,received:i.parsedType}),S}const n=new se;let s;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(s=this._getOrReturnCtx(e,s),b(s,{code:y.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")e.data.length>i.value&&(s=this._getOrReturnCtx(e,s),b(s,{code:y.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){const u=e.data.length>i.value,l=e.data.length<i.value;(u||l)&&(s=this._getOrReturnCtx(e,s),u?b(s,{code:y.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):l&&b(s,{code:y.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")Jn.test(e.data)||(s=this._getOrReturnCtx(e,s),b(s,{validation:"email",code:y.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Jt||(Jt=new RegExp(Qn,"u")),Jt.test(e.data)||(s=this._getOrReturnCtx(e,s),b(s,{validation:"emoji",code:y.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")Yn.test(e.data)||(s=this._getOrReturnCtx(e,s),b(s,{validation:"uuid",code:y.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")Kn.test(e.data)||(s=this._getOrReturnCtx(e,s),b(s,{validation:"nanoid",code:y.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")Wn.test(e.data)||(s=this._getOrReturnCtx(e,s),b(s,{validation:"cuid",code:y.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")Bn.test(e.data)||(s=this._getOrReturnCtx(e,s),b(s,{validation:"cuid2",code:y.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")Hn.test(e.data)||(s=this._getOrReturnCtx(e,s),b(s,{validation:"ulid",code:y.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),b(s,{validation:"url",code:y.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),b(s,{validation:"regex",code:y.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(s=this._getOrReturnCtx(e,s),b(s,{code:y.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(s=this._getOrReturnCtx(e,s),b(s,{code:y.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(s=this._getOrReturnCtx(e,s),b(s,{code:y.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?Cr(i).test(e.data)||(s=this._getOrReturnCtx(e,s),b(s,{code:y.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?ra.test(e.data)||(s=this._getOrReturnCtx(e,s),b(s,{code:y.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?na(i).test(e.data)||(s=this._getOrReturnCtx(e,s),b(s,{code:y.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?Gn.test(e.data)||(s=this._getOrReturnCtx(e,s),b(s,{validation:"duration",code:y.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?aa(e.data,i.version)||(s=this._getOrReturnCtx(e,s),b(s,{validation:"ip",code:y.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?ta.test(e.data)||(s=this._getOrReturnCtx(e,s),b(s,{validation:"base64",code:y.invalid_string,message:i.message}),n.dirty()):A.assertNever(i);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,i=parseInt(r.toFixed(s).replace(".","")),u=parseInt(e.toFixed(s).replace(".",""));return i%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 i=this._getOrReturnCtx(e);return b(i,{code:y.invalid_type,expected:E.number,received:i.parsedType}),S}let n;const s=new se;for(const i of this._def.checks)i.kind==="int"?A.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{code:y.invalid_type,expected:"integer",received:"float",message:i.message}),s.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),b(n,{code:y.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),b(n,{code:y.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?sa(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),b(n,{code:y.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{code:y.not_finite,message:i.message}),s.dirty()):A.assertNever(i);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 i=this._getOrReturnCtx(e);return b(i,{code:y.invalid_type,expected:E.bigint,received:i.parsedType}),S}let n;const s=new se;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),b(n,{code:y.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),b(n,{code:y.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),b(n,{code:y.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):A.assertNever(i);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 i=this._getOrReturnCtx(e);return b(i,{code:y.invalid_type,expected:E.date,received:i.parsedType}),S}if(isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return b(i,{code:y.invalid_date}),S}const n=new se;let s;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(s=this._getOrReturnCtx(e,s),b(s,{code:y.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(s=this._getOrReturnCtx(e,s),b(s,{code:y.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):A.assertNever(i);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 it 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)}}it.create=r=>new it({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 i=[...t.data].map((u,l)=>s.type._parseSync(new Ee(t,u,t.path,l)));return se.mergeArray(n,i)}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:i,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 _=i[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,i,u,l;const p=(u=(i=(s=this._def).errorMap)===null||i===void 0?void 0:i.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 i=this.shape[n];for(;i instanceof ke;)i=i._def.innerType;t[n]=i}}),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 ot extends P{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;function s(i){for(const l of i)if(l.result.status==="valid")return l.result;for(const l of i)if(l.result.status==="dirty")return t.common.issues.push(...l.ctx.common.issues),l.result;const u=i.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 i=>{const u={...t,common:{...t.common,issues:[]},parent:null};return{result:await i._parseAsync({data:t.data,path:t.path,parent:u}),ctx:u}})).then(s);{let i;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"&&!i&&(i={result:_,ctx:m}),m.common.issues.length&&u.push(m.common.issues)}if(i)return t.common.issues.push(...i.ctx.common.issues),i.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}}ot.create=(r,e)=>new ot({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 it?[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],i=this.optionsMap.get(s);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._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 i of t){const u=Se(i.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,i)}}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),i=A.objectKeys(r).filter(l=>s.indexOf(l)!==-1),u={...r,...e};for(const l of i){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 i=0;i<r.length;i++){const u=r[i],l=e[i],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=(i,u)=>{if(Kt(i)||Kt(u))return S;const l=Qt(i.value,u.value);return l.valid?((Gt(i)||Gt(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(([i,u])=>s(i,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 i=[...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(i).then(u=>se.mergeArray(t,u)):se.mergeArray(t,i)}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=[],i=this._def.keyType,u=this._def.valueType;for(const l in n.data)s.push({key:i._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,i=this._def.valueType,u=[...n.data.entries()].map(([l,p],m)=>({key:s._parse(new Ee(n,l,n.path,[m,"key"])),value:i._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 i=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)=>i._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 i={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,i).catch($=>{throw m.addIssue(n(p,$)),m}),O=await Reflect.apply(u,this,_);return await l._def.returns._def.type.parseAsync(O,i).catch($=>{throw m.addIssue(s(O,$)),m})})}else{const l=this;return ce(function(...p){const m=l._def.args.safeParse(p,i);if(!m.success)throw new fe([n(p,m.error)]);const _=Reflect.apply(u,this,m.data),O=l._def.returns.safeParse(_,i);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,i={addIssue:u=>{b(n,u),u.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),s.type==="preprocess"){const u=s.transform(n.data,i);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,i);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,i);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,i)).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(i=>({status:"valid",value:i.status==="valid"?i.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 ia=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 i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?S:i.status==="dirty"?(t.dirty(),ze(i.value)):this._def.out._parseAsync({data:i.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 i,u;if(!r(n)){const l=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,p=(u=(i=l.fatal)!==null&&i!==void 0?i:t)!==null&&u!==void 0?u:!0,m=typeof l=="string"?{message:l}:l;s.addIssue({code:"custom",...m,fatal:p})}}):qe.create()}const oa={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=it.create,ma=qe.create,ya=$e.create,va=Ce.create,ga=Rt.create,_a=ge.create,ba=W.create,Ea=W.strictCreate,wa=ot.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:Gt,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:it,ZodAny:qe,ZodUnknown:$e,ZodNever:Ce,ZodVoid:Rt,ZodArray:ge,ZodObject:W,ZodUnion:ot,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:ia,ZodBranded:Xt,ZodPipeline:mt,ZodReadonly:yt,custom:xr,Schema:P,ZodSchema:P,late:oa,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):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"]),Ga=c.object({type:Ka}),Ja=ee.extract(["BLUR","FOCUS","CHANGE"]),Qa=c.object({type:Ja,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()))}),is=c.object({type:c.literal(ee.enum.SETUP_PAYMENT_METHOD_SUCCESS),paymentMethodId:c.string()}),os=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(os.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",[Ga,Qa,es,rs,ns,as,$r,us,ls,ss,is]),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 new Error("Stripe JS not found.");return new Stripe(r)},Lr=async(r,e,t,n)=>{const s=await rr(r),i=ms[t.toLowerCase().trim()];return s.paymentRequest({country:"US",currency:i,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 i,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=(i=n.setupIntent)==null?void 0:i.status;if(s!=="succeeded")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,i)=>{const u=i.getAttribute("data-opid");return u?{...s,[u]:i.value}:s},e),Mt=(r,e,t,n,s,i,u)=>{const l=Fr(t,{type:r,sessionId:e,checkoutPaymentMethod:s,paymentFlowMetadata:u,doNotUseLegacyCCFlow:i});(s.provider==="apple_pay"||s.provider==="google_pay")&&(l[Ye.ZIP_CODE]||(l[Ye.ZIP_CODE]="00000"));const p=$r.safeParse(l);if(p.success)return p.data;{const m=p.error.format(),_=ps(m);for(const[O,V]of Object.entries(_))n(O,V,O);return null}},xs=r=>{try{return fs.parse(r)}catch(e){throw e}},Vr=(r,e,t,n,s)=>{const i={payload:n,nonce:Ss(),formId:e,elementId:t};r.postMessage(JSON.stringify(i),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(i=>{i(s)}))},onDestroy(s){n?s():t.push(s)}}},Os=r=>(...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,i;t?(n=t[1]?t[1]:e.protocol,s=t[2],i=t[4]):(n=e.protocol,s=e.hostname,i=e.port);const u=i&&i!==Is[n]?`:${i}`:"";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:i,originForSending:u,originForReceiving:l}=r;let p=!1;const m=_=>{if(_.source!==i||_.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=G=>me=>{if(t(`${n}: Sending ${V}() reply`),p){t(`${n}: Unable to send ${V}() reply due to destroyed connection`);return}const ie={penpal:Te.Reply,id:te,resolution:G,returnValue:me};G===Ze.Rejected&&me instanceof Error&&(ie.returnValue=zr(me),ie.returnValueIsError=!0);try{i.postMessage(ie,u)}catch(B){if(B.name===ar.DataCloneError){const oe={penpal:Te.Reply,id:te,resolution:Ze.Rejected,returnValue:zr(B),returnValueIsError:!0};i.postMessage(oe,u)}throw B}};new Promise(G=>G(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,i,u)=>(typeof s[i]>"u"&&(s[i]={}),u===n.length-1&&(s[i]=t),s[i]),r),r},Br=(r,e)=>{const t={};return Object.keys(r).forEach(n=>{const s=r[n],i=Zs(n,e);typeof s=="object"&&Object.assign(t,Br(s,i)),typeof s=="function"&&(t[i]=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:i,local:u,remote:l,originForSending:p,originForReceiving:m}=e;let _=!1;s(`${i}: Connecting call sender`);const O=$=>(...te)=>{s(`${i}: Sending ${$}() call`);let pe;try{l.closed&&(pe=!0)}catch{pe=!0}if(pe&&n(),_){const G=new Error(`Unable to send ${$}() call due to destroyed connection`);throw G.code=vt.ConnectionDestroyed,G}return new Promise((G,me)=>{const ie=$s(),B=U=>{if(U.source!==l||U.data.penpal!==Te.Reply||U.data.id!==ie)return;if(m!=="*"&&U.origin!==m){s(`${i} received message from origin ${U.origin} which did not match expected origin ${m}`);return}const ne=U.data;s(`${i}: Received ${$}() reply`),u.removeEventListener(Ae.Message,B);let ye=ne.returnValue;ne.returnValueIsError&&(ye=js(ye)),(ne.resolution===Ze.Fulfilled?G:me)(ye)};u.addEventListener(Ae.Message,B);const oe={penpal:Te.Call,id:ie,methodName:$,args:te};l.postMessage(oe,p)})},V=t.reduce(($,te)=>($[te]=O(te),$),{});return Object.assign(r,Fs(V)),()=>{_=!0}},zs=(r,e,t,n,s)=>{const{destroy:i,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,i,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 i={penpal:Te.SynAck,methodNames:Object.keys(e)};s.source.postMessage(i,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:i=!1}=r;const u=Os(i),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,G)=>{const me=Hs(s,m),ie=B=>{if(!(B.source!==e.contentWindow||!B.data)){if(B.data.penpal===Te.Syn){V(B);return}if(B.data.penpal===Te.Ack){const oe=$(B);oe&&(me(),pe(oe));return}}};window.addEventListener(Ae.Message,ie),u("Parent: Awaiting handshake"),Bs(e,l),p(B=>{window.removeEventListener(Ae.Message,ie),B&&G(B)})}),destroy(){m()}}};var sr={exports:{}},M={};/**
1
+ (function(ve,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("zod"),require("uuid"),require("penpal")):typeof define=="function"&&define.amd?define(["exports","zod","uuid","penpal"],i):(ve=typeof globalThis<"u"?globalThis:ve||self,i(ve.OpenPay={},ve.zod,ve.uuid,ve.penpal))})(this,function(ve,i,mn,hn){"use strict";var Hr={exports:{}},Dt={exports:{}},M={};/**
6
2
  * @license React
7
3
  * react.production.min.js
8
4
  *
@@ -10,7 +6,7 @@ ${r.map(t=>`- ${t.path.join("/")}: ${t.message}`).join(`
10
6
  *
11
7
  * This source code is licensed under the MIT license found in the
12
8
  * LICENSE file in the root directory of this source tree.
13
- */var Hr;function Gs(){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"),i=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 G(d,v,j){this.props=d,this.context=v,this.refs=pe,this.updater=j||$}G.prototype.isReactComponent={},G.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")},G.prototype.forceUpdate=function(d){this.updater.enqueueForceUpdate(this,d,"forceUpdate")};function me(){}me.prototype=G.prototype;function ie(d,v,j){this.props=d,this.context=v,this.refs=pe,this.updater=j||$}var B=ie.prototype=new me;B.constructor=ie,te(B,G.prototype),B.isPureReactComponent=!0;var oe=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={},J=null,H=null;if(v!=null)for(D in v.ref!==void 0&&(H=v.ref),v.key!==void 0&&(J=""+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:J,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 or(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?or(""+d.key):v.toString(36)}function Ke(d,v,j,D,L){var J=typeof d;(J==="undefined"||J==="boolean")&&(d=null);var H=!1;if(d===null)H=!0;else switch(J){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,oe(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+":",oe(d))for(var Y=0;Y<d.length;Y++){J=d[Y];var F=D+bt(J,Y);H+=Ke(J,v,j,F,L)}else if(F=V(d),typeof F=="function")for(d=F.call(d),Y=0;!(J=d.next()).done;)J=J.value,F=D+bt(J,Y++),H+=Ke(J,v,j,F,L);else if(J==="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(J){return v.call(j,J,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 Ge(){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=G,M.Fragment=t,M.Profiler=s,M.PureComponent=ie,M.StrictMode=n,M.Suspense=p,M.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Dt,M.act=Ge,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,J=d.ref,H=d._owner;if(v!=null){if(v.ref!==void 0&&(J=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:J,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:i,_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=Ge,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:{}};/**
9
+ */var Wr;function vn(){if(Wr)return M;Wr=1;var c=Symbol.for("react.element"),a=Symbol.for("react.portal"),d=Symbol.for("react.fragment"),m=Symbol.for("react.strict_mode"),g=Symbol.for("react.profiler"),b=Symbol.for("react.provider"),j=Symbol.for("react.context"),I=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),q=Symbol.for("react.memo"),U=Symbol.for("react.lazy"),z=Symbol.iterator;function ee(r){return r===null||typeof r!="object"?null:(r=z&&r[z]||r["@@iterator"],typeof r=="function"?r:null)}var Y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},J=Object.assign,ge={};function K(r,s,h){this.props=r,this.context=s,this.refs=ge,this.updater=h||Y}K.prototype.isReactComponent={},K.prototype.setState=function(r,s){if(typeof r!="object"&&typeof r!="function"&&r!=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,r,s,"setState")},K.prototype.forceUpdate=function(r){this.updater.enqueueForceUpdate(this,r,"forceUpdate")};function _e(){}_e.prototype=K.prototype;function ae(r,s,h){this.props=r,this.context=s,this.refs=ge,this.updater=h||Y}var ie=ae.prototype=new _e;ie.constructor=ae,J(ie,K.prototype),ie.isPureReactComponent=!0;var B=Array.isArray,$=Object.prototype.hasOwnProperty,V={current:null},Z={key:!0,ref:!0,__self:!0,__source:!0};function te(r,s,h){var _,E={},P=null,k=null;if(s!=null)for(_ in s.ref!==void 0&&(k=s.ref),s.key!==void 0&&(P=""+s.key),s)$.call(s,_)&&!Z.hasOwnProperty(_)&&(E[_]=s[_]);var O=arguments.length-2;if(O===1)E.children=h;else if(1<O){for(var C=Array(O),L=0;L<O;L++)C[L]=arguments[L+2];E.children=C}if(r&&r.defaultProps)for(_ in O=r.defaultProps,O)E[_]===void 0&&(E[_]=O[_]);return{$$typeof:c,type:r,key:P,ref:k,props:E,_owner:V.current}}function be(r,s){return{$$typeof:c,type:r.type,key:s,ref:r.ref,props:r.props,_owner:r._owner}}function pe(r){return typeof r=="object"&&r!==null&&r.$$typeof===c}function De(r){var s={"=":"=0",":":"=2"};return"$"+r.replace(/[=:]/g,function(h){return s[h]})}var Ee=/\/+/g;function de(r,s){return typeof r=="object"&&r!==null&&r.key!=null?De(""+r.key):s.toString(36)}function se(r,s,h,_,E){var P=typeof r;(P==="undefined"||P==="boolean")&&(r=null);var k=!1;if(r===null)k=!0;else switch(P){case"string":case"number":k=!0;break;case"object":switch(r.$$typeof){case c:case a:k=!0}}if(k)return k=r,E=E(k),r=_===""?"."+de(k,0):_,B(E)?(h="",r!=null&&(h=r.replace(Ee,"$&/")+"/"),se(E,s,h,"",function(L){return L})):E!=null&&(pe(E)&&(E=be(E,h+(!E.key||k&&k.key===E.key?"":(""+E.key).replace(Ee,"$&/")+"/")+r)),s.push(E)),1;if(k=0,_=_===""?".":_+":",B(r))for(var O=0;O<r.length;O++){P=r[O];var C=_+de(P,O);k+=se(P,s,h,C,E)}else if(C=ee(r),typeof C=="function")for(r=C.call(r),O=0;!(P=r.next()).done;)P=P.value,C=_+de(P,O++),k+=se(P,s,h,C,E);else if(P==="object")throw s=String(r),Error("Objects are not valid as a React child (found: "+(s==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":s)+"). If you meant to render a collection of children, use an array instead.");return k}function H(r,s,h){if(r==null)return r;var _=[],E=0;return se(r,_,"","",function(P){return s.call(h,P,E++)}),_}function Q(r){if(r._status===-1){var s=r._result;s=s(),s.then(function(h){(r._status===0||r._status===-1)&&(r._status=1,r._result=h)},function(h){(r._status===0||r._status===-1)&&(r._status=2,r._result=h)}),r._status===-1&&(r._status=0,r._result=s)}if(r._status===1)return r._result.default;throw r._result}var f={current:null},re={transition:null},we={ReactCurrentDispatcher:f,ReactCurrentBatchConfig:re,ReactCurrentOwner:V};function ue(){throw Error("act(...) is not supported in production builds of React.")}return M.Children={map:H,forEach:function(r,s,h){H(r,function(){s.apply(this,arguments)},h)},count:function(r){var s=0;return H(r,function(){s++}),s},toArray:function(r){return H(r,function(s){return s})||[]},only:function(r){if(!pe(r))throw Error("React.Children.only expected to receive a single React element child.");return r}},M.Component=K,M.Fragment=d,M.Profiler=g,M.PureComponent=ae,M.StrictMode=m,M.Suspense=x,M.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=we,M.act=ue,M.cloneElement=function(r,s,h){if(r==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+r+".");var _=J({},r.props),E=r.key,P=r.ref,k=r._owner;if(s!=null){if(s.ref!==void 0&&(P=s.ref,k=V.current),s.key!==void 0&&(E=""+s.key),r.type&&r.type.defaultProps)var O=r.type.defaultProps;for(C in s)$.call(s,C)&&!Z.hasOwnProperty(C)&&(_[C]=s[C]===void 0&&O!==void 0?O[C]:s[C])}var C=arguments.length-2;if(C===1)_.children=h;else if(1<C){O=Array(C);for(var L=0;L<C;L++)O[L]=arguments[L+2];_.children=O}return{$$typeof:c,type:r.type,key:E,ref:P,props:_,_owner:k}},M.createContext=function(r){return r={$$typeof:j,_currentValue:r,_currentValue2:r,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},r.Provider={$$typeof:b,_context:r},r.Consumer=r},M.createElement=te,M.createFactory=function(r){var s=te.bind(null,r);return s.type=r,s},M.createRef=function(){return{current:null}},M.forwardRef=function(r){return{$$typeof:I,render:r}},M.isValidElement=pe,M.lazy=function(r){return{$$typeof:U,_payload:{_status:-1,_result:r},_init:Q}},M.memo=function(r,s){return{$$typeof:q,type:r,compare:s===void 0?null:s}},M.startTransition=function(r){var s=re.transition;re.transition={};try{r()}finally{re.transition=s}},M.unstable_act=ue,M.useCallback=function(r,s){return f.current.useCallback(r,s)},M.useContext=function(r){return f.current.useContext(r)},M.useDebugValue=function(){},M.useDeferredValue=function(r){return f.current.useDeferredValue(r)},M.useEffect=function(r,s){return f.current.useEffect(r,s)},M.useId=function(){return f.current.useId()},M.useImperativeHandle=function(r,s,h){return f.current.useImperativeHandle(r,s,h)},M.useInsertionEffect=function(r,s){return f.current.useInsertionEffect(r,s)},M.useLayoutEffect=function(r,s){return f.current.useLayoutEffect(r,s)},M.useMemo=function(r,s){return f.current.useMemo(r,s)},M.useReducer=function(r,s,h){return f.current.useReducer(r,s,h)},M.useRef=function(r){return f.current.useRef(r)},M.useState=function(r){return f.current.useState(r)},M.useSyncExternalStore=function(r,s,h){return f.current.useSyncExternalStore(r,s,h)},M.useTransition=function(){return f.current.useTransition()},M.version="18.3.1",M}var Be={exports:{}};/**
14
10
  * @license React
15
11
  * react.development.js
16
12
  *
@@ -18,26 +14,68 @@ ${r.map(t=>`- ${t.path.join("/")}: ${t.message}`).join(`
18
14
  *
19
15
  * This source code is licensed under the MIT license found in the
20
16
  * LICENSE file in the root directory of this source tree.
21
- */gt.exports;var Yr;function Js(){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"),i=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"),G=Symbol.iterator,me="@@iterator";function ie(a){if(a===null||typeof a!="object")return null;var o=G&&a[G]||a[me];return typeof o=="function"?o:null}var B={current:null},oe={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 o=ye.getCurrentStack;return o&&(a+=o()||""),a};var _t=!1,or=!1,Nt=!1,bt=!1,Ke=!1,be={ReactCurrentDispatcher:B,ReactCurrentBatchConfig:oe,ReactCurrentOwner:ne};be.ReactDebugCurrentFrame=ye,be.ReactCurrentActQueue=U;function Me(a){{for(var o=arguments.length,f=new Array(o>1?o-1:0),h=1;h<o;h++)f[h-1]=arguments[h];Fe("warn",a,f)}}function x(a){{for(var o=arguments.length,f=new Array(o>1?o-1:0),h=1;h<o;h++)f[h-1]=arguments[h];Fe("error",a,f)}}function Fe(a,o,f){{var h=be.ReactDebugCurrentFrame,g=h.getStackAddendum();g!==""&&(o+="%s",f=f.concat([g]));var C=f.map(function(w){return String(w)});C.unshift("Warning: "+o),Function.prototype.apply.call(console[a],console,C)}}var Dt={};function Ge(a,o){{var f=a.constructor,h=f&&(f.displayName||f.name)||"ReactClass",g=h+"."+o;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.",o,h),Dt[g]=!0}}var d={isMounted:function(a){return!1},enqueueForceUpdate:function(a,o,f){Ge(a,"forceUpdate")},enqueueReplaceState:function(a,o,f,h){Ge(a,"replaceState")},enqueueSetState:function(a,o,f,h){Ge(a,"setState")}},v=Object.assign,j={};Object.freeze(j);function D(a,o,f){this.props=a,this.context=o,this.refs=j,this.updater=f||d}D.prototype.isReactComponent={},D.prototype.setState=function(a,o){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,o,"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)."]},J=function(a,o){Object.defineProperty(D.prototype,a,{get:function(){Me("%s(...) is deprecated in plain JavaScript React classes. %s",o[0],o[1])}})};for(var H in L)L.hasOwnProperty(H)&&J(H,L[H])}function Y(){}Y.prototype=D.prototype;function F(a,o,f){this.props=a,this.context=o,this.refs=j,this.updater=f||d}var ue=F.prototype=new Y;ue.constructor=F,v(ue,D.prototype),ue.isPureReactComponent=!0;function Oi(){var a={current:null};return Object.seal(a),a}var Ii=Array.isArray;function $t(a){return Ii(a)}function Pi(a){{var o=typeof Symbol=="function"&&Symbol.toStringTag,f=o&&a[Symbol.toStringTag]||a.constructor.name||"Object";return f}}function Ai(a){try{return an(a),!1}catch{return!0}}function an(a){return""+a}function Lt(a){if(Ai(a))return x("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Pi(a)),an(a)}function Mi(a,o,f){var h=a.displayName;if(h)return h;var g=o.displayName||o.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 i: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 o=a;return sn(o)+".Consumer";case p:var f=a;return sn(f._context)+".Provider";case _:return Mi(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 o=Object.getOwnPropertyDescriptor(a,"ref").get;if(o&&o.isReactWarning)return!1}return a.ref!==void 0}function dn(a){if(Et.call(a,"key")){var o=Object.getOwnPropertyDescriptor(a,"key").get;if(o&&o.isReactWarning)return!1}return a.key!==void 0}function ji(a,o){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)",o))};f.isReactWarning=!0,Object.defineProperty(a,"key",{get:f,configurable:!0})}function Ni(a,o){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)",o))};f.isReactWarning=!0,Object.defineProperty(a,"ref",{get:f,configurable:!0})}function Di(a){if(typeof a.ref=="string"&&ne.current&&a.__self&&ne.current.stateNode!==a.__self){var o=je(ne.current.type);cr[o]||(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',o,a.ref),cr[o]=!0)}}var ur=function(a,o,f,h,g,C,w){var R={$$typeof:n,type:a,key:o,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 $i(a,o,f){var h,g={},C=null,w=null,R=null,N=null;if(o!=null){ln(o)&&(w=o.ref,Di(o)),dn(o)&&(Lt(o.key),C=""+o.key),R=o.__self===void 0?null:o.__self,N=o.__source===void 0?null:o.__source;for(h in o)Et.call(o,h)&&!on.hasOwnProperty(h)&&(g[h]=o[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&&ji(g,Q),w&&Ni(g,Q)}return ur(a,C,w,R,N,ne.current,g)}function Li(a,o){var f=ur(a.type,o,a.ref,a._self,a._source,a._owner,a.props);return f}function Zi(a,o,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(o!=null){ln(o)&&(w=o.ref,Z=ne.current),dn(o)&&(Lt(o.key),C=""+o.key);var z;a.type&&a.type.defaultProps&&(z=a.type.defaultProps);for(h in o)Et.call(o,h)&&!on.hasOwnProperty(h)&&(o[h]===void 0&&z!==void 0?g[h]=z[h]:g[h]=o[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 Je(a){return typeof a=="object"&&a!==null&&a.$$typeof===n}var fn=".",Ui=":";function Fi(a){var o=/[=:]/g,f={"=":"=0",":":"=2"},h=a.replace(o,function(g){return f[g]});return"$"+h}var hn=!1,Vi=/\/+/g;function pn(a){return a.replace(Vi,"$&/")}function lr(a,o){return typeof a=="object"&&a!==null&&a.key!=null?(Lt(a.key),Fi(""+a.key)):o.toString(36)}function Zt(a,o,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,o,z,"",function(No){return No})}else N!=null&&(Je(N)&&(N.key&&(!R||R.key!==N.key)&&Lt(N.key),N=Li(N,f+(N.key&&(!R||R.key!==N.key)?pn(""+N.key)+"/":"")+Z)),o.push(N));return 1}var q,K,Q=0,ae=h===""?fn:h+Ui;if($t(a))for(var Ht=0;Ht<a.length;Ht++)q=a[Ht],K=ae+lr(q,Ht),Q+=Zt(q,o,f,K,g);else{var _r=ie(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 Mo=_r.call(Zn),Un,jo=0;!(Un=Mo.next()).done;)q=Un.value,K=ae+lr(q,jo++),Q+=Zt(q,o,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,o,f){if(a==null)return a;var h=[],g=0;return Zt(a,h,"","",function(C){return o.call(f,C,g++)}),h}function zi(a){var o=0;return Ut(a,function(){o++}),o}function qi(a,o,f){Ut(a,function(){o.apply(this,arguments)},f)}function Wi(a){return Ut(a,function(o){return o})||[]}function Bi(a){if(!Je(a))throw new Error("React.Children.only expected to receive a single React element child.");return a}function Hi(a){var o={$$typeof:m,_currentValue:a,_currentValue2:a,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null};o.Provider={$$typeof:p,_context:o};var f=!1,h=!1,g=!1;{var C={$$typeof:m,_context:o};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?")),o.Provider},set:function(w){o.Provider=w}},_currentValue:{get:function(){return o._currentValue},set:function(w){o._currentValue=w}},_currentValue2:{get:function(){return o._currentValue2},set:function(w){o._currentValue2=w}},_threadCount:{get:function(){return o._threadCount},set:function(w){o._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?")),o.Consumer}},displayName:{get:function(){return o.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)}}}),o.Consumer=C}return o._currentRenderer=null,o._currentRenderer2=null,o}var wt=-1,dr=0,mn=1,Yi=2;function Ki(a){if(a._status===wt){var o=a._result,f=o();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=Yi,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
17
+ */Be.exports;var Kr;function gn(){return Kr||(Kr=1,function(c,a){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 d="18.3.1",m=Symbol.for("react.element"),g=Symbol.for("react.portal"),b=Symbol.for("react.fragment"),j=Symbol.for("react.strict_mode"),I=Symbol.for("react.profiler"),x=Symbol.for("react.provider"),q=Symbol.for("react.context"),U=Symbol.for("react.forward_ref"),z=Symbol.for("react.suspense"),ee=Symbol.for("react.suspense_list"),Y=Symbol.for("react.memo"),J=Symbol.for("react.lazy"),ge=Symbol.for("react.offscreen"),K=Symbol.iterator,_e="@@iterator";function ae(e){if(e===null||typeof e!="object")return null;var t=K&&e[K]||e[_e];return typeof t=="function"?t:null}var ie={current:null},B={transition:null},$={current:null,isBatchingLegacy:!1,didScheduleLegacyUpdate:!1},V={current:null},Z={},te=null;function be(e){te=e}Z.setExtraStackFrame=function(e){te=e},Z.getCurrentStack=null,Z.getStackAddendum=function(){var e="";te&&(e+=te);var t=Z.getCurrentStack;return t&&(e+=t()||""),e};var pe=!1,De=!1,Ee=!1,de=!1,se=!1,H={ReactCurrentDispatcher:ie,ReactCurrentBatchConfig:B,ReactCurrentOwner:V};H.ReactDebugCurrentFrame=Z,H.ReactCurrentActQueue=$;function Q(e){{for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];re("warn",e,n)}}function f(e){{for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];re("error",e,n)}}function re(e,t,n){{var o=H.ReactDebugCurrentFrame,u=o.getStackAddendum();u!==""&&(t+="%s",n=n.concat([u]));var p=n.map(function(l){return String(l)});p.unshift("Warning: "+t),Function.prototype.apply.call(console[e],console,p)}}var we={};function ue(e,t){{var n=e.constructor,o=n&&(n.displayName||n.name)||"ReactClass",u=o+"."+t;if(we[u])return;f("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.",t,o),we[u]=!0}}var r={isMounted:function(e){return!1},enqueueForceUpdate:function(e,t,n){ue(e,"forceUpdate")},enqueueReplaceState:function(e,t,n,o){ue(e,"replaceState")},enqueueSetState:function(e,t,n,o){ue(e,"setState")}},s=Object.assign,h={};Object.freeze(h);function _(e,t,n){this.props=e,this.context=t,this.refs=h,this.updater=n||r}_.prototype.isReactComponent={},_.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=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,e,t,"setState")},_.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};{var E={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)."]},P=function(e,t){Object.defineProperty(_.prototype,e,{get:function(){Q("%s(...) is deprecated in plain JavaScript React classes. %s",t[0],t[1])}})};for(var k in E)E.hasOwnProperty(k)&&P(k,E[k])}function O(){}O.prototype=_.prototype;function C(e,t,n){this.props=e,this.context=t,this.refs=h,this.updater=n||r}var L=C.prototype=new O;L.constructor=C,s(L,_.prototype),L.isPureReactComponent=!0;function Nt(){var e={current:null};return Object.seal(e),e}var Ut=Array.isArray;function Ce(e){return Ut(e)}function zt(e){{var t=typeof Symbol=="function"&&Symbol.toStringTag,n=t&&e[Symbol.toStringTag]||e.constructor.name||"Object";return n}}function Vt(e){try{return Ge(e),!1}catch{return!0}}function Ge(e){return""+e}function Se(e){if(Vt(e))return f("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",zt(e)),Ge(e)}function qt(e,t,n){var o=e.displayName;if(o)return o;var u=t.displayName||t.name||"";return u!==""?n+"("+u+")":n}function Je(e){return e.displayName||"Context"}function X(e){if(e==null)return null;if(typeof e.tag=="number"&&f("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case b:return"Fragment";case g:return"Portal";case I:return"Profiler";case j:return"StrictMode";case z:return"Suspense";case ee:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case q:var t=e;return Je(t)+".Consumer";case x:var n=e;return Je(n._context)+".Provider";case U:return qt(e,e.render,"ForwardRef");case Y:var o=e.displayName||null;return o!==null?o:X(e.type)||"Memo";case J:{var u=e,p=u._payload,l=u._init;try{return X(l(p))}catch{return null}}}return null}var ye=Object.prototype.hasOwnProperty,Ze={key:!0,ref:!0,__self:!0,__source:!0},Qe,Xe,$e;$e={};function et(e){if(ye.call(e,"ref")){var t=Object.getOwnPropertyDescriptor(e,"ref").get;if(t&&t.isReactWarning)return!1}return e.ref!==void 0}function tt(e){if(ye.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return e.key!==void 0}function Yt(e,t){var n=function(){Qe||(Qe=!0,f("%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)",t))};n.isReactWarning=!0,Object.defineProperty(e,"key",{get:n,configurable:!0})}function Ht(e,t){var n=function(){Xe||(Xe=!0,f("%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)",t))};n.isReactWarning=!0,Object.defineProperty(e,"ref",{get:n,configurable:!0})}function Wt(e){if(typeof e.ref=="string"&&V.current&&e.__self&&V.current.stateNode!==e.__self){var t=X(V.current.type);$e[t]||(f('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',t,e.ref),$e[t]=!0)}}var Fe=function(e,t,n,o,u,p,l){var y={$$typeof:m,type:e,key:t,ref:n,props:l,_owner:p};return y._store={},Object.defineProperty(y._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(y,"_self",{configurable:!1,enumerable:!1,writable:!1,value:o}),Object.defineProperty(y,"_source",{configurable:!1,enumerable:!1,writable:!1,value:u}),Object.freeze&&(Object.freeze(y.props),Object.freeze(y)),y};function Kt(e,t,n){var o,u={},p=null,l=null,y=null,v=null;if(t!=null){et(t)&&(l=t.ref,Wt(t)),tt(t)&&(Se(t.key),p=""+t.key),y=t.__self===void 0?null:t.__self,v=t.__source===void 0?null:t.__source;for(o in t)ye.call(t,o)&&!Ze.hasOwnProperty(o)&&(u[o]=t[o])}var w=arguments.length-2;if(w===1)u.children=n;else if(w>1){for(var S=Array(w),R=0;R<w;R++)S[R]=arguments[R+2];Object.freeze&&Object.freeze(S),u.children=S}if(e&&e.defaultProps){var T=e.defaultProps;for(o in T)u[o]===void 0&&(u[o]=T[o])}if(p||l){var A=typeof e=="function"?e.displayName||e.name||"Unknown":e;p&&Yt(u,A),l&&Ht(u,A)}return Fe(e,p,l,y,v,V.current,u)}function Bt(e,t){var n=Fe(e.type,t,e.ref,e._self,e._source,e._owner,e.props);return n}function Gt(e,t,n){if(e==null)throw new Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var o,u=s({},e.props),p=e.key,l=e.ref,y=e._self,v=e._source,w=e._owner;if(t!=null){et(t)&&(l=t.ref,w=V.current),tt(t)&&(Se(t.key),p=""+t.key);var S;e.type&&e.type.defaultProps&&(S=e.type.defaultProps);for(o in t)ye.call(t,o)&&!Ze.hasOwnProperty(o)&&(t[o]===void 0&&S!==void 0?u[o]=S[o]:u[o]=t[o])}var R=arguments.length-2;if(R===1)u.children=n;else if(R>1){for(var T=Array(R),A=0;A<R;A++)T[A]=arguments[A+2];u.children=T}return Fe(e.type,p,l,y,v,w,u)}function ce(e){return typeof e=="object"&&e!==null&&e.$$typeof===m}var rt=".",Jt=":";function Zt(e){var t=/[=:]/g,n={"=":"=0",":":"=2"},o=e.replace(t,function(u){return n[u]});return"$"+o}var nt=!1,Qt=/\/+/g;function ot(e){return e.replace(Qt,"$&/")}function xe(e,t){return typeof e=="object"&&e!==null&&e.key!=null?(Se(e.key),Zt(""+e.key)):t.toString(36)}function Re(e,t,n,o,u){var p=typeof e;(p==="undefined"||p==="boolean")&&(e=null);var l=!1;if(e===null)l=!0;else switch(p){case"string":case"number":l=!0;break;case"object":switch(e.$$typeof){case m:case g:l=!0}}if(l){var y=e,v=u(y),w=o===""?rt+xe(y,0):o;if(Ce(v)){var S="";w!=null&&(S=ot(w)+"/"),Re(v,t,S,"",function(Yr){return Yr})}else v!=null&&(ce(v)&&(v.key&&(!y||y.key!==v.key)&&Se(v.key),v=Bt(v,n+(v.key&&(!y||y.key!==v.key)?ot(""+v.key)+"/":"")+w)),t.push(v));return 1}var R,T,A=0,F=o===""?rt:o+Jt;if(Ce(e))for(var Me=0;Me<e.length;Me++)R=e[Me],T=F+xe(R,Me),A+=Re(R,t,n,T,u);else{var We=ae(e);if(typeof We=="function"){var Pt=e;We===Pt.entries&&(nt||Q("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),nt=!0);for(var Vr=We.call(Pt),It,qr=0;!(It=Vr.next()).done;)R=It.value,T=F+xe(R,qr++),A+=Re(R,t,n,T,u)}else if(p==="object"){var jt=String(e);throw new Error("Objects are not valid as a React child (found: "+(jt==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":jt)+"). If you meant to render a collection of children, use an array instead.")}}return A}function ke(e,t,n){if(e==null)return e;var o=[],u=0;return Re(e,o,"","",function(p){return t.call(n,p,u++)}),o}function Xt(e){var t=0;return ke(e,function(){t++}),t}function er(e,t,n){ke(e,function(){t.apply(this,arguments)},n)}function tr(e){return ke(e,function(t){return t})||[]}function rr(e){if(!ce(e))throw new Error("React.Children.only expected to receive a single React element child.");return e}function nr(e){var t={$$typeof:q,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null};t.Provider={$$typeof:x,_context:t};var n=!1,o=!1,u=!1;{var p={$$typeof:q,_context:t};Object.defineProperties(p,{Provider:{get:function(){return o||(o=!0,f("Rendering <Context.Consumer.Provider> is not supported and will be removed in a future major release. Did you mean to render <Context.Provider> instead?")),t.Provider},set:function(l){t.Provider=l}},_currentValue:{get:function(){return t._currentValue},set:function(l){t._currentValue=l}},_currentValue2:{get:function(){return t._currentValue2},set:function(l){t._currentValue2=l}},_threadCount:{get:function(){return t._threadCount},set:function(l){t._threadCount=l}},Consumer:{get:function(){return n||(n=!0,f("Rendering <Context.Consumer.Consumer> is not supported and will be removed in a future major release. Did you mean to render <Context.Consumer> instead?")),t.Consumer}},displayName:{get:function(){return t.displayName},set:function(l){u||(Q("Setting `displayName` on Context.Consumer has no effect. You should set it directly on the context with Context.displayName = '%s'.",l),u=!0)}}}),t.Consumer=p}return t._currentRenderer=null,t._currentRenderer2=null,t}var me=-1,Le=0,at=1,or=2;function ar(e){if(e._status===me){var t=e._result,n=t();if(n.then(function(p){if(e._status===Le||e._status===me){var l=e;l._status=at,l._result=p}},function(p){if(e._status===Le||e._status===me){var l=e;l._status=or,l._result=p}}),e._status===me){var o=e;o._status=Le,o._result=n}}if(e._status===at){var u=e._result;return u===void 0&&f(`lazy: Expected the result of a dynamic import() call. Instead received: %s
22
18
 
23
19
  Your code should look like:
24
20
  const MyComponent = lazy(() => import('./MyComponent'))
25
21
 
26
- 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
22
+ Did you accidentally put curly braces around the import?`,u),"default"in u||f(`lazy: Expected the result of a dynamic import() call. Instead received: %s
27
23
 
28
24
  Your code should look like:
29
- const MyComponent = lazy(() => import('./MyComponent'))`,g),g.default}else throw a._result}function Gi(a){var o={_status:wt,_result:a},f={$$typeof:te,_payload:o,_init:Ki};{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 Ji(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 o={$$typeof:_,render:a};{var f;Object.defineProperty(o,"displayName",{enumerable:!1,configurable:!0,get:function(){return f},set:function(h){f=h,!a.name&&!a.displayName&&(a.displayName=h)}})}return o}var yn;yn=Symbol.for("react.module.reference");function vn(a){return!!(typeof a=="string"||typeof a=="function"||a===i||a===l||Ke||a===u||a===O||a===V||bt||a===pe||_t||or||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 Qi(a,o){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:o===void 0?null:o};{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:
25
+ const MyComponent = lazy(() => import('./MyComponent'))`,u),u.default}else throw e._result}function ir(e){var t={_status:me,_result:e},n={$$typeof:J,_payload:t,_init:ar};{var o,u;Object.defineProperties(n,{defaultProps:{configurable:!0,get:function(){return o},set:function(p){f("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."),o=p,Object.defineProperty(n,"defaultProps",{enumerable:!0})}},propTypes:{configurable:!0,get:function(){return u},set:function(p){f("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."),u=p,Object.defineProperty(n,"propTypes",{enumerable:!0})}}})}return n}function sr(e){e!=null&&e.$$typeof===Y?f("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."):typeof e!="function"?f("forwardRef requires a render function but was given %s.",e===null?"null":typeof e):e.length!==0&&e.length!==2&&f("forwardRef render functions accept exactly two parameters: props and ref. %s",e.length===1?"Did you forget to use the ref parameter?":"Any additional parameter will be undefined."),e!=null&&(e.defaultProps!=null||e.propTypes!=null)&&f("forwardRef render functions do not support propTypes or defaultProps. Did you accidentally pass a React component?");var t={$$typeof:U,render:e};{var n;Object.defineProperty(t,"displayName",{enumerable:!1,configurable:!0,get:function(){return n},set:function(o){n=o,!e.name&&!e.displayName&&(e.displayName=o)}})}return t}var it;it=Symbol.for("react.module.reference");function st(e){return!!(typeof e=="string"||typeof e=="function"||e===b||e===I||se||e===j||e===z||e===ee||de||e===ge||pe||De||Ee||typeof e=="object"&&e!==null&&(e.$$typeof===J||e.$$typeof===Y||e.$$typeof===x||e.$$typeof===q||e.$$typeof===U||e.$$typeof===it||e.getModuleId!==void 0))}function ur(e,t){st(e)||f("memo: The first argument must be a component. Instead received: %s",e===null?"null":typeof e);var n={$$typeof:Y,type:e,compare:t===void 0?null:t};{var o;Object.defineProperty(n,"displayName",{enumerable:!1,configurable:!0,get:function(){return o},set:function(u){o=u,!e.name&&!e.displayName&&(e.displayName=u)}})}return n}function N(){var e=ie.current;return e===null&&f(`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:
30
26
  1. You might have mismatching versions of React and the renderer (such as React DOM)
31
27
  2. You might be breaking the Rules of Hooks
32
28
  3. You might have more than one copy of React in the same app
33
- See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.`),a}function Xi(a){var o=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 o.useContext(a)}function eo(a){var o=le();return o.useState(a)}function to(a,o,f){var h=le();return h.useReducer(a,o,f)}function ro(a){var o=le();return o.useRef(a)}function no(a,o){var f=le();return f.useEffect(a,o)}function ao(a,o){var f=le();return f.useInsertionEffect(a,o)}function so(a,o){var f=le();return f.useLayoutEffect(a,o)}function io(a,o){var f=le();return f.useCallback(a,o)}function oo(a,o){var f=le();return f.useMemo(a,o)}function co(a,o,f){var h=le();return h.useImperativeHandle(a,o,f)}function uo(a,o){{var f=le();return f.useDebugValue(a,o)}}function lo(){var a=le();return a.useTransition()}function fo(a){var o=le();return o.useDeferredValue(a)}function ho(){var a=le();return a.useId()}function po(a,o,f){var h=le();return h.useSyncExternalStore(a,o,f)}var kt=0,gn,_n,bn,En,wn,kn,Tn;function Cn(){}Cn.__reactDisabledLog=!0;function mo(){{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 yo(){{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,o,f){{if(hr===void 0)try{throw Error()}catch(g){var h=g.stack.trim().match(/\n( *(at )?)/);hr=h&&h[1]||""}return`
34
- `+hr+a}}var pr=!1,Vt;{var vo=typeof WeakMap=="function"?WeakMap:Map;Vt=new vo}function Sn(a,o){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,mo();try{if(o){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(`
35
- `),N=h.stack.split(`
36
- `),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=`
37
- `+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,yo(),Error.prepareStackTrace=g}var K=a?a.displayName||a.name:"",Q=K?Ft(K):"";return typeof a=="function"&&Vt.set(a,Q),Q}function go(a,o,f){return Sn(a,!1)}function _o(a){var o=a.prototype;return!!(o&&o.isReactComponent)}function zt(a,o,f){if(a==null)return"";if(typeof a=="function")return Sn(a,_o(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 go(a.render);case $:return zt(a.type,o,f);case te:{var h=a,g=h._payload,C=h._init;try{return zt(C(g),o,f)}catch{}}}return""}var xn={},Rn=be.ReactDebugCurrentFrame;function qt(a){if(a){var o=a._owner,f=zt(a.type,a._source,o?o.type:null);Rn.setExtraStackFrame(f)}else Rn.setExtraStackFrame(null)}function bo(a,o,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](o,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 o=a._owner,f=zt(a.type,a._source,o?o.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`
29
+ See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.`),e}function cr(e){var t=N();if(e._context!==void 0){var n=e._context;n.Consumer===e?f("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?"):n.Provider===e&&f("Calling useContext(Context.Provider) is not supported. Did you mean to call useContext(Context) instead?")}return t.useContext(e)}function lr(e){var t=N();return t.useState(e)}function fr(e,t,n){var o=N();return o.useReducer(e,t,n)}function pr(e){var t=N();return t.useRef(e)}function dr(e,t){var n=N();return n.useEffect(e,t)}function yr(e,t){var n=N();return n.useInsertionEffect(e,t)}function mr(e,t){var n=N();return n.useLayoutEffect(e,t)}function hr(e,t){var n=N();return n.useCallback(e,t)}function vr(e,t){var n=N();return n.useMemo(e,t)}function gr(e,t,n){var o=N();return o.useImperativeHandle(e,t,n)}function _r(e,t){{var n=N();return n.useDebugValue(e,t)}}function br(){var e=N();return e.useTransition()}function Er(e){var t=N();return t.useDeferredValue(e)}function wr(){var e=N();return e.useId()}function Cr(e,t,n){var o=N();return o.useSyncExternalStore(e,t,n)}var he=0,ut,ct,lt,ft,pt,dt,yt;function mt(){}mt.__reactDisabledLog=!0;function Sr(){{if(he===0){ut=console.log,ct=console.info,lt=console.warn,ft=console.error,pt=console.group,dt=console.groupCollapsed,yt=console.groupEnd;var e={configurable:!0,enumerable:!0,value:mt,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}he++}}function Rr(){{if(he--,he===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:s({},e,{value:ut}),info:s({},e,{value:ct}),warn:s({},e,{value:lt}),error:s({},e,{value:ft}),group:s({},e,{value:pt}),groupCollapsed:s({},e,{value:dt}),groupEnd:s({},e,{value:yt})})}he<0&&f("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Ne=H.ReactCurrentDispatcher,Ue;function Oe(e,t,n){{if(Ue===void 0)try{throw Error()}catch(u){var o=u.stack.trim().match(/\n( *(at )?)/);Ue=o&&o[1]||""}return`
30
+ `+Ue+e}}var ze=!1,Te;{var kr=typeof WeakMap=="function"?WeakMap:Map;Te=new kr}function ht(e,t){if(!e||ze)return"";{var n=Te.get(e);if(n!==void 0)return n}var o;ze=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var p;p=Ne.current,Ne.current=null,Sr();try{if(t){var l=function(){throw Error()};if(Object.defineProperty(l.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(l,[])}catch(F){o=F}Reflect.construct(e,[],l)}else{try{l.call()}catch(F){o=F}e.call(l.prototype)}}else{try{throw Error()}catch(F){o=F}e()}}catch(F){if(F&&o&&typeof F.stack=="string"){for(var y=F.stack.split(`
31
+ `),v=o.stack.split(`
32
+ `),w=y.length-1,S=v.length-1;w>=1&&S>=0&&y[w]!==v[S];)S--;for(;w>=1&&S>=0;w--,S--)if(y[w]!==v[S]){if(w!==1||S!==1)do if(w--,S--,S<0||y[w]!==v[S]){var R=`
33
+ `+y[w].replace(" at new "," at ");return e.displayName&&R.includes("<anonymous>")&&(R=R.replace("<anonymous>",e.displayName)),typeof e=="function"&&Te.set(e,R),R}while(w>=1&&S>=0);break}}}finally{ze=!1,Ne.current=p,Rr(),Error.prepareStackTrace=u}var T=e?e.displayName||e.name:"",A=T?Oe(T):"";return typeof e=="function"&&Te.set(e,A),A}function Or(e,t,n){return ht(e,!1)}function Tr(e){var t=e.prototype;return!!(t&&t.isReactComponent)}function Pe(e,t,n){if(e==null)return"";if(typeof e=="function")return ht(e,Tr(e));if(typeof e=="string")return Oe(e);switch(e){case z:return Oe("Suspense");case ee:return Oe("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case U:return Or(e.render);case Y:return Pe(e.type,t,n);case J:{var o=e,u=o._payload,p=o._init;try{return Pe(p(u),t,n)}catch{}}}return""}var vt={},gt=H.ReactDebugCurrentFrame;function Ie(e){if(e){var t=e._owner,n=Pe(e.type,e._source,t?t.type:null);gt.setExtraStackFrame(n)}else gt.setExtraStackFrame(null)}function Pr(e,t,n,o,u){{var p=Function.call.bind(ye);for(var l in e)if(p(e,l)){var y=void 0;try{if(typeof e[l]!="function"){var v=Error((o||"React class")+": "+n+" type `"+l+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[l]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw v.name="Invariant Violation",v}y=e[l](t,l,o,n,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(w){y=w}y&&!(y instanceof Error)&&(Ie(u),f("%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).",o||"React class",n,l,typeof y),Ie(null)),y instanceof Error&&!(y.message in vt)&&(vt[y.message]=!0,Ie(u),f("Failed %s type: %s",n,y.message),Ie(null))}}}function le(e){if(e){var t=e._owner,n=Pe(e.type,e._source,t?t.type:null);be(n)}else be(null)}var Ve;Ve=!1;function _t(){if(V.current){var e=X(V.current.type);if(e)return`
38
34
 
39
- Check the render method of \``+a+"`."}return""}function Eo(a){if(a!==void 0){var o=a.fileName.replace(/^.*[\\\/]/,""),f=a.lineNumber;return`
35
+ Check the render method of \``+e+"`."}return""}function Ir(e){if(e!==void 0){var t=e.fileName.replace(/^.*[\\\/]/,""),n=e.lineNumber;return`
40
36
 
41
- Check your code at `+o+":"+f+"."}return""}function wo(a){return a!=null?Eo(a.__source):""}var In={};function ko(a){var o=On();if(!o){var f=typeof a=="string"?a:a.displayName||a.name;f&&(o=`
37
+ Check your code at `+t+":"+n+"."}return""}function jr(e){return e!=null?Ir(e.__source):""}var bt={};function Ar(e){var t=_t();if(!t){var n=typeof e=="string"?e:e.displayName||e.name;n&&(t=`
42
38
 
43
- Check the top-level render call using <`+f+">.")}return o}function Pn(a,o){if(!(!a._store||a._store.validated||a.key!=null)){a._store.validated=!0;var f=ko(o);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,o){if(typeof a=="object"){if($t(a))for(var f=0;f<a.length;f++){var h=a[f];Je(h)&&Pn(h,o)}else if(Je(a))a._store&&(a._store.validated=!0);else if(a){var g=ie(a);if(typeof g=="function"&&g!==a.entries)for(var C=g.call(a),w;!(w=C.next()).done;)Je(w.value)&&Pn(w.value,o)}}}function Mn(a){{var o=a.type;if(o==null||typeof o=="string")return;var f;if(typeof o=="function")f=o.propTypes;else if(typeof o=="object"&&(o.$$typeof===_||o.$$typeof===$))f=o.propTypes;else return;if(f){var h=je(o);bo(f,a.props,"prop",h,a)}else if(o.PropTypes!==void 0&&!mr){mr=!0;var g=je(o);x("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",g||"Unknown")}typeof o.getDefaultProps=="function"&&!o.getDefaultProps.isReactClassApproved&&x("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function To(a){{for(var o=Object.keys(a.props),f=0;f<o.length;f++){var h=o[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,o,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=wo(o);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=$i.apply(this,arguments);if(R==null)return R;if(h)for(var N=2;N<arguments.length;N++)An(arguments[N],a);return a===i?To(R):Mn(R),R}var Nn=!1;function Co(a){var o=jn.bind(null,a);return o.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(o,"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}}),o}function So(a,o,f){for(var h=Zi.apply(this,arguments),g=2;g<arguments.length;g++)An(arguments[g],h.type);return Mn(h),h}function xo(a,o){var f=oe.transition;oe.transition={};var h=oe.transition;oe.transition._updatedFibers=new Set;try{a()}finally{if(oe.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 Ro(a){if(Wt===null)try{var o=("require"+Math.random()).slice(0,7),f=r&&r[o];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 o=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(o),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(o),Xe===0?yr(ae,K,Q):K(ae)},function(ae){Bt(o),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(o),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,o,f){{var h=U.current;if(h!==null)try{gr(h),Ro(function(){h.length===0?(U.current=null,o(a)):yr(a,o,f)})}catch(g){f(g)}else o(a)}}var vr=!1;function gr(a){if(!vr){vr=!0;var o=0;try{for(;o<a.length;o++){var f=a[o];do f=f(!0);while(f!==null)}a.length=0}catch(h){throw a=a.slice(o+1),h}finally{vr=!1}}}var Oo=jn,Io=So,Po=Co,Ao={map:Ut,forEach:qi,count:zi,toArray:Wi,only:Bi};e.Children=Ao,e.Component=D,e.Fragment=i,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=Io,e.createContext=Hi,e.createElement=Oo,e.createFactory=Po,e.createRef=Oi,e.forwardRef=Ji,e.isValidElement=Je,e.lazy=Gi,e.memo=Qi,e.startTransition=xo,e.unstable_act=Ln,e.useCallback=io,e.useContext=Xi,e.useDebugValue=uo,e.useDeferredValue=fo,e.useEffect=no,e.useId=ho,e.useImperativeHandle=co,e.useInsertionEffect=ao,e.useLayoutEffect=so,e.useMemo=oo,e.useReducer=to,e.useRef=ro,e.useState=eo,e.useSyncExternalStore=po,e.useTransition=lo,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=Gs():sr.exports=Js();var Qs=sr.exports,Kr={exports:{}},Xs=Qs;function Gr(r,e,t){var n=typeof e=="function";Xs.useEffect(function(){var s,i=!0,u=r(function(){return i});return Promise.resolve(u).then(function(l){s=l}),function(){i=!1,n&&e(s)}},n?t:e)}Kr.exports=Gr,Kr.exports.useAsyncEffect=Gr;const ei=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{return!1}},ti=(r,e)=>!!r&&e,X=r=>c.nullable(r.optional());c.string().trim().min(1,{message:"Cannot be blank"});const ri=c.object({cde_response_type:c.literal("error"),message:c.string()}),ni=c.enum(["usd","brl"]),Jr=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())}),ai=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()}),si=c.record(c.string(),c.any()),ii=c.object({name:c.string(),settings:X(si)}),oi=c.object({provider:c.string(),processor_name:X(c.string()),metadata:X(c.record(c.string(),c.any()))}),ci=c.object({quantity:c.number()}),ui=c.object({id:X(c.string()),billing_interval:X(c.string()),billing_interval_count:X(c.number().int()),subscription_items:c.array(ci),trial_start:X(c.string()),trial_end:X(c.string())}),Qr=c.object({amount_atom:c.number()}),li=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()}),di=c.object({coupon:Jr}),fi=c.object({currency:c.string(),discounts:c.array(di),hosted_invoice_url:X(c.string()),lines:c.array(li),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(ui),invoices:c.array(fi)}),en=c.object({preview:Xr,preview_post_trial:X(Xr),coupons:c.array(Jr)}),tn=c.object({status:c.literal("open"),token:c.string(),email:X(c.string()),line_items:c.array(ai),amount_subtotal_atom:c.number().int(),amount_total_atom:c.number().int(),brand:ii,subs_preview:X(en),methods_available:c.array(oi)}),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:ni}).extend(tn.shape)]),hi=c.object({status:c.literal("complete")}),pi=c.object({status:c.literal("expired")});c.union([rn,hi,pi]),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 mi=c.object({type:c.string(),loc:c.array(c.string()),msg:c.string(),url:c.string()});c.array(mi),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 ir=async(r,e,t)=>{const n=await r.send(e);if(vi(n))throw new Error(`[cde-client] Error querying CDE: ${n.message}`);if(!yi(n,t)){const s=t.safeParse(n);throw s.success?new Error("Invalid state"):s.error}return n},yi=(r,e)=>e.safeParse(r).success,vi=r=>ri.safeParse(r).success,gi=async(r,e)=>await ir(r,{type:"get_checkout_preview",payload:e},en),nn=async r=>await ir(r,{type:"get_prefill",payload:{}},rn),_i=async(r,e)=>await ir(r,{type:"confirm_payment_flow",payload:e},hs);class bi{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:i}=t;switch(i.type){case"LAYOUT":this.handleLayoutEvent(i);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,i);break;case"TOKENIZE_STARTED":this.handleTokenizeStartedEvent();break;case"PAYMENT_FLOW_STARTED":this.handlePaymentFlowStartedEvent(i,e.source,s);break;case"TOKENIZE_SUCCESS":this.handleTokenizeSuccessEvent(e.source,s,i);break;case"CHECKOUT_SUCCESS":this.handleCheckoutSuccessEvent(i);break;case"SETUP_PAYMENT_METHOD_SUCCESS":this.handleSetupPaymentMethodSuccessEvent(i);break;case"LOAD_ERROR":this.handleLoadErrorEvent(i);break;case"VALIDATION_ERROR":this.handleValidationErrorEvent(i,s);break;case"TOKENIZE_ERROR":case"CHECKOUT_ERROR":this.handleErrorEvent(i);break}}validateEvent(e){return e.formId!==this.formInstance.formId||!e.elementId||this.nonces.has(e.nonce)?!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(),i=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 _i(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 i();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,i=s===Object.keys(this.eventTargets).length;!this.formInstance.checkoutFired&&(i||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,i]of Object.entries(this.eventTargets)){if(!i)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(i,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,i]of Object.entries(this.eventTargets))i&&this.postEventToFrame(i,s,t);this.tokenizedData=t}postEventToFrame(e,t,n){Vr(e,this.formId,t,n,this.config.baseUrl)}}async function Ei(r){const t=await Ks({iframe:r,debug:!0}).promise,n=await ei(t);if(!ti(t,n))throw new Error("Got invalid CDE connection object");return t}class wi{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 ki(r,e,t,n,s,i){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 Ti(m,l);u[l]={isLoading:!1,isAvailable:_,startFlow:O=>Ci(t,r.checkoutSecureToken,document.querySelector(r.formTarget),p,m,n,s,i,O)}}catch{u[l]={isLoading:!1,isAvailable:!1,startFlow:async()=>{}}}return u}async function Ti(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 Ci(r,e,t,n,s,i,u,l,p){try{const m=Fr(t,{});if(!Si(t,u,n))return;const O=(await nn(r)).mode==="setup",V=await xi(O,p,m,r,e),$=await Lr(s,V.amountAtom,V.currency,O);await $.canMakePayment(),$.show();const te=await vs($);i(te,n)}catch(m){l(Ar(m))}}function Si(r,e,t){return!!Mt(ee.enum.START_PAYMENT_FLOW,"dummy",r,e??(()=>{}),t,!1)}async function xi(r,e,t,n,s){if(r)return(e==null?void 0:e.amountToDisplayForSetupMode)??{amountAtom:0,currency:"usd"};e!=null&&e.amountToDisplayForSetupMode;const i=de.safeParse(t[Ye.PROMOTION_CODE]);if(!i.success)throw new Error(`Unknown promo code type: ${i.error.message}`);const u=await gi(n,{secure_token:s,promotion_code:i.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 Ri{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 wi,this.eventHandler=new bi(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 i={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]=i:(this.elements={[e]:i},this.connectToElement(i)),i}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){Ei(e.node).then(t=>{this.connectionManager.addConnection(e.type,t),this.initializePaymentRequests()}).catch(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 i={stripePmId:e.paymentMethod.id},u=Mt(ee.enum.START_PAYMENT_FLOW,this.sessionId,document.querySelector(this.formTarget)??document.body,this.config.onValidationError,t,!1,i);if(u){this.stripePm=e,this.checkoutFired=!0,this.eventHandler.setTokenizedData(u),this.eventHandler.postEventToFrame(s,n,u);break}}}onPaymentRequestError(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();e&&(this.paymentRequests=await ki(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=Ri,Object.defineProperty(Ne,Symbol.toStringTag,{value:"Module"})});
39
+ Check the top-level render call using <`+n+">.")}return t}function Et(e,t){if(!(!e._store||e._store.validated||e.key!=null)){e._store.validated=!0;var n=Ar(t);if(!bt[n]){bt[n]=!0;var o="";e&&e._owner&&e._owner!==V.current&&(o=" It was passed a child from "+X(e._owner.type)+"."),le(e),f('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',n,o),le(null)}}}function wt(e,t){if(typeof e=="object"){if(Ce(e))for(var n=0;n<e.length;n++){var o=e[n];ce(o)&&Et(o,t)}else if(ce(e))e._store&&(e._store.validated=!0);else if(e){var u=ae(e);if(typeof u=="function"&&u!==e.entries)for(var p=u.call(e),l;!(l=p.next()).done;)ce(l.value)&&Et(l.value,t)}}}function Ct(e){{var t=e.type;if(t==null||typeof t=="string")return;var n;if(typeof t=="function")n=t.propTypes;else if(typeof t=="object"&&(t.$$typeof===U||t.$$typeof===Y))n=t.propTypes;else return;if(n){var o=X(t);Pr(n,e.props,"prop",o,e)}else if(t.PropTypes!==void 0&&!Ve){Ve=!0;var u=X(t);f("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",u||"Unknown")}typeof t.getDefaultProps=="function"&&!t.getDefaultProps.isReactClassApproved&&f("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Mr(e){{for(var t=Object.keys(e.props),n=0;n<t.length;n++){var o=t[n];if(o!=="children"&&o!=="key"){le(e),f("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",o),le(null);break}}e.ref!==null&&(le(e),f("Invalid attribute `ref` supplied to `React.Fragment`."),le(null))}}function St(e,t,n){var o=st(e);if(!o){var u="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(u+=" 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 p=jr(t);p?u+=p:u+=_t();var l;e===null?l="null":Ce(e)?l="array":e!==void 0&&e.$$typeof===m?(l="<"+(X(e.type)||"Unknown")+" />",u=" Did you accidentally export a JSX literal instead of a component?"):l=typeof e,f("React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",l,u)}var y=Kt.apply(this,arguments);if(y==null)return y;if(o)for(var v=2;v<arguments.length;v++)wt(arguments[v],e);return e===b?Mr(y):Ct(y),y}var Rt=!1;function Dr(e){var t=St.bind(null,e);return t.type=e,Rt||(Rt=!0,Q("React.createFactory() is deprecated and will be removed in a future major release. Consider using JSX or use React.createElement() directly instead.")),Object.defineProperty(t,"type",{enumerable:!1,get:function(){return Q("Factory.type is deprecated. Access the class directly before passing it to createFactory."),Object.defineProperty(this,"type",{value:e}),e}}),t}function $r(e,t,n){for(var o=Gt.apply(this,arguments),u=2;u<arguments.length;u++)wt(arguments[u],o.type);return Ct(o),o}function Fr(e,t){var n=B.transition;B.transition={};var o=B.transition;B.transition._updatedFibers=new Set;try{e()}finally{if(B.transition=n,n===null&&o._updatedFibers){var u=o._updatedFibers.size;u>10&&Q("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."),o._updatedFibers.clear()}}}var kt=!1,je=null;function xr(e){if(je===null)try{var t=("require"+Math.random()).slice(0,7),n=c&&c[t];je=n.call(c,"timers").setImmediate}catch{je=function(u){kt===!1&&(kt=!0,typeof MessageChannel>"u"&&f("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 p=new MessageChannel;p.port1.onmessage=u,p.port2.postMessage(void 0)}}return je(e)}var fe=0,Ot=!1;function Tt(e){{var t=fe;fe++,$.current===null&&($.current=[]);var n=$.isBatchingLegacy,o;try{if($.isBatchingLegacy=!0,o=e(),!n&&$.didScheduleLegacyUpdate){var u=$.current;u!==null&&($.didScheduleLegacyUpdate=!1,He(u))}}catch(T){throw Ae(t),T}finally{$.isBatchingLegacy=n}if(o!==null&&typeof o=="object"&&typeof o.then=="function"){var p=o,l=!1,y={then:function(T,A){l=!0,p.then(function(F){Ae(t),fe===0?qe(F,T,A):T(F)},function(F){Ae(t),A(F)})}};return!Ot&&typeof Promise<"u"&&Promise.resolve().then(function(){}).then(function(){l||(Ot=!0,f("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 () => ...);"))}),y}else{var v=o;if(Ae(t),fe===0){var w=$.current;w!==null&&(He(w),$.current=null);var S={then:function(T,A){$.current===null?($.current=[],qe(v,T,A)):T(v)}};return S}else{var R={then:function(T,A){T(v)}};return R}}}}function Ae(e){e!==fe-1&&f("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. "),fe=e}function qe(e,t,n){{var o=$.current;if(o!==null)try{He(o),xr(function(){o.length===0?($.current=null,t(e)):qe(e,t,n)})}catch(u){n(u)}else t(e)}}var Ye=!1;function He(e){if(!Ye){Ye=!0;var t=0;try{for(;t<e.length;t++){var n=e[t];do n=n(!0);while(n!==null)}e.length=0}catch(o){throw e=e.slice(t+1),o}finally{Ye=!1}}}var Lr=St,Nr=$r,Ur=Dr,zr={map:ke,forEach:er,count:Xt,toArray:tr,only:rr};a.Children=zr,a.Component=_,a.Fragment=b,a.Profiler=I,a.PureComponent=C,a.StrictMode=j,a.Suspense=z,a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=H,a.act=Tt,a.cloneElement=Nr,a.createContext=nr,a.createElement=Lr,a.createFactory=Ur,a.createRef=Nt,a.forwardRef=sr,a.isValidElement=ce,a.lazy=ir,a.memo=ur,a.startTransition=Fr,a.unstable_act=Tt,a.useCallback=hr,a.useContext=cr,a.useDebugValue=_r,a.useDeferredValue=Er,a.useEffect=dr,a.useId=wr,a.useImperativeHandle=gr,a.useInsertionEffect=yr,a.useLayoutEffect=mr,a.useMemo=vr,a.useReducer=fr,a.useRef=pr,a.useState=lr,a.useSyncExternalStore=Cr,a.useTransition=br,a.version=d,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()}(Be,Be.exports)),Be.exports}process.env.NODE_ENV==="production"?Dt.exports=vn():Dt.exports=gn();var _n=Dt.exports,bn=_n;function Br(c,a,d){var m=typeof a=="function";bn.useEffect(function(){var g,b=!0,j=c(function(){return b});return Promise.resolve(j).then(function(I){g=I}),function(){b=!1,m&&a(g)}},m?d:a)}Hr.exports=Br,Hr.exports.useAsyncEffect=Br;const En=i.z.object({type:i.z.string(),loc:i.z.array(i.z.string()),msg:i.z.string(),url:i.z.string()}),wn=i.z.array(En),Cn=i.z.object({code:i.z.string(),message:i.z.string(),path:i.z.array(i.z.string())}),Sn=i.z.array(Cn),Rn={"failed to fetch":"Connection error: please double check if you are connected to the internet, then try again"},$t=c=>{const a=c.toLowerCase().trim();return Rn[a]??c},kn=c=>{try{return typeof JSON.parse(c)=="object"}catch{return!1}},On=c=>c.length===1?$t(c[0].msg):`Please fix the following errors:
40
+ ${c.map(a=>`• ${$t(a.msg)}`).join(`
41
+ `)}`,Tn=c=>`Encountered the following errors:
42
+ ${c.map(a=>`- ${a.path.join("/")}: ${a.message}`).join(`
43
+ `)}`,Gr=c=>{if(c instanceof Error)if(kn(c.message)){const a=JSON.parse(c.message);return wn.safeParse(a).success?On(a):Sn.safeParse(a).success?Tn(a):c.message}else return $t(c.message);if(typeof c=="object")try{return JSON.stringify(c)}catch(a){return a+""}else return c+""},oe=i.z.string().trim().min(1,{message:"Cannot be blank"}),ne=i.z.string().trim().optional(),Ft=c=>i.z.nullable(c.optional());var Ke=(c=>(c.FIRST_NAME="firstName",c.LAST_NAME="lastName",c.EMAIL="email",c.ZIP_CODE="zipCode",c.CITY="city",c.STATE="state",c.COUNTRY="country",c.ADDRESS="address",c.PHONE="phone",c.PROMOTION_CODE="promotionCode",c))(Ke||{});const Jr=i.z.nativeEnum(Ke);var Zr=(c=>(c.CARD_NUMBER="cardNumber",c.CARD_EXPIRY="cardExpiry",c.CARD_CVC="cardCvc",c))(Zr||{});const Qr=i.z.nativeEnum(Zr),Pn=i.z.union([Jr,Qr]),Xr=i.z.object({provider:i.z.string(),processor_name:Ft(i.z.string()),metadata:Ft(i.z.record(i.z.string(),i.z.any()))}),In=i.z.object({id:i.z.string()});i.z.object({cardNumber:ne,expiry:ne,cvc:ne}),i.z.object({backgroundColor:ne,color:ne,fontFamily:ne,fontSize:ne,fontWeight:ne,margin:ne,padding:ne});const G=i.z.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"]),jn=G.extract(["TOKENIZE_STARTED","CHECKOUT_STARTED"]),An=i.z.object({type:jn}),Mn=G.extract(["BLUR","FOCUS","CHANGE"]),Dn=i.z.object({type:Mn,elementType:Qr}),$n=G.extract(["LOAD_ERROR","TOKENIZE_ERROR","CHECKOUT_ERROR"]),Fn=i.z.object({type:$n,message:oe}),xn=G.extract(["VALIDATION_ERROR"]),Ln=i.z.object({type:xn,elementType:Pn,errors:i.z.array(i.z.string())}),Nn=i.z.object({type:i.z.literal(G.enum.LAYOUT),height:oe}),Un=i.z.object({type:i.z.literal(G.enum.LOADED),sessionId:oe,totalAmountAtoms:i.z.number(),currency:ne,checkoutPaymentMethods:i.z.array(Xr)}),zn=i.z.object({type:i.z.literal(G.enum.PAYMENT_FLOW_STARTED),nextActionMetadata:i.z.record(i.z.string(),i.z.any()),paymentFlowMetadata:i.z.any().optional(),startPFMetadata:i.z.optional(i.z.record(i.z.string(),i.z.any()))}),Vn=i.z.object({type:i.z.literal(G.enum.SETUP_PAYMENT_METHOD_SUCCESS),paymentMethodId:i.z.string()}),qn=i.z.object({firstName:oe,lastName:oe,email:oe,zipCode:oe,country:oe,promotionCode:ne}),Yn=G.extract(["TOKENIZE","CHECKOUT","START_PAYMENT_FLOW"]),en=i.z.object({type:Yn,sessionId:oe,checkoutPaymentMethod:Xr,paymentFlowMetadata:i.z.any().optional(),doNotUseLegacyCCFlow:i.z.boolean().optional(),existingCCPMId:ne}).extend(qn.shape),Hn=i.z.object({type:i.z.literal(G.enum.TOKENIZE_SUCCESS),isReadyForCheckout:i.z.boolean()}),Wn=i.z.object({type:i.z.literal(G.enum.CHECKOUT_SUCCESS),invoiceUrls:i.z.array(i.z.string()),subscriptionIds:i.z.array(i.z.string()),customerId:i.z.string()}),Kn=i.z.discriminatedUnion("type",[An,Dn,Fn,Ln,Nn,Un,en,Hn,Wn,zn,Vn]),Bn=i.z.object({payload:Kn,nonce:oe,formId:oe,elementId:oe});i.z.object({amountAtom:i.z.number(),currency:oe}),i.z.object({secure_token:i.z.string(),promotion_code:i.z.string().optional()}),i.z.object({secure_token:i.z.string(),existing_cc_pm_id:Ft(i.z.string())});const Gn=i.z.object({payment_methods:i.z.array(In)}),Jn=c=>{const a={};return Object.entries(c).forEach(([d,m])=>{try{const g=Jr.parse(d);Array.isArray(m)?a[g]=m:Array.isArray(m._errors)&&(a[g]=m._errors)}catch{return}}),a},Zn={usd:"usd",brl:"brl"},xt=async c=>{for(let a=0;a<10;a++)rn()||await Qn(500);if(!rn())throw new Error("Stripe JS not found.");return new Stripe(c)},tn=async(c,a,d,m)=>{const g=await xt(c),b=Zn[d.toLowerCase().trim()];return g.paymentRequest({country:"US",currency:b,total:{label:"Total",amount:a,pending:m},requestPayerName:!0,requestPayerEmail:!0})},Qn=c=>new Promise(a=>{setTimeout(a,c)}),rn=()=>"Stripe"in window,Xn=async c=>new Promise((a,d)=>{try{c.on("paymentmethod",async m=>{a(m)}),c.on("cancel",()=>{d(new Error("Payment cancelled, please click Submit again to pay"))})}catch(m){d(m)}}),eo=c=>{const a=c==null?void 0:c.stripe_pk;if(typeof a!="string")throw new Error("Invalid: stripe_pk not passed in checkout payment method");return a},to=async(c,a)=>{const d=c.nextActionMetadata;if(!c.paymentFlowMetadata||!c.paymentFlowMetadata.stripePmId)throw new Error(`Invalid payment flow metadata format: ${JSON.stringify(c.paymentFlowMetadata)}`);if(!d.stripe_pk||!d.client_secret)throw new Error(`Invalid next action metadata format: ${JSON.stringify(d)}`);if(a.paymentMethod.id!==c.paymentFlowMetadata.stripePmId)throw new Error(`PM ID mismatch: ${a.paymentMethod.id} != ${c.paymentFlowMetadata.stripePmId}`);const m=await(await xt(d.stripe_pk)).confirmCardSetup(d.client_secret,{payment_method:c.paymentFlowMetadata.stripePmId});if(m.error)throw a.complete("fail"),new Error(`Payment failed: ${m.error.message??"unknown"}`);a.complete("success")},ro=async c=>{var a,d,m,g;const b=c.nextActionMetadata,j=await(await xt(b.stripe_pk)).confirmCardSetup(b.client_secret,{payment_method:b.stripe_pm_id}),I=(a=j.setupIntent)==null?void 0:a.status;if(I!=="succeeded")throw I==="canceled"?new Error("Payment cancelled, please click Submit again to pay"):new Error(`${((d=j.error)==null?void 0:d.message)??((g=(m=j.setupIntent)==null?void 0:m.last_setup_error)==null?void 0:g.message)??"Payment failed, please click submit again to pay."}`)},no=c=>JSON.stringify(c),nn=(c,a)=>Array.from(c.querySelectorAll("input[data-opid]")??[]).reduce((d,m)=>{const g=m.getAttribute("data-opid");return g?{...d,[g]:m.value}:d},a),At=(c,a,d,m,g,b,j)=>{const I=nn(d,{type:c,sessionId:a,checkoutPaymentMethod:g,paymentFlowMetadata:j,doNotUseLegacyCCFlow:b});(g.provider==="apple_pay"||g.provider==="google_pay")&&(I[Ke.ZIP_CODE]||(I[Ke.ZIP_CODE]="00000"));const x=en.safeParse(I);if(x.success)return x.data;{const q=x.error.format(),U=Jn(q);for(const[z,ee]of Object.entries(U))m(z,ee,z);return null}},oo=c=>{try{return Bn.parse(c)}catch(a){throw a}},on=(c,a,d,m,g)=>{const b={payload:m,nonce:mn.v4(),formId:a,elementId:d};c.postMessage(JSON.stringify(b),g)};var D={};/**
44
+ * @license React
45
+ * react.production.min.js
46
+ *
47
+ * Copyright (c) Facebook, Inc. and its affiliates.
48
+ *
49
+ * This source code is licensed under the MIT license found in the
50
+ * LICENSE file in the root directory of this source tree.
51
+ */var an;function ao(){if(an)return D;an=1;var c=Symbol.for("react.element"),a=Symbol.for("react.portal"),d=Symbol.for("react.fragment"),m=Symbol.for("react.strict_mode"),g=Symbol.for("react.profiler"),b=Symbol.for("react.provider"),j=Symbol.for("react.context"),I=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),q=Symbol.for("react.memo"),U=Symbol.for("react.lazy"),z=Symbol.iterator;function ee(r){return r===null||typeof r!="object"?null:(r=z&&r[z]||r["@@iterator"],typeof r=="function"?r:null)}var Y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},J=Object.assign,ge={};function K(r,s,h){this.props=r,this.context=s,this.refs=ge,this.updater=h||Y}K.prototype.isReactComponent={},K.prototype.setState=function(r,s){if(typeof r!="object"&&typeof r!="function"&&r!=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,r,s,"setState")},K.prototype.forceUpdate=function(r){this.updater.enqueueForceUpdate(this,r,"forceUpdate")};function _e(){}_e.prototype=K.prototype;function ae(r,s,h){this.props=r,this.context=s,this.refs=ge,this.updater=h||Y}var ie=ae.prototype=new _e;ie.constructor=ae,J(ie,K.prototype),ie.isPureReactComponent=!0;var B=Array.isArray,$=Object.prototype.hasOwnProperty,V={current:null},Z={key:!0,ref:!0,__self:!0,__source:!0};function te(r,s,h){var _,E={},P=null,k=null;if(s!=null)for(_ in s.ref!==void 0&&(k=s.ref),s.key!==void 0&&(P=""+s.key),s)$.call(s,_)&&!Z.hasOwnProperty(_)&&(E[_]=s[_]);var O=arguments.length-2;if(O===1)E.children=h;else if(1<O){for(var C=Array(O),L=0;L<O;L++)C[L]=arguments[L+2];E.children=C}if(r&&r.defaultProps)for(_ in O=r.defaultProps,O)E[_]===void 0&&(E[_]=O[_]);return{$$typeof:c,type:r,key:P,ref:k,props:E,_owner:V.current}}function be(r,s){return{$$typeof:c,type:r.type,key:s,ref:r.ref,props:r.props,_owner:r._owner}}function pe(r){return typeof r=="object"&&r!==null&&r.$$typeof===c}function De(r){var s={"=":"=0",":":"=2"};return"$"+r.replace(/[=:]/g,function(h){return s[h]})}var Ee=/\/+/g;function de(r,s){return typeof r=="object"&&r!==null&&r.key!=null?De(""+r.key):s.toString(36)}function se(r,s,h,_,E){var P=typeof r;(P==="undefined"||P==="boolean")&&(r=null);var k=!1;if(r===null)k=!0;else switch(P){case"string":case"number":k=!0;break;case"object":switch(r.$$typeof){case c:case a:k=!0}}if(k)return k=r,E=E(k),r=_===""?"."+de(k,0):_,B(E)?(h="",r!=null&&(h=r.replace(Ee,"$&/")+"/"),se(E,s,h,"",function(L){return L})):E!=null&&(pe(E)&&(E=be(E,h+(!E.key||k&&k.key===E.key?"":(""+E.key).replace(Ee,"$&/")+"/")+r)),s.push(E)),1;if(k=0,_=_===""?".":_+":",B(r))for(var O=0;O<r.length;O++){P=r[O];var C=_+de(P,O);k+=se(P,s,h,C,E)}else if(C=ee(r),typeof C=="function")for(r=C.call(r),O=0;!(P=r.next()).done;)P=P.value,C=_+de(P,O++),k+=se(P,s,h,C,E);else if(P==="object")throw s=String(r),Error("Objects are not valid as a React child (found: "+(s==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":s)+"). If you meant to render a collection of children, use an array instead.");return k}function H(r,s,h){if(r==null)return r;var _=[],E=0;return se(r,_,"","",function(P){return s.call(h,P,E++)}),_}function Q(r){if(r._status===-1){var s=r._result;s=s(),s.then(function(h){(r._status===0||r._status===-1)&&(r._status=1,r._result=h)},function(h){(r._status===0||r._status===-1)&&(r._status=2,r._result=h)}),r._status===-1&&(r._status=0,r._result=s)}if(r._status===1)return r._result.default;throw r._result}var f={current:null},re={transition:null},we={ReactCurrentDispatcher:f,ReactCurrentBatchConfig:re,ReactCurrentOwner:V};function ue(){throw Error("act(...) is not supported in production builds of React.")}return D.Children={map:H,forEach:function(r,s,h){H(r,function(){s.apply(this,arguments)},h)},count:function(r){var s=0;return H(r,function(){s++}),s},toArray:function(r){return H(r,function(s){return s})||[]},only:function(r){if(!pe(r))throw Error("React.Children.only expected to receive a single React element child.");return r}},D.Component=K,D.Fragment=d,D.Profiler=g,D.PureComponent=ae,D.StrictMode=m,D.Suspense=x,D.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=we,D.act=ue,D.cloneElement=function(r,s,h){if(r==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+r+".");var _=J({},r.props),E=r.key,P=r.ref,k=r._owner;if(s!=null){if(s.ref!==void 0&&(P=s.ref,k=V.current),s.key!==void 0&&(E=""+s.key),r.type&&r.type.defaultProps)var O=r.type.defaultProps;for(C in s)$.call(s,C)&&!Z.hasOwnProperty(C)&&(_[C]=s[C]===void 0&&O!==void 0?O[C]:s[C])}var C=arguments.length-2;if(C===1)_.children=h;else if(1<C){O=Array(C);for(var L=0;L<C;L++)O[L]=arguments[L+2];_.children=O}return{$$typeof:c,type:r.type,key:E,ref:P,props:_,_owner:k}},D.createContext=function(r){return r={$$typeof:j,_currentValue:r,_currentValue2:r,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},r.Provider={$$typeof:b,_context:r},r.Consumer=r},D.createElement=te,D.createFactory=function(r){var s=te.bind(null,r);return s.type=r,s},D.createRef=function(){return{current:null}},D.forwardRef=function(r){return{$$typeof:I,render:r}},D.isValidElement=pe,D.lazy=function(r){return{$$typeof:U,_payload:{_status:-1,_result:r},_init:Q}},D.memo=function(r,s){return{$$typeof:q,type:r,compare:s===void 0?null:s}},D.startTransition=function(r){var s=re.transition;re.transition={};try{r()}finally{re.transition=s}},D.unstable_act=ue,D.useCallback=function(r,s){return f.current.useCallback(r,s)},D.useContext=function(r){return f.current.useContext(r)},D.useDebugValue=function(){},D.useDeferredValue=function(r){return f.current.useDeferredValue(r)},D.useEffect=function(r,s){return f.current.useEffect(r,s)},D.useId=function(){return f.current.useId()},D.useImperativeHandle=function(r,s,h){return f.current.useImperativeHandle(r,s,h)},D.useInsertionEffect=function(r,s){return f.current.useInsertionEffect(r,s)},D.useLayoutEffect=function(r,s){return f.current.useLayoutEffect(r,s)},D.useMemo=function(r,s){return f.current.useMemo(r,s)},D.useReducer=function(r,s,h){return f.current.useReducer(r,s,h)},D.useRef=function(r){return f.current.useRef(r)},D.useState=function(r){return f.current.useState(r)},D.useSyncExternalStore=function(r,s,h){return f.current.useSyncExternalStore(r,s,h)},D.useTransition=function(){return f.current.useTransition()},D.version="18.3.1",D}var Mt={exports:{}};/**
52
+ * @license React
53
+ * react.development.js
54
+ *
55
+ * Copyright (c) Facebook, Inc. and its affiliates.
56
+ *
57
+ * This source code is licensed under the MIT license found in the
58
+ * LICENSE file in the root directory of this source tree.
59
+ */Mt.exports;var sn;function io(){return sn||(sn=1,function(c,a){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 d="18.3.1",m=Symbol.for("react.element"),g=Symbol.for("react.portal"),b=Symbol.for("react.fragment"),j=Symbol.for("react.strict_mode"),I=Symbol.for("react.profiler"),x=Symbol.for("react.provider"),q=Symbol.for("react.context"),U=Symbol.for("react.forward_ref"),z=Symbol.for("react.suspense"),ee=Symbol.for("react.suspense_list"),Y=Symbol.for("react.memo"),J=Symbol.for("react.lazy"),ge=Symbol.for("react.offscreen"),K=Symbol.iterator,_e="@@iterator";function ae(e){if(e===null||typeof e!="object")return null;var t=K&&e[K]||e[_e];return typeof t=="function"?t:null}var ie={current:null},B={transition:null},$={current:null,isBatchingLegacy:!1,didScheduleLegacyUpdate:!1},V={current:null},Z={},te=null;function be(e){te=e}Z.setExtraStackFrame=function(e){te=e},Z.getCurrentStack=null,Z.getStackAddendum=function(){var e="";te&&(e+=te);var t=Z.getCurrentStack;return t&&(e+=t()||""),e};var pe=!1,De=!1,Ee=!1,de=!1,se=!1,H={ReactCurrentDispatcher:ie,ReactCurrentBatchConfig:B,ReactCurrentOwner:V};H.ReactDebugCurrentFrame=Z,H.ReactCurrentActQueue=$;function Q(e){{for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];re("warn",e,n)}}function f(e){{for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];re("error",e,n)}}function re(e,t,n){{var o=H.ReactDebugCurrentFrame,u=o.getStackAddendum();u!==""&&(t+="%s",n=n.concat([u]));var p=n.map(function(l){return String(l)});p.unshift("Warning: "+t),Function.prototype.apply.call(console[e],console,p)}}var we={};function ue(e,t){{var n=e.constructor,o=n&&(n.displayName||n.name)||"ReactClass",u=o+"."+t;if(we[u])return;f("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.",t,o),we[u]=!0}}var r={isMounted:function(e){return!1},enqueueForceUpdate:function(e,t,n){ue(e,"forceUpdate")},enqueueReplaceState:function(e,t,n,o){ue(e,"replaceState")},enqueueSetState:function(e,t,n,o){ue(e,"setState")}},s=Object.assign,h={};Object.freeze(h);function _(e,t,n){this.props=e,this.context=t,this.refs=h,this.updater=n||r}_.prototype.isReactComponent={},_.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=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,e,t,"setState")},_.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};{var E={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)."]},P=function(e,t){Object.defineProperty(_.prototype,e,{get:function(){Q("%s(...) is deprecated in plain JavaScript React classes. %s",t[0],t[1])}})};for(var k in E)E.hasOwnProperty(k)&&P(k,E[k])}function O(){}O.prototype=_.prototype;function C(e,t,n){this.props=e,this.context=t,this.refs=h,this.updater=n||r}var L=C.prototype=new O;L.constructor=C,s(L,_.prototype),L.isPureReactComponent=!0;function Nt(){var e={current:null};return Object.seal(e),e}var Ut=Array.isArray;function Ce(e){return Ut(e)}function zt(e){{var t=typeof Symbol=="function"&&Symbol.toStringTag,n=t&&e[Symbol.toStringTag]||e.constructor.name||"Object";return n}}function Vt(e){try{return Ge(e),!1}catch{return!0}}function Ge(e){return""+e}function Se(e){if(Vt(e))return f("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",zt(e)),Ge(e)}function qt(e,t,n){var o=e.displayName;if(o)return o;var u=t.displayName||t.name||"";return u!==""?n+"("+u+")":n}function Je(e){return e.displayName||"Context"}function X(e){if(e==null)return null;if(typeof e.tag=="number"&&f("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case b:return"Fragment";case g:return"Portal";case I:return"Profiler";case j:return"StrictMode";case z:return"Suspense";case ee:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case q:var t=e;return Je(t)+".Consumer";case x:var n=e;return Je(n._context)+".Provider";case U:return qt(e,e.render,"ForwardRef");case Y:var o=e.displayName||null;return o!==null?o:X(e.type)||"Memo";case J:{var u=e,p=u._payload,l=u._init;try{return X(l(p))}catch{return null}}}return null}var ye=Object.prototype.hasOwnProperty,Ze={key:!0,ref:!0,__self:!0,__source:!0},Qe,Xe,$e;$e={};function et(e){if(ye.call(e,"ref")){var t=Object.getOwnPropertyDescriptor(e,"ref").get;if(t&&t.isReactWarning)return!1}return e.ref!==void 0}function tt(e){if(ye.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return e.key!==void 0}function Yt(e,t){var n=function(){Qe||(Qe=!0,f("%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)",t))};n.isReactWarning=!0,Object.defineProperty(e,"key",{get:n,configurable:!0})}function Ht(e,t){var n=function(){Xe||(Xe=!0,f("%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)",t))};n.isReactWarning=!0,Object.defineProperty(e,"ref",{get:n,configurable:!0})}function Wt(e){if(typeof e.ref=="string"&&V.current&&e.__self&&V.current.stateNode!==e.__self){var t=X(V.current.type);$e[t]||(f('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',t,e.ref),$e[t]=!0)}}var Fe=function(e,t,n,o,u,p,l){var y={$$typeof:m,type:e,key:t,ref:n,props:l,_owner:p};return y._store={},Object.defineProperty(y._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(y,"_self",{configurable:!1,enumerable:!1,writable:!1,value:o}),Object.defineProperty(y,"_source",{configurable:!1,enumerable:!1,writable:!1,value:u}),Object.freeze&&(Object.freeze(y.props),Object.freeze(y)),y};function Kt(e,t,n){var o,u={},p=null,l=null,y=null,v=null;if(t!=null){et(t)&&(l=t.ref,Wt(t)),tt(t)&&(Se(t.key),p=""+t.key),y=t.__self===void 0?null:t.__self,v=t.__source===void 0?null:t.__source;for(o in t)ye.call(t,o)&&!Ze.hasOwnProperty(o)&&(u[o]=t[o])}var w=arguments.length-2;if(w===1)u.children=n;else if(w>1){for(var S=Array(w),R=0;R<w;R++)S[R]=arguments[R+2];Object.freeze&&Object.freeze(S),u.children=S}if(e&&e.defaultProps){var T=e.defaultProps;for(o in T)u[o]===void 0&&(u[o]=T[o])}if(p||l){var A=typeof e=="function"?e.displayName||e.name||"Unknown":e;p&&Yt(u,A),l&&Ht(u,A)}return Fe(e,p,l,y,v,V.current,u)}function Bt(e,t){var n=Fe(e.type,t,e.ref,e._self,e._source,e._owner,e.props);return n}function Gt(e,t,n){if(e==null)throw new Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var o,u=s({},e.props),p=e.key,l=e.ref,y=e._self,v=e._source,w=e._owner;if(t!=null){et(t)&&(l=t.ref,w=V.current),tt(t)&&(Se(t.key),p=""+t.key);var S;e.type&&e.type.defaultProps&&(S=e.type.defaultProps);for(o in t)ye.call(t,o)&&!Ze.hasOwnProperty(o)&&(t[o]===void 0&&S!==void 0?u[o]=S[o]:u[o]=t[o])}var R=arguments.length-2;if(R===1)u.children=n;else if(R>1){for(var T=Array(R),A=0;A<R;A++)T[A]=arguments[A+2];u.children=T}return Fe(e.type,p,l,y,v,w,u)}function ce(e){return typeof e=="object"&&e!==null&&e.$$typeof===m}var rt=".",Jt=":";function Zt(e){var t=/[=:]/g,n={"=":"=0",":":"=2"},o=e.replace(t,function(u){return n[u]});return"$"+o}var nt=!1,Qt=/\/+/g;function ot(e){return e.replace(Qt,"$&/")}function xe(e,t){return typeof e=="object"&&e!==null&&e.key!=null?(Se(e.key),Zt(""+e.key)):t.toString(36)}function Re(e,t,n,o,u){var p=typeof e;(p==="undefined"||p==="boolean")&&(e=null);var l=!1;if(e===null)l=!0;else switch(p){case"string":case"number":l=!0;break;case"object":switch(e.$$typeof){case m:case g:l=!0}}if(l){var y=e,v=u(y),w=o===""?rt+xe(y,0):o;if(Ce(v)){var S="";w!=null&&(S=ot(w)+"/"),Re(v,t,S,"",function(Yr){return Yr})}else v!=null&&(ce(v)&&(v.key&&(!y||y.key!==v.key)&&Se(v.key),v=Bt(v,n+(v.key&&(!y||y.key!==v.key)?ot(""+v.key)+"/":"")+w)),t.push(v));return 1}var R,T,A=0,F=o===""?rt:o+Jt;if(Ce(e))for(var Me=0;Me<e.length;Me++)R=e[Me],T=F+xe(R,Me),A+=Re(R,t,n,T,u);else{var We=ae(e);if(typeof We=="function"){var Pt=e;We===Pt.entries&&(nt||Q("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),nt=!0);for(var Vr=We.call(Pt),It,qr=0;!(It=Vr.next()).done;)R=It.value,T=F+xe(R,qr++),A+=Re(R,t,n,T,u)}else if(p==="object"){var jt=String(e);throw new Error("Objects are not valid as a React child (found: "+(jt==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":jt)+"). If you meant to render a collection of children, use an array instead.")}}return A}function ke(e,t,n){if(e==null)return e;var o=[],u=0;return Re(e,o,"","",function(p){return t.call(n,p,u++)}),o}function Xt(e){var t=0;return ke(e,function(){t++}),t}function er(e,t,n){ke(e,function(){t.apply(this,arguments)},n)}function tr(e){return ke(e,function(t){return t})||[]}function rr(e){if(!ce(e))throw new Error("React.Children.only expected to receive a single React element child.");return e}function nr(e){var t={$$typeof:q,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null};t.Provider={$$typeof:x,_context:t};var n=!1,o=!1,u=!1;{var p={$$typeof:q,_context:t};Object.defineProperties(p,{Provider:{get:function(){return o||(o=!0,f("Rendering <Context.Consumer.Provider> is not supported and will be removed in a future major release. Did you mean to render <Context.Provider> instead?")),t.Provider},set:function(l){t.Provider=l}},_currentValue:{get:function(){return t._currentValue},set:function(l){t._currentValue=l}},_currentValue2:{get:function(){return t._currentValue2},set:function(l){t._currentValue2=l}},_threadCount:{get:function(){return t._threadCount},set:function(l){t._threadCount=l}},Consumer:{get:function(){return n||(n=!0,f("Rendering <Context.Consumer.Consumer> is not supported and will be removed in a future major release. Did you mean to render <Context.Consumer> instead?")),t.Consumer}},displayName:{get:function(){return t.displayName},set:function(l){u||(Q("Setting `displayName` on Context.Consumer has no effect. You should set it directly on the context with Context.displayName = '%s'.",l),u=!0)}}}),t.Consumer=p}return t._currentRenderer=null,t._currentRenderer2=null,t}var me=-1,Le=0,at=1,or=2;function ar(e){if(e._status===me){var t=e._result,n=t();if(n.then(function(p){if(e._status===Le||e._status===me){var l=e;l._status=at,l._result=p}},function(p){if(e._status===Le||e._status===me){var l=e;l._status=or,l._result=p}}),e._status===me){var o=e;o._status=Le,o._result=n}}if(e._status===at){var u=e._result;return u===void 0&&f(`lazy: Expected the result of a dynamic import() call. Instead received: %s
60
+
61
+ Your code should look like:
62
+ const MyComponent = lazy(() => import('./MyComponent'))
63
+
64
+ Did you accidentally put curly braces around the import?`,u),"default"in u||f(`lazy: Expected the result of a dynamic import() call. Instead received: %s
65
+
66
+ Your code should look like:
67
+ const MyComponent = lazy(() => import('./MyComponent'))`,u),u.default}else throw e._result}function ir(e){var t={_status:me,_result:e},n={$$typeof:J,_payload:t,_init:ar};{var o,u;Object.defineProperties(n,{defaultProps:{configurable:!0,get:function(){return o},set:function(p){f("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."),o=p,Object.defineProperty(n,"defaultProps",{enumerable:!0})}},propTypes:{configurable:!0,get:function(){return u},set:function(p){f("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."),u=p,Object.defineProperty(n,"propTypes",{enumerable:!0})}}})}return n}function sr(e){e!=null&&e.$$typeof===Y?f("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."):typeof e!="function"?f("forwardRef requires a render function but was given %s.",e===null?"null":typeof e):e.length!==0&&e.length!==2&&f("forwardRef render functions accept exactly two parameters: props and ref. %s",e.length===1?"Did you forget to use the ref parameter?":"Any additional parameter will be undefined."),e!=null&&(e.defaultProps!=null||e.propTypes!=null)&&f("forwardRef render functions do not support propTypes or defaultProps. Did you accidentally pass a React component?");var t={$$typeof:U,render:e};{var n;Object.defineProperty(t,"displayName",{enumerable:!1,configurable:!0,get:function(){return n},set:function(o){n=o,!e.name&&!e.displayName&&(e.displayName=o)}})}return t}var it;it=Symbol.for("react.module.reference");function st(e){return!!(typeof e=="string"||typeof e=="function"||e===b||e===I||se||e===j||e===z||e===ee||de||e===ge||pe||De||Ee||typeof e=="object"&&e!==null&&(e.$$typeof===J||e.$$typeof===Y||e.$$typeof===x||e.$$typeof===q||e.$$typeof===U||e.$$typeof===it||e.getModuleId!==void 0))}function ur(e,t){st(e)||f("memo: The first argument must be a component. Instead received: %s",e===null?"null":typeof e);var n={$$typeof:Y,type:e,compare:t===void 0?null:t};{var o;Object.defineProperty(n,"displayName",{enumerable:!1,configurable:!0,get:function(){return o},set:function(u){o=u,!e.name&&!e.displayName&&(e.displayName=u)}})}return n}function N(){var e=ie.current;return e===null&&f(`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:
68
+ 1. You might have mismatching versions of React and the renderer (such as React DOM)
69
+ 2. You might be breaking the Rules of Hooks
70
+ 3. You might have more than one copy of React in the same app
71
+ See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.`),e}function cr(e){var t=N();if(e._context!==void 0){var n=e._context;n.Consumer===e?f("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?"):n.Provider===e&&f("Calling useContext(Context.Provider) is not supported. Did you mean to call useContext(Context) instead?")}return t.useContext(e)}function lr(e){var t=N();return t.useState(e)}function fr(e,t,n){var o=N();return o.useReducer(e,t,n)}function pr(e){var t=N();return t.useRef(e)}function dr(e,t){var n=N();return n.useEffect(e,t)}function yr(e,t){var n=N();return n.useInsertionEffect(e,t)}function mr(e,t){var n=N();return n.useLayoutEffect(e,t)}function hr(e,t){var n=N();return n.useCallback(e,t)}function vr(e,t){var n=N();return n.useMemo(e,t)}function gr(e,t,n){var o=N();return o.useImperativeHandle(e,t,n)}function _r(e,t){{var n=N();return n.useDebugValue(e,t)}}function br(){var e=N();return e.useTransition()}function Er(e){var t=N();return t.useDeferredValue(e)}function wr(){var e=N();return e.useId()}function Cr(e,t,n){var o=N();return o.useSyncExternalStore(e,t,n)}var he=0,ut,ct,lt,ft,pt,dt,yt;function mt(){}mt.__reactDisabledLog=!0;function Sr(){{if(he===0){ut=console.log,ct=console.info,lt=console.warn,ft=console.error,pt=console.group,dt=console.groupCollapsed,yt=console.groupEnd;var e={configurable:!0,enumerable:!0,value:mt,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}he++}}function Rr(){{if(he--,he===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:s({},e,{value:ut}),info:s({},e,{value:ct}),warn:s({},e,{value:lt}),error:s({},e,{value:ft}),group:s({},e,{value:pt}),groupCollapsed:s({},e,{value:dt}),groupEnd:s({},e,{value:yt})})}he<0&&f("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Ne=H.ReactCurrentDispatcher,Ue;function Oe(e,t,n){{if(Ue===void 0)try{throw Error()}catch(u){var o=u.stack.trim().match(/\n( *(at )?)/);Ue=o&&o[1]||""}return`
72
+ `+Ue+e}}var ze=!1,Te;{var kr=typeof WeakMap=="function"?WeakMap:Map;Te=new kr}function ht(e,t){if(!e||ze)return"";{var n=Te.get(e);if(n!==void 0)return n}var o;ze=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var p;p=Ne.current,Ne.current=null,Sr();try{if(t){var l=function(){throw Error()};if(Object.defineProperty(l.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(l,[])}catch(F){o=F}Reflect.construct(e,[],l)}else{try{l.call()}catch(F){o=F}e.call(l.prototype)}}else{try{throw Error()}catch(F){o=F}e()}}catch(F){if(F&&o&&typeof F.stack=="string"){for(var y=F.stack.split(`
73
+ `),v=o.stack.split(`
74
+ `),w=y.length-1,S=v.length-1;w>=1&&S>=0&&y[w]!==v[S];)S--;for(;w>=1&&S>=0;w--,S--)if(y[w]!==v[S]){if(w!==1||S!==1)do if(w--,S--,S<0||y[w]!==v[S]){var R=`
75
+ `+y[w].replace(" at new "," at ");return e.displayName&&R.includes("<anonymous>")&&(R=R.replace("<anonymous>",e.displayName)),typeof e=="function"&&Te.set(e,R),R}while(w>=1&&S>=0);break}}}finally{ze=!1,Ne.current=p,Rr(),Error.prepareStackTrace=u}var T=e?e.displayName||e.name:"",A=T?Oe(T):"";return typeof e=="function"&&Te.set(e,A),A}function Or(e,t,n){return ht(e,!1)}function Tr(e){var t=e.prototype;return!!(t&&t.isReactComponent)}function Pe(e,t,n){if(e==null)return"";if(typeof e=="function")return ht(e,Tr(e));if(typeof e=="string")return Oe(e);switch(e){case z:return Oe("Suspense");case ee:return Oe("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case U:return Or(e.render);case Y:return Pe(e.type,t,n);case J:{var o=e,u=o._payload,p=o._init;try{return Pe(p(u),t,n)}catch{}}}return""}var vt={},gt=H.ReactDebugCurrentFrame;function Ie(e){if(e){var t=e._owner,n=Pe(e.type,e._source,t?t.type:null);gt.setExtraStackFrame(n)}else gt.setExtraStackFrame(null)}function Pr(e,t,n,o,u){{var p=Function.call.bind(ye);for(var l in e)if(p(e,l)){var y=void 0;try{if(typeof e[l]!="function"){var v=Error((o||"React class")+": "+n+" type `"+l+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[l]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw v.name="Invariant Violation",v}y=e[l](t,l,o,n,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(w){y=w}y&&!(y instanceof Error)&&(Ie(u),f("%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).",o||"React class",n,l,typeof y),Ie(null)),y instanceof Error&&!(y.message in vt)&&(vt[y.message]=!0,Ie(u),f("Failed %s type: %s",n,y.message),Ie(null))}}}function le(e){if(e){var t=e._owner,n=Pe(e.type,e._source,t?t.type:null);be(n)}else be(null)}var Ve;Ve=!1;function _t(){if(V.current){var e=X(V.current.type);if(e)return`
76
+
77
+ Check the render method of \``+e+"`."}return""}function Ir(e){if(e!==void 0){var t=e.fileName.replace(/^.*[\\\/]/,""),n=e.lineNumber;return`
78
+
79
+ Check your code at `+t+":"+n+"."}return""}function jr(e){return e!=null?Ir(e.__source):""}var bt={};function Ar(e){var t=_t();if(!t){var n=typeof e=="string"?e:e.displayName||e.name;n&&(t=`
80
+
81
+ Check the top-level render call using <`+n+">.")}return t}function Et(e,t){if(!(!e._store||e._store.validated||e.key!=null)){e._store.validated=!0;var n=Ar(t);if(!bt[n]){bt[n]=!0;var o="";e&&e._owner&&e._owner!==V.current&&(o=" It was passed a child from "+X(e._owner.type)+"."),le(e),f('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',n,o),le(null)}}}function wt(e,t){if(typeof e=="object"){if(Ce(e))for(var n=0;n<e.length;n++){var o=e[n];ce(o)&&Et(o,t)}else if(ce(e))e._store&&(e._store.validated=!0);else if(e){var u=ae(e);if(typeof u=="function"&&u!==e.entries)for(var p=u.call(e),l;!(l=p.next()).done;)ce(l.value)&&Et(l.value,t)}}}function Ct(e){{var t=e.type;if(t==null||typeof t=="string")return;var n;if(typeof t=="function")n=t.propTypes;else if(typeof t=="object"&&(t.$$typeof===U||t.$$typeof===Y))n=t.propTypes;else return;if(n){var o=X(t);Pr(n,e.props,"prop",o,e)}else if(t.PropTypes!==void 0&&!Ve){Ve=!0;var u=X(t);f("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",u||"Unknown")}typeof t.getDefaultProps=="function"&&!t.getDefaultProps.isReactClassApproved&&f("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Mr(e){{for(var t=Object.keys(e.props),n=0;n<t.length;n++){var o=t[n];if(o!=="children"&&o!=="key"){le(e),f("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",o),le(null);break}}e.ref!==null&&(le(e),f("Invalid attribute `ref` supplied to `React.Fragment`."),le(null))}}function St(e,t,n){var o=st(e);if(!o){var u="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(u+=" 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 p=jr(t);p?u+=p:u+=_t();var l;e===null?l="null":Ce(e)?l="array":e!==void 0&&e.$$typeof===m?(l="<"+(X(e.type)||"Unknown")+" />",u=" Did you accidentally export a JSX literal instead of a component?"):l=typeof e,f("React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",l,u)}var y=Kt.apply(this,arguments);if(y==null)return y;if(o)for(var v=2;v<arguments.length;v++)wt(arguments[v],e);return e===b?Mr(y):Ct(y),y}var Rt=!1;function Dr(e){var t=St.bind(null,e);return t.type=e,Rt||(Rt=!0,Q("React.createFactory() is deprecated and will be removed in a future major release. Consider using JSX or use React.createElement() directly instead.")),Object.defineProperty(t,"type",{enumerable:!1,get:function(){return Q("Factory.type is deprecated. Access the class directly before passing it to createFactory."),Object.defineProperty(this,"type",{value:e}),e}}),t}function $r(e,t,n){for(var o=Gt.apply(this,arguments),u=2;u<arguments.length;u++)wt(arguments[u],o.type);return Ct(o),o}function Fr(e,t){var n=B.transition;B.transition={};var o=B.transition;B.transition._updatedFibers=new Set;try{e()}finally{if(B.transition=n,n===null&&o._updatedFibers){var u=o._updatedFibers.size;u>10&&Q("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."),o._updatedFibers.clear()}}}var kt=!1,je=null;function xr(e){if(je===null)try{var t=("require"+Math.random()).slice(0,7),n=c&&c[t];je=n.call(c,"timers").setImmediate}catch{je=function(o){kt===!1&&(kt=!0,typeof MessageChannel>"u"&&f("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 u=new MessageChannel;u.port1.onmessage=o,u.port2.postMessage(void 0)}}return je(e)}var fe=0,Ot=!1;function Tt(e){{var t=fe;fe++,$.current===null&&($.current=[]);var n=$.isBatchingLegacy,o;try{if($.isBatchingLegacy=!0,o=e(),!n&&$.didScheduleLegacyUpdate){var u=$.current;u!==null&&($.didScheduleLegacyUpdate=!1,He(u))}}catch(T){throw Ae(t),T}finally{$.isBatchingLegacy=n}if(o!==null&&typeof o=="object"&&typeof o.then=="function"){var p=o,l=!1,y={then:function(T,A){l=!0,p.then(function(F){Ae(t),fe===0?qe(F,T,A):T(F)},function(F){Ae(t),A(F)})}};return!Ot&&typeof Promise<"u"&&Promise.resolve().then(function(){}).then(function(){l||(Ot=!0,f("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 () => ...);"))}),y}else{var v=o;if(Ae(t),fe===0){var w=$.current;w!==null&&(He(w),$.current=null);var S={then:function(T,A){$.current===null?($.current=[],qe(v,T,A)):T(v)}};return S}else{var R={then:function(T,A){T(v)}};return R}}}}function Ae(e){e!==fe-1&&f("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. "),fe=e}function qe(e,t,n){{var o=$.current;if(o!==null)try{He(o),xr(function(){o.length===0?($.current=null,t(e)):qe(e,t,n)})}catch(u){n(u)}else t(e)}}var Ye=!1;function He(e){if(!Ye){Ye=!0;var t=0;try{for(;t<e.length;t++){var n=e[t];do n=n(!0);while(n!==null)}e.length=0}catch(o){throw e=e.slice(t+1),o}finally{Ye=!1}}}var Lr=St,Nr=$r,Ur=Dr,zr={map:ke,forEach:er,count:Xt,toArray:tr,only:rr};a.Children=zr,a.Component=_,a.Fragment=b,a.Profiler=I,a.PureComponent=C,a.StrictMode=j,a.Suspense=z,a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=H,a.act=Tt,a.cloneElement=Nr,a.createContext=nr,a.createElement=Lr,a.createFactory=Ur,a.createRef=Nt,a.forwardRef=sr,a.isValidElement=ce,a.lazy=ir,a.memo=ur,a.startTransition=Fr,a.unstable_act=Tt,a.useCallback=hr,a.useContext=cr,a.useDebugValue=_r,a.useDeferredValue=Er,a.useEffect=dr,a.useId=wr,a.useImperativeHandle=gr,a.useInsertionEffect=yr,a.useLayoutEffect=mr,a.useMemo=vr,a.useReducer=fr,a.useRef=pr,a.useState=lr,a.useSyncExternalStore=Cr,a.useTransition=br,a.version=d,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()}(Mt,Mt.exports)),Mt.exports}process.env.NODE_ENV==="production"?ao():io();const so=async c=>{if(typeof c!="object"||!c)return!1;try{const a={type:"ping"},d=await c.send(a);if(d!==!0)throw new Error(`Expected 'true' after ping, got ${JSON.stringify(d)}`);return!0}catch{return!1}},uo=(c,a)=>!!c&&a,W=c=>i.z.nullable(c.optional());i.z.string().trim().min(1,{message:"Cannot be blank"});const co=i.z.object({cde_response_type:i.z.literal("error"),message:i.z.string()}),lo=i.z.enum(["usd","brl"]),un=i.z.object({name:i.z.string(),amount_atom_off:W(i.z.number()),percent_off:W(i.z.number()),currency:W(i.z.string()),duration:i.z.string(),duration_in_months:W(i.z.number())}),fo=i.z.object({amount_subtotal_atom:i.z.number().int(),amount_total_atom:i.z.number().int(),currency:i.z.string(),description:W(i.z.string()),price_id:i.z.string(),billing_interval:W(i.z.string()),billing_interval_count:W(i.z.number().int()),quantity:i.z.number().int()}),po=i.z.record(i.z.string(),i.z.any()),yo=i.z.object({name:i.z.string(),settings:W(po)}),mo=i.z.object({provider:i.z.string(),processor_name:W(i.z.string()),metadata:W(i.z.record(i.z.string(),i.z.any()))}),ho=i.z.object({quantity:i.z.number()}),vo=i.z.object({id:W(i.z.string()),billing_interval:W(i.z.string()),billing_interval_count:W(i.z.number().int()),subscription_items:i.z.array(ho),trial_start:W(i.z.string()),trial_end:W(i.z.string())}),cn=i.z.object({amount_atom:i.z.number()}),go=i.z.object({amount_atom:i.z.number(),amount_atom_considering_discount_applied:i.z.number(),currency:i.z.string(),discount_amount_atoms:i.z.array(cn),subscription_item_id:i.z.string()}),_o=i.z.object({coupon:un}),bo=i.z.object({currency:i.z.string(),discounts:i.z.array(_o),hosted_invoice_url:W(i.z.string()),lines:i.z.array(go),remaining_amount_atom:i.z.number(),tax_amount_atom:i.z.number(),total_amount_atom:i.z.number(),total_discount_amount_atoms:i.z.array(cn)}),ln=i.z.object({created:i.z.array(vo),invoices:i.z.array(bo)}),fn=i.z.object({preview:ln,preview_post_trial:W(ln),coupons:i.z.array(un)}),pn=i.z.object({status:i.z.literal("open"),token:i.z.string(),email:W(i.z.string()),line_items:i.z.array(fo),amount_subtotal_atom:i.z.number().int(),amount_total_atom:i.z.number().int(),brand:yo,subs_preview:W(fn),methods_available:i.z.array(mo)}),dn=i.z.discriminatedUnion("mode",[i.z.object({mode:i.z.literal("setup"),currency:i.z.nullable(i.z.undefined())}).extend(pn.shape),i.z.object({mode:i.z.enum(["payment","subscription"]),currency:lo}).extend(pn.shape)]),Eo=i.z.object({status:i.z.literal("complete")}),wo=i.z.object({status:i.z.literal("expired")});i.z.union([dn,Eo,wo]),i.z.object({logo:i.z.string(),icon:i.z.string(),primary_color:i.z.string(),secondary_color:i.z.string()}),i.z.object({invoice_urls:i.z.array(i.z.string()),subscription_ids:i.z.array(i.z.string()),customer_id:i.z.string()}),i.z.object({payment_method_id:i.z.string()}),i.z.object({id:i.z.string(),return_url:i.z.string()});const Co=i.z.object({type:i.z.string(),loc:i.z.array(i.z.string()),msg:i.z.string(),url:i.z.string()});i.z.array(Co),i.z.object({required_user_actions:i.z.array(i.z.record(i.z.string(),i.z.any()))}),i.z.object({required_user_actions:i.z.array(i.z.record(i.z.string(),i.z.any())),cc_pm_id:i.z.string()});const Lt=async(c,a,d)=>{const m=await c.send(a);if(Ro(m))throw new Error(`[cde-client] Error querying CDE: ${m.message}`);if(!So(m,d)){const g=d.safeParse(m);throw g.success?new Error("Invalid state"):g.error}return m},So=(c,a)=>a.safeParse(c).success,Ro=c=>co.safeParse(c).success,ko=async(c,a)=>await Lt(c,{type:"get_checkout_preview",payload:a},fn),yn=async c=>await Lt(c,{type:"get_prefill",payload:{}},dn),Oo=async(c,a)=>await Lt(c,{type:"confirm_payment_flow",payload:a},Gn);class To{constructor(a){this.formInstance=a,this.config=a.config,this.formId=a.formId,this.eventTargets={},this.nonces=new Set,this.tokenizedData=null,this.tokenized=0,this.connectionManager=a.getConnectionManager()}setTokenizedData(a){this.tokenizedData=a}handleMessage(a){if(a.origin!==this.formInstance.config.baseUrl||!a.source)return;const d=oo(JSON.parse(a.data));if(!this.validateEvent(d))return;const{elementId:g,payload:b}=d;switch(b.type){case"LAYOUT":this.handleLayoutEvent(b);break;case"FOCUS":this.handleFocusEvent(g);break;case"BLUR":this.handleBlurEvent(g);break;case"CHANGE":this.handleChangeEvent(g);break;case"LOADED":this.handleLoadedEvent(a.source,g,b);break;case"TOKENIZE_STARTED":this.handleTokenizeStartedEvent();break;case"PAYMENT_FLOW_STARTED":this.handlePaymentFlowStartedEvent(b,a.source,g);break;case"TOKENIZE_SUCCESS":this.handleTokenizeSuccessEvent(a.source,g,b);break;case"CHECKOUT_SUCCESS":this.handleCheckoutSuccessEvent(b);break;case"SETUP_PAYMENT_METHOD_SUCCESS":this.handleSetupPaymentMethodSuccessEvent(b);break;case"LOAD_ERROR":this.handleLoadErrorEvent(b);break;case"VALIDATION_ERROR":this.handleValidationErrorEvent(b,g);break;case"TOKENIZE_ERROR":case"CHECKOUT_ERROR":this.handleErrorEvent(b);break}}validateEvent(a){return a.formId!==this.formInstance.formId||!a.elementId||this.nonces.has(a.nonce)?!1:(this.nonces.add(a.nonce),!0)}handleLayoutEvent(a){const d=a.height?`${a.height}px`:"100%";this.formInstance.setFormHeight(d)}handleFocusEvent(a){this.config.onFocus&&this.config.onFocus(a)}handleBlurEvent(a){this.config.onBlur&&this.config.onBlur(a)}handleChangeEvent(a){this.config.onChange&&this.config.onChange(a)}handleLoadedEvent(a,d,m){this.eventTargets[d]=a,this.formInstance.sessionId||(this.formInstance.sessionId=m.sessionId),this.config.onLoad&&this.config.onLoad(m.totalAmountAtoms,m.currency),this.formInstance.checkoutPaymentMethods=m.checkoutPaymentMethods}handleTokenizeStartedEvent(){this.formInstance.config.onCheckoutStarted&&this.formInstance.config.onCheckoutStarted()}async handlePaymentFlowStartedEvent(a,d,m){var j;if(!this.tokenizedData)throw new Error("tokenizedData not populated");const g=this.connectionManager.getConnection(),b=async()=>{var q;const I=a.nextActionMetadata.type;if(I!==void 0)if(I==="stripe_3ds")await ro(a);else if(I==="stripe_payment_request"){if(!this.formInstance.getStripePm())throw new Error("Stripe PM not set");await to(a,this.formInstance.getStripePm())}else throw new Error(`Unknown next action type: ${I}`);const x=await yn(g);if(x.mode==="setup"){const{payment_methods:U}=await Oo(g,{secure_token:x.token,existing_cc_pm_id:(q=this.tokenizedData)==null?void 0:q.existingCCPMId});if(U.length!==1)throw new Error(`Expected exactly one payment method, got ${U.length}`);return this.tokenized=0,this.formInstance.checkoutFired=!1,this.formInstance.config.onSetupPaymentMethodSuccess&&this.formInstance.config.onSetupPaymentMethodSuccess(U[0].id),{proceedToCheckout:!1}}else return{proceedToCheckout:!0}};try{const{proceedToCheckout:I}=await b();if(!I)return;let x;if(this.tokenizedData.checkoutPaymentMethod.provider==="credit_card"&&(x=(j=a.startPFMetadata)==null?void 0:j.cc_pm_id,!x))throw new Error("CC PM ID not found");on(d,this.formInstance.formId,m,{...this.tokenizedData,type:"CHECKOUT",doNotUseLegacyCCFlow:!0,existingCCPMId:x},this.formInstance.config.baseUrl),this.formInstance.checkoutFired=!0,this.tokenizedData=null,this.formInstance.config.onCheckoutStarted&&this.formInstance.config.onCheckoutStarted()}catch(I){const x=Gr(I);this.formInstance.checkoutFired=!1,this.formInstance.config.onCheckoutError&&this.formInstance.config.onCheckoutError(x)}}handleTokenizeSuccessEvent(a,d,m){if(!this.tokenizedData)throw new Error("Tokenized data not found");const g=this.tokenized+1,b=g===Object.keys(this.eventTargets).length;!this.formInstance.checkoutFired&&(b||m.isReadyForCheckout)?(this.tokenizedData.type=this.tokenizedData.type===G.enum.TOKENIZE?G.enum.CHECKOUT:G.enum.START_PAYMENT_FLOW,this.postEventToFrame(a,d,this.tokenizedData),this.tokenizedData=null):this.tokenized=g}handleCheckoutSuccessEvent(a){this.formInstance.config.onCheckoutSuccess&&this.formInstance.config.onCheckoutSuccess(a.invoiceUrls,a.subscriptionIds,a.customerId)}handleSetupPaymentMethodSuccessEvent(a){this.formInstance.config.onSetupPaymentMethodSuccess&&this.formInstance.config.onSetupPaymentMethodSuccess(a.paymentMethodId)}handleLoadErrorEvent(a){this.formInstance.config.onLoadError&&this.formInstance.config.onLoadError(a.message)}handleValidationErrorEvent(a,d){this.formInstance.config.onValidationError&&this.formInstance.config.onValidationError(a.elementType,a.errors,d)}handleErrorEvent(a){var d;if(a.message==="3DS_REQUIRED"){const m=(d=this.formInstance.checkoutPaymentMethods)==null?void 0:d.find(g=>g.provider==="credit_card");if(!this.formInstance.sessionId||!this.formInstance.formTarget||!this.config.onValidationError||!m)return;for(const[g,b]of Object.entries(this.eventTargets)){if(!b)continue;const j=At(G.enum.START_PAYMENT_FLOW,this.formInstance.sessionId,document.querySelector(this.formInstance.formTarget)??document.body,this.config.onValidationError,{...m,processor_name:"stripe"},!1);if(j){this.formInstance.checkoutFired=!0,this.tokenizedData=j,this.postEventToFrame(b,g,j);break}}}else this.formInstance.checkoutFired=!1,this.formInstance.config.onCheckoutError&&this.formInstance.config.onCheckoutError(a.message)}handleFormSubmit(){var m;if(!this.formInstance.sessionId||!((m=this.formInstance.checkoutPaymentMethods)!=null&&m.length)||!this.config.onValidationError)return;const a=this.formInstance.checkoutPaymentMethods.find(g=>g.provider==="credit_card");if(!a)throw new Error("Card not available as a payment method in checkout");const d=At(G.enum.TOKENIZE,this.formInstance.sessionId,document.querySelector(this.formInstance.formTarget)??document.body,this.config.onValidationError,a,!1);if(!d)throw new Error("Error constructing tokenize data");for(const[g,b]of Object.entries(this.eventTargets))b&&this.postEventToFrame(b,g,d);this.tokenizedData=d}postEventToFrame(a,d,m){on(a,this.formId,d,m,this.config.baseUrl)}}async function Po(c){const d=await hn.connectToChild({iframe:c,debug:!0}).promise,m=await so(d);if(!uo(d,m))throw new Error("Got invalid CDE connection object");return d}class Io{constructor(){this.connections=new Map}addConnection(a,d){this.connections.set(a,d)}getConnection(){const a=this.connections.values().next().value;if(!a)throw new Error("Connection not found");return a}}async function jo(c,a,d,m,g,b){const j={apple_pay:{isLoading:!0,isAvailable:!1,startFlow:async()=>{}},google_pay:{isLoading:!0,isAvailable:!1,startFlow:async()=>{}}};for(const I of["apple_pay","google_pay"])try{const x=a.find(z=>z.provider===I&&z.processor_name==="stripe");if(!x)throw new Error(`${I} is not available as a checkout method`);const q=eo(x.metadata),U=await Ao(q,I);j[I]={isLoading:!1,isAvailable:U,startFlow:z=>Mo(d,c.checkoutSecureToken,document.querySelector(c.formTarget),x,q,m,g,b,z)}}catch{j[I]={isLoading:!1,isAvailable:!1,startFlow:async()=>{}}}return j}async function Ao(c,a){const m=await tn(c,1e3,"usd"),g=await m.canMakePayment();if(m.abort(),!g)throw new Error(`Cannot make payment with ${a} for this session`);return g[a==="apple_pay"?"applePay":"googlePay"]}async function Mo(c,a,d,m,g,b,j,I,x){try{const q=nn(d,{});if(!Do(d,j,m))return;const z=(await yn(c)).mode==="setup",ee=await $o(z,x,q,c,a),Y=await tn(g,ee.amountAtom,ee.currency,z);await Y.canMakePayment(),Y.show();const J=await Xn(Y);b(J,m)}catch(q){I(Gr(q))}}function Do(c,a,d){return!!At(G.enum.START_PAYMENT_FLOW,"dummy",c,a??(()=>{}),d,!1)}async function $o(c,a,d,m,g){if(c)return(a==null?void 0:a.amountToDisplayForSetupMode)??{amountAtom:0,currency:"usd"};a!=null&&a.amountToDisplayForSetupMode;const b=ne.safeParse(d[Ke.PROMOTION_CODE]);if(!b.success)throw new Error(`Unknown promo code type: ${b.error.message}`);const j=await ko(m,{secure_token:g,promotion_code:b.data}),I=new Set(j.preview.invoices.map(U=>U.currency));if(I.size!==1)throw new Error(`Expected exactly one currency, got ${I.size}`);const x=I.values().next().value;return{amountAtom:j.preview.invoices.reduce((U,z)=>U+z.remaining_amount_atom,0),currency:x}}class Fo{constructor(a){this.config={...a,baseUrl:a.baseUrl??"https://cde.getopenpay.com"},this.elements=null,this.formId=`opjs-form-${window.crypto.randomUUID()}`,this.referer=window.location.origin,this.formTarget=a.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 Io,this.eventHandler=new To(this),window.addEventListener("message",this.eventHandler.handleMessage.bind(this.eventHandler))}getStripePm(){return this.stripePm}getConnectionManager(){return this.connectionManager}setFormHeight(a){this.formProperties.height=a,this.elements&&Object.values(this.elements).forEach(d=>{d.node.style.height=a})}initPaymentRequests(){return{apple_pay:{isLoading:!0,isAvailable:!1,startFlow:async()=>{}},google_pay:{isLoading:!0,isAvailable:!1,startFlow:async()=>{}}}}createElement(a,d={}){if(!this.config)throw new Error("OpenPay form not initialized");const m=document.createElement("iframe"),g=this.buildQueryString(d);m.name=`${a}-element`,m.src=`${this.config.baseUrl}/app/v1/${a}-element/?${g.toString()}`,m.style.border="none",m.style.width="100%";const b={type:a,node:m,mount:j=>{var I;return(I=document.querySelector(j))==null?void 0:I.appendChild(m)}};return this.elements?this.elements[a]=b:(this.elements={[a]:b},this.connectToElement(b)),b}buildQueryString(a){const d=new URLSearchParams;return d.append("referer",this.referer),d.append("formId",this.formId),a.styles&&d.append("styles",no(a.styles)),d.append("secureToken",this.config.checkoutSecureToken),d}connectToElement(a){Po(a.node).then(d=>{this.connectionManager.addConnection(a.type,d),this.initializePaymentRequests()}).catch(d=>{})}submit(){this.eventHandler.handleFormSubmit()}async onUserCompletePaymentRequestUI(a,d){if(!(!this.config.onValidationError||!this.sessionId||!this.checkoutPaymentMethods))for(const[m,g]of Object.entries(this.eventHandler.eventTargets??{})){const b={stripePmId:a.paymentMethod.id},j=At(G.enum.START_PAYMENT_FLOW,this.sessionId,document.querySelector(this.formTarget)??document.body,this.config.onValidationError,d,!1,b);if(j){this.stripePm=a,this.checkoutFired=!0,this.eventHandler.setTokenizedData(j),this.eventHandler.postEventToFrame(g,m,j);break}}}onPaymentRequestError(a){this.checkoutFired=!1,this.config.onCheckoutError&&this.config.onCheckoutError(a)}async initializePaymentRequests(){if(!this.config.checkoutSecureToken||!this.checkoutPaymentMethods||!this.formTarget)return;const a=this.connectionManager.getConnection();a&&(this.paymentRequests=await jo(this.config,this.checkoutPaymentMethods,a,this.onUserCompletePaymentRequestUI.bind(this),this.config.onValidationError,this.onPaymentRequestError.bind(this)),this.config.onPaymentRequestLoad&&this.config.onPaymentRequestLoad(this.paymentRequests))}destroy(){for(const a of Object.values(this.elements??{}))a.node.remove();window.removeEventListener("message",this.eventHandler.handleMessage.bind(this.eventHandler))}}ve.FieldName=Ke,ve.OpenPayForm=Fo,Object.defineProperty(ve,Symbol.toStringTag,{value:"Module"})});