File: /home/frenchy/refonte2023/wordpress/wp-content/plugins/give/build/donationFormApp.js
!function(){var e={4184:function(e,t){var r;!function(){"use strict";var n={}.hasOwnProperty;function s(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var a=typeof r;if("string"===a||"number"===a)e.push(r);else if(Array.isArray(r)){if(r.length){var o=s.apply(null,r);o&&e.push(o)}}else if("object"===a){if(r.toString!==Object.prototype.toString&&!r.toString.toString().includes("[native code]")){e.push(r.toString());continue}for(var i in r)n.call(r,i)&&r[i]&&e.push(i)}}}return e.join(" ")}e.exports?(s.default=s,e.exports=s):void 0===(r=function(){return s}.apply(t,[]))||(e.exports=r)}()},2705:function(e){var t;self,t=()=>{return e={7629:(e,t,r)=>{"use strict";const n=r(375),s=r(8571),a=r(9474),o=r(1687),i=r(8652),l=r(8160),c=r(3292),u=r(6354),f=r(8901),d=r(9708),m=r(6914),p=r(2294),h=r(6133),g=r(1152),y=r(8863),v=r(2036),b={Base:class{constructor(e){this.type=e,this.$_root=null,this._definition={},this._reset()}_reset(){this._ids=new p.Ids,this._preferences=null,this._refs=new h.Manager,this._cache=null,this._valids=null,this._invalids=null,this._flags={},this._rules=[],this._singleRules=new Map,this.$_terms={},this.$_temp={ruleset:null,whens:{}}}describe(){return n("function"==typeof d.describe,"Manifest functionality disabled"),d.describe(this)}allow(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return l.verifyFlat(t,"allow"),this._values(t,"_valids")}alter(e){n(e&&"object"==typeof e&&!Array.isArray(e),"Invalid targets argument"),n(!this._inRuleset(),"Cannot set alterations inside a ruleset");const t=this.clone();t.$_terms.alterations=t.$_terms.alterations||[];for(const r in e){const s=e[r];n("function"==typeof s,"Alteration adjuster for",r,"must be a function"),t.$_terms.alterations.push({target:r,adjuster:s})}return t.$_temp.ruleset=!1,t}artifact(e){return n(void 0!==e,"Artifact cannot be undefined"),n(!this._cache,"Cannot set an artifact with a rule cache"),this.$_setFlag("artifact",e)}cast(e){return n(!1===e||"string"==typeof e,"Invalid to value"),n(!1===e||this._definition.cast[e],"Type",this.type,"does not support casting to",e),this.$_setFlag("cast",!1===e?void 0:e)}default(e,t){return this._default("default",e,t)}description(e){return n(e&&"string"==typeof e,"Description must be a non-empty string"),this.$_setFlag("description",e)}empty(e){const t=this.clone();return void 0!==e&&(e=t.$_compile(e,{override:!1})),t.$_setFlag("empty",e,{clone:!1})}error(e){return n(e,"Missing error"),n(e instanceof Error||"function"==typeof e,"Must provide a valid Error object or a function"),this.$_setFlag("error",e)}example(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return n(void 0!==e,"Missing example"),l.assertOptions(t,["override"]),this._inner("examples",e,{single:!0,override:t.override})}external(e,t){return"object"==typeof e&&(n(!t,"Cannot combine options with description"),t=e.description,e=e.method),n("function"==typeof e,"Method must be a function"),n(void 0===t||t&&"string"==typeof t,"Description must be a non-empty string"),this._inner("externals",{method:e,description:t},{single:!0})}failover(e,t){return this._default("failover",e,t)}forbidden(){return this.presence("forbidden")}id(e){return e?(n("string"==typeof e,"id must be a non-empty string"),n(/^[^\.]+$/.test(e),"id cannot contain period character"),this.$_setFlag("id",e)):this.$_setFlag("id",void 0)}invalid(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return this._values(t,"_invalids")}label(e){return n(e&&"string"==typeof e,"Label name must be a non-empty string"),this.$_setFlag("label",e)}meta(e){return n(void 0!==e,"Meta cannot be undefined"),this._inner("metas",e,{single:!0})}note(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];n(t.length,"Missing notes");for(const e of t)n(e&&"string"==typeof e,"Notes must be non-empty strings");return this._inner("notes",t)}only(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return n("boolean"==typeof e,"Invalid mode:",e),this.$_setFlag("only",e)}optional(){return this.presence("optional")}prefs(e){n(e,"Missing preferences"),n(void 0===e.context,"Cannot override context"),n(void 0===e.externals,"Cannot override externals"),n(void 0===e.warnings,"Cannot override warnings"),n(void 0===e.debug,"Cannot override debug"),l.checkPreferences(e);const t=this.clone();return t._preferences=l.preferences(t._preferences,e),t}presence(e){return n(["optional","required","forbidden"].includes(e),"Unknown presence mode",e),this.$_setFlag("presence",e)}raw(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.$_setFlag("result",e?"raw":void 0)}result(e){return n(["raw","strip"].includes(e),"Unknown result mode",e),this.$_setFlag("result",e)}required(){return this.presence("required")}strict(e){const t=this.clone(),r=void 0!==e&&!e;return t._preferences=l.preferences(t._preferences,{convert:r}),t}strip(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.$_setFlag("result",e?"strip":void 0)}tag(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];n(t.length,"Missing tags");for(const e of t)n(e&&"string"==typeof e,"Tags must be non-empty strings");return this._inner("tags",t)}unit(e){return n(e&&"string"==typeof e,"Unit name must be a non-empty string"),this.$_setFlag("unit",e)}valid(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];l.verifyFlat(t,"valid");const n=this.allow(...t);return n.$_setFlag("only",!!n._valids,{clone:!1}),n}when(e,t){const r=this.clone();r.$_terms.whens||(r.$_terms.whens=[]);const s=c.when(r,e,t);if(!["any","link"].includes(r.type)){const e=s.is?[s]:s.switch;for(const t of e)n(!t.then||"any"===t.then.type||t.then.type===r.type,"Cannot combine",r.type,"with",t.then&&t.then.type),n(!t.otherwise||"any"===t.otherwise.type||t.otherwise.type===r.type,"Cannot combine",r.type,"with",t.otherwise&&t.otherwise.type)}return r.$_terms.whens.push(s),r.$_mutateRebuild()}cache(e){n(!this._inRuleset(),"Cannot set caching inside a ruleset"),n(!this._cache,"Cannot override schema cache"),n(void 0===this._flags.artifact,"Cannot cache a rule with an artifact");const t=this.clone();return t._cache=e||i.provider.provision(),t.$_temp.ruleset=!1,t}clone(){const e=Object.create(Object.getPrototypeOf(this));return this._assign(e)}concat(e){n(l.isSchema(e),"Invalid schema object"),n("any"===this.type||"any"===e.type||e.type===this.type,"Cannot merge type",this.type,"with another type:",e.type),n(!this._inRuleset(),"Cannot concatenate onto a schema with open ruleset"),n(!e._inRuleset(),"Cannot concatenate a schema with open ruleset");let t=this.clone();if("any"===this.type&&"any"!==e.type){const r=e.clone();for(const e of Object.keys(t))"type"!==e&&(r[e]=t[e]);t=r}t._ids.concat(e._ids),t._refs.register(e,h.toSibling),t._preferences=t._preferences?l.preferences(t._preferences,e._preferences):e._preferences,t._valids=v.merge(t._valids,e._valids,e._invalids),t._invalids=v.merge(t._invalids,e._invalids,e._valids);for(const r of e._singleRules.keys())t._singleRules.has(r)&&(t._rules=t._rules.filter((e=>e.keep||e.name!==r)),t._singleRules.delete(r));for(const r of e._rules)e._definition.rules[r.method].multi||t._singleRules.set(r.name,r),t._rules.push(r);if(t._flags.empty&&e._flags.empty){t._flags.empty=t._flags.empty.concat(e._flags.empty);const r=Object.assign({},e._flags);delete r.empty,o(t._flags,r)}else if(e._flags.empty){t._flags.empty=e._flags.empty;const r=Object.assign({},e._flags);delete r.empty,o(t._flags,r)}else o(t._flags,e._flags);for(const r in e.$_terms){const n=e.$_terms[r];n?t.$_terms[r]?t.$_terms[r]=t.$_terms[r].concat(n):t.$_terms[r]=n.slice():t.$_terms[r]||(t.$_terms[r]=n)}return this.$_root._tracer&&this.$_root._tracer._combine(t,[this,e]),t.$_mutateRebuild()}extend(e){return n(!e.base,"Cannot extend type with another base"),f.type(this,e)}extract(e){return e=Array.isArray(e)?e:e.split("."),this._ids.reach(e)}fork(e,t){n(!this._inRuleset(),"Cannot fork inside a ruleset");let r=this;for(let n of[].concat(e))n=Array.isArray(n)?n:n.split("."),r=r._ids.fork(n,t,r);return r.$_temp.ruleset=!1,r}rule(e){const t=this._definition;l.assertOptions(e,Object.keys(t.modifiers)),n(!1!==this.$_temp.ruleset,"Cannot apply rules to empty ruleset or the last rule added does not support rule properties");const r=null===this.$_temp.ruleset?this._rules.length-1:this.$_temp.ruleset;n(r>=0&&r<this._rules.length,"Cannot apply rules to empty ruleset");const a=this.clone();for(let o=r;o<a._rules.length;++o){const r=a._rules[o],i=s(r);for(const s in e)t.modifiers[s](i,e[s]),n(i.name===r.name,"Cannot change rule name");a._rules[o]=i,a._singleRules.get(i.name)===r&&a._singleRules.set(i.name,i)}return a.$_temp.ruleset=!1,a.$_mutateRebuild()}get ruleset(){n(!this._inRuleset(),"Cannot start a new ruleset without closing the previous one");const e=this.clone();return e.$_temp.ruleset=e._rules.length,e}get $(){return this.ruleset}tailor(e){e=[].concat(e),n(!this._inRuleset(),"Cannot tailor inside a ruleset");let t=this;if(this.$_terms.alterations)for(const{target:r,adjuster:s}of this.$_terms.alterations)e.includes(r)&&(t=s(t),n(l.isSchema(t),"Alteration adjuster for",r,"failed to return a schema object"));return t=t.$_modify({each:t=>t.tailor(e),ref:!1}),t.$_temp.ruleset=!1,t.$_mutateRebuild()}tracer(){return g.location?g.location(this):this}validate(e,t){return y.entry(e,this,t)}validateAsync(e,t){return y.entryAsync(e,this,t)}$_addRule(e){"string"==typeof e&&(e={name:e}),n(e&&"object"==typeof e,"Invalid options"),n(e.name&&"string"==typeof e.name,"Invalid rule name");for(const t in e)n("_"!==t[0],"Cannot set private rule properties");const t=Object.assign({},e);t._resolve=[],t.method=t.method||t.name;const r=this._definition.rules[t.method],s=t.args;n(r,"Unknown rule",t.method);const a=this.clone();if(s){n(1===Object.keys(s).length||Object.keys(s).length===this._definition.rules[t.name].args.length,"Invalid rule definition for",this.type,t.name);for(const e in s){let o=s[e];if(r.argsByName){const i=r.argsByName.get(e);if(i.ref&&l.isResolvable(o))t._resolve.push(e),a.$_mutateRegister(o);else if(i.normalize&&(o=i.normalize(o),s[e]=o),i.assert){const t=l.validateArg(o,e,i);n(!t,t,"or reference")}}void 0!==o?s[e]=o:delete s[e]}}return r.multi||(a._ruleRemove(t.name,{clone:!1}),a._singleRules.set(t.name,t)),!1===a.$_temp.ruleset&&(a.$_temp.ruleset=null),r.priority?a._rules.unshift(t):a._rules.push(t),a}$_compile(e,t){return c.schema(this.$_root,e,t)}$_createError(e,t,r,n,s){let a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};const o=!1!==a.flags?this._flags:{},i=a.messages?m.merge(this._definition.messages,a.messages):this._definition.messages;return new u.Report(e,t,r,o,i,n,s)}$_getFlag(e){return this._flags[e]}$_getRule(e){return this._singleRules.get(e)}$_mapLabels(e){return e=Array.isArray(e)?e:e.split("."),this._ids.labels(e)}$_match(e,t,r,n){(r=Object.assign({},r)).abortEarly=!0,r._externals=!1,t.snapshot();const s=!y.validate(e,this,t,r,n).errors;return t.restore(),s}$_modify(e){return l.assertOptions(e,["each","once","ref","schema"]),p.schema(this,e)||this}$_mutateRebuild(){return n(!this._inRuleset(),"Cannot add this rule inside a ruleset"),this._refs.reset(),this._ids.reset(),this.$_modify({each:(e,t)=>{let{source:r,name:n,path:s,key:a}=t;const o=this._definition[r][n]&&this._definition[r][n].register;!1!==o&&this.$_mutateRegister(e,{family:o,key:a})}}),this._definition.rebuild&&this._definition.rebuild(this),this.$_temp.ruleset=!1,this}$_mutateRegister(e){let{family:t,key:r}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this._refs.register(e,t),this._ids.register(e,{key:r})}$_property(e){return this._definition.properties[e]}$_reach(e){return this._ids.reach(e)}$_rootReferences(){return this._refs.roots()}$_setFlag(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};n("_"===e[0]||!this._inRuleset(),"Cannot set flag inside a ruleset");const s=this._definition.flags[e]||{};if(a(t,s.default)&&(t=void 0),a(t,this._flags[e]))return this;const o=!1!==r.clone?this.clone():this;return void 0!==t?(o._flags[e]=t,o.$_mutateRegister(t)):delete o._flags[e],"_"!==e[0]&&(o.$_temp.ruleset=!1),o}$_parent(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return this[e][l.symbols.parent].call(this,...r)}$_validate(e,t,r){return y.validate(e,this,t,r)}_assign(e){e.type=this.type,e.$_root=this.$_root,e.$_temp=Object.assign({},this.$_temp),e.$_temp.whens={},e._ids=this._ids.clone(),e._preferences=this._preferences,e._valids=this._valids&&this._valids.clone(),e._invalids=this._invalids&&this._invalids.clone(),e._rules=this._rules.slice(),e._singleRules=s(this._singleRules,{shallow:!0}),e._refs=this._refs.clone(),e._flags=Object.assign({},this._flags),e._cache=null,e.$_terms={};for(const t in this.$_terms)e.$_terms[t]=this.$_terms[t]?this.$_terms[t].slice():null;e.$_super={};for(const t in this.$_super)e.$_super[t]=this._super[t].bind(e);return e}_bare(){const e=this.clone();e._reset();const t=e._definition.terms;for(const r in t){const n=t[r];e.$_terms[r]=n.init}return e.$_mutateRebuild()}_default(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return l.assertOptions(r,"literal"),n(void 0!==t,"Missing",e,"value"),n("function"==typeof t||!r.literal,"Only function value supports literal option"),"function"==typeof t&&r.literal&&(t={[l.symbols.literal]:!0,literal:t}),this.$_setFlag(e,t)}_generate(e,t,r){if(!this.$_terms.whens)return{schema:this};const n=[],s=[];for(let a=0;a<this.$_terms.whens.length;++a){const o=this.$_terms.whens[a];if(o.concat){n.push(o.concat),s.push(`${a}.concat`);continue}const i=o.ref?o.ref.resolve(e,t,r):e,l=o.is?[o]:o.switch,c=s.length;for(let c=0;c<l.length;++c){const{is:u,then:f,otherwise:d}=l[c],m=`${a}${o.switch?"."+c:""}`;if(u.$_match(i,t.nest(u,`${m}.is`),r)){if(f){const a=t.localize([...t.path,`${m}.then`],t.ancestors,t.schemas),{schema:o,id:i}=f._generate(e,a,r);n.push(o),s.push(`${m}.then${i?`(${i})`:""}`);break}}else if(d){const a=t.localize([...t.path,`${m}.otherwise`],t.ancestors,t.schemas),{schema:o,id:i}=d._generate(e,a,r);n.push(o),s.push(`${m}.otherwise${i?`(${i})`:""}`);break}}if(o.break&&s.length>c)break}const a=s.join(", ");if(t.mainstay.tracer.debug(t,"rule","when",a),!a)return{schema:this};if(!t.mainstay.tracer.active&&this.$_temp.whens[a])return{schema:this.$_temp.whens[a],id:a};let o=this;this._definition.generate&&(o=this._definition.generate(this,e,t,r));for(const e of n)o=o.concat(e);return this.$_root._tracer&&this.$_root._tracer._combine(o,[this,...n]),this.$_temp.whens[a]=o,{schema:o,id:a}}_inner(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};n(!this._inRuleset(),`Cannot set ${e} inside a ruleset`);const s=this.clone();return s.$_terms[e]&&!r.override||(s.$_terms[e]=[]),r.single?s.$_terms[e].push(t):s.$_terms[e].push(...t),s.$_temp.ruleset=!1,s}_inRuleset(){return null!==this.$_temp.ruleset&&!1!==this.$_temp.ruleset}_ruleRemove(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this._singleRules.has(e))return this;const r=!1!==t.clone?this.clone():this;r._singleRules.delete(e);const n=[];for(let t=0;t<r._rules.length;++t){const s=r._rules[t];s.name!==e||s.keep?n.push(s):r._inRuleset()&&t<r.$_temp.ruleset&&--r.$_temp.ruleset}return r._rules=n,r}_values(e,t){l.verifyFlat(e,t.slice(1,-1));const r=this.clone(),s=e[0]===l.symbols.override;if(s&&(e=e.slice(1)),!r[t]&&e.length?r[t]=new v:s&&(r[t]=e.length?new v:null,r.$_mutateRebuild()),!r[t])return r;s&&r[t].override();for(const s of e){n(void 0!==s,"Cannot call allow/valid/invalid with undefined"),n(s!==l.symbols.override,"Override must be the first value");const e="_invalids"===t?"_valids":"_invalids";r[e]&&(r[e].remove(s),r[e].length||(n("_valids"===t||!r._flags.only,"Setting invalid value",s,"leaves schema rejecting all values due to previous valid rule"),r[e]=null)),r[t].add(s,r._refs)}return r}}};b.Base.prototype[l.symbols.any]={version:l.version,compile:c.compile,root:"$_root"},b.Base.prototype.isImmutable=!0,b.Base.prototype.deny=b.Base.prototype.invalid,b.Base.prototype.disallow=b.Base.prototype.invalid,b.Base.prototype.equal=b.Base.prototype.valid,b.Base.prototype.exist=b.Base.prototype.required,b.Base.prototype.not=b.Base.prototype.invalid,b.Base.prototype.options=b.Base.prototype.prefs,b.Base.prototype.preferences=b.Base.prototype.prefs,e.exports=new b.Base},8652:(e,t,r)=>{"use strict";const n=r(375),s=r(8571),a=r(8160),o={max:1e3,supported:new Set(["undefined","boolean","number","string"])};t.provider={provision:e=>new o.Cache(e)},o.Cache=class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a.assertOptions(e,["max"]),n(void 0===e.max||e.max&&e.max>0&&isFinite(e.max),"Invalid max cache size"),this._max=e.max||o.max,this._map=new Map,this._list=new o.List}get length(){return this._map.size}set(e,t){if(null!==e&&!o.supported.has(typeof e))return;let r=this._map.get(e);if(r)return r.value=t,void this._list.first(r);r=this._list.unshift({key:e,value:t}),this._map.set(e,r),this._compact()}get(e){const t=this._map.get(e);if(t)return this._list.first(t),s(t.value)}_compact(){if(this._map.size>this._max){const e=this._list.pop();this._map.delete(e.key)}}},o.List=class{constructor(){this.tail=null,this.head=null}unshift(e){return e.next=null,e.prev=this.head,this.head&&(this.head.next=e),this.head=e,this.tail||(this.tail=e),e}first(e){e!==this.head&&(this._remove(e),this.unshift(e))}pop(){return this._remove(this.tail)}_remove(e){const{next:t,prev:r}=e;return t.prev=r,r&&(r.next=t),e===this.tail&&(this.tail=t),e.prev=null,e.next=null,e}}},8160:(e,t,r)=>{"use strict";const n=r(375),s=r(7916),a=r(5934);let o,i;const l={isoDate:/^(?:[-+]\d{2})?(?:\d{4}(?!\d{2}\b))(?:(-?)(?:(?:0[1-9]|1[0-2])(?:\1(?:[12]\d|0[1-9]|3[01]))?|W(?:[0-4]\d|5[0-2])(?:-?[1-7])?|(?:00[1-9]|0[1-9]\d|[12]\d{2}|3(?:[0-5]\d|6[1-6])))(?![T]$|[T][\d]+Z$)(?:[T\s](?:(?:(?:[01]\d|2[0-3])(?:(:?)[0-5]\d)?|24\:?00)(?:[.,]\d+(?!:))?)(?:\2[0-5]\d(?:[.,]\d+)?)?(?:[Z]|(?:[+-])(?:[01]\d|2[0-3])(?::?[0-5]\d)?)?)?)?$/};t.version=a.version,t.defaults={abortEarly:!0,allowUnknown:!1,artifacts:!1,cache:!0,context:null,convert:!0,dateFormat:"iso",errors:{escapeHtml:!1,label:"path",language:null,render:!0,stack:!1,wrap:{label:'"',array:"[]"}},externals:!0,messages:{},nonEnumerables:!1,noDefaults:!1,presence:"optional",skipFunctions:!1,stripUnknown:!1,warnings:!1},t.symbols={any:Symbol.for("@hapi/joi/schema"),arraySingle:Symbol("arraySingle"),deepDefault:Symbol("deepDefault"),errors:Symbol("errors"),literal:Symbol("literal"),override:Symbol("override"),parent:Symbol("parent"),prefs:Symbol("prefs"),ref:Symbol("ref"),template:Symbol("template"),values:Symbol("values")},t.assertOptions=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"Options";n(e&&"object"==typeof e&&!Array.isArray(e),"Options must be of type object");const s=Object.keys(e).filter((e=>!t.includes(e)));n(0===s.length,`${r} contain unknown keys: ${s}`)},t.checkPreferences=function(e){i=i||r(3378);const t=i.preferences.validate(e);if(t.error)throw new s([t.error.details[0].message])},t.compare=function(e,t,r){switch(r){case"=":return e===t;case">":return e>t;case"<":return e<t;case">=":return e>=t;case"<=":return e<=t}},t.default=function(e,t){return void 0===e?t:e},t.isIsoDate=function(e){return l.isoDate.test(e)},t.isNumber=function(e){return"number"==typeof e&&!isNaN(e)},t.isResolvable=function(e){return!!e&&(e[t.symbols.ref]||e[t.symbols.template])},t.isSchema=function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=e&&e[t.symbols.any];return!!s&&(n(r.legacy||s.version===t.version,"Cannot mix different versions of joi schemas"),!0)},t.isValues=function(e){return e[t.symbols.values]},t.limit=function(e){return Number.isSafeInteger(e)&&e>=0},t.preferences=function(e,n){o=o||r(6914),e=e||{},n=n||{};const s=Object.assign({},e,n);return n.errors&&e.errors&&(s.errors=Object.assign({},e.errors,n.errors),s.errors.wrap=Object.assign({},e.errors.wrap,n.errors.wrap)),n.messages&&(s.messages=o.compile(n.messages,e.messages)),delete s[t.symbols.prefs],s},t.tryWithPath=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{return e()}catch(e){throw void 0!==e.path?e.path=t+"."+e.path:e.path=t,r.append&&(e.message=`${e.message} (${e.path})`),e}},t.validateArg=function(e,r,n){let{assert:s,message:a}=n;if(t.isSchema(s)){const t=s.validate(e);if(!t.error)return;return t.error.message}if(!s(e))return r?`${r} ${a}`:a},t.verifyFlat=function(e,t){for(const r of e)n(!Array.isArray(r),"Method no longer accepts array arguments:",t)}},3292:(e,t,r)=>{"use strict";const n=r(375),s=r(8160),a=r(6133),o={};t.schema=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};s.assertOptions(r,["appendPath","override"]);try{return o.schema(e,t,r)}catch(e){throw r.appendPath&&void 0!==e.path&&(e.message=`${e.message} (${e.path})`),e}},o.schema=function(e,t,r){n(void 0!==t,"Invalid undefined schema"),Array.isArray(t)&&(n(t.length,"Invalid empty array schema"),1===t.length&&(t=t[0]));const a=function(t){for(var n=arguments.length,s=new Array(n>1?n-1:0),a=1;a<n;a++)s[a-1]=arguments[a];return!1!==r.override?t.valid(e.override,...s):t.valid(...s)};if(o.simple(t))return a(e,t);if("function"==typeof t)return e.custom(t);if(n("object"==typeof t,"Invalid schema content:",typeof t),s.isResolvable(t))return a(e,t);if(s.isSchema(t))return t;if(Array.isArray(t)){for(const r of t)if(!o.simple(r))return e.alternatives().try(...t);return a(e,...t)}return t instanceof RegExp?e.string().regex(t):t instanceof Date?a(e.date(),t):(n(Object.getPrototypeOf(t)===Object.getPrototypeOf({}),"Schema can only contain plain objects"),e.object().keys(t))},t.ref=function(e,t){return a.isRef(e)?e:a.create(e,t)},t.compile=function(e,r){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};s.assertOptions(a,["legacy"]);const i=r&&r[s.symbols.any];if(i)return n(a.legacy||i.version===s.version,"Cannot mix different versions of joi schemas:",i.version,s.version),r;if("object"!=typeof r||!a.legacy)return t.schema(e,r,{appendPath:!0});const l=o.walk(r);return l?l.compile(l.root,r):t.schema(e,r,{appendPath:!0})},o.walk=function(e){if("object"!=typeof e)return null;if(Array.isArray(e)){for(const t of e){const e=o.walk(t);if(e)return e}return null}const t=e[s.symbols.any];if(t)return{root:e[t.root],compile:t.compile};n(Object.getPrototypeOf(e)===Object.getPrototypeOf({}),"Schema can only contain plain objects");for(const t in e){const r=o.walk(e[t]);if(r)return r}return null},o.simple=function(e){return null===e||["boolean","string","number"].includes(typeof e)},t.when=function(e,r,i){if(void 0===i&&(n(r&&"object"==typeof r,"Missing options"),i=r,r=a.create(".")),Array.isArray(i)&&(i={switch:i}),s.assertOptions(i,["is","not","then","otherwise","switch","break"]),s.isSchema(r))return n(void 0===i.is,'"is" can not be used with a schema condition'),n(void 0===i.not,'"not" can not be used with a schema condition'),n(void 0===i.switch,'"switch" can not be used with a schema condition'),o.condition(e,{is:r,then:i.then,otherwise:i.otherwise,break:i.break});if(n(a.isRef(r)||"string"==typeof r,"Invalid condition:",r),n(void 0===i.not||void 0===i.is,'Cannot combine "is" with "not"'),void 0===i.switch){let l=i;void 0!==i.not&&(l={is:i.not,then:i.otherwise,otherwise:i.then,break:i.break});let c=void 0!==l.is?e.$_compile(l.is):e.$_root.invalid(null,!1,0,"").required();return n(void 0!==l.then||void 0!==l.otherwise,'options must have at least one of "then", "otherwise", or "switch"'),n(void 0===l.break||void 0===l.then||void 0===l.otherwise,"Cannot specify then, otherwise, and break all together"),void 0===i.is||a.isRef(i.is)||s.isSchema(i.is)||(c=c.required()),o.condition(e,{ref:t.ref(r),is:c,then:l.then,otherwise:l.otherwise,break:l.break})}n(Array.isArray(i.switch),'"switch" must be an array'),n(void 0===i.is,'Cannot combine "switch" with "is"'),n(void 0===i.not,'Cannot combine "switch" with "not"'),n(void 0===i.then,'Cannot combine "switch" with "then"');const l={ref:t.ref(r),switch:[],break:i.break};for(let t=0;t<i.switch.length;++t){const r=i.switch[t],o=t===i.switch.length-1;s.assertOptions(r,o?["is","then","otherwise"]:["is","then"]),n(void 0!==r.is,'Switch statement missing "is"'),n(void 0!==r.then,'Switch statement missing "then"');const c={is:e.$_compile(r.is),then:e.$_compile(r.then)};if(a.isRef(r.is)||s.isSchema(r.is)||(c.is=c.is.required()),o){n(void 0===i.otherwise||void 0===r.otherwise,'Cannot specify "otherwise" inside and outside a "switch"');const t=void 0!==i.otherwise?i.otherwise:r.otherwise;void 0!==t&&(n(void 0===l.break,"Cannot specify both otherwise and break"),c.otherwise=e.$_compile(t))}l.switch.push(c)}return l},o.condition=function(e,t){for(const r of["then","otherwise"])void 0===t[r]?delete t[r]:t[r]=e.$_compile(t[r]);return t}},6354:(e,t,r)=>{"use strict";const n=r(5688),s=r(8160),a=r(3328);t.Report=class{constructor(e,r,n,s,a,o,i){if(this.code=e,this.flags=s,this.messages=a,this.path=o.path,this.prefs=i,this.state=o,this.value=r,this.message=null,this.template=null,this.local=n||{},this.local.label=t.label(this.flags,this.state,this.prefs,this.messages),void 0===this.value||this.local.hasOwnProperty("value")||(this.local.value=this.value),this.path.length){const e=this.path[this.path.length-1];"object"!=typeof e&&(this.local.key=e)}}_setTemplate(e){if(this.template=e,!this.flags.label&&0===this.path.length){const e=this._template(this.template,"root");e&&(this.local.label=e)}}toString(){if(this.message)return this.message;const e=this.code;if(!this.prefs.errors.render)return this.code;const t=this._template(this.template)||this._template(this.prefs.messages)||this._template(this.messages);return void 0===t?`Error code "${e}" is not defined, your custom type is missing the correct messages definition`:(this.message=t.render(this.value,this.state,this.prefs,this.local,{errors:this.prefs.errors,messages:[this.prefs.messages,this.messages]}),this.prefs.errors.label||(this.message=this.message.replace(/^"" /,"").trim()),this.message)}_template(e,r){return t.template(this.value,e,r||this.code,this.state,this.prefs)}},t.path=function(e){let t="";for(const r of e)"object"!=typeof r&&("string"==typeof r?(t&&(t+="."),t+=r):t+=`[${r}]`);return t},t.template=function(e,t,r,n,o){if(!t)return;if(a.isTemplate(t))return"root"!==r?t:null;let i=o.errors.language;if(s.isResolvable(i)&&(i=i.resolve(e,n,o)),i&&t[i]){if(void 0!==t[i][r])return t[i][r];if(void 0!==t[i]["*"])return t[i]["*"]}return t[r]?t[r]:t["*"]},t.label=function(e,r,n,s){if(e.label)return e.label;if(!n.errors.label)return"";let a=r.path;return"key"===n.errors.label&&r.path.length>1&&(a=r.path.slice(-1)),t.path(a)||t.template(null,n.messages,"root",r,n)||s&&t.template(null,s,"root",r,n)||"value"},t.process=function(e,r,n){if(!e)return null;const{override:s,message:a,details:o}=t.details(e);if(s)return s;if(n.errors.stack)return new t.ValidationError(a,o,r);const i=Error.stackTraceLimit;Error.stackTraceLimit=0;const l=new t.ValidationError(a,o,r);return Error.stackTraceLimit=i,l},t.details=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=[];const n=[];for(const s of e){if(s instanceof Error){if(!1!==t.override)return{override:s};const e=s.toString();r.push(e),n.push({message:e,type:"override",context:{error:s}});continue}const e=s.toString();r.push(e),n.push({message:e,path:s.path.filter((e=>"object"!=typeof e)),type:s.code,context:s.local})}return r.length>1&&(r=[...new Set(r)]),{message:r.join(". "),details:n}},t.ValidationError=class extends Error{constructor(e,t,r){super(e),this._original=r,this.details=t}static isError(e){return e instanceof t.ValidationError}},t.ValidationError.prototype.isJoi=!0,t.ValidationError.prototype.name="ValidationError",t.ValidationError.prototype.annotate=n.error},8901:(e,t,r)=>{"use strict";const n=r(375),s=r(8571),a=r(8160),o=r(6914),i={};t.type=function(e,t){const r=Object.getPrototypeOf(e),l=s(r),c=e._assign(Object.create(l)),u=Object.assign({},t);delete u.base,l._definition=u;const f=r._definition||{};u.messages=o.merge(f.messages,u.messages),u.properties=Object.assign({},f.properties,u.properties),c.type=u.type,u.flags=Object.assign({},f.flags,u.flags);const d=Object.assign({},f.terms);if(u.terms)for(const e in u.terms){const t=u.terms[e];n(void 0===c.$_terms[e],"Invalid term override for",u.type,e),c.$_terms[e]=t.init,d[e]=t}u.terms=d,u.args||(u.args=f.args),u.prepare=i.prepare(u.prepare,f.prepare),u.coerce&&("function"==typeof u.coerce&&(u.coerce={method:u.coerce}),u.coerce.from&&!Array.isArray(u.coerce.from)&&(u.coerce={method:u.coerce.method,from:[].concat(u.coerce.from)})),u.coerce=i.coerce(u.coerce,f.coerce),u.validate=i.validate(u.validate,f.validate);const m=Object.assign({},f.rules);if(u.rules)for(const e in u.rules){const t=u.rules[e];n("object"==typeof t,"Invalid rule definition for",u.type,e);let r=t.method;if(void 0===r&&(r=function(){return this.$_addRule(e)}),r&&(n(!l[e],"Rule conflict in",u.type,e),l[e]=r),n(!m[e],"Rule conflict in",u.type,e),m[e]=t,t.alias){const e=[].concat(t.alias);for(const r of e)l[r]=t.method}t.args&&(t.argsByName=new Map,t.args=t.args.map((e=>("string"==typeof e&&(e={name:e}),n(!t.argsByName.has(e.name),"Duplicated argument name",e.name),a.isSchema(e.assert)&&(e.assert=e.assert.strict().label(e.name)),t.argsByName.set(e.name,e),e))))}u.rules=m;const p=Object.assign({},f.modifiers);if(u.modifiers)for(const e in u.modifiers){n(!l[e],"Rule conflict in",u.type,e);const t=u.modifiers[e];n("function"==typeof t,"Invalid modifier definition for",u.type,e);const r=function(t){return this.rule({[e]:t})};l[e]=r,p[e]=t}if(u.modifiers=p,u.overrides){l._super=r,c.$_super={};for(const e in u.overrides)n(r[e],"Cannot override missing",e),u.overrides[e][a.symbols.parent]=r[e],c.$_super[e]=r[e].bind(c);Object.assign(l,u.overrides)}u.cast=Object.assign({},f.cast,u.cast);const h=Object.assign({},f.manifest,u.manifest);return h.build=i.build(u.manifest&&u.manifest.build,f.manifest&&f.manifest.build),u.manifest=h,u.rebuild=i.rebuild(u.rebuild,f.rebuild),c},i.build=function(e,t){return e&&t?function(r,n){return t(e(r,n),n)}:e||t},i.coerce=function(e,t){return e&&t?{from:e.from&&t.from?[...new Set([...e.from,...t.from])]:null,method(r,n){let s;if((!t.from||t.from.includes(typeof r))&&(s=t.method(r,n),s)){if(s.errors||void 0===s.value)return s;r=s.value}if(!e.from||e.from.includes(typeof r)){const t=e.method(r,n);if(t)return t}return s}}:e||t},i.prepare=function(e,t){return e&&t?function(r,n){const s=e(r,n);if(s){if(s.errors||void 0===s.value)return s;r=s.value}return t(r,n)||s}:e||t},i.rebuild=function(e,t){return e&&t?function(r){t(r),e(r)}:e||t},i.validate=function(e,t){return e&&t?function(r,n){const s=t(r,n);if(s){if(s.errors&&(!Array.isArray(s.errors)||s.errors.length))return s;r=s.value}return e(r,n)||s}:e||t}},5107:(e,t,r)=>{"use strict";const n=r(375),s=r(8571),a=r(8652),o=r(8160),i=r(3292),l=r(6354),c=r(8901),u=r(9708),f=r(6133),d=r(3328),m=r(1152);let p;const h={types:{alternatives:r(4946),any:r(8068),array:r(546),boolean:r(4937),date:r(7500),function:r(390),link:r(8785),number:r(3832),object:r(8966),string:r(7417),symbol:r(8826)},aliases:{alt:"alternatives",bool:"boolean",func:"function"},root:function(){const e={_types:new Set(Object.keys(h.types))};for(const t of e._types)e[t]=function(){for(var e=arguments.length,r=new Array(e),s=0;s<e;s++)r[s]=arguments[s];return n(!r.length||["alternatives","link","object"].includes(t),"The",t,"type does not allow arguments"),h.generate(this,h.types[t],r)};for(const t of["allow","custom","disallow","equal","exist","forbidden","invalid","not","only","optional","options","prefs","preferences","required","strip","valid","when"])e[t]=function(){return this.any()[t](...arguments)};Object.assign(e,h.methods);for(const t in h.aliases){const r=h.aliases[t];e[t]=e[r]}return e.x=e.expression,m.setup&&m.setup(e),e}};h.methods={ValidationError:l.ValidationError,version:o.version,cache:a.provider,assert(e,t){for(var r=arguments.length,n=new Array(r>2?r-2:0),s=2;s<r;s++)n[s-2]=arguments[s];h.assert(e,t,!0,n)},attempt(e,t){for(var r=arguments.length,n=new Array(r>2?r-2:0),s=2;s<r;s++)n[s-2]=arguments[s];return h.assert(e,t,!1,n)},build(e){return n("function"==typeof u.build,"Manifest functionality disabled"),u.build(this,e)},checkPreferences(e){o.checkPreferences(e)},compile(e,t){return i.compile(this,e,t)},defaults(e){n("function"==typeof e,"modifier must be a function");const t=Object.assign({},this);for(const r of t._types){const s=e(t[r]());n(o.isSchema(s),"modifier must return a valid schema object"),t[r]=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return h.generate(this,s,t)}}return t},expression(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return new d(...t)},extend(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];o.verifyFlat(t,"extend"),p=p||r(3378),n(t.length,"You need to provide at least one extension"),this.assert(t,p.extensions);const a=Object.assign({},this);a._types=new Set(a._types);for(let e of t){"function"==typeof e&&(e=e(a)),this.assert(e,p.extension);const t=h.expandExtension(e,a);for(const e of t){n(void 0===a[e.type]||a._types.has(e.type),"Cannot override name",e.type);const t=e.base||this.any(),r=c.type(t,e);a._types.add(e.type),a[e.type]=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return h.generate(this,r,t)}}}return a},isError:l.ValidationError.isError,isExpression:d.isTemplate,isRef:f.isRef,isSchema:o.isSchema,in(){return f.in(...arguments)},override:o.symbols.override,ref(){return f.create(...arguments)},types(){const e={};for(const t of this._types)e[t]=this[t]();for(const t in h.aliases)e[t]=this[t]();return e}},h.assert=function(e,t,r,n){const a=n[0]instanceof Error||"string"==typeof n[0]?n[0]:null,i=null!==a?n[1]:n[0],c=t.validate(e,o.preferences({errors:{stack:!0}},i||{}));let u=c.error;if(!u)return c.value;if(a instanceof Error)throw a;const f=r&&"function"==typeof u.annotate?u.annotate():u.message;throw u instanceof l.ValidationError==0&&(u=s(u)),u.message=a?`${a} ${f}`:f,u},h.generate=function(e,t,r){return n(e,"Must be invoked on a Joi instance."),t.$_root=e,t._definition.args&&r.length?t._definition.args(t,...r):t},h.expandExtension=function(e,t){if("string"==typeof e.type)return[e];const r=[];for(const n of t._types)if(e.type.test(n)){const s=Object.assign({},e);s.type=n,s.base=t[n](),r.push(s)}return r},e.exports=h.root()},6914:(e,t,r)=>{"use strict";const n=r(375),s=r(8571),a=r(3328);t.compile=function(e,t){if("string"==typeof e)return n(!t,"Cannot set single message string"),new a(e);if(a.isTemplate(e))return n(!t,"Cannot set single message template"),e;n("object"==typeof e&&!Array.isArray(e),"Invalid message options"),t=t?s(t):{};for(let r in e){const s=e[r];if("root"===r||a.isTemplate(s)){t[r]=s;continue}if("string"==typeof s){t[r]=new a(s);continue}n("object"==typeof s&&!Array.isArray(s),"Invalid message for",r);const o=r;for(r in t[o]=t[o]||{},s){const e=s[r];"root"===r||a.isTemplate(e)?t[o][r]=e:(n("string"==typeof e,"Invalid message for",r,"in",o),t[o][r]=new a(e))}}return t},t.decompile=function(e){const t={};for(let r in e){const n=e[r];if("root"===r){t.root=n;continue}if(a.isTemplate(n)){t[r]=n.describe({compact:!0});continue}const s=r;for(r in t[s]={},n){const e=n[r];"root"!==r?t[s][r]=e.describe({compact:!0}):t[s].root=e}}return t},t.merge=function(e,r){if(!e)return t.compile(r);if(!r)return e;if("string"==typeof r)return new a(r);if(a.isTemplate(r))return r;const o=s(e);for(let e in r){const t=r[e];if("root"===e||a.isTemplate(t)){o[e]=t;continue}if("string"==typeof t){o[e]=new a(t);continue}n("object"==typeof t&&!Array.isArray(t),"Invalid message for",e);const s=e;for(e in o[s]=o[s]||{},t){const r=t[e];"root"===e||a.isTemplate(r)?o[s][e]=r:(n("string"==typeof r,"Invalid message for",e,"in",s),o[s][e]=new a(r))}}return o}},2294:(e,t,r)=>{"use strict";const n=r(375),s=r(8160),a=r(6133),o={};t.Ids=o.Ids=class{constructor(){this._byId=new Map,this._byKey=new Map,this._schemaChain=!1}clone(){const e=new o.Ids;return e._byId=new Map(this._byId),e._byKey=new Map(this._byKey),e._schemaChain=this._schemaChain,e}concat(e){e._schemaChain&&(this._schemaChain=!0);for(const[t,r]of e._byId.entries())n(!this._byKey.has(t),"Schema id conflicts with existing key:",t),this._byId.set(t,r);for(const[t,r]of e._byKey.entries())n(!this._byId.has(t),"Schema key conflicts with existing id:",t),this._byKey.set(t,r)}fork(e,t,r){const a=this._collect(e);a.push({schema:r});const i=a.shift();let l={id:i.id,schema:t(i.schema)};n(s.isSchema(l.schema),"adjuster function failed to return a joi schema type");for(const e of a)l={id:e.id,schema:o.fork(e.schema,l.id,l.schema)};return l.schema}labels(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const r=e[0],n=this._get(r);if(!n)return[...t,...e].join(".");const s=e.slice(1);return t=[...t,n.schema._flags.label||r],s.length?n.schema._ids.labels(s,t):t.join(".")}reach(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const r=e[0],s=this._get(r);n(s,"Schema does not contain path",[...t,...e].join("."));const a=e.slice(1);return a.length?s.schema._ids.reach(a,[...t,r]):s.schema}register(e){let{key:t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e||!s.isSchema(e))return;(e.$_property("schemaChain")||e._ids._schemaChain)&&(this._schemaChain=!0);const r=e._flags.id;if(r){const t=this._byId.get(r);n(!t||t.schema===e,"Cannot add different schemas with the same id:",r),n(!this._byKey.has(r),"Schema id conflicts with existing key:",r),this._byId.set(r,{schema:e,id:r})}t&&(n(!this._byKey.has(t),"Schema already contains key:",t),n(!this._byId.has(t),"Schema key conflicts with existing id:",t),this._byKey.set(t,{schema:e,id:t}))}reset(){this._byId=new Map,this._byKey=new Map,this._schemaChain=!1}_collect(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];const s=e[0],a=this._get(s);n(a,"Schema does not contain path",[...t,...e].join(".")),r=[a,...r];const o=e.slice(1);return o.length?a.schema._ids._collect(o,[...t,s],r):r}_get(e){return this._byId.get(e)||this._byKey.get(e)}},o.fork=function(e,r,n){const s=t.schema(e,{each:(e,t)=>{let{key:s}=t;if(r===(e._flags.id||s))return n},ref:!1});return s?s.$_mutateRebuild():e},t.schema=function(e,t){let r;for(const n in e._flags){if("_"===n[0])continue;const s=o.scan(e._flags[n],{source:"flags",name:n},t);void 0!==s&&(r=r||e.clone(),r._flags[n]=s)}for(let n=0;n<e._rules.length;++n){const s=e._rules[n],a=o.scan(s.args,{source:"rules",name:s.name},t);if(void 0!==a){r=r||e.clone();const t=Object.assign({},s);t.args=a,r._rules[n]=t,r._singleRules.get(s.name)===s&&r._singleRules.set(s.name,t)}}for(const n in e.$_terms){if("_"===n[0])continue;const s=o.scan(e.$_terms[n],{source:"terms",name:n},t);void 0!==s&&(r=r||e.clone(),r.$_terms[n]=s)}return r},o.scan=function(e,t,r,n,i){const l=n||[];if(null===e||"object"!=typeof e)return;let c;if(Array.isArray(e)){for(let n=0;n<e.length;++n){const s="terms"===t.source&&"keys"===t.name&&e[n].key,a=o.scan(e[n],t,r,[n,...l],s);void 0!==a&&(c=c||e.slice(),c[n]=a)}return c}if(!1!==r.schema&&s.isSchema(e)||!1!==r.ref&&a.isRef(e)){const n=r.each(e,{...t,path:l,key:i});if(n===e)return;return n}for(const n in e){if("_"===n[0])continue;const s=o.scan(e[n],t,r,[n,...l],i);void 0!==s&&(c=c||Object.assign({},e),c[n]=s)}return c}},6133:(e,t,r)=>{"use strict";const n=r(375),s=r(8571),a=r(9621),o=r(8160);let i;const l={symbol:Symbol("ref"),defaults:{adjust:null,in:!1,iterables:null,map:null,separator:".",type:"value"}};t.create=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n("string"==typeof e,"Invalid reference key:",e),o.assertOptions(t,["adjust","ancestor","in","iterables","map","prefix","render","separator"]),n(!t.prefix||"object"==typeof t.prefix,"options.prefix must be of type object");const r=Object.assign({},l.defaults,t);delete r.prefix;const s=r.separator,a=l.context(e,s,t.prefix);if(r.type=a.type,e=a.key,"value"===r.type)if(a.root&&(n(!s||e[0]!==s,"Cannot specify relative path with root prefix"),r.ancestor="root",e||(e=null)),s&&s===e)e=null,r.ancestor=0;else if(void 0!==r.ancestor)n(!s||!e||e[0]!==s,"Cannot combine prefix with ancestor option");else{const[t,n]=l.ancestor(e,s);n&&""===(e=e.slice(n))&&(e=null),r.ancestor=t}return r.path=s?null===e?[]:e.split(s):[e],new l.Ref(r)},t.in=function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.create(e,{...r,in:!0})},t.isRef=function(e){return!!e&&!!e[o.symbols.ref]},l.Ref=class{constructor(e){n("object"==typeof e,"Invalid reference construction"),o.assertOptions(e,["adjust","ancestor","in","iterables","map","path","render","separator","type","depth","key","root","display"]),n([!1,void 0].includes(e.separator)||"string"==typeof e.separator&&1===e.separator.length,"Invalid separator"),n(!e.adjust||"function"==typeof e.adjust,"options.adjust must be a function"),n(!e.map||Array.isArray(e.map),"options.map must be an array"),n(!e.map||!e.adjust,"Cannot set both map and adjust options"),Object.assign(this,l.defaults,e),n("value"===this.type||void 0===this.ancestor,"Non-value references cannot reference ancestors"),Array.isArray(this.map)&&(this.map=new Map(this.map)),this.depth=this.path.length,this.key=this.path.length?this.path.join(this.separator):null,this.root=this.path[0],this.updateDisplay()}resolve(e,t,r,s){let a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};return n(!this.in||a.in,"Invalid in() reference usage"),"global"===this.type?this._resolve(r.context,t,a):"local"===this.type?this._resolve(s,t,a):this.ancestor?"root"===this.ancestor?this._resolve(t.ancestors[t.ancestors.length-1],t,a):(n(this.ancestor<=t.ancestors.length,"Invalid reference exceeds the schema root:",this.display),this._resolve(t.ancestors[this.ancestor-1],t,a)):this._resolve(e,t,a)}_resolve(e,t,r){let n;if("value"===this.type&&t.mainstay.shadow&&!1!==r.shadow&&(n=t.mainstay.shadow.get(this.absolute(t))),void 0===n&&(n=a(e,this.path,{iterables:this.iterables,functions:!0})),this.adjust&&(n=this.adjust(n)),this.map){const e=this.map.get(n);void 0!==e&&(n=e)}return t.mainstay&&t.mainstay.tracer.resolve(t,this,n),n}toString(){return this.display}absolute(e){return[...e.path.slice(0,-this.ancestor),...this.path]}clone(){return new l.Ref(this)}describe(){const e={path:this.path};"value"!==this.type&&(e.type=this.type),"."!==this.separator&&(e.separator=this.separator),"value"===this.type&&1!==this.ancestor&&(e.ancestor=this.ancestor),this.map&&(e.map=[...this.map]);for(const t of["adjust","iterables","render"])null!==this[t]&&void 0!==this[t]&&(e[t]=this[t]);return!1!==this.in&&(e.in=!0),{ref:e}}updateDisplay(){const e=null!==this.key?this.key:"";if("value"!==this.type)return void(this.display=`ref:${this.type}:${e}`);if(!this.separator)return void(this.display=`ref:${e}`);if(!this.ancestor)return void(this.display=`ref:${this.separator}${e}`);if("root"===this.ancestor)return void(this.display=`ref:root:${e}`);if(1===this.ancestor)return void(this.display=`ref:${e||".."}`);const t=new Array(this.ancestor+1).fill(this.separator).join("");this.display=`ref:${t}${e||""}`}},l.Ref.prototype[o.symbols.ref]=!0,t.build=function(e){return"value"===(e=Object.assign({},l.defaults,e)).type&&void 0===e.ancestor&&(e.ancestor=1),new l.Ref(e)},l.context=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(e=e.trim(),r){const n=void 0===r.global?"$":r.global;if(n!==t&&e.startsWith(n))return{key:e.slice(n.length),type:"global"};const s=void 0===r.local?"#":r.local;if(s!==t&&e.startsWith(s))return{key:e.slice(s.length),type:"local"};const a=void 0===r.root?"/":r.root;if(a!==t&&e.startsWith(a))return{key:e.slice(a.length),type:"value",root:!0}}return{key:e,type:"value"}},l.ancestor=function(e,t){if(!t)return[1,0];if(e[0]!==t)return[1,0];if(e[1]!==t)return[0,1];let r=2;for(;e[r]===t;)++r;return[r-1,r]},t.toSibling=0,t.toParent=1,t.Manager=class{constructor(){this.refs=[]}register(e,n){if(e)if(n=void 0===n?t.toParent:n,Array.isArray(e))for(const t of e)this.register(t,n);else if(o.isSchema(e))for(const t of e._refs.refs)t.ancestor-n>=0&&this.refs.push({ancestor:t.ancestor-n,root:t.root});else t.isRef(e)&&"value"===e.type&&e.ancestor-n>=0&&this.refs.push({ancestor:e.ancestor-n,root:e.root}),i=i||r(3328),i.isTemplate(e)&&this.register(e.refs(),n)}get length(){return this.refs.length}clone(){const e=new t.Manager;return e.refs=s(this.refs),e}reset(){this.refs=[]}roots(){return this.refs.filter((e=>!e.ancestor)).map((e=>e.root))}}},3378:(e,t,r)=>{"use strict";const n=r(5107),s={};s.wrap=n.string().min(1).max(2).allow(!1),t.preferences=n.object({allowUnknown:n.boolean(),abortEarly:n.boolean(),artifacts:n.boolean(),cache:n.boolean(),context:n.object(),convert:n.boolean(),dateFormat:n.valid("date","iso","string","time","utc"),debug:n.boolean(),errors:{escapeHtml:n.boolean(),label:n.valid("path","key",!1),language:[n.string(),n.object().ref()],render:n.boolean(),stack:n.boolean(),wrap:{label:s.wrap,array:s.wrap,string:s.wrap}},externals:n.boolean(),messages:n.object(),noDefaults:n.boolean(),nonEnumerables:n.boolean(),presence:n.valid("required","optional","forbidden"),skipFunctions:n.boolean(),stripUnknown:n.object({arrays:n.boolean(),objects:n.boolean()}).or("arrays","objects").allow(!0,!1),warnings:n.boolean()}).strict(),s.nameRx=/^[a-zA-Z0-9]\w*$/,s.rule=n.object({alias:n.array().items(n.string().pattern(s.nameRx)).single(),args:n.array().items(n.string(),n.object({name:n.string().pattern(s.nameRx).required(),ref:n.boolean(),assert:n.alternatives([n.function(),n.object().schema()]).conditional("ref",{is:!0,then:n.required()}),normalize:n.function(),message:n.string().when("assert",{is:n.function(),then:n.required()})})),convert:n.boolean(),manifest:n.boolean(),method:n.function().allow(!1),multi:n.boolean(),validate:n.function()}),t.extension=n.object({type:n.alternatives([n.string(),n.object().regex()]).required(),args:n.function(),cast:n.object().pattern(s.nameRx,n.object({from:n.function().maxArity(1).required(),to:n.function().minArity(1).maxArity(2).required()})),base:n.object().schema().when("type",{is:n.object().regex(),then:n.forbidden()}),coerce:[n.function().maxArity(3),n.object({method:n.function().maxArity(3).required(),from:n.array().items(n.string()).single()})],flags:n.object().pattern(s.nameRx,n.object({setter:n.string(),default:n.any()})),manifest:{build:n.function().arity(2)},messages:[n.object(),n.string()],modifiers:n.object().pattern(s.nameRx,n.function().minArity(1).maxArity(2)),overrides:n.object().pattern(s.nameRx,n.function()),prepare:n.function().maxArity(3),rebuild:n.function().arity(1),rules:n.object().pattern(s.nameRx,s.rule),terms:n.object().pattern(s.nameRx,n.object({init:n.array().allow(null).required(),manifest:n.object().pattern(/.+/,[n.valid("schema","single"),n.object({mapped:n.object({from:n.string().required(),to:n.string().required()}).required()})])})),validate:n.function().maxArity(3)}).strict(),t.extensions=n.array().items(n.object(),n.function().arity(1)).strict(),s.desc={buffer:n.object({buffer:n.string()}),func:n.object({function:n.function().required(),options:{literal:!0}}),override:n.object({override:!0}),ref:n.object({ref:n.object({type:n.valid("value","global","local"),path:n.array().required(),separator:n.string().length(1).allow(!1),ancestor:n.number().min(0).integer().allow("root"),map:n.array().items(n.array().length(2)).min(1),adjust:n.function(),iterables:n.boolean(),in:n.boolean(),render:n.boolean()}).required()}),regex:n.object({regex:n.string().min(3)}),special:n.object({special:n.valid("deep").required()}),template:n.object({template:n.string().required(),options:n.object()}),value:n.object({value:n.alternatives([n.object(),n.array()]).required()})},s.desc.entity=n.alternatives([n.array().items(n.link("...")),n.boolean(),n.function(),n.number(),n.string(),s.desc.buffer,s.desc.func,s.desc.ref,s.desc.regex,s.desc.special,s.desc.template,s.desc.value,n.link("/")]),s.desc.values=n.array().items(null,n.boolean(),n.function(),n.number().allow(1/0,-1/0),n.string().allow(""),n.symbol(),s.desc.buffer,s.desc.func,s.desc.override,s.desc.ref,s.desc.regex,s.desc.template,s.desc.value),s.desc.messages=n.object().pattern(/.+/,[n.string(),s.desc.template,n.object().pattern(/.+/,[n.string(),s.desc.template])]),t.description=n.object({type:n.string().required(),flags:n.object({cast:n.string(),default:n.any(),description:n.string(),empty:n.link("/"),failover:s.desc.entity,id:n.string(),label:n.string(),only:!0,presence:["optional","required","forbidden"],result:["raw","strip"],strip:n.boolean(),unit:n.string()}).unknown(),preferences:{allowUnknown:n.boolean(),abortEarly:n.boolean(),artifacts:n.boolean(),cache:n.boolean(),convert:n.boolean(),dateFormat:["date","iso","string","time","utc"],errors:{escapeHtml:n.boolean(),label:["path","key"],language:[n.string(),s.desc.ref],wrap:{label:s.wrap,array:s.wrap}},externals:n.boolean(),messages:s.desc.messages,noDefaults:n.boolean(),nonEnumerables:n.boolean(),presence:["required","optional","forbidden"],skipFunctions:n.boolean(),stripUnknown:n.object({arrays:n.boolean(),objects:n.boolean()}).or("arrays","objects").allow(!0,!1),warnings:n.boolean()},allow:s.desc.values,invalid:s.desc.values,rules:n.array().min(1).items({name:n.string().required(),args:n.object().min(1),keep:n.boolean(),message:[n.string(),s.desc.messages],warn:n.boolean()}),keys:n.object().pattern(/.*/,n.link("/")),link:s.desc.ref}).pattern(/^[a-z]\w*$/,n.any())},493:(e,t,r)=>{"use strict";const n=r(8571),s=r(9621),a=r(8160),o={value:Symbol("value")};e.exports=o.State=class{constructor(e,t,r){this.path=e,this.ancestors=t,this.mainstay=r.mainstay,this.schemas=r.schemas,this.debug=null}localize(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;const n=new o.State(e,t,this);return r&&n.schemas&&(n.schemas=[o.schemas(r),...n.schemas]),n}nest(e,t){const r=new o.State(this.path,this.ancestors,this);return r.schemas=r.schemas&&[o.schemas(e),...r.schemas],r.debug=t,r}shadow(e,t){this.mainstay.shadow=this.mainstay.shadow||new o.Shadow,this.mainstay.shadow.set(this.path,e,t)}snapshot(){this.mainstay.shadow&&(this._snapshot=n(this.mainstay.shadow.node(this.path))),this.mainstay.snapshot()}restore(){this.mainstay.shadow&&(this.mainstay.shadow.override(this.path,this._snapshot),this._snapshot=void 0),this.mainstay.restore()}commit(){this.mainstay.shadow&&(this.mainstay.shadow.override(this.path,this._snapshot),this._snapshot=void 0),this.mainstay.commit()}},o.schemas=function(e){return a.isSchema(e)?{schema:e}:e},o.Shadow=class{constructor(){this._values=null}set(e,t,r){if(!e.length)return;if("strip"===r&&"number"==typeof e[e.length-1])return;this._values=this._values||new Map;let n=this._values;for(let t=0;t<e.length;++t){const r=e[t];let s=n.get(r);s||(s=new Map,n.set(r,s)),n=s}n[o.value]=t}get(e){const t=this.node(e);if(t)return t[o.value]}node(e){if(this._values)return s(this._values,e,{iterables:!0})}override(e,t){if(!this._values)return;const r=e.slice(0,-1),n=e[e.length-1],a=s(this._values,r,{iterables:!0});t?a.set(n,t):a&&a.delete(n)}}},3328:(e,t,r)=>{"use strict";const n=r(375),s=r(8571),a=r(5277),o=r(1447),i=r(8160),l=r(6354),c=r(6133),u={symbol:Symbol("template"),opens:new Array(1e3).join("\0"),closes:new Array(1e3).join(""),dateFormat:{date:Date.prototype.toDateString,iso:Date.prototype.toISOString,string:Date.prototype.toString,time:Date.prototype.toTimeString,utc:Date.prototype.toUTCString}};e.exports=u.Template=class{constructor(e,t){n("string"==typeof e,"Template source must be a string"),n(!e.includes("\0")&&!e.includes(""),"Template source cannot contain reserved control characters"),this.source=e,this.rendered=e,this._template=null,this._settings=s(t),this._parse()}_parse(){if(!this.source.includes("{"))return;const e=u.encode(this.source),t=u.split(e);let r=!1;const n=[],s=t.shift();s&&n.push(s);for(const e of t){const t="{"!==e[0],s=t?"}":"}}",a=e.indexOf(s);if(-1===a||"{"===e[1]){n.push(`{${u.decode(e)}`);continue}let o=e.slice(t?0:1,a);const i=":"===o[0];i&&(o=o.slice(1));const l=this._ref(u.decode(o),{raw:t,wrapped:i});n.push(l),"string"!=typeof l&&(r=!0);const c=e.slice(a+s.length);c&&n.push(u.decode(c))}r?this._template=n:this.rendered=n.join("")}static date(e,t){return u.dateFormat[t.dateFormat].call(e)}describe(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this._settings&&e.compact)return this.source;const t={template:this.source};return this._settings&&(t.options=this._settings),t}static build(e){return new u.Template(e.template,e.options)}isDynamic(){return!!this._template}static isTemplate(e){return!!e&&!!e[i.symbols.template]}refs(){if(!this._template)return;const e=[];for(const t of this._template)"string"!=typeof t&&e.push(...t.refs);return e}resolve(e,t,r,n){return this._template&&1===this._template.length?this._part(this._template[0],e,t,r,n,{}):this.render(e,t,r,n)}_part(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return e.ref?e.ref.resolve(...r):e.formula.evaluate(r)}render(e,t,r,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};if(!this.isDynamic())return this.rendered;const o=[];for(const i of this._template)if("string"==typeof i)o.push(i);else{const l=this._part(i,e,t,r,n,s),c=u.stringify(l,e,t,r,n,s);if(void 0!==c){const e=i.raw||!1===(s.errors&&s.errors.escapeHtml)?c:a(c);o.push(u.wrap(e,i.wrapped&&r.errors.wrap.label))}}return o.join("")}_ref(e,t){let{raw:r,wrapped:n}=t;const s=[],a=e=>{const t=c.create(e,this._settings);return s.push(t),e=>t.resolve(...e)};try{var i=new o.Parser(e,{reference:a,functions:u.functions,constants:u.constants})}catch(t){throw t.message=`Invalid template variable "${e}" fails due to: ${t.message}`,t}if(i.single){if("reference"===i.single.type){const e=s[0];return{ref:e,raw:r,refs:s,wrapped:n||"local"===e.type&&"label"===e.key}}return u.stringify(i.single.value)}return{formula:i,raw:r,refs:s}}toString(){return this.source}},u.Template.prototype[i.symbols.template]=!0,u.Template.prototype.isImmutable=!0,u.encode=function(e){return e.replace(/\\(\{+)/g,((e,t)=>u.opens.slice(0,t.length))).replace(/\\(\}+)/g,((e,t)=>u.closes.slice(0,t.length)))},u.decode=function(e){return e.replace(/\u0000/g,"{").replace(/\u0001/g,"}")},u.split=function(e){const t=[];let r="";for(let n=0;n<e.length;++n){const s=e[n];if("{"===s){let s="";for(;n+1<e.length&&"{"===e[n+1];)s+="{",++n;t.push(r),r=s}else r+=s}return t.push(r),t},u.wrap=function(e,t){return t?1===t.length?`${t}${e}${t}`:`${t[0]}${e}${t[1]}`:e},u.stringify=function(e,t,r,n,s){let a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};const o=typeof e,i=n&&n.errors&&n.errors.wrap||{};let l=!1;if(c.isRef(e)&&e.render&&(l=e.in,e=e.resolve(t,r,n,s,{in:e.in,...a})),null===e)return"null";if("string"===o)return u.wrap(e,a.arrayItems&&i.string);if("number"===o||"function"===o||"symbol"===o)return e.toString();if("object"!==o)return JSON.stringify(e);if(e instanceof Date)return u.Template.date(e,n);if(e instanceof Map){const t=[];for(const[r,n]of e.entries())t.push(`${r.toString()} -> ${n.toString()}`);e=t}if(!Array.isArray(e))return e.toString();const f=[];for(const o of e)f.push(u.stringify(o,t,r,n,s,{arrayItems:!0,...a}));return u.wrap(f.join(", "),!l&&i.array)},u.constants={true:!0,false:!1,null:null,second:1e3,minute:6e4,hour:36e5,day:864e5},u.functions={if:(e,t,r)=>e?t:r,length:e=>"string"==typeof e?e.length:e&&"object"==typeof e?Array.isArray(e)?e.length:Object.keys(e).length:null,msg(e){const[t,r,n,s,a]=this,o=a.messages;if(!o)return"";const i=l.template(t,o[0],e,r,n)||l.template(t,o[1],e,r,n);return i?i.render(t,r,n,s,a):""},number:e=>"number"==typeof e?e:"string"==typeof e?parseFloat(e):"boolean"==typeof e?e?1:0:e instanceof Date?e.getTime():null}},4946:(e,t,r)=>{"use strict";const n=r(375),s=r(1687),a=r(8068),o=r(8160),i=r(3292),l=r(6354),c=r(6133),u={};e.exports=a.extend({type:"alternatives",flags:{match:{default:"any"}},terms:{matches:{init:[],register:c.toSibling}},args(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return 1===r.length&&Array.isArray(r[0])?e.try(...r[0]):e.try(...r)},validate(e,t){const{schema:r,error:n,state:a,prefs:o}=t;if(r._flags.match){const t=[],i=[];for(let n=0;n<r.$_terms.matches.length;++n){const s=r.$_terms.matches[n],l=a.nest(s.schema,`match.${n}`);l.snapshot();const c=s.schema.$_validate(e,l,o);c.errors?(i.push(c.errors),l.restore()):(t.push(c.value),l.commit())}if(0===t.length)return{errors:n("alternatives.any",{details:i.map((e=>l.details(e,{override:!1})))})};if("one"===r._flags.match)return 1===t.length?{value:t[0]}:{errors:n("alternatives.one")};if(t.length!==r.$_terms.matches.length)return{errors:n("alternatives.all",{details:i.map((e=>l.details(e,{override:!1})))})};const c=e=>e.$_terms.matches.some((e=>"object"===e.schema.type||"alternatives"===e.schema.type&&c(e.schema)));return c(r)?{value:t.reduce(((e,t)=>s(e,t,{mergeArrays:!1})))}:{value:t[t.length-1]}}const i=[];for(let t=0;t<r.$_terms.matches.length;++t){const n=r.$_terms.matches[t];if(n.schema){const r=a.nest(n.schema,`match.${t}`);r.snapshot();const s=n.schema.$_validate(e,r,o);if(!s.errors)return r.commit(),s;r.restore(),i.push({schema:n.schema,reports:s.errors});continue}const s=n.ref?n.ref.resolve(e,a,o):e,l=n.is?[n]:n.switch;for(let r=0;r<l.length;++r){const i=l[r],{is:c,then:u,otherwise:f}=i,d=`match.${t}${n.switch?"."+r:""}`;if(c.$_match(s,a.nest(c,`${d}.is`),o)){if(u)return u.$_validate(e,a.nest(u,`${d}.then`),o)}else if(f)return f.$_validate(e,a.nest(f,`${d}.otherwise`),o)}}return u.errors(i,t)},rules:{conditional:{method(e,t){n(!this._flags._endedSwitch,"Unreachable condition"),n(!this._flags.match,"Cannot combine match mode",this._flags.match,"with conditional rule"),n(void 0===t.break,"Cannot use break option with alternatives conditional");const r=this.clone(),s=i.when(r,e,t),a=s.is?[s]:s.switch;for(const e of a)if(e.then&&e.otherwise){r.$_setFlag("_endedSwitch",!0,{clone:!1});break}return r.$_terms.matches.push(s),r.$_mutateRebuild()}},match:{method(e){if(n(["any","one","all"].includes(e),"Invalid alternatives match mode",e),"any"!==e)for(const t of this.$_terms.matches)n(t.schema,"Cannot combine match mode",e,"with conditional rules");return this.$_setFlag("match",e)}},try:{method(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];n(t.length,"Missing alternative schemas"),o.verifyFlat(t,"try"),n(!this._flags._endedSwitch,"Unreachable condition");const s=this.clone();for(const e of t)s.$_terms.matches.push({schema:s.$_compile(e)});return s.$_mutateRebuild()}}},overrides:{label(e){return this.$_parent("label",e).$_modify({each:(t,r)=>"is"!==r.path[0]?t.label(e):void 0,ref:!1})}},rebuild(e){e.$_modify({each:t=>{o.isSchema(t)&&"array"===t.type&&e.$_setFlag("_arrayItems",!0,{clone:!1})}})},manifest:{build(e,t){if(t.matches)for(const r of t.matches){const{schema:t,ref:n,is:s,not:a,then:o,otherwise:i}=r;e=t?e.try(t):n?e.conditional(n,{is:s,then:o,not:a,otherwise:i,switch:r.switch}):e.conditional(s,{then:o,otherwise:i})}return e}},messages:{"alternatives.all":"{{#label}} does not match all of the required types","alternatives.any":"{{#label}} does not match any of the allowed types","alternatives.match":"{{#label}} does not match any of the allowed types","alternatives.one":"{{#label}} matches more than one allowed type","alternatives.types":"{{#label}} must be one of {{#types}}"}}),u.errors=function(e,t){let{error:r,state:n}=t;if(!e.length)return{errors:r("alternatives.any")};if(1===e.length)return{errors:e[0].reports};const s=new Set,a=[];for(const{reports:t,schema:o}of e){if(t.length>1)return u.unmatched(e,r);const i=t[0];if(i instanceof l.Report==0)return u.unmatched(e,r);if(i.state.path.length!==n.path.length){a.push({type:o.type,report:i});continue}if("any.only"===i.code){for(const e of i.local.valids)s.add(e);continue}const[c,f]=i.code.split(".");"base"===f?s.add(c):a.push({type:o.type,report:i})}return a.length?1===a.length?{errors:a[0].report}:u.unmatched(e,r):{errors:r("alternatives.types",{types:[...s]})}},u.unmatched=function(e,t){const r=[];for(const t of e)r.push(...t.reports);return{errors:t("alternatives.match",l.details(r,{override:!1}))}}},8068:(e,t,r)=>{"use strict";const n=r(375),s=r(7629),a=r(8160),o=r(6914);e.exports=s.extend({type:"any",flags:{only:{default:!1}},terms:{alterations:{init:null},examples:{init:null},externals:{init:null},metas:{init:[]},notes:{init:[]},shared:{init:null},tags:{init:[]},whens:{init:null}},rules:{custom:{method(e,t){return n("function"==typeof e,"Method must be a function"),n(void 0===t||t&&"string"==typeof t,"Description must be a non-empty string"),this.$_addRule({name:"custom",args:{method:e,description:t}})},validate(e,t,r){let{method:n}=r;try{return n(e,t)}catch(e){return t.error("any.custom",{error:e})}},args:["method","description"],multi:!0},messages:{method(e){return this.prefs({messages:e})}},shared:{method(e){n(a.isSchema(e)&&e._flags.id,"Schema must be a schema with an id");const t=this.clone();return t.$_terms.shared=t.$_terms.shared||[],t.$_terms.shared.push(e),t.$_mutateRegister(e),t}},warning:{method(e,t){return n(e&&"string"==typeof e,"Invalid warning code"),this.$_addRule({name:"warning",args:{code:e,local:t},warn:!0})},validate(e,t,r){let{code:n,local:s}=r;return t.error(n,s)},args:["code","local"],multi:!0}},modifiers:{keep(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];e.keep=t},message(e,t){e.message=o.compile(t)},warn(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];e.warn=t}},manifest:{build(e,t){for(const r in t){const n=t[r];if(["examples","externals","metas","notes","tags"].includes(r))for(const t of n)e=e[r.slice(0,-1)](t);else if("alterations"!==r)if("whens"!==r){if("shared"===r)for(const t of n)e=e.shared(t)}else for(const t of n){const{ref:r,is:n,not:s,then:a,otherwise:o,concat:i}=t;e=i?e.concat(i):r?e.when(r,{is:n,not:s,then:a,otherwise:o,switch:t.switch,break:t.break}):e.when(n,{then:a,otherwise:o,break:t.break})}else{const t={};for(const{target:e,adjuster:r}of n)t[e]=r;e=e.alter(t)}}return e}},messages:{"any.custom":"{{#label}} failed custom validation because {{#error.message}}","any.default":"{{#label}} threw an error when running default method","any.failover":"{{#label}} threw an error when running failover method","any.invalid":"{{#label}} contains an invalid value","any.only":'{{#label}} must be {if(#valids.length == 1, "", "one of ")}{{#valids}}',"any.ref":"{{#label}} {{#arg}} references {{:#ref}} which {{#reason}}","any.required":"{{#label}} is required","any.unknown":"{{#label}} is not allowed"}})},546:(e,t,r)=>{"use strict";const n=r(375),s=r(9474),a=r(9621),o=r(8068),i=r(8160),l=r(3292),c={};e.exports=o.extend({type:"array",flags:{single:{default:!1},sparse:{default:!1}},terms:{items:{init:[],manifest:"schema"},ordered:{init:[],manifest:"schema"},_exclusions:{init:[]},_inclusions:{init:[]},_requireds:{init:[]}},coerce:{from:"object",method(e,t){let{schema:r,state:n,prefs:s}=t;if(!Array.isArray(e))return;const a=r.$_getRule("sort");return a?c.sort(r,e,a.args.options,n,s):void 0}},validate(e,t){let{schema:r,error:n}=t;if(!Array.isArray(e)){if(r._flags.single){const t=[e];return t[i.symbols.arraySingle]=!0,{value:t}}return{errors:n("array.base")}}if(r.$_getRule("items")||r.$_terms.externals)return{value:e.slice()}},rules:{has:{method(e){e=this.$_compile(e,{appendPath:!0});const t=this.$_addRule({name:"has",args:{schema:e}});return t.$_mutateRegister(e),t},validate(e,t,r){let{state:n,prefs:s,error:a}=t,{schema:o}=r;const i=[e,...n.ancestors];for(let t=0;t<e.length;++t){const r=n.localize([...n.path,t],i,o);if(o.$_match(e[t],r,s))return e}const l=o._flags.label;return l?a("array.hasKnown",{patternLabel:l}):a("array.hasUnknown",null)},multi:!0},items:{method(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];i.verifyFlat(t,"items");const n=this.$_addRule("items");for(let e=0;e<t.length;++e){const r=i.tryWithPath((()=>this.$_compile(t[e])),e,{append:!0});n.$_terms.items.push(r)}return n.$_mutateRebuild()},validate(e,t){let{schema:r,error:n,state:s,prefs:a,errorsArray:o}=t;const l=r.$_terms._requireds.slice(),u=r.$_terms.ordered.slice(),f=[...r.$_terms._inclusions,...l],d=!e[i.symbols.arraySingle];delete e[i.symbols.arraySingle];const m=o();let p=e.length;for(let t=0;t<p;++t){const o=e[t];let i=!1,h=!1;const g=d?t:new Number(t),y=[...s.path,g];if(!r._flags.sparse&&void 0===o){if(m.push(n("array.sparse",{key:g,path:y,pos:t,value:void 0},s.localize(y))),a.abortEarly)return m;u.shift();continue}const v=[e,...s.ancestors];for(const e of r.$_terms._exclusions)if(e.$_match(o,s.localize(y,v,e),a,{presence:"ignore"})){if(m.push(n("array.excludes",{pos:t,value:o},s.localize(y))),a.abortEarly)return m;i=!0,u.shift();break}if(i)continue;if(r.$_terms.ordered.length){if(u.length){const i=u.shift(),l=i.$_validate(o,s.localize(y,v,i),a);if(l.errors){if(m.push(...l.errors),a.abortEarly)return m}else if("strip"===i._flags.result)c.fastSplice(e,t),--t,--p;else{if(!r._flags.sparse&&void 0===l.value){if(m.push(n("array.sparse",{key:g,path:y,pos:t,value:void 0},s.localize(y))),a.abortEarly)return m;continue}e[t]=l.value}continue}if(!r.$_terms.items.length){if(m.push(n("array.orderedLength",{pos:t,limit:r.$_terms.ordered.length})),a.abortEarly)return m;break}}const b=[];let _=l.length;for(let i=0;i<_;++i){const u=s.localize(y,v,l[i]);u.snapshot();const f=l[i].$_validate(o,u,a);if(b[i]=f,!f.errors){if(u.commit(),e[t]=f.value,h=!0,c.fastSplice(l,i),--i,--_,!r._flags.sparse&&void 0===f.value&&(m.push(n("array.sparse",{key:g,path:y,pos:t,value:void 0},s.localize(y))),a.abortEarly))return m;break}u.restore()}if(h)continue;const w=a.stripUnknown&&!!a.stripUnknown.arrays||!1;_=f.length;for(const u of f){let f;const d=l.indexOf(u);if(-1!==d)f=b[d];else{const l=s.localize(y,v,u);if(l.snapshot(),f=u.$_validate(o,l,a),!f.errors){l.commit(),"strip"===u._flags.result?(c.fastSplice(e,t),--t,--p):r._flags.sparse||void 0!==f.value?e[t]=f.value:(m.push(n("array.sparse",{key:g,path:y,pos:t,value:void 0},s.localize(y))),i=!0),h=!0;break}l.restore()}if(1===_){if(w){c.fastSplice(e,t),--t,--p,h=!0;break}if(m.push(...f.errors),a.abortEarly)return m;i=!0;break}}if(!i&&(r.$_terms._inclusions.length||r.$_terms._requireds.length)&&!h){if(w){c.fastSplice(e,t),--t,--p;continue}if(m.push(n("array.includes",{pos:t,value:o},s.localize(y))),a.abortEarly)return m}}return l.length&&c.fillMissedErrors(r,m,l,e,s,a),u.length&&(c.fillOrderedErrors(r,m,u,e,s,a),m.length||c.fillDefault(u,e,s,a)),m.length?m:e},priority:!0,manifest:!1},length:{method(e){return this.$_addRule({name:"length",args:{limit:e},operator:"="})},validate(e,t,r,n){let{limit:s}=r,{name:a,operator:o,args:l}=n;return i.compare(e.length,s,o)?e:t.error("array."+a,{limit:l.limit,value:e})},args:[{name:"limit",ref:!0,assert:i.limit,message:"must be a positive integer"}]},max:{method(e){return this.$_addRule({name:"max",method:"length",args:{limit:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"length",args:{limit:e},operator:">="})}},ordered:{method(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];i.verifyFlat(t,"ordered");const n=this.$_addRule("items");for(let e=0;e<t.length;++e){const r=i.tryWithPath((()=>this.$_compile(t[e])),e,{append:!0});c.validateSingle(r,n),n.$_mutateRegister(r),n.$_terms.ordered.push(r)}return n.$_mutateRebuild()}},single:{method(e){const t=void 0===e||!!e;return n(!t||!this._flags._arrayItems,"Cannot specify single rule when array has array items"),this.$_setFlag("single",t)}},sort:{method(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i.assertOptions(e,["by","order"]);const t={order:e.order||"ascending"};return e.by&&(t.by=l.ref(e.by,{ancestor:0}),n(!t.by.ancestor,"Cannot sort by ancestor")),this.$_addRule({name:"sort",args:{options:t}})},validate(e,t,r){let{error:n,state:s,prefs:a,schema:o}=t,{options:i}=r;const{value:l,errors:u}=c.sort(o,e,i,s,a);if(u)return u;for(let t=0;t<e.length;++t)if(e[t]!==l[t])return n("array.sort",{order:i.order,by:i.by?i.by.key:"value"});return e},convert:!0},sparse:{method(e){const t=void 0===e||!!e;return this._flags.sparse===t?this:(t?this.clone():this.$_addRule("items")).$_setFlag("sparse",t,{clone:!1})}},unique:{method(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n(!e||"function"==typeof e||"string"==typeof e,"comparator must be a function or a string"),i.assertOptions(t,["ignoreUndefined","separator"]);const r={name:"unique",args:{options:t,comparator:e}};if(e)if("string"==typeof e){const n=i.default(t.separator,".");r.path=n?e.split(n):[e]}else r.comparator=e;return this.$_addRule(r)},validate(e,t,r,o){let{state:i,error:l,schema:c}=t,{comparator:u,options:f}=r,{comparator:d,path:m}=o;const p={string:Object.create(null),number:Object.create(null),undefined:Object.create(null),boolean:Object.create(null),object:new Map,function:new Map,custom:new Map},h=d||s,g=f.ignoreUndefined;for(let t=0;t<e.length;++t){const r=m?a(e[t],m):e[t],s=d?p.custom:p[typeof r];if(n(s,"Failed to find unique map container for type",typeof r),s instanceof Map){const n=s.entries();let a;for(;!(a=n.next()).done;)if(h(a.value[0],r)){const r=i.localize([...i.path,t],[e,...i.ancestors]),n={pos:t,value:e[t],dupePos:a.value[1],dupeValue:e[a.value[1]]};return m&&(n.path=u),l("array.unique",n,r)}s.set(r,t)}else{if((!g||void 0!==r)&&void 0!==s[r]){const n={pos:t,value:e[t],dupePos:s[r],dupeValue:e[s[r]]};return m&&(n.path=u),l("array.unique",n,i.localize([...i.path,t],[e,...i.ancestors]))}s[r]=t}}return e},args:["comparator","options"],multi:!0}},cast:{set:{from:Array.isArray,to:(e,t)=>new Set(e)}},rebuild(e){e.$_terms._inclusions=[],e.$_terms._exclusions=[],e.$_terms._requireds=[];for(const t of e.$_terms.items)c.validateSingle(t,e),"required"===t._flags.presence?e.$_terms._requireds.push(t):"forbidden"===t._flags.presence?e.$_terms._exclusions.push(t):e.$_terms._inclusions.push(t);for(const t of e.$_terms.ordered)c.validateSingle(t,e)},manifest:{build:(e,t)=>(t.items&&(e=e.items(...t.items)),t.ordered&&(e=e.ordered(...t.ordered)),e)},messages:{"array.base":"{{#label}} must be an array","array.excludes":"{{#label}} contains an excluded value","array.hasKnown":"{{#label}} does not contain at least one required match for type {:#patternLabel}","array.hasUnknown":"{{#label}} does not contain at least one required match","array.includes":"{{#label}} does not match any of the allowed types","array.includesRequiredBoth":"{{#label}} does not contain {{#knownMisses}} and {{#unknownMisses}} other required value(s)","array.includesRequiredKnowns":"{{#label}} does not contain {{#knownMisses}}","array.includesRequiredUnknowns":"{{#label}} does not contain {{#unknownMisses}} required value(s)","array.length":"{{#label}} must contain {{#limit}} items","array.max":"{{#label}} must contain less than or equal to {{#limit}} items","array.min":"{{#label}} must contain at least {{#limit}} items","array.orderedLength":"{{#label}} must contain at most {{#limit}} items","array.sort":"{{#label}} must be sorted in {#order} order by {{#by}}","array.sort.mismatching":"{{#label}} cannot be sorted due to mismatching types","array.sort.unsupported":"{{#label}} cannot be sorted due to unsupported type {#type}","array.sparse":"{{#label}} must not be a sparse array item","array.unique":"{{#label}} contains a duplicate value"}}),c.fillMissedErrors=function(e,t,r,n,s,a){const o=[];let i=0;for(const e of r){const t=e._flags.label;t?o.push(t):++i}o.length?i?t.push(e.$_createError("array.includesRequiredBoth",n,{knownMisses:o,unknownMisses:i},s,a)):t.push(e.$_createError("array.includesRequiredKnowns",n,{knownMisses:o},s,a)):t.push(e.$_createError("array.includesRequiredUnknowns",n,{unknownMisses:i},s,a))},c.fillOrderedErrors=function(e,t,r,n,s,a){const o=[];for(const e of r)"required"===e._flags.presence&&o.push(e);o.length&&c.fillMissedErrors(e,t,o,n,s,a)},c.fillDefault=function(e,t,r,n){const s=[];let a=!0;for(let o=e.length-1;o>=0;--o){const i=e[o],l=[t,...r.ancestors],c=i.$_validate(void 0,r.localize(r.path,l,i),n).value;if(a){if(void 0===c)continue;a=!1}s.unshift(c)}s.length&&t.push(...s)},c.fastSplice=function(e,t){let r=t;for(;r<e.length;)e[r++]=e[r];--e.length},c.validateSingle=function(e,t){("array"===e.type||e._flags._arrayItems)&&(n(!t._flags.single,"Cannot specify array item with single rule enabled"),t.$_setFlag("_arrayItems",!0,{clone:!1}))},c.sort=function(e,t,r,n,s){const a="ascending"===r.order?1:-1,o=-1*a,i=a,l=(l,u)=>{let f=c.compare(l,u,o,i);if(null!==f)return f;if(r.by&&(l=r.by.resolve(l,n,s),u=r.by.resolve(u,n,s)),f=c.compare(l,u,o,i),null!==f)return f;const d=typeof l;if(d!==typeof u)throw e.$_createError("array.sort.mismatching",t,null,n,s);if("number"!==d&&"string"!==d)throw e.$_createError("array.sort.unsupported",t,{type:d},n,s);return"number"===d?(l-u)*a:l<u?o:i};try{return{value:t.slice().sort(l)}}catch(e){return{errors:e}}},c.compare=function(e,t,r,n){return e===t?0:void 0===e?1:void 0===t?-1:null===e?n:null===t?r:null}},4937:(e,t,r)=>{"use strict";const n=r(375),s=r(8068),a=r(8160),o=r(2036),i={isBool:function(e){return"boolean"==typeof e}};e.exports=s.extend({type:"boolean",flags:{sensitive:{default:!1}},terms:{falsy:{init:null,manifest:"values"},truthy:{init:null,manifest:"values"}},coerce(e,t){let{schema:r}=t;if("boolean"!=typeof e){if("string"==typeof e){const t=r._flags.sensitive?e:e.toLowerCase();e="true"===t||"false"!==t&&e}return"boolean"!=typeof e&&(e=r.$_terms.truthy&&r.$_terms.truthy.has(e,null,null,!r._flags.sensitive)||(!r.$_terms.falsy||!r.$_terms.falsy.has(e,null,null,!r._flags.sensitive))&&e),{value:e}}},validate(e,t){let{error:r}=t;if("boolean"!=typeof e)return{value:e,errors:r("boolean.base")}},rules:{truthy:{method(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];a.verifyFlat(t,"truthy");const s=this.clone();s.$_terms.truthy=s.$_terms.truthy||new o;for(let e=0;e<t.length;++e){const r=t[e];n(void 0!==r,"Cannot call truthy with undefined"),s.$_terms.truthy.add(r)}return s}},falsy:{method(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];a.verifyFlat(t,"falsy");const s=this.clone();s.$_terms.falsy=s.$_terms.falsy||new o;for(let e=0;e<t.length;++e){const r=t[e];n(void 0!==r,"Cannot call falsy with undefined"),s.$_terms.falsy.add(r)}return s}},sensitive:{method(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.$_setFlag("sensitive",e)}}},cast:{number:{from:i.isBool,to:(e,t)=>e?1:0},string:{from:i.isBool,to:(e,t)=>e?"true":"false"}},manifest:{build:(e,t)=>(t.truthy&&(e=e.truthy(...t.truthy)),t.falsy&&(e=e.falsy(...t.falsy)),e)},messages:{"boolean.base":"{{#label}} must be a boolean"}})},7500:(e,t,r)=>{"use strict";const n=r(375),s=r(8068),a=r(8160),o=r(3328),i={isDate:function(e){return e instanceof Date}};e.exports=s.extend({type:"date",coerce:{from:["number","string"],method(e,t){let{schema:r}=t;return{value:i.parse(e,r._flags.format)||e}}},validate(e,t){let{schema:r,error:n,prefs:s}=t;if(e instanceof Date&&!isNaN(e.getTime()))return;const a=r._flags.format;return s.convert&&a&&"string"==typeof e?{value:e,errors:n("date.format",{format:a})}:{value:e,errors:n("date.base")}},rules:{compare:{method:!1,validate(e,t,r,n){let{date:s}=r,{name:o,operator:i,args:l}=n;const c="now"===s?Date.now():s.getTime();return a.compare(e.getTime(),c,i)?e:t.error("date."+o,{limit:l.date,value:e})},args:[{name:"date",ref:!0,normalize:e=>"now"===e?e:i.parse(e),assert:e=>null!==e,message:"must have a valid date format"}]},format:{method(e){return n(["iso","javascript","unix"].includes(e),"Unknown date format",e),this.$_setFlag("format",e)}},greater:{method(e){return this.$_addRule({name:"greater",method:"compare",args:{date:e},operator:">"})}},iso:{method(){return this.format("iso")}},less:{method(e){return this.$_addRule({name:"less",method:"compare",args:{date:e},operator:"<"})}},max:{method(e){return this.$_addRule({name:"max",method:"compare",args:{date:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"compare",args:{date:e},operator:">="})}},timestamp:{method(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"javascript";return n(["javascript","unix"].includes(e),'"type" must be one of "javascript, unix"'),this.format(e)}}},cast:{number:{from:i.isDate,to:(e,t)=>e.getTime()},string:{from:i.isDate,to(e,t){let{prefs:r}=t;return o.date(e,r)}}},messages:{"date.base":"{{#label}} must be a valid date","date.format":'{{#label}} must be in {msg("date.format." + #format) || #format} format',"date.greater":"{{#label}} must be greater than {{:#limit}}","date.less":"{{#label}} must be less than {{:#limit}}","date.max":"{{#label}} must be less than or equal to {{:#limit}}","date.min":"{{#label}} must be greater than or equal to {{:#limit}}","date.format.iso":"ISO 8601 date","date.format.javascript":"timestamp or number of milliseconds","date.format.unix":"timestamp or number of seconds"}}),i.parse=function(e,t){if(e instanceof Date)return e;if("string"!=typeof e&&(isNaN(e)||!isFinite(e)))return null;if(/^\s*$/.test(e))return null;if("iso"===t)return a.isIsoDate(e)?i.date(e.toString()):null;const r=e;if("string"==typeof e&&/^[+-]?\d+(\.\d+)?$/.test(e)&&(e=parseFloat(e)),t){if("javascript"===t)return i.date(1*e);if("unix"===t)return i.date(1e3*e);if("string"==typeof r)return null}return i.date(e)},i.date=function(e){const t=new Date(e);return isNaN(t.getTime())?null:t}},390:(e,t,r)=>{"use strict";const n=r(375),s=r(7824);e.exports=s.extend({type:"function",properties:{typeof:"function"},rules:{arity:{method(e){return n(Number.isSafeInteger(e)&&e>=0,"n must be a positive integer"),this.$_addRule({name:"arity",args:{n:e}})},validate(e,t,r){let{n:n}=r;return e.length===n?e:t.error("function.arity",{n:n})}},class:{method(){return this.$_addRule("class")},validate:(e,t)=>/^\s*class\s/.test(e.toString())?e:t.error("function.class",{value:e})},minArity:{method(e){return n(Number.isSafeInteger(e)&&e>0,"n must be a strict positive integer"),this.$_addRule({name:"minArity",args:{n:e}})},validate(e,t,r){let{n:n}=r;return e.length>=n?e:t.error("function.minArity",{n:n})}},maxArity:{method(e){return n(Number.isSafeInteger(e)&&e>=0,"n must be a positive integer"),this.$_addRule({name:"maxArity",args:{n:e}})},validate(e,t,r){let{n:n}=r;return e.length<=n?e:t.error("function.maxArity",{n:n})}}},messages:{"function.arity":"{{#label}} must have an arity of {{#n}}","function.class":"{{#label}} must be a class","function.maxArity":"{{#label}} must have an arity lesser or equal to {{#n}}","function.minArity":"{{#label}} must have an arity greater or equal to {{#n}}"}})},7824:(e,t,r)=>{"use strict";const n=r(978),s=r(375),a=r(8571),o=r(3652),i=r(8068),l=r(8160),c=r(3292),u=r(6354),f=r(6133),d=r(3328),m={renameDefaults:{alias:!1,multiple:!1,override:!1}};e.exports=i.extend({type:"_keys",properties:{typeof:"object"},flags:{unknown:{default:!1}},terms:{dependencies:{init:null},keys:{init:null,manifest:{mapped:{from:"schema",to:"key"}}},patterns:{init:null},renames:{init:null}},args:(e,t)=>e.keys(t),validate(e,t){let{schema:r,error:n,state:s,prefs:a}=t;if(!e||typeof e!==r.$_property("typeof")||Array.isArray(e))return{value:e,errors:n("object.base",{type:r.$_property("typeof")})};if(!(r.$_terms.renames||r.$_terms.dependencies||r.$_terms.keys||r.$_terms.patterns||r.$_terms.externals))return;e=m.clone(e,a);const o=[];if(r.$_terms.renames&&!m.rename(r,e,s,a,o))return{value:e,errors:o};if(!r.$_terms.keys&&!r.$_terms.patterns&&!r.$_terms.dependencies)return{value:e,errors:o};const i=new Set(Object.keys(e));if(r.$_terms.keys){const t=[e,...s.ancestors];for(const n of r.$_terms.keys){const r=n.key,l=e[r];i.delete(r);const c=s.localize([...s.path,r],t,n),u=n.schema.$_validate(l,c,a);if(u.errors){if(a.abortEarly)return{value:e,errors:u.errors};void 0!==u.value&&(e[r]=u.value),o.push(...u.errors)}else"strip"===n.schema._flags.result||void 0===u.value&&void 0!==l?delete e[r]:void 0!==u.value&&(e[r]=u.value)}}if(i.size||r._flags._hasPatternMatch){const t=m.unknown(r,e,i,o,s,a);if(t)return t}if(r.$_terms.dependencies)for(const t of r.$_terms.dependencies){if(null!==t.key&&!1===m.isPresent(t.options)(t.key.resolve(e,s,a,null,{shadow:!1})))continue;const n=m.dependencies[t.rel](r,t,e,s,a);if(n){const t=r.$_createError(n.code,e,n.context,s,a);if(a.abortEarly)return{value:e,errors:t};o.push(t)}}return{value:e,errors:o}},rules:{and:{method(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return l.verifyFlat(t,"and"),m.dependency(this,"and",null,t)}},append:{method(e){return null==e||0===Object.keys(e).length?this:this.keys(e)}},assert:{method(e,t,r){d.isTemplate(e)||(e=c.ref(e)),s(void 0===r||"string"==typeof r,"Message must be a string"),t=this.$_compile(t,{appendPath:!0});const n=this.$_addRule({name:"assert",args:{subject:e,schema:t,message:r}});return n.$_mutateRegister(e),n.$_mutateRegister(t),n},validate(e,t,r){let{error:n,prefs:s,state:a}=t,{subject:o,schema:i,message:l}=r;const c=o.resolve(e,a,s),u=f.isRef(o)?o.absolute(a):[];return i.$_match(c,a.localize(u,[e,...a.ancestors],i),s)?e:n("object.assert",{subject:o,message:l})},args:["subject","schema","message"],multi:!0},instance:{method(e,t){return s("function"==typeof e,"constructor must be a function"),t=t||e.name,this.$_addRule({name:"instance",args:{constructor:e,name:t}})},validate(e,t,r){let{constructor:n,name:s}=r;return e instanceof n?e:t.error("object.instance",{type:s,value:e})},args:["constructor","name"]},keys:{method(e){s(void 0===e||"object"==typeof e,"Object schema must be a valid object"),s(!l.isSchema(e),"Object schema cannot be a joi schema");const t=this.clone();if(e)if(Object.keys(e).length){t.$_terms.keys=t.$_terms.keys?t.$_terms.keys.filter((t=>!e.hasOwnProperty(t.key))):new m.Keys;for(const r in e)l.tryWithPath((()=>t.$_terms.keys.push({key:r,schema:this.$_compile(e[r])})),r)}else t.$_terms.keys=new m.Keys;else t.$_terms.keys=null;return t.$_mutateRebuild()}},length:{method(e){return this.$_addRule({name:"length",args:{limit:e},operator:"="})},validate(e,t,r,n){let{limit:s}=r,{name:a,operator:o,args:i}=n;return l.compare(Object.keys(e).length,s,o)?e:t.error("object."+a,{limit:i.limit,value:e})},args:[{name:"limit",ref:!0,assert:l.limit,message:"must be a positive integer"}]},max:{method(e){return this.$_addRule({name:"max",method:"length",args:{limit:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"length",args:{limit:e},operator:">="})}},nand:{method(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return l.verifyFlat(t,"nand"),m.dependency(this,"nand",null,t)}},or:{method(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return l.verifyFlat(t,"or"),m.dependency(this,"or",null,t)}},oxor:{method(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return m.dependency(this,"oxor",null,t)}},pattern:{method(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const n=e instanceof RegExp;n||(e=this.$_compile(e,{appendPath:!0})),s(void 0!==t,"Invalid rule"),l.assertOptions(r,["fallthrough","matches"]),n&&s(!e.flags.includes("g")&&!e.flags.includes("y"),"pattern should not use global or sticky mode"),t=this.$_compile(t,{appendPath:!0});const a=this.clone();a.$_terms.patterns=a.$_terms.patterns||[];const o={[n?"regex":"schema"]:e,rule:t};return r.matches&&(o.matches=this.$_compile(r.matches),"array"!==o.matches.type&&(o.matches=o.matches.$_root.array().items(o.matches)),a.$_mutateRegister(o.matches),a.$_setFlag("_hasPatternMatch",!0,{clone:!1})),r.fallthrough&&(o.fallthrough=!0),a.$_terms.patterns.push(o),a.$_mutateRegister(t),a}},ref:{method(){return this.$_addRule("ref")},validate:(e,t)=>f.isRef(e)?e:t.error("object.refType",{value:e})},regex:{method(){return this.$_addRule("regex")},validate:(e,t)=>e instanceof RegExp?e:t.error("object.regex",{value:e})},rename:{method(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};s("string"==typeof e||e instanceof RegExp,"Rename missing the from argument"),s("string"==typeof t||t instanceof d,"Invalid rename to argument"),s(t!==e,"Cannot rename key to same name:",e),l.assertOptions(r,["alias","ignoreUndefined","override","multiple"]);const a=this.clone();a.$_terms.renames=a.$_terms.renames||[];for(const t of a.$_terms.renames)s(t.from!==e,"Cannot rename the same key multiple times");return t instanceof d&&a.$_mutateRegister(t),a.$_terms.renames.push({from:e,to:t,options:n(m.renameDefaults,r)}),a}},schema:{method(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"any";return this.$_addRule({name:"schema",args:{type:e}})},validate(e,t,r){let{type:n}=r;return!l.isSchema(e)||"any"!==n&&e.type!==n?t.error("object.schema",{type:n}):e}},unknown:{method(e){return this.$_setFlag("unknown",!1!==e)}},with:{method(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return m.dependency(this,"with",e,t,r)}},without:{method(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return m.dependency(this,"without",e,t,r)}},xor:{method(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return l.verifyFlat(t,"xor"),m.dependency(this,"xor",null,t)}}},overrides:{default(e,t){return void 0===e&&(e=l.symbols.deepDefault),this.$_parent("default",e,t)}},rebuild(e){if(e.$_terms.keys){const t=new o.Sorter;for(const r of e.$_terms.keys)l.tryWithPath((()=>t.add(r,{after:r.schema.$_rootReferences(),group:r.key})),r.key);e.$_terms.keys=new m.Keys(...t.nodes)}},manifest:{build(e,t){if(t.keys&&(e=e.keys(t.keys)),t.dependencies)for(const{rel:r,key:n=null,peers:s,options:a}of t.dependencies)e=m.dependency(e,r,n,s,a);if(t.patterns)for(const{regex:r,schema:n,rule:s,fallthrough:a,matches:o}of t.patterns)e=e.pattern(r||n,s,{fallthrough:a,matches:o});if(t.renames)for(const{from:r,to:n,options:s}of t.renames)e=e.rename(r,n,s);return e}},messages:{"object.and":"{{#label}} contains {{#presentWithLabels}} without its required peers {{#missingWithLabels}}","object.assert":'{{#label}} is invalid because {if(#subject.key, `"` + #subject.key + `" failed to ` + (#message || "pass the assertion test"), #message || "the assertion failed")}',"object.base":"{{#label}} must be of type {{#type}}","object.instance":"{{#label}} must be an instance of {{:#type}}","object.length":'{{#label}} must have {{#limit}} key{if(#limit == 1, "", "s")}',"object.max":'{{#label}} must have less than or equal to {{#limit}} key{if(#limit == 1, "", "s")}',"object.min":'{{#label}} must have at least {{#limit}} key{if(#limit == 1, "", "s")}',"object.missing":"{{#label}} must contain at least one of {{#peersWithLabels}}","object.nand":"{{:#mainWithLabel}} must not exist simultaneously with {{#peersWithLabels}}","object.oxor":"{{#label}} contains a conflict between optional exclusive peers {{#peersWithLabels}}","object.pattern.match":"{{#label}} keys failed to match pattern requirements","object.refType":"{{#label}} must be a Joi reference","object.regex":"{{#label}} must be a RegExp object","object.rename.multiple":"{{#label}} cannot rename {{:#from}} because multiple renames are disabled and another key was already renamed to {{:#to}}","object.rename.override":"{{#label}} cannot rename {{:#from}} because override is disabled and target {{:#to}} exists","object.schema":"{{#label}} must be a Joi schema of {{#type}} type","object.unknown":"{{#label}} is not allowed","object.with":"{{:#mainWithLabel}} missing required peer {{:#peerWithLabel}}","object.without":"{{:#mainWithLabel}} conflict with forbidden peer {{:#peerWithLabel}}","object.xor":"{{#label}} contains a conflict between exclusive peers {{#peersWithLabels}}"}}),m.clone=function(e,t){if("object"==typeof e){if(t.nonEnumerables)return a(e,{shallow:!0});const r=Object.create(Object.getPrototypeOf(e));return Object.assign(r,e),r}const r=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return e.apply(this,r)};return r.prototype=a(e.prototype),Object.defineProperty(r,"name",{value:e.name,writable:!1}),Object.defineProperty(r,"length",{value:e.length,writable:!1}),Object.assign(r,e),r},m.dependency=function(e,t,r,n,a){s(null===r||"string"==typeof r,t,"key must be a strings"),a||(a=n.length>1&&"object"==typeof n[n.length-1]?n.pop():{}),l.assertOptions(a,["separator","isPresent"]),n=[].concat(n);const o=l.default(a.separator,"."),i=[];for(const e of n)s("string"==typeof e,t,"peers must be strings"),i.push(c.ref(e,{separator:o,ancestor:0,prefix:!1}));null!==r&&(r=c.ref(r,{separator:o,ancestor:0,prefix:!1}));const u=e.clone();return u.$_terms.dependencies=u.$_terms.dependencies||[],u.$_terms.dependencies.push(new m.Dependency(t,r,i,n,a)),u},m.dependencies={and(e,t,r,n,s){const a=[],o=[],i=t.peers.length,l=m.isPresent(t.options);for(const e of t.peers)!1===l(e.resolve(r,n,s,null,{shadow:!1}))?a.push(e.key):o.push(e.key);if(a.length!==i&&o.length!==i)return{code:"object.and",context:{present:o,presentWithLabels:m.keysToLabels(e,o),missing:a,missingWithLabels:m.keysToLabels(e,a)}}},nand(e,t,r,n,s){const a=[],o=m.isPresent(t.options);for(const e of t.peers)o(e.resolve(r,n,s,null,{shadow:!1}))&&a.push(e.key);if(a.length!==t.peers.length)return;const i=t.paths[0],l=t.paths.slice(1);return{code:"object.nand",context:{main:i,mainWithLabel:m.keysToLabels(e,i),peers:l,peersWithLabels:m.keysToLabels(e,l)}}},or(e,t,r,n,s){const a=m.isPresent(t.options);for(const e of t.peers)if(a(e.resolve(r,n,s,null,{shadow:!1})))return;return{code:"object.missing",context:{peers:t.paths,peersWithLabels:m.keysToLabels(e,t.paths)}}},oxor(e,t,r,n,s){const a=[],o=m.isPresent(t.options);for(const e of t.peers)o(e.resolve(r,n,s,null,{shadow:!1}))&&a.push(e.key);if(!a.length||1===a.length)return;const i={peers:t.paths,peersWithLabels:m.keysToLabels(e,t.paths)};return i.present=a,i.presentWithLabels=m.keysToLabels(e,a),{code:"object.oxor",context:i}},with(e,t,r,n,s){const a=m.isPresent(t.options);for(const o of t.peers)if(!1===a(o.resolve(r,n,s,null,{shadow:!1})))return{code:"object.with",context:{main:t.key.key,mainWithLabel:m.keysToLabels(e,t.key.key),peer:o.key,peerWithLabel:m.keysToLabels(e,o.key)}}},without(e,t,r,n,s){const a=m.isPresent(t.options);for(const o of t.peers)if(a(o.resolve(r,n,s,null,{shadow:!1})))return{code:"object.without",context:{main:t.key.key,mainWithLabel:m.keysToLabels(e,t.key.key),peer:o.key,peerWithLabel:m.keysToLabels(e,o.key)}}},xor(e,t,r,n,s){const a=[],o=m.isPresent(t.options);for(const e of t.peers)o(e.resolve(r,n,s,null,{shadow:!1}))&&a.push(e.key);if(1===a.length)return;const i={peers:t.paths,peersWithLabels:m.keysToLabels(e,t.paths)};return 0===a.length?{code:"object.missing",context:i}:(i.present=a,i.presentWithLabels=m.keysToLabels(e,a),{code:"object.xor",context:i})}},m.keysToLabels=function(e,t){return Array.isArray(t)?t.map((t=>e.$_mapLabels(t))):e.$_mapLabels(t)},m.isPresent=function(e){return"function"==typeof e.isPresent?e.isPresent:e=>void 0!==e},m.rename=function(e,t,r,n,s){const a={};for(const o of e.$_terms.renames){const i=[],l="string"!=typeof o.from;if(l)for(const e in t){if(void 0===t[e]&&o.options.ignoreUndefined)continue;if(e===o.to)continue;const r=o.from.exec(e);r&&i.push({from:e,to:o.to,match:r})}else!Object.prototype.hasOwnProperty.call(t,o.from)||void 0===t[o.from]&&o.options.ignoreUndefined||i.push(o);for(const c of i){const i=c.from;let u=c.to;if(u instanceof d&&(u=u.render(t,r,n,c.match)),i!==u){if(!o.options.multiple&&a[u]&&(s.push(e.$_createError("object.rename.multiple",t,{from:i,to:u,pattern:l},r,n)),n.abortEarly))return!1;if(Object.prototype.hasOwnProperty.call(t,u)&&!o.options.override&&!a[u]&&(s.push(e.$_createError("object.rename.override",t,{from:i,to:u,pattern:l},r,n)),n.abortEarly))return!1;void 0===t[i]?delete t[u]:t[u]=t[i],a[u]=!0,o.options.alias||delete t[i]}}}return!0},m.unknown=function(e,t,r,n,s,a){if(e.$_terms.patterns){let o=!1;const i=e.$_terms.patterns.map((e=>{if(e.matches)return o=!0,[]})),l=[t,...s.ancestors];for(const o of r){const c=t[o],u=[...s.path,o];for(let f=0;f<e.$_terms.patterns.length;++f){const d=e.$_terms.patterns[f];if(d.regex){const e=d.regex.test(o);if(s.mainstay.tracer.debug(s,"rule",`pattern.${f}`,e?"pass":"error"),!e)continue}else if(!d.schema.$_match(o,s.nest(d.schema,`pattern.${f}`),a))continue;r.delete(o);const m=s.localize(u,l,{schema:d.rule,key:o}),p=d.rule.$_validate(c,m,a);if(p.errors){if(a.abortEarly)return{value:t,errors:p.errors};n.push(...p.errors)}if(d.matches&&i[f].push(o),t[o]=p.value,!d.fallthrough)break}}if(o)for(let r=0;r<i.length;++r){const o=i[r];if(!o)continue;const c=e.$_terms.patterns[r].matches,f=s.localize(s.path,l,c),d=c.$_validate(o,f,a);if(d.errors){const r=u.details(d.errors,{override:!1});r.matches=o;const i=e.$_createError("object.pattern.match",t,r,s,a);if(a.abortEarly)return{value:t,errors:i};n.push(i)}}}if(r.size&&(e.$_terms.keys||e.$_terms.patterns)){if(a.stripUnknown&&!e._flags.unknown||a.skipFunctions){const e=!(!a.stripUnknown||!0!==a.stripUnknown&&!a.stripUnknown.objects);for(const n of r)e?(delete t[n],r.delete(n)):"function"==typeof t[n]&&r.delete(n)}if(!l.default(e._flags.unknown,a.allowUnknown))for(const o of r){const r=s.localize([...s.path,o],[]),i=e.$_createError("object.unknown",t[o],{child:o},r,a,{flags:!1});if(a.abortEarly)return{value:t,errors:i};n.push(i)}}},m.Dependency=class{constructor(e,t,r,n,s){this.rel=e,this.key=t,this.peers=r,this.paths=n,this.options=s}describe(){const e={rel:this.rel,peers:this.paths};return null!==this.key&&(e.key=this.key.key),"."!==this.peers[0].separator&&(e.options={...e.options,separator:this.peers[0].separator}),this.options.isPresent&&(e.options={...e.options,isPresent:this.options.isPresent}),e}},m.Keys=class extends Array{concat(e){const t=this.slice(),r=new Map;for(let e=0;e<t.length;++e)r.set(t[e].key,e);for(const n of e){const e=n.key,s=r.get(e);void 0!==s?t[s]={key:e,schema:t[s].schema.concat(n.schema)}:t.push(n)}return t}}},8785:(e,t,r)=>{"use strict";const n=r(375),s=r(8068),a=r(8160),o=r(3292),i=r(6354),l={};e.exports=s.extend({type:"link",properties:{schemaChain:!0},terms:{link:{init:null,manifest:"single",register:!1}},args:(e,t)=>e.ref(t),validate(e,t){let{schema:r,state:s,prefs:a}=t;n(r.$_terms.link,"Uninitialized link schema");const o=l.generate(r,e,s,a),i=r.$_terms.link[0].ref;return o.$_validate(e,s.nest(o,`link:${i.display}:${o.type}`),a)},generate:(e,t,r,n)=>l.generate(e,t,r,n),rules:{ref:{method(e){n(!this.$_terms.link,"Cannot reinitialize schema"),e=o.ref(e),n("value"===e.type||"local"===e.type,"Invalid reference type:",e.type),n("local"===e.type||"root"===e.ancestor||e.ancestor>0,"Link cannot reference itself");const t=this.clone();return t.$_terms.link=[{ref:e}],t}},relative:{method(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.$_setFlag("relative",e)}}},overrides:{concat(e){n(this.$_terms.link,"Uninitialized link schema"),n(a.isSchema(e),"Invalid schema object"),n("link"!==e.type,"Cannot merge type link with another link");const t=this.clone();return t.$_terms.whens||(t.$_terms.whens=[]),t.$_terms.whens.push({concat:e}),t.$_mutateRebuild()}},manifest:{build:(e,t)=>(n(t.link,"Invalid link description missing link"),e.ref(t.link))}}),l.generate=function(e,t,r,n){let s=r.mainstay.links.get(e);if(s)return s._generate(t,r,n).schema;const a=e.$_terms.link[0].ref,{perspective:o,path:i}=l.perspective(a,r);l.assert(o,"which is outside of schema boundaries",a,e,r,n);try{s=i.length?o.$_reach(i):o}catch(t){l.assert(!1,"to non-existing schema",a,e,r,n)}return l.assert("link"!==s.type,"which is another link",a,e,r,n),e._flags.relative||r.mainstay.links.set(e,s),s._generate(t,r,n).schema},l.perspective=function(e,t){if("local"===e.type){for(const{schema:r,key:n}of t.schemas){if((r._flags.id||n)===e.path[0])return{perspective:r,path:e.path.slice(1)};if(r.$_terms.shared)for(const t of r.$_terms.shared)if(t._flags.id===e.path[0])return{perspective:t,path:e.path.slice(1)}}return{perspective:null,path:null}}return"root"===e.ancestor?{perspective:t.schemas[t.schemas.length-1].schema,path:e.path}:{perspective:t.schemas[e.ancestor]&&t.schemas[e.ancestor].schema,path:e.path}},l.assert=function(e,t,r,s,a,o){e||n(!1,`"${i.label(s._flags,a,o)}" contains link reference "${r.display}" ${t}`)}},3832:(e,t,r)=>{"use strict";const n=r(375),s=r(8068),a=r(8160),o={numberRx:/^\s*[+-]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:e([+-]?\d+))?\s*$/i,precisionRx:/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/,exponentialPartRegex:/[eE][+-]?\d+$/,leadingSignAndZerosRegex:/^[+-]?(0*)?/,dotRegex:/\./,trailingZerosRegex:/0+$/};e.exports=s.extend({type:"number",flags:{unsafe:{default:!1}},coerce:{from:"string",method(e,t){let{schema:r,error:n}=t;if(!e.match(o.numberRx))return;e=e.trim();const s={value:parseFloat(e)};if(0===s.value&&(s.value=0),!r._flags.unsafe)if(e.match(/e/i)){if(o.extractSignificantDigits(e)!==o.extractSignificantDigits(String(s.value)))return s.errors=n("number.unsafe"),s}else{const t=s.value.toString();if(t.match(/e/i))return s;if(t!==o.normalizeDecimal(e))return s.errors=n("number.unsafe"),s}return s}},validate(e,t){let{schema:r,error:n,prefs:s}=t;if(e===1/0||e===-1/0)return{value:e,errors:n("number.infinity")};if(!a.isNumber(e))return{value:e,errors:n("number.base")};const o={value:e};if(s.convert){const e=r.$_getRule("precision");if(e){const t=Math.pow(10,e.args.limit);o.value=Math.round(o.value*t)/t}}return 0===o.value&&(o.value=0),!r._flags.unsafe&&(e>Number.MAX_SAFE_INTEGER||e<Number.MIN_SAFE_INTEGER)&&(o.errors=n("number.unsafe")),o},rules:{compare:{method:!1,validate(e,t,r,n){let{limit:s}=r,{name:o,operator:i,args:l}=n;return a.compare(e,s,i)?e:t.error("number."+o,{limit:l.limit,value:e})},args:[{name:"limit",ref:!0,assert:a.isNumber,message:"must be a number"}]},greater:{method(e){return this.$_addRule({name:"greater",method:"compare",args:{limit:e},operator:">"})}},integer:{method(){return this.$_addRule("integer")},validate:(e,t)=>Math.trunc(e)-e==0?e:t.error("number.integer")},less:{method(e){return this.$_addRule({name:"less",method:"compare",args:{limit:e},operator:"<"})}},max:{method(e){return this.$_addRule({name:"max",method:"compare",args:{limit:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"compare",args:{limit:e},operator:">="})}},multiple:{method(e){return this.$_addRule({name:"multiple",args:{base:e}})},validate(e,t,r,n){let{base:s}=r;return e*(1/s)%1==0?e:t.error("number.multiple",{multiple:n.args.base,value:e})},args:[{name:"base",ref:!0,assert:e=>"number"==typeof e&&isFinite(e)&&e>0,message:"must be a positive number"}],multi:!0},negative:{method(){return this.sign("negative")}},port:{method(){return this.$_addRule("port")},validate:(e,t)=>Number.isSafeInteger(e)&&e>=0&&e<=65535?e:t.error("number.port")},positive:{method(){return this.sign("positive")}},precision:{method(e){return n(Number.isSafeInteger(e),"limit must be an integer"),this.$_addRule({name:"precision",args:{limit:e}})},validate(e,t,r){let{limit:n}=r;const s=e.toString().match(o.precisionRx);return Math.max((s[1]?s[1].length:0)-(s[2]?parseInt(s[2],10):0),0)<=n?e:t.error("number.precision",{limit:n,value:e})},convert:!0},sign:{method(e){return n(["negative","positive"].includes(e),"Invalid sign",e),this.$_addRule({name:"sign",args:{sign:e}})},validate(e,t,r){let{sign:n}=r;return"negative"===n&&e<0||"positive"===n&&e>0?e:t.error(`number.${n}`)}},unsafe:{method(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return n("boolean"==typeof e,"enabled must be a boolean"),this.$_setFlag("unsafe",e)}}},cast:{string:{from:e=>"number"==typeof e,to:(e,t)=>e.toString()}},messages:{"number.base":"{{#label}} must be a number","number.greater":"{{#label}} must be greater than {{#limit}}","number.infinity":"{{#label}} cannot be infinity","number.integer":"{{#label}} must be an integer","number.less":"{{#label}} must be less than {{#limit}}","number.max":"{{#label}} must be less than or equal to {{#limit}}","number.min":"{{#label}} must be greater than or equal to {{#limit}}","number.multiple":"{{#label}} must be a multiple of {{#multiple}}","number.negative":"{{#label}} must be a negative number","number.port":"{{#label}} must be a valid port","number.positive":"{{#label}} must be a positive number","number.precision":"{{#label}} must have no more than {{#limit}} decimal places","number.unsafe":"{{#label}} must be a safe number"}}),o.extractSignificantDigits=function(e){return e.replace(o.exponentialPartRegex,"").replace(o.dotRegex,"").replace(o.trailingZerosRegex,"").replace(o.leadingSignAndZerosRegex,"")},o.normalizeDecimal=function(e){return(e=e.replace(/^\+/,"").replace(/\.0*$/,"").replace(/^(-?)\.([^\.]*)$/,"$10.$2").replace(/^(-?)0+([0-9])/,"$1$2")).includes(".")&&e.endsWith("0")&&(e=e.replace(/0+$/,"")),"-0"===e?"0":e}},8966:(e,t,r)=>{"use strict";const n=r(7824);e.exports=n.extend({type:"object",cast:{map:{from:e=>e&&"object"==typeof e,to:(e,t)=>new Map(Object.entries(e))}}})},7417:(e,t,r)=>{"use strict";const n=r(375),s=r(5380),a=r(1745),o=r(9959),i=r(6064),l=r(9926),c=r(5752),u=r(8068),f=r(8160),d={tlds:l instanceof Set&&{tlds:{allow:l,deny:null}},base64Regex:{true:{true:/^(?:[\w\-]{2}[\w\-]{2})*(?:[\w\-]{2}==|[\w\-]{3}=)?$/,false:/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/},false:{true:/^(?:[\w\-]{2}[\w\-]{2})*(?:[\w\-]{2}(==)?|[\w\-]{3}=?)?$/,false:/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}(==)?|[A-Za-z0-9+\/]{3}=?)?$/}},dataUriRegex:/^data:[\w+.-]+\/[\w+.-]+;((charset=[\w-]+|base64),)?(.*)$/,hexRegex:/^[a-f0-9]+$/i,ipRegex:o.regex({cidr:"forbidden"}).regex,isoDurationRegex:/^P(?!$)(\d+Y)?(\d+M)?(\d+W)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?$/,guidBrackets:{"{":"}","[":"]","(":")","":""},guidVersions:{uuidv1:"1",uuidv2:"2",uuidv3:"3",uuidv4:"4",uuidv5:"5"},guidSeparators:new Set([void 0,!0,!1,"-",":"]),normalizationForms:["NFC","NFD","NFKC","NFKD"]};e.exports=u.extend({type:"string",flags:{insensitive:{default:!1},truncate:{default:!1}},terms:{replacements:{init:null}},coerce:{from:"string",method(e,t){let{schema:r,state:n,prefs:s}=t;const a=r.$_getRule("normalize");a&&(e=e.normalize(a.args.form));const o=r.$_getRule("case");o&&(e="upper"===o.args.direction?e.toLocaleUpperCase():e.toLocaleLowerCase());const i=r.$_getRule("trim");if(i&&i.args.enabled&&(e=e.trim()),r.$_terms.replacements)for(const t of r.$_terms.replacements)e=e.replace(t.pattern,t.replacement);const l=r.$_getRule("hex");if(l&&l.args.options.byteAligned&&e.length%2!=0&&(e=`0${e}`),r.$_getRule("isoDate")){const t=d.isoDate(e);t&&(e=t)}if(r._flags.truncate){const t=r.$_getRule("max");if(t){let a=t.args.limit;if(f.isResolvable(a)&&(a=a.resolve(e,n,s),!f.limit(a)))return{value:e,errors:r.$_createError("any.ref",a,{ref:t.args.limit,arg:"limit",reason:"must be a positive integer"},n,s)};e=e.slice(0,a)}}return{value:e}}},validate(e,t){let{schema:r,error:n}=t;if("string"!=typeof e)return{value:e,errors:n("string.base")};if(""===e){const t=r.$_getRule("min");if(t&&0===t.args.limit)return;return{value:e,errors:n("string.empty")}}},rules:{alphanum:{method(){return this.$_addRule("alphanum")},validate:(e,t)=>/^[a-zA-Z0-9]+$/.test(e)?e:t.error("string.alphanum")},base64:{method(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return f.assertOptions(e,["paddingRequired","urlSafe"]),e={urlSafe:!1,paddingRequired:!0,...e},n("boolean"==typeof e.paddingRequired,"paddingRequired must be boolean"),n("boolean"==typeof e.urlSafe,"urlSafe must be boolean"),this.$_addRule({name:"base64",args:{options:e}})},validate(e,t,r){let{options:n}=r;return d.base64Regex[n.paddingRequired][n.urlSafe].test(e)?e:t.error("string.base64")}},case:{method(e){return n(["lower","upper"].includes(e),"Invalid case:",e),this.$_addRule({name:"case",args:{direction:e}})},validate(e,t,r){let{direction:n}=r;return"lower"===n&&e===e.toLocaleLowerCase()||"upper"===n&&e===e.toLocaleUpperCase()?e:t.error(`string.${n}case`)},convert:!0},creditCard:{method(){return this.$_addRule("creditCard")},validate(e,t){let r=e.length,n=0,s=1;for(;r--;){const t=e.charAt(r)*s;n+=t-9*(t>9),s^=3}return n>0&&n%10==0?e:t.error("string.creditCard")}},dataUri:{method(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return f.assertOptions(e,["paddingRequired"]),e={paddingRequired:!0,...e},n("boolean"==typeof e.paddingRequired,"paddingRequired must be boolean"),this.$_addRule({name:"dataUri",args:{options:e}})},validate(e,t,r){let{options:n}=r;const s=e.match(d.dataUriRegex);if(s){if(!s[2])return e;if("base64"!==s[2])return e;if(d.base64Regex[n.paddingRequired].false.test(s[3]))return e}return t.error("string.dataUri")}},domain:{method(e){e&&f.assertOptions(e,["allowFullyQualified","allowUnicode","maxDomainSegments","minDomainSegments","tlds"]);const t=d.addressOptions(e);return this.$_addRule({name:"domain",args:{options:e},address:t})},validate(e,t,r,n){let{address:a}=n;return s.isValid(e,a)?e:t.error("string.domain")}},email:{method(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};f.assertOptions(e,["allowFullyQualified","allowUnicode","ignoreLength","maxDomainSegments","minDomainSegments","multiple","separator","tlds"]),n(void 0===e.multiple||"boolean"==typeof e.multiple,"multiple option must be an boolean");const t=d.addressOptions(e),r=new RegExp(`\\s*[${e.separator?i(e.separator):","}]\\s*`);return this.$_addRule({name:"email",args:{options:e},regex:r,address:t})},validate(e,t,r,n){let{options:s}=r,{regex:o,address:i}=n;const l=s.multiple?e.split(o):[e],c=[];for(const e of l)a.isValid(e,i)||c.push(e);return c.length?t.error("string.email",{value:e,invalids:c}):e}},guid:{alias:"uuid",method(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};f.assertOptions(e,["version","separator"]);let t="";if(e.version){const r=[].concat(e.version);n(r.length>=1,"version must have at least 1 valid version specified");const s=new Set;for(let e=0;e<r.length;++e){const a=r[e];n("string"==typeof a,"version at position "+e+" must be a string");const o=d.guidVersions[a.toLowerCase()];n(o,"version at position "+e+" must be one of "+Object.keys(d.guidVersions).join(", ")),n(!s.has(o),"version at position "+e+" must not be a duplicate"),t+=o,s.add(o)}}n(d.guidSeparators.has(e.separator),'separator must be one of true, false, "-", or ":"');const r=void 0===e.separator?"[:-]?":!0===e.separator?"[:-]":!1===e.separator?"[]?":`\\${e.separator}`,s=new RegExp(`^([\\[{\\(]?)[0-9A-F]{8}(${r})[0-9A-F]{4}\\2?[${t||"0-9A-F"}][0-9A-F]{3}\\2?[${t?"89AB":"0-9A-F"}][0-9A-F]{3}\\2?[0-9A-F]{12}([\\]}\\)]?)$`,"i");return this.$_addRule({name:"guid",args:{options:e},regex:s})},validate(e,t,r,n){let{regex:s}=n;const a=s.exec(e);return a?d.guidBrackets[a[1]]!==a[a.length-1]?t.error("string.guid"):e:t.error("string.guid")}},hex:{method(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return f.assertOptions(e,["byteAligned"]),e={byteAligned:!1,...e},n("boolean"==typeof e.byteAligned,"byteAligned must be boolean"),this.$_addRule({name:"hex",args:{options:e}})},validate(e,t,r){let{options:n}=r;return d.hexRegex.test(e)?n.byteAligned&&e.length%2!=0?t.error("string.hexAlign"):e:t.error("string.hex")}},hostname:{method(){return this.$_addRule("hostname")},validate:(e,t)=>s.isValid(e,{minDomainSegments:1})||d.ipRegex.test(e)?e:t.error("string.hostname")},insensitive:{method(){return this.$_setFlag("insensitive",!0)}},ip:{method(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};f.assertOptions(e,["cidr","version"]);const{cidr:t,versions:r,regex:n}=o.regex(e),s=e.version?r:void 0;return this.$_addRule({name:"ip",args:{options:{cidr:t,version:s}},regex:n})},validate(e,t,r,n){let{options:s}=r,{regex:a}=n;return a.test(e)?e:s.version?t.error("string.ipVersion",{value:e,cidr:s.cidr,version:s.version}):t.error("string.ip",{value:e,cidr:s.cidr})}},isoDate:{method(){return this.$_addRule("isoDate")},validate(e,t){let{error:r}=t;return d.isoDate(e)?e:r("string.isoDate")}},isoDuration:{method(){return this.$_addRule("isoDuration")},validate:(e,t)=>d.isoDurationRegex.test(e)?e:t.error("string.isoDuration")},length:{method(e,t){return d.length(this,"length",e,"=",t)},validate(e,t,r,n){let{limit:s,encoding:a}=r,{name:o,operator:i,args:l}=n;const c=!a&&e.length;return f.compare(c,s,i)?e:t.error("string."+o,{limit:l.limit,value:e,encoding:a})},args:[{name:"limit",ref:!0,assert:f.limit,message:"must be a positive integer"},"encoding"]},lowercase:{method(){return this.case("lower")}},max:{method(e,t){return d.length(this,"max",e,"<=",t)},args:["limit","encoding"]},min:{method(e,t){return d.length(this,"min",e,">=",t)},args:["limit","encoding"]},normalize:{method(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"NFC";return n(d.normalizationForms.includes(e),"normalization form must be one of "+d.normalizationForms.join(", ")),this.$_addRule({name:"normalize",args:{form:e}})},validate(e,t,r){let{error:n}=t,{form:s}=r;return e===e.normalize(s)?e:n("string.normalize",{value:e,form:s})},convert:!0},pattern:{alias:"regex",method(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n(e instanceof RegExp,"regex must be a RegExp"),n(!e.flags.includes("g")&&!e.flags.includes("y"),"regex should not use global or sticky mode"),"string"==typeof t&&(t={name:t}),f.assertOptions(t,["invert","name"]);const r=["string.pattern",t.invert?".invert":"",t.name?".name":".base"].join("");return this.$_addRule({name:"pattern",args:{regex:e,options:t},errorCode:r})},validate(e,t,r,n){let{regex:s,options:a}=r,{errorCode:o}=n;return s.test(e)^a.invert?e:t.error(o,{name:a.name,regex:s,value:e})},args:["regex","options"],multi:!0},replace:{method(e,t){"string"==typeof e&&(e=new RegExp(i(e),"g")),n(e instanceof RegExp,"pattern must be a RegExp"),n("string"==typeof t,"replacement must be a String");const r=this.clone();return r.$_terms.replacements||(r.$_terms.replacements=[]),r.$_terms.replacements.push({pattern:e,replacement:t}),r}},token:{method(){return this.$_addRule("token")},validate:(e,t)=>/^\w+$/.test(e)?e:t.error("string.token")},trim:{method(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return n("boolean"==typeof e,"enabled must be a boolean"),this.$_addRule({name:"trim",args:{enabled:e}})},validate(e,t,r){let{enabled:n}=r;return n&&e!==e.trim()?t.error("string.trim"):e},convert:!0},truncate:{method(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return n("boolean"==typeof e,"enabled must be a boolean"),this.$_setFlag("truncate",e)}},uppercase:{method(){return this.case("upper")}},uri:{method(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};f.assertOptions(e,["allowRelative","allowQuerySquareBrackets","domain","relativeOnly","scheme"]),e.domain&&f.assertOptions(e.domain,["allowFullyQualified","allowUnicode","maxDomainSegments","minDomainSegments","tlds"]);const{regex:t,scheme:r}=c.regex(e),n=e.domain?d.addressOptions(e.domain):null;return this.$_addRule({name:"uri",args:{options:e},regex:t,domain:n,scheme:r})},validate(e,t,r,n){let{options:a}=r,{regex:o,domain:i,scheme:l}=n;if(["http:/","https:/"].includes(e))return t.error("string.uri");const c=o.exec(e);if(c){const r=c[1]||c[2];return!i||a.allowRelative&&!r||s.isValid(r,i)?e:t.error("string.domain",{value:r})}return a.relativeOnly?t.error("string.uriRelativeOnly"):a.scheme?t.error("string.uriCustomScheme",{scheme:l,value:e}):t.error("string.uri")}}},manifest:{build(e,t){if(t.replacements)for(const{pattern:r,replacement:n}of t.replacements)e=e.replace(r,n);return e}},messages:{"string.alphanum":"{{#label}} must only contain alpha-numeric characters","string.base":"{{#label}} must be a string","string.base64":"{{#label}} must be a valid base64 string","string.creditCard":"{{#label}} must be a credit card","string.dataUri":"{{#label}} must be a valid dataUri string","string.domain":"{{#label}} must contain a valid domain name","string.email":"{{#label}} must be a valid email","string.empty":"{{#label}} is not allowed to be empty","string.guid":"{{#label}} must be a valid GUID","string.hex":"{{#label}} must only contain hexadecimal characters","string.hexAlign":"{{#label}} hex decoded representation must be byte aligned","string.hostname":"{{#label}} must be a valid hostname","string.ip":"{{#label}} must be a valid ip address with a {{#cidr}} CIDR","string.ipVersion":"{{#label}} must be a valid ip address of one of the following versions {{#version}} with a {{#cidr}} CIDR","string.isoDate":"{{#label}} must be in iso format","string.isoDuration":"{{#label}} must be a valid ISO 8601 duration","string.length":"{{#label}} length must be {{#limit}} characters long","string.lowercase":"{{#label}} must only contain lowercase characters","string.max":"{{#label}} length must be less than or equal to {{#limit}} characters long","string.min":"{{#label}} length must be at least {{#limit}} characters long","string.normalize":"{{#label}} must be unicode normalized in the {{#form}} form","string.token":"{{#label}} must only contain alpha-numeric and underscore characters","string.pattern.base":"{{#label}} with value {:[.]} fails to match the required pattern: {{#regex}}","string.pattern.name":"{{#label}} with value {:[.]} fails to match the {{#name}} pattern","string.pattern.invert.base":"{{#label}} with value {:[.]} matches the inverted pattern: {{#regex}}","string.pattern.invert.name":"{{#label}} with value {:[.]} matches the inverted {{#name}} pattern","string.trim":"{{#label}} must not have leading or trailing whitespace","string.uri":"{{#label}} must be a valid uri","string.uriCustomScheme":"{{#label}} must be a valid uri with a scheme matching the {{#scheme}} pattern","string.uriRelativeOnly":"{{#label}} must be a valid relative uri","string.uppercase":"{{#label}} must only contain uppercase characters"}}),d.addressOptions=function(e){if(!e)return e;if(n(void 0===e.minDomainSegments||Number.isSafeInteger(e.minDomainSegments)&&e.minDomainSegments>0,"minDomainSegments must be a positive integer"),n(void 0===e.maxDomainSegments||Number.isSafeInteger(e.maxDomainSegments)&&e.maxDomainSegments>0,"maxDomainSegments must be a positive integer"),!1===e.tlds)return e;if(!0===e.tlds||void 0===e.tlds)return n(d.tlds,"Built-in TLD list disabled"),Object.assign({},e,d.tlds);n("object"==typeof e.tlds,"tlds must be true, false, or an object");const t=e.tlds.deny;if(t)return Array.isArray(t)&&(e=Object.assign({},e,{tlds:{deny:new Set(t)}})),n(e.tlds.deny instanceof Set,"tlds.deny must be an array, Set, or boolean"),n(!e.tlds.allow,"Cannot specify both tlds.allow and tlds.deny lists"),d.validateTlds(e.tlds.deny,"tlds.deny"),e;const r=e.tlds.allow;return r?!0===r?(n(d.tlds,"Built-in TLD list disabled"),Object.assign({},e,d.tlds)):(Array.isArray(r)&&(e=Object.assign({},e,{tlds:{allow:new Set(r)}})),n(e.tlds.allow instanceof Set,"tlds.allow must be an array, Set, or boolean"),d.validateTlds(e.tlds.allow,"tlds.allow"),e):e},d.validateTlds=function(e,t){for(const r of e)n(s.isValid(r,{minDomainSegments:1,maxDomainSegments:1}),`${t} must contain valid top level domain names`)},d.isoDate=function(e){if(!f.isIsoDate(e))return null;/.*T.*[+-]\d\d$/.test(e)&&(e+="00");const t=new Date(e);return isNaN(t.getTime())?null:t.toISOString()},d.length=function(e,t,r,s,a){return n(!a||!1,"Invalid encoding:",a),e.$_addRule({name:t,method:"length",args:{limit:r,encoding:a},operator:s})}},8826:(e,t,r)=>{"use strict";const n=r(375),s=r(8068),a={};a.Map=class extends Map{slice(){return new a.Map(this)}},e.exports=s.extend({type:"symbol",terms:{map:{init:new a.Map}},coerce:{method(e,t){let{schema:r,error:n}=t;const s=r.$_terms.map.get(e);return s&&(e=s),r._flags.only&&"symbol"!=typeof e?{value:e,errors:n("symbol.map",{map:r.$_terms.map})}:{value:e}}},validate(e,t){let{error:r}=t;if("symbol"!=typeof e)return{value:e,errors:r("symbol.base")}},rules:{map:{method(e){e&&!e[Symbol.iterator]&&"object"==typeof e&&(e=Object.entries(e)),n(e&&e[Symbol.iterator],"Iterable must be an iterable or object");const t=this.clone(),r=[];for(const s of e){n(s&&s[Symbol.iterator],"Entry must be an iterable");const[e,a]=s;n("object"!=typeof e&&"function"!=typeof e&&"symbol"!=typeof e,"Key must not be of type object, function, or Symbol"),n("symbol"==typeof a,"Value must be a Symbol"),t.$_terms.map.set(e,a),r.push(a)}return t.valid(...r)}}},manifest:{build:(e,t)=>(t.map&&(e=e.map(t.map)),e)},messages:{"symbol.base":"{{#label}} must be a symbol","symbol.map":"{{#label}} must be one of {{#map}}"}})},8863:(e,t,r)=>{"use strict";const n=r(375),s=r(8571),a=r(738),o=r(9621),i=r(8160),l=r(6354),c=r(493),u={result:Symbol("result")};t.entry=function(e,t,r){let s=i.defaults;r&&(n(void 0===r.warnings,"Cannot override warnings preference in synchronous validation"),n(void 0===r.artifacts,"Cannot override artifacts preference in synchronous validation"),s=i.preferences(i.defaults,r));const a=u.entry(e,t,s);n(!a.mainstay.externals.length,"Schema with external rules must use validateAsync()");const o={value:a.value};return a.error&&(o.error=a.error),a.mainstay.warnings.length&&(o.warning=l.details(a.mainstay.warnings)),a.mainstay.debug&&(o.debug=a.mainstay.debug),a.mainstay.artifacts&&(o.artifacts=a.mainstay.artifacts),o},t.entryAsync=async function(e,t,r){let n=i.defaults;r&&(n=i.preferences(i.defaults,r));const s=u.entry(e,t,n),a=s.mainstay;if(s.error)throw a.debug&&(s.error.debug=a.debug),s.error;if(a.externals.length){let t=s.value;const c=[];for(const s of a.externals){const f=s.state.path,d="link"===s.schema.type?a.links.get(s.schema):null;let m,p,h=t;const g=f.length?[t]:[],y=f.length?o(e,f):e;if(f.length){m=f[f.length-1];let e=t;for(const t of f.slice(0,-1))e=e[t],g.unshift(e);p=g[0],h=p[m]}try{const e=(e,t)=>(d||s.schema).$_createError(e,h,t,s.state,n),o=await s.method(h,{schema:s.schema,linked:d,state:s.state,prefs:r,original:y,error:e,errorsArray:u.errorsArray,warn:(e,t)=>a.warnings.push((d||s.schema).$_createError(e,h,t,s.state,n)),message:(e,t)=>(d||s.schema).$_createError("external",h,t,s.state,n,{messages:e})});if(void 0===o||o===h)continue;if(o instanceof l.Report){if(a.tracer.log(s.schema,s.state,"rule","external","error"),c.push(o),n.abortEarly)break;continue}if(Array.isArray(o)&&o[i.symbols.errors]){if(a.tracer.log(s.schema,s.state,"rule","external","error"),c.push(...o),n.abortEarly)break;continue}p?(a.tracer.value(s.state,"rule",h,o,"external"),p[m]=o):(a.tracer.value(s.state,"rule",t,o,"external"),t=o)}catch(e){throw n.errors.label&&(e.message+=` (${s.label})`),e}}if(s.value=t,c.length)throw s.error=l.process(c,e,n),a.debug&&(s.error.debug=a.debug),s.error}if(!n.warnings&&!n.debug&&!n.artifacts)return s.value;const c={value:s.value};return a.warnings.length&&(c.warning=l.details(a.warnings)),a.debug&&(c.debug=a.debug),a.artifacts&&(c.artifacts=a.artifacts),c},u.Mainstay=class{constructor(e,t,r){this.externals=[],this.warnings=[],this.tracer=e,this.debug=t,this.links=r,this.shadow=null,this.artifacts=null,this._snapshots=[]}snapshot(){this._snapshots.push({externals:this.externals.slice(),warnings:this.warnings.slice()})}restore(){const e=this._snapshots.pop();this.externals=e.externals,this.warnings=e.warnings}commit(){this._snapshots.pop()}},u.entry=function(e,r,n){const{tracer:s,cleanup:a}=u.tracer(r,n),o=n.debug?[]:null,i=r._ids._schemaChain?new Map:null,f=new u.Mainstay(s,o,i),d=r._ids._schemaChain?[{schema:r}]:null,m=new c([],[],{mainstay:f,schemas:d}),p=t.validate(e,r,m,n);a&&r.$_root.untrace();const h=l.process(p.errors,e,n);return{value:p.value,error:h,mainstay:f}},u.tracer=function(e,t){return e.$_root._tracer?{tracer:e.$_root._tracer._register(e)}:t.debug?(n(e.$_root.trace,"Debug mode not supported"),{tracer:e.$_root.trace()._register(e),cleanup:!0}):{tracer:u.ignore}},t.validate=function(e,t,r,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};if(t.$_terms.whens&&(t=t._generate(e,r,n).schema),t._preferences&&(n=u.prefs(t,n)),t._cache&&n.cache){const n=t._cache.get(e);if(r.mainstay.tracer.debug(r,"validate","cached",!!n),n)return n}const a=(s,a,o)=>t.$_createError(s,e,a,o||r,n),o={original:e,prefs:n,schema:t,state:r,error:a,errorsArray:u.errorsArray,warn:(e,t,n)=>r.mainstay.warnings.push(a(e,t,n)),message:(s,a)=>t.$_createError("custom",e,a,r,n,{messages:s})};r.mainstay.tracer.entry(t,r);const l=t._definition;if(l.prepare&&void 0!==e&&n.convert){const t=l.prepare(e,o);if(t){if(r.mainstay.tracer.value(r,"prepare",e,t.value),t.errors)return u.finalize(t.value,[].concat(t.errors),o);e=t.value}}if(l.coerce&&void 0!==e&&n.convert&&(!l.coerce.from||l.coerce.from.includes(typeof e))){const t=l.coerce.method(e,o);if(t){if(r.mainstay.tracer.value(r,"coerced",e,t.value),t.errors)return u.finalize(t.value,[].concat(t.errors),o);e=t.value}}const c=t._flags.empty;c&&c.$_match(u.trim(e,t),r.nest(c),i.defaults)&&(r.mainstay.tracer.value(r,"empty",e,void 0),e=void 0);const f=s.presence||t._flags.presence||(t._flags._endedSwitch?null:n.presence);if(void 0===e){if("forbidden"===f)return u.finalize(e,null,o);if("required"===f)return u.finalize(e,[t.$_createError("any.required",e,null,r,n)],o);if("optional"===f){if(t._flags.default!==i.symbols.deepDefault)return u.finalize(e,null,o);r.mainstay.tracer.value(r,"default",e,{}),e={}}}else if("forbidden"===f)return u.finalize(e,[t.$_createError("any.unknown",e,null,r,n)],o);const d=[];if(t._valids){const s=t._valids.get(e,r,n,t._flags.insensitive);if(s)return n.convert&&(r.mainstay.tracer.value(r,"valids",e,s.value),e=s.value),r.mainstay.tracer.filter(t,r,"valid",s),u.finalize(e,null,o);if(t._flags.only){const s=t.$_createError("any.only",e,{valids:t._valids.values({display:!0})},r,n);if(n.abortEarly)return u.finalize(e,[s],o);d.push(s)}}if(t._invalids){const s=t._invalids.get(e,r,n,t._flags.insensitive);if(s){r.mainstay.tracer.filter(t,r,"invalid",s);const a=t.$_createError("any.invalid",e,{invalids:t._invalids.values({display:!0})},r,n);if(n.abortEarly)return u.finalize(e,[a],o);d.push(a)}}if(l.validate){const t=l.validate(e,o);if(t&&(r.mainstay.tracer.value(r,"base",e,t.value),e=t.value,t.errors)){if(!Array.isArray(t.errors))return d.push(t.errors),u.finalize(e,d,o);if(t.errors.length)return d.push(...t.errors),u.finalize(e,d,o)}}return t._rules.length?u.rules(e,d,o):u.finalize(e,d,o)},u.rules=function(e,t,r){const{schema:n,state:s,prefs:a}=r;for(const o of n._rules){const l=n._definition.rules[o.method];if(l.convert&&a.convert){s.mainstay.tracer.log(n,s,"rule",o.name,"full");continue}let c,f=o.args;if(o._resolve.length){f=Object.assign({},f);for(const t of o._resolve){const r=l.argsByName.get(t),o=f[t].resolve(e,s,a),u=r.normalize?r.normalize(o):o,d=i.validateArg(u,null,r);if(d){c=n.$_createError("any.ref",o,{arg:t,ref:f[t],reason:d},s,a);break}f[t]=u}}c=c||l.validate(e,r,f,o);const d=u.rule(c,o);if(d.errors){if(s.mainstay.tracer.log(n,s,"rule",o.name,"error"),o.warn){s.mainstay.warnings.push(...d.errors);continue}if(a.abortEarly)return u.finalize(e,d.errors,r);t.push(...d.errors)}else s.mainstay.tracer.log(n,s,"rule",o.name,"pass"),s.mainstay.tracer.value(s,"rule",e,d.value,o.name),e=d.value}return u.finalize(e,t,r)},u.rule=function(e,t){return e instanceof l.Report?(u.error(e,t),{errors:[e],value:null}):Array.isArray(e)&&e[i.symbols.errors]?(e.forEach((e=>u.error(e,t))),{errors:e,value:null}):{errors:null,value:e}},u.error=function(e,t){return t.message&&e._setTemplate(t.message),e},u.finalize=function(e,t,r){t=t||[];const{schema:s,state:a,prefs:o}=r;if(t.length){const n=u.default("failover",void 0,t,r);void 0!==n&&(a.mainstay.tracer.value(a,"failover",e,n),e=n,t=[])}if(t.length&&s._flags.error)if("function"==typeof s._flags.error){t=s._flags.error(t),Array.isArray(t)||(t=[t]);for(const e of t)n(e instanceof Error||e instanceof l.Report,"error() must return an Error object")}else t=[s._flags.error];if(void 0===e){const n=u.default("default",e,t,r);a.mainstay.tracer.value(a,"default",e,n),e=n}if(s._flags.cast&&void 0!==e){const t=s._definition.cast[s._flags.cast];if(t.from(e)){const n=t.to(e,r);a.mainstay.tracer.value(a,"cast",e,n,s._flags.cast),e=n}}if(s.$_terms.externals&&o.externals&&!1!==o._externals)for(const{method:e}of s.$_terms.externals)a.mainstay.externals.push({method:e,schema:s,state:a,label:l.label(s._flags,a,o)});const i={value:e,errors:t.length?t:null};return s._flags.result&&(i.value="strip"===s._flags.result?void 0:r.original,a.mainstay.tracer.value(a,s._flags.result,e,i.value),a.shadow(e,s._flags.result)),s._cache&&!1!==o.cache&&!s._refs.length&&s._cache.set(r.original,i),void 0===e||i.errors||void 0===s._flags.artifact||(a.mainstay.artifacts=a.mainstay.artifacts||new Map,a.mainstay.artifacts.has(s._flags.artifact)||a.mainstay.artifacts.set(s._flags.artifact,[]),a.mainstay.artifacts.get(s._flags.artifact).push(a.path)),i},u.prefs=function(e,t){const r=t===i.defaults;return r&&e._preferences[i.symbols.prefs]?e._preferences[i.symbols.prefs]:(t=i.preferences(t,e._preferences),r&&(e._preferences[i.symbols.prefs]=t),t)},u.default=function(e,t,r,n){const{schema:a,state:o,prefs:l}=n,c=a._flags[e];if(l.noDefaults||void 0===c)return t;if(o.mainstay.tracer.log(a,o,"rule",e,"full"),!c)return c;if("function"==typeof c){const i=c.length?[s(o.ancestors[0]),n]:[];try{return c(...i)}catch(t){return void r.push(a.$_createError(`any.${e}`,null,{error:t},o,l))}}return"object"!=typeof c?c:c[i.symbols.literal]?c.literal:i.isResolvable(c)?c.resolve(t,o,l):s(c)},u.trim=function(e,t){if("string"!=typeof e)return e;const r=t.$_getRule("trim");return r&&r.args.enabled?e.trim():e},u.ignore={active:!1,debug:a,entry:a,filter:a,log:a,resolve:a,value:a},u.errorsArray=function(){const e=[];return e[i.symbols.errors]=!0,e}},2036:(e,t,r)=>{"use strict";const n=r(375),s=r(9474),a=r(8160),o={};e.exports=o.Values=class{constructor(e,t){this._values=new Set(e),this._refs=new Set(t),this._lowercase=o.lowercases(e),this._override=!1}get length(){return this._values.size+this._refs.size}add(e,t){a.isResolvable(e)?this._refs.has(e)||(this._refs.add(e),t&&t.register(e)):this.has(e,null,null,!1)||(this._values.add(e),"string"==typeof e&&this._lowercase.set(e.toLowerCase(),e))}static merge(e,t,r){if(e=e||new o.Values,t){if(t._override)return t.clone();for(const r of[...t._values,...t._refs])e.add(r)}if(r)for(const t of[...r._values,...r._refs])e.remove(t);return e.length?e:null}remove(e){a.isResolvable(e)?this._refs.delete(e):(this._values.delete(e),"string"==typeof e&&this._lowercase.delete(e.toLowerCase()))}has(e,t,r,n){return!!this.get(e,t,r,n)}get(e,t,r,n){if(!this.length)return!1;if(this._values.has(e))return{value:e};if("string"==typeof e&&e&&n){const t=this._lowercase.get(e.toLowerCase());if(t)return{value:t}}if(!this._refs.size&&"object"!=typeof e)return!1;if("object"==typeof e)for(const t of this._values)if(s(t,e))return{value:t};if(t)for(const a of this._refs){const o=a.resolve(e,t,r,null,{in:!0});if(void 0===o)continue;const i=a.in&&"object"==typeof o?Array.isArray(o)?o:Object.keys(o):[o];for(const t of i)if(typeof t==typeof e)if(n&&e&&"string"==typeof e){if(t.toLowerCase()===e.toLowerCase())return{value:t,ref:a}}else if(s(t,e))return{value:t,ref:a}}return!1}override(){this._override=!0}values(e){if(e&&e.display){const e=[];for(const t of[...this._values,...this._refs])void 0!==t&&e.push(t);return e}return Array.from([...this._values,...this._refs])}clone(){const e=new o.Values(this._values,this._refs);return e._override=this._override,e}concat(e){n(!e._override,"Cannot concat override set of values");const t=new o.Values([...this._values,...e._values],[...this._refs,...e._refs]);return t._override=this._override,t}describe(){const e=[];this._override&&e.push({override:!0});for(const t of this._values.values())e.push(t&&"object"==typeof t?{value:t}:t);for(const t of this._refs.values())e.push(t.describe());return e}},o.Values.prototype[a.symbols.values]=!0,o.Values.prototype.slice=o.Values.prototype.clone,o.lowercases=function(e){const t=new Map;if(e)for(const r of e)"string"==typeof r&&t.set(r.toLowerCase(),r);return t}},978:(e,t,r)=>{"use strict";const n=r(375),s=r(8571),a=r(1687),o=r(9621),i={};e.exports=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(n(e&&"object"==typeof e,"Invalid defaults value: must be an object"),n(!t||!0===t||"object"==typeof t,"Invalid source value: must be true, falsy or an object"),n("object"==typeof r,"Invalid options: must be an object"),!t)return null;if(r.shallow)return i.applyToDefaultsWithShallow(e,t,r);const o=s(e);if(!0===t)return o;const l=void 0!==r.nullOverride&&r.nullOverride;return a(o,t,{nullOverride:l,mergeArrays:!1})},i.applyToDefaultsWithShallow=function(e,t,r){const l=r.shallow;n(Array.isArray(l),"Invalid keys");const c=new Map,u=!0===t?null:new Set;for(let r of l){r=Array.isArray(r)?r:r.split(".");const n=o(e,r);n&&"object"==typeof n?c.set(n,u&&o(t,r)||n):u&&u.add(r)}const f=s(e,{},c);if(!u)return f;for(const e of u)i.reachCopy(f,t,e);const d=void 0!==r.nullOverride&&r.nullOverride;return a(f,t,{nullOverride:d,mergeArrays:!1})},i.reachCopy=function(e,t,r){for(const e of r){if(!(e in t))return;const r=t[e];if("object"!=typeof r||null===r)return;t=r}const n=t;let s=e;for(let e=0;e<r.length-1;++e){const t=r[e];"object"!=typeof s[t]&&(s[t]={}),s=s[t]}s[r[r.length-1]]=n}},375:(e,t,r)=>{"use strict";const n=r(7916);e.exports=function(e){if(!e){for(var t=arguments.length,r=new Array(t>1?t-1:0),s=1;s<t;s++)r[s-1]=arguments[s];if(1===r.length&&r[0]instanceof Error)throw r[0];throw new n(r)}}},8571:(e,t,r)=>{"use strict";const n=r(9621),s=r(4277),a=r(7043),o={needsProtoHack:new Set([s.set,s.map,s.weakSet,s.weakMap])};e.exports=o.clone=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if("object"!=typeof e||null===e)return e;let n=o.clone,i=r;if(t.shallow){if(!0!==t.shallow)return o.cloneWithShallow(e,t);n=e=>e}else if(i){const t=i.get(e);if(t)return t}else i=new Map;const l=s.getInternalProto(e);if(l===s.buffer)return!1;if(l===s.date)return new Date(e.getTime());if(l===s.regex)return new RegExp(e);const c=o.base(e,l,t);if(c===e)return e;if(i&&i.set(e,c),l===s.set)for(const r of e)c.add(n(r,t,i));else if(l===s.map)for(const[r,s]of e)c.set(r,n(s,t,i));const u=a.keys(e,t);for(const r of u){if("__proto__"===r)continue;if(l===s.array&&"length"===r){c.length=e.length;continue}const a=Object.getOwnPropertyDescriptor(e,r);a?a.get||a.set?Object.defineProperty(c,r,a):a.enumerable?c[r]=n(e[r],t,i):Object.defineProperty(c,r,{enumerable:!1,writable:!0,configurable:!0,value:n(e[r],t,i)}):Object.defineProperty(c,r,{enumerable:!0,writable:!0,configurable:!0,value:n(e[r],t,i)})}return c},o.cloneWithShallow=function(e,t){const r=t.shallow;(t=Object.assign({},t)).shallow=!1;const s=new Map;for(const t of r){const r=n(e,t);"object"!=typeof r&&"function"!=typeof r||s.set(r,r)}return o.clone(e,t,s)},o.base=function(e,t,r){if(!1===r.prototype)return o.needsProtoHack.has(t)?new t.constructor:t===s.array?[]:{};const n=Object.getPrototypeOf(e);if(n&&n.isImmutable)return e;if(t===s.array){const e=[];return n!==t&&Object.setPrototypeOf(e,n),e}if(o.needsProtoHack.has(t)){const e=new n.constructor;return n!==t&&Object.setPrototypeOf(e,n),e}return Object.create(n)}},9474:(e,t,r)=>{"use strict";const n=r(4277),s={mismatched:null};e.exports=function(e,t,r){return r=Object.assign({prototype:!0},r),!!s.isDeepEqual(e,t,r,[])},s.isDeepEqual=function(e,t,r,a){if(e===t)return 0!==e||1/e==1/t;const o=typeof e;if(o!==typeof t)return!1;if(null===e||null===t)return!1;if("function"===o){if(!r.deepFunction||e.toString()!==t.toString())return!1}else if("object"!==o)return e!=e&&t!=t;const i=s.getSharedType(e,t,!!r.prototype);switch(i){case n.buffer:return!1;case n.promise:return e===t;case n.regex:return e.toString()===t.toString();case s.mismatched:return!1}for(let r=a.length-1;r>=0;--r)if(a[r].isSame(e,t))return!0;a.push(new s.SeenEntry(e,t));try{return!!s.isDeepEqualObj(i,e,t,r,a)}finally{a.pop()}},s.getSharedType=function(e,t,r){if(r)return Object.getPrototypeOf(e)!==Object.getPrototypeOf(t)?s.mismatched:n.getInternalProto(e);const a=n.getInternalProto(e);return a!==n.getInternalProto(t)?s.mismatched:a},s.valueOf=function(e){const t=e.valueOf;if(void 0===t)return e;try{return t.call(e)}catch(e){return e}},s.hasOwnEnumerableProperty=function(e,t){return Object.prototype.propertyIsEnumerable.call(e,t)},s.isSetSimpleEqual=function(e,t){for(const r of Set.prototype.values.call(e))if(!Set.prototype.has.call(t,r))return!1;return!0},s.isDeepEqualObj=function(e,t,r,a,o){const{isDeepEqual:i,valueOf:l,hasOwnEnumerableProperty:c}=s,{keys:u,getOwnPropertySymbols:f}=Object;if(e===n.array){if(!a.part){if(t.length!==r.length)return!1;for(let e=0;e<t.length;++e)if(!i(t[e],r[e],a,o))return!1;return!0}for(const e of t)for(const t of r)if(i(e,t,a,o))return!0}else if(e===n.set){if(t.size!==r.size)return!1;if(!s.isSetSimpleEqual(t,r)){const e=new Set(Set.prototype.values.call(r));for(const r of Set.prototype.values.call(t)){if(e.delete(r))continue;let t=!1;for(const n of e)if(i(r,n,a,o)){e.delete(n),t=!0;break}if(!t)return!1}}}else if(e===n.map){if(t.size!==r.size)return!1;for(const[e,n]of Map.prototype.entries.call(t)){if(void 0===n&&!Map.prototype.has.call(r,e))return!1;if(!i(n,Map.prototype.get.call(r,e),a,o))return!1}}else if(e===n.error&&(t.name!==r.name||t.message!==r.message))return!1;const d=l(t),m=l(r);if((t!==d||r!==m)&&!i(d,m,a,o))return!1;const p=u(t);if(!a.part&&p.length!==u(r).length&&!a.skip)return!1;let h=0;for(const e of p)if(a.skip&&a.skip.includes(e))void 0===r[e]&&++h;else{if(!c(r,e))return!1;if(!i(t[e],r[e],a,o))return!1}if(!a.part&&p.length-h!==u(r).length)return!1;if(!1!==a.symbols){const e=f(t),n=new Set(f(r));for(const s of e){if(!a.skip||!a.skip.includes(s))if(c(t,s)){if(!c(r,s))return!1;if(!i(t[s],r[s],a,o))return!1}else if(c(r,s))return!1;n.delete(s)}for(const e of n)if(c(r,e))return!1}return!0},s.SeenEntry=class{constructor(e,t){this.obj=e,this.ref=t}isSame(e,t){return this.obj===e&&this.ref===t}}},7916:(e,t,r)=>{"use strict";const n=r(8761);e.exports=class extends Error{constructor(e){super(e.filter((e=>""!==e)).map((e=>"string"==typeof e?e:e instanceof Error?e.message:n(e))).join(" ")||"Unknown error"),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,t.assert)}}},5277:e=>{"use strict";const t={};e.exports=function(e){if(!e)return"";let r="";for(let n=0;n<e.length;++n){const s=e.charCodeAt(n);t.isSafe(s)?r+=e[n]:r+=t.escapeHtmlChar(s)}return r},t.escapeHtmlChar=function(e){return t.namedHtml.get(e)||(e>=256?"&#"+e+";":`&#x${e.toString(16).padStart(2,"0")};`)},t.isSafe=function(e){return t.safeCharCodes.has(e)},t.namedHtml=new Map([[38,"&"],[60,"<"],[62,">"],[34,"""],[160," "],[162,"¢"],[163,"£"],[164,"¤"],[169,"©"],[174,"®"]]),t.safeCharCodes=function(){const e=new Set;for(let t=32;t<123;++t)(t>=97||t>=65&&t<=90||t>=48&&t<=57||32===t||46===t||44===t||45===t||58===t||95===t)&&e.add(t);return e}()},6064:e=>{"use strict";e.exports=function(e){return e.replace(/[\^\$\.\*\+\-\?\=\!\:\|\\\/\(\)\[\]\{\}\,]/g,"\\$&")}},738:e=>{"use strict";e.exports=function(){}},1687:(e,t,r)=>{"use strict";const n=r(375),s=r(8571),a=r(7043),o={};e.exports=o.merge=function(e,t,r){if(n(e&&"object"==typeof e,"Invalid target value: must be an object"),n(null==t||"object"==typeof t,"Invalid source value: must be null, undefined, or an object"),!t)return e;if(r=Object.assign({nullOverride:!0,mergeArrays:!0},r),Array.isArray(t)){n(Array.isArray(e),"Cannot merge array onto an object"),r.mergeArrays||(e.length=0);for(let n=0;n<t.length;++n)e.push(s(t[n],{symbols:r.symbols}));return e}const i=a.keys(t,r);for(let n=0;n<i.length;++n){const a=i[n];if("__proto__"===a||!Object.prototype.propertyIsEnumerable.call(t,a))continue;const l=t[a];if(l&&"object"==typeof l){if(e[a]===l)continue;!e[a]||"object"!=typeof e[a]||Array.isArray(e[a])!==Array.isArray(l)||l instanceof Date||l instanceof RegExp?e[a]=s(l,{symbols:r.symbols}):o.merge(e[a],l,r)}else(null!=l||r.nullOverride)&&(e[a]=l)}return e}},9621:(e,t,r)=>{"use strict";const n=r(375),s={};e.exports=function(e,t,r){if(!1===t||null==t)return e;"string"==typeof(r=r||{})&&(r={separator:r});const a=Array.isArray(t);n(!a||!r.separator,"Separator option is not valid for array-based chain");const o=a?t:t.split(r.separator||".");let i=e;for(let e=0;e<o.length;++e){let a=o[e];const l=r.iterables&&s.iterables(i);if(Array.isArray(i)||"set"===l){const e=Number(a);Number.isInteger(e)&&(a=e<0?i.length+e:e)}if(!i||"function"==typeof i&&!1===r.functions||!l&&void 0===i[a]){n(!r.strict||e+1===o.length,"Missing segment",a,"in reach path ",t),n("object"==typeof i||!0===r.functions||"function"!=typeof i,"Invalid segment",a,"in reach path ",t),i=r.default;break}i=l?"set"===l?[...i][a]:i.get(a):i[a]}return i},s.iterables=function(e){return e instanceof Set?"set":e instanceof Map?"map":void 0}},8761:e=>{"use strict";e.exports=function(){try{return JSON.stringify(...arguments)}catch(e){return"[Cannot display object: "+e.message+"]"}}},4277:(e,t)=>{"use strict";const r={};t=e.exports={array:Array.prototype,buffer:!1,date:Date.prototype,error:Error.prototype,generic:Object.prototype,map:Map.prototype,promise:Promise.prototype,regex:RegExp.prototype,set:Set.prototype,weakMap:WeakMap.prototype,weakSet:WeakSet.prototype},r.typeMap=new Map([["[object Error]",t.error],["[object Map]",t.map],["[object Promise]",t.promise],["[object Set]",t.set],["[object WeakMap]",t.weakMap],["[object WeakSet]",t.weakSet]]),t.getInternalProto=function(e){if(Array.isArray(e))return t.array;if(e instanceof Date)return t.date;if(e instanceof RegExp)return t.regex;if(e instanceof Error)return t.error;const n=Object.prototype.toString.call(e);return r.typeMap.get(n)||t.generic}},7043:(e,t)=>{"use strict";t.keys=function(e){return!1!==(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).symbols?Reflect.ownKeys(e):Object.getOwnPropertyNames(e)}},3652:(e,t,r)=>{"use strict";const n=r(375),s={};t.Sorter=class{constructor(){this._items=[],this.nodes=[]}add(e,t){const r=[].concat((t=t||{}).before||[]),s=[].concat(t.after||[]),a=t.group||"?",o=t.sort||0;n(!r.includes(a),`Item cannot come before itself: ${a}`),n(!r.includes("?"),"Item cannot come before unassociated items"),n(!s.includes(a),`Item cannot come after itself: ${a}`),n(!s.includes("?"),"Item cannot come after unassociated items"),Array.isArray(e)||(e=[e]);for(const t of e){const e={seq:this._items.length,sort:o,before:r,after:s,group:a,node:t};this._items.push(e)}if(!t.manual){const e=this._sort();n(e,"item","?"!==a?`added into group ${a}`:"","created a dependencies error")}return this.nodes}merge(e){Array.isArray(e)||(e=[e]);for(const t of e)if(t)for(const e of t._items)this._items.push(Object.assign({},e));this._items.sort(s.mergeSort);for(let e=0;e<this._items.length;++e)this._items[e].seq=e;const t=this._sort();return n(t,"merge created a dependencies error"),this.nodes}sort(){const e=this._sort();return n(e,"sort created a dependencies error"),this.nodes}_sort(){const e={},t=Object.create(null),r=Object.create(null);for(const n of this._items){const s=n.seq,a=n.group;r[a]=r[a]||[],r[a].push(s),e[s]=n.before;for(const e of n.after)t[e]=t[e]||[],t[e].push(s)}for(const t in e){const n=[];for(const s in e[t]){const a=e[t][s];r[a]=r[a]||[],n.push(...r[a])}e[t]=n}for(const n in t)if(r[n])for(const s of r[n])e[s].push(...t[n]);const n={};for(const t in e){const r=e[t];for(const e of r)n[e]=n[e]||[],n[e].push(t)}const s={},a=[];for(let e=0;e<this._items.length;++e){let t=e;if(n[e]){t=null;for(let e=0;e<this._items.length;++e){if(!0===s[e])continue;n[e]||(n[e]=[]);const r=n[e].length;let a=0;for(let t=0;t<r;++t)s[n[e][t]]&&++a;if(a===r){t=e;break}}}null!==t&&(s[t]=!0,a.push(t))}if(a.length!==this._items.length)return!1;const o={};for(const e of this._items)o[e.seq]=e;this._items=[],this.nodes=[];for(const e of a){const t=o[e];this.nodes.push(t.node),this._items.push(t)}return!0}},s.mergeSort=(e,t)=>e.sort===t.sort?0:e.sort<t.sort?-1:1},5380:(e,t,r)=>{"use strict";const n=r(443),s=r(2178),a={minDomainSegments:2,nonAsciiRx:/[^\x00-\x7f]/,domainControlRx:/[\x00-\x20@\:\/\\#!\$&\'\(\)\*\+,;=\?]/,tldSegmentRx:/^[a-zA-Z](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/,domainSegmentRx:/^[a-zA-Z0-9](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/,URL:n.URL||URL};t.analyze=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e)return s.code("DOMAIN_NON_EMPTY_STRING");if("string"!=typeof e)throw new Error("Invalid input: domain must be a string");if(e.length>256)return s.code("DOMAIN_TOO_LONG");if(a.nonAsciiRx.test(e)){if(!1===t.allowUnicode)return s.code("DOMAIN_INVALID_UNICODE_CHARS");e=e.normalize("NFC")}if(a.domainControlRx.test(e))return s.code("DOMAIN_INVALID_CHARS");e=a.punycode(e),t.allowFullyQualified&&"."===e[e.length-1]&&(e=e.slice(0,-1));const r=t.minDomainSegments||a.minDomainSegments,n=e.split(".");if(n.length<r)return s.code("DOMAIN_SEGMENTS_COUNT");if(t.maxDomainSegments&&n.length>t.maxDomainSegments)return s.code("DOMAIN_SEGMENTS_COUNT_MAX");const o=t.tlds;if(o){const e=n[n.length-1].toLowerCase();if(o.deny&&o.deny.has(e)||o.allow&&!o.allow.has(e))return s.code("DOMAIN_FORBIDDEN_TLDS")}for(let e=0;e<n.length;++e){const t=n[e];if(!t.length)return s.code("DOMAIN_EMPTY_SEGMENT");if(t.length>63)return s.code("DOMAIN_LONG_SEGMENT");if(e<n.length-1){if(!a.domainSegmentRx.test(t))return s.code("DOMAIN_INVALID_CHARS")}else if(!a.tldSegmentRx.test(t))return s.code("DOMAIN_INVALID_TLDS_CHARS")}return null},t.isValid=function(e,r){return!t.analyze(e,r)},a.punycode=function(e){e.includes("%")&&(e=e.replace(/%/g,"%25"));try{return new a.URL(`http://${e}`).host}catch(t){return e}}},1745:(e,t,r)=>{"use strict";const n=r(9848),s=r(5380),a=r(2178),o={nonAsciiRx:/[^\x00-\x7f]/,encoder:new(n.TextEncoder||TextEncoder)};t.analyze=function(e,t){return o.email(e,t)},t.isValid=function(e,t){return!o.email(e,t)},o.email=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("string"!=typeof e)throw new Error("Invalid input: email must be a string");if(!e)return a.code("EMPTY_STRING");const r=!o.nonAsciiRx.test(e);if(!r){if(!1===t.allowUnicode)return a.code("FORBIDDEN_UNICODE");e=e.normalize("NFC")}const n=e.split("@");if(2!==n.length)return n.length>2?a.code("MULTIPLE_AT_CHAR"):a.code("MISSING_AT_CHAR");const[i,l]=n;if(!i)return a.code("EMPTY_LOCAL");if(!t.ignoreLength){if(e.length>254)return a.code("ADDRESS_TOO_LONG");if(o.encoder.encode(i).length>64)return a.code("LOCAL_TOO_LONG")}return o.local(i,r)||s.analyze(l,t)},o.local=function(e,t){const r=e.split(".");for(const e of r){if(!e.length)return a.code("EMPTY_LOCAL_SEGMENT");if(t){if(!o.atextRx.test(e))return a.code("INVALID_LOCAL_CHARS")}else for(const t of e){if(o.atextRx.test(t))continue;const e=o.binary(t);if(!o.atomRx.test(e))return a.code("INVALID_LOCAL_CHARS")}}},o.binary=function(e){return Array.from(o.encoder.encode(e)).map((e=>String.fromCharCode(e))).join("")},o.atextRx=/^[\w!#\$%&'\*\+\-/=\?\^`\{\|\}~]+$/,o.atomRx=new RegExp(["(?:[\\xc2-\\xdf][\\x80-\\xbf])","(?:\\xe0[\\xa0-\\xbf][\\x80-\\xbf])|(?:[\\xe1-\\xec][\\x80-\\xbf]{2})|(?:\\xed[\\x80-\\x9f][\\x80-\\xbf])|(?:[\\xee-\\xef][\\x80-\\xbf]{2})","(?:\\xf0[\\x90-\\xbf][\\x80-\\xbf]{2})|(?:[\\xf1-\\xf3][\\x80-\\xbf]{3})|(?:\\xf4[\\x80-\\x8f][\\x80-\\xbf]{2})"].join("|"))},2178:(e,t)=>{"use strict";t.codes={EMPTY_STRING:"Address must be a non-empty string",FORBIDDEN_UNICODE:"Address contains forbidden Unicode characters",MULTIPLE_AT_CHAR:"Address cannot contain more than one @ character",MISSING_AT_CHAR:"Address must contain one @ character",EMPTY_LOCAL:"Address local part cannot be empty",ADDRESS_TOO_LONG:"Address too long",LOCAL_TOO_LONG:"Address local part too long",EMPTY_LOCAL_SEGMENT:"Address local part contains empty dot-separated segment",INVALID_LOCAL_CHARS:"Address local part contains invalid character",DOMAIN_NON_EMPTY_STRING:"Domain must be a non-empty string",DOMAIN_TOO_LONG:"Domain too long",DOMAIN_INVALID_UNICODE_CHARS:"Domain contains forbidden Unicode characters",DOMAIN_INVALID_CHARS:"Domain contains invalid character",DOMAIN_INVALID_TLDS_CHARS:"Domain contains invalid tld character",DOMAIN_SEGMENTS_COUNT:"Domain lacks the minimum required number of segments",DOMAIN_SEGMENTS_COUNT_MAX:"Domain contains too many segments",DOMAIN_FORBIDDEN_TLDS:"Domain uses forbidden TLD",DOMAIN_EMPTY_SEGMENT:"Domain contains empty dot-separated segment",DOMAIN_LONG_SEGMENT:"Domain contains dot-separated segment that is too long"},t.code=function(e){return{code:e,error:t.codes[e]}}},9959:(e,t,r)=>{"use strict";const n=r(375),s=r(5752);t.regex=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};n(void 0===e.cidr||"string"==typeof e.cidr,"options.cidr must be a string");const t=e.cidr?e.cidr.toLowerCase():"optional";n(["required","optional","forbidden"].includes(t),"options.cidr must be one of required, optional, forbidden"),n(void 0===e.version||"string"==typeof e.version||Array.isArray(e.version),"options.version must be a string or an array of string");let r=e.version||["ipv4","ipv6","ipvfuture"];Array.isArray(r)||(r=[r]),n(r.length>=1,"options.version must have at least 1 version specified");for(let e=0;e<r.length;++e)n("string"==typeof r[e],"options.version must only contain strings"),r[e]=r[e].toLowerCase(),n(["ipv4","ipv6","ipvfuture"].includes(r[e]),"options.version contains unknown version "+r[e]+" - must be one of ipv4, ipv6, ipvfuture");r=Array.from(new Set(r));const a=`(?:${r.map((e=>{if("forbidden"===t)return s.ip[e];const r=`\\/${"ipv4"===e?s.ip.v4Cidr:s.ip.v6Cidr}`;return"required"===t?`${s.ip[e]}${r}`:`${s.ip[e]}(?:${r})?`})).join("|")})`,o=new RegExp(`^${a}$`);return{cidr:t,versions:r,regex:o,raw:a}}},5752:(e,t,r)=>{"use strict";const n=r(375),s=r(6064),a={generate:function(){const e={},t="\\dA-Fa-f",r="["+t+"]",n="\\w-\\.~",s="!\\$&'\\(\\)\\*\\+,;=",a="%"+t,o=n+a+s+":@",i="["+o+"]",l="(?:0{0,2}\\d|0?[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])";e.ipv4address="(?:"+l+"\\.){3}"+l;const c=r+"{1,4}",u="(?:"+c+":"+c+"|"+e.ipv4address+")",f="(?:"+c+":){6}"+u,d="::(?:"+c+":){5}"+u,m="(?:"+c+")?::(?:"+c+":){4}"+u,p="(?:(?:"+c+":){0,1}"+c+")?::(?:"+c+":){3}"+u,h="(?:(?:"+c+":){0,2}"+c+")?::(?:"+c+":){2}"+u,g="(?:(?:"+c+":){0,3}"+c+")?::"+c+":"+u,y="(?:(?:"+c+":){0,4}"+c+")?::"+u,v="(?:(?:"+c+":){0,5}"+c+")?::"+c,b="(?:(?:"+c+":){0,6}"+c+")?::";e.ipv4Cidr="(?:\\d|[1-2]\\d|3[0-2])",e.ipv6Cidr="(?:0{0,2}\\d|0?[1-9]\\d|1[01]\\d|12[0-8])",e.ipv6address="(?:"+f+"|"+d+"|"+m+"|"+p+"|"+h+"|"+g+"|"+y+"|"+v+"|"+b+")",e.ipvFuture="v"+r+"+\\.["+n+s+":]+",e.scheme="[a-zA-Z][a-zA-Z\\d+-\\.]*",e.schemeRegex=new RegExp(e.scheme);const _="["+n+a+s+":]*",w="["+n+a+s+"]{1,255}",x="(?:\\[(?:"+e.ipv6address+"|"+e.ipvFuture+")\\]|"+e.ipv4address+"|"+w+")",$="(?:"+_+"@)?"+x+"(?::\\d*)?",S="(?:"+_+"@)?("+x+")(?::\\d*)?",k=i+"*",A=i+"+",j="(?:\\/"+k+")*",R="\\/(?:"+A+j+")?",E=A+j,O="["+n+a+s+"@]+"+j,C="(?:\\/\\/\\/"+k+j+")";return e.hierPart="(?:(?:\\/\\/"+$+j+")|"+R+"|"+E+"|"+C+")",e.hierPartCapture="(?:(?:\\/\\/"+S+j+")|"+R+"|"+E+")",e.relativeRef="(?:(?:\\/\\/"+$+j+")|"+R+"|"+O+"|)",e.relativeRefCapture="(?:(?:\\/\\/"+S+j+")|"+R+"|"+O+"|)",e.query="["+o+"\\/\\?]*(?=#|$)",e.queryWithSquareBrackets="["+o+"\\[\\]\\/\\?]*(?=#|$)",e.fragment="["+o+"\\/\\?]*",e}};a.rfc3986=a.generate(),t.ip={v4Cidr:a.rfc3986.ipv4Cidr,v6Cidr:a.rfc3986.ipv6Cidr,ipv4:a.rfc3986.ipv4address,ipv6:a.rfc3986.ipv6address,ipvfuture:a.rfc3986.ipvFuture},a.createRegex=function(e){const t=a.rfc3986,r="(?:\\?"+(e.allowQuerySquareBrackets?t.queryWithSquareBrackets:t.query)+")?(?:#"+t.fragment+")?",o=e.domain?t.relativeRefCapture:t.relativeRef;if(e.relativeOnly)return a.wrap(o+r);let i="";if(e.scheme){n(e.scheme instanceof RegExp||"string"==typeof e.scheme||Array.isArray(e.scheme),"scheme must be a RegExp, String, or Array");const r=[].concat(e.scheme);n(r.length>=1,"scheme must have at least 1 scheme specified");const a=[];for(let e=0;e<r.length;++e){const o=r[e];n(o instanceof RegExp||"string"==typeof o,"scheme at position "+e+" must be a RegExp or String"),o instanceof RegExp?a.push(o.source.toString()):(n(t.schemeRegex.test(o),"scheme at position "+e+" must be a valid scheme"),a.push(s(o)))}i=a.join("|")}const l="(?:"+(i?"(?:"+i+")":t.scheme)+":"+(e.domain?t.hierPartCapture:t.hierPart)+")",c=e.allowRelative?"(?:"+l+"|"+o+")":l;return a.wrap(c+r,i)},a.wrap=function(e,t){return{raw:e=`(?=.)(?!https?:/(?:$|[^/]))(?!https?:///)(?!https?:[^/])${e}`,regex:new RegExp(`^${e}$`),scheme:t}},a.uriRegex=a.createRegex({}),t.regex=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e.scheme||e.allowRelative||e.relativeOnly||e.allowQuerySquareBrackets||e.domain?a.createRegex(e):a.uriRegex}},1447:(e,t)=>{"use strict";const r={operators:["!","^","*","/","%","+","-","<","<=",">",">=","==","!=","&&","||","??"],operatorCharacters:["!","^","*","/","%","+","-","<","=",">","&","|","?"],operatorsOrder:[["^"],["*","/","%"],["+","-"],["<","<=",">",">="],["==","!="],["&&"],["||","??"]],operatorsPrefix:["!","n"],literals:{'"':'"',"`":"`","'":"'","[":"]"},numberRx:/^(?:[0-9]*(\.[0-9]*)?){1}$/,tokenRx:/^[\w\$\#\.\@\:\{\}]+$/,symbol:Symbol("formula"),settings:Symbol("settings")};t.Parser=class{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!t[r.settings]&&t.constants)for(const e in t.constants){const r=t.constants[e];if(null!==r&&!["boolean","number","string"].includes(typeof r))throw new Error(`Formula constant ${e} contains invalid ${typeof r} value type`)}this.settings=t[r.settings]?t:Object.assign({[r.settings]:!0,constants:{},functions:{}},t),this.single=null,this._parts=null,this._parse(e)}_parse(e){let n=[],s="",a=0,o=!1;const i=e=>{if(a)throw new Error("Formula missing closing parenthesis");const i=n.length?n[n.length-1]:null;if(o||s||e){if(i&&"reference"===i.type&&")"===e)return i.type="function",i.value=this._subFormula(s,i.value),void(s="");if(")"===e){const e=new t.Parser(s,this.settings);n.push({type:"segment",value:e})}else if(o){if("]"===o)return n.push({type:"reference",value:s}),void(s="");n.push({type:"literal",value:s})}else if(r.operatorCharacters.includes(s))i&&"operator"===i.type&&r.operators.includes(i.value+s)?i.value+=s:n.push({type:"operator",value:s});else if(s.match(r.numberRx))n.push({type:"constant",value:parseFloat(s)});else if(void 0!==this.settings.constants[s])n.push({type:"constant",value:this.settings.constants[s]});else{if(!s.match(r.tokenRx))throw new Error(`Formula contains invalid token: ${s}`);n.push({type:"reference",value:s})}s=""}};for(const t of e)o?t===o?(i(),o=!1):s+=t:a?"("===t?(s+=t,++a):")"===t?(--a,a?s+=t:i(t)):s+=t:t in r.literals?o=r.literals[t]:"("===t?(i(),++a):r.operatorCharacters.includes(t)?(i(),s=t,i()):" "!==t?s+=t:i();i(),n=n.map(((e,t)=>"operator"!==e.type||"-"!==e.value||t&&"operator"!==n[t-1].type?e:{type:"operator",value:"n"}));let l=!1;for(const e of n){if("operator"===e.type){if(r.operatorsPrefix.includes(e.value))continue;if(!l)throw new Error("Formula contains an operator in invalid position");if(!r.operators.includes(e.value))throw new Error(`Formula contains an unknown operator ${e.value}`)}else if(l)throw new Error("Formula missing expected operator");l=!l}if(!l)throw new Error("Formula contains invalid trailing operator");1===n.length&&["reference","literal","constant"].includes(n[0].type)&&(this.single={type:"reference"===n[0].type?"reference":"value",value:n[0].value}),this._parts=n.map((e=>{if("operator"===e.type)return r.operatorsPrefix.includes(e.value)?e:e.value;if("reference"!==e.type)return e.value;if(this.settings.tokenRx&&!this.settings.tokenRx.test(e.value))throw new Error(`Formula contains invalid reference ${e.value}`);return this.settings.reference?this.settings.reference(e.value):r.reference(e.value)}))}_subFormula(e,n){const s=this.settings.functions[n];if("function"!=typeof s)throw new Error(`Formula contains unknown function ${n}`);let a=[];if(e){let t="",s=0,o=!1;const i=()=>{if(!t)throw new Error(`Formula contains function ${n} with invalid arguments ${e}`);a.push(t),t=""};for(let n=0;n<e.length;++n){const a=e[n];o?(t+=a,a===o&&(o=!1)):a in r.literals&&!s?(t+=a,o=r.literals[a]):","!==a||s?(t+=a,"("===a?++s:")"===a&&--s):i()}i()}return a=a.map((e=>new t.Parser(e,this.settings))),function(e){const t=[];for(const r of a)t.push(r.evaluate(e));return s.call(e,...t)}}evaluate(e){const t=this._parts.slice();for(let n=t.length-2;n>=0;--n){const s=t[n];if(s&&"operator"===s.type){const a=t[n+1];t.splice(n+1,1);const o=r.evaluate(a,e);t[n]=r.single(s.value,o)}}return r.operatorsOrder.forEach((n=>{for(let s=1;s<t.length-1;)if(n.includes(t[s])){const n=t[s],a=r.evaluate(t[s-1],e),o=r.evaluate(t[s+1],e);t.splice(s,2);const i=r.calculate(n,a,o);t[s-1]=0===i?0:i}else s+=2})),r.evaluate(t[0],e)}},t.Parser.prototype[r.symbol]=!0,r.reference=function(e){return function(t){return t&&void 0!==t[e]?t[e]:null}},r.evaluate=function(e,t){return null===e?null:"function"==typeof e?e(t):e[r.symbol]?e.evaluate(t):e},r.single=function(e,t){if("!"===e)return!t;const r=-t;return 0===r?0:r},r.calculate=function(e,t,n){if("??"===e)return r.exists(t)?t:n;if("string"==typeof t||"string"==typeof n){if("+"===e)return(t=r.exists(t)?t:"")+(r.exists(n)?n:"")}else switch(e){case"^":return Math.pow(t,n);case"*":return t*n;case"/":return t/n;case"%":return t%n;case"+":return t+n;case"-":return t-n}switch(e){case"<":return t<n;case"<=":return t<=n;case">":return t>n;case">=":return t>=n;case"==":return t===n;case"!=":return t!==n;case"&&":return t&&n;case"||":return t||n}return null},r.exists=function(e){return null!=e}},9926:()=>{},5688:()=>{},9708:()=>{},1152:()=>{},443:()=>{},9848:()=>{},5934:e=>{"use strict";e.exports={version:"17.9.2"}}},t={},function r(n){var s=t[n];if(void 0!==s)return s.exports;var a=t[n]={exports:{}};return e[n](a,a.exports,r),a.exports}(5107);var e,t},e.exports=t()},5800:function(e,t,r){!function(e,t){"use strict";function r(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var n=r(t);function s(e,t){return s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},s(e,t)}var a={error:null},o=function(e){function t(){for(var t,r=arguments.length,n=new Array(r),s=0;s<r;s++)n[s]=arguments[s];return(t=e.call.apply(e,[this].concat(n))||this).state=a,t.resetErrorBoundary=function(){for(var e,r=arguments.length,n=new Array(r),s=0;s<r;s++)n[s]=arguments[s];null==t.props.onReset||(e=t.props).onReset.apply(e,n),t.reset()},t}var r,o;o=e,(r=t).prototype=Object.create(o.prototype),r.prototype.constructor=r,s(r,o),t.getDerivedStateFromError=function(e){return{error:e}};var i=t.prototype;return i.reset=function(){this.setState(a)},i.componentDidCatch=function(e,t){var r,n;null==(r=(n=this.props).onError)||r.call(n,e,t)},i.componentDidUpdate=function(e,t){var r,n,s,a,o=this.state.error,i=this.props.resetKeys;null!==o&&null!==t.error&&(void 0===(s=e.resetKeys)&&(s=[]),void 0===(a=i)&&(a=[]),s.length!==a.length||s.some((function(e,t){return!Object.is(e,a[t])})))&&(null==(r=(n=this.props).onResetKeysChange)||r.call(n,e.resetKeys,i),this.reset())},i.render=function(){var e=this.state.error,t=this.props,r=t.fallbackRender,s=t.FallbackComponent,a=t.fallback;if(null!==e){var o={error:e,resetErrorBoundary:this.resetErrorBoundary};if(n.isValidElement(a))return a;if("function"==typeof r)return r(o);if(s)return n.createElement(s,o);throw new Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop")}return this.props.children},t}(n.Component);e.ErrorBoundary=o,e.useErrorHandler=function(e){var t=n.useState(null),r=t[0],s=t[1];if(null!=e)throw e;if(null!=r)throw r;return s},e.withErrorBoundary=function(e,t){var r=function(r){return n.createElement(o,t,n.createElement(e,r))},s=e.displayName||e.name||"Unknown";return r.displayName="withErrorBoundary("+s+")",r},Object.defineProperty(e,"__esModule",{value:!0})}(t,r(9196))},9196:function(e){"use strict";e.exports=window.React}},t={};function r(n){var s=t[n];if(void 0!==s)return s.exports;var a=t[n]={exports:{}};return e[n].call(a.exports,a,a.exports,r),a.exports}r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,{a:t}),t},r.d=function(e,t){for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){"use strict";var e=window.wp.element;function t(e){return"field"===e.nodeType}function n(e){return"group"===e.nodeType}function s(e){return"validation_error"===e.type||null!=e.data?.errors}function a(e){return"gateway_error"===e.type}function o(e,t,r){e.forEach((e=>{r&&!r(e)||t(e),n(e)&&o(e.nodes,t,r)}))}function i(e,t,r,n){let s=r;return o(e,(e=>{s=t(s,e)}),n),s}var l=r(9196),c=e=>"checkbox"===e.type,u=e=>e instanceof Date,f=e=>null==e;const d=e=>"object"==typeof e;var m=e=>!f(e)&&!Array.isArray(e)&&d(e)&&!u(e),p=e=>m(e)&&e.target?c(e.target)?e.target.checked:e.target.value:e,h=(e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)),g=e=>{const t=e.constructor&&e.constructor.prototype;return m(t)&&t.hasOwnProperty("isPrototypeOf")},y="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function v(e){let t;const r=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else{if(y&&(e instanceof Blob||e instanceof FileList)||!r&&!m(e))return e;if(t=r?[]:{},r||g(e))for(const r in e)e.hasOwnProperty(r)&&(t[r]=v(e[r]));else t=e}return t}var b=e=>Array.isArray(e)?e.filter(Boolean):[],_=e=>void 0===e,w=(e,t,r)=>{if(!t||!m(e))return r;const n=b(t.split(/[,[\].]+?/)).reduce(((e,t)=>f(e)?e:e[t]),e);return _(n)||n===e?_(e[t])?r:e[t]:n};const x={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},$={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},S="pattern",k="required",A=l.createContext(null),j=()=>l.useContext(A),R=e=>{const{children:t,...r}=e;return l.createElement(A.Provider,{value:r},t)};var E=(e,t,r,n=!0)=>{const s={defaultValues:t._defaultValues};for(const a in e)Object.defineProperty(s,a,{get:()=>{const s=a;return t._proxyFormState[s]!==$.all&&(t._proxyFormState[s]=!n||$.all),r&&(r[s]=!0),e[s]}});return s},O=e=>m(e)&&!Object.keys(e).length,C=(e,t,r,n)=>{r(e);const{name:s,...a}=e;return O(a)||Object.keys(a).length>=Object.keys(t).length||Object.keys(a).find((e=>t[e]===(!n||$.all)))},D=e=>Array.isArray(e)?e:[e],F=(e,t,r)=>r&&t?e===t:!e||!t||e===t||D(e).some((e=>e&&(e.startsWith(t)||t.startsWith(e))));function P(e){const t=l.useRef(e);t.current=e,l.useEffect((()=>{const r=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{r&&r.unsubscribe()}}),[e.disabled])}function M(e){const t=j(),{control:r=t.control,disabled:n,name:s,exact:a}=e||{},[o,i]=l.useState(r._formState),c=l.useRef(!0),u=l.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1}),f=l.useRef(s);return f.current=s,P({disabled:n,next:e=>c.current&&F(f.current,e.name,a)&&C(e,u.current,r._updateFormState)&&i({...r._formState,...e}),subject:r._subjects.state}),l.useEffect((()=>(c.current=!0,u.current.isValid&&r._updateValid(!0),()=>{c.current=!1})),[r]),E(o,r,u.current,!1)}var I=e=>"string"==typeof e,N=(e,t,r,n,s)=>I(e)?(n&&t.watch.add(e),w(r,e,s)):Array.isArray(e)?e.map((e=>(n&&t.watch.add(e),w(r,e)))):(n&&(t.watchAll=!0),r);function T(e){const t=j(),{control:r=t.control,name:n,defaultValue:s,disabled:a,exact:o}=e||{},i=l.useRef(n);i.current=n,P({disabled:a,subject:r._subjects.values,next:e=>{F(i.current,e.name,o)&&u(v(N(i.current,r._names,e.values||r._formValues,!1,s)))}});const[c,u]=l.useState(r._getWatch(n,s));return l.useEffect((()=>r._removeUnmounted())),c}var V=e=>/^\w*$/.test(e),L=e=>b(e.replace(/["|']|\]/g,"").split(/\.|\[/));function q(e,t,r){let n=-1;const s=V(t)?[t]:L(t),a=s.length,o=a-1;for(;++n<a;){const t=s[n];let a=r;if(n!==o){const r=e[t];a=m(r)||Array.isArray(r)?r:isNaN(+s[n+1])?{}:[]}e[t]=a,e=e[t]}return e}var z=(e,t,r,n,s)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:s||!0}}:{};const U=(e,t,r)=>{for(const n of r||Object.keys(e)){const r=w(e,n);if(r){const{_f:e,...n}=r;if(e&&t(e.name)){if(e.ref.focus){e.ref.focus();break}if(e.refs&&e.refs[0].focus){e.refs[0].focus();break}}else m(n)&&U(n,t)}}};var B=e=>({isOnSubmit:!e||e===$.onSubmit,isOnBlur:e===$.onBlur,isOnChange:e===$.onChange,isOnAll:e===$.all,isOnTouch:e===$.onTouched}),W=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some((t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length))))),H=(e,t,r)=>{const n=b(w(e,r));return q(n,"root",t[r]),q(e,r,n),e},K=e=>"boolean"==typeof e,G=e=>"file"===e.type,Z=e=>"function"==typeof e,Y=e=>{if(!y)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},J=e=>I(e),Q=e=>"radio"===e.type,X=e=>e instanceof RegExp;const ee={value:!1,isValid:!1},te={value:!0,isValid:!0};var re=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter((e=>e&&e.checked&&!e.disabled)).map((e=>e.value));return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!_(e[0].attributes.value)?_(e[0].value)||""===e[0].value?te:{value:e[0].value,isValid:!0}:te:ee}return ee};const ne={isValid:!1,value:null};var se=e=>Array.isArray(e)?e.reduce(((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e),ne):ne;function ae(e,t,r="validate"){if(J(e)||Array.isArray(e)&&e.every(J)||K(e)&&!e)return{type:r,message:J(e)?e:"",ref:t}}var oe=e=>m(e)&&!X(e)?e:{value:e,message:""},ie=async(e,t,r,n,s)=>{const{ref:a,refs:o,required:i,maxLength:l,minLength:u,min:d,max:p,pattern:h,validate:g,name:y,valueAsNumber:v,mount:b,disabled:x}=e._f,$=w(t,y);if(!b||x)return{};const A=o?o[0]:a,j=e=>{n&&A.reportValidity&&(A.setCustomValidity(K(e)?"":e||""),A.reportValidity())},R={},E=Q(a),C=c(a),D=E||C,F=(v||G(a))&&_(a.value)&&_($)||Y(a)&&""===a.value||""===$||Array.isArray($)&&!$.length,P=z.bind(null,y,r,R),M=(e,t,r,n="maxLength",s="minLength")=>{const o=e?t:r;R[y]={type:e?n:s,message:o,ref:a,...P(e?n:s,o)}};if(s?!Array.isArray($)||!$.length:i&&(!D&&(F||f($))||K($)&&!$||C&&!re(o).isValid||E&&!se(o).isValid)){const{value:e,message:t}=J(i)?{value:!!i,message:i}:oe(i);if(e&&(R[y]={type:k,message:t,ref:A,...P(k,t)},!r))return j(t),R}if(!(F||f(d)&&f(p))){let e,t;const n=oe(p),s=oe(d);if(f($)||isNaN($)){const r=a.valueAsDate||new Date($),o=e=>new Date((new Date).toDateString()+" "+e),i="time"==a.type,l="week"==a.type;I(n.value)&&$&&(e=i?o($)>o(n.value):l?$>n.value:r>new Date(n.value)),I(s.value)&&$&&(t=i?o($)<o(s.value):l?$<s.value:r<new Date(s.value))}else{const r=a.valueAsNumber||($?+$:$);f(n.value)||(e=r>n.value),f(s.value)||(t=r<s.value)}if((e||t)&&(M(!!e,n.message,s.message,"max","min"),!r))return j(R[y].message),R}if((l||u)&&!F&&(I($)||s&&Array.isArray($))){const e=oe(l),t=oe(u),n=!f(e.value)&&$.length>+e.value,s=!f(t.value)&&$.length<+t.value;if((n||s)&&(M(n,e.message,t.message),!r))return j(R[y].message),R}if(h&&!F&&I($)){const{value:e,message:t}=oe(h);if(X(e)&&!$.match(e)&&(R[y]={type:S,message:t,ref:a,...P(S,t)},!r))return j(t),R}if(g)if(Z(g)){const e=ae(await g($,t),A);if(e&&(R[y]={...e,...P("validate",e.message)},!r))return j(e.message),R}else if(m(g)){let e={};for(const n in g){if(!O(e)&&!r)break;const s=ae(await g[n]($,t),A,n);s&&(e={...s,...P(n,s.message)},j(s.message),r&&(R[y]=e))}if(!O(e)&&(R[y]={ref:A,...e},!r))return R}return j(!0),R};function le(e,t){const r=Array.isArray(t)?t:V(t)?[t]:L(t),n=1===r.length?e:function(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;)e=_(e)?n++:e[t[n++]];return e}(e,r),s=r.length-1,a=r[s];return n&&delete n[a],0!==s&&(m(n)&&O(n)||Array.isArray(n)&&function(e){for(const t in e)if(e.hasOwnProperty(t)&&!_(e[t]))return!1;return!0}(n))&&le(e,r.slice(0,-1)),e}function ce(){let e=[];return{get observers(){return e},next:t=>{for(const r of e)r.next&&r.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter((e=>e!==t))}}),unsubscribe:()=>{e=[]}}}var ue=e=>f(e)||!d(e);function fe(e,t){if(ue(e)||ue(t))return e===t;if(u(e)&&u(t))return e.getTime()===t.getTime();const r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(const s of r){const r=e[s];if(!n.includes(s))return!1;if("ref"!==s){const e=t[s];if(u(r)&&u(e)||m(r)&&m(e)||Array.isArray(r)&&Array.isArray(e)?!fe(r,e):r!==e)return!1}}return!0}var de=e=>"select-multiple"===e.type,me=e=>Q(e)||c(e),pe=e=>Y(e)&&e.isConnected,he=e=>{for(const t in e)if(Z(e[t]))return!0;return!1};function ge(e,t={}){const r=Array.isArray(e);if(m(e)||r)for(const r in e)Array.isArray(e[r])||m(e[r])&&!he(e[r])?(t[r]=Array.isArray(e[r])?[]:{},ge(e[r],t[r])):f(e[r])||(t[r]=!0);return t}function ye(e,t,r){const n=Array.isArray(e);if(m(e)||n)for(const n in e)Array.isArray(e[n])||m(e[n])&&!he(e[n])?_(t)||ue(r[n])?r[n]=Array.isArray(e[n])?ge(e[n],[]):{...ge(e[n])}:ye(e[n],f(t)?{}:t[n],r[n]):r[n]=!fe(e[n],t[n]);return r}var ve=(e,t)=>ye(e,t,ge(t)),be=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>_(e)?e:t?""===e?NaN:e?+e:e:r&&I(e)?new Date(e):n?n(e):e;function _e(e){const t=e.ref;if(!(e.refs?e.refs.every((e=>e.disabled)):t.disabled))return G(t)?t.files:Q(t)?se(e.refs).value:de(t)?[...t.selectedOptions].map((({value:e})=>e)):c(t)?re(e.refs).value:be(_(t.value)?e.ref.value:t.value,e)}var we=(e,t,r,n)=>{const s={};for(const r of e){const e=w(t,r);e&&q(s,r,e._f)}return{criteriaMode:r,names:[...e],fields:s,shouldUseNativeValidation:n}},xe=e=>_(e)?e:X(e)?e.source:m(e)?X(e.value)?e.value.source:e.value:e,$e=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function Se(e,t,r){const n=w(e,r);if(n||V(r))return{error:n,name:r};const s=r.split(".");for(;s.length;){const n=s.join("."),a=w(t,n),o=w(e,n);if(a&&!Array.isArray(a)&&r!==n)return{name:r};if(o&&o.type)return{name:n,error:o};s.pop()}return{name:r}}var ke=(e,t,r,n,s)=>!s.isOnAll&&(!r&&s.isOnTouch?!(t||e):(r?n.isOnBlur:s.isOnBlur)?!e:!(r?n.isOnChange:s.isOnChange)||e),Ae=(e,t)=>!b(w(e,t)).length&&le(e,t);const je={mode:$.onSubmit,reValidateMode:$.onChange,shouldFocusError:!0};function Re(e={},t){let r,n={...je,...e},s={submitCount:0,isDirty:!1,isLoading:Z(n.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},errors:{}},a={},o=(m(n.defaultValues)||m(n.values))&&v(n.defaultValues||n.values)||{},i=n.shouldUnregister?{}:v(o),l={action:!1,mount:!1,watch:!1},d={mount:new Set,unMount:new Set,array:new Set,watch:new Set},g=0;const S={isDirty:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},k={values:ce(),array:ce(),state:ce()},A=e.resetOptions&&e.resetOptions.keepDirtyValues,j=B(n.mode),R=B(n.reValidateMode),E=n.criteriaMode===$.all,C=async e=>{if(S.isValid||e){const e=n.resolver?O((await T()).errors):await V(a,!0);e!==s.isValid&&k.state.next({isValid:e})}},F=e=>S.isValidating&&k.state.next({isValidating:e}),P=(e,t,r,n)=>{const s=w(a,e);if(s){const a=w(i,e,_(r)?w(o,e):r);_(a)||n&&n.defaultChecked||t?q(i,e,t?a:_e(s._f)):J(e,a),l.mount&&C()}},M=(e,t,r,n,a)=>{let i=!1,l=!1;const c={name:e};if(!r||n){S.isDirty&&(l=s.isDirty,s.isDirty=c.isDirty=L(),i=l!==c.isDirty);const r=fe(w(o,e),t);l=w(s.dirtyFields,e),r?le(s.dirtyFields,e):q(s.dirtyFields,e,!0),c.dirtyFields=s.dirtyFields,i=i||S.dirtyFields&&l!==!r}if(r){const t=w(s.touchedFields,e);t||(q(s.touchedFields,e,r),c.touchedFields=s.touchedFields,i=i||S.touchedFields&&t!==r)}return i&&a&&k.state.next(c),i?c:{}},T=async e=>n.resolver(i,n.context,we(e||d.mount,a,n.criteriaMode,n.shouldUseNativeValidation)),V=async(e,t,r={valid:!0})=>{for(const a in e){const o=e[a];if(o){const{_f:e,...a}=o;if(e){const a=d.array.has(e.name),l=await ie(o,i,E,n.shouldUseNativeValidation&&!t,a);if(l[e.name]&&(r.valid=!1,t))break;!t&&(w(l,e.name)?a?H(s.errors,l,e.name):q(s.errors,e.name,l[e.name]):le(s.errors,e.name))}a&&await V(a,t,r)}}return r.valid},L=(e,t)=>(e&&t&&q(i,e,t),!fe(re(),o)),z=(e,t,r)=>N(e,d,{...l.mount?i:_(t)?o:I(e)?{[e]:t}:t},r,t),J=(e,t,r={})=>{const n=w(a,e);let s=t;if(n){const r=n._f;r&&(!r.disabled&&q(i,e,be(t,r)),s=Y(r.ref)&&f(t)?"":t,de(r.ref)?[...r.ref.options].forEach((e=>e.selected=s.includes(e.value))):r.refs?c(r.ref)?r.refs.length>1?r.refs.forEach((e=>(!e.defaultChecked||!e.disabled)&&(e.checked=Array.isArray(s)?!!s.find((t=>t===e.value)):s===e.value))):r.refs[0]&&(r.refs[0].checked=!!s):r.refs.forEach((e=>e.checked=e.value===s)):G(r.ref)?r.ref.value="":(r.ref.value=s,r.ref.type||k.values.next({name:e,values:{...i}})))}(r.shouldDirty||r.shouldTouch)&&M(e,s,r.shouldTouch,r.shouldDirty,!0),r.shouldValidate&&te(e)},Q=(e,t,r)=>{for(const n in t){const s=t[n],o=`${e}.${n}`,i=w(a,o);!d.array.has(e)&&ue(s)&&(!i||i._f)||u(s)?J(o,s,r):Q(o,s,r)}},X=(e,r,n={})=>{const c=w(a,e),u=d.array.has(e),m=v(r);q(i,e,m),u?(k.array.next({name:e,values:{...i}}),(S.isDirty||S.dirtyFields)&&n.shouldDirty&&k.state.next({name:e,dirtyFields:ve(o,i),isDirty:L(e,m)})):!c||c._f||f(m)?J(e,m,n):Q(e,m,n),W(e,d)&&k.state.next({...s}),k.values.next({name:e,values:{...i}}),!l.mount&&t()},ee=async t=>{const o=t.target;let l=o.name,c=!0;const u=w(a,l);if(u){let f,m;const h=o.type?_e(u._f):p(t),y=t.type===x.BLUR||t.type===x.FOCUS_OUT,v=!$e(u._f)&&!n.resolver&&!w(s.errors,l)&&!u._f.deps||ke(y,w(s.touchedFields,l),s.isSubmitted,R,j),b=W(l,d,y);q(i,l,h),y?(u._f.onBlur&&u._f.onBlur(t),r&&r(0)):u._f.onChange&&u._f.onChange(t);const _=M(l,h,y,!1),$=!O(_)||b;if(!y&&k.values.next({name:l,type:t.type,values:{...i}}),v)return S.isValid&&C(),$&&k.state.next({name:l,...b?{}:_});if(!y&&b&&k.state.next({...s}),F(!0),n.resolver){const{errors:e}=await T([l]),t=Se(s.errors,a,l),r=Se(e,a,t.name||l);f=r.error,l=r.name,m=O(e)}else f=(await ie(u,i,E,n.shouldUseNativeValidation))[l],c=isNaN(h)||h===w(i,l,h),c&&(f?m=!1:S.isValid&&(m=await V(a,!0)));c&&(u._f.deps&&te(u._f.deps),((t,n,a,o)=>{const i=w(s.errors,t),l=S.isValid&&K(n)&&s.isValid!==n;var c;if(e.delayError&&a?(c=()=>((e,t)=>{q(s.errors,e,t),k.state.next({errors:s.errors})})(t,a),r=e=>{clearTimeout(g),g=setTimeout(c,e)},r(e.delayError)):(clearTimeout(g),r=null,a?q(s.errors,t,a):le(s.errors,t)),(a?!fe(i,a):i)||!O(o)||l){const e={...o,...l&&K(n)?{isValid:n}:{},errors:s.errors,name:t};s={...s,...e},k.state.next(e)}F(!1)})(l,m,f,_))}},te=async(e,t={})=>{let r,o;const i=D(e);if(F(!0),n.resolver){const t=await(async e=>{const{errors:t}=await T();if(e)for(const r of e){const e=w(t,r);e?q(s.errors,r,e):le(s.errors,r)}else s.errors=t;return t})(_(e)?e:i);r=O(t),o=e?!i.some((e=>w(t,e))):r}else e?(o=(await Promise.all(i.map((async e=>{const t=w(a,e);return await V(t&&t._f?{[e]:t}:t)})))).every(Boolean),(o||s.isValid)&&C()):o=r=await V(a);return k.state.next({...!I(e)||S.isValid&&r!==s.isValid?{}:{name:e},...n.resolver||!e?{isValid:r}:{},errors:s.errors,isValidating:!1}),t.shouldFocus&&!o&&U(a,(e=>e&&w(s.errors,e)),e?i:d.mount),o},re=e=>{const t={...o,...l.mount?i:{}};return _(e)?t:I(e)?w(t,e):e.map((e=>w(t,e)))},ne=(e,t)=>({invalid:!!w((t||s).errors,e),isDirty:!!w((t||s).dirtyFields,e),isTouched:!!w((t||s).touchedFields,e),error:w((t||s).errors,e)}),se=(e,t,r)=>{const n=(w(a,e,{_f:{}})._f||{}).ref;q(s.errors,e,{...t,ref:n}),k.state.next({name:e,errors:s.errors,isValid:!1}),r&&r.shouldFocus&&n&&n.focus&&n.focus()},ae=(e,t={})=>{for(const r of e?D(e):d.mount)d.mount.delete(r),d.array.delete(r),t.keepValue||(le(a,r),le(i,r)),!t.keepError&&le(s.errors,r),!t.keepDirty&&le(s.dirtyFields,r),!t.keepTouched&&le(s.touchedFields,r),!n.shouldUnregister&&!t.keepDefaultValue&&le(o,r);k.values.next({values:{...i}}),k.state.next({...s,...t.keepDirty?{isDirty:L()}:{}}),!t.keepIsValid&&C()},oe=(e,t={})=>{let r=w(a,e);const s=K(t.disabled);return q(a,e,{...r||{},_f:{...r&&r._f?r._f:{ref:{name:e}},name:e,mount:!0,...t}}),d.mount.add(e),r?s&&q(i,e,t.disabled?void 0:w(i,e,_e(r._f))):P(e,!0,t.value),{...s?{disabled:t.disabled}:{},...n.progressive?{required:!!t.required,min:xe(t.min),max:xe(t.max),minLength:xe(t.minLength),maxLength:xe(t.maxLength),pattern:xe(t.pattern)}:{},name:e,onChange:ee,onBlur:ee,ref:s=>{if(s){oe(e,t),r=w(a,e);const n=_(s.value)&&s.querySelectorAll&&s.querySelectorAll("input,select,textarea")[0]||s,i=me(n),l=r._f.refs||[];if(i?l.find((e=>e===n)):n===r._f.ref)return;q(a,e,{_f:{...r._f,...i?{refs:[...l.filter(pe),n,...Array.isArray(w(o,e))?[{}]:[]],ref:{type:n.type,name:e}}:{ref:n}}}),P(e,!1,void 0,n)}else r=w(a,e,{}),r._f&&(r._f.mount=!1),(n.shouldUnregister||t.shouldUnregister)&&(!h(d.array,e)||!l.action)&&d.unMount.add(e)}}},he=()=>n.shouldFocusError&&U(a,(e=>e&&w(s.errors,e)),d.mount),ge=(e,t)=>async r=>{r&&(r.preventDefault&&r.preventDefault(),r.persist&&r.persist());let o=v(i);if(k.state.next({isSubmitting:!0}),n.resolver){const{errors:e,values:t}=await T();s.errors=e,o=t}else await V(a);le(s.errors,"root"),O(s.errors)?(k.state.next({errors:{}}),await e(o,r)):(t&&await t({...s.errors},r),he(),setTimeout(he)),k.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:O(s.errors),submitCount:s.submitCount+1,errors:s.errors})},ye=(r,n={})=>{const c=r||o,u=v(c),f=r&&!O(r)?u:o;if(n.keepDefaultValues||(o=c),!n.keepValues){if(n.keepDirtyValues||A)for(const e of d.mount)w(s.dirtyFields,e)?q(f,e,w(i,e)):X(e,w(f,e));else{if(y&&_(r))for(const e of d.mount){const t=w(a,e);if(t&&t._f){const e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(Y(e)){const t=e.closest("form");if(t){t.reset();break}}}}a={}}i=e.shouldUnregister?n.keepDefaultValues?v(o):{}:v(f),k.array.next({values:{...f}}),k.values.next({values:{...f}})}d={mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},!l.mount&&t(),l.mount=!S.isValid||!!n.keepIsValid,l.watch=!!e.shouldUnregister,k.state.next({submitCount:n.keepSubmitCount?s.submitCount:0,isDirty:n.keepDirty?s.isDirty:!(!n.keepDefaultValues||fe(r,o)),isSubmitted:!!n.keepIsSubmitted&&s.isSubmitted,dirtyFields:n.keepDirtyValues?s.dirtyFields:n.keepDefaultValues&&r?ve(o,r):{},touchedFields:n.keepTouched?s.touchedFields:{},errors:n.keepErrors?s.errors:{},isSubmitting:!1,isSubmitSuccessful:!1})},Re=(e,t)=>ye(Z(e)?e(i):e,t);return{control:{register:oe,unregister:ae,getFieldState:ne,handleSubmit:ge,setError:se,_executeSchema:T,_getWatch:z,_getDirty:L,_updateValid:C,_removeUnmounted:()=>{for(const e of d.unMount){const t=w(a,e);t&&(t._f.refs?t._f.refs.every((e=>!pe(e))):!pe(t._f.ref))&&ae(e)}d.unMount=new Set},_updateFieldArray:(e,t=[],r,n,c=!0,u=!0)=>{if(n&&r){if(l.action=!0,u&&Array.isArray(w(a,e))){const t=r(w(a,e),n.argA,n.argB);c&&q(a,e,t)}if(u&&Array.isArray(w(s.errors,e))){const t=r(w(s.errors,e),n.argA,n.argB);c&&q(s.errors,e,t),Ae(s.errors,e)}if(S.touchedFields&&u&&Array.isArray(w(s.touchedFields,e))){const t=r(w(s.touchedFields,e),n.argA,n.argB);c&&q(s.touchedFields,e,t)}S.dirtyFields&&(s.dirtyFields=ve(o,i)),k.state.next({name:e,isDirty:L(e,t),dirtyFields:s.dirtyFields,errors:s.errors,isValid:s.isValid})}else q(i,e,t)},_getFieldArray:t=>b(w(l.mount?i:o,t,e.shouldUnregister?w(o,t,[]):[])),_reset:ye,_resetDefaultValues:()=>Z(n.defaultValues)&&n.defaultValues().then((e=>{Re(e,n.resetOptions),k.state.next({isLoading:!1})})),_updateFormState:e=>{s={...s,...e}},_subjects:k,_proxyFormState:S,get _fields(){return a},get _formValues(){return i},get _state(){return l},set _state(e){l=e},get _defaultValues(){return o},get _names(){return d},set _names(e){d=e},get _formState(){return s},set _formState(e){s=e},get _options(){return n},set _options(e){n={...n,...e}}},trigger:te,register:oe,handleSubmit:ge,watch:(e,t)=>Z(e)?k.values.subscribe({next:r=>e(z(void 0,t),r)}):z(e,t,!0),setValue:X,getValues:re,reset:Re,resetField:(e,t={})=>{w(a,e)&&(_(t.defaultValue)?X(e,w(o,e)):(X(e,t.defaultValue),q(o,e,t.defaultValue)),t.keepTouched||le(s.touchedFields,e),t.keepDirty||(le(s.dirtyFields,e),s.isDirty=t.defaultValue?L(e,w(o,e)):L()),t.keepError||(le(s.errors,e),S.isValid&&C()),k.state.next({...s}))},clearErrors:e=>{e&&D(e).forEach((e=>le(s.errors,e))),k.state.next({errors:e?s.errors:{}})},unregister:ae,setError:se,setFocus:(e,t={})=>{const r=w(a,e),n=r&&r._f;if(n){const e=n.refs?n.refs[0]:n.ref;e.focus&&(e.focus(),t.shouldSelect&&e.select())}},getFieldState:ne}}function Ee(e={}){const t=l.useRef(),r=l.useRef(),[n,s]=l.useState({isDirty:!1,isValidating:!1,isLoading:Z(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},errors:{},defaultValues:Z(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...Re(e,(()=>s((e=>({...e}))))),formState:n});const a=t.current.control;return a._options=e,P({subject:a._subjects.state,next:e=>{C(e,a._proxyFormState,a._updateFormState,!0)&&s({...a._formState})}}),l.useEffect((()=>{e.values&&!fe(e.values,r.current)?(a._reset(e.values,a._options.resetOptions),r.current=e.values):a._resetDefaultValues()}),[e.values,a]),l.useEffect((()=>{a._state.mount||(a._updateValid(),a._state.mount=!0),a._state.watch&&(a._state.watch=!1,a._subjects.state.next({...a._formState})),a._removeUnmounted()})),t.current.formState=E(n,a),t.current}var Oe=function(e,t,r){if(e&&"reportValidity"in e){var n=w(r,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},Ce=function(e,t){var r=function(r){var n=t.fields[r];n&&n.ref&&"reportValidity"in n.ref?Oe(n.ref,r,e):n.refs&&n.refs.forEach((function(t){return Oe(t,r,e)}))};for(var n in t.fields)r(n)},De=function(e,t){t.shouldUseNativeValidation&&Ce(e,t);var r={};for(var n in e){var s=w(t.fields,n);q(r,n,Object.assign(e[n],{ref:s&&s.ref}))}return r},Fe=function(e,t,r){return void 0===t&&(t={abortEarly:!1}),void 0===r&&(r={}),function(n,s,a){try{var o=function(){return l.error?{values:{},errors:De((e=l.error,t=!a.shouldUseNativeValidation&&"all"===a.criteriaMode,e.details.length?e.details.reduce((function(e,r){var n=r.path.join(".");if(e[n]||(e[n]={message:r.message,type:r.type}),t){var s=e[n].types,a=s&&s[r.type];e[n]=z(n,t,e,r.type,a?[].concat(a,r.message):r.message)}return e}),{}):{}),a)}:(a.shouldUseNativeValidation&&Ce({},a),{errors:{},values:l.value});var e,t},i=Object.assign({},t,{context:s}),l={},c=function(){if("sync"===r.mode)l=e.validate(n,i);else{var t=function(t,r){try{var s=Promise.resolve(e.validateAsync(n,i)).then((function(e){l.value=e}))}catch(t){return r(t)}return s&&s.then?s.then(void 0,r):s}((function(){return Promise.resolve(e.validateAsync(n,i)).then((function(e){l.value=e}))}),(function(e){l.error=e}));if(t&&t.then)return t.then((function(){}))}}();return Promise.resolve(c&&c.then?c.then(o):o())}catch(e){return Promise.reject(e)}}};function Pe(){return window.givewpDonationFormExports}const Me="update_default_values";function Ie(e,t){return t.type===Me?{...e,defaultValues:{...e.values,...t.values}}:e}const Ne=(0,l.createContext)(null);Ne.displayName="DonationFormState";const Te=(0,l.createContext)(null);Te.displayName="DonationFormStateDispatch";const Ve=({initialState:t,children:r})=>{const[n,s]=(0,l.useReducer)(Ie,t);return(0,e.createElement)(Ne.Provider,{value:n},(0,e.createElement)(Te.Provider,{value:s},r))},Le=()=>(0,l.useContext)(Ne),qe=()=>(0,l.useContext)(Te),ze=window.givewp.form.templates,Ue=ze.layouts.wrapper;function Be(t,r="div",n){const{nodeType:s,type:a}=function(e){let t=null,r=null;return Object.entries(ze).forEach((n=>{if("object"==typeof n[1]){const s=n[0],a=Object.keys(n[1]).find((t=>n[1][t]===e));a&&(r=a,t=s)}})),{nodeType:t,type:r}}(t);return o=>(0,e.createElement)(Ue,{nodeType:s,type:a,htmlTag:r,name:n},(0,e.createElement)(t,{...o}))}function We(e,t="div",r){return(0,l.useMemo)((()=>Be(e,t,r)),[e])}const He=window.givewp.form.templates,Ke=He.layouts.fieldLabel,Ge=He.layouts.fieldError;function Ze(t,r,n){const s=function(e,t){return e.hasOwnProperty(t)?e[t].message:null}(n,t.name);return{...t,inputProps:r(t.name,(a=t.validationRules,["required","maxLength","minLength"].reduce(((e,t)=>(a.hasOwnProperty(t)&&(e[t]=a[t]),e)),{}))),fieldError:s,Label:()=>(0,e.createElement)(Ke,{label:t.label,required:t.validationRules.required}),ErrorMessage:()=>(0,e.createElement)(Ge,{error:s,name:t.name})};var a}function Ye(t){return(0,e.memo)(t,Je)}function Je(e,t){return e.node.name===t.node.name}const Qe=window.givewp.form.templates;var Xe=Ye((function({node:t}){const{register:r}=window.givewp.form.hooks.useFormContext(),{errors:n}=window.givewp.form.hooks.useFormState(),s="hidden"!==t.type?We(Qe.fields[t.type],"div",t.name):Qe.fields[t.type],a=Ze(t,r,n);return(0,e.createElement)(s,{key:t.name,...a})}));const et=window.givewp.form.templates;var tt=Ye((function({node:t}){const r=We(et.elements[t.type],"div",t.name);return(0,e.createElement)(r,{key:t.name,...t})}));const rt=window.givewp.form.templates;var nt=Ye((function({node:t}){const r=We(rt.groups[t.type],"div",t.name),n=t.reduceNodes(((t,r)=>(t[r.name]=t=>(0,e.createElement)(ft,{node:{...r,...t}}),t)),{}),s=t.reduceNodes(((e,t)=>(e[t.name]=t,e)),{});return(0,e.createElement)(r,{key:t.name,nodeComponents:n,nodeProps:s,...t})}));const st=Be(window.givewp.form.templates.fields.gateways);var at=Ye((function({node:t}){const{register:r}=window.givewp.form.hooks.useFormContext(),{errors:n}=window.givewp.form.hooks.useFormState(),s=Ze(t,r,n),{gateways:a}=Le();return(0,e.createElement)(st,{key:t.name,...s,gateways:a})})),ot={"=":(e,t)=>e==t,"!=":(e,t)=>e!=t,">":(e,t)=>e>t,">=":(e,t)=>e>=t,"<":(e,t)=>e<t,"<=":(e,t)=>e<=t,contains:(e,t)=>String(e).includes(t),not_contains:(e,t)=>!String(e).includes(t)};function it(e){const t=(0,l.useMemo)((()=>e.length?[...e.reduce(ct,new Set).values()]:[]),[e]),r=T({name:t}),n=(0,l.useMemo)((()=>t.reduce(((e,t,n)=>(e.set(t,r[n]),e)),new Map)),[t,r]);return(0,l.useMemo)((()=>!e.length||lt(e,n)),[n])}function lt(e,t){return!e.length||e.reduce((function e(r,n){if("basic"===n.type){const e=t.get(n.field),s=ot[n.comparisonOperator](e,n.value);return"and"===n.logicalOperator?(null==r||r)&&s:null!=r&&r||s}return"and"===n.boolean?(null==r||r)&&n.conditions.reduce(e,null):null!=r&&r||n.conditions.reduce(e,null)}),null)}function ct(e,t){return"basic"===t.type?e.add(t.field):t.conditions.reduce(ct,e)}const ut=window.givewp.form.templates;var ft=Ye((function({node:r}){const s=it(r.visibilityConditions),{unregister:a}=window.givewp.form.hooks.useFormContext();return(0,e.useEffect)((()=>{s||(t(r)&&a(r.name,{keepDefaultValue:!0}),n(r)&&r.walkNodes((e=>{a(e.name,{keepDefaultValue:!0})}),t))}),[s,a]),s?t(r)&&(l=r,ze.fields.hasOwnProperty(l.type))?"gateways"===r.type?(0,e.createElement)(at,{node:r}):(0,e.createElement)(Xe,{node:r}):function(e){return"element"===e.nodeType}(r)&&(i=r,ze.elements.hasOwnProperty(i.type))?(0,e.createElement)(tt,{node:r}):n(r)&&(o=r,ze.groups.hasOwnProperty(o.type))?(0,e.createElement)(nt,{node:r}):(console.error(`Node: ${JSON.stringify(r)} does not exist in Form Design: ${JSON.stringify(ut)}`),null):null;var o,i,l})),dt=r(5800),mt=window.wp.i18n;function pt({error:t,resetErrorBoundary:r}){const{useFormState:n,useFormContext:s}=window.givewp.form.hooks,{errors:a}=n(),{getValues:o}=s();return console.info({donationFormErrors:a,donationFormValues:o()}),(0,e.createElement)("div",{role:"alert"},(0,e.createElement)("p",null,(0,mt.__)("An error occurred in the form. Please notify the site administrator. The error message is:","give")),(0,e.createElement)("pre",{style:{padding:"0.5rem"}},t.message),(0,e.createElement)("button",{type:"button",onClick:r},(0,mt.__)("Reload form","give")))}function ht({children:t}){return(0,e.createElement)(dt.ErrorBoundary,{FallbackComponent:pt,onReset:()=>{window.location.reload()}},t)}const gt=Be(window.givewp.form.templates.layouts.section,"section");function yt({section:r}){const n=it(r.visibilityConditions),{unregister:s}=window.givewp.form.hooks.useFormContext();return(0,e.useEffect)((()=>{n||r.walkNodes((e=>{s(e.name)}),t)}),[n]),n?(0,e.createElement)(gt,{section:r},r.nodes.map((t=>(0,e.createElement)(ht,{key:t.name},(0,e.createElement)(ft,{node:t}))))):null}var vt=(e,t,r)=>{Object.entries(t).forEach((([t,n])=>{Object.keys(e).includes(t)?r(t,{message:Array.isArray(n)?n[0]:n}):r("FORM_ERROR","gateway_error"===t?{message:Array.isArray(n)?n[0]:n}:{message:(0,mt.__)("Something went wrong, please try again or contact support.","give")})}))};class bt extends Error{constructor(e,...t){super(...t),Error.captureStackTrace&&Error.captureStackTrace(this,bt),this.name="FormRequestError",this.errors=e}}var _t=bt;async function wt(e,t){const r=new URL(e);var n,s;(n=new URLSearchParams(r.search),s=t,n.has("givewp-route")&&s.includes(n.get("givewp-route")))?window.location.assign(r):window.top.location.assign(r)}async function xt(e,t){return{response:await fetch(e,{method:"POST",mode:"cors",cache:"default",credentials:"same-origin",redirect:"follow",referrerPolicy:"no-referrer-when-downgrade",headers:{accept:"application/json"},body:t})}}function $t(e){const t=new FormData;for(const r in e){const n=e[r];if(null===n||"object"!=typeof n||n instanceof File)t.append(r,n);else for(const e in n)t.append(`${r}[${e}]`,n[e])}return t}async function St(e,t,r,n,o){if("subscription"===e?.donationType&&!r.supportsSubscriptions)return t("FORM_ERROR",{message:(0,mt.__)("This payment gateway does not support recurring payments, please try selecting another payment gateway.","give")});try{const{originUrl:t,isEmbed:i,embedId:l}=function(){const e=window.top.location.href,t=null!==window.frameElement;return{originUrl:e,isEmbed:t,embedId:t?window.frameElement.hasAttribute("data-givewp-embed-id")?window.frameElement.getAttribute("data-givewp-embed-id"):window.frameElement.id:null}}(),c=$t({...e,originUrl:t,isEmbed:i,embedId:l});let u={};if(r.beforeCreatePayment){u=await r.beforeCreatePayment(e);for(const e in u)c.append(`gatewayData[${e}]`,u[e])}const{response:f}=await xt(n,c);(function(e){return!0===e.redirected})(f)&&await wt(f.url,o);const d=await f.json();if(function(e){return"redirect"===e.type}(d)&&await wt(d.data.redirectUrl,o),a(d)||s(d))throw new _t(d.data.errors.errors);r.afterCreatePayment&&await r.afterCreatePayment(d)}catch(r){var i;return r instanceof _t?vt(e,r.errors,t):t("FORM_ERROR",{message:null!==(i=r?.message)&&void 0!==i?i:(0,mt.__)("Something went wrong, please try again or contact support.","give")})}}var kt=Symbol.for("immer-nothing"),At=Symbol.for("immer-draftable"),jt=Symbol.for("immer-state");function Rt(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Et=Object.getPrototypeOf;function Ot(e){return!!e&&!!e[jt]}function Ct(e){return!!e&&(Ft(e)||Array.isArray(e)||!!e[At]||!!e.constructor?.[At]||Tt(e)||Vt(e))}var Dt=Object.prototype.constructor.toString();function Ft(e){if(!e||"object"!=typeof e)return!1;const t=Et(e);if(null===t)return!0;const r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return r===Object||"function"==typeof r&&Function.toString.call(r)===Dt}function Pt(e,t){0===Mt(e)?Object.entries(e).forEach((([r,n])=>{t(r,n,e)})):e.forEach(((r,n)=>t(n,r,e)))}function Mt(e){const t=e[jt];return t?t.type_:Array.isArray(e)?1:Tt(e)?2:Vt(e)?3:0}function It(e,t){return 2===Mt(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Nt(e,t,r){const n=Mt(e);2===n?e.set(t,r):3===n?e.add(r):e[t]=r}function Tt(e){return e instanceof Map}function Vt(e){return e instanceof Set}function Lt(e){return e.copy_||e.base_}function qt(e,t){if(Tt(e))return new Map(e);if(Vt(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&Ft(e)){if(!Et(e)){const t=Object.create(null);return Object.assign(t,e)}return{...e}}const r=Object.getOwnPropertyDescriptors(e);delete r[jt];let n=Reflect.ownKeys(r);for(let t=0;t<n.length;t++){const s=n[t],a=r[s];!1===a.writable&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(r[s]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[s]})}return Object.create(Et(e),r)}function zt(e,t=!1){return Bt(e)||Ot(e)||!Ct(e)||(Mt(e)>1&&(e.set=e.add=e.clear=e.delete=Ut),Object.freeze(e),t&&Pt(e,((e,t)=>zt(t,!0)))),e}function Ut(){Rt(2)}function Bt(e){return Object.isFrozen(e)}var Wt,Ht={};function Kt(e){const t=Ht[e];return t||Rt(0),t}function Gt(){return Wt}function Zt(e,t){t&&(Kt("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Yt(e){Jt(e),e.drafts_.forEach(Xt),e.drafts_=null}function Jt(e){e===Wt&&(Wt=e.parent_)}function Qt(e){return Wt={drafts_:[],parent_:Wt,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Xt(e){const t=e[jt];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function er(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];return void 0!==e&&e!==r?(r[jt].modified_&&(Yt(t),Rt(4)),Ct(e)&&(e=tr(t,e),t.parent_||nr(t,e)),t.patches_&&Kt("Patches").generateReplacementPatches_(r[jt].base_,e,t.patches_,t.inversePatches_)):e=tr(t,r,[]),Yt(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==kt?e:void 0}function tr(e,t,r){if(Bt(t))return t;const n=t[jt];if(!n)return Pt(t,((s,a)=>rr(e,n,t,s,a,r))),t;if(n.scope_!==e)return t;if(!n.modified_)return nr(e,n.base_,!0),n.base_;if(!n.finalized_){n.finalized_=!0,n.scope_.unfinalizedDrafts_--;const t=n.copy_;let s=t,a=!1;3===n.type_&&(s=new Set(t),t.clear(),a=!0),Pt(s,((s,o)=>rr(e,n,t,s,o,r,a))),nr(e,t,!1),r&&e.patches_&&Kt("Patches").generatePatches_(n,r,e.patches_,e.inversePatches_)}return n.copy_}function rr(e,t,r,n,s,a,o){if(Ot(s)){const o=tr(e,s,a&&t&&3!==t.type_&&!It(t.assigned_,n)?a.concat(n):void 0);if(Nt(r,n,o),!Ot(o))return;e.canAutoFreeze_=!1}else o&&r.add(s);if(Ct(s)&&!Bt(s)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;tr(e,s),t&&t.scope_.parent_||nr(e,s)}}function nr(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&zt(t,r)}var sr={get(e,t){if(t===jt)return e;const r=Lt(e);if(!It(r,t))return function(e,t,r){const n=ir(t,r);return n?"value"in n?n.value:n.get?.call(e.draft_):void 0}(e,r,t);const n=r[t];return e.finalized_||!Ct(n)?n:n===or(e.base_,t)?(cr(e),e.copy_[t]=ur(n,e)):n},has(e,t){return t in Lt(e)},ownKeys(e){return Reflect.ownKeys(Lt(e))},set(e,t,r){const n=ir(Lt(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){const n=or(Lt(e),t),o=n?.[jt];if(o&&o.base_===r)return e.copy_[t]=r,e.assigned_[t]=!1,!0;if(((s=r)===(a=n)?0!==s||1/s==1/a:s!=s&&a!=a)&&(void 0!==r||It(e.base_,t)))return!0;cr(e),lr(e)}var s,a;return e.copy_[t]===r&&(void 0!==r||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_[t]=!0),!0},deleteProperty(e,t){return void 0!==or(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,cr(e),lr(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const r=Lt(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:n.enumerable,value:r[t]}:n},defineProperty(){Rt(11)},getPrototypeOf(e){return Et(e.base_)},setPrototypeOf(){Rt(12)}},ar={};function or(e,t){const r=e[jt];return(r?Lt(r):e)[t]}function ir(e,t){if(!(t in e))return;let r=Et(e);for(;r;){const e=Object.getOwnPropertyDescriptor(r,t);if(e)return e;r=Et(r)}}function lr(e){e.modified_||(e.modified_=!0,e.parent_&&lr(e.parent_))}function cr(e){e.copy_||(e.copy_=qt(e.base_,e.scope_.immer_.useStrictShallowCopy_))}function ur(e,t){const r=Tt(e)?Kt("MapSet").proxyMap_(e,t):Vt(e)?Kt("MapSet").proxySet_(e,t):function(e,t){const r=Array.isArray(e),n={type_:r?1:0,scope_:t?t.scope_:Gt(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let s=n,a=sr;r&&(s=[n],a=ar);const{revoke:o,proxy:i}=Proxy.revocable(s,a);return n.draft_=i,n.revoke_=o,i}(e,t);return(t?t.scope_:Gt()).drafts_.push(r),r}function fr(e){if(!Ct(e)||Bt(e))return e;const t=e[jt];let r;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=qt(e,t.scope_.immer_.useStrictShallowCopy_)}else r=qt(e,!0);return Pt(r,((e,t)=>{Nt(r,e,fr(t))})),t&&(t.finalized_=!1),r}Pt(sr,((e,t)=>{ar[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),ar.deleteProperty=function(e,t){return ar.set.call(this,e,t,void 0)},ar.set=function(e,t,r){return sr.set.call(this,e[0],t,r,e[0])};var dr=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(e,t,r)=>{if("function"==typeof e&&"function"!=typeof t){const r=t;t=e;const n=this;return function(e=r,...s){return n.produce(e,(e=>t.call(this,e,...s)))}}let n;if("function"!=typeof t&&Rt(6),void 0!==r&&"function"!=typeof r&&Rt(7),Ct(e)){const s=Qt(this),a=ur(e,void 0);let o=!0;try{n=t(a),o=!1}finally{o?Yt(s):Jt(s)}return Zt(s,r),er(n,s)}if(!e||"object"!=typeof e){if(n=t(e),void 0===n&&(n=e),n===kt&&(n=void 0),this.autoFreeze_&&zt(n,!0),r){const t=[],s=[];Kt("Patches").generateReplacementPatches_(e,n,t,s),r(t,s)}return n}Rt(1)},this.produceWithPatches=(e,t)=>{if("function"==typeof e)return(t,...r)=>this.produceWithPatches(t,(t=>e(t,...r)));let r,n;return[this.produce(e,t,((e,t)=>{r=e,n=t})),r,n]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){var t;Ct(e)||Rt(8),Ot(e)&&(Ot(t=e)||Rt(10),e=fr(t));const r=Qt(this),n=ur(e,void 0);return n[jt].isManual_=!0,Jt(r),n}finishDraft(e,t){const r=e&&e[jt];r&&r.isManual_||Rt(9);const{scope_:n}=r;return Zt(n,t),er(void 0,n)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){const n=t[r];if(0===n.path.length&&"replace"===n.op){e=n.value;break}}r>-1&&(t=t.slice(r+1));const n=Kt("Patches").applyPatches_;return Ot(e)?n(e,t):this.produce(e,(e=>n(e,t)))}},mr=dr.produce;dr.produceWithPatches.bind(dr),dr.setAutoFreeze.bind(dr),dr.setUseStrictShallowCopy.bind(dr),dr.applyPatches.bind(dr),dr.createDraft.bind(dr),dr.finishDraft.bind(dr);const pr="add_item",hr="remove_item",gr="add_amount_to_total",yr="remove_amount_from_total";function vr(e,t){switch(t.type){case pr:e.items[t.item.id]=t.item;break;case hr:delete e.items[t.itemId];break;case gr:e.totals[t.itemId]=t.amount;break;case yr:delete e.totals[t.itemId]}}const br=(0,l.createContext)(null);br.displayName="DonationSummaryProvider";const _r=(0,l.createContext)(null);_r.displayName="DonationSummaryDispatch";const wr=({initialState:t={items:{},totals:{}},children:r})=>{const[n,s]=(a=vr,o=t,i=(0,l.useMemo)((function(){return mr(a)}),[a]),(0,l.useReducer)(i,o,void 0));var a,o,i;return(0,e.createElement)(br.Provider,{value:n},(0,e.createElement)(_r.Provider,{value:s},r))},{donateUrl:xr,inlineRedirectRoutes:$r}=Pe(),Sr=Be(window.givewp.form.templates.layouts.form);function kr({defaultValues:t,sections:r,validationSchema:n}){const{gateways:s}=Le(),a=(0,l.useCallback)((e=>s.find((({id:t})=>t===e))),[]),o=Ee({defaultValues:t,resolver:Fe(n),reValidateMode:"onBlur"}),{handleSubmit:i,setError:c,control:u}=o,{errors:f,isSubmitting:d,isSubmitSuccessful:m}=M({control:u}),p=f.hasOwnProperty("FORM_ERROR")?f.FORM_ERROR.message:null;return(0,e.createElement)(R,{...o},(0,e.createElement)(ht,null,(0,e.createElement)(wr,null,(0,e.createElement)(Sr,{formProps:{id:"give-next-gen",onSubmit:i((e=>St(e,c,a(e.gatewayId),xr,$r)))},isSubmitting:d||m,formError:p},(0,e.createElement)(e.Fragment,null,r.map((t=>(0,e.createElement)(ht,{key:t.name},(0,e.createElement)(yt,{key:t.name,section:t})))))))))}function Ar(e,t){!function(e,t,r){o(e.nodes,t,r)}(this,e,t)}function jr(e,t){return function(e,t,r){return function(e,t,r){let n=[];return o(e,(e=>{n.push(t(e))}),r),n}(e.nodes,t,r)}(this,e,t)}function Rr(e,t,r){return function(e,t,r,n){return i(e.nodes,t,r,n)}(this,e,t,r)}var Er=r(2705),Or=r.n(Er);const Cr=(0,mt.sprintf)(/* translators: base error message */
(0,mt.__)("This is a required field","give`"),"{#label}");function Dr(e,t){return new Intl.NumberFormat(navigator.language,{style:"currency",currency:e,...t})}const{form:Fr}=Pe(),Pr=window.givewp.form.templates,Mr=Be(Pr.layouts.header),Ir=Be(Pr.layouts.headerTitle),Nr=Be(Pr.layouts.headerDescription),Tr=Be(Pr.layouts.goal),Vr=e=>Dr(Fr.currency,{maximumFractionDigits:0}).format(e);function Lr(){return(0,e.createElement)(ht,null,(0,e.createElement)(Mr,{Title:()=>Fr.settings?.showHeading&&(0,e.createElement)(Ir,{text:Fr.settings.heading}),Description:()=>Fr.settings?.showDescription&&(0,e.createElement)(Nr,{text:Fr.settings.description}),Goal:()=>Fr.goal?.show&&(0,e.createElement)(Tr,{currency:Fr.currency,type:Fr.goal.type,goalLabel:Fr.goal.label,progressPercentage:Fr.goal.progressPercentage,currentAmount:Fr.goal.currentAmount,currentAmountFormatted:Fr.goal.typeIsMoney?Vr(Fr.goal.currentAmount):Fr.goal.currentAmount.toString(),targetAmount:Fr.goal.targetAmount,targetAmountFormatted:Fr.goal.typeIsMoney?Vr(Fr.goal.targetAmount):Fr.goal.targetAmount.toString(),totalRevenue:Fr.stats.totalRevenue,totalRevenueFormatted:Vr(Fr.stats.totalRevenue),totalCountValue:Fr.stats.totalCountValue,totalCountLabel:Fr.stats.totalCountLabel})}))}const qr=(0,l.createContext)(null);qr.displayName="DonationFormSettings";const zr=({value:t,children:r})=>(0,e.createElement)(qr.Provider,{value:t},r),Ur=()=>(0,l.useContext)(qr),Br="set_current_step",Wr="set_next_step";function Hr(e,t){switch(t.type){case Br:return{...e,currentStep:t.step};case Wr:const r=e.steps.map((e=>{const r=!e.visibilityConditions.length||lt(e.visibilityConditions,new Map(Object.entries(t.formValues)));return{...e,isVisible:r}}));return{...e,steps:r,currentStep:r.findIndex(((t,r)=>t.isVisible&&r>e.currentStep))};default:return e}}function Kr(e){return{type:Br,step:e}}const Gr=(0,l.createContext)(null);Gr.displayName="DonationFormMultiStepState";const Zr=(0,l.createContext)(null);Zr.displayName="DonationFormMultiStepStateDispatch";const Yr=({initialState:t,children:r})=>{const[n,s]=(0,l.useReducer)(Hr,t);return(0,e.createElement)(Gr.Provider,{value:n},(0,e.createElement)(Zr.Provider,{value:s},r))},Jr=()=>(0,l.useContext)(Gr),Qr=()=>(0,l.useContext)(Zr);function Xr({isSubmitting:t,submittingText:r=(0,mt.__)("Submitting…","give")}){const{donateButtonCaption:n}=window.givewp.form.hooks.useDonationFormSettings();return(0,e.createElement)("button",{type:"submit",disabled:t,"aria-busy":t},t?r:n)}function en(){const{gateways:e}=Le();return(0,l.useCallback)((t=>e?.find((({id:e})=>e===t))),[e])}const{validateUrl:tn}=Pe();function rn({buttonText:t=(0,mt.__)("Continue")}){const{steps:r,currentStep:n}=Jr(),o=en(),i=(0,l.useMemo)((()=>{var e;return null!==(e=r.find((({id:e})=>e===n))?.fields)&&void 0!==e?e:[]}),[r,n]),{trigger:c,getValues:u,setError:f}=j(),d=function(){const e=qe(),t=Qr();return(0,l.useCallback)(((r,n)=>{e({type:Me,values:n}),t(function(e){return{type:Wr,formValues:e}}(n))}),[e,t])}(),m=n===r.length-1,[p,h]=(0,l.useState)(!1);return!m&&(0,e.createElement)("button",{className:"givewp-donation-form__steps-button-next",type:"button",disabled:p,"aria-busy":p,onClick:async()=>{if(h(!0),!await c(i))return void h(!1);const e=u(),t=await async function(e,t,r,n){if(void 0!==n&&"subscription"===t?.donationType&&!n.supportsSubscriptions)return r("FORM_ERROR",{message:(0,mt.__)("This payment gateway does not support recurring payments, please try selecting another payment gateway.","give")});try{const r=$t(t),{response:n}=await xt(e,r),o=await n.json();if(a(o)||s(o))throw new _t(o.data.errors.errors);return!0}catch(e){var o;return e instanceof _t?vt(t,e.errors,r):r("FORM_ERROR",{message:null!==(o=e?.message)&&void 0!==o?o:(0,mt.__)("Something went wrong, please try again or contact support.","give")})}}(tn,e,f,o(e?.gatewayId));h(!1),t&&d(n,e)}},t)}const{donateUrl:nn,inlineRedirectRoutes:sn}=Pe(),an=Be(window.givewp.form.templates.layouts.multiStepForm);function on({currentStep:t,isFirstStep:r,isLastStep:n,children:s}){const{defaultValues:a,validationSchema:o}=Le(),{multiStepNextButtonText:i,multiStepFirstButtonText:l}=Ur(),c=en(),u=Ee({defaultValues:a,resolver:Fe(o),reValidateMode:"onBlur"}),{handleSubmit:f,setError:d,control:m,getValues:p,trigger:h}=u,{errors:g,isSubmitting:y,isSubmitSuccessful:v}=M({control:m}),b=g.hasOwnProperty("FORM_ERROR")?g.FORM_ERROR.message:null;return(0,e.createElement)(R,{...u},(0,e.createElement)(ht,null,(0,e.createElement)(an,{formProps:{className:"givewp-layouts-multiStepForm__form",onSubmit:f((e=>St(e,d,c(e.gatewayId),nn,sn)))},isSubmitting:y||v,formError:b,previousButton:null,nextButton:!n&&(0,e.createElement)(rn,{buttonText:r?l:i}),submitButton:n&&(0,e.createElement)(Xr,{isSubmitting:y||v})},s)))}var ln=r(4184),cn=r.n(ln);function un({children:t}){const{currentStep:r}=Jr(),n=function(){const e=Qr();return(0,l.useCallback)((t=>{const r=t-1;e(Kr(r<=0?0:r))}),[e])}();return r>0&&(0,e.createElement)("button",{className:"givewp-donation-form__steps-header-previous-button",type:"button",onClick:()=>n(r)},t)}function fn(){const t=function(){const{steps:e,currentStep:t}=Jr();return function(e,t){return e?.find((({id:e})=>e===t))}(e,t)}();return t.id>0&&(0,e.createElement)("p",{className:"givewp-donation-form__steps-header-title-text"},t.title)}function dn({children:t}){const{steps:r,showHeader:n,currentStep:s}=Jr(),a=!n||s>0,o=n?r.length:r.length-1;return(0,e.createElement)("div",{className:"givewp-donation-form__steps"},(0,e.createElement)("div",{className:"givewp-donation-form__steps-header"},(0,e.createElement)("div",{className:"givewp-donation-form__steps-header-previous"},(0,e.createElement)(un,null,(0,mt.__)("Previous","give"))),(0,e.createElement)("div",{className:"givewp-donation-form__steps-header-title"},(0,e.createElement)(fn,null))),a&&(0,e.createElement)("progress",{className:"givewp-donation-form__steps-progress",value:s,max:o}),(0,e.createElement)("div",{className:"givewp-donation-form__steps-body"},t),(0,e.createElement)("div",{className:"givewp-donation-form__steps-footer"},(0,e.createElement)("div",{className:"givewp-donation-form__steps-footer-secure"},(0,e.createElement)("i",{className:"fas fa-lock givewp-donation-form__steps-footer-secure-icon"}),(0,e.createElement)("small",{className:"givewp-donation-form__steps-footer-secure-icon"},(0,mt.__)("Secure Donation","give")))))}function mn({steps:t}){const{currentStep:r}=Jr(),n=function(t){const r=(0,e.useRef)();return(0,e.useEffect)((()=>{r.current=t}),[t]),r.current}(r),s=t?.map((({id:t,element:s})=>{const a=r>=t,o=0===t,i=t===r,l=r>n,c=r<n,u=cn()("givewp-donation-form__step",{"givewp-donation-form__step--start":o,"givewp-donation-form__step--visible":i,"givewp-donation-form__step--hidden":!i,"givewp-donation-form__step--ascending":i&&l,"givewp-donation-form__step--descending":i&&c});return(0,e.createElement)("div",{key:t,id:`givewp-donation-form-step-${t}`,className:u},a&&s)}));return(0,e.createElement)(dn,null,s)}function pn(){const t=Qr(),{multiStepFirstButtonText:r}=Ur();return(0,e.createElement)("div",null,(0,e.createElement)(Lr,null),(0,e.createElement)("button",{type:"button",className:"givewp-donation-form__steps-button-next",onClick:()=>{t(Kr(1))}},null!=r?r:(0,mt.__)("Donate","give")))}const hn=Be(window.givewp.form.templates.layouts.section,"section"),gn=(r,n)=>{const s=n?r.length+1:r.length;return r.map(((r,a)=>{const o=n?a+1:a,i=0===o,l=o===s-1,c=function(e){return e.reduceNodes(((e,t)=>e.concat(t.name)),[],t)}(r),u=r?.label,f=r?.description;return{id:o,title:u,description:f,element:(0,e.createElement)(on,{key:o,currentStep:o,isFirstStep:i,isLastStep:l},(0,e.createElement)(ht,{key:r.name},(0,e.createElement)(hn,{key:r.name,section:r,hideLabel:!0},r.nodes.map((t=>(0,e.createElement)(ht,{key:t.name},(0,e.createElement)(ft,{key:t.name,node:t}))))))),fields:c,visibilityConditions:r.visibilityConditions,isVisible:!r.visibilityConditions.length}}))};function yn({sections:t,showHeader:r}){const n=gn(t,r);return r&&n.unshift({id:0,title:null,description:null,element:(0,e.createElement)(pn,null),fields:[],visibilityConditions:[],isVisible:!0}),(0,e.createElement)(Yr,{initialState:{steps:n,currentStep:0,showHeader:r}},(0,e.createElement)(wr,null,(0,e.createElement)(mn,{steps:n})))}const vn=Be(window.givewp.form.templates.layouts.goalAchieved),{form:bn}=Pe();var wn;(wn=bn).walkNodes=Ar.bind(wn),wn.mapNodes=jr.bind(wn),wn.reduceNodes=Rr.bind(wn),wn.walkNodes((e=>{e.walkNodes=Ar.bind(e),e.mapNodes=jr.bind(e),e.reduceNodes=Rr.bind(e)}),n),window.givewp.form.hooks={useFormContext:j,useWatch:T,useFormState:M,useCurrencyFormatter:function(e,t){return(0,l.useMemo)((()=>Dr(e,t)),[e,navigator.language])},useDonationSummary:function(){const{items:t,totals:r}=(0,l.useContext)(br),n=(0,l.useContext)(_r);return{items:t,totals:r,addItem:(0,e.useCallback)((e=>n(function(e){return{type:pr,item:e}}(e))),[n]),removeItem:(0,e.useCallback)((e=>n(function(e){return{type:hr,itemId:e}}(e))),[n]),addToTotal:(0,e.useCallback)(((e,t)=>n(function(e,t){return{type:gr,itemId:e,amount:t}}(e,t))),[n]),removeFromTotal:(0,e.useCallback)((e=>n(function(e){return{type:yr,itemId:e}}(e))),[n])}},useDonationFormSettings:Ur};const xn=i(bn.nodes,((e,t)=>{const r=t.defaultValue;return null!==r&&""!==r&&(e[t.name]=r),e}),{},t),$n=function(e){const r=e.reduceNodes(((e,t)=>(e[t.name]=function(e){let t=function(e){let t;return 0===Object.keys(e).length?Or().any():(e.hasOwnProperty("numeric")||e.hasOwnProperty("integer")?(t=Or().number(),e.hasOwnProperty("integer")&&(t=t.integer())):e.hasOwnProperty("boolean")?t=Or().boolean():e.hasOwnProperty("array")?t=Or().array():e.hasOwnProperty("file")?t=Or().object():e.hasOwnProperty("dateTime")?t=Or().date():(t=Or().string(),e.hasOwnProperty("email")&&(t=t.email({tlds:!1})),e.hasOwnProperty("alpha")&&(t=t.alpha()),e.hasOwnProperty("alphanum")&&(t=t.alphanum())),!e.hasOwnProperty("number")&&e.hasOwnProperty("boolean")||(e.hasOwnProperty("min")&&(t=t.min(e.min)),e.hasOwnProperty("max")&&(t=t.max(e.max))),t=e.required?e.hasOwnProperty("excludeUnless")?t.custom(((t,r)=>{const n=r.state.ancestors[0],s=e.excludeUnless.every((e=>ot[e.comparisonOperator](n[e.field],e.value)));return!s||""!==t&&null!==t?s?t:void 0:r.error("required")}),"exclude unless validation"):t.required():t.optional().allow("",null),t=function(e,t){return e.hasOwnProperty("donationType")&&(t=Or().allow("single","subscription").only().required()),e.hasOwnProperty("subscriptionPeriod")&&(t=Or().when("donationType",{is:"subscription",then:Or().allow("day","week","quarter","month","year").only().required(),otherwise:Or().optional()})),e.hasOwnProperty("subscriptionFrequency")&&(t=Or().when("donationType",{is:"subscription",then:Or().number().integer().required(),otherwise:Or().optional()})),e.hasOwnProperty("subscriptionInstallments")&&(t=Or().when("donationType",{is:"subscription",then:Or().number().integer().required(),otherwise:Or().optional()})),t}(e,t),t)}(e.validationRules);return e.label&&(t=t.label(e.label)),t}(t),e)),{},t);return Or().object(r).messages({"string.base":Cr,"string.empty":Cr,"any.required":Cr,"number.base":Cr,"object.base":Cr})}(bn),Sn={defaultValues:xn,gateways:window.givewp.gateways.getAll(),validationSchema:$n},kn={...bn.settings,...function(e){const{nodes:t,...r}=e;return r}(bn)};function An(){return bn.goal.isAchieved?(0,e.createElement)(ht,null,(0,e.createElement)(vn,{goalAchievedMessage:bn.settings.goalAchievedMessage})):bn.design?.isMultiStep?(0,e.createElement)(zr,{value:kn},(0,e.createElement)(Ve,{initialState:Sn},(0,e.createElement)(yn,{sections:bn.nodes,showHeader:bn.settings?.showHeader}))):(0,e.createElement)(zr,{value:kn},(0,e.createElement)(Ve,{initialState:Sn},bn.settings?.showHeader&&(0,e.createElement)(Lr,null),(0,e.createElement)(kr,{defaultValues:xn,sections:bn.nodes,validationSchema:$n})))}const jn=document.getElementById("root-givewp-donation-form");e.createRoot?(0,e.createRoot)(jn).render((0,e.createElement)(An,null)):(0,e.render)((0,e.createElement)(An,null),jn)}()}();