@vizzly/services 0.12.8 → 0.12.9-dev-5e9b41f0b1e1775b297c82e5c8b4be20ff647784

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/dist/index.js +1 -1
  2. package/dist/results-driver/src/driver/VizzlyQuery/AreaChart/toQueries.d.ts +1 -1
  3. package/dist/results-driver/src/driver/VizzlyQuery/BarChart/toQueries.d.ts +1 -1
  4. package/dist/results-driver/src/driver/VizzlyQuery/BasicTable/toQueries.d.ts +1 -1
  5. package/dist/results-driver/src/driver/VizzlyQuery/HorizontalBarChart/toQueries.d.ts +1 -1
  6. package/dist/results-driver/src/driver/VizzlyQuery/LineChart/toQueries.d.ts +1 -1
  7. package/dist/results-driver/src/driver/VizzlyQuery/PieChart/toQueries.d.ts +1 -1
  8. package/dist/results-driver/src/driver/VizzlyQuery/PivotTable/toQueries.d.ts +1 -1
  9. package/dist/services/src/VizzlyLoader.d.ts +1 -1
  10. package/dist/services/src/index.d.ts +11 -8
  11. package/dist/shared-logic/src/AdditionalFilter/AdditionalFilter.d.ts +1 -1
  12. package/dist/shared-logic/src/Component/Component.d.ts +1 -1
  13. package/dist/shared-logic/src/Component/sharedSchemas.d.ts +1 -3
  14. package/dist/shared-logic/src/Component/types.d.ts +12 -5
  15. package/dist/shared-logic/src/Component/upcast.d.ts +1 -1
  16. package/dist/shared-logic/src/{Table → ConditionalFormatting}/attributesSchema.d.ts +1 -0
  17. package/dist/shared-logic/src/CustomField/CustomField.d.ts +0 -1
  18. package/dist/shared-logic/src/{CustomComponent → CustomView}/index.d.ts +2 -2
  19. package/dist/shared-logic/src/CustomView/types.d.ts +33 -0
  20. package/dist/shared-logic/src/Field/Field.d.ts +6 -0
  21. package/dist/shared-logic/src/Query/Query.d.ts +5 -1
  22. package/dist/shared-logic/src/QueryEngineConfig/types.d.ts +2 -12
  23. package/dist/shared-logic/src/getComponentInterface.d.ts +1 -1
  24. package/dist/shared-logic/src/utils/generateId.d.ts +1 -0
  25. package/dist/shared-logic/src/utils/stringHelper.d.ts +1 -0
  26. package/package.json +2 -2
  27. package/dist/shared-logic/src/CustomComponent/types.d.ts +0 -27
  28. /package/dist/shared-logic/src/{CustomComponent → CustomView}/attributesSchema.d.ts +0 -0
  29. /package/dist/shared-logic/src/{CustomComponent → CustomView}/constants.d.ts +0 -0
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see index.js.LICENSE.txt */
2
- var e={4579:e=>{var t;self,t=()=>(()=>{var e={514:(e,t,r)=>{const{clone:n}=r(8870),i=r(8160),o={annotations:Symbol("annotations")};t.error=function(e){if(!this._original||"object"!=typeof this._original)return this.details[0].message;const t=e?"":"",r=e?"":"",a=e?"":"",s=n(this._original);for(let e=this.details.length-1;e>=0;--e){const t=e+1,r=this.details[e],n=r.path;let a=s;for(let e=0;;++e){const s=n[e];if(i.isSchema(a)&&(a=a.clone()),!(e+1<n.length&&"string"!=typeof a[s])){const e=a[o.annotations]||{errors:{},missing:{}};a[o.annotations]=e;const n=s||r.context.key;void 0!==a[s]?(e.errors[n]=e.errors[n]||[],e.errors[n].push(t)):e.missing[n]=t;break}a=a[s]}}let l=o.safeStringify(s,2).replace(/_\$key\$_([, \d]+)_\$end\$_"/g,((e,r)=>`" ${t}[${r}]${a}`)).replace(/"_\$miss\$_([^|]+)\|(\d+)_\$end\$_": "__missing__"/g,((e,n,i)=>`${r}"${n}"${a}${t} [${i}]: -- missing --${a}`)).replace(/\s*"_\$idx\$_([, \d]+)_\$end\$_",?\n(.*)/g,((e,r,n)=>`\n${n} ${t}[${r}]${a}`)).replace(/"\[(NaN|Symbol.*|-?Infinity|function.*|\(.*)]"/g,((e,t)=>t));l=`${l}\n${t}`;for(let e=0;e<this.details.length;++e)l=`${l}\n[${e+1}] ${this.details[e].message}`;return l+=a,l},o.safeStringify=function(e,t){return JSON.stringify(e,o.serializer(),t)},o.serializer=function(){const e=[],t=[],r=(r,n)=>t[0]===n?"[Circular ~]":"[Circular ~."+e.slice(0,t.indexOf(n)).join(".")+"]";return function(n,i){if(t.length>0){const o=t.indexOf(this);~o?(t.length=o+1,e.length=o+1,e[o]=n):(t.push(this),e.push(n)),~t.indexOf(i)&&(i=r.call(this,n,i))}else t.push(i);if(i){const e=i[o.annotations];if(e){if(Array.isArray(i)){const t=[];for(let r=0;r<i.length;++r)e.errors[r]&&t.push(`_$idx$_${e.errors[r].sort().join(", ")}_$end$_`),t.push(i[r]);i=t}else{for(const t in e.errors)i[`${t}_$key$_${e.errors[t].sort().join(", ")}_$end$_`]=i[t],i[t]=void 0;for(const t in e.missing)i[`_$miss$_${t}|${e.missing[t]}_$end$_`]="__missing__"}return i}}return i===1/0||i===-1/0||Number.isNaN(i)||"function"==typeof i||"symbol"==typeof i?"["+i.toString()+"]":i}}},7629:(e,t,r)=>{const{assert:n,clone:i,deepEqual:o,merge:a}=r(8870),s=r(8652),l=r(8160),u=r(3292),c=r(6354),d=r(8901),p=r(1123),f=r(6914),h=r(2294),m=r(6133),g=r(2305),y=r(8863),b=r(2036),v={Base:class{constructor(e){this.type=e,this.$_root=null,this._definition={},this._reset()}_reset(){this._ids=new h.Ids,this._preferences=null,this._refs=new m.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 p.describe,"Manifest functionality disabled"),p.describe(this)}allow(...e){return l.verifyFlat(e,"allow"),this._values(e,"_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 i=e[r];n("function"==typeof i,"Alteration adjuster for",r,"must be a function"),t.$_terms.alterations.push({target:r,adjuster:i})}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,t={}){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(...e){return this._values(e,"_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(...e){n(e.length,"Missing notes");for(const t of e)n(t&&"string"==typeof t,"Notes must be non-empty strings");return this._inner("notes",e)}only(e=!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(e=!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(e=!0){return this.$_setFlag("result",e?"strip":void 0)}tag(...e){n(e.length,"Missing tags");for(const t of e)n(t&&"string"==typeof t,"Tags must be non-empty strings");return this._inner("tags",e)}unit(e){return n(e&&"string"==typeof e,"Unit name must be a non-empty string"),this.$_setFlag("unit",e)}valid(...e){l.verifyFlat(e,"valid");const t=this.allow(...e);return t.$_setFlag("only",!!t._valids,{clone:!1}),t}when(e,t){const r=this.clone();r.$_terms.whens||(r.$_terms.whens=[]);const i=u.when(r,e,t);if(!["any","link"].includes(r.type)){const e=i.is?[i]:i.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(i),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||s.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,m.toSibling),t._preferences=t._preferences?l.preferences(t._preferences,e._preferences):e._preferences,t._valids=b.merge(t._valids,e._valids,e._invalids),t._invalids=b.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,a(t._flags,r)}else if(e._flags.empty){t._flags.empty=e._flags.empty;const r=Object.assign({},e._flags);delete r.empty,a(t._flags,r)}else a(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"),d.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 o=this.clone();for(let a=r;a<o._rules.length;++a){const r=o._rules[a],s=i(r);for(const i in e)t.modifiers[i](s,e[i]),n(s.name===r.name,"Cannot change rule name");o._rules[a]=s,o._singleRules.get(s.name)===r&&o._singleRules.set(s.name,s)}return o.$_temp.ruleset=!1,o.$_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:i}of this.$_terms.alterations)e.includes(r)&&(t=i(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],i=t.args;n(r,"Unknown rule",t.method);const o=this.clone();if(i){n(1===Object.keys(i).length||Object.keys(i).length===this._definition.rules[t.name].args.length,"Invalid rule definition for",this.type,t.name);for(const e in i){let a=i[e];if(r.argsByName){const s=r.argsByName.get(e);if(s.ref&&l.isResolvable(a))t._resolve.push(e),o.$_mutateRegister(a);else if(s.normalize&&(a=s.normalize(a),i[e]=a),s.assert){const t=l.validateArg(a,e,s);n(!t,t,"or reference")}}void 0!==a?i[e]=a:delete i[e]}}return r.multi||(o._ruleRemove(t.name,{clone:!1}),o._singleRules.set(t.name,t)),!1===o.$_temp.ruleset&&(o.$_temp.ruleset=null),r.priority?o._rules.unshift(t):o._rules.push(t),o}$_compile(e,t){return u.schema(this.$_root,e,t)}$_createError(e,t,r,n,i,o={}){const a=!1!==o.flags?this._flags:{},s=o.messages?f.merge(this._definition.messages,o.messages):this._definition.messages;return new c.Report(e,t,r,a,s,n,i)}$_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 i=!y.validate(e,this,t,r,n).errors;return t.restore(),i}$_modify(e){return l.assertOptions(e,["each","once","ref","schema"]),h.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,{source:t,name:r,path:n,key:i})=>{const o=this._definition[t][r]&&this._definition[t][r].register;!1!==o&&this.$_mutateRegister(e,{family:o,key:i})}}),this._definition.rebuild&&this._definition.rebuild(this),this.$_temp.ruleset=!1,this}$_mutateRegister(e,{family:t,key:r}={}){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,r={}){n("_"===e[0]||!this._inRuleset(),"Cannot set flag inside a ruleset");const i=this._definition.flags[e]||{};if(o(t,i.default)&&(t=void 0),o(t,this._flags[e]))return this;const a=!1!==r.clone?this.clone():this;return void 0!==t?(a._flags[e]=t,a.$_mutateRegister(t)):delete a._flags[e],"_"!==e[0]&&(a.$_temp.ruleset=!1),a}$_parent(e,...t){return this[e][l.symbols.parent].call(this,...t)}$_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=i(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,r={}){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=[],i=[];for(let o=0;o<this.$_terms.whens.length;++o){const a=this.$_terms.whens[o];if(a.concat){n.push(a.concat),i.push(`${o}.concat`);continue}const s=a.ref?a.ref.resolve(e,t,r):e,l=a.is?[a]:a.switch,u=i.length;for(let u=0;u<l.length;++u){const{is:c,then:d,otherwise:p}=l[u],f=`${o}${a.switch?"."+u:""}`;if(c.$_match(s,t.nest(c,`${f}.is`),r)){if(d){const o=t.localize([...t.path,`${f}.then`],t.ancestors,t.schemas),{schema:a,id:s}=d._generate(e,o,r);n.push(a),i.push(`${f}.then${s?`(${s})`:""}`);break}}else if(p){const o=t.localize([...t.path,`${f}.otherwise`],t.ancestors,t.schemas),{schema:a,id:s}=p._generate(e,o,r);n.push(a),i.push(`${f}.otherwise${s?`(${s})`:""}`);break}}if(a.break&&i.length>u)break}const o=i.join(", ");if(t.mainstay.tracer.debug(t,"rule","when",o),!o)return{schema:this};if(!t.mainstay.tracer.active&&this.$_temp.whens[o])return{schema:this.$_temp.whens[o],id:o};let a=this;this._definition.generate&&(a=this._definition.generate(this,e,t,r));for(const e of n)a=a.concat(e);return this.$_root._tracer&&this.$_root._tracer._combine(a,[this,...n]),this.$_temp.whens[o]=a,{schema:a,id:o}}_inner(e,t,r={}){n(!this._inRuleset(),`Cannot set ${e} inside a ruleset`);const i=this.clone();return i.$_terms[e]&&!r.override||(i.$_terms[e]=[]),r.single?i.$_terms[e].push(t):i.$_terms[e].push(...t),i.$_temp.ruleset=!1,i}_inRuleset(){return null!==this.$_temp.ruleset&&!1!==this.$_temp.ruleset}_ruleRemove(e,t={}){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 i=r._rules[t];i.name!==e||i.keep?n.push(i):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(),i=e[0]===l.symbols.override;if(i&&(e=e.slice(1)),!r[t]&&e.length?r[t]=new b:i&&(r[t]=e.length?new b:null,r.$_mutateRebuild()),!r[t])return r;i&&r[t].override();for(const i of e){n(void 0!==i,"Cannot call allow/valid/invalid with undefined"),n(i!==l.symbols.override,"Override must be the first value");const e="_invalids"===t?"_valids":"_invalids";r[e]&&(r[e].remove(i),r[e].length||(n("_valids"===t||!r._flags.only,"Setting invalid value",i,"leaves schema rejecting all values due to previous valid rule"),r[e]=null)),r[t].add(i,r._refs)}return r}}};v.Base.prototype[l.symbols.any]={version:l.version,compile:u.compile,root:"$_root"},v.Base.prototype.isImmutable=!0,v.Base.prototype.deny=v.Base.prototype.invalid,v.Base.prototype.disallow=v.Base.prototype.invalid,v.Base.prototype.equal=v.Base.prototype.valid,v.Base.prototype.exist=v.Base.prototype.required,v.Base.prototype.not=v.Base.prototype.invalid,v.Base.prototype.options=v.Base.prototype.prefs,v.Base.prototype.preferences=v.Base.prototype.prefs,e.exports=new v.Base},8652:(e,t,r)=>{const{assert:n,clone:i}=r(8870),o=r(8160),a={max:1e3,supported:new Set(["undefined","boolean","number","string"])};t.provider={provision:e=>new a.Cache(e)},a.Cache=class{constructor(e={}){o.assertOptions(e,["max"]),n(void 0===e.max||e.max&&e.max>0&&isFinite(e.max),"Invalid max cache size"),this._max=e.max||a.max,this._map=new Map,this._list=new a.List}get length(){return this._map.size}set(e,t){if(null!==e&&!a.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),i(t.value)}_compact(){if(this._map.size>this._max){const e=this._list.pop();this._map.delete(e.key)}}},a.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)=>{const{assert:n,AssertError:i}=r(8870),o=r(5934);let a,s;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=o.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,r="Options"){n(e&&"object"==typeof e&&!Array.isArray(e),"Options must be of type object");const i=Object.keys(e).filter((e=>!t.includes(e)));n(0===i.length,`${r} contain unknown keys: ${i}`)},t.checkPreferences=function(e){s=s||r(3378);const t=s.preferences.validate(e);if(t.error)throw new i([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,r={}){const i=e&&e[t.symbols.any];return!!i&&(n(r.legacy||i.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){a=a||r(6914),e=e||{},n=n||{};const i=Object.assign({},e,n);return n.errors&&e.errors&&(i.errors=Object.assign({},e.errors,n.errors),i.errors.wrap=Object.assign({},e.errors.wrap,n.errors.wrap)),n.messages&&(i.messages=a.compile(n.messages,e.messages)),delete i[t.symbols.prefs],i},t.tryWithPath=function(e,t,r={}){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,{assert:n,message:i}){if(t.isSchema(n)){const t=n.validate(e);if(!t.error)return;return t.error.message}if(!n(e))return r?`${r} ${i}`:i},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)=>{const{assert:n}=r(8870),i=r(8160),o=r(6133),a={};t.schema=function(e,t,r={}){i.assertOptions(r,["appendPath","override"]);try{return a.schema(e,t,r)}catch(e){throw r.appendPath&&void 0!==e.path&&(e.message=`${e.message} (${e.path})`),e}},a.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 o=(t,...n)=>!1!==r.override?t.valid(e.override,...n):t.valid(...n);if(a.simple(t))return o(e,t);if("function"==typeof t)return e.custom(t);if(n("object"==typeof t,"Invalid schema content:",typeof t),i.isResolvable(t))return o(e,t);if(i.isSchema(t))return t;if(Array.isArray(t)){for(const r of t)if(!a.simple(r))return e.alternatives().try(...t);return o(e,...t)}return t instanceof RegExp?e.string().regex(t):t instanceof Date?o(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 o.isRef(e)?e:o.create(e,t)},t.compile=function(e,r,o={}){i.assertOptions(o,["legacy"]);const s=r&&r[i.symbols.any];if(s)return n(o.legacy||s.version===i.version,"Cannot mix different versions of joi schemas:",s.version,i.version),r;if("object"!=typeof r||!o.legacy)return t.schema(e,r,{appendPath:!0});const l=a.walk(r);return l?l.compile(l.root,r):t.schema(e,r,{appendPath:!0})},a.walk=function(e){if("object"!=typeof e)return null;if(Array.isArray(e)){for(const t of e){const e=a.walk(t);if(e)return e}return null}const t=e[i.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=a.walk(e[t]);if(r)return r}return null},a.simple=function(e){return null===e||["boolean","string","number"].includes(typeof e)},t.when=function(e,r,s){if(void 0===s&&(n(r&&"object"==typeof r,"Missing options"),s=r,r=o.create(".")),Array.isArray(s)&&(s={switch:s}),i.assertOptions(s,["is","not","then","otherwise","switch","break"]),i.isSchema(r))return n(void 0===s.is,'"is" can not be used with a schema condition'),n(void 0===s.not,'"not" can not be used with a schema condition'),n(void 0===s.switch,'"switch" can not be used with a schema condition'),a.condition(e,{is:r,then:s.then,otherwise:s.otherwise,break:s.break});if(n(o.isRef(r)||"string"==typeof r,"Invalid condition:",r),n(void 0===s.not||void 0===s.is,'Cannot combine "is" with "not"'),void 0===s.switch){let l=s;void 0!==s.not&&(l={is:s.not,then:s.otherwise,otherwise:s.then,break:s.break});let u=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===s.is||o.isRef(s.is)||i.isSchema(s.is)||(u=u.required()),a.condition(e,{ref:t.ref(r),is:u,then:l.then,otherwise:l.otherwise,break:l.break})}n(Array.isArray(s.switch),'"switch" must be an array'),n(void 0===s.is,'Cannot combine "switch" with "is"'),n(void 0===s.not,'Cannot combine "switch" with "not"'),n(void 0===s.then,'Cannot combine "switch" with "then"');const l={ref:t.ref(r),switch:[],break:s.break};for(let t=0;t<s.switch.length;++t){const r=s.switch[t],a=t===s.switch.length-1;i.assertOptions(r,a?["is","then","otherwise"]:["is","then"]),n(void 0!==r.is,'Switch statement missing "is"'),n(void 0!==r.then,'Switch statement missing "then"');const u={is:e.$_compile(r.is),then:e.$_compile(r.then)};if(o.isRef(r.is)||i.isSchema(r.is)||(u.is=u.is.required()),a){n(void 0===s.otherwise||void 0===r.otherwise,'Cannot specify "otherwise" inside and outside a "switch"');const t=void 0!==s.otherwise?s.otherwise:r.otherwise;void 0!==t&&(n(void 0===l.break,"Cannot specify both otherwise and break"),u.otherwise=e.$_compile(t))}l.switch.push(u)}return l},a.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)=>{const n=r(514),i=r(8160),o=r(3328);t.Report=class{constructor(e,r,n,i,o,a,s){if(this.code=e,this.flags=i,this.messages=o,this.path=a.path,this.prefs=s,this.state=a,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,a){if(!t)return;if(o.isTemplate(t))return"root"!==r?t:null;let s=a.errors.language;if(i.isResolvable(s)&&(s=s.resolve(e,n,a)),s&&t[s]){if(void 0!==t[s][r])return t[s][r];if(void 0!==t[s]["*"])return t[s]["*"]}return t[r]?t[r]:t["*"]},t.label=function(e,r,n,i){if(e.label)return e.label;if(!n.errors.label)return"";let o=r.path;return"key"===n.errors.label&&r.path.length>1&&(o=r.path.slice(-1)),t.path(o)||t.template(null,n.messages,"root",r,n)||i&&t.template(null,i,"root",r,n)||"value"},t.process=function(e,r,n){if(!e)return null;const{override:i,message:o,details:a}=t.details(e);if(i)return i;if(n.errors.stack)return new t.ValidationError(o,a,r);const s=Error.stackTraceLimit;Error.stackTraceLimit=0;const l=new t.ValidationError(o,a,r);return Error.stackTraceLimit=s,l},t.details=function(e,t={}){let r=[];const n=[];for(const i of e){if(i instanceof Error){if(!1!==t.override)return{override:i};const e=i.toString();r.push(e),n.push({message:e,type:"override",context:{error:i}});continue}const e=i.toString();r.push(e),n.push({message:e,path:i.path.filter((e=>"object"!=typeof e)),type:i.code,context:i.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)=>{const{assert:n,clone:i}=r(8870),o=r(8160),a=r(6914),s={};t.type=function(e,t){const r=Object.getPrototypeOf(e),l=i(r),u=e._assign(Object.create(l)),c=Object.assign({},t);delete c.base,l._definition=c;const d=r._definition||{};c.messages=a.merge(d.messages,c.messages),c.properties=Object.assign({},d.properties,c.properties),u.type=c.type,c.flags=Object.assign({},d.flags,c.flags);const p=Object.assign({},d.terms);if(c.terms)for(const e in c.terms){const t=c.terms[e];n(void 0===u.$_terms[e],"Invalid term override for",c.type,e),u.$_terms[e]=t.init,p[e]=t}c.terms=p,c.args||(c.args=d.args),c.prepare=s.prepare(c.prepare,d.prepare),c.coerce&&("function"==typeof c.coerce&&(c.coerce={method:c.coerce}),c.coerce.from&&!Array.isArray(c.coerce.from)&&(c.coerce={method:c.coerce.method,from:[].concat(c.coerce.from)})),c.coerce=s.coerce(c.coerce,d.coerce),c.validate=s.validate(c.validate,d.validate);const f=Object.assign({},d.rules);if(c.rules)for(const e in c.rules){const t=c.rules[e];n("object"==typeof t,"Invalid rule definition for",c.type,e);let r=t.method;if(void 0===r&&(r=function(){return this.$_addRule(e)}),r&&(n(!l[e],"Rule conflict in",c.type,e),l[e]=r),n(!f[e],"Rule conflict in",c.type,e),f[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),o.isSchema(e.assert)&&(e.assert=e.assert.strict().label(e.name)),t.argsByName.set(e.name,e),e))))}c.rules=f;const h=Object.assign({},d.modifiers);if(c.modifiers)for(const e in c.modifiers){n(!l[e],"Rule conflict in",c.type,e);const t=c.modifiers[e];n("function"==typeof t,"Invalid modifier definition for",c.type,e);const r=function(t){return this.rule({[e]:t})};l[e]=r,h[e]=t}if(c.modifiers=h,c.overrides){l._super=r,u.$_super={};for(const e in c.overrides)n(r[e],"Cannot override missing",e),c.overrides[e][o.symbols.parent]=r[e],u.$_super[e]=r[e].bind(u);Object.assign(l,c.overrides)}c.cast=Object.assign({},d.cast,c.cast);const m=Object.assign({},d.manifest,c.manifest);return m.build=s.build(c.manifest&&c.manifest.build,d.manifest&&d.manifest.build),c.manifest=m,c.rebuild=s.rebuild(c.rebuild,d.rebuild),u},s.build=function(e,t){return e&&t?function(r,n){return t(e(r,n),n)}:e||t},s.coerce=function(e,t){return e&&t?{from:e.from&&t.from?[...new Set([...e.from,...t.from])]:null,method(r,n){let i;if((!t.from||t.from.includes(typeof r))&&(i=t.method(r,n),i)){if(i.errors||void 0===i.value)return i;r=i.value}if(!e.from||e.from.includes(typeof r)){const t=e.method(r,n);if(t)return t}return i}}:e||t},s.prepare=function(e,t){return e&&t?function(r,n){const i=e(r,n);if(i){if(i.errors||void 0===i.value)return i;r=i.value}return t(r,n)||i}:e||t},s.rebuild=function(e,t){return e&&t?function(r){t(r),e(r)}:e||t},s.validate=function(e,t){return e&&t?function(r,n){const i=t(r,n);if(i){if(i.errors&&(!Array.isArray(i.errors)||i.errors.length))return i;r=i.value}return e(r,n)||i}:e||t}},5107:(e,t,r)=>{const{assert:n,clone:i}=r(8870),o=r(8652),a=r(8160),s=r(3292),l=r(6354),u=r(8901),c=r(1123),d=r(6133),p=r(3328),f=r(2305);let h;const m={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(m.types))};for(const t of e._types)e[t]=function(...e){return n(!e.length||["alternatives","link","object"].includes(t),"The",t,"type does not allow arguments"),m.generate(this,m.types[t],e)};for(const t of["allow","custom","disallow","equal","exist","forbidden","invalid","not","only","optional","options","prefs","preferences","required","strip","valid","when"])e[t]=function(...e){return this.any()[t](...e)};Object.assign(e,m.methods);for(const t in m.aliases){const r=m.aliases[t];e[t]=e[r]}return e.x=e.expression,f.setup&&f.setup(e),e}};m.methods={ValidationError:l.ValidationError,version:a.version,cache:o.provider,assert(e,t,...r){m.assert(e,t,!0,r)},attempt:(e,t,...r)=>m.assert(e,t,!1,r),build(e){return n("function"==typeof c.build,"Manifest functionality disabled"),c.build(this,e)},checkPreferences(e){a.checkPreferences(e)},compile(e,t){return s.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 i=e(t[r]());n(a.isSchema(i),"modifier must return a valid schema object"),t[r]=function(...e){return m.generate(this,i,e)}}return t},expression:(...e)=>new p(...e),extend(...e){a.verifyFlat(e,"extend"),h=h||r(3378),n(e.length,"You need to provide at least one extension"),this.assert(e,h.extensions);const t=Object.assign({},this);t._types=new Set(t._types);for(let r of e){"function"==typeof r&&(r=r(t)),this.assert(r,h.extension);const e=m.expandExtension(r,t);for(const r of e){n(void 0===t[r.type]||t._types.has(r.type),"Cannot override name",r.type);const e=r.base||this.any(),i=u.type(e,r);t._types.add(r.type),t[r.type]=function(...e){return m.generate(this,i,e)}}}return t},isError:l.ValidationError.isError,isExpression:p.isTemplate,isRef:d.isRef,isSchema:a.isSchema,in:(...e)=>d.in(...e),override:a.symbols.override,ref:(...e)=>d.create(...e),types(){const e={};for(const t of this._types)e[t]=this[t]();for(const t in m.aliases)e[t]=this[t]();return e}},m.assert=function(e,t,r,n){const o=n[0]instanceof Error||"string"==typeof n[0]?n[0]:null,s=null!==o?n[1]:n[0],u=t.validate(e,a.preferences({errors:{stack:!0}},s||{}));let c=u.error;if(!c)return u.value;if(o instanceof Error)throw o;const d=r&&"function"==typeof c.annotate?c.annotate():c.message;throw c instanceof l.ValidationError==0&&(c=i(c)),c.message=o?`${o} ${d}`:d,c},m.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},m.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 i=Object.assign({},e);i.type=n,i.base=t[n](),r.push(i)}return r},e.exports=m.root()},1123:(e,t,r)=>{const{assert:n,clone:i}=r(8870),o=r(8160),a=r(6914),s=r(6133),l=r(3328);let u;const c={};t.describe=function(e){const t=e._definition,r={type:e.type,flags:{},rules:[]};for(const t in e._flags)"_"!==t[0]&&(r.flags[t]=c.describe(e._flags[t]));Object.keys(r.flags).length||delete r.flags,e._preferences&&(r.preferences=i(e._preferences,{shallow:["messages"]}),delete r.preferences[o.symbols.prefs],r.preferences.messages&&(r.preferences.messages=a.decompile(r.preferences.messages))),e._valids&&(r.allow=e._valids.describe()),e._invalids&&(r.invalid=e._invalids.describe());for(const n of e._rules){if(!1===t.rules[n.name].manifest)continue;const e={name:n.name};for(const r in t.modifiers)void 0!==n[r]&&(e[r]=c.describe(n[r]));if(n.args){e.args={};for(const t in n.args){const r=n.args[t];("options"!==t||Object.keys(r).length)&&(e.args[t]=c.describe(r,{assign:t}))}Object.keys(e.args).length||delete e.args}r.rules.push(e)}r.rules.length||delete r.rules;for(const i in e.$_terms){if("_"===i[0])continue;n(!r[i],"Cannot describe schema due to internal name conflict with",i);const a=e.$_terms[i];if(!a)continue;if(a instanceof Map){a.size&&(r[i]=[...a.entries()]);continue}if(o.isValues(a)){r[i]=a.describe();continue}n(t.terms[i],"Term",i,"missing configuration");const s=t.terms[i].manifest,l="object"==typeof s;if(!a.length&&!l)continue;const u=[];for(const e of a)u.push(c.describe(e));if(l){const{from:e,to:t}=s.mapped;r[i]={};for(const n of u)r[i][n[t]]=n[e]}else"single"!==s?r[i]=u:(n(1===u.length,"Term",i,"contains more than one item"),r[i]=u[0])}return c.validate(e.$_root,r),r},c.describe=function(e,t={}){if(Array.isArray(e))return e.map(c.describe);if(e===o.symbols.deepDefault)return{special:"deep"};if("object"!=typeof e||null===e)return e;if("options"===t.assign)return i(e);if(e instanceof Date)return e.toISOString();if(e instanceof Error)return e;if(e instanceof RegExp)return"regex"===t.assign?e.toString():{regex:e.toString()};if(e[o.symbols.literal])return{function:e.literal};if("function"==typeof e.describe)return"ref"===t.assign?e.describe().ref:e.describe();const r={};for(const t in e){const n=e[t];void 0!==n&&(r[t]=c.describe(n,{assign:t}))}return r},t.build=function(e,t){return new c.Builder(e).parse(t)},c.Builder=class{constructor(e){this.joi=e}parse(e){c.validate(this.joi,e);let t=this.joi[e.type]()._bare();const r=t._definition;if(e.flags)for(const i in e.flags){const o=r.flags[i]&&r.flags[i].setter||i;n("function"==typeof t[o],"Invalid flag",i,"for type",e.type),t=t[o](this.build(e.flags[i]))}if(e.preferences&&(t=t.preferences(this.build(e.preferences))),e.allow&&(t=t.allow(...this.build(e.allow))),e.invalid&&(t=t.invalid(...this.build(e.invalid))),e.rules)for(const i of e.rules){n("function"==typeof t[i.name],"Invalid rule",i.name,"for type",e.type);const o=[];if(i.args){const t={};for(const e in i.args)t[e]=this.build(i.args[e],{assign:e});const a=Object.keys(t),s=r.rules[i.name].args;if(s){n(a.length<=s.length,"Invalid number of arguments for",e.type,i.name,"(expected up to",s.length,", found",a.length,")");for(const{name:e}of s)o.push(t[e])}else n(1===a.length,"Invalid number of arguments for",e.type,i.name,"(expected up to 1, found",a.length,")"),o.push(t[a[0]])}t=t[i.name](...o);const a={};for(const e in r.modifiers)void 0!==i[e]&&(a[e]=this.build(i[e]));Object.keys(a).length&&(t=t.rule(a))}const i={};for(const t in e){if(["allow","flags","invalid","whens","preferences","rules","type"].includes(t))continue;n(r.terms[t],"Term",t,"missing configuration");const o=r.terms[t].manifest;if("schema"!==o)if("values"!==o)if("single"!==o)if("object"!=typeof o)i[t]=this.build(e[t]);else{i[t]={};for(const r in e[t]){const n=e[t][r];i[t][r]=this.parse(n)}}else i[t]=this.build(e[t]);else i[t]=e[t].map((e=>this.build(e)));else i[t]=e[t].map((e=>this.parse(e)))}return e.whens&&(i.whens=e.whens.map((e=>this.build(e)))),t=r.manifest.build(t,i),t.$_temp.ruleset=!1,t}build(e,t={}){if(null===e)return null;if(Array.isArray(e))return e.map((e=>this.build(e)));if(e instanceof Error)return e;if("options"===t.assign)return i(e);if("regex"===t.assign)return c.regex(e);if("ref"===t.assign)return s.build(e);if("object"!=typeof e)return e;if(1===Object.keys(e).length){if(e.buffer)return n(!1,"Buffers are not supported"),!1;if(e.function)return{[o.symbols.literal]:!0,literal:e.function};if(e.override)return o.symbols.override;if(e.ref)return s.build(e.ref);if(e.regex)return c.regex(e.regex);if(e.special)return n(["deep"].includes(e.special),"Unknown special value",e.special),o.symbols.deepDefault;if(e.value)return i(e.value)}if(e.type)return this.parse(e);if(e.template)return l.build(e);const r={};for(const t in e)r[t]=this.build(e[t],{assign:t});return r}},c.regex=function(e){const t=e.lastIndexOf("/"),r=e.slice(1,t),n=e.slice(t+1);return new RegExp(r,n)},c.validate=function(e,t){u=u||r(3378),e.assert(t,u.description)}},6914:(e,t,r)=>{const{assert:n,clone:i}=r(8870),o=r(3328);t.compile=function(e,t){if("string"==typeof e)return n(!t,"Cannot set single message string"),new o(e);if(o.isTemplate(e))return n(!t,"Cannot set single message template"),e;n("object"==typeof e&&!Array.isArray(e),"Invalid message options"),t=t?i(t):{};for(let r in e){const i=e[r];if("root"===r||o.isTemplate(i)){t[r]=i;continue}if("string"==typeof i){t[r]=new o(i);continue}n("object"==typeof i&&!Array.isArray(i),"Invalid message for",r);const a=r;for(r in t[a]=t[a]||{},i){const e=i[r];"root"===r||o.isTemplate(e)?t[a][r]=e:(n("string"==typeof e,"Invalid message for",r,"in",a),t[a][r]=new o(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(o.isTemplate(n)){t[r]=n.describe({compact:!0});continue}const i=r;for(r in t[i]={},n){const e=n[r];"root"!==r?t[i][r]=e.describe({compact:!0}):t[i].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 o(r);if(o.isTemplate(r))return r;const a=i(e);for(let e in r){const t=r[e];if("root"===e||o.isTemplate(t)){a[e]=t;continue}if("string"==typeof t){a[e]=new o(t);continue}n("object"==typeof t&&!Array.isArray(t),"Invalid message for",e);const i=e;for(e in a[i]=a[i]||{},t){const r=t[e];"root"===e||o.isTemplate(r)?a[i][e]=r:(n("string"==typeof r,"Invalid message for",e,"in",i),a[i][e]=new o(r))}}return a}},2294:(e,t,r)=>{const{assert:n}=r(8870),i=r(8160),o=r(6133),a={};t.Ids=a.Ids=class{constructor(){this._byId=new Map,this._byKey=new Map,this._schemaChain=!1}clone(){const e=new a.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 o=this._collect(e);o.push({schema:r});const s=o.shift();let l={id:s.id,schema:t(s.schema)};n(i.isSchema(l.schema),"adjuster function failed to return a joi schema type");for(const e of o)l={id:e.id,schema:a.fork(e.schema,l.id,l.schema)};return l.schema}labels(e,t=[]){const r=e[0],n=this._get(r);if(!n)return[...t,...e].join(".");const i=e.slice(1);return t=[...t,n.schema._flags.label||r],i.length?n.schema._ids.labels(i,t):t.join(".")}reach(e,t=[]){const r=e[0],i=this._get(r);n(i,"Schema does not contain path",[...t,...e].join("."));const o=e.slice(1);return o.length?i.schema._ids.reach(o,[...t,r]):i.schema}register(e,{key:t}={}){if(!e||!i.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,t=[],r=[]){const i=e[0],o=this._get(i);n(o,"Schema does not contain path",[...t,...e].join(".")),r=[o,...r];const a=e.slice(1);return a.length?o.schema._ids._collect(a,[...t,i],r):r}_get(e){return this._byId.get(e)||this._byKey.get(e)}},a.fork=function(e,r,n){const i=t.schema(e,{each:(e,{key:t})=>{if(r===(e._flags.id||t))return n},ref:!1});return i?i.$_mutateRebuild():e},t.schema=function(e,t){let r;for(const n in e._flags){if("_"===n[0])continue;const i=a.scan(e._flags[n],{source:"flags",name:n},t);void 0!==i&&(r=r||e.clone(),r._flags[n]=i)}for(let n=0;n<e._rules.length;++n){const i=e._rules[n],o=a.scan(i.args,{source:"rules",name:i.name},t);if(void 0!==o){r=r||e.clone();const t=Object.assign({},i);t.args=o,r._rules[n]=t,r._singleRules.get(i.name)===i&&r._singleRules.set(i.name,t)}}for(const n in e.$_terms){if("_"===n[0])continue;const i=a.scan(e.$_terms[n],{source:"terms",name:n},t);void 0!==i&&(r=r||e.clone(),r.$_terms[n]=i)}return r},a.scan=function(e,t,r,n,s){const l=n||[];if(null===e||"object"!=typeof e)return;let u;if(Array.isArray(e)){for(let n=0;n<e.length;++n){const i="terms"===t.source&&"keys"===t.name&&e[n].key,o=a.scan(e[n],t,r,[n,...l],i);void 0!==o&&(u=u||e.slice(),u[n]=o)}return u}if(!1!==r.schema&&i.isSchema(e)||!1!==r.ref&&o.isRef(e)){const n=r.each(e,{...t,path:l,key:s});if(n===e)return;return n}for(const n in e){if("_"===n[0])continue;const i=a.scan(e[n],t,r,[n,...l],s);void 0!==i&&(u=u||Object.assign({},e),u[n]=i)}return u}},6133:(e,t,r)=>{const{assert:n,clone:i,reach:o}=r(8870),a=r(8160);let s;const l={symbol:Symbol("ref"),defaults:{adjust:null,in:!1,iterables:null,map:null,separator:".",type:"value"}};t.create=function(e,t={}){n("string"==typeof e,"Invalid reference key:",e),a.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 i=r.separator,o=l.context(e,i,t.prefix);if(r.type=o.type,e=o.key,"value"===r.type)if(o.root&&(n(!i||e[0]!==i,"Cannot specify relative path with root prefix"),r.ancestor="root",e||(e=null)),i&&i===e)e=null,r.ancestor=0;else if(void 0!==r.ancestor)n(!i||!e||e[0]!==i,"Cannot combine prefix with ancestor option");else{const[t,n]=l.ancestor(e,i);n&&""===(e=e.slice(n))&&(e=null),r.ancestor=t}return r.path=i?null===e?[]:e.split(i):[e],new l.Ref(r)},t.in=function(e,r={}){return t.create(e,{...r,in:!0})},t.isRef=function(e){return!!e&&!!e[a.symbols.ref]},l.Ref=class{constructor(e){n("object"==typeof e,"Invalid reference construction"),a.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,i,o={}){return n(!this.in||o.in,"Invalid in() reference usage"),"global"===this.type?this._resolve(r.context,t,o):"local"===this.type?this._resolve(i,t,o):this.ancestor?"root"===this.ancestor?this._resolve(t.ancestors[t.ancestors.length-1],t,o):(n(this.ancestor<=t.ancestors.length,"Invalid reference exceeds the schema root:",this.display),this._resolve(t.ancestors[this.ancestor-1],t,o)):this._resolve(e,t,o)}_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=o(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[a.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,r={}){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 i=void 0===r.local?"#":r.local;if(i!==t&&e.startsWith(i))return{key:e.slice(i.length),type:"local"};const o=void 0===r.root?"/":r.root;if(o!==t&&e.startsWith(o))return{key:e.slice(o.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(a.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}),s=s||r(3328),s.isTemplate(e)&&this.register(e.refs(),n)}get length(){return this.refs.length}clone(){const e=new t.Manager;return e.refs=i(this.refs),e}reset(){this.refs=[]}roots(){return this.refs.filter((e=>!e.ancestor)).map((e=>e.root))}}},3378:(e,t,r)=>{const n=r(5107),i={};i.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:i.wrap,array:i.wrap,string:i.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(),i.nameRx=/^[a-zA-Z0-9]\w*$/,i.rule=n.object({alias:n.array().items(n.string().pattern(i.nameRx)).single(),args:n.array().items(n.string(),n.object({name:n.string().pattern(i.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(i.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(i.nameRx,n.object({setter:n.string(),default:n.any()})),manifest:{build:n.function().arity(2)},messages:[n.object(),n.string()],modifiers:n.object().pattern(i.nameRx,n.function().minArity(1).maxArity(2)),overrides:n.object().pattern(i.nameRx,n.function()),prepare:n.function().maxArity(3),rebuild:n.function().arity(1),rules:n.object().pattern(i.nameRx,i.rule),terms:n.object().pattern(i.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(),i.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()})},i.desc.entity=n.alternatives([n.array().items(n.link("...")),n.boolean(),n.function(),n.number(),n.string(),i.desc.buffer,i.desc.func,i.desc.ref,i.desc.regex,i.desc.special,i.desc.template,i.desc.value,n.link("/")]),i.desc.values=n.array().items(null,n.boolean(),n.function(),n.number().allow(1/0,-1/0),n.string().allow(""),n.symbol(),i.desc.buffer,i.desc.func,i.desc.override,i.desc.ref,i.desc.regex,i.desc.template,i.desc.value),i.desc.messages=n.object().pattern(/.+/,[n.string(),i.desc.template,n.object().pattern(/.+/,[n.string(),i.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:i.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(),i.desc.ref],wrap:{label:i.wrap,array:i.wrap}},externals:n.boolean(),messages:i.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:i.desc.values,invalid:i.desc.values,rules:n.array().min(1).items({name:n.string().required(),args:n.object().min(1),keep:n.boolean(),message:[n.string(),i.desc.messages],warn:n.boolean()}),keys:n.object().pattern(/.*/,n.link("/")),link:i.desc.ref}).pattern(/^[a-z]\w*$/,n.any())},493:(e,t,r)=>{const{clone:n,reach:i}=r(8870),o=r(8160),a={value:Symbol("value")};e.exports=a.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,t=null,r=null){const n=new a.State(e,t,this);return r&&n.schemas&&(n.schemas=[a.schemas(r),...n.schemas]),n}nest(e,t){const r=new a.State(this.path,this.ancestors,this);return r.schemas=r.schemas&&[a.schemas(e),...r.schemas],r.debug=t,r}shadow(e,t){this.mainstay.shadow=this.mainstay.shadow||new a.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()}},a.schemas=function(e){return o.isSchema(e)?{schema:e}:e},a.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 i=n.get(r);i||(i=new Map,n.set(r,i)),n=i}n[a.value]=t}get(e){const t=this.node(e);if(t)return t[a.value]}node(e){if(this._values)return i(this._values,e,{iterables:!0})}override(e,t){if(!this._values)return;const r=e.slice(0,-1),n=e[e.length-1],o=i(this._values,r,{iterables:!0});t?o.set(n,t):o&&o.delete(n)}}},3328:(e,t,r)=>{const{assert:n,clone:i,escapeHtml:o}=r(8870),a=r(4964),s=r(8160),l=r(6354),u=r(6133),c={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=c.Template=class{constructor(e,t){if(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,t){const{functions:e,...r}=t;this._settings=Object.keys(r).length?i(r):void 0,this._functions=e,this._functions&&(n(Object.keys(this._functions).every((e=>"string"==typeof e)),"Functions keys must be strings"),n(Object.values(this._functions).every((e=>"function"==typeof e)),"Functions values must be functions"))}else this._settings=void 0,this._functions=void 0;this._parse()}_parse(){if(!this.source.includes("{"))return;const e=c.encode(this.source),t=c.split(e);let r=!1;const n=[],i=t.shift();i&&n.push(i);for(const e of t){const t="{"!==e[0],i=t?"}":"}}",o=e.indexOf(i);if(-1===o||"{"===e[1]){n.push(`{${c.decode(e)}`);continue}let a=e.slice(t?0:1,o);const s=":"===a[0];s&&(a=a.slice(1));const l=this._ref(c.decode(a),{raw:t,wrapped:s});n.push(l),"string"!=typeof l&&(r=!0);const u=e.slice(o+i.length);u&&n.push(c.decode(u))}r?this._template=n:this.rendered=n.join("")}static date(e,t){return c.dateFormat[t.dateFormat].call(e)}describe(e={}){if(!this._settings&&e.compact)return this.source;const t={template:this.source};return this._settings&&(t.options=this._settings),this._functions&&(t.functions=this._functions),t}static build(e){return new c.Template(e.template,e.options||e.functions?{...e.options,functions:e.functions}:void 0)}isDynamic(){return!!this._template}static isTemplate(e){return!!e&&!!e[s.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,...t){return e.ref?e.ref.resolve(...t):e.formula.evaluate(t)}render(e,t,r,n,i={}){if(!this.isDynamic())return this.rendered;const a=[];for(const s of this._template)if("string"==typeof s)a.push(s);else{const l=this._part(s,e,t,r,n,i),u=c.stringify(l,e,t,r,n,i);if(void 0!==u){const e=s.raw||!1===(i.errors&&i.errors.escapeHtml)?u:o(u);a.push(c.wrap(e,s.wrapped&&r.errors.wrap.label))}}return a.join("")}_ref(e,{raw:t,wrapped:r}){const n=[],i=e=>{const t=u.create(e,this._settings);return n.push(t),e=>{const r=t.resolve(...e);return void 0!==r?r:null}};try{const t=this._functions?{...c.functions,...this._functions}:c.functions;var o=new a.Parser(e,{reference:i,functions:t,constants:c.constants})}catch(t){throw t.message=`Invalid template variable "${e}" fails due to: ${t.message}`,t}if(o.single){if("reference"===o.single.type){const e=n[0];return{ref:e,raw:t,refs:n,wrapped:r||"local"===e.type&&"label"===e.key}}return c.stringify(o.single.value)}return{formula:o,raw:t,refs:n}}toString(){return this.source}},c.Template.prototype[s.symbols.template]=!0,c.Template.prototype.isImmutable=!0,c.encode=function(e){return e.replace(/\\(\{+)/g,((e,t)=>c.opens.slice(0,t.length))).replace(/\\(\}+)/g,((e,t)=>c.closes.slice(0,t.length)))},c.decode=function(e){return e.replace(/\u0000/g,"{").replace(/\u0001/g,"}")},c.split=function(e){const t=[];let r="";for(let n=0;n<e.length;++n){const i=e[n];if("{"===i){let i="";for(;n+1<e.length&&"{"===e[n+1];)i+="{",++n;t.push(r),r=i}else r+=i}return t.push(r),t},c.wrap=function(e,t){return t?1===t.length?`${t}${e}${t}`:`${t[0]}${e}${t[1]}`:e},c.stringify=function(e,t,r,n,i,o={}){const a=typeof e,s=n&&n.errors&&n.errors.wrap||{};let l=!1;if(u.isRef(e)&&e.render&&(l=e.in,e=e.resolve(t,r,n,i,{in:e.in,...o})),null===e)return"null";if("string"===a)return c.wrap(e,o.arrayItems&&s.string);if("number"===a||"function"===a||"symbol"===a)return e.toString();if("object"!==a)return JSON.stringify(e);if(e instanceof Date)return c.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 d=[];for(const a of e)d.push(c.stringify(a,t,r,n,i,{arrayItems:!0,...o}));return c.wrap(d.join(", "),!l&&s.array)},c.constants={true:!0,false:!1,null:null,second:1e3,minute:6e4,hour:36e5,day:864e5},c.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,i,o]=this,a=o.messages;if(!a)return"";const s=l.template(t,a[0],e,r,n)||l.template(t,a[1],e,r,n);return s?s.render(t,r,n,i,o):""},number:e=>"number"==typeof e?e:"string"==typeof e?parseFloat(e):"boolean"==typeof e?e?1:0:e instanceof Date?e.getTime():null}},2305:(e,t,r)=>{const{deepEqual:n}=r(8870),i=r(7593),o=r(6354),a={codes:{error:1,pass:2,full:3},labels:{0:"never used",1:"always error",2:"always pass"}};t.setup=function(e){const t=function(){return e._tracer=e._tracer||new a.Tracer,e._tracer};e.trace=t,e[Symbol.for("@hapi/lab/coverage/initialize")]=t,e.untrace=()=>{e._tracer=null}},t.location=function(e){return e.$_setFlag("_tracerLocation",i.location(2))},a.Tracer=class{constructor(){this.name="Joi",this._schemas=new Map}_register(e){const t=this._schemas.get(e);if(t)return t.store;const r=new a.Store(e),{filename:n,line:o}=e._flags._tracerLocation||i.location(5);return this._schemas.set(e,{filename:n,line:o,store:r}),r}_combine(e,t){for(const{store:r}of this._schemas.values())r._combine(e,t)}report(e){const t=[];for(const{filename:r,line:n,store:i}of this._schemas.values()){if(e&&e!==r)continue;const o=[],s=[];for(const[e,t]of i._sources.entries()){if(a.sub(t.paths,s))continue;if(!t.entry){o.push({status:"never reached",paths:[...t.paths]}),s.push(...t.paths);continue}for(const r of["valid","invalid"]){const n=e[`_${r}s`];if(!n)continue;const i=new Set(n._values),a=new Set(n._refs);for(const{value:e,ref:n}of t[r])i.delete(e),a.delete(n);(i.size||a.size)&&o.push({status:[...i,...[...a].map((e=>e.display))],rule:`${r}s`})}const r=e._rules.map((e=>e.name));for(const t of["default","failover"])void 0!==e._flags[t]&&r.push(t);for(const e of r){const r=a.labels[t.rule[e]||0];if(r){const n={rule:e,status:r};t.paths.size&&(n.paths=[...t.paths]),o.push(n)}}}o.length&&t.push({filename:r,line:n,missing:o,severity:"error",message:`Schema missing tests for ${o.map(a.message).join(", ")}`})}return t.length?t:null}},a.Store=class{constructor(e){this.active=!0,this._sources=new Map,this._combos=new Map,this._scan(e)}debug(e,t,r,n){e.mainstay.debug&&e.mainstay.debug.push({type:t,name:r,result:n,path:e.path})}entry(e,t){a.debug(t,{type:"entry"}),this._record(e,(e=>{e.entry=!0}))}filter(e,t,r,n){a.debug(t,{type:r,...n}),this._record(e,(e=>{e[r].add(n)}))}log(e,t,r,n,i){a.debug(t,{type:r,name:n,result:"full"===i?"pass":i}),this._record(e,(e=>{e[r][n]=e[r][n]||0,e[r][n]|=a.codes[i]}))}resolve(e,t,r){if(!e.mainstay.debug)return;const n={type:"resolve",ref:t.display,to:r,path:e.path};e.mainstay.debug.push(n)}value(e,t,r,i,o){if(!e.mainstay.debug||n(r,i))return;const a={type:"value",by:t,from:r,to:i,path:e.path};o&&(a.name=o),e.mainstay.debug.push(a)}_record(e,t){const r=this._sources.get(e);if(r)return void t(r);const n=this._combos.get(e);for(const e of n)this._record(e,t)}_scan(e,t){const r=t||[];let n=this._sources.get(e);n||(n={paths:new Set,entry:!1,rule:{},valid:new Set,invalid:new Set},this._sources.set(e,n)),r.length&&n.paths.add(r),e.$_modify({each:(e,t)=>{const n=a.id(e,t);this._scan(e,r.concat(n))},ref:!1})}_combine(e,t){this._combos.set(e,t)}},a.message=function(e){return`${e.paths?o.path(e.paths[0])+(e.rule?":":""):""}${e.rule||""} (${e.status})`},a.id=function(e,{source:t,name:r,path:n,key:i}){return e._flags.id?e._flags.id:i||(r=`@${r}`,"terms"===t?[r,n[Math.min(n.length-1,1)]]:r)},a.sub=function(e,t){for(const r of e)for(const e of t)if(n(r.slice(0,e.length),e))return!0;return!1},a.debug=function(e,t){e.mainstay.debug&&(t.path=e.debug?[...e.path,e.debug]:e.path,e.mainstay.debug.push(t))}},4946:(e,t,r)=>{const{assert:n,merge:i}=r(8870),o=r(8068),a=r(8160),s=r(3292),l=r(6354),u=r(6133),c={};e.exports=o.extend({type:"alternatives",flags:{match:{default:"any"}},terms:{matches:{init:[],register:u.toSibling}},args:(e,...t)=>1===t.length&&Array.isArray(t[0])?e.try(...t[0]):e.try(...t),validate(e,t){const{schema:r,error:n,state:o,prefs:a}=t;if(r._flags.match){const t=[],s=[];for(let n=0;n<r.$_terms.matches.length;++n){const i=r.$_terms.matches[n],l=o.nest(i.schema,`match.${n}`);l.snapshot();const u=i.schema.$_validate(e,l,a);u.errors?(s.push(u.errors),l.restore()):(t.push(u.value),l.commit())}if(0===t.length)return{errors:n("alternatives.any",{details:s.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:s.map((e=>l.details(e,{override:!1})))})};const u=e=>e.$_terms.matches.some((e=>"object"===e.schema.type||"alternatives"===e.schema.type&&u(e.schema)));return u(r)?{value:t.reduce(((e,t)=>i(e,t,{mergeArrays:!1})))}:{value:t[t.length-1]}}const s=[];for(let t=0;t<r.$_terms.matches.length;++t){const n=r.$_terms.matches[t];if(n.schema){const r=o.nest(n.schema,`match.${t}`);r.snapshot();const i=n.schema.$_validate(e,r,a);if(!i.errors)return r.commit(),i;r.restore(),s.push({schema:n.schema,reports:i.errors});continue}const i=n.ref?n.ref.resolve(e,o,a):e,l=n.is?[n]:n.switch;for(let r=0;r<l.length;++r){const s=l[r],{is:u,then:c,otherwise:d}=s,p=`match.${t}${n.switch?"."+r:""}`;if(u.$_match(i,o.nest(u,`${p}.is`),a)){if(c)return c.$_validate(e,o.nest(c,`${p}.then`),a)}else if(d)return d.$_validate(e,o.nest(d,`${p}.otherwise`),a)}}return c.errors(s,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(),i=s.when(r,e,t),o=i.is?[i]:i.switch;for(const e of o)if(e.then&&e.otherwise){r.$_setFlag("_endedSwitch",!0,{clone:!1});break}return r.$_terms.matches.push(i),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(...e){n(e.length,"Missing alternative schemas"),a.verifyFlat(e,"try"),n(!this._flags._endedSwitch,"Unreachable condition");const t=this.clone();for(const r of e)t.$_terms.matches.push({schema:t.$_compile(r)});return t.$_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=>{a.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:i,not:o,then:a,otherwise:s}=r;e=t?e.try(t):n?e.conditional(n,{is:i,then:a,not:o,otherwise:s,switch:r.switch}):e.conditional(i,{then:a,otherwise:s})}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}}"}}),c.errors=function(e,{error:t,state:r}){if(!e.length)return{errors:t("alternatives.any")};if(1===e.length)return{errors:e[0].reports};const n=new Set,i=[];for(const{reports:o,schema:a}of e){if(o.length>1)return c.unmatched(e,t);const s=o[0];if(s instanceof l.Report==0)return c.unmatched(e,t);if(s.state.path.length!==r.path.length){i.push({type:a.type,report:s});continue}if("any.only"===s.code){for(const e of s.local.valids)n.add(e);continue}const[u,d]=s.code.split(".");"base"===d?n.add(u):i.push({type:a.type,report:s})}return i.length?1===i.length?{errors:i[0].report}:c.unmatched(e,t):{errors:t("alternatives.types",{types:[...n]})}},c.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)=>{const{assert:n}=r(8870),i=r(7629),o=r(8160),a=r(6914);e.exports=i.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,{method:r}){try{return r(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(o.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,{code:r,local:n})=>t.error(r,n),args:["code","local"],multi:!0}},modifiers:{keep(e,t=!0){e.keep=t},message(e,t){e.message=a.compile(t)},warn(e,t=!0){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:i,then:o,otherwise:a,concat:s}=t;e=s?e.concat(s):r?e.when(r,{is:n,not:i,then:o,otherwise:a,switch:t.switch,break:t.break}):e.when(n,{then:o,otherwise:a,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)=>{const{assert:n,deepEqual:i,reach:o}=r(8870),a=r(8068),s=r(8160),l=r(3292),u={};e.exports=a.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,{schema:t,state:r,prefs:n}){if(!Array.isArray(e))return;const i=t.$_getRule("sort");return i?u.sort(t,e,i.args.options,r,n):void 0}},validate(e,{schema:t,error:r}){if(!Array.isArray(e)){if(t._flags.single){const t=[e];return t[s.symbols.arraySingle]=!0,{value:t}}return{errors:r("array.base")}}if(t.$_getRule("items")||t.$_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,{state:t,prefs:r,error:n},{schema:i}){const o=[e,...t.ancestors];for(let n=0;n<e.length;++n){const a=t.localize([...t.path,n],o,i);if(i.$_match(e[n],a,r))return e}const a=i._flags.label;return a?n("array.hasKnown",{patternLabel:a}):n("array.hasUnknown",null)},multi:!0},items:{method(...e){s.verifyFlat(e,"items");const t=this.$_addRule("items");for(let r=0;r<e.length;++r){const n=s.tryWithPath((()=>this.$_compile(e[r])),r,{append:!0});t.$_terms.items.push(n)}return t.$_mutateRebuild()},validate(e,{schema:t,error:r,state:n,prefs:i,errorsArray:o}){const a=t.$_terms._requireds.slice(),l=t.$_terms.ordered.slice(),c=[...t.$_terms._inclusions,...a],d=!e[s.symbols.arraySingle];delete e[s.symbols.arraySingle];const p=o();let f=e.length;for(let o=0;o<f;++o){const s=e[o];let h=!1,m=!1;const g=d?o:new Number(o),y=[...n.path,g];if(!t._flags.sparse&&void 0===s){if(p.push(r("array.sparse",{key:g,path:y,pos:o,value:void 0},n.localize(y))),i.abortEarly)return p;l.shift();continue}const b=[e,...n.ancestors];for(const e of t.$_terms._exclusions)if(e.$_match(s,n.localize(y,b,e),i,{presence:"ignore"})){if(p.push(r("array.excludes",{pos:o,value:s},n.localize(y))),i.abortEarly)return p;h=!0,l.shift();break}if(h)continue;if(t.$_terms.ordered.length){if(l.length){const a=l.shift(),c=a.$_validate(s,n.localize(y,b,a),i);if(c.errors){if(p.push(...c.errors),i.abortEarly)return p}else if("strip"===a._flags.result)u.fastSplice(e,o),--o,--f;else{if(!t._flags.sparse&&void 0===c.value){if(p.push(r("array.sparse",{key:g,path:y,pos:o,value:void 0},n.localize(y))),i.abortEarly)return p;continue}e[o]=c.value}continue}if(!t.$_terms.items.length){if(p.push(r("array.orderedLength",{pos:o,limit:t.$_terms.ordered.length})),i.abortEarly)return p;break}}const v=[];let _=a.length;for(let l=0;l<_;++l){const c=n.localize(y,b,a[l]);c.snapshot();const d=a[l].$_validate(s,c,i);if(v[l]=d,!d.errors){if(c.commit(),e[o]=d.value,m=!0,u.fastSplice(a,l),--l,--_,!t._flags.sparse&&void 0===d.value&&(p.push(r("array.sparse",{key:g,path:y,pos:o,value:void 0},n.localize(y))),i.abortEarly))return p;break}c.restore()}if(m)continue;const A=i.stripUnknown&&!!i.stripUnknown.arrays||!1;_=c.length;for(const l of c){let c;const d=a.indexOf(l);if(-1!==d)c=v[d];else{const a=n.localize(y,b,l);if(a.snapshot(),c=l.$_validate(s,a,i),!c.errors){a.commit(),"strip"===l._flags.result?(u.fastSplice(e,o),--o,--f):t._flags.sparse||void 0!==c.value?e[o]=c.value:(p.push(r("array.sparse",{key:g,path:y,pos:o,value:void 0},n.localize(y))),h=!0),m=!0;break}a.restore()}if(1===_){if(A){u.fastSplice(e,o),--o,--f,m=!0;break}if(p.push(...c.errors),i.abortEarly)return p;h=!0;break}}if(!h&&(t.$_terms._inclusions.length||t.$_terms._requireds.length)&&!m){if(A){u.fastSplice(e,o),--o,--f;continue}if(p.push(r("array.includes",{pos:o,value:s},n.localize(y))),i.abortEarly)return p}}return a.length&&u.fillMissedErrors(t,p,a,e,n,i),l.length&&(u.fillOrderedErrors(t,p,l,e,n,i),p.length||u.fillDefault(l,e,n,i)),p.length?p:e},priority:!0,manifest:!1},length:{method(e){return this.$_addRule({name:"length",args:{limit:e},operator:"="})},validate:(e,t,{limit:r},{name:n,operator:i,args:o})=>s.compare(e.length,r,i)?e:t.error("array."+n,{limit:o.limit,value:e}),args:[{name:"limit",ref:!0,assert:s.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(...e){s.verifyFlat(e,"ordered");const t=this.$_addRule("items");for(let r=0;r<e.length;++r){const n=s.tryWithPath((()=>this.$_compile(e[r])),r,{append:!0});u.validateSingle(n,t),t.$_mutateRegister(n),t.$_terms.ordered.push(n)}return t.$_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(e={}){s.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,{error:t,state:r,prefs:n,schema:i},{options:o}){const{value:a,errors:s}=u.sort(i,e,o,r,n);if(s)return s;for(let r=0;r<e.length;++r)if(e[r]!==a[r])return t("array.sort",{order:o.order,by:o.by?o.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,t={}){n(!e||"function"==typeof e||"string"==typeof e,"comparator must be a function or a string"),s.assertOptions(t,["ignoreUndefined","separator"]);const r={name:"unique",args:{options:t,comparator:e}};if(e)if("string"==typeof e){const n=s.default(t.separator,".");r.path=n?e.split(n):[e]}else r.comparator=e;return this.$_addRule(r)},validate(e,{state:t,error:r,schema:a},{comparator:s,options:l},{comparator:u,path:c}){const d={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},p=u||i,f=l.ignoreUndefined;for(let i=0;i<e.length;++i){const a=c?o(e[i],c):e[i],l=u?d.custom:d[typeof a];if(n(l,"Failed to find unique map container for type",typeof a),l instanceof Map){const n=l.entries();let o;for(;!(o=n.next()).done;)if(p(o.value[0],a)){const n=t.localize([...t.path,i],[e,...t.ancestors]),a={pos:i,value:e[i],dupePos:o.value[1],dupeValue:e[o.value[1]]};return c&&(a.path=s),r("array.unique",a,n)}l.set(a,i)}else{if((!f||void 0!==a)&&void 0!==l[a]){const n={pos:i,value:e[i],dupePos:l[a],dupeValue:e[l[a]]};return c&&(n.path=s),r("array.unique",n,t.localize([...t.path,i],[e,...t.ancestors]))}l[a]=i}}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)u.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)u.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"}}),u.fillMissedErrors=function(e,t,r,n,i,o){const a=[];let s=0;for(const e of r){const t=e._flags.label;t?a.push(t):++s}a.length?s?t.push(e.$_createError("array.includesRequiredBoth",n,{knownMisses:a,unknownMisses:s},i,o)):t.push(e.$_createError("array.includesRequiredKnowns",n,{knownMisses:a},i,o)):t.push(e.$_createError("array.includesRequiredUnknowns",n,{unknownMisses:s},i,o))},u.fillOrderedErrors=function(e,t,r,n,i,o){const a=[];for(const e of r)"required"===e._flags.presence&&a.push(e);a.length&&u.fillMissedErrors(e,t,a,n,i,o)},u.fillDefault=function(e,t,r,n){const i=[];let o=!0;for(let a=e.length-1;a>=0;--a){const s=e[a],l=[t,...r.ancestors],u=s.$_validate(void 0,r.localize(r.path,l,s),n).value;if(o){if(void 0===u)continue;o=!1}i.unshift(u)}i.length&&t.push(...i)},u.fastSplice=function(e,t){let r=t;for(;r<e.length;)e[r++]=e[r];--e.length},u.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}))},u.sort=function(e,t,r,n,i){const o="ascending"===r.order?1:-1,a=-1*o,s=o,l=(l,c)=>{let d=u.compare(l,c,a,s);if(null!==d)return d;if(r.by&&(l=r.by.resolve(l,n,i),c=r.by.resolve(c,n,i)),d=u.compare(l,c,a,s),null!==d)return d;const p=typeof l;if(p!==typeof c)throw e.$_createError("array.sort.mismatching",t,null,n,i);if("number"!==p&&"string"!==p)throw e.$_createError("array.sort.unsupported",t,{type:p},n,i);return"number"===p?(l-c)*o:l<c?a:s};try{return{value:t.slice().sort(l)}}catch(e){return{errors:e}}},u.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)=>{const{assert:n}=r(8870),i=r(8068),o=r(8160),a=r(2036),s={isBool:function(e){return"boolean"==typeof e}};e.exports=i.extend({type:"boolean",flags:{sensitive:{default:!1}},terms:{falsy:{init:null,manifest:"values"},truthy:{init:null,manifest:"values"}},coerce(e,{schema:t}){if("boolean"!=typeof e){if("string"==typeof e){const r=t._flags.sensitive?e:e.toLowerCase();e="true"===r||"false"!==r&&e}return"boolean"!=typeof e&&(e=t.$_terms.truthy&&t.$_terms.truthy.has(e,null,null,!t._flags.sensitive)||(!t.$_terms.falsy||!t.$_terms.falsy.has(e,null,null,!t._flags.sensitive))&&e),{value:e}}},validate(e,{error:t}){if("boolean"!=typeof e)return{value:e,errors:t("boolean.base")}},rules:{truthy:{method(...e){o.verifyFlat(e,"truthy");const t=this.clone();t.$_terms.truthy=t.$_terms.truthy||new a;for(let r=0;r<e.length;++r){const i=e[r];n(void 0!==i,"Cannot call truthy with undefined"),t.$_terms.truthy.add(i)}return t}},falsy:{method(...e){o.verifyFlat(e,"falsy");const t=this.clone();t.$_terms.falsy=t.$_terms.falsy||new a;for(let r=0;r<e.length;++r){const i=e[r];n(void 0!==i,"Cannot call falsy with undefined"),t.$_terms.falsy.add(i)}return t}},sensitive:{method(e=!0){return this.$_setFlag("sensitive",e)}}},cast:{number:{from:s.isBool,to:(e,t)=>e?1:0},string:{from:s.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)=>{const{assert:n}=r(8870),i=r(8068),o=r(8160),a=r(3328),s={isDate:function(e){return e instanceof Date}};e.exports=i.extend({type:"date",coerce:{from:["number","string"],method:(e,{schema:t})=>({value:s.parse(e,t._flags.format)||e})},validate(e,{schema:t,error:r,prefs:n}){if(e instanceof Date&&!isNaN(e.getTime()))return;const i=t._flags.format;return n.convert&&i&&"string"==typeof e?{value:e,errors:r("date.format",{format:i})}:{value:e,errors:r("date.base")}},rules:{compare:{method:!1,validate(e,t,{date:r},{name:n,operator:i,args:a}){const s="now"===r?Date.now():r.getTime();return o.compare(e.getTime(),s,i)?e:t.error("date."+n,{limit:a.date,value:e})},args:[{name:"date",ref:!0,normalize:e=>"now"===e?e:s.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(e="javascript"){return n(["javascript","unix"].includes(e),'"type" must be one of "javascript, unix"'),this.format(e)}}},cast:{number:{from:s.isDate,to:(e,t)=>e.getTime()},string:{from:s.isDate,to:(e,{prefs:t})=>a.date(e,t)}},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"}}),s.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 o.isIsoDate(e)?s.date(e.toString()):null;const r=e;if("string"==typeof e&&/^[+-]?\d+(\.\d+)?$/.test(e)&&(e=parseFloat(e)),t){if("javascript"===t)return s.date(1*e);if("unix"===t)return s.date(1e3*e);if("string"==typeof r)return null}return s.date(e)},s.date=function(e){const t=new Date(e);return isNaN(t.getTime())?null:t}},390:(e,t,r)=>{const{assert:n}=r(8870),i=r(7824);e.exports=i.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,{n:r})=>e.length===r?e:t.error("function.arity",{n:r})},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,{n:r})=>e.length>=r?e:t.error("function.minArity",{n:r})},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,{n:r})=>e.length<=r?e:t.error("function.maxArity",{n:r})}},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)=>{const{applyToDefaults:n,assert:i,clone:o}=r(8870),a=r(3652),s=r(8068),l=r(8160),u=r(3292),c=r(6354),d=r(6133),p=r(3328),f={renameDefaults:{alias:!1,multiple:!1,override:!1}};e.exports=s.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,{schema:t,error:r,state:n,prefs:i}){if(!e||typeof e!==t.$_property("typeof")||Array.isArray(e))return{value:e,errors:r("object.base",{type:t.$_property("typeof")})};if(!(t.$_terms.renames||t.$_terms.dependencies||t.$_terms.keys||t.$_terms.patterns||t.$_terms.externals))return;e=f.clone(e,i);const o=[];if(t.$_terms.renames&&!f.rename(t,e,n,i,o))return{value:e,errors:o};if(!t.$_terms.keys&&!t.$_terms.patterns&&!t.$_terms.dependencies)return{value:e,errors:o};const a=new Set(Object.keys(e));if(t.$_terms.keys){const r=[e,...n.ancestors];for(const s of t.$_terms.keys){const t=s.key,l=e[t];a.delete(t);const u=n.localize([...n.path,t],r,s),c=s.schema.$_validate(l,u,i);if(c.errors){if(i.abortEarly)return{value:e,errors:c.errors};void 0!==c.value&&(e[t]=c.value),o.push(...c.errors)}else"strip"===s.schema._flags.result||void 0===c.value&&void 0!==l?delete e[t]:void 0!==c.value&&(e[t]=c.value)}}if(a.size||t._flags._hasPatternMatch){const r=f.unknown(t,e,a,o,n,i);if(r)return r}if(t.$_terms.dependencies)for(const r of t.$_terms.dependencies){if(null!==r.key&&!1===f.isPresent(r.options)(r.key.resolve(e,n,i,null,{shadow:!1})))continue;const a=f.dependencies[r.rel](t,r,e,n,i);if(a){const r=t.$_createError(a.code,e,a.context,n,i);if(i.abortEarly)return{value:e,errors:r};o.push(r)}}return{value:e,errors:o}},rules:{and:{method(...e){return l.verifyFlat(e,"and"),f.dependency(this,"and",null,e)}},append:{method(e){return null==e||0===Object.keys(e).length?this:this.keys(e)}},assert:{method(e,t,r){p.isTemplate(e)||(e=u.ref(e)),i(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,{error:t,prefs:r,state:n},{subject:i,schema:o,message:a}){const s=i.resolve(e,n,r),l=d.isRef(i)?i.absolute(n):[];return o.$_match(s,n.localize(l,[e,...n.ancestors],o),r)?e:t("object.assert",{subject:i,message:a})},args:["subject","schema","message"],multi:!0},instance:{method(e,t){return i("function"==typeof e,"constructor must be a function"),t=t||e.name,this.$_addRule({name:"instance",args:{constructor:e,name:t}})},validate:(e,t,{constructor:r,name:n})=>e instanceof r?e:t.error("object.instance",{type:n,value:e}),args:["constructor","name"]},keys:{method(e){i(void 0===e||"object"==typeof e,"Object schema must be a valid object"),i(!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 f.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 f.Keys;else t.$_terms.keys=null;return t.$_mutateRebuild()}},length:{method(e){return this.$_addRule({name:"length",args:{limit:e},operator:"="})},validate:(e,t,{limit:r},{name:n,operator:i,args:o})=>l.compare(Object.keys(e).length,r,i)?e:t.error("object."+n,{limit:o.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(...e){return l.verifyFlat(e,"nand"),f.dependency(this,"nand",null,e)}},or:{method(...e){return l.verifyFlat(e,"or"),f.dependency(this,"or",null,e)}},oxor:{method(...e){return f.dependency(this,"oxor",null,e)}},pattern:{method(e,t,r={}){const n=e instanceof RegExp;n||(e=this.$_compile(e,{appendPath:!0})),i(void 0!==t,"Invalid rule"),l.assertOptions(r,["fallthrough","matches"]),n&&i(!e.flags.includes("g")&&!e.flags.includes("y"),"pattern should not use global or sticky mode"),t=this.$_compile(t,{appendPath:!0});const o=this.clone();o.$_terms.patterns=o.$_terms.patterns||[];const a={[n?"regex":"schema"]:e,rule:t};return r.matches&&(a.matches=this.$_compile(r.matches),"array"!==a.matches.type&&(a.matches=a.matches.$_root.array().items(a.matches)),o.$_mutateRegister(a.matches),o.$_setFlag("_hasPatternMatch",!0,{clone:!1})),r.fallthrough&&(a.fallthrough=!0),o.$_terms.patterns.push(a),o.$_mutateRegister(t),o}},ref:{method(){return this.$_addRule("ref")},validate:(e,t)=>d.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,r={}){i("string"==typeof e||e instanceof RegExp,"Rename missing the from argument"),i("string"==typeof t||t instanceof p,"Invalid rename to argument"),i(t!==e,"Cannot rename key to same name:",e),l.assertOptions(r,["alias","ignoreUndefined","override","multiple"]);const o=this.clone();o.$_terms.renames=o.$_terms.renames||[];for(const t of o.$_terms.renames)i(t.from!==e,"Cannot rename the same key multiple times");return t instanceof p&&o.$_mutateRegister(t),o.$_terms.renames.push({from:e,to:t,options:n(f.renameDefaults,r)}),o}},schema:{method(e="any"){return this.$_addRule({name:"schema",args:{type:e}})},validate:(e,t,{type:r})=>!l.isSchema(e)||"any"!==r&&e.type!==r?t.error("object.schema",{type:r}):e},unknown:{method(e){return this.$_setFlag("unknown",!1!==e)}},with:{method(e,t,r={}){return f.dependency(this,"with",e,t,r)}},without:{method(e,t,r={}){return f.dependency(this,"without",e,t,r)}},xor:{method(...e){return l.verifyFlat(e,"xor"),f.dependency(this,"xor",null,e)}}},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 a.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 f.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:i,options:o}of t.dependencies)e=f.dependency(e,r,n,i,o);if(t.patterns)for(const{regex:r,schema:n,rule:i,fallthrough:o,matches:a}of t.patterns)e=e.pattern(r||n,i,{fallthrough:o,matches:a});if(t.renames)for(const{from:r,to:n,options:i}of t.renames)e=e.rename(r,n,i);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}}"}}),f.clone=function(e,t){if("object"==typeof e){if(t.nonEnumerables)return o(e,{shallow:!0});const r=Object.create(Object.getPrototypeOf(e));return Object.assign(r,e),r}const r=function(...t){return e.apply(this,t)};return r.prototype=o(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},f.dependency=function(e,t,r,n,o){i(null===r||"string"==typeof r,t,"key must be a strings"),o||(o=n.length>1&&"object"==typeof n[n.length-1]?n.pop():{}),l.assertOptions(o,["separator","isPresent"]),n=[].concat(n);const a=l.default(o.separator,"."),s=[];for(const e of n)i("string"==typeof e,t,"peers must be strings"),s.push(u.ref(e,{separator:a,ancestor:0,prefix:!1}));null!==r&&(r=u.ref(r,{separator:a,ancestor:0,prefix:!1}));const c=e.clone();return c.$_terms.dependencies=c.$_terms.dependencies||[],c.$_terms.dependencies.push(new f.Dependency(t,r,s,n,o)),c},f.dependencies={and(e,t,r,n,i){const o=[],a=[],s=t.peers.length,l=f.isPresent(t.options);for(const e of t.peers)!1===l(e.resolve(r,n,i,null,{shadow:!1}))?o.push(e.key):a.push(e.key);if(o.length!==s&&a.length!==s)return{code:"object.and",context:{present:a,presentWithLabels:f.keysToLabels(e,a),missing:o,missingWithLabels:f.keysToLabels(e,o)}}},nand(e,t,r,n,i){const o=[],a=f.isPresent(t.options);for(const e of t.peers)a(e.resolve(r,n,i,null,{shadow:!1}))&&o.push(e.key);if(o.length!==t.peers.length)return;const s=t.paths[0],l=t.paths.slice(1);return{code:"object.nand",context:{main:s,mainWithLabel:f.keysToLabels(e,s),peers:l,peersWithLabels:f.keysToLabels(e,l)}}},or(e,t,r,n,i){const o=f.isPresent(t.options);for(const e of t.peers)if(o(e.resolve(r,n,i,null,{shadow:!1})))return;return{code:"object.missing",context:{peers:t.paths,peersWithLabels:f.keysToLabels(e,t.paths)}}},oxor(e,t,r,n,i){const o=[],a=f.isPresent(t.options);for(const e of t.peers)a(e.resolve(r,n,i,null,{shadow:!1}))&&o.push(e.key);if(!o.length||1===o.length)return;const s={peers:t.paths,peersWithLabels:f.keysToLabels(e,t.paths)};return s.present=o,s.presentWithLabels=f.keysToLabels(e,o),{code:"object.oxor",context:s}},with(e,t,r,n,i){const o=f.isPresent(t.options);for(const a of t.peers)if(!1===o(a.resolve(r,n,i,null,{shadow:!1})))return{code:"object.with",context:{main:t.key.key,mainWithLabel:f.keysToLabels(e,t.key.key),peer:a.key,peerWithLabel:f.keysToLabels(e,a.key)}}},without(e,t,r,n,i){const o=f.isPresent(t.options);for(const a of t.peers)if(o(a.resolve(r,n,i,null,{shadow:!1})))return{code:"object.without",context:{main:t.key.key,mainWithLabel:f.keysToLabels(e,t.key.key),peer:a.key,peerWithLabel:f.keysToLabels(e,a.key)}}},xor(e,t,r,n,i){const o=[],a=f.isPresent(t.options);for(const e of t.peers)a(e.resolve(r,n,i,null,{shadow:!1}))&&o.push(e.key);if(1===o.length)return;const s={peers:t.paths,peersWithLabels:f.keysToLabels(e,t.paths)};return 0===o.length?{code:"object.missing",context:s}:(s.present=o,s.presentWithLabels=f.keysToLabels(e,o),{code:"object.xor",context:s})}},f.keysToLabels=function(e,t){return Array.isArray(t)?t.map((t=>e.$_mapLabels(t))):e.$_mapLabels(t)},f.isPresent=function(e){return"function"==typeof e.isPresent?e.isPresent:e=>void 0!==e},f.rename=function(e,t,r,n,i){const o={};for(const a of e.$_terms.renames){const s=[],l="string"!=typeof a.from;if(l)for(const e in t){if(void 0===t[e]&&a.options.ignoreUndefined)continue;if(e===a.to)continue;const r=a.from.exec(e);r&&s.push({from:e,to:a.to,match:r})}else!Object.prototype.hasOwnProperty.call(t,a.from)||void 0===t[a.from]&&a.options.ignoreUndefined||s.push(a);for(const u of s){const s=u.from;let c=u.to;if(c instanceof p&&(c=c.render(t,r,n,u.match)),s!==c){if(!a.options.multiple&&o[c]&&(i.push(e.$_createError("object.rename.multiple",t,{from:s,to:c,pattern:l},r,n)),n.abortEarly))return!1;if(Object.prototype.hasOwnProperty.call(t,c)&&!a.options.override&&!o[c]&&(i.push(e.$_createError("object.rename.override",t,{from:s,to:c,pattern:l},r,n)),n.abortEarly))return!1;void 0===t[s]?delete t[c]:t[c]=t[s],o[c]=!0,a.options.alias||delete t[s]}}}return!0},f.unknown=function(e,t,r,n,i,o){if(e.$_terms.patterns){let a=!1;const s=e.$_terms.patterns.map((e=>{if(e.matches)return a=!0,[]})),l=[t,...i.ancestors];for(const a of r){const u=t[a],c=[...i.path,a];for(let d=0;d<e.$_terms.patterns.length;++d){const p=e.$_terms.patterns[d];if(p.regex){const e=p.regex.test(a);if(i.mainstay.tracer.debug(i,"rule",`pattern.${d}`,e?"pass":"error"),!e)continue}else if(!p.schema.$_match(a,i.nest(p.schema,`pattern.${d}`),o))continue;r.delete(a);const f=i.localize(c,l,{schema:p.rule,key:a}),h=p.rule.$_validate(u,f,o);if(h.errors){if(o.abortEarly)return{value:t,errors:h.errors};n.push(...h.errors)}if(p.matches&&s[d].push(a),t[a]=h.value,!p.fallthrough)break}}if(a)for(let r=0;r<s.length;++r){const a=s[r];if(!a)continue;const u=e.$_terms.patterns[r].matches,d=i.localize(i.path,l,u),p=u.$_validate(a,d,o);if(p.errors){const r=c.details(p.errors,{override:!1});r.matches=a;const s=e.$_createError("object.pattern.match",t,r,i,o);if(o.abortEarly)return{value:t,errors:s};n.push(s)}}}if(r.size&&(e.$_terms.keys||e.$_terms.patterns)){if(o.stripUnknown&&!e._flags.unknown||o.skipFunctions){const e=!(!o.stripUnknown||!0!==o.stripUnknown&&!o.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,o.allowUnknown))for(const a of r){const r=i.localize([...i.path,a],[]),s=e.$_createError("object.unknown",t[a],{child:a},r,o,{flags:!1});if(o.abortEarly)return{value:t,errors:s};n.push(s)}}},f.Dependency=class{constructor(e,t,r,n,i){this.rel=e,this.key=t,this.peers=r,this.paths=n,this.options=i}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}},f.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,i=r.get(e);void 0!==i?t[i]={key:e,schema:t[i].schema.concat(n.schema)}:t.push(n)}return t}}},8785:(e,t,r)=>{const{assert:n}=r(8870),i=r(8068),o=r(8160),a=r(3292),s=r(6354),l={};e.exports=i.extend({type:"link",properties:{schemaChain:!0},terms:{link:{init:null,manifest:"single",register:!1}},args:(e,t)=>e.ref(t),validate(e,{schema:t,state:r,prefs:i}){n(t.$_terms.link,"Uninitialized link schema");const o=l.generate(t,e,r,i),a=t.$_terms.link[0].ref;return o.$_validate(e,r.nest(o,`link:${a.display}:${o.type}`),i)},generate:(e,t,r,n)=>l.generate(e,t,r,n),rules:{ref:{method(e){n(!this.$_terms.link,"Cannot reinitialize schema"),e=a.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(e=!0){return this.$_setFlag("relative",e)}}},overrides:{concat(e){n(this.$_terms.link,"Uninitialized link schema"),n(o.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 i=r.mainstay.links.get(e);if(i)return i._generate(t,r,n).schema;const o=e.$_terms.link[0].ref,{perspective:a,path:s}=l.perspective(o,r);l.assert(a,"which is outside of schema boundaries",o,e,r,n);try{i=s.length?a.$_reach(s):a}catch(t){l.assert(!1,"to non-existing schema",o,e,r,n)}return l.assert("link"!==i.type,"which is another link",o,e,r,n),e._flags.relative||r.mainstay.links.set(e,i),i._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,i,o,a){e||n(!1,`"${s.label(i._flags,o,a)}" contains link reference "${r.display}" ${t}`)}},3832:(e,t,r)=>{const{assert:n}=r(8870),i=r(8068),o=r(8160),a={numberRx:/^\s*[+-]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:e([+-]?\d+))?\s*$/i,precisionRx:/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/,exponentialPartRegex:/[eE][+-]?\d+$/,leadingSignAndZerosRegex:/^[+-]?(0*)?/,dotRegex:/\./,trailingZerosRegex:/0+$/};e.exports=i.extend({type:"number",flags:{unsafe:{default:!1}},coerce:{from:"string",method(e,{schema:t,error:r}){if(!e.match(a.numberRx))return;e=e.trim();const n={value:parseFloat(e)};if(0===n.value&&(n.value=0),!t._flags.unsafe)if(e.match(/e/i)){if(a.extractSignificantDigits(e)!==a.extractSignificantDigits(String(n.value)))return n.errors=r("number.unsafe"),n}else{const t=n.value.toString();if(t.match(/e/i))return n;if(t!==a.normalizeDecimal(e))return n.errors=r("number.unsafe"),n}return n}},validate(e,{schema:t,error:r,prefs:n}){if(e===1/0||e===-1/0)return{value:e,errors:r("number.infinity")};if(!o.isNumber(e))return{value:e,errors:r("number.base")};const i={value:e};if(n.convert){const e=t.$_getRule("precision");if(e){const t=Math.pow(10,e.args.limit);i.value=Math.round(i.value*t)/t}}return 0===i.value&&(i.value=0),!t._flags.unsafe&&(e>Number.MAX_SAFE_INTEGER||e<Number.MIN_SAFE_INTEGER)&&(i.errors=r("number.unsafe")),i},rules:{compare:{method:!1,validate:(e,t,{limit:r},{name:n,operator:i,args:a})=>o.compare(e,r,i)?e:t.error("number."+n,{limit:a.limit,value:e}),args:[{name:"limit",ref:!0,assert:o.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,{base:r},n)=>e*(1/r)%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,{limit:r}){const n=e.toString().match(a.precisionRx);return Math.max((n[1]?n[1].length:0)-(n[2]?parseInt(n[2],10):0),0)<=r?e:t.error("number.precision",{limit:r,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,{sign:r})=>"negative"===r&&e<0||"positive"===r&&e>0?e:t.error(`number.${r}`)},unsafe:{method(e=!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"}}),a.extractSignificantDigits=function(e){return e.replace(a.exponentialPartRegex,"").replace(a.dotRegex,"").replace(a.trailingZerosRegex,"").replace(a.leadingSignAndZerosRegex,"")},a.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)=>{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)=>{const{assert:n,escapeRegex:i}=r(8870),{isDomainValid:o,isEmailValid:a,ipRegex:s,uriRegex:l}=r(4958),u=r(6264),c=r(8068),d=r(8160),p={tlds:u.tlds instanceof Set&&{tlds:{allow:u.tlds,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:s({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",uuidv6:"6",uuidv7:"7",uuidv8:"8"},guidSeparators:new Set([void 0,!0,!1,"-",":"]),normalizationForms:["NFC","NFD","NFKC","NFKD"]};e.exports=c.extend({type:"string",flags:{insensitive:{default:!1},truncate:{default:!1}},terms:{replacements:{init:null}},coerce:{from:"string",method(e,{schema:t,state:r,prefs:n}){const i=t.$_getRule("normalize");i&&(e=e.normalize(i.args.form));const o=t.$_getRule("case");o&&(e="upper"===o.args.direction?e.toLocaleUpperCase():e.toLocaleLowerCase());const a=t.$_getRule("trim");if(a&&a.args.enabled&&(e=e.trim()),t.$_terms.replacements)for(const r of t.$_terms.replacements)e=e.replace(r.pattern,r.replacement);const s=t.$_getRule("hex");if(s&&s.args.options.byteAligned&&e.length%2!=0&&(e=`0${e}`),t.$_getRule("isoDate")){const t=p.isoDate(e);t&&(e=t)}if(t._flags.truncate){const i=t.$_getRule("max");if(i){let o=i.args.limit;if(d.isResolvable(o)&&(o=o.resolve(e,r,n),!d.limit(o)))return{value:e,errors:t.$_createError("any.ref",o,{ref:i.args.limit,arg:"limit",reason:"must be a positive integer"},r,n)};e=e.slice(0,o)}}return{value:e}}},validate(e,{schema:t,error:r}){if("string"!=typeof e)return{value:e,errors:r("string.base")};if(""===e){const n=t.$_getRule("min");if(n&&0===n.args.limit)return;return{value:e,errors:r("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(e={}){return d.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,{options:r})=>p.base64Regex[r.paddingRequired][r.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,{direction:r})=>"lower"===r&&e===e.toLocaleLowerCase()||"upper"===r&&e===e.toLocaleUpperCase()?e:t.error(`string.${r}case`),convert:!0},creditCard:{method(){return this.$_addRule("creditCard")},validate(e,t){let r=e.length,n=0,i=1;for(;r--;){const t=e.charAt(r)*i;n+=t-9*(t>9),i^=3}return n>0&&n%10==0?e:t.error("string.creditCard")}},dataUri:{method(e={}){return d.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,{options:r}){const n=e.match(p.dataUriRegex);if(n){if(!n[2])return e;if("base64"!==n[2])return e;if(p.base64Regex[r.paddingRequired].false.test(n[3]))return e}return t.error("string.dataUri")}},domain:{method(e){e&&d.assertOptions(e,["allowFullyQualified","allowUnicode","allowUnderscore","maxDomainSegments","minDomainSegments","tlds"]);const t=p.addressOptions(e);return this.$_addRule({name:"domain",args:{options:e},address:t})},validate:(e,t,r,{address:n})=>o(e,n)?e:t.error("string.domain")},email:{method(e={}){d.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=p.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,{options:r},{regex:n,address:i}){const o=r.multiple?e.split(n):[e],s=[];for(const e of o)a(e,i)||s.push(e);return s.length?t.error("string.email",{value:e,invalids:s}):e}},guid:{alias:"uuid",method(e={}){d.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 i=new Set;for(let e=0;e<r.length;++e){const o=r[e];n("string"==typeof o,"version at position "+e+" must be a string");const a=p.guidVersions[o.toLowerCase()];n(a,"version at position "+e+" must be one of "+Object.keys(p.guidVersions).join(", ")),n(!i.has(a),"version at position "+e+" must not be a duplicate"),t+=a,i.add(a)}}n(p.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}`,i=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:i})},validate(e,t,r,{regex:n}){const i=n.exec(e);return i?p.guidBrackets[i[1]]!==i[i.length-1]?t.error("string.guid"):e:t.error("string.guid")}},hex:{method(e={}){return d.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,{options:r})=>p.hexRegex.test(e)?r.byteAligned&&e.length%2!=0?t.error("string.hexAlign"):e:t.error("string.hex")},hostname:{method(){return this.$_addRule("hostname")},validate:(e,t)=>o(e,{minDomainSegments:1})||p.ipRegex.test(e)?e:t.error("string.hostname")},insensitive:{method(){return this.$_setFlag("insensitive",!0)}},ip:{method(e={}){d.assertOptions(e,["cidr","version"]);const{cidr:t,versions:r,regex:n}=s(e),i=e.version?r:void 0;return this.$_addRule({name:"ip",args:{options:{cidr:t,version:i}},regex:n})},validate:(e,t,{options:r},{regex:n})=>n.test(e)?e:r.version?t.error("string.ipVersion",{value:e,cidr:r.cidr,version:r.version}):t.error("string.ip",{value:e,cidr:r.cidr})},isoDate:{method(){return this.$_addRule("isoDate")},validate:(e,{error:t})=>p.isoDate(e)?e:t("string.isoDate")},isoDuration:{method(){return this.$_addRule("isoDuration")},validate:(e,t)=>p.isoDurationRegex.test(e)?e:t.error("string.isoDuration")},length:{method(e,t){return p.length(this,"length",e,"=",t)},validate(e,t,{limit:r,encoding:n},{name:i,operator:o,args:a}){const s=!n&&e.length;return d.compare(s,r,o)?e:t.error("string."+i,{limit:a.limit,value:e,encoding:n})},args:[{name:"limit",ref:!0,assert:d.limit,message:"must be a positive integer"},"encoding"]},lowercase:{method(){return this.case("lower")}},max:{method(e,t){return p.length(this,"max",e,"<=",t)},args:["limit","encoding"]},min:{method(e,t){return p.length(this,"min",e,">=",t)},args:["limit","encoding"]},normalize:{method(e="NFC"){return n(p.normalizationForms.includes(e),"normalization form must be one of "+p.normalizationForms.join(", ")),this.$_addRule({name:"normalize",args:{form:e}})},validate:(e,{error:t},{form:r})=>e===e.normalize(r)?e:t("string.normalize",{value:e,form:r}),convert:!0},pattern:{alias:"regex",method(e,t={}){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}),d.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,{regex:r,options:n},{errorCode:i})=>r.test(e)^n.invert?e:t.error(i,{name:n.name,regex:r,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(e=!0){return n("boolean"==typeof e,"enabled must be a boolean"),this.$_addRule({name:"trim",args:{enabled:e}})},validate:(e,t,{enabled:r})=>r&&e!==e.trim()?t.error("string.trim"):e,convert:!0},truncate:{method(e=!0){return n("boolean"==typeof e,"enabled must be a boolean"),this.$_setFlag("truncate",e)}},uppercase:{method(){return this.case("upper")}},uri:{method(e={}){d.assertOptions(e,["allowRelative","allowQuerySquareBrackets","domain","relativeOnly","scheme"]),e.domain&&d.assertOptions(e.domain,["allowFullyQualified","allowUnicode","maxDomainSegments","minDomainSegments","tlds"]);const{regex:t,scheme:r}=l(e),n=e.domain?p.addressOptions(e.domain):null;return this.$_addRule({name:"uri",args:{options:e},regex:t,domain:n,scheme:r})},validate(e,t,{options:r},{regex:n,domain:i,scheme:a}){if(["http:/","https:/"].includes(e))return t.error("string.uri");const s=n.exec(e);if(s){const n=s[1]||s[2];return!i||r.allowRelative&&!n||o(n,i)?e:t.error("string.domain",{value:n})}return r.relativeOnly?t.error("string.uriRelativeOnly"):r.scheme?t.error("string.uriCustomScheme",{scheme:a,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"}}),p.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(p.tlds,"Built-in TLD list disabled"),Object.assign({},e,p.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"),p.validateTlds(e.tlds.deny,"tlds.deny"),e;const r=e.tlds.allow;return r?!0===r?(n(p.tlds,"Built-in TLD list disabled"),Object.assign({},e,p.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"),p.validateTlds(e.tlds.allow,"tlds.allow"),e):{...e,tlds:!1}},p.validateTlds=function(e,t){for(const r of e)n(o(r,{minDomainSegments:1,maxDomainSegments:1}),`${t} must contain valid top level domain names`)},p.isoDate=function(e){if(!d.isIsoDate(e))return null;/.*T.*[+-]\d\d$/.test(e)&&(e+="00");const t=new Date(e);return isNaN(t.getTime())?null:t.toISOString()},p.length=function(e,t,r,i,o){return n(!o||!1,"Invalid encoding:",o),e.$_addRule({name:t,method:"length",args:{limit:r,encoding:o},operator:i})}},8826:(e,t,r)=>{const{assert:n}=r(8870),i=r(8068),o={};o.Map=class extends Map{slice(){return new o.Map(this)}},e.exports=i.extend({type:"symbol",terms:{map:{init:new o.Map}},coerce:{method(e,{schema:t,error:r}){const n=t.$_terms.map.get(e);return n&&(e=n),t._flags.only&&"symbol"!=typeof e?{value:e,errors:r("symbol.map",{map:t.$_terms.map})}:{value:e}}},validate(e,{error:t}){if("symbol"!=typeof e)return{value:e,errors:t("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 i of e){n(i&&i[Symbol.iterator],"Entry must be an iterable");const[e,o]=i;n("object"!=typeof e&&"function"!=typeof e&&"symbol"!=typeof e,"Key must not be of type object, function, or Symbol"),n("symbol"==typeof o,"Value must be a Symbol"),t.$_terms.map.set(e,o),r.push(o)}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)=>{const{assert:n,clone:i,ignore:o,reach:a}=r(8870),s=r(8160),l=r(6354),u=r(493),c={result:Symbol("result")};t.entry=function(e,t,r){let i=s.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"),i=s.preferences(s.defaults,r));const o=c.entry(e,t,i);n(!o.mainstay.externals.length,"Schema with external rules must use validateAsync()");const a={value:o.value};return o.error&&(a.error=o.error),o.mainstay.warnings.length&&(a.warning=l.details(o.mainstay.warnings)),o.mainstay.debug&&(a.debug=o.mainstay.debug),o.mainstay.artifacts&&(a.artifacts=o.mainstay.artifacts),a},t.entryAsync=async function(e,t,r){let n=s.defaults;r&&(n=s.preferences(s.defaults,r));const i=c.entry(e,t,n),o=i.mainstay;if(i.error)throw o.debug&&(i.error.debug=o.debug),i.error;if(o.externals.length){let t=i.value;const u=[];for(const i of o.externals){const d=i.state.path,p="link"===i.schema.type?o.links.get(i.schema):null;let f,h,m=t;const g=d.length?[t]:[],y=d.length?a(e,d):e;if(d.length){f=d[d.length-1];let e=t;for(const t of d.slice(0,-1))e=e[t],g.unshift(e);h=g[0],m=h[f]}try{const e=(e,t)=>(p||i.schema).$_createError(e,m,t,i.state,n),a=await i.method(m,{schema:i.schema,linked:p,state:i.state,prefs:r,original:y,error:e,errorsArray:c.errorsArray,warn:(e,t)=>o.warnings.push((p||i.schema).$_createError(e,m,t,i.state,n)),message:(e,t)=>(p||i.schema).$_createError("external",m,t,i.state,n,{messages:e})});if(void 0===a||a===m)continue;if(a instanceof l.Report){if(o.tracer.log(i.schema,i.state,"rule","external","error"),u.push(a),n.abortEarly)break;continue}if(Array.isArray(a)&&a[s.symbols.errors]){if(o.tracer.log(i.schema,i.state,"rule","external","error"),u.push(...a),n.abortEarly)break;continue}h?(o.tracer.value(i.state,"rule",m,a,"external"),h[f]=a):(o.tracer.value(i.state,"rule",t,a,"external"),t=a)}catch(e){throw n.errors.label&&(e.message+=` (${i.label})`),e}}if(i.value=t,u.length)throw i.error=l.process(u,e,n),o.debug&&(i.error.debug=o.debug),i.error}if(!n.warnings&&!n.debug&&!n.artifacts)return i.value;const u={value:i.value};return o.warnings.length&&(u.warning=l.details(o.warnings)),o.debug&&(u.debug=o.debug),o.artifacts&&(u.artifacts=o.artifacts),u},c.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()}},c.entry=function(e,r,n){const{tracer:i,cleanup:o}=c.tracer(r,n),a=n.debug?[]:null,s=r._ids._schemaChain?new Map:null,d=new c.Mainstay(i,a,s),p=r._ids._schemaChain?[{schema:r}]:null,f=new u([],[],{mainstay:d,schemas:p}),h=t.validate(e,r,f,n);o&&r.$_root.untrace();const m=l.process(h.errors,e,n);return{value:h.value,error:m,mainstay:d}},c.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:c.ignore}},t.validate=function(e,t,r,n,i={}){if(t.$_terms.whens&&(t=t._generate(e,r,n).schema),t._preferences&&(n=c.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 o=(i,o,a)=>t.$_createError(i,e,o,a||r,n),a={original:e,prefs:n,schema:t,state:r,error:o,errorsArray:c.errorsArray,warn:(e,t,n)=>r.mainstay.warnings.push(o(e,t,n)),message:(i,o)=>t.$_createError("custom",e,o,r,n,{messages:i})};r.mainstay.tracer.entry(t,r);const l=t._definition;if(l.prepare&&void 0!==e&&n.convert){const t=l.prepare(e,a);if(t){if(r.mainstay.tracer.value(r,"prepare",e,t.value),t.errors)return c.finalize(t.value,[].concat(t.errors),a);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,a);if(t){if(r.mainstay.tracer.value(r,"coerced",e,t.value),t.errors)return c.finalize(t.value,[].concat(t.errors),a);e=t.value}}const u=t._flags.empty;u&&u.$_match(c.trim(e,t),r.nest(u),s.defaults)&&(r.mainstay.tracer.value(r,"empty",e,void 0),e=void 0);const d=i.presence||t._flags.presence||(t._flags._endedSwitch?null:n.presence);if(void 0===e){if("forbidden"===d)return c.finalize(e,null,a);if("required"===d)return c.finalize(e,[t.$_createError("any.required",e,null,r,n)],a);if("optional"===d){if(t._flags.default!==s.symbols.deepDefault)return c.finalize(e,null,a);r.mainstay.tracer.value(r,"default",e,{}),e={}}}else if("forbidden"===d)return c.finalize(e,[t.$_createError("any.unknown",e,null,r,n)],a);const p=[];if(t._valids){const i=t._valids.get(e,r,n,t._flags.insensitive);if(i)return n.convert&&(r.mainstay.tracer.value(r,"valids",e,i.value),e=i.value),r.mainstay.tracer.filter(t,r,"valid",i),c.finalize(e,null,a);if(t._flags.only){const i=t.$_createError("any.only",e,{valids:t._valids.values({display:!0})},r,n);if(n.abortEarly)return c.finalize(e,[i],a);p.push(i)}}if(t._invalids){const i=t._invalids.get(e,r,n,t._flags.insensitive);if(i){r.mainstay.tracer.filter(t,r,"invalid",i);const o=t.$_createError("any.invalid",e,{invalids:t._invalids.values({display:!0})},r,n);if(n.abortEarly)return c.finalize(e,[o],a);p.push(o)}}if(l.validate){const t=l.validate(e,a);if(t&&(r.mainstay.tracer.value(r,"base",e,t.value),e=t.value,t.errors)){if(!Array.isArray(t.errors))return p.push(t.errors),c.finalize(e,p,a);if(t.errors.length)return p.push(...t.errors),c.finalize(e,p,a)}}return t._rules.length?c.rules(e,p,a):c.finalize(e,p,a)},c.rules=function(e,t,r){const{schema:n,state:i,prefs:o}=r;for(const a of n._rules){const l=n._definition.rules[a.method];if(l.convert&&o.convert){i.mainstay.tracer.log(n,i,"rule",a.name,"full");continue}let u,d=a.args;if(a._resolve.length){d=Object.assign({},d);for(const t of a._resolve){const r=l.argsByName.get(t),a=d[t].resolve(e,i,o),c=r.normalize?r.normalize(a):a,p=s.validateArg(c,null,r);if(p){u=n.$_createError("any.ref",a,{arg:t,ref:d[t],reason:p},i,o);break}d[t]=c}}u=u||l.validate(e,r,d,a);const p=c.rule(u,a);if(p.errors){if(i.mainstay.tracer.log(n,i,"rule",a.name,"error"),a.warn){i.mainstay.warnings.push(...p.errors);continue}if(o.abortEarly)return c.finalize(e,p.errors,r);t.push(...p.errors)}else i.mainstay.tracer.log(n,i,"rule",a.name,"pass"),i.mainstay.tracer.value(i,"rule",e,p.value,a.name),e=p.value}return c.finalize(e,t,r)},c.rule=function(e,t){return e instanceof l.Report?(c.error(e,t),{errors:[e],value:null}):Array.isArray(e)&&e[s.symbols.errors]?(e.forEach((e=>c.error(e,t))),{errors:e,value:null}):{errors:null,value:e}},c.error=function(e,t){return t.message&&e._setTemplate(t.message),e},c.finalize=function(e,t,r){t=t||[];const{schema:i,state:o,prefs:a}=r;if(t.length){const n=c.default("failover",void 0,t,r);void 0!==n&&(o.mainstay.tracer.value(o,"failover",e,n),e=n,t=[])}if(t.length&&i._flags.error)if("function"==typeof i._flags.error){t=i._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=[i._flags.error];if(void 0===e){const n=c.default("default",e,t,r);o.mainstay.tracer.value(o,"default",e,n),e=n}if(i._flags.cast&&void 0!==e){const t=i._definition.cast[i._flags.cast];if(t.from(e)){const n=t.to(e,r);o.mainstay.tracer.value(o,"cast",e,n,i._flags.cast),e=n}}if(i.$_terms.externals&&a.externals&&!1!==a._externals)for(const{method:e}of i.$_terms.externals)o.mainstay.externals.push({method:e,schema:i,state:o,label:l.label(i._flags,o,a)});const s={value:e,errors:t.length?t:null};return i._flags.result&&(s.value="strip"===i._flags.result?void 0:r.original,o.mainstay.tracer.value(o,i._flags.result,e,s.value),o.shadow(e,i._flags.result)),i._cache&&!1!==a.cache&&!i._refs.length&&i._cache.set(r.original,s),void 0===e||s.errors||void 0===i._flags.artifact||(o.mainstay.artifacts=o.mainstay.artifacts||new Map,o.mainstay.artifacts.has(i._flags.artifact)||o.mainstay.artifacts.set(i._flags.artifact,[]),o.mainstay.artifacts.get(i._flags.artifact).push(o.path)),s},c.prefs=function(e,t){const r=t===s.defaults;return r&&e._preferences[s.symbols.prefs]?e._preferences[s.symbols.prefs]:(t=s.preferences(t,e._preferences),r&&(e._preferences[s.symbols.prefs]=t),t)},c.default=function(e,t,r,n){const{schema:o,state:a,prefs:l}=n,u=o._flags[e];if(l.noDefaults||void 0===u)return t;if(a.mainstay.tracer.log(o,a,"rule",e,"full"),!u)return u;if("function"==typeof u){const s=u.length?[i(a.ancestors[0]),n]:[];try{return u(...s)}catch(t){return void r.push(o.$_createError(`any.${e}`,null,{error:t},a,l))}}return"object"!=typeof u?u:u[s.symbols.literal]?u.literal:s.isResolvable(u)?u.resolve(t,a,l):i(u)},c.trim=function(e,t){if("string"!=typeof e)return e;const r=t.$_getRule("trim");return r&&r.args.enabled?e.trim():e},c.ignore={active:!1,debug:o,entry:o,filter:o,log:o,resolve:o,value:o},c.errorsArray=function(){const e=[];return e[s.symbols.errors]=!0,e}},2036:(e,t,r)=>{const{assert:n,deepEqual:i}=r(8870),o=r(8160),a={};e.exports=a.Values=class{constructor(e,t){this._values=new Set(e),this._refs=new Set(t),this._lowercase=a.lowercases(e),this._override=!1}get length(){return this._values.size+this._refs.size}add(e,t){o.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 a.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){o.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(i(t,e))return{value:t};if(t)for(const o of this._refs){const a=o.resolve(e,t,r,null,{in:!0});if(void 0===a)continue;const s=o.in&&"object"==typeof a?Array.isArray(a)?a:Object.keys(a):[a];for(const t of s)if(typeof t==typeof e)if(n&&e&&"string"==typeof e){if(t.toLowerCase()===e.toLowerCase())return{value:t,ref:o}}else if(i(t,e))return{value:t,ref:o}}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 a.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 a.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}},a.Values.prototype[o.symbols.values]=!0,a.Values.prototype.slice=a.Values.prototype.clone,a.lowercases=function(e){const t=new Map;if(e)for(const r of e)"string"==typeof r&&t.set(r.toLowerCase(),r);return t}},4958:(e,t,r)=>{r.r(t),r.d(t,{analyzeDomain:()=>h,analyzeEmail:()=>_,errorCodes:()=>i,ipRegex:()=>M,isDomainValid:()=>m,isEmailValid:()=>A,uriDecode:()=>q,uriRegex:()=>P,validateDomainOptions:()=>g});var n=r(1275);const i={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"};function o(e){return{code:e,error:i[e]}}const a=2,s=/[^\x00-\x7f]/,l=/[\x00-\x20@\:\/\\#!\$&\'\(\)\*\+,;=\?]/,u=/^[a-zA-Z](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/,c=/^[a-zA-Z0-9](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/,d=/^[a-zA-Z0-9_](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/,p=n.URL||URL;function f(e){return!!e.allow}function h(e,t={}){if(!e)return o("DOMAIN_NON_EMPTY_STRING");if("string"!=typeof e)throw new Error("Invalid input: domain must be a string");if(e.length>256)return o("DOMAIN_TOO_LONG");if(s.test(e)){if(!1===t.allowUnicode)return o("DOMAIN_INVALID_UNICODE_CHARS");e=e.normalize("NFC")}if(l.test(e))return o("DOMAIN_INVALID_CHARS");e=function(e){e.includes("%")&&(e=e.replace(/%/g,"%25"));try{return new p(`http://${e}`).host}catch(t){return e}}(e),t.allowFullyQualified&&"."===e[e.length-1]&&(e=e.slice(0,-1));const r=t.minDomainSegments||a,n=e.split(".");if(n.length<r)return o("DOMAIN_SEGMENTS_COUNT");if(t.maxDomainSegments&&n.length>t.maxDomainSegments)return o("DOMAIN_SEGMENTS_COUNT_MAX");const i=t.tlds;if(i){const e=n[n.length-1].toLowerCase();if(f(i)){if(!i.allow.has(e))return o("DOMAIN_FORBIDDEN_TLDS")}else if(i.deny.has(e))return o("DOMAIN_FORBIDDEN_TLDS")}for(let e=0;e<n.length;++e){const r=n[e];if(!r.length)return o("DOMAIN_EMPTY_SEGMENT");if(r.length>63)return o("DOMAIN_LONG_SEGMENT");if(e<n.length-1){if(t.allowUnderscore){if(!d.test(r))return o("DOMAIN_INVALID_CHARS")}else if(!c.test(r))return o("DOMAIN_INVALID_CHARS")}else if(!u.test(r))return o("DOMAIN_INVALID_TLDS_CHARS")}return null}function m(e,t){return!h(e,t)}function g(e){if(e){if("object"!=typeof e.tlds)throw new Error("Invalid options: tlds must be a boolean or an object");if(f(e.tlds)){if(e.tlds.allow instanceof Set==0)throw new Error("Invalid options: tlds.allow must be a Set object or true");if(e.tlds.deny)throw new Error("Invalid options: cannot specify both tlds.allow and tlds.deny lists")}else if(e.tlds.deny instanceof Set==0)throw new Error("Invalid options: tlds.deny must be a Set object")}}var y=r(3975);const b=/[^\x00-\x7f]/,v=new(y.TextEncoder||TextEncoder);function _(e,t){return w(e,t)}function A(e,t){return!w(e,t)}function w(e,t={}){if("string"!=typeof e)throw new Error("Invalid input: email must be a string");if(!e)return o("EMPTY_STRING");const r=!b.test(e);if(!r){if(!1===t.allowUnicode)return o("FORBIDDEN_UNICODE");e=e.normalize("NFC")}const n=e.split("@");if(2!==n.length)return n.length>2?o("MULTIPLE_AT_CHAR"):o("MISSING_AT_CHAR");const[i,a]=n;if(!i)return o("EMPTY_LOCAL");if(!t.ignoreLength){if(e.length>254)return o("ADDRESS_TOO_LONG");if(v.encode(i).length>64)return o("LOCAL_TOO_LONG")}return function(e,t){const r=e.split(".");for(const e of r){if(!e.length)return o("EMPTY_LOCAL_SEGMENT");if(t){if(!S.test(e))return o("INVALID_LOCAL_CHARS")}else for(const t of e){if(S.test(t))continue;const e=T(t);if(!E.test(e))return o("INVALID_LOCAL_CHARS")}}return null}(i,r)||h(a,t)}function T(e){return Array.from(v.encode(e),(e=>String.fromCharCode(e))).join("")}const S=/^[\w!#\$%&'\*\+\-/=\?\^`\{\|\}~]+$/,E=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("|"));var O=r(375),x=r.n(O),C=r(6064),I=r.n(C);const j=function(){const e={},t="\\dA-Fa-f",r="["+t+"]",n="\\w-\\.~",i="!\\$&'\\(\\)\\*\\+,;=",o="%"+t,a=n+o+i+":@",s="["+a+"]",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 u=r+"{1,4}",c="(?:"+u+":"+u+"|"+e.ipv4address+")",d="(?:"+u+":){6}"+c,p="::(?:"+u+":){5}"+c,f="(?:"+u+")?::(?:"+u+":){4}"+c,h="(?:(?:"+u+":){0,1}"+u+")?::(?:"+u+":){3}"+c,m="(?:(?:"+u+":){0,2}"+u+")?::(?:"+u+":){2}"+c,g="(?:(?:"+u+":){0,3}"+u+")?::"+u+":"+c,y="(?:(?:"+u+":){0,4}"+u+")?::"+c,b="(?:(?:"+u+":){0,5}"+u+")?::"+u,v="(?:(?:"+u+":){0,6}"+u+")?::";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="(?:"+d+"|"+p+"|"+f+"|"+h+"|"+m+"|"+g+"|"+y+"|"+b+"|"+v+")",e.ipvFuture="v"+r+"+\\.["+n+i+":]+",e.scheme="[a-zA-Z][a-zA-Z\\d+-\\.]*",e.schemeRegex=new RegExp(e.scheme);const _="["+n+o+i+":]*",A="["+n+o+i+"]{1,255}",w="(?:\\[(?:"+e.ipv6address+"|"+e.ipvFuture+")\\]|"+e.ipv4address+"|"+A+")",T="(?:"+_+"@)?"+w+"(?::\\d*)?",S="(?:"+_+"@)?("+w+")(?::\\d*)?",E=s+"*",O=s+"+",x="(?:\\/"+E+")*",C="\\/(?:"+O+x+")?",I=O+x,j="["+n+o+i+"@]+"+x,R="(?:\\/\\/\\/"+E+x+")";return e.hierPart="(?:(?:\\/\\/"+T+x+")|"+C+"|"+I+"|"+R+")",e.hierPartCapture="(?:(?:\\/\\/"+S+x+")|"+C+"|"+I+")",e.relativeRef="(?:(?:\\/\\/"+T+x+")|"+C+"|"+j+"|)",e.relativeRefCapture="(?:(?:\\/\\/"+S+x+")|"+C+"|"+j+"|)",e.query="["+a+"\\/\\?]*(?=#|$)",e.queryWithSquareBrackets="["+a+"\\[\\]\\/\\?]*(?=#|$)",e.fragment="["+a+"\\/\\?]*",e}(),R={v4Cidr:j.ipv4Cidr,v6Cidr:j.ipv6Cidr,ipv4:j.ipv4address,ipv6:j.ipv6address,ipvfuture:j.ipvFuture};function D(e){const t=j,r="(?:\\?"+(e.allowQuerySquareBrackets?t.queryWithSquareBrackets:t.query)+")?(?:#"+t.fragment+")?",n=e.domain?t.relativeRefCapture:t.relativeRef;if(e.relativeOnly)return F(n+r);let i="";if(e.scheme){x()(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);x()(r.length>=1,"scheme must have at least 1 scheme specified");const n=[];for(let e=0;e<r.length;++e){const i=r[e];x()(i instanceof RegExp||"string"==typeof i,"scheme at position "+e+" must be a RegExp or String"),i instanceof RegExp?n.push(i.source.toString()):(x()(t.schemeRegex.test(i),"scheme at position "+e+" must be a valid scheme"),n.push(I()(i)))}i=n.join("|")}const o="(?:"+(i?"(?:"+i+")":t.scheme)+":"+(e.domain?t.hierPartCapture:t.hierPart)+")";return F((e.allowRelative?"(?:"+o+"|"+n+")":o)+r,i)}function F(e,t=null){return{raw:e=`(?=.)(?!https?:/(?:$|[^/]))(?!https?:///)(?!https?:[^/])${e}`,regex:new RegExp(`^${e}$`),scheme:t}}const N=D({});function P(e={}){return e.scheme||e.allowRelative||e.relativeOnly||e.allowQuerySquareBrackets||e.domain?D(e):N}function M(e={}){const t=e.cidr||"optional";x()(["required","optional","forbidden"].includes(t),"options.cidr must be one of required, optional, forbidden"),x()(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]),x()(r.length>=1,"options.version must have at least 1 version specified");for(const e of r)x()("string"==typeof e&&e===e.toLowerCase(),"Invalid options.version value"),x()(["ipv4","ipv6","ipvfuture"].includes(e),"options.version contains unknown version "+e+" - must be one of ipv4, ipv6, ipvfuture");r=Array.from(new Set(r));const n=`(?:${r.map((e=>{if("forbidden"===t)return R[e];const r=`\\/${"ipv4"===e?R.v4Cidr:R.v6Cidr}`;return"required"===t?`${R[e]}${r}`:`${R[e]}(?:${r})?`})).join("|")})`,i=new RegExp(`^${n}$`);return{cidr:t,versions:r,regex:i,raw:n}}const L={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15},k={accept:12,reject:0,data:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,7,7,7,7,7,7,7,7,7,7,7,7,8,7,7,10,9,9,9,11,4,4,4,4,4,4,4,4,4,4,4,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,24,36,48,60,72,84,96,0,12,12,12,0,0,0,0,0,0,0,0,0,0,0,24,0,0,0,0,0,0,0,0,0,24,24,24,0,0,0,0,0,0,0,0,0,24,24,0,0,0,0,0,0,0,0,0,0,48,48,48,0,0,0,0,0,0,0,0,0,0,48,48,0,0,0,0,0,0,0,0,0,48,0,0,0,0,0,0,0,0,0,0,127,63,63,63,0,31,15,15,15,7,7,7]};function q(e){let t=e.indexOf("%");if(-1===t)return e;let r="",n=0,i=0,o=t,a=k.accept;for(;t>-1&&t<e.length;){const s=$(e[t+1],4)|$(e[t+2],0),l=k.data[s];if(a=k.data[256+a+l],i=i<<6|s&k.data[364+l],a!==k.accept){if(a===k.reject)return null;if(t+=3,t>=e.length||"%"!==e[t])return null}else r+=e.slice(n,o),r+=i<=65535?String.fromCharCode(i):String.fromCharCode(55232+(i>>10),56320+(1023&i)),i=0,n=t+3,t=e.indexOf("%",n),o=t}return r+e.slice(n)}function $(e,t){const r=L[e];return void 0===r?255:r<<t}},4964:(e,t)=>{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,t={}){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=[],i="",o=0,a=!1;const s=e=>{if(o)throw new Error("Formula missing closing parenthesis");const s=n.length?n[n.length-1]:null;if(a||i||e){if(s&&"reference"===s.type&&")"===e)return s.type="function",s.value=this._subFormula(i,s.value),void(i="");if(")"===e){const e=new t.Parser(i,this.settings);n.push({type:"segment",value:e})}else if(a){if("]"===a)return n.push({type:"reference",value:i}),void(i="");n.push({type:"literal",value:i})}else if(r.operatorCharacters.includes(i))s&&"operator"===s.type&&r.operators.includes(s.value+i)?s.value+=i:n.push({type:"operator",value:i});else if(i.match(r.numberRx))n.push({type:"constant",value:parseFloat(i)});else if(void 0!==this.settings.constants[i])n.push({type:"constant",value:this.settings.constants[i]});else{if(!i.match(r.tokenRx))throw new Error(`Formula contains invalid token: ${i}`);n.push({type:"reference",value:i})}i=""}};for(const t of e)a?t===a?(s(),a=!1):i+=t:o?"("===t?(i+=t,++o):")"===t?(--o,o?i+=t:s(t)):i+=t:t in r.literals?a=r.literals[t]:"("===t?(s(),++o):r.operatorCharacters.includes(t)?(s(),i=t,s()):" "!==t?i+=t:s();s(),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 i=this.settings.functions[n];if("function"!=typeof i)throw new Error(`Formula contains unknown function ${n}`);let o=[];if(e){let t="",i=0,a=!1;const s=()=>{if(!t)throw new Error(`Formula contains function ${n} with invalid arguments ${e}`);o.push(t),t=""};for(let n=0;n<e.length;++n){const o=e[n];a?(t+=o,o===a&&(a=!1)):o in r.literals&&!i?(t+=o,a=r.literals[o]):","!==o||i?(t+=o,"("===o?++i:")"===o&&--i):s()}s()}return o=o.map((e=>new t.Parser(e,this.settings))),function(e){const t=[];for(const r of o)t.push(r.evaluate(e));return i.call(e,...t)}}evaluate(e){const t=this._parts.slice();for(let n=t.length-2;n>=0;--n){const i=t[n];if(i&&"operator"===i.type){const o=t[n+1];t.splice(n+1,1);const a=r.evaluate(o,e);t[n]=r.single(i.value,a)}}return r.operatorsOrder.forEach((n=>{for(let i=1;i<t.length-1;)if(n.includes(t[i])){const n=t[i],o=r.evaluate(t[i-1],e),a=r.evaluate(t[i+1],e);t.splice(i,2);const s=r.calculate(n,o,a);t[i-1]=0===s?0:s}else i+=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}},978:(e,t,r)=>{const n=r(375),i=r(8571),o=r(1687),a=r(9621),s={};e.exports=function(e,t,r={}){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 s.applyToDefaultsWithShallow(e,t,r);const a=i(e);if(!0===t)return a;const l=void 0!==r.nullOverride&&r.nullOverride;return o(a,t,{nullOverride:l,mergeArrays:!1})},s.applyToDefaultsWithShallow=function(e,t,r){const l=r.shallow;n(Array.isArray(l),"Invalid keys");const u=new Map,c=!0===t?null:new Set;for(let r of l){r=Array.isArray(r)?r:r.split(".");const n=a(e,r);n&&"object"==typeof n?u.set(n,c&&a(t,r)||n):c&&c.add(r)}const d=i(e,{},u);if(!c)return d;for(const e of c)s.reachCopy(d,t,e);const p=void 0!==r.nullOverride&&r.nullOverride;return o(d,t,{nullOverride:p,mergeArrays:!1})},s.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 i=e;for(let e=0;e<r.length-1;++e){const t=r[e];"object"!=typeof i[t]&&(i[t]={}),i=i[t]}i[r[r.length-1]]=n}},375:(e,t,r)=>{const n=r(4213),i=r(8761),o=e.exports=function(e,...t){if(e)return;if(1===t.length&&t[0]instanceof Error)throw t[0];const r=t.filter((e=>""!==e)).map((e=>"string"==typeof e?e:e instanceof Error?e.message:i(e)));throw new n(r.join(" "),o)}},4213:e=>{e.exports=class extends Error{constructor(e,t){var r,n,i,o;super(e||"Unknown error"),r=this,i="AssertError",(n="symbol"==typeof(o=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(n="name"))?o:String(o))in r?Object.defineProperty(r,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[n]=i,"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,t)}}},9367:e=>{const t={};e.exports=t.Bench=class{constructor(){this.ts=0,this.reset()}reset(){this.ts=t.Bench.now()}elapsed(){return t.Bench.now()-this.ts}static now(){const e=process.hrtime();return 1e3*e[0]+e[1]/1e6}}},8630:(e,t,r)=>{const n=r(738);e.exports=function(){return new Promise(n)}},8571:(e,t,r)=>{const n=r(9621),i=r(4277),o=r(7043),a={needsProtoHack:new Set([i.set,i.map,i.weakSet,i.weakMap])};e.exports=a.clone=function(e,t={},r=null){if("object"!=typeof e||null===e)return e;let n=a.clone,s=r;if(t.shallow){if(!0!==t.shallow)return a.cloneWithShallow(e,t);n=e=>e}else if(s){const t=s.get(e);if(t)return t}else s=new Map;const l=i.getInternalProto(e);switch(l){case i.buffer:return(!1).from(e);case i.date:return new Date(e.getTime());case i.regex:case i.url:return new l.constructor(e)}const u=a.base(e,l,t);if(u===e)return e;if(s&&s.set(e,u),l===i.set)for(const r of e)u.add(n(r,t,s));else if(l===i.map)for(const[r,i]of e)u.set(r,n(i,t,s));const c=o.keys(e,t);for(const r of c){if("__proto__"===r)continue;if(l===i.array&&"length"===r){u.length=e.length;continue}const o=Object.getOwnPropertyDescriptor(e,r);o?o.get||o.set?Object.defineProperty(u,r,o):o.enumerable?u[r]=n(e[r],t,s):Object.defineProperty(u,r,{enumerable:!1,writable:!0,configurable:!0,value:n(e[r],t,s)}):Object.defineProperty(u,r,{enumerable:!0,writable:!0,configurable:!0,value:n(e[r],t,s)})}return u},a.cloneWithShallow=function(e,t){const r=t.shallow;(t=Object.assign({},t)).shallow=!1;const i=new Map;for(const t of r){const r=n(e,t);"object"!=typeof r&&"function"!=typeof r||i.set(r,r)}return a.clone(e,t,i)},a.base=function(e,t,r){if(!1===r.prototype)return a.needsProtoHack.has(t)?new t.constructor:t===i.array?[]:{};const n=Object.getPrototypeOf(e);if(n&&n.isImmutable)return e;if(t===i.array){const e=[];return n!==t&&Object.setPrototypeOf(e,n),e}if(a.needsProtoHack.has(t)){const e=new n.constructor;return n!==t&&Object.setPrototypeOf(e,n),e}return Object.create(n)}},1467:(e,t,r)=>{const n=r(375),i=r(9474),o=r(6064),a=r(7043),s={};e.exports=function(e,t,r={}){return"object"!=typeof t&&(t=[t]),n(!Array.isArray(t)||t.length,"Values array cannot be empty"),"string"==typeof e?s.string(e,t,r):Array.isArray(e)?s.array(e,t,r):(n("object"==typeof e,"Reference must be string or an object"),s.object(e,t,r))},s.array=function(e,t,r){if(Array.isArray(t)||(t=[t]),!e.length)return!1;if(r.only&&r.once&&e.length!==t.length)return!1;let n;const i=new Map;for(const e of t)if(r.deep&&e&&"object"==typeof e){var o;n=null!==(o=n)&&void 0!==o?o:s.compare(r);let t=!1;for(const[r,o]of i.entries())if(n(r,e)){++o.allowed,t=!0;break}t||i.set(e,{allowed:1,hits:0})}else{const t=i.get(e);t?++t.allowed:i.set(e,{allowed:1,hits:0})}let a=0;for(const t of e){let e;if(r.deep&&t&&"object"==typeof t){var l;n=null!==(l=n)&&void 0!==l?l:s.compare(r);for(const[r,o]of i.entries())if(n(r,t)){e=o;break}}else e=i.get(t);if(e&&(++e.hits,++a,r.once&&e.hits>e.allowed))return!1}if(r.only&&a!==e.length)return!1;for(const e of i.values())if(e.hits!==e.allowed&&e.hits<e.allowed&&!r.part)return!1;return!!a},s.object=function(e,t,r){n(void 0===r.once,"Cannot use option once with object");const i=a.keys(e,r);if(!i.length)return!1;if(Array.isArray(t))return s.array(i,t,r);const o=Object.getOwnPropertySymbols(t).filter((e=>t.propertyIsEnumerable(e))),l=[...Object.keys(t),...o],u=s.compare(r),c=new Set(l);for(const n of i)if(c.has(n)){if(!u(t[n],e[n]))return!1;c.delete(n)}else if(r.only)return!1;return!c.size||!!r.part&&c.size<l.length},s.string=function(e,t,r){if(""===e)return 1===t.length&&""===t[0]||!r.once&&!t.some((e=>""!==e));const i=new Map,a=[];for(const e of t)if(n("string"==typeof e,"Cannot compare string reference to non-string value"),e){const t=i.get(e);t?++t.allowed:(i.set(e,{allowed:1,hits:0}),a.push(o(e)))}else if(r.once||r.only)return!1;if(!a.length)return!0;const s=new RegExp(`(${a.join("|")})`,"g"),l=e.replace(s,((e,t)=>(++i.get(t).hits,"")));if(r.only&&l)return!1;let u=!1;for(const e of i.values())if(e.hits&&(u=!0),e.hits!==e.allowed){if(e.hits<e.allowed&&!r.part)return!1;if(r.once)return!1}return!!u},s.compare=function(e){if(!e.deep)return s.shallow;const t=void 0!==e.only,r=void 0!==e.part,n={prototype:t?e.only:!!r&&!e.part,part:t?!e.only:!!r&&e.part};return(e,t)=>i(e,t,n)},s.shallow=function(e,t){return e===t}},9474:(e,t,r)=>{const n=r(4277),i={mismatched:null};e.exports=function(e,t,r){return r=Object.assign({prototype:!0},r),!!i.isDeepEqual(e,t,r,[])},i.isDeepEqual=function(e,t,r,o){if(e===t)return 0!==e||1/e==1/t;const a=typeof e;if(a!==typeof t)return!1;if(null===e||null===t)return!1;if("function"===a){if(!r.deepFunction||e.toString()!==t.toString())return!1}else if("object"!==a)return e!=e&&t!=t;const s=i.getSharedType(e,t,!!r.prototype);switch(s){case n.buffer:return!1;case n.promise:return e===t;case n.regex:case n.url:return e.toString()===t.toString();case i.mismatched:return!1}for(let r=o.length-1;r>=0;--r)if(o[r].isSame(e,t))return!0;o.push(new i.SeenEntry(e,t));try{return!!i.isDeepEqualObj(s,e,t,r,o)}finally{o.pop()}},i.getSharedType=function(e,t,r){if(r)return Object.getPrototypeOf(e)!==Object.getPrototypeOf(t)?i.mismatched:n.getInternalProto(e);const o=n.getInternalProto(e);return o!==n.getInternalProto(t)?i.mismatched:o},i.valueOf=function(e){const t=e.valueOf;if(void 0===t)return e;try{return t.call(e)}catch(e){return e}},i.hasOwnEnumerableProperty=function(e,t){return Object.prototype.propertyIsEnumerable.call(e,t)},i.isSetSimpleEqual=function(e,t){for(const r of Set.prototype.values.call(e))if(!Set.prototype.has.call(t,r))return!1;return!0},i.isDeepEqualObj=function(e,t,r,o,a){const{isDeepEqual:s,valueOf:l,hasOwnEnumerableProperty:u}=i,{keys:c,getOwnPropertySymbols:d}=Object;if(e===n.array){if(!o.part){if(t.length!==r.length)return!1;for(let e=0;e<t.length;++e)if(!s(t[e],r[e],o,a))return!1;return!0}for(const e of t)for(const t of r)if(s(e,t,o,a))return!0}else if(e===n.set){if(t.size!==r.size)return!1;if(!i.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(s(r,n,o,a)){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(!s(n,Map.prototype.get.call(r,e),o,a))return!1}}else if(e===n.error&&(t.name!==r.name||t.message!==r.message))return!1;const p=l(t),f=l(r);if((t!==p||r!==f)&&!s(p,f,o,a))return!1;const h=c(t);if(!o.part&&h.length!==c(r).length&&!o.skip)return!1;let m=0;for(const e of h)if(o.skip&&o.skip.includes(e))void 0===r[e]&&++m;else{if(!u(r,e))return!1;if(!s(t[e],r[e],o,a))return!1}if(!o.part&&h.length-m!==c(r).length)return!1;if(!1!==o.symbols){const e=d(t),n=new Set(d(r));for(const i of e){var g;if(null===(g=o.skip)||void 0===g||!g.includes(i))if(u(t,i)){if(!u(r,i))return!1;if(!s(t[i],r[i],o,a))return!1}else if(u(r,i))return!1;n.delete(i)}for(const e of n)if(u(r,e))return!1}return!0},i.SeenEntry=class{constructor(e,t){this.obj=e,this.ref=t}isSame(e,t){return this.obj===e&&this.ref===t}}},4168:(e,t,r)=>{const n=r(375);e.exports=function(e){return n(/^[ \w\!#\$%&'\(\)\*\+,\-\.\/\:;<\=>\?@\[\]\^`\{\|\}~\"\\]*$/.test(e),"Bad attribute value ("+e+")"),e.replace(/\\/g,"\\\\").replace(/\"/g,'\\"')}},5277:e=>{const t={};e.exports=function(e){if(!e)return"";let r="";for(let n=0;n<e.length;++n){const i=e.charCodeAt(n);t.isSafe(i)?r+=e[n]:r+=t.escapeHtmlChar(i)}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,"&amp;"],[60,"&lt;"],[62,"&gt;"],[34,"&quot;"],[160,"&nbsp;"],[162,"&cent;"],[163,"&pound;"],[164,"&curren;"],[169,"&copy;"],[174,"&reg;"]]),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}()},7973:e=>{const t={};e.exports=function(e){return e?e.replace(/[<>&\u2028\u2029]/g,t.escape):""},t.escape=function(e){return t.replacements.get(e)},t.replacements=new Map([["<","\\u003c"],[">","\\u003e"],["&","\\u0026"],["\u2028","\\u2028"],["\u2029","\\u2029"]])},6064:e=>{e.exports=function(e){return e.replace(/[\^\$\.\*\+\-\?\=\!\:\|\\\/\(\)\[\]\{\}\,]/g,"\\$&")}},655:e=>{const t={};e.exports=t.flatten=function(e,r){const n=r||[];for(const r of e)Array.isArray(r)?t.flatten(r,n):n.push(r);return n}},738:e=>{e.exports=function(){}},8870:(e,t,r)=>{t.applyToDefaults=r(978),t.assert=r(375),t.AssertError=r(4213),t.Bench=r(9367),t.block=r(8630),t.clone=r(8571),t.contain=r(1467),t.deepEqual=r(9474),t.escapeHeaderAttribute=r(4168),t.escapeHtml=r(5277),t.escapeJson=r(7973),t.escapeRegex=r(6064),t.flatten=r(655),t.ignore=r(738),t.intersect=r(5088),t.isPromise=r(7259),t.merge=r(1687),t.once=r(5022),t.reach=r(9621),t.reachTemplate=r(4069),t.stringify=r(8761),t.wait=r(2620)},5088:e=>{const t={};e.exports=function(e,r,n={}){if(!e||!r)return n.first?null:[];const i=[],o=Array.isArray(e)?new Set(e):e,a=new Set;for(const e of r)if(t.has(o,e)&&!a.has(e)){if(n.first)return e;i.push(e),a.add(e)}return n.first?null:i},t.has=function(e,t){return"function"==typeof e.has?e.has(t):void 0!==e[t]}},7259:e=>{e.exports=function(e){return"function"==typeof(null==e?void 0:e.then)}},1687:(e,t,r)=>{const n=r(375),i=r(8571),o=r(7043),a={};e.exports=a.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(i(t[n],{symbols:r.symbols}));return e}const s=o.keys(t,r);for(let n=0;n<s.length;++n){const o=s[n];if("__proto__"===o||!Object.prototype.propertyIsEnumerable.call(t,o))continue;const l=t[o];if(l&&"object"==typeof l){if(e[o]===l)continue;!e[o]||"object"!=typeof e[o]||Array.isArray(e[o])!==Array.isArray(l)||l instanceof Date||l instanceof RegExp?e[o]=i(l,{symbols:r.symbols}):a.merge(e[o],l,r)}else(null!=l||r.nullOverride)&&(e[o]=l)}return e}},5022:e=>{const t=Symbol("wrapped");e.exports=function(e){if(e[t])return e;let r=!1;const n=function(...t){r||(r=!0,e(...t))};return n[t]=!0,n}},9621:(e,t,r)=>{const n=r(375),i={};e.exports=function(e,t,r){if(!1===t||null==t)return e;"string"==typeof(r=r||{})&&(r={separator:r});const o=Array.isArray(t);n(!o||!r.separator,"Separator option is not valid for array-based chain");const a=o?t:t.split(r.separator||".");let s=e;for(let e=0;e<a.length;++e){let o=a[e];const l=r.iterables&&i.iterables(s);if(Array.isArray(s)||"set"===l){const e=Number(o);Number.isInteger(e)&&(o=e<0?s.length+e:e)}if(!s||"function"==typeof s&&!1===r.functions||!l&&void 0===s[o]){n(!r.strict||e+1===a.length,"Missing segment",o,"in reach path ",t),n("object"==typeof s||!0===r.functions||"function"!=typeof s,"Invalid segment",o,"in reach path ",t),s=r.default;break}s=l?"set"===l?[...s][o]:s.get(o):s[o]}return s},i.iterables=function(e){return e instanceof Set?"set":e instanceof Map?"map":void 0}},4069:(e,t,r)=>{const n=r(9621);e.exports=function(e,t,r){return t.replace(/{([^{}]+)}/g,((t,i)=>{const o=n(e,i,r);return null!=o?o:""}))}},8761:e=>{e.exports=function(...e){try{return JSON.stringify(...e)}catch(e){return"[Cannot display object: "+e.message+"]"}}},4277:(e,t)=>{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,url:URL.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 URL]",t.url],["[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)=>{t.keys=function(e,t={}){return!1!==t.symbols?Reflect.ownKeys(e):Object.getOwnPropertyNames(e)}},2620:e=>{e.exports=function(e,t,r){if("bigint"==typeof e&&(e=Number(e)),e>=Number.MAX_SAFE_INTEGER&&(e=1/0),"number"!=typeof e&&void 0!==e)throw new TypeError("Timeout must be a number or bigint");return new Promise((n=>{const i=r?r.setTimeout:setTimeout,o=()=>{const r=Math.min(e,2147483647);e-=r,i((()=>e>0?o():n(t)),r)};e!==1/0&&o()}))}},7593:(e,t)=>{t.location=function(e=0){const t=Error.prepareStackTrace;Error.prepareStackTrace=(e,t)=>t;const r={};Error.captureStackTrace(r,this);const n=r.stack[e+1];return Error.prepareStackTrace=t,{filename:n.getFileName(),line:n.getLineNumber()}}},6264:(e,t,r)=>{r.r(t),r.d(t,{tlds:()=>n});const n=new Set(["AAA","AARP","ABB","ABBOTT","ABBVIE","ABC","ABLE","ABOGADO","ABUDHABI","AC","ACADEMY","ACCENTURE","ACCOUNTANT","ACCOUNTANTS","ACO","ACTOR","AD","ADS","ADULT","AE","AEG","AERO","AETNA","AF","AFL","AFRICA","AG","AGAKHAN","AGENCY","AI","AIG","AIRBUS","AIRFORCE","AIRTEL","AKDN","AL","ALIBABA","ALIPAY","ALLFINANZ","ALLSTATE","ALLY","ALSACE","ALSTOM","AM","AMAZON","AMERICANEXPRESS","AMERICANFAMILY","AMEX","AMFAM","AMICA","AMSTERDAM","ANALYTICS","ANDROID","ANQUAN","ANZ","AO","AOL","APARTMENTS","APP","APPLE","AQ","AQUARELLE","AR","ARAB","ARAMCO","ARCHI","ARMY","ARPA","ART","ARTE","AS","ASDA","ASIA","ASSOCIATES","AT","ATHLETA","ATTORNEY","AU","AUCTION","AUDI","AUDIBLE","AUDIO","AUSPOST","AUTHOR","AUTO","AUTOS","AVIANCA","AW","AWS","AX","AXA","AZ","AZURE","BA","BABY","BAIDU","BANAMEX","BANANAREPUBLIC","BAND","BANK","BAR","BARCELONA","BARCLAYCARD","BARCLAYS","BAREFOOT","BARGAINS","BASEBALL","BASKETBALL","BAUHAUS","BAYERN","BB","BBC","BBT","BBVA","BCG","BCN","BD","BE","BEATS","BEAUTY","BEER","BENTLEY","BERLIN","BEST","BESTBUY","BET","BF","BG","BH","BHARTI","BI","BIBLE","BID","BIKE","BING","BINGO","BIO","BIZ","BJ","BLACK","BLACKFRIDAY","BLOCKBUSTER","BLOG","BLOOMBERG","BLUE","BM","BMS","BMW","BN","BNPPARIBAS","BO","BOATS","BOEHRINGER","BOFA","BOM","BOND","BOO","BOOK","BOOKING","BOSCH","BOSTIK","BOSTON","BOT","BOUTIQUE","BOX","BR","BRADESCO","BRIDGESTONE","BROADWAY","BROKER","BROTHER","BRUSSELS","BS","BT","BUILD","BUILDERS","BUSINESS","BUY","BUZZ","BV","BW","BY","BZ","BZH","CA","CAB","CAFE","CAL","CALL","CALVINKLEIN","CAM","CAMERA","CAMP","CANON","CAPETOWN","CAPITAL","CAPITALONE","CAR","CARAVAN","CARDS","CARE","CAREER","CAREERS","CARS","CASA","CASE","CASH","CASINO","CAT","CATERING","CATHOLIC","CBA","CBN","CBRE","CBS","CC","CD","CENTER","CEO","CERN","CF","CFA","CFD","CG","CH","CHANEL","CHANNEL","CHARITY","CHASE","CHAT","CHEAP","CHINTAI","CHRISTMAS","CHROME","CHURCH","CI","CIPRIANI","CIRCLE","CISCO","CITADEL","CITI","CITIC","CITY","CITYEATS","CK","CL","CLAIMS","CLEANING","CLICK","CLINIC","CLINIQUE","CLOTHING","CLOUD","CLUB","CLUBMED","CM","CN","CO","COACH","CODES","COFFEE","COLLEGE","COLOGNE","COM","COMCAST","COMMBANK","COMMUNITY","COMPANY","COMPARE","COMPUTER","COMSEC","CONDOS","CONSTRUCTION","CONSULTING","CONTACT","CONTRACTORS","COOKING","COOL","COOP","CORSICA","COUNTRY","COUPON","COUPONS","COURSES","CPA","CR","CREDIT","CREDITCARD","CREDITUNION","CRICKET","CROWN","CRS","CRUISE","CRUISES","CU","CUISINELLA","CV","CW","CX","CY","CYMRU","CYOU","CZ","DABUR","DAD","DANCE","DATA","DATE","DATING","DATSUN","DAY","DCLK","DDS","DE","DEAL","DEALER","DEALS","DEGREE","DELIVERY","DELL","DELOITTE","DELTA","DEMOCRAT","DENTAL","DENTIST","DESI","DESIGN","DEV","DHL","DIAMONDS","DIET","DIGITAL","DIRECT","DIRECTORY","DISCOUNT","DISCOVER","DISH","DIY","DJ","DK","DM","DNP","DO","DOCS","DOCTOR","DOG","DOMAINS","DOT","DOWNLOAD","DRIVE","DTV","DUBAI","DUNLOP","DUPONT","DURBAN","DVAG","DVR","DZ","EARTH","EAT","EC","ECO","EDEKA","EDU","EDUCATION","EE","EG","EMAIL","EMERCK","ENERGY","ENGINEER","ENGINEERING","ENTERPRISES","EPSON","EQUIPMENT","ER","ERICSSON","ERNI","ES","ESQ","ESTATE","ET","ETISALAT","EU","EUROVISION","EUS","EVENTS","EXCHANGE","EXPERT","EXPOSED","EXPRESS","EXTRASPACE","FAGE","FAIL","FAIRWINDS","FAITH","FAMILY","FAN","FANS","FARM","FARMERS","FASHION","FAST","FEDEX","FEEDBACK","FERRARI","FERRERO","FI","FIDELITY","FIDO","FILM","FINAL","FINANCE","FINANCIAL","FIRE","FIRESTONE","FIRMDALE","FISH","FISHING","FIT","FITNESS","FJ","FK","FLICKR","FLIGHTS","FLIR","FLORIST","FLOWERS","FLY","FM","FO","FOO","FOOD","FOOTBALL","FORD","FOREX","FORSALE","FORUM","FOUNDATION","FOX","FR","FREE","FRESENIUS","FRL","FROGANS","FRONTDOOR","FRONTIER","FTR","FUJITSU","FUN","FUND","FURNITURE","FUTBOL","FYI","GA","GAL","GALLERY","GALLO","GALLUP","GAME","GAMES","GAP","GARDEN","GAY","GB","GBIZ","GD","GDN","GE","GEA","GENT","GENTING","GEORGE","GF","GG","GGEE","GH","GI","GIFT","GIFTS","GIVES","GIVING","GL","GLASS","GLE","GLOBAL","GLOBO","GM","GMAIL","GMBH","GMO","GMX","GN","GODADDY","GOLD","GOLDPOINT","GOLF","GOO","GOODYEAR","GOOG","GOOGLE","GOP","GOT","GOV","GP","GQ","GR","GRAINGER","GRAPHICS","GRATIS","GREEN","GRIPE","GROCERY","GROUP","GS","GT","GU","GUARDIAN","GUCCI","GUGE","GUIDE","GUITARS","GURU","GW","GY","HAIR","HAMBURG","HANGOUT","HAUS","HBO","HDFC","HDFCBANK","HEALTH","HEALTHCARE","HELP","HELSINKI","HERE","HERMES","HIPHOP","HISAMITSU","HITACHI","HIV","HK","HKT","HM","HN","HOCKEY","HOLDINGS","HOLIDAY","HOMEDEPOT","HOMEGOODS","HOMES","HOMESENSE","HONDA","HORSE","HOSPITAL","HOST","HOSTING","HOT","HOTELS","HOTMAIL","HOUSE","HOW","HR","HSBC","HT","HU","HUGHES","HYATT","HYUNDAI","IBM","ICBC","ICE","ICU","ID","IE","IEEE","IFM","IKANO","IL","IM","IMAMAT","IMDB","IMMO","IMMOBILIEN","IN","INC","INDUSTRIES","INFINITI","INFO","ING","INK","INSTITUTE","INSURANCE","INSURE","INT","INTERNATIONAL","INTUIT","INVESTMENTS","IO","IPIRANGA","IQ","IR","IRISH","IS","ISMAILI","IST","ISTANBUL","IT","ITAU","ITV","JAGUAR","JAVA","JCB","JE","JEEP","JETZT","JEWELRY","JIO","JLL","JM","JMP","JNJ","JO","JOBS","JOBURG","JOT","JOY","JP","JPMORGAN","JPRS","JUEGOS","JUNIPER","KAUFEN","KDDI","KE","KERRYHOTELS","KERRYLOGISTICS","KERRYPROPERTIES","KFH","KG","KH","KI","KIA","KIDS","KIM","KINDER","KINDLE","KITCHEN","KIWI","KM","KN","KOELN","KOMATSU","KOSHER","KP","KPMG","KPN","KR","KRD","KRED","KUOKGROUP","KW","KY","KYOTO","KZ","LA","LACAIXA","LAMBORGHINI","LAMER","LANCASTER","LAND","LANDROVER","LANXESS","LASALLE","LAT","LATINO","LATROBE","LAW","LAWYER","LB","LC","LDS","LEASE","LECLERC","LEFRAK","LEGAL","LEGO","LEXUS","LGBT","LI","LIDL","LIFE","LIFEINSURANCE","LIFESTYLE","LIGHTING","LIKE","LILLY","LIMITED","LIMO","LINCOLN","LINK","LIPSY","LIVE","LIVING","LK","LLC","LLP","LOAN","LOANS","LOCKER","LOCUS","LOL","LONDON","LOTTE","LOTTO","LOVE","LPL","LPLFINANCIAL","LR","LS","LT","LTD","LTDA","LU","LUNDBECK","LUXE","LUXURY","LV","LY","MA","MADRID","MAIF","MAISON","MAKEUP","MAN","MANAGEMENT","MANGO","MAP","MARKET","MARKETING","MARKETS","MARRIOTT","MARSHALLS","MATTEL","MBA","MC","MCKINSEY","MD","ME","MED","MEDIA","MEET","MELBOURNE","MEME","MEMORIAL","MEN","MENU","MERCKMSD","MG","MH","MIAMI","MICROSOFT","MIL","MINI","MINT","MIT","MITSUBISHI","MK","ML","MLB","MLS","MM","MMA","MN","MO","MOBI","MOBILE","MODA","MOE","MOI","MOM","MONASH","MONEY","MONSTER","MORMON","MORTGAGE","MOSCOW","MOTO","MOTORCYCLES","MOV","MOVIE","MP","MQ","MR","MS","MSD","MT","MTN","MTR","MU","MUSEUM","MUSIC","MV","MW","MX","MY","MZ","NA","NAB","NAGOYA","NAME","NATURA","NAVY","NBA","NC","NE","NEC","NET","NETBANK","NETFLIX","NETWORK","NEUSTAR","NEW","NEWS","NEXT","NEXTDIRECT","NEXUS","NF","NFL","NG","NGO","NHK","NI","NICO","NIKE","NIKON","NINJA","NISSAN","NISSAY","NL","NO","NOKIA","NORTON","NOW","NOWRUZ","NOWTV","NP","NR","NRA","NRW","NTT","NU","NYC","NZ","OBI","OBSERVER","OFFICE","OKINAWA","OLAYAN","OLAYANGROUP","OLDNAVY","OLLO","OM","OMEGA","ONE","ONG","ONL","ONLINE","OOO","OPEN","ORACLE","ORANGE","ORG","ORGANIC","ORIGINS","OSAKA","OTSUKA","OTT","OVH","PA","PAGE","PANASONIC","PARIS","PARS","PARTNERS","PARTS","PARTY","PAY","PCCW","PE","PET","PF","PFIZER","PG","PH","PHARMACY","PHD","PHILIPS","PHONE","PHOTO","PHOTOGRAPHY","PHOTOS","PHYSIO","PICS","PICTET","PICTURES","PID","PIN","PING","PINK","PIONEER","PIZZA","PK","PL","PLACE","PLAY","PLAYSTATION","PLUMBING","PLUS","PM","PN","PNC","POHL","POKER","POLITIE","PORN","POST","PR","PRAMERICA","PRAXI","PRESS","PRIME","PRO","PROD","PRODUCTIONS","PROF","PROGRESSIVE","PROMO","PROPERTIES","PROPERTY","PROTECTION","PRU","PRUDENTIAL","PS","PT","PUB","PW","PWC","PY","QA","QPON","QUEBEC","QUEST","RACING","RADIO","RE","READ","REALESTATE","REALTOR","REALTY","RECIPES","RED","REDSTONE","REDUMBRELLA","REHAB","REISE","REISEN","REIT","RELIANCE","REN","RENT","RENTALS","REPAIR","REPORT","REPUBLICAN","REST","RESTAURANT","REVIEW","REVIEWS","REXROTH","RICH","RICHARDLI","RICOH","RIL","RIO","RIP","RO","ROCHER","ROCKS","RODEO","ROGERS","ROOM","RS","RSVP","RU","RUGBY","RUHR","RUN","RW","RWE","RYUKYU","SA","SAARLAND","SAFE","SAFETY","SAKURA","SALE","SALON","SAMSCLUB","SAMSUNG","SANDVIK","SANDVIKCOROMANT","SANOFI","SAP","SARL","SAS","SAVE","SAXO","SB","SBI","SBS","SC","SCA","SCB","SCHAEFFLER","SCHMIDT","SCHOLARSHIPS","SCHOOL","SCHULE","SCHWARZ","SCIENCE","SCOT","SD","SE","SEARCH","SEAT","SECURE","SECURITY","SEEK","SELECT","SENER","SERVICES","SEVEN","SEW","SEX","SEXY","SFR","SG","SH","SHANGRILA","SHARP","SHAW","SHELL","SHIA","SHIKSHA","SHOES","SHOP","SHOPPING","SHOUJI","SHOW","SHOWTIME","SI","SILK","SINA","SINGLES","SITE","SJ","SK","SKI","SKIN","SKY","SKYPE","SL","SLING","SM","SMART","SMILE","SN","SNCF","SO","SOCCER","SOCIAL","SOFTBANK","SOFTWARE","SOHU","SOLAR","SOLUTIONS","SONG","SONY","SOY","SPA","SPACE","SPORT","SPOT","SR","SRL","SS","ST","STADA","STAPLES","STAR","STATEBANK","STATEFARM","STC","STCGROUP","STOCKHOLM","STORAGE","STORE","STREAM","STUDIO","STUDY","STYLE","SU","SUCKS","SUPPLIES","SUPPLY","SUPPORT","SURF","SURGERY","SUZUKI","SV","SWATCH","SWISS","SX","SY","SYDNEY","SYSTEMS","SZ","TAB","TAIPEI","TALK","TAOBAO","TARGET","TATAMOTORS","TATAR","TATTOO","TAX","TAXI","TC","TCI","TD","TDK","TEAM","TECH","TECHNOLOGY","TEL","TEMASEK","TENNIS","TEVA","TF","TG","TH","THD","THEATER","THEATRE","TIAA","TICKETS","TIENDA","TIPS","TIRES","TIROL","TJ","TJMAXX","TJX","TK","TKMAXX","TL","TM","TMALL","TN","TO","TODAY","TOKYO","TOOLS","TOP","TORAY","TOSHIBA","TOTAL","TOURS","TOWN","TOYOTA","TOYS","TR","TRADE","TRADING","TRAINING","TRAVEL","TRAVELERS","TRAVELERSINSURANCE","TRUST","TRV","TT","TUBE","TUI","TUNES","TUSHU","TV","TVS","TW","TZ","UA","UBANK","UBS","UG","UK","UNICOM","UNIVERSITY","UNO","UOL","UPS","US","UY","UZ","VA","VACATIONS","VANA","VANGUARD","VC","VE","VEGAS","VENTURES","VERISIGN","VERSICHERUNG","VET","VG","VI","VIAJES","VIDEO","VIG","VIKING","VILLAS","VIN","VIP","VIRGIN","VISA","VISION","VIVA","VIVO","VLAANDEREN","VN","VODKA","VOLKSWAGEN","VOLVO","VOTE","VOTING","VOTO","VOYAGE","VU","WALES","WALMART","WALTER","WANG","WANGGOU","WATCH","WATCHES","WEATHER","WEATHERCHANNEL","WEBCAM","WEBER","WEBSITE","WED","WEDDING","WEIBO","WEIR","WF","WHOSWHO","WIEN","WIKI","WILLIAMHILL","WIN","WINDOWS","WINE","WINNERS","WME","WOLTERSKLUWER","WOODSIDE","WORK","WORKS","WORLD","WOW","WS","WTC","WTF","XBOX","XEROX","XFINITY","XIHUAN","XIN","XN--11B4C3D","XN--1CK2E1B","XN--1QQW23A","XN--2SCRJ9C","XN--30RR7Y","XN--3BST00M","XN--3DS443G","XN--3E0B707E","XN--3HCRJ9C","XN--3PXU8K","XN--42C2D9A","XN--45BR5CYL","XN--45BRJ9C","XN--45Q11C","XN--4DBRK0CE","XN--4GBRIM","XN--54B7FTA0CC","XN--55QW42G","XN--55QX5D","XN--5SU34J936BGSG","XN--5TZM5G","XN--6FRZ82G","XN--6QQ986B3XL","XN--80ADXHKS","XN--80AO21A","XN--80AQECDR1A","XN--80ASEHDB","XN--80ASWG","XN--8Y0A063A","XN--90A3AC","XN--90AE","XN--90AIS","XN--9DBQ2A","XN--9ET52U","XN--9KRT00A","XN--B4W605FERD","XN--BCK1B9A5DRE4C","XN--C1AVG","XN--C2BR7G","XN--CCK2B3B","XN--CCKWCXETD","XN--CG4BKI","XN--CLCHC0EA0B2G2A9GCD","XN--CZR694B","XN--CZRS0T","XN--CZRU2D","XN--D1ACJ3B","XN--D1ALF","XN--E1A4C","XN--ECKVDTC9D","XN--EFVY88H","XN--FCT429K","XN--FHBEI","XN--FIQ228C5HS","XN--FIQ64B","XN--FIQS8S","XN--FIQZ9S","XN--FJQ720A","XN--FLW351E","XN--FPCRJ9C3D","XN--FZC2C9E2C","XN--FZYS8D69UVGM","XN--G2XX48C","XN--GCKR3F0F","XN--GECRJ9C","XN--GK3AT1E","XN--H2BREG3EVE","XN--H2BRJ9C","XN--H2BRJ9C8C","XN--HXT814E","XN--I1B6B1A6A2E","XN--IMR513N","XN--IO0A7I","XN--J1AEF","XN--J1AMH","XN--J6W193G","XN--JLQ480N2RG","XN--JVR189M","XN--KCRX77D1X4A","XN--KPRW13D","XN--KPRY57D","XN--KPUT3I","XN--L1ACC","XN--LGBBAT1AD8J","XN--MGB9AWBF","XN--MGBA3A3EJT","XN--MGBA3A4F16A","XN--MGBA7C0BBN0A","XN--MGBAAKC7DVF","XN--MGBAAM7A8H","XN--MGBAB2BD","XN--MGBAH1A3HJKRD","XN--MGBAI9AZGQP6J","XN--MGBAYH7GPA","XN--MGBBH1A","XN--MGBBH1A71E","XN--MGBC0A9AZCG","XN--MGBCA7DZDO","XN--MGBCPQ6GPA1A","XN--MGBERP4A5D4AR","XN--MGBGU82A","XN--MGBI4ECEXP","XN--MGBPL2FH","XN--MGBT3DHD","XN--MGBTX2B","XN--MGBX4CD0AB","XN--MIX891F","XN--MK1BU44C","XN--MXTQ1M","XN--NGBC5AZD","XN--NGBE9E0A","XN--NGBRX","XN--NODE","XN--NQV7F","XN--NQV7FS00EMA","XN--NYQY26A","XN--O3CW4H","XN--OGBPF8FL","XN--OTU796D","XN--P1ACF","XN--P1AI","XN--PGBS0DH","XN--PSSY2U","XN--Q7CE6A","XN--Q9JYB4C","XN--QCKA1PMC","XN--QXA6A","XN--QXAM","XN--RHQV96G","XN--ROVU88B","XN--RVC1E0AM3E","XN--S9BRJ9C","XN--SES554G","XN--T60B56A","XN--TCKWE","XN--TIQ49XQYJ","XN--UNUP4Y","XN--VERMGENSBERATER-CTB","XN--VERMGENSBERATUNG-PWB","XN--VHQUV","XN--VUQ861B","XN--W4R85EL8FHU5DNRA","XN--W4RS40L","XN--WGBH1C","XN--WGBL6A","XN--XHQ521B","XN--XKC2AL3HYE2A","XN--XKC2DL3A5EE0H","XN--Y9A3AQ","XN--YFRO4I67O","XN--YGBI2AMMX","XN--ZFR164B","XXX","XYZ","YACHTS","YAHOO","YAMAXUN","YANDEX","YE","YODOBASHI","YOGA","YOKOHAMA","YOU","YOUTUBE","YT","YUN","ZA","ZAPPOS","ZARA","ZERO","ZIP","ZM","ZONE","ZUERICH","ZW"].map((e=>e.toLowerCase())))},3652:(e,t,r)=>{const{assert:n}=r(8870),i={};t.Sorter=class{constructor(){this._items=[],this.nodes=[]}add(e,t){var r,i,o,a,s;t=null!==(r=t)&&void 0!==r?r:{};const l=[].concat(null!==(i=t.before)&&void 0!==i?i:[]),u=[].concat(null!==(o=t.after)&&void 0!==o?o:[]),c=null!==(a=t.group)&&void 0!==a?a:"?",d=null!==(s=t.sort)&&void 0!==s?s:0;n(!l.includes(c),`Item cannot come before itself: ${c}`),n(!l.includes("?"),"Item cannot come before unassociated items"),n(!u.includes(c),`Item cannot come after itself: ${c}`),n(!u.includes("?"),"Item cannot come after unassociated items"),Array.isArray(e)||(e=[e]);for(const t of e){const e={seq:this._items.length,sort:d,before:l,after:u,group:c,node:t};this._items.push(e)}if(!t.manual){const e=this._sort();n(e,"item","?"!==c?`added into group ${c}`:"","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(i.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 o of this._items){var n;const a=o.seq,s=o.group;r[s]=null!==(n=r[s])&&void 0!==n?n:[],r[s].push(a),e[a]=o.before;for(const e of o.after){var i;t[e]=null!==(i=t[e])&&void 0!==i?i:[],t[e].push(a)}}for(const t in e){const n=[];for(const i in e[t]){var o;const a=e[t][i];r[a]=null!==(o=r[a])&&void 0!==o?o:[],n.push(...r[a])}e[t]=n}for(const n in t)if(r[n])for(const i of r[n])e[i].push(...t[n]);const a={};for(const t in e){const r=e[t];for(const e of r){var s;a[e]=null!==(s=a[e])&&void 0!==s?s:[],a[e].push(t)}}const l={},u=[];for(let e=0;e<this._items.length;++e){let t=e;if(a[e]){t=null;for(let e=0;e<this._items.length;++e){if(!0===l[e])continue;a[e]||(a[e]=[]);const r=a[e].length;let n=0;for(let t=0;t<r;++t)l[a[e][t]]&&++n;if(n===r){t=e;break}}}null!==t&&(l[t]=!0,u.push(t))}if(u.length!==this._items.length)return!1;const c={};for(const e of this._items)c[e.seq]=e;this._items=[],this.nodes=[];for(const e of u){const t=c[e];this.nodes.push(t.node),this._items.push(t)}return!0}},i.mergeSort=(e,t)=>e.sort===t.sort?0:e.sort<t.sort?-1:1},1275:()=>{},3975:()=>{},5934:e=>{e.exports=JSON.parse('{"version":"17.11.0"}')}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n](o,o.exports,r),o.exports}return r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(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=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r(5107)})(),e.exports=t()},3493:(e,t,r)=>{r(6603),e.exports=self.fetch.bind(self)},3103:(e,t,r)=>{var n=r(4715)(r(8942),"DataView");e.exports=n},9770:(e,t,r)=>{var n=r(4715)(r(8942),"Map");e.exports=n},9413:(e,t,r)=>{var n=r(4715)(r(8942),"Promise");e.exports=n},4512:(e,t,r)=>{var n=r(4715)(r(8942),"Set");e.exports=n},5650:(e,t,r)=>{var n=r(8942).Symbol;e.exports=n},9270:(e,t,r)=>{var n=r(4715)(r(8942),"WeakMap");e.exports=n},7379:(e,t,r)=>{var n=r(5650),i=r(8870),o=r(9005),a=n?n.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":a&&a in Object(e)?i(e):o(e)}},6027:(e,t,r)=>{var n=r(7379),i=r(547);e.exports=function(e){return i(e)&&"[object Arguments]"==n(e)}},9624:(e,t,r)=>{var n=r(3655),i=r(4759),o=r(1580),a=r(4066),s=/^\[object .+?Constructor\]$/,l=Function.prototype,u=Object.prototype,c=l.toString,d=u.hasOwnProperty,p=RegExp("^"+c.call(d).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=function(e){return!(!o(e)||i(e))&&(n(e)?p:s).test(a(e))}},674:(e,t,r)=>{var n=r(7379),i=r(5387),o=r(547),a={};a["[object Float32Array]"]=a["[object Float64Array]"]=a["[object Int8Array]"]=a["[object Int16Array]"]=a["[object Int32Array]"]=a["[object Uint8Array]"]=a["[object Uint8ClampedArray]"]=a["[object Uint16Array]"]=a["[object Uint32Array]"]=!0,a["[object Arguments]"]=a["[object Array]"]=a["[object ArrayBuffer]"]=a["[object Boolean]"]=a["[object DataView]"]=a["[object Date]"]=a["[object Error]"]=a["[object Function]"]=a["[object Map]"]=a["[object Number]"]=a["[object Object]"]=a["[object RegExp]"]=a["[object Set]"]=a["[object String]"]=a["[object WeakMap]"]=!1,e.exports=function(e){return o(e)&&i(e.length)&&!!a[n(e)]}},195:(e,t,r)=>{var n=r(4882),i=r(8121),o=Object.prototype.hasOwnProperty;e.exports=function(e){if(!n(e))return i(e);var t=[];for(var r in Object(e))o.call(e,r)&&"constructor"!=r&&t.push(r);return t}},6403:(e,t,r)=>{var n=r(2945),i=/^\s+/;e.exports=function(e){return e?e.slice(0,n(e)+1).replace(i,""):e}},9460:e=>{e.exports=function(e){return function(t){return e(t)}}},1950:(e,t,r)=>{var n=r(8942)["__core-js_shared__"];e.exports=n},4967:(e,t,r)=>{var n="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g;e.exports=n},4715:(e,t,r)=>{var n=r(9624),i=r(155);e.exports=function(e,t){var r=i(e,t);return n(r)?r:void 0}},8870:(e,t,r)=>{var n=r(5650),i=Object.prototype,o=i.hasOwnProperty,a=i.toString,s=n?n.toStringTag:void 0;e.exports=function(e){var t=o.call(e,s),r=e[s];try{e[s]=void 0;var n=!0}catch(e){}var i=a.call(e);return n&&(t?e[s]=r:delete e[s]),i}},8486:(e,t,r)=>{var n=r(3103),i=r(9770),o=r(9413),a=r(4512),s=r(9270),l=r(7379),u=r(4066),c="[object Map]",d="[object Promise]",p="[object Set]",f="[object WeakMap]",h="[object DataView]",m=u(n),g=u(i),y=u(o),b=u(a),v=u(s),_=l;(n&&_(new n(new ArrayBuffer(1)))!=h||i&&_(new i)!=c||o&&_(o.resolve())!=d||a&&_(new a)!=p||s&&_(new s)!=f)&&(_=function(e){var t=l(e),r="[object Object]"==t?e.constructor:void 0,n=r?u(r):"";if(n)switch(n){case m:return h;case g:return c;case y:return d;case b:return p;case v:return f}return t}),e.exports=_},155:e=>{e.exports=function(e,t){return null==e?void 0:e[t]}},4759:(e,t,r)=>{var n,i=r(1950),o=(n=/[^.]+$/.exec(i&&i.keys&&i.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"";e.exports=function(e){return!!o&&o in e}},4882:e=>{var t=Object.prototype;e.exports=function(e){var r=e&&e.constructor;return e===("function"==typeof r&&r.prototype||t)}},8121:(e,t,r)=>{var n=r(3766)(Object.keys,Object);e.exports=n},2306:(e,t,r)=>{e=r.nmd(e);var n=r(4967),i=t&&!t.nodeType&&t,o=i&&e&&!e.nodeType&&e,a=o&&o.exports===i&&n.process,s=function(){try{return o&&o.require&&o.require("util").types||a&&a.binding&&a.binding("util")}catch(e){}}();e.exports=s},9005:e=>{var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},3766:e=>{e.exports=function(e,t){return function(r){return e(t(r))}}},8942:(e,t,r)=>{var n=r(4967),i="object"==typeof self&&self&&self.Object===Object&&self,o=n||i||Function("return this")();e.exports=o},4066:e=>{var t=Function.prototype.toString;e.exports=function(e){if(null!=e){try{return t.call(e)}catch(e){}try{return e+""}catch(e){}}return""}},2945:e=>{var t=/\s/;e.exports=function(e){for(var r=e.length;r--&&t.test(e.charAt(r)););return r}},2784:(e,t,r)=>{var n=r(1580),i=r(4495),o=r(6131),a=Math.max,s=Math.min;e.exports=function(e,t,r){var l,u,c,d,p,f,h=0,m=!1,g=!1,y=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function b(t){var r=l,n=u;return l=u=void 0,h=t,d=e.apply(n,r)}function v(e){var r=e-f;return void 0===f||r>=t||r<0||g&&e-h>=c}function _(){var e=i();if(v(e))return A(e);p=setTimeout(_,function(e){var r=t-(e-f);return g?s(r,c-(e-h)):r}(e))}function A(e){return p=void 0,y&&l?b(e):(l=u=void 0,d)}function w(){var e=i(),r=v(e);if(l=arguments,u=this,f=e,r){if(void 0===p)return function(e){return h=e,p=setTimeout(_,t),m?b(e):d}(f);if(g)return clearTimeout(p),p=setTimeout(_,t),b(f)}return void 0===p&&(p=setTimeout(_,t)),d}return t=o(t)||0,n(r)&&(m=!!r.leading,c=(g="maxWait"in r)?a(o(r.maxWait)||0,t):c,y="trailing"in r?!!r.trailing:y),w.cancel=function(){void 0!==p&&clearTimeout(p),h=0,l=f=u=p=void 0},w.flush=function(){return void 0===p?d:A(i())},w}},3283:(e,t,r)=>{var n=r(6027),i=r(547),o=Object.prototype,a=o.hasOwnProperty,s=o.propertyIsEnumerable,l=n(function(){return arguments}())?n:function(e){return i(e)&&a.call(e,"callee")&&!s.call(e,"callee")};e.exports=l},3142:e=>{var t=Array.isArray;e.exports=t},6529:(e,t,r)=>{var n=r(3655),i=r(5387);e.exports=function(e){return null!=e&&i(e.length)&&!n(e)}},5853:(e,t,r)=>{e=r.nmd(e);var n=r(8942),i=r(4772),o=t&&!t.nodeType&&t,a=o&&e&&!e.nodeType&&e,s=a&&a.exports===o?n.Buffer:void 0,l=(s?s.isBuffer:void 0)||i;e.exports=l},3514:(e,t,r)=>{var n=r(195),i=r(8486),o=r(3283),a=r(3142),s=r(6529),l=r(5853),u=r(4882),c=r(8666),d=Object.prototype.hasOwnProperty;e.exports=function(e){if(null==e)return!0;if(s(e)&&(a(e)||"string"==typeof e||"function"==typeof e.splice||l(e)||c(e)||o(e)))return!e.length;var t=i(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(u(e))return!n(e).length;for(var r in e)if(d.call(e,r))return!1;return!0}},3655:(e,t,r)=>{var n=r(7379),i=r(1580);e.exports=function(e){if(!i(e))return!1;var t=n(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},5387:e=>{e.exports=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}},1580:e=>{e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},547:e=>{e.exports=function(e){return null!=e&&"object"==typeof e}},1187:(e,t,r)=>{var n=r(7379),i=r(547);e.exports=function(e){return"symbol"==typeof e||i(e)&&"[object Symbol]"==n(e)}},8666:(e,t,r)=>{var n=r(674),i=r(9460),o=r(2306),a=o&&o.isTypedArray,s=a?i(a):n;e.exports=s},5250:function(e,t,r){var n;e=r.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",s="__lodash_placeholder__",l=32,u=128,c=1/0,d=9007199254740991,p=NaN,f=4294967295,h=[["ary",u],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",l],["partialRight",64],["rearg",256]],m="[object Arguments]",g="[object Array]",y="[object Boolean]",b="[object Date]",v="[object Error]",_="[object Function]",A="[object GeneratorFunction]",w="[object Map]",T="[object Number]",S="[object Object]",E="[object Promise]",O="[object RegExp]",x="[object Set]",C="[object String]",I="[object Symbol]",j="[object WeakMap]",R="[object ArrayBuffer]",D="[object DataView]",F="[object Float32Array]",N="[object Float64Array]",P="[object Int8Array]",M="[object Int16Array]",L="[object Int32Array]",k="[object Uint8Array]",q="[object Uint8ClampedArray]",$="[object Uint16Array]",z="[object Uint32Array]",B=/\b__p \+= '';/g,G=/\b(__p \+=) '' \+/g,U=/(__e\(.*?\)|\b__t\)) \+\n'';/g,V=/&(?:amp|lt|gt|quot|#39);/g,H=/[&<>"']/g,Y=RegExp(V.source),X=RegExp(H.source),W=/<%-([\s\S]+?)%>/g,K=/<%([\s\S]+?)%>/g,Q=/<%=([\s\S]+?)%>/g,Z=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,J=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,re=RegExp(te.source),ne=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,se=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ue=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,de=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,fe=/^[-+]0x[0-9a-f]+$/i,he=/^0b[01]+$/i,me=/^\[object .+?Constructor\]$/,ge=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,be=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ve=/($^)/,_e=/['\n\r\u2028\u2029\\]/g,Ae="\\ud800-\\udfff",we="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Te="\\u2700-\\u27bf",Se="a-z\\xdf-\\xf6\\xf8-\\xff",Ee="A-Z\\xc0-\\xd6\\xd8-\\xde",Oe="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ce="["+Ae+"]",Ie="["+xe+"]",je="["+we+"]",Re="\\d+",De="["+Te+"]",Fe="["+Se+"]",Ne="[^"+Ae+xe+Re+Te+Se+Ee+"]",Pe="\\ud83c[\\udffb-\\udfff]",Me="[^"+Ae+"]",Le="(?:\\ud83c[\\udde6-\\uddff]){2}",ke="[\\ud800-\\udbff][\\udc00-\\udfff]",qe="["+Ee+"]",$e="\\u200d",ze="(?:"+Fe+"|"+Ne+")",Be="(?:"+qe+"|"+Ne+")",Ge="(?:['’](?:d|ll|m|re|s|t|ve))?",Ue="(?:['’](?:D|LL|M|RE|S|T|VE))?",Ve="(?:"+je+"|"+Pe+")?",He="["+Oe+"]?",Ye=He+Ve+"(?:"+$e+"(?:"+[Me,Le,ke].join("|")+")"+He+Ve+")*",Xe="(?:"+[De,Le,ke].join("|")+")"+Ye,We="(?:"+[Me+je+"?",je,Le,ke,Ce].join("|")+")",Ke=RegExp("['’]","g"),Qe=RegExp(je,"g"),Ze=RegExp(Pe+"(?="+Pe+")|"+We+Ye,"g"),Je=RegExp([qe+"?"+Fe+"+"+Ge+"(?="+[Ie,qe,"$"].join("|")+")",Be+"+"+Ue+"(?="+[Ie,qe+ze,"$"].join("|")+")",qe+"?"+ze+"+"+Ge,qe+"+"+Ue,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Re,Xe].join("|"),"g"),et=RegExp("["+$e+Ae+we+Oe+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,rt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],nt=-1,it={};it[F]=it[N]=it[P]=it[M]=it[L]=it[k]=it[q]=it[$]=it[z]=!0,it[m]=it[g]=it[R]=it[y]=it[D]=it[b]=it[v]=it[_]=it[w]=it[T]=it[S]=it[O]=it[x]=it[C]=it[j]=!1;var ot={};ot[m]=ot[g]=ot[R]=ot[D]=ot[y]=ot[b]=ot[F]=ot[N]=ot[P]=ot[M]=ot[L]=ot[w]=ot[T]=ot[S]=ot[O]=ot[x]=ot[C]=ot[I]=ot[k]=ot[q]=ot[$]=ot[z]=!0,ot[v]=ot[_]=ot[j]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},st=parseFloat,lt=parseInt,ut="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g,ct="object"==typeof self&&self&&self.Object===Object&&self,dt=ut||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ft=pt&&e&&!e.nodeType&&e,ht=ft&&ft.exports===pt,mt=ht&&ut.process,gt=function(){try{return ft&&ft.require&&ft.require("util").types||mt&&mt.binding&&mt.binding("util")}catch(e){}}(),yt=gt&&gt.isArrayBuffer,bt=gt&&gt.isDate,vt=gt&&gt.isMap,_t=gt&&gt.isRegExp,At=gt&&gt.isSet,wt=gt&&gt.isTypedArray;function Tt(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}function St(e,t,r,n){for(var i=-1,o=null==e?0:e.length;++i<o;){var a=e[i];t(n,a,r(a),e)}return n}function Et(e,t){for(var r=-1,n=null==e?0:e.length;++r<n&&!1!==t(e[r],r,e););return e}function Ot(e,t){for(var r=null==e?0:e.length;r--&&!1!==t(e[r],r,e););return e}function xt(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(!t(e[r],r,e))return!1;return!0}function Ct(e,t){for(var r=-1,n=null==e?0:e.length,i=0,o=[];++r<n;){var a=e[r];t(a,r,e)&&(o[i++]=a)}return o}function It(e,t){return!(null==e||!e.length)&&qt(e,t,0)>-1}function jt(e,t,r){for(var n=-1,i=null==e?0:e.length;++n<i;)if(r(t,e[n]))return!0;return!1}function Rt(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}function Dt(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}function Ft(e,t,r,n){var i=-1,o=null==e?0:e.length;for(n&&o&&(r=e[++i]);++i<o;)r=t(r,e[i],i,e);return r}function Nt(e,t,r,n){var i=null==e?0:e.length;for(n&&i&&(r=e[--i]);i--;)r=t(r,e[i],i,e);return r}function Pt(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}var Mt=Gt("length");function Lt(e,t,r){var n;return r(e,(function(e,r,i){if(t(e,r,i))return n=r,!1})),n}function kt(e,t,r,n){for(var i=e.length,o=r+(n?1:-1);n?o--:++o<i;)if(t(e[o],o,e))return o;return-1}function qt(e,t,r){return t==t?function(e,t,r){for(var n=r-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}(e,t,r):kt(e,zt,r)}function $t(e,t,r,n){for(var i=r-1,o=e.length;++i<o;)if(n(e[i],t))return i;return-1}function zt(e){return e!=e}function Bt(e,t){var r=null==e?0:e.length;return r?Ht(e,t)/r:p}function Gt(e){return function(t){return null==t?i:t[e]}}function Ut(e){return function(t){return null==e?i:e[t]}}function Vt(e,t,r,n,i){return i(e,(function(e,i,o){r=n?(n=!1,e):t(r,e,i,o)})),r}function Ht(e,t){for(var r,n=-1,o=e.length;++n<o;){var a=t(e[n]);a!==i&&(r=r===i?a:r+a)}return r}function Yt(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}function Xt(e){return e?e.slice(0,dr(e)+1).replace(ne,""):e}function Wt(e){return function(t){return e(t)}}function Kt(e,t){return Rt(t,(function(t){return e[t]}))}function Qt(e,t){return e.has(t)}function Zt(e,t){for(var r=-1,n=e.length;++r<n&&qt(t,e[r],0)>-1;);return r}function Jt(e,t){for(var r=e.length;r--&&qt(t,e[r],0)>-1;);return r}var er=Ut({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tr=Ut({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function rr(e){return"\\"+at[e]}function nr(e){return et.test(e)}function ir(e){var t=-1,r=Array(e.size);return e.forEach((function(e,n){r[++t]=[n,e]})),r}function or(e,t){return function(r){return e(t(r))}}function ar(e,t){for(var r=-1,n=e.length,i=0,o=[];++r<n;){var a=e[r];a!==t&&a!==s||(e[r]=s,o[i++]=r)}return o}function sr(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=e})),r}function lr(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=[e,e]})),r}function ur(e){return nr(e)?function(e){for(var t=Ze.lastIndex=0;Ze.test(e);)++t;return t}(e):Mt(e)}function cr(e){return nr(e)?function(e){return e.match(Ze)||[]}(e):function(e){return e.split("")}(e)}function dr(e){for(var t=e.length;t--&&ie.test(e.charAt(t)););return t}var pr=Ut({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"}),fr=function e(t){var r,n=(t=null==t?dt:fr.defaults(dt.Object(),t,fr.pick(dt,rt))).Array,ie=t.Date,Ae=t.Error,we=t.Function,Te=t.Math,Se=t.Object,Ee=t.RegExp,Oe=t.String,xe=t.TypeError,Ce=n.prototype,Ie=we.prototype,je=Se.prototype,Re=t["__core-js_shared__"],De=Ie.toString,Fe=je.hasOwnProperty,Ne=0,Pe=(r=/[^.]+$/.exec(Re&&Re.keys&&Re.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"",Me=je.toString,Le=De.call(Se),ke=dt._,qe=Ee("^"+De.call(Fe).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),$e=ht?t.Buffer:i,ze=t.Symbol,Be=t.Uint8Array,Ge=$e?$e.allocUnsafe:i,Ue=or(Se.getPrototypeOf,Se),Ve=Se.create,He=je.propertyIsEnumerable,Ye=Ce.splice,Xe=ze?ze.isConcatSpreadable:i,We=ze?ze.iterator:i,Ze=ze?ze.toStringTag:i,et=function(){try{var e=lo(Se,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==dt.clearTimeout&&t.clearTimeout,ut=ie&&ie.now!==dt.Date.now&&ie.now,ct=t.setTimeout!==dt.setTimeout&&t.setTimeout,pt=Te.ceil,ft=Te.floor,mt=Se.getOwnPropertySymbols,gt=$e?$e.isBuffer:i,Mt=t.isFinite,Ut=Ce.join,hr=or(Se.keys,Se),mr=Te.max,gr=Te.min,yr=ie.now,br=t.parseInt,vr=Te.random,_r=Ce.reverse,Ar=lo(t,"DataView"),wr=lo(t,"Map"),Tr=lo(t,"Promise"),Sr=lo(t,"Set"),Er=lo(t,"WeakMap"),Or=lo(Se,"create"),xr=Er&&new Er,Cr={},Ir=Lo(Ar),jr=Lo(wr),Rr=Lo(Tr),Dr=Lo(Sr),Fr=Lo(Er),Nr=ze?ze.prototype:i,Pr=Nr?Nr.valueOf:i,Mr=Nr?Nr.toString:i;function Lr(e){if(es(e)&&!Ga(e)&&!(e instanceof zr)){if(e instanceof $r)return e;if(Fe.call(e,"__wrapped__"))return ko(e)}return new $r(e)}var kr=function(){function e(){}return function(t){if(!Ja(t))return{};if(Ve)return Ve(t);e.prototype=t;var r=new e;return e.prototype=i,r}}();function qr(){}function $r(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function zr(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=f,this.__views__=[]}function Br(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Gr(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Ur(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Vr(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new Ur;++t<r;)this.add(e[t])}function Hr(e){var t=this.__data__=new Gr(e);this.size=t.size}function Yr(e,t){var r=Ga(e),n=!r&&Ba(e),i=!r&&!n&&Ya(e),o=!r&&!n&&!i&&ls(e),a=r||n||i||o,s=a?Yt(e.length,Oe):[],l=s.length;for(var u in e)!t&&!Fe.call(e,u)||a&&("length"==u||i&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||go(u,l))||s.push(u);return s}function Xr(e){var t=e.length;return t?e[Vn(0,t-1)]:i}function Wr(e,t){return Do(Oi(e),on(t,0,e.length))}function Kr(e){return Do(Oi(e))}function Qr(e,t,r){(r!==i&&!qa(e[t],r)||r===i&&!(t in e))&&rn(e,t,r)}function Zr(e,t,r){var n=e[t];Fe.call(e,t)&&qa(n,r)&&(r!==i||t in e)||rn(e,t,r)}function Jr(e,t){for(var r=e.length;r--;)if(qa(e[r][0],t))return r;return-1}function en(e,t,r,n){return cn(e,(function(e,i,o){t(n,e,r(e),o)})),n}function tn(e,t){return e&&xi(t,js(t),e)}function rn(e,t,r){"__proto__"==t&&et?et(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function nn(e,t){for(var r=-1,o=t.length,a=n(o),s=null==e;++r<o;)a[r]=s?i:Es(e,t[r]);return a}function on(e,t,r){return e==e&&(r!==i&&(e=e<=r?e:r),t!==i&&(e=e>=t?e:t)),e}function an(e,t,r,n,o,a){var s,l=1&t,u=2&t,c=4&t;if(r&&(s=o?r(e,n,o,a):r(e)),s!==i)return s;if(!Ja(e))return e;var d=Ga(e);if(d){if(s=function(e){var t=e.length,r=new e.constructor(t);return t&&"string"==typeof e[0]&&Fe.call(e,"index")&&(r.index=e.index,r.input=e.input),r}(e),!l)return Oi(e,s)}else{var p=po(e),f=p==_||p==A;if(Ya(e))return _i(e,l);if(p==S||p==m||f&&!o){if(s=u||f?{}:ho(e),!l)return u?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Rs(t),e)}(s,e)):function(e,t){return xi(e,uo(e),t)}(e,tn(s,e))}else{if(!ot[p])return o?e:{};s=function(e,t,r){var n,i=e.constructor;switch(t){case R:return Ai(e);case y:case b:return new i(+e);case D:return function(e,t){var r=t?Ai(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}(e,r);case F:case N:case P:case M:case L:case k:case q:case $:case z:return wi(e,r);case w:return new i;case T:case C:return new i(e);case O:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case I:return n=e,Pr?Se(Pr.call(n)):{}}}(e,p,l)}}a||(a=new Hr);var h=a.get(e);if(h)return h;a.set(e,s),os(e)?e.forEach((function(n){s.add(an(n,t,r,n,e,a))})):ts(e)&&e.forEach((function(n,i){s.set(i,an(n,t,r,i,e,a))}));var g=d?i:(c?u?to:eo:u?Rs:js)(e);return Et(g||e,(function(n,i){g&&(n=e[i=n]),Zr(s,i,an(n,t,r,i,e,a))})),s}function sn(e,t,r){var n=r.length;if(null==e)return!n;for(e=Se(e);n--;){var o=r[n],a=t[o],s=e[o];if(s===i&&!(o in e)||!a(s))return!1}return!0}function ln(e,t,r){if("function"!=typeof e)throw new xe(o);return Co((function(){e.apply(i,r)}),t)}function un(e,t,r,n){var i=-1,o=It,a=!0,s=e.length,l=[],u=t.length;if(!s)return l;r&&(t=Rt(t,Wt(r))),n?(o=jt,a=!1):t.length>=200&&(o=Qt,a=!1,t=new Vr(t));e:for(;++i<s;){var c=e[i],d=null==r?c:r(c);if(c=n||0!==c?c:0,a&&d==d){for(var p=u;p--;)if(t[p]===d)continue e;l.push(c)}else o(t,d,n)||l.push(c)}return l}Lr.templateSettings={escape:W,evaluate:K,interpolate:Q,variable:"",imports:{_:Lr}},Lr.prototype=qr.prototype,Lr.prototype.constructor=Lr,$r.prototype=kr(qr.prototype),$r.prototype.constructor=$r,zr.prototype=kr(qr.prototype),zr.prototype.constructor=zr,Br.prototype.clear=function(){this.__data__=Or?Or(null):{},this.size=0},Br.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Br.prototype.get=function(e){var t=this.__data__;if(Or){var r=t[e];return r===a?i:r}return Fe.call(t,e)?t[e]:i},Br.prototype.has=function(e){var t=this.__data__;return Or?t[e]!==i:Fe.call(t,e)},Br.prototype.set=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Or&&t===i?a:t,this},Gr.prototype.clear=function(){this.__data__=[],this.size=0},Gr.prototype.delete=function(e){var t=this.__data__,r=Jr(t,e);return!(r<0||(r==t.length-1?t.pop():Ye.call(t,r,1),--this.size,0))},Gr.prototype.get=function(e){var t=this.__data__,r=Jr(t,e);return r<0?i:t[r][1]},Gr.prototype.has=function(e){return Jr(this.__data__,e)>-1},Gr.prototype.set=function(e,t){var r=this.__data__,n=Jr(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this},Ur.prototype.clear=function(){this.size=0,this.__data__={hash:new Br,map:new(wr||Gr),string:new Br}},Ur.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Ur.prototype.get=function(e){return ao(this,e).get(e)},Ur.prototype.has=function(e){return ao(this,e).has(e)},Ur.prototype.set=function(e,t){var r=ao(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this},Vr.prototype.add=Vr.prototype.push=function(e){return this.__data__.set(e,a),this},Vr.prototype.has=function(e){return this.__data__.has(e)},Hr.prototype.clear=function(){this.__data__=new Gr,this.size=0},Hr.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},Hr.prototype.get=function(e){return this.__data__.get(e)},Hr.prototype.has=function(e){return this.__data__.has(e)},Hr.prototype.set=function(e,t){var r=this.__data__;if(r instanceof Gr){var n=r.__data__;if(!wr||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new Ur(n)}return r.set(e,t),this.size=r.size,this};var cn=ji(bn),dn=ji(vn,!0);function pn(e,t){var r=!0;return cn(e,(function(e,n,i){return r=!!t(e,n,i)})),r}function fn(e,t,r){for(var n=-1,o=e.length;++n<o;){var a=e[n],s=t(a);if(null!=s&&(l===i?s==s&&!ss(s):r(s,l)))var l=s,u=a}return u}function hn(e,t){var r=[];return cn(e,(function(e,n,i){t(e,n,i)&&r.push(e)})),r}function mn(e,t,r,n,i){var o=-1,a=e.length;for(r||(r=mo),i||(i=[]);++o<a;){var s=e[o];t>0&&r(s)?t>1?mn(s,t-1,r,n,i):Dt(i,s):n||(i[i.length]=s)}return i}var gn=Ri(),yn=Ri(!0);function bn(e,t){return e&&gn(e,t,js)}function vn(e,t){return e&&yn(e,t,js)}function _n(e,t){return Ct(t,(function(t){return Ka(e[t])}))}function An(e,t){for(var r=0,n=(t=gi(t,e)).length;null!=e&&r<n;)e=e[Mo(t[r++])];return r&&r==n?e:i}function wn(e,t,r){var n=t(e);return Ga(e)?n:Dt(n,r(e))}function Tn(e){return null==e?e===i?"[object Undefined]":"[object Null]":Ze&&Ze in Se(e)?function(e){var t=Fe.call(e,Ze),r=e[Ze];try{e[Ze]=i;var n=!0}catch(e){}var o=Me.call(e);return n&&(t?e[Ze]=r:delete e[Ze]),o}(e):function(e){return Me.call(e)}(e)}function Sn(e,t){return e>t}function En(e,t){return null!=e&&Fe.call(e,t)}function On(e,t){return null!=e&&t in Se(e)}function xn(e,t,r){for(var o=r?jt:It,a=e[0].length,s=e.length,l=s,u=n(s),c=1/0,d=[];l--;){var p=e[l];l&&t&&(p=Rt(p,Wt(t))),c=gr(p.length,c),u[l]=!r&&(t||a>=120&&p.length>=120)?new Vr(l&&p):i}p=e[0];var f=-1,h=u[0];e:for(;++f<a&&d.length<c;){var m=p[f],g=t?t(m):m;if(m=r||0!==m?m:0,!(h?Qt(h,g):o(d,g,r))){for(l=s;--l;){var y=u[l];if(!(y?Qt(y,g):o(e[l],g,r)))continue e}h&&h.push(g),d.push(m)}}return d}function Cn(e,t,r){var n=null==(e=Eo(e,t=gi(t,e)))?e:e[Mo(Wo(t))];return null==n?i:Tt(n,e,r)}function In(e){return es(e)&&Tn(e)==m}function jn(e,t,r,n,o){return e===t||(null==e||null==t||!es(e)&&!es(t)?e!=e&&t!=t:function(e,t,r,n,o,a){var s=Ga(e),l=Ga(t),u=s?g:po(e),c=l?g:po(t),d=(u=u==m?S:u)==S,p=(c=c==m?S:c)==S,f=u==c;if(f&&Ya(e)){if(!Ya(t))return!1;s=!0,d=!1}if(f&&!d)return a||(a=new Hr),s||ls(e)?Zi(e,t,r,n,o,a):function(e,t,r,n,i,o,a){switch(r){case D:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case R:return!(e.byteLength!=t.byteLength||!o(new Be(e),new Be(t)));case y:case b:case T:return qa(+e,+t);case v:return e.name==t.name&&e.message==t.message;case O:case C:return e==t+"";case w:var s=ir;case x:var l=1&n;if(s||(s=sr),e.size!=t.size&&!l)return!1;var u=a.get(e);if(u)return u==t;n|=2,a.set(e,t);var c=Zi(s(e),s(t),n,i,o,a);return a.delete(e),c;case I:if(Pr)return Pr.call(e)==Pr.call(t)}return!1}(e,t,u,r,n,o,a);if(!(1&r)){var h=d&&Fe.call(e,"__wrapped__"),_=p&&Fe.call(t,"__wrapped__");if(h||_){var A=h?e.value():e,E=_?t.value():t;return a||(a=new Hr),o(A,E,r,n,a)}}return!!f&&(a||(a=new Hr),function(e,t,r,n,o,a){var s=1&r,l=eo(e),u=l.length;if(u!=eo(t).length&&!s)return!1;for(var c=u;c--;){var d=l[c];if(!(s?d in t:Fe.call(t,d)))return!1}var p=a.get(e),f=a.get(t);if(p&&f)return p==t&&f==e;var h=!0;a.set(e,t),a.set(t,e);for(var m=s;++c<u;){var g=e[d=l[c]],y=t[d];if(n)var b=s?n(y,g,d,t,e,a):n(g,y,d,e,t,a);if(!(b===i?g===y||o(g,y,r,n,a):b)){h=!1;break}m||(m="constructor"==d)}if(h&&!m){var v=e.constructor,_=t.constructor;v==_||!("constructor"in e)||!("constructor"in t)||"function"==typeof v&&v instanceof v&&"function"==typeof _&&_ instanceof _||(h=!1)}return a.delete(e),a.delete(t),h}(e,t,r,n,o,a))}(e,t,r,n,jn,o))}function Rn(e,t,r,n){var o=r.length,a=o,s=!n;if(null==e)return!a;for(e=Se(e);o--;){var l=r[o];if(s&&l[2]?l[1]!==e[l[0]]:!(l[0]in e))return!1}for(;++o<a;){var u=(l=r[o])[0],c=e[u],d=l[1];if(s&&l[2]){if(c===i&&!(u in e))return!1}else{var p=new Hr;if(n)var f=n(c,d,u,e,t,p);if(!(f===i?jn(d,c,3,n,p):f))return!1}}return!0}function Dn(e){return!(!Ja(e)||(t=e,Pe&&Pe in t))&&(Ka(e)?qe:me).test(Lo(e));var t}function Fn(e){return"function"==typeof e?e:null==e?rl:"object"==typeof e?Ga(e)?kn(e[0],e[1]):Ln(e):dl(e)}function Nn(e){if(!Ao(e))return hr(e);var t=[];for(var r in Se(e))Fe.call(e,r)&&"constructor"!=r&&t.push(r);return t}function Pn(e,t){return e<t}function Mn(e,t){var r=-1,i=Va(e)?n(e.length):[];return cn(e,(function(e,n,o){i[++r]=t(e,n,o)})),i}function Ln(e){var t=so(e);return 1==t.length&&t[0][2]?To(t[0][0],t[0][1]):function(r){return r===e||Rn(r,e,t)}}function kn(e,t){return bo(e)&&wo(t)?To(Mo(e),t):function(r){var n=Es(r,e);return n===i&&n===t?Os(r,e):jn(t,n,3)}}function qn(e,t,r,n,o){e!==t&&gn(t,(function(a,s){if(o||(o=new Hr),Ja(a))!function(e,t,r,n,o,a,s){var l=Oo(e,r),u=Oo(t,r),c=s.get(u);if(c)Qr(e,r,c);else{var d=a?a(l,u,r+"",e,t,s):i,p=d===i;if(p){var f=Ga(u),h=!f&&Ya(u),m=!f&&!h&&ls(u);d=u,f||h||m?Ga(l)?d=l:Ha(l)?d=Oi(l):h?(p=!1,d=_i(u,!0)):m?(p=!1,d=wi(u,!0)):d=[]:ns(u)||Ba(u)?(d=l,Ba(l)?d=gs(l):Ja(l)&&!Ka(l)||(d=ho(u))):p=!1}p&&(s.set(u,d),o(d,u,n,a,s),s.delete(u)),Qr(e,r,d)}}(e,t,s,r,qn,n,o);else{var l=n?n(Oo(e,s),a,s+"",e,t,o):i;l===i&&(l=a),Qr(e,s,l)}}),Rs)}function $n(e,t){var r=e.length;if(r)return go(t+=t<0?r:0,r)?e[t]:i}function zn(e,t,r){t=t.length?Rt(t,(function(e){return Ga(e)?function(t){return An(t,1===e.length?e[0]:e)}:e})):[rl];var n=-1;t=Rt(t,Wt(oo()));var i=Mn(e,(function(e,r,i){var o=Rt(t,(function(t){return t(e)}));return{criteria:o,index:++n,value:e}}));return function(e,t){var n=e.length;for(e.sort((function(e,t){return function(e,t,r){for(var n=-1,i=e.criteria,o=t.criteria,a=i.length,s=r.length;++n<a;){var l=Ti(i[n],o[n]);if(l)return n>=s?l:l*("desc"==r[n]?-1:1)}return e.index-t.index}(e,t,r)}));n--;)e[n]=e[n].value;return e}(i)}function Bn(e,t,r){for(var n=-1,i=t.length,o={};++n<i;){var a=t[n],s=An(e,a);r(s,a)&&Kn(o,gi(a,e),s)}return o}function Gn(e,t,r,n){var i=n?$t:qt,o=-1,a=t.length,s=e;for(e===t&&(t=Oi(t)),r&&(s=Rt(e,Wt(r)));++o<a;)for(var l=0,u=t[o],c=r?r(u):u;(l=i(s,c,l,n))>-1;)s!==e&&Ye.call(s,l,1),Ye.call(e,l,1);return e}function Un(e,t){for(var r=e?t.length:0,n=r-1;r--;){var i=t[r];if(r==n||i!==o){var o=i;go(i)?Ye.call(e,i,1):li(e,i)}}return e}function Vn(e,t){return e+ft(vr()*(t-e+1))}function Hn(e,t){var r="";if(!e||t<1||t>d)return r;do{t%2&&(r+=e),(t=ft(t/2))&&(e+=e)}while(t);return r}function Yn(e,t){return Io(So(e,t,rl),e+"")}function Xn(e){return Xr(qs(e))}function Wn(e,t){var r=qs(e);return Do(r,on(t,0,r.length))}function Kn(e,t,r,n){if(!Ja(e))return e;for(var o=-1,a=(t=gi(t,e)).length,s=a-1,l=e;null!=l&&++o<a;){var u=Mo(t[o]),c=r;if("__proto__"===u||"constructor"===u||"prototype"===u)return e;if(o!=s){var d=l[u];(c=n?n(d,u,l):i)===i&&(c=Ja(d)?d:go(t[o+1])?[]:{})}Zr(l,u,c),l=l[u]}return e}var Qn=xr?function(e,t){return xr.set(e,t),e}:rl,Zn=et?function(e,t){return et(e,"toString",{configurable:!0,enumerable:!1,value:Js(t),writable:!0})}:rl;function Jn(e){return Do(qs(e))}function ei(e,t,r){var i=-1,o=e.length;t<0&&(t=-t>o?0:o+t),(r=r>o?o:r)<0&&(r+=o),o=t>r?0:r-t>>>0,t>>>=0;for(var a=n(o);++i<o;)a[i]=e[i+t];return a}function ti(e,t){var r;return cn(e,(function(e,n,i){return!(r=t(e,n,i))})),!!r}function ri(e,t,r){var n=0,i=null==e?n:e.length;if("number"==typeof t&&t==t&&i<=2147483647){for(;n<i;){var o=n+i>>>1,a=e[o];null!==a&&!ss(a)&&(r?a<=t:a<t)?n=o+1:i=o}return i}return ni(e,t,rl,r)}function ni(e,t,r,n){var o=0,a=null==e?0:e.length;if(0===a)return 0;for(var s=(t=r(t))!=t,l=null===t,u=ss(t),c=t===i;o<a;){var d=ft((o+a)/2),p=r(e[d]),f=p!==i,h=null===p,m=p==p,g=ss(p);if(s)var y=n||m;else y=c?m&&(n||f):l?m&&f&&(n||!h):u?m&&f&&!h&&(n||!g):!h&&!g&&(n?p<=t:p<t);y?o=d+1:a=d}return gr(a,4294967294)}function ii(e,t){for(var r=-1,n=e.length,i=0,o=[];++r<n;){var a=e[r],s=t?t(a):a;if(!r||!qa(s,l)){var l=s;o[i++]=0===a?0:a}}return o}function oi(e){return"number"==typeof e?e:ss(e)?p:+e}function ai(e){if("string"==typeof e)return e;if(Ga(e))return Rt(e,ai)+"";if(ss(e))return Mr?Mr.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function si(e,t,r){var n=-1,i=It,o=e.length,a=!0,s=[],l=s;if(r)a=!1,i=jt;else if(o>=200){var u=t?null:Hi(e);if(u)return sr(u);a=!1,i=Qt,l=new Vr}else l=t?[]:s;e:for(;++n<o;){var c=e[n],d=t?t(c):c;if(c=r||0!==c?c:0,a&&d==d){for(var p=l.length;p--;)if(l[p]===d)continue e;t&&l.push(d),s.push(c)}else i(l,d,r)||(l!==s&&l.push(d),s.push(c))}return s}function li(e,t){return null==(e=Eo(e,t=gi(t,e)))||delete e[Mo(Wo(t))]}function ui(e,t,r,n){return Kn(e,t,r(An(e,t)),n)}function ci(e,t,r,n){for(var i=e.length,o=n?i:-1;(n?o--:++o<i)&&t(e[o],o,e););return r?ei(e,n?0:o,n?o+1:i):ei(e,n?o+1:0,n?i:o)}function di(e,t){var r=e;return r instanceof zr&&(r=r.value()),Ft(t,(function(e,t){return t.func.apply(t.thisArg,Dt([e],t.args))}),r)}function pi(e,t,r){var i=e.length;if(i<2)return i?si(e[0]):[];for(var o=-1,a=n(i);++o<i;)for(var s=e[o],l=-1;++l<i;)l!=o&&(a[o]=un(a[o]||s,e[l],t,r));return si(mn(a,1),t,r)}function fi(e,t,r){for(var n=-1,o=e.length,a=t.length,s={};++n<o;){var l=n<a?t[n]:i;r(s,e[n],l)}return s}function hi(e){return Ha(e)?e:[]}function mi(e){return"function"==typeof e?e:rl}function gi(e,t){return Ga(e)?e:bo(e,t)?[e]:Po(ys(e))}var yi=Yn;function bi(e,t,r){var n=e.length;return r=r===i?n:r,!t&&r>=n?e:ei(e,t,r)}var vi=at||function(e){return dt.clearTimeout(e)};function _i(e,t){if(t)return e.slice();var r=e.length,n=Ge?Ge(r):new e.constructor(r);return e.copy(n),n}function Ai(e){var t=new e.constructor(e.byteLength);return new Be(t).set(new Be(e)),t}function wi(e,t){var r=t?Ai(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function Ti(e,t){if(e!==t){var r=e!==i,n=null===e,o=e==e,a=ss(e),s=t!==i,l=null===t,u=t==t,c=ss(t);if(!l&&!c&&!a&&e>t||a&&s&&u&&!l&&!c||n&&s&&u||!r&&u||!o)return 1;if(!n&&!a&&!c&&e<t||c&&r&&o&&!n&&!a||l&&r&&o||!s&&o||!u)return-1}return 0}function Si(e,t,r,i){for(var o=-1,a=e.length,s=r.length,l=-1,u=t.length,c=mr(a-s,0),d=n(u+c),p=!i;++l<u;)d[l]=t[l];for(;++o<s;)(p||o<a)&&(d[r[o]]=e[o]);for(;c--;)d[l++]=e[o++];return d}function Ei(e,t,r,i){for(var o=-1,a=e.length,s=-1,l=r.length,u=-1,c=t.length,d=mr(a-l,0),p=n(d+c),f=!i;++o<d;)p[o]=e[o];for(var h=o;++u<c;)p[h+u]=t[u];for(;++s<l;)(f||o<a)&&(p[h+r[s]]=e[o++]);return p}function Oi(e,t){var r=-1,i=e.length;for(t||(t=n(i));++r<i;)t[r]=e[r];return t}function xi(e,t,r,n){var o=!r;r||(r={});for(var a=-1,s=t.length;++a<s;){var l=t[a],u=n?n(r[l],e[l],l,r,e):i;u===i&&(u=e[l]),o?rn(r,l,u):Zr(r,l,u)}return r}function Ci(e,t){return function(r,n){var i=Ga(r)?St:en,o=t?t():{};return i(r,e,oo(n,2),o)}}function Ii(e){return Yn((function(t,r){var n=-1,o=r.length,a=o>1?r[o-1]:i,s=o>2?r[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,s&&yo(r[0],r[1],s)&&(a=o<3?i:a,o=1),t=Se(t);++n<o;){var l=r[n];l&&e(t,l,n,a)}return t}))}function ji(e,t){return function(r,n){if(null==r)return r;if(!Va(r))return e(r,n);for(var i=r.length,o=t?i:-1,a=Se(r);(t?o--:++o<i)&&!1!==n(a[o],o,a););return r}}function Ri(e){return function(t,r,n){for(var i=-1,o=Se(t),a=n(t),s=a.length;s--;){var l=a[e?s:++i];if(!1===r(o[l],l,o))break}return t}}function Di(e){return function(t){var r=nr(t=ys(t))?cr(t):i,n=r?r[0]:t.charAt(0),o=r?bi(r,1).join(""):t.slice(1);return n[e]()+o}}function Fi(e){return function(t){return Ft(Ks(Bs(t).replace(Ke,"")),e,"")}}function Ni(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var r=kr(e.prototype),n=e.apply(r,t);return Ja(n)?n:r}}function Pi(e){return function(t,r,n){var o=Se(t);if(!Va(t)){var a=oo(r,3);t=js(t),r=function(e){return a(o[e],e,o)}}var s=e(t,r,n);return s>-1?o[a?t[s]:s]:i}}function Mi(e){return Ji((function(t){var r=t.length,n=r,a=$r.prototype.thru;for(e&&t.reverse();n--;){var s=t[n];if("function"!=typeof s)throw new xe(o);if(a&&!l&&"wrapper"==no(s))var l=new $r([],!0)}for(n=l?n:r;++n<r;){var u=no(s=t[n]),c="wrapper"==u?ro(s):i;l=c&&vo(c[0])&&424==c[1]&&!c[4].length&&1==c[9]?l[no(c[0])].apply(l,c[3]):1==s.length&&vo(s)?l[u]():l.thru(s)}return function(){var e=arguments,n=e[0];if(l&&1==e.length&&Ga(n))return l.plant(n).value();for(var i=0,o=r?t[i].apply(this,e):n;++i<r;)o=t[i].call(this,o);return o}}))}function Li(e,t,r,o,a,s,l,c,d,p){var f=t&u,h=1&t,m=2&t,g=24&t,y=512&t,b=m?i:Ni(e);return function u(){for(var v=arguments.length,_=n(v),A=v;A--;)_[A]=arguments[A];if(g)var w=io(u),T=function(e,t){for(var r=e.length,n=0;r--;)e[r]===t&&++n;return n}(_,w);if(o&&(_=Si(_,o,a,g)),s&&(_=Ei(_,s,l,g)),v-=T,g&&v<p){var S=ar(_,w);return Ui(e,t,Li,u.placeholder,r,_,S,c,d,p-v)}var E=h?r:this,O=m?E[e]:e;return v=_.length,c?_=function(e,t){for(var r=e.length,n=gr(t.length,r),o=Oi(e);n--;){var a=t[n];e[n]=go(a,r)?o[a]:i}return e}(_,c):y&&v>1&&_.reverse(),f&&d<v&&(_.length=d),this&&this!==dt&&this instanceof u&&(O=b||Ni(O)),O.apply(E,_)}}function ki(e,t){return function(r,n){return function(e,t,r,n){return bn(e,(function(e,i,o){t(n,r(e),i,o)})),n}(r,e,t(n),{})}}function qi(e,t){return function(r,n){var o;if(r===i&&n===i)return t;if(r!==i&&(o=r),n!==i){if(o===i)return n;"string"==typeof r||"string"==typeof n?(r=ai(r),n=ai(n)):(r=oi(r),n=oi(n)),o=e(r,n)}return o}}function $i(e){return Ji((function(t){return t=Rt(t,Wt(oo())),Yn((function(r){var n=this;return e(t,(function(e){return Tt(e,n,r)}))}))}))}function zi(e,t){var r=(t=t===i?" ":ai(t)).length;if(r<2)return r?Hn(t,e):t;var n=Hn(t,pt(e/ur(t)));return nr(t)?bi(cr(n),0,e).join(""):n.slice(0,e)}function Bi(e){return function(t,r,o){return o&&"number"!=typeof o&&yo(t,r,o)&&(r=o=i),t=ps(t),r===i?(r=t,t=0):r=ps(r),function(e,t,r,i){for(var o=-1,a=mr(pt((t-e)/(r||1)),0),s=n(a);a--;)s[i?a:++o]=e,e+=r;return s}(t,r,o=o===i?t<r?1:-1:ps(o),e)}}function Gi(e){return function(t,r){return"string"==typeof t&&"string"==typeof r||(t=ms(t),r=ms(r)),e(t,r)}}function Ui(e,t,r,n,o,a,s,u,c,d){var p=8&t;t|=p?l:64,4&(t&=~(p?64:l))||(t&=-4);var f=[e,t,o,p?a:i,p?s:i,p?i:a,p?i:s,u,c,d],h=r.apply(i,f);return vo(e)&&xo(h,f),h.placeholder=n,jo(h,e,t)}function Vi(e){var t=Te[e];return function(e,r){if(e=ms(e),(r=null==r?0:gr(fs(r),292))&&Mt(e)){var n=(ys(e)+"e").split("e");return+((n=(ys(t(n[0]+"e"+(+n[1]+r)))+"e").split("e"))[0]+"e"+(+n[1]-r))}return t(e)}}var Hi=Sr&&1/sr(new Sr([,-0]))[1]==c?function(e){return new Sr(e)}:sl;function Yi(e){return function(t){var r=po(t);return r==w?ir(t):r==x?lr(t):function(e,t){return Rt(t,(function(t){return[t,e[t]]}))}(t,e(t))}}function Xi(e,t,r,a,c,d,p,f){var h=2&t;if(!h&&"function"!=typeof e)throw new xe(o);var m=a?a.length:0;if(m||(t&=-97,a=c=i),p=p===i?p:mr(fs(p),0),f=f===i?f:fs(f),m-=c?c.length:0,64&t){var g=a,y=c;a=c=i}var b=h?i:ro(e),v=[e,t,r,a,c,g,y,d,p,f];if(b&&function(e,t){var r=e[1],n=t[1],i=r|n,o=i<131,a=n==u&&8==r||n==u&&256==r&&e[7].length<=t[8]||384==n&&t[7].length<=t[8]&&8==r;if(!o&&!a)return e;1&n&&(e[2]=t[2],i|=1&r?0:4);var l=t[3];if(l){var c=e[3];e[3]=c?Si(c,l,t[4]):l,e[4]=c?ar(e[3],s):t[4]}(l=t[5])&&(c=e[5],e[5]=c?Ei(c,l,t[6]):l,e[6]=c?ar(e[5],s):t[6]),(l=t[7])&&(e[7]=l),n&u&&(e[8]=null==e[8]?t[8]:gr(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=i}(v,b),e=v[0],t=v[1],r=v[2],a=v[3],c=v[4],!(f=v[9]=v[9]===i?h?0:e.length:mr(v[9]-m,0))&&24&t&&(t&=-25),t&&1!=t)_=8==t||16==t?function(e,t,r){var o=Ni(e);return function a(){for(var s=arguments.length,l=n(s),u=s,c=io(a);u--;)l[u]=arguments[u];var d=s<3&&l[0]!==c&&l[s-1]!==c?[]:ar(l,c);return(s-=d.length)<r?Ui(e,t,Li,a.placeholder,i,l,d,i,i,r-s):Tt(this&&this!==dt&&this instanceof a?o:e,this,l)}}(e,t,f):t!=l&&33!=t||c.length?Li.apply(i,v):function(e,t,r,i){var o=1&t,a=Ni(e);return function t(){for(var s=-1,l=arguments.length,u=-1,c=i.length,d=n(c+l),p=this&&this!==dt&&this instanceof t?a:e;++u<c;)d[u]=i[u];for(;l--;)d[u++]=arguments[++s];return Tt(p,o?r:this,d)}}(e,t,r,a);else var _=function(e,t,r){var n=1&t,i=Ni(e);return function t(){return(this&&this!==dt&&this instanceof t?i:e).apply(n?r:this,arguments)}}(e,t,r);return jo((b?Qn:xo)(_,v),e,t)}function Wi(e,t,r,n){return e===i||qa(e,je[r])&&!Fe.call(n,r)?t:e}function Ki(e,t,r,n,o,a){return Ja(e)&&Ja(t)&&(a.set(t,e),qn(e,t,i,Ki,a),a.delete(t)),e}function Qi(e){return ns(e)?i:e}function Zi(e,t,r,n,o,a){var s=1&r,l=e.length,u=t.length;if(l!=u&&!(s&&u>l))return!1;var c=a.get(e),d=a.get(t);if(c&&d)return c==t&&d==e;var p=-1,f=!0,h=2&r?new Vr:i;for(a.set(e,t),a.set(t,e);++p<l;){var m=e[p],g=t[p];if(n)var y=s?n(g,m,p,t,e,a):n(m,g,p,e,t,a);if(y!==i){if(y)continue;f=!1;break}if(h){if(!Pt(t,(function(e,t){if(!Qt(h,t)&&(m===e||o(m,e,r,n,a)))return h.push(t)}))){f=!1;break}}else if(m!==g&&!o(m,g,r,n,a)){f=!1;break}}return a.delete(e),a.delete(t),f}function Ji(e){return Io(So(e,i,Uo),e+"")}function eo(e){return wn(e,js,uo)}function to(e){return wn(e,Rs,co)}var ro=xr?function(e){return xr.get(e)}:sl;function no(e){for(var t=e.name+"",r=Cr[t],n=Fe.call(Cr,t)?r.length:0;n--;){var i=r[n],o=i.func;if(null==o||o==e)return i.name}return t}function io(e){return(Fe.call(Lr,"placeholder")?Lr:e).placeholder}function oo(){var e=Lr.iteratee||nl;return e=e===nl?Fn:e,arguments.length?e(arguments[0],arguments[1]):e}function ao(e,t){var r,n,i=e.__data__;return("string"==(n=typeof(r=t))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?i["string"==typeof t?"string":"hash"]:i.map}function so(e){for(var t=js(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,wo(i)]}return t}function lo(e,t){var r=function(e,t){return null==e?i:e[t]}(e,t);return Dn(r)?r:i}var uo=mt?function(e){return null==e?[]:(e=Se(e),Ct(mt(e),(function(t){return He.call(e,t)})))}:hl,co=mt?function(e){for(var t=[];e;)Dt(t,uo(e)),e=Ue(e);return t}:hl,po=Tn;function fo(e,t,r){for(var n=-1,i=(t=gi(t,e)).length,o=!1;++n<i;){var a=Mo(t[n]);if(!(o=null!=e&&r(e,a)))break;e=e[a]}return o||++n!=i?o:!!(i=null==e?0:e.length)&&Za(i)&&go(a,i)&&(Ga(e)||Ba(e))}function ho(e){return"function"!=typeof e.constructor||Ao(e)?{}:kr(Ue(e))}function mo(e){return Ga(e)||Ba(e)||!!(Xe&&e&&e[Xe])}function go(e,t){var r=typeof e;return!!(t=null==t?d:t)&&("number"==r||"symbol"!=r&&ye.test(e))&&e>-1&&e%1==0&&e<t}function yo(e,t,r){if(!Ja(r))return!1;var n=typeof t;return!!("number"==n?Va(r)&&go(t,r.length):"string"==n&&t in r)&&qa(r[t],e)}function bo(e,t){if(Ga(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!ss(e))||J.test(e)||!Z.test(e)||null!=t&&e in Se(t)}function vo(e){var t=no(e),r=Lr[t];if("function"!=typeof r||!(t in zr.prototype))return!1;if(e===r)return!0;var n=ro(r);return!!n&&e===n[0]}(Ar&&po(new Ar(new ArrayBuffer(1)))!=D||wr&&po(new wr)!=w||Tr&&po(Tr.resolve())!=E||Sr&&po(new Sr)!=x||Er&&po(new Er)!=j)&&(po=function(e){var t=Tn(e),r=t==S?e.constructor:i,n=r?Lo(r):"";if(n)switch(n){case Ir:return D;case jr:return w;case Rr:return E;case Dr:return x;case Fr:return j}return t});var _o=Re?Ka:ml;function Ao(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||je)}function wo(e){return e==e&&!Ja(e)}function To(e,t){return function(r){return null!=r&&r[e]===t&&(t!==i||e in Se(r))}}function So(e,t,r){return t=mr(t===i?e.length-1:t,0),function(){for(var i=arguments,o=-1,a=mr(i.length-t,0),s=n(a);++o<a;)s[o]=i[t+o];o=-1;for(var l=n(t+1);++o<t;)l[o]=i[o];return l[t]=r(s),Tt(e,this,l)}}function Eo(e,t){return t.length<2?e:An(e,ei(t,0,-1))}function Oo(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var xo=Ro(Qn),Co=ct||function(e,t){return dt.setTimeout(e,t)},Io=Ro(Zn);function jo(e,t,r){var n=t+"";return Io(e,function(e,t){var r=t.length;if(!r)return e;var n=r-1;return t[n]=(r>1?"& ":"")+t[n],t=t.join(r>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(n,function(e,t){return Et(h,(function(r){var n="_."+r[0];t&r[1]&&!It(e,n)&&e.push(n)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(se):[]}(n),r)))}function Ro(e){var t=0,r=0;return function(){var n=yr(),o=16-(n-r);if(r=n,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function Do(e,t){var r=-1,n=e.length,o=n-1;for(t=t===i?n:t;++r<t;){var a=Vn(r,o),s=e[a];e[a]=e[r],e[r]=s}return e.length=t,e}var Fo,No,Po=(Fo=Fa((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(ee,(function(e,r,n,i){t.push(n?i.replace(ce,"$1"):r||e)})),t}),(function(e){return 500===No.size&&No.clear(),e})),No=Fo.cache,Fo);function Mo(e){if("string"==typeof e||ss(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Lo(e){if(null!=e){try{return De.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function ko(e){if(e instanceof zr)return e.clone();var t=new $r(e.__wrapped__,e.__chain__);return t.__actions__=Oi(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var qo=Yn((function(e,t){return Ha(e)?un(e,mn(t,1,Ha,!0)):[]})),$o=Yn((function(e,t){var r=Wo(t);return Ha(r)&&(r=i),Ha(e)?un(e,mn(t,1,Ha,!0),oo(r,2)):[]})),zo=Yn((function(e,t){var r=Wo(t);return Ha(r)&&(r=i),Ha(e)?un(e,mn(t,1,Ha,!0),i,r):[]}));function Bo(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var i=null==r?0:fs(r);return i<0&&(i=mr(n+i,0)),kt(e,oo(t,3),i)}function Go(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var o=n-1;return r!==i&&(o=fs(r),o=r<0?mr(n+o,0):gr(o,n-1)),kt(e,oo(t,3),o,!0)}function Uo(e){return null!=e&&e.length?mn(e,1):[]}function Vo(e){return e&&e.length?e[0]:i}var Ho=Yn((function(e){var t=Rt(e,hi);return t.length&&t[0]===e[0]?xn(t):[]})),Yo=Yn((function(e){var t=Wo(e),r=Rt(e,hi);return t===Wo(r)?t=i:r.pop(),r.length&&r[0]===e[0]?xn(r,oo(t,2)):[]})),Xo=Yn((function(e){var t=Wo(e),r=Rt(e,hi);return(t="function"==typeof t?t:i)&&r.pop(),r.length&&r[0]===e[0]?xn(r,i,t):[]}));function Wo(e){var t=null==e?0:e.length;return t?e[t-1]:i}var Ko=Yn(Qo);function Qo(e,t){return e&&e.length&&t&&t.length?Gn(e,t):e}var Zo=Ji((function(e,t){var r=null==e?0:e.length,n=nn(e,t);return Un(e,Rt(t,(function(e){return go(e,r)?+e:e})).sort(Ti)),n}));function Jo(e){return null==e?e:_r.call(e)}var ea=Yn((function(e){return si(mn(e,1,Ha,!0))})),ta=Yn((function(e){var t=Wo(e);return Ha(t)&&(t=i),si(mn(e,1,Ha,!0),oo(t,2))})),ra=Yn((function(e){var t=Wo(e);return t="function"==typeof t?t:i,si(mn(e,1,Ha,!0),i,t)}));function na(e){if(!e||!e.length)return[];var t=0;return e=Ct(e,(function(e){if(Ha(e))return t=mr(e.length,t),!0})),Yt(t,(function(t){return Rt(e,Gt(t))}))}function ia(e,t){if(!e||!e.length)return[];var r=na(e);return null==t?r:Rt(r,(function(e){return Tt(t,i,e)}))}var oa=Yn((function(e,t){return Ha(e)?un(e,t):[]})),aa=Yn((function(e){return pi(Ct(e,Ha))})),sa=Yn((function(e){var t=Wo(e);return Ha(t)&&(t=i),pi(Ct(e,Ha),oo(t,2))})),la=Yn((function(e){var t=Wo(e);return t="function"==typeof t?t:i,pi(Ct(e,Ha),i,t)})),ua=Yn(na),ca=Yn((function(e){var t=e.length,r=t>1?e[t-1]:i;return r="function"==typeof r?(e.pop(),r):i,ia(e,r)}));function da(e){var t=Lr(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var fa=Ji((function(e){var t=e.length,r=t?e[0]:0,n=this.__wrapped__,o=function(t){return nn(t,e)};return!(t>1||this.__actions__.length)&&n instanceof zr&&go(r)?((n=n.slice(r,+r+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new $r(n,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ha=Ci((function(e,t,r){Fe.call(e,r)?++e[r]:rn(e,r,1)})),ma=Pi(Bo),ga=Pi(Go);function ya(e,t){return(Ga(e)?Et:cn)(e,oo(t,3))}function ba(e,t){return(Ga(e)?Ot:dn)(e,oo(t,3))}var va=Ci((function(e,t,r){Fe.call(e,r)?e[r].push(t):rn(e,r,[t])})),_a=Yn((function(e,t,r){var i=-1,o="function"==typeof t,a=Va(e)?n(e.length):[];return cn(e,(function(e){a[++i]=o?Tt(t,e,r):Cn(e,t,r)})),a})),Aa=Ci((function(e,t,r){rn(e,r,t)}));function wa(e,t){return(Ga(e)?Rt:Mn)(e,oo(t,3))}var Ta=Ci((function(e,t,r){e[r?0:1].push(t)}),(function(){return[[],[]]})),Sa=Yn((function(e,t){if(null==e)return[];var r=t.length;return r>1&&yo(e,t[0],t[1])?t=[]:r>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),zn(e,mn(t,1),[])})),Ea=ut||function(){return dt.Date.now()};function Oa(e,t,r){return t=r?i:t,t=e&&null==t?e.length:t,Xi(e,u,i,i,i,i,t)}function xa(e,t){var r;if("function"!=typeof t)throw new xe(o);return e=fs(e),function(){return--e>0&&(r=t.apply(this,arguments)),e<=1&&(t=i),r}}var Ca=Yn((function(e,t,r){var n=1;if(r.length){var i=ar(r,io(Ca));n|=l}return Xi(e,n,t,r,i)})),Ia=Yn((function(e,t,r){var n=3;if(r.length){var i=ar(r,io(Ia));n|=l}return Xi(t,n,e,r,i)}));function ja(e,t,r){var n,a,s,l,u,c,d=0,p=!1,f=!1,h=!0;if("function"!=typeof e)throw new xe(o);function m(t){var r=n,o=a;return n=a=i,d=t,l=e.apply(o,r)}function g(e){var r=e-c;return c===i||r>=t||r<0||f&&e-d>=s}function y(){var e=Ea();if(g(e))return b(e);u=Co(y,function(e){var r=t-(e-c);return f?gr(r,s-(e-d)):r}(e))}function b(e){return u=i,h&&n?m(e):(n=a=i,l)}function v(){var e=Ea(),r=g(e);if(n=arguments,a=this,c=e,r){if(u===i)return function(e){return d=e,u=Co(y,t),p?m(e):l}(c);if(f)return vi(u),u=Co(y,t),m(c)}return u===i&&(u=Co(y,t)),l}return t=ms(t)||0,Ja(r)&&(p=!!r.leading,s=(f="maxWait"in r)?mr(ms(r.maxWait)||0,t):s,h="trailing"in r?!!r.trailing:h),v.cancel=function(){u!==i&&vi(u),d=0,n=c=a=u=i},v.flush=function(){return u===i?l:b(Ea())},v}var Ra=Yn((function(e,t){return ln(e,1,t)})),Da=Yn((function(e,t,r){return ln(e,ms(t)||0,r)}));function Fa(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var a=e.apply(this,n);return r.cache=o.set(i,a)||o,a};return r.cache=new(Fa.Cache||Ur),r}function Na(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Fa.Cache=Ur;var Pa=yi((function(e,t){var r=(t=1==t.length&&Ga(t[0])?Rt(t[0],Wt(oo())):Rt(mn(t,1),Wt(oo()))).length;return Yn((function(n){for(var i=-1,o=gr(n.length,r);++i<o;)n[i]=t[i].call(this,n[i]);return Tt(e,this,n)}))})),Ma=Yn((function(e,t){var r=ar(t,io(Ma));return Xi(e,l,i,t,r)})),La=Yn((function(e,t){var r=ar(t,io(La));return Xi(e,64,i,t,r)})),ka=Ji((function(e,t){return Xi(e,256,i,i,i,t)}));function qa(e,t){return e===t||e!=e&&t!=t}var $a=Gi(Sn),za=Gi((function(e,t){return e>=t})),Ba=In(function(){return arguments}())?In:function(e){return es(e)&&Fe.call(e,"callee")&&!He.call(e,"callee")},Ga=n.isArray,Ua=yt?Wt(yt):function(e){return es(e)&&Tn(e)==R};function Va(e){return null!=e&&Za(e.length)&&!Ka(e)}function Ha(e){return es(e)&&Va(e)}var Ya=gt||ml,Xa=bt?Wt(bt):function(e){return es(e)&&Tn(e)==b};function Wa(e){if(!es(e))return!1;var t=Tn(e);return t==v||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ns(e)}function Ka(e){if(!Ja(e))return!1;var t=Tn(e);return t==_||t==A||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Qa(e){return"number"==typeof e&&e==fs(e)}function Za(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=d}function Ja(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function es(e){return null!=e&&"object"==typeof e}var ts=vt?Wt(vt):function(e){return es(e)&&po(e)==w};function rs(e){return"number"==typeof e||es(e)&&Tn(e)==T}function ns(e){if(!es(e)||Tn(e)!=S)return!1;var t=Ue(e);if(null===t)return!0;var r=Fe.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&De.call(r)==Le}var is=_t?Wt(_t):function(e){return es(e)&&Tn(e)==O},os=At?Wt(At):function(e){return es(e)&&po(e)==x};function as(e){return"string"==typeof e||!Ga(e)&&es(e)&&Tn(e)==C}function ss(e){return"symbol"==typeof e||es(e)&&Tn(e)==I}var ls=wt?Wt(wt):function(e){return es(e)&&Za(e.length)&&!!it[Tn(e)]},us=Gi(Pn),cs=Gi((function(e,t){return e<=t}));function ds(e){if(!e)return[];if(Va(e))return as(e)?cr(e):Oi(e);if(We&&e[We])return function(e){for(var t,r=[];!(t=e.next()).done;)r.push(t.value);return r}(e[We]());var t=po(e);return(t==w?ir:t==x?sr:qs)(e)}function ps(e){return e?(e=ms(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function fs(e){var t=ps(e),r=t%1;return t==t?r?t-r:t:0}function hs(e){return e?on(fs(e),0,f):0}function ms(e){if("number"==typeof e)return e;if(ss(e))return p;if(Ja(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Ja(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Xt(e);var r=he.test(e);return r||ge.test(e)?lt(e.slice(2),r?2:8):fe.test(e)?p:+e}function gs(e){return xi(e,Rs(e))}function ys(e){return null==e?"":ai(e)}var bs=Ii((function(e,t){if(Ao(t)||Va(t))xi(t,js(t),e);else for(var r in t)Fe.call(t,r)&&Zr(e,r,t[r])})),vs=Ii((function(e,t){xi(t,Rs(t),e)})),_s=Ii((function(e,t,r,n){xi(t,Rs(t),e,n)})),As=Ii((function(e,t,r,n){xi(t,js(t),e,n)})),ws=Ji(nn),Ts=Yn((function(e,t){e=Se(e);var r=-1,n=t.length,o=n>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(n=1);++r<n;)for(var a=t[r],s=Rs(a),l=-1,u=s.length;++l<u;){var c=s[l],d=e[c];(d===i||qa(d,je[c])&&!Fe.call(e,c))&&(e[c]=a[c])}return e})),Ss=Yn((function(e){return e.push(i,Ki),Tt(Fs,i,e)}));function Es(e,t,r){var n=null==e?i:An(e,t);return n===i?r:n}function Os(e,t){return null!=e&&fo(e,t,On)}var xs=ki((function(e,t,r){null!=t&&"function"!=typeof t.toString&&(t=Me.call(t)),e[t]=r}),Js(rl)),Cs=ki((function(e,t,r){null!=t&&"function"!=typeof t.toString&&(t=Me.call(t)),Fe.call(e,t)?e[t].push(r):e[t]=[r]}),oo),Is=Yn(Cn);function js(e){return Va(e)?Yr(e):Nn(e)}function Rs(e){return Va(e)?Yr(e,!0):function(e){if(!Ja(e))return function(e){var t=[];if(null!=e)for(var r in Se(e))t.push(r);return t}(e);var t=Ao(e),r=[];for(var n in e)("constructor"!=n||!t&&Fe.call(e,n))&&r.push(n);return r}(e)}var Ds=Ii((function(e,t,r){qn(e,t,r)})),Fs=Ii((function(e,t,r,n){qn(e,t,r,n)})),Ns=Ji((function(e,t){var r={};if(null==e)return r;var n=!1;t=Rt(t,(function(t){return t=gi(t,e),n||(n=t.length>1),t})),xi(e,to(e),r),n&&(r=an(r,7,Qi));for(var i=t.length;i--;)li(r,t[i]);return r})),Ps=Ji((function(e,t){return null==e?{}:function(e,t){return Bn(e,t,(function(t,r){return Os(e,r)}))}(e,t)}));function Ms(e,t){if(null==e)return{};var r=Rt(to(e),(function(e){return[e]}));return t=oo(t),Bn(e,r,(function(e,r){return t(e,r[0])}))}var Ls=Yi(js),ks=Yi(Rs);function qs(e){return null==e?[]:Kt(e,js(e))}var $s=Fi((function(e,t,r){return t=t.toLowerCase(),e+(r?zs(t):t)}));function zs(e){return Ws(ys(e).toLowerCase())}function Bs(e){return(e=ys(e))&&e.replace(be,er).replace(Qe,"")}var Gs=Fi((function(e,t,r){return e+(r?"-":"")+t.toLowerCase()})),Us=Fi((function(e,t,r){return e+(r?" ":"")+t.toLowerCase()})),Vs=Di("toLowerCase"),Hs=Fi((function(e,t,r){return e+(r?"_":"")+t.toLowerCase()})),Ys=Fi((function(e,t,r){return e+(r?" ":"")+Ws(t)})),Xs=Fi((function(e,t,r){return e+(r?" ":"")+t.toUpperCase()})),Ws=Di("toUpperCase");function Ks(e,t,r){return e=ys(e),(t=r?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Je)||[]}(e):function(e){return e.match(le)||[]}(e):e.match(t)||[]}var Qs=Yn((function(e,t){try{return Tt(e,i,t)}catch(e){return Wa(e)?e:new Ae(e)}})),Zs=Ji((function(e,t){return Et(t,(function(t){t=Mo(t),rn(e,t,Ca(e[t],e))})),e}));function Js(e){return function(){return e}}var el=Mi(),tl=Mi(!0);function rl(e){return e}function nl(e){return Fn("function"==typeof e?e:an(e,1))}var il=Yn((function(e,t){return function(r){return Cn(r,e,t)}})),ol=Yn((function(e,t){return function(r){return Cn(e,r,t)}}));function al(e,t,r){var n=js(t),i=_n(t,n);null!=r||Ja(t)&&(i.length||!n.length)||(r=t,t=e,e=this,i=_n(t,js(t)));var o=!(Ja(r)&&"chain"in r&&!r.chain),a=Ka(e);return Et(i,(function(r){var n=t[r];e[r]=n,a&&(e.prototype[r]=function(){var t=this.__chain__;if(o||t){var r=e(this.__wrapped__);return(r.__actions__=Oi(this.__actions__)).push({func:n,args:arguments,thisArg:e}),r.__chain__=t,r}return n.apply(e,Dt([this.value()],arguments))})})),e}function sl(){}var ll=$i(Rt),ul=$i(xt),cl=$i(Pt);function dl(e){return bo(e)?Gt(Mo(e)):function(e){return function(t){return An(t,e)}}(e)}var pl=Bi(),fl=Bi(!0);function hl(){return[]}function ml(){return!1}var gl,yl=qi((function(e,t){return e+t}),0),bl=Vi("ceil"),vl=qi((function(e,t){return e/t}),1),_l=Vi("floor"),Al=qi((function(e,t){return e*t}),1),wl=Vi("round"),Tl=qi((function(e,t){return e-t}),0);return Lr.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=fs(e),function(){if(--e<1)return t.apply(this,arguments)}},Lr.ary=Oa,Lr.assign=bs,Lr.assignIn=vs,Lr.assignInWith=_s,Lr.assignWith=As,Lr.at=ws,Lr.before=xa,Lr.bind=Ca,Lr.bindAll=Zs,Lr.bindKey=Ia,Lr.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Ga(e)?e:[e]},Lr.chain=da,Lr.chunk=function(e,t,r){t=(r?yo(e,t,r):t===i)?1:mr(fs(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,s=0,l=n(pt(o/t));a<o;)l[s++]=ei(e,a,a+=t);return l},Lr.compact=function(e){for(var t=-1,r=null==e?0:e.length,n=0,i=[];++t<r;){var o=e[t];o&&(i[n++]=o)}return i},Lr.concat=function(){var e=arguments.length;if(!e)return[];for(var t=n(e-1),r=arguments[0],i=e;i--;)t[i-1]=arguments[i];return Dt(Ga(r)?Oi(r):[r],mn(t,1))},Lr.cond=function(e){var t=null==e?0:e.length,r=oo();return e=t?Rt(e,(function(e){if("function"!=typeof e[1])throw new xe(o);return[r(e[0]),e[1]]})):[],Yn((function(r){for(var n=-1;++n<t;){var i=e[n];if(Tt(i[0],this,r))return Tt(i[1],this,r)}}))},Lr.conforms=function(e){return function(e){var t=js(e);return function(r){return sn(r,e,t)}}(an(e,1))},Lr.constant=Js,Lr.countBy=ha,Lr.create=function(e,t){var r=kr(e);return null==t?r:tn(r,t)},Lr.curry=function e(t,r,n){var o=Xi(t,8,i,i,i,i,i,r=n?i:r);return o.placeholder=e.placeholder,o},Lr.curryRight=function e(t,r,n){var o=Xi(t,16,i,i,i,i,i,r=n?i:r);return o.placeholder=e.placeholder,o},Lr.debounce=ja,Lr.defaults=Ts,Lr.defaultsDeep=Ss,Lr.defer=Ra,Lr.delay=Da,Lr.difference=qo,Lr.differenceBy=$o,Lr.differenceWith=zo,Lr.drop=function(e,t,r){var n=null==e?0:e.length;return n?ei(e,(t=r||t===i?1:fs(t))<0?0:t,n):[]},Lr.dropRight=function(e,t,r){var n=null==e?0:e.length;return n?ei(e,0,(t=n-(t=r||t===i?1:fs(t)))<0?0:t):[]},Lr.dropRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!0,!0):[]},Lr.dropWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!0):[]},Lr.fill=function(e,t,r,n){var o=null==e?0:e.length;return o?(r&&"number"!=typeof r&&yo(e,t,r)&&(r=0,n=o),function(e,t,r,n){var o=e.length;for((r=fs(r))<0&&(r=-r>o?0:o+r),(n=n===i||n>o?o:fs(n))<0&&(n+=o),n=r>n?0:hs(n);r<n;)e[r++]=t;return e}(e,t,r,n)):[]},Lr.filter=function(e,t){return(Ga(e)?Ct:hn)(e,oo(t,3))},Lr.flatMap=function(e,t){return mn(wa(e,t),1)},Lr.flatMapDeep=function(e,t){return mn(wa(e,t),c)},Lr.flatMapDepth=function(e,t,r){return r=r===i?1:fs(r),mn(wa(e,t),r)},Lr.flatten=Uo,Lr.flattenDeep=function(e){return null!=e&&e.length?mn(e,c):[]},Lr.flattenDepth=function(e,t){return null!=e&&e.length?mn(e,t=t===i?1:fs(t)):[]},Lr.flip=function(e){return Xi(e,512)},Lr.flow=el,Lr.flowRight=tl,Lr.fromPairs=function(e){for(var t=-1,r=null==e?0:e.length,n={};++t<r;){var i=e[t];n[i[0]]=i[1]}return n},Lr.functions=function(e){return null==e?[]:_n(e,js(e))},Lr.functionsIn=function(e){return null==e?[]:_n(e,Rs(e))},Lr.groupBy=va,Lr.initial=function(e){return null!=e&&e.length?ei(e,0,-1):[]},Lr.intersection=Ho,Lr.intersectionBy=Yo,Lr.intersectionWith=Xo,Lr.invert=xs,Lr.invertBy=Cs,Lr.invokeMap=_a,Lr.iteratee=nl,Lr.keyBy=Aa,Lr.keys=js,Lr.keysIn=Rs,Lr.map=wa,Lr.mapKeys=function(e,t){var r={};return t=oo(t,3),bn(e,(function(e,n,i){rn(r,t(e,n,i),e)})),r},Lr.mapValues=function(e,t){var r={};return t=oo(t,3),bn(e,(function(e,n,i){rn(r,n,t(e,n,i))})),r},Lr.matches=function(e){return Ln(an(e,1))},Lr.matchesProperty=function(e,t){return kn(e,an(t,1))},Lr.memoize=Fa,Lr.merge=Ds,Lr.mergeWith=Fs,Lr.method=il,Lr.methodOf=ol,Lr.mixin=al,Lr.negate=Na,Lr.nthArg=function(e){return e=fs(e),Yn((function(t){return $n(t,e)}))},Lr.omit=Ns,Lr.omitBy=function(e,t){return Ms(e,Na(oo(t)))},Lr.once=function(e){return xa(2,e)},Lr.orderBy=function(e,t,r,n){return null==e?[]:(Ga(t)||(t=null==t?[]:[t]),Ga(r=n?i:r)||(r=null==r?[]:[r]),zn(e,t,r))},Lr.over=ll,Lr.overArgs=Pa,Lr.overEvery=ul,Lr.overSome=cl,Lr.partial=Ma,Lr.partialRight=La,Lr.partition=Ta,Lr.pick=Ps,Lr.pickBy=Ms,Lr.property=dl,Lr.propertyOf=function(e){return function(t){return null==e?i:An(e,t)}},Lr.pull=Ko,Lr.pullAll=Qo,Lr.pullAllBy=function(e,t,r){return e&&e.length&&t&&t.length?Gn(e,t,oo(r,2)):e},Lr.pullAllWith=function(e,t,r){return e&&e.length&&t&&t.length?Gn(e,t,i,r):e},Lr.pullAt=Zo,Lr.range=pl,Lr.rangeRight=fl,Lr.rearg=ka,Lr.reject=function(e,t){return(Ga(e)?Ct:hn)(e,Na(oo(t,3)))},Lr.remove=function(e,t){var r=[];if(!e||!e.length)return r;var n=-1,i=[],o=e.length;for(t=oo(t,3);++n<o;){var a=e[n];t(a,n,e)&&(r.push(a),i.push(n))}return Un(e,i),r},Lr.rest=function(e,t){if("function"!=typeof e)throw new xe(o);return Yn(e,t=t===i?t:fs(t))},Lr.reverse=Jo,Lr.sampleSize=function(e,t,r){return t=(r?yo(e,t,r):t===i)?1:fs(t),(Ga(e)?Wr:Wn)(e,t)},Lr.set=function(e,t,r){return null==e?e:Kn(e,t,r)},Lr.setWith=function(e,t,r,n){return n="function"==typeof n?n:i,null==e?e:Kn(e,t,r,n)},Lr.shuffle=function(e){return(Ga(e)?Kr:Jn)(e)},Lr.slice=function(e,t,r){var n=null==e?0:e.length;return n?(r&&"number"!=typeof r&&yo(e,t,r)?(t=0,r=n):(t=null==t?0:fs(t),r=r===i?n:fs(r)),ei(e,t,r)):[]},Lr.sortBy=Sa,Lr.sortedUniq=function(e){return e&&e.length?ii(e):[]},Lr.sortedUniqBy=function(e,t){return e&&e.length?ii(e,oo(t,2)):[]},Lr.split=function(e,t,r){return r&&"number"!=typeof r&&yo(e,t,r)&&(t=r=i),(r=r===i?f:r>>>0)?(e=ys(e))&&("string"==typeof t||null!=t&&!is(t))&&!(t=ai(t))&&nr(e)?bi(cr(e),0,r):e.split(t,r):[]},Lr.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:mr(fs(t),0),Yn((function(r){var n=r[t],i=bi(r,0,t);return n&&Dt(i,n),Tt(e,this,i)}))},Lr.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Lr.take=function(e,t,r){return e&&e.length?ei(e,0,(t=r||t===i?1:fs(t))<0?0:t):[]},Lr.takeRight=function(e,t,r){var n=null==e?0:e.length;return n?ei(e,(t=n-(t=r||t===i?1:fs(t)))<0?0:t,n):[]},Lr.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Lr.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Lr.tap=function(e,t){return t(e),e},Lr.throttle=function(e,t,r){var n=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Ja(r)&&(n="leading"in r?!!r.leading:n,i="trailing"in r?!!r.trailing:i),ja(e,t,{leading:n,maxWait:t,trailing:i})},Lr.thru=pa,Lr.toArray=ds,Lr.toPairs=Ls,Lr.toPairsIn=ks,Lr.toPath=function(e){return Ga(e)?Rt(e,Mo):ss(e)?[e]:Oi(Po(ys(e)))},Lr.toPlainObject=gs,Lr.transform=function(e,t,r){var n=Ga(e),i=n||Ya(e)||ls(e);if(t=oo(t,4),null==r){var o=e&&e.constructor;r=i?n?new o:[]:Ja(e)&&Ka(o)?kr(Ue(e)):{}}return(i?Et:bn)(e,(function(e,n,i){return t(r,e,n,i)})),r},Lr.unary=function(e){return Oa(e,1)},Lr.union=ea,Lr.unionBy=ta,Lr.unionWith=ra,Lr.uniq=function(e){return e&&e.length?si(e):[]},Lr.uniqBy=function(e,t){return e&&e.length?si(e,oo(t,2)):[]},Lr.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?si(e,i,t):[]},Lr.unset=function(e,t){return null==e||li(e,t)},Lr.unzip=na,Lr.unzipWith=ia,Lr.update=function(e,t,r){return null==e?e:ui(e,t,mi(r))},Lr.updateWith=function(e,t,r,n){return n="function"==typeof n?n:i,null==e?e:ui(e,t,mi(r),n)},Lr.values=qs,Lr.valuesIn=function(e){return null==e?[]:Kt(e,Rs(e))},Lr.without=oa,Lr.words=Ks,Lr.wrap=function(e,t){return Ma(mi(t),e)},Lr.xor=aa,Lr.xorBy=sa,Lr.xorWith=la,Lr.zip=ua,Lr.zipObject=function(e,t){return fi(e||[],t||[],Zr)},Lr.zipObjectDeep=function(e,t){return fi(e||[],t||[],Kn)},Lr.zipWith=ca,Lr.entries=Ls,Lr.entriesIn=ks,Lr.extend=vs,Lr.extendWith=_s,al(Lr,Lr),Lr.add=yl,Lr.attempt=Qs,Lr.camelCase=$s,Lr.capitalize=zs,Lr.ceil=bl,Lr.clamp=function(e,t,r){return r===i&&(r=t,t=i),r!==i&&(r=(r=ms(r))==r?r:0),t!==i&&(t=(t=ms(t))==t?t:0),on(ms(e),t,r)},Lr.clone=function(e){return an(e,4)},Lr.cloneDeep=function(e){return an(e,5)},Lr.cloneDeepWith=function(e,t){return an(e,5,t="function"==typeof t?t:i)},Lr.cloneWith=function(e,t){return an(e,4,t="function"==typeof t?t:i)},Lr.conformsTo=function(e,t){return null==t||sn(e,t,js(t))},Lr.deburr=Bs,Lr.defaultTo=function(e,t){return null==e||e!=e?t:e},Lr.divide=vl,Lr.endsWith=function(e,t,r){e=ys(e),t=ai(t);var n=e.length,o=r=r===i?n:on(fs(r),0,n);return(r-=t.length)>=0&&e.slice(r,o)==t},Lr.eq=qa,Lr.escape=function(e){return(e=ys(e))&&X.test(e)?e.replace(H,tr):e},Lr.escapeRegExp=function(e){return(e=ys(e))&&re.test(e)?e.replace(te,"\\$&"):e},Lr.every=function(e,t,r){var n=Ga(e)?xt:pn;return r&&yo(e,t,r)&&(t=i),n(e,oo(t,3))},Lr.find=ma,Lr.findIndex=Bo,Lr.findKey=function(e,t){return Lt(e,oo(t,3),bn)},Lr.findLast=ga,Lr.findLastIndex=Go,Lr.findLastKey=function(e,t){return Lt(e,oo(t,3),vn)},Lr.floor=_l,Lr.forEach=ya,Lr.forEachRight=ba,Lr.forIn=function(e,t){return null==e?e:gn(e,oo(t,3),Rs)},Lr.forInRight=function(e,t){return null==e?e:yn(e,oo(t,3),Rs)},Lr.forOwn=function(e,t){return e&&bn(e,oo(t,3))},Lr.forOwnRight=function(e,t){return e&&vn(e,oo(t,3))},Lr.get=Es,Lr.gt=$a,Lr.gte=za,Lr.has=function(e,t){return null!=e&&fo(e,t,En)},Lr.hasIn=Os,Lr.head=Vo,Lr.identity=rl,Lr.includes=function(e,t,r,n){e=Va(e)?e:qs(e),r=r&&!n?fs(r):0;var i=e.length;return r<0&&(r=mr(i+r,0)),as(e)?r<=i&&e.indexOf(t,r)>-1:!!i&&qt(e,t,r)>-1},Lr.indexOf=function(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var i=null==r?0:fs(r);return i<0&&(i=mr(n+i,0)),qt(e,t,i)},Lr.inRange=function(e,t,r){return t=ps(t),r===i?(r=t,t=0):r=ps(r),function(e,t,r){return e>=gr(t,r)&&e<mr(t,r)}(e=ms(e),t,r)},Lr.invoke=Is,Lr.isArguments=Ba,Lr.isArray=Ga,Lr.isArrayBuffer=Ua,Lr.isArrayLike=Va,Lr.isArrayLikeObject=Ha,Lr.isBoolean=function(e){return!0===e||!1===e||es(e)&&Tn(e)==y},Lr.isBuffer=Ya,Lr.isDate=Xa,Lr.isElement=function(e){return es(e)&&1===e.nodeType&&!ns(e)},Lr.isEmpty=function(e){if(null==e)return!0;if(Va(e)&&(Ga(e)||"string"==typeof e||"function"==typeof e.splice||Ya(e)||ls(e)||Ba(e)))return!e.length;var t=po(e);if(t==w||t==x)return!e.size;if(Ao(e))return!Nn(e).length;for(var r in e)if(Fe.call(e,r))return!1;return!0},Lr.isEqual=function(e,t){return jn(e,t)},Lr.isEqualWith=function(e,t,r){var n=(r="function"==typeof r?r:i)?r(e,t):i;return n===i?jn(e,t,i,r):!!n},Lr.isError=Wa,Lr.isFinite=function(e){return"number"==typeof e&&Mt(e)},Lr.isFunction=Ka,Lr.isInteger=Qa,Lr.isLength=Za,Lr.isMap=ts,Lr.isMatch=function(e,t){return e===t||Rn(e,t,so(t))},Lr.isMatchWith=function(e,t,r){return r="function"==typeof r?r:i,Rn(e,t,so(t),r)},Lr.isNaN=function(e){return rs(e)&&e!=+e},Lr.isNative=function(e){if(_o(e))throw new Ae("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Dn(e)},Lr.isNil=function(e){return null==e},Lr.isNull=function(e){return null===e},Lr.isNumber=rs,Lr.isObject=Ja,Lr.isObjectLike=es,Lr.isPlainObject=ns,Lr.isRegExp=is,Lr.isSafeInteger=function(e){return Qa(e)&&e>=-9007199254740991&&e<=d},Lr.isSet=os,Lr.isString=as,Lr.isSymbol=ss,Lr.isTypedArray=ls,Lr.isUndefined=function(e){return e===i},Lr.isWeakMap=function(e){return es(e)&&po(e)==j},Lr.isWeakSet=function(e){return es(e)&&"[object WeakSet]"==Tn(e)},Lr.join=function(e,t){return null==e?"":Ut.call(e,t)},Lr.kebabCase=Gs,Lr.last=Wo,Lr.lastIndexOf=function(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var o=n;return r!==i&&(o=(o=fs(r))<0?mr(n+o,0):gr(o,n-1)),t==t?function(e,t,r){for(var n=r+1;n--;)if(e[n]===t)return n;return n}(e,t,o):kt(e,zt,o,!0)},Lr.lowerCase=Us,Lr.lowerFirst=Vs,Lr.lt=us,Lr.lte=cs,Lr.max=function(e){return e&&e.length?fn(e,rl,Sn):i},Lr.maxBy=function(e,t){return e&&e.length?fn(e,oo(t,2),Sn):i},Lr.mean=function(e){return Bt(e,rl)},Lr.meanBy=function(e,t){return Bt(e,oo(t,2))},Lr.min=function(e){return e&&e.length?fn(e,rl,Pn):i},Lr.minBy=function(e,t){return e&&e.length?fn(e,oo(t,2),Pn):i},Lr.stubArray=hl,Lr.stubFalse=ml,Lr.stubObject=function(){return{}},Lr.stubString=function(){return""},Lr.stubTrue=function(){return!0},Lr.multiply=Al,Lr.nth=function(e,t){return e&&e.length?$n(e,fs(t)):i},Lr.noConflict=function(){return dt._===this&&(dt._=ke),this},Lr.noop=sl,Lr.now=Ea,Lr.pad=function(e,t,r){e=ys(e);var n=(t=fs(t))?ur(e):0;if(!t||n>=t)return e;var i=(t-n)/2;return zi(ft(i),r)+e+zi(pt(i),r)},Lr.padEnd=function(e,t,r){e=ys(e);var n=(t=fs(t))?ur(e):0;return t&&n<t?e+zi(t-n,r):e},Lr.padStart=function(e,t,r){e=ys(e);var n=(t=fs(t))?ur(e):0;return t&&n<t?zi(t-n,r)+e:e},Lr.parseInt=function(e,t,r){return r||null==t?t=0:t&&(t=+t),br(ys(e).replace(ne,""),t||0)},Lr.random=function(e,t,r){if(r&&"boolean"!=typeof r&&yo(e,t,r)&&(t=r=i),r===i&&("boolean"==typeof t?(r=t,t=i):"boolean"==typeof e&&(r=e,e=i)),e===i&&t===i?(e=0,t=1):(e=ps(e),t===i?(t=e,e=0):t=ps(t)),e>t){var n=e;e=t,t=n}if(r||e%1||t%1){var o=vr();return gr(e+o*(t-e+st("1e-"+((o+"").length-1))),t)}return Vn(e,t)},Lr.reduce=function(e,t,r){var n=Ga(e)?Ft:Vt,i=arguments.length<3;return n(e,oo(t,4),r,i,cn)},Lr.reduceRight=function(e,t,r){var n=Ga(e)?Nt:Vt,i=arguments.length<3;return n(e,oo(t,4),r,i,dn)},Lr.repeat=function(e,t,r){return t=(r?yo(e,t,r):t===i)?1:fs(t),Hn(ys(e),t)},Lr.replace=function(){var e=arguments,t=ys(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Lr.result=function(e,t,r){var n=-1,o=(t=gi(t,e)).length;for(o||(o=1,e=i);++n<o;){var a=null==e?i:e[Mo(t[n])];a===i&&(n=o,a=r),e=Ka(a)?a.call(e):a}return e},Lr.round=wl,Lr.runInContext=e,Lr.sample=function(e){return(Ga(e)?Xr:Xn)(e)},Lr.size=function(e){if(null==e)return 0;if(Va(e))return as(e)?ur(e):e.length;var t=po(e);return t==w||t==x?e.size:Nn(e).length},Lr.snakeCase=Hs,Lr.some=function(e,t,r){var n=Ga(e)?Pt:ti;return r&&yo(e,t,r)&&(t=i),n(e,oo(t,3))},Lr.sortedIndex=function(e,t){return ri(e,t)},Lr.sortedIndexBy=function(e,t,r){return ni(e,t,oo(r,2))},Lr.sortedIndexOf=function(e,t){var r=null==e?0:e.length;if(r){var n=ri(e,t);if(n<r&&qa(e[n],t))return n}return-1},Lr.sortedLastIndex=function(e,t){return ri(e,t,!0)},Lr.sortedLastIndexBy=function(e,t,r){return ni(e,t,oo(r,2),!0)},Lr.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var r=ri(e,t,!0)-1;if(qa(e[r],t))return r}return-1},Lr.startCase=Ys,Lr.startsWith=function(e,t,r){return e=ys(e),r=null==r?0:on(fs(r),0,e.length),t=ai(t),e.slice(r,r+t.length)==t},Lr.subtract=Tl,Lr.sum=function(e){return e&&e.length?Ht(e,rl):0},Lr.sumBy=function(e,t){return e&&e.length?Ht(e,oo(t,2)):0},Lr.template=function(e,t,r){var n=Lr.templateSettings;r&&yo(e,t,r)&&(t=i),e=ys(e),t=_s({},t,n,Wi);var o,a,s=_s({},t.imports,n.imports,Wi),l=js(s),u=Kt(s,l),c=0,d=t.interpolate||ve,p="__p += '",f=Ee((t.escape||ve).source+"|"+d.source+"|"+(d===Q?de:ve).source+"|"+(t.evaluate||ve).source+"|$","g"),h="//# sourceURL="+(Fe.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++nt+"]")+"\n";e.replace(f,(function(t,r,n,i,s,l){return n||(n=i),p+=e.slice(c,l).replace(_e,rr),r&&(o=!0,p+="' +\n__e("+r+") +\n'"),s&&(a=!0,p+="';\n"+s+";\n__p += '"),n&&(p+="' +\n((__t = ("+n+")) == null ? '' : __t) +\n'"),c=l+t.length,t})),p+="';\n";var m=Fe.call(t,"variable")&&t.variable;if(m){if(ue.test(m))throw new Ae("Invalid `variable` option passed into `_.template`")}else p="with (obj) {\n"+p+"\n}\n";p=(a?p.replace(B,""):p).replace(G,"$1").replace(U,"$1;"),p="function("+(m||"obj")+") {\n"+(m?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(o?", __e = _.escape":"")+(a?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+p+"return __p\n}";var g=Qs((function(){return we(l,h+"return "+p).apply(i,u)}));if(g.source=p,Wa(g))throw g;return g},Lr.times=function(e,t){if((e=fs(e))<1||e>d)return[];var r=f,n=gr(e,f);t=oo(t),e-=f;for(var i=Yt(n,t);++r<e;)t(r);return i},Lr.toFinite=ps,Lr.toInteger=fs,Lr.toLength=hs,Lr.toLower=function(e){return ys(e).toLowerCase()},Lr.toNumber=ms,Lr.toSafeInteger=function(e){return e?on(fs(e),-9007199254740991,d):0===e?e:0},Lr.toString=ys,Lr.toUpper=function(e){return ys(e).toUpperCase()},Lr.trim=function(e,t,r){if((e=ys(e))&&(r||t===i))return Xt(e);if(!e||!(t=ai(t)))return e;var n=cr(e),o=cr(t);return bi(n,Zt(n,o),Jt(n,o)+1).join("")},Lr.trimEnd=function(e,t,r){if((e=ys(e))&&(r||t===i))return e.slice(0,dr(e)+1);if(!e||!(t=ai(t)))return e;var n=cr(e);return bi(n,0,Jt(n,cr(t))+1).join("")},Lr.trimStart=function(e,t,r){if((e=ys(e))&&(r||t===i))return e.replace(ne,"");if(!e||!(t=ai(t)))return e;var n=cr(e);return bi(n,Zt(n,cr(t))).join("")},Lr.truncate=function(e,t){var r=30,n="...";if(Ja(t)){var o="separator"in t?t.separator:o;r="length"in t?fs(t.length):r,n="omission"in t?ai(t.omission):n}var a=(e=ys(e)).length;if(nr(e)){var s=cr(e);a=s.length}if(r>=a)return e;var l=r-ur(n);if(l<1)return n;var u=s?bi(s,0,l).join(""):e.slice(0,l);if(o===i)return u+n;if(s&&(l+=u.length-l),is(o)){if(e.slice(l).search(o)){var c,d=u;for(o.global||(o=Ee(o.source,ys(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(d);)var p=c.index;u=u.slice(0,p===i?l:p)}}else if(e.indexOf(ai(o),l)!=l){var f=u.lastIndexOf(o);f>-1&&(u=u.slice(0,f))}return u+n},Lr.unescape=function(e){return(e=ys(e))&&Y.test(e)?e.replace(V,pr):e},Lr.uniqueId=function(e){var t=++Ne;return ys(e)+t},Lr.upperCase=Xs,Lr.upperFirst=Ws,Lr.each=ya,Lr.eachRight=ba,Lr.first=Vo,al(Lr,(gl={},bn(Lr,(function(e,t){Fe.call(Lr.prototype,t)||(gl[t]=e)})),gl),{chain:!1}),Lr.VERSION="4.17.21",Et(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Lr[e].placeholder=Lr})),Et(["drop","take"],(function(e,t){zr.prototype[e]=function(r){r=r===i?1:mr(fs(r),0);var n=this.__filtered__&&!t?new zr(this):this.clone();return n.__filtered__?n.__takeCount__=gr(r,n.__takeCount__):n.__views__.push({size:gr(r,f),type:e+(n.__dir__<0?"Right":"")}),n},zr.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),Et(["filter","map","takeWhile"],(function(e,t){var r=t+1,n=1==r||3==r;zr.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:r}),t.__filtered__=t.__filtered__||n,t}})),Et(["head","last"],(function(e,t){var r="take"+(t?"Right":"");zr.prototype[e]=function(){return this[r](1).value()[0]}})),Et(["initial","tail"],(function(e,t){var r="drop"+(t?"":"Right");zr.prototype[e]=function(){return this.__filtered__?new zr(this):this[r](1)}})),zr.prototype.compact=function(){return this.filter(rl)},zr.prototype.find=function(e){return this.filter(e).head()},zr.prototype.findLast=function(e){return this.reverse().find(e)},zr.prototype.invokeMap=Yn((function(e,t){return"function"==typeof e?new zr(this):this.map((function(r){return Cn(r,e,t)}))})),zr.prototype.reject=function(e){return this.filter(Na(oo(e)))},zr.prototype.slice=function(e,t){e=fs(e);var r=this;return r.__filtered__&&(e>0||t<0)?new zr(r):(e<0?r=r.takeRight(-e):e&&(r=r.drop(e)),t!==i&&(r=(t=fs(t))<0?r.dropRight(-t):r.take(t-e)),r)},zr.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},zr.prototype.toArray=function(){return this.take(f)},bn(zr.prototype,(function(e,t){var r=/^(?:filter|find|map|reject)|While$/.test(t),n=/^(?:head|last)$/.test(t),o=Lr[n?"take"+("last"==t?"Right":""):t],a=n||/^find/.test(t);o&&(Lr.prototype[t]=function(){var t=this.__wrapped__,s=n?[1]:arguments,l=t instanceof zr,u=s[0],c=l||Ga(t),d=function(e){var t=o.apply(Lr,Dt([e],s));return n&&p?t[0]:t};c&&r&&"function"==typeof u&&1!=u.length&&(l=c=!1);var p=this.__chain__,f=!!this.__actions__.length,h=a&&!p,m=l&&!f;if(!a&&c){t=m?t:new zr(this);var g=e.apply(t,s);return g.__actions__.push({func:pa,args:[d],thisArg:i}),new $r(g,p)}return h&&m?e.apply(this,s):(g=this.thru(d),h?n?g.value()[0]:g.value():g)})})),Et(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ce[e],r=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",n=/^(?:pop|shift)$/.test(e);Lr.prototype[e]=function(){var e=arguments;if(n&&!this.__chain__){var i=this.value();return t.apply(Ga(i)?i:[],e)}return this[r]((function(r){return t.apply(Ga(r)?r:[],e)}))}})),bn(zr.prototype,(function(e,t){var r=Lr[t];if(r){var n=r.name+"";Fe.call(Cr,n)||(Cr[n]=[]),Cr[n].push({name:t,func:r})}})),Cr[Li(i,2).name]=[{name:"wrapper",func:i}],zr.prototype.clone=function(){var e=new zr(this.__wrapped__);return e.__actions__=Oi(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Oi(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Oi(this.__views__),e},zr.prototype.reverse=function(){if(this.__filtered__){var e=new zr(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},zr.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,r=Ga(e),n=t<0,i=r?e.length:0,o=function(e,t,r){for(var n=-1,i=r.length;++n<i;){var o=r[n],a=o.size;switch(o.type){case"drop":e+=a;break;case"dropRight":t-=a;break;case"take":t=gr(t,e+a);break;case"takeRight":e=mr(e,t-a)}}return{start:e,end:t}}(0,i,this.__views__),a=o.start,s=o.end,l=s-a,u=n?s:a-1,c=this.__iteratees__,d=c.length,p=0,f=gr(l,this.__takeCount__);if(!r||!n&&i==l&&f==l)return di(e,this.__actions__);var h=[];e:for(;l--&&p<f;){for(var m=-1,g=e[u+=t];++m<d;){var y=c[m],b=y.iteratee,v=y.type,_=b(g);if(2==v)g=_;else if(!_){if(1==v)continue e;break e}}h[p++]=g}return h},Lr.prototype.at=fa,Lr.prototype.chain=function(){return da(this)},Lr.prototype.commit=function(){return new $r(this.value(),this.__chain__)},Lr.prototype.next=function(){this.__values__===i&&(this.__values__=ds(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Lr.prototype.plant=function(e){for(var t,r=this;r instanceof qr;){var n=ko(r);n.__index__=0,n.__values__=i,t?o.__wrapped__=n:t=n;var o=n;r=r.__wrapped__}return o.__wrapped__=e,t},Lr.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof zr){var t=e;return this.__actions__.length&&(t=new zr(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Jo],thisArg:i}),new $r(t,this.__chain__)}return this.thru(Jo)},Lr.prototype.toJSON=Lr.prototype.valueOf=Lr.prototype.value=function(){return di(this.__wrapped__,this.__actions__)},Lr.prototype.first=Lr.prototype.head,We&&(Lr.prototype[We]=function(){return this}),Lr}();dt._=fr,(n=function(){return fr}.call(t,r,t,e))===i||(e.exports=n)}.call(this)},4495:(e,t,r)=>{var n=r(8942);e.exports=function(){return n.Date.now()}},4772:e=>{e.exports=function(){return!1}},7331:(e,t,r)=>{var n=r(2784),i=r(1580);e.exports=function(e,t,r){var o=!0,a=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return i(r)&&(o="leading"in r?!!r.leading:o,a="trailing"in r?!!r.trailing:a),n(e,t,{leading:o,maxWait:t,trailing:a})}},6131:(e,t,r)=>{var n=r(6403),i=r(1580),o=r(1187),a=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,l=/^0o[0-7]+$/i,u=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(o(e))return NaN;if(i(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=i(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=n(e);var r=s.test(e);return r||l.test(e)?u(e.slice(2),r?2:8):a.test(e)?NaN:+e}},6603:(e,t,r)=>{r.r(t),r.d(t,{DOMException:()=>A,Headers:()=>c,Request:()=>y,Response:()=>v,fetch:()=>w});var n="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||void 0!==r.g&&r.g||{},i={searchParams:"URLSearchParams"in n,iterable:"Symbol"in n&&"iterator"in Symbol,blob:"FileReader"in n&&"Blob"in n&&function(){try{return new Blob,!0}catch(e){return!1}}(),formData:"FormData"in n,arrayBuffer:"ArrayBuffer"in n};if(i.arrayBuffer)var o=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],a=ArrayBuffer.isView||function(e){return e&&o.indexOf(Object.prototype.toString.call(e))>-1};function s(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||""===e)throw new TypeError('Invalid character in header field name: "'+e+'"');return e.toLowerCase()}function l(e){return"string"!=typeof e&&(e=String(e)),e}function u(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return i.iterable&&(t[Symbol.iterator]=function(){return t}),t}function c(e){this.map={},e instanceof c?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){if(2!=e.length)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+e.length);this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function d(e){if(!e._noBody)return e.bodyUsed?Promise.reject(new TypeError("Already read")):void(e.bodyUsed=!0)}function p(e){return new Promise((function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}}))}function f(e){var t=new FileReader,r=p(t);return t.readAsArrayBuffer(e),r}function h(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function m(){return this.bodyUsed=!1,this._initBody=function(e){var t;this.bodyUsed=this.bodyUsed,this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:i.blob&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:i.formData&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:i.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():i.arrayBuffer&&i.blob&&(t=e)&&DataView.prototype.isPrototypeOf(t)?(this._bodyArrayBuffer=h(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):i.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(e)||a(e))?this._bodyArrayBuffer=h(e):this._bodyText=e=Object.prototype.toString.call(e):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):i.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i.blob&&(this.blob=function(){var e=d(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))}),this.arrayBuffer=function(){if(this._bodyArrayBuffer)return d(this)||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer));if(i.blob)return this.blob().then(f);throw new Error("could not read as ArrayBuffer")},this.text=function(){var e,t,r,n,i,o=d(this);if(o)return o;if(this._bodyBlob)return e=this._bodyBlob,r=p(t=new FileReader),i=(n=/charset=([A-Za-z0-9_-]+)/.exec(e.type))?n[1]:"utf-8",t.readAsText(e,i),r;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),r=new Array(t.length),n=0;n<t.length;n++)r[n]=String.fromCharCode(t[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},i.formData&&(this.formData=function(){return this.text().then(b)}),this.json=function(){return this.text().then(JSON.parse)},this}c.prototype.append=function(e,t){e=s(e),t=l(t);var r=this.map[e];this.map[e]=r?r+", "+t:t},c.prototype.delete=function(e){delete this.map[s(e)]},c.prototype.get=function(e){return e=s(e),this.has(e)?this.map[e]:null},c.prototype.has=function(e){return this.map.hasOwnProperty(s(e))},c.prototype.set=function(e,t){this.map[s(e)]=l(t)},c.prototype.forEach=function(e,t){for(var r in this.map)this.map.hasOwnProperty(r)&&e.call(t,this.map[r],r,this)},c.prototype.keys=function(){var e=[];return this.forEach((function(t,r){e.push(r)})),u(e)},c.prototype.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),u(e)},c.prototype.entries=function(){var e=[];return this.forEach((function(t,r){e.push([r,t])})),u(e)},i.iterable&&(c.prototype[Symbol.iterator]=c.prototype.entries);var g=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function y(e,t){if(!(this instanceof y))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');var r,i,o=(t=t||{}).body;if(e instanceof y){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new c(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,o||null==e._bodyInit||(o=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",!t.headers&&this.headers||(this.headers=new c(t.headers)),this.method=(i=(r=t.method||this.method||"GET").toUpperCase(),g.indexOf(i)>-1?i:r),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal||function(){if("AbortController"in n)return(new AbortController).signal}(),this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&o)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(o),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==t.cache&&"no-cache"!==t.cache)){var a=/([?&])_=[^&]*/;a.test(this.url)?this.url=this.url.replace(a,"$1_="+(new Date).getTime()):this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}function b(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var r=e.split("="),n=r.shift().replace(/\+/g," "),i=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(n),decodeURIComponent(i))}})),t}function v(e,t){if(!(this instanceof v))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=void 0===t.statusText?"":""+t.statusText,this.headers=new c(t.headers),this.url=t.url||"",this._initBody(e)}y.prototype.clone=function(){return new y(this,{body:this._bodyInit})},m.call(y.prototype),m.call(v.prototype),v.prototype.clone=function(){return new v(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new c(this.headers),url:this.url})},v.error=function(){var e=new v(null,{status:200,statusText:""});return e.ok=!1,e.status=0,e.type="error",e};var _=[301,302,303,307,308];v.redirect=function(e,t){if(-1===_.indexOf(t))throw new RangeError("Invalid status code");return new v(null,{status:t,headers:{location:e}})};var A=n.DOMException;try{new A}catch(e){(A=function(e,t){this.message=e,this.name=t;var r=Error(e);this.stack=r.stack}).prototype=Object.create(Error.prototype),A.prototype.constructor=A}function w(e,t){return new Promise((function(r,o){var a=new y(e,t);if(a.signal&&a.signal.aborted)return o(new A("Aborted","AbortError"));var u=new XMLHttpRequest;function d(){u.abort()}if(u.onload=function(){var e,t,n={statusText:u.statusText,headers:(e=u.getAllResponseHeaders()||"",t=new c,e.replace(/\r?\n[\t ]+/g," ").split("\r").map((function(e){return 0===e.indexOf("\n")?e.substr(1,e.length):e})).forEach((function(e){var r=e.split(":"),n=r.shift().trim();if(n){var i=r.join(":").trim();try{t.append(n,i)}catch(e){console.warn("Response "+e.message)}}})),t)};0===a.url.indexOf("file://")&&(u.status<200||u.status>599)?n.status=200:n.status=u.status,n.url="responseURL"in u?u.responseURL:n.headers.get("X-Request-URL");var i="response"in u?u.response:u.responseText;setTimeout((function(){r(new v(i,n))}),0)},u.onerror=function(){setTimeout((function(){o(new TypeError("Network request failed"))}),0)},u.ontimeout=function(){setTimeout((function(){o(new TypeError("Network request timed out"))}),0)},u.onabort=function(){setTimeout((function(){o(new A("Aborted","AbortError"))}),0)},u.open(a.method,function(e){try{return""===e&&n.location.href?n.location.href:e}catch(t){return e}}(a.url),!0),"include"===a.credentials?u.withCredentials=!0:"omit"===a.credentials&&(u.withCredentials=!1),"responseType"in u&&(i.blob?u.responseType="blob":i.arrayBuffer&&(u.responseType="arraybuffer")),t&&"object"==typeof t.headers&&!(t.headers instanceof c||n.Headers&&t.headers instanceof n.Headers)){var p=[];Object.getOwnPropertyNames(t.headers).forEach((function(e){p.push(s(e)),u.setRequestHeader(e,l(t.headers[e]))})),a.headers.forEach((function(e,t){-1===p.indexOf(t)&&u.setRequestHeader(t,e)}))}else a.headers.forEach((function(e,t){u.setRequestHeader(t,e)}));a.signal&&(a.signal.addEventListener("abort",d),u.onreadystatechange=function(){4===u.readyState&&a.signal.removeEventListener("abort",d)}),u.send(void 0===a._bodyInit?null:a._bodyInit)}))}w.polyfill=!0,n.fetch||(n.fetch=w,n.Headers=c,n.Request=y,n.Response=v)},7262:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ConnectionDoesNotExistOnProject=void 0;class r extends Error{constructor(e){super(e),this.name="ConnectionDoesNotExistOnProject"}}t.ConnectionDoesNotExistOnProject=r},6537:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DashboardQuotaReached=void 0;class r extends Error{constructor(e){super(e),this.name="DashboardQuotaReached"}}t.DashboardQuotaReached=r},2315:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FailedToCreateDashboard=void 0;class r extends Error{constructor(e){super(e),this.name="FailedToCreateDashboard"}}t.FailedToCreateDashboard=r},4365:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FailedToCreateGlobalLibrary=void 0;class r extends Error{constructor(e){super(e),this.name="FailedToCreateGlobalLibrary"}}t.FailedToCreateGlobalLibrary=r},3482:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FailedToCreateQueryEngineUser=void 0;class r extends Error{constructor(e){super(e),this.name="FailedToCreateQueryEngineUser"}}t.FailedToCreateQueryEngineUser=r},8912:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FailedToDecryptDashboardBeforeClient=void 0;class r extends Error{constructor(){super("Vizzly offers dashboard encryption to keep your dashboard configurations secure.\nPlease ensure your Vizzly Query Engine is still setup to manage encrypted dashboards."),this.name="FailedToDecryptDashboardBeforeClient"}}t.FailedToDecryptDashboardBeforeClient=r},9235:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FailedToFetchConnection=void 0;class r extends Error{constructor(e){super(e),this.name="FailedToFetchConnection"}}t.FailedToFetchConnection=r},4979:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FailedToFetchDashboardAccessTokens=void 0;class r extends Error{constructor(e){super(e),this.name="FailedToFetchDashboardAccessTokens"}}t.FailedToFetchDashboardAccessTokens=r},5186:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FailedToFetchDashboards=void 0;class r extends Error{constructor(e){super(e),this.name="FailedToFetchDashboards"}}t.FailedToFetchDashboards=r},3749:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FailedToFetchGlobalLibraryAccessTokens=void 0;class r extends Error{constructor(e){super(e),this.name="FailedToFetchGlobalLibraryAccessTokens"}}t.FailedToFetchGlobalLibraryAccessTokens=r},2994:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FailedToFetchProject=void 0;class r extends Error{constructor(e){super(e),this.name="FailedToFetchProject"}}t.FailedToFetchProject=r},6689:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FailedToFetchProjects=void 0;class r extends Error{constructor(e){super(e),this.name="FailedToFetchProjects"}}t.FailedToFetchProjects=r},5654:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FailedToFetchQueryEngineUser=void 0;class r extends Error{constructor(e){super(e),this.name="FailedToFetchQueryEngineUser"}}t.FailedToFetchQueryEngineUser=r},3551:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FailedToFetchTeamMembers=void 0;class r extends Error{constructor(e){super(e),this.name="FailedToFetchTeamMembers"}}t.FailedToFetchTeamMembers=r},4455:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FailedToFetchVizzlyConfig=void 0;class r extends Error{constructor(e){super(e),this.name="FailedToFetchVizzlyConfig"}}t.FailedToFetchVizzlyConfig=r},3394:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FailedToResolveDataSets=void 0;class r extends Error{constructor(e){super(e),this.name="FailedToResolveDataSets"}}t.FailedToResolveDataSets=r},8108:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FailedToSaveProjectEncryptedEncryptionSecret=void 0;class r extends Error{constructor(e){super(`Failed to save project encrypted encryption secret for ${e}`),this.name="FailedToSaveProjectEncryptedEncryptionSecret"}}t.FailedToSaveProjectEncryptedEncryptionSecret=r},2309:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FailedToSetupProject=void 0;class r extends Error{constructor(e){super(e),this.name="FailedToSetupProject"}}t.FailedToSetupProject=r},2680:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FailedToUpdateDashboard=void 0;class r extends Error{constructor(e){super(e),this.name="FailedToUpdateDashboard"}}t.FailedToUpdateDashboard=r},2258:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FailedToUpdateGlobalLibrary=void 0;class r extends Error{constructor(e){super(e),this.name="FailedToUpdateGlobalLibrary"}}t.FailedToUpdateGlobalLibrary=r},2325:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FailedToUpdateQueryEngineUser=void 0;class r extends Error{constructor(e){super(e),this.name="FailedToUpdateQueryEngineUser"}}t.FailedToUpdateQueryEngineUser=r},7634:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MissingAuthParameter=void 0;class r extends Error{constructor(e){super(`Missing required auth parameter ${e}`)}}t.MissingAuthParameter=r},642:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRequiredVizzlyQueryEngineApi=void 0;class r extends Error{}t.MissingRequiredVizzlyQueryEngineApi=r},9635:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ProjectEncryptedSecretAlreadySaved=void 0;class r extends Error{constructor(e){super(`Project encrypted encryption secret already exists for ${e}`),this.name="ProjectEncryptedSecretAlreadySaved"}}t.ProjectEncryptedSecretAlreadySaved=r},6081:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SQLPreviewError=void 0;const n=r(9040);class i extends n.ValidationError{constructor(e){super(e),this.name="SQLPreviewError"}}t.SQLPreviewError=i},9040:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ValidationError=void 0;class r extends Error{constructor(e){super(e),this.name="ValidationError"}}t.ValidationError=r},9979:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(6537),t),i(r(2315),t),i(r(4979),t),i(r(5186),t),i(r(7634),t),i(r(642),t),i(r(9040),t),i(r(6081),t),i(r(2309),t),i(r(3394),t),i(r(4365),t),i(r(8912),t),i(r(2680),t),i(r(4455),t),i(r(7262),t),i(r(9235),t),i(r(2994),t),i(r(6689),t),i(r(3551),t),i(r(3482),t),i(r(5654),t),i(r(9635),t),i(r(8108),t)},4843:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)},a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.Errors=void 0,o(r(2890),t),o(r(5512),t),o(r(7855),t),o(r(4640),t),o(r(9800),t),o(r(1171),t),o(r(7783),t),o(r(2474),t),t.Errors=a(r(9979))},3806:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Api=void 0;const o=i(r(3493)),a=r(3052),s=r(7783);t.Api=class{constructor(e,t,r=(()=>({}))){this.host=t,this.extraHeaders=r,this.auth=e}execute(e){return n(this,void 0,void 0,(function*(){var t,n;const i=this.auth.buildAuthHeaders(e.acceptedAuthParams),l=Object.assign(Object.assign({},e.headers||{}),this.extraHeaders()||{}),u=`${this.host}${e.path}`,c=a.Monitor.timeRequest(e.method,u,o.default),d=yield c(u,{method:e.method,headers:Object.assign(Object.assign({"Content-Type":"application/json",Accept:"application/json","Vizzly-User-Agent":`${s.VizzlyApiClientLogger.UserAgentProduct}${this.originApp()} (Using client ${null===(t=r(9034))||void 0===t?void 0:t.version})`},i),l),redirect:"follow",referrerPolicy:"no-referrer",body:e.body?JSON.stringify(e.body):null,signal:e.abortSignal});let p=(null===(n=d.headers.get("content-type"))||void 0===n?void 0:n.includes("json"))?yield d.json():d.text();const f=d.headers.get("vizzly-query-engine-request-id")||"-",h=d.headers.get("x-request-id")||"-";return 500===d.status&&console.log(`[TRACING] QE; ${f} - API; ${h}`,i),s.VizzlyApiClientLogger.debug(`[TRACING] QE; ${f} - API; ${h}`),{body:p,status:d.status,headers:d.headers}}))}originApp(){if("undefined"==typeof window||!window.document){const e=process.env.VIZZLY_ORIGIN_APP||"";return""==e?"":` (${e})`}return""}getAuth(){return this.auth}}},9800:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Authentication=void 0;const n=r(5250),i=r(7634);t.Authentication=class{constructor(e){this.authParams=e}updateAuthParams(e){this.authParams=Object.assign(Object.assign({},this.authParams),e)}clearAuthParams(){this.authParams={}}getQueryEngineAccessToken(){if(!this.authParams.queryEngineAccessToken)throw new i.MissingAuthParameter("queryEngineAccessToken");return this.authParams.queryEngineAccessToken}getProjectAdminOverrideToken(){return this.authParams.projectAdminOverrideToken}getDashboardAccessToken(){if(!this.authParams.dashboardAccessToken)throw new i.MissingAuthParameter("dashboardAccessToken");return this.authParams.dashboardAccessToken}getAppSessionToken(){return this.authParams.appSessionToken}getDataAccessToken(){if(!this.authParams.dataAccessToken)throw new i.MissingAuthParameter("dataAccessToken");return this.authParams.dataAccessToken}getProjectApiKey(){if(!this.authParams.projectApiKey)throw new i.MissingAuthParameter("projectApiKey");return this.authParams.projectApiKey}getProjectAccessToken(){if(!this.authParams.projectAccessToken)throw new i.MissingAuthParameter("projectAccessToken");return this.authParams.projectAccessToken}buildAuthHeaders(e){let t=e?(0,n.pick)(this.authParams,e):this.authParams;return t.dashboardAccessToken?{auth:`Bearer ${t.dashboardAccessToken}`}:t.projectAccessToken?{auth:`Bearer ${t.projectAccessToken}`}:t.projectApiKey?{auth:`Api-Key ${t.projectApiKey}`}:t.appSessionToken?{auth:`Bearer ${t.appSessionToken}`}:{}}}},8607:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.DashboardManager=void 0;const i=r(5250),o=r(4968);class a{constructor(e){this.vizzly=e}create(e){return n(this,void 0,void 0,(function*(){const t=this.vizzly.getDashboardRepository();return yield t.createDashboard(e)}))}update(e){return n(this,void 0,void 0,(function*(){var t,r,a;const s=this.vizzly.getDashboardRepository(),l=this.vizzly.getGlobalLibraryRepository(),[{global_libraries:u,permissions:c},{dashboards:d,permissions:p}]=yield Promise.all([l.fetchGlobalLibraries(e),s.fetchDashboards(e)]),f=d.find((t=>t.id===e.dashboardId));if(!f)throw new Error("Cannot find dashboard to update.");const{parentGlobalLibraries:h,childGlobalLibraries:m}=o.GlobalLibraryRepository.splitParentAndChildGlobalLibraries(u),g=p.find((t=>"read_write"===t.scope&&t.dashboardId===e.dashboardId));if(!g)throw new Error("Failed to find update token for dashboard.");const y=yield s.updateDashboard(Object.assign(Object.assign({},e),{dashboardPermission:g}));let b=[];(null===(t=e.definition)||void 0===t?void 0:t.componentLibrary)&&(b=(0,i.cloneDeep)(e.definition.componentLibrary||[]).filter((e=>!(null!==f.parent_dashboard_id&&e.attributes.protectedByOrganisation))));const v=null===f.parent_dashboard_id?h:m,_=null===f.parent_dashboard_id,A=b.length>0||!!(null===(r=e.definition)||void 0===r?void 0:r.customFields),w=u.find((e=>null===e.parent_global_library_id));!_&&w&&A&&0===v.length&&(yield l.createGlobalLibrary({library:{views:b,customFields:(null===(a=e.definition)||void 0===a?void 0:a.customFields)||{}},parentGlobalLibraryId:w.id,permissions:[{scope:"read_write"}]}));const T=v.map((t=>n(this,void 0,void 0,(function*(){var r;const n=c.find((e=>e.globalLibraryId===t.id&&"read_write"===e.scope));n||console.log("No write permission"),n&&(yield l.updateGlobalLibrary({globalLibrarySessionToken:n.token,library:{views:b,customFields:(null===(r=e.definition)||void 0===r?void 0:r.customFields)||{}}}))}))));return yield Promise.all(T),y}))}getDashboards(e){return n(this,void 0,void 0,(function*(){const t=this.vizzly.getDashboardRepository(),r=this.vizzly.getGlobalLibraryRepository(),[{dashboards:n},{global_libraries:i}]=yield Promise.all([t.fetchDashboards(e),r.fetchGlobalLibraries(e)]);return a.mergeDashboardsAndGlobalLibraries(n,i)}))}static mergeDashboardsAndGlobalLibraries(e,t){return(0,i.cloneDeep)(e).map((r=>{let n=(0,i.cloneDeep)(r.definition.componentLibrary),s=null===r.parent_dashboard_id?[]:e.find((e=>e.id===r.parent_dashboard_id)).definition.componentLibrary,{parentGlobalLibraries:l,childGlobalLibraries:u}=o.GlobalLibraryRepository.splitParentAndChildGlobalLibraries(t);u=null===r.parent_dashboard_id?[]:u;let c=(0,i.uniqBy)([...a.markViewsAsProtected(l.flatMap((e=>e.library.views||[]))),...u.flatMap((e=>e.library.views||[])),...a.markViewsAsProtected(s),...null===r.parent_dashboard_id?a.markViewsAsProtected(n):n||[]],(e=>e.attributes.viewId));return r.definition.componentLibrary=c,r.definition.customFields=a.mergeCustomFields(r,e,l,u),r}))}static mergeCustomFields(e,t,r,n){var o;const a=null===e.parent_dashboard_id?{}:(null===(o=t.find((t=>t.id===e.parent_dashboard_id)))||void 0===o?void 0:o.definition.customFields)||{};return((...e)=>e.reduce(((e,t)=>(Object.keys(e||{}).forEach((r=>{t[r]||(t[r]=[]),t[r]=(0,i.uniqBy)([...t[r],...(null==e?void 0:e[r])||[]],(e=>e.id))})),t)),{}))((0,i.cloneDeep)(e.definition.customFields)||{},(0,i.cloneDeep)(a)||{},...(0,i.cloneDeep)(n).map((e=>e.library.customFields||{})),...(0,i.cloneDeep)(r).map((e=>e.library.customFields||{})))}static markViewsAsProtected(e){return(e||[]).map((e=>Object.assign(Object.assign({},e),{attributes:Object.assign(Object.assign({},e.attributes),{protectedByOrganisation:!0})})))}}t.DashboardManager=a},178:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.DashboardRepository=void 0;const i=r(6537),o=r(2315),a=r(8912),s=r(4979),l=r(2680),u=r(2975),c=r(8328);class d{constructor(e){this.vizzly=e,this.repo=new c.Repository("id")}createDashboard(e){return n(this,void 0,void 0,(function*(){let t;if(this.vizzly.implementationStrategy.shouldPersistViaQueryEngine()){const r=this.vizzly.getVizzlyQueryEngineAPI();t=yield r.execute(r.buildCreateDashboardRequest(e))}else{const r=this.vizzly.getVizzlyAPI();t=yield r.execute(r.buildCreateDashboardRequest(e))}if(200===t.status){const e=t.body.permissions.map(u.Permission.formatDashboardPermission),r=d.embellishDashboardFromAPI(t.body.dashboard,e);return this.repo.addItem(r,e),{dashboard:r,permissions:e}}if(422===t.status)throw new i.DashboardQuotaReached(`Dashboard quota reached; ${JSON.stringify(t.body)}`);if(200!=t.status)throw console.log(),new o.FailedToCreateDashboard(`Failed to create the dashboard from POST /api/v2/dashboard. Got ${t.status}`);throw new o.FailedToCreateDashboard(`Unknown failure. Got status ${t.status}`)}))}updateDashboard(e){return n(this,void 0,void 0,(function*(){let t;if(this.vizzly.implementationStrategy.shouldPersistViaQueryEngine()){const r=this.vizzly.getVizzlyQueryEngineAPI();t=yield r.execute(r.buildUpdateDashboardRequest(e))}else{const r=this.vizzly.getVizzlyAPI();t=yield r.execute(r.buildUpdateDashboardRequest(e))}if(200===t.status){const r=d.embellishDashboardFromAPI(t.body.dashboard,[e.dashboardPermission]);return this.repo.updateItem(r),r}throw new l.FailedToUpdateDashboard(`Failed to update dashboard, got status ${t.status}`)}))}fetchDashboards(e){return n(this,void 0,void 0,(function*(){return yield this.fetchDashboardAccessTokens(e)}))}static embellishDashboardFromAPI(e,t){return Object.assign(Object.assign({},e),{permission:d.takeHighestPermission(e.id,t)})}static takeHighestPermission(e,t){const r=d.takePermissionsOfScope(e,t,"read");return d.takePermissionsOfScope(e,t,"read_write")[0]||r[0]}static takePermissionsOfScope(e,t,r){return t.filter((t=>t.dashboardId===e&&t.scope===r))}fetchDashboardAccessTokens(e){return n(this,void 0,void 0,(function*(){let t;if(!this.repo.isPopulated()){if(this.vizzly.implementationStrategy.shouldPersistViaQueryEngine()){const r=this.vizzly.getVizzlyQueryEngineAPI();t=yield r.execute(r.buildFetchDashboardAccessTokensRequest(e))}else{const r=this.vizzly.getVizzlyAPI();t=yield r.execute(r.buildFetchDashboardAccessTokensRequest(e))}if(200!==t.status)throw new s.FailedToFetchDashboardAccessTokens("Failed to fetch dashboard access tokens.");{const e=t.body.permissions.map(u.Permission.formatDashboardPermission),r=t.body.dashboards.map((t=>{if("string"==typeof t.definition)throw new a.FailedToDecryptDashboardBeforeClient;return d.embellishDashboardFromAPI(t,e)}));this.repo.initRepo(r,e)}}return{dashboards:this.repo.getRepo().storedItems,permissions:this.repo.getRepo().permissions}}))}clearRepo(){this.repo.clear()}}t.DashboardRepository=d},5465:function(e,t){var r=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.GlobalLibraryManager=void 0,t.GlobalLibraryManager=class{constructor(e){this.vizzly=e}create(e){return r(this,void 0,void 0,(function*(){const t=this.vizzly.getGlobalLibraryRepository();return yield t.createGlobalLibrary(e)}))}update(e){return r(this,void 0,void 0,(function*(){const t=this.vizzly.getGlobalLibraryRepository(),{global_libraries:r,permissions:n}=yield t.fetchGlobalLibraries(e);if(!r.find((t=>t.id===e.globalLibraryId)))throw new Error("Global library not found");const i=n.find((t=>t.globalLibraryId===e.globalLibraryId&&"read_write"===t.scope));if(!i)throw new Error("No write permission for this library");return yield t.updateGlobalLibrary({globalLibrarySessionToken:i.token,library:e.library})}))}getGlobalLibraries(e){return r(this,void 0,void 0,(function*(){const t=this.vizzly.getGlobalLibraryRepository();return yield t.fetchGlobalLibraries(e)}))}}},4968:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.GlobalLibraryRepository=void 0;const i=r(5250),o=r(2975),a=r(3749),s=r(8328),l=r(2258);class u{constructor(e){this.vizzly=e,this.repo=new s.Repository("id")}createGlobalLibrary(e){return n(this,void 0,void 0,(function*(){const t=this.vizzly.getVizzlyAPI();let r;if(this.vizzly.implementationStrategy.shouldPersistViaQueryEngine()){const t=this.vizzly.getVizzlyQueryEngineAPI();r=yield t.createGlobalLibrary(e)}else r=yield t.createGlobalLibrary(e);return r.global_library=u.upcast(r.global_library),this.repo.addItem(r.global_library,r.permissions),r}))}fetchGlobalLibraries(e){return n(this,void 0,void 0,(function*(){return yield this.fetchGlobalLibraryAccessTokens(e)}))}fetchGlobalLibraryAccessTokens(e){return n(this,void 0,void 0,(function*(){const t=this.vizzly.getVizzlyAPI();let r;if(!this.repo.isPopulated()){if(this.vizzly.implementationStrategy.shouldPersistViaQueryEngine()){const t=this.vizzly.getVizzlyQueryEngineAPI();r=yield t.fetchGlobalLibraryAccessTokens(e)}else r=yield t.fetchGlobalLibraryAccessTokens(e);if(200!==r.status)throw new a.FailedToFetchGlobalLibraryAccessTokens("Failed to load access tokens for the global library.");{const e=r.body.permissions.map(o.Permission.formatGlobalLibraryPermission);this.repo.initRepo(r.body.global_libraries.map(u.upcast),e)}}return{global_libraries:this.repo.getRepo().storedItems,permissions:this.repo.getRepo().permissions}}))}updateGlobalLibrary(e){return n(this,void 0,void 0,(function*(){let t;const r=this.vizzly.getVizzlyAPI();if(this.vizzly.implementationStrategy.shouldPersistViaQueryEngine()){const r=this.vizzly.getVizzlyQueryEngineAPI();t=yield r.updateGlobalLibrary(e)}else t=yield r.updateGlobalLibrary(e);if(200!=t.status)throw new l.FailedToUpdateGlobalLibrary(`Failed to update the global library ${t.status}`);const n=u.upcast(t.body.global_library);return this.repo.updateItem(n),n}))}getChildGlobalLibrariesByParentGlobalLibraryId(e){return n(this,void 0,void 0,(function*(){const{global_libraries:t}=yield this.fetchGlobalLibraries();return u.mapParentToChildGlobalLibraries(t)[e]||[]}))}static splitParentAndChildGlobalLibraries(e){let t=[],r=[];return e.forEach((e=>{null===e.parent_global_library_id?r=[...r,e]:t=[...t,e]})),{childGlobalLibraries:t,parentGlobalLibraries:r}}static mapParentToChildGlobalLibraries(e){let t={};return(0,i.cloneDeep)(e).forEach((e=>{null!==e.parent_global_library_id&&(t[e.parent_global_library_id]||(t[e.parent_global_library_id]=[]),t[e.parent_global_library_id]=[...t[e.parent_global_library_id],e])})),t}static upcast(e){return Object.assign(Object.assign({},e),{library:Object.assign({views:[],customFields:{}},e.library||{})})}}t.GlobalLibraryRepository=u},1171:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PersistDirectToVizzlyApi=t.PersistViaQueryEngine=t.ImplementationStrategy=void 0;class r{}t.ImplementationStrategy=r,t.PersistViaQueryEngine=class extends r{shouldPersistViaQueryEngine(){return!0}},t.PersistDirectToVizzlyApi=class extends r{shouldPersistViaQueryEngine(){return!1}}},3052:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.Monitor=void 0;const i=r(7783);t.Monitor=class{static timeRequest(e,t,r){return function(...o){return n(this,void 0,void 0,(function*(){const n=performance.now(),a=yield r(...o),s=performance.now()-n;return i.VizzlyApiClientLogger.debug(`[@vizzly/api-client timing] ${e.toUpperCase()} ${t} - ${s.toFixed(2)}ms`),a}))}}}},2975:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Permission=void 0,t.Permission=class{static formatDashboardPermission(e){return{userReference:e.user_reference,scope:e.scope,token:e.token,dashboardId:e.dashboard_id}}static formatGlobalLibraryPermission(e){return{userReference:e.user_reference,scope:e.scope,token:e.token,globalLibraryId:e.global_library_id}}static validateJwtExpiry(e,t=10){try{const[r,n,i]=e.split("."),o=Buffer.from(n,"base64").toString("utf-8"),a=JSON.parse(o).exp;return!(a<Math.floor(Date.now()/1e3)+t)}catch(e){return!1}}}},8328:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Repository=void 0;const n=r(5250),i=r(2975);t.Repository=class{constructor(e){this.itemKey=e,this.storedItems=[],this.permissions=[]}getRepo(){return{storedItems:this.storedItems,permissions:this.permissions}}initRepo(e,t){this.storedItems=e,this.permissions=t}addItem(e,t){this.isPopulated()&&(this.storedItems=[...this.storedItems,e],this.permissions=[...this.permissions,...t])}updateItem(e){this.storedItems=this.storedItems.map((t=>t[this.itemKey]==e[this.itemKey]?e:t))}isPopulated(){return(this.storedItems.length>0||this.permissions.length>0)&&this.permissionsAreFresh()}permissionsAreFresh(){return(0,n.every)(this.permissions,(e=>i.Permission.validateJwtExpiry(e.token)))}clear(){this.storedItems=[],this.permissions=[]}}},2890:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Vizzly=void 0;const n=r(642),i=r(178),o=r(4968),a=r(8607),s=r(5465);t.Vizzly=class{constructor(e,t){this.APIs=e,this.implementationStrategy=t,this.dashboardManager=new a.DashboardManager(this),this.dashboardRepository=new i.DashboardRepository(this),this.globalLibraryRepository=new o.GlobalLibraryRepository(this),this.globalLibraryManager=new s.GlobalLibraryManager(this)}getAPIs(){if(this.implementationStrategy.shouldPersistViaQueryEngine()&&!this.APIs.vizzlyQueryEngineApi)throw new n.MissingRequiredVizzlyQueryEngineApi("Strategy is to persist via a query engine. However no query engine API was provided.");return this.APIs}getVizzlyAppApi(){return this.getAPIs().vizzlyAppApi}getVizzlyQueryEngineAPI(){return this.getAPIs().vizzlyQueryEngineApi}getVizzlyAPI(){return this.getAPIs().vizzlyApi}getDashboardRepository(){return this.dashboardRepository}getGlobalLibraryRepository(){return this.globalLibraryRepository}getDashboardManager(){return this.dashboardManager}getGlobalLibraryManager(){return this.globalLibraryManager}}},5512:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.VizzlyApi=void 0;const i=r(3806),o=r(9979),a=r(4455),s=r(7262),l=r(9235),u=r(2994),c=r(2325),d=r(8108),p=r(9635);class f extends i.Api{constructor(e,t="https://api.vizzly.co"){super(e,t)}buildFetchDashboardAccessTokensRequest(e){return{path:"/api/v2/auth/dashboards/access",method:"post",body:{dashboardAccessToken:this.auth.getDashboardAccessToken(),projectAdminOverrideToken:this.auth.getProjectAdminOverrideToken()},abortSignal:null==e?void 0:e.abortSignal}}fetchGlobalLibraries(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildFetchGlobalLibrariesRequest(e))}))}buildFetchGlobalLibrariesRequest(e){return{path:"/api/v2/multi-get-global-library",method:"post",body:{globalLibraryAccessTokens:e.globalLibraryAccessTokens},abortSignal:e.abortSignal}}fetchGlobalLibraryAccessTokens(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildFetchGlobalLibraryAccessTokensRequest(e))}))}buildFetchGlobalLibraryAccessTokensRequest(e){return{path:"/api/v2/auth/global-library/access",method:"post",body:{dashboardAccessToken:this.auth.getDashboardAccessToken(),projectAdminOverrideToken:this.auth.getProjectAdminOverrideToken()},abortSignal:null==e?void 0:e.abortSignal}}buildCreateDashboardRequest(e){return{path:"/api/v2/dashboard",method:"post",body:{dashboardAccessToken:this.auth.getDashboardAccessToken(),definition:e.definition,meta:e.metadata||e.meta||{},parentDashboardId:e.parentDashboardId,permissions:e.permissions},abortSignal:e.abortSignal}}buildFetchDashboardsRequest(e){return{path:"/api/v2/multi-get-dashboard",method:"post",body:{dashboardAccessTokens:e.dashboardSessionAccessTokens},abortSignal:e.abortSignal}}createParentDashboard(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildCreateParentDashboardRequest(e))}))}buildCreateParentDashboardRequest(e){return{path:"/api/v2/parent-dashboard",method:"post",body:{projectId:e.projectId,definition:e.definition},abortSignal:e.abortSignal}}createParentGlobalLibrary(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildCreateParentGlobalLibraryRequest(e))}))}buildCreateParentGlobalLibraryRequest(e){return{path:"/api/v2/parent-global-library",method:"post",body:{projectId:e.projectId,library:e.library},abortSignal:e.abortSignal}}createGlobalLibrary(e){return n(this,void 0,void 0,(function*(){const t=yield this.execute(this.buildCreateGlobalLibraryRequest(e));if(200===t.status)return t.body;throw new o.FailedToCreateGlobalLibrary("Failed to create global library")}))}buildCreateGlobalLibraryRequest(e){return{path:"/api/v2/global-library",method:"post",body:{dashboardAccessToken:this.auth.getDashboardAccessToken(),parentGlobalLibraryId:e.parentGlobalLibraryId,library:e.library,permissions:e.permissions},abortSignal:e.abortSignal}}getProjects(e){return n(this,void 0,void 0,(function*(){const t=yield this.execute(this.buildGetProjectsRequest(e));if(200===t.status)return{projects:t.body.projects};throw new o.FailedToFetchProjects(`Failed to fetch projects. Got status ${t.status}`)}))}buildGetProjectsRequest(e){return{path:"/api/v2/projects",method:"get",abortSignal:null==e?void 0:e.abortSignal}}createProjectApiKey(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildCreateProjectApiKeyRequest(e))}))}buildCreateProjectApiKeyRequest(e){return{path:`/api/v3/project/${e.projectId}/api-key`,method:"post",body:{},abortSignal:e.abortSignal}}createQueryEngineUser(e){return n(this,void 0,void 0,(function*(){const t=yield this.execute(this.buildCreateQueryEngineUserRequest(e));if(200===t.status)return t.body.query_engine_user;throw new o.FailedToCreateQueryEngineUser(`Failed to create query engine user. Got status ${t.status}`)}))}buildCreateQueryEngineUserRequest(e){return{path:`/api/v3/project/${e.projectId}/query-engine-user`,method:"post",body:{email:e.email,password:e.password},abortSignal:e.abortSignal}}buildCreateSelfHostedDynamicQueryEngineProjectRequest(e){return{path:"/api/v2/project/self-hosted-dynamic-query-engine",method:"post",body:{},abortSignal:null==e?void 0:e.abortSignal}}buildCreateSelfHostedInBrowserProjectRequest(e){return{path:"/api/v2/project/self-hosted-in-browser",method:"post",body:{},abortSignal:null==e?void 0:e.abortSignal}}buildCreateSelfHostedProjectRequest(e){return{path:"/api/v2/project/self-hosted-query-engine",method:"post",body:{},abortSignal:null==e?void 0:e.abortSignal}}createManagedQueryEngineProject(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildCreateManagedQueryEngineProjectRequest(e))}))}buildCreateManagedQueryEngineProjectRequest(e){return{path:"/api/v2/project/managed-query-engine",method:"post",body:{parent_dashboard_definition:{}},abortSignal:null==e?void 0:e.abortSignal}}createVizzlyConfigVersion(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildCreateVizzlyConfigVersionRequest(e))}))}buildCreateVizzlyConfigVersionRequest(e){return{path:`/api/v3/project/${e.projectId}/config`,method:"post",body:{projectId:e.projectId,encryptedConfig:e.encryptedConfig},abortSignal:e.abortSignal}}duplicateParentDashboard(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildDuplicateParentDashboardRequest(e))}))}buildDuplicateParentDashboardRequest(e){return{path:"/api/v2/duplicate-parent-dashboard",method:"post",body:{dashboardId:e.dashboardId},abortSignal:e.abortSignal}}getConnection(e){return n(this,void 0,void 0,(function*(){const t=yield this.execute(this.buildGetConnectionRequest(e));if(200===t.status)return{encryptedCredentials:t.body.encrypted_credentials};if(404==t.status)throw new s.ConnectionDoesNotExistOnProject("An active connection does not exist on the project");throw new l.FailedToFetchConnection(`Failed to fetch connection for the project. Got status ${t.status}`)}))}buildGetConnectionRequest(e){return{path:`/api/v2/project/${e.projectId}/connection`,method:"get",abortSignal:e.abortSignal,acceptedAuthParams:["projectApiKey","projectAccessToken"]}}getManagedQueryEngineKeyPair(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildGetManagedQueryEngineKeyPairRequest(e))}))}buildGetManagedQueryEngineKeyPairRequest(e){return{path:`/api/v2/project/managed-query-engine/${e.managedProjectId}/key-pairs/${e.keyPairId}`,method:"get",abortSignal:e.abortSignal}}getProject(e){return n(this,void 0,void 0,(function*(){const t=yield this.execute(this.buildGetProjectRequest(e));if(200===t.status)return t.body;throw new u.FailedToFetchProject(`Failed to fetch project. Got status ${t.status}`)}))}buildGetProjectRequest(e){return{path:`/api/v3/project/${e.projectId}`,method:"get",abortSignal:e.abortSignal,acceptedAuthParams:["projectApiKey","projectAccessToken"]}}getProjectAccessToken(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildGetProjectAccessTokenRequest(e))}))}buildGetProjectAccessTokenRequest(e){let t="";return e.resourceFilters&&(t=`filter=${e.resourceFilters.join(",")}`),{path:`/api/v2/auth/project/${e.projectId}/access_token?${t}`,method:"get",abortSignal:e.abortSignal,acceptedAuthParams:["projectApiKey","appSessionToken"]}}getQueryEngineUser(e){return n(this,void 0,void 0,(function*(){const t=yield this.execute(this.buildGetQueryEngineUserRequest(e));if(200===t.status)return t.body.query_engine_user;throw new o.FailedToFetchQueryEngineUser(`Failed to fetch query engine user. Got status ${t.status}`)}))}buildGetQueryEngineUserRequest(e){return{path:`/api/v3/project/${e.projectId}/query-engine-user?email=${encodeURIComponent(e.email)}`,method:"get",abortSignal:e.abortSignal,acceptedAuthParams:["projectApiKey","projectAccessToken"]}}getTeamMembers(e){return n(this,void 0,void 0,(function*(){const t=yield this.execute(this.buildGetTeamMembersRequest(e));if(200===t.status)return t.body;throw new o.FailedToFetchTeamMembers(`Failed to fetch team members. Got status ${t.status}`)}))}buildGetTeamMembersRequest(e){return{path:`/api/v3/project/${e.projectId}/organisation-team-members`,method:"get",abortSignal:e.abortSignal,acceptedAuthParams:["projectApiKey","projectAccessToken"]}}getVizzlyConfig(e){return n(this,void 0,void 0,(function*(){const t=yield this.execute(this.buildGetVizzlyConfigRequest(e));if(200===t.status)return{encryptedConfig:t.body.encrypted_config};throw new a.FailedToFetchVizzlyConfig(`Failed to fetch the config containing data sets from the Vizzly API. Got status ${t.status}`)}))}buildGetVizzlyConfigRequest(e){return{path:`/api/v3/project/${e.projectId}/config`,method:"get",abortSignal:e.abortSignal,acceptedAuthParams:["projectApiKey","projectAccessToken"]}}saveConnection(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildSaveConnectionRequest(e))}))}buildSaveConnectionRequest(e){return{path:"/api/v3/project/connection",method:"post",body:{projectId:e.projectId,encryptedConfig:e.encryptedConfig,encryptedConnection:e.encryptedConnection},abortSignal:e.abortSignal,acceptedAuthParams:["projectApiKey","projectAccessToken"]}}saveEncryptedProjectEncryptionSecret(e){return n(this,void 0,void 0,(function*(){const t=yield this.execute(this.buildSaveEncryptedProjectEncryptionSecretRequest(e));if(200===t.status)return!0;if(400==t.status&&!e.allowRotation)throw new p.ProjectEncryptedSecretAlreadySaved(e.projectId);throw new d.FailedToSaveProjectEncryptedEncryptionSecret(e.projectId)}))}buildSaveEncryptedProjectEncryptionSecretRequest(e){return{path:`/api/v3/project/${e.projectId}/encrypted-encryption-secret`,method:"post",body:{projectId:e.projectId,encryptedEncryptionSecret:e.encryptedProjectEncryptionSecret,allowRotation:e.allowRotation},abortSignal:e.abortSignal,acceptedAuthParams:["projectApiKey","projectAccessToken"]}}saveScheduledReport(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildSaveScheduledReportRequest(e))}))}buildSaveScheduledReportRequest(e){return{path:"/api/scheduled-report",method:"post",body:{cronSchedule:e.cronSchedule,dashboardAccessToken:this.auth.getDashboardAccessToken(),scheduledReportId:e.scheduledReportId},abortSignal:e.abortSignal}}updateDashboard(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildUpdateDashboardRequest(e))}))}buildUpdateDashboardRequest(e){return{path:"/api/v2/dashboard",method:"put",body:{dashboardSessionToken:e.dashboardPermission.token,definition:e.definition,meta:e.metadata||e.meta||{},deleted:e.deleted},abortSignal:e.abortSignal}}updateParentGlobalLibrary(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildUpdateParentGlobalLibraryRequest(e))}))}buildUpdateParentGlobalLibraryRequest(e){return{path:"/api/v2/parent-global-library",method:"put",body:{globalLibraryId:e.globalLibraryId,deleted:e.deleted,name:e.name},abortSignal:e.abortSignal}}updateGlobalLibrary(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildUpdateGlobalLibraryRequest(e))}))}buildUpdateGlobalLibraryRequest(e){return{path:"/api/v2/global-library",method:"put",body:{globalLibrarySessionToken:e.globalLibrarySessionToken,deleted:e.deleted,library:e.library},abortSignal:e.abortSignal}}updateProjectApiKey(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildUpdateProjectApiKeyRequest(e))}))}buildUpdateProjectApiKeyRequest(e){return{path:`/api/v3/project/${e.projectId}/api-key/${e.projectApiKeyId}`,method:"put",body:{disabled:e.disabled},abortSignal:e.abortSignal}}updateQueryEngineUser(e){return n(this,void 0,void 0,(function*(){const t=yield this.execute(this.buildUpdateQueryEngineUserRequest(e));if(200===t.status)return!0;throw new c.FailedToUpdateQueryEngineUser(`Failed to update query engine user. Got status ${t.status}`)}))}buildUpdateQueryEngineUserRequest(e){return{path:`/api/v3/project/${e.projectId}/query-engine-user`,method:"put",body:{query_engine_user_id:e.queryEngineUserId,password:e.password},abortSignal:e.abortSignal,acceptedAuthParams:["projectApiKey","projectAccessToken"]}}}t.VizzlyApi=f},7783:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.VizzlyApiClientLogger=void 0;class r{static setBackend(e){this.backend=e}static debug(...e){r.backend&&r.backend.debug(...e)}static info(...e){r.backend&&r.backend.info(...e)}static warning(...e){r.backend&&r.backend.warning(...e)}static error(...e){r.backend&&r.backend.error(...e)}}t.VizzlyApiClientLogger=r,r.UserAgentProduct="Vizzly-Api-Client"},7855:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.VizzlyAppApi=void 0;const i=r(3806);class o extends i.Api{constructor(e,t="https://app.vizzly.co"){super(e,t)}createCliAuthToken(){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildCreateCliAuthTokenRequest())}))}buildCreateCliAuthTokenRequest(){return{path:"/api/create-cli-auth-token",method:"post",body:{}}}createInstantDashboard(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildCreateInstantDashboardRequest(e))}))}buildCreateInstantDashboardRequest(e){return{path:"/api/v2/instant-dashboard",method:"post",body:{parent_dashboard_definition:e.definition}}}createProjectAdminOverrideAccessToken(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildCreateProjectAdminOverrideAccessTokenRequest(e))}))}buildCreateProjectAdminOverrideAccessTokenRequest(e){return{path:`/api/v2/project/${e.projectId}/admin-override`,method:"post",body:{}}}startEmailChange(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildStartEmailChangeRequest(e))}))}buildStartEmailChangeRequest(e){return{path:"/api/self/start-email-change",method:"post",body:{email:e.email}}}completeEmailChange(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildCompleteEmailChangeRequest(e))}))}buildCompleteEmailChangeRequest(e){return{path:"/api/self/complete-email-change",method:"post",body:{token:e.token}}}getManagedQueryEngineAccessTokens(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildGetManagedQueryEngineAccessTokensRequest(e))}))}buildGetManagedQueryEngineAccessTokensRequest(e){return{path:`/api/v2/managed-query-engine/${e.managedQueryEngineId}/identity`,method:"get"}}getParentDashboardMeta(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildGetParentDashboardMetaRequest(e))}))}buildGetParentDashboardMetaRequest(e){return{path:`/api/v2/parent-dashboard/${e.dashboardId}/stats`,method:"get"}}updateParentDashboard(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildUpdateParentDashboardRequest(e))}))}buildUpdateParentDashboardRequest(e){return{path:`/api/v2/parent-dashboard/${e.dashboardId}/stats`,method:"put",body:{name:e.name,definition:e.definition,meta:e.meta,deleted:e.deleted,webhookId:e.webhookId}}}getProjectMeta(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildGetProjectMetaRequest(e))}))}buildGetProjectMetaRequest(e){return{path:`/api/v2/project/${e.projectId}/meta`,method:"get"}}getSelf(){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildGetSelfRequest())}))}buildGetSelfRequest(){return{path:"/api/self",method:"get"}}getTeam(){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildGetTeamRequest())}))}buildGetTeamRequest(){return{path:"/api/team",method:"get"}}getWebhooks(){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildGetWebhooksRequest())}))}buildGetWebhooksRequest(){return{path:"/api/organisation/webhooks",method:"get"}}inviteTeamMember(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildInviteTeamMemberRequest(e))}))}buildInviteTeamMemberRequest(e){return{path:"/api/invite",method:"post",body:{email:e.email,first_name:e.firstName,last_name:e.lastName,department:e.department}}}inAppAcceptTeamMemberInvite(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildInAppAcceptTeamMemberInviteRequest(e))}))}buildInAppAcceptTeamMemberInviteRequest(e){return{path:"/api/invite/in-app-accept",method:"post",body:{team_member_id:e.teamMemberId}}}acceptTeamMemberInvite(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildAcceptTeamMemberInviteRequest(e))}))}buildAcceptTeamMemberInviteRequest(e){return{path:"/api/invite/accept",method:"post",body:{token:e.inviteToken}}}resendTeamMemberInvite(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildResendTeamMemberInviteRequest(e))}))}buildResendTeamMemberInviteRequest(e){return{path:"/api/invite/resend",method:"post",body:{team_member_id:e.teamMemberId}}}removeTeamMember(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildRemoveTeamMemberRequest(e))}))}buildRemoveTeamMemberRequest(e){return{path:"/api/invite/remove",method:"post",body:{team_member_id:e.teamMemberId}}}startSignIn(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildStartSignInRequest(e))}))}buildStartSignInRequest(e){return{path:"/api/start-sign-in",method:"post",body:{email:e.email}}}completeSignIn(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildCompleteSignInRequest(e))}))}buildCompleteSignInRequest(e){return{path:"/api/complete-sign-in",method:"post",body:{token:e.token}}}signUp(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildSignUpRequest(e))}))}buildSignUpRequest(e){return{path:"/api/complete-sign-in",method:"post",body:{email:e.email,organisation_title:e.organisationTitle,first_name:e.firstName,last_name:e.lastName,department:e.department}}}switchOrganisation(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildSwitchOrganisationRequest(e))}))}buildSwitchOrganisationRequest(e){return{path:"/api/team/switch",method:"post",body:{organisation_id:e.organisationId}}}toggleKeyPairDisabled(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildToggleKeyPairDisabledRequest(e))}))}buildToggleKeyPairDisabledRequest(e){return{path:"/api/organisation/key-pairs/toggle-disabled",method:"post",body:{key_pair_id:e.keyPairId,disabled:e.disabled}}}updateProject(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildUpdateProjectRequest(e))}))}buildUpdateProjectRequest(e){return{path:"/api/v2/project",method:"put",body:{project_id:e.projectId,deleted:e.deleted,name:e.name}}}uploadPublicKey(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildUploadPublicKeyRequest(e))}))}buildUploadPublicKeyRequest(e){return{path:"/api/v2/project/key-pair",method:"post",body:{public_key:e.publicKey,project_id:e.projectId}}}}t.VizzlyAppApi=o},4640:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.VizzlyQueryEngineApi=void 0;const i=r(3806),o=r(6081),a=r(3394),s=r(2309),l=r(9979);class u extends i.Api{constructor(e,t,r){super(e,t,r)}buildCreateDashboardRequest(e){return{path:"/api/v1/dashboard",method:"post",abortSignal:e.abortSignal,body:{dashboardAccessToken:this.auth.getDashboardAccessToken(),definition:e.definition,meta:e.metadata||e.meta||{},parentDashboardId:e.parentDashboardId,permissions:e.permissions}}}buildFetchDashboardAccessTokensRequest(e){return{path:"/api/v1/dashboard/access",method:"post",abortSignal:null==e?void 0:e.abortSignal,body:{dashboardAccessToken:this.auth.getDashboardAccessToken(),projectAdminOverrideToken:this.auth.getProjectAdminOverrideToken()}}}fetchGlobalLibraryAccessTokens(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildFetchGlobalLibraryAccessTokensRequest(e))}))}buildFetchGlobalLibraryAccessTokensRequest(e){return{path:"/api/v1/global-library/access",method:"post",abortSignal:null==e?void 0:e.abortSignal,body:{dashboardAccessToken:this.auth.getDashboardAccessToken(),projectAdminOverrideToken:this.auth.getProjectAdminOverrideToken()}}}buildFetchDashboardsRequest(e){return{path:"/api/v1/get-dashboards",method:"post",abortSignal:e.abortSignal,body:{dashboardAccessTokens:e.dashboardSessionAccessTokens}}}createConfigFromUpload(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildCreateConfigFromUploadRequest(e))}))}buildCreateConfigFromUploadRequest(e){return{path:"/api/v1/create-config-from-upload",method:"post",abortSignal:e.abortSignal,body:{queryEngineAccessToken:this.auth.getQueryEngineAccessToken(),table:e.table,fieldPublicNames:e.fieldPublicNames}}}createResults(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildCreateResultsRequest(e))}))}buildCreateResultsRequest(e){return{path:"/api/v1/create-results",method:"post",abortSignal:e.abortSignal,body:{queries:e.queries,virtualFields:{},identityConfigIntegritySignature:this.auth.getDataAccessToken()}}}createSqlPreview(e){return n(this,void 0,void 0,(function*(){var t;const r=yield this.execute(this.buildCreateSqlPreviewRequest(e));if(200===r.status)return r;throw new o.SQLPreviewError((null===(t=null==r?void 0:r.body)||void 0===t?void 0:t.message)||"Unknown SQL error")}))}buildCreateSqlPreviewRequest(e){return{path:"/api/v1/create-sql-preview",method:"post",abortSignal:e.abortSignal,body:{sql:e.sql,parameters:e.parameters,limit:e.limit}}}createQueryEngineUser(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildCreateQueryEngineUserRequest(e))}))}buildCreateQueryEngineUserRequest(e){return{path:"/api/v1/query-engine-user",method:"post",abortSignal:e.abortSignal,body:{email:e.email,password:e.password}}}fetchDataSets(e){return n(this,void 0,void 0,(function*(){const t=this.buildFetchDataSetsRequest(e),r=yield this.execute(t);if(200===r.status)return r;throw new a.FailedToResolveDataSets(`Failed to resolve data sets from ${t.path}. Received status ${r.status}`)}))}buildFetchDataSetsRequest(e){return{path:"/api/v1/resolve-data-sets",method:"post",abortSignal:null==e?void 0:e.abortSignal,body:{integritySignature:this.auth.getDataAccessToken()}}}fetchSelfHostedQueryEngineConfig(e){return n(this,void 0,void 0,(function*(){return this.execute(this.buildFetchSelfHostedQueryEngineConfigRequest(e))}))}buildFetchSelfHostedQueryEngineConfigRequest(e){return{path:"/api/v1/support",method:"post",abortSignal:null==e?void 0:e.abortSignal,body:{}}}fetchProject(e){return n(this,void 0,void 0,(function*(){return this.execute(this.buildFetchProjectRequest(e))}))}buildFetchProjectRequest(e){return{path:"/api/v1/project",method:"get",abortSignal:null==e?void 0:e.abortSignal,body:{}}}getStarted(e){return n(this,void 0,void 0,(function*(){const t=yield this.execute(this.buildGetStartedRequest(e));if(200!=t.status)throw new s.FailedToSetupProject("object"==typeof t.body&&t.body.reason&&"reason"in t.body?t.body.reason:"Failed to create the first user.");return t}))}buildGetStartedRequest(e){return{path:"/api/v2/get-started",method:"post",abortSignal:e.abortSignal,body:{email:e.email,password:e.password}}}getTeamMembers(e){return n(this,void 0,void 0,(function*(){return this.execute(this.buildGetTeamMembersRequest(e))}))}buildGetTeamMembersRequest(e){return{path:"/api/v1/team-members",method:"get",abortSignal:null==e?void 0:e.abortSignal}}isVizzly(e){return n(this,void 0,void 0,(function*(){return this.execute(this.buildIsVizzlyRequest(e))}))}buildIsVizzlyRequest(e){return{path:"/api/is-vizzly",method:"get",abortSignal:null==e?void 0:e.abortSignal}}saveConfig(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildSaveConfigRequest(e))}))}buildSaveConfigRequest(e){return{path:"/api/v1/save-config",method:"post",abortSignal:e.abortSignal,body:{config:e.config}}}saveConnection(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildSaveConnectionRequest(e))}))}buildSaveConnectionRequest(e){return{path:"/api/v1/save-connection",method:"post",abortSignal:e.abortSignal,body:{connection:e.connection,client:e.client}}}signInWithQueryEngineAccessToken(e){return n(this,void 0,void 0,(function*(){return this.execute(this.buildSignInWithQueryEngineAccessTokenRequest(e))}))}buildSignInWithQueryEngineAccessTokenRequest(e){return{path:"/api/v1/sign-in",method:"post",abortSignal:null==e?void 0:e.abortSignal,body:{}}}signInWithEmailAndPassword(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildSignInWithEmailAndPasswordRequest(e))}))}buildSignInWithEmailAndPasswordRequest(e){return{path:"/api/v1/sign-in",method:"post",abortSignal:e.abortSignal,body:{email:e.email,password:e.password}}}status(e){return n(this,void 0,void 0,(function*(){return this.execute(this.buildStatusRequest(e))}))}buildStatusRequest(e){return{path:"/api/status",method:"post",abortSignal:null==e?void 0:e.abortSignal,body:{}}}createGlobalLibrary(e){return n(this,void 0,void 0,(function*(){const t=yield this.execute(this.buildCreateGlobalLibraryRequest(e));if(200===t.status)return t.body;throw new l.FailedToCreateGlobalLibrary(`Failed to create a global library. Got status ${t.status}`)}))}buildCreateGlobalLibraryRequest(e){return{path:"/api/v1/global-library",method:"post",abortSignal:e.abortSignal,body:{dashboardAccessToken:this.auth.getDashboardAccessToken(),parentGlobalLibraryId:e.parentGlobalLibraryId,library:e.library,permissions:e.permissions}}}fetchGlobalLibraries(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildFetchGlobalLibrariesRequest(e))}))}buildFetchGlobalLibrariesRequest(e){return{path:"/api/v1/get-global-libraries",method:"post",abortSignal:e.abortSignal,body:{globalLibraryAccessTokens:e.globalLibraryAccessTokens}}}updateGlobalLibrary(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildUpdateGlobalLibraryRequest(e))}))}buildUpdateGlobalLibraryRequest(e){return{path:"/api/v1/global-library",method:"put",abortSignal:e.abortSignal,body:{globalLibrarySessionToken:e.globalLibrarySessionToken,deleted:e.deleted,library:e.library}}}updateDashboard(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildUpdateDashboardRequest(e))}))}buildUpdateDashboardRequest(e){return{path:"/api/v1/dashboard",method:"put",abortSignal:e.abortSignal,body:{dashboardSessionToken:e.dashboardPermission.token,definition:e.definition,meta:e.metadata||e.meta||{},deleted:e.deleted}}}updateQueryEngineUser(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildUpdateQueryEngineUserRequest(e))}))}buildUpdateQueryEngineUserRequest(e){return{path:"/api/v1/query-engine-user",method:"put",abortSignal:e.abortSignal,body:{queryEngineUserId:e.queryEngineUserId,password:e.password}}}uploadDataToVizzlyCloud(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildUploadDataToVizzlyCloudRequest(e))}))}buildUploadDataToVizzlyCloudRequest(e){return{path:"/api/v1/ingest",method:"post",abortSignal:e.abortSignal,body:{queryEngineAccessToken:this.auth.getQueryEngineAccessToken(),ingest:e.ingest}}}}t.VizzlyQueryEngineApi=u},2474:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(1741),t),i(r(2016),t),i(r(1048),t),i(r(9774),t)},1741:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},2016:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},1048:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},9774:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},9450:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.queryEngineConfig=void 0;const n=r(7513);t.queryEngineConfig=()=>({origin:"query-engine",supportedFeatures:["simpleMaths","aggregateMaths","subquery","configManagerUi","sqlDefinedDataSet","roundedNumbers","switchField","encryptedDashboards","sqlViews","dateMaths"],supportedTimeTruncFunctions:(0,n.supportedTimeTruncFunctions)(["month","year","quarter","week","day","hour","minute","second"]),supportedAggregates:(0,n.supportedAggregates)(["sum","mean","min","max","count","countDistinct"]),supportedOperators:(0,n.supportedOperators)([">","<","=","!=",">=","<=","is_one_of","is_not_one_of","starts_with","ends_with","contains_substring","does_not_contain_substring","array_contains"]),supportedTransformationFunctions:(0,n.supportedTransformationFunctions)(["round_to_0_dp","round_to_2_dp"])})},9667:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.supportedAggregatesConstants=t.timeDimensionsConstants=t.supportedOperatorsConstants=void 0,t.supportedOperatorsConstants={">":{publicName:"Greater than",validDataTypes:["number","date_time"]},"<":{publicName:"Less than",validDataTypes:["number","date_time"]},"<=":{publicName:"Less than or equal to",validDataTypes:["number","date_time"]},">=":{publicName:"Greater than or equal to",validDataTypes:["number","date_time"]},"!=":{publicName:"Not equal to",validDataTypes:["number","date_time","boolean","string"]},is_one_of:{publicName:"Is one of",validDataTypes:["number","date_time","boolean","string"]},"=":{publicName:"Equal to",validDataTypes:["number","date_time","boolean","string"]},is_not_one_of:{publicName:"Is not one of",validDataTypes:["number","date_time","boolean","string"]},starts_with:{publicName:"Starts with",validDataTypes:["string"]},ends_with:{publicName:"Ends with",validDataTypes:["string"]},contains_substring:{publicName:"Contains text",validDataTypes:["string"]},does_not_contain_substring:{publicName:"Does not contain text",validDataTypes:["string"]},array_contains:{publicName:"Contains",validDataTypes:["string[]"]}},t.timeDimensionsConstants={month:{publicName:"Monthly",dateFormat:"MMMM YYYY"},year:{publicName:"Yearly",dateFormat:"YYYY"},quarter:{publicName:"Per quarter",dateFormat:"quarter"},week:{publicName:"Weekly",dateFormat:"week"},day:{publicName:"Daily",dateFormat:"DD-MM-YYYY"},second:{publicName:"Per second",dateFormat:"hh:mm:ss"},hour:{publicName:"Hourly",dateFormat:"hh:mm"},minute:{publicName:"Per minute",dateFormat:"hh:mm"}},t.supportedAggregatesConstants={mean:{publicName:"Mean",validDataTypes:["number"]},sum:{publicName:"Sum",validDataTypes:["number"]},min:{publicName:"Min",validDataTypes:["number"]},max:{publicName:"Max",validDataTypes:["number"]},count:{publicName:"Count",validDataTypes:["string","number","boolean","date_time","string[]"]},countDistinct:{publicName:"Unique",validDataTypes:["string","number","boolean","date_time"]},median:{publicName:"Median",validDataTypes:["number"]},percentile25:{publicName:"25th percentile",validDataTypes:["number"]},percentile75:{publicName:"75th percentile",validDataTypes:["number"]},percentile90:{publicName:"90th percentile",validDataTypes:["number"]},percentile95:{publicName:"95th percentile",validDataTypes:["number"]},percentile99:{publicName:"99th percentile",validDataTypes:["number"]}}},6676:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.getQueryEngineConfig=void 0;const a=o(r(3543)),s=o(r(5133)),l=o(r(9450)),u=o(r(1047)),c=o(r(8590)),d=o(r(5226)),p=o(r(9488)),f=r(1594);t.getQueryEngineConfig=e=>{switch(e){case"js":return f.localQueryEngineConfig;case"postgres":return a.queryEngineConfig();case"redshift":return s.queryEngineConfig();case"bigquery":return l.queryEngineConfig();case"mariadb":return c.queryEngineConfig();case"snowflake":return d.queryEngineConfig();case"mysql":return p.queryEngineConfig();case"microsoftSQLServer":return u.queryEngineConfig();case"SQLite":throw"SQLite not support via the query engine"}}},8162:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)},a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.Support=t.Constants=void 0,o(r(6676),t),o(r(4002),t),t.Constants=a(r(9667)),t.Support=a(r(7513))},1594:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.localQueryEngineConfig=void 0;const n=r(7513);t.localQueryEngineConfig={origin:"in-browser",supportedFeatures:["simpleMaths","aggregateMaths","subquery","encryptedDashboards","switchField","roundedNumbers","encryptedDashboards","dateMaths"],supportedTimeTruncFunctions:(0,n.supportedTimeTruncFunctions)(["month","year","quarter","week","day","hour","minute","second"]),supportedAggregates:(0,n.supportedAggregates)(["sum","mean","min","max","count","countDistinct","median"]),supportedOperators:(0,n.supportedOperators)([">","<","=","!=",">=","<=","is_one_of","is_not_one_of","starts_with","ends_with","contains_substring","does_not_contain_substring","array_contains"]),supportedTransformationFunctions:(0,n.supportedTransformationFunctions)(["round_to_0_dp","round_to_2_dp"])}},8590:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.queryEngineConfig=void 0;const n=r(7513);t.queryEngineConfig=()=>({origin:"query-engine",supportedFeatures:["simpleMaths","subquery","configManagerUi","switchField","sqlDefinedDataSet","roundedNumbers","aggregateMaths","encryptedDashboards","sqlViews","dateMaths"],supportedTimeTruncFunctions:(0,n.supportedTimeTruncFunctions)(["month","year","day","hour","minute","second"]),supportedAggregates:(0,n.supportedAggregates)(["sum","mean","min","max","count","countDistinct"]),supportedOperators:(0,n.supportedOperators)([">","<","=","!=",">=","<=","is_one_of","is_not_one_of","starts_with","ends_with","contains_substring","does_not_contain_substring"]),supportedTransformationFunctions:(0,n.supportedTransformationFunctions)(["round_to_0_dp","round_to_2_dp"])})},4002:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.merge=void 0;const n=r(5250);t.merge=(...e)=>e.reduce(((e,t)=>{const r=r=>{let i=e[r],o=t[r];if("object"==typeof i&&"object"==typeof o){const e=(0,n.intersection)(Object.keys(i),Object.keys(o));return(0,n.pick)(t[r],e)}throw"Cannot intersect non-object type in mapIntersection function."};return{origin:"query-engine",supportedAggregates:r("supportedAggregates"),supportedFeatures:(0,n.intersection)(e.supportedFeatures,t.supportedFeatures),supportedOperators:r("supportedOperators"),supportedTimeTruncFunctions:r("supportedTimeTruncFunctions"),supportedTransformationFunctions:r("supportedTransformationFunctions")}}),e[0])},1047:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.queryEngineConfig=void 0;const n=r(7513);t.queryEngineConfig=()=>({origin:"query-engine",supportedFeatures:["simpleMaths","aggregateMaths","subquery","configManagerUi","switchField","roundedNumbers","sqlDefinedDataSet","encryptedDashboards","sqlViews","dateMaths"],supportedTimeTruncFunctions:(0,n.supportedTimeTruncFunctions)(["month","year","quarter","week","day","hour","minute","second"]),supportedAggregates:(0,n.supportedAggregates)(["sum","mean","min","max","count","countDistinct"]),supportedOperators:(0,n.supportedOperators)([">","<","=","!=",">=","<=","is_one_of","is_not_one_of","starts_with","ends_with","contains_substring","does_not_contain_substring","array_contains"]),supportedTransformationFunctions:(0,n.supportedTransformationFunctions)(["round_to_0_dp","round_to_2_dp"])})},9488:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.queryEngineConfig=void 0;const n=r(7513);t.queryEngineConfig=()=>({origin:"query-engine",supportedFeatures:["simpleMaths","subquery","configManagerUi","sqlDefinedDataSet","roundedNumbers","aggregateMaths","encryptedDashboards","sqlViews","dateMaths"],supportedTimeTruncFunctions:(0,n.supportedTimeTruncFunctions)(["month","year","day","hour","minute","second"]),supportedAggregates:(0,n.supportedAggregates)(["sum","mean","min","max","count","countDistinct"]),supportedOperators:(0,n.supportedOperators)([">","<","=","!=",">=","<=","is_one_of","is_not_one_of","starts_with","ends_with","contains_substring","does_not_contain_substring"]),supportedTransformationFunctions:(0,n.supportedTransformationFunctions)(["round_to_0_dp","round_to_2_dp"])})},3543:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.queryEngineConfig=void 0;const n=r(7513);t.queryEngineConfig=()=>({origin:"query-engine",supportedFeatures:["simpleMaths","aggregateMaths","subquery","configManagerUi","switchField","roundedNumbers","sqlDefinedDataSet","encryptedDashboards","sqlViews","dateMaths"],supportedTimeTruncFunctions:(0,n.supportedTimeTruncFunctions)(["month","year","quarter","week","day","hour","minute","second"]),supportedAggregates:(0,n.supportedAggregates)(["sum","mean","median","min","max","count","countDistinct","percentile25","percentile75","percentile90","percentile95","percentile99"]),supportedOperators:(0,n.supportedOperators)([">","<","=","!=",">=","<=","is_one_of","is_not_one_of","starts_with","ends_with","contains_substring","does_not_contain_substring","array_contains"]),supportedTransformationFunctions:(0,n.supportedTransformationFunctions)(["round_to_0_dp","round_to_2_dp"])})},5133:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.queryEngineConfig=void 0;const n=r(7513);t.queryEngineConfig=()=>({origin:"query-engine",supportedFeatures:["simpleMaths","aggregateMaths","subquery","configManagerUi","switchField","roundedNumbers","sqlDefinedDataSet","encryptedDashboards","sqlViews","dateMaths"],supportedTimeTruncFunctions:(0,n.supportedTimeTruncFunctions)(["month","year","quarter","week","day","hour","minute","second"]),supportedAggregates:(0,n.supportedAggregates)(["sum","mean","min","max","count","countDistinct"]),supportedOperators:(0,n.supportedOperators)([">","<","=","!=",">=","<=","is_one_of","is_not_one_of","starts_with","ends_with","contains_substring","does_not_contain_substring","array_contains"]),supportedTransformationFunctions:(0,n.supportedTransformationFunctions)(["round_to_0_dp","round_to_2_dp"])})},5226:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.queryEngineConfig=void 0;const n=r(7513);t.queryEngineConfig=()=>({origin:"query-engine",supportedFeatures:["simpleMaths","aggregateMaths","subquery","configManagerUi","sqlDefinedDataSet","roundedNumbers","switchField","encryptedDashboards","sqlViews","dateMaths"],supportedTimeTruncFunctions:(0,n.supportedTimeTruncFunctions)(["month","year","quarter","week","day","hour","minute","second"]),supportedAggregates:(0,n.supportedAggregates)(["sum","mean","median","min","max","count","countDistinct","percentile25","percentile75","percentile90","percentile95","percentile99"]),supportedOperators:(0,n.supportedOperators)([">","<","=","!=",">=","<=","is_one_of","is_not_one_of","starts_with","ends_with","contains_substring","does_not_contain_substring","array_contains"]),supportedTransformationFunctions:(0,n.supportedTransformationFunctions)(["round_to_0_dp","round_to_2_dp"])})},7513:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validOperatorsForField=t.ALL_SUPPORTED_CONSTANTS=t.isSupportedTimeTruncFunction=t.isSupportedAggregate=t.isSupportedAggregateFunction=t.supportedAggregates=t.supportedTimeTruncFunctions=t.supportedOperators=t.supportedAggregatesFunction=t.supportedTransformationFunctions=void 0;const n=r(5250),i=r(9667),o={round_to_0_dp:{publicName:"Round to 0dp",validDataTypes:["number"]},round_to_2_dp:{publicName:"Round to 2dp",validDataTypes:["number"]}};t.supportedTransformationFunctions=e=>{const t=(0,n.cloneDeep)(o);if(!e)return t;let r={};return e.forEach((e=>{if(!t[e])throw`Transformation function ${e} is not managed by Vizzly`;r[e]=t[e]})),r},t.supportedAggregatesFunction=(e,t,r)=>{const n=e.supportedAggregates,i=Object.keys(n).filter((e=>n[e].validDataTypes.includes(t)));let o=r&&r.length>0?r.filter((e=>i.includes(e))):i;return r&&r.length>0&&0===o.length&&(o=i),o},t.supportedOperators=e=>{const t=(0,n.cloneDeep)(i.supportedOperatorsConstants);if(!e)return t;let r={};return e.forEach((e=>{if(!i.supportedOperatorsConstants[e])throw`Operator ${e} not managed by Vizzly`;r[e]=i.supportedOperatorsConstants[e]})),r},t.supportedTimeTruncFunctions=e=>{const t=(0,n.cloneDeep)(i.timeDimensionsConstants);if(!e)return t;let r={};return e.forEach((e=>{if(!t[e])throw`Time trunc function ${e} not managed by Vizzly`;r[e]=t[e]})),r},t.supportedAggregates=e=>{const t=(0,n.cloneDeep)(i.supportedAggregatesConstants);if(!e)return t;let r={};return e.forEach((e=>{if(!t[e])throw`Aggregate ${e} not managed by Vizzly`;r[e]=t[e]})),r},t.isSupportedAggregateFunction=(e,t)=>[...Object.keys(e),"none"].includes(t),t.isSupportedAggregate=(e,t)=>"string"==typeof e&&t.hasOwnProperty(e),t.isSupportedTimeTruncFunction=(e,t)=>[...Object.keys(e),"none"].includes(t),t.ALL_SUPPORTED_CONSTANTS=[{namespace:"config.supported_operator",constants:i.supportedOperatorsConstants},{namespace:"config.supported_aggregate",constants:i.supportedAggregatesConstants},{namespace:"config.supported_time",constants:i.timeDimensionsConstants}],t.validOperatorsForField=(e,t)=>{let r=[...Object.keys(t.supportedOperators)];return r=r.filter((t=>i.supportedOperatorsConstants[t].validDataTypes.includes(e.dataType))),r}},4639:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ENVIRONMENT_VARIABLES_TO_REQUIRED=t.vizzlyToPossibleNativeDataTypes=t.NATIVE_DATA_TYPES=t.SUPPORTED_CLIENTS=void 0;const n=r(5250),i=r(6342);t.SUPPORTED_CLIENTS=["bigquery","mariadb","postgres","snowflake","mysql","microsoftSQLServer","redshift"];const o=e=>(0,n.reduce)(Object.keys(i.NATIVE_DATA_TYPES_DATABASE[e]),((e,t)=>Object.assign(Object.assign({},e),{[t]:t})),{});t.NATIVE_DATA_TYPES={mysql:o("mysql"),snowflake:o("snowflake"),postgres:o("postgres"),redshift:o("redshift"),mariadb:o("mariadb"),bigquery:o("bigquery"),microsoftSQLServer:o("microsoftSQLServer")},t.vizzlyToPossibleNativeDataTypes=(e,t)=>{let r=[];return Object.entries(i.NATIVE_DATA_TYPES_DATABASE[e]).forEach((([e,{normalizedType:n}])=>{n==t&&(r=[...r,e])})),r},t.ENVIRONMENT_VARIABLES_TO_REQUIRED={postgres:{VIZZLY_POSTGRES_PASSWORD:!0,VIZZLY_POSTGRES_DATABASE:!0,VIZZLY_POSTGRES_USER:!0,VIZZLY_POSTGRES_HOST:!0,VIZZLY_POSTGRES_PORT:!1},mariadb:{VIZZLY_MARIADB_PASSWORD:!0,VIZZLY_MARIADB_DATABASE:!0,VIZZLY_MARIADB_USER:!0,VIZZLY_MARIADB_HOST:!0,VIZZLY_MARIADB_PORT:!1},mysql:{VIZZLY_MYSQL_PASSWORD:!0,VIZZLY_MYSQL_DATABASE:!0,VIZZLY_MYSQL_USER:!0,VIZZLY_MYSQL_HOST:!0,VIZZLY_MYSQL_PORT:!1},elasticsearch:{VIZZLY_ELASTICSEARCH_CLOUD_ID:!0,VIZZLY_ELASTICSEARCH_API_KEY:!0,VIZZLY_ELASTICSEARCH_NODE:!0,VIZZLY_ELASTICSEARCH_USERNAME:!0,VIZZLY_ELASTICSEARCH_PASSWORD:!0,VIZZLY_ELASTICSEARCH_API_KEY_ID:!0},bigquery:{VIZZLY_BIGQUERY_PROJECT_ID:!0,VIZZLY_BIGQUERY_REGION:!0,VIZZLY_BIGQUERY_KEY_FILENAME:!1,VIZZLY_BIGQUERY_CREDENTIALS:!1},snowflake:{VIZZLY_SNOWFLAKE_PASSWORD:!0,VIZZLY_SNOWFLAKE_DATABASE:!1,VIZZLY_SNOWFLAKE_USERNAME:!0,VIZZLY_SNOWFLAKE_ACCOUNT:!0,VIZZLY_SNOWFLAKE_WAREHOUSE:!0,VIZZLY_SNOWFLAKE_ROLE:!0,VIZZLY_SNOWFLAKE_SCHEMA:!1,VIZZLY_SNOWFLAKE_SESSION_KEEP_ALIVE:!1},microsoftSQLServer:{VIZZLY_MICROSOFT_SQL_SERVER_PASSWORD:!0,VIZZLY_MICROSOFT_SQL_SERVER_DATABASE:!0,VIZZLY_MICROSOFT_SQL_SERVER_USER:!0,VIZZLY_MICROSOFT_SQL_SERVER_HOST:!0,VIZZLY_MICROSOFT_SQL_SERVER_PORT:!1}}},3342:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.validate=void 0;const i=n(r(746));t.validate=i.default},746:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ID_REGEX_ERROR_MESSAGE=t.ALLOWED_ID_REGEX=void 0;const i=n(r(4579)),o=r(6676),a=r(4639),s=r(7513),l=r(9667),u=r(8284),c=["unencryptedCredentials","encryptedCredentials"],d=Object.keys(l.supportedOperatorsConstants),p=["second","minute","hour","day","week","month","quarter","year"];t.ALLOWED_ID_REGEX=/^[a-zA-Z0-9_+:\/=\-\s]*$/,t.ID_REGEX_ERROR_MESSAGE="IDs must only use alpha numeric characters and _";const f={checkConnectionSpecificDataSets:!0},h={abortEarly:!1,allowUnknown:!0},m=e=>i.default.object({id:i.default.string().required().regex(t.ALLOWED_ID_REGEX,t.ID_REGEX_ERROR_MESSAGE).description("A unique identifier for this field. It should not change unless the meaning of the field, or the data type has changed."),publicName:i.default.string().optional().allow("").description("The name of this field that you want your users to see. This can be changed as much as you like without causing a breaking change."),address:i.default.array().items(i.default.string()).optional().description('The address of the column in your database. For example; ["database_name", "table_name", "column_name"] or for BigQuery; ["bigquery project id", "bigquery data set id", "table name", "column name"]'),description:i.default.string().allow("").optional().max(110).description("A description of what the purpose of this data set is"),sql:i.default.string().optional().description("Provide a SQL definition of the field, instead of a table & name combination."),dataType:i.default.valid(...Object.values(a.NATIVE_DATA_TYPES[e])).required(),canBeDimension:i.default.boolean().optional(),canBeMeasure:i.default.boolean().optional(),canBeUsedInSort:i.default.boolean().optional(),allowedGranularities:i.default.array().items(i.default.string().valid(...p)).optional(),allowedOperators:i.default.alternatives().conditional("..dataType",{is:i.default.string().valid(...(0,a.vizzlyToPossibleNativeDataTypes)(e,"string")),then:i.default.array().items(i.default.string().valid(...(0,s.validOperatorsForField)({dataType:"string"},(0,o.getQueryEngineConfig)(e)))).description("For fields that have a string data type.")}).conditional("..dataType",{is:i.default.string().valid(...(0,a.vizzlyToPossibleNativeDataTypes)(e,"number")),then:i.default.array().items(i.default.string().valid(...(0,s.validOperatorsForField)({dataType:"number"},(0,o.getQueryEngineConfig)(e)))).description("For fields that have a number data type.")}).conditional("..dataType",{is:i.default.string().valid(...(0,a.vizzlyToPossibleNativeDataTypes)(e,"date_time")),then:i.default.array().items(i.default.valid(...(0,s.validOperatorsForField)({dataType:"date_time"},(0,o.getQueryEngineConfig)(e)))).description("For fields that have a date time data type.")}).conditional("..dataType",{is:i.default.string().valid(...(0,a.vizzlyToPossibleNativeDataTypes)(e,"boolean")),then:i.default.array().items(i.default.string().valid(...(0,s.validOperatorsForField)({dataType:"boolean"},(0,o.getQueryEngineConfig)(e)))).description("For fields that have a boolean data type.")}).conditional("..dataType",{is:i.default.string().valid(...(0,a.vizzlyToPossibleNativeDataTypes)(e,"string[]")),then:i.default.array().items(i.default.string().valid(...(0,s.validOperatorsForField)({dataType:"string[]"},(0,o.getQueryEngineConfig)(e)))).description("For fields that have a string array data type.")}).optional()}),g=i.default.object({type:i.default.string().valid("rightJoin","leftJoin","innerJoin","outerJoin","leftOuterJoin","rightOuterJoin").required(),left:i.default.array().items(i.default.string()).required(),right:i.default.array().items(i.default.string()).required()}),y=i.default.object({fieldId:i.default.string().required(),op:i.default.string().valid(...d).required()}),b=e=>i.default.object(Object.assign(Object.assign({},(e=>({id:i.default.string().required().regex(t.ALLOWED_ID_REGEX,t.ID_REGEX_ERROR_MESSAGE).description("A unique ID for the data set. This should not change unless the meaning of the data set represents changes."),connectionId:i.default.string().required(),hide:i.default.boolean().optional().description("Hide the data set from the dashboard."),name:i.default.string().required().description("A public name for the data set. This can change as much as you like without causing a breaking change."),description:i.default.string().allow("").optional().max(110).description("A description of what this field represents"),sql:i.default.string().optional().description("Optionally define the data set using a SQL statement. If used, the `table` value for each field should equal `vizzly_data_set`."),testParameters:i.default.string().optional().description("Test parameters that are used when creating SQL backed data sets. This is a stringified JSON object."),preAggregated:i.default.alternatives(i.default.array().items(i.default.string()).description("Array of data set IDs relied on by the pre-aggregated data set"),i.default.boolean().allow(!1).description("Only `False` is a valid boolean option. For truthy values, provide an array of data set IDs")).optional().description("Optional - For pre-aggregated data sets or SQL views, provide a list of data sets that are relied upon."),fields:i.default.array().min(1).items(e).unique("id").message("Field IDs must be unique").required(),secureFilterGuards:i.default.array().items(y).optional()}))(e)),{joins:i.default.array().items(g).unique("right").message("A table cannot be referenced in a right join multiple times.").optional()})),v=e=>{var t;if(1===(null===(t=e.onlyClients)||void 0===t?void 0:t.length))return b(m(e.onlyClients[0]));const r=i.default.alternatives(...(e.onlyClients||a.SUPPORTED_CLIENTS).map((e=>b(m(e)))));if(e.dataSetIdToClientMapping){const t=Object.entries(e.dataSetIdToClientMapping).map((([e,t])=>({is:e,then:b(m(t))})));return i.default.alternatives().conditional(".id",[...t,{is:!0,then:r}])}return r};t.default=(e,t={})=>{const r=((e,t)=>i.default.object({version:i.default.number(),connections:i.default.object().pattern(i.default.string(),i.default.object({client:i.default.string().allow(...a.SUPPORTED_CLIENTS).required(),name:i.default.string().optional().allow(""),encryptedCredentials:i.default.string().optional(),unencryptedCredentials:i.default.alternatives(i.default.string(),i.default.object()).optional()})),dataSets:i.default.array().items(t.checkConnectionSpecificDataSets?i.default.object().custom((t=>{var r,n;const i=t.connectionId||"___vizzly_default_conn",o=null===(n=null===(r=null==e?void 0:e.connections)||void 0===r?void 0:r[i])||void 0===n?void 0:n.client;if(!o)throw new u.DataSetNotLinkedToConnection(t.id);const a=b(m(o)).validate(t,h);if(a.error)throw a.error;return t}),"Data sets linked to connections"):v(t)).unique("id").message("dataSet[x].id must be unique.").required(),executableDashboardConfigForPDF:i.default.string().allow(null).optional().description("JavaScript dashboard config for server-side generated PDFs"),publicKeys:i.default.array().items(i.default.string()).optional(),sqlViews:i.default.object().pattern(i.default.string(),i.default.object({name:i.default.string().required(),sql:i.default.string().allow("").required()})).optional()}))(e,Object.assign(Object.assign(Object.assign({},f),t),{dataSetIdToClientMapping:_(e)})).validate(e,h);return r.error&&r.error.details.map((e=>{var t,r;c.includes((null===(t=e.context)||void 0===t?void 0:t.key)||"")&&(null===(r=e.context)||void 0===r?void 0:r.value)&&(e.context.value="-- VIZZLY REDACTED --")})),r};const _=e=>{let t={};return e&&"object"==typeof(null==e?void 0:e.dataSets)&&"object"==typeof(null==e?void 0:e.connections)&&e.dataSets.forEach((r=>{var n,i;if(t){const o=r.connectionId||"___vizzly_default_conn",a=null===(i=null===(n=null==e?void 0:e.connections)||void 0===n?void 0:n[o])||void 0===i?void 0:i.client;a&&(t[r.id]=a)}})),t}},8284:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DataSetNotLinkedToConnection=void 0;class r extends Error{constructor(e){super(`Data set ${e} must be linked to a connection by setting a 'connectionId' property that references a connection in the 'connections' section.`),this.name="DataSetNotLinkedToConnection"}}t.DataSetNotLinkedToConnection=r},4893:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t},a=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.VizzlyConfig=t.QueryEngineConfig=void 0,t.QueryEngineConfig=o(r(8162)),t.VizzlyConfig=o(r(3342)),a(r(7076),t)},7076:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},6342:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.DATE_MATHS_OPERATORS=t.NORMALIZED_DATA_TYPES=void 0,i(r(3154),t),i(r(4795),t),t.NORMALIZED_DATA_TYPES=["number","boolean","string","date_time","string[]"],t.DATE_MATHS_OPERATORS=["seconds_between","minutes_between","hours_between","days_between"]},3154:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.NATIVE_DATA_TYPES_DATABASE=void 0,t.NATIVE_DATA_TYPES_DATABASE={microsoftSQLServer:{INT:{normalizedType:"number"},BIGINT:{normalizedType:"number"},NUMERIC:{normalizedType:"number"},BIT:{normalizedType:"number"},SMALLINT:{normalizedType:"number"},DECIMAL:{normalizedType:"number"},SMALLMONEY:{normalizedType:"number"},TINYINT:{normalizedType:"number"},MONEY:{normalizedType:"number"},FLOAT:{normalizedType:"number"},REAL:{normalizedType:"number"},DATE:{normalizedType:"date_time"},DATETIME2:{normalizedType:"date_time"},SMALLDATETIME:{normalizedType:"date_time"},DATETIME:{normalizedType:"date_time"},TIME:{normalizedType:"date_time"},CHAR:{normalizedType:"string"},VARCHAR:{normalizedType:"string"},TEXT:{normalizedType:"string",castAs:"VARCHAR(8000)"},NCHAR:{normalizedType:"string"},NVARCHAR:{normalizedType:"string"},NTEXT:{normalizedType:"string"},BINARY:{normalizedType:"string"},VARBINARY:{normalizedType:"string"}},bigquery:{INT64:{normalizedType:"number"},FLOAT64:{normalizedType:"number"},NUMERIC:{normalizedType:"number"},BIGNUMERIC:{normalizedType:"number"},STRING:{normalizedType:"string"},DATE:{normalizedType:"date_time"},DATETIME:{normalizedType:"date_time"},TIMESTAMP:{normalizedType:"date_time"},BOOL:{normalizedType:"boolean"},"ARRAY<STRING>":{normalizedType:"string[]"}},elasticsearch:{date_time:{normalizedType:"date_time"},number:{normalizedType:"number"},string:{normalizedType:"string"},boolean:{normalizedType:"boolean"}},mariadb:{TINYINT:{normalizedType:"number",castAs:"INT"},SMALLINT:{normalizedType:"number",castAs:"INT"},MEDIUMINT:{normalizedType:"number",castAs:"INT"},INT:{normalizedType:"number"},INTEGER:{normalizedType:"number",castAs:"INT"},BIGINT:{normalizedType:"number",castAs:"INT"},DECIMAL:{normalizedType:"number"},FLOAT:{normalizedType:"number"},DOUBLE:{normalizedType:"number"},VARCHAR:{normalizedType:"string",castAs:"CHAR"},TEXT:{normalizedType:"string",castAs:"CHAR"},TINYTEXT:{normalizedType:"string",castAs:"CHAR"},CHAR:{normalizedType:"string"},MEDIUMTEXT:{normalizedType:"string",castAs:"CHAR"},LONGTEXT:{normalizedType:"string",castAs:"CHAR"},DATE:{normalizedType:"date_time"},DATETIME:{normalizedType:"date_time"},TIMESTAMP:{normalizedType:"date_time",castAs:"DATETIME"},BOOLEAN:{normalizedType:"boolean",castAs:null},BOOL:{normalizedType:"boolean",castAs:null}},postgres:{JSONB:{normalizedType:"string"},UUID:{normalizedType:"string"},DECIMAL:{normalizedType:"number"},NUMERIC:{normalizedType:"number"},INT:{normalizedType:"number"},INTEGER:{normalizedType:"number"},BIGINT:{normalizedType:"number"},SMALLINT:{normalizedType:"number"},DOUBLEPRECISION:{normalizedType:"number",castAs:"DOUBLE PRECISION"},"DOUBLE PRECISION":{normalizedType:"number"},REAL:{normalizedType:"number"},FLOAT:{normalizedType:"number"},NUMBER:{normalizedType:"number"},BINARY:{normalizedType:"string"},VARBINARY:{normalizedType:"string"},CHAR:{normalizedType:"string"},CHARACTER:{normalizedType:"string"},"CHARACTER VARYING":{normalizedType:"string"},TEXT:{normalizedType:"string"},VARCHAR:{normalizedType:"string"},TIME:{normalizedType:"date_time"},DATE:{normalizedType:"date_time"},TIMESTAMP_LTZ:{normalizedType:"date_time"},TIMESTAMP_NTZ:{normalizedType:"date_time"},TIMESTAMP_TZ:{normalizedType:"date_time"},TIMESTAMP:{normalizedType:"date_time"},BOOLEAN:{normalizedType:"boolean"},"TIMESTAMP WITH TIME ZONE":{normalizedType:"date_time"},"TIMESTAMP WITHOUT TIME ZONE":{normalizedType:"date_time"},ARRAY:{normalizedType:"string[]"}},SQLite:{BOOLEAN:{normalizedType:"boolean"},NULL:{normalizedType:"string"},INTEGER:{normalizedType:"number"},REAL:{normalizedType:"number"},DECIMAL:{normalizedType:"number"},CHAR:{normalizedType:"string"},TEXT:{normalizedType:"string"},DATE:{normalizedType:"date_time"},TIMESTAMP:{normalizedType:"date_time"}},snowflake:{FIXED:{normalizedType:"number"},DECIMAL:{normalizedType:"number"},NUMERIC:{normalizedType:"number"},INT:{normalizedType:"number"},INTEGER:{normalizedType:"number"},BIGINT:{normalizedType:"number"},SMALLINT:{normalizedType:"number"},TINYINT:{normalizedType:"number"},BYTEINT:{normalizedType:"number"},FLOAT:{normalizedType:"number"},FLOAT4:{normalizedType:"number"},FLOAT8:{normalizedType:"number"},DOUBLE:{normalizedType:"number"},DOUBLEPRECISION:{normalizedType:"number",castAs:"DOUBLE PRECISION"},"DOUBLE PRECISION":{normalizedType:"number"},REAL:{normalizedType:"number"},NUMBER:{normalizedType:"number"},BINARY:{normalizedType:"string"},VARBINARY:{normalizedType:"string"},CHAR:{normalizedType:"string"},CHARACTER:{normalizedType:"string"},"CHARACTER VARYING":{normalizedType:"string"},TEXT:{normalizedType:"string"},VARCHAR:{normalizedType:"string"},STRING:{normalizedType:"string"},TIME:{normalizedType:"date_time"},DATE:{normalizedType:"date_time"},DATETIME:{normalizedType:"date_time"},TIMESTAMP_LTZ:{normalizedType:"date_time"},TIMESTAMP_NTZ:{normalizedType:"date_time"},TIMESTAMP_TZ:{normalizedType:"date_time"},TIMESTAMP:{normalizedType:"date_time"},BOOLEAN:{normalizedType:"boolean"},ARRAY:{normalizedType:"string[]"},VARIANT:{normalizedType:"string"}},mysql:{TINYINT:{normalizedType:"number",castAs:"SIGNED"},SMALLINT:{normalizedType:"number",castAs:"SIGNED"},MEDIUMINT:{normalizedType:"number",castAs:"SIGNED"},INT:{normalizedType:"number",castAs:"SIGNED"},INTEGER:{normalizedType:"number",castAs:"SIGNED"},BIGINT:{normalizedType:"number",castAs:"SIGNED"},DECIMAL:{normalizedType:"number",castAs:"DECIMAL(65, 10)"},FLOAT:{normalizedType:"number",castAs:"DECIMAL(65, 10)"},DOUBLE:{normalizedType:"number",castAs:"DECIMAL(65, 10)"},CHAR:{normalizedType:"string",castAs:"CHAR"},VARCHAR:{normalizedType:"string",castAs:"CHAR"},TEXT:{normalizedType:"string",castAs:"CHAR"},TINYTEXT:{normalizedType:"string",castAs:"CHAR"},MEDIUMTEXT:{normalizedType:"string",castAs:"CHAR"},LONGTEXT:{normalizedType:"string",castAs:"CHAR"},DATE:{normalizedType:"date_time"},DATETIME:{normalizedType:"date_time"},TIMESTAMP:{normalizedType:"date_time",castAs:"DATETIME"},BOOLEAN:{normalizedType:"boolean"},BOOL:{normalizedType:"boolean"}},redshift:{SUPER:{normalizedType:"string[]"},UUID:{normalizedType:"string"},DECIMAL:{normalizedType:"number"},NUMERIC:{normalizedType:"number"},INT:{normalizedType:"number"},INTEGER:{normalizedType:"number"},BIGINT:{normalizedType:"number"},SMALLINT:{normalizedType:"number"},DOUBLEPRECISION:{normalizedType:"number",castAs:"DOUBLE PRECISION"},"DOUBLE PRECISION":{normalizedType:"number"},REAL:{normalizedType:"number"},FLOAT:{normalizedType:"number"},NUMBER:{normalizedType:"number"},BINARY:{normalizedType:"string"},VARBINARY:{normalizedType:"string"},CHAR:{normalizedType:"string"},CHARACTER:{normalizedType:"string"},"CHARACTER VARYING":{normalizedType:"string"},TEXT:{normalizedType:"string"},VARCHAR:{normalizedType:"string"},TIME:{normalizedType:"date_time"},DATE:{normalizedType:"date_time"},TIMESTAMP_LTZ:{normalizedType:"date_time"},TIMESTAMP_NTZ:{normalizedType:"date_time"},TIMESTAMP_TZ:{normalizedType:"date_time"},TIMESTAMP:{normalizedType:"date_time"},BOOLEAN:{normalizedType:"boolean"},"TIMESTAMP WITH TIME ZONE":{normalizedType:"date_time"},"TIMESTAMP WITHOUT TIME ZONE":{normalizedType:"date_time"},ARRAY:{normalizedType:"string[]"}}}},4795:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},8143:function(e){e.exports=function(){for(var e=function(e,t,r){return void 0===t&&(t=0),void 0===r&&(r=1),e<t?t:e>r?r:e},t=e,r={},n=0,i=["Boolean","Number","String","Function","Array","Date","RegExp","Undefined","Null"];n<i.length;n+=1){var o=i[n];r["[object "+o+"]"]=o.toLowerCase()}var a=function(e){return r[Object.prototype.toString.call(e)]||"object"},s=a,l=a,u=Math.PI,c={clip_rgb:function(e){e._clipped=!1,e._unclipped=e.slice(0);for(var r=0;r<=3;r++)r<3?((e[r]<0||e[r]>255)&&(e._clipped=!0),e[r]=t(e[r],0,255)):3===r&&(e[r]=t(e[r],0,1));return e},limit:e,type:a,unpack:function(e,t){return void 0===t&&(t=null),e.length>=3?Array.prototype.slice.call(e):"object"==s(e[0])&&t?t.split("").filter((function(t){return void 0!==e[0][t]})).map((function(t){return e[0][t]})):e[0]},last:function(e){if(e.length<2)return null;var t=e.length-1;return"string"==l(e[t])?e[t].toLowerCase():null},PI:u,TWOPI:2*u,PITHIRD:u/3,DEG2RAD:u/180,RAD2DEG:180/u},d={format:{},autodetect:[]},p=c.last,f=c.clip_rgb,h=c.type,m=d,g=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var r=this;if("object"===h(e[0])&&e[0].constructor&&e[0].constructor===this.constructor)return e[0];var n=p(e),i=!1;if(!n){i=!0,m.sorted||(m.autodetect=m.autodetect.sort((function(e,t){return t.p-e.p})),m.sorted=!0);for(var o=0,a=m.autodetect;o<a.length;o+=1){var s=a[o];if(n=s.test.apply(s,e))break}}if(!m.format[n])throw new Error("unknown format: "+e);var l=m.format[n].apply(null,i?e:e.slice(0,-1));r._rgb=f(l),3===r._rgb.length&&r._rgb.push(1)};g.prototype.toString=function(){return"function"==h(this.hex)?this.hex():"["+this._rgb.join(",")+"]"};var y=g,b=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(b.Color,[null].concat(e)))};b.Color=y,b.version="2.4.2";var v=b,_=c.unpack,A=Math.max,w=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var r=_(e,"rgb"),n=r[0],i=r[1],o=r[2],a=1-A(n/=255,A(i/=255,o/=255)),s=a<1?1/(1-a):0;return[(1-n-a)*s,(1-i-a)*s,(1-o-a)*s,a]},T=c.unpack,S=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var r=(e=T(e,"cmyk"))[0],n=e[1],i=e[2],o=e[3],a=e.length>4?e[4]:1;return 1===o?[0,0,0,a]:[r>=1?0:255*(1-r)*(1-o),n>=1?0:255*(1-n)*(1-o),i>=1?0:255*(1-i)*(1-o),a]},E=v,O=y,x=d,C=c.unpack,I=c.type,j=w;O.prototype.cmyk=function(){return j(this._rgb)},E.cmyk=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(O,[null].concat(e,["cmyk"])))},x.format.cmyk=S,x.autodetect.push({p:2,test:function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];if(e=C(e,"cmyk"),"array"===I(e)&&4===e.length)return"cmyk"}});var R=c.unpack,D=c.last,F=function(e){return Math.round(100*e)/100},N=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var r=R(e,"hsla"),n=D(e)||"lsa";return r[0]=F(r[0]||0),r[1]=F(100*r[1])+"%",r[2]=F(100*r[2])+"%","hsla"===n||r.length>3&&r[3]<1?(r[3]=r.length>3?r[3]:1,n="hsla"):r.length=3,n+"("+r.join(",")+")"},P=c.unpack,M=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var r=(e=P(e,"rgba"))[0],n=e[1],i=e[2];r/=255,n/=255,i/=255;var o,a,s=Math.min(r,n,i),l=Math.max(r,n,i),u=(l+s)/2;return l===s?(o=0,a=Number.NaN):o=u<.5?(l-s)/(l+s):(l-s)/(2-l-s),r==l?a=(n-i)/(l-s):n==l?a=2+(i-r)/(l-s):i==l&&(a=4+(r-n)/(l-s)),(a*=60)<0&&(a+=360),e.length>3&&void 0!==e[3]?[a,o,u,e[3]]:[a,o,u]},L=c.unpack,k=c.last,q=N,$=M,z=Math.round,B=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var r=L(e,"rgba"),n=k(e)||"rgb";return"hsl"==n.substr(0,3)?q($(r),n):(r[0]=z(r[0]),r[1]=z(r[1]),r[2]=z(r[2]),("rgba"===n||r.length>3&&r[3]<1)&&(r[3]=r.length>3?r[3]:1,n="rgba"),n+"("+r.slice(0,"rgb"===n?3:4).join(",")+")")},G=c.unpack,U=Math.round,V=function(){for(var e,t=[],r=arguments.length;r--;)t[r]=arguments[r];var n,i,o,a=(t=G(t,"hsl"))[0],s=t[1],l=t[2];if(0===s)n=i=o=255*l;else{var u=[0,0,0],c=[0,0,0],d=l<.5?l*(1+s):l+s-l*s,p=2*l-d,f=a/360;u[0]=f+1/3,u[1]=f,u[2]=f-1/3;for(var h=0;h<3;h++)u[h]<0&&(u[h]+=1),u[h]>1&&(u[h]-=1),6*u[h]<1?c[h]=p+6*(d-p)*u[h]:2*u[h]<1?c[h]=d:3*u[h]<2?c[h]=p+(d-p)*(2/3-u[h])*6:c[h]=p;n=(e=[U(255*c[0]),U(255*c[1]),U(255*c[2])])[0],i=e[1],o=e[2]}return t.length>3?[n,i,o,t[3]]:[n,i,o,1]},H=V,Y=d,X=/^rgb\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*\)$/,W=/^rgba\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*,\s*([01]|[01]?\.\d+)\)$/,K=/^rgb\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,Q=/^rgba\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,Z=/^hsl\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,J=/^hsla\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,ee=Math.round,te=function(e){var t;if(e=e.toLowerCase().trim(),Y.format.named)try{return Y.format.named(e)}catch(e){}if(t=e.match(X)){for(var r=t.slice(1,4),n=0;n<3;n++)r[n]=+r[n];return r[3]=1,r}if(t=e.match(W)){for(var i=t.slice(1,5),o=0;o<4;o++)i[o]=+i[o];return i}if(t=e.match(K)){for(var a=t.slice(1,4),s=0;s<3;s++)a[s]=ee(2.55*a[s]);return a[3]=1,a}if(t=e.match(Q)){for(var l=t.slice(1,5),u=0;u<3;u++)l[u]=ee(2.55*l[u]);return l[3]=+l[3],l}if(t=e.match(Z)){var c=t.slice(1,4);c[1]*=.01,c[2]*=.01;var d=H(c);return d[3]=1,d}if(t=e.match(J)){var p=t.slice(1,4);p[1]*=.01,p[2]*=.01;var f=H(p);return f[3]=+t[4],f}};te.test=function(e){return X.test(e)||W.test(e)||K.test(e)||Q.test(e)||Z.test(e)||J.test(e)};var re=v,ne=y,ie=d,oe=c.type,ae=B,se=te;ne.prototype.css=function(e){return ae(this._rgb,e)},re.css=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(ne,[null].concat(e,["css"])))},ie.format.css=se,ie.autodetect.push({p:5,test:function(e){for(var t=[],r=arguments.length-1;r-- >0;)t[r]=arguments[r+1];if(!t.length&&"string"===oe(e)&&se.test(e))return"css"}});var le=y,ue=v,ce=c.unpack;d.format.gl=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var r=ce(e,"rgba");return r[0]*=255,r[1]*=255,r[2]*=255,r},ue.gl=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(le,[null].concat(e,["gl"])))},le.prototype.gl=function(){var e=this._rgb;return[e[0]/255,e[1]/255,e[2]/255,e[3]]};var de=c.unpack,pe=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var r,n=de(e,"rgb"),i=n[0],o=n[1],a=n[2],s=Math.min(i,o,a),l=Math.max(i,o,a),u=l-s,c=100*u/255,d=s/(255-u)*100;return 0===u?r=Number.NaN:(i===l&&(r=(o-a)/u),o===l&&(r=2+(a-i)/u),a===l&&(r=4+(i-o)/u),(r*=60)<0&&(r+=360)),[r,c,d]},fe=c.unpack,he=Math.floor,me=function(){for(var e,t,r,n,i,o,a=[],s=arguments.length;s--;)a[s]=arguments[s];var l,u,c,d=(a=fe(a,"hcg"))[0],p=a[1],f=a[2];f*=255;var h=255*p;if(0===p)l=u=c=f;else{360===d&&(d=0),d>360&&(d-=360),d<0&&(d+=360);var m=he(d/=60),g=d-m,y=f*(1-p),b=y+h*(1-g),v=y+h*g,_=y+h;switch(m){case 0:l=(e=[_,v,y])[0],u=e[1],c=e[2];break;case 1:l=(t=[b,_,y])[0],u=t[1],c=t[2];break;case 2:l=(r=[y,_,v])[0],u=r[1],c=r[2];break;case 3:l=(n=[y,b,_])[0],u=n[1],c=n[2];break;case 4:l=(i=[v,y,_])[0],u=i[1],c=i[2];break;case 5:l=(o=[_,y,b])[0],u=o[1],c=o[2]}}return[l,u,c,a.length>3?a[3]:1]},ge=c.unpack,ye=c.type,be=v,ve=y,_e=d,Ae=pe;ve.prototype.hcg=function(){return Ae(this._rgb)},be.hcg=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(ve,[null].concat(e,["hcg"])))},_e.format.hcg=me,_e.autodetect.push({p:1,test:function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];if(e=ge(e,"hcg"),"array"===ye(e)&&3===e.length)return"hcg"}});var we=c.unpack,Te=c.last,Se=Math.round,Ee=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var r=we(e,"rgba"),n=r[0],i=r[1],o=r[2],a=r[3],s=Te(e)||"auto";void 0===a&&(a=1),"auto"===s&&(s=a<1?"rgba":"rgb");var l="000000"+((n=Se(n))<<16|(i=Se(i))<<8|(o=Se(o))).toString(16);l=l.substr(l.length-6);var u="0"+Se(255*a).toString(16);switch(u=u.substr(u.length-2),s.toLowerCase()){case"rgba":return"#"+l+u;case"argb":return"#"+u+l;default:return"#"+l}},Oe=/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,xe=/^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/,Ce=function(e){if(e.match(Oe)){4!==e.length&&7!==e.length||(e=e.substr(1)),3===e.length&&(e=(e=e.split(""))[0]+e[0]+e[1]+e[1]+e[2]+e[2]);var t=parseInt(e,16);return[t>>16,t>>8&255,255&t,1]}if(e.match(xe)){5!==e.length&&9!==e.length||(e=e.substr(1)),4===e.length&&(e=(e=e.split(""))[0]+e[0]+e[1]+e[1]+e[2]+e[2]+e[3]+e[3]);var r=parseInt(e,16);return[r>>24&255,r>>16&255,r>>8&255,Math.round((255&r)/255*100)/100]}throw new Error("unknown hex color: "+e)},Ie=v,je=y,Re=c.type,De=d,Fe=Ee;je.prototype.hex=function(e){return Fe(this._rgb,e)},Ie.hex=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(je,[null].concat(e,["hex"])))},De.format.hex=Ce,De.autodetect.push({p:4,test:function(e){for(var t=[],r=arguments.length-1;r-- >0;)t[r]=arguments[r+1];if(!t.length&&"string"===Re(e)&&[3,4,5,6,7,8,9].indexOf(e.length)>=0)return"hex"}});var Ne=c.unpack,Pe=c.TWOPI,Me=Math.min,Le=Math.sqrt,ke=Math.acos,qe=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var r,n=Ne(e,"rgb"),i=n[0],o=n[1],a=n[2],s=Me(i/=255,o/=255,a/=255),l=(i+o+a)/3,u=l>0?1-s/l:0;return 0===u?r=NaN:(r=(i-o+(i-a))/2,r/=Le((i-o)*(i-o)+(i-a)*(o-a)),r=ke(r),a>o&&(r=Pe-r),r/=Pe),[360*r,u,l]},$e=c.unpack,ze=c.limit,Be=c.TWOPI,Ge=c.PITHIRD,Ue=Math.cos,Ve=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var r,n,i,o=(e=$e(e,"hsi"))[0],a=e[1],s=e[2];return isNaN(o)&&(o=0),isNaN(a)&&(a=0),o>360&&(o-=360),o<0&&(o+=360),(o/=360)<1/3?n=1-((i=(1-a)/3)+(r=(1+a*Ue(Be*o)/Ue(Ge-Be*o))/3)):o<2/3?i=1-((r=(1-a)/3)+(n=(1+a*Ue(Be*(o-=1/3))/Ue(Ge-Be*o))/3)):r=1-((n=(1-a)/3)+(i=(1+a*Ue(Be*(o-=2/3))/Ue(Ge-Be*o))/3)),[255*(r=ze(s*r*3)),255*(n=ze(s*n*3)),255*(i=ze(s*i*3)),e.length>3?e[3]:1]},He=c.unpack,Ye=c.type,Xe=v,We=y,Ke=d,Qe=qe;We.prototype.hsi=function(){return Qe(this._rgb)},Xe.hsi=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(We,[null].concat(e,["hsi"])))},Ke.format.hsi=Ve,Ke.autodetect.push({p:2,test:function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];if(e=He(e,"hsi"),"array"===Ye(e)&&3===e.length)return"hsi"}});var Ze=c.unpack,Je=c.type,et=v,tt=y,rt=d,nt=M;tt.prototype.hsl=function(){return nt(this._rgb)},et.hsl=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(tt,[null].concat(e,["hsl"])))},rt.format.hsl=V,rt.autodetect.push({p:2,test:function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];if(e=Ze(e,"hsl"),"array"===Je(e)&&3===e.length)return"hsl"}});var it=c.unpack,ot=Math.min,at=Math.max,st=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var r,n,i,o=(e=it(e,"rgb"))[0],a=e[1],s=e[2],l=ot(o,a,s),u=at(o,a,s),c=u-l;return i=u/255,0===u?(r=Number.NaN,n=0):(n=c/u,o===u&&(r=(a-s)/c),a===u&&(r=2+(s-o)/c),s===u&&(r=4+(o-a)/c),(r*=60)<0&&(r+=360)),[r,n,i]},lt=c.unpack,ut=Math.floor,ct=function(){for(var e,t,r,n,i,o,a=[],s=arguments.length;s--;)a[s]=arguments[s];var l,u,c,d=(a=lt(a,"hsv"))[0],p=a[1],f=a[2];if(f*=255,0===p)l=u=c=f;else{360===d&&(d=0),d>360&&(d-=360),d<0&&(d+=360);var h=ut(d/=60),m=d-h,g=f*(1-p),y=f*(1-p*m),b=f*(1-p*(1-m));switch(h){case 0:l=(e=[f,b,g])[0],u=e[1],c=e[2];break;case 1:l=(t=[y,f,g])[0],u=t[1],c=t[2];break;case 2:l=(r=[g,f,b])[0],u=r[1],c=r[2];break;case 3:l=(n=[g,y,f])[0],u=n[1],c=n[2];break;case 4:l=(i=[b,g,f])[0],u=i[1],c=i[2];break;case 5:l=(o=[f,g,y])[0],u=o[1],c=o[2]}}return[l,u,c,a.length>3?a[3]:1]},dt=c.unpack,pt=c.type,ft=v,ht=y,mt=d,gt=st;ht.prototype.hsv=function(){return gt(this._rgb)},ft.hsv=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(ht,[null].concat(e,["hsv"])))},mt.format.hsv=ct,mt.autodetect.push({p:2,test:function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];if(e=dt(e,"hsv"),"array"===pt(e)&&3===e.length)return"hsv"}});var yt={Kn:18,Xn:.95047,Yn:1,Zn:1.08883,t0:.137931034,t1:.206896552,t2:.12841855,t3:.008856452},bt=yt,vt=c.unpack,_t=Math.pow,At=function(e){return(e/=255)<=.04045?e/12.92:_t((e+.055)/1.055,2.4)},wt=function(e){return e>bt.t3?_t(e,1/3):e/bt.t2+bt.t0},Tt=function(e,t,r){return e=At(e),t=At(t),r=At(r),[wt((.4124564*e+.3575761*t+.1804375*r)/bt.Xn),wt((.2126729*e+.7151522*t+.072175*r)/bt.Yn),wt((.0193339*e+.119192*t+.9503041*r)/bt.Zn)]},St=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var r=vt(e,"rgb"),n=r[0],i=r[1],o=r[2],a=Tt(n,i,o),s=a[0],l=a[1],u=116*l-16;return[u<0?0:u,500*(s-l),200*(l-a[2])]},Et=yt,Ot=c.unpack,xt=Math.pow,Ct=function(e){return 255*(e<=.00304?12.92*e:1.055*xt(e,1/2.4)-.055)},It=function(e){return e>Et.t1?e*e*e:Et.t2*(e-Et.t0)},jt=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var r,n,i,o=(e=Ot(e,"lab"))[0],a=e[1],s=e[2];return n=(o+16)/116,r=isNaN(a)?n:n+a/500,i=isNaN(s)?n:n-s/200,n=Et.Yn*It(n),r=Et.Xn*It(r),i=Et.Zn*It(i),[Ct(3.2404542*r-1.5371385*n-.4985314*i),Ct(-.969266*r+1.8760108*n+.041556*i),Ct(.0556434*r-.2040259*n+1.0572252*i),e.length>3?e[3]:1]},Rt=c.unpack,Dt=c.type,Ft=v,Nt=y,Pt=d,Mt=St;Nt.prototype.lab=function(){return Mt(this._rgb)},Ft.lab=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(Nt,[null].concat(e,["lab"])))},Pt.format.lab=jt,Pt.autodetect.push({p:2,test:function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];if(e=Rt(e,"lab"),"array"===Dt(e)&&3===e.length)return"lab"}});var Lt=c.unpack,kt=c.RAD2DEG,qt=Math.sqrt,$t=Math.atan2,zt=Math.round,Bt=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var r=Lt(e,"lab"),n=r[0],i=r[1],o=r[2],a=qt(i*i+o*o),s=($t(o,i)*kt+360)%360;return 0===zt(1e4*a)&&(s=Number.NaN),[n,a,s]},Gt=c.unpack,Ut=St,Vt=Bt,Ht=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var r=Gt(e,"rgb"),n=r[0],i=r[1],o=r[2],a=Ut(n,i,o),s=a[0],l=a[1],u=a[2];return Vt(s,l,u)},Yt=c.unpack,Xt=c.DEG2RAD,Wt=Math.sin,Kt=Math.cos,Qt=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var r=Yt(e,"lch"),n=r[0],i=r[1],o=r[2];return isNaN(o)&&(o=0),[n,Kt(o*=Xt)*i,Wt(o)*i]},Zt=c.unpack,Jt=Qt,er=jt,tr=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var r=(e=Zt(e,"lch"))[0],n=e[1],i=e[2],o=Jt(r,n,i),a=o[0],s=o[1],l=o[2],u=er(a,s,l);return[u[0],u[1],u[2],e.length>3?e[3]:1]},rr=c.unpack,nr=tr,ir=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var r=rr(e,"hcl").reverse();return nr.apply(void 0,r)},or=c.unpack,ar=c.type,sr=v,lr=y,ur=d,cr=Ht;lr.prototype.lch=function(){return cr(this._rgb)},lr.prototype.hcl=function(){return cr(this._rgb).reverse()},sr.lch=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(lr,[null].concat(e,["lch"])))},sr.hcl=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(lr,[null].concat(e,["hcl"])))},ur.format.lch=tr,ur.format.hcl=ir,["lch","hcl"].forEach((function(e){return ur.autodetect.push({p:2,test:function(){for(var t=[],r=arguments.length;r--;)t[r]=arguments[r];if(t=or(t,e),"array"===ar(t)&&3===t.length)return e}})}));var dr={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflower:"#6495ed",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",laserlemon:"#ffff54",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrod:"#fafad2",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",maroon2:"#7f0000",maroon3:"#b03060",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",purple2:"#7f007f",purple3:"#a020f0",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},pr=d,fr=c.type,hr=dr,mr=Ce,gr=Ee;y.prototype.name=function(){for(var e=gr(this._rgb,"rgb"),t=0,r=Object.keys(hr);t<r.length;t+=1){var n=r[t];if(hr[n]===e)return n.toLowerCase()}return e},pr.format.named=function(e){if(e=e.toLowerCase(),hr[e])return mr(hr[e]);throw new Error("unknown color name: "+e)},pr.autodetect.push({p:5,test:function(e){for(var t=[],r=arguments.length-1;r-- >0;)t[r]=arguments[r+1];if(!t.length&&"string"===fr(e)&&hr[e.toLowerCase()])return"named"}});var yr=c.unpack,br=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var r=yr(e,"rgb");return(r[0]<<16)+(r[1]<<8)+r[2]},vr=c.type,_r=v,Ar=y,wr=d,Tr=c.type,Sr=br;Ar.prototype.num=function(){return Sr(this._rgb)},_r.num=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(Ar,[null].concat(e,["num"])))},wr.format.num=function(e){if("number"==vr(e)&&e>=0&&e<=16777215)return[e>>16,e>>8&255,255&e,1];throw new Error("unknown num color: "+e)},wr.autodetect.push({p:5,test:function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];if(1===e.length&&"number"===Tr(e[0])&&e[0]>=0&&e[0]<=16777215)return"num"}});var Er=v,Or=y,xr=d,Cr=c.unpack,Ir=c.type,jr=Math.round;Or.prototype.rgb=function(e){return void 0===e&&(e=!0),!1===e?this._rgb.slice(0,3):this._rgb.slice(0,3).map(jr)},Or.prototype.rgba=function(e){return void 0===e&&(e=!0),this._rgb.slice(0,4).map((function(t,r){return r<3?!1===e?t:jr(t):t}))},Er.rgb=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(Or,[null].concat(e,["rgb"])))},xr.format.rgb=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var r=Cr(e,"rgba");return void 0===r[3]&&(r[3]=1),r},xr.autodetect.push({p:3,test:function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];if(e=Cr(e,"rgba"),"array"===Ir(e)&&(3===e.length||4===e.length&&"number"==Ir(e[3])&&e[3]>=0&&e[3]<=1))return"rgb"}});var Rr=Math.log,Dr=function(e){var t,r,n,i=e/100;return i<66?(t=255,r=i<6?0:-155.25485562709179-.44596950469579133*(r=i-2)+104.49216199393888*Rr(r),n=i<20?0:.8274096064007395*(n=i-10)-254.76935184120902+115.67994401066147*Rr(n)):(t=351.97690566805693+.114206453784165*(t=i-55)-40.25366309332127*Rr(t),r=325.4494125711974+.07943456536662342*(r=i-50)-28.0852963507957*Rr(r),n=255),[t,r,n,1]},Fr=Dr,Nr=c.unpack,Pr=Math.round,Mr=v,Lr=y,kr=d,qr=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];for(var r,n=Nr(e,"rgb"),i=n[0],o=n[2],a=1e3,s=4e4;s-a>.4;){var l=Fr(r=.5*(s+a));l[2]/l[0]>=o/i?s=r:a=r}return Pr(r)};Lr.prototype.temp=Lr.prototype.kelvin=Lr.prototype.temperature=function(){return qr(this._rgb)},Mr.temp=Mr.kelvin=Mr.temperature=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(Lr,[null].concat(e,["temp"])))},kr.format.temp=kr.format.kelvin=kr.format.temperature=Dr;var $r=c.unpack,zr=Math.cbrt,Br=Math.pow,Gr=Math.sign,Ur=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var r=$r(e,"rgb"),n=r[0],i=r[1],o=r[2],a=[Vr(n/255),Vr(i/255),Vr(o/255)],s=a[0],l=a[1],u=a[2],c=zr(.4122214708*s+.5363325363*l+.0514459929*u),d=zr(.2119034982*s+.6806995451*l+.1073969566*u),p=zr(.0883024619*s+.2817188376*l+.6299787005*u);return[.2104542553*c+.793617785*d-.0040720468*p,1.9779984951*c-2.428592205*d+.4505937099*p,.0259040371*c+.7827717662*d-.808675766*p]};function Vr(e){var t=Math.abs(e);return t<.04045?e/12.92:(Gr(e)||1)*Br((t+.055)/1.055,2.4)}var Hr=c.unpack,Yr=Math.pow,Xr=Math.sign,Wr=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var r=(e=Hr(e,"lab"))[0],n=e[1],i=e[2],o=Yr(r+.3963377774*n+.2158037573*i,3),a=Yr(r-.1055613458*n-.0638541728*i,3),s=Yr(r-.0894841775*n-1.291485548*i,3);return[255*Kr(4.0767416621*o-3.3077115913*a+.2309699292*s),255*Kr(-1.2684380046*o+2.6097574011*a-.3413193965*s),255*Kr(-.0041960863*o-.7034186147*a+1.707614701*s),e.length>3?e[3]:1]};function Kr(e){var t=Math.abs(e);return t>.0031308?(Xr(e)||1)*(1.055*Yr(t,1/2.4)-.055):12.92*e}var Qr=c.unpack,Zr=c.type,Jr=v,en=y,tn=d,rn=Ur;en.prototype.oklab=function(){return rn(this._rgb)},Jr.oklab=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(en,[null].concat(e,["oklab"])))},tn.format.oklab=Wr,tn.autodetect.push({p:3,test:function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];if(e=Qr(e,"oklab"),"array"===Zr(e)&&3===e.length)return"oklab"}});var nn=c.unpack,on=Ur,an=Bt,sn=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var r=nn(e,"rgb"),n=r[0],i=r[1],o=r[2],a=on(n,i,o),s=a[0],l=a[1],u=a[2];return an(s,l,u)},ln=c.unpack,un=Qt,cn=Wr,dn=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var r=(e=ln(e,"lch"))[0],n=e[1],i=e[2],o=un(r,n,i),a=o[0],s=o[1],l=o[2],u=cn(a,s,l);return[u[0],u[1],u[2],e.length>3?e[3]:1]},pn=c.unpack,fn=c.type,hn=v,mn=y,gn=d,yn=sn;mn.prototype.oklch=function(){return yn(this._rgb)},hn.oklch=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(mn,[null].concat(e,["oklch"])))},gn.format.oklch=dn,gn.autodetect.push({p:3,test:function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];if(e=pn(e,"oklch"),"array"===fn(e)&&3===e.length)return"oklch"}});var bn=y,vn=c.type;bn.prototype.alpha=function(e,t){return void 0===t&&(t=!1),void 0!==e&&"number"===vn(e)?t?(this._rgb[3]=e,this):new bn([this._rgb[0],this._rgb[1],this._rgb[2],e],"rgb"):this._rgb[3]},y.prototype.clipped=function(){return this._rgb._clipped||!1};var _n=y,An=yt;_n.prototype.darken=function(e){void 0===e&&(e=1);var t=this.lab();return t[0]-=An.Kn*e,new _n(t,"lab").alpha(this.alpha(),!0)},_n.prototype.brighten=function(e){return void 0===e&&(e=1),this.darken(-e)},_n.prototype.darker=_n.prototype.darken,_n.prototype.brighter=_n.prototype.brighten,y.prototype.get=function(e){var t=e.split("."),r=t[0],n=t[1],i=this[r]();if(n){var o=r.indexOf(n)-("ok"===r.substr(0,2)?2:0);if(o>-1)return i[o];throw new Error("unknown channel "+n+" in mode "+r)}return i};var wn=y,Tn=c.type,Sn=Math.pow;wn.prototype.luminance=function(e){if(void 0!==e&&"number"===Tn(e)){if(0===e)return new wn([0,0,0,this._rgb[3]],"rgb");if(1===e)return new wn([255,255,255,this._rgb[3]],"rgb");var t=this.luminance(),r=20,n=function(t,i){var o=t.interpolate(i,.5,"rgb"),a=o.luminance();return Math.abs(e-a)<1e-7||!r--?o:a>e?n(t,o):n(o,i)},i=(t>e?n(new wn([0,0,0]),this):n(this,new wn([255,255,255]))).rgb();return new wn(i.concat([this._rgb[3]]))}return En.apply(void 0,this._rgb.slice(0,3))};var En=function(e,t,r){return.2126*(e=On(e))+.7152*(t=On(t))+.0722*On(r)},On=function(e){return(e/=255)<=.03928?e/12.92:Sn((e+.055)/1.055,2.4)},xn={},Cn=y,In=c.type,jn=xn,Rn=function(e,t,r){void 0===r&&(r=.5);for(var n=[],i=arguments.length-3;i-- >0;)n[i]=arguments[i+3];var o=n[0]||"lrgb";if(jn[o]||n.length||(o=Object.keys(jn)[0]),!jn[o])throw new Error("interpolation mode "+o+" is not defined");return"object"!==In(e)&&(e=new Cn(e)),"object"!==In(t)&&(t=new Cn(t)),jn[o](e,t,r).alpha(e.alpha()+r*(t.alpha()-e.alpha()))},Dn=y,Fn=Rn;Dn.prototype.mix=Dn.prototype.interpolate=function(e,t){void 0===t&&(t=.5);for(var r=[],n=arguments.length-2;n-- >0;)r[n]=arguments[n+2];return Fn.apply(void 0,[this,e,t].concat(r))};var Nn=y;Nn.prototype.premultiply=function(e){void 0===e&&(e=!1);var t=this._rgb,r=t[3];return e?(this._rgb=[t[0]*r,t[1]*r,t[2]*r,r],this):new Nn([t[0]*r,t[1]*r,t[2]*r,r],"rgb")};var Pn=y,Mn=yt;Pn.prototype.saturate=function(e){void 0===e&&(e=1);var t=this.lch();return t[1]+=Mn.Kn*e,t[1]<0&&(t[1]=0),new Pn(t,"lch").alpha(this.alpha(),!0)},Pn.prototype.desaturate=function(e){return void 0===e&&(e=1),this.saturate(-e)};var Ln=y,kn=c.type;Ln.prototype.set=function(e,t,r){void 0===r&&(r=!1);var n=e.split("."),i=n[0],o=n[1],a=this[i]();if(o){var s=i.indexOf(o)-("ok"===i.substr(0,2)?2:0);if(s>-1){if("string"==kn(t))switch(t.charAt(0)){case"+":case"-":a[s]+=+t;break;case"*":a[s]*=+t.substr(1);break;case"/":a[s]/=+t.substr(1);break;default:a[s]=+t}else{if("number"!==kn(t))throw new Error("unsupported value for Color.set");a[s]=t}var l=new Ln(a,i);return r?(this._rgb=l._rgb,this):l}throw new Error("unknown channel "+o+" in mode "+i)}return a};var qn=y;xn.rgb=function(e,t,r){var n=e._rgb,i=t._rgb;return new qn(n[0]+r*(i[0]-n[0]),n[1]+r*(i[1]-n[1]),n[2]+r*(i[2]-n[2]),"rgb")};var $n=y,zn=Math.sqrt,Bn=Math.pow;xn.lrgb=function(e,t,r){var n=e._rgb,i=n[0],o=n[1],a=n[2],s=t._rgb,l=s[0],u=s[1],c=s[2];return new $n(zn(Bn(i,2)*(1-r)+Bn(l,2)*r),zn(Bn(o,2)*(1-r)+Bn(u,2)*r),zn(Bn(a,2)*(1-r)+Bn(c,2)*r),"rgb")};var Gn=y;xn.lab=function(e,t,r){var n=e.lab(),i=t.lab();return new Gn(n[0]+r*(i[0]-n[0]),n[1]+r*(i[1]-n[1]),n[2]+r*(i[2]-n[2]),"lab")};var Un=y,Vn=function(e,t,r,n){var i,o,a,s,l,u,c,d,p,f,h,m,g;return"hsl"===n?(a=e.hsl(),s=t.hsl()):"hsv"===n?(a=e.hsv(),s=t.hsv()):"hcg"===n?(a=e.hcg(),s=t.hcg()):"hsi"===n?(a=e.hsi(),s=t.hsi()):"lch"===n||"hcl"===n?(n="hcl",a=e.hcl(),s=t.hcl()):"oklch"===n&&(a=e.oklch().reverse(),s=t.oklch().reverse()),"h"!==n.substr(0,1)&&"oklch"!==n||(l=(i=a)[0],c=i[1],p=i[2],u=(o=s)[0],d=o[1],f=o[2]),isNaN(l)||isNaN(u)?isNaN(l)?isNaN(u)?m=Number.NaN:(m=u,1!=p&&0!=p||"hsv"==n||(h=d)):(m=l,1!=f&&0!=f||"hsv"==n||(h=c)):m=l+r*(u>l&&u-l>180?u-(l+360):u<l&&l-u>180?u+360-l:u-l),void 0===h&&(h=c+r*(d-c)),g=p+r*(f-p),new Un("oklch"===n?[g,h,m]:[m,h,g],n)},Hn=Vn,Yn=function(e,t,r){return Hn(e,t,r,"lch")};xn.lch=Yn,xn.hcl=Yn;var Xn=y;xn.num=function(e,t,r){var n=e.num(),i=t.num();return new Xn(n+r*(i-n),"num")};var Wn=Vn;xn.hcg=function(e,t,r){return Wn(e,t,r,"hcg")};var Kn=Vn;xn.hsi=function(e,t,r){return Kn(e,t,r,"hsi")};var Qn=Vn;xn.hsl=function(e,t,r){return Qn(e,t,r,"hsl")};var Zn=Vn;xn.hsv=function(e,t,r){return Zn(e,t,r,"hsv")};var Jn=y;xn.oklab=function(e,t,r){var n=e.oklab(),i=t.oklab();return new Jn(n[0]+r*(i[0]-n[0]),n[1]+r*(i[1]-n[1]),n[2]+r*(i[2]-n[2]),"oklab")};var ei=Vn;xn.oklch=function(e,t,r){return ei(e,t,r,"oklch")};var ti=y,ri=c.clip_rgb,ni=Math.pow,ii=Math.sqrt,oi=Math.PI,ai=Math.cos,si=Math.sin,li=Math.atan2,ui=function(e,t){for(var r=e.length,n=[0,0,0,0],i=0;i<e.length;i++){var o=e[i],a=t[i]/r,s=o._rgb;n[0]+=ni(s[0],2)*a,n[1]+=ni(s[1],2)*a,n[2]+=ni(s[2],2)*a,n[3]+=s[3]*a}return n[0]=ii(n[0]),n[1]=ii(n[1]),n[2]=ii(n[2]),n[3]>.9999999&&(n[3]=1),new ti(ri(n))},ci=v,di=c.type,pi=Math.pow,fi=function(e){var t="rgb",r=ci("#ccc"),n=0,i=[0,1],o=[],a=[0,0],s=!1,l=[],u=!1,c=0,d=1,p=!1,f={},h=!0,m=1,g=function(e){if((e=e||["#fff","#000"])&&"string"===di(e)&&ci.brewer&&ci.brewer[e.toLowerCase()]&&(e=ci.brewer[e.toLowerCase()]),"array"===di(e)){1===e.length&&(e=[e[0],e[0]]),e=e.slice(0);for(var t=0;t<e.length;t++)e[t]=ci(e[t]);o.length=0;for(var r=0;r<e.length;r++)o.push(r/(e.length-1))}return _(),l=e},y=function(e){return e},b=function(e){return e},v=function(e,n){var i,u;if(null==n&&(n=!1),isNaN(e)||null===e)return r;u=n?e:s&&s.length>2?function(e){if(null!=s){for(var t=s.length-1,r=0;r<t&&e>=s[r];)r++;return r-1}return 0}(e)/(s.length-2):d!==c?(e-c)/(d-c):1,u=b(u),n||(u=y(u)),1!==m&&(u=pi(u,m)),u=a[0]+u*(1-a[0]-a[1]),u=Math.min(1,Math.max(0,u));var p=Math.floor(1e4*u);if(h&&f[p])i=f[p];else{if("array"===di(l))for(var g=0;g<o.length;g++){var v=o[g];if(u<=v){i=l[g];break}if(u>=v&&g===o.length-1){i=l[g];break}if(u>v&&u<o[g+1]){u=(u-v)/(o[g+1]-v),i=ci.interpolate(l[g],l[g+1],u,t);break}}else"function"===di(l)&&(i=l(u));h&&(f[p]=i)}return i},_=function(){return f={}};g(e);var A=function(e){var t=ci(v(e));return u&&t[u]?t[u]():t};return A.classes=function(e){if(null!=e){if("array"===di(e))s=e,i=[e[0],e[e.length-1]];else{var t=ci.analyze(i);s=0===e?[t.min,t.max]:ci.limits(t,"e",e)}return A}return s},A.domain=function(e){if(!arguments.length)return i;c=e[0],d=e[e.length-1],o=[];var t=l.length;if(e.length===t&&c!==d)for(var r=0,n=Array.from(e);r<n.length;r+=1){var a=n[r];o.push((a-c)/(d-c))}else{for(var s=0;s<t;s++)o.push(s/(t-1));if(e.length>2){var u=e.map((function(t,r){return r/(e.length-1)})),p=e.map((function(e){return(e-c)/(d-c)}));p.every((function(e,t){return u[t]===e}))||(b=function(e){if(e<=0||e>=1)return e;for(var t=0;e>=p[t+1];)t++;var r=(e-p[t])/(p[t+1]-p[t]);return u[t]+r*(u[t+1]-u[t])})}}return i=[c,d],A},A.mode=function(e){return arguments.length?(t=e,_(),A):t},A.range=function(e,t){return g(e),A},A.out=function(e){return u=e,A},A.spread=function(e){return arguments.length?(n=e,A):n},A.correctLightness=function(e){return null==e&&(e=!0),p=e,_(),y=p?function(e){for(var t=v(0,!0).lab()[0],r=v(1,!0).lab()[0],n=t>r,i=v(e,!0).lab()[0],o=t+(r-t)*e,a=i-o,s=0,l=1,u=20;Math.abs(a)>.01&&u-- >0;)n&&(a*=-1),a<0?(s=e,e+=.5*(l-e)):(l=e,e+=.5*(s-e)),a=(i=v(e,!0).lab()[0])-o;return e}:function(e){return e},A},A.padding=function(e){return null!=e?("number"===di(e)&&(e=[e,e]),a=e,A):a},A.colors=function(t,r){arguments.length<2&&(r="hex");var n=[];if(0===arguments.length)n=l.slice(0);else if(1===t)n=[A(.5)];else if(t>1){var o=i[0],a=i[1]-o;n=function(e,t,r){for(var n=[],i=e<t,o=r?i?t+1:t-1:t,a=e;i?a<o:a>o;i?a++:a--)n.push(a);return n}(0,t,!1).map((function(e){return A(o+e/(t-1)*a)}))}else{e=[];var u=[];if(s&&s.length>2)for(var c=1,d=s.length,p=1<=d;p?c<d:c>d;p?c++:c--)u.push(.5*(s[c-1]+s[c]));else u=i;n=u.map((function(e){return A(e)}))}return ci[r]&&(n=n.map((function(e){return e[r]()}))),n},A.cache=function(e){return null!=e?(h=e,A):h},A.gamma=function(e){return null!=e?(m=e,A):m},A.nodata=function(e){return null!=e?(r=ci(e),A):r},A};var hi=y,mi=fi,gi=v,yi=function(e,t,r){if(!yi[r])throw new Error("unknown blend mode "+r);return yi[r](e,t)},bi=function(e){return function(t,r){var n=gi(r).rgb(),i=gi(t).rgb();return gi.rgb(e(n,i))}},vi=function(e){return function(t,r){var n=[];return n[0]=e(t[0],r[0]),n[1]=e(t[1],r[1]),n[2]=e(t[2],r[2]),n}};yi.normal=bi(vi((function(e){return e}))),yi.multiply=bi(vi((function(e,t){return e*t/255}))),yi.screen=bi(vi((function(e,t){return 255*(1-(1-e/255)*(1-t/255))}))),yi.overlay=bi(vi((function(e,t){return t<128?2*e*t/255:255*(1-2*(1-e/255)*(1-t/255))}))),yi.darken=bi(vi((function(e,t){return e>t?t:e}))),yi.lighten=bi(vi((function(e,t){return e>t?e:t}))),yi.dodge=bi(vi((function(e,t){return 255===e||(e=t/255*255/(1-e/255))>255?255:e}))),yi.burn=bi(vi((function(e,t){return 255*(1-(1-t/255)/(e/255))})));for(var _i=yi,Ai=c.type,wi=c.clip_rgb,Ti=c.TWOPI,Si=Math.pow,Ei=Math.sin,Oi=Math.cos,xi=v,Ci=y,Ii=Math.floor,ji=Math.random,Ri=a,Di=Math.log,Fi=Math.pow,Ni=Math.floor,Pi=Math.abs,Mi=function(e,t){void 0===t&&(t=null);var r={min:Number.MAX_VALUE,max:-1*Number.MAX_VALUE,sum:0,values:[],count:0};return"object"===Ri(e)&&(e=Object.values(e)),e.forEach((function(e){t&&"object"===Ri(e)&&(e=e[t]),null==e||isNaN(e)||(r.values.push(e),r.sum+=e,e<r.min&&(r.min=e),e>r.max&&(r.max=e),r.count+=1)})),r.domain=[r.min,r.max],r.limits=function(e,t){return Li(r,e,t)},r},Li=function(e,t,r){void 0===t&&(t="equal"),void 0===r&&(r=7),"array"==Ri(e)&&(e=Mi(e));var n=e.min,i=e.max,o=e.values.sort((function(e,t){return e-t}));if(1===r)return[n,i];var a=[];if("c"===t.substr(0,1)&&(a.push(n),a.push(i)),"e"===t.substr(0,1)){a.push(n);for(var s=1;s<r;s++)a.push(n+s/r*(i-n));a.push(i)}else if("l"===t.substr(0,1)){if(n<=0)throw new Error("Logarithmic scales are only possible for values > 0");var l=Math.LOG10E*Di(n),u=Math.LOG10E*Di(i);a.push(n);for(var c=1;c<r;c++)a.push(Fi(10,l+c/r*(u-l)));a.push(i)}else if("q"===t.substr(0,1)){a.push(n);for(var d=1;d<r;d++){var p=(o.length-1)*d/r,f=Ni(p);if(f===p)a.push(o[f]);else{var h=p-f;a.push(o[f]*(1-h)+o[f+1]*h)}}a.push(i)}else if("k"===t.substr(0,1)){var m,g=o.length,y=new Array(g),b=new Array(r),v=!0,_=0,A=null;(A=[]).push(n);for(var w=1;w<r;w++)A.push(n+w/r*(i-n));for(A.push(i);v;){for(var T=0;T<r;T++)b[T]=0;for(var S=0;S<g;S++)for(var E=o[S],O=Number.MAX_VALUE,x=void 0,C=0;C<r;C++){var I=Pi(A[C]-E);I<O&&(O=I,x=C),b[x]++,y[S]=x}for(var j=new Array(r),R=0;R<r;R++)j[R]=null;for(var D=0;D<g;D++)null===j[m=y[D]]?j[m]=o[D]:j[m]+=o[D];for(var F=0;F<r;F++)j[F]*=1/b[F];v=!1;for(var N=0;N<r;N++)if(j[N]!==A[N]){v=!0;break}A=j,++_>200&&(v=!1)}for(var P={},M=0;M<r;M++)P[M]=[];for(var L=0;L<g;L++)P[m=y[L]].push(o[L]);for(var k=[],q=0;q<r;q++)k.push(P[q][0]),k.push(P[q][P[q].length-1]);k=k.sort((function(e,t){return e-t})),a.push(k[0]);for(var $=1;$<k.length;$+=2){var z=k[$];isNaN(z)||-1!==a.indexOf(z)||a.push(z)}}return a},ki={analyze:Mi,limits:Li},qi=y,$i=y,zi=Math.sqrt,Bi=Math.pow,Gi=Math.min,Ui=Math.max,Vi=Math.atan2,Hi=Math.abs,Yi=Math.cos,Xi=Math.sin,Wi=Math.exp,Ki=Math.PI,Qi=y,Zi=y,Ji=v,eo=fi,to={cool:function(){return eo([Ji.hsl(180,1,.9),Ji.hsl(250,.7,.4)])},hot:function(){return eo(["#000","#f00","#ff0","#fff"]).mode("rgb")}},ro={OrRd:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"],PuBu:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"],BuPu:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"],Oranges:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"],BuGn:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"],YlOrBr:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"],YlGn:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"],Reds:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"],RdPu:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"],Greens:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"],YlGnBu:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"],Purples:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"],GnBu:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"],Greys:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"],YlOrRd:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"],PuRd:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"],Blues:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"],PuBuGn:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"],Viridis:["#440154","#482777","#3f4a8a","#31678e","#26838f","#1f9d8a","#6cce5a","#b6de2b","#fee825"],Spectral:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],RdYlGn:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],RdBu:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],PiYG:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],PRGn:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],RdYlBu:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],BrBG:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],RdGy:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],PuOr:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],Set2:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"],Accent:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"],Set1:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"],Set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],Dark2:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"],Paired:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"],Pastel2:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc","#cccccc"],Pastel1:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"]},no=0,io=Object.keys(ro);no<io.length;no+=1){var oo=io[no];ro[oo.toLowerCase()]=ro[oo]}var ao=ro,so=v;return so.average=function(e,t,r){void 0===t&&(t="lrgb"),void 0===r&&(r=null);var n=e.length;r||(r=Array.from(new Array(n)).map((function(){return 1})));var i=n/r.reduce((function(e,t){return e+t}));if(r.forEach((function(e,t){r[t]*=i})),e=e.map((function(e){return new ti(e)})),"lrgb"===t)return ui(e,r);for(var o=e.shift(),a=o.get(t),s=[],l=0,u=0,c=0;c<a.length;c++)if(a[c]=(a[c]||0)*r[0],s.push(isNaN(a[c])?0:r[0]),"h"===t.charAt(c)&&!isNaN(a[c])){var d=a[c]/180*oi;l+=ai(d)*r[0],u+=si(d)*r[0]}var p=o.alpha()*r[0];e.forEach((function(e,n){var i=e.get(t);p+=e.alpha()*r[n+1];for(var o=0;o<a.length;o++)if(!isNaN(i[o]))if(s[o]+=r[n+1],"h"===t.charAt(o)){var c=i[o]/180*oi;l+=ai(c)*r[n+1],u+=si(c)*r[n+1]}else a[o]+=i[o]*r[n+1]}));for(var f=0;f<a.length;f++)if("h"===t.charAt(f)){for(var h=li(u/s[f],l/s[f])/oi*180;h<0;)h+=360;for(;h>=360;)h-=360;a[f]=h}else a[f]=a[f]/s[f];return p/=n,new ti(a,t).alpha(p>.99999?1:p,!0)},so.bezier=function(e){var t=function(e){var t,r,n,i,o,a,s;if(2===(e=e.map((function(e){return new hi(e)}))).length)t=e.map((function(e){return e.lab()})),o=t[0],a=t[1],i=function(e){var t=[0,1,2].map((function(t){return o[t]+e*(a[t]-o[t])}));return new hi(t,"lab")};else if(3===e.length)r=e.map((function(e){return e.lab()})),o=r[0],a=r[1],s=r[2],i=function(e){var t=[0,1,2].map((function(t){return(1-e)*(1-e)*o[t]+2*(1-e)*e*a[t]+e*e*s[t]}));return new hi(t,"lab")};else if(4===e.length){var l;n=e.map((function(e){return e.lab()})),o=n[0],a=n[1],s=n[2],l=n[3],i=function(e){var t=[0,1,2].map((function(t){return(1-e)*(1-e)*(1-e)*o[t]+3*(1-e)*(1-e)*e*a[t]+3*(1-e)*e*e*s[t]+e*e*e*l[t]}));return new hi(t,"lab")}}else{if(!(e.length>=5))throw new RangeError("No point in running bezier with only one color.");var u,c,d;u=e.map((function(e){return e.lab()})),d=e.length-1,c=function(e){for(var t=[1,1],r=1;r<e;r++){for(var n=[1],i=1;i<=t.length;i++)n[i]=(t[i]||0)+t[i-1];t=n}return t}(d),i=function(e){var t=1-e,r=[0,1,2].map((function(r){return u.reduce((function(n,i,o){return n+c[o]*Math.pow(t,d-o)*Math.pow(e,o)*i[r]}),0)}));return new hi(r,"lab")}}return i}(e);return t.scale=function(){return mi(t)},t},so.blend=_i,so.cubehelix=function(e,t,r,n,i){void 0===e&&(e=300),void 0===t&&(t=-1.5),void 0===r&&(r=1),void 0===n&&(n=1),void 0===i&&(i=[0,1]);var o,a=0;"array"===Ai(i)?o=i[1]-i[0]:(o=0,i=[i,i]);var s=function(s){var l=Ti*((e+120)/360+t*s),u=Si(i[0]+o*s,n),c=(0!==a?r[0]+s*a:r)*u*(1-u)/2,d=Oi(l),p=Ei(l);return xi(wi([255*(u+c*(-.14861*d+1.78277*p)),255*(u+c*(-.29227*d-.90649*p)),255*(u+c*(1.97294*d)),1]))};return s.start=function(t){return null==t?e:(e=t,s)},s.rotations=function(e){return null==e?t:(t=e,s)},s.gamma=function(e){return null==e?n:(n=e,s)},s.hue=function(e){return null==e?r:("array"===Ai(r=e)?0==(a=r[1]-r[0])&&(r=r[1]):a=0,s)},s.lightness=function(e){return null==e?i:("array"===Ai(e)?(i=e,o=e[1]-e[0]):(i=[e,e],o=0),s)},s.scale=function(){return xi.scale(s)},s.hue(r),s},so.mix=so.interpolate=Rn,so.random=function(){for(var e="#",t=0;t<6;t++)e+="0123456789abcdef".charAt(Ii(16*ji()));return new Ci(e,"hex")},so.scale=fi,so.analyze=ki.analyze,so.contrast=function(e,t){e=new qi(e),t=new qi(t);var r=e.luminance(),n=t.luminance();return r>n?(r+.05)/(n+.05):(n+.05)/(r+.05)},so.deltaE=function(e,t,r,n,i){void 0===r&&(r=1),void 0===n&&(n=1),void 0===i&&(i=1);var o=function(e){return 360*e/(2*Ki)},a=function(e){return 2*Ki*e/360};e=new $i(e),t=new $i(t);var s=Array.from(e.lab()),l=s[0],u=s[1],c=s[2],d=Array.from(t.lab()),p=d[0],f=d[1],h=d[2],m=(l+p)/2,g=(zi(Bi(u,2)+Bi(c,2))+zi(Bi(f,2)+Bi(h,2)))/2,y=.5*(1-zi(Bi(g,7)/(Bi(g,7)+Bi(25,7)))),b=u*(1+y),v=f*(1+y),_=zi(Bi(b,2)+Bi(c,2)),A=zi(Bi(v,2)+Bi(h,2)),w=(_+A)/2,T=o(Vi(c,b)),S=o(Vi(h,v)),E=T>=0?T:T+360,O=S>=0?S:S+360,x=Hi(E-O)>180?(E+O+360)/2:(E+O)/2,C=1-.17*Yi(a(x-30))+.24*Yi(a(2*x))+.32*Yi(a(3*x+6))-.2*Yi(a(4*x-63)),I=O-E;I=Hi(I)<=180?I:O<=E?I+360:I-360,I=2*zi(_*A)*Xi(a(I)/2);var j=p-l,R=A-_,D=1+.015*Bi(m-50,2)/zi(20+Bi(m-50,2)),F=1+.045*w,N=1+.015*w*C,P=30*Wi(-Bi((x-275)/25,2)),M=-2*zi(Bi(w,7)/(Bi(w,7)+Bi(25,7)))*Xi(2*a(P)),L=zi(Bi(j/(r*D),2)+Bi(R/(n*F),2)+Bi(I/(i*N),2)+M*(R/(n*F))*(I/(i*N)));return Ui(0,Gi(100,L))},so.distance=function(e,t,r){void 0===r&&(r="lab"),e=new Qi(e),t=new Qi(t);var n=e.get(r),i=t.get(r),o=0;for(var a in n){var s=(n[a]||0)-(i[a]||0);o+=s*s}return Math.sqrt(o)},so.limits=ki.limits,so.valid=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];try{return new(Function.prototype.bind.apply(Zi,[null].concat(e))),!0}catch(e){return!1}},so.scales=to,so.colors=dr,so.brewer=ao,so}()},9034:e=>{e.exports=JSON.parse('{"name":"@vizzly/api-client","version":"0.0.34","private":false,"license":"NONE","source":"src/index.ts","main":"dist/index.js","types":"dist/index.d.ts","type":"commonjs","files":["dist"],"devDependencies":{"@types/isomorphic-fetch":"^0.0.39","@types/jest":"^29.5.12","@types/lodash":"^4.17.0","@types/uuid":"^9.0.8","@vizzly/auth":"^0.2.8","jest":"^29.6.0","lodash":"^4.17.21","nock":"^13.5.4","prettier":"^3.2.5","ts-jest":"^29.1.1","ts-loader":"^9.5.1","typescript":"^5.3.2","uuid":"^9.0.1"},"scripts":{"test":"jest","build":"rm -rf ./dist && tsc","dev":"tsc -w","format":"prettier --write ./src/** ./__tests__/**","prepublish":"yarn build"},"dependencies":{"isomorphic-fetch":"^3.0.0"}}')}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={id:n,loaded:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.loaded=!0,o.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(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.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var n={};(()=>{r.d(n,{B:()=>Eo,Q:()=>xi});var e=r(4843),t=r(5250);const i=(e,r)=>(0,t.mergeWith)({},e,r,((e,r)=>(0,t.isArray)(r)?r:(0,t.isObject)(e)&&(0,t.isObject)(r)?i(e,r):r));var o=r(4893);const a=o.QueryEngineConfig.Constants.timeDimensionsConstants,s=(e,t)=>[...Object.keys(e),"none"].includes(t),l=o.QueryEngineConfig.Constants.supportedOperatorsConstants,u=(e,t)=>{let r=[...Object.keys(t.supportedOperators)];return r=r.filter((t=>c[t].validDataTypes.includes(e.dataType))),r},c=l,d=e=>e.map((e=>e.map((e=>"is_one_of"!=e.op&&"is_not_one_of"!=e.op||(0,t.isArray)(e.value)?e:Object.assign(Object.assign({},e),{value:[e.value]}))))),p=(e,t)=>e.map((e=>{let r=Object.assign(Object.assign({},e),{aggregate:void 0,function:e.function||e.aggregate});return delete r.aggregate,t&&r.field==t.field&&"none"==r.function&&(r.function=t.truncate),r})),f=e=>e.map((e=>{let t=Object.assign(Object.assign({},e),{aggregate:void 0,function:e.function||e.aggregate});return delete t.aggregate,t})),h=e=>"auto"===e||0===e||2===e?e:"auto",m=e=>{if(!e)return{};let r={};return e.measure&&Object.entries(e.measure).forEach((([e,t])=>{r&&(r[e]=f(t))})),{measure:(0,t.isEmpty)(r)?void 0:r,group:e.group}},g=o.QueryEngineConfig.Constants.supportedAggregatesConstants,y=g,b=(e,r,n)=>{const i=(0,t.replace)(e,r,n);return i.indexOf(r)>=0?b(i,r,n):i},v=["debug","info","warning","error","properties"];const _=e=>v.findIndex((e=>"error"==e))<=v.findIndex((t=>e==t)),A=e=>e instanceof Error?e:(0,t.isObject)(e)||(0,t.isArray)(e)?JSON.stringify(e):e,w=(...e)=>{_("debug")&&console.info("[VIZZLY DEBUG]",...e.map(A))},T=(...e)=>{_("warning")&&console.warn("[VIZZLY WARNING]",...e.map(A))},S=(...e)=>{_("error")&&console.error("[VIZZLY ERROR]",...e.map(A))},E=(Object.keys((0,t.cloneDeep)(y)),e=>{return(t=b(e,"_"," ")).charAt(0).toUpperCase()+t.slice(1);var t}),O=(e,t)=>{const r=e.split("_"),n=r.pop();return[void 0,...Object.keys(t.supportedAggregates||{}),...Object.keys(t.supportedTimeTruncFunctions||{}),...Object.keys(t.supportedTransformationFunctions||{})].includes(n)?{field:r.join("_"),function:null!=n?n:""}:{field:e,function:"none"}},x=e=>e.map((e=>"string"==typeof e?{field:e,function:"none"}:e)),C=(e,t,r)=>{const n=e.supportedAggregates,i=Object.keys(n).filter((e=>n[e].validDataTypes.includes(t)));null==r||r.forEach((e=>{n.hasOwnProperty(e)||T(`Unsupported aggregate option: ${e} on ${t}`)}));let o=r&&r.length>0?r.filter((e=>i.includes(e))):i;return r&&r.length>0&&0===o.length&&(o=i),o},I=e=>(null==e?void 0:e.function)&&"none"!=(null==e?void 0:e.function)?`${e.field}_${e.function}`:null==e?void 0:e.field,j=O;function R(e,t){const r={};for(const[n,i]of Object.entries(e))r[n]=i.filter((e=>(null==e?void 0:e.field)!==t));return r}const D=(e,r)=>{let n=(0,t.remove)(e.order,(e=>(0,t.some)(r,(t=>{const r=t.function==e.function,n=t.field==e.field;return r&&n}))));return Object.assign(Object.assign({},e),{order:n})},F=(e,r,n)=>{var i,o,a;let l=Object.assign({},e);if("measure"in l&&(0,t.remove)(l.measure,(e=>e.field==r)),"barMeasure"in l&&(0,t.remove)(l.barMeasure,(e=>e.field==r)),"lineMeasure"in l&&(0,t.remove)(l.lineMeasure,(e=>e.field==r)),"xMeasure"in l&&(null===(i=l.yMeasure)||void 0===i?void 0:i.field)==r&&(l.xMeasure=null),"yMeasure"in l&&(null===(o=l.yMeasure)||void 0===o?void 0:o.field)==r&&(l.yMeasure=null),"order"in l&&(0,t.remove)(l.order,(e=>e.field==r)),"dimension"in l&&(0,t.remove)(l.dimension,(e=>e.field==r)),"barDimension"in l&&(0,t.remove)(l.barDimension,(e=>e.field==r)),"lineDimension"in l&&(0,t.remove)(l.lineDimension,(e=>e.field==r)),"filter"in l&&l.filter.forEach((e=>{(0,t.remove)(e,(e=>e.field==r))})),"parameters"in l&&l.parameters&&n){const e=((e,t,r)=>{if("measure"in e&&e.measure){const n=function(e,t){return Object.keys(e).map((e=>{const r=j(e,t);return(null==r?void 0:r.function)?r:null})).find((e=>null!==e))}(e.measure,r);if((null==n?void 0:n.function)&&n.field===t){const t=I(n);delete e.measure[t]}e.measure=R(e.measure,t)}if("group"in e&&e.group){const i=function(e,t){return Object.keys(e).map((e=>{const r=((e,t)=>{const r=e.split("_"),n=r.pop();return n&&!s(t,n)?null:{field:r.join("_"),truncate:null!=n?n:""}})(e,t.supportedTimeTruncFunctions);return(null==r?void 0:r.truncate)?r:null})).find((e=>null!==e))}(e.group,r);if((null==i?void 0:i.truncate)&&i.field===t){const t=(null==(n=i)?void 0:n.truncate)&&"none"!=(null==n?void 0:n.truncate)?`${n.field}_${n.truncate}`:null==n?void 0:n.field;delete e.group[t]}else e.group.hasOwnProperty(t)&&delete e.group[t];e.group=R(e.group,t)}var n;return e})(l.parameters,r,n);l.parameters=e}return"timeDimension"in l&&(null===(a=l.timeDimension)||void 0===a?void 0:a.field)==r&&(l.timeDimension=null),l},N=e=>{let t=[...e.measure];return e.dimension.forEach((e=>{t.push({field:e.field,function:e.function})})),e.timeDimension&&t.push({field:e.timeDimension.field,function:e.timeDimension.truncate}),D(e,t)},P=(e,t,r)=>{let n=i(e,t);const{value:o,error:a}=r.validate(n);if(a)throw a;return o};var M=r(4579),L=r.n(M);const k=e=>L().object({filters:L().array().items(L().array().items(X(e)).required().max(1)).required().max(1),ruleValue:L().string().allow("").required(),ruleValueEnd:L().string().allow(""),ruleType:L().valid("backgroundColor","fontColor","lineColor","areaColor").required()}).description("A rule used to conditionally format a view."),q=L().object({field:L().string().required().description("ID of the field in the data set to add a prefix too."),prefix:L().string().required().description("The prefix to be applied.")}),$=e=>({minutes:{description:e?e("duration_option.minutes","Minutes"):"Minutes",formatter:(e,t)=>{e.setMinutes(e.getMinutes()+t)}},hours:{description:e?e("duration_option.minutes","Hours"):"Hours",formatter:(e,t)=>{e.setHours(e.getHours()+t)}},days:{description:e?e("duration_option.minutes","Days"):"Days",formatter:(e,t)=>{e.setDate(e.getDate()+t)}},weeks:{description:e?e("duration_option.minutes","Weeks"):"Weeks",formatter:(e,t)=>{e.setDate(e.getDate()+7*t)}},months:{description:e?e("duration_option.minutes","Months"):"Months",formatter:(e,t)=>{e.setMonth(e.getMonth()+t)}},years:{description:e?e("duration_option.minutes","Years"):"Years",formatter:(e,t)=>{e.setFullYear(e.getFullYear()+t)}}}),z=L().object({unit:L().string().valid(...(()=>{const e=$();return Object.keys(e)})()).required(),value:L().number().integer().required(),timeFrame:L().string().valid(...(()=>{const e={future:{description:"Future"},past:{description:"Past"}};return Object.keys(e)})()).required()}),B=(e,t)=>{const r=t?new Date(t):new Date;if(!e.value||null===e.unit)throw new Error(`Unrecognized value: ${e.value}`);let n="future"===e.timeFrame?e.value:-e.value;return $()[e.unit].formatter(r,n),r},G=()=>L().array().items(L().object({key:L().string().required()})).min(0),U=(e,t)=>{const r=(e,t)=>L().object({field:e.required(),function:t.required().description("Which if any, aggregate function should be applied to the field?")});return(null==t?void 0:t.restrictFields)?L().alternatives(...t.restrictFields.filter((e=>e.canBeMeasure)).map((t=>{const n=(i=t,o=e,Object.keys(o).filter((e=>o[e].validDataTypes.includes(i.dataType))));var i,o;return r(L().string().valid(t.id).description(`${t.publicName}, ${t.description||""}.`),L().string().valid(...n,"none"))}))):r(L().string().description("The ID of the field from the data set to reference."),L().valid(...Object.keys(e),"none"))},V=e=>L().object({field:L().string().required().description("The ID of the field from the data set to reference."),direction:L().string().valid("asc","desc").required().description("In which direction should the results be ordered?"),function:L().string().valid(...Object.keys(e.supportedAggregates),...Object.keys(e.supportedTimeTruncFunctions),"none").description("Which if any, function should be applied to the field?")}),H=e=>L().object({field:L().string().required().description("The ID of the field from the data set to reference."),truncate:L().valid(...Object.keys(e),"none"),bucketFill:L().boolean()}),Y=(e,t)=>{const r=(t,r)=>L().object({field:t.required(),pivot:L().string().valid("x","y").optional(),function:r?L().valid(...Object.keys(e),"none").required():L().valid("none").required()});return(null==t?void 0:t.restrictFields)?L().array().items(L().alternatives(...t.restrictFields.filter((e=>e.canBeDimension)).map((e=>r(L().string().valid(e.id).description(`${e.publicName}, ${e.description||""}.`),"date_time"===e.dataType))))).description("Fields to group the data by"):L().array().items(r(L().string().description("The ID of the field from the data set to reference."),!0)).description("Fields to group the data by")},X=e=>L().object({field:L().string().required().description("The ID of the field from the data set to reference."),op:L().string().valid(...Object.keys(e.supportedOperators)).required(),value:L().alternatives(L().string().allow(null),L().number(),L().boolean(),L().array().items(L().string(),L().number()),z).required(),function:L().string().valid(...Object.keys(e.supportedAggregates),...Object.keys(e.supportedTimeTruncFunctions),"none").description("Which function should be applied to the field?")}),W=e=>L().array().items(L().array().items(X(e))),K=()=>L().number().description("Limit the number of results returned after the query has been ran."),Q=e=>{const t=(null==e?void 0:e.restrictDataSetIds)?L().string().valid(...e.restrictDataSetIds):L().string();return{viewId:L().string().allow("").optional().description("__vizzly_hide_from_docs"),displayTitle:L().string().allow("").description("A title that explains what is being displayed."),displaySubject:L().string().allow("").description("A chance to add a more detailed description of what is being shown."),dataSetId:t.description("The ID of the data set that is being used by the view."),protectedByOrganisation:L().boolean().optional().description("Has the view been created by your organisation, and therefore cannot be modified by your users?")}},Z=L().valid("auto",2,0).description("Determine how many axis labels should be shown on the axis"),J=(e,t)=>({measure:L().array().items(U(e.supportedAggregates,t)).required().description("A list of metrics that are to be shown. For example the `count` of a specific field in your data set."),dimension:Y(e.supportedTimeTruncFunctions,t).required(),order:L().array().items(V(e)),limit:K(),offset:L().number().min(0).description("Paginate results by using this property with limit."),filter:L().array().items(L().array().items(X(e)))}),ee=(e,t)=>Object.assign(Object.assign({},J(e,t)),{timeDimension:L().alternatives(H(e.supportedTimeTruncFunctions),L().valid(null)).required(),drilldown:L().alternatives(Y(e.supportedTimeTruncFunctions,t).required(),L().string()),xAxisPrefix:L().string().allow("").description("Add a prefix to the X Axis"),yAxisPrefix:L().string().allow("").description("Add a prefix to the Y Axis"),xAxisPostfix:L().string().allow("").description("Add a postfix to the X Axis"),yAxisPostfix:L().string().allow("").description("Add a postfix to the Y Axis"),yAxisFormat:L().alternatives(L().string(),L().valid(null)).description("ID of the formatting function to apply to the Y Axis values"),xAxisFormat:L().alternatives(L().string(),L().valid(null)).description("ID of the formatting function to apply to the X Axis values"),approxYAxisLabelCount:Z,approxXAxisLabelCount:Z}),te=L().string().valid("natural","straight","step","stepBefore","stepAfter"),re=e=>L().array().items(L().object({function:L().string().valid(...Object.keys(e.supportedAggregates),...Object.keys(e.supportedTimeTruncFunctions),"none"),field:L().string().required().description("The ID of the field from the data set to reference.")})),ne=e=>L().array().items(L().object({function:L().string().valid(...Object.keys(e.supportedAggregates),...Object.keys(e.supportedTimeTruncFunctions),"none"),truncate:L().string(),field:L().string().required().description("The ID of the field from the data set to reference."),bucketFill:L().boolean().optional(),pivot:L().string().valid("x","y").optional()})),ie=(e,t)=>L().object().pattern(L().string(),L().alternatives().try(L().array().items(H(e.supportedTimeTruncFunctions)).min(1),Y(e.supportedTimeTruncFunctions,t))).unknown(!0),oe=(e,t)=>L().object().pattern(L().string(),L().array().items(U(e.supportedAggregates,t)).min(1)).unknown(!0),ae=(e,t)=>L().object({measure:oe(e,t),group:ie(e,t)}),se=()=>L().array().items(L().object({color:L().string().required(),value:L().number().required(),strokeWidth:L().number().required(),strokeStyle:L().string().valid("dashed","solid").required(),label:L().boolean().optional()})),le=()=>L().object({func:L().string().valid("mean","sum","current").allow(null).optional()}),ue=()=>L().object({x:L().string().allow(""),y:L().string().allow("")}),ce=L().object().pattern(L().string(),L().object({width:L().number().min(0),height:L().number().min(0)})),de=e=>L().array().items(k(e)).description("Apply formatting based on a set of defined rules."),pe=e=>L().object(Object.assign(Object.assign(Object.assign({},Q(e.attributesSchemaOptions)),ee(e.queryEngineConfig,e.attributesSchemaOptions)),{stacked:L().valid(!0,!1,"100%"),legend:L().valid(!0,!1),type:L().valid("barChart","horizontalBarChart").required(),conditionalFormattingRules:de(e.queryEngineConfig),protectedFields:L().object({dimension:ne(e.queryEngineConfig),measure:re(e.queryEngineConfig)}).unknown(!0),parameters:ae(e.queryEngineConfig,e.attributesSchemaOptions),goalLines:se(),axisTitles:ue(),headline:le(),tags:G()})),fe=e=>(t,r)=>{let n=P(t,r,pe(e));return n=N(n),n};class he extends Error{constructor(e){super(e),this.name="ValidationError"}}const me=he;class ge extends me{constructor(e){super(`Corrupt view. ${e.message}.\n\n ${JSON.stringify(e)}\n `),this.name="CorruptedView"}}r(3514);const ye={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let be;const ve=new Uint8Array(16);function _e(){if(!be&&(be="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!be))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return be(ve)}const Ae=[];for(let e=0;e<256;++e)Ae.push((e+256).toString(16).slice(1));const we=function(e,t,r){if(ye.randomUUID&&!t&&!e)return ye.randomUUID();const n=(e=e||{}).random||(e.rng||_e)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(let e=0;e<16;++e)t[r+e]=n[e];return t}return function(e,t=0){return Ae[e[t+0]]+Ae[e[t+1]]+Ae[e[t+2]]+Ae[e[t+3]]+"-"+Ae[e[t+4]]+Ae[e[t+5]]+"-"+Ae[e[t+6]]+Ae[e[t+7]]+"-"+Ae[e[t+8]]+Ae[e[t+9]]+"-"+Ae[e[t+10]]+Ae[e[t+11]]+Ae[e[t+12]]+Ae[e[t+13]]+Ae[e[t+14]]+Ae[e[t+15]]}(n)},Te=(e,t)=>t.length>0&&t[0].length>0?{type:"function",function:e.aggregate,value:{type:"switchField",value:{cases:[{returns:{type:"field",function:"none",value:e.fieldId},filter:t},{returns:{type:"null"},filter:[[{value:1,op:"=",field:{type:"number",value:1}}]]}]}}}:{type:"field",function:e.aggregate,value:e.fieldId},Se=(e,t,r)=>e.map((({rule:e,name:n})=>({returns:{type:"string",value:n},filter:ke(e,t,r)}))),Ee=e=>"leftFieldId"in e&&"operator"in e&&"rightFieldId"in e,Oe=e=>"roundToDecimalPlaces"in e,xe=e=>"leftFieldId"in e&&"leftFunction"in e&&"operator"in e&&"rightFieldId"in e&&"rightFunction"in e,Ce=e=>"denominatorFieldId"in e||"numeratorFieldId"in e,Ie=e=>"rules"in e,je=e=>"rule"in e,Re=e=>"dateCalculationFunction"in e,De=e=>Ce(e)||Ee(e)||xe(e)||Ie(e)||Oe(e)||Re(e)||je(e),Fe=(e,t,r,n,i,o)=>{if(Ce(t))return((e,t,r,n,i)=>{var o,a,s,l;const{combinedNominatorFilters:u,combinedDenominatorFilters:c}=function(e,t){let r=[],n=[];return t.numeratorFilter&&qe(t.numeratorFilter)?t.numeratorFilter.forEach((t=>{r=[...r,...Le(null!=e?e:[],t)]})):r=null!=e?e:[],t.denominatorFilter&&qe(t.denominatorFilter)?t.denominatorFilter.forEach((t=>{n=[...n,...Le(null!=e?e:[],t)]})):n=null!=e?e:[],{combinedNominatorFilters:r,combinedDenominatorFilters:n}}(i,e),d={fieldId:null!==(o=e.numeratorFieldId)&&void 0!==o?o:e.denominatorFieldId,aggregate:null!==(a=e.numeratorAggregate)&&void 0!==a?a:e.denominatorAggregate},p={fieldId:null!==(s=e.denominatorFieldId)&&void 0!==s?s:e.numeratorFieldId,aggregate:null!==(l=e.denominatorAggregate)&&void 0!==l?l:e.numeratorFieldId},f={type:"subquery",value:{measure:[{type:"field",value:e.denominatorFieldId,function:e.denominatorAggregate}],filter:ke(c||[],t,r)}},h=Te(p,qe(e.denominatorFilter)?ke(c,t,r):[]);return{type:"maths",left:Te(d,qe(e.numeratorFilter)?ke(u,t,r):[]),op:"/",right:"withinGrouping"===e.denominatorScope?h:f}})(t,r,n,0,o);if(Ie(t))return((e,t,r,n)=>{const i={type:"switchField",value:{cases:Se(t.rules,r,n)}};return"none"==e.function?i:{type:"function",function:e.function,value:i}})(e,t,r,n);if(xe(t))return(e=>{const t=(e,t,r)=>r?{type:"maths",left:{type:"field",value:e,function:t},right:{type:"field",value:r.fieldId,function:r.function},op:r.operator}:{type:"field",value:e,function:t};return{type:"maths",left:t(e.leftFieldId,e.leftFunction,e.leftNested),right:t(e.rightFieldId,e.rightFunction,e.rightNested),op:e.operator}})(t);if(Ee(t))return((e,t)=>"none"!=e.function?{type:"function",function:e.function,value:{type:"maths",left:{type:"field",value:t.leftFieldId,function:"none"},right:{type:"field",value:t.rightFieldId,function:"none"},op:t.operator}}:{type:"maths",left:{type:"field",value:t.leftFieldId,function:"none"},right:{type:"field",value:t.rightFieldId,function:"none"},op:t.operator})(e,t);if(Oe(t))return Ne(e,t);if(je(t))return((e,t,r)=>({type:"function",function:e.function,value:{type:"switchField",value:{cases:[{returns:{type:"field",function:"none",value:e.fieldId},filter:ke(e.rule,t,r)},{returns:{type:"null"},filter:[[{value:1,op:"=",field:{type:"number",value:1}}]]}]}}}))(t,r,n);if(Re(t))return Pe(e,t);throw`Unsupported custom field type; ${JSON.stringify(t)}`},Ne=(e,t)=>{const r={type:"field",function:`round_to_${t.roundToDecimalPlaces}_dp`,value:t.fieldId};return"none"==e.function?r:{type:"function",function:e.function,value:r}},Pe=(e,t)=>"none"!=e.function?{type:"function",function:e.function,value:{type:"date_maths",op:t.dateCalculationFunction,left:{type:"field",function:"none",value:t.leftFieldId},right:{type:"field",function:"none",value:t.rightFieldId}}}:{type:"date_maths",op:t.dateCalculationFunction,left:{type:"field",function:"none",value:t.leftFieldId},right:{type:"field",function:"none",value:t.rightFieldId}},Me=e=>{var t,r;if("leftAggregate"in e||"rightAggregate"in e){let t=Object.assign(Object.assign({},e),{rightFunction:e.rightFunction||e.rightAggregate,leftFunction:e.leftFunction||e.leftAggregate,leftNested:e.leftNested?Object.assign(Object.assign({},e.leftNested),{aggregate:void 0,function:e.leftNested.function||e.leftNested.aggregate}):void 0,rightNested:e.rightNested?Object.assign(Object.assign({},e.rightNested),{aggregate:void 0,function:e.rightNested.function||e.rightNested.aggregate}):void 0});return delete t.leftAggregate,delete t.rightAggregate,t.rightNested&&delete t.rightNested.aggregate,t.leftNested&&delete t.leftNested.aggregate,t}if("numeratorFieldId"in e&&!("version"in e)){const n=[...(null===(t=e.numeratorFilter)||void 0===t?void 0:t[0])||[],...(null===(r=e.denominatorFilter)||void 0===r?void 0:r[0])||[]];return Object.assign(Object.assign({},e),{version:2,denominatorScope:e.denominatorScope||"all",denominatorFilter:(null==e?void 0:e.denominatorFilter)||[],numeratorFilter:n.length>0?[n]:[]})}return e},Le=(e,r)=>(e&&!(0,t.isEmpty)(e)||(e=[[]]),[...e].map((e=>[...e,...r]))),ke=(e,t,r)=>e.map((n=>[...n].flatMap((n=>{var i,o;if(n.function&&!s(t.supportedTimeTruncFunctions,n.function))throw`Query engine does not support the query function ${n.function}.`;const a=rt(r,n.field);let l={type:"field",value:n.field,function:null!==(i=n.function)&&void 0!==i?i:"none"};if(De(a)&&(l=Fe({field:a.id,function:null!==(o=n.function)&&void 0!==o?o:"none"},a,t,r,0,e)),"array_contains"==n.op&&Array.isArray(n.value))return[...n.value].map((e=>({field:l,op:n.op,value:e})));let u=n.value;return function(e){const{error:t}=z.validate(e);return!t}(n.value)&&(u=B(n.value)),[{field:l,op:n.op,value:u}]})))),qe=e=>e&&(0,t.isArray)(e)&&(0,t.isArray)(e[0]),$e=(e,t)=>[[...e,t],e.length],ze=(e,t,r,n,i,o,a,l,u)=>{let c=[],d=[],p=[],f=[],h=[];if(o){let t;if(!s(u.supportedTimeTruncFunctions,o.truncate))throw`Query engine does not support the time trunc function ${o.truncate}.`;[d,t]=$e(d,{type:"field",value:o.field,function:o.truncate}),c=[...c,{functionId:o.truncate,field:rt(e,o.field)}],p=[...p,{index:t}]}return i.forEach((t=>{let r;[d,r]=$e(d,{type:"field",value:null==t?void 0:t.field,function:t.function}),c=[...c,{functionId:t.function,field:rt(e,t.field)}],p=[...p,{index:r}]})),t.forEach((t=>{if(r=u.supportedAggregates,n=t.function,![...Object.keys(r),"none"].includes(n))throw`Query engine does not support the query function ${t.function}.`;var r,n;[d]=$e(d,{type:"field",value:t.field,function:t.function}),c=[...c,{functionId:t.function,field:rt(e,t.field)}]})),r.forEach((e=>{const t=d.findIndex((t=>{if("field"==t.type){const r=t.function==e.function;return t.value==e.field&&r}return!1}));t>=0&&(f=[...f,{index:t,direction:e.direction}])})),n.forEach((t=>{const r=ke([t],u,e);h=[...h,r[0]]})),d=d.map((t=>{if("field"==t.type&&"string"==typeof t.value){const r=rt(e,t.value);if(De(r))return Fe({function:t.function,field:t.value},r,u,e,Qe({group:p}),n)}return t})),{query:{type:"query",dataSetId:e.id,measure:d,group:p,filter:h,order:f,limit:a,offset:l},measureDescription:c}};var Be=r(6342);const Ge=e=>L().alternatives((e=>L().object({type:L().valid("function").required(),value:L().link("#Measure"),function:L().valid("none",...Object.keys(e.supportedAggregates))}))(e),L().object({type:L().valid("null").required()}),L().object({type:L().valid("boolean").required(),value:L().boolean().allow(null)}),L().object({type:L().valid("string").required(),value:L().string().allow("")}),L().object({type:L().valid("maths").required(),left:L().link("#Measure"),right:L().link("#Measure").required(),op:L().string().valid("+","*","/","-").required()}),L().object({type:L().valid("date_maths").required(),left:L().link("#Measure").required(),right:L().link("#Measure").required(),op:L().string().valid(...Be.DATE_MATHS_OPERATORS).required()}),L().object({type:L().valid("subquery").required(),value:L().object({measure:L().array().items(L().link("#Measure")),filter:L().array().items(L().array().items(L().link("#Filter")))})}),(e=>L().object({type:L().valid("field").required(),value:L().string().required(),function:L().valid("none",...Object.keys(e.supportedAggregates),...Object.keys(e.supportedTimeTruncFunctions),...Object.keys(e.supportedTransformationFunctions)).required()}))(e),L().object({type:"number",value:L().number()}),L().object({type:L().valid("switchField").required(),value:L().object({cases:L().array().items(L().object({returns:L().link("#Measure"),filter:L().array().items(L().array().items(L().link("#Filter")))}))})})).id("Measure"),Ue=L().object({index:L().number().required()}),Ve=L().object({index:L().number().required(),direction:L().string().valid("asc","desc").required()}),He=(e,t)=>{let r=[L().valid(null)];return t.forEach((e=>{"boolean"==e&&(r=[...r,L().boolean()]),"string"==e&&(r=[...r,L().string()]),"string[]"==e&&(r=[...r,L().string(),L().number()]),"number"==e&&(r=[...r,L().number()]),"date_time"==e&&(r=[...r,L().date().iso()])})),"is_one_of"==e||"is_not_one_of"==e?L().array().items(L().alternatives(r)):L().alternatives(r)},Ye=e=>L().object({field:Ge(e),op:L().string().valid(...Object.keys(e.supportedOperators)),value:L().alternatives().conditional("op",Object.keys(e.supportedOperators).map((t=>({is:t,then:He(t,e.supportedOperators[t].validDataTypes)}))))}).id("Filter"),Xe=e=>{const t=Ye(e);return L().alternatives(L().object({type:L().valid("preparedQuery").required(),preparedQueryType:L().valid("uniqueArrayValues").required(),dataSetId:L().string().required(),fieldId:L().string().required(),filter:L().array().items(L().array().items(t))}),L().object({type:L().valid("preparedQuery").required(),preparedQueryType:L().valid("preAggregated").required(),dataSetId:L().string().required(),filter:L().object().pattern(L().string(),L().array().items(L().array().items(t)))}))},We=e=>{const t=Ye(e),r=Ge(e);return L().alternatives().conditional(".type",{is:"query",then:L().object({type:L().valid("query"),dataSetId:L().string().required(),measure:L().array().items(r).min(1).required(),group:L().array().items(Ue).required(),filter:L().array().items(L().array().items(t)).required(),order:L().array().items(Ve).required(),limit:K(),offset:L().number().optional()}).shared(t).shared(r)}).conditional(".type",{is:"preparedQuery",then:Xe(e)})},Ke=(We(o.QueryEngineConfig.getQueryEngineConfig("postgres")),We(o.QueryEngineConfig.getQueryEngineConfig("snowflake")),We(o.QueryEngineConfig.getQueryEngineConfig("mariadb")),We(o.QueryEngineConfig.getQueryEngineConfig("mysql")),We(o.QueryEngineConfig.getQueryEngineConfig("bigquery")),We(o.QueryEngineConfig.getQueryEngineConfig("redshift")),ze),Qe=e=>e.group.length>0,Ze=(e,t,r)=>({query:{type:"preparedQuery",preparedQueryType:"uniqueArrayValues",dataSetId:e,fieldId:t.id,filter:r||[]},resultFields:[{id:t.id,publicName:t.publicName,dataType:t.dataType}]});class Je extends me{constructor(e,t){super(`\n An expected field is missing from a dataSet.\n\n Missing '${t}'. Got;\n ${JSON.stringify(e)}\n `),this.name="FieldNotFoundInDataSet",this.missingFieldId=t}getMissingFieldId(){return this.missingFieldId}}function et(e,r){let n=[...e];return(null==r?void 0:r.onlyFieldTypes)&&!(0,t.isEmpty)(r.onlyFieldTypes)&&(n=[...n].filter((e=>{var t;return null===(t=null==r?void 0:r.onlyFieldTypes)||void 0===t?void 0:t.includes(e.dataType)}))),(null==r?void 0:r.forComponent)&&(n=((e,t)=>{const r=$r(t);return[...e].filter((e=>{let t=!0;return Ce(e)&&!r.supportedCustomFields.percentages&&(t=!1),Ee(e)&&!r.supportedCustomFields.simpleMaths&&(t=!1),Ie(e)&&!r.supportedCustomFields.rules&&(t=!1),Oe(e)&&!r.supportedCustomFields.roundedNumbers&&(t=!1),je(e)&&!r.supportedCustomFields.conditional&&(t=!1),Re(e)&&!r.supportedCustomFields.dateCalculations&&(t=!1),t}))})(n,r.forComponent)),(null==r?void 0:r.removePercentage)&&(n=n.filter((e=>!Ce(e)))),(null==r?void 0:r.removeRuleGrouping)&&(n=n.filter((e=>!Ie(e)))),(null==r?void 0:r.removeSimpleMaths)&&(n=n.filter((e=>!Ee(e)))),(null==r?void 0:r.removeAggregateMaths)&&(n=n.filter((e=>!xe(e)))),(null==r?void 0:r.removeDateCalculations)&&(n=n.filter((e=>!Re(e)))),(null==r?void 0:r.removeConditional)&&(n=n.filter((e=>!je(e)))),(null==r?void 0:r.onlyDimensions)&&(n=n.filter((e=>e.canBeDimension))),(null==r?void 0:r.onlyMeasures)&&(n=n.filter((e=>e.canBeMeasure))),n}const tt=(e,t)=>e.find((e=>e.id==t))||null,rt=(e,t)=>{let r=[...e.fields].find((e=>e.id==t));if(r)return r;throw new Je(e,t)},nt=(e,r)=>{const n=(0,t.findIndex)(e,(e=>e.id==r));return[e[n]||null,n]},it=(e,t)=>[...et(e.fields,{onlyFieldTypes:["number","string","boolean"],onlyMeasures:!0,forComponent:t})],ot=e=>Object.assign(Object.assign({},e),{fields:[...e.fields].filter((e=>!De(e)))}),at=(e,t,r)=>{const n="horizontalBarChart"===r?void 0:"x",i=(e=>[...et(e.fields,{onlyFieldTypes:["boolean","number","string"],onlyDimensions:!0,removePercentage:!0,removeSimpleMaths:!0,removeAggregateMaths:!0})])(e)[0],o=[...it(e,r)].map((e=>{const r=(n=e,i=t.supportedAggregates,((e,t)=>{var r;let n=null!==(r=e.supportedAggregateOptions)&&void 0!==r?r:[],i=n.filter((r=>Object.keys(t).includes(r)&&t[r].validDataTypes.includes(e.dataType)));return 0===i.length?i=Object.keys(t).filter((r=>t[r].validDataTypes.includes(e.dataType))):i.sort(((e,t)=>n.indexOf(e)-n.indexOf(t))),i})(n,i)[0]);var n,i;return{field:e.id,function:r}}));return{dataSetId:e.id,measure:o,order:[],timeDimension:null,filter:[],dimension:i?[{field:i.id,function:"none",pivot:n}]:[]}},st=(e,t)=>t?(e=e.map(ot),[...[...e].map((e=>{const r=(t[e.id]||[]).map(Me);return Object.assign(Object.assign({},e),{fields:[...e.fields,...r]})}))]):e;class lt extends me{constructor(e,t){super(`\n An expected data set is missing from the dashboard.\n\n Missing '${t}'. Got;\n ${JSON.stringify([...e].map((e=>e.id)))}\n `),this.name="DataSetNotFound"}}const ut={allowUnknown:!0,stripUnknown:!0},ct=(e,t,r)=>{const{error:n}=$r(e.type,{queryEngineConfig:r}).schema.validate(e,ut);if(n)return[new ge(n)];const i=tt(t,e.dataSetId);if(!i)return[new lt(t,e.dataSetId)];const o=(e=>{let t=[];return(e=>{let t=[];return"measure"in e&&e.measure&&(t=[...t,...e.measure]),"xMeasure"in e&&e.xMeasure&&(t=[...t,e.xMeasure]),"yMeasure"in e&&e.yMeasure&&(t=[...t,e.yMeasure]),t})(e).forEach((e=>{t=[...t,e.field]})),(e=>{let t=[];return"dimension"in e&&e.dimension&&(t=[...t,...e.dimension]),"lineDimension"in e&&e.lineDimension&&(t=[...t,...e.lineDimension]),"barDimension"in e&&e.barDimension&&(t=[...t,...e.barDimension]),t})(e).forEach((e=>{t=[...t,e.field]})),"order"in e&&e.order&&(t=[...t,...[...e.order].map((e=>e.field))]),"timeDimension"in e&&e.timeDimension&&(t=[...t,e.timeDimension.field]),t})(e);try{o.forEach((e=>{rt(i,e)}))}catch(e){if(e instanceof Je)return[e];throw e}return[]},dt=e=>{return!!(e=>{var t;return"comboChart"===e.type?!!e.timeDimension||!!(e.barDimension.length>0&&e.lineDimension.length>0):"barChart"!==e.type&&"lineChart"!==e.type&&"areaChart"!==e.type&&"horizontalBarChart"!==e.type&&"scatterChart"!==e.type&&"pieChart"!==e.type||!!e.timeDimension||!(null==e?void 0:e.dimension)||0!==(null===(t=null==e?void 0:e.dimension)||void 0===t?void 0:t.length)})(e)||("barChart"===(t=e).type?"The Column Chart needs to have a grouping or a time to display correctly.":"lineChart"===t.type?"The Line Chart needs to have a grouping or a time to display correctly.":"areaChart"===t.type?"The Area Chart needs to have a grouping or a time to display correctly.":"horizontalBarChart"===t.type?"The Horizontal Bar Chart needs to have a grouping or a time to display correctly.":"comboChart"===t.type?"The Combo Chart needs to have a grouping (Bar and Line), or have time set to display correctly.":"scatterChart"===t.type?"The Scatter Chart needs to have a grouping to display correctly.":"pieChart"===t.type?"The Pie Chart needs to have a grouping to display correctly.":null);var t};const pt=e=>e||`view_${we()}`;function ft(e){const t=e,{parentDimension:r}=t;return function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r}(t,["parentDimension"])}const ht=(e,r,n)=>{let i=(0,t.cloneDeep)(et(r.fields,{onlyFieldTypes:["boolean","string"]})),o=(0,t.cloneDeep)(et(r.fields,{onlyFieldTypes:["date_time"]})),a=(0,t.cloneDeep)(et(r.fields,{onlyFieldTypes:["number"]})),s=null;return o[0]&&(s={field:o[0].id,truncate:"none"}),n(e,{protectedByOrganisation:!0,dimension:i.map((e=>({field:e.id,function:"none"}))),measure:[...a].map((e=>({function:"none",field:e.id}))),order:[],timeDimension:s})},mt=(e,r)=>{let n=null,i=(0,t.cloneDeep)(e);return i.forEach((e=>{const t=rt(r,e.field);"date_time"==t.dataType&&(n={field:t.id,truncate:e.function})})),i=i.filter((e=>"date_time"!=rt(r,e.field).dataType)),{timeDimension:n,dimension:i}},gt=e=>{let t=[...e.dimension];return"timeDimension"in e&&e.timeDimension&&(t=[{field:e.timeDimension.field,function:e.timeDimension.truncate},...t]),t},yt=e=>{if(!e)return;let r=(0,t.cloneDeep)(e);return r.measure=f(e.measure||[]),r},bt=(e,r)=>{let n=[];return(0,t.isEmpty)(r)||void 0===r?[]:(null==r||r.map((t=>{if((null==t?void 0:t.ruleType)&&(null==t?void 0:t.ruleValue)){let r=[];const i="field"in t&&"string"==typeof t.field&&"operator"in t&&"string"==typeof t.operator&&"value"in t;if(null==t?void 0:t.filters){const n=t.filters.map((t=>t.map((t=>vt(t,e)))));r.push(...n)}else i&&r.push([vt({field:t.field,op:t.operator,value:t.value},e)]);n.push({filters:r,ruleValueEnd:null==t?void 0:t.ruleValueEnd,ruleValue:t.ruleValue,ruleType:t.ruleType})}})),n)},vt=(e,t)=>{var r;const n=O(e.field,t),i="none"!==n.function?n.function:null!==(r=e.function)&&void 0!==r?r:"none";return{field:n.field,op:e.op,value:e.value,function:i}},_t={title:"Column chart",description:"Uses bars to compare different sets of data.",namespace:"bar_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this bar chart?"},views:{type:"views",title:"View",description:""},field_y_axis:{type:"fieldCollector",title:"Metric - Y Axis",description:"What do you want each bar to measure?",callToAction:"Add metric"},drilldown:{type:"drilldown",title:"Drilldown",description:"After clicking on a segment of this bar chart, what information do you want to see next?"},field_x_axis:{type:"fieldCollector",title:"Grouping - X Axis",description:"What do you want each bar to represent? An example might be a `product category` field to represent each category as a bar.",callToAction:"Add grouping"},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this bar chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this bar chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{stacked:{type:"stacked",title:"Layout",description:"",namespace:"stacked"},legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"}}},headline:{type:"headline",title:"Headline",description:""},goal_line:{type:"goalLine",title:"Goal Lines",description:""},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""}}};function At(e,t){return(t=>t in e.format_panel)(t)?Object.assign(Object.assign({},e.format_panel[t]),{namespace:t}):Object.assign(Object.assign({},e.data_panel[t]),{namespace:t})}function wt(e,t){var r;return null===(r=e.format_panel.axis_labels)||void 0===r?void 0:r.subSectionDefinition[t]}function Tt(e){return Object.assign(Object.assign({},At(e,"heading")),{subSection:[e.format_panel.heading.subSectionDefinition.title,e.format_panel.heading.subSectionDefinition.subject]})}function St(e){return Object.assign(Object.assign({},At(e,"axis_labels")),{y:Object.assign(Object.assign({},wt(e,"y")),{prefix:wt(e,"y.prefix"),postfix:wt(e,"y.postfix"),format:wt(e,"y.format"),count:wt(e,"y.count"),axisTitle:wt(e,"y.axis_title")}),x:Object.assign(Object.assign({},wt(e,"x")),{prefix:wt(e,"x.prefix"),postfix:wt(e,"x.postfix"),format:wt(e,"x.format"),count:wt(e,"x.count"),axisTitle:wt(e,"x.axis_title")})})}function Et(e,t,r){var n,i,o,a,s;return t?Object.assign(Object.assign({},At(e,"chart_styles")),{subSection:[null===(n=e.format_panel.chart_styles)||void 0===n?void 0:n.subSectionDefinition.curve,null===(i=e.format_panel.chart_styles)||void 0===i?void 0:i.subSectionDefinition.legend]}):r?Object.assign(Object.assign({},At(e,"chart_styles")),{subSection:[null===(o=e.format_panel.chart_styles)||void 0===o?void 0:o.subSectionDefinition.stacked,null===(a=e.format_panel.chart_styles)||void 0===a?void 0:a.subSectionDefinition.legend]}):Object.assign(Object.assign({},At(e,"chart_styles")),{subSection:[null===(s=e.format_panel.chart_styles)||void 0===s?void 0:s.subSectionDefinition.legend]})}function Ot(e,t){var r;return Object.assign(Object.assign({},null===(r=e.format_panel.stats_labels)||void 0===r?void 0:r.subSectionDefinition[t]),{namespace:t})}const xt=(e,t)=>{if("current"===(null==e?void 0:e.func)&&t)return e},Ct=e=>({title:_t.title,description:_t.description,servicesClass:"BarChart",namespace:_t.namespace,dump:e=>e,load:t=>{var r;return Object.assign(Object.assign({},t),{measure:f(t.measure),order:p(t.order,t.timeDimension),filter:d(t.filter),protectedFields:yt(t.protectedFields),viewId:pt(t.viewId),dimension:x(t.dimension),approxXAxisLabelCount:h(t.approxXAxisLabelCount),approxYAxisLabelCount:h(t.approxYAxisLabelCount),parameters:m(t.parameters),conditionalFormattingRules:bt(e.queryEngineConfig,t.conditionalFormattingRules),headline:xt(t.headline,t.timeDimension),tags:null!==(r=t.tags)&&void 0!==r?r:[]})},setAttributes:fe(e),validate:(t,r)=>ct(t,r,e.queryEngineConfig),init:(e,t)=>Object.assign({type:"barChart",measure:[],dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",viewId:pt(null==t?void 0:t.viewId),filter:[],order:[],stacked:void 0,dataSetId:e,limit:5e3,conditionalFormattingRules:[],protectedByOrganisation:void 0,protectedFields:void 0,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,drilldown:[],legend:!0,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",parameters:{},goalLines:void 0,axisTitles:void 0,headline:void 0,tags:[]},t),createFeedback:dt,schema:pe(e),removeField:(t,r)=>F(t,r,e.queryEngineConfig),isRunnable:e=>e.measure.length>0,autoGenerate(t){const{measure:r,dimension:n}=at(t,e.queryEngineConfig,"barChart");return this.init(t.id,{measure:[r[0]],dimension:n})},dataPanelConfig:()=>[At(_t,"data_set"),At(_t,"views"),Object.assign(Object.assign({},At(_t,"field_y_axis")),{fieldFilterOptions:{forComponent:"barChart",onlyMeasures:!0},preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"}),At(_t,"drilldown"),Object.assign(Object.assign({},At(_t,"field_x_axis")),{fieldFilterOptions:{forComponent:"barChart",onlyDimensions:!0},preventDuplicates:!0,preSetPartialAttributes:(e,t)=>mt(e,t),getValues:e=>gt(e),maxAllowed:2,testId:"add-dimension"}),At(_t,"sort"),At(_t,"filter"),At(_t,"custom_metrics"),At(_t,"limit")],formatPanelConfig:()=>[Tt(_t),Et(_t,!1,!0),St(_t),Object.assign(Object.assign({},At(_t,"conditional_formatting")),{ruleType:"backgroundColor"}),At(_t,"goal_line"),At(_t,"headline")],supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0},supportedFeatures:{parameters:!0,colorGradient:!1},setDataAttributesFromPreAggregatedDataSet(e,t){return ht(e,t,this.setAttributes)}}),It=e=>L().object(Object.assign(Object.assign(Object.assign({},Q(e.attributesSchemaOptions)),ee(e.queryEngineConfig,e.attributesSchemaOptions)),{stacked:L().valid(!0,!1,"100%"),legend:L().valid(!0,!1),type:L().valid("lineChart").required(),parameters:ae(e.queryEngineConfig,e.attributesSchemaOptions),lineCurve:te,conditionalFormattingRules:de(e.queryEngineConfig),goalLines:se(),axisTitles:ue(),headline:le(),tags:G()})),jt=e=>(t,r)=>{let n=P(t,r,It(e));return n=N(n),n},Rt={title:"Line chart",description:"Ideal for illustrating changes and trends over time with line graphs.",namespace:"line_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this line chart?"},views:{type:"views",title:"View",description:""},field_y_axis:{type:"fieldCollector",title:"Metric - Y Axis",description:"What do you want each line to measure?",callToAction:"Add metric"},drilldown:{type:"drilldown",title:"Drilldown",description:"After clicking on a segment of this line chart, what information do you want to see next?"},field_x_axis:{type:"fieldCollector",title:"Grouping - X Axis",description:"What do you want each line to represent? An example might be a `product category` field to represent each category as a line.",callToAction:"Add grouping"},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this line chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this line chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{curve:{type:"curve",title:"Line Curve",description:"",namespace:"curve"},legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"}}},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""},headline:{type:"headline",title:"Headline",description:""},goal_line:{type:"goalLine",title:"Goal Lines",description:""}}},Dt=e=>({title:"Line chart",description:"Ideal for illustrating changes and trends over time with line graphs.",servicesClass:"LineChart",namespace:"line_chart",dump:e=>e,load:t=>{var r;return{type:t.type,measure:f(t.measure),order:p(t.order,t.timeDimension),dimension:x(t.dimension),timeDimension:t.timeDimension,displayTitle:t.displayTitle,displaySubject:t.displaySubject,protectedByOrganisation:t.protectedByOrganisation,viewId:pt(t.viewId),filter:d(t.filter),dataSetId:t.dataSetId,limit:t.limit,xAxisPostfix:t.xAxisPostfix,xAxisPrefix:t.xAxisPrefix,yAxisPostfix:t.yAxisPostfix,yAxisPrefix:t.yAxisPrefix,yAxisFormat:t.yAxisFormat,xAxisFormat:t.xAxisFormat,lineCurve:t.lineCurve,conditionalFormattingRules:bt(e.queryEngineConfig,t.conditionalFormattingRules),drilldown:t.drilldown,legend:t.legend,goalLines:t.goalLines,headline:xt(t.headline,t.timeDimension),parameters:m(t.parameters),approxXAxisLabelCount:h(t.approxXAxisLabelCount),approxYAxisLabelCount:h(t.approxYAxisLabelCount),axisTitles:t.axisTitles,tags:null!==(r=t.tags)&&void 0!==r?r:[]}},setAttributes:jt(e),validate:(t,r)=>ct(t,r,e.queryEngineConfig),init:(e,t)=>Object.assign({type:"lineChart",measure:[],dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",protectedByOrganisation:void 0,viewId:pt(null==t?void 0:t.viewId),filter:[],order:[],dataSetId:e,limit:5e3,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,lineCurve:"natural",conditionalFormattingRules:[],drilldown:[],legend:!0,goalLines:void 0,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",parameters:{},axisTitles:void 0,headline:void 0,tags:[]},t),createFeedback:dt,schema:It(e),removeField:(t,r)=>F(t,r,e.queryEngineConfig),isRunnable:e=>e.measure.length>0,autoGenerate(t){const{measure:r,dimension:n}=at(t,e.queryEngineConfig,"lineChart");return this.init(t.id,{measure:[r[0]],dimension:n})},dataPanelConfig:()=>[At(Rt,"data_set"),At(Rt,"views"),Object.assign(Object.assign({},At(Rt,"field_y_axis")),{fieldFilterOptions:{forComponent:"lineChart"},preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"}),Object.assign(Object.assign({},At(Rt,"field_x_axis")),{fieldFilterOptions:{forComponent:"lineChart",onlyDimensions:!0},preventDuplicates:!0,preSetPartialAttributes:(e,t)=>mt(e,t),getValues:e=>gt(e),maxAllowed:2,testId:"add-dimension"}),At(Rt,"sort"),At(Rt,"filter"),At(Rt,"custom_metrics"),At(Rt,"limit")],formatPanelConfig:()=>[Tt(Rt),Et(Rt,!0,!1),St(Rt),Object.assign(Object.assign({},At(Rt,"conditional_formatting")),{ruleType:"lineColor"}),At(Rt,"goal_line"),At(Rt,"headline")],supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0},supportedFeatures:{parameters:!0,colorGradient:!1},setDataAttributesFromPreAggregatedDataSet(e,t){return ht(e,t,this.setAttributes)}}),Ft=e=>L().object(Object.assign(Object.assign({},Q(e.attributesSchemaOptions)),{measure:L().array().items(U(e.queryEngineConfig.supportedAggregates,e.attributesSchemaOptions)),dimension:Y(e.queryEngineConfig.supportedTimeTruncFunctions,e.attributesSchemaOptions),filter:W(e.queryEngineConfig),timeDimension:L().valid(null),order:L().array().items(V(e.queryEngineConfig)),type:L().valid("pieChart").required(),legend:L().valid(!0,!1),limit:K(),labelsAsPercentage:L().boolean(),conditionalFormattingRules:de(e.queryEngineConfig),labelFormat:L().alternatives(L().string(),L().valid(null)),parameters:ae(e.queryEngineConfig,e.attributesSchemaOptions),tags:G()})),Nt={title:"Pie chart",description:"Represents data in a circular pie-like format, useful for showing proportions.",namespace:"pie_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this pie chart?"},views:{type:"views",title:"View",description:""},field_metrics:{type:"fieldCollector",title:"Metric",description:"What do you want each segment to measure?",callToAction:"Add metric"},field_grouping:{type:"fieldCollector",title:"Grouping",description:"How do you want to split each section of the pie chart?",callToAction:"Add comparison"},sort:{type:"sort",title:"Sort",description:"Choose the order of segments in the pie chart"},filter:{type:"filter",title:"Filters",description:"Only include the information you want in this pie chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Limit the number of segments shown on this pie chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{number_format:{type:"numberFormat",title:"Format",description:"",namespace:"number_format"},legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"}}},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""}}},Pt=e=>({title:Nt.title,description:Nt.description,servicesClass:"PieChart",namespace:Nt.namespace,dump:e=>e,load:t=>{var r;return{type:t.type,measure:f(t.measure),order:p(t.order,t.timeDimension),dimension:x(t.dimension),viewId:pt(t.viewId),timeDimension:t.timeDimension,displayTitle:t.displayTitle,displaySubject:t.displaySubject,protectedByOrganisation:t.protectedByOrganisation,filter:d(t.filter),dataSetId:t.dataSetId,limit:t.limit,conditionalFormattingRules:bt(e.queryEngineConfig,t.conditionalFormattingRules),labelsAsPercentage:t.labelsAsPercentage,legend:t.legend,labelFormat:t.labelFormat,parameters:m(t.parameters),tags:null!==(r=t.tags)&&void 0!==r?r:[]}},setAttributes:(t,r)=>P(t,r,Ft(e)),validate:(t,r)=>ct(t,r,e.queryEngineConfig),init:(e,t)=>Object.assign({type:"pieChart",measure:[],dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",protectedByOrganisation:void 0,viewId:pt(null==t?void 0:t.viewId),filter:[],order:[],dataSetId:e,limit:5e3,conditionalFormattingRules:[],labelsAsPercentage:!1,legend:!0,labelFormat:null,parameters:{},tags:[]},t),createFeedback:dt,schema:Ft(e),removeField:(t,r)=>F(t,r,e.queryEngineConfig),isRunnable:e=>e.measure.length>0,autoGenerate(t){const{measure:r,dimension:n}=at(t,e.queryEngineConfig,"pieChart");return this.init(t.id,{measure:[r[0]],dimension:n})},dataPanelConfig:()=>[At(Nt,"data_set"),At(Nt,"views"),Object.assign(Object.assign({},At(Nt,"field_metrics")),{fieldFilterOptions:{forComponent:"pieChart"},maxAllowed:1,preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"}),Object.assign(Object.assign({},At(Nt,"field_grouping")),{fieldFilterOptions:{onlyFieldTypes:["boolean","number","string"],onlyDimensions:!0,removePercentage:!0,removeSimpleMaths:!0,removeAggregateMaths:!0},maxAllowed:1,preSetPartialAttributes:e=>({dimension:e}),getValues:e=>e.dimension,testId:"add-dimension"}),At(Nt,"sort"),At(Nt,"filter"),At(Nt,"custom_metrics"),At(Nt,"limit")],formatPanelConfig:()=>{var e,t;return[Tt(Nt),Object.assign(Object.assign({},At(Nt,"conditional_formatting")),{ruleType:"backgroundColor"}),Object.assign(Object.assign({},At(Nt,"chart_styles")),{subSection:[null===(e=Nt.format_panel.chart_styles)||void 0===e?void 0:e.subSectionDefinition.legend,null===(t=Nt.format_panel.chart_styles)||void 0===t?void 0:t.subSectionDefinition.number_format]})]},supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0},supportedFeatures:{parameters:!0,colorGradient:!1}}),Mt=e=>L().object(Object.assign(Object.assign({},Q(e.attributesSchemaOptions)),{xMeasure:U(e.queryEngineConfig.supportedAggregates,e.attributesSchemaOptions).allow(null),yMeasure:U(e.queryEngineConfig.supportedAggregates,e.attributesSchemaOptions).allow(null),dimension:Y(e.queryEngineConfig.supportedTimeTruncFunctions,e.attributesSchemaOptions),order:L().array().items(V(e.queryEngineConfig)),limit:K(),legend:L().valid(!0,!1),offset:L().number().min(0),filter:W(e.queryEngineConfig),type:L().valid("scatterChart").required(),timeDimension:L().valid(null),xAxisPrefix:L().string().allow(""),yAxisPrefix:L().string().allow(""),xAxisPostfix:L().string().allow(""),yAxisPostfix:L().string().allow(""),yAxisFormat:L().alternatives(L().string(),L().valid(null)),xAxisFormat:L().alternatives(L().string(),L().valid(null)),approxYAxisLabelCount:Z,approxXAxisLabelCount:Z,goalLines:se(),axisTitles:ue(),tags:G()})),Lt=e=>(t,r)=>{let n=P(t,r,Mt(e)),i=[];return n.xMeasure&&i.push(n.xMeasure),n.yMeasure&&i.push(n.yMeasure),n.dimension.forEach((e=>{i.push({field:e.field,function:e.function})})),n=D(n,i),n},kt={title:"Scatter chart",description:"Displays data points on a Cartesian plane, perfect for showing correlations.",namespace:"scatter_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this scatter chart?"},views:{type:"views",title:"View",description:""},labelled_metrics:{type:"labelledMetrics",title:"Metric - Y Axis",description:"",subSectionDefinition:{xAxis:{type:"metrics",title:"X axis",namespace:"metrics.xAxis"},yAxis:{type:"metrics",title:"Y axis",namespace:"metrics.yAxis"}}},field_grouping:{type:"fieldCollector",title:"Grouping",description:"What do you want each dot to represent?",callToAction:"Add comparison"},filter:{type:"filter",title:"Filters",description:"Only include the information you want in this scatter chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Limit the number of data points shown on this scatter chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"}}},goal_line:{type:"goalLine",title:"Goal Lines",description:""}}},qt=e=>({title:kt.title,description:kt.description,servicesClass:"ScatterChart",namespace:kt.namespace,dump:e=>e,load:e=>{var t;return{type:e.type,xMeasure:f(e.xMeasure?[e.xMeasure]:[])[0]||null,yMeasure:f(e.yMeasure?[e.yMeasure]:[])[0]||null,dimension:x(e.dimension),viewId:pt(e.viewId),timeDimension:e.timeDimension,displayTitle:e.displayTitle,displaySubject:e.displaySubject,protectedByOrganisation:e.protectedByOrganisation,filter:d(e.filter),order:p(e.order,e.timeDimension),dataSetId:e.dataSetId,limit:e.limit,legend:e.legend,xAxisFormat:e.xAxisFormat,yAxisFormat:e.yAxisFormat,yAxisPostfix:e.yAxisPostfix,yAxisPrefix:e.yAxisPrefix,xAxisPostfix:e.xAxisPostfix,xAxisPrefix:e.xAxisPrefix,approxXAxisLabelCount:h(e.approxXAxisLabelCount),approxYAxisLabelCount:h(e.approxYAxisLabelCount),goalLines:e.goalLines,axisTitles:e.axisTitles,tags:null!==(t=e.tags)&&void 0!==t?t:[]}},setAttributes:Lt(e),validate:(t,r)=>ct(t,r,e.queryEngineConfig),init:(e,t)=>Object.assign({type:"scatterChart",xMeasure:null,yMeasure:null,dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",protectedByOrganisation:void 0,viewId:pt(null==t?void 0:t.viewId),filter:[],order:[],dataSetId:e,limit:5e3,legend:!0,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",goalLines:void 0,axisTitles:void 0,tags:[]},t),createFeedback:dt,schema:Mt(e),removeField:(t,r)=>F(t,r,e.queryEngineConfig),isRunnable:e=>!!e.xMeasure&&!!e.yMeasure&&e.dimension.length>0,autoGenerate(t){const{measure:r,dimension:n}=at(t,e.queryEngineConfig,"scatterChart");return this.init(t.id,{xMeasure:r[0],yMeasure:r[1],dimension:n})},dataPanelConfig:()=>{var e,t;return[At(kt,"data_set"),At(kt,"views"),Object.assign(Object.assign({},At(kt,"labelled_metrics")),{subSection:[Object.assign(Object.assign({},null===(e=kt.data_panel.labelled_metrics)||void 0===e?void 0:e.subSectionDefinition.xAxis),{propKey:"xMeasure",allowsMultiple:!1}),Object.assign(Object.assign({},null===(t=kt.data_panel.labelled_metrics)||void 0===t?void 0:t.subSectionDefinition.yAxis),{propKey:"yMeasure",allowsMultiple:!1})]}),Object.assign(Object.assign({},At(kt,"field_grouping")),{fieldFilterOptions:{onlyDimensions:!0,onlyFieldTypes:["boolean","number","string"],removePercentage:!0,removeSimpleMaths:!0,removeAggregateMaths:!0},maxAllowed:1,preSetPartialAttributes:e=>({dimension:e}),getValues:e=>e.dimension,testId:"add-dimension"}),At(kt,"filter"),At(kt,"custom_metrics"),At(kt,"limit")]},formatPanelConfig:()=>{var e;return[Tt(kt),Object.assign(Object.assign({},At(kt,"chart_styles")),{subSection:[null===(e=kt.format_panel.chart_styles)||void 0===e?void 0:e.subSectionDefinition.legend]}),St(kt),At(kt,"goal_line")]},supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0},supportedFeatures:{parameters:!1,colorGradient:!1}}),$t=e=>L().object(Object.assign(Object.assign({},Q(e.attributesSchemaOptions)),{stacked:L().valid(!0,!1,"100%"),legend:L().valid(!0,!1),barMeasure:L().array().items(U(e.queryEngineConfig.supportedAggregates,e.attributesSchemaOptions)),lineMeasure:L().array().items(U(e.queryEngineConfig.supportedAggregates,e.attributesSchemaOptions)),barDimension:Y(e.queryEngineConfig.supportedTimeTruncFunctions,e.attributesSchemaOptions),lineDimension:Y(e.queryEngineConfig.supportedTimeTruncFunctions,e.attributesSchemaOptions),order:L().array().items(V(e.queryEngineConfig)),timeDimension:L().alternatives(H(e.queryEngineConfig.supportedTimeTruncFunctions),L().valid(null)),limit:K(),offset:L().number().min(0),filter:W(e.queryEngineConfig),type:L().valid("comboChart").required(),xAxisPrefix:L().string().allow(""),yAxisPrefix:L().string().allow(""),xAxisPostfix:L().string().allow(""),yAxisPostfix:L().string().allow(""),yAxisFormat:L().alternatives(L().string(),L().valid(null)),xAxisFormat:L().alternatives(L().string(),L().valid(null)),approxYAxisLabelCount:Z,approxXAxisLabelCount:Z,goalLines:se(),conditionalFormattingRules:L().object({bar:L().array().items(k(e.queryEngineConfig)),line:L().array().items(k(e.queryEngineConfig))}),axisTitles:ue(),tags:G()})),zt=e=>(t,r)=>{let n=P(t,r,$t(e)),i=[...n.lineMeasure,...n.barMeasure];return[...n.lineDimension,...n.barDimension].forEach((e=>{i.push({field:e.field,function:e.function})})),n.timeDimension&&i.push({field:n.timeDimension.field,function:n.timeDimension.truncate}),n=D(n,i),n},Bt={title:"Combo chart",description:"A versatile component that combines different chart types.",namespace:"combo_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this combo chart?"},views:{type:"views",title:"View",description:""},labelled_metrics:{type:"labelledMetrics",title:"Metric - Y Axis",description:"What do you want each line and bar to measure?",subSectionDefinition:{line:{type:"metrics",title:"Line",namespace:"metrics.line"},bar:{type:"metrics",title:"Bar",namespace:"metrics.bar"}}},combo_chart_dimension:{type:"comboChartDimension",title:"Grouping - X Axis",description:""},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this combo chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this bar chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{stacked:{type:"stacked",title:"Layout",description:"",namespace:"stacked"},legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"}}},goal_line:{type:"goalLine",title:"Goal Lines",description:""},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:"",subSectionDefinition:{bar:{title:"Bar",namespace:"bar"},line:{title:"Line",namespace:"line"}}}}},Gt=e=>({title:Bt.title,description:Bt.description,servicesClass:"ComboChart",namespace:Bt.namespace,dump:e=>e,load:t=>{return r=t,n=e.queryEngineConfig,Object.assign(Object.assign({},r),{lineMeasure:f(r.lineMeasure),barMeasure:f(r.barMeasure),order:p(r.order,r.timeDimension||null),filter:d(r.filter),lineDimension:x(r.lineDimension||r.dimension||[]),barDimension:x(r.barDimension||r.dimension||[]),viewId:pt(r.viewId),approxXAxisLabelCount:h(r.approxXAxisLabelCount),approxYAxisLabelCount:h(r.approxYAxisLabelCount),conditionalFormattingRules:{bar:bt(n,null===(i=r.conditionalFormattingRules)||void 0===i?void 0:i.bar),line:bt(n,null===(o=r.conditionalFormattingRules)||void 0===o?void 0:o.line)},tags:null!==(a=r.tags)&&void 0!==a?a:[]});var r,n,i,o,a},setAttributes:zt(e),validate:(t,r)=>ct(t,r,e.queryEngineConfig),init:(e,t)=>Object.assign({type:"comboChart",barMeasure:[],lineMeasure:[],lineDimension:[],barDimension:[],timeDimension:null,displayTitle:"",displaySubject:"",viewId:pt(null==t?void 0:t.viewId),filter:[],order:[],dataSetId:e,limit:5e3,xAxisPostfix:"",protectedByOrganisation:void 0,xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,legend:!0,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",goalLines:void 0,conditionalFormattingRules:void 0,axisTitles:void 0,tags:[]},t),createFeedback:dt,schema:$t(e),removeField:(t,r)=>F(t,r,e.queryEngineConfig),isRunnable:e=>e.lineMeasure.length>0||e.barMeasure.length>0,autoGenerate(t){const{measure:r,dimension:n}=at(t,e.queryEngineConfig,"comboChart");return this.init(t.id,{barMeasure:[r[0]],lineMeasure:[r[1]||r[0]],barDimension:n,lineDimension:n})},dataPanelConfig:()=>{var e,t;return[At(Bt,"data_set"),At(Bt,"views"),Object.assign(Object.assign({},At(Bt,"labelled_metrics")),{subSection:[Object.assign(Object.assign({},null===(e=Bt.data_panel.labelled_metrics)||void 0===e?void 0:e.subSectionDefinition.line),{propKey:"lineMeasure",allowsMultiple:!0}),Object.assign(Object.assign({},null===(t=Bt.data_panel.labelled_metrics)||void 0===t?void 0:t.subSectionDefinition.bar),{propKey:"barMeasure",allowsMultiple:!0})]}),At(Bt,"combo_chart_dimension"),At(Bt,"sort"),At(Bt,"filter"),At(Bt,"custom_metrics"),At(Bt,"limit")]},formatPanelConfig:()=>{var e,t,r,n,i,o,a,s,l,u;return[Tt(Bt),Et(Bt,!1,!0),St(Bt),Object.assign(Object.assign({},At(Bt,"conditional_formatting")),{ruleType:"backgroundColor",subSection:[{title:null!==(r=null===(t=null===(e=Bt.format_panel.conditional_formatting)||void 0===e?void 0:e.subSectionDefinition)||void 0===t?void 0:t.bar.title)&&void 0!==r?r:"",namespace:null===(i=null===(n=Bt.format_panel.conditional_formatting)||void 0===n?void 0:n.subSectionDefinition)||void 0===i?void 0:i.bar.namespace,propKey:"bar"},{title:null!==(s=null===(a=null===(o=Bt.format_panel.conditional_formatting)||void 0===o?void 0:o.subSectionDefinition)||void 0===a?void 0:a.line.title)&&void 0!==s?s:"",namespace:null===(u=null===(l=Bt.format_panel.conditional_formatting)||void 0===l?void 0:l.subSectionDefinition)||void 0===u?void 0:u.line.namespace,propKey:"line"}]}),At(Bt,"goal_line")]},supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0},supportedFeatures:{parameters:!1,colorGradient:!1}}),Ut=e=>L().object(Object.assign(Object.assign({},Q(e.attributesSchemaOptions)),{type:L().valid("dataTable").required(),measure:L().array().items(U(e.queryEngineConfig.supportedAggregates,e.attributesSchemaOptions)).required(),dimension:Y(e.queryEngineConfig.supportedTimeTruncFunctions,e.attributesSchemaOptions).required(),order:L().array().items(V(e.queryEngineConfig)),timeDimension:L().alternatives(H(e.queryEngineConfig.supportedTimeTruncFunctions),L().valid(null)),limit:K().required(),offset:L().number().min(0),filter:W(e.queryEngineConfig),prefixes:L().array().items(q),exportNames:L().object(),numberFormat:L().object(),conditionalFormattingRules:de(e.queryEngineConfig),dateTimeFormat:L().string(),protectedFields:L().object({dimension:ne(e.queryEngineConfig),measure:re(e.queryEngineConfig)}).unknown(!0),sizing:ce,tags:G(),tableDrilldown:L().array().items(L().object({subsetDimension:L().string().required().description("The ID of the field in the data set to drill down by.")})).description("Drilldown configuration for a pivot table.")})),Vt=e=>(t,r)=>{let n=P(t,r,Ut(e));return n=N(n),n},Ht={title:"Pivot table",description:"Transforms data into a table with dynamic rows and columns.",namespace:"pivot_table",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this data table?"},views:{type:"views",title:"View",description:""},field_columns:{type:"fieldCollector",title:"Group columns",callToAction:"Add group column",description:""},field_rows:{type:"fieldCollector",title:"Group rows",description:"Which field do you want to group each row by? An example might be an employee ID or geographical location",callToAction:"Add group row"},drilldown:{type:"drilldown",title:"Drilldown",description:"Drilldowns in a pivot table reveals underlying data contributing to summarized figures upon clicking."},field_metrics:{type:"fieldCollector",title:"Metrics",description:"Select the columns to show in the data table",callToAction:"Add metric"},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this data table."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},pagination:{type:"pagination",title:"Pagination",description:"Define the size for each page in the table"}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},format:{type:"format",title:"Format",description:"",subSectionDefinition:{time:{type:"time",title:"Time",description:"",namespace:"time"}}},prefixes:{type:"prefixes",title:"Prefixes",description:""},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""}}},Yt=[3,5,10,20,50,100,200],Xt=(e,t)=>e.filter((e=>e.pivot==t)),Wt=e=>({title:Ht.title,description:Ht.description,servicesClass:"PivotTable",namespace:Ht.namespace,dump:e=>e,load:t=>{var r,n,i;return{type:t.type,measure:f(t.measure),order:p(t.order,t.timeDimension||null),displayTitle:t.displayTitle,dimension:(i=gt({timeDimension:t.timeDimension,dimension:x(t.dimension)}),i.map((e=>Object.assign(Object.assign({},e),{pivot:e.pivot?e.pivot:"x"})))),displaySubject:t.displaySubject,protectedByOrganisation:t.protectedByOrganisation,protectedFields:yt(t.protectedFields),viewId:pt(t.viewId),filter:d(t.filter),dataSetId:t.dataSetId,limit:t.limit,offset:t.offset,conditionalFormattingRules:bt(e.queryEngineConfig,t.conditionalFormattingRules),dateTimeFormat:t.dateTimeFormat,prefixes:t.prefixes,exportNames:t.exportNames,numberFormat:t.numberFormat,sizing:t.sizing,tableDrilldown:(n=t.tableDrilldown,n&&n.length>0?n.map(ft):n||[]),tags:null!==(r=t.tags)&&void 0!==r?r:[]}},setAttributes:Vt(e),validate:(t,r)=>ct(t,r,e.queryEngineConfig),init:(e,t)=>Object.assign({type:"dataTable",measure:[],displayTitle:"",dimension:[],protectedByOrganisation:void 0,displaySubject:"",viewId:pt(null==t?void 0:t.viewId),filter:[],order:[],dataSetId:e,limit:50,offset:0,conditionalFormattingRules:[],protectedFields:void 0,prefixes:[],dateTimeFormat:"DD MMMM YYYY, hh:mm",exportNames:{},numberFormat:{},sizing:{},tableDrilldown:[],tags:[]},t),schema:Ut(e),removeField:(t,r)=>F(t,r,e.queryEngineConfig),isRunnable:e=>e.measure.length>0,autoGenerate(t){const{measure:r,dimension:n}=at(t,e.queryEngineConfig,"dataTable");return this.init(t.id,{measure:r.slice(0,5),dimension:n})},dataPanelConfig:()=>[At(Ht,"data_set"),At(Ht,"views"),Object.assign(Object.assign({},At(Ht,"field_columns")),{fieldFilterOptions:{onlyFieldTypes:["boolean","number","string","date_time"],onlyDimensions:!0,removePercentage:!0,removeSimpleMaths:!0,removeAggregateMaths:!0},preventDuplicates:!0,preSetPartialAttributes:(e,t,r)=>({dimension:[...e.map((e=>Object.assign(Object.assign({},e),{pivot:"y"}))),...Xt(r.dimension,"x")]}),getValues:e=>Xt(e.dimension,"y"),testId:"add-pivot-dimension"}),Object.assign(Object.assign({},At(Ht,"field_rows")),{fieldFilterOptions:{onlyFieldTypes:["boolean","number","string","date_time"],onlyDimensions:!0,removePercentage:!0,removeSimpleMaths:!0,removeAggregateMaths:!0},preventDuplicates:!0,preSetPartialAttributes:(e,t,r)=>({dimension:[...e.map((e=>Object.assign(Object.assign({},e),{pivot:"x"}))),...Xt(r.dimension,"y")]}),getValues:e=>Xt(e.dimension,"x"),testId:"add-dimension"}),At(Ht,"drilldown"),Object.assign(Object.assign({},At(Ht,"field_metrics")),{fieldFilterOptions:{forComponent:"dataTable"},preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"}),At(Ht,"sort"),Object.assign(Object.assign({},At(Ht,"pagination")),{options:Yt}),At(Ht,"filter"),At(Ht,"custom_metrics")],formatPanelConfig:()=>{var e;return[Tt(Ht),Object.assign(Object.assign({},At(Ht,"format")),{subSection:[null===(e=Ht.format_panel.format)||void 0===e?void 0:e.subSectionDefinition.time]}),At(Ht,"prefixes"),Object.assign(Object.assign({},At(Ht,"conditional_formatting")),{ruleType:"backgroundColor"})]},supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0},supportedFeatures:{parameters:!1,colorGradient:!0}}),Kt=L().object({field:L().string().required(),function:L().valid("none").required()}),Qt=e=>L().object(Object.assign(Object.assign({},Q(e.attributesSchemaOptions)),{type:L().valid("basicTable").required(),measure:L().array().items(Kt).required(),dimension:L().array().max(0),order:L().array().items(V(e.queryEngineConfig)),timeDimension:L().valid(null),limit:K().required(),offset:L().number().min(0),filter:W(e.queryEngineConfig),prefixes:L().array().items(q),exportNames:L().object(),numberFormat:L().object(),conditionalFormattingRules:de(e.queryEngineConfig),dateTimeFormat:L().string(),protectedFields:L().object({measure:re(e.queryEngineConfig)}).unknown(!0),sizing:ce,tags:G()})),Zt=e=>(t,r)=>{let n=P(t,r,Qt(e));return n=D(n,[...n.measure]),n},Jt={title:"Basic table",description:"Displays data in a simple, straightforward table format.",namespace:"basic_table",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this basic table?"},views:{type:"views",title:"View",description:""},fields:{type:"fields",title:"Columns",description:"Select which values you want to see in this table"},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this basic table."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},pagination:{type:"pagination",title:"Pagination",description:"Define the size for each page in the table"}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{type:"subject",title:"Subject",description:"",namespace:"subject"}}},format:{type:"format",title:"Format",description:"",subSectionDefinition:{time:{type:"time",title:"Time",description:"",namespace:"time"}}},prefixes:{type:"prefixes",title:"Prefixes",description:""},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""}}},er=e=>({title:Jt.title,description:Jt.description,servicesClass:"BasicTable",namespace:Jt.namespace,dump:e=>({type:e.type,measure:e.measure,displayTitle:e.displayTitle,dimension:e.dimension,timeDimension:e.timeDimension,displaySubject:e.displaySubject,protectedFields:e.protectedFields,filter:e.filter,order:e.order,dataSetId:e.dataSetId,viewId:null==e?void 0:e.viewId,limit:e.limit,offset:e.offset,conditionalFormattingRules:e.conditionalFormattingRules,protectedByOrganisation:e.protectedByOrganisation,dateTimeFormat:e.dateTimeFormat,prefixes:e.prefixes,exportNames:e.exportNames,numberFormat:e.numberFormat,sizing:e.sizing,tags:e.tags}),load:t=>{var r;return Object.assign(Object.assign({},t),{measure:f(t.measure),order:p(t.order,t.timeDimension),filter:d(t.filter),dimension:x(t.dimension),viewId:pt(t.viewId),protectedFields:yt(t.protectedFields),conditionalFormattingRules:bt(e.queryEngineConfig,t.conditionalFormattingRules),tags:null!==(r=t.tags)&&void 0!==r?r:[]})},setAttributes:Zt(e),validate:(t,r)=>ct(t,r,e.queryEngineConfig),init:function(t,r){const n={type:"basicTable",measure:[],displayTitle:"",dimension:[],timeDimension:null,displaySubject:"",filter:[],order:[],tags:[],dataSetId:t,viewId:pt(null==r?void 0:r.viewId),protectedFields:void 0,limit:50,offset:0,conditionalFormattingRules:[],prefixes:[],dateTimeFormat:"DD MMMM YYYY, hh:mm",exportNames:{},numberFormat:{},sizing:{}};return Zt(e)(n,r||{})},schema:Qt(e),removeField:(t,r)=>F(t,r,e.queryEngineConfig),setFields:function(t,r){const n=[...r].map((e=>({field:e,function:"none"})));return Zt(e)(t,{measure:n})},setDateTimeFormat:function(e,t){return this.setAttributes(e,{dateTimeFormat:t})},isRunnable:e=>e.measure.length>0,autoGenerate(e){const t=[...et(e.fields,{forComponent:"basicTable",onlyMeasures:!0,removeAggregateMaths:!0,removePercentage:!0})].map((e=>({field:e.id,function:"none"})));return this.init(e.id,{measure:t.slice(0,5)})},dataPanelConfig:()=>[At(Jt,"data_set"),At(Jt,"views"),At(Jt,"fields"),At(Jt,"sort"),Object.assign(Object.assign({},At(Jt,"pagination")),{options:Yt}),At(Jt,"filter"),At(Jt,"custom_metrics")],formatPanelConfig:()=>{var e;return[Tt(Jt),Object.assign(Object.assign({},At(Jt,"format")),{subSection:[null===(e=Jt.format_panel.format)||void 0===e?void 0:e.subSectionDefinition.time]}),At(Jt,"prefixes"),Object.assign(Object.assign({},At(Jt,"conditional_formatting")),{ruleType:"backgroundColor"})]},supportedCustomFields:{percentages:!1,simpleMaths:!0,rules:!0,aggregateMaths:!1,roundedNumbers:!0,dateCalculations:!1,conditional:!0},supportedFeatures:{parameters:!1,colorGradient:!0}}),tr=e=>(t,r)=>{let n=P(t,r,pe(e));return n=N(n),n},rr={title:"Horizontal bar chart",description:"Similar to a BarChart but with horizontal bars.",namespace:"horizontal_bar_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this bar chart?"},views:{type:"views",title:"View",description:""},field_y_axis:{type:"fieldCollector",title:"Metric - Y Axis",description:"What do you want each bar to measure?",callToAction:"Add metric"},drilldown:{type:"drilldown",title:"Drilldown",description:"After clicking on a segment of this bar chart, what information do you want to see next?"},field_x_axis:{type:"fieldCollector",title:"Grouping - X Axis",description:"What do you want each bar to represent? An example might be a `product category` field to represent each category as a bar.",callToAction:"Add grouping"},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this bar chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this bar chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{stacked:{type:"stacked",title:"Layout",description:"",namespace:"stacked"},legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"}}},headline:{type:"headline",title:"Headline",description:""},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""}}},nr=e=>({title:rr.title,description:rr.description,servicesClass:"HorizontalBarChart",namespace:rr.namespace,dump:e=>e,load:e=>{var t;return Object.assign(Object.assign({},e),{measure:f(e.measure),order:p(e.order,e.timeDimension),dimension:x(e.dimension),viewId:pt(e.viewId),filter:d(e.filter),approxXAxisLabelCount:h(e.approxXAxisLabelCount),approxYAxisLabelCount:h(e.approxYAxisLabelCount),protectedFields:yt(e.protectedFields),tags:null!==(t=e.tags)&&void 0!==t?t:[]})},setAttributes:tr(e),validate:(t,r)=>ct(t,r,e.queryEngineConfig),init:(e,t)=>Object.assign({type:"horizontalBarChart",measure:[],dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",viewId:pt(null==t?void 0:t.viewId),filter:[],order:[],dataSetId:e,limit:5e3,conditionalFormattingRules:[],protectedByOrganisation:void 0,protectedFields:void 0,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,legend:!0,drilldown:[],approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",axisTitles:void 0,tags:[]},t),createFeedback:dt,schema:pe(e),removeField:(t,r)=>F(t,r,e.queryEngineConfig),isRunnable:e=>e.measure.length>0,autoGenerate(t){const{measure:r,dimension:n}=at(t,e.queryEngineConfig,"horizontalBarChart");return this.init(t.id,{measure:[r[0]],dimension:n})},dataPanelConfig:()=>[At(rr,"data_set"),At(rr,"views"),Object.assign(Object.assign({},At(rr,"field_y_axis")),{fieldFilterOptions:{forComponent:"horizontalBarChart"},preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"}),At(rr,"drilldown"),Object.assign(Object.assign({},At(rr,"field_x_axis")),{fieldFilterOptions:{forComponent:"horizontalBarChart",onlyDimensions:!0},preventDuplicates:!0,preSetPartialAttributes:(e,t)=>mt(e,t),getValues:e=>gt(e),maxAllowed:2,testId:"add-dimension"}),At(rr,"sort"),At(rr,"filter"),At(rr,"custom_metrics"),At(rr,"limit")],formatPanelConfig:()=>[Tt(rr),Et(rr,!1,!0),St(rr),Object.assign(Object.assign({},At(rr,"conditional_formatting")),{ruleType:"backgroundColor"}),At(rr,"headline")],supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0},supportedFeatures:{parameters:!0,colorGradient:!1},setDataAttributesFromPreAggregatedDataSet(e,t){return ht(e,t,this.setAttributes)}}),ir=e=>L().object(Object.assign(Object.assign(Object.assign({},Q(e.attributesSchemaOptions)),ee(e.queryEngineConfig,e.attributesSchemaOptions)),{stacked:L().valid(!0,!1,"100%"),legend:L().valid(!0,!1),type:L().valid("areaChart").required(),lineCurve:te,conditionalFormattingRules:de(e.queryEngineConfig),parameters:ae(e.queryEngineConfig,e.attributesSchemaOptions),goalLines:se(),axisTitles:ue(),headline:le(),tags:G()})),or=e=>(t,r)=>{let n=P(t,r,ir(e));return n=N(n),n},ar={title:"Area chart",description:"Displays data as areas on a chart, useful for showing trends over time.",namespace:"area_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this area chart?"},views:{type:"views",title:"View",description:""},field_y_axis:{type:"fieldCollector",title:"Metric - Y Axis",description:"What do you want each area to measure?",callToAction:"Add metric"},field_x_axis:{type:"fieldCollector",title:"Grouping - X Axis",description:"What do you want each area to represent? An example might be an employee ID to represent each employee.",callToAction:"Add grouping"},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this area chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this area chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{stacked:{type:"stacked",title:"Layout",description:"",namespace:"stacked"},legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"},curve:{type:"curve",title:"Line Curve",description:"",namespace:"curve"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"}}},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""},headline:{type:"headline",title:"Headline",description:""},goal_line:{type:"goalLine",title:"Goal Lines",description:""}}},sr=e=>({title:ar.title,description:ar.description,servicesClass:"AreaChart",namespace:ar.namespace,dump:e=>e,load:t=>{var r;return{type:t.type,measure:f(t.measure),displayTitle:t.displayTitle,dimension:x(t.dimension),timeDimension:t.timeDimension,displaySubject:t.displaySubject,viewId:pt(t.viewId),filter:d(t.filter),order:p(t.order,t.timeDimension),dataSetId:t.dataSetId,limit:t.limit,offset:t.offset,xAxisPostfix:t.xAxisPostfix,xAxisPrefix:t.xAxisPrefix,yAxisPostfix:t.yAxisPostfix,yAxisPrefix:t.yAxisPrefix,lineCurve:t.lineCurve,conditionalFormattingRules:bt(e.queryEngineConfig,t.conditionalFormattingRules),protectedByOrganisation:t.protectedByOrganisation,stacked:t.stacked,drilldown:t.drilldown,legend:t.legend,yAxisFormat:t.yAxisFormat,xAxisFormat:t.xAxisFormat,goalLines:t.goalLines,parameters:m(t.parameters),approxXAxisLabelCount:h(t.approxXAxisLabelCount),approxYAxisLabelCount:h(t.approxYAxisLabelCount),headline:xt(t.headline,t.timeDimension),tags:null!==(r=t.tags)&&void 0!==r?r:[]}},setAttributes:or(e),validate:(t,r)=>ct(t,r,e.queryEngineConfig),init:(e,t)=>Object.assign({type:"areaChart",measure:[],displayTitle:"",dimension:[],timeDimension:null,displaySubject:"",viewId:pt(null==t?void 0:t.viewId),filter:[],order:[],dataSetId:e,limit:5e3,offset:0,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,lineCurve:"natural",conditionalFormattingRules:[],drilldown:[],legend:!0,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",parameters:{},goalLines:void 0,axisTitles:void 0,headline:void 0,tags:[]},t),createFeedback:dt,schema:ir(e),removeField:(t,r)=>F(t,r,e.queryEngineConfig),isRunnable:e=>e.measure.length>0,autoGenerate(t){const{measure:r,dimension:n}=at(t,e.queryEngineConfig,"areaChart");return this.init(t.id,{measure:[r[0]],dimension:n})},dataPanelConfig:()=>[At(ar,"data_set"),At(ar,"views"),Object.assign(Object.assign({},At(ar,"field_y_axis")),{fieldFilterOptions:{forComponent:"areaChart"},preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"}),Object.assign(Object.assign({},At(ar,"field_x_axis")),{fieldFilterOptions:{forComponent:"areaChart",onlyDimensions:!0},preventDuplicates:!0,preSetPartialAttributes:(e,t)=>mt(e,t),getValues:e=>gt(e),maxAllowed:2,testId:"add-dimension"}),At(ar,"sort"),At(ar,"filter"),At(ar,"custom_metrics"),At(ar,"limit")],formatPanelConfig:()=>{var e,t,r;return[Tt(ar),Object.assign(Object.assign({},At(ar,"chart_styles")),{subSection:[null===(e=ar.format_panel.chart_styles)||void 0===e?void 0:e.subSectionDefinition.stacked,null===(t=ar.format_panel.chart_styles)||void 0===t?void 0:t.subSectionDefinition.legend,null===(r=ar.format_panel.chart_styles)||void 0===r?void 0:r.subSectionDefinition.curve]}),St(ar),Object.assign(Object.assign({},At(ar,"conditional_formatting")),{ruleType:"areaColor"}),At(ar,"goal_line"),At(ar,"headline")]},supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0},supportedFeatures:{parameters:!0,colorGradient:!1}}),lr=e=>L().object(Object.assign(Object.assign({},Q(e.attributesSchemaOptions)),{fontSize:L().string().allow(""),formatter:L().object(),measure:L().array().items(U(e.queryEngineConfig.supportedAggregates,e.attributesSchemaOptions)),filter:W(e.queryEngineConfig),prefixes:L().object(),postfixes:L().object(),type:L().valid("singleStat").required(),limit:K(),conditionalFormattingRules:de(e.queryEngineConfig),deltaTimeDimension:L().alternatives(H(e.queryEngineConfig.supportedTimeTruncFunctions),L().valid(null)),parameters:ae(e.queryEngineConfig,e.attributesSchemaOptions),tags:G()})),ur=e=>{if("singleMeasure"in e){let t={},r={},n=[],i={};return e.singleMeasure&&(n=[e.singleMeasure],t[I(e.singleMeasure)]=e.prefix,r[I(e.singleMeasure)]=e.postfix,i[I(e.singleMeasure)]=e.formatter),{type:"singleStat",prefixes:t,postfixes:r,measure:n,formatter:i,fontSize:e.fontSize,displayTitle:e.displayTitle,displaySubject:e.displaySubject,tags:e.tags,filter:d(e.filter),dataSetId:e.dataSetId,limit:e.limit,conditionalFormattingRules:e.conditionalFormattingRules,deltaTimeDimension:e.deltaTimeDimension,parameters:m(e.parameters)}}return Object.assign(Object.assign({},e),{filter:d(e.filter)})},cr={title:"Single stat",description:"Shows a single statistical value, ideal for key data point representation.",namespace:"single_stat",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this single stat?"},views:{type:"views",title:"View",description:""},field_metrics:{type:"fieldCollector",title:"Metrics",description:"What do you want to show?",callToAction:"Add metric"},filter:{type:"filter",title:"Filters",description:"Only include the information you want in this scatter chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},comparison:{type:"comparison",title:"Comparison",description:""}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},stats_labels:{type:"statsLabels",title:"Labels",description:"",subSectionDefinition:{prefix:{title:"Prefix",description:"",namespace:"prefix"},postfix:{title:"Postfix",description:"",namespace:"postfix"},format:{title:"Format",description:"",namespace:"format"},count:{title:"Label count",description:"",namespace:"count"}}},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""},format:{type:"format",title:"Format",description:"",subSectionDefinition:{font_size:{title:"Font Size",type:"fontSize",description:"",namespace:"font_size"}}}}},dr=e=>({title:cr.title,description:cr.description,servicesClass:"SingleStat",namespace:cr.namespace,dump:e=>e,load:e=>{var t;const r=ur(e);return{type:"singleStat",prefixes:r.prefixes,postfixes:r.postfixes,formatter:r.formatter,fontSize:r.fontSize,measure:f(r.measure),displayTitle:r.displayTitle,displaySubject:r.displaySubject,protectedByOrganisation:e.protectedByOrganisation,viewId:pt(e.viewId),filter:r.filter,dataSetId:r.dataSetId,limit:r.limit,conditionalFormattingRules:r.conditionalFormattingRules,deltaTimeDimension:r.deltaTimeDimension,parameters:m(r.parameters),tags:null!==(t=r.tags)&&void 0!==t?t:[]}},setAttributes:(t,r)=>P(t,r,lr(e)),validate:(t,r)=>ct(t,r,e.queryEngineConfig),init:(e,t)=>Object.assign({type:"singleStat",measure:[],displayTitle:"",postfixes:{},prefixes:{},formatter:{},fontSize:"2rem",protectedByOrganisation:void 0,displaySubject:"",viewId:pt(null==t?void 0:t.viewId),filter:[],dataSetId:e,limit:5e3,conditionalFormattingRules:[],deltaTimeDimension:null,parameters:{},tags:[]},t),schema:lr(e),removeField:(t,r)=>F(t,r,e.queryEngineConfig),isRunnable:e=>e.measure.length>0,autoGenerate(t){const{measure:r}=at(t,e.queryEngineConfig,"singleStat");return this.init(t.id,{measure:[r[0]]})},dataPanelConfig:()=>[At(cr,"data_set"),At(cr,"views"),Object.assign(Object.assign({},At(cr,"field_metrics")),{fieldFilterOptions:{forComponent:"singleStat"},preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"}),At(cr,"filter"),At(cr,"custom_metrics"),At(cr,"comparison")],formatPanelConfig:()=>{var e;return[Tt(cr),Object.assign(Object.assign({},At(cr,"stats_labels")),{prefix:Ot(cr,"prefix"),postfix:Ot(cr,"postfix"),format:Ot(cr,"format"),count:Ot(cr,"count")}),Object.assign(Object.assign({},At(cr,"format")),{subSection:[null===(e=cr.format_panel.format)||void 0===e?void 0:e.subSectionDefinition.font_size]}),Object.assign(Object.assign({},At(cr,"conditional_formatting")),{ruleType:"fontColor"})]},supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,aggregateMaths:!0,rules:!0,roundedNumbers:!0,conditional:!0},supportedFeatures:{parameters:!0,colorGradient:!1},setDataAttributesFromPreAggregatedDataSet(e,r){let n=(0,t.cloneDeep)(et(r.fields,{onlyFieldTypes:["number"]}));return Object.assign(Object.assign({},e),{type:"singleStat",protectedByOrganisation:!0,measure:[...n].map((e=>({function:"none",field:e.id})))})}}),pr=e=>L().object(Object.assign(Object.assign({},Q(e.attributesSchemaOptions)),{type:L().valid("custom").required(),customComponentId:L().string().required(),tags:G()})),fr={title:"Progress",description:"Used to show progress towards goals, completion of tasks, or as indicators of performance metrics.",namespace:"progress",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this progress?"},views:{type:"views",title:"View",description:""}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}}}},hr=e=>({title:fr.title,description:fr.description,namespace:fr.namespace,servicesClass:"Custom",dump:e=>e,load:e=>{var t;return{type:"custom",viewId:pt(e.viewId),customComponentId:e.customComponentId,displayTitle:e.displayTitle,displaySubject:e.displaySubject,dataSetId:e.dataSetId,tags:null!==(t=e.tags)&&void 0!==t?t:[],protectedByOrganisation:e.protectedByOrganisation}},setAttributes:(t,r)=>P(t,r,pr(e)),validate:(t,r)=>ct(t,r,e.queryEngineConfig),init:(e,t)=>({type:"custom",viewId:pt(null==t?void 0:t.viewId),customComponentId:(null==t?void 0:t.customComponentId)||"",dataSetId:e,displaySubject:"",displayTitle:"",tags:[],protectedByOrganisation:void 0}),schema:pr(e),removeField:(e,t)=>e,isRunnable:()=>!0,autoGenerate(e){return this.init(e.id)},dataPanelConfig:()=>[At(fr,"data_set"),At(fr,"views")],formatPanelConfig:()=>[Tt(fr)],supportedCustomFields:{percentages:!1,simpleMaths:!1,rules:!1,aggregateMaths:!1,roundedNumbers:!1,dateCalculations:!1,conditional:!1},supportedFeatures:{colorGradient:!1,parameters:!1}}),mr=e=>L().object(Object.assign(Object.assign({},Q(e.attributesSchemaOptions)),{type:L().valid("mercatorMap").required(),measure:L().array().items(U(e.queryEngineConfig.supportedAggregates,e.attributesSchemaOptions)),filter:W(e.queryEngineConfig),limit:K(),dimension:Y({},e.attributesSchemaOptions),labelFormat:L().alternatives(L().string(),L().valid(null)),noDataColor:L().string().required(),backgroundColor:L().string().required(),maxValueColor:L().string().required(),minValueColor:L().string().required(),position:L().object({scale:L().number(),centerX:L().number(),centerY:L().number()}),tags:G()})),gr=e=>(t,r)=>P(t,r,mr(e)),yr={title:"Country map",description:"A map component based on the Mercator projection, suitable for geographical data visualization.",namespace:"mercator_map",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use for this map?"},views:{type:"views",title:"View",description:""},field_metrics:{type:"fieldCollector",title:"Metric",description:"What do you want to show?",callToAction:"Add metric"},field_country:{type:"fieldCollector",title:"Country",description:"Which field contains the country code required to group results on?",callToAction:"Set country"},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use on this map."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this map."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Map Settings",description:"",subSectionDefinition:{number_format:{type:"numberFormat",title:"Value format",description:"",namespace:"number_format"}}},map_colors:{type:"mapColors",title:"Map colors",description:""}}},br=e=>({title:yr.title,description:yr.description,servicesClass:"MercatorMap",namespace:yr.namespace,dump:e=>e,load:e=>{var t;return{dataSetId:e.dataSetId,displaySubject:e.displaySubject,displayTitle:e.displayTitle,protectedByOrganisation:e.protectedByOrganisation,viewId:pt(e.viewId),type:"mercatorMap",dimension:e.dimension,limit:e.limit,measure:f(e.measure),labelFormat:e.labelFormat,position:e.position,filter:d(e.filter),noDataColor:e.noDataColor||"#ffffff",backgroundColor:e.backgroundColor||"#EFF5F6",maxValueColor:e.maxValueColor||"#000000",minValueColor:e.minValueColor||"#e0e0e0",tags:null!==(t=e.tags)&&void 0!==t?t:[]}},setAttributes:gr(e),validate:()=>[],init:(e,t)=>Object.assign({type:"mercatorMap",dataSetId:e,dimension:[],measure:[],displaySubject:"",displayTitle:"",limit:5e3,filter:[],viewId:pt(null==t?void 0:t.viewId),labelFormat:null,noDataColor:"#ffffff",backgroundColor:"#EFF5F6",maxValueColor:"#000000",minValueColor:"#e0e0e0",tags:[]},t),schema:mr(e),removeField:(e,t)=>e,isRunnable:e=>!!(e.dimension&&e.dimension[0]&&e.measure&&e.measure[0]),autoGenerate(e){return this.init(e.id)},dataPanelConfig:()=>[At(yr,"data_set"),At(yr,"views"),Object.assign(Object.assign({},At(yr,"field_metrics")),{type:"fieldCollector",fieldFilterOptions:{forComponent:"mercatorMap"},maxAllowed:1,preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"}),Object.assign(Object.assign({},At(yr,"field_country")),{fieldFilterOptions:{onlyDimensions:!0,onlyFieldTypes:["string"],removeRuleGrouping:!1,removeSimpleMaths:!0,removePercentage:!0,removeAggregateMaths:!0},maxAllowed:1,preSetPartialAttributes:e=>({dimension:e}),getValues:e=>e.dimension,testId:"add-dimension"}),At(yr,"filter"),At(yr,"custom_metrics"),At(yr,"limit")],formatPanelConfig:()=>{var e;return[Tt(yr),Object.assign(Object.assign({},At(yr,"chart_styles")),{subSection:[null===(e=yr.format_panel.chart_styles)||void 0===e?void 0:e.subSectionDefinition.number_format]}),At(yr,"map_colors")]},supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0},supportedFeatures:{parameters:!1,colorGradient:!1}});var vr;!function(e){e.Linear="linear",e.Circular="circular"}(vr||(vr={}));const _r=e=>L().object(Object.assign(Object.assign({},Q(e.attributesSchemaOptions)),{measure:L().array().items(U(e.queryEngineConfig.supportedAggregates,e.attributesSchemaOptions)),filter:W(e.queryEngineConfig),type:L().valid("progress").required(),limit:K(),conditionalFormattingRules:de(e.queryEngineConfig),parameters:ae(e.queryEngineConfig,e.attributesSchemaOptions),goals:L().array().items(L().object({field:L().string().required().description("ID of the field in the data set to which the goal applies too"),value:L().number().required().description("Value of which the goal is set")})).description("Set the target value that progression is shown towards."),progressType:L().array().items(L().object({field:L().string().required().description("ID of the field to set the progress type of"),value:L().valid(vr.Linear,vr.Circular).required()})).description("Set the display type of the progress view"),formatter:L().object().pattern(L().string(),L().string()),prefixes:L().object().pattern(L().string(),L().string()),postfixes:L().object().pattern(L().string(),L().string()),tags:G()})),Ar={title:"Progress",description:"Used to show progress towards goals, completion of tasks, or as indicators of performance metrics.",namespace:"progress",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this progress?"},views:{type:"views",title:"View",description:""},progress_goals:{type:"progressGoals",title:"Metric",description:"What do you want to show in each progress bar?"},filter:{type:"filter",title:"Filters",description:"Only include the information you want in this progress chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},stats_labels:{type:"statsLabels",title:"Labels",description:"",subSectionDefinition:{prefix:{title:"Prefix",description:"",namespace:"prefix"},postfix:{title:"Postfix",description:"",namespace:"postfix"},format:{title:"Format",description:"",namespace:"format"},count:{title:"Label count",description:"",namespace:"count"}}},progress_type:{type:"progressType",title:"Type",description:""}}},wr=e=>({title:Ar.title,description:Ar.description,dump:e=>e,namespace:Ar.namespace,servicesClass:"Progress",load:e=>{var t;const r=ur(e);return{type:"progress",measure:f(r.measure),displayTitle:r.displayTitle,displaySubject:r.displaySubject,protectedByOrganisation:r.protectedByOrganisation,viewId:pt(r.viewId),filter:r.filter,dataSetId:r.dataSetId,limit:r.limit,conditionalFormattingRules:r.conditionalFormattingRules,parameters:r.parameters,prefixes:r.prefixes,postfixes:r.postfixes,formatter:r.formatter,goals:r.goals,progressType:r.progressType,tags:null!==(t=r.tags)&&void 0!==t?t:[]}},setAttributes:(t,r)=>P(t,r,_r(e)),validate:(t,r)=>ct(t,r,e.queryEngineConfig),init:(e,t)=>Object.assign({type:"progress",measure:[],displayTitle:"",protectedByOrganisation:void 0,displaySubject:"",viewId:pt(null==t?void 0:t.viewId),filter:[],dataSetId:e,limit:5e3,conditionalFormattingRules:[],parameters:{},formatter:{},progressType:[],goals:[],postfixes:{},prefixes:{},tags:[]},t),schema:_r(e),removeField:(t,r)=>F(t,r,e.queryEngineConfig),isRunnable:e=>e.measure.length>0,autoGenerate(e){return this.init(e.id)},dataPanelConfig:()=>[At(Ar,"data_set"),At(Ar,"views"),At(Ar,"progress_goals"),At(Ar,"filter"),At(Ar,"custom_metrics")],formatPanelConfig:()=>[Tt(Ar),At(Ar,"progress_type"),Object.assign(Object.assign({},At(Ar,"stats_labels")),{prefix:Ot(Ar,"prefix"),postfix:Ot(Ar,"postfix"),format:Ot(Ar,"format"),count:Ot(Ar,"count")})],supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,aggregateMaths:!0,rules:!0,roundedNumbers:!0,conditional:!0},supportedFeatures:{parameters:!1,colorGradient:!1}}),Tr=["title","description","data_panel","format_panel"],Sr=["title","description","callToAction"],Er="call_to_action",Or=L().alternatives().try(L().string(),L().object({sentence:L().string().custom(((e,t)=>{const r=/\{\{(\w+)\}\}/g;let n;for(;null!==(n=r.exec(e));){const e=n[1];if(!t.state.ancestors[0][`${e}_singular`]||!t.state.ancestors[0][`${e}_plural`]){const r=`"textOverride": "${e}" found in sentence but corresponding "${e}_singular" and "${e}_plural" fields are missing`;return t.error("any.invalid",{message:r})}}return e}))}).pattern(/.+_(singular|plural)$/,L().string())).messages({"any.custom":"{{#message}}"}),xr=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,Cr=/<style\b[^<]*(?:(?!<\/style>)<[^<]*)*<\/style>/gi,Ir=/on[a-z]+\s*=\s*["'][^"']*["']/gi,jr=/javascript:[^\s"']+/gi,Rr=new RegExp(`^(?:${/<(b|strong)>(?:(?!<\/(b|strong)>).)*<\/(b|strong)>/.source}|${/<(i|em)>(?:(?!<\/(i|em)>).)*<\/(i|em)>/.source}|[^*_<>])*$`,"m"),Dr=e=>{if(xr.test(e)||Cr.test(e)||Ir.test(e)||jr.test(e))throw new Error("Invalid content: potentially malicious elements detected.");return Rr.test(e)},Fr=(e,t,r,n)=>Nr(e,t,r,void 0,n),Nr=(e,t,r,n,i)=>{if(i)return`[key: ${e}]`;const o=n?function(e,t){const r=e[t],n=Or.validate(r);return n.error&&n.error.details.forEach((e=>{var t;S(null===(t=e.context)||void 0===t?void 0:t.message)})),(()=>{if("string"==typeof r)return Dr(r);if("object"==typeof r)return Dr(r.sentence);if(void 0===r)return!0;throw new Error("Invalid translation type")})()?r:void 0}(n,e):void 0;let a;return a="object"==typeof o&&null!==o?o.sentence:"string"==typeof o?o:t,a=function(e,t){if(!t)return e;return e.replace(/\[\[([^\]]+)\]\]/g,((e,r)=>{const n=r.split("|");for(const e of n){const r=t[e];if("string"==typeof r&&""!==r)return r;if("number"==typeof r)return r.toString()}return""}))}(a,r),r&&(a=function(e,t,r){return Object.entries(t).forEach((([t,n])=>{if(n&&"object"==typeof n&&"count"in n){const i=n,o=1===i.count?r&&r[`${t}_singular`]||i.singular:r&&r[`${t}_plural`]||i.plural;e=e.replace(new RegExp(`{{${t}}}`,"g"),o)}})),e}(a,r,o)),function(e,t){if(!t)return e;for(const[r,n]of Object.entries(t))if("string"==typeof n||"number"==typeof n){const t=new RegExp(`\\[\\[${r}\\]\\]`,"g");e=e.replace(t,String(n))}return e}(a,r)},Pr=(e,t)=>{const r=null!=t?t:Nr;let n=e;const i=e.namespace;return Tr.forEach((t=>{if("title"===t||"description"===t){const o=r(`${i}.${t}`,e[t]);n=Object.assign(Object.assign({},n),{[t]:o})}if("data_panel"===t){const o=`${i}.${t}`,a=[];e.dataPanelConfig().forEach((e=>{e.subSection&&(e.subSection=Lr(e,r,o)),kr(e).forEach((t=>{const n=r(`${o}.${t.key}`,t.defaultValue);e[t.property]=n})),a.push(e)})),n=Object.assign(Object.assign({},n),{dataPanelConfig:()=>a})}if("format_panel"===t){const o=`${i}.${t}`,a=[];e.formatPanelConfig().forEach((e=>{e.subSection&&(e.subSection=Lr(e,r,o)),function(e,t,r){function n(r,n){r&&kr(r).forEach((i=>{const o=e(`${t}.${n}.${i.key}`,i.defaultValue);r[i.property]=o}))}function i(e,t,r){t.forEach((t=>{const i=e[t];i&&n(i,r)}))}r.x&&(i(r.x,Mr,"axis_labels"),n(r.x,"axis_labels")),r.y&&(i(r.y,Mr,"axis_labels"),n(r.y,"axis_labels")),function(e){return"prefix"in e}(r)&&i(r,Mr,"stats_labels")}(r,o,e),kr(e).forEach((t=>{const n=r(`${o}.${t.key}`,t.defaultValue);e[t.property]=n})),a.push(e)})),n=Object.assign(Object.assign({},n),{formatPanelConfig:()=>a})}})),n},Mr=["count","axisTitle","format","postfix","prefix"];function Lr(e,t,r){var n;return null===(n=e.subSection)||void 0===n?void 0:n.map((n=>(kr(n).forEach((i=>{const o=t(`${r}.${e.namespace}.${i.key}`,i.defaultValue);n[i.property]=o})),n)))}function kr(e){const t=e.namespace||e.type;if(!t)return[];const r=[];return Sr.forEach((n=>{if(e[n]){let i=n;"callToAction"===n&&(i=Er),r.push({key:`${t}.${i}`,defaultValue:e[n],property:n})}})),r}const qr={queryEngineConfig:{supportedFeatures:[],supportedAggregates:{},supportedTimeTruncFunctions:{},supportedOperators:{},supportedTransformationFunctions:{}}},$r=function(e,t){if("custom"==e)return Pr(hr(t||qr),null==t?void 0:t.textOverride);if("barChart"==e)return Pr(Ct(t||qr),null==t?void 0:t.textOverride);if("areaChart"==e)return Pr(sr(t||qr),null==t?void 0:t.textOverride);if("lineChart"==e)return Pr(Dt(t||qr),null==t?void 0:t.textOverride);if("pieChart"==e)return Pr(Pt(t||qr),null==t?void 0:t.textOverride);if("scatterChart"==e)return Pr(qt(t||qr),null==t?void 0:t.textOverride);if("comboChart"==e)return Pr(Gt(t||qr),null==t?void 0:t.textOverride);if("dataTable"==e)return Pr(Wt(t||qr),null==t?void 0:t.textOverride);if("basicTable"==e)return Pr(er(t||qr),null==t?void 0:t.textOverride);if("singleStat"==e)return Pr(dr(t||qr),null==t?void 0:t.textOverride);if("progress"==e)return Pr(wr(t||qr),null==t?void 0:t.textOverride);if("mercatorMap"==e)return Pr(br(t||qr),null==t?void 0:t.textOverride);if("horizontalBarChart"==e)return Pr(nr(t||qr),null==t?void 0:t.textOverride);throw`Cannot get interface for ${e}. Please implement it.`},zr=(["barChart","horizontalBarChart","areaChart","lineChart","scatterChart","pieChart","singleStat","dataTable","basicTable","comboChart","mercatorMap","progress","custom"].filter((e=>"custom"!=e)),"dateFilter"),Br="dateAndTimeFilter",Gr="singleSelectFilter",Ur="multiSelectFilter",Vr="numericFilter",Hr=e=>"fields"in e?(e=>{if("globalSelectFilter"==e.type)return{type:"singleSelectFilter",title:e.title,value:null,requiresValue:!1,managedByConfiguration:!1,appliesToFields:e.fields.map((e=>({fieldId:e.field,dataSetId:e.dataSetId})))};if("globalDateTimeFilter"==e.type)return{type:"dateFilter",value:null,requiresValue:!1,managedByConfiguration:!1,title:e.title,appliesToFields:e.fields.map((e=>({fieldId:e.field,dataSetId:e.dataSetId})))};throw`Unrecognised global filter. ${JSON.stringify(e)}`})(e):Object.assign(Object.assign({},e),{type:Kr(e.type)}),Yr=(e,t,r)=>t.appliesToFields.flatMap((n=>{var i,o,a;if(n.dataSetId!=e.id)return[];if(null==t.value)return[];if("string[]"==rt(e,n.fieldId).dataType)return[{field:n.fieldId,op:"array_contains",value:t.value}];if((t.type==zr||t.type==Br)&&"relativeRange"==(null===(i=t.value)||void 0===i?void 0:i.type))return[];if((t.type==zr||t.type==Br)&&"fixedRange"==(null===(o=t.value)||void 0===o?void 0:o.type))return[{field:n.fieldId,op:Zr(Qr.Greater,t),value:t.value.after},{field:n.fieldId,op:Zr(Qr.Less,t),value:t.value.before}];if((t.type==zr||t.type==Br)&&"relative"==(null===(a=t.value)||void 0===a?void 0:a.type)){let{before:e,after:i}=r[t.value.value].range,o=[];return e&&(o=[...o,{field:n.fieldId,op:Zr(Qr.Less,t),value:e}]),i&&(o=[...o,{field:n.fieldId,op:Zr(Qr.Greater,t),value:i}]),o}if(t.type==Gr)return[{field:n.fieldId,op:"=",value:t.value}];if(t.type==Ur&&t.value.length>0)return[{field:n.fieldId,op:"is_one_of",value:t.value}];if(t.type==zr&&!t.value||t.type==Br&&!t.value||t.type==Ur&&0===t.value.length)return[];if(t.type==Vr)return t.value?[{field:n.fieldId,op:t.value.op,value:t.value.value}]:[];throw`Cannot convert filter type ${t.type} to query attributes filter. ${JSON.stringify(t)}`})),Xr=(e,t)=>{var r;if("relativeRange"!==(null===(r=e.value)||void 0===r?void 0:r.type))return[];if(0===e.value.filters.length)return[];let n=[];return((e,t)=>{if(!t)throw new Error("appliesToFields is required");return e.map((e=>{const r=e.map((e=>({op:e.op,value:Object.assign({},e.value)}))),n=[];return t.forEach((e=>{r.forEach((t=>{n.push(Object.assign(Object.assign({},t),{field:e.fieldId}))}))})),n}))})(e.value.filters,e.appliesToFields)[0].forEach((e=>{n.push({field:e.field,op:e.op,value:B(e.value,t)})})),n},Wr=(e,t,r)=>{let n=[];return(e.globalFilters||[]).forEach((e=>{let i=[];e.type!==Br&&e.type!==zr||(i=Xr(e)),n=[...n,...i,...Yr(t,e,r)]})),Object.values(e.localFilters||{}).flat().forEach((e=>{let i=[];e.type!==Br&&e.type!==zr||(i=Xr(e)),n=[...n,...i,...Yr(t,e,r)]})),n},Kr=e=>"dateTimeFilter"===e?zr:e;var Qr;function Zr(e,t){switch(e){case Qr.Greater:return t.inclusiveDate?">=":">";case Qr.Less:return t.inclusiveDate?"<=":"<";default:throw new Error("Unknown date operation")}}!function(e){e[e.Greater=0]="Greater",e[e.Less=1]="Less"}(Qr||(Qr={}));const Jr=L().object({fieldId:L().string().required(),dataSetId:L().string().required()}),en=e=>L().object().pattern(L().string(),L().array().items(X(e)).optional()),tn=e=>({title:L().string().allow(""),managedByConfiguration:L().boolean().optional(),requiresValue:L().boolean().optional(),optionsFilters:en(e).optional(),appliesToFields:L().array().items(Jr).required(),optionsPulledFrom:L().array().items(Jr).optional(),hidden:L().boolean(),options:L().array().items(L().object({value:L().allow(L().number(),L().string()),label:L().string()})).optional()}),rn=(e,t)=>L().object(Object.assign(Object.assign({},tn(e)),{type:L().valid(Gr).required(),value:L().alternatives(L().string(),L().number(),L().boolean(),L().valid(...t?[]:[null]))})),nn=(e,t)=>L().object(Object.assign(Object.assign({},tn(e)),{type:L().valid(Ur).required(),value:L().alternatives(L().array().items(L().string(),L().number()).single(),L().valid(...t?[]:[null]))})),on=(e,t,r)=>L().object(Object.assign(Object.assign({},tn(e)),{type:L().valid(r).required(),inclusiveDate:L().boolean().optional(),value:L().alternatives(L().valid(...t?[]:[null]),L().object({type:L().valid("fixedRange"),before:L().alternatives(L().date()).required(),after:L().alternatives(L().date()).required()}),L().object({type:L().valid("relative"),value:L().string()}),L().object({type:L().valid("relativeRange"),filters:L().array()}))})),an=(e,t)=>L().object(Object.assign(Object.assign({},tn(e)),{type:L().valid(Vr).required(),value:L().alternatives(L().object({op:L().allow("=","<",">","<=",">="),value:L().number().allow(null,0)}),L().valid(...t?[]:[null]))})),sn=(e,t)=>L().alternatives().conditional(".type",{is:Gr,then:rn(e,t)}).conditional(".type",{is:zr,then:on(e,t,zr)}).conditional(".type",{is:Br,then:on(e,t,Br)}).conditional(".type",{is:Ur,then:nn(e,t)}).conditional(".type",{is:Vr,then:an(e,t)});function ln(e){return L().array().items(L().custom(((t,r)=>{if(!e)return r.error("any.invalid");const n=sn(e,!!t.requiresValue),{error:i}=n.validate(t);return i?r.error("any.invalid",{message:i.message}):t}))).required()}r(8143);const un=350,cn={colors:["#feae4a","#5fbaff","#e15e9d"],detail:"minimal",fontFamily:"Inter, sans-serif",rowLimit:6,fontSize:"0.65rem"},dn=e=>"displayTitle"in e,pn=e=>({colSpan:e,isEmpty:!0}),fn=e=>"isEmpty"in e,hn=e=>{const r=[...e],n=(0,t.sumBy)(r,(e=>e.colSpan));return 12==n||(r[r.length-1].colSpan+=12-n),r},mn=e=>!(e&&fn(e)&&e.colSpan<=0),gn=(e,r)=>e.map((e=>((e,r)=>{const n=(e=>"components"in e?e:{components:e,height:un})(e),i=n.components.filter(mn).map((e=>e&&e.colSpan<=0?Object.assign(Object.assign({},e),{colSpan:1}):e)),o=(0,t.sumBy)(i,(e=>null==e?1:0)),a=12-(0,t.sumBy)(i,(e=>null==e?0:e.colSpan)),s=Math.floor(a/o),l=[...i].map((e=>null===e?{isEmpty:!0,colSpan:s}:fn(e)||dn(e)?e:yn(Object.assign(Object.assign({},e),{colSpan:e.colSpan}),r)));return{components:hn(l),height:n.height||un}})(e,r))),yn=(e,r)=>{if("isEmpty"in e||dn(e))return e;const{load:n}=$r(e.attributes.type,r),i=n(e.attributes);let o=[];return(0,t.isArray)(e.localFilters)&&(o=[...e.localFilters?e.localFilters:[]].map((e=>Hr(e)))),"addOns"in e.attributes&&(0,t.isEmpty)(o)&&e.attributes.addOns.forEach((e=>{o=[...o,{type:"dateFilter"==e.type?"dateFilter":"singleSelectFilter",value:null,requiresValue:!1,managedByConfiguration:!1,appliesToFields:[{fieldId:e.field,dataSetId:i.dataSetId}]}]})),delete e.addOns,delete i.addOns,Object.assign(Object.assign({},e),{localFilters:o,attributes:i,results:[]})},bn=e=>L().alternatives().conditional(".type",{is:"barChart",then:Ct(e).schema}).conditional(".type",{is:"mercatorMap",then:br(e).schema}).conditional(".type",{is:"horizontalBarChart",then:nr(e).schema}).conditional(".type",{is:"lineChart",then:Dt(e).schema}).conditional(".type",{is:"comboChart",then:Gt(e).schema}).conditional(".type",{is:"areaChart",then:sr(e).schema}).conditional(".type",{is:"pieChart",then:Pt(e).schema}).conditional(".type",{is:"scatterChart",then:qt(e).schema}).conditional(".type",{is:"singleStat",then:dr(e).schema}).conditional(".type",{is:"dataTable",then:Wt(e).schema}).conditional(".type",{is:"basicTable",then:er(e).schema}).conditional(".type",{is:"progress",then:wr(e).schema}).conditional(".type",{is:"custom",then:hr(e).schema}),vn=L().object({displayTitle:L().string().min(1).required(),colSpan:L().number().valid(12).required()}),_n=L().number().min(1).max(12).required().messages({"number.base":'"colSpan" must be a number',"number.min":'"colSpan" must be at least {#limit}',"number.max":'"colSpan" must be less than or equal to {#limit}',"any.required":'"colSpan" is a required field'}),An=L().object({isEmpty:L().valid(!0).required(),colSpan:_n}),wn=e=>L().object({attributes:bn({queryEngineConfig:e}),colSpan:_n}),Tn=e=>L().object({id:L().string(),display:Sn(e),componentLibrary:L().array().required().items(L().object({attributes:bn({queryEngineConfig:e})})),globalFilters:ln(e),customFields:L().object().required()});function Sn(e){return L().array().required().items(L().object({height:L().number().required(),components:L().array().required().min(1).items(L().alternatives(An,wn(e),vn))}))}const En=(e,t)=>{const r=t?{queryEngineConfig:t}:void 0;if("string"==typeof e.definition)throw new Error("Dashboard is an encrypted string, use the query engine to fetch the dashboard. Please use the queryEngineConfig prop to pass the query engine configuration.");return{id:e.id,parentDashboardId:e.parent_dashboard_id,isPlayground:!1,permission:e.permission,globalFilters:[...e.definition.globalFilters||[]].map((e=>Hr(e))),componentLibrary:[...e.definition.componentLibrary||[]].map((e=>yn(Object.assign(Object.assign({},e),{colSpan:(null==e?void 0:e.colSpan)||1}),r))),theme:Object.assign(Object.assign({},cn),e.theme),display:gn(e.definition.display,r),webhookId:e.webhook_id||null,createdAt:new Date(e.created_at),updatedAt:new Date(e.updated_at),metadata:e.metadata||{}}},On=(e,t,r)=>Object.assign(Object.assign({},e),{dataSets:st(t,r)});const xn=(e,t)=>{const r=new Map;return e.forEach((e=>{const t=e.attributes.viewId;r.set(null!=t?t:"",e)})),t.forEach((e=>{const t=e.attributes.viewId;r.has(null!=t?t:"")||r.set(null!=t?t:"",e)})),Array.from(r.values())};function Cn(e){const t=e.find((t=>e.some((e=>e.id===t.parentGlobalLibraryId))))||e.find((e=>null===e.parentGlobalLibraryId));if(!t)throw new Error("No matching library found.");return t}const In=e=>{e.library.views=[],e.library.customFields={}};class jn extends Error{constructor(e){super(e),this.name="FailedToLoadQueryEngineConfig"}}const Rn=jn;class Dn extends Error{constructor(e){super(`The queryEngineEndpoint value '${e}' is not valid.`),this.name="InvalidQueryEngineEndpoint",this.invalidEndpoint=e}}const Fn=Dn;class Nn extends Error{constructor(){super("The queryEngineEndpoint value is not of the correct type. It must be a string or a function."),this.name="InvalidQueryEngineEndpointType"}}const Pn=Nn;var Mn=r(3493),Ln=r.n(Mn);const kn=e=>e.startsWith("/")?kn(e.slice(1)):e.endsWith("/")?kn(e.slice(0,-1)):e;var qn=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))};const $n=(e,t)=>qn(void 0,void 0,void 0,(function*(){if(e.dashboardAccessToken)return w("Using dashboard access token for auth header"),{auth:`Bearer ${e.dashboardAccessToken}`};if(e.projectAccessToken)return w("Using project access token for auth header"),{auth:`Bearer ${e.projectAccessToken}`};if(e.apiKey)return w("Using API Key for auth header"),{auth:`Api-Key ${e.apiKey}`};if(t.preFetchProjectAccessTokens&&(e.useCookieAuth||e.appSessionAuthToken)){w("Fetching project access token from the Vizzly API",t.preFetchProjectAccessTokens.projectId,"Filtering by",t.preFetchProjectAccessTokens.resourceFilters);const r=yield(e=>(t,r,n)=>{return i=void 0,o=void 0,s=function*(){let i={};r&&(i.auth=`Bearer ${r}`);let o="";n&&(o=`filter=${n.join(",")}`);const{status:a,body:s}=yield e({path:`/api/v2/auth/project/${t}/access_token?${o}`,method:"get",headers:i});if(200==a)return s.token.token},new((a=void 0)||(a=Promise))((function(e,t){function r(e){try{l(s.next(e))}catch(e){t(e)}}function n(e){try{l(s.throw(e))}catch(e){t(e)}}function l(t){var i;t.done?e(t.value):(i=t.value,i instanceof a?i:new a((function(e){e(i)}))).then(r,n)}l((s=s.apply(i,o||[])).next())}));var i,o,a,s})(zn(e))(t.preFetchProjectAccessTokens.projectId,e.appSessionAuthToken,t.preFetchProjectAccessTokens.resourceFilters);if(r)return w("Project access token received."),{auth:`Bearer ${r}`};w("Failed to receive project access token.")}else w("Not pre-fetching project access token.");return{}})),zn=e=>t=>qn(void 0,void 0,void 0,(function*(){var r;try{const r=yield $n(e,t),n=t.headers||{},i=((e,t)=>{const r=kn(e),n=kn(t),i=(o=e).startsWith("https://")||o.startsWith("http://")||o.startsWith(".")?"":"/";var o;return""==r&&""==n?"/":""==n?`${i}${r}`:""!=r&&""!=n?`${i}${r}/${n}`:`${i}${n}`})(e.host,t.path),o=yield Ln()(i,{method:t.method,headers:Object.assign(Object.assign({"Content-Type":"application/json",Accept:"application/json"},r),n),redirect:"follow",referrerPolicy:"no-referrer",body:t.body?JSON.stringify(t.body):null,signal:t.abortSignal,mode:t.mode||void 0});let a=yield o.json();return w("HTTP Client Response",{host:e.host,path:t.path,status:o.status,responseId:o.headers.get("X-Request-Id")}),{body:a,status:o.status,headers:o.headers}}catch(e){if(null===(r=t.abortSignal)||void 0===r?void 0:r.aborted)return console.log("Aborted a request."),{status:500,body:{reason:"Aborted"},headers:null};throw e}})),Bn=e=>"string"==typeof e?e:e.endpoint;const Gn=e=>"string"==typeof e?{}:e.customHeaders?e.customHeaders():{},Un=e=>t=>{return r=void 0,n=void 0,o=function*(){const r={host:Bn(e)},n=Object.assign(Object.assign({},t),{headers:Object.assign(Object.assign({},t.headers),Gn(e))});return zn(r)(n)},new((i=void 0)||(i=Promise))((function(e,t){function a(e){try{l(o.next(e))}catch(e){t(e)}}function s(e){try{l(o.throw(e))}catch(e){t(e)}}function l(t){var r;t.done?e(t.value):(r=t.value,r instanceof i?r:new i((function(e){e(r)}))).then(a,s)}l((o=o.apply(r,n||[])).next())}));var r,n,i,o};const Vn=e=>{return t=void 0,r=void 0,i=function*(){const t=Un(e),r=yield t({method:"post",mode:"cors",path:"/api/v1/support",body:{}});return 200==r.status?"supportedFeatures"in(n=r.body)?n:Object.assign(Object.assign({},n),{supportedFeatures:["subquery"]}):null;var n},new((n=void 0)||(n=Promise))((function(e,o){function a(e){try{l(i.next(e))}catch(e){o(e)}}function s(e){try{l(i.throw(e))}catch(e){o(e)}}function l(t){var r;t.done?e(t.value):(r=t.value,r instanceof n?r:new n((function(e){e(r)}))).then(a,s)}l((i=i.apply(t,r||[])).next())}));var t,r,n,i},Hn=o.QueryEngineConfig.getQueryEngineConfig("js");const Yn=e=>{let t="string"==typeof e?e:e.endpoint;return!!t.startsWith("http://")||!!t.startsWith("https://")||!!t.startsWith("/")};class Xn extends Error{constructor(e){super(e),this.name="FailedToLoadIdentity"}}const Wn=Xn;class Kn extends Error{constructor(e){super(e),this.name="InvalidIdentityReturn"}}const Qn=Kn,Zn=e=>{const t=(e=>{var t;const r=null===(t=e.split("."))||void 0===t?void 0:t[1];return JSON.parse((n=r,"object"==typeof window&&window&&window.atob?window.atob(n):Buffer.from(n,"base64").toString()).toString());var n})(e);return Object.assign(Object.assign({},t),{signature:e})};const Jn=e=>{return t=void 0,r=void 0,i=function*(){let t=yield e();if(t=(e=>{if(!e)throw new Qn("Failed to load identity.");const{error:t}=L().object({dashboardAccessToken:L().string().required(),dataAccessToken:L().string(),queryEngineAccessToken:L().string(),projectAccessToken:L().string().optional()}).validate(e);if(t)throw new Qn(t.message);return e})(t),!t)throw new Wn("Failed to fetch identity config.");const r=ei()&&((n=window.location.href).split("#vizzly_")[1]||new URLSearchParams(new URL(n).search).get("_vizzlyDashboardAdmin"))||null;var n;return{identityConfig:((e,t,r,n)=>{let i=Zn(e);"scope"in i||(i.scope="read_write");const o={dashboardAccess:i,dataAccess:t?Zn(t):void 0,queryEngineAccessConfig:r?Zn(r):void 0,dashboardAdminOverride:n?Zn(n):void 0};return(e=>{const t=new Date,r=new Date(e.dashboardAccess.expires),n=!!e.dataAccess&&new Date(e.dataAccess.expires);!1!==n&&n<t&&console.warn("Vizzly data access token expired at;",n),r<t&&console.warn("Vizzly dashboard access token expired at;",r)})(o),o})(t.dashboardAccessToken,t.dataAccessToken,t.queryEngineAccessToken,r),tokens:t}},new((n=void 0)||(n=Promise))((function(e,o){function a(e){try{l(i.next(e))}catch(e){o(e)}}function s(e){try{l(i.throw(e))}catch(e){o(e)}}function l(t){var r;t.done?e(t.value):(r=t.value,r instanceof n?r:new n((function(e){e(r)}))).then(a,s)}l((i=i.apply(t,r||[])).next())}));var t,r,n,i},ei=()=>"undefined"!=typeof window,ti=[{namespace:"config.supported_operator",constants:l},{namespace:"config.supported_aggregate",constants:g},{namespace:"config.supported_time",constants:a}],ri=(e,t,r)=>{const n={};return Object.entries(e).forEach((([e,i])=>{n[e]=Object.assign(Object.assign({},i),{publicName:t(`${r}.${e}`,i.publicName)})})),n};class ni extends Error{constructor(){super("Identity prop type is invalid."),this.name="InvalidIdentityPropType"}}const ii=ni;class oi extends Error{constructor(e){super(e),this.name="FailedToResolveDataSets"}}const ai=oi;class si extends Error{constructor(){super("dataSets property is not valid"),this.name="InvalidDataSetsPropType"}}const li=si;var ui=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))};L().function();const ci=e=>t=>ui(void 0,void 0,void 0,(function*(){var r,n,i,o,a,s,l;return yield(n=e,i=null===(r=t.dataAccess)||void 0===r?void 0:r.signature,o=void 0,a=void 0,s=void 0,l=function*(){const e=Un(n),t=yield e({method:"post",body:{dynamicConfig:"object"==typeof n?n.dynamicConfig:void 0,integritySignature:i},mode:"cors",path:"/api/v1/resolve-data-sets",abortSignal:void 0});if(200==t.status)return t.body.dataSets;throw new ai(`Failed to resolve data sets from ${JSON.stringify(n)}. Received status ${t.status}`)},new(s||(s=Promise))((function(e,t){function r(e){try{i(l.next(e))}catch(e){t(e)}}function n(e){try{i(l.throw(e))}catch(e){t(e)}}function i(t){var i;t.done?e(t.value):(i=t.value,i instanceof s?i:new s((function(e){e(i)}))).then(r,n)}i((l=l.apply(o,a||[])).next())})))})),di=(t,r)=>(n,i)=>ui(void 0,void 0,void 0,(function*(){try{let e=((e,t)=>{if(e)return e;if("function"==typeof t){if(!e)throw"dataSets function is required when loading a custom query engine config.";return e}if(t)return ci(t);throw new li})(t,r);if("function"!=typeof e)throw new li;let o=yield e(n,i);if(!o)throw new ai("Failed to fetch data sets from the query engine endpoint");return o.map((e=>((e,t)=>Object.assign(Object.assign({},e),{fields:[...e.fields].map((e=>((e,t,r)=>{const n=E(e.id);return{id:e.id,dataType:e.dataType,publicName:e.publicName||n,dashboardRequiredFilterGroups:e.dashboardRequiredFilterGroups||[],description:e.description||void 0,canBeDimension:void 0===e.canBeDimension||e.canBeDimension,canBeMeasure:void 0===e.canBeMeasure||e.canBeMeasure,allowedOperators:void 0===e.allowedOperators?u(e,t):e.allowedOperators,allowedGranularities:void 0===e.allowedGranularities?Object.keys(t.supportedTimeTruncFunctions):e.allowedGranularities,supportedAggregateOptions:C(t,e.dataType,e.supportedAggregateOptions)}})(e,t)))}))(e,i)))}catch(t){if(S(t),t instanceof li)throw t;if(t instanceof e.Errors.FailedToResolveDataSets)throw new ai(t.message);throw new ai("Failed to fetch data sets.")}}));var pi=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))};const fi={apiHost:"https://api.vizzly.co"},hi="in-browser";class mi{constructor(e,t,r,n=fi){this.queryEngineConfig=void 0,this.dataSets=void 0,this.queryEngine=e||hi,this.loadAccessTokens=t,this.loadDataSetsCallback=r,this.options=Object.assign(Object.assign({},fi),n)}getQueryEngineConfig(){return pi(this,void 0,void 0,(function*(){return this.queryEngineConfig||(this.queryEngineConfig=yield(e=this.queryEngine,t=this.loadDataSetsCallback,r=void 0,n=void 0,o=function*(){try{if("in-browser"===e)return Hn;if("function"==typeof e){let t=yield e();if(!t)throw new Rn("Failed to load query engine config.");return Object.assign({},t)}if(t){if(!Yn(e))throw new Fn(e);return Hn}if("string"==typeof e||"object"==typeof e&&"endpoint"in e){if(!Yn(e))throw new Fn(e);const t=yield Vn(e);if(!t)throw new Rn("Failed to load query engine config.");return t}throw new Pn}catch(e){if(S(e),e instanceof Fn)throw e;if(e instanceof Pn)throw e;throw new Rn("Failed to load query engine config.")}},new((i=void 0)||(i=Promise))((function(e,t){function a(e){try{l(o.next(e))}catch(e){t(e)}}function s(e){try{l(o.throw(e))}catch(e){t(e)}}function l(t){var r;t.done?e(t.value):(r=t.value,r instanceof i?r:new i((function(e){e(r)}))).then(a,s)}l((o=o.apply(r,n||[])).next())}))),this.queryEngineConfig=((e,t)=>{const r=Object.assign({},e);return r.supportedAggregates&&(r.supportedAggregates=ri(r.supportedAggregates,t,ti[1].namespace)),r.supportedTimeTruncFunctions&&(r.supportedTimeTruncFunctions=ri(r.supportedTimeTruncFunctions,t,ti[2].namespace)),r.supportedOperators&&(r.supportedOperators=ri(r.supportedOperators,t,ti[0].namespace)),r})(this.queryEngineConfig,((e,t,r)=>Nr(e,t,r,this.options.textOverrides,this.options.developerMode)))),this.queryEngineConfig;var e,t,r,n,i,o}))}getIdentity(){return pi(this,void 0,void 0,(function*(){if("function"!=typeof this.loadAccessTokens)throw new ii;const{tokens:e,identityConfig:t}=yield Jn(this.loadAccessTokens);return{accessTokens:e,identityConfig:t}}))}getDataSets(){return pi(this,void 0,void 0,(function*(){const{identityConfig:e}=yield this.getIdentity(),t=yield this.getQueryEngineConfig(),r=di(this.loadDataSetsCallback,this.queryEngine);return this.dataSets=yield r(e,t),this.dataSets}))}load(){return pi(this,void 0,void 0,(function*(){const[{identityConfig:e},t,r]=yield Promise.all([this.getIdentity(),this.getQueryEngineConfig(),this.getDataSets()]);return{queryEngineConfig:t,dataSets:r,identityConfig:e,dashboardStorageStrategy:this.getDashboardStorageStrategy(t)}}))}getDashboardStorageStrategy(e){return"function"==typeof this.queryEngine?{strategy:"vizzlyApi"}:e.supportedFeatures.includes("encryptedDashboards")&&this.queryEngine!==hi?{strategy:"queryEngine",endpoint:this.queryEngine}:{strategy:"vizzlyApi"}}}function gi(e,t){if(!t)throw new Error("Query engine config is required to validate filters");const r=((e,t)=>{const r=[];return e.forEach((e=>{const n=sn(t,!!e.requiresValue),{error:i,value:o}=n.validate(e);if(i)throw S(`Invalid global filter configuration: ${i.message}`),i;r.push(o)})),r})(e,t);return r}class yi extends Error{}class bi extends me{constructor(e,t){super(`'Issue with Services in ${t}: '${e}'`),this.name="ServicesValidation"}}class vi{constructor(e){var t,r;if(this.component=void 0,this.localFilters=void 0,this.isEmpty=void 0,null==e?void 0:e.component)this.component=null==e?void 0:e.component,this.colSpan=null!==(t=null==e?void 0:e.colSpan)&&void 0!==t?t:12;else{const t=pn(null!==(r=null==e?void 0:e.colSpan)&&void 0!==r?r:12);this.colSpan=t.colSpan,this.isEmpty=t.isEmpty}(null==e?void 0:e.localFilters)&&(this.localFilters=gi(e.localFilters,Eo.use().getViewConfiguration().queryEngineConfig))}set(e){var t;this.component=e.component,this.colSpan=null!==(t=e.colSpan)&&void 0!==t?t:12,this.isEmpty=!e.component||void 0,(null==e?void 0:e.localFilters)&&(this.localFilters=gi(e.localFilters,Eo.use().getViewConfiguration().queryEngineConfig))}setColSpan(e){try{!function(e){const{error:t,value:r}=_n.validate(e);if(t)throw new yi(t.message)}(e),this.colSpan=e}catch(e){throw new bi(e,"Cell.setColSpan")}}setComponent(e){this.component=e,this.isEmpty=void 0}emptyCell(e){const t=pn(null!=e?e:12);this.colSpan=t.colSpan,this.isEmpty=t.isEmpty,this.component=void 0}}class _i{constructor(e,t){this.components=[],this.height=un,this.components=null!=e?e:[],this.height=null!=t?t:un,this.validateTotalColSpan()}addCell(e,t){void 0===t?this.components.push(e):this.components.splice(t,0,e),this.validateTotalColSpan()}setHeight(e){this.height=e}setRow(e){this.components=e,this.validateTotalColSpan()}set(e,t){this.components=e,this.height=null!=t?t:un,this.validateTotalColSpan()}validateTotalColSpan(){if(this.components.reduce(((e,t)=>e+t.colSpan),0)>12)throw new Error("Total column span of cells exceeds the allowed limit of 12.")}}class Ai{constructor(e){this.component=void 0;let t={displayTitle:"New Header",colSpan:12};e&&(t=Object.assign(Object.assign({},t),{displayTitle:e}));const r={components:[t],height:null!=52?52:un};this.component=[r]}setTitle(e){if(!this.component)throw new Error("Header is undefined");dn(this.component[0].components[0])&&(this.component[0].components[0].displayTitle=e)}}function wi(e){let t=[];return e.forEach((e=>{var r,n;if(e instanceof _i){const n=null==e?void 0:e.components.map((e=>{var t;return e.component&&!e.isEmpty?{attributes:e.component.attributes,localFilters:null!==(t=e.localFilters)&&void 0!==t?t:[],updatesFromParameters:{},results:[],colSpan:e.colSpan,reports:[]}:(e.isEmpty,{colSpan:e.colSpan,isEmpty:!0})}));t.push({height:null!==(r=e.height)&&void 0!==r?r:un,components:n})}e instanceof Ai&&(null===(n=e.component)||void 0===n||n.forEach((e=>{t.push({height:e.height,components:e.components})})))})),t}const Ti=e=>{var t;let r=[],n=new Set;return null===(t=null==e?void 0:e.library)||void 0===t||t.forEach((e=>{var t;if(e.component&&e.component.attributes){const{viewId:i}=e.component.attributes;if(n.has(null!=i?i:""))throw new Error(`Duplicate viewId found: ${i}`);n.add(null!=i?i:""),r.push({attributes:e.component.attributes,localFilters:null!==(t=e.localFilters)&&void 0!==t?t:[],updatesFromParameters:{},results:[],colSpan:1,reports:[]})}})),r};function Si(e){const t=L().object({component:L().object().required(),uniqueViewId:L().string().min(1).required().messages({"string.base":"\"uniqueViewId\" should be a type of 'text'","string.empty":'"uniqueViewId" cannot be an empty field',"string.min":'"uniqueViewId" should have a minimum length of {#limit}',"any.required":'"uniqueViewId" maybe undefined or null'})}),{error:r}=t.validate(e);if(r)throw new yi(r.message)}const Ei=(e,t)=>Object.assign(Object.assign({},e),{attributes:Object.assign(Object.assign({},e.attributes),{viewId:t})});class Oi{constructor(e){this.vizzly=Eo.use();const{init:t}=$r(e.type,{queryEngineConfig:this.vizzly.getViewConfiguration().queryEngineConfig});this.attributes=t(null==e?void 0:e.dataSetId,e)}updateAttributes(e){const{setAttributes:t}=$r(this.attributes.type,{queryEngineConfig:this.vizzly.getViewConfiguration().queryEngineConfig});if(!this.attributes)throw new Error("Attributes have not been initialized yet");this.attributes=t(this.attributes,e)}}class xi extends Error{constructor(e){super(`Vizzly has not yet been loaded. Please see the instantiation docs;\nhttps://docs.vizzly.co/services/initializing\n\nThis might be expected behavior if you have set it up correctly. If so, you will need\nto handle this error and retry once Vizzly has finished loading.\n\n${e!=Eo.DEFAULT_INSTANCE_ID&&`Instance Id; ${e}`}`),this.name="VizzlyInstanceNotLoaded"}}class Ci extends Error{constructor(e,t){super(`Timeout waiting for Vizzly to load. Please see the instantiation docs;\nhttps://docs.vizzly.co/services/initializing\n\nThis might be expected behavior if you have set it up correctly. If so, you will need\nto bump the timeout which was set to ${t}ms.\n\n${e!=Eo.DEFAULT_INSTANCE_ID&&`Instance Id; ${e}`}`),this.name="TimeoutWaitingForVizzlyInstance"}}const Ii={convert:!1,stripUnknown:!1,allowUnknown:!0},ji={convert:!1,stripUnknown:!1,allowUnknown:!0};var Ri;!function(e){e.SAVING="saving",e.SAVED="saved",e.DELETED="deleted"}(Ri||(Ri={}));const Di=(e,t)=>e.map((e=>e.map((({field:e,functionId:t})=>({id:I({field:e.id,function:t}),publicName:e.publicName,dataType:e.dataType}))))),Fi=(e,t,r)=>{const n=t.map((t=>{const n=tt(e,t.dataSetId);if(!n)throw"Data set not found for query attributes query";return ze(n,t.measure,t.order,t.filter,t.dimension,t.timeDimension,t.limit,t.offset,r)}));return{queries:n.map((e=>e.query)),resultFields:Di([...n].map((e=>e.measureDescription)))}};function Ni(e,t){let r=e.optionsFilters?e.optionsFilters[t.dataSetId]:[];return null==r?void 0:r.filter((e=>e.field!==t.fieldId))}const Pi=(e,t,r,n)=>{const{query:i,measureDescription:o}=Ke(t,e.measure,e.order,Le(e.filter,r),e.dimension,e.timeDimension||null,e.limit,e.offset,n);return{queries:[i],resultFields:Di([o])}},Mi=Pi,Li=Pi,ki=Pi,qi=Pi,$i=Pi,zi=Pi,Bi=Pi,Gi=(e,t,r,n)=>{const{queries:i,measureDescription:o}=((e,t,r,n)=>{const i=((e,t,r,n)=>{let{query:i,measureDescription:o}=Ke(r,e.measure,[],Le(e.filter,t),[],null,1,e.offset,n);return i.measure=[{type:"number",value:0},...i.measure],o=[{field:{id:"single-stat-bumper-field",canBeDimension:!1,canBeMeasure:!1,publicName:"",dataType:"number",allowedOperators:[]},functionId:"none"},...o],{query:i,measureDescription:o}})(e,n,t,r);let o=null;return"deltaTimeDimension"in e&&(o=((e,t,r,n)=>t.deltaTimeDimension?Ke(e,t.measure,[{field:t.deltaTimeDimension.field,direction:"asc",function:t.deltaTimeDimension.truncate}],Le(t.filter,r),[],t.deltaTimeDimension,t.limit,t.offset,n):null)(t,e,n,r)),{queries:o?[i.query,o.query]:[i.query],measureDescription:o?[i.measureDescription,o.measureDescription]:[i.measureDescription]}})(e,t,n,r);return{queries:i,resultFields:Di(o)}},Ui=(e,t,r,n)=>{switch(e.type){case"areaChart":return Mi(e,t,r,n);case"barChart":return Li(e,t,r,n);case"horizontalBarChart":return ki(e,t,r,n);case"lineChart":return qi(e,t,r,n);case"pieChart":return $i(e,t,r,n);case"dataTable":return zi(e,t,r,n);case"basicTable":return Bi(e,t,r,n);case"comboChart":return((e,t,r,n)=>{const{line:i,bar:o}=((e,t,r,n)=>{let i=Ke(t,e.lineMeasure,e.order,Le(e.filter,n),e.lineDimension,e.timeDimension,e.limit,e.offset,r);return{bar:Ke(t,e.barMeasure,e.order,Le(e.filter,n),e.barDimension,e.timeDimension,e.limit,e.offset,r),line:i}})(e,t,n,r);return{queries:[i.query,o.query],resultFields:Di([i.measureDescription,o.measureDescription])}})(e,t,r,n);case"singleStat":case"progress":return Gi(e,t,r,n);case"scatterChart":return((e,t,r,n)=>{let i=[];e.xMeasure&&i.push(e.xMeasure),e.yMeasure&&i.push(e.yMeasure);const{query:o,measureDescription:a}=Ke(t,i,e.order,Le(e.filter,r),e.dimension,e.timeDimension,e.limit,e.offset,n);return{queries:[o],resultFields:Di([a])}})(e,t,r,n);case"mercatorMap":return((e,t,r,n)=>Fi([t],[{measure:e.measure,dataSetId:t.id,dimension:e.dimension,limit:e.limit,filter:Le(e.filter,r),order:[],timeDimension:null}],n))(e,t,r,n);default:throw"Unsupported."}},Vi=(e,t,r)=>{let n=[],i=[];if(Array.isArray(e)&&"type"in e[0]&&"preparedQuery"==e[0].type&&"preAggregated"==e[0].preparedQueryType){const o=tt(r.dataSets,e[0].dataSetId);if(!o)throw"Data set not found for pre aggregated query";const[a]=o.preAggregated,{query:s,resultFields:l}=((e,t)=>({query:e,resultFields:t.fields.map((e=>({id:e.id,publicName:e.publicName,dataType:e.dataType})))}))(e[0],o),u=tt(r.dataSets,a),c=Wr(r.filterConfig,u,r.timeRangeOptions),d=ke([c],t,u);n=[Object.assign(Object.assign({},s),{filter:{[u.id]:d}})],i=[l]}else if(Array.isArray(e)&&"type"in e[0]&&"preparedQuery"==e[0].type&&"uniqueArrayValues"==e[0].preparedQueryType){n=[e[0]];const t=tt(r.dataSets,e[0].dataSetId);if(!t)throw"Data set not found for view attributes query";const o=rt(t,e[0].fieldId),{query:a,resultFields:s}=Ze(e[0].dataSetId,o);n=[a],i=[s]}else if(Array.isArray(e)){let o=[...e].map((e=>{const t=tt(r.dataSets,e.dataSetId);if(!t)throw"Data set not found for query-attributes query";const n=Wr(r.filterConfig,t,r.timeRangeOptions);return Object.assign(Object.assign({},e),{filter:Le(e.filter,n)})}));const{queries:a,resultFields:s}=Fi(r.dataSets,o,t);n=a,i=s}else if("type"in e&&("order"in e||"measure"in e)){const o=tt(r.dataSets,e.dataSetId);if(!o)throw"Data set not found for view attributes query";const a=Wr(r.filterConfig,o,r.timeRangeOptions);let{queries:s,resultFields:l}=Ui(e,o,a,t);n=s,i=l}else if("custom"!=e.type){let{queries:o,resultFields:a}=((e,t,r)=>{let n=[...e.appliesToFields].map((n=>{const i=tt(t,n.dataSetId);if(!i)throw"Data set not found for additional filter query";const o=rt(i,n.fieldId);if("string[]"==o.dataType){const t=ke([Ni(e,n)],r,i),{query:a,resultFields:s}=Ze(n.dataSetId,o,t);return{queries:[a],resultFields:[s]}}{const o=((e,t,r)=>{let n=[{field:t,function:"count"}],i=r?[r]:[],o=[{field:t,function:"none"}];return{dataSetId:e.id,measure:n,order:[],filter:i,dimension:o,timeDimension:null,limit:5e3,offset:0}})(i,n.fieldId,Ni(e,n));return Fi(t,[o],r)}}));return{queries:n.flatMap((e=>e.queries)),resultFields:n.flatMap((e=>e.resultFields))}})(e,r.dataSets,t);n=o,i=a}return{queries:n,resultFields:i}};let Hi={};const Yi=e=>Array.isArray(e)?0==e.length:"object"==typeof e&&Yi(Object.keys(e)),Xi=(e,t,r,n)=>{return i=void 0,o=void 0,s=function*(){let i={};e.forEach(((e,t)=>{const r=(e=>{const t=JSON.stringify(e),r=Hi[t];if(!r)return w("Browser cache miss.",e),null;w("Browser cache hit.",e);const{item:n,expires:i}=r;return new Date<i?n:(delete Hi[t],null)})(n(e));r&&(w("Query result received from the cache."),i[t]=r)})),e.forEach(((e,r)=>{t(e)||(w("Query is not runnable."),i[r]=null)}));const o=e.filter(((e,r)=>t(e)&&void 0===i[r]));let a=[];return Yi(o)||(a=yield r(o)),null===a||Yi(a)&&Yi(i)?null:[...e].map(((e,r)=>{let o=i[r];if(t(e)&&null==o&&(o=(null==a?void 0:a.shift())||null,((e,t,r)=>{const n=JSON.stringify(e);let i=new Date;i.setSeconds(i.getSeconds()+20),w("Browser cache new object set.",n),Hi[n]={item:t,expires:i}})(n(e),o)),void 0===o)throw"A result went missing...";return o}))},new((a=void 0)||(a=Promise))((function(e,t){function r(e){try{l(s.next(e))}catch(e){t(e)}}function n(e){try{l(s.throw(e))}catch(e){t(e)}}function l(t){var i;t.done?e(t.value):(i=t.value,i instanceof a?i:new a((function(e){e(i)}))).then(r,n)}l((s=s.apply(i,o||[])).next())}));var i,o,a,s};var Wi=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))};const Ki=(e,t,r)=>Wi(void 0,void 0,void 0,(function*(){const{queries:n,resultFields:i}=Vi(t,e.queryEngineConfig,r),o=yield Xi(n,(e=>!0),(t=>Wi(void 0,void 0,void 0,(function*(){return yield((e,t,r,n)=>{return i=void 0,o=void 0,s=function*(){const i=Un(t),{status:o,body:a}=yield i({path:"/api/v1/create-results",method:"post",mode:"cors",body:{queries:e,virtualFields:{},dynamicConfig:"object"==typeof t?t.dynamicConfig:void 0,identityConfigIntegritySignature:r},abortSignal:n});return 200==o?a:null},new((a=void 0)||(a=Promise))((function(e,t){function r(e){try{l(s.next(e))}catch(e){t(e)}}function n(e){try{l(s.throw(e))}catch(e){t(e)}}function l(t){var i;t.done?e(t.value):(i=t.value,i instanceof a?i:new a((function(e){e(i)}))).then(r,n)}l((s=s.apply(i,o||[])).next())}));var i,o,a,s})(t,e.queryEngineEndpoint,e.dataAccessToken,r.abortSignal)}))),(t=>({query:t,cacheKeyNamespace:e.cacheKeyNamespace})));return[...n].map(((e,t)=>{if(null===o)return null;const r=o[t];return void 0===r?null:{content:r,fields:i[t]}}))}));var Qi=r(7331),Zi=r.n(Qi);const Ji={},eo=[];let to={};class ro extends Error{constructor(e){super(e),this.name="MissingVizzlyInMemoryDb"}}const no=ro,io=()=>{const e=window.VizzlyInMemoryDb;if(!e)throw new no("VizzlyInMemoryDb missing! This means that 'window.VizzlyInMemoryDb' was not set. This is required for the in-browser vizzly setup.\n\nPlease ensure you have added the script tag to load the in-browser query engine.\n\nFor example, this should be added within the <head> tag;\n<script src=\"https://static.app.vizzly.co/query-engine/0.8.16/vizzly-in-memory-db.umd.js\"><\/script>\n\nNote, you can change the version of the in-memory database by changing '0.8.3' to the version you require.\n");return e};const oo=(e,r)=>{const n={type:"orWhere",value:[...[...e].filter((e=>!(0,t.isEmpty)(e)))].map((e=>({type:"andWhere",value:e.map((e=>({type:"where",left:ao(e.field,r),op:e.op,right:{type:(0,t.isArray)(e.value)?"list":(0,t.isNumber)(e.value)?"number":"unsafeString",value:(0,t.isArray)(e.value)?e.value.map((e=>({type:"unsafeString",value:e}))):e.value}})))})))};let i={type:"andWhere",value:[]};return(0,t.isEmpty)(n.value)||(i.value=[...i.value,n]),i},ao=(e,t)=>{if("subquery"==e.type)return{type:"subquery",value:{select:[ao(e.value.measure[0],t)],where:oo(e.value.filter,t),join:[]}};if("maths"==e.type)return{type:"maths",left:ao(e.left,t),right:ao(e.right,t),op:e.op};if("date_maths"==e.type)return{type:"date_maths",left:ao(e.left,t),right:ao(e.right,t),op:e.op};if("number"==e.type)return e;if("null"==e.type)return e;if("string"==e.type)return{type:"unsafeString",value:e.value};if("function"==e.type)return{type:"function",function:e.function,value:ao(e.value,t)};if("switchField"==e.type)return{type:"case",value:{cases:e.value.cases.map((e=>({result:ao(e.returns,t),where:oo(e.filter,t)})))}};if("field"==e.type&&"none"!=e.function){const r=rt(t,e.value);return{type:"function",function:e.function,value:{type:"field",value:{nativeDataType:r.dataType,address:["_",t.id,r.id]}}}}if("field"===e.type){const r=rt(t,e.value);return{type:"field",value:{nativeDataType:r.dataType,address:["_",t.id,r.id]}}}throw`Unsupported measure in JS query engine ${JSON.stringify(e)}`};var so=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))};const lo=(e,t)=>`${e}::${t}`,uo=(e,t,r)=>so(void 0,void 0,void 0,(function*(){const n=[...e].map((e=>so(void 0,void 0,void 0,(function*(){const[n]=nt(t,e.dataSetId),i=lo(r,e.dataSetId);if(Ji[i]&&n){const t=yield((e,t)=>{return r=void 0,n=void 0,o=function*(){var r,n,i;if("query"===e.type){if(0===(null===(r=null==e?void 0:e.measure)||void 0===r?void 0:r.length))return[[]];const i={select:e.measure.map((e=>ao(e,t))),where:oo(e.filter,t),order:e.order,group:e.group,join:[],limit:e.limit||5e3,offset:e.offset||0,from:["_",e.dataSetId]},o=yield io().query(i);return(null===(n=null==o?void 0:o[0])||void 0===n?void 0:n.values)||[]}if("preparedQuery"===e.type&&"uniqueArrayValues"===e.preparedQueryType){const r={type:"uniqueArrayValues",field:{type:"field",value:{address:["_",e.dataSetId,e.fieldId],nativeDataType:"JSON"}},where:oo(e.filter,t),join:[]},n=yield io().query(r);return(null===(i=null==n?void 0:n[0])||void 0===i?void 0:i.values)||[]}throw"Unsupported query"},new((i=void 0)||(i=Promise))((function(e,t){function a(e){try{l(o.next(e))}catch(e){t(e)}}function s(e){try{l(o.throw(e))}catch(e){t(e)}}function l(t){var r;t.done?e(t.value):(r=t.value,r instanceof i?r:new i((function(e){e(r)}))).then(a,s)}l((o=o.apply(r,n||[])).next())}));var r,n,i,o})(e,n);return t}return console.warn("Returning an empty result."),[]}))));return yield Promise.all(n)})),co=(e,t,r,n)=>so(void 0,void 0,void 0,(function*(){return yield io().init(t.map((e=>({id:null==e?void 0:e.id,fields:null==e?void 0:e.fields.map((e=>({id:e.id,dataType:e.dataType})))})))),yield Promise.all([...e].flatMap((e=>so(void 0,void 0,void 0,(function*(){const[i]=nt(t,e.dataSetId);if(i){const t=yield((e,t,r)=>{return n=void 0,i=void 0,a=function*(){to[e.id]||(to[e.id]=Zi()(t,5e3,{leading:!0}));let n=to[e.id];if(w("Fetching data for in-browser query engine. DataSet;",e.id,"CacheKey;",r),Ji[r])return w("Returning data for in-browser query engine from the cache."),Ji[r];{const t=yield n(e);return t||eo.includes(e.id)||(eo.push(e.id),console.error(`Failed to download data for data set ${e.id}`)),t&&n.cancel(),Ji[r]=t,t}},new((o=void 0)||(o=Promise))((function(e,t){function r(e){try{l(a.next(e))}catch(e){t(e)}}function s(e){try{l(a.throw(e))}catch(e){t(e)}}function l(t){var n;t.done?e(t.value):(n=t.value,n instanceof o?n:new o((function(e){e(n)}))).then(r,s)}l((a=a.apply(n,i||[])).next())}));var n,i,o,a})(i,r,lo(n,e.dataSetId)),o={id:null==i?void 0:i.id,fields:null==i?void 0:i.fields.map((e=>({id:e.id,dataType:e.dataType})))};yield io().ingest(o,t||[])}return[]}))))),yield uo(e,t,n)}));var po=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},fo=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))};function ho(e,t,r){return n=this,i=void 0,a=function*(){return"vizzlyQueryEngine"==e.type?yield Ki(e,t,r):"vizzlyJsQueryEngine"==e.type?yield((e,t,r)=>po(void 0,void 0,void 0,(function*(){const{queries:n,resultFields:i}=Vi(t,Hn,r);let o=yield Xi(n,(e=>!0),(t=>po(void 0,void 0,void 0,(function*(){return yield co(t,r.dataSets,e.loadData,e.cacheKeyNamespace)}))),(t=>({query:t,cacheKeyNamespace:e.cacheKeyNamespace})));return null===o&&(o=n.map((()=>null))),[...n].map(((e,t)=>{if(null===o)return null;const r=o[t];return void 0===r?null:{content:r,fields:i[t]}}))})))(e,t,r):"custom"==e.type?yield((e,t,r)=>fo(void 0,void 0,void 0,(function*(){const{queries:n,resultFields:i}=Vi(t,e.queryEngineConfig,r),o=yield Xi(n,(e=>("preparedQuery"==e.type&&T("Custom query engine does not support prepared queries."),"query"==e.type)),(t=>fo(void 0,void 0,void 0,(function*(){const n=yield e.runQueries(t,Object.assign(Object.assign({},r),{dataAccessToken:e.dataAccessToken}));return null==n?t.map((()=>null)):n.map(((e,t)=>Array.isArray(e)?{fields:i[t],content:e}:e))}))),(t=>({query:t,cacheKeyNamespace:e.cacheKeyNamespace})));return null===o?n.map((()=>null)):o})))(e,t,r):[]},new((o=void 0)||(o=Promise))((function(e,t){function r(e){try{l(a.next(e))}catch(e){t(e)}}function s(e){try{l(a.throw(e))}catch(e){t(e)}}function l(t){var n;t.done?e(t.value):(n=t.value,n instanceof o?n:new o((function(e){e(n)}))).then(r,s)}l((a=a.apply(n,i||[])).next())}));var n,i,o,a}var mo=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))};const go=(e,t)=>{const r=new Date(e.getTime()-24*t*60*60*1e3);return new Date(r.getFullYear(),r.getMonth(),r.getDate())},yo=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()),bo={today:!1,past_1_day:!0,yesterday:!0,past_3_days:!0,past_7_days:!0,past_30_days:!0,past_90_days:!0,past_3_months:!1,past_6_months:!1,past_12_months:!1,past_18_months:!1},vo=(e,t)=>{const r=yo(e),n=new Date(r);return n.setDate(n.getDate()+1),n.setMilliseconds(n.getMilliseconds()-1),{description:t,range:{before:n,after:r}}},_o=(e,t,r)=>{const n=new Date;let i=new Date(n);return t>0&&i.setMonth(n.getMonth()-t),e>0&&(i=new Date(n.getTime()-24*e*60*60*1e3)),{description:r,range:{before:n,after:i}}};var Ao=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))};const wo="default";e.VizzlyApiClientLogger.UserAgentProduct="Services";const To=Object.assign({},{apiHost:"https://api.vizzly.co"});class So{constructor(t,r,n,i,o,a){this.programmaticDashboard=o,this.dataSets=n,this.queryEngineConfig=r,this.identityConfig=t,this.vizzlyAPIClient=((t,r,n)=>{var i,o,a;const s=new e.Authentication({dashboardAccessToken:null==t?void 0:t.dashboardAccess.signature,dataAccessToken:null===(i=null==t?void 0:t.dataAccess)||void 0===i?void 0:i.signature,projectAdminOverrideToken:null===(o=null==t?void 0:t.dashboardAdminOverride)||void 0===o?void 0:o.signature,queryEngineAccessToken:null===(a=null==t?void 0:t.queryEngineAccessConfig)||void 0===a?void 0:a.signature});let l=()=>({});"queryEngine"===r.strategy&&"string"!=typeof r.endpoint&&(l=r.endpoint.customHeaders||l);const u="queryEngine"===r.strategy?new e.VizzlyQueryEngineApi(s,"string"==typeof r.endpoint?r.endpoint:r.endpoint.endpoint,l):void 0,c=new e.VizzlyApi(s,n.host),d=new e.VizzlyAppApi(s,"https://app.vizzly.co");return new e.Vizzly({vizzlyApi:c,vizzlyAppApi:d,vizzlyQueryEngineApi:u},"queryEngine"===r.strategy?new e.PersistViaQueryEngine:new e.PersistDirectToVizzlyApi)})(t,i,a)}static load(e,t=To){return Ao(this,void 0,void 0,(function*(){w("Starting load process for the services package.");const{queryEngine:r,dataSets:n,identity:i,programmaticDashboard:o}=e,a=new mi(r,i,n,t),{queryEngineConfig:s,dataSets:l,identityConfig:u,dashboardStorageStrategy:c}=yield a.load(),d=new Eo(u,s,l,c,o,{host:t.apiHost});return Eo._instanceStore[wo]=d,Eo.queryEngine=r,w("Loaded services package and added it to the instance store."),d}))}static use(e=wo){const t=Eo._instanceStore[e];if(!t)throw new xi(e);return t}static waitToUse(e=wo,t=1e4){return Ao(this,void 0,void 0,(function*(){const r=So._instanceStore,n=e;return new Promise(((i,o)=>{if(r.hasOwnProperty(n))return void i(r[n]);const a=setTimeout((()=>{clearTimeout(a),o(new Ci(e,t))}),t),s=setInterval((()=>{r.hasOwnProperty(n)&&(clearTimeout(a),clearInterval(s),i(r[n]))}),10)}))}))}static clearInstances(){Eo._instanceStore={}}createDashboard(e){var t;return Ao(this,void 0,void 0,(function*(){((e,t)=>{const r=L().object({definition:t?Tn(t):L().object().required(),parentDashboardId:L().string().required(),metadata:L().object()}).validate(e,ji);if(r.error)throw new yi(r.error.message)})(e,this.queryEngineConfig);const r=this.vizzlyAPIClient.getDashboardManager(),{dashboard:n}=yield r.create({metadata:e.metadata||e.meta,definition:e.definition,parentDashboardId:e.parentDashboardId,permissions:[{scope:"read_write"}]}),i=En(n,this.queryEngineConfig);return On(i,this.dataSets,(null===(t=n.definition)||void 0===t?void 0:t.customFields)||{})}))}updateDashboard(e){var t;return Ao(this,void 0,void 0,(function*(){((e,t)=>{const r=L().object({dashboardId:L().string().required(),definition:t?Tn(t):L().object().required(),metadata:L().object().optional(),deleted:L().boolean().optional()}).validate(e,ji);if(r.error)throw new yi(r.error.message)})(e,this.queryEngineConfig);const r=this.vizzlyAPIClient.getDashboardManager(),n=yield r.update({dashboardId:e.dashboardId,metadata:e.metadata||e.meta,definition:e.definition,deleted:e.deleted,abortSignal:e.abortSignal}),i=En(n,this.queryEngineConfig);return On(i,this.dataSets,(null===(t=n.definition)||void 0===t?void 0:t.customFields)||{})}))}getDashboards(e){return Ao(this,void 0,void 0,(function*(){const t=this.vizzlyAPIClient.getDashboardManager(),r=(yield t.getDashboards((null==e?void 0:e.abortController)?{abortSignal:null==e?void 0:e.abortController.signal}:{})).flatMap((e=>So.upcastDashboard(e,this.dataSets,this.queryEngineConfig)));return this.programmaticDashboard?function(e,t){const r=((e,t)=>{if(t.length>0&&"vizzly_editor"===t[0].id)return[...e,Object.assign(Object.assign({},t[0]),{parentDashboardId:e[0].id,isProgrammatic:!0})]})(e,t);if(r)return r;const n=new Map(t.map((e=>[e.id,e])));return e.map((e=>{const t=n.get(e.id);if(null!==e.parentDashboardId){const t=n.get(e.parentDashboardId);if((null==t?void 0:t.id)===e.parentDashboardId)return Object.assign(Object.assign({},e),{componentLibrary:xn(null==t?void 0:t.componentLibrary,e.componentLibrary)})}return null!=t?t:e}))}(r,((e,t)=>{let r=[];return e.map((e=>{var n;if(void 0===e.id)throw new Error("Dashboard id is undefined");const i=On(e,t,e.customFields||{});r.push({id:i.id,dataSets:i.dataSets,display:null!==(n=i.display)&&void 0!==n?n:[],globalFilters:[],componentLibrary:i.componentLibrary||[],parentDashboardId:null,metadata:{},theme:{},webhookId:"",isPlayground:!1,createdAt:new Date,updatedAt:new Date,isProgrammatic:!0})})),r})(yield this.programmaticDashboard(this.dataSets),this.dataSets)):r}))}getGlobalLibraries(e){return Ao(this,void 0,void 0,(function*(){const t=(yield this.vizzlyAPIClient).getGlobalLibraryManager(),r=yield t.getGlobalLibraries((null==e?void 0:e.abortController)?{abortSignal:null==e?void 0:e.abortController.signal}:{});return this.globalLibraryPermissions=r.permissions,r.global_libraries.map((e=>{return{id:(t=e).id,name:t.name,library:t.library,createdAt:new Date(t.created_at),updatedAt:new Date(t.updated_at),parentGlobalLibraryId:t.parent_global_library_id};var t}))}))}getViewConfiguration(){return{queryEngineConfig:this.queryEngineConfig}}getIdentityConfig(){return this.identityConfig}query(e,t){return Ao(this,void 0,void 0,(function*(){w("[Services] Querying data with queries:",e);let r=wo;(null==t?void 0:t.instanceId)&&(r=t.instanceId);const n=So._instanceStore[r];((e,t)=>{const r=L().array().items((e=>L().object(Object.assign(Object.assign({},J(e,{})),{timeDimension:L().alternatives(H(e.supportedTimeTruncFunctions),L().valid(null))})))(t)).validate(e,Ii);if(r.error)throw new yi(r.error.message)})(e,n.queryEngineConfig);const i=(()=>{if(null==t?void 0:t.queryEngineEndpoint)return t.queryEngineEndpoint;if(Eo.queryEngine){if("string"==typeof Eo.queryEngine)return Eo.queryEngine;if("string"!=typeof Eo.queryEngine&&"endpoint"in Eo.queryEngine)return Eo.queryEngine.endpoint}})(),o=((e,t,r,n,i,o)=>{var a;let s=(l=e.dashboardAccess,["accessType","dashboardId","projectId","userReference","scope"].map((e=>`${e}:${l[e]}`)).join(":::"));var l;if(n)return(i,o)=>mo(void 0,void 0,void 0,(function*(){var a;return yield ho({type:"custom",queryEngineConfig:t,runQueries:n,dataAccessToken:null===(a=e.dataAccess)||void 0===a?void 0:a.signature,cacheKeyNamespace:s},i,{abortSignal:o.abortSignal,dataSets:o.dataSets,filterConfig:o.filterConfig||{},timeRangeOptions:r})}));if(i)return(e,t)=>mo(void 0,void 0,void 0,(function*(){return yield ho({type:"vizzlyJsQueryEngine",loadData:i,cacheKeyNamespace:s},e,{abortSignal:t.abortSignal,dataSets:t.dataSets,filterConfig:t.filterConfig||{},timeRangeOptions:r})}));if(o&&(null===(a=e.dataAccess)||void 0===a?void 0:a.signature))return(n,i)=>mo(void 0,void 0,void 0,(function*(){var a;return yield ho({type:"vizzlyQueryEngine",queryEngineConfig:t,dataAccessToken:null===(a=e.dataAccess)||void 0===a?void 0:a.signature,queryEngineEndpoint:o,cacheKeyNamespace:s},n,{abortSignal:i.abortSignal,dataSets:i.dataSets,filterConfig:i.filterConfig||{},timeRangeOptions:r})}));throw"Missing required props."})(n.identityConfig,n.queryEngineConfig,((e,t)=>{const r=(e=>{return{today:vo(new Date,e("filter.today","Today")),past_1_day:_o(1,0,e("filter.past_1_day","Last 24 hours")),yesterday:(t=new Date,r=e("filter.yesterday","Yesterday"),{description:r,range:{before:yo(t),after:yo(go(t,1))}}),past_3_days:_o(3,0,e("filter.past_3_days","Last 3 days")),past_7_days:_o(7,0,e("filter.past_7_days","Last 7 days")),past_30_days:_o(30,0,e("filter.past_30_days","Last 30 days")),past_90_days:_o(90,0,e("filter.past_90_days","Last 90 days")),past_3_months:_o(0,3,e("filter.past_3_months","Last 3 months")),past_6_months:_o(0,6,e("filter.past_6_months","Last 6 months")),past_12_months:_o(0,12,e("filter.past_12_months","Last 12 months")),past_18_months:_o(0,18,e("filter.past_18_months","Last 18 months"))};var t,r})(e),n=Object.keys(bo).map((e=>e in r?`_vizzly_${e}`:e)),i=n.indexOf("_vizzly_today");i>-1&&(n.splice(i,1),n.unshift("_vizzly_today"));let o={},a={};for(const e of n){const n=e.replace("_vizzly_",""),i=r[n],o=null==t?void 0:t[n];"boolean"==typeof o?o&&(a[e]=i):null!=o?a[e]=o:!1!==bo[n]&&(a[e]=i)}if(t)for(const[e,r]of Object.entries(t))e in bo||(n.push(e),a[e]=r);for(const e of n)e in a&&(o[e]=a[e]);return o})(Fr,null==t?void 0:t.dateFilterOptions),null==t?void 0:t.runQueries,null==t?void 0:t.data,i);return{results:yield(()=>Ao(this,void 0,void 0,(function*(){var r;try{return yield o(e,{abortSignal:null===(r=null==t?void 0:t.abortController)||void 0===r?void 0:r.signal,dataSets:this.dataSets})}catch(e){return S("[Services] Error fetching data on query:",e),null}})))()}}))}static upcastDashboard(e,t,r){var n;try{const i=En(e,r);return[On(i,t,(null===(n=e.definition)||void 0===n?void 0:n.customFields)||{})]}catch(t){return S(`Failed to upcast dashboard ${e.id}. This dashboard will not be available for use.`,t),[]}}static filterDashboards(e,r){let n=(0,t.cloneDeep)(e);return r.onlyParentDashboards&&(n=n.filter((e=>null===e.parentDashboardId))),r.onlyChildDashboards&&(n=n.filter((e=>null!==e.parentDashboardId))),r.onlyChildDashboardsForParent&&(n=n.filter((e=>e.parentDashboardId===r.onlyChildDashboardsForParent))),r.onlyAllowScope&&(n=n.filter((e=>{var t;return(null===(t=e.permission)||void 0===t?void 0:t.scope)===r.onlyAllowScope}))),r.onlyDashboardsIncludingMetadata&&(n=n.filter((e=>{const n=Object.keys(r.onlyDashboardsIncludingMetadata||{});return(0,t.every)(n,(t=>{var n;return e.metadata[t]===(null===(n=null==r?void 0:r.onlyDashboardsIncludingMetadata)||void 0===n?void 0:n[t])}))}))),n}static validateDashboard(e){L()}updateGlobalLibrary(e){return Ao(this,void 0,void 0,(function*(){try{const t=this.vizzlyAPIClient.getGlobalLibraryManager();return yield t.update(e)}catch(e){S("Error updating global library:",e)}}))}static eventBusController(e,t){var r;return Ao(this,void 0,void 0,(function*(){try{const n=So.use();if(("addComponentToLibrary"===e.action||"deleteComponentFromLibrary"===e.action)&&n.globalLibraryPermissions){Eo.publish({data:{action:"updateToGlobalLibraryStatus",state:Ri.SAVING}});const[i]=yield Promise.all([yield n.getGlobalLibraries({abortController:null==t?void 0:t.abortController})]);let o=Cn(i);"addComponentToLibrary"===e.action&&(o=function(e,t,r){const n=Cn(e);if(!n)throw new Error("No matching library found.");return n.library.views&&n.library.customFields||In(n),function(e,t){if(!e)throw new Error("View array needs initialised");const r=e.findIndex((e=>e.attributes.viewId===(null==t?void 0:t.attributes.viewId)));-1!==r?e[r]=t:e.push(t)}(n.library.views,t),function(e,t){var r;if(!e)throw new Error("View object needs initialised");for(const n in e)e.hasOwnProperty(n)&&(null===(r=t.library.customFields)||void 0===r?void 0:r.hasOwnProperty(n))&&(t.library.customFields[n]=e[n])}(r,n),n}(i,e.component,e.customFields)),"deleteComponentFromLibrary"===e.action&&(o=((e,t)=>{const r=Cn(e);if(!r)throw new Error("No matching library found.");return r.library.views?r.library.views=r.library.views.filter((e=>e.attributes.viewId!==t.attributes.viewId)):r.library.views=[],r})(i,e.component));const a=function(e,t){var r;return(null===(r=e.find((e=>"read_write"===e.scope&&t[0].id===e.globalLibraryId)))||void 0===r?void 0:r.token)||""}(n.globalLibraryPermissions,[o]);((...e)=>{_("info")&&console.info("[VIZZLY INFO]",...e.map(A))})("library and tokens for update",{libraryForUpdate:o,tokenForLibrary:a});const s={globalLibraryId:o.id,library:o.library,abortSignal:null===(r=null==t?void 0:t.abortController)||void 0===r?void 0:r.signal,globalLibrarySessionToken:a};if(yield n.updateGlobalLibrary(s)){let t=Ri.SAVED;"deleteComponentFromLibrary"===e.action&&(t=Ri.DELETED),Eo.publish({data:{action:"newViewsInGlobalLibrary"}}),Eo.publish({data:{action:"updateToGlobalLibraryStatus",state:t}})}}}catch(e){S("Error handling event:",e)}}))}static publish(e){Eo.eventBus.map((t=>{t(e)})),Eo.eventBusController(e.data).catch((e=>{S("Failed to handle event:",e)}))}static subscription(e){return Eo.eventBus.push(e),()=>{Eo.eventBus=Eo.eventBus.filter((t=>t!==e))}}}So._instanceStore={},So.DEFAULT_INSTANCE_ID=wo,So.eventBus=[],So.Row=_i,So.Cell=vi,So.Dashboard=class{constructor(e,t){this.dashboard=void 0;let r={id:e};(null==t?void 0:t.display)&&(r=Object.assign(Object.assign({},r),{display:wi(null==t?void 0:t.display)})),(null==t?void 0:t.customFields)&&(r=Object.assign(Object.assign({},r),{customFields:t.customFields})),(null==t?void 0:t.library)&&(r=Object.assign(Object.assign({},r),{componentLibrary:Ti(null==t?void 0:t.library)})),this.dashboard=(e=>Object.assign({isPlayground:!1,display:[{components:[pn(8),pn(4)],height:un},{components:[pn(4),pn(4),pn(4)],height:un}],componentLibrary:[],globalFilters:[],customFields:{}},e))(r)}setDisplay(e){let t=wi(e);if(!this.dashboard)throw new Error("Dashboard is undefined");this.dashboard.display=t}setCustomFields(e){if(!this.dashboard)throw new Error("Dashboard is undefined");this.dashboard.customFields=e}setLibrary(e){if(!this.dashboard)throw new Error("Dashboard is undefined");this.dashboard.componentLibrary=Ti(e)}build(){var e,t;if(!this.dashboard)throw new Error("Dashboard is undefined");return Object.assign(Object.assign({},this.dashboard),{display:null===(e=this.dashboard)||void 0===e?void 0:e.display,componentLibrary:null===(t=this.dashboard)||void 0===t?void 0:t.componentLibrary})}},So.Editor=class{constructor(e){this.editor=void 0,(null==e?void 0:e.component)&&(this.editor=e.component)}setComponent(e){if(!this.editor)throw new Error("Editor is undefined");this.editor=e}build(){if(!this.editor)throw new Error("Editor is undefined");return((e,t)=>{var r,n;if(!e.attributes)throw new Error("Component attributes are required in saveable");return{attributes:Object.assign(Object.assign({},e.attributes),{protectedByOrganisation:void 0}),localFilters:null!==(r=e.localFilters)&&void 0!==r?r:[],colSpan:1,results:[],updatesFromParameters:null!==(n=e.updatesFromParameters)&&void 0!==n?n:{},reports:[]}})({attributes:this.editor.attributes})}},So.Header=Ai,So.Library=class{constructor(e){this.library=void 0,this.library=[],(null==e?void 0:e.components)&&this.addComponents(null==e?void 0:e.components)}addComponent(e,t,r){var n,i;try{Si({component:e,uniqueViewId:t});const o=new vi({component:Ei(e,t),colSpan:1,localFilters:null==r?void 0:r.localFilters});void 0===(null==r?void 0:r.position)?null===(n=this.library)||void 0===n||n.push(o):null===(i=this.library)||void 0===i||i.splice(r.position,0,o)}catch(e){throw new bi(e,"Library.addComponent")}}addComponents(e){try{if(void 0===e)throw new bi("Components are undefined","Library.addComponents");e.forEach((e=>{var t;Si(e);const r=new vi({component:Ei(e.component,e.uniqueViewId),colSpan:1});null===(t=this.library)||void 0===t||t.push(r)}))}catch(e){throw new bi(e,"Library.addComponents")}}},So.AreaChart=class extends Oi{constructor(e){super(Object.assign(Object.assign({},e),{type:"areaChart"}))}static type(){return"areaChart"}},So.LineChart=class extends Oi{constructor(e){super(Object.assign(Object.assign({},e),{type:"lineChart"}))}static type(){return"lineChart"}},So.BarChart=class extends Oi{constructor(e){super(Object.assign(Object.assign({},e),{type:"barChart"}))}static type(){return"barChart"}},So.PieChart=class extends Oi{constructor(e){super(Object.assign(Object.assign({},e),{type:"pieChart"}))}static type(){return"pieChart"}},So.ScatterChart=class extends Oi{constructor(e){super(Object.assign(Object.assign({},e),{type:"scatterChart"}))}static type(){return"scatterChart"}},So.ComboChart=class extends Oi{constructor(e){super(Object.assign(Object.assign({},e),{type:"comboChart"}))}static type(){return"comboChart"}},So.PivotTable=class extends Oi{constructor(e){super(Object.assign(Object.assign({},e),{type:"dataTable"}))}static type(){return"dataTable"}},So.BasicTable=class extends Oi{constructor(e){super(Object.assign(Object.assign({},e),{type:"basicTable"}))}static type(){return"basicTable"}},So.HorizontalBarChart=class extends Oi{constructor(e){super(Object.assign(Object.assign({},e),{type:"horizontalBarChart"}))}static type(){return"horizontalBarChart"}},So.MercatorMap=class extends Oi{constructor(e){super(Object.assign(Object.assign({},e),{type:"mercatorMap"}))}static type(){return"mercatorMap"}},So.SingleStat=class extends Oi{constructor(e){super(Object.assign(Object.assign({},e),{type:"singleStat"}))}static type(){return"singleStat"}},So.Progress=class extends Oi{constructor(e){super(Object.assign(Object.assign({},e),{type:"progress"}))}static type(){return"progress"}},"undefined"==typeof window||window.Vizzly||(window.Vizzly=So);const Eo="undefined"!=typeof window&&window.Vizzly||So})();var i=n.B,o=n.Q;export{i as Vizzly,o as VizzlyInstanceNotLoaded};
2
+ var e={4579:e=>{var t;self,t=()=>(()=>{var e={514:(e,t,r)=>{const{clone:n}=r(8870),i=r(8160),o={annotations:Symbol("annotations")};t.error=function(e){if(!this._original||"object"!=typeof this._original)return this.details[0].message;const t=e?"":"",r=e?"":"",a=e?"":"",s=n(this._original);for(let e=this.details.length-1;e>=0;--e){const t=e+1,r=this.details[e],n=r.path;let a=s;for(let e=0;;++e){const s=n[e];if(i.isSchema(a)&&(a=a.clone()),!(e+1<n.length&&"string"!=typeof a[s])){const e=a[o.annotations]||{errors:{},missing:{}};a[o.annotations]=e;const n=s||r.context.key;void 0!==a[s]?(e.errors[n]=e.errors[n]||[],e.errors[n].push(t)):e.missing[n]=t;break}a=a[s]}}let l=o.safeStringify(s,2).replace(/_\$key\$_([, \d]+)_\$end\$_"/g,((e,r)=>`" ${t}[${r}]${a}`)).replace(/"_\$miss\$_([^|]+)\|(\d+)_\$end\$_": "__missing__"/g,((e,n,i)=>`${r}"${n}"${a}${t} [${i}]: -- missing --${a}`)).replace(/\s*"_\$idx\$_([, \d]+)_\$end\$_",?\n(.*)/g,((e,r,n)=>`\n${n} ${t}[${r}]${a}`)).replace(/"\[(NaN|Symbol.*|-?Infinity|function.*|\(.*)]"/g,((e,t)=>t));l=`${l}\n${t}`;for(let e=0;e<this.details.length;++e)l=`${l}\n[${e+1}] ${this.details[e].message}`;return l+=a,l},o.safeStringify=function(e,t){return JSON.stringify(e,o.serializer(),t)},o.serializer=function(){const e=[],t=[],r=(r,n)=>t[0]===n?"[Circular ~]":"[Circular ~."+e.slice(0,t.indexOf(n)).join(".")+"]";return function(n,i){if(t.length>0){const o=t.indexOf(this);~o?(t.length=o+1,e.length=o+1,e[o]=n):(t.push(this),e.push(n)),~t.indexOf(i)&&(i=r.call(this,n,i))}else t.push(i);if(i){const e=i[o.annotations];if(e){if(Array.isArray(i)){const t=[];for(let r=0;r<i.length;++r)e.errors[r]&&t.push(`_$idx$_${e.errors[r].sort().join(", ")}_$end$_`),t.push(i[r]);i=t}else{for(const t in e.errors)i[`${t}_$key$_${e.errors[t].sort().join(", ")}_$end$_`]=i[t],i[t]=void 0;for(const t in e.missing)i[`_$miss$_${t}|${e.missing[t]}_$end$_`]="__missing__"}return i}}return i===1/0||i===-1/0||Number.isNaN(i)||"function"==typeof i||"symbol"==typeof i?"["+i.toString()+"]":i}}},7629:(e,t,r)=>{const{assert:n,clone:i,deepEqual:o,merge:a}=r(8870),s=r(8652),l=r(8160),u=r(3292),c=r(6354),d=r(8901),p=r(1123),f=r(6914),h=r(2294),m=r(6133),g=r(2305),y=r(8863),b=r(2036),v={Base:class{constructor(e){this.type=e,this.$_root=null,this._definition={},this._reset()}_reset(){this._ids=new h.Ids,this._preferences=null,this._refs=new m.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 p.describe,"Manifest functionality disabled"),p.describe(this)}allow(...e){return l.verifyFlat(e,"allow"),this._values(e,"_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 i=e[r];n("function"==typeof i,"Alteration adjuster for",r,"must be a function"),t.$_terms.alterations.push({target:r,adjuster:i})}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,t={}){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(...e){return this._values(e,"_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(...e){n(e.length,"Missing notes");for(const t of e)n(t&&"string"==typeof t,"Notes must be non-empty strings");return this._inner("notes",e)}only(e=!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(e=!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(e=!0){return this.$_setFlag("result",e?"strip":void 0)}tag(...e){n(e.length,"Missing tags");for(const t of e)n(t&&"string"==typeof t,"Tags must be non-empty strings");return this._inner("tags",e)}unit(e){return n(e&&"string"==typeof e,"Unit name must be a non-empty string"),this.$_setFlag("unit",e)}valid(...e){l.verifyFlat(e,"valid");const t=this.allow(...e);return t.$_setFlag("only",!!t._valids,{clone:!1}),t}when(e,t){const r=this.clone();r.$_terms.whens||(r.$_terms.whens=[]);const i=u.when(r,e,t);if(!["any","link"].includes(r.type)){const e=i.is?[i]:i.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(i),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||s.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,m.toSibling),t._preferences=t._preferences?l.preferences(t._preferences,e._preferences):e._preferences,t._valids=b.merge(t._valids,e._valids,e._invalids),t._invalids=b.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,a(t._flags,r)}else if(e._flags.empty){t._flags.empty=e._flags.empty;const r=Object.assign({},e._flags);delete r.empty,a(t._flags,r)}else a(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"),d.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 o=this.clone();for(let a=r;a<o._rules.length;++a){const r=o._rules[a],s=i(r);for(const i in e)t.modifiers[i](s,e[i]),n(s.name===r.name,"Cannot change rule name");o._rules[a]=s,o._singleRules.get(s.name)===r&&o._singleRules.set(s.name,s)}return o.$_temp.ruleset=!1,o.$_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:i}of this.$_terms.alterations)e.includes(r)&&(t=i(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],i=t.args;n(r,"Unknown rule",t.method);const o=this.clone();if(i){n(1===Object.keys(i).length||Object.keys(i).length===this._definition.rules[t.name].args.length,"Invalid rule definition for",this.type,t.name);for(const e in i){let a=i[e];if(r.argsByName){const s=r.argsByName.get(e);if(s.ref&&l.isResolvable(a))t._resolve.push(e),o.$_mutateRegister(a);else if(s.normalize&&(a=s.normalize(a),i[e]=a),s.assert){const t=l.validateArg(a,e,s);n(!t,t,"or reference")}}void 0!==a?i[e]=a:delete i[e]}}return r.multi||(o._ruleRemove(t.name,{clone:!1}),o._singleRules.set(t.name,t)),!1===o.$_temp.ruleset&&(o.$_temp.ruleset=null),r.priority?o._rules.unshift(t):o._rules.push(t),o}$_compile(e,t){return u.schema(this.$_root,e,t)}$_createError(e,t,r,n,i,o={}){const a=!1!==o.flags?this._flags:{},s=o.messages?f.merge(this._definition.messages,o.messages):this._definition.messages;return new c.Report(e,t,r,a,s,n,i)}$_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 i=!y.validate(e,this,t,r,n).errors;return t.restore(),i}$_modify(e){return l.assertOptions(e,["each","once","ref","schema"]),h.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,{source:t,name:r,path:n,key:i})=>{const o=this._definition[t][r]&&this._definition[t][r].register;!1!==o&&this.$_mutateRegister(e,{family:o,key:i})}}),this._definition.rebuild&&this._definition.rebuild(this),this.$_temp.ruleset=!1,this}$_mutateRegister(e,{family:t,key:r}={}){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,r={}){n("_"===e[0]||!this._inRuleset(),"Cannot set flag inside a ruleset");const i=this._definition.flags[e]||{};if(o(t,i.default)&&(t=void 0),o(t,this._flags[e]))return this;const a=!1!==r.clone?this.clone():this;return void 0!==t?(a._flags[e]=t,a.$_mutateRegister(t)):delete a._flags[e],"_"!==e[0]&&(a.$_temp.ruleset=!1),a}$_parent(e,...t){return this[e][l.symbols.parent].call(this,...t)}$_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=i(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,r={}){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=[],i=[];for(let o=0;o<this.$_terms.whens.length;++o){const a=this.$_terms.whens[o];if(a.concat){n.push(a.concat),i.push(`${o}.concat`);continue}const s=a.ref?a.ref.resolve(e,t,r):e,l=a.is?[a]:a.switch,u=i.length;for(let u=0;u<l.length;++u){const{is:c,then:d,otherwise:p}=l[u],f=`${o}${a.switch?"."+u:""}`;if(c.$_match(s,t.nest(c,`${f}.is`),r)){if(d){const o=t.localize([...t.path,`${f}.then`],t.ancestors,t.schemas),{schema:a,id:s}=d._generate(e,o,r);n.push(a),i.push(`${f}.then${s?`(${s})`:""}`);break}}else if(p){const o=t.localize([...t.path,`${f}.otherwise`],t.ancestors,t.schemas),{schema:a,id:s}=p._generate(e,o,r);n.push(a),i.push(`${f}.otherwise${s?`(${s})`:""}`);break}}if(a.break&&i.length>u)break}const o=i.join(", ");if(t.mainstay.tracer.debug(t,"rule","when",o),!o)return{schema:this};if(!t.mainstay.tracer.active&&this.$_temp.whens[o])return{schema:this.$_temp.whens[o],id:o};let a=this;this._definition.generate&&(a=this._definition.generate(this,e,t,r));for(const e of n)a=a.concat(e);return this.$_root._tracer&&this.$_root._tracer._combine(a,[this,...n]),this.$_temp.whens[o]=a,{schema:a,id:o}}_inner(e,t,r={}){n(!this._inRuleset(),`Cannot set ${e} inside a ruleset`);const i=this.clone();return i.$_terms[e]&&!r.override||(i.$_terms[e]=[]),r.single?i.$_terms[e].push(t):i.$_terms[e].push(...t),i.$_temp.ruleset=!1,i}_inRuleset(){return null!==this.$_temp.ruleset&&!1!==this.$_temp.ruleset}_ruleRemove(e,t={}){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 i=r._rules[t];i.name!==e||i.keep?n.push(i):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(),i=e[0]===l.symbols.override;if(i&&(e=e.slice(1)),!r[t]&&e.length?r[t]=new b:i&&(r[t]=e.length?new b:null,r.$_mutateRebuild()),!r[t])return r;i&&r[t].override();for(const i of e){n(void 0!==i,"Cannot call allow/valid/invalid with undefined"),n(i!==l.symbols.override,"Override must be the first value");const e="_invalids"===t?"_valids":"_invalids";r[e]&&(r[e].remove(i),r[e].length||(n("_valids"===t||!r._flags.only,"Setting invalid value",i,"leaves schema rejecting all values due to previous valid rule"),r[e]=null)),r[t].add(i,r._refs)}return r}}};v.Base.prototype[l.symbols.any]={version:l.version,compile:u.compile,root:"$_root"},v.Base.prototype.isImmutable=!0,v.Base.prototype.deny=v.Base.prototype.invalid,v.Base.prototype.disallow=v.Base.prototype.invalid,v.Base.prototype.equal=v.Base.prototype.valid,v.Base.prototype.exist=v.Base.prototype.required,v.Base.prototype.not=v.Base.prototype.invalid,v.Base.prototype.options=v.Base.prototype.prefs,v.Base.prototype.preferences=v.Base.prototype.prefs,e.exports=new v.Base},8652:(e,t,r)=>{const{assert:n,clone:i}=r(8870),o=r(8160),a={max:1e3,supported:new Set(["undefined","boolean","number","string"])};t.provider={provision:e=>new a.Cache(e)},a.Cache=class{constructor(e={}){o.assertOptions(e,["max"]),n(void 0===e.max||e.max&&e.max>0&&isFinite(e.max),"Invalid max cache size"),this._max=e.max||a.max,this._map=new Map,this._list=new a.List}get length(){return this._map.size}set(e,t){if(null!==e&&!a.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),i(t.value)}_compact(){if(this._map.size>this._max){const e=this._list.pop();this._map.delete(e.key)}}},a.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)=>{const{assert:n,AssertError:i}=r(8870),o=r(5934);let a,s;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=o.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,r="Options"){n(e&&"object"==typeof e&&!Array.isArray(e),"Options must be of type object");const i=Object.keys(e).filter((e=>!t.includes(e)));n(0===i.length,`${r} contain unknown keys: ${i}`)},t.checkPreferences=function(e){s=s||r(3378);const t=s.preferences.validate(e);if(t.error)throw new i([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,r={}){const i=e&&e[t.symbols.any];return!!i&&(n(r.legacy||i.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){a=a||r(6914),e=e||{},n=n||{};const i=Object.assign({},e,n);return n.errors&&e.errors&&(i.errors=Object.assign({},e.errors,n.errors),i.errors.wrap=Object.assign({},e.errors.wrap,n.errors.wrap)),n.messages&&(i.messages=a.compile(n.messages,e.messages)),delete i[t.symbols.prefs],i},t.tryWithPath=function(e,t,r={}){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,{assert:n,message:i}){if(t.isSchema(n)){const t=n.validate(e);if(!t.error)return;return t.error.message}if(!n(e))return r?`${r} ${i}`:i},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)=>{const{assert:n}=r(8870),i=r(8160),o=r(6133),a={};t.schema=function(e,t,r={}){i.assertOptions(r,["appendPath","override"]);try{return a.schema(e,t,r)}catch(e){throw r.appendPath&&void 0!==e.path&&(e.message=`${e.message} (${e.path})`),e}},a.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 o=(t,...n)=>!1!==r.override?t.valid(e.override,...n):t.valid(...n);if(a.simple(t))return o(e,t);if("function"==typeof t)return e.custom(t);if(n("object"==typeof t,"Invalid schema content:",typeof t),i.isResolvable(t))return o(e,t);if(i.isSchema(t))return t;if(Array.isArray(t)){for(const r of t)if(!a.simple(r))return e.alternatives().try(...t);return o(e,...t)}return t instanceof RegExp?e.string().regex(t):t instanceof Date?o(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 o.isRef(e)?e:o.create(e,t)},t.compile=function(e,r,o={}){i.assertOptions(o,["legacy"]);const s=r&&r[i.symbols.any];if(s)return n(o.legacy||s.version===i.version,"Cannot mix different versions of joi schemas:",s.version,i.version),r;if("object"!=typeof r||!o.legacy)return t.schema(e,r,{appendPath:!0});const l=a.walk(r);return l?l.compile(l.root,r):t.schema(e,r,{appendPath:!0})},a.walk=function(e){if("object"!=typeof e)return null;if(Array.isArray(e)){for(const t of e){const e=a.walk(t);if(e)return e}return null}const t=e[i.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=a.walk(e[t]);if(r)return r}return null},a.simple=function(e){return null===e||["boolean","string","number"].includes(typeof e)},t.when=function(e,r,s){if(void 0===s&&(n(r&&"object"==typeof r,"Missing options"),s=r,r=o.create(".")),Array.isArray(s)&&(s={switch:s}),i.assertOptions(s,["is","not","then","otherwise","switch","break"]),i.isSchema(r))return n(void 0===s.is,'"is" can not be used with a schema condition'),n(void 0===s.not,'"not" can not be used with a schema condition'),n(void 0===s.switch,'"switch" can not be used with a schema condition'),a.condition(e,{is:r,then:s.then,otherwise:s.otherwise,break:s.break});if(n(o.isRef(r)||"string"==typeof r,"Invalid condition:",r),n(void 0===s.not||void 0===s.is,'Cannot combine "is" with "not"'),void 0===s.switch){let l=s;void 0!==s.not&&(l={is:s.not,then:s.otherwise,otherwise:s.then,break:s.break});let u=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===s.is||o.isRef(s.is)||i.isSchema(s.is)||(u=u.required()),a.condition(e,{ref:t.ref(r),is:u,then:l.then,otherwise:l.otherwise,break:l.break})}n(Array.isArray(s.switch),'"switch" must be an array'),n(void 0===s.is,'Cannot combine "switch" with "is"'),n(void 0===s.not,'Cannot combine "switch" with "not"'),n(void 0===s.then,'Cannot combine "switch" with "then"');const l={ref:t.ref(r),switch:[],break:s.break};for(let t=0;t<s.switch.length;++t){const r=s.switch[t],a=t===s.switch.length-1;i.assertOptions(r,a?["is","then","otherwise"]:["is","then"]),n(void 0!==r.is,'Switch statement missing "is"'),n(void 0!==r.then,'Switch statement missing "then"');const u={is:e.$_compile(r.is),then:e.$_compile(r.then)};if(o.isRef(r.is)||i.isSchema(r.is)||(u.is=u.is.required()),a){n(void 0===s.otherwise||void 0===r.otherwise,'Cannot specify "otherwise" inside and outside a "switch"');const t=void 0!==s.otherwise?s.otherwise:r.otherwise;void 0!==t&&(n(void 0===l.break,"Cannot specify both otherwise and break"),u.otherwise=e.$_compile(t))}l.switch.push(u)}return l},a.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)=>{const n=r(514),i=r(8160),o=r(3328);t.Report=class{constructor(e,r,n,i,o,a,s){if(this.code=e,this.flags=i,this.messages=o,this.path=a.path,this.prefs=s,this.state=a,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,a){if(!t)return;if(o.isTemplate(t))return"root"!==r?t:null;let s=a.errors.language;if(i.isResolvable(s)&&(s=s.resolve(e,n,a)),s&&t[s]){if(void 0!==t[s][r])return t[s][r];if(void 0!==t[s]["*"])return t[s]["*"]}return t[r]?t[r]:t["*"]},t.label=function(e,r,n,i){if(e.label)return e.label;if(!n.errors.label)return"";let o=r.path;return"key"===n.errors.label&&r.path.length>1&&(o=r.path.slice(-1)),t.path(o)||t.template(null,n.messages,"root",r,n)||i&&t.template(null,i,"root",r,n)||"value"},t.process=function(e,r,n){if(!e)return null;const{override:i,message:o,details:a}=t.details(e);if(i)return i;if(n.errors.stack)return new t.ValidationError(o,a,r);const s=Error.stackTraceLimit;Error.stackTraceLimit=0;const l=new t.ValidationError(o,a,r);return Error.stackTraceLimit=s,l},t.details=function(e,t={}){let r=[];const n=[];for(const i of e){if(i instanceof Error){if(!1!==t.override)return{override:i};const e=i.toString();r.push(e),n.push({message:e,type:"override",context:{error:i}});continue}const e=i.toString();r.push(e),n.push({message:e,path:i.path.filter((e=>"object"!=typeof e)),type:i.code,context:i.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)=>{const{assert:n,clone:i}=r(8870),o=r(8160),a=r(6914),s={};t.type=function(e,t){const r=Object.getPrototypeOf(e),l=i(r),u=e._assign(Object.create(l)),c=Object.assign({},t);delete c.base,l._definition=c;const d=r._definition||{};c.messages=a.merge(d.messages,c.messages),c.properties=Object.assign({},d.properties,c.properties),u.type=c.type,c.flags=Object.assign({},d.flags,c.flags);const p=Object.assign({},d.terms);if(c.terms)for(const e in c.terms){const t=c.terms[e];n(void 0===u.$_terms[e],"Invalid term override for",c.type,e),u.$_terms[e]=t.init,p[e]=t}c.terms=p,c.args||(c.args=d.args),c.prepare=s.prepare(c.prepare,d.prepare),c.coerce&&("function"==typeof c.coerce&&(c.coerce={method:c.coerce}),c.coerce.from&&!Array.isArray(c.coerce.from)&&(c.coerce={method:c.coerce.method,from:[].concat(c.coerce.from)})),c.coerce=s.coerce(c.coerce,d.coerce),c.validate=s.validate(c.validate,d.validate);const f=Object.assign({},d.rules);if(c.rules)for(const e in c.rules){const t=c.rules[e];n("object"==typeof t,"Invalid rule definition for",c.type,e);let r=t.method;if(void 0===r&&(r=function(){return this.$_addRule(e)}),r&&(n(!l[e],"Rule conflict in",c.type,e),l[e]=r),n(!f[e],"Rule conflict in",c.type,e),f[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),o.isSchema(e.assert)&&(e.assert=e.assert.strict().label(e.name)),t.argsByName.set(e.name,e),e))))}c.rules=f;const h=Object.assign({},d.modifiers);if(c.modifiers)for(const e in c.modifiers){n(!l[e],"Rule conflict in",c.type,e);const t=c.modifiers[e];n("function"==typeof t,"Invalid modifier definition for",c.type,e);const r=function(t){return this.rule({[e]:t})};l[e]=r,h[e]=t}if(c.modifiers=h,c.overrides){l._super=r,u.$_super={};for(const e in c.overrides)n(r[e],"Cannot override missing",e),c.overrides[e][o.symbols.parent]=r[e],u.$_super[e]=r[e].bind(u);Object.assign(l,c.overrides)}c.cast=Object.assign({},d.cast,c.cast);const m=Object.assign({},d.manifest,c.manifest);return m.build=s.build(c.manifest&&c.manifest.build,d.manifest&&d.manifest.build),c.manifest=m,c.rebuild=s.rebuild(c.rebuild,d.rebuild),u},s.build=function(e,t){return e&&t?function(r,n){return t(e(r,n),n)}:e||t},s.coerce=function(e,t){return e&&t?{from:e.from&&t.from?[...new Set([...e.from,...t.from])]:null,method(r,n){let i;if((!t.from||t.from.includes(typeof r))&&(i=t.method(r,n),i)){if(i.errors||void 0===i.value)return i;r=i.value}if(!e.from||e.from.includes(typeof r)){const t=e.method(r,n);if(t)return t}return i}}:e||t},s.prepare=function(e,t){return e&&t?function(r,n){const i=e(r,n);if(i){if(i.errors||void 0===i.value)return i;r=i.value}return t(r,n)||i}:e||t},s.rebuild=function(e,t){return e&&t?function(r){t(r),e(r)}:e||t},s.validate=function(e,t){return e&&t?function(r,n){const i=t(r,n);if(i){if(i.errors&&(!Array.isArray(i.errors)||i.errors.length))return i;r=i.value}return e(r,n)||i}:e||t}},5107:(e,t,r)=>{const{assert:n,clone:i}=r(8870),o=r(8652),a=r(8160),s=r(3292),l=r(6354),u=r(8901),c=r(1123),d=r(6133),p=r(3328),f=r(2305);let h;const m={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(m.types))};for(const t of e._types)e[t]=function(...e){return n(!e.length||["alternatives","link","object"].includes(t),"The",t,"type does not allow arguments"),m.generate(this,m.types[t],e)};for(const t of["allow","custom","disallow","equal","exist","forbidden","invalid","not","only","optional","options","prefs","preferences","required","strip","valid","when"])e[t]=function(...e){return this.any()[t](...e)};Object.assign(e,m.methods);for(const t in m.aliases){const r=m.aliases[t];e[t]=e[r]}return e.x=e.expression,f.setup&&f.setup(e),e}};m.methods={ValidationError:l.ValidationError,version:a.version,cache:o.provider,assert(e,t,...r){m.assert(e,t,!0,r)},attempt:(e,t,...r)=>m.assert(e,t,!1,r),build(e){return n("function"==typeof c.build,"Manifest functionality disabled"),c.build(this,e)},checkPreferences(e){a.checkPreferences(e)},compile(e,t){return s.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 i=e(t[r]());n(a.isSchema(i),"modifier must return a valid schema object"),t[r]=function(...e){return m.generate(this,i,e)}}return t},expression:(...e)=>new p(...e),extend(...e){a.verifyFlat(e,"extend"),h=h||r(3378),n(e.length,"You need to provide at least one extension"),this.assert(e,h.extensions);const t=Object.assign({},this);t._types=new Set(t._types);for(let r of e){"function"==typeof r&&(r=r(t)),this.assert(r,h.extension);const e=m.expandExtension(r,t);for(const r of e){n(void 0===t[r.type]||t._types.has(r.type),"Cannot override name",r.type);const e=r.base||this.any(),i=u.type(e,r);t._types.add(r.type),t[r.type]=function(...e){return m.generate(this,i,e)}}}return t},isError:l.ValidationError.isError,isExpression:p.isTemplate,isRef:d.isRef,isSchema:a.isSchema,in:(...e)=>d.in(...e),override:a.symbols.override,ref:(...e)=>d.create(...e),types(){const e={};for(const t of this._types)e[t]=this[t]();for(const t in m.aliases)e[t]=this[t]();return e}},m.assert=function(e,t,r,n){const o=n[0]instanceof Error||"string"==typeof n[0]?n[0]:null,s=null!==o?n[1]:n[0],u=t.validate(e,a.preferences({errors:{stack:!0}},s||{}));let c=u.error;if(!c)return u.value;if(o instanceof Error)throw o;const d=r&&"function"==typeof c.annotate?c.annotate():c.message;throw c instanceof l.ValidationError==0&&(c=i(c)),c.message=o?`${o} ${d}`:d,c},m.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},m.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 i=Object.assign({},e);i.type=n,i.base=t[n](),r.push(i)}return r},e.exports=m.root()},1123:(e,t,r)=>{const{assert:n,clone:i}=r(8870),o=r(8160),a=r(6914),s=r(6133),l=r(3328);let u;const c={};t.describe=function(e){const t=e._definition,r={type:e.type,flags:{},rules:[]};for(const t in e._flags)"_"!==t[0]&&(r.flags[t]=c.describe(e._flags[t]));Object.keys(r.flags).length||delete r.flags,e._preferences&&(r.preferences=i(e._preferences,{shallow:["messages"]}),delete r.preferences[o.symbols.prefs],r.preferences.messages&&(r.preferences.messages=a.decompile(r.preferences.messages))),e._valids&&(r.allow=e._valids.describe()),e._invalids&&(r.invalid=e._invalids.describe());for(const n of e._rules){if(!1===t.rules[n.name].manifest)continue;const e={name:n.name};for(const r in t.modifiers)void 0!==n[r]&&(e[r]=c.describe(n[r]));if(n.args){e.args={};for(const t in n.args){const r=n.args[t];("options"!==t||Object.keys(r).length)&&(e.args[t]=c.describe(r,{assign:t}))}Object.keys(e.args).length||delete e.args}r.rules.push(e)}r.rules.length||delete r.rules;for(const i in e.$_terms){if("_"===i[0])continue;n(!r[i],"Cannot describe schema due to internal name conflict with",i);const a=e.$_terms[i];if(!a)continue;if(a instanceof Map){a.size&&(r[i]=[...a.entries()]);continue}if(o.isValues(a)){r[i]=a.describe();continue}n(t.terms[i],"Term",i,"missing configuration");const s=t.terms[i].manifest,l="object"==typeof s;if(!a.length&&!l)continue;const u=[];for(const e of a)u.push(c.describe(e));if(l){const{from:e,to:t}=s.mapped;r[i]={};for(const n of u)r[i][n[t]]=n[e]}else"single"!==s?r[i]=u:(n(1===u.length,"Term",i,"contains more than one item"),r[i]=u[0])}return c.validate(e.$_root,r),r},c.describe=function(e,t={}){if(Array.isArray(e))return e.map(c.describe);if(e===o.symbols.deepDefault)return{special:"deep"};if("object"!=typeof e||null===e)return e;if("options"===t.assign)return i(e);if(e instanceof Date)return e.toISOString();if(e instanceof Error)return e;if(e instanceof RegExp)return"regex"===t.assign?e.toString():{regex:e.toString()};if(e[o.symbols.literal])return{function:e.literal};if("function"==typeof e.describe)return"ref"===t.assign?e.describe().ref:e.describe();const r={};for(const t in e){const n=e[t];void 0!==n&&(r[t]=c.describe(n,{assign:t}))}return r},t.build=function(e,t){return new c.Builder(e).parse(t)},c.Builder=class{constructor(e){this.joi=e}parse(e){c.validate(this.joi,e);let t=this.joi[e.type]()._bare();const r=t._definition;if(e.flags)for(const i in e.flags){const o=r.flags[i]&&r.flags[i].setter||i;n("function"==typeof t[o],"Invalid flag",i,"for type",e.type),t=t[o](this.build(e.flags[i]))}if(e.preferences&&(t=t.preferences(this.build(e.preferences))),e.allow&&(t=t.allow(...this.build(e.allow))),e.invalid&&(t=t.invalid(...this.build(e.invalid))),e.rules)for(const i of e.rules){n("function"==typeof t[i.name],"Invalid rule",i.name,"for type",e.type);const o=[];if(i.args){const t={};for(const e in i.args)t[e]=this.build(i.args[e],{assign:e});const a=Object.keys(t),s=r.rules[i.name].args;if(s){n(a.length<=s.length,"Invalid number of arguments for",e.type,i.name,"(expected up to",s.length,", found",a.length,")");for(const{name:e}of s)o.push(t[e])}else n(1===a.length,"Invalid number of arguments for",e.type,i.name,"(expected up to 1, found",a.length,")"),o.push(t[a[0]])}t=t[i.name](...o);const a={};for(const e in r.modifiers)void 0!==i[e]&&(a[e]=this.build(i[e]));Object.keys(a).length&&(t=t.rule(a))}const i={};for(const t in e){if(["allow","flags","invalid","whens","preferences","rules","type"].includes(t))continue;n(r.terms[t],"Term",t,"missing configuration");const o=r.terms[t].manifest;if("schema"!==o)if("values"!==o)if("single"!==o)if("object"!=typeof o)i[t]=this.build(e[t]);else{i[t]={};for(const r in e[t]){const n=e[t][r];i[t][r]=this.parse(n)}}else i[t]=this.build(e[t]);else i[t]=e[t].map((e=>this.build(e)));else i[t]=e[t].map((e=>this.parse(e)))}return e.whens&&(i.whens=e.whens.map((e=>this.build(e)))),t=r.manifest.build(t,i),t.$_temp.ruleset=!1,t}build(e,t={}){if(null===e)return null;if(Array.isArray(e))return e.map((e=>this.build(e)));if(e instanceof Error)return e;if("options"===t.assign)return i(e);if("regex"===t.assign)return c.regex(e);if("ref"===t.assign)return s.build(e);if("object"!=typeof e)return e;if(1===Object.keys(e).length){if(e.buffer)return n(!1,"Buffers are not supported"),!1;if(e.function)return{[o.symbols.literal]:!0,literal:e.function};if(e.override)return o.symbols.override;if(e.ref)return s.build(e.ref);if(e.regex)return c.regex(e.regex);if(e.special)return n(["deep"].includes(e.special),"Unknown special value",e.special),o.symbols.deepDefault;if(e.value)return i(e.value)}if(e.type)return this.parse(e);if(e.template)return l.build(e);const r={};for(const t in e)r[t]=this.build(e[t],{assign:t});return r}},c.regex=function(e){const t=e.lastIndexOf("/"),r=e.slice(1,t),n=e.slice(t+1);return new RegExp(r,n)},c.validate=function(e,t){u=u||r(3378),e.assert(t,u.description)}},6914:(e,t,r)=>{const{assert:n,clone:i}=r(8870),o=r(3328);t.compile=function(e,t){if("string"==typeof e)return n(!t,"Cannot set single message string"),new o(e);if(o.isTemplate(e))return n(!t,"Cannot set single message template"),e;n("object"==typeof e&&!Array.isArray(e),"Invalid message options"),t=t?i(t):{};for(let r in e){const i=e[r];if("root"===r||o.isTemplate(i)){t[r]=i;continue}if("string"==typeof i){t[r]=new o(i);continue}n("object"==typeof i&&!Array.isArray(i),"Invalid message for",r);const a=r;for(r in t[a]=t[a]||{},i){const e=i[r];"root"===r||o.isTemplate(e)?t[a][r]=e:(n("string"==typeof e,"Invalid message for",r,"in",a),t[a][r]=new o(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(o.isTemplate(n)){t[r]=n.describe({compact:!0});continue}const i=r;for(r in t[i]={},n){const e=n[r];"root"!==r?t[i][r]=e.describe({compact:!0}):t[i].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 o(r);if(o.isTemplate(r))return r;const a=i(e);for(let e in r){const t=r[e];if("root"===e||o.isTemplate(t)){a[e]=t;continue}if("string"==typeof t){a[e]=new o(t);continue}n("object"==typeof t&&!Array.isArray(t),"Invalid message for",e);const i=e;for(e in a[i]=a[i]||{},t){const r=t[e];"root"===e||o.isTemplate(r)?a[i][e]=r:(n("string"==typeof r,"Invalid message for",e,"in",i),a[i][e]=new o(r))}}return a}},2294:(e,t,r)=>{const{assert:n}=r(8870),i=r(8160),o=r(6133),a={};t.Ids=a.Ids=class{constructor(){this._byId=new Map,this._byKey=new Map,this._schemaChain=!1}clone(){const e=new a.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 o=this._collect(e);o.push({schema:r});const s=o.shift();let l={id:s.id,schema:t(s.schema)};n(i.isSchema(l.schema),"adjuster function failed to return a joi schema type");for(const e of o)l={id:e.id,schema:a.fork(e.schema,l.id,l.schema)};return l.schema}labels(e,t=[]){const r=e[0],n=this._get(r);if(!n)return[...t,...e].join(".");const i=e.slice(1);return t=[...t,n.schema._flags.label||r],i.length?n.schema._ids.labels(i,t):t.join(".")}reach(e,t=[]){const r=e[0],i=this._get(r);n(i,"Schema does not contain path",[...t,...e].join("."));const o=e.slice(1);return o.length?i.schema._ids.reach(o,[...t,r]):i.schema}register(e,{key:t}={}){if(!e||!i.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,t=[],r=[]){const i=e[0],o=this._get(i);n(o,"Schema does not contain path",[...t,...e].join(".")),r=[o,...r];const a=e.slice(1);return a.length?o.schema._ids._collect(a,[...t,i],r):r}_get(e){return this._byId.get(e)||this._byKey.get(e)}},a.fork=function(e,r,n){const i=t.schema(e,{each:(e,{key:t})=>{if(r===(e._flags.id||t))return n},ref:!1});return i?i.$_mutateRebuild():e},t.schema=function(e,t){let r;for(const n in e._flags){if("_"===n[0])continue;const i=a.scan(e._flags[n],{source:"flags",name:n},t);void 0!==i&&(r=r||e.clone(),r._flags[n]=i)}for(let n=0;n<e._rules.length;++n){const i=e._rules[n],o=a.scan(i.args,{source:"rules",name:i.name},t);if(void 0!==o){r=r||e.clone();const t=Object.assign({},i);t.args=o,r._rules[n]=t,r._singleRules.get(i.name)===i&&r._singleRules.set(i.name,t)}}for(const n in e.$_terms){if("_"===n[0])continue;const i=a.scan(e.$_terms[n],{source:"terms",name:n},t);void 0!==i&&(r=r||e.clone(),r.$_terms[n]=i)}return r},a.scan=function(e,t,r,n,s){const l=n||[];if(null===e||"object"!=typeof e)return;let u;if(Array.isArray(e)){for(let n=0;n<e.length;++n){const i="terms"===t.source&&"keys"===t.name&&e[n].key,o=a.scan(e[n],t,r,[n,...l],i);void 0!==o&&(u=u||e.slice(),u[n]=o)}return u}if(!1!==r.schema&&i.isSchema(e)||!1!==r.ref&&o.isRef(e)){const n=r.each(e,{...t,path:l,key:s});if(n===e)return;return n}for(const n in e){if("_"===n[0])continue;const i=a.scan(e[n],t,r,[n,...l],s);void 0!==i&&(u=u||Object.assign({},e),u[n]=i)}return u}},6133:(e,t,r)=>{const{assert:n,clone:i,reach:o}=r(8870),a=r(8160);let s;const l={symbol:Symbol("ref"),defaults:{adjust:null,in:!1,iterables:null,map:null,separator:".",type:"value"}};t.create=function(e,t={}){n("string"==typeof e,"Invalid reference key:",e),a.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 i=r.separator,o=l.context(e,i,t.prefix);if(r.type=o.type,e=o.key,"value"===r.type)if(o.root&&(n(!i||e[0]!==i,"Cannot specify relative path with root prefix"),r.ancestor="root",e||(e=null)),i&&i===e)e=null,r.ancestor=0;else if(void 0!==r.ancestor)n(!i||!e||e[0]!==i,"Cannot combine prefix with ancestor option");else{const[t,n]=l.ancestor(e,i);n&&""===(e=e.slice(n))&&(e=null),r.ancestor=t}return r.path=i?null===e?[]:e.split(i):[e],new l.Ref(r)},t.in=function(e,r={}){return t.create(e,{...r,in:!0})},t.isRef=function(e){return!!e&&!!e[a.symbols.ref]},l.Ref=class{constructor(e){n("object"==typeof e,"Invalid reference construction"),a.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,i,o={}){return n(!this.in||o.in,"Invalid in() reference usage"),"global"===this.type?this._resolve(r.context,t,o):"local"===this.type?this._resolve(i,t,o):this.ancestor?"root"===this.ancestor?this._resolve(t.ancestors[t.ancestors.length-1],t,o):(n(this.ancestor<=t.ancestors.length,"Invalid reference exceeds the schema root:",this.display),this._resolve(t.ancestors[this.ancestor-1],t,o)):this._resolve(e,t,o)}_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=o(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[a.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,r={}){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 i=void 0===r.local?"#":r.local;if(i!==t&&e.startsWith(i))return{key:e.slice(i.length),type:"local"};const o=void 0===r.root?"/":r.root;if(o!==t&&e.startsWith(o))return{key:e.slice(o.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(a.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}),s=s||r(3328),s.isTemplate(e)&&this.register(e.refs(),n)}get length(){return this.refs.length}clone(){const e=new t.Manager;return e.refs=i(this.refs),e}reset(){this.refs=[]}roots(){return this.refs.filter((e=>!e.ancestor)).map((e=>e.root))}}},3378:(e,t,r)=>{const n=r(5107),i={};i.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:i.wrap,array:i.wrap,string:i.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(),i.nameRx=/^[a-zA-Z0-9]\w*$/,i.rule=n.object({alias:n.array().items(n.string().pattern(i.nameRx)).single(),args:n.array().items(n.string(),n.object({name:n.string().pattern(i.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(i.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(i.nameRx,n.object({setter:n.string(),default:n.any()})),manifest:{build:n.function().arity(2)},messages:[n.object(),n.string()],modifiers:n.object().pattern(i.nameRx,n.function().minArity(1).maxArity(2)),overrides:n.object().pattern(i.nameRx,n.function()),prepare:n.function().maxArity(3),rebuild:n.function().arity(1),rules:n.object().pattern(i.nameRx,i.rule),terms:n.object().pattern(i.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(),i.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()})},i.desc.entity=n.alternatives([n.array().items(n.link("...")),n.boolean(),n.function(),n.number(),n.string(),i.desc.buffer,i.desc.func,i.desc.ref,i.desc.regex,i.desc.special,i.desc.template,i.desc.value,n.link("/")]),i.desc.values=n.array().items(null,n.boolean(),n.function(),n.number().allow(1/0,-1/0),n.string().allow(""),n.symbol(),i.desc.buffer,i.desc.func,i.desc.override,i.desc.ref,i.desc.regex,i.desc.template,i.desc.value),i.desc.messages=n.object().pattern(/.+/,[n.string(),i.desc.template,n.object().pattern(/.+/,[n.string(),i.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:i.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(),i.desc.ref],wrap:{label:i.wrap,array:i.wrap}},externals:n.boolean(),messages:i.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:i.desc.values,invalid:i.desc.values,rules:n.array().min(1).items({name:n.string().required(),args:n.object().min(1),keep:n.boolean(),message:[n.string(),i.desc.messages],warn:n.boolean()}),keys:n.object().pattern(/.*/,n.link("/")),link:i.desc.ref}).pattern(/^[a-z]\w*$/,n.any())},493:(e,t,r)=>{const{clone:n,reach:i}=r(8870),o=r(8160),a={value:Symbol("value")};e.exports=a.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,t=null,r=null){const n=new a.State(e,t,this);return r&&n.schemas&&(n.schemas=[a.schemas(r),...n.schemas]),n}nest(e,t){const r=new a.State(this.path,this.ancestors,this);return r.schemas=r.schemas&&[a.schemas(e),...r.schemas],r.debug=t,r}shadow(e,t){this.mainstay.shadow=this.mainstay.shadow||new a.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()}},a.schemas=function(e){return o.isSchema(e)?{schema:e}:e},a.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 i=n.get(r);i||(i=new Map,n.set(r,i)),n=i}n[a.value]=t}get(e){const t=this.node(e);if(t)return t[a.value]}node(e){if(this._values)return i(this._values,e,{iterables:!0})}override(e,t){if(!this._values)return;const r=e.slice(0,-1),n=e[e.length-1],o=i(this._values,r,{iterables:!0});t?o.set(n,t):o&&o.delete(n)}}},3328:(e,t,r)=>{const{assert:n,clone:i,escapeHtml:o}=r(8870),a=r(4964),s=r(8160),l=r(6354),u=r(6133),c={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=c.Template=class{constructor(e,t){if(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,t){const{functions:e,...r}=t;this._settings=Object.keys(r).length?i(r):void 0,this._functions=e,this._functions&&(n(Object.keys(this._functions).every((e=>"string"==typeof e)),"Functions keys must be strings"),n(Object.values(this._functions).every((e=>"function"==typeof e)),"Functions values must be functions"))}else this._settings=void 0,this._functions=void 0;this._parse()}_parse(){if(!this.source.includes("{"))return;const e=c.encode(this.source),t=c.split(e);let r=!1;const n=[],i=t.shift();i&&n.push(i);for(const e of t){const t="{"!==e[0],i=t?"}":"}}",o=e.indexOf(i);if(-1===o||"{"===e[1]){n.push(`{${c.decode(e)}`);continue}let a=e.slice(t?0:1,o);const s=":"===a[0];s&&(a=a.slice(1));const l=this._ref(c.decode(a),{raw:t,wrapped:s});n.push(l),"string"!=typeof l&&(r=!0);const u=e.slice(o+i.length);u&&n.push(c.decode(u))}r?this._template=n:this.rendered=n.join("")}static date(e,t){return c.dateFormat[t.dateFormat].call(e)}describe(e={}){if(!this._settings&&e.compact)return this.source;const t={template:this.source};return this._settings&&(t.options=this._settings),this._functions&&(t.functions=this._functions),t}static build(e){return new c.Template(e.template,e.options||e.functions?{...e.options,functions:e.functions}:void 0)}isDynamic(){return!!this._template}static isTemplate(e){return!!e&&!!e[s.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,...t){return e.ref?e.ref.resolve(...t):e.formula.evaluate(t)}render(e,t,r,n,i={}){if(!this.isDynamic())return this.rendered;const a=[];for(const s of this._template)if("string"==typeof s)a.push(s);else{const l=this._part(s,e,t,r,n,i),u=c.stringify(l,e,t,r,n,i);if(void 0!==u){const e=s.raw||!1===(i.errors&&i.errors.escapeHtml)?u:o(u);a.push(c.wrap(e,s.wrapped&&r.errors.wrap.label))}}return a.join("")}_ref(e,{raw:t,wrapped:r}){const n=[],i=e=>{const t=u.create(e,this._settings);return n.push(t),e=>{const r=t.resolve(...e);return void 0!==r?r:null}};try{const t=this._functions?{...c.functions,...this._functions}:c.functions;var o=new a.Parser(e,{reference:i,functions:t,constants:c.constants})}catch(t){throw t.message=`Invalid template variable "${e}" fails due to: ${t.message}`,t}if(o.single){if("reference"===o.single.type){const e=n[0];return{ref:e,raw:t,refs:n,wrapped:r||"local"===e.type&&"label"===e.key}}return c.stringify(o.single.value)}return{formula:o,raw:t,refs:n}}toString(){return this.source}},c.Template.prototype[s.symbols.template]=!0,c.Template.prototype.isImmutable=!0,c.encode=function(e){return e.replace(/\\(\{+)/g,((e,t)=>c.opens.slice(0,t.length))).replace(/\\(\}+)/g,((e,t)=>c.closes.slice(0,t.length)))},c.decode=function(e){return e.replace(/\u0000/g,"{").replace(/\u0001/g,"}")},c.split=function(e){const t=[];let r="";for(let n=0;n<e.length;++n){const i=e[n];if("{"===i){let i="";for(;n+1<e.length&&"{"===e[n+1];)i+="{",++n;t.push(r),r=i}else r+=i}return t.push(r),t},c.wrap=function(e,t){return t?1===t.length?`${t}${e}${t}`:`${t[0]}${e}${t[1]}`:e},c.stringify=function(e,t,r,n,i,o={}){const a=typeof e,s=n&&n.errors&&n.errors.wrap||{};let l=!1;if(u.isRef(e)&&e.render&&(l=e.in,e=e.resolve(t,r,n,i,{in:e.in,...o})),null===e)return"null";if("string"===a)return c.wrap(e,o.arrayItems&&s.string);if("number"===a||"function"===a||"symbol"===a)return e.toString();if("object"!==a)return JSON.stringify(e);if(e instanceof Date)return c.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 d=[];for(const a of e)d.push(c.stringify(a,t,r,n,i,{arrayItems:!0,...o}));return c.wrap(d.join(", "),!l&&s.array)},c.constants={true:!0,false:!1,null:null,second:1e3,minute:6e4,hour:36e5,day:864e5},c.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,i,o]=this,a=o.messages;if(!a)return"";const s=l.template(t,a[0],e,r,n)||l.template(t,a[1],e,r,n);return s?s.render(t,r,n,i,o):""},number:e=>"number"==typeof e?e:"string"==typeof e?parseFloat(e):"boolean"==typeof e?e?1:0:e instanceof Date?e.getTime():null}},2305:(e,t,r)=>{const{deepEqual:n}=r(8870),i=r(7593),o=r(6354),a={codes:{error:1,pass:2,full:3},labels:{0:"never used",1:"always error",2:"always pass"}};t.setup=function(e){const t=function(){return e._tracer=e._tracer||new a.Tracer,e._tracer};e.trace=t,e[Symbol.for("@hapi/lab/coverage/initialize")]=t,e.untrace=()=>{e._tracer=null}},t.location=function(e){return e.$_setFlag("_tracerLocation",i.location(2))},a.Tracer=class{constructor(){this.name="Joi",this._schemas=new Map}_register(e){const t=this._schemas.get(e);if(t)return t.store;const r=new a.Store(e),{filename:n,line:o}=e._flags._tracerLocation||i.location(5);return this._schemas.set(e,{filename:n,line:o,store:r}),r}_combine(e,t){for(const{store:r}of this._schemas.values())r._combine(e,t)}report(e){const t=[];for(const{filename:r,line:n,store:i}of this._schemas.values()){if(e&&e!==r)continue;const o=[],s=[];for(const[e,t]of i._sources.entries()){if(a.sub(t.paths,s))continue;if(!t.entry){o.push({status:"never reached",paths:[...t.paths]}),s.push(...t.paths);continue}for(const r of["valid","invalid"]){const n=e[`_${r}s`];if(!n)continue;const i=new Set(n._values),a=new Set(n._refs);for(const{value:e,ref:n}of t[r])i.delete(e),a.delete(n);(i.size||a.size)&&o.push({status:[...i,...[...a].map((e=>e.display))],rule:`${r}s`})}const r=e._rules.map((e=>e.name));for(const t of["default","failover"])void 0!==e._flags[t]&&r.push(t);for(const e of r){const r=a.labels[t.rule[e]||0];if(r){const n={rule:e,status:r};t.paths.size&&(n.paths=[...t.paths]),o.push(n)}}}o.length&&t.push({filename:r,line:n,missing:o,severity:"error",message:`Schema missing tests for ${o.map(a.message).join(", ")}`})}return t.length?t:null}},a.Store=class{constructor(e){this.active=!0,this._sources=new Map,this._combos=new Map,this._scan(e)}debug(e,t,r,n){e.mainstay.debug&&e.mainstay.debug.push({type:t,name:r,result:n,path:e.path})}entry(e,t){a.debug(t,{type:"entry"}),this._record(e,(e=>{e.entry=!0}))}filter(e,t,r,n){a.debug(t,{type:r,...n}),this._record(e,(e=>{e[r].add(n)}))}log(e,t,r,n,i){a.debug(t,{type:r,name:n,result:"full"===i?"pass":i}),this._record(e,(e=>{e[r][n]=e[r][n]||0,e[r][n]|=a.codes[i]}))}resolve(e,t,r){if(!e.mainstay.debug)return;const n={type:"resolve",ref:t.display,to:r,path:e.path};e.mainstay.debug.push(n)}value(e,t,r,i,o){if(!e.mainstay.debug||n(r,i))return;const a={type:"value",by:t,from:r,to:i,path:e.path};o&&(a.name=o),e.mainstay.debug.push(a)}_record(e,t){const r=this._sources.get(e);if(r)return void t(r);const n=this._combos.get(e);for(const e of n)this._record(e,t)}_scan(e,t){const r=t||[];let n=this._sources.get(e);n||(n={paths:new Set,entry:!1,rule:{},valid:new Set,invalid:new Set},this._sources.set(e,n)),r.length&&n.paths.add(r),e.$_modify({each:(e,t)=>{const n=a.id(e,t);this._scan(e,r.concat(n))},ref:!1})}_combine(e,t){this._combos.set(e,t)}},a.message=function(e){return`${e.paths?o.path(e.paths[0])+(e.rule?":":""):""}${e.rule||""} (${e.status})`},a.id=function(e,{source:t,name:r,path:n,key:i}){return e._flags.id?e._flags.id:i||(r=`@${r}`,"terms"===t?[r,n[Math.min(n.length-1,1)]]:r)},a.sub=function(e,t){for(const r of e)for(const e of t)if(n(r.slice(0,e.length),e))return!0;return!1},a.debug=function(e,t){e.mainstay.debug&&(t.path=e.debug?[...e.path,e.debug]:e.path,e.mainstay.debug.push(t))}},4946:(e,t,r)=>{const{assert:n,merge:i}=r(8870),o=r(8068),a=r(8160),s=r(3292),l=r(6354),u=r(6133),c={};e.exports=o.extend({type:"alternatives",flags:{match:{default:"any"}},terms:{matches:{init:[],register:u.toSibling}},args:(e,...t)=>1===t.length&&Array.isArray(t[0])?e.try(...t[0]):e.try(...t),validate(e,t){const{schema:r,error:n,state:o,prefs:a}=t;if(r._flags.match){const t=[],s=[];for(let n=0;n<r.$_terms.matches.length;++n){const i=r.$_terms.matches[n],l=o.nest(i.schema,`match.${n}`);l.snapshot();const u=i.schema.$_validate(e,l,a);u.errors?(s.push(u.errors),l.restore()):(t.push(u.value),l.commit())}if(0===t.length)return{errors:n("alternatives.any",{details:s.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:s.map((e=>l.details(e,{override:!1})))})};const u=e=>e.$_terms.matches.some((e=>"object"===e.schema.type||"alternatives"===e.schema.type&&u(e.schema)));return u(r)?{value:t.reduce(((e,t)=>i(e,t,{mergeArrays:!1})))}:{value:t[t.length-1]}}const s=[];for(let t=0;t<r.$_terms.matches.length;++t){const n=r.$_terms.matches[t];if(n.schema){const r=o.nest(n.schema,`match.${t}`);r.snapshot();const i=n.schema.$_validate(e,r,a);if(!i.errors)return r.commit(),i;r.restore(),s.push({schema:n.schema,reports:i.errors});continue}const i=n.ref?n.ref.resolve(e,o,a):e,l=n.is?[n]:n.switch;for(let r=0;r<l.length;++r){const s=l[r],{is:u,then:c,otherwise:d}=s,p=`match.${t}${n.switch?"."+r:""}`;if(u.$_match(i,o.nest(u,`${p}.is`),a)){if(c)return c.$_validate(e,o.nest(c,`${p}.then`),a)}else if(d)return d.$_validate(e,o.nest(d,`${p}.otherwise`),a)}}return c.errors(s,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(),i=s.when(r,e,t),o=i.is?[i]:i.switch;for(const e of o)if(e.then&&e.otherwise){r.$_setFlag("_endedSwitch",!0,{clone:!1});break}return r.$_terms.matches.push(i),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(...e){n(e.length,"Missing alternative schemas"),a.verifyFlat(e,"try"),n(!this._flags._endedSwitch,"Unreachable condition");const t=this.clone();for(const r of e)t.$_terms.matches.push({schema:t.$_compile(r)});return t.$_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=>{a.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:i,not:o,then:a,otherwise:s}=r;e=t?e.try(t):n?e.conditional(n,{is:i,then:a,not:o,otherwise:s,switch:r.switch}):e.conditional(i,{then:a,otherwise:s})}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}}"}}),c.errors=function(e,{error:t,state:r}){if(!e.length)return{errors:t("alternatives.any")};if(1===e.length)return{errors:e[0].reports};const n=new Set,i=[];for(const{reports:o,schema:a}of e){if(o.length>1)return c.unmatched(e,t);const s=o[0];if(s instanceof l.Report==0)return c.unmatched(e,t);if(s.state.path.length!==r.path.length){i.push({type:a.type,report:s});continue}if("any.only"===s.code){for(const e of s.local.valids)n.add(e);continue}const[u,d]=s.code.split(".");"base"===d?n.add(u):i.push({type:a.type,report:s})}return i.length?1===i.length?{errors:i[0].report}:c.unmatched(e,t):{errors:t("alternatives.types",{types:[...n]})}},c.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)=>{const{assert:n}=r(8870),i=r(7629),o=r(8160),a=r(6914);e.exports=i.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,{method:r}){try{return r(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(o.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,{code:r,local:n})=>t.error(r,n),args:["code","local"],multi:!0}},modifiers:{keep(e,t=!0){e.keep=t},message(e,t){e.message=a.compile(t)},warn(e,t=!0){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:i,then:o,otherwise:a,concat:s}=t;e=s?e.concat(s):r?e.when(r,{is:n,not:i,then:o,otherwise:a,switch:t.switch,break:t.break}):e.when(n,{then:o,otherwise:a,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)=>{const{assert:n,deepEqual:i,reach:o}=r(8870),a=r(8068),s=r(8160),l=r(3292),u={};e.exports=a.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,{schema:t,state:r,prefs:n}){if(!Array.isArray(e))return;const i=t.$_getRule("sort");return i?u.sort(t,e,i.args.options,r,n):void 0}},validate(e,{schema:t,error:r}){if(!Array.isArray(e)){if(t._flags.single){const t=[e];return t[s.symbols.arraySingle]=!0,{value:t}}return{errors:r("array.base")}}if(t.$_getRule("items")||t.$_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,{state:t,prefs:r,error:n},{schema:i}){const o=[e,...t.ancestors];for(let n=0;n<e.length;++n){const a=t.localize([...t.path,n],o,i);if(i.$_match(e[n],a,r))return e}const a=i._flags.label;return a?n("array.hasKnown",{patternLabel:a}):n("array.hasUnknown",null)},multi:!0},items:{method(...e){s.verifyFlat(e,"items");const t=this.$_addRule("items");for(let r=0;r<e.length;++r){const n=s.tryWithPath((()=>this.$_compile(e[r])),r,{append:!0});t.$_terms.items.push(n)}return t.$_mutateRebuild()},validate(e,{schema:t,error:r,state:n,prefs:i,errorsArray:o}){const a=t.$_terms._requireds.slice(),l=t.$_terms.ordered.slice(),c=[...t.$_terms._inclusions,...a],d=!e[s.symbols.arraySingle];delete e[s.symbols.arraySingle];const p=o();let f=e.length;for(let o=0;o<f;++o){const s=e[o];let h=!1,m=!1;const g=d?o:new Number(o),y=[...n.path,g];if(!t._flags.sparse&&void 0===s){if(p.push(r("array.sparse",{key:g,path:y,pos:o,value:void 0},n.localize(y))),i.abortEarly)return p;l.shift();continue}const b=[e,...n.ancestors];for(const e of t.$_terms._exclusions)if(e.$_match(s,n.localize(y,b,e),i,{presence:"ignore"})){if(p.push(r("array.excludes",{pos:o,value:s},n.localize(y))),i.abortEarly)return p;h=!0,l.shift();break}if(h)continue;if(t.$_terms.ordered.length){if(l.length){const a=l.shift(),c=a.$_validate(s,n.localize(y,b,a),i);if(c.errors){if(p.push(...c.errors),i.abortEarly)return p}else if("strip"===a._flags.result)u.fastSplice(e,o),--o,--f;else{if(!t._flags.sparse&&void 0===c.value){if(p.push(r("array.sparse",{key:g,path:y,pos:o,value:void 0},n.localize(y))),i.abortEarly)return p;continue}e[o]=c.value}continue}if(!t.$_terms.items.length){if(p.push(r("array.orderedLength",{pos:o,limit:t.$_terms.ordered.length})),i.abortEarly)return p;break}}const v=[];let _=a.length;for(let l=0;l<_;++l){const c=n.localize(y,b,a[l]);c.snapshot();const d=a[l].$_validate(s,c,i);if(v[l]=d,!d.errors){if(c.commit(),e[o]=d.value,m=!0,u.fastSplice(a,l),--l,--_,!t._flags.sparse&&void 0===d.value&&(p.push(r("array.sparse",{key:g,path:y,pos:o,value:void 0},n.localize(y))),i.abortEarly))return p;break}c.restore()}if(m)continue;const A=i.stripUnknown&&!!i.stripUnknown.arrays||!1;_=c.length;for(const l of c){let c;const d=a.indexOf(l);if(-1!==d)c=v[d];else{const a=n.localize(y,b,l);if(a.snapshot(),c=l.$_validate(s,a,i),!c.errors){a.commit(),"strip"===l._flags.result?(u.fastSplice(e,o),--o,--f):t._flags.sparse||void 0!==c.value?e[o]=c.value:(p.push(r("array.sparse",{key:g,path:y,pos:o,value:void 0},n.localize(y))),h=!0),m=!0;break}a.restore()}if(1===_){if(A){u.fastSplice(e,o),--o,--f,m=!0;break}if(p.push(...c.errors),i.abortEarly)return p;h=!0;break}}if(!h&&(t.$_terms._inclusions.length||t.$_terms._requireds.length)&&!m){if(A){u.fastSplice(e,o),--o,--f;continue}if(p.push(r("array.includes",{pos:o,value:s},n.localize(y))),i.abortEarly)return p}}return a.length&&u.fillMissedErrors(t,p,a,e,n,i),l.length&&(u.fillOrderedErrors(t,p,l,e,n,i),p.length||u.fillDefault(l,e,n,i)),p.length?p:e},priority:!0,manifest:!1},length:{method(e){return this.$_addRule({name:"length",args:{limit:e},operator:"="})},validate:(e,t,{limit:r},{name:n,operator:i,args:o})=>s.compare(e.length,r,i)?e:t.error("array."+n,{limit:o.limit,value:e}),args:[{name:"limit",ref:!0,assert:s.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(...e){s.verifyFlat(e,"ordered");const t=this.$_addRule("items");for(let r=0;r<e.length;++r){const n=s.tryWithPath((()=>this.$_compile(e[r])),r,{append:!0});u.validateSingle(n,t),t.$_mutateRegister(n),t.$_terms.ordered.push(n)}return t.$_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(e={}){s.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,{error:t,state:r,prefs:n,schema:i},{options:o}){const{value:a,errors:s}=u.sort(i,e,o,r,n);if(s)return s;for(let r=0;r<e.length;++r)if(e[r]!==a[r])return t("array.sort",{order:o.order,by:o.by?o.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,t={}){n(!e||"function"==typeof e||"string"==typeof e,"comparator must be a function or a string"),s.assertOptions(t,["ignoreUndefined","separator"]);const r={name:"unique",args:{options:t,comparator:e}};if(e)if("string"==typeof e){const n=s.default(t.separator,".");r.path=n?e.split(n):[e]}else r.comparator=e;return this.$_addRule(r)},validate(e,{state:t,error:r,schema:a},{comparator:s,options:l},{comparator:u,path:c}){const d={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},p=u||i,f=l.ignoreUndefined;for(let i=0;i<e.length;++i){const a=c?o(e[i],c):e[i],l=u?d.custom:d[typeof a];if(n(l,"Failed to find unique map container for type",typeof a),l instanceof Map){const n=l.entries();let o;for(;!(o=n.next()).done;)if(p(o.value[0],a)){const n=t.localize([...t.path,i],[e,...t.ancestors]),a={pos:i,value:e[i],dupePos:o.value[1],dupeValue:e[o.value[1]]};return c&&(a.path=s),r("array.unique",a,n)}l.set(a,i)}else{if((!f||void 0!==a)&&void 0!==l[a]){const n={pos:i,value:e[i],dupePos:l[a],dupeValue:e[l[a]]};return c&&(n.path=s),r("array.unique",n,t.localize([...t.path,i],[e,...t.ancestors]))}l[a]=i}}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)u.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)u.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"}}),u.fillMissedErrors=function(e,t,r,n,i,o){const a=[];let s=0;for(const e of r){const t=e._flags.label;t?a.push(t):++s}a.length?s?t.push(e.$_createError("array.includesRequiredBoth",n,{knownMisses:a,unknownMisses:s},i,o)):t.push(e.$_createError("array.includesRequiredKnowns",n,{knownMisses:a},i,o)):t.push(e.$_createError("array.includesRequiredUnknowns",n,{unknownMisses:s},i,o))},u.fillOrderedErrors=function(e,t,r,n,i,o){const a=[];for(const e of r)"required"===e._flags.presence&&a.push(e);a.length&&u.fillMissedErrors(e,t,a,n,i,o)},u.fillDefault=function(e,t,r,n){const i=[];let o=!0;for(let a=e.length-1;a>=0;--a){const s=e[a],l=[t,...r.ancestors],u=s.$_validate(void 0,r.localize(r.path,l,s),n).value;if(o){if(void 0===u)continue;o=!1}i.unshift(u)}i.length&&t.push(...i)},u.fastSplice=function(e,t){let r=t;for(;r<e.length;)e[r++]=e[r];--e.length},u.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}))},u.sort=function(e,t,r,n,i){const o="ascending"===r.order?1:-1,a=-1*o,s=o,l=(l,c)=>{let d=u.compare(l,c,a,s);if(null!==d)return d;if(r.by&&(l=r.by.resolve(l,n,i),c=r.by.resolve(c,n,i)),d=u.compare(l,c,a,s),null!==d)return d;const p=typeof l;if(p!==typeof c)throw e.$_createError("array.sort.mismatching",t,null,n,i);if("number"!==p&&"string"!==p)throw e.$_createError("array.sort.unsupported",t,{type:p},n,i);return"number"===p?(l-c)*o:l<c?a:s};try{return{value:t.slice().sort(l)}}catch(e){return{errors:e}}},u.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)=>{const{assert:n}=r(8870),i=r(8068),o=r(8160),a=r(2036),s={isBool:function(e){return"boolean"==typeof e}};e.exports=i.extend({type:"boolean",flags:{sensitive:{default:!1}},terms:{falsy:{init:null,manifest:"values"},truthy:{init:null,manifest:"values"}},coerce(e,{schema:t}){if("boolean"!=typeof e){if("string"==typeof e){const r=t._flags.sensitive?e:e.toLowerCase();e="true"===r||"false"!==r&&e}return"boolean"!=typeof e&&(e=t.$_terms.truthy&&t.$_terms.truthy.has(e,null,null,!t._flags.sensitive)||(!t.$_terms.falsy||!t.$_terms.falsy.has(e,null,null,!t._flags.sensitive))&&e),{value:e}}},validate(e,{error:t}){if("boolean"!=typeof e)return{value:e,errors:t("boolean.base")}},rules:{truthy:{method(...e){o.verifyFlat(e,"truthy");const t=this.clone();t.$_terms.truthy=t.$_terms.truthy||new a;for(let r=0;r<e.length;++r){const i=e[r];n(void 0!==i,"Cannot call truthy with undefined"),t.$_terms.truthy.add(i)}return t}},falsy:{method(...e){o.verifyFlat(e,"falsy");const t=this.clone();t.$_terms.falsy=t.$_terms.falsy||new a;for(let r=0;r<e.length;++r){const i=e[r];n(void 0!==i,"Cannot call falsy with undefined"),t.$_terms.falsy.add(i)}return t}},sensitive:{method(e=!0){return this.$_setFlag("sensitive",e)}}},cast:{number:{from:s.isBool,to:(e,t)=>e?1:0},string:{from:s.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)=>{const{assert:n}=r(8870),i=r(8068),o=r(8160),a=r(3328),s={isDate:function(e){return e instanceof Date}};e.exports=i.extend({type:"date",coerce:{from:["number","string"],method:(e,{schema:t})=>({value:s.parse(e,t._flags.format)||e})},validate(e,{schema:t,error:r,prefs:n}){if(e instanceof Date&&!isNaN(e.getTime()))return;const i=t._flags.format;return n.convert&&i&&"string"==typeof e?{value:e,errors:r("date.format",{format:i})}:{value:e,errors:r("date.base")}},rules:{compare:{method:!1,validate(e,t,{date:r},{name:n,operator:i,args:a}){const s="now"===r?Date.now():r.getTime();return o.compare(e.getTime(),s,i)?e:t.error("date."+n,{limit:a.date,value:e})},args:[{name:"date",ref:!0,normalize:e=>"now"===e?e:s.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(e="javascript"){return n(["javascript","unix"].includes(e),'"type" must be one of "javascript, unix"'),this.format(e)}}},cast:{number:{from:s.isDate,to:(e,t)=>e.getTime()},string:{from:s.isDate,to:(e,{prefs:t})=>a.date(e,t)}},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"}}),s.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 o.isIsoDate(e)?s.date(e.toString()):null;const r=e;if("string"==typeof e&&/^[+-]?\d+(\.\d+)?$/.test(e)&&(e=parseFloat(e)),t){if("javascript"===t)return s.date(1*e);if("unix"===t)return s.date(1e3*e);if("string"==typeof r)return null}return s.date(e)},s.date=function(e){const t=new Date(e);return isNaN(t.getTime())?null:t}},390:(e,t,r)=>{const{assert:n}=r(8870),i=r(7824);e.exports=i.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,{n:r})=>e.length===r?e:t.error("function.arity",{n:r})},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,{n:r})=>e.length>=r?e:t.error("function.minArity",{n:r})},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,{n:r})=>e.length<=r?e:t.error("function.maxArity",{n:r})}},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)=>{const{applyToDefaults:n,assert:i,clone:o}=r(8870),a=r(3652),s=r(8068),l=r(8160),u=r(3292),c=r(6354),d=r(6133),p=r(3328),f={renameDefaults:{alias:!1,multiple:!1,override:!1}};e.exports=s.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,{schema:t,error:r,state:n,prefs:i}){if(!e||typeof e!==t.$_property("typeof")||Array.isArray(e))return{value:e,errors:r("object.base",{type:t.$_property("typeof")})};if(!(t.$_terms.renames||t.$_terms.dependencies||t.$_terms.keys||t.$_terms.patterns||t.$_terms.externals))return;e=f.clone(e,i);const o=[];if(t.$_terms.renames&&!f.rename(t,e,n,i,o))return{value:e,errors:o};if(!t.$_terms.keys&&!t.$_terms.patterns&&!t.$_terms.dependencies)return{value:e,errors:o};const a=new Set(Object.keys(e));if(t.$_terms.keys){const r=[e,...n.ancestors];for(const s of t.$_terms.keys){const t=s.key,l=e[t];a.delete(t);const u=n.localize([...n.path,t],r,s),c=s.schema.$_validate(l,u,i);if(c.errors){if(i.abortEarly)return{value:e,errors:c.errors};void 0!==c.value&&(e[t]=c.value),o.push(...c.errors)}else"strip"===s.schema._flags.result||void 0===c.value&&void 0!==l?delete e[t]:void 0!==c.value&&(e[t]=c.value)}}if(a.size||t._flags._hasPatternMatch){const r=f.unknown(t,e,a,o,n,i);if(r)return r}if(t.$_terms.dependencies)for(const r of t.$_terms.dependencies){if(null!==r.key&&!1===f.isPresent(r.options)(r.key.resolve(e,n,i,null,{shadow:!1})))continue;const a=f.dependencies[r.rel](t,r,e,n,i);if(a){const r=t.$_createError(a.code,e,a.context,n,i);if(i.abortEarly)return{value:e,errors:r};o.push(r)}}return{value:e,errors:o}},rules:{and:{method(...e){return l.verifyFlat(e,"and"),f.dependency(this,"and",null,e)}},append:{method(e){return null==e||0===Object.keys(e).length?this:this.keys(e)}},assert:{method(e,t,r){p.isTemplate(e)||(e=u.ref(e)),i(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,{error:t,prefs:r,state:n},{subject:i,schema:o,message:a}){const s=i.resolve(e,n,r),l=d.isRef(i)?i.absolute(n):[];return o.$_match(s,n.localize(l,[e,...n.ancestors],o),r)?e:t("object.assert",{subject:i,message:a})},args:["subject","schema","message"],multi:!0},instance:{method(e,t){return i("function"==typeof e,"constructor must be a function"),t=t||e.name,this.$_addRule({name:"instance",args:{constructor:e,name:t}})},validate:(e,t,{constructor:r,name:n})=>e instanceof r?e:t.error("object.instance",{type:n,value:e}),args:["constructor","name"]},keys:{method(e){i(void 0===e||"object"==typeof e,"Object schema must be a valid object"),i(!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 f.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 f.Keys;else t.$_terms.keys=null;return t.$_mutateRebuild()}},length:{method(e){return this.$_addRule({name:"length",args:{limit:e},operator:"="})},validate:(e,t,{limit:r},{name:n,operator:i,args:o})=>l.compare(Object.keys(e).length,r,i)?e:t.error("object."+n,{limit:o.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(...e){return l.verifyFlat(e,"nand"),f.dependency(this,"nand",null,e)}},or:{method(...e){return l.verifyFlat(e,"or"),f.dependency(this,"or",null,e)}},oxor:{method(...e){return f.dependency(this,"oxor",null,e)}},pattern:{method(e,t,r={}){const n=e instanceof RegExp;n||(e=this.$_compile(e,{appendPath:!0})),i(void 0!==t,"Invalid rule"),l.assertOptions(r,["fallthrough","matches"]),n&&i(!e.flags.includes("g")&&!e.flags.includes("y"),"pattern should not use global or sticky mode"),t=this.$_compile(t,{appendPath:!0});const o=this.clone();o.$_terms.patterns=o.$_terms.patterns||[];const a={[n?"regex":"schema"]:e,rule:t};return r.matches&&(a.matches=this.$_compile(r.matches),"array"!==a.matches.type&&(a.matches=a.matches.$_root.array().items(a.matches)),o.$_mutateRegister(a.matches),o.$_setFlag("_hasPatternMatch",!0,{clone:!1})),r.fallthrough&&(a.fallthrough=!0),o.$_terms.patterns.push(a),o.$_mutateRegister(t),o}},ref:{method(){return this.$_addRule("ref")},validate:(e,t)=>d.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,r={}){i("string"==typeof e||e instanceof RegExp,"Rename missing the from argument"),i("string"==typeof t||t instanceof p,"Invalid rename to argument"),i(t!==e,"Cannot rename key to same name:",e),l.assertOptions(r,["alias","ignoreUndefined","override","multiple"]);const o=this.clone();o.$_terms.renames=o.$_terms.renames||[];for(const t of o.$_terms.renames)i(t.from!==e,"Cannot rename the same key multiple times");return t instanceof p&&o.$_mutateRegister(t),o.$_terms.renames.push({from:e,to:t,options:n(f.renameDefaults,r)}),o}},schema:{method(e="any"){return this.$_addRule({name:"schema",args:{type:e}})},validate:(e,t,{type:r})=>!l.isSchema(e)||"any"!==r&&e.type!==r?t.error("object.schema",{type:r}):e},unknown:{method(e){return this.$_setFlag("unknown",!1!==e)}},with:{method(e,t,r={}){return f.dependency(this,"with",e,t,r)}},without:{method(e,t,r={}){return f.dependency(this,"without",e,t,r)}},xor:{method(...e){return l.verifyFlat(e,"xor"),f.dependency(this,"xor",null,e)}}},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 a.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 f.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:i,options:o}of t.dependencies)e=f.dependency(e,r,n,i,o);if(t.patterns)for(const{regex:r,schema:n,rule:i,fallthrough:o,matches:a}of t.patterns)e=e.pattern(r||n,i,{fallthrough:o,matches:a});if(t.renames)for(const{from:r,to:n,options:i}of t.renames)e=e.rename(r,n,i);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}}"}}),f.clone=function(e,t){if("object"==typeof e){if(t.nonEnumerables)return o(e,{shallow:!0});const r=Object.create(Object.getPrototypeOf(e));return Object.assign(r,e),r}const r=function(...t){return e.apply(this,t)};return r.prototype=o(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},f.dependency=function(e,t,r,n,o){i(null===r||"string"==typeof r,t,"key must be a strings"),o||(o=n.length>1&&"object"==typeof n[n.length-1]?n.pop():{}),l.assertOptions(o,["separator","isPresent"]),n=[].concat(n);const a=l.default(o.separator,"."),s=[];for(const e of n)i("string"==typeof e,t,"peers must be strings"),s.push(u.ref(e,{separator:a,ancestor:0,prefix:!1}));null!==r&&(r=u.ref(r,{separator:a,ancestor:0,prefix:!1}));const c=e.clone();return c.$_terms.dependencies=c.$_terms.dependencies||[],c.$_terms.dependencies.push(new f.Dependency(t,r,s,n,o)),c},f.dependencies={and(e,t,r,n,i){const o=[],a=[],s=t.peers.length,l=f.isPresent(t.options);for(const e of t.peers)!1===l(e.resolve(r,n,i,null,{shadow:!1}))?o.push(e.key):a.push(e.key);if(o.length!==s&&a.length!==s)return{code:"object.and",context:{present:a,presentWithLabels:f.keysToLabels(e,a),missing:o,missingWithLabels:f.keysToLabels(e,o)}}},nand(e,t,r,n,i){const o=[],a=f.isPresent(t.options);for(const e of t.peers)a(e.resolve(r,n,i,null,{shadow:!1}))&&o.push(e.key);if(o.length!==t.peers.length)return;const s=t.paths[0],l=t.paths.slice(1);return{code:"object.nand",context:{main:s,mainWithLabel:f.keysToLabels(e,s),peers:l,peersWithLabels:f.keysToLabels(e,l)}}},or(e,t,r,n,i){const o=f.isPresent(t.options);for(const e of t.peers)if(o(e.resolve(r,n,i,null,{shadow:!1})))return;return{code:"object.missing",context:{peers:t.paths,peersWithLabels:f.keysToLabels(e,t.paths)}}},oxor(e,t,r,n,i){const o=[],a=f.isPresent(t.options);for(const e of t.peers)a(e.resolve(r,n,i,null,{shadow:!1}))&&o.push(e.key);if(!o.length||1===o.length)return;const s={peers:t.paths,peersWithLabels:f.keysToLabels(e,t.paths)};return s.present=o,s.presentWithLabels=f.keysToLabels(e,o),{code:"object.oxor",context:s}},with(e,t,r,n,i){const o=f.isPresent(t.options);for(const a of t.peers)if(!1===o(a.resolve(r,n,i,null,{shadow:!1})))return{code:"object.with",context:{main:t.key.key,mainWithLabel:f.keysToLabels(e,t.key.key),peer:a.key,peerWithLabel:f.keysToLabels(e,a.key)}}},without(e,t,r,n,i){const o=f.isPresent(t.options);for(const a of t.peers)if(o(a.resolve(r,n,i,null,{shadow:!1})))return{code:"object.without",context:{main:t.key.key,mainWithLabel:f.keysToLabels(e,t.key.key),peer:a.key,peerWithLabel:f.keysToLabels(e,a.key)}}},xor(e,t,r,n,i){const o=[],a=f.isPresent(t.options);for(const e of t.peers)a(e.resolve(r,n,i,null,{shadow:!1}))&&o.push(e.key);if(1===o.length)return;const s={peers:t.paths,peersWithLabels:f.keysToLabels(e,t.paths)};return 0===o.length?{code:"object.missing",context:s}:(s.present=o,s.presentWithLabels=f.keysToLabels(e,o),{code:"object.xor",context:s})}},f.keysToLabels=function(e,t){return Array.isArray(t)?t.map((t=>e.$_mapLabels(t))):e.$_mapLabels(t)},f.isPresent=function(e){return"function"==typeof e.isPresent?e.isPresent:e=>void 0!==e},f.rename=function(e,t,r,n,i){const o={};for(const a of e.$_terms.renames){const s=[],l="string"!=typeof a.from;if(l)for(const e in t){if(void 0===t[e]&&a.options.ignoreUndefined)continue;if(e===a.to)continue;const r=a.from.exec(e);r&&s.push({from:e,to:a.to,match:r})}else!Object.prototype.hasOwnProperty.call(t,a.from)||void 0===t[a.from]&&a.options.ignoreUndefined||s.push(a);for(const u of s){const s=u.from;let c=u.to;if(c instanceof p&&(c=c.render(t,r,n,u.match)),s!==c){if(!a.options.multiple&&o[c]&&(i.push(e.$_createError("object.rename.multiple",t,{from:s,to:c,pattern:l},r,n)),n.abortEarly))return!1;if(Object.prototype.hasOwnProperty.call(t,c)&&!a.options.override&&!o[c]&&(i.push(e.$_createError("object.rename.override",t,{from:s,to:c,pattern:l},r,n)),n.abortEarly))return!1;void 0===t[s]?delete t[c]:t[c]=t[s],o[c]=!0,a.options.alias||delete t[s]}}}return!0},f.unknown=function(e,t,r,n,i,o){if(e.$_terms.patterns){let a=!1;const s=e.$_terms.patterns.map((e=>{if(e.matches)return a=!0,[]})),l=[t,...i.ancestors];for(const a of r){const u=t[a],c=[...i.path,a];for(let d=0;d<e.$_terms.patterns.length;++d){const p=e.$_terms.patterns[d];if(p.regex){const e=p.regex.test(a);if(i.mainstay.tracer.debug(i,"rule",`pattern.${d}`,e?"pass":"error"),!e)continue}else if(!p.schema.$_match(a,i.nest(p.schema,`pattern.${d}`),o))continue;r.delete(a);const f=i.localize(c,l,{schema:p.rule,key:a}),h=p.rule.$_validate(u,f,o);if(h.errors){if(o.abortEarly)return{value:t,errors:h.errors};n.push(...h.errors)}if(p.matches&&s[d].push(a),t[a]=h.value,!p.fallthrough)break}}if(a)for(let r=0;r<s.length;++r){const a=s[r];if(!a)continue;const u=e.$_terms.patterns[r].matches,d=i.localize(i.path,l,u),p=u.$_validate(a,d,o);if(p.errors){const r=c.details(p.errors,{override:!1});r.matches=a;const s=e.$_createError("object.pattern.match",t,r,i,o);if(o.abortEarly)return{value:t,errors:s};n.push(s)}}}if(r.size&&(e.$_terms.keys||e.$_terms.patterns)){if(o.stripUnknown&&!e._flags.unknown||o.skipFunctions){const e=!(!o.stripUnknown||!0!==o.stripUnknown&&!o.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,o.allowUnknown))for(const a of r){const r=i.localize([...i.path,a],[]),s=e.$_createError("object.unknown",t[a],{child:a},r,o,{flags:!1});if(o.abortEarly)return{value:t,errors:s};n.push(s)}}},f.Dependency=class{constructor(e,t,r,n,i){this.rel=e,this.key=t,this.peers=r,this.paths=n,this.options=i}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}},f.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,i=r.get(e);void 0!==i?t[i]={key:e,schema:t[i].schema.concat(n.schema)}:t.push(n)}return t}}},8785:(e,t,r)=>{const{assert:n}=r(8870),i=r(8068),o=r(8160),a=r(3292),s=r(6354),l={};e.exports=i.extend({type:"link",properties:{schemaChain:!0},terms:{link:{init:null,manifest:"single",register:!1}},args:(e,t)=>e.ref(t),validate(e,{schema:t,state:r,prefs:i}){n(t.$_terms.link,"Uninitialized link schema");const o=l.generate(t,e,r,i),a=t.$_terms.link[0].ref;return o.$_validate(e,r.nest(o,`link:${a.display}:${o.type}`),i)},generate:(e,t,r,n)=>l.generate(e,t,r,n),rules:{ref:{method(e){n(!this.$_terms.link,"Cannot reinitialize schema"),e=a.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(e=!0){return this.$_setFlag("relative",e)}}},overrides:{concat(e){n(this.$_terms.link,"Uninitialized link schema"),n(o.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 i=r.mainstay.links.get(e);if(i)return i._generate(t,r,n).schema;const o=e.$_terms.link[0].ref,{perspective:a,path:s}=l.perspective(o,r);l.assert(a,"which is outside of schema boundaries",o,e,r,n);try{i=s.length?a.$_reach(s):a}catch(t){l.assert(!1,"to non-existing schema",o,e,r,n)}return l.assert("link"!==i.type,"which is another link",o,e,r,n),e._flags.relative||r.mainstay.links.set(e,i),i._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,i,o,a){e||n(!1,`"${s.label(i._flags,o,a)}" contains link reference "${r.display}" ${t}`)}},3832:(e,t,r)=>{const{assert:n}=r(8870),i=r(8068),o=r(8160),a={numberRx:/^\s*[+-]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:e([+-]?\d+))?\s*$/i,precisionRx:/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/,exponentialPartRegex:/[eE][+-]?\d+$/,leadingSignAndZerosRegex:/^[+-]?(0*)?/,dotRegex:/\./,trailingZerosRegex:/0+$/};e.exports=i.extend({type:"number",flags:{unsafe:{default:!1}},coerce:{from:"string",method(e,{schema:t,error:r}){if(!e.match(a.numberRx))return;e=e.trim();const n={value:parseFloat(e)};if(0===n.value&&(n.value=0),!t._flags.unsafe)if(e.match(/e/i)){if(a.extractSignificantDigits(e)!==a.extractSignificantDigits(String(n.value)))return n.errors=r("number.unsafe"),n}else{const t=n.value.toString();if(t.match(/e/i))return n;if(t!==a.normalizeDecimal(e))return n.errors=r("number.unsafe"),n}return n}},validate(e,{schema:t,error:r,prefs:n}){if(e===1/0||e===-1/0)return{value:e,errors:r("number.infinity")};if(!o.isNumber(e))return{value:e,errors:r("number.base")};const i={value:e};if(n.convert){const e=t.$_getRule("precision");if(e){const t=Math.pow(10,e.args.limit);i.value=Math.round(i.value*t)/t}}return 0===i.value&&(i.value=0),!t._flags.unsafe&&(e>Number.MAX_SAFE_INTEGER||e<Number.MIN_SAFE_INTEGER)&&(i.errors=r("number.unsafe")),i},rules:{compare:{method:!1,validate:(e,t,{limit:r},{name:n,operator:i,args:a})=>o.compare(e,r,i)?e:t.error("number."+n,{limit:a.limit,value:e}),args:[{name:"limit",ref:!0,assert:o.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,{base:r},n)=>e*(1/r)%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,{limit:r}){const n=e.toString().match(a.precisionRx);return Math.max((n[1]?n[1].length:0)-(n[2]?parseInt(n[2],10):0),0)<=r?e:t.error("number.precision",{limit:r,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,{sign:r})=>"negative"===r&&e<0||"positive"===r&&e>0?e:t.error(`number.${r}`)},unsafe:{method(e=!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"}}),a.extractSignificantDigits=function(e){return e.replace(a.exponentialPartRegex,"").replace(a.dotRegex,"").replace(a.trailingZerosRegex,"").replace(a.leadingSignAndZerosRegex,"")},a.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)=>{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)=>{const{assert:n,escapeRegex:i}=r(8870),{isDomainValid:o,isEmailValid:a,ipRegex:s,uriRegex:l}=r(4958),u=r(6264),c=r(8068),d=r(8160),p={tlds:u.tlds instanceof Set&&{tlds:{allow:u.tlds,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:s({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",uuidv6:"6",uuidv7:"7",uuidv8:"8"},guidSeparators:new Set([void 0,!0,!1,"-",":"]),normalizationForms:["NFC","NFD","NFKC","NFKD"]};e.exports=c.extend({type:"string",flags:{insensitive:{default:!1},truncate:{default:!1}},terms:{replacements:{init:null}},coerce:{from:"string",method(e,{schema:t,state:r,prefs:n}){const i=t.$_getRule("normalize");i&&(e=e.normalize(i.args.form));const o=t.$_getRule("case");o&&(e="upper"===o.args.direction?e.toLocaleUpperCase():e.toLocaleLowerCase());const a=t.$_getRule("trim");if(a&&a.args.enabled&&(e=e.trim()),t.$_terms.replacements)for(const r of t.$_terms.replacements)e=e.replace(r.pattern,r.replacement);const s=t.$_getRule("hex");if(s&&s.args.options.byteAligned&&e.length%2!=0&&(e=`0${e}`),t.$_getRule("isoDate")){const t=p.isoDate(e);t&&(e=t)}if(t._flags.truncate){const i=t.$_getRule("max");if(i){let o=i.args.limit;if(d.isResolvable(o)&&(o=o.resolve(e,r,n),!d.limit(o)))return{value:e,errors:t.$_createError("any.ref",o,{ref:i.args.limit,arg:"limit",reason:"must be a positive integer"},r,n)};e=e.slice(0,o)}}return{value:e}}},validate(e,{schema:t,error:r}){if("string"!=typeof e)return{value:e,errors:r("string.base")};if(""===e){const n=t.$_getRule("min");if(n&&0===n.args.limit)return;return{value:e,errors:r("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(e={}){return d.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,{options:r})=>p.base64Regex[r.paddingRequired][r.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,{direction:r})=>"lower"===r&&e===e.toLocaleLowerCase()||"upper"===r&&e===e.toLocaleUpperCase()?e:t.error(`string.${r}case`),convert:!0},creditCard:{method(){return this.$_addRule("creditCard")},validate(e,t){let r=e.length,n=0,i=1;for(;r--;){const t=e.charAt(r)*i;n+=t-9*(t>9),i^=3}return n>0&&n%10==0?e:t.error("string.creditCard")}},dataUri:{method(e={}){return d.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,{options:r}){const n=e.match(p.dataUriRegex);if(n){if(!n[2])return e;if("base64"!==n[2])return e;if(p.base64Regex[r.paddingRequired].false.test(n[3]))return e}return t.error("string.dataUri")}},domain:{method(e){e&&d.assertOptions(e,["allowFullyQualified","allowUnicode","allowUnderscore","maxDomainSegments","minDomainSegments","tlds"]);const t=p.addressOptions(e);return this.$_addRule({name:"domain",args:{options:e},address:t})},validate:(e,t,r,{address:n})=>o(e,n)?e:t.error("string.domain")},email:{method(e={}){d.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=p.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,{options:r},{regex:n,address:i}){const o=r.multiple?e.split(n):[e],s=[];for(const e of o)a(e,i)||s.push(e);return s.length?t.error("string.email",{value:e,invalids:s}):e}},guid:{alias:"uuid",method(e={}){d.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 i=new Set;for(let e=0;e<r.length;++e){const o=r[e];n("string"==typeof o,"version at position "+e+" must be a string");const a=p.guidVersions[o.toLowerCase()];n(a,"version at position "+e+" must be one of "+Object.keys(p.guidVersions).join(", ")),n(!i.has(a),"version at position "+e+" must not be a duplicate"),t+=a,i.add(a)}}n(p.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}`,i=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:i})},validate(e,t,r,{regex:n}){const i=n.exec(e);return i?p.guidBrackets[i[1]]!==i[i.length-1]?t.error("string.guid"):e:t.error("string.guid")}},hex:{method(e={}){return d.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,{options:r})=>p.hexRegex.test(e)?r.byteAligned&&e.length%2!=0?t.error("string.hexAlign"):e:t.error("string.hex")},hostname:{method(){return this.$_addRule("hostname")},validate:(e,t)=>o(e,{minDomainSegments:1})||p.ipRegex.test(e)?e:t.error("string.hostname")},insensitive:{method(){return this.$_setFlag("insensitive",!0)}},ip:{method(e={}){d.assertOptions(e,["cidr","version"]);const{cidr:t,versions:r,regex:n}=s(e),i=e.version?r:void 0;return this.$_addRule({name:"ip",args:{options:{cidr:t,version:i}},regex:n})},validate:(e,t,{options:r},{regex:n})=>n.test(e)?e:r.version?t.error("string.ipVersion",{value:e,cidr:r.cidr,version:r.version}):t.error("string.ip",{value:e,cidr:r.cidr})},isoDate:{method(){return this.$_addRule("isoDate")},validate:(e,{error:t})=>p.isoDate(e)?e:t("string.isoDate")},isoDuration:{method(){return this.$_addRule("isoDuration")},validate:(e,t)=>p.isoDurationRegex.test(e)?e:t.error("string.isoDuration")},length:{method(e,t){return p.length(this,"length",e,"=",t)},validate(e,t,{limit:r,encoding:n},{name:i,operator:o,args:a}){const s=!n&&e.length;return d.compare(s,r,o)?e:t.error("string."+i,{limit:a.limit,value:e,encoding:n})},args:[{name:"limit",ref:!0,assert:d.limit,message:"must be a positive integer"},"encoding"]},lowercase:{method(){return this.case("lower")}},max:{method(e,t){return p.length(this,"max",e,"<=",t)},args:["limit","encoding"]},min:{method(e,t){return p.length(this,"min",e,">=",t)},args:["limit","encoding"]},normalize:{method(e="NFC"){return n(p.normalizationForms.includes(e),"normalization form must be one of "+p.normalizationForms.join(", ")),this.$_addRule({name:"normalize",args:{form:e}})},validate:(e,{error:t},{form:r})=>e===e.normalize(r)?e:t("string.normalize",{value:e,form:r}),convert:!0},pattern:{alias:"regex",method(e,t={}){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}),d.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,{regex:r,options:n},{errorCode:i})=>r.test(e)^n.invert?e:t.error(i,{name:n.name,regex:r,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(e=!0){return n("boolean"==typeof e,"enabled must be a boolean"),this.$_addRule({name:"trim",args:{enabled:e}})},validate:(e,t,{enabled:r})=>r&&e!==e.trim()?t.error("string.trim"):e,convert:!0},truncate:{method(e=!0){return n("boolean"==typeof e,"enabled must be a boolean"),this.$_setFlag("truncate",e)}},uppercase:{method(){return this.case("upper")}},uri:{method(e={}){d.assertOptions(e,["allowRelative","allowQuerySquareBrackets","domain","relativeOnly","scheme"]),e.domain&&d.assertOptions(e.domain,["allowFullyQualified","allowUnicode","maxDomainSegments","minDomainSegments","tlds"]);const{regex:t,scheme:r}=l(e),n=e.domain?p.addressOptions(e.domain):null;return this.$_addRule({name:"uri",args:{options:e},regex:t,domain:n,scheme:r})},validate(e,t,{options:r},{regex:n,domain:i,scheme:a}){if(["http:/","https:/"].includes(e))return t.error("string.uri");const s=n.exec(e);if(s){const n=s[1]||s[2];return!i||r.allowRelative&&!n||o(n,i)?e:t.error("string.domain",{value:n})}return r.relativeOnly?t.error("string.uriRelativeOnly"):r.scheme?t.error("string.uriCustomScheme",{scheme:a,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"}}),p.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(p.tlds,"Built-in TLD list disabled"),Object.assign({},e,p.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"),p.validateTlds(e.tlds.deny,"tlds.deny"),e;const r=e.tlds.allow;return r?!0===r?(n(p.tlds,"Built-in TLD list disabled"),Object.assign({},e,p.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"),p.validateTlds(e.tlds.allow,"tlds.allow"),e):{...e,tlds:!1}},p.validateTlds=function(e,t){for(const r of e)n(o(r,{minDomainSegments:1,maxDomainSegments:1}),`${t} must contain valid top level domain names`)},p.isoDate=function(e){if(!d.isIsoDate(e))return null;/.*T.*[+-]\d\d$/.test(e)&&(e+="00");const t=new Date(e);return isNaN(t.getTime())?null:t.toISOString()},p.length=function(e,t,r,i,o){return n(!o||!1,"Invalid encoding:",o),e.$_addRule({name:t,method:"length",args:{limit:r,encoding:o},operator:i})}},8826:(e,t,r)=>{const{assert:n}=r(8870),i=r(8068),o={};o.Map=class extends Map{slice(){return new o.Map(this)}},e.exports=i.extend({type:"symbol",terms:{map:{init:new o.Map}},coerce:{method(e,{schema:t,error:r}){const n=t.$_terms.map.get(e);return n&&(e=n),t._flags.only&&"symbol"!=typeof e?{value:e,errors:r("symbol.map",{map:t.$_terms.map})}:{value:e}}},validate(e,{error:t}){if("symbol"!=typeof e)return{value:e,errors:t("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 i of e){n(i&&i[Symbol.iterator],"Entry must be an iterable");const[e,o]=i;n("object"!=typeof e&&"function"!=typeof e&&"symbol"!=typeof e,"Key must not be of type object, function, or Symbol"),n("symbol"==typeof o,"Value must be a Symbol"),t.$_terms.map.set(e,o),r.push(o)}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)=>{const{assert:n,clone:i,ignore:o,reach:a}=r(8870),s=r(8160),l=r(6354),u=r(493),c={result:Symbol("result")};t.entry=function(e,t,r){let i=s.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"),i=s.preferences(s.defaults,r));const o=c.entry(e,t,i);n(!o.mainstay.externals.length,"Schema with external rules must use validateAsync()");const a={value:o.value};return o.error&&(a.error=o.error),o.mainstay.warnings.length&&(a.warning=l.details(o.mainstay.warnings)),o.mainstay.debug&&(a.debug=o.mainstay.debug),o.mainstay.artifacts&&(a.artifacts=o.mainstay.artifacts),a},t.entryAsync=async function(e,t,r){let n=s.defaults;r&&(n=s.preferences(s.defaults,r));const i=c.entry(e,t,n),o=i.mainstay;if(i.error)throw o.debug&&(i.error.debug=o.debug),i.error;if(o.externals.length){let t=i.value;const u=[];for(const i of o.externals){const d=i.state.path,p="link"===i.schema.type?o.links.get(i.schema):null;let f,h,m=t;const g=d.length?[t]:[],y=d.length?a(e,d):e;if(d.length){f=d[d.length-1];let e=t;for(const t of d.slice(0,-1))e=e[t],g.unshift(e);h=g[0],m=h[f]}try{const e=(e,t)=>(p||i.schema).$_createError(e,m,t,i.state,n),a=await i.method(m,{schema:i.schema,linked:p,state:i.state,prefs:r,original:y,error:e,errorsArray:c.errorsArray,warn:(e,t)=>o.warnings.push((p||i.schema).$_createError(e,m,t,i.state,n)),message:(e,t)=>(p||i.schema).$_createError("external",m,t,i.state,n,{messages:e})});if(void 0===a||a===m)continue;if(a instanceof l.Report){if(o.tracer.log(i.schema,i.state,"rule","external","error"),u.push(a),n.abortEarly)break;continue}if(Array.isArray(a)&&a[s.symbols.errors]){if(o.tracer.log(i.schema,i.state,"rule","external","error"),u.push(...a),n.abortEarly)break;continue}h?(o.tracer.value(i.state,"rule",m,a,"external"),h[f]=a):(o.tracer.value(i.state,"rule",t,a,"external"),t=a)}catch(e){throw n.errors.label&&(e.message+=` (${i.label})`),e}}if(i.value=t,u.length)throw i.error=l.process(u,e,n),o.debug&&(i.error.debug=o.debug),i.error}if(!n.warnings&&!n.debug&&!n.artifacts)return i.value;const u={value:i.value};return o.warnings.length&&(u.warning=l.details(o.warnings)),o.debug&&(u.debug=o.debug),o.artifacts&&(u.artifacts=o.artifacts),u},c.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()}},c.entry=function(e,r,n){const{tracer:i,cleanup:o}=c.tracer(r,n),a=n.debug?[]:null,s=r._ids._schemaChain?new Map:null,d=new c.Mainstay(i,a,s),p=r._ids._schemaChain?[{schema:r}]:null,f=new u([],[],{mainstay:d,schemas:p}),h=t.validate(e,r,f,n);o&&r.$_root.untrace();const m=l.process(h.errors,e,n);return{value:h.value,error:m,mainstay:d}},c.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:c.ignore}},t.validate=function(e,t,r,n,i={}){if(t.$_terms.whens&&(t=t._generate(e,r,n).schema),t._preferences&&(n=c.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 o=(i,o,a)=>t.$_createError(i,e,o,a||r,n),a={original:e,prefs:n,schema:t,state:r,error:o,errorsArray:c.errorsArray,warn:(e,t,n)=>r.mainstay.warnings.push(o(e,t,n)),message:(i,o)=>t.$_createError("custom",e,o,r,n,{messages:i})};r.mainstay.tracer.entry(t,r);const l=t._definition;if(l.prepare&&void 0!==e&&n.convert){const t=l.prepare(e,a);if(t){if(r.mainstay.tracer.value(r,"prepare",e,t.value),t.errors)return c.finalize(t.value,[].concat(t.errors),a);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,a);if(t){if(r.mainstay.tracer.value(r,"coerced",e,t.value),t.errors)return c.finalize(t.value,[].concat(t.errors),a);e=t.value}}const u=t._flags.empty;u&&u.$_match(c.trim(e,t),r.nest(u),s.defaults)&&(r.mainstay.tracer.value(r,"empty",e,void 0),e=void 0);const d=i.presence||t._flags.presence||(t._flags._endedSwitch?null:n.presence);if(void 0===e){if("forbidden"===d)return c.finalize(e,null,a);if("required"===d)return c.finalize(e,[t.$_createError("any.required",e,null,r,n)],a);if("optional"===d){if(t._flags.default!==s.symbols.deepDefault)return c.finalize(e,null,a);r.mainstay.tracer.value(r,"default",e,{}),e={}}}else if("forbidden"===d)return c.finalize(e,[t.$_createError("any.unknown",e,null,r,n)],a);const p=[];if(t._valids){const i=t._valids.get(e,r,n,t._flags.insensitive);if(i)return n.convert&&(r.mainstay.tracer.value(r,"valids",e,i.value),e=i.value),r.mainstay.tracer.filter(t,r,"valid",i),c.finalize(e,null,a);if(t._flags.only){const i=t.$_createError("any.only",e,{valids:t._valids.values({display:!0})},r,n);if(n.abortEarly)return c.finalize(e,[i],a);p.push(i)}}if(t._invalids){const i=t._invalids.get(e,r,n,t._flags.insensitive);if(i){r.mainstay.tracer.filter(t,r,"invalid",i);const o=t.$_createError("any.invalid",e,{invalids:t._invalids.values({display:!0})},r,n);if(n.abortEarly)return c.finalize(e,[o],a);p.push(o)}}if(l.validate){const t=l.validate(e,a);if(t&&(r.mainstay.tracer.value(r,"base",e,t.value),e=t.value,t.errors)){if(!Array.isArray(t.errors))return p.push(t.errors),c.finalize(e,p,a);if(t.errors.length)return p.push(...t.errors),c.finalize(e,p,a)}}return t._rules.length?c.rules(e,p,a):c.finalize(e,p,a)},c.rules=function(e,t,r){const{schema:n,state:i,prefs:o}=r;for(const a of n._rules){const l=n._definition.rules[a.method];if(l.convert&&o.convert){i.mainstay.tracer.log(n,i,"rule",a.name,"full");continue}let u,d=a.args;if(a._resolve.length){d=Object.assign({},d);for(const t of a._resolve){const r=l.argsByName.get(t),a=d[t].resolve(e,i,o),c=r.normalize?r.normalize(a):a,p=s.validateArg(c,null,r);if(p){u=n.$_createError("any.ref",a,{arg:t,ref:d[t],reason:p},i,o);break}d[t]=c}}u=u||l.validate(e,r,d,a);const p=c.rule(u,a);if(p.errors){if(i.mainstay.tracer.log(n,i,"rule",a.name,"error"),a.warn){i.mainstay.warnings.push(...p.errors);continue}if(o.abortEarly)return c.finalize(e,p.errors,r);t.push(...p.errors)}else i.mainstay.tracer.log(n,i,"rule",a.name,"pass"),i.mainstay.tracer.value(i,"rule",e,p.value,a.name),e=p.value}return c.finalize(e,t,r)},c.rule=function(e,t){return e instanceof l.Report?(c.error(e,t),{errors:[e],value:null}):Array.isArray(e)&&e[s.symbols.errors]?(e.forEach((e=>c.error(e,t))),{errors:e,value:null}):{errors:null,value:e}},c.error=function(e,t){return t.message&&e._setTemplate(t.message),e},c.finalize=function(e,t,r){t=t||[];const{schema:i,state:o,prefs:a}=r;if(t.length){const n=c.default("failover",void 0,t,r);void 0!==n&&(o.mainstay.tracer.value(o,"failover",e,n),e=n,t=[])}if(t.length&&i._flags.error)if("function"==typeof i._flags.error){t=i._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=[i._flags.error];if(void 0===e){const n=c.default("default",e,t,r);o.mainstay.tracer.value(o,"default",e,n),e=n}if(i._flags.cast&&void 0!==e){const t=i._definition.cast[i._flags.cast];if(t.from(e)){const n=t.to(e,r);o.mainstay.tracer.value(o,"cast",e,n,i._flags.cast),e=n}}if(i.$_terms.externals&&a.externals&&!1!==a._externals)for(const{method:e}of i.$_terms.externals)o.mainstay.externals.push({method:e,schema:i,state:o,label:l.label(i._flags,o,a)});const s={value:e,errors:t.length?t:null};return i._flags.result&&(s.value="strip"===i._flags.result?void 0:r.original,o.mainstay.tracer.value(o,i._flags.result,e,s.value),o.shadow(e,i._flags.result)),i._cache&&!1!==a.cache&&!i._refs.length&&i._cache.set(r.original,s),void 0===e||s.errors||void 0===i._flags.artifact||(o.mainstay.artifacts=o.mainstay.artifacts||new Map,o.mainstay.artifacts.has(i._flags.artifact)||o.mainstay.artifacts.set(i._flags.artifact,[]),o.mainstay.artifacts.get(i._flags.artifact).push(o.path)),s},c.prefs=function(e,t){const r=t===s.defaults;return r&&e._preferences[s.symbols.prefs]?e._preferences[s.symbols.prefs]:(t=s.preferences(t,e._preferences),r&&(e._preferences[s.symbols.prefs]=t),t)},c.default=function(e,t,r,n){const{schema:o,state:a,prefs:l}=n,u=o._flags[e];if(l.noDefaults||void 0===u)return t;if(a.mainstay.tracer.log(o,a,"rule",e,"full"),!u)return u;if("function"==typeof u){const s=u.length?[i(a.ancestors[0]),n]:[];try{return u(...s)}catch(t){return void r.push(o.$_createError(`any.${e}`,null,{error:t},a,l))}}return"object"!=typeof u?u:u[s.symbols.literal]?u.literal:s.isResolvable(u)?u.resolve(t,a,l):i(u)},c.trim=function(e,t){if("string"!=typeof e)return e;const r=t.$_getRule("trim");return r&&r.args.enabled?e.trim():e},c.ignore={active:!1,debug:o,entry:o,filter:o,log:o,resolve:o,value:o},c.errorsArray=function(){const e=[];return e[s.symbols.errors]=!0,e}},2036:(e,t,r)=>{const{assert:n,deepEqual:i}=r(8870),o=r(8160),a={};e.exports=a.Values=class{constructor(e,t){this._values=new Set(e),this._refs=new Set(t),this._lowercase=a.lowercases(e),this._override=!1}get length(){return this._values.size+this._refs.size}add(e,t){o.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 a.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){o.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(i(t,e))return{value:t};if(t)for(const o of this._refs){const a=o.resolve(e,t,r,null,{in:!0});if(void 0===a)continue;const s=o.in&&"object"==typeof a?Array.isArray(a)?a:Object.keys(a):[a];for(const t of s)if(typeof t==typeof e)if(n&&e&&"string"==typeof e){if(t.toLowerCase()===e.toLowerCase())return{value:t,ref:o}}else if(i(t,e))return{value:t,ref:o}}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 a.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 a.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}},a.Values.prototype[o.symbols.values]=!0,a.Values.prototype.slice=a.Values.prototype.clone,a.lowercases=function(e){const t=new Map;if(e)for(const r of e)"string"==typeof r&&t.set(r.toLowerCase(),r);return t}},4958:(e,t,r)=>{r.r(t),r.d(t,{analyzeDomain:()=>h,analyzeEmail:()=>_,errorCodes:()=>i,ipRegex:()=>M,isDomainValid:()=>m,isEmailValid:()=>A,uriDecode:()=>q,uriRegex:()=>P,validateDomainOptions:()=>g});var n=r(1275);const i={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"};function o(e){return{code:e,error:i[e]}}const a=2,s=/[^\x00-\x7f]/,l=/[\x00-\x20@\:\/\\#!\$&\'\(\)\*\+,;=\?]/,u=/^[a-zA-Z](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/,c=/^[a-zA-Z0-9](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/,d=/^[a-zA-Z0-9_](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/,p=n.URL||URL;function f(e){return!!e.allow}function h(e,t={}){if(!e)return o("DOMAIN_NON_EMPTY_STRING");if("string"!=typeof e)throw new Error("Invalid input: domain must be a string");if(e.length>256)return o("DOMAIN_TOO_LONG");if(s.test(e)){if(!1===t.allowUnicode)return o("DOMAIN_INVALID_UNICODE_CHARS");e=e.normalize("NFC")}if(l.test(e))return o("DOMAIN_INVALID_CHARS");e=function(e){e.includes("%")&&(e=e.replace(/%/g,"%25"));try{return new p(`http://${e}`).host}catch(t){return e}}(e),t.allowFullyQualified&&"."===e[e.length-1]&&(e=e.slice(0,-1));const r=t.minDomainSegments||a,n=e.split(".");if(n.length<r)return o("DOMAIN_SEGMENTS_COUNT");if(t.maxDomainSegments&&n.length>t.maxDomainSegments)return o("DOMAIN_SEGMENTS_COUNT_MAX");const i=t.tlds;if(i){const e=n[n.length-1].toLowerCase();if(f(i)){if(!i.allow.has(e))return o("DOMAIN_FORBIDDEN_TLDS")}else if(i.deny.has(e))return o("DOMAIN_FORBIDDEN_TLDS")}for(let e=0;e<n.length;++e){const r=n[e];if(!r.length)return o("DOMAIN_EMPTY_SEGMENT");if(r.length>63)return o("DOMAIN_LONG_SEGMENT");if(e<n.length-1){if(t.allowUnderscore){if(!d.test(r))return o("DOMAIN_INVALID_CHARS")}else if(!c.test(r))return o("DOMAIN_INVALID_CHARS")}else if(!u.test(r))return o("DOMAIN_INVALID_TLDS_CHARS")}return null}function m(e,t){return!h(e,t)}function g(e){if(e){if("object"!=typeof e.tlds)throw new Error("Invalid options: tlds must be a boolean or an object");if(f(e.tlds)){if(e.tlds.allow instanceof Set==0)throw new Error("Invalid options: tlds.allow must be a Set object or true");if(e.tlds.deny)throw new Error("Invalid options: cannot specify both tlds.allow and tlds.deny lists")}else if(e.tlds.deny instanceof Set==0)throw new Error("Invalid options: tlds.deny must be a Set object")}}var y=r(3975);const b=/[^\x00-\x7f]/,v=new(y.TextEncoder||TextEncoder);function _(e,t){return w(e,t)}function A(e,t){return!w(e,t)}function w(e,t={}){if("string"!=typeof e)throw new Error("Invalid input: email must be a string");if(!e)return o("EMPTY_STRING");const r=!b.test(e);if(!r){if(!1===t.allowUnicode)return o("FORBIDDEN_UNICODE");e=e.normalize("NFC")}const n=e.split("@");if(2!==n.length)return n.length>2?o("MULTIPLE_AT_CHAR"):o("MISSING_AT_CHAR");const[i,a]=n;if(!i)return o("EMPTY_LOCAL");if(!t.ignoreLength){if(e.length>254)return o("ADDRESS_TOO_LONG");if(v.encode(i).length>64)return o("LOCAL_TOO_LONG")}return function(e,t){const r=e.split(".");for(const e of r){if(!e.length)return o("EMPTY_LOCAL_SEGMENT");if(t){if(!T.test(e))return o("INVALID_LOCAL_CHARS")}else for(const t of e){if(T.test(t))continue;const e=S(t);if(!E.test(e))return o("INVALID_LOCAL_CHARS")}}return null}(i,r)||h(a,t)}function S(e){return Array.from(v.encode(e),(e=>String.fromCharCode(e))).join("")}const T=/^[\w!#\$%&'\*\+\-/=\?\^`\{\|\}~]+$/,E=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("|"));var O=r(375),x=r.n(O),C=r(6064),I=r.n(C);const j=function(){const e={},t="\\dA-Fa-f",r="["+t+"]",n="\\w-\\.~",i="!\\$&'\\(\\)\\*\\+,;=",o="%"+t,a=n+o+i+":@",s="["+a+"]",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 u=r+"{1,4}",c="(?:"+u+":"+u+"|"+e.ipv4address+")",d="(?:"+u+":){6}"+c,p="::(?:"+u+":){5}"+c,f="(?:"+u+")?::(?:"+u+":){4}"+c,h="(?:(?:"+u+":){0,1}"+u+")?::(?:"+u+":){3}"+c,m="(?:(?:"+u+":){0,2}"+u+")?::(?:"+u+":){2}"+c,g="(?:(?:"+u+":){0,3}"+u+")?::"+u+":"+c,y="(?:(?:"+u+":){0,4}"+u+")?::"+c,b="(?:(?:"+u+":){0,5}"+u+")?::"+u,v="(?:(?:"+u+":){0,6}"+u+")?::";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="(?:"+d+"|"+p+"|"+f+"|"+h+"|"+m+"|"+g+"|"+y+"|"+b+"|"+v+")",e.ipvFuture="v"+r+"+\\.["+n+i+":]+",e.scheme="[a-zA-Z][a-zA-Z\\d+-\\.]*",e.schemeRegex=new RegExp(e.scheme);const _="["+n+o+i+":]*",A="["+n+o+i+"]{1,255}",w="(?:\\[(?:"+e.ipv6address+"|"+e.ipvFuture+")\\]|"+e.ipv4address+"|"+A+")",S="(?:"+_+"@)?"+w+"(?::\\d*)?",T="(?:"+_+"@)?("+w+")(?::\\d*)?",E=s+"*",O=s+"+",x="(?:\\/"+E+")*",C="\\/(?:"+O+x+")?",I=O+x,j="["+n+o+i+"@]+"+x,R="(?:\\/\\/\\/"+E+x+")";return e.hierPart="(?:(?:\\/\\/"+S+x+")|"+C+"|"+I+"|"+R+")",e.hierPartCapture="(?:(?:\\/\\/"+T+x+")|"+C+"|"+I+")",e.relativeRef="(?:(?:\\/\\/"+S+x+")|"+C+"|"+j+"|)",e.relativeRefCapture="(?:(?:\\/\\/"+T+x+")|"+C+"|"+j+"|)",e.query="["+a+"\\/\\?]*(?=#|$)",e.queryWithSquareBrackets="["+a+"\\[\\]\\/\\?]*(?=#|$)",e.fragment="["+a+"\\/\\?]*",e}(),R={v4Cidr:j.ipv4Cidr,v6Cidr:j.ipv6Cidr,ipv4:j.ipv4address,ipv6:j.ipv6address,ipvfuture:j.ipvFuture};function D(e){const t=j,r="(?:\\?"+(e.allowQuerySquareBrackets?t.queryWithSquareBrackets:t.query)+")?(?:#"+t.fragment+")?",n=e.domain?t.relativeRefCapture:t.relativeRef;if(e.relativeOnly)return F(n+r);let i="";if(e.scheme){x()(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);x()(r.length>=1,"scheme must have at least 1 scheme specified");const n=[];for(let e=0;e<r.length;++e){const i=r[e];x()(i instanceof RegExp||"string"==typeof i,"scheme at position "+e+" must be a RegExp or String"),i instanceof RegExp?n.push(i.source.toString()):(x()(t.schemeRegex.test(i),"scheme at position "+e+" must be a valid scheme"),n.push(I()(i)))}i=n.join("|")}const o="(?:"+(i?"(?:"+i+")":t.scheme)+":"+(e.domain?t.hierPartCapture:t.hierPart)+")";return F((e.allowRelative?"(?:"+o+"|"+n+")":o)+r,i)}function F(e,t=null){return{raw:e=`(?=.)(?!https?:/(?:$|[^/]))(?!https?:///)(?!https?:[^/])${e}`,regex:new RegExp(`^${e}$`),scheme:t}}const N=D({});function P(e={}){return e.scheme||e.allowRelative||e.relativeOnly||e.allowQuerySquareBrackets||e.domain?D(e):N}function M(e={}){const t=e.cidr||"optional";x()(["required","optional","forbidden"].includes(t),"options.cidr must be one of required, optional, forbidden"),x()(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]),x()(r.length>=1,"options.version must have at least 1 version specified");for(const e of r)x()("string"==typeof e&&e===e.toLowerCase(),"Invalid options.version value"),x()(["ipv4","ipv6","ipvfuture"].includes(e),"options.version contains unknown version "+e+" - must be one of ipv4, ipv6, ipvfuture");r=Array.from(new Set(r));const n=`(?:${r.map((e=>{if("forbidden"===t)return R[e];const r=`\\/${"ipv4"===e?R.v4Cidr:R.v6Cidr}`;return"required"===t?`${R[e]}${r}`:`${R[e]}(?:${r})?`})).join("|")})`,i=new RegExp(`^${n}$`);return{cidr:t,versions:r,regex:i,raw:n}}const L={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15},k={accept:12,reject:0,data:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,7,7,7,7,7,7,7,7,7,7,7,7,8,7,7,10,9,9,9,11,4,4,4,4,4,4,4,4,4,4,4,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,24,36,48,60,72,84,96,0,12,12,12,0,0,0,0,0,0,0,0,0,0,0,24,0,0,0,0,0,0,0,0,0,24,24,24,0,0,0,0,0,0,0,0,0,24,24,0,0,0,0,0,0,0,0,0,0,48,48,48,0,0,0,0,0,0,0,0,0,0,48,48,0,0,0,0,0,0,0,0,0,48,0,0,0,0,0,0,0,0,0,0,127,63,63,63,0,31,15,15,15,7,7,7]};function q(e){let t=e.indexOf("%");if(-1===t)return e;let r="",n=0,i=0,o=t,a=k.accept;for(;t>-1&&t<e.length;){const s=$(e[t+1],4)|$(e[t+2],0),l=k.data[s];if(a=k.data[256+a+l],i=i<<6|s&k.data[364+l],a!==k.accept){if(a===k.reject)return null;if(t+=3,t>=e.length||"%"!==e[t])return null}else r+=e.slice(n,o),r+=i<=65535?String.fromCharCode(i):String.fromCharCode(55232+(i>>10),56320+(1023&i)),i=0,n=t+3,t=e.indexOf("%",n),o=t}return r+e.slice(n)}function $(e,t){const r=L[e];return void 0===r?255:r<<t}},4964:(e,t)=>{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,t={}){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=[],i="",o=0,a=!1;const s=e=>{if(o)throw new Error("Formula missing closing parenthesis");const s=n.length?n[n.length-1]:null;if(a||i||e){if(s&&"reference"===s.type&&")"===e)return s.type="function",s.value=this._subFormula(i,s.value),void(i="");if(")"===e){const e=new t.Parser(i,this.settings);n.push({type:"segment",value:e})}else if(a){if("]"===a)return n.push({type:"reference",value:i}),void(i="");n.push({type:"literal",value:i})}else if(r.operatorCharacters.includes(i))s&&"operator"===s.type&&r.operators.includes(s.value+i)?s.value+=i:n.push({type:"operator",value:i});else if(i.match(r.numberRx))n.push({type:"constant",value:parseFloat(i)});else if(void 0!==this.settings.constants[i])n.push({type:"constant",value:this.settings.constants[i]});else{if(!i.match(r.tokenRx))throw new Error(`Formula contains invalid token: ${i}`);n.push({type:"reference",value:i})}i=""}};for(const t of e)a?t===a?(s(),a=!1):i+=t:o?"("===t?(i+=t,++o):")"===t?(--o,o?i+=t:s(t)):i+=t:t in r.literals?a=r.literals[t]:"("===t?(s(),++o):r.operatorCharacters.includes(t)?(s(),i=t,s()):" "!==t?i+=t:s();s(),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 i=this.settings.functions[n];if("function"!=typeof i)throw new Error(`Formula contains unknown function ${n}`);let o=[];if(e){let t="",i=0,a=!1;const s=()=>{if(!t)throw new Error(`Formula contains function ${n} with invalid arguments ${e}`);o.push(t),t=""};for(let n=0;n<e.length;++n){const o=e[n];a?(t+=o,o===a&&(a=!1)):o in r.literals&&!i?(t+=o,a=r.literals[o]):","!==o||i?(t+=o,"("===o?++i:")"===o&&--i):s()}s()}return o=o.map((e=>new t.Parser(e,this.settings))),function(e){const t=[];for(const r of o)t.push(r.evaluate(e));return i.call(e,...t)}}evaluate(e){const t=this._parts.slice();for(let n=t.length-2;n>=0;--n){const i=t[n];if(i&&"operator"===i.type){const o=t[n+1];t.splice(n+1,1);const a=r.evaluate(o,e);t[n]=r.single(i.value,a)}}return r.operatorsOrder.forEach((n=>{for(let i=1;i<t.length-1;)if(n.includes(t[i])){const n=t[i],o=r.evaluate(t[i-1],e),a=r.evaluate(t[i+1],e);t.splice(i,2);const s=r.calculate(n,o,a);t[i-1]=0===s?0:s}else i+=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}},978:(e,t,r)=>{const n=r(375),i=r(8571),o=r(1687),a=r(9621),s={};e.exports=function(e,t,r={}){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 s.applyToDefaultsWithShallow(e,t,r);const a=i(e);if(!0===t)return a;const l=void 0!==r.nullOverride&&r.nullOverride;return o(a,t,{nullOverride:l,mergeArrays:!1})},s.applyToDefaultsWithShallow=function(e,t,r){const l=r.shallow;n(Array.isArray(l),"Invalid keys");const u=new Map,c=!0===t?null:new Set;for(let r of l){r=Array.isArray(r)?r:r.split(".");const n=a(e,r);n&&"object"==typeof n?u.set(n,c&&a(t,r)||n):c&&c.add(r)}const d=i(e,{},u);if(!c)return d;for(const e of c)s.reachCopy(d,t,e);const p=void 0!==r.nullOverride&&r.nullOverride;return o(d,t,{nullOverride:p,mergeArrays:!1})},s.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 i=e;for(let e=0;e<r.length-1;++e){const t=r[e];"object"!=typeof i[t]&&(i[t]={}),i=i[t]}i[r[r.length-1]]=n}},375:(e,t,r)=>{const n=r(4213),i=r(8761),o=e.exports=function(e,...t){if(e)return;if(1===t.length&&t[0]instanceof Error)throw t[0];const r=t.filter((e=>""!==e)).map((e=>"string"==typeof e?e:e instanceof Error?e.message:i(e)));throw new n(r.join(" "),o)}},4213:e=>{e.exports=class extends Error{constructor(e,t){var r,n,i,o;super(e||"Unknown error"),r=this,i="AssertError",(n="symbol"==typeof(o=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(n="name"))?o:String(o))in r?Object.defineProperty(r,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[n]=i,"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,t)}}},9367:e=>{const t={};e.exports=t.Bench=class{constructor(){this.ts=0,this.reset()}reset(){this.ts=t.Bench.now()}elapsed(){return t.Bench.now()-this.ts}static now(){const e=process.hrtime();return 1e3*e[0]+e[1]/1e6}}},8630:(e,t,r)=>{const n=r(738);e.exports=function(){return new Promise(n)}},8571:(e,t,r)=>{const n=r(9621),i=r(4277),o=r(7043),a={needsProtoHack:new Set([i.set,i.map,i.weakSet,i.weakMap])};e.exports=a.clone=function(e,t={},r=null){if("object"!=typeof e||null===e)return e;let n=a.clone,s=r;if(t.shallow){if(!0!==t.shallow)return a.cloneWithShallow(e,t);n=e=>e}else if(s){const t=s.get(e);if(t)return t}else s=new Map;const l=i.getInternalProto(e);switch(l){case i.buffer:return(!1).from(e);case i.date:return new Date(e.getTime());case i.regex:case i.url:return new l.constructor(e)}const u=a.base(e,l,t);if(u===e)return e;if(s&&s.set(e,u),l===i.set)for(const r of e)u.add(n(r,t,s));else if(l===i.map)for(const[r,i]of e)u.set(r,n(i,t,s));const c=o.keys(e,t);for(const r of c){if("__proto__"===r)continue;if(l===i.array&&"length"===r){u.length=e.length;continue}const o=Object.getOwnPropertyDescriptor(e,r);o?o.get||o.set?Object.defineProperty(u,r,o):o.enumerable?u[r]=n(e[r],t,s):Object.defineProperty(u,r,{enumerable:!1,writable:!0,configurable:!0,value:n(e[r],t,s)}):Object.defineProperty(u,r,{enumerable:!0,writable:!0,configurable:!0,value:n(e[r],t,s)})}return u},a.cloneWithShallow=function(e,t){const r=t.shallow;(t=Object.assign({},t)).shallow=!1;const i=new Map;for(const t of r){const r=n(e,t);"object"!=typeof r&&"function"!=typeof r||i.set(r,r)}return a.clone(e,t,i)},a.base=function(e,t,r){if(!1===r.prototype)return a.needsProtoHack.has(t)?new t.constructor:t===i.array?[]:{};const n=Object.getPrototypeOf(e);if(n&&n.isImmutable)return e;if(t===i.array){const e=[];return n!==t&&Object.setPrototypeOf(e,n),e}if(a.needsProtoHack.has(t)){const e=new n.constructor;return n!==t&&Object.setPrototypeOf(e,n),e}return Object.create(n)}},1467:(e,t,r)=>{const n=r(375),i=r(9474),o=r(6064),a=r(7043),s={};e.exports=function(e,t,r={}){return"object"!=typeof t&&(t=[t]),n(!Array.isArray(t)||t.length,"Values array cannot be empty"),"string"==typeof e?s.string(e,t,r):Array.isArray(e)?s.array(e,t,r):(n("object"==typeof e,"Reference must be string or an object"),s.object(e,t,r))},s.array=function(e,t,r){if(Array.isArray(t)||(t=[t]),!e.length)return!1;if(r.only&&r.once&&e.length!==t.length)return!1;let n;const i=new Map;for(const e of t)if(r.deep&&e&&"object"==typeof e){var o;n=null!==(o=n)&&void 0!==o?o:s.compare(r);let t=!1;for(const[r,o]of i.entries())if(n(r,e)){++o.allowed,t=!0;break}t||i.set(e,{allowed:1,hits:0})}else{const t=i.get(e);t?++t.allowed:i.set(e,{allowed:1,hits:0})}let a=0;for(const t of e){let e;if(r.deep&&t&&"object"==typeof t){var l;n=null!==(l=n)&&void 0!==l?l:s.compare(r);for(const[r,o]of i.entries())if(n(r,t)){e=o;break}}else e=i.get(t);if(e&&(++e.hits,++a,r.once&&e.hits>e.allowed))return!1}if(r.only&&a!==e.length)return!1;for(const e of i.values())if(e.hits!==e.allowed&&e.hits<e.allowed&&!r.part)return!1;return!!a},s.object=function(e,t,r){n(void 0===r.once,"Cannot use option once with object");const i=a.keys(e,r);if(!i.length)return!1;if(Array.isArray(t))return s.array(i,t,r);const o=Object.getOwnPropertySymbols(t).filter((e=>t.propertyIsEnumerable(e))),l=[...Object.keys(t),...o],u=s.compare(r),c=new Set(l);for(const n of i)if(c.has(n)){if(!u(t[n],e[n]))return!1;c.delete(n)}else if(r.only)return!1;return!c.size||!!r.part&&c.size<l.length},s.string=function(e,t,r){if(""===e)return 1===t.length&&""===t[0]||!r.once&&!t.some((e=>""!==e));const i=new Map,a=[];for(const e of t)if(n("string"==typeof e,"Cannot compare string reference to non-string value"),e){const t=i.get(e);t?++t.allowed:(i.set(e,{allowed:1,hits:0}),a.push(o(e)))}else if(r.once||r.only)return!1;if(!a.length)return!0;const s=new RegExp(`(${a.join("|")})`,"g"),l=e.replace(s,((e,t)=>(++i.get(t).hits,"")));if(r.only&&l)return!1;let u=!1;for(const e of i.values())if(e.hits&&(u=!0),e.hits!==e.allowed){if(e.hits<e.allowed&&!r.part)return!1;if(r.once)return!1}return!!u},s.compare=function(e){if(!e.deep)return s.shallow;const t=void 0!==e.only,r=void 0!==e.part,n={prototype:t?e.only:!!r&&!e.part,part:t?!e.only:!!r&&e.part};return(e,t)=>i(e,t,n)},s.shallow=function(e,t){return e===t}},9474:(e,t,r)=>{const n=r(4277),i={mismatched:null};e.exports=function(e,t,r){return r=Object.assign({prototype:!0},r),!!i.isDeepEqual(e,t,r,[])},i.isDeepEqual=function(e,t,r,o){if(e===t)return 0!==e||1/e==1/t;const a=typeof e;if(a!==typeof t)return!1;if(null===e||null===t)return!1;if("function"===a){if(!r.deepFunction||e.toString()!==t.toString())return!1}else if("object"!==a)return e!=e&&t!=t;const s=i.getSharedType(e,t,!!r.prototype);switch(s){case n.buffer:return!1;case n.promise:return e===t;case n.regex:case n.url:return e.toString()===t.toString();case i.mismatched:return!1}for(let r=o.length-1;r>=0;--r)if(o[r].isSame(e,t))return!0;o.push(new i.SeenEntry(e,t));try{return!!i.isDeepEqualObj(s,e,t,r,o)}finally{o.pop()}},i.getSharedType=function(e,t,r){if(r)return Object.getPrototypeOf(e)!==Object.getPrototypeOf(t)?i.mismatched:n.getInternalProto(e);const o=n.getInternalProto(e);return o!==n.getInternalProto(t)?i.mismatched:o},i.valueOf=function(e){const t=e.valueOf;if(void 0===t)return e;try{return t.call(e)}catch(e){return e}},i.hasOwnEnumerableProperty=function(e,t){return Object.prototype.propertyIsEnumerable.call(e,t)},i.isSetSimpleEqual=function(e,t){for(const r of Set.prototype.values.call(e))if(!Set.prototype.has.call(t,r))return!1;return!0},i.isDeepEqualObj=function(e,t,r,o,a){const{isDeepEqual:s,valueOf:l,hasOwnEnumerableProperty:u}=i,{keys:c,getOwnPropertySymbols:d}=Object;if(e===n.array){if(!o.part){if(t.length!==r.length)return!1;for(let e=0;e<t.length;++e)if(!s(t[e],r[e],o,a))return!1;return!0}for(const e of t)for(const t of r)if(s(e,t,o,a))return!0}else if(e===n.set){if(t.size!==r.size)return!1;if(!i.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(s(r,n,o,a)){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(!s(n,Map.prototype.get.call(r,e),o,a))return!1}}else if(e===n.error&&(t.name!==r.name||t.message!==r.message))return!1;const p=l(t),f=l(r);if((t!==p||r!==f)&&!s(p,f,o,a))return!1;const h=c(t);if(!o.part&&h.length!==c(r).length&&!o.skip)return!1;let m=0;for(const e of h)if(o.skip&&o.skip.includes(e))void 0===r[e]&&++m;else{if(!u(r,e))return!1;if(!s(t[e],r[e],o,a))return!1}if(!o.part&&h.length-m!==c(r).length)return!1;if(!1!==o.symbols){const e=d(t),n=new Set(d(r));for(const i of e){var g;if(null===(g=o.skip)||void 0===g||!g.includes(i))if(u(t,i)){if(!u(r,i))return!1;if(!s(t[i],r[i],o,a))return!1}else if(u(r,i))return!1;n.delete(i)}for(const e of n)if(u(r,e))return!1}return!0},i.SeenEntry=class{constructor(e,t){this.obj=e,this.ref=t}isSame(e,t){return this.obj===e&&this.ref===t}}},4168:(e,t,r)=>{const n=r(375);e.exports=function(e){return n(/^[ \w\!#\$%&'\(\)\*\+,\-\.\/\:;<\=>\?@\[\]\^`\{\|\}~\"\\]*$/.test(e),"Bad attribute value ("+e+")"),e.replace(/\\/g,"\\\\").replace(/\"/g,'\\"')}},5277:e=>{const t={};e.exports=function(e){if(!e)return"";let r="";for(let n=0;n<e.length;++n){const i=e.charCodeAt(n);t.isSafe(i)?r+=e[n]:r+=t.escapeHtmlChar(i)}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,"&amp;"],[60,"&lt;"],[62,"&gt;"],[34,"&quot;"],[160,"&nbsp;"],[162,"&cent;"],[163,"&pound;"],[164,"&curren;"],[169,"&copy;"],[174,"&reg;"]]),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}()},7973:e=>{const t={};e.exports=function(e){return e?e.replace(/[<>&\u2028\u2029]/g,t.escape):""},t.escape=function(e){return t.replacements.get(e)},t.replacements=new Map([["<","\\u003c"],[">","\\u003e"],["&","\\u0026"],["\u2028","\\u2028"],["\u2029","\\u2029"]])},6064:e=>{e.exports=function(e){return e.replace(/[\^\$\.\*\+\-\?\=\!\:\|\\\/\(\)\[\]\{\}\,]/g,"\\$&")}},655:e=>{const t={};e.exports=t.flatten=function(e,r){const n=r||[];for(const r of e)Array.isArray(r)?t.flatten(r,n):n.push(r);return n}},738:e=>{e.exports=function(){}},8870:(e,t,r)=>{t.applyToDefaults=r(978),t.assert=r(375),t.AssertError=r(4213),t.Bench=r(9367),t.block=r(8630),t.clone=r(8571),t.contain=r(1467),t.deepEqual=r(9474),t.escapeHeaderAttribute=r(4168),t.escapeHtml=r(5277),t.escapeJson=r(7973),t.escapeRegex=r(6064),t.flatten=r(655),t.ignore=r(738),t.intersect=r(5088),t.isPromise=r(7259),t.merge=r(1687),t.once=r(5022),t.reach=r(9621),t.reachTemplate=r(4069),t.stringify=r(8761),t.wait=r(2620)},5088:e=>{const t={};e.exports=function(e,r,n={}){if(!e||!r)return n.first?null:[];const i=[],o=Array.isArray(e)?new Set(e):e,a=new Set;for(const e of r)if(t.has(o,e)&&!a.has(e)){if(n.first)return e;i.push(e),a.add(e)}return n.first?null:i},t.has=function(e,t){return"function"==typeof e.has?e.has(t):void 0!==e[t]}},7259:e=>{e.exports=function(e){return"function"==typeof(null==e?void 0:e.then)}},1687:(e,t,r)=>{const n=r(375),i=r(8571),o=r(7043),a={};e.exports=a.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(i(t[n],{symbols:r.symbols}));return e}const s=o.keys(t,r);for(let n=0;n<s.length;++n){const o=s[n];if("__proto__"===o||!Object.prototype.propertyIsEnumerable.call(t,o))continue;const l=t[o];if(l&&"object"==typeof l){if(e[o]===l)continue;!e[o]||"object"!=typeof e[o]||Array.isArray(e[o])!==Array.isArray(l)||l instanceof Date||l instanceof RegExp?e[o]=i(l,{symbols:r.symbols}):a.merge(e[o],l,r)}else(null!=l||r.nullOverride)&&(e[o]=l)}return e}},5022:e=>{const t=Symbol("wrapped");e.exports=function(e){if(e[t])return e;let r=!1;const n=function(...t){r||(r=!0,e(...t))};return n[t]=!0,n}},9621:(e,t,r)=>{const n=r(375),i={};e.exports=function(e,t,r){if(!1===t||null==t)return e;"string"==typeof(r=r||{})&&(r={separator:r});const o=Array.isArray(t);n(!o||!r.separator,"Separator option is not valid for array-based chain");const a=o?t:t.split(r.separator||".");let s=e;for(let e=0;e<a.length;++e){let o=a[e];const l=r.iterables&&i.iterables(s);if(Array.isArray(s)||"set"===l){const e=Number(o);Number.isInteger(e)&&(o=e<0?s.length+e:e)}if(!s||"function"==typeof s&&!1===r.functions||!l&&void 0===s[o]){n(!r.strict||e+1===a.length,"Missing segment",o,"in reach path ",t),n("object"==typeof s||!0===r.functions||"function"!=typeof s,"Invalid segment",o,"in reach path ",t),s=r.default;break}s=l?"set"===l?[...s][o]:s.get(o):s[o]}return s},i.iterables=function(e){return e instanceof Set?"set":e instanceof Map?"map":void 0}},4069:(e,t,r)=>{const n=r(9621);e.exports=function(e,t,r){return t.replace(/{([^{}]+)}/g,((t,i)=>{const o=n(e,i,r);return null!=o?o:""}))}},8761:e=>{e.exports=function(...e){try{return JSON.stringify(...e)}catch(e){return"[Cannot display object: "+e.message+"]"}}},4277:(e,t)=>{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,url:URL.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 URL]",t.url],["[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)=>{t.keys=function(e,t={}){return!1!==t.symbols?Reflect.ownKeys(e):Object.getOwnPropertyNames(e)}},2620:e=>{e.exports=function(e,t,r){if("bigint"==typeof e&&(e=Number(e)),e>=Number.MAX_SAFE_INTEGER&&(e=1/0),"number"!=typeof e&&void 0!==e)throw new TypeError("Timeout must be a number or bigint");return new Promise((n=>{const i=r?r.setTimeout:setTimeout,o=()=>{const r=Math.min(e,2147483647);e-=r,i((()=>e>0?o():n(t)),r)};e!==1/0&&o()}))}},7593:(e,t)=>{t.location=function(e=0){const t=Error.prepareStackTrace;Error.prepareStackTrace=(e,t)=>t;const r={};Error.captureStackTrace(r,this);const n=r.stack[e+1];return Error.prepareStackTrace=t,{filename:n.getFileName(),line:n.getLineNumber()}}},6264:(e,t,r)=>{r.r(t),r.d(t,{tlds:()=>n});const n=new Set(["AAA","AARP","ABB","ABBOTT","ABBVIE","ABC","ABLE","ABOGADO","ABUDHABI","AC","ACADEMY","ACCENTURE","ACCOUNTANT","ACCOUNTANTS","ACO","ACTOR","AD","ADS","ADULT","AE","AEG","AERO","AETNA","AF","AFL","AFRICA","AG","AGAKHAN","AGENCY","AI","AIG","AIRBUS","AIRFORCE","AIRTEL","AKDN","AL","ALIBABA","ALIPAY","ALLFINANZ","ALLSTATE","ALLY","ALSACE","ALSTOM","AM","AMAZON","AMERICANEXPRESS","AMERICANFAMILY","AMEX","AMFAM","AMICA","AMSTERDAM","ANALYTICS","ANDROID","ANQUAN","ANZ","AO","AOL","APARTMENTS","APP","APPLE","AQ","AQUARELLE","AR","ARAB","ARAMCO","ARCHI","ARMY","ARPA","ART","ARTE","AS","ASDA","ASIA","ASSOCIATES","AT","ATHLETA","ATTORNEY","AU","AUCTION","AUDI","AUDIBLE","AUDIO","AUSPOST","AUTHOR","AUTO","AUTOS","AVIANCA","AW","AWS","AX","AXA","AZ","AZURE","BA","BABY","BAIDU","BANAMEX","BANANAREPUBLIC","BAND","BANK","BAR","BARCELONA","BARCLAYCARD","BARCLAYS","BAREFOOT","BARGAINS","BASEBALL","BASKETBALL","BAUHAUS","BAYERN","BB","BBC","BBT","BBVA","BCG","BCN","BD","BE","BEATS","BEAUTY","BEER","BENTLEY","BERLIN","BEST","BESTBUY","BET","BF","BG","BH","BHARTI","BI","BIBLE","BID","BIKE","BING","BINGO","BIO","BIZ","BJ","BLACK","BLACKFRIDAY","BLOCKBUSTER","BLOG","BLOOMBERG","BLUE","BM","BMS","BMW","BN","BNPPARIBAS","BO","BOATS","BOEHRINGER","BOFA","BOM","BOND","BOO","BOOK","BOOKING","BOSCH","BOSTIK","BOSTON","BOT","BOUTIQUE","BOX","BR","BRADESCO","BRIDGESTONE","BROADWAY","BROKER","BROTHER","BRUSSELS","BS","BT","BUILD","BUILDERS","BUSINESS","BUY","BUZZ","BV","BW","BY","BZ","BZH","CA","CAB","CAFE","CAL","CALL","CALVINKLEIN","CAM","CAMERA","CAMP","CANON","CAPETOWN","CAPITAL","CAPITALONE","CAR","CARAVAN","CARDS","CARE","CAREER","CAREERS","CARS","CASA","CASE","CASH","CASINO","CAT","CATERING","CATHOLIC","CBA","CBN","CBRE","CBS","CC","CD","CENTER","CEO","CERN","CF","CFA","CFD","CG","CH","CHANEL","CHANNEL","CHARITY","CHASE","CHAT","CHEAP","CHINTAI","CHRISTMAS","CHROME","CHURCH","CI","CIPRIANI","CIRCLE","CISCO","CITADEL","CITI","CITIC","CITY","CITYEATS","CK","CL","CLAIMS","CLEANING","CLICK","CLINIC","CLINIQUE","CLOTHING","CLOUD","CLUB","CLUBMED","CM","CN","CO","COACH","CODES","COFFEE","COLLEGE","COLOGNE","COM","COMCAST","COMMBANK","COMMUNITY","COMPANY","COMPARE","COMPUTER","COMSEC","CONDOS","CONSTRUCTION","CONSULTING","CONTACT","CONTRACTORS","COOKING","COOL","COOP","CORSICA","COUNTRY","COUPON","COUPONS","COURSES","CPA","CR","CREDIT","CREDITCARD","CREDITUNION","CRICKET","CROWN","CRS","CRUISE","CRUISES","CU","CUISINELLA","CV","CW","CX","CY","CYMRU","CYOU","CZ","DABUR","DAD","DANCE","DATA","DATE","DATING","DATSUN","DAY","DCLK","DDS","DE","DEAL","DEALER","DEALS","DEGREE","DELIVERY","DELL","DELOITTE","DELTA","DEMOCRAT","DENTAL","DENTIST","DESI","DESIGN","DEV","DHL","DIAMONDS","DIET","DIGITAL","DIRECT","DIRECTORY","DISCOUNT","DISCOVER","DISH","DIY","DJ","DK","DM","DNP","DO","DOCS","DOCTOR","DOG","DOMAINS","DOT","DOWNLOAD","DRIVE","DTV","DUBAI","DUNLOP","DUPONT","DURBAN","DVAG","DVR","DZ","EARTH","EAT","EC","ECO","EDEKA","EDU","EDUCATION","EE","EG","EMAIL","EMERCK","ENERGY","ENGINEER","ENGINEERING","ENTERPRISES","EPSON","EQUIPMENT","ER","ERICSSON","ERNI","ES","ESQ","ESTATE","ET","ETISALAT","EU","EUROVISION","EUS","EVENTS","EXCHANGE","EXPERT","EXPOSED","EXPRESS","EXTRASPACE","FAGE","FAIL","FAIRWINDS","FAITH","FAMILY","FAN","FANS","FARM","FARMERS","FASHION","FAST","FEDEX","FEEDBACK","FERRARI","FERRERO","FI","FIDELITY","FIDO","FILM","FINAL","FINANCE","FINANCIAL","FIRE","FIRESTONE","FIRMDALE","FISH","FISHING","FIT","FITNESS","FJ","FK","FLICKR","FLIGHTS","FLIR","FLORIST","FLOWERS","FLY","FM","FO","FOO","FOOD","FOOTBALL","FORD","FOREX","FORSALE","FORUM","FOUNDATION","FOX","FR","FREE","FRESENIUS","FRL","FROGANS","FRONTDOOR","FRONTIER","FTR","FUJITSU","FUN","FUND","FURNITURE","FUTBOL","FYI","GA","GAL","GALLERY","GALLO","GALLUP","GAME","GAMES","GAP","GARDEN","GAY","GB","GBIZ","GD","GDN","GE","GEA","GENT","GENTING","GEORGE","GF","GG","GGEE","GH","GI","GIFT","GIFTS","GIVES","GIVING","GL","GLASS","GLE","GLOBAL","GLOBO","GM","GMAIL","GMBH","GMO","GMX","GN","GODADDY","GOLD","GOLDPOINT","GOLF","GOO","GOODYEAR","GOOG","GOOGLE","GOP","GOT","GOV","GP","GQ","GR","GRAINGER","GRAPHICS","GRATIS","GREEN","GRIPE","GROCERY","GROUP","GS","GT","GU","GUARDIAN","GUCCI","GUGE","GUIDE","GUITARS","GURU","GW","GY","HAIR","HAMBURG","HANGOUT","HAUS","HBO","HDFC","HDFCBANK","HEALTH","HEALTHCARE","HELP","HELSINKI","HERE","HERMES","HIPHOP","HISAMITSU","HITACHI","HIV","HK","HKT","HM","HN","HOCKEY","HOLDINGS","HOLIDAY","HOMEDEPOT","HOMEGOODS","HOMES","HOMESENSE","HONDA","HORSE","HOSPITAL","HOST","HOSTING","HOT","HOTELS","HOTMAIL","HOUSE","HOW","HR","HSBC","HT","HU","HUGHES","HYATT","HYUNDAI","IBM","ICBC","ICE","ICU","ID","IE","IEEE","IFM","IKANO","IL","IM","IMAMAT","IMDB","IMMO","IMMOBILIEN","IN","INC","INDUSTRIES","INFINITI","INFO","ING","INK","INSTITUTE","INSURANCE","INSURE","INT","INTERNATIONAL","INTUIT","INVESTMENTS","IO","IPIRANGA","IQ","IR","IRISH","IS","ISMAILI","IST","ISTANBUL","IT","ITAU","ITV","JAGUAR","JAVA","JCB","JE","JEEP","JETZT","JEWELRY","JIO","JLL","JM","JMP","JNJ","JO","JOBS","JOBURG","JOT","JOY","JP","JPMORGAN","JPRS","JUEGOS","JUNIPER","KAUFEN","KDDI","KE","KERRYHOTELS","KERRYLOGISTICS","KERRYPROPERTIES","KFH","KG","KH","KI","KIA","KIDS","KIM","KINDER","KINDLE","KITCHEN","KIWI","KM","KN","KOELN","KOMATSU","KOSHER","KP","KPMG","KPN","KR","KRD","KRED","KUOKGROUP","KW","KY","KYOTO","KZ","LA","LACAIXA","LAMBORGHINI","LAMER","LANCASTER","LAND","LANDROVER","LANXESS","LASALLE","LAT","LATINO","LATROBE","LAW","LAWYER","LB","LC","LDS","LEASE","LECLERC","LEFRAK","LEGAL","LEGO","LEXUS","LGBT","LI","LIDL","LIFE","LIFEINSURANCE","LIFESTYLE","LIGHTING","LIKE","LILLY","LIMITED","LIMO","LINCOLN","LINK","LIPSY","LIVE","LIVING","LK","LLC","LLP","LOAN","LOANS","LOCKER","LOCUS","LOL","LONDON","LOTTE","LOTTO","LOVE","LPL","LPLFINANCIAL","LR","LS","LT","LTD","LTDA","LU","LUNDBECK","LUXE","LUXURY","LV","LY","MA","MADRID","MAIF","MAISON","MAKEUP","MAN","MANAGEMENT","MANGO","MAP","MARKET","MARKETING","MARKETS","MARRIOTT","MARSHALLS","MATTEL","MBA","MC","MCKINSEY","MD","ME","MED","MEDIA","MEET","MELBOURNE","MEME","MEMORIAL","MEN","MENU","MERCKMSD","MG","MH","MIAMI","MICROSOFT","MIL","MINI","MINT","MIT","MITSUBISHI","MK","ML","MLB","MLS","MM","MMA","MN","MO","MOBI","MOBILE","MODA","MOE","MOI","MOM","MONASH","MONEY","MONSTER","MORMON","MORTGAGE","MOSCOW","MOTO","MOTORCYCLES","MOV","MOVIE","MP","MQ","MR","MS","MSD","MT","MTN","MTR","MU","MUSEUM","MUSIC","MV","MW","MX","MY","MZ","NA","NAB","NAGOYA","NAME","NATURA","NAVY","NBA","NC","NE","NEC","NET","NETBANK","NETFLIX","NETWORK","NEUSTAR","NEW","NEWS","NEXT","NEXTDIRECT","NEXUS","NF","NFL","NG","NGO","NHK","NI","NICO","NIKE","NIKON","NINJA","NISSAN","NISSAY","NL","NO","NOKIA","NORTON","NOW","NOWRUZ","NOWTV","NP","NR","NRA","NRW","NTT","NU","NYC","NZ","OBI","OBSERVER","OFFICE","OKINAWA","OLAYAN","OLAYANGROUP","OLDNAVY","OLLO","OM","OMEGA","ONE","ONG","ONL","ONLINE","OOO","OPEN","ORACLE","ORANGE","ORG","ORGANIC","ORIGINS","OSAKA","OTSUKA","OTT","OVH","PA","PAGE","PANASONIC","PARIS","PARS","PARTNERS","PARTS","PARTY","PAY","PCCW","PE","PET","PF","PFIZER","PG","PH","PHARMACY","PHD","PHILIPS","PHONE","PHOTO","PHOTOGRAPHY","PHOTOS","PHYSIO","PICS","PICTET","PICTURES","PID","PIN","PING","PINK","PIONEER","PIZZA","PK","PL","PLACE","PLAY","PLAYSTATION","PLUMBING","PLUS","PM","PN","PNC","POHL","POKER","POLITIE","PORN","POST","PR","PRAMERICA","PRAXI","PRESS","PRIME","PRO","PROD","PRODUCTIONS","PROF","PROGRESSIVE","PROMO","PROPERTIES","PROPERTY","PROTECTION","PRU","PRUDENTIAL","PS","PT","PUB","PW","PWC","PY","QA","QPON","QUEBEC","QUEST","RACING","RADIO","RE","READ","REALESTATE","REALTOR","REALTY","RECIPES","RED","REDSTONE","REDUMBRELLA","REHAB","REISE","REISEN","REIT","RELIANCE","REN","RENT","RENTALS","REPAIR","REPORT","REPUBLICAN","REST","RESTAURANT","REVIEW","REVIEWS","REXROTH","RICH","RICHARDLI","RICOH","RIL","RIO","RIP","RO","ROCHER","ROCKS","RODEO","ROGERS","ROOM","RS","RSVP","RU","RUGBY","RUHR","RUN","RW","RWE","RYUKYU","SA","SAARLAND","SAFE","SAFETY","SAKURA","SALE","SALON","SAMSCLUB","SAMSUNG","SANDVIK","SANDVIKCOROMANT","SANOFI","SAP","SARL","SAS","SAVE","SAXO","SB","SBI","SBS","SC","SCA","SCB","SCHAEFFLER","SCHMIDT","SCHOLARSHIPS","SCHOOL","SCHULE","SCHWARZ","SCIENCE","SCOT","SD","SE","SEARCH","SEAT","SECURE","SECURITY","SEEK","SELECT","SENER","SERVICES","SEVEN","SEW","SEX","SEXY","SFR","SG","SH","SHANGRILA","SHARP","SHAW","SHELL","SHIA","SHIKSHA","SHOES","SHOP","SHOPPING","SHOUJI","SHOW","SHOWTIME","SI","SILK","SINA","SINGLES","SITE","SJ","SK","SKI","SKIN","SKY","SKYPE","SL","SLING","SM","SMART","SMILE","SN","SNCF","SO","SOCCER","SOCIAL","SOFTBANK","SOFTWARE","SOHU","SOLAR","SOLUTIONS","SONG","SONY","SOY","SPA","SPACE","SPORT","SPOT","SR","SRL","SS","ST","STADA","STAPLES","STAR","STATEBANK","STATEFARM","STC","STCGROUP","STOCKHOLM","STORAGE","STORE","STREAM","STUDIO","STUDY","STYLE","SU","SUCKS","SUPPLIES","SUPPLY","SUPPORT","SURF","SURGERY","SUZUKI","SV","SWATCH","SWISS","SX","SY","SYDNEY","SYSTEMS","SZ","TAB","TAIPEI","TALK","TAOBAO","TARGET","TATAMOTORS","TATAR","TATTOO","TAX","TAXI","TC","TCI","TD","TDK","TEAM","TECH","TECHNOLOGY","TEL","TEMASEK","TENNIS","TEVA","TF","TG","TH","THD","THEATER","THEATRE","TIAA","TICKETS","TIENDA","TIPS","TIRES","TIROL","TJ","TJMAXX","TJX","TK","TKMAXX","TL","TM","TMALL","TN","TO","TODAY","TOKYO","TOOLS","TOP","TORAY","TOSHIBA","TOTAL","TOURS","TOWN","TOYOTA","TOYS","TR","TRADE","TRADING","TRAINING","TRAVEL","TRAVELERS","TRAVELERSINSURANCE","TRUST","TRV","TT","TUBE","TUI","TUNES","TUSHU","TV","TVS","TW","TZ","UA","UBANK","UBS","UG","UK","UNICOM","UNIVERSITY","UNO","UOL","UPS","US","UY","UZ","VA","VACATIONS","VANA","VANGUARD","VC","VE","VEGAS","VENTURES","VERISIGN","VERSICHERUNG","VET","VG","VI","VIAJES","VIDEO","VIG","VIKING","VILLAS","VIN","VIP","VIRGIN","VISA","VISION","VIVA","VIVO","VLAANDEREN","VN","VODKA","VOLKSWAGEN","VOLVO","VOTE","VOTING","VOTO","VOYAGE","VU","WALES","WALMART","WALTER","WANG","WANGGOU","WATCH","WATCHES","WEATHER","WEATHERCHANNEL","WEBCAM","WEBER","WEBSITE","WED","WEDDING","WEIBO","WEIR","WF","WHOSWHO","WIEN","WIKI","WILLIAMHILL","WIN","WINDOWS","WINE","WINNERS","WME","WOLTERSKLUWER","WOODSIDE","WORK","WORKS","WORLD","WOW","WS","WTC","WTF","XBOX","XEROX","XFINITY","XIHUAN","XIN","XN--11B4C3D","XN--1CK2E1B","XN--1QQW23A","XN--2SCRJ9C","XN--30RR7Y","XN--3BST00M","XN--3DS443G","XN--3E0B707E","XN--3HCRJ9C","XN--3PXU8K","XN--42C2D9A","XN--45BR5CYL","XN--45BRJ9C","XN--45Q11C","XN--4DBRK0CE","XN--4GBRIM","XN--54B7FTA0CC","XN--55QW42G","XN--55QX5D","XN--5SU34J936BGSG","XN--5TZM5G","XN--6FRZ82G","XN--6QQ986B3XL","XN--80ADXHKS","XN--80AO21A","XN--80AQECDR1A","XN--80ASEHDB","XN--80ASWG","XN--8Y0A063A","XN--90A3AC","XN--90AE","XN--90AIS","XN--9DBQ2A","XN--9ET52U","XN--9KRT00A","XN--B4W605FERD","XN--BCK1B9A5DRE4C","XN--C1AVG","XN--C2BR7G","XN--CCK2B3B","XN--CCKWCXETD","XN--CG4BKI","XN--CLCHC0EA0B2G2A9GCD","XN--CZR694B","XN--CZRS0T","XN--CZRU2D","XN--D1ACJ3B","XN--D1ALF","XN--E1A4C","XN--ECKVDTC9D","XN--EFVY88H","XN--FCT429K","XN--FHBEI","XN--FIQ228C5HS","XN--FIQ64B","XN--FIQS8S","XN--FIQZ9S","XN--FJQ720A","XN--FLW351E","XN--FPCRJ9C3D","XN--FZC2C9E2C","XN--FZYS8D69UVGM","XN--G2XX48C","XN--GCKR3F0F","XN--GECRJ9C","XN--GK3AT1E","XN--H2BREG3EVE","XN--H2BRJ9C","XN--H2BRJ9C8C","XN--HXT814E","XN--I1B6B1A6A2E","XN--IMR513N","XN--IO0A7I","XN--J1AEF","XN--J1AMH","XN--J6W193G","XN--JLQ480N2RG","XN--JVR189M","XN--KCRX77D1X4A","XN--KPRW13D","XN--KPRY57D","XN--KPUT3I","XN--L1ACC","XN--LGBBAT1AD8J","XN--MGB9AWBF","XN--MGBA3A3EJT","XN--MGBA3A4F16A","XN--MGBA7C0BBN0A","XN--MGBAAKC7DVF","XN--MGBAAM7A8H","XN--MGBAB2BD","XN--MGBAH1A3HJKRD","XN--MGBAI9AZGQP6J","XN--MGBAYH7GPA","XN--MGBBH1A","XN--MGBBH1A71E","XN--MGBC0A9AZCG","XN--MGBCA7DZDO","XN--MGBCPQ6GPA1A","XN--MGBERP4A5D4AR","XN--MGBGU82A","XN--MGBI4ECEXP","XN--MGBPL2FH","XN--MGBT3DHD","XN--MGBTX2B","XN--MGBX4CD0AB","XN--MIX891F","XN--MK1BU44C","XN--MXTQ1M","XN--NGBC5AZD","XN--NGBE9E0A","XN--NGBRX","XN--NODE","XN--NQV7F","XN--NQV7FS00EMA","XN--NYQY26A","XN--O3CW4H","XN--OGBPF8FL","XN--OTU796D","XN--P1ACF","XN--P1AI","XN--PGBS0DH","XN--PSSY2U","XN--Q7CE6A","XN--Q9JYB4C","XN--QCKA1PMC","XN--QXA6A","XN--QXAM","XN--RHQV96G","XN--ROVU88B","XN--RVC1E0AM3E","XN--S9BRJ9C","XN--SES554G","XN--T60B56A","XN--TCKWE","XN--TIQ49XQYJ","XN--UNUP4Y","XN--VERMGENSBERATER-CTB","XN--VERMGENSBERATUNG-PWB","XN--VHQUV","XN--VUQ861B","XN--W4R85EL8FHU5DNRA","XN--W4RS40L","XN--WGBH1C","XN--WGBL6A","XN--XHQ521B","XN--XKC2AL3HYE2A","XN--XKC2DL3A5EE0H","XN--Y9A3AQ","XN--YFRO4I67O","XN--YGBI2AMMX","XN--ZFR164B","XXX","XYZ","YACHTS","YAHOO","YAMAXUN","YANDEX","YE","YODOBASHI","YOGA","YOKOHAMA","YOU","YOUTUBE","YT","YUN","ZA","ZAPPOS","ZARA","ZERO","ZIP","ZM","ZONE","ZUERICH","ZW"].map((e=>e.toLowerCase())))},3652:(e,t,r)=>{const{assert:n}=r(8870),i={};t.Sorter=class{constructor(){this._items=[],this.nodes=[]}add(e,t){var r,i,o,a,s;t=null!==(r=t)&&void 0!==r?r:{};const l=[].concat(null!==(i=t.before)&&void 0!==i?i:[]),u=[].concat(null!==(o=t.after)&&void 0!==o?o:[]),c=null!==(a=t.group)&&void 0!==a?a:"?",d=null!==(s=t.sort)&&void 0!==s?s:0;n(!l.includes(c),`Item cannot come before itself: ${c}`),n(!l.includes("?"),"Item cannot come before unassociated items"),n(!u.includes(c),`Item cannot come after itself: ${c}`),n(!u.includes("?"),"Item cannot come after unassociated items"),Array.isArray(e)||(e=[e]);for(const t of e){const e={seq:this._items.length,sort:d,before:l,after:u,group:c,node:t};this._items.push(e)}if(!t.manual){const e=this._sort();n(e,"item","?"!==c?`added into group ${c}`:"","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(i.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 o of this._items){var n;const a=o.seq,s=o.group;r[s]=null!==(n=r[s])&&void 0!==n?n:[],r[s].push(a),e[a]=o.before;for(const e of o.after){var i;t[e]=null!==(i=t[e])&&void 0!==i?i:[],t[e].push(a)}}for(const t in e){const n=[];for(const i in e[t]){var o;const a=e[t][i];r[a]=null!==(o=r[a])&&void 0!==o?o:[],n.push(...r[a])}e[t]=n}for(const n in t)if(r[n])for(const i of r[n])e[i].push(...t[n]);const a={};for(const t in e){const r=e[t];for(const e of r){var s;a[e]=null!==(s=a[e])&&void 0!==s?s:[],a[e].push(t)}}const l={},u=[];for(let e=0;e<this._items.length;++e){let t=e;if(a[e]){t=null;for(let e=0;e<this._items.length;++e){if(!0===l[e])continue;a[e]||(a[e]=[]);const r=a[e].length;let n=0;for(let t=0;t<r;++t)l[a[e][t]]&&++n;if(n===r){t=e;break}}}null!==t&&(l[t]=!0,u.push(t))}if(u.length!==this._items.length)return!1;const c={};for(const e of this._items)c[e.seq]=e;this._items=[],this.nodes=[];for(const e of u){const t=c[e];this.nodes.push(t.node),this._items.push(t)}return!0}},i.mergeSort=(e,t)=>e.sort===t.sort?0:e.sort<t.sort?-1:1},1275:()=>{},3975:()=>{},5934:e=>{e.exports=JSON.parse('{"version":"17.11.0"}')}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n](o,o.exports,r),o.exports}return r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(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=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r(5107)})(),e.exports=t()},3493:(e,t,r)=>{r(6603),e.exports=self.fetch.bind(self)},3103:(e,t,r)=>{var n=r(4715)(r(8942),"DataView");e.exports=n},9770:(e,t,r)=>{var n=r(4715)(r(8942),"Map");e.exports=n},9413:(e,t,r)=>{var n=r(4715)(r(8942),"Promise");e.exports=n},4512:(e,t,r)=>{var n=r(4715)(r(8942),"Set");e.exports=n},5650:(e,t,r)=>{var n=r(8942).Symbol;e.exports=n},9270:(e,t,r)=>{var n=r(4715)(r(8942),"WeakMap");e.exports=n},7379:(e,t,r)=>{var n=r(5650),i=r(8870),o=r(9005),a=n?n.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":a&&a in Object(e)?i(e):o(e)}},6027:(e,t,r)=>{var n=r(7379),i=r(547);e.exports=function(e){return i(e)&&"[object Arguments]"==n(e)}},9624:(e,t,r)=>{var n=r(3655),i=r(4759),o=r(1580),a=r(4066),s=/^\[object .+?Constructor\]$/,l=Function.prototype,u=Object.prototype,c=l.toString,d=u.hasOwnProperty,p=RegExp("^"+c.call(d).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=function(e){return!(!o(e)||i(e))&&(n(e)?p:s).test(a(e))}},674:(e,t,r)=>{var n=r(7379),i=r(5387),o=r(547),a={};a["[object Float32Array]"]=a["[object Float64Array]"]=a["[object Int8Array]"]=a["[object Int16Array]"]=a["[object Int32Array]"]=a["[object Uint8Array]"]=a["[object Uint8ClampedArray]"]=a["[object Uint16Array]"]=a["[object Uint32Array]"]=!0,a["[object Arguments]"]=a["[object Array]"]=a["[object ArrayBuffer]"]=a["[object Boolean]"]=a["[object DataView]"]=a["[object Date]"]=a["[object Error]"]=a["[object Function]"]=a["[object Map]"]=a["[object Number]"]=a["[object Object]"]=a["[object RegExp]"]=a["[object Set]"]=a["[object String]"]=a["[object WeakMap]"]=!1,e.exports=function(e){return o(e)&&i(e.length)&&!!a[n(e)]}},195:(e,t,r)=>{var n=r(4882),i=r(8121),o=Object.prototype.hasOwnProperty;e.exports=function(e){if(!n(e))return i(e);var t=[];for(var r in Object(e))o.call(e,r)&&"constructor"!=r&&t.push(r);return t}},6403:(e,t,r)=>{var n=r(2945),i=/^\s+/;e.exports=function(e){return e?e.slice(0,n(e)+1).replace(i,""):e}},9460:e=>{e.exports=function(e){return function(t){return e(t)}}},1950:(e,t,r)=>{var n=r(8942)["__core-js_shared__"];e.exports=n},4967:(e,t,r)=>{var n="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g;e.exports=n},4715:(e,t,r)=>{var n=r(9624),i=r(155);e.exports=function(e,t){var r=i(e,t);return n(r)?r:void 0}},8870:(e,t,r)=>{var n=r(5650),i=Object.prototype,o=i.hasOwnProperty,a=i.toString,s=n?n.toStringTag:void 0;e.exports=function(e){var t=o.call(e,s),r=e[s];try{e[s]=void 0;var n=!0}catch(e){}var i=a.call(e);return n&&(t?e[s]=r:delete e[s]),i}},8486:(e,t,r)=>{var n=r(3103),i=r(9770),o=r(9413),a=r(4512),s=r(9270),l=r(7379),u=r(4066),c="[object Map]",d="[object Promise]",p="[object Set]",f="[object WeakMap]",h="[object DataView]",m=u(n),g=u(i),y=u(o),b=u(a),v=u(s),_=l;(n&&_(new n(new ArrayBuffer(1)))!=h||i&&_(new i)!=c||o&&_(o.resolve())!=d||a&&_(new a)!=p||s&&_(new s)!=f)&&(_=function(e){var t=l(e),r="[object Object]"==t?e.constructor:void 0,n=r?u(r):"";if(n)switch(n){case m:return h;case g:return c;case y:return d;case b:return p;case v:return f}return t}),e.exports=_},155:e=>{e.exports=function(e,t){return null==e?void 0:e[t]}},4759:(e,t,r)=>{var n,i=r(1950),o=(n=/[^.]+$/.exec(i&&i.keys&&i.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"";e.exports=function(e){return!!o&&o in e}},4882:e=>{var t=Object.prototype;e.exports=function(e){var r=e&&e.constructor;return e===("function"==typeof r&&r.prototype||t)}},8121:(e,t,r)=>{var n=r(3766)(Object.keys,Object);e.exports=n},2306:(e,t,r)=>{e=r.nmd(e);var n=r(4967),i=t&&!t.nodeType&&t,o=i&&e&&!e.nodeType&&e,a=o&&o.exports===i&&n.process,s=function(){try{return o&&o.require&&o.require("util").types||a&&a.binding&&a.binding("util")}catch(e){}}();e.exports=s},9005:e=>{var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},3766:e=>{e.exports=function(e,t){return function(r){return e(t(r))}}},8942:(e,t,r)=>{var n=r(4967),i="object"==typeof self&&self&&self.Object===Object&&self,o=n||i||Function("return this")();e.exports=o},4066:e=>{var t=Function.prototype.toString;e.exports=function(e){if(null!=e){try{return t.call(e)}catch(e){}try{return e+""}catch(e){}}return""}},2945:e=>{var t=/\s/;e.exports=function(e){for(var r=e.length;r--&&t.test(e.charAt(r)););return r}},2784:(e,t,r)=>{var n=r(1580),i=r(4495),o=r(6131),a=Math.max,s=Math.min;e.exports=function(e,t,r){var l,u,c,d,p,f,h=0,m=!1,g=!1,y=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function b(t){var r=l,n=u;return l=u=void 0,h=t,d=e.apply(n,r)}function v(e){var r=e-f;return void 0===f||r>=t||r<0||g&&e-h>=c}function _(){var e=i();if(v(e))return A(e);p=setTimeout(_,function(e){var r=t-(e-f);return g?s(r,c-(e-h)):r}(e))}function A(e){return p=void 0,y&&l?b(e):(l=u=void 0,d)}function w(){var e=i(),r=v(e);if(l=arguments,u=this,f=e,r){if(void 0===p)return function(e){return h=e,p=setTimeout(_,t),m?b(e):d}(f);if(g)return clearTimeout(p),p=setTimeout(_,t),b(f)}return void 0===p&&(p=setTimeout(_,t)),d}return t=o(t)||0,n(r)&&(m=!!r.leading,c=(g="maxWait"in r)?a(o(r.maxWait)||0,t):c,y="trailing"in r?!!r.trailing:y),w.cancel=function(){void 0!==p&&clearTimeout(p),h=0,l=f=u=p=void 0},w.flush=function(){return void 0===p?d:A(i())},w}},3283:(e,t,r)=>{var n=r(6027),i=r(547),o=Object.prototype,a=o.hasOwnProperty,s=o.propertyIsEnumerable,l=n(function(){return arguments}())?n:function(e){return i(e)&&a.call(e,"callee")&&!s.call(e,"callee")};e.exports=l},3142:e=>{var t=Array.isArray;e.exports=t},6529:(e,t,r)=>{var n=r(3655),i=r(5387);e.exports=function(e){return null!=e&&i(e.length)&&!n(e)}},5853:(e,t,r)=>{e=r.nmd(e);var n=r(8942),i=r(4772),o=t&&!t.nodeType&&t,a=o&&e&&!e.nodeType&&e,s=a&&a.exports===o?n.Buffer:void 0,l=(s?s.isBuffer:void 0)||i;e.exports=l},3514:(e,t,r)=>{var n=r(195),i=r(8486),o=r(3283),a=r(3142),s=r(6529),l=r(5853),u=r(4882),c=r(8666),d=Object.prototype.hasOwnProperty;e.exports=function(e){if(null==e)return!0;if(s(e)&&(a(e)||"string"==typeof e||"function"==typeof e.splice||l(e)||c(e)||o(e)))return!e.length;var t=i(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(u(e))return!n(e).length;for(var r in e)if(d.call(e,r))return!1;return!0}},3655:(e,t,r)=>{var n=r(7379),i=r(1580);e.exports=function(e){if(!i(e))return!1;var t=n(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},5387:e=>{e.exports=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}},1580:e=>{e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},547:e=>{e.exports=function(e){return null!=e&&"object"==typeof e}},1187:(e,t,r)=>{var n=r(7379),i=r(547);e.exports=function(e){return"symbol"==typeof e||i(e)&&"[object Symbol]"==n(e)}},8666:(e,t,r)=>{var n=r(674),i=r(9460),o=r(2306),a=o&&o.isTypedArray,s=a?i(a):n;e.exports=s},5250:function(e,t,r){var n;e=r.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",s="__lodash_placeholder__",l=32,u=128,c=1/0,d=9007199254740991,p=NaN,f=4294967295,h=[["ary",u],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",l],["partialRight",64],["rearg",256]],m="[object Arguments]",g="[object Array]",y="[object Boolean]",b="[object Date]",v="[object Error]",_="[object Function]",A="[object GeneratorFunction]",w="[object Map]",S="[object Number]",T="[object Object]",E="[object Promise]",O="[object RegExp]",x="[object Set]",C="[object String]",I="[object Symbol]",j="[object WeakMap]",R="[object ArrayBuffer]",D="[object DataView]",F="[object Float32Array]",N="[object Float64Array]",P="[object Int8Array]",M="[object Int16Array]",L="[object Int32Array]",k="[object Uint8Array]",q="[object Uint8ClampedArray]",$="[object Uint16Array]",z="[object Uint32Array]",B=/\b__p \+= '';/g,G=/\b(__p \+=) '' \+/g,U=/(__e\(.*?\)|\b__t\)) \+\n'';/g,V=/&(?:amp|lt|gt|quot|#39);/g,H=/[&<>"']/g,Y=RegExp(V.source),X=RegExp(H.source),W=/<%-([\s\S]+?)%>/g,K=/<%([\s\S]+?)%>/g,Q=/<%=([\s\S]+?)%>/g,Z=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,J=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,re=RegExp(te.source),ne=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,se=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ue=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,de=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,fe=/^[-+]0x[0-9a-f]+$/i,he=/^0b[01]+$/i,me=/^\[object .+?Constructor\]$/,ge=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,be=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ve=/($^)/,_e=/['\n\r\u2028\u2029\\]/g,Ae="\\ud800-\\udfff",we="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Se="\\u2700-\\u27bf",Te="a-z\\xdf-\\xf6\\xf8-\\xff",Ee="A-Z\\xc0-\\xd6\\xd8-\\xde",Oe="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ce="["+Ae+"]",Ie="["+xe+"]",je="["+we+"]",Re="\\d+",De="["+Se+"]",Fe="["+Te+"]",Ne="[^"+Ae+xe+Re+Se+Te+Ee+"]",Pe="\\ud83c[\\udffb-\\udfff]",Me="[^"+Ae+"]",Le="(?:\\ud83c[\\udde6-\\uddff]){2}",ke="[\\ud800-\\udbff][\\udc00-\\udfff]",qe="["+Ee+"]",$e="\\u200d",ze="(?:"+Fe+"|"+Ne+")",Be="(?:"+qe+"|"+Ne+")",Ge="(?:['’](?:d|ll|m|re|s|t|ve))?",Ue="(?:['’](?:D|LL|M|RE|S|T|VE))?",Ve="(?:"+je+"|"+Pe+")?",He="["+Oe+"]?",Ye=He+Ve+"(?:"+$e+"(?:"+[Me,Le,ke].join("|")+")"+He+Ve+")*",Xe="(?:"+[De,Le,ke].join("|")+")"+Ye,We="(?:"+[Me+je+"?",je,Le,ke,Ce].join("|")+")",Ke=RegExp("['’]","g"),Qe=RegExp(je,"g"),Ze=RegExp(Pe+"(?="+Pe+")|"+We+Ye,"g"),Je=RegExp([qe+"?"+Fe+"+"+Ge+"(?="+[Ie,qe,"$"].join("|")+")",Be+"+"+Ue+"(?="+[Ie,qe+ze,"$"].join("|")+")",qe+"?"+ze+"+"+Ge,qe+"+"+Ue,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Re,Xe].join("|"),"g"),et=RegExp("["+$e+Ae+we+Oe+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,rt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],nt=-1,it={};it[F]=it[N]=it[P]=it[M]=it[L]=it[k]=it[q]=it[$]=it[z]=!0,it[m]=it[g]=it[R]=it[y]=it[D]=it[b]=it[v]=it[_]=it[w]=it[S]=it[T]=it[O]=it[x]=it[C]=it[j]=!1;var ot={};ot[m]=ot[g]=ot[R]=ot[D]=ot[y]=ot[b]=ot[F]=ot[N]=ot[P]=ot[M]=ot[L]=ot[w]=ot[S]=ot[T]=ot[O]=ot[x]=ot[C]=ot[I]=ot[k]=ot[q]=ot[$]=ot[z]=!0,ot[v]=ot[_]=ot[j]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},st=parseFloat,lt=parseInt,ut="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g,ct="object"==typeof self&&self&&self.Object===Object&&self,dt=ut||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ft=pt&&e&&!e.nodeType&&e,ht=ft&&ft.exports===pt,mt=ht&&ut.process,gt=function(){try{return ft&&ft.require&&ft.require("util").types||mt&&mt.binding&&mt.binding("util")}catch(e){}}(),yt=gt&&gt.isArrayBuffer,bt=gt&&gt.isDate,vt=gt&&gt.isMap,_t=gt&&gt.isRegExp,At=gt&&gt.isSet,wt=gt&&gt.isTypedArray;function St(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}function Tt(e,t,r,n){for(var i=-1,o=null==e?0:e.length;++i<o;){var a=e[i];t(n,a,r(a),e)}return n}function Et(e,t){for(var r=-1,n=null==e?0:e.length;++r<n&&!1!==t(e[r],r,e););return e}function Ot(e,t){for(var r=null==e?0:e.length;r--&&!1!==t(e[r],r,e););return e}function xt(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(!t(e[r],r,e))return!1;return!0}function Ct(e,t){for(var r=-1,n=null==e?0:e.length,i=0,o=[];++r<n;){var a=e[r];t(a,r,e)&&(o[i++]=a)}return o}function It(e,t){return!(null==e||!e.length)&&qt(e,t,0)>-1}function jt(e,t,r){for(var n=-1,i=null==e?0:e.length;++n<i;)if(r(t,e[n]))return!0;return!1}function Rt(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}function Dt(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}function Ft(e,t,r,n){var i=-1,o=null==e?0:e.length;for(n&&o&&(r=e[++i]);++i<o;)r=t(r,e[i],i,e);return r}function Nt(e,t,r,n){var i=null==e?0:e.length;for(n&&i&&(r=e[--i]);i--;)r=t(r,e[i],i,e);return r}function Pt(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}var Mt=Gt("length");function Lt(e,t,r){var n;return r(e,(function(e,r,i){if(t(e,r,i))return n=r,!1})),n}function kt(e,t,r,n){for(var i=e.length,o=r+(n?1:-1);n?o--:++o<i;)if(t(e[o],o,e))return o;return-1}function qt(e,t,r){return t==t?function(e,t,r){for(var n=r-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}(e,t,r):kt(e,zt,r)}function $t(e,t,r,n){for(var i=r-1,o=e.length;++i<o;)if(n(e[i],t))return i;return-1}function zt(e){return e!=e}function Bt(e,t){var r=null==e?0:e.length;return r?Ht(e,t)/r:p}function Gt(e){return function(t){return null==t?i:t[e]}}function Ut(e){return function(t){return null==e?i:e[t]}}function Vt(e,t,r,n,i){return i(e,(function(e,i,o){r=n?(n=!1,e):t(r,e,i,o)})),r}function Ht(e,t){for(var r,n=-1,o=e.length;++n<o;){var a=t(e[n]);a!==i&&(r=r===i?a:r+a)}return r}function Yt(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}function Xt(e){return e?e.slice(0,dr(e)+1).replace(ne,""):e}function Wt(e){return function(t){return e(t)}}function Kt(e,t){return Rt(t,(function(t){return e[t]}))}function Qt(e,t){return e.has(t)}function Zt(e,t){for(var r=-1,n=e.length;++r<n&&qt(t,e[r],0)>-1;);return r}function Jt(e,t){for(var r=e.length;r--&&qt(t,e[r],0)>-1;);return r}var er=Ut({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tr=Ut({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function rr(e){return"\\"+at[e]}function nr(e){return et.test(e)}function ir(e){var t=-1,r=Array(e.size);return e.forEach((function(e,n){r[++t]=[n,e]})),r}function or(e,t){return function(r){return e(t(r))}}function ar(e,t){for(var r=-1,n=e.length,i=0,o=[];++r<n;){var a=e[r];a!==t&&a!==s||(e[r]=s,o[i++]=r)}return o}function sr(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=e})),r}function lr(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=[e,e]})),r}function ur(e){return nr(e)?function(e){for(var t=Ze.lastIndex=0;Ze.test(e);)++t;return t}(e):Mt(e)}function cr(e){return nr(e)?function(e){return e.match(Ze)||[]}(e):function(e){return e.split("")}(e)}function dr(e){for(var t=e.length;t--&&ie.test(e.charAt(t)););return t}var pr=Ut({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"}),fr=function e(t){var r,n=(t=null==t?dt:fr.defaults(dt.Object(),t,fr.pick(dt,rt))).Array,ie=t.Date,Ae=t.Error,we=t.Function,Se=t.Math,Te=t.Object,Ee=t.RegExp,Oe=t.String,xe=t.TypeError,Ce=n.prototype,Ie=we.prototype,je=Te.prototype,Re=t["__core-js_shared__"],De=Ie.toString,Fe=je.hasOwnProperty,Ne=0,Pe=(r=/[^.]+$/.exec(Re&&Re.keys&&Re.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"",Me=je.toString,Le=De.call(Te),ke=dt._,qe=Ee("^"+De.call(Fe).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),$e=ht?t.Buffer:i,ze=t.Symbol,Be=t.Uint8Array,Ge=$e?$e.allocUnsafe:i,Ue=or(Te.getPrototypeOf,Te),Ve=Te.create,He=je.propertyIsEnumerable,Ye=Ce.splice,Xe=ze?ze.isConcatSpreadable:i,We=ze?ze.iterator:i,Ze=ze?ze.toStringTag:i,et=function(){try{var e=lo(Te,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==dt.clearTimeout&&t.clearTimeout,ut=ie&&ie.now!==dt.Date.now&&ie.now,ct=t.setTimeout!==dt.setTimeout&&t.setTimeout,pt=Se.ceil,ft=Se.floor,mt=Te.getOwnPropertySymbols,gt=$e?$e.isBuffer:i,Mt=t.isFinite,Ut=Ce.join,hr=or(Te.keys,Te),mr=Se.max,gr=Se.min,yr=ie.now,br=t.parseInt,vr=Se.random,_r=Ce.reverse,Ar=lo(t,"DataView"),wr=lo(t,"Map"),Sr=lo(t,"Promise"),Tr=lo(t,"Set"),Er=lo(t,"WeakMap"),Or=lo(Te,"create"),xr=Er&&new Er,Cr={},Ir=Lo(Ar),jr=Lo(wr),Rr=Lo(Sr),Dr=Lo(Tr),Fr=Lo(Er),Nr=ze?ze.prototype:i,Pr=Nr?Nr.valueOf:i,Mr=Nr?Nr.toString:i;function Lr(e){if(es(e)&&!Ga(e)&&!(e instanceof zr)){if(e instanceof $r)return e;if(Fe.call(e,"__wrapped__"))return ko(e)}return new $r(e)}var kr=function(){function e(){}return function(t){if(!Ja(t))return{};if(Ve)return Ve(t);e.prototype=t;var r=new e;return e.prototype=i,r}}();function qr(){}function $r(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function zr(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=f,this.__views__=[]}function Br(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Gr(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Ur(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Vr(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new Ur;++t<r;)this.add(e[t])}function Hr(e){var t=this.__data__=new Gr(e);this.size=t.size}function Yr(e,t){var r=Ga(e),n=!r&&Ba(e),i=!r&&!n&&Ya(e),o=!r&&!n&&!i&&ls(e),a=r||n||i||o,s=a?Yt(e.length,Oe):[],l=s.length;for(var u in e)!t&&!Fe.call(e,u)||a&&("length"==u||i&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||go(u,l))||s.push(u);return s}function Xr(e){var t=e.length;return t?e[Vn(0,t-1)]:i}function Wr(e,t){return Do(Oi(e),on(t,0,e.length))}function Kr(e){return Do(Oi(e))}function Qr(e,t,r){(r!==i&&!qa(e[t],r)||r===i&&!(t in e))&&rn(e,t,r)}function Zr(e,t,r){var n=e[t];Fe.call(e,t)&&qa(n,r)&&(r!==i||t in e)||rn(e,t,r)}function Jr(e,t){for(var r=e.length;r--;)if(qa(e[r][0],t))return r;return-1}function en(e,t,r,n){return cn(e,(function(e,i,o){t(n,e,r(e),o)})),n}function tn(e,t){return e&&xi(t,js(t),e)}function rn(e,t,r){"__proto__"==t&&et?et(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function nn(e,t){for(var r=-1,o=t.length,a=n(o),s=null==e;++r<o;)a[r]=s?i:Es(e,t[r]);return a}function on(e,t,r){return e==e&&(r!==i&&(e=e<=r?e:r),t!==i&&(e=e>=t?e:t)),e}function an(e,t,r,n,o,a){var s,l=1&t,u=2&t,c=4&t;if(r&&(s=o?r(e,n,o,a):r(e)),s!==i)return s;if(!Ja(e))return e;var d=Ga(e);if(d){if(s=function(e){var t=e.length,r=new e.constructor(t);return t&&"string"==typeof e[0]&&Fe.call(e,"index")&&(r.index=e.index,r.input=e.input),r}(e),!l)return Oi(e,s)}else{var p=po(e),f=p==_||p==A;if(Ya(e))return _i(e,l);if(p==T||p==m||f&&!o){if(s=u||f?{}:ho(e),!l)return u?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Rs(t),e)}(s,e)):function(e,t){return xi(e,uo(e),t)}(e,tn(s,e))}else{if(!ot[p])return o?e:{};s=function(e,t,r){var n,i=e.constructor;switch(t){case R:return Ai(e);case y:case b:return new i(+e);case D:return function(e,t){var r=t?Ai(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}(e,r);case F:case N:case P:case M:case L:case k:case q:case $:case z:return wi(e,r);case w:return new i;case S:case C:return new i(e);case O:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case I:return n=e,Pr?Te(Pr.call(n)):{}}}(e,p,l)}}a||(a=new Hr);var h=a.get(e);if(h)return h;a.set(e,s),os(e)?e.forEach((function(n){s.add(an(n,t,r,n,e,a))})):ts(e)&&e.forEach((function(n,i){s.set(i,an(n,t,r,i,e,a))}));var g=d?i:(c?u?to:eo:u?Rs:js)(e);return Et(g||e,(function(n,i){g&&(n=e[i=n]),Zr(s,i,an(n,t,r,i,e,a))})),s}function sn(e,t,r){var n=r.length;if(null==e)return!n;for(e=Te(e);n--;){var o=r[n],a=t[o],s=e[o];if(s===i&&!(o in e)||!a(s))return!1}return!0}function ln(e,t,r){if("function"!=typeof e)throw new xe(o);return Co((function(){e.apply(i,r)}),t)}function un(e,t,r,n){var i=-1,o=It,a=!0,s=e.length,l=[],u=t.length;if(!s)return l;r&&(t=Rt(t,Wt(r))),n?(o=jt,a=!1):t.length>=200&&(o=Qt,a=!1,t=new Vr(t));e:for(;++i<s;){var c=e[i],d=null==r?c:r(c);if(c=n||0!==c?c:0,a&&d==d){for(var p=u;p--;)if(t[p]===d)continue e;l.push(c)}else o(t,d,n)||l.push(c)}return l}Lr.templateSettings={escape:W,evaluate:K,interpolate:Q,variable:"",imports:{_:Lr}},Lr.prototype=qr.prototype,Lr.prototype.constructor=Lr,$r.prototype=kr(qr.prototype),$r.prototype.constructor=$r,zr.prototype=kr(qr.prototype),zr.prototype.constructor=zr,Br.prototype.clear=function(){this.__data__=Or?Or(null):{},this.size=0},Br.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Br.prototype.get=function(e){var t=this.__data__;if(Or){var r=t[e];return r===a?i:r}return Fe.call(t,e)?t[e]:i},Br.prototype.has=function(e){var t=this.__data__;return Or?t[e]!==i:Fe.call(t,e)},Br.prototype.set=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Or&&t===i?a:t,this},Gr.prototype.clear=function(){this.__data__=[],this.size=0},Gr.prototype.delete=function(e){var t=this.__data__,r=Jr(t,e);return!(r<0||(r==t.length-1?t.pop():Ye.call(t,r,1),--this.size,0))},Gr.prototype.get=function(e){var t=this.__data__,r=Jr(t,e);return r<0?i:t[r][1]},Gr.prototype.has=function(e){return Jr(this.__data__,e)>-1},Gr.prototype.set=function(e,t){var r=this.__data__,n=Jr(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this},Ur.prototype.clear=function(){this.size=0,this.__data__={hash:new Br,map:new(wr||Gr),string:new Br}},Ur.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Ur.prototype.get=function(e){return ao(this,e).get(e)},Ur.prototype.has=function(e){return ao(this,e).has(e)},Ur.prototype.set=function(e,t){var r=ao(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this},Vr.prototype.add=Vr.prototype.push=function(e){return this.__data__.set(e,a),this},Vr.prototype.has=function(e){return this.__data__.has(e)},Hr.prototype.clear=function(){this.__data__=new Gr,this.size=0},Hr.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},Hr.prototype.get=function(e){return this.__data__.get(e)},Hr.prototype.has=function(e){return this.__data__.has(e)},Hr.prototype.set=function(e,t){var r=this.__data__;if(r instanceof Gr){var n=r.__data__;if(!wr||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new Ur(n)}return r.set(e,t),this.size=r.size,this};var cn=ji(bn),dn=ji(vn,!0);function pn(e,t){var r=!0;return cn(e,(function(e,n,i){return r=!!t(e,n,i)})),r}function fn(e,t,r){for(var n=-1,o=e.length;++n<o;){var a=e[n],s=t(a);if(null!=s&&(l===i?s==s&&!ss(s):r(s,l)))var l=s,u=a}return u}function hn(e,t){var r=[];return cn(e,(function(e,n,i){t(e,n,i)&&r.push(e)})),r}function mn(e,t,r,n,i){var o=-1,a=e.length;for(r||(r=mo),i||(i=[]);++o<a;){var s=e[o];t>0&&r(s)?t>1?mn(s,t-1,r,n,i):Dt(i,s):n||(i[i.length]=s)}return i}var gn=Ri(),yn=Ri(!0);function bn(e,t){return e&&gn(e,t,js)}function vn(e,t){return e&&yn(e,t,js)}function _n(e,t){return Ct(t,(function(t){return Ka(e[t])}))}function An(e,t){for(var r=0,n=(t=gi(t,e)).length;null!=e&&r<n;)e=e[Mo(t[r++])];return r&&r==n?e:i}function wn(e,t,r){var n=t(e);return Ga(e)?n:Dt(n,r(e))}function Sn(e){return null==e?e===i?"[object Undefined]":"[object Null]":Ze&&Ze in Te(e)?function(e){var t=Fe.call(e,Ze),r=e[Ze];try{e[Ze]=i;var n=!0}catch(e){}var o=Me.call(e);return n&&(t?e[Ze]=r:delete e[Ze]),o}(e):function(e){return Me.call(e)}(e)}function Tn(e,t){return e>t}function En(e,t){return null!=e&&Fe.call(e,t)}function On(e,t){return null!=e&&t in Te(e)}function xn(e,t,r){for(var o=r?jt:It,a=e[0].length,s=e.length,l=s,u=n(s),c=1/0,d=[];l--;){var p=e[l];l&&t&&(p=Rt(p,Wt(t))),c=gr(p.length,c),u[l]=!r&&(t||a>=120&&p.length>=120)?new Vr(l&&p):i}p=e[0];var f=-1,h=u[0];e:for(;++f<a&&d.length<c;){var m=p[f],g=t?t(m):m;if(m=r||0!==m?m:0,!(h?Qt(h,g):o(d,g,r))){for(l=s;--l;){var y=u[l];if(!(y?Qt(y,g):o(e[l],g,r)))continue e}h&&h.push(g),d.push(m)}}return d}function Cn(e,t,r){var n=null==(e=Eo(e,t=gi(t,e)))?e:e[Mo(Wo(t))];return null==n?i:St(n,e,r)}function In(e){return es(e)&&Sn(e)==m}function jn(e,t,r,n,o){return e===t||(null==e||null==t||!es(e)&&!es(t)?e!=e&&t!=t:function(e,t,r,n,o,a){var s=Ga(e),l=Ga(t),u=s?g:po(e),c=l?g:po(t),d=(u=u==m?T:u)==T,p=(c=c==m?T:c)==T,f=u==c;if(f&&Ya(e)){if(!Ya(t))return!1;s=!0,d=!1}if(f&&!d)return a||(a=new Hr),s||ls(e)?Zi(e,t,r,n,o,a):function(e,t,r,n,i,o,a){switch(r){case D:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case R:return!(e.byteLength!=t.byteLength||!o(new Be(e),new Be(t)));case y:case b:case S:return qa(+e,+t);case v:return e.name==t.name&&e.message==t.message;case O:case C:return e==t+"";case w:var s=ir;case x:var l=1&n;if(s||(s=sr),e.size!=t.size&&!l)return!1;var u=a.get(e);if(u)return u==t;n|=2,a.set(e,t);var c=Zi(s(e),s(t),n,i,o,a);return a.delete(e),c;case I:if(Pr)return Pr.call(e)==Pr.call(t)}return!1}(e,t,u,r,n,o,a);if(!(1&r)){var h=d&&Fe.call(e,"__wrapped__"),_=p&&Fe.call(t,"__wrapped__");if(h||_){var A=h?e.value():e,E=_?t.value():t;return a||(a=new Hr),o(A,E,r,n,a)}}return!!f&&(a||(a=new Hr),function(e,t,r,n,o,a){var s=1&r,l=eo(e),u=l.length;if(u!=eo(t).length&&!s)return!1;for(var c=u;c--;){var d=l[c];if(!(s?d in t:Fe.call(t,d)))return!1}var p=a.get(e),f=a.get(t);if(p&&f)return p==t&&f==e;var h=!0;a.set(e,t),a.set(t,e);for(var m=s;++c<u;){var g=e[d=l[c]],y=t[d];if(n)var b=s?n(y,g,d,t,e,a):n(g,y,d,e,t,a);if(!(b===i?g===y||o(g,y,r,n,a):b)){h=!1;break}m||(m="constructor"==d)}if(h&&!m){var v=e.constructor,_=t.constructor;v==_||!("constructor"in e)||!("constructor"in t)||"function"==typeof v&&v instanceof v&&"function"==typeof _&&_ instanceof _||(h=!1)}return a.delete(e),a.delete(t),h}(e,t,r,n,o,a))}(e,t,r,n,jn,o))}function Rn(e,t,r,n){var o=r.length,a=o,s=!n;if(null==e)return!a;for(e=Te(e);o--;){var l=r[o];if(s&&l[2]?l[1]!==e[l[0]]:!(l[0]in e))return!1}for(;++o<a;){var u=(l=r[o])[0],c=e[u],d=l[1];if(s&&l[2]){if(c===i&&!(u in e))return!1}else{var p=new Hr;if(n)var f=n(c,d,u,e,t,p);if(!(f===i?jn(d,c,3,n,p):f))return!1}}return!0}function Dn(e){return!(!Ja(e)||(t=e,Pe&&Pe in t))&&(Ka(e)?qe:me).test(Lo(e));var t}function Fn(e){return"function"==typeof e?e:null==e?rl:"object"==typeof e?Ga(e)?kn(e[0],e[1]):Ln(e):dl(e)}function Nn(e){if(!Ao(e))return hr(e);var t=[];for(var r in Te(e))Fe.call(e,r)&&"constructor"!=r&&t.push(r);return t}function Pn(e,t){return e<t}function Mn(e,t){var r=-1,i=Va(e)?n(e.length):[];return cn(e,(function(e,n,o){i[++r]=t(e,n,o)})),i}function Ln(e){var t=so(e);return 1==t.length&&t[0][2]?So(t[0][0],t[0][1]):function(r){return r===e||Rn(r,e,t)}}function kn(e,t){return bo(e)&&wo(t)?So(Mo(e),t):function(r){var n=Es(r,e);return n===i&&n===t?Os(r,e):jn(t,n,3)}}function qn(e,t,r,n,o){e!==t&&gn(t,(function(a,s){if(o||(o=new Hr),Ja(a))!function(e,t,r,n,o,a,s){var l=Oo(e,r),u=Oo(t,r),c=s.get(u);if(c)Qr(e,r,c);else{var d=a?a(l,u,r+"",e,t,s):i,p=d===i;if(p){var f=Ga(u),h=!f&&Ya(u),m=!f&&!h&&ls(u);d=u,f||h||m?Ga(l)?d=l:Ha(l)?d=Oi(l):h?(p=!1,d=_i(u,!0)):m?(p=!1,d=wi(u,!0)):d=[]:ns(u)||Ba(u)?(d=l,Ba(l)?d=gs(l):Ja(l)&&!Ka(l)||(d=ho(u))):p=!1}p&&(s.set(u,d),o(d,u,n,a,s),s.delete(u)),Qr(e,r,d)}}(e,t,s,r,qn,n,o);else{var l=n?n(Oo(e,s),a,s+"",e,t,o):i;l===i&&(l=a),Qr(e,s,l)}}),Rs)}function $n(e,t){var r=e.length;if(r)return go(t+=t<0?r:0,r)?e[t]:i}function zn(e,t,r){t=t.length?Rt(t,(function(e){return Ga(e)?function(t){return An(t,1===e.length?e[0]:e)}:e})):[rl];var n=-1;t=Rt(t,Wt(oo()));var i=Mn(e,(function(e,r,i){var o=Rt(t,(function(t){return t(e)}));return{criteria:o,index:++n,value:e}}));return function(e,t){var n=e.length;for(e.sort((function(e,t){return function(e,t,r){for(var n=-1,i=e.criteria,o=t.criteria,a=i.length,s=r.length;++n<a;){var l=Si(i[n],o[n]);if(l)return n>=s?l:l*("desc"==r[n]?-1:1)}return e.index-t.index}(e,t,r)}));n--;)e[n]=e[n].value;return e}(i)}function Bn(e,t,r){for(var n=-1,i=t.length,o={};++n<i;){var a=t[n],s=An(e,a);r(s,a)&&Kn(o,gi(a,e),s)}return o}function Gn(e,t,r,n){var i=n?$t:qt,o=-1,a=t.length,s=e;for(e===t&&(t=Oi(t)),r&&(s=Rt(e,Wt(r)));++o<a;)for(var l=0,u=t[o],c=r?r(u):u;(l=i(s,c,l,n))>-1;)s!==e&&Ye.call(s,l,1),Ye.call(e,l,1);return e}function Un(e,t){for(var r=e?t.length:0,n=r-1;r--;){var i=t[r];if(r==n||i!==o){var o=i;go(i)?Ye.call(e,i,1):li(e,i)}}return e}function Vn(e,t){return e+ft(vr()*(t-e+1))}function Hn(e,t){var r="";if(!e||t<1||t>d)return r;do{t%2&&(r+=e),(t=ft(t/2))&&(e+=e)}while(t);return r}function Yn(e,t){return Io(To(e,t,rl),e+"")}function Xn(e){return Xr(qs(e))}function Wn(e,t){var r=qs(e);return Do(r,on(t,0,r.length))}function Kn(e,t,r,n){if(!Ja(e))return e;for(var o=-1,a=(t=gi(t,e)).length,s=a-1,l=e;null!=l&&++o<a;){var u=Mo(t[o]),c=r;if("__proto__"===u||"constructor"===u||"prototype"===u)return e;if(o!=s){var d=l[u];(c=n?n(d,u,l):i)===i&&(c=Ja(d)?d:go(t[o+1])?[]:{})}Zr(l,u,c),l=l[u]}return e}var Qn=xr?function(e,t){return xr.set(e,t),e}:rl,Zn=et?function(e,t){return et(e,"toString",{configurable:!0,enumerable:!1,value:Js(t),writable:!0})}:rl;function Jn(e){return Do(qs(e))}function ei(e,t,r){var i=-1,o=e.length;t<0&&(t=-t>o?0:o+t),(r=r>o?o:r)<0&&(r+=o),o=t>r?0:r-t>>>0,t>>>=0;for(var a=n(o);++i<o;)a[i]=e[i+t];return a}function ti(e,t){var r;return cn(e,(function(e,n,i){return!(r=t(e,n,i))})),!!r}function ri(e,t,r){var n=0,i=null==e?n:e.length;if("number"==typeof t&&t==t&&i<=2147483647){for(;n<i;){var o=n+i>>>1,a=e[o];null!==a&&!ss(a)&&(r?a<=t:a<t)?n=o+1:i=o}return i}return ni(e,t,rl,r)}function ni(e,t,r,n){var o=0,a=null==e?0:e.length;if(0===a)return 0;for(var s=(t=r(t))!=t,l=null===t,u=ss(t),c=t===i;o<a;){var d=ft((o+a)/2),p=r(e[d]),f=p!==i,h=null===p,m=p==p,g=ss(p);if(s)var y=n||m;else y=c?m&&(n||f):l?m&&f&&(n||!h):u?m&&f&&!h&&(n||!g):!h&&!g&&(n?p<=t:p<t);y?o=d+1:a=d}return gr(a,4294967294)}function ii(e,t){for(var r=-1,n=e.length,i=0,o=[];++r<n;){var a=e[r],s=t?t(a):a;if(!r||!qa(s,l)){var l=s;o[i++]=0===a?0:a}}return o}function oi(e){return"number"==typeof e?e:ss(e)?p:+e}function ai(e){if("string"==typeof e)return e;if(Ga(e))return Rt(e,ai)+"";if(ss(e))return Mr?Mr.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function si(e,t,r){var n=-1,i=It,o=e.length,a=!0,s=[],l=s;if(r)a=!1,i=jt;else if(o>=200){var u=t?null:Hi(e);if(u)return sr(u);a=!1,i=Qt,l=new Vr}else l=t?[]:s;e:for(;++n<o;){var c=e[n],d=t?t(c):c;if(c=r||0!==c?c:0,a&&d==d){for(var p=l.length;p--;)if(l[p]===d)continue e;t&&l.push(d),s.push(c)}else i(l,d,r)||(l!==s&&l.push(d),s.push(c))}return s}function li(e,t){return null==(e=Eo(e,t=gi(t,e)))||delete e[Mo(Wo(t))]}function ui(e,t,r,n){return Kn(e,t,r(An(e,t)),n)}function ci(e,t,r,n){for(var i=e.length,o=n?i:-1;(n?o--:++o<i)&&t(e[o],o,e););return r?ei(e,n?0:o,n?o+1:i):ei(e,n?o+1:0,n?i:o)}function di(e,t){var r=e;return r instanceof zr&&(r=r.value()),Ft(t,(function(e,t){return t.func.apply(t.thisArg,Dt([e],t.args))}),r)}function pi(e,t,r){var i=e.length;if(i<2)return i?si(e[0]):[];for(var o=-1,a=n(i);++o<i;)for(var s=e[o],l=-1;++l<i;)l!=o&&(a[o]=un(a[o]||s,e[l],t,r));return si(mn(a,1),t,r)}function fi(e,t,r){for(var n=-1,o=e.length,a=t.length,s={};++n<o;){var l=n<a?t[n]:i;r(s,e[n],l)}return s}function hi(e){return Ha(e)?e:[]}function mi(e){return"function"==typeof e?e:rl}function gi(e,t){return Ga(e)?e:bo(e,t)?[e]:Po(ys(e))}var yi=Yn;function bi(e,t,r){var n=e.length;return r=r===i?n:r,!t&&r>=n?e:ei(e,t,r)}var vi=at||function(e){return dt.clearTimeout(e)};function _i(e,t){if(t)return e.slice();var r=e.length,n=Ge?Ge(r):new e.constructor(r);return e.copy(n),n}function Ai(e){var t=new e.constructor(e.byteLength);return new Be(t).set(new Be(e)),t}function wi(e,t){var r=t?Ai(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function Si(e,t){if(e!==t){var r=e!==i,n=null===e,o=e==e,a=ss(e),s=t!==i,l=null===t,u=t==t,c=ss(t);if(!l&&!c&&!a&&e>t||a&&s&&u&&!l&&!c||n&&s&&u||!r&&u||!o)return 1;if(!n&&!a&&!c&&e<t||c&&r&&o&&!n&&!a||l&&r&&o||!s&&o||!u)return-1}return 0}function Ti(e,t,r,i){for(var o=-1,a=e.length,s=r.length,l=-1,u=t.length,c=mr(a-s,0),d=n(u+c),p=!i;++l<u;)d[l]=t[l];for(;++o<s;)(p||o<a)&&(d[r[o]]=e[o]);for(;c--;)d[l++]=e[o++];return d}function Ei(e,t,r,i){for(var o=-1,a=e.length,s=-1,l=r.length,u=-1,c=t.length,d=mr(a-l,0),p=n(d+c),f=!i;++o<d;)p[o]=e[o];for(var h=o;++u<c;)p[h+u]=t[u];for(;++s<l;)(f||o<a)&&(p[h+r[s]]=e[o++]);return p}function Oi(e,t){var r=-1,i=e.length;for(t||(t=n(i));++r<i;)t[r]=e[r];return t}function xi(e,t,r,n){var o=!r;r||(r={});for(var a=-1,s=t.length;++a<s;){var l=t[a],u=n?n(r[l],e[l],l,r,e):i;u===i&&(u=e[l]),o?rn(r,l,u):Zr(r,l,u)}return r}function Ci(e,t){return function(r,n){var i=Ga(r)?Tt:en,o=t?t():{};return i(r,e,oo(n,2),o)}}function Ii(e){return Yn((function(t,r){var n=-1,o=r.length,a=o>1?r[o-1]:i,s=o>2?r[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,s&&yo(r[0],r[1],s)&&(a=o<3?i:a,o=1),t=Te(t);++n<o;){var l=r[n];l&&e(t,l,n,a)}return t}))}function ji(e,t){return function(r,n){if(null==r)return r;if(!Va(r))return e(r,n);for(var i=r.length,o=t?i:-1,a=Te(r);(t?o--:++o<i)&&!1!==n(a[o],o,a););return r}}function Ri(e){return function(t,r,n){for(var i=-1,o=Te(t),a=n(t),s=a.length;s--;){var l=a[e?s:++i];if(!1===r(o[l],l,o))break}return t}}function Di(e){return function(t){var r=nr(t=ys(t))?cr(t):i,n=r?r[0]:t.charAt(0),o=r?bi(r,1).join(""):t.slice(1);return n[e]()+o}}function Fi(e){return function(t){return Ft(Ks(Bs(t).replace(Ke,"")),e,"")}}function Ni(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var r=kr(e.prototype),n=e.apply(r,t);return Ja(n)?n:r}}function Pi(e){return function(t,r,n){var o=Te(t);if(!Va(t)){var a=oo(r,3);t=js(t),r=function(e){return a(o[e],e,o)}}var s=e(t,r,n);return s>-1?o[a?t[s]:s]:i}}function Mi(e){return Ji((function(t){var r=t.length,n=r,a=$r.prototype.thru;for(e&&t.reverse();n--;){var s=t[n];if("function"!=typeof s)throw new xe(o);if(a&&!l&&"wrapper"==no(s))var l=new $r([],!0)}for(n=l?n:r;++n<r;){var u=no(s=t[n]),c="wrapper"==u?ro(s):i;l=c&&vo(c[0])&&424==c[1]&&!c[4].length&&1==c[9]?l[no(c[0])].apply(l,c[3]):1==s.length&&vo(s)?l[u]():l.thru(s)}return function(){var e=arguments,n=e[0];if(l&&1==e.length&&Ga(n))return l.plant(n).value();for(var i=0,o=r?t[i].apply(this,e):n;++i<r;)o=t[i].call(this,o);return o}}))}function Li(e,t,r,o,a,s,l,c,d,p){var f=t&u,h=1&t,m=2&t,g=24&t,y=512&t,b=m?i:Ni(e);return function u(){for(var v=arguments.length,_=n(v),A=v;A--;)_[A]=arguments[A];if(g)var w=io(u),S=function(e,t){for(var r=e.length,n=0;r--;)e[r]===t&&++n;return n}(_,w);if(o&&(_=Ti(_,o,a,g)),s&&(_=Ei(_,s,l,g)),v-=S,g&&v<p){var T=ar(_,w);return Ui(e,t,Li,u.placeholder,r,_,T,c,d,p-v)}var E=h?r:this,O=m?E[e]:e;return v=_.length,c?_=function(e,t){for(var r=e.length,n=gr(t.length,r),o=Oi(e);n--;){var a=t[n];e[n]=go(a,r)?o[a]:i}return e}(_,c):y&&v>1&&_.reverse(),f&&d<v&&(_.length=d),this&&this!==dt&&this instanceof u&&(O=b||Ni(O)),O.apply(E,_)}}function ki(e,t){return function(r,n){return function(e,t,r,n){return bn(e,(function(e,i,o){t(n,r(e),i,o)})),n}(r,e,t(n),{})}}function qi(e,t){return function(r,n){var o;if(r===i&&n===i)return t;if(r!==i&&(o=r),n!==i){if(o===i)return n;"string"==typeof r||"string"==typeof n?(r=ai(r),n=ai(n)):(r=oi(r),n=oi(n)),o=e(r,n)}return o}}function $i(e){return Ji((function(t){return t=Rt(t,Wt(oo())),Yn((function(r){var n=this;return e(t,(function(e){return St(e,n,r)}))}))}))}function zi(e,t){var r=(t=t===i?" ":ai(t)).length;if(r<2)return r?Hn(t,e):t;var n=Hn(t,pt(e/ur(t)));return nr(t)?bi(cr(n),0,e).join(""):n.slice(0,e)}function Bi(e){return function(t,r,o){return o&&"number"!=typeof o&&yo(t,r,o)&&(r=o=i),t=ps(t),r===i?(r=t,t=0):r=ps(r),function(e,t,r,i){for(var o=-1,a=mr(pt((t-e)/(r||1)),0),s=n(a);a--;)s[i?a:++o]=e,e+=r;return s}(t,r,o=o===i?t<r?1:-1:ps(o),e)}}function Gi(e){return function(t,r){return"string"==typeof t&&"string"==typeof r||(t=ms(t),r=ms(r)),e(t,r)}}function Ui(e,t,r,n,o,a,s,u,c,d){var p=8&t;t|=p?l:64,4&(t&=~(p?64:l))||(t&=-4);var f=[e,t,o,p?a:i,p?s:i,p?i:a,p?i:s,u,c,d],h=r.apply(i,f);return vo(e)&&xo(h,f),h.placeholder=n,jo(h,e,t)}function Vi(e){var t=Se[e];return function(e,r){if(e=ms(e),(r=null==r?0:gr(fs(r),292))&&Mt(e)){var n=(ys(e)+"e").split("e");return+((n=(ys(t(n[0]+"e"+(+n[1]+r)))+"e").split("e"))[0]+"e"+(+n[1]-r))}return t(e)}}var Hi=Tr&&1/sr(new Tr([,-0]))[1]==c?function(e){return new Tr(e)}:sl;function Yi(e){return function(t){var r=po(t);return r==w?ir(t):r==x?lr(t):function(e,t){return Rt(t,(function(t){return[t,e[t]]}))}(t,e(t))}}function Xi(e,t,r,a,c,d,p,f){var h=2&t;if(!h&&"function"!=typeof e)throw new xe(o);var m=a?a.length:0;if(m||(t&=-97,a=c=i),p=p===i?p:mr(fs(p),0),f=f===i?f:fs(f),m-=c?c.length:0,64&t){var g=a,y=c;a=c=i}var b=h?i:ro(e),v=[e,t,r,a,c,g,y,d,p,f];if(b&&function(e,t){var r=e[1],n=t[1],i=r|n,o=i<131,a=n==u&&8==r||n==u&&256==r&&e[7].length<=t[8]||384==n&&t[7].length<=t[8]&&8==r;if(!o&&!a)return e;1&n&&(e[2]=t[2],i|=1&r?0:4);var l=t[3];if(l){var c=e[3];e[3]=c?Ti(c,l,t[4]):l,e[4]=c?ar(e[3],s):t[4]}(l=t[5])&&(c=e[5],e[5]=c?Ei(c,l,t[6]):l,e[6]=c?ar(e[5],s):t[6]),(l=t[7])&&(e[7]=l),n&u&&(e[8]=null==e[8]?t[8]:gr(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=i}(v,b),e=v[0],t=v[1],r=v[2],a=v[3],c=v[4],!(f=v[9]=v[9]===i?h?0:e.length:mr(v[9]-m,0))&&24&t&&(t&=-25),t&&1!=t)_=8==t||16==t?function(e,t,r){var o=Ni(e);return function a(){for(var s=arguments.length,l=n(s),u=s,c=io(a);u--;)l[u]=arguments[u];var d=s<3&&l[0]!==c&&l[s-1]!==c?[]:ar(l,c);return(s-=d.length)<r?Ui(e,t,Li,a.placeholder,i,l,d,i,i,r-s):St(this&&this!==dt&&this instanceof a?o:e,this,l)}}(e,t,f):t!=l&&33!=t||c.length?Li.apply(i,v):function(e,t,r,i){var o=1&t,a=Ni(e);return function t(){for(var s=-1,l=arguments.length,u=-1,c=i.length,d=n(c+l),p=this&&this!==dt&&this instanceof t?a:e;++u<c;)d[u]=i[u];for(;l--;)d[u++]=arguments[++s];return St(p,o?r:this,d)}}(e,t,r,a);else var _=function(e,t,r){var n=1&t,i=Ni(e);return function t(){return(this&&this!==dt&&this instanceof t?i:e).apply(n?r:this,arguments)}}(e,t,r);return jo((b?Qn:xo)(_,v),e,t)}function Wi(e,t,r,n){return e===i||qa(e,je[r])&&!Fe.call(n,r)?t:e}function Ki(e,t,r,n,o,a){return Ja(e)&&Ja(t)&&(a.set(t,e),qn(e,t,i,Ki,a),a.delete(t)),e}function Qi(e){return ns(e)?i:e}function Zi(e,t,r,n,o,a){var s=1&r,l=e.length,u=t.length;if(l!=u&&!(s&&u>l))return!1;var c=a.get(e),d=a.get(t);if(c&&d)return c==t&&d==e;var p=-1,f=!0,h=2&r?new Vr:i;for(a.set(e,t),a.set(t,e);++p<l;){var m=e[p],g=t[p];if(n)var y=s?n(g,m,p,t,e,a):n(m,g,p,e,t,a);if(y!==i){if(y)continue;f=!1;break}if(h){if(!Pt(t,(function(e,t){if(!Qt(h,t)&&(m===e||o(m,e,r,n,a)))return h.push(t)}))){f=!1;break}}else if(m!==g&&!o(m,g,r,n,a)){f=!1;break}}return a.delete(e),a.delete(t),f}function Ji(e){return Io(To(e,i,Uo),e+"")}function eo(e){return wn(e,js,uo)}function to(e){return wn(e,Rs,co)}var ro=xr?function(e){return xr.get(e)}:sl;function no(e){for(var t=e.name+"",r=Cr[t],n=Fe.call(Cr,t)?r.length:0;n--;){var i=r[n],o=i.func;if(null==o||o==e)return i.name}return t}function io(e){return(Fe.call(Lr,"placeholder")?Lr:e).placeholder}function oo(){var e=Lr.iteratee||nl;return e=e===nl?Fn:e,arguments.length?e(arguments[0],arguments[1]):e}function ao(e,t){var r,n,i=e.__data__;return("string"==(n=typeof(r=t))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?i["string"==typeof t?"string":"hash"]:i.map}function so(e){for(var t=js(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,wo(i)]}return t}function lo(e,t){var r=function(e,t){return null==e?i:e[t]}(e,t);return Dn(r)?r:i}var uo=mt?function(e){return null==e?[]:(e=Te(e),Ct(mt(e),(function(t){return He.call(e,t)})))}:hl,co=mt?function(e){for(var t=[];e;)Dt(t,uo(e)),e=Ue(e);return t}:hl,po=Sn;function fo(e,t,r){for(var n=-1,i=(t=gi(t,e)).length,o=!1;++n<i;){var a=Mo(t[n]);if(!(o=null!=e&&r(e,a)))break;e=e[a]}return o||++n!=i?o:!!(i=null==e?0:e.length)&&Za(i)&&go(a,i)&&(Ga(e)||Ba(e))}function ho(e){return"function"!=typeof e.constructor||Ao(e)?{}:kr(Ue(e))}function mo(e){return Ga(e)||Ba(e)||!!(Xe&&e&&e[Xe])}function go(e,t){var r=typeof e;return!!(t=null==t?d:t)&&("number"==r||"symbol"!=r&&ye.test(e))&&e>-1&&e%1==0&&e<t}function yo(e,t,r){if(!Ja(r))return!1;var n=typeof t;return!!("number"==n?Va(r)&&go(t,r.length):"string"==n&&t in r)&&qa(r[t],e)}function bo(e,t){if(Ga(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!ss(e))||J.test(e)||!Z.test(e)||null!=t&&e in Te(t)}function vo(e){var t=no(e),r=Lr[t];if("function"!=typeof r||!(t in zr.prototype))return!1;if(e===r)return!0;var n=ro(r);return!!n&&e===n[0]}(Ar&&po(new Ar(new ArrayBuffer(1)))!=D||wr&&po(new wr)!=w||Sr&&po(Sr.resolve())!=E||Tr&&po(new Tr)!=x||Er&&po(new Er)!=j)&&(po=function(e){var t=Sn(e),r=t==T?e.constructor:i,n=r?Lo(r):"";if(n)switch(n){case Ir:return D;case jr:return w;case Rr:return E;case Dr:return x;case Fr:return j}return t});var _o=Re?Ka:ml;function Ao(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||je)}function wo(e){return e==e&&!Ja(e)}function So(e,t){return function(r){return null!=r&&r[e]===t&&(t!==i||e in Te(r))}}function To(e,t,r){return t=mr(t===i?e.length-1:t,0),function(){for(var i=arguments,o=-1,a=mr(i.length-t,0),s=n(a);++o<a;)s[o]=i[t+o];o=-1;for(var l=n(t+1);++o<t;)l[o]=i[o];return l[t]=r(s),St(e,this,l)}}function Eo(e,t){return t.length<2?e:An(e,ei(t,0,-1))}function Oo(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var xo=Ro(Qn),Co=ct||function(e,t){return dt.setTimeout(e,t)},Io=Ro(Zn);function jo(e,t,r){var n=t+"";return Io(e,function(e,t){var r=t.length;if(!r)return e;var n=r-1;return t[n]=(r>1?"& ":"")+t[n],t=t.join(r>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(n,function(e,t){return Et(h,(function(r){var n="_."+r[0];t&r[1]&&!It(e,n)&&e.push(n)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(se):[]}(n),r)))}function Ro(e){var t=0,r=0;return function(){var n=yr(),o=16-(n-r);if(r=n,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function Do(e,t){var r=-1,n=e.length,o=n-1;for(t=t===i?n:t;++r<t;){var a=Vn(r,o),s=e[a];e[a]=e[r],e[r]=s}return e.length=t,e}var Fo,No,Po=(Fo=Fa((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(ee,(function(e,r,n,i){t.push(n?i.replace(ce,"$1"):r||e)})),t}),(function(e){return 500===No.size&&No.clear(),e})),No=Fo.cache,Fo);function Mo(e){if("string"==typeof e||ss(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Lo(e){if(null!=e){try{return De.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function ko(e){if(e instanceof zr)return e.clone();var t=new $r(e.__wrapped__,e.__chain__);return t.__actions__=Oi(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var qo=Yn((function(e,t){return Ha(e)?un(e,mn(t,1,Ha,!0)):[]})),$o=Yn((function(e,t){var r=Wo(t);return Ha(r)&&(r=i),Ha(e)?un(e,mn(t,1,Ha,!0),oo(r,2)):[]})),zo=Yn((function(e,t){var r=Wo(t);return Ha(r)&&(r=i),Ha(e)?un(e,mn(t,1,Ha,!0),i,r):[]}));function Bo(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var i=null==r?0:fs(r);return i<0&&(i=mr(n+i,0)),kt(e,oo(t,3),i)}function Go(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var o=n-1;return r!==i&&(o=fs(r),o=r<0?mr(n+o,0):gr(o,n-1)),kt(e,oo(t,3),o,!0)}function Uo(e){return null!=e&&e.length?mn(e,1):[]}function Vo(e){return e&&e.length?e[0]:i}var Ho=Yn((function(e){var t=Rt(e,hi);return t.length&&t[0]===e[0]?xn(t):[]})),Yo=Yn((function(e){var t=Wo(e),r=Rt(e,hi);return t===Wo(r)?t=i:r.pop(),r.length&&r[0]===e[0]?xn(r,oo(t,2)):[]})),Xo=Yn((function(e){var t=Wo(e),r=Rt(e,hi);return(t="function"==typeof t?t:i)&&r.pop(),r.length&&r[0]===e[0]?xn(r,i,t):[]}));function Wo(e){var t=null==e?0:e.length;return t?e[t-1]:i}var Ko=Yn(Qo);function Qo(e,t){return e&&e.length&&t&&t.length?Gn(e,t):e}var Zo=Ji((function(e,t){var r=null==e?0:e.length,n=nn(e,t);return Un(e,Rt(t,(function(e){return go(e,r)?+e:e})).sort(Si)),n}));function Jo(e){return null==e?e:_r.call(e)}var ea=Yn((function(e){return si(mn(e,1,Ha,!0))})),ta=Yn((function(e){var t=Wo(e);return Ha(t)&&(t=i),si(mn(e,1,Ha,!0),oo(t,2))})),ra=Yn((function(e){var t=Wo(e);return t="function"==typeof t?t:i,si(mn(e,1,Ha,!0),i,t)}));function na(e){if(!e||!e.length)return[];var t=0;return e=Ct(e,(function(e){if(Ha(e))return t=mr(e.length,t),!0})),Yt(t,(function(t){return Rt(e,Gt(t))}))}function ia(e,t){if(!e||!e.length)return[];var r=na(e);return null==t?r:Rt(r,(function(e){return St(t,i,e)}))}var oa=Yn((function(e,t){return Ha(e)?un(e,t):[]})),aa=Yn((function(e){return pi(Ct(e,Ha))})),sa=Yn((function(e){var t=Wo(e);return Ha(t)&&(t=i),pi(Ct(e,Ha),oo(t,2))})),la=Yn((function(e){var t=Wo(e);return t="function"==typeof t?t:i,pi(Ct(e,Ha),i,t)})),ua=Yn(na),ca=Yn((function(e){var t=e.length,r=t>1?e[t-1]:i;return r="function"==typeof r?(e.pop(),r):i,ia(e,r)}));function da(e){var t=Lr(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var fa=Ji((function(e){var t=e.length,r=t?e[0]:0,n=this.__wrapped__,o=function(t){return nn(t,e)};return!(t>1||this.__actions__.length)&&n instanceof zr&&go(r)?((n=n.slice(r,+r+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new $r(n,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ha=Ci((function(e,t,r){Fe.call(e,r)?++e[r]:rn(e,r,1)})),ma=Pi(Bo),ga=Pi(Go);function ya(e,t){return(Ga(e)?Et:cn)(e,oo(t,3))}function ba(e,t){return(Ga(e)?Ot:dn)(e,oo(t,3))}var va=Ci((function(e,t,r){Fe.call(e,r)?e[r].push(t):rn(e,r,[t])})),_a=Yn((function(e,t,r){var i=-1,o="function"==typeof t,a=Va(e)?n(e.length):[];return cn(e,(function(e){a[++i]=o?St(t,e,r):Cn(e,t,r)})),a})),Aa=Ci((function(e,t,r){rn(e,r,t)}));function wa(e,t){return(Ga(e)?Rt:Mn)(e,oo(t,3))}var Sa=Ci((function(e,t,r){e[r?0:1].push(t)}),(function(){return[[],[]]})),Ta=Yn((function(e,t){if(null==e)return[];var r=t.length;return r>1&&yo(e,t[0],t[1])?t=[]:r>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),zn(e,mn(t,1),[])})),Ea=ut||function(){return dt.Date.now()};function Oa(e,t,r){return t=r?i:t,t=e&&null==t?e.length:t,Xi(e,u,i,i,i,i,t)}function xa(e,t){var r;if("function"!=typeof t)throw new xe(o);return e=fs(e),function(){return--e>0&&(r=t.apply(this,arguments)),e<=1&&(t=i),r}}var Ca=Yn((function(e,t,r){var n=1;if(r.length){var i=ar(r,io(Ca));n|=l}return Xi(e,n,t,r,i)})),Ia=Yn((function(e,t,r){var n=3;if(r.length){var i=ar(r,io(Ia));n|=l}return Xi(t,n,e,r,i)}));function ja(e,t,r){var n,a,s,l,u,c,d=0,p=!1,f=!1,h=!0;if("function"!=typeof e)throw new xe(o);function m(t){var r=n,o=a;return n=a=i,d=t,l=e.apply(o,r)}function g(e){var r=e-c;return c===i||r>=t||r<0||f&&e-d>=s}function y(){var e=Ea();if(g(e))return b(e);u=Co(y,function(e){var r=t-(e-c);return f?gr(r,s-(e-d)):r}(e))}function b(e){return u=i,h&&n?m(e):(n=a=i,l)}function v(){var e=Ea(),r=g(e);if(n=arguments,a=this,c=e,r){if(u===i)return function(e){return d=e,u=Co(y,t),p?m(e):l}(c);if(f)return vi(u),u=Co(y,t),m(c)}return u===i&&(u=Co(y,t)),l}return t=ms(t)||0,Ja(r)&&(p=!!r.leading,s=(f="maxWait"in r)?mr(ms(r.maxWait)||0,t):s,h="trailing"in r?!!r.trailing:h),v.cancel=function(){u!==i&&vi(u),d=0,n=c=a=u=i},v.flush=function(){return u===i?l:b(Ea())},v}var Ra=Yn((function(e,t){return ln(e,1,t)})),Da=Yn((function(e,t,r){return ln(e,ms(t)||0,r)}));function Fa(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var a=e.apply(this,n);return r.cache=o.set(i,a)||o,a};return r.cache=new(Fa.Cache||Ur),r}function Na(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Fa.Cache=Ur;var Pa=yi((function(e,t){var r=(t=1==t.length&&Ga(t[0])?Rt(t[0],Wt(oo())):Rt(mn(t,1),Wt(oo()))).length;return Yn((function(n){for(var i=-1,o=gr(n.length,r);++i<o;)n[i]=t[i].call(this,n[i]);return St(e,this,n)}))})),Ma=Yn((function(e,t){var r=ar(t,io(Ma));return Xi(e,l,i,t,r)})),La=Yn((function(e,t){var r=ar(t,io(La));return Xi(e,64,i,t,r)})),ka=Ji((function(e,t){return Xi(e,256,i,i,i,t)}));function qa(e,t){return e===t||e!=e&&t!=t}var $a=Gi(Tn),za=Gi((function(e,t){return e>=t})),Ba=In(function(){return arguments}())?In:function(e){return es(e)&&Fe.call(e,"callee")&&!He.call(e,"callee")},Ga=n.isArray,Ua=yt?Wt(yt):function(e){return es(e)&&Sn(e)==R};function Va(e){return null!=e&&Za(e.length)&&!Ka(e)}function Ha(e){return es(e)&&Va(e)}var Ya=gt||ml,Xa=bt?Wt(bt):function(e){return es(e)&&Sn(e)==b};function Wa(e){if(!es(e))return!1;var t=Sn(e);return t==v||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ns(e)}function Ka(e){if(!Ja(e))return!1;var t=Sn(e);return t==_||t==A||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Qa(e){return"number"==typeof e&&e==fs(e)}function Za(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=d}function Ja(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function es(e){return null!=e&&"object"==typeof e}var ts=vt?Wt(vt):function(e){return es(e)&&po(e)==w};function rs(e){return"number"==typeof e||es(e)&&Sn(e)==S}function ns(e){if(!es(e)||Sn(e)!=T)return!1;var t=Ue(e);if(null===t)return!0;var r=Fe.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&De.call(r)==Le}var is=_t?Wt(_t):function(e){return es(e)&&Sn(e)==O},os=At?Wt(At):function(e){return es(e)&&po(e)==x};function as(e){return"string"==typeof e||!Ga(e)&&es(e)&&Sn(e)==C}function ss(e){return"symbol"==typeof e||es(e)&&Sn(e)==I}var ls=wt?Wt(wt):function(e){return es(e)&&Za(e.length)&&!!it[Sn(e)]},us=Gi(Pn),cs=Gi((function(e,t){return e<=t}));function ds(e){if(!e)return[];if(Va(e))return as(e)?cr(e):Oi(e);if(We&&e[We])return function(e){for(var t,r=[];!(t=e.next()).done;)r.push(t.value);return r}(e[We]());var t=po(e);return(t==w?ir:t==x?sr:qs)(e)}function ps(e){return e?(e=ms(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function fs(e){var t=ps(e),r=t%1;return t==t?r?t-r:t:0}function hs(e){return e?on(fs(e),0,f):0}function ms(e){if("number"==typeof e)return e;if(ss(e))return p;if(Ja(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Ja(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Xt(e);var r=he.test(e);return r||ge.test(e)?lt(e.slice(2),r?2:8):fe.test(e)?p:+e}function gs(e){return xi(e,Rs(e))}function ys(e){return null==e?"":ai(e)}var bs=Ii((function(e,t){if(Ao(t)||Va(t))xi(t,js(t),e);else for(var r in t)Fe.call(t,r)&&Zr(e,r,t[r])})),vs=Ii((function(e,t){xi(t,Rs(t),e)})),_s=Ii((function(e,t,r,n){xi(t,Rs(t),e,n)})),As=Ii((function(e,t,r,n){xi(t,js(t),e,n)})),ws=Ji(nn),Ss=Yn((function(e,t){e=Te(e);var r=-1,n=t.length,o=n>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(n=1);++r<n;)for(var a=t[r],s=Rs(a),l=-1,u=s.length;++l<u;){var c=s[l],d=e[c];(d===i||qa(d,je[c])&&!Fe.call(e,c))&&(e[c]=a[c])}return e})),Ts=Yn((function(e){return e.push(i,Ki),St(Fs,i,e)}));function Es(e,t,r){var n=null==e?i:An(e,t);return n===i?r:n}function Os(e,t){return null!=e&&fo(e,t,On)}var xs=ki((function(e,t,r){null!=t&&"function"!=typeof t.toString&&(t=Me.call(t)),e[t]=r}),Js(rl)),Cs=ki((function(e,t,r){null!=t&&"function"!=typeof t.toString&&(t=Me.call(t)),Fe.call(e,t)?e[t].push(r):e[t]=[r]}),oo),Is=Yn(Cn);function js(e){return Va(e)?Yr(e):Nn(e)}function Rs(e){return Va(e)?Yr(e,!0):function(e){if(!Ja(e))return function(e){var t=[];if(null!=e)for(var r in Te(e))t.push(r);return t}(e);var t=Ao(e),r=[];for(var n in e)("constructor"!=n||!t&&Fe.call(e,n))&&r.push(n);return r}(e)}var Ds=Ii((function(e,t,r){qn(e,t,r)})),Fs=Ii((function(e,t,r,n){qn(e,t,r,n)})),Ns=Ji((function(e,t){var r={};if(null==e)return r;var n=!1;t=Rt(t,(function(t){return t=gi(t,e),n||(n=t.length>1),t})),xi(e,to(e),r),n&&(r=an(r,7,Qi));for(var i=t.length;i--;)li(r,t[i]);return r})),Ps=Ji((function(e,t){return null==e?{}:function(e,t){return Bn(e,t,(function(t,r){return Os(e,r)}))}(e,t)}));function Ms(e,t){if(null==e)return{};var r=Rt(to(e),(function(e){return[e]}));return t=oo(t),Bn(e,r,(function(e,r){return t(e,r[0])}))}var Ls=Yi(js),ks=Yi(Rs);function qs(e){return null==e?[]:Kt(e,js(e))}var $s=Fi((function(e,t,r){return t=t.toLowerCase(),e+(r?zs(t):t)}));function zs(e){return Ws(ys(e).toLowerCase())}function Bs(e){return(e=ys(e))&&e.replace(be,er).replace(Qe,"")}var Gs=Fi((function(e,t,r){return e+(r?"-":"")+t.toLowerCase()})),Us=Fi((function(e,t,r){return e+(r?" ":"")+t.toLowerCase()})),Vs=Di("toLowerCase"),Hs=Fi((function(e,t,r){return e+(r?"_":"")+t.toLowerCase()})),Ys=Fi((function(e,t,r){return e+(r?" ":"")+Ws(t)})),Xs=Fi((function(e,t,r){return e+(r?" ":"")+t.toUpperCase()})),Ws=Di("toUpperCase");function Ks(e,t,r){return e=ys(e),(t=r?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Je)||[]}(e):function(e){return e.match(le)||[]}(e):e.match(t)||[]}var Qs=Yn((function(e,t){try{return St(e,i,t)}catch(e){return Wa(e)?e:new Ae(e)}})),Zs=Ji((function(e,t){return Et(t,(function(t){t=Mo(t),rn(e,t,Ca(e[t],e))})),e}));function Js(e){return function(){return e}}var el=Mi(),tl=Mi(!0);function rl(e){return e}function nl(e){return Fn("function"==typeof e?e:an(e,1))}var il=Yn((function(e,t){return function(r){return Cn(r,e,t)}})),ol=Yn((function(e,t){return function(r){return Cn(e,r,t)}}));function al(e,t,r){var n=js(t),i=_n(t,n);null!=r||Ja(t)&&(i.length||!n.length)||(r=t,t=e,e=this,i=_n(t,js(t)));var o=!(Ja(r)&&"chain"in r&&!r.chain),a=Ka(e);return Et(i,(function(r){var n=t[r];e[r]=n,a&&(e.prototype[r]=function(){var t=this.__chain__;if(o||t){var r=e(this.__wrapped__);return(r.__actions__=Oi(this.__actions__)).push({func:n,args:arguments,thisArg:e}),r.__chain__=t,r}return n.apply(e,Dt([this.value()],arguments))})})),e}function sl(){}var ll=$i(Rt),ul=$i(xt),cl=$i(Pt);function dl(e){return bo(e)?Gt(Mo(e)):function(e){return function(t){return An(t,e)}}(e)}var pl=Bi(),fl=Bi(!0);function hl(){return[]}function ml(){return!1}var gl,yl=qi((function(e,t){return e+t}),0),bl=Vi("ceil"),vl=qi((function(e,t){return e/t}),1),_l=Vi("floor"),Al=qi((function(e,t){return e*t}),1),wl=Vi("round"),Sl=qi((function(e,t){return e-t}),0);return Lr.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=fs(e),function(){if(--e<1)return t.apply(this,arguments)}},Lr.ary=Oa,Lr.assign=bs,Lr.assignIn=vs,Lr.assignInWith=_s,Lr.assignWith=As,Lr.at=ws,Lr.before=xa,Lr.bind=Ca,Lr.bindAll=Zs,Lr.bindKey=Ia,Lr.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Ga(e)?e:[e]},Lr.chain=da,Lr.chunk=function(e,t,r){t=(r?yo(e,t,r):t===i)?1:mr(fs(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,s=0,l=n(pt(o/t));a<o;)l[s++]=ei(e,a,a+=t);return l},Lr.compact=function(e){for(var t=-1,r=null==e?0:e.length,n=0,i=[];++t<r;){var o=e[t];o&&(i[n++]=o)}return i},Lr.concat=function(){var e=arguments.length;if(!e)return[];for(var t=n(e-1),r=arguments[0],i=e;i--;)t[i-1]=arguments[i];return Dt(Ga(r)?Oi(r):[r],mn(t,1))},Lr.cond=function(e){var t=null==e?0:e.length,r=oo();return e=t?Rt(e,(function(e){if("function"!=typeof e[1])throw new xe(o);return[r(e[0]),e[1]]})):[],Yn((function(r){for(var n=-1;++n<t;){var i=e[n];if(St(i[0],this,r))return St(i[1],this,r)}}))},Lr.conforms=function(e){return function(e){var t=js(e);return function(r){return sn(r,e,t)}}(an(e,1))},Lr.constant=Js,Lr.countBy=ha,Lr.create=function(e,t){var r=kr(e);return null==t?r:tn(r,t)},Lr.curry=function e(t,r,n){var o=Xi(t,8,i,i,i,i,i,r=n?i:r);return o.placeholder=e.placeholder,o},Lr.curryRight=function e(t,r,n){var o=Xi(t,16,i,i,i,i,i,r=n?i:r);return o.placeholder=e.placeholder,o},Lr.debounce=ja,Lr.defaults=Ss,Lr.defaultsDeep=Ts,Lr.defer=Ra,Lr.delay=Da,Lr.difference=qo,Lr.differenceBy=$o,Lr.differenceWith=zo,Lr.drop=function(e,t,r){var n=null==e?0:e.length;return n?ei(e,(t=r||t===i?1:fs(t))<0?0:t,n):[]},Lr.dropRight=function(e,t,r){var n=null==e?0:e.length;return n?ei(e,0,(t=n-(t=r||t===i?1:fs(t)))<0?0:t):[]},Lr.dropRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!0,!0):[]},Lr.dropWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!0):[]},Lr.fill=function(e,t,r,n){var o=null==e?0:e.length;return o?(r&&"number"!=typeof r&&yo(e,t,r)&&(r=0,n=o),function(e,t,r,n){var o=e.length;for((r=fs(r))<0&&(r=-r>o?0:o+r),(n=n===i||n>o?o:fs(n))<0&&(n+=o),n=r>n?0:hs(n);r<n;)e[r++]=t;return e}(e,t,r,n)):[]},Lr.filter=function(e,t){return(Ga(e)?Ct:hn)(e,oo(t,3))},Lr.flatMap=function(e,t){return mn(wa(e,t),1)},Lr.flatMapDeep=function(e,t){return mn(wa(e,t),c)},Lr.flatMapDepth=function(e,t,r){return r=r===i?1:fs(r),mn(wa(e,t),r)},Lr.flatten=Uo,Lr.flattenDeep=function(e){return null!=e&&e.length?mn(e,c):[]},Lr.flattenDepth=function(e,t){return null!=e&&e.length?mn(e,t=t===i?1:fs(t)):[]},Lr.flip=function(e){return Xi(e,512)},Lr.flow=el,Lr.flowRight=tl,Lr.fromPairs=function(e){for(var t=-1,r=null==e?0:e.length,n={};++t<r;){var i=e[t];n[i[0]]=i[1]}return n},Lr.functions=function(e){return null==e?[]:_n(e,js(e))},Lr.functionsIn=function(e){return null==e?[]:_n(e,Rs(e))},Lr.groupBy=va,Lr.initial=function(e){return null!=e&&e.length?ei(e,0,-1):[]},Lr.intersection=Ho,Lr.intersectionBy=Yo,Lr.intersectionWith=Xo,Lr.invert=xs,Lr.invertBy=Cs,Lr.invokeMap=_a,Lr.iteratee=nl,Lr.keyBy=Aa,Lr.keys=js,Lr.keysIn=Rs,Lr.map=wa,Lr.mapKeys=function(e,t){var r={};return t=oo(t,3),bn(e,(function(e,n,i){rn(r,t(e,n,i),e)})),r},Lr.mapValues=function(e,t){var r={};return t=oo(t,3),bn(e,(function(e,n,i){rn(r,n,t(e,n,i))})),r},Lr.matches=function(e){return Ln(an(e,1))},Lr.matchesProperty=function(e,t){return kn(e,an(t,1))},Lr.memoize=Fa,Lr.merge=Ds,Lr.mergeWith=Fs,Lr.method=il,Lr.methodOf=ol,Lr.mixin=al,Lr.negate=Na,Lr.nthArg=function(e){return e=fs(e),Yn((function(t){return $n(t,e)}))},Lr.omit=Ns,Lr.omitBy=function(e,t){return Ms(e,Na(oo(t)))},Lr.once=function(e){return xa(2,e)},Lr.orderBy=function(e,t,r,n){return null==e?[]:(Ga(t)||(t=null==t?[]:[t]),Ga(r=n?i:r)||(r=null==r?[]:[r]),zn(e,t,r))},Lr.over=ll,Lr.overArgs=Pa,Lr.overEvery=ul,Lr.overSome=cl,Lr.partial=Ma,Lr.partialRight=La,Lr.partition=Sa,Lr.pick=Ps,Lr.pickBy=Ms,Lr.property=dl,Lr.propertyOf=function(e){return function(t){return null==e?i:An(e,t)}},Lr.pull=Ko,Lr.pullAll=Qo,Lr.pullAllBy=function(e,t,r){return e&&e.length&&t&&t.length?Gn(e,t,oo(r,2)):e},Lr.pullAllWith=function(e,t,r){return e&&e.length&&t&&t.length?Gn(e,t,i,r):e},Lr.pullAt=Zo,Lr.range=pl,Lr.rangeRight=fl,Lr.rearg=ka,Lr.reject=function(e,t){return(Ga(e)?Ct:hn)(e,Na(oo(t,3)))},Lr.remove=function(e,t){var r=[];if(!e||!e.length)return r;var n=-1,i=[],o=e.length;for(t=oo(t,3);++n<o;){var a=e[n];t(a,n,e)&&(r.push(a),i.push(n))}return Un(e,i),r},Lr.rest=function(e,t){if("function"!=typeof e)throw new xe(o);return Yn(e,t=t===i?t:fs(t))},Lr.reverse=Jo,Lr.sampleSize=function(e,t,r){return t=(r?yo(e,t,r):t===i)?1:fs(t),(Ga(e)?Wr:Wn)(e,t)},Lr.set=function(e,t,r){return null==e?e:Kn(e,t,r)},Lr.setWith=function(e,t,r,n){return n="function"==typeof n?n:i,null==e?e:Kn(e,t,r,n)},Lr.shuffle=function(e){return(Ga(e)?Kr:Jn)(e)},Lr.slice=function(e,t,r){var n=null==e?0:e.length;return n?(r&&"number"!=typeof r&&yo(e,t,r)?(t=0,r=n):(t=null==t?0:fs(t),r=r===i?n:fs(r)),ei(e,t,r)):[]},Lr.sortBy=Ta,Lr.sortedUniq=function(e){return e&&e.length?ii(e):[]},Lr.sortedUniqBy=function(e,t){return e&&e.length?ii(e,oo(t,2)):[]},Lr.split=function(e,t,r){return r&&"number"!=typeof r&&yo(e,t,r)&&(t=r=i),(r=r===i?f:r>>>0)?(e=ys(e))&&("string"==typeof t||null!=t&&!is(t))&&!(t=ai(t))&&nr(e)?bi(cr(e),0,r):e.split(t,r):[]},Lr.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:mr(fs(t),0),Yn((function(r){var n=r[t],i=bi(r,0,t);return n&&Dt(i,n),St(e,this,i)}))},Lr.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Lr.take=function(e,t,r){return e&&e.length?ei(e,0,(t=r||t===i?1:fs(t))<0?0:t):[]},Lr.takeRight=function(e,t,r){var n=null==e?0:e.length;return n?ei(e,(t=n-(t=r||t===i?1:fs(t)))<0?0:t,n):[]},Lr.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Lr.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Lr.tap=function(e,t){return t(e),e},Lr.throttle=function(e,t,r){var n=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Ja(r)&&(n="leading"in r?!!r.leading:n,i="trailing"in r?!!r.trailing:i),ja(e,t,{leading:n,maxWait:t,trailing:i})},Lr.thru=pa,Lr.toArray=ds,Lr.toPairs=Ls,Lr.toPairsIn=ks,Lr.toPath=function(e){return Ga(e)?Rt(e,Mo):ss(e)?[e]:Oi(Po(ys(e)))},Lr.toPlainObject=gs,Lr.transform=function(e,t,r){var n=Ga(e),i=n||Ya(e)||ls(e);if(t=oo(t,4),null==r){var o=e&&e.constructor;r=i?n?new o:[]:Ja(e)&&Ka(o)?kr(Ue(e)):{}}return(i?Et:bn)(e,(function(e,n,i){return t(r,e,n,i)})),r},Lr.unary=function(e){return Oa(e,1)},Lr.union=ea,Lr.unionBy=ta,Lr.unionWith=ra,Lr.uniq=function(e){return e&&e.length?si(e):[]},Lr.uniqBy=function(e,t){return e&&e.length?si(e,oo(t,2)):[]},Lr.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?si(e,i,t):[]},Lr.unset=function(e,t){return null==e||li(e,t)},Lr.unzip=na,Lr.unzipWith=ia,Lr.update=function(e,t,r){return null==e?e:ui(e,t,mi(r))},Lr.updateWith=function(e,t,r,n){return n="function"==typeof n?n:i,null==e?e:ui(e,t,mi(r),n)},Lr.values=qs,Lr.valuesIn=function(e){return null==e?[]:Kt(e,Rs(e))},Lr.without=oa,Lr.words=Ks,Lr.wrap=function(e,t){return Ma(mi(t),e)},Lr.xor=aa,Lr.xorBy=sa,Lr.xorWith=la,Lr.zip=ua,Lr.zipObject=function(e,t){return fi(e||[],t||[],Zr)},Lr.zipObjectDeep=function(e,t){return fi(e||[],t||[],Kn)},Lr.zipWith=ca,Lr.entries=Ls,Lr.entriesIn=ks,Lr.extend=vs,Lr.extendWith=_s,al(Lr,Lr),Lr.add=yl,Lr.attempt=Qs,Lr.camelCase=$s,Lr.capitalize=zs,Lr.ceil=bl,Lr.clamp=function(e,t,r){return r===i&&(r=t,t=i),r!==i&&(r=(r=ms(r))==r?r:0),t!==i&&(t=(t=ms(t))==t?t:0),on(ms(e),t,r)},Lr.clone=function(e){return an(e,4)},Lr.cloneDeep=function(e){return an(e,5)},Lr.cloneDeepWith=function(e,t){return an(e,5,t="function"==typeof t?t:i)},Lr.cloneWith=function(e,t){return an(e,4,t="function"==typeof t?t:i)},Lr.conformsTo=function(e,t){return null==t||sn(e,t,js(t))},Lr.deburr=Bs,Lr.defaultTo=function(e,t){return null==e||e!=e?t:e},Lr.divide=vl,Lr.endsWith=function(e,t,r){e=ys(e),t=ai(t);var n=e.length,o=r=r===i?n:on(fs(r),0,n);return(r-=t.length)>=0&&e.slice(r,o)==t},Lr.eq=qa,Lr.escape=function(e){return(e=ys(e))&&X.test(e)?e.replace(H,tr):e},Lr.escapeRegExp=function(e){return(e=ys(e))&&re.test(e)?e.replace(te,"\\$&"):e},Lr.every=function(e,t,r){var n=Ga(e)?xt:pn;return r&&yo(e,t,r)&&(t=i),n(e,oo(t,3))},Lr.find=ma,Lr.findIndex=Bo,Lr.findKey=function(e,t){return Lt(e,oo(t,3),bn)},Lr.findLast=ga,Lr.findLastIndex=Go,Lr.findLastKey=function(e,t){return Lt(e,oo(t,3),vn)},Lr.floor=_l,Lr.forEach=ya,Lr.forEachRight=ba,Lr.forIn=function(e,t){return null==e?e:gn(e,oo(t,3),Rs)},Lr.forInRight=function(e,t){return null==e?e:yn(e,oo(t,3),Rs)},Lr.forOwn=function(e,t){return e&&bn(e,oo(t,3))},Lr.forOwnRight=function(e,t){return e&&vn(e,oo(t,3))},Lr.get=Es,Lr.gt=$a,Lr.gte=za,Lr.has=function(e,t){return null!=e&&fo(e,t,En)},Lr.hasIn=Os,Lr.head=Vo,Lr.identity=rl,Lr.includes=function(e,t,r,n){e=Va(e)?e:qs(e),r=r&&!n?fs(r):0;var i=e.length;return r<0&&(r=mr(i+r,0)),as(e)?r<=i&&e.indexOf(t,r)>-1:!!i&&qt(e,t,r)>-1},Lr.indexOf=function(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var i=null==r?0:fs(r);return i<0&&(i=mr(n+i,0)),qt(e,t,i)},Lr.inRange=function(e,t,r){return t=ps(t),r===i?(r=t,t=0):r=ps(r),function(e,t,r){return e>=gr(t,r)&&e<mr(t,r)}(e=ms(e),t,r)},Lr.invoke=Is,Lr.isArguments=Ba,Lr.isArray=Ga,Lr.isArrayBuffer=Ua,Lr.isArrayLike=Va,Lr.isArrayLikeObject=Ha,Lr.isBoolean=function(e){return!0===e||!1===e||es(e)&&Sn(e)==y},Lr.isBuffer=Ya,Lr.isDate=Xa,Lr.isElement=function(e){return es(e)&&1===e.nodeType&&!ns(e)},Lr.isEmpty=function(e){if(null==e)return!0;if(Va(e)&&(Ga(e)||"string"==typeof e||"function"==typeof e.splice||Ya(e)||ls(e)||Ba(e)))return!e.length;var t=po(e);if(t==w||t==x)return!e.size;if(Ao(e))return!Nn(e).length;for(var r in e)if(Fe.call(e,r))return!1;return!0},Lr.isEqual=function(e,t){return jn(e,t)},Lr.isEqualWith=function(e,t,r){var n=(r="function"==typeof r?r:i)?r(e,t):i;return n===i?jn(e,t,i,r):!!n},Lr.isError=Wa,Lr.isFinite=function(e){return"number"==typeof e&&Mt(e)},Lr.isFunction=Ka,Lr.isInteger=Qa,Lr.isLength=Za,Lr.isMap=ts,Lr.isMatch=function(e,t){return e===t||Rn(e,t,so(t))},Lr.isMatchWith=function(e,t,r){return r="function"==typeof r?r:i,Rn(e,t,so(t),r)},Lr.isNaN=function(e){return rs(e)&&e!=+e},Lr.isNative=function(e){if(_o(e))throw new Ae("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Dn(e)},Lr.isNil=function(e){return null==e},Lr.isNull=function(e){return null===e},Lr.isNumber=rs,Lr.isObject=Ja,Lr.isObjectLike=es,Lr.isPlainObject=ns,Lr.isRegExp=is,Lr.isSafeInteger=function(e){return Qa(e)&&e>=-9007199254740991&&e<=d},Lr.isSet=os,Lr.isString=as,Lr.isSymbol=ss,Lr.isTypedArray=ls,Lr.isUndefined=function(e){return e===i},Lr.isWeakMap=function(e){return es(e)&&po(e)==j},Lr.isWeakSet=function(e){return es(e)&&"[object WeakSet]"==Sn(e)},Lr.join=function(e,t){return null==e?"":Ut.call(e,t)},Lr.kebabCase=Gs,Lr.last=Wo,Lr.lastIndexOf=function(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var o=n;return r!==i&&(o=(o=fs(r))<0?mr(n+o,0):gr(o,n-1)),t==t?function(e,t,r){for(var n=r+1;n--;)if(e[n]===t)return n;return n}(e,t,o):kt(e,zt,o,!0)},Lr.lowerCase=Us,Lr.lowerFirst=Vs,Lr.lt=us,Lr.lte=cs,Lr.max=function(e){return e&&e.length?fn(e,rl,Tn):i},Lr.maxBy=function(e,t){return e&&e.length?fn(e,oo(t,2),Tn):i},Lr.mean=function(e){return Bt(e,rl)},Lr.meanBy=function(e,t){return Bt(e,oo(t,2))},Lr.min=function(e){return e&&e.length?fn(e,rl,Pn):i},Lr.minBy=function(e,t){return e&&e.length?fn(e,oo(t,2),Pn):i},Lr.stubArray=hl,Lr.stubFalse=ml,Lr.stubObject=function(){return{}},Lr.stubString=function(){return""},Lr.stubTrue=function(){return!0},Lr.multiply=Al,Lr.nth=function(e,t){return e&&e.length?$n(e,fs(t)):i},Lr.noConflict=function(){return dt._===this&&(dt._=ke),this},Lr.noop=sl,Lr.now=Ea,Lr.pad=function(e,t,r){e=ys(e);var n=(t=fs(t))?ur(e):0;if(!t||n>=t)return e;var i=(t-n)/2;return zi(ft(i),r)+e+zi(pt(i),r)},Lr.padEnd=function(e,t,r){e=ys(e);var n=(t=fs(t))?ur(e):0;return t&&n<t?e+zi(t-n,r):e},Lr.padStart=function(e,t,r){e=ys(e);var n=(t=fs(t))?ur(e):0;return t&&n<t?zi(t-n,r)+e:e},Lr.parseInt=function(e,t,r){return r||null==t?t=0:t&&(t=+t),br(ys(e).replace(ne,""),t||0)},Lr.random=function(e,t,r){if(r&&"boolean"!=typeof r&&yo(e,t,r)&&(t=r=i),r===i&&("boolean"==typeof t?(r=t,t=i):"boolean"==typeof e&&(r=e,e=i)),e===i&&t===i?(e=0,t=1):(e=ps(e),t===i?(t=e,e=0):t=ps(t)),e>t){var n=e;e=t,t=n}if(r||e%1||t%1){var o=vr();return gr(e+o*(t-e+st("1e-"+((o+"").length-1))),t)}return Vn(e,t)},Lr.reduce=function(e,t,r){var n=Ga(e)?Ft:Vt,i=arguments.length<3;return n(e,oo(t,4),r,i,cn)},Lr.reduceRight=function(e,t,r){var n=Ga(e)?Nt:Vt,i=arguments.length<3;return n(e,oo(t,4),r,i,dn)},Lr.repeat=function(e,t,r){return t=(r?yo(e,t,r):t===i)?1:fs(t),Hn(ys(e),t)},Lr.replace=function(){var e=arguments,t=ys(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Lr.result=function(e,t,r){var n=-1,o=(t=gi(t,e)).length;for(o||(o=1,e=i);++n<o;){var a=null==e?i:e[Mo(t[n])];a===i&&(n=o,a=r),e=Ka(a)?a.call(e):a}return e},Lr.round=wl,Lr.runInContext=e,Lr.sample=function(e){return(Ga(e)?Xr:Xn)(e)},Lr.size=function(e){if(null==e)return 0;if(Va(e))return as(e)?ur(e):e.length;var t=po(e);return t==w||t==x?e.size:Nn(e).length},Lr.snakeCase=Hs,Lr.some=function(e,t,r){var n=Ga(e)?Pt:ti;return r&&yo(e,t,r)&&(t=i),n(e,oo(t,3))},Lr.sortedIndex=function(e,t){return ri(e,t)},Lr.sortedIndexBy=function(e,t,r){return ni(e,t,oo(r,2))},Lr.sortedIndexOf=function(e,t){var r=null==e?0:e.length;if(r){var n=ri(e,t);if(n<r&&qa(e[n],t))return n}return-1},Lr.sortedLastIndex=function(e,t){return ri(e,t,!0)},Lr.sortedLastIndexBy=function(e,t,r){return ni(e,t,oo(r,2),!0)},Lr.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var r=ri(e,t,!0)-1;if(qa(e[r],t))return r}return-1},Lr.startCase=Ys,Lr.startsWith=function(e,t,r){return e=ys(e),r=null==r?0:on(fs(r),0,e.length),t=ai(t),e.slice(r,r+t.length)==t},Lr.subtract=Sl,Lr.sum=function(e){return e&&e.length?Ht(e,rl):0},Lr.sumBy=function(e,t){return e&&e.length?Ht(e,oo(t,2)):0},Lr.template=function(e,t,r){var n=Lr.templateSettings;r&&yo(e,t,r)&&(t=i),e=ys(e),t=_s({},t,n,Wi);var o,a,s=_s({},t.imports,n.imports,Wi),l=js(s),u=Kt(s,l),c=0,d=t.interpolate||ve,p="__p += '",f=Ee((t.escape||ve).source+"|"+d.source+"|"+(d===Q?de:ve).source+"|"+(t.evaluate||ve).source+"|$","g"),h="//# sourceURL="+(Fe.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++nt+"]")+"\n";e.replace(f,(function(t,r,n,i,s,l){return n||(n=i),p+=e.slice(c,l).replace(_e,rr),r&&(o=!0,p+="' +\n__e("+r+") +\n'"),s&&(a=!0,p+="';\n"+s+";\n__p += '"),n&&(p+="' +\n((__t = ("+n+")) == null ? '' : __t) +\n'"),c=l+t.length,t})),p+="';\n";var m=Fe.call(t,"variable")&&t.variable;if(m){if(ue.test(m))throw new Ae("Invalid `variable` option passed into `_.template`")}else p="with (obj) {\n"+p+"\n}\n";p=(a?p.replace(B,""):p).replace(G,"$1").replace(U,"$1;"),p="function("+(m||"obj")+") {\n"+(m?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(o?", __e = _.escape":"")+(a?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+p+"return __p\n}";var g=Qs((function(){return we(l,h+"return "+p).apply(i,u)}));if(g.source=p,Wa(g))throw g;return g},Lr.times=function(e,t){if((e=fs(e))<1||e>d)return[];var r=f,n=gr(e,f);t=oo(t),e-=f;for(var i=Yt(n,t);++r<e;)t(r);return i},Lr.toFinite=ps,Lr.toInteger=fs,Lr.toLength=hs,Lr.toLower=function(e){return ys(e).toLowerCase()},Lr.toNumber=ms,Lr.toSafeInteger=function(e){return e?on(fs(e),-9007199254740991,d):0===e?e:0},Lr.toString=ys,Lr.toUpper=function(e){return ys(e).toUpperCase()},Lr.trim=function(e,t,r){if((e=ys(e))&&(r||t===i))return Xt(e);if(!e||!(t=ai(t)))return e;var n=cr(e),o=cr(t);return bi(n,Zt(n,o),Jt(n,o)+1).join("")},Lr.trimEnd=function(e,t,r){if((e=ys(e))&&(r||t===i))return e.slice(0,dr(e)+1);if(!e||!(t=ai(t)))return e;var n=cr(e);return bi(n,0,Jt(n,cr(t))+1).join("")},Lr.trimStart=function(e,t,r){if((e=ys(e))&&(r||t===i))return e.replace(ne,"");if(!e||!(t=ai(t)))return e;var n=cr(e);return bi(n,Zt(n,cr(t))).join("")},Lr.truncate=function(e,t){var r=30,n="...";if(Ja(t)){var o="separator"in t?t.separator:o;r="length"in t?fs(t.length):r,n="omission"in t?ai(t.omission):n}var a=(e=ys(e)).length;if(nr(e)){var s=cr(e);a=s.length}if(r>=a)return e;var l=r-ur(n);if(l<1)return n;var u=s?bi(s,0,l).join(""):e.slice(0,l);if(o===i)return u+n;if(s&&(l+=u.length-l),is(o)){if(e.slice(l).search(o)){var c,d=u;for(o.global||(o=Ee(o.source,ys(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(d);)var p=c.index;u=u.slice(0,p===i?l:p)}}else if(e.indexOf(ai(o),l)!=l){var f=u.lastIndexOf(o);f>-1&&(u=u.slice(0,f))}return u+n},Lr.unescape=function(e){return(e=ys(e))&&Y.test(e)?e.replace(V,pr):e},Lr.uniqueId=function(e){var t=++Ne;return ys(e)+t},Lr.upperCase=Xs,Lr.upperFirst=Ws,Lr.each=ya,Lr.eachRight=ba,Lr.first=Vo,al(Lr,(gl={},bn(Lr,(function(e,t){Fe.call(Lr.prototype,t)||(gl[t]=e)})),gl),{chain:!1}),Lr.VERSION="4.17.21",Et(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Lr[e].placeholder=Lr})),Et(["drop","take"],(function(e,t){zr.prototype[e]=function(r){r=r===i?1:mr(fs(r),0);var n=this.__filtered__&&!t?new zr(this):this.clone();return n.__filtered__?n.__takeCount__=gr(r,n.__takeCount__):n.__views__.push({size:gr(r,f),type:e+(n.__dir__<0?"Right":"")}),n},zr.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),Et(["filter","map","takeWhile"],(function(e,t){var r=t+1,n=1==r||3==r;zr.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:r}),t.__filtered__=t.__filtered__||n,t}})),Et(["head","last"],(function(e,t){var r="take"+(t?"Right":"");zr.prototype[e]=function(){return this[r](1).value()[0]}})),Et(["initial","tail"],(function(e,t){var r="drop"+(t?"":"Right");zr.prototype[e]=function(){return this.__filtered__?new zr(this):this[r](1)}})),zr.prototype.compact=function(){return this.filter(rl)},zr.prototype.find=function(e){return this.filter(e).head()},zr.prototype.findLast=function(e){return this.reverse().find(e)},zr.prototype.invokeMap=Yn((function(e,t){return"function"==typeof e?new zr(this):this.map((function(r){return Cn(r,e,t)}))})),zr.prototype.reject=function(e){return this.filter(Na(oo(e)))},zr.prototype.slice=function(e,t){e=fs(e);var r=this;return r.__filtered__&&(e>0||t<0)?new zr(r):(e<0?r=r.takeRight(-e):e&&(r=r.drop(e)),t!==i&&(r=(t=fs(t))<0?r.dropRight(-t):r.take(t-e)),r)},zr.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},zr.prototype.toArray=function(){return this.take(f)},bn(zr.prototype,(function(e,t){var r=/^(?:filter|find|map|reject)|While$/.test(t),n=/^(?:head|last)$/.test(t),o=Lr[n?"take"+("last"==t?"Right":""):t],a=n||/^find/.test(t);o&&(Lr.prototype[t]=function(){var t=this.__wrapped__,s=n?[1]:arguments,l=t instanceof zr,u=s[0],c=l||Ga(t),d=function(e){var t=o.apply(Lr,Dt([e],s));return n&&p?t[0]:t};c&&r&&"function"==typeof u&&1!=u.length&&(l=c=!1);var p=this.__chain__,f=!!this.__actions__.length,h=a&&!p,m=l&&!f;if(!a&&c){t=m?t:new zr(this);var g=e.apply(t,s);return g.__actions__.push({func:pa,args:[d],thisArg:i}),new $r(g,p)}return h&&m?e.apply(this,s):(g=this.thru(d),h?n?g.value()[0]:g.value():g)})})),Et(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ce[e],r=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",n=/^(?:pop|shift)$/.test(e);Lr.prototype[e]=function(){var e=arguments;if(n&&!this.__chain__){var i=this.value();return t.apply(Ga(i)?i:[],e)}return this[r]((function(r){return t.apply(Ga(r)?r:[],e)}))}})),bn(zr.prototype,(function(e,t){var r=Lr[t];if(r){var n=r.name+"";Fe.call(Cr,n)||(Cr[n]=[]),Cr[n].push({name:t,func:r})}})),Cr[Li(i,2).name]=[{name:"wrapper",func:i}],zr.prototype.clone=function(){var e=new zr(this.__wrapped__);return e.__actions__=Oi(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Oi(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Oi(this.__views__),e},zr.prototype.reverse=function(){if(this.__filtered__){var e=new zr(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},zr.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,r=Ga(e),n=t<0,i=r?e.length:0,o=function(e,t,r){for(var n=-1,i=r.length;++n<i;){var o=r[n],a=o.size;switch(o.type){case"drop":e+=a;break;case"dropRight":t-=a;break;case"take":t=gr(t,e+a);break;case"takeRight":e=mr(e,t-a)}}return{start:e,end:t}}(0,i,this.__views__),a=o.start,s=o.end,l=s-a,u=n?s:a-1,c=this.__iteratees__,d=c.length,p=0,f=gr(l,this.__takeCount__);if(!r||!n&&i==l&&f==l)return di(e,this.__actions__);var h=[];e:for(;l--&&p<f;){for(var m=-1,g=e[u+=t];++m<d;){var y=c[m],b=y.iteratee,v=y.type,_=b(g);if(2==v)g=_;else if(!_){if(1==v)continue e;break e}}h[p++]=g}return h},Lr.prototype.at=fa,Lr.prototype.chain=function(){return da(this)},Lr.prototype.commit=function(){return new $r(this.value(),this.__chain__)},Lr.prototype.next=function(){this.__values__===i&&(this.__values__=ds(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Lr.prototype.plant=function(e){for(var t,r=this;r instanceof qr;){var n=ko(r);n.__index__=0,n.__values__=i,t?o.__wrapped__=n:t=n;var o=n;r=r.__wrapped__}return o.__wrapped__=e,t},Lr.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof zr){var t=e;return this.__actions__.length&&(t=new zr(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Jo],thisArg:i}),new $r(t,this.__chain__)}return this.thru(Jo)},Lr.prototype.toJSON=Lr.prototype.valueOf=Lr.prototype.value=function(){return di(this.__wrapped__,this.__actions__)},Lr.prototype.first=Lr.prototype.head,We&&(Lr.prototype[We]=function(){return this}),Lr}();dt._=fr,(n=function(){return fr}.call(t,r,t,e))===i||(e.exports=n)}.call(this)},4495:(e,t,r)=>{var n=r(8942);e.exports=function(){return n.Date.now()}},4772:e=>{e.exports=function(){return!1}},7331:(e,t,r)=>{var n=r(2784),i=r(1580);e.exports=function(e,t,r){var o=!0,a=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return i(r)&&(o="leading"in r?!!r.leading:o,a="trailing"in r?!!r.trailing:a),n(e,t,{leading:o,maxWait:t,trailing:a})}},6131:(e,t,r)=>{var n=r(6403),i=r(1580),o=r(1187),a=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,l=/^0o[0-7]+$/i,u=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(o(e))return NaN;if(i(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=i(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=n(e);var r=s.test(e);return r||l.test(e)?u(e.slice(2),r?2:8):a.test(e)?NaN:+e}},6603:(e,t,r)=>{r.r(t),r.d(t,{DOMException:()=>A,Headers:()=>c,Request:()=>y,Response:()=>v,fetch:()=>w});var n="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||void 0!==r.g&&r.g||{},i={searchParams:"URLSearchParams"in n,iterable:"Symbol"in n&&"iterator"in Symbol,blob:"FileReader"in n&&"Blob"in n&&function(){try{return new Blob,!0}catch(e){return!1}}(),formData:"FormData"in n,arrayBuffer:"ArrayBuffer"in n};if(i.arrayBuffer)var o=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],a=ArrayBuffer.isView||function(e){return e&&o.indexOf(Object.prototype.toString.call(e))>-1};function s(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||""===e)throw new TypeError('Invalid character in header field name: "'+e+'"');return e.toLowerCase()}function l(e){return"string"!=typeof e&&(e=String(e)),e}function u(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return i.iterable&&(t[Symbol.iterator]=function(){return t}),t}function c(e){this.map={},e instanceof c?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){if(2!=e.length)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+e.length);this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function d(e){if(!e._noBody)return e.bodyUsed?Promise.reject(new TypeError("Already read")):void(e.bodyUsed=!0)}function p(e){return new Promise((function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}}))}function f(e){var t=new FileReader,r=p(t);return t.readAsArrayBuffer(e),r}function h(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function m(){return this.bodyUsed=!1,this._initBody=function(e){var t;this.bodyUsed=this.bodyUsed,this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:i.blob&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:i.formData&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:i.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():i.arrayBuffer&&i.blob&&(t=e)&&DataView.prototype.isPrototypeOf(t)?(this._bodyArrayBuffer=h(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):i.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(e)||a(e))?this._bodyArrayBuffer=h(e):this._bodyText=e=Object.prototype.toString.call(e):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):i.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i.blob&&(this.blob=function(){var e=d(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))}),this.arrayBuffer=function(){if(this._bodyArrayBuffer)return d(this)||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer));if(i.blob)return this.blob().then(f);throw new Error("could not read as ArrayBuffer")},this.text=function(){var e,t,r,n,i,o=d(this);if(o)return o;if(this._bodyBlob)return e=this._bodyBlob,r=p(t=new FileReader),i=(n=/charset=([A-Za-z0-9_-]+)/.exec(e.type))?n[1]:"utf-8",t.readAsText(e,i),r;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),r=new Array(t.length),n=0;n<t.length;n++)r[n]=String.fromCharCode(t[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},i.formData&&(this.formData=function(){return this.text().then(b)}),this.json=function(){return this.text().then(JSON.parse)},this}c.prototype.append=function(e,t){e=s(e),t=l(t);var r=this.map[e];this.map[e]=r?r+", "+t:t},c.prototype.delete=function(e){delete this.map[s(e)]},c.prototype.get=function(e){return e=s(e),this.has(e)?this.map[e]:null},c.prototype.has=function(e){return this.map.hasOwnProperty(s(e))},c.prototype.set=function(e,t){this.map[s(e)]=l(t)},c.prototype.forEach=function(e,t){for(var r in this.map)this.map.hasOwnProperty(r)&&e.call(t,this.map[r],r,this)},c.prototype.keys=function(){var e=[];return this.forEach((function(t,r){e.push(r)})),u(e)},c.prototype.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),u(e)},c.prototype.entries=function(){var e=[];return this.forEach((function(t,r){e.push([r,t])})),u(e)},i.iterable&&(c.prototype[Symbol.iterator]=c.prototype.entries);var g=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function y(e,t){if(!(this instanceof y))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');var r,i,o=(t=t||{}).body;if(e instanceof y){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new c(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,o||null==e._bodyInit||(o=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",!t.headers&&this.headers||(this.headers=new c(t.headers)),this.method=(i=(r=t.method||this.method||"GET").toUpperCase(),g.indexOf(i)>-1?i:r),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal||function(){if("AbortController"in n)return(new AbortController).signal}(),this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&o)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(o),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==t.cache&&"no-cache"!==t.cache)){var a=/([?&])_=[^&]*/;a.test(this.url)?this.url=this.url.replace(a,"$1_="+(new Date).getTime()):this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}function b(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var r=e.split("="),n=r.shift().replace(/\+/g," "),i=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(n),decodeURIComponent(i))}})),t}function v(e,t){if(!(this instanceof v))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=void 0===t.statusText?"":""+t.statusText,this.headers=new c(t.headers),this.url=t.url||"",this._initBody(e)}y.prototype.clone=function(){return new y(this,{body:this._bodyInit})},m.call(y.prototype),m.call(v.prototype),v.prototype.clone=function(){return new v(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new c(this.headers),url:this.url})},v.error=function(){var e=new v(null,{status:200,statusText:""});return e.ok=!1,e.status=0,e.type="error",e};var _=[301,302,303,307,308];v.redirect=function(e,t){if(-1===_.indexOf(t))throw new RangeError("Invalid status code");return new v(null,{status:t,headers:{location:e}})};var A=n.DOMException;try{new A}catch(e){(A=function(e,t){this.message=e,this.name=t;var r=Error(e);this.stack=r.stack}).prototype=Object.create(Error.prototype),A.prototype.constructor=A}function w(e,t){return new Promise((function(r,o){var a=new y(e,t);if(a.signal&&a.signal.aborted)return o(new A("Aborted","AbortError"));var u=new XMLHttpRequest;function d(){u.abort()}if(u.onload=function(){var e,t,n={statusText:u.statusText,headers:(e=u.getAllResponseHeaders()||"",t=new c,e.replace(/\r?\n[\t ]+/g," ").split("\r").map((function(e){return 0===e.indexOf("\n")?e.substr(1,e.length):e})).forEach((function(e){var r=e.split(":"),n=r.shift().trim();if(n){var i=r.join(":").trim();try{t.append(n,i)}catch(e){console.warn("Response "+e.message)}}})),t)};0===a.url.indexOf("file://")&&(u.status<200||u.status>599)?n.status=200:n.status=u.status,n.url="responseURL"in u?u.responseURL:n.headers.get("X-Request-URL");var i="response"in u?u.response:u.responseText;setTimeout((function(){r(new v(i,n))}),0)},u.onerror=function(){setTimeout((function(){o(new TypeError("Network request failed"))}),0)},u.ontimeout=function(){setTimeout((function(){o(new TypeError("Network request timed out"))}),0)},u.onabort=function(){setTimeout((function(){o(new A("Aborted","AbortError"))}),0)},u.open(a.method,function(e){try{return""===e&&n.location.href?n.location.href:e}catch(t){return e}}(a.url),!0),"include"===a.credentials?u.withCredentials=!0:"omit"===a.credentials&&(u.withCredentials=!1),"responseType"in u&&(i.blob?u.responseType="blob":i.arrayBuffer&&(u.responseType="arraybuffer")),t&&"object"==typeof t.headers&&!(t.headers instanceof c||n.Headers&&t.headers instanceof n.Headers)){var p=[];Object.getOwnPropertyNames(t.headers).forEach((function(e){p.push(s(e)),u.setRequestHeader(e,l(t.headers[e]))})),a.headers.forEach((function(e,t){-1===p.indexOf(t)&&u.setRequestHeader(t,e)}))}else a.headers.forEach((function(e,t){u.setRequestHeader(t,e)}));a.signal&&(a.signal.addEventListener("abort",d),u.onreadystatechange=function(){4===u.readyState&&a.signal.removeEventListener("abort",d)}),u.send(void 0===a._bodyInit?null:a._bodyInit)}))}w.polyfill=!0,n.fetch||(n.fetch=w,n.Headers=c,n.Request=y,n.Response=v)},7262:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ConnectionDoesNotExistOnProject=void 0;class r extends Error{constructor(e){super(e),this.name="ConnectionDoesNotExistOnProject"}}t.ConnectionDoesNotExistOnProject=r},6537:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DashboardQuotaReached=void 0;class r extends Error{constructor(e){super(e),this.name="DashboardQuotaReached"}}t.DashboardQuotaReached=r},2315:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FailedToCreateDashboard=void 0;class r extends Error{constructor(e){super(e),this.name="FailedToCreateDashboard"}}t.FailedToCreateDashboard=r},4365:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FailedToCreateGlobalLibrary=void 0;class r extends Error{constructor(e){super(e),this.name="FailedToCreateGlobalLibrary"}}t.FailedToCreateGlobalLibrary=r},3482:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FailedToCreateQueryEngineUser=void 0;class r extends Error{constructor(e){super(e),this.name="FailedToCreateQueryEngineUser"}}t.FailedToCreateQueryEngineUser=r},8912:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FailedToDecryptDashboardBeforeClient=void 0;class r extends Error{constructor(){super("Vizzly offers dashboard encryption to keep your dashboard configurations secure.\nPlease ensure your Vizzly Query Engine is still setup to manage encrypted dashboards."),this.name="FailedToDecryptDashboardBeforeClient"}}t.FailedToDecryptDashboardBeforeClient=r},9235:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FailedToFetchConnection=void 0;class r extends Error{constructor(e){super(e),this.name="FailedToFetchConnection"}}t.FailedToFetchConnection=r},4979:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FailedToFetchDashboardAccessTokens=void 0;class r extends Error{constructor(e){super(e),this.name="FailedToFetchDashboardAccessTokens"}}t.FailedToFetchDashboardAccessTokens=r},5186:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FailedToFetchDashboards=void 0;class r extends Error{constructor(e){super(e),this.name="FailedToFetchDashboards"}}t.FailedToFetchDashboards=r},3749:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FailedToFetchGlobalLibraryAccessTokens=void 0;class r extends Error{constructor(e){super(e),this.name="FailedToFetchGlobalLibraryAccessTokens"}}t.FailedToFetchGlobalLibraryAccessTokens=r},2994:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FailedToFetchProject=void 0;class r extends Error{constructor(e){super(e),this.name="FailedToFetchProject"}}t.FailedToFetchProject=r},6689:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FailedToFetchProjects=void 0;class r extends Error{constructor(e){super(e),this.name="FailedToFetchProjects"}}t.FailedToFetchProjects=r},5654:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FailedToFetchQueryEngineUser=void 0;class r extends Error{constructor(e){super(e),this.name="FailedToFetchQueryEngineUser"}}t.FailedToFetchQueryEngineUser=r},3551:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FailedToFetchTeamMembers=void 0;class r extends Error{constructor(e){super(e),this.name="FailedToFetchTeamMembers"}}t.FailedToFetchTeamMembers=r},4455:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FailedToFetchVizzlyConfig=void 0;class r extends Error{constructor(e){super(e),this.name="FailedToFetchVizzlyConfig"}}t.FailedToFetchVizzlyConfig=r},3394:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FailedToResolveDataSets=void 0;class r extends Error{constructor(e){super(e),this.name="FailedToResolveDataSets"}}t.FailedToResolveDataSets=r},8108:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FailedToSaveProjectEncryptedEncryptionSecret=void 0;class r extends Error{constructor(e){super(`Failed to save project encrypted encryption secret for ${e}`),this.name="FailedToSaveProjectEncryptedEncryptionSecret"}}t.FailedToSaveProjectEncryptedEncryptionSecret=r},2309:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FailedToSetupProject=void 0;class r extends Error{constructor(e){super(e),this.name="FailedToSetupProject"}}t.FailedToSetupProject=r},2680:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FailedToUpdateDashboard=void 0;class r extends Error{constructor(e){super(e),this.name="FailedToUpdateDashboard"}}t.FailedToUpdateDashboard=r},2258:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FailedToUpdateGlobalLibrary=void 0;class r extends Error{constructor(e){super(e),this.name="FailedToUpdateGlobalLibrary"}}t.FailedToUpdateGlobalLibrary=r},2325:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FailedToUpdateQueryEngineUser=void 0;class r extends Error{constructor(e){super(e),this.name="FailedToUpdateQueryEngineUser"}}t.FailedToUpdateQueryEngineUser=r},7634:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MissingAuthParameter=void 0;class r extends Error{constructor(e){super(`Missing required auth parameter ${e}`)}}t.MissingAuthParameter=r},642:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRequiredVizzlyQueryEngineApi=void 0;class r extends Error{}t.MissingRequiredVizzlyQueryEngineApi=r},9635:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ProjectEncryptedSecretAlreadySaved=void 0;class r extends Error{constructor(e){super(`Project encrypted encryption secret already exists for ${e}`),this.name="ProjectEncryptedSecretAlreadySaved"}}t.ProjectEncryptedSecretAlreadySaved=r},6081:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SQLPreviewError=void 0;const n=r(9040);class i extends n.ValidationError{constructor(e){super(e),this.name="SQLPreviewError"}}t.SQLPreviewError=i},9040:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ValidationError=void 0;class r extends Error{constructor(e){super(e),this.name="ValidationError"}}t.ValidationError=r},9979:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(6537),t),i(r(2315),t),i(r(4979),t),i(r(5186),t),i(r(7634),t),i(r(642),t),i(r(9040),t),i(r(6081),t),i(r(2309),t),i(r(3394),t),i(r(4365),t),i(r(8912),t),i(r(2680),t),i(r(4455),t),i(r(7262),t),i(r(9235),t),i(r(2994),t),i(r(6689),t),i(r(3551),t),i(r(3482),t),i(r(5654),t),i(r(9635),t),i(r(8108),t)},4843:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)},a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.Errors=void 0,o(r(2890),t),o(r(5512),t),o(r(7855),t),o(r(4640),t),o(r(9800),t),o(r(1171),t),o(r(7783),t),o(r(7807),t),o(r(2474),t),t.Errors=a(r(9979))},3806:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Api=void 0;const o=i(r(3493)),a=r(3052),s=r(7783),l=r(7807);t.Api=class{constructor(e,t,r=(()=>({}))){this.host=t,this.extraHeaders=r,this.auth=e}execute(e){return n(this,void 0,void 0,(function*(){var t,n;const i=this.auth.buildAuthHeaders(e.acceptedAuthParams),u=Object.assign(Object.assign({},e.headers||{}),this.extraHeaders()||{}),c=l.Path.buildPath(this.host,e.path),d=a.Monitor.timeRequest(e.method,c,o.default),p=yield d(c,{method:e.method,headers:Object.assign(Object.assign({"Content-Type":"application/json",Accept:"application/json","Vizzly-User-Agent":`${s.VizzlyApiClientLogger.UserAgentProduct}${this.originApp()} (Using client ${null===(t=r(9034))||void 0===t?void 0:t.version})`},i),u),redirect:"follow",referrerPolicy:"no-referrer",body:e.body?JSON.stringify(e.body):null,signal:e.abortSignal});let f=(null===(n=p.headers.get("content-type"))||void 0===n?void 0:n.includes("json"))?yield p.json():p.text();const h=p.headers.get("vizzly-query-engine-request-id")||"-",m=p.headers.get("x-request-id")||"-";return 500===p.status&&console.log(`[TRACING] QE; ${h} - API; ${m}`,i),s.VizzlyApiClientLogger.debug(`[TRACING] QE; ${h} - API; ${m}`),{body:f,status:p.status,headers:p.headers}}))}originApp(){if("undefined"==typeof window||!window.document){const e="",t=process.env.VIZZLY_ORIGIN_APP||e||"";return""==t?"":` (${t})`}return""}getAuth(){return this.auth}}},9800:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Authentication=void 0;const n=r(5250),i=r(7634);t.Authentication=class{constructor(e){this.authParams=e}updateAuthParams(e){this.authParams=Object.assign(Object.assign({},this.authParams),e)}clearAuthParams(){this.authParams={}}getQueryEngineAccessToken(){if(!this.authParams.queryEngineAccessToken)throw new i.MissingAuthParameter("queryEngineAccessToken");return this.authParams.queryEngineAccessToken}getProjectAdminOverrideToken(){return this.authParams.projectAdminOverrideToken}getDashboardAccessToken(){if(!this.authParams.dashboardAccessToken)throw new i.MissingAuthParameter("dashboardAccessToken");return this.authParams.dashboardAccessToken}getAppSessionToken(){return this.authParams.appSessionToken}getDataAccessToken(){if(!this.authParams.dataAccessToken)throw new i.MissingAuthParameter("dataAccessToken");return this.authParams.dataAccessToken}getProjectApiKey(){if(!this.authParams.projectApiKey)throw new i.MissingAuthParameter("projectApiKey");return this.authParams.projectApiKey}getProjectAccessToken(){if(!this.authParams.projectAccessToken)throw new i.MissingAuthParameter("projectAccessToken");return this.authParams.projectAccessToken}buildAuthHeaders(e){let t=e?(0,n.pick)(this.authParams,e):this.authParams;return t.dashboardAccessToken?{auth:`Bearer ${t.dashboardAccessToken}`}:t.projectAccessToken?{auth:`Bearer ${t.projectAccessToken}`}:t.projectApiKey?{auth:`Api-Key ${t.projectApiKey}`}:t.appSessionToken?{auth:`Bearer ${t.appSessionToken}`}:{}}}},8607:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.DashboardManager=void 0;const i=r(5250),o=r(4968);class a{constructor(e){this.vizzly=e}create(e){return n(this,void 0,void 0,(function*(){const t=this.vizzly.getDashboardRepository();return yield t.createDashboard(e)}))}update(e){return n(this,void 0,void 0,(function*(){var t,r,a;const s=this.vizzly.getDashboardRepository(),l=this.vizzly.getGlobalLibraryRepository(),[{global_libraries:u,permissions:c},{dashboards:d,permissions:p}]=yield Promise.all([l.fetchGlobalLibraries(e),s.fetchDashboards(e)]),f=d.find((t=>t.id===e.dashboardId));if(!f)throw new Error("Cannot find dashboard to update.");const{parentGlobalLibraries:h,childGlobalLibraries:m}=o.GlobalLibraryRepository.splitParentAndChildGlobalLibraries(u),g=p.find((t=>"read_write"===t.scope&&t.dashboardId===e.dashboardId));if(!g)throw new Error("Failed to find update token for dashboard.");const y=yield s.updateDashboard(Object.assign(Object.assign({},e),{dashboardPermission:g}));let b=[];(null===(t=e.definition)||void 0===t?void 0:t.componentLibrary)&&(b=(0,i.cloneDeep)(e.definition.componentLibrary||[]).filter((e=>!(null!==f.parent_dashboard_id&&e.attributes.protectedByOrganisation))));const v=null===f.parent_dashboard_id?h:m,_=null===f.parent_dashboard_id,A=b.length>0||!!(null===(r=e.definition)||void 0===r?void 0:r.customFields),w=u.find((e=>null===e.parent_global_library_id));!_&&w&&A&&0===v.length&&(yield l.createGlobalLibrary({library:{views:b,customFields:(null===(a=e.definition)||void 0===a?void 0:a.customFields)||{}},parentGlobalLibraryId:w.id,permissions:[{scope:"read_write"}]}));const S=v.map((t=>n(this,void 0,void 0,(function*(){var r;const n=c.find((e=>e.globalLibraryId===t.id&&"read_write"===e.scope));n||console.log("No write permission"),n&&(yield l.updateGlobalLibrary({globalLibrarySessionToken:n.token,library:{views:b,customFields:(null===(r=e.definition)||void 0===r?void 0:r.customFields)||{}}}))}))));return yield Promise.all(S),y}))}getDashboards(e){return n(this,void 0,void 0,(function*(){const t=this.vizzly.getDashboardRepository(),r=this.vizzly.getGlobalLibraryRepository(),[{dashboards:n},{global_libraries:i}]=yield Promise.all([t.fetchDashboards(e),r.fetchGlobalLibraries(e)]);return a.mergeDashboardsAndGlobalLibraries(n,i)}))}static mergeDashboardsAndGlobalLibraries(e,t){return(0,i.cloneDeep)(e).map((r=>{let n=(0,i.cloneDeep)(r.definition.componentLibrary),s=null===r.parent_dashboard_id?[]:e.find((e=>e.id===r.parent_dashboard_id)).definition.componentLibrary,{parentGlobalLibraries:l,childGlobalLibraries:u}=o.GlobalLibraryRepository.splitParentAndChildGlobalLibraries(t);u=null===r.parent_dashboard_id?[]:u;let c=(0,i.uniqBy)([...a.markViewsAsProtected(l.flatMap((e=>e.library.views||[]))),...u.flatMap((e=>e.library.views||[])),...a.markViewsAsProtected(s),...null===r.parent_dashboard_id?a.markViewsAsProtected(n):n||[]],(e=>e.attributes.viewId));return r.definition.componentLibrary=c,r.definition.customFields=a.mergeCustomFields(r,e,l,u),r}))}static mergeCustomFields(e,t,r,n){var o;const a=null===e.parent_dashboard_id?{}:(null===(o=t.find((t=>t.id===e.parent_dashboard_id)))||void 0===o?void 0:o.definition.customFields)||{};return((...e)=>e.reduce(((e,t)=>(Object.keys(e||{}).forEach((r=>{t[r]||(t[r]=[]),t[r]=(0,i.uniqBy)([...t[r],...(null==e?void 0:e[r])||[]],(e=>e.id))})),t)),{}))((0,i.cloneDeep)(e.definition.customFields)||{},(0,i.cloneDeep)(a)||{},...(0,i.cloneDeep)(n).map((e=>e.library.customFields||{})),...(0,i.cloneDeep)(r).map((e=>e.library.customFields||{})))}static markViewsAsProtected(e){return(e||[]).map((e=>Object.assign(Object.assign({},e),{attributes:Object.assign(Object.assign({},e.attributes),{protectedByOrganisation:!0})})))}}t.DashboardManager=a},178:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.DashboardRepository=void 0;const i=r(6537),o=r(2315),a=r(8912),s=r(4979),l=r(2680),u=r(2975),c=r(8328);class d{constructor(e){this.vizzly=e,this.repo=new c.Repository("id")}createDashboard(e){return n(this,void 0,void 0,(function*(){let t;if(this.vizzly.implementationStrategy.shouldPersistViaQueryEngine()){const r=this.vizzly.getVizzlyQueryEngineAPI();t=yield r.execute(r.buildCreateDashboardRequest(e))}else{const r=this.vizzly.getVizzlyAPI();t=yield r.execute(r.buildCreateDashboardRequest(e))}if(200===t.status){const e=t.body.permissions.map(u.Permission.formatDashboardPermission),r=d.embellishDashboardFromAPI(t.body.dashboard,e);return this.repo.addItem(r,e),{dashboard:r,permissions:e}}if(422===t.status)throw new i.DashboardQuotaReached(`Dashboard quota reached; ${JSON.stringify(t.body)}`);if(200!=t.status)throw console.log(),new o.FailedToCreateDashboard(`Failed to create the dashboard from POST /api/v2/dashboard. Got ${t.status}`);throw new o.FailedToCreateDashboard(`Unknown failure. Got status ${t.status}`)}))}updateDashboard(e){return n(this,void 0,void 0,(function*(){let t;if(this.vizzly.implementationStrategy.shouldPersistViaQueryEngine()){const r=this.vizzly.getVizzlyQueryEngineAPI();t=yield r.execute(r.buildUpdateDashboardRequest(e))}else{const r=this.vizzly.getVizzlyAPI();t=yield r.execute(r.buildUpdateDashboardRequest(e))}if(200===t.status){const r=d.embellishDashboardFromAPI(t.body.dashboard,[e.dashboardPermission]);return this.repo.updateItem(r),r}throw new l.FailedToUpdateDashboard(`Failed to update dashboard, got status ${t.status}`)}))}fetchDashboards(e){return n(this,void 0,void 0,(function*(){return yield this.fetchDashboardAccessTokens(e)}))}static embellishDashboardFromAPI(e,t){return Object.assign(Object.assign({},e),{permission:d.takeHighestPermission(e.id,t)})}static takeHighestPermission(e,t){const r=d.takePermissionsOfScope(e,t,"read");return d.takePermissionsOfScope(e,t,"read_write")[0]||r[0]}static takePermissionsOfScope(e,t,r){return t.filter((t=>t.dashboardId===e&&t.scope===r))}fetchDashboardAccessTokens(e){return n(this,void 0,void 0,(function*(){let t;if(!this.repo.isPopulated()){if(this.vizzly.implementationStrategy.shouldPersistViaQueryEngine()){const r=this.vizzly.getVizzlyQueryEngineAPI();t=yield r.execute(r.buildFetchDashboardAccessTokensRequest(e))}else{const r=this.vizzly.getVizzlyAPI();t=yield r.execute(r.buildFetchDashboardAccessTokensRequest(e))}if(200!==t.status)throw new s.FailedToFetchDashboardAccessTokens("Failed to fetch dashboard access tokens.");{const e=t.body.permissions.map(u.Permission.formatDashboardPermission),r=t.body.dashboards.map((t=>{if("string"==typeof t.definition)throw new a.FailedToDecryptDashboardBeforeClient;return d.embellishDashboardFromAPI(t,e)}));this.repo.initRepo(r,e)}}return{dashboards:this.repo.getRepo().storedItems,permissions:this.repo.getRepo().permissions}}))}clearRepo(){this.repo.clear()}}t.DashboardRepository=d},5465:function(e,t){var r=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.GlobalLibraryManager=void 0,t.GlobalLibraryManager=class{constructor(e){this.vizzly=e}create(e){return r(this,void 0,void 0,(function*(){const t=this.vizzly.getGlobalLibraryRepository();return yield t.createGlobalLibrary(e)}))}update(e){return r(this,void 0,void 0,(function*(){const t=this.vizzly.getGlobalLibraryRepository(),{global_libraries:r,permissions:n}=yield t.fetchGlobalLibraries(e);if(!r.find((t=>t.id===e.globalLibraryId)))throw new Error("Global library not found");const i=n.find((t=>t.globalLibraryId===e.globalLibraryId&&"read_write"===t.scope));if(!i)throw new Error("No write permission for this library");return yield t.updateGlobalLibrary({globalLibrarySessionToken:i.token,library:e.library})}))}getGlobalLibraries(e){return r(this,void 0,void 0,(function*(){const t=this.vizzly.getGlobalLibraryRepository();return yield t.fetchGlobalLibraries(e)}))}}},4968:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.GlobalLibraryRepository=void 0;const i=r(5250),o=r(2975),a=r(3749),s=r(8328),l=r(2258);class u{constructor(e){this.vizzly=e,this.repo=new s.Repository("id")}createGlobalLibrary(e){return n(this,void 0,void 0,(function*(){const t=this.vizzly.getVizzlyAPI();let r;if(this.vizzly.implementationStrategy.shouldPersistViaQueryEngine()){const t=this.vizzly.getVizzlyQueryEngineAPI();r=yield t.createGlobalLibrary(e)}else r=yield t.createGlobalLibrary(e);return r.global_library=u.upcast(r.global_library),this.repo.addItem(r.global_library,r.permissions),r}))}fetchGlobalLibraries(e){return n(this,void 0,void 0,(function*(){return yield this.fetchGlobalLibraryAccessTokens(e)}))}fetchGlobalLibraryAccessTokens(e){return n(this,void 0,void 0,(function*(){const t=this.vizzly.getVizzlyAPI();let r;if(!this.repo.isPopulated()){if(this.vizzly.implementationStrategy.shouldPersistViaQueryEngine()){const t=this.vizzly.getVizzlyQueryEngineAPI();r=yield t.fetchGlobalLibraryAccessTokens(e)}else r=yield t.fetchGlobalLibraryAccessTokens(e);if(200!==r.status)throw new a.FailedToFetchGlobalLibraryAccessTokens("Failed to load access tokens for the global library.");{const e=r.body.permissions.map(o.Permission.formatGlobalLibraryPermission);this.repo.initRepo(r.body.global_libraries.map(u.upcast),e)}}return{global_libraries:this.repo.getRepo().storedItems,permissions:this.repo.getRepo().permissions}}))}updateGlobalLibrary(e){return n(this,void 0,void 0,(function*(){let t;const r=this.vizzly.getVizzlyAPI();if(this.vizzly.implementationStrategy.shouldPersistViaQueryEngine()){const r=this.vizzly.getVizzlyQueryEngineAPI();t=yield r.updateGlobalLibrary(e)}else t=yield r.updateGlobalLibrary(e);if(200!=t.status)throw new l.FailedToUpdateGlobalLibrary(`Failed to update the global library ${t.status}`);const n=u.upcast(t.body.global_library);return this.repo.updateItem(n),n}))}getChildGlobalLibrariesByParentGlobalLibraryId(e){return n(this,void 0,void 0,(function*(){const{global_libraries:t}=yield this.fetchGlobalLibraries();return u.mapParentToChildGlobalLibraries(t)[e]||[]}))}static splitParentAndChildGlobalLibraries(e){let t=[],r=[];return e.forEach((e=>{null===e.parent_global_library_id?r=[...r,e]:t=[...t,e]})),{childGlobalLibraries:t,parentGlobalLibraries:r}}static mapParentToChildGlobalLibraries(e){let t={};return(0,i.cloneDeep)(e).forEach((e=>{null!==e.parent_global_library_id&&(t[e.parent_global_library_id]||(t[e.parent_global_library_id]=[]),t[e.parent_global_library_id]=[...t[e.parent_global_library_id],e])})),t}static upcast(e){return Object.assign(Object.assign({},e),{library:Object.assign({views:[],customFields:{}},e.library||{})})}}t.GlobalLibraryRepository=u},1171:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PersistDirectToVizzlyApi=t.PersistViaQueryEngine=t.ImplementationStrategy=void 0;class r{}t.ImplementationStrategy=r,t.PersistViaQueryEngine=class extends r{shouldPersistViaQueryEngine(){return!0}},t.PersistDirectToVizzlyApi=class extends r{shouldPersistViaQueryEngine(){return!1}}},3052:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.Monitor=void 0;const i=r(7783);t.Monitor=class{static timeRequest(e,t,r){return function(...o){return n(this,void 0,void 0,(function*(){const n=performance.now(),a=yield r(...o),s=performance.now()-n;return i.VizzlyApiClientLogger.debug(`[@vizzly/api-client timing] ${e.toUpperCase()} ${t} - ${s.toFixed(2)}ms`),a}))}}}},7807:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Path=void 0;class r{static removeAnyWrappingForwardSlash(e){return e.startsWith("/")?r.removeAnyWrappingForwardSlash(e.slice(1)):e.endsWith("/")?r.removeAnyWrappingForwardSlash(e.slice(0,-1)):e}static baseIsValid(e){return e.startsWith("https://")||e.startsWith("http://")||e.startsWith(".")}static buildPath(e,t){const n=r.removeAnyWrappingForwardSlash(e),i=r.removeAnyWrappingForwardSlash(t),o=r.baseIsValid(e)?"":"/";return""==n&&""==i?"/":""==i?`${o}${n}`:""!=n&&""!=i?`${o}${n}/${i}`:`${o}${i}`}static addQueryParam(e,t,r){const[n,i]=e.split("#"),[o,a]=n.split("?");var s=new URLSearchParams(a);return s.set(t,r),o+"?"+s.toString()+(i?`#${i}`:"")}static hasHashtag(e){return e.includes("#")}static setVizzlyHashtagValue(e,t){return`${e}#vizzly_${t}`}static getVizzlyHashtagValue(e){return e.split("#vizzly_")[1]||null}}t.Path=r},2975:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Permission=void 0,t.Permission=class{static formatDashboardPermission(e){return{userReference:e.user_reference,scope:e.scope,token:e.token,dashboardId:e.dashboard_id}}static formatGlobalLibraryPermission(e){return{userReference:e.user_reference,scope:e.scope,token:e.token,globalLibraryId:e.global_library_id}}static validateJwtExpiry(e,t=10){try{const[r,n,i]=e.split("."),o=Buffer.from(n,"base64").toString("utf-8"),a=JSON.parse(o).exp;return!(a<Math.floor(Date.now()/1e3)+t)}catch(e){return!1}}}},8328:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Repository=void 0;const n=r(5250),i=r(2975);t.Repository=class{constructor(e){this.itemKey=e,this.storedItems=[],this.permissions=[]}getRepo(){return{storedItems:this.storedItems,permissions:this.permissions}}initRepo(e,t){this.storedItems=e,this.permissions=t}addItem(e,t){this.isPopulated()&&(this.storedItems=[...this.storedItems,e],this.permissions=[...this.permissions,...t])}updateItem(e){this.storedItems=this.storedItems.map((t=>t[this.itemKey]==e[this.itemKey]?e:t))}isPopulated(){return(this.storedItems.length>0||this.permissions.length>0)&&this.permissionsAreFresh()}permissionsAreFresh(){return(0,n.every)(this.permissions,(e=>i.Permission.validateJwtExpiry(e.token)))}clear(){this.storedItems=[],this.permissions=[]}}},2890:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Vizzly=void 0;const n=r(642),i=r(178),o=r(4968),a=r(8607),s=r(5465);t.Vizzly=class{constructor(e,t){this.APIs=e,this.implementationStrategy=t,this.dashboardManager=new a.DashboardManager(this),this.dashboardRepository=new i.DashboardRepository(this),this.globalLibraryRepository=new o.GlobalLibraryRepository(this),this.globalLibraryManager=new s.GlobalLibraryManager(this)}getAPIs(){if(this.implementationStrategy.shouldPersistViaQueryEngine()&&!this.APIs.vizzlyQueryEngineApi)throw new n.MissingRequiredVizzlyQueryEngineApi("Strategy is to persist via a query engine. However no query engine API was provided.");return this.APIs}getVizzlyAppApi(){return this.getAPIs().vizzlyAppApi}getVizzlyQueryEngineAPI(){return this.getAPIs().vizzlyQueryEngineApi}getVizzlyAPI(){return this.getAPIs().vizzlyApi}getDashboardRepository(){return this.dashboardRepository}getGlobalLibraryRepository(){return this.globalLibraryRepository}getDashboardManager(){return this.dashboardManager}getGlobalLibraryManager(){return this.globalLibraryManager}}},5512:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.VizzlyApi=void 0;const i=r(3806),o=r(9979),a=r(4455),s=r(7262),l=r(9235),u=r(2994),c=r(2325),d=r(8108),p=r(9635);class f extends i.Api{constructor(e,t="https://api.vizzly.co"){super(e,t)}buildFetchDashboardAccessTokensRequest(e){return{path:"/api/v2/auth/dashboards/access",method:"post",body:{dashboardAccessToken:this.auth.getDashboardAccessToken(),projectAdminOverrideToken:this.auth.getProjectAdminOverrideToken()},abortSignal:null==e?void 0:e.abortSignal}}fetchGlobalLibraries(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildFetchGlobalLibrariesRequest(e))}))}buildFetchGlobalLibrariesRequest(e){return{path:"/api/v2/multi-get-global-library",method:"post",body:{globalLibraryAccessTokens:e.globalLibraryAccessTokens},abortSignal:e.abortSignal}}fetchGlobalLibraryAccessTokens(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildFetchGlobalLibraryAccessTokensRequest(e))}))}buildFetchGlobalLibraryAccessTokensRequest(e){return{path:"/api/v2/auth/global-library/access",method:"post",body:{dashboardAccessToken:this.auth.getDashboardAccessToken(),projectAdminOverrideToken:this.auth.getProjectAdminOverrideToken()},abortSignal:null==e?void 0:e.abortSignal}}buildCreateDashboardRequest(e){return{path:"/api/v2/dashboard",method:"post",body:{dashboardAccessToken:this.auth.getDashboardAccessToken(),definition:e.definition,meta:e.metadata||e.meta||{},parentDashboardId:e.parentDashboardId,permissions:e.permissions},abortSignal:e.abortSignal}}buildFetchDashboardsRequest(e){return{path:"/api/v2/multi-get-dashboard",method:"post",body:{dashboardAccessTokens:e.dashboardSessionAccessTokens},abortSignal:e.abortSignal}}createParentDashboard(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildCreateParentDashboardRequest(e))}))}buildCreateParentDashboardRequest(e){return{path:"/api/v2/parent-dashboard",method:"post",body:{projectId:e.projectId,definition:e.definition},abortSignal:e.abortSignal}}createParentGlobalLibrary(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildCreateParentGlobalLibraryRequest(e))}))}buildCreateParentGlobalLibraryRequest(e){return{path:"/api/v2/parent-global-library",method:"post",body:{projectId:e.projectId,library:e.library},abortSignal:e.abortSignal}}createGlobalLibrary(e){return n(this,void 0,void 0,(function*(){const t=yield this.execute(this.buildCreateGlobalLibraryRequest(e));if(200===t.status)return t.body;throw new o.FailedToCreateGlobalLibrary("Failed to create global library")}))}buildCreateGlobalLibraryRequest(e){return{path:"/api/v2/global-library",method:"post",body:{dashboardAccessToken:this.auth.getDashboardAccessToken(),parentGlobalLibraryId:e.parentGlobalLibraryId,library:e.library,permissions:e.permissions},abortSignal:e.abortSignal}}getProjects(e){return n(this,void 0,void 0,(function*(){const t=yield this.execute(this.buildGetProjectsRequest(e));if(200===t.status)return{projects:t.body.projects};throw new o.FailedToFetchProjects(`Failed to fetch projects. Got status ${t.status}`)}))}buildGetProjectsRequest(e){return{path:"/api/v2/projects",method:"get",abortSignal:null==e?void 0:e.abortSignal}}createProjectApiKey(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildCreateProjectApiKeyRequest(e))}))}buildCreateProjectApiKeyRequest(e){return{path:`/api/v3/project/${e.projectId}/api-key`,method:"post",body:{},abortSignal:e.abortSignal}}createQueryEngineUser(e){return n(this,void 0,void 0,(function*(){const t=yield this.execute(this.buildCreateQueryEngineUserRequest(e));if(200===t.status)return t.body.query_engine_user;throw new o.FailedToCreateQueryEngineUser(`Failed to create query engine user. Got status ${t.status}`)}))}buildCreateQueryEngineUserRequest(e){return{path:`/api/v3/project/${e.projectId}/query-engine-user`,method:"post",body:{email:e.email,password:e.password},abortSignal:e.abortSignal}}buildCreateSelfHostedDynamicQueryEngineProjectRequest(e){return{path:"/api/v2/project/self-hosted-dynamic-query-engine",method:"post",body:{},abortSignal:null==e?void 0:e.abortSignal}}buildCreateSelfHostedInBrowserProjectRequest(e){return{path:"/api/v2/project/self-hosted-in-browser",method:"post",body:{},abortSignal:null==e?void 0:e.abortSignal}}buildCreateSelfHostedProjectRequest(e){return{path:"/api/v2/project/self-hosted-query-engine",method:"post",body:{},abortSignal:null==e?void 0:e.abortSignal}}createManagedQueryEngineProject(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildCreateManagedQueryEngineProjectRequest(e))}))}buildCreateManagedQueryEngineProjectRequest(e){return{path:"/api/v2/project/managed-query-engine",method:"post",body:{parent_dashboard_definition:{}},abortSignal:null==e?void 0:e.abortSignal}}createVizzlyConfigVersion(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildCreateVizzlyConfigVersionRequest(e))}))}buildCreateVizzlyConfigVersionRequest(e){return{path:`/api/v3/project/${e.projectId}/config`,method:"post",body:{projectId:e.projectId,encryptedConfig:e.encryptedConfig},abortSignal:e.abortSignal}}duplicateParentDashboard(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildDuplicateParentDashboardRequest(e))}))}buildDuplicateParentDashboardRequest(e){return{path:"/api/v2/duplicate-parent-dashboard",method:"post",body:{dashboardId:e.dashboardId},abortSignal:e.abortSignal}}getConnection(e){return n(this,void 0,void 0,(function*(){const t=yield this.execute(this.buildGetConnectionRequest(e));if(200===t.status)return{encryptedCredentials:t.body.encrypted_credentials};if(404==t.status)throw new s.ConnectionDoesNotExistOnProject("An active connection does not exist on the project");throw new l.FailedToFetchConnection(`Failed to fetch connection for the project. Got status ${t.status}`)}))}buildGetConnectionRequest(e){return{path:`/api/v2/project/${e.projectId}/connection`,method:"get",abortSignal:e.abortSignal,acceptedAuthParams:["projectApiKey","projectAccessToken"]}}getManagedQueryEngineKeyPair(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildGetManagedQueryEngineKeyPairRequest(e))}))}buildGetManagedQueryEngineKeyPairRequest(e){return{path:`/api/v2/project/managed-query-engine/${e.managedProjectId}/key-pairs/${e.keyPairId}`,method:"get",abortSignal:e.abortSignal}}getProject(e){return n(this,void 0,void 0,(function*(){const t=yield this.execute(this.buildGetProjectRequest(e));if(200===t.status)return t.body;throw new u.FailedToFetchProject(`Failed to fetch project. Got status ${t.status}`)}))}buildGetProjectRequest(e){return{path:`/api/v3/project/${e.projectId}`,method:"get",abortSignal:e.abortSignal,acceptedAuthParams:["projectApiKey","projectAccessToken"]}}getProjectAccessToken(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildGetProjectAccessTokenRequest(e))}))}buildGetProjectAccessTokenRequest(e){let t="";return e.resourceFilters&&(t=`filter=${e.resourceFilters.join(",")}`),{path:`/api/v2/auth/project/${e.projectId}/access_token?${t}`,method:"get",abortSignal:e.abortSignal,acceptedAuthParams:["projectApiKey","appSessionToken"]}}getQueryEngineUser(e){return n(this,void 0,void 0,(function*(){const t=yield this.execute(this.buildGetQueryEngineUserRequest(e));if(200===t.status)return t.body.query_engine_user;throw new o.FailedToFetchQueryEngineUser(`Failed to fetch query engine user. Got status ${t.status}`)}))}buildGetQueryEngineUserRequest(e){return{path:`/api/v3/project/${e.projectId}/query-engine-user?email=${encodeURIComponent(e.email)}`,method:"get",abortSignal:e.abortSignal,acceptedAuthParams:["projectApiKey","projectAccessToken"]}}getTeamMembers(e){return n(this,void 0,void 0,(function*(){const t=yield this.execute(this.buildGetTeamMembersRequest(e));if(200===t.status)return t.body;throw new o.FailedToFetchTeamMembers(`Failed to fetch team members. Got status ${t.status}`)}))}buildGetTeamMembersRequest(e){return{path:`/api/v3/project/${e.projectId}/organisation-team-members`,method:"get",abortSignal:e.abortSignal,acceptedAuthParams:["projectApiKey","projectAccessToken"]}}getVizzlyConfig(e){return n(this,void 0,void 0,(function*(){const t=yield this.execute(this.buildGetVizzlyConfigRequest(e));if(200===t.status)return{encryptedConfig:t.body.encrypted_config};throw new a.FailedToFetchVizzlyConfig(`Failed to fetch the config containing data sets from the Vizzly API. Got status ${t.status}`)}))}buildGetVizzlyConfigRequest(e){return{path:`/api/v3/project/${e.projectId}/config`,method:"get",abortSignal:e.abortSignal,acceptedAuthParams:["projectApiKey","projectAccessToken"]}}saveConnection(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildSaveConnectionRequest(e))}))}buildSaveConnectionRequest(e){return{path:"/api/v3/project/connection",method:"post",body:{projectId:e.projectId,encryptedConfig:e.encryptedConfig,encryptedConnection:e.encryptedConnection},abortSignal:e.abortSignal,acceptedAuthParams:["projectApiKey","projectAccessToken"]}}saveEncryptedProjectEncryptionSecret(e){return n(this,void 0,void 0,(function*(){const t=yield this.execute(this.buildSaveEncryptedProjectEncryptionSecretRequest(e));if(200===t.status)return!0;if(400==t.status&&!e.allowRotation)throw new p.ProjectEncryptedSecretAlreadySaved(e.projectId);throw new d.FailedToSaveProjectEncryptedEncryptionSecret(e.projectId)}))}buildSaveEncryptedProjectEncryptionSecretRequest(e){return{path:`/api/v3/project/${e.projectId}/encrypted-encryption-secret`,method:"post",body:{projectId:e.projectId,encryptedEncryptionSecret:e.encryptedProjectEncryptionSecret,allowRotation:e.allowRotation},abortSignal:e.abortSignal,acceptedAuthParams:["projectApiKey","projectAccessToken"]}}saveScheduledReport(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildSaveScheduledReportRequest(e))}))}buildSaveScheduledReportRequest(e){return{path:"/api/scheduled-report",method:"post",body:{cronSchedule:e.cronSchedule,dashboardAccessToken:this.auth.getDashboardAccessToken(),scheduledReportId:e.scheduledReportId},abortSignal:e.abortSignal}}updateDashboard(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildUpdateDashboardRequest(e))}))}buildUpdateDashboardRequest(e){return{path:"/api/v2/dashboard",method:"put",body:{dashboardSessionToken:e.dashboardPermission.token,definition:e.definition,meta:e.metadata||e.meta||{},deleted:e.deleted},abortSignal:e.abortSignal}}updateParentGlobalLibrary(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildUpdateParentGlobalLibraryRequest(e))}))}buildUpdateParentGlobalLibraryRequest(e){return{path:"/api/v2/parent-global-library",method:"put",body:{globalLibraryId:e.globalLibraryId,deleted:e.deleted,name:e.name},abortSignal:e.abortSignal}}updateGlobalLibrary(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildUpdateGlobalLibraryRequest(e))}))}buildUpdateGlobalLibraryRequest(e){return{path:"/api/v2/global-library",method:"put",body:{globalLibrarySessionToken:e.globalLibrarySessionToken,deleted:e.deleted,library:e.library},abortSignal:e.abortSignal}}updateProjectApiKey(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildUpdateProjectApiKeyRequest(e))}))}buildUpdateProjectApiKeyRequest(e){return{path:`/api/v3/project/${e.projectId}/api-key/${e.projectApiKeyId}`,method:"put",body:{disabled:e.disabled},abortSignal:e.abortSignal}}updateQueryEngineUser(e){return n(this,void 0,void 0,(function*(){const t=yield this.execute(this.buildUpdateQueryEngineUserRequest(e));if(200===t.status)return!0;throw new c.FailedToUpdateQueryEngineUser(`Failed to update query engine user. Got status ${t.status}`)}))}buildUpdateQueryEngineUserRequest(e){return{path:`/api/v3/project/${e.projectId}/query-engine-user`,method:"put",body:{query_engine_user_id:e.queryEngineUserId,password:e.password},abortSignal:e.abortSignal,acceptedAuthParams:["projectApiKey","projectAccessToken"]}}}t.VizzlyApi=f},7783:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.VizzlyApiClientLogger=void 0;class r{static setBackend(e){this.backend=e}static debug(...e){r.backend&&r.backend.debug(...e)}static info(...e){r.backend&&r.backend.info(...e)}static warning(...e){r.backend&&r.backend.warning(...e)}static error(...e){r.backend&&r.backend.error(...e)}}t.VizzlyApiClientLogger=r,r.UserAgentProduct="Vizzly-Api-Client"},7855:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.VizzlyAppApi=void 0;const i=r(3806);class o extends i.Api{constructor(e,t="https://app.vizzly.co"){super(e,t)}createCliAuthToken(){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildCreateCliAuthTokenRequest())}))}buildCreateCliAuthTokenRequest(){return{path:"/api/create-cli-auth-token",method:"post",body:{}}}createInstantDashboard(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildCreateInstantDashboardRequest(e))}))}buildCreateInstantDashboardRequest(e){return{path:"/api/v2/instant-dashboard",method:"post",body:{parent_dashboard_definition:e.definition}}}createProjectAdminOverrideAccessToken(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildCreateProjectAdminOverrideAccessTokenRequest(e))}))}buildCreateProjectAdminOverrideAccessTokenRequest(e){return{path:`/api/v2/project/${e.projectId}/admin-override`,method:"post",body:{}}}startEmailChange(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildStartEmailChangeRequest(e))}))}buildStartEmailChangeRequest(e){return{path:"/api/self/start-email-change",method:"post",body:{email:e.email}}}completeEmailChange(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildCompleteEmailChangeRequest(e))}))}buildCompleteEmailChangeRequest(e){return{path:"/api/self/complete-email-change",method:"post",body:{token:e.token}}}getManagedQueryEngineAccessTokens(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildGetManagedQueryEngineAccessTokensRequest(e))}))}buildGetManagedQueryEngineAccessTokensRequest(e){return{path:`/api/v2/managed-query-engine/${e.managedQueryEngineId}/identity`,method:"get"}}getParentDashboardMeta(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildGetParentDashboardMetaRequest(e))}))}buildGetParentDashboardMetaRequest(e){return{path:`/api/v2/parent-dashboard/${e.dashboardId}/stats`,method:"get"}}updateParentDashboard(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildUpdateParentDashboardRequest(e))}))}buildUpdateParentDashboardRequest(e){return{path:`/api/v2/parent-dashboard/${e.dashboardId}/stats`,method:"put",body:{name:e.name,definition:e.definition,meta:e.meta,deleted:e.deleted,webhookId:e.webhookId}}}getProjectMeta(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildGetProjectMetaRequest(e))}))}buildGetProjectMetaRequest(e){return{path:`/api/v2/project/${e.projectId}/meta`,method:"get"}}getSelf(){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildGetSelfRequest())}))}buildGetSelfRequest(){return{path:"/api/self",method:"get"}}getTeam(){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildGetTeamRequest())}))}buildGetTeamRequest(){return{path:"/api/team",method:"get"}}getWebhooks(){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildGetWebhooksRequest())}))}buildGetWebhooksRequest(){return{path:"/api/organisation/webhooks",method:"get"}}inviteTeamMember(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildInviteTeamMemberRequest(e))}))}buildInviteTeamMemberRequest(e){return{path:"/api/invite",method:"post",body:{email:e.email,first_name:e.firstName,last_name:e.lastName,department:e.department}}}inAppAcceptTeamMemberInvite(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildInAppAcceptTeamMemberInviteRequest(e))}))}buildInAppAcceptTeamMemberInviteRequest(e){return{path:"/api/invite/in-app-accept",method:"post",body:{team_member_id:e.teamMemberId}}}acceptTeamMemberInvite(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildAcceptTeamMemberInviteRequest(e))}))}buildAcceptTeamMemberInviteRequest(e){return{path:"/api/invite/accept",method:"post",body:{token:e.inviteToken}}}resendTeamMemberInvite(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildResendTeamMemberInviteRequest(e))}))}buildResendTeamMemberInviteRequest(e){return{path:"/api/invite/resend",method:"post",body:{team_member_id:e.teamMemberId}}}removeTeamMember(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildRemoveTeamMemberRequest(e))}))}buildRemoveTeamMemberRequest(e){return{path:"/api/invite/remove",method:"post",body:{team_member_id:e.teamMemberId}}}startSignIn(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildStartSignInRequest(e))}))}buildStartSignInRequest(e){return{path:"/api/start-sign-in",method:"post",body:{email:e.email}}}completeSignIn(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildCompleteSignInRequest(e))}))}buildCompleteSignInRequest(e){return{path:"/api/complete-sign-in",method:"post",body:{token:e.token}}}signUp(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildSignUpRequest(e))}))}buildSignUpRequest(e){return{path:"/api/complete-sign-in",method:"post",body:{email:e.email,organisation_title:e.organisationTitle,first_name:e.firstName,last_name:e.lastName,department:e.department}}}switchOrganisation(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildSwitchOrganisationRequest(e))}))}buildSwitchOrganisationRequest(e){return{path:"/api/team/switch",method:"post",body:{organisation_id:e.organisationId}}}toggleKeyPairDisabled(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildToggleKeyPairDisabledRequest(e))}))}buildToggleKeyPairDisabledRequest(e){return{path:"/api/organisation/key-pairs/toggle-disabled",method:"post",body:{key_pair_id:e.keyPairId,disabled:e.disabled}}}updateProject(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildUpdateProjectRequest(e))}))}buildUpdateProjectRequest(e){return{path:"/api/v2/project",method:"put",body:{project_id:e.projectId,deleted:e.deleted,name:e.name}}}uploadPublicKey(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildUploadPublicKeyRequest(e))}))}buildUploadPublicKeyRequest(e){return{path:"/api/v2/project/key-pair",method:"post",body:{public_key:e.publicKey,project_id:e.projectId}}}}t.VizzlyAppApi=o},4640:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.VizzlyQueryEngineApi=void 0;const i=r(3806),o=r(6081),a=r(3394),s=r(2309),l=r(9979);class u extends i.Api{constructor(e,t,r){super(e,t,r)}buildCreateDashboardRequest(e){return{path:"/api/v1/dashboard",method:"post",abortSignal:e.abortSignal,body:{dashboardAccessToken:this.auth.getDashboardAccessToken(),definition:e.definition,meta:e.metadata||e.meta||{},parentDashboardId:e.parentDashboardId,permissions:e.permissions}}}buildFetchDashboardAccessTokensRequest(e){return{path:"/api/v1/dashboard/access",method:"post",abortSignal:null==e?void 0:e.abortSignal,body:{dashboardAccessToken:this.auth.getDashboardAccessToken(),projectAdminOverrideToken:this.auth.getProjectAdminOverrideToken()}}}fetchGlobalLibraryAccessTokens(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildFetchGlobalLibraryAccessTokensRequest(e))}))}buildFetchGlobalLibraryAccessTokensRequest(e){return{path:"/api/v1/global-library/access",method:"post",abortSignal:null==e?void 0:e.abortSignal,body:{dashboardAccessToken:this.auth.getDashboardAccessToken(),projectAdminOverrideToken:this.auth.getProjectAdminOverrideToken()}}}buildFetchDashboardsRequest(e){return{path:"/api/v1/get-dashboards",method:"post",abortSignal:e.abortSignal,body:{dashboardAccessTokens:e.dashboardSessionAccessTokens}}}createConfigFromUpload(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildCreateConfigFromUploadRequest(e))}))}buildCreateConfigFromUploadRequest(e){return{path:"/api/v1/create-config-from-upload",method:"post",abortSignal:e.abortSignal,body:{queryEngineAccessToken:this.auth.getQueryEngineAccessToken(),table:e.table,fieldPublicNames:e.fieldPublicNames}}}createResults(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildCreateResultsRequest(e))}))}buildCreateResultsRequest(e){return{path:"/api/v1/create-results",method:"post",abortSignal:e.abortSignal,body:{queries:e.queries,virtualFields:{},identityConfigIntegritySignature:this.auth.getDataAccessToken()}}}createSqlPreview(e){return n(this,void 0,void 0,(function*(){var t;const r=yield this.execute(this.buildCreateSqlPreviewRequest(e));if(200===r.status)return r;throw new o.SQLPreviewError((null===(t=null==r?void 0:r.body)||void 0===t?void 0:t.message)||"Unknown SQL error")}))}buildCreateSqlPreviewRequest(e){return{path:"/api/v1/create-sql-preview",method:"post",abortSignal:e.abortSignal,body:{sql:e.sql,parameters:e.parameters,limit:e.limit}}}createQueryEngineUser(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildCreateQueryEngineUserRequest(e))}))}buildCreateQueryEngineUserRequest(e){return{path:"/api/v1/query-engine-user",method:"post",abortSignal:e.abortSignal,body:{email:e.email,password:e.password}}}fetchDataSets(e){return n(this,void 0,void 0,(function*(){const t=this.buildFetchDataSetsRequest(e),r=yield this.execute(t);if(200===r.status)return r;throw new a.FailedToResolveDataSets(`Failed to resolve data sets from ${t.path}. Received status ${r.status}`)}))}buildFetchDataSetsRequest(e){return{path:"/api/v1/resolve-data-sets",method:"post",abortSignal:null==e?void 0:e.abortSignal,body:{integritySignature:this.auth.getDataAccessToken()}}}fetchSelfHostedQueryEngineConfig(e){return n(this,void 0,void 0,(function*(){return this.execute(this.buildFetchSelfHostedQueryEngineConfigRequest(e))}))}buildFetchSelfHostedQueryEngineConfigRequest(e){return{path:"/api/v1/support",method:"post",abortSignal:null==e?void 0:e.abortSignal,body:{}}}fetchProject(e){return n(this,void 0,void 0,(function*(){return this.execute(this.buildFetchProjectRequest(e))}))}buildFetchProjectRequest(e){return{path:"/api/v1/project",method:"get",abortSignal:null==e?void 0:e.abortSignal,body:{}}}getStarted(e){return n(this,void 0,void 0,(function*(){const t=yield this.execute(this.buildGetStartedRequest(e));if(200!=t.status)throw new s.FailedToSetupProject("object"==typeof t.body&&t.body.reason&&"reason"in t.body?t.body.reason:"Failed to create the first user.");return t}))}buildGetStartedRequest(e){return{path:"/api/v2/get-started",method:"post",abortSignal:e.abortSignal,body:{email:e.email,password:e.password}}}getTeamMembers(e){return n(this,void 0,void 0,(function*(){return this.execute(this.buildGetTeamMembersRequest(e))}))}buildGetTeamMembersRequest(e){return{path:"/api/v1/team-members",method:"get",abortSignal:null==e?void 0:e.abortSignal}}isVizzly(e){return n(this,void 0,void 0,(function*(){return this.execute(this.buildIsVizzlyRequest(e))}))}buildIsVizzlyRequest(e){return{path:"/api/is-vizzly",method:"get",abortSignal:null==e?void 0:e.abortSignal}}saveConfig(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildSaveConfigRequest(e))}))}buildSaveConfigRequest(e){return{path:"/api/v1/save-config",method:"post",abortSignal:e.abortSignal,body:{config:e.config}}}saveConnection(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildSaveConnectionRequest(e))}))}buildSaveConnectionRequest(e){return{path:"/api/v1/save-connection",method:"post",abortSignal:e.abortSignal,body:{connection:e.connection,client:e.client}}}signInWithQueryEngineAccessToken(e){return n(this,void 0,void 0,(function*(){return this.execute(this.buildSignInWithQueryEngineAccessTokenRequest(e))}))}buildSignInWithQueryEngineAccessTokenRequest(e){return{path:"/api/v1/sign-in",method:"post",abortSignal:null==e?void 0:e.abortSignal,body:{}}}signInWithEmailAndPassword(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildSignInWithEmailAndPasswordRequest(e))}))}buildSignInWithEmailAndPasswordRequest(e){return{path:"/api/v1/sign-in",method:"post",abortSignal:e.abortSignal,body:{email:e.email,password:e.password}}}status(e){return n(this,void 0,void 0,(function*(){return this.execute(this.buildStatusRequest(e))}))}buildStatusRequest(e){return{path:"/api/status",method:"post",abortSignal:null==e?void 0:e.abortSignal,body:{}}}createGlobalLibrary(e){return n(this,void 0,void 0,(function*(){const t=yield this.execute(this.buildCreateGlobalLibraryRequest(e));if(200===t.status)return t.body;throw new l.FailedToCreateGlobalLibrary(`Failed to create a global library. Got status ${t.status}`)}))}buildCreateGlobalLibraryRequest(e){return{path:"/api/v1/global-library",method:"post",abortSignal:e.abortSignal,body:{dashboardAccessToken:this.auth.getDashboardAccessToken(),parentGlobalLibraryId:e.parentGlobalLibraryId,library:e.library,permissions:e.permissions}}}fetchGlobalLibraries(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildFetchGlobalLibrariesRequest(e))}))}buildFetchGlobalLibrariesRequest(e){return{path:"/api/v1/get-global-libraries",method:"post",abortSignal:e.abortSignal,body:{globalLibraryAccessTokens:e.globalLibraryAccessTokens}}}updateGlobalLibrary(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildUpdateGlobalLibraryRequest(e))}))}buildUpdateGlobalLibraryRequest(e){return{path:"/api/v1/global-library",method:"put",abortSignal:e.abortSignal,body:{globalLibrarySessionToken:e.globalLibrarySessionToken,deleted:e.deleted,library:e.library}}}updateDashboard(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildUpdateDashboardRequest(e))}))}buildUpdateDashboardRequest(e){return{path:"/api/v1/dashboard",method:"put",abortSignal:e.abortSignal,body:{dashboardSessionToken:e.dashboardPermission.token,definition:e.definition,meta:e.metadata||e.meta||{},deleted:e.deleted}}}updateQueryEngineUser(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildUpdateQueryEngineUserRequest(e))}))}buildUpdateQueryEngineUserRequest(e){return{path:"/api/v1/query-engine-user",method:"put",abortSignal:e.abortSignal,body:{queryEngineUserId:e.queryEngineUserId,password:e.password}}}uploadDataToVizzlyCloud(e){return n(this,void 0,void 0,(function*(){return yield this.execute(this.buildUploadDataToVizzlyCloudRequest(e))}))}buildUploadDataToVizzlyCloudRequest(e){return{path:"/api/v1/ingest",method:"post",abortSignal:e.abortSignal,body:{queryEngineAccessToken:this.auth.getQueryEngineAccessToken(),ingest:e.ingest}}}}t.VizzlyQueryEngineApi=u},2474:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(1741),t),i(r(2016),t),i(r(1048),t),i(r(9774),t)},1741:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},2016:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},1048:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},9774:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},9450:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.queryEngineConfig=void 0;const n=r(7513);t.queryEngineConfig=()=>({origin:"query-engine",supportedFeatures:["simpleMaths","aggregateMaths","subquery","configManagerUi","sqlDefinedDataSet","roundedNumbers","switchField","encryptedDashboards","sqlViews","dateMaths"],supportedTimeTruncFunctions:(0,n.supportedTimeTruncFunctions)(["month","year","quarter","week","day","hour","minute","second"]),supportedAggregates:(0,n.supportedAggregates)(["sum","mean","min","max","count","countDistinct"]),supportedOperators:(0,n.supportedOperators)([">","<","=","!=",">=","<=","is_one_of","is_not_one_of","starts_with","ends_with","contains_substring","does_not_contain_substring","array_contains"]),supportedTransformationFunctions:(0,n.supportedTransformationFunctions)(["round_to_0_dp","round_to_2_dp"])})},9667:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.supportedAggregatesConstants=t.timeDimensionsConstants=t.supportedOperatorsConstants=void 0,t.supportedOperatorsConstants={">":{publicName:"Greater than",validDataTypes:["number","date_time"]},"<":{publicName:"Less than",validDataTypes:["number","date_time"]},"<=":{publicName:"Less than or equal to",validDataTypes:["number","date_time"]},">=":{publicName:"Greater than or equal to",validDataTypes:["number","date_time"]},"!=":{publicName:"Not equal to",validDataTypes:["number","date_time","boolean","string"]},is_one_of:{publicName:"Is one of",validDataTypes:["number","date_time","boolean","string"]},"=":{publicName:"Equal to",validDataTypes:["number","date_time","boolean","string"]},is_not_one_of:{publicName:"Is not one of",validDataTypes:["number","date_time","boolean","string"]},starts_with:{publicName:"Starts with",validDataTypes:["string"]},ends_with:{publicName:"Ends with",validDataTypes:["string"]},contains_substring:{publicName:"Contains text",validDataTypes:["string"]},does_not_contain_substring:{publicName:"Does not contain text",validDataTypes:["string"]},array_contains:{publicName:"Contains",validDataTypes:["string[]"]}},t.timeDimensionsConstants={month:{publicName:"Monthly",dateFormat:"MMMM YYYY"},year:{publicName:"Yearly",dateFormat:"YYYY"},quarter:{publicName:"Per quarter",dateFormat:"quarter"},week:{publicName:"Weekly",dateFormat:"week"},day:{publicName:"Daily",dateFormat:"DD-MM-YYYY"},second:{publicName:"Per second",dateFormat:"hh:mm:ss"},hour:{publicName:"Hourly",dateFormat:"hh:mm"},minute:{publicName:"Per minute",dateFormat:"hh:mm"}},t.supportedAggregatesConstants={mean:{publicName:"Mean",validDataTypes:["number"]},sum:{publicName:"Sum",validDataTypes:["number"]},min:{publicName:"Min",validDataTypes:["number"]},max:{publicName:"Max",validDataTypes:["number"]},count:{publicName:"Count",validDataTypes:["string","number","boolean","date_time","string[]"]},countDistinct:{publicName:"Unique",validDataTypes:["string","number","boolean","date_time"]},median:{publicName:"Median",validDataTypes:["number"]},percentile25:{publicName:"25th percentile",validDataTypes:["number"]},percentile75:{publicName:"75th percentile",validDataTypes:["number"]},percentile90:{publicName:"90th percentile",validDataTypes:["number"]},percentile95:{publicName:"95th percentile",validDataTypes:["number"]},percentile99:{publicName:"99th percentile",validDataTypes:["number"]}}},6676:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.getQueryEngineConfig=void 0;const a=o(r(3543)),s=o(r(5133)),l=o(r(9450)),u=o(r(1047)),c=o(r(8590)),d=o(r(5226)),p=o(r(9488)),f=r(1594);t.getQueryEngineConfig=e=>{switch(e){case"js":return f.localQueryEngineConfig;case"postgres":return a.queryEngineConfig();case"redshift":return s.queryEngineConfig();case"bigquery":return l.queryEngineConfig();case"mariadb":return c.queryEngineConfig();case"snowflake":return d.queryEngineConfig();case"mysql":return p.queryEngineConfig();case"microsoftSQLServer":return u.queryEngineConfig();case"SQLite":throw"SQLite not support via the query engine"}}},8162:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)},a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.Support=t.Constants=void 0,o(r(6676),t),o(r(4002),t),t.Constants=a(r(9667)),t.Support=a(r(7513))},1594:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.localQueryEngineConfig=void 0;const n=r(7513);t.localQueryEngineConfig={origin:"in-browser",supportedFeatures:["simpleMaths","aggregateMaths","subquery","encryptedDashboards","switchField","roundedNumbers","encryptedDashboards","dateMaths"],supportedTimeTruncFunctions:(0,n.supportedTimeTruncFunctions)(["month","year","quarter","week","day","hour","minute","second"]),supportedAggregates:(0,n.supportedAggregates)(["sum","mean","min","max","count","countDistinct","median"]),supportedOperators:(0,n.supportedOperators)([">","<","=","!=",">=","<=","is_one_of","is_not_one_of","starts_with","ends_with","contains_substring","does_not_contain_substring","array_contains"]),supportedTransformationFunctions:(0,n.supportedTransformationFunctions)(["round_to_0_dp","round_to_2_dp"])}},8590:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.queryEngineConfig=void 0;const n=r(7513);t.queryEngineConfig=()=>({origin:"query-engine",supportedFeatures:["simpleMaths","subquery","configManagerUi","switchField","sqlDefinedDataSet","roundedNumbers","aggregateMaths","encryptedDashboards","sqlViews","dateMaths"],supportedTimeTruncFunctions:(0,n.supportedTimeTruncFunctions)(["month","year","day","hour","minute","second"]),supportedAggregates:(0,n.supportedAggregates)(["sum","mean","min","max","count","countDistinct"]),supportedOperators:(0,n.supportedOperators)([">","<","=","!=",">=","<=","is_one_of","is_not_one_of","starts_with","ends_with","contains_substring","does_not_contain_substring"]),supportedTransformationFunctions:(0,n.supportedTransformationFunctions)(["round_to_0_dp","round_to_2_dp"])})},4002:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.merge=void 0;const n=r(5250);t.merge=(...e)=>e.reduce(((e,t)=>{const r=r=>{let i=e[r],o=t[r];if("object"==typeof i&&"object"==typeof o){const e=(0,n.intersection)(Object.keys(i),Object.keys(o));return(0,n.pick)(t[r],e)}throw"Cannot intersect non-object type in mapIntersection function."};return{origin:"query-engine",supportedAggregates:r("supportedAggregates"),supportedFeatures:(0,n.intersection)(e.supportedFeatures,t.supportedFeatures),supportedOperators:r("supportedOperators"),supportedTimeTruncFunctions:r("supportedTimeTruncFunctions"),supportedTransformationFunctions:r("supportedTransformationFunctions")}}),e[0])},1047:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.queryEngineConfig=void 0;const n=r(7513);t.queryEngineConfig=()=>({origin:"query-engine",supportedFeatures:["simpleMaths","aggregateMaths","subquery","configManagerUi","switchField","roundedNumbers","sqlDefinedDataSet","encryptedDashboards","sqlViews","dateMaths"],supportedTimeTruncFunctions:(0,n.supportedTimeTruncFunctions)(["month","year","quarter","week","day","hour","minute","second"]),supportedAggregates:(0,n.supportedAggregates)(["sum","mean","min","max","count","countDistinct"]),supportedOperators:(0,n.supportedOperators)([">","<","=","!=",">=","<=","is_one_of","is_not_one_of","starts_with","ends_with","contains_substring","does_not_contain_substring","array_contains"]),supportedTransformationFunctions:(0,n.supportedTransformationFunctions)(["round_to_0_dp","round_to_2_dp"])})},9488:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.queryEngineConfig=void 0;const n=r(7513);t.queryEngineConfig=()=>({origin:"query-engine",supportedFeatures:["simpleMaths","subquery","configManagerUi","sqlDefinedDataSet","roundedNumbers","aggregateMaths","encryptedDashboards","sqlViews","dateMaths"],supportedTimeTruncFunctions:(0,n.supportedTimeTruncFunctions)(["month","year","day","hour","minute","second"]),supportedAggregates:(0,n.supportedAggregates)(["sum","mean","min","max","count","countDistinct"]),supportedOperators:(0,n.supportedOperators)([">","<","=","!=",">=","<=","is_one_of","is_not_one_of","starts_with","ends_with","contains_substring","does_not_contain_substring"]),supportedTransformationFunctions:(0,n.supportedTransformationFunctions)(["round_to_0_dp","round_to_2_dp"])})},3543:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.queryEngineConfig=void 0;const n=r(7513);t.queryEngineConfig=()=>({origin:"query-engine",supportedFeatures:["simpleMaths","aggregateMaths","subquery","configManagerUi","switchField","roundedNumbers","sqlDefinedDataSet","encryptedDashboards","sqlViews","dateMaths"],supportedTimeTruncFunctions:(0,n.supportedTimeTruncFunctions)(["month","year","quarter","week","day","hour","minute","second"]),supportedAggregates:(0,n.supportedAggregates)(["sum","mean","median","min","max","count","countDistinct","percentile25","percentile75","percentile90","percentile95","percentile99"]),supportedOperators:(0,n.supportedOperators)([">","<","=","!=",">=","<=","is_one_of","is_not_one_of","starts_with","ends_with","contains_substring","does_not_contain_substring","array_contains"]),supportedTransformationFunctions:(0,n.supportedTransformationFunctions)(["round_to_0_dp","round_to_2_dp"])})},5133:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.queryEngineConfig=void 0;const n=r(7513);t.queryEngineConfig=()=>({origin:"query-engine",supportedFeatures:["simpleMaths","aggregateMaths","subquery","configManagerUi","switchField","roundedNumbers","sqlDefinedDataSet","encryptedDashboards","sqlViews","dateMaths"],supportedTimeTruncFunctions:(0,n.supportedTimeTruncFunctions)(["month","year","quarter","week","day","hour","minute","second"]),supportedAggregates:(0,n.supportedAggregates)(["sum","mean","min","max","count","countDistinct"]),supportedOperators:(0,n.supportedOperators)([">","<","=","!=",">=","<=","is_one_of","is_not_one_of","starts_with","ends_with","contains_substring","does_not_contain_substring","array_contains"]),supportedTransformationFunctions:(0,n.supportedTransformationFunctions)(["round_to_0_dp","round_to_2_dp"])})},5226:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.queryEngineConfig=void 0;const n=r(7513);t.queryEngineConfig=()=>({origin:"query-engine",supportedFeatures:["simpleMaths","aggregateMaths","subquery","configManagerUi","sqlDefinedDataSet","roundedNumbers","switchField","encryptedDashboards","sqlViews","dateMaths"],supportedTimeTruncFunctions:(0,n.supportedTimeTruncFunctions)(["month","year","quarter","week","day","hour","minute","second"]),supportedAggregates:(0,n.supportedAggregates)(["sum","mean","median","min","max","count","countDistinct","percentile25","percentile75","percentile90","percentile95","percentile99"]),supportedOperators:(0,n.supportedOperators)([">","<","=","!=",">=","<=","is_one_of","is_not_one_of","starts_with","ends_with","contains_substring","does_not_contain_substring","array_contains"]),supportedTransformationFunctions:(0,n.supportedTransformationFunctions)(["round_to_0_dp","round_to_2_dp"])})},7513:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validOperatorsForField=t.ALL_SUPPORTED_CONSTANTS=t.isSupportedTimeTruncFunction=t.isSupportedAggregate=t.isSupportedAggregateFunction=t.supportedAggregates=t.supportedTimeTruncFunctions=t.supportedOperators=t.supportedAggregatesFunction=t.supportedTransformationFunctions=void 0;const n=r(5250),i=r(9667),o={round_to_0_dp:{publicName:"Round to 0dp",validDataTypes:["number"]},round_to_2_dp:{publicName:"Round to 2dp",validDataTypes:["number"]}};t.supportedTransformationFunctions=e=>{const t=(0,n.cloneDeep)(o);if(!e)return t;let r={};return e.forEach((e=>{if(!t[e])throw`Transformation function ${e} is not managed by Vizzly`;r[e]=t[e]})),r},t.supportedAggregatesFunction=(e,t,r)=>{const n=e.supportedAggregates,i=Object.keys(n).filter((e=>n[e].validDataTypes.includes(t)));let o=r&&r.length>0?r.filter((e=>i.includes(e))):i;return r&&r.length>0&&0===o.length&&(o=i),o},t.supportedOperators=e=>{const t=(0,n.cloneDeep)(i.supportedOperatorsConstants);if(!e)return t;let r={};return e.forEach((e=>{if(!i.supportedOperatorsConstants[e])throw`Operator ${e} not managed by Vizzly`;r[e]=i.supportedOperatorsConstants[e]})),r},t.supportedTimeTruncFunctions=e=>{const t=(0,n.cloneDeep)(i.timeDimensionsConstants);if(!e)return t;let r={};return e.forEach((e=>{if(!t[e])throw`Time trunc function ${e} not managed by Vizzly`;r[e]=t[e]})),r},t.supportedAggregates=e=>{const t=(0,n.cloneDeep)(i.supportedAggregatesConstants);if(!e)return t;let r={};return e.forEach((e=>{if(!t[e])throw`Aggregate ${e} not managed by Vizzly`;r[e]=t[e]})),r},t.isSupportedAggregateFunction=(e,t)=>[...Object.keys(e),"none"].includes(t),t.isSupportedAggregate=(e,t)=>"string"==typeof e&&t.hasOwnProperty(e),t.isSupportedTimeTruncFunction=(e,t)=>[...Object.keys(e),"none"].includes(t),t.ALL_SUPPORTED_CONSTANTS=[{namespace:"config.supported_operator",constants:i.supportedOperatorsConstants},{namespace:"config.supported_aggregate",constants:i.supportedAggregatesConstants},{namespace:"config.supported_time",constants:i.timeDimensionsConstants}],t.validOperatorsForField=(e,t)=>{let r=[...Object.keys(t.supportedOperators)];return r=r.filter((t=>i.supportedOperatorsConstants[t].validDataTypes.includes(e.dataType))),r}},4639:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ENVIRONMENT_VARIABLES_TO_REQUIRED=t.vizzlyToPossibleNativeDataTypes=t.NATIVE_DATA_TYPES=t.SUPPORTED_CLIENTS=void 0;const n=r(5250),i=r(6342);t.SUPPORTED_CLIENTS=["bigquery","mariadb","postgres","snowflake","mysql","microsoftSQLServer","redshift"];const o=e=>(0,n.reduce)(Object.keys(i.NATIVE_DATA_TYPES_DATABASE[e]),((e,t)=>Object.assign(Object.assign({},e),{[t]:t})),{});t.NATIVE_DATA_TYPES={mysql:o("mysql"),snowflake:o("snowflake"),postgres:o("postgres"),redshift:o("redshift"),mariadb:o("mariadb"),bigquery:o("bigquery"),microsoftSQLServer:o("microsoftSQLServer")},t.vizzlyToPossibleNativeDataTypes=(e,t)=>{let r=[];return Object.entries(i.NATIVE_DATA_TYPES_DATABASE[e]).forEach((([e,{normalizedType:n}])=>{n==t&&(r=[...r,e])})),r},t.ENVIRONMENT_VARIABLES_TO_REQUIRED={postgres:{VIZZLY_POSTGRES_PASSWORD:!0,VIZZLY_POSTGRES_DATABASE:!0,VIZZLY_POSTGRES_USER:!0,VIZZLY_POSTGRES_HOST:!0,VIZZLY_POSTGRES_PORT:!1},mariadb:{VIZZLY_MARIADB_PASSWORD:!0,VIZZLY_MARIADB_DATABASE:!0,VIZZLY_MARIADB_USER:!0,VIZZLY_MARIADB_HOST:!0,VIZZLY_MARIADB_PORT:!1},mysql:{VIZZLY_MYSQL_PASSWORD:!0,VIZZLY_MYSQL_DATABASE:!0,VIZZLY_MYSQL_USER:!0,VIZZLY_MYSQL_HOST:!0,VIZZLY_MYSQL_PORT:!1},elasticsearch:{VIZZLY_ELASTICSEARCH_CLOUD_ID:!0,VIZZLY_ELASTICSEARCH_API_KEY:!0,VIZZLY_ELASTICSEARCH_NODE:!0,VIZZLY_ELASTICSEARCH_USERNAME:!0,VIZZLY_ELASTICSEARCH_PASSWORD:!0,VIZZLY_ELASTICSEARCH_API_KEY_ID:!0},bigquery:{VIZZLY_BIGQUERY_PROJECT_ID:!0,VIZZLY_BIGQUERY_REGION:!0,VIZZLY_BIGQUERY_KEY_FILENAME:!1,VIZZLY_BIGQUERY_CREDENTIALS:!1},snowflake:{VIZZLY_SNOWFLAKE_PASSWORD:!0,VIZZLY_SNOWFLAKE_DATABASE:!1,VIZZLY_SNOWFLAKE_USERNAME:!0,VIZZLY_SNOWFLAKE_ACCOUNT:!0,VIZZLY_SNOWFLAKE_WAREHOUSE:!0,VIZZLY_SNOWFLAKE_ROLE:!0,VIZZLY_SNOWFLAKE_SCHEMA:!1,VIZZLY_SNOWFLAKE_SESSION_KEEP_ALIVE:!1},microsoftSQLServer:{VIZZLY_MICROSOFT_SQL_SERVER_PASSWORD:!0,VIZZLY_MICROSOFT_SQL_SERVER_DATABASE:!0,VIZZLY_MICROSOFT_SQL_SERVER_USER:!0,VIZZLY_MICROSOFT_SQL_SERVER_HOST:!0,VIZZLY_MICROSOFT_SQL_SERVER_PORT:!1}}},3342:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.validate=void 0;const i=n(r(746));t.validate=i.default},746:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ID_REGEX_ERROR_MESSAGE=t.ALLOWED_ID_REGEX=void 0;const i=n(r(4579)),o=r(6676),a=r(4639),s=r(7513),l=r(9667),u=r(8284),c=["unencryptedCredentials","encryptedCredentials"],d=Object.keys(l.supportedOperatorsConstants),p=["second","minute","hour","day","week","month","quarter","year"];t.ALLOWED_ID_REGEX=/^[a-zA-Z0-9_+:\/=\-\s]*$/,t.ID_REGEX_ERROR_MESSAGE="IDs must only use alpha numeric characters and _";const f={checkConnectionSpecificDataSets:!0},h={abortEarly:!1,allowUnknown:!0},m=e=>i.default.object({id:i.default.string().required().regex(t.ALLOWED_ID_REGEX,t.ID_REGEX_ERROR_MESSAGE).description("A unique identifier for this field. It should not change unless the meaning of the field, or the data type has changed."),publicName:i.default.string().optional().allow("").description("The name of this field that you want your users to see. This can be changed as much as you like without causing a breaking change."),address:i.default.array().items(i.default.string()).optional().description('The address of the column in your database. For example; ["database_name", "table_name", "column_name"] or for BigQuery; ["bigquery project id", "bigquery data set id", "table name", "column name"]'),description:i.default.string().allow("").optional().max(110).description("A description of what the purpose of this data set is"),sql:i.default.string().optional().description("Provide a SQL definition of the field, instead of a table & name combination."),dataType:i.default.valid(...Object.values(a.NATIVE_DATA_TYPES[e])).required(),canBeDimension:i.default.boolean().optional(),canBeMeasure:i.default.boolean().optional(),canBeUsedInSort:i.default.boolean().optional(),allowedGranularities:i.default.array().items(i.default.string().valid(...p)).optional(),allowedOperators:i.default.alternatives().conditional("..dataType",{is:i.default.string().valid(...(0,a.vizzlyToPossibleNativeDataTypes)(e,"string")),then:i.default.array().items(i.default.string().valid(...(0,s.validOperatorsForField)({dataType:"string"},(0,o.getQueryEngineConfig)(e)))).description("For fields that have a string data type.")}).conditional("..dataType",{is:i.default.string().valid(...(0,a.vizzlyToPossibleNativeDataTypes)(e,"number")),then:i.default.array().items(i.default.string().valid(...(0,s.validOperatorsForField)({dataType:"number"},(0,o.getQueryEngineConfig)(e)))).description("For fields that have a number data type.")}).conditional("..dataType",{is:i.default.string().valid(...(0,a.vizzlyToPossibleNativeDataTypes)(e,"date_time")),then:i.default.array().items(i.default.valid(...(0,s.validOperatorsForField)({dataType:"date_time"},(0,o.getQueryEngineConfig)(e)))).description("For fields that have a date time data type.")}).conditional("..dataType",{is:i.default.string().valid(...(0,a.vizzlyToPossibleNativeDataTypes)(e,"boolean")),then:i.default.array().items(i.default.string().valid(...(0,s.validOperatorsForField)({dataType:"boolean"},(0,o.getQueryEngineConfig)(e)))).description("For fields that have a boolean data type.")}).conditional("..dataType",{is:i.default.string().valid(...(0,a.vizzlyToPossibleNativeDataTypes)(e,"string[]")),then:i.default.array().items(i.default.string().valid(...(0,s.validOperatorsForField)({dataType:"string[]"},(0,o.getQueryEngineConfig)(e)))).description("For fields that have a string array data type.")}).optional()}),g=i.default.object({type:i.default.string().valid("rightJoin","leftJoin","innerJoin","outerJoin","leftOuterJoin","rightOuterJoin").required(),left:i.default.array().items(i.default.string()).required(),right:i.default.array().items(i.default.string()).required()}),y=i.default.object({fieldId:i.default.string().required(),op:i.default.string().valid(...d).required()}),b=e=>i.default.object(Object.assign(Object.assign({},(e=>({id:i.default.string().required().regex(t.ALLOWED_ID_REGEX,t.ID_REGEX_ERROR_MESSAGE).description("A unique ID for the data set. This should not change unless the meaning of the data set represents changes."),connectionId:i.default.string().required(),hide:i.default.boolean().optional().description("Hide the data set from the dashboard."),name:i.default.string().required().description("A public name for the data set. This can change as much as you like without causing a breaking change."),description:i.default.string().allow("").optional().max(110).description("A description of what this field represents"),sql:i.default.string().optional().description("Optionally define the data set using a SQL statement. If used, the `table` value for each field should equal `vizzly_data_set`."),testParameters:i.default.string().optional().description("Test parameters that are used when creating SQL backed data sets. This is a stringified JSON object."),preAggregated:i.default.alternatives(i.default.array().items(i.default.string()).description("Array of data set IDs relied on by the pre-aggregated data set"),i.default.boolean().allow(!1).description("Only `False` is a valid boolean option. For truthy values, provide an array of data set IDs")).optional().description("Optional - For pre-aggregated data sets or SQL views, provide a list of data sets that are relied upon."),fields:i.default.array().min(1).items(e).unique("id").message("Field IDs must be unique").required(),secureFilterGuards:i.default.array().items(y).optional()}))(e)),{joins:i.default.array().items(g).unique("right").message("A table cannot be referenced in a right join multiple times.").optional()})),v=e=>{var t;if(1===(null===(t=e.onlyClients)||void 0===t?void 0:t.length))return b(m(e.onlyClients[0]));const r=i.default.alternatives(...(e.onlyClients||a.SUPPORTED_CLIENTS).map((e=>b(m(e)))));if(e.dataSetIdToClientMapping){const t=Object.entries(e.dataSetIdToClientMapping).map((([e,t])=>({is:e,then:b(m(t))})));return i.default.alternatives().conditional(".id",[...t,{is:!0,then:r}])}return r};t.default=(e,t={})=>{const r=((e,t)=>i.default.object({version:i.default.number(),connections:i.default.object().pattern(i.default.string(),i.default.object({client:i.default.string().allow(...a.SUPPORTED_CLIENTS).required(),name:i.default.string().optional().allow(""),encryptedCredentials:i.default.string().optional(),unencryptedCredentials:i.default.alternatives(i.default.string(),i.default.object()).optional()})),dataSets:i.default.array().items(t.checkConnectionSpecificDataSets?i.default.object().custom((t=>{var r,n;const i=t.connectionId||"___vizzly_default_conn",o=null===(n=null===(r=null==e?void 0:e.connections)||void 0===r?void 0:r[i])||void 0===n?void 0:n.client;if(!o)throw new u.DataSetNotLinkedToConnection(t.id);const a=b(m(o)).validate(t,h);if(a.error)throw a.error;return t}),"Data sets linked to connections"):v(t)).unique("id").message("dataSet[x].id must be unique.").required(),executableDashboardConfigForPDF:i.default.string().allow(null).optional().description("JavaScript dashboard config for server-side generated PDFs"),publicKeys:i.default.array().items(i.default.string()).optional(),sqlViews:i.default.object().pattern(i.default.string(),i.default.object({name:i.default.string().required(),sql:i.default.string().allow("").required()})).optional()}))(e,Object.assign(Object.assign(Object.assign({},f),t),{dataSetIdToClientMapping:_(e)})).validate(e,h);return r.error&&r.error.details.map((e=>{var t,r;c.includes((null===(t=e.context)||void 0===t?void 0:t.key)||"")&&(null===(r=e.context)||void 0===r?void 0:r.value)&&(e.context.value="-- VIZZLY REDACTED --")})),r};const _=e=>{let t={};return e&&"object"==typeof(null==e?void 0:e.dataSets)&&"object"==typeof(null==e?void 0:e.connections)&&e.dataSets.forEach((r=>{var n,i;if(t){const o=r.connectionId||"___vizzly_default_conn",a=null===(i=null===(n=null==e?void 0:e.connections)||void 0===n?void 0:n[o])||void 0===i?void 0:i.client;a&&(t[r.id]=a)}})),t}},8284:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DataSetNotLinkedToConnection=void 0;class r extends Error{constructor(e){super(`Data set ${e} must be linked to a connection by setting a 'connectionId' property that references a connection in the 'connections' section.`),this.name="DataSetNotLinkedToConnection"}}t.DataSetNotLinkedToConnection=r},4893:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t},a=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.VizzlyConfig=t.QueryEngineConfig=void 0,t.QueryEngineConfig=o(r(8162)),t.VizzlyConfig=o(r(3342)),a(r(7076),t)},7076:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},6342:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.DATE_MATHS_OPERATORS=t.NORMALIZED_DATA_TYPES=void 0,i(r(3154),t),i(r(4795),t),t.NORMALIZED_DATA_TYPES=["number","boolean","string","date_time","string[]"],t.DATE_MATHS_OPERATORS=["seconds_between","minutes_between","hours_between","days_between"]},3154:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.NATIVE_DATA_TYPES_DATABASE=void 0,t.NATIVE_DATA_TYPES_DATABASE={microsoftSQLServer:{INT:{normalizedType:"number"},BIGINT:{normalizedType:"number"},NUMERIC:{normalizedType:"number"},BIT:{normalizedType:"number"},SMALLINT:{normalizedType:"number"},DECIMAL:{normalizedType:"number"},SMALLMONEY:{normalizedType:"number"},TINYINT:{normalizedType:"number"},MONEY:{normalizedType:"number"},FLOAT:{normalizedType:"number"},REAL:{normalizedType:"number"},DATE:{normalizedType:"date_time"},DATETIME2:{normalizedType:"date_time"},SMALLDATETIME:{normalizedType:"date_time"},DATETIME:{normalizedType:"date_time"},TIME:{normalizedType:"date_time"},CHAR:{normalizedType:"string"},VARCHAR:{normalizedType:"string"},TEXT:{normalizedType:"string",castAs:"VARCHAR(8000)"},NCHAR:{normalizedType:"string"},NVARCHAR:{normalizedType:"string"},NTEXT:{normalizedType:"string"},BINARY:{normalizedType:"string"},VARBINARY:{normalizedType:"string"}},bigquery:{INT64:{normalizedType:"number"},FLOAT64:{normalizedType:"number"},NUMERIC:{normalizedType:"number"},BIGNUMERIC:{normalizedType:"number"},STRING:{normalizedType:"string"},DATE:{normalizedType:"date_time"},DATETIME:{normalizedType:"date_time"},TIMESTAMP:{normalizedType:"date_time"},BOOL:{normalizedType:"boolean"},"ARRAY<STRING>":{normalizedType:"string[]"}},elasticsearch:{date_time:{normalizedType:"date_time"},number:{normalizedType:"number"},string:{normalizedType:"string"},boolean:{normalizedType:"boolean"}},mariadb:{TINYINT:{normalizedType:"number",castAs:"INT"},SMALLINT:{normalizedType:"number",castAs:"INT"},MEDIUMINT:{normalizedType:"number",castAs:"INT"},INT:{normalizedType:"number"},INTEGER:{normalizedType:"number",castAs:"INT"},BIGINT:{normalizedType:"number",castAs:"INT"},DECIMAL:{normalizedType:"number"},FLOAT:{normalizedType:"number"},DOUBLE:{normalizedType:"number"},VARCHAR:{normalizedType:"string",castAs:"CHAR"},TEXT:{normalizedType:"string",castAs:"CHAR"},TINYTEXT:{normalizedType:"string",castAs:"CHAR"},CHAR:{normalizedType:"string"},MEDIUMTEXT:{normalizedType:"string",castAs:"CHAR"},LONGTEXT:{normalizedType:"string",castAs:"CHAR"},DATE:{normalizedType:"date_time"},DATETIME:{normalizedType:"date_time"},TIMESTAMP:{normalizedType:"date_time",castAs:"DATETIME"},BOOLEAN:{normalizedType:"boolean",castAs:null},BOOL:{normalizedType:"boolean",castAs:null}},postgres:{JSONB:{normalizedType:"string"},UUID:{normalizedType:"string"},DECIMAL:{normalizedType:"number"},NUMERIC:{normalizedType:"number"},INT:{normalizedType:"number"},INTEGER:{normalizedType:"number"},BIGINT:{normalizedType:"number"},SMALLINT:{normalizedType:"number"},DOUBLEPRECISION:{normalizedType:"number",castAs:"DOUBLE PRECISION"},"DOUBLE PRECISION":{normalizedType:"number"},REAL:{normalizedType:"number"},FLOAT:{normalizedType:"number"},NUMBER:{normalizedType:"number"},BINARY:{normalizedType:"string"},VARBINARY:{normalizedType:"string"},CHAR:{normalizedType:"string"},CHARACTER:{normalizedType:"string"},"CHARACTER VARYING":{normalizedType:"string"},TEXT:{normalizedType:"string"},VARCHAR:{normalizedType:"string"},TIME:{normalizedType:"date_time"},DATE:{normalizedType:"date_time"},TIMESTAMP_LTZ:{normalizedType:"date_time"},TIMESTAMP_NTZ:{normalizedType:"date_time"},TIMESTAMP_TZ:{normalizedType:"date_time"},TIMESTAMP:{normalizedType:"date_time"},BOOLEAN:{normalizedType:"boolean"},"TIMESTAMP WITH TIME ZONE":{normalizedType:"date_time"},"TIMESTAMP WITHOUT TIME ZONE":{normalizedType:"date_time"},ARRAY:{normalizedType:"string[]"}},SQLite:{BOOLEAN:{normalizedType:"boolean"},NULL:{normalizedType:"string"},INTEGER:{normalizedType:"number"},REAL:{normalizedType:"number"},DECIMAL:{normalizedType:"number"},CHAR:{normalizedType:"string"},TEXT:{normalizedType:"string"},DATE:{normalizedType:"date_time"},TIMESTAMP:{normalizedType:"date_time"}},snowflake:{FIXED:{normalizedType:"number"},DECIMAL:{normalizedType:"number"},NUMERIC:{normalizedType:"number"},INT:{normalizedType:"number"},INTEGER:{normalizedType:"number"},BIGINT:{normalizedType:"number"},SMALLINT:{normalizedType:"number"},TINYINT:{normalizedType:"number"},BYTEINT:{normalizedType:"number"},FLOAT:{normalizedType:"number"},FLOAT4:{normalizedType:"number"},FLOAT8:{normalizedType:"number"},DOUBLE:{normalizedType:"number"},DOUBLEPRECISION:{normalizedType:"number",castAs:"DOUBLE PRECISION"},"DOUBLE PRECISION":{normalizedType:"number"},REAL:{normalizedType:"number"},NUMBER:{normalizedType:"number"},BINARY:{normalizedType:"string"},VARBINARY:{normalizedType:"string"},CHAR:{normalizedType:"string"},CHARACTER:{normalizedType:"string"},"CHARACTER VARYING":{normalizedType:"string"},TEXT:{normalizedType:"string"},VARCHAR:{normalizedType:"string"},STRING:{normalizedType:"string"},TIME:{normalizedType:"date_time"},DATE:{normalizedType:"date_time"},DATETIME:{normalizedType:"date_time"},TIMESTAMP_LTZ:{normalizedType:"date_time"},TIMESTAMP_NTZ:{normalizedType:"date_time"},TIMESTAMP_TZ:{normalizedType:"date_time"},TIMESTAMP:{normalizedType:"date_time"},BOOLEAN:{normalizedType:"boolean"},ARRAY:{normalizedType:"string[]"},VARIANT:{normalizedType:"string"}},mysql:{TINYINT:{normalizedType:"number",castAs:"SIGNED"},SMALLINT:{normalizedType:"number",castAs:"SIGNED"},MEDIUMINT:{normalizedType:"number",castAs:"SIGNED"},INT:{normalizedType:"number",castAs:"SIGNED"},INTEGER:{normalizedType:"number",castAs:"SIGNED"},BIGINT:{normalizedType:"number",castAs:"SIGNED"},DECIMAL:{normalizedType:"number",castAs:"DECIMAL(65, 10)"},FLOAT:{normalizedType:"number",castAs:"DECIMAL(65, 10)"},DOUBLE:{normalizedType:"number",castAs:"DECIMAL(65, 10)"},CHAR:{normalizedType:"string",castAs:"CHAR"},VARCHAR:{normalizedType:"string",castAs:"CHAR"},TEXT:{normalizedType:"string",castAs:"CHAR"},TINYTEXT:{normalizedType:"string",castAs:"CHAR"},MEDIUMTEXT:{normalizedType:"string",castAs:"CHAR"},LONGTEXT:{normalizedType:"string",castAs:"CHAR"},DATE:{normalizedType:"date_time"},DATETIME:{normalizedType:"date_time"},TIMESTAMP:{normalizedType:"date_time",castAs:"DATETIME"},BOOLEAN:{normalizedType:"boolean"},BOOL:{normalizedType:"boolean"}},redshift:{SUPER:{normalizedType:"string[]"},UUID:{normalizedType:"string"},DECIMAL:{normalizedType:"number"},NUMERIC:{normalizedType:"number"},INT:{normalizedType:"number"},INTEGER:{normalizedType:"number"},BIGINT:{normalizedType:"number"},SMALLINT:{normalizedType:"number"},DOUBLEPRECISION:{normalizedType:"number",castAs:"DOUBLE PRECISION"},"DOUBLE PRECISION":{normalizedType:"number"},REAL:{normalizedType:"number"},FLOAT:{normalizedType:"number"},NUMBER:{normalizedType:"number"},BINARY:{normalizedType:"string"},VARBINARY:{normalizedType:"string"},CHAR:{normalizedType:"string"},CHARACTER:{normalizedType:"string"},"CHARACTER VARYING":{normalizedType:"string"},TEXT:{normalizedType:"string"},VARCHAR:{normalizedType:"string"},TIME:{normalizedType:"date_time"},DATE:{normalizedType:"date_time"},TIMESTAMP_LTZ:{normalizedType:"date_time"},TIMESTAMP_NTZ:{normalizedType:"date_time"},TIMESTAMP_TZ:{normalizedType:"date_time"},TIMESTAMP:{normalizedType:"date_time"},BOOLEAN:{normalizedType:"boolean"},"TIMESTAMP WITH TIME ZONE":{normalizedType:"date_time"},"TIMESTAMP WITHOUT TIME ZONE":{normalizedType:"date_time"},ARRAY:{normalizedType:"string[]"}}}},4795:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},8143:function(e){e.exports=function(){for(var e=function(e,t,r){return void 0===t&&(t=0),void 0===r&&(r=1),e<t?t:e>r?r:e},t=e,r={},n=0,i=["Boolean","Number","String","Function","Array","Date","RegExp","Undefined","Null"];n<i.length;n+=1){var o=i[n];r["[object "+o+"]"]=o.toLowerCase()}var a=function(e){return r[Object.prototype.toString.call(e)]||"object"},s=a,l=a,u=Math.PI,c={clip_rgb:function(e){e._clipped=!1,e._unclipped=e.slice(0);for(var r=0;r<=3;r++)r<3?((e[r]<0||e[r]>255)&&(e._clipped=!0),e[r]=t(e[r],0,255)):3===r&&(e[r]=t(e[r],0,1));return e},limit:e,type:a,unpack:function(e,t){return void 0===t&&(t=null),e.length>=3?Array.prototype.slice.call(e):"object"==s(e[0])&&t?t.split("").filter((function(t){return void 0!==e[0][t]})).map((function(t){return e[0][t]})):e[0]},last:function(e){if(e.length<2)return null;var t=e.length-1;return"string"==l(e[t])?e[t].toLowerCase():null},PI:u,TWOPI:2*u,PITHIRD:u/3,DEG2RAD:u/180,RAD2DEG:180/u},d={format:{},autodetect:[]},p=c.last,f=c.clip_rgb,h=c.type,m=d,g=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var r=this;if("object"===h(e[0])&&e[0].constructor&&e[0].constructor===this.constructor)return e[0];var n=p(e),i=!1;if(!n){i=!0,m.sorted||(m.autodetect=m.autodetect.sort((function(e,t){return t.p-e.p})),m.sorted=!0);for(var o=0,a=m.autodetect;o<a.length;o+=1){var s=a[o];if(n=s.test.apply(s,e))break}}if(!m.format[n])throw new Error("unknown format: "+e);var l=m.format[n].apply(null,i?e:e.slice(0,-1));r._rgb=f(l),3===r._rgb.length&&r._rgb.push(1)};g.prototype.toString=function(){return"function"==h(this.hex)?this.hex():"["+this._rgb.join(",")+"]"};var y=g,b=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(b.Color,[null].concat(e)))};b.Color=y,b.version="2.4.2";var v=b,_=c.unpack,A=Math.max,w=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var r=_(e,"rgb"),n=r[0],i=r[1],o=r[2],a=1-A(n/=255,A(i/=255,o/=255)),s=a<1?1/(1-a):0;return[(1-n-a)*s,(1-i-a)*s,(1-o-a)*s,a]},S=c.unpack,T=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var r=(e=S(e,"cmyk"))[0],n=e[1],i=e[2],o=e[3],a=e.length>4?e[4]:1;return 1===o?[0,0,0,a]:[r>=1?0:255*(1-r)*(1-o),n>=1?0:255*(1-n)*(1-o),i>=1?0:255*(1-i)*(1-o),a]},E=v,O=y,x=d,C=c.unpack,I=c.type,j=w;O.prototype.cmyk=function(){return j(this._rgb)},E.cmyk=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(O,[null].concat(e,["cmyk"])))},x.format.cmyk=T,x.autodetect.push({p:2,test:function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];if(e=C(e,"cmyk"),"array"===I(e)&&4===e.length)return"cmyk"}});var R=c.unpack,D=c.last,F=function(e){return Math.round(100*e)/100},N=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var r=R(e,"hsla"),n=D(e)||"lsa";return r[0]=F(r[0]||0),r[1]=F(100*r[1])+"%",r[2]=F(100*r[2])+"%","hsla"===n||r.length>3&&r[3]<1?(r[3]=r.length>3?r[3]:1,n="hsla"):r.length=3,n+"("+r.join(",")+")"},P=c.unpack,M=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var r=(e=P(e,"rgba"))[0],n=e[1],i=e[2];r/=255,n/=255,i/=255;var o,a,s=Math.min(r,n,i),l=Math.max(r,n,i),u=(l+s)/2;return l===s?(o=0,a=Number.NaN):o=u<.5?(l-s)/(l+s):(l-s)/(2-l-s),r==l?a=(n-i)/(l-s):n==l?a=2+(i-r)/(l-s):i==l&&(a=4+(r-n)/(l-s)),(a*=60)<0&&(a+=360),e.length>3&&void 0!==e[3]?[a,o,u,e[3]]:[a,o,u]},L=c.unpack,k=c.last,q=N,$=M,z=Math.round,B=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var r=L(e,"rgba"),n=k(e)||"rgb";return"hsl"==n.substr(0,3)?q($(r),n):(r[0]=z(r[0]),r[1]=z(r[1]),r[2]=z(r[2]),("rgba"===n||r.length>3&&r[3]<1)&&(r[3]=r.length>3?r[3]:1,n="rgba"),n+"("+r.slice(0,"rgb"===n?3:4).join(",")+")")},G=c.unpack,U=Math.round,V=function(){for(var e,t=[],r=arguments.length;r--;)t[r]=arguments[r];var n,i,o,a=(t=G(t,"hsl"))[0],s=t[1],l=t[2];if(0===s)n=i=o=255*l;else{var u=[0,0,0],c=[0,0,0],d=l<.5?l*(1+s):l+s-l*s,p=2*l-d,f=a/360;u[0]=f+1/3,u[1]=f,u[2]=f-1/3;for(var h=0;h<3;h++)u[h]<0&&(u[h]+=1),u[h]>1&&(u[h]-=1),6*u[h]<1?c[h]=p+6*(d-p)*u[h]:2*u[h]<1?c[h]=d:3*u[h]<2?c[h]=p+(d-p)*(2/3-u[h])*6:c[h]=p;n=(e=[U(255*c[0]),U(255*c[1]),U(255*c[2])])[0],i=e[1],o=e[2]}return t.length>3?[n,i,o,t[3]]:[n,i,o,1]},H=V,Y=d,X=/^rgb\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*\)$/,W=/^rgba\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*,\s*([01]|[01]?\.\d+)\)$/,K=/^rgb\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,Q=/^rgba\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,Z=/^hsl\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,J=/^hsla\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,ee=Math.round,te=function(e){var t;if(e=e.toLowerCase().trim(),Y.format.named)try{return Y.format.named(e)}catch(e){}if(t=e.match(X)){for(var r=t.slice(1,4),n=0;n<3;n++)r[n]=+r[n];return r[3]=1,r}if(t=e.match(W)){for(var i=t.slice(1,5),o=0;o<4;o++)i[o]=+i[o];return i}if(t=e.match(K)){for(var a=t.slice(1,4),s=0;s<3;s++)a[s]=ee(2.55*a[s]);return a[3]=1,a}if(t=e.match(Q)){for(var l=t.slice(1,5),u=0;u<3;u++)l[u]=ee(2.55*l[u]);return l[3]=+l[3],l}if(t=e.match(Z)){var c=t.slice(1,4);c[1]*=.01,c[2]*=.01;var d=H(c);return d[3]=1,d}if(t=e.match(J)){var p=t.slice(1,4);p[1]*=.01,p[2]*=.01;var f=H(p);return f[3]=+t[4],f}};te.test=function(e){return X.test(e)||W.test(e)||K.test(e)||Q.test(e)||Z.test(e)||J.test(e)};var re=v,ne=y,ie=d,oe=c.type,ae=B,se=te;ne.prototype.css=function(e){return ae(this._rgb,e)},re.css=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(ne,[null].concat(e,["css"])))},ie.format.css=se,ie.autodetect.push({p:5,test:function(e){for(var t=[],r=arguments.length-1;r-- >0;)t[r]=arguments[r+1];if(!t.length&&"string"===oe(e)&&se.test(e))return"css"}});var le=y,ue=v,ce=c.unpack;d.format.gl=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var r=ce(e,"rgba");return r[0]*=255,r[1]*=255,r[2]*=255,r},ue.gl=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(le,[null].concat(e,["gl"])))},le.prototype.gl=function(){var e=this._rgb;return[e[0]/255,e[1]/255,e[2]/255,e[3]]};var de=c.unpack,pe=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var r,n=de(e,"rgb"),i=n[0],o=n[1],a=n[2],s=Math.min(i,o,a),l=Math.max(i,o,a),u=l-s,c=100*u/255,d=s/(255-u)*100;return 0===u?r=Number.NaN:(i===l&&(r=(o-a)/u),o===l&&(r=2+(a-i)/u),a===l&&(r=4+(i-o)/u),(r*=60)<0&&(r+=360)),[r,c,d]},fe=c.unpack,he=Math.floor,me=function(){for(var e,t,r,n,i,o,a=[],s=arguments.length;s--;)a[s]=arguments[s];var l,u,c,d=(a=fe(a,"hcg"))[0],p=a[1],f=a[2];f*=255;var h=255*p;if(0===p)l=u=c=f;else{360===d&&(d=0),d>360&&(d-=360),d<0&&(d+=360);var m=he(d/=60),g=d-m,y=f*(1-p),b=y+h*(1-g),v=y+h*g,_=y+h;switch(m){case 0:l=(e=[_,v,y])[0],u=e[1],c=e[2];break;case 1:l=(t=[b,_,y])[0],u=t[1],c=t[2];break;case 2:l=(r=[y,_,v])[0],u=r[1],c=r[2];break;case 3:l=(n=[y,b,_])[0],u=n[1],c=n[2];break;case 4:l=(i=[v,y,_])[0],u=i[1],c=i[2];break;case 5:l=(o=[_,y,b])[0],u=o[1],c=o[2]}}return[l,u,c,a.length>3?a[3]:1]},ge=c.unpack,ye=c.type,be=v,ve=y,_e=d,Ae=pe;ve.prototype.hcg=function(){return Ae(this._rgb)},be.hcg=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(ve,[null].concat(e,["hcg"])))},_e.format.hcg=me,_e.autodetect.push({p:1,test:function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];if(e=ge(e,"hcg"),"array"===ye(e)&&3===e.length)return"hcg"}});var we=c.unpack,Se=c.last,Te=Math.round,Ee=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var r=we(e,"rgba"),n=r[0],i=r[1],o=r[2],a=r[3],s=Se(e)||"auto";void 0===a&&(a=1),"auto"===s&&(s=a<1?"rgba":"rgb");var l="000000"+((n=Te(n))<<16|(i=Te(i))<<8|(o=Te(o))).toString(16);l=l.substr(l.length-6);var u="0"+Te(255*a).toString(16);switch(u=u.substr(u.length-2),s.toLowerCase()){case"rgba":return"#"+l+u;case"argb":return"#"+u+l;default:return"#"+l}},Oe=/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,xe=/^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/,Ce=function(e){if(e.match(Oe)){4!==e.length&&7!==e.length||(e=e.substr(1)),3===e.length&&(e=(e=e.split(""))[0]+e[0]+e[1]+e[1]+e[2]+e[2]);var t=parseInt(e,16);return[t>>16,t>>8&255,255&t,1]}if(e.match(xe)){5!==e.length&&9!==e.length||(e=e.substr(1)),4===e.length&&(e=(e=e.split(""))[0]+e[0]+e[1]+e[1]+e[2]+e[2]+e[3]+e[3]);var r=parseInt(e,16);return[r>>24&255,r>>16&255,r>>8&255,Math.round((255&r)/255*100)/100]}throw new Error("unknown hex color: "+e)},Ie=v,je=y,Re=c.type,De=d,Fe=Ee;je.prototype.hex=function(e){return Fe(this._rgb,e)},Ie.hex=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(je,[null].concat(e,["hex"])))},De.format.hex=Ce,De.autodetect.push({p:4,test:function(e){for(var t=[],r=arguments.length-1;r-- >0;)t[r]=arguments[r+1];if(!t.length&&"string"===Re(e)&&[3,4,5,6,7,8,9].indexOf(e.length)>=0)return"hex"}});var Ne=c.unpack,Pe=c.TWOPI,Me=Math.min,Le=Math.sqrt,ke=Math.acos,qe=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var r,n=Ne(e,"rgb"),i=n[0],o=n[1],a=n[2],s=Me(i/=255,o/=255,a/=255),l=(i+o+a)/3,u=l>0?1-s/l:0;return 0===u?r=NaN:(r=(i-o+(i-a))/2,r/=Le((i-o)*(i-o)+(i-a)*(o-a)),r=ke(r),a>o&&(r=Pe-r),r/=Pe),[360*r,u,l]},$e=c.unpack,ze=c.limit,Be=c.TWOPI,Ge=c.PITHIRD,Ue=Math.cos,Ve=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var r,n,i,o=(e=$e(e,"hsi"))[0],a=e[1],s=e[2];return isNaN(o)&&(o=0),isNaN(a)&&(a=0),o>360&&(o-=360),o<0&&(o+=360),(o/=360)<1/3?n=1-((i=(1-a)/3)+(r=(1+a*Ue(Be*o)/Ue(Ge-Be*o))/3)):o<2/3?i=1-((r=(1-a)/3)+(n=(1+a*Ue(Be*(o-=1/3))/Ue(Ge-Be*o))/3)):r=1-((n=(1-a)/3)+(i=(1+a*Ue(Be*(o-=2/3))/Ue(Ge-Be*o))/3)),[255*(r=ze(s*r*3)),255*(n=ze(s*n*3)),255*(i=ze(s*i*3)),e.length>3?e[3]:1]},He=c.unpack,Ye=c.type,Xe=v,We=y,Ke=d,Qe=qe;We.prototype.hsi=function(){return Qe(this._rgb)},Xe.hsi=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(We,[null].concat(e,["hsi"])))},Ke.format.hsi=Ve,Ke.autodetect.push({p:2,test:function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];if(e=He(e,"hsi"),"array"===Ye(e)&&3===e.length)return"hsi"}});var Ze=c.unpack,Je=c.type,et=v,tt=y,rt=d,nt=M;tt.prototype.hsl=function(){return nt(this._rgb)},et.hsl=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(tt,[null].concat(e,["hsl"])))},rt.format.hsl=V,rt.autodetect.push({p:2,test:function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];if(e=Ze(e,"hsl"),"array"===Je(e)&&3===e.length)return"hsl"}});var it=c.unpack,ot=Math.min,at=Math.max,st=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var r,n,i,o=(e=it(e,"rgb"))[0],a=e[1],s=e[2],l=ot(o,a,s),u=at(o,a,s),c=u-l;return i=u/255,0===u?(r=Number.NaN,n=0):(n=c/u,o===u&&(r=(a-s)/c),a===u&&(r=2+(s-o)/c),s===u&&(r=4+(o-a)/c),(r*=60)<0&&(r+=360)),[r,n,i]},lt=c.unpack,ut=Math.floor,ct=function(){for(var e,t,r,n,i,o,a=[],s=arguments.length;s--;)a[s]=arguments[s];var l,u,c,d=(a=lt(a,"hsv"))[0],p=a[1],f=a[2];if(f*=255,0===p)l=u=c=f;else{360===d&&(d=0),d>360&&(d-=360),d<0&&(d+=360);var h=ut(d/=60),m=d-h,g=f*(1-p),y=f*(1-p*m),b=f*(1-p*(1-m));switch(h){case 0:l=(e=[f,b,g])[0],u=e[1],c=e[2];break;case 1:l=(t=[y,f,g])[0],u=t[1],c=t[2];break;case 2:l=(r=[g,f,b])[0],u=r[1],c=r[2];break;case 3:l=(n=[g,y,f])[0],u=n[1],c=n[2];break;case 4:l=(i=[b,g,f])[0],u=i[1],c=i[2];break;case 5:l=(o=[f,g,y])[0],u=o[1],c=o[2]}}return[l,u,c,a.length>3?a[3]:1]},dt=c.unpack,pt=c.type,ft=v,ht=y,mt=d,gt=st;ht.prototype.hsv=function(){return gt(this._rgb)},ft.hsv=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(ht,[null].concat(e,["hsv"])))},mt.format.hsv=ct,mt.autodetect.push({p:2,test:function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];if(e=dt(e,"hsv"),"array"===pt(e)&&3===e.length)return"hsv"}});var yt={Kn:18,Xn:.95047,Yn:1,Zn:1.08883,t0:.137931034,t1:.206896552,t2:.12841855,t3:.008856452},bt=yt,vt=c.unpack,_t=Math.pow,At=function(e){return(e/=255)<=.04045?e/12.92:_t((e+.055)/1.055,2.4)},wt=function(e){return e>bt.t3?_t(e,1/3):e/bt.t2+bt.t0},St=function(e,t,r){return e=At(e),t=At(t),r=At(r),[wt((.4124564*e+.3575761*t+.1804375*r)/bt.Xn),wt((.2126729*e+.7151522*t+.072175*r)/bt.Yn),wt((.0193339*e+.119192*t+.9503041*r)/bt.Zn)]},Tt=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var r=vt(e,"rgb"),n=r[0],i=r[1],o=r[2],a=St(n,i,o),s=a[0],l=a[1],u=116*l-16;return[u<0?0:u,500*(s-l),200*(l-a[2])]},Et=yt,Ot=c.unpack,xt=Math.pow,Ct=function(e){return 255*(e<=.00304?12.92*e:1.055*xt(e,1/2.4)-.055)},It=function(e){return e>Et.t1?e*e*e:Et.t2*(e-Et.t0)},jt=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var r,n,i,o=(e=Ot(e,"lab"))[0],a=e[1],s=e[2];return n=(o+16)/116,r=isNaN(a)?n:n+a/500,i=isNaN(s)?n:n-s/200,n=Et.Yn*It(n),r=Et.Xn*It(r),i=Et.Zn*It(i),[Ct(3.2404542*r-1.5371385*n-.4985314*i),Ct(-.969266*r+1.8760108*n+.041556*i),Ct(.0556434*r-.2040259*n+1.0572252*i),e.length>3?e[3]:1]},Rt=c.unpack,Dt=c.type,Ft=v,Nt=y,Pt=d,Mt=Tt;Nt.prototype.lab=function(){return Mt(this._rgb)},Ft.lab=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(Nt,[null].concat(e,["lab"])))},Pt.format.lab=jt,Pt.autodetect.push({p:2,test:function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];if(e=Rt(e,"lab"),"array"===Dt(e)&&3===e.length)return"lab"}});var Lt=c.unpack,kt=c.RAD2DEG,qt=Math.sqrt,$t=Math.atan2,zt=Math.round,Bt=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var r=Lt(e,"lab"),n=r[0],i=r[1],o=r[2],a=qt(i*i+o*o),s=($t(o,i)*kt+360)%360;return 0===zt(1e4*a)&&(s=Number.NaN),[n,a,s]},Gt=c.unpack,Ut=Tt,Vt=Bt,Ht=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var r=Gt(e,"rgb"),n=r[0],i=r[1],o=r[2],a=Ut(n,i,o),s=a[0],l=a[1],u=a[2];return Vt(s,l,u)},Yt=c.unpack,Xt=c.DEG2RAD,Wt=Math.sin,Kt=Math.cos,Qt=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var r=Yt(e,"lch"),n=r[0],i=r[1],o=r[2];return isNaN(o)&&(o=0),[n,Kt(o*=Xt)*i,Wt(o)*i]},Zt=c.unpack,Jt=Qt,er=jt,tr=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var r=(e=Zt(e,"lch"))[0],n=e[1],i=e[2],o=Jt(r,n,i),a=o[0],s=o[1],l=o[2],u=er(a,s,l);return[u[0],u[1],u[2],e.length>3?e[3]:1]},rr=c.unpack,nr=tr,ir=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var r=rr(e,"hcl").reverse();return nr.apply(void 0,r)},or=c.unpack,ar=c.type,sr=v,lr=y,ur=d,cr=Ht;lr.prototype.lch=function(){return cr(this._rgb)},lr.prototype.hcl=function(){return cr(this._rgb).reverse()},sr.lch=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(lr,[null].concat(e,["lch"])))},sr.hcl=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(lr,[null].concat(e,["hcl"])))},ur.format.lch=tr,ur.format.hcl=ir,["lch","hcl"].forEach((function(e){return ur.autodetect.push({p:2,test:function(){for(var t=[],r=arguments.length;r--;)t[r]=arguments[r];if(t=or(t,e),"array"===ar(t)&&3===t.length)return e}})}));var dr={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflower:"#6495ed",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",laserlemon:"#ffff54",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrod:"#fafad2",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",maroon2:"#7f0000",maroon3:"#b03060",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",purple2:"#7f007f",purple3:"#a020f0",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},pr=d,fr=c.type,hr=dr,mr=Ce,gr=Ee;y.prototype.name=function(){for(var e=gr(this._rgb,"rgb"),t=0,r=Object.keys(hr);t<r.length;t+=1){var n=r[t];if(hr[n]===e)return n.toLowerCase()}return e},pr.format.named=function(e){if(e=e.toLowerCase(),hr[e])return mr(hr[e]);throw new Error("unknown color name: "+e)},pr.autodetect.push({p:5,test:function(e){for(var t=[],r=arguments.length-1;r-- >0;)t[r]=arguments[r+1];if(!t.length&&"string"===fr(e)&&hr[e.toLowerCase()])return"named"}});var yr=c.unpack,br=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var r=yr(e,"rgb");return(r[0]<<16)+(r[1]<<8)+r[2]},vr=c.type,_r=v,Ar=y,wr=d,Sr=c.type,Tr=br;Ar.prototype.num=function(){return Tr(this._rgb)},_r.num=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(Ar,[null].concat(e,["num"])))},wr.format.num=function(e){if("number"==vr(e)&&e>=0&&e<=16777215)return[e>>16,e>>8&255,255&e,1];throw new Error("unknown num color: "+e)},wr.autodetect.push({p:5,test:function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];if(1===e.length&&"number"===Sr(e[0])&&e[0]>=0&&e[0]<=16777215)return"num"}});var Er=v,Or=y,xr=d,Cr=c.unpack,Ir=c.type,jr=Math.round;Or.prototype.rgb=function(e){return void 0===e&&(e=!0),!1===e?this._rgb.slice(0,3):this._rgb.slice(0,3).map(jr)},Or.prototype.rgba=function(e){return void 0===e&&(e=!0),this._rgb.slice(0,4).map((function(t,r){return r<3?!1===e?t:jr(t):t}))},Er.rgb=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(Or,[null].concat(e,["rgb"])))},xr.format.rgb=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var r=Cr(e,"rgba");return void 0===r[3]&&(r[3]=1),r},xr.autodetect.push({p:3,test:function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];if(e=Cr(e,"rgba"),"array"===Ir(e)&&(3===e.length||4===e.length&&"number"==Ir(e[3])&&e[3]>=0&&e[3]<=1))return"rgb"}});var Rr=Math.log,Dr=function(e){var t,r,n,i=e/100;return i<66?(t=255,r=i<6?0:-155.25485562709179-.44596950469579133*(r=i-2)+104.49216199393888*Rr(r),n=i<20?0:.8274096064007395*(n=i-10)-254.76935184120902+115.67994401066147*Rr(n)):(t=351.97690566805693+.114206453784165*(t=i-55)-40.25366309332127*Rr(t),r=325.4494125711974+.07943456536662342*(r=i-50)-28.0852963507957*Rr(r),n=255),[t,r,n,1]},Fr=Dr,Nr=c.unpack,Pr=Math.round,Mr=v,Lr=y,kr=d,qr=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];for(var r,n=Nr(e,"rgb"),i=n[0],o=n[2],a=1e3,s=4e4;s-a>.4;){var l=Fr(r=.5*(s+a));l[2]/l[0]>=o/i?s=r:a=r}return Pr(r)};Lr.prototype.temp=Lr.prototype.kelvin=Lr.prototype.temperature=function(){return qr(this._rgb)},Mr.temp=Mr.kelvin=Mr.temperature=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(Lr,[null].concat(e,["temp"])))},kr.format.temp=kr.format.kelvin=kr.format.temperature=Dr;var $r=c.unpack,zr=Math.cbrt,Br=Math.pow,Gr=Math.sign,Ur=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var r=$r(e,"rgb"),n=r[0],i=r[1],o=r[2],a=[Vr(n/255),Vr(i/255),Vr(o/255)],s=a[0],l=a[1],u=a[2],c=zr(.4122214708*s+.5363325363*l+.0514459929*u),d=zr(.2119034982*s+.6806995451*l+.1073969566*u),p=zr(.0883024619*s+.2817188376*l+.6299787005*u);return[.2104542553*c+.793617785*d-.0040720468*p,1.9779984951*c-2.428592205*d+.4505937099*p,.0259040371*c+.7827717662*d-.808675766*p]};function Vr(e){var t=Math.abs(e);return t<.04045?e/12.92:(Gr(e)||1)*Br((t+.055)/1.055,2.4)}var Hr=c.unpack,Yr=Math.pow,Xr=Math.sign,Wr=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var r=(e=Hr(e,"lab"))[0],n=e[1],i=e[2],o=Yr(r+.3963377774*n+.2158037573*i,3),a=Yr(r-.1055613458*n-.0638541728*i,3),s=Yr(r-.0894841775*n-1.291485548*i,3);return[255*Kr(4.0767416621*o-3.3077115913*a+.2309699292*s),255*Kr(-1.2684380046*o+2.6097574011*a-.3413193965*s),255*Kr(-.0041960863*o-.7034186147*a+1.707614701*s),e.length>3?e[3]:1]};function Kr(e){var t=Math.abs(e);return t>.0031308?(Xr(e)||1)*(1.055*Yr(t,1/2.4)-.055):12.92*e}var Qr=c.unpack,Zr=c.type,Jr=v,en=y,tn=d,rn=Ur;en.prototype.oklab=function(){return rn(this._rgb)},Jr.oklab=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(en,[null].concat(e,["oklab"])))},tn.format.oklab=Wr,tn.autodetect.push({p:3,test:function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];if(e=Qr(e,"oklab"),"array"===Zr(e)&&3===e.length)return"oklab"}});var nn=c.unpack,on=Ur,an=Bt,sn=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var r=nn(e,"rgb"),n=r[0],i=r[1],o=r[2],a=on(n,i,o),s=a[0],l=a[1],u=a[2];return an(s,l,u)},ln=c.unpack,un=Qt,cn=Wr,dn=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var r=(e=ln(e,"lch"))[0],n=e[1],i=e[2],o=un(r,n,i),a=o[0],s=o[1],l=o[2],u=cn(a,s,l);return[u[0],u[1],u[2],e.length>3?e[3]:1]},pn=c.unpack,fn=c.type,hn=v,mn=y,gn=d,yn=sn;mn.prototype.oklch=function(){return yn(this._rgb)},hn.oklch=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(mn,[null].concat(e,["oklch"])))},gn.format.oklch=dn,gn.autodetect.push({p:3,test:function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];if(e=pn(e,"oklch"),"array"===fn(e)&&3===e.length)return"oklch"}});var bn=y,vn=c.type;bn.prototype.alpha=function(e,t){return void 0===t&&(t=!1),void 0!==e&&"number"===vn(e)?t?(this._rgb[3]=e,this):new bn([this._rgb[0],this._rgb[1],this._rgb[2],e],"rgb"):this._rgb[3]},y.prototype.clipped=function(){return this._rgb._clipped||!1};var _n=y,An=yt;_n.prototype.darken=function(e){void 0===e&&(e=1);var t=this.lab();return t[0]-=An.Kn*e,new _n(t,"lab").alpha(this.alpha(),!0)},_n.prototype.brighten=function(e){return void 0===e&&(e=1),this.darken(-e)},_n.prototype.darker=_n.prototype.darken,_n.prototype.brighter=_n.prototype.brighten,y.prototype.get=function(e){var t=e.split("."),r=t[0],n=t[1],i=this[r]();if(n){var o=r.indexOf(n)-("ok"===r.substr(0,2)?2:0);if(o>-1)return i[o];throw new Error("unknown channel "+n+" in mode "+r)}return i};var wn=y,Sn=c.type,Tn=Math.pow;wn.prototype.luminance=function(e){if(void 0!==e&&"number"===Sn(e)){if(0===e)return new wn([0,0,0,this._rgb[3]],"rgb");if(1===e)return new wn([255,255,255,this._rgb[3]],"rgb");var t=this.luminance(),r=20,n=function(t,i){var o=t.interpolate(i,.5,"rgb"),a=o.luminance();return Math.abs(e-a)<1e-7||!r--?o:a>e?n(t,o):n(o,i)},i=(t>e?n(new wn([0,0,0]),this):n(this,new wn([255,255,255]))).rgb();return new wn(i.concat([this._rgb[3]]))}return En.apply(void 0,this._rgb.slice(0,3))};var En=function(e,t,r){return.2126*(e=On(e))+.7152*(t=On(t))+.0722*On(r)},On=function(e){return(e/=255)<=.03928?e/12.92:Tn((e+.055)/1.055,2.4)},xn={},Cn=y,In=c.type,jn=xn,Rn=function(e,t,r){void 0===r&&(r=.5);for(var n=[],i=arguments.length-3;i-- >0;)n[i]=arguments[i+3];var o=n[0]||"lrgb";if(jn[o]||n.length||(o=Object.keys(jn)[0]),!jn[o])throw new Error("interpolation mode "+o+" is not defined");return"object"!==In(e)&&(e=new Cn(e)),"object"!==In(t)&&(t=new Cn(t)),jn[o](e,t,r).alpha(e.alpha()+r*(t.alpha()-e.alpha()))},Dn=y,Fn=Rn;Dn.prototype.mix=Dn.prototype.interpolate=function(e,t){void 0===t&&(t=.5);for(var r=[],n=arguments.length-2;n-- >0;)r[n]=arguments[n+2];return Fn.apply(void 0,[this,e,t].concat(r))};var Nn=y;Nn.prototype.premultiply=function(e){void 0===e&&(e=!1);var t=this._rgb,r=t[3];return e?(this._rgb=[t[0]*r,t[1]*r,t[2]*r,r],this):new Nn([t[0]*r,t[1]*r,t[2]*r,r],"rgb")};var Pn=y,Mn=yt;Pn.prototype.saturate=function(e){void 0===e&&(e=1);var t=this.lch();return t[1]+=Mn.Kn*e,t[1]<0&&(t[1]=0),new Pn(t,"lch").alpha(this.alpha(),!0)},Pn.prototype.desaturate=function(e){return void 0===e&&(e=1),this.saturate(-e)};var Ln=y,kn=c.type;Ln.prototype.set=function(e,t,r){void 0===r&&(r=!1);var n=e.split("."),i=n[0],o=n[1],a=this[i]();if(o){var s=i.indexOf(o)-("ok"===i.substr(0,2)?2:0);if(s>-1){if("string"==kn(t))switch(t.charAt(0)){case"+":case"-":a[s]+=+t;break;case"*":a[s]*=+t.substr(1);break;case"/":a[s]/=+t.substr(1);break;default:a[s]=+t}else{if("number"!==kn(t))throw new Error("unsupported value for Color.set");a[s]=t}var l=new Ln(a,i);return r?(this._rgb=l._rgb,this):l}throw new Error("unknown channel "+o+" in mode "+i)}return a};var qn=y;xn.rgb=function(e,t,r){var n=e._rgb,i=t._rgb;return new qn(n[0]+r*(i[0]-n[0]),n[1]+r*(i[1]-n[1]),n[2]+r*(i[2]-n[2]),"rgb")};var $n=y,zn=Math.sqrt,Bn=Math.pow;xn.lrgb=function(e,t,r){var n=e._rgb,i=n[0],o=n[1],a=n[2],s=t._rgb,l=s[0],u=s[1],c=s[2];return new $n(zn(Bn(i,2)*(1-r)+Bn(l,2)*r),zn(Bn(o,2)*(1-r)+Bn(u,2)*r),zn(Bn(a,2)*(1-r)+Bn(c,2)*r),"rgb")};var Gn=y;xn.lab=function(e,t,r){var n=e.lab(),i=t.lab();return new Gn(n[0]+r*(i[0]-n[0]),n[1]+r*(i[1]-n[1]),n[2]+r*(i[2]-n[2]),"lab")};var Un=y,Vn=function(e,t,r,n){var i,o,a,s,l,u,c,d,p,f,h,m,g;return"hsl"===n?(a=e.hsl(),s=t.hsl()):"hsv"===n?(a=e.hsv(),s=t.hsv()):"hcg"===n?(a=e.hcg(),s=t.hcg()):"hsi"===n?(a=e.hsi(),s=t.hsi()):"lch"===n||"hcl"===n?(n="hcl",a=e.hcl(),s=t.hcl()):"oklch"===n&&(a=e.oklch().reverse(),s=t.oklch().reverse()),"h"!==n.substr(0,1)&&"oklch"!==n||(l=(i=a)[0],c=i[1],p=i[2],u=(o=s)[0],d=o[1],f=o[2]),isNaN(l)||isNaN(u)?isNaN(l)?isNaN(u)?m=Number.NaN:(m=u,1!=p&&0!=p||"hsv"==n||(h=d)):(m=l,1!=f&&0!=f||"hsv"==n||(h=c)):m=l+r*(u>l&&u-l>180?u-(l+360):u<l&&l-u>180?u+360-l:u-l),void 0===h&&(h=c+r*(d-c)),g=p+r*(f-p),new Un("oklch"===n?[g,h,m]:[m,h,g],n)},Hn=Vn,Yn=function(e,t,r){return Hn(e,t,r,"lch")};xn.lch=Yn,xn.hcl=Yn;var Xn=y;xn.num=function(e,t,r){var n=e.num(),i=t.num();return new Xn(n+r*(i-n),"num")};var Wn=Vn;xn.hcg=function(e,t,r){return Wn(e,t,r,"hcg")};var Kn=Vn;xn.hsi=function(e,t,r){return Kn(e,t,r,"hsi")};var Qn=Vn;xn.hsl=function(e,t,r){return Qn(e,t,r,"hsl")};var Zn=Vn;xn.hsv=function(e,t,r){return Zn(e,t,r,"hsv")};var Jn=y;xn.oklab=function(e,t,r){var n=e.oklab(),i=t.oklab();return new Jn(n[0]+r*(i[0]-n[0]),n[1]+r*(i[1]-n[1]),n[2]+r*(i[2]-n[2]),"oklab")};var ei=Vn;xn.oklch=function(e,t,r){return ei(e,t,r,"oklch")};var ti=y,ri=c.clip_rgb,ni=Math.pow,ii=Math.sqrt,oi=Math.PI,ai=Math.cos,si=Math.sin,li=Math.atan2,ui=function(e,t){for(var r=e.length,n=[0,0,0,0],i=0;i<e.length;i++){var o=e[i],a=t[i]/r,s=o._rgb;n[0]+=ni(s[0],2)*a,n[1]+=ni(s[1],2)*a,n[2]+=ni(s[2],2)*a,n[3]+=s[3]*a}return n[0]=ii(n[0]),n[1]=ii(n[1]),n[2]=ii(n[2]),n[3]>.9999999&&(n[3]=1),new ti(ri(n))},ci=v,di=c.type,pi=Math.pow,fi=function(e){var t="rgb",r=ci("#ccc"),n=0,i=[0,1],o=[],a=[0,0],s=!1,l=[],u=!1,c=0,d=1,p=!1,f={},h=!0,m=1,g=function(e){if((e=e||["#fff","#000"])&&"string"===di(e)&&ci.brewer&&ci.brewer[e.toLowerCase()]&&(e=ci.brewer[e.toLowerCase()]),"array"===di(e)){1===e.length&&(e=[e[0],e[0]]),e=e.slice(0);for(var t=0;t<e.length;t++)e[t]=ci(e[t]);o.length=0;for(var r=0;r<e.length;r++)o.push(r/(e.length-1))}return _(),l=e},y=function(e){return e},b=function(e){return e},v=function(e,n){var i,u;if(null==n&&(n=!1),isNaN(e)||null===e)return r;u=n?e:s&&s.length>2?function(e){if(null!=s){for(var t=s.length-1,r=0;r<t&&e>=s[r];)r++;return r-1}return 0}(e)/(s.length-2):d!==c?(e-c)/(d-c):1,u=b(u),n||(u=y(u)),1!==m&&(u=pi(u,m)),u=a[0]+u*(1-a[0]-a[1]),u=Math.min(1,Math.max(0,u));var p=Math.floor(1e4*u);if(h&&f[p])i=f[p];else{if("array"===di(l))for(var g=0;g<o.length;g++){var v=o[g];if(u<=v){i=l[g];break}if(u>=v&&g===o.length-1){i=l[g];break}if(u>v&&u<o[g+1]){u=(u-v)/(o[g+1]-v),i=ci.interpolate(l[g],l[g+1],u,t);break}}else"function"===di(l)&&(i=l(u));h&&(f[p]=i)}return i},_=function(){return f={}};g(e);var A=function(e){var t=ci(v(e));return u&&t[u]?t[u]():t};return A.classes=function(e){if(null!=e){if("array"===di(e))s=e,i=[e[0],e[e.length-1]];else{var t=ci.analyze(i);s=0===e?[t.min,t.max]:ci.limits(t,"e",e)}return A}return s},A.domain=function(e){if(!arguments.length)return i;c=e[0],d=e[e.length-1],o=[];var t=l.length;if(e.length===t&&c!==d)for(var r=0,n=Array.from(e);r<n.length;r+=1){var a=n[r];o.push((a-c)/(d-c))}else{for(var s=0;s<t;s++)o.push(s/(t-1));if(e.length>2){var u=e.map((function(t,r){return r/(e.length-1)})),p=e.map((function(e){return(e-c)/(d-c)}));p.every((function(e,t){return u[t]===e}))||(b=function(e){if(e<=0||e>=1)return e;for(var t=0;e>=p[t+1];)t++;var r=(e-p[t])/(p[t+1]-p[t]);return u[t]+r*(u[t+1]-u[t])})}}return i=[c,d],A},A.mode=function(e){return arguments.length?(t=e,_(),A):t},A.range=function(e,t){return g(e),A},A.out=function(e){return u=e,A},A.spread=function(e){return arguments.length?(n=e,A):n},A.correctLightness=function(e){return null==e&&(e=!0),p=e,_(),y=p?function(e){for(var t=v(0,!0).lab()[0],r=v(1,!0).lab()[0],n=t>r,i=v(e,!0).lab()[0],o=t+(r-t)*e,a=i-o,s=0,l=1,u=20;Math.abs(a)>.01&&u-- >0;)n&&(a*=-1),a<0?(s=e,e+=.5*(l-e)):(l=e,e+=.5*(s-e)),a=(i=v(e,!0).lab()[0])-o;return e}:function(e){return e},A},A.padding=function(e){return null!=e?("number"===di(e)&&(e=[e,e]),a=e,A):a},A.colors=function(t,r){arguments.length<2&&(r="hex");var n=[];if(0===arguments.length)n=l.slice(0);else if(1===t)n=[A(.5)];else if(t>1){var o=i[0],a=i[1]-o;n=function(e,t,r){for(var n=[],i=e<t,o=r?i?t+1:t-1:t,a=e;i?a<o:a>o;i?a++:a--)n.push(a);return n}(0,t,!1).map((function(e){return A(o+e/(t-1)*a)}))}else{e=[];var u=[];if(s&&s.length>2)for(var c=1,d=s.length,p=1<=d;p?c<d:c>d;p?c++:c--)u.push(.5*(s[c-1]+s[c]));else u=i;n=u.map((function(e){return A(e)}))}return ci[r]&&(n=n.map((function(e){return e[r]()}))),n},A.cache=function(e){return null!=e?(h=e,A):h},A.gamma=function(e){return null!=e?(m=e,A):m},A.nodata=function(e){return null!=e?(r=ci(e),A):r},A};var hi=y,mi=fi,gi=v,yi=function(e,t,r){if(!yi[r])throw new Error("unknown blend mode "+r);return yi[r](e,t)},bi=function(e){return function(t,r){var n=gi(r).rgb(),i=gi(t).rgb();return gi.rgb(e(n,i))}},vi=function(e){return function(t,r){var n=[];return n[0]=e(t[0],r[0]),n[1]=e(t[1],r[1]),n[2]=e(t[2],r[2]),n}};yi.normal=bi(vi((function(e){return e}))),yi.multiply=bi(vi((function(e,t){return e*t/255}))),yi.screen=bi(vi((function(e,t){return 255*(1-(1-e/255)*(1-t/255))}))),yi.overlay=bi(vi((function(e,t){return t<128?2*e*t/255:255*(1-2*(1-e/255)*(1-t/255))}))),yi.darken=bi(vi((function(e,t){return e>t?t:e}))),yi.lighten=bi(vi((function(e,t){return e>t?e:t}))),yi.dodge=bi(vi((function(e,t){return 255===e||(e=t/255*255/(1-e/255))>255?255:e}))),yi.burn=bi(vi((function(e,t){return 255*(1-(1-t/255)/(e/255))})));for(var _i=yi,Ai=c.type,wi=c.clip_rgb,Si=c.TWOPI,Ti=Math.pow,Ei=Math.sin,Oi=Math.cos,xi=v,Ci=y,Ii=Math.floor,ji=Math.random,Ri=a,Di=Math.log,Fi=Math.pow,Ni=Math.floor,Pi=Math.abs,Mi=function(e,t){void 0===t&&(t=null);var r={min:Number.MAX_VALUE,max:-1*Number.MAX_VALUE,sum:0,values:[],count:0};return"object"===Ri(e)&&(e=Object.values(e)),e.forEach((function(e){t&&"object"===Ri(e)&&(e=e[t]),null==e||isNaN(e)||(r.values.push(e),r.sum+=e,e<r.min&&(r.min=e),e>r.max&&(r.max=e),r.count+=1)})),r.domain=[r.min,r.max],r.limits=function(e,t){return Li(r,e,t)},r},Li=function(e,t,r){void 0===t&&(t="equal"),void 0===r&&(r=7),"array"==Ri(e)&&(e=Mi(e));var n=e.min,i=e.max,o=e.values.sort((function(e,t){return e-t}));if(1===r)return[n,i];var a=[];if("c"===t.substr(0,1)&&(a.push(n),a.push(i)),"e"===t.substr(0,1)){a.push(n);for(var s=1;s<r;s++)a.push(n+s/r*(i-n));a.push(i)}else if("l"===t.substr(0,1)){if(n<=0)throw new Error("Logarithmic scales are only possible for values > 0");var l=Math.LOG10E*Di(n),u=Math.LOG10E*Di(i);a.push(n);for(var c=1;c<r;c++)a.push(Fi(10,l+c/r*(u-l)));a.push(i)}else if("q"===t.substr(0,1)){a.push(n);for(var d=1;d<r;d++){var p=(o.length-1)*d/r,f=Ni(p);if(f===p)a.push(o[f]);else{var h=p-f;a.push(o[f]*(1-h)+o[f+1]*h)}}a.push(i)}else if("k"===t.substr(0,1)){var m,g=o.length,y=new Array(g),b=new Array(r),v=!0,_=0,A=null;(A=[]).push(n);for(var w=1;w<r;w++)A.push(n+w/r*(i-n));for(A.push(i);v;){for(var S=0;S<r;S++)b[S]=0;for(var T=0;T<g;T++)for(var E=o[T],O=Number.MAX_VALUE,x=void 0,C=0;C<r;C++){var I=Pi(A[C]-E);I<O&&(O=I,x=C),b[x]++,y[T]=x}for(var j=new Array(r),R=0;R<r;R++)j[R]=null;for(var D=0;D<g;D++)null===j[m=y[D]]?j[m]=o[D]:j[m]+=o[D];for(var F=0;F<r;F++)j[F]*=1/b[F];v=!1;for(var N=0;N<r;N++)if(j[N]!==A[N]){v=!0;break}A=j,++_>200&&(v=!1)}for(var P={},M=0;M<r;M++)P[M]=[];for(var L=0;L<g;L++)P[m=y[L]].push(o[L]);for(var k=[],q=0;q<r;q++)k.push(P[q][0]),k.push(P[q][P[q].length-1]);k=k.sort((function(e,t){return e-t})),a.push(k[0]);for(var $=1;$<k.length;$+=2){var z=k[$];isNaN(z)||-1!==a.indexOf(z)||a.push(z)}}return a},ki={analyze:Mi,limits:Li},qi=y,$i=y,zi=Math.sqrt,Bi=Math.pow,Gi=Math.min,Ui=Math.max,Vi=Math.atan2,Hi=Math.abs,Yi=Math.cos,Xi=Math.sin,Wi=Math.exp,Ki=Math.PI,Qi=y,Zi=y,Ji=v,eo=fi,to={cool:function(){return eo([Ji.hsl(180,1,.9),Ji.hsl(250,.7,.4)])},hot:function(){return eo(["#000","#f00","#ff0","#fff"]).mode("rgb")}},ro={OrRd:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"],PuBu:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"],BuPu:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"],Oranges:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"],BuGn:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"],YlOrBr:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"],YlGn:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"],Reds:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"],RdPu:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"],Greens:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"],YlGnBu:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"],Purples:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"],GnBu:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"],Greys:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"],YlOrRd:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"],PuRd:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"],Blues:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"],PuBuGn:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"],Viridis:["#440154","#482777","#3f4a8a","#31678e","#26838f","#1f9d8a","#6cce5a","#b6de2b","#fee825"],Spectral:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],RdYlGn:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],RdBu:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],PiYG:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],PRGn:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],RdYlBu:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],BrBG:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],RdGy:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],PuOr:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],Set2:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"],Accent:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"],Set1:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"],Set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],Dark2:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"],Paired:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"],Pastel2:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc","#cccccc"],Pastel1:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"]},no=0,io=Object.keys(ro);no<io.length;no+=1){var oo=io[no];ro[oo.toLowerCase()]=ro[oo]}var ao=ro,so=v;return so.average=function(e,t,r){void 0===t&&(t="lrgb"),void 0===r&&(r=null);var n=e.length;r||(r=Array.from(new Array(n)).map((function(){return 1})));var i=n/r.reduce((function(e,t){return e+t}));if(r.forEach((function(e,t){r[t]*=i})),e=e.map((function(e){return new ti(e)})),"lrgb"===t)return ui(e,r);for(var o=e.shift(),a=o.get(t),s=[],l=0,u=0,c=0;c<a.length;c++)if(a[c]=(a[c]||0)*r[0],s.push(isNaN(a[c])?0:r[0]),"h"===t.charAt(c)&&!isNaN(a[c])){var d=a[c]/180*oi;l+=ai(d)*r[0],u+=si(d)*r[0]}var p=o.alpha()*r[0];e.forEach((function(e,n){var i=e.get(t);p+=e.alpha()*r[n+1];for(var o=0;o<a.length;o++)if(!isNaN(i[o]))if(s[o]+=r[n+1],"h"===t.charAt(o)){var c=i[o]/180*oi;l+=ai(c)*r[n+1],u+=si(c)*r[n+1]}else a[o]+=i[o]*r[n+1]}));for(var f=0;f<a.length;f++)if("h"===t.charAt(f)){for(var h=li(u/s[f],l/s[f])/oi*180;h<0;)h+=360;for(;h>=360;)h-=360;a[f]=h}else a[f]=a[f]/s[f];return p/=n,new ti(a,t).alpha(p>.99999?1:p,!0)},so.bezier=function(e){var t=function(e){var t,r,n,i,o,a,s;if(2===(e=e.map((function(e){return new hi(e)}))).length)t=e.map((function(e){return e.lab()})),o=t[0],a=t[1],i=function(e){var t=[0,1,2].map((function(t){return o[t]+e*(a[t]-o[t])}));return new hi(t,"lab")};else if(3===e.length)r=e.map((function(e){return e.lab()})),o=r[0],a=r[1],s=r[2],i=function(e){var t=[0,1,2].map((function(t){return(1-e)*(1-e)*o[t]+2*(1-e)*e*a[t]+e*e*s[t]}));return new hi(t,"lab")};else if(4===e.length){var l;n=e.map((function(e){return e.lab()})),o=n[0],a=n[1],s=n[2],l=n[3],i=function(e){var t=[0,1,2].map((function(t){return(1-e)*(1-e)*(1-e)*o[t]+3*(1-e)*(1-e)*e*a[t]+3*(1-e)*e*e*s[t]+e*e*e*l[t]}));return new hi(t,"lab")}}else{if(!(e.length>=5))throw new RangeError("No point in running bezier with only one color.");var u,c,d;u=e.map((function(e){return e.lab()})),d=e.length-1,c=function(e){for(var t=[1,1],r=1;r<e;r++){for(var n=[1],i=1;i<=t.length;i++)n[i]=(t[i]||0)+t[i-1];t=n}return t}(d),i=function(e){var t=1-e,r=[0,1,2].map((function(r){return u.reduce((function(n,i,o){return n+c[o]*Math.pow(t,d-o)*Math.pow(e,o)*i[r]}),0)}));return new hi(r,"lab")}}return i}(e);return t.scale=function(){return mi(t)},t},so.blend=_i,so.cubehelix=function(e,t,r,n,i){void 0===e&&(e=300),void 0===t&&(t=-1.5),void 0===r&&(r=1),void 0===n&&(n=1),void 0===i&&(i=[0,1]);var o,a=0;"array"===Ai(i)?o=i[1]-i[0]:(o=0,i=[i,i]);var s=function(s){var l=Si*((e+120)/360+t*s),u=Ti(i[0]+o*s,n),c=(0!==a?r[0]+s*a:r)*u*(1-u)/2,d=Oi(l),p=Ei(l);return xi(wi([255*(u+c*(-.14861*d+1.78277*p)),255*(u+c*(-.29227*d-.90649*p)),255*(u+c*(1.97294*d)),1]))};return s.start=function(t){return null==t?e:(e=t,s)},s.rotations=function(e){return null==e?t:(t=e,s)},s.gamma=function(e){return null==e?n:(n=e,s)},s.hue=function(e){return null==e?r:("array"===Ai(r=e)?0==(a=r[1]-r[0])&&(r=r[1]):a=0,s)},s.lightness=function(e){return null==e?i:("array"===Ai(e)?(i=e,o=e[1]-e[0]):(i=[e,e],o=0),s)},s.scale=function(){return xi.scale(s)},s.hue(r),s},so.mix=so.interpolate=Rn,so.random=function(){for(var e="#",t=0;t<6;t++)e+="0123456789abcdef".charAt(Ii(16*ji()));return new Ci(e,"hex")},so.scale=fi,so.analyze=ki.analyze,so.contrast=function(e,t){e=new qi(e),t=new qi(t);var r=e.luminance(),n=t.luminance();return r>n?(r+.05)/(n+.05):(n+.05)/(r+.05)},so.deltaE=function(e,t,r,n,i){void 0===r&&(r=1),void 0===n&&(n=1),void 0===i&&(i=1);var o=function(e){return 360*e/(2*Ki)},a=function(e){return 2*Ki*e/360};e=new $i(e),t=new $i(t);var s=Array.from(e.lab()),l=s[0],u=s[1],c=s[2],d=Array.from(t.lab()),p=d[0],f=d[1],h=d[2],m=(l+p)/2,g=(zi(Bi(u,2)+Bi(c,2))+zi(Bi(f,2)+Bi(h,2)))/2,y=.5*(1-zi(Bi(g,7)/(Bi(g,7)+Bi(25,7)))),b=u*(1+y),v=f*(1+y),_=zi(Bi(b,2)+Bi(c,2)),A=zi(Bi(v,2)+Bi(h,2)),w=(_+A)/2,S=o(Vi(c,b)),T=o(Vi(h,v)),E=S>=0?S:S+360,O=T>=0?T:T+360,x=Hi(E-O)>180?(E+O+360)/2:(E+O)/2,C=1-.17*Yi(a(x-30))+.24*Yi(a(2*x))+.32*Yi(a(3*x+6))-.2*Yi(a(4*x-63)),I=O-E;I=Hi(I)<=180?I:O<=E?I+360:I-360,I=2*zi(_*A)*Xi(a(I)/2);var j=p-l,R=A-_,D=1+.015*Bi(m-50,2)/zi(20+Bi(m-50,2)),F=1+.045*w,N=1+.015*w*C,P=30*Wi(-Bi((x-275)/25,2)),M=-2*zi(Bi(w,7)/(Bi(w,7)+Bi(25,7)))*Xi(2*a(P)),L=zi(Bi(j/(r*D),2)+Bi(R/(n*F),2)+Bi(I/(i*N),2)+M*(R/(n*F))*(I/(i*N)));return Ui(0,Gi(100,L))},so.distance=function(e,t,r){void 0===r&&(r="lab"),e=new Qi(e),t=new Qi(t);var n=e.get(r),i=t.get(r),o=0;for(var a in n){var s=(n[a]||0)-(i[a]||0);o+=s*s}return Math.sqrt(o)},so.limits=ki.limits,so.valid=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];try{return new(Function.prototype.bind.apply(Zi,[null].concat(e))),!0}catch(e){return!1}},so.scales=to,so.colors=dr,so.brewer=ao,so}()},9034:e=>{e.exports=JSON.parse('{"name":"@vizzly/api-client","version":"0.0.35","private":false,"license":"NONE","source":"src/index.ts","main":"dist/index.js","types":"dist/index.d.ts","type":"commonjs","files":["dist"],"devDependencies":{"@types/isomorphic-fetch":"^0.0.39","@types/jest":"^29.5.12","@types/lodash":"^4.17.0","@types/uuid":"^9.0.8","@vizzly/auth":"^0.2.8","jest":"^29.6.0","lodash":"^4.17.21","nock":"^13.5.4","prettier":"^3.2.5","ts-jest":"^29.1.1","ts-loader":"^9.5.1","typescript":"^5.3.2","uuid":"^9.0.1"},"scripts":{"test":"jest","build":"rm -rf ./dist && tsc","dev":"tsc -w","format":"prettier --write ./src/** ./__tests__/**","prepublish":"yarn build"},"dependencies":{"isomorphic-fetch":"^3.0.0"}}')}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={id:n,loaded:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.loaded=!0,o.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(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.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var n={};(()=>{r.d(n,{B:()=>To,Q:()=>Ei});var e=r(4843),t=r(5250);const i=(e,r)=>(0,t.mergeWith)({},e,r,((e,r)=>(0,t.isArray)(r)?r:(0,t.isObject)(e)&&(0,t.isObject)(r)?i(e,r):r));var o=r(4893);const a=o.QueryEngineConfig.Constants.timeDimensionsConstants,s=(e,t)=>[...Object.keys(e),"none"].includes(t),l=o.QueryEngineConfig.Constants.supportedOperatorsConstants,u=(e,t)=>{let r=[...Object.keys(t.supportedOperators)];return r=r.filter((t=>c[t].validDataTypes.includes(e.dataType))),r},c=l,d=e=>e.map((e=>e.map((e=>"is_one_of"!=e.op&&"is_not_one_of"!=e.op||(0,t.isArray)(e.value)?e:Object.assign(Object.assign({},e),{value:[e.value]}))))),p=(e,t)=>e.map((e=>{let r=Object.assign(Object.assign({},e),{aggregate:void 0,function:e.function||e.aggregate});return delete r.aggregate,t&&r.field==t.field&&"none"==r.function&&(r.function=t.truncate),r})),f=e=>e.map((e=>{let t=Object.assign(Object.assign({},e),{aggregate:void 0,function:e.function||e.aggregate});return delete t.aggregate,t})),h=e=>"auto"===e||0===e||2===e?e:"auto",m=e=>{if(!e)return{};let r={};return e.measure&&Object.entries(e.measure).forEach((([e,t])=>{r&&(r[e]=f(t))})),{measure:(0,t.isEmpty)(r)?void 0:r,group:e.group}},g=o.QueryEngineConfig.Constants.supportedAggregatesConstants,y=g,b=(e,r,n)=>{const i=(0,t.replace)(e,r,n);return i.indexOf(r)>=0?b(i,r,n):i},v=["debug","info","warning","error","properties"];const _=e=>v.findIndex((e=>"error"==e))<=v.findIndex((t=>e==t)),A=e=>e instanceof Error?e:(0,t.isObject)(e)||(0,t.isArray)(e)?JSON.stringify(e):e,w=(...e)=>{_("debug")&&console.info("[VIZZLY DEBUG]",...e.map(A))},S=(...e)=>{_("warning")&&console.warn("[VIZZLY WARNING]",...e.map(A))},T=(...e)=>{_("error")&&console.error("[VIZZLY ERROR]",...e.map(A))},E=(Object.keys((0,t.cloneDeep)(y)),e=>{return(t=b(e,"_"," ")).charAt(0).toUpperCase()+t.slice(1);var t}),O=(e,t)=>{const r=e.split("_"),n=r.pop();return[void 0,...Object.keys(t.supportedAggregates||{}),...Object.keys(t.supportedTimeTruncFunctions||{}),...Object.keys(t.supportedTransformationFunctions||{})].includes(n)?{field:r.join("_"),function:null!=n?n:""}:{field:e,function:"none"}},x=e=>e.map((e=>"string"==typeof e?{field:e,function:"none"}:e)),C=(e,t,r)=>{const n=e.supportedAggregates,i=Object.keys(n).filter((e=>n[e].validDataTypes.includes(t)));null==r||r.forEach((e=>{n.hasOwnProperty(e)||S(`Unsupported aggregate option: ${e} on ${t}`)}));let o=r&&r.length>0?r.filter((e=>i.includes(e))):i;return r&&r.length>0&&0===o.length&&(o=i),o},I=e=>(null==e?void 0:e.function)&&"none"!=(null==e?void 0:e.function)?`${e.field}_${e.function}`:null==e?void 0:e.field,j=O;function R(e,t){const r={};for(const[n,i]of Object.entries(e))r[n]=i.filter((e=>(null==e?void 0:e.field)!==t));return r}const D=(e,r)=>{let n=(0,t.remove)(e.order,(e=>(0,t.some)(r,(t=>{const r=t.function==e.function,n=t.field==e.field;return r&&n}))));return Object.assign(Object.assign({},e),{order:n})},F=(e,r,n)=>{var i,o,a;let l=Object.assign({},e);if("measure"in l&&(0,t.remove)(l.measure,(e=>e.field==r)),"barMeasure"in l&&(0,t.remove)(l.barMeasure,(e=>e.field==r)),"lineMeasure"in l&&(0,t.remove)(l.lineMeasure,(e=>e.field==r)),"xMeasure"in l&&(null===(i=l.yMeasure)||void 0===i?void 0:i.field)==r&&(l.xMeasure=null),"yMeasure"in l&&(null===(o=l.yMeasure)||void 0===o?void 0:o.field)==r&&(l.yMeasure=null),"order"in l&&(0,t.remove)(l.order,(e=>e.field==r)),"dimension"in l&&(0,t.remove)(l.dimension,(e=>e.field==r)),"barDimension"in l&&(0,t.remove)(l.barDimension,(e=>e.field==r)),"lineDimension"in l&&(0,t.remove)(l.lineDimension,(e=>e.field==r)),"filter"in l&&l.filter.forEach((e=>{(0,t.remove)(e,(e=>e.field==r))})),"parameters"in l&&l.parameters&&n){const e=((e,t,r)=>{if("measure"in e&&e.measure){const n=function(e,t){return Object.keys(e).map((e=>{const r=j(e,t);return(null==r?void 0:r.function)?r:null})).find((e=>null!==e))}(e.measure,r);if((null==n?void 0:n.function)&&n.field===t){const t=I(n);delete e.measure[t]}e.measure=R(e.measure,t)}if("group"in e&&e.group){const i=function(e,t){return Object.keys(e).map((e=>{const r=((e,t)=>{const r=e.split("_"),n=r.pop();return n&&!s(t,n)?null:{field:r.join("_"),truncate:null!=n?n:""}})(e,t.supportedTimeTruncFunctions);return(null==r?void 0:r.truncate)?r:null})).find((e=>null!==e))}(e.group,r);if((null==i?void 0:i.truncate)&&i.field===t){const t=(null==(n=i)?void 0:n.truncate)&&"none"!=(null==n?void 0:n.truncate)?`${n.field}_${n.truncate}`:null==n?void 0:n.field;delete e.group[t]}else e.group.hasOwnProperty(t)&&delete e.group[t];e.group=R(e.group,t)}var n;return e})(l.parameters,r,n);l.parameters=e}return"timeDimension"in l&&(null===(a=l.timeDimension)||void 0===a?void 0:a.field)==r&&(l.timeDimension=null),l},N=e=>{let t=[...e.measure];return e.dimension.forEach((e=>{t.push({field:e.field,function:e.function})})),e.timeDimension&&t.push({field:e.timeDimension.field,function:e.timeDimension.truncate}),D(e,t)},P=(e,t,r)=>{let n=i(e,t);const{value:o,error:a}=r.validate(n);if(a)throw a;return o};var M=r(4579),L=r.n(M);const k=e=>({minutes:{description:e?e("duration_option.minutes","Minutes"):"Minutes",formatter:(e,t)=>{e.setMinutes(e.getMinutes()+t)}},hours:{description:e?e("duration_option.minutes","Hours"):"Hours",formatter:(e,t)=>{e.setHours(e.getHours()+t)}},days:{description:e?e("duration_option.minutes","Days"):"Days",formatter:(e,t)=>{e.setDate(e.getDate()+t)}},weeks:{description:e?e("duration_option.minutes","Weeks"):"Weeks",formatter:(e,t)=>{e.setDate(e.getDate()+7*t)}},months:{description:e?e("duration_option.minutes","Months"):"Months",formatter:(e,t)=>{e.setMonth(e.getMonth()+t)}},years:{description:e?e("duration_option.minutes","Years"):"Years",formatter:(e,t)=>{e.setFullYear(e.getFullYear()+t)}}}),q=L().object({unit:L().string().valid(...(()=>{const e=k();return Object.keys(e)})()).required(),value:L().number().integer().required(),timeFrame:L().string().valid(...(()=>{const e={future:{description:"Future"},past:{description:"Past"}};return Object.keys(e)})()).required()}),$=(e,t)=>{const r=t?new Date(t):new Date;if(!e.value||null===e.unit)throw new Error(`Unrecognized value: ${e.value}`);let n="future"===e.timeFrame?e.value:-e.value;return k()[e.unit].formatter(r,n),r},z=()=>L().array().items(L().object({key:L().string().required()})).min(0),B=(e,t)=>{const r=(e,t)=>L().object({field:e.required(),function:t.required().description("Which if any, aggregate function should be applied to the field?")});return(null==t?void 0:t.restrictFields)?L().alternatives(...t.restrictFields.filter((e=>e.canBeMeasure)).map((t=>{const n=(i=t,o=e,Object.keys(o).filter((e=>o[e].validDataTypes.includes(i.dataType))));var i,o;return r(L().string().valid(t.id).description(`${t.publicName}, ${t.description||""}.`),L().string().valid(...n,"none"))}))):r(L().string().description("The ID of the field from the data set to reference."),L().valid(...Object.keys(e),"none"))},G=e=>L().object({field:L().string().required().description("The ID of the field from the data set to reference."),direction:L().string().valid("asc","desc").required().description("In which direction should the results be ordered?"),function:L().string().valid(...Object.keys(e.supportedAggregates),...Object.keys(e.supportedTimeTruncFunctions),"none").description("Which if any, function should be applied to the field?")}),U=e=>L().object({field:L().string().required().description("The ID of the field from the data set to reference."),truncate:L().valid(...Object.keys(e),"none"),bucketFill:L().boolean()}),V=(e,t)=>{const r=(t,r)=>L().object({field:t.required(),pivot:L().string().valid("x","y").optional(),function:r?L().valid(...Object.keys(e),"none").required():L().valid("none").required()});return(null==t?void 0:t.restrictFields)?L().array().items(L().alternatives(...t.restrictFields.filter((e=>e.canBeDimension)).map((e=>r(L().string().valid(e.id).description(`${e.publicName}, ${e.description||""}.`),"date_time"===e.dataType))))).description("Fields to group the data by"):L().array().items(r(L().string().description("The ID of the field from the data set to reference."),!0)).description("Fields to group the data by")},H=e=>L().object({field:L().string().required().description("The ID of the field from the data set to reference."),op:L().string().valid(...Object.keys(e.supportedOperators)).required(),value:L().alternatives(L().string().allow(null),L().number(),L().boolean(),L().array().items(L().string(),L().number()),q).required(),function:L().string().valid(...Object.keys(e.supportedAggregates),...Object.keys(e.supportedTimeTruncFunctions),"none").description("Which function should be applied to the field?")}),Y=e=>L().array().items(L().array().items(H(e))),X=()=>L().number().description("Limit the number of results returned after the query has been ran."),W=e=>{const t=(null==e?void 0:e.restrictDataSetIds)?L().string().valid(...e.restrictDataSetIds):L().string();return{viewId:L().string().allow("").optional().description("__vizzly_hide_from_docs"),displayTitle:L().string().allow("").description("A title that explains what is being displayed."),displaySubject:L().string().allow("").description("A chance to add a more detailed description of what is being shown."),dataSetId:t.description("The ID of the data set that is being used by the view."),protectedByOrganisation:L().boolean().optional().description("Has the view been created by your organisation, and therefore cannot be modified by your users?")}},K=L().valid("auto",2,0).description("Determine how many axis labels should be shown on the axis"),Q=(e,t)=>({measure:L().array().items(B(e.supportedAggregates,t)).required().description("A list of metrics that are to be shown. For example the `count` of a specific field in your data set."),dimension:V(e.supportedTimeTruncFunctions,t).required(),order:L().array().items(G(e)),limit:X(),offset:L().number().min(0).description("Paginate results by using this property with limit.")}),Z=(e,t)=>Object.assign(Object.assign({},Q(e,t)),{filter:L().array().items(L().array().items(H(e))),timeDimension:L().alternatives(U(e.supportedTimeTruncFunctions),L().valid(null)).required(),drilldown:L().alternatives(V(e.supportedTimeTruncFunctions,t).required(),L().string()),xAxisPrefix:L().string().allow("").description("Add a prefix to the X Axis"),yAxisPrefix:L().string().allow("").description("Add a prefix to the Y Axis"),xAxisPostfix:L().string().allow("").description("Add a postfix to the X Axis"),yAxisPostfix:L().string().allow("").description("Add a postfix to the Y Axis"),yAxisFormat:L().alternatives(L().string(),L().valid(null)).description("ID of the formatting function to apply to the Y Axis values"),xAxisFormat:L().alternatives(L().string(),L().valid(null)).description("ID of the formatting function to apply to the X Axis values"),approxYAxisLabelCount:K,approxXAxisLabelCount:K}),J=L().string().valid("natural","straight","step","stepBefore","stepAfter"),ee=e=>L().array().items(L().object({function:L().string().valid(...Object.keys(e.supportedAggregates),...Object.keys(e.supportedTimeTruncFunctions),"none"),field:L().string().required().description("The ID of the field from the data set to reference.")})),te=e=>L().array().items(L().object({function:L().string().valid(...Object.keys(e.supportedAggregates),...Object.keys(e.supportedTimeTruncFunctions),"none"),truncate:L().string(),field:L().string().required().description("The ID of the field from the data set to reference."),bucketFill:L().boolean().optional(),pivot:L().string().valid("x","y").optional()})),re=(e,t)=>L().object().pattern(L().string(),L().alternatives().try(L().array().items(U(e.supportedTimeTruncFunctions)).min(1),V(e.supportedTimeTruncFunctions,t))).unknown(!0),ne=(e,t)=>L().object().pattern(L().string(),L().array().items(B(e.supportedAggregates,t)).min(1)).unknown(!0),ie=(e,t)=>L().object({measure:ne(e,t),group:re(e,t)}),oe=()=>L().array().items(L().object({color:L().string().required(),value:L().number().required(),strokeWidth:L().number().required(),strokeStyle:L().string().valid("dashed","solid").required(),label:L().boolean().optional()})),ae=()=>L().object({func:L().string().valid("mean","sum","current").allow(null).optional()}),se=()=>L().object({x:L().string().allow(""),y:L().string().allow("")}),le=L().object().pattern(L().string(),L().object({width:L().number().min(0),height:L().number().min(0)})),ue=e=>L().object({filters:L().array().items(L().array().items(H(e)).required().max(1)).required().max(1),ruleValue:L().string().allow("").required(),ruleValueEnd:L().string().allow(""),ruleType:L().valid("backgroundColor","fontColor","lineColor","areaColor").required()}).description("A rule used to conditionally format a view."),ce=L().object({field:L().string().required().description("ID of the field in the data set to add a prefix too."),prefix:L().string().required().description("The prefix to be applied.")}),de=e=>L().array().items(ue(e)).description("Apply formatting based on a set of defined rules."),pe=e=>L().object(Object.assign(Object.assign(Object.assign({},W(e.attributesSchemaOptions)),Z(e.queryEngineConfig,e.attributesSchemaOptions)),{stacked:L().valid(!0,!1,"100%"),legend:L().valid(!0,!1),type:L().valid("barChart","horizontalBarChart").required(),conditionalFormattingRules:de(e.queryEngineConfig),protectedFields:L().object({dimension:te(e.queryEngineConfig),measure:ee(e.queryEngineConfig)}).unknown(!0),parameters:ie(e.queryEngineConfig,e.attributesSchemaOptions),goalLines:oe(),axisTitles:se(),headline:ae(),tags:z(),drilldownOptions:L().array().items(L().object({field:L().string().required(),function:L().string().valid(...Object.keys(e.queryEngineConfig.supportedAggregates),...Object.keys(e.queryEngineConfig.supportedTimeTruncFunctions),"none")}))})),fe=e=>(t,r)=>{let n=P(t,r,pe(e));return n=N(n),n};class he extends Error{constructor(e){super(e),this.name="ValidationError"}}const me=he;class ge extends me{constructor(e){super(`Corrupt view. ${e.message}.\n\n ${JSON.stringify(e)}\n `),this.name="CorruptedView"}}r(3514);const ye=(e,t)=>t.length>0&&t[0].length>0?{type:"function",function:e.aggregate,value:{type:"switchField",value:{cases:[{returns:{type:"field",function:"none",value:e.fieldId},filter:t},{returns:{type:"null"},filter:[[{value:1,op:"=",field:{type:"number",value:1}}]]}]}}}:{type:"field",function:e.aggregate,value:e.fieldId},be=(e,t,r)=>e.map((({rule:e,name:n})=>({returns:{type:"string",value:n},filter:je(e,t,r)}))),ve=e=>"leftFieldId"in e&&"operator"in e&&"rightFieldId"in e,_e=e=>"roundToDecimalPlaces"in e,Ae=e=>"leftFieldId"in e&&"leftFunction"in e&&"operator"in e&&"rightFieldId"in e&&"rightFunction"in e,we=e=>"denominatorFieldId"in e||"numeratorFieldId"in e,Se=e=>"rules"in e,Te=e=>"rule"in e,Ee=e=>"dateCalculationFunction"in e,Oe=e=>we(e)||ve(e)||Ae(e)||Se(e)||_e(e)||Ee(e)||Te(e),xe=(e,t,r,n,i,o)=>{if(we(t))return((e,t,r,n,i)=>{var o,a,s,l;const{combinedNominatorFilters:u,combinedDenominatorFilters:c}=function(e,t){let r=[],n=[];return t.numeratorFilter&&Re(t.numeratorFilter)?t.numeratorFilter.forEach((t=>{r=[...r,...Ie(null!=e?e:[],t)]})):r=null!=e?e:[],t.denominatorFilter&&Re(t.denominatorFilter)?t.denominatorFilter.forEach((t=>{n=[...n,...Ie(null!=e?e:[],t)]})):n=null!=e?e:[],{combinedNominatorFilters:r,combinedDenominatorFilters:n}}(i,e),d={fieldId:null!==(o=e.numeratorFieldId)&&void 0!==o?o:e.denominatorFieldId,aggregate:null!==(a=e.numeratorAggregate)&&void 0!==a?a:e.denominatorAggregate},p={fieldId:null!==(s=e.denominatorFieldId)&&void 0!==s?s:e.numeratorFieldId,aggregate:null!==(l=e.denominatorAggregate)&&void 0!==l?l:e.numeratorFieldId},f={type:"subquery",value:{measure:[{type:"field",value:e.denominatorFieldId,function:e.denominatorAggregate}],filter:je(c||[],t,r)}},h=ye(p,Re(e.denominatorFilter)?je(c,t,r):[]);return{type:"maths",left:ye(d,Re(e.numeratorFilter)?je(u,t,r):[]),op:"/",right:"withinGrouping"===e.denominatorScope?h:f}})(t,r,n,0,o);if(Se(t))return((e,t,r,n)=>{const i={type:"switchField",value:{cases:be(t.rules,r,n)}};return"none"==e.function?i:{type:"function",function:e.function,value:i}})(e,t,r,n);if(Ae(t))return(e=>{const t=(e,t,r)=>r?{type:"maths",left:{type:"field",value:e,function:t},right:{type:"field",value:r.fieldId,function:r.function},op:r.operator}:{type:"field",value:e,function:t};return{type:"maths",left:t(e.leftFieldId,e.leftFunction,e.leftNested),right:t(e.rightFieldId,e.rightFunction,e.rightNested),op:e.operator}})(t);if(ve(t))return((e,t)=>"none"!=e.function?{type:"function",function:e.function,value:{type:"maths",left:{type:"field",value:t.leftFieldId,function:"none"},right:{type:"field",value:t.rightFieldId,function:"none"},op:t.operator}}:{type:"maths",left:{type:"field",value:t.leftFieldId,function:"none"},right:{type:"field",value:t.rightFieldId,function:"none"},op:t.operator})(e,t);if(_e(t))return((e,t)=>{const r={type:"field",function:`round_to_${t.roundToDecimalPlaces}_dp`,value:t.fieldId};return"none"==e.function?r:{type:"function",function:e.function,value:r}})(e,t);if(Te(t))return((e,t,r)=>({type:"function",function:e.function,value:{type:"switchField",value:{cases:[{returns:{type:"field",function:"none",value:e.fieldId},filter:je(e.rule,t,r)},{returns:{type:"null"},filter:[[{value:1,op:"=",field:{type:"number",value:1}}]]}]}}}))(t,r,n);if(Ee(t))return((e,t)=>"none"!=e.function?{type:"function",function:e.function,value:{type:"date_maths",op:t.dateCalculationFunction,left:{type:"field",function:"none",value:t.leftFieldId},right:{type:"field",function:"none",value:t.rightFieldId}}}:{type:"date_maths",op:t.dateCalculationFunction,left:{type:"field",function:"none",value:t.leftFieldId},right:{type:"field",function:"none",value:t.rightFieldId}})(e,t);throw`Unsupported custom field type; ${JSON.stringify(t)}`},Ce=e=>{var t,r;if("leftAggregate"in e||"rightAggregate"in e){let t=Object.assign(Object.assign({},e),{rightFunction:e.rightFunction||e.rightAggregate,leftFunction:e.leftFunction||e.leftAggregate,leftNested:e.leftNested?Object.assign(Object.assign({},e.leftNested),{aggregate:void 0,function:e.leftNested.function||e.leftNested.aggregate}):void 0,rightNested:e.rightNested?Object.assign(Object.assign({},e.rightNested),{aggregate:void 0,function:e.rightNested.function||e.rightNested.aggregate}):void 0});return delete t.leftAggregate,delete t.rightAggregate,t.rightNested&&delete t.rightNested.aggregate,t.leftNested&&delete t.leftNested.aggregate,t}if("numeratorFieldId"in e&&!("version"in e)){const n=[...(null===(t=e.numeratorFilter)||void 0===t?void 0:t[0])||[],...(null===(r=e.denominatorFilter)||void 0===r?void 0:r[0])||[]];return Object.assign(Object.assign({},e),{version:2,denominatorScope:e.denominatorScope||"all",denominatorFilter:(null==e?void 0:e.denominatorFilter)||[],numeratorFilter:n.length>0?[n]:[]})}return e},Ie=(e,r)=>(e&&!(0,t.isEmpty)(e)||(e=[[]]),[...e].map((e=>[...e,...r]))),je=(e,t,r)=>e.map((n=>[...n].flatMap((n=>{var i,o;if(n.function&&!s(t.supportedTimeTruncFunctions,n.function))throw`Query engine does not support the query function ${n.function}.`;const a=mt(r,n.field);let l={type:"field",value:n.field,function:null!==(i=n.function)&&void 0!==i?i:"none"};if(Oe(a)&&(l=xe({field:a.id,function:null!==(o=n.function)&&void 0!==o?o:"none"},a,t,r,0,e)),"array_contains"==n.op&&Array.isArray(n.value))return[...n.value].map((e=>({field:l,op:n.op,value:e})));let u=n.value;return function(e){const{error:t}=q.validate(e);return!t}(n.value)&&(u=$(n.value)),[{field:l,op:n.op,value:u}]})))),Re=e=>e&&(0,t.isArray)(e)&&(0,t.isArray)(e[0]),De=(e,t)=>[[...e,t],e.length],Fe=(e,t,r,n,i,o,a,l,u)=>{let c=[],d=[],p=[],f=[],h=[];if(o){let t;if(!s(u.supportedTimeTruncFunctions,o.truncate))throw`Query engine does not support the time trunc function ${o.truncate}.`;[d,t]=De(d,{type:"field",value:o.field,function:o.truncate}),c=[...c,{functionId:o.truncate,field:mt(e,o.field)}],p=[...p,{index:t}]}return i.forEach((t=>{let r;[d,r]=De(d,{type:"field",value:null==t?void 0:t.field,function:t.function}),c=[...c,{functionId:t.function,field:mt(e,t.field)}],p=[...p,{index:r}]})),t.forEach((t=>{if(r=u.supportedAggregates,n=t.function,![...Object.keys(r),"none"].includes(n))throw`Query engine does not support the query function ${t.function}.`;var r,n;[d]=De(d,{type:"field",value:t.field,function:t.function}),c=[...c,{functionId:t.function,field:mt(e,t.field)}]})),r.forEach((e=>{const t=d.findIndex((t=>{if("field"==t.type){const r=t.function==e.function;return t.value==e.field&&r}return!1}));t>=0&&(f=[...f,{index:t,direction:e.direction}])})),n.forEach((t=>{const r=je([t],u,e);h=[...h,r[0]]})),d=d.map((t=>{if("field"==t.type&&"string"==typeof t.value){const r=mt(e,t.value);if(Oe(r))return xe({function:t.function,field:t.value},r,u,e,ct({group:p}),n)}return t})),{query:{type:"query",dataSetId:e.id,measure:d,group:p,filter:h,order:f,limit:a,offset:l},measureDescription:c}};var Ne=r(6342);const Pe=e=>L().alternatives((e=>L().object({type:L().valid("function").required(),value:L().link("#Measure"),function:L().valid("none",...Object.keys(e.supportedAggregates))}))(e),L().object({type:L().valid("null").required()}),L().object({type:L().valid("boolean").required(),value:L().boolean().allow(null)}),L().object({type:L().valid("string").required(),value:L().string().allow("")}),L().object({type:L().valid("maths").required(),left:L().link("#Measure"),right:L().link("#Measure").required(),op:L().string().valid("+","*","/","-").required()}),L().object({type:L().valid("date_maths").required(),left:L().link("#Measure").required(),right:L().link("#Measure").required(),op:L().string().valid(...Ne.DATE_MATHS_OPERATORS).required()}),L().object({type:L().valid("subquery").required(),value:L().object({measure:L().array().items(L().link("#Measure")),filter:L().array().items(L().array().items(L().link("#Filter")))})}),(e=>L().object({type:L().valid("field").required(),value:L().string().required(),function:L().valid("none",...Object.keys(e.supportedAggregates),...Object.keys(e.supportedTimeTruncFunctions),...Object.keys(e.supportedTransformationFunctions)).required()}))(e),L().object({type:"number",value:L().number()}),L().object({type:L().valid("switchField").required(),value:L().object({cases:L().array().items(L().object({returns:L().link("#Measure"),filter:L().array().items(L().array().items(L().link("#Filter")))}))})})).id("Measure"),Me=L().object({index:L().number().required()}),Le=L().object({index:L().number().required(),direction:L().string().valid("asc","desc").required()}),ke=(e,t)=>{let r=[L().valid(null)];return t.forEach((e=>{"boolean"==e&&(r=[...r,L().boolean()]),"string"==e&&(r=[...r,L().string()]),"string[]"==e&&(r=[...r,L().string(),L().number()]),"number"==e&&(r=[...r,L().number()]),"date_time"==e&&(r=[...r,L().date().iso()])})),"is_one_of"==e||"is_not_one_of"==e?L().array().items(L().alternatives(r)):L().alternatives(r)},qe=e=>L().object({field:Pe(e),op:L().string().valid(...Object.keys(e.supportedOperators)),value:L().alternatives().conditional("op",Object.keys(e.supportedOperators).map((t=>({is:t,then:ke(t,e.supportedOperators[t].validDataTypes)}))))}).id("Filter"),$e=e=>{const t=qe(e);return L().alternatives(L().object({type:L().valid("preparedQuery").required(),preparedQueryType:L().valid("uniqueArrayValues").required(),dataSetId:L().string().required(),fieldId:L().string().required(),filter:L().array().items(L().array().items(t))}),L().object({type:L().valid("preparedQuery").required(),preparedQueryType:L().valid("preAggregated").required(),dataSetId:L().string().required(),filter:L().object().pattern(L().string(),L().array().items(L().array().items(t)))}))},ze=e=>{const t=qe(e),r=Pe(e);return L().alternatives().conditional(".type",{is:"query",then:L().object({type:L().valid("query"),dataSetId:L().string().required(),measure:L().array().items(r).min(1).required(),group:L().array().items(Me).required(),filter:L().array().items(L().array().items(t)).required(),order:L().array().items(Le).required(),limit:X(),offset:L().number().optional()}).shared(t).shared(r)}).conditional(".type",{is:"preparedQuery",then:$e(e)})},Be=(ze(o.QueryEngineConfig.getQueryEngineConfig("postgres")),ze(o.QueryEngineConfig.getQueryEngineConfig("snowflake")),ze(o.QueryEngineConfig.getQueryEngineConfig("mariadb")),ze(o.QueryEngineConfig.getQueryEngineConfig("mysql")),ze(o.QueryEngineConfig.getQueryEngineConfig("bigquery")),ze(o.QueryEngineConfig.getQueryEngineConfig("redshift")),"dateFilter"),Ge="dateAndTimeFilter",Ue="singleSelectFilter",Ve="multiSelectFilter",He="numericFilter",Ye=e=>"fields"in e?(e=>{if("globalSelectFilter"==e.type)return{type:"singleSelectFilter",title:e.title,value:null,requiresValue:!1,managedByConfiguration:!1,appliesToFields:e.fields.map((e=>({fieldId:e.field,dataSetId:e.dataSetId})))};if("globalDateTimeFilter"==e.type)return{type:"dateFilter",value:null,requiresValue:!1,managedByConfiguration:!1,title:e.title,appliesToFields:e.fields.map((e=>({fieldId:e.field,dataSetId:e.dataSetId})))};throw`Unrecognised global filter. ${JSON.stringify(e)}`})(e):Object.assign(Object.assign({},e),{type:Qe(e.type)}),Xe=(e,t,r)=>t.appliesToFields.flatMap((n=>{var i,o,a;if(n.dataSetId!=e.id)return[];if(null==t.value)return[];if("string[]"==mt(e,n.fieldId).dataType)return[{field:n.fieldId,op:"array_contains",value:t.value}];if((t.type==Be||t.type==Ge)&&"relativeRange"==(null===(i=t.value)||void 0===i?void 0:i.type))return[];if((t.type==Be||t.type==Ge)&&"fixedRange"==(null===(o=t.value)||void 0===o?void 0:o.type))return[{field:n.fieldId,op:Je(Ze.Greater,t),value:t.value.after},{field:n.fieldId,op:Je(Ze.Less,t),value:t.value.before}];if((t.type==Be||t.type==Ge)&&"relative"==(null===(a=t.value)||void 0===a?void 0:a.type)){let{before:e,after:i}=r[t.value.value].range,o=[];return e&&(o=[...o,{field:n.fieldId,op:Je(Ze.Less,t),value:e}]),i&&(o=[...o,{field:n.fieldId,op:Je(Ze.Greater,t),value:i}]),o}if(t.type==Ue)return[{field:n.fieldId,op:"=",value:t.value}];if(t.type==Ve&&t.value.length>0)return[{field:n.fieldId,op:"is_one_of",value:t.value}];if(t.type==Be&&!t.value||t.type==Ge&&!t.value||t.type==Ve&&0===t.value.length)return[];if(t.type==He)return t.value?[{field:n.fieldId,op:t.value.op,value:t.value.value}]:[];throw`Cannot convert filter type ${t.type} to query attributes filter. ${JSON.stringify(t)}`})),We=(e,t)=>{var r;if("relativeRange"!==(null===(r=e.value)||void 0===r?void 0:r.type))return[];if(0===e.value.filters.length)return[];let n=[];return((e,t)=>{if(!t)throw new Error("appliesToFields is required");return e.map((e=>{const r=e.map((e=>({op:e.op,value:Object.assign({},e.value)}))),n=[];return t.forEach((e=>{r.forEach((t=>{n.push(Object.assign(Object.assign({},t),{field:e.fieldId}))}))})),n}))})(e.value.filters,e.appliesToFields)[0].forEach((e=>{n.push({field:e.field,op:e.op,value:$(e.value,t)})})),n},Ke=(e,t,r)=>{let n=[];return(e.globalFilters||[]).forEach((e=>{let i=[];e.type!==Ge&&e.type!==Be||(i=We(e)),n=[...n,...i,...Xe(t,e,r)]})),Object.values(e.localFilters||{}).flat().forEach((e=>{let i=[];e.type!==Ge&&e.type!==Be||(i=We(e)),n=[...n,...i,...Xe(t,e,r)]})),n},Qe=e=>"dateTimeFilter"===e?Be:e;var Ze;function Je(e,t){switch(e){case Ze.Greater:return t.inclusiveDate?">=":">";case Ze.Less:return t.inclusiveDate?"<=":"<";default:throw new Error("Unknown date operation")}}!function(e){e[e.Greater=0]="Greater",e[e.Less=1]="Less"}(Ze||(Ze={}));const et=L().object({fieldId:L().string().required(),dataSetId:L().string().required()}),tt=e=>L().object().pattern(L().string(),L().array().items(H(e)).optional()),rt=e=>({title:L().string().allow(""),managedByConfiguration:L().boolean().optional(),requiresValue:L().boolean().optional(),optionsFilters:tt(e).optional(),appliesToFields:L().array().items(et).required(),optionsPulledFrom:L().array().items(et).optional(),hidden:L().boolean(),options:L().array().items(L().object({value:L().allow(L().number(),L().string()),label:L().string()})).optional()}),nt=(e,t)=>L().object(Object.assign(Object.assign({},rt(e)),{type:L().valid(Ue).required(),value:L().alternatives(L().string(),L().number(),L().boolean(),L().valid(...t?[]:[null]))})),it=(e,t)=>L().object(Object.assign(Object.assign({},rt(e)),{type:L().valid(Ve).required(),value:L().alternatives(L().array().items(L().string(),L().number()).single(),L().valid(...t?[]:[null]))})),ot=(e,t,r)=>L().object(Object.assign(Object.assign({},rt(e)),{type:L().valid(r).required(),inclusiveDate:L().boolean().optional(),value:L().alternatives(L().valid(...t?[]:[null]),L().object({type:L().valid("fixedRange"),before:L().alternatives(L().date()).required(),after:L().alternatives(L().date()).required()}),L().object({type:L().valid("relative"),value:L().string()}),L().object({type:L().valid("relativeRange"),filters:L().array()}))})),at=(e,t)=>L().object(Object.assign(Object.assign({},rt(e)),{type:L().valid(He).required(),value:L().alternatives(L().object({op:L().allow("=","<",">","<=",">="),value:L().number().allow(null,0)}),L().valid(...t?[]:[null]))})),st=(e,t)=>L().alternatives().conditional(".type",{is:Ue,then:nt(e,t)}).conditional(".type",{is:Be,then:ot(e,t,Be)}).conditional(".type",{is:Ge,then:ot(e,t,Ge)}).conditional(".type",{is:Ve,then:it(e,t)}).conditional(".type",{is:He,then:at(e,t)});function lt(e){return L().array().items(L().custom(((t,r)=>{if(!e)return r.error("any.invalid");const n=st(e,!!t.requiresValue),{error:i}=n.validate(t);return i?r.error("any.invalid",{message:i.message}):t}))).required()}const ut=Fe,ct=e=>e.group.length>0,dt=(e,t,r)=>({query:{type:"preparedQuery",preparedQueryType:"uniqueArrayValues",dataSetId:e,fieldId:t.id,filter:r||[]},resultFields:[{id:t.id,publicName:t.publicName,dataType:t.dataType}]});class pt extends me{constructor(e,t){super(`\n An expected field is missing from a dataSet.\n\n Missing '${t}'. Got;\n ${JSON.stringify(e)}\n `),this.name="FieldNotFoundInDataSet",this.missingFieldId=t}getMissingFieldId(){return this.missingFieldId}}function ft(e,r){let n=[...e];return(null==r?void 0:r.onlyFieldTypes)&&!(0,t.isEmpty)(r.onlyFieldTypes)&&(n=[...n].filter((e=>{var t;return null===(t=null==r?void 0:r.onlyFieldTypes)||void 0===t?void 0:t.includes(e.dataType)}))),(null==r?void 0:r.forComponent)&&(n=((e,t)=>{const r=an(t);return[...e].filter((e=>{let t=!0;return we(e)&&!r.supportedCustomFields.percentages&&(t=!1),ve(e)&&!r.supportedCustomFields.simpleMaths&&(t=!1),Se(e)&&!r.supportedCustomFields.rules&&(t=!1),_e(e)&&!r.supportedCustomFields.roundedNumbers&&(t=!1),Te(e)&&!r.supportedCustomFields.conditional&&(t=!1),Ee(e)&&!r.supportedCustomFields.dateCalculations&&(t=!1),t}))})(n,r.forComponent)),(null==r?void 0:r.removePercentage)&&(n=n.filter((e=>!we(e)))),(null==r?void 0:r.removeRuleGrouping)&&(n=n.filter((e=>!Se(e)))),(null==r?void 0:r.removeSimpleMaths)&&(n=n.filter((e=>!ve(e)))),(null==r?void 0:r.removeAggregateMaths)&&(n=n.filter((e=>!Ae(e)))),(null==r?void 0:r.removeDateCalculations)&&(n=n.filter((e=>!Ee(e)))),(null==r?void 0:r.removeConditional)&&(n=n.filter((e=>!Te(e)))),(null==r?void 0:r.onlyDimensions)&&(n=n.filter((e=>e.canBeDimension))),(null==r?void 0:r.onlyMeasures)&&(n=n.filter((e=>e.canBeMeasure))),n}const ht=(e,t)=>e.find((e=>e.id==t))||null,mt=(e,t)=>{let r=[...e.fields].find((e=>e.id==t));if(r)return r;throw new pt(e,t)},gt=(e,r)=>{const n=(0,t.findIndex)(e,(e=>e.id==r));return[e[n]||null,n]},yt=(e,t)=>[...ft(e.fields,{onlyFieldTypes:["number","string","boolean"],onlyMeasures:!0,forComponent:t})],bt=e=>Object.assign(Object.assign({},e),{fields:[...e.fields].filter((e=>!Oe(e)))}),vt=(e,t,r)=>{const n="horizontalBarChart"===r?void 0:"x",i=(e=>[...ft(e.fields,{onlyFieldTypes:["boolean","number","string"],onlyDimensions:!0,removePercentage:!0,removeSimpleMaths:!0,removeAggregateMaths:!0})])(e)[0],o=[...yt(e,r)].map((e=>{const r=(n=e,i=t.supportedAggregates,((e,t)=>{var r;let n=null!==(r=e.supportedAggregateOptions)&&void 0!==r?r:[],i=n.filter((r=>Object.keys(t).includes(r)&&t[r].validDataTypes.includes(e.dataType)));return 0===i.length?i=Object.keys(t).filter((r=>t[r].validDataTypes.includes(e.dataType))):i.sort(((e,t)=>n.indexOf(e)-n.indexOf(t))),i})(n,i)[0]);var n,i;return{field:e.id,function:r}}));return{dataSetId:e.id,measure:o,order:[],timeDimension:null,filter:[],dimension:i?[{field:i.id,function:"none",pivot:n}]:[]}},_t=(e,t)=>t?(e=e.map(bt),[...[...e].map((e=>{const r=(t[e.id]||[]).map(Ce);return Object.assign(Object.assign({},e),{fields:[...e.fields,...r]})}))]):e;class At extends me{constructor(e,t){super(`\n An expected data set is missing from the dashboard.\n\n Missing '${t}'. Got;\n ${JSON.stringify([...e].map((e=>e.id)))}\n `),this.name="DataSetNotFound"}}const wt={allowUnknown:!0,stripUnknown:!0},St=(e,t,r)=>{const{error:n}=an(e.type,{queryEngineConfig:r}).schema.validate(e,wt);if(n)return[new ge(n)];const i=ht(t,e.dataSetId);if(!i)return[new At(t,e.dataSetId)];const o=(e=>{let t=[];return(e=>{let t=[];return"measure"in e&&e.measure&&(t=[...t,...e.measure]),"xMeasure"in e&&e.xMeasure&&(t=[...t,e.xMeasure]),"yMeasure"in e&&e.yMeasure&&(t=[...t,e.yMeasure]),t})(e).forEach((e=>{t=[...t,e.field]})),(e=>{let t=[];return"dimension"in e&&e.dimension&&(t=[...t,...e.dimension]),"lineDimension"in e&&e.lineDimension&&(t=[...t,...e.lineDimension]),"barDimension"in e&&e.barDimension&&(t=[...t,...e.barDimension]),t})(e).forEach((e=>{t=[...t,e.field]})),"order"in e&&e.order&&(t=[...t,...[...e.order].map((e=>e.field))]),"timeDimension"in e&&e.timeDimension&&(t=[...t,e.timeDimension.field]),t})(e);try{o.forEach((e=>{mt(i,e)}))}catch(e){if(e instanceof pt)return[e];throw e}return[]},Tt=e=>{return!!(e=>{var t;return"comboChart"===e.type?!!e.timeDimension||!!(e.barDimension.length>0&&e.lineDimension.length>0):"barChart"!==e.type&&"lineChart"!==e.type&&"areaChart"!==e.type&&"horizontalBarChart"!==e.type&&"scatterChart"!==e.type&&"pieChart"!==e.type||!!e.timeDimension||!(null==e?void 0:e.dimension)||0!==(null===(t=null==e?void 0:e.dimension)||void 0===t?void 0:t.length)})(e)||("barChart"===(t=e).type?"The Column Chart needs to have a grouping or a time to display correctly.":"lineChart"===t.type?"The Line Chart needs to have a grouping or a time to display correctly.":"areaChart"===t.type?"The Area Chart needs to have a grouping or a time to display correctly.":"horizontalBarChart"===t.type?"The Horizontal Bar Chart needs to have a grouping or a time to display correctly.":"comboChart"===t.type?"The Combo Chart needs to have a grouping (Bar and Line), or have time set to display correctly.":"scatterChart"===t.type?"The Scatter Chart needs to have a grouping to display correctly.":"pieChart"===t.type?"The Pie Chart needs to have a grouping to display correctly.":null);var t},Et={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let Ot;const xt=new Uint8Array(16);function Ct(){if(!Ot&&(Ot="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Ot))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ot(xt)}const It=[];for(let e=0;e<256;++e)It.push((e+256).toString(16).slice(1));const jt=function(e,t,r){if(Et.randomUUID&&!t&&!e)return Et.randomUUID();const n=(e=e||{}).random||(e.rng||Ct)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(let e=0;e<16;++e)t[r+e]=n[e];return t}return function(e,t=0){return It[e[t+0]]+It[e[t+1]]+It[e[t+2]]+It[e[t+3]]+"-"+It[e[t+4]]+It[e[t+5]]+"-"+It[e[t+6]]+It[e[t+7]]+"-"+It[e[t+8]]+It[e[t+9]]+"-"+It[e[t+10]]+It[e[t+11]]+It[e[t+12]]+It[e[t+13]]+It[e[t+14]]+It[e[t+15]]}(n)};const Rt=e=>e||`view_${jt()}`;function Dt(e){const t=e,{parentDimension:r}=t;return function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r}(t,["parentDimension"])}const Ft=(e,r,n)=>{let i=(0,t.cloneDeep)(ft(r.fields,{onlyFieldTypes:["boolean","string"]})),o=(0,t.cloneDeep)(ft(r.fields,{onlyFieldTypes:["date_time"]})),a=(0,t.cloneDeep)(ft(r.fields,{onlyFieldTypes:["number"]})),s=null;return o[0]&&(s={field:o[0].id,truncate:"none"}),n(e,{protectedByOrganisation:!0,dimension:i.map((e=>({field:e.id,function:"none"}))),measure:[...a].map((e=>({function:"none",field:e.id}))),order:[],timeDimension:s})},Nt=(e,r)=>{let n=null,i=(0,t.cloneDeep)(e);return i.forEach((e=>{const t=mt(r,e.field);"date_time"==t.dataType&&(n={field:t.id,truncate:e.function})})),i=i.filter((e=>"date_time"!=mt(r,e.field).dataType)),{timeDimension:n,dimension:i}},Pt=e=>{let t=[...e.dimension];return"timeDimension"in e&&e.timeDimension&&(t=[{field:e.timeDimension.field,function:e.timeDimension.truncate},...t]),t},Mt=e=>{if(!e)return;let r=(0,t.cloneDeep)(e);return r.measure=f(e.measure||[]),r},Lt=(e,r)=>{let n=[];return(0,t.isEmpty)(r)||void 0===r?[]:(null==r||r.map((t=>{if((null==t?void 0:t.ruleType)&&(null==t?void 0:t.ruleValue)){let r=[];const i="field"in t&&"string"==typeof t.field&&"operator"in t&&"string"==typeof t.operator&&"value"in t;if(null==t?void 0:t.filters){const n=t.filters.map((t=>t.map((t=>kt(t,e)))));r.push(...n)}else i&&r.push([kt({field:t.field,op:t.operator,value:t.value},e)]);n.push({filters:r,ruleValueEnd:null==t?void 0:t.ruleValueEnd,ruleValue:t.ruleValue,ruleType:t.ruleType})}})),n)},kt=(e,t)=>{var r;const n=O(e.field,t),i="none"!==n.function?n.function:null!==(r=e.function)&&void 0!==r?r:"none";return{field:n.field,op:e.op,value:e.value,function:i}},qt={title:"Column chart",description:"Uses bars to compare different sets of data.",namespace:"bar_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this bar chart?"},views:{type:"views",title:"View",description:""},field_y_axis:{type:"fieldCollector",title:"Metric - Y Axis",description:"What do you want each bar to measure?",callToAction:"Add metric"},drilldown:{type:"drilldown",title:"Drilldown",description:"After clicking on a segment of this bar chart, what information do you want to see next?"},field_x_axis:{type:"fieldCollector",title:"Grouping - X Axis",description:"What do you want each bar to represent? An example might be a `product category` field to represent each category as a bar.",callToAction:"Add grouping"},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this bar chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this bar chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{stacked:{type:"stacked",title:"Layout",description:"",namespace:"stacked"},legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"}}},headline:{type:"headline",title:"Headline",description:""},goal_line:{type:"goalLine",title:"Goal Lines",description:""},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""}}};function $t(e,t){return(t=>t in e.format_panel)(t)?Object.assign(Object.assign({},e.format_panel[t]),{namespace:t}):Object.assign(Object.assign({},e.data_panel[t]),{namespace:t})}function zt(e,t){var r;return null===(r=e.format_panel.axis_labels)||void 0===r?void 0:r.subSectionDefinition[t]}function Bt(e){return Object.assign(Object.assign({},$t(e,"heading")),{subSection:[e.format_panel.heading.subSectionDefinition.title,e.format_panel.heading.subSectionDefinition.subject]})}function Gt(e){return Object.assign(Object.assign({},$t(e,"axis_labels")),{y:Object.assign(Object.assign({},zt(e,"y")),{prefix:zt(e,"y.prefix"),postfix:zt(e,"y.postfix"),format:zt(e,"y.format"),count:zt(e,"y.count"),axisTitle:zt(e,"y.axis_title")}),x:Object.assign(Object.assign({},zt(e,"x")),{prefix:zt(e,"x.prefix"),postfix:zt(e,"x.postfix"),format:zt(e,"x.format"),count:zt(e,"x.count"),axisTitle:zt(e,"x.axis_title")})})}function Ut(e,t,r){var n,i,o,a,s;return t?Object.assign(Object.assign({},$t(e,"chart_styles")),{subSection:[null===(n=e.format_panel.chart_styles)||void 0===n?void 0:n.subSectionDefinition.curve,null===(i=e.format_panel.chart_styles)||void 0===i?void 0:i.subSectionDefinition.legend]}):r?Object.assign(Object.assign({},$t(e,"chart_styles")),{subSection:[null===(o=e.format_panel.chart_styles)||void 0===o?void 0:o.subSectionDefinition.stacked,null===(a=e.format_panel.chart_styles)||void 0===a?void 0:a.subSectionDefinition.legend]}):Object.assign(Object.assign({},$t(e,"chart_styles")),{subSection:[null===(s=e.format_panel.chart_styles)||void 0===s?void 0:s.subSectionDefinition.legend]})}function Vt(e,t){var r;return Object.assign(Object.assign({},null===(r=e.format_panel.stats_labels)||void 0===r?void 0:r.subSectionDefinition[t]),{namespace:t})}const Ht=(e,t)=>{if("current"===(null==e?void 0:e.func)&&t)return e},Yt=e=>({title:qt.title,description:qt.description,servicesClass:"BarChart",namespace:qt.namespace,dump:e=>e,load:t=>{var r;return Object.assign(Object.assign({},t),{measure:f(t.measure),order:p(t.order,t.timeDimension),filter:d(t.filter),protectedFields:Mt(t.protectedFields),viewId:Rt(t.viewId),dimension:x(t.dimension),approxXAxisLabelCount:h(t.approxXAxisLabelCount),approxYAxisLabelCount:h(t.approxYAxisLabelCount),parameters:m(t.parameters),conditionalFormattingRules:Lt(e.queryEngineConfig,t.conditionalFormattingRules),headline:Ht(t.headline,t.timeDimension),tags:null!==(r=t.tags)&&void 0!==r?r:[],drilldownOptions:t.drilldownOptions})},setAttributes:fe(e),validate:(t,r)=>St(t,r,e.queryEngineConfig),init:(e,t)=>Object.assign({type:"barChart",measure:[],dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",viewId:Rt(null==t?void 0:t.viewId),filter:[],order:[],stacked:void 0,dataSetId:e,limit:5e3,conditionalFormattingRules:[],protectedByOrganisation:void 0,protectedFields:void 0,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,drilldown:[],legend:!0,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",parameters:{},goalLines:void 0,axisTitles:void 0,headline:void 0,tags:[],drilldownOptions:void 0},t),createFeedback:Tt,schema:pe(e),removeField:(t,r)=>F(t,r,e.queryEngineConfig),isRunnable:e=>e.measure.length>0,autoGenerate(t){const{measure:r,dimension:n}=vt(t,e.queryEngineConfig,"barChart");return this.init(t.id,{measure:[r[0]],dimension:n})},dataPanelConfig:()=>[$t(qt,"data_set"),$t(qt,"views"),Object.assign(Object.assign({},$t(qt,"field_y_axis")),{fieldFilterOptions:{forComponent:"barChart",onlyMeasures:!0},preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"}),Object.assign(Object.assign({},$t(qt,"field_x_axis")),{fieldFilterOptions:{forComponent:"barChart",onlyDimensions:!0},preventDuplicates:!0,preSetPartialAttributes:(e,t)=>Nt(e,t),getValues:e=>Pt(e),maxAllowed:2,testId:"add-dimension"}),$t(qt,"sort"),$t(qt,"filter"),Object.assign(Object.assign({},$t(qt,"drilldown")),{options:{property:"drilldownOptions"}}),$t(qt,"custom_metrics"),$t(qt,"limit")],formatPanelConfig:()=>[Bt(qt),Ut(qt,!1,!0),Gt(qt),Object.assign(Object.assign({},$t(qt,"conditional_formatting")),{ruleType:"backgroundColor"}),$t(qt,"goal_line"),$t(qt,"headline")],supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0},supportedFeatures:{parameters:!0,colorGradient:!1},setDataAttributesFromPreAggregatedDataSet(e,t){return Ft(e,t,this.setAttributes)}}),Xt=e=>L().object(Object.assign(Object.assign(Object.assign({},W(e.attributesSchemaOptions)),Z(e.queryEngineConfig,e.attributesSchemaOptions)),{stacked:L().valid(!0,!1,"100%"),legend:L().valid(!0,!1),type:L().valid("lineChart").required(),parameters:ie(e.queryEngineConfig,e.attributesSchemaOptions),lineCurve:J,conditionalFormattingRules:de(e.queryEngineConfig),goalLines:oe(),axisTitles:se(),headline:ae(),tags:z()})),Wt=e=>(t,r)=>{let n=P(t,r,Xt(e));return n=N(n),n},Kt={title:"Line chart",description:"Ideal for illustrating changes and trends over time with line graphs.",namespace:"line_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this line chart?"},views:{type:"views",title:"View",description:""},field_y_axis:{type:"fieldCollector",title:"Metric - Y Axis",description:"What do you want each line to measure?",callToAction:"Add metric"},drilldown:{type:"drilldown",title:"Drilldown",description:"After clicking on a segment of this line chart, what information do you want to see next?"},field_x_axis:{type:"fieldCollector",title:"Grouping - X Axis",description:"What do you want each line to represent? An example might be a `product category` field to represent each category as a line.",callToAction:"Add grouping"},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this line chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this line chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{curve:{type:"curve",title:"Line Curve",description:"",namespace:"curve"},legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"}}},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""},headline:{type:"headline",title:"Headline",description:""},goal_line:{type:"goalLine",title:"Goal Lines",description:""}}},Qt=e=>({title:"Line chart",description:"Ideal for illustrating changes and trends over time with line graphs.",servicesClass:"LineChart",namespace:"line_chart",dump:e=>e,load:t=>{var r;return{type:t.type,measure:f(t.measure),order:p(t.order,t.timeDimension),dimension:x(t.dimension),timeDimension:t.timeDimension,displayTitle:t.displayTitle,displaySubject:t.displaySubject,protectedByOrganisation:t.protectedByOrganisation,viewId:Rt(t.viewId),filter:d(t.filter),dataSetId:t.dataSetId,limit:t.limit,xAxisPostfix:t.xAxisPostfix,xAxisPrefix:t.xAxisPrefix,yAxisPostfix:t.yAxisPostfix,yAxisPrefix:t.yAxisPrefix,yAxisFormat:t.yAxisFormat,xAxisFormat:t.xAxisFormat,lineCurve:t.lineCurve,conditionalFormattingRules:Lt(e.queryEngineConfig,t.conditionalFormattingRules),drilldown:t.drilldown,legend:t.legend,goalLines:t.goalLines,headline:Ht(t.headline,t.timeDimension),parameters:m(t.parameters),approxXAxisLabelCount:h(t.approxXAxisLabelCount),approxYAxisLabelCount:h(t.approxYAxisLabelCount),axisTitles:t.axisTitles,tags:null!==(r=t.tags)&&void 0!==r?r:[]}},setAttributes:Wt(e),validate:(t,r)=>St(t,r,e.queryEngineConfig),init:(e,t)=>Object.assign({type:"lineChart",measure:[],dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",protectedByOrganisation:void 0,viewId:Rt(null==t?void 0:t.viewId),filter:[],order:[],dataSetId:e,limit:5e3,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,lineCurve:"natural",conditionalFormattingRules:[],drilldown:[],legend:!0,goalLines:void 0,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",parameters:{},axisTitles:void 0,headline:void 0,tags:[]},t),createFeedback:Tt,schema:Xt(e),removeField:(t,r)=>F(t,r,e.queryEngineConfig),isRunnable:e=>e.measure.length>0,autoGenerate(t){const{measure:r,dimension:n}=vt(t,e.queryEngineConfig,"lineChart");return this.init(t.id,{measure:[r[0]],dimension:n})},dataPanelConfig:()=>[$t(Kt,"data_set"),$t(Kt,"views"),Object.assign(Object.assign({},$t(Kt,"field_y_axis")),{fieldFilterOptions:{forComponent:"lineChart"},preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"}),Object.assign(Object.assign({},$t(Kt,"field_x_axis")),{fieldFilterOptions:{forComponent:"lineChart",onlyDimensions:!0},preventDuplicates:!0,preSetPartialAttributes:(e,t)=>Nt(e,t),getValues:e=>Pt(e),maxAllowed:2,testId:"add-dimension"}),$t(Kt,"sort"),$t(Kt,"filter"),$t(Kt,"custom_metrics"),$t(Kt,"limit")],formatPanelConfig:()=>[Bt(Kt),Ut(Kt,!0,!1),Gt(Kt),Object.assign(Object.assign({},$t(Kt,"conditional_formatting")),{ruleType:"lineColor"}),$t(Kt,"goal_line"),$t(Kt,"headline")],supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0},supportedFeatures:{parameters:!0,colorGradient:!1},setDataAttributesFromPreAggregatedDataSet(e,t){return Ft(e,t,this.setAttributes)}}),Zt=e=>L().object(Object.assign(Object.assign({},W(e.attributesSchemaOptions)),{measure:L().array().items(B(e.queryEngineConfig.supportedAggregates,e.attributesSchemaOptions)),dimension:V(e.queryEngineConfig.supportedTimeTruncFunctions,e.attributesSchemaOptions),filter:Y(e.queryEngineConfig),timeDimension:L().valid(null),order:L().array().items(G(e.queryEngineConfig)),type:L().valid("pieChart").required(),legend:L().valid(!0,!1),limit:X(),labelsAsPercentage:L().boolean(),conditionalFormattingRules:de(e.queryEngineConfig),labelFormat:L().alternatives(L().string(),L().valid(null)),parameters:ie(e.queryEngineConfig,e.attributesSchemaOptions),tags:z()})),Jt={title:"Pie chart",description:"Represents data in a circular pie-like format, useful for showing proportions.",namespace:"pie_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this pie chart?"},views:{type:"views",title:"View",description:""},field_metrics:{type:"fieldCollector",title:"Metric",description:"What do you want each segment to measure?",callToAction:"Add metric"},field_grouping:{type:"fieldCollector",title:"Grouping",description:"How do you want to split each section of the pie chart?",callToAction:"Add comparison"},sort:{type:"sort",title:"Sort",description:"Choose the order of segments in the pie chart"},filter:{type:"filter",title:"Filters",description:"Only include the information you want in this pie chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Limit the number of segments shown on this pie chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{number_format:{type:"numberFormat",title:"Format",description:"",namespace:"number_format"},legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"}}},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""}}},er=e=>({title:Jt.title,description:Jt.description,servicesClass:"PieChart",namespace:Jt.namespace,dump:e=>e,load:t=>{var r;return{type:t.type,measure:f(t.measure),order:p(t.order,t.timeDimension),dimension:x(t.dimension),viewId:Rt(t.viewId),timeDimension:t.timeDimension,displayTitle:t.displayTitle,displaySubject:t.displaySubject,protectedByOrganisation:t.protectedByOrganisation,filter:d(t.filter),dataSetId:t.dataSetId,limit:t.limit,conditionalFormattingRules:Lt(e.queryEngineConfig,t.conditionalFormattingRules),labelsAsPercentage:t.labelsAsPercentage,legend:t.legend,labelFormat:t.labelFormat,parameters:m(t.parameters),tags:null!==(r=t.tags)&&void 0!==r?r:[]}},setAttributes:(t,r)=>P(t,r,Zt(e)),validate:(t,r)=>St(t,r,e.queryEngineConfig),init:(e,t)=>Object.assign({type:"pieChart",measure:[],dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",protectedByOrganisation:void 0,viewId:Rt(null==t?void 0:t.viewId),filter:[],order:[],dataSetId:e,limit:5e3,conditionalFormattingRules:[],labelsAsPercentage:!1,legend:!0,labelFormat:null,parameters:{},tags:[]},t),createFeedback:Tt,schema:Zt(e),removeField:(t,r)=>F(t,r,e.queryEngineConfig),isRunnable:e=>e.measure.length>0,autoGenerate(t){const{measure:r,dimension:n}=vt(t,e.queryEngineConfig,"pieChart");return this.init(t.id,{measure:[r[0]],dimension:n})},dataPanelConfig:()=>[$t(Jt,"data_set"),$t(Jt,"views"),Object.assign(Object.assign({},$t(Jt,"field_metrics")),{fieldFilterOptions:{forComponent:"pieChart"},maxAllowed:1,preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"}),Object.assign(Object.assign({},$t(Jt,"field_grouping")),{fieldFilterOptions:{onlyFieldTypes:["boolean","number","string"],onlyDimensions:!0,removePercentage:!0,removeSimpleMaths:!0,removeAggregateMaths:!0},maxAllowed:1,preSetPartialAttributes:e=>({dimension:e}),getValues:e=>e.dimension,testId:"add-dimension"}),$t(Jt,"sort"),$t(Jt,"filter"),$t(Jt,"custom_metrics"),$t(Jt,"limit")],formatPanelConfig:()=>{var e,t;return[Bt(Jt),Object.assign(Object.assign({},$t(Jt,"conditional_formatting")),{ruleType:"backgroundColor"}),Object.assign(Object.assign({},$t(Jt,"chart_styles")),{subSection:[null===(e=Jt.format_panel.chart_styles)||void 0===e?void 0:e.subSectionDefinition.legend,null===(t=Jt.format_panel.chart_styles)||void 0===t?void 0:t.subSectionDefinition.number_format]})]},supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0},supportedFeatures:{parameters:!0,colorGradient:!1}}),tr=e=>L().object(Object.assign(Object.assign({},W(e.attributesSchemaOptions)),{xMeasure:B(e.queryEngineConfig.supportedAggregates,e.attributesSchemaOptions).allow(null),yMeasure:B(e.queryEngineConfig.supportedAggregates,e.attributesSchemaOptions).allow(null),dimension:V(e.queryEngineConfig.supportedTimeTruncFunctions,e.attributesSchemaOptions),order:L().array().items(G(e.queryEngineConfig)),limit:X(),legend:L().valid(!0,!1),offset:L().number().min(0),filter:Y(e.queryEngineConfig),type:L().valid("scatterChart").required(),timeDimension:L().valid(null),xAxisPrefix:L().string().allow(""),yAxisPrefix:L().string().allow(""),xAxisPostfix:L().string().allow(""),yAxisPostfix:L().string().allow(""),yAxisFormat:L().alternatives(L().string(),L().valid(null)),xAxisFormat:L().alternatives(L().string(),L().valid(null)),approxYAxisLabelCount:K,approxXAxisLabelCount:K,goalLines:oe(),axisTitles:se(),tags:z()})),rr=e=>(t,r)=>{let n=P(t,r,tr(e)),i=[];return n.xMeasure&&i.push(n.xMeasure),n.yMeasure&&i.push(n.yMeasure),n.dimension.forEach((e=>{i.push({field:e.field,function:e.function})})),n=D(n,i),n},nr={title:"Scatter chart",description:"Displays data points on a Cartesian plane, perfect for showing correlations.",namespace:"scatter_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this scatter chart?"},views:{type:"views",title:"View",description:""},labelled_metrics:{type:"labelledMetrics",title:"Metric - Y Axis",description:"",subSectionDefinition:{xAxis:{type:"metrics",title:"X axis",namespace:"metrics.xAxis"},yAxis:{type:"metrics",title:"Y axis",namespace:"metrics.yAxis"}}},field_grouping:{type:"fieldCollector",title:"Grouping",description:"What do you want each dot to represent?",callToAction:"Add comparison"},filter:{type:"filter",title:"Filters",description:"Only include the information you want in this scatter chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Limit the number of data points shown on this scatter chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"}}},goal_line:{type:"goalLine",title:"Goal Lines",description:""}}},ir=e=>({title:nr.title,description:nr.description,servicesClass:"ScatterChart",namespace:nr.namespace,dump:e=>e,load:e=>{var t;return{type:e.type,xMeasure:f(e.xMeasure?[e.xMeasure]:[])[0]||null,yMeasure:f(e.yMeasure?[e.yMeasure]:[])[0]||null,dimension:x(e.dimension),viewId:Rt(e.viewId),timeDimension:e.timeDimension,displayTitle:e.displayTitle,displaySubject:e.displaySubject,protectedByOrganisation:e.protectedByOrganisation,filter:d(e.filter),order:p(e.order,e.timeDimension),dataSetId:e.dataSetId,limit:e.limit,legend:e.legend,xAxisFormat:e.xAxisFormat,yAxisFormat:e.yAxisFormat,yAxisPostfix:e.yAxisPostfix,yAxisPrefix:e.yAxisPrefix,xAxisPostfix:e.xAxisPostfix,xAxisPrefix:e.xAxisPrefix,approxXAxisLabelCount:h(e.approxXAxisLabelCount),approxYAxisLabelCount:h(e.approxYAxisLabelCount),goalLines:e.goalLines,axisTitles:e.axisTitles,tags:null!==(t=e.tags)&&void 0!==t?t:[]}},setAttributes:rr(e),validate:(t,r)=>St(t,r,e.queryEngineConfig),init:(e,t)=>Object.assign({type:"scatterChart",xMeasure:null,yMeasure:null,dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",protectedByOrganisation:void 0,viewId:Rt(null==t?void 0:t.viewId),filter:[],order:[],dataSetId:e,limit:5e3,legend:!0,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",goalLines:void 0,axisTitles:void 0,tags:[]},t),createFeedback:Tt,schema:tr(e),removeField:(t,r)=>F(t,r,e.queryEngineConfig),isRunnable:e=>!!e.xMeasure&&!!e.yMeasure&&e.dimension.length>0,autoGenerate(t){const{measure:r,dimension:n}=vt(t,e.queryEngineConfig,"scatterChart");return this.init(t.id,{xMeasure:r[0],yMeasure:r[1],dimension:n})},dataPanelConfig:()=>{var e,t;return[$t(nr,"data_set"),$t(nr,"views"),Object.assign(Object.assign({},$t(nr,"labelled_metrics")),{subSection:[Object.assign(Object.assign({},null===(e=nr.data_panel.labelled_metrics)||void 0===e?void 0:e.subSectionDefinition.xAxis),{propKey:"xMeasure",allowsMultiple:!1}),Object.assign(Object.assign({},null===(t=nr.data_panel.labelled_metrics)||void 0===t?void 0:t.subSectionDefinition.yAxis),{propKey:"yMeasure",allowsMultiple:!1})]}),Object.assign(Object.assign({},$t(nr,"field_grouping")),{fieldFilterOptions:{onlyDimensions:!0,onlyFieldTypes:["boolean","number","string"],removePercentage:!0,removeSimpleMaths:!0,removeAggregateMaths:!0},maxAllowed:1,preSetPartialAttributes:e=>({dimension:e}),getValues:e=>e.dimension,testId:"add-dimension"}),$t(nr,"filter"),$t(nr,"custom_metrics"),$t(nr,"limit")]},formatPanelConfig:()=>{var e;return[Bt(nr),Object.assign(Object.assign({},$t(nr,"chart_styles")),{subSection:[null===(e=nr.format_panel.chart_styles)||void 0===e?void 0:e.subSectionDefinition.legend]}),Gt(nr),$t(nr,"goal_line")]},supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0},supportedFeatures:{parameters:!1,colorGradient:!1}}),or=e=>L().object(Object.assign(Object.assign({},W(e.attributesSchemaOptions)),{stacked:L().valid(!0,!1,"100%"),legend:L().valid(!0,!1),barMeasure:L().array().items(B(e.queryEngineConfig.supportedAggregates,e.attributesSchemaOptions)),lineMeasure:L().array().items(B(e.queryEngineConfig.supportedAggregates,e.attributesSchemaOptions)),barDimension:V(e.queryEngineConfig.supportedTimeTruncFunctions,e.attributesSchemaOptions),lineDimension:V(e.queryEngineConfig.supportedTimeTruncFunctions,e.attributesSchemaOptions),order:L().array().items(G(e.queryEngineConfig)),timeDimension:L().alternatives(U(e.queryEngineConfig.supportedTimeTruncFunctions),L().valid(null)),limit:X(),offset:L().number().min(0),filter:Y(e.queryEngineConfig),type:L().valid("comboChart").required(),xAxisPrefix:L().string().allow(""),yAxisPrefix:L().string().allow(""),xAxisPostfix:L().string().allow(""),yAxisPostfix:L().string().allow(""),yAxisFormat:L().alternatives(L().string(),L().valid(null)),xAxisFormat:L().alternatives(L().string(),L().valid(null)),approxYAxisLabelCount:K,approxXAxisLabelCount:K,goalLines:oe(),conditionalFormattingRules:L().object({bar:L().array().items(ue(e.queryEngineConfig)),line:L().array().items(ue(e.queryEngineConfig))}),axisTitles:se(),tags:z()})),ar=e=>(t,r)=>{let n=P(t,r,or(e)),i=[...n.lineMeasure,...n.barMeasure];return[...n.lineDimension,...n.barDimension].forEach((e=>{i.push({field:e.field,function:e.function})})),n.timeDimension&&i.push({field:n.timeDimension.field,function:n.timeDimension.truncate}),n=D(n,i),n},sr={title:"Combo chart",description:"A versatile component that combines different chart types.",namespace:"combo_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this combo chart?"},views:{type:"views",title:"View",description:""},labelled_metrics:{type:"labelledMetrics",title:"Metric - Y Axis",description:"What do you want each line and bar to measure?",subSectionDefinition:{line:{type:"metrics",title:"Line",namespace:"metrics.line"},bar:{type:"metrics",title:"Bar",namespace:"metrics.bar"}}},combo_chart_dimension:{type:"comboChartDimension",title:"Grouping - X Axis",description:""},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this combo chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this bar chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{stacked:{type:"stacked",title:"Layout",description:"",namespace:"stacked"},legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"}}},goal_line:{type:"goalLine",title:"Goal Lines",description:""},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:"",subSectionDefinition:{bar:{title:"Bar",namespace:"bar"},line:{title:"Line",namespace:"line"}}}}},lr=e=>({title:sr.title,description:sr.description,servicesClass:"ComboChart",namespace:sr.namespace,dump:e=>e,load:t=>{return r=t,n=e.queryEngineConfig,Object.assign(Object.assign({},r),{lineMeasure:f(r.lineMeasure),barMeasure:f(r.barMeasure),order:p(r.order,r.timeDimension||null),filter:d(r.filter),lineDimension:x(r.lineDimension||r.dimension||[]),barDimension:x(r.barDimension||r.dimension||[]),viewId:Rt(r.viewId),approxXAxisLabelCount:h(r.approxXAxisLabelCount),approxYAxisLabelCount:h(r.approxYAxisLabelCount),conditionalFormattingRules:{bar:Lt(n,null===(i=r.conditionalFormattingRules)||void 0===i?void 0:i.bar),line:Lt(n,null===(o=r.conditionalFormattingRules)||void 0===o?void 0:o.line)},tags:null!==(a=r.tags)&&void 0!==a?a:[]});var r,n,i,o,a},setAttributes:ar(e),validate:(t,r)=>St(t,r,e.queryEngineConfig),init:(e,t)=>Object.assign({type:"comboChart",barMeasure:[],lineMeasure:[],lineDimension:[],barDimension:[],timeDimension:null,displayTitle:"",displaySubject:"",viewId:Rt(null==t?void 0:t.viewId),filter:[],order:[],dataSetId:e,limit:5e3,xAxisPostfix:"",protectedByOrganisation:void 0,xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,legend:!0,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",goalLines:void 0,conditionalFormattingRules:void 0,axisTitles:void 0,tags:[]},t),createFeedback:Tt,schema:or(e),removeField:(t,r)=>F(t,r,e.queryEngineConfig),isRunnable:e=>e.lineMeasure.length>0||e.barMeasure.length>0,autoGenerate(t){const{measure:r,dimension:n}=vt(t,e.queryEngineConfig,"comboChart");return this.init(t.id,{barMeasure:[r[0]],lineMeasure:[r[1]||r[0]],barDimension:n,lineDimension:n})},dataPanelConfig:()=>{var e,t;return[$t(sr,"data_set"),$t(sr,"views"),Object.assign(Object.assign({},$t(sr,"labelled_metrics")),{subSection:[Object.assign(Object.assign({},null===(e=sr.data_panel.labelled_metrics)||void 0===e?void 0:e.subSectionDefinition.line),{propKey:"lineMeasure",allowsMultiple:!0}),Object.assign(Object.assign({},null===(t=sr.data_panel.labelled_metrics)||void 0===t?void 0:t.subSectionDefinition.bar),{propKey:"barMeasure",allowsMultiple:!0})]}),$t(sr,"combo_chart_dimension"),$t(sr,"sort"),$t(sr,"filter"),$t(sr,"custom_metrics"),$t(sr,"limit")]},formatPanelConfig:()=>{var e,t,r,n,i,o,a,s,l,u;return[Bt(sr),Ut(sr,!1,!0),Gt(sr),Object.assign(Object.assign({},$t(sr,"conditional_formatting")),{ruleType:"backgroundColor",subSection:[{title:null!==(r=null===(t=null===(e=sr.format_panel.conditional_formatting)||void 0===e?void 0:e.subSectionDefinition)||void 0===t?void 0:t.bar.title)&&void 0!==r?r:"",namespace:null===(i=null===(n=sr.format_panel.conditional_formatting)||void 0===n?void 0:n.subSectionDefinition)||void 0===i?void 0:i.bar.namespace,propKey:"bar"},{title:null!==(s=null===(a=null===(o=sr.format_panel.conditional_formatting)||void 0===o?void 0:o.subSectionDefinition)||void 0===a?void 0:a.line.title)&&void 0!==s?s:"",namespace:null===(u=null===(l=sr.format_panel.conditional_formatting)||void 0===l?void 0:l.subSectionDefinition)||void 0===u?void 0:u.line.namespace,propKey:"line"}]}),$t(sr,"goal_line")]},supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0},supportedFeatures:{parameters:!1,colorGradient:!1}}),ur=e=>L().object(Object.assign(Object.assign({},W(e.attributesSchemaOptions)),{type:L().valid("dataTable").required(),measure:L().array().items(B(e.queryEngineConfig.supportedAggregates,e.attributesSchemaOptions)).required(),dimension:V(e.queryEngineConfig.supportedTimeTruncFunctions,e.attributesSchemaOptions).required(),order:L().array().items(G(e.queryEngineConfig)),timeDimension:L().alternatives(U(e.queryEngineConfig.supportedTimeTruncFunctions),L().valid(null)),limit:X().required(),offset:L().number().min(0),filter:Y(e.queryEngineConfig),prefixes:L().array().items(ce),exportNames:L().object(),numberFormat:L().object(),conditionalFormattingRules:de(e.queryEngineConfig),dateTimeFormat:L().string(),protectedFields:L().object({dimension:te(e.queryEngineConfig),measure:ee(e.queryEngineConfig)}).unknown(!0),sizing:le,tags:z(),tableDrilldown:L().array().items(L().object({subsetDimension:L().string().required().description("The ID of the field in the data set to drill down by.")})).description("Drilldown configuration for a pivot table.")})),cr=e=>(t,r)=>{let n=P(t,r,ur(e));return n=N(n),n},dr={title:"Pivot table",description:"Transforms data into a table with dynamic rows and columns.",namespace:"pivot_table",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this data table?"},views:{type:"views",title:"View",description:""},field_columns:{type:"fieldCollector",title:"Group columns",callToAction:"Add group column",description:""},field_rows:{type:"fieldCollector",title:"Group rows",description:"Which field do you want to group each row by? An example might be an employee ID or geographical location",callToAction:"Add group row"},drilldown:{type:"drilldown",title:"Drilldown",description:"Drilldowns in a pivot table reveals underlying data contributing to summarized figures upon clicking."},field_metrics:{type:"fieldCollector",title:"Metrics",description:"Select the columns to show in the data table",callToAction:"Add metric"},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this data table."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},pagination:{type:"pagination",title:"Pagination",description:"Define the size for each page in the table"}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},format:{type:"format",title:"Format",description:"",subSectionDefinition:{time:{type:"time",title:"Time",description:"",namespace:"time"}}},prefixes:{type:"prefixes",title:"Prefixes",description:""},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""}}},pr=[3,5,10,20,50,100,200],fr=(e,t)=>e.filter((e=>e.pivot==t)),hr=e=>({title:dr.title,description:dr.description,servicesClass:"PivotTable",namespace:dr.namespace,dump:e=>e,load:t=>{var r,n,i;return{type:t.type,measure:f(t.measure),order:p(t.order,t.timeDimension||null),displayTitle:t.displayTitle,dimension:(i=Pt({timeDimension:t.timeDimension,dimension:x(t.dimension)}),i.map((e=>Object.assign(Object.assign({},e),{pivot:e.pivot?e.pivot:"x"})))),displaySubject:t.displaySubject,protectedByOrganisation:t.protectedByOrganisation,protectedFields:Mt(t.protectedFields),viewId:Rt(t.viewId),filter:d(t.filter),dataSetId:t.dataSetId,limit:t.limit,offset:t.offset,conditionalFormattingRules:Lt(e.queryEngineConfig,t.conditionalFormattingRules),dateTimeFormat:t.dateTimeFormat,prefixes:t.prefixes,exportNames:t.exportNames,numberFormat:t.numberFormat,sizing:t.sizing,tableDrilldown:(n=t.tableDrilldown,n&&n.length>0?n.map(Dt):n||[]),tags:null!==(r=t.tags)&&void 0!==r?r:[]}},setAttributes:cr(e),validate:(t,r)=>St(t,r,e.queryEngineConfig),init:(e,t)=>Object.assign({type:"dataTable",measure:[],displayTitle:"",dimension:[],protectedByOrganisation:void 0,displaySubject:"",viewId:Rt(null==t?void 0:t.viewId),filter:[],order:[],dataSetId:e,limit:50,offset:0,conditionalFormattingRules:[],protectedFields:void 0,prefixes:[],dateTimeFormat:"DD MMMM YYYY, hh:mm",exportNames:{},numberFormat:{},sizing:{},tableDrilldown:[],tags:[]},t),schema:ur(e),removeField:(t,r)=>F(t,r,e.queryEngineConfig),isRunnable:e=>e.measure.length>0,autoGenerate(t){const{measure:r,dimension:n}=vt(t,e.queryEngineConfig,"dataTable");return this.init(t.id,{measure:r.slice(0,5),dimension:n})},dataPanelConfig:()=>[$t(dr,"data_set"),$t(dr,"views"),Object.assign(Object.assign({},$t(dr,"field_columns")),{fieldFilterOptions:{onlyFieldTypes:["boolean","number","string","date_time"],onlyDimensions:!0,removePercentage:!0,removeSimpleMaths:!0,removeAggregateMaths:!0},preventDuplicates:!0,preSetPartialAttributes:(e,t,r)=>({dimension:[...e.map((e=>Object.assign(Object.assign({},e),{pivot:"y"}))),...fr(r.dimension,"x")]}),getValues:e=>fr(e.dimension,"y"),testId:"add-pivot-dimension"}),Object.assign(Object.assign({},$t(dr,"field_rows")),{fieldFilterOptions:{onlyFieldTypes:["boolean","number","string","date_time"],onlyDimensions:!0,removePercentage:!0,removeSimpleMaths:!0,removeAggregateMaths:!0},preventDuplicates:!0,preSetPartialAttributes:(e,t,r)=>({dimension:[...e.map((e=>Object.assign(Object.assign({},e),{pivot:"x"}))),...fr(r.dimension,"y")]}),getValues:e=>fr(e.dimension,"x"),testId:"add-dimension"}),Object.assign(Object.assign({},$t(dr,"drilldown")),{options:{maxOptions:1,property:"tableDrilldown"}}),Object.assign(Object.assign({},$t(dr,"field_metrics")),{fieldFilterOptions:{forComponent:"dataTable"},preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"}),$t(dr,"sort"),Object.assign(Object.assign({},$t(dr,"pagination")),{options:pr}),$t(dr,"filter"),$t(dr,"custom_metrics")],formatPanelConfig:()=>{var e;return[Bt(dr),Object.assign(Object.assign({},$t(dr,"format")),{subSection:[null===(e=dr.format_panel.format)||void 0===e?void 0:e.subSectionDefinition.time]}),$t(dr,"prefixes"),Object.assign(Object.assign({},$t(dr,"conditional_formatting")),{ruleType:"backgroundColor"})]},supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0},supportedFeatures:{parameters:!1,colorGradient:!0}}),mr=L().object({field:L().string().required(),function:L().valid("none").required()}),gr=e=>L().object(Object.assign(Object.assign({},W(e.attributesSchemaOptions)),{type:L().valid("basicTable").required(),measure:L().array().items(mr).required(),dimension:L().array().max(0),order:L().array().items(G(e.queryEngineConfig)),timeDimension:L().valid(null),limit:X().required(),offset:L().number().min(0),filter:Y(e.queryEngineConfig),prefixes:L().array().items(ce),exportNames:L().object(),numberFormat:L().object(),conditionalFormattingRules:de(e.queryEngineConfig),dateTimeFormat:L().string(),protectedFields:L().object({measure:ee(e.queryEngineConfig)}).unknown(!0),sizing:le,tags:z()})),yr=e=>(t,r)=>{let n=P(t,r,gr(e));return n=D(n,[...n.measure]),n},br={title:"Basic table",description:"Displays data in a simple, straightforward table format.",namespace:"basic_table",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this basic table?"},views:{type:"views",title:"View",description:""},fields:{type:"fields",title:"Columns",description:"Select which values you want to see in this table"},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this basic table."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},pagination:{type:"pagination",title:"Pagination",description:"Define the size for each page in the table"}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{type:"subject",title:"Subject",description:"",namespace:"subject"}}},format:{type:"format",title:"Format",description:"",subSectionDefinition:{time:{type:"time",title:"Time",description:"",namespace:"time"}}},prefixes:{type:"prefixes",title:"Prefixes",description:""},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""}}},vr=e=>({title:br.title,description:br.description,servicesClass:"BasicTable",namespace:br.namespace,dump:e=>({type:e.type,measure:e.measure,displayTitle:e.displayTitle,dimension:e.dimension,timeDimension:e.timeDimension,displaySubject:e.displaySubject,protectedFields:e.protectedFields,filter:e.filter,order:e.order,dataSetId:e.dataSetId,viewId:null==e?void 0:e.viewId,limit:e.limit,offset:e.offset,conditionalFormattingRules:e.conditionalFormattingRules,protectedByOrganisation:e.protectedByOrganisation,dateTimeFormat:e.dateTimeFormat,prefixes:e.prefixes,exportNames:e.exportNames,numberFormat:e.numberFormat,sizing:e.sizing,tags:e.tags}),load:t=>{var r;return Object.assign(Object.assign({},t),{measure:f(t.measure),order:p(t.order,t.timeDimension),filter:d(t.filter),dimension:x(t.dimension),viewId:Rt(t.viewId),protectedFields:Mt(t.protectedFields),conditionalFormattingRules:Lt(e.queryEngineConfig,t.conditionalFormattingRules),tags:null!==(r=t.tags)&&void 0!==r?r:[]})},setAttributes:yr(e),validate:(t,r)=>St(t,r,e.queryEngineConfig),init:function(t,r){const n={type:"basicTable",measure:[],displayTitle:"",dimension:[],timeDimension:null,displaySubject:"",filter:[],order:[],tags:[],dataSetId:t,viewId:Rt(null==r?void 0:r.viewId),protectedFields:void 0,limit:50,offset:0,conditionalFormattingRules:[],prefixes:[],dateTimeFormat:"DD MMMM YYYY, hh:mm",exportNames:{},numberFormat:{},sizing:{}};return yr(e)(n,r||{})},schema:gr(e),removeField:(t,r)=>F(t,r,e.queryEngineConfig),setFields:function(t,r){const n=[...r].map((e=>({field:e,function:"none"})));return yr(e)(t,{measure:n})},setDateTimeFormat:function(e,t){return this.setAttributes(e,{dateTimeFormat:t})},isRunnable:e=>e.measure.length>0,autoGenerate(e){const t=[...ft(e.fields,{forComponent:"basicTable",onlyMeasures:!0,removeAggregateMaths:!0,removePercentage:!0})].map((e=>({field:e.id,function:"none"})));return this.init(e.id,{measure:t.slice(0,5)})},dataPanelConfig:()=>[$t(br,"data_set"),$t(br,"views"),$t(br,"fields"),$t(br,"sort"),Object.assign(Object.assign({},$t(br,"pagination")),{options:pr}),$t(br,"filter"),$t(br,"custom_metrics")],formatPanelConfig:()=>{var e;return[Bt(br),Object.assign(Object.assign({},$t(br,"format")),{subSection:[null===(e=br.format_panel.format)||void 0===e?void 0:e.subSectionDefinition.time]}),$t(br,"prefixes"),Object.assign(Object.assign({},$t(br,"conditional_formatting")),{ruleType:"backgroundColor"})]},supportedCustomFields:{percentages:!1,simpleMaths:!0,rules:!0,aggregateMaths:!1,roundedNumbers:!0,dateCalculations:!1,conditional:!0},supportedFeatures:{parameters:!1,colorGradient:!0}}),_r=e=>(t,r)=>{let n=P(t,r,pe(e));return n=N(n),n},Ar={title:"Horizontal bar chart",description:"Similar to a BarChart but with horizontal bars.",namespace:"horizontal_bar_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this bar chart?"},views:{type:"views",title:"View",description:""},field_y_axis:{type:"fieldCollector",title:"Metric - Y Axis",description:"What do you want each bar to measure?",callToAction:"Add metric"},drilldown:{type:"drilldown",title:"Drilldown",description:"After clicking on a segment of this bar chart, what information do you want to see next?"},field_x_axis:{type:"fieldCollector",title:"Grouping - X Axis",description:"What do you want each bar to represent? An example might be a `product category` field to represent each category as a bar.",callToAction:"Add grouping"},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this bar chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this bar chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{stacked:{type:"stacked",title:"Layout",description:"",namespace:"stacked"},legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"}}},headline:{type:"headline",title:"Headline",description:""},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""}}},wr=e=>({title:Ar.title,description:Ar.description,servicesClass:"HorizontalBarChart",namespace:Ar.namespace,dump:e=>e,load:e=>{var t;return Object.assign(Object.assign({},e),{measure:f(e.measure),order:p(e.order,e.timeDimension),dimension:x(e.dimension),viewId:Rt(e.viewId),filter:d(e.filter),approxXAxisLabelCount:h(e.approxXAxisLabelCount),approxYAxisLabelCount:h(e.approxYAxisLabelCount),protectedFields:Mt(e.protectedFields),tags:null!==(t=e.tags)&&void 0!==t?t:[]})},setAttributes:_r(e),validate:(t,r)=>St(t,r,e.queryEngineConfig),init:(e,t)=>Object.assign({type:"horizontalBarChart",measure:[],dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",viewId:Rt(null==t?void 0:t.viewId),filter:[],order:[],dataSetId:e,limit:5e3,conditionalFormattingRules:[],protectedByOrganisation:void 0,protectedFields:void 0,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,legend:!0,drilldown:[],approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",axisTitles:void 0,tags:[],drilldownOptions:void 0},t),createFeedback:Tt,schema:pe(e),removeField:(t,r)=>F(t,r,e.queryEngineConfig),isRunnable:e=>e.measure.length>0,autoGenerate(t){const{measure:r,dimension:n}=vt(t,e.queryEngineConfig,"horizontalBarChart");return this.init(t.id,{measure:[r[0]],dimension:n})},dataPanelConfig:()=>[$t(Ar,"data_set"),$t(Ar,"views"),Object.assign(Object.assign({},$t(Ar,"field_y_axis")),{fieldFilterOptions:{forComponent:"horizontalBarChart"},preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"}),Object.assign(Object.assign({},$t(Ar,"field_x_axis")),{fieldFilterOptions:{forComponent:"horizontalBarChart",onlyDimensions:!0},preventDuplicates:!0,preSetPartialAttributes:(e,t)=>Nt(e,t),getValues:e=>Pt(e),maxAllowed:2,testId:"add-dimension"}),$t(Ar,"sort"),$t(Ar,"filter"),Object.assign(Object.assign({},$t(Ar,"drilldown")),{options:{property:"drilldownOptions"}}),$t(Ar,"custom_metrics"),$t(Ar,"limit")],formatPanelConfig:()=>[Bt(Ar),Ut(Ar,!1,!0),Gt(Ar),Object.assign(Object.assign({},$t(Ar,"conditional_formatting")),{ruleType:"backgroundColor"}),$t(Ar,"headline")],supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0},supportedFeatures:{parameters:!0,colorGradient:!1},setDataAttributesFromPreAggregatedDataSet(e,t){return Ft(e,t,this.setAttributes)}}),Sr=e=>L().object(Object.assign(Object.assign(Object.assign({},W(e.attributesSchemaOptions)),Z(e.queryEngineConfig,e.attributesSchemaOptions)),{stacked:L().valid(!0,!1,"100%"),legend:L().valid(!0,!1),type:L().valid("areaChart").required(),lineCurve:J,conditionalFormattingRules:de(e.queryEngineConfig),parameters:ie(e.queryEngineConfig,e.attributesSchemaOptions),goalLines:oe(),axisTitles:se(),headline:ae(),tags:z()})),Tr=e=>(t,r)=>{let n=P(t,r,Sr(e));return n=N(n),n},Er={title:"Area chart",description:"Displays data as areas on a chart, useful for showing trends over time.",namespace:"area_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this area chart?"},views:{type:"views",title:"View",description:""},field_y_axis:{type:"fieldCollector",title:"Metric - Y Axis",description:"What do you want each area to measure?",callToAction:"Add metric"},field_x_axis:{type:"fieldCollector",title:"Grouping - X Axis",description:"What do you want each area to represent? An example might be an employee ID to represent each employee.",callToAction:"Add grouping"},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this area chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this area chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{stacked:{type:"stacked",title:"Layout",description:"",namespace:"stacked"},legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"},curve:{type:"curve",title:"Line Curve",description:"",namespace:"curve"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"}}},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""},headline:{type:"headline",title:"Headline",description:""},goal_line:{type:"goalLine",title:"Goal Lines",description:""}}},Or=e=>({title:Er.title,description:Er.description,servicesClass:"AreaChart",namespace:Er.namespace,dump:e=>e,load:t=>{var r;return{type:t.type,measure:f(t.measure),displayTitle:t.displayTitle,dimension:x(t.dimension),timeDimension:t.timeDimension,displaySubject:t.displaySubject,viewId:Rt(t.viewId),filter:d(t.filter),order:p(t.order,t.timeDimension),dataSetId:t.dataSetId,limit:t.limit,offset:t.offset,xAxisPostfix:t.xAxisPostfix,xAxisPrefix:t.xAxisPrefix,yAxisPostfix:t.yAxisPostfix,yAxisPrefix:t.yAxisPrefix,lineCurve:t.lineCurve,conditionalFormattingRules:Lt(e.queryEngineConfig,t.conditionalFormattingRules),protectedByOrganisation:t.protectedByOrganisation,stacked:t.stacked,drilldown:t.drilldown,legend:t.legend,yAxisFormat:t.yAxisFormat,xAxisFormat:t.xAxisFormat,goalLines:t.goalLines,parameters:m(t.parameters),approxXAxisLabelCount:h(t.approxXAxisLabelCount),approxYAxisLabelCount:h(t.approxYAxisLabelCount),headline:Ht(t.headline,t.timeDimension),tags:null!==(r=t.tags)&&void 0!==r?r:[]}},setAttributes:Tr(e),validate:(t,r)=>St(t,r,e.queryEngineConfig),init:(e,t)=>Object.assign({type:"areaChart",measure:[],displayTitle:"",dimension:[],timeDimension:null,displaySubject:"",viewId:Rt(null==t?void 0:t.viewId),filter:[],order:[],dataSetId:e,limit:5e3,offset:0,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,lineCurve:"natural",conditionalFormattingRules:[],drilldown:[],legend:!0,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",parameters:{},goalLines:void 0,axisTitles:void 0,headline:void 0,tags:[]},t),createFeedback:Tt,schema:Sr(e),removeField:(t,r)=>F(t,r,e.queryEngineConfig),isRunnable:e=>e.measure.length>0,autoGenerate(t){const{measure:r,dimension:n}=vt(t,e.queryEngineConfig,"areaChart");return this.init(t.id,{measure:[r[0]],dimension:n})},dataPanelConfig:()=>[$t(Er,"data_set"),$t(Er,"views"),Object.assign(Object.assign({},$t(Er,"field_y_axis")),{fieldFilterOptions:{forComponent:"areaChart"},preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"}),Object.assign(Object.assign({},$t(Er,"field_x_axis")),{fieldFilterOptions:{forComponent:"areaChart",onlyDimensions:!0},preventDuplicates:!0,preSetPartialAttributes:(e,t)=>Nt(e,t),getValues:e=>Pt(e),maxAllowed:2,testId:"add-dimension"}),$t(Er,"sort"),$t(Er,"filter"),$t(Er,"custom_metrics"),$t(Er,"limit")],formatPanelConfig:()=>{var e,t,r;return[Bt(Er),Object.assign(Object.assign({},$t(Er,"chart_styles")),{subSection:[null===(e=Er.format_panel.chart_styles)||void 0===e?void 0:e.subSectionDefinition.stacked,null===(t=Er.format_panel.chart_styles)||void 0===t?void 0:t.subSectionDefinition.legend,null===(r=Er.format_panel.chart_styles)||void 0===r?void 0:r.subSectionDefinition.curve]}),Gt(Er),Object.assign(Object.assign({},$t(Er,"conditional_formatting")),{ruleType:"areaColor"}),$t(Er,"goal_line"),$t(Er,"headline")]},supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0},supportedFeatures:{parameters:!0,colorGradient:!1}}),xr=e=>L().object(Object.assign(Object.assign({},W(e.attributesSchemaOptions)),{fontSize:L().string().allow(""),formatter:L().object(),measure:L().array().items(B(e.queryEngineConfig.supportedAggregates,e.attributesSchemaOptions)),filter:Y(e.queryEngineConfig),prefixes:L().object(),postfixes:L().object(),type:L().valid("singleStat").required(),limit:X(),conditionalFormattingRules:de(e.queryEngineConfig),deltaTimeDimension:L().alternatives(U(e.queryEngineConfig.supportedTimeTruncFunctions),L().valid(null)),parameters:ie(e.queryEngineConfig,e.attributesSchemaOptions),tags:z()})),Cr=e=>{if("singleMeasure"in e){let t={},r={},n=[],i={};return e.singleMeasure&&(n=[e.singleMeasure],t[I(e.singleMeasure)]=e.prefix,r[I(e.singleMeasure)]=e.postfix,i[I(e.singleMeasure)]=e.formatter),{type:"singleStat",prefixes:t,postfixes:r,measure:n,formatter:i,fontSize:e.fontSize,displayTitle:e.displayTitle,displaySubject:e.displaySubject,tags:e.tags,filter:d(e.filter),dataSetId:e.dataSetId,limit:e.limit,conditionalFormattingRules:e.conditionalFormattingRules,deltaTimeDimension:e.deltaTimeDimension,parameters:m(e.parameters)}}return Object.assign(Object.assign({},e),{filter:d(e.filter)})},Ir={title:"Single stat",description:"Shows a single statistical value, ideal for key data point representation.",namespace:"single_stat",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this single stat?"},views:{type:"views",title:"View",description:""},field_metrics:{type:"fieldCollector",title:"Metrics",description:"What do you want to show?",callToAction:"Add metric"},filter:{type:"filter",title:"Filters",description:"Only include the information you want in this scatter chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},comparison:{type:"comparison",title:"Comparison",description:""}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},stats_labels:{type:"statsLabels",title:"Labels",description:"",subSectionDefinition:{prefix:{title:"Prefix",description:"",namespace:"prefix"},postfix:{title:"Postfix",description:"",namespace:"postfix"},format:{title:"Format",description:"",namespace:"format"},count:{title:"Label count",description:"",namespace:"count"}}},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""},format:{type:"format",title:"Format",description:"",subSectionDefinition:{font_size:{title:"Font Size",type:"fontSize",description:"",namespace:"font_size"}}}}},jr=e=>({title:Ir.title,description:Ir.description,servicesClass:"SingleStat",namespace:Ir.namespace,dump:e=>e,load:e=>{var t;const r=Cr(e);return{type:"singleStat",prefixes:r.prefixes,postfixes:r.postfixes,formatter:r.formatter,fontSize:r.fontSize,measure:f(r.measure),displayTitle:r.displayTitle,displaySubject:r.displaySubject,protectedByOrganisation:e.protectedByOrganisation,viewId:Rt(e.viewId),filter:r.filter,dataSetId:r.dataSetId,limit:r.limit,conditionalFormattingRules:r.conditionalFormattingRules,deltaTimeDimension:r.deltaTimeDimension,parameters:m(r.parameters),tags:null!==(t=r.tags)&&void 0!==t?t:[]}},setAttributes:(t,r)=>P(t,r,xr(e)),validate:(t,r)=>St(t,r,e.queryEngineConfig),init:(e,t)=>Object.assign({type:"singleStat",measure:[],displayTitle:"",postfixes:{},prefixes:{},formatter:{},fontSize:"2rem",protectedByOrganisation:void 0,displaySubject:"",viewId:Rt(null==t?void 0:t.viewId),filter:[],dataSetId:e,limit:5e3,conditionalFormattingRules:[],deltaTimeDimension:null,parameters:{},tags:[]},t),schema:xr(e),removeField:(t,r)=>F(t,r,e.queryEngineConfig),isRunnable:e=>e.measure.length>0,autoGenerate(t){const{measure:r}=vt(t,e.queryEngineConfig,"singleStat");return this.init(t.id,{measure:[r[0]]})},dataPanelConfig:()=>[$t(Ir,"data_set"),$t(Ir,"views"),Object.assign(Object.assign({},$t(Ir,"field_metrics")),{fieldFilterOptions:{forComponent:"singleStat"},preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"}),$t(Ir,"filter"),$t(Ir,"custom_metrics"),$t(Ir,"comparison")],formatPanelConfig:()=>{var e;return[Bt(Ir),Object.assign(Object.assign({},$t(Ir,"stats_labels")),{prefix:Vt(Ir,"prefix"),postfix:Vt(Ir,"postfix"),format:Vt(Ir,"format"),count:Vt(Ir,"count")}),Object.assign(Object.assign({},$t(Ir,"format")),{subSection:[null===(e=Ir.format_panel.format)||void 0===e?void 0:e.subSectionDefinition.font_size]}),Object.assign(Object.assign({},$t(Ir,"conditional_formatting")),{ruleType:"fontColor"})]},supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,aggregateMaths:!0,rules:!0,roundedNumbers:!0,conditional:!0},supportedFeatures:{parameters:!0,colorGradient:!1},setDataAttributesFromPreAggregatedDataSet(e,r){let n=(0,t.cloneDeep)(ft(r.fields,{onlyFieldTypes:["number"]}));return Object.assign(Object.assign({},e),{type:"singleStat",protectedByOrganisation:!0,measure:[...n].map((e=>({function:"none",field:e.id})))})}}),Rr=e=>L().object(Object.assign(Object.assign({},W(e.attributesSchemaOptions)),{type:L().valid("custom").required(),customViewId:L().string().required(),tags:z()})),Dr={title:"Progress",description:"Used to show progress towards goals, completion of tasks, or as indicators of performance metrics.",namespace:"progress",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this progress?"},views:{type:"views",title:"View",description:""}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}}}},Fr=e=>({title:Dr.title,description:Dr.description,namespace:Dr.namespace,servicesClass:"Custom",dump:e=>e,load:e=>{var t;return{type:"custom",viewId:Rt(e.viewId),customViewId:e.customViewId,displayTitle:e.displayTitle,displaySubject:e.displaySubject,dataSetId:e.dataSetId,tags:null!==(t=e.tags)&&void 0!==t?t:[],protectedByOrganisation:e.protectedByOrganisation}},setAttributes:(t,r)=>P(t,r,Rr(e)),validate:(t,r)=>St(t,r,e.queryEngineConfig),init:(e,t)=>({type:"custom",viewId:Rt(null==t?void 0:t.viewId),customViewId:(null==t?void 0:t.customViewId)||"",dataSetId:e,displaySubject:"",displayTitle:"",tags:[],protectedByOrganisation:void 0}),schema:Rr(e),removeField:(e,t)=>e,isRunnable:()=>!0,autoGenerate(e){return this.init(e.id)},dataPanelConfig:()=>[$t(Dr,"data_set"),$t(Dr,"views")],formatPanelConfig:()=>[Bt(Dr)],supportedCustomFields:{percentages:!1,simpleMaths:!1,rules:!1,aggregateMaths:!1,roundedNumbers:!1,dateCalculations:!1,conditional:!1},supportedFeatures:{colorGradient:!1,parameters:!1}}),Nr=e=>L().object(Object.assign(Object.assign({},W(e.attributesSchemaOptions)),{type:L().valid("mercatorMap").required(),measure:L().array().items(B(e.queryEngineConfig.supportedAggregates,e.attributesSchemaOptions)),filter:Y(e.queryEngineConfig),limit:X(),dimension:V({},e.attributesSchemaOptions),labelFormat:L().alternatives(L().string(),L().valid(null)),noDataColor:L().string().required(),backgroundColor:L().string().required(),maxValueColor:L().string().required(),minValueColor:L().string().required(),position:L().object({scale:L().number(),centerX:L().number(),centerY:L().number()}),tags:z()})),Pr=e=>(t,r)=>P(t,r,Nr(e)),Mr={title:"Country map",description:"A map component based on the Mercator projection, suitable for geographical data visualization.",namespace:"mercator_map",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use for this map?"},views:{type:"views",title:"View",description:""},field_metrics:{type:"fieldCollector",title:"Metric",description:"What do you want to show?",callToAction:"Add metric"},field_country:{type:"fieldCollector",title:"Country",description:"Which field contains the country code required to group results on?",callToAction:"Set country"},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use on this map."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this map."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Map Settings",description:"",subSectionDefinition:{number_format:{type:"numberFormat",title:"Value format",description:"",namespace:"number_format"}}},map_colors:{type:"mapColors",title:"Map colors",description:""}}},Lr=e=>({title:Mr.title,description:Mr.description,servicesClass:"MercatorMap",namespace:Mr.namespace,dump:e=>e,load:e=>{var t;return{dataSetId:e.dataSetId,displaySubject:e.displaySubject,displayTitle:e.displayTitle,protectedByOrganisation:e.protectedByOrganisation,viewId:Rt(e.viewId),type:"mercatorMap",dimension:e.dimension,limit:e.limit,measure:f(e.measure),labelFormat:e.labelFormat,position:e.position,filter:d(e.filter),noDataColor:e.noDataColor||"#ffffff",backgroundColor:e.backgroundColor||"#EFF5F6",maxValueColor:e.maxValueColor||"#000000",minValueColor:e.minValueColor||"#e0e0e0",tags:null!==(t=e.tags)&&void 0!==t?t:[]}},setAttributes:Pr(e),validate:()=>[],init:(e,t)=>Object.assign({type:"mercatorMap",dataSetId:e,dimension:[],measure:[],displaySubject:"",displayTitle:"",limit:5e3,filter:[],viewId:Rt(null==t?void 0:t.viewId),labelFormat:null,noDataColor:"#ffffff",backgroundColor:"#EFF5F6",maxValueColor:"#000000",minValueColor:"#e0e0e0",tags:[]},t),schema:Nr(e),removeField:(e,t)=>e,isRunnable:e=>!!(e.dimension&&e.dimension[0]&&e.measure&&e.measure[0]),autoGenerate(e){return this.init(e.id)},dataPanelConfig:()=>[$t(Mr,"data_set"),$t(Mr,"views"),Object.assign(Object.assign({},$t(Mr,"field_metrics")),{type:"fieldCollector",fieldFilterOptions:{forComponent:"mercatorMap"},maxAllowed:1,preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"}),Object.assign(Object.assign({},$t(Mr,"field_country")),{fieldFilterOptions:{onlyDimensions:!0,onlyFieldTypes:["string"],removeRuleGrouping:!1,removeSimpleMaths:!0,removePercentage:!0,removeAggregateMaths:!0},maxAllowed:1,preSetPartialAttributes:e=>({dimension:e}),getValues:e=>e.dimension,testId:"add-dimension"}),$t(Mr,"filter"),$t(Mr,"custom_metrics"),$t(Mr,"limit")],formatPanelConfig:()=>{var e;return[Bt(Mr),Object.assign(Object.assign({},$t(Mr,"chart_styles")),{subSection:[null===(e=Mr.format_panel.chart_styles)||void 0===e?void 0:e.subSectionDefinition.number_format]}),$t(Mr,"map_colors")]},supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0},supportedFeatures:{parameters:!1,colorGradient:!1}});var kr;!function(e){e.Linear="linear",e.Circular="circular"}(kr||(kr={}));const qr=e=>L().object(Object.assign(Object.assign({},W(e.attributesSchemaOptions)),{measure:L().array().items(B(e.queryEngineConfig.supportedAggregates,e.attributesSchemaOptions)),filter:Y(e.queryEngineConfig),type:L().valid("progress").required(),limit:X(),conditionalFormattingRules:de(e.queryEngineConfig),parameters:ie(e.queryEngineConfig,e.attributesSchemaOptions),goals:L().array().items(L().object({field:L().string().required().description("ID of the field in the data set to which the goal applies too"),value:L().number().required().description("Value of which the goal is set")})).description("Set the target value that progression is shown towards."),progressType:L().array().items(L().object({field:L().string().required().description("ID of the field to set the progress type of"),value:L().valid(kr.Linear,kr.Circular).required()})).description("Set the display type of the progress view"),formatter:L().object().pattern(L().string(),L().string()),prefixes:L().object().pattern(L().string(),L().string()),postfixes:L().object().pattern(L().string(),L().string()),tags:z()})),$r={title:"Progress",description:"Used to show progress towards goals, completion of tasks, or as indicators of performance metrics.",namespace:"progress",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this progress?"},views:{type:"views",title:"View",description:""},progress_goals:{type:"progressGoals",title:"Metric",description:"What do you want to show in each progress bar?"},filter:{type:"filter",title:"Filters",description:"Only include the information you want in this progress chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},stats_labels:{type:"statsLabels",title:"Labels",description:"",subSectionDefinition:{prefix:{title:"Prefix",description:"",namespace:"prefix"},postfix:{title:"Postfix",description:"",namespace:"postfix"},format:{title:"Format",description:"",namespace:"format"},count:{title:"Label count",description:"",namespace:"count"}}},progress_type:{type:"progressType",title:"Type",description:""}}},zr=e=>({title:$r.title,description:$r.description,dump:e=>e,namespace:$r.namespace,servicesClass:"Progress",load:e=>{var t;const r=Cr(e);return{type:"progress",measure:f(r.measure),displayTitle:r.displayTitle,displaySubject:r.displaySubject,protectedByOrganisation:r.protectedByOrganisation,viewId:Rt(r.viewId),filter:r.filter,dataSetId:r.dataSetId,limit:r.limit,conditionalFormattingRules:r.conditionalFormattingRules,parameters:r.parameters,prefixes:r.prefixes,postfixes:r.postfixes,formatter:r.formatter,goals:r.goals,progressType:r.progressType,tags:null!==(t=r.tags)&&void 0!==t?t:[]}},setAttributes:(t,r)=>P(t,r,qr(e)),validate:(t,r)=>St(t,r,e.queryEngineConfig),init:(e,t)=>Object.assign({type:"progress",measure:[],displayTitle:"",protectedByOrganisation:void 0,displaySubject:"",viewId:Rt(null==t?void 0:t.viewId),filter:[],dataSetId:e,limit:5e3,conditionalFormattingRules:[],parameters:{},formatter:{},progressType:[],goals:[],postfixes:{},prefixes:{},tags:[]},t),schema:qr(e),removeField:(t,r)=>F(t,r,e.queryEngineConfig),isRunnable:e=>e.measure.length>0,autoGenerate(e){return this.init(e.id)},dataPanelConfig:()=>[$t($r,"data_set"),$t($r,"views"),$t($r,"progress_goals"),$t($r,"filter"),$t($r,"custom_metrics")],formatPanelConfig:()=>[Bt($r),$t($r,"progress_type"),Object.assign(Object.assign({},$t($r,"stats_labels")),{prefix:Vt($r,"prefix"),postfix:Vt($r,"postfix"),format:Vt($r,"format"),count:Vt($r,"count")})],supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,aggregateMaths:!0,rules:!0,roundedNumbers:!0,conditional:!0},supportedFeatures:{parameters:!1,colorGradient:!1}}),Br=["title","description","data_panel","format_panel"],Gr=["title","description","callToAction"],Ur="call_to_action",Vr=L().alternatives().try(L().string(),L().object({sentence:L().string().custom(((e,t)=>{const r=/\{\{(\w+)\}\}/g;let n;for(;null!==(n=r.exec(e));){const e=n[1];if(!t.state.ancestors[0][`${e}_singular`]||!t.state.ancestors[0][`${e}_plural`]){const r=`"textOverride": "${e}" found in sentence but corresponding "${e}_singular" and "${e}_plural" fields are missing`;return t.error("any.invalid",{message:r})}}return e}))}).pattern(/.+_(singular|plural)$/,L().string())).messages({"any.custom":"{{#message}}"}),Hr=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,Yr=/<style\b[^<]*(?:(?!<\/style>)<[^<]*)*<\/style>/gi,Xr=/on[a-z]+\s*=\s*["'][^"']*["']/gi,Wr=/javascript:[^\s"']+/gi,Kr=new RegExp(`^(?:${/<(b|strong)>(?:(?!<\/(b|strong)>).)*<\/(b|strong)>/.source}|${/<(i|em)>(?:(?!<\/(i|em)>).)*<\/(i|em)>/.source}|[^*_<>])*$`,"m"),Qr=e=>{if(Hr.test(e)||Yr.test(e)||Xr.test(e)||Wr.test(e))throw new Error("Invalid content: potentially malicious elements detected.");return Kr.test(e)},Zr=(e,t,r,n)=>Jr(e,t,r,void 0,n),Jr=(e,t,r,n,i)=>{if(i)return`[key: ${e}]`;const o=n?function(e,t){const r=e[t],n=Vr.validate(r);return n.error&&n.error.details.forEach((e=>{var t;T(null===(t=e.context)||void 0===t?void 0:t.message)})),(()=>{if("string"==typeof r)return Qr(r);if("object"==typeof r)return Qr(r.sentence);if(void 0===r)return!0;throw new Error("Invalid translation type")})()?r:void 0}(n,e):void 0;let a;return a="object"==typeof o&&null!==o?o.sentence:"string"==typeof o?o:t,a=function(e,t){if(!t)return e;return e.replace(/\[\[([^\]]+)\]\]/g,((e,r)=>{const n=r.split("|");for(const e of n){const r=t[e];if("string"==typeof r&&""!==r)return r;if("number"==typeof r)return r.toString()}return""}))}(a,r),r&&(a=function(e,t,r){return Object.entries(t).forEach((([t,n])=>{if(n&&"object"==typeof n&&"count"in n){const i=n,o=1===i.count?r&&r[`${t}_singular`]||i.singular:r&&r[`${t}_plural`]||i.plural;e=e.replace(new RegExp(`{{${t}}}`,"g"),o)}})),e}(a,r,o)),function(e,t){if(!t)return e;for(const[r,n]of Object.entries(t))if("string"==typeof n||"number"==typeof n){const t=new RegExp(`\\[\\[${r}\\]\\]`,"g");e=e.replace(t,String(n))}return e}(a,r)},en=(e,t)=>{const r=null!=t?t:Jr;let n=e;const i=e.namespace;return Br.forEach((t=>{if("title"===t||"description"===t){const o=r(`${i}.${t}`,e[t]);n=Object.assign(Object.assign({},n),{[t]:o})}if("data_panel"===t){const o=`${i}.${t}`,a=[];e.dataPanelConfig().forEach((e=>{e.subSection&&(e.subSection=rn(e,r,o)),nn(e).forEach((t=>{const n=r(`${o}.${t.key}`,t.defaultValue);e[t.property]=n})),a.push(e)})),n=Object.assign(Object.assign({},n),{dataPanelConfig:()=>a})}if("format_panel"===t){const o=`${i}.${t}`,a=[];e.formatPanelConfig().forEach((e=>{e.subSection&&(e.subSection=rn(e,r,o)),function(e,t,r){function n(r,n){r&&nn(r).forEach((i=>{const o=e(`${t}.${n}.${i.key}`,i.defaultValue);r[i.property]=o}))}function i(e,t,r){t.forEach((t=>{const i=e[t];i&&n(i,r)}))}r.x&&(i(r.x,tn,"axis_labels"),n(r.x,"axis_labels")),r.y&&(i(r.y,tn,"axis_labels"),n(r.y,"axis_labels")),function(e){return"prefix"in e}(r)&&i(r,tn,"stats_labels")}(r,o,e),nn(e).forEach((t=>{const n=r(`${o}.${t.key}`,t.defaultValue);e[t.property]=n})),a.push(e)})),n=Object.assign(Object.assign({},n),{formatPanelConfig:()=>a})}})),n},tn=["count","axisTitle","format","postfix","prefix"];function rn(e,t,r){var n;return null===(n=e.subSection)||void 0===n?void 0:n.map((n=>(nn(n).forEach((i=>{const o=t(`${r}.${e.namespace}.${i.key}`,i.defaultValue);n[i.property]=o})),n)))}function nn(e){const t=e.namespace||e.type;if(!t)return[];const r=[];return Gr.forEach((n=>{if(e[n]){let i=n;"callToAction"===n&&(i=Ur),r.push({key:`${t}.${i}`,defaultValue:e[n],property:n})}})),r}const on={queryEngineConfig:{supportedFeatures:[],supportedAggregates:{},supportedTimeTruncFunctions:{},supportedOperators:{},supportedTransformationFunctions:{}}},an=function(e,t){if("custom"==e)return en(Fr(t||on),null==t?void 0:t.textOverride);if("barChart"==e)return en(Yt(t||on),null==t?void 0:t.textOverride);if("areaChart"==e)return en(Or(t||on),null==t?void 0:t.textOverride);if("lineChart"==e)return en(Qt(t||on),null==t?void 0:t.textOverride);if("pieChart"==e)return en(er(t||on),null==t?void 0:t.textOverride);if("scatterChart"==e)return en(ir(t||on),null==t?void 0:t.textOverride);if("comboChart"==e)return en(lr(t||on),null==t?void 0:t.textOverride);if("dataTable"==e)return en(hr(t||on),null==t?void 0:t.textOverride);if("basicTable"==e)return en(vr(t||on),null==t?void 0:t.textOverride);if("singleStat"==e)return en(jr(t||on),null==t?void 0:t.textOverride);if("progress"==e)return en(zr(t||on),null==t?void 0:t.textOverride);if("mercatorMap"==e)return en(Lr(t||on),null==t?void 0:t.textOverride);if("horizontalBarChart"==e)return en(wr(t||on),null==t?void 0:t.textOverride);throw`Cannot get interface for ${e}. Please implement it.`};["barChart","horizontalBarChart","areaChart","lineChart","scatterChart","pieChart","singleStat","dataTable","basicTable","comboChart","mercatorMap","progress","custom"].filter((e=>"custom"!=e)),r(8143);const sn=350,ln={colors:["#feae4a","#5fbaff","#e15e9d"],detail:"minimal",fontFamily:"Inter, sans-serif",rowLimit:6,fontSize:"0.65rem"},un=e=>"displayTitle"in e,cn=e=>({colSpan:e,isEmpty:!0}),dn=e=>"isEmpty"in e,pn=e=>{const r=[...e],n=(0,t.sumBy)(r,(e=>e.colSpan));return 12==n||(r[r.length-1].colSpan+=12-n),r},fn=e=>!(e&&dn(e)&&e.colSpan<=0),hn=(e,r)=>e.map((e=>((e,r)=>{const n=(e=>"components"in e?e:{components:e,height:sn})(e),i=n.components.filter(fn).map((e=>e&&e.colSpan<=0?Object.assign(Object.assign({},e),{colSpan:1}):e)),o=(0,t.sumBy)(i,(e=>null==e?1:0)),a=12-(0,t.sumBy)(i,(e=>null==e?0:e.colSpan)),s=Math.floor(a/o),l=[...i].map((e=>null===e?{isEmpty:!0,colSpan:s}:dn(e)||un(e)?e:mn(Object.assign(Object.assign({},e),{colSpan:e.colSpan}),r)));return{components:pn(l),height:n.height||sn}})(e,r))),mn=(e,r)=>{if("isEmpty"in e||un(e))return e;const{load:n}=an(e.attributes.type,r),i=n(e.attributes);let o=[];return(0,t.isArray)(e.localFilters)&&(o=[...e.localFilters?e.localFilters:[]].map((e=>Ye(e)))),"addOns"in e.attributes&&(0,t.isEmpty)(o)&&e.attributes.addOns.forEach((e=>{o=[...o,{type:"dateFilter"==e.type?"dateFilter":"singleSelectFilter",value:null,requiresValue:!1,managedByConfiguration:!1,appliesToFields:[{fieldId:e.field,dataSetId:i.dataSetId}]}]})),delete e.addOns,delete i.addOns,Object.assign(Object.assign({},e),{localFilters:o,attributes:i,results:[]})},gn=e=>L().alternatives().conditional(".type",{is:"barChart",then:Yt(e).schema}).conditional(".type",{is:"mercatorMap",then:Lr(e).schema}).conditional(".type",{is:"horizontalBarChart",then:wr(e).schema}).conditional(".type",{is:"lineChart",then:Qt(e).schema}).conditional(".type",{is:"comboChart",then:lr(e).schema}).conditional(".type",{is:"areaChart",then:Or(e).schema}).conditional(".type",{is:"pieChart",then:er(e).schema}).conditional(".type",{is:"scatterChart",then:ir(e).schema}).conditional(".type",{is:"singleStat",then:jr(e).schema}).conditional(".type",{is:"dataTable",then:hr(e).schema}).conditional(".type",{is:"basicTable",then:vr(e).schema}).conditional(".type",{is:"progress",then:zr(e).schema}).conditional(".type",{is:"custom",then:Fr(e).schema}),yn=L().object({displayTitle:L().string().min(1).required(),colSpan:L().number().valid(12).required()}),bn=L().number().min(1).max(12).required().messages({"number.base":'"colSpan" must be a number',"number.min":'"colSpan" must be at least {#limit}',"number.max":'"colSpan" must be less than or equal to {#limit}',"any.required":'"colSpan" is a required field'}),vn=L().object({isEmpty:L().valid(!0).required(),colSpan:bn}),_n=e=>L().object({attributes:gn({queryEngineConfig:e}),colSpan:bn}),An=e=>L().object({id:L().string(),display:wn(e),componentLibrary:L().array().required().items(L().object({attributes:gn({queryEngineConfig:e})})),globalFilters:lt(e),customFields:L().object().required()});function wn(e){return L().array().required().items(L().object({height:L().number().required(),components:L().array().required().min(1).items(L().alternatives(vn,_n(e),yn))}))}const Sn=(e,t)=>{const r=t?{queryEngineConfig:t}:void 0;if("string"==typeof e.definition)throw new Error("Dashboard is an encrypted string, use the query engine to fetch the dashboard. Please use the queryEngineConfig prop to pass the query engine configuration.");return{id:e.id,parentDashboardId:e.parent_dashboard_id,isPlayground:!1,permission:e.permission,globalFilters:[...e.definition.globalFilters||[]].map((e=>Ye(e))),componentLibrary:[...e.definition.componentLibrary||[]].map((e=>mn(Object.assign(Object.assign({},e),{colSpan:(null==e?void 0:e.colSpan)||1}),r))),theme:Object.assign(Object.assign({},ln),e.theme),display:hn(e.definition.display,r),webhookId:e.webhook_id||null,createdAt:new Date(e.created_at),updatedAt:new Date(e.updated_at),metadata:e.metadata||{}}},Tn=(e,t,r)=>Object.assign(Object.assign({},e),{dataSets:_t(t,r)});const En=(e,t)=>{const r=new Map;return e.forEach((e=>{const t=e.attributes.viewId;r.set(null!=t?t:"",e)})),t.forEach((e=>{const t=e.attributes.viewId;r.has(null!=t?t:"")||r.set(null!=t?t:"",e)})),Array.from(r.values())};function On(e){const t=e.find((t=>e.some((e=>e.id===t.parentGlobalLibraryId))))||e.find((e=>null===e.parentGlobalLibraryId));if(!t)throw new Error("No matching library found.");return t}const xn=e=>{e.library.views=[],e.library.customFields={}};class Cn extends Error{constructor(e){super(e),this.name="FailedToLoadQueryEngineConfig"}}const In=Cn;class jn extends Error{constructor(e){super(`The queryEngineEndpoint value '${e}' is not valid.`),this.name="InvalidQueryEngineEndpoint",this.invalidEndpoint=e}}const Rn=jn;class Dn extends Error{constructor(){super("The queryEngineEndpoint value is not of the correct type. It must be a string or a function."),this.name="InvalidQueryEngineEndpointType"}}const Fn=Dn;var Nn=r(3493),Pn=r.n(Nn);const Mn=e=>e.startsWith("/")?Mn(e.slice(1)):e.endsWith("/")?Mn(e.slice(0,-1)):e;var Ln=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))};const kn=(e,t)=>Ln(void 0,void 0,void 0,(function*(){if(e.dashboardAccessToken)return w("Using dashboard access token for auth header"),{auth:`Bearer ${e.dashboardAccessToken}`};if(e.projectAccessToken)return w("Using project access token for auth header"),{auth:`Bearer ${e.projectAccessToken}`};if(e.apiKey)return w("Using API Key for auth header"),{auth:`Api-Key ${e.apiKey}`};if(t.preFetchProjectAccessTokens&&(e.useCookieAuth||e.appSessionAuthToken)){w("Fetching project access token from the Vizzly API",t.preFetchProjectAccessTokens.projectId,"Filtering by",t.preFetchProjectAccessTokens.resourceFilters);const r=yield(e=>(t,r,n)=>{return i=void 0,o=void 0,s=function*(){let i={};r&&(i.auth=`Bearer ${r}`);let o="";n&&(o=`filter=${n.join(",")}`);const{status:a,body:s}=yield e({path:`/api/v2/auth/project/${t}/access_token?${o}`,method:"get",headers:i});if(200==a)return s.token.token},new((a=void 0)||(a=Promise))((function(e,t){function r(e){try{l(s.next(e))}catch(e){t(e)}}function n(e){try{l(s.throw(e))}catch(e){t(e)}}function l(t){var i;t.done?e(t.value):(i=t.value,i instanceof a?i:new a((function(e){e(i)}))).then(r,n)}l((s=s.apply(i,o||[])).next())}));var i,o,a,s})(qn(e))(t.preFetchProjectAccessTokens.projectId,e.appSessionAuthToken,t.preFetchProjectAccessTokens.resourceFilters);if(r)return w("Project access token received."),{auth:`Bearer ${r}`};w("Failed to receive project access token.")}else w("Not pre-fetching project access token.");return{}})),qn=e=>t=>Ln(void 0,void 0,void 0,(function*(){var r;try{const r=yield kn(e,t),n=t.headers||{},i=((e,t)=>{const r=Mn(e),n=Mn(t),i=(o=e).startsWith("https://")||o.startsWith("http://")||o.startsWith(".")?"":"/";var o;return""==r&&""==n?"/":""==n?`${i}${r}`:""!=r&&""!=n?`${i}${r}/${n}`:`${i}${n}`})(e.host,t.path),o=yield Pn()(i,{method:t.method,headers:Object.assign(Object.assign({"Content-Type":"application/json",Accept:"application/json"},r),n),redirect:"follow",referrerPolicy:"no-referrer",body:t.body?JSON.stringify(t.body):null,signal:t.abortSignal,mode:t.mode||void 0});let a=yield o.json();return w("HTTP Client Response",{host:e.host,path:t.path,status:o.status,responseId:o.headers.get("X-Request-Id")}),{body:a,status:o.status,headers:o.headers}}catch(e){if(null===(r=t.abortSignal)||void 0===r?void 0:r.aborted)return console.log("Aborted a request."),{status:500,body:{reason:"Aborted"},headers:null};throw e}})),$n=e=>"string"==typeof e?e:e.endpoint;const zn=e=>"string"==typeof e?{}:e.customHeaders?e.customHeaders():{},Bn=e=>t=>{return r=void 0,n=void 0,o=function*(){const r={host:$n(e)},n=Object.assign(Object.assign({},t),{headers:Object.assign(Object.assign({},t.headers),zn(e))});return qn(r)(n)},new((i=void 0)||(i=Promise))((function(e,t){function a(e){try{l(o.next(e))}catch(e){t(e)}}function s(e){try{l(o.throw(e))}catch(e){t(e)}}function l(t){var r;t.done?e(t.value):(r=t.value,r instanceof i?r:new i((function(e){e(r)}))).then(a,s)}l((o=o.apply(r,n||[])).next())}));var r,n,i,o};const Gn=e=>{return t=void 0,r=void 0,i=function*(){const t=Bn(e),r=yield t({method:"post",mode:"cors",path:"/api/v1/support",body:{}});return 200==r.status?"supportedFeatures"in(n=r.body)?n:Object.assign(Object.assign({},n),{supportedFeatures:["subquery"]}):null;var n},new((n=void 0)||(n=Promise))((function(e,o){function a(e){try{l(i.next(e))}catch(e){o(e)}}function s(e){try{l(i.throw(e))}catch(e){o(e)}}function l(t){var r;t.done?e(t.value):(r=t.value,r instanceof n?r:new n((function(e){e(r)}))).then(a,s)}l((i=i.apply(t,r||[])).next())}));var t,r,n,i},Un=o.QueryEngineConfig.getQueryEngineConfig("js");const Vn=e=>{let t="string"==typeof e?e:e.endpoint;return!!t.startsWith("http://")||!!t.startsWith("https://")||!!t.startsWith("/")};class Hn extends Error{constructor(e){super(e),this.name="FailedToLoadIdentity"}}const Yn=Hn;class Xn extends Error{constructor(e){super(e),this.name="InvalidIdentityReturn"}}const Wn=Xn,Kn=e=>{const t=(e=>{var t;const r=null===(t=e.split("."))||void 0===t?void 0:t[1];return JSON.parse((n=r,"object"==typeof window&&window&&window.atob?window.atob(n):Buffer.from(n,"base64").toString()).toString());var n})(e);return Object.assign(Object.assign({},t),{signature:e})};const Qn=e=>{return t=void 0,r=void 0,i=function*(){let t=yield e();if(t=(e=>{if(!e)throw new Wn("Failed to load identity.");const{error:t}=L().object({dashboardAccessToken:L().string().required(),dataAccessToken:L().string(),queryEngineAccessToken:L().string(),projectAccessToken:L().string().optional()}).validate(e);if(t)throw new Wn(t.message);return e})(t),!t)throw new Yn("Failed to fetch identity config.");const r=Zn()&&((n=window.location.href).split("#vizzly_")[1]||new URLSearchParams(new URL(n).search).get("_vizzlyDashboardAdmin"))||null;var n;return{identityConfig:((e,t,r,n)=>{let i=Kn(e);"scope"in i||(i.scope="read_write");const o={dashboardAccess:i,dataAccess:t?Kn(t):void 0,queryEngineAccessConfig:r?Kn(r):void 0,dashboardAdminOverride:n?Kn(n):void 0};return(e=>{const t=new Date,r=new Date(e.dashboardAccess.expires),n=!!e.dataAccess&&new Date(e.dataAccess.expires);!1!==n&&n<t&&console.warn("Vizzly data access token expired at;",n),r<t&&console.warn("Vizzly dashboard access token expired at;",r)})(o),o})(t.dashboardAccessToken,t.dataAccessToken,t.queryEngineAccessToken,r),tokens:t}},new((n=void 0)||(n=Promise))((function(e,o){function a(e){try{l(i.next(e))}catch(e){o(e)}}function s(e){try{l(i.throw(e))}catch(e){o(e)}}function l(t){var r;t.done?e(t.value):(r=t.value,r instanceof n?r:new n((function(e){e(r)}))).then(a,s)}l((i=i.apply(t,r||[])).next())}));var t,r,n,i},Zn=()=>"undefined"!=typeof window,Jn=[{namespace:"config.supported_operator",constants:l},{namespace:"config.supported_aggregate",constants:g},{namespace:"config.supported_time",constants:a}],ei=(e,t,r)=>{const n={};return Object.entries(e).forEach((([e,i])=>{n[e]=Object.assign(Object.assign({},i),{publicName:t(`${r}.${e}`,i.publicName)})})),n};class ti extends Error{constructor(){super("Identity prop type is invalid."),this.name="InvalidIdentityPropType"}}const ri=ti;class ni extends Error{constructor(e){super(e),this.name="FailedToResolveDataSets"}}const ii=ni;class oi extends Error{constructor(){super("dataSets property is not valid"),this.name="InvalidDataSetsPropType"}}const ai=oi;var si=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))};L().function();const li=e=>t=>si(void 0,void 0,void 0,(function*(){var r,n,i,o,a,s,l;return yield(n=e,i=null===(r=t.dataAccess)||void 0===r?void 0:r.signature,o=void 0,a=void 0,s=void 0,l=function*(){const e=Bn(n),t=yield e({method:"post",body:{dynamicConfig:"object"==typeof n?n.dynamicConfig:void 0,integritySignature:i},mode:"cors",path:"/api/v1/resolve-data-sets",abortSignal:void 0});if(200==t.status)return t.body.dataSets;throw new ii(`Failed to resolve data sets from ${JSON.stringify(n)}. Received status ${t.status}`)},new(s||(s=Promise))((function(e,t){function r(e){try{i(l.next(e))}catch(e){t(e)}}function n(e){try{i(l.throw(e))}catch(e){t(e)}}function i(t){var i;t.done?e(t.value):(i=t.value,i instanceof s?i:new s((function(e){e(i)}))).then(r,n)}i((l=l.apply(o,a||[])).next())})))})),ui=(t,r)=>(n,i)=>si(void 0,void 0,void 0,(function*(){try{let e=((e,t)=>{if(e)return e;if("function"==typeof t){if(!e)throw"dataSets function is required when loading a custom query engine config.";return e}if(t)return li(t);throw new ai})(t,r);if("function"!=typeof e)throw new ai;let o=yield e(n,i);if(!o)throw new ii("Failed to fetch data sets from the query engine endpoint");return o.map((e=>((e,t)=>Object.assign(Object.assign({},e),{fields:[...e.fields].map((e=>((e,t,r)=>{const n=E(e.id);return{id:e.id,dataType:e.dataType,publicName:e.publicName||n,dashboardRequiredFilterGroups:e.dashboardRequiredFilterGroups||[],description:e.description||void 0,canBeDimension:void 0===e.canBeDimension||e.canBeDimension,canBeMeasure:void 0===e.canBeMeasure||e.canBeMeasure,allowedOperators:void 0===e.allowedOperators?u(e,t):e.allowedOperators,allowedGranularities:void 0===e.allowedGranularities?Object.keys(t.supportedTimeTruncFunctions):e.allowedGranularities,supportedAggregateOptions:C(t,e.dataType,e.supportedAggregateOptions)}})(e,t)))}))(e,i)))}catch(t){if(T(t),t instanceof ai)throw t;if(t instanceof e.Errors.FailedToResolveDataSets)throw new ii(t.message);throw new ii("Failed to fetch data sets.")}}));var ci=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))};const di={apiHost:"https://api.vizzly.co"},pi="in-browser";class fi{constructor(e,t,r,n=di){this.queryEngineConfig=void 0,this.dataSets=void 0,this.queryEngine=e||pi,this.loadAccessTokens=t,this.loadDataSetsCallback=r,this.options=Object.assign(Object.assign({},di),n)}getQueryEngineConfig(){return ci(this,void 0,void 0,(function*(){return this.queryEngineConfig||(this.queryEngineConfig=yield(e=this.queryEngine,t=this.loadDataSetsCallback,r=void 0,n=void 0,o=function*(){try{if("in-browser"===e)return Un;if("function"==typeof e){let t=yield e();if(!t)throw new In("Failed to load query engine config.");return Object.assign({},t)}if(t){if(!Vn(e))throw new Rn(e);return Un}if("string"==typeof e||"object"==typeof e&&"endpoint"in e){if(!Vn(e))throw new Rn(e);const t=yield Gn(e);if(!t)throw new In("Failed to load query engine config.");return t}throw new Fn}catch(e){if(T(e),e instanceof Rn)throw e;if(e instanceof Fn)throw e;throw new In("Failed to load query engine config.")}},new((i=void 0)||(i=Promise))((function(e,t){function a(e){try{l(o.next(e))}catch(e){t(e)}}function s(e){try{l(o.throw(e))}catch(e){t(e)}}function l(t){var r;t.done?e(t.value):(r=t.value,r instanceof i?r:new i((function(e){e(r)}))).then(a,s)}l((o=o.apply(r,n||[])).next())}))),this.queryEngineConfig=((e,t)=>{const r=Object.assign({},e);return r.supportedAggregates&&(r.supportedAggregates=ei(r.supportedAggregates,t,Jn[1].namespace)),r.supportedTimeTruncFunctions&&(r.supportedTimeTruncFunctions=ei(r.supportedTimeTruncFunctions,t,Jn[2].namespace)),r.supportedOperators&&(r.supportedOperators=ei(r.supportedOperators,t,Jn[0].namespace)),r})(this.queryEngineConfig,((e,t,r)=>Jr(e,t,r,this.options.textOverrides,this.options.developerMode)))),this.queryEngineConfig;var e,t,r,n,i,o}))}getIdentity(){return ci(this,void 0,void 0,(function*(){if("function"!=typeof this.loadAccessTokens)throw new ri;const{tokens:e,identityConfig:t}=yield Qn(this.loadAccessTokens);return{accessTokens:e,identityConfig:t}}))}getDataSets(){return ci(this,void 0,void 0,(function*(){const{identityConfig:e}=yield this.getIdentity(),t=yield this.getQueryEngineConfig(),r=ui(this.loadDataSetsCallback,this.queryEngine);return this.dataSets=yield r(e,t),this.dataSets}))}load(){return ci(this,void 0,void 0,(function*(){const[{identityConfig:e},t,r]=yield Promise.all([this.getIdentity(),this.getQueryEngineConfig(),this.getDataSets()]);return{queryEngineConfig:t,dataSets:r,identityConfig:e,dashboardStorageStrategy:this.getDashboardStorageStrategy(t)}}))}getDashboardStorageStrategy(e){return"function"==typeof this.queryEngine?{strategy:"vizzlyApi"}:e.supportedFeatures.includes("encryptedDashboards")&&this.queryEngine!==pi?{strategy:"queryEngine",endpoint:this.queryEngine}:{strategy:"vizzlyApi"}}}function hi(e,t){if(!t)throw new Error("Query engine config is required to validate filters");const r=((e,t)=>{const r=[];return e.forEach((e=>{const n=st(t,!!e.requiresValue),{error:i,value:o}=n.validate(e);if(i)throw T(`Invalid global filter configuration: ${i.message}`),i;r.push(o)})),r})(e,t);return r}class mi extends Error{}class gi extends me{constructor(e,t){super(`'Issue with Services in ${t}: '${e}'`),this.name="ServicesValidation"}}class yi{constructor(e){var t,r;if(this.component=void 0,this.localFilters=void 0,this.isEmpty=void 0,null==e?void 0:e.component)this.component=null==e?void 0:e.component,this.colSpan=null!==(t=null==e?void 0:e.colSpan)&&void 0!==t?t:12;else{const t=cn(null!==(r=null==e?void 0:e.colSpan)&&void 0!==r?r:12);this.colSpan=t.colSpan,this.isEmpty=t.isEmpty}(null==e?void 0:e.localFilters)&&(this.localFilters=hi(e.localFilters,To.use().getViewConfiguration().queryEngineConfig))}set(e){var t;this.component=e.component,this.colSpan=null!==(t=e.colSpan)&&void 0!==t?t:12,this.isEmpty=!e.component||void 0,(null==e?void 0:e.localFilters)&&(this.localFilters=hi(e.localFilters,To.use().getViewConfiguration().queryEngineConfig))}setColSpan(e){try{!function(e){const{error:t,value:r}=bn.validate(e);if(t)throw new mi(t.message)}(e),this.colSpan=e}catch(e){throw new gi(e,"Cell.setColSpan")}}setComponent(e){this.component=e,this.isEmpty=void 0}emptyCell(e){const t=cn(null!=e?e:12);this.colSpan=t.colSpan,this.isEmpty=t.isEmpty,this.component=void 0}}class bi{constructor(e,t){this.components=[],this.height=sn,this.components=null!=e?e:[],this.height=null!=t?t:sn,this.validateTotalColSpan()}addCell(e,t){void 0===t?this.components.push(e):this.components.splice(t,0,e),this.validateTotalColSpan()}setHeight(e){this.height=e}setRow(e){this.components=e,this.validateTotalColSpan()}set(e,t){this.components=e,this.height=null!=t?t:sn,this.validateTotalColSpan()}validateTotalColSpan(){if(this.components.reduce(((e,t)=>e+t.colSpan),0)>12)throw new Error("Total column span of cells exceeds the allowed limit of 12.")}}class vi{constructor(e){this.component=void 0;let t={displayTitle:"New Header",colSpan:12};e&&(t=Object.assign(Object.assign({},t),{displayTitle:e}));const r={components:[t],height:null!=52?52:sn};this.component=[r]}setTitle(e){if(!this.component)throw new Error("Header is undefined");un(this.component[0].components[0])&&(this.component[0].components[0].displayTitle=e)}}function _i(e){let t=[];return e.forEach((e=>{var r,n;if(e instanceof bi){const n=null==e?void 0:e.components.map((e=>{var t;return e.component&&!e.isEmpty?{attributes:e.component.attributes,localFilters:null!==(t=e.localFilters)&&void 0!==t?t:[],updatesFromParameters:{},results:[],colSpan:e.colSpan,reports:[]}:(e.isEmpty,{colSpan:e.colSpan,isEmpty:!0})}));t.push({height:null!==(r=e.height)&&void 0!==r?r:sn,components:n})}e instanceof vi&&(null===(n=e.component)||void 0===n||n.forEach((e=>{t.push({height:e.height,components:e.components})})))})),t}const Ai=e=>{var t;let r=[],n=new Set;return null===(t=null==e?void 0:e.library)||void 0===t||t.forEach((e=>{var t;if(e.component&&e.component.attributes){const{viewId:i}=e.component.attributes;if(n.has(null!=i?i:""))throw new Error(`Duplicate viewId found: ${i}`);n.add(null!=i?i:""),r.push({attributes:e.component.attributes,localFilters:null!==(t=e.localFilters)&&void 0!==t?t:[],updatesFromParameters:{},results:[],colSpan:1,reports:[]})}})),r};function wi(e){const t=L().object({component:L().object().required(),uniqueViewId:L().string().min(1).required().messages({"string.base":"\"uniqueViewId\" should be a type of 'text'","string.empty":'"uniqueViewId" cannot be an empty field',"string.min":'"uniqueViewId" should have a minimum length of {#limit}',"any.required":'"uniqueViewId" maybe undefined or null'})}),{error:r}=t.validate(e);if(r)throw new mi(r.message)}const Si=(e,t)=>Object.assign(Object.assign({},e),{attributes:Object.assign(Object.assign({},e.attributes),{viewId:t})});class Ti{constructor(e){this.vizzly=To.use();const{init:t}=an(e.type,{queryEngineConfig:this.vizzly.getViewConfiguration().queryEngineConfig});this.attributes=t(null==e?void 0:e.dataSetId,e)}updateAttributes(e){const{setAttributes:t}=an(this.attributes.type,{queryEngineConfig:this.vizzly.getViewConfiguration().queryEngineConfig});if(!this.attributes)throw new Error("Attributes have not been initialized yet");this.attributes=t(this.attributes,e)}}class Ei extends Error{constructor(e){super(`Vizzly has not yet been loaded. Please see the instantiation docs;\nhttps://docs.vizzly.co/services/initializing\n\nThis might be expected behavior if you have set it up correctly. If so, you will need\nto handle this error and retry once Vizzly has finished loading.\n\nInstance Id; ${e}`),this.name="VizzlyInstanceNotLoaded"}}class Oi extends Error{constructor(e,t){super(`Timeout waiting for Vizzly to load. Please see the instantiation docs;\nhttps://docs.vizzly.co/services/initializing\n\nThis might be expected behavior if you have set it up correctly. If so, you will need\nto bump the timeout which was set to ${t}ms.\n\nInstance Id; ${e}`),this.name="TimeoutWaitingForVizzlyInstance"}}const xi={convert:!1,stripUnknown:!1,allowUnknown:!0},Ci=e=>L().array().items(L().alternatives().try(L().object({field:L().string().required().description("The ID of the field from the data set to reference."),op:L().string().valid(...Object.keys(e.supportedOperators)).required(),value:L().any().required()}).description("A filter object to apply to the data set."),L().array())),Ii={convert:!1,stripUnknown:!1,allowUnknown:!0};var ji;!function(e){e.SAVING="saving",e.SAVED="saved",e.DELETED="deleted"}(ji||(ji={}));const Ri=(e,t)=>e.map((e=>e.map((({field:e,functionId:t})=>({id:I({field:e.id,function:t}),publicName:e.publicName,dataType:e.dataType}))))),Di=(e,t,r)=>{const n=t.map((t=>{const n=ht(e,t.dataSetId);if(!n)throw"Data set not found for query attributes query";return Fe(n,t.measure,t.order,t.filter,t.dimension,t.timeDimension,t.limit,t.offset,r)}));return{queries:n.map((e=>e.query)),resultFields:Ri([...n].map((e=>e.measureDescription)))}};function Fi(e,t){let r=e.optionsFilters?e.optionsFilters[t.dataSetId]:[];return null==r?void 0:r.filter((e=>e.field!==t.fieldId))}const Ni=(e,t,r,n)=>{const{query:i,measureDescription:o}=ut(t,e.measure,e.order,Ie(e.filter,r),e.dimension,e.timeDimension||null,e.limit,e.offset,n);return{queries:[i],resultFields:Ri([o])}},Pi=Ni,Mi=Ni,Li=Ni,ki=Ni,qi=Ni,$i=Ni,zi=Ni,Bi=(e,t,r,n)=>{const{queries:i,measureDescription:o}=((e,t,r,n)=>{const i=((e,t,r,n)=>{let{query:i,measureDescription:o}=ut(r,e.measure,[],Ie(e.filter,t),[],null,1,e.offset,n);return i.measure=[{type:"number",value:0},...i.measure],o=[{field:{id:"single-stat-bumper-field",canBeDimension:!1,canBeMeasure:!1,publicName:"",dataType:"number",allowedOperators:[]},functionId:"none"},...o],{query:i,measureDescription:o}})(e,n,t,r);let o=null;return"deltaTimeDimension"in e&&(o=((e,t,r,n)=>t.deltaTimeDimension?ut(e,t.measure,[{field:t.deltaTimeDimension.field,direction:"asc",function:t.deltaTimeDimension.truncate}],Ie(t.filter,r),[],t.deltaTimeDimension,t.limit,t.offset,n):null)(t,e,n,r)),{queries:o?[i.query,o.query]:[i.query],measureDescription:o?[i.measureDescription,o.measureDescription]:[i.measureDescription]}})(e,t,n,r);return{queries:i,resultFields:Ri(o)}},Gi=(e,t,r,n)=>{switch(e.type){case"areaChart":return Pi(e,t,r,n);case"barChart":return Mi(e,t,r,n);case"horizontalBarChart":return Li(e,t,r,n);case"lineChart":return ki(e,t,r,n);case"pieChart":return qi(e,t,r,n);case"dataTable":return $i(e,t,r,n);case"basicTable":return zi(e,t,r,n);case"comboChart":return((e,t,r,n)=>{const{line:i,bar:o}=((e,t,r,n)=>{let i=ut(t,e.lineMeasure,e.order,Ie(e.filter,n),e.lineDimension,e.timeDimension,e.limit,e.offset,r);return{bar:ut(t,e.barMeasure,e.order,Ie(e.filter,n),e.barDimension,e.timeDimension,e.limit,e.offset,r),line:i}})(e,t,n,r);return{queries:[i.query,o.query],resultFields:Ri([i.measureDescription,o.measureDescription])}})(e,t,r,n);case"singleStat":case"progress":return Bi(e,t,r,n);case"scatterChart":return((e,t,r,n)=>{let i=[];e.xMeasure&&i.push(e.xMeasure),e.yMeasure&&i.push(e.yMeasure);const{query:o,measureDescription:a}=ut(t,i,e.order,Ie(e.filter,r),e.dimension,e.timeDimension,e.limit,e.offset,n);return{queries:[o],resultFields:Ri([a])}})(e,t,r,n);case"mercatorMap":return((e,t,r,n)=>Di([t],[{measure:e.measure,dataSetId:t.id,dimension:e.dimension,limit:e.limit,filter:Ie(e.filter,r),order:[],timeDimension:null}],n))(e,t,r,n);default:throw"Unsupported."}},Ui=(e,t,r)=>{let n=[],i=[];if(Array.isArray(e)&&"type"in e[0]&&"preparedQuery"==e[0].type&&"preAggregated"==e[0].preparedQueryType){const o=ht(r.dataSets,e[0].dataSetId);if(!o)throw"Data set not found for pre aggregated query";const[a]=o.preAggregated,{query:s,resultFields:l}=((e,t)=>({query:e,resultFields:t.fields.map((e=>({id:e.id,publicName:e.publicName,dataType:e.dataType})))}))(e[0],o),u=ht(r.dataSets,a),c=Ke(r.filterConfig,u,r.timeRangeOptions),d=je([c],t,u);n=[Object.assign(Object.assign({},s),{filter:{[u.id]:d}})],i=[l]}else if(Array.isArray(e)&&"type"in e[0]&&"preparedQuery"==e[0].type&&"uniqueArrayValues"==e[0].preparedQueryType){n=[e[0]];const t=ht(r.dataSets,e[0].dataSetId);if(!t)throw"Data set not found for view attributes query";const o=mt(t,e[0].fieldId),{query:a,resultFields:s}=dt(e[0].dataSetId,o);n=[a],i=[s]}else if(Array.isArray(e)){let o=[...e].map((e=>{const t=ht(r.dataSets,e.dataSetId);if(!t)throw"Data set not found for query-attributes query";const n=Ke(r.filterConfig,t,r.timeRangeOptions);return Object.assign(Object.assign({},e),{filter:Ie(e.filter,n)})}));const{queries:a,resultFields:s}=Di(r.dataSets,o,t);n=a,i=s}else if("type"in e&&("order"in e||"measure"in e)){const o=ht(r.dataSets,e.dataSetId);if(!o)throw"Data set not found for view attributes query";const a=Ke(r.filterConfig,o,r.timeRangeOptions);let{queries:s,resultFields:l}=Gi(e,o,a,t);n=s,i=l}else if("custom"!=e.type){let{queries:o,resultFields:a}=((e,t,r)=>{let n=[...e.appliesToFields].map((n=>{const i=ht(t,n.dataSetId);if(!i)throw"Data set not found for additional filter query";const o=mt(i,n.fieldId);if("string[]"==o.dataType){const t=je([Fi(e,n)],r,i),{query:a,resultFields:s}=dt(n.dataSetId,o,t);return{queries:[a],resultFields:[s]}}{const o=((e,t,r)=>{let n=[{field:t,function:"count"}],i=r?[r]:[],o=[{field:t,function:"none"}];return{dataSetId:e.id,measure:n,order:[],filter:i,dimension:o,timeDimension:null,limit:5e3,offset:0}})(i,n.fieldId,Fi(e,n));return Di(t,[o],r)}}));return{queries:n.flatMap((e=>e.queries)),resultFields:n.flatMap((e=>e.resultFields))}})(e,r.dataSets,t);n=o,i=a}return{queries:n,resultFields:i}};let Vi={};const Hi=e=>Array.isArray(e)?0==e.length:"object"==typeof e&&Hi(Object.keys(e)),Yi=(e,t,r,n)=>{return i=void 0,o=void 0,s=function*(){let i={};e.forEach(((e,t)=>{const r=(e=>{const t=JSON.stringify(e),r=Vi[t];if(!r)return w("Browser cache miss.",e),null;w("Browser cache hit.",e);const{item:n,expires:i}=r;return new Date<i?n:(delete Vi[t],null)})(n(e));r&&(w("Query result received from the cache."),i[t]=r)})),e.forEach(((e,r)=>{t(e)||(w("Query is not runnable."),i[r]=null)}));const o=e.filter(((e,r)=>t(e)&&void 0===i[r]));let a=[];return Hi(o)||(a=yield r(o)),null===a||Hi(a)&&Hi(i)?null:[...e].map(((e,r)=>{let o=i[r];if(t(e)&&null==o&&(o=(null==a?void 0:a.shift())||null,((e,t,r)=>{const n=JSON.stringify(e);let i=new Date;i.setSeconds(i.getSeconds()+20),w("Browser cache new object set.",n),Vi[n]={item:t,expires:i}})(n(e),o)),void 0===o)throw"A result went missing...";return o}))},new((a=void 0)||(a=Promise))((function(e,t){function r(e){try{l(s.next(e))}catch(e){t(e)}}function n(e){try{l(s.throw(e))}catch(e){t(e)}}function l(t){var i;t.done?e(t.value):(i=t.value,i instanceof a?i:new a((function(e){e(i)}))).then(r,n)}l((s=s.apply(i,o||[])).next())}));var i,o,a,s};var Xi=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))};const Wi=(e,t,r)=>Xi(void 0,void 0,void 0,(function*(){const{queries:n,resultFields:i}=Ui(t,e.queryEngineConfig,r),o=yield Yi(n,(e=>!0),(t=>Xi(void 0,void 0,void 0,(function*(){return yield((e,t,r,n)=>{return i=void 0,o=void 0,s=function*(){const i=Bn(t),{status:o,body:a}=yield i({path:"/api/v1/create-results",method:"post",mode:"cors",body:{queries:e,virtualFields:{},dynamicConfig:"object"==typeof t?t.dynamicConfig:void 0,identityConfigIntegritySignature:r},abortSignal:n});return 200==o?a:null},new((a=void 0)||(a=Promise))((function(e,t){function r(e){try{l(s.next(e))}catch(e){t(e)}}function n(e){try{l(s.throw(e))}catch(e){t(e)}}function l(t){var i;t.done?e(t.value):(i=t.value,i instanceof a?i:new a((function(e){e(i)}))).then(r,n)}l((s=s.apply(i,o||[])).next())}));var i,o,a,s})(t,e.queryEngineEndpoint,e.dataAccessToken,r.abortSignal)}))),(t=>({query:t,cacheKeyNamespace:e.cacheKeyNamespace})));return[...n].map(((e,t)=>{if(null===o)return null;const r=o[t];return void 0===r?null:{content:r,fields:i[t]}}))}));var Ki=r(7331),Qi=r.n(Ki);const Zi={},Ji=[];let eo={};class to extends Error{constructor(e){super(e),this.name="MissingVizzlyInMemoryDb"}}const ro=to,no=()=>{const e=window.VizzlyInMemoryDb;if(!e)throw new ro("VizzlyInMemoryDb missing! This means that 'window.VizzlyInMemoryDb' was not set. This is required for the in-browser vizzly setup.\n\nPlease ensure you have added the script tag to load the in-browser query engine.\n\nFor example, this should be added within the <head> tag;\n<script src=\"https://static.app.vizzly.co/query-engine/0.8.16/vizzly-in-memory-db.umd.js\"><\/script>\n\nNote, you can change the version of the in-memory database by changing '0.8.3' to the version you require.\n");return e};const io=(e,r)=>{const n={type:"orWhere",value:[...[...e].filter((e=>!(0,t.isEmpty)(e)))].map((e=>({type:"andWhere",value:e.map((e=>({type:"where",left:oo(e.field,r),op:e.op,right:{type:(0,t.isArray)(e.value)?"list":(0,t.isNumber)(e.value)?"number":"unsafeString",value:(0,t.isArray)(e.value)?e.value.map((e=>({type:"unsafeString",value:e}))):e.value}})))})))};let i={type:"andWhere",value:[]};return(0,t.isEmpty)(n.value)||(i.value=[...i.value,n]),i},oo=(e,t)=>{if("subquery"==e.type)return{type:"subquery",value:{select:[oo(e.value.measure[0],t)],where:io(e.value.filter,t),join:[]}};if("maths"==e.type)return{type:"maths",left:oo(e.left,t),right:oo(e.right,t),op:e.op};if("date_maths"==e.type)return{type:"date_maths",left:oo(e.left,t),right:oo(e.right,t),op:e.op};if("number"==e.type)return e;if("null"==e.type)return e;if("string"==e.type)return{type:"unsafeString",value:e.value};if("function"==e.type)return{type:"function",function:e.function,value:oo(e.value,t)};if("switchField"==e.type)return{type:"case",value:{cases:e.value.cases.map((e=>({result:oo(e.returns,t),where:io(e.filter,t)})))}};if("field"==e.type&&"none"!=e.function){const r=mt(t,e.value);return{type:"function",function:e.function,value:{type:"field",value:{nativeDataType:r.dataType,address:["_",t.id,r.id]}}}}if("field"===e.type){const r=mt(t,e.value);return{type:"field",value:{nativeDataType:r.dataType,address:["_",t.id,r.id]}}}throw`Unsupported measure in JS query engine ${JSON.stringify(e)}`};var ao=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))};const so=(e,t)=>`${e}::${t}`,lo=(e,t,r)=>ao(void 0,void 0,void 0,(function*(){const n=[...e].map((e=>ao(void 0,void 0,void 0,(function*(){const[n]=gt(t,e.dataSetId),i=so(r,e.dataSetId);if(Zi[i]&&n){const t=yield((e,t)=>{return r=void 0,n=void 0,o=function*(){var r,n,i;if("query"===e.type){if(0===(null===(r=null==e?void 0:e.measure)||void 0===r?void 0:r.length))return[[]];const i={select:e.measure.map((e=>oo(e,t))),where:io(e.filter,t),order:e.order,group:e.group,join:[],limit:e.limit||5e3,offset:e.offset||0,from:["_",e.dataSetId]},o=yield no().query(i);return(null===(n=null==o?void 0:o[0])||void 0===n?void 0:n.values)||[]}if("preparedQuery"===e.type&&"uniqueArrayValues"===e.preparedQueryType){const r={type:"uniqueArrayValues",field:{type:"field",value:{address:["_",e.dataSetId,e.fieldId],nativeDataType:"JSON"}},where:io(e.filter,t),join:[]},n=yield no().query(r);return(null===(i=null==n?void 0:n[0])||void 0===i?void 0:i.values)||[]}throw"Unsupported query"},new((i=void 0)||(i=Promise))((function(e,t){function a(e){try{l(o.next(e))}catch(e){t(e)}}function s(e){try{l(o.throw(e))}catch(e){t(e)}}function l(t){var r;t.done?e(t.value):(r=t.value,r instanceof i?r:new i((function(e){e(r)}))).then(a,s)}l((o=o.apply(r,n||[])).next())}));var r,n,i,o})(e,n);return t}return console.warn("Returning an empty result."),[]}))));return yield Promise.all(n)})),uo=(e,t,r,n)=>ao(void 0,void 0,void 0,(function*(){return yield no().init(t.map((e=>({id:null==e?void 0:e.id,fields:null==e?void 0:e.fields.map((e=>({id:e.id,dataType:e.dataType})))})))),yield Promise.all([...e].flatMap((e=>ao(void 0,void 0,void 0,(function*(){const[i]=gt(t,e.dataSetId);if(i){const t=yield((e,t,r)=>{return n=void 0,i=void 0,a=function*(){eo[e.id]||(eo[e.id]=Qi()(t,5e3,{leading:!0}));let n=eo[e.id];if(w("Fetching data for in-browser query engine. DataSet;",e.id,"CacheKey;",r),Zi[r])return w("Returning data for in-browser query engine from the cache."),Zi[r];{const t=yield n(e);return t||Ji.includes(e.id)||(Ji.push(e.id),console.error(`Failed to download data for data set ${e.id}`)),t&&n.cancel(),Zi[r]=t,t}},new((o=void 0)||(o=Promise))((function(e,t){function r(e){try{l(a.next(e))}catch(e){t(e)}}function s(e){try{l(a.throw(e))}catch(e){t(e)}}function l(t){var n;t.done?e(t.value):(n=t.value,n instanceof o?n:new o((function(e){e(n)}))).then(r,s)}l((a=a.apply(n,i||[])).next())}));var n,i,o,a})(i,r,so(n,e.dataSetId)),o={id:null==i?void 0:i.id,fields:null==i?void 0:i.fields.map((e=>({id:e.id,dataType:e.dataType})))};yield no().ingest(o,t||[])}return[]}))))),yield lo(e,t,n)}));var co=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},po=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))};function fo(e,t,r){return n=this,i=void 0,a=function*(){return"vizzlyQueryEngine"==e.type?yield Wi(e,t,r):"vizzlyJsQueryEngine"==e.type?yield((e,t,r)=>co(void 0,void 0,void 0,(function*(){const{queries:n,resultFields:i}=Ui(t,Un,r);let o=yield Yi(n,(e=>!0),(t=>co(void 0,void 0,void 0,(function*(){return yield uo(t,r.dataSets,e.loadData,e.cacheKeyNamespace)}))),(t=>({query:t,cacheKeyNamespace:e.cacheKeyNamespace})));return null===o&&(o=n.map((()=>null))),[...n].map(((e,t)=>{if(null===o)return null;const r=o[t];return void 0===r?null:{content:r,fields:i[t]}}))})))(e,t,r):"custom"==e.type?yield((e,t,r)=>po(void 0,void 0,void 0,(function*(){const{queries:n,resultFields:i}=Ui(t,e.queryEngineConfig,r),o=yield Yi(n,(e=>("preparedQuery"==e.type&&S("Custom query engine does not support prepared queries."),"query"==e.type)),(t=>po(void 0,void 0,void 0,(function*(){const n=yield e.runQueries(t,Object.assign(Object.assign({},r),{dataAccessToken:e.dataAccessToken}));return null==n?t.map((()=>null)):n.map(((e,t)=>Array.isArray(e)?{fields:i[t],content:e}:e))}))),(t=>({query:t,cacheKeyNamespace:e.cacheKeyNamespace})));return null===o?n.map((()=>null)):o})))(e,t,r):[]},new((o=void 0)||(o=Promise))((function(e,t){function r(e){try{l(a.next(e))}catch(e){t(e)}}function s(e){try{l(a.throw(e))}catch(e){t(e)}}function l(t){var n;t.done?e(t.value):(n=t.value,n instanceof o?n:new o((function(e){e(n)}))).then(r,s)}l((a=a.apply(n,i||[])).next())}));var n,i,o,a}var ho=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))};const mo=(e,t)=>{const r=new Date(e.getTime()-24*t*60*60*1e3);return new Date(r.getFullYear(),r.getMonth(),r.getDate())},go=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()),yo={today:!1,past_1_day:!0,yesterday:!0,past_3_days:!0,past_7_days:!0,past_30_days:!0,past_90_days:!0,past_3_months:!1,past_6_months:!1,past_12_months:!1,past_18_months:!1},bo=(e,t)=>{const r=go(e),n=new Date(r);return n.setDate(n.getDate()+1),n.setMilliseconds(n.getMilliseconds()-1),{description:t,range:{before:n,after:r}}},vo=(e,t,r)=>{const n=new Date;let i=new Date(n);return t>0&&i.setMonth(n.getMonth()-t),e>0&&(i=new Date(n.getTime()-24*e*60*60*1e3)),{description:r,range:{before:n,after:i}}};var _o=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))};const Ao="default";e.VizzlyApiClientLogger.UserAgentProduct="Services";const wo=Object.assign({},{apiHost:"https://api.vizzly.co"});class So{constructor(t,r,n,i,o,a){this.programmaticDashboard=o,this.dataSets=n,this.queryEngineConfig=r,this.identityConfig=t,this.vizzlyAPIClient=((t,r,n)=>{var i,o,a;const s=new e.Authentication({dashboardAccessToken:null==t?void 0:t.dashboardAccess.signature,dataAccessToken:null===(i=null==t?void 0:t.dataAccess)||void 0===i?void 0:i.signature,projectAdminOverrideToken:null===(o=null==t?void 0:t.dashboardAdminOverride)||void 0===o?void 0:o.signature,queryEngineAccessToken:null===(a=null==t?void 0:t.queryEngineAccessConfig)||void 0===a?void 0:a.signature});let l=()=>({});"queryEngine"===r.strategy&&"string"!=typeof r.endpoint&&(l=r.endpoint.customHeaders||l);const u="queryEngine"===r.strategy?new e.VizzlyQueryEngineApi(s,"string"==typeof r.endpoint?r.endpoint:r.endpoint.endpoint,l):void 0,c=new e.VizzlyApi(s,n.host),d=new e.VizzlyAppApi(s,"https://app.vizzly.co");return new e.Vizzly({vizzlyApi:c,vizzlyAppApi:d,vizzlyQueryEngineApi:u},"queryEngine"===r.strategy?new e.PersistViaQueryEngine:new e.PersistDirectToVizzlyApi)})(t,i,a)}static load(e,t=wo){return _o(this,void 0,void 0,(function*(){w("Starting load process for the services package.");const{queryEngine:r,dataSets:n,identity:i,programmaticDashboard:o}=e,a=new fi(r,i,n,t),{queryEngineConfig:s,dataSets:l,identityConfig:u,dashboardStorageStrategy:c}=yield a.load(),d=new To(u,s,l,c,o,{host:t.apiHost});return To._instanceStore[Ao]=d,To.queryEngine=r,w("Loaded services package and added it to the instance store."),d}))}static use(e=Ao){const t=To._instanceStore[e];if(!t)throw new Ei(e);return t}static waitToUse(e=Ao,t=1e4){return _o(this,void 0,void 0,(function*(){const r=So._instanceStore,n=e;return new Promise(((i,o)=>{if(r.hasOwnProperty(n))return void i(r[n]);const a=setTimeout((()=>{clearTimeout(a),o(new Oi(e,t))}),t),s=setInterval((()=>{r.hasOwnProperty(n)&&(clearTimeout(a),clearInterval(s),i(r[n]))}),10)}))}))}static clearInstances(){To._instanceStore={}}createDashboard(e){var t;return _o(this,void 0,void 0,(function*(){((e,t)=>{const r=L().object({definition:t?An(t):L().object().required(),parentDashboardId:L().string().required(),metadata:L().object()}).validate(e,Ii);if(r.error)throw new mi(r.error.message)})(e,this.queryEngineConfig);const r=this.vizzlyAPIClient.getDashboardManager(),{dashboard:n}=yield r.create({metadata:e.metadata||e.meta,definition:e.definition,parentDashboardId:e.parentDashboardId,permissions:[{scope:"read_write"}]}),i=Sn(n,this.queryEngineConfig);return Tn(i,this.dataSets,(null===(t=n.definition)||void 0===t?void 0:t.customFields)||{})}))}updateDashboard(e){var t;return _o(this,void 0,void 0,(function*(){((e,t)=>{const r=L().object({dashboardId:L().string().required(),definition:t?An(t):L().object().required(),metadata:L().object().optional(),deleted:L().boolean().optional()}).validate(e,Ii);if(r.error)throw new mi(r.error.message)})(e,this.queryEngineConfig);const r=this.vizzlyAPIClient.getDashboardManager(),n=yield r.update({dashboardId:e.dashboardId,metadata:e.metadata||e.meta,definition:e.definition,deleted:e.deleted,abortSignal:e.abortSignal}),i=Sn(n,this.queryEngineConfig);return Tn(i,this.dataSets,(null===(t=n.definition)||void 0===t?void 0:t.customFields)||{})}))}getDashboards(e){return _o(this,void 0,void 0,(function*(){const t=this.vizzlyAPIClient.getDashboardManager(),r=(yield t.getDashboards((null==e?void 0:e.abortController)?{abortSignal:null==e?void 0:e.abortController.signal}:{})).flatMap((e=>So.upcastDashboard(e,this.dataSets,this.queryEngineConfig)));return this.programmaticDashboard?function(e,t){const r=((e,t)=>{if(t.length>0&&"vizzly_editor"===t[0].id)return[...e,Object.assign(Object.assign({},t[0]),{parentDashboardId:e[0].id,isProgrammatic:!0,permission:e[0].permission})]})(e,t);if(r)return r;const n=new Map(t.map((e=>[e.id,e])));return e.map((e=>{const t=n.get(e.id);if(null!==e.parentDashboardId){const t=n.get(e.parentDashboardId);if((null==t?void 0:t.id)===e.parentDashboardId)return Object.assign(Object.assign({},e),{componentLibrary:En(null==t?void 0:t.componentLibrary,e.componentLibrary)})}return null!=t?t:e}))}(r,((e,t)=>{let r=[];return e.map((e=>{var n;if(void 0===e.id)throw new Error("Dashboard id is undefined");const i=Tn(e,t,e.customFields||{});r.push({id:i.id,dataSets:i.dataSets,display:null!==(n=i.display)&&void 0!==n?n:[],globalFilters:[],componentLibrary:i.componentLibrary||[],parentDashboardId:null,metadata:{},theme:{},webhookId:"",isPlayground:!1,createdAt:new Date,updatedAt:new Date,isProgrammatic:!0})})),r})(yield this.programmaticDashboard(this.dataSets),this.dataSets)):r}))}getGlobalLibraries(e){return _o(this,void 0,void 0,(function*(){const t=(yield this.vizzlyAPIClient).getGlobalLibraryManager(),r=yield t.getGlobalLibraries((null==e?void 0:e.abortController)?{abortSignal:null==e?void 0:e.abortController.signal}:{});return this.globalLibraryPermissions=r.permissions,r.global_libraries.map((e=>{return{id:(t=e).id,name:t.name,library:t.library,createdAt:new Date(t.created_at),updatedAt:new Date(t.updated_at),parentGlobalLibraryId:t.parent_global_library_id};var t}))}))}getViewConfiguration(){return{queryEngineConfig:this.queryEngineConfig}}getIdentityConfig(){return this.identityConfig}query(e,t){return _o(this,void 0,void 0,(function*(){w("[Services] Querying data with queries:",e);let r=Ao;(null==t?void 0:t.instanceId)&&(r=t.instanceId);const n=So._instanceStore[r],i=function(e,t){let r=e;return t&&r.map((e=>{const r=t[e.dataSetId].flat();0!==r.length&&e.filter.push(r)})),r}(e,null==t?void 0:t.dashboardFilters);((e,t)=>{const r=L().array().items((e=>L().object(Object.assign(Object.assign({},Q(e,{})),{filter:Ci(e),timeDimension:L().alternatives(U(e.supportedTimeTruncFunctions),L().valid(null))})))(t)).validate(e,xi);if(r.error)throw new mi(r.error.message)})(i,n.queryEngineConfig);const o=(()=>{if(null==t?void 0:t.queryEngineEndpoint)return t.queryEngineEndpoint;if(To.queryEngine){if("string"==typeof To.queryEngine)return To.queryEngine;if("string"!=typeof To.queryEngine&&"endpoint"in To.queryEngine)return To.queryEngine.endpoint}})(),a=((e,t,r,n,i,o)=>{var a;let s=(l=e.dashboardAccess,["accessType","dashboardId","projectId","userReference","scope"].map((e=>`${e}:${l[e]}`)).join(":::"));var l;if(n)return(i,o)=>ho(void 0,void 0,void 0,(function*(){var a;return yield fo({type:"custom",queryEngineConfig:t,runQueries:n,dataAccessToken:null===(a=e.dataAccess)||void 0===a?void 0:a.signature,cacheKeyNamespace:s},i,{abortSignal:o.abortSignal,dataSets:o.dataSets,filterConfig:o.filterConfig||{},timeRangeOptions:r})}));if(i)return(e,t)=>ho(void 0,void 0,void 0,(function*(){return yield fo({type:"vizzlyJsQueryEngine",loadData:i,cacheKeyNamespace:s},e,{abortSignal:t.abortSignal,dataSets:t.dataSets,filterConfig:t.filterConfig||{},timeRangeOptions:r})}));if(o&&(null===(a=e.dataAccess)||void 0===a?void 0:a.signature))return(n,i)=>ho(void 0,void 0,void 0,(function*(){var a;return yield fo({type:"vizzlyQueryEngine",queryEngineConfig:t,dataAccessToken:null===(a=e.dataAccess)||void 0===a?void 0:a.signature,queryEngineEndpoint:o,cacheKeyNamespace:s},n,{abortSignal:i.abortSignal,dataSets:i.dataSets,filterConfig:i.filterConfig||{},timeRangeOptions:r})}));throw"Missing required props."})(n.identityConfig,n.queryEngineConfig,((e,t)=>{const r=(e=>{return{today:bo(new Date,e("filter.today","Today")),past_1_day:vo(1,0,e("filter.past_1_day","Last 24 hours")),yesterday:(t=new Date,r=e("filter.yesterday","Yesterday"),{description:r,range:{before:go(t),after:go(mo(t,1))}}),past_3_days:vo(3,0,e("filter.past_3_days","Last 3 days")),past_7_days:vo(7,0,e("filter.past_7_days","Last 7 days")),past_30_days:vo(30,0,e("filter.past_30_days","Last 30 days")),past_90_days:vo(90,0,e("filter.past_90_days","Last 90 days")),past_3_months:vo(0,3,e("filter.past_3_months","Last 3 months")),past_6_months:vo(0,6,e("filter.past_6_months","Last 6 months")),past_12_months:vo(0,12,e("filter.past_12_months","Last 12 months")),past_18_months:vo(0,18,e("filter.past_18_months","Last 18 months"))};var t,r})(e),n=Object.keys(yo).map((e=>e in r?`_vizzly_${e}`:e)),i=n.indexOf("_vizzly_today");i>-1&&(n.splice(i,1),n.unshift("_vizzly_today"));let o={},a={};for(const e of n){const n=e.replace("_vizzly_",""),i=r[n],o=null==t?void 0:t[n];"boolean"==typeof o?o&&(a[e]=i):null!=o?a[e]=o:!1!==yo[n]&&(a[e]=i)}if(t)for(const[e,r]of Object.entries(t))e in yo||(n.push(e),a[e]=r);for(const e of n)e in a&&(o[e]=a[e]);return o})(Zr,null==t?void 0:t.dateFilterOptions),null==t?void 0:t.runQueries,null==t?void 0:t.data,o);return{results:yield(()=>_o(this,void 0,void 0,(function*(){var e;try{return yield a(i,{abortSignal:null===(e=null==t?void 0:t.abortController)||void 0===e?void 0:e.signal,dataSets:this.dataSets})}catch(e){return T("[Services] Error fetching data on query:",e),null}})))()}}))}static upcastDashboard(e,t,r){var n;try{const i=Sn(e,r);return[Tn(i,t,(null===(n=e.definition)||void 0===n?void 0:n.customFields)||{})]}catch(t){return T(`Failed to upcast dashboard ${e.id}. This dashboard will not be available for use.`,t),[]}}static filterDashboards(e,r){let n=(0,t.cloneDeep)(e);return r.onlyParentDashboards&&(n=n.filter((e=>null===e.parentDashboardId))),r.onlyChildDashboards&&(n=n.filter((e=>null!==e.parentDashboardId))),r.onlyChildDashboardsForParent&&(n=n.filter((e=>e.parentDashboardId===r.onlyChildDashboardsForParent))),r.onlyAllowScope&&(n=n.filter((e=>{var t;return(null===(t=e.permission)||void 0===t?void 0:t.scope)===r.onlyAllowScope}))),r.onlyDashboardsIncludingMetadata&&(n=n.filter((e=>{const n=Object.keys(r.onlyDashboardsIncludingMetadata||{});return(0,t.every)(n,(t=>{var n;return e.metadata[t]===(null===(n=null==r?void 0:r.onlyDashboardsIncludingMetadata)||void 0===n?void 0:n[t])}))}))),n}static validateDashboard(e){L()}updateGlobalLibrary(e){return _o(this,void 0,void 0,(function*(){try{const t=this.vizzlyAPIClient.getGlobalLibraryManager();return yield t.update(e)}catch(e){T("Error updating global library:",e)}}))}static eventBusController(e,t){var r;return _o(this,void 0,void 0,(function*(){try{const n=So.use();if(("addComponentToLibrary"===e.action||"deleteComponentFromLibrary"===e.action)&&n.globalLibraryPermissions){To.publish({data:{action:"updateToGlobalLibraryStatus",state:ji.SAVING}});const[i]=yield Promise.all([yield n.getGlobalLibraries({abortController:null==t?void 0:t.abortController})]);let o=On(i);"addComponentToLibrary"===e.action&&(o=function(e,t,r){const n=On(e);if(!n)throw new Error("No matching library found.");return n.library.views&&n.library.customFields||xn(n),function(e,t){if(!e)throw new Error("View array needs initialised");const r=e.findIndex((e=>e.attributes.viewId===(null==t?void 0:t.attributes.viewId)));-1!==r?e[r]=t:e.push(t)}(n.library.views,t),function(e,t){var r;if(!e)throw new Error("View object needs initialised");for(const n in e)e.hasOwnProperty(n)&&(null===(r=t.library.customFields)||void 0===r?void 0:r.hasOwnProperty(n))&&(t.library.customFields[n]=e[n])}(r,n),n}(i,e.component,e.customFields)),"deleteComponentFromLibrary"===e.action&&(o=((e,t)=>{const r=On(e);if(!r)throw new Error("No matching library found.");return r.library.views?r.library.views=r.library.views.filter((e=>e.attributes.viewId!==t.attributes.viewId)):r.library.views=[],r})(i,e.component));const a=function(e,t){var r;return(null===(r=e.find((e=>"read_write"===e.scope&&t[0].id===e.globalLibraryId)))||void 0===r?void 0:r.token)||""}(n.globalLibraryPermissions,[o]);((...e)=>{_("info")&&console.info("[VIZZLY INFO]",...e.map(A))})("library and tokens for update",{libraryForUpdate:o,tokenForLibrary:a});const s={globalLibraryId:o.id,library:o.library,abortSignal:null===(r=null==t?void 0:t.abortController)||void 0===r?void 0:r.signal,globalLibrarySessionToken:a};if(yield n.updateGlobalLibrary(s)){let t=ji.SAVED;"deleteComponentFromLibrary"===e.action&&(t=ji.DELETED),To.publish({data:{action:"newViewsInGlobalLibrary"}}),To.publish({data:{action:"updateToGlobalLibraryStatus",state:t}})}}}catch(e){T("Error handling event:",e)}}))}static publish(e){To.eventBus.map((t=>{t(e)})),To.eventBusController(e.data).catch((e=>{T("Failed to handle event:",e)}))}static subscription(e){return To.eventBus.push(e),()=>{To.eventBus=To.eventBus.filter((t=>t!==e))}}}So._instanceStore={},So.DEFAULT_INSTANCE_ID=Ao,So.eventBus=[],So.Row=bi,So.Cell=yi,So.Dashboard=class{constructor(e,t){this.dashboard=void 0;let r={id:e};(null==t?void 0:t.display)&&(r=Object.assign(Object.assign({},r),{display:_i(null==t?void 0:t.display)})),(null==t?void 0:t.customFields)&&(r=Object.assign(Object.assign({},r),{customFields:t.customFields})),(null==t?void 0:t.library)&&(r=Object.assign(Object.assign({},r),{componentLibrary:Ai(null==t?void 0:t.library)})),this.dashboard=(e=>Object.assign({isPlayground:!1,display:[{components:[cn(8),cn(4)],height:sn},{components:[cn(4),cn(4),cn(4)],height:sn}],componentLibrary:[],globalFilters:[],customFields:{}},e))(r)}setDisplay(e){let t=_i(e);if(!this.dashboard)throw new Error("Dashboard is undefined");this.dashboard.display=t}setCustomFields(e){if(!this.dashboard)throw new Error("Dashboard is undefined");this.dashboard.customFields=e}setLibrary(e){if(!this.dashboard)throw new Error("Dashboard is undefined");this.dashboard.componentLibrary=Ai(e)}build(){var e,t;if(!this.dashboard)throw new Error("Dashboard is undefined");return Object.assign(Object.assign({},this.dashboard),{display:null===(e=this.dashboard)||void 0===e?void 0:e.display,componentLibrary:null===(t=this.dashboard)||void 0===t?void 0:t.componentLibrary})}},So.Editor=class{constructor(e){this.editor=void 0,(null==e?void 0:e.component)&&(this.editor=e.component)}setComponent(e){if(!this.editor)throw new Error("Editor is undefined");this.editor=e}build(){if(!this.editor)throw new Error("Editor is undefined");return((e,t)=>{var r,n;if(!e.attributes)throw new Error("Component attributes are required in saveable");return{attributes:Object.assign(Object.assign({},e.attributes),{protectedByOrganisation:void 0}),localFilters:null!==(r=e.localFilters)&&void 0!==r?r:[],colSpan:1,results:[],updatesFromParameters:null!==(n=e.updatesFromParameters)&&void 0!==n?n:{},reports:[]}})({attributes:this.editor.attributes})}},So.Header=vi,So.Library=class{constructor(e){this.library=void 0,this.library=[],(null==e?void 0:e.components)&&this.addComponents(null==e?void 0:e.components)}addComponent(e,t,r){var n,i;try{wi({component:e,uniqueViewId:t});const o=new yi({component:Si(e,t),colSpan:1,localFilters:null==r?void 0:r.localFilters});void 0===(null==r?void 0:r.position)?null===(n=this.library)||void 0===n||n.push(o):null===(i=this.library)||void 0===i||i.splice(r.position,0,o)}catch(e){throw new gi(e,"Library.addComponent")}}addComponents(e){try{if(void 0===e)throw new gi("Components are undefined","Library.addComponents");e.forEach((e=>{var t;wi(e);const r=new yi({component:Si(e.component,e.uniqueViewId),colSpan:1});null===(t=this.library)||void 0===t||t.push(r)}))}catch(e){throw new gi(e,"Library.addComponents")}}},So.AreaChart=class extends Ti{constructor(e){super(Object.assign(Object.assign({},e),{type:"areaChart"}))}static type(){return"areaChart"}},So.LineChart=class extends Ti{constructor(e){super(Object.assign(Object.assign({},e),{type:"lineChart"}))}static type(){return"lineChart"}},So.BarChart=class extends Ti{constructor(e){super(Object.assign(Object.assign({},e),{type:"barChart"}))}static type(){return"barChart"}},So.PieChart=class extends Ti{constructor(e){super(Object.assign(Object.assign({},e),{type:"pieChart"}))}static type(){return"pieChart"}},So.ScatterChart=class extends Ti{constructor(e){super(Object.assign(Object.assign({},e),{type:"scatterChart"}))}static type(){return"scatterChart"}},So.ComboChart=class extends Ti{constructor(e){super(Object.assign(Object.assign({},e),{type:"comboChart"}))}static type(){return"comboChart"}},So.PivotTable=class extends Ti{constructor(e){super(Object.assign(Object.assign({},e),{type:"dataTable"}))}static type(){return"dataTable"}},So.BasicTable=class extends Ti{constructor(e){super(Object.assign(Object.assign({},e),{type:"basicTable"}))}static type(){return"basicTable"}},So.HorizontalBarChart=class extends Ti{constructor(e){super(Object.assign(Object.assign({},e),{type:"horizontalBarChart"}))}static type(){return"horizontalBarChart"}},So.MercatorMap=class extends Ti{constructor(e){super(Object.assign(Object.assign({},e),{type:"mercatorMap"}))}static type(){return"mercatorMap"}},So.SingleStat=class extends Ti{constructor(e){super(Object.assign(Object.assign({},e),{type:"singleStat"}))}static type(){return"singleStat"}},So.Progress=class extends Ti{constructor(e){super(Object.assign(Object.assign({},e),{type:"progress"}))}static type(){return"progress"}},"undefined"==typeof window||window.Vizzly||(window.Vizzly=So);const To="undefined"!=typeof window&&window.Vizzly||So})();var i=n.B,o=n.Q;export{i as Vizzly,o as VizzlyInstanceNotLoaded};