@vizzly/services 0.12.12 → 0.12.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/shared-logic/src/AdditionalFilter/AdditionalFilter.d.ts +10 -1
- package/dist/shared-logic/src/AdditionalFilter/constants.d.ts +7 -0
- package/dist/shared-logic/src/AdditionalFilter/types.d.ts +10 -3
- package/dist/shared-logic/src/Component/types.d.ts +1 -0
- package/dist/shared-logic/src/ComponentInterface/types/namespaces.types.d.ts +1 -0
- package/dist/shared-logic/src/Field/types.d.ts +1 -1
- package/dist/shared-logic/src/FormatPanelConfig/types.d.ts +1 -1
- package/dist/shared-logic/src/Theme/types.d.ts +44 -20
- package/dist/shared-logic/src/utils/DateTime.d.ts +2 -1
- package/dist/shared-logic/src/utils/numberHelpers.d.ts +1 -0
- package/package.json +1 -1
- package/dist/shared-logic/src/ProtectedFields/upcastProtectedFields.d.ts +0 -2
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),a={annotations:Symbol("annotations")};t.error=function(e){if(!this._original||"object"!=typeof this._original)return this.details[0].message;const t=e?"":"[31m",r=e?"":"[41m",o=e?"":"[0m",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 o=s;for(let e=0;;++e){const s=n[e];if(i.isSchema(o)&&(o=o.clone()),!(e+1<n.length&&"string"!=typeof o[s])){const e=o[a.annotations]||{errors:{},missing:{}};o[a.annotations]=e;const n=s||r.context.key;void 0!==o[s]?(e.errors[n]=e.errors[n]||[],e.errors[n].push(t)):e.missing[n]=t;break}o=o[s]}}let l=a.safeStringify(s,2).replace(/_\$key\$_([, \d]+)_\$end\$_"/g,((e,r)=>`" ${t}[${r}]${o}`)).replace(/"_\$miss\$_([^|]+)\|(\d+)_\$end\$_": "__missing__"/g,((e,n,i)=>`${r}"${n}"${o}${t} [${i}]: -- missing --${o}`)).replace(/\s*"_\$idx\$_([, \d]+)_\$end\$_",?\n(.*)/g,((e,r,n)=>`\n${n} ${t}[${r}]${o}`)).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+=o,l},a.safeStringify=function(e,t){return JSON.stringify(e,a.serializer(),t)},a.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 a=t.indexOf(this);~a?(t.length=a+1,e.length=a+1,e[a]=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[a.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:a,merge:o}=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,o(t._flags,r)}else if(e._flags.empty){t._flags.empty=e._flags.empty;const r=Object.assign({},e._flags);delete r.empty,o(t._flags,r)}else o(t._flags,e._flags);for(const r in e.$_terms){const n=e.$_terms[r];n?t.$_terms[r]?t.$_terms[r]=t.$_terms[r].concat(n):t.$_terms[r]=n.slice():t.$_terms[r]||(t.$_terms[r]=n)}return this.$_root._tracer&&this.$_root._tracer._combine(t,[this,e]),t.$_mutateRebuild()}extend(e){return n(!e.base,"Cannot extend type with another base"),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 a=this.clone();for(let o=r;o<a._rules.length;++o){const r=a._rules[o],s=i(r);for(const i in e)t.modifiers[i](s,e[i]),n(s.name===r.name,"Cannot change rule name");a._rules[o]=s,a._singleRules.get(s.name)===r&&a._singleRules.set(s.name,s)}return a.$_temp.ruleset=!1,a.$_mutateRebuild()}get ruleset(){n(!this._inRuleset(),"Cannot start a new ruleset without closing the previous one");const e=this.clone();return e.$_temp.ruleset=e._rules.length,e}get $(){return this.ruleset}tailor(e){e=[].concat(e),n(!this._inRuleset(),"Cannot tailor inside a ruleset");let t=this;if(this.$_terms.alterations)for(const{target:r,adjuster: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 a=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 o=i[e];if(r.argsByName){const s=r.argsByName.get(e);if(s.ref&&l.isResolvable(o))t._resolve.push(e),a.$_mutateRegister(o);else if(s.normalize&&(o=s.normalize(o),i[e]=o),s.assert){const t=l.validateArg(o,e,s);n(!t,t,"or reference")}}void 0!==o?i[e]=o:delete i[e]}}return r.multi||(a._ruleRemove(t.name,{clone:!1}),a._singleRules.set(t.name,t)),!1===a.$_temp.ruleset&&(a.$_temp.ruleset=null),r.priority?a._rules.unshift(t):a._rules.push(t),a}$_compile(e,t){return u.schema(this.$_root,e,t)}$_createError(e,t,r,n,i,a={}){const o=!1!==a.flags?this._flags:{},s=a.messages?f.merge(this._definition.messages,a.messages):this._definition.messages;return new c.Report(e,t,r,o,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 a=this._definition[t][r]&&this._definition[t][r].register;!1!==a&&this.$_mutateRegister(e,{family:a,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(a(t,i.default)&&(t=void 0),a(t,this._flags[e]))return this;const o=!1!==r.clone?this.clone():this;return void 0!==t?(o._flags[e]=t,o.$_mutateRegister(t)):delete o._flags[e],"_"!==e[0]&&(o.$_temp.ruleset=!1),o}$_parent(e,...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 a=0;a<this.$_terms.whens.length;++a){const o=this.$_terms.whens[a];if(o.concat){n.push(o.concat),i.push(`${a}.concat`);continue}const s=o.ref?o.ref.resolve(e,t,r):e,l=o.is?[o]:o.switch,u=i.length;for(let u=0;u<l.length;++u){const{is:c,then:d,otherwise:p}=l[u],f=`${a}${o.switch?"."+u:""}`;if(c.$_match(s,t.nest(c,`${f}.is`),r)){if(d){const a=t.localize([...t.path,`${f}.then`],t.ancestors,t.schemas),{schema:o,id:s}=d._generate(e,a,r);n.push(o),i.push(`${f}.then${s?`(${s})`:""}`);break}}else if(p){const a=t.localize([...t.path,`${f}.otherwise`],t.ancestors,t.schemas),{schema:o,id:s}=p._generate(e,a,r);n.push(o),i.push(`${f}.otherwise${s?`(${s})`:""}`);break}}if(o.break&&i.length>u)break}const a=i.join(", ");if(t.mainstay.tracer.debug(t,"rule","when",a),!a)return{schema:this};if(!t.mainstay.tracer.active&&this.$_temp.whens[a])return{schema:this.$_temp.whens[a],id:a};let o=this;this._definition.generate&&(o=this._definition.generate(this,e,t,r));for(const e of n)o=o.concat(e);return this.$_root._tracer&&this.$_root._tracer._combine(o,[this,...n]),this.$_temp.whens[a]=o,{schema:o,id:a}}_inner(e,t,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),a=r(8160),o={max:1e3,supported:new Set(["undefined","boolean","number","string"])};t.provider={provision:e=>new o.Cache(e)},o.Cache=class{constructor(e={}){a.assertOptions(e,["max"]),n(void 0===e.max||e.max&&e.max>0&&isFinite(e.max),"Invalid max cache size"),this._max=e.max||o.max,this._map=new Map,this._list=new o.List}get length(){return this._map.size}set(e,t){if(null!==e&&!o.supported.has(typeof e))return;let r=this._map.get(e);if(r)return r.value=t,void this._list.first(r);r=this._list.unshift({key:e,value:t}),this._map.set(e,r),this._compact()}get(e){const t=this._map.get(e);if(t)return this._list.first(t),i(t.value)}_compact(){if(this._map.size>this._max){const e=this._list.pop();this._map.delete(e.key)}}},o.List=class{constructor(){this.tail=null,this.head=null}unshift(e){return e.next=null,e.prev=this.head,this.head&&(this.head.next=e),this.head=e,this.tail||(this.tail=e),e}first(e){e!==this.head&&(this._remove(e),this.unshift(e))}pop(){return this._remove(this.tail)}_remove(e){const{next:t,prev:r}=e;return t.prev=r,r&&(r.next=t),e===this.tail&&(this.tail=t),e.prev=null,e.next=null,e}}},8160:(e,t,r)=>{const{assert:n,AssertError:i}=r(8870),a=r(5934);let o,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=a.version,t.defaults={abortEarly:!0,allowUnknown:!1,artifacts:!1,cache:!0,context:null,convert:!0,dateFormat:"iso",errors:{escapeHtml:!1,label:"path",language:null,render:!0,stack:!1,wrap:{label:'"',array:"[]"}},externals:!0,messages:{},nonEnumerables:!1,noDefaults:!1,presence:"optional",skipFunctions:!1,stripUnknown:!1,warnings:!1},t.symbols={any:Symbol.for("@hapi/joi/schema"),arraySingle:Symbol("arraySingle"),deepDefault:Symbol("deepDefault"),errors:Symbol("errors"),literal:Symbol("literal"),override:Symbol("override"),parent:Symbol("parent"),prefs:Symbol("prefs"),ref:Symbol("ref"),template:Symbol("template"),values:Symbol("values")},t.assertOptions=function(e,t,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){o=o||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=o.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),a=r(6133),o={};t.schema=function(e,t,r={}){i.assertOptions(r,["appendPath","override"]);try{return o.schema(e,t,r)}catch(e){throw r.appendPath&&void 0!==e.path&&(e.message=`${e.message} (${e.path})`),e}},o.schema=function(e,t,r){n(void 0!==t,"Invalid undefined schema"),Array.isArray(t)&&(n(t.length,"Invalid empty array schema"),1===t.length&&(t=t[0]));const a=(t,...n)=>!1!==r.override?t.valid(e.override,...n):t.valid(...n);if(o.simple(t))return a(e,t);if("function"==typeof t)return e.custom(t);if(n("object"==typeof t,"Invalid schema content:",typeof t),i.isResolvable(t))return a(e,t);if(i.isSchema(t))return t;if(Array.isArray(t)){for(const r of t)if(!o.simple(r))return e.alternatives().try(...t);return a(e,...t)}return t instanceof RegExp?e.string().regex(t):t instanceof Date?a(e.date(),t):(n(Object.getPrototypeOf(t)===Object.getPrototypeOf({}),"Schema can only contain plain objects"),e.object().keys(t))},t.ref=function(e,t){return a.isRef(e)?e:a.create(e,t)},t.compile=function(e,r,a={}){i.assertOptions(a,["legacy"]);const s=r&&r[i.symbols.any];if(s)return n(a.legacy||s.version===i.version,"Cannot mix different versions of joi schemas:",s.version,i.version),r;if("object"!=typeof r||!a.legacy)return t.schema(e,r,{appendPath:!0});const l=o.walk(r);return l?l.compile(l.root,r):t.schema(e,r,{appendPath:!0})},o.walk=function(e){if("object"!=typeof e)return null;if(Array.isArray(e)){for(const t of e){const e=o.walk(t);if(e)return e}return null}const t=e[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=o.walk(e[t]);if(r)return r}return null},o.simple=function(e){return null===e||["boolean","string","number"].includes(typeof e)},t.when=function(e,r,s){if(void 0===s&&(n(r&&"object"==typeof r,"Missing options"),s=r,r=a.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'),o.condition(e,{is:r,then:s.then,otherwise:s.otherwise,break:s.break});if(n(a.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||a.isRef(s.is)||i.isSchema(s.is)||(u=u.required()),o.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],o=t===s.switch.length-1;i.assertOptions(r,o?["is","then","otherwise"]:["is","then"]),n(void 0!==r.is,'Switch statement missing "is"'),n(void 0!==r.then,'Switch statement missing "then"');const u={is:e.$_compile(r.is),then:e.$_compile(r.then)};if(a.isRef(r.is)||i.isSchema(r.is)||(u.is=u.is.required()),o){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},o.condition=function(e,t){for(const r of["then","otherwise"])void 0===t[r]?delete t[r]:t[r]=e.$_compile(t[r]);return t}},6354:(e,t,r)=>{const n=r(514),i=r(8160),a=r(3328);t.Report=class{constructor(e,r,n,i,a,o,s){if(this.code=e,this.flags=i,this.messages=a,this.path=o.path,this.prefs=s,this.state=o,this.value=r,this.message=null,this.template=null,this.local=n||{},this.local.label=t.label(this.flags,this.state,this.prefs,this.messages),void 0===this.value||this.local.hasOwnProperty("value")||(this.local.value=this.value),this.path.length){const e=this.path[this.path.length-1];"object"!=typeof e&&(this.local.key=e)}}_setTemplate(e){if(this.template=e,!this.flags.label&&0===this.path.length){const e=this._template(this.template,"root");e&&(this.local.label=e)}}toString(){if(this.message)return this.message;const e=this.code;if(!this.prefs.errors.render)return this.code;const t=this._template(this.template)||this._template(this.prefs.messages)||this._template(this.messages);return void 0===t?`Error code "${e}" is not defined, your custom type is missing the correct messages definition`:(this.message=t.render(this.value,this.state,this.prefs,this.local,{errors:this.prefs.errors,messages:[this.prefs.messages,this.messages]}),this.prefs.errors.label||(this.message=this.message.replace(/^"" /,"").trim()),this.message)}_template(e,r){return t.template(this.value,e,r||this.code,this.state,this.prefs)}},t.path=function(e){let t="";for(const r of e)"object"!=typeof r&&("string"==typeof r?(t&&(t+="."),t+=r):t+=`[${r}]`);return t},t.template=function(e,t,r,n,o){if(!t)return;if(a.isTemplate(t))return"root"!==r?t:null;let s=o.errors.language;if(i.isResolvable(s)&&(s=s.resolve(e,n,o)),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 a=r.path;return"key"===n.errors.label&&r.path.length>1&&(a=r.path.slice(-1)),t.path(a)||t.template(null,n.messages,"root",r,n)||i&&t.template(null,i,"root",r,n)||"value"},t.process=function(e,r,n){if(!e)return null;const{override:i,message:a,details:o}=t.details(e);if(i)return i;if(n.errors.stack)return new t.ValidationError(a,o,r);const s=Error.stackTraceLimit;Error.stackTraceLimit=0;const l=new t.ValidationError(a,o,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),a=r(8160),o=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=o.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),a.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][a.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),a=r(8652),o=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:o.version,cache:a.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){o.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(o.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){o.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:o.isSchema,in:(...e)=>d.in(...e),override:o.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 a=n[0]instanceof Error||"string"==typeof n[0]?n[0]:null,s=null!==a?n[1]:n[0],u=t.validate(e,o.preferences({errors:{stack:!0}},s||{}));let c=u.error;if(!c)return u.value;if(a instanceof Error)throw a;const d=r&&"function"==typeof c.annotate?c.annotate():c.message;throw c instanceof l.ValidationError==0&&(c=i(c)),c.message=a?`${a} ${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),a=r(8160),o=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[a.symbols.prefs],r.preferences.messages&&(r.preferences.messages=o.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 o=e.$_terms[i];if(!o)continue;if(o instanceof Map){o.size&&(r[i]=[...o.entries()]);continue}if(a.isValues(o)){r[i]=o.describe();continue}n(t.terms[i],"Term",i,"missing configuration");const s=t.terms[i].manifest,l="object"==typeof s;if(!o.length&&!l)continue;const u=[];for(const e of o)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===a.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[a.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 a=r.flags[i]&&r.flags[i].setter||i;n("function"==typeof t[a],"Invalid flag",i,"for type",e.type),t=t[a](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 a=[];if(i.args){const t={};for(const e in i.args)t[e]=this.build(i.args[e],{assign:e});const o=Object.keys(t),s=r.rules[i.name].args;if(s){n(o.length<=s.length,"Invalid number of arguments for",e.type,i.name,"(expected up to",s.length,", found",o.length,")");for(const{name:e}of s)a.push(t[e])}else n(1===o.length,"Invalid number of arguments for",e.type,i.name,"(expected up to 1, found",o.length,")"),a.push(t[o[0]])}t=t[i.name](...a);const o={};for(const e in r.modifiers)void 0!==i[e]&&(o[e]=this.build(i[e]));Object.keys(o).length&&(t=t.rule(o))}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 a=r.terms[t].manifest;if("schema"!==a)if("values"!==a)if("single"!==a)if("object"!=typeof a)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{[a.symbols.literal]:!0,literal:e.function};if(e.override)return a.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),a.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),a=r(3328);t.compile=function(e,t){if("string"==typeof e)return n(!t,"Cannot set single message string"),new a(e);if(a.isTemplate(e))return n(!t,"Cannot set single message template"),e;n("object"==typeof e&&!Array.isArray(e),"Invalid message options"),t=t?i(t):{};for(let r in e){const i=e[r];if("root"===r||a.isTemplate(i)){t[r]=i;continue}if("string"==typeof i){t[r]=new a(i);continue}n("object"==typeof i&&!Array.isArray(i),"Invalid message for",r);const o=r;for(r in t[o]=t[o]||{},i){const e=i[r];"root"===r||a.isTemplate(e)?t[o][r]=e:(n("string"==typeof e,"Invalid message for",r,"in",o),t[o][r]=new a(e))}}return t},t.decompile=function(e){const t={};for(let r in e){const n=e[r];if("root"===r){t.root=n;continue}if(a.isTemplate(n)){t[r]=n.describe({compact:!0});continue}const 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 a(r);if(a.isTemplate(r))return r;const o=i(e);for(let e in r){const t=r[e];if("root"===e||a.isTemplate(t)){o[e]=t;continue}if("string"==typeof t){o[e]=new a(t);continue}n("object"==typeof t&&!Array.isArray(t),"Invalid message for",e);const i=e;for(e in o[i]=o[i]||{},t){const r=t[e];"root"===e||a.isTemplate(r)?o[i][e]=r:(n("string"==typeof r,"Invalid message for",e,"in",i),o[i][e]=new a(r))}}return o}},2294:(e,t,r)=>{const{assert:n}=r(8870),i=r(8160),a=r(6133),o={};t.Ids=o.Ids=class{constructor(){this._byId=new Map,this._byKey=new Map,this._schemaChain=!1}clone(){const e=new o.Ids;return e._byId=new Map(this._byId),e._byKey=new Map(this._byKey),e._schemaChain=this._schemaChain,e}concat(e){e._schemaChain&&(this._schemaChain=!0);for(const[t,r]of e._byId.entries())n(!this._byKey.has(t),"Schema id conflicts with existing key:",t),this._byId.set(t,r);for(const[t,r]of e._byKey.entries())n(!this._byId.has(t),"Schema key conflicts with existing id:",t),this._byKey.set(t,r)}fork(e,t,r){const a=this._collect(e);a.push({schema:r});const s=a.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 a)l={id:e.id,schema:o.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 a=e.slice(1);return a.length?i.schema._ids.reach(a,[...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],a=this._get(i);n(a,"Schema does not contain path",[...t,...e].join(".")),r=[a,...r];const o=e.slice(1);return o.length?a.schema._ids._collect(o,[...t,i],r):r}_get(e){return this._byId.get(e)||this._byKey.get(e)}},o.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=o.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],a=o.scan(i.args,{source:"rules",name:i.name},t);if(void 0!==a){r=r||e.clone();const t=Object.assign({},i);t.args=a,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=o.scan(e.$_terms[n],{source:"terms",name:n},t);void 0!==i&&(r=r||e.clone(),r.$_terms[n]=i)}return r},o.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,a=o.scan(e[n],t,r,[n,...l],i);void 0!==a&&(u=u||e.slice(),u[n]=a)}return u}if(!1!==r.schema&&i.isSchema(e)||!1!==r.ref&&a.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=o.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:a}=r(8870),o=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),o.assertOptions(t,["adjust","ancestor","in","iterables","map","prefix","render","separator"]),n(!t.prefix||"object"==typeof t.prefix,"options.prefix must be of type object");const r=Object.assign({},l.defaults,t);delete r.prefix;const i=r.separator,a=l.context(e,i,t.prefix);if(r.type=a.type,e=a.key,"value"===r.type)if(a.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[o.symbols.ref]},l.Ref=class{constructor(e){n("object"==typeof e,"Invalid reference construction"),o.assertOptions(e,["adjust","ancestor","in","iterables","map","path","render","separator","type","depth","key","root","display"]),n([!1,void 0].includes(e.separator)||"string"==typeof e.separator&&1===e.separator.length,"Invalid separator"),n(!e.adjust||"function"==typeof e.adjust,"options.adjust must be a function"),n(!e.map||Array.isArray(e.map),"options.map must be an array"),n(!e.map||!e.adjust,"Cannot set both map and adjust options"),Object.assign(this,l.defaults,e),n("value"===this.type||void 0===this.ancestor,"Non-value references cannot reference ancestors"),Array.isArray(this.map)&&(this.map=new Map(this.map)),this.depth=this.path.length,this.key=this.path.length?this.path.join(this.separator):null,this.root=this.path[0],this.updateDisplay()}resolve(e,t,r,i,a={}){return n(!this.in||a.in,"Invalid in() reference usage"),"global"===this.type?this._resolve(r.context,t,a):"local"===this.type?this._resolve(i,t,a):this.ancestor?"root"===this.ancestor?this._resolve(t.ancestors[t.ancestors.length-1],t,a):(n(this.ancestor<=t.ancestors.length,"Invalid reference exceeds the schema root:",this.display),this._resolve(t.ancestors[this.ancestor-1],t,a)):this._resolve(e,t,a)}_resolve(e,t,r){let n;if("value"===this.type&&t.mainstay.shadow&&!1!==r.shadow&&(n=t.mainstay.shadow.get(this.absolute(t))),void 0===n&&(n=a(e,this.path,{iterables:this.iterables,functions:!0})),this.adjust&&(n=this.adjust(n)),this.map){const e=this.map.get(n);void 0!==e&&(n=e)}return t.mainstay&&t.mainstay.tracer.resolve(t,this,n),n}toString(){return this.display}absolute(e){return[...e.path.slice(0,-this.ancestor),...this.path]}clone(){return new l.Ref(this)}describe(){const e={path:this.path};"value"!==this.type&&(e.type=this.type),"."!==this.separator&&(e.separator=this.separator),"value"===this.type&&1!==this.ancestor&&(e.ancestor=this.ancestor),this.map&&(e.map=[...this.map]);for(const t of["adjust","iterables","render"])null!==this[t]&&void 0!==this[t]&&(e[t]=this[t]);return!1!==this.in&&(e.in=!0),{ref:e}}updateDisplay(){const e=null!==this.key?this.key:"";if("value"!==this.type)return void(this.display=`ref:${this.type}:${e}`);if(!this.separator)return void(this.display=`ref:${e}`);if(!this.ancestor)return void(this.display=`ref:${this.separator}${e}`);if("root"===this.ancestor)return void(this.display=`ref:root:${e}`);if(1===this.ancestor)return void(this.display=`ref:${e||".."}`);const t=new Array(this.ancestor+1).fill(this.separator).join("");this.display=`ref:${t}${e||""}`}},l.Ref.prototype[o.symbols.ref]=!0,t.build=function(e){return"value"===(e=Object.assign({},l.defaults,e)).type&&void 0===e.ancestor&&(e.ancestor=1),new l.Ref(e)},l.context=function(e,t,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 a=void 0===r.root?"/":r.root;if(a!==t&&e.startsWith(a))return{key:e.slice(a.length),type:"value",root:!0}}return{key:e,type:"value"}},l.ancestor=function(e,t){if(!t)return[1,0];if(e[0]!==t)return[1,0];if(e[1]!==t)return[0,1];let r=2;for(;e[r]===t;)++r;return[r-1,r]},t.toSibling=0,t.toParent=1,t.Manager=class{constructor(){this.refs=[]}register(e,n){if(e)if(n=void 0===n?t.toParent:n,Array.isArray(e))for(const t of e)this.register(t,n);else if(o.isSchema(e))for(const t of e._refs.refs)t.ancestor-n>=0&&this.refs.push({ancestor:t.ancestor-n,root:t.root});else t.isRef(e)&&"value"===e.type&&e.ancestor-n>=0&&this.refs.push({ancestor:e.ancestor-n,root:e.root}),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),a=r(8160),o={value:Symbol("value")};e.exports=o.State=class{constructor(e,t,r){this.path=e,this.ancestors=t,this.mainstay=r.mainstay,this.schemas=r.schemas,this.debug=null}localize(e,t=null,r=null){const n=new o.State(e,t,this);return r&&n.schemas&&(n.schemas=[o.schemas(r),...n.schemas]),n}nest(e,t){const r=new o.State(this.path,this.ancestors,this);return r.schemas=r.schemas&&[o.schemas(e),...r.schemas],r.debug=t,r}shadow(e,t){this.mainstay.shadow=this.mainstay.shadow||new o.Shadow,this.mainstay.shadow.set(this.path,e,t)}snapshot(){this.mainstay.shadow&&(this._snapshot=n(this.mainstay.shadow.node(this.path))),this.mainstay.snapshot()}restore(){this.mainstay.shadow&&(this.mainstay.shadow.override(this.path,this._snapshot),this._snapshot=void 0),this.mainstay.restore()}commit(){this.mainstay.shadow&&(this.mainstay.shadow.override(this.path,this._snapshot),this._snapshot=void 0),this.mainstay.commit()}},o.schemas=function(e){return a.isSchema(e)?{schema:e}:e},o.Shadow=class{constructor(){this._values=null}set(e,t,r){if(!e.length)return;if("strip"===r&&"number"==typeof e[e.length-1])return;this._values=this._values||new Map;let n=this._values;for(let t=0;t<e.length;++t){const r=e[t];let i=n.get(r);i||(i=new Map,n.set(r,i)),n=i}n[o.value]=t}get(e){const t=this.node(e);if(t)return t[o.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],a=i(this._values,r,{iterables:!0});t?a.set(n,t):a&&a.delete(n)}}},3328:(e,t,r)=>{const{assert:n,clone:i,escapeHtml:a}=r(8870),o=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?"}":"}}",a=e.indexOf(i);if(-1===a||"{"===e[1]){n.push(`{${c.decode(e)}`);continue}let o=e.slice(t?0:1,a);const s=":"===o[0];s&&(o=o.slice(1));const l=this._ref(c.decode(o),{raw:t,wrapped:s});n.push(l),"string"!=typeof l&&(r=!0);const u=e.slice(a+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 o=[];for(const s of this._template)if("string"==typeof s)o.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:a(u);o.push(c.wrap(e,s.wrapped&&r.errors.wrap.label))}}return o.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 a=new o.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(a.single){if("reference"===a.single.type){const e=n[0];return{ref:e,raw:t,refs:n,wrapped:r||"local"===e.type&&"label"===e.key}}return c.stringify(a.single.value)}return{formula:a,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,a={}){const o=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,...a})),null===e)return"null";if("string"===o)return c.wrap(e,a.arrayItems&&s.string);if("number"===o||"function"===o||"symbol"===o)return e.toString();if("object"!==o)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 o of e)d.push(c.stringify(o,t,r,n,i,{arrayItems:!0,...a}));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,a]=this,o=a.messages;if(!o)return"";const s=l.template(t,o[0],e,r,n)||l.template(t,o[1],e,r,n);return s?s.render(t,r,n,i,a):""},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),a=r(6354),o={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 o.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))},o.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 o.Store(e),{filename:n,line:a}=e._flags._tracerLocation||i.location(5);return this._schemas.set(e,{filename:n,line:a,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 a=[],s=[];for(const[e,t]of i._sources.entries()){if(o.sub(t.paths,s))continue;if(!t.entry){a.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),o=new Set(n._refs);for(const{value:e,ref:n}of t[r])i.delete(e),o.delete(n);(i.size||o.size)&&a.push({status:[...i,...[...o].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=o.labels[t.rule[e]||0];if(r){const n={rule:e,status:r};t.paths.size&&(n.paths=[...t.paths]),a.push(n)}}}a.length&&t.push({filename:r,line:n,missing:a,severity:"error",message:`Schema missing tests for ${a.map(o.message).join(", ")}`})}return t.length?t:null}},o.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){o.debug(t,{type:"entry"}),this._record(e,(e=>{e.entry=!0}))}filter(e,t,r,n){o.debug(t,{type:r,...n}),this._record(e,(e=>{e[r].add(n)}))}log(e,t,r,n,i){o.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]|=o.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,a){if(!e.mainstay.debug||n(r,i))return;const o={type:"value",by:t,from:r,to:i,path:e.path};a&&(o.name=a),e.mainstay.debug.push(o)}_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=o.id(e,t);this._scan(e,r.concat(n))},ref:!1})}_combine(e,t){this._combos.set(e,t)}},o.message=function(e){return`${e.paths?a.path(e.paths[0])+(e.rule?":":""):""}${e.rule||""} (${e.status})`},o.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)},o.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},o.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),a=r(8068),o=r(8160),s=r(3292),l=r(6354),u=r(6133),c={};e.exports=a.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:a,prefs:o}=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=a.nest(i.schema,`match.${n}`);l.snapshot();const u=i.schema.$_validate(e,l,o);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=a.nest(n.schema,`match.${t}`);r.snapshot();const i=n.schema.$_validate(e,r,o);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,a,o):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,a.nest(u,`${p}.is`),o)){if(c)return c.$_validate(e,a.nest(c,`${p}.then`),o)}else if(d)return d.$_validate(e,a.nest(d,`${p}.otherwise`),o)}}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),a=i.is?[i]:i.switch;for(const e of a)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"),o.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=>{o.isSchema(t)&&"array"===t.type&&e.$_setFlag("_arrayItems",!0,{clone:!1})}})},manifest:{build(e,t){if(t.matches)for(const r of t.matches){const{schema:t,ref:n,is:i,not:a,then:o,otherwise:s}=r;e=t?e.try(t):n?e.conditional(n,{is:i,then:o,not:a,otherwise:s,switch:r.switch}):e.conditional(i,{then:o,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:a,schema:o}of e){if(a.length>1)return c.unmatched(e,t);const s=a[0];if(s instanceof l.Report==0)return c.unmatched(e,t);if(s.state.path.length!==r.path.length){i.push({type:o.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:o.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),a=r(8160),o=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(a.isSchema(e)&&e._flags.id,"Schema must be a schema with an id");const t=this.clone();return t.$_terms.shared=t.$_terms.shared||[],t.$_terms.shared.push(e),t.$_mutateRegister(e),t}},warning:{method(e,t){return n(e&&"string"==typeof e,"Invalid warning code"),this.$_addRule({name:"warning",args:{code:e,local:t},warn:!0})},validate:(e,t,{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=o.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:a,otherwise:o,concat:s}=t;e=s?e.concat(s):r?e.when(r,{is:n,not:i,then:a,otherwise:o,switch:t.switch,break:t.break}):e.when(n,{then:a,otherwise:o,break:t.break})}else{const t={};for(const{target:e,adjuster:r}of n)t[e]=r;e=e.alter(t)}}return e}},messages:{"any.custom":"{{#label}} failed custom validation because {{#error.message}}","any.default":"{{#label}} threw an error when running default method","any.failover":"{{#label}} threw an error when running failover method","any.invalid":"{{#label}} contains an invalid value","any.only":'{{#label}} must be {if(#valids.length == 1, "", "one of ")}{{#valids}}',"any.ref":"{{#label}} {{#arg}} references {{:#ref}} which {{#reason}}","any.required":"{{#label}} is required","any.unknown":"{{#label}} is not allowed"}})},546:(e,t,r)=>{const{assert:n,deepEqual:i,reach:a}=r(8870),o=r(8068),s=r(8160),l=r(3292),u={};e.exports=o.extend({type:"array",flags:{single:{default:!1},sparse:{default:!1}},terms:{items:{init:[],manifest:"schema"},ordered:{init:[],manifest:"schema"},_exclusions:{init:[]},_inclusions:{init:[]},_requireds:{init:[]}},coerce:{from:"object",method(e,{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 a=[e,...t.ancestors];for(let n=0;n<e.length;++n){const o=t.localize([...t.path,n],a,i);if(i.$_match(e[n],o,r))return e}const o=i._flags.label;return o?n("array.hasKnown",{patternLabel:o}):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:a}){const o=t.$_terms._requireds.slice(),l=t.$_terms.ordered.slice(),c=[...t.$_terms._inclusions,...o],d=!e[s.symbols.arraySingle];delete e[s.symbols.arraySingle];const p=a();let f=e.length;for(let a=0;a<f;++a){const s=e[a];let h=!1,m=!1;const g=d?a:new Number(a),y=[...n.path,g];if(!t._flags.sparse&&void 0===s){if(p.push(r("array.sparse",{key:g,path:y,pos:a,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:a,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 o=l.shift(),c=o.$_validate(s,n.localize(y,b,o),i);if(c.errors){if(p.push(...c.errors),i.abortEarly)return p}else if("strip"===o._flags.result)u.fastSplice(e,a),--a,--f;else{if(!t._flags.sparse&&void 0===c.value){if(p.push(r("array.sparse",{key:g,path:y,pos:a,value:void 0},n.localize(y))),i.abortEarly)return p;continue}e[a]=c.value}continue}if(!t.$_terms.items.length){if(p.push(r("array.orderedLength",{pos:a,limit:t.$_terms.ordered.length})),i.abortEarly)return p;break}}const v=[];let _=o.length;for(let l=0;l<_;++l){const c=n.localize(y,b,o[l]);c.snapshot();const d=o[l].$_validate(s,c,i);if(v[l]=d,!d.errors){if(c.commit(),e[a]=d.value,m=!0,u.fastSplice(o,l),--l,--_,!t._flags.sparse&&void 0===d.value&&(p.push(r("array.sparse",{key:g,path:y,pos:a,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=o.indexOf(l);if(-1!==d)c=v[d];else{const o=n.localize(y,b,l);if(o.snapshot(),c=l.$_validate(s,o,i),!c.errors){o.commit(),"strip"===l._flags.result?(u.fastSplice(e,a),--a,--f):t._flags.sparse||void 0!==c.value?e[a]=c.value:(p.push(r("array.sparse",{key:g,path:y,pos:a,value:void 0},n.localize(y))),h=!0),m=!0;break}o.restore()}if(1===_){if(A){u.fastSplice(e,a),--a,--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,a),--a,--f;continue}if(p.push(r("array.includes",{pos:a,value:s},n.localize(y))),i.abortEarly)return p}}return o.length&&u.fillMissedErrors(t,p,o,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:a})=>s.compare(e.length,r,i)?e:t.error("array."+n,{limit:a.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:a}){const{value:o,errors:s}=u.sort(i,e,a,r,n);if(s)return s;for(let r=0;r<e.length;++r)if(e[r]!==o[r])return t("array.sort",{order:a.order,by:a.by?a.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:o},{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 o=c?a(e[i],c):e[i],l=u?d.custom:d[typeof o];if(n(l,"Failed to find unique map container for type",typeof o),l instanceof Map){const n=l.entries();let a;for(;!(a=n.next()).done;)if(p(a.value[0],o)){const n=t.localize([...t.path,i],[e,...t.ancestors]),o={pos:i,value:e[i],dupePos:a.value[1],dupeValue:e[a.value[1]]};return c&&(o.path=s),r("array.unique",o,n)}l.set(o,i)}else{if((!f||void 0!==o)&&void 0!==l[o]){const n={pos:i,value:e[i],dupePos:l[o],dupeValue:e[l[o]]};return c&&(n.path=s),r("array.unique",n,t.localize([...t.path,i],[e,...t.ancestors]))}l[o]=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,a){const o=[];let s=0;for(const e of r){const t=e._flags.label;t?o.push(t):++s}o.length?s?t.push(e.$_createError("array.includesRequiredBoth",n,{knownMisses:o,unknownMisses:s},i,a)):t.push(e.$_createError("array.includesRequiredKnowns",n,{knownMisses:o},i,a)):t.push(e.$_createError("array.includesRequiredUnknowns",n,{unknownMisses:s},i,a))},u.fillOrderedErrors=function(e,t,r,n,i,a){const o=[];for(const e of r)"required"===e._flags.presence&&o.push(e);o.length&&u.fillMissedErrors(e,t,o,n,i,a)},u.fillDefault=function(e,t,r,n){const i=[];let a=!0;for(let o=e.length-1;o>=0;--o){const s=e[o],l=[t,...r.ancestors],u=s.$_validate(void 0,r.localize(r.path,l,s),n).value;if(a){if(void 0===u)continue;a=!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 a="ascending"===r.order?1:-1,o=-1*a,s=a,l=(l,c)=>{let d=u.compare(l,c,o,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,o,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)*a:l<c?o: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),a=r(8160),o=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){a.verifyFlat(e,"truthy");const t=this.clone();t.$_terms.truthy=t.$_terms.truthy||new o;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){a.verifyFlat(e,"falsy");const t=this.clone();t.$_terms.falsy=t.$_terms.falsy||new o;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),a=r(8160),o=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:o}){const s="now"===r?Date.now():r.getTime();return a.compare(e.getTime(),s,i)?e:t.error("date."+n,{limit:o.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})=>o.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 a.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:a}=r(8870),o=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 a=[];if(t.$_terms.renames&&!f.rename(t,e,n,i,a))return{value:e,errors:a};if(!t.$_terms.keys&&!t.$_terms.patterns&&!t.$_terms.dependencies)return{value:e,errors:a};const o=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];o.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),a.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(o.size||t._flags._hasPatternMatch){const r=f.unknown(t,e,o,a,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 o=f.dependencies[r.rel](t,r,e,n,i);if(o){const r=t.$_createError(o.code,e,o.context,n,i);if(i.abortEarly)return{value:e,errors:r};a.push(r)}}return{value:e,errors:a}},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:a,message:o}){const s=i.resolve(e,n,r),l=d.isRef(i)?i.absolute(n):[];return a.$_match(s,n.localize(l,[e,...n.ancestors],a),r)?e:t("object.assert",{subject:i,message:o})},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:a})=>l.compare(Object.keys(e).length,r,i)?e:t.error("object."+n,{limit:a.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 a=this.clone();a.$_terms.patterns=a.$_terms.patterns||[];const o={[n?"regex":"schema"]:e,rule:t};return r.matches&&(o.matches=this.$_compile(r.matches),"array"!==o.matches.type&&(o.matches=o.matches.$_root.array().items(o.matches)),a.$_mutateRegister(o.matches),a.$_setFlag("_hasPatternMatch",!0,{clone:!1})),r.fallthrough&&(o.fallthrough=!0),a.$_terms.patterns.push(o),a.$_mutateRegister(t),a}},ref:{method(){return this.$_addRule("ref")},validate:(e,t)=>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 a=this.clone();a.$_terms.renames=a.$_terms.renames||[];for(const t of a.$_terms.renames)i(t.from!==e,"Cannot rename the same key multiple times");return t instanceof p&&a.$_mutateRegister(t),a.$_terms.renames.push({from:e,to:t,options:n(f.renameDefaults,r)}),a}},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 o.Sorter;for(const r of e.$_terms.keys)l.tryWithPath((()=>t.add(r,{after:r.schema.$_rootReferences(),group:r.key})),r.key);e.$_terms.keys=new 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:a}of t.dependencies)e=f.dependency(e,r,n,i,a);if(t.patterns)for(const{regex:r,schema:n,rule:i,fallthrough:a,matches:o}of t.patterns)e=e.pattern(r||n,i,{fallthrough:a,matches:o});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 a(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=a(e.prototype),Object.defineProperty(r,"name",{value:e.name,writable:!1}),Object.defineProperty(r,"length",{value:e.length,writable:!1}),Object.assign(r,e),r},f.dependency=function(e,t,r,n,a){i(null===r||"string"==typeof r,t,"key must be a strings"),a||(a=n.length>1&&"object"==typeof n[n.length-1]?n.pop():{}),l.assertOptions(a,["separator","isPresent"]),n=[].concat(n);const o=l.default(a.separator,"."),s=[];for(const e of n)i("string"==typeof e,t,"peers must be strings"),s.push(u.ref(e,{separator:o,ancestor:0,prefix:!1}));null!==r&&(r=u.ref(r,{separator:o,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,a)),c},f.dependencies={and(e,t,r,n,i){const a=[],o=[],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}))?a.push(e.key):o.push(e.key);if(a.length!==s&&o.length!==s)return{code:"object.and",context:{present:o,presentWithLabels:f.keysToLabels(e,o),missing:a,missingWithLabels:f.keysToLabels(e,a)}}},nand(e,t,r,n,i){const a=[],o=f.isPresent(t.options);for(const e of t.peers)o(e.resolve(r,n,i,null,{shadow:!1}))&&a.push(e.key);if(a.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 a=f.isPresent(t.options);for(const e of t.peers)if(a(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 a=[],o=f.isPresent(t.options);for(const e of t.peers)o(e.resolve(r,n,i,null,{shadow:!1}))&&a.push(e.key);if(!a.length||1===a.length)return;const s={peers:t.paths,peersWithLabels:f.keysToLabels(e,t.paths)};return s.present=a,s.presentWithLabels=f.keysToLabels(e,a),{code:"object.oxor",context:s}},with(e,t,r,n,i){const a=f.isPresent(t.options);for(const o of t.peers)if(!1===a(o.resolve(r,n,i,null,{shadow:!1})))return{code:"object.with",context:{main:t.key.key,mainWithLabel:f.keysToLabels(e,t.key.key),peer:o.key,peerWithLabel:f.keysToLabels(e,o.key)}}},without(e,t,r,n,i){const a=f.isPresent(t.options);for(const o of t.peers)if(a(o.resolve(r,n,i,null,{shadow:!1})))return{code:"object.without",context:{main:t.key.key,mainWithLabel:f.keysToLabels(e,t.key.key),peer:o.key,peerWithLabel:f.keysToLabels(e,o.key)}}},xor(e,t,r,n,i){const a=[],o=f.isPresent(t.options);for(const e of t.peers)o(e.resolve(r,n,i,null,{shadow:!1}))&&a.push(e.key);if(1===a.length)return;const s={peers:t.paths,peersWithLabels:f.keysToLabels(e,t.paths)};return 0===a.length?{code:"object.missing",context:s}:(s.present=a,s.presentWithLabels=f.keysToLabels(e,a),{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 a={};for(const o of e.$_terms.renames){const s=[],l="string"!=typeof o.from;if(l)for(const e in t){if(void 0===t[e]&&o.options.ignoreUndefined)continue;if(e===o.to)continue;const r=o.from.exec(e);r&&s.push({from:e,to:o.to,match:r})}else!Object.prototype.hasOwnProperty.call(t,o.from)||void 0===t[o.from]&&o.options.ignoreUndefined||s.push(o);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(!o.options.multiple&&a[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)&&!o.options.override&&!a[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],a[c]=!0,o.options.alias||delete t[s]}}}return!0},f.unknown=function(e,t,r,n,i,a){if(e.$_terms.patterns){let o=!1;const s=e.$_terms.patterns.map((e=>{if(e.matches)return o=!0,[]})),l=[t,...i.ancestors];for(const o of r){const u=t[o],c=[...i.path,o];for(let d=0;d<e.$_terms.patterns.length;++d){const p=e.$_terms.patterns[d];if(p.regex){const e=p.regex.test(o);if(i.mainstay.tracer.debug(i,"rule",`pattern.${d}`,e?"pass":"error"),!e)continue}else if(!p.schema.$_match(o,i.nest(p.schema,`pattern.${d}`),a))continue;r.delete(o);const f=i.localize(c,l,{schema:p.rule,key:o}),h=p.rule.$_validate(u,f,a);if(h.errors){if(a.abortEarly)return{value:t,errors:h.errors};n.push(...h.errors)}if(p.matches&&s[d].push(o),t[o]=h.value,!p.fallthrough)break}}if(o)for(let r=0;r<s.length;++r){const o=s[r];if(!o)continue;const u=e.$_terms.patterns[r].matches,d=i.localize(i.path,l,u),p=u.$_validate(o,d,a);if(p.errors){const r=c.details(p.errors,{override:!1});r.matches=o;const s=e.$_createError("object.pattern.match",t,r,i,a);if(a.abortEarly)return{value:t,errors:s};n.push(s)}}}if(r.size&&(e.$_terms.keys||e.$_terms.patterns)){if(a.stripUnknown&&!e._flags.unknown||a.skipFunctions){const e=!(!a.stripUnknown||!0!==a.stripUnknown&&!a.stripUnknown.objects);for(const n of r)e?(delete t[n],r.delete(n)):"function"==typeof t[n]&&r.delete(n)}if(!l.default(e._flags.unknown,a.allowUnknown))for(const o of r){const r=i.localize([...i.path,o],[]),s=e.$_createError("object.unknown",t[o],{child:o},r,a,{flags:!1});if(a.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),a=r(8160),o=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 a=l.generate(t,e,r,i),o=t.$_terms.link[0].ref;return a.$_validate(e,r.nest(a,`link:${o.display}:${a.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=o.ref(e),n("value"===e.type||"local"===e.type,"Invalid reference type:",e.type),n("local"===e.type||"root"===e.ancestor||e.ancestor>0,"Link cannot reference itself");const t=this.clone();return t.$_terms.link=[{ref:e}],t}},relative:{method(e=!0){return this.$_setFlag("relative",e)}}},overrides:{concat(e){n(this.$_terms.link,"Uninitialized link schema"),n(a.isSchema(e),"Invalid schema object"),n("link"!==e.type,"Cannot merge type link with another link");const t=this.clone();return t.$_terms.whens||(t.$_terms.whens=[]),t.$_terms.whens.push({concat:e}),t.$_mutateRebuild()}},manifest:{build:(e,t)=>(n(t.link,"Invalid link description missing link"),e.ref(t.link))}}),l.generate=function(e,t,r,n){let i=r.mainstay.links.get(e);if(i)return i._generate(t,r,n).schema;const a=e.$_terms.link[0].ref,{perspective:o,path:s}=l.perspective(a,r);l.assert(o,"which is outside of schema boundaries",a,e,r,n);try{i=s.length?o.$_reach(s):o}catch(t){l.assert(!1,"to non-existing schema",a,e,r,n)}return l.assert("link"!==i.type,"which is another link",a,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,a,o){e||n(!1,`"${s.label(i._flags,a,o)}" contains link reference "${r.display}" ${t}`)}},3832:(e,t,r)=>{const{assert:n}=r(8870),i=r(8068),a=r(8160),o={numberRx:/^\s*[+-]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:e([+-]?\d+))?\s*$/i,precisionRx:/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/,exponentialPartRegex:/[eE][+-]?\d+$/,leadingSignAndZerosRegex:/^[+-]?(0*)?/,dotRegex:/\./,trailingZerosRegex:/0+$/};e.exports=i.extend({type:"number",flags:{unsafe:{default:!1}},coerce:{from:"string",method(e,{schema:t,error:r}){if(!e.match(o.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(o.extractSignificantDigits(e)!==o.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!==o.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(!a.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:o})=>a.compare(e,r,i)?e:t.error("number."+n,{limit:o.limit,value:e}),args:[{name:"limit",ref:!0,assert:a.isNumber,message:"must be a number"}]},greater:{method(e){return this.$_addRule({name:"greater",method:"compare",args:{limit:e},operator:">"})}},integer:{method(){return this.$_addRule("integer")},validate:(e,t)=>Math.trunc(e)-e==0?e:t.error("number.integer")},less:{method(e){return this.$_addRule({name:"less",method:"compare",args:{limit:e},operator:"<"})}},max:{method(e){return this.$_addRule({name:"max",method:"compare",args:{limit:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"compare",args:{limit:e},operator:">="})}},multiple:{method(e){return this.$_addRule({name:"multiple",args:{base:e}})},validate:(e,t,{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(o.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"}}),o.extractSignificantDigits=function(e){return e.replace(o.exponentialPartRegex,"").replace(o.dotRegex,"").replace(o.trailingZerosRegex,"").replace(o.leadingSignAndZerosRegex,"")},o.normalizeDecimal=function(e){return(e=e.replace(/^\+/,"").replace(/\.0*$/,"").replace(/^(-?)\.([^\.]*)$/,"$10.$2").replace(/^(-?)0+([0-9])/,"$1$2")).includes(".")&&e.endsWith("0")&&(e=e.replace(/0+$/,"")),"-0"===e?"0":e}},8966:(e,t,r)=>{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:a,isEmailValid:o,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 a=t.$_getRule("case");a&&(e="upper"===a.args.direction?e.toLocaleUpperCase():e.toLocaleLowerCase());const o=t.$_getRule("trim");if(o&&o.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 a=i.args.limit;if(d.isResolvable(a)&&(a=a.resolve(e,r,n),!d.limit(a)))return{value:e,errors:t.$_createError("any.ref",a,{ref:i.args.limit,arg:"limit",reason:"must be a positive integer"},r,n)};e=e.slice(0,a)}}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})=>a(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 a=r.multiple?e.split(n):[e],s=[];for(const e of a)o(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 a=r[e];n("string"==typeof a,"version at position "+e+" must be a string");const o=p.guidVersions[a.toLowerCase()];n(o,"version at position "+e+" must be one of "+Object.keys(p.guidVersions).join(", ")),n(!i.has(o),"version at position "+e+" must not be a duplicate"),t+=o,i.add(o)}}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)=>a(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:a,args:o}){const s=!n&&e.length;return d.compare(s,r,a)?e:t.error("string."+i,{limit:o.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:o}){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||a(n,i)?e:t.error("string.domain",{value:n})}return r.relativeOnly?t.error("string.uriRelativeOnly"):r.scheme?t.error("string.uriCustomScheme",{scheme:o,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(a(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,a){return n(!a||!1,"Invalid encoding:",a),e.$_addRule({name:t,method:"length",args:{limit:r,encoding:a},operator:i})}},8826:(e,t,r)=>{const{assert:n}=r(8870),i=r(8068),a={};a.Map=class extends Map{slice(){return new a.Map(this)}},e.exports=i.extend({type:"symbol",terms:{map:{init:new a.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,a]=i;n("object"!=typeof e&&"function"!=typeof e&&"symbol"!=typeof e,"Key must not be of type object, function, or Symbol"),n("symbol"==typeof a,"Value must be a Symbol"),t.$_terms.map.set(e,a),r.push(a)}return t.valid(...r)}}},manifest:{build:(e,t)=>(t.map&&(e=e.map(t.map)),e)},messages:{"symbol.base":"{{#label}} must be a symbol","symbol.map":"{{#label}} must be one of {{#map}}"}})},8863:(e,t,r)=>{const{assert:n,clone:i,ignore:a,reach:o}=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 a=c.entry(e,t,i);n(!a.mainstay.externals.length,"Schema with external rules must use validateAsync()");const o={value:a.value};return a.error&&(o.error=a.error),a.mainstay.warnings.length&&(o.warning=l.details(a.mainstay.warnings)),a.mainstay.debug&&(o.debug=a.mainstay.debug),a.mainstay.artifacts&&(o.artifacts=a.mainstay.artifacts),o},t.entryAsync=async function(e,t,r){let n=s.defaults;r&&(n=s.preferences(s.defaults,r));const i=c.entry(e,t,n),a=i.mainstay;if(i.error)throw a.debug&&(i.error.debug=a.debug),i.error;if(a.externals.length){let t=i.value;const u=[];for(const i of a.externals){const d=i.state.path,p="link"===i.schema.type?a.links.get(i.schema):null;let f,h,m=t;const g=d.length?[t]:[],y=d.length?o(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),o=await i.method(m,{schema:i.schema,linked:p,state:i.state,prefs:r,original:y,error:e,errorsArray:c.errorsArray,warn:(e,t)=>a.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===o||o===m)continue;if(o instanceof l.Report){if(a.tracer.log(i.schema,i.state,"rule","external","error"),u.push(o),n.abortEarly)break;continue}if(Array.isArray(o)&&o[s.symbols.errors]){if(a.tracer.log(i.schema,i.state,"rule","external","error"),u.push(...o),n.abortEarly)break;continue}h?(a.tracer.value(i.state,"rule",m,o,"external"),h[f]=o):(a.tracer.value(i.state,"rule",t,o,"external"),t=o)}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),a.debug&&(i.error.debug=a.debug),i.error}if(!n.warnings&&!n.debug&&!n.artifacts)return i.value;const u={value:i.value};return a.warnings.length&&(u.warning=l.details(a.warnings)),a.debug&&(u.debug=a.debug),a.artifacts&&(u.artifacts=a.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:a}=c.tracer(r,n),o=n.debug?[]:null,s=r._ids._schemaChain?new Map:null,d=new c.Mainstay(i,o,s),p=r._ids._schemaChain?[{schema:r}]:null,f=new u([],[],{mainstay:d,schemas:p}),h=t.validate(e,r,f,n);a&&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 a=(i,a,o)=>t.$_createError(i,e,a,o||r,n),o={original:e,prefs:n,schema:t,state:r,error:a,errorsArray:c.errorsArray,warn:(e,t,n)=>r.mainstay.warnings.push(a(e,t,n)),message:(i,a)=>t.$_createError("custom",e,a,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,o);if(t){if(r.mainstay.tracer.value(r,"prepare",e,t.value),t.errors)return c.finalize(t.value,[].concat(t.errors),o);e=t.value}}if(l.coerce&&void 0!==e&&n.convert&&(!l.coerce.from||l.coerce.from.includes(typeof e))){const t=l.coerce.method(e,o);if(t){if(r.mainstay.tracer.value(r,"coerced",e,t.value),t.errors)return c.finalize(t.value,[].concat(t.errors),o);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,o);if("required"===d)return c.finalize(e,[t.$_createError("any.required",e,null,r,n)],o);if("optional"===d){if(t._flags.default!==s.symbols.deepDefault)return c.finalize(e,null,o);r.mainstay.tracer.value(r,"default",e,{}),e={}}}else if("forbidden"===d)return c.finalize(e,[t.$_createError("any.unknown",e,null,r,n)],o);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,o);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],o);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 a=t.$_createError("any.invalid",e,{invalids:t._invalids.values({display:!0})},r,n);if(n.abortEarly)return c.finalize(e,[a],o);p.push(a)}}if(l.validate){const t=l.validate(e,o);if(t&&(r.mainstay.tracer.value(r,"base",e,t.value),e=t.value,t.errors)){if(!Array.isArray(t.errors))return p.push(t.errors),c.finalize(e,p,o);if(t.errors.length)return p.push(...t.errors),c.finalize(e,p,o)}}return t._rules.length?c.rules(e,p,o):c.finalize(e,p,o)},c.rules=function(e,t,r){const{schema:n,state:i,prefs:a}=r;for(const o of n._rules){const l=n._definition.rules[o.method];if(l.convert&&a.convert){i.mainstay.tracer.log(n,i,"rule",o.name,"full");continue}let u,d=o.args;if(o._resolve.length){d=Object.assign({},d);for(const t of o._resolve){const r=l.argsByName.get(t),o=d[t].resolve(e,i,a),c=r.normalize?r.normalize(o):o,p=s.validateArg(c,null,r);if(p){u=n.$_createError("any.ref",o,{arg:t,ref:d[t],reason:p},i,a);break}d[t]=c}}u=u||l.validate(e,r,d,o);const p=c.rule(u,o);if(p.errors){if(i.mainstay.tracer.log(n,i,"rule",o.name,"error"),o.warn){i.mainstay.warnings.push(...p.errors);continue}if(a.abortEarly)return c.finalize(e,p.errors,r);t.push(...p.errors)}else i.mainstay.tracer.log(n,i,"rule",o.name,"pass"),i.mainstay.tracer.value(i,"rule",e,p.value,o.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:a,prefs:o}=r;if(t.length){const n=c.default("failover",void 0,t,r);void 0!==n&&(a.mainstay.tracer.value(a,"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);a.mainstay.tracer.value(a,"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);a.mainstay.tracer.value(a,"cast",e,n,i._flags.cast),e=n}}if(i.$_terms.externals&&o.externals&&!1!==o._externals)for(const{method:e}of i.$_terms.externals)a.mainstay.externals.push({method:e,schema:i,state:a,label:l.label(i._flags,a,o)});const s={value:e,errors:t.length?t:null};return i._flags.result&&(s.value="strip"===i._flags.result?void 0:r.original,a.mainstay.tracer.value(a,i._flags.result,e,s.value),a.shadow(e,i._flags.result)),i._cache&&!1!==o.cache&&!i._refs.length&&i._cache.set(r.original,s),void 0===e||s.errors||void 0===i._flags.artifact||(a.mainstay.artifacts=a.mainstay.artifacts||new Map,a.mainstay.artifacts.has(i._flags.artifact)||a.mainstay.artifacts.set(i._flags.artifact,[]),a.mainstay.artifacts.get(i._flags.artifact).push(a.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:a,state:o,prefs:l}=n,u=a._flags[e];if(l.noDefaults||void 0===u)return t;if(o.mainstay.tracer.log(a,o,"rule",e,"full"),!u)return u;if("function"==typeof u){const s=u.length?[i(o.ancestors[0]),n]:[];try{return u(...s)}catch(t){return void r.push(a.$_createError(`any.${e}`,null,{error:t},o,l))}}return"object"!=typeof u?u:u[s.symbols.literal]?u.literal:s.isResolvable(u)?u.resolve(t,o,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:a,entry:a,filter:a,log:a,resolve:a,value:a},c.errorsArray=function(){const e=[];return e[s.symbols.errors]=!0,e}},2036:(e,t,r)=>{const{assert:n,deepEqual:i}=r(8870),a=r(8160),o={};e.exports=o.Values=class{constructor(e,t){this._values=new Set(e),this._refs=new Set(t),this._lowercase=o.lowercases(e),this._override=!1}get length(){return this._values.size+this._refs.size}add(e,t){a.isResolvable(e)?this._refs.has(e)||(this._refs.add(e),t&&t.register(e)):this.has(e,null,null,!1)||(this._values.add(e),"string"==typeof e&&this._lowercase.set(e.toLowerCase(),e))}static merge(e,t,r){if(e=e||new o.Values,t){if(t._override)return t.clone();for(const r of[...t._values,...t._refs])e.add(r)}if(r)for(const t of[...r._values,...r._refs])e.remove(t);return e.length?e:null}remove(e){a.isResolvable(e)?this._refs.delete(e):(this._values.delete(e),"string"==typeof e&&this._lowercase.delete(e.toLowerCase()))}has(e,t,r,n){return!!this.get(e,t,r,n)}get(e,t,r,n){if(!this.length)return!1;if(this._values.has(e))return{value:e};if("string"==typeof e&&e&&n){const t=this._lowercase.get(e.toLowerCase());if(t)return{value:t}}if(!this._refs.size&&"object"!=typeof e)return!1;if("object"==typeof e)for(const t of this._values)if(i(t,e))return{value:t};if(t)for(const a of this._refs){const o=a.resolve(e,t,r,null,{in:!0});if(void 0===o)continue;const s=a.in&&"object"==typeof o?Array.isArray(o)?o:Object.keys(o):[o];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:a}}else if(i(t,e))return{value:t,ref:a}}return!1}override(){this._override=!0}values(e){if(e&&e.display){const e=[];for(const t of[...this._values,...this._refs])void 0!==t&&e.push(t);return e}return Array.from([...this._values,...this._refs])}clone(){const e=new o.Values(this._values,this._refs);return e._override=this._override,e}concat(e){n(!e._override,"Cannot concat override set of values");const t=new o.Values([...this._values,...e._values],[...this._refs,...e._refs]);return t._override=this._override,t}describe(){const e=[];this._override&&e.push({override:!0});for(const t of this._values.values())e.push(t&&"object"==typeof t?{value:t}:t);for(const t of this._refs.values())e.push(t.describe());return e}},o.Values.prototype[a.symbols.values]=!0,o.Values.prototype.slice=o.Values.prototype.clone,o.lowercases=function(e){const t=new Map;if(e)for(const r of e)"string"==typeof r&&t.set(r.toLowerCase(),r);return t}},4958:(e,t,r)=>{r.r(t),r.d(t,{analyzeDomain:()=>h,analyzeEmail:()=>_,errorCodes:()=>i,ipRegex:()=>N,isDomainValid:()=>m,isEmailValid:()=>A,uriDecode:()=>q,uriRegex:()=>M,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 a(e){return{code:e,error:i[e]}}const o=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 a("DOMAIN_NON_EMPTY_STRING");if("string"!=typeof e)throw new Error("Invalid input: domain must be a string");if(e.length>256)return a("DOMAIN_TOO_LONG");if(s.test(e)){if(!1===t.allowUnicode)return a("DOMAIN_INVALID_UNICODE_CHARS");e=e.normalize("NFC")}if(l.test(e))return a("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||o,n=e.split(".");if(n.length<r)return a("DOMAIN_SEGMENTS_COUNT");if(t.maxDomainSegments&&n.length>t.maxDomainSegments)return a("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 a("DOMAIN_FORBIDDEN_TLDS")}else if(i.deny.has(e))return a("DOMAIN_FORBIDDEN_TLDS")}for(let e=0;e<n.length;++e){const r=n[e];if(!r.length)return a("DOMAIN_EMPTY_SEGMENT");if(r.length>63)return a("DOMAIN_LONG_SEGMENT");if(e<n.length-1){if(t.allowUnderscore){if(!d.test(r))return a("DOMAIN_INVALID_CHARS")}else if(!c.test(r))return a("DOMAIN_INVALID_CHARS")}else if(!u.test(r))return a("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 a("EMPTY_STRING");const r=!b.test(e);if(!r){if(!1===t.allowUnicode)return a("FORBIDDEN_UNICODE");e=e.normalize("NFC")}const n=e.split("@");if(2!==n.length)return n.length>2?a("MULTIPLE_AT_CHAR"):a("MISSING_AT_CHAR");const[i,o]=n;if(!i)return a("EMPTY_LOCAL");if(!t.ignoreLength){if(e.length>254)return a("ADDRESS_TOO_LONG");if(v.encode(i).length>64)return a("LOCAL_TOO_LONG")}return function(e,t){const r=e.split(".");for(const e of r){if(!e.length)return a("EMPTY_LOCAL_SEGMENT");if(t){if(!T.test(e))return a("INVALID_LOCAL_CHARS")}else for(const t of e){if(T.test(t))continue;const e=S(t);if(!E.test(e))return a("INVALID_LOCAL_CHARS")}}return null}(i,r)||h(o,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 x=r(375),O=r.n(x),C=r(6064),I=r.n(C);const j=function(){const e={},t="\\dA-Fa-f",r="["+t+"]",n="\\w-\\.~",i="!\\$&'\\(\\)\\*\\+,;=",a="%"+t,o=n+a+i+":@",s="["+o+"]",l="(?:0{0,2}\\d|0?[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])";e.ipv4address="(?:"+l+"\\.){3}"+l;const 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+a+i+":]*",A="["+n+a+i+"]{1,255}",w="(?:\\[(?:"+e.ipv6address+"|"+e.ipvFuture+")\\]|"+e.ipv4address+"|"+A+")",S="(?:"+_+"@)?"+w+"(?::\\d*)?",T="(?:"+_+"@)?("+w+")(?::\\d*)?",E=s+"*",x=s+"+",O="(?:\\/"+E+")*",C="\\/(?:"+x+O+")?",I=x+O,j="["+n+a+i+"@]+"+O,R="(?:\\/\\/\\/"+E+O+")";return e.hierPart="(?:(?:\\/\\/"+S+O+")|"+C+"|"+I+"|"+R+")",e.hierPartCapture="(?:(?:\\/\\/"+T+O+")|"+C+"|"+I+")",e.relativeRef="(?:(?:\\/\\/"+S+O+")|"+C+"|"+j+"|)",e.relativeRefCapture="(?:(?:\\/\\/"+T+O+")|"+C+"|"+j+"|)",e.query="["+o+"\\/\\?]*(?=#|$)",e.queryWithSquareBrackets="["+o+"\\[\\]\\/\\?]*(?=#|$)",e.fragment="["+o+"\\/\\?]*",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){O()(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);O()(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];O()(i instanceof RegExp||"string"==typeof i,"scheme at position "+e+" must be a RegExp or String"),i instanceof RegExp?n.push(i.source.toString()):(O()(t.schemeRegex.test(i),"scheme at position "+e+" must be a valid scheme"),n.push(I()(i)))}i=n.join("|")}const a="(?:"+(i?"(?:"+i+")":t.scheme)+":"+(e.domain?t.hierPartCapture:t.hierPart)+")";return F((e.allowRelative?"(?:"+a+"|"+n+")":a)+r,i)}function F(e,t=null){return{raw:e=`(?=.)(?!https?:/(?:$|[^/]))(?!https?:///)(?!https?:[^/])${e}`,regex:new RegExp(`^${e}$`),scheme:t}}const P=D({});function M(e={}){return e.scheme||e.allowRelative||e.relativeOnly||e.allowQuerySquareBrackets||e.domain?D(e):P}function N(e={}){const t=e.cidr||"optional";O()(["required","optional","forbidden"].includes(t),"options.cidr must be one of required, optional, forbidden"),O()(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]),O()(r.length>=1,"options.version must have at least 1 version specified");for(const e of r)O()("string"==typeof e&&e===e.toLowerCase(),"Invalid options.version value"),O()(["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,a=t,o=k.accept;for(;t>-1&&t<e.length;){const s=$(e[t+1],4)|$(e[t+2],0),l=k.data[s];if(o=k.data[256+o+l],i=i<<6|s&k.data[364+l],o!==k.accept){if(o===k.reject)return null;if(t+=3,t>=e.length||"%"!==e[t])return null}else r+=e.slice(n,a),r+=i<=65535?String.fromCharCode(i):String.fromCharCode(55232+(i>>10),56320+(1023&i)),i=0,n=t+3,t=e.indexOf("%",n),a=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="",a=0,o=!1;const s=e=>{if(a)throw new Error("Formula missing closing parenthesis");const s=n.length?n[n.length-1]:null;if(o||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(o){if("]"===o)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)o?t===o?(s(),o=!1):i+=t:a?"("===t?(i+=t,++a):")"===t?(--a,a?i+=t:s(t)):i+=t:t in r.literals?o=r.literals[t]:"("===t?(s(),++a):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 a=[];if(e){let t="",i=0,o=!1;const s=()=>{if(!t)throw new Error(`Formula contains function ${n} with invalid arguments ${e}`);a.push(t),t=""};for(let n=0;n<e.length;++n){const a=e[n];o?(t+=a,a===o&&(o=!1)):a in r.literals&&!i?(t+=a,o=r.literals[a]):","!==a||i?(t+=a,"("===a?++i:")"===a&&--i):s()}s()}return a=a.map((e=>new t.Parser(e,this.settings))),function(e){const t=[];for(const r of a)t.push(r.evaluate(e));return 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 a=t[n+1];t.splice(n+1,1);const o=r.evaluate(a,e);t[n]=r.single(i.value,o)}}return r.operatorsOrder.forEach((n=>{for(let i=1;i<t.length-1;)if(n.includes(t[i])){const n=t[i],a=r.evaluate(t[i-1],e),o=r.evaluate(t[i+1],e);t.splice(i,2);const s=r.calculate(n,a,o);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),a=r(1687),o=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 o=i(e);if(!0===t)return o;const l=void 0!==r.nullOverride&&r.nullOverride;return a(o,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=o(e,r);n&&"object"==typeof n?u.set(n,c&&o(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 a(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),a=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(" "),a)}},4213:e=>{e.exports=class extends Error{constructor(e,t){var r,n,i,a;super(e||"Unknown error"),r=this,i="AssertError",(n="symbol"==typeof(a=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"))?a:String(a))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),a=r(7043),o={needsProtoHack:new Set([i.set,i.map,i.weakSet,i.weakMap])};e.exports=o.clone=function(e,t={},r=null){if("object"!=typeof e||null===e)return e;let n=o.clone,s=r;if(t.shallow){if(!0!==t.shallow)return o.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=o.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=a.keys(e,t);for(const r of c){if("__proto__"===r)continue;if(l===i.array&&"length"===r){u.length=e.length;continue}const a=Object.getOwnPropertyDescriptor(e,r);a?a.get||a.set?Object.defineProperty(u,r,a):a.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},o.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 o.clone(e,t,i)},o.base=function(e,t,r){if(!1===r.prototype)return o.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(o.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),a=r(6064),o=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 a;n=null!==(a=n)&&void 0!==a?a:s.compare(r);let t=!1;for(const[r,a]of i.entries())if(n(r,e)){++a.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 o=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,a]of i.entries())if(n(r,t)){e=a;break}}else e=i.get(t);if(e&&(++e.hits,++o,r.once&&e.hits>e.allowed))return!1}if(r.only&&o!==e.length)return!1;for(const e of i.values())if(e.hits!==e.allowed&&e.hits<e.allowed&&!r.part)return!1;return!!o},s.object=function(e,t,r){n(void 0===r.once,"Cannot use option once with object");const i=o.keys(e,r);if(!i.length)return!1;if(Array.isArray(t))return s.array(i,t,r);const a=Object.getOwnPropertySymbols(t).filter((e=>t.propertyIsEnumerable(e))),l=[...Object.keys(t),...a],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,o=[];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}),o.push(a(e)))}else if(r.once||r.only)return!1;if(!o.length)return!0;const s=new RegExp(`(${o.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,a){if(e===t)return 0!==e||1/e==1/t;const o=typeof e;if(o!==typeof t)return!1;if(null===e||null===t)return!1;if("function"===o){if(!r.deepFunction||e.toString()!==t.toString())return!1}else if("object"!==o)return e!=e&&t!=t;const 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=a.length-1;r>=0;--r)if(a[r].isSame(e,t))return!0;a.push(new i.SeenEntry(e,t));try{return!!i.isDeepEqualObj(s,e,t,r,a)}finally{a.pop()}},i.getSharedType=function(e,t,r){if(r)return Object.getPrototypeOf(e)!==Object.getPrototypeOf(t)?i.mismatched:n.getInternalProto(e);const a=n.getInternalProto(e);return a!==n.getInternalProto(t)?i.mismatched:a},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,a,o){const{isDeepEqual:s,valueOf:l,hasOwnEnumerableProperty:u}=i,{keys:c,getOwnPropertySymbols:d}=Object;if(e===n.array){if(!a.part){if(t.length!==r.length)return!1;for(let e=0;e<t.length;++e)if(!s(t[e],r[e],a,o))return!1;return!0}for(const e of t)for(const t of r)if(s(e,t,a,o))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,a,o)){e.delete(n),t=!0;break}if(!t)return!1}}}else if(e===n.map){if(t.size!==r.size)return!1;for(const[e,n]of Map.prototype.entries.call(t)){if(void 0===n&&!Map.prototype.has.call(r,e))return!1;if(!s(n,Map.prototype.get.call(r,e),a,o))return!1}}else if(e===n.error&&(t.name!==r.name||t.message!==r.message))return!1;const p=l(t),f=l(r);if((t!==p||r!==f)&&!s(p,f,a,o))return!1;const h=c(t);if(!a.part&&h.length!==c(r).length&&!a.skip)return!1;let m=0;for(const e of h)if(a.skip&&a.skip.includes(e))void 0===r[e]&&++m;else{if(!u(r,e))return!1;if(!s(t[e],r[e],a,o))return!1}if(!a.part&&h.length-m!==c(r).length)return!1;if(!1!==a.symbols){const e=d(t),n=new Set(d(r));for(const i of e){var g;if(null===(g=a.skip)||void 0===g||!g.includes(i))if(u(t,i)){if(!u(r,i))return!1;if(!s(t[i],r[i],a,o))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,"&"],[60,"<"],[62,">"],[34,"""],[160," "],[162,"¢"],[163,"£"],[164,"¤"],[169,"©"],[174,"®"]]),t.safeCharCodes=function(){const e=new Set;for(let t=32;t<123;++t)(t>=97||t>=65&&t<=90||t>=48&&t<=57||32===t||46===t||44===t||45===t||58===t||95===t)&&e.add(t);return e}()},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=[],a=Array.isArray(e)?new Set(e):e,o=new Set;for(const e of r)if(t.has(a,e)&&!o.has(e)){if(n.first)return e;i.push(e),o.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),a=r(7043),o={};e.exports=o.merge=function(e,t,r){if(n(e&&"object"==typeof e,"Invalid target value: must be an object"),n(null==t||"object"==typeof t,"Invalid source value: must be null, undefined, or an object"),!t)return e;if(r=Object.assign({nullOverride:!0,mergeArrays:!0},r),Array.isArray(t)){n(Array.isArray(e),"Cannot merge array onto an object"),r.mergeArrays||(e.length=0);for(let n=0;n<t.length;++n)e.push(i(t[n],{symbols:r.symbols}));return e}const s=a.keys(t,r);for(let n=0;n<s.length;++n){const a=s[n];if("__proto__"===a||!Object.prototype.propertyIsEnumerable.call(t,a))continue;const l=t[a];if(l&&"object"==typeof l){if(e[a]===l)continue;!e[a]||"object"!=typeof e[a]||Array.isArray(e[a])!==Array.isArray(l)||l instanceof Date||l instanceof RegExp?e[a]=i(l,{symbols:r.symbols}):o.merge(e[a],l,r)}else(null!=l||r.nullOverride)&&(e[a]=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 a=Array.isArray(t);n(!a||!r.separator,"Separator option is not valid for array-based chain");const o=a?t:t.split(r.separator||".");let s=e;for(let e=0;e<o.length;++e){let a=o[e];const l=r.iterables&&i.iterables(s);if(Array.isArray(s)||"set"===l){const e=Number(a);Number.isInteger(e)&&(a=e<0?s.length+e:e)}if(!s||"function"==typeof s&&!1===r.functions||!l&&void 0===s[a]){n(!r.strict||e+1===o.length,"Missing segment",a,"in reach path ",t),n("object"==typeof s||!0===r.functions||"function"!=typeof s,"Invalid segment",a,"in reach path ",t),s=r.default;break}s=l?"set"===l?[...s][a]:s.get(a):s[a]}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 a=n(e,i,r);return null!=a?a:""}))}},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,a=()=>{const r=Math.min(e,2147483647);e-=r,i((()=>e>0?a():n(t)),r)};e!==1/0&&a()}))}},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,a,o,s;t=null!==(r=t)&&void 0!==r?r:{};const l=[].concat(null!==(i=t.before)&&void 0!==i?i:[]),u=[].concat(null!==(a=t.after)&&void 0!==a?a:[]),c=null!==(o=t.group)&&void 0!==o?o:"?",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 a of this._items){var n;const o=a.seq,s=a.group;r[s]=null!==(n=r[s])&&void 0!==n?n:[],r[s].push(o),e[o]=a.before;for(const e of a.after){var i;t[e]=null!==(i=t[e])&&void 0!==i?i:[],t[e].push(o)}}for(const t in e){const n=[];for(const i in e[t]){var a;const o=e[t][i];r[o]=null!==(a=r[o])&&void 0!==a?a:[],n.push(...r[o])}e[t]=n}for(const n in t)if(r[n])for(const i of r[n])e[i].push(...t[n]);const o={};for(const t in e){const r=e[t];for(const e of r){var s;o[e]=null!==(s=o[e])&&void 0!==s?s:[],o[e].push(t)}}const l={},u=[];for(let e=0;e<this._items.length;++e){let t=e;if(o[e]){t=null;for(let e=0;e<this._items.length;++e){if(!0===l[e])continue;o[e]||(o[e]=[]);const r=o[e].length;let n=0;for(let t=0;t<r;++t)l[o[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 a=t[n]={exports:{}};return e[n](a,a.exports,r),a.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()},288:(e,t,r)=>{var n="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||void 0!==r.g&&r.g,i=function(){function e(){this.fetch=!1,this.DOMException=n.DOMException}return e.prototype=n,new e}();!function(e){!function(t){var r=void 0!==e&&e||"undefined"!=typeof self&&self||void 0!==r&&r,n="URLSearchParams"in r,i="Symbol"in r&&"iterator"in Symbol,a="FileReader"in r&&"Blob"in r&&function(){try{return new Blob,!0}catch(e){return!1}}(),o="FormData"in r,s="ArrayBuffer"in r;if(s)var l=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(e){return e&&l.indexOf(Object.prototype.toString.call(e))>-1};function c(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 d(e){return"string"!=typeof e&&(e=String(e)),e}function p(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return i&&(t[Symbol.iterator]=function(){return t}),t}function f(e){this.map={},e instanceof f?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function h(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function m(e){return new Promise((function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}}))}function g(e){var t=new FileReader,r=m(t);return t.readAsArrayBuffer(e),r}function y(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function b(){return this.bodyUsed=!1,this._initBody=function(e){var t;this.bodyUsed=this.bodyUsed,this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:a&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:o&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:n&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():s&&a&&(t=e)&&DataView.prototype.isPrototypeOf(t)?(this._bodyArrayBuffer=y(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s&&(ArrayBuffer.prototype.isPrototypeOf(e)||u(e))?this._bodyArrayBuffer=y(e):this._bodyText=e=Object.prototype.toString.call(e):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):n&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},a&&(this.blob=function(){var e=h(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(){return this._bodyArrayBuffer?h(this)||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer)):this.blob().then(g)}),this.text=function(){var e,t,r,n=h(this);if(n)return n;if(this._bodyBlob)return e=this._bodyBlob,r=m(t=new FileReader),t.readAsText(e),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)},o&&(this.formData=function(){return this.text().then(A)}),this.json=function(){return this.text().then(JSON.parse)},this}f.prototype.append=function(e,t){e=c(e),t=d(t);var r=this.map[e];this.map[e]=r?r+", "+t:t},f.prototype.delete=function(e){delete this.map[c(e)]},f.prototype.get=function(e){return e=c(e),this.has(e)?this.map[e]:null},f.prototype.has=function(e){return this.map.hasOwnProperty(c(e))},f.prototype.set=function(e,t){this.map[c(e)]=d(t)},f.prototype.forEach=function(e,t){for(var r in this.map)this.map.hasOwnProperty(r)&&e.call(t,this.map[r],r,this)},f.prototype.keys=function(){var e=[];return this.forEach((function(t,r){e.push(r)})),p(e)},f.prototype.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),p(e)},f.prototype.entries=function(){var e=[];return this.forEach((function(t,r){e.push([r,t])})),p(e)},i&&(f.prototype[Symbol.iterator]=f.prototype.entries);var v=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function _(e,t){if(!(this instanceof _))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');var r,n,i=(t=t||{}).body;if(e instanceof _){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new f(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,i||null==e._bodyInit||(i=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 f(t.headers)),this.method=(n=(r=t.method||this.method||"GET").toUpperCase(),v.indexOf(n)>-1?n:r),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(i),!("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 A(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 w(e,t){if(!(this instanceof w))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText=void 0===t.statusText?"":""+t.statusText,this.headers=new f(t.headers),this.url=t.url||"",this._initBody(e)}_.prototype.clone=function(){return new _(this,{body:this._bodyInit})},b.call(_.prototype),b.call(w.prototype),w.prototype.clone=function(){return new w(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new f(this.headers),url:this.url})},w.error=function(){var e=new w(null,{status:0,statusText:""});return e.type="error",e};var S=[301,302,303,307,308];w.redirect=function(e,t){if(-1===S.indexOf(t))throw new RangeError("Invalid status code");return new w(null,{status:t,headers:{location:e}})},t.DOMException=r.DOMException;try{new t.DOMException}catch(e){t.DOMException=function(e,t){this.message=e,this.name=t;var r=Error(e);this.stack=r.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function T(e,n){return new Promise((function(i,o){var l=new _(e,n);if(l.signal&&l.signal.aborted)return o(new t.DOMException("Aborted","AbortError"));var u=new XMLHttpRequest;function c(){u.abort()}u.onload=function(){var e,t,r={status:u.status,statusText:u.statusText,headers:(e=u.getAllResponseHeaders()||"",t=new f,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();t.append(n,i)}})),t)};r.url="responseURL"in u?u.responseURL:r.headers.get("X-Request-URL");var n="response"in u?u.response:u.responseText;setTimeout((function(){i(new w(n,r))}),0)},u.onerror=function(){setTimeout((function(){o(new TypeError("Network request failed"))}),0)},u.ontimeout=function(){setTimeout((function(){o(new TypeError("Network request failed"))}),0)},u.onabort=function(){setTimeout((function(){o(new t.DOMException("Aborted","AbortError"))}),0)},u.open(l.method,function(e){try{return""===e&&r.location.href?r.location.href:e}catch(t){return e}}(l.url),!0),"include"===l.credentials?u.withCredentials=!0:"omit"===l.credentials&&(u.withCredentials=!1),"responseType"in u&&(a?u.responseType="blob":s&&l.headers.get("Content-Type")&&-1!==l.headers.get("Content-Type").indexOf("application/octet-stream")&&(u.responseType="arraybuffer")),!n||"object"!=typeof n.headers||n.headers instanceof f?l.headers.forEach((function(e,t){u.setRequestHeader(t,e)})):Object.getOwnPropertyNames(n.headers).forEach((function(e){u.setRequestHeader(e,d(n.headers[e]))})),l.signal&&(l.signal.addEventListener("abort",c),u.onreadystatechange=function(){4===u.readyState&&l.signal.removeEventListener("abort",c)}),u.send(void 0===l._bodyInit?null:l._bodyInit)}))}T.polyfill=!0,r.fetch||(r.fetch=T,r.Headers=f,r.Request=_,r.Response=w),t.Headers=f,t.Request=_,t.Response=w,t.fetch=T}({})}(i),i.fetch.ponyfill=!0,delete i.fetch.polyfill;var a=n.fetch?n:i;(t=a.fetch).default=a.fetch,t.fetch=a.fetch,t.Headers=a.Headers,t.Request=a.Request,t.Response=a.Response,e.exports=t},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),a=r(9005),o=n?n.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":o&&o in Object(e)?i(e):a(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),a=r(1580),o=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!(!a(e)||i(e))&&(n(e)?p:s).test(o(e))}},674:(e,t,r)=>{var n=r(7379),i=r(5387),a=r(547),o={};o["[object Float32Array]"]=o["[object Float64Array]"]=o["[object Int8Array]"]=o["[object Int16Array]"]=o["[object Int32Array]"]=o["[object Uint8Array]"]=o["[object Uint8ClampedArray]"]=o["[object Uint16Array]"]=o["[object Uint32Array]"]=!0,o["[object Arguments]"]=o["[object Array]"]=o["[object ArrayBuffer]"]=o["[object Boolean]"]=o["[object DataView]"]=o["[object Date]"]=o["[object Error]"]=o["[object Function]"]=o["[object Map]"]=o["[object Number]"]=o["[object Object]"]=o["[object RegExp]"]=o["[object Set]"]=o["[object String]"]=o["[object WeakMap]"]=!1,e.exports=function(e){return a(e)&&i(e.length)&&!!o[n(e)]}},195:(e,t,r)=>{var n=r(4882),i=r(8121),a=Object.prototype.hasOwnProperty;e.exports=function(e){if(!n(e))return i(e);var t=[];for(var r in Object(e))a.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,a=i.hasOwnProperty,o=i.toString,s=n?n.toStringTag:void 0;e.exports=function(e){var t=a.call(e,s),r=e[s];try{e[s]=void 0;var n=!0}catch(e){}var i=o.call(e);return n&&(t?e[s]=r:delete e[s]),i}},8486:(e,t,r)=>{var n=r(3103),i=r(9770),a=r(9413),o=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(a),b=u(o),v=u(s),_=l;(n&&_(new n(new ArrayBuffer(1)))!=h||i&&_(new i)!=c||a&&_(a.resolve())!=d||o&&_(new o)!=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),a=(n=/[^.]+$/.exec(i&&i.keys&&i.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"";e.exports=function(e){return!!a&&a 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,a=i&&e&&!e.nodeType&&e,o=a&&a.exports===i&&n.process,s=function(){try{return a&&a.require&&a.require("util").types||o&&o.binding&&o.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,a=n||i||Function("return this")();e.exports=a},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),a=r(6131),o=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=a(t)||0,n(r)&&(m=!!r.leading,c=(g="maxWait"in r)?o(a(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),a=Object.prototype,o=a.hasOwnProperty,s=a.propertyIsEnumerable,l=n(function(){return arguments}())?n:function(e){return i(e)&&o.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),a=t&&!t.nodeType&&t,o=a&&e&&!e.nodeType&&e,s=o&&o.exports===a?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),a=r(3283),o=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)&&(o(e)||"string"==typeof e||"function"==typeof e.splice||l(e)||c(e)||a(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),a=r(2306),o=a&&a.isTypedArray,s=o?i(o):n;e.exports=s},5250:function(e,t,r){var n;e=r.nmd(e),function(){var i,a="Expected a function",o="__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]",x="[object RegExp]",O="[object Set]",C="[object String]",I="[object Symbol]",j="[object WeakMap]",R="[object ArrayBuffer]",D="[object DataView]",F="[object Float32Array]",P="[object Float64Array]",M="[object Int8Array]",N="[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/,ae=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,oe=/\{\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",xe="\\ufe0e\\ufe0f",Oe="\\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="["+Oe+"]",je="["+we+"]",Re="\\d+",De="["+Se+"]",Fe="["+Te+"]",Pe="[^"+Ae+Oe+Re+Se+Te+Ee+"]",Me="\\ud83c[\\udffb-\\udfff]",Ne="[^"+Ae+"]",Le="(?:\\ud83c[\\udde6-\\uddff]){2}",ke="[\\ud800-\\udbff][\\udc00-\\udfff]",qe="["+Ee+"]",$e="\\u200d",ze="(?:"+Fe+"|"+Pe+")",Be="(?:"+qe+"|"+Pe+")",Ge="(?:['’](?:d|ll|m|re|s|t|ve))?",Ue="(?:['’](?:D|LL|M|RE|S|T|VE))?",Ve="(?:"+je+"|"+Me+")?",He="["+xe+"]?",Ye=He+Ve+"(?:"+$e+"(?:"+[Ne,Le,ke].join("|")+")"+He+Ve+")*",Xe="(?:"+[De,Le,ke].join("|")+")"+Ye,We="(?:"+[Ne+je+"?",je,Le,ke,Ce].join("|")+")",Ke=RegExp("['’]","g"),Qe=RegExp(je,"g"),Ze=RegExp(Me+"(?="+Me+")|"+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+xe+"]"),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[P]=it[M]=it[N]=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[x]=it[O]=it[C]=it[j]=!1;var at={};at[m]=at[g]=at[R]=at[D]=at[y]=at[b]=at[F]=at[P]=at[M]=at[N]=at[L]=at[w]=at[S]=at[T]=at[x]=at[O]=at[C]=at[I]=at[k]=at[q]=at[$]=at[z]=!0,at[v]=at[_]=at[j]=!1;var ot={"\\":"\\","'":"'","\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&>.isArrayBuffer,bt=gt&>.isDate,vt=gt&>.isMap,_t=gt&>.isRegExp,At=gt&>.isSet,wt=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,a=null==e?0:e.length;++i<a;){var o=e[i];t(n,o,r(o),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 xt(e,t){for(var r=null==e?0:e.length;r--&&!1!==t(e[r],r,e););return e}function Ot(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,a=[];++r<n;){var o=e[r];t(o,r,e)&&(a[i++]=o)}return a}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,a=null==e?0:e.length;for(n&&a&&(r=e[++i]);++i<a;)r=t(r,e[i],i,e);return r}function Pt(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 Mt(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 Nt=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,a=r+(n?1:-1);n?a--:++a<i;)if(t(e[a],a,e))return a;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,a=e.length;++i<a;)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,a){r=n?(n=!1,e):t(r,e,i,a)})),r}function Ht(e,t){for(var r,n=-1,a=e.length;++n<a;){var o=t(e[n]);o!==i&&(r=r===i?o:r+o)}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({"&":"&","<":"<",">":">",'"':""","'":"'"});function rr(e){return"\\"+ot[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 ar(e,t){return function(r){return e(t(r))}}function or(e,t){for(var r=-1,n=e.length,i=0,a=[];++r<n;){var o=e[r];o!==t&&o!==s||(e[r]=s,a[i++]=r)}return a}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):Nt(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({"&":"&","<":"<",">":">",""":'"',"'":"'"}),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,xe=t.String,Oe=t.TypeError,Ce=n.prototype,Ie=we.prototype,je=Te.prototype,Re=t["__core-js_shared__"],De=Ie.toString,Fe=je.hasOwnProperty,Pe=0,Me=(r=/[^.]+$/.exec(Re&&Re.keys&&Re.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"",Ne=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=ar(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=la(Te,"defineProperty");return e({},"",{}),e}catch(e){}}(),ot=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,Nt=t.isFinite,Ut=Ce.join,hr=ar(Te.keys,Te),mr=Se.max,gr=Se.min,yr=ie.now,br=t.parseInt,vr=Se.random,_r=Ce.reverse,Ar=la(t,"DataView"),wr=la(t,"Map"),Sr=la(t,"Promise"),Tr=la(t,"Set"),Er=la(t,"WeakMap"),xr=la(Te,"create"),Or=Er&&new Er,Cr={},Ir=Na(Ar),jr=Na(wr),Rr=Na(Sr),Dr=Na(Tr),Fr=Na(Er),Pr=ze?ze.prototype:i,Mr=Pr?Pr.valueOf:i,Nr=Pr?Pr.toString:i;function Lr(e){if(es(e)&&!Go(e)&&!(e instanceof zr)){if(e instanceof $r)return e;if(Fe.call(e,"__wrapped__"))return La(e)}return new $r(e)}var kr=function(){function e(){}return function(t){if(!Jo(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=Go(e),n=!r&&Bo(e),i=!r&&!n&&Yo(e),a=!r&&!n&&!i&&ls(e),o=r||n||i||a,s=o?Yt(e.length,xe):[],l=s.length;for(var u in e)!t&&!Fe.call(e,u)||o&&("length"==u||i&&("offset"==u||"parent"==u)||a&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||ma(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 Ra(xi(e),an(t,0,e.length))}function Kr(e){return Ra(xi(e))}function Qr(e,t,r){(r!==i&&!qo(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)&&qo(n,r)&&(r!==i||t in e)||rn(e,t,r)}function Jr(e,t){for(var r=e.length;r--;)if(qo(e[r][0],t))return r;return-1}function en(e,t,r,n){return cn(e,(function(e,i,a){t(n,e,r(e),a)})),n}function tn(e,t){return e&&Oi(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,a=t.length,o=n(a),s=null==e;++r<a;)o[r]=s?i:Es(e,t[r]);return o}function an(e,t,r){return e==e&&(r!==i&&(e=e<=r?e:r),t!==i&&(e=e>=t?e:t)),e}function on(e,t,r,n,a,o){var s,l=1&t,u=2&t,c=4&t;if(r&&(s=a?r(e,n,a,o):r(e)),s!==i)return s;if(!Jo(e))return e;var d=Go(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 xi(e,s)}else{var p=da(e),f=p==_||p==A;if(Yo(e))return _i(e,l);if(p==T||p==m||f&&!a){if(s=u||f?{}:fa(e),!l)return u?function(e,t){return Oi(e,ca(e),t)}(e,function(e,t){return e&&Oi(t,Rs(t),e)}(s,e)):function(e,t){return Oi(e,ua(e),t)}(e,tn(s,e))}else{if(!at[p])return a?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 P:case M:case N: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 x:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case O:return new i;case I:return n=e,Mr?Te(Mr.call(n)):{}}}(e,p,l)}}o||(o=new Hr);var h=o.get(e);if(h)return h;o.set(e,s),as(e)?e.forEach((function(n){s.add(on(n,t,r,n,e,o))})):ts(e)&&e.forEach((function(n,i){s.set(i,on(n,t,r,i,e,o))}));var g=d?i:(c?u?ta:ea:u?Rs:js)(e);return Et(g||e,(function(n,i){g&&(n=e[i=n]),Zr(s,i,on(n,t,r,i,e,o))})),s}function sn(e,t,r){var n=r.length;if(null==e)return!n;for(e=Te(e);n--;){var a=r[n],o=t[a],s=e[a];if(s===i&&!(a in e)||!o(s))return!1}return!0}function ln(e,t,r){if("function"!=typeof e)throw new Oe(a);return Oa((function(){e.apply(i,r)}),t)}function un(e,t,r,n){var i=-1,a=It,o=!0,s=e.length,l=[],u=t.length;if(!s)return l;r&&(t=Rt(t,Wt(r))),n?(a=jt,o=!1):t.length>=200&&(a=Qt,o=!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,o&&d==d){for(var p=u;p--;)if(t[p]===d)continue e;l.push(c)}else a(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__=xr?xr(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(xr){var r=t[e];return r===o?i:r}return Fe.call(t,e)?t[e]:i},Br.prototype.has=function(e){var t=this.__data__;return xr?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]=xr&&t===i?o: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=oa(this,e).delete(e);return this.size-=t?1:0,t},Ur.prototype.get=function(e){return oa(this,e).get(e)},Ur.prototype.has=function(e){return oa(this,e).has(e)},Ur.prototype.set=function(e,t){var r=oa(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,o),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,a=e.length;++n<a;){var o=e[n],s=t(o);if(null!=s&&(l===i?s==s&&!ss(s):r(s,l)))var l=s,u=o}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 a=-1,o=e.length;for(r||(r=ha),i||(i=[]);++a<o;){var s=e[a];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 Ko(e[t])}))}function An(e,t){for(var r=0,n=(t=gi(t,e)).length;null!=e&&r<n;)e=e[Ma(t[r++])];return r&&r==n?e:i}function wn(e,t,r){var n=t(e);return Go(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 a=Ne.call(e);return n&&(t?e[Ze]=r:delete e[Ze]),a}(e):function(e){return Ne.call(e)}(e)}function Tn(e,t){return e>t}function En(e,t){return null!=e&&Fe.call(e,t)}function xn(e,t){return null!=e&&t in Te(e)}function On(e,t,r){for(var a=r?jt:It,o=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||o>=120&&p.length>=120)?new Vr(l&&p):i}p=e[0];var f=-1,h=u[0];e:for(;++f<o&&d.length<c;){var m=p[f],g=t?t(m):m;if(m=r||0!==m?m:0,!(h?Qt(h,g):a(d,g,r))){for(l=s;--l;){var y=u[l];if(!(y?Qt(y,g):a(e[l],g,r)))continue e}h&&h.push(g),d.push(m)}}return d}function Cn(e,t,r){var n=null==(e=Ta(e,t=gi(t,e)))?e:e[Ma(Xa(t))];return null==n?i:St(n,e,r)}function In(e){return es(e)&&Sn(e)==m}function jn(e,t,r,n,a){return e===t||(null==e||null==t||!es(e)&&!es(t)?e!=e&&t!=t:function(e,t,r,n,a,o){var s=Go(e),l=Go(t),u=s?g:da(e),c=l?g:da(t),d=(u=u==m?T:u)==T,p=(c=c==m?T:c)==T,f=u==c;if(f&&Yo(e)){if(!Yo(t))return!1;s=!0,d=!1}if(f&&!d)return o||(o=new Hr),s||ls(e)?Zi(e,t,r,n,a,o):function(e,t,r,n,i,a,o){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||!a(new Be(e),new Be(t)));case y:case b:case S:return qo(+e,+t);case v:return e.name==t.name&&e.message==t.message;case x:case C:return e==t+"";case w:var s=ir;case O:var l=1&n;if(s||(s=sr),e.size!=t.size&&!l)return!1;var u=o.get(e);if(u)return u==t;n|=2,o.set(e,t);var c=Zi(s(e),s(t),n,i,a,o);return o.delete(e),c;case I:if(Mr)return Mr.call(e)==Mr.call(t)}return!1}(e,t,u,r,n,a,o);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 o||(o=new Hr),a(A,E,r,n,o)}}return!!f&&(o||(o=new Hr),function(e,t,r,n,a,o){var s=1&r,l=ea(e),u=l.length;if(u!=ea(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=o.get(e),f=o.get(t);if(p&&f)return p==t&&f==e;var h=!0;o.set(e,t),o.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,o):n(g,y,d,e,t,o);if(!(b===i?g===y||a(g,y,r,n,o):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 o.delete(e),o.delete(t),h}(e,t,r,n,a,o))}(e,t,r,n,jn,a))}function Rn(e,t,r,n){var a=r.length,o=a,s=!n;if(null==e)return!o;for(e=Te(e);a--;){var l=r[a];if(s&&l[2]?l[1]!==e[l[0]]:!(l[0]in e))return!1}for(;++a<o;){var u=(l=r[a])[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!(!Jo(e)||(t=e,Me&&Me in t))&&(Ko(e)?qe:me).test(Na(e));var t}function Fn(e){return"function"==typeof e?e:null==e?rl:"object"==typeof e?Go(e)?kn(e[0],e[1]):Ln(e):dl(e)}function Pn(e){if(!_a(e))return hr(e);var t=[];for(var r in Te(e))Fe.call(e,r)&&"constructor"!=r&&t.push(r);return t}function Mn(e,t){return e<t}function Nn(e,t){var r=-1,i=Vo(e)?n(e.length):[];return cn(e,(function(e,n,a){i[++r]=t(e,n,a)})),i}function Ln(e){var t=sa(e);return 1==t.length&&t[0][2]?wa(t[0][0],t[0][1]):function(r){return r===e||Rn(r,e,t)}}function kn(e,t){return ya(e)&&Aa(t)?wa(Ma(e),t):function(r){var n=Es(r,e);return n===i&&n===t?xs(r,e):jn(t,n,3)}}function qn(e,t,r,n,a){e!==t&&gn(t,(function(o,s){if(a||(a=new Hr),Jo(o))!function(e,t,r,n,a,o,s){var l=Ea(e,r),u=Ea(t,r),c=s.get(u);if(c)Qr(e,r,c);else{var d=o?o(l,u,r+"",e,t,s):i,p=d===i;if(p){var f=Go(u),h=!f&&Yo(u),m=!f&&!h&&ls(u);d=u,f||h||m?Go(l)?d=l:Ho(l)?d=xi(l):h?(p=!1,d=_i(u,!0)):m?(p=!1,d=wi(u,!0)):d=[]:ns(u)||Bo(u)?(d=l,Bo(l)?d=gs(l):Jo(l)&&!Ko(l)||(d=fa(u))):p=!1}p&&(s.set(u,d),a(d,u,n,o,s),s.delete(u)),Qr(e,r,d)}}(e,t,s,r,qn,n,a);else{var l=n?n(Ea(e,s),o,s+"",e,t,a):i;l===i&&(l=o),Qr(e,s,l)}}),Rs)}function $n(e,t){var r=e.length;if(r)return ma(t+=t<0?r:0,r)?e[t]:i}function zn(e,t,r){t=t.length?Rt(t,(function(e){return Go(e)?function(t){return An(t,1===e.length?e[0]:e)}:e})):[rl];var n=-1;t=Rt(t,Wt(aa()));var i=Nn(e,(function(e,r,i){var a=Rt(t,(function(t){return t(e)}));return{criteria:a,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,a=t.criteria,o=i.length,s=r.length;++n<o;){var l=Si(i[n],a[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,a={};++n<i;){var o=t[n],s=An(e,o);r(s,o)&&Kn(a,gi(o,e),s)}return a}function Gn(e,t,r,n){var i=n?$t:qt,a=-1,o=t.length,s=e;for(e===t&&(t=xi(t)),r&&(s=Rt(e,Wt(r)));++a<o;)for(var l=0,u=t[a],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!==a){var a=i;ma(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 Ca(Sa(e,t,rl),e+"")}function Xn(e){return Xr(qs(e))}function Wn(e,t){var r=qs(e);return Ra(r,an(t,0,r.length))}function Kn(e,t,r,n){if(!Jo(e))return e;for(var a=-1,o=(t=gi(t,e)).length,s=o-1,l=e;null!=l&&++a<o;){var u=Ma(t[a]),c=r;if("__proto__"===u||"constructor"===u||"prototype"===u)return e;if(a!=s){var d=l[u];(c=n?n(d,u,l):i)===i&&(c=Jo(d)?d:ma(t[a+1])?[]:{})}Zr(l,u,c),l=l[u]}return e}var Qn=Or?function(e,t){return Or.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 Ra(qs(e))}function ei(e,t,r){var i=-1,a=e.length;t<0&&(t=-t>a?0:a+t),(r=r>a?a:r)<0&&(r+=a),a=t>r?0:r-t>>>0,t>>>=0;for(var o=n(a);++i<a;)o[i]=e[i+t];return o}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 a=n+i>>>1,o=e[a];null!==o&&!ss(o)&&(r?o<=t:o<t)?n=a+1:i=a}return i}return ni(e,t,rl,r)}function ni(e,t,r,n){var a=0,o=null==e?0:e.length;if(0===o)return 0;for(var s=(t=r(t))!=t,l=null===t,u=ss(t),c=t===i;a<o;){var d=ft((a+o)/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?a=d+1:o=d}return gr(o,4294967294)}function ii(e,t){for(var r=-1,n=e.length,i=0,a=[];++r<n;){var o=e[r],s=t?t(o):o;if(!r||!qo(s,l)){var l=s;a[i++]=0===o?0:o}}return a}function ai(e){return"number"==typeof e?e:ss(e)?p:+e}function oi(e){if("string"==typeof e)return e;if(Go(e))return Rt(e,oi)+"";if(ss(e))return Nr?Nr.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function si(e,t,r){var n=-1,i=It,a=e.length,o=!0,s=[],l=s;if(r)o=!1,i=jt;else if(a>=200){var u=t?null:Hi(e);if(u)return sr(u);o=!1,i=Qt,l=new Vr}else l=t?[]:s;e:for(;++n<a;){var c=e[n],d=t?t(c):c;if(c=r||0!==c?c:0,o&&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=Ta(e,t=gi(t,e)))||delete e[Ma(Xa(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,a=n?i:-1;(n?a--:++a<i)&&t(e[a],a,e););return r?ei(e,n?0:a,n?a+1:i):ei(e,n?a+1:0,n?i:a)}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 a=-1,o=n(i);++a<i;)for(var s=e[a],l=-1;++l<i;)l!=a&&(o[a]=un(o[a]||s,e[l],t,r));return si(mn(o,1),t,r)}function fi(e,t,r){for(var n=-1,a=e.length,o=t.length,s={};++n<a;){var l=n<o?t[n]:i;r(s,e[n],l)}return s}function hi(e){return Ho(e)?e:[]}function mi(e){return"function"==typeof e?e:rl}function gi(e,t){return Go(e)?e:ya(e,t)?[e]:Pa(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=ot||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,a=e==e,o=ss(e),s=t!==i,l=null===t,u=t==t,c=ss(t);if(!l&&!c&&!o&&e>t||o&&s&&u&&!l&&!c||n&&s&&u||!r&&u||!a)return 1;if(!n&&!o&&!c&&e<t||c&&r&&a&&!n&&!o||l&&r&&a||!s&&a||!u)return-1}return 0}function Ti(e,t,r,i){for(var a=-1,o=e.length,s=r.length,l=-1,u=t.length,c=mr(o-s,0),d=n(u+c),p=!i;++l<u;)d[l]=t[l];for(;++a<s;)(p||a<o)&&(d[r[a]]=e[a]);for(;c--;)d[l++]=e[a++];return d}function Ei(e,t,r,i){for(var a=-1,o=e.length,s=-1,l=r.length,u=-1,c=t.length,d=mr(o-l,0),p=n(d+c),f=!i;++a<d;)p[a]=e[a];for(var h=a;++u<c;)p[h+u]=t[u];for(;++s<l;)(f||a<o)&&(p[h+r[s]]=e[a++]);return p}function xi(e,t){var r=-1,i=e.length;for(t||(t=n(i));++r<i;)t[r]=e[r];return t}function Oi(e,t,r,n){var a=!r;r||(r={});for(var o=-1,s=t.length;++o<s;){var l=t[o],u=n?n(r[l],e[l],l,r,e):i;u===i&&(u=e[l]),a?rn(r,l,u):Zr(r,l,u)}return r}function Ci(e,t){return function(r,n){var i=Go(r)?Tt:en,a=t?t():{};return i(r,e,aa(n,2),a)}}function Ii(e){return Yn((function(t,r){var n=-1,a=r.length,o=a>1?r[a-1]:i,s=a>2?r[2]:i;for(o=e.length>3&&"function"==typeof o?(a--,o):i,s&&ga(r[0],r[1],s)&&(o=a<3?i:o,a=1),t=Te(t);++n<a;){var l=r[n];l&&e(t,l,n,o)}return t}))}function ji(e,t){return function(r,n){if(null==r)return r;if(!Vo(r))return e(r,n);for(var i=r.length,a=t?i:-1,o=Te(r);(t?a--:++a<i)&&!1!==n(o[a],a,o););return r}}function Ri(e){return function(t,r,n){for(var i=-1,a=Te(t),o=n(t),s=o.length;s--;){var l=o[e?s:++i];if(!1===r(a[l],l,a))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),a=r?bi(r,1).join(""):t.slice(1);return n[e]()+a}}function Fi(e){return function(t){return Ft(Ks(Bs(t).replace(Ke,"")),e,"")}}function Pi(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 Jo(n)?n:r}}function Mi(e){return function(t,r,n){var a=Te(t);if(!Vo(t)){var o=aa(r,3);t=js(t),r=function(e){return o(a[e],e,a)}}var s=e(t,r,n);return s>-1?a[o?t[s]:s]:i}}function Ni(e){return Ji((function(t){var r=t.length,n=r,o=$r.prototype.thru;for(e&&t.reverse();n--;){var s=t[n];if("function"!=typeof s)throw new Oe(a);if(o&&!l&&"wrapper"==na(s))var l=new $r([],!0)}for(n=l?n:r;++n<r;){var u=na(s=t[n]),c="wrapper"==u?ra(s):i;l=c&&ba(c[0])&&424==c[1]&&!c[4].length&&1==c[9]?l[na(c[0])].apply(l,c[3]):1==s.length&&ba(s)?l[u]():l.thru(s)}return function(){var e=arguments,n=e[0];if(l&&1==e.length&&Go(n))return l.plant(n).value();for(var i=0,a=r?t[i].apply(this,e):n;++i<r;)a=t[i].call(this,a);return a}}))}function Li(e,t,r,a,o,s,l,c,d,p){var f=t&u,h=1&t,m=2&t,g=24&t,y=512&t,b=m?i:Pi(e);return function u(){for(var v=arguments.length,_=n(v),A=v;A--;)_[A]=arguments[A];if(g)var w=ia(u),S=function(e,t){for(var r=e.length,n=0;r--;)e[r]===t&&++n;return n}(_,w);if(a&&(_=Ti(_,a,o,g)),s&&(_=Ei(_,s,l,g)),v-=S,g&&v<p){var T=or(_,w);return Ui(e,t,Li,u.placeholder,r,_,T,c,d,p-v)}var E=h?r:this,x=m?E[e]:e;return v=_.length,c?_=function(e,t){for(var r=e.length,n=gr(t.length,r),a=xi(e);n--;){var o=t[n];e[n]=ma(o,r)?a[o]:i}return e}(_,c):y&&v>1&&_.reverse(),f&&d<v&&(_.length=d),this&&this!==dt&&this instanceof u&&(x=b||Pi(x)),x.apply(E,_)}}function ki(e,t){return function(r,n){return function(e,t,r,n){return bn(e,(function(e,i,a){t(n,r(e),i,a)})),n}(r,e,t(n),{})}}function qi(e,t){return function(r,n){var a;if(r===i&&n===i)return t;if(r!==i&&(a=r),n!==i){if(a===i)return n;"string"==typeof r||"string"==typeof n?(r=oi(r),n=oi(n)):(r=ai(r),n=ai(n)),a=e(r,n)}return a}}function $i(e){return Ji((function(t){return t=Rt(t,Wt(aa())),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?" ":oi(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,a){return a&&"number"!=typeof a&&ga(t,r,a)&&(r=a=i),t=ps(t),r===i?(r=t,t=0):r=ps(r),function(e,t,r,i){for(var a=-1,o=mr(pt((t-e)/(r||1)),0),s=n(o);o--;)s[i?o:++a]=e,e+=r;return s}(t,r,a=a===i?t<r?1:-1:ps(a),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,a,o,s,u,c,d){var p=8&t;t|=p?l:64,4&(t&=~(p?64:l))||(t&=-4);var f=[e,t,a,p?o:i,p?s:i,p?i:o,p?i:s,u,c,d],h=r.apply(i,f);return ba(e)&&xa(h,f),h.placeholder=n,Ia(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))&&Nt(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=da(t);return r==w?ir(t):r==O?lr(t):function(e,t){return Rt(t,(function(t){return[t,e[t]]}))}(t,e(t))}}function Xi(e,t,r,o,c,d,p,f){var h=2&t;if(!h&&"function"!=typeof e)throw new Oe(a);var m=o?o.length:0;if(m||(t&=-97,o=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=o,y=c;o=c=i}var b=h?i:ra(e),v=[e,t,r,o,c,g,y,d,p,f];if(b&&function(e,t){var r=e[1],n=t[1],i=r|n,a=i<131,o=n==u&&8==r||n==u&&256==r&&e[7].length<=t[8]||384==n&&t[7].length<=t[8]&&8==r;if(!a&&!o)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?or(e[3],s):t[4]}(l=t[5])&&(c=e[5],e[5]=c?Ei(c,l,t[6]):l,e[6]=c?or(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],o=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 a=Pi(e);return function o(){for(var s=arguments.length,l=n(s),u=s,c=ia(o);u--;)l[u]=arguments[u];var d=s<3&&l[0]!==c&&l[s-1]!==c?[]:or(l,c);return(s-=d.length)<r?Ui(e,t,Li,o.placeholder,i,l,d,i,i,r-s):St(this&&this!==dt&&this instanceof o?a:e,this,l)}}(e,t,f):t!=l&&33!=t||c.length?Li.apply(i,v):function(e,t,r,i){var a=1&t,o=Pi(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?o:e;++u<c;)d[u]=i[u];for(;l--;)d[u++]=arguments[++s];return St(p,a?r:this,d)}}(e,t,r,o);else var _=function(e,t,r){var n=1&t,i=Pi(e);return function t(){return(this&&this!==dt&&this instanceof t?i:e).apply(n?r:this,arguments)}}(e,t,r);return Ia((b?Qn:xa)(_,v),e,t)}function Wi(e,t,r,n){return e===i||qo(e,je[r])&&!Fe.call(n,r)?t:e}function Ki(e,t,r,n,a,o){return Jo(e)&&Jo(t)&&(o.set(t,e),qn(e,t,i,Ki,o),o.delete(t)),e}function Qi(e){return ns(e)?i:e}function Zi(e,t,r,n,a,o){var s=1&r,l=e.length,u=t.length;if(l!=u&&!(s&&u>l))return!1;var c=o.get(e),d=o.get(t);if(c&&d)return c==t&&d==e;var p=-1,f=!0,h=2&r?new Vr:i;for(o.set(e,t),o.set(t,e);++p<l;){var m=e[p],g=t[p];if(n)var y=s?n(g,m,p,t,e,o):n(m,g,p,e,t,o);if(y!==i){if(y)continue;f=!1;break}if(h){if(!Mt(t,(function(e,t){if(!Qt(h,t)&&(m===e||a(m,e,r,n,o)))return h.push(t)}))){f=!1;break}}else if(m!==g&&!a(m,g,r,n,o)){f=!1;break}}return o.delete(e),o.delete(t),f}function Ji(e){return Ca(Sa(e,i,Ga),e+"")}function ea(e){return wn(e,js,ua)}function ta(e){return wn(e,Rs,ca)}var ra=Or?function(e){return Or.get(e)}:sl;function na(e){for(var t=e.name+"",r=Cr[t],n=Fe.call(Cr,t)?r.length:0;n--;){var i=r[n],a=i.func;if(null==a||a==e)return i.name}return t}function ia(e){return(Fe.call(Lr,"placeholder")?Lr:e).placeholder}function aa(){var e=Lr.iteratee||nl;return e=e===nl?Fn:e,arguments.length?e(arguments[0],arguments[1]):e}function oa(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 sa(e){for(var t=js(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,Aa(i)]}return t}function la(e,t){var r=function(e,t){return null==e?i:e[t]}(e,t);return Dn(r)?r:i}var ua=mt?function(e){return null==e?[]:(e=Te(e),Ct(mt(e),(function(t){return He.call(e,t)})))}:hl,ca=mt?function(e){for(var t=[];e;)Dt(t,ua(e)),e=Ue(e);return t}:hl,da=Sn;function pa(e,t,r){for(var n=-1,i=(t=gi(t,e)).length,a=!1;++n<i;){var o=Ma(t[n]);if(!(a=null!=e&&r(e,o)))break;e=e[o]}return a||++n!=i?a:!!(i=null==e?0:e.length)&&Zo(i)&&ma(o,i)&&(Go(e)||Bo(e))}function fa(e){return"function"!=typeof e.constructor||_a(e)?{}:kr(Ue(e))}function ha(e){return Go(e)||Bo(e)||!!(Xe&&e&&e[Xe])}function ma(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 ga(e,t,r){if(!Jo(r))return!1;var n=typeof t;return!!("number"==n?Vo(r)&&ma(t,r.length):"string"==n&&t in r)&&qo(r[t],e)}function ya(e,t){if(Go(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 ba(e){var t=na(e),r=Lr[t];if("function"!=typeof r||!(t in zr.prototype))return!1;if(e===r)return!0;var n=ra(r);return!!n&&e===n[0]}(Ar&&da(new Ar(new ArrayBuffer(1)))!=D||wr&&da(new wr)!=w||Sr&&da(Sr.resolve())!=E||Tr&&da(new Tr)!=O||Er&&da(new Er)!=j)&&(da=function(e){var t=Sn(e),r=t==T?e.constructor:i,n=r?Na(r):"";if(n)switch(n){case Ir:return D;case jr:return w;case Rr:return E;case Dr:return O;case Fr:return j}return t});var va=Re?Ko:ml;function _a(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||je)}function Aa(e){return e==e&&!Jo(e)}function wa(e,t){return function(r){return null!=r&&r[e]===t&&(t!==i||e in Te(r))}}function Sa(e,t,r){return t=mr(t===i?e.length-1:t,0),function(){for(var i=arguments,a=-1,o=mr(i.length-t,0),s=n(o);++a<o;)s[a]=i[t+a];a=-1;for(var l=n(t+1);++a<t;)l[a]=i[a];return l[t]=r(s),St(e,this,l)}}function Ta(e,t){return t.length<2?e:An(e,ei(t,0,-1))}function Ea(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var xa=ja(Qn),Oa=ct||function(e,t){return dt.setTimeout(e,t)},Ca=ja(Zn);function Ia(e,t,r){var n=t+"";return Ca(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(ae,"{\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(oe);return t?t[1].split(se):[]}(n),r)))}function ja(e){var t=0,r=0;return function(){var n=yr(),a=16-(n-r);if(r=n,a>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function Ra(e,t){var r=-1,n=e.length,a=n-1;for(t=t===i?n:t;++r<t;){var o=Vn(r,a),s=e[o];e[o]=e[r],e[r]=s}return e.length=t,e}var Da,Fa,Pa=(Da=Fo((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===Fa.size&&Fa.clear(),e})),Fa=Da.cache,Da);function Ma(e){if("string"==typeof e||ss(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Na(e){if(null!=e){try{return De.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function La(e){if(e instanceof zr)return e.clone();var t=new $r(e.__wrapped__,e.__chain__);return t.__actions__=xi(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var ka=Yn((function(e,t){return Ho(e)?un(e,mn(t,1,Ho,!0)):[]})),qa=Yn((function(e,t){var r=Xa(t);return Ho(r)&&(r=i),Ho(e)?un(e,mn(t,1,Ho,!0),aa(r,2)):[]})),$a=Yn((function(e,t){var r=Xa(t);return Ho(r)&&(r=i),Ho(e)?un(e,mn(t,1,Ho,!0),i,r):[]}));function za(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,aa(t,3),i)}function Ba(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var a=n-1;return r!==i&&(a=fs(r),a=r<0?mr(n+a,0):gr(a,n-1)),kt(e,aa(t,3),a,!0)}function Ga(e){return null!=e&&e.length?mn(e,1):[]}function Ua(e){return e&&e.length?e[0]:i}var Va=Yn((function(e){var t=Rt(e,hi);return t.length&&t[0]===e[0]?On(t):[]})),Ha=Yn((function(e){var t=Xa(e),r=Rt(e,hi);return t===Xa(r)?t=i:r.pop(),r.length&&r[0]===e[0]?On(r,aa(t,2)):[]})),Ya=Yn((function(e){var t=Xa(e),r=Rt(e,hi);return(t="function"==typeof t?t:i)&&r.pop(),r.length&&r[0]===e[0]?On(r,i,t):[]}));function Xa(e){var t=null==e?0:e.length;return t?e[t-1]:i}var Wa=Yn(Ka);function Ka(e,t){return e&&e.length&&t&&t.length?Gn(e,t):e}var Qa=Ji((function(e,t){var r=null==e?0:e.length,n=nn(e,t);return Un(e,Rt(t,(function(e){return ma(e,r)?+e:e})).sort(Si)),n}));function Za(e){return null==e?e:_r.call(e)}var Ja=Yn((function(e){return si(mn(e,1,Ho,!0))})),eo=Yn((function(e){var t=Xa(e);return Ho(t)&&(t=i),si(mn(e,1,Ho,!0),aa(t,2))})),to=Yn((function(e){var t=Xa(e);return t="function"==typeof t?t:i,si(mn(e,1,Ho,!0),i,t)}));function ro(e){if(!e||!e.length)return[];var t=0;return e=Ct(e,(function(e){if(Ho(e))return t=mr(e.length,t),!0})),Yt(t,(function(t){return Rt(e,Gt(t))}))}function no(e,t){if(!e||!e.length)return[];var r=ro(e);return null==t?r:Rt(r,(function(e){return St(t,i,e)}))}var io=Yn((function(e,t){return Ho(e)?un(e,t):[]})),ao=Yn((function(e){return pi(Ct(e,Ho))})),oo=Yn((function(e){var t=Xa(e);return Ho(t)&&(t=i),pi(Ct(e,Ho),aa(t,2))})),so=Yn((function(e){var t=Xa(e);return t="function"==typeof t?t:i,pi(Ct(e,Ho),i,t)})),lo=Yn(ro),uo=Yn((function(e){var t=e.length,r=t>1?e[t-1]:i;return r="function"==typeof r?(e.pop(),r):i,no(e,r)}));function co(e){var t=Lr(e);return t.__chain__=!0,t}function po(e,t){return t(e)}var fo=Ji((function(e){var t=e.length,r=t?e[0]:0,n=this.__wrapped__,a=function(t){return nn(t,e)};return!(t>1||this.__actions__.length)&&n instanceof zr&&ma(r)?((n=n.slice(r,+r+(t?1:0))).__actions__.push({func:po,args:[a],thisArg:i}),new $r(n,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(a)})),ho=Ci((function(e,t,r){Fe.call(e,r)?++e[r]:rn(e,r,1)})),mo=Mi(za),go=Mi(Ba);function yo(e,t){return(Go(e)?Et:cn)(e,aa(t,3))}function bo(e,t){return(Go(e)?xt:dn)(e,aa(t,3))}var vo=Ci((function(e,t,r){Fe.call(e,r)?e[r].push(t):rn(e,r,[t])})),_o=Yn((function(e,t,r){var i=-1,a="function"==typeof t,o=Vo(e)?n(e.length):[];return cn(e,(function(e){o[++i]=a?St(t,e,r):Cn(e,t,r)})),o})),Ao=Ci((function(e,t,r){rn(e,r,t)}));function wo(e,t){return(Go(e)?Rt:Nn)(e,aa(t,3))}var So=Ci((function(e,t,r){e[r?0:1].push(t)}),(function(){return[[],[]]})),To=Yn((function(e,t){if(null==e)return[];var r=t.length;return r>1&&ga(e,t[0],t[1])?t=[]:r>2&&ga(t[0],t[1],t[2])&&(t=[t[0]]),zn(e,mn(t,1),[])})),Eo=ut||function(){return dt.Date.now()};function xo(e,t,r){return t=r?i:t,t=e&&null==t?e.length:t,Xi(e,u,i,i,i,i,t)}function Oo(e,t){var r;if("function"!=typeof t)throw new Oe(a);return e=fs(e),function(){return--e>0&&(r=t.apply(this,arguments)),e<=1&&(t=i),r}}var Co=Yn((function(e,t,r){var n=1;if(r.length){var i=or(r,ia(Co));n|=l}return Xi(e,n,t,r,i)})),Io=Yn((function(e,t,r){var n=3;if(r.length){var i=or(r,ia(Io));n|=l}return Xi(t,n,e,r,i)}));function jo(e,t,r){var n,o,s,l,u,c,d=0,p=!1,f=!1,h=!0;if("function"!=typeof e)throw new Oe(a);function m(t){var r=n,a=o;return n=o=i,d=t,l=e.apply(a,r)}function g(e){var r=e-c;return c===i||r>=t||r<0||f&&e-d>=s}function y(){var e=Eo();if(g(e))return b(e);u=Oa(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=o=i,l)}function v(){var e=Eo(),r=g(e);if(n=arguments,o=this,c=e,r){if(u===i)return function(e){return d=e,u=Oa(y,t),p?m(e):l}(c);if(f)return vi(u),u=Oa(y,t),m(c)}return u===i&&(u=Oa(y,t)),l}return t=ms(t)||0,Jo(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=o=u=i},v.flush=function(){return u===i?l:b(Eo())},v}var Ro=Yn((function(e,t){return ln(e,1,t)})),Do=Yn((function(e,t,r){return ln(e,ms(t)||0,r)}));function Fo(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new Oe(a);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],a=r.cache;if(a.has(i))return a.get(i);var o=e.apply(this,n);return r.cache=a.set(i,o)||a,o};return r.cache=new(Fo.Cache||Ur),r}function Po(e){if("function"!=typeof e)throw new Oe(a);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)}}Fo.Cache=Ur;var Mo=yi((function(e,t){var r=(t=1==t.length&&Go(t[0])?Rt(t[0],Wt(aa())):Rt(mn(t,1),Wt(aa()))).length;return Yn((function(n){for(var i=-1,a=gr(n.length,r);++i<a;)n[i]=t[i].call(this,n[i]);return St(e,this,n)}))})),No=Yn((function(e,t){var r=or(t,ia(No));return Xi(e,l,i,t,r)})),Lo=Yn((function(e,t){var r=or(t,ia(Lo));return Xi(e,64,i,t,r)})),ko=Ji((function(e,t){return Xi(e,256,i,i,i,t)}));function qo(e,t){return e===t||e!=e&&t!=t}var $o=Gi(Tn),zo=Gi((function(e,t){return e>=t})),Bo=In(function(){return arguments}())?In:function(e){return es(e)&&Fe.call(e,"callee")&&!He.call(e,"callee")},Go=n.isArray,Uo=yt?Wt(yt):function(e){return es(e)&&Sn(e)==R};function Vo(e){return null!=e&&Zo(e.length)&&!Ko(e)}function Ho(e){return es(e)&&Vo(e)}var Yo=gt||ml,Xo=bt?Wt(bt):function(e){return es(e)&&Sn(e)==b};function Wo(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 Ko(e){if(!Jo(e))return!1;var t=Sn(e);return t==_||t==A||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Qo(e){return"number"==typeof e&&e==fs(e)}function Zo(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=d}function Jo(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)&&da(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)==x},as=At?Wt(At):function(e){return es(e)&&da(e)==O};function os(e){return"string"==typeof e||!Go(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)&&Zo(e.length)&&!!it[Sn(e)]},us=Gi(Mn),cs=Gi((function(e,t){return e<=t}));function ds(e){if(!e)return[];if(Vo(e))return os(e)?cr(e):xi(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=da(e);return(t==w?ir:t==O?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?an(fs(e),0,f):0}function ms(e){if("number"==typeof e)return e;if(ss(e))return p;if(Jo(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Jo(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 Oi(e,Rs(e))}function ys(e){return null==e?"":oi(e)}var bs=Ii((function(e,t){if(_a(t)||Vo(t))Oi(t,js(t),e);else for(var r in t)Fe.call(t,r)&&Zr(e,r,t[r])})),vs=Ii((function(e,t){Oi(t,Rs(t),e)})),_s=Ii((function(e,t,r,n){Oi(t,Rs(t),e,n)})),As=Ii((function(e,t,r,n){Oi(t,js(t),e,n)})),ws=Ji(nn),Ss=Yn((function(e,t){e=Te(e);var r=-1,n=t.length,a=n>2?t[2]:i;for(a&&ga(t[0],t[1],a)&&(n=1);++r<n;)for(var o=t[r],s=Rs(o),l=-1,u=s.length;++l<u;){var c=s[l],d=e[c];(d===i||qo(d,je[c])&&!Fe.call(e,c))&&(e[c]=o[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 xs(e,t){return null!=e&&pa(e,t,xn)}var Os=ki((function(e,t,r){null!=t&&"function"!=typeof t.toString&&(t=Ne.call(t)),e[t]=r}),Js(rl)),Cs=ki((function(e,t,r){null!=t&&"function"!=typeof t.toString&&(t=Ne.call(t)),Fe.call(e,t)?e[t].push(r):e[t]=[r]}),aa),Is=Yn(Cn);function js(e){return Vo(e)?Yr(e):Pn(e)}function Rs(e){return Vo(e)?Yr(e,!0):function(e){if(!Jo(e))return function(e){var t=[];if(null!=e)for(var r in Te(e))t.push(r);return t}(e);var t=_a(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)})),Ps=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})),Oi(e,ta(e),r),n&&(r=on(r,7,Qi));for(var i=t.length;i--;)li(r,t[i]);return r})),Ms=Ji((function(e,t){return null==e?{}:function(e,t){return Bn(e,t,(function(t,r){return xs(e,r)}))}(e,t)}));function Ns(e,t){if(null==e)return{};var r=Rt(ta(e),(function(e){return[e]}));return t=aa(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 Wo(e)?e:new Ae(e)}})),Zs=Ji((function(e,t){return Et(t,(function(t){t=Ma(t),rn(e,t,Co(e[t],e))})),e}));function Js(e){return function(){return e}}var el=Ni(),tl=Ni(!0);function rl(e){return e}function nl(e){return Fn("function"==typeof e?e:on(e,1))}var il=Yn((function(e,t){return function(r){return Cn(r,e,t)}})),al=Yn((function(e,t){return function(r){return Cn(e,r,t)}}));function ol(e,t,r){var n=js(t),i=_n(t,n);null!=r||Jo(t)&&(i.length||!n.length)||(r=t,t=e,e=this,i=_n(t,js(t)));var a=!(Jo(r)&&"chain"in r&&!r.chain),o=Ko(e);return Et(i,(function(r){var n=t[r];e[r]=n,o&&(e.prototype[r]=function(){var t=this.__chain__;if(a||t){var r=e(this.__wrapped__);return(r.__actions__=xi(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(Ot),cl=$i(Mt);function dl(e){return ya(e)?Gt(Ma(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 Oe(a);return e=fs(e),function(){if(--e<1)return t.apply(this,arguments)}},Lr.ary=xo,Lr.assign=bs,Lr.assignIn=vs,Lr.assignInWith=_s,Lr.assignWith=As,Lr.at=ws,Lr.before=Oo,Lr.bind=Co,Lr.bindAll=Zs,Lr.bindKey=Io,Lr.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Go(e)?e:[e]},Lr.chain=co,Lr.chunk=function(e,t,r){t=(r?ga(e,t,r):t===i)?1:mr(fs(t),0);var a=null==e?0:e.length;if(!a||t<1)return[];for(var o=0,s=0,l=n(pt(a/t));o<a;)l[s++]=ei(e,o,o+=t);return l},Lr.compact=function(e){for(var t=-1,r=null==e?0:e.length,n=0,i=[];++t<r;){var a=e[t];a&&(i[n++]=a)}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(Go(r)?xi(r):[r],mn(t,1))},Lr.cond=function(e){var t=null==e?0:e.length,r=aa();return e=t?Rt(e,(function(e){if("function"!=typeof e[1])throw new Oe(a);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)}}(on(e,1))},Lr.constant=Js,Lr.countBy=ho,Lr.create=function(e,t){var r=kr(e);return null==t?r:tn(r,t)},Lr.curry=function e(t,r,n){var a=Xi(t,8,i,i,i,i,i,r=n?i:r);return a.placeholder=e.placeholder,a},Lr.curryRight=function e(t,r,n){var a=Xi(t,16,i,i,i,i,i,r=n?i:r);return a.placeholder=e.placeholder,a},Lr.debounce=jo,Lr.defaults=Ss,Lr.defaultsDeep=Ts,Lr.defer=Ro,Lr.delay=Do,Lr.difference=ka,Lr.differenceBy=qa,Lr.differenceWith=$a,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,aa(t,3),!0,!0):[]},Lr.dropWhile=function(e,t){return e&&e.length?ci(e,aa(t,3),!0):[]},Lr.fill=function(e,t,r,n){var a=null==e?0:e.length;return a?(r&&"number"!=typeof r&&ga(e,t,r)&&(r=0,n=a),function(e,t,r,n){var a=e.length;for((r=fs(r))<0&&(r=-r>a?0:a+r),(n=n===i||n>a?a:fs(n))<0&&(n+=a),n=r>n?0:hs(n);r<n;)e[r++]=t;return e}(e,t,r,n)):[]},Lr.filter=function(e,t){return(Go(e)?Ct:hn)(e,aa(t,3))},Lr.flatMap=function(e,t){return mn(wo(e,t),1)},Lr.flatMapDeep=function(e,t){return mn(wo(e,t),c)},Lr.flatMapDepth=function(e,t,r){return r=r===i?1:fs(r),mn(wo(e,t),r)},Lr.flatten=Ga,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=vo,Lr.initial=function(e){return null!=e&&e.length?ei(e,0,-1):[]},Lr.intersection=Va,Lr.intersectionBy=Ha,Lr.intersectionWith=Ya,Lr.invert=Os,Lr.invertBy=Cs,Lr.invokeMap=_o,Lr.iteratee=nl,Lr.keyBy=Ao,Lr.keys=js,Lr.keysIn=Rs,Lr.map=wo,Lr.mapKeys=function(e,t){var r={};return t=aa(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=aa(t,3),bn(e,(function(e,n,i){rn(r,n,t(e,n,i))})),r},Lr.matches=function(e){return Ln(on(e,1))},Lr.matchesProperty=function(e,t){return kn(e,on(t,1))},Lr.memoize=Fo,Lr.merge=Ds,Lr.mergeWith=Fs,Lr.method=il,Lr.methodOf=al,Lr.mixin=ol,Lr.negate=Po,Lr.nthArg=function(e){return e=fs(e),Yn((function(t){return $n(t,e)}))},Lr.omit=Ps,Lr.omitBy=function(e,t){return Ns(e,Po(aa(t)))},Lr.once=function(e){return Oo(2,e)},Lr.orderBy=function(e,t,r,n){return null==e?[]:(Go(t)||(t=null==t?[]:[t]),Go(r=n?i:r)||(r=null==r?[]:[r]),zn(e,t,r))},Lr.over=ll,Lr.overArgs=Mo,Lr.overEvery=ul,Lr.overSome=cl,Lr.partial=No,Lr.partialRight=Lo,Lr.partition=So,Lr.pick=Ms,Lr.pickBy=Ns,Lr.property=dl,Lr.propertyOf=function(e){return function(t){return null==e?i:An(e,t)}},Lr.pull=Wa,Lr.pullAll=Ka,Lr.pullAllBy=function(e,t,r){return e&&e.length&&t&&t.length?Gn(e,t,aa(r,2)):e},Lr.pullAllWith=function(e,t,r){return e&&e.length&&t&&t.length?Gn(e,t,i,r):e},Lr.pullAt=Qa,Lr.range=pl,Lr.rangeRight=fl,Lr.rearg=ko,Lr.reject=function(e,t){return(Go(e)?Ct:hn)(e,Po(aa(t,3)))},Lr.remove=function(e,t){var r=[];if(!e||!e.length)return r;var n=-1,i=[],a=e.length;for(t=aa(t,3);++n<a;){var o=e[n];t(o,n,e)&&(r.push(o),i.push(n))}return Un(e,i),r},Lr.rest=function(e,t){if("function"!=typeof e)throw new Oe(a);return Yn(e,t=t===i?t:fs(t))},Lr.reverse=Za,Lr.sampleSize=function(e,t,r){return t=(r?ga(e,t,r):t===i)?1:fs(t),(Go(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(Go(e)?Kr:Jn)(e)},Lr.slice=function(e,t,r){var n=null==e?0:e.length;return n?(r&&"number"!=typeof r&&ga(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=To,Lr.sortedUniq=function(e){return e&&e.length?ii(e):[]},Lr.sortedUniqBy=function(e,t){return e&&e.length?ii(e,aa(t,2)):[]},Lr.split=function(e,t,r){return r&&"number"!=typeof r&&ga(e,t,r)&&(t=r=i),(r=r===i?f:r>>>0)?(e=ys(e))&&("string"==typeof t||null!=t&&!is(t))&&!(t=oi(t))&&nr(e)?bi(cr(e),0,r):e.split(t,r):[]},Lr.spread=function(e,t){if("function"!=typeof e)throw new Oe(a);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,aa(t,3),!1,!0):[]},Lr.takeWhile=function(e,t){return e&&e.length?ci(e,aa(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 Oe(a);return Jo(r)&&(n="leading"in r?!!r.leading:n,i="trailing"in r?!!r.trailing:i),jo(e,t,{leading:n,maxWait:t,trailing:i})},Lr.thru=po,Lr.toArray=ds,Lr.toPairs=Ls,Lr.toPairsIn=ks,Lr.toPath=function(e){return Go(e)?Rt(e,Ma):ss(e)?[e]:xi(Pa(ys(e)))},Lr.toPlainObject=gs,Lr.transform=function(e,t,r){var n=Go(e),i=n||Yo(e)||ls(e);if(t=aa(t,4),null==r){var a=e&&e.constructor;r=i?n?new a:[]:Jo(e)&&Ko(a)?kr(Ue(e)):{}}return(i?Et:bn)(e,(function(e,n,i){return t(r,e,n,i)})),r},Lr.unary=function(e){return xo(e,1)},Lr.union=Ja,Lr.unionBy=eo,Lr.unionWith=to,Lr.uniq=function(e){return e&&e.length?si(e):[]},Lr.uniqBy=function(e,t){return e&&e.length?si(e,aa(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=ro,Lr.unzipWith=no,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=io,Lr.words=Ks,Lr.wrap=function(e,t){return No(mi(t),e)},Lr.xor=ao,Lr.xorBy=oo,Lr.xorWith=so,Lr.zip=lo,Lr.zipObject=function(e,t){return fi(e||[],t||[],Zr)},Lr.zipObjectDeep=function(e,t){return fi(e||[],t||[],Kn)},Lr.zipWith=uo,Lr.entries=Ls,Lr.entriesIn=ks,Lr.extend=vs,Lr.extendWith=_s,ol(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),an(ms(e),t,r)},Lr.clone=function(e){return on(e,4)},Lr.cloneDeep=function(e){return on(e,5)},Lr.cloneDeepWith=function(e,t){return on(e,5,t="function"==typeof t?t:i)},Lr.cloneWith=function(e,t){return on(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=oi(t);var n=e.length,a=r=r===i?n:an(fs(r),0,n);return(r-=t.length)>=0&&e.slice(r,a)==t},Lr.eq=qo,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=Go(e)?Ot:pn;return r&&ga(e,t,r)&&(t=i),n(e,aa(t,3))},Lr.find=mo,Lr.findIndex=za,Lr.findKey=function(e,t){return Lt(e,aa(t,3),bn)},Lr.findLast=go,Lr.findLastIndex=Ba,Lr.findLastKey=function(e,t){return Lt(e,aa(t,3),vn)},Lr.floor=_l,Lr.forEach=yo,Lr.forEachRight=bo,Lr.forIn=function(e,t){return null==e?e:gn(e,aa(t,3),Rs)},Lr.forInRight=function(e,t){return null==e?e:yn(e,aa(t,3),Rs)},Lr.forOwn=function(e,t){return e&&bn(e,aa(t,3))},Lr.forOwnRight=function(e,t){return e&&vn(e,aa(t,3))},Lr.get=Es,Lr.gt=$o,Lr.gte=zo,Lr.has=function(e,t){return null!=e&&pa(e,t,En)},Lr.hasIn=xs,Lr.head=Ua,Lr.identity=rl,Lr.includes=function(e,t,r,n){e=Vo(e)?e:qs(e),r=r&&!n?fs(r):0;var i=e.length;return r<0&&(r=mr(i+r,0)),os(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=Bo,Lr.isArray=Go,Lr.isArrayBuffer=Uo,Lr.isArrayLike=Vo,Lr.isArrayLikeObject=Ho,Lr.isBoolean=function(e){return!0===e||!1===e||es(e)&&Sn(e)==y},Lr.isBuffer=Yo,Lr.isDate=Xo,Lr.isElement=function(e){return es(e)&&1===e.nodeType&&!ns(e)},Lr.isEmpty=function(e){if(null==e)return!0;if(Vo(e)&&(Go(e)||"string"==typeof e||"function"==typeof e.splice||Yo(e)||ls(e)||Bo(e)))return!e.length;var t=da(e);if(t==w||t==O)return!e.size;if(_a(e))return!Pn(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=Wo,Lr.isFinite=function(e){return"number"==typeof e&&Nt(e)},Lr.isFunction=Ko,Lr.isInteger=Qo,Lr.isLength=Zo,Lr.isMap=ts,Lr.isMatch=function(e,t){return e===t||Rn(e,t,sa(t))},Lr.isMatchWith=function(e,t,r){return r="function"==typeof r?r:i,Rn(e,t,sa(t),r)},Lr.isNaN=function(e){return rs(e)&&e!=+e},Lr.isNative=function(e){if(va(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=Jo,Lr.isObjectLike=es,Lr.isPlainObject=ns,Lr.isRegExp=is,Lr.isSafeInteger=function(e){return Qo(e)&&e>=-9007199254740991&&e<=d},Lr.isSet=as,Lr.isString=os,Lr.isSymbol=ss,Lr.isTypedArray=ls,Lr.isUndefined=function(e){return e===i},Lr.isWeakMap=function(e){return es(e)&&da(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=Xa,Lr.lastIndexOf=function(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var a=n;return r!==i&&(a=(a=fs(r))<0?mr(n+a,0):gr(a,n-1)),t==t?function(e,t,r){for(var n=r+1;n--;)if(e[n]===t)return n;return n}(e,t,a):kt(e,zt,a,!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,aa(t,2),Tn):i},Lr.mean=function(e){return Bt(e,rl)},Lr.meanBy=function(e,t){return Bt(e,aa(t,2))},Lr.min=function(e){return e&&e.length?fn(e,rl,Mn):i},Lr.minBy=function(e,t){return e&&e.length?fn(e,aa(t,2),Mn):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=Eo,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&&ga(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 a=vr();return gr(e+a*(t-e+st("1e-"+((a+"").length-1))),t)}return Vn(e,t)},Lr.reduce=function(e,t,r){var n=Go(e)?Ft:Vt,i=arguments.length<3;return n(e,aa(t,4),r,i,cn)},Lr.reduceRight=function(e,t,r){var n=Go(e)?Pt:Vt,i=arguments.length<3;return n(e,aa(t,4),r,i,dn)},Lr.repeat=function(e,t,r){return t=(r?ga(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,a=(t=gi(t,e)).length;for(a||(a=1,e=i);++n<a;){var o=null==e?i:e[Ma(t[n])];o===i&&(n=a,o=r),e=Ko(o)?o.call(e):o}return e},Lr.round=wl,Lr.runInContext=e,Lr.sample=function(e){return(Go(e)?Xr:Xn)(e)},Lr.size=function(e){if(null==e)return 0;if(Vo(e))return os(e)?ur(e):e.length;var t=da(e);return t==w||t==O?e.size:Pn(e).length},Lr.snakeCase=Hs,Lr.some=function(e,t,r){var n=Go(e)?Mt:ti;return r&&ga(e,t,r)&&(t=i),n(e,aa(t,3))},Lr.sortedIndex=function(e,t){return ri(e,t)},Lr.sortedIndexBy=function(e,t,r){return ni(e,t,aa(r,2))},Lr.sortedIndexOf=function(e,t){var r=null==e?0:e.length;if(r){var n=ri(e,t);if(n<r&&qo(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,aa(r,2),!0)},Lr.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var r=ri(e,t,!0)-1;if(qo(e[r],t))return r}return-1},Lr.startCase=Ys,Lr.startsWith=function(e,t,r){return e=ys(e),r=null==r?0:an(fs(r),0,e.length),t=oi(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,aa(t,2)):0},Lr.template=function(e,t,r){var n=Lr.templateSettings;r&&ga(e,t,r)&&(t=i),e=ys(e),t=_s({},t,n,Wi);var a,o,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&&(a=!0,p+="' +\n__e("+r+") +\n'"),s&&(o=!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=(o?p.replace(B,""):p).replace(G,"$1").replace(U,"$1;"),p="function("+(m||"obj")+") {\n"+(m?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(a?", __e = _.escape":"")+(o?", __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,Wo(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=aa(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?an(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=oi(t)))return e;var n=cr(e),a=cr(t);return bi(n,Zt(n,a),Jt(n,a)+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=oi(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=oi(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(Jo(t)){var a="separator"in t?t.separator:a;r="length"in t?fs(t.length):r,n="omission"in t?oi(t.omission):n}var o=(e=ys(e)).length;if(nr(e)){var s=cr(e);o=s.length}if(r>=o)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(a===i)return u+n;if(s&&(l+=u.length-l),is(a)){if(e.slice(l).search(a)){var c,d=u;for(a.global||(a=Ee(a.source,ys(pe.exec(a))+"g")),a.lastIndex=0;c=a.exec(d);)var p=c.index;u=u.slice(0,p===i?l:p)}}else if(e.indexOf(oi(a),l)!=l){var f=u.lastIndexOf(a);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=++Pe;return ys(e)+t},Lr.upperCase=Xs,Lr.upperFirst=Ws,Lr.each=yo,Lr.eachRight=bo,Lr.first=Ua,ol(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:aa(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(Po(aa(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),a=Lr[n?"take"+("last"==t?"Right":""):t],o=n||/^find/.test(t);a&&(Lr.prototype[t]=function(){var t=this.__wrapped__,s=n?[1]:arguments,l=t instanceof zr,u=s[0],c=l||Go(t),d=function(e){var t=a.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=o&&!p,m=l&&!f;if(!o&&c){t=m?t:new zr(this);var g=e.apply(t,s);return g.__actions__.push({func:po,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(Go(i)?i:[],e)}return this[r]((function(r){return t.apply(Go(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__=xi(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=xi(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=xi(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=Go(e),n=t<0,i=r?e.length:0,a=function(e,t,r){for(var n=-1,i=r.length;++n<i;){var a=r[n],o=a.size;switch(a.type){case"drop":e+=o;break;case"dropRight":t-=o;break;case"take":t=gr(t,e+o);break;case"takeRight":e=mr(e,t-o)}}return{start:e,end:t}}(0,i,this.__views__),o=a.start,s=a.end,l=s-o,u=n?s:o-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=fo,Lr.prototype.chain=function(){return co(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=La(r);n.__index__=0,n.__values__=i,t?a.__wrapped__=n:t=n;var a=n;r=r.__wrapped__}return a.__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:po,args:[Za],thisArg:i}),new $r(t,this.__chain__)}return this.thru(Za)},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 a=!0,o=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return i(r)&&(a="leading"in r?!!r.leading:a,o="trailing"in r?!!r.trailing:o),n(e,t,{leading:a,maxWait:t,trailing:o})}},6131:(e,t,r)=>{var n=r(6403),i=r(1580),a=r(1187),o=/^[-+]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(a(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):o.test(e)?NaN:+e}},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}),a=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)},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.Errors=void 0,a(r(2890),t),a(r(5512),t),a(r(7855),t),a(r(4640),t),a(r(9800),t),a(r(1171),t),a(r(7783),t),a(r(7807),t),a(r(2474),t),t.Errors=o(r(9979))},3806:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(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(o,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 a=i(r(288)),o=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=o.Monitor.timeRequest(e.method,c,a.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&&s.VizzlyApiClientLogger.debug(`[TRACING] QE; ${h} - API; ${m}`),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,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(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(o,s)}l((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.DashboardManager=void 0;const i=r(5250),a=r(4968),o=r(7783);class s{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,s;const l=this.vizzly.getDashboardRepository(),u=this.vizzly.getGlobalLibraryRepository(),[{global_libraries:c,permissions:d},{dashboards:p,permissions:f}]=yield Promise.all([u.fetchGlobalLibraries(e),l.fetchDashboards(e)]),h=p.find((t=>t.id===e.dashboardId));if(!h)throw new Error("Cannot find dashboard to update.");const{parentGlobalLibraries:m,childGlobalLibraries:g}=a.GlobalLibraryRepository.splitParentAndChildGlobalLibraries(c),y=f.find((t=>"read_write"===t.scope&&t.dashboardId===e.dashboardId));if(!y)throw new Error("Failed to find update token for dashboard.");const b=yield l.updateDashboard(Object.assign(Object.assign({},e),{dashboardPermission:y}));let v=[];(null===(t=e.definition)||void 0===t?void 0:t.componentLibrary)&&(v=(0,i.cloneDeep)(e.definition.componentLibrary||[]).filter((e=>!(null!==h.parent_dashboard_id&&e.attributes.protectedByOrganisation))));const _=null===h.parent_dashboard_id?m:g,A=null===h.parent_dashboard_id,w=v.length>0||!!(null===(r=e.definition)||void 0===r?void 0:r.customFields),S=c.find((e=>null===e.parent_global_library_id));!A&&S&&w&&0===_.length&&(yield u.createGlobalLibrary({library:{views:v,customFields:(null===(s=e.definition)||void 0===s?void 0:s.customFields)||{}},parentGlobalLibraryId:S.id,permissions:[{scope:"read_write"}]}));const T=_.map((t=>n(this,void 0,void 0,(function*(){var r;const n=d.find((e=>e.globalLibraryId===t.id&&"read_write"===e.scope));n||o.VizzlyApiClientLogger.error("No write permission found."),n&&(yield u.updateGlobalLibrary({globalLibrarySessionToken:n.token,library:{views:v,customFields:(null===(r=e.definition)||void 0===r?void 0:r.customFields)||{}}}))}))));return yield Promise.all(T),b}))}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 s.mergeDashboardsAndGlobalLibraries(n,i)}))}static mergeDashboardsAndGlobalLibraries(e,t){return(0,i.cloneDeep)(e).map((r=>{let n=(0,i.cloneDeep)(r.definition.componentLibrary),o=null===r.parent_dashboard_id?[]:e.find((e=>e.id===r.parent_dashboard_id)).definition.componentLibrary,{parentGlobalLibraries:l,childGlobalLibraries:u}=a.GlobalLibraryRepository.splitParentAndChildGlobalLibraries(t);u=null===r.parent_dashboard_id?[]:u;let c=(0,i.uniqBy)([...s.markViewsAsProtected(l.flatMap((e=>e.library.views||[]))),...u.flatMap((e=>e.library.views||[])),...s.markViewsAsProtected(o),...null===r.parent_dashboard_id?s.markViewsAsProtected(n):n||[]],(e=>e.attributes.viewId));return r.definition.componentLibrary=c,r.definition.customFields=s.mergeCustomFields(r,e,l,u),r}))}static mergeCustomFields(e,t,r,n){var a;const o=null===e.parent_dashboard_id?{}:(null===(a=t.find((t=>t.id===e.parent_dashboard_id)))||void 0===a?void 0:a.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)(o)||{},...(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=s},178:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(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(o,s)}l((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.DashboardRepository=void 0;const i=r(6537),a=r(2315),o=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 new a.FailedToCreateDashboard(`Failed to create the dashboard from POST /api/v2/dashboard. Got ${t.status}`);throw new a.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 o.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,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(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(o,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,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(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(o,s)}l((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.GlobalLibraryRepository=void 0;const i=r(5250),a=r(2975),o=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 o.FailedToFetchGlobalLibraryAccessTokens("Failed to load access tokens for the global library.");{const e=r.body.permissions.map(a.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,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(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(o,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(...a){return n(this,void 0,void 0,(function*(){const n=performance.now(),o=yield r(...a),s=performance.now()-n;return i.VizzlyApiClientLogger.debug(`[@vizzly/api-client timing] ${e.toUpperCase()} ${t} - ${s.toFixed(2)}ms`),o}))}}}},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),a=r.baseIsValid(e)?"":"/";return""==n&&""==i?"/":""==i?`${a}${n}`:""!=n&&""!=i?`${a}${n}/${i}`:`${a}${i}`}static addQueryParam(e,t,r){const[n,i]=e.split("#"),[a,o]=n.split("?");var s=new URLSearchParams(o);return s.set(t,r),a+"?"+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("."),a=Buffer.from(n,"base64").toString("utf-8"),o=JSON.parse(a).exp;return!(o<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),a=r(4968),o=r(8607),s=r(5465);t.Vizzly=class{constructor(e,t){this.APIs=e,this.implementationStrategy=t,this.dashboardManager=new o.DashboardManager(this),this.dashboardRepository=new i.DashboardRepository(this),this.globalLibraryRepository=new a.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,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(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(o,s)}l((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.VizzlyApi=void 0;const i=r(3806),a=r(9979),o=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 a.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 a.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 a.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","appSessionToken"]}}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 a.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 a.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 o.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,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(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(o,s)}l((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.VizzlyAppApi=void 0;const i=r(3806);class a 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=a},4640:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(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(o,s)}l((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.VizzlyQueryEngineApi=void 0;const i=r(3806),a=r(6081),o=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 a.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 o.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","array_does_not_contain"]),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[]"]},array_does_not_contain:{publicName:"Does not contain",validDataTypes:["string[]"]},array_contains_any_of:{publicName:"Contains any of",validDataTypes:["string[]"]},array_contains_all_of:{publicName:"Contains all of",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}),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.getQueryEngineConfig=void 0;const o=a(r(3543)),s=a(r(5133)),l=a(r(9450)),u=a(r(1047)),c=a(r(8590)),d=a(r(5226)),p=a(r(9488)),f=r(1594);t.getQueryEngineConfig=e=>{switch(e){case"js":return f.localQueryEngineConfig;case"postgres":return o.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}),a=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)},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.Support=t.Constants=void 0,a(r(6676),t),a(r(4002),t),t.Constants=o(r(9667)),t.Support=o(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","array_does_not_contain"]),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],a=t[r];if("object"==typeof i&&"object"==typeof a){const e=(0,n.intersection)(Object.keys(i),Object.keys(a));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","array_does_not_contain"]),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","array_does_not_contain"]),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","array_does_not_contain"]),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","array_does_not_contain","array_contains_any_of","array_contains_all_of"]),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),a={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)(a);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 a=r&&r.length>0?r.filter((e=>i.includes(e))):i;return r&&r.length>0&&0===a.length&&(a=i),a},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 a=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:a("mysql"),snowflake:a("snowflake"),postgres:a("postgres"),redshift:a("redshift"),mariadb:a("mariadb"),bigquery:a("bigquery"),microsoftSQLServer:a("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._sqlDataSetSchema=t._fieldSchema=t.ID_REGEX_ERROR_MESSAGE=t.ALLOWED_ID_REGEX=void 0;const i=n(r(4579)),a=r(6676),o=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};t._fieldSchema=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(o.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,o.vizzlyToPossibleNativeDataTypes)(e,"string")),then:i.default.array().items(i.default.string().valid(...(0,s.validOperatorsForField)({dataType:"string"},(0,a.getQueryEngineConfig)(e)))).description("For fields that have a string data type.")}).conditional("..dataType",{is:i.default.string().valid(...(0,o.vizzlyToPossibleNativeDataTypes)(e,"number")),then:i.default.array().items(i.default.string().valid(...(0,s.validOperatorsForField)({dataType:"number"},(0,a.getQueryEngineConfig)(e)))).description("For fields that have a number data type.")}).conditional("..dataType",{is:i.default.string().valid(...(0,o.vizzlyToPossibleNativeDataTypes)(e,"date_time")),then:i.default.array().items(i.default.valid(...(0,s.validOperatorsForField)({dataType:"date_time"},(0,a.getQueryEngineConfig)(e)))).description("For fields that have a date time data type.")}).conditional("..dataType",{is:i.default.string().valid(...(0,o.vizzlyToPossibleNativeDataTypes)(e,"boolean")),then:i.default.array().items(i.default.string().valid(...(0,s.validOperatorsForField)({dataType:"boolean"},(0,a.getQueryEngineConfig)(e)))).description("For fields that have a boolean data type.")}).conditional("..dataType",{is:i.default.string().valid(...(0,o.vizzlyToPossibleNativeDataTypes)(e,"string[]")),then:i.default.array().items(i.default.string().valid(...(0,s.validOperatorsForField)({dataType:"string[]"},(0,a.getQueryEngineConfig)(e)))).description("For fields that have a string array data type.")}).optional()});const m=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(),as:i.default.string().optional()}),g=i.default.object({fieldId:i.default.string().required(),op:i.default.string().valid(...d).required()});t._sqlDataSetSchema=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(g).optional()}))(e)),{joins:i.default.array().items(m).unique(((e,t)=>{const r=JSON.stringify(e.right)===JSON.stringify(t.right);return!e.as&&!t.as&&r})).message("A table cannot be referenced in a right join multiple times.").optional()}));const y=e=>{var r;if(1===(null===(r=e.onlyClients)||void 0===r?void 0:r.length))return(0,t._sqlDataSetSchema)((0,t._fieldSchema)(e.onlyClients[0]));const n=i.default.alternatives(...(e.onlyClients||o.SUPPORTED_CLIENTS).map((e=>(0,t._sqlDataSetSchema)((0,t._fieldSchema)(e)))));if(e.dataSetIdToClientMapping){const r=Object.entries(e.dataSetIdToClientMapping).map((([e,r])=>({is:e,then:(0,t._sqlDataSetSchema)((0,t._fieldSchema)(r))})));return i.default.alternatives().conditional(".id",[...r,{is:!0,then:n}])}return n};t.default=(e,r={})=>{const n=((e,r)=>i.default.object({version:i.default.number(),connections:i.default.object().pattern(i.default.string(),i.default.object({client:i.default.string().allow(...o.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(r.checkConnectionSpecificDataSets?i.default.object().custom((r=>{var n,i;const a=r.connectionId||"___vizzly_default_conn",o=null===(i=null===(n=null==e?void 0:e.connections)||void 0===n?void 0:n[a])||void 0===i?void 0:i.client;if(!o)throw new u.DataSetNotLinkedToConnection(r.id);const s=(0,t._sqlDataSetSchema)((0,t._fieldSchema)(o)).validate(r,h);if(s.error)throw s.error;return r}),"Data sets linked to connections"):y(r)).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),r),{dataSetIdToClientMapping:b(e)})).validate(e,h);return n.error&&n.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 --")})),n};const b=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 a=r.connectionId||"___vizzly_default_conn",o=null===(i=null===(n=null==e?void 0:e.connections)||void 0===n?void 0:n[a])||void 0===i?void 0:i.client;o&&(t[r.id]=o)}})),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},630:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ianaTimeZonesDb=void 0,t.ianaTimeZonesDb=["Africa/Abidjan","Africa/Accra","Africa/Addis_Ababa","Africa/Algiers","Africa/Asmera","Africa/Bamako","Africa/Bangui","Africa/Banjul","Africa/Bissau","Africa/Blantyre","Africa/Brazzaville","Africa/Bujumbura","Africa/Cairo","Africa/Casablanca","Africa/Ceuta","Africa/Conakry","Africa/Dakar","Africa/Dar_es_Salaam","Africa/Djibouti","Africa/Douala","Africa/El_Aaiun","Africa/Freetown","Africa/Gaborone","Africa/Harare","Africa/Johannesburg","Africa/Juba","Africa/Kampala","Africa/Khartoum","Africa/Kigali","Africa/Kinshasa","Africa/Lagos","Africa/Libreville","Africa/Lome","Africa/Luanda","Africa/Lubumbashi","Africa/Lusaka","Africa/Malabo","Africa/Maputo","Africa/Maseru","Africa/Mbabane","Africa/Mogadishu","Africa/Monrovia","Africa/Nairobi","Africa/Ndjamena","Africa/Niamey","Africa/Nouakchott","Africa/Ouagadougou","Africa/Porto-Novo","Africa/Sao_Tome","Africa/Tripoli","Africa/Tunis","Africa/Windhoek","America/Adak","America/Anchorage","America/Anguilla","America/Antigua","America/Araguaina","America/Argentina/La_Rioja","America/Argentina/Rio_Gallegos","America/Argentina/Salta","America/Argentina/San_Juan","America/Argentina/San_Luis","America/Argentina/Tucuman","America/Argentina/Ushuaia","America/Aruba","America/Asuncion","America/Bahia","America/Bahia_Banderas","America/Barbados","America/Belem","America/Belize","America/Blanc-Sablon","America/Boa_Vista","America/Bogota","America/Boise","America/Buenos_Aires","America/Cambridge_Bay","America/Campo_Grande","America/Cancun","America/Caracas","America/Catamarca","America/Cayenne","America/Cayman","America/Chicago","America/Chihuahua","America/Ciudad_Juarez","America/Coral_Harbour","America/Cordoba","America/Costa_Rica","America/Creston","America/Cuiaba","America/Curacao","America/Danmarkshavn","America/Dawson","America/Dawson_Creek","America/Denver","America/Detroit","America/Dominica","America/Edmonton","America/Eirunepe","America/El_Salvador","America/Fort_Nelson","America/Fortaleza","America/Glace_Bay","America/Godthab","America/Goose_Bay","America/Grand_Turk","America/Grenada","America/Guadeloupe","America/Guatemala","America/Guayaquil","America/Guyana","America/Halifax","America/Havana","America/Hermosillo","America/Indiana/Knox","America/Indiana/Marengo","America/Indiana/Petersburg","America/Indiana/Tell_City","America/Indiana/Vevay","America/Indiana/Vincennes","America/Indiana/Winamac","America/Indianapolis","America/Inuvik","America/Iqaluit","America/Jamaica","America/Jujuy","America/Juneau","America/Kentucky/Monticello","America/Kralendijk","America/La_Paz","America/Lima","America/Los_Angeles","America/Louisville","America/Lower_Princes","America/Maceio","America/Managua","America/Manaus","America/Marigot","America/Martinique","America/Matamoros","America/Mazatlan","America/Mendoza","America/Menominee","America/Merida","America/Metlakatla","America/Mexico_City","America/Miquelon","America/Moncton","America/Monterrey","America/Montevideo","America/Montserrat","America/Nassau","America/New_York","America/Nome","America/Noronha","America/North_Dakota/Beulah","America/North_Dakota/Center","America/North_Dakota/New_Salem","America/Ojinaga","America/Panama","America/Paramaribo","America/Phoenix","America/Port-au-Prince","America/Port_of_Spain","America/Porto_Velho","America/Puerto_Rico","America/Punta_Arenas","America/Rankin_Inlet","America/Recife","America/Regina","America/Resolute","America/Rio_Branco","America/Santarem","America/Santiago","America/Santo_Domingo","America/Sao_Paulo","America/Scoresbysund","America/Sitka","America/St_Barthelemy","America/St_Johns","America/St_Kitts","America/St_Lucia","America/St_Thomas","America/St_Vincent","America/Swift_Current","America/Tegucigalpa","America/Thule","America/Tijuana","America/Toronto","America/Tortola","America/Vancouver","America/Whitehorse","America/Winnipeg","America/Yakutat","Antarctica/Casey","Antarctica/Davis","Antarctica/DumontDUrville","Antarctica/Macquarie","Antarctica/Mawson","Antarctica/McMurdo","Antarctica/Palmer","Antarctica/Rothera","Antarctica/Syowa","Antarctica/Troll","Antarctica/Vostok","Arctic/Longyearbyen","Asia/Aden","Asia/Almaty","Asia/Amman","Asia/Anadyr","Asia/Aqtau","Asia/Aqtobe","Asia/Ashgabat","Asia/Atyrau","Asia/Baghdad","Asia/Bahrain","Asia/Baku","Asia/Bangkok","Asia/Barnaul","Asia/Beirut","Asia/Bishkek","Asia/Brunei","Asia/Calcutta","Asia/Chita","Asia/Choibalsan","Asia/Colombo","Asia/Damascus","Asia/Dhaka","Asia/Dili","Asia/Dubai","Asia/Dushanbe","Asia/Famagusta","Asia/Gaza","Asia/Hebron","Asia/Hong_Kong","Asia/Hovd","Asia/Irkutsk","Asia/Jakarta","Asia/Jayapura","Asia/Jerusalem","Asia/Kabul","Asia/Kamchatka","Asia/Karachi","Asia/Katmandu","Asia/Khandyga","Asia/Krasnoyarsk","Asia/Kuala_Lumpur","Asia/Kuching","Asia/Kuwait","Asia/Macau","Asia/Magadan","Asia/Makassar","Asia/Manila","Asia/Muscat","Asia/Nicosia","Asia/Novokuznetsk","Asia/Novosibirsk","Asia/Omsk","Asia/Oral","Asia/Phnom_Penh","Asia/Pontianak","Asia/Pyongyang","Asia/Qatar","Asia/Qostanay","Asia/Qyzylorda","Asia/Rangoon","Asia/Riyadh","Asia/Saigon","Asia/Sakhalin","Asia/Samarkand","Asia/Seoul","Asia/Shanghai","Asia/Singapore","Asia/Srednekolymsk","Asia/Taipei","Asia/Tashkent","Asia/Tbilisi","Asia/Tehran","Asia/Thimphu","Asia/Tokyo","Asia/Tomsk","Asia/Ulaanbaatar","Asia/Urumqi","Asia/Ust-Nera","Asia/Vientiane","Asia/Vladivostok","Asia/Yakutsk","Asia/Yekaterinburg","Asia/Yerevan","Atlantic/Azores","Atlantic/Bermuda","Atlantic/Canary","Atlantic/Cape_Verde","Atlantic/Faeroe","Atlantic/Madeira","Atlantic/Reykjavik","Atlantic/South_Georgia","Atlantic/St_Helena","Atlantic/Stanley","Australia/Adelaide","Australia/Brisbane","Australia/Broken_Hill","Australia/Darwin","Australia/Eucla","Australia/Hobart","Australia/Lindeman","Australia/Lord_Howe","Australia/Melbourne","Australia/Perth","Australia/Sydney","Europe/Amsterdam","Europe/Andorra","Europe/Astrakhan","Europe/Athens","Europe/Belgrade","Europe/Berlin","Europe/Bratislava","Europe/Brussels","Europe/Bucharest","Europe/Budapest","Europe/Busingen","Europe/Chisinau","Europe/Copenhagen","Europe/Dublin","Europe/Gibraltar","Europe/Guernsey","Europe/Helsinki","Europe/Isle_of_Man","Europe/Istanbul","Europe/Jersey","Europe/Kaliningrad","Europe/Kiev","Europe/Kirov","Europe/Lisbon","Europe/Ljubljana","Europe/London","Europe/Luxembourg","Europe/Madrid","Europe/Malta","Europe/Mariehamn","Europe/Minsk","Europe/Monaco","Europe/Moscow","Europe/Oslo","Europe/Paris","Europe/Podgorica","Europe/Prague","Europe/Riga","Europe/Rome","Europe/Samara","Europe/San_Marino","Europe/Sarajevo","Europe/Saratov","Europe/Simferopol","Europe/Skopje","Europe/Sofia","Europe/Stockholm","Europe/Tallinn","Europe/Tirane","Europe/Ulyanovsk","Europe/Vaduz","Europe/Vatican","Europe/Vienna","Europe/Vilnius","Europe/Volgograd","Europe/Warsaw","Europe/Zagreb","Europe/Zurich","Indian/Antananarivo","Indian/Chagos","Indian/Christmas","Indian/Cocos","Indian/Comoro","Indian/Kerguelen","Indian/Mahe","Indian/Maldives","Indian/Mauritius","Indian/Mayotte","Indian/Reunion","Pacific/Apia","Pacific/Auckland","Pacific/Bougainville","Pacific/Chatham","Pacific/Easter","Pacific/Efate","Pacific/Enderbury","Pacific/Fakaofo","Pacific/Fiji","Pacific/Funafuti","Pacific/Galapagos","Pacific/Gambier","Pacific/Guadalcanal","Pacific/Guam","Pacific/Honolulu","Pacific/Kiritimati","Pacific/Kosrae","Pacific/Kwajalein","Pacific/Majuro","Pacific/Marquesas","Pacific/Midway","Pacific/Nauru","Pacific/Niue","Pacific/Norfolk","Pacific/Noumea","Pacific/Pago_Pago","Pacific/Palau","Pacific/Pitcairn","Pacific/Ponape","Pacific/Port_Moresby","Pacific/Rarotonga","Pacific/Saipan","Pacific/Tahiti","Pacific/Tarawa","Pacific/Tongatapu","Pacific/Truk","Pacific/Wake","Pacific/Wallis"]},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}),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},o=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=a(r(8162)),t.VizzlyConfig=a(r(3342)),o(r(7076),t),o(r(2069),t)},2069:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ianaTimeZones=t.ETC_UTC_TIME_ZONE=void 0,t.ETC_UTC_TIME_ZONE="Etc/UTC";const n=r(630);t.ianaTimeZones=()=>[t.ETC_UTC_TIME_ZONE,...n.ianaTimeZonesDb]},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 a=i[n];r["[object "+a+"]"]=a.toLowerCase()}var o=function(e){return r[Object.prototype.toString.call(e)]||"object"},s=o,l=o,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:o,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 a=0,o=m.autodetect;a<o.length;a+=1){var s=o[a];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],a=r[2],o=1-A(n/=255,A(i/=255,a/=255)),s=o<1?1/(1-o):0;return[(1-n-o)*s,(1-i-o)*s,(1-a-o)*s,o]},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],a=e[3],o=e.length>4?e[4]:1;return 1===a?[0,0,0,o]:[r>=1?0:255*(1-r)*(1-a),n>=1?0:255*(1-n)*(1-a),i>=1?0:255*(1-i)*(1-a),o]},E=v,x=y,O=d,C=c.unpack,I=c.type,j=w;x.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(x,[null].concat(e,["cmyk"])))},O.format.cmyk=T,O.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},P=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(",")+")"},M=c.unpack,N=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var r=(e=M(e,"rgba"))[0],n=e[1],i=e[2];r/=255,n/=255,i/=255;var a,o,s=Math.min(r,n,i),l=Math.max(r,n,i),u=(l+s)/2;return l===s?(a=0,o=Number.NaN):a=u<.5?(l-s)/(l+s):(l-s)/(2-l-s),r==l?o=(n-i)/(l-s):n==l?o=2+(i-r)/(l-s):i==l&&(o=4+(r-n)/(l-s)),(o*=60)<0&&(o+=360),e.length>3&&void 0!==e[3]?[o,a,u,e[3]]:[o,a,u]},L=c.unpack,k=c.last,q=P,$=N,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,a,o=(t=G(t,"hsl"))[0],s=t[1],l=t[2];if(0===s)n=i=a=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=o/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],a=e[2]}return t.length>3?[n,i,a,t[3]]:[n,i,a,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),a=0;a<4;a++)i[a]=+i[a];return i}if(t=e.match(K)){for(var o=t.slice(1,4),s=0;s<3;s++)o[s]=ee(2.55*o[s]);return o[3]=1,o}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,ae=c.type,oe=B,se=te;ne.prototype.css=function(e){return oe(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"===ae(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],a=n[1],o=n[2],s=Math.min(i,a,o),l=Math.max(i,a,o),u=l-s,c=100*u/255,d=s/(255-u)*100;return 0===u?r=Number.NaN:(i===l&&(r=(a-o)/u),a===l&&(r=2+(o-i)/u),o===l&&(r=4+(i-a)/u),(r*=60)<0&&(r+=360)),[r,c,d]},fe=c.unpack,he=Math.floor,me=function(){for(var e,t,r,n,i,a,o=[],s=arguments.length;s--;)o[s]=arguments[s];var l,u,c,d=(o=fe(o,"hcg"))[0],p=o[1],f=o[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=(a=[_,y,b])[0],u=a[1],c=a[2]}}return[l,u,c,o.length>3?o[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],a=r[2],o=r[3],s=Se(e)||"auto";void 0===o&&(o=1),"auto"===s&&(s=o<1?"rgba":"rgb");var l="000000"+((n=Te(n))<<16|(i=Te(i))<<8|(a=Te(a))).toString(16);l=l.substr(l.length-6);var u="0"+Te(255*o).toString(16);switch(u=u.substr(u.length-2),s.toLowerCase()){case"rgba":return"#"+l+u;case"argb":return"#"+u+l;default:return"#"+l}},xe=/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,Oe=/^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/,Ce=function(e){if(e.match(xe)){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(Oe)){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 Pe=c.unpack,Me=c.TWOPI,Ne=Math.min,Le=Math.sqrt,ke=Math.acos,qe=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var r,n=Pe(e,"rgb"),i=n[0],a=n[1],o=n[2],s=Ne(i/=255,a/=255,o/=255),l=(i+a+o)/3,u=l>0?1-s/l:0;return 0===u?r=NaN:(r=(i-a+(i-o))/2,r/=Le((i-a)*(i-a)+(i-o)*(a-o)),r=ke(r),o>a&&(r=Me-r),r/=Me),[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,a=(e=$e(e,"hsi"))[0],o=e[1],s=e[2];return isNaN(a)&&(a=0),isNaN(o)&&(o=0),a>360&&(a-=360),a<0&&(a+=360),(a/=360)<1/3?n=1-((i=(1-o)/3)+(r=(1+o*Ue(Be*a)/Ue(Ge-Be*a))/3)):a<2/3?i=1-((r=(1-o)/3)+(n=(1+o*Ue(Be*(a-=1/3))/Ue(Ge-Be*a))/3)):r=1-((n=(1-o)/3)+(i=(1+o*Ue(Be*(a-=2/3))/Ue(Ge-Be*a))/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=N;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,at=Math.min,ot=Math.max,st=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var r,n,i,a=(e=it(e,"rgb"))[0],o=e[1],s=e[2],l=at(a,o,s),u=ot(a,o,s),c=u-l;return i=u/255,0===u?(r=Number.NaN,n=0):(n=c/u,a===u&&(r=(o-s)/c),o===u&&(r=2+(s-a)/c),s===u&&(r=4+(a-o)/c),(r*=60)<0&&(r+=360)),[r,n,i]},lt=c.unpack,ut=Math.floor,ct=function(){for(var e,t,r,n,i,a,o=[],s=arguments.length;s--;)o[s]=arguments[s];var l,u,c,d=(o=lt(o,"hsv"))[0],p=o[1],f=o[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=(a=[f,g,y])[0],u=a[1],c=a[2]}}return[l,u,c,o.length>3?o[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],a=r[2],o=St(n,i,a),s=o[0],l=o[1],u=116*l-16;return[u<0?0:u,500*(s-l),200*(l-o[2])]},Et=yt,xt=c.unpack,Ot=Math.pow,Ct=function(e){return 255*(e<=.00304?12.92*e:1.055*Ot(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,a=(e=xt(e,"lab"))[0],o=e[1],s=e[2];return n=(a+16)/116,r=isNaN(o)?n:n+o/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,Pt=y,Mt=d,Nt=Tt;Pt.prototype.lab=function(){return Nt(this._rgb)},Ft.lab=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(Pt,[null].concat(e,["lab"])))},Mt.format.lab=jt,Mt.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],a=r[2],o=qt(i*i+a*a),s=($t(a,i)*kt+360)%360;return 0===zt(1e4*o)&&(s=Number.NaN),[n,o,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],a=r[2],o=Ut(n,i,a),s=o[0],l=o[1],u=o[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],a=r[2];return isNaN(a)&&(a=0),[n,Kt(a*=Xt)*i,Wt(a)*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],a=Jt(r,n,i),o=a[0],s=a[1],l=a[2],u=er(o,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)},ar=c.unpack,or=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=ar(t,e),"array"===or(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,xr=y,Or=d,Cr=c.unpack,Ir=c.type,jr=Math.round;xr.prototype.rgb=function(e){return void 0===e&&(e=!0),!1===e?this._rgb.slice(0,3):this._rgb.slice(0,3).map(jr)},xr.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(xr,[null].concat(e,["rgb"])))},Or.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},Or.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,Pr=c.unpack,Mr=Math.round,Nr=v,Lr=y,kr=d,qr=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];for(var r,n=Pr(e,"rgb"),i=n[0],a=n[2],o=1e3,s=4e4;s-o>.4;){var l=Fr(r=.5*(s+o));l[2]/l[0]>=a/i?s=r:o=r}return Mr(r)};Lr.prototype.temp=Lr.prototype.kelvin=Lr.prototype.temperature=function(){return qr(this._rgb)},Nr.temp=Nr.kelvin=Nr.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],a=r[2],o=[Vr(n/255),Vr(i/255),Vr(a/255)],s=o[0],l=o[1],u=o[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],a=Yr(r+.3963377774*n+.2158037573*i,3),o=Yr(r-.1055613458*n-.0638541728*i,3),s=Yr(r-.0894841775*n-1.291485548*i,3);return[255*Kr(4.0767416621*a-3.3077115913*o+.2309699292*s),255*Kr(-1.2684380046*a+2.6097574011*o-.3413193965*s),255*Kr(-.0041960863*a-.7034186147*o+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,an=Ur,on=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],a=r[2],o=an(n,i,a),s=o[0],l=o[1],u=o[2];return on(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],a=un(r,n,i),o=a[0],s=a[1],l=a[2],u=cn(o,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 a=r.indexOf(n)-("ok"===r.substr(0,2)?2:0);if(a>-1)return i[a];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 a=t.interpolate(i,.5,"rgb"),o=a.luminance();return Math.abs(e-o)<1e-7||!r--?a:o>e?n(t,a):n(a,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=xn(e))+.7152*(t=xn(t))+.0722*xn(r)},xn=function(e){return(e/=255)<=.03928?e/12.92:Tn((e+.055)/1.055,2.4)},On={},Cn=y,In=c.type,jn=On,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 a=n[0]||"lrgb";if(jn[a]||n.length||(a=Object.keys(jn)[0]),!jn[a])throw new Error("interpolation mode "+a+" is not defined");return"object"!==In(e)&&(e=new Cn(e)),"object"!==In(t)&&(t=new Cn(t)),jn[a](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 Pn=y;Pn.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 Pn([t[0]*r,t[1]*r,t[2]*r,r],"rgb")};var Mn=y,Nn=yt;Mn.prototype.saturate=function(e){void 0===e&&(e=1);var t=this.lch();return t[1]+=Nn.Kn*e,t[1]<0&&(t[1]=0),new Mn(t,"lch").alpha(this.alpha(),!0)},Mn.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],a=n[1],o=this[i]();if(a){var s=i.indexOf(a)-("ok"===i.substr(0,2)?2:0);if(s>-1){if("string"==kn(t))switch(t.charAt(0)){case"+":case"-":o[s]+=+t;break;case"*":o[s]*=+t.substr(1);break;case"/":o[s]/=+t.substr(1);break;default:o[s]=+t}else{if("number"!==kn(t))throw new Error("unsupported value for Color.set");o[s]=t}var l=new Ln(o,i);return r?(this._rgb=l._rgb,this):l}throw new Error("unknown channel "+a+" in mode "+i)}return o};var qn=y;On.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;On.lrgb=function(e,t,r){var n=e._rgb,i=n[0],a=n[1],o=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(a,2)*(1-r)+Bn(u,2)*r),zn(Bn(o,2)*(1-r)+Bn(c,2)*r),"rgb")};var Gn=y;On.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,a,o,s,l,u,c,d,p,f,h,m,g;return"hsl"===n?(o=e.hsl(),s=t.hsl()):"hsv"===n?(o=e.hsv(),s=t.hsv()):"hcg"===n?(o=e.hcg(),s=t.hcg()):"hsi"===n?(o=e.hsi(),s=t.hsi()):"lch"===n||"hcl"===n?(n="hcl",o=e.hcl(),s=t.hcl()):"oklch"===n&&(o=e.oklch().reverse(),s=t.oklch().reverse()),"h"!==n.substr(0,1)&&"oklch"!==n||(l=(i=o)[0],c=i[1],p=i[2],u=(a=s)[0],d=a[1],f=a[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")};On.lch=Yn,On.hcl=Yn;var Xn=y;On.num=function(e,t,r){var n=e.num(),i=t.num();return new Xn(n+r*(i-n),"num")};var Wn=Vn;On.hcg=function(e,t,r){return Wn(e,t,r,"hcg")};var Kn=Vn;On.hsi=function(e,t,r){return Kn(e,t,r,"hsi")};var Qn=Vn;On.hsl=function(e,t,r){return Qn(e,t,r,"hsl")};var Zn=Vn;On.hsv=function(e,t,r){return Zn(e,t,r,"hsv")};var Jn=y;On.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;On.oklch=function(e,t,r){return ei(e,t,r,"oklch")};var ti=y,ri=c.clip_rgb,ni=Math.pow,ii=Math.sqrt,ai=Math.PI,oi=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 a=e[i],o=t[i]/r,s=a._rgb;n[0]+=ni(s[0],2)*o,n[1]+=ni(s[1],2)*o,n[2]+=ni(s[2],2)*o,n[3]+=s[3]*o}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],a=[],o=[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]);a.length=0;for(var r=0;r<e.length;r++)a.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=o[0]+u*(1-o[0]-o[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<a.length;g++){var v=a[g];if(u<=v){i=l[g];break}if(u>=v&&g===a.length-1){i=l[g];break}if(u>v&&u<a[g+1]){u=(u-v)/(a[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],a=[];var t=l.length;if(e.length===t&&c!==d)for(var r=0,n=Array.from(e);r<n.length;r+=1){var o=n[r];a.push((o-c)/(d-c))}else{for(var s=0;s<t;s++)a.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],a=t+(r-t)*e,o=i-a,s=0,l=1,u=20;Math.abs(o)>.01&&u-- >0;)n&&(o*=-1),o<0?(s=e,e+=.5*(l-e)):(l=e,e+=.5*(s-e)),o=(i=v(e,!0).lab()[0])-a;return e}:function(e){return e},A},A.padding=function(e){return null!=e?("number"===di(e)&&(e=[e,e]),o=e,A):o},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 a=i[0],o=i[1]-a;n=function(e,t,r){for(var n=[],i=e<t,a=r?i?t+1:t-1:t,o=e;i?o<a:o>a;i?o++:o--)n.push(o);return n}(0,t,!1).map((function(e){return A(a+e/(t-1)*o)}))}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,xi=Math.cos,Oi=v,Ci=y,Ii=Math.floor,ji=Math.random,Ri=o,Di=Math.log,Fi=Math.pow,Pi=Math.floor,Mi=Math.abs,Ni=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=Ni(e));var n=e.min,i=e.max,a=e.values.sort((function(e,t){return e-t}));if(1===r)return[n,i];var o=[];if("c"===t.substr(0,1)&&(o.push(n),o.push(i)),"e"===t.substr(0,1)){o.push(n);for(var s=1;s<r;s++)o.push(n+s/r*(i-n));o.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);o.push(n);for(var c=1;c<r;c++)o.push(Fi(10,l+c/r*(u-l)));o.push(i)}else if("q"===t.substr(0,1)){o.push(n);for(var d=1;d<r;d++){var p=(a.length-1)*d/r,f=Pi(p);if(f===p)o.push(a[f]);else{var h=p-f;o.push(a[f]*(1-h)+a[f+1]*h)}}o.push(i)}else if("k"===t.substr(0,1)){var m,g=a.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=a[T],x=Number.MAX_VALUE,O=void 0,C=0;C<r;C++){var I=Mi(A[C]-E);I<x&&(x=I,O=C),b[O]++,y[T]=O}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]=a[D]:j[m]+=a[D];for(var F=0;F<r;F++)j[F]*=1/b[F];v=!1;for(var P=0;P<r;P++)if(j[P]!==A[P]){v=!0;break}A=j,++_>200&&(v=!1)}for(var M={},N=0;N<r;N++)M[N]=[];for(var L=0;L<g;L++)M[m=y[L]].push(a[L]);for(var k=[],q=0;q<r;q++)k.push(M[q][0]),k.push(M[q][M[q].length-1]);k=k.sort((function(e,t){return e-t})),o.push(k[0]);for(var $=1;$<k.length;$+=2){var z=k[$];isNaN(z)||-1!==o.indexOf(z)||o.push(z)}}return o},ki={analyze:Ni,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,ea=fi,ta={cool:function(){return ea([Ji.hsl(180,1,.9),Ji.hsl(250,.7,.4)])},hot:function(){return ea(["#000","#f00","#ff0","#fff"]).mode("rgb")}},ra={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"]},na=0,ia=Object.keys(ra);na<ia.length;na+=1){var aa=ia[na];ra[aa.toLowerCase()]=ra[aa]}var oa=ra,sa=v;return sa.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 a=e.shift(),o=a.get(t),s=[],l=0,u=0,c=0;c<o.length;c++)if(o[c]=(o[c]||0)*r[0],s.push(isNaN(o[c])?0:r[0]),"h"===t.charAt(c)&&!isNaN(o[c])){var d=o[c]/180*ai;l+=oi(d)*r[0],u+=si(d)*r[0]}var p=a.alpha()*r[0];e.forEach((function(e,n){var i=e.get(t);p+=e.alpha()*r[n+1];for(var a=0;a<o.length;a++)if(!isNaN(i[a]))if(s[a]+=r[n+1],"h"===t.charAt(a)){var c=i[a]/180*ai;l+=oi(c)*r[n+1],u+=si(c)*r[n+1]}else o[a]+=i[a]*r[n+1]}));for(var f=0;f<o.length;f++)if("h"===t.charAt(f)){for(var h=li(u/s[f],l/s[f])/ai*180;h<0;)h+=360;for(;h>=360;)h-=360;o[f]=h}else o[f]=o[f]/s[f];return p/=n,new ti(o,t).alpha(p>.99999?1:p,!0)},sa.bezier=function(e){var t=function(e){var t,r,n,i,a,o,s;if(2===(e=e.map((function(e){return new hi(e)}))).length)t=e.map((function(e){return e.lab()})),a=t[0],o=t[1],i=function(e){var t=[0,1,2].map((function(t){return a[t]+e*(o[t]-a[t])}));return new hi(t,"lab")};else if(3===e.length)r=e.map((function(e){return e.lab()})),a=r[0],o=r[1],s=r[2],i=function(e){var t=[0,1,2].map((function(t){return(1-e)*(1-e)*a[t]+2*(1-e)*e*o[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()})),a=n[0],o=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)*a[t]+3*(1-e)*(1-e)*e*o[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,a){return n+c[a]*Math.pow(t,d-a)*Math.pow(e,a)*i[r]}),0)}));return new hi(r,"lab")}}return i}(e);return t.scale=function(){return mi(t)},t},sa.blend=_i,sa.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 a,o=0;"array"===Ai(i)?a=i[1]-i[0]:(a=0,i=[i,i]);var s=function(s){var l=Si*((e+120)/360+t*s),u=Ti(i[0]+a*s,n),c=(0!==o?r[0]+s*o:r)*u*(1-u)/2,d=xi(l),p=Ei(l);return Oi(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==(o=r[1]-r[0])&&(r=r[1]):o=0,s)},s.lightness=function(e){return null==e?i:("array"===Ai(e)?(i=e,a=e[1]-e[0]):(i=[e,e],a=0),s)},s.scale=function(){return Oi.scale(s)},s.hue(r),s},sa.mix=sa.interpolate=Rn,sa.random=function(){for(var e="#",t=0;t<6;t++)e+="0123456789abcdef".charAt(Ii(16*ji()));return new Ci(e,"hex")},sa.scale=fi,sa.analyze=ki.analyze,sa.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)},sa.deltaE=function(e,t,r,n,i){void 0===r&&(r=1),void 0===n&&(n=1),void 0===i&&(i=1);var a=function(e){return 360*e/(2*Ki)},o=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=a(Vi(c,b)),T=a(Vi(h,v)),E=S>=0?S:S+360,x=T>=0?T:T+360,O=Hi(E-x)>180?(E+x+360)/2:(E+x)/2,C=1-.17*Yi(o(O-30))+.24*Yi(o(2*O))+.32*Yi(o(3*O+6))-.2*Yi(o(4*O-63)),I=x-E;I=Hi(I)<=180?I:x<=E?I+360:I-360,I=2*zi(_*A)*Xi(o(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,P=1+.015*w*C,M=30*Wi(-Bi((O-275)/25,2)),N=-2*zi(Bi(w,7)/(Bi(w,7)+Bi(25,7)))*Xi(2*o(M)),L=zi(Bi(j/(r*D),2)+Bi(R/(n*F),2)+Bi(I/(i*P),2)+N*(R/(n*F))*(I/(i*P)));return Ui(0,Gi(100,L))},sa.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),a=0;for(var o in n){var s=(n[o]||0)-(i[o]||0);a+=s*s}return Math.sqrt(a)},sa.limits=ki.limits,sa.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}},sa.scales=ta,sa.colors=dr,sa.brewer=oa,sa}()},9034:e=>{e.exports=JSON.parse('{"name":"@vizzly/api-client","version":"0.0.38","private":false,"license":"NONE","source":"src/index.ts","main":"dist/index.js","types":"dist/index.d.ts","type":"commonjs","files":["dist"],"devDependencies":{"@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":{"cross-fetch":"^4.0.0"}}')}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var a=t[n]={id:n,loaded:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.loaded=!0,a.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.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var n={};(()=>{r.d(n,{B:()=>Na,Q:()=>Ni});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 a=r(4893);const o=a.QueryEngineConfig.Constants.timeDimensionsConstants,s=(e,t)=>[...Object.keys(e),"none"].includes(t),l=a.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=a.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}),x=(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"}},O=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 a=r&&r.length>0?r.filter((e=>i.includes(e))):i;return r&&r.length>0&&0===a.length&&(a=i),a},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=x;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,a,o;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===(a=l.yMeasure)||void 0===a?void 0:a.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===(o=l.timeDimension)||void 0===o?void 0:o.field)==r&&(l.timeDimension=null),l},P=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)},M=(e,t,r)=>{let n=i(e,t);const{value:a,error:o}=r.validate(n);if(o)throw o;return a};var N=r(4579),L=r.n(N);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,a=e,Object.keys(a).filter((e=>a[e].validDataTypes.includes(i.dataType))));var i,a;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().try(ue,L().string().allow(null),L().number(),L().boolean(),L().array().items(L().string(),L().number(),L().allow(null)),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)}),ae=()=>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()})),oe=()=>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=L().custom(((e,t)=>"[object Date]"===Object.prototype.toString.call(e)?e:t.error("any.invalid")),"Date object validation"),ce=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."),de=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.")}),pe=e=>L().array().items(ce(e)).description("Apply formatting based on a set of defined rules."),fe=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","funnelChart").required(),conditionalFormattingRules:pe(e.queryEngineConfig),protectedFields:L().object({dimension:te(e.queryEngineConfig),measure:ee(e.queryEngineConfig)}).unknown(!0),parameters:ie(e.queryEngineConfig,e.attributesSchemaOptions),goalLines:ae(),axisTitles:se(),headline:oe(),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")}))})),he=e=>(t,r)=>{let n=M(t,r,fe(e));return n=P(n),n};class me extends Error{constructor(e){super(e),this.name="ValidationError"}}const ge=me;class ye extends ge{constructor(e){super(`Corrupt view. ${e.message}.\n\n ${JSON.stringify(e)}\n `),this.name="CorruptedView"}}r(3514);const be=(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},ve=(e,t,r)=>e.map((({rule:e,name:n})=>({returns:{type:"string",value:n},filter:Re(e,t,r)}))),_e=e=>"leftFieldId"in e&&"operator"in e&&"rightFieldId"in e,Ae=e=>"roundToDecimalPlaces"in e,we=e=>"leftFieldId"in e&&"leftFunction"in e&&"operator"in e&&"rightFieldId"in e&&"rightFunction"in e,Se=e=>"denominatorFieldId"in e||"numeratorFieldId"in e,Te=e=>"rules"in e,Ee=e=>"rule"in e,xe=e=>"dateCalculationFunction"in e,Oe=e=>Se(e)||_e(e)||we(e)||Te(e)||Ae(e)||xe(e)||Ee(e),Ce=(e,t,r,n,i,a)=>{if(Se(t))return((e,t,r,n,i)=>{var a,o,s,l;const{combinedNominatorFilters:u,combinedDenominatorFilters:c}=function(e,t){let r=[],n=[];return t.numeratorFilter&&De(t.numeratorFilter)?t.numeratorFilter.forEach((t=>{r=[...r,...je(null!=e?e:[],t)]})):r=null!=e?e:[],t.denominatorFilter&&De(t.denominatorFilter)?t.denominatorFilter.forEach((t=>{n=[...n,...je(null!=e?e:[],t)]})):n=null!=e?e:[],{combinedNominatorFilters:r,combinedDenominatorFilters:n}}(i,e),d={fieldId:null!==(a=e.numeratorFieldId)&&void 0!==a?a:e.denominatorFieldId,aggregate:null!==(o=e.numeratorAggregate)&&void 0!==o?o: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:Re(c||[],t,r)}},h=be(p,De(e.denominatorFilter)?Re(c,t,r):[]);return{type:"maths",left:be(d,De(e.numeratorFilter)?Re(u,t,r):[]),op:"/",right:"withinGrouping"===e.denominatorScope?h:f}})(t,r,n,0,a);if(Te(t))return((e,t,r,n)=>{const i={type:"switchField",value:{cases:ve(t.rules,r,n)}};return"none"==e.function?i:{type:"function",function:e.function,value:i}})(e,t,r,n);if(we(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(_e(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(Ae(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(Ee(t))return((e,t,r)=>({type:"function",function:e.function,value:{type:"switchField",value:{cases:[{returns:{type:"field",function:"none",value:e.fieldId},filter:Re(e.rule,t,r)},{returns:{type:"null"},filter:[[{value:1,op:"=",field:{type:"number",value:1}}]]}]}}}))(t,r,n);if(xe(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)}`},Ie=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},je=(e,r)=>(e&&!(0,t.isEmpty)(e)||(e=[[]]),[...e].map((e=>[...e,...r]))),Re=(e,t,r)=>e.map((n=>[...n].flatMap((n=>{var i,a;if(n.function&&!s(t.supportedTimeTruncFunctions,n.function))throw`Query engine does not support the query function ${n.function}.`;const o=bt(r,n.field);let l={type:"field",value:n.field,function:null!==(i=n.function)&&void 0!==i?i:"none"};if(Oe(o)&&(l=Ce({field:o.id,function:null!==(a=n.function)&&void 0!==a?a:"none"},o,t,r,0,e)),("array_contains"==n.op||"array_does_not_contain"==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}]})))),De=e=>e&&(0,t.isArray)(e)&&(0,t.isArray)(e[0]),Fe=e=>e&&(0,t.isArray)(e)&&(0,t.isArray)(e[0])&&"field"in e[0][0]&&"op"in e[0][0]&&"value"in e[0][0],Pe=(e,t)=>[[...e,t],e.length],Me=(e,t,r,n,i,a,o,l,u)=>{let c=[],d=[],p=[],f=[],h=[];if(a){let t;if(!s(u.supportedTimeTruncFunctions,a.truncate))throw`Query engine does not support the time trunc function ${a.truncate}.`;[d,t]=Pe(d,{type:"field",value:a.field,function:a.truncate}),c=[...c,{functionId:a.truncate,field:bt(e,a.field)}],p=[...p,{index:t}]}return i.forEach((t=>{let r;[d,r]=Pe(d,{type:"field",value:null==t?void 0:t.field,function:t.function}),c=[...c,{functionId:t.function,field:bt(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]=Pe(d,{type:"field",value:t.field,function:t.function}),c=[...c,{functionId:t.function,field:bt(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=Re([t],u,e);h=[...h,r[0]]})),d=d.map((t=>{if("field"==t.type&&"string"==typeof t.value){const r=bt(e,t.value);if(Oe(r))return Ce({function:t.function,field:t.value},r,u,e,ft({group:p}),n)}return t})),{query:{type:"query",dataSetId:e.id,measure:d,group:p,filter:h,order:f,limit:o,offset:l},measureDescription:c}};var Ne=r(6342);const Le=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"),ke=L().object({index:L().number().required()}),qe=L().object({index:L().number().required(),direction:L().string().valid("asc","desc").required()}),$e=(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(),L().array().items(L().alternatives(L().string(),L().number(),L().valid(!0),L().valid(!1)))]),"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)},ze=e=>L().object({field:Le(e),op:L().string().valid(...Object.keys(e.supportedOperators)),value:L().alternatives().conditional("op",Object.keys(e.supportedOperators).map((t=>({is:t,then:$e(t,e.supportedOperators[t].validDataTypes)}))))}).id("Filter"),Be=e=>{const t=ze(e);return L().alternatives(L().object({type:L().valid("preparedQuery").required(),timeZone:L().string().valid(...(0,a.ianaTimeZones)()).default(a.ETC_UTC_TIME_ZONE),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(),timeZone:L().string().valid(...(0,a.ianaTimeZones)()).default(a.ETC_UTC_TIME_ZONE),preparedQueryType:L().valid("preAggregated").required(),dataSetId:L().string().required(),filter:L().object().pattern(L().string(),L().array().items(L().array().items(t)))}))},Ge=e=>{const t=ze(e),r=Le(e);return L().alternatives().conditional(".type",{is:"query",then:L().object({type:L().valid("query"),timeZone:L().string().valid(...(0,a.ianaTimeZones)()).default(a.ETC_UTC_TIME_ZONE),dataSetId:L().string().required(),measure:L().array().items(r).min(1).required(),group:L().array().items(ke).required(),filter:L().array().items(L().array().items(t)).required(),order:L().array().items(qe).required(),limit:X(),offset:L().number().optional()}).shared(t).shared(r)}).conditional(".type",{is:"preparedQuery",then:Be(e)})},Ue=(Ge(a.QueryEngineConfig.getQueryEngineConfig("postgres")),Ge(a.QueryEngineConfig.getQueryEngineConfig("snowflake")),Ge(a.QueryEngineConfig.getQueryEngineConfig("mariadb")),Ge(a.QueryEngineConfig.getQueryEngineConfig("mysql")),Ge(a.QueryEngineConfig.getQueryEngineConfig("bigquery")),Ge(a.QueryEngineConfig.getQueryEngineConfig("redshift")),"dateFilter"),Ve="dateAndTimeFilter",He="singleSelectFilter",Ye="multiSelectFilter",Xe="numericFilter",We=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:Je(e.type)}),Ke=(e,t,r)=>t.appliesToFields.flatMap((n=>{var i,a,o;if(n.dataSetId!=e.id)return[];if(null==t.value)return[];if("string[]"==bt(e,n.fieldId).dataType&&t.type!==Ye&&!Fe(t.value))return[{field:n.fieldId,op:"array_contains",value:t.value}];if((t.type==Ue||t.type==Ve)&&"relativeRange"==(null===(i=t.value)||void 0===i?void 0:i.type))return[];if((t.type==Ue||t.type==Ve)&&"fixedRange"==(null===(a=t.value)||void 0===a?void 0:a.type))return[{field:n.fieldId,op:tt(et.Greater,t),value:t.value.after},{field:n.fieldId,op:tt(et.Less,t),value:t.value.before}];if((t.type==Ue||t.type==Ve)&&"relative"==(null===(o=t.value)||void 0===o?void 0:o.type)){let{before:e,after:i}=r[t.value.value].range,a=[];return e&&(a=[...a,{field:n.fieldId,op:tt(et.Less,t),value:e}]),i&&(a=[...a,{field:n.fieldId,op:tt(et.Greater,t),value:i}]),a}if(t.type==He){let e=t.value;return"__vizzly_null_value_option"===t.value&&(e=null),[{field:n.fieldId,op:"=",value:e}]}if(Fe(t.value))return rt(t.value,n,e.id);if(t.type==Ye&&t.value.length>0)return[{field:n.fieldId,op:"is_one_of",value:t.value}];if(t.type==Ue&&!t.value||t.type==Ve&&!t.value||t.type==Ye&&0===t.value.length)return[];if(t.type==Xe)return"op"in t.value&&"value"in 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)}`})),Qe=(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},Ze=(e,t,r)=>{let n=[];return(e.globalFilters||[]).forEach((e=>{let i=[];e.type!==Ve&&e.type!==Ue||(i=Qe(e)),n=[...n,...i,...Ke(t,e,r)]})),Object.values(e.localFilters||{}).flat().forEach((e=>{let i=[];e.type!==Ve&&e.type!==Ue||(i=Qe(e)),n=[...n,...i,...Ke(t,e,r)]})),n},Je=e=>"dateTimeFilter"===e?Ue:e;var et;function tt(e,t){switch(e){case et.Greater:return t.inclusiveDate?">=":">";case et.Less:return t.inclusiveDate?"<=":"<";default:throw new Error("Unknown date operation")}}!function(e){e[e.Greater=0]="Greater",e[e.Less=1]="Less"}(et||(et={}));const rt=(e,r,n)=>{if(!e)return[];const i=e[0];if((0,t.isArray)(e)&&(0,t.isArray)(e[0])){if(r.dataSetId!=n)return[];const e=i.find((e=>e.field==r.fieldId));return null!=e?e:[]}return[]},nt=L().object({fieldId:L().string().required(),dataSetId:L().string().required()}),it=e=>L().object().pattern(L().string(),L().array().items(H(e)).optional()),at=e=>({title:L().string().allow(""),managedByConfiguration:L().boolean().optional(),requiresValue:L().boolean().optional(),optionsFilters:it(e).optional(),appliesToFields:L().array().items(nt).required(),optionsPulledFrom:L().array().items(nt).optional(),hidden:L().boolean(),options:L().array().items(L().object({value:L().allow(L().number(),L().string()),label:L().string()})).optional()}),ot=(e,t)=>L().object(Object.assign(Object.assign({},at(e)),{type:L().valid(He).required(),value:L().alternatives(L().string(),L().number(),L().boolean(),L().valid(...t?[]:[null]))})),st=(e,t)=>L().object(Object.assign(Object.assign({},at(e)),{type:L().valid(Ye).required(),value:L().alternatives(L().array().items(L().string(),L().number()).single(),L().valid(...t?[]:[null]),L().array().items(L().array().items(H(e))))})),lt=(e,t,r)=>L().object(Object.assign(Object.assign({},at(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()}))})),ut=(e,t)=>L().object(Object.assign(Object.assign({},at(e)),{type:L().valid(Xe).required(),value:L().alternatives(L().object({op:L().allow("=","<",">","<=",">="),value:L().number().allow(null,0)}),L().array().items(L().array().items(H(e))),L().valid(...t?[]:[null]))})),ct=(e,t)=>L().alternatives().conditional(".type",{is:He,then:ot(e,t)}).conditional(".type",{is:Ue,then:lt(e,t,Ue)}).conditional(".type",{is:Ve,then:lt(e,t,Ve)}).conditional(".type",{is:Ye,then:st(e,t)}).conditional(".type",{is:Xe,then:ut(e,t)});function dt(e){return L().array().items(L().custom(((t,r)=>{if(!e)return r.error("any.invalid");const n=ct(e,!!t.requiresValue),{error:i}=n.validate(t);return i?r.error("any.invalid",{message:i.message}):t}))).required()}const pt=Me,ft=e=>e.group.length>0,ht=(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 mt extends ge{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 gt(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=yn(t);return[...e].filter((e=>{let t=!0;return Se(e)&&!r.supportedCustomFields.percentages&&(t=!1),_e(e)&&!r.supportedCustomFields.simpleMaths&&(t=!1),Te(e)&&!r.supportedCustomFields.rules&&(t=!1),Ae(e)&&!r.supportedCustomFields.roundedNumbers&&(t=!1),Ee(e)&&!r.supportedCustomFields.conditional&&(t=!1),xe(e)&&!r.supportedCustomFields.dateCalculations&&(t=!1),t}))})(n,r.forComponent)),(null==r?void 0:r.removePercentage)&&(n=n.filter((e=>!Se(e)))),(null==r?void 0:r.removeRuleGrouping)&&(n=n.filter((e=>!Te(e)))),(null==r?void 0:r.removeSimpleMaths)&&(n=n.filter((e=>!_e(e)))),(null==r?void 0:r.removeAggregateMaths)&&(n=n.filter((e=>!we(e)))),(null==r?void 0:r.removeDateCalculations)&&(n=n.filter((e=>!xe(e)))),(null==r?void 0:r.removeConditional)&&(n=n.filter((e=>!Ee(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 yt=(e,t)=>e.find((e=>e.id==t))||null,bt=(e,t)=>{let r=[...e.fields].find((e=>e.id==t));if(r)return r;throw new mt(e,t)},vt=(e,r)=>{const n=(0,t.findIndex)(e,(e=>e.id==r));return[e[n]||null,n]},_t=(e,t)=>[...gt(e.fields,{onlyFieldTypes:["number","string","boolean"],onlyMeasures:!0,forComponent:t})],At=e=>Object.assign(Object.assign({},e),{fields:[...e.fields].filter((e=>!Oe(e)))}),wt=(e,t,r)=>{const n="horizontalBarChart"===r?void 0:"x",i=(e=>[...gt(e.fields,{onlyFieldTypes:["boolean","number","string"],onlyDimensions:!0,removePercentage:!0,removeSimpleMaths:!0,removeAggregateMaths:!0})])(e)[0],a=[..._t(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:a,order:[],timeDimension:null,filter:[],dimension:i?[{field:i.id,function:"none",pivot:n}]:[]}},St=(e,t)=>t?(e=e.map(At),[...[...e].map((e=>{const r=(t[e.id]||[]).map(Ie);return Object.assign(Object.assign({},e),{fields:[...e.fields,...r]})}))]):e;class Tt extends ge{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 Et={allowUnknown:!0,stripUnknown:!0},xt=(e,t,r)=>{const{error:n}=yn(e.type,{queryEngineConfig:r}).schema.validate(e,Et);if(n)return[new ye(n)];const i=yt(t,e.dataSetId);if(!i)return[new Tt(t,e.dataSetId)];const a=(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{a.forEach((e=>{bt(i,e)}))}catch(e){if(e instanceof mt)return[e];throw e}return[]},Ot=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},Ct={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let It;const jt=new Uint8Array(16);function Rt(){if(!It&&(It="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!It))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return It(jt)}const Dt=[];for(let e=0;e<256;++e)Dt.push((e+256).toString(16).slice(1));const Ft=function(e,t,r){if(Ct.randomUUID&&!t&&!e)return Ct.randomUUID();const n=(e=e||{}).random||(e.rng||Rt)();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 Dt[e[t+0]]+Dt[e[t+1]]+Dt[e[t+2]]+Dt[e[t+3]]+"-"+Dt[e[t+4]]+Dt[e[t+5]]+"-"+Dt[e[t+6]]+Dt[e[t+7]]+"-"+Dt[e[t+8]]+Dt[e[t+9]]+"-"+Dt[e[t+10]]+Dt[e[t+11]]+Dt[e[t+12]]+Dt[e[t+13]]+Dt[e[t+14]]+Dt[e[t+15]]}(n)};const Pt=e=>e||`view_${Ft()}`;function Mt(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 Nt=(e,r,n)=>{let i=(0,t.cloneDeep)(gt(r.fields,{onlyFieldTypes:["boolean","string"]})),a=(0,t.cloneDeep)(gt(r.fields,{onlyFieldTypes:["date_time"]})),o=(0,t.cloneDeep)(gt(r.fields,{onlyFieldTypes:["number"]})),s=null;return a[0]&&(s={field:a[0].id,truncate:"none"}),n(e,{protectedByOrganisation:!0,dimension:i.map((e=>({field:e.id,function:"none"}))),measure:[...o].map((e=>({function:"none",field:e.id}))),order:[],timeDimension:s})},Lt=(e,r)=>{let n=null,i=(0,t.cloneDeep)(e);return i.forEach((e=>{const t=bt(r,e.field);"date_time"==t.dataType&&(n={field:t.id,truncate:e.function})})),i=i.filter((e=>"date_time"!=bt(r,e.field).dataType)),{timeDimension:n,dimension:i}},kt=e=>{let t=[...e.dimension];return"timeDimension"in e&&e.timeDimension&&(t=[{field:e.timeDimension.field,function:e.timeDimension.truncate},...t]),t},qt=e=>{if(!e)return;let r=(0,t.cloneDeep)(e);return r.measure=f(e.measure||[]),r},$t=(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=>zt(t,e)))));r.push(...n)}else i&&r.push([zt({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)},zt=(e,t)=>{var r;const n=x(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}},Bt={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 Gt(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 Ut(e,t){var r;return null===(r=e.format_panel.axis_labels)||void 0===r?void 0:r.subSectionDefinition[t]}function Vt(e){return Object.assign(Object.assign({},Gt(e,"heading")),{subSection:[e.format_panel.heading.subSectionDefinition.title,e.format_panel.heading.subSectionDefinition.subject]})}function Ht(e){return Object.assign(Object.assign({},Gt(e,"axis_labels")),{y:Object.assign(Object.assign({},Ut(e,"y")),{prefix:Ut(e,"y.prefix"),postfix:Ut(e,"y.postfix"),format:Ut(e,"y.format"),count:Ut(e,"y.count"),axisTitle:Ut(e,"y.axis_title")}),x:Object.assign(Object.assign({},Ut(e,"x")),{prefix:Ut(e,"x.prefix"),postfix:Ut(e,"x.postfix"),format:Ut(e,"x.format"),count:Ut(e,"x.count"),axisTitle:Ut(e,"x.axis_title")})})}function Yt(e,t,r){var n,i,a,o,s;return t?Object.assign(Object.assign({},Gt(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({},Gt(e,"chart_styles")),{subSection:[null===(a=e.format_panel.chart_styles)||void 0===a?void 0:a.subSectionDefinition.stacked,null===(o=e.format_panel.chart_styles)||void 0===o?void 0:o.subSectionDefinition.legend]}):Object.assign(Object.assign({},Gt(e,"chart_styles")),{subSection:[null===(s=e.format_panel.chart_styles)||void 0===s?void 0:s.subSectionDefinition.legend]})}function Xt(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 Wt=(e,t)=>{if("current"===(null==e?void 0:e.func)&&t)return e},Kt=e=>({title:Bt.title,description:Bt.description,servicesClass:"BarChart",namespace:Bt.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:qt(t.protectedFields),viewId:Pt(t.viewId),dimension:O(t.dimension),approxXAxisLabelCount:h(t.approxXAxisLabelCount),approxYAxisLabelCount:h(t.approxYAxisLabelCount),parameters:m(t.parameters),conditionalFormattingRules:$t(e.queryEngineConfig,t.conditionalFormattingRules),headline:Wt(t.headline,t.timeDimension),tags:null!==(r=t.tags)&&void 0!==r?r:[],drilldownOptions:t.drilldownOptions})},setAttributes:he(e),validate:(t,r)=>xt(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:[],drilldownOptions:void 0},t),createFeedback:Ot,schema:fe(e),removeField:(t,r)=>F(t,r,e.queryEngineConfig),isRunnable:e=>e.measure.length>0,autoGenerate(t){const{measure:r,dimension:n}=wt(t,e.queryEngineConfig,"barChart");return this.init(t.id,{measure:[r[0]],dimension:n})},dataPanelConfig:()=>[Gt(Bt,"data_set"),Gt(Bt,"views"),Object.assign(Object.assign({},Gt(Bt,"field_y_axis")),{fieldFilterOptions:{forComponent:"barChart",onlyMeasures:!0},preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"}),Object.assign(Object.assign({},Gt(Bt,"field_x_axis")),{fieldFilterOptions:{forComponent:"barChart",onlyDimensions:!0},preventDuplicates:!0,preSetPartialAttributes:(e,t)=>Lt(e,t),getValues:e=>kt(e),maxAllowed:2,testId:"add-dimension"}),Gt(Bt,"sort"),Gt(Bt,"filter"),Object.assign(Object.assign({},Gt(Bt,"drilldown")),{options:{property:"drilldownOptions"}}),Gt(Bt,"custom_metrics"),Gt(Bt,"limit")],formatPanelConfig:()=>[Vt(Bt),Yt(Bt,!1,!0),Ht(Bt),Object.assign(Object.assign({},Gt(Bt,"conditional_formatting")),{ruleType:"backgroundColor"}),Gt(Bt,"goal_line"),Gt(Bt,"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 Nt(e,t,this.setAttributes)}}),Qt=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:pe(e.queryEngineConfig),goalLines:ae(),axisTitles:se(),headline:oe(),tags:z()})),Zt=e=>(t,r)=>{let n=M(t,r,Qt(e));return n=P(n),n},Jt={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:""}}},er=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:O(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:$t(e.queryEngineConfig,t.conditionalFormattingRules),drilldown:t.drilldown,legend:t.legend,goalLines:t.goalLines,headline:Wt(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:Zt(e),validate:(t,r)=>xt(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:Ot,schema:Qt(e),removeField:(t,r)=>F(t,r,e.queryEngineConfig),isRunnable:e=>e.measure.length>0,autoGenerate(t){const{measure:r,dimension:n}=wt(t,e.queryEngineConfig,"lineChart");return this.init(t.id,{measure:[r[0]],dimension:n})},dataPanelConfig:()=>[Gt(Jt,"data_set"),Gt(Jt,"views"),Object.assign(Object.assign({},Gt(Jt,"field_y_axis")),{fieldFilterOptions:{forComponent:"lineChart"},preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"}),Object.assign(Object.assign({},Gt(Jt,"field_x_axis")),{fieldFilterOptions:{forComponent:"lineChart",onlyDimensions:!0},preventDuplicates:!0,preSetPartialAttributes:(e,t)=>Lt(e,t),getValues:e=>kt(e),maxAllowed:2,testId:"add-dimension"}),Gt(Jt,"sort"),Gt(Jt,"filter"),Gt(Jt,"custom_metrics"),Gt(Jt,"limit")],formatPanelConfig:()=>[Vt(Jt),Yt(Jt,!0,!1),Ht(Jt),Object.assign(Object.assign({},Gt(Jt,"conditional_formatting")),{ruleType:"lineColor"}),Gt(Jt,"goal_line"),Gt(Jt,"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 Nt(e,t,this.setAttributes)}}),tr=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:pe(e.queryEngineConfig),labelFormat:L().alternatives(L().string(),L().valid(null)),parameters:ie(e.queryEngineConfig,e.attributesSchemaOptions),tags:z()})),rr={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:""}}},nr=e=>({title:rr.title,description:rr.description,servicesClass:"PieChart",namespace:rr.namespace,dump:e=>e,load:t=>{var r;return{type:t.type,measure:f(t.measure),order:p(t.order,t.timeDimension),dimension:O(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:$t(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)=>M(t,r,tr(e)),validate:(t,r)=>xt(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:Ot,schema:tr(e),removeField:(t,r)=>F(t,r,e.queryEngineConfig),isRunnable:e=>e.measure.length>0,autoGenerate(t){const{measure:r,dimension:n}=wt(t,e.queryEngineConfig,"pieChart");return this.init(t.id,{measure:[r[0]],dimension:n})},dataPanelConfig:()=>[Gt(rr,"data_set"),Gt(rr,"views"),Object.assign(Object.assign({},Gt(rr,"field_metrics")),{fieldFilterOptions:{forComponent:"pieChart"},maxAllowed:1,preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"}),Object.assign(Object.assign({},Gt(rr,"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"}),Gt(rr,"sort"),Gt(rr,"filter"),Gt(rr,"custom_metrics"),Gt(rr,"limit")],formatPanelConfig:()=>{var e,t;return[Vt(rr),Object.assign(Object.assign({},Gt(rr,"conditional_formatting")),{ruleType:"backgroundColor"}),Object.assign(Object.assign({},Gt(rr,"chart_styles")),{subSection:[null===(e=rr.format_panel.chart_styles)||void 0===e?void 0:e.subSectionDefinition.legend,null===(t=rr.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}}),ir=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:ae(),axisTitles:se(),tags:z()})),ar=e=>(t,r)=>{let n=M(t,r,ir(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},or={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:""}}},sr=e=>({title:or.title,description:or.description,servicesClass:"ScatterChart",namespace:or.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:O(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:ar(e),validate:(t,r)=>xt(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:Ot,schema:ir(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}=wt(t,e.queryEngineConfig,"scatterChart");return this.init(t.id,{xMeasure:r[0],yMeasure:r[1],dimension:n})},dataPanelConfig:()=>{var e,t;return[Gt(or,"data_set"),Gt(or,"views"),Object.assign(Object.assign({},Gt(or,"labelled_metrics")),{subSection:[Object.assign(Object.assign({},null===(e=or.data_panel.labelled_metrics)||void 0===e?void 0:e.subSectionDefinition.xAxis),{propKey:"xMeasure",allowsMultiple:!1}),Object.assign(Object.assign({},null===(t=or.data_panel.labelled_metrics)||void 0===t?void 0:t.subSectionDefinition.yAxis),{propKey:"yMeasure",allowsMultiple:!1})]}),Object.assign(Object.assign({},Gt(or,"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"}),Gt(or,"filter"),Gt(or,"custom_metrics"),Gt(or,"limit")]},formatPanelConfig:()=>{var e;return[Vt(or),Object.assign(Object.assign({},Gt(or,"chart_styles")),{subSection:[null===(e=or.format_panel.chart_styles)||void 0===e?void 0:e.subSectionDefinition.legend]}),Ht(or),Gt(or,"goal_line")]},supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0},supportedFeatures:{parameters:!1,colorGradient:!1}}),lr=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:ae(),conditionalFormattingRules:L().object({bar:L().array().items(ce(e.queryEngineConfig)),line:L().array().items(ce(e.queryEngineConfig))}),axisTitles:se(),tags:z()})),ur=e=>(t,r)=>{let n=M(t,r,lr(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},cr={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"}}}}},dr=e=>({title:cr.title,description:cr.description,servicesClass:"ComboChart",namespace:cr.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:O(r.lineDimension||r.dimension||[]),barDimension:O(r.barDimension||r.dimension||[]),viewId:Pt(r.viewId),approxXAxisLabelCount:h(r.approxXAxisLabelCount),approxYAxisLabelCount:h(r.approxYAxisLabelCount),conditionalFormattingRules:{bar:$t(n,null===(i=r.conditionalFormattingRules)||void 0===i?void 0:i.bar),line:$t(n,null===(a=r.conditionalFormattingRules)||void 0===a?void 0:a.line)},tags:null!==(o=r.tags)&&void 0!==o?o:[]});var r,n,i,a,o},setAttributes:ur(e),validate:(t,r)=>xt(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:Ot,schema:lr(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}=wt(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[Gt(cr,"data_set"),Gt(cr,"views"),Object.assign(Object.assign({},Gt(cr,"labelled_metrics")),{subSection:[Object.assign(Object.assign({},null===(e=cr.data_panel.labelled_metrics)||void 0===e?void 0:e.subSectionDefinition.line),{propKey:"lineMeasure",allowsMultiple:!0}),Object.assign(Object.assign({},null===(t=cr.data_panel.labelled_metrics)||void 0===t?void 0:t.subSectionDefinition.bar),{propKey:"barMeasure",allowsMultiple:!0})]}),Gt(cr,"combo_chart_dimension"),Gt(cr,"sort"),Gt(cr,"filter"),Gt(cr,"custom_metrics"),Gt(cr,"limit")]},formatPanelConfig:()=>{var e,t,r,n,i,a,o,s,l,u;return[Vt(cr),Yt(cr,!1,!0),Ht(cr),Object.assign(Object.assign({},Gt(cr,"conditional_formatting")),{ruleType:"backgroundColor",subSection:[{title:null!==(r=null===(t=null===(e=cr.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=cr.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===(o=null===(a=cr.format_panel.conditional_formatting)||void 0===a?void 0:a.subSectionDefinition)||void 0===o?void 0:o.line.title)&&void 0!==s?s:"",namespace:null===(u=null===(l=cr.format_panel.conditional_formatting)||void 0===l?void 0:l.subSectionDefinition)||void 0===u?void 0:u.line.namespace,propKey:"line"}]}),Gt(cr,"goal_line")]},supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0},supportedFeatures:{parameters:!1,colorGradient:!1}}),pr=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(de),exportNames:L().object(),numberFormat:L().object(),conditionalFormattingRules:pe(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.")})),fr=e=>(t,r)=>{let n=M(t,r,pr(e));return n=P(n),n},hr={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:""}}},mr=[3,5,10,20,50,100,200],gr=(e,t)=>e.filter((e=>e.pivot==t)),yr=e=>({title:hr.title,description:hr.description,servicesClass:"PivotTable",namespace:hr.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=kt({timeDimension:t.timeDimension,dimension:O(t.dimension)}),i.map((e=>Object.assign(Object.assign({},e),{pivot:e.pivot?e.pivot:"x"})))),displaySubject:t.displaySubject,protectedByOrganisation:t.protectedByOrganisation,protectedFields:qt(t.protectedFields),viewId:Pt(t.viewId),filter:d(t.filter),dataSetId:t.dataSetId,limit:t.limit,offset:t.offset,conditionalFormattingRules:$t(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(Mt):n||[]),tags:null!==(r=t.tags)&&void 0!==r?r:[]}},setAttributes:fr(e),validate:(t,r)=>xt(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:pr(e),removeField:(t,r)=>F(t,r,e.queryEngineConfig),isRunnable:e=>e.measure.length>0,autoGenerate(t){const{measure:r,dimension:n}=wt(t,e.queryEngineConfig,"dataTable");return this.init(t.id,{measure:r.slice(0,5),dimension:n})},dataPanelConfig:()=>[Gt(hr,"data_set"),Gt(hr,"views"),Object.assign(Object.assign({},Gt(hr,"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"}))),...gr(r.dimension,"x")]}),getValues:e=>gr(e.dimension,"y"),testId:"add-pivot-dimension"}),Object.assign(Object.assign({},Gt(hr,"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"}))),...gr(r.dimension,"y")]}),getValues:e=>gr(e.dimension,"x"),testId:"add-dimension"}),Object.assign(Object.assign({},Gt(hr,"drilldown")),{options:{maxOptions:1,property:"tableDrilldown"}}),Object.assign(Object.assign({},Gt(hr,"field_metrics")),{fieldFilterOptions:{forComponent:"dataTable"},preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"}),Gt(hr,"sort"),Object.assign(Object.assign({},Gt(hr,"pagination")),{options:mr}),Gt(hr,"filter"),Gt(hr,"custom_metrics")],formatPanelConfig:()=>{var e;return[Vt(hr),Object.assign(Object.assign({},Gt(hr,"format")),{subSection:[null===(e=hr.format_panel.format)||void 0===e?void 0:e.subSectionDefinition.time]}),Gt(hr,"prefixes"),Object.assign(Object.assign({},Gt(hr,"conditional_formatting")),{ruleType:"backgroundColor"})]},supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0},supportedFeatures:{parameters:!1,colorGradient:!0}}),br=L().object({field:L().string().required(),function:L().valid("none").required()}),vr=e=>L().object(Object.assign(Object.assign({},W(e.attributesSchemaOptions)),{type:L().valid("basicTable").required(),measure:L().array().items(br).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(de),exportNames:L().object(),numberFormat:L().object(),conditionalFormattingRules:pe(e.queryEngineConfig),dateTimeFormat:L().string(),protectedFields:L().object({measure:ee(e.queryEngineConfig)}).unknown(!0),sizing:le,tags:z()})),_r=e=>(t,r)=>{let n=M(t,r,vr(e));return n=D(n,[...n.measure]),n},Ar={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:""}}},wr=e=>({title:Ar.title,description:Ar.description,servicesClass:"BasicTable",namespace:Ar.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:O(t.dimension),viewId:Pt(t.viewId),protectedFields:qt(t.protectedFields),conditionalFormattingRules:$t(e.queryEngineConfig,t.conditionalFormattingRules),tags:null!==(r=t.tags)&&void 0!==r?r:[]})},setAttributes:_r(e),validate:(t,r)=>xt(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 _r(e)(n,r||{})},schema:vr(e),removeField:(t,r)=>F(t,r,e.queryEngineConfig),setFields:function(t,r){const n=[...r].map((e=>({field:e,function:"none"})));return _r(e)(t,{measure:n})},setDateTimeFormat:function(e,t){return this.setAttributes(e,{dateTimeFormat:t})},isRunnable:e=>e.measure.length>0,autoGenerate(e){const t=[...gt(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:()=>[Gt(Ar,"data_set"),Gt(Ar,"views"),Gt(Ar,"fields"),Gt(Ar,"sort"),Object.assign(Object.assign({},Gt(Ar,"pagination")),{options:mr}),Gt(Ar,"filter"),Gt(Ar,"custom_metrics")],formatPanelConfig:()=>{var e;return[Vt(Ar),Object.assign(Object.assign({},Gt(Ar,"format")),{subSection:[null===(e=Ar.format_panel.format)||void 0===e?void 0:e.subSectionDefinition.time]}),Gt(Ar,"prefixes"),Object.assign(Object.assign({},Gt(Ar,"conditional_formatting")),{ruleType:"backgroundColor"})]},supportedCustomFields:{percentages:!1,simpleMaths:!0,rules:!0,aggregateMaths:!1,roundedNumbers:!0,dateCalculations:!1,conditional:!0},supportedFeatures:{parameters:!1,colorGradient:!0}}),Sr=e=>(t,r)=>{let n=M(t,r,fe(e));return n=P(n),n},Tr={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:""}}},Er=e=>({title:Tr.title,description:Tr.description,servicesClass:"HorizontalBarChart",namespace:Tr.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:O(e.dimension),viewId:Pt(e.viewId),filter:d(e.filter),approxXAxisLabelCount:h(e.approxXAxisLabelCount),approxYAxisLabelCount:h(e.approxYAxisLabelCount),protectedFields:qt(e.protectedFields),tags:null!==(t=e.tags)&&void 0!==t?t:[]})},setAttributes:Sr(e),validate:(t,r)=>xt(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:[],drilldownOptions:void 0},t),createFeedback:Ot,schema:fe(e),removeField:(t,r)=>F(t,r,e.queryEngineConfig),isRunnable:e=>e.measure.length>0,autoGenerate(t){const{measure:r,dimension:n}=wt(t,e.queryEngineConfig,"horizontalBarChart");return this.init(t.id,{measure:[r[0]],dimension:n})},dataPanelConfig:()=>[Gt(Tr,"data_set"),Gt(Tr,"views"),Object.assign(Object.assign({},Gt(Tr,"field_y_axis")),{fieldFilterOptions:{forComponent:"horizontalBarChart"},preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"}),Object.assign(Object.assign({},Gt(Tr,"field_x_axis")),{fieldFilterOptions:{forComponent:"horizontalBarChart",onlyDimensions:!0},preventDuplicates:!0,preSetPartialAttributes:(e,t)=>Lt(e,t),getValues:e=>kt(e),maxAllowed:2,testId:"add-dimension"}),Gt(Tr,"sort"),Gt(Tr,"filter"),Object.assign(Object.assign({},Gt(Tr,"drilldown")),{options:{property:"drilldownOptions"}}),Gt(Tr,"custom_metrics"),Gt(Tr,"limit")],formatPanelConfig:()=>[Vt(Tr),Yt(Tr,!1,!0),Ht(Tr),Object.assign(Object.assign({},Gt(Tr,"conditional_formatting")),{ruleType:"backgroundColor"}),Gt(Tr,"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 Nt(e,t,this.setAttributes)}}),xr=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:pe(e.queryEngineConfig),parameters:ie(e.queryEngineConfig,e.attributesSchemaOptions),goalLines:ae(),axisTitles:se(),headline:oe(),tags:z()})),Or=e=>(t,r)=>{let n=M(t,r,xr(e));return n=P(n),n},Cr={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"}}},rich_text:{type:"richText",title:"Text format"},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:""}}},Ir=e=>({title:Cr.title,description:Cr.description,servicesClass:"AreaChart",namespace:Cr.namespace,dump:e=>e,load:t=>{var r;return{type:t.type,measure:f(t.measure),displayTitle:t.displayTitle,dimension:O(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:$t(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:Wt(t.headline,t.timeDimension),tags:null!==(r=t.tags)&&void 0!==r?r:[]}},setAttributes:Or(e),validate:(t,r)=>xt(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:Ot,schema:xr(e),removeField:(t,r)=>F(t,r,e.queryEngineConfig),isRunnable:e=>e.measure.length>0,autoGenerate(t){const{measure:r,dimension:n}=wt(t,e.queryEngineConfig,"areaChart");return this.init(t.id,{measure:[r[0]],dimension:n})},dataPanelConfig:()=>[Gt(Cr,"data_set"),Gt(Cr,"views"),Object.assign(Object.assign({},Gt(Cr,"field_y_axis")),{fieldFilterOptions:{forComponent:"areaChart"},preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"}),Object.assign(Object.assign({},Gt(Cr,"field_x_axis")),{fieldFilterOptions:{forComponent:"areaChart",onlyDimensions:!0},preventDuplicates:!0,preSetPartialAttributes:(e,t)=>Lt(e,t),getValues:e=>kt(e),maxAllowed:2,testId:"add-dimension"}),Gt(Cr,"sort"),Gt(Cr,"filter"),Gt(Cr,"custom_metrics"),Gt(Cr,"limit")],formatPanelConfig:()=>{var e,t,r;return[Vt(Cr),Object.assign(Object.assign({},Gt(Cr,"chart_styles")),{subSection:[null===(e=Cr.format_panel.chart_styles)||void 0===e?void 0:e.subSectionDefinition.stacked,null===(t=Cr.format_panel.chart_styles)||void 0===t?void 0:t.subSectionDefinition.legend,null===(r=Cr.format_panel.chart_styles)||void 0===r?void 0:r.subSectionDefinition.curve]}),Ht(Cr),Object.assign(Object.assign({},Gt(Cr,"conditional_formatting")),{ruleType:"areaColor"}),Gt(Cr,"goal_line"),Gt(Cr,"headline")]},supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0},supportedFeatures:{parameters:!0,colorGradient:!1}}),jr=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:pe(e.queryEngineConfig),deltaTimeDimension:L().alternatives(U(e.queryEngineConfig.supportedTimeTruncFunctions),L().valid(null)),parameters:ie(e.queryEngineConfig,e.attributesSchemaOptions),tags:z()})),Rr=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)})},Dr={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"}}}}},Fr=e=>({title:Dr.title,description:Dr.description,servicesClass:"SingleStat",namespace:Dr.namespace,dump:e=>e,load:e=>{var t;const r=Rr(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)=>M(t,r,jr(e)),validate:(t,r)=>xt(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:jr(e),removeField:(t,r)=>F(t,r,e.queryEngineConfig),isRunnable:e=>e.measure.length>0,autoGenerate(t){const{measure:r}=wt(t,e.queryEngineConfig,"singleStat");return this.init(t.id,{measure:[r[0]]})},dataPanelConfig:()=>[Gt(Dr,"data_set"),Gt(Dr,"views"),Object.assign(Object.assign({},Gt(Dr,"field_metrics")),{fieldFilterOptions:{forComponent:"singleStat"},preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"}),Gt(Dr,"filter"),Gt(Dr,"custom_metrics"),Gt(Dr,"comparison")],formatPanelConfig:()=>{var e;return[Vt(Dr),Object.assign(Object.assign({},Gt(Dr,"stats_labels")),{prefix:Xt(Dr,"prefix"),postfix:Xt(Dr,"postfix"),format:Xt(Dr,"format"),count:Xt(Dr,"count")}),Object.assign(Object.assign({},Gt(Dr,"format")),{subSection:[null===(e=Dr.format_panel.format)||void 0===e?void 0:e.subSectionDefinition.font_size]}),Object.assign(Object.assign({},Gt(Dr,"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)(gt(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({},W(e.attributesSchemaOptions)),{type:L().valid("custom").required(),customViewId:L().string().required(),tags:z()})),Mr={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"}}}}},Nr=e=>({title:Mr.title,description:Mr.description,namespace:Mr.namespace,servicesClass:"Custom",dump:e=>e,load:e=>{var t;return{type:"custom",viewId:Pt(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)=>M(t,r,Pr(e)),validate:(t,r)=>xt(t,r,e.queryEngineConfig),init:(e,t)=>({type:"custom",viewId:Pt(null==t?void 0:t.viewId),customViewId:(null==t?void 0:t.customViewId)||"",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:()=>[Gt(Mr,"data_set"),Gt(Mr,"views")],formatPanelConfig:()=>[Vt(Mr)],supportedCustomFields:{percentages:!1,simpleMaths:!1,rules:!1,aggregateMaths:!1,roundedNumbers:!1,dateCalculations:!1,conditional:!1},supportedFeatures:{colorGradient:!1,parameters:!1}}),Lr=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()})),kr=e=>(t,r)=>M(t,r,Lr(e)),qr={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:""}}},$r=e=>({title:qr.title,description:qr.description,servicesClass:"MercatorMap",namespace:qr.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:kr(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:Lr(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:()=>[Gt(qr,"data_set"),Gt(qr,"views"),Object.assign(Object.assign({},Gt(qr,"field_metrics")),{type:"fieldCollector",fieldFilterOptions:{forComponent:"mercatorMap"},maxAllowed:1,preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"}),Object.assign(Object.assign({},Gt(qr,"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"}),Gt(qr,"filter"),Gt(qr,"custom_metrics"),Gt(qr,"limit")],formatPanelConfig:()=>{var e;return[Vt(qr),Object.assign(Object.assign({},Gt(qr,"chart_styles")),{subSection:[null===(e=qr.format_panel.chart_styles)||void 0===e?void 0:e.subSectionDefinition.number_format]}),Gt(qr,"map_colors")]},supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0},supportedFeatures:{parameters:!1,colorGradient:!1}}),zr=e=>L().object(Object.assign(Object.assign(Object.assign({},W(e.attributesSchemaOptions)),Z(e.queryEngineConfig,e.attributesSchemaOptions)),{type:L().valid("richText").required(),tags:z(),content:L().any()})),Br=e=>(t,r)=>M(t,r,zr(e)),Gr={title:"Rich text",description:"Add your data to a rich text component.",namespace:"rich_text",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this rich text view?"},views:{type:"views",title:"View",description:""},field_metrics:{type:"fieldCollector",title:"Metrics",description:"What metrics do you need to collect?",callToAction:"Add metric"},field_grouping:{type:"fieldCollector",title:"Grouping",description:"How do you want to group your results?",callToAction:"Add grouping"},sort:{type:"sort",title:"Sort",description:"How should the results be ordered?"},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this text view."},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 use on this text view."}},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"}}},rich_text:{type:"richText",title:"Text format",description:""}}},Ur={type:"doc",content:[{type:"heading",attrs:{level:1},content:[{type:"text",text:"Rich text views"}]},{type:"paragraph",content:[{type:"text",text:"In this view, you can add any "},{type:"text",marks:[{type:"bold"}],text:"text based content"},{type:"text",text:" to your dashboard, and "},{type:"text",marks:[{type:"italic"}],text:"mix in your data with it!"}]},{type:"paragraph",content:[{type:"text",text:"Remember to use the "},{type:"text",marks:[{type:"bold"}],text:"format"},{type:"text",text:" "},{type:"text",marks:[{type:"bold"}],text:"tab"},{type:"text",text:" to "},{type:"text",marks:[{type:"underline"}],text:"style"},{type:"text",text:" your contents"}]},{type:"heading",attrs:{level:2},content:[{type:"text",text:"Adding data?"}]},{type:"paragraph",content:[{type:"text",text:"You can add data to your text content by using templating. For example, is how to take metrics "},{type:"text",marks:[{type:"code"}],text:'"Metric Name"'},{type:"text",text:" and "},{type:"text",marks:[{type:"code"}],text:'"A different metric name" '},{type:"text",text:"from the first row of the results, and show it on this view;"}]},{type:"codeBlock",attrs:{language:null},content:[{type:"text",text:"{{ data.first.metric_name }}\n{{ data.first.a_different_metric_name }}\n"}]}]},Vr=e=>({title:Gr.title,description:Gr.description,servicesClass:"RichText",namespace:Gr.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:"richText",dimension:e.dimension,limit:e.limit,measure:f(e.measure),filter:d(e.filter),tags:null!==(t=e.tags)&&void 0!==t?t:[],content:e.content||"",order:e.order||[],timeDimension:e.timeDimension||null}},setAttributes:Br(e),validate:()=>[],init:(e,t)=>Object.assign({type:"richText",dataSetId:e,dimension:[],measure:[],displaySubject:"",displayTitle:"",limit:5e3,filter:[],viewId:Pt(null==t?void 0:t.viewId),tags:[],order:[],timeDimension:null,content:Ur},t),schema:zr(e),removeField:(e,t)=>e,isRunnable:e=>!(!e.measure||!e.measure[0]),autoGenerate(e){return this.init(e.id)},dataPanelConfig:()=>[Gt(Gr,"data_set"),Gt(Gr,"views"),Object.assign(Object.assign({},Gt(Gr,"field_metrics")),{fieldFilterOptions:{forComponent:"richText",onlyMeasures:!0},preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"}),Object.assign(Object.assign({},Gt(Gr,"field_grouping")),{fieldFilterOptions:{forComponent:"richText",onlyDimensions:!0},preventDuplicates:!0,preSetPartialAttributes:(e,t)=>Lt(e,t),getValues:e=>kt(e),maxAllowed:2,testId:"add-dimension"}),Gt(Gr,"sort"),Gt(Gr,"filter"),Gt(Gr,"custom_metrics"),Gt(Gr,"limit")],formatPanelConfig:()=>[Vt(Gr),Object.assign({},Gt(Gr,"rich_text"))],supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0},supportedFeatures:{parameters:!1,colorGradient:!1}});var Hr;!function(e){e.Linear="linear",e.Circular="circular"}(Hr||(Hr={}));const Yr=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:pe(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(Hr.Linear,Hr.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()})),Xr={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:Xr.title,description:Xr.description,dump:e=>e,namespace:Xr.namespace,servicesClass:"Progress",load:e=>{var t;const r=Rr(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)=>M(t,r,Yr(e)),validate:(t,r)=>xt(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:Yr(e),removeField:(t,r)=>F(t,r,e.queryEngineConfig),isRunnable:e=>e.measure.length>0,autoGenerate(e){return this.init(e.id)},dataPanelConfig:()=>[Gt(Xr,"data_set"),Gt(Xr,"views"),Gt(Xr,"progress_goals"),Gt(Xr,"filter"),Gt(Xr,"custom_metrics")],formatPanelConfig:()=>[Vt(Xr),Gt(Xr,"progress_type"),Object.assign(Object.assign({},Gt(Xr,"stats_labels")),{prefix:Xt(Xr,"prefix"),postfix:Xt(Xr,"postfix"),format:Xt(Xr,"format"),count:Xt(Xr,"count")})],supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,aggregateMaths:!0,rules:!0,roundedNumbers:!0,conditional:!0},supportedFeatures:{parameters:!1,colorGradient:!1}}),Kr=e=>(t,r)=>{let n=M(t,r,fe(e));return n=P(n),n},Qr={title:"Funnel chart",description:"Track conversion between stages of a process.",namespace:"funnel_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"},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:{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:""}}},Zr=e=>({title:Qr.title,description:Qr.description,servicesClass:"FunnelChart",namespace:Qr.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:O(e.dimension),viewId:Pt(e.viewId),filter:d(e.filter),approxXAxisLabelCount:h(e.approxXAxisLabelCount),approxYAxisLabelCount:h(e.approxYAxisLabelCount),protectedFields:qt(e.protectedFields),tags:null!==(t=e.tags)&&void 0!==t?t:[]})},setAttributes:Kr(e),validate:(t,r)=>xt(t,r,e.queryEngineConfig),init:(e,t)=>Object.assign({type:"funnelChart",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,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",axisTitles:void 0,tags:[]},t),createFeedback:Ot,schema:fe(e),removeField:(t,r)=>F(t,r,e.queryEngineConfig),isRunnable:e=>e.measure.length>0,autoGenerate(t){const{measure:r,dimension:n}=wt(t,e.queryEngineConfig,"funnelChart");return this.init(t.id,{measure:[r[0]],dimension:n})},dataPanelConfig:()=>[Gt(Qr,"data_set"),Gt(Qr,"views"),Object.assign(Object.assign({},Gt(Qr,"field_y_axis")),{fieldFilterOptions:{forComponent:"funnelChart"},preSetPartialAttributes:e=>({measure:e}),allowsMultiple:!1,maxAllowed:1,getValues:e=>e.measure,testId:"metric-input"}),Object.assign(Object.assign({},Gt(Qr,"field_x_axis")),{fieldFilterOptions:{forComponent:"funnelChart",onlyDimensions:!0},allowsMultiple:!1,preventDuplicates:!0,preSetPartialAttributes:(e,t)=>Lt(e,t),getValues:e=>kt(e),maxAllowed:1,testId:"add-dimension"}),Gt(Qr,"sort"),Gt(Qr,"filter"),Gt(Qr,"custom_metrics"),Gt(Qr,"limit")],formatPanelConfig:()=>[Vt(Qr),Yt(Qr,!1,!1),Ht(Qr),Object.assign(Object.assign({},Gt(Qr,"conditional_formatting")),{ruleType:"backgroundColor"}),Gt(Qr,"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 Nt(e,t,this.setAttributes)}}),Jr=["title","description","data_panel","format_panel"],en=["title","description","callToAction"],tn="call_to_action",rn=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}}"}),nn=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,an=/<style\b[^<]*(?:(?!<\/style>)<[^<]*)*<\/style>/gi,on=/on[a-z]+\s*=\s*["'][^"']*["']/gi,sn=/javascript:[^\s"']+/gi,ln=new RegExp(`^(?:${/<(b|strong)>(?:(?!<\/(b|strong)>).)*<\/(b|strong)>/.source}|${/<(i|em)>(?:(?!<\/(i|em)>).)*<\/(i|em)>/.source}|[^*_<>])*$`,"m"),un=e=>{if(nn.test(e)||an.test(e)||on.test(e)||sn.test(e))throw new Error("Invalid content: potentially malicious elements detected.");return ln.test(e)},cn=(e,t,r,n)=>dn(e,t,r,void 0,n),dn=(e,t,r,n,i)=>{if(i)return`[key: ${e}]`;const a=n?function(e,t){const r=e[t],n=rn.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 un(r);if("object"==typeof r)return un(r.sentence);if(void 0===r)return!0;throw new Error("Invalid translation type")})()?r:void 0}(n,e):void 0;let o;return o="object"==typeof a&&null!==a?a.sentence:"string"==typeof a?a:t,o=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""}))}(o,r),r&&(o=function(e,t,r){return Object.entries(t).forEach((([t,n])=>{if(n&&"object"==typeof n&&"count"in n){const i=n,a=1===i.count?r&&r[`${t}_singular`]||i.singular:r&&r[`${t}_plural`]||i.plural;e=e.replace(new RegExp(`{{${t}}}`,"g"),a)}})),e}(o,r,a)),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}(o,r)},pn=(e,t)=>{const r=null!=t?t:dn;let n=e;const i=e.namespace;return Jr.forEach((t=>{if("title"===t||"description"===t){const a=r(`${i}.${t}`,e[t]);n=Object.assign(Object.assign({},n),{[t]:a})}if("data_panel"===t){const a=`${i}.${t}`,o=[];e.dataPanelConfig().forEach((e=>{e.subSection&&(e.subSection=hn(e,r,a)),mn(e).forEach((t=>{const n=r(`${a}.${t.key}`,t.defaultValue);e[t.property]=n})),o.push(e)})),n=Object.assign(Object.assign({},n),{dataPanelConfig:()=>o})}if("format_panel"===t){const a=`${i}.${t}`,o=[];e.formatPanelConfig().forEach((e=>{e.subSection&&(e.subSection=hn(e,r,a)),function(e,t,r){function n(r,n){r&&mn(r).forEach((i=>{const a=e(`${t}.${n}.${i.key}`,i.defaultValue);r[i.property]=a}))}function i(e,t,r){t.forEach((t=>{const i=e[t];i&&n(i,r)}))}r.x&&(i(r.x,fn,"axis_labels"),n(r.x,"axis_labels")),r.y&&(i(r.y,fn,"axis_labels"),n(r.y,"axis_labels")),function(e){return"prefix"in e}(r)&&i(r,fn,"stats_labels")}(r,a,e),mn(e).forEach((t=>{const n=r(`${a}.${t.key}`,t.defaultValue);e[t.property]=n})),o.push(e)})),n=Object.assign(Object.assign({},n),{formatPanelConfig:()=>o})}})),n},fn=["count","axisTitle","format","postfix","prefix"];function hn(e,t,r){var n;return null===(n=e.subSection)||void 0===n?void 0:n.map((n=>(mn(n).forEach((i=>{const a=t(`${r}.${e.namespace}.${i.key}`,i.defaultValue);n[i.property]=a})),n)))}function mn(e){const t=e.namespace||e.type;if(!t)return[];const r=[];return en.forEach((n=>{if(e[n]){let i=n;"callToAction"===n&&(i=tn),r.push({key:`${t}.${i}`,defaultValue:e[n],property:n})}})),r}const gn={queryEngineConfig:{supportedFeatures:[],supportedAggregates:{},supportedTimeTruncFunctions:{},supportedOperators:{},supportedTransformationFunctions:{}}},yn=function(e,t){if("areaChart"==e)return pn(Ir(t||gn),null==t?void 0:t.textOverride);if("barChart"==e)return pn(Kt(t||gn),null==t?void 0:t.textOverride);if("basicTable"==e)return pn(wr(t||gn),null==t?void 0:t.textOverride);if("comboChart"==e)return pn(dr(t||gn),null==t?void 0:t.textOverride);if("custom"==e)return pn(Nr(t||gn),null==t?void 0:t.textOverride);if("dataTable"==e)return pn(yr(t||gn),null==t?void 0:t.textOverride);if("funnelChart"==e)return pn(Zr(t||gn),null==t?void 0:t.textOverride);if("richText"==e)return pn(Vr(t||gn),null==t?void 0:t.textOverride);if("horizontalBarChart"==e)return pn(Er(t||gn),null==t?void 0:t.textOverride);if("lineChart"==e)return pn(er(t||gn),null==t?void 0:t.textOverride);if("mercatorMap"==e)return pn($r(t||gn),null==t?void 0:t.textOverride);if("pieChart"==e)return pn(nr(t||gn),null==t?void 0:t.textOverride);if("progress"==e)return pn(Wr(t||gn),null==t?void 0:t.textOverride);if("scatterChart"==e)return pn(sr(t||gn),null==t?void 0:t.textOverride);if("singleStat"==e)return pn(Fr(t||gn),null==t?void 0:t.textOverride);throw`Cannot get interface for ${e}. Please implement it.`};["barChart","horizontalBarChart","funnelChart","areaChart","lineChart","scatterChart","pieChart","singleStat","dataTable","basicTable","comboChart","mercatorMap","progress","richText","custom"].filter((e=>"custom"!=e)),r(8143);const bn=350,vn={colors:["#feae4a","#5fbaff","#e15e9d"],detail:"minimal",fontFamily:"Inter, sans-serif",rowLimit:6,fontSize:"0.65rem"},_n=e=>"displayTitle"in e,An=e=>({colSpan:e,isEmpty:!0}),wn=e=>"isEmpty"in e,Sn=e=>{const r=[...e],n=(0,t.sumBy)(r,(e=>e.colSpan));return 12==n||(r[r.length-1].colSpan+=12-n),r},Tn=e=>!(e&&wn(e)&&e.colSpan<=0),En=(e,r)=>e.map((e=>((e,r)=>{const n=(e=>"components"in e?e:{components:e,height:bn})(e),i=n.components.filter(Tn).map((e=>e&&e.colSpan<=0?Object.assign(Object.assign({},e),{colSpan:1}):e)),a=(0,t.sumBy)(i,(e=>null==e?1:0)),o=12-(0,t.sumBy)(i,(e=>null==e?0:e.colSpan)),s=Math.floor(o/a),l=[...i].map((e=>null===e?{isEmpty:!0,colSpan:s}:wn(e)||_n(e)?e:xn(Object.assign(Object.assign({},e),{colSpan:e.colSpan}),r)));return{components:Sn(l),height:n.height||bn}})(e,r))),xn=(e,r)=>{if("isEmpty"in e||_n(e))return e;const{load:n}=yn(e.attributes.type,r),i=n(e.attributes);let a=[];return(0,t.isArray)(e.localFilters)&&(a=[...e.localFilters?e.localFilters:[]].map((e=>We(e)))),"addOns"in e.attributes&&(0,t.isEmpty)(a)&&e.attributes.addOns.forEach((e=>{a=[...a,{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:a,attributes:i,results:[]})},On=e=>L().alternatives().conditional(".type",{is:"barChart",then:Kt(e).schema}).conditional(".type",{is:"richText",then:Vr(e).schema}).conditional(".type",{is:"mercatorMap",then:$r(e).schema}).conditional(".type",{is:"horizontalBarChart",then:Er(e).schema}).conditional(".type",{is:"lineChart",then:er(e).schema}).conditional(".type",{is:"comboChart",then:dr(e).schema}).conditional(".type",{is:"areaChart",then:Ir(e).schema}).conditional(".type",{is:"pieChart",then:nr(e).schema}).conditional(".type",{is:"scatterChart",then:sr(e).schema}).conditional(".type",{is:"singleStat",then:Fr(e).schema}).conditional(".type",{is:"dataTable",then:yr(e).schema}).conditional(".type",{is:"basicTable",then:wr(e).schema}).conditional(".type",{is:"progress",then:Wr(e).schema}).conditional(".type",{is:"custom",then:Nr(e).schema}).conditional(".type",{is:"funnelChart",then:Zr(e).schema}),Cn=L().object({displayTitle:L().string().min(1).required(),colSpan:L().number().valid(12).required()}),In=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'}),jn=L().object({isEmpty:L().valid(!0).required(),colSpan:In}),Rn=e=>L().object({attributes:On({queryEngineConfig:e}),colSpan:In}),Dn=e=>L().object({id:L().string(),display:Fn(e),componentLibrary:L().array().required().items(L().object({attributes:On({queryEngineConfig:e})})),globalFilters:dt(e),customFields:L().object().required()});function Fn(e){return L().array().required().items(L().object({height:L().number().required(),components:L().array().required().min(1).items(L().alternatives(jn,Rn(e),Cn))}))}const Pn=(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=>We(e))),componentLibrary:[...e.definition.componentLibrary||[]].map((e=>xn(Object.assign(Object.assign({},e),{colSpan:(null==e?void 0:e.colSpan)||1}),r))),theme:Object.assign(Object.assign({},vn),e.theme),display:En(e.definition.display,r),webhookId:e.webhook_id||null,createdAt:new Date(e.created_at),updatedAt:new Date(e.updated_at),metadata:e.metadata||{}}},Mn=(e,t,r)=>Object.assign(Object.assign({},e),{dataSets:St(t,r)});const Nn=(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 Ln(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 kn=e=>{e.library.views=[],e.library.customFields={}};class qn extends Error{constructor(e){super(e),this.name="FailedToLoadQueryEngineConfig"}}const $n=qn;class zn extends Error{constructor(e){super(`The queryEngineEndpoint value '${e}' is not valid.`),this.name="InvalidQueryEngineEndpoint",this.invalidEndpoint=e}}const Bn=zn;class Gn 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 Un=Gn;var Vn=r(288),Hn=r.n(Vn);const Yn=e=>e.startsWith("/")?Yn(e.slice(1)):e.endsWith("/")?Yn(e.slice(0,-1)):e;var Xn=function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(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(o,s)}l((n=n.apply(e,t||[])).next())}))};const Wn=(e,t)=>Xn(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,a=void 0,s=function*(){let i={};r&&(i.auth=`Bearer ${r}`);let a="";n&&(a=`filter=${n.join(",")}`);const{status:o,body:s}=yield e({path:`/api/v2/auth/project/${t}/access_token?${a}`,method:"get",headers:i});if(200==o)return s.token.token},new((o=void 0)||(o=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 o?i:new o((function(e){e(i)}))).then(r,n)}l((s=s.apply(i,a||[])).next())}));var i,a,o,s})(Kn(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{}})),Kn=e=>t=>Xn(void 0,void 0,void 0,(function*(){var r;try{const r=yield Wn(e,t),n=t.headers||{},i=((e,t)=>{const r=Yn(e),n=Yn(t),i=(a=e).startsWith("https://")||a.startsWith("http://")||a.startsWith(".")?"":"/";var a;return""==r&&""==n?"/":""==n?`${i}${r}`:""!=r&&""!=n?`${i}${r}/${n}`:`${i}${n}`})(e.host,t.path),a=yield Hn()(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 o=yield a.json();return w("HTTP Client Response",{host:e.host,path:t.path,status:a.status,responseId:a.headers.get("X-Request-Id")}),{body:o,status:a.status,headers:a.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}})),Qn=e=>"string"==typeof e?e:e.endpoint;const Zn=e=>"string"==typeof e?{}:e.customHeaders?e.customHeaders():{},Jn=e=>t=>{return r=void 0,n=void 0,a=function*(){const r={host:Qn(e)},n=Object.assign(Object.assign({},t),{headers:Object.assign(Object.assign({},t.headers),Zn(e))});return Kn(r)(n)},new((i=void 0)||(i=Promise))((function(e,t){function o(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 r;t.done?e(t.value):(r=t.value,r instanceof i?r:new i((function(e){e(r)}))).then(o,s)}l((a=a.apply(r,n||[])).next())}));var r,n,i,a};const ei=e=>{return t=void 0,r=void 0,i=function*(){const t=Jn(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,a){function o(e){try{l(i.next(e))}catch(e){a(e)}}function s(e){try{l(i.throw(e))}catch(e){a(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(o,s)}l((i=i.apply(t,r||[])).next())}));var t,r,n,i},ti=a.QueryEngineConfig.getQueryEngineConfig("js");const ri=e=>{let t="string"==typeof e?e:e.endpoint;return!!t.startsWith("http://")||!!t.startsWith("https://")||!!t.startsWith("/")};class ni extends Error{constructor(e){super(e),this.name="FailedToLoadIdentity"}}const ii=ni;class ai extends Error{constructor(e){super(e),this.name="InvalidIdentityReturn"}}const oi=ai,si=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 li=e=>{return t=void 0,r=void 0,i=function*(){let t=yield e();if(t=(e=>{if(!e)throw new oi("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 oi(t.message);return e})(t),!t)throw new ii("Failed to fetch identity config.");const r=ui()&&((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=si(e);"scope"in i||(i.scope="read_write");const a={dashboardAccess:i,dataAccess:t?si(t):void 0,queryEngineAccessConfig:r?si(r):void 0,dashboardAdminOverride:n?si(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)})(a),a})(t.dashboardAccessToken,t.dataAccessToken,t.queryEngineAccessToken,r),tokens:t}},new((n=void 0)||(n=Promise))((function(e,a){function o(e){try{l(i.next(e))}catch(e){a(e)}}function s(e){try{l(i.throw(e))}catch(e){a(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(o,s)}l((i=i.apply(t,r||[])).next())}));var t,r,n,i},ui=()=>"undefined"!=typeof window,ci=[{namespace:"config.supported_operator",constants:l},{namespace:"config.supported_aggregate",constants:g},{namespace:"config.supported_time",constants:o}],di=(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 pi extends Error{constructor(){super("Identity prop type is invalid."),this.name="InvalidIdentityPropType"}}const fi=pi;class hi extends Error{constructor(e){super(e),this.name="FailedToResolveDataSets"}}const mi=hi;class gi extends Error{constructor(){super("dataSets property is not valid"),this.name="InvalidDataSetsPropType"}}const yi=gi;var bi=function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(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(o,s)}l((n=n.apply(e,t||[])).next())}))};L().function();const vi=e=>t=>bi(void 0,void 0,void 0,(function*(){var r,n,i,a,o,s,l;return yield(n=e,i=null===(r=t.dataAccess)||void 0===r?void 0:r.signature,a=void 0,o=void 0,s=void 0,l=function*(){const e=Jn(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 mi(`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(a,o||[])).next())})))})),_i=(t,r)=>(n,i)=>bi(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 vi(t);throw new yi})(t,r);if("function"!=typeof e)throw new yi;let a=yield e(n,i);if(!a)throw new mi("Failed to fetch data sets from the query engine endpoint");return a.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 yi)throw t;if(t instanceof e.Errors.FailedToResolveDataSets)throw new mi(t.message);throw new mi("Failed to fetch data sets.")}}));var Ai=function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(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(o,s)}l((n=n.apply(e,t||[])).next())}))};const wi={apiHost:"https://api.vizzly.co"},Si="in-browser";class Ti{constructor(e,t,r,n=wi){this.queryEngineConfig=void 0,this.dataSets=void 0,this.queryEngine=e||Si,this.loadAccessTokens=t,this.loadDataSetsCallback=r,this.options=Object.assign(Object.assign({},wi),n)}getQueryEngineConfig(){return Ai(this,void 0,void 0,(function*(){return this.queryEngineConfig||(this.queryEngineConfig=yield(e=this.queryEngine,t=this.loadDataSetsCallback,r=void 0,n=void 0,a=function*(){try{if("in-browser"===e)return ti;if("function"==typeof e){let t=yield e();if(!t)throw new $n("Failed to load query engine config.");return Object.assign({},t)}if(t){if(!ri(e))throw new Bn(e);return ti}if("string"==typeof e||"object"==typeof e&&"endpoint"in e){if(!ri(e))throw new Bn(e);const t=yield ei(e);if(!t)throw new $n("Failed to load query engine config.");return t}throw new Un}catch(e){if(T(e),e instanceof Bn)throw e;if(e instanceof Un)throw e;throw new $n("Failed to load query engine config.")}},new((i=void 0)||(i=Promise))((function(e,t){function o(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 r;t.done?e(t.value):(r=t.value,r instanceof i?r:new i((function(e){e(r)}))).then(o,s)}l((a=a.apply(r,n||[])).next())}))),this.queryEngineConfig=((e,t)=>{const r=Object.assign({},e);return r.supportedAggregates&&(r.supportedAggregates=di(r.supportedAggregates,t,ci[1].namespace)),r.supportedTimeTruncFunctions&&(r.supportedTimeTruncFunctions=di(r.supportedTimeTruncFunctions,t,ci[2].namespace)),r.supportedOperators&&(r.supportedOperators=di(r.supportedOperators,t,ci[0].namespace)),r})(this.queryEngineConfig,((e,t,r)=>dn(e,t,r,this.options.textOverrides,this.options.developerMode)))),this.queryEngineConfig;var e,t,r,n,i,a}))}getIdentity(){return Ai(this,void 0,void 0,(function*(){if("function"!=typeof this.loadAccessTokens)throw new fi;const{tokens:e,identityConfig:t}=yield li(this.loadAccessTokens);return{accessTokens:e,identityConfig:t}}))}getDataSets(){return Ai(this,void 0,void 0,(function*(){const{identityConfig:e}=yield this.getIdentity(),t=yield this.getQueryEngineConfig(),r=_i(this.loadDataSetsCallback,this.queryEngine);return this.dataSets=yield r(e,t),this.dataSets}))}load(){return Ai(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!==Si?{strategy:"queryEngine",endpoint:this.queryEngine}:{strategy:"vizzlyApi"}}}function Ei(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=ct(t,!!e.requiresValue),{error:i,value:a}=n.validate(e);if(i)throw T(`Invalid global filter configuration: ${i.message}`),i;r.push(a)})),r})(e,t);return r}class xi extends Error{}class Oi extends ge{constructor(e,t){super(`'Issue with Services in ${t}: '${e}'`),this.name="ServicesValidation"}}class Ci{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=An(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=Ei(e.localFilters,Na.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=Ei(e.localFilters,Na.use().getViewConfiguration().queryEngineConfig))}setColSpan(e){try{!function(e){const{error:t,value:r}=In.validate(e);if(t)throw new xi(t.message)}(e),this.colSpan=e}catch(e){throw new Oi(e,"Cell.setColSpan")}}setComponent(e){this.component=e,this.isEmpty=void 0}emptyCell(e){const t=An(null!=e?e:12);this.colSpan=t.colSpan,this.isEmpty=t.isEmpty,this.component=void 0}}class Ii{constructor(e,t){this.components=[],this.height=bn,this.components=null!=e?e:[],this.height=null!=t?t:bn,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:bn,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 ji{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:bn};this.component=[r]}setTitle(e){if(!this.component)throw new Error("Header is undefined");_n(this.component[0].components[0])&&(this.component[0].components[0].displayTitle=e)}}function Ri(e){let t=[];return e.forEach((e=>{var r,n;if(e instanceof Ii){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:bn,components:n})}e instanceof ji&&(null===(n=e.component)||void 0===n||n.forEach((e=>{t.push({height:e.height,components:e.components})})))})),t}const Di=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 Fi(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 xi(r.message)}const Pi=(e,t)=>Object.assign(Object.assign({},e),{attributes:Object.assign(Object.assign({},e.attributes),{viewId:t})});class Mi{constructor(e){this.vizzly=Na.use();const{init:t}=yn(e.type,{queryEngineConfig:this.vizzly.getViewConfiguration().queryEngineConfig});this.attributes=t(null==e?void 0:e.dataSetId,e)}updateAttributes(e){const{setAttributes:t}=yn(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 Ni 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 Li 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 ki={convert:!1,stripUnknown:!1,allowUnknown:!0},qi=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())),$i={convert:!1,stripUnknown:!1,allowUnknown:!0};var zi;!function(e){e.SAVING="saving",e.SAVED="saved",e.DELETED="deleted"}(zi||(zi={}));const Bi=(e,t)=>e.map((e=>e.map((({field:e,functionId:t})=>({id:I({field:e.id,function:t}),publicName:e.publicName,dataType:e.dataType}))))),Gi=(e,t,r)=>{const n=t.map((t=>{const n=yt(e,t.dataSetId);if(!n)throw"Data set not found for query attributes query";return Me(n,t.measure,t.order,t.filter,t.dimension,t.timeDimension,t.limit,t.offset,r)}));return{queries:n.map((e=>e.query)),resultFields:Bi([...n].map((e=>e.measureDescription)))}};function Ui(e,t){let r=e.optionsFilters?e.optionsFilters[t.dataSetId]:[];return null==r?void 0:r.filter((e=>e.field!==t.fieldId))}const Vi=(e,t,r,n)=>{const{query:i,measureDescription:a}=pt(t,e.measure,e.order,je(e.filter,r),e.dimension,e.timeDimension||null,e.limit,e.offset,n);return{queries:[i],resultFields:Bi([a])}},Hi=Vi,Yi=Vi,Xi=Vi,Wi=Vi,Ki=Vi,Qi=Vi,Zi=Vi,Ji=(e,t,r,n)=>{const{queries:i,measureDescription:a}=((e,t,r,n)=>{const i=((e,t,r,n)=>{let{query:i,measureDescription:a}=pt(r,e.measure,[],je(e.filter,t),[],null,1,e.offset,n);return i.measure=[{type:"number",value:0},...i.measure],a=[{field:{id:"single-stat-bumper-field",canBeDimension:!1,canBeMeasure:!1,publicName:"",dataType:"number",allowedOperators:[]},functionId:"none"},...a],{query:i,measureDescription:a}})(e,n,t,r);let a=null;return"deltaTimeDimension"in e&&(a=((e,t,r,n)=>t.deltaTimeDimension?pt(e,t.measure,[{field:t.deltaTimeDimension.field,direction:"asc",function:t.deltaTimeDimension.truncate}],je(t.filter,r),[],t.deltaTimeDimension,t.limit,t.offset,n):null)(t,e,n,r)),{queries:a?[i.query,a.query]:[i.query],measureDescription:a?[i.measureDescription,a.measureDescription]:[i.measureDescription]}})(e,t,n,r);return{queries:i,resultFields:Bi(a)}},ea=Vi,ta=Vi,ra=(e,t,r,n)=>{switch(e.type){case"areaChart":return Hi(e,t,r,n);case"barChart":return Yi(e,t,r,n);case"horizontalBarChart":return Xi(e,t,r,n);case"lineChart":return Wi(e,t,r,n);case"pieChart":return Ki(e,t,r,n);case"dataTable":return Qi(e,t,r,n);case"basicTable":return Zi(e,t,r,n);case"comboChart":return((e,t,r,n)=>{const{line:i,bar:a}=((e,t,r,n)=>{let i=pt(t,e.lineMeasure,e.order,je(e.filter,n),e.lineDimension,e.timeDimension,e.limit,e.offset,r);return{bar:pt(t,e.barMeasure,e.order,je(e.filter,n),e.barDimension,e.timeDimension,e.limit,e.offset,r),line:i}})(e,t,n,r);return{queries:[i.query,a.query],resultFields:Bi([i.measureDescription,a.measureDescription])}})(e,t,r,n);case"singleStat":case"progress":return Ji(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:a,measureDescription:o}=pt(t,i,e.order,je(e.filter,r),e.dimension,e.timeDimension,e.limit,e.offset,n);return{queries:[a],resultFields:Bi([o])}})(e,t,r,n);case"mercatorMap":return((e,t,r,n)=>Gi([t],[{measure:e.measure,dataSetId:t.id,dimension:e.dimension,limit:e.limit,filter:je(e.filter,r),order:[],timeDimension:null}],n))(e,t,r,n);case"funnelChart":return ea(e,t,r,n);case"richText":return ta(e,t,r,n);default:throw"Unsupported."}},na=(e,t,r)=>{let n=[],i=[];if(Array.isArray(e)&&"type"in e[0]&&"preparedQuery"==e[0].type&&"preAggregated"==e[0].preparedQueryType){const a=yt(r.dataSets,e[0].dataSetId);if(!a)throw"Data set not found for pre aggregated query";const[o]=a.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],a),u=yt(r.dataSets,o),c=Ze(r.filterConfig,u,r.timeRangeOptions),d=Re([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=yt(r.dataSets,e[0].dataSetId);if(!t)throw"Data set not found for view attributes query";const a=bt(t,e[0].fieldId),{query:o,resultFields:s}=ht(e[0].dataSetId,a);n=[o],i=[s]}else if(Array.isArray(e)){let a=[...e].map((e=>{const t=yt(r.dataSets,e.dataSetId);if(!t)throw"Data set not found for query-attributes query";const n=Ze(r.filterConfig,t,r.timeRangeOptions);return Object.assign(Object.assign({},e),{filter:je(e.filter,n)})}));const{queries:o,resultFields:s}=Gi(r.dataSets,a,t);n=o,i=s}else if("type"in e&&("order"in e||"measure"in e)){const a=yt(r.dataSets,e.dataSetId);if(!a)throw"Data set not found for view attributes query";const o=Ze(r.filterConfig,a,r.timeRangeOptions);let{queries:s,resultFields:l}=ra(e,a,o,t);n=s,i=l}else if("custom"!=e.type){let{queries:a,resultFields:o}=((e,t,r)=>{let n=[...e.appliesToFields].map((n=>{const i=yt(t,n.dataSetId);if(!i)throw"Data set not found for additional filter query";const a=bt(i,n.fieldId);if("string[]"==a.dataType){const t=Re([Ui(e,n)],r,i),{query:o,resultFields:s}=ht(n.dataSetId,a,t);return{queries:[o],resultFields:[s]}}{const a=((e,t,r)=>{let n=[{field:t,function:"count"}],i=r?[r]:[],a=[{field:t,function:"none"}];return{dataSetId:e.id,measure:n,order:[],filter:i,dimension:a,timeDimension:null,limit:5e3,offset:0}})(i,n.fieldId,Ui(e,n));return Gi(t,[a],r)}}));return{queries:n.flatMap((e=>e.queries)),resultFields:n.flatMap((e=>e.resultFields))}})(e,r.dataSets,t);n=a,i=o}return r.timeZone&&(n=n.map((e=>Object.assign(Object.assign({},e),{timeZone:r.timeZone})))),{queries:n,resultFields:i}};let ia={};const aa=e=>Array.isArray(e)?0==e.length:"object"==typeof e&&aa(Object.keys(e)),oa=(e,t,r,n)=>{return i=void 0,a=void 0,s=function*(){let i={};e.forEach(((e,t)=>{const r=(e=>{const t=JSON.stringify(e),r=ia[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 ia[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 a=e.filter(((e,r)=>t(e)&&void 0===i[r]));let o=[];return aa(a)||(o=yield r(a)),null===o||aa(o)&&aa(i)?null:[...e].map(((e,r)=>{let a=i[r];if(t(e)&&null==a&&(a=(null==o?void 0:o.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),ia[n]={item:t,expires:i}})(n(e),a)),void 0===a)throw"A result went missing...";return a}))},new((o=void 0)||(o=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 o?i:new o((function(e){e(i)}))).then(r,n)}l((s=s.apply(i,a||[])).next())}));var i,a,o,s};var sa=function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(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(o,s)}l((n=n.apply(e,t||[])).next())}))};const la=(e,t,r)=>sa(void 0,void 0,void 0,(function*(){const{queries:n,resultFields:i}=na(t,e.queryEngineConfig,r),a=yield oa(n,(e=>!0),(t=>sa(void 0,void 0,void 0,(function*(){return yield((e,t,r,n)=>{return i=void 0,a=void 0,s=function*(){const i=Jn(t),{status:a,body:o}=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==a?o:null},new((o=void 0)||(o=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 o?i:new o((function(e){e(i)}))).then(r,n)}l((s=s.apply(i,a||[])).next())}));var i,a,o,s})(t,e.queryEngineEndpoint,e.dataAccessToken,r.abortSignal)}))),(t=>({query:t,cacheKeyNamespace:e.cacheKeyNamespace})));return[...n].map(((e,t)=>{if(null===a)return null;const r=a[t];return void 0===r?null:{content:r,fields:i[t]}}))}));var ua=r(7331),ca=r.n(ua);let da={};const pa=[];let fa={};class ha extends Error{constructor(e){super(e),this.name="MissingVizzlyInMemoryDb"}}const ma=ha,ga=()=>{const e=window.VizzlyInMemoryDb;if(!e)throw new ma("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.19/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 ya=(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:ba(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},ba=(e,t)=>{if("subquery"==e.type)return{type:"subquery",value:{select:[ba(e.value.measure[0],t)],where:ya(e.value.filter,t),join:[]}};if("maths"==e.type)return{type:"maths",left:ba(e.left,t),right:ba(e.right,t),op:e.op};if("date_maths"==e.type)return{type:"date_maths",left:ba(e.left,t),right:ba(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:ba(e.value,t)};if("switchField"==e.type)return{type:"case",value:{cases:e.value.cases.map((e=>({result:ba(e.returns,t),where:ya(e.filter,t)})))}};if("field"==e.type&&"none"!=e.function){const r=bt(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=bt(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 va=function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(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(o,s)}l((n=n.apply(e,t||[])).next())}))};const _a=(e,t)=>`${e}::${t}`,Aa=(e,t,r)=>va(void 0,void 0,void 0,(function*(){const n=[...e].map((e=>va(void 0,void 0,void 0,(function*(){const[n]=vt(t,e.dataSetId),i=_a(r,e.dataSetId);if(da[i]&&n){const t=yield((e,t)=>{return r=void 0,n=void 0,a=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=>ba(e,t))),where:ya(e.filter,t),order:e.order,group:e.group,join:[],limit:e.limit||5e3,offset:e.offset||0,from:["_",e.dataSetId]},a=yield ga().query(i);return(null===(n=null==a?void 0:a[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:ya(e.filter,t),join:[]},n=yield ga().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 o(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 r;t.done?e(t.value):(r=t.value,r instanceof i?r:new i((function(e){e(r)}))).then(o,s)}l((a=a.apply(r,n||[])).next())}));var r,n,i,a})(e,n);return t}return console.warn("Returning an empty result."),[]}))));return yield Promise.all(n)})),wa=(e,t,r,n)=>va(void 0,void 0,void 0,(function*(){return yield ga().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=>va(void 0,void 0,void 0,(function*(){const[i]=vt(t,e.dataSetId);if(i){const t=yield((e,t,r)=>{return n=void 0,i=void 0,o=function*(){fa[e.id]||(fa[e.id]=ca()(t,5e3,{leading:!0}));let n=fa[e.id];if(w("Fetching data for in-browser query engine. DataSet;",e.id,"CacheKey;",r),da[r])return w("Returning data for in-browser query engine from the cache."),da[r];{const t=yield n(e);return t||pa.includes(e.id)||(pa.push(e.id),console.error(`Failed to download data for data set ${e.id}`)),t&&n.cancel(),w(`Data from cacheKey: ${r}`,t),da[r]=t,t}},new((a=void 0)||(a=Promise))((function(e,t){function r(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 n;t.done?e(t.value):(n=t.value,n instanceof a?n:new a((function(e){e(n)}))).then(r,s)}l((o=o.apply(n,i||[])).next())}));var n,i,a,o})(i,r,_a(n,e.dataSetId)),a={id:null==i?void 0:i.id,fields:null==i?void 0:i.fields.map((e=>({id:e.id,dataType:e.dataType})))};yield ga().ingest(a,t||[])}return[]}))))),yield Aa(e,t,n)}));var Sa=function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(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(o,s)}l((n=n.apply(e,t||[])).next())}))},Ta=function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(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(o,s)}l((n=n.apply(e,t||[])).next())}))};function Ea(e,t,r){return n=this,i=void 0,o=function*(){return"vizzlyQueryEngine"==e.type?yield la(e,t,r):"vizzlyJsQueryEngine"==e.type?yield((e,t,r)=>Sa(void 0,void 0,void 0,(function*(){const{queries:n,resultFields:i}=na(t,ti,r);let a=yield oa(n,(e=>!0),(t=>Sa(void 0,void 0,void 0,(function*(){return yield wa(t,r.dataSets,e.loadData,e.cacheKeyNamespace)}))),(t=>({query:t,cacheKeyNamespace:e.cacheKeyNamespace})));return null===a&&(a=n.map((()=>null))),[...n].map(((e,t)=>{if(null===a)return null;const r=a[t];return void 0===r?null:{content:r,fields:i[t]}}))})))(e,t,r):"custom"==e.type?yield((e,t,r)=>Ta(void 0,void 0,void 0,(function*(){const{queries:n,resultFields:i}=na(t,e.queryEngineConfig,r),a=yield oa(n,(e=>("preparedQuery"==e.type&&S("Custom query engine does not support prepared queries."),"query"==e.type)),(t=>Ta(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===a?n.map((()=>null)):a})))(e,t,r):[]},new((a=void 0)||(a=Promise))((function(e,t){function r(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 n;t.done?e(t.value):(n=t.value,n instanceof a?n:new a((function(e){e(n)}))).then(r,s)}l((o=o.apply(n,i||[])).next())}));var n,i,a,o}var xa=function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(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(o,s)}l((n=n.apply(e,t||[])).next())}))};const Oa=(e,t)=>{const r=new Date(e.getTime()-24*t*60*60*1e3);return new Date(r.getFullYear(),r.getMonth(),r.getDate())},Ca=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()),Ia={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},ja=(e,t)=>{const r=Ca(e),n=new Date(r);return n.setDate(n.getDate()+1),n.setMilliseconds(n.getMilliseconds()-1),{description:t,range:{before:n,after:r}}},Ra=(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 Da=function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(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(o,s)}l((n=n.apply(e,t||[])).next())}))};const Fa="default";e.VizzlyApiClientLogger.UserAgentProduct="Services";const Pa=Object.assign({},{apiHost:"https://api.vizzly.co"});class Ma{constructor(t,r,n,i,a,o){this.programmaticDashboard=a,this.dataSets=n,this.queryEngineConfig=r,this.identityConfig=t,this.vizzlyAPIClient=((t,r,n)=>{var i,a,o;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===(a=null==t?void 0:t.dashboardAdminOverride)||void 0===a?void 0:a.signature,queryEngineAccessToken:null===(o=null==t?void 0:t.queryEngineAccessConfig)||void 0===o?void 0:o.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,o)}static load(e,t=Pa){return Da(this,void 0,void 0,(function*(){w("Starting load process for the services package.");const{queryEngine:r,dataSets:n,identity:i,programmaticDashboard:a}=e,o=new Ti(r,i,n,t),{queryEngineConfig:s,dataSets:l,identityConfig:u,dashboardStorageStrategy:c}=yield o.load(),d=new Na(u,s,l,c,a,{host:t.apiHost});return Na._instanceStore[Fa]=d,Na.queryEngine=r,w("Loaded services package and added it to the instance store."),d}))}static use(e=Fa){const t=Na._instanceStore[e];if(!t)throw new Ni(e);return t}static waitToUse(e=Fa,t=1e4){return Da(this,void 0,void 0,(function*(){const r=Ma._instanceStore,n=e;return new Promise(((i,a)=>{if(r.hasOwnProperty(n))return void i(r[n]);const o=setTimeout((()=>{clearTimeout(o),a(new Li(e,t))}),t),s=setInterval((()=>{r.hasOwnProperty(n)&&(clearTimeout(o),clearInterval(s),i(r[n]))}),10)}))}))}static clearInstances(){Na._instanceStore={}}createDashboard(e){var t;return Da(this,void 0,void 0,(function*(){((e,t)=>{const r=L().object({definition:t?Dn(t):L().object().required(),parentDashboardId:L().string().required(),metadata:L().object()}).validate(e,$i);if(r.error)throw new xi(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=Pn(n,this.queryEngineConfig);return Mn(i,this.dataSets,(null===(t=n.definition)||void 0===t?void 0:t.customFields)||{})}))}updateDashboard(e){var t;return Da(this,void 0,void 0,(function*(){((e,t)=>{const r=L().object({dashboardId:L().string().required(),definition:t?Dn(t):L().object().required(),metadata:L().object().optional(),deleted:L().boolean().optional()}).validate(e,$i);if(r.error)throw new xi(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=Pn(n,this.queryEngineConfig);return Mn(i,this.dataSets,(null===(t=n.definition)||void 0===t?void 0:t.customFields)||{})}))}getDashboards(e){return Da(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=>Ma.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:Nn(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=Mn(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 Da(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 Da(this,void 0,void 0,(function*(){w("[Services] Querying data with queries:",e);let r=Fa;(null==t?void 0:t.instanceId)&&(r=t.instanceId);const n=Ma._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:qi(e),timeDimension:L().alternatives(U(e.supportedTimeTruncFunctions),L().valid(null))})))(t)).validate(e,ki);if(r.error)throw new xi(r.error.message)})(i,n.queryEngineConfig);const a=(()=>{if(null==t?void 0:t.queryEngineEndpoint)return t.queryEngineEndpoint;if(Na.queryEngine){if("string"==typeof Na.queryEngine)return Na.queryEngine;if("string"!=typeof Na.queryEngine&&"endpoint"in Na.queryEngine)return Na.queryEngine.endpoint}})(),o=((e,t,r,n,i,a,o)=>{var s;let l=(u=e.dashboardAccess,["accessType","dashboardId","projectId","userReference","scope"].map((e=>`${e}:${u[e]}`)).join(":::"));var u;if(n)return(i,a)=>xa(void 0,void 0,void 0,(function*(){var s;return yield Ea({type:"custom",queryEngineConfig:t,runQueries:n,dataAccessToken:null===(s=e.dataAccess)||void 0===s?void 0:s.signature,cacheKeyNamespace:l},i,{abortSignal:a.abortSignal,dataSets:a.dataSets,filterConfig:a.filterConfig||{},timeRangeOptions:r,timeZone:o})}));if(i)return(e,t)=>xa(void 0,void 0,void 0,(function*(){return yield Ea({type:"vizzlyJsQueryEngine",loadData:i,cacheKeyNamespace:l},e,{abortSignal:t.abortSignal,dataSets:t.dataSets,filterConfig:t.filterConfig||{},timeRangeOptions:r,timeZone:o})}));if(a&&(null===(s=e.dataAccess)||void 0===s?void 0:s.signature))return(n,i)=>xa(void 0,void 0,void 0,(function*(){var s;return yield Ea({type:"vizzlyQueryEngine",queryEngineConfig:t,dataAccessToken:null===(s=e.dataAccess)||void 0===s?void 0:s.signature,queryEngineEndpoint:a,cacheKeyNamespace:l},n,{abortSignal:i.abortSignal,dataSets:i.dataSets,filterConfig:i.filterConfig||{},timeRangeOptions:r,timeZone:o})}));throw"Missing required props."})(n.identityConfig,n.queryEngineConfig,((e,t)=>{const r=(e=>{return{today:ja(new Date,e("filter.today","Today")),past_1_day:Ra(1,0,e("filter.past_1_day","Last 24 hours")),yesterday:(t=new Date,r=e("filter.yesterday","Yesterday"),{description:r,range:{before:Ca(t),after:Ca(Oa(t,1))}}),past_3_days:Ra(3,0,e("filter.past_3_days","Last 3 days")),past_7_days:Ra(7,0,e("filter.past_7_days","Last 7 days")),past_30_days:Ra(30,0,e("filter.past_30_days","Last 30 days")),past_90_days:Ra(90,0,e("filter.past_90_days","Last 90 days")),past_3_months:Ra(0,3,e("filter.past_3_months","Last 3 months")),past_6_months:Ra(0,6,e("filter.past_6_months","Last 6 months")),past_12_months:Ra(0,12,e("filter.past_12_months","Last 12 months")),past_18_months:Ra(0,18,e("filter.past_18_months","Last 18 months"))};var t,r})(e),n=Object.keys(Ia).map((e=>e in r?`_vizzly_${e}`:e)),i=n.indexOf("_vizzly_today");i>-1&&(n.splice(i,1),n.unshift("_vizzly_today"));let a={},o={};for(const e of n){const n=e.replace("_vizzly_",""),i=r[n],a=null==t?void 0:t[n];"boolean"==typeof a?a&&(o[e]=i):null!=a?o[e]=a:!1!==Ia[n]&&(o[e]=i)}if(t)for(const[e,r]of Object.entries(t))e in Ia||(n.push(e),o[e]=r);for(const e of n)e in o&&(a[e]=o[e]);return a})(cn,null==t?void 0:t.dateFilterOptions),null==t?void 0:t.runQueries,null==t?void 0:t.data,a);return{results:yield(()=>Da(this,void 0,void 0,(function*(){var e;try{return yield o(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=Pn(e,r);return[Mn(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 Da(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 Da(this,void 0,void 0,(function*(){try{const n=Ma.use();if(("addComponentToLibrary"===e.action||"deleteComponentFromLibrary"===e.action)&&n.globalLibraryPermissions){Na.publish({data:{action:"updateToGlobalLibraryStatus",state:zi.SAVING}});const[i]=yield Promise.all([yield n.getGlobalLibraries({abortController:null==t?void 0:t.abortController})]);let a=Ln(i);"addComponentToLibrary"===e.action&&(a=function(e,t,r){const n=Ln(e);if(!n)throw new Error("No matching library found.");return n.library.views&&n.library.customFields||kn(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&&(a=((e,t)=>{const r=Ln(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 o=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,[a]);((...e)=>{_("info")&&console.info("[VIZZLY INFO]",...e.map(A))})("library and tokens for update",{libraryForUpdate:a,tokenForLibrary:o});const s={globalLibraryId:a.id,library:a.library,abortSignal:null===(r=null==t?void 0:t.abortController)||void 0===r?void 0:r.signal,globalLibrarySessionToken:o};if(yield n.updateGlobalLibrary(s)){let t=zi.SAVED;"deleteComponentFromLibrary"===e.action&&(t=zi.DELETED),Na.publish({data:{action:"newViewsInGlobalLibrary"}}),Na.publish({data:{action:"updateToGlobalLibraryStatus",state:t}})}}}catch(e){T("Error handling event:",e)}}))}static publish(e){Na.eventBus.map((t=>{t(e)})),Na.eventBusController(e.data).catch((e=>{T("Failed to handle event:",e)}))}static subscription(e){return Na.eventBus.push(e),()=>{Na.eventBus=Na.eventBus.filter((t=>t!==e))}}}Ma._instanceStore={},Ma.DEFAULT_INSTANCE_ID=Fa,Ma.eventBus=[],Ma.Row=Ii,Ma.Cell=Ci,Ma.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:Ri(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:Di(null==t?void 0:t.library)})),this.dashboard=(e=>Object.assign({isPlayground:!1,display:[{components:[An(8),An(4)],height:bn},{components:[An(4),An(4),An(4)],height:bn}],componentLibrary:[],globalFilters:[],customFields:{}},e))(r)}setDisplay(e){let t=Ri(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=Di(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})}},Ma.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})}},Ma.Header=ji,Ma.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{Fi({component:e,uniqueViewId:t});const a=new Ci({component:Pi(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(a):null===(i=this.library)||void 0===i||i.splice(r.position,0,a)}catch(e){throw new Oi(e,"Library.addComponent")}}addComponents(e){try{if(void 0===e)throw new Oi("Components are undefined","Library.addComponents");e.forEach((e=>{var t;Fi(e);const r=new Ci({component:Pi(e.component,e.uniqueViewId),colSpan:1});null===(t=this.library)||void 0===t||t.push(r)}))}catch(e){throw new Oi(e,"Library.addComponents")}}},Ma.AreaChart=class extends Mi{constructor(e){super(Object.assign(Object.assign({},e),{type:"areaChart"}))}static type(){return"areaChart"}},Ma.LineChart=class extends Mi{constructor(e){super(Object.assign(Object.assign({},e),{type:"lineChart"}))}static type(){return"lineChart"}},Ma.BarChart=class extends Mi{constructor(e){super(Object.assign(Object.assign({},e),{type:"barChart"}))}static type(){return"barChart"}},Ma.PieChart=class extends Mi{constructor(e){super(Object.assign(Object.assign({},e),{type:"pieChart"}))}static type(){return"pieChart"}},Ma.ScatterChart=class extends Mi{constructor(e){super(Object.assign(Object.assign({},e),{type:"scatterChart"}))}static type(){return"scatterChart"}},Ma.ComboChart=class extends Mi{constructor(e){super(Object.assign(Object.assign({},e),{type:"comboChart"}))}static type(){return"comboChart"}},Ma.PivotTable=class extends Mi{constructor(e){super(Object.assign(Object.assign({},e),{type:"dataTable"}))}static type(){return"dataTable"}},Ma.BasicTable=class extends Mi{constructor(e){super(Object.assign(Object.assign({},e),{type:"basicTable"}))}static type(){return"basicTable"}},Ma.HorizontalBarChart=class extends Mi{constructor(e){super(Object.assign(Object.assign({},e),{type:"horizontalBarChart"}))}static type(){return"horizontalBarChart"}},Ma.MercatorMap=class extends Mi{constructor(e){super(Object.assign(Object.assign({},e),{type:"mercatorMap"}))}static type(){return"mercatorMap"}},Ma.SingleStat=class extends Mi{constructor(e){super(Object.assign(Object.assign({},e),{type:"singleStat"}))}static type(){return"singleStat"}},Ma.Progress=class extends Mi{constructor(e){super(Object.assign(Object.assign({},e),{type:"progress"}))}static type(){return"progress"}},"undefined"==typeof window||window.Vizzly||(window.Vizzly=Ma);const Na="undefined"!=typeof window&&window.Vizzly||Ma})();var i=n.B,a=n.Q;export{i as Vizzly,a 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),a={annotations:Symbol("annotations")};t.error=function(e){if(!this._original||"object"!=typeof this._original)return this.details[0].message;const t=e?"":"[31m",r=e?"":"[41m",o=e?"":"[0m",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 o=s;for(let e=0;;++e){const s=n[e];if(i.isSchema(o)&&(o=o.clone()),!(e+1<n.length&&"string"!=typeof o[s])){const e=o[a.annotations]||{errors:{},missing:{}};o[a.annotations]=e;const n=s||r.context.key;void 0!==o[s]?(e.errors[n]=e.errors[n]||[],e.errors[n].push(t)):e.missing[n]=t;break}o=o[s]}}let l=a.safeStringify(s,2).replace(/_\$key\$_([, \d]+)_\$end\$_"/g,((e,r)=>`" ${t}[${r}]${o}`)).replace(/"_\$miss\$_([^|]+)\|(\d+)_\$end\$_": "__missing__"/g,((e,n,i)=>`${r}"${n}"${o}${t} [${i}]: -- missing --${o}`)).replace(/\s*"_\$idx\$_([, \d]+)_\$end\$_",?\n(.*)/g,((e,r,n)=>`\n${n} ${t}[${r}]${o}`)).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+=o,l},a.safeStringify=function(e,t){return JSON.stringify(e,a.serializer(),t)},a.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 a=t.indexOf(this);~a?(t.length=a+1,e.length=a+1,e[a]=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[a.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:a,merge:o}=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,o(t._flags,r)}else if(e._flags.empty){t._flags.empty=e._flags.empty;const r=Object.assign({},e._flags);delete r.empty,o(t._flags,r)}else o(t._flags,e._flags);for(const r in e.$_terms){const n=e.$_terms[r];n?t.$_terms[r]?t.$_terms[r]=t.$_terms[r].concat(n):t.$_terms[r]=n.slice():t.$_terms[r]||(t.$_terms[r]=n)}return this.$_root._tracer&&this.$_root._tracer._combine(t,[this,e]),t.$_mutateRebuild()}extend(e){return n(!e.base,"Cannot extend type with another base"),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 a=this.clone();for(let o=r;o<a._rules.length;++o){const r=a._rules[o],s=i(r);for(const i in e)t.modifiers[i](s,e[i]),n(s.name===r.name,"Cannot change rule name");a._rules[o]=s,a._singleRules.get(s.name)===r&&a._singleRules.set(s.name,s)}return a.$_temp.ruleset=!1,a.$_mutateRebuild()}get ruleset(){n(!this._inRuleset(),"Cannot start a new ruleset without closing the previous one");const e=this.clone();return e.$_temp.ruleset=e._rules.length,e}get $(){return this.ruleset}tailor(e){e=[].concat(e),n(!this._inRuleset(),"Cannot tailor inside a ruleset");let t=this;if(this.$_terms.alterations)for(const{target:r,adjuster: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 a=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 o=i[e];if(r.argsByName){const s=r.argsByName.get(e);if(s.ref&&l.isResolvable(o))t._resolve.push(e),a.$_mutateRegister(o);else if(s.normalize&&(o=s.normalize(o),i[e]=o),s.assert){const t=l.validateArg(o,e,s);n(!t,t,"or reference")}}void 0!==o?i[e]=o:delete i[e]}}return r.multi||(a._ruleRemove(t.name,{clone:!1}),a._singleRules.set(t.name,t)),!1===a.$_temp.ruleset&&(a.$_temp.ruleset=null),r.priority?a._rules.unshift(t):a._rules.push(t),a}$_compile(e,t){return u.schema(this.$_root,e,t)}$_createError(e,t,r,n,i,a={}){const o=!1!==a.flags?this._flags:{},s=a.messages?f.merge(this._definition.messages,a.messages):this._definition.messages;return new c.Report(e,t,r,o,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 a=this._definition[t][r]&&this._definition[t][r].register;!1!==a&&this.$_mutateRegister(e,{family:a,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(a(t,i.default)&&(t=void 0),a(t,this._flags[e]))return this;const o=!1!==r.clone?this.clone():this;return void 0!==t?(o._flags[e]=t,o.$_mutateRegister(t)):delete o._flags[e],"_"!==e[0]&&(o.$_temp.ruleset=!1),o}$_parent(e,...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 a=0;a<this.$_terms.whens.length;++a){const o=this.$_terms.whens[a];if(o.concat){n.push(o.concat),i.push(`${a}.concat`);continue}const s=o.ref?o.ref.resolve(e,t,r):e,l=o.is?[o]:o.switch,u=i.length;for(let u=0;u<l.length;++u){const{is:c,then:d,otherwise:p}=l[u],f=`${a}${o.switch?"."+u:""}`;if(c.$_match(s,t.nest(c,`${f}.is`),r)){if(d){const a=t.localize([...t.path,`${f}.then`],t.ancestors,t.schemas),{schema:o,id:s}=d._generate(e,a,r);n.push(o),i.push(`${f}.then${s?`(${s})`:""}`);break}}else if(p){const a=t.localize([...t.path,`${f}.otherwise`],t.ancestors,t.schemas),{schema:o,id:s}=p._generate(e,a,r);n.push(o),i.push(`${f}.otherwise${s?`(${s})`:""}`);break}}if(o.break&&i.length>u)break}const a=i.join(", ");if(t.mainstay.tracer.debug(t,"rule","when",a),!a)return{schema:this};if(!t.mainstay.tracer.active&&this.$_temp.whens[a])return{schema:this.$_temp.whens[a],id:a};let o=this;this._definition.generate&&(o=this._definition.generate(this,e,t,r));for(const e of n)o=o.concat(e);return this.$_root._tracer&&this.$_root._tracer._combine(o,[this,...n]),this.$_temp.whens[a]=o,{schema:o,id:a}}_inner(e,t,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),a=r(8160),o={max:1e3,supported:new Set(["undefined","boolean","number","string"])};t.provider={provision:e=>new o.Cache(e)},o.Cache=class{constructor(e={}){a.assertOptions(e,["max"]),n(void 0===e.max||e.max&&e.max>0&&isFinite(e.max),"Invalid max cache size"),this._max=e.max||o.max,this._map=new Map,this._list=new o.List}get length(){return this._map.size}set(e,t){if(null!==e&&!o.supported.has(typeof e))return;let r=this._map.get(e);if(r)return r.value=t,void this._list.first(r);r=this._list.unshift({key:e,value:t}),this._map.set(e,r),this._compact()}get(e){const t=this._map.get(e);if(t)return this._list.first(t),i(t.value)}_compact(){if(this._map.size>this._max){const e=this._list.pop();this._map.delete(e.key)}}},o.List=class{constructor(){this.tail=null,this.head=null}unshift(e){return e.next=null,e.prev=this.head,this.head&&(this.head.next=e),this.head=e,this.tail||(this.tail=e),e}first(e){e!==this.head&&(this._remove(e),this.unshift(e))}pop(){return this._remove(this.tail)}_remove(e){const{next:t,prev:r}=e;return t.prev=r,r&&(r.next=t),e===this.tail&&(this.tail=t),e.prev=null,e.next=null,e}}},8160:(e,t,r)=>{const{assert:n,AssertError:i}=r(8870),a=r(5934);let o,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=a.version,t.defaults={abortEarly:!0,allowUnknown:!1,artifacts:!1,cache:!0,context:null,convert:!0,dateFormat:"iso",errors:{escapeHtml:!1,label:"path",language:null,render:!0,stack:!1,wrap:{label:'"',array:"[]"}},externals:!0,messages:{},nonEnumerables:!1,noDefaults:!1,presence:"optional",skipFunctions:!1,stripUnknown:!1,warnings:!1},t.symbols={any:Symbol.for("@hapi/joi/schema"),arraySingle:Symbol("arraySingle"),deepDefault:Symbol("deepDefault"),errors:Symbol("errors"),literal:Symbol("literal"),override:Symbol("override"),parent:Symbol("parent"),prefs:Symbol("prefs"),ref:Symbol("ref"),template:Symbol("template"),values:Symbol("values")},t.assertOptions=function(e,t,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){o=o||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=o.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),a=r(6133),o={};t.schema=function(e,t,r={}){i.assertOptions(r,["appendPath","override"]);try{return o.schema(e,t,r)}catch(e){throw r.appendPath&&void 0!==e.path&&(e.message=`${e.message} (${e.path})`),e}},o.schema=function(e,t,r){n(void 0!==t,"Invalid undefined schema"),Array.isArray(t)&&(n(t.length,"Invalid empty array schema"),1===t.length&&(t=t[0]));const a=(t,...n)=>!1!==r.override?t.valid(e.override,...n):t.valid(...n);if(o.simple(t))return a(e,t);if("function"==typeof t)return e.custom(t);if(n("object"==typeof t,"Invalid schema content:",typeof t),i.isResolvable(t))return a(e,t);if(i.isSchema(t))return t;if(Array.isArray(t)){for(const r of t)if(!o.simple(r))return e.alternatives().try(...t);return a(e,...t)}return t instanceof RegExp?e.string().regex(t):t instanceof Date?a(e.date(),t):(n(Object.getPrototypeOf(t)===Object.getPrototypeOf({}),"Schema can only contain plain objects"),e.object().keys(t))},t.ref=function(e,t){return a.isRef(e)?e:a.create(e,t)},t.compile=function(e,r,a={}){i.assertOptions(a,["legacy"]);const s=r&&r[i.symbols.any];if(s)return n(a.legacy||s.version===i.version,"Cannot mix different versions of joi schemas:",s.version,i.version),r;if("object"!=typeof r||!a.legacy)return t.schema(e,r,{appendPath:!0});const l=o.walk(r);return l?l.compile(l.root,r):t.schema(e,r,{appendPath:!0})},o.walk=function(e){if("object"!=typeof e)return null;if(Array.isArray(e)){for(const t of e){const e=o.walk(t);if(e)return e}return null}const t=e[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=o.walk(e[t]);if(r)return r}return null},o.simple=function(e){return null===e||["boolean","string","number"].includes(typeof e)},t.when=function(e,r,s){if(void 0===s&&(n(r&&"object"==typeof r,"Missing options"),s=r,r=a.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'),o.condition(e,{is:r,then:s.then,otherwise:s.otherwise,break:s.break});if(n(a.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||a.isRef(s.is)||i.isSchema(s.is)||(u=u.required()),o.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],o=t===s.switch.length-1;i.assertOptions(r,o?["is","then","otherwise"]:["is","then"]),n(void 0!==r.is,'Switch statement missing "is"'),n(void 0!==r.then,'Switch statement missing "then"');const u={is:e.$_compile(r.is),then:e.$_compile(r.then)};if(a.isRef(r.is)||i.isSchema(r.is)||(u.is=u.is.required()),o){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},o.condition=function(e,t){for(const r of["then","otherwise"])void 0===t[r]?delete t[r]:t[r]=e.$_compile(t[r]);return t}},6354:(e,t,r)=>{const n=r(514),i=r(8160),a=r(3328);t.Report=class{constructor(e,r,n,i,a,o,s){if(this.code=e,this.flags=i,this.messages=a,this.path=o.path,this.prefs=s,this.state=o,this.value=r,this.message=null,this.template=null,this.local=n||{},this.local.label=t.label(this.flags,this.state,this.prefs,this.messages),void 0===this.value||this.local.hasOwnProperty("value")||(this.local.value=this.value),this.path.length){const e=this.path[this.path.length-1];"object"!=typeof e&&(this.local.key=e)}}_setTemplate(e){if(this.template=e,!this.flags.label&&0===this.path.length){const e=this._template(this.template,"root");e&&(this.local.label=e)}}toString(){if(this.message)return this.message;const e=this.code;if(!this.prefs.errors.render)return this.code;const t=this._template(this.template)||this._template(this.prefs.messages)||this._template(this.messages);return void 0===t?`Error code "${e}" is not defined, your custom type is missing the correct messages definition`:(this.message=t.render(this.value,this.state,this.prefs,this.local,{errors:this.prefs.errors,messages:[this.prefs.messages,this.messages]}),this.prefs.errors.label||(this.message=this.message.replace(/^"" /,"").trim()),this.message)}_template(e,r){return t.template(this.value,e,r||this.code,this.state,this.prefs)}},t.path=function(e){let t="";for(const r of e)"object"!=typeof r&&("string"==typeof r?(t&&(t+="."),t+=r):t+=`[${r}]`);return t},t.template=function(e,t,r,n,o){if(!t)return;if(a.isTemplate(t))return"root"!==r?t:null;let s=o.errors.language;if(i.isResolvable(s)&&(s=s.resolve(e,n,o)),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 a=r.path;return"key"===n.errors.label&&r.path.length>1&&(a=r.path.slice(-1)),t.path(a)||t.template(null,n.messages,"root",r,n)||i&&t.template(null,i,"root",r,n)||"value"},t.process=function(e,r,n){if(!e)return null;const{override:i,message:a,details:o}=t.details(e);if(i)return i;if(n.errors.stack)return new t.ValidationError(a,o,r);const s=Error.stackTraceLimit;Error.stackTraceLimit=0;const l=new t.ValidationError(a,o,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),a=r(8160),o=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=o.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),a.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][a.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),a=r(8652),o=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:o.version,cache:a.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){o.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(o.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){o.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:o.isSchema,in:(...e)=>d.in(...e),override:o.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 a=n[0]instanceof Error||"string"==typeof n[0]?n[0]:null,s=null!==a?n[1]:n[0],u=t.validate(e,o.preferences({errors:{stack:!0}},s||{}));let c=u.error;if(!c)return u.value;if(a instanceof Error)throw a;const d=r&&"function"==typeof c.annotate?c.annotate():c.message;throw c instanceof l.ValidationError==0&&(c=i(c)),c.message=a?`${a} ${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),a=r(8160),o=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[a.symbols.prefs],r.preferences.messages&&(r.preferences.messages=o.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 o=e.$_terms[i];if(!o)continue;if(o instanceof Map){o.size&&(r[i]=[...o.entries()]);continue}if(a.isValues(o)){r[i]=o.describe();continue}n(t.terms[i],"Term",i,"missing configuration");const s=t.terms[i].manifest,l="object"==typeof s;if(!o.length&&!l)continue;const u=[];for(const e of o)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===a.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[a.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 a=r.flags[i]&&r.flags[i].setter||i;n("function"==typeof t[a],"Invalid flag",i,"for type",e.type),t=t[a](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 a=[];if(i.args){const t={};for(const e in i.args)t[e]=this.build(i.args[e],{assign:e});const o=Object.keys(t),s=r.rules[i.name].args;if(s){n(o.length<=s.length,"Invalid number of arguments for",e.type,i.name,"(expected up to",s.length,", found",o.length,")");for(const{name:e}of s)a.push(t[e])}else n(1===o.length,"Invalid number of arguments for",e.type,i.name,"(expected up to 1, found",o.length,")"),a.push(t[o[0]])}t=t[i.name](...a);const o={};for(const e in r.modifiers)void 0!==i[e]&&(o[e]=this.build(i[e]));Object.keys(o).length&&(t=t.rule(o))}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 a=r.terms[t].manifest;if("schema"!==a)if("values"!==a)if("single"!==a)if("object"!=typeof a)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{[a.symbols.literal]:!0,literal:e.function};if(e.override)return a.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),a.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),a=r(3328);t.compile=function(e,t){if("string"==typeof e)return n(!t,"Cannot set single message string"),new a(e);if(a.isTemplate(e))return n(!t,"Cannot set single message template"),e;n("object"==typeof e&&!Array.isArray(e),"Invalid message options"),t=t?i(t):{};for(let r in e){const i=e[r];if("root"===r||a.isTemplate(i)){t[r]=i;continue}if("string"==typeof i){t[r]=new a(i);continue}n("object"==typeof i&&!Array.isArray(i),"Invalid message for",r);const o=r;for(r in t[o]=t[o]||{},i){const e=i[r];"root"===r||a.isTemplate(e)?t[o][r]=e:(n("string"==typeof e,"Invalid message for",r,"in",o),t[o][r]=new a(e))}}return t},t.decompile=function(e){const t={};for(let r in e){const n=e[r];if("root"===r){t.root=n;continue}if(a.isTemplate(n)){t[r]=n.describe({compact:!0});continue}const 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 a(r);if(a.isTemplate(r))return r;const o=i(e);for(let e in r){const t=r[e];if("root"===e||a.isTemplate(t)){o[e]=t;continue}if("string"==typeof t){o[e]=new a(t);continue}n("object"==typeof t&&!Array.isArray(t),"Invalid message for",e);const i=e;for(e in o[i]=o[i]||{},t){const r=t[e];"root"===e||a.isTemplate(r)?o[i][e]=r:(n("string"==typeof r,"Invalid message for",e,"in",i),o[i][e]=new a(r))}}return o}},2294:(e,t,r)=>{const{assert:n}=r(8870),i=r(8160),a=r(6133),o={};t.Ids=o.Ids=class{constructor(){this._byId=new Map,this._byKey=new Map,this._schemaChain=!1}clone(){const e=new o.Ids;return e._byId=new Map(this._byId),e._byKey=new Map(this._byKey),e._schemaChain=this._schemaChain,e}concat(e){e._schemaChain&&(this._schemaChain=!0);for(const[t,r]of e._byId.entries())n(!this._byKey.has(t),"Schema id conflicts with existing key:",t),this._byId.set(t,r);for(const[t,r]of e._byKey.entries())n(!this._byId.has(t),"Schema key conflicts with existing id:",t),this._byKey.set(t,r)}fork(e,t,r){const a=this._collect(e);a.push({schema:r});const s=a.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 a)l={id:e.id,schema:o.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 a=e.slice(1);return a.length?i.schema._ids.reach(a,[...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],a=this._get(i);n(a,"Schema does not contain path",[...t,...e].join(".")),r=[a,...r];const o=e.slice(1);return o.length?a.schema._ids._collect(o,[...t,i],r):r}_get(e){return this._byId.get(e)||this._byKey.get(e)}},o.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=o.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],a=o.scan(i.args,{source:"rules",name:i.name},t);if(void 0!==a){r=r||e.clone();const t=Object.assign({},i);t.args=a,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=o.scan(e.$_terms[n],{source:"terms",name:n},t);void 0!==i&&(r=r||e.clone(),r.$_terms[n]=i)}return r},o.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,a=o.scan(e[n],t,r,[n,...l],i);void 0!==a&&(u=u||e.slice(),u[n]=a)}return u}if(!1!==r.schema&&i.isSchema(e)||!1!==r.ref&&a.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=o.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:a}=r(8870),o=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),o.assertOptions(t,["adjust","ancestor","in","iterables","map","prefix","render","separator"]),n(!t.prefix||"object"==typeof t.prefix,"options.prefix must be of type object");const r=Object.assign({},l.defaults,t);delete r.prefix;const i=r.separator,a=l.context(e,i,t.prefix);if(r.type=a.type,e=a.key,"value"===r.type)if(a.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[o.symbols.ref]},l.Ref=class{constructor(e){n("object"==typeof e,"Invalid reference construction"),o.assertOptions(e,["adjust","ancestor","in","iterables","map","path","render","separator","type","depth","key","root","display"]),n([!1,void 0].includes(e.separator)||"string"==typeof e.separator&&1===e.separator.length,"Invalid separator"),n(!e.adjust||"function"==typeof e.adjust,"options.adjust must be a function"),n(!e.map||Array.isArray(e.map),"options.map must be an array"),n(!e.map||!e.adjust,"Cannot set both map and adjust options"),Object.assign(this,l.defaults,e),n("value"===this.type||void 0===this.ancestor,"Non-value references cannot reference ancestors"),Array.isArray(this.map)&&(this.map=new Map(this.map)),this.depth=this.path.length,this.key=this.path.length?this.path.join(this.separator):null,this.root=this.path[0],this.updateDisplay()}resolve(e,t,r,i,a={}){return n(!this.in||a.in,"Invalid in() reference usage"),"global"===this.type?this._resolve(r.context,t,a):"local"===this.type?this._resolve(i,t,a):this.ancestor?"root"===this.ancestor?this._resolve(t.ancestors[t.ancestors.length-1],t,a):(n(this.ancestor<=t.ancestors.length,"Invalid reference exceeds the schema root:",this.display),this._resolve(t.ancestors[this.ancestor-1],t,a)):this._resolve(e,t,a)}_resolve(e,t,r){let n;if("value"===this.type&&t.mainstay.shadow&&!1!==r.shadow&&(n=t.mainstay.shadow.get(this.absolute(t))),void 0===n&&(n=a(e,this.path,{iterables:this.iterables,functions:!0})),this.adjust&&(n=this.adjust(n)),this.map){const e=this.map.get(n);void 0!==e&&(n=e)}return t.mainstay&&t.mainstay.tracer.resolve(t,this,n),n}toString(){return this.display}absolute(e){return[...e.path.slice(0,-this.ancestor),...this.path]}clone(){return new l.Ref(this)}describe(){const e={path:this.path};"value"!==this.type&&(e.type=this.type),"."!==this.separator&&(e.separator=this.separator),"value"===this.type&&1!==this.ancestor&&(e.ancestor=this.ancestor),this.map&&(e.map=[...this.map]);for(const t of["adjust","iterables","render"])null!==this[t]&&void 0!==this[t]&&(e[t]=this[t]);return!1!==this.in&&(e.in=!0),{ref:e}}updateDisplay(){const e=null!==this.key?this.key:"";if("value"!==this.type)return void(this.display=`ref:${this.type}:${e}`);if(!this.separator)return void(this.display=`ref:${e}`);if(!this.ancestor)return void(this.display=`ref:${this.separator}${e}`);if("root"===this.ancestor)return void(this.display=`ref:root:${e}`);if(1===this.ancestor)return void(this.display=`ref:${e||".."}`);const t=new Array(this.ancestor+1).fill(this.separator).join("");this.display=`ref:${t}${e||""}`}},l.Ref.prototype[o.symbols.ref]=!0,t.build=function(e){return"value"===(e=Object.assign({},l.defaults,e)).type&&void 0===e.ancestor&&(e.ancestor=1),new l.Ref(e)},l.context=function(e,t,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 a=void 0===r.root?"/":r.root;if(a!==t&&e.startsWith(a))return{key:e.slice(a.length),type:"value",root:!0}}return{key:e,type:"value"}},l.ancestor=function(e,t){if(!t)return[1,0];if(e[0]!==t)return[1,0];if(e[1]!==t)return[0,1];let r=2;for(;e[r]===t;)++r;return[r-1,r]},t.toSibling=0,t.toParent=1,t.Manager=class{constructor(){this.refs=[]}register(e,n){if(e)if(n=void 0===n?t.toParent:n,Array.isArray(e))for(const t of e)this.register(t,n);else if(o.isSchema(e))for(const t of e._refs.refs)t.ancestor-n>=0&&this.refs.push({ancestor:t.ancestor-n,root:t.root});else t.isRef(e)&&"value"===e.type&&e.ancestor-n>=0&&this.refs.push({ancestor:e.ancestor-n,root:e.root}),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),a=r(8160),o={value:Symbol("value")};e.exports=o.State=class{constructor(e,t,r){this.path=e,this.ancestors=t,this.mainstay=r.mainstay,this.schemas=r.schemas,this.debug=null}localize(e,t=null,r=null){const n=new o.State(e,t,this);return r&&n.schemas&&(n.schemas=[o.schemas(r),...n.schemas]),n}nest(e,t){const r=new o.State(this.path,this.ancestors,this);return r.schemas=r.schemas&&[o.schemas(e),...r.schemas],r.debug=t,r}shadow(e,t){this.mainstay.shadow=this.mainstay.shadow||new o.Shadow,this.mainstay.shadow.set(this.path,e,t)}snapshot(){this.mainstay.shadow&&(this._snapshot=n(this.mainstay.shadow.node(this.path))),this.mainstay.snapshot()}restore(){this.mainstay.shadow&&(this.mainstay.shadow.override(this.path,this._snapshot),this._snapshot=void 0),this.mainstay.restore()}commit(){this.mainstay.shadow&&(this.mainstay.shadow.override(this.path,this._snapshot),this._snapshot=void 0),this.mainstay.commit()}},o.schemas=function(e){return a.isSchema(e)?{schema:e}:e},o.Shadow=class{constructor(){this._values=null}set(e,t,r){if(!e.length)return;if("strip"===r&&"number"==typeof e[e.length-1])return;this._values=this._values||new Map;let n=this._values;for(let t=0;t<e.length;++t){const r=e[t];let i=n.get(r);i||(i=new Map,n.set(r,i)),n=i}n[o.value]=t}get(e){const t=this.node(e);if(t)return t[o.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],a=i(this._values,r,{iterables:!0});t?a.set(n,t):a&&a.delete(n)}}},3328:(e,t,r)=>{const{assert:n,clone:i,escapeHtml:a}=r(8870),o=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?"}":"}}",a=e.indexOf(i);if(-1===a||"{"===e[1]){n.push(`{${c.decode(e)}`);continue}let o=e.slice(t?0:1,a);const s=":"===o[0];s&&(o=o.slice(1));const l=this._ref(c.decode(o),{raw:t,wrapped:s});n.push(l),"string"!=typeof l&&(r=!0);const u=e.slice(a+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 o=[];for(const s of this._template)if("string"==typeof s)o.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:a(u);o.push(c.wrap(e,s.wrapped&&r.errors.wrap.label))}}return o.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 a=new o.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(a.single){if("reference"===a.single.type){const e=n[0];return{ref:e,raw:t,refs:n,wrapped:r||"local"===e.type&&"label"===e.key}}return c.stringify(a.single.value)}return{formula:a,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,a={}){const o=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,...a})),null===e)return"null";if("string"===o)return c.wrap(e,a.arrayItems&&s.string);if("number"===o||"function"===o||"symbol"===o)return e.toString();if("object"!==o)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 o of e)d.push(c.stringify(o,t,r,n,i,{arrayItems:!0,...a}));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,a]=this,o=a.messages;if(!o)return"";const s=l.template(t,o[0],e,r,n)||l.template(t,o[1],e,r,n);return s?s.render(t,r,n,i,a):""},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),a=r(6354),o={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 o.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))},o.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 o.Store(e),{filename:n,line:a}=e._flags._tracerLocation||i.location(5);return this._schemas.set(e,{filename:n,line:a,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 a=[],s=[];for(const[e,t]of i._sources.entries()){if(o.sub(t.paths,s))continue;if(!t.entry){a.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),o=new Set(n._refs);for(const{value:e,ref:n}of t[r])i.delete(e),o.delete(n);(i.size||o.size)&&a.push({status:[...i,...[...o].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=o.labels[t.rule[e]||0];if(r){const n={rule:e,status:r};t.paths.size&&(n.paths=[...t.paths]),a.push(n)}}}a.length&&t.push({filename:r,line:n,missing:a,severity:"error",message:`Schema missing tests for ${a.map(o.message).join(", ")}`})}return t.length?t:null}},o.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){o.debug(t,{type:"entry"}),this._record(e,(e=>{e.entry=!0}))}filter(e,t,r,n){o.debug(t,{type:r,...n}),this._record(e,(e=>{e[r].add(n)}))}log(e,t,r,n,i){o.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]|=o.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,a){if(!e.mainstay.debug||n(r,i))return;const o={type:"value",by:t,from:r,to:i,path:e.path};a&&(o.name=a),e.mainstay.debug.push(o)}_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=o.id(e,t);this._scan(e,r.concat(n))},ref:!1})}_combine(e,t){this._combos.set(e,t)}},o.message=function(e){return`${e.paths?a.path(e.paths[0])+(e.rule?":":""):""}${e.rule||""} (${e.status})`},o.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)},o.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},o.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),a=r(8068),o=r(8160),s=r(3292),l=r(6354),u=r(6133),c={};e.exports=a.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:a,prefs:o}=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=a.nest(i.schema,`match.${n}`);l.snapshot();const u=i.schema.$_validate(e,l,o);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=a.nest(n.schema,`match.${t}`);r.snapshot();const i=n.schema.$_validate(e,r,o);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,a,o):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,a.nest(u,`${p}.is`),o)){if(c)return c.$_validate(e,a.nest(c,`${p}.then`),o)}else if(d)return d.$_validate(e,a.nest(d,`${p}.otherwise`),o)}}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),a=i.is?[i]:i.switch;for(const e of a)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"),o.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=>{o.isSchema(t)&&"array"===t.type&&e.$_setFlag("_arrayItems",!0,{clone:!1})}})},manifest:{build(e,t){if(t.matches)for(const r of t.matches){const{schema:t,ref:n,is:i,not:a,then:o,otherwise:s}=r;e=t?e.try(t):n?e.conditional(n,{is:i,then:o,not:a,otherwise:s,switch:r.switch}):e.conditional(i,{then:o,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:a,schema:o}of e){if(a.length>1)return c.unmatched(e,t);const s=a[0];if(s instanceof l.Report==0)return c.unmatched(e,t);if(s.state.path.length!==r.path.length){i.push({type:o.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:o.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),a=r(8160),o=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(a.isSchema(e)&&e._flags.id,"Schema must be a schema with an id");const t=this.clone();return t.$_terms.shared=t.$_terms.shared||[],t.$_terms.shared.push(e),t.$_mutateRegister(e),t}},warning:{method(e,t){return n(e&&"string"==typeof e,"Invalid warning code"),this.$_addRule({name:"warning",args:{code:e,local:t},warn:!0})},validate:(e,t,{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=o.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:a,otherwise:o,concat:s}=t;e=s?e.concat(s):r?e.when(r,{is:n,not:i,then:a,otherwise:o,switch:t.switch,break:t.break}):e.when(n,{then:a,otherwise:o,break:t.break})}else{const t={};for(const{target:e,adjuster:r}of n)t[e]=r;e=e.alter(t)}}return e}},messages:{"any.custom":"{{#label}} failed custom validation because {{#error.message}}","any.default":"{{#label}} threw an error when running default method","any.failover":"{{#label}} threw an error when running failover method","any.invalid":"{{#label}} contains an invalid value","any.only":'{{#label}} must be {if(#valids.length == 1, "", "one of ")}{{#valids}}',"any.ref":"{{#label}} {{#arg}} references {{:#ref}} which {{#reason}}","any.required":"{{#label}} is required","any.unknown":"{{#label}} is not allowed"}})},546:(e,t,r)=>{const{assert:n,deepEqual:i,reach:a}=r(8870),o=r(8068),s=r(8160),l=r(3292),u={};e.exports=o.extend({type:"array",flags:{single:{default:!1},sparse:{default:!1}},terms:{items:{init:[],manifest:"schema"},ordered:{init:[],manifest:"schema"},_exclusions:{init:[]},_inclusions:{init:[]},_requireds:{init:[]}},coerce:{from:"object",method(e,{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 a=[e,...t.ancestors];for(let n=0;n<e.length;++n){const o=t.localize([...t.path,n],a,i);if(i.$_match(e[n],o,r))return e}const o=i._flags.label;return o?n("array.hasKnown",{patternLabel:o}):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:a}){const o=t.$_terms._requireds.slice(),l=t.$_terms.ordered.slice(),c=[...t.$_terms._inclusions,...o],d=!e[s.symbols.arraySingle];delete e[s.symbols.arraySingle];const p=a();let f=e.length;for(let a=0;a<f;++a){const s=e[a];let h=!1,m=!1;const g=d?a:new Number(a),y=[...n.path,g];if(!t._flags.sparse&&void 0===s){if(p.push(r("array.sparse",{key:g,path:y,pos:a,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:a,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 o=l.shift(),c=o.$_validate(s,n.localize(y,b,o),i);if(c.errors){if(p.push(...c.errors),i.abortEarly)return p}else if("strip"===o._flags.result)u.fastSplice(e,a),--a,--f;else{if(!t._flags.sparse&&void 0===c.value){if(p.push(r("array.sparse",{key:g,path:y,pos:a,value:void 0},n.localize(y))),i.abortEarly)return p;continue}e[a]=c.value}continue}if(!t.$_terms.items.length){if(p.push(r("array.orderedLength",{pos:a,limit:t.$_terms.ordered.length})),i.abortEarly)return p;break}}const v=[];let _=o.length;for(let l=0;l<_;++l){const c=n.localize(y,b,o[l]);c.snapshot();const d=o[l].$_validate(s,c,i);if(v[l]=d,!d.errors){if(c.commit(),e[a]=d.value,m=!0,u.fastSplice(o,l),--l,--_,!t._flags.sparse&&void 0===d.value&&(p.push(r("array.sparse",{key:g,path:y,pos:a,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=o.indexOf(l);if(-1!==d)c=v[d];else{const o=n.localize(y,b,l);if(o.snapshot(),c=l.$_validate(s,o,i),!c.errors){o.commit(),"strip"===l._flags.result?(u.fastSplice(e,a),--a,--f):t._flags.sparse||void 0!==c.value?e[a]=c.value:(p.push(r("array.sparse",{key:g,path:y,pos:a,value:void 0},n.localize(y))),h=!0),m=!0;break}o.restore()}if(1===_){if(A){u.fastSplice(e,a),--a,--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,a),--a,--f;continue}if(p.push(r("array.includes",{pos:a,value:s},n.localize(y))),i.abortEarly)return p}}return o.length&&u.fillMissedErrors(t,p,o,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:a})=>s.compare(e.length,r,i)?e:t.error("array."+n,{limit:a.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:a}){const{value:o,errors:s}=u.sort(i,e,a,r,n);if(s)return s;for(let r=0;r<e.length;++r)if(e[r]!==o[r])return t("array.sort",{order:a.order,by:a.by?a.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:o},{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 o=c?a(e[i],c):e[i],l=u?d.custom:d[typeof o];if(n(l,"Failed to find unique map container for type",typeof o),l instanceof Map){const n=l.entries();let a;for(;!(a=n.next()).done;)if(p(a.value[0],o)){const n=t.localize([...t.path,i],[e,...t.ancestors]),o={pos:i,value:e[i],dupePos:a.value[1],dupeValue:e[a.value[1]]};return c&&(o.path=s),r("array.unique",o,n)}l.set(o,i)}else{if((!f||void 0!==o)&&void 0!==l[o]){const n={pos:i,value:e[i],dupePos:l[o],dupeValue:e[l[o]]};return c&&(n.path=s),r("array.unique",n,t.localize([...t.path,i],[e,...t.ancestors]))}l[o]=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,a){const o=[];let s=0;for(const e of r){const t=e._flags.label;t?o.push(t):++s}o.length?s?t.push(e.$_createError("array.includesRequiredBoth",n,{knownMisses:o,unknownMisses:s},i,a)):t.push(e.$_createError("array.includesRequiredKnowns",n,{knownMisses:o},i,a)):t.push(e.$_createError("array.includesRequiredUnknowns",n,{unknownMisses:s},i,a))},u.fillOrderedErrors=function(e,t,r,n,i,a){const o=[];for(const e of r)"required"===e._flags.presence&&o.push(e);o.length&&u.fillMissedErrors(e,t,o,n,i,a)},u.fillDefault=function(e,t,r,n){const i=[];let a=!0;for(let o=e.length-1;o>=0;--o){const s=e[o],l=[t,...r.ancestors],u=s.$_validate(void 0,r.localize(r.path,l,s),n).value;if(a){if(void 0===u)continue;a=!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 a="ascending"===r.order?1:-1,o=-1*a,s=a,l=(l,c)=>{let d=u.compare(l,c,o,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,o,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)*a:l<c?o: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),a=r(8160),o=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){a.verifyFlat(e,"truthy");const t=this.clone();t.$_terms.truthy=t.$_terms.truthy||new o;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){a.verifyFlat(e,"falsy");const t=this.clone();t.$_terms.falsy=t.$_terms.falsy||new o;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),a=r(8160),o=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:o}){const s="now"===r?Date.now():r.getTime();return a.compare(e.getTime(),s,i)?e:t.error("date."+n,{limit:o.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})=>o.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 a.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:a}=r(8870),o=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 a=[];if(t.$_terms.renames&&!f.rename(t,e,n,i,a))return{value:e,errors:a};if(!t.$_terms.keys&&!t.$_terms.patterns&&!t.$_terms.dependencies)return{value:e,errors:a};const o=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];o.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),a.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(o.size||t._flags._hasPatternMatch){const r=f.unknown(t,e,o,a,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 o=f.dependencies[r.rel](t,r,e,n,i);if(o){const r=t.$_createError(o.code,e,o.context,n,i);if(i.abortEarly)return{value:e,errors:r};a.push(r)}}return{value:e,errors:a}},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:a,message:o}){const s=i.resolve(e,n,r),l=d.isRef(i)?i.absolute(n):[];return a.$_match(s,n.localize(l,[e,...n.ancestors],a),r)?e:t("object.assert",{subject:i,message:o})},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:a})=>l.compare(Object.keys(e).length,r,i)?e:t.error("object."+n,{limit:a.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 a=this.clone();a.$_terms.patterns=a.$_terms.patterns||[];const o={[n?"regex":"schema"]:e,rule:t};return r.matches&&(o.matches=this.$_compile(r.matches),"array"!==o.matches.type&&(o.matches=o.matches.$_root.array().items(o.matches)),a.$_mutateRegister(o.matches),a.$_setFlag("_hasPatternMatch",!0,{clone:!1})),r.fallthrough&&(o.fallthrough=!0),a.$_terms.patterns.push(o),a.$_mutateRegister(t),a}},ref:{method(){return this.$_addRule("ref")},validate:(e,t)=>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 a=this.clone();a.$_terms.renames=a.$_terms.renames||[];for(const t of a.$_terms.renames)i(t.from!==e,"Cannot rename the same key multiple times");return t instanceof p&&a.$_mutateRegister(t),a.$_terms.renames.push({from:e,to:t,options:n(f.renameDefaults,r)}),a}},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 o.Sorter;for(const r of e.$_terms.keys)l.tryWithPath((()=>t.add(r,{after:r.schema.$_rootReferences(),group:r.key})),r.key);e.$_terms.keys=new 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:a}of t.dependencies)e=f.dependency(e,r,n,i,a);if(t.patterns)for(const{regex:r,schema:n,rule:i,fallthrough:a,matches:o}of t.patterns)e=e.pattern(r||n,i,{fallthrough:a,matches:o});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 a(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=a(e.prototype),Object.defineProperty(r,"name",{value:e.name,writable:!1}),Object.defineProperty(r,"length",{value:e.length,writable:!1}),Object.assign(r,e),r},f.dependency=function(e,t,r,n,a){i(null===r||"string"==typeof r,t,"key must be a strings"),a||(a=n.length>1&&"object"==typeof n[n.length-1]?n.pop():{}),l.assertOptions(a,["separator","isPresent"]),n=[].concat(n);const o=l.default(a.separator,"."),s=[];for(const e of n)i("string"==typeof e,t,"peers must be strings"),s.push(u.ref(e,{separator:o,ancestor:0,prefix:!1}));null!==r&&(r=u.ref(r,{separator:o,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,a)),c},f.dependencies={and(e,t,r,n,i){const a=[],o=[],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}))?a.push(e.key):o.push(e.key);if(a.length!==s&&o.length!==s)return{code:"object.and",context:{present:o,presentWithLabels:f.keysToLabels(e,o),missing:a,missingWithLabels:f.keysToLabels(e,a)}}},nand(e,t,r,n,i){const a=[],o=f.isPresent(t.options);for(const e of t.peers)o(e.resolve(r,n,i,null,{shadow:!1}))&&a.push(e.key);if(a.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 a=f.isPresent(t.options);for(const e of t.peers)if(a(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 a=[],o=f.isPresent(t.options);for(const e of t.peers)o(e.resolve(r,n,i,null,{shadow:!1}))&&a.push(e.key);if(!a.length||1===a.length)return;const s={peers:t.paths,peersWithLabels:f.keysToLabels(e,t.paths)};return s.present=a,s.presentWithLabels=f.keysToLabels(e,a),{code:"object.oxor",context:s}},with(e,t,r,n,i){const a=f.isPresent(t.options);for(const o of t.peers)if(!1===a(o.resolve(r,n,i,null,{shadow:!1})))return{code:"object.with",context:{main:t.key.key,mainWithLabel:f.keysToLabels(e,t.key.key),peer:o.key,peerWithLabel:f.keysToLabels(e,o.key)}}},without(e,t,r,n,i){const a=f.isPresent(t.options);for(const o of t.peers)if(a(o.resolve(r,n,i,null,{shadow:!1})))return{code:"object.without",context:{main:t.key.key,mainWithLabel:f.keysToLabels(e,t.key.key),peer:o.key,peerWithLabel:f.keysToLabels(e,o.key)}}},xor(e,t,r,n,i){const a=[],o=f.isPresent(t.options);for(const e of t.peers)o(e.resolve(r,n,i,null,{shadow:!1}))&&a.push(e.key);if(1===a.length)return;const s={peers:t.paths,peersWithLabels:f.keysToLabels(e,t.paths)};return 0===a.length?{code:"object.missing",context:s}:(s.present=a,s.presentWithLabels=f.keysToLabels(e,a),{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 a={};for(const o of e.$_terms.renames){const s=[],l="string"!=typeof o.from;if(l)for(const e in t){if(void 0===t[e]&&o.options.ignoreUndefined)continue;if(e===o.to)continue;const r=o.from.exec(e);r&&s.push({from:e,to:o.to,match:r})}else!Object.prototype.hasOwnProperty.call(t,o.from)||void 0===t[o.from]&&o.options.ignoreUndefined||s.push(o);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(!o.options.multiple&&a[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)&&!o.options.override&&!a[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],a[c]=!0,o.options.alias||delete t[s]}}}return!0},f.unknown=function(e,t,r,n,i,a){if(e.$_terms.patterns){let o=!1;const s=e.$_terms.patterns.map((e=>{if(e.matches)return o=!0,[]})),l=[t,...i.ancestors];for(const o of r){const u=t[o],c=[...i.path,o];for(let d=0;d<e.$_terms.patterns.length;++d){const p=e.$_terms.patterns[d];if(p.regex){const e=p.regex.test(o);if(i.mainstay.tracer.debug(i,"rule",`pattern.${d}`,e?"pass":"error"),!e)continue}else if(!p.schema.$_match(o,i.nest(p.schema,`pattern.${d}`),a))continue;r.delete(o);const f=i.localize(c,l,{schema:p.rule,key:o}),h=p.rule.$_validate(u,f,a);if(h.errors){if(a.abortEarly)return{value:t,errors:h.errors};n.push(...h.errors)}if(p.matches&&s[d].push(o),t[o]=h.value,!p.fallthrough)break}}if(o)for(let r=0;r<s.length;++r){const o=s[r];if(!o)continue;const u=e.$_terms.patterns[r].matches,d=i.localize(i.path,l,u),p=u.$_validate(o,d,a);if(p.errors){const r=c.details(p.errors,{override:!1});r.matches=o;const s=e.$_createError("object.pattern.match",t,r,i,a);if(a.abortEarly)return{value:t,errors:s};n.push(s)}}}if(r.size&&(e.$_terms.keys||e.$_terms.patterns)){if(a.stripUnknown&&!e._flags.unknown||a.skipFunctions){const e=!(!a.stripUnknown||!0!==a.stripUnknown&&!a.stripUnknown.objects);for(const n of r)e?(delete t[n],r.delete(n)):"function"==typeof t[n]&&r.delete(n)}if(!l.default(e._flags.unknown,a.allowUnknown))for(const o of r){const r=i.localize([...i.path,o],[]),s=e.$_createError("object.unknown",t[o],{child:o},r,a,{flags:!1});if(a.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),a=r(8160),o=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 a=l.generate(t,e,r,i),o=t.$_terms.link[0].ref;return a.$_validate(e,r.nest(a,`link:${o.display}:${a.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=o.ref(e),n("value"===e.type||"local"===e.type,"Invalid reference type:",e.type),n("local"===e.type||"root"===e.ancestor||e.ancestor>0,"Link cannot reference itself");const t=this.clone();return t.$_terms.link=[{ref:e}],t}},relative:{method(e=!0){return this.$_setFlag("relative",e)}}},overrides:{concat(e){n(this.$_terms.link,"Uninitialized link schema"),n(a.isSchema(e),"Invalid schema object"),n("link"!==e.type,"Cannot merge type link with another link");const t=this.clone();return t.$_terms.whens||(t.$_terms.whens=[]),t.$_terms.whens.push({concat:e}),t.$_mutateRebuild()}},manifest:{build:(e,t)=>(n(t.link,"Invalid link description missing link"),e.ref(t.link))}}),l.generate=function(e,t,r,n){let i=r.mainstay.links.get(e);if(i)return i._generate(t,r,n).schema;const a=e.$_terms.link[0].ref,{perspective:o,path:s}=l.perspective(a,r);l.assert(o,"which is outside of schema boundaries",a,e,r,n);try{i=s.length?o.$_reach(s):o}catch(t){l.assert(!1,"to non-existing schema",a,e,r,n)}return l.assert("link"!==i.type,"which is another link",a,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,a,o){e||n(!1,`"${s.label(i._flags,a,o)}" contains link reference "${r.display}" ${t}`)}},3832:(e,t,r)=>{const{assert:n}=r(8870),i=r(8068),a=r(8160),o={numberRx:/^\s*[+-]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:e([+-]?\d+))?\s*$/i,precisionRx:/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/,exponentialPartRegex:/[eE][+-]?\d+$/,leadingSignAndZerosRegex:/^[+-]?(0*)?/,dotRegex:/\./,trailingZerosRegex:/0+$/};e.exports=i.extend({type:"number",flags:{unsafe:{default:!1}},coerce:{from:"string",method(e,{schema:t,error:r}){if(!e.match(o.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(o.extractSignificantDigits(e)!==o.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!==o.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(!a.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:o})=>a.compare(e,r,i)?e:t.error("number."+n,{limit:o.limit,value:e}),args:[{name:"limit",ref:!0,assert:a.isNumber,message:"must be a number"}]},greater:{method(e){return this.$_addRule({name:"greater",method:"compare",args:{limit:e},operator:">"})}},integer:{method(){return this.$_addRule("integer")},validate:(e,t)=>Math.trunc(e)-e==0?e:t.error("number.integer")},less:{method(e){return this.$_addRule({name:"less",method:"compare",args:{limit:e},operator:"<"})}},max:{method(e){return this.$_addRule({name:"max",method:"compare",args:{limit:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"compare",args:{limit:e},operator:">="})}},multiple:{method(e){return this.$_addRule({name:"multiple",args:{base:e}})},validate:(e,t,{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(o.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"}}),o.extractSignificantDigits=function(e){return e.replace(o.exponentialPartRegex,"").replace(o.dotRegex,"").replace(o.trailingZerosRegex,"").replace(o.leadingSignAndZerosRegex,"")},o.normalizeDecimal=function(e){return(e=e.replace(/^\+/,"").replace(/\.0*$/,"").replace(/^(-?)\.([^\.]*)$/,"$10.$2").replace(/^(-?)0+([0-9])/,"$1$2")).includes(".")&&e.endsWith("0")&&(e=e.replace(/0+$/,"")),"-0"===e?"0":e}},8966:(e,t,r)=>{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:a,isEmailValid:o,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 a=t.$_getRule("case");a&&(e="upper"===a.args.direction?e.toLocaleUpperCase():e.toLocaleLowerCase());const o=t.$_getRule("trim");if(o&&o.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 a=i.args.limit;if(d.isResolvable(a)&&(a=a.resolve(e,r,n),!d.limit(a)))return{value:e,errors:t.$_createError("any.ref",a,{ref:i.args.limit,arg:"limit",reason:"must be a positive integer"},r,n)};e=e.slice(0,a)}}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})=>a(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 a=r.multiple?e.split(n):[e],s=[];for(const e of a)o(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 a=r[e];n("string"==typeof a,"version at position "+e+" must be a string");const o=p.guidVersions[a.toLowerCase()];n(o,"version at position "+e+" must be one of "+Object.keys(p.guidVersions).join(", ")),n(!i.has(o),"version at position "+e+" must not be a duplicate"),t+=o,i.add(o)}}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)=>a(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:a,args:o}){const s=!n&&e.length;return d.compare(s,r,a)?e:t.error("string."+i,{limit:o.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:o}){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||a(n,i)?e:t.error("string.domain",{value:n})}return r.relativeOnly?t.error("string.uriRelativeOnly"):r.scheme?t.error("string.uriCustomScheme",{scheme:o,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(a(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,a){return n(!a||!1,"Invalid encoding:",a),e.$_addRule({name:t,method:"length",args:{limit:r,encoding:a},operator:i})}},8826:(e,t,r)=>{const{assert:n}=r(8870),i=r(8068),a={};a.Map=class extends Map{slice(){return new a.Map(this)}},e.exports=i.extend({type:"symbol",terms:{map:{init:new a.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,a]=i;n("object"!=typeof e&&"function"!=typeof e&&"symbol"!=typeof e,"Key must not be of type object, function, or Symbol"),n("symbol"==typeof a,"Value must be a Symbol"),t.$_terms.map.set(e,a),r.push(a)}return t.valid(...r)}}},manifest:{build:(e,t)=>(t.map&&(e=e.map(t.map)),e)},messages:{"symbol.base":"{{#label}} must be a symbol","symbol.map":"{{#label}} must be one of {{#map}}"}})},8863:(e,t,r)=>{const{assert:n,clone:i,ignore:a,reach:o}=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 a=c.entry(e,t,i);n(!a.mainstay.externals.length,"Schema with external rules must use validateAsync()");const o={value:a.value};return a.error&&(o.error=a.error),a.mainstay.warnings.length&&(o.warning=l.details(a.mainstay.warnings)),a.mainstay.debug&&(o.debug=a.mainstay.debug),a.mainstay.artifacts&&(o.artifacts=a.mainstay.artifacts),o},t.entryAsync=async function(e,t,r){let n=s.defaults;r&&(n=s.preferences(s.defaults,r));const i=c.entry(e,t,n),a=i.mainstay;if(i.error)throw a.debug&&(i.error.debug=a.debug),i.error;if(a.externals.length){let t=i.value;const u=[];for(const i of a.externals){const d=i.state.path,p="link"===i.schema.type?a.links.get(i.schema):null;let f,h,m=t;const g=d.length?[t]:[],y=d.length?o(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),o=await i.method(m,{schema:i.schema,linked:p,state:i.state,prefs:r,original:y,error:e,errorsArray:c.errorsArray,warn:(e,t)=>a.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===o||o===m)continue;if(o instanceof l.Report){if(a.tracer.log(i.schema,i.state,"rule","external","error"),u.push(o),n.abortEarly)break;continue}if(Array.isArray(o)&&o[s.symbols.errors]){if(a.tracer.log(i.schema,i.state,"rule","external","error"),u.push(...o),n.abortEarly)break;continue}h?(a.tracer.value(i.state,"rule",m,o,"external"),h[f]=o):(a.tracer.value(i.state,"rule",t,o,"external"),t=o)}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),a.debug&&(i.error.debug=a.debug),i.error}if(!n.warnings&&!n.debug&&!n.artifacts)return i.value;const u={value:i.value};return a.warnings.length&&(u.warning=l.details(a.warnings)),a.debug&&(u.debug=a.debug),a.artifacts&&(u.artifacts=a.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:a}=c.tracer(r,n),o=n.debug?[]:null,s=r._ids._schemaChain?new Map:null,d=new c.Mainstay(i,o,s),p=r._ids._schemaChain?[{schema:r}]:null,f=new u([],[],{mainstay:d,schemas:p}),h=t.validate(e,r,f,n);a&&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 a=(i,a,o)=>t.$_createError(i,e,a,o||r,n),o={original:e,prefs:n,schema:t,state:r,error:a,errorsArray:c.errorsArray,warn:(e,t,n)=>r.mainstay.warnings.push(a(e,t,n)),message:(i,a)=>t.$_createError("custom",e,a,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,o);if(t){if(r.mainstay.tracer.value(r,"prepare",e,t.value),t.errors)return c.finalize(t.value,[].concat(t.errors),o);e=t.value}}if(l.coerce&&void 0!==e&&n.convert&&(!l.coerce.from||l.coerce.from.includes(typeof e))){const t=l.coerce.method(e,o);if(t){if(r.mainstay.tracer.value(r,"coerced",e,t.value),t.errors)return c.finalize(t.value,[].concat(t.errors),o);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,o);if("required"===d)return c.finalize(e,[t.$_createError("any.required",e,null,r,n)],o);if("optional"===d){if(t._flags.default!==s.symbols.deepDefault)return c.finalize(e,null,o);r.mainstay.tracer.value(r,"default",e,{}),e={}}}else if("forbidden"===d)return c.finalize(e,[t.$_createError("any.unknown",e,null,r,n)],o);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,o);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],o);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 a=t.$_createError("any.invalid",e,{invalids:t._invalids.values({display:!0})},r,n);if(n.abortEarly)return c.finalize(e,[a],o);p.push(a)}}if(l.validate){const t=l.validate(e,o);if(t&&(r.mainstay.tracer.value(r,"base",e,t.value),e=t.value,t.errors)){if(!Array.isArray(t.errors))return p.push(t.errors),c.finalize(e,p,o);if(t.errors.length)return p.push(...t.errors),c.finalize(e,p,o)}}return t._rules.length?c.rules(e,p,o):c.finalize(e,p,o)},c.rules=function(e,t,r){const{schema:n,state:i,prefs:a}=r;for(const o of n._rules){const l=n._definition.rules[o.method];if(l.convert&&a.convert){i.mainstay.tracer.log(n,i,"rule",o.name,"full");continue}let u,d=o.args;if(o._resolve.length){d=Object.assign({},d);for(const t of o._resolve){const r=l.argsByName.get(t),o=d[t].resolve(e,i,a),c=r.normalize?r.normalize(o):o,p=s.validateArg(c,null,r);if(p){u=n.$_createError("any.ref",o,{arg:t,ref:d[t],reason:p},i,a);break}d[t]=c}}u=u||l.validate(e,r,d,o);const p=c.rule(u,o);if(p.errors){if(i.mainstay.tracer.log(n,i,"rule",o.name,"error"),o.warn){i.mainstay.warnings.push(...p.errors);continue}if(a.abortEarly)return c.finalize(e,p.errors,r);t.push(...p.errors)}else i.mainstay.tracer.log(n,i,"rule",o.name,"pass"),i.mainstay.tracer.value(i,"rule",e,p.value,o.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:a,prefs:o}=r;if(t.length){const n=c.default("failover",void 0,t,r);void 0!==n&&(a.mainstay.tracer.value(a,"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);a.mainstay.tracer.value(a,"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);a.mainstay.tracer.value(a,"cast",e,n,i._flags.cast),e=n}}if(i.$_terms.externals&&o.externals&&!1!==o._externals)for(const{method:e}of i.$_terms.externals)a.mainstay.externals.push({method:e,schema:i,state:a,label:l.label(i._flags,a,o)});const s={value:e,errors:t.length?t:null};return i._flags.result&&(s.value="strip"===i._flags.result?void 0:r.original,a.mainstay.tracer.value(a,i._flags.result,e,s.value),a.shadow(e,i._flags.result)),i._cache&&!1!==o.cache&&!i._refs.length&&i._cache.set(r.original,s),void 0===e||s.errors||void 0===i._flags.artifact||(a.mainstay.artifacts=a.mainstay.artifacts||new Map,a.mainstay.artifacts.has(i._flags.artifact)||a.mainstay.artifacts.set(i._flags.artifact,[]),a.mainstay.artifacts.get(i._flags.artifact).push(a.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:a,state:o,prefs:l}=n,u=a._flags[e];if(l.noDefaults||void 0===u)return t;if(o.mainstay.tracer.log(a,o,"rule",e,"full"),!u)return u;if("function"==typeof u){const s=u.length?[i(o.ancestors[0]),n]:[];try{return u(...s)}catch(t){return void r.push(a.$_createError(`any.${e}`,null,{error:t},o,l))}}return"object"!=typeof u?u:u[s.symbols.literal]?u.literal:s.isResolvable(u)?u.resolve(t,o,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:a,entry:a,filter:a,log:a,resolve:a,value:a},c.errorsArray=function(){const e=[];return e[s.symbols.errors]=!0,e}},2036:(e,t,r)=>{const{assert:n,deepEqual:i}=r(8870),a=r(8160),o={};e.exports=o.Values=class{constructor(e,t){this._values=new Set(e),this._refs=new Set(t),this._lowercase=o.lowercases(e),this._override=!1}get length(){return this._values.size+this._refs.size}add(e,t){a.isResolvable(e)?this._refs.has(e)||(this._refs.add(e),t&&t.register(e)):this.has(e,null,null,!1)||(this._values.add(e),"string"==typeof e&&this._lowercase.set(e.toLowerCase(),e))}static merge(e,t,r){if(e=e||new o.Values,t){if(t._override)return t.clone();for(const r of[...t._values,...t._refs])e.add(r)}if(r)for(const t of[...r._values,...r._refs])e.remove(t);return e.length?e:null}remove(e){a.isResolvable(e)?this._refs.delete(e):(this._values.delete(e),"string"==typeof e&&this._lowercase.delete(e.toLowerCase()))}has(e,t,r,n){return!!this.get(e,t,r,n)}get(e,t,r,n){if(!this.length)return!1;if(this._values.has(e))return{value:e};if("string"==typeof e&&e&&n){const t=this._lowercase.get(e.toLowerCase());if(t)return{value:t}}if(!this._refs.size&&"object"!=typeof e)return!1;if("object"==typeof e)for(const t of this._values)if(i(t,e))return{value:t};if(t)for(const a of this._refs){const o=a.resolve(e,t,r,null,{in:!0});if(void 0===o)continue;const s=a.in&&"object"==typeof o?Array.isArray(o)?o:Object.keys(o):[o];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:a}}else if(i(t,e))return{value:t,ref:a}}return!1}override(){this._override=!0}values(e){if(e&&e.display){const e=[];for(const t of[...this._values,...this._refs])void 0!==t&&e.push(t);return e}return Array.from([...this._values,...this._refs])}clone(){const e=new o.Values(this._values,this._refs);return e._override=this._override,e}concat(e){n(!e._override,"Cannot concat override set of values");const t=new o.Values([...this._values,...e._values],[...this._refs,...e._refs]);return t._override=this._override,t}describe(){const e=[];this._override&&e.push({override:!0});for(const t of this._values.values())e.push(t&&"object"==typeof t?{value:t}:t);for(const t of this._refs.values())e.push(t.describe());return e}},o.Values.prototype[a.symbols.values]=!0,o.Values.prototype.slice=o.Values.prototype.clone,o.lowercases=function(e){const t=new Map;if(e)for(const r of e)"string"==typeof r&&t.set(r.toLowerCase(),r);return t}},4958:(e,t,r)=>{r.r(t),r.d(t,{analyzeDomain:()=>h,analyzeEmail:()=>_,errorCodes:()=>i,ipRegex:()=>N,isDomainValid:()=>m,isEmailValid:()=>A,uriDecode:()=>q,uriRegex:()=>M,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 a(e){return{code:e,error:i[e]}}const o=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 a("DOMAIN_NON_EMPTY_STRING");if("string"!=typeof e)throw new Error("Invalid input: domain must be a string");if(e.length>256)return a("DOMAIN_TOO_LONG");if(s.test(e)){if(!1===t.allowUnicode)return a("DOMAIN_INVALID_UNICODE_CHARS");e=e.normalize("NFC")}if(l.test(e))return a("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||o,n=e.split(".");if(n.length<r)return a("DOMAIN_SEGMENTS_COUNT");if(t.maxDomainSegments&&n.length>t.maxDomainSegments)return a("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 a("DOMAIN_FORBIDDEN_TLDS")}else if(i.deny.has(e))return a("DOMAIN_FORBIDDEN_TLDS")}for(let e=0;e<n.length;++e){const r=n[e];if(!r.length)return a("DOMAIN_EMPTY_SEGMENT");if(r.length>63)return a("DOMAIN_LONG_SEGMENT");if(e<n.length-1){if(t.allowUnderscore){if(!d.test(r))return a("DOMAIN_INVALID_CHARS")}else if(!c.test(r))return a("DOMAIN_INVALID_CHARS")}else if(!u.test(r))return a("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 a("EMPTY_STRING");const r=!b.test(e);if(!r){if(!1===t.allowUnicode)return a("FORBIDDEN_UNICODE");e=e.normalize("NFC")}const n=e.split("@");if(2!==n.length)return n.length>2?a("MULTIPLE_AT_CHAR"):a("MISSING_AT_CHAR");const[i,o]=n;if(!i)return a("EMPTY_LOCAL");if(!t.ignoreLength){if(e.length>254)return a("ADDRESS_TOO_LONG");if(v.encode(i).length>64)return a("LOCAL_TOO_LONG")}return function(e,t){const r=e.split(".");for(const e of r){if(!e.length)return a("EMPTY_LOCAL_SEGMENT");if(t){if(!T.test(e))return a("INVALID_LOCAL_CHARS")}else for(const t of e){if(T.test(t))continue;const e=S(t);if(!E.test(e))return a("INVALID_LOCAL_CHARS")}}return null}(i,r)||h(o,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="!\\$&'\\(\\)\\*\\+,;=",a="%"+t,o=n+a+i+":@",s="["+o+"]",l="(?:0{0,2}\\d|0?[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])";e.ipv4address="(?:"+l+"\\.){3}"+l;const 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+a+i+":]*",A="["+n+a+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+a+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="["+o+"\\/\\?]*(?=#|$)",e.queryWithSquareBrackets="["+o+"\\[\\]\\/\\?]*(?=#|$)",e.fragment="["+o+"\\/\\?]*",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 a="(?:"+(i?"(?:"+i+")":t.scheme)+":"+(e.domain?t.hierPartCapture:t.hierPart)+")";return F((e.allowRelative?"(?:"+a+"|"+n+")":a)+r,i)}function F(e,t=null){return{raw:e=`(?=.)(?!https?:/(?:$|[^/]))(?!https?:///)(?!https?:[^/])${e}`,regex:new RegExp(`^${e}$`),scheme:t}}const P=D({});function M(e={}){return e.scheme||e.allowRelative||e.relativeOnly||e.allowQuerySquareBrackets||e.domain?D(e):P}function N(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,a=t,o=k.accept;for(;t>-1&&t<e.length;){const s=$(e[t+1],4)|$(e[t+2],0),l=k.data[s];if(o=k.data[256+o+l],i=i<<6|s&k.data[364+l],o!==k.accept){if(o===k.reject)return null;if(t+=3,t>=e.length||"%"!==e[t])return null}else r+=e.slice(n,a),r+=i<=65535?String.fromCharCode(i):String.fromCharCode(55232+(i>>10),56320+(1023&i)),i=0,n=t+3,t=e.indexOf("%",n),a=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="",a=0,o=!1;const s=e=>{if(a)throw new Error("Formula missing closing parenthesis");const s=n.length?n[n.length-1]:null;if(o||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(o){if("]"===o)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)o?t===o?(s(),o=!1):i+=t:a?"("===t?(i+=t,++a):")"===t?(--a,a?i+=t:s(t)):i+=t:t in r.literals?o=r.literals[t]:"("===t?(s(),++a):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 a=[];if(e){let t="",i=0,o=!1;const s=()=>{if(!t)throw new Error(`Formula contains function ${n} with invalid arguments ${e}`);a.push(t),t=""};for(let n=0;n<e.length;++n){const a=e[n];o?(t+=a,a===o&&(o=!1)):a in r.literals&&!i?(t+=a,o=r.literals[a]):","!==a||i?(t+=a,"("===a?++i:")"===a&&--i):s()}s()}return a=a.map((e=>new t.Parser(e,this.settings))),function(e){const t=[];for(const r of a)t.push(r.evaluate(e));return 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 a=t[n+1];t.splice(n+1,1);const o=r.evaluate(a,e);t[n]=r.single(i.value,o)}}return r.operatorsOrder.forEach((n=>{for(let i=1;i<t.length-1;)if(n.includes(t[i])){const n=t[i],a=r.evaluate(t[i-1],e),o=r.evaluate(t[i+1],e);t.splice(i,2);const s=r.calculate(n,a,o);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),a=r(1687),o=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 o=i(e);if(!0===t)return o;const l=void 0!==r.nullOverride&&r.nullOverride;return a(o,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=o(e,r);n&&"object"==typeof n?u.set(n,c&&o(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 a(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),a=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(" "),a)}},4213:e=>{e.exports=class extends Error{constructor(e,t){var r,n,i,a;super(e||"Unknown error"),r=this,i="AssertError",(n="symbol"==typeof(a=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"))?a:String(a))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),a=r(7043),o={needsProtoHack:new Set([i.set,i.map,i.weakSet,i.weakMap])};e.exports=o.clone=function(e,t={},r=null){if("object"!=typeof e||null===e)return e;let n=o.clone,s=r;if(t.shallow){if(!0!==t.shallow)return o.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=o.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=a.keys(e,t);for(const r of c){if("__proto__"===r)continue;if(l===i.array&&"length"===r){u.length=e.length;continue}const a=Object.getOwnPropertyDescriptor(e,r);a?a.get||a.set?Object.defineProperty(u,r,a):a.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},o.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 o.clone(e,t,i)},o.base=function(e,t,r){if(!1===r.prototype)return o.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(o.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),a=r(6064),o=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 a;n=null!==(a=n)&&void 0!==a?a:s.compare(r);let t=!1;for(const[r,a]of i.entries())if(n(r,e)){++a.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 o=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,a]of i.entries())if(n(r,t)){e=a;break}}else e=i.get(t);if(e&&(++e.hits,++o,r.once&&e.hits>e.allowed))return!1}if(r.only&&o!==e.length)return!1;for(const e of i.values())if(e.hits!==e.allowed&&e.hits<e.allowed&&!r.part)return!1;return!!o},s.object=function(e,t,r){n(void 0===r.once,"Cannot use option once with object");const i=o.keys(e,r);if(!i.length)return!1;if(Array.isArray(t))return s.array(i,t,r);const a=Object.getOwnPropertySymbols(t).filter((e=>t.propertyIsEnumerable(e))),l=[...Object.keys(t),...a],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,o=[];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}),o.push(a(e)))}else if(r.once||r.only)return!1;if(!o.length)return!0;const s=new RegExp(`(${o.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,a){if(e===t)return 0!==e||1/e==1/t;const o=typeof e;if(o!==typeof t)return!1;if(null===e||null===t)return!1;if("function"===o){if(!r.deepFunction||e.toString()!==t.toString())return!1}else if("object"!==o)return e!=e&&t!=t;const 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=a.length-1;r>=0;--r)if(a[r].isSame(e,t))return!0;a.push(new i.SeenEntry(e,t));try{return!!i.isDeepEqualObj(s,e,t,r,a)}finally{a.pop()}},i.getSharedType=function(e,t,r){if(r)return Object.getPrototypeOf(e)!==Object.getPrototypeOf(t)?i.mismatched:n.getInternalProto(e);const a=n.getInternalProto(e);return a!==n.getInternalProto(t)?i.mismatched:a},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,a,o){const{isDeepEqual:s,valueOf:l,hasOwnEnumerableProperty:u}=i,{keys:c,getOwnPropertySymbols:d}=Object;if(e===n.array){if(!a.part){if(t.length!==r.length)return!1;for(let e=0;e<t.length;++e)if(!s(t[e],r[e],a,o))return!1;return!0}for(const e of t)for(const t of r)if(s(e,t,a,o))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,a,o)){e.delete(n),t=!0;break}if(!t)return!1}}}else if(e===n.map){if(t.size!==r.size)return!1;for(const[e,n]of Map.prototype.entries.call(t)){if(void 0===n&&!Map.prototype.has.call(r,e))return!1;if(!s(n,Map.prototype.get.call(r,e),a,o))return!1}}else if(e===n.error&&(t.name!==r.name||t.message!==r.message))return!1;const p=l(t),f=l(r);if((t!==p||r!==f)&&!s(p,f,a,o))return!1;const h=c(t);if(!a.part&&h.length!==c(r).length&&!a.skip)return!1;let m=0;for(const e of h)if(a.skip&&a.skip.includes(e))void 0===r[e]&&++m;else{if(!u(r,e))return!1;if(!s(t[e],r[e],a,o))return!1}if(!a.part&&h.length-m!==c(r).length)return!1;if(!1!==a.symbols){const e=d(t),n=new Set(d(r));for(const i of e){var g;if(null===(g=a.skip)||void 0===g||!g.includes(i))if(u(t,i)){if(!u(r,i))return!1;if(!s(t[i],r[i],a,o))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,"&"],[60,"<"],[62,">"],[34,"""],[160," "],[162,"¢"],[163,"£"],[164,"¤"],[169,"©"],[174,"®"]]),t.safeCharCodes=function(){const e=new Set;for(let t=32;t<123;++t)(t>=97||t>=65&&t<=90||t>=48&&t<=57||32===t||46===t||44===t||45===t||58===t||95===t)&&e.add(t);return e}()},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=[],a=Array.isArray(e)?new Set(e):e,o=new Set;for(const e of r)if(t.has(a,e)&&!o.has(e)){if(n.first)return e;i.push(e),o.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),a=r(7043),o={};e.exports=o.merge=function(e,t,r){if(n(e&&"object"==typeof e,"Invalid target value: must be an object"),n(null==t||"object"==typeof t,"Invalid source value: must be null, undefined, or an object"),!t)return e;if(r=Object.assign({nullOverride:!0,mergeArrays:!0},r),Array.isArray(t)){n(Array.isArray(e),"Cannot merge array onto an object"),r.mergeArrays||(e.length=0);for(let n=0;n<t.length;++n)e.push(i(t[n],{symbols:r.symbols}));return e}const s=a.keys(t,r);for(let n=0;n<s.length;++n){const a=s[n];if("__proto__"===a||!Object.prototype.propertyIsEnumerable.call(t,a))continue;const l=t[a];if(l&&"object"==typeof l){if(e[a]===l)continue;!e[a]||"object"!=typeof e[a]||Array.isArray(e[a])!==Array.isArray(l)||l instanceof Date||l instanceof RegExp?e[a]=i(l,{symbols:r.symbols}):o.merge(e[a],l,r)}else(null!=l||r.nullOverride)&&(e[a]=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 a=Array.isArray(t);n(!a||!r.separator,"Separator option is not valid for array-based chain");const o=a?t:t.split(r.separator||".");let s=e;for(let e=0;e<o.length;++e){let a=o[e];const l=r.iterables&&i.iterables(s);if(Array.isArray(s)||"set"===l){const e=Number(a);Number.isInteger(e)&&(a=e<0?s.length+e:e)}if(!s||"function"==typeof s&&!1===r.functions||!l&&void 0===s[a]){n(!r.strict||e+1===o.length,"Missing segment",a,"in reach path ",t),n("object"==typeof s||!0===r.functions||"function"!=typeof s,"Invalid segment",a,"in reach path ",t),s=r.default;break}s=l?"set"===l?[...s][a]:s.get(a):s[a]}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 a=n(e,i,r);return null!=a?a:""}))}},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,a=()=>{const r=Math.min(e,2147483647);e-=r,i((()=>e>0?a():n(t)),r)};e!==1/0&&a()}))}},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,a,o,s;t=null!==(r=t)&&void 0!==r?r:{};const l=[].concat(null!==(i=t.before)&&void 0!==i?i:[]),u=[].concat(null!==(a=t.after)&&void 0!==a?a:[]),c=null!==(o=t.group)&&void 0!==o?o:"?",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 a of this._items){var n;const o=a.seq,s=a.group;r[s]=null!==(n=r[s])&&void 0!==n?n:[],r[s].push(o),e[o]=a.before;for(const e of a.after){var i;t[e]=null!==(i=t[e])&&void 0!==i?i:[],t[e].push(o)}}for(const t in e){const n=[];for(const i in e[t]){var a;const o=e[t][i];r[o]=null!==(a=r[o])&&void 0!==a?a:[],n.push(...r[o])}e[t]=n}for(const n in t)if(r[n])for(const i of r[n])e[i].push(...t[n]);const o={};for(const t in e){const r=e[t];for(const e of r){var s;o[e]=null!==(s=o[e])&&void 0!==s?s:[],o[e].push(t)}}const l={},u=[];for(let e=0;e<this._items.length;++e){let t=e;if(o[e]){t=null;for(let e=0;e<this._items.length;++e){if(!0===l[e])continue;o[e]||(o[e]=[]);const r=o[e].length;let n=0;for(let t=0;t<r;++t)l[o[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 a=t[n]={exports:{}};return e[n](a,a.exports,r),a.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()},288:(e,t,r)=>{var n="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||void 0!==r.g&&r.g,i=function(){function e(){this.fetch=!1,this.DOMException=n.DOMException}return e.prototype=n,new e}();!function(e){!function(t){var r=void 0!==e&&e||"undefined"!=typeof self&&self||void 0!==r&&r,n="URLSearchParams"in r,i="Symbol"in r&&"iterator"in Symbol,a="FileReader"in r&&"Blob"in r&&function(){try{return new Blob,!0}catch(e){return!1}}(),o="FormData"in r,s="ArrayBuffer"in r;if(s)var l=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(e){return e&&l.indexOf(Object.prototype.toString.call(e))>-1};function c(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 d(e){return"string"!=typeof e&&(e=String(e)),e}function p(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return i&&(t[Symbol.iterator]=function(){return t}),t}function f(e){this.map={},e instanceof f?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function h(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function m(e){return new Promise((function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}}))}function g(e){var t=new FileReader,r=m(t);return t.readAsArrayBuffer(e),r}function y(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function b(){return this.bodyUsed=!1,this._initBody=function(e){var t;this.bodyUsed=this.bodyUsed,this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:a&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:o&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:n&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():s&&a&&(t=e)&&DataView.prototype.isPrototypeOf(t)?(this._bodyArrayBuffer=y(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s&&(ArrayBuffer.prototype.isPrototypeOf(e)||u(e))?this._bodyArrayBuffer=y(e):this._bodyText=e=Object.prototype.toString.call(e):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):n&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},a&&(this.blob=function(){var e=h(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(){return this._bodyArrayBuffer?h(this)||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer)):this.blob().then(g)}),this.text=function(){var e,t,r,n=h(this);if(n)return n;if(this._bodyBlob)return e=this._bodyBlob,r=m(t=new FileReader),t.readAsText(e),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)},o&&(this.formData=function(){return this.text().then(A)}),this.json=function(){return this.text().then(JSON.parse)},this}f.prototype.append=function(e,t){e=c(e),t=d(t);var r=this.map[e];this.map[e]=r?r+", "+t:t},f.prototype.delete=function(e){delete this.map[c(e)]},f.prototype.get=function(e){return e=c(e),this.has(e)?this.map[e]:null},f.prototype.has=function(e){return this.map.hasOwnProperty(c(e))},f.prototype.set=function(e,t){this.map[c(e)]=d(t)},f.prototype.forEach=function(e,t){for(var r in this.map)this.map.hasOwnProperty(r)&&e.call(t,this.map[r],r,this)},f.prototype.keys=function(){var e=[];return this.forEach((function(t,r){e.push(r)})),p(e)},f.prototype.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),p(e)},f.prototype.entries=function(){var e=[];return this.forEach((function(t,r){e.push([r,t])})),p(e)},i&&(f.prototype[Symbol.iterator]=f.prototype.entries);var v=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function _(e,t){if(!(this instanceof _))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');var r,n,i=(t=t||{}).body;if(e instanceof _){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new f(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,i||null==e._bodyInit||(i=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 f(t.headers)),this.method=(n=(r=t.method||this.method||"GET").toUpperCase(),v.indexOf(n)>-1?n:r),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(i),!("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 A(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 w(e,t){if(!(this instanceof w))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText=void 0===t.statusText?"":""+t.statusText,this.headers=new f(t.headers),this.url=t.url||"",this._initBody(e)}_.prototype.clone=function(){return new _(this,{body:this._bodyInit})},b.call(_.prototype),b.call(w.prototype),w.prototype.clone=function(){return new w(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new f(this.headers),url:this.url})},w.error=function(){var e=new w(null,{status:0,statusText:""});return e.type="error",e};var S=[301,302,303,307,308];w.redirect=function(e,t){if(-1===S.indexOf(t))throw new RangeError("Invalid status code");return new w(null,{status:t,headers:{location:e}})},t.DOMException=r.DOMException;try{new t.DOMException}catch(e){t.DOMException=function(e,t){this.message=e,this.name=t;var r=Error(e);this.stack=r.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function T(e,n){return new Promise((function(i,o){var l=new _(e,n);if(l.signal&&l.signal.aborted)return o(new t.DOMException("Aborted","AbortError"));var u=new XMLHttpRequest;function c(){u.abort()}u.onload=function(){var e,t,r={status:u.status,statusText:u.statusText,headers:(e=u.getAllResponseHeaders()||"",t=new f,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();t.append(n,i)}})),t)};r.url="responseURL"in u?u.responseURL:r.headers.get("X-Request-URL");var n="response"in u?u.response:u.responseText;setTimeout((function(){i(new w(n,r))}),0)},u.onerror=function(){setTimeout((function(){o(new TypeError("Network request failed"))}),0)},u.ontimeout=function(){setTimeout((function(){o(new TypeError("Network request failed"))}),0)},u.onabort=function(){setTimeout((function(){o(new t.DOMException("Aborted","AbortError"))}),0)},u.open(l.method,function(e){try{return""===e&&r.location.href?r.location.href:e}catch(t){return e}}(l.url),!0),"include"===l.credentials?u.withCredentials=!0:"omit"===l.credentials&&(u.withCredentials=!1),"responseType"in u&&(a?u.responseType="blob":s&&l.headers.get("Content-Type")&&-1!==l.headers.get("Content-Type").indexOf("application/octet-stream")&&(u.responseType="arraybuffer")),!n||"object"!=typeof n.headers||n.headers instanceof f?l.headers.forEach((function(e,t){u.setRequestHeader(t,e)})):Object.getOwnPropertyNames(n.headers).forEach((function(e){u.setRequestHeader(e,d(n.headers[e]))})),l.signal&&(l.signal.addEventListener("abort",c),u.onreadystatechange=function(){4===u.readyState&&l.signal.removeEventListener("abort",c)}),u.send(void 0===l._bodyInit?null:l._bodyInit)}))}T.polyfill=!0,r.fetch||(r.fetch=T,r.Headers=f,r.Request=_,r.Response=w),t.Headers=f,t.Request=_,t.Response=w,t.fetch=T}({})}(i),i.fetch.ponyfill=!0,delete i.fetch.polyfill;var a=n.fetch?n:i;(t=a.fetch).default=a.fetch,t.fetch=a.fetch,t.Headers=a.Headers,t.Request=a.Request,t.Response=a.Response,e.exports=t},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),a=r(9005),o=n?n.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":o&&o in Object(e)?i(e):a(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),a=r(1580),o=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!(!a(e)||i(e))&&(n(e)?p:s).test(o(e))}},674:(e,t,r)=>{var n=r(7379),i=r(5387),a=r(547),o={};o["[object Float32Array]"]=o["[object Float64Array]"]=o["[object Int8Array]"]=o["[object Int16Array]"]=o["[object Int32Array]"]=o["[object Uint8Array]"]=o["[object Uint8ClampedArray]"]=o["[object Uint16Array]"]=o["[object Uint32Array]"]=!0,o["[object Arguments]"]=o["[object Array]"]=o["[object ArrayBuffer]"]=o["[object Boolean]"]=o["[object DataView]"]=o["[object Date]"]=o["[object Error]"]=o["[object Function]"]=o["[object Map]"]=o["[object Number]"]=o["[object Object]"]=o["[object RegExp]"]=o["[object Set]"]=o["[object String]"]=o["[object WeakMap]"]=!1,e.exports=function(e){return a(e)&&i(e.length)&&!!o[n(e)]}},195:(e,t,r)=>{var n=r(4882),i=r(8121),a=Object.prototype.hasOwnProperty;e.exports=function(e){if(!n(e))return i(e);var t=[];for(var r in Object(e))a.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,a=i.hasOwnProperty,o=i.toString,s=n?n.toStringTag:void 0;e.exports=function(e){var t=a.call(e,s),r=e[s];try{e[s]=void 0;var n=!0}catch(e){}var i=o.call(e);return n&&(t?e[s]=r:delete e[s]),i}},8486:(e,t,r)=>{var n=r(3103),i=r(9770),a=r(9413),o=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(a),b=u(o),v=u(s),_=l;(n&&_(new n(new ArrayBuffer(1)))!=h||i&&_(new i)!=c||a&&_(a.resolve())!=d||o&&_(new o)!=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),a=(n=/[^.]+$/.exec(i&&i.keys&&i.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"";e.exports=function(e){return!!a&&a 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,a=i&&e&&!e.nodeType&&e,o=a&&a.exports===i&&n.process,s=function(){try{return a&&a.require&&a.require("util").types||o&&o.binding&&o.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,a=n||i||Function("return this")();e.exports=a},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),a=r(6131),o=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=a(t)||0,n(r)&&(m=!!r.leading,c=(g="maxWait"in r)?o(a(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),a=Object.prototype,o=a.hasOwnProperty,s=a.propertyIsEnumerable,l=n(function(){return arguments}())?n:function(e){return i(e)&&o.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),a=t&&!t.nodeType&&t,o=a&&e&&!e.nodeType&&e,s=o&&o.exports===a?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),a=r(3283),o=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)&&(o(e)||"string"==typeof e||"function"==typeof e.splice||l(e)||c(e)||a(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),a=r(2306),o=a&&a.isTypedArray,s=o?i(o):n;e.exports=s},5250:function(e,t,r){var n;e=r.nmd(e),function(){var i,a="Expected a function",o="__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]",P="[object Float64Array]",M="[object Int8Array]",N="[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/,ae=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,oe=/\{\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+"]",Pe="[^"+Ae+xe+Re+Se+Te+Ee+"]",Me="\\ud83c[\\udffb-\\udfff]",Ne="[^"+Ae+"]",Le="(?:\\ud83c[\\udde6-\\uddff]){2}",ke="[\\ud800-\\udbff][\\udc00-\\udfff]",qe="["+Ee+"]",$e="\\u200d",ze="(?:"+Fe+"|"+Pe+")",Be="(?:"+qe+"|"+Pe+")",Ge="(?:['’](?:d|ll|m|re|s|t|ve))?",Ue="(?:['’](?:D|LL|M|RE|S|T|VE))?",Ve="(?:"+je+"|"+Me+")?",He="["+Oe+"]?",Ye=He+Ve+"(?:"+$e+"(?:"+[Ne,Le,ke].join("|")+")"+He+Ve+")*",Xe="(?:"+[De,Le,ke].join("|")+")"+Ye,We="(?:"+[Ne+je+"?",je,Le,ke,Ce].join("|")+")",Ke=RegExp("['’]","g"),Qe=RegExp(je,"g"),Ze=RegExp(Me+"(?="+Me+")|"+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[P]=it[M]=it[N]=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 at={};at[m]=at[g]=at[R]=at[D]=at[y]=at[b]=at[F]=at[P]=at[M]=at[N]=at[L]=at[w]=at[S]=at[T]=at[O]=at[x]=at[C]=at[I]=at[k]=at[q]=at[$]=at[z]=!0,at[v]=at[_]=at[j]=!1;var ot={"\\":"\\","'":"'","\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&>.isArrayBuffer,bt=gt&>.isDate,vt=gt&>.isMap,_t=gt&>.isRegExp,At=gt&>.isSet,wt=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,a=null==e?0:e.length;++i<a;){var o=e[i];t(n,o,r(o),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,a=[];++r<n;){var o=e[r];t(o,r,e)&&(a[i++]=o)}return a}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,a=null==e?0:e.length;for(n&&a&&(r=e[++i]);++i<a;)r=t(r,e[i],i,e);return r}function Pt(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 Mt(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 Nt=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,a=r+(n?1:-1);n?a--:++a<i;)if(t(e[a],a,e))return a;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,a=e.length;++i<a;)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,a){r=n?(n=!1,e):t(r,e,i,a)})),r}function Ht(e,t){for(var r,n=-1,a=e.length;++n<a;){var o=t(e[n]);o!==i&&(r=r===i?o:r+o)}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({"&":"&","<":"<",">":">",'"':""","'":"'"});function rr(e){return"\\"+ot[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 ar(e,t){return function(r){return e(t(r))}}function or(e,t){for(var r=-1,n=e.length,i=0,a=[];++r<n;){var o=e[r];o!==t&&o!==s||(e[r]=s,a[i++]=r)}return a}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):Nt(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({"&":"&","<":"<",">":">",""":'"',"'":"'"}),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,Pe=0,Me=(r=/[^.]+$/.exec(Re&&Re.keys&&Re.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"",Ne=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=ar(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=la(Te,"defineProperty");return e({},"",{}),e}catch(e){}}(),ot=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,Nt=t.isFinite,Ut=Ce.join,hr=ar(Te.keys,Te),mr=Se.max,gr=Se.min,yr=ie.now,br=t.parseInt,vr=Se.random,_r=Ce.reverse,Ar=la(t,"DataView"),wr=la(t,"Map"),Sr=la(t,"Promise"),Tr=la(t,"Set"),Er=la(t,"WeakMap"),Or=la(Te,"create"),xr=Er&&new Er,Cr={},Ir=Na(Ar),jr=Na(wr),Rr=Na(Sr),Dr=Na(Tr),Fr=Na(Er),Pr=ze?ze.prototype:i,Mr=Pr?Pr.valueOf:i,Nr=Pr?Pr.toString:i;function Lr(e){if(es(e)&&!Go(e)&&!(e instanceof zr)){if(e instanceof $r)return e;if(Fe.call(e,"__wrapped__"))return La(e)}return new $r(e)}var kr=function(){function e(){}return function(t){if(!Jo(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=Go(e),n=!r&&Bo(e),i=!r&&!n&&Yo(e),a=!r&&!n&&!i&&ls(e),o=r||n||i||a,s=o?Yt(e.length,Oe):[],l=s.length;for(var u in e)!t&&!Fe.call(e,u)||o&&("length"==u||i&&("offset"==u||"parent"==u)||a&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||ma(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 Ra(Oi(e),an(t,0,e.length))}function Kr(e){return Ra(Oi(e))}function Qr(e,t,r){(r!==i&&!qo(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)&&qo(n,r)&&(r!==i||t in e)||rn(e,t,r)}function Jr(e,t){for(var r=e.length;r--;)if(qo(e[r][0],t))return r;return-1}function en(e,t,r,n){return cn(e,(function(e,i,a){t(n,e,r(e),a)})),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,a=t.length,o=n(a),s=null==e;++r<a;)o[r]=s?i:Es(e,t[r]);return o}function an(e,t,r){return e==e&&(r!==i&&(e=e<=r?e:r),t!==i&&(e=e>=t?e:t)),e}function on(e,t,r,n,a,o){var s,l=1&t,u=2&t,c=4&t;if(r&&(s=a?r(e,n,a,o):r(e)),s!==i)return s;if(!Jo(e))return e;var d=Go(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=da(e),f=p==_||p==A;if(Yo(e))return _i(e,l);if(p==T||p==m||f&&!a){if(s=u||f?{}:fa(e),!l)return u?function(e,t){return xi(e,ca(e),t)}(e,function(e,t){return e&&xi(t,Rs(t),e)}(s,e)):function(e,t){return xi(e,ua(e),t)}(e,tn(s,e))}else{if(!at[p])return a?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 P:case M:case N: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,Mr?Te(Mr.call(n)):{}}}(e,p,l)}}o||(o=new Hr);var h=o.get(e);if(h)return h;o.set(e,s),as(e)?e.forEach((function(n){s.add(on(n,t,r,n,e,o))})):ts(e)&&e.forEach((function(n,i){s.set(i,on(n,t,r,i,e,o))}));var g=d?i:(c?u?ta:ea:u?Rs:js)(e);return Et(g||e,(function(n,i){g&&(n=e[i=n]),Zr(s,i,on(n,t,r,i,e,o))})),s}function sn(e,t,r){var n=r.length;if(null==e)return!n;for(e=Te(e);n--;){var a=r[n],o=t[a],s=e[a];if(s===i&&!(a in e)||!o(s))return!1}return!0}function ln(e,t,r){if("function"!=typeof e)throw new xe(a);return xa((function(){e.apply(i,r)}),t)}function un(e,t,r,n){var i=-1,a=It,o=!0,s=e.length,l=[],u=t.length;if(!s)return l;r&&(t=Rt(t,Wt(r))),n?(a=jt,o=!1):t.length>=200&&(a=Qt,o=!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,o&&d==d){for(var p=u;p--;)if(t[p]===d)continue e;l.push(c)}else a(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===o?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?o: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=oa(this,e).delete(e);return this.size-=t?1:0,t},Ur.prototype.get=function(e){return oa(this,e).get(e)},Ur.prototype.has=function(e){return oa(this,e).has(e)},Ur.prototype.set=function(e,t){var r=oa(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,o),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,a=e.length;++n<a;){var o=e[n],s=t(o);if(null!=s&&(l===i?s==s&&!ss(s):r(s,l)))var l=s,u=o}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 a=-1,o=e.length;for(r||(r=ha),i||(i=[]);++a<o;){var s=e[a];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 Ko(e[t])}))}function An(e,t){for(var r=0,n=(t=gi(t,e)).length;null!=e&&r<n;)e=e[Ma(t[r++])];return r&&r==n?e:i}function wn(e,t,r){var n=t(e);return Go(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 a=Ne.call(e);return n&&(t?e[Ze]=r:delete e[Ze]),a}(e):function(e){return Ne.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 a=r?jt:It,o=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||o>=120&&p.length>=120)?new Vr(l&&p):i}p=e[0];var f=-1,h=u[0];e:for(;++f<o&&d.length<c;){var m=p[f],g=t?t(m):m;if(m=r||0!==m?m:0,!(h?Qt(h,g):a(d,g,r))){for(l=s;--l;){var y=u[l];if(!(y?Qt(y,g):a(e[l],g,r)))continue e}h&&h.push(g),d.push(m)}}return d}function Cn(e,t,r){var n=null==(e=Ta(e,t=gi(t,e)))?e:e[Ma(Xa(t))];return null==n?i:St(n,e,r)}function In(e){return es(e)&&Sn(e)==m}function jn(e,t,r,n,a){return e===t||(null==e||null==t||!es(e)&&!es(t)?e!=e&&t!=t:function(e,t,r,n,a,o){var s=Go(e),l=Go(t),u=s?g:da(e),c=l?g:da(t),d=(u=u==m?T:u)==T,p=(c=c==m?T:c)==T,f=u==c;if(f&&Yo(e)){if(!Yo(t))return!1;s=!0,d=!1}if(f&&!d)return o||(o=new Hr),s||ls(e)?Zi(e,t,r,n,a,o):function(e,t,r,n,i,a,o){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||!a(new Be(e),new Be(t)));case y:case b:case S:return qo(+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=o.get(e);if(u)return u==t;n|=2,o.set(e,t);var c=Zi(s(e),s(t),n,i,a,o);return o.delete(e),c;case I:if(Mr)return Mr.call(e)==Mr.call(t)}return!1}(e,t,u,r,n,a,o);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 o||(o=new Hr),a(A,E,r,n,o)}}return!!f&&(o||(o=new Hr),function(e,t,r,n,a,o){var s=1&r,l=ea(e),u=l.length;if(u!=ea(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=o.get(e),f=o.get(t);if(p&&f)return p==t&&f==e;var h=!0;o.set(e,t),o.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,o):n(g,y,d,e,t,o);if(!(b===i?g===y||a(g,y,r,n,o):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 o.delete(e),o.delete(t),h}(e,t,r,n,a,o))}(e,t,r,n,jn,a))}function Rn(e,t,r,n){var a=r.length,o=a,s=!n;if(null==e)return!o;for(e=Te(e);a--;){var l=r[a];if(s&&l[2]?l[1]!==e[l[0]]:!(l[0]in e))return!1}for(;++a<o;){var u=(l=r[a])[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!(!Jo(e)||(t=e,Me&&Me in t))&&(Ko(e)?qe:me).test(Na(e));var t}function Fn(e){return"function"==typeof e?e:null==e?rl:"object"==typeof e?Go(e)?kn(e[0],e[1]):Ln(e):dl(e)}function Pn(e){if(!_a(e))return hr(e);var t=[];for(var r in Te(e))Fe.call(e,r)&&"constructor"!=r&&t.push(r);return t}function Mn(e,t){return e<t}function Nn(e,t){var r=-1,i=Vo(e)?n(e.length):[];return cn(e,(function(e,n,a){i[++r]=t(e,n,a)})),i}function Ln(e){var t=sa(e);return 1==t.length&&t[0][2]?wa(t[0][0],t[0][1]):function(r){return r===e||Rn(r,e,t)}}function kn(e,t){return ya(e)&&Aa(t)?wa(Ma(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,a){e!==t&&gn(t,(function(o,s){if(a||(a=new Hr),Jo(o))!function(e,t,r,n,a,o,s){var l=Ea(e,r),u=Ea(t,r),c=s.get(u);if(c)Qr(e,r,c);else{var d=o?o(l,u,r+"",e,t,s):i,p=d===i;if(p){var f=Go(u),h=!f&&Yo(u),m=!f&&!h&&ls(u);d=u,f||h||m?Go(l)?d=l:Ho(l)?d=Oi(l):h?(p=!1,d=_i(u,!0)):m?(p=!1,d=wi(u,!0)):d=[]:ns(u)||Bo(u)?(d=l,Bo(l)?d=gs(l):Jo(l)&&!Ko(l)||(d=fa(u))):p=!1}p&&(s.set(u,d),a(d,u,n,o,s),s.delete(u)),Qr(e,r,d)}}(e,t,s,r,qn,n,a);else{var l=n?n(Ea(e,s),o,s+"",e,t,a):i;l===i&&(l=o),Qr(e,s,l)}}),Rs)}function $n(e,t){var r=e.length;if(r)return ma(t+=t<0?r:0,r)?e[t]:i}function zn(e,t,r){t=t.length?Rt(t,(function(e){return Go(e)?function(t){return An(t,1===e.length?e[0]:e)}:e})):[rl];var n=-1;t=Rt(t,Wt(aa()));var i=Nn(e,(function(e,r,i){var a=Rt(t,(function(t){return t(e)}));return{criteria:a,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,a=t.criteria,o=i.length,s=r.length;++n<o;){var l=Si(i[n],a[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,a={};++n<i;){var o=t[n],s=An(e,o);r(s,o)&&Kn(a,gi(o,e),s)}return a}function Gn(e,t,r,n){var i=n?$t:qt,a=-1,o=t.length,s=e;for(e===t&&(t=Oi(t)),r&&(s=Rt(e,Wt(r)));++a<o;)for(var l=0,u=t[a],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!==a){var a=i;ma(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 Ca(Sa(e,t,rl),e+"")}function Xn(e){return Xr(qs(e))}function Wn(e,t){var r=qs(e);return Ra(r,an(t,0,r.length))}function Kn(e,t,r,n){if(!Jo(e))return e;for(var a=-1,o=(t=gi(t,e)).length,s=o-1,l=e;null!=l&&++a<o;){var u=Ma(t[a]),c=r;if("__proto__"===u||"constructor"===u||"prototype"===u)return e;if(a!=s){var d=l[u];(c=n?n(d,u,l):i)===i&&(c=Jo(d)?d:ma(t[a+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 Ra(qs(e))}function ei(e,t,r){var i=-1,a=e.length;t<0&&(t=-t>a?0:a+t),(r=r>a?a:r)<0&&(r+=a),a=t>r?0:r-t>>>0,t>>>=0;for(var o=n(a);++i<a;)o[i]=e[i+t];return o}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 a=n+i>>>1,o=e[a];null!==o&&!ss(o)&&(r?o<=t:o<t)?n=a+1:i=a}return i}return ni(e,t,rl,r)}function ni(e,t,r,n){var a=0,o=null==e?0:e.length;if(0===o)return 0;for(var s=(t=r(t))!=t,l=null===t,u=ss(t),c=t===i;a<o;){var d=ft((a+o)/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?a=d+1:o=d}return gr(o,4294967294)}function ii(e,t){for(var r=-1,n=e.length,i=0,a=[];++r<n;){var o=e[r],s=t?t(o):o;if(!r||!qo(s,l)){var l=s;a[i++]=0===o?0:o}}return a}function ai(e){return"number"==typeof e?e:ss(e)?p:+e}function oi(e){if("string"==typeof e)return e;if(Go(e))return Rt(e,oi)+"";if(ss(e))return Nr?Nr.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function si(e,t,r){var n=-1,i=It,a=e.length,o=!0,s=[],l=s;if(r)o=!1,i=jt;else if(a>=200){var u=t?null:Hi(e);if(u)return sr(u);o=!1,i=Qt,l=new Vr}else l=t?[]:s;e:for(;++n<a;){var c=e[n],d=t?t(c):c;if(c=r||0!==c?c:0,o&&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=Ta(e,t=gi(t,e)))||delete e[Ma(Xa(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,a=n?i:-1;(n?a--:++a<i)&&t(e[a],a,e););return r?ei(e,n?0:a,n?a+1:i):ei(e,n?a+1:0,n?i:a)}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 a=-1,o=n(i);++a<i;)for(var s=e[a],l=-1;++l<i;)l!=a&&(o[a]=un(o[a]||s,e[l],t,r));return si(mn(o,1),t,r)}function fi(e,t,r){for(var n=-1,a=e.length,o=t.length,s={};++n<a;){var l=n<o?t[n]:i;r(s,e[n],l)}return s}function hi(e){return Ho(e)?e:[]}function mi(e){return"function"==typeof e?e:rl}function gi(e,t){return Go(e)?e:ya(e,t)?[e]:Pa(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=ot||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,a=e==e,o=ss(e),s=t!==i,l=null===t,u=t==t,c=ss(t);if(!l&&!c&&!o&&e>t||o&&s&&u&&!l&&!c||n&&s&&u||!r&&u||!a)return 1;if(!n&&!o&&!c&&e<t||c&&r&&a&&!n&&!o||l&&r&&a||!s&&a||!u)return-1}return 0}function Ti(e,t,r,i){for(var a=-1,o=e.length,s=r.length,l=-1,u=t.length,c=mr(o-s,0),d=n(u+c),p=!i;++l<u;)d[l]=t[l];for(;++a<s;)(p||a<o)&&(d[r[a]]=e[a]);for(;c--;)d[l++]=e[a++];return d}function Ei(e,t,r,i){for(var a=-1,o=e.length,s=-1,l=r.length,u=-1,c=t.length,d=mr(o-l,0),p=n(d+c),f=!i;++a<d;)p[a]=e[a];for(var h=a;++u<c;)p[h+u]=t[u];for(;++s<l;)(f||a<o)&&(p[h+r[s]]=e[a++]);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 a=!r;r||(r={});for(var o=-1,s=t.length;++o<s;){var l=t[o],u=n?n(r[l],e[l],l,r,e):i;u===i&&(u=e[l]),a?rn(r,l,u):Zr(r,l,u)}return r}function Ci(e,t){return function(r,n){var i=Go(r)?Tt:en,a=t?t():{};return i(r,e,aa(n,2),a)}}function Ii(e){return Yn((function(t,r){var n=-1,a=r.length,o=a>1?r[a-1]:i,s=a>2?r[2]:i;for(o=e.length>3&&"function"==typeof o?(a--,o):i,s&&ga(r[0],r[1],s)&&(o=a<3?i:o,a=1),t=Te(t);++n<a;){var l=r[n];l&&e(t,l,n,o)}return t}))}function ji(e,t){return function(r,n){if(null==r)return r;if(!Vo(r))return e(r,n);for(var i=r.length,a=t?i:-1,o=Te(r);(t?a--:++a<i)&&!1!==n(o[a],a,o););return r}}function Ri(e){return function(t,r,n){for(var i=-1,a=Te(t),o=n(t),s=o.length;s--;){var l=o[e?s:++i];if(!1===r(a[l],l,a))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),a=r?bi(r,1).join(""):t.slice(1);return n[e]()+a}}function Fi(e){return function(t){return Ft(Ks(Bs(t).replace(Ke,"")),e,"")}}function Pi(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 Jo(n)?n:r}}function Mi(e){return function(t,r,n){var a=Te(t);if(!Vo(t)){var o=aa(r,3);t=js(t),r=function(e){return o(a[e],e,a)}}var s=e(t,r,n);return s>-1?a[o?t[s]:s]:i}}function Ni(e){return Ji((function(t){var r=t.length,n=r,o=$r.prototype.thru;for(e&&t.reverse();n--;){var s=t[n];if("function"!=typeof s)throw new xe(a);if(o&&!l&&"wrapper"==na(s))var l=new $r([],!0)}for(n=l?n:r;++n<r;){var u=na(s=t[n]),c="wrapper"==u?ra(s):i;l=c&&ba(c[0])&&424==c[1]&&!c[4].length&&1==c[9]?l[na(c[0])].apply(l,c[3]):1==s.length&&ba(s)?l[u]():l.thru(s)}return function(){var e=arguments,n=e[0];if(l&&1==e.length&&Go(n))return l.plant(n).value();for(var i=0,a=r?t[i].apply(this,e):n;++i<r;)a=t[i].call(this,a);return a}}))}function Li(e,t,r,a,o,s,l,c,d,p){var f=t&u,h=1&t,m=2&t,g=24&t,y=512&t,b=m?i:Pi(e);return function u(){for(var v=arguments.length,_=n(v),A=v;A--;)_[A]=arguments[A];if(g)var w=ia(u),S=function(e,t){for(var r=e.length,n=0;r--;)e[r]===t&&++n;return n}(_,w);if(a&&(_=Ti(_,a,o,g)),s&&(_=Ei(_,s,l,g)),v-=S,g&&v<p){var T=or(_,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),a=Oi(e);n--;){var o=t[n];e[n]=ma(o,r)?a[o]:i}return e}(_,c):y&&v>1&&_.reverse(),f&&d<v&&(_.length=d),this&&this!==dt&&this instanceof u&&(O=b||Pi(O)),O.apply(E,_)}}function ki(e,t){return function(r,n){return function(e,t,r,n){return bn(e,(function(e,i,a){t(n,r(e),i,a)})),n}(r,e,t(n),{})}}function qi(e,t){return function(r,n){var a;if(r===i&&n===i)return t;if(r!==i&&(a=r),n!==i){if(a===i)return n;"string"==typeof r||"string"==typeof n?(r=oi(r),n=oi(n)):(r=ai(r),n=ai(n)),a=e(r,n)}return a}}function $i(e){return Ji((function(t){return t=Rt(t,Wt(aa())),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?" ":oi(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,a){return a&&"number"!=typeof a&&ga(t,r,a)&&(r=a=i),t=ps(t),r===i?(r=t,t=0):r=ps(r),function(e,t,r,i){for(var a=-1,o=mr(pt((t-e)/(r||1)),0),s=n(o);o--;)s[i?o:++a]=e,e+=r;return s}(t,r,a=a===i?t<r?1:-1:ps(a),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,a,o,s,u,c,d){var p=8&t;t|=p?l:64,4&(t&=~(p?64:l))||(t&=-4);var f=[e,t,a,p?o:i,p?s:i,p?i:o,p?i:s,u,c,d],h=r.apply(i,f);return ba(e)&&Oa(h,f),h.placeholder=n,Ia(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))&&Nt(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=da(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,o,c,d,p,f){var h=2&t;if(!h&&"function"!=typeof e)throw new xe(a);var m=o?o.length:0;if(m||(t&=-97,o=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=o,y=c;o=c=i}var b=h?i:ra(e),v=[e,t,r,o,c,g,y,d,p,f];if(b&&function(e,t){var r=e[1],n=t[1],i=r|n,a=i<131,o=n==u&&8==r||n==u&&256==r&&e[7].length<=t[8]||384==n&&t[7].length<=t[8]&&8==r;if(!a&&!o)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?or(e[3],s):t[4]}(l=t[5])&&(c=e[5],e[5]=c?Ei(c,l,t[6]):l,e[6]=c?or(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],o=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 a=Pi(e);return function o(){for(var s=arguments.length,l=n(s),u=s,c=ia(o);u--;)l[u]=arguments[u];var d=s<3&&l[0]!==c&&l[s-1]!==c?[]:or(l,c);return(s-=d.length)<r?Ui(e,t,Li,o.placeholder,i,l,d,i,i,r-s):St(this&&this!==dt&&this instanceof o?a:e,this,l)}}(e,t,f):t!=l&&33!=t||c.length?Li.apply(i,v):function(e,t,r,i){var a=1&t,o=Pi(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?o:e;++u<c;)d[u]=i[u];for(;l--;)d[u++]=arguments[++s];return St(p,a?r:this,d)}}(e,t,r,o);else var _=function(e,t,r){var n=1&t,i=Pi(e);return function t(){return(this&&this!==dt&&this instanceof t?i:e).apply(n?r:this,arguments)}}(e,t,r);return Ia((b?Qn:Oa)(_,v),e,t)}function Wi(e,t,r,n){return e===i||qo(e,je[r])&&!Fe.call(n,r)?t:e}function Ki(e,t,r,n,a,o){return Jo(e)&&Jo(t)&&(o.set(t,e),qn(e,t,i,Ki,o),o.delete(t)),e}function Qi(e){return ns(e)?i:e}function Zi(e,t,r,n,a,o){var s=1&r,l=e.length,u=t.length;if(l!=u&&!(s&&u>l))return!1;var c=o.get(e),d=o.get(t);if(c&&d)return c==t&&d==e;var p=-1,f=!0,h=2&r?new Vr:i;for(o.set(e,t),o.set(t,e);++p<l;){var m=e[p],g=t[p];if(n)var y=s?n(g,m,p,t,e,o):n(m,g,p,e,t,o);if(y!==i){if(y)continue;f=!1;break}if(h){if(!Mt(t,(function(e,t){if(!Qt(h,t)&&(m===e||a(m,e,r,n,o)))return h.push(t)}))){f=!1;break}}else if(m!==g&&!a(m,g,r,n,o)){f=!1;break}}return o.delete(e),o.delete(t),f}function Ji(e){return Ca(Sa(e,i,Ga),e+"")}function ea(e){return wn(e,js,ua)}function ta(e){return wn(e,Rs,ca)}var ra=xr?function(e){return xr.get(e)}:sl;function na(e){for(var t=e.name+"",r=Cr[t],n=Fe.call(Cr,t)?r.length:0;n--;){var i=r[n],a=i.func;if(null==a||a==e)return i.name}return t}function ia(e){return(Fe.call(Lr,"placeholder")?Lr:e).placeholder}function aa(){var e=Lr.iteratee||nl;return e=e===nl?Fn:e,arguments.length?e(arguments[0],arguments[1]):e}function oa(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 sa(e){for(var t=js(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,Aa(i)]}return t}function la(e,t){var r=function(e,t){return null==e?i:e[t]}(e,t);return Dn(r)?r:i}var ua=mt?function(e){return null==e?[]:(e=Te(e),Ct(mt(e),(function(t){return He.call(e,t)})))}:hl,ca=mt?function(e){for(var t=[];e;)Dt(t,ua(e)),e=Ue(e);return t}:hl,da=Sn;function pa(e,t,r){for(var n=-1,i=(t=gi(t,e)).length,a=!1;++n<i;){var o=Ma(t[n]);if(!(a=null!=e&&r(e,o)))break;e=e[o]}return a||++n!=i?a:!!(i=null==e?0:e.length)&&Zo(i)&&ma(o,i)&&(Go(e)||Bo(e))}function fa(e){return"function"!=typeof e.constructor||_a(e)?{}:kr(Ue(e))}function ha(e){return Go(e)||Bo(e)||!!(Xe&&e&&e[Xe])}function ma(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 ga(e,t,r){if(!Jo(r))return!1;var n=typeof t;return!!("number"==n?Vo(r)&&ma(t,r.length):"string"==n&&t in r)&&qo(r[t],e)}function ya(e,t){if(Go(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 ba(e){var t=na(e),r=Lr[t];if("function"!=typeof r||!(t in zr.prototype))return!1;if(e===r)return!0;var n=ra(r);return!!n&&e===n[0]}(Ar&&da(new Ar(new ArrayBuffer(1)))!=D||wr&&da(new wr)!=w||Sr&&da(Sr.resolve())!=E||Tr&&da(new Tr)!=x||Er&&da(new Er)!=j)&&(da=function(e){var t=Sn(e),r=t==T?e.constructor:i,n=r?Na(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 va=Re?Ko:ml;function _a(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||je)}function Aa(e){return e==e&&!Jo(e)}function wa(e,t){return function(r){return null!=r&&r[e]===t&&(t!==i||e in Te(r))}}function Sa(e,t,r){return t=mr(t===i?e.length-1:t,0),function(){for(var i=arguments,a=-1,o=mr(i.length-t,0),s=n(o);++a<o;)s[a]=i[t+a];a=-1;for(var l=n(t+1);++a<t;)l[a]=i[a];return l[t]=r(s),St(e,this,l)}}function Ta(e,t){return t.length<2?e:An(e,ei(t,0,-1))}function Ea(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var Oa=ja(Qn),xa=ct||function(e,t){return dt.setTimeout(e,t)},Ca=ja(Zn);function Ia(e,t,r){var n=t+"";return Ca(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(ae,"{\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(oe);return t?t[1].split(se):[]}(n),r)))}function ja(e){var t=0,r=0;return function(){var n=yr(),a=16-(n-r);if(r=n,a>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function Ra(e,t){var r=-1,n=e.length,a=n-1;for(t=t===i?n:t;++r<t;){var o=Vn(r,a),s=e[o];e[o]=e[r],e[r]=s}return e.length=t,e}var Da,Fa,Pa=(Da=Fo((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===Fa.size&&Fa.clear(),e})),Fa=Da.cache,Da);function Ma(e){if("string"==typeof e||ss(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Na(e){if(null!=e){try{return De.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function La(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 ka=Yn((function(e,t){return Ho(e)?un(e,mn(t,1,Ho,!0)):[]})),qa=Yn((function(e,t){var r=Xa(t);return Ho(r)&&(r=i),Ho(e)?un(e,mn(t,1,Ho,!0),aa(r,2)):[]})),$a=Yn((function(e,t){var r=Xa(t);return Ho(r)&&(r=i),Ho(e)?un(e,mn(t,1,Ho,!0),i,r):[]}));function za(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,aa(t,3),i)}function Ba(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var a=n-1;return r!==i&&(a=fs(r),a=r<0?mr(n+a,0):gr(a,n-1)),kt(e,aa(t,3),a,!0)}function Ga(e){return null!=e&&e.length?mn(e,1):[]}function Ua(e){return e&&e.length?e[0]:i}var Va=Yn((function(e){var t=Rt(e,hi);return t.length&&t[0]===e[0]?xn(t):[]})),Ha=Yn((function(e){var t=Xa(e),r=Rt(e,hi);return t===Xa(r)?t=i:r.pop(),r.length&&r[0]===e[0]?xn(r,aa(t,2)):[]})),Ya=Yn((function(e){var t=Xa(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 Xa(e){var t=null==e?0:e.length;return t?e[t-1]:i}var Wa=Yn(Ka);function Ka(e,t){return e&&e.length&&t&&t.length?Gn(e,t):e}var Qa=Ji((function(e,t){var r=null==e?0:e.length,n=nn(e,t);return Un(e,Rt(t,(function(e){return ma(e,r)?+e:e})).sort(Si)),n}));function Za(e){return null==e?e:_r.call(e)}var Ja=Yn((function(e){return si(mn(e,1,Ho,!0))})),eo=Yn((function(e){var t=Xa(e);return Ho(t)&&(t=i),si(mn(e,1,Ho,!0),aa(t,2))})),to=Yn((function(e){var t=Xa(e);return t="function"==typeof t?t:i,si(mn(e,1,Ho,!0),i,t)}));function ro(e){if(!e||!e.length)return[];var t=0;return e=Ct(e,(function(e){if(Ho(e))return t=mr(e.length,t),!0})),Yt(t,(function(t){return Rt(e,Gt(t))}))}function no(e,t){if(!e||!e.length)return[];var r=ro(e);return null==t?r:Rt(r,(function(e){return St(t,i,e)}))}var io=Yn((function(e,t){return Ho(e)?un(e,t):[]})),ao=Yn((function(e){return pi(Ct(e,Ho))})),oo=Yn((function(e){var t=Xa(e);return Ho(t)&&(t=i),pi(Ct(e,Ho),aa(t,2))})),so=Yn((function(e){var t=Xa(e);return t="function"==typeof t?t:i,pi(Ct(e,Ho),i,t)})),lo=Yn(ro),uo=Yn((function(e){var t=e.length,r=t>1?e[t-1]:i;return r="function"==typeof r?(e.pop(),r):i,no(e,r)}));function co(e){var t=Lr(e);return t.__chain__=!0,t}function po(e,t){return t(e)}var fo=Ji((function(e){var t=e.length,r=t?e[0]:0,n=this.__wrapped__,a=function(t){return nn(t,e)};return!(t>1||this.__actions__.length)&&n instanceof zr&&ma(r)?((n=n.slice(r,+r+(t?1:0))).__actions__.push({func:po,args:[a],thisArg:i}),new $r(n,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(a)})),ho=Ci((function(e,t,r){Fe.call(e,r)?++e[r]:rn(e,r,1)})),mo=Mi(za),go=Mi(Ba);function yo(e,t){return(Go(e)?Et:cn)(e,aa(t,3))}function bo(e,t){return(Go(e)?Ot:dn)(e,aa(t,3))}var vo=Ci((function(e,t,r){Fe.call(e,r)?e[r].push(t):rn(e,r,[t])})),_o=Yn((function(e,t,r){var i=-1,a="function"==typeof t,o=Vo(e)?n(e.length):[];return cn(e,(function(e){o[++i]=a?St(t,e,r):Cn(e,t,r)})),o})),Ao=Ci((function(e,t,r){rn(e,r,t)}));function wo(e,t){return(Go(e)?Rt:Nn)(e,aa(t,3))}var So=Ci((function(e,t,r){e[r?0:1].push(t)}),(function(){return[[],[]]})),To=Yn((function(e,t){if(null==e)return[];var r=t.length;return r>1&&ga(e,t[0],t[1])?t=[]:r>2&&ga(t[0],t[1],t[2])&&(t=[t[0]]),zn(e,mn(t,1),[])})),Eo=ut||function(){return dt.Date.now()};function Oo(e,t,r){return t=r?i:t,t=e&&null==t?e.length:t,Xi(e,u,i,i,i,i,t)}function xo(e,t){var r;if("function"!=typeof t)throw new xe(a);return e=fs(e),function(){return--e>0&&(r=t.apply(this,arguments)),e<=1&&(t=i),r}}var Co=Yn((function(e,t,r){var n=1;if(r.length){var i=or(r,ia(Co));n|=l}return Xi(e,n,t,r,i)})),Io=Yn((function(e,t,r){var n=3;if(r.length){var i=or(r,ia(Io));n|=l}return Xi(t,n,e,r,i)}));function jo(e,t,r){var n,o,s,l,u,c,d=0,p=!1,f=!1,h=!0;if("function"!=typeof e)throw new xe(a);function m(t){var r=n,a=o;return n=o=i,d=t,l=e.apply(a,r)}function g(e){var r=e-c;return c===i||r>=t||r<0||f&&e-d>=s}function y(){var e=Eo();if(g(e))return b(e);u=xa(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=o=i,l)}function v(){var e=Eo(),r=g(e);if(n=arguments,o=this,c=e,r){if(u===i)return function(e){return d=e,u=xa(y,t),p?m(e):l}(c);if(f)return vi(u),u=xa(y,t),m(c)}return u===i&&(u=xa(y,t)),l}return t=ms(t)||0,Jo(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=o=u=i},v.flush=function(){return u===i?l:b(Eo())},v}var Ro=Yn((function(e,t){return ln(e,1,t)})),Do=Yn((function(e,t,r){return ln(e,ms(t)||0,r)}));function Fo(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(a);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],a=r.cache;if(a.has(i))return a.get(i);var o=e.apply(this,n);return r.cache=a.set(i,o)||a,o};return r.cache=new(Fo.Cache||Ur),r}function Po(e){if("function"!=typeof e)throw new xe(a);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)}}Fo.Cache=Ur;var Mo=yi((function(e,t){var r=(t=1==t.length&&Go(t[0])?Rt(t[0],Wt(aa())):Rt(mn(t,1),Wt(aa()))).length;return Yn((function(n){for(var i=-1,a=gr(n.length,r);++i<a;)n[i]=t[i].call(this,n[i]);return St(e,this,n)}))})),No=Yn((function(e,t){var r=or(t,ia(No));return Xi(e,l,i,t,r)})),Lo=Yn((function(e,t){var r=or(t,ia(Lo));return Xi(e,64,i,t,r)})),ko=Ji((function(e,t){return Xi(e,256,i,i,i,t)}));function qo(e,t){return e===t||e!=e&&t!=t}var $o=Gi(Tn),zo=Gi((function(e,t){return e>=t})),Bo=In(function(){return arguments}())?In:function(e){return es(e)&&Fe.call(e,"callee")&&!He.call(e,"callee")},Go=n.isArray,Uo=yt?Wt(yt):function(e){return es(e)&&Sn(e)==R};function Vo(e){return null!=e&&Zo(e.length)&&!Ko(e)}function Ho(e){return es(e)&&Vo(e)}var Yo=gt||ml,Xo=bt?Wt(bt):function(e){return es(e)&&Sn(e)==b};function Wo(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 Ko(e){if(!Jo(e))return!1;var t=Sn(e);return t==_||t==A||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Qo(e){return"number"==typeof e&&e==fs(e)}function Zo(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=d}function Jo(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)&&da(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},as=At?Wt(At):function(e){return es(e)&&da(e)==x};function os(e){return"string"==typeof e||!Go(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)&&Zo(e.length)&&!!it[Sn(e)]},us=Gi(Mn),cs=Gi((function(e,t){return e<=t}));function ds(e){if(!e)return[];if(Vo(e))return os(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=da(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?an(fs(e),0,f):0}function ms(e){if("number"==typeof e)return e;if(ss(e))return p;if(Jo(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Jo(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?"":oi(e)}var bs=Ii((function(e,t){if(_a(t)||Vo(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,a=n>2?t[2]:i;for(a&&ga(t[0],t[1],a)&&(n=1);++r<n;)for(var o=t[r],s=Rs(o),l=-1,u=s.length;++l<u;){var c=s[l],d=e[c];(d===i||qo(d,je[c])&&!Fe.call(e,c))&&(e[c]=o[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&&pa(e,t,On)}var xs=ki((function(e,t,r){null!=t&&"function"!=typeof t.toString&&(t=Ne.call(t)),e[t]=r}),Js(rl)),Cs=ki((function(e,t,r){null!=t&&"function"!=typeof t.toString&&(t=Ne.call(t)),Fe.call(e,t)?e[t].push(r):e[t]=[r]}),aa),Is=Yn(Cn);function js(e){return Vo(e)?Yr(e):Pn(e)}function Rs(e){return Vo(e)?Yr(e,!0):function(e){if(!Jo(e))return function(e){var t=[];if(null!=e)for(var r in Te(e))t.push(r);return t}(e);var t=_a(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)})),Ps=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,ta(e),r),n&&(r=on(r,7,Qi));for(var i=t.length;i--;)li(r,t[i]);return r})),Ms=Ji((function(e,t){return null==e?{}:function(e,t){return Bn(e,t,(function(t,r){return Os(e,r)}))}(e,t)}));function Ns(e,t){if(null==e)return{};var r=Rt(ta(e),(function(e){return[e]}));return t=aa(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 Wo(e)?e:new Ae(e)}})),Zs=Ji((function(e,t){return Et(t,(function(t){t=Ma(t),rn(e,t,Co(e[t],e))})),e}));function Js(e){return function(){return e}}var el=Ni(),tl=Ni(!0);function rl(e){return e}function nl(e){return Fn("function"==typeof e?e:on(e,1))}var il=Yn((function(e,t){return function(r){return Cn(r,e,t)}})),al=Yn((function(e,t){return function(r){return Cn(e,r,t)}}));function ol(e,t,r){var n=js(t),i=_n(t,n);null!=r||Jo(t)&&(i.length||!n.length)||(r=t,t=e,e=this,i=_n(t,js(t)));var a=!(Jo(r)&&"chain"in r&&!r.chain),o=Ko(e);return Et(i,(function(r){var n=t[r];e[r]=n,o&&(e.prototype[r]=function(){var t=this.__chain__;if(a||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(Mt);function dl(e){return ya(e)?Gt(Ma(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(a);return e=fs(e),function(){if(--e<1)return t.apply(this,arguments)}},Lr.ary=Oo,Lr.assign=bs,Lr.assignIn=vs,Lr.assignInWith=_s,Lr.assignWith=As,Lr.at=ws,Lr.before=xo,Lr.bind=Co,Lr.bindAll=Zs,Lr.bindKey=Io,Lr.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Go(e)?e:[e]},Lr.chain=co,Lr.chunk=function(e,t,r){t=(r?ga(e,t,r):t===i)?1:mr(fs(t),0);var a=null==e?0:e.length;if(!a||t<1)return[];for(var o=0,s=0,l=n(pt(a/t));o<a;)l[s++]=ei(e,o,o+=t);return l},Lr.compact=function(e){for(var t=-1,r=null==e?0:e.length,n=0,i=[];++t<r;){var a=e[t];a&&(i[n++]=a)}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(Go(r)?Oi(r):[r],mn(t,1))},Lr.cond=function(e){var t=null==e?0:e.length,r=aa();return e=t?Rt(e,(function(e){if("function"!=typeof e[1])throw new xe(a);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)}}(on(e,1))},Lr.constant=Js,Lr.countBy=ho,Lr.create=function(e,t){var r=kr(e);return null==t?r:tn(r,t)},Lr.curry=function e(t,r,n){var a=Xi(t,8,i,i,i,i,i,r=n?i:r);return a.placeholder=e.placeholder,a},Lr.curryRight=function e(t,r,n){var a=Xi(t,16,i,i,i,i,i,r=n?i:r);return a.placeholder=e.placeholder,a},Lr.debounce=jo,Lr.defaults=Ss,Lr.defaultsDeep=Ts,Lr.defer=Ro,Lr.delay=Do,Lr.difference=ka,Lr.differenceBy=qa,Lr.differenceWith=$a,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,aa(t,3),!0,!0):[]},Lr.dropWhile=function(e,t){return e&&e.length?ci(e,aa(t,3),!0):[]},Lr.fill=function(e,t,r,n){var a=null==e?0:e.length;return a?(r&&"number"!=typeof r&&ga(e,t,r)&&(r=0,n=a),function(e,t,r,n){var a=e.length;for((r=fs(r))<0&&(r=-r>a?0:a+r),(n=n===i||n>a?a:fs(n))<0&&(n+=a),n=r>n?0:hs(n);r<n;)e[r++]=t;return e}(e,t,r,n)):[]},Lr.filter=function(e,t){return(Go(e)?Ct:hn)(e,aa(t,3))},Lr.flatMap=function(e,t){return mn(wo(e,t),1)},Lr.flatMapDeep=function(e,t){return mn(wo(e,t),c)},Lr.flatMapDepth=function(e,t,r){return r=r===i?1:fs(r),mn(wo(e,t),r)},Lr.flatten=Ga,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=vo,Lr.initial=function(e){return null!=e&&e.length?ei(e,0,-1):[]},Lr.intersection=Va,Lr.intersectionBy=Ha,Lr.intersectionWith=Ya,Lr.invert=xs,Lr.invertBy=Cs,Lr.invokeMap=_o,Lr.iteratee=nl,Lr.keyBy=Ao,Lr.keys=js,Lr.keysIn=Rs,Lr.map=wo,Lr.mapKeys=function(e,t){var r={};return t=aa(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=aa(t,3),bn(e,(function(e,n,i){rn(r,n,t(e,n,i))})),r},Lr.matches=function(e){return Ln(on(e,1))},Lr.matchesProperty=function(e,t){return kn(e,on(t,1))},Lr.memoize=Fo,Lr.merge=Ds,Lr.mergeWith=Fs,Lr.method=il,Lr.methodOf=al,Lr.mixin=ol,Lr.negate=Po,Lr.nthArg=function(e){return e=fs(e),Yn((function(t){return $n(t,e)}))},Lr.omit=Ps,Lr.omitBy=function(e,t){return Ns(e,Po(aa(t)))},Lr.once=function(e){return xo(2,e)},Lr.orderBy=function(e,t,r,n){return null==e?[]:(Go(t)||(t=null==t?[]:[t]),Go(r=n?i:r)||(r=null==r?[]:[r]),zn(e,t,r))},Lr.over=ll,Lr.overArgs=Mo,Lr.overEvery=ul,Lr.overSome=cl,Lr.partial=No,Lr.partialRight=Lo,Lr.partition=So,Lr.pick=Ms,Lr.pickBy=Ns,Lr.property=dl,Lr.propertyOf=function(e){return function(t){return null==e?i:An(e,t)}},Lr.pull=Wa,Lr.pullAll=Ka,Lr.pullAllBy=function(e,t,r){return e&&e.length&&t&&t.length?Gn(e,t,aa(r,2)):e},Lr.pullAllWith=function(e,t,r){return e&&e.length&&t&&t.length?Gn(e,t,i,r):e},Lr.pullAt=Qa,Lr.range=pl,Lr.rangeRight=fl,Lr.rearg=ko,Lr.reject=function(e,t){return(Go(e)?Ct:hn)(e,Po(aa(t,3)))},Lr.remove=function(e,t){var r=[];if(!e||!e.length)return r;var n=-1,i=[],a=e.length;for(t=aa(t,3);++n<a;){var o=e[n];t(o,n,e)&&(r.push(o),i.push(n))}return Un(e,i),r},Lr.rest=function(e,t){if("function"!=typeof e)throw new xe(a);return Yn(e,t=t===i?t:fs(t))},Lr.reverse=Za,Lr.sampleSize=function(e,t,r){return t=(r?ga(e,t,r):t===i)?1:fs(t),(Go(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(Go(e)?Kr:Jn)(e)},Lr.slice=function(e,t,r){var n=null==e?0:e.length;return n?(r&&"number"!=typeof r&&ga(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=To,Lr.sortedUniq=function(e){return e&&e.length?ii(e):[]},Lr.sortedUniqBy=function(e,t){return e&&e.length?ii(e,aa(t,2)):[]},Lr.split=function(e,t,r){return r&&"number"!=typeof r&&ga(e,t,r)&&(t=r=i),(r=r===i?f:r>>>0)?(e=ys(e))&&("string"==typeof t||null!=t&&!is(t))&&!(t=oi(t))&&nr(e)?bi(cr(e),0,r):e.split(t,r):[]},Lr.spread=function(e,t){if("function"!=typeof e)throw new xe(a);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,aa(t,3),!1,!0):[]},Lr.takeWhile=function(e,t){return e&&e.length?ci(e,aa(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(a);return Jo(r)&&(n="leading"in r?!!r.leading:n,i="trailing"in r?!!r.trailing:i),jo(e,t,{leading:n,maxWait:t,trailing:i})},Lr.thru=po,Lr.toArray=ds,Lr.toPairs=Ls,Lr.toPairsIn=ks,Lr.toPath=function(e){return Go(e)?Rt(e,Ma):ss(e)?[e]:Oi(Pa(ys(e)))},Lr.toPlainObject=gs,Lr.transform=function(e,t,r){var n=Go(e),i=n||Yo(e)||ls(e);if(t=aa(t,4),null==r){var a=e&&e.constructor;r=i?n?new a:[]:Jo(e)&&Ko(a)?kr(Ue(e)):{}}return(i?Et:bn)(e,(function(e,n,i){return t(r,e,n,i)})),r},Lr.unary=function(e){return Oo(e,1)},Lr.union=Ja,Lr.unionBy=eo,Lr.unionWith=to,Lr.uniq=function(e){return e&&e.length?si(e):[]},Lr.uniqBy=function(e,t){return e&&e.length?si(e,aa(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=ro,Lr.unzipWith=no,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=io,Lr.words=Ks,Lr.wrap=function(e,t){return No(mi(t),e)},Lr.xor=ao,Lr.xorBy=oo,Lr.xorWith=so,Lr.zip=lo,Lr.zipObject=function(e,t){return fi(e||[],t||[],Zr)},Lr.zipObjectDeep=function(e,t){return fi(e||[],t||[],Kn)},Lr.zipWith=uo,Lr.entries=Ls,Lr.entriesIn=ks,Lr.extend=vs,Lr.extendWith=_s,ol(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),an(ms(e),t,r)},Lr.clone=function(e){return on(e,4)},Lr.cloneDeep=function(e){return on(e,5)},Lr.cloneDeepWith=function(e,t){return on(e,5,t="function"==typeof t?t:i)},Lr.cloneWith=function(e,t){return on(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=oi(t);var n=e.length,a=r=r===i?n:an(fs(r),0,n);return(r-=t.length)>=0&&e.slice(r,a)==t},Lr.eq=qo,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=Go(e)?xt:pn;return r&&ga(e,t,r)&&(t=i),n(e,aa(t,3))},Lr.find=mo,Lr.findIndex=za,Lr.findKey=function(e,t){return Lt(e,aa(t,3),bn)},Lr.findLast=go,Lr.findLastIndex=Ba,Lr.findLastKey=function(e,t){return Lt(e,aa(t,3),vn)},Lr.floor=_l,Lr.forEach=yo,Lr.forEachRight=bo,Lr.forIn=function(e,t){return null==e?e:gn(e,aa(t,3),Rs)},Lr.forInRight=function(e,t){return null==e?e:yn(e,aa(t,3),Rs)},Lr.forOwn=function(e,t){return e&&bn(e,aa(t,3))},Lr.forOwnRight=function(e,t){return e&&vn(e,aa(t,3))},Lr.get=Es,Lr.gt=$o,Lr.gte=zo,Lr.has=function(e,t){return null!=e&&pa(e,t,En)},Lr.hasIn=Os,Lr.head=Ua,Lr.identity=rl,Lr.includes=function(e,t,r,n){e=Vo(e)?e:qs(e),r=r&&!n?fs(r):0;var i=e.length;return r<0&&(r=mr(i+r,0)),os(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=Bo,Lr.isArray=Go,Lr.isArrayBuffer=Uo,Lr.isArrayLike=Vo,Lr.isArrayLikeObject=Ho,Lr.isBoolean=function(e){return!0===e||!1===e||es(e)&&Sn(e)==y},Lr.isBuffer=Yo,Lr.isDate=Xo,Lr.isElement=function(e){return es(e)&&1===e.nodeType&&!ns(e)},Lr.isEmpty=function(e){if(null==e)return!0;if(Vo(e)&&(Go(e)||"string"==typeof e||"function"==typeof e.splice||Yo(e)||ls(e)||Bo(e)))return!e.length;var t=da(e);if(t==w||t==x)return!e.size;if(_a(e))return!Pn(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=Wo,Lr.isFinite=function(e){return"number"==typeof e&&Nt(e)},Lr.isFunction=Ko,Lr.isInteger=Qo,Lr.isLength=Zo,Lr.isMap=ts,Lr.isMatch=function(e,t){return e===t||Rn(e,t,sa(t))},Lr.isMatchWith=function(e,t,r){return r="function"==typeof r?r:i,Rn(e,t,sa(t),r)},Lr.isNaN=function(e){return rs(e)&&e!=+e},Lr.isNative=function(e){if(va(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=Jo,Lr.isObjectLike=es,Lr.isPlainObject=ns,Lr.isRegExp=is,Lr.isSafeInteger=function(e){return Qo(e)&&e>=-9007199254740991&&e<=d},Lr.isSet=as,Lr.isString=os,Lr.isSymbol=ss,Lr.isTypedArray=ls,Lr.isUndefined=function(e){return e===i},Lr.isWeakMap=function(e){return es(e)&&da(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=Xa,Lr.lastIndexOf=function(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var a=n;return r!==i&&(a=(a=fs(r))<0?mr(n+a,0):gr(a,n-1)),t==t?function(e,t,r){for(var n=r+1;n--;)if(e[n]===t)return n;return n}(e,t,a):kt(e,zt,a,!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,aa(t,2),Tn):i},Lr.mean=function(e){return Bt(e,rl)},Lr.meanBy=function(e,t){return Bt(e,aa(t,2))},Lr.min=function(e){return e&&e.length?fn(e,rl,Mn):i},Lr.minBy=function(e,t){return e&&e.length?fn(e,aa(t,2),Mn):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=Eo,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&&ga(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 a=vr();return gr(e+a*(t-e+st("1e-"+((a+"").length-1))),t)}return Vn(e,t)},Lr.reduce=function(e,t,r){var n=Go(e)?Ft:Vt,i=arguments.length<3;return n(e,aa(t,4),r,i,cn)},Lr.reduceRight=function(e,t,r){var n=Go(e)?Pt:Vt,i=arguments.length<3;return n(e,aa(t,4),r,i,dn)},Lr.repeat=function(e,t,r){return t=(r?ga(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,a=(t=gi(t,e)).length;for(a||(a=1,e=i);++n<a;){var o=null==e?i:e[Ma(t[n])];o===i&&(n=a,o=r),e=Ko(o)?o.call(e):o}return e},Lr.round=wl,Lr.runInContext=e,Lr.sample=function(e){return(Go(e)?Xr:Xn)(e)},Lr.size=function(e){if(null==e)return 0;if(Vo(e))return os(e)?ur(e):e.length;var t=da(e);return t==w||t==x?e.size:Pn(e).length},Lr.snakeCase=Hs,Lr.some=function(e,t,r){var n=Go(e)?Mt:ti;return r&&ga(e,t,r)&&(t=i),n(e,aa(t,3))},Lr.sortedIndex=function(e,t){return ri(e,t)},Lr.sortedIndexBy=function(e,t,r){return ni(e,t,aa(r,2))},Lr.sortedIndexOf=function(e,t){var r=null==e?0:e.length;if(r){var n=ri(e,t);if(n<r&&qo(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,aa(r,2),!0)},Lr.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var r=ri(e,t,!0)-1;if(qo(e[r],t))return r}return-1},Lr.startCase=Ys,Lr.startsWith=function(e,t,r){return e=ys(e),r=null==r?0:an(fs(r),0,e.length),t=oi(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,aa(t,2)):0},Lr.template=function(e,t,r){var n=Lr.templateSettings;r&&ga(e,t,r)&&(t=i),e=ys(e),t=_s({},t,n,Wi);var a,o,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&&(a=!0,p+="' +\n__e("+r+") +\n'"),s&&(o=!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=(o?p.replace(B,""):p).replace(G,"$1").replace(U,"$1;"),p="function("+(m||"obj")+") {\n"+(m?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(a?", __e = _.escape":"")+(o?", __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,Wo(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=aa(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?an(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=oi(t)))return e;var n=cr(e),a=cr(t);return bi(n,Zt(n,a),Jt(n,a)+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=oi(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=oi(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(Jo(t)){var a="separator"in t?t.separator:a;r="length"in t?fs(t.length):r,n="omission"in t?oi(t.omission):n}var o=(e=ys(e)).length;if(nr(e)){var s=cr(e);o=s.length}if(r>=o)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(a===i)return u+n;if(s&&(l+=u.length-l),is(a)){if(e.slice(l).search(a)){var c,d=u;for(a.global||(a=Ee(a.source,ys(pe.exec(a))+"g")),a.lastIndex=0;c=a.exec(d);)var p=c.index;u=u.slice(0,p===i?l:p)}}else if(e.indexOf(oi(a),l)!=l){var f=u.lastIndexOf(a);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=++Pe;return ys(e)+t},Lr.upperCase=Xs,Lr.upperFirst=Ws,Lr.each=yo,Lr.eachRight=bo,Lr.first=Ua,ol(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:aa(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(Po(aa(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),a=Lr[n?"take"+("last"==t?"Right":""):t],o=n||/^find/.test(t);a&&(Lr.prototype[t]=function(){var t=this.__wrapped__,s=n?[1]:arguments,l=t instanceof zr,u=s[0],c=l||Go(t),d=function(e){var t=a.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=o&&!p,m=l&&!f;if(!o&&c){t=m?t:new zr(this);var g=e.apply(t,s);return g.__actions__.push({func:po,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(Go(i)?i:[],e)}return this[r]((function(r){return t.apply(Go(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=Go(e),n=t<0,i=r?e.length:0,a=function(e,t,r){for(var n=-1,i=r.length;++n<i;){var a=r[n],o=a.size;switch(a.type){case"drop":e+=o;break;case"dropRight":t-=o;break;case"take":t=gr(t,e+o);break;case"takeRight":e=mr(e,t-o)}}return{start:e,end:t}}(0,i,this.__views__),o=a.start,s=a.end,l=s-o,u=n?s:o-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=fo,Lr.prototype.chain=function(){return co(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=La(r);n.__index__=0,n.__values__=i,t?a.__wrapped__=n:t=n;var a=n;r=r.__wrapped__}return a.__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:po,args:[Za],thisArg:i}),new $r(t,this.__chain__)}return this.thru(Za)},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 a=!0,o=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return i(r)&&(a="leading"in r?!!r.leading:a,o="trailing"in r?!!r.trailing:o),n(e,t,{leading:a,maxWait:t,trailing:o})}},6131:(e,t,r)=>{var n=r(6403),i=r(1580),a=r(1187),o=/^[-+]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(a(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):o.test(e)?NaN:+e}},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}),a=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)},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.Errors=void 0,a(r(2890),t),a(r(5512),t),a(r(7855),t),a(r(4640),t),a(r(9800),t),a(r(1171),t),a(r(7783),t),a(r(7807),t),a(r(2474),t),t.Errors=o(r(9979))},3806:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(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(o,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 a=i(r(288)),o=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=o.Monitor.timeRequest(e.method,c,a.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&&s.VizzlyApiClientLogger.debug(`[TRACING] QE; ${h} - API; ${m}`),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,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(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(o,s)}l((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.DashboardManager=void 0;const i=r(5250),a=r(4968),o=r(7783);class s{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,s;const l=this.vizzly.getDashboardRepository(),u=this.vizzly.getGlobalLibraryRepository(),[{global_libraries:c,permissions:d},{dashboards:p,permissions:f}]=yield Promise.all([u.fetchGlobalLibraries(e),l.fetchDashboards(e)]),h=p.find((t=>t.id===e.dashboardId));if(!h)throw new Error("Cannot find dashboard to update.");const{parentGlobalLibraries:m,childGlobalLibraries:g}=a.GlobalLibraryRepository.splitParentAndChildGlobalLibraries(c),y=f.find((t=>"read_write"===t.scope&&t.dashboardId===e.dashboardId));if(!y)throw new Error("Failed to find update token for dashboard.");const b=yield l.updateDashboard(Object.assign(Object.assign({},e),{dashboardPermission:y}));let v=[];(null===(t=e.definition)||void 0===t?void 0:t.componentLibrary)&&(v=(0,i.cloneDeep)(e.definition.componentLibrary||[]).filter((e=>!(null!==h.parent_dashboard_id&&e.attributes.protectedByOrganisation))));const _=null===h.parent_dashboard_id?m:g,A=null===h.parent_dashboard_id,w=v.length>0||!!(null===(r=e.definition)||void 0===r?void 0:r.customFields),S=c.find((e=>null===e.parent_global_library_id));!A&&S&&w&&0===_.length&&(yield u.createGlobalLibrary({library:{views:v,customFields:(null===(s=e.definition)||void 0===s?void 0:s.customFields)||{}},parentGlobalLibraryId:S.id,permissions:[{scope:"read_write"}]}));const T=_.map((t=>n(this,void 0,void 0,(function*(){var r;const n=d.find((e=>e.globalLibraryId===t.id&&"read_write"===e.scope));n||o.VizzlyApiClientLogger.error("No write permission found."),n&&(yield u.updateGlobalLibrary({globalLibrarySessionToken:n.token,library:{views:v,customFields:(null===(r=e.definition)||void 0===r?void 0:r.customFields)||{}}}))}))));return yield Promise.all(T),b}))}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 s.mergeDashboardsAndGlobalLibraries(n,i)}))}static mergeDashboardsAndGlobalLibraries(e,t){return(0,i.cloneDeep)(e).map((r=>{let n=(0,i.cloneDeep)(r.definition.componentLibrary),o=null===r.parent_dashboard_id?[]:e.find((e=>e.id===r.parent_dashboard_id)).definition.componentLibrary,{parentGlobalLibraries:l,childGlobalLibraries:u}=a.GlobalLibraryRepository.splitParentAndChildGlobalLibraries(t);u=null===r.parent_dashboard_id?[]:u;let c=(0,i.uniqBy)([...s.markViewsAsProtected(l.flatMap((e=>e.library.views||[]))),...u.flatMap((e=>e.library.views||[])),...s.markViewsAsProtected(o),...null===r.parent_dashboard_id?s.markViewsAsProtected(n):n||[]],(e=>e.attributes.viewId));return r.definition.componentLibrary=c,r.definition.customFields=s.mergeCustomFields(r,e,l,u),r}))}static mergeCustomFields(e,t,r,n){var a;const o=null===e.parent_dashboard_id?{}:(null===(a=t.find((t=>t.id===e.parent_dashboard_id)))||void 0===a?void 0:a.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)(o)||{},...(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=s},178:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(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(o,s)}l((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.DashboardRepository=void 0;const i=r(6537),a=r(2315),o=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 new a.FailedToCreateDashboard(`Failed to create the dashboard from POST /api/v2/dashboard. Got ${t.status}`);throw new a.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 o.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,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(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(o,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,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(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(o,s)}l((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.GlobalLibraryRepository=void 0;const i=r(5250),a=r(2975),o=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 o.FailedToFetchGlobalLibraryAccessTokens("Failed to load access tokens for the global library.");{const e=r.body.permissions.map(a.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,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(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(o,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(...a){return n(this,void 0,void 0,(function*(){const n=performance.now(),o=yield r(...a),s=performance.now()-n;return i.VizzlyApiClientLogger.debug(`[@vizzly/api-client timing] ${e.toUpperCase()} ${t} - ${s.toFixed(2)}ms`),o}))}}}},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),a=r.baseIsValid(e)?"":"/";return""==n&&""==i?"/":""==i?`${a}${n}`:""!=n&&""!=i?`${a}${n}/${i}`:`${a}${i}`}static addQueryParam(e,t,r){const[n,i]=e.split("#"),[a,o]=n.split("?");var s=new URLSearchParams(o);return s.set(t,r),a+"?"+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("."),a=Buffer.from(n,"base64").toString("utf-8"),o=JSON.parse(a).exp;return!(o<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),a=r(4968),o=r(8607),s=r(5465);t.Vizzly=class{constructor(e,t){this.APIs=e,this.implementationStrategy=t,this.dashboardManager=new o.DashboardManager(this),this.dashboardRepository=new i.DashboardRepository(this),this.globalLibraryRepository=new a.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,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(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(o,s)}l((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.VizzlyApi=void 0;const i=r(3806),a=r(9979),o=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 a.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 a.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 a.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","appSessionToken"]}}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 a.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 a.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 o.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,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(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(o,s)}l((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.VizzlyAppApi=void 0;const i=r(3806);class a 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=a},4640:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(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(o,s)}l((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.VizzlyQueryEngineApi=void 0;const i=r(3806),a=r(6081),o=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 a.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 o.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","array_does_not_contain"]),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[]"]},array_does_not_contain:{publicName:"Does not contain",validDataTypes:["string[]"]},array_contains_any_of:{publicName:"Contains any of",validDataTypes:["string[]"]},array_contains_all_of:{publicName:"Contains all of",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"},hourOfDayOnly:{publicName:"Hour of day",dateFormat:"hour_of_day"},weekOfYearOnly:{publicName:"Week of year",dateFormat:"week_of_year"},dayOfWeekOnly:{publicName:"Day of week",dateFormat:"day_of_week_iso"},dayOfMonthOnly:{publicName:"Day of month",dateFormat:"day_of_month"},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}),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.getQueryEngineConfig=void 0;const o=a(r(3543)),s=a(r(5133)),l=a(r(9450)),u=a(r(1047)),c=a(r(8590)),d=a(r(5226)),p=a(r(9488)),f=r(1594);t.getQueryEngineConfig=e=>{switch(e){case"js":return f.localQueryEngineConfig;case"postgres":return o.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}),a=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)},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.Support=t.Constants=void 0,a(r(6676),t),a(r(4002),t),t.Constants=o(r(9667)),t.Support=o(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","array_does_not_contain"]),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],a=t[r];if("object"==typeof i&&"object"==typeof a){const e=(0,n.intersection)(Object.keys(i),Object.keys(a));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=()=>{return{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",..."undefined"!=typeof process&&"KUSTO"===(null===(e=process.env.VIZZLY_MICROSOFT_FLAVOR)||void 0===e?void 0:e.toUpperCase())?[]:["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","array_does_not_contain"]),supportedTransformationFunctions:(0,n.supportedTransformationFunctions)(["round_to_0_dp","round_to_2_dp"])};var e}},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","dayOfMonthOnly","dayOfWeekOnly","weekOfYearOnly"]),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","array_does_not_contain"]),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","array_does_not_contain"]),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","dayOfMonthOnly","dayOfWeekOnly","weekOfYearOnly","hourOfDayOnly"]),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","array_does_not_contain","array_contains_any_of","array_contains_all_of"]),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),a={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)(a);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 a=r&&r.length>0?r.filter((e=>i.includes(e))):i;return r&&r.length>0&&0===a.length&&(a=i),a},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 a=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:a("mysql"),snowflake:a("snowflake"),postgres:a("postgres"),redshift:a("redshift"),mariadb:a("mariadb"),bigquery:a("bigquery"),microsoftSQLServer:a("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.__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}),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.Schemas=t.ID_REGEX_ERROR_MESSAGE=t.ALLOWED_ID_REGEX=t.validate=void 0;const o=a(r(746));t.validate=o.default,Object.defineProperty(t,"ALLOWED_ID_REGEX",{enumerable:!0,get:function(){return o.ALLOWED_ID_REGEX}}),Object.defineProperty(t,"ID_REGEX_ERROR_MESSAGE",{enumerable:!0,get:function(){return o.ID_REGEX_ERROR_MESSAGE}});const s={bigQuery:o.bigQuerySchema,postgres:o.postgresSchema,mariadb:o.mariadbSchema,mySQL:o.mySQLSchema,snowflake:o.snowflakeSchema,microsoftSQLServer:o.microsoftSQLServerSchema,redshift:o.redshiftSchema};t.Schemas=s},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.redshiftSchema=t.microsoftSQLServerSchema=t.snowflakeSchema=t.mySQLSchema=t.mariadbSchema=t.postgresSchema=t.bigQuerySchema=t._sqlDataSetSchema=t._fieldSchema=t.ID_REGEX_ERROR_MESSAGE=t.ALLOWED_ID_REGEX=void 0;const i=n(r(4579)),a=r(6676),o=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","dayOfMonthOnly","dayOfWeekOnly","weekOfYearOnly","hourOfDayOnly"];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};t._fieldSchema=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(o.NATIVE_DATA_TYPES[e])).required(),canBeDimension:i.default.boolean().optional().description("Can this field be used in groupings?"),canBeMeasure:i.default.boolean().optional().description("Can this field be used in aggregations?"),canBeUsedInSort:i.default.boolean().optional().description("__vizzly_hide_from_docs"),allowedGranularities:i.default.array().items(i.default.string().valid(...p)).optional(),allowedOperators:i.default.alternatives().conditional("..dataType",{is:i.default.string().valid(...(0,o.vizzlyToPossibleNativeDataTypes)(e,"string")),then:i.default.array().items(i.default.string().valid(...(0,s.validOperatorsForField)({dataType:"string"},(0,a.getQueryEngineConfig)(e)))).description("For fields that have a string data type.")}).conditional("..dataType",{is:i.default.string().valid(...(0,o.vizzlyToPossibleNativeDataTypes)(e,"number")),then:i.default.array().items(i.default.string().valid(...(0,s.validOperatorsForField)({dataType:"number"},(0,a.getQueryEngineConfig)(e)))).description("For fields that have a number data type.")}).conditional("..dataType",{is:i.default.string().valid(...(0,o.vizzlyToPossibleNativeDataTypes)(e,"date_time")),then:i.default.array().items(i.default.valid(...(0,s.validOperatorsForField)({dataType:"date_time"},(0,a.getQueryEngineConfig)(e)))).description("For fields that have a date time data type.")}).conditional("..dataType",{is:i.default.string().valid(...(0,o.vizzlyToPossibleNativeDataTypes)(e,"boolean")),then:i.default.array().items(i.default.string().valid(...(0,s.validOperatorsForField)({dataType:"boolean"},(0,a.getQueryEngineConfig)(e)))).description("For fields that have a boolean data type.")}).conditional("..dataType",{is:i.default.string().valid(...(0,o.vizzlyToPossibleNativeDataTypes)(e,"string[]")),then:i.default.array().items(i.default.string().valid(...(0,s.validOperatorsForField)({dataType:"string[]"},(0,a.getQueryEngineConfig)(e)))).description("For fields that have a string array data type.")}).optional()});const m=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(),as:i.default.string().optional()}),g=i.default.object({fieldId:i.default.string().required(),op:i.default.string().valid(...d).required()});t._sqlDataSetSchema=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().description("Reference the connection to use for this data set."),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(g).optional()}))(e)),{joins:i.default.array().items(m).unique(((e,t)=>{const r=JSON.stringify(e.right)===JSON.stringify(t.right);return!e.as&&!t.as&&r})).message("A table cannot be referenced in a right join multiple times.").optional()}));const y=e=>{var r;if(1===(null===(r=e.onlyClients)||void 0===r?void 0:r.length))return(0,t._sqlDataSetSchema)((0,t._fieldSchema)(e.onlyClients[0]));const n=i.default.alternatives(...(e.onlyClients||o.SUPPORTED_CLIENTS).map((e=>(0,t._sqlDataSetSchema)((0,t._fieldSchema)(e)))));if(e.dataSetIdToClientMapping){const r=Object.entries(e.dataSetIdToClientMapping).map((([e,r])=>({is:e,then:(0,t._sqlDataSetSchema)((0,t._fieldSchema)(r))})));return i.default.alternatives().conditional(".id",[...r,{is:!0,then:n}])}return n},b=(e,r)=>i.default.object({version:i.default.number(),connections:i.default.object().pattern(i.default.string(),i.default.object({client:i.default.string().allow(...o.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(r.checkConnectionSpecificDataSets?i.default.object().custom((r=>{var n,i;const a=r.connectionId||"___vizzly_default_conn",o=null===(i=null===(n=null==e?void 0:e.connections)||void 0===n?void 0:n[a])||void 0===i?void 0:i.client;if(!o)throw new u.DataSetNotLinkedToConnection(r.id);const s=(0,t._sqlDataSetSchema)((0,t._fieldSchema)(o)).validate(r,h);if(s.error)throw s.error;return r}),"Data sets linked to connections"):y(r)).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()});t.bigQuerySchema=b({},{onlyClients:["bigquery"]}),t.postgresSchema=b({},{onlyClients:["postgres"]}),t.mariadbSchema=b({},{onlyClients:["mariadb"]}),t.mySQLSchema=b({},{onlyClients:["mysql"]}),t.snowflakeSchema=b({},{onlyClients:["snowflake"]}),t.microsoftSQLServerSchema=b({},{onlyClients:["microsoftSQLServer"]}),t.redshiftSchema=b({},{onlyClients:["redshift"]}),t.default=(e,t={})=>{const r=b(e,Object.assign(Object.assign(Object.assign({},f),t),{dataSetIdToClientMapping:v(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 v=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 a=r.connectionId||"___vizzly_default_conn",o=null===(i=null===(n=null==e?void 0:e.connections)||void 0===n?void 0:n[a])||void 0===i?void 0:i.client;o&&(t[r.id]=o)}})),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},630:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ianaTimeZonesDb=void 0,t.ianaTimeZonesDb=["Africa/Abidjan","Africa/Accra","Africa/Addis_Ababa","Africa/Algiers","Africa/Asmera","Africa/Bamako","Africa/Bangui","Africa/Banjul","Africa/Bissau","Africa/Blantyre","Africa/Brazzaville","Africa/Bujumbura","Africa/Cairo","Africa/Casablanca","Africa/Ceuta","Africa/Conakry","Africa/Dakar","Africa/Dar_es_Salaam","Africa/Djibouti","Africa/Douala","Africa/El_Aaiun","Africa/Freetown","Africa/Gaborone","Africa/Harare","Africa/Johannesburg","Africa/Juba","Africa/Kampala","Africa/Khartoum","Africa/Kigali","Africa/Kinshasa","Africa/Lagos","Africa/Libreville","Africa/Lome","Africa/Luanda","Africa/Lubumbashi","Africa/Lusaka","Africa/Malabo","Africa/Maputo","Africa/Maseru","Africa/Mbabane","Africa/Mogadishu","Africa/Monrovia","Africa/Nairobi","Africa/Ndjamena","Africa/Niamey","Africa/Nouakchott","Africa/Ouagadougou","Africa/Porto-Novo","Africa/Sao_Tome","Africa/Tripoli","Africa/Tunis","Africa/Windhoek","America/Adak","America/Anchorage","America/Anguilla","America/Antigua","America/Araguaina","America/Argentina/La_Rioja","America/Argentina/Rio_Gallegos","America/Argentina/Salta","America/Argentina/San_Juan","America/Argentina/San_Luis","America/Argentina/Tucuman","America/Argentina/Ushuaia","America/Aruba","America/Asuncion","America/Bahia","America/Bahia_Banderas","America/Barbados","America/Belem","America/Belize","America/Blanc-Sablon","America/Boa_Vista","America/Bogota","America/Boise","America/Buenos_Aires","America/Cambridge_Bay","America/Campo_Grande","America/Cancun","America/Caracas","America/Catamarca","America/Cayenne","America/Cayman","America/Chicago","America/Chihuahua","America/Ciudad_Juarez","America/Coral_Harbour","America/Cordoba","America/Costa_Rica","America/Creston","America/Cuiaba","America/Curacao","America/Danmarkshavn","America/Dawson","America/Dawson_Creek","America/Denver","America/Detroit","America/Dominica","America/Edmonton","America/Eirunepe","America/El_Salvador","America/Fort_Nelson","America/Fortaleza","America/Glace_Bay","America/Godthab","America/Goose_Bay","America/Grand_Turk","America/Grenada","America/Guadeloupe","America/Guatemala","America/Guayaquil","America/Guyana","America/Halifax","America/Havana","America/Hermosillo","America/Indiana/Knox","America/Indiana/Marengo","America/Indiana/Petersburg","America/Indiana/Tell_City","America/Indiana/Vevay","America/Indiana/Vincennes","America/Indiana/Winamac","America/Indianapolis","America/Inuvik","America/Iqaluit","America/Jamaica","America/Jujuy","America/Juneau","America/Kentucky/Monticello","America/Kralendijk","America/La_Paz","America/Lima","America/Los_Angeles","America/Louisville","America/Lower_Princes","America/Maceio","America/Managua","America/Manaus","America/Marigot","America/Martinique","America/Matamoros","America/Mazatlan","America/Mendoza","America/Menominee","America/Merida","America/Metlakatla","America/Mexico_City","America/Miquelon","America/Moncton","America/Monterrey","America/Montevideo","America/Montserrat","America/Nassau","America/New_York","America/Nome","America/Noronha","America/North_Dakota/Beulah","America/North_Dakota/Center","America/North_Dakota/New_Salem","America/Ojinaga","America/Panama","America/Paramaribo","America/Phoenix","America/Port-au-Prince","America/Port_of_Spain","America/Porto_Velho","America/Puerto_Rico","America/Punta_Arenas","America/Rankin_Inlet","America/Recife","America/Regina","America/Resolute","America/Rio_Branco","America/Santarem","America/Santiago","America/Santo_Domingo","America/Sao_Paulo","America/Scoresbysund","America/Sitka","America/St_Barthelemy","America/St_Johns","America/St_Kitts","America/St_Lucia","America/St_Thomas","America/St_Vincent","America/Swift_Current","America/Tegucigalpa","America/Thule","America/Tijuana","America/Toronto","America/Tortola","America/Vancouver","America/Whitehorse","America/Winnipeg","America/Yakutat","Antarctica/Casey","Antarctica/Davis","Antarctica/DumontDUrville","Antarctica/Macquarie","Antarctica/Mawson","Antarctica/McMurdo","Antarctica/Palmer","Antarctica/Rothera","Antarctica/Syowa","Antarctica/Troll","Antarctica/Vostok","Arctic/Longyearbyen","Asia/Aden","Asia/Almaty","Asia/Amman","Asia/Anadyr","Asia/Aqtau","Asia/Aqtobe","Asia/Ashgabat","Asia/Atyrau","Asia/Baghdad","Asia/Bahrain","Asia/Baku","Asia/Bangkok","Asia/Barnaul","Asia/Beirut","Asia/Bishkek","Asia/Brunei","Asia/Calcutta","Asia/Chita","Asia/Choibalsan","Asia/Colombo","Asia/Damascus","Asia/Dhaka","Asia/Dili","Asia/Dubai","Asia/Dushanbe","Asia/Famagusta","Asia/Gaza","Asia/Hebron","Asia/Hong_Kong","Asia/Hovd","Asia/Irkutsk","Asia/Jakarta","Asia/Jayapura","Asia/Jerusalem","Asia/Kabul","Asia/Kamchatka","Asia/Karachi","Asia/Katmandu","Asia/Khandyga","Asia/Krasnoyarsk","Asia/Kuala_Lumpur","Asia/Kuching","Asia/Kuwait","Asia/Macau","Asia/Magadan","Asia/Makassar","Asia/Manila","Asia/Muscat","Asia/Nicosia","Asia/Novokuznetsk","Asia/Novosibirsk","Asia/Omsk","Asia/Oral","Asia/Phnom_Penh","Asia/Pontianak","Asia/Pyongyang","Asia/Qatar","Asia/Qostanay","Asia/Qyzylorda","Asia/Rangoon","Asia/Riyadh","Asia/Saigon","Asia/Sakhalin","Asia/Samarkand","Asia/Seoul","Asia/Shanghai","Asia/Singapore","Asia/Srednekolymsk","Asia/Taipei","Asia/Tashkent","Asia/Tbilisi","Asia/Tehran","Asia/Thimphu","Asia/Tokyo","Asia/Tomsk","Asia/Ulaanbaatar","Asia/Urumqi","Asia/Ust-Nera","Asia/Vientiane","Asia/Vladivostok","Asia/Yakutsk","Asia/Yekaterinburg","Asia/Yerevan","Atlantic/Azores","Atlantic/Bermuda","Atlantic/Canary","Atlantic/Cape_Verde","Atlantic/Faeroe","Atlantic/Madeira","Atlantic/Reykjavik","Atlantic/South_Georgia","Atlantic/St_Helena","Atlantic/Stanley","Australia/Adelaide","Australia/Brisbane","Australia/Broken_Hill","Australia/Darwin","Australia/Eucla","Australia/Hobart","Australia/Lindeman","Australia/Lord_Howe","Australia/Melbourne","Australia/Perth","Australia/Sydney","Europe/Amsterdam","Europe/Andorra","Europe/Astrakhan","Europe/Athens","Europe/Belgrade","Europe/Berlin","Europe/Bratislava","Europe/Brussels","Europe/Bucharest","Europe/Budapest","Europe/Busingen","Europe/Chisinau","Europe/Copenhagen","Europe/Dublin","Europe/Gibraltar","Europe/Guernsey","Europe/Helsinki","Europe/Isle_of_Man","Europe/Istanbul","Europe/Jersey","Europe/Kaliningrad","Europe/Kiev","Europe/Kirov","Europe/Lisbon","Europe/Ljubljana","Europe/London","Europe/Luxembourg","Europe/Madrid","Europe/Malta","Europe/Mariehamn","Europe/Minsk","Europe/Monaco","Europe/Moscow","Europe/Oslo","Europe/Paris","Europe/Podgorica","Europe/Prague","Europe/Riga","Europe/Rome","Europe/Samara","Europe/San_Marino","Europe/Sarajevo","Europe/Saratov","Europe/Simferopol","Europe/Skopje","Europe/Sofia","Europe/Stockholm","Europe/Tallinn","Europe/Tirane","Europe/Ulyanovsk","Europe/Vaduz","Europe/Vatican","Europe/Vienna","Europe/Vilnius","Europe/Volgograd","Europe/Warsaw","Europe/Zagreb","Europe/Zurich","Indian/Antananarivo","Indian/Chagos","Indian/Christmas","Indian/Cocos","Indian/Comoro","Indian/Kerguelen","Indian/Mahe","Indian/Maldives","Indian/Mauritius","Indian/Mayotte","Indian/Reunion","Pacific/Apia","Pacific/Auckland","Pacific/Bougainville","Pacific/Chatham","Pacific/Easter","Pacific/Efate","Pacific/Enderbury","Pacific/Fakaofo","Pacific/Fiji","Pacific/Funafuti","Pacific/Galapagos","Pacific/Gambier","Pacific/Guadalcanal","Pacific/Guam","Pacific/Honolulu","Pacific/Kiritimati","Pacific/Kosrae","Pacific/Kwajalein","Pacific/Majuro","Pacific/Marquesas","Pacific/Midway","Pacific/Nauru","Pacific/Niue","Pacific/Norfolk","Pacific/Noumea","Pacific/Pago_Pago","Pacific/Palau","Pacific/Pitcairn","Pacific/Ponape","Pacific/Port_Moresby","Pacific/Rarotonga","Pacific/Saipan","Pacific/Tahiti","Pacific/Tarawa","Pacific/Tongatapu","Pacific/Truk","Pacific/Wake","Pacific/Wallis"]},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}),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},o=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=a(r(8162)),t.VizzlyConfig=a(r(3342)),o(r(7076),t),o(r(2069),t)},2069:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ianaTimeZones=t.ETC_UTC_TIME_ZONE=void 0,t.ETC_UTC_TIME_ZONE="Etc/UTC";const n=r(630);t.ianaTimeZones=()=>[t.ETC_UTC_TIME_ZONE,...n.ianaTimeZonesDb]},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.getNativeDataTypesOfNormalizedType=t.DATE_MATHS_OPERATORS=t.NORMALIZED_DATA_TYPES=void 0;const a=r(3154);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"],t.getNativeDataTypesOfNormalizedType=(e,t)=>Object.keys(a.NATIVE_DATA_TYPES_DATABASE[e]).filter((r=>a.NATIVE_DATA_TYPES_DATABASE[e][r].normalizedType===t))},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 a=i[n];r["[object "+a+"]"]=a.toLowerCase()}var o=function(e){return r[Object.prototype.toString.call(e)]||"object"},s=o,l=o,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:o,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 a=0,o=m.autodetect;a<o.length;a+=1){var s=o[a];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],a=r[2],o=1-A(n/=255,A(i/=255,a/=255)),s=o<1?1/(1-o):0;return[(1-n-o)*s,(1-i-o)*s,(1-a-o)*s,o]},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],a=e[3],o=e.length>4?e[4]:1;return 1===a?[0,0,0,o]:[r>=1?0:255*(1-r)*(1-a),n>=1?0:255*(1-n)*(1-a),i>=1?0:255*(1-i)*(1-a),o]},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},P=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(",")+")"},M=c.unpack,N=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var r=(e=M(e,"rgba"))[0],n=e[1],i=e[2];r/=255,n/=255,i/=255;var a,o,s=Math.min(r,n,i),l=Math.max(r,n,i),u=(l+s)/2;return l===s?(a=0,o=Number.NaN):a=u<.5?(l-s)/(l+s):(l-s)/(2-l-s),r==l?o=(n-i)/(l-s):n==l?o=2+(i-r)/(l-s):i==l&&(o=4+(r-n)/(l-s)),(o*=60)<0&&(o+=360),e.length>3&&void 0!==e[3]?[o,a,u,e[3]]:[o,a,u]},L=c.unpack,k=c.last,q=P,$=N,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,a,o=(t=G(t,"hsl"))[0],s=t[1],l=t[2];if(0===s)n=i=a=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=o/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],a=e[2]}return t.length>3?[n,i,a,t[3]]:[n,i,a,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),a=0;a<4;a++)i[a]=+i[a];return i}if(t=e.match(K)){for(var o=t.slice(1,4),s=0;s<3;s++)o[s]=ee(2.55*o[s]);return o[3]=1,o}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,ae=c.type,oe=B,se=te;ne.prototype.css=function(e){return oe(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"===ae(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],a=n[1],o=n[2],s=Math.min(i,a,o),l=Math.max(i,a,o),u=l-s,c=100*u/255,d=s/(255-u)*100;return 0===u?r=Number.NaN:(i===l&&(r=(a-o)/u),a===l&&(r=2+(o-i)/u),o===l&&(r=4+(i-a)/u),(r*=60)<0&&(r+=360)),[r,c,d]},fe=c.unpack,he=Math.floor,me=function(){for(var e,t,r,n,i,a,o=[],s=arguments.length;s--;)o[s]=arguments[s];var l,u,c,d=(o=fe(o,"hcg"))[0],p=o[1],f=o[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=(a=[_,y,b])[0],u=a[1],c=a[2]}}return[l,u,c,o.length>3?o[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],a=r[2],o=r[3],s=Se(e)||"auto";void 0===o&&(o=1),"auto"===s&&(s=o<1?"rgba":"rgb");var l="000000"+((n=Te(n))<<16|(i=Te(i))<<8|(a=Te(a))).toString(16);l=l.substr(l.length-6);var u="0"+Te(255*o).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 Pe=c.unpack,Me=c.TWOPI,Ne=Math.min,Le=Math.sqrt,ke=Math.acos,qe=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var r,n=Pe(e,"rgb"),i=n[0],a=n[1],o=n[2],s=Ne(i/=255,a/=255,o/=255),l=(i+a+o)/3,u=l>0?1-s/l:0;return 0===u?r=NaN:(r=(i-a+(i-o))/2,r/=Le((i-a)*(i-a)+(i-o)*(a-o)),r=ke(r),o>a&&(r=Me-r),r/=Me),[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,a=(e=$e(e,"hsi"))[0],o=e[1],s=e[2];return isNaN(a)&&(a=0),isNaN(o)&&(o=0),a>360&&(a-=360),a<0&&(a+=360),(a/=360)<1/3?n=1-((i=(1-o)/3)+(r=(1+o*Ue(Be*a)/Ue(Ge-Be*a))/3)):a<2/3?i=1-((r=(1-o)/3)+(n=(1+o*Ue(Be*(a-=1/3))/Ue(Ge-Be*a))/3)):r=1-((n=(1-o)/3)+(i=(1+o*Ue(Be*(a-=2/3))/Ue(Ge-Be*a))/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=N;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,at=Math.min,ot=Math.max,st=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var r,n,i,a=(e=it(e,"rgb"))[0],o=e[1],s=e[2],l=at(a,o,s),u=ot(a,o,s),c=u-l;return i=u/255,0===u?(r=Number.NaN,n=0):(n=c/u,a===u&&(r=(o-s)/c),o===u&&(r=2+(s-a)/c),s===u&&(r=4+(a-o)/c),(r*=60)<0&&(r+=360)),[r,n,i]},lt=c.unpack,ut=Math.floor,ct=function(){for(var e,t,r,n,i,a,o=[],s=arguments.length;s--;)o[s]=arguments[s];var l,u,c,d=(o=lt(o,"hsv"))[0],p=o[1],f=o[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=(a=[f,g,y])[0],u=a[1],c=a[2]}}return[l,u,c,o.length>3?o[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],a=r[2],o=St(n,i,a),s=o[0],l=o[1],u=116*l-16;return[u<0?0:u,500*(s-l),200*(l-o[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,a=(e=Ot(e,"lab"))[0],o=e[1],s=e[2];return n=(a+16)/116,r=isNaN(o)?n:n+o/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,Pt=y,Mt=d,Nt=Tt;Pt.prototype.lab=function(){return Nt(this._rgb)},Ft.lab=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(Pt,[null].concat(e,["lab"])))},Mt.format.lab=jt,Mt.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],a=r[2],o=qt(i*i+a*a),s=($t(a,i)*kt+360)%360;return 0===zt(1e4*o)&&(s=Number.NaN),[n,o,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],a=r[2],o=Ut(n,i,a),s=o[0],l=o[1],u=o[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],a=r[2];return isNaN(a)&&(a=0),[n,Kt(a*=Xt)*i,Wt(a)*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],a=Jt(r,n,i),o=a[0],s=a[1],l=a[2],u=er(o,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)},ar=c.unpack,or=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=ar(t,e),"array"===or(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,Pr=c.unpack,Mr=Math.round,Nr=v,Lr=y,kr=d,qr=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];for(var r,n=Pr(e,"rgb"),i=n[0],a=n[2],o=1e3,s=4e4;s-o>.4;){var l=Fr(r=.5*(s+o));l[2]/l[0]>=a/i?s=r:o=r}return Mr(r)};Lr.prototype.temp=Lr.prototype.kelvin=Lr.prototype.temperature=function(){return qr(this._rgb)},Nr.temp=Nr.kelvin=Nr.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],a=r[2],o=[Vr(n/255),Vr(i/255),Vr(a/255)],s=o[0],l=o[1],u=o[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],a=Yr(r+.3963377774*n+.2158037573*i,3),o=Yr(r-.1055613458*n-.0638541728*i,3),s=Yr(r-.0894841775*n-1.291485548*i,3);return[255*Kr(4.0767416621*a-3.3077115913*o+.2309699292*s),255*Kr(-1.2684380046*a+2.6097574011*o-.3413193965*s),255*Kr(-.0041960863*a-.7034186147*o+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,an=Ur,on=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],a=r[2],o=an(n,i,a),s=o[0],l=o[1],u=o[2];return on(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],a=un(r,n,i),o=a[0],s=a[1],l=a[2],u=cn(o,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 a=r.indexOf(n)-("ok"===r.substr(0,2)?2:0);if(a>-1)return i[a];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 a=t.interpolate(i,.5,"rgb"),o=a.luminance();return Math.abs(e-o)<1e-7||!r--?a:o>e?n(t,a):n(a,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 a=n[0]||"lrgb";if(jn[a]||n.length||(a=Object.keys(jn)[0]),!jn[a])throw new Error("interpolation mode "+a+" is not defined");return"object"!==In(e)&&(e=new Cn(e)),"object"!==In(t)&&(t=new Cn(t)),jn[a](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 Pn=y;Pn.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 Pn([t[0]*r,t[1]*r,t[2]*r,r],"rgb")};var Mn=y,Nn=yt;Mn.prototype.saturate=function(e){void 0===e&&(e=1);var t=this.lch();return t[1]+=Nn.Kn*e,t[1]<0&&(t[1]=0),new Mn(t,"lch").alpha(this.alpha(),!0)},Mn.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],a=n[1],o=this[i]();if(a){var s=i.indexOf(a)-("ok"===i.substr(0,2)?2:0);if(s>-1){if("string"==kn(t))switch(t.charAt(0)){case"+":case"-":o[s]+=+t;break;case"*":o[s]*=+t.substr(1);break;case"/":o[s]/=+t.substr(1);break;default:o[s]=+t}else{if("number"!==kn(t))throw new Error("unsupported value for Color.set");o[s]=t}var l=new Ln(o,i);return r?(this._rgb=l._rgb,this):l}throw new Error("unknown channel "+a+" in mode "+i)}return o};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],a=n[1],o=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(a,2)*(1-r)+Bn(u,2)*r),zn(Bn(o,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,a,o,s,l,u,c,d,p,f,h,m,g;return"hsl"===n?(o=e.hsl(),s=t.hsl()):"hsv"===n?(o=e.hsv(),s=t.hsv()):"hcg"===n?(o=e.hcg(),s=t.hcg()):"hsi"===n?(o=e.hsi(),s=t.hsi()):"lch"===n||"hcl"===n?(n="hcl",o=e.hcl(),s=t.hcl()):"oklch"===n&&(o=e.oklch().reverse(),s=t.oklch().reverse()),"h"!==n.substr(0,1)&&"oklch"!==n||(l=(i=o)[0],c=i[1],p=i[2],u=(a=s)[0],d=a[1],f=a[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,ai=Math.PI,oi=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 a=e[i],o=t[i]/r,s=a._rgb;n[0]+=ni(s[0],2)*o,n[1]+=ni(s[1],2)*o,n[2]+=ni(s[2],2)*o,n[3]+=s[3]*o}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],a=[],o=[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]);a.length=0;for(var r=0;r<e.length;r++)a.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=o[0]+u*(1-o[0]-o[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<a.length;g++){var v=a[g];if(u<=v){i=l[g];break}if(u>=v&&g===a.length-1){i=l[g];break}if(u>v&&u<a[g+1]){u=(u-v)/(a[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],a=[];var t=l.length;if(e.length===t&&c!==d)for(var r=0,n=Array.from(e);r<n.length;r+=1){var o=n[r];a.push((o-c)/(d-c))}else{for(var s=0;s<t;s++)a.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],a=t+(r-t)*e,o=i-a,s=0,l=1,u=20;Math.abs(o)>.01&&u-- >0;)n&&(o*=-1),o<0?(s=e,e+=.5*(l-e)):(l=e,e+=.5*(s-e)),o=(i=v(e,!0).lab()[0])-a;return e}:function(e){return e},A},A.padding=function(e){return null!=e?("number"===di(e)&&(e=[e,e]),o=e,A):o},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 a=i[0],o=i[1]-a;n=function(e,t,r){for(var n=[],i=e<t,a=r?i?t+1:t-1:t,o=e;i?o<a:o>a;i?o++:o--)n.push(o);return n}(0,t,!1).map((function(e){return A(a+e/(t-1)*o)}))}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=o,Di=Math.log,Fi=Math.pow,Pi=Math.floor,Mi=Math.abs,Ni=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=Ni(e));var n=e.min,i=e.max,a=e.values.sort((function(e,t){return e-t}));if(1===r)return[n,i];var o=[];if("c"===t.substr(0,1)&&(o.push(n),o.push(i)),"e"===t.substr(0,1)){o.push(n);for(var s=1;s<r;s++)o.push(n+s/r*(i-n));o.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);o.push(n);for(var c=1;c<r;c++)o.push(Fi(10,l+c/r*(u-l)));o.push(i)}else if("q"===t.substr(0,1)){o.push(n);for(var d=1;d<r;d++){var p=(a.length-1)*d/r,f=Pi(p);if(f===p)o.push(a[f]);else{var h=p-f;o.push(a[f]*(1-h)+a[f+1]*h)}}o.push(i)}else if("k"===t.substr(0,1)){var m,g=a.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=a[T],O=Number.MAX_VALUE,x=void 0,C=0;C<r;C++){var I=Mi(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]=a[D]:j[m]+=a[D];for(var F=0;F<r;F++)j[F]*=1/b[F];v=!1;for(var P=0;P<r;P++)if(j[P]!==A[P]){v=!0;break}A=j,++_>200&&(v=!1)}for(var M={},N=0;N<r;N++)M[N]=[];for(var L=0;L<g;L++)M[m=y[L]].push(a[L]);for(var k=[],q=0;q<r;q++)k.push(M[q][0]),k.push(M[q][M[q].length-1]);k=k.sort((function(e,t){return e-t})),o.push(k[0]);for(var $=1;$<k.length;$+=2){var z=k[$];isNaN(z)||-1!==o.indexOf(z)||o.push(z)}}return o},ki={analyze:Ni,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,ea=fi,ta={cool:function(){return ea([Ji.hsl(180,1,.9),Ji.hsl(250,.7,.4)])},hot:function(){return ea(["#000","#f00","#ff0","#fff"]).mode("rgb")}},ra={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"]},na=0,ia=Object.keys(ra);na<ia.length;na+=1){var aa=ia[na];ra[aa.toLowerCase()]=ra[aa]}var oa=ra,sa=v;return sa.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 a=e.shift(),o=a.get(t),s=[],l=0,u=0,c=0;c<o.length;c++)if(o[c]=(o[c]||0)*r[0],s.push(isNaN(o[c])?0:r[0]),"h"===t.charAt(c)&&!isNaN(o[c])){var d=o[c]/180*ai;l+=oi(d)*r[0],u+=si(d)*r[0]}var p=a.alpha()*r[0];e.forEach((function(e,n){var i=e.get(t);p+=e.alpha()*r[n+1];for(var a=0;a<o.length;a++)if(!isNaN(i[a]))if(s[a]+=r[n+1],"h"===t.charAt(a)){var c=i[a]/180*ai;l+=oi(c)*r[n+1],u+=si(c)*r[n+1]}else o[a]+=i[a]*r[n+1]}));for(var f=0;f<o.length;f++)if("h"===t.charAt(f)){for(var h=li(u/s[f],l/s[f])/ai*180;h<0;)h+=360;for(;h>=360;)h-=360;o[f]=h}else o[f]=o[f]/s[f];return p/=n,new ti(o,t).alpha(p>.99999?1:p,!0)},sa.bezier=function(e){var t=function(e){var t,r,n,i,a,o,s;if(2===(e=e.map((function(e){return new hi(e)}))).length)t=e.map((function(e){return e.lab()})),a=t[0],o=t[1],i=function(e){var t=[0,1,2].map((function(t){return a[t]+e*(o[t]-a[t])}));return new hi(t,"lab")};else if(3===e.length)r=e.map((function(e){return e.lab()})),a=r[0],o=r[1],s=r[2],i=function(e){var t=[0,1,2].map((function(t){return(1-e)*(1-e)*a[t]+2*(1-e)*e*o[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()})),a=n[0],o=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)*a[t]+3*(1-e)*(1-e)*e*o[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,a){return n+c[a]*Math.pow(t,d-a)*Math.pow(e,a)*i[r]}),0)}));return new hi(r,"lab")}}return i}(e);return t.scale=function(){return mi(t)},t},sa.blend=_i,sa.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 a,o=0;"array"===Ai(i)?a=i[1]-i[0]:(a=0,i=[i,i]);var s=function(s){var l=Si*((e+120)/360+t*s),u=Ti(i[0]+a*s,n),c=(0!==o?r[0]+s*o: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==(o=r[1]-r[0])&&(r=r[1]):o=0,s)},s.lightness=function(e){return null==e?i:("array"===Ai(e)?(i=e,a=e[1]-e[0]):(i=[e,e],a=0),s)},s.scale=function(){return xi.scale(s)},s.hue(r),s},sa.mix=sa.interpolate=Rn,sa.random=function(){for(var e="#",t=0;t<6;t++)e+="0123456789abcdef".charAt(Ii(16*ji()));return new Ci(e,"hex")},sa.scale=fi,sa.analyze=ki.analyze,sa.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)},sa.deltaE=function(e,t,r,n,i){void 0===r&&(r=1),void 0===n&&(n=1),void 0===i&&(i=1);var a=function(e){return 360*e/(2*Ki)},o=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=a(Vi(c,b)),T=a(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(o(x-30))+.24*Yi(o(2*x))+.32*Yi(o(3*x+6))-.2*Yi(o(4*x-63)),I=O-E;I=Hi(I)<=180?I:O<=E?I+360:I-360,I=2*zi(_*A)*Xi(o(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,P=1+.015*w*C,M=30*Wi(-Bi((x-275)/25,2)),N=-2*zi(Bi(w,7)/(Bi(w,7)+Bi(25,7)))*Xi(2*o(M)),L=zi(Bi(j/(r*D),2)+Bi(R/(n*F),2)+Bi(I/(i*P),2)+N*(R/(n*F))*(I/(i*P)));return Ui(0,Gi(100,L))},sa.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),a=0;for(var o in n){var s=(n[o]||0)-(i[o]||0);a+=s*s}return Math.sqrt(a)},sa.limits=ki.limits,sa.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}},sa.scales=ta,sa.colors=dr,sa.brewer=oa,sa}()},9034:e=>{e.exports=JSON.parse('{"name":"@vizzly/api-client","version":"0.0.38","private":false,"license":"NONE","source":"src/index.ts","main":"dist/index.js","types":"dist/index.d.ts","type":"commonjs","files":["dist"],"devDependencies":{"@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":{"cross-fetch":"^4.0.0"}}')}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var a=t[n]={id:n,loaded:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.loaded=!0,a.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.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var n={};(()=>{r.d(n,{B:()=>ka,Q:()=>ki});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 a=r(4893);const o=a.QueryEngineConfig.Constants.timeDimensionsConstants,s=(e,t)=>[...Object.keys(e),"none"].includes(t),l=a.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=a.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 a=r&&r.length>0?r.filter((e=>i.includes(e))):i;return r&&r.length>0&&0===a.length&&(a=i),a},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,a,o;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===(a=l.yMeasure)||void 0===a?void 0:a.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===(o=l.timeDimension)||void 0===o?void 0:o.field)==r&&(l.timeDimension=null),l},P=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)},M=(e,t,r)=>{let n=i(e,t);const{value:a,error:o}=r.validate(n);if(o)throw o;return a};var N=r(4579),L=r.n(N);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,a=e,Object.keys(a).filter((e=>a[e].validDataTypes.includes(i.dataType))));var i,a;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().try(ue,L().string().allow(null),L().number(),L().boolean(),L().array().items(L().string(),L().number(),L().allow(null)),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)}),ae=()=>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()})),oe=()=>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=L().custom(((e,t)=>"[object Date]"===Object.prototype.toString.call(e)?e:t.error("any.invalid")),"Date object validation"),ce=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."),de=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.")}),pe=e=>L().array().items(ce(e)).description("Apply formatting based on a set of defined rules."),fe=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","funnelChart").required(),conditionalFormattingRules:pe(e.queryEngineConfig),protectedFields:L().object({dimension:te(e.queryEngineConfig),measure:ee(e.queryEngineConfig)}).unknown(!0),parameters:ie(e.queryEngineConfig,e.attributesSchemaOptions),goalLines:ae(),axisTitles:se(),headline:oe(),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")}))})),he=e=>(t,r)=>{let n=M(t,r,fe(e));return n=P(n),n};class me extends Error{constructor(e){super(e),this.name="ValidationError"}}const ge=me;class ye extends ge{constructor(e){super(`Corrupt view. ${e.message}.\n\n ${JSON.stringify(e)}\n `),this.name="CorruptedView"}}r(3514);const be=(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},ve=(e,t,r)=>e.map((({rule:e,name:n})=>({returns:{type:"string",value:n},filter:Re(e,t,r)}))),_e=e=>"leftFieldId"in e&&"operator"in e&&"rightFieldId"in e,Ae=e=>"roundToDecimalPlaces"in e,we=e=>"leftFieldId"in e&&"leftFunction"in e&&"operator"in e&&"rightFieldId"in e&&"rightFunction"in e,Se=e=>"denominatorFieldId"in e||"numeratorFieldId"in e,Te=e=>"rules"in e,Ee=e=>"rule"in e,Oe=e=>"dateCalculationFunction"in e,xe=e=>Se(e)||_e(e)||we(e)||Te(e)||Ae(e)||Oe(e)||Ee(e),Ce=(e,t,r,n,i,a)=>{if(Se(t))return((e,t,r,n,i)=>{var a,o,s,l;const{combinedNominatorFilters:u,combinedDenominatorFilters:c}=function(e,t){let r=[],n=[];return t.numeratorFilter&&De(t.numeratorFilter)?t.numeratorFilter.forEach((t=>{r=[...r,...je(null!=e?e:[],t)]})):r=null!=e?e:[],t.denominatorFilter&&De(t.denominatorFilter)?t.denominatorFilter.forEach((t=>{n=[...n,...je(null!=e?e:[],t)]})):n=null!=e?e:[],{combinedNominatorFilters:r,combinedDenominatorFilters:n}}(i,e),d={fieldId:null!==(a=e.numeratorFieldId)&&void 0!==a?a:e.denominatorFieldId,aggregate:null!==(o=e.numeratorAggregate)&&void 0!==o?o: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:Re(c||[],t,r)}},h=be(p,De(e.denominatorFilter)?Re(c,t,r):[]);return{type:"maths",left:be(d,De(e.numeratorFilter)?Re(u,t,r):[]),op:"/",right:"withinGrouping"===e.denominatorScope?h:f}})(t,r,n,0,a);if(Te(t))return((e,t,r,n)=>{const i={type:"switchField",value:{cases:ve(t.rules,r,n)}};return"none"==e.function?i:{type:"function",function:e.function,value:i}})(e,t,r,n);if(we(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(_e(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(Ae(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(Ee(t))return((e,t,r)=>({type:"function",function:e.function,value:{type:"switchField",value:{cases:[{returns:{type:"field",function:"none",value:e.fieldId},filter:Re(e.rule,t,r)},{returns:{type:"null"},filter:[[{value:1,op:"=",field:{type:"number",value:1}}]]}]}}}))(t,r,n);if(Oe(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)}`},Ie=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},je=(e,r)=>(e&&!(0,t.isEmpty)(e)||(e=[[]]),[...e].map((e=>[...e,...r]))),Re=(e,t,r)=>e.map((n=>[...n].flatMap((n=>{var i,a;if(n.function&&!s(t.supportedTimeTruncFunctions,n.function))throw`Query engine does not support the query function ${n.function}.`;const o=At(r,n.field);let l={type:"field",value:n.field,function:null!==(i=n.function)&&void 0!==i?i:"none"};if(xe(o)&&(l=Ce({field:o.id,function:null!==(a=n.function)&&void 0!==a?a:"none"},o,t,r,0,e)),("array_contains"==n.op||"array_does_not_contain"==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}]})))),De=e=>e&&(0,t.isArray)(e)&&(0,t.isArray)(e[0]),Fe=e=>e&&(0,t.isArray)(e)&&(0,t.isArray)(e[0])&&"field"in e[0][0]&&"op"in e[0][0]&&"value"in e[0][0],Pe=(e,t)=>[[...e,t],e.length],Me=(e,t,r,n,i,a,o,l,u)=>{let c=[],d=[],p=[],f=[],h=[];if(a){let t;if(!s(u.supportedTimeTruncFunctions,a.truncate))throw`Query engine does not support the time trunc function ${a.truncate}.`;[d,t]=Pe(d,{type:"field",value:a.field,function:a.truncate}),c=[...c,{functionId:a.truncate,field:At(e,a.field)}],p=[...p,{index:t}]}return i.forEach((t=>{let r;[d,r]=Pe(d,{type:"field",value:null==t?void 0:t.field,function:t.function}),c=[...c,{functionId:t.function,field:At(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]=Pe(d,{type:"field",value:t.field,function:t.function}),c=[...c,{functionId:t.function,field:At(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=Re([t],u,e);h=[...h,r[0]]})),d=d.map((t=>{if("field"==t.type&&"string"==typeof t.value){const r=At(e,t.value);if(xe(r))return Ce({function:t.function,field:t.value},r,u,e,gt({group:p}),n)}return t})),{query:{type:"query",dataSetId:e.id,measure:d,group:p,filter:h,order:f,limit:o,offset:l},measureDescription:c}};var Ne=r(6342);const Le=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"),ke=L().object({index:L().number().required()}),qe=L().object({index:L().number().required(),direction:L().string().valid("asc","desc").required()}),$e=(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(),L().array().items(L().alternatives(L().string(),L().number(),L().valid(!0),L().valid(!1)))]),"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)},ze=e=>L().object({field:Le(e),op:L().string().valid(...Object.keys(e.supportedOperators)),value:L().alternatives().conditional("op",Object.keys(e.supportedOperators).map((t=>({is:t,then:$e(t,e.supportedOperators[t].validDataTypes)}))))}).id("Filter"),Be=e=>{const t=ze(e);return L().alternatives(L().object({type:L().valid("preparedQuery").required(),timeZone:L().string().valid(...(0,a.ianaTimeZones)()).default(a.ETC_UTC_TIME_ZONE),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(),timeZone:L().string().valid(...(0,a.ianaTimeZones)()).default(a.ETC_UTC_TIME_ZONE),preparedQueryType:L().valid("preAggregated").required(),dataSetId:L().string().required(),filter:L().object().pattern(L().string(),L().array().items(L().array().items(t)))}))},Ge=e=>{const t=ze(e),r=Le(e);return L().alternatives().conditional(".type",{is:"query",then:L().object({type:L().valid("query"),timeZone:L().string().valid(...(0,a.ianaTimeZones)()).default(a.ETC_UTC_TIME_ZONE),dataSetId:L().string().required(),measure:L().array().items(r).min(1).required(),group:L().array().items(ke).required(),filter:L().array().items(L().array().items(t)).required(),order:L().array().items(qe).required(),limit:X(),offset:L().number().optional()}).shared(t).shared(r)}).conditional(".type",{is:"preparedQuery",then:Be(e)})},Ue=(Ge(a.QueryEngineConfig.getQueryEngineConfig("postgres")),Ge(a.QueryEngineConfig.getQueryEngineConfig("snowflake")),Ge(a.QueryEngineConfig.getQueryEngineConfig("mariadb")),Ge(a.QueryEngineConfig.getQueryEngineConfig("mysql")),Ge(a.QueryEngineConfig.getQueryEngineConfig("bigquery")),Ge(a.QueryEngineConfig.getQueryEngineConfig("redshift")),"dateFilter"),Ve="dateAndTimeFilter",He="singleSelectFilter",Ye="multiSelectFilter",Xe="numericFilter",We="advancedFilter",Ke=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:et(e.type),value:tt(e.value,e.type,e.appliesToFields)}),Qe=(e,t,r)=>t.appliesToFields.flatMap((n=>{var i,a,o;if(n.dataSetId!=e.id)return[];if(null==t.value)return[];if("string[]"==At(e,n.fieldId).dataType&&t.type!==Ye&&!Fe(t.value))return[{field:n.fieldId,op:"array_contains",value:t.value}];if((t.type==Ue||t.type==Ve)&&"relativeRange"==(null===(i=t.value)||void 0===i?void 0:i.type))return[];if((t.type==Ue||t.type==Ve)&&"fixedRange"==(null===(a=t.value)||void 0===a?void 0:a.type))return[{field:n.fieldId,op:nt(rt.Greater,t),value:t.value.after},{field:n.fieldId,op:nt(rt.Less,t),value:t.value.before}];if((t.type==Ue||t.type==Ve)&&"relative"==(null===(o=t.value)||void 0===o?void 0:o.type)){let{before:e,after:i}=r[t.value.value].range,a=[];return e&&(a=[...a,{field:n.fieldId,op:nt(rt.Less,t),value:e}]),i&&(a=[...a,{field:n.fieldId,op:nt(rt.Greater,t),value:i}]),a}if(t.type==He){let e=t.value;return"__vizzly_null_value_option"===t.value&&(e=null),[{field:n.fieldId,op:"=",value:e}]}if(Fe(t.value))return it(t.value,n,e.id);if(t.type==Ye&&t.value.length>0)return[{field:n.fieldId,op:"is_one_of",value:t.value}];if(t.type==Ue&&!t.value||t.type==Ve&&!t.value||t.type==Ye&&0===t.value.length)return[];if(t.type==Xe)return"op"in t.value&&"value"in 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)}`})),Ze=(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},Je=(e,t,r)=>{let n=[];return(e.globalFilters||[]).forEach((e=>{let i=[];e.type!==Ve&&e.type!==Ue||(i=Ze(e)),n=[...n,...i,...Qe(t,e,r)]})),Object.values(e.localFilters||{}).flat().forEach((e=>{let i=[];e.type!==Ve&&e.type!==Ue||(i=Ze(e)),n=[...n,...i,...Qe(t,e,r)]})),n},et=e=>"dateTimeFilter"===e?Ue:"numericFilter"===e||"multiSelectFilter"===e?We:e,tt=(e,t,r)=>{if(null==e)return null;if(Fe(e))return e;if("numericFilter"===t){const t=e;return[r.map((e=>({field:e.fieldId,op:t.op,value:t.value})))]}return"multiSelectFilter"===t?[r.map((t=>({field:t.fieldId,op:"is_one_of",value:e})))]:e};var rt;function nt(e,t){switch(e){case rt.Greater:return t.inclusiveDate?">=":">";case rt.Less:return t.inclusiveDate?"<=":"<";default:throw new Error("Unknown date operation")}}!function(e){e[e.Greater=0]="Greater",e[e.Less=1]="Less"}(rt||(rt={}));const it=(e,r,n)=>{if(!e)return[];const i=e[0];if((0,t.isArray)(e)&&(0,t.isArray)(e[0])){if(r.dataSetId!=n)return[];const e=i.find((e=>e.field==r.fieldId));return null!=e?e:[]}return[]},at=L().object({fieldId:L().string().required(),dataSetId:L().string().required()}),ot=e=>L().object().pattern(L().string(),L().array().items(H(e)).optional()),st=e=>({title:L().string().allow(""),managedByConfiguration:L().boolean().optional(),requiresValue:L().boolean().optional(),optionsFilters:ot(e).optional(),appliesToFields:L().array().items(at).required(),optionsPulledFrom:L().array().items(at).optional(),hidden:L().boolean(),options:L().array().items(L().object({value:L().allow(L().number(),L().string()),label:L().string()})).optional()}),lt=(e,t)=>L().object(Object.assign(Object.assign({},st(e)),{type:L().valid(He).required(),value:L().alternatives(L().string(),L().number(),L().boolean(),L().valid(...t?[]:[null]))})),ut=(e,t)=>L().object(Object.assign(Object.assign({},st(e)),{type:L().valid(Ye).required(),value:L().alternatives(L().array().items(L().string(),L().number()).single(),L().valid(...t?[]:[null]),L().array().items(L().array().items(H(e))))})),ct=(e,t)=>L().object(Object.assign(Object.assign({},st(e)),{type:L().valid(We).required(),value:L().alternatives(L().valid(...t?[]:[null]),L().array().items(L().array().items(H(e))))})),dt=(e,t,r)=>L().object(Object.assign(Object.assign({},st(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()}))})),pt=(e,t)=>L().object(Object.assign(Object.assign({},st(e)),{type:L().valid(Xe).required(),value:L().alternatives(L().object({op:L().allow("=","<",">","<=",">="),value:L().number().allow(null,0)}),L().array().items(L().array().items(H(e))),L().valid(...t?[]:[null]))})),ft=(e,t)=>L().alternatives().conditional(".type",{is:He,then:lt(e,t)}).conditional(".type",{is:Ue,then:dt(e,t,Ue)}).conditional(".type",{is:Ve,then:dt(e,t,Ve)}).conditional(".type",{is:Ye,then:ut(e,t)}).conditional(".type",{is:Xe,then:pt(e,t)}).conditional(".type",{is:We,then:ct(e,t)});function ht(e){return L().array().items(L().custom(((t,r)=>{if(!e)return r.error("any.invalid");const n=ft(e,!!t.requiresValue),{error:i}=n.validate(t);return i?r.error("any.invalid",{message:i.message}):t}))).required()}const mt=Me,gt=e=>e.group.length>0,yt=(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 bt extends ge{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 vt(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=vn(t);return[...e].filter((e=>{let t=!0;return Se(e)&&!r.supportedCustomFields.percentages&&(t=!1),_e(e)&&!r.supportedCustomFields.simpleMaths&&(t=!1),Te(e)&&!r.supportedCustomFields.rules&&(t=!1),Ae(e)&&!r.supportedCustomFields.roundedNumbers&&(t=!1),Ee(e)&&!r.supportedCustomFields.conditional&&(t=!1),Oe(e)&&!r.supportedCustomFields.dateCalculations&&(t=!1),t}))})(n,r.forComponent)),(null==r?void 0:r.removePercentage)&&(n=n.filter((e=>!Se(e)))),(null==r?void 0:r.removeRuleGrouping)&&(n=n.filter((e=>!Te(e)))),(null==r?void 0:r.removeSimpleMaths)&&(n=n.filter((e=>!_e(e)))),(null==r?void 0:r.removeAggregateMaths)&&(n=n.filter((e=>!we(e)))),(null==r?void 0:r.removeDateCalculations)&&(n=n.filter((e=>!Oe(e)))),(null==r?void 0:r.removeConditional)&&(n=n.filter((e=>!Ee(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 _t=(e,t)=>e.find((e=>e.id==t))||null,At=(e,t)=>{let r=[...e.fields].find((e=>e.id==t));if(r)return r;throw new bt(e,t)},wt=(e,r)=>{const n=(0,t.findIndex)(e,(e=>e.id==r));return[e[n]||null,n]},St=(e,t)=>[...vt(e.fields,{onlyFieldTypes:["number","string","boolean"],onlyMeasures:!0,forComponent:t})],Tt=e=>Object.assign(Object.assign({},e),{fields:[...e.fields].filter((e=>!xe(e)))}),Et=(e,t,r)=>{const n="horizontalBarChart"===r?void 0:"x",i=(e=>[...vt(e.fields,{onlyFieldTypes:["boolean","number","string"],onlyDimensions:!0,removePercentage:!0,removeSimpleMaths:!0,removeAggregateMaths:!0})])(e)[0],a=[...St(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:a,order:[],timeDimension:null,filter:[],dimension:i?[{field:i.id,function:"none",pivot:n}]:[]}},Ot=(e,t)=>t?(e=e.map(Tt),[...[...e].map((e=>{const r=(t[e.id]||[]).map(Ie);return Object.assign(Object.assign({},e),{fields:[...e.fields,...r]})}))]):e;class xt extends ge{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 Ct={allowUnknown:!0,stripUnknown:!0},It=(e,t,r)=>{const{error:n}=vn(e.type,{queryEngineConfig:r}).schema.validate(e,Ct);if(n)return[new ye(n)];const i=_t(t,e.dataSetId);if(!i)return[new xt(t,e.dataSetId)];const a=(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{a.forEach((e=>{At(i,e)}))}catch(e){if(e instanceof bt)return[e];throw e}return[]},jt=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},Rt={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let Dt;const Ft=new Uint8Array(16);function Pt(){if(!Dt&&(Dt="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Dt))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Dt(Ft)}const Mt=[];for(let e=0;e<256;++e)Mt.push((e+256).toString(16).slice(1));const Nt=function(e,t,r){if(Rt.randomUUID&&!t&&!e)return Rt.randomUUID();const n=(e=e||{}).random||(e.rng||Pt)();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 Mt[e[t+0]]+Mt[e[t+1]]+Mt[e[t+2]]+Mt[e[t+3]]+"-"+Mt[e[t+4]]+Mt[e[t+5]]+"-"+Mt[e[t+6]]+Mt[e[t+7]]+"-"+Mt[e[t+8]]+Mt[e[t+9]]+"-"+Mt[e[t+10]]+Mt[e[t+11]]+Mt[e[t+12]]+Mt[e[t+13]]+Mt[e[t+14]]+Mt[e[t+15]]}(n)};const Lt=e=>e||`view_${Nt()}`;function kt(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 qt=(e,r,n)=>{let i=(0,t.cloneDeep)(vt(r.fields,{onlyFieldTypes:["boolean","string"]})),a=(0,t.cloneDeep)(vt(r.fields,{onlyFieldTypes:["date_time"]})),o=(0,t.cloneDeep)(vt(r.fields,{onlyFieldTypes:["number"]})),s=null;return a[0]&&(s={field:a[0].id,truncate:"none"}),n(e,{protectedByOrganisation:!0,dimension:i.map((e=>({field:e.id,function:"none"}))),measure:[...o].map((e=>({function:"none",field:e.id}))),order:[],timeDimension:s})},$t=(e,r)=>{let n=null,i=(0,t.cloneDeep)(e);return i.forEach((e=>{const t=At(r,e.field);"date_time"==t.dataType&&(n={field:t.id,truncate:e.function})})),i=i.filter((e=>"date_time"!=At(r,e.field).dataType)),{timeDimension:n,dimension:i}},zt=e=>{let t=[...e.dimension];return"timeDimension"in e&&e.timeDimension&&(t=[{field:e.timeDimension.field,function:e.timeDimension.truncate},...t]),t},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=>Gt(t,e)))));r.push(...n)}else i&&r.push([Gt({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)},Gt=(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}},Ut={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 Vt(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 Ht(e,t){var r;return null===(r=e.format_panel.axis_labels)||void 0===r?void 0:r.subSectionDefinition[t]}function Yt(e){return Object.assign(Object.assign({},Vt(e,"heading")),{subSection:[e.format_panel.heading.subSectionDefinition.title,e.format_panel.heading.subSectionDefinition.subject]})}function Xt(e){return Object.assign(Object.assign({},Vt(e,"axis_labels")),{y:Object.assign(Object.assign({},Ht(e,"y")),{prefix:Ht(e,"y.prefix"),postfix:Ht(e,"y.postfix"),format:Ht(e,"y.format"),count:Ht(e,"y.count"),axisTitle:Ht(e,"y.axis_title")}),x:Object.assign(Object.assign({},Ht(e,"x")),{prefix:Ht(e,"x.prefix"),postfix:Ht(e,"x.postfix"),format:Ht(e,"x.format"),count:Ht(e,"x.count"),axisTitle:Ht(e,"x.axis_title")})})}function Wt(e,t,r){var n,i,a,o,s;return t?Object.assign(Object.assign({},Vt(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({},Vt(e,"chart_styles")),{subSection:[null===(a=e.format_panel.chart_styles)||void 0===a?void 0:a.subSectionDefinition.stacked,null===(o=e.format_panel.chart_styles)||void 0===o?void 0:o.subSectionDefinition.legend]}):Object.assign(Object.assign({},Vt(e,"chart_styles")),{subSection:[null===(s=e.format_panel.chart_styles)||void 0===s?void 0:s.subSectionDefinition.legend]})}function Kt(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 Qt=(e,t)=>{if("current"===(null==e?void 0:e.func)&&t)return e},Zt=e=>({title:Ut.title,description:Ut.description,servicesClass:"BarChart",namespace:Ut.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),viewId:Lt(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:Qt(t.headline,t.timeDimension),tags:null!==(r=t.tags)&&void 0!==r?r:[],drilldownOptions:t.drilldownOptions})},setAttributes:he(e),validate:(t,r)=>It(t,r,e.queryEngineConfig),init:(e,t)=>Object.assign({type:"barChart",measure:[],dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",viewId:Lt(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:jt,schema:fe(e),removeField:(t,r)=>F(t,r,e.queryEngineConfig),isRunnable:e=>e.measure.length>0,autoGenerate(t){const{measure:r,dimension:n}=Et(t,e.queryEngineConfig,"barChart");return this.init(t.id,{measure:[r[0]],dimension:n})},dataPanelConfig:()=>[Vt(Ut,"data_set"),Vt(Ut,"views"),Object.assign(Object.assign({},Vt(Ut,"field_y_axis")),{fieldFilterOptions:{forComponent:"barChart",onlyMeasures:!0},preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"}),Object.assign(Object.assign({},Vt(Ut,"field_x_axis")),{fieldFilterOptions:{forComponent:"barChart",onlyDimensions:!0},preventDuplicates:!0,preSetPartialAttributes:(e,t)=>$t(e,t),getValues:e=>zt(e),maxAllowed:2,testId:"add-dimension"}),Vt(Ut,"sort"),Vt(Ut,"filter"),Object.assign(Object.assign({},Vt(Ut,"drilldown")),{options:{property:"drilldownOptions"}}),Vt(Ut,"custom_metrics"),Vt(Ut,"limit")],formatPanelConfig:()=>[Yt(Ut),Wt(Ut,!1,!0),Xt(Ut),Object.assign(Object.assign({},Vt(Ut,"conditional_formatting")),{ruleType:"backgroundColor"}),Vt(Ut,"goal_line"),Vt(Ut,"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 qt(e,t,this.setAttributes)}}),Jt=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:pe(e.queryEngineConfig),goalLines:ae(),axisTitles:se(),headline:oe(),tags:z()})),er=e=>(t,r)=>{let n=M(t,r,Jt(e));return n=P(n),n},tr={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:""}}},rr=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:Lt(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:Qt(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:er(e),validate:(t,r)=>It(t,r,e.queryEngineConfig),init:(e,t)=>Object.assign({type:"lineChart",measure:[],dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",protectedByOrganisation:void 0,viewId:Lt(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:jt,schema:Jt(e),removeField:(t,r)=>F(t,r,e.queryEngineConfig),isRunnable:e=>e.measure.length>0,autoGenerate(t){const{measure:r,dimension:n}=Et(t,e.queryEngineConfig,"lineChart");return this.init(t.id,{measure:[r[0]],dimension:n})},dataPanelConfig:()=>[Vt(tr,"data_set"),Vt(tr,"views"),Object.assign(Object.assign({},Vt(tr,"field_y_axis")),{fieldFilterOptions:{forComponent:"lineChart"},preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"}),Object.assign(Object.assign({},Vt(tr,"field_x_axis")),{fieldFilterOptions:{forComponent:"lineChart",onlyDimensions:!0},preventDuplicates:!0,preSetPartialAttributes:(e,t)=>$t(e,t),getValues:e=>zt(e),maxAllowed:2,testId:"add-dimension"}),Vt(tr,"sort"),Vt(tr,"filter"),Vt(tr,"custom_metrics"),Vt(tr,"limit")],formatPanelConfig:()=>[Yt(tr),Wt(tr,!0,!1),Xt(tr),Object.assign(Object.assign({},Vt(tr,"conditional_formatting")),{ruleType:"lineColor"}),Vt(tr,"goal_line"),Vt(tr,"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 qt(e,t,this.setAttributes)}}),nr=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),labels:L().valid(!0,!1),limit:X(),labelsAsPercentage:L().boolean(),conditionalFormattingRules:pe(e.queryEngineConfig),labelFormat:L().alternatives(L().string(),L().valid(null)),parameters:ie(e.queryEngineConfig,e.attributesSchemaOptions),tags:z()})),ir={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"},labels:{type:"labels",title:"Show Labels",description:"",namespace:"labels"}}},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""}}},ar=e=>({title:ir.title,description:ir.description,servicesClass:"PieChart",namespace:ir.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:Lt(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,labels:t.labels,labelFormat:t.labelFormat,parameters:m(t.parameters),tags:null!==(r=t.tags)&&void 0!==r?r:[]}},setAttributes:(t,r)=>M(t,r,nr(e)),validate:(t,r)=>It(t,r,e.queryEngineConfig),init:(e,t)=>Object.assign({type:"pieChart",measure:[],dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",protectedByOrganisation:void 0,viewId:Lt(null==t?void 0:t.viewId),filter:[],order:[],dataSetId:e,limit:5e3,conditionalFormattingRules:[],labelsAsPercentage:!1,legend:!0,labels:!1,labelFormat:null,parameters:{},tags:[]},t),createFeedback:jt,schema:nr(e),removeField:(t,r)=>F(t,r,e.queryEngineConfig),isRunnable:e=>e.measure.length>0,autoGenerate(t){const{measure:r,dimension:n}=Et(t,e.queryEngineConfig,"pieChart");return this.init(t.id,{measure:[r[0]],dimension:n})},dataPanelConfig:()=>[Vt(ir,"data_set"),Vt(ir,"views"),Object.assign(Object.assign({},Vt(ir,"field_metrics")),{fieldFilterOptions:{forComponent:"pieChart"},maxAllowed:1,preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"}),Object.assign(Object.assign({},Vt(ir,"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"}),Vt(ir,"sort"),Vt(ir,"filter"),Vt(ir,"custom_metrics"),Vt(ir,"limit")],formatPanelConfig:()=>{var e,t,r;return[Yt(ir),Object.assign(Object.assign({},Vt(ir,"conditional_formatting")),{ruleType:"backgroundColor"}),Object.assign(Object.assign({},Vt(ir,"chart_styles")),{subSection:[null===(e=ir.format_panel.chart_styles)||void 0===e?void 0:e.subSectionDefinition.legend,null===(t=ir.format_panel.chart_styles)||void 0===t?void 0:t.subSectionDefinition.labels,null===(r=ir.format_panel.chart_styles)||void 0===r?void 0:r.subSectionDefinition.number_format]})]},supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0},supportedFeatures:{parameters:!0,colorGradient:!1}}),or=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:ae(),axisTitles:se(),tags:z()})),sr=e=>(t,r)=>{let n=M(t,r,or(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},lr={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:""}}},ur=e=>({title:lr.title,description:lr.description,servicesClass:"ScatterChart",namespace:lr.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:Lt(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:sr(e),validate:(t,r)=>It(t,r,e.queryEngineConfig),init:(e,t)=>Object.assign({type:"scatterChart",xMeasure:null,yMeasure:null,dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",protectedByOrganisation:void 0,viewId:Lt(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:jt,schema:or(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}=Et(t,e.queryEngineConfig,"scatterChart");return this.init(t.id,{xMeasure:r[0],yMeasure:r[1],dimension:n})},dataPanelConfig:()=>{var e,t;return[Vt(lr,"data_set"),Vt(lr,"views"),Object.assign(Object.assign({},Vt(lr,"labelled_metrics")),{subSection:[Object.assign(Object.assign({},null===(e=lr.data_panel.labelled_metrics)||void 0===e?void 0:e.subSectionDefinition.xAxis),{propKey:"xMeasure",allowsMultiple:!1}),Object.assign(Object.assign({},null===(t=lr.data_panel.labelled_metrics)||void 0===t?void 0:t.subSectionDefinition.yAxis),{propKey:"yMeasure",allowsMultiple:!1})]}),Object.assign(Object.assign({},Vt(lr,"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"}),Vt(lr,"filter"),Vt(lr,"custom_metrics"),Vt(lr,"limit")]},formatPanelConfig:()=>{var e;return[Yt(lr),Object.assign(Object.assign({},Vt(lr,"chart_styles")),{subSection:[null===(e=lr.format_panel.chart_styles)||void 0===e?void 0:e.subSectionDefinition.legend]}),Xt(lr),Vt(lr,"goal_line")]},supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0},supportedFeatures:{parameters:!1,colorGradient:!1}}),cr=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:ae(),conditionalFormattingRules:L().object({bar:L().array().items(ce(e.queryEngineConfig)),line:L().array().items(ce(e.queryEngineConfig))}),axisTitles:se(),tags:z()})),dr=e=>(t,r)=>{let n=M(t,r,cr(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},pr={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"}}}}},fr=e=>({title:pr.title,description:pr.description,servicesClass:"ComboChart",namespace:pr.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:Lt(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===(a=r.conditionalFormattingRules)||void 0===a?void 0:a.line)},tags:null!==(o=r.tags)&&void 0!==o?o:[]});var r,n,i,a,o},setAttributes:dr(e),validate:(t,r)=>It(t,r,e.queryEngineConfig),init:(e,t)=>Object.assign({type:"comboChart",barMeasure:[],lineMeasure:[],lineDimension:[],barDimension:[],timeDimension:null,displayTitle:"",displaySubject:"",viewId:Lt(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:jt,schema:cr(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}=Et(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[Vt(pr,"data_set"),Vt(pr,"views"),Object.assign(Object.assign({},Vt(pr,"labelled_metrics")),{subSection:[Object.assign(Object.assign({},null===(e=pr.data_panel.labelled_metrics)||void 0===e?void 0:e.subSectionDefinition.line),{propKey:"lineMeasure",allowsMultiple:!0}),Object.assign(Object.assign({},null===(t=pr.data_panel.labelled_metrics)||void 0===t?void 0:t.subSectionDefinition.bar),{propKey:"barMeasure",allowsMultiple:!0})]}),Vt(pr,"combo_chart_dimension"),Vt(pr,"sort"),Vt(pr,"filter"),Vt(pr,"custom_metrics"),Vt(pr,"limit")]},formatPanelConfig:()=>{var e,t,r,n,i,a,o,s,l,u;return[Yt(pr),Wt(pr,!1,!0),Xt(pr),Object.assign(Object.assign({},Vt(pr,"conditional_formatting")),{ruleType:"backgroundColor",subSection:[{title:null!==(r=null===(t=null===(e=pr.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=pr.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===(o=null===(a=pr.format_panel.conditional_formatting)||void 0===a?void 0:a.subSectionDefinition)||void 0===o?void 0:o.line.title)&&void 0!==s?s:"",namespace:null===(u=null===(l=pr.format_panel.conditional_formatting)||void 0===l?void 0:l.subSectionDefinition)||void 0===u?void 0:u.line.namespace,propKey:"line"}]}),Vt(pr,"goal_line")]},supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0},supportedFeatures:{parameters:!1,colorGradient:!1}}),hr=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(de),exportNames:L().object(),numberFormat:L().object(),conditionalFormattingRules:pe(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.")})),mr=e=>(t,r)=>{let n=M(t,r,hr(e));return n=P(n),n},gr={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:""}}},yr=[3,5,10,20,50,100,200],br=(e,t)=>e.filter((e=>e.pivot==t)),vr=e=>({title:gr.title,description:gr.description,servicesClass:"PivotTable",namespace:gr.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=zt({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:t.protectedFields,viewId:Lt(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(kt):n||[]),tags:null!==(r=t.tags)&&void 0!==r?r:[]}},setAttributes:mr(e),validate:(t,r)=>It(t,r,e.queryEngineConfig),init:(e,t)=>Object.assign({type:"dataTable",measure:[],displayTitle:"",dimension:[],protectedByOrganisation:void 0,displaySubject:"",viewId:Lt(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:hr(e),removeField:(t,r)=>F(t,r,e.queryEngineConfig),isRunnable:e=>e.measure.length>0,autoGenerate(t){const{measure:r,dimension:n}=Et(t,e.queryEngineConfig,"dataTable");return this.init(t.id,{measure:r.slice(0,5),dimension:n})},dataPanelConfig:()=>[Vt(gr,"data_set"),Vt(gr,"views"),Object.assign(Object.assign({},Vt(gr,"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"}))),...br(r.dimension,"x")]}),getValues:e=>br(e.dimension,"y"),testId:"add-pivot-dimension"}),Object.assign(Object.assign({},Vt(gr,"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"}))),...br(r.dimension,"y")]}),getValues:e=>br(e.dimension,"x"),testId:"add-dimension"}),Object.assign(Object.assign({},Vt(gr,"drilldown")),{options:{maxOptions:1,property:"tableDrilldown"}}),Object.assign(Object.assign({},Vt(gr,"field_metrics")),{fieldFilterOptions:{forComponent:"dataTable"},preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"}),Vt(gr,"sort"),Object.assign(Object.assign({},Vt(gr,"pagination")),{options:yr}),Vt(gr,"filter"),Vt(gr,"custom_metrics")],formatPanelConfig:()=>{var e;return[Yt(gr),Object.assign(Object.assign({},Vt(gr,"format")),{subSection:[null===(e=gr.format_panel.format)||void 0===e?void 0:e.subSectionDefinition.time]}),Vt(gr,"prefixes"),Object.assign(Object.assign({},Vt(gr,"conditional_formatting")),{ruleType:"backgroundColor"})]},supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0},supportedFeatures:{parameters:!1,colorGradient:!0}}),_r=L().object({field:L().string().required(),function:L().valid("none").required()}),Ar=e=>L().object(Object.assign(Object.assign({},W(e.attributesSchemaOptions)),{type:L().valid("basicTable").required(),measure:L().array().items(_r).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(de),exportNames:L().object(),numberFormat:L().object(),conditionalFormattingRules:pe(e.queryEngineConfig),dateTimeFormat:L().string(),protectedFields:L().object({measure:ee(e.queryEngineConfig)}).unknown(!0),sizing:le,tags:z()})),wr=e=>(t,r)=>{let n=M(t,r,Ar(e));return n=D(n,[...n.measure]),n},Sr={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:""}}},Tr=e=>({title:Sr.title,description:Sr.description,servicesClass:"BasicTable",namespace:Sr.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:Lt(t.viewId),conditionalFormattingRules:Bt(e.queryEngineConfig,t.conditionalFormattingRules),tags:null!==(r=t.tags)&&void 0!==r?r:[]})},setAttributes:wr(e),validate:(t,r)=>It(t,r,e.queryEngineConfig),init:function(t,r){const n={type:"basicTable",measure:[],displayTitle:"",dimension:[],timeDimension:null,displaySubject:"",filter:[],order:[],tags:[],dataSetId:t,viewId:Lt(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 wr(e)(n,r||{})},schema:Ar(e),removeField:(t,r)=>F(t,r,e.queryEngineConfig),setFields:function(t,r){const n=[...r].map((e=>({field:e,function:"none"})));return wr(e)(t,{measure:n})},setDateTimeFormat:function(e,t){return this.setAttributes(e,{dateTimeFormat:t})},isRunnable:e=>e.measure.length>0,autoGenerate(e){const t=[...vt(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:()=>[Vt(Sr,"data_set"),Vt(Sr,"views"),Vt(Sr,"fields"),Vt(Sr,"sort"),Object.assign(Object.assign({},Vt(Sr,"pagination")),{options:yr}),Vt(Sr,"filter"),Vt(Sr,"custom_metrics")],formatPanelConfig:()=>{var e;return[Yt(Sr),Object.assign(Object.assign({},Vt(Sr,"format")),{subSection:[null===(e=Sr.format_panel.format)||void 0===e?void 0:e.subSectionDefinition.time]}),Vt(Sr,"prefixes"),Object.assign(Object.assign({},Vt(Sr,"conditional_formatting")),{ruleType:"backgroundColor"})]},supportedCustomFields:{percentages:!1,simpleMaths:!0,rules:!0,aggregateMaths:!1,roundedNumbers:!0,dateCalculations:!1,conditional:!0},supportedFeatures:{parameters:!1,colorGradient:!0}}),Er=e=>(t,r)=>{let n=M(t,r,fe(e));return n=P(n),n},Or={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:""}}},xr=e=>({title:Or.title,description:Or.description,servicesClass:"HorizontalBarChart",namespace:Or.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:Lt(e.viewId),filter:d(e.filter),approxXAxisLabelCount:h(e.approxXAxisLabelCount),approxYAxisLabelCount:h(e.approxYAxisLabelCount),tags:null!==(t=e.tags)&&void 0!==t?t:[]})},setAttributes:Er(e),validate:(t,r)=>It(t,r,e.queryEngineConfig),init:(e,t)=>Object.assign({type:"horizontalBarChart",measure:[],dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",viewId:Lt(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:jt,schema:fe(e),removeField:(t,r)=>F(t,r,e.queryEngineConfig),isRunnable:e=>e.measure.length>0,autoGenerate(t){const{measure:r,dimension:n}=Et(t,e.queryEngineConfig,"horizontalBarChart");return this.init(t.id,{measure:[r[0]],dimension:n})},dataPanelConfig:()=>[Vt(Or,"data_set"),Vt(Or,"views"),Object.assign(Object.assign({},Vt(Or,"field_y_axis")),{fieldFilterOptions:{forComponent:"horizontalBarChart"},preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"}),Object.assign(Object.assign({},Vt(Or,"field_x_axis")),{fieldFilterOptions:{forComponent:"horizontalBarChart",onlyDimensions:!0},preventDuplicates:!0,preSetPartialAttributes:(e,t)=>$t(e,t),getValues:e=>zt(e),maxAllowed:2,testId:"add-dimension"}),Vt(Or,"sort"),Vt(Or,"filter"),Object.assign(Object.assign({},Vt(Or,"drilldown")),{options:{property:"drilldownOptions"}}),Vt(Or,"custom_metrics"),Vt(Or,"limit")],formatPanelConfig:()=>[Yt(Or),Wt(Or,!1,!0),Xt(Or),Object.assign(Object.assign({},Vt(Or,"conditional_formatting")),{ruleType:"backgroundColor"}),Vt(Or,"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 qt(e,t,this.setAttributes)}}),Cr=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:pe(e.queryEngineConfig),parameters:ie(e.queryEngineConfig,e.attributesSchemaOptions),goalLines:ae(),axisTitles:se(),headline:oe(),tags:z()})),Ir=e=>(t,r)=>{let n=M(t,r,Cr(e));return n=P(n),n},jr={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"}}},rich_text:{type:"richText",title:"Text format"},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:""}}},Rr=e=>({title:jr.title,description:jr.description,servicesClass:"AreaChart",namespace:jr.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:Lt(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:Qt(t.headline,t.timeDimension),tags:null!==(r=t.tags)&&void 0!==r?r:[]}},setAttributes:Ir(e),validate:(t,r)=>It(t,r,e.queryEngineConfig),init:(e,t)=>Object.assign({type:"areaChart",measure:[],displayTitle:"",dimension:[],timeDimension:null,displaySubject:"",viewId:Lt(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:jt,schema:Cr(e),removeField:(t,r)=>F(t,r,e.queryEngineConfig),isRunnable:e=>e.measure.length>0,autoGenerate(t){const{measure:r,dimension:n}=Et(t,e.queryEngineConfig,"areaChart");return this.init(t.id,{measure:[r[0]],dimension:n})},dataPanelConfig:()=>[Vt(jr,"data_set"),Vt(jr,"views"),Object.assign(Object.assign({},Vt(jr,"field_y_axis")),{fieldFilterOptions:{forComponent:"areaChart"},preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"}),Object.assign(Object.assign({},Vt(jr,"field_x_axis")),{fieldFilterOptions:{forComponent:"areaChart",onlyDimensions:!0},preventDuplicates:!0,preSetPartialAttributes:(e,t)=>$t(e,t),getValues:e=>zt(e),maxAllowed:2,testId:"add-dimension"}),Vt(jr,"sort"),Vt(jr,"filter"),Vt(jr,"custom_metrics"),Vt(jr,"limit")],formatPanelConfig:()=>{var e,t,r;return[Yt(jr),Object.assign(Object.assign({},Vt(jr,"chart_styles")),{subSection:[null===(e=jr.format_panel.chart_styles)||void 0===e?void 0:e.subSectionDefinition.stacked,null===(t=jr.format_panel.chart_styles)||void 0===t?void 0:t.subSectionDefinition.legend,null===(r=jr.format_panel.chart_styles)||void 0===r?void 0:r.subSectionDefinition.curve]}),Xt(jr),Object.assign(Object.assign({},Vt(jr,"conditional_formatting")),{ruleType:"areaColor"}),Vt(jr,"goal_line"),Vt(jr,"headline")]},supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0},supportedFeatures:{parameters:!0,colorGradient:!1}}),Dr=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:pe(e.queryEngineConfig),deltaTimeDimension:L().alternatives(U(e.queryEngineConfig.supportedTimeTruncFunctions),L().valid(null)),parameters:ie(e.queryEngineConfig,e.attributesSchemaOptions),tags:z()})),Fr=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)})},Pr={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"}}}}},Mr=e=>({title:Pr.title,description:Pr.description,servicesClass:"SingleStat",namespace:Pr.namespace,dump:e=>e,load:e=>{var t;const r=Fr(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:Lt(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)=>M(t,r,Dr(e)),validate:(t,r)=>It(t,r,e.queryEngineConfig),init:(e,t)=>Object.assign({type:"singleStat",measure:[],displayTitle:"",postfixes:{},prefixes:{},formatter:{},fontSize:"2rem",protectedByOrganisation:void 0,displaySubject:"",viewId:Lt(null==t?void 0:t.viewId),filter:[],dataSetId:e,limit:5e3,conditionalFormattingRules:[],deltaTimeDimension:null,parameters:{},tags:[]},t),schema:Dr(e),removeField:(t,r)=>F(t,r,e.queryEngineConfig),isRunnable:e=>e.measure.length>0,autoGenerate(t){const{measure:r}=Et(t,e.queryEngineConfig,"singleStat");return this.init(t.id,{measure:[r[0]]})},dataPanelConfig:()=>[Vt(Pr,"data_set"),Vt(Pr,"views"),Object.assign(Object.assign({},Vt(Pr,"field_metrics")),{fieldFilterOptions:{forComponent:"singleStat"},preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"}),Vt(Pr,"filter"),Vt(Pr,"custom_metrics"),Vt(Pr,"comparison")],formatPanelConfig:()=>{var e;return[Yt(Pr),Object.assign(Object.assign({},Vt(Pr,"stats_labels")),{prefix:Kt(Pr,"prefix"),postfix:Kt(Pr,"postfix"),format:Kt(Pr,"format"),count:Kt(Pr,"count")}),Object.assign(Object.assign({},Vt(Pr,"format")),{subSection:[null===(e=Pr.format_panel.format)||void 0===e?void 0:e.subSectionDefinition.font_size]}),Object.assign(Object.assign({},Vt(Pr,"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)(vt(r.fields,{onlyFieldTypes:["number"]}));return Object.assign(Object.assign({},e),{type:"singleStat",protectedByOrganisation:!0,measure:[...n].map((e=>({function:"none",field:e.id})))})}}),Nr=e=>L().object(Object.assign(Object.assign({},W(e.attributesSchemaOptions)),{type:L().valid("custom").required(),customViewId:L().string().required(),tags:z()})),Lr={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"}}}}},kr=e=>({title:Lr.title,description:Lr.description,namespace:Lr.namespace,servicesClass:"Custom",dump:e=>e,load:e=>{var t;return{type:"custom",viewId:Lt(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)=>M(t,r,Nr(e)),validate:(t,r)=>It(t,r,e.queryEngineConfig),init:(e,t)=>({type:"custom",viewId:Lt(null==t?void 0:t.viewId),customViewId:(null==t?void 0:t.customViewId)||"",dataSetId:e,displaySubject:"",displayTitle:"",tags:[],protectedByOrganisation:void 0}),schema:Nr(e),removeField:(e,t)=>e,isRunnable:()=>!0,autoGenerate(e){return this.init(e.id)},dataPanelConfig:()=>[Vt(Lr,"data_set"),Vt(Lr,"views")],formatPanelConfig:()=>[Yt(Lr)],supportedCustomFields:{percentages:!1,simpleMaths:!1,rules:!1,aggregateMaths:!1,roundedNumbers:!1,dateCalculations:!1,conditional:!1},supportedFeatures:{colorGradient:!1,parameters:!1}}),qr=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()})),$r=e=>(t,r)=>M(t,r,qr(e)),zr={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:zr.title,description:zr.description,servicesClass:"MercatorMap",namespace:zr.namespace,dump:e=>e,load:e=>{var t;return{dataSetId:e.dataSetId,displaySubject:e.displaySubject,displayTitle:e.displayTitle,protectedByOrganisation:e.protectedByOrganisation,viewId:Lt(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:$r(e),validate:()=>[],init:(e,t)=>Object.assign({type:"mercatorMap",dataSetId:e,dimension:[],measure:[],displaySubject:"",displayTitle:"",limit:5e3,filter:[],viewId:Lt(null==t?void 0:t.viewId),labelFormat:null,noDataColor:"#ffffff",backgroundColor:"#EFF5F6",maxValueColor:"#000000",minValueColor:"#e0e0e0",tags:[]},t),schema:qr(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:()=>[Vt(zr,"data_set"),Vt(zr,"views"),Object.assign(Object.assign({},Vt(zr,"field_metrics")),{type:"fieldCollector",fieldFilterOptions:{forComponent:"mercatorMap"},maxAllowed:1,preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"}),Object.assign(Object.assign({},Vt(zr,"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"}),Vt(zr,"filter"),Vt(zr,"custom_metrics"),Vt(zr,"limit")],formatPanelConfig:()=>{var e;return[Yt(zr),Object.assign(Object.assign({},Vt(zr,"chart_styles")),{subSection:[null===(e=zr.format_panel.chart_styles)||void 0===e?void 0:e.subSectionDefinition.number_format]}),Vt(zr,"map_colors")]},supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0},supportedFeatures:{parameters:!1,colorGradient:!1}}),Gr=e=>L().object(Object.assign(Object.assign(Object.assign({},W(e.attributesSchemaOptions)),Z(e.queryEngineConfig,e.attributesSchemaOptions)),{type:L().valid("richText").required(),tags:z(),content:L().any()})),Ur=e=>(t,r)=>M(t,r,Gr(e)),Vr={title:"Rich text",description:"Add your data to a rich text component.",namespace:"rich_text",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this rich text view?"},views:{type:"views",title:"View",description:""},field_metrics:{type:"fieldCollector",title:"Metrics",description:"What metrics do you need to collect?",callToAction:"Add metric"},field_grouping:{type:"fieldCollector",title:"Grouping",description:"How do you want to group your results?",callToAction:"Add grouping"},sort:{type:"sort",title:"Sort",description:"How should the results be ordered?"},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this text view."},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 use on this text view."}},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"}}},rich_text:{type:"richText",title:"Text format",description:""}}},Hr={type:"doc",content:[{type:"heading",attrs:{level:1},content:[{type:"text",text:"Rich text views"}]},{type:"paragraph",content:[{type:"text",text:"In this view, you can add any "},{type:"text",marks:[{type:"bold"}],text:"text based content"},{type:"text",text:" to your dashboard, and "},{type:"text",marks:[{type:"italic"}],text:"mix in your data with it!"}]},{type:"paragraph",content:[{type:"text",text:"Remember to use the "},{type:"text",marks:[{type:"bold"}],text:"format"},{type:"text",text:" "},{type:"text",marks:[{type:"bold"}],text:"tab"},{type:"text",text:" to "},{type:"text",marks:[{type:"underline"}],text:"style"},{type:"text",text:" your contents"}]},{type:"heading",attrs:{level:2},content:[{type:"text",text:"Adding data?"}]},{type:"paragraph",content:[{type:"text",text:"You can add data to your text content by using templating. For example, is how to take metrics "},{type:"text",marks:[{type:"code"}],text:'"Metric Name"'},{type:"text",text:" and "},{type:"text",marks:[{type:"code"}],text:'"A different metric name" '},{type:"text",text:"from the first row of the results, and show it on this view;"}]},{type:"codeBlock",attrs:{language:null},content:[{type:"text",text:"{{ data.first.metric_name }}\n{{ data.first.a_different_metric_name }}\n"}]}]},Yr=e=>({title:Vr.title,description:Vr.description,servicesClass:"RichText",namespace:Vr.namespace,dump:e=>e,load:e=>{var t;return{dataSetId:e.dataSetId,displaySubject:e.displaySubject,displayTitle:e.displayTitle,protectedByOrganisation:e.protectedByOrganisation,viewId:Lt(e.viewId),type:"richText",dimension:e.dimension,limit:e.limit,measure:f(e.measure),filter:d(e.filter),tags:null!==(t=e.tags)&&void 0!==t?t:[],content:e.content||"",order:e.order||[],timeDimension:e.timeDimension||null}},setAttributes:Ur(e),validate:()=>[],init:(e,t)=>Object.assign({type:"richText",dataSetId:e,dimension:[],measure:[],displaySubject:"",displayTitle:"",limit:5e3,filter:[],viewId:Lt(null==t?void 0:t.viewId),tags:[],order:[],timeDimension:null,content:Hr},t),schema:Gr(e),removeField:(e,t)=>e,isRunnable:e=>!(!e.measure||!e.measure[0]),autoGenerate(e){return this.init(e.id)},dataPanelConfig:()=>[Vt(Vr,"data_set"),Vt(Vr,"views"),Object.assign(Object.assign({},Vt(Vr,"field_metrics")),{fieldFilterOptions:{forComponent:"richText",onlyMeasures:!0},preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"}),Object.assign(Object.assign({},Vt(Vr,"field_grouping")),{fieldFilterOptions:{forComponent:"richText",onlyDimensions:!0},preventDuplicates:!0,preSetPartialAttributes:(e,t)=>$t(e,t),getValues:e=>zt(e),maxAllowed:2,testId:"add-dimension"}),Vt(Vr,"sort"),Vt(Vr,"filter"),Vt(Vr,"custom_metrics"),Vt(Vr,"limit")],formatPanelConfig:()=>[Yt(Vr),Object.assign({},Vt(Vr,"rich_text"))],supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0},supportedFeatures:{parameters:!1,colorGradient:!1}});var Xr;!function(e){e.Linear="linear",e.Circular="circular"}(Xr||(Xr={}));const Wr=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:pe(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(Xr.Linear,Xr.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()})),Kr={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:""}}},Qr=e=>({title:Kr.title,description:Kr.description,dump:e=>e,namespace:Kr.namespace,servicesClass:"Progress",load:e=>{var t;const r=Fr(e);return{type:"progress",measure:f(r.measure),displayTitle:r.displayTitle,displaySubject:r.displaySubject,protectedByOrganisation:r.protectedByOrganisation,viewId:Lt(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)=>M(t,r,Wr(e)),validate:(t,r)=>It(t,r,e.queryEngineConfig),init:(e,t)=>Object.assign({type:"progress",measure:[],displayTitle:"",protectedByOrganisation:void 0,displaySubject:"",viewId:Lt(null==t?void 0:t.viewId),filter:[],dataSetId:e,limit:5e3,conditionalFormattingRules:[],parameters:{},formatter:{},progressType:[],goals:[],postfixes:{},prefixes:{},tags:[]},t),schema:Wr(e),removeField:(t,r)=>F(t,r,e.queryEngineConfig),isRunnable:e=>e.measure.length>0,autoGenerate(e){return this.init(e.id)},dataPanelConfig:()=>[Vt(Kr,"data_set"),Vt(Kr,"views"),Vt(Kr,"progress_goals"),Vt(Kr,"filter"),Vt(Kr,"custom_metrics")],formatPanelConfig:()=>[Yt(Kr),Vt(Kr,"progress_type"),Object.assign(Object.assign({},Vt(Kr,"stats_labels")),{prefix:Kt(Kr,"prefix"),postfix:Kt(Kr,"postfix"),format:Kt(Kr,"format"),count:Kt(Kr,"count")})],supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,aggregateMaths:!0,rules:!0,roundedNumbers:!0,conditional:!0},supportedFeatures:{parameters:!1,colorGradient:!1}}),Zr=e=>(t,r)=>{let n=M(t,r,fe(e));return n=P(n),n},Jr={title:"Funnel chart",description:"Track conversion between stages of a process.",namespace:"funnel_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"},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:{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:""}}},en=e=>({title:Jr.title,description:Jr.description,servicesClass:"FunnelChart",namespace:Jr.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:Lt(e.viewId),filter:d(e.filter),approxXAxisLabelCount:h(e.approxXAxisLabelCount),approxYAxisLabelCount:h(e.approxYAxisLabelCount),tags:null!==(t=e.tags)&&void 0!==t?t:[]})},setAttributes:Zr(e),validate:(t,r)=>It(t,r,e.queryEngineConfig),init:(e,t)=>Object.assign({type:"funnelChart",measure:[],dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",viewId:Lt(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,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",axisTitles:void 0,tags:[]},t),createFeedback:jt,schema:fe(e),removeField:(t,r)=>F(t,r,e.queryEngineConfig),isRunnable:e=>e.measure.length>0,autoGenerate(t){const{measure:r,dimension:n}=Et(t,e.queryEngineConfig,"funnelChart");return this.init(t.id,{measure:[r[0]],dimension:n})},dataPanelConfig:()=>[Vt(Jr,"data_set"),Vt(Jr,"views"),Object.assign(Object.assign({},Vt(Jr,"field_y_axis")),{fieldFilterOptions:{forComponent:"funnelChart"},preSetPartialAttributes:e=>({measure:e}),allowsMultiple:!1,maxAllowed:1,getValues:e=>e.measure,testId:"metric-input"}),Object.assign(Object.assign({},Vt(Jr,"field_x_axis")),{fieldFilterOptions:{forComponent:"funnelChart",onlyDimensions:!0},allowsMultiple:!1,preventDuplicates:!0,preSetPartialAttributes:(e,t)=>$t(e,t),getValues:e=>zt(e),maxAllowed:1,testId:"add-dimension"}),Vt(Jr,"sort"),Vt(Jr,"filter"),Vt(Jr,"custom_metrics"),Vt(Jr,"limit")],formatPanelConfig:()=>[Yt(Jr),Wt(Jr,!1,!1),Xt(Jr),Object.assign(Object.assign({},Vt(Jr,"conditional_formatting")),{ruleType:"backgroundColor"}),Vt(Jr,"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 qt(e,t,this.setAttributes)}}),tn=["title","description","data_panel","format_panel"],rn=["title","description","callToAction"],nn="call_to_action",an=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}}"}),on=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,sn=/<style\b[^<]*(?:(?!<\/style>)<[^<]*)*<\/style>/gi,ln=/on[a-z]+\s*=\s*["'][^"']*["']/gi,un=/javascript:[^\s"']+/gi,cn=new RegExp(`^(?:${/<(b|strong)>(?:(?!<\/(b|strong)>).)*<\/(b|strong)>/.source}|${/<(i|em)>(?:(?!<\/(i|em)>).)*<\/(i|em)>/.source}|[^*_<>])*$`,"m"),dn=e=>{if(on.test(e)||sn.test(e)||ln.test(e)||un.test(e))throw new Error("Invalid content: potentially malicious elements detected.");return cn.test(e)},pn=(e,t,r,n)=>fn(e,t,r,void 0,n),fn=(e,t,r,n,i)=>{if(i)return`[key: ${e}]`;const a=n?function(e,t){const r=e[t],n=an.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 dn(r);if("object"==typeof r)return dn(r.sentence);if(void 0===r)return!0;throw new Error("Invalid translation type")})()?r:void 0}(n,e):void 0;let o;return o="object"==typeof a&&null!==a?a.sentence:"string"==typeof a?a:t,o=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""}))}(o,r),r&&(o=function(e,t,r){return Object.entries(t).forEach((([t,n])=>{if(n&&"object"==typeof n&&"count"in n){const i=n,a=1===i.count?r&&r[`${t}_singular`]||i.singular:r&&r[`${t}_plural`]||i.plural;e=e.replace(new RegExp(`{{${t}}}`,"g"),a)}})),e}(o,r,a)),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}(o,r)},hn=(e,t)=>{const r=null!=t?t:fn;let n=e;const i=e.namespace;return tn.forEach((t=>{if("title"===t||"description"===t){const a=r(`${i}.${t}`,e[t]);n=Object.assign(Object.assign({},n),{[t]:a})}if("data_panel"===t){const a=`${i}.${t}`,o=[];e.dataPanelConfig().forEach((e=>{e.subSection&&(e.subSection=gn(e,r,a)),yn(e).forEach((t=>{const n=r(`${a}.${t.key}`,t.defaultValue);e[t.property]=n})),o.push(e)})),n=Object.assign(Object.assign({},n),{dataPanelConfig:()=>o})}if("format_panel"===t){const a=`${i}.${t}`,o=[];e.formatPanelConfig().forEach((e=>{e.subSection&&(e.subSection=gn(e,r,a)),function(e,t,r){function n(r,n){r&&yn(r).forEach((i=>{const a=e(`${t}.${n}.${i.key}`,i.defaultValue);r[i.property]=a}))}function i(e,t,r){t.forEach((t=>{const i=e[t];i&&n(i,r)}))}r.x&&(i(r.x,mn,"axis_labels"),n(r.x,"axis_labels")),r.y&&(i(r.y,mn,"axis_labels"),n(r.y,"axis_labels")),function(e){return"prefix"in e}(r)&&i(r,mn,"stats_labels")}(r,a,e),yn(e).forEach((t=>{const n=r(`${a}.${t.key}`,t.defaultValue);e[t.property]=n})),o.push(e)})),n=Object.assign(Object.assign({},n),{formatPanelConfig:()=>o})}})),n},mn=["count","axisTitle","format","postfix","prefix"];function gn(e,t,r){var n;return null===(n=e.subSection)||void 0===n?void 0:n.map((n=>(yn(n).forEach((i=>{const a=t(`${r}.${e.namespace}.${i.key}`,i.defaultValue);n[i.property]=a})),n)))}function yn(e){const t=e.namespace||e.type;if(!t)return[];const r=[];return rn.forEach((n=>{if(e[n]){let i=n;"callToAction"===n&&(i=nn),r.push({key:`${t}.${i}`,defaultValue:e[n],property:n})}})),r}const bn={queryEngineConfig:{supportedFeatures:[],supportedAggregates:{},supportedTimeTruncFunctions:{},supportedOperators:{},supportedTransformationFunctions:{}}},vn=function(e,t){if("areaChart"==e)return hn(Rr(t||bn),null==t?void 0:t.textOverride);if("barChart"==e)return hn(Zt(t||bn),null==t?void 0:t.textOverride);if("basicTable"==e)return hn(Tr(t||bn),null==t?void 0:t.textOverride);if("comboChart"==e)return hn(fr(t||bn),null==t?void 0:t.textOverride);if("custom"==e)return hn(kr(t||bn),null==t?void 0:t.textOverride);if("dataTable"==e)return hn(vr(t||bn),null==t?void 0:t.textOverride);if("funnelChart"==e)return hn(en(t||bn),null==t?void 0:t.textOverride);if("richText"==e)return hn(Yr(t||bn),null==t?void 0:t.textOverride);if("horizontalBarChart"==e)return hn(xr(t||bn),null==t?void 0:t.textOverride);if("lineChart"==e)return hn(rr(t||bn),null==t?void 0:t.textOverride);if("mercatorMap"==e)return hn(Br(t||bn),null==t?void 0:t.textOverride);if("pieChart"==e)return hn(ar(t||bn),null==t?void 0:t.textOverride);if("progress"==e)return hn(Qr(t||bn),null==t?void 0:t.textOverride);if("scatterChart"==e)return hn(ur(t||bn),null==t?void 0:t.textOverride);if("singleStat"==e)return hn(Mr(t||bn),null==t?void 0:t.textOverride);throw`Cannot get interface for ${e}. Please implement it.`};["barChart","horizontalBarChart","funnelChart","areaChart","lineChart","scatterChart","pieChart","singleStat","dataTable","basicTable","comboChart","mercatorMap","progress","richText","custom"].filter((e=>"custom"!=e)),r(8143);const _n=350,An={colors:["#feae4a","#5fbaff","#e15e9d"],detail:"minimal",fontFamily:"Inter, sans-serif",rowLimit:6,fontSize:"0.65rem"},wn=e=>"displayTitle"in e,Sn=e=>({colSpan:e,isEmpty:!0}),Tn=e=>"isEmpty"in e,En=e=>{const r=[...e],n=(0,t.sumBy)(r,(e=>e.colSpan));return 12==n||(r[r.length-1].colSpan+=12-n),r},On=e=>!(e&&Tn(e)&&e.colSpan<=0),xn=(e,r)=>e.map((e=>((e,r)=>{const n=(e=>"components"in e?e:{components:e,height:_n})(e),i=n.components.filter(On).map((e=>e&&e.colSpan<=0?Object.assign(Object.assign({},e),{colSpan:1}):e)),a=(0,t.sumBy)(i,(e=>null==e?1:0)),o=12-(0,t.sumBy)(i,(e=>null==e?0:e.colSpan)),s=Math.floor(o/a),l=[...i].map((e=>null===e?{isEmpty:!0,colSpan:s}:Tn(e)||wn(e)?e:Cn(Object.assign(Object.assign({},e),{colSpan:e.colSpan}),r)));return{components:En(l),height:n.height||_n}})(e,r))),Cn=(e,r)=>{if("isEmpty"in e||wn(e))return e;const{load:n}=vn(e.attributes.type,r),i=n(e.attributes);let a=[];return(0,t.isArray)(e.localFilters)&&(a=[...e.localFilters?e.localFilters:[]].map((e=>Ke(e)))),"addOns"in e.attributes&&(0,t.isEmpty)(a)&&e.attributes.addOns.forEach((e=>{a=[...a,{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:a,attributes:i,results:[]})},In=e=>L().alternatives().conditional(".type",{is:"barChart",then:Zt(e).schema}).conditional(".type",{is:"richText",then:Yr(e).schema}).conditional(".type",{is:"mercatorMap",then:Br(e).schema}).conditional(".type",{is:"horizontalBarChart",then:xr(e).schema}).conditional(".type",{is:"lineChart",then:rr(e).schema}).conditional(".type",{is:"comboChart",then:fr(e).schema}).conditional(".type",{is:"areaChart",then:Rr(e).schema}).conditional(".type",{is:"pieChart",then:ar(e).schema}).conditional(".type",{is:"scatterChart",then:ur(e).schema}).conditional(".type",{is:"singleStat",then:Mr(e).schema}).conditional(".type",{is:"dataTable",then:vr(e).schema}).conditional(".type",{is:"basicTable",then:Tr(e).schema}).conditional(".type",{is:"progress",then:Qr(e).schema}).conditional(".type",{is:"custom",then:kr(e).schema}).conditional(".type",{is:"funnelChart",then:en(e).schema}),jn=L().object({displayTitle:L().string().min(1).required(),colSpan:L().number().valid(12).required()}),Rn=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'}),Dn=L().object({isEmpty:L().valid(!0).required(),colSpan:Rn}),Fn=e=>L().object({attributes:In({queryEngineConfig:e}),colSpan:Rn}),Pn=e=>L().object({id:L().string(),display:Mn(e),componentLibrary:L().array().required().items(L().object({attributes:In({queryEngineConfig:e})})),globalFilters:ht(e),customFields:L().object().required()});function Mn(e){return L().array().required().items(L().object({height:L().number().required(),components:L().array().required().min(1).items(L().alternatives(Dn,Fn(e),jn))}))}const Nn=(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=>Ke(e))),componentLibrary:[...e.definition.componentLibrary||[]].map((e=>Cn(Object.assign(Object.assign({},e),{colSpan:(null==e?void 0:e.colSpan)||1}),r))),theme:Object.assign(Object.assign({},An),e.theme),display:xn(e.definition.display,r),webhookId:e.webhook_id||null,createdAt:new Date(e.created_at),updatedAt:new Date(e.updated_at),metadata:e.metadata||{}}},Ln=(e,t,r)=>Object.assign(Object.assign({},e),{dataSets:Ot(t,r)});const kn=(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 qn(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 $n=e=>{e.library.views=[],e.library.customFields={}};class zn extends Error{constructor(e){super(e),this.name="FailedToLoadQueryEngineConfig"}}const Bn=zn;class Gn extends Error{constructor(e){super(`The queryEngineEndpoint value '${e}' is not valid.`),this.name="InvalidQueryEngineEndpoint",this.invalidEndpoint=e}}const Un=Gn;class Vn 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 Hn=Vn;var Yn=r(288),Xn=r.n(Yn);const Wn=e=>e.startsWith("/")?Wn(e.slice(1)):e.endsWith("/")?Wn(e.slice(0,-1)):e;var Kn=function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(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(o,s)}l((n=n.apply(e,t||[])).next())}))};const Qn=(e,t)=>Kn(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,a=void 0,s=function*(){let i={};r&&(i.auth=`Bearer ${r}`);let a="";n&&(a=`filter=${n.join(",")}`);const{status:o,body:s}=yield e({path:`/api/v2/auth/project/${t}/access_token?${a}`,method:"get",headers:i});if(200==o)return s.token.token},new((o=void 0)||(o=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 o?i:new o((function(e){e(i)}))).then(r,n)}l((s=s.apply(i,a||[])).next())}));var i,a,o,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=>Kn(void 0,void 0,void 0,(function*(){var r;try{const r=yield Qn(e,t),n=t.headers||{},i=((e,t)=>{const r=Wn(e),n=Wn(t),i=(a=e).startsWith("https://")||a.startsWith("http://")||a.startsWith(".")?"":"/";var a;return""==r&&""==n?"/":""==n?`${i}${r}`:""!=r&&""!=n?`${i}${r}/${n}`:`${i}${n}`})(e.host,t.path),a=yield Xn()(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 o=yield a.json();return w("HTTP Client Response",{host:e.host,path:t.path,status:a.status,responseId:a.headers.get("X-Request-Id")}),{body:o,status:a.status,headers:a.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}})),Jn=e=>"string"==typeof e?e:e.endpoint;const ei=e=>"string"==typeof e?{}:e.customHeaders?e.customHeaders():{},ti=e=>t=>{return r=void 0,n=void 0,a=function*(){const r={host:Jn(e)},n=Object.assign(Object.assign({},t),{headers:Object.assign(Object.assign({},t.headers),ei(e))});return Zn(r)(n)},new((i=void 0)||(i=Promise))((function(e,t){function o(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 r;t.done?e(t.value):(r=t.value,r instanceof i?r:new i((function(e){e(r)}))).then(o,s)}l((a=a.apply(r,n||[])).next())}));var r,n,i,a};const ri=e=>{return t=void 0,r=void 0,i=function*(){const t=ti(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,a){function o(e){try{l(i.next(e))}catch(e){a(e)}}function s(e){try{l(i.throw(e))}catch(e){a(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(o,s)}l((i=i.apply(t,r||[])).next())}));var t,r,n,i},ni=a.QueryEngineConfig.getQueryEngineConfig("js");const ii=e=>{let t="string"==typeof e?e:e.endpoint;return!!t.startsWith("http://")||!!t.startsWith("https://")||!!t.startsWith("/")};class ai extends Error{constructor(e){super(e),this.name="FailedToLoadIdentity"}}const oi=ai;class si extends Error{constructor(e){super(e),this.name="InvalidIdentityReturn"}}const li=si,ui=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 ci=e=>{return t=void 0,r=void 0,i=function*(){let t=yield e();if(t=(e=>{if(!e)throw new li("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 li(t.message);return e})(t),!t)throw new oi("Failed to fetch identity config.");const r=di()&&((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=ui(e);"scope"in i||(i.scope="read_write");const a={dashboardAccess:i,dataAccess:t?ui(t):void 0,queryEngineAccessConfig:r?ui(r):void 0,dashboardAdminOverride:n?ui(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)})(a),a})(t.dashboardAccessToken,t.dataAccessToken,t.queryEngineAccessToken,r),tokens:t}},new((n=void 0)||(n=Promise))((function(e,a){function o(e){try{l(i.next(e))}catch(e){a(e)}}function s(e){try{l(i.throw(e))}catch(e){a(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(o,s)}l((i=i.apply(t,r||[])).next())}));var t,r,n,i},di=()=>"undefined"!=typeof window,pi=[{namespace:"config.supported_operator",constants:l},{namespace:"config.supported_aggregate",constants:g},{namespace:"config.supported_time",constants:o}],fi=(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 hi extends Error{constructor(){super("Identity prop type is invalid."),this.name="InvalidIdentityPropType"}}const mi=hi;class gi extends Error{constructor(e){super(e),this.name="FailedToResolveDataSets"}}const yi=gi;class bi extends Error{constructor(){super("dataSets property is not valid"),this.name="InvalidDataSetsPropType"}}const vi=bi;var _i=function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(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(o,s)}l((n=n.apply(e,t||[])).next())}))};L().function();const Ai=e=>t=>_i(void 0,void 0,void 0,(function*(){var r,n,i,a,o,s,l;return yield(n=e,i=null===(r=t.dataAccess)||void 0===r?void 0:r.signature,a=void 0,o=void 0,s=void 0,l=function*(){const e=ti(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 yi(`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(a,o||[])).next())})))})),wi=(t,r)=>(n,i)=>_i(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 Ai(t);throw new vi})(t,r);if("function"!=typeof e)throw new vi;let a=yield e(n,i);if(!a)throw new yi("Failed to fetch data sets from the query engine endpoint");return a.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 vi)throw t;if(t instanceof e.Errors.FailedToResolveDataSets)throw new yi(t.message);throw new yi("Failed to fetch data sets.")}}));var Si=function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(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(o,s)}l((n=n.apply(e,t||[])).next())}))};const Ti={apiHost:"https://api.vizzly.co"},Ei="in-browser";class Oi{constructor(e,t,r,n=Ti){this.queryEngineConfig=void 0,this.dataSets=void 0,this.queryEngine=e||Ei,this.loadAccessTokens=t,this.loadDataSetsCallback=r,this.options=Object.assign(Object.assign({},Ti),n)}getQueryEngineConfig(){return Si(this,void 0,void 0,(function*(){return this.queryEngineConfig||(this.queryEngineConfig=yield(e=this.queryEngine,t=this.loadDataSetsCallback,r=void 0,n=void 0,a=function*(){try{if("in-browser"===e)return ni;if("function"==typeof e){let t=yield e();if(!t)throw new Bn("Failed to load query engine config.");return Object.assign({},t)}if(t){if(!ii(e))throw new Un(e);return ni}if("string"==typeof e||"object"==typeof e&&"endpoint"in e){if(!ii(e))throw new Un(e);const t=yield ri(e);if(!t)throw new Bn("Failed to load query engine config.");return t}throw new Hn}catch(e){if(T(e),e instanceof Un)throw e;if(e instanceof Hn)throw e;throw new Bn("Failed to load query engine config.")}},new((i=void 0)||(i=Promise))((function(e,t){function o(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 r;t.done?e(t.value):(r=t.value,r instanceof i?r:new i((function(e){e(r)}))).then(o,s)}l((a=a.apply(r,n||[])).next())}))),this.queryEngineConfig=((e,t)=>{const r=Object.assign({},e);return r.supportedAggregates&&(r.supportedAggregates=fi(r.supportedAggregates,t,pi[1].namespace)),r.supportedTimeTruncFunctions&&(r.supportedTimeTruncFunctions=fi(r.supportedTimeTruncFunctions,t,pi[2].namespace)),r.supportedOperators&&(r.supportedOperators=fi(r.supportedOperators,t,pi[0].namespace)),r})(this.queryEngineConfig,((e,t,r)=>fn(e,t,r,this.options.textOverrides,this.options.developerMode)))),this.queryEngineConfig;var e,t,r,n,i,a}))}getIdentity(){return Si(this,void 0,void 0,(function*(){if("function"!=typeof this.loadAccessTokens)throw new mi;const{tokens:e,identityConfig:t}=yield ci(this.loadAccessTokens);return{accessTokens:e,identityConfig:t}}))}getDataSets(){return Si(this,void 0,void 0,(function*(){const{identityConfig:e}=yield this.getIdentity(),t=yield this.getQueryEngineConfig(),r=wi(this.loadDataSetsCallback,this.queryEngine);return this.dataSets=yield r(e,t),this.dataSets}))}load(){return Si(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!==Ei?{strategy:"queryEngine",endpoint:this.queryEngine}:{strategy:"vizzlyApi"}}}function xi(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=ft(t,!!e.requiresValue),{error:i,value:a}=n.validate(e);if(i)throw T(`Invalid global filter configuration: ${i.message}`),i;r.push(a)})),r})(e,t);return r}class Ci extends Error{}class Ii extends ge{constructor(e,t){super(`'Issue with Services in ${t}: '${e}'`),this.name="ServicesValidation"}}class ji{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=Sn(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=xi(e.localFilters,ka.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=xi(e.localFilters,ka.use().getViewConfiguration().queryEngineConfig))}setColSpan(e){try{!function(e){const{error:t,value:r}=Rn.validate(e);if(t)throw new Ci(t.message)}(e),this.colSpan=e}catch(e){throw new Ii(e,"Cell.setColSpan")}}setComponent(e){this.component=e,this.isEmpty=void 0}emptyCell(e){const t=Sn(null!=e?e:12);this.colSpan=t.colSpan,this.isEmpty=t.isEmpty,this.component=void 0}}class Ri{constructor(e,t){this.components=[],this.height=_n,this.components=null!=e?e:[],this.height=null!=t?t:_n,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:_n,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 Di{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:_n};this.component=[r]}setTitle(e){if(!this.component)throw new Error("Header is undefined");wn(this.component[0].components[0])&&(this.component[0].components[0].displayTitle=e)}}function Fi(e){let t=[];return e.forEach((e=>{var r,n;if(e instanceof Ri){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:_n,components:n})}e instanceof Di&&(null===(n=e.component)||void 0===n||n.forEach((e=>{t.push({height:e.height,components:e.components})})))})),t}const Pi=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 Mi(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 Ci(r.message)}const Ni=(e,t)=>Object.assign(Object.assign({},e),{attributes:Object.assign(Object.assign({},e.attributes),{viewId:t})});class Li{constructor(e){this.vizzly=ka.use();const{init:t}=vn(e.type,{queryEngineConfig:this.vizzly.getViewConfiguration().queryEngineConfig});this.attributes=t(null==e?void 0:e.dataSetId,e)}updateAttributes(e){const{setAttributes:t}=vn(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 ki 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 qi 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 $i={convert:!1,stripUnknown:!1,allowUnknown:!0},zi=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())),Bi={convert:!1,stripUnknown:!1,allowUnknown:!0};var Gi;!function(e){e.SAVING="saving",e.SAVED="saved",e.DELETED="deleted"}(Gi||(Gi={}));const Ui=(e,t)=>e.map((e=>e.map((({field:e,functionId:t})=>({id:I({field:e.id,function:t}),publicName:e.publicName,dataType:e.dataType}))))),Vi=(e,t,r)=>{const n=t.map((t=>{const n=_t(e,t.dataSetId);if(!n)throw"Data set not found for query attributes query";return Me(n,t.measure,t.order,t.filter,t.dimension,t.timeDimension,t.limit,t.offset,r)}));return{queries:n.map((e=>e.query)),resultFields:Ui([...n].map((e=>e.measureDescription)))}};function Hi(e,t){let r=e.optionsFilters?e.optionsFilters[t.dataSetId]:[];return null==r?void 0:r.filter((e=>e.field!==t.fieldId))}const Yi=(e,t,r,n)=>{const{query:i,measureDescription:a}=mt(t,e.measure,e.order,je(e.filter,r),e.dimension,e.timeDimension||null,e.limit,e.offset,n);return{queries:[i],resultFields:Ui([a])}},Xi=Yi,Wi=Yi,Ki=Yi,Qi=Yi,Zi=Yi,Ji=Yi,ea=Yi,ta=(e,t,r,n)=>{const{queries:i,measureDescription:a}=((e,t,r,n)=>{const i=((e,t,r,n)=>{let{query:i,measureDescription:a}=mt(r,e.measure,[],je(e.filter,t),[],null,1,e.offset,n);return i.measure=[{type:"number",value:0},...i.measure],a=[{field:{id:"single-stat-bumper-field",canBeDimension:!1,canBeMeasure:!1,publicName:"",dataType:"number",allowedOperators:[]},functionId:"none"},...a],{query:i,measureDescription:a}})(e,n,t,r);let a=null;return"deltaTimeDimension"in e&&(a=((e,t,r,n)=>t.deltaTimeDimension?mt(e,t.measure,[{field:t.deltaTimeDimension.field,direction:"asc",function:t.deltaTimeDimension.truncate}],je(t.filter,r),[],t.deltaTimeDimension,t.limit,t.offset,n):null)(t,e,n,r)),{queries:a?[i.query,a.query]:[i.query],measureDescription:a?[i.measureDescription,a.measureDescription]:[i.measureDescription]}})(e,t,n,r);return{queries:i,resultFields:Ui(a)}},ra=Yi,na=Yi,ia=(e,t,r,n)=>{switch(e.type){case"areaChart":return Xi(e,t,r,n);case"barChart":return Wi(e,t,r,n);case"horizontalBarChart":return Ki(e,t,r,n);case"lineChart":return Qi(e,t,r,n);case"pieChart":return Zi(e,t,r,n);case"dataTable":return Ji(e,t,r,n);case"basicTable":return ea(e,t,r,n);case"comboChart":return((e,t,r,n)=>{const{line:i,bar:a}=((e,t,r,n)=>{let i=mt(t,e.lineMeasure,e.order,je(e.filter,n),e.lineDimension,e.timeDimension,e.limit,e.offset,r);return{bar:mt(t,e.barMeasure,e.order,je(e.filter,n),e.barDimension,e.timeDimension,e.limit,e.offset,r),line:i}})(e,t,n,r);return{queries:[i.query,a.query],resultFields:Ui([i.measureDescription,a.measureDescription])}})(e,t,r,n);case"singleStat":case"progress":return ta(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:a,measureDescription:o}=mt(t,i,e.order,je(e.filter,r),e.dimension,e.timeDimension,e.limit,e.offset,n);return{queries:[a],resultFields:Ui([o])}})(e,t,r,n);case"mercatorMap":return((e,t,r,n)=>Vi([t],[{measure:e.measure,dataSetId:t.id,dimension:e.dimension,limit:e.limit,filter:je(e.filter,r),order:[],timeDimension:null}],n))(e,t,r,n);case"funnelChart":return ra(e,t,r,n);case"richText":return na(e,t,r,n);default:throw"Unsupported."}},aa=(e,t,r)=>{let n=[],i=[];if(Array.isArray(e)&&"type"in e[0]&&"preparedQuery"==e[0].type&&"preAggregated"==e[0].preparedQueryType){const a=_t(r.dataSets,e[0].dataSetId);if(!a)throw"Data set not found for pre aggregated query";const[o]=a.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],a),u=_t(r.dataSets,o),c=Je(r.filterConfig,u,r.timeRangeOptions),d=Re([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=_t(r.dataSets,e[0].dataSetId);if(!t)throw"Data set not found for view attributes query";const a=At(t,e[0].fieldId),{query:o,resultFields:s}=yt(e[0].dataSetId,a);n=[o],i=[s]}else if(Array.isArray(e)){let a=[...e].map((e=>{const t=_t(r.dataSets,e.dataSetId);if(!t)throw"Data set not found for query-attributes query";const n=Je(r.filterConfig,t,r.timeRangeOptions);return Object.assign(Object.assign({},e),{filter:je(e.filter,n)})}));const{queries:o,resultFields:s}=Vi(r.dataSets,a,t);n=o,i=s}else if("type"in e&&("order"in e||"measure"in e)){const a=_t(r.dataSets,e.dataSetId);if(!a)throw"Data set not found for view attributes query";const o=Je(r.filterConfig,a,r.timeRangeOptions);let{queries:s,resultFields:l}=ia(e,a,o,t);n=s,i=l}else if("custom"!=e.type){let{queries:a,resultFields:o}=((e,t,r)=>{let n=[...e.appliesToFields].map((n=>{const i=_t(t,n.dataSetId);if(!i)throw"Data set not found for additional filter query";const a=At(i,n.fieldId);if("string[]"==a.dataType){const t=Re([Hi(e,n)],r,i),{query:o,resultFields:s}=yt(n.dataSetId,a,t);return{queries:[o],resultFields:[s]}}{const a=((e,t,r)=>{let n=[{field:t,function:"count"}],i=r?[r]:[],a=[{field:t,function:"none"}];return{dataSetId:e.id,measure:n,order:[],filter:i,dimension:a,timeDimension:null,limit:5e3,offset:0}})(i,n.fieldId,Hi(e,n));return Vi(t,[a],r)}}));return{queries:n.flatMap((e=>e.queries)),resultFields:n.flatMap((e=>e.resultFields))}})(e,r.dataSets,t);n=a,i=o}return r.timeZone&&(n=n.map((e=>Object.assign(Object.assign({},e),{timeZone:r.timeZone})))),{queries:n,resultFields:i}};let oa={};const sa=e=>Array.isArray(e)?0==e.length:"object"==typeof e&&sa(Object.keys(e)),la=(e,t,r,n)=>{return i=void 0,a=void 0,s=function*(){let i={};e.forEach(((e,t)=>{const r=(e=>{const t=JSON.stringify(e),r=oa[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 oa[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 a=e.filter(((e,r)=>t(e)&&void 0===i[r]));let o=[];return sa(a)||(o=yield r(a)),null===o||sa(o)&&sa(i)?null:[...e].map(((e,r)=>{let a=i[r];if(t(e)&&null==a&&(a=(null==o?void 0:o.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),oa[n]={item:t,expires:i}})(n(e),a)),void 0===a)throw"A result went missing...";return a}))},new((o=void 0)||(o=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 o?i:new o((function(e){e(i)}))).then(r,n)}l((s=s.apply(i,a||[])).next())}));var i,a,o,s};var ua=function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(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(o,s)}l((n=n.apply(e,t||[])).next())}))};const ca=(e,t,r)=>ua(void 0,void 0,void 0,(function*(){const{queries:n,resultFields:i}=aa(t,e.queryEngineConfig,r),a=yield la(n,(e=>!0),(t=>ua(void 0,void 0,void 0,(function*(){return yield((e,t,r,n)=>{return i=void 0,a=void 0,s=function*(){const i=ti(t),{status:a,body:o}=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==a?o:null},new((o=void 0)||(o=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 o?i:new o((function(e){e(i)}))).then(r,n)}l((s=s.apply(i,a||[])).next())}));var i,a,o,s})(t,e.queryEngineEndpoint,e.dataAccessToken,r.abortSignal)}))),(t=>({query:t,cacheKeyNamespace:e.cacheKeyNamespace})));return[...n].map(((e,t)=>{if(null===a)return null;const r=a[t];return void 0===r?null:{content:r,fields:i[t]}}))}));var da=r(7331),pa=r.n(da);let fa={};const ha=[];let ma={};class ga extends Error{constructor(e){super(e),this.name="MissingVizzlyInMemoryDb"}}const ya=ga,ba=()=>{const e=window.VizzlyInMemoryDb;if(!e)throw new ya("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.19/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 va=(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:_a(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},_a=(e,t)=>{if("subquery"==e.type)return{type:"subquery",value:{select:[_a(e.value.measure[0],t)],where:va(e.value.filter,t),join:[]}};if("maths"==e.type)return{type:"maths",left:_a(e.left,t),right:_a(e.right,t),op:e.op};if("date_maths"==e.type)return{type:"date_maths",left:_a(e.left,t),right:_a(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:_a(e.value,t)};if("switchField"==e.type)return{type:"case",value:{cases:e.value.cases.map((e=>({result:_a(e.returns,t),where:va(e.filter,t)})))}};if("field"==e.type&&"none"!=e.function){const r=At(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=At(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 Aa=function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(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(o,s)}l((n=n.apply(e,t||[])).next())}))};const wa=(e,t)=>`${e}::${t}`,Sa=(e,t,r)=>Aa(void 0,void 0,void 0,(function*(){const n=[...e].map((e=>Aa(void 0,void 0,void 0,(function*(){const[n]=wt(t,e.dataSetId),i=wa(r,e.dataSetId);if(fa[i]&&n){const t=yield((e,t)=>{return r=void 0,n=void 0,a=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=>_a(e,t))),where:va(e.filter,t),order:e.order,group:e.group,join:[],limit:e.limit||5e3,offset:e.offset||0,from:["_",e.dataSetId]},a=yield ba().query(i);return(null===(n=null==a?void 0:a[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:va(e.filter,t),join:[]},n=yield ba().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 o(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 r;t.done?e(t.value):(r=t.value,r instanceof i?r:new i((function(e){e(r)}))).then(o,s)}l((a=a.apply(r,n||[])).next())}));var r,n,i,a})(e,n);return t}return console.warn("Returning an empty result."),[]}))));return yield Promise.all(n)})),Ta=(e,t,r,n)=>Aa(void 0,void 0,void 0,(function*(){return yield ba().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=>Aa(void 0,void 0,void 0,(function*(){const[i]=wt(t,e.dataSetId);if(i){const t=yield((e,t,r)=>{return n=void 0,i=void 0,o=function*(){ma[e.id]||(ma[e.id]=pa()(t,5e3,{leading:!0}));let n=ma[e.id];if(w("Fetching data for in-browser query engine. DataSet;",e.id,"CacheKey;",r),fa[r])return w("Returning data for in-browser query engine from the cache."),fa[r];{const t=yield n(e);return t||ha.includes(e.id)||(ha.push(e.id),console.error(`Failed to download data for data set ${e.id}`)),t&&n.cancel(),w(`Data from cacheKey: ${r}`,t),fa[r]=t,t}},new((a=void 0)||(a=Promise))((function(e,t){function r(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 n;t.done?e(t.value):(n=t.value,n instanceof a?n:new a((function(e){e(n)}))).then(r,s)}l((o=o.apply(n,i||[])).next())}));var n,i,a,o})(i,r,wa(n,e.dataSetId)),a={id:null==i?void 0:i.id,fields:null==i?void 0:i.fields.map((e=>({id:e.id,dataType:e.dataType})))};yield ba().ingest(a,t||[])}return[]}))))),yield Sa(e,t,n)}));var Ea=function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(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(o,s)}l((n=n.apply(e,t||[])).next())}))},Oa=function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(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(o,s)}l((n=n.apply(e,t||[])).next())}))};function xa(e,t,r){return n=this,i=void 0,o=function*(){return"vizzlyQueryEngine"==e.type?yield ca(e,t,r):"vizzlyJsQueryEngine"==e.type?yield((e,t,r)=>Ea(void 0,void 0,void 0,(function*(){const{queries:n,resultFields:i}=aa(t,ni,r);let a=yield la(n,(e=>!0),(t=>Ea(void 0,void 0,void 0,(function*(){return yield Ta(t,r.dataSets,e.loadData,e.cacheKeyNamespace)}))),(t=>({query:t,cacheKeyNamespace:e.cacheKeyNamespace})));return null===a&&(a=n.map((()=>null))),[...n].map(((e,t)=>{if(null===a)return null;const r=a[t];return void 0===r?null:{content:r,fields:i[t]}}))})))(e,t,r):"custom"==e.type?yield((e,t,r)=>Oa(void 0,void 0,void 0,(function*(){const{queries:n,resultFields:i}=aa(t,e.queryEngineConfig,r),a=yield la(n,(e=>("preparedQuery"==e.type&&S("Custom query engine does not support prepared queries."),"query"==e.type)),(t=>Oa(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===a?n.map((()=>null)):a})))(e,t,r):[]},new((a=void 0)||(a=Promise))((function(e,t){function r(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 n;t.done?e(t.value):(n=t.value,n instanceof a?n:new a((function(e){e(n)}))).then(r,s)}l((o=o.apply(n,i||[])).next())}));var n,i,a,o}var Ca=function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(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(o,s)}l((n=n.apply(e,t||[])).next())}))};const Ia=(e,t)=>{const r=new Date(e.getTime()-24*t*60*60*1e3);return new Date(r.getFullYear(),r.getMonth(),r.getDate())},ja=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()),Ra={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},Da=(e,t)=>{const r=ja(e),n=new Date(r);return n.setDate(n.getDate()+1),n.setMilliseconds(n.getMilliseconds()-1),{description:t,range:{before:n,after:r}}},Fa=(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 Pa=function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(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(o,s)}l((n=n.apply(e,t||[])).next())}))};const Ma="default";e.VizzlyApiClientLogger.UserAgentProduct="Services";const Na=Object.assign({},{apiHost:"https://api.vizzly.co"});class La{constructor(t,r,n,i,a,o){this.programmaticDashboard=a,this.dataSets=n,this.queryEngineConfig=r,this.identityConfig=t,this.vizzlyAPIClient=((t,r,n)=>{var i,a,o;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===(a=null==t?void 0:t.dashboardAdminOverride)||void 0===a?void 0:a.signature,queryEngineAccessToken:null===(o=null==t?void 0:t.queryEngineAccessConfig)||void 0===o?void 0:o.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,o)}static load(e,t=Na){return Pa(this,void 0,void 0,(function*(){w("Starting load process for the services package.");const{queryEngine:r,dataSets:n,identity:i,programmaticDashboard:a}=e,o=new Oi(r,i,n,t),{queryEngineConfig:s,dataSets:l,identityConfig:u,dashboardStorageStrategy:c}=yield o.load(),d=new ka(u,s,l,c,a,{host:t.apiHost});return ka._instanceStore[Ma]=d,ka.queryEngine=r,w("Loaded services package and added it to the instance store."),d}))}static use(e=Ma){const t=ka._instanceStore[e];if(!t)throw new ki(e);return t}static waitToUse(e=Ma,t=1e4){return Pa(this,void 0,void 0,(function*(){const r=La._instanceStore,n=e;return new Promise(((i,a)=>{if(r.hasOwnProperty(n))return void i(r[n]);const o=setTimeout((()=>{clearTimeout(o),a(new qi(e,t))}),t),s=setInterval((()=>{r.hasOwnProperty(n)&&(clearTimeout(o),clearInterval(s),i(r[n]))}),10)}))}))}static clearInstances(){ka._instanceStore={}}createDashboard(e){var t;return Pa(this,void 0,void 0,(function*(){((e,t)=>{const r=L().object({definition:t?Pn(t):L().object().required(),parentDashboardId:L().string().required(),metadata:L().object()}).validate(e,Bi);if(r.error)throw new Ci(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=Nn(n,this.queryEngineConfig);return Ln(i,this.dataSets,(null===(t=n.definition)||void 0===t?void 0:t.customFields)||{})}))}updateDashboard(e){var t;return Pa(this,void 0,void 0,(function*(){((e,t)=>{const r=L().object({dashboardId:L().string().required(),definition:t?Pn(t):L().object().required(),metadata:L().object().optional(),deleted:L().boolean().optional()}).validate(e,Bi);if(r.error)throw new Ci(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=Nn(n,this.queryEngineConfig);return Ln(i,this.dataSets,(null===(t=n.definition)||void 0===t?void 0:t.customFields)||{})}))}getDashboards(e){return Pa(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=>La.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:kn(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=Ln(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 Pa(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 Pa(this,void 0,void 0,(function*(){w("[Services] Querying data with queries:",e);let r=Ma;(null==t?void 0:t.instanceId)&&(r=t.instanceId);const n=La._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:zi(e),timeDimension:L().alternatives(U(e.supportedTimeTruncFunctions),L().valid(null))})))(t)).validate(e,$i);if(r.error)throw new Ci(r.error.message)})(i,n.queryEngineConfig);const a=(()=>{if(null==t?void 0:t.queryEngineEndpoint)return t.queryEngineEndpoint;if(ka.queryEngine){if("string"==typeof ka.queryEngine)return ka.queryEngine;if("string"!=typeof ka.queryEngine&&"endpoint"in ka.queryEngine)return ka.queryEngine.endpoint}})(),o=((e,t,r,n,i,a,o)=>{var s;let l=(u=e.dashboardAccess,["accessType","dashboardId","projectId","userReference","scope"].map((e=>`${e}:${u[e]}`)).join(":::"));var u;if(n)return(i,a)=>Ca(void 0,void 0,void 0,(function*(){var s;return yield xa({type:"custom",queryEngineConfig:t,runQueries:n,dataAccessToken:null===(s=e.dataAccess)||void 0===s?void 0:s.signature,cacheKeyNamespace:l},i,{abortSignal:a.abortSignal,dataSets:a.dataSets,filterConfig:a.filterConfig||{},timeRangeOptions:r,timeZone:o})}));if(i)return(e,t)=>Ca(void 0,void 0,void 0,(function*(){return yield xa({type:"vizzlyJsQueryEngine",loadData:i,cacheKeyNamespace:l},e,{abortSignal:t.abortSignal,dataSets:t.dataSets,filterConfig:t.filterConfig||{},timeRangeOptions:r,timeZone:o})}));if(a&&(null===(s=e.dataAccess)||void 0===s?void 0:s.signature))return(n,i)=>Ca(void 0,void 0,void 0,(function*(){var s;return yield xa({type:"vizzlyQueryEngine",queryEngineConfig:t,dataAccessToken:null===(s=e.dataAccess)||void 0===s?void 0:s.signature,queryEngineEndpoint:a,cacheKeyNamespace:l},n,{abortSignal:i.abortSignal,dataSets:i.dataSets,filterConfig:i.filterConfig||{},timeRangeOptions:r,timeZone:o})}));throw"Missing required props."})(n.identityConfig,n.queryEngineConfig,((e,t)=>{const r=(e=>{return{today:Da(new Date,e("filter.today","Today")),past_1_day:Fa(1,0,e("filter.past_1_day","Last 24 hours")),yesterday:(t=new Date,r=e("filter.yesterday","Yesterday"),{description:r,range:{before:ja(t),after:ja(Ia(t,1))}}),past_3_days:Fa(3,0,e("filter.past_3_days","Last 3 days")),past_7_days:Fa(7,0,e("filter.past_7_days","Last 7 days")),past_30_days:Fa(30,0,e("filter.past_30_days","Last 30 days")),past_90_days:Fa(90,0,e("filter.past_90_days","Last 90 days")),past_3_months:Fa(0,3,e("filter.past_3_months","Last 3 months")),past_6_months:Fa(0,6,e("filter.past_6_months","Last 6 months")),past_12_months:Fa(0,12,e("filter.past_12_months","Last 12 months")),past_18_months:Fa(0,18,e("filter.past_18_months","Last 18 months"))};var t,r})(e),n=Object.keys(Ra).map((e=>e in r?`_vizzly_${e}`:e)),i=n.indexOf("_vizzly_today");i>-1&&(n.splice(i,1),n.unshift("_vizzly_today"));let a={},o={};for(const e of n){const n=e.replace("_vizzly_",""),i=r[n],a=null==t?void 0:t[n];"boolean"==typeof a?a&&(o[e]=i):null!=a?o[e]=a:!1!==Ra[n]&&(o[e]=i)}if(t)for(const[e,r]of Object.entries(t))e in Ra||(n.push(e),o[e]=r);for(const e of n)e in o&&(a[e]=o[e]);return a})(pn,null==t?void 0:t.dateFilterOptions),null==t?void 0:t.runQueries,null==t?void 0:t.data,a);return{results:yield(()=>Pa(this,void 0,void 0,(function*(){var e;try{return yield o(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=Nn(e,r);return[Ln(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 Pa(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 Pa(this,void 0,void 0,(function*(){try{const n=La.use();if(("addComponentToLibrary"===e.action||"deleteComponentFromLibrary"===e.action)&&n.globalLibraryPermissions){ka.publish({data:{action:"updateToGlobalLibraryStatus",state:Gi.SAVING}});const[i]=yield Promise.all([yield n.getGlobalLibraries({abortController:null==t?void 0:t.abortController})]);let a=qn(i);"addComponentToLibrary"===e.action&&(a=function(e,t,r){const n=qn(e);if(!n)throw new Error("No matching library found.");return n.library.views&&n.library.customFields||$n(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&&(a=((e,t)=>{const r=qn(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 o=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,[a]);((...e)=>{_("info")&&console.info("[VIZZLY INFO]",...e.map(A))})("library and tokens for update",{libraryForUpdate:a,tokenForLibrary:o});const s={globalLibraryId:a.id,library:a.library,abortSignal:null===(r=null==t?void 0:t.abortController)||void 0===r?void 0:r.signal,globalLibrarySessionToken:o};if(yield n.updateGlobalLibrary(s)){let t=Gi.SAVED;"deleteComponentFromLibrary"===e.action&&(t=Gi.DELETED),ka.publish({data:{action:"newViewsInGlobalLibrary"}}),ka.publish({data:{action:"updateToGlobalLibraryStatus",state:t}})}}}catch(e){T("Error handling event:",e)}}))}static publish(e){ka.eventBus.map((t=>{t(e)})),ka.eventBusController(e.data).catch((e=>{T("Failed to handle event:",e)}))}static subscription(e){return ka.eventBus.push(e),()=>{ka.eventBus=ka.eventBus.filter((t=>t!==e))}}}La._instanceStore={},La.DEFAULT_INSTANCE_ID=Ma,La.eventBus=[],La.Row=Ri,La.Cell=ji,La.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:Fi(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:Pi(null==t?void 0:t.library)})),this.dashboard=(e=>Object.assign({isPlayground:!1,display:[{components:[Sn(8),Sn(4)],height:_n},{components:[Sn(4),Sn(4),Sn(4)],height:_n}],componentLibrary:[],globalFilters:[],customFields:{}},e))(r)}setDisplay(e){let t=Fi(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=Pi(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})}},La.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})}},La.Header=Di,La.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{Mi({component:e,uniqueViewId:t});const a=new ji({component:Ni(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(a):null===(i=this.library)||void 0===i||i.splice(r.position,0,a)}catch(e){throw new Ii(e,"Library.addComponent")}}addComponents(e){try{if(void 0===e)throw new Ii("Components are undefined","Library.addComponents");e.forEach((e=>{var t;Mi(e);const r=new ji({component:Ni(e.component,e.uniqueViewId),colSpan:1});null===(t=this.library)||void 0===t||t.push(r)}))}catch(e){throw new Ii(e,"Library.addComponents")}}},La.AreaChart=class extends Li{constructor(e){super(Object.assign(Object.assign({},e),{type:"areaChart"}))}static type(){return"areaChart"}},La.LineChart=class extends Li{constructor(e){super(Object.assign(Object.assign({},e),{type:"lineChart"}))}static type(){return"lineChart"}},La.BarChart=class extends Li{constructor(e){super(Object.assign(Object.assign({},e),{type:"barChart"}))}static type(){return"barChart"}},La.PieChart=class extends Li{constructor(e){super(Object.assign(Object.assign({},e),{type:"pieChart"}))}static type(){return"pieChart"}},La.ScatterChart=class extends Li{constructor(e){super(Object.assign(Object.assign({},e),{type:"scatterChart"}))}static type(){return"scatterChart"}},La.ComboChart=class extends Li{constructor(e){super(Object.assign(Object.assign({},e),{type:"comboChart"}))}static type(){return"comboChart"}},La.PivotTable=class extends Li{constructor(e){super(Object.assign(Object.assign({},e),{type:"dataTable"}))}static type(){return"dataTable"}},La.BasicTable=class extends Li{constructor(e){super(Object.assign(Object.assign({},e),{type:"basicTable"}))}static type(){return"basicTable"}},La.HorizontalBarChart=class extends Li{constructor(e){super(Object.assign(Object.assign({},e),{type:"horizontalBarChart"}))}static type(){return"horizontalBarChart"}},La.MercatorMap=class extends Li{constructor(e){super(Object.assign(Object.assign({},e),{type:"mercatorMap"}))}static type(){return"mercatorMap"}},La.SingleStat=class extends Li{constructor(e){super(Object.assign(Object.assign({},e),{type:"singleStat"}))}static type(){return"singleStat"}},La.Progress=class extends Li{constructor(e){super(Object.assign(Object.assign({},e),{type:"progress"}))}static type(){return"progress"}},"undefined"==typeof window||window.Vizzly||(window.Vizzly=La);const ka="undefined"!=typeof window&&window.Vizzly||La})();var i=n.B,a=n.Q;export{i as Vizzly,a as VizzlyInstanceNotLoaded};
|