codesaaz-core 0.0.3 → 0.0.5
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/codesaaz-core.css +1 -1
- package/dist/codesaaz.es.js +2382 -2202
- package/dist/codesaaz.umd.js +12 -12
- package/package.json +1 -1
package/dist/codesaaz.umd.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
(function(Tt,
|
|
1
|
+
(function(Tt,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("vue"),require("vue-router"),require("primevue")):typeof define=="function"&&define.amd?define(["exports","vue","vue-router","primevue"],a):(Tt=typeof globalThis<"u"?globalThis:Tt||self,a(Tt.Codesaaz={},Tt.Vue,Tt.VueRouter,Tt.PrimeVue))})(this,function(Tt,a,Ut,Xo){"use strict";var mk=Object.defineProperty;var pk=(Tt,a,Ut)=>a in Tt?mk(Tt,a,{enumerable:!0,configurable:!0,writable:!0,value:Ut}):Tt[a]=Ut;var L=(Tt,a,Ut)=>pk(Tt,typeof a!="symbol"?a+"":a,Ut);const Oi={get:Di("GET"),post:Di("POST"),put:Di("PUT"),delete:Di("DELETE")};function Di(n){return(t,e)=>{const i={method:n,headers:{}};return e&&(i.headers["Content-Type"]="application/json",i.body=JSON.stringify(e)),fetch(t,i).then(gd)}}function gd(n){return n.text().then(t=>{const e=t&&JSON.parse(t);return n.ok?e:Promise.reject(e)})}/*!
|
|
2
2
|
* pinia v2.3.1
|
|
3
3
|
* (c) 2025 Eduardo San Martin Morote
|
|
4
4
|
* @license MIT
|
|
5
|
-
*/let Yo;const vs=n=>Yo=n,ud=Symbol();function Cs(n){return n&&typeof n=="object"&&Object.prototype.toString.call(n)==="[object Object]"&&typeof n.toJSON!="function"}var Pn;(function(n){n.direct="direct",n.patchObject="patch object",n.patchFunction="patch function"})(Pn||(Pn={}));const Ko=()=>{};function Xo(n,t,e,i=Ko){n.push(t);const s=()=>{const o=n.indexOf(t);o>-1&&(n.splice(o,1),i())};return!e&&l.getCurrentScope()&&l.onScopeDispose(s),s}function dn(n,...t){n.slice().forEach(e=>{e(...t)})}const hd=n=>n(),Go=Symbol(),Os=Symbol();function Ds(n,t){n instanceof Map&&t instanceof Map?t.forEach((e,i)=>n.set(i,e)):n instanceof Set&&t instanceof Set&&t.forEach(n.add,n);for(const e in t){if(!t.hasOwnProperty(e))continue;const i=t[e],s=n[e];Cs(s)&&Cs(i)&&n.hasOwnProperty(e)&&!l.isRef(i)&&!l.isReactive(i)?n[e]=Ds(s,i):n[e]=i}return n}const fd=Symbol();function md(n){return!Cs(n)||!n.hasOwnProperty(fd)}const{assign:Ne}=Object;function pd(n){return!!(l.isRef(n)&&n.effect)}function gd(n,t,e,i){const{state:s,actions:o,getters:r}=t,a=e.state.value[n];let c;function d(){a||(e.state.value[n]=s?s():{});const u=l.toRefs(e.state.value[n]);return Ne(u,o,Object.keys(r||{}).reduce((h,f)=>(h[f]=l.markRaw(l.computed(()=>{vs(e);const m=e._s.get(n);return r[f].call(m,m)})),h),{}))}return c=Qo(n,d,t,e,i,!0),c}function Qo(n,t,e={},i,s,o){let r;const a=Ne({actions:{}},e),c={deep:!0};let d,u,h=[],f=[],m;const p=i.state.value[n];!o&&!p&&(i.state.value[n]={}),l.ref({});let g;function y(x){let O;d=u=!1,typeof x=="function"?(x(i.state.value[n]),O={type:Pn.patchFunction,storeId:n,events:m}):(Ds(i.state.value[n],x),O={type:Pn.patchObject,payload:x,storeId:n,events:m});const M=g=Symbol();l.nextTick().then(()=>{g===M&&(d=!0)}),u=!0,dn(h,O,i.state.value[n])}const b=o?function(){const{state:O}=e,M=O?O():{};this.$patch(C=>{Ne(C,M)})}:Ko;function _(){r.stop(),h=[],f=[],i._s.delete(n)}const w=(x,O="")=>{if(Go in x)return x[Os]=O,x;const M=function(){vs(i);const C=Array.from(arguments),T=[],$=[];function U(I){T.push(I)}function H(I){$.push(I)}dn(f,{args:C,name:M[Os],store:k,after:U,onError:H});let B;try{B=x.apply(this&&this.$id===n?this:k,C)}catch(I){throw dn($,I),I}return B instanceof Promise?B.then(I=>(dn(T,I),I)).catch(I=>(dn($,I),Promise.reject(I))):(dn(T,B),B)};return M[Go]=!0,M[Os]=O,M},E={_p:i,$id:n,$onAction:Xo.bind(null,f),$patch:y,$reset:b,$subscribe(x,O={}){const M=Xo(h,x,O.detached,()=>C()),C=r.run(()=>l.watch(()=>i.state.value[n],T=>{(O.flush==="sync"?u:d)&&x({storeId:n,type:Pn.direct,events:m},T)},Ne({},c,O)));return M},$dispose:_},k=l.reactive(E);i._s.set(n,k);const S=(i._a&&i._a.runWithContext||hd)(()=>i._e.run(()=>(r=l.effectScope()).run(()=>t({action:w}))));for(const x in S){const O=S[x];if(l.isRef(O)&&!pd(O)||l.isReactive(O))o||(p&&md(O)&&(l.isRef(O)?O.value=p[x]:Ds(O,p[x])),i.state.value[n][x]=O);else if(typeof O=="function"){const M=w(O,x);S[x]=M,a.actions[x]=O}}return Ne(k,S),Ne(l.toRaw(k),S),Object.defineProperty(k,"$state",{get:()=>i.state.value[n],set:x=>{y(O=>{Ne(O,x)})}}),i._p.forEach(x=>{Ne(k,r.run(()=>x({store:k,app:i._a,pinia:i,options:a})))}),p&&o&&e.hydrate&&e.hydrate(k.$state,p),d=!0,u=!0,k}/*! #__NO_SIDE_EFFECTS__ */function Jo(n,t,e){let i,s;const o=typeof t=="function";typeof n=="string"?(i=n,s=o?e:t):(s=n,i=n.id);function r(a,c){const d=l.hasInjectionContext();return a=a||(d?l.inject(ud,null):null),a&&vs(a),a=Yo,a._s.has(i)||(o?Qo(i,t,s,a):gd(i,s,a)),a._s.get(i)}return r.$id=i,r}const me=Jo("globalConfigsStore",{state:()=>({globalConfigs:{}}),actions:{setBaseUrl(n){this.globalConfigs.baseUrl=n},setAppId(n){this.globalConfigs.appId=n}},getters:{getBaseUrl:n=>()=>n.globalConfigs.baseUrl,getAppId:n=>()=>n.globalConfigs.appId}});class Zo{constructor(){let t="http://localhost:7070";const e=me();e.getBaseUrl()!=null&&e.getBaseUrl()!=""&&(t=e.getBaseUrl()),this.baseUrl=t}async post(t,e){return await Oi.post(this.baseUrl+t,e)}async put(t,e){return await Oi.put(this.baseUrl+t,e)}async delete(t,e){return await Oi.delete(this.baseUrl+t,e)}async get(t){return await Oi.get(this.baseUrl+t)}}class qe{constructor(){this.httpService=new Zo}async getEntityRecords(t){return await this.getAppId(),await this.httpService.get(`/api/app/v1/${this.appId}/entity/${t}/record`)}async searchEntityRecords(t,e){return this.appId==null&&this.getAppId(),await this.httpService.post(`/api/app/v1/${this.appId}/entity/${t}/record/search`,e)}async getRelatedEntityRecord(t,e){return this.appId==null&&this.getAppId(),await this.httpService.get(`/api/app/v1/${this.appId}/entity/${t}/link/record/${e}?fetchRelatedEntities=true`)}async saveRelatedEntityRecord(t,e,i){return this.appId==null&&this.getAppId(),await this.httpService.post(`/api/app/v1/${this.appId}/entity/${t}/link/record/${e}`,i)}async getRecord(t,e){return this.appId==null&&this.getAppId(),await this.httpService.get(`/api/app/v1/${this.appId}/entity/${t}/record/${e}?fetchRelatedEntities=false`)}async addRecord(t,e){return this.appId==null&&this.getAppId(),await this.httpService.post(`/api/app/v1/${this.appId}/entity/${t}/record`,e)}async updateRecord(t,e,i){return this.appId==null&&this.getAppId(),await this.httpService.put(`/api/app/v1/${this.appId}/entity/${t}/record/${e}`,i)}async deleteRecord(t,e){return this.appId==null&&this.getAppId(),await this.httpService.delete(`/api/app/v1/${this.appId}/entity/${t}/record/${e}`)}async getAppId(){const t=me();this.appId=t.getAppId()}}function yd(n=""){const t=new qe,e={gt:"GREATER_THAN",dateAfter:"GREATER_THAN",equals:"EQUAL",dateIs:"EQUAL",notEquals:"NOT_EQUAL",dateIsNot:"NOT_EQUAL",lt:"LESS_THAN",dateBefore:"LESS_THAN",lte:"LESS_THAN_EQUAL",gte:"GREATER_THAN_EQUAL",between:"BETWEEN",contains:"CONTAINS",startsWith:"STARTS_WITH",notContains:"NOT_CONTAINS",endsWith:"ENDS_WITH"};let i=l.ref({}),s=l.ref([]),o=l.ref([]),r=l.ref([]);const a=l.ref(""),c=l.ref(1),d=l.ref(25),u=l.ref(0),h=l.ref(0),f=l.ref(0),m=l.ref(!1),p=l.ref([]),g=l.ref(""),y=l.ref({}),b=async(C,T=!0)=>{m.value=!0;try{const $=await t.getEntityRecords(C);$&&$.response&&(i.value=$.response,s.value=$.response.result,r.value=$.response.entity.entityDefinition.columns,o.value=w($.response.entity.entityDefinition.columns),h.value=$.response.totalRecords,M())}catch($){console.error("Error fetching entity:",$.errorMessage)}finally{m.value=!1}},_=async(C=!0)=>{m.value=!0;try{const T={sortBy:[a.value],sortDirection:c.value===1?"ASC":"DESC",pageSize:d.value,currentPage:u.value,columnList:null,filter:p.value,fullTextSearch:g.value};Object.keys(T.filter).length===0&&(T.filter=[]);const $=await t.searchEntityRecords(n,T);$&&$.response&&(m.value=!1,i.value=$.response,s.value=$.response.result,h.value=$.response.totalRecords,f.value=u.value*d.value)}catch(T){console.error("Error fetching entity:",T.errorMessage)}finally{m.value=!1}},w=C=>C.map(T=>({field:T.name,name:T.displayName?T.displayName:T.name,filterable:T.filterable,datatype:T.type,sortable:!0,displayFormatKey:T.displayFormatKey,displayFormat:T.displayFormat})),E=C=>{a.value=C.sortField,c.value=C.sortOrder,f.value=0,_()},k=C=>{d.value=C.rows,u.value=C.page,f.value=C.first,_()},v=()=>{_()},S=()=>{_()},x=C=>{switch(C.toLowerCase()){case"integer":case"int":case"numeric":return"numeric";case"date":return"date";case"bool":case"boolean":return"boolean";default:return"text"}},O=C=>{const T=o.value.find($=>$.field===C);return T?T.datatype:null},M=()=>{for(let C=0;C<r.value.length;C++){const T=r.value[C];if(T.primaryKey&&T.primaryKey==!0){y.value=T,a.value=T.name;break}}};return{items:s,headers:o,first:f,totalRecords:h,pageSize:d,loading:m,sortBy:a,sortDirection:c,operatorMap:e,filterToSend:p,fullTextSearch:g,listingResponse:i,primarayKeyColumn:y,onFullTextSearch:S,getDatatypeByField:O,getColumnDatatype:x,onSort:E,onPage:k,onFilter:v,fetchEntityFilterData:_,fetchEntityByName:b}}const jt=(n,t)=>{const e=n.__vccOpts||n;for(const[i,s]of t)e[i]=s;return e},bd={key:0,class:"field flex flex-col mb-3"},_d=["for"],xd={key:0},kd={key:0,class:"font-bold"},Sd={key:1,class:"font-bold text-color-hint"},wd={key:1,class:"flex items-center"},Ed={class:"ml-2"},vd={key:0},Ni=jt({__name:"EntityForm",props:l.mergeModels({column:Object,errors:Array},{modelValue:{},modelModifiers:{}}),emits:l.mergeModels(["input"],["update:modelValue"]),setup(n,{emit:t}){const e=l.useModel(n,"modelValue"),i=t,s=o=>{i("input",o.name)};if(n.column&&!n.column.inputComponent){let o="";switch(n.column.type.toLowerCase()){case"text":o="INPUT_TEXT";break;case"int":o="INPUT_NUMBER";break;case"float":o="INPUT_FLOAT";break;case"boolean":o="INPUT_BOOLEAN";break;case"uuid":o="INPUT_UUID";break;case"date":o="INPUT_DATE";break;default:o="INPUT_STRING"}n.column.inputComponent=o}return(o,r)=>{var h,f,m,p,g;const a=l.resolveComponent("Calendar"),c=l.resolveComponent("InputNumber"),d=l.resolveComponent("InputText"),u=l.resolveComponent("Checkbox");return l.openBlock(),l.createElementBlock(l.Fragment,null,[n.column.inputComponent.toLowerCase()!="input_boolean"?(l.openBlock(),l.createElementBlock("div",bd,[l.createElementVNode("label",{class:"mb-1",for:n.column.name},[l.createTextVNode(l.toDisplayString(n.column.displayName||n.column.name)+" ",1),n.column.required?(l.openBlock(),l.createElementBlock("span",xd,"*")):l.createCommentVNode("",!0)],8,_d),n.column.inputComponent.toLowerCase()=="input_date"?(l.openBlock(),l.createBlock(a,{key:0,modelValue:e.value,"onUpdate:modelValue":r[0]||(r[0]=y=>e.value=y),id:n.column.name,name:n.column.name,onDateSelect:r[1]||(r[1]=y=>s(n.column)),invalid:((h=n.errors)==null?void 0:h.length)>0},null,8,["modelValue","id","name","invalid"])):n.column.inputComponent.toLowerCase()=="input_number"?(l.openBlock(),l.createBlock(c,{key:1,modelValue:e.value,"onUpdate:modelValue":r[2]||(r[2]=y=>e.value=y),id:n.column.name,name:n.column.name,allowEmpty:!0,format:!1,onInput:r[3]||(r[3]=y=>s(n.column)),invalid:((f=n.errors)==null?void 0:f.length)>0},null,8,["modelValue","id","name","invalid"])):n.column.type.toLowerCase()=="input_float"?(l.openBlock(),l.createBlock(c,{key:2,type:"decimal",minFractionDigits:1,id:n.column.name,allowEmpty:!0,format:!1,name:n.column.name,onInput:r[4]||(r[4]=y=>s(n.column)),invalid:((m=n.errors)==null?void 0:m.length)>0},null,8,["id","name","invalid"])):(l.openBlock(),l.createBlock(d,{key:3,modelValue:e.value,"onUpdate:modelValue":r[5]||(r[5]=y=>e.value=y),id:n.column.name,name:n.column.name,onInput:r[6]||(r[6]=y=>s(n.column)),invalid:((p=n.errors)==null?void 0:p.length)>0},null,8,["modelValue","id","name","invalid"])),(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(n.errors,(y,b)=>(l.openBlock(),l.createElementBlock("div",{key:b,class:"text-red-500 mt-1 ml-2"},[y.includes("hint:")?(l.openBlock(),l.createElementBlock("small",Sd,l.toDisplayString(y.split(":")[1]),1)):(l.openBlock(),l.createElementBlock("small",kd,l.toDisplayString(y),1))]))),128))])):l.createCommentVNode("",!0),n.column.inputComponent.toLowerCase()=="input_boolean"?(l.openBlock(),l.createElementBlock("div",wd,[l.createVNode(u,{modelValue:e.value,"onUpdate:modelValue":r[7]||(r[7]=y=>e.value=y),invalid:((g=n.errors)==null?void 0:g.length)>0,onInput:r[8]||(r[8]=y=>s(n.column.name)),binary:""},null,8,["modelValue","invalid"]),l.createElementVNode("label",Ed,[l.createTextVNode(l.toDisplayString(n.column.displayName||n.column.name)+" ",1),n.column.required?(l.openBlock(),l.createElementBlock("span",vd,"*")):l.createCommentVNode("",!0)])])):l.createCommentVNode("",!0)],64)}}},[["__scopeId","data-v-bda1af7c"]]);/**
|
|
5
|
+
*/let Go;const Os=n=>Go=n,yd=Symbol();function Ds(n){return n&&typeof n=="object"&&Object.prototype.toString.call(n)==="[object Object]"&&typeof n.toJSON!="function"}var Pn;(function(n){n.direct="direct",n.patchObject="patch object",n.patchFunction="patch function"})(Pn||(Pn={}));const Qo=()=>{};function Jo(n,t,e,i=Qo){n.push(t);const s=()=>{const o=n.indexOf(t);o>-1&&(n.splice(o,1),i())};return!e&&a.getCurrentScope()&&a.onScopeDispose(s),s}function dn(n,...t){n.slice().forEach(e=>{e(...t)})}const bd=n=>n(),Zo=Symbol(),Ns=Symbol();function Ts(n,t){n instanceof Map&&t instanceof Map?t.forEach((e,i)=>n.set(i,e)):n instanceof Set&&t instanceof Set&&t.forEach(n.add,n);for(const e in t){if(!t.hasOwnProperty(e))continue;const i=t[e],s=n[e];Ds(s)&&Ds(i)&&n.hasOwnProperty(e)&&!a.isRef(i)&&!a.isReactive(i)?n[e]=Ts(s,i):n[e]=i}return n}const _d=Symbol();function xd(n){return!Ds(n)||!n.hasOwnProperty(_d)}const{assign:Ne}=Object;function kd(n){return!!(a.isRef(n)&&n.effect)}function Sd(n,t,e,i){const{state:s,actions:o,getters:r}=t,l=e.state.value[n];let c;function d(){l||(e.state.value[n]=s?s():{});const u=a.toRefs(e.state.value[n]);return Ne(u,o,Object.keys(r||{}).reduce((h,f)=>(h[f]=a.markRaw(a.computed(()=>{Os(e);const m=e._s.get(n);return r[f].call(m,m)})),h),{}))}return c=tr(n,d,t,e,i,!0),c}function tr(n,t,e={},i,s,o){let r;const l=Ne({actions:{}},e),c={deep:!0};let d,u,h=[],f=[],m;const p=i.state.value[n];!o&&!p&&(i.state.value[n]={}),a.ref({});let g;function y(x){let O;d=u=!1,typeof x=="function"?(x(i.state.value[n]),O={type:Pn.patchFunction,storeId:n,events:m}):(Ts(i.state.value[n],x),O={type:Pn.patchObject,payload:x,storeId:n,events:m});const M=g=Symbol();a.nextTick().then(()=>{g===M&&(d=!0)}),u=!0,dn(h,O,i.state.value[n])}const b=o?function(){const{state:O}=e,M=O?O():{};this.$patch(v=>{Ne(v,M)})}:Qo;function _(){r.stop(),h=[],f=[],i._s.delete(n)}const w=(x,O="")=>{if(Zo in x)return x[Ns]=O,x;const M=function(){Os(i);const v=Array.from(arguments),T=[],$=[];function U(I){T.push(I)}function H(I){$.push(I)}dn(f,{args:v,name:M[Ns],store:k,after:U,onError:H});let F;try{F=x.apply(this&&this.$id===n?this:k,v)}catch(I){throw dn($,I),I}return F instanceof Promise?F.then(I=>(dn(T,I),I)).catch(I=>(dn($,I),Promise.reject(I))):(dn(T,F),F)};return M[Zo]=!0,M[Ns]=O,M},E={_p:i,$id:n,$onAction:Jo.bind(null,f),$patch:y,$reset:b,$subscribe(x,O={}){const M=Jo(h,x,O.detached,()=>v()),v=r.run(()=>a.watch(()=>i.state.value[n],T=>{(O.flush==="sync"?u:d)&&x({storeId:n,type:Pn.direct,events:m},T)},Ne({},c,O)));return M},$dispose:_},k=a.reactive(E);i._s.set(n,k);const S=(i._a&&i._a.runWithContext||bd)(()=>i._e.run(()=>(r=a.effectScope()).run(()=>t({action:w}))));for(const x in S){const O=S[x];if(a.isRef(O)&&!kd(O)||a.isReactive(O))o||(p&&xd(O)&&(a.isRef(O)?O.value=p[x]:Ts(O,p[x])),i.state.value[n][x]=O);else if(typeof O=="function"){const M=w(O,x);S[x]=M,l.actions[x]=O}}return Ne(k,S),Ne(a.toRaw(k),S),Object.defineProperty(k,"$state",{get:()=>i.state.value[n],set:x=>{y(O=>{Ne(O,x)})}}),i._p.forEach(x=>{Ne(k,r.run(()=>x({store:k,app:i._a,pinia:i,options:l})))}),p&&o&&e.hydrate&&e.hydrate(k.$state,p),d=!0,u=!0,k}/*! #__NO_SIDE_EFFECTS__ */function er(n,t,e){let i,s;const o=typeof t=="function";typeof n=="string"?(i=n,s=o?e:t):(s=n,i=n.id);function r(l,c){const d=a.hasInjectionContext();return l=l||(d?a.inject(yd,null):null),l&&Os(l),l=Go,l._s.has(i)||(o?tr(i,t,s,l):Sd(i,s,l)),l._s.get(i)}return r.$id=i,r}const re=er("globalConfigsStore",{state:()=>({globalConfigs:{}}),actions:{setBaseUrl(n){this.globalConfigs.baseUrl=n},setAppId(n){this.globalConfigs.appId=n}},getters:{getBaseUrl:n=>()=>n.globalConfigs.baseUrl,getAppId:n=>()=>n.globalConfigs.appId}});class nr{constructor(){let t="http://localhost:7070";const e=re();e.getBaseUrl()!=null&&e.getBaseUrl()!=""&&(t=e.getBaseUrl()),this.baseUrl=t}async post(t,e){return await Oi.post(this.baseUrl+t,e)}async put(t,e){return await Oi.put(this.baseUrl+t,e)}async delete(t,e){return await Oi.delete(this.baseUrl+t,e)}async get(t){return await Oi.get(this.baseUrl+t)}}class qe{constructor(){this.httpService=new nr}async getEntityRecords(t){return await this.getAppId(),await this.httpService.get(`/api/app/v1/${this.appId}/entity/${t}/record`)}async searchEntityRecords(t,e){return this.appId==null&&this.getAppId(),await this.httpService.post(`/api/app/v1/${this.appId}/entity/${t}/record/search`,e)}async getRelatedEntityRecord(t,e){return this.appId==null&&this.getAppId(),await this.httpService.get(`/api/app/v1/${this.appId}/entity/${t}/link/record/${e}?fetchRelatedEntities=true`)}async saveRelatedEntityRecord(t,e,i){return this.appId==null&&this.getAppId(),await this.httpService.post(`/api/app/v1/${this.appId}/entity/${t}/link/record/${e}`,i)}async getRecord(t,e){return this.appId==null&&this.getAppId(),await this.httpService.get(`/api/app/v1/${this.appId}/entity/${t}/record/${e}?fetchRelatedEntities=false`)}async addRecord(t,e){return this.appId==null&&this.getAppId(),await this.httpService.post(`/api/app/v1/${this.appId}/entity/${t}/record`,e)}async updateRecord(t,e,i){return this.appId==null&&this.getAppId(),await this.httpService.put(`/api/app/v1/${this.appId}/entity/${t}/record/${e}`,i)}async deleteRecord(t,e){return this.appId==null&&this.getAppId(),await this.httpService.delete(`/api/app/v1/${this.appId}/entity/${t}/record/${e}`)}async getAppId(){const t=re();this.appId=t.getAppId()}}function wd(n=""){const t=new qe,e={gt:"GREATER_THAN",dateAfter:"GREATER_THAN",equals:"EQUAL",dateIs:"EQUAL",notEquals:"NOT_EQUAL",dateIsNot:"NOT_EQUAL",lt:"LESS_THAN",dateBefore:"LESS_THAN",lte:"LESS_THAN_EQUAL",gte:"GREATER_THAN_EQUAL",between:"BETWEEN",contains:"CONTAINS",startsWith:"STARTS_WITH",notContains:"NOT_CONTAINS",endsWith:"ENDS_WITH"};let i=a.ref({}),s=a.ref([]),o=a.ref([]),r=a.ref([]);const l=a.ref(""),c=a.ref(1),d=a.ref(25),u=a.ref(0),h=a.ref(0),f=a.ref(0),m=a.ref(!1),p=a.ref([]),g=a.ref(""),y=a.ref({}),b=async(v,T=!0)=>{m.value=!0;try{const $=await t.getEntityRecords(v);$&&$.response&&(i.value=$.response,s.value=$.response.result,r.value=$.response.entity.entityDefinition.columns,o.value=w($.response.entity.entityDefinition.columns),h.value=$.response.totalRecords,M())}catch($){console.error("Error fetching entity:",$.errorMessage)}finally{m.value=!1}},_=async(v=!0)=>{m.value=!0;try{const T={sortBy:[l.value],sortDirection:c.value===1?"ASC":"DESC",pageSize:d.value,currentPage:u.value,columnList:null,filter:p.value,fullTextSearch:g.value};Object.keys(T.filter).length===0&&(T.filter=[]);const $=await t.searchEntityRecords(n,T);$&&$.response&&(m.value=!1,i.value=$.response,s.value=$.response.result,h.value=$.response.totalRecords,f.value=u.value*d.value)}catch(T){console.error("Error fetching entity:",T.errorMessage)}finally{m.value=!1}},w=v=>v.map(T=>({field:T.name,name:T.displayName?T.displayName:T.name,filterable:T.filterable,datatype:T.type,sortable:!0,displayFormatKey:T.displayFormatKey,displayFormat:T.displayFormat})),E=v=>{l.value=v.sortField,c.value=v.sortOrder,f.value=0,_()},k=v=>{d.value=v.rows,u.value=v.page,f.value=v.first,_()},C=()=>{_()},S=()=>{_()},x=v=>{switch(v.toLowerCase()){case"integer":case"int":case"numeric":return"numeric";case"date":return"date";case"bool":case"boolean":return"boolean";default:return"text"}},O=v=>{const T=o.value.find($=>$.field===v);return T?T.datatype:null},M=()=>{for(let v=0;v<r.value.length;v++){const T=r.value[v];if(T.primaryKey&&T.primaryKey==!0){y.value=T,l.value=T.name;break}}};return{items:s,headers:o,first:f,totalRecords:h,pageSize:d,loading:m,sortBy:l,sortDirection:c,operatorMap:e,filterToSend:p,fullTextSearch:g,listingResponse:i,primarayKeyColumn:y,onFullTextSearch:S,getDatatypeByField:O,getColumnDatatype:x,onSort:E,onPage:k,onFilter:C,fetchEntityFilterData:_,fetchEntityByName:b}}const Ft=(n,t)=>{const e=n.__vccOpts||n;for(const[i,s]of t)e[i]=s;return e},Ed={key:0,class:"field flex flex-col mb-3"},Cd=["for"],vd={key:0},Od={key:0,class:"font-bold"},Dd={key:1,class:"font-bold text-color-hint"},Nd={key:1,class:"flex items-center"},Td={class:"ml-2"},Pd={key:0},Ni=Ft({__name:"EntityForm",props:a.mergeModels({column:Object,errors:Array},{modelValue:{},modelModifiers:{}}),emits:a.mergeModels(["input"],["update:modelValue"]),setup(n,{emit:t}){const e=a.useModel(n,"modelValue"),i=t,s=o=>{i("input",o.name)};if(n.column&&!n.column.inputComponent){let o="";switch(n.column.type.toLowerCase()){case"text":o="INPUT_TEXT";break;case"int":o="INPUT_NUMBER";break;case"float":o="INPUT_FLOAT";break;case"boolean":o="INPUT_BOOLEAN";break;case"uuid":o="INPUT_UUID";break;case"date":o="INPUT_DATE";break;default:o="INPUT_STRING"}n.column.inputComponent=o}return(o,r)=>{var h,f,m,p,g;const l=a.resolveComponent("Calendar"),c=a.resolveComponent("InputNumber"),d=a.resolveComponent("InputText"),u=a.resolveComponent("Checkbox");return a.openBlock(),a.createElementBlock(a.Fragment,null,[n.column.inputComponent.toLowerCase()!="input_boolean"?(a.openBlock(),a.createElementBlock("div",Ed,[a.createElementVNode("label",{class:"mb-1",for:n.column.name},[a.createTextVNode(a.toDisplayString(n.column.displayName||n.column.name)+" ",1),n.column.required?(a.openBlock(),a.createElementBlock("span",vd,"*")):a.createCommentVNode("",!0)],8,Cd),n.column.inputComponent.toLowerCase()=="input_date"?(a.openBlock(),a.createBlock(l,{key:0,modelValue:e.value,"onUpdate:modelValue":r[0]||(r[0]=y=>e.value=y),id:n.column.name,name:n.column.name,onDateSelect:r[1]||(r[1]=y=>s(n.column)),invalid:((h=n.errors)==null?void 0:h.length)>0},null,8,["modelValue","id","name","invalid"])):n.column.inputComponent.toLowerCase()=="input_number"?(a.openBlock(),a.createBlock(c,{key:1,modelValue:e.value,"onUpdate:modelValue":r[2]||(r[2]=y=>e.value=y),id:n.column.name,name:n.column.name,allowEmpty:!0,format:!1,onInput:r[3]||(r[3]=y=>s(n.column)),invalid:((f=n.errors)==null?void 0:f.length)>0},null,8,["modelValue","id","name","invalid"])):n.column.type.toLowerCase()=="input_float"?(a.openBlock(),a.createBlock(c,{key:2,type:"decimal",minFractionDigits:1,id:n.column.name,allowEmpty:!0,format:!1,name:n.column.name,onInput:r[4]||(r[4]=y=>s(n.column)),invalid:((m=n.errors)==null?void 0:m.length)>0},null,8,["id","name","invalid"])):(a.openBlock(),a.createBlock(d,{key:3,modelValue:e.value,"onUpdate:modelValue":r[5]||(r[5]=y=>e.value=y),id:n.column.name,name:n.column.name,onInput:r[6]||(r[6]=y=>s(n.column)),invalid:((p=n.errors)==null?void 0:p.length)>0},null,8,["modelValue","id","name","invalid"])),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(n.errors,(y,b)=>(a.openBlock(),a.createElementBlock("div",{key:b,class:"text-red-500 mt-1 ml-2"},[y.includes("hint:")?(a.openBlock(),a.createElementBlock("small",Dd,a.toDisplayString(y.split(":")[1]),1)):(a.openBlock(),a.createElementBlock("small",Od,a.toDisplayString(y),1))]))),128))])):a.createCommentVNode("",!0),n.column.inputComponent.toLowerCase()=="input_boolean"?(a.openBlock(),a.createElementBlock("div",Nd,[a.createVNode(u,{modelValue:e.value,"onUpdate:modelValue":r[7]||(r[7]=y=>e.value=y),invalid:((g=n.errors)==null?void 0:g.length)>0,onInput:r[8]||(r[8]=y=>s(n.column.name)),binary:""},null,8,["modelValue","invalid"]),a.createElementVNode("label",Td,[a.createTextVNode(a.toDisplayString(n.column.displayName||n.column.name)+" ",1),n.column.required?(a.openBlock(),a.createElementBlock("span",Pd,"*")):a.createCommentVNode("",!0)])])):a.createCommentVNode("",!0)],64)}}},[["__scopeId","data-v-bda1af7c"]]);/**
|
|
6
6
|
* vee-validate v4.15.0
|
|
7
7
|
* (c) 2024 Abdelrahman Awad
|
|
8
8
|
* @license MIT
|
|
9
|
-
*/function Jt(n){return typeof n=="function"}function tr(n){return n==null}const un=n=>n!==null&&!!n&&typeof n=="object"&&!Array.isArray(n);function Ns(n){return Number(n)>=0}function Cd(n){return typeof n=="object"&&n!==null}function Od(n){return n==null?n===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(n)}function er(n){if(!Cd(n)||Od(n)!=="[object Object]")return!1;if(Object.getPrototypeOf(n)===null)return!0;let t=n;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(n)===t}function Mn(n,t){return Object.keys(t).forEach(e=>{if(er(t[e])&&er(n[e])){n[e]||(n[e]={}),Mn(n[e],t[e]);return}n[e]=t[e]}),n}function Ti(n){const t=n.split(".");if(!t.length)return"";let e=String(t[0]);for(let i=1;i<t.length;i++){if(Ns(t[i])){e+=`[${t[i]}]`;continue}e+=`.${t[i]}`}return e}const Dd={};function Nd(n){return Dd[n]}function nr(n,t,e){typeof e.value=="object"&&(e.value=ht(e.value)),!e.enumerable||e.get||e.set||!e.configurable||!e.writable||t==="__proto__"?Object.defineProperty(n,t,e):n[t]=e.value}function ht(n){if(typeof n!="object")return n;var t=0,e,i,s,o=Object.prototype.toString.call(n);if(o==="[object Object]"?s=Object.create(n.__proto__||null):o==="[object Array]"?s=Array(n.length):o==="[object Set]"?(s=new Set,n.forEach(function(r){s.add(ht(r))})):o==="[object Map]"?(s=new Map,n.forEach(function(r,a){s.set(ht(a),ht(r))})):o==="[object Date]"?s=new Date(+n):o==="[object RegExp]"?s=new RegExp(n.source,n.flags):o==="[object DataView]"?s=new n.constructor(ht(n.buffer)):o==="[object ArrayBuffer]"?s=n.slice(0):o.slice(-6)==="Array]"&&(s=new n.constructor(n)),s){for(i=Object.getOwnPropertySymbols(n);t<i.length;t++)nr(s,i[t],Object.getOwnPropertyDescriptor(n,i[t]));for(t=0,i=Object.getOwnPropertyNames(n);t<i.length;t++)Object.hasOwnProperty.call(s,e=i[t])&&s[e]===n[e]||nr(s,e,Object.getOwnPropertyDescriptor(n,e))}return s||n}const Td=Symbol("vee-validate-form"),Pd=Symbol("vee-validate-form-context"),Md=typeof window<"u";function Vd(n){return Jt(n)&&!!n.__locatorRef}function Te(n){return!!n&&Jt(n.parse)&&n.__type==="VVTypedSchema"}function ir(n){return!!n&&Jt(n.validate)}function Ad(n){return n==="checkbox"||n==="radio"}function Fd(n){return un(n)||Array.isArray(n)}function Bd(n){return Array.isArray(n)?n.length===0:un(n)&&Object.keys(n).length===0}function Pi(n){return/^\[.+\]$/i.test(n)}function $d(n){return sr(n)&&n.multiple}function sr(n){return n.tagName==="SELECT"}function Rd(n){return or(n)&&n.target&&"submit"in n.target}function or(n){return n?!!(typeof Event<"u"&&Jt(Event)&&n instanceof Event||n&&n.srcElement):!1}function Vn(n,t){if(n===t)return!0;if(n&&t&&typeof n=="object"&&typeof t=="object"){if(n.constructor!==t.constructor)return!1;var e,i,s;if(Array.isArray(n)){if(e=n.length,e!=t.length)return!1;for(i=e;i--!==0;)if(!Vn(n[i],t[i]))return!1;return!0}if(n instanceof Map&&t instanceof Map){if(n.size!==t.size)return!1;for(i of n.entries())if(!t.has(i[0]))return!1;for(i of n.entries())if(!Vn(i[1],t.get(i[0])))return!1;return!0}if(ar(n)&&ar(t))return!(n.size!==t.size||n.name!==t.name||n.lastModified!==t.lastModified||n.type!==t.type);if(n instanceof Set&&t instanceof Set){if(n.size!==t.size)return!1;for(i of n.entries())if(!t.has(i[0]))return!1;return!0}if(ArrayBuffer.isView(n)&&ArrayBuffer.isView(t)){if(e=n.length,e!=t.length)return!1;for(i=e;i--!==0;)if(n[i]!==t[i])return!1;return!0}if(n.constructor===RegExp)return n.source===t.source&&n.flags===t.flags;if(n.valueOf!==Object.prototype.valueOf)return n.valueOf()===t.valueOf();if(n.toString!==Object.prototype.toString)return n.toString()===t.toString();if(s=Object.keys(n),e=s.length-rr(n,s),e!==Object.keys(t).length-rr(t,Object.keys(t)))return!1;for(i=e;i--!==0;)if(!Object.prototype.hasOwnProperty.call(t,s[i]))return!1;for(i=e;i--!==0;){var o=s[i];if(!Vn(n[o],t[o]))return!1}return!0}return n!==n&&t!==t}function rr(n,t){let e=0;for(let s=t.length;s--!==0;){var i=t[s];n[i]===void 0&&e++}return e}function ar(n){return Md?n instanceof File:!1}function Ts(n){return Pi(n)?n.replace(/\[|\]/gi,""):n}function pe(n,t,e){return n?Pi(t)?n[Ts(t)]:(t||"").split(/\.|\[(\d+)\]/).filter(Boolean).reduce((s,o)=>Fd(s)&&o in s?s[o]:e,n):e}function ge(n,t,e){if(Pi(t)){n[Ts(t)]=e;return}const i=t.split(/\.|\[(\d+)\]/).filter(Boolean);let s=n;for(let o=0;o<i.length;o++){if(o===i.length-1){s[i[o]]=e;return}(!(i[o]in s)||tr(s[i[o]]))&&(s[i[o]]=Ns(i[o+1])?[]:{}),s=s[i[o]]}}function Ps(n,t){if(Array.isArray(n)&&Ns(t)){n.splice(Number(t),1);return}un(n)&&delete n[t]}function lr(n,t){if(Pi(t)){delete n[Ts(t)];return}const e=t.split(/\.|\[(\d+)\]/).filter(Boolean);let i=n;for(let o=0;o<e.length;o++){if(o===e.length-1){Ps(i,e[o]);break}if(!(e[o]in i)||tr(i[e[o]]))break;i=i[e[o]]}const s=e.map((o,r)=>pe(n,e.slice(0,r).join(".")));for(let o=s.length-1;o>=0;o--)if(Bd(s[o])){if(o===0){Ps(n,e[0]);continue}Ps(s[o-1],e[o-1])}}function qt(n){return Object.keys(n)}function cr(n,t=0){let e=null,i=[];return function(...s){return e&&clearTimeout(e),e=setTimeout(()=>{const o=n(...s);i.forEach(r=>r(o)),i=[]},t),new Promise(o=>i.push(o))}}function Ld(n,t){let e;return async function(...s){const o=n(...s);e=o;const r=await o;return o!==e?r:(e=void 0,t(r,s))}}function dr(n){return Array.isArray(n)?n:n?[n]:[]}function Mi(n,t){const e={};for(const i in n)t.includes(i)||(e[i]=n[i]);return e}function Id(n){let t=null,e=[];return function(...i){const s=l.nextTick(()=>{if(t!==s)return;const o=n(...i);e.forEach(r=>r(o)),e=[],t=null});return t=s,new Promise(o=>e.push(o))}}function Ms(n){if(ur(n))return n._value}function ur(n){return"_value"in n}function jd(n){return n.type==="number"||n.type==="range"?Number.isNaN(n.valueAsNumber)?n.value:n.valueAsNumber:n.value}function hr(n){if(!or(n))return n;const t=n.target;if(Ad(t.type)&&ur(t))return Ms(t);if(t.type==="file"&&t.files){const e=Array.from(t.files);return t.multiple?e:e[0]}if($d(t))return Array.from(t.options).filter(e=>e.selected&&!e.disabled).map(Ms);if(sr(t)){const e=Array.from(t.options).find(i=>i.selected);return e?Ms(e):t.value}return jd(t)}function zd(n){const t={};return Object.defineProperty(t,"_$$isNormalized",{value:!0,writable:!1,enumerable:!1,configurable:!1}),n?un(n)&&n._$$isNormalized?n:un(n)?Object.keys(n).reduce((e,i)=>{const s=Wd(n[i]);return n[i]!==!1&&(e[i]=fr(s)),e},t):typeof n!="string"?t:n.split("|").reduce((e,i)=>{const s=Hd(i);return s.name&&(e[s.name]=fr(s.params)),e},t):t}function Wd(n){return n===!0?[]:Array.isArray(n)||un(n)?n:[n]}function fr(n){const t=e=>typeof e=="string"&&e[0]==="@"?Ud(e.slice(1)):e;return Array.isArray(n)?n.map(t):n instanceof RegExp?[n]:Object.keys(n).reduce((e,i)=>(e[i]=t(n[i]),e),{})}const Hd=n=>{let t=[];const e=n.split(":")[0];return n.includes(":")&&(t=n.split(":").slice(1).join(":").split(",")),{name:e,params:t}};function Ud(n){const t=e=>{var i;return(i=pe(e,n))!==null&&i!==void 0?i:e[n]};return t.__locatorRef=n,t}let qd=Object.assign({},{generateMessage:({field:n})=>`${n} is not valid.`,bails:!0,validateOnBlur:!0,validateOnChange:!0,validateOnInput:!1,validateOnModelUpdate:!0});const An=()=>qd;async function Yd(n,t,e={}){const i=e==null?void 0:e.bails,s={name:(e==null?void 0:e.name)||"{field}",rules:t,label:e==null?void 0:e.label,bails:i??!0,formData:(e==null?void 0:e.values)||{}},o=await Kd(s,n);return Object.assign(Object.assign({},o),{valid:!o.errors.length})}async function Kd(n,t){const e=n.rules;if(Te(e)||ir(e))return Gd(t,Object.assign(Object.assign({},n),{rules:e}));if(Jt(e)||Array.isArray(e)){const a={field:n.label||n.name,name:n.name,label:n.label,form:n.formData,value:t},c=Array.isArray(e)?e:[e],d=c.length,u=[];for(let h=0;h<d;h++){const f=c[h],m=await f(t,a);if(!(typeof m!="string"&&!Array.isArray(m)&&m)){if(Array.isArray(m))u.push(...m);else{const g=typeof m=="string"?m:pr(a);u.push(g)}if(n.bails)return{errors:u}}}return{errors:u}}const i=Object.assign(Object.assign({},n),{rules:zd(e)}),s=[],o=Object.keys(i.rules),r=o.length;for(let a=0;a<r;a++){const c=o[a],d=await Qd(i,t,{name:c,params:i.rules[c]});if(d.error&&(s.push(d.error),n.bails))return{errors:s}}return{errors:s}}function Xd(n){return!!n&&n.name==="ValidationError"}function mr(n){return{__type:"VVTypedSchema",async parse(e,i){var s;try{return{output:await n.validate(e,{abortEarly:!1,context:(i==null?void 0:i.formData)||{}}),errors:[]}}catch(o){if(!Xd(o))throw o;if(!(!((s=o.inner)===null||s===void 0)&&s.length)&&o.errors.length)return{errors:[{path:o.path,errors:o.errors}]};const r=o.inner.reduce((a,c)=>{const d=c.path||"";return a[d]||(a[d]={errors:[],path:d}),a[d].errors.push(...c.errors),a},{});return{errors:Object.values(r)}}}}}async function Gd(n,t){const i=await(Te(t.rules)?t.rules:mr(t.rules)).parse(n,{formData:t.formData}),s=[];for(const o of i.errors)o.errors.length&&s.push(...o.errors);return{value:i.value,errors:s}}async function Qd(n,t,e){const i=Nd(e.name);if(!i)throw new Error(`No such validator '${e.name}' exists.`);const s=Jd(e.params,n.formData),o={field:n.label||n.name,name:n.name,label:n.label,value:t,form:n.formData,rule:Object.assign(Object.assign({},e),{params:s})},r=await i(t,s,o);return typeof r=="string"?{error:r}:{error:r?void 0:pr(o)}}function pr(n){const t=An().generateMessage;return t?t(n):"Field is invalid"}function Jd(n,t){const e=i=>Vd(i)?i(t):i;return Array.isArray(n)?n.map(e):Object.keys(n).reduce((i,s)=>(i[s]=e(n[s]),i),{})}async function Zd(n,t){const i=await(Te(n)?n:mr(n)).parse(ht(t),{formData:ht(t)}),s={},o={};for(const r of i.errors){const a=r.errors,c=(r.path||"").replace(/\["(\d+)"\]/g,(d,u)=>`[${u}]`);s[c]={valid:!a.length,errors:a},a.length&&(o[c]=a[0])}return{valid:!i.errors.length,results:s,errors:o,values:i.value,source:"schema"}}async function tu(n,t,e){const s=qt(n).map(async d=>{var u,h,f;const m=(u=e==null?void 0:e.names)===null||u===void 0?void 0:u[d],p=await Yd(pe(t,d),n[d],{name:(m==null?void 0:m.name)||d,label:m==null?void 0:m.label,values:t,bails:(f=(h=e==null?void 0:e.bailsMap)===null||h===void 0?void 0:h[d])!==null&&f!==void 0?f:!0});return Object.assign(Object.assign({},p),{path:d})});let o=!0;const r=await Promise.all(s),a={},c={};for(const d of r)a[d.path]={valid:d.valid,errors:d.errors},d.valid||(o=!1,c[d.path]=d.errors[0]);return{valid:o,results:a,errors:c,source:"schema"}}let eu=0;const Vi=["bails","fieldsCount","id","multiple","type","validate"];function gr(n){const t={},e=Object.assign({},l.toValue(t)),i=l.unref(void 0);return i&&Te(i)&&Jt(i.cast)?ht(i.cast(e)||{}):ht(e)}function yr(n){var t;const e=eu++,i="Form";let s=0;const o=l.ref(!1),r=l.ref(!1),a=l.ref(0),c=[],d=l.reactive(gr()),u=l.ref([]),h=l.ref({}),f=l.ref({}),m=Id(()=>{f.value=u.value.reduce((N,D)=>(N[Ti(l.toValue(D.path))]=D,N),{})});function p(N,D){const V=I(N);if(!V){typeof N=="string"&&(h.value[Ti(N)]=dr(D));return}if(typeof N=="string"){const z=Ti(N);h.value[z]&&delete h.value[z]}V.errors=dr(D),V.valid=!V.errors.length}function g(N){qt(N).forEach(D=>{p(D,N[D])})}const y=l.computed(()=>{const N=u.value.reduce((D,V)=>(V.errors.length&&(D[l.toValue(V.path)]=V.errors),D),{});return Object.assign(Object.assign({},h.value),N)}),b=l.computed(()=>qt(y.value).reduce((N,D)=>{const V=y.value[D];return V!=null&&V.length&&(N[D]=V[0]),N},{})),_=l.computed(()=>u.value.reduce((N,D)=>(N[l.toValue(D.path)]={name:l.toValue(D.path)||"",label:D.label||""},N),{})),w=l.computed(()=>u.value.reduce((N,D)=>{var V;return N[l.toValue(D.path)]=(V=D.bails)!==null&&V!==void 0?V:!0,N},{})),E=Object.assign({},{}),k=(t=void 0)!==null&&t!==void 0?t:!1,{initialValues:v,originalInitialValues:S,setInitialValues:x}=iu(u,d),O=nu(u,d,S,b),M=l.computed(()=>u.value.reduce((N,D)=>{const V=pe(d,l.toValue(D.path));return ge(N,l.toValue(D.path),V),N},{})),C=void 0;function T(N,D){var V,z;const K=l.computed(()=>pe(v.value,l.toValue(N))),Z=f.value[l.toValue(N)],q=(D==null?void 0:D.type)==="checkbox"||(D==null?void 0:D.type)==="radio";if(Z&&q){Z.multiple=!0;const Qt=s++;return Array.isArray(Z.id)?Z.id.push(Qt):Z.id=[Z.id,Qt],Z.fieldsCount++,Z.__flags.pendingUnmount[Qt]=!1,Z}const kt=l.computed(()=>pe(d,l.toValue(N))),Et=l.toValue(N),At=P.findIndex(Qt=>Qt===Et);At!==-1&&P.splice(At,1);const yt=l.computed(()=>{var Qt,Ci,zo,Wo;const Ho=l.toValue(C);if(Te(Ho))return(Ci=(Qt=Ho.describe)===null||Qt===void 0?void 0:Qt.call(Ho,l.toValue(N)).required)!==null&&Ci!==void 0?Ci:!1;const Uo=l.toValue(D==null?void 0:D.schema);return Te(Uo)&&(Wo=(zo=Uo.describe)===null||zo===void 0?void 0:zo.call(Uo).required)!==null&&Wo!==void 0?Wo:!1}),Ft=s++,It=l.reactive({id:Ft,path:N,touched:!1,pending:!1,valid:!0,validated:!!(!((V=E[Et])===null||V===void 0)&&V.length),required:yt,initialValue:K,errors:l.shallowRef([]),bails:(z=D==null?void 0:D.bails)!==null&&z!==void 0?z:!1,label:D==null?void 0:D.label,type:(D==null?void 0:D.type)||"default",value:kt,multiple:!1,__flags:{pendingUnmount:{[Ft]:!1},pendingReset:!1},fieldsCount:1,validate:D==null?void 0:D.validate,dirty:l.computed(()=>!Vn(l.unref(kt),l.unref(K)))});return u.value.push(It),f.value[Et]=It,m(),b.value[Et]&&!E[Et]&&l.nextTick(()=>{Ot(Et,{mode:"silent"})}),l.isRef(N)&&l.watch(N,Qt=>{m();const Ci=ht(kt.value);f.value[Qt]=It,l.nextTick(()=>{ge(d,Qt,Ci)})}),It}const $=cr(Nn,5),U=cr(Nn,5),H=Ld(async N=>await(N==="silent"?$():U()),(N,[D])=>{const V=qt(st.errorBag.value),K=[...new Set([...qt(N.results),...u.value.map(Z=>Z.path),...V])].sort().reduce((Z,q)=>{var kt;const Et=q,At=I(Et)||F(Et),yt=((kt=N.results[Et])===null||kt===void 0?void 0:kt.errors)||[],Ft=l.toValue(At==null?void 0:At.path)||Et,It=su({errors:yt,valid:!yt.length},Z.results[Ft]);return Z.results[Ft]=It,It.valid||(Z.errors[Ft]=It.errors[0]),At&&h.value[Ft]&&delete h.value[Ft],At?(At.valid=It.valid,D==="silent"||D==="validated-only"&&!At.validated||p(At,It.errors),Z):(p(Ft,yt),Z)},{valid:N.valid,results:{},errors:{},source:N.source});return N.values&&(K.values=N.values,K.source=N.source),qt(K.results).forEach(Z=>{var q;const kt=I(Z);kt&&D!=="silent"&&(D==="validated-only"&&!kt.validated||p(kt,(q=K.results[Z])===null||q===void 0?void 0:q.errors))}),K});function B(N){u.value.forEach(N)}function I(N){const D=typeof N=="string"?Ti(N):N;return typeof D=="string"?f.value[D]:D}function F(N){return u.value.filter(V=>N.startsWith(l.toValue(V.path))).reduce((V,z)=>V?z.path.length>V.path.length?z:V:z,void 0)}let P=[],R;function W(N){return P.push(N),R||(R=l.nextTick(()=>{[...P].sort().reverse().forEach(V=>{lr(d,V)}),P=[],R=null})),R}function J(N){return function(V,z){return function(Z){return Z instanceof Event&&(Z.preventDefault(),Z.stopPropagation()),B(q=>q.touched=!0),o.value=!0,a.value++,ct().then(q=>{const kt=ht(d);if(q.valid&&typeof V=="function"){const Et=ht(M.value);let At=N?Et:kt;return q.values&&(At=q.source==="schema"?q.values:Object.assign({},At,q.values)),V(At,{evt:Z,controlledValues:Et,setErrors:g,setFieldError:p,setTouched:Ht,setFieldTouched:fe,setValues:Gt,setFieldValue:ut,resetForm:dt,resetField:xt})}!q.valid&&typeof z=="function"&&z({values:kt,evt:Z,errors:q.errors,results:q.results})}).then(q=>(o.value=!1,q),q=>{throw o.value=!1,q})}}}const ot=J(!1);ot.withControlled=J(!0);function nt(N,D){const V=u.value.findIndex(K=>K.path===N&&(Array.isArray(K.id)?K.id.includes(D):K.id===D)),z=u.value[V];if(!(V===-1||!z)){if(l.nextTick(()=>{Ot(N,{mode:"silent",warn:!1})}),z.multiple&&z.fieldsCount&&z.fieldsCount--,Array.isArray(z.id)){const K=z.id.indexOf(D);K>=0&&z.id.splice(K,1),delete z.__flags.pendingUnmount[D]}(!z.multiple||z.fieldsCount<=0)&&(u.value.splice(V,1),Dn(N),m(),delete f.value[N])}}function Y(N){qt(f.value).forEach(D=>{D.startsWith(N)&&delete f.value[D]}),u.value=u.value.filter(D=>!D.path.startsWith(N)),l.nextTick(()=>{m()})}const st={name:i,formId:e,values:d,controlledValues:M,errorBag:y,errors:b,schema:C,submitCount:a,meta:O,isSubmitting:o,isValidating:r,fieldArrays:c,keepValuesOnUnmount:k,validateSchema:l.unref(C)?H:void 0,validate:ct,setFieldError:p,validateField:Ot,setFieldValue:ut,setValues:Gt,setErrors:g,setFieldTouched:fe,setTouched:Ht,resetForm:dt,resetField:xt,handleSubmit:ot,useFieldModel:Es,defineInputBinds:X,defineComponentBinds:cn,defineField:Tn,stageInitialValue:oe,unsetInitialValue:Dn,setFieldInitialValue:ln,createPathState:T,getPathState:I,unsetPathValue:W,removePathState:nt,initialValues:v,getAllPathStates:()=>u.value,destroyPath:Y,isFieldTouched:j,isFieldDirty:A,isFieldValid:rt};function ut(N,D,V=!0){const z=ht(D),K=typeof N=="string"?N:N.path;I(K)||T(K),ge(d,K,z),V&&Ot(K)}function Ue(N,D=!0){qt(d).forEach(V=>{delete d[V]}),qt(N).forEach(V=>{ut(V,N[V],!1)}),D&&ct()}function Gt(N,D=!0){Mn(d,N),c.forEach(V=>V&&V.reset()),D&&ct()}function De(N,D){const V=I(l.toValue(N))||T(N);return l.computed({get(){return V.value},set(z){var K;const Z=l.toValue(N);ut(Z,z,(K=l.toValue(D))!==null&&K!==void 0?K:!1)}})}function fe(N,D){const V=I(N);V&&(V.touched=D)}function j(N){const D=I(N);return D?D.touched:u.value.filter(V=>V.path.startsWith(N)).some(V=>V.touched)}function A(N){const D=I(N);return D?D.dirty:u.value.filter(V=>V.path.startsWith(N)).some(V=>V.dirty)}function rt(N){const D=I(N);return D?D.valid:u.value.filter(V=>V.path.startsWith(N)).every(V=>V.valid)}function Ht(N){if(typeof N=="boolean"){B(D=>{D.touched=N});return}qt(N).forEach(D=>{fe(D,!!N[D])})}function xt(N,D){var V;const z=D&&"value"in D?D.value:pe(v.value,N),K=I(N);K&&(K.__flags.pendingReset=!0),ln(N,ht(z),!0),ut(N,z,!1),fe(N,(V=D==null?void 0:D.touched)!==null&&V!==void 0?V:!1),p(N,(D==null?void 0:D.errors)||[]),l.nextTick(()=>{K&&(K.__flags.pendingReset=!1)})}function dt(N,D){let V=ht(N!=null&&N.values?N.values:S.value);V=D!=null&&D.force?V:Mn(S.value,V),V=Te(C)&&Jt(C.cast)?C.cast(V):V,x(V,{force:D==null?void 0:D.force}),B(z=>{var K;z.__flags.pendingReset=!0,z.validated=!1,z.touched=((K=N==null?void 0:N.touched)===null||K===void 0?void 0:K[l.toValue(z.path)])||!1,ut(l.toValue(z.path),pe(V,l.toValue(z.path)),!1),p(l.toValue(z.path),void 0)}),D!=null&&D.force?Ue(V,!1):Gt(V,!1),g((N==null?void 0:N.errors)||{}),a.value=(N==null?void 0:N.submitCount)||0,l.nextTick(()=>{ct({mode:"silent"}),B(z=>{z.__flags.pendingReset=!1})})}async function ct(N){const D=(N==null?void 0:N.mode)||"force";if(D==="force"&&B(q=>q.validated=!0),st.validateSchema)return st.validateSchema(D);r.value=!0;const V=await Promise.all(u.value.map(q=>q.validate?q.validate(N).then(kt=>({key:l.toValue(q.path),valid:kt.valid,errors:kt.errors,value:kt.value})):Promise.resolve({key:l.toValue(q.path),valid:!0,errors:[],value:void 0})));r.value=!1;const z={},K={},Z={};for(const q of V)z[q.key]={valid:q.valid,errors:q.errors},q.value&&ge(Z,q.key,q.value),q.errors.length&&(K[q.key]=q.errors[0]);return{valid:V.every(q=>q.valid),results:z,errors:K,values:Z,source:"fields"}}async function Ot(N,D){var V;const z=I(N);return z&&(D==null?void 0:D.mode)!=="silent"&&(z.validated=!0),z!=null&&z.validate?z.validate(D):(!z&&(V=D==null?void 0:D.warn),Promise.resolve({errors:[],valid:!0}))}function Dn(N){lr(v.value,N)}function oe(N,D,V=!1){ln(N,D),ge(d,N,D),V&&ge(S.value,N,ht(D))}function ln(N,D,V=!1){ge(v.value,N,ht(D)),V&&ge(S.value,N,ht(D))}async function Nn(){const N=l.unref(C);if(!N)return{valid:!0,results:{},errors:{},source:"none"};r.value=!0;const D=ir(N)||Te(N)?await Zd(N,d):await tu(N,d,{names:_.value,bailsMap:w.value});return r.value=!1,D}const jo=ot((N,{evt:D})=>{Rd(D)&&D.target.submit()});l.onMounted(()=>{st.validateSchema&&st.validateSchema("silent")}),l.isRef(C)&&l.watch(C,()=>{var N;(N=st.validateSchema)===null||N===void 0||N.call(st,"validated-only")}),l.provide(Td,st);function Tn(N,D){const V=Jt(D)||D==null?void 0:D.label,z=I(l.toValue(N))||T(N,{label:V}),K=()=>Jt(D)?D(Mi(z,Vi)):D||{};function Z(){var yt;z.touched=!0,((yt=K().validateOnBlur)!==null&&yt!==void 0?yt:An().validateOnBlur)&&Ot(l.toValue(z.path))}function q(){var yt;((yt=K().validateOnInput)!==null&&yt!==void 0?yt:An().validateOnInput)&&l.nextTick(()=>{Ot(l.toValue(z.path))})}function kt(){var yt;((yt=K().validateOnChange)!==null&&yt!==void 0?yt:An().validateOnChange)&&l.nextTick(()=>{Ot(l.toValue(z.path))})}const Et=l.computed(()=>{const yt={onChange:kt,onInput:q,onBlur:Z};return Jt(D)?Object.assign(Object.assign({},yt),D(Mi(z,Vi)).props||{}):D!=null&&D.props?Object.assign(Object.assign({},yt),D.props(Mi(z,Vi))):yt});return[De(N,()=>{var yt,Ft,It;return(It=(yt=K().validateOnModelUpdate)!==null&&yt!==void 0?yt:(Ft=An())===null||Ft===void 0?void 0:Ft.validateOnModelUpdate)!==null&&It!==void 0?It:!0}),Et]}function Es(N){return Array.isArray(N)?N.map(D=>De(D,!0)):De(N)}function X(N,D){const[V,z]=Tn(N,D);function K(){z.value.onBlur()}function Z(kt){const Et=hr(kt);ut(l.toValue(N),Et,!1),z.value.onInput()}function q(kt){const Et=hr(kt);ut(l.toValue(N),Et,!1),z.value.onChange()}return l.computed(()=>Object.assign(Object.assign({},z.value),{onBlur:K,onInput:Z,onChange:q,value:V.value}))}function cn(N,D){const[V,z]=Tn(N,D),K=I(l.toValue(N));function Z(q){V.value=q}return l.computed(()=>{const q=Jt(D)?D(Mi(K,Vi)):D||{};return Object.assign({[q.model||"modelValue"]:V.value,[`onUpdate:${q.model||"modelValue"}`]:Z},z.value)})}const Nt=Object.assign(Object.assign({},st),{values:l.readonly(d),handleReset:()=>dt(),submitForm:jo});return l.provide(Pd,Nt),Nt}function nu(n,t,e,i){const s={touched:"some",pending:"some",valid:"every"},o=l.computed(()=>!Vn(t,l.unref(e)));function r(){const c=n.value;return qt(s).reduce((d,u)=>{const h=s[u];return d[u]=c[h](f=>f[u]),d},{})}const a=l.reactive(r());return l.watchEffect(()=>{const c=r();a.touched=c.touched,a.valid=c.valid,a.pending=c.pending}),l.computed(()=>Object.assign(Object.assign({initialValues:l.unref(e)},a),{valid:a.valid&&!qt(i.value).length,dirty:o.value}))}function iu(n,t,e){const i=gr(),s=l.ref(i),o=l.ref(ht(i));function r(a,c){c!=null&&c.force?(s.value=ht(a),o.value=ht(a)):(s.value=Mn(ht(s.value)||{},ht(a)),o.value=Mn(ht(o.value)||{},ht(a))),c!=null&&c.updateFields&&n.value.forEach(d=>{if(d.touched)return;const h=pe(s.value,l.toValue(d.path));ge(t,l.toValue(d.path),ht(h))})}return{initialValues:s,originalInitialValues:o,setInitialValues:r}}function su(n,t){return t?{valid:n.valid&&t.valid,errors:[...n.errors,...t.errors]}:n}function ou(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Vs,br;function ru(){if(br)return Vs;br=1;function n(b){this._maxSize=b,this.clear()}n.prototype.clear=function(){this._size=0,this._values=Object.create(null)},n.prototype.get=function(b){return this._values[b]},n.prototype.set=function(b,_){return this._size>=this._maxSize&&this.clear(),b in this._values||this._size++,this._values[b]=_};var t=/[^.^\]^[]+|(?=\[\]|\.\.)/g,e=/^\d+$/,i=/^\d/,s=/[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g,o=/^\s*(['"]?)(.*?)(\1)\s*$/,r=512,a=new n(r),c=new n(r),d=new n(r);Vs={Cache:n,split:h,normalizePath:u,setter:function(b){var _=u(b);return c.get(b)||c.set(b,function(E,k){for(var v=0,S=_.length,x=E;v<S-1;){var O=_[v];if(O==="__proto__"||O==="constructor"||O==="prototype")return E;x=x[_[v++]]}x[_[v]]=k})},getter:function(b,_){var w=u(b);return d.get(b)||d.set(b,function(k){for(var v=0,S=w.length;v<S;)if(k!=null||!_)k=k[w[v++]];else return;return k})},join:function(b){return b.reduce(function(_,w){return _+(m(w)||e.test(w)?"["+w+"]":(_?".":"")+w)},"")},forEach:function(b,_,w){f(Array.isArray(b)?b:h(b),_,w)}};function u(b){return a.get(b)||a.set(b,h(b).map(function(_){return _.replace(o,"$2")}))}function h(b){return b.match(t)||[""]}function f(b,_,w){var E=b.length,k,v,S,x;for(v=0;v<E;v++)k=b[v],k&&(y(k)&&(k='"'+k+'"'),x=m(k),S=!x&&/^\d+$/.test(k),_.call(w,k,x,S,v,b))}function m(b){return typeof b=="string"&&b&&["'",'"'].indexOf(b.charAt(0))!==-1}function p(b){return b.match(i)&&!b.match(e)}function g(b){return s.test(b)}function y(b){return!m(b)&&(p(b)||g(b))}return Vs}var Ye=ru(),As,_r;function au(){if(_r)return As;_r=1;const n=/[A-Z\xc0-\xd6\xd8-\xde]?[a-z\xdf-\xf6\xf8-\xff]+(?:['’](?:d|ll|m|re|s|t|ve))?(?=[\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]|[A-Z\xc0-\xd6\xd8-\xde]|$)|(?:[A-Z\xc0-\xd6\xd8-\xde]|[^\ud800-\udfff\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\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:D|LL|M|RE|S|T|VE))?(?=[\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]|[A-Z\xc0-\xd6\xd8-\xde](?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\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\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])|$)|[A-Z\xc0-\xd6\xd8-\xde]?(?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\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\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:d|ll|m|re|s|t|ve))?|[A-Z\xc0-\xd6\xd8-\xde]+(?:['’](?:D|LL|M|RE|S|T|VE))?|\d*(?:1ST|2ND|3RD|(?![123])\dTH)(?=\b|[a-z_])|\d*(?:1st|2nd|3rd|(?![123])\dth)(?=\b|[A-Z_])|\d+|(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?(?:\u200d(?:[^\ud800-\udfff]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?)*/g,t=u=>u.match(n)||[],e=u=>u[0].toUpperCase()+u.slice(1),i=(u,h)=>t(u).join(h).toLowerCase(),s=u=>t(u).reduce((h,f)=>`${h}${h?f[0].toUpperCase()+f.slice(1).toLowerCase():f.toLowerCase()}`,"");return As={words:t,upperFirst:e,camelCase:s,pascalCase:u=>e(s(u)),snakeCase:u=>i(u,"_"),kebabCase:u=>i(u,"-"),sentenceCase:u=>e(i(u," ")),titleCase:u=>t(u).map(e).join(" ")},As}var Fs=au(),Ai={exports:{}},xr;function lu(){if(xr)return Ai.exports;xr=1,Ai.exports=function(s){return n(t(s),s)},Ai.exports.array=n;function n(s,o){var r=s.length,a=new Array(r),c={},d=r,u=e(o),h=i(s);for(o.forEach(function(m){if(!h.has(m[0])||!h.has(m[1]))throw new Error("Unknown node. There is an unknown node in the supplied edges.")});d--;)c[d]||f(s[d],d,new Set);return a;function f(m,p,g){if(g.has(m)){var y;try{y=", node was:"+JSON.stringify(m)}catch{y=""}throw new Error("Cyclic dependency"+y)}if(!h.has(m))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(m));if(!c[p]){c[p]=!0;var b=u.get(m)||new Set;if(b=Array.from(b),p=b.length){g.add(m);do{var _=b[--p];f(_,h.get(_),g)}while(p);g.delete(m)}a[--r]=m}}}function t(s){for(var o=new Set,r=0,a=s.length;r<a;r++){var c=s[r];o.add(c[0]),o.add(c[1])}return Array.from(o)}function e(s){for(var o=new Map,r=0,a=s.length;r<a;r++){var c=s[r];o.has(c[0])||o.set(c[0],new Set),o.has(c[1])||o.set(c[1],new Set),o.get(c[0]).add(c[1])}return o}function i(s){for(var o=new Map,r=0,a=s.length;r<a;r++)o.set(s[r],r);return o}return Ai.exports}var cu=lu();const du=ou(cu),uu=Object.prototype.toString,hu=Error.prototype.toString,fu=RegExp.prototype.toString,mu=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",pu=/^Symbol\((.*)\)(.*)$/;function gu(n){return n!=+n?"NaN":n===0&&1/n<0?"-0":""+n}function kr(n,t=!1){if(n==null||n===!0||n===!1)return""+n;const e=typeof n;if(e==="number")return gu(n);if(e==="string")return t?`"${n}"`:n;if(e==="function")return"[Function "+(n.name||"anonymous")+"]";if(e==="symbol")return mu.call(n).replace(pu,"Symbol($1)");const i=uu.call(n).slice(8,-1);return i==="Date"?isNaN(n.getTime())?""+n:n.toISOString(n):i==="Error"||n instanceof Error?"["+hu.call(n)+"]":i==="RegExp"?fu.call(n):null}function Pe(n,t){let e=kr(n,t);return e!==null?e:JSON.stringify(n,function(i,s){let o=kr(this[i],t);return o!==null?o:s},2)}function Sr(n){return n==null?[]:[].concat(n)}let wr,Er,vr,yu=/\$\{\s*(\w+)\s*\}/g;wr=Symbol.toStringTag;class Cr{constructor(t,e,i,s){this.name=void 0,this.message=void 0,this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=void 0,this.inner=void 0,this[wr]="Error",this.name="ValidationError",this.value=e,this.path=i,this.type=s,this.errors=[],this.inner=[],Sr(t).forEach(o=>{if(Bt.isError(o)){this.errors.push(...o.errors);const r=o.inner.length?o.inner:[o];this.inner.push(...r)}else this.errors.push(o)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0]}}Er=Symbol.hasInstance,vr=Symbol.toStringTag;class Bt extends Error{static formatError(t,e){const i=e.label||e.path||"this";return e=Object.assign({},e,{path:i,originalPath:e.path}),typeof t=="string"?t.replace(yu,(s,o)=>Pe(e[o])):typeof t=="function"?t(e):t}static isError(t){return t&&t.name==="ValidationError"}constructor(t,e,i,s,o){const r=new Cr(t,e,i,s);if(o)return r;super(),this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=[],this.inner=[],this[vr]="Error",this.name=r.name,this.message=r.message,this.type=r.type,this.value=r.value,this.path=r.path,this.errors=r.errors,this.inner=r.inner,Error.captureStackTrace&&Error.captureStackTrace(this,Bt)}static[Er](t){return Cr[Symbol.hasInstance](t)||super[Symbol.hasInstance](t)}}let re={default:"${path} is invalid",required:"${path} is a required field",defined:"${path} must be defined",notNull:"${path} cannot be null",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:n,type:t,value:e,originalValue:i})=>{const s=i!=null&&i!==e?` (cast from the value \`${Pe(i,!0)}\`).`:".";return t!=="mixed"?`${n} must be a \`${t}\` type, but the final value was: \`${Pe(e,!0)}\``+s:`${n} must match the configured type. The validated value was: \`${Pe(e,!0)}\``+s}},$t={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",datetime:"${path} must be a valid ISO date-time",datetime_precision:"${path} must be a valid ISO date-time with a sub-second precision of exactly ${precision} digits",datetime_offset:'${path} must be a valid ISO date-time with UTC "Z" timezone',trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},bu={min:"${path} must be greater than or equal to ${min}",max:"${path} must be less than or equal to ${max}",lessThan:"${path} must be less than ${less}",moreThan:"${path} must be greater than ${more}",positive:"${path} must be a positive number",negative:"${path} must be a negative number",integer:"${path} must be an integer"},Bs={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},_u={isValue:"${path} field must be ${value}"},Fi={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"};Object.assign(Object.create(null),{mixed:re,string:$t,number:bu,date:Bs,object:Fi,array:{min:"${path} field must have at least ${min} items",max:"${path} field must have less than or equal to ${max} items",length:"${path} must have ${length} items"},boolean:_u,tuple:{notType:n=>{const{path:t,value:e,spec:i}=n,s=i.types.length;if(Array.isArray(e)){if(e.length<s)return`${t} tuple value has too few items, expected a length of ${s} but got ${e.length} for value: \`${Pe(e,!0)}\``;if(e.length>s)return`${t} tuple value has too many items, expected a length of ${s} but got ${e.length} for value: \`${Pe(e,!0)}\``}return Bt.formatError(re.notType,n)}}});const $s=n=>n&&n.__isYupSchema__;class Bi{static fromOptions(t,e){if(!e.then&&!e.otherwise)throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");let{is:i,then:s,otherwise:o}=e,r=typeof i=="function"?i:(...a)=>a.every(c=>c===i);return new Bi(t,(a,c)=>{var d;let u=r(...a)?s:o;return(d=u==null?void 0:u(c))!=null?d:c})}constructor(t,e){this.fn=void 0,this.refs=t,this.refs=t,this.fn=e}resolve(t,e){let i=this.refs.map(o=>o.getValue(e==null?void 0:e.value,e==null?void 0:e.parent,e==null?void 0:e.context)),s=this.fn(i,t,e);if(s===void 0||s===t)return t;if(!$s(s))throw new TypeError("conditions must return a schema object");return s.resolve(e)}}const $i={context:"$",value:"."};class Ke{constructor(t,e={}){if(this.key=void 0,this.isContext=void 0,this.isValue=void 0,this.isSibling=void 0,this.path=void 0,this.getter=void 0,this.map=void 0,typeof t!="string")throw new TypeError("ref must be a string, got: "+t);if(this.key=t.trim(),t==="")throw new TypeError("ref must be a non-empty string");this.isContext=this.key[0]===$i.context,this.isValue=this.key[0]===$i.value,this.isSibling=!this.isContext&&!this.isValue;let i=this.isContext?$i.context:this.isValue?$i.value:"";this.path=this.key.slice(i.length),this.getter=this.path&&Ye.getter(this.path,!0),this.map=e.map}getValue(t,e,i){let s=this.isContext?i:this.isValue?t:e;return this.getter&&(s=this.getter(s||{})),this.map&&(s=this.map(s)),s}cast(t,e){return this.getValue(t,e==null?void 0:e.parent,e==null?void 0:e.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(t){return t&&t.__isYupRef}}Ke.prototype.__isYupRef=!0;const Xe=n=>n==null;function hn(n){function t({value:e,path:i="",options:s,originalValue:o,schema:r},a,c){const{name:d,test:u,params:h,message:f,skipAbsent:m}=n;let{parent:p,context:g,abortEarly:y=r.spec.abortEarly,disableStackTrace:b=r.spec.disableStackTrace}=s;function _(C){return Ke.isRef(C)?C.getValue(e,p,g):C}function w(C={}){const T=Object.assign({value:e,originalValue:o,label:r.spec.label,path:C.path||i,spec:r.spec,disableStackTrace:C.disableStackTrace||b},h,C.params);for(const U of Object.keys(T))T[U]=_(T[U]);const $=new Bt(Bt.formatError(C.message||f,T),e,T.path,C.type||d,T.disableStackTrace);return $.params=T,$}const E=y?a:c;let k={path:i,parent:p,type:d,from:s.from,createError:w,resolve:_,options:s,originalValue:o,schema:r};const v=C=>{Bt.isError(C)?E(C):C?c(null):E(w())},S=C=>{Bt.isError(C)?E(C):a(C)};if(m&&Xe(e))return v(!0);let O;try{var M;if(O=u.call(k,e,k),typeof((M=O)==null?void 0:M.then)=="function"){if(s.sync)throw new Error(`Validation test of type: "${k.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve(O).then(v,S)}}catch(C){S(C);return}v(O)}return t.OPTIONS=n,t}function xu(n,t,e,i=e){let s,o,r;return t?(Ye.forEach(t,(a,c,d)=>{let u=c?a.slice(1,a.length-1):a;n=n.resolve({context:i,parent:s,value:e});let h=n.type==="tuple",f=d?parseInt(u,10):0;if(n.innerType||h){if(h&&!d)throw new Error(`Yup.reach cannot implicitly index into a tuple type. the path part "${r}" must contain an index to the tuple element, e.g. "${r}[0]"`);if(e&&f>=e.length)throw new Error(`Yup.reach cannot resolve an array item at index: ${a}, in the path: ${t}. because there is no value at that index. `);s=e,e=e&&e[f],n=h?n.spec.types[f]:n.innerType}if(!d){if(!n.fields||!n.fields[u])throw new Error(`The schema does not contain the path: ${t}. (failed at: ${r} which is a type: "${n.type}")`);s=e,e=e&&e[u],n=n.fields[u]}o=u,r=c?"["+a+"]":"."+a}),{schema:n,parent:s,parentPath:o}):{parent:s,parentPath:t,schema:n}}class Ri extends Set{describe(){const t=[];for(const e of this.values())t.push(Ke.isRef(e)?e.describe():e);return t}resolveAll(t){let e=[];for(const i of this.values())e.push(t(i));return e}clone(){return new Ri(this.values())}merge(t,e){const i=this.clone();return t.forEach(s=>i.add(s)),e.forEach(s=>i.delete(s)),i}}function fn(n,t=new Map){if($s(n)||!n||typeof n!="object")return n;if(t.has(n))return t.get(n);let e;if(n instanceof Date)e=new Date(n.getTime()),t.set(n,e);else if(n instanceof RegExp)e=new RegExp(n),t.set(n,e);else if(Array.isArray(n)){e=new Array(n.length),t.set(n,e);for(let i=0;i<n.length;i++)e[i]=fn(n[i],t)}else if(n instanceof Map){e=new Map,t.set(n,e);for(const[i,s]of n.entries())e.set(i,fn(s,t))}else if(n instanceof Set){e=new Set,t.set(n,e);for(const i of n)e.add(fn(i,t))}else if(n instanceof Object){e={},t.set(n,e);for(const[i,s]of Object.entries(n))e[i]=fn(s,t)}else throw Error(`Unable to clone ${n}`);return e}class ae{constructor(t){this.type=void 0,this.deps=[],this.tests=void 0,this.transforms=void 0,this.conditions=[],this._mutate=void 0,this.internalTests={},this._whitelist=new Ri,this._blacklist=new Ri,this.exclusiveTests=Object.create(null),this._typeCheck=void 0,this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(re.notType)}),this.type=t.type,this._typeCheck=t.check,this.spec=Object.assign({strip:!1,strict:!1,abortEarly:!0,recursive:!0,disableStackTrace:!1,nullable:!1,optional:!0,coerce:!0},t==null?void 0:t.spec),this.withMutation(e=>{e.nonNullable()})}get _type(){return this.type}clone(t){if(this._mutate)return t&&Object.assign(this.spec,t),this;const e=Object.create(Object.getPrototypeOf(this));return e.type=this.type,e._typeCheck=this._typeCheck,e._whitelist=this._whitelist.clone(),e._blacklist=this._blacklist.clone(),e.internalTests=Object.assign({},this.internalTests),e.exclusiveTests=Object.assign({},this.exclusiveTests),e.deps=[...this.deps],e.conditions=[...this.conditions],e.tests=[...this.tests],e.transforms=[...this.transforms],e.spec=fn(Object.assign({},this.spec,t)),e}label(t){let e=this.clone();return e.spec.label=t,e}meta(...t){if(t.length===0)return this.spec.meta;let e=this.clone();return e.spec.meta=Object.assign(e.spec.meta||{},t[0]),e}withMutation(t){let e=this._mutate;this._mutate=!0;let i=t(this);return this._mutate=e,i}concat(t){if(!t||t===this)return this;if(t.type!==this.type&&this.type!=="mixed")throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${t.type}`);let e=this,i=t.clone();const s=Object.assign({},e.spec,i.spec);return i.spec=s,i.internalTests=Object.assign({},e.internalTests,i.internalTests),i._whitelist=e._whitelist.merge(t._whitelist,t._blacklist),i._blacklist=e._blacklist.merge(t._blacklist,t._whitelist),i.tests=e.tests,i.exclusiveTests=e.exclusiveTests,i.withMutation(o=>{t.tests.forEach(r=>{o.test(r.OPTIONS)})}),i.transforms=[...e.transforms,...i.transforms],i}isType(t){return t==null?!!(this.spec.nullable&&t===null||this.spec.optional&&t===void 0):this._typeCheck(t)}resolve(t){let e=this;if(e.conditions.length){let i=e.conditions;e=e.clone(),e.conditions=[],e=i.reduce((s,o)=>o.resolve(s,t),e),e=e.resolve(t)}return e}resolveOptions(t){var e,i,s,o;return Object.assign({},t,{from:t.from||[],strict:(e=t.strict)!=null?e:this.spec.strict,abortEarly:(i=t.abortEarly)!=null?i:this.spec.abortEarly,recursive:(s=t.recursive)!=null?s:this.spec.recursive,disableStackTrace:(o=t.disableStackTrace)!=null?o:this.spec.disableStackTrace})}cast(t,e={}){let i=this.resolve(Object.assign({value:t},e)),s=e.assert==="ignore-optionality",o=i._cast(t,e);if(e.assert!==!1&&!i.isType(o)){if(s&&Xe(o))return o;let r=Pe(t),a=Pe(o);throw new TypeError(`The value of ${e.path||"field"} could not be cast to a value that satisfies the schema type: "${i.type}".
|
|
9
|
+
*/function Jt(n){return typeof n=="function"}function ir(n){return n==null}const un=n=>n!==null&&!!n&&typeof n=="object"&&!Array.isArray(n);function Ps(n){return Number(n)>=0}function Md(n){return typeof n=="object"&&n!==null}function Vd(n){return n==null?n===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(n)}function sr(n){if(!Md(n)||Vd(n)!=="[object Object]")return!1;if(Object.getPrototypeOf(n)===null)return!0;let t=n;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(n)===t}function Mn(n,t){return Object.keys(t).forEach(e=>{if(sr(t[e])&&sr(n[e])){n[e]||(n[e]={}),Mn(n[e],t[e]);return}n[e]=t[e]}),n}function Ti(n){const t=n.split(".");if(!t.length)return"";let e=String(t[0]);for(let i=1;i<t.length;i++){if(Ps(t[i])){e+=`[${t[i]}]`;continue}e+=`.${t[i]}`}return e}const Ad={};function Bd(n){return Ad[n]}function or(n,t,e){typeof e.value=="object"&&(e.value=ht(e.value)),!e.enumerable||e.get||e.set||!e.configurable||!e.writable||t==="__proto__"?Object.defineProperty(n,t,e):n[t]=e.value}function ht(n){if(typeof n!="object")return n;var t=0,e,i,s,o=Object.prototype.toString.call(n);if(o==="[object Object]"?s=Object.create(n.__proto__||null):o==="[object Array]"?s=Array(n.length):o==="[object Set]"?(s=new Set,n.forEach(function(r){s.add(ht(r))})):o==="[object Map]"?(s=new Map,n.forEach(function(r,l){s.set(ht(l),ht(r))})):o==="[object Date]"?s=new Date(+n):o==="[object RegExp]"?s=new RegExp(n.source,n.flags):o==="[object DataView]"?s=new n.constructor(ht(n.buffer)):o==="[object ArrayBuffer]"?s=n.slice(0):o.slice(-6)==="Array]"&&(s=new n.constructor(n)),s){for(i=Object.getOwnPropertySymbols(n);t<i.length;t++)or(s,i[t],Object.getOwnPropertyDescriptor(n,i[t]));for(t=0,i=Object.getOwnPropertyNames(n);t<i.length;t++)Object.hasOwnProperty.call(s,e=i[t])&&s[e]===n[e]||or(s,e,Object.getOwnPropertyDescriptor(n,e))}return s||n}const Fd=Symbol("vee-validate-form"),$d=Symbol("vee-validate-form-context"),Rd=typeof window<"u";function Ld(n){return Jt(n)&&!!n.__locatorRef}function Te(n){return!!n&&Jt(n.parse)&&n.__type==="VVTypedSchema"}function rr(n){return!!n&&Jt(n.validate)}function Id(n){return n==="checkbox"||n==="radio"}function jd(n){return un(n)||Array.isArray(n)}function zd(n){return Array.isArray(n)?n.length===0:un(n)&&Object.keys(n).length===0}function Pi(n){return/^\[.+\]$/i.test(n)}function Wd(n){return ar(n)&&n.multiple}function ar(n){return n.tagName==="SELECT"}function Hd(n){return lr(n)&&n.target&&"submit"in n.target}function lr(n){return n?!!(typeof Event<"u"&&Jt(Event)&&n instanceof Event||n&&n.srcElement):!1}function Vn(n,t){if(n===t)return!0;if(n&&t&&typeof n=="object"&&typeof t=="object"){if(n.constructor!==t.constructor)return!1;var e,i,s;if(Array.isArray(n)){if(e=n.length,e!=t.length)return!1;for(i=e;i--!==0;)if(!Vn(n[i],t[i]))return!1;return!0}if(n instanceof Map&&t instanceof Map){if(n.size!==t.size)return!1;for(i of n.entries())if(!t.has(i[0]))return!1;for(i of n.entries())if(!Vn(i[1],t.get(i[0])))return!1;return!0}if(dr(n)&&dr(t))return!(n.size!==t.size||n.name!==t.name||n.lastModified!==t.lastModified||n.type!==t.type);if(n instanceof Set&&t instanceof Set){if(n.size!==t.size)return!1;for(i of n.entries())if(!t.has(i[0]))return!1;return!0}if(ArrayBuffer.isView(n)&&ArrayBuffer.isView(t)){if(e=n.length,e!=t.length)return!1;for(i=e;i--!==0;)if(n[i]!==t[i])return!1;return!0}if(n.constructor===RegExp)return n.source===t.source&&n.flags===t.flags;if(n.valueOf!==Object.prototype.valueOf)return n.valueOf()===t.valueOf();if(n.toString!==Object.prototype.toString)return n.toString()===t.toString();if(s=Object.keys(n),e=s.length-cr(n,s),e!==Object.keys(t).length-cr(t,Object.keys(t)))return!1;for(i=e;i--!==0;)if(!Object.prototype.hasOwnProperty.call(t,s[i]))return!1;for(i=e;i--!==0;){var o=s[i];if(!Vn(n[o],t[o]))return!1}return!0}return n!==n&&t!==t}function cr(n,t){let e=0;for(let s=t.length;s--!==0;){var i=t[s];n[i]===void 0&&e++}return e}function dr(n){return Rd?n instanceof File:!1}function Ms(n){return Pi(n)?n.replace(/\[|\]/gi,""):n}function pe(n,t,e){return n?Pi(t)?n[Ms(t)]:(t||"").split(/\.|\[(\d+)\]/).filter(Boolean).reduce((s,o)=>jd(s)&&o in s?s[o]:e,n):e}function ge(n,t,e){if(Pi(t)){n[Ms(t)]=e;return}const i=t.split(/\.|\[(\d+)\]/).filter(Boolean);let s=n;for(let o=0;o<i.length;o++){if(o===i.length-1){s[i[o]]=e;return}(!(i[o]in s)||ir(s[i[o]]))&&(s[i[o]]=Ps(i[o+1])?[]:{}),s=s[i[o]]}}function Vs(n,t){if(Array.isArray(n)&&Ps(t)){n.splice(Number(t),1);return}un(n)&&delete n[t]}function ur(n,t){if(Pi(t)){delete n[Ms(t)];return}const e=t.split(/\.|\[(\d+)\]/).filter(Boolean);let i=n;for(let o=0;o<e.length;o++){if(o===e.length-1){Vs(i,e[o]);break}if(!(e[o]in i)||ir(i[e[o]]))break;i=i[e[o]]}const s=e.map((o,r)=>pe(n,e.slice(0,r).join(".")));for(let o=s.length-1;o>=0;o--)if(zd(s[o])){if(o===0){Vs(n,e[0]);continue}Vs(s[o-1],e[o-1])}}function qt(n){return Object.keys(n)}function hr(n,t=0){let e=null,i=[];return function(...s){return e&&clearTimeout(e),e=setTimeout(()=>{const o=n(...s);i.forEach(r=>r(o)),i=[]},t),new Promise(o=>i.push(o))}}function Ud(n,t){let e;return async function(...s){const o=n(...s);e=o;const r=await o;return o!==e?r:(e=void 0,t(r,s))}}function fr(n){return Array.isArray(n)?n:n?[n]:[]}function Mi(n,t){const e={};for(const i in n)t.includes(i)||(e[i]=n[i]);return e}function qd(n){let t=null,e=[];return function(...i){const s=a.nextTick(()=>{if(t!==s)return;const o=n(...i);e.forEach(r=>r(o)),e=[],t=null});return t=s,new Promise(o=>e.push(o))}}function As(n){if(mr(n))return n._value}function mr(n){return"_value"in n}function Yd(n){return n.type==="number"||n.type==="range"?Number.isNaN(n.valueAsNumber)?n.value:n.valueAsNumber:n.value}function pr(n){if(!lr(n))return n;const t=n.target;if(Id(t.type)&&mr(t))return As(t);if(t.type==="file"&&t.files){const e=Array.from(t.files);return t.multiple?e:e[0]}if(Wd(t))return Array.from(t.options).filter(e=>e.selected&&!e.disabled).map(As);if(ar(t)){const e=Array.from(t.options).find(i=>i.selected);return e?As(e):t.value}return Yd(t)}function Kd(n){const t={};return Object.defineProperty(t,"_$$isNormalized",{value:!0,writable:!1,enumerable:!1,configurable:!1}),n?un(n)&&n._$$isNormalized?n:un(n)?Object.keys(n).reduce((e,i)=>{const s=Xd(n[i]);return n[i]!==!1&&(e[i]=gr(s)),e},t):typeof n!="string"?t:n.split("|").reduce((e,i)=>{const s=Gd(i);return s.name&&(e[s.name]=gr(s.params)),e},t):t}function Xd(n){return n===!0?[]:Array.isArray(n)||un(n)?n:[n]}function gr(n){const t=e=>typeof e=="string"&&e[0]==="@"?Qd(e.slice(1)):e;return Array.isArray(n)?n.map(t):n instanceof RegExp?[n]:Object.keys(n).reduce((e,i)=>(e[i]=t(n[i]),e),{})}const Gd=n=>{let t=[];const e=n.split(":")[0];return n.includes(":")&&(t=n.split(":").slice(1).join(":").split(",")),{name:e,params:t}};function Qd(n){const t=e=>{var i;return(i=pe(e,n))!==null&&i!==void 0?i:e[n]};return t.__locatorRef=n,t}let Jd=Object.assign({},{generateMessage:({field:n})=>`${n} is not valid.`,bails:!0,validateOnBlur:!0,validateOnChange:!0,validateOnInput:!1,validateOnModelUpdate:!0});const An=()=>Jd;async function Zd(n,t,e={}){const i=e==null?void 0:e.bails,s={name:(e==null?void 0:e.name)||"{field}",rules:t,label:e==null?void 0:e.label,bails:i??!0,formData:(e==null?void 0:e.values)||{}},o=await tu(s,n);return Object.assign(Object.assign({},o),{valid:!o.errors.length})}async function tu(n,t){const e=n.rules;if(Te(e)||rr(e))return nu(t,Object.assign(Object.assign({},n),{rules:e}));if(Jt(e)||Array.isArray(e)){const l={field:n.label||n.name,name:n.name,label:n.label,form:n.formData,value:t},c=Array.isArray(e)?e:[e],d=c.length,u=[];for(let h=0;h<d;h++){const f=c[h],m=await f(t,l);if(!(typeof m!="string"&&!Array.isArray(m)&&m)){if(Array.isArray(m))u.push(...m);else{const g=typeof m=="string"?m:br(l);u.push(g)}if(n.bails)return{errors:u}}}return{errors:u}}const i=Object.assign(Object.assign({},n),{rules:Kd(e)}),s=[],o=Object.keys(i.rules),r=o.length;for(let l=0;l<r;l++){const c=o[l],d=await iu(i,t,{name:c,params:i.rules[c]});if(d.error&&(s.push(d.error),n.bails))return{errors:s}}return{errors:s}}function eu(n){return!!n&&n.name==="ValidationError"}function yr(n){return{__type:"VVTypedSchema",async parse(e,i){var s;try{return{output:await n.validate(e,{abortEarly:!1,context:(i==null?void 0:i.formData)||{}}),errors:[]}}catch(o){if(!eu(o))throw o;if(!(!((s=o.inner)===null||s===void 0)&&s.length)&&o.errors.length)return{errors:[{path:o.path,errors:o.errors}]};const r=o.inner.reduce((l,c)=>{const d=c.path||"";return l[d]||(l[d]={errors:[],path:d}),l[d].errors.push(...c.errors),l},{});return{errors:Object.values(r)}}}}}async function nu(n,t){const i=await(Te(t.rules)?t.rules:yr(t.rules)).parse(n,{formData:t.formData}),s=[];for(const o of i.errors)o.errors.length&&s.push(...o.errors);return{value:i.value,errors:s}}async function iu(n,t,e){const i=Bd(e.name);if(!i)throw new Error(`No such validator '${e.name}' exists.`);const s=su(e.params,n.formData),o={field:n.label||n.name,name:n.name,label:n.label,value:t,form:n.formData,rule:Object.assign(Object.assign({},e),{params:s})},r=await i(t,s,o);return typeof r=="string"?{error:r}:{error:r?void 0:br(o)}}function br(n){const t=An().generateMessage;return t?t(n):"Field is invalid"}function su(n,t){const e=i=>Ld(i)?i(t):i;return Array.isArray(n)?n.map(e):Object.keys(n).reduce((i,s)=>(i[s]=e(n[s]),i),{})}async function ou(n,t){const i=await(Te(n)?n:yr(n)).parse(ht(t),{formData:ht(t)}),s={},o={};for(const r of i.errors){const l=r.errors,c=(r.path||"").replace(/\["(\d+)"\]/g,(d,u)=>`[${u}]`);s[c]={valid:!l.length,errors:l},l.length&&(o[c]=l[0])}return{valid:!i.errors.length,results:s,errors:o,values:i.value,source:"schema"}}async function ru(n,t,e){const s=qt(n).map(async d=>{var u,h,f;const m=(u=e==null?void 0:e.names)===null||u===void 0?void 0:u[d],p=await Zd(pe(t,d),n[d],{name:(m==null?void 0:m.name)||d,label:m==null?void 0:m.label,values:t,bails:(f=(h=e==null?void 0:e.bailsMap)===null||h===void 0?void 0:h[d])!==null&&f!==void 0?f:!0});return Object.assign(Object.assign({},p),{path:d})});let o=!0;const r=await Promise.all(s),l={},c={};for(const d of r)l[d.path]={valid:d.valid,errors:d.errors},d.valid||(o=!1,c[d.path]=d.errors[0]);return{valid:o,results:l,errors:c,source:"schema"}}let au=0;const Vi=["bails","fieldsCount","id","multiple","type","validate"];function _r(n){const t={},e=Object.assign({},a.toValue(t)),i=a.unref(void 0);return i&&Te(i)&&Jt(i.cast)?ht(i.cast(e)||{}):ht(e)}function xr(n){var t;const e=au++,i="Form";let s=0;const o=a.ref(!1),r=a.ref(!1),l=a.ref(0),c=[],d=a.reactive(_r()),u=a.ref([]),h=a.ref({}),f=a.ref({}),m=qd(()=>{f.value=u.value.reduce((N,D)=>(N[Ti(a.toValue(D.path))]=D,N),{})});function p(N,D){const V=I(N);if(!V){typeof N=="string"&&(h.value[Ti(N)]=fr(D));return}if(typeof N=="string"){const z=Ti(N);h.value[z]&&delete h.value[z]}V.errors=fr(D),V.valid=!V.errors.length}function g(N){qt(N).forEach(D=>{p(D,N[D])})}const y=a.computed(()=>{const N=u.value.reduce((D,V)=>(V.errors.length&&(D[a.toValue(V.path)]=V.errors),D),{});return Object.assign(Object.assign({},h.value),N)}),b=a.computed(()=>qt(y.value).reduce((N,D)=>{const V=y.value[D];return V!=null&&V.length&&(N[D]=V[0]),N},{})),_=a.computed(()=>u.value.reduce((N,D)=>(N[a.toValue(D.path)]={name:a.toValue(D.path)||"",label:D.label||""},N),{})),w=a.computed(()=>u.value.reduce((N,D)=>{var V;return N[a.toValue(D.path)]=(V=D.bails)!==null&&V!==void 0?V:!0,N},{})),E=Object.assign({},{}),k=(t=void 0)!==null&&t!==void 0?t:!1,{initialValues:C,originalInitialValues:S,setInitialValues:x}=cu(u,d),O=lu(u,d,S,b),M=a.computed(()=>u.value.reduce((N,D)=>{const V=pe(d,a.toValue(D.path));return ge(N,a.toValue(D.path),V),N},{})),v=void 0;function T(N,D){var V,z;const K=a.computed(()=>pe(C.value,a.toValue(N))),Z=f.value[a.toValue(N)],q=(D==null?void 0:D.type)==="checkbox"||(D==null?void 0:D.type)==="radio";if(Z&&q){Z.multiple=!0;const Qt=s++;return Array.isArray(Z.id)?Z.id.push(Qt):Z.id=[Z.id,Qt],Z.fieldsCount++,Z.__flags.pendingUnmount[Qt]=!1,Z}const kt=a.computed(()=>pe(d,a.toValue(N))),Et=a.toValue(N),At=P.findIndex(Qt=>Qt===Et);At!==-1&&P.splice(At,1);const yt=a.computed(()=>{var Qt,vi,Uo,qo;const Yo=a.toValue(v);if(Te(Yo))return(vi=(Qt=Yo.describe)===null||Qt===void 0?void 0:Qt.call(Yo,a.toValue(N)).required)!==null&&vi!==void 0?vi:!1;const Ko=a.toValue(D==null?void 0:D.schema);return Te(Ko)&&(qo=(Uo=Ko.describe)===null||Uo===void 0?void 0:Uo.call(Ko).required)!==null&&qo!==void 0?qo:!1}),Bt=s++,jt=a.reactive({id:Bt,path:N,touched:!1,pending:!1,valid:!0,validated:!!(!((V=E[Et])===null||V===void 0)&&V.length),required:yt,initialValue:K,errors:a.shallowRef([]),bails:(z=D==null?void 0:D.bails)!==null&&z!==void 0?z:!1,label:D==null?void 0:D.label,type:(D==null?void 0:D.type)||"default",value:kt,multiple:!1,__flags:{pendingUnmount:{[Bt]:!1},pendingReset:!1},fieldsCount:1,validate:D==null?void 0:D.validate,dirty:a.computed(()=>!Vn(a.unref(kt),a.unref(K)))});return u.value.push(jt),f.value[Et]=jt,m(),b.value[Et]&&!E[Et]&&a.nextTick(()=>{Ot(Et,{mode:"silent"})}),a.isRef(N)&&a.watch(N,Qt=>{m();const vi=ht(kt.value);f.value[Qt]=jt,a.nextTick(()=>{ge(d,Qt,vi)})}),jt}const $=hr(Nn,5),U=hr(Nn,5),H=Ud(async N=>await(N==="silent"?$():U()),(N,[D])=>{const V=qt(st.errorBag.value),K=[...new Set([...qt(N.results),...u.value.map(Z=>Z.path),...V])].sort().reduce((Z,q)=>{var kt;const Et=q,At=I(Et)||B(Et),yt=((kt=N.results[Et])===null||kt===void 0?void 0:kt.errors)||[],Bt=a.toValue(At==null?void 0:At.path)||Et,jt=du({errors:yt,valid:!yt.length},Z.results[Bt]);return Z.results[Bt]=jt,jt.valid||(Z.errors[Bt]=jt.errors[0]),At&&h.value[Bt]&&delete h.value[Bt],At?(At.valid=jt.valid,D==="silent"||D==="validated-only"&&!At.validated||p(At,jt.errors),Z):(p(Bt,yt),Z)},{valid:N.valid,results:{},errors:{},source:N.source});return N.values&&(K.values=N.values,K.source=N.source),qt(K.results).forEach(Z=>{var q;const kt=I(Z);kt&&D!=="silent"&&(D==="validated-only"&&!kt.validated||p(kt,(q=K.results[Z])===null||q===void 0?void 0:q.errors))}),K});function F(N){u.value.forEach(N)}function I(N){const D=typeof N=="string"?Ti(N):N;return typeof D=="string"?f.value[D]:D}function B(N){return u.value.filter(V=>N.startsWith(a.toValue(V.path))).reduce((V,z)=>V?z.path.length>V.path.length?z:V:z,void 0)}let P=[],R;function W(N){return P.push(N),R||(R=a.nextTick(()=>{[...P].sort().reverse().forEach(V=>{ur(d,V)}),P=[],R=null})),R}function J(N){return function(V,z){return function(Z){return Z instanceof Event&&(Z.preventDefault(),Z.stopPropagation()),F(q=>q.touched=!0),o.value=!0,l.value++,ct().then(q=>{const kt=ht(d);if(q.valid&&typeof V=="function"){const Et=ht(M.value);let At=N?Et:kt;return q.values&&(At=q.source==="schema"?q.values:Object.assign({},At,q.values)),V(At,{evt:Z,controlledValues:Et,setErrors:g,setFieldError:p,setTouched:Ht,setFieldTouched:me,setValues:Gt,setFieldValue:ut,resetForm:dt,resetField:xt})}!q.valid&&typeof z=="function"&&z({values:kt,evt:Z,errors:q.errors,results:q.results})}).then(q=>(o.value=!1,q),q=>{throw o.value=!1,q})}}}const ot=J(!1);ot.withControlled=J(!0);function nt(N,D){const V=u.value.findIndex(K=>K.path===N&&(Array.isArray(K.id)?K.id.includes(D):K.id===D)),z=u.value[V];if(!(V===-1||!z)){if(a.nextTick(()=>{Ot(N,{mode:"silent",warn:!1})}),z.multiple&&z.fieldsCount&&z.fieldsCount--,Array.isArray(z.id)){const K=z.id.indexOf(D);K>=0&&z.id.splice(K,1),delete z.__flags.pendingUnmount[D]}(!z.multiple||z.fieldsCount<=0)&&(u.value.splice(V,1),Dn(N),m(),delete f.value[N])}}function Y(N){qt(f.value).forEach(D=>{D.startsWith(N)&&delete f.value[D]}),u.value=u.value.filter(D=>!D.path.startsWith(N)),a.nextTick(()=>{m()})}const st={name:i,formId:e,values:d,controlledValues:M,errorBag:y,errors:b,schema:v,submitCount:l,meta:O,isSubmitting:o,isValidating:r,fieldArrays:c,keepValuesOnUnmount:k,validateSchema:a.unref(v)?H:void 0,validate:ct,setFieldError:p,validateField:Ot,setFieldValue:ut,setValues:Gt,setErrors:g,setFieldTouched:me,setTouched:Ht,resetForm:dt,resetField:xt,handleSubmit:ot,useFieldModel:vs,defineInputBinds:X,defineComponentBinds:cn,defineField:Tn,stageInitialValue:oe,unsetInitialValue:Dn,setFieldInitialValue:ln,createPathState:T,getPathState:I,unsetPathValue:W,removePathState:nt,initialValues:C,getAllPathStates:()=>u.value,destroyPath:Y,isFieldTouched:j,isFieldDirty:A,isFieldValid:rt};function ut(N,D,V=!0){const z=ht(D),K=typeof N=="string"?N:N.path;I(K)||T(K),ge(d,K,z),V&&Ot(K)}function Ue(N,D=!0){qt(d).forEach(V=>{delete d[V]}),qt(N).forEach(V=>{ut(V,N[V],!1)}),D&&ct()}function Gt(N,D=!0){Mn(d,N),c.forEach(V=>V&&V.reset()),D&&ct()}function De(N,D){const V=I(a.toValue(N))||T(N);return a.computed({get(){return V.value},set(z){var K;const Z=a.toValue(N);ut(Z,z,(K=a.toValue(D))!==null&&K!==void 0?K:!1)}})}function me(N,D){const V=I(N);V&&(V.touched=D)}function j(N){const D=I(N);return D?D.touched:u.value.filter(V=>V.path.startsWith(N)).some(V=>V.touched)}function A(N){const D=I(N);return D?D.dirty:u.value.filter(V=>V.path.startsWith(N)).some(V=>V.dirty)}function rt(N){const D=I(N);return D?D.valid:u.value.filter(V=>V.path.startsWith(N)).every(V=>V.valid)}function Ht(N){if(typeof N=="boolean"){F(D=>{D.touched=N});return}qt(N).forEach(D=>{me(D,!!N[D])})}function xt(N,D){var V;const z=D&&"value"in D?D.value:pe(C.value,N),K=I(N);K&&(K.__flags.pendingReset=!0),ln(N,ht(z),!0),ut(N,z,!1),me(N,(V=D==null?void 0:D.touched)!==null&&V!==void 0?V:!1),p(N,(D==null?void 0:D.errors)||[]),a.nextTick(()=>{K&&(K.__flags.pendingReset=!1)})}function dt(N,D){let V=ht(N!=null&&N.values?N.values:S.value);V=D!=null&&D.force?V:Mn(S.value,V),V=Te(v)&&Jt(v.cast)?v.cast(V):V,x(V,{force:D==null?void 0:D.force}),F(z=>{var K;z.__flags.pendingReset=!0,z.validated=!1,z.touched=((K=N==null?void 0:N.touched)===null||K===void 0?void 0:K[a.toValue(z.path)])||!1,ut(a.toValue(z.path),pe(V,a.toValue(z.path)),!1),p(a.toValue(z.path),void 0)}),D!=null&&D.force?Ue(V,!1):Gt(V,!1),g((N==null?void 0:N.errors)||{}),l.value=(N==null?void 0:N.submitCount)||0,a.nextTick(()=>{ct({mode:"silent"}),F(z=>{z.__flags.pendingReset=!1})})}async function ct(N){const D=(N==null?void 0:N.mode)||"force";if(D==="force"&&F(q=>q.validated=!0),st.validateSchema)return st.validateSchema(D);r.value=!0;const V=await Promise.all(u.value.map(q=>q.validate?q.validate(N).then(kt=>({key:a.toValue(q.path),valid:kt.valid,errors:kt.errors,value:kt.value})):Promise.resolve({key:a.toValue(q.path),valid:!0,errors:[],value:void 0})));r.value=!1;const z={},K={},Z={};for(const q of V)z[q.key]={valid:q.valid,errors:q.errors},q.value&&ge(Z,q.key,q.value),q.errors.length&&(K[q.key]=q.errors[0]);return{valid:V.every(q=>q.valid),results:z,errors:K,values:Z,source:"fields"}}async function Ot(N,D){var V;const z=I(N);return z&&(D==null?void 0:D.mode)!=="silent"&&(z.validated=!0),z!=null&&z.validate?z.validate(D):(!z&&(V=D==null?void 0:D.warn),Promise.resolve({errors:[],valid:!0}))}function Dn(N){ur(C.value,N)}function oe(N,D,V=!1){ln(N,D),ge(d,N,D),V&&ge(S.value,N,ht(D))}function ln(N,D,V=!1){ge(C.value,N,ht(D)),V&&ge(S.value,N,ht(D))}async function Nn(){const N=a.unref(v);if(!N)return{valid:!0,results:{},errors:{},source:"none"};r.value=!0;const D=rr(N)||Te(N)?await ou(N,d):await ru(N,d,{names:_.value,bailsMap:w.value});return r.value=!1,D}const Ho=ot((N,{evt:D})=>{Hd(D)&&D.target.submit()});a.onMounted(()=>{st.validateSchema&&st.validateSchema("silent")}),a.isRef(v)&&a.watch(v,()=>{var N;(N=st.validateSchema)===null||N===void 0||N.call(st,"validated-only")}),a.provide(Fd,st);function Tn(N,D){const V=Jt(D)||D==null?void 0:D.label,z=I(a.toValue(N))||T(N,{label:V}),K=()=>Jt(D)?D(Mi(z,Vi)):D||{};function Z(){var yt;z.touched=!0,((yt=K().validateOnBlur)!==null&&yt!==void 0?yt:An().validateOnBlur)&&Ot(a.toValue(z.path))}function q(){var yt;((yt=K().validateOnInput)!==null&&yt!==void 0?yt:An().validateOnInput)&&a.nextTick(()=>{Ot(a.toValue(z.path))})}function kt(){var yt;((yt=K().validateOnChange)!==null&&yt!==void 0?yt:An().validateOnChange)&&a.nextTick(()=>{Ot(a.toValue(z.path))})}const Et=a.computed(()=>{const yt={onChange:kt,onInput:q,onBlur:Z};return Jt(D)?Object.assign(Object.assign({},yt),D(Mi(z,Vi)).props||{}):D!=null&&D.props?Object.assign(Object.assign({},yt),D.props(Mi(z,Vi))):yt});return[De(N,()=>{var yt,Bt,jt;return(jt=(yt=K().validateOnModelUpdate)!==null&&yt!==void 0?yt:(Bt=An())===null||Bt===void 0?void 0:Bt.validateOnModelUpdate)!==null&&jt!==void 0?jt:!0}),Et]}function vs(N){return Array.isArray(N)?N.map(D=>De(D,!0)):De(N)}function X(N,D){const[V,z]=Tn(N,D);function K(){z.value.onBlur()}function Z(kt){const Et=pr(kt);ut(a.toValue(N),Et,!1),z.value.onInput()}function q(kt){const Et=pr(kt);ut(a.toValue(N),Et,!1),z.value.onChange()}return a.computed(()=>Object.assign(Object.assign({},z.value),{onBlur:K,onInput:Z,onChange:q,value:V.value}))}function cn(N,D){const[V,z]=Tn(N,D),K=I(a.toValue(N));function Z(q){V.value=q}return a.computed(()=>{const q=Jt(D)?D(Mi(K,Vi)):D||{};return Object.assign({[q.model||"modelValue"]:V.value,[`onUpdate:${q.model||"modelValue"}`]:Z},z.value)})}const Nt=Object.assign(Object.assign({},st),{values:a.readonly(d),handleReset:()=>dt(),submitForm:Ho});return a.provide($d,Nt),Nt}function lu(n,t,e,i){const s={touched:"some",pending:"some",valid:"every"},o=a.computed(()=>!Vn(t,a.unref(e)));function r(){const c=n.value;return qt(s).reduce((d,u)=>{const h=s[u];return d[u]=c[h](f=>f[u]),d},{})}const l=a.reactive(r());return a.watchEffect(()=>{const c=r();l.touched=c.touched,l.valid=c.valid,l.pending=c.pending}),a.computed(()=>Object.assign(Object.assign({initialValues:a.unref(e)},l),{valid:l.valid&&!qt(i.value).length,dirty:o.value}))}function cu(n,t,e){const i=_r(),s=a.ref(i),o=a.ref(ht(i));function r(l,c){c!=null&&c.force?(s.value=ht(l),o.value=ht(l)):(s.value=Mn(ht(s.value)||{},ht(l)),o.value=Mn(ht(o.value)||{},ht(l))),c!=null&&c.updateFields&&n.value.forEach(d=>{if(d.touched)return;const h=pe(s.value,a.toValue(d.path));ge(t,a.toValue(d.path),ht(h))})}return{initialValues:s,originalInitialValues:o,setInitialValues:r}}function du(n,t){return t?{valid:n.valid&&t.valid,errors:[...n.errors,...t.errors]}:n}function uu(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Bs,kr;function hu(){if(kr)return Bs;kr=1;function n(b){this._maxSize=b,this.clear()}n.prototype.clear=function(){this._size=0,this._values=Object.create(null)},n.prototype.get=function(b){return this._values[b]},n.prototype.set=function(b,_){return this._size>=this._maxSize&&this.clear(),b in this._values||this._size++,this._values[b]=_};var t=/[^.^\]^[]+|(?=\[\]|\.\.)/g,e=/^\d+$/,i=/^\d/,s=/[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g,o=/^\s*(['"]?)(.*?)(\1)\s*$/,r=512,l=new n(r),c=new n(r),d=new n(r);Bs={Cache:n,split:h,normalizePath:u,setter:function(b){var _=u(b);return c.get(b)||c.set(b,function(E,k){for(var C=0,S=_.length,x=E;C<S-1;){var O=_[C];if(O==="__proto__"||O==="constructor"||O==="prototype")return E;x=x[_[C++]]}x[_[C]]=k})},getter:function(b,_){var w=u(b);return d.get(b)||d.set(b,function(k){for(var C=0,S=w.length;C<S;)if(k!=null||!_)k=k[w[C++]];else return;return k})},join:function(b){return b.reduce(function(_,w){return _+(m(w)||e.test(w)?"["+w+"]":(_?".":"")+w)},"")},forEach:function(b,_,w){f(Array.isArray(b)?b:h(b),_,w)}};function u(b){return l.get(b)||l.set(b,h(b).map(function(_){return _.replace(o,"$2")}))}function h(b){return b.match(t)||[""]}function f(b,_,w){var E=b.length,k,C,S,x;for(C=0;C<E;C++)k=b[C],k&&(y(k)&&(k='"'+k+'"'),x=m(k),S=!x&&/^\d+$/.test(k),_.call(w,k,x,S,C,b))}function m(b){return typeof b=="string"&&b&&["'",'"'].indexOf(b.charAt(0))!==-1}function p(b){return b.match(i)&&!b.match(e)}function g(b){return s.test(b)}function y(b){return!m(b)&&(p(b)||g(b))}return Bs}var Ye=hu(),Fs,Sr;function fu(){if(Sr)return Fs;Sr=1;const n=/[A-Z\xc0-\xd6\xd8-\xde]?[a-z\xdf-\xf6\xf8-\xff]+(?:['’](?:d|ll|m|re|s|t|ve))?(?=[\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]|[A-Z\xc0-\xd6\xd8-\xde]|$)|(?:[A-Z\xc0-\xd6\xd8-\xde]|[^\ud800-\udfff\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\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:D|LL|M|RE|S|T|VE))?(?=[\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]|[A-Z\xc0-\xd6\xd8-\xde](?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\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\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])|$)|[A-Z\xc0-\xd6\xd8-\xde]?(?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\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\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:d|ll|m|re|s|t|ve))?|[A-Z\xc0-\xd6\xd8-\xde]+(?:['’](?:D|LL|M|RE|S|T|VE))?|\d*(?:1ST|2ND|3RD|(?![123])\dTH)(?=\b|[a-z_])|\d*(?:1st|2nd|3rd|(?![123])\dth)(?=\b|[A-Z_])|\d+|(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?(?:\u200d(?:[^\ud800-\udfff]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?)*/g,t=u=>u.match(n)||[],e=u=>u[0].toUpperCase()+u.slice(1),i=(u,h)=>t(u).join(h).toLowerCase(),s=u=>t(u).reduce((h,f)=>`${h}${h?f[0].toUpperCase()+f.slice(1).toLowerCase():f.toLowerCase()}`,"");return Fs={words:t,upperFirst:e,camelCase:s,pascalCase:u=>e(s(u)),snakeCase:u=>i(u,"_"),kebabCase:u=>i(u,"-"),sentenceCase:u=>e(i(u," ")),titleCase:u=>t(u).map(e).join(" ")},Fs}var $s=fu(),Ai={exports:{}},wr;function mu(){if(wr)return Ai.exports;wr=1,Ai.exports=function(s){return n(t(s),s)},Ai.exports.array=n;function n(s,o){var r=s.length,l=new Array(r),c={},d=r,u=e(o),h=i(s);for(o.forEach(function(m){if(!h.has(m[0])||!h.has(m[1]))throw new Error("Unknown node. There is an unknown node in the supplied edges.")});d--;)c[d]||f(s[d],d,new Set);return l;function f(m,p,g){if(g.has(m)){var y;try{y=", node was:"+JSON.stringify(m)}catch{y=""}throw new Error("Cyclic dependency"+y)}if(!h.has(m))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(m));if(!c[p]){c[p]=!0;var b=u.get(m)||new Set;if(b=Array.from(b),p=b.length){g.add(m);do{var _=b[--p];f(_,h.get(_),g)}while(p);g.delete(m)}l[--r]=m}}}function t(s){for(var o=new Set,r=0,l=s.length;r<l;r++){var c=s[r];o.add(c[0]),o.add(c[1])}return Array.from(o)}function e(s){for(var o=new Map,r=0,l=s.length;r<l;r++){var c=s[r];o.has(c[0])||o.set(c[0],new Set),o.has(c[1])||o.set(c[1],new Set),o.get(c[0]).add(c[1])}return o}function i(s){for(var o=new Map,r=0,l=s.length;r<l;r++)o.set(s[r],r);return o}return Ai.exports}var pu=mu();const gu=uu(pu),yu=Object.prototype.toString,bu=Error.prototype.toString,_u=RegExp.prototype.toString,xu=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",ku=/^Symbol\((.*)\)(.*)$/;function Su(n){return n!=+n?"NaN":n===0&&1/n<0?"-0":""+n}function Er(n,t=!1){if(n==null||n===!0||n===!1)return""+n;const e=typeof n;if(e==="number")return Su(n);if(e==="string")return t?`"${n}"`:n;if(e==="function")return"[Function "+(n.name||"anonymous")+"]";if(e==="symbol")return xu.call(n).replace(ku,"Symbol($1)");const i=yu.call(n).slice(8,-1);return i==="Date"?isNaN(n.getTime())?""+n:n.toISOString(n):i==="Error"||n instanceof Error?"["+bu.call(n)+"]":i==="RegExp"?_u.call(n):null}function Pe(n,t){let e=Er(n,t);return e!==null?e:JSON.stringify(n,function(i,s){let o=Er(this[i],t);return o!==null?o:s},2)}function Cr(n){return n==null?[]:[].concat(n)}let vr,Or,Dr,wu=/\$\{\s*(\w+)\s*\}/g;vr=Symbol.toStringTag;class Nr{constructor(t,e,i,s){this.name=void 0,this.message=void 0,this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=void 0,this.inner=void 0,this[vr]="Error",this.name="ValidationError",this.value=e,this.path=i,this.type=s,this.errors=[],this.inner=[],Cr(t).forEach(o=>{if($t.isError(o)){this.errors.push(...o.errors);const r=o.inner.length?o.inner:[o];this.inner.push(...r)}else this.errors.push(o)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0]}}Or=Symbol.hasInstance,Dr=Symbol.toStringTag;class $t extends Error{static formatError(t,e){const i=e.label||e.path||"this";return e=Object.assign({},e,{path:i,originalPath:e.path}),typeof t=="string"?t.replace(wu,(s,o)=>Pe(e[o])):typeof t=="function"?t(e):t}static isError(t){return t&&t.name==="ValidationError"}constructor(t,e,i,s,o){const r=new Nr(t,e,i,s);if(o)return r;super(),this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=[],this.inner=[],this[Dr]="Error",this.name=r.name,this.message=r.message,this.type=r.type,this.value=r.value,this.path=r.path,this.errors=r.errors,this.inner=r.inner,Error.captureStackTrace&&Error.captureStackTrace(this,$t)}static[Or](t){return Nr[Symbol.hasInstance](t)||super[Symbol.hasInstance](t)}}let ae={default:"${path} is invalid",required:"${path} is a required field",defined:"${path} must be defined",notNull:"${path} cannot be null",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:n,type:t,value:e,originalValue:i})=>{const s=i!=null&&i!==e?` (cast from the value \`${Pe(i,!0)}\`).`:".";return t!=="mixed"?`${n} must be a \`${t}\` type, but the final value was: \`${Pe(e,!0)}\``+s:`${n} must match the configured type. The validated value was: \`${Pe(e,!0)}\``+s}},Rt={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",datetime:"${path} must be a valid ISO date-time",datetime_precision:"${path} must be a valid ISO date-time with a sub-second precision of exactly ${precision} digits",datetime_offset:'${path} must be a valid ISO date-time with UTC "Z" timezone',trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},Eu={min:"${path} must be greater than or equal to ${min}",max:"${path} must be less than or equal to ${max}",lessThan:"${path} must be less than ${less}",moreThan:"${path} must be greater than ${more}",positive:"${path} must be a positive number",negative:"${path} must be a negative number",integer:"${path} must be an integer"},Rs={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},Cu={isValue:"${path} field must be ${value}"},Bi={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"};Object.assign(Object.create(null),{mixed:ae,string:Rt,number:Eu,date:Rs,object:Bi,array:{min:"${path} field must have at least ${min} items",max:"${path} field must have less than or equal to ${max} items",length:"${path} must have ${length} items"},boolean:Cu,tuple:{notType:n=>{const{path:t,value:e,spec:i}=n,s=i.types.length;if(Array.isArray(e)){if(e.length<s)return`${t} tuple value has too few items, expected a length of ${s} but got ${e.length} for value: \`${Pe(e,!0)}\``;if(e.length>s)return`${t} tuple value has too many items, expected a length of ${s} but got ${e.length} for value: \`${Pe(e,!0)}\``}return $t.formatError(ae.notType,n)}}});const Ls=n=>n&&n.__isYupSchema__;class Fi{static fromOptions(t,e){if(!e.then&&!e.otherwise)throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");let{is:i,then:s,otherwise:o}=e,r=typeof i=="function"?i:(...l)=>l.every(c=>c===i);return new Fi(t,(l,c)=>{var d;let u=r(...l)?s:o;return(d=u==null?void 0:u(c))!=null?d:c})}constructor(t,e){this.fn=void 0,this.refs=t,this.refs=t,this.fn=e}resolve(t,e){let i=this.refs.map(o=>o.getValue(e==null?void 0:e.value,e==null?void 0:e.parent,e==null?void 0:e.context)),s=this.fn(i,t,e);if(s===void 0||s===t)return t;if(!Ls(s))throw new TypeError("conditions must return a schema object");return s.resolve(e)}}const $i={context:"$",value:"."};class Ke{constructor(t,e={}){if(this.key=void 0,this.isContext=void 0,this.isValue=void 0,this.isSibling=void 0,this.path=void 0,this.getter=void 0,this.map=void 0,typeof t!="string")throw new TypeError("ref must be a string, got: "+t);if(this.key=t.trim(),t==="")throw new TypeError("ref must be a non-empty string");this.isContext=this.key[0]===$i.context,this.isValue=this.key[0]===$i.value,this.isSibling=!this.isContext&&!this.isValue;let i=this.isContext?$i.context:this.isValue?$i.value:"";this.path=this.key.slice(i.length),this.getter=this.path&&Ye.getter(this.path,!0),this.map=e.map}getValue(t,e,i){let s=this.isContext?i:this.isValue?t:e;return this.getter&&(s=this.getter(s||{})),this.map&&(s=this.map(s)),s}cast(t,e){return this.getValue(t,e==null?void 0:e.parent,e==null?void 0:e.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(t){return t&&t.__isYupRef}}Ke.prototype.__isYupRef=!0;const Xe=n=>n==null;function hn(n){function t({value:e,path:i="",options:s,originalValue:o,schema:r},l,c){const{name:d,test:u,params:h,message:f,skipAbsent:m}=n;let{parent:p,context:g,abortEarly:y=r.spec.abortEarly,disableStackTrace:b=r.spec.disableStackTrace}=s;function _(v){return Ke.isRef(v)?v.getValue(e,p,g):v}function w(v={}){const T=Object.assign({value:e,originalValue:o,label:r.spec.label,path:v.path||i,spec:r.spec,disableStackTrace:v.disableStackTrace||b},h,v.params);for(const U of Object.keys(T))T[U]=_(T[U]);const $=new $t($t.formatError(v.message||f,T),e,T.path,v.type||d,T.disableStackTrace);return $.params=T,$}const E=y?l:c;let k={path:i,parent:p,type:d,from:s.from,createError:w,resolve:_,options:s,originalValue:o,schema:r};const C=v=>{$t.isError(v)?E(v):v?c(null):E(w())},S=v=>{$t.isError(v)?E(v):l(v)};if(m&&Xe(e))return C(!0);let O;try{var M;if(O=u.call(k,e,k),typeof((M=O)==null?void 0:M.then)=="function"){if(s.sync)throw new Error(`Validation test of type: "${k.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve(O).then(C,S)}}catch(v){S(v);return}C(O)}return t.OPTIONS=n,t}function vu(n,t,e,i=e){let s,o,r;return t?(Ye.forEach(t,(l,c,d)=>{let u=c?l.slice(1,l.length-1):l;n=n.resolve({context:i,parent:s,value:e});let h=n.type==="tuple",f=d?parseInt(u,10):0;if(n.innerType||h){if(h&&!d)throw new Error(`Yup.reach cannot implicitly index into a tuple type. the path part "${r}" must contain an index to the tuple element, e.g. "${r}[0]"`);if(e&&f>=e.length)throw new Error(`Yup.reach cannot resolve an array item at index: ${l}, in the path: ${t}. because there is no value at that index. `);s=e,e=e&&e[f],n=h?n.spec.types[f]:n.innerType}if(!d){if(!n.fields||!n.fields[u])throw new Error(`The schema does not contain the path: ${t}. (failed at: ${r} which is a type: "${n.type}")`);s=e,e=e&&e[u],n=n.fields[u]}o=u,r=c?"["+l+"]":"."+l}),{schema:n,parent:s,parentPath:o}):{parent:s,parentPath:t,schema:n}}class Ri extends Set{describe(){const t=[];for(const e of this.values())t.push(Ke.isRef(e)?e.describe():e);return t}resolveAll(t){let e=[];for(const i of this.values())e.push(t(i));return e}clone(){return new Ri(this.values())}merge(t,e){const i=this.clone();return t.forEach(s=>i.add(s)),e.forEach(s=>i.delete(s)),i}}function fn(n,t=new Map){if(Ls(n)||!n||typeof n!="object")return n;if(t.has(n))return t.get(n);let e;if(n instanceof Date)e=new Date(n.getTime()),t.set(n,e);else if(n instanceof RegExp)e=new RegExp(n),t.set(n,e);else if(Array.isArray(n)){e=new Array(n.length),t.set(n,e);for(let i=0;i<n.length;i++)e[i]=fn(n[i],t)}else if(n instanceof Map){e=new Map,t.set(n,e);for(const[i,s]of n.entries())e.set(i,fn(s,t))}else if(n instanceof Set){e=new Set,t.set(n,e);for(const i of n)e.add(fn(i,t))}else if(n instanceof Object){e={},t.set(n,e);for(const[i,s]of Object.entries(n))e[i]=fn(s,t)}else throw Error(`Unable to clone ${n}`);return e}class le{constructor(t){this.type=void 0,this.deps=[],this.tests=void 0,this.transforms=void 0,this.conditions=[],this._mutate=void 0,this.internalTests={},this._whitelist=new Ri,this._blacklist=new Ri,this.exclusiveTests=Object.create(null),this._typeCheck=void 0,this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(ae.notType)}),this.type=t.type,this._typeCheck=t.check,this.spec=Object.assign({strip:!1,strict:!1,abortEarly:!0,recursive:!0,disableStackTrace:!1,nullable:!1,optional:!0,coerce:!0},t==null?void 0:t.spec),this.withMutation(e=>{e.nonNullable()})}get _type(){return this.type}clone(t){if(this._mutate)return t&&Object.assign(this.spec,t),this;const e=Object.create(Object.getPrototypeOf(this));return e.type=this.type,e._typeCheck=this._typeCheck,e._whitelist=this._whitelist.clone(),e._blacklist=this._blacklist.clone(),e.internalTests=Object.assign({},this.internalTests),e.exclusiveTests=Object.assign({},this.exclusiveTests),e.deps=[...this.deps],e.conditions=[...this.conditions],e.tests=[...this.tests],e.transforms=[...this.transforms],e.spec=fn(Object.assign({},this.spec,t)),e}label(t){let e=this.clone();return e.spec.label=t,e}meta(...t){if(t.length===0)return this.spec.meta;let e=this.clone();return e.spec.meta=Object.assign(e.spec.meta||{},t[0]),e}withMutation(t){let e=this._mutate;this._mutate=!0;let i=t(this);return this._mutate=e,i}concat(t){if(!t||t===this)return this;if(t.type!==this.type&&this.type!=="mixed")throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${t.type}`);let e=this,i=t.clone();const s=Object.assign({},e.spec,i.spec);return i.spec=s,i.internalTests=Object.assign({},e.internalTests,i.internalTests),i._whitelist=e._whitelist.merge(t._whitelist,t._blacklist),i._blacklist=e._blacklist.merge(t._blacklist,t._whitelist),i.tests=e.tests,i.exclusiveTests=e.exclusiveTests,i.withMutation(o=>{t.tests.forEach(r=>{o.test(r.OPTIONS)})}),i.transforms=[...e.transforms,...i.transforms],i}isType(t){return t==null?!!(this.spec.nullable&&t===null||this.spec.optional&&t===void 0):this._typeCheck(t)}resolve(t){let e=this;if(e.conditions.length){let i=e.conditions;e=e.clone(),e.conditions=[],e=i.reduce((s,o)=>o.resolve(s,t),e),e=e.resolve(t)}return e}resolveOptions(t){var e,i,s,o;return Object.assign({},t,{from:t.from||[],strict:(e=t.strict)!=null?e:this.spec.strict,abortEarly:(i=t.abortEarly)!=null?i:this.spec.abortEarly,recursive:(s=t.recursive)!=null?s:this.spec.recursive,disableStackTrace:(o=t.disableStackTrace)!=null?o:this.spec.disableStackTrace})}cast(t,e={}){let i=this.resolve(Object.assign({value:t},e)),s=e.assert==="ignore-optionality",o=i._cast(t,e);if(e.assert!==!1&&!i.isType(o)){if(s&&Xe(o))return o;let r=Pe(t),l=Pe(o);throw new TypeError(`The value of ${e.path||"field"} could not be cast to a value that satisfies the schema type: "${i.type}".
|
|
10
10
|
|
|
11
11
|
attempted value: ${r}
|
|
12
|
-
`+(a!==r?`result of cast: ${a}`:""))}return o}_cast(t,e){let i=t===void 0?t:this.transforms.reduce((s,o)=>o.call(this,s,t,this),t);return i===void 0&&(i=this.getDefault(e)),i}_validate(t,e={},i,s){let{path:o,originalValue:r=t,strict:a=this.spec.strict}=e,c=t;a||(c=this._cast(c,Object.assign({assert:!1},e)));let d=[];for(let u of Object.values(this.internalTests))u&&d.push(u);this.runTests({path:o,value:c,originalValue:r,options:e,tests:d},i,u=>{if(u.length)return s(u,c);this.runTests({path:o,value:c,originalValue:r,options:e,tests:this.tests},i,s)})}runTests(t,e,i){let s=!1,{tests:o,value:r,originalValue:a,path:c,options:d}=t,u=g=>{s||(s=!0,e(g,r))},h=g=>{s||(s=!0,i(g,r))},f=o.length,m=[];if(!f)return h([]);let p={value:r,originalValue:a,path:c,options:d,schema:this};for(let g=0;g<o.length;g++){const y=o[g];y(p,u,function(_){_&&(Array.isArray(_)?m.push(..._):m.push(_)),--f<=0&&h(m)})}}asNestedTest({key:t,index:e,parent:i,parentPath:s,originalParent:o,options:r}){const a=t??e;if(a==null)throw TypeError("Must include `key` or `index` for nested validations");const c=typeof a=="number";let d=i[a];const u=Object.assign({},r,{strict:!0,parent:i,value:d,originalValue:o[a],key:void 0,[c?"index":"key"]:a,path:c||a.includes(".")?`${s||""}[${c?a:`"${a}"`}]`:(s?`${s}.`:"")+t});return(h,f,m)=>this.resolve(u)._validate(d,u,f,m)}validate(t,e){var i;let s=this.resolve(Object.assign({},e,{value:t})),o=(i=e==null?void 0:e.disableStackTrace)!=null?i:s.spec.disableStackTrace;return new Promise((r,a)=>s._validate(t,e,(c,d)=>{Bt.isError(c)&&(c.value=d),a(c)},(c,d)=>{c.length?a(new Bt(c,d,void 0,void 0,o)):r(d)}))}validateSync(t,e){var i;let s=this.resolve(Object.assign({},e,{value:t})),o,r=(i=e==null?void 0:e.disableStackTrace)!=null?i:s.spec.disableStackTrace;return s._validate(t,Object.assign({},e,{sync:!0}),(a,c)=>{throw Bt.isError(a)&&(a.value=c),a},(a,c)=>{if(a.length)throw new Bt(a,t,void 0,void 0,r);o=c}),o}isValid(t,e){return this.validate(t,e).then(()=>!0,i=>{if(Bt.isError(i))return!1;throw i})}isValidSync(t,e){try{return this.validateSync(t,e),!0}catch(i){if(Bt.isError(i))return!1;throw i}}_getDefault(t){let e=this.spec.default;return e==null?e:typeof e=="function"?e.call(this,t):fn(e)}getDefault(t){return this.resolve(t||{})._getDefault(t)}default(t){return arguments.length===0?this._getDefault():this.clone({default:t})}strict(t=!0){return this.clone({strict:t})}nullability(t,e){const i=this.clone({nullable:t});return i.internalTests.nullable=hn({message:e,name:"nullable",test(s){return s===null?this.schema.spec.nullable:!0}}),i}optionality(t,e){const i=this.clone({optional:t});return i.internalTests.optionality=hn({message:e,name:"optionality",test(s){return s===void 0?this.schema.spec.optional:!0}}),i}optional(){return this.optionality(!0)}defined(t=re.defined){return this.optionality(!1,t)}nullable(){return this.nullability(!0)}nonNullable(t=re.notNull){return this.nullability(!1,t)}required(t=re.required){return this.clone().withMutation(e=>e.nonNullable(t).defined(t))}notRequired(){return this.clone().withMutation(t=>t.nullable().optional())}transform(t){let e=this.clone();return e.transforms.push(t),e}test(...t){let e;if(t.length===1?typeof t[0]=="function"?e={test:t[0]}:e=t[0]:t.length===2?e={name:t[0],test:t[1]}:e={name:t[0],message:t[1],test:t[2]},e.message===void 0&&(e.message=re.default),typeof e.test!="function")throw new TypeError("`test` is a required parameters");let i=this.clone(),s=hn(e),o=e.exclusive||e.name&&i.exclusiveTests[e.name]===!0;if(e.exclusive&&!e.name)throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");return e.name&&(i.exclusiveTests[e.name]=!!e.exclusive),i.tests=i.tests.filter(r=>!(r.OPTIONS.name===e.name&&(o||r.OPTIONS.test===s.OPTIONS.test))),i.tests.push(s),i}when(t,e){!Array.isArray(t)&&typeof t!="string"&&(e=t,t=".");let i=this.clone(),s=Sr(t).map(o=>new Ke(o));return s.forEach(o=>{o.isSibling&&i.deps.push(o.key)}),i.conditions.push(typeof e=="function"?new Bi(s,e):Bi.fromOptions(s,e)),i}typeError(t){let e=this.clone();return e.internalTests.typeError=hn({message:t,name:"typeError",skipAbsent:!0,test(i){return this.schema._typeCheck(i)?!0:this.createError({params:{type:this.schema.type}})}}),e}oneOf(t,e=re.oneOf){let i=this.clone();return t.forEach(s=>{i._whitelist.add(s),i._blacklist.delete(s)}),i.internalTests.whiteList=hn({message:e,name:"oneOf",skipAbsent:!0,test(s){let o=this.schema._whitelist,r=o.resolveAll(this.resolve);return r.includes(s)?!0:this.createError({params:{values:Array.from(o).join(", "),resolved:r}})}}),i}notOneOf(t,e=re.notOneOf){let i=this.clone();return t.forEach(s=>{i._blacklist.add(s),i._whitelist.delete(s)}),i.internalTests.blacklist=hn({message:e,name:"notOneOf",test(s){let o=this.schema._blacklist,r=o.resolveAll(this.resolve);return r.includes(s)?this.createError({params:{values:Array.from(o).join(", "),resolved:r}}):!0}}),i}strip(t=!0){let e=this.clone();return e.spec.strip=t,e}describe(t){const e=(t?this.resolve(t):this).clone(),{label:i,meta:s,optional:o,nullable:r}=e.spec;return{meta:s,label:i,optional:o,nullable:r,default:e.getDefault(t),type:e.type,oneOf:e._whitelist.describe(),notOneOf:e._blacklist.describe(),tests:e.tests.map(c=>({name:c.OPTIONS.name,params:c.OPTIONS.params})).filter((c,d,u)=>u.findIndex(h=>h.name===c.name)===d)}}}ae.prototype.__isYupSchema__=!0;for(const n of["validate","validateSync"])ae.prototype[`${n}At`]=function(t,e,i={}){const{parent:s,parentPath:o,schema:r}=xu(this,t,e,i.context);return r[n](s&&s[o],Object.assign({},i,{parent:s,path:t}))};for(const n of["equals","is"])ae.prototype[n]=ae.prototype.oneOf;for(const n of["not","nope"])ae.prototype[n]=ae.prototype.notOneOf;const ku=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function Su(n){const t=Rs(n);if(!t)return Date.parse?Date.parse(n):Number.NaN;if(t.z===void 0&&t.plusMinus===void 0)return new Date(t.year,t.month,t.day,t.hour,t.minute,t.second,t.millisecond).valueOf();let e=0;return t.z!=="Z"&&t.plusMinus!==void 0&&(e=t.hourOffset*60+t.minuteOffset,t.plusMinus==="+"&&(e=0-e)),Date.UTC(t.year,t.month,t.day,t.hour,t.minute+e,t.second,t.millisecond)}function Rs(n){var t,e;const i=ku.exec(n);return i?{year:ye(i[1]),month:ye(i[2],1)-1,day:ye(i[3],1),hour:ye(i[4]),minute:ye(i[5]),second:ye(i[6]),millisecond:i[7]?ye(i[7].substring(0,3)):0,precision:(t=(e=i[7])==null?void 0:e.length)!=null?t:void 0,z:i[8]||void 0,plusMinus:i[9]||void 0,hourOffset:ye(i[10]),minuteOffset:ye(i[11])}:null}function ye(n,t=0){return Number(n)||t}let wu=/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Eu=/^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,vu=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,Cu="^\\d{4}-\\d{2}-\\d{2}",Ou="\\d{2}:\\d{2}:\\d{2}",Du="(([+-]\\d{2}(:?\\d{2})?)|Z)",Nu=new RegExp(`${Cu}T${Ou}(\\.\\d+)?${Du}$`),Tu=n=>Xe(n)||n===n.trim(),Pu={}.toString();function Ls(){return new Or}class Or extends ae{constructor(){super({type:"string",check(t){return t instanceof String&&(t=t.valueOf()),typeof t=="string"}}),this.withMutation(()=>{this.transform((t,e,i)=>{if(!i.spec.coerce||i.isType(t)||Array.isArray(t))return t;const s=t!=null&&t.toString?t.toString():t;return s===Pu?t:s})})}required(t){return super.required(t).withMutation(e=>e.test({message:t||re.required,name:"required",skipAbsent:!0,test:i=>!!i.length}))}notRequired(){return super.notRequired().withMutation(t=>(t.tests=t.tests.filter(e=>e.OPTIONS.name!=="required"),t))}length(t,e=$t.length){return this.test({message:e,name:"length",exclusive:!0,params:{length:t},skipAbsent:!0,test(i){return i.length===this.resolve(t)}})}min(t,e=$t.min){return this.test({message:e,name:"min",exclusive:!0,params:{min:t},skipAbsent:!0,test(i){return i.length>=this.resolve(t)}})}max(t,e=$t.max){return this.test({name:"max",exclusive:!0,message:e,params:{max:t},skipAbsent:!0,test(i){return i.length<=this.resolve(t)}})}matches(t,e){let i=!1,s,o;return e&&(typeof e=="object"?{excludeEmptyString:i=!1,message:s,name:o}=e:s=e),this.test({name:o||"matches",message:s||$t.matches,params:{regex:t},skipAbsent:!0,test:r=>r===""&&i||r.search(t)!==-1})}email(t=$t.email){return this.matches(wu,{name:"email",message:t,excludeEmptyString:!0})}url(t=$t.url){return this.matches(Eu,{name:"url",message:t,excludeEmptyString:!0})}uuid(t=$t.uuid){return this.matches(vu,{name:"uuid",message:t,excludeEmptyString:!1})}datetime(t){let e="",i,s;return t&&(typeof t=="object"?{message:e="",allowOffset:i=!1,precision:s=void 0}=t:e=t),this.matches(Nu,{name:"datetime",message:e||$t.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:e||$t.datetime_offset,params:{allowOffset:i},skipAbsent:!0,test:o=>{if(!o||i)return!0;const r=Rs(o);return r?!!r.z:!1}}).test({name:"datetime_precision",message:e||$t.datetime_precision,params:{precision:s},skipAbsent:!0,test:o=>{if(!o||s==null)return!0;const r=Rs(o);return r?r.precision===s:!1}})}ensure(){return this.default("").transform(t=>t===null?"":t)}trim(t=$t.trim){return this.transform(e=>e!=null?e.trim():e).test({message:t,name:"trim",test:Tu})}lowercase(t=$t.lowercase){return this.transform(e=>Xe(e)?e:e.toLowerCase()).test({message:t,name:"string_case",exclusive:!0,skipAbsent:!0,test:e=>Xe(e)||e===e.toLowerCase()})}uppercase(t=$t.uppercase){return this.transform(e=>Xe(e)?e:e.toUpperCase()).test({message:t,name:"string_case",exclusive:!0,skipAbsent:!0,test:e=>Xe(e)||e===e.toUpperCase()})}}Ls.prototype=Or.prototype;let Mu=new Date(""),Vu=n=>Object.prototype.toString.call(n)==="[object Date]";class Li extends ae{constructor(){super({type:"date",check(t){return Vu(t)&&!isNaN(t.getTime())}}),this.withMutation(()=>{this.transform((t,e,i)=>!i.spec.coerce||i.isType(t)||t===null?t:(t=Su(t),isNaN(t)?Li.INVALID_DATE:new Date(t)))})}prepareParam(t,e){let i;if(Ke.isRef(t))i=t;else{let s=this.cast(t);if(!this._typeCheck(s))throw new TypeError(`\`${e}\` must be a Date or a value that can be \`cast()\` to a Date`);i=s}return i}min(t,e=Bs.min){let i=this.prepareParam(t,"min");return this.test({message:e,name:"min",exclusive:!0,params:{min:t},skipAbsent:!0,test(s){return s>=this.resolve(i)}})}max(t,e=Bs.max){let i=this.prepareParam(t,"max");return this.test({message:e,name:"max",exclusive:!0,params:{max:t},skipAbsent:!0,test(s){return s<=this.resolve(i)}})}}Li.INVALID_DATE=Mu,Li.prototype;function Au(n,t=[]){let e=[],i=new Set,s=new Set(t.map(([r,a])=>`${r}-${a}`));function o(r,a){let c=Ye.split(r)[0];i.add(c),s.has(`${a}-${c}`)||e.push([a,c])}for(const r of Object.keys(n)){let a=n[r];i.add(r),Ke.isRef(a)&&a.isSibling?o(a.path,r):$s(a)&&"deps"in a&&a.deps.forEach(c=>o(c,r))}return du.array(Array.from(i),e).reverse()}function Dr(n,t){let e=1/0;return n.some((i,s)=>{var o;if((o=t.path)!=null&&o.includes(i))return e=s,!0}),e}function Nr(n){return(t,e)=>Dr(n,t)-Dr(n,e)}const Fu=(n,t,e)=>{if(typeof n!="string")return n;let i=n;try{i=JSON.parse(n)}catch{}return e.isType(i)?i:n};function Ii(n){if("fields"in n){const t={};for(const[e,i]of Object.entries(n.fields))t[e]=Ii(i);return n.setFields(t)}if(n.type==="array"){const t=n.optional();return t.innerType&&(t.innerType=Ii(t.innerType)),t}return n.type==="tuple"?n.optional().clone({types:n.spec.types.map(Ii)}):"optional"in n?n.optional():n}const Bu=(n,t)=>{const e=[...Ye.normalizePath(t)];if(e.length===1)return e[0]in n;let i=e.pop(),s=Ye.getter(Ye.join(e),!0)(n);return!!(s&&i in s)};let Tr=n=>Object.prototype.toString.call(n)==="[object Object]";function Pr(n,t){let e=Object.keys(n.fields);return Object.keys(t).filter(i=>e.indexOf(i)===-1)}const $u=Nr([]);function Is(n){return new Mr(n)}class Mr extends ae{constructor(t){super({type:"object",check(e){return Tr(e)||typeof e=="function"}}),this.fields=Object.create(null),this._sortErrors=$u,this._nodes=[],this._excludedEdges=[],this.withMutation(()=>{t&&this.shape(t)})}_cast(t,e={}){var i;let s=super._cast(t,e);if(s===void 0)return this.getDefault(e);if(!this._typeCheck(s))return s;let o=this.fields,r=(i=e.stripUnknown)!=null?i:this.spec.noUnknown,a=[].concat(this._nodes,Object.keys(s).filter(h=>!this._nodes.includes(h))),c={},d=Object.assign({},e,{parent:c,__validating:e.__validating||!1}),u=!1;for(const h of a){let f=o[h],m=h in s;if(f){let p,g=s[h];d.path=(e.path?`${e.path}.`:"")+h,f=f.resolve({value:g,context:e.context,parent:c});let y=f instanceof ae?f.spec:void 0,b=y==null?void 0:y.strict;if(y!=null&&y.strip){u=u||h in s;continue}p=!e.__validating||!b?f.cast(s[h],d):s[h],p!==void 0&&(c[h]=p)}else m&&!r&&(c[h]=s[h]);(m!==h in c||c[h]!==s[h])&&(u=!0)}return u?c:s}_validate(t,e={},i,s){let{from:o=[],originalValue:r=t,recursive:a=this.spec.recursive}=e;e.from=[{schema:this,value:r},...o],e.__validating=!0,e.originalValue=r,super._validate(t,e,i,(c,d)=>{if(!a||!Tr(d)){s(c,d);return}r=r||d;let u=[];for(let h of this._nodes){let f=this.fields[h];!f||Ke.isRef(f)||u.push(f.asNestedTest({options:e,key:h,parent:d,parentPath:e.path,originalParent:r}))}this.runTests({tests:u,value:d,originalValue:r,options:e},i,h=>{s(h.sort(this._sortErrors).concat(c),d)})})}clone(t){const e=super.clone(t);return e.fields=Object.assign({},this.fields),e._nodes=this._nodes,e._excludedEdges=this._excludedEdges,e._sortErrors=this._sortErrors,e}concat(t){let e=super.concat(t),i=e.fields;for(let[s,o]of Object.entries(this.fields)){const r=i[s];i[s]=r===void 0?o:r}return e.withMutation(s=>s.setFields(i,[...this._excludedEdges,...t._excludedEdges]))}_getDefault(t){if("default"in this.spec)return super._getDefault(t);if(!this._nodes.length)return;let e={};return this._nodes.forEach(i=>{var s;const o=this.fields[i];let r=t;(s=r)!=null&&s.value&&(r=Object.assign({},r,{parent:r.value,value:r.value[i]})),e[i]=o&&"getDefault"in o?o.getDefault(r):void 0}),e}setFields(t,e){let i=this.clone();return i.fields=t,i._nodes=Au(t,e),i._sortErrors=Nr(Object.keys(t)),e&&(i._excludedEdges=e),i}shape(t,e=[]){return this.clone().withMutation(i=>{let s=i._excludedEdges;return e.length&&(Array.isArray(e[0])||(e=[e]),s=[...i._excludedEdges,...e]),i.setFields(Object.assign(i.fields,t),s)})}partial(){const t={};for(const[e,i]of Object.entries(this.fields))t[e]="optional"in i&&i.optional instanceof Function?i.optional():i;return this.setFields(t)}deepPartial(){return Ii(this)}pick(t){const e={};for(const i of t)this.fields[i]&&(e[i]=this.fields[i]);return this.setFields(e,this._excludedEdges.filter(([i,s])=>t.includes(i)&&t.includes(s)))}omit(t){const e=[];for(const i of Object.keys(this.fields))t.includes(i)||e.push(i);return this.pick(e)}from(t,e,i){let s=Ye.getter(t,!0);return this.transform(o=>{if(!o)return o;let r=o;return Bu(o,t)&&(r=Object.assign({},o),i||delete r[t],r[e]=s(o)),r})}json(){return this.transform(Fu)}exact(t){return this.test({name:"exact",exclusive:!0,message:t||Fi.exact,test(e){if(e==null)return!0;const i=Pr(this.schema,e);return i.length===0||this.createError({params:{properties:i.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(t=!0,e=Fi.noUnknown){typeof t!="boolean"&&(e=t,t=!0);let i=this.test({name:"noUnknown",exclusive:!0,message:e,test(s){if(s==null)return!0;const o=Pr(this.schema,s);return!t||o.length===0||this.createError({params:{unknown:o.join(", ")}})}});return i.spec.noUnknown=t,i}unknown(t=!0,e=Fi.noUnknown){return this.noUnknown(!t,e)}transformKeys(t){return this.transform(e=>{if(!e)return e;const i={};for(const s of Object.keys(e))i[t(s)]=e[s];return i})}camelCase(){return this.transformKeys(Fs.camelCase)}snakeCase(){return this.transformKeys(Fs.snakeCase)}constantCase(){return this.transformKeys(t=>Fs.snakeCase(t).toUpperCase())}describe(t){const e=(t?this.resolve(t):this).clone(),i=super.describe(t);i.fields={};for(const[o,r]of Object.entries(e.fields)){var s;let a=t;(s=a)!=null&&s.value&&(a=Object.assign({},a,{parent:a.value,value:a.value[o]})),i.fields[o]=r.describe(a)}return i}}Is.prototype=Mr.prototype;function js(n,t,e){const i=new qe;let s=l.ref({});const o=l.ref({}),r=l.ref({});let a=l.ref([]);const c=l.ref(null),d=l.ref([]);let u=l.ref([]),h=l.ref(!1);const f=l.ref({});let{handleSubmit:m,errors:p,setErrors:g}=yr();const y=async()=>{var F;try{const P=await i.getEntityRecords(n);P&&P.response&&(s.value=P.response,a.value=(F=P.response.entity.entityDefinition)==null?void 0:F.columns,I(),S(),C())}catch(P){toast.add({severity:"error",summary:"Error",detail:P.errorMessage,life:3e3})}finally{}},b=async()=>{var F;try{const P=await i.getRecord(n,t);P&&P.response&&(s.value=P.response,a.value=(F=P.response.entity.entityDefinition)==null?void 0:F.columns,I(),o.value=JSON.parse(JSON.stringify(P.response.result[0])),C())}catch(P){console.error("Error fetching entity:",P.errorMessage)}finally{}},_=async()=>{var F,P;try{const R=await i.getRelatedEntityRecord(n,t);R&&R.response&&(s.value=R.response,a.value=(P=(F=R.response.entity)==null?void 0:F.entityDefinition)==null?void 0:P.columns,I(),o.value=JSON.parse(JSON.stringify(R.response.result[0])),o.value.entityName&&delete o.value.entityName,o.value.linkedEntities&&delete o.value.linkedEntities,u.value=R.response.result[0].linkedEntities,r.value=JSON.parse(JSON.stringify(o.value)),C())}catch(R){console.error("Error fetching entity:",R.errorMessage)}finally{}},w=async F=>{try{let P=await i.addRecord(n,F);P&&P.response&&e("onSaveDialog",{entityName:n,recordId:t})}catch(P){P.validationErrors&&(d.value=JSON.parse(JSON.stringify(P.validationErrors))),console.error("Error fetching entity:",P.errorMessage)}finally{}},E=async(F,P)=>{try{let R=await i.addRecord(n,P);if(R&&R.response){let W=await i.saveRelatedEntityRecord(n,R.response.recordId,F.linkedEntities);W&&W.response&&e("onSaveDialog",{entityName:n,recordId:t})}}catch(R){R.validationErrors&&(d.value=JSON.parse(JSON.stringify(R.validationErrors))),console.error("Error fetching entity:",R.errorMessage)}finally{}},k=async F=>{try{const P=await i.updateRecord(n,t,F);P&&P.response&&(h.value=!1,r.value=JSON.parse(JSON.stringify(o.value)),e("onSaveDialog",{entityName:n,recordId:t}))}catch(P){P.validationErrors&&(d.value=JSON.parse(JSON.stringify(P.errvalidationErrorsors))),console.error("Error fetching entity:",P.errorMessage)}finally{}},v=async(F,P,R)=>{try{let W=await i.saveRelatedEntityRecord(F,P,R);W&&W.response&&e("onSaveDialog",{entityName:n,enityRecordId:P})}catch(W){W.validationErrors&&(d.value=JSON.parse(JSON.stringify(W.validationErrors))),console.error("Error fetching entity:",W.errorMessage)}finally{}},S=()=>{for(let F=0;F<a.value.length;F++){let P=a.value[F];P.autoGenerated||(o.value[P.name]="")}},x=F=>{let P="";for(let R=0;R<a.value.length;R++){let W=a.value[R];if(F==W.name){P=W.type;break}}return P},O=()=>{const F=a.value.filter(R=>R.autoGenerated).map(R=>R.name);return Object.entries(o.value).filter(([R])=>!F.includes(R)).map(([R,W])=>({recordColumnName:R,recordColumnValue:W,columnType:x(R)}))},M=async(F={})=>{try{await c.value.validate(o.value,{abortEarly:!1}),g({})}catch(R){const W=R.inner.reduce((G,ot)=>(G[ot.path]||(G[ot.path]={messages:[]}),G[ot.path].messages.push(...ot.errors),G),{}),J=Object.entries(W).reduce((G,[ot,nt])=>(G[ot]={messages:nt.messages},G),{});g(J);return}const P={dataDefinitions:O()};t?await k(P):F.relationType=="MANY_TO_ONE"?await E(F,P):await w(P)},C=()=>{c.value=Is().shape(a.value.reduce((F,P)=>(P.autoGenerated||(F[P.name]=Ls().nullable(!1).test({name:"custom-validation",test:function(R){const W=[];let J="";if(P.required&&(!R||R.trim()===""))if(P.validations){J=T(P.validations,"VALIDATE_REQUIRED"),W.push(J);let G=U(P.validations,"VALIDATE_REQUIRED");G&&(G="hint:"+G,W.push(G))}else J=P.displayName+" is required.",W.push(J);else{if(P.maxLength&&R.length>P.maxLength)if(P.validations){J=T(P.validations,"VALIDATE_MAXLENGTH"),W.push(J);let G=U(P.validations,"VALIDATE_MAXLENGTH");G&&(G="hint:"+G,W.push(G))}else J=P.displayName+" cannot exceed from "+P.maxLength+" characters",W.push(J);if(P.regxId&&!new RegExp($(P.validations,"VALIDATE_REGX")).test(R))if(P.validations){J=T(P.validations,"VALIDATE_REGX"),W.push(J);let G=U(P.validations,"VALIDATE_REGX");G&&(G="hint:"+G,W.push(G))}else J=P.displayName+" invalid format.",W.push(J)}return W.length>0?this.createError({message:W}):!0}})),F),{}))},T=(F,P)=>{for(let R=0;R<F.length;R++)if(P==F[R].type)return F[R].message},$=(F,P)=>{for(let R=0;R<F.length;R++)if(P==F[R].type)return F[R].regx},U=(F,P)=>{for(let R=0;R<F.length;R++)if(P==F[R].type)return F[R].hint},H=F=>{g({...p.value,[F]:null}),h.value=!0},B=()=>{h.value=!1;for(let F in o.value)o.value.hasOwnProperty(F)&&g({...p.value,[F]:null});o.value=JSON.parse(JSON.stringify(r.value))},I=()=>{for(let F=0;F<a.value.length;F++){const P=a.value[F];if(P.primaryKey&&P.primaryKey==!0){f.value=P;break}}};return{formData:o,columns:a,errors:p,backendErrors:d,isDataChange:h,linkedEntities:u,primarayKeyColumn:f,clearErrors:H,saveRecord:M,fetchAllRecords:y,fetchRecord:b,getRelatedEntityRecordById:_,cancleRecord:B,saveRelatedEntityRecord:v}}const Ru={key:0,class:"surface-card"},Lu={class:"info"},Iu={key:0,class:"list-none p-0"},Vr={__name:"EntityFormErrors",props:{errors:Array},setup(n){let t=l.ref(!0);const e=()=>{t.value=!t.value};return(i,s)=>{var r;const o=l.resolveComponent("Message");return((r=n.errors)==null?void 0:r.length)>0?(l.openBlock(),l.createElementBlock("div",Ru,[s[1]||(s[1]=l.createElementVNode("h4",{class:"flex-1 font-bold text-red-500"},"Errors",-1)),l.createElementVNode("div",Lu,[l.createElementVNode("span",{onClick:s[0]||(s[0]=a=>e()),class:"cursor-pointer underline showHideColor"},l.toDisplayString(l.unref(t)?"Hide":"Show"),1)]),l.unref(t)?(l.openBlock(),l.createElementBlock("ul",Iu,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(n.errors,(a,c)=>(l.openBlock(),l.createElementBlock("li",{key:c,class:"mb-2"},[l.createVNode(o,{style:{"word-break":"break-all"},closable:!1,severity:"error"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(a.message),1)]),_:2},1024)]))),128))])):l.createCommentVNode("",!0)])):l.createCommentVNode("",!0)}}},ju={class:"field flex flex-col"},zu=["for"],Wu={key:0,class:"flex items-center"},Hu={key:1},Uu={class:"flex items-center"},Ar={__name:"EntitySelection",props:{modelValue:{required:!0},entityName:{type:String,required:!0},columnName:{type:String,required:!0},relatedEntityColumn:{type:String,required:!0}},emits:["update:modelValue"],setup(n,{emit:t}){const e=n,i=new qe,s=l.ref({});let o=l.ref("");const r=t;l.onMounted(()=>{a()});const a=async()=>{try{const u=await i.getEntityRecords(e.entityName);u&&u.response&&(s.value=u.response,d())}catch{}finally{}},c=()=>{r("update:modelValue",o.value[e.relatedEntityColumn])},d=()=>{for(let u=0;u<s.value.result.length;u++){const h=s.value.result[u];if(h[e.relatedEntityColumn]==e.modelValue){o.value=h;break}}};return(u,h)=>{const f=l.resolveComponent("Select");return l.openBlock(),l.createElementBlock("div",ju,[l.createElementVNode("label",{for:n.columnName},l.toDisplayString(n.columnName),9,zu),l.createVNode(f,{modelValue:l.unref(o),"onUpdate:modelValue":[h[0]||(h[0]=m=>l.isRef(o)?o.value=m:o=m),c],"item-value":n.relatedEntityColumn,options:s.value.result,filter:"",optionLabel:n.relatedEntityColumn,placeholder:"Select "+n.relatedEntityColumn,class:"w-full"},{value:l.withCtx(m=>[m.value?(l.openBlock(),l.createElementBlock("div",Wu,[l.createElementVNode("div",null,l.toDisplayString(m.value[n.relatedEntityColumn]),1)])):(l.openBlock(),l.createElementBlock("span",Hu,l.toDisplayString(m.placeholder),1))]),option:l.withCtx(m=>[l.createElementVNode("div",Uu,[l.createElementVNode("div",null,l.toDisplayString(m.option[n.relatedEntityColumn]),1)])]),_:1},8,["modelValue","item-value","options","optionLabel","placeholder"])])}}},qu={key:0,style:{"font-weight":"700","font-size":"1.25rem"}},Yu={key:1,style:{"font-weight":"700","font-size":"1.25rem"}},Ku={__name:"EntityDialog",props:l.mergeModels({entityName:{type:String,required:!0},recordId:{type:[String,Number],default:null}},{showForm:{},showFormModifiers:{}}),emits:l.mergeModels(["onSaveDialog"],["update:showForm"]),setup(n,{emit:t}){const e=l.useModel(n,"showForm"),i=t,{formData:s,columns:o,errors:r,backendErrors:a,clearErrors:c,saveRecord:d,fetchAllRecords:u,fetchRecord:h}=js(n.entityName,n.recordId,i);return l.onMounted(()=>{n.recordId?h():u()}),(f,m)=>{const p=l.resolveComponent("Button"),g=l.resolveComponent("Dialog");return e.value?(l.openBlock(),l.createBlock(g,{key:0,showFooter:!1,visible:e.value,"onUpdate:visible":m[2]||(m[2]=y=>e.value=y),style:{width:"50rem"},breakpoints:{"1199px":"75vw","575px":"90vw"},modal:!0,class:"p-fluid"},{header:l.withCtx(()=>[n.recordId?(l.openBlock(),l.createElementBlock("span",qu,"Edit "+l.toDisplayString(n.entityName)+" record details",1)):l.createCommentVNode("",!0),n.recordId?l.createCommentVNode("",!0):(l.openBlock(),l.createElementBlock("span",Yu,"Add "+l.toDisplayString(n.entityName)+" record details",1))]),footer:l.withCtx(()=>[l.createVNode(p,{type:"button",icon:"",label:"Cancel",severity:"secondary",onClick:m[0]||(m[0]=y=>e.value=!1)}),l.createVNode(p,{type:"button",icon:"",label:"Save",severity:"success",onClick:m[1]||(m[1]=y=>l.unref(d)())})]),default:l.withCtx(()=>{var y;return[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(o),(b,_)=>{var w;return l.openBlock(),l.createElementBlock("div",{key:_},[!b.autoGenerated&&!b.foreignKey?(l.openBlock(),l.createBlock(Ni,{key:0,modelValue:l.unref(s)[b.name],"onUpdate:modelValue":E=>l.unref(s)[b.name]=E,column:b,errors:(w=l.unref(r)[b.name])==null?void 0:w.messages,onInput:l.unref(c)},null,8,["modelValue","onUpdate:modelValue","column","errors","onInput"])):l.createCommentVNode("",!0),!b.autoGenerated&&b.foreignKey?(l.openBlock(),l.createBlock(Ar,{key:1,modelValue:l.unref(s)[b.name],"onUpdate:modelValue":E=>l.unref(s)[b.name]=E,entityName:b.foreignKey.referencedEntityName,columnName:b.name,relatedEntityColumn:b.foreignKey.referencedColumnName},null,8,["modelValue","onUpdate:modelValue","entityName","columnName","relatedEntityColumn"])):l.createCommentVNode("",!0)])}),128)),((y=l.unref(a))==null?void 0:y.length)>0?(l.openBlock(),l.createBlock(Vr,{key:0,errors:l.unref(a)},null,8,["errors"])):l.createCommentVNode("",!0)]}),_:1},8,["visible"])):l.createCommentVNode("",!0)}}},Xu={__name:"DeleteConfirmationDialog",props:l.mergeModels({entityName:{type:String,required:!0},recordId:{type:[String,Number],default:null}},{showDeleteDialog:{},showDeleteDialogModifiers:{}}),emits:l.mergeModels(["onDeleteItem"],["update:showDeleteDialog"]),setup(n,{emit:t}){const e=new qe,i=l.useModel(n,"showDeleteDialog"),s=t,o=async()=>{try{const r=await e.deleteRecord(n.entityName,n.recordId);r&&r.response&&s("onDeleteItem")}catch(r){console.error("Error deleting record:",r.errorMessage)}finally{}};return(r,a)=>{const c=l.resolveComponent("Button"),d=l.resolveComponent("Dialog");return l.openBlock(),l.createBlock(d,{visible:i.value,"onUpdate:visible":a[1]||(a[1]=u=>i.value=u),style:{width:"450px"},header:"Confirm",modal:!0},{footer:l.withCtx(()=>[l.createVNode(c,{label:"No",icon:"pi pi-times",text:"",onClick:a[0]||(a[0]=u=>i.value=!1)}),l.createVNode(c,{label:"Yes",icon:"pi pi-check",text:"",onClick:o})]),default:l.withCtx(()=>[a[2]||(a[2]=l.createElementVNode("div",{class:"flex items-center justify-center"},[l.createElementVNode("i",{class:"pi pi-exclamation-triangle mr-3",style:{"font-size":"2rem"}}),l.createElementVNode("span",null,"Are you sure you want to delete the selected item?")],-1))]),_:1},8,["visible"])}}};function zs(n){return n==null||n===""||Array.isArray(n)&&n.length===0||!(n instanceof Date)&&typeof n=="object"&&Object.keys(n).length===0}function Fr(n){return!!(n&&n.constructor&&n.call&&n.apply)}function bt(n){return!zs(n)}function mn(n,t=!0){return n instanceof Object&&n.constructor===Object&&(t||Object.keys(n).length!==0)}function Zt(n,...t){return Fr(n)?n(...t):n}function le(n,t=!0){return typeof n=="string"&&(t||n!=="")}function Me(n){return le(n)?n.replace(/(-|_)/g,"").toLowerCase():n}function Br(n,t="",e={}){const i=Me(t).split("."),s=i.shift();return s?mn(n)?Br(Zt(n[Object.keys(n).find(o=>Me(o)===s)||""],e),i.join("."),e):void 0:Zt(n,e)}function Ws(n,t=!0){return Array.isArray(n)&&(t||n.length!==0)}function Gu(n){return bt(n)&&!isNaN(n)}function be(n,t){if(t){const e=t.test(n);return t.lastIndex=0,e}return!1}function Fn(n){return n&&n.replace(/\/\*(?:(?!\*\/)[\s\S])*\*\/|[\r\n\t]+/g,"").replace(/ {2,}/g," ").replace(/ ([{:}]) /g,"$1").replace(/([;,]) /g,"$1").replace(/ !/g,"!").replace(/: /g,":")}function $r(n){return le(n)?n.replace(/(_)/g,"-").replace(/[A-Z]/g,(t,e)=>e===0?t:"-"+t.toLowerCase()).toLowerCase():n}function Rr(n){return le(n)?n.replace(/[A-Z]/g,(t,e)=>e===0?t:"."+t.toLowerCase()).toLowerCase():n}var pn={STARTS_WITH:"startsWith",CONTAINS:"contains",NOT_CONTAINS:"notContains",ENDS_WITH:"endsWith",EQUALS:"equals",NOT_EQUALS:"notEquals",IN:"in",LESS_THAN:"lt",LESS_THAN_OR_EQUAL_TO:"lte",GREATER_THAN:"gt",GREATER_THAN_OR_EQUAL_TO:"gte",BETWEEN:"between",DATE_IS:"dateIs",DATE_IS_NOT:"dateIsNot",DATE_BEFORE:"dateBefore",DATE_AFTER:"dateAfter"},Qu={AND:"and",OR:"or"};const Ju={key:0},Zu={key:1},Hs={__name:"RecordColumnRenderer",props:{column:Object,value:null},setup(n){const t=l.ref(null),e=Object.assign({"/src/directives/dateFormat.js":()=>Promise.resolve().then(()=>dy),"/src/directives/textFormatUpperCase.js":()=>Promise.resolve().then(()=>uy)});async function i(){await l.nextTick();const s=e[`/src/directives/${n.column.displayFormatKey}.js`];s&&t.value&&s().then(o=>{o.default.beforeMount(t.value,{value:n.value,arg:n.column.displayFormat})})}return l.onMounted(()=>{i()}),l.onUpdated(()=>{i()}),(s,o)=>n.column.displayFormatKey?(l.openBlock(),l.createElementBlock("span",Ju,[l.createElementVNode("span",{ref_key:"el",ref:t},l.toDisplayString(n.value),513)])):(l.openBlock(),l.createElementBlock("span",Zu,l.toDisplayString(n.value),1))}};class th{constructor(){this.httpService=new Zo}async getEntities(){return await this.getAppId(),await this.httpService.get(`/api/app/v1/${this.appId}/entity`)}getEntity(t){}saveEntity(){}async getAppId(){const t=me();this.appId=t.getAppId()}}const Lr=Jo("entitiesStore",{state:()=>({entities:[],entityService:new th}),actions:{async fetchEntities(){try{return await this.entityService.getEntities()}catch(n){console.error("Error fetching entities:",n)}finally{}},async getEntities(){if(this.entities.length===0){const n=await this.fetchEntities();return this.setEntities(n.response),this.entities}else return this.entities},setEntities(n){this.entities=n}},getters:{}}),eh={class:"field flex flex-col w-full"},nh={key:0,class:"flex items-center"},ih={key:1},sh={class:"flex items-center"},oh={__name:"EntityExplorer",props:{entityName:String,onEntityChangeCallback:Function},setup(n){const t=me(),e=l.ref(""),i=Lr(),s=l.ref([]),o=async()=>{s.value=await i.getEntities(),r()},r=()=>{for(let c=0;c<s.value.length;c++){const d=s.value[c];d.name.toLowerCase()==n.entityName.toLowerCase()&&(e.value=d)}},a=()=>{n.onEntityChangeCallback(e.value.name)};return l.watch(()=>t.globalConfigs.appId,async c=>{c&&await o()},{immediate:!0}),(c,d)=>{const u=l.resolveComponent("Select");return l.openBlock(),l.createElementBlock("div",eh,[l.createVNode(u,{modelValue:e.value,"onUpdate:modelValue":[d[0]||(d[0]=h=>e.value=h),a],options:s.value,filter:"",optionLabel:"name",placeholder:"Select entity",class:"w-full"},{value:l.withCtx(h=>[h.value?(l.openBlock(),l.createElementBlock("div",nh,[l.createElementVNode("div",null,l.toDisplayString(h.value.name),1)])):(l.openBlock(),l.createElementBlock("span",ih,l.toDisplayString(h.placeholder),1))]),option:l.withCtx(h=>[l.createElementVNode("div",sh,[l.createElementVNode("div",null,l.toDisplayString(h.option.name),1)])]),_:1},8,["modelValue","options"])])}}},rh={class:"card"},ah={class:"flex flex-row w-1/6"},lh={class:"my-2"},ch={class:"flex flex-col md:flex-row md:justify-between md:items-center"},dh={class:"flex flex-row items-center"},uh={class:"ml-2"},hh={class:"flex flex-row gap-2"},Ir={__name:"Grid",props:{entityName:String},setup(n){const t=me(),e=n,i=Ut.useRoute(),s=l.ref(e.entityName||i.params.entityName),o=l.ref({}),r=l.ref(""),a=l.ref(!1),c=l.ref(!1),{items:d,headers:u,first:h,totalRecords:f,pageSize:m,loading:p,sortBy:g,sortDirection:y,operatorMap:b,filterToSend:_,primarayKeyColumn:w,fullTextSearch:E,listingResponse:k,onFullTextSearch:v,getDatatypeByField:S,getColumnDatatype:x,onSort:O,onPage:M,onFilter:C,fetchEntityFilterData:T,fetchEntityByName:$}=yd(s.value),U=l.ref();let H=l.ref(!1);const B=nt=>{o.value=nt.reduce((Y,st)=>{if(!st.filterable)return Y;let ut=pn.CONTAINS;switch(st.datatype.toLowerCase()){case"string":case"uuid":ut=pn.STARTS_WITH;break;case"date":ut=pn.DATE_IS;break;case"numeric":case"int":case"integer":ut=pn.EQUALS;break;case"bool":case"boolean":ut=pn.EQUALS;break}return st.datatype=="bool"||st.datatype=="boolean"?Y[st.field]={value:null,matchMode:pn.EQUALS}:Y[st.field]={operator:Qu.AND,constraints:[{value:null,matchMode:ut}]},Y},{})},I=()=>{B(u.value),_.value=G(o.value),C()},F=nt=>{_.value=G(o.value),C()},P=nt=>{nt?r.value=nt[w.value.name]:r.value="",a.value=!a.value},R=()=>{a.value=!1,T(!1)},W=nt=>{r.value=nt[w.value.name],c.value=!0},J=()=>{c.value=!1,T(!1)},G=nt=>Object.keys(nt).map(Y=>{const st=nt[Y];return st.constraints?st.constraints.filter(ut=>ut.value!==null&&ut.value!=="").map(ut=>({columnName:Y,operator:b[ut.matchMode]??ut.matchMode,value:ut.value,columnType:S(Y)})):st.value!==null&&st.value!==""?{columnName:Y,operator:b[st.matchMode]??st.matchMode,value:st.value,columnType:S(Y)}:[]}).flat(),ot=nt=>{s.value=nt,$(nt)};return l.watch(()=>t.globalConfigs.appId,async nt=>{nt&&$(s.value)},{immediate:!0}),l.watch(()=>u.value,nt=>{!H.value&&nt&&nt.length&&(B(nt),H.value=!0)},{immediate:!0}),(nt,Y)=>{const st=l.resolveComponent("Button"),ut=l.resolveComponent("Toolbar"),Ue=l.resolveComponent("ProgressSpinner"),Gt=l.resolveComponent("InputIcon"),De=l.resolveComponent("IconField"),fe=l.resolveComponent("Calendar"),j=l.resolveComponent("InputNumber"),A=l.resolveComponent("Checkbox"),rt=l.resolveComponent("Column"),Ht=l.resolveComponent("DataTable");return l.openBlock(),l.createElementBlock(l.Fragment,null,[l.createElementVNode("div",rh,[l.createElementVNode("div",ah,[(l.openBlock(),l.createBlock(oh,{key:s.value,entityName:s.value,onEntityChangeCallback:ot},null,8,["entityName"]))]),l.createVNode(ut,{class:"mb-4 mt-4"},{start:l.withCtx(()=>[l.createElementVNode("div",lh,[l.createVNode(st,{type:"button",icon:"pi pi-filter-slash",label:"Clear",severity:"warning",onClick:Y[0]||(Y[0]=xt=>I())})])]),end:l.withCtx(()=>[l.createVNode(st,{label:"Add",icon:"pi pi-plus",class:"mr-2",severity:"success",onClick:Y[1]||(Y[1]=xt=>P())})]),_:1}),l.createVNode(Ht,{lazy:"",value:l.unref(d),loading:l.unref(p),ref_key:"dt",ref:U,stripedRows:!0,showGridlines:"",rowHover:!0,paginator:!0,rows:l.unref(m),rowsPerPageOptions:[10,25,50,100],totalRecords:l.unref(f),first:l.unref(h),sortField:l.unref(g),sortOrder:l.unref(y),filters:o.value,"onUpdate:filters":Y[5]||(Y[5]=xt=>o.value=xt),filterDisplay:"menu",scrollable:"",scrollHeight:"400px",onSort:l.unref(O),onPage:l.unref(M),onFilter:Y[6]||(Y[6]=xt=>F()),size:"large",paginatorTemplate:"FirstPageLink PrevPageLink PageLinks NextPageLink LastPageLink CurrentPageReport RowsPerPageDropdown",currentPageReportTemplate:"Showing {first} to {last} of {totalRecords} items"},{empty:l.withCtx(()=>Y[9]||(Y[9]=[l.createTextVNode(" No data found. ")])),loading:l.withCtx(()=>[l.createVNode(Ue)]),header:l.withCtx(()=>[l.createElementVNode("div",ch,[l.createElementVNode("div",dh,[Y[10]||(Y[10]=l.createElementVNode("h5",{class:"m-0 text-xl font-semibold"},"Entity Name:",-1)),l.createElementVNode("span",uh,l.toDisplayString(s.value),1)]),l.createVNode(De,{iconPosition:"left",class:"block mt-2 md:mt-0"},{default:l.withCtx(()=>[l.createVNode(Gt,{class:"pi pi-search",onClick:Y[2]||(Y[2]=xt=>l.unref(v)())}),l.createVNode(l.unref(qo.InputText),{class:"w-full sm:w-auto",onKeyup:Y[3]||(Y[3]=l.withKeys(xt=>l.unref(v)(),["enter"])),modelValue:l.unref(E),"onUpdate:modelValue":Y[4]||(Y[4]=xt=>l.isRef(E)?E.value=xt:null),placeholder:"Search..."},null,8,["modelValue"])]),_:1})])]),default:l.withCtx(()=>{var xt;return[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(u),dt=>(l.openBlock(),l.createBlock(rt,{key:dt.field,dataType:l.unref(x)(dt.datatype),field:dt.field,header:dt.name,sortable:dt.sortable,showAddButton:!1,showFilterOperator:!1,style:{"text-wrap":"nowrap"}},l.createSlots({body:l.withCtx(({data:ct})=>[l.createVNode(Hs,{column:dt,value:ct[dt.field]},null,8,["column","value"])]),_:2},[dt.datatype.toLowerCase()==="date"&&dt.filterable?{name:"filter",fn:l.withCtx(({filterModel:ct})=>[l.createVNode(fe,{modelValue:ct.value,"onUpdate:modelValue":Ot=>ct.value=Ot,dateFormat:"mm/dd/yy",placeholder:"mm/dd/yyyy"},null,8,["modelValue","onUpdate:modelValue"])]),key:"0"}:dt.datatype.toLowerCase()==="int"&&dt.filterable?{name:"filter",fn:l.withCtx(({filterModel:ct})=>[l.createVNode(j,{modelValue:ct.value,"onUpdate:modelValue":Ot=>ct.value=Ot,placeholder:"Search..."},null,8,["modelValue","onUpdate:modelValue"])]),key:"1"}:dt.datatype.toLowerCase()==="boolean"&&dt.filterable?{name:"filter",fn:l.withCtx(({filterModel:ct})=>[l.createVNode(A,{modelValue:ct.value,"onUpdate:modelValue":Ot=>ct.value=Ot,indeterminate:ct.value===null,binary:""},null,8,["modelValue","onUpdate:modelValue","indeterminate"])]),key:"2"}:dt.filterable?{name:"filter",fn:l.withCtx(({filterModel:ct})=>[l.createVNode(l.unref(qo.InputText),{style:{width:"150px"},type:"text",modelValue:ct.value,"onUpdate:modelValue":Ot=>ct.value=Ot,class:"p-column-filter",placeholder:"Search..."},null,8,["modelValue","onUpdate:modelValue"])]),key:"3"}:void 0]),1032,["dataType","field","header","sortable"]))),128)),((xt=l.unref(d))==null?void 0:xt.length)>0?(l.openBlock(),l.createBlock(rt,{key:0,header:"Actions"},{body:l.withCtx(({data:dt})=>[l.createElementVNode("div",hh,[l.createVNode(st,{onClick:ct=>P(dt),icon:"pi pi-pencil",severity:"success",size:"",rounded:"","aria-label":"Edit"},null,8,["onClick"]),l.createVNode(st,{onClick:ct=>W(dt),icon:"pi pi-trash",severity:"danger",rounded:"","aria-label":"Delete"},null,8,["onClick"])])]),_:1})):l.createCommentVNode("",!0)]}),_:1},8,["value","loading","rows","totalRecords","first","sortField","sortOrder","filters","onSort","onPage"])]),a.value?(l.openBlock(),l.createBlock(Ku,{key:0,showForm:a.value,"onUpdate:showForm":Y[7]||(Y[7]=xt=>a.value=xt),entityName:l.unref(k).entityName,recordId:r.value,onOnSaveDialog:R},null,8,["showForm","entityName","recordId"])):l.createCommentVNode("",!0),c.value?(l.openBlock(),l.createBlock(Xu,{key:1,showDeleteDialog:c.value,"onUpdate:showDeleteDialog":Y[8]||(Y[8]=xt=>c.value=xt),entityName:l.unref(k).entityName,recordId:r.value,onOnDeleteItem:J},null,8,["showDeleteDialog","entityName","recordId"])):l.createCommentVNode("",!0)],64)}}};function fh(){const n=new Map;return{on(t,e){let i=n.get(t);return i?i.push(e):i=[e],n.set(t,i),this},off(t,e){let i=n.get(t);return i&&i.splice(i.indexOf(e)>>>0,1),this},emit(t,e){let i=n.get(t);i&&i.slice().map(s=>{s(e)})},clear(){n.clear()}}}var mh=Object.defineProperty,ph=Object.defineProperties,gh=Object.getOwnPropertyDescriptors,ji=Object.getOwnPropertySymbols,jr=Object.prototype.hasOwnProperty,zr=Object.prototype.propertyIsEnumerable,Wr=(n,t,e)=>t in n?mh(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,te=(n,t)=>{for(var e in t||(t={}))jr.call(t,e)&&Wr(n,e,t[e]);if(ji)for(var e of ji(t))zr.call(t,e)&&Wr(n,e,t[e]);return n},Us=(n,t)=>ph(n,gh(t)),_e=(n,t)=>{var e={};for(var i in n)jr.call(n,i)&&t.indexOf(i)<0&&(e[i]=n[i]);if(n!=null&&ji)for(var i of ji(n))t.indexOf(i)<0&&zr.call(n,i)&&(e[i]=n[i]);return e},yh=fh(),Ve=yh;function Hr(n,t){Ws(n)?n.push(...t||[]):mn(n)&&Object.assign(n,t)}function bh(n){return mn(n)&&n.hasOwnProperty("value")&&n.hasOwnProperty("type")?n.value:n}function _h(n){return n.replaceAll(/ /g,"").replace(/[^\w]/g,"-")}function qs(n="",t=""){return _h(`${le(n,!1)&&le(t,!1)?`${n}-`:n}${t}`)}function Ur(n="",t=""){return`--${qs(n,t)}`}function xh(n=""){const t=(n.match(/{/g)||[]).length,e=(n.match(/}/g)||[]).length;return(t+e)%2!==0}function qr(n,t="",e="",i=[],s){if(le(n)){const o=/{([^}]*)}/g,r=n.trim();if(xh(r))return;if(be(r,o)){const a=r.replaceAll(o,u=>{const f=u.replace(/{|}/g,"").split(".").filter(m=>!i.some(p=>be(m,p)));return`var(${Ur(e,$r(f.join("-")))}${bt(s)?`, ${s}`:""})`}),c=/(\d+\s+[\+\-\*\/]\s+\d+)/g,d=/var\([^)]+\)/g;return be(a.replace(d,"0"),c)?`calc(${a})`:a}return r}else if(Gu(n))return n}function kh(n,t,e){le(t,!1)&&n.push(`${t}:${e};`)}function gn(n,t){return n?`${n}{${t}}`:""}var Bn=(...n)=>Sh(vt.getTheme(),...n),Sh=(n={},t,e,i)=>{if(t){const{variable:s,options:o}=vt.defaults||{},{prefix:r,transform:a}=(n==null?void 0:n.options)||o||{},d=be(t,/{([^}]*)}/g)?t:`{${t}}`;return i==="value"||zs(i)&&a==="strict"?vt.getTokenValue(t):qr(d,void 0,r,[s.excludedKeyRegex],e)}return""};function wh(n,t={}){const e=vt.defaults.variable,{prefix:i=e.prefix,selector:s=e.selector,excludedKeyRegex:o=e.excludedKeyRegex}=t,r=(d,u="")=>Object.entries(d).reduce((h,[f,m])=>{const p=be(f,o)?qs(u):qs(u,$r(f)),g=bh(m);if(mn(g)){const{variables:y,tokens:b}=r(g,p);Hr(h.tokens,b),Hr(h.variables,y)}else h.tokens.push((i?p.replace(`${i}-`,""):p).replaceAll("-",".")),kh(h.variables,Ur(p),qr(g,p,i,[o]));return h},{variables:[],tokens:[]}),{variables:a,tokens:c}=r(n,i);return{value:a,tokens:c,declarations:a.join(""),css:gn(s,a.join(""))}}var ee={regex:{rules:{class:{pattern:/^\.([a-zA-Z][\w-]*)$/,resolve(n){return{type:"class",selector:n,matched:this.pattern.test(n.trim())}}},attr:{pattern:/^\[(.*)\]$/,resolve(n){return{type:"attr",selector:`:root${n}`,matched:this.pattern.test(n.trim())}}},media:{pattern:/^@media (.*)$/,resolve(n){return{type:"media",selector:`${n}{:root{[CSS]}}`,matched:this.pattern.test(n.trim())}}},system:{pattern:/^system$/,resolve(n){return{type:"system",selector:"@media (prefers-color-scheme: dark){:root{[CSS]}}",matched:this.pattern.test(n.trim())}}},custom:{resolve(n){return{type:"custom",selector:n,matched:!0}}}},resolve(n){const t=Object.keys(this.rules).filter(e=>e!=="custom").map(e=>this.rules[e]);return[n].flat().map(e=>{var i;return(i=t.map(s=>s.resolve(e)).find(s=>s.matched))!=null?i:this.rules.custom.resolve(e)})}},_toVariables(n,t){return wh(n,{prefix:t==null?void 0:t.prefix})},getCommon({name:n="",theme:t={},params:e,set:i,defaults:s}){var o,r,a,c,d,u,h;const{preset:f,options:m}=t;let p,g,y,b,_,w,E;if(bt(f)&&m.transform!=="strict"){const{primitive:k,semantic:v,extend:S}=f,x=v||{},{colorScheme:O}=x,M=_e(x,["colorScheme"]),C=S||{},{colorScheme:T}=C,$=_e(C,["colorScheme"]),U=O||{},{dark:H}=U,B=_e(U,["dark"]),I=T||{},{dark:F}=I,P=_e(I,["dark"]),R=bt(k)?this._toVariables({primitive:k},m):{},W=bt(M)?this._toVariables({semantic:M},m):{},J=bt(B)?this._toVariables({light:B},m):{},G=bt(H)?this._toVariables({dark:H},m):{},ot=bt($)?this._toVariables({semantic:$},m):{},nt=bt(P)?this._toVariables({light:P},m):{},Y=bt(F)?this._toVariables({dark:F},m):{},[st,ut]=[(o=R.declarations)!=null?o:"",R.tokens],[Ue,Gt]=[(r=W.declarations)!=null?r:"",W.tokens||[]],[De,fe]=[(a=J.declarations)!=null?a:"",J.tokens||[]],[j,A]=[(c=G.declarations)!=null?c:"",G.tokens||[]],[rt,Ht]=[(d=ot.declarations)!=null?d:"",ot.tokens||[]],[xt,dt]=[(u=nt.declarations)!=null?u:"",nt.tokens||[]],[ct,Ot]=[(h=Y.declarations)!=null?h:"",Y.tokens||[]];p=this.transformCSS(n,st,"light","variable",m,i,s),g=ut;const Dn=this.transformCSS(n,`${Ue}${De}`,"light","variable",m,i,s),oe=this.transformCSS(n,`${j}`,"dark","variable",m,i,s);y=`${Dn}${oe}`,b=[...new Set([...Gt,...fe,...A])];const ln=this.transformCSS(n,`${rt}${xt}color-scheme:light`,"light","variable",m,i,s),Nn=this.transformCSS(n,`${ct}color-scheme:dark`,"dark","variable",m,i,s);_=`${ln}${Nn}`,w=[...new Set([...Ht,...dt,...Ot])],E=Zt(f.css,{dt:Bn})}return{primitive:{css:p,tokens:g},semantic:{css:y,tokens:b},global:{css:_,tokens:w},style:E}},getPreset({name:n="",preset:t={},options:e,params:i,set:s,defaults:o,selector:r}){var a,c,d;let u,h,f;if(bt(t)&&e.transform!=="strict"){const m=n.replace("-directive",""),p=t,{colorScheme:g,extend:y,css:b}=p,_=_e(p,["colorScheme","extend","css"]),w=y||{},{colorScheme:E}=w,k=_e(w,["colorScheme"]),v=g||{},{dark:S}=v,x=_e(v,["dark"]),O=E||{},{dark:M}=O,C=_e(O,["dark"]),T=bt(_)?this._toVariables({[m]:te(te({},_),k)},e):{},$=bt(x)?this._toVariables({[m]:te(te({},x),C)},e):{},U=bt(S)?this._toVariables({[m]:te(te({},S),M)},e):{},[H,B]=[(a=T.declarations)!=null?a:"",T.tokens||[]],[I,F]=[(c=$.declarations)!=null?c:"",$.tokens||[]],[P,R]=[(d=U.declarations)!=null?d:"",U.tokens||[]],W=this.transformCSS(m,`${H}${I}`,"light","variable",e,s,o,r),J=this.transformCSS(m,P,"dark","variable",e,s,o,r);u=`${W}${J}`,h=[...new Set([...B,...F,...R])],f=Zt(b,{dt:Bn})}return{css:u,tokens:h,style:f}},getPresetC({name:n="",theme:t={},params:e,set:i,defaults:s}){var o;const{preset:r,options:a}=t,c=(o=r==null?void 0:r.components)==null?void 0:o[n];return this.getPreset({name:n,preset:c,options:a,params:e,set:i,defaults:s})},getPresetD({name:n="",theme:t={},params:e,set:i,defaults:s}){var o;const r=n.replace("-directive",""),{preset:a,options:c}=t,d=(o=a==null?void 0:a.directives)==null?void 0:o[r];return this.getPreset({name:r,preset:d,options:c,params:e,set:i,defaults:s})},applyDarkColorScheme(n){return!(n.darkModeSelector==="none"||n.darkModeSelector===!1)},getColorSchemeOption(n,t){var e;return this.applyDarkColorScheme(n)?this.regex.resolve(n.darkModeSelector===!0?t.options.darkModeSelector:(e=n.darkModeSelector)!=null?e:t.options.darkModeSelector):[]},getLayerOrder(n,t={},e,i){const{cssLayer:s}=t;return s?`@layer ${Zt(s.order||"primeui",e)}`:""},getCommonStyleSheet({name:n="",theme:t={},params:e,props:i={},set:s,defaults:o}){const r=this.getCommon({name:n,theme:t,params:e,set:s,defaults:o}),a=Object.entries(i).reduce((c,[d,u])=>c.push(`${d}="${u}"`)&&c,[]).join(" ");return Object.entries(r||{}).reduce((c,[d,u])=>{if(u!=null&&u.css){const h=Fn(u==null?void 0:u.css),f=`${d}-variables`;c.push(`<style type="text/css" data-primevue-style-id="${f}" ${a}>${h}</style>`)}return c},[]).join("")},getStyleSheet({name:n="",theme:t={},params:e,props:i={},set:s,defaults:o}){var r;const a={name:n,theme:t,params:e,set:s,defaults:o},c=(r=n.includes("-directive")?this.getPresetD(a):this.getPresetC(a))==null?void 0:r.css,d=Object.entries(i).reduce((u,[h,f])=>u.push(`${h}="${f}"`)&&u,[]).join(" ");return c?`<style type="text/css" data-primevue-style-id="${n}-variables" ${d}>${Fn(c)}</style>`:""},createTokens(n={},t,e="",i="",s={}){return Object.entries(n).forEach(([o,r])=>{const a=be(o,t.variable.excludedKeyRegex)?e:e?`${e}.${Rr(o)}`:Rr(o),c=i?`${i}.${o}`:o;mn(r)?this.createTokens(r,t,a,c,s):(s[a]||(s[a]={paths:[],computed(d,u={}){var h,f;return this.paths.length===1?(h=this.paths[0])==null?void 0:h.computed(this.paths[0].scheme,u.binding):d&&d!=="none"?(f=this.paths.find(m=>m.scheme===d))==null?void 0:f.computed(d,u.binding):this.paths.map(m=>m.computed(m.scheme,u[m.scheme]))}}),s[a].paths.push({path:c,value:r,scheme:c.includes("colorScheme.light")?"light":c.includes("colorScheme.dark")?"dark":"none",computed(d,u={}){const h=/{([^}]*)}/g;let f=r;if(u.name=this.path,u.binding||(u.binding={}),be(r,h)){const p=r.trim().replaceAll(h,b=>{var _;const w=b.replace(/{|}/g,""),E=(_=s[w])==null?void 0:_.computed(d,u);return Ws(E)&&E.length===2?`light-dark(${E[0].value},${E[1].value})`:E==null?void 0:E.value}),g=/(\d+\w*\s+[\+\-\*\/]\s+\d+\w*)/g,y=/var\([^)]+\)/g;f=be(p.replace(y,"0"),g)?`calc(${p})`:p}return zs(u.binding)&&delete u.binding,{colorScheme:d,path:this.path,paths:u,value:f.includes("undefined")?void 0:f}}}))}),s},getTokenValue(n,t,e){var i;const o=(c=>c.split(".").filter(u=>!be(u.toLowerCase(),e.variable.excludedKeyRegex)).join("."))(t),r=t.includes("colorScheme.light")?"light":t.includes("colorScheme.dark")?"dark":void 0,a=[(i=n[o])==null?void 0:i.computed(r)].flat().filter(c=>c);return a.length===1?a[0].value:a.reduce((c={},d)=>{const u=d,{colorScheme:h}=u,f=_e(u,["colorScheme"]);return c[h]=f,c},void 0)},getSelectorRule(n,t,e,i){return e==="class"||e==="attr"?gn(bt(t)?`${n}${t},${n} ${t}`:n,i):gn(n,bt(t)?gn(t,i):i)},transformCSS(n,t,e,i,s={},o,r,a){if(bt(t)){const{cssLayer:c}=s;if(i!=="style"){const d=this.getColorSchemeOption(s,r);t=e==="dark"?d.reduce((u,{type:h,selector:f})=>(bt(f)&&(u+=f.includes("[CSS]")?f.replace("[CSS]",t):this.getSelectorRule(f,a,h,t)),u),""):gn(a??":root",t)}if(c){const d={name:"primeui",order:"primeui"};mn(c)&&(d.name=Zt(c.name,{name:n,type:i})),bt(d.name)&&(t=gn(`@layer ${d.name}`,t),o==null||o.layerNames(d.name))}return t}return""}},vt={defaults:{variable:{prefix:"p",selector:":root",excludedKeyRegex:/^(primitive|semantic|components|directives|variables|colorscheme|light|dark|common|root|states|extend|css)$/gi},options:{prefix:"p",darkModeSelector:"system",cssLayer:!1}},_theme:void 0,_layerNames:new Set,_loadedStyleNames:new Set,_loadingStyles:new Set,_tokens:{},update(n={}){const{theme:t}=n;t&&(this._theme=Us(te({},t),{options:te(te({},this.defaults.options),t.options)}),this._tokens=ee.createTokens(this.preset,this.defaults),this.clearLoadedStyleNames())},get theme(){return this._theme},get preset(){var n;return((n=this.theme)==null?void 0:n.preset)||{}},get options(){var n;return((n=this.theme)==null?void 0:n.options)||{}},get tokens(){return this._tokens},getTheme(){return this.theme},setTheme(n){this.update({theme:n}),Ve.emit("theme:change",n)},getPreset(){return this.preset},setPreset(n){this._theme=Us(te({},this.theme),{preset:n}),this._tokens=ee.createTokens(n,this.defaults),this.clearLoadedStyleNames(),Ve.emit("preset:change",n),Ve.emit("theme:change",this.theme)},getOptions(){return this.options},setOptions(n){this._theme=Us(te({},this.theme),{options:n}),this.clearLoadedStyleNames(),Ve.emit("options:change",n),Ve.emit("theme:change",this.theme)},getLayerNames(){return[...this._layerNames]},setLayerNames(n){this._layerNames.add(n)},getLoadedStyleNames(){return this._loadedStyleNames},isStyleNameLoaded(n){return this._loadedStyleNames.has(n)},setLoadedStyleName(n){this._loadedStyleNames.add(n)},deleteLoadedStyleName(n){this._loadedStyleNames.delete(n)},clearLoadedStyleNames(){this._loadedStyleNames.clear()},getTokenValue(n){return ee.getTokenValue(this.tokens,n,this.defaults)},getCommon(n="",t){return ee.getCommon({name:n,theme:this.theme,params:t,defaults:this.defaults,set:{layerNames:this.setLayerNames.bind(this)}})},getComponent(n="",t){const e={name:n,theme:this.theme,params:t,defaults:this.defaults,set:{layerNames:this.setLayerNames.bind(this)}};return ee.getPresetC(e)},getDirective(n="",t){const e={name:n,theme:this.theme,params:t,defaults:this.defaults,set:{layerNames:this.setLayerNames.bind(this)}};return ee.getPresetD(e)},getCustomPreset(n="",t,e,i){const s={name:n,preset:t,options:this.options,selector:e,params:i,defaults:this.defaults,set:{layerNames:this.setLayerNames.bind(this)}};return ee.getPreset(s)},getLayerOrderCSS(n=""){return ee.getLayerOrder(n,this.options,{names:this.getLayerNames()},this.defaults)},transformCSS(n="",t,e="style",i){return ee.transformCSS(n,t,i,e,this.options,{layerNames:this.setLayerNames.bind(this)},this.defaults)},getCommonStyleSheet(n="",t,e={}){return ee.getCommonStyleSheet({name:n,theme:this.theme,params:t,props:e,defaults:this.defaults,set:{layerNames:this.setLayerNames.bind(this)}})},getStyleSheet(n,t,e={}){return ee.getStyleSheet({name:n,theme:this.theme,params:t,props:e,defaults:this.defaults,set:{layerNames:this.setLayerNames.bind(this)}})},onStyleMounted(n){this._loadingStyles.add(n)},onStyleUpdated(n){this._loadingStyles.add(n)},onStyleLoaded(n,{name:t}){this._loadingStyles.size&&(this._loadingStyles.delete(t),Ve.emit(`theme:${t}:load`,n),!this._loadingStyles.size&&Ve.emit("theme:load"))}};function Ys(n){return typeof HTMLElement=="object"?n instanceof HTMLElement:n&&typeof n=="object"&&n!==null&&n.nodeType===1&&typeof n.nodeName=="string"}function Ks(n,t={}){if(Ys(n)){const e=(i,s)=>{var o,r;const a=(o=n==null?void 0:n.$attrs)!=null&&o[i]?[(r=n==null?void 0:n.$attrs)==null?void 0:r[i]]:[];return[s].flat().reduce((c,d)=>{if(d!=null){const u=typeof d;if(u==="string"||u==="number")c.push(d);else if(u==="object"){const h=Array.isArray(d)?e(i,d):Object.entries(d).map(([f,m])=>i==="style"&&(m||m===0)?`${f.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}:${m}`:m?f:void 0);c=h.length?c.concat(h.filter(f=>!!f)):c}}return c},a)};Object.entries(t).forEach(([i,s])=>{if(s!=null){const o=i.match(/^on(.+)/);o?n.addEventListener(o[1].toLowerCase(),s):i==="p-bind"||i==="pBind"?Ks(n,s):(s=i==="class"?[...new Set(e("class",s))].join(" ").trim():i==="style"?e("style",s).join(";").trim():s,(n.$attrs=n.$attrs||{})&&(n.$attrs[i]=s),n.setAttribute(i,s))}})}}function Eh(n,t){return Ys(n)?n.matches(t)?n:n.querySelector(t):null}function vh(n){if(n){let t=n.parentNode;return t&&t instanceof ShadowRoot&&t.host&&(t=t.host),t}return null}function Ch(n){return!!(n!==null&&typeof n<"u"&&n.nodeName&&vh(n))}function Yr(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}function Oh(n,t="",e){Ys(n)&&e!==null&&e!==void 0&&n.setAttribute(t,e)}var zi={};function Dh(n="pui_id_"){return zi.hasOwnProperty(n)||(zi[n]=0),zi[n]++,`${n}${zi[n]}`}var $n={_loadedStyleNames:new Set,getLoadedStyleNames:function(){return this._loadedStyleNames},isStyleNameLoaded:function(t){return this._loadedStyleNames.has(t)},setLoadedStyleName:function(t){this._loadedStyleNames.add(t)},deleteLoadedStyleName:function(t){this._loadedStyleNames.delete(t)},clearLoadedStyleNames:function(){this._loadedStyleNames.clear()}};function Rn(n){"@babel/helpers - typeof";return Rn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Rn(n)}function Kr(n,t){var e=Object.keys(n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);t&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(n,s).enumerable})),e.push.apply(e,i)}return e}function Xr(n){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?Kr(Object(e),!0).forEach(function(i){Nh(n,i,e[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(e)):Kr(Object(e)).forEach(function(i){Object.defineProperty(n,i,Object.getOwnPropertyDescriptor(e,i))})}return n}function Nh(n,t,e){return(t=Th(t))in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}function Th(n){var t=Ph(n,"string");return Rn(t)=="symbol"?t:t+""}function Ph(n,t){if(Rn(n)!="object"||!n)return n;var e=n[Symbol.toPrimitive];if(e!==void 0){var i=e.call(n,t||"default");if(Rn(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(n)}function Mh(n){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;l.getCurrentInstance()?l.onMounted(n):t?n():l.nextTick(n)}var Vh=0;function Ah(n){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},e=l.ref(!1),i=l.ref(n),s=l.ref(null),o=Yr()?window.document:void 0,r=t.document,a=r===void 0?o:r,c=t.immediate,d=c===void 0?!0:c,u=t.manual,h=u===void 0?!1:u,f=t.name,m=f===void 0?"style_".concat(++Vh):f,p=t.id,g=p===void 0?void 0:p,y=t.media,b=y===void 0?void 0:y,_=t.nonce,w=_===void 0?void 0:_,E=t.first,k=E===void 0?!1:E,v=t.onMounted,S=v===void 0?void 0:v,x=t.onUpdated,O=x===void 0?void 0:x,M=t.onLoad,C=M===void 0?void 0:M,T=t.props,$=T===void 0?{}:T,U=function(){},H=function(F){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(a){var R=Xr(Xr({},$),P),W=R.name||m,J=R.id||g,G=R.nonce||w;s.value=a.querySelector('style[data-primevue-style-id="'.concat(W,'"]'))||a.getElementById(J)||a.createElement("style"),s.value.isConnected||(i.value=F||n,Ks(s.value,{type:"text/css",id:J,media:b,nonce:G}),k?a.head.prepend(s.value):a.head.appendChild(s.value),Oh(s.value,"data-primevue-style-id",W),Ks(s.value,R),s.value.onload=function(ot){return C==null?void 0:C(ot,{name:W})},S==null||S(W)),!e.value&&(U=l.watch(i,function(ot){s.value.textContent=ot,O==null||O(W)},{immediate:!0}),e.value=!0)}},B=function(){!a||!e.value||(U(),Ch(s.value)&&a.head.removeChild(s.value),e.value=!1)};return d&&!h&&Mh(H),{id:g,name:m,el:s,css:i,unload:B,load:H,isLoaded:l.readonly(e)}}function Ln(n){"@babel/helpers - typeof";return Ln=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ln(n)}function Gr(n,t){return Rh(n)||$h(n,t)||Bh(n,t)||Fh()}function Fh(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
13
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
12
|
+
`+(l!==r?`result of cast: ${l}`:""))}return o}_cast(t,e){let i=t===void 0?t:this.transforms.reduce((s,o)=>o.call(this,s,t,this),t);return i===void 0&&(i=this.getDefault(e)),i}_validate(t,e={},i,s){let{path:o,originalValue:r=t,strict:l=this.spec.strict}=e,c=t;l||(c=this._cast(c,Object.assign({assert:!1},e)));let d=[];for(let u of Object.values(this.internalTests))u&&d.push(u);this.runTests({path:o,value:c,originalValue:r,options:e,tests:d},i,u=>{if(u.length)return s(u,c);this.runTests({path:o,value:c,originalValue:r,options:e,tests:this.tests},i,s)})}runTests(t,e,i){let s=!1,{tests:o,value:r,originalValue:l,path:c,options:d}=t,u=g=>{s||(s=!0,e(g,r))},h=g=>{s||(s=!0,i(g,r))},f=o.length,m=[];if(!f)return h([]);let p={value:r,originalValue:l,path:c,options:d,schema:this};for(let g=0;g<o.length;g++){const y=o[g];y(p,u,function(_){_&&(Array.isArray(_)?m.push(..._):m.push(_)),--f<=0&&h(m)})}}asNestedTest({key:t,index:e,parent:i,parentPath:s,originalParent:o,options:r}){const l=t??e;if(l==null)throw TypeError("Must include `key` or `index` for nested validations");const c=typeof l=="number";let d=i[l];const u=Object.assign({},r,{strict:!0,parent:i,value:d,originalValue:o[l],key:void 0,[c?"index":"key"]:l,path:c||l.includes(".")?`${s||""}[${c?l:`"${l}"`}]`:(s?`${s}.`:"")+t});return(h,f,m)=>this.resolve(u)._validate(d,u,f,m)}validate(t,e){var i;let s=this.resolve(Object.assign({},e,{value:t})),o=(i=e==null?void 0:e.disableStackTrace)!=null?i:s.spec.disableStackTrace;return new Promise((r,l)=>s._validate(t,e,(c,d)=>{$t.isError(c)&&(c.value=d),l(c)},(c,d)=>{c.length?l(new $t(c,d,void 0,void 0,o)):r(d)}))}validateSync(t,e){var i;let s=this.resolve(Object.assign({},e,{value:t})),o,r=(i=e==null?void 0:e.disableStackTrace)!=null?i:s.spec.disableStackTrace;return s._validate(t,Object.assign({},e,{sync:!0}),(l,c)=>{throw $t.isError(l)&&(l.value=c),l},(l,c)=>{if(l.length)throw new $t(l,t,void 0,void 0,r);o=c}),o}isValid(t,e){return this.validate(t,e).then(()=>!0,i=>{if($t.isError(i))return!1;throw i})}isValidSync(t,e){try{return this.validateSync(t,e),!0}catch(i){if($t.isError(i))return!1;throw i}}_getDefault(t){let e=this.spec.default;return e==null?e:typeof e=="function"?e.call(this,t):fn(e)}getDefault(t){return this.resolve(t||{})._getDefault(t)}default(t){return arguments.length===0?this._getDefault():this.clone({default:t})}strict(t=!0){return this.clone({strict:t})}nullability(t,e){const i=this.clone({nullable:t});return i.internalTests.nullable=hn({message:e,name:"nullable",test(s){return s===null?this.schema.spec.nullable:!0}}),i}optionality(t,e){const i=this.clone({optional:t});return i.internalTests.optionality=hn({message:e,name:"optionality",test(s){return s===void 0?this.schema.spec.optional:!0}}),i}optional(){return this.optionality(!0)}defined(t=ae.defined){return this.optionality(!1,t)}nullable(){return this.nullability(!0)}nonNullable(t=ae.notNull){return this.nullability(!1,t)}required(t=ae.required){return this.clone().withMutation(e=>e.nonNullable(t).defined(t))}notRequired(){return this.clone().withMutation(t=>t.nullable().optional())}transform(t){let e=this.clone();return e.transforms.push(t),e}test(...t){let e;if(t.length===1?typeof t[0]=="function"?e={test:t[0]}:e=t[0]:t.length===2?e={name:t[0],test:t[1]}:e={name:t[0],message:t[1],test:t[2]},e.message===void 0&&(e.message=ae.default),typeof e.test!="function")throw new TypeError("`test` is a required parameters");let i=this.clone(),s=hn(e),o=e.exclusive||e.name&&i.exclusiveTests[e.name]===!0;if(e.exclusive&&!e.name)throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");return e.name&&(i.exclusiveTests[e.name]=!!e.exclusive),i.tests=i.tests.filter(r=>!(r.OPTIONS.name===e.name&&(o||r.OPTIONS.test===s.OPTIONS.test))),i.tests.push(s),i}when(t,e){!Array.isArray(t)&&typeof t!="string"&&(e=t,t=".");let i=this.clone(),s=Cr(t).map(o=>new Ke(o));return s.forEach(o=>{o.isSibling&&i.deps.push(o.key)}),i.conditions.push(typeof e=="function"?new Fi(s,e):Fi.fromOptions(s,e)),i}typeError(t){let e=this.clone();return e.internalTests.typeError=hn({message:t,name:"typeError",skipAbsent:!0,test(i){return this.schema._typeCheck(i)?!0:this.createError({params:{type:this.schema.type}})}}),e}oneOf(t,e=ae.oneOf){let i=this.clone();return t.forEach(s=>{i._whitelist.add(s),i._blacklist.delete(s)}),i.internalTests.whiteList=hn({message:e,name:"oneOf",skipAbsent:!0,test(s){let o=this.schema._whitelist,r=o.resolveAll(this.resolve);return r.includes(s)?!0:this.createError({params:{values:Array.from(o).join(", "),resolved:r}})}}),i}notOneOf(t,e=ae.notOneOf){let i=this.clone();return t.forEach(s=>{i._blacklist.add(s),i._whitelist.delete(s)}),i.internalTests.blacklist=hn({message:e,name:"notOneOf",test(s){let o=this.schema._blacklist,r=o.resolveAll(this.resolve);return r.includes(s)?this.createError({params:{values:Array.from(o).join(", "),resolved:r}}):!0}}),i}strip(t=!0){let e=this.clone();return e.spec.strip=t,e}describe(t){const e=(t?this.resolve(t):this).clone(),{label:i,meta:s,optional:o,nullable:r}=e.spec;return{meta:s,label:i,optional:o,nullable:r,default:e.getDefault(t),type:e.type,oneOf:e._whitelist.describe(),notOneOf:e._blacklist.describe(),tests:e.tests.map(c=>({name:c.OPTIONS.name,params:c.OPTIONS.params})).filter((c,d,u)=>u.findIndex(h=>h.name===c.name)===d)}}}le.prototype.__isYupSchema__=!0;for(const n of["validate","validateSync"])le.prototype[`${n}At`]=function(t,e,i={}){const{parent:s,parentPath:o,schema:r}=vu(this,t,e,i.context);return r[n](s&&s[o],Object.assign({},i,{parent:s,path:t}))};for(const n of["equals","is"])le.prototype[n]=le.prototype.oneOf;for(const n of["not","nope"])le.prototype[n]=le.prototype.notOneOf;const Ou=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function Du(n){const t=Is(n);if(!t)return Date.parse?Date.parse(n):Number.NaN;if(t.z===void 0&&t.plusMinus===void 0)return new Date(t.year,t.month,t.day,t.hour,t.minute,t.second,t.millisecond).valueOf();let e=0;return t.z!=="Z"&&t.plusMinus!==void 0&&(e=t.hourOffset*60+t.minuteOffset,t.plusMinus==="+"&&(e=0-e)),Date.UTC(t.year,t.month,t.day,t.hour,t.minute+e,t.second,t.millisecond)}function Is(n){var t,e;const i=Ou.exec(n);return i?{year:ye(i[1]),month:ye(i[2],1)-1,day:ye(i[3],1),hour:ye(i[4]),minute:ye(i[5]),second:ye(i[6]),millisecond:i[7]?ye(i[7].substring(0,3)):0,precision:(t=(e=i[7])==null?void 0:e.length)!=null?t:void 0,z:i[8]||void 0,plusMinus:i[9]||void 0,hourOffset:ye(i[10]),minuteOffset:ye(i[11])}:null}function ye(n,t=0){return Number(n)||t}let Nu=/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Tu=/^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,Pu=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,Mu="^\\d{4}-\\d{2}-\\d{2}",Vu="\\d{2}:\\d{2}:\\d{2}",Au="(([+-]\\d{2}(:?\\d{2})?)|Z)",Bu=new RegExp(`${Mu}T${Vu}(\\.\\d+)?${Au}$`),Fu=n=>Xe(n)||n===n.trim(),$u={}.toString();function js(){return new Tr}class Tr extends le{constructor(){super({type:"string",check(t){return t instanceof String&&(t=t.valueOf()),typeof t=="string"}}),this.withMutation(()=>{this.transform((t,e,i)=>{if(!i.spec.coerce||i.isType(t)||Array.isArray(t))return t;const s=t!=null&&t.toString?t.toString():t;return s===$u?t:s})})}required(t){return super.required(t).withMutation(e=>e.test({message:t||ae.required,name:"required",skipAbsent:!0,test:i=>!!i.length}))}notRequired(){return super.notRequired().withMutation(t=>(t.tests=t.tests.filter(e=>e.OPTIONS.name!=="required"),t))}length(t,e=Rt.length){return this.test({message:e,name:"length",exclusive:!0,params:{length:t},skipAbsent:!0,test(i){return i.length===this.resolve(t)}})}min(t,e=Rt.min){return this.test({message:e,name:"min",exclusive:!0,params:{min:t},skipAbsent:!0,test(i){return i.length>=this.resolve(t)}})}max(t,e=Rt.max){return this.test({name:"max",exclusive:!0,message:e,params:{max:t},skipAbsent:!0,test(i){return i.length<=this.resolve(t)}})}matches(t,e){let i=!1,s,o;return e&&(typeof e=="object"?{excludeEmptyString:i=!1,message:s,name:o}=e:s=e),this.test({name:o||"matches",message:s||Rt.matches,params:{regex:t},skipAbsent:!0,test:r=>r===""&&i||r.search(t)!==-1})}email(t=Rt.email){return this.matches(Nu,{name:"email",message:t,excludeEmptyString:!0})}url(t=Rt.url){return this.matches(Tu,{name:"url",message:t,excludeEmptyString:!0})}uuid(t=Rt.uuid){return this.matches(Pu,{name:"uuid",message:t,excludeEmptyString:!1})}datetime(t){let e="",i,s;return t&&(typeof t=="object"?{message:e="",allowOffset:i=!1,precision:s=void 0}=t:e=t),this.matches(Bu,{name:"datetime",message:e||Rt.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:e||Rt.datetime_offset,params:{allowOffset:i},skipAbsent:!0,test:o=>{if(!o||i)return!0;const r=Is(o);return r?!!r.z:!1}}).test({name:"datetime_precision",message:e||Rt.datetime_precision,params:{precision:s},skipAbsent:!0,test:o=>{if(!o||s==null)return!0;const r=Is(o);return r?r.precision===s:!1}})}ensure(){return this.default("").transform(t=>t===null?"":t)}trim(t=Rt.trim){return this.transform(e=>e!=null?e.trim():e).test({message:t,name:"trim",test:Fu})}lowercase(t=Rt.lowercase){return this.transform(e=>Xe(e)?e:e.toLowerCase()).test({message:t,name:"string_case",exclusive:!0,skipAbsent:!0,test:e=>Xe(e)||e===e.toLowerCase()})}uppercase(t=Rt.uppercase){return this.transform(e=>Xe(e)?e:e.toUpperCase()).test({message:t,name:"string_case",exclusive:!0,skipAbsent:!0,test:e=>Xe(e)||e===e.toUpperCase()})}}js.prototype=Tr.prototype;let Ru=new Date(""),Lu=n=>Object.prototype.toString.call(n)==="[object Date]";class Li extends le{constructor(){super({type:"date",check(t){return Lu(t)&&!isNaN(t.getTime())}}),this.withMutation(()=>{this.transform((t,e,i)=>!i.spec.coerce||i.isType(t)||t===null?t:(t=Du(t),isNaN(t)?Li.INVALID_DATE:new Date(t)))})}prepareParam(t,e){let i;if(Ke.isRef(t))i=t;else{let s=this.cast(t);if(!this._typeCheck(s))throw new TypeError(`\`${e}\` must be a Date or a value that can be \`cast()\` to a Date`);i=s}return i}min(t,e=Rs.min){let i=this.prepareParam(t,"min");return this.test({message:e,name:"min",exclusive:!0,params:{min:t},skipAbsent:!0,test(s){return s>=this.resolve(i)}})}max(t,e=Rs.max){let i=this.prepareParam(t,"max");return this.test({message:e,name:"max",exclusive:!0,params:{max:t},skipAbsent:!0,test(s){return s<=this.resolve(i)}})}}Li.INVALID_DATE=Ru,Li.prototype;function Iu(n,t=[]){let e=[],i=new Set,s=new Set(t.map(([r,l])=>`${r}-${l}`));function o(r,l){let c=Ye.split(r)[0];i.add(c),s.has(`${l}-${c}`)||e.push([l,c])}for(const r of Object.keys(n)){let l=n[r];i.add(r),Ke.isRef(l)&&l.isSibling?o(l.path,r):Ls(l)&&"deps"in l&&l.deps.forEach(c=>o(c,r))}return gu.array(Array.from(i),e).reverse()}function Pr(n,t){let e=1/0;return n.some((i,s)=>{var o;if((o=t.path)!=null&&o.includes(i))return e=s,!0}),e}function Mr(n){return(t,e)=>Pr(n,t)-Pr(n,e)}const ju=(n,t,e)=>{if(typeof n!="string")return n;let i=n;try{i=JSON.parse(n)}catch{}return e.isType(i)?i:n};function Ii(n){if("fields"in n){const t={};for(const[e,i]of Object.entries(n.fields))t[e]=Ii(i);return n.setFields(t)}if(n.type==="array"){const t=n.optional();return t.innerType&&(t.innerType=Ii(t.innerType)),t}return n.type==="tuple"?n.optional().clone({types:n.spec.types.map(Ii)}):"optional"in n?n.optional():n}const zu=(n,t)=>{const e=[...Ye.normalizePath(t)];if(e.length===1)return e[0]in n;let i=e.pop(),s=Ye.getter(Ye.join(e),!0)(n);return!!(s&&i in s)};let Vr=n=>Object.prototype.toString.call(n)==="[object Object]";function Ar(n,t){let e=Object.keys(n.fields);return Object.keys(t).filter(i=>e.indexOf(i)===-1)}const Wu=Mr([]);function zs(n){return new Br(n)}class Br extends le{constructor(t){super({type:"object",check(e){return Vr(e)||typeof e=="function"}}),this.fields=Object.create(null),this._sortErrors=Wu,this._nodes=[],this._excludedEdges=[],this.withMutation(()=>{t&&this.shape(t)})}_cast(t,e={}){var i;let s=super._cast(t,e);if(s===void 0)return this.getDefault(e);if(!this._typeCheck(s))return s;let o=this.fields,r=(i=e.stripUnknown)!=null?i:this.spec.noUnknown,l=[].concat(this._nodes,Object.keys(s).filter(h=>!this._nodes.includes(h))),c={},d=Object.assign({},e,{parent:c,__validating:e.__validating||!1}),u=!1;for(const h of l){let f=o[h],m=h in s;if(f){let p,g=s[h];d.path=(e.path?`${e.path}.`:"")+h,f=f.resolve({value:g,context:e.context,parent:c});let y=f instanceof le?f.spec:void 0,b=y==null?void 0:y.strict;if(y!=null&&y.strip){u=u||h in s;continue}p=!e.__validating||!b?f.cast(s[h],d):s[h],p!==void 0&&(c[h]=p)}else m&&!r&&(c[h]=s[h]);(m!==h in c||c[h]!==s[h])&&(u=!0)}return u?c:s}_validate(t,e={},i,s){let{from:o=[],originalValue:r=t,recursive:l=this.spec.recursive}=e;e.from=[{schema:this,value:r},...o],e.__validating=!0,e.originalValue=r,super._validate(t,e,i,(c,d)=>{if(!l||!Vr(d)){s(c,d);return}r=r||d;let u=[];for(let h of this._nodes){let f=this.fields[h];!f||Ke.isRef(f)||u.push(f.asNestedTest({options:e,key:h,parent:d,parentPath:e.path,originalParent:r}))}this.runTests({tests:u,value:d,originalValue:r,options:e},i,h=>{s(h.sort(this._sortErrors).concat(c),d)})})}clone(t){const e=super.clone(t);return e.fields=Object.assign({},this.fields),e._nodes=this._nodes,e._excludedEdges=this._excludedEdges,e._sortErrors=this._sortErrors,e}concat(t){let e=super.concat(t),i=e.fields;for(let[s,o]of Object.entries(this.fields)){const r=i[s];i[s]=r===void 0?o:r}return e.withMutation(s=>s.setFields(i,[...this._excludedEdges,...t._excludedEdges]))}_getDefault(t){if("default"in this.spec)return super._getDefault(t);if(!this._nodes.length)return;let e={};return this._nodes.forEach(i=>{var s;const o=this.fields[i];let r=t;(s=r)!=null&&s.value&&(r=Object.assign({},r,{parent:r.value,value:r.value[i]})),e[i]=o&&"getDefault"in o?o.getDefault(r):void 0}),e}setFields(t,e){let i=this.clone();return i.fields=t,i._nodes=Iu(t,e),i._sortErrors=Mr(Object.keys(t)),e&&(i._excludedEdges=e),i}shape(t,e=[]){return this.clone().withMutation(i=>{let s=i._excludedEdges;return e.length&&(Array.isArray(e[0])||(e=[e]),s=[...i._excludedEdges,...e]),i.setFields(Object.assign(i.fields,t),s)})}partial(){const t={};for(const[e,i]of Object.entries(this.fields))t[e]="optional"in i&&i.optional instanceof Function?i.optional():i;return this.setFields(t)}deepPartial(){return Ii(this)}pick(t){const e={};for(const i of t)this.fields[i]&&(e[i]=this.fields[i]);return this.setFields(e,this._excludedEdges.filter(([i,s])=>t.includes(i)&&t.includes(s)))}omit(t){const e=[];for(const i of Object.keys(this.fields))t.includes(i)||e.push(i);return this.pick(e)}from(t,e,i){let s=Ye.getter(t,!0);return this.transform(o=>{if(!o)return o;let r=o;return zu(o,t)&&(r=Object.assign({},o),i||delete r[t],r[e]=s(o)),r})}json(){return this.transform(ju)}exact(t){return this.test({name:"exact",exclusive:!0,message:t||Bi.exact,test(e){if(e==null)return!0;const i=Ar(this.schema,e);return i.length===0||this.createError({params:{properties:i.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(t=!0,e=Bi.noUnknown){typeof t!="boolean"&&(e=t,t=!0);let i=this.test({name:"noUnknown",exclusive:!0,message:e,test(s){if(s==null)return!0;const o=Ar(this.schema,s);return!t||o.length===0||this.createError({params:{unknown:o.join(", ")}})}});return i.spec.noUnknown=t,i}unknown(t=!0,e=Bi.noUnknown){return this.noUnknown(!t,e)}transformKeys(t){return this.transform(e=>{if(!e)return e;const i={};for(const s of Object.keys(e))i[t(s)]=e[s];return i})}camelCase(){return this.transformKeys($s.camelCase)}snakeCase(){return this.transformKeys($s.snakeCase)}constantCase(){return this.transformKeys(t=>$s.snakeCase(t).toUpperCase())}describe(t){const e=(t?this.resolve(t):this).clone(),i=super.describe(t);i.fields={};for(const[o,r]of Object.entries(e.fields)){var s;let l=t;(s=l)!=null&&s.value&&(l=Object.assign({},l,{parent:l.value,value:l.value[o]})),i.fields[o]=r.describe(l)}return i}}zs.prototype=Br.prototype;function Ws(n,t,e){const i=new qe;let s=a.ref({});const o=a.ref({}),r=a.ref({});let l=a.ref([]);const c=a.ref(null),d=a.ref([]);let u=a.ref([]),h=a.ref(!1);const f=a.ref({});let{handleSubmit:m,errors:p,setErrors:g}=xr();const y=async()=>{var B;try{const P=await i.getEntityRecords(n);P&&P.response&&(s.value=P.response,l.value=(B=P.response.entity.entityDefinition)==null?void 0:B.columns,I(),S(),v())}catch(P){toast.add({severity:"error",summary:"Error",detail:P.errorMessage,life:3e3})}finally{}},b=async()=>{var B;try{const P=await i.getRecord(n,t);P&&P.response&&(s.value=P.response,l.value=(B=P.response.entity.entityDefinition)==null?void 0:B.columns,I(),o.value=JSON.parse(JSON.stringify(P.response.result[0])),v())}catch(P){console.error("Error fetching entity:",P.errorMessage)}finally{}},_=async()=>{var B,P;try{const R=await i.getRelatedEntityRecord(n,t);R&&R.response&&(s.value=R.response,l.value=(P=(B=R.response.entity)==null?void 0:B.entityDefinition)==null?void 0:P.columns,I(),o.value=JSON.parse(JSON.stringify(R.response.result[0])),o.value.entityName&&delete o.value.entityName,o.value.linkedEntities&&delete o.value.linkedEntities,u.value=R.response.result[0].linkedEntities,r.value=JSON.parse(JSON.stringify(o.value)),v())}catch(R){console.error("Error fetching entity:",R.errorMessage)}finally{}},w=async B=>{try{let P=await i.addRecord(n,B);P&&P.response&&e("onSaveDialog",{entityName:n,recordId:t})}catch(P){P.validationErrors&&(d.value=JSON.parse(JSON.stringify(P.validationErrors))),console.error("Error fetching entity:",P.errorMessage)}finally{}},E=async(B,P)=>{try{let R=await i.addRecord(n,P);if(R&&R.response){let W=await i.saveRelatedEntityRecord(n,R.response.recordId,B.linkedEntities);W&&W.response&&e("onSaveDialog",{entityName:n,recordId:t})}}catch(R){R.validationErrors&&(d.value=JSON.parse(JSON.stringify(R.validationErrors))),console.error("Error fetching entity:",R.errorMessage)}finally{}},k=async B=>{try{const P=await i.updateRecord(n,t,B);P&&P.response&&(h.value=!1,r.value=JSON.parse(JSON.stringify(o.value)),e("onSaveDialog",{entityName:n,recordId:t}))}catch(P){P.validationErrors&&(d.value=JSON.parse(JSON.stringify(P.errvalidationErrorsors))),console.error("Error fetching entity:",P.errorMessage)}finally{}},C=async(B,P,R)=>{try{let W=await i.saveRelatedEntityRecord(B,P,R);W&&W.response&&e("onSaveDialog",{entityName:n,enityRecordId:P})}catch(W){W.validationErrors&&(d.value=JSON.parse(JSON.stringify(W.validationErrors))),console.error("Error fetching entity:",W.errorMessage)}finally{}},S=()=>{for(let B=0;B<l.value.length;B++){let P=l.value[B];P.autoGenerated||(o.value[P.name]="")}},x=B=>{let P="";for(let R=0;R<l.value.length;R++){let W=l.value[R];if(B==W.name){P=W.type;break}}return P},O=()=>{const B=l.value.filter(R=>R.autoGenerated).map(R=>R.name);return Object.entries(o.value).filter(([R])=>!B.includes(R)).map(([R,W])=>({recordColumnName:R,recordColumnValue:W,columnType:x(R)}))},M=async(B={})=>{try{await c.value.validate(o.value,{abortEarly:!1}),g({})}catch(R){const W=R.inner.reduce((G,ot)=>(G[ot.path]||(G[ot.path]={messages:[]}),G[ot.path].messages.push(...ot.errors),G),{}),J=Object.entries(W).reduce((G,[ot,nt])=>(G[ot]={messages:nt.messages},G),{});g(J);return}const P={dataDefinitions:O()};t?await k(P):B.relationType=="MANY_TO_ONE"?await E(B,P):await w(P)},v=()=>{c.value=zs().shape(l.value.reduce((B,P)=>(P.autoGenerated||(B[P.name]=js().nullable(!1).test({name:"custom-validation",test:function(R){const W=[];let J="";if(P.required&&(!R||R.trim()===""))if(P.validations){J=T(P.validations,"VALIDATE_REQUIRED"),W.push(J);let G=U(P.validations,"VALIDATE_REQUIRED");G&&(G="hint:"+G,W.push(G))}else J=P.displayName+" is required.",W.push(J);else{if(P.maxLength&&R.length>P.maxLength)if(P.validations){J=T(P.validations,"VALIDATE_MAXLENGTH"),W.push(J);let G=U(P.validations,"VALIDATE_MAXLENGTH");G&&(G="hint:"+G,W.push(G))}else J=P.displayName+" cannot exceed from "+P.maxLength+" characters",W.push(J);if(P.regxId&&!new RegExp($(P.validations,"VALIDATE_REGX")).test(R))if(P.validations){J=T(P.validations,"VALIDATE_REGX"),W.push(J);let G=U(P.validations,"VALIDATE_REGX");G&&(G="hint:"+G,W.push(G))}else J=P.displayName+" invalid format.",W.push(J)}return W.length>0?this.createError({message:W}):!0}})),B),{}))},T=(B,P)=>{for(let R=0;R<B.length;R++)if(P==B[R].type)return B[R].message},$=(B,P)=>{for(let R=0;R<B.length;R++)if(P==B[R].type)return B[R].regx},U=(B,P)=>{for(let R=0;R<B.length;R++)if(P==B[R].type)return B[R].hint},H=B=>{g({...p.value,[B]:null}),h.value=!0},F=()=>{h.value=!1;for(let B in o.value)o.value.hasOwnProperty(B)&&g({...p.value,[B]:null});o.value=JSON.parse(JSON.stringify(r.value))},I=()=>{for(let B=0;B<l.value.length;B++){const P=l.value[B];if(P.primaryKey&&P.primaryKey==!0){f.value=P;break}}};return{formData:o,columns:l,errors:p,backendErrors:d,isDataChange:h,linkedEntities:u,primarayKeyColumn:f,clearErrors:H,saveRecord:M,fetchAllRecords:y,fetchRecord:b,getRelatedEntityRecordById:_,cancleRecord:F,saveRelatedEntityRecord:C}}const Hu={key:0,class:"surface-card"},Uu={class:"info"},qu={key:0,class:"list-none p-0"},Fr={__name:"EntityFormErrors",props:{errors:Array},setup(n){let t=a.ref(!0);const e=()=>{t.value=!t.value};return(i,s)=>{var r;const o=a.resolveComponent("Message");return((r=n.errors)==null?void 0:r.length)>0?(a.openBlock(),a.createElementBlock("div",Hu,[s[1]||(s[1]=a.createElementVNode("h4",{class:"flex-1 font-bold text-red-500"},"Errors",-1)),a.createElementVNode("div",Uu,[a.createElementVNode("span",{onClick:s[0]||(s[0]=l=>e()),class:"cursor-pointer underline showHideColor"},a.toDisplayString(a.unref(t)?"Hide":"Show"),1)]),a.unref(t)?(a.openBlock(),a.createElementBlock("ul",qu,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(n.errors,(l,c)=>(a.openBlock(),a.createElementBlock("li",{key:c,class:"mb-2"},[a.createVNode(o,{style:{"word-break":"break-all"},closable:!1,severity:"error"},{default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(l.message),1)]),_:2},1024)]))),128))])):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0)}}},Yu={class:"field flex flex-col"},Ku=["for"],Xu={key:0,class:"flex items-center"},Gu={key:1},Qu={class:"flex items-center"},$r={__name:"EntitySelection",props:{modelValue:{required:!0},entityName:{type:String,required:!0},columnName:{type:String,required:!0},relatedEntityColumn:{type:String,required:!0}},emits:["update:modelValue"],setup(n,{emit:t}){const e=n,i=new qe,s=a.ref({});let o=a.ref("");const r=t;a.onMounted(()=>{l()});const l=async()=>{try{const u=await i.getEntityRecords(e.entityName);u&&u.response&&(s.value=u.response,d())}catch{}finally{}},c=()=>{r("update:modelValue",o.value[e.relatedEntityColumn])},d=()=>{for(let u=0;u<s.value.result.length;u++){const h=s.value.result[u];if(h[e.relatedEntityColumn]==e.modelValue){o.value=h;break}}};return(u,h)=>{const f=a.resolveComponent("Select");return a.openBlock(),a.createElementBlock("div",Yu,[a.createElementVNode("label",{for:n.columnName},a.toDisplayString(n.columnName),9,Ku),a.createVNode(f,{modelValue:a.unref(o),"onUpdate:modelValue":[h[0]||(h[0]=m=>a.isRef(o)?o.value=m:o=m),c],"item-value":n.relatedEntityColumn,options:s.value.result,filter:"",optionLabel:n.relatedEntityColumn,placeholder:"Select "+n.relatedEntityColumn,class:"w-full"},{value:a.withCtx(m=>[m.value?(a.openBlock(),a.createElementBlock("div",Xu,[a.createElementVNode("div",null,a.toDisplayString(m.value[n.relatedEntityColumn]),1)])):(a.openBlock(),a.createElementBlock("span",Gu,a.toDisplayString(m.placeholder),1))]),option:a.withCtx(m=>[a.createElementVNode("div",Qu,[a.createElementVNode("div",null,a.toDisplayString(m.option[n.relatedEntityColumn]),1)])]),_:1},8,["modelValue","item-value","options","optionLabel","placeholder"])])}}},Ju={key:0,style:{"font-weight":"700","font-size":"1.25rem"}},Zu={key:1,style:{"font-weight":"700","font-size":"1.25rem"}},th={__name:"EntityDialog",props:a.mergeModels({entityName:{type:String,required:!0},recordId:{type:[String,Number],default:null}},{showForm:{},showFormModifiers:{}}),emits:a.mergeModels(["onSaveDialog"],["update:showForm"]),setup(n,{emit:t}){const e=a.useModel(n,"showForm"),i=t,{formData:s,columns:o,errors:r,backendErrors:l,clearErrors:c,saveRecord:d,fetchAllRecords:u,fetchRecord:h}=Ws(n.entityName,n.recordId,i);return a.onMounted(()=>{n.recordId?h():u()}),(f,m)=>{const p=a.resolveComponent("Button"),g=a.resolveComponent("Dialog");return e.value?(a.openBlock(),a.createBlock(g,{key:0,showFooter:!1,visible:e.value,"onUpdate:visible":m[2]||(m[2]=y=>e.value=y),style:{width:"50rem"},breakpoints:{"1199px":"75vw","575px":"90vw"},modal:!0,class:"p-fluid"},{header:a.withCtx(()=>[n.recordId?(a.openBlock(),a.createElementBlock("span",Ju,"Edit "+a.toDisplayString(n.entityName)+" record details",1)):a.createCommentVNode("",!0),n.recordId?a.createCommentVNode("",!0):(a.openBlock(),a.createElementBlock("span",Zu,"Add "+a.toDisplayString(n.entityName)+" record details",1))]),footer:a.withCtx(()=>[a.createVNode(p,{type:"button",icon:"",label:"Cancel",severity:"secondary",onClick:m[0]||(m[0]=y=>e.value=!1)}),a.createVNode(p,{type:"button",icon:"",label:"Save",severity:"success",onClick:m[1]||(m[1]=y=>a.unref(d)())})]),default:a.withCtx(()=>{var y;return[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(o),(b,_)=>{var w;return a.openBlock(),a.createElementBlock("div",{key:_},[!b.autoGenerated&&!b.foreignKey?(a.openBlock(),a.createBlock(Ni,{key:0,modelValue:a.unref(s)[b.name],"onUpdate:modelValue":E=>a.unref(s)[b.name]=E,column:b,errors:(w=a.unref(r)[b.name])==null?void 0:w.messages,onInput:a.unref(c)},null,8,["modelValue","onUpdate:modelValue","column","errors","onInput"])):a.createCommentVNode("",!0),!b.autoGenerated&&b.foreignKey?(a.openBlock(),a.createBlock($r,{key:1,modelValue:a.unref(s)[b.name],"onUpdate:modelValue":E=>a.unref(s)[b.name]=E,entityName:b.foreignKey.referencedEntityName,columnName:b.name,relatedEntityColumn:b.foreignKey.referencedColumnName},null,8,["modelValue","onUpdate:modelValue","entityName","columnName","relatedEntityColumn"])):a.createCommentVNode("",!0)])}),128)),((y=a.unref(l))==null?void 0:y.length)>0?(a.openBlock(),a.createBlock(Fr,{key:0,errors:a.unref(l)},null,8,["errors"])):a.createCommentVNode("",!0)]}),_:1},8,["visible"])):a.createCommentVNode("",!0)}}},eh={__name:"DeleteConfirmationDialog",props:a.mergeModels({entityName:{type:String,required:!0},recordId:{type:[String,Number],default:null}},{showDeleteDialog:{},showDeleteDialogModifiers:{}}),emits:a.mergeModels(["onDeleteItem"],["update:showDeleteDialog"]),setup(n,{emit:t}){const e=new qe,i=a.useModel(n,"showDeleteDialog"),s=t,o=async()=>{try{const r=await e.deleteRecord(n.entityName,n.recordId);r&&r.response&&s("onDeleteItem")}catch(r){console.error("Error deleting record:",r.errorMessage)}finally{}};return(r,l)=>{const c=a.resolveComponent("Button"),d=a.resolveComponent("Dialog");return a.openBlock(),a.createBlock(d,{visible:i.value,"onUpdate:visible":l[1]||(l[1]=u=>i.value=u),style:{width:"450px"},header:"Confirm",modal:!0},{footer:a.withCtx(()=>[a.createVNode(c,{label:"No",icon:"pi pi-times",text:"",onClick:l[0]||(l[0]=u=>i.value=!1)}),a.createVNode(c,{label:"Yes",icon:"pi pi-check",text:"",onClick:o})]),default:a.withCtx(()=>[l[2]||(l[2]=a.createElementVNode("div",{class:"flex items-center justify-center"},[a.createElementVNode("i",{class:"pi pi-exclamation-triangle mr-3",style:{"font-size":"2rem"}}),a.createElementVNode("span",null,"Are you sure you want to delete the selected item?")],-1))]),_:1},8,["visible"])}}};function Hs(n){return n==null||n===""||Array.isArray(n)&&n.length===0||!(n instanceof Date)&&typeof n=="object"&&Object.keys(n).length===0}function Rr(n){return!!(n&&n.constructor&&n.call&&n.apply)}function bt(n){return!Hs(n)}function mn(n,t=!0){return n instanceof Object&&n.constructor===Object&&(t||Object.keys(n).length!==0)}function Zt(n,...t){return Rr(n)?n(...t):n}function ce(n,t=!0){return typeof n=="string"&&(t||n!=="")}function Me(n){return ce(n)?n.replace(/(-|_)/g,"").toLowerCase():n}function Lr(n,t="",e={}){const i=Me(t).split("."),s=i.shift();return s?mn(n)?Lr(Zt(n[Object.keys(n).find(o=>Me(o)===s)||""],e),i.join("."),e):void 0:Zt(n,e)}function Us(n,t=!0){return Array.isArray(n)&&(t||n.length!==0)}function nh(n){return bt(n)&&!isNaN(n)}function be(n,t){if(t){const e=t.test(n);return t.lastIndex=0,e}return!1}function Bn(n){return n&&n.replace(/\/\*(?:(?!\*\/)[\s\S])*\*\/|[\r\n\t]+/g,"").replace(/ {2,}/g," ").replace(/ ([{:}]) /g,"$1").replace(/([;,]) /g,"$1").replace(/ !/g,"!").replace(/: /g,":")}function Ir(n){return ce(n)?n.replace(/(_)/g,"-").replace(/[A-Z]/g,(t,e)=>e===0?t:"-"+t.toLowerCase()).toLowerCase():n}function jr(n){return ce(n)?n.replace(/[A-Z]/g,(t,e)=>e===0?t:"."+t.toLowerCase()).toLowerCase():n}var pn={STARTS_WITH:"startsWith",CONTAINS:"contains",NOT_CONTAINS:"notContains",ENDS_WITH:"endsWith",EQUALS:"equals",NOT_EQUALS:"notEquals",IN:"in",LESS_THAN:"lt",LESS_THAN_OR_EQUAL_TO:"lte",GREATER_THAN:"gt",GREATER_THAN_OR_EQUAL_TO:"gte",BETWEEN:"between",DATE_IS:"dateIs",DATE_IS_NOT:"dateIsNot",DATE_BEFORE:"dateBefore",DATE_AFTER:"dateAfter"},ih={AND:"and",OR:"or"};const sh={key:0},oh={key:1},qs={__name:"RecordColumnRenderer",props:{column:Object,value:null},setup(n){const t=a.ref(null),e=Object.assign({"/src/directives/dateFormat.js":()=>Promise.resolve().then(()=>wy),"/src/directives/textFormatUpperCase.js":()=>Promise.resolve().then(()=>Ey)});async function i(){await a.nextTick();const s=e[`/src/directives/${n.column.displayFormatKey}.js`];s&&t.value&&s().then(o=>{o.default.beforeMount(t.value,{value:n.value,arg:n.column.displayFormat})})}return a.onMounted(()=>{i()}),a.onUpdated(()=>{i()}),(s,o)=>n.column.displayFormatKey?(a.openBlock(),a.createElementBlock("span",sh,[a.createElementVNode("span",{ref_key:"el",ref:t},a.toDisplayString(n.value),513)])):(a.openBlock(),a.createElementBlock("span",oh,a.toDisplayString(n.value),1))}};class rh{constructor(){this.httpService=new nr}async getEntities(){return await this.getAppId(),await this.httpService.get(`/api/app/v1/${this.appId}/entity`)}getEntity(t){}saveEntity(){}async getAppId(){const t=re();this.appId=t.getAppId()}}const zr=er("entitiesStore",{state:()=>({entities:[],entityService:new rh}),actions:{async fetchEntities(){try{return await this.entityService.getEntities()}catch(n){console.error("Error fetching entities:",n)}finally{}},async getEntities(){if(this.entities.length===0){const n=await this.fetchEntities();return this.setEntities(n.response),this.entities}else return this.entities},setEntities(n){this.entities=n}},getters:{}}),ah={class:"field flex flex-col w-full"},lh={key:0,class:"flex items-center"},ch={key:1},dh={class:"flex items-center"},uh={__name:"EntityExplorer",props:{entityName:String,onEntityChangeCallback:Function},setup(n){const t=re(),e=a.ref(""),i=zr(),s=a.ref([]),o=async()=>{s.value=await i.getEntities(),r()},r=()=>{for(let c=0;c<s.value.length;c++){const d=s.value[c];d.name.toLowerCase()==n.entityName.toLowerCase()&&(e.value=d)}},l=()=>{n.onEntityChangeCallback(e.value.name)};return a.watch(()=>t.globalConfigs.appId,async c=>{c&&await o()},{immediate:!0}),(c,d)=>{const u=a.resolveComponent("Select");return a.openBlock(),a.createElementBlock("div",ah,[a.createVNode(u,{modelValue:e.value,"onUpdate:modelValue":[d[0]||(d[0]=h=>e.value=h),l],options:s.value,filter:"",optionLabel:"name",placeholder:"Select entity",class:"w-full"},{value:a.withCtx(h=>[h.value?(a.openBlock(),a.createElementBlock("div",lh,[a.createElementVNode("div",null,a.toDisplayString(h.value.name),1)])):(a.openBlock(),a.createElementBlock("span",ch,a.toDisplayString(h.placeholder),1))]),option:a.withCtx(h=>[a.createElementVNode("div",dh,[a.createElementVNode("div",null,a.toDisplayString(h.option.name),1)])]),_:1},8,["modelValue","options"])])}}},hh={class:"card"},fh={class:"flex flex-row w-1/6"},mh={class:"my-2"},ph={class:"flex flex-col md:flex-row md:justify-between md:items-center"},gh={class:"flex flex-row items-center"},yh={class:"ml-2"},bh={class:"flex flex-row gap-2"},Wr={__name:"Grid",props:{entityName:String},setup(n){const t=re(),e=n,i=Ut.useRoute(),s=a.ref(e.entityName||i.params.entityName),o=a.ref({}),r=a.ref(""),l=a.ref(!1),c=a.ref(!1),{items:d,headers:u,first:h,totalRecords:f,pageSize:m,loading:p,sortBy:g,sortDirection:y,operatorMap:b,filterToSend:_,primarayKeyColumn:w,fullTextSearch:E,listingResponse:k,onFullTextSearch:C,getDatatypeByField:S,getColumnDatatype:x,onSort:O,onPage:M,onFilter:v,fetchEntityFilterData:T,fetchEntityByName:$}=wd(s.value),U=a.ref();let H=a.ref(!1);const F=nt=>{o.value=nt.reduce((Y,st)=>{if(!st.filterable)return Y;let ut=pn.CONTAINS;switch(st.datatype.toLowerCase()){case"string":case"uuid":ut=pn.STARTS_WITH;break;case"date":ut=pn.DATE_IS;break;case"numeric":case"int":case"integer":ut=pn.EQUALS;break;case"bool":case"boolean":ut=pn.EQUALS;break}return st.datatype=="bool"||st.datatype=="boolean"?Y[st.field]={value:null,matchMode:pn.EQUALS}:Y[st.field]={operator:ih.AND,constraints:[{value:null,matchMode:ut}]},Y},{})},I=()=>{F(u.value),_.value=G(o.value),v()},B=nt=>{_.value=G(o.value),v()},P=nt=>{nt?r.value=nt[w.value.name]:r.value="",l.value=!l.value},R=()=>{l.value=!1,T(!1)},W=nt=>{r.value=nt[w.value.name],c.value=!0},J=()=>{c.value=!1,T(!1)},G=nt=>Object.keys(nt).map(Y=>{const st=nt[Y];return st.constraints?st.constraints.filter(ut=>ut.value!==null&&ut.value!=="").map(ut=>({columnName:Y,operator:b[ut.matchMode]??ut.matchMode,value:ut.value,columnType:S(Y)})):st.value!==null&&st.value!==""?{columnName:Y,operator:b[st.matchMode]??st.matchMode,value:st.value,columnType:S(Y)}:[]}).flat(),ot=nt=>{s.value=nt,$(nt)};return a.watch(()=>t.globalConfigs.appId,async nt=>{nt&&$(s.value)},{immediate:!0}),a.watch(()=>u.value,nt=>{!H.value&&nt&&nt.length&&(F(nt),H.value=!0)},{immediate:!0}),(nt,Y)=>{const st=a.resolveComponent("Button"),ut=a.resolveComponent("Toolbar"),Ue=a.resolveComponent("ProgressSpinner"),Gt=a.resolveComponent("InputIcon"),De=a.resolveComponent("IconField"),me=a.resolveComponent("Calendar"),j=a.resolveComponent("InputNumber"),A=a.resolveComponent("Checkbox"),rt=a.resolveComponent("Column"),Ht=a.resolveComponent("DataTable");return a.openBlock(),a.createElementBlock(a.Fragment,null,[a.createElementVNode("div",hh,[a.createElementVNode("div",fh,[(a.openBlock(),a.createBlock(uh,{key:s.value,entityName:s.value,onEntityChangeCallback:ot},null,8,["entityName"]))]),a.createVNode(ut,{class:"mb-4 mt-4"},{start:a.withCtx(()=>[a.createElementVNode("div",mh,[a.createVNode(st,{type:"button",icon:"pi pi-filter-slash",label:"Clear",severity:"warning",onClick:Y[0]||(Y[0]=xt=>I())})])]),end:a.withCtx(()=>[a.createVNode(st,{label:"Add",icon:"pi pi-plus",class:"mr-2",severity:"success",onClick:Y[1]||(Y[1]=xt=>P())})]),_:1}),a.createVNode(Ht,{lazy:"",value:a.unref(d),loading:a.unref(p),ref_key:"dt",ref:U,stripedRows:!0,showGridlines:"",rowHover:!0,paginator:!0,rows:a.unref(m),rowsPerPageOptions:[10,25,50,100],totalRecords:a.unref(f),first:a.unref(h),sortField:a.unref(g),sortOrder:a.unref(y),filters:o.value,"onUpdate:filters":Y[5]||(Y[5]=xt=>o.value=xt),filterDisplay:"menu",scrollable:"",scrollHeight:"400px",onSort:a.unref(O),onPage:a.unref(M),onFilter:Y[6]||(Y[6]=xt=>B()),size:"large",paginatorTemplate:"FirstPageLink PrevPageLink PageLinks NextPageLink LastPageLink CurrentPageReport RowsPerPageDropdown",currentPageReportTemplate:"Showing {first} to {last} of {totalRecords} items"},{empty:a.withCtx(()=>Y[9]||(Y[9]=[a.createTextVNode(" No data found. ")])),loading:a.withCtx(()=>[a.createVNode(Ue)]),header:a.withCtx(()=>[a.createElementVNode("div",ph,[a.createElementVNode("div",gh,[Y[10]||(Y[10]=a.createElementVNode("h5",{class:"m-0 text-xl font-semibold"},"Entity Name:",-1)),a.createElementVNode("span",yh,a.toDisplayString(s.value),1)]),a.createVNode(De,{iconPosition:"left",class:"block mt-2 md:mt-0"},{default:a.withCtx(()=>[a.createVNode(Gt,{class:"pi pi-search",onClick:Y[2]||(Y[2]=xt=>a.unref(C)())}),a.createVNode(a.unref(Xo.InputText),{class:"w-full sm:w-auto",onKeyup:Y[3]||(Y[3]=a.withKeys(xt=>a.unref(C)(),["enter"])),modelValue:a.unref(E),"onUpdate:modelValue":Y[4]||(Y[4]=xt=>a.isRef(E)?E.value=xt:null),placeholder:"Search..."},null,8,["modelValue"])]),_:1})])]),default:a.withCtx(()=>{var xt;return[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(u),dt=>(a.openBlock(),a.createBlock(rt,{key:dt.field,dataType:a.unref(x)(dt.datatype),field:dt.field,header:dt.name,sortable:dt.sortable,showAddButton:!1,showFilterOperator:!1,style:{"text-wrap":"nowrap"}},a.createSlots({body:a.withCtx(({data:ct})=>[a.createVNode(qs,{column:dt,value:ct[dt.field]},null,8,["column","value"])]),_:2},[dt.datatype.toLowerCase()==="date"&&dt.filterable?{name:"filter",fn:a.withCtx(({filterModel:ct})=>[a.createVNode(me,{modelValue:ct.value,"onUpdate:modelValue":Ot=>ct.value=Ot,dateFormat:"mm/dd/yy",placeholder:"mm/dd/yyyy"},null,8,["modelValue","onUpdate:modelValue"])]),key:"0"}:dt.datatype.toLowerCase()==="int"&&dt.filterable?{name:"filter",fn:a.withCtx(({filterModel:ct})=>[a.createVNode(j,{modelValue:ct.value,"onUpdate:modelValue":Ot=>ct.value=Ot,placeholder:"Search..."},null,8,["modelValue","onUpdate:modelValue"])]),key:"1"}:dt.datatype.toLowerCase()==="boolean"&&dt.filterable?{name:"filter",fn:a.withCtx(({filterModel:ct})=>[a.createVNode(A,{modelValue:ct.value,"onUpdate:modelValue":Ot=>ct.value=Ot,indeterminate:ct.value===null,binary:""},null,8,["modelValue","onUpdate:modelValue","indeterminate"])]),key:"2"}:dt.filterable?{name:"filter",fn:a.withCtx(({filterModel:ct})=>[a.createVNode(a.unref(Xo.InputText),{style:{width:"150px"},type:"text",modelValue:ct.value,"onUpdate:modelValue":Ot=>ct.value=Ot,class:"p-column-filter",placeholder:"Search..."},null,8,["modelValue","onUpdate:modelValue"])]),key:"3"}:void 0]),1032,["dataType","field","header","sortable"]))),128)),((xt=a.unref(d))==null?void 0:xt.length)>0?(a.openBlock(),a.createBlock(rt,{key:0,header:"Actions"},{body:a.withCtx(({data:dt})=>[a.createElementVNode("div",bh,[a.createVNode(st,{onClick:ct=>P(dt),icon:"pi pi-pencil",severity:"success",size:"",rounded:"","aria-label":"Edit"},null,8,["onClick"]),a.createVNode(st,{onClick:ct=>W(dt),icon:"pi pi-trash",severity:"danger",rounded:"","aria-label":"Delete"},null,8,["onClick"])])]),_:1})):a.createCommentVNode("",!0)]}),_:1},8,["value","loading","rows","totalRecords","first","sortField","sortOrder","filters","onSort","onPage"])]),l.value?(a.openBlock(),a.createBlock(th,{key:0,showForm:l.value,"onUpdate:showForm":Y[7]||(Y[7]=xt=>l.value=xt),entityName:a.unref(k).entityName,recordId:r.value,onOnSaveDialog:R},null,8,["showForm","entityName","recordId"])):a.createCommentVNode("",!0),c.value?(a.openBlock(),a.createBlock(eh,{key:1,showDeleteDialog:c.value,"onUpdate:showDeleteDialog":Y[8]||(Y[8]=xt=>c.value=xt),entityName:a.unref(k).entityName,recordId:r.value,onOnDeleteItem:J},null,8,["showDeleteDialog","entityName","recordId"])):a.createCommentVNode("",!0)],64)}}};function _h(){const n=new Map;return{on(t,e){let i=n.get(t);return i?i.push(e):i=[e],n.set(t,i),this},off(t,e){let i=n.get(t);return i&&i.splice(i.indexOf(e)>>>0,1),this},emit(t,e){let i=n.get(t);i&&i.slice().map(s=>{s(e)})},clear(){n.clear()}}}var xh=Object.defineProperty,kh=Object.defineProperties,Sh=Object.getOwnPropertyDescriptors,ji=Object.getOwnPropertySymbols,Hr=Object.prototype.hasOwnProperty,Ur=Object.prototype.propertyIsEnumerable,qr=(n,t,e)=>t in n?xh(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,te=(n,t)=>{for(var e in t||(t={}))Hr.call(t,e)&&qr(n,e,t[e]);if(ji)for(var e of ji(t))Ur.call(t,e)&&qr(n,e,t[e]);return n},Ys=(n,t)=>kh(n,Sh(t)),_e=(n,t)=>{var e={};for(var i in n)Hr.call(n,i)&&t.indexOf(i)<0&&(e[i]=n[i]);if(n!=null&&ji)for(var i of ji(n))t.indexOf(i)<0&&Ur.call(n,i)&&(e[i]=n[i]);return e},wh=_h(),Ve=wh;function Yr(n,t){Us(n)?n.push(...t||[]):mn(n)&&Object.assign(n,t)}function Eh(n){return mn(n)&&n.hasOwnProperty("value")&&n.hasOwnProperty("type")?n.value:n}function Ch(n){return n.replaceAll(/ /g,"").replace(/[^\w]/g,"-")}function Ks(n="",t=""){return Ch(`${ce(n,!1)&&ce(t,!1)?`${n}-`:n}${t}`)}function Kr(n="",t=""){return`--${Ks(n,t)}`}function vh(n=""){const t=(n.match(/{/g)||[]).length,e=(n.match(/}/g)||[]).length;return(t+e)%2!==0}function Xr(n,t="",e="",i=[],s){if(ce(n)){const o=/{([^}]*)}/g,r=n.trim();if(vh(r))return;if(be(r,o)){const l=r.replaceAll(o,u=>{const f=u.replace(/{|}/g,"").split(".").filter(m=>!i.some(p=>be(m,p)));return`var(${Kr(e,Ir(f.join("-")))}${bt(s)?`, ${s}`:""})`}),c=/(\d+\s+[\+\-\*\/]\s+\d+)/g,d=/var\([^)]+\)/g;return be(l.replace(d,"0"),c)?`calc(${l})`:l}return r}else if(nh(n))return n}function Oh(n,t,e){ce(t,!1)&&n.push(`${t}:${e};`)}function gn(n,t){return n?`${n}{${t}}`:""}var Fn=(...n)=>Dh(Ct.getTheme(),...n),Dh=(n={},t,e,i)=>{if(t){const{variable:s,options:o}=Ct.defaults||{},{prefix:r,transform:l}=(n==null?void 0:n.options)||o||{},d=be(t,/{([^}]*)}/g)?t:`{${t}}`;return i==="value"||Hs(i)&&l==="strict"?Ct.getTokenValue(t):Xr(d,void 0,r,[s.excludedKeyRegex],e)}return""};function Nh(n,t={}){const e=Ct.defaults.variable,{prefix:i=e.prefix,selector:s=e.selector,excludedKeyRegex:o=e.excludedKeyRegex}=t,r=(d,u="")=>Object.entries(d).reduce((h,[f,m])=>{const p=be(f,o)?Ks(u):Ks(u,Ir(f)),g=Eh(m);if(mn(g)){const{variables:y,tokens:b}=r(g,p);Yr(h.tokens,b),Yr(h.variables,y)}else h.tokens.push((i?p.replace(`${i}-`,""):p).replaceAll("-",".")),Oh(h.variables,Kr(p),Xr(g,p,i,[o]));return h},{variables:[],tokens:[]}),{variables:l,tokens:c}=r(n,i);return{value:l,tokens:c,declarations:l.join(""),css:gn(s,l.join(""))}}var ee={regex:{rules:{class:{pattern:/^\.([a-zA-Z][\w-]*)$/,resolve(n){return{type:"class",selector:n,matched:this.pattern.test(n.trim())}}},attr:{pattern:/^\[(.*)\]$/,resolve(n){return{type:"attr",selector:`:root${n}`,matched:this.pattern.test(n.trim())}}},media:{pattern:/^@media (.*)$/,resolve(n){return{type:"media",selector:`${n}{:root{[CSS]}}`,matched:this.pattern.test(n.trim())}}},system:{pattern:/^system$/,resolve(n){return{type:"system",selector:"@media (prefers-color-scheme: dark){:root{[CSS]}}",matched:this.pattern.test(n.trim())}}},custom:{resolve(n){return{type:"custom",selector:n,matched:!0}}}},resolve(n){const t=Object.keys(this.rules).filter(e=>e!=="custom").map(e=>this.rules[e]);return[n].flat().map(e=>{var i;return(i=t.map(s=>s.resolve(e)).find(s=>s.matched))!=null?i:this.rules.custom.resolve(e)})}},_toVariables(n,t){return Nh(n,{prefix:t==null?void 0:t.prefix})},getCommon({name:n="",theme:t={},params:e,set:i,defaults:s}){var o,r,l,c,d,u,h;const{preset:f,options:m}=t;let p,g,y,b,_,w,E;if(bt(f)&&m.transform!=="strict"){const{primitive:k,semantic:C,extend:S}=f,x=C||{},{colorScheme:O}=x,M=_e(x,["colorScheme"]),v=S||{},{colorScheme:T}=v,$=_e(v,["colorScheme"]),U=O||{},{dark:H}=U,F=_e(U,["dark"]),I=T||{},{dark:B}=I,P=_e(I,["dark"]),R=bt(k)?this._toVariables({primitive:k},m):{},W=bt(M)?this._toVariables({semantic:M},m):{},J=bt(F)?this._toVariables({light:F},m):{},G=bt(H)?this._toVariables({dark:H},m):{},ot=bt($)?this._toVariables({semantic:$},m):{},nt=bt(P)?this._toVariables({light:P},m):{},Y=bt(B)?this._toVariables({dark:B},m):{},[st,ut]=[(o=R.declarations)!=null?o:"",R.tokens],[Ue,Gt]=[(r=W.declarations)!=null?r:"",W.tokens||[]],[De,me]=[(l=J.declarations)!=null?l:"",J.tokens||[]],[j,A]=[(c=G.declarations)!=null?c:"",G.tokens||[]],[rt,Ht]=[(d=ot.declarations)!=null?d:"",ot.tokens||[]],[xt,dt]=[(u=nt.declarations)!=null?u:"",nt.tokens||[]],[ct,Ot]=[(h=Y.declarations)!=null?h:"",Y.tokens||[]];p=this.transformCSS(n,st,"light","variable",m,i,s),g=ut;const Dn=this.transformCSS(n,`${Ue}${De}`,"light","variable",m,i,s),oe=this.transformCSS(n,`${j}`,"dark","variable",m,i,s);y=`${Dn}${oe}`,b=[...new Set([...Gt,...me,...A])];const ln=this.transformCSS(n,`${rt}${xt}color-scheme:light`,"light","variable",m,i,s),Nn=this.transformCSS(n,`${ct}color-scheme:dark`,"dark","variable",m,i,s);_=`${ln}${Nn}`,w=[...new Set([...Ht,...dt,...Ot])],E=Zt(f.css,{dt:Fn})}return{primitive:{css:p,tokens:g},semantic:{css:y,tokens:b},global:{css:_,tokens:w},style:E}},getPreset({name:n="",preset:t={},options:e,params:i,set:s,defaults:o,selector:r}){var l,c,d;let u,h,f;if(bt(t)&&e.transform!=="strict"){const m=n.replace("-directive",""),p=t,{colorScheme:g,extend:y,css:b}=p,_=_e(p,["colorScheme","extend","css"]),w=y||{},{colorScheme:E}=w,k=_e(w,["colorScheme"]),C=g||{},{dark:S}=C,x=_e(C,["dark"]),O=E||{},{dark:M}=O,v=_e(O,["dark"]),T=bt(_)?this._toVariables({[m]:te(te({},_),k)},e):{},$=bt(x)?this._toVariables({[m]:te(te({},x),v)},e):{},U=bt(S)?this._toVariables({[m]:te(te({},S),M)},e):{},[H,F]=[(l=T.declarations)!=null?l:"",T.tokens||[]],[I,B]=[(c=$.declarations)!=null?c:"",$.tokens||[]],[P,R]=[(d=U.declarations)!=null?d:"",U.tokens||[]],W=this.transformCSS(m,`${H}${I}`,"light","variable",e,s,o,r),J=this.transformCSS(m,P,"dark","variable",e,s,o,r);u=`${W}${J}`,h=[...new Set([...F,...B,...R])],f=Zt(b,{dt:Fn})}return{css:u,tokens:h,style:f}},getPresetC({name:n="",theme:t={},params:e,set:i,defaults:s}){var o;const{preset:r,options:l}=t,c=(o=r==null?void 0:r.components)==null?void 0:o[n];return this.getPreset({name:n,preset:c,options:l,params:e,set:i,defaults:s})},getPresetD({name:n="",theme:t={},params:e,set:i,defaults:s}){var o;const r=n.replace("-directive",""),{preset:l,options:c}=t,d=(o=l==null?void 0:l.directives)==null?void 0:o[r];return this.getPreset({name:r,preset:d,options:c,params:e,set:i,defaults:s})},applyDarkColorScheme(n){return!(n.darkModeSelector==="none"||n.darkModeSelector===!1)},getColorSchemeOption(n,t){var e;return this.applyDarkColorScheme(n)?this.regex.resolve(n.darkModeSelector===!0?t.options.darkModeSelector:(e=n.darkModeSelector)!=null?e:t.options.darkModeSelector):[]},getLayerOrder(n,t={},e,i){const{cssLayer:s}=t;return s?`@layer ${Zt(s.order||"primeui",e)}`:""},getCommonStyleSheet({name:n="",theme:t={},params:e,props:i={},set:s,defaults:o}){const r=this.getCommon({name:n,theme:t,params:e,set:s,defaults:o}),l=Object.entries(i).reduce((c,[d,u])=>c.push(`${d}="${u}"`)&&c,[]).join(" ");return Object.entries(r||{}).reduce((c,[d,u])=>{if(u!=null&&u.css){const h=Bn(u==null?void 0:u.css),f=`${d}-variables`;c.push(`<style type="text/css" data-primevue-style-id="${f}" ${l}>${h}</style>`)}return c},[]).join("")},getStyleSheet({name:n="",theme:t={},params:e,props:i={},set:s,defaults:o}){var r;const l={name:n,theme:t,params:e,set:s,defaults:o},c=(r=n.includes("-directive")?this.getPresetD(l):this.getPresetC(l))==null?void 0:r.css,d=Object.entries(i).reduce((u,[h,f])=>u.push(`${h}="${f}"`)&&u,[]).join(" ");return c?`<style type="text/css" data-primevue-style-id="${n}-variables" ${d}>${Bn(c)}</style>`:""},createTokens(n={},t,e="",i="",s={}){return Object.entries(n).forEach(([o,r])=>{const l=be(o,t.variable.excludedKeyRegex)?e:e?`${e}.${jr(o)}`:jr(o),c=i?`${i}.${o}`:o;mn(r)?this.createTokens(r,t,l,c,s):(s[l]||(s[l]={paths:[],computed(d,u={}){var h,f;return this.paths.length===1?(h=this.paths[0])==null?void 0:h.computed(this.paths[0].scheme,u.binding):d&&d!=="none"?(f=this.paths.find(m=>m.scheme===d))==null?void 0:f.computed(d,u.binding):this.paths.map(m=>m.computed(m.scheme,u[m.scheme]))}}),s[l].paths.push({path:c,value:r,scheme:c.includes("colorScheme.light")?"light":c.includes("colorScheme.dark")?"dark":"none",computed(d,u={}){const h=/{([^}]*)}/g;let f=r;if(u.name=this.path,u.binding||(u.binding={}),be(r,h)){const p=r.trim().replaceAll(h,b=>{var _;const w=b.replace(/{|}/g,""),E=(_=s[w])==null?void 0:_.computed(d,u);return Us(E)&&E.length===2?`light-dark(${E[0].value},${E[1].value})`:E==null?void 0:E.value}),g=/(\d+\w*\s+[\+\-\*\/]\s+\d+\w*)/g,y=/var\([^)]+\)/g;f=be(p.replace(y,"0"),g)?`calc(${p})`:p}return Hs(u.binding)&&delete u.binding,{colorScheme:d,path:this.path,paths:u,value:f.includes("undefined")?void 0:f}}}))}),s},getTokenValue(n,t,e){var i;const o=(c=>c.split(".").filter(u=>!be(u.toLowerCase(),e.variable.excludedKeyRegex)).join("."))(t),r=t.includes("colorScheme.light")?"light":t.includes("colorScheme.dark")?"dark":void 0,l=[(i=n[o])==null?void 0:i.computed(r)].flat().filter(c=>c);return l.length===1?l[0].value:l.reduce((c={},d)=>{const u=d,{colorScheme:h}=u,f=_e(u,["colorScheme"]);return c[h]=f,c},void 0)},getSelectorRule(n,t,e,i){return e==="class"||e==="attr"?gn(bt(t)?`${n}${t},${n} ${t}`:n,i):gn(n,bt(t)?gn(t,i):i)},transformCSS(n,t,e,i,s={},o,r,l){if(bt(t)){const{cssLayer:c}=s;if(i!=="style"){const d=this.getColorSchemeOption(s,r);t=e==="dark"?d.reduce((u,{type:h,selector:f})=>(bt(f)&&(u+=f.includes("[CSS]")?f.replace("[CSS]",t):this.getSelectorRule(f,l,h,t)),u),""):gn(l??":root",t)}if(c){const d={name:"primeui",order:"primeui"};mn(c)&&(d.name=Zt(c.name,{name:n,type:i})),bt(d.name)&&(t=gn(`@layer ${d.name}`,t),o==null||o.layerNames(d.name))}return t}return""}},Ct={defaults:{variable:{prefix:"p",selector:":root",excludedKeyRegex:/^(primitive|semantic|components|directives|variables|colorscheme|light|dark|common|root|states|extend|css)$/gi},options:{prefix:"p",darkModeSelector:"system",cssLayer:!1}},_theme:void 0,_layerNames:new Set,_loadedStyleNames:new Set,_loadingStyles:new Set,_tokens:{},update(n={}){const{theme:t}=n;t&&(this._theme=Ys(te({},t),{options:te(te({},this.defaults.options),t.options)}),this._tokens=ee.createTokens(this.preset,this.defaults),this.clearLoadedStyleNames())},get theme(){return this._theme},get preset(){var n;return((n=this.theme)==null?void 0:n.preset)||{}},get options(){var n;return((n=this.theme)==null?void 0:n.options)||{}},get tokens(){return this._tokens},getTheme(){return this.theme},setTheme(n){this.update({theme:n}),Ve.emit("theme:change",n)},getPreset(){return this.preset},setPreset(n){this._theme=Ys(te({},this.theme),{preset:n}),this._tokens=ee.createTokens(n,this.defaults),this.clearLoadedStyleNames(),Ve.emit("preset:change",n),Ve.emit("theme:change",this.theme)},getOptions(){return this.options},setOptions(n){this._theme=Ys(te({},this.theme),{options:n}),this.clearLoadedStyleNames(),Ve.emit("options:change",n),Ve.emit("theme:change",this.theme)},getLayerNames(){return[...this._layerNames]},setLayerNames(n){this._layerNames.add(n)},getLoadedStyleNames(){return this._loadedStyleNames},isStyleNameLoaded(n){return this._loadedStyleNames.has(n)},setLoadedStyleName(n){this._loadedStyleNames.add(n)},deleteLoadedStyleName(n){this._loadedStyleNames.delete(n)},clearLoadedStyleNames(){this._loadedStyleNames.clear()},getTokenValue(n){return ee.getTokenValue(this.tokens,n,this.defaults)},getCommon(n="",t){return ee.getCommon({name:n,theme:this.theme,params:t,defaults:this.defaults,set:{layerNames:this.setLayerNames.bind(this)}})},getComponent(n="",t){const e={name:n,theme:this.theme,params:t,defaults:this.defaults,set:{layerNames:this.setLayerNames.bind(this)}};return ee.getPresetC(e)},getDirective(n="",t){const e={name:n,theme:this.theme,params:t,defaults:this.defaults,set:{layerNames:this.setLayerNames.bind(this)}};return ee.getPresetD(e)},getCustomPreset(n="",t,e,i){const s={name:n,preset:t,options:this.options,selector:e,params:i,defaults:this.defaults,set:{layerNames:this.setLayerNames.bind(this)}};return ee.getPreset(s)},getLayerOrderCSS(n=""){return ee.getLayerOrder(n,this.options,{names:this.getLayerNames()},this.defaults)},transformCSS(n="",t,e="style",i){return ee.transformCSS(n,t,i,e,this.options,{layerNames:this.setLayerNames.bind(this)},this.defaults)},getCommonStyleSheet(n="",t,e={}){return ee.getCommonStyleSheet({name:n,theme:this.theme,params:t,props:e,defaults:this.defaults,set:{layerNames:this.setLayerNames.bind(this)}})},getStyleSheet(n,t,e={}){return ee.getStyleSheet({name:n,theme:this.theme,params:t,props:e,defaults:this.defaults,set:{layerNames:this.setLayerNames.bind(this)}})},onStyleMounted(n){this._loadingStyles.add(n)},onStyleUpdated(n){this._loadingStyles.add(n)},onStyleLoaded(n,{name:t}){this._loadingStyles.size&&(this._loadingStyles.delete(t),Ve.emit(`theme:${t}:load`,n),!this._loadingStyles.size&&Ve.emit("theme:load"))}};function Xs(n){return typeof HTMLElement=="object"?n instanceof HTMLElement:n&&typeof n=="object"&&n!==null&&n.nodeType===1&&typeof n.nodeName=="string"}function Gs(n,t={}){if(Xs(n)){const e=(i,s)=>{var o,r;const l=(o=n==null?void 0:n.$attrs)!=null&&o[i]?[(r=n==null?void 0:n.$attrs)==null?void 0:r[i]]:[];return[s].flat().reduce((c,d)=>{if(d!=null){const u=typeof d;if(u==="string"||u==="number")c.push(d);else if(u==="object"){const h=Array.isArray(d)?e(i,d):Object.entries(d).map(([f,m])=>i==="style"&&(m||m===0)?`${f.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}:${m}`:m?f:void 0);c=h.length?c.concat(h.filter(f=>!!f)):c}}return c},l)};Object.entries(t).forEach(([i,s])=>{if(s!=null){const o=i.match(/^on(.+)/);o?n.addEventListener(o[1].toLowerCase(),s):i==="p-bind"||i==="pBind"?Gs(n,s):(s=i==="class"?[...new Set(e("class",s))].join(" ").trim():i==="style"?e("style",s).join(";").trim():s,(n.$attrs=n.$attrs||{})&&(n.$attrs[i]=s),n.setAttribute(i,s))}})}}function Th(n,t){return Xs(n)?n.matches(t)?n:n.querySelector(t):null}function Ph(n){if(n){let t=n.parentNode;return t&&t instanceof ShadowRoot&&t.host&&(t=t.host),t}return null}function Mh(n){return!!(n!==null&&typeof n<"u"&&n.nodeName&&Ph(n))}function Gr(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}function Vh(n,t="",e){Xs(n)&&e!==null&&e!==void 0&&n.setAttribute(t,e)}var zi={};function Ah(n="pui_id_"){return zi.hasOwnProperty(n)||(zi[n]=0),zi[n]++,`${n}${zi[n]}`}var $n={_loadedStyleNames:new Set,getLoadedStyleNames:function(){return this._loadedStyleNames},isStyleNameLoaded:function(t){return this._loadedStyleNames.has(t)},setLoadedStyleName:function(t){this._loadedStyleNames.add(t)},deleteLoadedStyleName:function(t){this._loadedStyleNames.delete(t)},clearLoadedStyleNames:function(){this._loadedStyleNames.clear()}};function Rn(n){"@babel/helpers - typeof";return Rn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Rn(n)}function Qr(n,t){var e=Object.keys(n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);t&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(n,s).enumerable})),e.push.apply(e,i)}return e}function Jr(n){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?Qr(Object(e),!0).forEach(function(i){Bh(n,i,e[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(e)):Qr(Object(e)).forEach(function(i){Object.defineProperty(n,i,Object.getOwnPropertyDescriptor(e,i))})}return n}function Bh(n,t,e){return(t=Fh(t))in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}function Fh(n){var t=$h(n,"string");return Rn(t)=="symbol"?t:t+""}function $h(n,t){if(Rn(n)!="object"||!n)return n;var e=n[Symbol.toPrimitive];if(e!==void 0){var i=e.call(n,t||"default");if(Rn(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(n)}function Rh(n){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;a.getCurrentInstance()?a.onMounted(n):t?n():a.nextTick(n)}var Lh=0;function Ih(n){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},e=a.ref(!1),i=a.ref(n),s=a.ref(null),o=Gr()?window.document:void 0,r=t.document,l=r===void 0?o:r,c=t.immediate,d=c===void 0?!0:c,u=t.manual,h=u===void 0?!1:u,f=t.name,m=f===void 0?"style_".concat(++Lh):f,p=t.id,g=p===void 0?void 0:p,y=t.media,b=y===void 0?void 0:y,_=t.nonce,w=_===void 0?void 0:_,E=t.first,k=E===void 0?!1:E,C=t.onMounted,S=C===void 0?void 0:C,x=t.onUpdated,O=x===void 0?void 0:x,M=t.onLoad,v=M===void 0?void 0:M,T=t.props,$=T===void 0?{}:T,U=function(){},H=function(B){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(l){var R=Jr(Jr({},$),P),W=R.name||m,J=R.id||g,G=R.nonce||w;s.value=l.querySelector('style[data-primevue-style-id="'.concat(W,'"]'))||l.getElementById(J)||l.createElement("style"),s.value.isConnected||(i.value=B||n,Gs(s.value,{type:"text/css",id:J,media:b,nonce:G}),k?l.head.prepend(s.value):l.head.appendChild(s.value),Vh(s.value,"data-primevue-style-id",W),Gs(s.value,R),s.value.onload=function(ot){return v==null?void 0:v(ot,{name:W})},S==null||S(W)),!e.value&&(U=a.watch(i,function(ot){s.value.textContent=ot,O==null||O(W)},{immediate:!0}),e.value=!0)}},F=function(){!l||!e.value||(U(),Mh(s.value)&&l.head.removeChild(s.value),e.value=!1)};return d&&!h&&Rh(H),{id:g,name:m,el:s,css:i,unload:F,load:H,isLoaded:a.readonly(e)}}function Ln(n){"@babel/helpers - typeof";return Ln=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ln(n)}function Zr(n,t){return Hh(n)||Wh(n,t)||zh(n,t)||jh()}function jh(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
13
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function zh(n,t){if(n){if(typeof n=="string")return ta(n,t);var e={}.toString.call(n).slice(8,-1);return e==="Object"&&n.constructor&&(e=n.constructor.name),e==="Map"||e==="Set"?Array.from(n):e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?ta(n,t):void 0}}function ta(n,t){(t==null||t>n.length)&&(t=n.length);for(var e=0,i=Array(t);e<t;e++)i[e]=n[e];return i}function Wh(n,t){var e=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(e!=null){var i,s,o,r,l=[],c=!0,d=!1;try{if(o=(e=e.call(n)).next,t!==0)for(;!(c=(i=o.call(e)).done)&&(l.push(i.value),l.length!==t);c=!0);}catch(u){d=!0,s=u}finally{try{if(!c&&e.return!=null&&(r=e.return(),Object(r)!==r))return}finally{if(d)throw s}}return l}}function Hh(n){if(Array.isArray(n))return n}function ea(n,t){var e=Object.keys(n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);t&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(n,s).enumerable})),e.push.apply(e,i)}return e}function Qs(n){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?ea(Object(e),!0).forEach(function(i){Uh(n,i,e[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(e)):ea(Object(e)).forEach(function(i){Object.defineProperty(n,i,Object.getOwnPropertyDescriptor(e,i))})}return n}function Uh(n,t,e){return(t=qh(t))in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}function qh(n){var t=Yh(n,"string");return Ln(t)=="symbol"?t:t+""}function Yh(n,t){if(Ln(n)!="object"||!n)return n;var e=n[Symbol.toPrimitive];if(e!==void 0){var i=e.call(n,t||"default");if(Ln(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(n)}var Kh=function(t){var e=t.dt;return`
|
|
14
14
|
*,
|
|
15
15
|
::before,
|
|
16
16
|
::after {
|
|
@@ -131,7 +131,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
131
131
|
background: transparent;
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
|
-
`)},
|
|
134
|
+
`)},Xh=function(t){var e=t.dt;return`
|
|
135
135
|
.p-hidden-accessible {
|
|
136
136
|
border: 0;
|
|
137
137
|
clip: rect(0 0 0 0);
|
|
@@ -152,22 +152,22 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
152
152
|
overflow: hidden;
|
|
153
153
|
padding-right: `.concat(e("scrollbar.width"),`;
|
|
154
154
|
}
|
|
155
|
-
`)},
|
|
156
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ea(n,t){if(n){if(typeof n=="string")return na(n,t);var e={}.toString.call(n).slice(8,-1);return e==="Object"&&n.constructor&&(e=n.constructor.name),e==="Map"||e==="Set"?Array.from(n):e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?na(n,t):void 0}}function na(n,t){(t==null||t>n.length)&&(t=n.length);for(var e=0,i=Array(t);e<t;e++)i[e]=n[e];return i}function Kh(n,t){var e=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(e!=null){var i,s,o,r,a=[],c=!0,d=!1;try{if(o=(e=e.call(n)).next,t===0){if(Object(e)!==e)return;c=!1}else for(;!(c=(i=o.call(e)).done)&&(a.push(i.value),a.length!==t);c=!0);}catch(u){d=!0,s=u}finally{try{if(!c&&e.return!=null&&(r=e.return(),Object(r)!==r))return}finally{if(d)throw s}}return a}}function ia(n){if(Array.isArray(n))return n}function sa(n,t){var e=Object.keys(n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);t&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(n,s).enumerable})),e.push.apply(e,i)}return e}function tt(n){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?sa(Object(e),!0).forEach(function(i){zn(n,i,e[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(e)):sa(Object(e)).forEach(function(i){Object.defineProperty(n,i,Object.getOwnPropertyDescriptor(e,i))})}return n}function zn(n,t,e){return(t=Xh(t))in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}function Xh(n){var t=Gh(n,"string");return In(t)=="symbol"?t:t+""}function Gh(n,t){if(In(n)!="object"||!n)return n;var e=n[Symbol.toPrimitive];if(e!==void 0){var i=e.call(n,t||"default");if(In(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(n)}var Qh={name:"BaseComponent",props:{pt:{type:Object,default:void 0},ptOptions:{type:Object,default:void 0},unstyled:{type:Boolean,default:void 0},dt:{type:Object,default:void 0}},inject:{$parentInstance:{default:void 0}},watch:{isUnstyled:{immediate:!0,handler:function(t){t||(this._loadCoreStyles(),this._themeChangeListener(this._loadCoreStyles))}},dt:{immediate:!0,handler:function(t){var e=this;t?(this._loadScopedThemeStyles(t),this._themeChangeListener(function(){return e._loadScopedThemeStyles(t)})):this._unloadScopedThemeStyles()}}},scopedStyleEl:void 0,rootEl:void 0,$attrSelector:void 0,beforeCreate:function(){var t,e,i,s,o,r,a,c,d,u,h,f=(t=this.pt)===null||t===void 0?void 0:t._usept,m=f?(e=this.pt)===null||e===void 0||(e=e.originalValue)===null||e===void 0?void 0:e[this.$.type.name]:void 0,p=f?(i=this.pt)===null||i===void 0||(i=i.value)===null||i===void 0?void 0:i[this.$.type.name]:this.pt;(s=p||m)===null||s===void 0||(s=s.hooks)===null||s===void 0||(o=s.onBeforeCreate)===null||o===void 0||o.call(s);var g=(r=this.$primevueConfig)===null||r===void 0||(r=r.pt)===null||r===void 0?void 0:r._usept,y=g?(a=this.$primevue)===null||a===void 0||(a=a.config)===null||a===void 0||(a=a.pt)===null||a===void 0?void 0:a.originalValue:void 0,b=g?(c=this.$primevue)===null||c===void 0||(c=c.config)===null||c===void 0||(c=c.pt)===null||c===void 0?void 0:c.value:(d=this.$primevue)===null||d===void 0||(d=d.config)===null||d===void 0?void 0:d.pt;(u=b||y)===null||u===void 0||(u=u[this.$.type.name])===null||u===void 0||(u=u.hooks)===null||u===void 0||(h=u.onBeforeCreate)===null||h===void 0||h.call(u),this.$attrSelector=Dh("pc")},created:function(){this._hook("onCreated")},beforeMount:function(){this.rootEl=Eh(this.$el,'[data-pc-name="'.concat(Me(this.$.type.name),'"]')),this.rootEl&&(this.$attrSelector&&!this.rootEl.hasAttribute(this.$attrSelector)&&this.rootEl.setAttribute(this.$attrSelector,""),this.rootEl.$pc=tt({name:this.$.type.name,attrSelector:this.$attrSelector},this.$params)),this._loadStyles(),this._hook("onBeforeMount")},mounted:function(){this._hook("onMounted")},beforeUpdate:function(){this._hook("onBeforeUpdate")},updated:function(){this._hook("onUpdated")},beforeUnmount:function(){this._hook("onBeforeUnmount")},unmounted:function(){this._unloadScopedThemeStyles(),this._hook("onUnmounted")},methods:{_hook:function(t){if(!this.$options.hostName){var e=this._usePT(this._getPT(this.pt,this.$.type.name),this._getOptionValue,"hooks.".concat(t)),i=this._useDefaultPT(this._getOptionValue,"hooks.".concat(t));e==null||e(),i==null||i()}},_mergeProps:function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),s=1;s<e;s++)i[s-1]=arguments[s];return Fr(t)?t.apply(void 0,i):l.mergeProps.apply(void 0,i)},_loadStyles:function(){var t=this,e=function(){$n.isStyleNameLoaded("base")||(xe.loadCSS(t.$styleOptions),t._loadGlobalStyles(),$n.setLoadedStyleName("base")),t._loadThemeStyles()};e(),this._themeChangeListener(e)},_loadCoreStyles:function(){var t,e;!$n.isStyleNameLoaded((t=this.$style)===null||t===void 0?void 0:t.name)&&(e=this.$style)!==null&&e!==void 0&&e.name&&(Zr.loadCSS(this.$styleOptions),this.$options.style&&this.$style.loadCSS(this.$styleOptions),$n.setLoadedStyleName(this.$style.name))},_loadGlobalStyles:function(){var t=this._useGlobalPT(this._getOptionValue,"global.css",this.$params);bt(t)&&xe.load(t,tt({name:"global"},this.$styleOptions))},_loadThemeStyles:function(){var t,e;if(!(this.isUnstyled||this.$theme==="none")){if(!vt.isStyleNameLoaded("common")){var i,s,o=((i=this.$style)===null||i===void 0||(s=i.getCommonTheme)===null||s===void 0?void 0:s.call(i))||{},r=o.primitive,a=o.semantic,c=o.global,d=o.style;xe.load(r==null?void 0:r.css,tt({name:"primitive-variables"},this.$styleOptions)),xe.load(a==null?void 0:a.css,tt({name:"semantic-variables"},this.$styleOptions)),xe.load(c==null?void 0:c.css,tt({name:"global-variables"},this.$styleOptions)),xe.loadTheme(tt({name:"global-style"},this.$styleOptions),d),vt.setLoadedStyleName("common")}if(!vt.isStyleNameLoaded((t=this.$style)===null||t===void 0?void 0:t.name)&&(e=this.$style)!==null&&e!==void 0&&e.name){var u,h,f,m,p=((u=this.$style)===null||u===void 0||(h=u.getComponentTheme)===null||h===void 0?void 0:h.call(u))||{},g=p.css,y=p.style;(f=this.$style)===null||f===void 0||f.load(g,tt({name:"".concat(this.$style.name,"-variables")},this.$styleOptions)),(m=this.$style)===null||m===void 0||m.loadTheme(tt({name:"".concat(this.$style.name,"-style")},this.$styleOptions),y),vt.setLoadedStyleName(this.$style.name)}if(!vt.isStyleNameLoaded("layer-order")){var b,_,w=(b=this.$style)===null||b===void 0||(_=b.getLayerOrderThemeCSS)===null||_===void 0?void 0:_.call(b);xe.load(w,tt({name:"layer-order",first:!0},this.$styleOptions)),vt.setLoadedStyleName("layer-order")}}},_loadScopedThemeStyles:function(t){var e,i,s,o=((e=this.$style)===null||e===void 0||(i=e.getPresetTheme)===null||i===void 0?void 0:i.call(e,t,"[".concat(this.$attrSelector,"]")))||{},r=o.css,a=(s=this.$style)===null||s===void 0?void 0:s.load(r,tt({name:"".concat(this.$attrSelector,"-").concat(this.$style.name)},this.$styleOptions));this.scopedStyleEl=a.el},_unloadScopedThemeStyles:function(){var t;(t=this.scopedStyleEl)===null||t===void 0||(t=t.value)===null||t===void 0||t.remove()},_themeChangeListener:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(){};$n.clearLoadedStyleNames(),Ve.on("theme:change",t)},_getHostInstance:function(t){return t?this.$options.hostName?t.$.type.name===this.$options.hostName?t:this._getHostInstance(t.$parentInstance):t.$parentInstance:void 0},_getPropValue:function(t){var e;return this[t]||((e=this._getHostInstance(this))===null||e===void 0?void 0:e[t])},_getOptionValue:function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return Br(t,e,i)},_getPTValue:function(){var t,e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,r=/./g.test(i)&&!!s[i.split(".")[0]],a=this._getPropValue("ptOptions")||((t=this.$primevueConfig)===null||t===void 0?void 0:t.ptOptions)||{},c=a.mergeSections,d=c===void 0?!0:c,u=a.mergeProps,h=u===void 0?!1:u,f=o?r?this._useGlobalPT(this._getPTClassValue,i,s):this._useDefaultPT(this._getPTClassValue,i,s):void 0,m=r?void 0:this._getPTSelf(e,this._getPTClassValue,i,tt(tt({},s),{},{global:f||{}})),p=this._getPTDatasets(i);return d||!d&&m?h?this._mergeProps(h,f,m,p):tt(tt(tt({},f),m),p):tt(tt({},m),p)},_getPTSelf:function(){for(var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=arguments.length,i=new Array(e>1?e-1:0),s=1;s<e;s++)i[s-1]=arguments[s];return l.mergeProps(this._usePT.apply(this,[this._getPT(t,this.$name)].concat(i)),this._usePT.apply(this,[this.$_attrsPT].concat(i)))},_getPTDatasets:function(){var t,e,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",s="data-pc-",o=i==="root"&&bt((t=this.pt)===null||t===void 0?void 0:t["data-pc-section"]);return i!=="transition"&&tt(tt({},i==="root"&&tt(tt(zn({},"".concat(s,"name"),Me(o?(e=this.pt)===null||e===void 0?void 0:e["data-pc-section"]:this.$.type.name)),o&&zn({},"".concat(s,"extend"),Me(this.$.type.name))),Yr()&&zn({},"".concat(this.$attrSelector),""))),{},zn({},"".concat(s,"section"),Me(i)))},_getPTClassValue:function(){var t=this._getOptionValue.apply(this,arguments);return le(t)||Ws(t)?{class:t}:t},_getPT:function(t){var e=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",s=arguments.length>2?arguments[2]:void 0,o=function(a){var c,d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,u=s?s(a):a,h=Me(i),f=Me(e.$name);return(c=d?h!==f?u==null?void 0:u[h]:void 0:u==null?void 0:u[h])!==null&&c!==void 0?c:u};return t!=null&&t.hasOwnProperty("_usept")?{_usept:t._usept,originalValue:o(t.originalValue),value:o(t.value)}:o(t,!0)},_usePT:function(t,e,i,s){var o=function(g){return e(g,i,s)};if(t!=null&&t.hasOwnProperty("_usept")){var r,a=t._usept||((r=this.$primevueConfig)===null||r===void 0?void 0:r.ptOptions)||{},c=a.mergeSections,d=c===void 0?!0:c,u=a.mergeProps,h=u===void 0?!1:u,f=o(t.originalValue),m=o(t.value);return f===void 0&&m===void 0?void 0:le(m)?m:le(f)?f:d||!d&&m?h?this._mergeProps(h,f,m):tt(tt({},f),m):m}return o(t)},_useGlobalPT:function(t,e,i){return this._usePT(this.globalPT,t,e,i)},_useDefaultPT:function(t,e,i){return this._usePT(this.defaultPT,t,e,i)},ptm:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this._getPTValue(this.pt,t,tt(tt({},this.$params),e))},ptmi:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return l.mergeProps(this.$_attrsWithoutPT,this.ptm(t,e))},ptmo:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this._getPTValue(t,e,tt({instance:this},i),!1)},cx:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.isUnstyled?void 0:this._getOptionValue(this.$style.classes,t,tt(tt({},this.$params),e))},sx:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(e){var s=this._getOptionValue(this.$style.inlineStyles,t,tt(tt({},this.$params),i)),o=this._getOptionValue(Zr.inlineStyles,t,tt(tt({},this.$params),i));return[o,s]}}},computed:{globalPT:function(){var t,e=this;return this._getPT((t=this.$primevueConfig)===null||t===void 0?void 0:t.pt,void 0,function(i){return Zt(i,{instance:e})})},defaultPT:function(){var t,e=this;return this._getPT((t=this.$primevueConfig)===null||t===void 0?void 0:t.pt,void 0,function(i){return e._getOptionValue(i,e.$name,tt({},e.$params))||Zt(i,tt({},e.$params))})},isUnstyled:function(){var t;return this.unstyled!==void 0?this.unstyled:(t=this.$primevueConfig)===null||t===void 0?void 0:t.unstyled},$inProps:function(){var t,e=Object.keys(((t=this.$.vnode)===null||t===void 0?void 0:t.props)||{});return Object.fromEntries(Object.entries(this.$props).filter(function(i){var s=jn(i,1),o=s[0];return e==null?void 0:e.includes(o)}))},$theme:function(){var t;return(t=this.$primevueConfig)===null||t===void 0?void 0:t.theme},$style:function(){return tt(tt({classes:void 0,inlineStyles:void 0,load:function(){},loadCSS:function(){},loadTheme:function(){}},(this._getHostInstance(this)||{}).$style),this.$options.style)},$styleOptions:function(){var t;return{nonce:(t=this.$primevueConfig)===null||t===void 0||(t=t.csp)===null||t===void 0?void 0:t.nonce}},$primevueConfig:function(){var t;return(t=this.$primevue)===null||t===void 0?void 0:t.config},$name:function(){return this.$options.hostName||this.$.type.name},$params:function(){var t=this._getHostInstance(this)||this.$parent;return{instance:this,props:this.$props,state:this.$data,attrs:this.$attrs,parent:{instance:t,props:t==null?void 0:t.$props,state:t==null?void 0:t.$data,attrs:t==null?void 0:t.$attrs}}},$_attrsPT:function(){return Object.entries(this.$attrs||{}).filter(function(t){var e=jn(t,1),i=e[0];return i==null?void 0:i.startsWith("pt:")}).reduce(function(t,e){var i=jn(e,2),s=i[0],o=i[1],r=s.split(":"),a=qh(r),c=a.slice(1);return c==null||c.reduce(function(d,u,h,f){return!d[u]&&(d[u]=h===f.length-1?o:{}),d[u]},t),t},{})},$_attrsWithoutPT:function(){return Object.entries(this.$attrs||{}).filter(function(t){var e=jn(t,1),i=e[0];return!(i!=null&&i.startsWith("pt:"))}).reduce(function(t,e){var i=jn(e,2),s=i[0],o=i[1];return t[s]=o,t},{})}}},Jh={root:{position:"relative"}},Zh={root:"p-chart"},tf=xe.extend({name:"chart",classes:Zh,inlineStyles:Jh}),ef={name:"BaseChart",extends:Qh,props:{type:String,data:null,options:null,plugins:null,width:{type:Number,default:300},height:{type:Number,default:150},canvasProps:{type:null,default:null}},style:tf,provide:function(){return{$pcChart:this,$parentInstance:this}}},oa={name:"Chart",extends:ef,inheritAttrs:!1,emits:["select","loaded"],chart:null,watch:{data:{handler:function(){this.reinit()},deep:!0},type:function(){this.reinit()},options:function(){this.reinit()}},mounted:function(){this.initChart()},beforeUnmount:function(){this.chart&&(this.chart.destroy(),this.chart=null)},methods:{initChart:function(){var t=this;Promise.resolve().then(()=>tk).then(function(e){t.chart&&(t.chart.destroy(),t.chart=null),e&&e.default&&(t.chart=new e.default(t.$refs.canvas,{type:t.type,data:t.data,options:t.options,plugins:t.plugins})),t.$emit("loaded",t.chart)})},getCanvas:function(){return this.$canvas},getChart:function(){return this.chart},getBase64Image:function(){return this.chart.toBase64Image()},refresh:function(){this.chart&&this.chart.update()},reinit:function(){this.initChart()},onCanvasClick:function(t){if(this.chart){var e=this.chart.getElementsAtEventForMode(t,"nearest",{intersect:!0},!1),i=this.chart.getElementsAtEventForMode(t,"dataset",{intersect:!0},!1);e&&e[0]&&i&&this.$emit("select",{originalEvent:t,element:e[0],dataset:i})}},generateLegend:function(){if(this.chart)return this.chart.generateLegend()}}};function Wn(n){"@babel/helpers - typeof";return Wn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Wn(n)}function ra(n,t){var e=Object.keys(n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);t&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(n,s).enumerable})),e.push.apply(e,i)}return e}function aa(n){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?ra(Object(e),!0).forEach(function(i){nf(n,i,e[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(e)):ra(Object(e)).forEach(function(i){Object.defineProperty(n,i,Object.getOwnPropertyDescriptor(e,i))})}return n}function nf(n,t,e){return(t=sf(t))in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}function sf(n){var t=of(n,"string");return Wn(t)=="symbol"?t:t+""}function of(n,t){if(Wn(n)!="object"||!n)return n;var e=n[Symbol.toPrimitive];if(e!==void 0){var i=e.call(n,t||"default");if(Wn(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(n)}var rf=["width","height"];function af(n,t,e,i,s,o){return l.openBlock(),l.createElementBlock("div",l.mergeProps({class:n.cx("root"),style:n.sx("root")},n.ptmi("root")),[l.createElementVNode("canvas",l.mergeProps({ref:"canvas",width:n.width,height:n.height,onClick:t[0]||(t[0]=function(r){return o.onCanvasClick(r)})},aa(aa({},n.canvasProps),n.ptm("canvas"))),null,16,rf)],16)}oa.render=af;function lf(){const n={primary:"#0efcf1",primaryBorder:"#388E3C",secondary:"#0ec6fc",secondaryBorder:"#FBC02D",tertiary:"#f1fc0e",tertiaryBorder:"#FFA000"},t=["linear","easeInQuad","easeOutQuad","easeInOutQuad","easeInCubic","easeOutCubic","easeInOutCubic","easeInQuart","easeOutQuart","easeInOutQuart","easeInBounce","easeOutBounce","easeInOutBounce","easeInOutElastic"],e=l.ref("easeInOutElastic"),i=l.computed(()=>({responsive:!0,maintainAspectRatio:!0,plugins:{legend:{position:"top",labels:{font:{size:16}}},tooltip:{enabled:!0,titleFont:{size:14},bodyFont:{size:12}},zoom:{zoom:{wheel:{enabled:!0},drag:{enabled:!0},mode:"xy"},pan:{enabled:!0,mode:"xy"}}},scales:{x:{grid:{display:!1},ticks:{font:{size:14}}},y:{grid:{display:!0,color:"#e0e0e0"},ticks:{font:{size:14}}}},animation:{duration:2e3,easing:e.value,delay:500,loop:!1,animateRotate:!0,animateScale:!0},elements:{point:{radius:6,hoverRadius:10,backgroundColor:n.secondary},line:{tension:.4,borderWidth:2},bar:{borderWidth:2,borderRadius:4}}}));return{colorConfig:n,animationOptions:t,selectedAnimation:e,defaultChartOptions:i}}const cf={components:{Chart:oa},props:{type:{type:String,required:!0},chartData:{type:Object,required:!0},chartOptions:{type:Object,default:()=>({})}},setup(n){const{colorConfig:t,defaultChartOptions:e}=lf(),i=l.computed(()=>{const o=n.chartData.datasets.map((r,a)=>{const c=Object.values(t);return{...r,backgroundColor:c[a%c.length],borderColor:c[a%c.length+1]}});return{...n.chartData,datasets:o}}),s=l.computed(()=>({...e.value,maintainAspectRatio:!0,...n.chartOptions}));return{computedChartData:i,computedChartOptions:s}}},df={class:"chart-container"},uf={key:0},hf={key:1};function ff(n,t,e,i,s,o){const r=l.resolveComponent("Chart",!0);return l.openBlock(),l.createElementBlock("div",df,[e.chartData?(l.openBlock(),l.createElementBlock("div",uf,[l.createVNode(r,{type:e.type,data:i.computedChartData,options:i.computedChartOptions},null,8,["type","data","options"])])):(l.openBlock(),l.createElementBlock("div",hf,t[0]||(t[0]=[l.createElementVNode("p",null,"No data available for the chart.",-1)])))])}const Hn=jt(cf,[["render",ff],["__scopeId","data-v-8e3e786b"]]);function Un(){const n=l.ref(null),t=l.ref(!1),e=l.ref(null);return{chartData:n,fetchChartData:async({entityName:s,xaxis:o=null,yaxis:r=null})=>{t.value=!0,e.value=null;const a="https://mocki.io/v1/1ab17035-c115-4049-8ebf-a1e1b92d739a";try{const d=await(await fetch(a)).json();if(!d||!d.response||!d.response.result)throw new Error("Invalid data structure from API.");const u=d.response.result;if(!o&&!r){const h=Object.keys(u[0]);o=h[1],r=h.slice(4);const f=u.reduce((g,y)=>(r.forEach(b=>{g[b]||(g[b]=0),g[b]+=y[b]||0}),g),{}),m=Object.keys(f),p=Object.values(f);n.value={labels:m,datasets:[{label:"Default Data",data:p,borderWidth:1}]}}else{const h=u.map(p=>p[o]),m=(Array.isArray(r)?r:[r]).map(p=>({label:p,data:u.map(g=>g[p]||0),borderWidth:1}));n.value={labels:h,datasets:m}}}catch(c){e.value=c.message,n.value=null}finally{t.value=!1}},loading:t,error:e}}const mf={components:{chart:Hn},props:{entityName:{type:String,required:!0},title:{type:String,default:"Bar Chart"},yaxis:{type:String,required:!0},xaxis:{type:String,required:!0}},setup(n){const{chartData:t,fetchChartData:e,loading:i,error:s}=Un(),o=l.ref({responsive:!0,plugins:{legend:{position:"top"},tooltip:{callbacks:{label:function(a){return`${a.dataset.label}: ${a.raw}`}}}}}),r=async()=>{if(!n.yaxis||!n.xaxis){console.error("xaxis or yaxis is not defined."),s.value="x-axis or y-axis is not properly configured.";return}await e({entityName:n.entityName,yaxis:n.yaxis,xaxis:n.xaxis})};return l.onMounted(()=>{console.log("Fetching data for yAxis:",n.yaxis),console.log("Fetching data for xAxis:",n.xaxis),r()}),{chartData:t,chartOptions:o,loading:i,error:s}}},pf={key:0,class:"chart-container"},gf={key:1},yf={key:0},bf={key:1},_f={key:2};function xf(n,t,e,i,s,o){const r=l.resolveComponent("chart");return l.openBlock(),l.createElementBlock("div",null,[l.createElementVNode("div",null,[l.createElementVNode("h2",null,"Entity name: "+l.toDisplayString(e.entityName),1)]),i.chartData?(l.openBlock(),l.createElementBlock("div",pf,[l.createElementVNode("h3",null,l.toDisplayString(e.title)+" , x-axis : "+l.toDisplayString(e.xaxis)+" , y-axis : "+l.toDisplayString(e.yaxis),1),l.createVNode(r,{type:"bar",chartData:i.chartData,chartOptions:i.chartOptions},null,8,["chartData","chartOptions"])])):(l.openBlock(),l.createElementBlock("div",gf,[i.loading?(l.openBlock(),l.createElementBlock("p",yf,"Loading chart data...")):i.error?(l.openBlock(),l.createElementBlock("p",bf,l.toDisplayString(i.error),1)):(l.openBlock(),l.createElementBlock("p",_f,"No data available for the chart."))]))])}const la=jt(mf,[["render",xf],["__scopeId","data-v-67577a46"]]),kf={components:{chart:Hn},props:{entityName:{type:String,required:!0},title:{type:String,default:"Bar Chart"},yaxis:{type:String,required:!0},xaxis:{type:String,required:!0}},setup(n){const{chartData:t,fetchChartData:e,loading:i,error:s}=Un(),o=l.ref({responsive:!0,plugins:{legend:{position:"top"},tooltip:{callbacks:{label:function(a){return`${a.dataset.label}: ${a.raw}`}}}}}),r=async()=>{if(!n.yaxis||!n.xaxis){console.error("xaxis or yaxis is not defined."),s.value="x-axis or y-axis is not properly configured.";return}await e({entityName:n.entityName,yaxis:n.yaxis,xaxis:n.xaxis})};return l.onMounted(()=>{console.log("Fetching data for yAxis:",n.yaxis),console.log("Fetching data for xAxis:",n.xaxis),r()}),{chartData:t,chartOptions:o,loading:i,error:s}}},Sf={key:0,class:"chart-container"},wf={key:1},Ef={key:0},vf={key:1},Cf={key:2};function Of(n,t,e,i,s,o){const r=l.resolveComponent("chart");return l.openBlock(),l.createElementBlock("div",null,[l.createElementVNode("div",null,[l.createElementVNode("h2",null,"Entity name: "+l.toDisplayString(e.entityName),1)]),i.chartData?(l.openBlock(),l.createElementBlock("div",Sf,[l.createElementVNode("h3",null,l.toDisplayString(e.title)+" , x-axis : "+l.toDisplayString(e.xaxis)+" , y-axis : "+l.toDisplayString(e.yaxis),1),l.createVNode(r,{type:"line",chartData:i.chartData,chartOptions:i.chartOptions},null,8,["chartData","chartOptions"])])):(l.openBlock(),l.createElementBlock("div",wf,[i.loading?(l.openBlock(),l.createElementBlock("p",Ef,"Loading chart data...")):i.error?(l.openBlock(),l.createElementBlock("p",vf,l.toDisplayString(i.error),1)):(l.openBlock(),l.createElementBlock("p",Cf,"No data available for the chart."))]))])}const ca=jt(kf,[["render",Of],["__scopeId","data-v-2cfe3d4d"]]),Df={components:{chart:Hn},props:{entityName:{type:String,required:!0},title:{type:String,default:"Pie Chart"},yaxis:{type:String,default:null},xaxis:{type:String,default:null}},setup(n){const{chartData:t,fetchChartData:e,loading:i,error:s}=Un(),o=l.ref({responsive:!0,plugins:{legend:{position:"top"},tooltip:{callbacks:{label:function(a){return`${a.label}: ${a.raw}`}}}}}),r=async()=>{await e({entityName:n.entityName,xaxis:n.xaxis,yaxis:n.yaxis})};return l.onMounted(()=>{r()}),{chartData:t,chartOptions:o,loading:i,error:s}}},Nf={key:0,class:"chart-container"},Tf={key:1},Pf={key:0},Mf={key:1},Vf={key:2};function Af(n,t,e,i,s,o){const r=l.resolveComponent("chart");return l.openBlock(),l.createElementBlock("div",null,[l.createElementVNode("div",null,[l.createElementVNode("h2",null,"Entity name: "+l.toDisplayString(e.entityName),1)]),i.chartData?(l.openBlock(),l.createElementBlock("div",Nf,[l.createElementVNode("h3",null,l.toDisplayString(e.title),1),l.createVNode(r,{type:"pie",chartData:i.chartData,chartOptions:i.chartOptions},null,8,["chartData","chartOptions"])])):(l.openBlock(),l.createElementBlock("div",Tf,[i.loading?(l.openBlock(),l.createElementBlock("p",Pf,"Loading chart data...")):i.error?(l.openBlock(),l.createElementBlock("p",Mf,l.toDisplayString(i.error),1)):(l.openBlock(),l.createElementBlock("p",Vf,"No data available for the chart."))]))])}const da=jt(Df,[["render",Af],["__scopeId","data-v-27f5ea01"]]),Ff={components:{chart:Hn},props:{entityName:{type:String,required:!0},title:{type:String,default:"Pie Chart"},yaxis:{type:String,default:null},xaxis:{type:String,default:null}},setup(n){const{chartData:t,fetchChartData:e,loading:i,error:s}=Un(),o=l.ref({responsive:!0,plugins:{legend:{position:"top"},tooltip:{callbacks:{label:function(a){return`${a.label}: ${a.raw}`}}}}}),r=async()=>{await e({entityName:n.entityName,xaxis:n.xaxis,yaxis:n.yaxis})};return l.onMounted(()=>{r()}),{chartData:t,chartOptions:o,loading:i,error:s}}},Bf={key:0,class:"chart-container"},$f={key:1},Rf={key:0},Lf={key:1},If={key:2};function jf(n,t,e,i,s,o){const r=l.resolveComponent("chart");return l.openBlock(),l.createElementBlock("div",null,[l.createElementVNode("div",null,[l.createElementVNode("h2",null,"Entity name: "+l.toDisplayString(e.entityName),1)]),i.chartData?(l.openBlock(),l.createElementBlock("div",Bf,[l.createElementVNode("h3",null,l.toDisplayString(e.title),1),l.createVNode(r,{type:"polarArea",chartData:i.chartData,chartOptions:i.chartOptions},null,8,["chartData","chartOptions"])])):(l.openBlock(),l.createElementBlock("div",$f,[i.loading?(l.openBlock(),l.createElementBlock("p",Rf,"Loading chart data...")):i.error?(l.openBlock(),l.createElementBlock("p",Lf,l.toDisplayString(i.error),1)):(l.openBlock(),l.createElementBlock("p",If,"No data available for the chart."))]))])}const ua=jt(Ff,[["render",jf],["__scopeId","data-v-941f0d0a"]]),zf={components:{chart:Hn},props:{entityName:{type:String,required:!0},title:{type:String,default:"Bar Chart"},yaxis:{type:String,required:!0},xaxis:{type:String,required:!0}},setup(n){const{chartData:t,fetchChartData:e,loading:i,error:s}=Un(),o=l.ref({responsive:!0,plugins:{legend:{position:"top"},tooltip:{callbacks:{label:function(a){return`${a.dataset.label}: ${a.raw}`}}}}}),r=async()=>{if(!n.yaxis||!n.xaxis){console.error("xaxis or yaxis is not defined."),s.value="x-axis or y-axis is not properly configured.";return}await e({entityName:n.entityName,yaxis:n.yaxis,xaxis:n.xaxis})};return l.onMounted(()=>{console.log("Fetching data for yAxis:",n.yaxis),console.log("Fetching data for xAxis:",n.xaxis),r()}),{chartData:t,chartOptions:o,loading:i,error:s}}},Wf={key:0,class:"chart-container"},Hf={key:1},Uf={key:0},qf={key:1},Yf={key:2};function Kf(n,t,e,i,s,o){const r=l.resolveComponent("chart");return l.openBlock(),l.createElementBlock("div",null,[l.createElementVNode("div",null,[l.createElementVNode("h2",null,"Entity name: "+l.toDisplayString(e.entityName),1)]),i.chartData?(l.openBlock(),l.createElementBlock("div",Wf,[l.createElementVNode("h3",null,l.toDisplayString(e.title)+" , x-axis : "+l.toDisplayString(e.xaxis)+" , y-axis : "+l.toDisplayString(e.yaxis),1),l.createVNode(r,{type:"radar",chartData:i.chartData,chartOptions:i.chartOptions},null,8,["chartData","chartOptions"])])):(l.openBlock(),l.createElementBlock("div",Hf,[i.loading?(l.openBlock(),l.createElementBlock("p",Uf,"Loading chart data...")):i.error?(l.openBlock(),l.createElementBlock("p",qf,l.toDisplayString(i.error),1)):(l.openBlock(),l.createElementBlock("p",Yf,"No data available for the chart."))]))])}const ha=jt(zf,[["render",Kf],["__scopeId","data-v-80750171"]]),Xf={class:"flex flex-col p-3"},Gf={class:"flex justify-center flex-row mb-2 cursor-pointer"},Qf={style:{"word-break":"break-all"}},Jf={__name:"LinkEntityContent",props:{linkEntityListItem:{type:Object,required:!0}},setup(n){Ut.useRoute();const t=me(),e=l.ref("");t.getAppId()!=null&&t.getAppId()!=""&&(e.value=t.getAppId());const i=l.ref(),s=l.ref(!1),o=l.ref(!1),r=l.ref({}),a=l.ref([{label:"Remove association",icon:"",command:h=>{c()}}]),c=()=>{console.log(r.value),console.log("Function is calling")},d=(h,f)=>{r.value=f,i.value.show(h),o.value=!0},u=()=>{r.value={},o.value=!1};return(h,f)=>{const m=l.resolveComponent("Button"),p=l.resolveComponent("ContextMenu"),g=l.resolveComponent("router-link");return l.openBlock(),l.createElementBlock("div",{onMouseenter:f[4]||(f[4]=l.withModifiers(y=>s.value=!0,["prevent"])),onMouseleave:f[5]||(f[5]=l.withModifiers(y=>s.value=!1,["prevent"])),class:"flex relative m-3",style:{border:"1px solid var(--surface-border)","border-radius":"5px"}},[l.withDirectives(l.createVNode(m,{onClick:f[0]||(f[0]=y=>d(y,n.linkEntityListItem)),class:"!absolute right-0",size:"small",style:{width:"55px",height:"25px","border-radius":"5px","font-size":"12px"}},{default:l.withCtx(()=>f[6]||(f[6]=[l.createTextVNode(" More")])),_:1},512),[[l.vShow,s.value||o.value]]),l.createVNode(p,{ref_key:"menu",ref:i,model:a.value,onMouseenter:f[1]||(f[1]=l.withModifiers(y=>s.value=!0,["prevent"])),onMouseleave:f[2]||(f[2]=l.withModifiers(y=>s.value=!1,["prevent"])),onHide:f[3]||(f[3]=y=>u())},null,8,["model"]),l.createElementVNode("div",Xf,[l.createElementVNode("div",Gf,[l.createElementVNode("div",Qf,l.toDisplayString(n.linkEntityListItem.entityName),1),l.createVNode(g,{to:{name:"entity360view",params:{entityName:n.linkEntityListItem.entityName,id:n.linkEntityListItem.id,appId:e.value}},target:"_blank"},{default:l.withCtx(()=>f[7]||(f[7]=[l.createElementVNode("div",{class:"pi pi-external-link ml-3"},null,-1)])),_:1},8,["to"])]),l.createElementVNode("div",null,"Id: "+l.toDisplayString(n.linkEntityListItem.id),1)])],32)}}},Zf={class:"flex flex-col mt-3"},tm={class:"flex flex-row items-center"},em={class:"flex items-center justify-center mt-5"},nm={key:0,class:"pi pi-caret-right"},im={key:1,class:"pi pi-caret-down"},sm={key:0},om={class:"flex flex-col mt-5"},rm={class:"col-12"},am={class:"flex flex-col mt-5"},lm={class:"col-12 font-bold"},cm={key:0},dm={class:"flex flex-col mt-5"},um={class:"col-12"},hm={class:"flex flex-col mt-5"},fm={class:"col-12"},mm={class:"flex flex-col mt-5"},pm={class:"col-12"},gm={class:"flex flex-row justify-between items-center mt-5"},ym={key:1,class:"mt-2"},bm={class:"flex flex-row justify-between items-center"},_m={key:1,class:"text-red-500"},xm={class:"flex flex-col mt-5"},km={class:"flex flex-row justify-between items-center mt-2"},Sm={class:"flex flex-row items-center mt-5 mb-5"},wm={class:"font-bold"},Em={class:"font-bold ml-2 flex-1"},vm={class:"flex flex-row justify-center items-center mb-2"},Cm={class:"ml-2 flex-1"},Om={key:0,class:"pi pi-exclamation-circle"},Dm={class:"flex flex-col justify-center"},Nm={class:"flex flex-row justify-between items-center"},Tm={class:"justify-start"},Pm={class:"justify-start"},Mm=jt({__name:"EntityLookup",props:l.mergeModels({linkedEntity:{type:Object,required:!0},entity360Name:{type:String,required:!0},entity360Id:{required:!0},saveExistingRelatedEntityRecord:{type:Function,required:!0}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(n){Ut.useRoute();const t=n,e=l.useModel(n,"modelValue"),i=new qe,s=l.ref({}),o=l.ref([]),r=l.ref({}),a=l.ref([]),c=l.ref([]),d=l.ref({}),u=l.ref("id"),h=l.ref(1),f=l.ref([]),m=l.ref(25),p=l.ref(0),g=l.ref(0),y=l.ref(0);let b=l.ref([]);const _=l.ref(!1),w={gt:"GREATER_THAN",dateAfter:"GREATER_THAN",equals:"EQUAL",dateIs:"EQUAL",notEquals:"NOT_EQUAL",dateIsNot:"NOT_EQUAL",lt:"LESS_THAN",dateBefore:"LESS_THAN",lte:"LESS_THAN_EQUAL",gte:"GREATER_THAN_EQUAL",between:"BETWEEN",contains:"CONTAINS",startsWith:"STARTS_WITH",notContains:"NOT_CONTAINS",endsWith:"ENDS_WITH"},E={gt:"is greater than",dateAfter:"is after",equals:"is equals",dateIs:"is equals",notEquals:"is not equals",dateIsNot:"is not equals",lt:"is less than",dateBefore:"is before",lte:"is less than or equal to",gte:"is greater than or equal to",between:"between",contains:"contains",startsWith:"starts with",notContains:"not contains",endsWith:"ends with"};l.onMounted(()=>{v()});const k=j=>t.linkedEntity.list.some(A=>A[d.value.name]===j),v=async()=>{try{const j={sortBy:[u.value],sortDirection:h.value===1?"ASC":"DESC",pageSize:m.value,currentPage:p.value,columnList:null,filter:b.value,fullTextSearch:""},A=await i.searchEntityRecords(t.linkedEntity.entityName,j);A&&A.response&&(s.value=A.response,a.value=A.response.entity.entityDefinition.columns,c.value=ut(A.response.entity.entityDefinition.columns),g.value=A.response.totalRecords,await S(),await x(),O())}catch{}finally{}},S=async()=>{for(let j=0;j<a.value.length;j++){const A=a.value[j];!A.autoGeneerated&&A.foreignKey&&A.foreignKey.referencedEntityName.toLowerCase()==t.entity360Name.toLowerCase()&&(r.value=A)}},x=async()=>{for(let j=0;j<a.value.length;j++){const A=a.value[j];if(A.primaryKey&&A.primaryKey==!0){d.value=A;break}}},O=()=>{for(let j=0;j<t.linkedEntity.list.length;j++){const A=t.linkedEntity.list[j];A.is_deleted==!1&&A[r.value.name]==t.entity360Id&&o.value.push(A[d.value.name])}},M=()=>{let j=JSON.parse(JSON.stringify(o.value));j=j.filter(rt=>!k(rt));let A={linkEntityName:s.value.entityName,linkRecordIdList:[]};for(let rt=0;rt<j.length;rt++){const Ht=j[rt];A.linkRecordIdList.push(Ht)}t.saveExistingRelatedEntityRecord(A)},C=()=>{_.value=!_.value},T=[{label:"Starts with",value:"startsWith"},{label:"Contains",value:"contains"},{label:"Not contains",value:"notContains"},{label:"Ends with",value:"endsWith"},{label:"Equals",value:"equals"},{label:"Not equals",value:"notEquals"}],$=[{label:"Equals",value:"equals"},{label:"Not equals",value:"notEquals"},{label:"Less than",value:"lt"},{label:"Less than or equal to",value:"lte"},{label:"Greater than",value:"gt"},{label:"Greater than or equal to",value:"gte"}],U=[{label:"Equals",value:"equals"},{label:"Not equals",value:"notEquals"}],H=[{label:"Date is",value:"dateIs"},{label:"Date is not",value:"dateIsNot"},{label:"Date is before",value:"dateBefore"},{label:"Date is after",value:"dateAfter"}],B=[{label:"ASC",value:1},{label:"DESC",value:-1}];let I=[];const F=l.computed(()=>c.value.filter(j=>j.sortable)),P=l.computed(()=>c.value.filter(j=>j.filterable)),R=j=>c.value.filter(A=>{var rt;return A.filterable?((rt=f.value[j])==null?void 0:rt.columnName)===A.name?!0:!f.value.some((Ht,xt)=>xt!==j&&Ht.columnName===A.name):!1}).map(A=>({label:A.name,value:A.field})),W=j=>{let A="";switch(Gt(j.columnName).toLowerCase()){case"string":case"uuid":A="startsWith";break;case"date":A="dateIs";break;case"numeric":case"int":case"integer":A="equals";break;case"bool":case"boolean":A="equals";break}j.operator=A,j.value=""},J=j=>{const A=Gt(j.columnName);switch(A&&A.toLowerCase()){case"integer":case"int":case"numeric":I=$;break;case"date":I=H;break;case"bool":case"boolean":I=U;break;default:I=T}return I},G=j=>{if(j&&j.columnName){const A=Gt(j.columnName);return De(A)}else return""},ot=()=>{for(let j=0;j<f.value.length;j++){const A=f.value[j];A.editing=!1}f.value.push({columnName:"",value:"",operator:"",editing:!0})},nt=j=>{f.value.splice(j,1)},Y=j=>{j.editing=!j.editing},st=()=>{let j=JSON.parse(JSON.stringify(f.value));b.value=[];for(let A=0;A<j.length;A++){const rt=j[A];delete rt.editing,rt.columnName&&rt.operator&&rt.value&&(rt.columnType=Gt(rt.columnName),rt.operator=w[rt.operator],b.value.push(rt))}v()},ut=j=>j.map(A=>({field:A.name,name:A.displayName?A.displayName:A.name,filterable:A.filterable,datatype:A.type,sortable:!0,displayFormatKey:A.displayFormatKey,displayFormat:A.displayFormat})),Ue=()=>{v()},Gt=j=>{const A=c.value.find(rt=>rt.field===j);return A?A.datatype:null},De=j=>{switch(j.toLowerCase()){case"integer":case"int":case"numeric":return"numeric";case"date":return"date";case"bool":case"boolean":return"boolean";default:return"text"}},fe=j=>{m.value=j.rows,p.value=j.page,y.value=j.first,v()};return(j,A)=>{var Tn,Es;const rt=l.resolveComponent("InputIcon"),Ht=l.resolveComponent("InputText"),xt=l.resolveComponent("IconField"),dt=l.resolveComponent("Select"),ct=l.resolveComponent("Divider"),Ot=l.resolveComponent("InputNumber"),Dn=l.resolveComponent("Calendar"),oe=l.resolveComponent("Button"),ln=l.resolveComponent("Checkbox"),Nn=l.resolveComponent("Paginator"),jo=l.resolveDirective("tooltip");return l.openBlock(),l.createElementBlock(l.Fragment,null,[l.createElementVNode("div",Zf,[l.createElementVNode("div",tm,[l.createVNode(xt,{class:"block mt-2 md:mt-0 w-full"},{default:l.withCtx(()=>[l.createVNode(rt,{onClick:A[0]||(A[0]=()=>{}),class:"pi pi-search"}),l.createVNode(Ht,{class:"w-full",onKeyup:A[1]||(A[1]=l.withKeys(()=>{},["enter"])),placeholder:`Search ${s.value.entityName}`},null,8,["placeholder"])]),_:1})]),l.createElementVNode("div",em,[l.createElementVNode("div",{class:"flex items-center cursor-pointer sorting-filter-section flex-1 line-height-4",onClick:A[2]||(A[2]=X=>C())},[_.value?l.createCommentVNode("",!0):(l.openBlock(),l.createElementBlock("div",nm)),_.value?(l.openBlock(),l.createElementBlock("div",im)):l.createCommentVNode("",!0),A[9]||(A[9]=l.createElementVNode("div",{class:"ml-3 font-bold"}," Sorting & Filters ",-1))])]),_.value?(l.openBlock(),l.createElementBlock("div",sm,[l.createElementVNode("div",om,[A[10]||(A[10]=l.createElementVNode("div",{class:"col-12 font-bold"},"Sort Column",-1)),l.createElementVNode("div",rm,[l.createVNode(dt,{modelValue:u.value,"onUpdate:modelValue":A[3]||(A[3]=X=>u.value=X),options:F.value,optionLabel:"name",optionValue:"field",highlightOnSelect:!1,class:"w-full",onChange:A[4]||(A[4]=X=>Ue(j.event))},null,8,["modelValue","options"])])]),l.createElementVNode("div",am,[A[11]||(A[11]=l.createElementVNode("div",{class:"col-12 font-bold"},[l.createElementVNode("div",{class:"col-12 font-bold"},"Sort Direction")],-1)),l.createElementVNode("div",lm,[l.createVNode(dt,{modelValue:h.value,"onUpdate:modelValue":A[5]||(A[5]=X=>h.value=X),options:B,optionLabel:"label",optionValue:"value",highlightOnSelect:!1,class:"w-full",onChange:A[6]||(A[6]=X=>Ue(j.event))},null,8,["modelValue"])])]),(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(f.value,(X,cn)=>(l.openBlock(),l.createElementBlock("div",{key:cn},[X.editing?(l.openBlock(),l.createElementBlock("div",cm,[l.createVNode(ct,{class:"mt-5"}),l.createElementVNode("div",dm,[A[12]||(A[12]=l.createElementVNode("div",{class:"col-12 font-bold"},"Filter Column",-1)),l.createElementVNode("div",um,[l.createVNode(dt,{modelValue:X.columnName,"onUpdate:modelValue":Nt=>X.columnName=Nt,options:R(cn),optionLabel:"label",placeholder:"Select column",optionValue:"value",highlightOnSelect:!1,class:"w-full",onChange:Nt=>W(X)},null,8,["modelValue","onUpdate:modelValue","options","onChange"])])]),l.createElementVNode("div",hm,[A[13]||(A[13]=l.createElementVNode("div",{class:"col-12 font-bold"},"Filter Operator",-1)),l.createElementVNode("div",fm,[l.createVNode(dt,{modelValue:X.operator,"onUpdate:modelValue":Nt=>X.operator=Nt,options:J(X),optionLabel:"label",placeholder:"Select operator",optionValue:"value",highlightOnSelect:!1,class:"w-full"},null,8,["modelValue","onUpdate:modelValue","options"])])]),l.createElementVNode("div",mm,[A[14]||(A[14]=l.createElementVNode("div",{class:"col-12 font-bold"},"Filter value",-1)),l.createElementVNode("div",pm,[G(X)=="numeric"?(l.openBlock(),l.createBlock(Ot,{key:0,format:!1,class:"w-full",modelValue:X.value,"onUpdate:modelValue":Nt=>X.value=Nt,placeholder:"Search value"},null,8,["modelValue","onUpdate:modelValue"])):G(X)=="date"?(l.openBlock(),l.createBlock(Dn,{key:1,class:"w-full",modelValue:X.value,"onUpdate:modelValue":Nt=>X.value=Nt,dateFormat:"mm/dd/yy",placeholder:"mm/dd/yyyy"},null,8,["modelValue","onUpdate:modelValue"])):(l.openBlock(),l.createBlock(Ht,{key:2,modelValue:X.value,"onUpdate:modelValue":Nt=>X.value=Nt,class:"w-full",placeholder:"Search value"},null,8,["modelValue","onUpdate:modelValue"]))])]),l.createElementVNode("div",gm,[l.createVNode(oe,{style:{width:"100px"},label:"Hide",icon:"",severity:"warning",onClick:Nt=>Y(X)},null,8,["onClick"]),l.createVNode(oe,{style:{width:"100px"},label:"Delete",icon:"",severity:"danger",onClick:Nt=>nt(cn)},null,8,["onClick"])])])):l.createCommentVNode("",!0),X.editing?l.createCommentVNode("",!0):(l.openBlock(),l.createElementBlock("div",ym,[l.createVNode(ct),l.createElementVNode("div",bm,[l.createElementVNode("span",null,[X.columnName||X.operator||X.value?(l.openBlock(),l.createElementBlock(l.Fragment,{key:0},[l.createElementVNode("span",{class:l.normalizeClass({"text-red-500":!X.columnName})},l.toDisplayString(X.columnName?" "+X.columnName:" column"),3),l.createElementVNode("span",{class:l.normalizeClass({"text-red-500":!E[X.operator]})},l.toDisplayString(X.operator?" "+E[X.operator]:" operator"),3),l.createElementVNode("span",{class:l.normalizeClass({"text-red-500":!X.value})},l.toDisplayString(X.value?" "+X.value:" value"),3)],64)):(l.openBlock(),l.createElementBlock("span",_m,"Filter is empty"))]),l.createVNode(oe,{style:{width:"100px"},label:"Edit",icon:"",severity:"info",onClick:Nt=>Y(X)},null,8,["onClick"])])]))]))),128)),l.createElementVNode("div",xm,[l.createVNode(ct),l.createElementVNode("div",km,[l.createVNode(oe,{style:{width:"100px"},label:"Add",disabled:P.value.length===f.value.length,icon:"",severity:"success",onClick:ot},null,8,["disabled"]),l.createVNode(oe,{style:{width:"100px"},label:"Apply",severity:"info",onClick:st})])])])):l.createCommentVNode("",!0),l.createElementVNode("div",Sm,[l.createElementVNode("div",wm,l.toDisplayString((Tn=s.value)==null?void 0:Tn.totalRecords),1),l.createElementVNode("div",Em,l.toDisplayString((Es=s.value)==null?void 0:Es.entityName),1)]),(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(s.value.result,(X,cn)=>(l.openBlock(),l.createElementBlock("div",{key:cn},[l.createElementVNode("div",vm,[l.createVNode(ln,{disabled:k(X[d.value.name]),modelValue:o.value,"onUpdate:modelValue":A[7]||(A[7]=Nt=>o.value=Nt),value:X[d.value.name]},null,8,["disabled","modelValue","value"]),l.createElementVNode("div",Cm,[l.createTextVNode(l.toDisplayString(n.linkedEntity.entityName)+" ",1),l.createElementVNode("span",null,l.toDisplayString(X[d.value.name]),1)]),k(X[d.value.name])?l.withDirectives((l.openBlock(),l.createElementBlock("div",Om,null,512)),[[jo,"This record is already associated.",void 0,{left:!0}]]):l.createCommentVNode("",!0)])]))),128)),l.createVNode(Nn,{rows:m.value,totalRecords:g.value,rowsPerPageOptions:[10,25,50,100],onPage:fe,template:"FirstPageLink PageLinks LastPageLink CurrentPageReport RowsPerPageDropdown",currentPageReportTemplate:""},null,8,["rows","totalRecords"])]),l.createElementVNode("div",Dm,[l.createVNode(ct,{class:"mt-5"}),l.createElementVNode("div",Nm,[l.createElementVNode("div",Tm,[l.createVNode(oe,{label:"Cancel",icon:"",severity:"secondary",onClick:A[8]||(A[8]=X=>e.value=!1)})]),l.createElementVNode("div",Pm,[l.createVNode(oe,{label:"Save",severity:"success",onClick:M})])])])],64)}}},[["__scopeId","data-v-7fd52649"]]),Vm={class:"field flex flex-col"},Am={key:0,class:"flex items-center"},Fm={key:1},Bm={class:"flex items-center"},$m={class:"flex flex-col justify-center"},Rm={class:"flex flex-row justify-between items-center"},Lm={class:"justify-start"},Im={class:"justify-start"},jm={__name:"EntityLookupObject",props:l.mergeModels({linkedEntity:{type:Object,required:!0},entity360Name:{type:String,required:!0},entity360Id:{type:[String,Number]},saveExistingEntityObject:{type:Function}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(n){Ut.useRoute();const t=n,e=l.useModel(n,"modelValue"),i=new qe,s=l.ref({}),o=l.ref({});let r=l.ref("");const a=l.ref({}),c=l.ref({});l.onMounted(async()=>{console.log("linkedEntity"),console.log(t.linkedEntity),console.log("entity360Name"),console.log(t.entity360Name),console.log("entity360Id"),console.log(t.entity360Id),await u(),await d()});const d=async()=>{try{const g=await i.getEntityRecords(t.linkedEntity.entityName);g&&g.response&&(s.value=g.response,await h(g.response.entity.entityDefinition.columns),await m(),console.log(s.value))}catch{}finally{}},u=async()=>{try{const g=await i.getRecord(t.entity360Name,t.entity360Id);g&&g.response&&(o.value=g.response,await f(g.response.entity.entityDefinition.columns),console.log(o.value))}catch{}finally{}},h=async g=>{for(let y=0;y<g.length;y++){const b=g[y];if(b.primaryKey&&b.primaryKey==!0){a.value=b;break}}},f=async g=>{for(let y=0;y<g.length;y++){const b=g[y];if(!b.autoGeneerated&&b.foreignKey&&b.foreignKey.referencedEntityName.toLowerCase()==t.linkedEntity.entityName.toLowerCase()){c.value=b;break}}},m=async()=>{for(let g=0;g<s.value.result.length;g++){const y=s.value.result[g];if(y[a.value.name]==o.value.result[0][c.value.name]){r.value=y;break}}},p=()=>{const g={linkedEntityRecordId:r.value[a.value.name],linkedEntityName:t.linkedEntity.entityName,relationType:"ManyToOne"};t.saveExistingEntityObject(g)};return(g,y)=>{const b=l.resolveComponent("Select"),_=l.resolveComponent("Divider"),w=l.resolveComponent("Button");return l.openBlock(),l.createElementBlock("div",Vm,[l.createVNode(b,{modelValue:l.unref(r),"onUpdate:modelValue":y[0]||(y[0]=E=>l.isRef(r)?r.value=E:r=E),"item-value":a.value.name,options:s.value.result,filter:"",optionLabel:a.value.name,placeholder:"Select "+a.value.name,class:"w-full"},{value:l.withCtx(E=>[E.value?(l.openBlock(),l.createElementBlock("div",Am,[l.createElementVNode("div",null,l.toDisplayString(E.value[a.value.name]),1)])):(l.openBlock(),l.createElementBlock("span",Fm,l.toDisplayString(E.placeholder),1))]),option:l.withCtx(E=>[l.createElementVNode("div",Bm,[l.createElementVNode("div",null,l.toDisplayString(E.option[a.value.name]),1)])]),_:1},8,["modelValue","item-value","options","optionLabel","placeholder"]),l.createElementVNode("div",$m,[l.createVNode(_),l.createElementVNode("div",Rm,[l.createElementVNode("div",Lm,[l.createVNode(w,{label:"Cancel",icon:"",severity:"secondary",onClick:y[1]||(y[1]=E=>e.value=!1)})]),l.createElementVNode("div",Im,[l.createVNode(w,{label:"Save",severity:"success",onClick:p})])])])])}}},zm={style:{"font-weight":"700","font-size":"1.25rem"}},Wm={class:"flex flex-col"},Hm={class:"flex flex-row justify-between items-center"},Um={class:"justify-start"},qm={class:"justify-start"},Ym="",Km={__name:"CreateRelatedentity",props:l.mergeModels({entity360Id:{required:!0},entity360Name:{type:String,required:!0},linkedEntity:{type:Object,required:!0}},{showCreateRelatedEntityForm:{},showCreateRelatedEntityFormModifiers:{}}),emits:l.mergeModels(["onSaveDialog"],["update:showCreateRelatedEntityForm"]),setup(n,{emit:t}){const e=l.useModel(n,"showCreateRelatedEntityForm");Ut.useRoute();const i=n,s=i.linkedEntity.entityName,o=t,r=l.ref("Add existing");l.onMounted(()=>{m()});const{formData:a,columns:c,errors:d,backendErrors:u,clearErrors:h,saveRecord:f,fetchAllRecords:m,saveRelatedEntityRecord:p}=js(s,Ym,o),g=()=>{for(let w=0;w<c.value.length;w++){const E=c.value[w];!E.autoGenerated&&E.foreignKey&&(a.value[E.name]=i.entity360Id)}const _={relationType:i.linkedEntity.relationType,linkedEntities:{entityLinkage:[{linkEntityName:i.entity360Name,linkRecordIdList:[i.entity360Id]}]}};f(_)},y=_=>{var w;if(((w=_==null?void 0:_.linkRecordIdList)==null?void 0:w.length)>0){const E={entityLinkage:[{linkEntityName:_.linkEntityName,linkRecordIdList:_.linkRecordIdList}]};p(i.entity360Name,i.entity360Id,E)}},b=_=>{const w={entityLinkage:[{linkEntityName:i.entity360Name,linkRecordIdList:[i.entity360Id]}]};p(_.linkedEntityName,_.linkedEntityRecordId,w)};return(_,w)=>{const E=l.resolveComponent("Tab"),k=l.resolveComponent("TabList"),v=l.resolveComponent("Divider"),S=l.resolveComponent("Button"),x=l.resolveComponent("TabPanel"),O=l.resolveComponent("TabPanels"),M=l.resolveComponent("Tabs"),C=l.resolveComponent("Drawer");return l.openBlock(),l.createBlock(C,{visible:e.value,"onUpdate:visible":w[3]||(w[3]=T=>e.value=T),blockScroll:!0,position:"right",class:"p-fluid layout-profile-sidebar",style:{width:"40%"},pt:{closeButton:"ml-auto"}},{header:l.withCtx(()=>[l.createElementVNode("span",zm,l.toDisplayString(r.value)+" "+l.toDisplayString(n.linkedEntity.entityName),1)]),default:l.withCtx(()=>[l.createVNode(M,{value:"1"},{default:l.withCtx(()=>[l.createVNode(k,null,{default:l.withCtx(()=>[l.createVNode(E,{value:"0"},{default:l.withCtx(()=>w[4]||(w[4]=[l.createTextVNode("Create new")])),_:1}),l.createVNode(E,{value:"1"},{default:l.withCtx(()=>w[5]||(w[5]=[l.createTextVNode("Add existing")])),_:1})]),_:1}),l.createVNode(O,null,{default:l.withCtx(()=>[l.createVNode(x,{value:"0"},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(c),(T,$)=>{var U;return l.openBlock(),l.createElementBlock("div",{key:$,class:"mt-3"},[!T.autoGenerated&&!T.foreignKey?(l.openBlock(),l.createBlock(Ni,{key:0,modelValue:l.unref(a)[T.name],"onUpdate:modelValue":H=>l.unref(a)[T.name]=H,column:T,errors:(U=l.unref(d)[T.name])==null?void 0:U.messages,onInput:l.unref(h)},null,8,["modelValue","onUpdate:modelValue","column","errors","onInput"])):l.createCommentVNode("",!0)])}),128)),l.createElementVNode("div",Wm,[l.createVNode(v),l.createElementVNode("div",Hm,[l.createElementVNode("div",Um,[l.createVNode(S,{label:"Cancel",icon:"",severity:"secondary",onClick:w[0]||(w[0]=T=>e.value=!1)})]),l.createElementVNode("div",qm,[l.createVNode(S,{label:"Save",severity:"success",onClick:g})])])])]),_:1}),l.createVNode(x,{value:"1"},{default:l.withCtx(()=>[n.linkedEntity.relationType=="ONE_TO_MANY"?(l.openBlock(),l.createBlock(Mm,{key:0,modelValue:e.value,"onUpdate:modelValue":w[1]||(w[1]=T=>e.value=T),linkedEntity:n.linkedEntity,entity360Name:n.entity360Name,entity360Id:n.entity360Id,saveExistingRelatedEntityRecord:y},null,8,["modelValue","linkedEntity","entity360Name","entity360Id"])):l.createCommentVNode("",!0),n.linkedEntity.relationType=="MANY_TO_ONE"?(l.openBlock(),l.createBlock(jm,{key:1,modelValue:e.value,"onUpdate:modelValue":w[2]||(w[2]=T=>e.value=T),linkedEntity:n.linkedEntity,entity360Name:n.entity360Name,entity360Id:n.entity360Id,saveExistingEntityObject:b},null,8,["modelValue","linkedEntity","entity360Name","entity360Id"])):l.createCommentVNode("",!0)]),_:1})]),_:1})]),_:1})]),_:1},8,["visible"])}}},Xm={class:"flex flex-col border-bottom-section pb-3 pt-3"},Gm={class:"flex items-center pl-3 pr-3 justify-between"},Qm={key:0,class:"pi pi-caret-right"},Jm={key:1,class:"pi pi-caret-down"},Zm={class:"ml-3 font-bold"},tp={class:"ml-1"},ep={class:"text-right"},np={key:0},ip=jt({__name:"LinkEntitySection",props:{entity360Id:{required:!0},entity360Name:{type:String,required:!0},linkedEntity:{type:Object,required:!0},entity360Name:{type:[String,Number]},onSaveRelatedEnttity:{type:Function}},setup(n){Ut.useRoute();const t=n,e=l.ref(!1),i=l.ref(!1),s=()=>{e.value=!e.value},o=()=>{i.value=!i.value},r=()=>{i.value=!1,t.onSaveRelatedEnttity()},a=l.computed(()=>t.linkedEntity.list.filter(c=>!c.is_deleted).length);return(c,d)=>{const u=l.resolveComponent("Button");return l.openBlock(),l.createElementBlock(l.Fragment,null,[l.createElementVNode("div",Xm,[l.createElementVNode("div",Gm,[l.createElementVNode("div",{class:"flex cursor-pointer items-center linked-entity-section grow line-height-4",onClick:d[0]||(d[0]=h=>s())},[e.value?l.createCommentVNode("",!0):(l.openBlock(),l.createElementBlock("div",Qm)),e.value?(l.openBlock(),l.createElementBlock("div",Jm)):l.createCommentVNode("",!0),l.createElementVNode("div",Zm,l.toDisplayString(n.linkedEntity.entityName),1),l.createElementVNode("div",tp," ("+l.toDisplayString(a.value)+") ",1)]),l.createElementVNode("div",ep,[l.createVNode(u,{label:"Add",icon:"pi pi-plus",size:"small",onClick:d[1]||(d[1]=h=>o())})])]),e.value?(l.openBlock(),l.createElementBlock("div",np,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(n.linkedEntity.list,(h,f)=>(l.openBlock(),l.createElementBlock("div",{class:"flex flex-col",key:f},[h.is_deleted?l.createCommentVNode("",!0):(l.openBlock(),l.createBlock(Jf,{key:0,linkEntityListItem:h},null,8,["linkEntityListItem"]))]))),128))])):l.createCommentVNode("",!0)]),i.value?(l.openBlock(),l.createBlock(Km,{key:0,showCreateRelatedEntityForm:i.value,"onUpdate:showCreateRelatedEntityForm":d[2]||(d[2]=h=>i.value=h),linkedEntity:n.linkedEntity,entity360Name:n.entity360Name,entity360Id:n.entity360Id,onOnSaveDialog:r},null,8,["showCreateRelatedEntityForm","linkedEntity","entity360Name","entity360Id"])):l.createCommentVNode("",!0)],64)}}},[["__scopeId","data-v-412eec44"]]),sp={class:"flex"},op={class:"p-3 mt-3 flex-col items-center"},rp={key:0,class:"pi pi-caret-right"},ap={key:1,class:"pi pi-caret-down"},lp={class:"font-bold ml-2"},cp={key:0,class:"flex flex-col mt-4"},dp={class:"flex flex-col mt-2"},up={class:"flex flex-row flex-wrap justify-between pl-5"},hp={class:"flex flex-col"},fp={class:"font-bold"},mp={class:"mt-2"},pp={key:0,class:"flex flex-col",style:{position:"relative","max-width":"400px","background-color":"var(--surface-card)"}},gp={key:2,style:{width:"350px"},class:"flex flex-col justify-center"},yp={key:0,class:"custom-sidebar"},bp={class:"custom-sidebar-content"},_p={class:"custom-sidebar-button"},xp={class:"custom-sidebar-text"},fa=jt({__name:"Entity360",props:{entityName:{type:String},recordId:{type:String}},emits:["onSaveDialog"],setup(n,{emit:t}){var x,O;const e=me(),i=Ut.useRoute(),s=n,o=l.ref(!0),r=l.ref(!1);let a=(x=i==null?void 0:i.params)==null?void 0:x.entityName,c=(O=i==null?void 0:i.params)==null?void 0:O.id;s.entityName&&(a=s.entityName),s.recordId&&(c=s.recordId);const d=t,{formData:u,columns:h,errors:f,backendErrors:m,isDataChange:p,linkedEntities:g,primarayColumn:y,clearErrors:b,saveRecord:_,getRelatedEntityRecordById:w,cancleRecord:E}=js(a,c,d);l.watch(()=>e.globalConfigs.appId,async M=>{M&&w()},{immediate:!0});const k=()=>{o.value=!o.value},v=()=>{r.value=!r.value},S=()=>{w()};return(M,C)=>{var R;const T=l.resolveComponent("SplitterPanel"),$=l.resolveComponent("Tab"),U=l.resolveComponent("TabList"),H=l.resolveComponent("TabPanel"),B=l.resolveComponent("TabPanels"),I=l.resolveComponent("Tabs"),F=l.resolveComponent("Splitter"),P=l.resolveComponent("Button");return l.openBlock(),l.createElementBlock(l.Fragment,null,[l.createElementVNode("div",sp,[l.createVNode(F,{class:"flex-1",layout:"horizontal",gutterSize:8,size:100},{default:l.withCtx(()=>[l.createVNode(T,{size:20,minSize:10,maxSize:20},{default:l.withCtx(()=>[l.createElementVNode("div",op,[l.createElementVNode("div",{onClick:C[0]||(C[0]=W=>k()),class:"section-heading cursor-pointer"},[o.value?l.createCommentVNode("",!0):(l.openBlock(),l.createElementBlock("i",rp)),o.value?(l.openBlock(),l.createElementBlock("i",ap)):l.createCommentVNode("",!0),l.createElementVNode("span",lp," About this "+l.toDisplayString(l.unref(a)),1)]),o.value?(l.openBlock(),l.createElementBlock("div",cp,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(h),(W,J)=>{var G;return l.openBlock(),l.createElementBlock("div",{key:J},[W.autoGenerated?l.createCommentVNode("",!0):(l.openBlock(),l.createBlock(Ni,{key:0,modelValue:l.unref(u)[W.name],"onUpdate:modelValue":ot=>l.unref(u)[W.name]=ot,column:W,errors:(G=l.unref(f)[W.name])==null?void 0:G.messages,onInput:l.unref(b)},null,8,["modelValue","onUpdate:modelValue","column","errors","onInput"]))])}),128))])):l.createCommentVNode("",!0)])]),_:1}),l.createVNode(T,{size:55,minSize:35,style:{height:"100%"}},{default:l.withCtx(()=>[l.createVNode(I,{value:"0"},{default:l.withCtx(()=>[l.createVNode(U,null,{default:l.withCtx(()=>[l.createVNode($,{value:"0"},{default:l.withCtx(()=>C[3]||(C[3]=[l.createTextVNode("Overview")])),_:1}),l.createVNode($,{value:"1"},{default:l.withCtx(()=>C[4]||(C[4]=[l.createTextVNode("Activity")])),_:1})]),_:1}),l.createVNode(B,null,{default:l.withCtx(()=>[l.createVNode(H,{value:"0"},{default:l.withCtx(()=>[l.createElementVNode("div",dp,[C[5]||(C[5]=l.createElementVNode("h3",{class:"mt-2 text-xl font-semibold"},"Data highlights",-1)),l.createElementVNode("div",up,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(h).filter(W=>W.autoGenerated),(W,J)=>(l.openBlock(),l.createElementBlock("div",{key:J,class:"column-item"},[l.createElementVNode("div",hp,[l.createElementVNode("div",fp,l.toDisplayString(W.name),1),l.createElementVNode("div",mp,[l.createVNode(Hs,{column:W,value:l.unref(u)[W.name]},null,8,["column","value"])])])]))),128))])])]),_:1}),l.createVNode(H,{value:"1"})]),_:1})]),_:1})]),_:1})]),_:1}),((R=l.unref(g))==null?void 0:R.length)>0?(l.openBlock(),l.createElementBlock("div",pp,[r.value?(l.openBlock(),l.createBlock(P,{key:0,icon:"pi pi-caret-right",rounded:"",onClick:v,"aria-label":"Filter",style:{height:"2rem",width:"2rem",left:"-20px"}})):l.createCommentVNode("",!0),r.value?l.createCommentVNode("",!0):(l.openBlock(),l.createBlock(P,{key:1,icon:"pi pi-caret-left",rounded:"",onClick:v,"aria-label":"Filter",style:{height:"2rem",width:"2rem",left:"-20px"}})),r.value?(l.openBlock(),l.createElementBlock("div",gp,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(g),(W,J)=>(l.openBlock(),l.createElementBlock("div",{key:J},[l.createVNode(ip,{entity360Name:l.unref(a),entity360Id:l.unref(c),linkedEntity:W,onSaveRelatedEnttity:S},null,8,["entity360Name","entity360Id","linkedEntity"])]))),128))])):l.createCommentVNode("",!0)])):l.createCommentVNode("",!0)]),l.unref(p)?(l.openBlock(),l.createElementBlock("div",yp,[l.createElementVNode("div",bp,[l.createElementVNode("div",_p,[l.createVNode(P,{severity:"primary",onClick:C[1]||(C[1]=W=>l.unref(_)())},{default:l.withCtx(()=>C[6]||(C[6]=[l.createTextVNode("Save")])),_:1}),l.createVNode(P,{style:{"margin-left":"10px"},severity:"secondary",onClick:C[2]||(C[2]=W=>l.unref(E)())},{default:l.withCtx(()=>C[7]||(C[7]=[l.createTextVNode("Cancel")])),_:1})]),l.createElementVNode("div",xp," You've changed property in the "+l.toDisplayString(l.unref(a))+". ",1)])])):l.createCommentVNode("",!0)],64)}}},[["__scopeId","data-v-8d31dd1c"]]);function kp(){const n=new qe;let{errors:t,setErrors:e}=yr(),i=l.reactive({data:null});const s=v=>{i.data=v},o=async v=>{try{const S=await n.getEntityRecords(v);if(S&&S.response)return S}catch(S){return console.error("Error fetching entity:",S.errorMessage),S}finally{}},r=async(v,S)=>{try{let x=await n.addRecord(v.entityName,S);if(x)return x}catch(x){return x}finally{}},a=async(v,S,x)=>{try{const O=await n.updateRecord(v.entityName,S,x);if(O&&O.response)return O}catch(O){return O}finally{}},c=async(v,S)=>{try{S.filter==null&&(S.filter={}),Object.keys(S.filter).length===0&&(S.filter=[]);const x=await n.searchEntityRecords(v.entityName,S);if(x)return x.response.sortBy=S.sortBy,x.response.filters=S.filter,x.response.sortDirection=S.sortDirection,x.response.fullTextSearch=S.fullTextSearch,x}catch(x){return x}finally{}},d=async(v,S)=>{try{const x=await n.deleteRecord(v.entityName,S);if(x)return x}catch(x){console.error("Error on deleting record:",x.errorMessage)}finally{}},u=v=>v.result,h=v=>v.entity.entityDefinition.columns,f=v=>{const S=v.entity.entityDefinition.columns;let x={};for(let O=0;O<S.length;O++){const M=S[O];if(M.primaryKey&&M.primaryKey==!0){x=M;break}}return x},m=v=>{const S=v.entity.entityDefinition.columns;let x={};for(let O=0;O<S.length;O++){let M=S[O];M.autoGenerated||(x[M.name]="")}return x},p=(v,S)=>{let x="";const O=v.entity.entityDefinition.columns;for(let M=0;M<O.length;M++){let C=O[M];if(S==C.name){x=C.type;break}}return x},g=(v,S)=>{const O=v.entity.entityDefinition.columns.filter(C=>C.autoGenerated).map(C=>C.name);return Object.entries(S).filter(([C])=>!O.includes(C)).map(([C,T])=>({recordColumnName:C,recordColumnValue:T,columnType:p(i.data,C)}))},y=()=>{const v=i.data.entity.entityDefinition.columns;return Is().shape(v.reduce((x,O)=>(O.autoGenerated||(x[O.name]=Ls().nullable(!1).test({name:"custom-validation",test:function(M){const C=[];let T="";if(O.required&&(!M||M.trim()===""))if(O.validations){T=b(O.validations,"VALIDATE_REQUIRED"),C.push(T);let $=w(O.validations,"VALIDATE_REQUIRED");$&&($="hint:"+$,C.push($))}else T=O.displayName+" is required.",C.push(T);else{if(O.maxLength&&M.length>O.maxLength)if(O.validations){T=b(O.validations,"VALIDATE_MAXLENGTH"),C.push(T);let $=w(O.validations,"VALIDATE_MAXLENGTH");$&&($="hint:"+$,C.push($))}else T=O.displayName+" cannot exceed from "+O.maxLength+" characters",C.push(T);if(O.regxId&&!new RegExp(_(O.validations,"VALIDATE_REGX")).test(M))if(O.validations){T=b(O.validations,"VALIDATE_REGX"),C.push(T);let $=w(O.validations,"VALIDATE_REGX");$&&($="hint:"+$,C.push($))}else T=O.displayName+" invalid format.",C.push(T)}return C.length>0?this.createError({message:C}):!0}})),x),{}))},b=(v,S)=>{for(let x=0;x<v.length;x++)if(S==v[x].type)return v[x].message},_=(v,S)=>{for(let x=0;x<v.length;x++)if(S==v[x].type)return v[x].regx},w=(v,S)=>{for(let x=0;x<v.length;x++)if(S==v[x].type)return v[x].hint};return{state:i,setEntity:s,getEntity:o,addRecord:r,updateRecord:a,searchRecord:c,entityRecordDelete:d,getEntityItems:u,getEntityColumns:h,getPrimaryKeyColumn:f,getFormData:m,createDataToSave:g,createValidationSchema:y,clearErrors:v=>(e({...t.value,[v]:null}),t.value),validateData:async(v,S)=>{try{return await v.validate(S,{abortEarly:!1}),e({}),{validate:!0}}catch(x){const O=x.inner.reduce((T,$)=>(T[$.path]||(T[$.path]={messages:[]}),T[$.path].messages.push(...$.errors),T),{}),M=Object.entries(O).reduce((T,[$,U])=>(T[$]={messages:U.messages},T),{});return e(M),{validate:!1,errors:t.value}}}}}const Sp={__name:"ConfirmDeleteDialog",props:{showDeleteDialog:{},showDeleteDialogModifiers:{}},emits:l.mergeModels(["onDeleteItem"],["update:showDeleteDialog"]),setup(n,{emit:t}){const e=l.useModel(n,"showDeleteDialog"),i=t,s=o=>{i("onDeleteItem",{remove:o})};return(o,r)=>{const a=l.resolveComponent("Button"),c=l.resolveComponent("Dialog");return l.openBlock(),l.createBlock(c,{visible:e.value,"onUpdate:visible":r[2]||(r[2]=d=>e.value=d),style:{width:"450px"},header:"Confirm",modal:!0},{footer:l.withCtx(()=>[l.createVNode(a,{label:"No",icon:"pi pi-times",text:"",onClick:r[0]||(r[0]=d=>s(!1))}),l.createVNode(a,{label:"Yes",icon:"pi pi-check",text:"",onClick:r[1]||(r[1]=d=>s(!0))})]),default:l.withCtx(()=>[r[3]||(r[3]=l.createElementVNode("div",{class:"flex items-center justify-center"},[l.createElementVNode("i",{class:"pi pi-exclamation-triangle mr-3",style:{"font-size":"2rem"}}),l.createElementVNode("span",null,"Are you sure you want to delete the selected item?")],-1))]),_:1},8,["visible"])}}},wp={key:0,style:{"font-weight":"700","font-size":"1.25rem"}},Ep={key:1,style:{"font-weight":"700","font-size":"1.25rem"}},ma={__name:"EntityFormDialog",props:l.mergeModels({item:Object},{showEntityForm:{},showEntityFormModifiers:{}}),emits:["update:showEntityForm"],setup(n){const t=l.useModel(n,"showEntityForm"),e=l.inject("entityObject"),i=n;let s=l.ref([]),o=l.ref({}),r=l.ref([]),a=l.ref(null),c=l.ref({});l.onMounted(()=>{s.value=e.getEntityColumns(e.state.data),i.item?o.value=JSON.parse(JSON.stringify(i.item)):o.value=e.getFormData(e.state.data),a.value=e.createValidationSchema()});const d=async()=>{const m=await e.validateData(a.value,o.value);if(!m.validate){c.value=m.errors;return}const p=e.getPrimaryKeyColumn(e.state.data),g=i.item[p.name],y={dataDefinitions:e.createDataToSave(e.state.data,o.value)},b=await e.updateRecord(e.state.data,g,y);if(b&&b.success){t.value=!1;const _={sortBy:e.state.data.sortBy,sortDirection:e.state.data.sortDirection,pageSize:e.state.data.pageSize,currentPage:e.state.data.currentPage,columnList:null,filter:e.state.data.filters,fullTextSearch:e.state.data.fullTextSearch},w=await e.searchRecord(e.state.data,_);if(w!=null&&w.response){let E=w==null?void 0:w.response;e.setEntity(E)}}else b.validationErrors&&(r.value=JSON.parse(JSON.stringify(b.errvalidationErrorsors)))},u=async()=>{const m=await e.validateData(a.value,o.value);if(!m.validate){c.value=m.errors;return}const p={dataDefinitions:e.createDataToSave(e.state.data,o.value)},g=await e.addRecord(e.state.data,p);g&&g.success?(t.value=!1,e.state.data=await e.getEntity(e.state.data.entityName)):g.validationErrors&&(r.value=JSON.parse(JSON.stringify(g.errvalidationErrorsors)))},h=async()=>{i.item?d():u()},f=m=>{c.value=e.clearErrors(m)};return(m,p)=>{const g=l.resolveComponent("Button"),y=l.resolveComponent("Dialog");return t.value?(l.openBlock(),l.createBlock(y,{key:0,showFooter:!1,visible:t.value,"onUpdate:visible":p[2]||(p[2]=b=>t.value=b),style:{width:"50rem"},breakpoints:{"1199px":"75vw","575px":"90vw"},modal:!0,class:"p-fluid"},{header:l.withCtx(()=>[n.item?(l.openBlock(),l.createElementBlock("span",wp,"Edit "+l.toDisplayString(l.unref(e).state.data.entityName)+" record details",1)):l.createCommentVNode("",!0),n.item?l.createCommentVNode("",!0):(l.openBlock(),l.createElementBlock("span",Ep,"Add "+l.toDisplayString(l.unref(e).state.data.entityName)+" record details",1))]),footer:l.withCtx(()=>[l.createVNode(g,{type:"button",icon:"",label:"Cancel",severity:"secondary",onClick:p[0]||(p[0]=b=>t.value=!1)}),l.createVNode(g,{type:"button",icon:"",label:"Save",severity:"success",onClick:p[1]||(p[1]=b=>h())})]),default:l.withCtx(()=>{var b;return[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(s),(_,w)=>{var E;return l.openBlock(),l.createElementBlock("div",{key:w},[!_.autoGenerated&&!_.foreignKey?(l.openBlock(),l.createBlock(Ni,{key:0,modelValue:l.unref(o)[_.name],"onUpdate:modelValue":k=>l.unref(o)[_.name]=k,column:_,errors:(E=l.unref(c)[_.name])==null?void 0:E.messages,onInput:f},null,8,["modelValue","onUpdate:modelValue","column","errors"])):l.createCommentVNode("",!0),!_.autoGenerated&&_.foreignKey?(l.openBlock(),l.createBlock(Ar,{key:1,modelValue:l.unref(o)[_.name],"onUpdate:modelValue":k=>l.unref(o)[_.name]=k,entityName:_.foreignKey.referencedEntityName,columnName:_.name,relatedEntityColumn:_.foreignKey.referencedColumnName},null,8,["modelValue","onUpdate:modelValue","entityName","columnName","relatedEntityColumn"])):l.createCommentVNode("",!0)])}),128)),((b=l.unref(r))==null?void 0:b.length)>0?(l.openBlock(),l.createBlock(Vr,{key:0,errors:l.unref(r)},null,8,["errors"])):l.createCommentVNode("",!0)]}),_:1},8,["visible"])):l.createCommentVNode("",!0)}}},vp={class:"flex justify-between items-start"},Cp={class:"flex-grow-1"},Op={class:"tile-grid"},Dp={class:"font-bold text-lg text-700"},Np={class:"flex flex-col gap-2"},Tp=jt({__name:"EntityListSingleRecord",props:{item:Object},setup(n){const t=n,e=l.inject("entityObject"),i=l.ref([]),s=l.ref(!1),o=l.ref(!1);l.onMounted(()=>{i.value=e.getEntityColumns(e.state.data)});const r=()=>{s.value=!0},a=()=>{o.value=!0},c=u=>{u.remove==!0?d():s.value=!1},d=async()=>{const u=e.getPrimaryKeyColumn(e.state.data),h=t.item[u.name],f=await e.entityRecordDelete(e.state.data,h);if(f!=null&&f.success){s.value=!1;const m={sortBy:e.state.data.sortBy,sortDirection:e.state.data.sortDirection,pageSize:e.state.data.pageSize,currentPage:e.state.data.currentPage,columnList:null,filter:e.state.data.filters,fullTextSearch:e.state.data.fullTextSearch},p=await e.searchRecord(e.state.data,m);if(p!=null&&p.response){let g=p==null?void 0:p.response;e.setEntity(g)}console.log(f)}};return(u,h)=>{const f=l.resolveComponent("Button");return l.openBlock(),l.createElementBlock(l.Fragment,null,[l.createElementVNode("div",vp,[l.createElementVNode("div",Cp,[l.createElementVNode("div",Op,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(i.value,(m,p)=>(l.openBlock(),l.createElementBlock("div",{key:p},[l.createElementVNode("span",Dp,l.toDisplayString(m.name)+" : ",1),l.createVNode(Hs,{column:m,value:n.item[m.name]},null,8,["column","value"])]))),128))])]),l.createElementVNode("div",Np,[l.createVNode(f,{onClick:h[0]||(h[0]=m=>a()),icon:"pi pi-pencil",severity:"success",size:"",rounded:"","aria-label":"Edit"}),l.createVNode(f,{onClick:h[1]||(h[1]=m=>r()),icon:"pi pi-trash",severity:"danger",rounded:"","aria-label":"Delete"})])]),o.value?(l.openBlock(),l.createBlock(ma,{key:0,showEntityForm:o.value,"onUpdate:showEntityForm":h[2]||(h[2]=m=>o.value=m),item:n.item},null,8,["showEntityForm","item"])):l.createCommentVNode("",!0),s.value?(l.openBlock(),l.createBlock(Sp,{key:1,showDeleteDialog:s.value,"onUpdate:showDeleteDialog":h[3]||(h[3]=m=>s.value=m),onOnDeleteItem:c},null,8,["showDeleteDialog"])):l.createCommentVNode("",!0)],64)}}},[["__scopeId","data-v-ea3b758f"]]),Pp=jt({__name:"EntityListRecordParent",props:{listItemDisplay:String},setup(n){const t=l.inject("entityObject"),e=l.ref([]);return l.watch(()=>t.state.data,i=>{i&&(e.value=i.result,console.log("Entity state updated in child:",t))},{immediate:!0}),(i,s)=>(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(e.value,(o,r)=>(l.openBlock(),l.createElementBlock("div",{key:r,class:"card rounded-md p-5 my-2 shadow-lg relative tile"},[(l.openBlock(),l.createBlock(l.resolveDynamicComponent(n.listItemDisplay!=null&&n.listItemDisplay!=""?n.listItemDisplay:Tp),l.mergeProps({ref_for:!0},{item:o}),null,16))]))),128))}},[["__scopeId","data-v-b13f837f"]]),Mp={};function Vp(n,t){return null}const Ap=jt(Mp,[["render",Vp]]),Fp={class:"my-2"},Bp={class:"m-0"},$p={__name:"EntityListHeaderSlot",setup(n){const t=l.inject("entityObject");let e=l.ref("");return l.watch(()=>t.state.data,i=>{i&&(e.value=i.entityName)},{immediate:!0}),(i,s)=>{const o=l.resolveComponent("Toolbar");return l.openBlock(),l.createBlock(o,{class:"p-2 my-2"},{start:l.withCtx(()=>[l.createElementVNode("div",Fp,[l.createElementVNode("h2",Bp,"EntityName: "+l.toDisplayString(l.unref(e)),1)])]),end:l.withCtx(()=>s[0]||(s[0]=[])),_:1})}}},Rp={class:"flex flex-col mb-5"},Lp={class:"col-12"},Ip={class:"flex flex-col mb-5"},jp={class:"col-12"},zp={key:0},Wp={class:"flex flex-col mb-5"},Hp={class:"col-12"},Up={class:"flex flex-col mb-5"},qp={class:"col-12"},Yp={class:"flex flex-col mb-5"},Kp={class:"col-12"},Xp={class:"flex flex-row justify-between items-center"},Gp={key:1},Qp={class:"flex flex-row justify-between items-center"},Jp={key:1,class:"text-red-500"},Zp={class:"flex flex-col"},tg={class:"flex flex-row justify-between items-center"},eg={__name:"FilterSortSidebar",props:l.mergeModels({headers:Array,operatorMap:Object,sortCallback:Function,filterCallback:Function,getColumnDatatype:Function,getDatatypeByField:Function},{sortBy:{},sortByModifiers:{},sortDirection:{},sortDirectionModifiers:{},showFilter:{},showFilterModifiers:{},filters:{},filtersModifiers:{}}),emits:["update:sortBy","update:sortDirection","update:showFilter","update:filters"],setup(n){const t=l.useModel(n,"sortBy"),e=l.useModel(n,"sortDirection"),i=l.useModel(n,"showFilter"),s=l.useModel(n,"filters"),o={gt:"is greater than",dateAfter:"is after",equals:"is equals",dateIs:"is equals",notEquals:"is not equals",dateIsNot:"is not equals",lt:"is less than",dateBefore:"is before",lte:"is less than or equal to",gte:"is greater than or equal to",between:"between",contains:"contains",startsWith:"starts with",notContains:"not contains",endsWith:"ends with"},r=[{label:"Starts with",value:"startsWith"},{label:"Contains",value:"contains"},{label:"Not contains",value:"notContains"},{label:"Ends with",value:"endsWith"},{label:"Equals",value:"equals"},{label:"Not equals",value:"notEquals"}],a=[{label:"Equals",value:"equals"},{label:"Not equals",value:"notEquals"},{label:"Less than",value:"lt"},{label:"Less than or equal to",value:"lte"},{label:"Greater than",value:"gt"},{label:"Greater than or equal to",value:"gte"}],c=[{label:"Equals",value:"equals"},{label:"Not equals",value:"notEquals"}],d=[{label:"Date is",value:"dateIs"},{label:"Date is not",value:"dateIsNot"},{label:"Date is before",value:"dateBefore"},{label:"Date is after",value:"dateAfter"}],u=[{label:"ASC",value:1},{label:"DESC",value:-1}];let h=[];const f=l.computed(()=>n.headers.filter(S=>S.sortable)),m=l.computed(()=>n.headers.filter(S=>S.filterable)),p=S=>n.headers.filter(x=>{var O;return x.filterable?((O=s.value[S])==null?void 0:O.columnName)===x.name?!0:!s.value.some((M,C)=>C!==S&&M.columnName===x.name):!1}).map(x=>({label:x.name,value:x.field})),g=S=>{let x="";switch(n.getDatatypeByField(S.columnName).toLowerCase()){case"string":case"uuid":x="startsWith";break;case"date":x="dateIs";break;case"numeric":case"int":case"integer":x="equals";break;case"bool":case"boolean":x="equals";break}S.operator=x,S.value=""},y=S=>{const x=n.getDatatypeByField(S.columnName);switch(x&&x.toLowerCase()){case"integer":case"int":case"numeric":h=a;break;case"date":h=d;break;case"bool":case"boolean":h=c;break;default:h=r}return h},b=S=>{if(S&&S.columnName){const x=n.getDatatypeByField(S.columnName);return n.getColumnDatatype(x)}else return""},_=()=>{for(let S=0;S<s.value.length;S++){const x=s.value[S];x.editing=!1}s.value.push({columnName:"",value:"",operator:"",editing:!0})},w=S=>{s.value.splice(S,1)},E=S=>{S.editing=!S.editing},k=()=>{let S=[],x=JSON.parse(JSON.stringify(s.value));for(let O=0;O<x.length;O++){const M=x[O];delete M.editing,M.columnName&&M.operator&&M.value&&(M.columnType=n.getDatatypeByField(M.columnName),M.operator=n.operatorMap[M.operator],S.push(M))}n.filterCallback(S)},v=()=>{n.sortCallback()};return(S,x)=>{const O=l.resolveComponent("Select"),M=l.resolveComponent("Divider"),C=l.resolveComponent("InputNumber"),T=l.resolveComponent("Calendar"),$=l.resolveComponent("InputText"),U=l.resolveComponent("Button"),H=l.resolveComponent("Drawer");return l.openBlock(),l.createBlock(H,{visible:i.value,"onUpdate:visible":x[4]||(x[4]=B=>i.value=B),header:"Sorting and Filter",blockScroll:!0,position:"right",class:"layout-profile-sidebar !w-full md:!w-80 lg:!w-[30rem]",pt:{closeButton:"ml-auto"}},{default:l.withCtx(()=>[l.createElementVNode("div",Rp,[x[5]||(x[5]=l.createElementVNode("div",{class:"col-12 font-bold"},"Sort Column",-1)),l.createElementVNode("div",Lp,[l.createVNode(O,{modelValue:t.value,"onUpdate:modelValue":x[0]||(x[0]=B=>t.value=B),options:f.value,optionLabel:"name",optionValue:"field",highlightOnSelect:!1,class:"w-full",onChange:x[1]||(x[1]=B=>v(S.event))},null,8,["modelValue","options"])])]),l.createElementVNode("div",Ip,[x[6]||(x[6]=l.createElementVNode("div",{class:"col-12 font-bold"},[l.createElementVNode("div",{class:"col-12 font-bold"},"Sort Direction")],-1)),l.createElementVNode("div",jp,[l.createVNode(O,{modelValue:e.value,"onUpdate:modelValue":x[2]||(x[2]=B=>e.value=B),options:u,optionLabel:"label",optionValue:"value",highlightOnSelect:!1,class:"w-full",onChange:x[3]||(x[3]=B=>v(S.event))},null,8,["modelValue"])])]),(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(s.value,(B,I)=>(l.openBlock(),l.createElementBlock("div",{key:I},[B.editing?(l.openBlock(),l.createElementBlock("div",zp,[l.createVNode(M),l.createElementVNode("div",Wp,[x[7]||(x[7]=l.createElementVNode("div",{class:"col-12 font-bold"},"Filter Column",-1)),l.createElementVNode("div",Hp,[l.createVNode(O,{modelValue:B.columnName,"onUpdate:modelValue":F=>B.columnName=F,options:p(I),optionLabel:"label",placeholder:"Select column",optionValue:"value",highlightOnSelect:!1,class:"w-full",onChange:F=>g(B)},null,8,["modelValue","onUpdate:modelValue","options","onChange"])])]),l.createElementVNode("div",Up,[x[8]||(x[8]=l.createElementVNode("div",{class:"col-12 font-bold"},"Filter Operator",-1)),l.createElementVNode("div",qp,[l.createVNode(O,{modelValue:B.operator,"onUpdate:modelValue":F=>B.operator=F,options:y(B),optionLabel:"label",placeholder:"Select operator",optionValue:"value",highlightOnSelect:!1,class:"w-full"},null,8,["modelValue","onUpdate:modelValue","options"])])]),l.createElementVNode("div",Yp,[x[9]||(x[9]=l.createElementVNode("div",{class:"col-12 font-bold"},"Filter value",-1)),l.createElementVNode("div",Kp,[b(B)=="numeric"?(l.openBlock(),l.createBlock(C,{key:0,format:!1,class:"w-full",modelValue:B.value,"onUpdate:modelValue":F=>B.value=F,placeholder:"Search value"},null,8,["modelValue","onUpdate:modelValue"])):b(B)=="date"?(l.openBlock(),l.createBlock(T,{key:1,class:"w-full",modelValue:B.value,"onUpdate:modelValue":F=>B.value=F,dateFormat:"mm/dd/yy",placeholder:"mm/dd/yyyy"},null,8,["modelValue","onUpdate:modelValue"])):(l.openBlock(),l.createBlock($,{key:2,modelValue:B.value,"onUpdate:modelValue":F=>B.value=F,class:"w-full",placeholder:"Search value"},null,8,["modelValue","onUpdate:modelValue"]))])]),l.createElementVNode("div",Xp,[l.createVNode(U,{label:"Hide",icon:"",severity:"warn",onClick:F=>E(B)},null,8,["onClick"]),l.createVNode(U,{label:"Delete",icon:"",severity:"danger",onClick:F=>w(I)},null,8,["onClick"])])])):l.createCommentVNode("",!0),B.editing?l.createCommentVNode("",!0):(l.openBlock(),l.createElementBlock("div",Gp,[l.createVNode(M),l.createElementVNode("div",Qp,[l.createElementVNode("span",null,[B.columnName||B.operator||B.value?(l.openBlock(),l.createElementBlock(l.Fragment,{key:0},[l.createElementVNode("span",{class:l.normalizeClass({"text-red-500":!B.columnName})},l.toDisplayString(B.columnName?" "+B.columnName:" column"),3),l.createElementVNode("span",{class:l.normalizeClass({"text-red-500":!o[B.operator]})},l.toDisplayString(B.operator?" "+o[B.operator]:" operator"),3),l.createElementVNode("span",{class:l.normalizeClass({"text-red-500":!B.value})},l.toDisplayString(B.value?" "+B.value:" value"),3)],64)):(l.openBlock(),l.createElementBlock("span",Jp,"Filter is empty"))]),l.createVNode(U,{label:"Edit",icon:"",severity:"info",onClick:F=>E(B)},null,8,["onClick"])])]))]))),128)),l.createElementVNode("div",Zp,[l.createVNode(M),l.createElementVNode("div",tg,[l.createVNode(U,{label:"Add",disabled:m.value.length===s.value.length,icon:"",severity:"success",onClick:_},null,8,["disabled"]),l.createVNode(U,{label:"Apply",severity:"info",onClick:k})])])]),_:1},8,["visible"])}}},ng={class:"my-2"},pa={__name:"EntityListFilters",setup(n){const t=l.inject("entityObject"),e=l.ref(!1),i=l.ref([]),s=l.ref([]),o=l.ref(""),r=l.ref(1);let a=l.ref("");const c=l.ref([]),d=l.ref([]),u={gt:"GREATER_THAN",dateAfter:"GREATER_THAN",equals:"EQUAL",dateIs:"EQUAL",notEquals:"NOT_EQUAL",dateIsNot:"NOT_EQUAL",lt:"LESS_THAN",dateBefore:"LESS_THAN",lte:"LESS_THAN_EQUAL",gte:"GREATER_THAN_EQUAL",between:"BETWEEN",contains:"CONTAINS",startsWith:"STARTS_WITH",notContains:"NOT_CONTAINS",endsWith:"ENDS_WITH"};l.watch(()=>t.state.data,E=>{if(E&&(c.value=t.getEntityColumns(E),d.value=b(c.value),o.value=="")){const k=t.getPrimaryKeyColumn(E);o.value=k.name}},{immediate:!0});const h=()=>{e.value=!e.value},f=E=>{s.value=E,m()},m=async()=>{const E={sortBy:[o.value],sortDirection:r.value===1?"ASC":"DESC",pageSize:t.state.data.pageSize,currentPage:t.state.data.currentPage,columnList:null,filter:s.value,fullTextSearch:a.value},k=await t.searchRecord(t.state.data,E);if(k!=null&&k.success){let v=k==null?void 0:k.response;t.setEntity(v)}},p=()=>{m()},g=()=>{i.value=[],s.value=[],m()},y=()=>{m()},b=E=>E.map(k=>({field:k.name,name:k.displayName?k.displayName:k.name,filterable:k.filterable,datatype:k.type,sortable:k.indexColumn,displayFormatKey:k.displayFormatKey,displayFormat:k.displayFormat})),_=E=>{switch(E.toLowerCase()){case"integer":case"int":case"numeric":return"numeric";case"date":return"date";case"bool":case"boolean":return"boolean";default:return"text"}},w=E=>{const k=c.value.find(v=>v.name===E);return k?k.type:null};return(E,k)=>{const v=l.resolveComponent("Button"),S=l.resolveComponent("InputIcon"),x=l.resolveComponent("InputText"),O=l.resolveComponent("IconField"),M=l.resolveComponent("Toolbar");return l.openBlock(),l.createElementBlock(l.Fragment,null,[l.createVNode(M,{class:"p-2 my-2"},{start:l.withCtx(()=>[l.createElementVNode("div",ng,[l.createVNode(v,{type:"button",size:"medium",icon:"pi pi-filter",label:"Filter",severity:"info",onClick:k[0]||(k[0]=C=>h())})]),l.createVNode(v,{class:"ml-3",size:"medium",type:"button",icon:"pi pi-filter-slash",label:"Clear",severity:"warn",onClick:k[1]||(k[1]=C=>g())})]),end:l.withCtx(()=>[l.createVNode(O,{iconPosition:"right",class:"block mt-2 md:mt-0"},{default:l.withCtx(()=>[l.createVNode(S,{onClick:k[2]||(k[2]=C=>y()),class:"pi pi-search"}),l.createVNode(x,{class:"w-full sm:w-auto",onKeyup:k[3]||(k[3]=l.withKeys(C=>y(),["enter"])),modelValue:l.unref(a),"onUpdate:modelValue":k[4]||(k[4]=C=>l.isRef(a)?a.value=C:a=C),placeholder:"Search..."},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(eg,{sortBy:o.value,"onUpdate:sortBy":k[5]||(k[5]=C=>o.value=C),sortDirection:r.value,"onUpdate:sortDirection":k[6]||(k[6]=C=>r.value=C),showFilter:e.value,"onUpdate:showFilter":k[7]||(k[7]=C=>e.value=C),filters:i.value,"onUpdate:filters":k[8]||(k[8]=C=>i.value=C),headers:d.value,operatorMap:u,sortCallback:p,filterCallback:f,getColumnDatatype:_,getDatatypeByField:w},null,8,["sortBy","sortDirection","showFilter","filters","headers"])],64)}}},ig={__name:"EntityListPagination",setup(n){const t=l.ref(25),e=l.ref(0),i=l.ref(0),s=l.ref(0);let o=l.inject("entityObject");const r=async a=>{t.value=a.rows,e.value=a.page,s.value=a.first;const c={sortBy:o.state.data.sortBy,sortDirection:o.state.data.sortDirection,columnList:null,filter:o.state.data.filters,fullTextSearch:o.state.data.fullTextSearch,pageSize:t.value,currentPage:e.value},d=await o.searchRecord(o.state.data,c);if(d!=null&&d.success){let u=d==null?void 0:d.response;o.setEntity(u),i.value=d.response.totalRecords,s.value=e.value*t.value}};return l.watch(()=>{var a,c;return(c=(a=o==null?void 0:o.state)==null?void 0:a.data)==null?void 0:c.totalRecords},a=>{i&&(i.value=a)},{immediate:!0}),(a,c)=>{const d=l.resolveComponent("Paginator");return l.openBlock(),l.createBlock(d,{class:"my-4",rows:t.value,totalRecords:i.value,rowsPerPageOptions:[10,25,50,100],onPage:r,template:"FirstPageLink PrevPageLink PageLinks NextPageLink LastPageLink CurrentPageReport RowsPerPageDropdown",currentPageReportTemplate:"Showing {first} to {last} of {totalRecords} items"},null,8,["rows","totalRecords"])}}},sg={class:"flex flex-row justify-end p-2 my-2"},ga={__name:"EntityListAddButton",setup(n){const t=l.ref(!1),e=()=>{t.value=!0};return(i,s)=>{const o=l.resolveComponent("Button");return l.openBlock(),l.createElementBlock(l.Fragment,null,[l.createElementVNode("div",sg,[l.createVNode(o,{label:"Add",size:"medium",icon:"pi pi-plus",severity:"success",onClick:s[0]||(s[0]=r=>e())})]),t.value?(l.openBlock(),l.createBlock(ma,{key:0,showEntityForm:t.value,"onUpdate:showEntityForm":s[1]||(s[1]=r=>t.value=r)},null,8,["showEntityForm"])):l.createCommentVNode("",!0)],64)}}},ya={__name:"EntityList",props:{entityName:String,listDisplay:String,listItemDisplay:String,listHeader:String,listFooter:String,listFilter:String,listPagination:String,showAddButton:Boolean,listFilerSlot:Boolean,className:{type:String,default:"default-class"}},setup(n){const t=kp(),e=me();l.provide("entityObject",t);const i=n;return l.watch(()=>e.globalConfigs.appId,async s=>{if(s){const o=await t.getEntity(i.entityName);o.success?t.setEntity(o.response):t.setEntity({result:[]})}},{immediate:!0}),(s,o)=>{var r,a,c;return s.$slots["list-item-display"]?(l.openBlock(),l.createElementBlock(l.Fragment,{key:0},[n.showAddButton?(l.openBlock(),l.createBlock(ga,{key:0})):l.createCommentVNode("",!0),n.listFilerSlot?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(n.listFilter||pa),{key:1})):l.createCommentVNode("",!0),(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(((c=(a=(r=l.unref(t))==null?void 0:r.state)==null?void 0:a.data)==null?void 0:c.result)||[],d=>l.renderSlot(s.$slots,"list-item-display",{item:d})),256))],64)):(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[(l.openBlock(),l.createBlock(l.resolveDynamicComponent(n.listHeader||$p))),(l.openBlock(),l.createBlock(l.resolveDynamicComponent(n.listFilter||pa))),n.showAddButton?(l.openBlock(),l.createBlock(ga,{key:0})):l.createCommentVNode("",!0),(l.openBlock(),l.createBlock(l.resolveDynamicComponent(n.listDisplay||Pp),l.normalizeProps(l.guardReactiveProps({listItemDisplay:n.listItemDisplay})),null,16)),(l.openBlock(),l.createBlock(l.resolveDynamicComponent(n.listPagination||ig))),(l.openBlock(),l.createBlock(l.resolveDynamicComponent(n.listFooter||Ap)))],64))}}},og={install(n,t){n.component("CSEntityGrid",Ir),n.component("csentitygrid",Ir),n.component("CSEntityList",ya),n.component("csentitylist",ya),n.component("CSEntityBarChart",la),n.component("csentitybarchart",la),n.component("CSEntityLineChart",ca),n.component("csentitylinechart",ca),n.component("CSEntityPieChart",da),n.component("csentitypiechart",da),n.component("CSEntityPolarChart",ua),n.component("csentitypolarchart",ua),n.component("CSEntityRadarChart",ha),n.component("csentityradarchart",ha),n.component("CSEntity360View",fa),n.component("csentity360view",fa)}},ba=6048e5,rg=864e5,_a=Symbol.for("constructDateFrom");function Ae(n,t){return typeof n=="function"?n(t):n&&typeof n=="object"&&_a in n?n[_a](t):n instanceof Date?new n.constructor(t):new Date(t)}function ne(n,t){return Ae(t||n,n)}let ag={};function Wi(){return ag}function qn(n,t){var a,c,d,u;const e=Wi(),i=(t==null?void 0:t.weekStartsOn)??((c=(a=t==null?void 0:t.locale)==null?void 0:a.options)==null?void 0:c.weekStartsOn)??e.weekStartsOn??((u=(d=e.locale)==null?void 0:d.options)==null?void 0:u.weekStartsOn)??0,s=ne(n,t==null?void 0:t.in),o=s.getDay(),r=(o<i?7:0)+o-i;return s.setDate(s.getDate()-r),s.setHours(0,0,0,0),s}function Hi(n,t){return qn(n,{...t,weekStartsOn:1})}function xa(n,t){const e=ne(n,t==null?void 0:t.in),i=e.getFullYear(),s=Ae(e,0);s.setFullYear(i+1,0,4),s.setHours(0,0,0,0);const o=Hi(s),r=Ae(e,0);r.setFullYear(i,0,4),r.setHours(0,0,0,0);const a=Hi(r);return e.getTime()>=o.getTime()?i+1:e.getTime()>=a.getTime()?i:i-1}function ka(n){const t=ne(n),e=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return e.setUTCFullYear(t.getFullYear()),+n-+e}function lg(n,...t){const e=Ae.bind(null,t.find(i=>typeof i=="object"));return t.map(e)}function Sa(n,t){const e=ne(n,t==null?void 0:t.in);return e.setHours(0,0,0,0),e}function cg(n,t,e){const[i,s]=lg(e==null?void 0:e.in,n,t),o=Sa(i),r=Sa(s),a=+o-ka(o),c=+r-ka(r);return Math.round((a-c)/rg)}function dg(n,t){const e=xa(n,t),i=Ae(n,0);return i.setFullYear(e,0,4),i.setHours(0,0,0,0),Hi(i)}function ug(n){return n instanceof Date||typeof n=="object"&&Object.prototype.toString.call(n)==="[object Date]"}function hg(n){return!(!ug(n)&&typeof n!="number"||isNaN(+ne(n)))}function fg(n,t){const e=ne(n,t==null?void 0:t.in);return e.setFullYear(e.getFullYear(),0,1),e.setHours(0,0,0,0),e}const mg={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},pg=(n,t,e)=>{let i;const s=mg[n];return typeof s=="string"?i=s:t===1?i=s.one:i=s.other.replace("{{count}}",t.toString()),e!=null&&e.addSuffix?e.comparison&&e.comparison>0?"in "+i:i+" ago":i};function Gs(n){return(t={})=>{const e=t.width?String(t.width):n.defaultWidth;return n.formats[e]||n.formats[n.defaultWidth]}}const gg={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},yg={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},bg={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},_g={date:Gs({formats:gg,defaultWidth:"full"}),time:Gs({formats:yg,defaultWidth:"full"}),dateTime:Gs({formats:bg,defaultWidth:"full"})},xg={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},kg=(n,t,e,i)=>xg[n];function Yn(n){return(t,e)=>{const i=e!=null&&e.context?String(e.context):"standalone";let s;if(i==="formatting"&&n.formattingValues){const r=n.defaultFormattingWidth||n.defaultWidth,a=e!=null&&e.width?String(e.width):r;s=n.formattingValues[a]||n.formattingValues[r]}else{const r=n.defaultWidth,a=e!=null&&e.width?String(e.width):n.defaultWidth;s=n.values[a]||n.values[r]}const o=n.argumentCallback?n.argumentCallback(t):t;return s[o]}}const Sg={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},wg={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Eg={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},vg={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Cg={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Og={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},Dg={ordinalNumber:(n,t)=>{const e=Number(n),i=e%100;if(i>20||i<10)switch(i%10){case 1:return e+"st";case 2:return e+"nd";case 3:return e+"rd"}return e+"th"},era:Yn({values:Sg,defaultWidth:"wide"}),quarter:Yn({values:wg,defaultWidth:"wide",argumentCallback:n=>n-1}),month:Yn({values:Eg,defaultWidth:"wide"}),day:Yn({values:vg,defaultWidth:"wide"}),dayPeriod:Yn({values:Cg,defaultWidth:"wide",formattingValues:Og,defaultFormattingWidth:"wide"})};function Kn(n){return(t,e={})=>{const i=e.width,s=i&&n.matchPatterns[i]||n.matchPatterns[n.defaultMatchWidth],o=t.match(s);if(!o)return null;const r=o[0],a=i&&n.parsePatterns[i]||n.parsePatterns[n.defaultParseWidth],c=Array.isArray(a)?Tg(a,h=>h.test(r)):Ng(a,h=>h.test(r));let d;d=n.valueCallback?n.valueCallback(c):c,d=e.valueCallback?e.valueCallback(d):d;const u=t.slice(r.length);return{value:d,rest:u}}}function Ng(n,t){for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)&&t(n[e]))return e}function Tg(n,t){for(let e=0;e<n.length;e++)if(t(n[e]))return e}function Pg(n){return(t,e={})=>{const i=t.match(n.matchPattern);if(!i)return null;const s=i[0],o=t.match(n.parsePattern);if(!o)return null;let r=n.valueCallback?n.valueCallback(o[0]):o[0];r=e.valueCallback?e.valueCallback(r):r;const a=t.slice(s.length);return{value:r,rest:a}}}const Mg=/^(\d+)(th|st|nd|rd)?/i,Vg=/\d+/i,Ag={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Fg={any:[/^b/i,/^(a|c)/i]},Bg={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},$g={any:[/1/i,/2/i,/3/i,/4/i]},Rg={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Lg={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Ig={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},jg={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},zg={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Wg={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Hg={ordinalNumber:Pg({matchPattern:Mg,parsePattern:Vg,valueCallback:n=>parseInt(n,10)}),era:Kn({matchPatterns:Ag,defaultMatchWidth:"wide",parsePatterns:Fg,defaultParseWidth:"any"}),quarter:Kn({matchPatterns:Bg,defaultMatchWidth:"wide",parsePatterns:$g,defaultParseWidth:"any",valueCallback:n=>n+1}),month:Kn({matchPatterns:Rg,defaultMatchWidth:"wide",parsePatterns:Lg,defaultParseWidth:"any"}),day:Kn({matchPatterns:Ig,defaultMatchWidth:"wide",parsePatterns:jg,defaultParseWidth:"any"}),dayPeriod:Kn({matchPatterns:zg,defaultMatchWidth:"any",parsePatterns:Wg,defaultParseWidth:"any"})},Ug={code:"en-US",formatDistance:pg,formatLong:_g,formatRelative:kg,localize:Dg,match:Hg,options:{weekStartsOn:0,firstWeekContainsDate:1}};function qg(n,t){const e=ne(n,t==null?void 0:t.in);return cg(e,fg(e))+1}function Yg(n,t){const e=ne(n,t==null?void 0:t.in),i=+Hi(e)-+dg(e);return Math.round(i/ba)+1}function wa(n,t){var u,h,f,m;const e=ne(n,t==null?void 0:t.in),i=e.getFullYear(),s=Wi(),o=(t==null?void 0:t.firstWeekContainsDate)??((h=(u=t==null?void 0:t.locale)==null?void 0:u.options)==null?void 0:h.firstWeekContainsDate)??s.firstWeekContainsDate??((m=(f=s.locale)==null?void 0:f.options)==null?void 0:m.firstWeekContainsDate)??1,r=Ae((t==null?void 0:t.in)||n,0);r.setFullYear(i+1,0,o),r.setHours(0,0,0,0);const a=qn(r,t),c=Ae((t==null?void 0:t.in)||n,0);c.setFullYear(i,0,o),c.setHours(0,0,0,0);const d=qn(c,t);return+e>=+a?i+1:+e>=+d?i:i-1}function Kg(n,t){var a,c,d,u;const e=Wi(),i=(t==null?void 0:t.firstWeekContainsDate)??((c=(a=t==null?void 0:t.locale)==null?void 0:a.options)==null?void 0:c.firstWeekContainsDate)??e.firstWeekContainsDate??((u=(d=e.locale)==null?void 0:d.options)==null?void 0:u.firstWeekContainsDate)??1,s=wa(n,t),o=Ae((t==null?void 0:t.in)||n,0);return o.setFullYear(s,0,i),o.setHours(0,0,0,0),qn(o,t)}function Xg(n,t){const e=ne(n,t==null?void 0:t.in),i=+qn(e,t)-+Kg(e,t);return Math.round(i/ba)+1}function at(n,t){const e=n<0?"-":"",i=Math.abs(n).toString().padStart(t,"0");return e+i}const Fe={y(n,t){const e=n.getFullYear(),i=e>0?e:1-e;return at(t==="yy"?i%100:i,t.length)},M(n,t){const e=n.getMonth();return t==="M"?String(e+1):at(e+1,2)},d(n,t){return at(n.getDate(),t.length)},a(n,t){const e=n.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return e.toUpperCase();case"aaa":return e;case"aaaaa":return e[0];case"aaaa":default:return e==="am"?"a.m.":"p.m."}},h(n,t){return at(n.getHours()%12||12,t.length)},H(n,t){return at(n.getHours(),t.length)},m(n,t){return at(n.getMinutes(),t.length)},s(n,t){return at(n.getSeconds(),t.length)},S(n,t){const e=t.length,i=n.getMilliseconds(),s=Math.trunc(i*Math.pow(10,e-3));return at(s,t.length)}},yn={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Ea={G:function(n,t,e){const i=n.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return e.era(i,{width:"abbreviated"});case"GGGGG":return e.era(i,{width:"narrow"});case"GGGG":default:return e.era(i,{width:"wide"})}},y:function(n,t,e){if(t==="yo"){const i=n.getFullYear(),s=i>0?i:1-i;return e.ordinalNumber(s,{unit:"year"})}return Fe.y(n,t)},Y:function(n,t,e,i){const s=wa(n,i),o=s>0?s:1-s;if(t==="YY"){const r=o%100;return at(r,2)}return t==="Yo"?e.ordinalNumber(o,{unit:"year"}):at(o,t.length)},R:function(n,t){const e=xa(n);return at(e,t.length)},u:function(n,t){const e=n.getFullYear();return at(e,t.length)},Q:function(n,t,e){const i=Math.ceil((n.getMonth()+1)/3);switch(t){case"Q":return String(i);case"QQ":return at(i,2);case"Qo":return e.ordinalNumber(i,{unit:"quarter"});case"QQQ":return e.quarter(i,{width:"abbreviated",context:"formatting"});case"QQQQQ":return e.quarter(i,{width:"narrow",context:"formatting"});case"QQQQ":default:return e.quarter(i,{width:"wide",context:"formatting"})}},q:function(n,t,e){const i=Math.ceil((n.getMonth()+1)/3);switch(t){case"q":return String(i);case"qq":return at(i,2);case"qo":return e.ordinalNumber(i,{unit:"quarter"});case"qqq":return e.quarter(i,{width:"abbreviated",context:"standalone"});case"qqqqq":return e.quarter(i,{width:"narrow",context:"standalone"});case"qqqq":default:return e.quarter(i,{width:"wide",context:"standalone"})}},M:function(n,t,e){const i=n.getMonth();switch(t){case"M":case"MM":return Fe.M(n,t);case"Mo":return e.ordinalNumber(i+1,{unit:"month"});case"MMM":return e.month(i,{width:"abbreviated",context:"formatting"});case"MMMMM":return e.month(i,{width:"narrow",context:"formatting"});case"MMMM":default:return e.month(i,{width:"wide",context:"formatting"})}},L:function(n,t,e){const i=n.getMonth();switch(t){case"L":return String(i+1);case"LL":return at(i+1,2);case"Lo":return e.ordinalNumber(i+1,{unit:"month"});case"LLL":return e.month(i,{width:"abbreviated",context:"standalone"});case"LLLLL":return e.month(i,{width:"narrow",context:"standalone"});case"LLLL":default:return e.month(i,{width:"wide",context:"standalone"})}},w:function(n,t,e,i){const s=Xg(n,i);return t==="wo"?e.ordinalNumber(s,{unit:"week"}):at(s,t.length)},I:function(n,t,e){const i=Yg(n);return t==="Io"?e.ordinalNumber(i,{unit:"week"}):at(i,t.length)},d:function(n,t,e){return t==="do"?e.ordinalNumber(n.getDate(),{unit:"date"}):Fe.d(n,t)},D:function(n,t,e){const i=qg(n);return t==="Do"?e.ordinalNumber(i,{unit:"dayOfYear"}):at(i,t.length)},E:function(n,t,e){const i=n.getDay();switch(t){case"E":case"EE":case"EEE":return e.day(i,{width:"abbreviated",context:"formatting"});case"EEEEE":return e.day(i,{width:"narrow",context:"formatting"});case"EEEEEE":return e.day(i,{width:"short",context:"formatting"});case"EEEE":default:return e.day(i,{width:"wide",context:"formatting"})}},e:function(n,t,e,i){const s=n.getDay(),o=(s-i.weekStartsOn+8)%7||7;switch(t){case"e":return String(o);case"ee":return at(o,2);case"eo":return e.ordinalNumber(o,{unit:"day"});case"eee":return e.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return e.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return e.day(s,{width:"short",context:"formatting"});case"eeee":default:return e.day(s,{width:"wide",context:"formatting"})}},c:function(n,t,e,i){const s=n.getDay(),o=(s-i.weekStartsOn+8)%7||7;switch(t){case"c":return String(o);case"cc":return at(o,t.length);case"co":return e.ordinalNumber(o,{unit:"day"});case"ccc":return e.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return e.day(s,{width:"narrow",context:"standalone"});case"cccccc":return e.day(s,{width:"short",context:"standalone"});case"cccc":default:return e.day(s,{width:"wide",context:"standalone"})}},i:function(n,t,e){const i=n.getDay(),s=i===0?7:i;switch(t){case"i":return String(s);case"ii":return at(s,t.length);case"io":return e.ordinalNumber(s,{unit:"day"});case"iii":return e.day(i,{width:"abbreviated",context:"formatting"});case"iiiii":return e.day(i,{width:"narrow",context:"formatting"});case"iiiiii":return e.day(i,{width:"short",context:"formatting"});case"iiii":default:return e.day(i,{width:"wide",context:"formatting"})}},a:function(n,t,e){const s=n.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return e.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return e.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return e.dayPeriod(s,{width:"narrow",context:"formatting"});case"aaaa":default:return e.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(n,t,e){const i=n.getHours();let s;switch(i===12?s=yn.noon:i===0?s=yn.midnight:s=i/12>=1?"pm":"am",t){case"b":case"bb":return e.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return e.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return e.dayPeriod(s,{width:"narrow",context:"formatting"});case"bbbb":default:return e.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(n,t,e){const i=n.getHours();let s;switch(i>=17?s=yn.evening:i>=12?s=yn.afternoon:i>=4?s=yn.morning:s=yn.night,t){case"B":case"BB":case"BBB":return e.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return e.dayPeriod(s,{width:"narrow",context:"formatting"});case"BBBB":default:return e.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(n,t,e){if(t==="ho"){let i=n.getHours()%12;return i===0&&(i=12),e.ordinalNumber(i,{unit:"hour"})}return Fe.h(n,t)},H:function(n,t,e){return t==="Ho"?e.ordinalNumber(n.getHours(),{unit:"hour"}):Fe.H(n,t)},K:function(n,t,e){const i=n.getHours()%12;return t==="Ko"?e.ordinalNumber(i,{unit:"hour"}):at(i,t.length)},k:function(n,t,e){let i=n.getHours();return i===0&&(i=24),t==="ko"?e.ordinalNumber(i,{unit:"hour"}):at(i,t.length)},m:function(n,t,e){return t==="mo"?e.ordinalNumber(n.getMinutes(),{unit:"minute"}):Fe.m(n,t)},s:function(n,t,e){return t==="so"?e.ordinalNumber(n.getSeconds(),{unit:"second"}):Fe.s(n,t)},S:function(n,t){return Fe.S(n,t)},X:function(n,t,e){const i=n.getTimezoneOffset();if(i===0)return"Z";switch(t){case"X":return Ca(i);case"XXXX":case"XX":return Ge(i);case"XXXXX":case"XXX":default:return Ge(i,":")}},x:function(n,t,e){const i=n.getTimezoneOffset();switch(t){case"x":return Ca(i);case"xxxx":case"xx":return Ge(i);case"xxxxx":case"xxx":default:return Ge(i,":")}},O:function(n,t,e){const i=n.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+va(i,":");case"OOOO":default:return"GMT"+Ge(i,":")}},z:function(n,t,e){const i=n.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+va(i,":");case"zzzz":default:return"GMT"+Ge(i,":")}},t:function(n,t,e){const i=Math.trunc(+n/1e3);return at(i,t.length)},T:function(n,t,e){return at(+n,t.length)}};function va(n,t=""){const e=n>0?"-":"+",i=Math.abs(n),s=Math.trunc(i/60),o=i%60;return o===0?e+String(s):e+String(s)+t+at(o,2)}function Ca(n,t){return n%60===0?(n>0?"-":"+")+at(Math.abs(n)/60,2):Ge(n,t)}function Ge(n,t=""){const e=n>0?"-":"+",i=Math.abs(n),s=at(Math.trunc(i/60),2),o=at(i%60,2);return e+s+t+o}const Oa=(n,t)=>{switch(n){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},Da=(n,t)=>{switch(n){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},Gg={p:Da,P:(n,t)=>{const e=n.match(/(P+)(p+)?/)||[],i=e[1],s=e[2];if(!s)return Oa(n,t);let o;switch(i){case"P":o=t.dateTime({width:"short"});break;case"PP":o=t.dateTime({width:"medium"});break;case"PPP":o=t.dateTime({width:"long"});break;case"PPPP":default:o=t.dateTime({width:"full"});break}return o.replace("{{date}}",Oa(i,t)).replace("{{time}}",Da(s,t))}},Qg=/^D+$/,Jg=/^Y+$/,Zg=["D","DD","YY","YYYY"];function ty(n){return Qg.test(n)}function ey(n){return Jg.test(n)}function ny(n,t,e){const i=iy(n,t,e);if(console.warn(i),Zg.includes(n))throw new RangeError(i)}function iy(n,t,e){const i=n[0]==="Y"?"years":"days of the month";return`Use \`${n.toLowerCase()}\` instead of \`${n}\` (in \`${t}\`) for formatting ${i} to the input \`${e}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const sy=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,oy=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,ry=/^'([^]*?)'?$/,ay=/''/g,ly=/[a-zA-Z]/;function Na(n,t,e){var u,h,f,m;const i=Wi(),s=i.locale??Ug,o=i.firstWeekContainsDate??((h=(u=i.locale)==null?void 0:u.options)==null?void 0:h.firstWeekContainsDate)??1,r=i.weekStartsOn??((m=(f=i.locale)==null?void 0:f.options)==null?void 0:m.weekStartsOn)??0,a=ne(n,e==null?void 0:e.in);if(!hg(a))throw new RangeError("Invalid time value");let c=t.match(oy).map(p=>{const g=p[0];if(g==="p"||g==="P"){const y=Gg[g];return y(p,s.formatLong)}return p}).join("").match(sy).map(p=>{if(p==="''")return{isToken:!1,value:"'"};const g=p[0];if(g==="'")return{isToken:!1,value:cy(p)};if(Ea[g])return{isToken:!0,value:p};if(g.match(ly))throw new RangeError("Format string contains an unescaped latin alphabet character `"+g+"`");return{isToken:!1,value:p}});s.localize.preprocessor&&(c=s.localize.preprocessor(a,c));const d={firstWeekContainsDate:o,weekStartsOn:r,locale:s};return c.map(p=>{if(!p.isToken)return p.value;const g=p.value;(ey(g)||ty(g))&&ny(g,t,String(n));const y=Ea[g[0]];return y(a,g,s.localize,d)}).join("")}function cy(n){const t=n.match(ry);return t?t[1].replace(ay,"'"):n}const dy=Object.freeze(Object.defineProperty({__proto__:null,default:{beforeMount(n,t){const{value:e,arg:i}=t;if(n&&e){const s=Na(new Date(e),i||"yyyy-MM-dd");n.textContent=s}},updated(n,t){const{value:e,arg:i}=t;if(n&&e){const s=Na(new Date(e),i||"yyyy-MM-dd");n.textContent=s}}}},Symbol.toStringTag,{value:"Module"})),uy=Object.freeze(Object.defineProperty({__proto__:null,default:{beforeMount(n,t){const{value:e,arg:i}=t;e&&(n.textContent=n.textContent.toUpperCase())},updated(n,t){const{value:e,arg:i}=t;e&&(n.textContent=n.textContent.toUpperCase())}}},Symbol.toStringTag,{value:"Module"}));/*!
|
|
155
|
+
`)},Gh={},Qh={},xe={name:"base",css:Xh,theme:Kh,classes:Gh,inlineStyles:Qh,load:function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:function(o){return o},s=i(Zt(t,{dt:Fn}));return bt(s)?Ih(Bn(s),Qs({name:this.name},e)):{}},loadCSS:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return this.load(this.css,t)},loadTheme:function(){var t=this,e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return this.load(this.theme,e,function(){var s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return Ct.transformCSS(e.name||t.name,"".concat(s).concat(i))})},getCommonTheme:function(t){return Ct.getCommon(this.name,t)},getComponentTheme:function(t){return Ct.getComponent(this.name,t)},getDirectiveTheme:function(t){return Ct.getDirective(this.name,t)},getPresetTheme:function(t,e,i){return Ct.getCustomPreset(this.name,t,e,i)},getLayerOrderThemeCSS:function(){return Ct.getLayerOrderCSS(this.name)},getStyleSheet:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.css){var i=Zt(this.css,{dt:Fn})||"",s=Bn("".concat(i).concat(t)),o=Object.entries(e).reduce(function(r,l){var c=Zr(l,2),d=c[0],u=c[1];return r.push("".concat(d,'="').concat(u,'"'))&&r},[]).join(" ");return bt(s)?'<style type="text/css" data-primevue-style-id="'.concat(this.name,'" ').concat(o,">").concat(s,"</style>"):""}return""},getCommonThemeStyleSheet:function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Ct.getCommonStyleSheet(this.name,t,e)},getThemeStyleSheet:function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=[Ct.getStyleSheet(this.name,t,e)];if(this.theme){var s=this.name==="base"?"global-style":"".concat(this.name,"-style"),o=Zt(this.theme,{dt:Fn}),r=Bn(Ct.transformCSS(s,o)),l=Object.entries(e).reduce(function(c,d){var u=Zr(d,2),h=u[0],f=u[1];return c.push("".concat(h,'="').concat(f,'"'))&&c},[]).join(" ");bt(r)&&i.push('<style type="text/css" data-primevue-style-id="'.concat(s,'" ').concat(l,">").concat(r,"</style>"))}return i.join("")},extend:function(t){return Qs(Qs({},this),{},{css:void 0,theme:void 0},t)}},na=xe.extend({name:"common"});function In(n){"@babel/helpers - typeof";return In=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},In(n)}function Jh(n){return ra(n)||Zh(n)||sa(n)||ia()}function Zh(n){if(typeof Symbol<"u"&&n[Symbol.iterator]!=null||n["@@iterator"]!=null)return Array.from(n)}function jn(n,t){return ra(n)||tf(n,t)||sa(n,t)||ia()}function ia(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
156
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function sa(n,t){if(n){if(typeof n=="string")return oa(n,t);var e={}.toString.call(n).slice(8,-1);return e==="Object"&&n.constructor&&(e=n.constructor.name),e==="Map"||e==="Set"?Array.from(n):e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?oa(n,t):void 0}}function oa(n,t){(t==null||t>n.length)&&(t=n.length);for(var e=0,i=Array(t);e<t;e++)i[e]=n[e];return i}function tf(n,t){var e=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(e!=null){var i,s,o,r,l=[],c=!0,d=!1;try{if(o=(e=e.call(n)).next,t===0){if(Object(e)!==e)return;c=!1}else for(;!(c=(i=o.call(e)).done)&&(l.push(i.value),l.length!==t);c=!0);}catch(u){d=!0,s=u}finally{try{if(!c&&e.return!=null&&(r=e.return(),Object(r)!==r))return}finally{if(d)throw s}}return l}}function ra(n){if(Array.isArray(n))return n}function aa(n,t){var e=Object.keys(n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);t&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(n,s).enumerable})),e.push.apply(e,i)}return e}function tt(n){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?aa(Object(e),!0).forEach(function(i){zn(n,i,e[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(e)):aa(Object(e)).forEach(function(i){Object.defineProperty(n,i,Object.getOwnPropertyDescriptor(e,i))})}return n}function zn(n,t,e){return(t=ef(t))in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}function ef(n){var t=nf(n,"string");return In(t)=="symbol"?t:t+""}function nf(n,t){if(In(n)!="object"||!n)return n;var e=n[Symbol.toPrimitive];if(e!==void 0){var i=e.call(n,t||"default");if(In(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(n)}var sf={name:"BaseComponent",props:{pt:{type:Object,default:void 0},ptOptions:{type:Object,default:void 0},unstyled:{type:Boolean,default:void 0},dt:{type:Object,default:void 0}},inject:{$parentInstance:{default:void 0}},watch:{isUnstyled:{immediate:!0,handler:function(t){t||(this._loadCoreStyles(),this._themeChangeListener(this._loadCoreStyles))}},dt:{immediate:!0,handler:function(t){var e=this;t?(this._loadScopedThemeStyles(t),this._themeChangeListener(function(){return e._loadScopedThemeStyles(t)})):this._unloadScopedThemeStyles()}}},scopedStyleEl:void 0,rootEl:void 0,$attrSelector:void 0,beforeCreate:function(){var t,e,i,s,o,r,l,c,d,u,h,f=(t=this.pt)===null||t===void 0?void 0:t._usept,m=f?(e=this.pt)===null||e===void 0||(e=e.originalValue)===null||e===void 0?void 0:e[this.$.type.name]:void 0,p=f?(i=this.pt)===null||i===void 0||(i=i.value)===null||i===void 0?void 0:i[this.$.type.name]:this.pt;(s=p||m)===null||s===void 0||(s=s.hooks)===null||s===void 0||(o=s.onBeforeCreate)===null||o===void 0||o.call(s);var g=(r=this.$primevueConfig)===null||r===void 0||(r=r.pt)===null||r===void 0?void 0:r._usept,y=g?(l=this.$primevue)===null||l===void 0||(l=l.config)===null||l===void 0||(l=l.pt)===null||l===void 0?void 0:l.originalValue:void 0,b=g?(c=this.$primevue)===null||c===void 0||(c=c.config)===null||c===void 0||(c=c.pt)===null||c===void 0?void 0:c.value:(d=this.$primevue)===null||d===void 0||(d=d.config)===null||d===void 0?void 0:d.pt;(u=b||y)===null||u===void 0||(u=u[this.$.type.name])===null||u===void 0||(u=u.hooks)===null||u===void 0||(h=u.onBeforeCreate)===null||h===void 0||h.call(u),this.$attrSelector=Ah("pc")},created:function(){this._hook("onCreated")},beforeMount:function(){this.rootEl=Th(this.$el,'[data-pc-name="'.concat(Me(this.$.type.name),'"]')),this.rootEl&&(this.$attrSelector&&!this.rootEl.hasAttribute(this.$attrSelector)&&this.rootEl.setAttribute(this.$attrSelector,""),this.rootEl.$pc=tt({name:this.$.type.name,attrSelector:this.$attrSelector},this.$params)),this._loadStyles(),this._hook("onBeforeMount")},mounted:function(){this._hook("onMounted")},beforeUpdate:function(){this._hook("onBeforeUpdate")},updated:function(){this._hook("onUpdated")},beforeUnmount:function(){this._hook("onBeforeUnmount")},unmounted:function(){this._unloadScopedThemeStyles(),this._hook("onUnmounted")},methods:{_hook:function(t){if(!this.$options.hostName){var e=this._usePT(this._getPT(this.pt,this.$.type.name),this._getOptionValue,"hooks.".concat(t)),i=this._useDefaultPT(this._getOptionValue,"hooks.".concat(t));e==null||e(),i==null||i()}},_mergeProps:function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),s=1;s<e;s++)i[s-1]=arguments[s];return Rr(t)?t.apply(void 0,i):a.mergeProps.apply(void 0,i)},_loadStyles:function(){var t=this,e=function(){$n.isStyleNameLoaded("base")||(xe.loadCSS(t.$styleOptions),t._loadGlobalStyles(),$n.setLoadedStyleName("base")),t._loadThemeStyles()};e(),this._themeChangeListener(e)},_loadCoreStyles:function(){var t,e;!$n.isStyleNameLoaded((t=this.$style)===null||t===void 0?void 0:t.name)&&(e=this.$style)!==null&&e!==void 0&&e.name&&(na.loadCSS(this.$styleOptions),this.$options.style&&this.$style.loadCSS(this.$styleOptions),$n.setLoadedStyleName(this.$style.name))},_loadGlobalStyles:function(){var t=this._useGlobalPT(this._getOptionValue,"global.css",this.$params);bt(t)&&xe.load(t,tt({name:"global"},this.$styleOptions))},_loadThemeStyles:function(){var t,e;if(!(this.isUnstyled||this.$theme==="none")){if(!Ct.isStyleNameLoaded("common")){var i,s,o=((i=this.$style)===null||i===void 0||(s=i.getCommonTheme)===null||s===void 0?void 0:s.call(i))||{},r=o.primitive,l=o.semantic,c=o.global,d=o.style;xe.load(r==null?void 0:r.css,tt({name:"primitive-variables"},this.$styleOptions)),xe.load(l==null?void 0:l.css,tt({name:"semantic-variables"},this.$styleOptions)),xe.load(c==null?void 0:c.css,tt({name:"global-variables"},this.$styleOptions)),xe.loadTheme(tt({name:"global-style"},this.$styleOptions),d),Ct.setLoadedStyleName("common")}if(!Ct.isStyleNameLoaded((t=this.$style)===null||t===void 0?void 0:t.name)&&(e=this.$style)!==null&&e!==void 0&&e.name){var u,h,f,m,p=((u=this.$style)===null||u===void 0||(h=u.getComponentTheme)===null||h===void 0?void 0:h.call(u))||{},g=p.css,y=p.style;(f=this.$style)===null||f===void 0||f.load(g,tt({name:"".concat(this.$style.name,"-variables")},this.$styleOptions)),(m=this.$style)===null||m===void 0||m.loadTheme(tt({name:"".concat(this.$style.name,"-style")},this.$styleOptions),y),Ct.setLoadedStyleName(this.$style.name)}if(!Ct.isStyleNameLoaded("layer-order")){var b,_,w=(b=this.$style)===null||b===void 0||(_=b.getLayerOrderThemeCSS)===null||_===void 0?void 0:_.call(b);xe.load(w,tt({name:"layer-order",first:!0},this.$styleOptions)),Ct.setLoadedStyleName("layer-order")}}},_loadScopedThemeStyles:function(t){var e,i,s,o=((e=this.$style)===null||e===void 0||(i=e.getPresetTheme)===null||i===void 0?void 0:i.call(e,t,"[".concat(this.$attrSelector,"]")))||{},r=o.css,l=(s=this.$style)===null||s===void 0?void 0:s.load(r,tt({name:"".concat(this.$attrSelector,"-").concat(this.$style.name)},this.$styleOptions));this.scopedStyleEl=l.el},_unloadScopedThemeStyles:function(){var t;(t=this.scopedStyleEl)===null||t===void 0||(t=t.value)===null||t===void 0||t.remove()},_themeChangeListener:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(){};$n.clearLoadedStyleNames(),Ve.on("theme:change",t)},_getHostInstance:function(t){return t?this.$options.hostName?t.$.type.name===this.$options.hostName?t:this._getHostInstance(t.$parentInstance):t.$parentInstance:void 0},_getPropValue:function(t){var e;return this[t]||((e=this._getHostInstance(this))===null||e===void 0?void 0:e[t])},_getOptionValue:function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return Lr(t,e,i)},_getPTValue:function(){var t,e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,r=/./g.test(i)&&!!s[i.split(".")[0]],l=this._getPropValue("ptOptions")||((t=this.$primevueConfig)===null||t===void 0?void 0:t.ptOptions)||{},c=l.mergeSections,d=c===void 0?!0:c,u=l.mergeProps,h=u===void 0?!1:u,f=o?r?this._useGlobalPT(this._getPTClassValue,i,s):this._useDefaultPT(this._getPTClassValue,i,s):void 0,m=r?void 0:this._getPTSelf(e,this._getPTClassValue,i,tt(tt({},s),{},{global:f||{}})),p=this._getPTDatasets(i);return d||!d&&m?h?this._mergeProps(h,f,m,p):tt(tt(tt({},f),m),p):tt(tt({},m),p)},_getPTSelf:function(){for(var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=arguments.length,i=new Array(e>1?e-1:0),s=1;s<e;s++)i[s-1]=arguments[s];return a.mergeProps(this._usePT.apply(this,[this._getPT(t,this.$name)].concat(i)),this._usePT.apply(this,[this.$_attrsPT].concat(i)))},_getPTDatasets:function(){var t,e,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",s="data-pc-",o=i==="root"&&bt((t=this.pt)===null||t===void 0?void 0:t["data-pc-section"]);return i!=="transition"&&tt(tt({},i==="root"&&tt(tt(zn({},"".concat(s,"name"),Me(o?(e=this.pt)===null||e===void 0?void 0:e["data-pc-section"]:this.$.type.name)),o&&zn({},"".concat(s,"extend"),Me(this.$.type.name))),Gr()&&zn({},"".concat(this.$attrSelector),""))),{},zn({},"".concat(s,"section"),Me(i)))},_getPTClassValue:function(){var t=this._getOptionValue.apply(this,arguments);return ce(t)||Us(t)?{class:t}:t},_getPT:function(t){var e=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",s=arguments.length>2?arguments[2]:void 0,o=function(l){var c,d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,u=s?s(l):l,h=Me(i),f=Me(e.$name);return(c=d?h!==f?u==null?void 0:u[h]:void 0:u==null?void 0:u[h])!==null&&c!==void 0?c:u};return t!=null&&t.hasOwnProperty("_usept")?{_usept:t._usept,originalValue:o(t.originalValue),value:o(t.value)}:o(t,!0)},_usePT:function(t,e,i,s){var o=function(g){return e(g,i,s)};if(t!=null&&t.hasOwnProperty("_usept")){var r,l=t._usept||((r=this.$primevueConfig)===null||r===void 0?void 0:r.ptOptions)||{},c=l.mergeSections,d=c===void 0?!0:c,u=l.mergeProps,h=u===void 0?!1:u,f=o(t.originalValue),m=o(t.value);return f===void 0&&m===void 0?void 0:ce(m)?m:ce(f)?f:d||!d&&m?h?this._mergeProps(h,f,m):tt(tt({},f),m):m}return o(t)},_useGlobalPT:function(t,e,i){return this._usePT(this.globalPT,t,e,i)},_useDefaultPT:function(t,e,i){return this._usePT(this.defaultPT,t,e,i)},ptm:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this._getPTValue(this.pt,t,tt(tt({},this.$params),e))},ptmi:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return a.mergeProps(this.$_attrsWithoutPT,this.ptm(t,e))},ptmo:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this._getPTValue(t,e,tt({instance:this},i),!1)},cx:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.isUnstyled?void 0:this._getOptionValue(this.$style.classes,t,tt(tt({},this.$params),e))},sx:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(e){var s=this._getOptionValue(this.$style.inlineStyles,t,tt(tt({},this.$params),i)),o=this._getOptionValue(na.inlineStyles,t,tt(tt({},this.$params),i));return[o,s]}}},computed:{globalPT:function(){var t,e=this;return this._getPT((t=this.$primevueConfig)===null||t===void 0?void 0:t.pt,void 0,function(i){return Zt(i,{instance:e})})},defaultPT:function(){var t,e=this;return this._getPT((t=this.$primevueConfig)===null||t===void 0?void 0:t.pt,void 0,function(i){return e._getOptionValue(i,e.$name,tt({},e.$params))||Zt(i,tt({},e.$params))})},isUnstyled:function(){var t;return this.unstyled!==void 0?this.unstyled:(t=this.$primevueConfig)===null||t===void 0?void 0:t.unstyled},$inProps:function(){var t,e=Object.keys(((t=this.$.vnode)===null||t===void 0?void 0:t.props)||{});return Object.fromEntries(Object.entries(this.$props).filter(function(i){var s=jn(i,1),o=s[0];return e==null?void 0:e.includes(o)}))},$theme:function(){var t;return(t=this.$primevueConfig)===null||t===void 0?void 0:t.theme},$style:function(){return tt(tt({classes:void 0,inlineStyles:void 0,load:function(){},loadCSS:function(){},loadTheme:function(){}},(this._getHostInstance(this)||{}).$style),this.$options.style)},$styleOptions:function(){var t;return{nonce:(t=this.$primevueConfig)===null||t===void 0||(t=t.csp)===null||t===void 0?void 0:t.nonce}},$primevueConfig:function(){var t;return(t=this.$primevue)===null||t===void 0?void 0:t.config},$name:function(){return this.$options.hostName||this.$.type.name},$params:function(){var t=this._getHostInstance(this)||this.$parent;return{instance:this,props:this.$props,state:this.$data,attrs:this.$attrs,parent:{instance:t,props:t==null?void 0:t.$props,state:t==null?void 0:t.$data,attrs:t==null?void 0:t.$attrs}}},$_attrsPT:function(){return Object.entries(this.$attrs||{}).filter(function(t){var e=jn(t,1),i=e[0];return i==null?void 0:i.startsWith("pt:")}).reduce(function(t,e){var i=jn(e,2),s=i[0],o=i[1],r=s.split(":"),l=Jh(r),c=l.slice(1);return c==null||c.reduce(function(d,u,h,f){return!d[u]&&(d[u]=h===f.length-1?o:{}),d[u]},t),t},{})},$_attrsWithoutPT:function(){return Object.entries(this.$attrs||{}).filter(function(t){var e=jn(t,1),i=e[0];return!(i!=null&&i.startsWith("pt:"))}).reduce(function(t,e){var i=jn(e,2),s=i[0],o=i[1];return t[s]=o,t},{})}}},of={root:{position:"relative"}},rf={root:"p-chart"},af=xe.extend({name:"chart",classes:rf,inlineStyles:of}),lf={name:"BaseChart",extends:sf,props:{type:String,data:null,options:null,plugins:null,width:{type:Number,default:300},height:{type:Number,default:150},canvasProps:{type:null,default:null}},style:af,provide:function(){return{$pcChart:this,$parentInstance:this}}},la={name:"Chart",extends:lf,inheritAttrs:!1,emits:["select","loaded"],chart:null,watch:{data:{handler:function(){this.reinit()},deep:!0},type:function(){this.reinit()},options:function(){this.reinit()}},mounted:function(){this.initChart()},beforeUnmount:function(){this.chart&&(this.chart.destroy(),this.chart=null)},methods:{initChart:function(){var t=this;Promise.resolve().then(()=>fk).then(function(e){t.chart&&(t.chart.destroy(),t.chart=null),e&&e.default&&(t.chart=new e.default(t.$refs.canvas,{type:t.type,data:t.data,options:t.options,plugins:t.plugins})),t.$emit("loaded",t.chart)})},getCanvas:function(){return this.$canvas},getChart:function(){return this.chart},getBase64Image:function(){return this.chart.toBase64Image()},refresh:function(){this.chart&&this.chart.update()},reinit:function(){this.initChart()},onCanvasClick:function(t){if(this.chart){var e=this.chart.getElementsAtEventForMode(t,"nearest",{intersect:!0},!1),i=this.chart.getElementsAtEventForMode(t,"dataset",{intersect:!0},!1);e&&e[0]&&i&&this.$emit("select",{originalEvent:t,element:e[0],dataset:i})}},generateLegend:function(){if(this.chart)return this.chart.generateLegend()}}};function Wn(n){"@babel/helpers - typeof";return Wn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Wn(n)}function ca(n,t){var e=Object.keys(n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);t&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(n,s).enumerable})),e.push.apply(e,i)}return e}function da(n){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?ca(Object(e),!0).forEach(function(i){cf(n,i,e[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(e)):ca(Object(e)).forEach(function(i){Object.defineProperty(n,i,Object.getOwnPropertyDescriptor(e,i))})}return n}function cf(n,t,e){return(t=df(t))in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}function df(n){var t=uf(n,"string");return Wn(t)=="symbol"?t:t+""}function uf(n,t){if(Wn(n)!="object"||!n)return n;var e=n[Symbol.toPrimitive];if(e!==void 0){var i=e.call(n,t||"default");if(Wn(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(n)}var hf=["width","height"];function ff(n,t,e,i,s,o){return a.openBlock(),a.createElementBlock("div",a.mergeProps({class:n.cx("root"),style:n.sx("root")},n.ptmi("root")),[a.createElementVNode("canvas",a.mergeProps({ref:"canvas",width:n.width,height:n.height,onClick:t[0]||(t[0]=function(r){return o.onCanvasClick(r)})},da(da({},n.canvasProps),n.ptm("canvas"))),null,16,hf)],16)}la.render=ff;function mf(){const n={primary:"#0efcf1",primaryBorder:"#388E3C",secondary:"#0ec6fc",secondaryBorder:"#FBC02D",tertiary:"#f1fc0e",tertiaryBorder:"#FFA000"},t=["linear","easeInQuad","easeOutQuad","easeInOutQuad","easeInCubic","easeOutCubic","easeInOutCubic","easeInQuart","easeOutQuart","easeInOutQuart","easeInBounce","easeOutBounce","easeInOutBounce","easeInOutElastic"],e=a.ref("easeInOutElastic"),i=a.computed(()=>({responsive:!0,maintainAspectRatio:!0,plugins:{legend:{position:"top",labels:{font:{size:16}}},tooltip:{enabled:!0,titleFont:{size:14},bodyFont:{size:12}},zoom:{zoom:{wheel:{enabled:!0},drag:{enabled:!0},mode:"xy"},pan:{enabled:!0,mode:"xy"}}},scales:{x:{grid:{display:!1},ticks:{font:{size:14}}},y:{grid:{display:!0,color:"#e0e0e0"},ticks:{font:{size:14}}}},animation:{duration:2e3,easing:e.value,delay:500,loop:!1,animateRotate:!0,animateScale:!0},elements:{point:{radius:6,hoverRadius:10,backgroundColor:n.secondary},line:{tension:.4,borderWidth:2},bar:{borderWidth:2,borderRadius:4}}}));return{colorConfig:n,animationOptions:t,selectedAnimation:e,defaultChartOptions:i}}const pf={components:{Chart:la},props:{type:{type:String,required:!0},chartData:{type:Object,required:!0},chartOptions:{type:Object,default:()=>({})}},setup(n){const{colorConfig:t,defaultChartOptions:e}=mf(),i=a.computed(()=>{const o=n.chartData.datasets.map((r,l)=>{const c=Object.values(t);return{...r,backgroundColor:c[l%c.length],borderColor:c[l%c.length+1]}});return{...n.chartData,datasets:o}}),s=a.computed(()=>({...e.value,maintainAspectRatio:!0,...n.chartOptions}));return{computedChartData:i,computedChartOptions:s}}},gf={class:"chart-container"},yf={key:0},bf={key:1};function _f(n,t,e,i,s,o){const r=a.resolveComponent("Chart",!0);return a.openBlock(),a.createElementBlock("div",gf,[e.chartData?(a.openBlock(),a.createElementBlock("div",yf,[a.createVNode(r,{type:e.type,data:i.computedChartData,options:i.computedChartOptions},null,8,["type","data","options"])])):(a.openBlock(),a.createElementBlock("div",bf,t[0]||(t[0]=[a.createElementVNode("p",null,"No data available for the chart.",-1)])))])}const Hn=Ft(pf,[["render",_f],["__scopeId","data-v-8e3e786b"]]);function Un(){const n=a.ref(null),t=a.ref(!1),e=a.ref(null);return{chartData:n,fetchChartData:async({entityName:s,xaxis:o=null,yaxis:r=null})=>{t.value=!0,e.value=null;const l="https://mocki.io/v1/1ab17035-c115-4049-8ebf-a1e1b92d739a";try{const d=await(await fetch(l)).json();if(!d||!d.response||!d.response.result)throw new Error("Invalid data structure from API.");const u=d.response.result;if(!o&&!r){const h=Object.keys(u[0]);o=h[1],r=h.slice(4);const f=u.reduce((g,y)=>(r.forEach(b=>{g[b]||(g[b]=0),g[b]+=y[b]||0}),g),{}),m=Object.keys(f),p=Object.values(f);n.value={labels:m,datasets:[{label:"Default Data",data:p,borderWidth:1}]}}else{const h=u.map(p=>p[o]),m=(Array.isArray(r)?r:[r]).map(p=>({label:p,data:u.map(g=>g[p]||0),borderWidth:1}));n.value={labels:h,datasets:m}}}catch(c){e.value=c.message,n.value=null}finally{t.value=!1}},loading:t,error:e}}const xf={components:{chart:Hn},props:{entityName:{type:String,required:!0},title:{type:String,default:"Bar Chart"},yaxis:{type:String,required:!0},xaxis:{type:String,required:!0}},setup(n){const{chartData:t,fetchChartData:e,loading:i,error:s}=Un(),o=a.ref({responsive:!0,plugins:{legend:{position:"top"},tooltip:{callbacks:{label:function(l){return`${l.dataset.label}: ${l.raw}`}}}}}),r=async()=>{if(!n.yaxis||!n.xaxis){console.error("xaxis or yaxis is not defined."),s.value="x-axis or y-axis is not properly configured.";return}await e({entityName:n.entityName,yaxis:n.yaxis,xaxis:n.xaxis})};return a.onMounted(()=>{console.log("Fetching data for yAxis:",n.yaxis),console.log("Fetching data for xAxis:",n.xaxis),r()}),{chartData:t,chartOptions:o,loading:i,error:s}}},kf={key:0,class:"chart-container"},Sf={key:1},wf={key:0},Ef={key:1},Cf={key:2};function vf(n,t,e,i,s,o){const r=a.resolveComponent("chart");return a.openBlock(),a.createElementBlock("div",null,[a.createElementVNode("div",null,[a.createElementVNode("h2",null,"Entity name: "+a.toDisplayString(e.entityName),1)]),i.chartData?(a.openBlock(),a.createElementBlock("div",kf,[a.createElementVNode("h3",null,a.toDisplayString(e.title)+" , x-axis : "+a.toDisplayString(e.xaxis)+" , y-axis : "+a.toDisplayString(e.yaxis),1),a.createVNode(r,{type:"bar",chartData:i.chartData,chartOptions:i.chartOptions},null,8,["chartData","chartOptions"])])):(a.openBlock(),a.createElementBlock("div",Sf,[i.loading?(a.openBlock(),a.createElementBlock("p",wf,"Loading chart data...")):i.error?(a.openBlock(),a.createElementBlock("p",Ef,a.toDisplayString(i.error),1)):(a.openBlock(),a.createElementBlock("p",Cf,"No data available for the chart."))]))])}const ua=Ft(xf,[["render",vf],["__scopeId","data-v-67577a46"]]),Of={components:{chart:Hn},props:{entityName:{type:String,required:!0},title:{type:String,default:"Bar Chart"},yaxis:{type:String,required:!0},xaxis:{type:String,required:!0}},setup(n){const{chartData:t,fetchChartData:e,loading:i,error:s}=Un(),o=a.ref({responsive:!0,plugins:{legend:{position:"top"},tooltip:{callbacks:{label:function(l){return`${l.dataset.label}: ${l.raw}`}}}}}),r=async()=>{if(!n.yaxis||!n.xaxis){console.error("xaxis or yaxis is not defined."),s.value="x-axis or y-axis is not properly configured.";return}await e({entityName:n.entityName,yaxis:n.yaxis,xaxis:n.xaxis})};return a.onMounted(()=>{console.log("Fetching data for yAxis:",n.yaxis),console.log("Fetching data for xAxis:",n.xaxis),r()}),{chartData:t,chartOptions:o,loading:i,error:s}}},Df={key:0,class:"chart-container"},Nf={key:1},Tf={key:0},Pf={key:1},Mf={key:2};function Vf(n,t,e,i,s,o){const r=a.resolveComponent("chart");return a.openBlock(),a.createElementBlock("div",null,[a.createElementVNode("div",null,[a.createElementVNode("h2",null,"Entity name: "+a.toDisplayString(e.entityName),1)]),i.chartData?(a.openBlock(),a.createElementBlock("div",Df,[a.createElementVNode("h3",null,a.toDisplayString(e.title)+" , x-axis : "+a.toDisplayString(e.xaxis)+" , y-axis : "+a.toDisplayString(e.yaxis),1),a.createVNode(r,{type:"line",chartData:i.chartData,chartOptions:i.chartOptions},null,8,["chartData","chartOptions"])])):(a.openBlock(),a.createElementBlock("div",Nf,[i.loading?(a.openBlock(),a.createElementBlock("p",Tf,"Loading chart data...")):i.error?(a.openBlock(),a.createElementBlock("p",Pf,a.toDisplayString(i.error),1)):(a.openBlock(),a.createElementBlock("p",Mf,"No data available for the chart."))]))])}const ha=Ft(Of,[["render",Vf],["__scopeId","data-v-2cfe3d4d"]]),Af={components:{chart:Hn},props:{entityName:{type:String,required:!0},title:{type:String,default:"Pie Chart"},yaxis:{type:String,default:null},xaxis:{type:String,default:null}},setup(n){const{chartData:t,fetchChartData:e,loading:i,error:s}=Un(),o=a.ref({responsive:!0,plugins:{legend:{position:"top"},tooltip:{callbacks:{label:function(l){return`${l.label}: ${l.raw}`}}}}}),r=async()=>{await e({entityName:n.entityName,xaxis:n.xaxis,yaxis:n.yaxis})};return a.onMounted(()=>{r()}),{chartData:t,chartOptions:o,loading:i,error:s}}},Bf={key:0,class:"chart-container"},Ff={key:1},$f={key:0},Rf={key:1},Lf={key:2};function If(n,t,e,i,s,o){const r=a.resolveComponent("chart");return a.openBlock(),a.createElementBlock("div",null,[a.createElementVNode("div",null,[a.createElementVNode("h2",null,"Entity name: "+a.toDisplayString(e.entityName),1)]),i.chartData?(a.openBlock(),a.createElementBlock("div",Bf,[a.createElementVNode("h3",null,a.toDisplayString(e.title),1),a.createVNode(r,{type:"pie",chartData:i.chartData,chartOptions:i.chartOptions},null,8,["chartData","chartOptions"])])):(a.openBlock(),a.createElementBlock("div",Ff,[i.loading?(a.openBlock(),a.createElementBlock("p",$f,"Loading chart data...")):i.error?(a.openBlock(),a.createElementBlock("p",Rf,a.toDisplayString(i.error),1)):(a.openBlock(),a.createElementBlock("p",Lf,"No data available for the chart."))]))])}const fa=Ft(Af,[["render",If],["__scopeId","data-v-27f5ea01"]]),jf={components:{chart:Hn},props:{entityName:{type:String,required:!0},title:{type:String,default:"Pie Chart"},yaxis:{type:String,default:null},xaxis:{type:String,default:null}},setup(n){const{chartData:t,fetchChartData:e,loading:i,error:s}=Un(),o=a.ref({responsive:!0,plugins:{legend:{position:"top"},tooltip:{callbacks:{label:function(l){return`${l.label}: ${l.raw}`}}}}}),r=async()=>{await e({entityName:n.entityName,xaxis:n.xaxis,yaxis:n.yaxis})};return a.onMounted(()=>{r()}),{chartData:t,chartOptions:o,loading:i,error:s}}},zf={key:0,class:"chart-container"},Wf={key:1},Hf={key:0},Uf={key:1},qf={key:2};function Yf(n,t,e,i,s,o){const r=a.resolveComponent("chart");return a.openBlock(),a.createElementBlock("div",null,[a.createElementVNode("div",null,[a.createElementVNode("h2",null,"Entity name: "+a.toDisplayString(e.entityName),1)]),i.chartData?(a.openBlock(),a.createElementBlock("div",zf,[a.createElementVNode("h3",null,a.toDisplayString(e.title),1),a.createVNode(r,{type:"polarArea",chartData:i.chartData,chartOptions:i.chartOptions},null,8,["chartData","chartOptions"])])):(a.openBlock(),a.createElementBlock("div",Wf,[i.loading?(a.openBlock(),a.createElementBlock("p",Hf,"Loading chart data...")):i.error?(a.openBlock(),a.createElementBlock("p",Uf,a.toDisplayString(i.error),1)):(a.openBlock(),a.createElementBlock("p",qf,"No data available for the chart."))]))])}const ma=Ft(jf,[["render",Yf],["__scopeId","data-v-941f0d0a"]]),Kf={components:{chart:Hn},props:{entityName:{type:String,required:!0},title:{type:String,default:"Bar Chart"},yaxis:{type:String,required:!0},xaxis:{type:String,required:!0}},setup(n){const{chartData:t,fetchChartData:e,loading:i,error:s}=Un(),o=a.ref({responsive:!0,plugins:{legend:{position:"top"},tooltip:{callbacks:{label:function(l){return`${l.dataset.label}: ${l.raw}`}}}}}),r=async()=>{if(!n.yaxis||!n.xaxis){console.error("xaxis or yaxis is not defined."),s.value="x-axis or y-axis is not properly configured.";return}await e({entityName:n.entityName,yaxis:n.yaxis,xaxis:n.xaxis})};return a.onMounted(()=>{console.log("Fetching data for yAxis:",n.yaxis),console.log("Fetching data for xAxis:",n.xaxis),r()}),{chartData:t,chartOptions:o,loading:i,error:s}}},Xf={key:0,class:"chart-container"},Gf={key:1},Qf={key:0},Jf={key:1},Zf={key:2};function tm(n,t,e,i,s,o){const r=a.resolveComponent("chart");return a.openBlock(),a.createElementBlock("div",null,[a.createElementVNode("div",null,[a.createElementVNode("h2",null,"Entity name: "+a.toDisplayString(e.entityName),1)]),i.chartData?(a.openBlock(),a.createElementBlock("div",Xf,[a.createElementVNode("h3",null,a.toDisplayString(e.title)+" , x-axis : "+a.toDisplayString(e.xaxis)+" , y-axis : "+a.toDisplayString(e.yaxis),1),a.createVNode(r,{type:"radar",chartData:i.chartData,chartOptions:i.chartOptions},null,8,["chartData","chartOptions"])])):(a.openBlock(),a.createElementBlock("div",Gf,[i.loading?(a.openBlock(),a.createElementBlock("p",Qf,"Loading chart data...")):i.error?(a.openBlock(),a.createElementBlock("p",Jf,a.toDisplayString(i.error),1)):(a.openBlock(),a.createElementBlock("p",Zf,"No data available for the chart."))]))])}const pa=Ft(Kf,[["render",tm],["__scopeId","data-v-80750171"]]),em={class:"flex flex-col p-3"},nm={class:"flex justify-center flex-row mb-2 cursor-pointer"},im={style:{"word-break":"break-all"}},sm={__name:"LinkEntityContent",props:{linkEntityListItem:{type:Object,required:!0}},setup(n){Ut.useRoute();const t=re(),e=a.ref("");t.getAppId()!=null&&t.getAppId()!=""&&(e.value=t.getAppId());const i=a.ref(),s=a.ref(!1),o=a.ref(!1),r=a.ref({}),l=a.ref([{label:"Remove association",icon:"",command:h=>{c()}}]),c=()=>{console.log(r.value),console.log("Function is calling")},d=(h,f)=>{r.value=f,i.value.show(h),o.value=!0},u=()=>{r.value={},o.value=!1};return(h,f)=>{const m=a.resolveComponent("Button"),p=a.resolveComponent("ContextMenu"),g=a.resolveComponent("router-link");return a.openBlock(),a.createElementBlock("div",{onMouseenter:f[4]||(f[4]=a.withModifiers(y=>s.value=!0,["prevent"])),onMouseleave:f[5]||(f[5]=a.withModifiers(y=>s.value=!1,["prevent"])),class:"flex relative m-3",style:{border:"1px solid var(--surface-border)","border-radius":"5px"}},[a.withDirectives(a.createVNode(m,{onClick:f[0]||(f[0]=y=>d(y,n.linkEntityListItem)),class:"!absolute right-0",size:"small",style:{width:"55px",height:"25px","border-radius":"5px","font-size":"12px"}},{default:a.withCtx(()=>f[6]||(f[6]=[a.createTextVNode(" More")])),_:1},512),[[a.vShow,s.value||o.value]]),a.createVNode(p,{ref_key:"menu",ref:i,model:l.value,onMouseenter:f[1]||(f[1]=a.withModifiers(y=>s.value=!0,["prevent"])),onMouseleave:f[2]||(f[2]=a.withModifiers(y=>s.value=!1,["prevent"])),onHide:f[3]||(f[3]=y=>u())},null,8,["model"]),a.createElementVNode("div",em,[a.createElementVNode("div",nm,[a.createElementVNode("div",im,a.toDisplayString(n.linkEntityListItem.entityName),1),a.createVNode(g,{to:{name:"entity360view",params:{entityName:n.linkEntityListItem.entityName,id:n.linkEntityListItem.id,appId:e.value}},target:"_blank"},{default:a.withCtx(()=>f[7]||(f[7]=[a.createElementVNode("div",{class:"pi pi-external-link ml-3"},null,-1)])),_:1},8,["to"])]),a.createElementVNode("div",null,"Id: "+a.toDisplayString(n.linkEntityListItem.id),1)])],32)}}},om={class:"flex flex-col mt-3"},rm={class:"flex flex-row items-center"},am={class:"flex items-center justify-center mt-5"},lm={key:0,class:"pi pi-caret-right"},cm={key:1,class:"pi pi-caret-down"},dm={key:0},um={class:"flex flex-col mt-5"},hm={class:"col-12"},fm={class:"flex flex-col mt-5"},mm={class:"col-12 font-bold"},pm={key:0},gm={class:"flex flex-col mt-5"},ym={class:"col-12"},bm={class:"flex flex-col mt-5"},_m={class:"col-12"},xm={class:"flex flex-col mt-5"},km={class:"col-12"},Sm={class:"flex flex-row justify-between items-center mt-5"},wm={key:1,class:"mt-2"},Em={class:"flex flex-row justify-between items-center"},Cm={key:1,class:"text-red-500"},vm={class:"flex flex-col mt-5"},Om={class:"flex flex-row justify-between items-center mt-2"},Dm={class:"flex flex-row items-center mt-5 mb-5"},Nm={class:"font-bold"},Tm={class:"font-bold ml-2 flex-1"},Pm={class:"flex flex-row justify-center items-center mb-2"},Mm={class:"ml-2 flex-1"},Vm={key:0,class:"pi pi-exclamation-circle"},Am={class:"flex flex-col justify-center"},Bm={class:"flex flex-row justify-between items-center"},Fm={class:"justify-start"},$m={class:"justify-start"},Rm=Ft({__name:"EntityLookup",props:a.mergeModels({linkedEntity:{type:Object,required:!0},entity360Name:{type:String,required:!0},entity360Id:{required:!0},saveExistingRelatedEntityRecord:{type:Function,required:!0}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(n){Ut.useRoute();const t=n,e=a.useModel(n,"modelValue"),i=new qe,s=a.ref({}),o=a.ref([]),r=a.ref({}),l=a.ref([]),c=a.ref([]),d=a.ref({}),u=a.ref("id"),h=a.ref(1),f=a.ref([]),m=a.ref(25),p=a.ref(0),g=a.ref(0),y=a.ref(0);let b=a.ref([]);const _=a.ref(!1),w={gt:"GREATER_THAN",dateAfter:"GREATER_THAN",equals:"EQUAL",dateIs:"EQUAL",notEquals:"NOT_EQUAL",dateIsNot:"NOT_EQUAL",lt:"LESS_THAN",dateBefore:"LESS_THAN",lte:"LESS_THAN_EQUAL",gte:"GREATER_THAN_EQUAL",between:"BETWEEN",contains:"CONTAINS",startsWith:"STARTS_WITH",notContains:"NOT_CONTAINS",endsWith:"ENDS_WITH"},E={gt:"is greater than",dateAfter:"is after",equals:"is equals",dateIs:"is equals",notEquals:"is not equals",dateIsNot:"is not equals",lt:"is less than",dateBefore:"is before",lte:"is less than or equal to",gte:"is greater than or equal to",between:"between",contains:"contains",startsWith:"starts with",notContains:"not contains",endsWith:"ends with"};a.onMounted(()=>{C()});const k=j=>t.linkedEntity.list.some(A=>A[d.value.name]===j),C=async()=>{try{const j={sortBy:[u.value],sortDirection:h.value===1?"ASC":"DESC",pageSize:m.value,currentPage:p.value,columnList:null,filter:b.value,fullTextSearch:""},A=await i.searchEntityRecords(t.linkedEntity.entityName,j);A&&A.response&&(s.value=A.response,l.value=A.response.entity.entityDefinition.columns,c.value=ut(A.response.entity.entityDefinition.columns),g.value=A.response.totalRecords,await S(),await x(),O())}catch{}finally{}},S=async()=>{for(let j=0;j<l.value.length;j++){const A=l.value[j];!A.autoGeneerated&&A.foreignKey&&A.foreignKey.referencedEntityName.toLowerCase()==t.entity360Name.toLowerCase()&&(r.value=A)}},x=async()=>{for(let j=0;j<l.value.length;j++){const A=l.value[j];if(A.primaryKey&&A.primaryKey==!0){d.value=A;break}}},O=()=>{for(let j=0;j<t.linkedEntity.list.length;j++){const A=t.linkedEntity.list[j];A.is_deleted==!1&&A[r.value.name]==t.entity360Id&&o.value.push(A[d.value.name])}},M=()=>{let j=JSON.parse(JSON.stringify(o.value));j=j.filter(rt=>!k(rt));let A={linkEntityName:s.value.entityName,linkRecordIdList:[]};for(let rt=0;rt<j.length;rt++){const Ht=j[rt];A.linkRecordIdList.push(Ht)}t.saveExistingRelatedEntityRecord(A)},v=()=>{_.value=!_.value},T=[{label:"Starts with",value:"startsWith"},{label:"Contains",value:"contains"},{label:"Not contains",value:"notContains"},{label:"Ends with",value:"endsWith"},{label:"Equals",value:"equals"},{label:"Not equals",value:"notEquals"}],$=[{label:"Equals",value:"equals"},{label:"Not equals",value:"notEquals"},{label:"Less than",value:"lt"},{label:"Less than or equal to",value:"lte"},{label:"Greater than",value:"gt"},{label:"Greater than or equal to",value:"gte"}],U=[{label:"Equals",value:"equals"},{label:"Not equals",value:"notEquals"}],H=[{label:"Date is",value:"dateIs"},{label:"Date is not",value:"dateIsNot"},{label:"Date is before",value:"dateBefore"},{label:"Date is after",value:"dateAfter"}],F=[{label:"ASC",value:1},{label:"DESC",value:-1}];let I=[];const B=a.computed(()=>c.value.filter(j=>j.sortable)),P=a.computed(()=>c.value.filter(j=>j.filterable)),R=j=>c.value.filter(A=>{var rt;return A.filterable?((rt=f.value[j])==null?void 0:rt.columnName)===A.name?!0:!f.value.some((Ht,xt)=>xt!==j&&Ht.columnName===A.name):!1}).map(A=>({label:A.name,value:A.field})),W=j=>{let A="";switch(Gt(j.columnName).toLowerCase()){case"string":case"uuid":A="startsWith";break;case"date":A="dateIs";break;case"numeric":case"int":case"integer":A="equals";break;case"bool":case"boolean":A="equals";break}j.operator=A,j.value=""},J=j=>{const A=Gt(j.columnName);switch(A&&A.toLowerCase()){case"integer":case"int":case"numeric":I=$;break;case"date":I=H;break;case"bool":case"boolean":I=U;break;default:I=T}return I},G=j=>{if(j&&j.columnName){const A=Gt(j.columnName);return De(A)}else return""},ot=()=>{for(let j=0;j<f.value.length;j++){const A=f.value[j];A.editing=!1}f.value.push({columnName:"",value:"",operator:"",editing:!0})},nt=j=>{f.value.splice(j,1)},Y=j=>{j.editing=!j.editing},st=()=>{let j=JSON.parse(JSON.stringify(f.value));b.value=[];for(let A=0;A<j.length;A++){const rt=j[A];delete rt.editing,rt.columnName&&rt.operator&&rt.value&&(rt.columnType=Gt(rt.columnName),rt.operator=w[rt.operator],b.value.push(rt))}C()},ut=j=>j.map(A=>({field:A.name,name:A.displayName?A.displayName:A.name,filterable:A.filterable,datatype:A.type,sortable:!0,displayFormatKey:A.displayFormatKey,displayFormat:A.displayFormat})),Ue=()=>{C()},Gt=j=>{const A=c.value.find(rt=>rt.field===j);return A?A.datatype:null},De=j=>{switch(j.toLowerCase()){case"integer":case"int":case"numeric":return"numeric";case"date":return"date";case"bool":case"boolean":return"boolean";default:return"text"}},me=j=>{m.value=j.rows,p.value=j.page,y.value=j.first,C()};return(j,A)=>{var Tn,vs;const rt=a.resolveComponent("InputIcon"),Ht=a.resolveComponent("InputText"),xt=a.resolveComponent("IconField"),dt=a.resolveComponent("Select"),ct=a.resolveComponent("Divider"),Ot=a.resolveComponent("InputNumber"),Dn=a.resolveComponent("Calendar"),oe=a.resolveComponent("Button"),ln=a.resolveComponent("Checkbox"),Nn=a.resolveComponent("Paginator"),Ho=a.resolveDirective("tooltip");return a.openBlock(),a.createElementBlock(a.Fragment,null,[a.createElementVNode("div",om,[a.createElementVNode("div",rm,[a.createVNode(xt,{class:"block mt-2 md:mt-0 w-full"},{default:a.withCtx(()=>[a.createVNode(rt,{onClick:A[0]||(A[0]=()=>{}),class:"pi pi-search"}),a.createVNode(Ht,{class:"w-full",onKeyup:A[1]||(A[1]=a.withKeys(()=>{},["enter"])),placeholder:`Search ${s.value.entityName}`},null,8,["placeholder"])]),_:1})]),a.createElementVNode("div",am,[a.createElementVNode("div",{class:"flex items-center cursor-pointer sorting-filter-section flex-1 line-height-4",onClick:A[2]||(A[2]=X=>v())},[_.value?a.createCommentVNode("",!0):(a.openBlock(),a.createElementBlock("div",lm)),_.value?(a.openBlock(),a.createElementBlock("div",cm)):a.createCommentVNode("",!0),A[9]||(A[9]=a.createElementVNode("div",{class:"ml-3 font-bold"}," Sorting & Filters ",-1))])]),_.value?(a.openBlock(),a.createElementBlock("div",dm,[a.createElementVNode("div",um,[A[10]||(A[10]=a.createElementVNode("div",{class:"col-12 font-bold"},"Sort Column",-1)),a.createElementVNode("div",hm,[a.createVNode(dt,{modelValue:u.value,"onUpdate:modelValue":A[3]||(A[3]=X=>u.value=X),options:B.value,optionLabel:"name",optionValue:"field",highlightOnSelect:!1,class:"w-full",onChange:A[4]||(A[4]=X=>Ue(j.event))},null,8,["modelValue","options"])])]),a.createElementVNode("div",fm,[A[11]||(A[11]=a.createElementVNode("div",{class:"col-12 font-bold"},[a.createElementVNode("div",{class:"col-12 font-bold"},"Sort Direction")],-1)),a.createElementVNode("div",mm,[a.createVNode(dt,{modelValue:h.value,"onUpdate:modelValue":A[5]||(A[5]=X=>h.value=X),options:F,optionLabel:"label",optionValue:"value",highlightOnSelect:!1,class:"w-full",onChange:A[6]||(A[6]=X=>Ue(j.event))},null,8,["modelValue"])])]),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(f.value,(X,cn)=>(a.openBlock(),a.createElementBlock("div",{key:cn},[X.editing?(a.openBlock(),a.createElementBlock("div",pm,[a.createVNode(ct,{class:"mt-5"}),a.createElementVNode("div",gm,[A[12]||(A[12]=a.createElementVNode("div",{class:"col-12 font-bold"},"Filter Column",-1)),a.createElementVNode("div",ym,[a.createVNode(dt,{modelValue:X.columnName,"onUpdate:modelValue":Nt=>X.columnName=Nt,options:R(cn),optionLabel:"label",placeholder:"Select column",optionValue:"value",highlightOnSelect:!1,class:"w-full",onChange:Nt=>W(X)},null,8,["modelValue","onUpdate:modelValue","options","onChange"])])]),a.createElementVNode("div",bm,[A[13]||(A[13]=a.createElementVNode("div",{class:"col-12 font-bold"},"Filter Operator",-1)),a.createElementVNode("div",_m,[a.createVNode(dt,{modelValue:X.operator,"onUpdate:modelValue":Nt=>X.operator=Nt,options:J(X),optionLabel:"label",placeholder:"Select operator",optionValue:"value",highlightOnSelect:!1,class:"w-full"},null,8,["modelValue","onUpdate:modelValue","options"])])]),a.createElementVNode("div",xm,[A[14]||(A[14]=a.createElementVNode("div",{class:"col-12 font-bold"},"Filter value",-1)),a.createElementVNode("div",km,[G(X)=="numeric"?(a.openBlock(),a.createBlock(Ot,{key:0,format:!1,class:"w-full",modelValue:X.value,"onUpdate:modelValue":Nt=>X.value=Nt,placeholder:"Search value"},null,8,["modelValue","onUpdate:modelValue"])):G(X)=="date"?(a.openBlock(),a.createBlock(Dn,{key:1,class:"w-full",modelValue:X.value,"onUpdate:modelValue":Nt=>X.value=Nt,dateFormat:"mm/dd/yy",placeholder:"mm/dd/yyyy"},null,8,["modelValue","onUpdate:modelValue"])):(a.openBlock(),a.createBlock(Ht,{key:2,modelValue:X.value,"onUpdate:modelValue":Nt=>X.value=Nt,class:"w-full",placeholder:"Search value"},null,8,["modelValue","onUpdate:modelValue"]))])]),a.createElementVNode("div",Sm,[a.createVNode(oe,{style:{width:"100px"},label:"Hide",icon:"",severity:"warning",onClick:Nt=>Y(X)},null,8,["onClick"]),a.createVNode(oe,{style:{width:"100px"},label:"Delete",icon:"",severity:"danger",onClick:Nt=>nt(cn)},null,8,["onClick"])])])):a.createCommentVNode("",!0),X.editing?a.createCommentVNode("",!0):(a.openBlock(),a.createElementBlock("div",wm,[a.createVNode(ct),a.createElementVNode("div",Em,[a.createElementVNode("span",null,[X.columnName||X.operator||X.value?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[a.createElementVNode("span",{class:a.normalizeClass({"text-red-500":!X.columnName})},a.toDisplayString(X.columnName?" "+X.columnName:" column"),3),a.createElementVNode("span",{class:a.normalizeClass({"text-red-500":!E[X.operator]})},a.toDisplayString(X.operator?" "+E[X.operator]:" operator"),3),a.createElementVNode("span",{class:a.normalizeClass({"text-red-500":!X.value})},a.toDisplayString(X.value?" "+X.value:" value"),3)],64)):(a.openBlock(),a.createElementBlock("span",Cm,"Filter is empty"))]),a.createVNode(oe,{style:{width:"100px"},label:"Edit",icon:"",severity:"info",onClick:Nt=>Y(X)},null,8,["onClick"])])]))]))),128)),a.createElementVNode("div",vm,[a.createVNode(ct),a.createElementVNode("div",Om,[a.createVNode(oe,{style:{width:"100px"},label:"Add",disabled:P.value.length===f.value.length,icon:"",severity:"success",onClick:ot},null,8,["disabled"]),a.createVNode(oe,{style:{width:"100px"},label:"Apply",severity:"info",onClick:st})])])])):a.createCommentVNode("",!0),a.createElementVNode("div",Dm,[a.createElementVNode("div",Nm,a.toDisplayString((Tn=s.value)==null?void 0:Tn.totalRecords),1),a.createElementVNode("div",Tm,a.toDisplayString((vs=s.value)==null?void 0:vs.entityName),1)]),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(s.value.result,(X,cn)=>(a.openBlock(),a.createElementBlock("div",{key:cn},[a.createElementVNode("div",Pm,[a.createVNode(ln,{disabled:k(X[d.value.name]),modelValue:o.value,"onUpdate:modelValue":A[7]||(A[7]=Nt=>o.value=Nt),value:X[d.value.name]},null,8,["disabled","modelValue","value"]),a.createElementVNode("div",Mm,[a.createTextVNode(a.toDisplayString(n.linkedEntity.entityName)+" ",1),a.createElementVNode("span",null,a.toDisplayString(X[d.value.name]),1)]),k(X[d.value.name])?a.withDirectives((a.openBlock(),a.createElementBlock("div",Vm,null,512)),[[Ho,"This record is already associated.",void 0,{left:!0}]]):a.createCommentVNode("",!0)])]))),128)),a.createVNode(Nn,{rows:m.value,totalRecords:g.value,rowsPerPageOptions:[10,25,50,100],onPage:me,template:"FirstPageLink PageLinks LastPageLink CurrentPageReport RowsPerPageDropdown",currentPageReportTemplate:""},null,8,["rows","totalRecords"])]),a.createElementVNode("div",Am,[a.createVNode(ct,{class:"mt-5"}),a.createElementVNode("div",Bm,[a.createElementVNode("div",Fm,[a.createVNode(oe,{label:"Cancel",icon:"",severity:"secondary",onClick:A[8]||(A[8]=X=>e.value=!1)})]),a.createElementVNode("div",$m,[a.createVNode(oe,{label:"Save",severity:"success",onClick:M})])])])],64)}}},[["__scopeId","data-v-7fd52649"]]),Lm={class:"field flex flex-col"},Im={key:0,class:"flex items-center"},jm={key:1},zm={class:"flex items-center"},Wm={class:"flex flex-col justify-center"},Hm={class:"flex flex-row justify-between items-center"},Um={class:"justify-start"},qm={class:"justify-start"},Ym={__name:"EntityLookupObject",props:a.mergeModels({linkedEntity:{type:Object,required:!0},entity360Name:{type:String,required:!0},entity360Id:{type:[String,Number]},saveExistingEntityObject:{type:Function}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(n){Ut.useRoute();const t=n,e=a.useModel(n,"modelValue"),i=new qe,s=a.ref({}),o=a.ref({});let r=a.ref("");const l=a.ref({}),c=a.ref({});a.onMounted(async()=>{console.log("linkedEntity"),console.log(t.linkedEntity),console.log("entity360Name"),console.log(t.entity360Name),console.log("entity360Id"),console.log(t.entity360Id),await u(),await d()});const d=async()=>{try{const g=await i.getEntityRecords(t.linkedEntity.entityName);g&&g.response&&(s.value=g.response,await h(g.response.entity.entityDefinition.columns),await m(),console.log(s.value))}catch{}finally{}},u=async()=>{try{const g=await i.getRecord(t.entity360Name,t.entity360Id);g&&g.response&&(o.value=g.response,await f(g.response.entity.entityDefinition.columns),console.log(o.value))}catch{}finally{}},h=async g=>{for(let y=0;y<g.length;y++){const b=g[y];if(b.primaryKey&&b.primaryKey==!0){l.value=b;break}}},f=async g=>{for(let y=0;y<g.length;y++){const b=g[y];if(!b.autoGeneerated&&b.foreignKey&&b.foreignKey.referencedEntityName.toLowerCase()==t.linkedEntity.entityName.toLowerCase()){c.value=b;break}}},m=async()=>{for(let g=0;g<s.value.result.length;g++){const y=s.value.result[g];if(y[l.value.name]==o.value.result[0][c.value.name]){r.value=y;break}}},p=()=>{const g={linkedEntityRecordId:r.value[l.value.name],linkedEntityName:t.linkedEntity.entityName,relationType:"ManyToOne"};t.saveExistingEntityObject(g)};return(g,y)=>{const b=a.resolveComponent("Select"),_=a.resolveComponent("Divider"),w=a.resolveComponent("Button");return a.openBlock(),a.createElementBlock("div",Lm,[a.createVNode(b,{modelValue:a.unref(r),"onUpdate:modelValue":y[0]||(y[0]=E=>a.isRef(r)?r.value=E:r=E),"item-value":l.value.name,options:s.value.result,filter:"",optionLabel:l.value.name,placeholder:"Select "+l.value.name,class:"w-full"},{value:a.withCtx(E=>[E.value?(a.openBlock(),a.createElementBlock("div",Im,[a.createElementVNode("div",null,a.toDisplayString(E.value[l.value.name]),1)])):(a.openBlock(),a.createElementBlock("span",jm,a.toDisplayString(E.placeholder),1))]),option:a.withCtx(E=>[a.createElementVNode("div",zm,[a.createElementVNode("div",null,a.toDisplayString(E.option[l.value.name]),1)])]),_:1},8,["modelValue","item-value","options","optionLabel","placeholder"]),a.createElementVNode("div",Wm,[a.createVNode(_),a.createElementVNode("div",Hm,[a.createElementVNode("div",Um,[a.createVNode(w,{label:"Cancel",icon:"",severity:"secondary",onClick:y[1]||(y[1]=E=>e.value=!1)})]),a.createElementVNode("div",qm,[a.createVNode(w,{label:"Save",severity:"success",onClick:p})])])])])}}},Km={style:{"font-weight":"700","font-size":"1.25rem"}},Xm={class:"flex flex-col"},Gm={class:"flex flex-row justify-between items-center"},Qm={class:"justify-start"},Jm={class:"justify-start"},Zm="",tp={__name:"CreateRelatedentity",props:a.mergeModels({entity360Id:{required:!0},entity360Name:{type:String,required:!0},linkedEntity:{type:Object,required:!0}},{showCreateRelatedEntityForm:{},showCreateRelatedEntityFormModifiers:{}}),emits:a.mergeModels(["onSaveDialog"],["update:showCreateRelatedEntityForm"]),setup(n,{emit:t}){const e=a.useModel(n,"showCreateRelatedEntityForm");Ut.useRoute();const i=n,s=i.linkedEntity.entityName,o=t,r=a.ref("Add existing");a.onMounted(()=>{m()});const{formData:l,columns:c,errors:d,backendErrors:u,clearErrors:h,saveRecord:f,fetchAllRecords:m,saveRelatedEntityRecord:p}=Ws(s,Zm,o),g=()=>{for(let w=0;w<c.value.length;w++){const E=c.value[w];!E.autoGenerated&&E.foreignKey&&(l.value[E.name]=i.entity360Id)}const _={relationType:i.linkedEntity.relationType,linkedEntities:{entityLinkage:[{linkEntityName:i.entity360Name,linkRecordIdList:[i.entity360Id]}]}};f(_)},y=_=>{var w;if(((w=_==null?void 0:_.linkRecordIdList)==null?void 0:w.length)>0){const E={entityLinkage:[{linkEntityName:_.linkEntityName,linkRecordIdList:_.linkRecordIdList}]};p(i.entity360Name,i.entity360Id,E)}},b=_=>{const w={entityLinkage:[{linkEntityName:i.entity360Name,linkRecordIdList:[i.entity360Id]}]};p(_.linkedEntityName,_.linkedEntityRecordId,w)};return(_,w)=>{const E=a.resolveComponent("Tab"),k=a.resolveComponent("TabList"),C=a.resolveComponent("Divider"),S=a.resolveComponent("Button"),x=a.resolveComponent("TabPanel"),O=a.resolveComponent("TabPanels"),M=a.resolveComponent("Tabs"),v=a.resolveComponent("Drawer");return a.openBlock(),a.createBlock(v,{visible:e.value,"onUpdate:visible":w[3]||(w[3]=T=>e.value=T),blockScroll:!0,position:"right",class:"p-fluid layout-profile-sidebar",style:{width:"40%"},pt:{closeButton:"ml-auto"}},{header:a.withCtx(()=>[a.createElementVNode("span",Km,a.toDisplayString(r.value)+" "+a.toDisplayString(n.linkedEntity.entityName),1)]),default:a.withCtx(()=>[a.createVNode(M,{value:"1"},{default:a.withCtx(()=>[a.createVNode(k,null,{default:a.withCtx(()=>[a.createVNode(E,{value:"0"},{default:a.withCtx(()=>w[4]||(w[4]=[a.createTextVNode("Create new")])),_:1}),a.createVNode(E,{value:"1"},{default:a.withCtx(()=>w[5]||(w[5]=[a.createTextVNode("Add existing")])),_:1})]),_:1}),a.createVNode(O,null,{default:a.withCtx(()=>[a.createVNode(x,{value:"0"},{default:a.withCtx(()=>[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(c),(T,$)=>{var U;return a.openBlock(),a.createElementBlock("div",{key:$,class:"mt-3"},[!T.autoGenerated&&!T.foreignKey?(a.openBlock(),a.createBlock(Ni,{key:0,modelValue:a.unref(l)[T.name],"onUpdate:modelValue":H=>a.unref(l)[T.name]=H,column:T,errors:(U=a.unref(d)[T.name])==null?void 0:U.messages,onInput:a.unref(h)},null,8,["modelValue","onUpdate:modelValue","column","errors","onInput"])):a.createCommentVNode("",!0)])}),128)),a.createElementVNode("div",Xm,[a.createVNode(C),a.createElementVNode("div",Gm,[a.createElementVNode("div",Qm,[a.createVNode(S,{label:"Cancel",icon:"",severity:"secondary",onClick:w[0]||(w[0]=T=>e.value=!1)})]),a.createElementVNode("div",Jm,[a.createVNode(S,{label:"Save",severity:"success",onClick:g})])])])]),_:1}),a.createVNode(x,{value:"1"},{default:a.withCtx(()=>[n.linkedEntity.relationType=="ONE_TO_MANY"?(a.openBlock(),a.createBlock(Rm,{key:0,modelValue:e.value,"onUpdate:modelValue":w[1]||(w[1]=T=>e.value=T),linkedEntity:n.linkedEntity,entity360Name:n.entity360Name,entity360Id:n.entity360Id,saveExistingRelatedEntityRecord:y},null,8,["modelValue","linkedEntity","entity360Name","entity360Id"])):a.createCommentVNode("",!0),n.linkedEntity.relationType=="MANY_TO_ONE"?(a.openBlock(),a.createBlock(Ym,{key:1,modelValue:e.value,"onUpdate:modelValue":w[2]||(w[2]=T=>e.value=T),linkedEntity:n.linkedEntity,entity360Name:n.entity360Name,entity360Id:n.entity360Id,saveExistingEntityObject:b},null,8,["modelValue","linkedEntity","entity360Name","entity360Id"])):a.createCommentVNode("",!0)]),_:1})]),_:1})]),_:1})]),_:1},8,["visible"])}}},ep={class:"flex flex-col border-bottom-section pb-3 pt-3"},np={class:"flex items-center pl-3 pr-3 justify-between"},ip={key:0,class:"pi pi-caret-right"},sp={key:1,class:"pi pi-caret-down"},op={class:"ml-3 font-bold"},rp={class:"ml-1"},ap={class:"text-right"},lp={key:0},cp=Ft({__name:"LinkEntitySection",props:{entity360Id:{required:!0},entity360Name:{type:String,required:!0},linkedEntity:{type:Object,required:!0},entity360Name:{type:[String,Number]},onSaveRelatedEnttity:{type:Function}},setup(n){Ut.useRoute();const t=n,e=a.ref(!1),i=a.ref(!1),s=()=>{e.value=!e.value},o=()=>{i.value=!i.value},r=()=>{i.value=!1,t.onSaveRelatedEnttity()},l=a.computed(()=>t.linkedEntity.list.filter(c=>!c.is_deleted).length);return(c,d)=>{const u=a.resolveComponent("Button");return a.openBlock(),a.createElementBlock(a.Fragment,null,[a.createElementVNode("div",ep,[a.createElementVNode("div",np,[a.createElementVNode("div",{class:"flex cursor-pointer items-center linked-entity-section grow line-height-4",onClick:d[0]||(d[0]=h=>s())},[e.value?a.createCommentVNode("",!0):(a.openBlock(),a.createElementBlock("div",ip)),e.value?(a.openBlock(),a.createElementBlock("div",sp)):a.createCommentVNode("",!0),a.createElementVNode("div",op,a.toDisplayString(n.linkedEntity.entityName),1),a.createElementVNode("div",rp," ("+a.toDisplayString(l.value)+") ",1)]),a.createElementVNode("div",ap,[a.createVNode(u,{label:"Add",icon:"pi pi-plus",size:"small",onClick:d[1]||(d[1]=h=>o())})])]),e.value?(a.openBlock(),a.createElementBlock("div",lp,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(n.linkedEntity.list,(h,f)=>(a.openBlock(),a.createElementBlock("div",{class:"flex flex-col",key:f},[h.is_deleted?a.createCommentVNode("",!0):(a.openBlock(),a.createBlock(sm,{key:0,linkEntityListItem:h},null,8,["linkEntityListItem"]))]))),128))])):a.createCommentVNode("",!0)]),i.value?(a.openBlock(),a.createBlock(tp,{key:0,showCreateRelatedEntityForm:i.value,"onUpdate:showCreateRelatedEntityForm":d[2]||(d[2]=h=>i.value=h),linkedEntity:n.linkedEntity,entity360Name:n.entity360Name,entity360Id:n.entity360Id,onOnSaveDialog:r},null,8,["showCreateRelatedEntityForm","linkedEntity","entity360Name","entity360Id"])):a.createCommentVNode("",!0)],64)}}},[["__scopeId","data-v-412eec44"]]),dp={class:"flex"},up={class:"p-3 mt-3 flex-col items-center"},hp={key:0,class:"pi pi-caret-right"},fp={key:1,class:"pi pi-caret-down"},mp={class:"font-bold ml-2"},pp={key:0,class:"flex flex-col mt-4"},gp={class:"flex flex-col mt-2"},yp={class:"flex flex-row flex-wrap justify-between pl-5"},bp={class:"flex flex-col"},_p={class:"font-bold"},xp={class:"mt-2"},kp={key:0,class:"flex flex-col",style:{position:"relative","max-width":"400px","background-color":"var(--surface-card)"}},Sp={key:2,style:{width:"350px"},class:"flex flex-col justify-center"},wp={key:0,class:"custom-sidebar"},Ep={class:"custom-sidebar-content"},Cp={class:"custom-sidebar-button"},vp={class:"custom-sidebar-text"},ga=Ft({__name:"Entity360",props:{entityName:{type:String},recordId:{type:String}},emits:["onSaveDialog"],setup(n,{emit:t}){var x,O;const e=re(),i=Ut.useRoute(),s=n,o=a.ref(!0),r=a.ref(!1);let l=(x=i==null?void 0:i.params)==null?void 0:x.entityName,c=(O=i==null?void 0:i.params)==null?void 0:O.id;s.entityName&&(l=s.entityName),s.recordId&&(c=s.recordId);const d=t,{formData:u,columns:h,errors:f,backendErrors:m,isDataChange:p,linkedEntities:g,primarayColumn:y,clearErrors:b,saveRecord:_,getRelatedEntityRecordById:w,cancleRecord:E}=Ws(l,c,d);a.watch(()=>e.globalConfigs.appId,async M=>{M&&w()},{immediate:!0});const k=()=>{o.value=!o.value},C=()=>{r.value=!r.value},S=()=>{w()};return(M,v)=>{var R;const T=a.resolveComponent("SplitterPanel"),$=a.resolveComponent("Tab"),U=a.resolveComponent("TabList"),H=a.resolveComponent("TabPanel"),F=a.resolveComponent("TabPanels"),I=a.resolveComponent("Tabs"),B=a.resolveComponent("Splitter"),P=a.resolveComponent("Button");return a.openBlock(),a.createElementBlock(a.Fragment,null,[a.createElementVNode("div",dp,[a.createVNode(B,{class:"flex-1",layout:"horizontal",gutterSize:8,size:100},{default:a.withCtx(()=>[a.createVNode(T,{size:20,minSize:10,maxSize:20},{default:a.withCtx(()=>[a.createElementVNode("div",up,[a.createElementVNode("div",{onClick:v[0]||(v[0]=W=>k()),class:"section-heading cursor-pointer"},[o.value?a.createCommentVNode("",!0):(a.openBlock(),a.createElementBlock("i",hp)),o.value?(a.openBlock(),a.createElementBlock("i",fp)):a.createCommentVNode("",!0),a.createElementVNode("span",mp," About this "+a.toDisplayString(a.unref(l)),1)]),o.value?(a.openBlock(),a.createElementBlock("div",pp,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(h),(W,J)=>{var G;return a.openBlock(),a.createElementBlock("div",{key:J},[W.autoGenerated?a.createCommentVNode("",!0):(a.openBlock(),a.createBlock(Ni,{key:0,modelValue:a.unref(u)[W.name],"onUpdate:modelValue":ot=>a.unref(u)[W.name]=ot,column:W,errors:(G=a.unref(f)[W.name])==null?void 0:G.messages,onInput:a.unref(b)},null,8,["modelValue","onUpdate:modelValue","column","errors","onInput"]))])}),128))])):a.createCommentVNode("",!0)])]),_:1}),a.createVNode(T,{size:55,minSize:35,style:{height:"100%"}},{default:a.withCtx(()=>[a.createVNode(I,{value:"0"},{default:a.withCtx(()=>[a.createVNode(U,null,{default:a.withCtx(()=>[a.createVNode($,{value:"0"},{default:a.withCtx(()=>v[3]||(v[3]=[a.createTextVNode("Overview")])),_:1}),a.createVNode($,{value:"1"},{default:a.withCtx(()=>v[4]||(v[4]=[a.createTextVNode("Activity")])),_:1})]),_:1}),a.createVNode(F,null,{default:a.withCtx(()=>[a.createVNode(H,{value:"0"},{default:a.withCtx(()=>[a.createElementVNode("div",gp,[v[5]||(v[5]=a.createElementVNode("h3",{class:"mt-2 text-xl font-semibold"},"Data highlights",-1)),a.createElementVNode("div",yp,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(h).filter(W=>W.autoGenerated),(W,J)=>(a.openBlock(),a.createElementBlock("div",{key:J,class:"column-item"},[a.createElementVNode("div",bp,[a.createElementVNode("div",_p,a.toDisplayString(W.name),1),a.createElementVNode("div",xp,[a.createVNode(qs,{column:W,value:a.unref(u)[W.name]},null,8,["column","value"])])])]))),128))])])]),_:1}),a.createVNode(H,{value:"1"})]),_:1})]),_:1})]),_:1})]),_:1}),((R=a.unref(g))==null?void 0:R.length)>0?(a.openBlock(),a.createElementBlock("div",kp,[r.value?(a.openBlock(),a.createBlock(P,{key:0,icon:"pi pi-caret-right",rounded:"",onClick:C,"aria-label":"Filter",style:{height:"2rem",width:"2rem",left:"-20px"}})):a.createCommentVNode("",!0),r.value?a.createCommentVNode("",!0):(a.openBlock(),a.createBlock(P,{key:1,icon:"pi pi-caret-left",rounded:"",onClick:C,"aria-label":"Filter",style:{height:"2rem",width:"2rem",left:"-20px"}})),r.value?(a.openBlock(),a.createElementBlock("div",Sp,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(g),(W,J)=>(a.openBlock(),a.createElementBlock("div",{key:J},[a.createVNode(cp,{entity360Name:a.unref(l),entity360Id:a.unref(c),linkedEntity:W,onSaveRelatedEnttity:S},null,8,["entity360Name","entity360Id","linkedEntity"])]))),128))])):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0)]),a.unref(p)?(a.openBlock(),a.createElementBlock("div",wp,[a.createElementVNode("div",Ep,[a.createElementVNode("div",Cp,[a.createVNode(P,{severity:"primary",onClick:v[1]||(v[1]=W=>a.unref(_)())},{default:a.withCtx(()=>v[6]||(v[6]=[a.createTextVNode("Save")])),_:1}),a.createVNode(P,{style:{"margin-left":"10px"},severity:"secondary",onClick:v[2]||(v[2]=W=>a.unref(E)())},{default:a.withCtx(()=>v[7]||(v[7]=[a.createTextVNode("Cancel")])),_:1})]),a.createElementVNode("div",vp," You've changed property in the "+a.toDisplayString(a.unref(l))+". ",1)])])):a.createCommentVNode("",!0)],64)}}},[["__scopeId","data-v-8d31dd1c"]]);function ya(){const n=new qe;let{errors:t,setErrors:e}=xr(),i=a.reactive({data:null});const s=C=>{i.data=C},o=async C=>{try{const S=await n.getEntityRecords(C);if(S&&S.response)return S}catch(S){return console.error("Error fetching entity:",S.errorMessage),S}finally{}},r=async(C,S)=>{try{let x=await n.addRecord(C.entityName,S);if(x)return x}catch(x){return x}finally{}},l=async(C,S,x)=>{try{const O=await n.updateRecord(C.entityName,S,x);if(O&&O.response)return O}catch(O){return O}finally{}},c=async(C,S)=>{try{S.filter==null&&(S.filter={}),Object.keys(S.filter).length===0&&(S.filter=[]);const x=await n.searchEntityRecords(C.entityName,S);if(x)return x.response.sortBy=S.sortBy,x.response.filters=S.filter,x.response.sortDirection=S.sortDirection,x.response.fullTextSearch=S.fullTextSearch,x}catch(x){return x}finally{}},d=async(C,S)=>{try{const x=await n.deleteRecord(C.entityName,S);if(x)return x}catch(x){console.error("Error on deleting record:",x.errorMessage)}finally{}},u=C=>C.result,h=C=>C.entity.entityDefinition.columns,f=C=>{const S=C.entity.entityDefinition.columns;let x={};for(let O=0;O<S.length;O++){const M=S[O];if(M.primaryKey&&M.primaryKey==!0){x=M;break}}return x},m=C=>{const S=C.entity.entityDefinition.columns;let x={};for(let O=0;O<S.length;O++){let M=S[O];M.autoGenerated||(x[M.name]="")}return x},p=(C,S)=>{let x="";const O=C.entity.entityDefinition.columns;for(let M=0;M<O.length;M++){let v=O[M];if(S==v.name){x=v.type;break}}return x},g=(C,S)=>{const O=C.entity.entityDefinition.columns.filter(v=>v.autoGenerated).map(v=>v.name);return Object.entries(S).filter(([v])=>!O.includes(v)).map(([v,T])=>({recordColumnName:v,recordColumnValue:T,columnType:p(i.data,v)}))},y=()=>{const C=i.data.entity.entityDefinition.columns;return zs().shape(C.reduce((x,O)=>(O.autoGenerated||(x[O.name]=js().nullable(!1).test({name:"custom-validation",test:function(M){const v=[];let T="";if(O.required&&(!M||M.trim()===""))if(O.validations){T=b(O.validations,"VALIDATE_REQUIRED"),v.push(T);let $=w(O.validations,"VALIDATE_REQUIRED");$&&($="hint:"+$,v.push($))}else T=O.displayName+" is required.",v.push(T);else{if(O.maxLength&&M.length>O.maxLength)if(O.validations){T=b(O.validations,"VALIDATE_MAXLENGTH"),v.push(T);let $=w(O.validations,"VALIDATE_MAXLENGTH");$&&($="hint:"+$,v.push($))}else T=O.displayName+" cannot exceed from "+O.maxLength+" characters",v.push(T);if(O.regxId&&!new RegExp(_(O.validations,"VALIDATE_REGX")).test(M))if(O.validations){T=b(O.validations,"VALIDATE_REGX"),v.push(T);let $=w(O.validations,"VALIDATE_REGX");$&&($="hint:"+$,v.push($))}else T=O.displayName+" invalid format.",v.push(T)}return v.length>0?this.createError({message:v}):!0}})),x),{}))},b=(C,S)=>{for(let x=0;x<C.length;x++)if(S==C[x].type)return C[x].message},_=(C,S)=>{for(let x=0;x<C.length;x++)if(S==C[x].type)return C[x].regx},w=(C,S)=>{for(let x=0;x<C.length;x++)if(S==C[x].type)return C[x].hint};return{state:i,setEntity:s,getEntity:o,addRecord:r,updateRecord:l,searchRecord:c,entityRecordDelete:d,getEntityItems:u,getEntityColumns:h,getPrimaryKeyColumn:f,getFormData:m,createDataToSave:g,createValidationSchema:y,clearErrors:C=>(e({...t.value,[C]:null}),t.value),validateData:async(C,S)=>{try{return await C.validate(S,{abortEarly:!1}),e({}),{validate:!0}}catch(x){const O=x.inner.reduce((T,$)=>(T[$.path]||(T[$.path]={messages:[]}),T[$.path].messages.push(...$.errors),T),{}),M=Object.entries(O).reduce((T,[$,U])=>(T[$]={messages:U.messages},T),{});return e(M),{validate:!1,errors:t.value}}}}}const ba={__name:"ConfirmDeleteDialog",props:{showDeleteDialog:{},showDeleteDialogModifiers:{}},emits:a.mergeModels(["onDeleteItem"],["update:showDeleteDialog"]),setup(n,{emit:t}){const e=a.useModel(n,"showDeleteDialog"),i=t,s=o=>{i("onDeleteItem",{remove:o})};return(o,r)=>{const l=a.resolveComponent("Button"),c=a.resolveComponent("Dialog");return a.openBlock(),a.createBlock(c,{visible:e.value,"onUpdate:visible":r[2]||(r[2]=d=>e.value=d),style:{width:"450px"},header:"Confirm",modal:!0},{footer:a.withCtx(()=>[a.createVNode(l,{label:"No",icon:"pi pi-times",text:"",onClick:r[0]||(r[0]=d=>s(!1))}),a.createVNode(l,{label:"Yes",icon:"pi pi-check",text:"",onClick:r[1]||(r[1]=d=>s(!0))})]),default:a.withCtx(()=>[r[3]||(r[3]=a.createElementVNode("div",{class:"flex items-center justify-center"},[a.createElementVNode("i",{class:"pi pi-exclamation-triangle mr-3",style:{"font-size":"2rem"}}),a.createElementVNode("span",null,"Are you sure you want to delete the selected item?")],-1))]),_:1},8,["visible"])}}},Op={key:0,style:{"font-weight":"700","font-size":"1.25rem"}},Dp={key:1,style:{"font-weight":"700","font-size":"1.25rem"}},Js={__name:"EntityFormDialog",props:a.mergeModels({item:Object},{showEntityForm:{},showEntityFormModifiers:{}}),emits:["update:showEntityForm"],setup(n){const t=a.useModel(n,"showEntityForm"),e=a.inject("entityObject"),i=n;let s=a.ref([]),o=a.ref({}),r=a.ref([]),l=a.ref(null),c=a.ref({});a.onMounted(()=>{s.value=e.getEntityColumns(e.state.data),i.item?o.value=JSON.parse(JSON.stringify(i.item)):o.value=e.getFormData(e.state.data),l.value=e.createValidationSchema()});const d=async()=>{const m=await e.validateData(l.value,o.value);if(!m.validate){c.value=m.errors;return}const p=e.getPrimaryKeyColumn(e.state.data),g=i.item[p.name],y={dataDefinitions:e.createDataToSave(e.state.data,o.value)},b=await e.updateRecord(e.state.data,g,y);if(b&&b.success){t.value=!1;const _={sortBy:e.state.data.sortBy,sortDirection:e.state.data.sortDirection,pageSize:e.state.data.pageSize,currentPage:e.state.data.currentPage,columnList:null,filter:e.state.data.filters,fullTextSearch:e.state.data.fullTextSearch},w=await e.searchRecord(e.state.data,_);if(w!=null&&w.response){let E=w==null?void 0:w.response;e.setEntity(E)}}else b.validationErrors&&(r.value=JSON.parse(JSON.stringify(b.errvalidationErrorsors)))},u=async()=>{const m=await e.validateData(l.value,o.value);if(!m.validate){c.value=m.errors;return}const p={dataDefinitions:e.createDataToSave(e.state.data,o.value)},g=await e.addRecord(e.state.data,p);g&&g.success?(t.value=!1,e.state.data=await e.getEntity(e.state.data.entityName)):g.validationErrors&&(r.value=JSON.parse(JSON.stringify(g.errvalidationErrorsors)))},h=async()=>{i.item?d():u()},f=m=>{c.value=e.clearErrors(m)};return(m,p)=>{const g=a.resolveComponent("Button"),y=a.resolveComponent("Dialog");return t.value?(a.openBlock(),a.createBlock(y,{key:0,showFooter:!1,visible:t.value,"onUpdate:visible":p[2]||(p[2]=b=>t.value=b),style:{width:"50rem"},breakpoints:{"1199px":"75vw","575px":"90vw"},modal:!0,class:"p-fluid"},{header:a.withCtx(()=>[n.item?(a.openBlock(),a.createElementBlock("span",Op,"Edit "+a.toDisplayString(a.unref(e).state.data.entityName)+" record details",1)):a.createCommentVNode("",!0),n.item?a.createCommentVNode("",!0):(a.openBlock(),a.createElementBlock("span",Dp,"Add "+a.toDisplayString(a.unref(e).state.data.entityName)+" record details",1))]),footer:a.withCtx(()=>[a.createVNode(g,{type:"button",icon:"",label:"Cancel",severity:"secondary",onClick:p[0]||(p[0]=b=>t.value=!1)}),a.createVNode(g,{type:"button",icon:"",label:"Save",severity:"success",onClick:p[1]||(p[1]=b=>h())})]),default:a.withCtx(()=>{var b;return[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(s),(_,w)=>{var E;return a.openBlock(),a.createElementBlock("div",{key:w},[!_.autoGenerated&&!_.foreignKey?(a.openBlock(),a.createBlock(Ni,{key:0,modelValue:a.unref(o)[_.name],"onUpdate:modelValue":k=>a.unref(o)[_.name]=k,column:_,errors:(E=a.unref(c)[_.name])==null?void 0:E.messages,onInput:f},null,8,["modelValue","onUpdate:modelValue","column","errors"])):a.createCommentVNode("",!0),!_.autoGenerated&&_.foreignKey?(a.openBlock(),a.createBlock($r,{key:1,modelValue:a.unref(o)[_.name],"onUpdate:modelValue":k=>a.unref(o)[_.name]=k,entityName:_.foreignKey.referencedEntityName,columnName:_.name,relatedEntityColumn:_.foreignKey.referencedColumnName},null,8,["modelValue","onUpdate:modelValue","entityName","columnName","relatedEntityColumn"])):a.createCommentVNode("",!0)])}),128)),((b=a.unref(r))==null?void 0:b.length)>0?(a.openBlock(),a.createBlock(Fr,{key:0,errors:a.unref(r)},null,8,["errors"])):a.createCommentVNode("",!0)]}),_:1},8,["visible"])):a.createCommentVNode("",!0)}}},Np={class:"flex justify-between items-start"},Tp={class:"flex-grow-1"},Pp={class:"tile-grid"},Mp={class:"font-bold text-lg text-700"},Vp={class:"flex flex-col gap-2"},Ap=Ft({__name:"EntityListSingleRecord",props:{item:Object},setup(n){const t=n,e=a.inject("entityObject"),i=a.ref([]),s=a.ref(!1),o=a.ref(!1);a.onMounted(()=>{i.value=e.getEntityColumns(e.state.data)});const r=()=>{s.value=!0},l=()=>{o.value=!0},c=u=>{u.remove==!0?d():s.value=!1},d=async()=>{const u=e.getPrimaryKeyColumn(e.state.data),h=t.item[u.name],f=await e.entityRecordDelete(e.state.data,h);if(f!=null&&f.success){s.value=!1;const m={sortBy:e.state.data.sortBy,sortDirection:e.state.data.sortDirection,pageSize:e.state.data.pageSize,currentPage:e.state.data.currentPage,columnList:null,filter:e.state.data.filters,fullTextSearch:e.state.data.fullTextSearch},p=await e.searchRecord(e.state.data,m);if(p!=null&&p.response){let g=p==null?void 0:p.response;e.setEntity(g)}console.log(f)}};return(u,h)=>{const f=a.resolveComponent("Button");return a.openBlock(),a.createElementBlock(a.Fragment,null,[a.createElementVNode("div",Np,[a.createElementVNode("div",Tp,[a.createElementVNode("div",Pp,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(i.value,(m,p)=>(a.openBlock(),a.createElementBlock("div",{key:p},[a.createElementVNode("span",Mp,a.toDisplayString(m.name)+" : ",1),a.createVNode(qs,{column:m,value:n.item[m.name]},null,8,["column","value"])]))),128))])]),a.createElementVNode("div",Vp,[a.createVNode(f,{onClick:h[0]||(h[0]=m=>l()),icon:"pi pi-pencil",severity:"success",size:"",rounded:"","aria-label":"Edit"}),a.createVNode(f,{onClick:h[1]||(h[1]=m=>r()),icon:"pi pi-trash",severity:"danger",rounded:"","aria-label":"Delete"})])]),o.value?(a.openBlock(),a.createBlock(Js,{key:0,showEntityForm:o.value,"onUpdate:showEntityForm":h[2]||(h[2]=m=>o.value=m),item:n.item},null,8,["showEntityForm","item"])):a.createCommentVNode("",!0),s.value?(a.openBlock(),a.createBlock(ba,{key:1,showDeleteDialog:s.value,"onUpdate:showDeleteDialog":h[3]||(h[3]=m=>s.value=m),onOnDeleteItem:c},null,8,["showDeleteDialog"])):a.createCommentVNode("",!0)],64)}}},[["__scopeId","data-v-ea3b758f"]]),Bp=Ft({__name:"EntityListRecordParent",props:{listItemDisplay:String},setup(n){const t=a.inject("entityObject"),e=a.ref([]);return a.watch(()=>t.state.data,i=>{i&&(e.value=i.result,console.log("Entity state updated in child:",t))},{immediate:!0}),(i,s)=>(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(e.value,(o,r)=>(a.openBlock(),a.createElementBlock("div",{key:r,class:"card rounded-md p-5 my-2 shadow-lg relative tile"},[(a.openBlock(),a.createBlock(a.resolveDynamicComponent(n.listItemDisplay!=null&&n.listItemDisplay!=""?n.listItemDisplay:Ap),a.mergeProps({ref_for:!0},{item:o}),null,16))]))),128))}},[["__scopeId","data-v-b13f837f"]]),Fp={};function $p(n,t){return null}const _a=Ft(Fp,[["render",$p]]),Rp={class:"my-2"},Lp={class:"m-0"},xa={__name:"EntityListHeaderSlot",setup(n){const t=a.inject("entityObject");let e=a.ref("");return a.watch(()=>t.state.data,i=>{i&&(e.value=i.entityName)},{immediate:!0}),(i,s)=>{const o=a.resolveComponent("Toolbar");return a.openBlock(),a.createBlock(o,{class:"p-2 my-2"},{start:a.withCtx(()=>[a.createElementVNode("div",Rp,[a.createElementVNode("h2",Lp,"EntityName: "+a.toDisplayString(a.unref(e)),1)])]),end:a.withCtx(()=>s[0]||(s[0]=[])),_:1})}}},Ip={class:"flex flex-col mb-5"},jp={class:"col-12"},zp={class:"flex flex-col mb-5"},Wp={class:"col-12"},Hp={key:0},Up={class:"flex flex-col mb-5"},qp={class:"col-12"},Yp={class:"flex flex-col mb-5"},Kp={class:"col-12"},Xp={class:"flex flex-col mb-5"},Gp={class:"col-12"},Qp={class:"flex flex-row justify-between items-center"},Jp={key:1},Zp={class:"flex flex-row justify-between items-center"},tg={key:1,class:"text-red-500"},eg={class:"flex flex-col"},ng={class:"flex flex-row justify-between items-center"},ig={__name:"FilterSortSidebar",props:a.mergeModels({headers:Array,operatorMap:Object,sortCallback:Function,filterCallback:Function,getColumnDatatype:Function,getDatatypeByField:Function},{sortBy:{},sortByModifiers:{},sortDirection:{},sortDirectionModifiers:{},showFilter:{},showFilterModifiers:{},filters:{},filtersModifiers:{}}),emits:["update:sortBy","update:sortDirection","update:showFilter","update:filters"],setup(n){const t=a.useModel(n,"sortBy"),e=a.useModel(n,"sortDirection"),i=a.useModel(n,"showFilter"),s=a.useModel(n,"filters"),o={gt:"is greater than",dateAfter:"is after",equals:"is equals",dateIs:"is equals",notEquals:"is not equals",dateIsNot:"is not equals",lt:"is less than",dateBefore:"is before",lte:"is less than or equal to",gte:"is greater than or equal to",between:"between",contains:"contains",startsWith:"starts with",notContains:"not contains",endsWith:"ends with"},r=[{label:"Starts with",value:"startsWith"},{label:"Contains",value:"contains"},{label:"Not contains",value:"notContains"},{label:"Ends with",value:"endsWith"},{label:"Equals",value:"equals"},{label:"Not equals",value:"notEquals"}],l=[{label:"Equals",value:"equals"},{label:"Not equals",value:"notEquals"},{label:"Less than",value:"lt"},{label:"Less than or equal to",value:"lte"},{label:"Greater than",value:"gt"},{label:"Greater than or equal to",value:"gte"}],c=[{label:"Equals",value:"equals"},{label:"Not equals",value:"notEquals"}],d=[{label:"Date is",value:"dateIs"},{label:"Date is not",value:"dateIsNot"},{label:"Date is before",value:"dateBefore"},{label:"Date is after",value:"dateAfter"}],u=[{label:"ASC",value:1},{label:"DESC",value:-1}];let h=[];const f=a.computed(()=>n.headers.filter(S=>S.sortable)),m=a.computed(()=>n.headers.filter(S=>S.filterable)),p=S=>n.headers.filter(x=>{var O;return x.filterable?((O=s.value[S])==null?void 0:O.columnName)===x.name?!0:!s.value.some((M,v)=>v!==S&&M.columnName===x.name):!1}).map(x=>({label:x.name,value:x.field})),g=S=>{let x="";switch(n.getDatatypeByField(S.columnName).toLowerCase()){case"string":case"uuid":x="startsWith";break;case"date":x="dateIs";break;case"numeric":case"int":case"integer":x="equals";break;case"bool":case"boolean":x="equals";break}S.operator=x,S.value=""},y=S=>{const x=n.getDatatypeByField(S.columnName);switch(x&&x.toLowerCase()){case"integer":case"int":case"numeric":h=l;break;case"date":h=d;break;case"bool":case"boolean":h=c;break;default:h=r}return h},b=S=>{if(S&&S.columnName){const x=n.getDatatypeByField(S.columnName);return n.getColumnDatatype(x)}else return""},_=()=>{for(let S=0;S<s.value.length;S++){const x=s.value[S];x.editing=!1}s.value.push({columnName:"",value:"",operator:"",editing:!0})},w=S=>{s.value.splice(S,1)},E=S=>{S.editing=!S.editing},k=()=>{let S=[],x=JSON.parse(JSON.stringify(s.value));for(let O=0;O<x.length;O++){const M=x[O];delete M.editing,M.columnName&&M.operator&&M.value&&(M.columnType=n.getDatatypeByField(M.columnName),M.operator=n.operatorMap[M.operator],S.push(M))}n.filterCallback(S)},C=()=>{n.sortCallback()};return(S,x)=>{const O=a.resolveComponent("Select"),M=a.resolveComponent("Divider"),v=a.resolveComponent("InputNumber"),T=a.resolveComponent("Calendar"),$=a.resolveComponent("InputText"),U=a.resolveComponent("Button"),H=a.resolveComponent("Drawer");return a.openBlock(),a.createBlock(H,{visible:i.value,"onUpdate:visible":x[4]||(x[4]=F=>i.value=F),header:"Sorting and Filter",blockScroll:!0,position:"right",class:"layout-profile-sidebar !w-full md:!w-80 lg:!w-[30rem]",pt:{closeButton:"ml-auto"}},{default:a.withCtx(()=>[a.createElementVNode("div",Ip,[x[5]||(x[5]=a.createElementVNode("div",{class:"col-12 font-bold"},"Sort Column",-1)),a.createElementVNode("div",jp,[a.createVNode(O,{modelValue:t.value,"onUpdate:modelValue":x[0]||(x[0]=F=>t.value=F),options:f.value,optionLabel:"name",optionValue:"field",highlightOnSelect:!1,class:"w-full",onChange:x[1]||(x[1]=F=>C(S.event))},null,8,["modelValue","options"])])]),a.createElementVNode("div",zp,[x[6]||(x[6]=a.createElementVNode("div",{class:"col-12 font-bold"},[a.createElementVNode("div",{class:"col-12 font-bold"},"Sort Direction")],-1)),a.createElementVNode("div",Wp,[a.createVNode(O,{modelValue:e.value,"onUpdate:modelValue":x[2]||(x[2]=F=>e.value=F),options:u,optionLabel:"label",optionValue:"value",highlightOnSelect:!1,class:"w-full",onChange:x[3]||(x[3]=F=>C(S.event))},null,8,["modelValue"])])]),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(s.value,(F,I)=>(a.openBlock(),a.createElementBlock("div",{key:I},[F.editing?(a.openBlock(),a.createElementBlock("div",Hp,[a.createVNode(M),a.createElementVNode("div",Up,[x[7]||(x[7]=a.createElementVNode("div",{class:"col-12 font-bold"},"Filter Column",-1)),a.createElementVNode("div",qp,[a.createVNode(O,{modelValue:F.columnName,"onUpdate:modelValue":B=>F.columnName=B,options:p(I),optionLabel:"label",placeholder:"Select column",optionValue:"value",highlightOnSelect:!1,class:"w-full",onChange:B=>g(F)},null,8,["modelValue","onUpdate:modelValue","options","onChange"])])]),a.createElementVNode("div",Yp,[x[8]||(x[8]=a.createElementVNode("div",{class:"col-12 font-bold"},"Filter Operator",-1)),a.createElementVNode("div",Kp,[a.createVNode(O,{modelValue:F.operator,"onUpdate:modelValue":B=>F.operator=B,options:y(F),optionLabel:"label",placeholder:"Select operator",optionValue:"value",highlightOnSelect:!1,class:"w-full"},null,8,["modelValue","onUpdate:modelValue","options"])])]),a.createElementVNode("div",Xp,[x[9]||(x[9]=a.createElementVNode("div",{class:"col-12 font-bold"},"Filter value",-1)),a.createElementVNode("div",Gp,[b(F)=="numeric"?(a.openBlock(),a.createBlock(v,{key:0,format:!1,class:"w-full",modelValue:F.value,"onUpdate:modelValue":B=>F.value=B,placeholder:"Search value"},null,8,["modelValue","onUpdate:modelValue"])):b(F)=="date"?(a.openBlock(),a.createBlock(T,{key:1,class:"w-full",modelValue:F.value,"onUpdate:modelValue":B=>F.value=B,dateFormat:"mm/dd/yy",placeholder:"mm/dd/yyyy"},null,8,["modelValue","onUpdate:modelValue"])):(a.openBlock(),a.createBlock($,{key:2,modelValue:F.value,"onUpdate:modelValue":B=>F.value=B,class:"w-full",placeholder:"Search value"},null,8,["modelValue","onUpdate:modelValue"]))])]),a.createElementVNode("div",Qp,[a.createVNode(U,{label:"Hide",icon:"",severity:"warn",onClick:B=>E(F)},null,8,["onClick"]),a.createVNode(U,{label:"Delete",icon:"",severity:"danger",onClick:B=>w(I)},null,8,["onClick"])])])):a.createCommentVNode("",!0),F.editing?a.createCommentVNode("",!0):(a.openBlock(),a.createElementBlock("div",Jp,[a.createVNode(M),a.createElementVNode("div",Zp,[a.createElementVNode("span",null,[F.columnName||F.operator||F.value?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[a.createElementVNode("span",{class:a.normalizeClass({"text-red-500":!F.columnName})},a.toDisplayString(F.columnName?" "+F.columnName:" column"),3),a.createElementVNode("span",{class:a.normalizeClass({"text-red-500":!o[F.operator]})},a.toDisplayString(F.operator?" "+o[F.operator]:" operator"),3),a.createElementVNode("span",{class:a.normalizeClass({"text-red-500":!F.value})},a.toDisplayString(F.value?" "+F.value:" value"),3)],64)):(a.openBlock(),a.createElementBlock("span",tg,"Filter is empty"))]),a.createVNode(U,{label:"Edit",icon:"",severity:"info",onClick:B=>E(F)},null,8,["onClick"])])]))]))),128)),a.createElementVNode("div",eg,[a.createVNode(M),a.createElementVNode("div",ng,[a.createVNode(U,{label:"Add",disabled:m.value.length===s.value.length,icon:"",severity:"success",onClick:_},null,8,["disabled"]),a.createVNode(U,{label:"Apply",severity:"info",onClick:k})])])]),_:1},8,["visible"])}}},sg={class:"my-2"},Wi={__name:"EntityListFilters",setup(n){const t=a.inject("entityObject"),e=a.ref(!1),i=a.ref([]),s=a.ref([]),o=a.ref(""),r=a.ref(1);let l=a.ref("");const c=a.ref([]),d=a.ref([]),u={gt:"GREATER_THAN",dateAfter:"GREATER_THAN",equals:"EQUAL",dateIs:"EQUAL",notEquals:"NOT_EQUAL",dateIsNot:"NOT_EQUAL",lt:"LESS_THAN",dateBefore:"LESS_THAN",lte:"LESS_THAN_EQUAL",gte:"GREATER_THAN_EQUAL",between:"BETWEEN",contains:"CONTAINS",startsWith:"STARTS_WITH",notContains:"NOT_CONTAINS",endsWith:"ENDS_WITH"};a.watch(()=>t.state.data,E=>{if(E&&(c.value=t.getEntityColumns(E),d.value=b(c.value),o.value=="")){const k=t.getPrimaryKeyColumn(E);o.value=k.name}},{immediate:!0});const h=()=>{e.value=!e.value},f=E=>{s.value=E,m()},m=async()=>{const E={sortBy:[o.value],sortDirection:r.value===1?"ASC":"DESC",pageSize:t.state.data.pageSize,currentPage:t.state.data.currentPage,columnList:null,filter:s.value,fullTextSearch:l.value},k=await t.searchRecord(t.state.data,E);if(k!=null&&k.success){let C=k==null?void 0:k.response;t.setEntity(C)}},p=()=>{m()},g=()=>{i.value=[],s.value=[],m()},y=()=>{m()},b=E=>E.map(k=>({field:k.name,name:k.displayName?k.displayName:k.name,filterable:k.filterable,datatype:k.type,sortable:k.indexColumn,displayFormatKey:k.displayFormatKey,displayFormat:k.displayFormat})),_=E=>{switch(E.toLowerCase()){case"integer":case"int":case"numeric":return"numeric";case"date":return"date";case"bool":case"boolean":return"boolean";default:return"text"}},w=E=>{const k=c.value.find(C=>C.name===E);return k?k.type:null};return(E,k)=>{const C=a.resolveComponent("Button"),S=a.resolveComponent("InputIcon"),x=a.resolveComponent("InputText"),O=a.resolveComponent("IconField"),M=a.resolveComponent("Toolbar");return a.openBlock(),a.createElementBlock(a.Fragment,null,[a.createVNode(M,{class:"p-2 my-2"},{start:a.withCtx(()=>[a.createElementVNode("div",sg,[a.createVNode(C,{type:"button",size:"medium",icon:"pi pi-filter",label:"Filter",severity:"info",onClick:k[0]||(k[0]=v=>h())})]),a.createVNode(C,{class:"ml-3",size:"medium",type:"button",icon:"pi pi-filter-slash",label:"Clear",severity:"warn",onClick:k[1]||(k[1]=v=>g())})]),end:a.withCtx(()=>[a.createVNode(O,{iconPosition:"right",class:"block mt-2 md:mt-0"},{default:a.withCtx(()=>[a.createVNode(S,{onClick:k[2]||(k[2]=v=>y()),class:"pi pi-search"}),a.createVNode(x,{class:"w-full sm:w-auto",onKeyup:k[3]||(k[3]=a.withKeys(v=>y(),["enter"])),modelValue:a.unref(l),"onUpdate:modelValue":k[4]||(k[4]=v=>a.isRef(l)?l.value=v:l=v),placeholder:"Search..."},null,8,["modelValue"])]),_:1})]),_:1}),a.createVNode(ig,{sortBy:o.value,"onUpdate:sortBy":k[5]||(k[5]=v=>o.value=v),sortDirection:r.value,"onUpdate:sortDirection":k[6]||(k[6]=v=>r.value=v),showFilter:e.value,"onUpdate:showFilter":k[7]||(k[7]=v=>e.value=v),filters:i.value,"onUpdate:filters":k[8]||(k[8]=v=>i.value=v),headers:d.value,operatorMap:u,sortCallback:p,filterCallback:f,getColumnDatatype:_,getDatatypeByField:w},null,8,["sortBy","sortDirection","showFilter","filters","headers"])],64)}}},ka={__name:"EntityListPagination",setup(n){const t=a.ref(25),e=a.ref(0),i=a.ref(0),s=a.ref(0);let o=a.inject("entityObject");const r=async l=>{t.value=l.rows,e.value=l.page,s.value=l.first;const c={sortBy:o.state.data.sortBy,sortDirection:o.state.data.sortDirection,columnList:null,filter:o.state.data.filters,fullTextSearch:o.state.data.fullTextSearch,pageSize:t.value,currentPage:e.value},d=await o.searchRecord(o.state.data,c);if(d!=null&&d.success){let u=d==null?void 0:d.response;o.setEntity(u),i.value=d.response.totalRecords,s.value=e.value*t.value}};return a.watch(()=>{var l,c;return(c=(l=o==null?void 0:o.state)==null?void 0:l.data)==null?void 0:c.totalRecords},l=>{i&&(i.value=l)},{immediate:!0}),(l,c)=>{const d=a.resolveComponent("Paginator");return a.openBlock(),a.createBlock(d,{class:"my-4",rows:t.value,totalRecords:i.value,rowsPerPageOptions:[10,25,50,100],onPage:r,template:"FirstPageLink PrevPageLink PageLinks NextPageLink LastPageLink CurrentPageReport RowsPerPageDropdown",currentPageReportTemplate:"Showing {first} to {last} of {totalRecords} items"},null,8,["rows","totalRecords"])}}},og={class:"flex flex-row justify-end p-2 my-2"},Hi={__name:"EntityListAddButton",setup(n){const t=a.ref(!1),e=()=>{t.value=!0};return(i,s)=>{const o=a.resolveComponent("Button");return a.openBlock(),a.createElementBlock(a.Fragment,null,[a.createElementVNode("div",og,[a.createVNode(o,{label:"Add",size:"medium",icon:"pi pi-plus",onClick:s[0]||(s[0]=r=>e())})]),t.value?(a.openBlock(),a.createBlock(Js,{key:0,showEntityForm:t.value,"onUpdate:showEntityForm":s[1]||(s[1]=r=>t.value=r)},null,8,["showEntityForm"])):a.createCommentVNode("",!0)],64)}}},Sa={__name:"EntityList",props:{entityName:String,listDisplay:String,listItemDisplay:String,listHeader:String,listFooter:String,listFilter:String,listPagination:String,showAddButton:Boolean,listFilerSlot:Boolean,className:{type:String,default:"default-class"}},setup(n,{expose:t}){const e=ya(),i=re();a.provide("entityObject",e);const s=n;return t({props:s,reload:()=>{console.log("reload data")}}),a.watch(()=>i.globalConfigs.appId,async r=>{if(r){const l=await e.getEntity(s.entityName);l.success?e.setEntity(l.response):e.setEntity({result:[]})}},{immediate:!0}),(r,l)=>{var c,d,u;return r.$slots["list-item-display"]?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[n.showAddButton?(a.openBlock(),a.createBlock(Hi,{key:0})):a.createCommentVNode("",!0),n.listFilerSlot?(a.openBlock(),a.createBlock(a.resolveDynamicComponent(n.listFilter||Wi),{key:1})):a.createCommentVNode("",!0),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(((u=(d=(c=a.unref(e))==null?void 0:c.state)==null?void 0:d.data)==null?void 0:u.result)||[],h=>a.renderSlot(r.$slots,"list-item-display",{item:h})),256))],64)):(a.openBlock(),a.createElementBlock(a.Fragment,{key:1},[(a.openBlock(),a.createBlock(a.resolveDynamicComponent(n.listHeader||xa))),(a.openBlock(),a.createBlock(a.resolveDynamicComponent(n.listFilter||Wi))),n.showAddButton?(a.openBlock(),a.createBlock(Hi,{key:0})):a.createCommentVNode("",!0),(a.openBlock(),a.createBlock(a.resolveDynamicComponent(n.listDisplay||Bp),a.normalizeProps(a.guardReactiveProps({listItemDisplay:n.listItemDisplay})),null,16)),(a.openBlock(),a.createBlock(a.resolveDynamicComponent(n.listPagination||ka))),(a.openBlock(),a.createBlock(a.resolveDynamicComponent(n.listFooter||_a)))],64))}}},rg={key:0},ag=["href"],lg={key:1},cg={class:"action-buttons"},dg=Ft({__name:"EntityListSingleRecordUnOrdered",props:{item:Object,entityName:String,showAddButton:Boolean,listFilerSlot:Boolean,className:String,listDisplay:String,listHeader:String,listFooter:String,listFilter:String,listPagination:String,displayField:String,baseUrl:String,hrefKey:String,listItemDisplay:String,listHeaderSlot:Boolean,listPaginationSlot:Boolean,className:{type:String,default:"default-class"}},setup(n){const t=n,e=a.inject("entityObject"),i=a.ref([]),s=a.ref(null),o=a.ref(null),r=a.ref(!1),l=a.ref(!1);a.onMounted(()=>{i.value=e.getEntityColumns(e.state.data),s.value=i.value.find(f=>f.name===t.displayField)||null,s.value&&(o.value=t.item[s.value.name])});const c=()=>{r.value=!0},d=()=>{l.value=!0},u=async f=>{f.remove?h():r.value=!1},h=async()=>{const f=e.getPrimaryKeyColumn(e.state.data),m=t.item[f.name],p=await e.entityRecordDelete(e.state.data,m);if(p!=null&&p.success){r.value=!1;const g=await e.searchRecord(e.state.data,{sortBy:e.state.data.sortBy,sortDirection:e.state.data.sortDirection,pageSize:e.state.data.pageSize,currentPage:e.state.data.currentPage,columnList:null,filter:e.state.data.filters,fullTextSearch:e.state.data.fullTextSearch});g!=null&&g.response&&e.setEntity(g.response)}};return(f,m)=>{const p=a.resolveComponent("Button");return a.openBlock(),a.createElementBlock(a.Fragment,null,[a.createElementVNode("ul",{class:a.normalizeClass(t.className)},[s.value?(a.openBlock(),a.createElementBlock("li",rg,[a.createElementVNode("a",{href:`${n.baseUrl}/${n.item[n.hrefKey]}`,target:"_blank",class:"hover:underline"},a.toDisplayString(o.value),9,ag)])):(a.openBlock(),a.createElementBlock("li",lg,[a.createElementVNode("span",null,"No matching field found for '"+a.toDisplayString(o.value)+"'.",1)])),a.createElementVNode("li",cg,[a.createVNode(p,{onClick:m[0]||(m[0]=g=>d()),icon:"pi pi-pencil",severity:"success",rounded:"","aria-label":"Edit"}),a.createVNode(p,{onClick:m[1]||(m[1]=g=>c()),icon:"pi pi-trash",severity:"danger",rounded:"","aria-label":"Delete"})])],2),l.value?(a.openBlock(),a.createBlock(Js,{key:0,showEntityForm:l.value,"onUpdate:showEntityForm":m[2]||(m[2]=g=>l.value=g),item:n.item},null,8,["showEntityForm","item"])):a.createCommentVNode("",!0),r.value?(a.openBlock(),a.createBlock(ba,{key:1,showDeleteDialog:r.value,"onUpdate:showDeleteDialog":m[3]||(m[3]=g=>r.value=g),onOnDeleteItem:u},null,8,["showDeleteDialog"])):a.createCommentVNode("",!0)],64)}}},[["__scopeId","data-v-3083ba60"]]),ug={key:0,class:"error-message"},hg={class:"text-red-500 font-bold"},fg={key:0},mg={key:1},pg={key:2},gg={key:3},yg={key:1},wa=Ft({__name:"EntityListUnOrdered",props:{entityName:String,listDisplay:String,listItemDisplay:String,listHeader:String,listFooter:String,listFilter:String,listPagination:String,showAddButton:Boolean,listFilerSlot:Boolean,listHeaderSlot:Boolean,listPaginationSlot:Boolean,className:{type:String,default:"default-class"},displayField:String,baseUrl:String,hrefKey:String},setup(n,{expose:t}){const e=ya(),i=re();a.provide("entityObject",e);const s=n;console.log("classname",s.className);const o=a.ref([]);return a.watch(()=>e.state.data,c=>{c&&(o.value=c.result)},{immediate:!0}),t({props:s,reload:()=>{console.log("reload data")},filter:()=>{console.log("filter data in unordered")}}),a.watch(()=>i.globalConfigs.appId,async c=>{if(c){const d=await e.getEntity(s.entityName);e.setEntity(d.success?d.response:{result:[]})}},{immediate:!0}),(c,d)=>{var u,h,f;return c.$slots["list-item-display-unOrdered"]?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[n.showAddButton?(a.openBlock(),a.createBlock(Hi,{key:0})):a.createCommentVNode("",!0),n.listFilerSlot?(a.openBlock(),a.createBlock(a.resolveDynamicComponent(n.listFilter||Wi),{key:1})):a.createCommentVNode("",!0),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(((f=(h=(u=a.unref(e))==null?void 0:u.state)==null?void 0:h.data)==null?void 0:f.result)||[],m=>a.renderSlot(c.$slots,"list-item-display-unOrdered",{item:m},void 0,!0)),256))],64)):(a.openBlock(),a.createElementBlock(a.Fragment,{key:1},[!n.displayField||!n.baseUrl||!n.hrefKey||!n.entityName?(a.openBlock(),a.createElementBlock("div",ug,[a.createElementVNode("p",hg,[d[0]||(d[0]=a.createTextVNode(" Error: Missing required props - ")),n.entityName?a.createCommentVNode("",!0):(a.openBlock(),a.createElementBlock("span",fg,"Entity Name")),n.displayField?a.createCommentVNode("",!0):(a.openBlock(),a.createElementBlock("span",mg,"Display Field")),n.baseUrl?a.createCommentVNode("",!0):(a.openBlock(),a.createElementBlock("span",pg,"Base Url")),n.hrefKey?a.createCommentVNode("",!0):(a.openBlock(),a.createElementBlock("span",gg,"Href Key"))])])):(a.openBlock(),a.createElementBlock("div",yg,[n.listHeaderSlot?(a.openBlock(),a.createBlock(a.resolveDynamicComponent(n.listHeader||xa),{key:0})):a.createCommentVNode("",!0),n.listFilerSlot?(a.openBlock(),a.createBlock(a.resolveDynamicComponent(n.listFilter||Wi),{key:1})):a.createCommentVNode("",!0),n.showAddButton?(a.openBlock(),a.createBlock(Hi,{key:2})):a.createCommentVNode("",!0),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(o.value,(m,p)=>(a.openBlock(),a.createElementBlock("div",{key:p},[(a.openBlock(),a.createBlock(a.resolveDynamicComponent(n.listItemDisplay!=null&&n.listItemDisplay!=""?n.listItemDisplay:dg),a.mergeProps({ref_for:!0},{item:m,...s}),null,16))]))),128)),n.listPaginationSlot?(a.openBlock(),a.createBlock(a.resolveDynamicComponent(n.listPagination||ka),{key:3})):a.createCommentVNode("",!0),(a.openBlock(),a.createBlock(a.resolveDynamicComponent(n.listFooter||_a)))]))],64))}}},[["__scopeId","data-v-6facf379"]]),bg={install(n,t){n.component("CSEntityGrid",Wr),n.component("csentitygrid",Wr),n.component("CSEntityList",Sa),n.component("csentitylist",Sa),n.component("CSEntityBarChart",ua),n.component("csentitybarchart",ua),n.component("CSEntityLineChart",ha),n.component("csentitylinechart",ha),n.component("CSEntityPieChart",fa),n.component("csentitypiechart",fa),n.component("CSEntityPolarChart",ma),n.component("csentitypolarchart",ma),n.component("CSEntityRadarChart",pa),n.component("csentityradarchart",pa),n.component("CSEntity360View",ga),n.component("csentity360view",ga),n.component("CSEntityListUnOrdered",wa),n.component("csentitylistunordered",wa)}},Ea=6048e5,_g=864e5,Ca=Symbol.for("constructDateFrom");function Ae(n,t){return typeof n=="function"?n(t):n&&typeof n=="object"&&Ca in n?n[Ca](t):n instanceof Date?new n.constructor(t):new Date(t)}function ne(n,t){return Ae(t||n,n)}let xg={};function Ui(){return xg}function qn(n,t){var l,c,d,u;const e=Ui(),i=(t==null?void 0:t.weekStartsOn)??((c=(l=t==null?void 0:t.locale)==null?void 0:l.options)==null?void 0:c.weekStartsOn)??e.weekStartsOn??((u=(d=e.locale)==null?void 0:d.options)==null?void 0:u.weekStartsOn)??0,s=ne(n,t==null?void 0:t.in),o=s.getDay(),r=(o<i?7:0)+o-i;return s.setDate(s.getDate()-r),s.setHours(0,0,0,0),s}function qi(n,t){return qn(n,{...t,weekStartsOn:1})}function va(n,t){const e=ne(n,t==null?void 0:t.in),i=e.getFullYear(),s=Ae(e,0);s.setFullYear(i+1,0,4),s.setHours(0,0,0,0);const o=qi(s),r=Ae(e,0);r.setFullYear(i,0,4),r.setHours(0,0,0,0);const l=qi(r);return e.getTime()>=o.getTime()?i+1:e.getTime()>=l.getTime()?i:i-1}function Oa(n){const t=ne(n),e=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return e.setUTCFullYear(t.getFullYear()),+n-+e}function kg(n,...t){const e=Ae.bind(null,t.find(i=>typeof i=="object"));return t.map(e)}function Da(n,t){const e=ne(n,t==null?void 0:t.in);return e.setHours(0,0,0,0),e}function Sg(n,t,e){const[i,s]=kg(e==null?void 0:e.in,n,t),o=Da(i),r=Da(s),l=+o-Oa(o),c=+r-Oa(r);return Math.round((l-c)/_g)}function wg(n,t){const e=va(n,t),i=Ae(n,0);return i.setFullYear(e,0,4),i.setHours(0,0,0,0),qi(i)}function Eg(n){return n instanceof Date||typeof n=="object"&&Object.prototype.toString.call(n)==="[object Date]"}function Cg(n){return!(!Eg(n)&&typeof n!="number"||isNaN(+ne(n)))}function vg(n,t){const e=ne(n,t==null?void 0:t.in);return e.setFullYear(e.getFullYear(),0,1),e.setHours(0,0,0,0),e}const Og={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},Dg=(n,t,e)=>{let i;const s=Og[n];return typeof s=="string"?i=s:t===1?i=s.one:i=s.other.replace("{{count}}",t.toString()),e!=null&&e.addSuffix?e.comparison&&e.comparison>0?"in "+i:i+" ago":i};function Zs(n){return(t={})=>{const e=t.width?String(t.width):n.defaultWidth;return n.formats[e]||n.formats[n.defaultWidth]}}const Ng={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Tg={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Pg={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Mg={date:Zs({formats:Ng,defaultWidth:"full"}),time:Zs({formats:Tg,defaultWidth:"full"}),dateTime:Zs({formats:Pg,defaultWidth:"full"})},Vg={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Ag=(n,t,e,i)=>Vg[n];function Yn(n){return(t,e)=>{const i=e!=null&&e.context?String(e.context):"standalone";let s;if(i==="formatting"&&n.formattingValues){const r=n.defaultFormattingWidth||n.defaultWidth,l=e!=null&&e.width?String(e.width):r;s=n.formattingValues[l]||n.formattingValues[r]}else{const r=n.defaultWidth,l=e!=null&&e.width?String(e.width):n.defaultWidth;s=n.values[l]||n.values[r]}const o=n.argumentCallback?n.argumentCallback(t):t;return s[o]}}const Bg={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Fg={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},$g={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Rg={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Lg={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Ig={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},jg={ordinalNumber:(n,t)=>{const e=Number(n),i=e%100;if(i>20||i<10)switch(i%10){case 1:return e+"st";case 2:return e+"nd";case 3:return e+"rd"}return e+"th"},era:Yn({values:Bg,defaultWidth:"wide"}),quarter:Yn({values:Fg,defaultWidth:"wide",argumentCallback:n=>n-1}),month:Yn({values:$g,defaultWidth:"wide"}),day:Yn({values:Rg,defaultWidth:"wide"}),dayPeriod:Yn({values:Lg,defaultWidth:"wide",formattingValues:Ig,defaultFormattingWidth:"wide"})};function Kn(n){return(t,e={})=>{const i=e.width,s=i&&n.matchPatterns[i]||n.matchPatterns[n.defaultMatchWidth],o=t.match(s);if(!o)return null;const r=o[0],l=i&&n.parsePatterns[i]||n.parsePatterns[n.defaultParseWidth],c=Array.isArray(l)?Wg(l,h=>h.test(r)):zg(l,h=>h.test(r));let d;d=n.valueCallback?n.valueCallback(c):c,d=e.valueCallback?e.valueCallback(d):d;const u=t.slice(r.length);return{value:d,rest:u}}}function zg(n,t){for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)&&t(n[e]))return e}function Wg(n,t){for(let e=0;e<n.length;e++)if(t(n[e]))return e}function Hg(n){return(t,e={})=>{const i=t.match(n.matchPattern);if(!i)return null;const s=i[0],o=t.match(n.parsePattern);if(!o)return null;let r=n.valueCallback?n.valueCallback(o[0]):o[0];r=e.valueCallback?e.valueCallback(r):r;const l=t.slice(s.length);return{value:r,rest:l}}}const Ug=/^(\d+)(th|st|nd|rd)?/i,qg=/\d+/i,Yg={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Kg={any:[/^b/i,/^(a|c)/i]},Xg={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Gg={any:[/1/i,/2/i,/3/i,/4/i]},Qg={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Jg={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Zg={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},ty={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},ey={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},ny={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},iy={ordinalNumber:Hg({matchPattern:Ug,parsePattern:qg,valueCallback:n=>parseInt(n,10)}),era:Kn({matchPatterns:Yg,defaultMatchWidth:"wide",parsePatterns:Kg,defaultParseWidth:"any"}),quarter:Kn({matchPatterns:Xg,defaultMatchWidth:"wide",parsePatterns:Gg,defaultParseWidth:"any",valueCallback:n=>n+1}),month:Kn({matchPatterns:Qg,defaultMatchWidth:"wide",parsePatterns:Jg,defaultParseWidth:"any"}),day:Kn({matchPatterns:Zg,defaultMatchWidth:"wide",parsePatterns:ty,defaultParseWidth:"any"}),dayPeriod:Kn({matchPatterns:ey,defaultMatchWidth:"any",parsePatterns:ny,defaultParseWidth:"any"})},sy={code:"en-US",formatDistance:Dg,formatLong:Mg,formatRelative:Ag,localize:jg,match:iy,options:{weekStartsOn:0,firstWeekContainsDate:1}};function oy(n,t){const e=ne(n,t==null?void 0:t.in);return Sg(e,vg(e))+1}function ry(n,t){const e=ne(n,t==null?void 0:t.in),i=+qi(e)-+wg(e);return Math.round(i/Ea)+1}function Na(n,t){var u,h,f,m;const e=ne(n,t==null?void 0:t.in),i=e.getFullYear(),s=Ui(),o=(t==null?void 0:t.firstWeekContainsDate)??((h=(u=t==null?void 0:t.locale)==null?void 0:u.options)==null?void 0:h.firstWeekContainsDate)??s.firstWeekContainsDate??((m=(f=s.locale)==null?void 0:f.options)==null?void 0:m.firstWeekContainsDate)??1,r=Ae((t==null?void 0:t.in)||n,0);r.setFullYear(i+1,0,o),r.setHours(0,0,0,0);const l=qn(r,t),c=Ae((t==null?void 0:t.in)||n,0);c.setFullYear(i,0,o),c.setHours(0,0,0,0);const d=qn(c,t);return+e>=+l?i+1:+e>=+d?i:i-1}function ay(n,t){var l,c,d,u;const e=Ui(),i=(t==null?void 0:t.firstWeekContainsDate)??((c=(l=t==null?void 0:t.locale)==null?void 0:l.options)==null?void 0:c.firstWeekContainsDate)??e.firstWeekContainsDate??((u=(d=e.locale)==null?void 0:d.options)==null?void 0:u.firstWeekContainsDate)??1,s=Na(n,t),o=Ae((t==null?void 0:t.in)||n,0);return o.setFullYear(s,0,i),o.setHours(0,0,0,0),qn(o,t)}function ly(n,t){const e=ne(n,t==null?void 0:t.in),i=+qn(e,t)-+ay(e,t);return Math.round(i/Ea)+1}function at(n,t){const e=n<0?"-":"",i=Math.abs(n).toString().padStart(t,"0");return e+i}const Be={y(n,t){const e=n.getFullYear(),i=e>0?e:1-e;return at(t==="yy"?i%100:i,t.length)},M(n,t){const e=n.getMonth();return t==="M"?String(e+1):at(e+1,2)},d(n,t){return at(n.getDate(),t.length)},a(n,t){const e=n.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return e.toUpperCase();case"aaa":return e;case"aaaaa":return e[0];case"aaaa":default:return e==="am"?"a.m.":"p.m."}},h(n,t){return at(n.getHours()%12||12,t.length)},H(n,t){return at(n.getHours(),t.length)},m(n,t){return at(n.getMinutes(),t.length)},s(n,t){return at(n.getSeconds(),t.length)},S(n,t){const e=t.length,i=n.getMilliseconds(),s=Math.trunc(i*Math.pow(10,e-3));return at(s,t.length)}},yn={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Ta={G:function(n,t,e){const i=n.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return e.era(i,{width:"abbreviated"});case"GGGGG":return e.era(i,{width:"narrow"});case"GGGG":default:return e.era(i,{width:"wide"})}},y:function(n,t,e){if(t==="yo"){const i=n.getFullYear(),s=i>0?i:1-i;return e.ordinalNumber(s,{unit:"year"})}return Be.y(n,t)},Y:function(n,t,e,i){const s=Na(n,i),o=s>0?s:1-s;if(t==="YY"){const r=o%100;return at(r,2)}return t==="Yo"?e.ordinalNumber(o,{unit:"year"}):at(o,t.length)},R:function(n,t){const e=va(n);return at(e,t.length)},u:function(n,t){const e=n.getFullYear();return at(e,t.length)},Q:function(n,t,e){const i=Math.ceil((n.getMonth()+1)/3);switch(t){case"Q":return String(i);case"QQ":return at(i,2);case"Qo":return e.ordinalNumber(i,{unit:"quarter"});case"QQQ":return e.quarter(i,{width:"abbreviated",context:"formatting"});case"QQQQQ":return e.quarter(i,{width:"narrow",context:"formatting"});case"QQQQ":default:return e.quarter(i,{width:"wide",context:"formatting"})}},q:function(n,t,e){const i=Math.ceil((n.getMonth()+1)/3);switch(t){case"q":return String(i);case"qq":return at(i,2);case"qo":return e.ordinalNumber(i,{unit:"quarter"});case"qqq":return e.quarter(i,{width:"abbreviated",context:"standalone"});case"qqqqq":return e.quarter(i,{width:"narrow",context:"standalone"});case"qqqq":default:return e.quarter(i,{width:"wide",context:"standalone"})}},M:function(n,t,e){const i=n.getMonth();switch(t){case"M":case"MM":return Be.M(n,t);case"Mo":return e.ordinalNumber(i+1,{unit:"month"});case"MMM":return e.month(i,{width:"abbreviated",context:"formatting"});case"MMMMM":return e.month(i,{width:"narrow",context:"formatting"});case"MMMM":default:return e.month(i,{width:"wide",context:"formatting"})}},L:function(n,t,e){const i=n.getMonth();switch(t){case"L":return String(i+1);case"LL":return at(i+1,2);case"Lo":return e.ordinalNumber(i+1,{unit:"month"});case"LLL":return e.month(i,{width:"abbreviated",context:"standalone"});case"LLLLL":return e.month(i,{width:"narrow",context:"standalone"});case"LLLL":default:return e.month(i,{width:"wide",context:"standalone"})}},w:function(n,t,e,i){const s=ly(n,i);return t==="wo"?e.ordinalNumber(s,{unit:"week"}):at(s,t.length)},I:function(n,t,e){const i=ry(n);return t==="Io"?e.ordinalNumber(i,{unit:"week"}):at(i,t.length)},d:function(n,t,e){return t==="do"?e.ordinalNumber(n.getDate(),{unit:"date"}):Be.d(n,t)},D:function(n,t,e){const i=oy(n);return t==="Do"?e.ordinalNumber(i,{unit:"dayOfYear"}):at(i,t.length)},E:function(n,t,e){const i=n.getDay();switch(t){case"E":case"EE":case"EEE":return e.day(i,{width:"abbreviated",context:"formatting"});case"EEEEE":return e.day(i,{width:"narrow",context:"formatting"});case"EEEEEE":return e.day(i,{width:"short",context:"formatting"});case"EEEE":default:return e.day(i,{width:"wide",context:"formatting"})}},e:function(n,t,e,i){const s=n.getDay(),o=(s-i.weekStartsOn+8)%7||7;switch(t){case"e":return String(o);case"ee":return at(o,2);case"eo":return e.ordinalNumber(o,{unit:"day"});case"eee":return e.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return e.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return e.day(s,{width:"short",context:"formatting"});case"eeee":default:return e.day(s,{width:"wide",context:"formatting"})}},c:function(n,t,e,i){const s=n.getDay(),o=(s-i.weekStartsOn+8)%7||7;switch(t){case"c":return String(o);case"cc":return at(o,t.length);case"co":return e.ordinalNumber(o,{unit:"day"});case"ccc":return e.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return e.day(s,{width:"narrow",context:"standalone"});case"cccccc":return e.day(s,{width:"short",context:"standalone"});case"cccc":default:return e.day(s,{width:"wide",context:"standalone"})}},i:function(n,t,e){const i=n.getDay(),s=i===0?7:i;switch(t){case"i":return String(s);case"ii":return at(s,t.length);case"io":return e.ordinalNumber(s,{unit:"day"});case"iii":return e.day(i,{width:"abbreviated",context:"formatting"});case"iiiii":return e.day(i,{width:"narrow",context:"formatting"});case"iiiiii":return e.day(i,{width:"short",context:"formatting"});case"iiii":default:return e.day(i,{width:"wide",context:"formatting"})}},a:function(n,t,e){const s=n.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return e.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return e.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return e.dayPeriod(s,{width:"narrow",context:"formatting"});case"aaaa":default:return e.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(n,t,e){const i=n.getHours();let s;switch(i===12?s=yn.noon:i===0?s=yn.midnight:s=i/12>=1?"pm":"am",t){case"b":case"bb":return e.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return e.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return e.dayPeriod(s,{width:"narrow",context:"formatting"});case"bbbb":default:return e.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(n,t,e){const i=n.getHours();let s;switch(i>=17?s=yn.evening:i>=12?s=yn.afternoon:i>=4?s=yn.morning:s=yn.night,t){case"B":case"BB":case"BBB":return e.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return e.dayPeriod(s,{width:"narrow",context:"formatting"});case"BBBB":default:return e.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(n,t,e){if(t==="ho"){let i=n.getHours()%12;return i===0&&(i=12),e.ordinalNumber(i,{unit:"hour"})}return Be.h(n,t)},H:function(n,t,e){return t==="Ho"?e.ordinalNumber(n.getHours(),{unit:"hour"}):Be.H(n,t)},K:function(n,t,e){const i=n.getHours()%12;return t==="Ko"?e.ordinalNumber(i,{unit:"hour"}):at(i,t.length)},k:function(n,t,e){let i=n.getHours();return i===0&&(i=24),t==="ko"?e.ordinalNumber(i,{unit:"hour"}):at(i,t.length)},m:function(n,t,e){return t==="mo"?e.ordinalNumber(n.getMinutes(),{unit:"minute"}):Be.m(n,t)},s:function(n,t,e){return t==="so"?e.ordinalNumber(n.getSeconds(),{unit:"second"}):Be.s(n,t)},S:function(n,t){return Be.S(n,t)},X:function(n,t,e){const i=n.getTimezoneOffset();if(i===0)return"Z";switch(t){case"X":return Ma(i);case"XXXX":case"XX":return Ge(i);case"XXXXX":case"XXX":default:return Ge(i,":")}},x:function(n,t,e){const i=n.getTimezoneOffset();switch(t){case"x":return Ma(i);case"xxxx":case"xx":return Ge(i);case"xxxxx":case"xxx":default:return Ge(i,":")}},O:function(n,t,e){const i=n.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Pa(i,":");case"OOOO":default:return"GMT"+Ge(i,":")}},z:function(n,t,e){const i=n.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Pa(i,":");case"zzzz":default:return"GMT"+Ge(i,":")}},t:function(n,t,e){const i=Math.trunc(+n/1e3);return at(i,t.length)},T:function(n,t,e){return at(+n,t.length)}};function Pa(n,t=""){const e=n>0?"-":"+",i=Math.abs(n),s=Math.trunc(i/60),o=i%60;return o===0?e+String(s):e+String(s)+t+at(o,2)}function Ma(n,t){return n%60===0?(n>0?"-":"+")+at(Math.abs(n)/60,2):Ge(n,t)}function Ge(n,t=""){const e=n>0?"-":"+",i=Math.abs(n),s=at(Math.trunc(i/60),2),o=at(i%60,2);return e+s+t+o}const Va=(n,t)=>{switch(n){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},Aa=(n,t)=>{switch(n){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},cy={p:Aa,P:(n,t)=>{const e=n.match(/(P+)(p+)?/)||[],i=e[1],s=e[2];if(!s)return Va(n,t);let o;switch(i){case"P":o=t.dateTime({width:"short"});break;case"PP":o=t.dateTime({width:"medium"});break;case"PPP":o=t.dateTime({width:"long"});break;case"PPPP":default:o=t.dateTime({width:"full"});break}return o.replace("{{date}}",Va(i,t)).replace("{{time}}",Aa(s,t))}},dy=/^D+$/,uy=/^Y+$/,hy=["D","DD","YY","YYYY"];function fy(n){return dy.test(n)}function my(n){return uy.test(n)}function py(n,t,e){const i=gy(n,t,e);if(console.warn(i),hy.includes(n))throw new RangeError(i)}function gy(n,t,e){const i=n[0]==="Y"?"years":"days of the month";return`Use \`${n.toLowerCase()}\` instead of \`${n}\` (in \`${t}\`) for formatting ${i} to the input \`${e}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const yy=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,by=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,_y=/^'([^]*?)'?$/,xy=/''/g,ky=/[a-zA-Z]/;function Ba(n,t,e){var u,h,f,m;const i=Ui(),s=i.locale??sy,o=i.firstWeekContainsDate??((h=(u=i.locale)==null?void 0:u.options)==null?void 0:h.firstWeekContainsDate)??1,r=i.weekStartsOn??((m=(f=i.locale)==null?void 0:f.options)==null?void 0:m.weekStartsOn)??0,l=ne(n,e==null?void 0:e.in);if(!Cg(l))throw new RangeError("Invalid time value");let c=t.match(by).map(p=>{const g=p[0];if(g==="p"||g==="P"){const y=cy[g];return y(p,s.formatLong)}return p}).join("").match(yy).map(p=>{if(p==="''")return{isToken:!1,value:"'"};const g=p[0];if(g==="'")return{isToken:!1,value:Sy(p)};if(Ta[g])return{isToken:!0,value:p};if(g.match(ky))throw new RangeError("Format string contains an unescaped latin alphabet character `"+g+"`");return{isToken:!1,value:p}});s.localize.preprocessor&&(c=s.localize.preprocessor(l,c));const d={firstWeekContainsDate:o,weekStartsOn:r,locale:s};return c.map(p=>{if(!p.isToken)return p.value;const g=p.value;(my(g)||fy(g))&&py(g,t,String(n));const y=Ta[g[0]];return y(l,g,s.localize,d)}).join("")}function Sy(n){const t=n.match(_y);return t?t[1].replace(xy,"'"):n}const wy=Object.freeze(Object.defineProperty({__proto__:null,default:{beforeMount(n,t){const{value:e,arg:i}=t;if(n&&e){const s=Ba(new Date(e),i||"yyyy-MM-dd");n.textContent=s}},updated(n,t){const{value:e,arg:i}=t;if(n&&e){const s=Ba(new Date(e),i||"yyyy-MM-dd");n.textContent=s}}}},Symbol.toStringTag,{value:"Module"})),Ey=Object.freeze(Object.defineProperty({__proto__:null,default:{beforeMount(n,t){const{value:e,arg:i}=t;e&&(n.textContent=n.textContent.toUpperCase())},updated(n,t){const{value:e,arg:i}=t;e&&(n.textContent=n.textContent.toUpperCase())}}},Symbol.toStringTag,{value:"Module"}));/*!
|
|
157
157
|
* @kurkle/color v0.3.4
|
|
158
158
|
* https://github.com/kurkle/color#readme
|
|
159
159
|
* (c) 2024 Jukka Kurkela
|
|
160
160
|
* Released under the MIT License
|
|
161
|
-
*/function Xn(n){return n+.5|0}const
|
|
161
|
+
*/function Xn(n){return n+.5|0}const Fe=(n,t,e)=>Math.max(Math.min(n,e),t);function Gn(n){return Fe(Xn(n*2.55),0,255)}function $e(n){return Fe(Xn(n*255),0,255)}function ke(n){return Fe(Xn(n/2.55)/100,0,1)}function Fa(n){return Fe(Xn(n*100),0,100)}const Yt={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},to=[..."0123456789ABCDEF"],Cy=n=>to[n&15],vy=n=>to[(n&240)>>4]+to[n&15],Yi=n=>(n&240)>>4===(n&15),Oy=n=>Yi(n.r)&&Yi(n.g)&&Yi(n.b)&&Yi(n.a);function Dy(n){var t=n.length,e;return n[0]==="#"&&(t===4||t===5?e={r:255&Yt[n[1]]*17,g:255&Yt[n[2]]*17,b:255&Yt[n[3]]*17,a:t===5?Yt[n[4]]*17:255}:(t===7||t===9)&&(e={r:Yt[n[1]]<<4|Yt[n[2]],g:Yt[n[3]]<<4|Yt[n[4]],b:Yt[n[5]]<<4|Yt[n[6]],a:t===9?Yt[n[7]]<<4|Yt[n[8]]:255})),e}const Ny=(n,t)=>n<255?t(n):"";function Ty(n){var t=Oy(n)?Cy:vy;return n?"#"+t(n.r)+t(n.g)+t(n.b)+Ny(n.a,t):void 0}const Py=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function $a(n,t,e){const i=t*Math.min(e,1-e),s=(o,r=(o+n/30)%12)=>e-i*Math.max(Math.min(r-3,9-r,1),-1);return[s(0),s(8),s(4)]}function My(n,t,e){const i=(s,o=(s+n/60)%6)=>e-e*t*Math.max(Math.min(o,4-o,1),0);return[i(5),i(3),i(1)]}function Vy(n,t,e){const i=$a(n,1,.5);let s;for(t+e>1&&(s=1/(t+e),t*=s,e*=s),s=0;s<3;s++)i[s]*=1-t-e,i[s]+=t;return i}function Ay(n,t,e,i,s){return n===s?(t-e)/i+(t<e?6:0):t===s?(e-n)/i+2:(n-t)/i+4}function eo(n){const e=n.r/255,i=n.g/255,s=n.b/255,o=Math.max(e,i,s),r=Math.min(e,i,s),l=(o+r)/2;let c,d,u;return o!==r&&(u=o-r,d=l>.5?u/(2-o-r):u/(o+r),c=Ay(e,i,s,u,o),c=c*60+.5),[c|0,d||0,l]}function no(n,t,e,i){return(Array.isArray(t)?n(t[0],t[1],t[2]):n(t,e,i)).map($e)}function io(n,t,e){return no($a,n,t,e)}function By(n,t,e){return no(Vy,n,t,e)}function Fy(n,t,e){return no(My,n,t,e)}function Ra(n){return(n%360+360)%360}function $y(n){const t=Py.exec(n);let e=255,i;if(!t)return;t[5]!==i&&(e=t[6]?Gn(+t[5]):$e(+t[5]));const s=Ra(+t[2]),o=+t[3]/100,r=+t[4]/100;return t[1]==="hwb"?i=By(s,o,r):t[1]==="hsv"?i=Fy(s,o,r):i=io(s,o,r),{r:i[0],g:i[1],b:i[2],a:e}}function Ry(n,t){var e=eo(n);e[0]=Ra(e[0]+t),e=io(e),n.r=e[0],n.g=e[1],n.b=e[2]}function Ly(n){if(!n)return;const t=eo(n),e=t[0],i=Fa(t[1]),s=Fa(t[2]);return n.a<255?`hsla(${e}, ${i}%, ${s}%, ${ke(n.a)})`:`hsl(${e}, ${i}%, ${s}%)`}const La={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},Ia={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};function Iy(){const n={},t=Object.keys(Ia),e=Object.keys(La);let i,s,o,r,l;for(i=0;i<t.length;i++){for(r=l=t[i],s=0;s<e.length;s++)o=e[s],l=l.replace(o,La[o]);o=parseInt(Ia[r],16),n[l]=[o>>16&255,o>>8&255,o&255]}return n}let Ki;function jy(n){Ki||(Ki=Iy(),Ki.transparent=[0,0,0,0]);const t=Ki[n.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}const zy=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function Wy(n){const t=zy.exec(n);let e=255,i,s,o;if(t){if(t[7]!==i){const r=+t[7];e=t[8]?Gn(r):Fe(r*255,0,255)}return i=+t[1],s=+t[3],o=+t[5],i=255&(t[2]?Gn(i):Fe(i,0,255)),s=255&(t[4]?Gn(s):Fe(s,0,255)),o=255&(t[6]?Gn(o):Fe(o,0,255)),{r:i,g:s,b:o,a:e}}}function Hy(n){return n&&(n.a<255?`rgba(${n.r}, ${n.g}, ${n.b}, ${ke(n.a)})`:`rgb(${n.r}, ${n.g}, ${n.b})`)}const so=n=>n<=.0031308?n*12.92:Math.pow(n,1/2.4)*1.055-.055,bn=n=>n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4);function Uy(n,t,e){const i=bn(ke(n.r)),s=bn(ke(n.g)),o=bn(ke(n.b));return{r:$e(so(i+e*(bn(ke(t.r))-i))),g:$e(so(s+e*(bn(ke(t.g))-s))),b:$e(so(o+e*(bn(ke(t.b))-o))),a:n.a+e*(t.a-n.a)}}function Xi(n,t,e){if(n){let i=eo(n);i[t]=Math.max(0,Math.min(i[t]+i[t]*e,t===0?360:1)),i=io(i),n.r=i[0],n.g=i[1],n.b=i[2]}}function ja(n,t){return n&&Object.assign(t||{},n)}function za(n){var t={r:0,g:0,b:0,a:255};return Array.isArray(n)?n.length>=3&&(t={r:n[0],g:n[1],b:n[2],a:255},n.length>3&&(t.a=$e(n[3]))):(t=ja(n,{r:0,g:0,b:0,a:1}),t.a=$e(t.a)),t}function qy(n){return n.charAt(0)==="r"?Wy(n):$y(n)}class Qn{constructor(t){if(t instanceof Qn)return t;const e=typeof t;let i;e==="object"?i=za(t):e==="string"&&(i=Dy(t)||jy(t)||qy(t)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var t=ja(this._rgb);return t&&(t.a=ke(t.a)),t}set rgb(t){this._rgb=za(t)}rgbString(){return this._valid?Hy(this._rgb):void 0}hexString(){return this._valid?Ty(this._rgb):void 0}hslString(){return this._valid?Ly(this._rgb):void 0}mix(t,e){if(t){const i=this.rgb,s=t.rgb;let o;const r=e===o?.5:e,l=2*r-1,c=i.a-s.a,d=((l*c===-1?l:(l+c)/(1+l*c))+1)/2;o=1-d,i.r=255&d*i.r+o*s.r+.5,i.g=255&d*i.g+o*s.g+.5,i.b=255&d*i.b+o*s.b+.5,i.a=r*i.a+(1-r)*s.a,this.rgb=i}return this}interpolate(t,e){return t&&(this._rgb=Uy(this._rgb,t._rgb,e)),this}clone(){return new Qn(this.rgb)}alpha(t){return this._rgb.a=$e(t),this}clearer(t){const e=this._rgb;return e.a*=1-t,this}greyscale(){const t=this._rgb,e=Xn(t.r*.3+t.g*.59+t.b*.11);return t.r=t.g=t.b=e,this}opaquer(t){const e=this._rgb;return e.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return Xi(this._rgb,2,t),this}darken(t){return Xi(this._rgb,2,-t),this}saturate(t){return Xi(this._rgb,1,t),this}desaturate(t){return Xi(this._rgb,1,-t),this}rotate(t){return Ry(this._rgb,t),this}}/*!
|
|
162
162
|
* Chart.js v4.4.7
|
|
163
163
|
* https://www.chartjs.org
|
|
164
164
|
* (c) 2024 Chart.js Contributors
|
|
165
165
|
* Released under the MIT License
|
|
166
|
-
*/function Se(){}const Ay=(()=>{let n=0;return()=>n++})();function it(n){return n==null}function _t(n){if(Array.isArray&&Array.isArray(n))return!0;const t=Object.prototype.toString.call(n);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function et(n){return n!==null&&Object.prototype.toString.call(n)==="[object Object]"}function St(n){return(typeof n=="number"||n instanceof Number)&&isFinite(+n)}function zt(n,t){return St(n)?n:t}function Q(n,t){return typeof n>"u"?t:n}const Fy=(n,t)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100:+n/t,$a=(n,t)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100*t:+n;function ft(n,t,e){if(n&&typeof n.call=="function")return n.apply(e,t)}function lt(n,t,e,i){let s,o,r;if(_t(n))for(o=n.length,s=0;s<o;s++)t.call(e,n[s],s);else if(et(n))for(r=Object.keys(n),o=r.length,s=0;s<o;s++)t.call(e,n[r[s]],r[s])}function Ki(n,t){let e,i,s,o;if(!n||!t||n.length!==t.length)return!1;for(e=0,i=n.length;e<i;++e)if(s=n[e],o=t[e],s.datasetIndex!==o.datasetIndex||s.index!==o.index)return!1;return!0}function Xi(n){if(_t(n))return n.map(Xi);if(et(n)){const t=Object.create(null),e=Object.keys(n),i=e.length;let s=0;for(;s<i;++s)t[e[s]]=Xi(n[e[s]]);return t}return n}function Ra(n){return["__proto__","prototype","constructor"].indexOf(n)===-1}function By(n,t,e,i){if(!Ra(n))return;const s=t[n],o=e[n];et(s)&&et(o)?Jn(s,o,i):t[n]=Xi(o)}function Jn(n,t,e){const i=_t(t)?t:[t],s=i.length;if(!et(n))return n;e=e||{};const o=e.merger||By;let r;for(let a=0;a<s;++a){if(r=i[a],!et(r))continue;const c=Object.keys(r);for(let d=0,u=c.length;d<u;++d)o(c[d],n,r,e)}return n}function Zn(n,t){return Jn(n,t,{merger:$y})}function $y(n,t,e){if(!Ra(n))return;const i=t[n],s=e[n];et(i)&&et(s)?Zn(i,s):Object.prototype.hasOwnProperty.call(t,n)||(t[n]=Xi(s))}const La={"":n=>n,x:n=>n.x,y:n=>n.y};function Ry(n){const t=n.split("."),e=[];let i="";for(const s of t)i+=s,i.endsWith("\\")?i=i.slice(0,-1)+".":(e.push(i),i="");return e}function Ly(n){const t=Ry(n);return e=>{for(const i of t){if(i==="")break;e=e&&e[i]}return e}}function Re(n,t){return(La[t]||(La[t]=Ly(t)))(n)}function no(n){return n.charAt(0).toUpperCase()+n.slice(1)}const ti=n=>typeof n<"u",Le=n=>typeof n=="function",Ia=(n,t)=>{if(n.size!==t.size)return!1;for(const e of n)if(!t.has(e))return!1;return!0};function Iy(n){return n.type==="mouseup"||n.type==="click"||n.type==="contextmenu"}const mt=Math.PI,pt=2*mt,jy=pt+mt,Gi=Number.POSITIVE_INFINITY,zy=mt/180,wt=mt/2,Qe=mt/4,ja=mt*2/3,Ie=Math.log10,ce=Math.sign;function ei(n,t,e){return Math.abs(n-t)<e}function za(n){const t=Math.round(n);n=ei(n,t,n/1e3)?t:n;const e=Math.pow(10,Math.floor(Ie(n))),i=n/e;return(i<=1?1:i<=2?2:i<=5?5:10)*e}function Wy(n){const t=[],e=Math.sqrt(n);let i;for(i=1;i<e;i++)n%i===0&&(t.push(i),t.push(n/i));return e===(e|0)&&t.push(e),t.sort((s,o)=>s-o).pop(),t}function _n(n){return!isNaN(parseFloat(n))&&isFinite(n)}function Hy(n,t){const e=Math.round(n);return e-t<=n&&e+t>=n}function Wa(n,t,e){let i,s,o;for(i=0,s=n.length;i<s;i++)o=n[i][e],isNaN(o)||(t.min=Math.min(t.min,o),t.max=Math.max(t.max,o))}function ie(n){return n*(mt/180)}function io(n){return n*(180/mt)}function Ha(n){if(!St(n))return;let t=1,e=0;for(;Math.round(n*t)/t!==n;)t*=10,e++;return e}function Ua(n,t){const e=t.x-n.x,i=t.y-n.y,s=Math.sqrt(e*e+i*i);let o=Math.atan2(i,e);return o<-.5*mt&&(o+=pt),{angle:o,distance:s}}function so(n,t){return Math.sqrt(Math.pow(t.x-n.x,2)+Math.pow(t.y-n.y,2))}function Uy(n,t){return(n-t+jy)%pt-mt}function Wt(n){return(n%pt+pt)%pt}function ni(n,t,e,i){const s=Wt(n),o=Wt(t),r=Wt(e),a=Wt(o-s),c=Wt(r-s),d=Wt(s-o),u=Wt(s-r);return s===o||s===r||i&&o===r||a>c&&d<u}function Dt(n,t,e){return Math.max(t,Math.min(e,n))}function qy(n){return Dt(n,-32768,32767)}function we(n,t,e,i=1e-6){return n>=Math.min(t,e)-i&&n<=Math.max(t,e)+i}function oo(n,t,e){e=e||(r=>n[r]<t);let i=n.length-1,s=0,o;for(;i-s>1;)o=s+i>>1,e(o)?s=o:i=o;return{lo:s,hi:i}}const Ee=(n,t,e,i)=>oo(n,e,i?s=>{const o=n[s][t];return o<e||o===e&&n[s+1][t]===e}:s=>n[s][t]<e),Yy=(n,t,e)=>oo(n,e,i=>n[i][t]>=e);function Ky(n,t,e){let i=0,s=n.length;for(;i<s&&n[i]<t;)i++;for(;s>i&&n[s-1]>e;)s--;return i>0||s<n.length?n.slice(i,s):n}const qa=["push","pop","shift","splice","unshift"];function Xy(n,t){if(n._chartjs){n._chartjs.listeners.push(t);return}Object.defineProperty(n,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[t]}}),qa.forEach(e=>{const i="_onData"+no(e),s=n[e];Object.defineProperty(n,e,{configurable:!0,enumerable:!1,value(...o){const r=s.apply(this,o);return n._chartjs.listeners.forEach(a=>{typeof a[i]=="function"&&a[i](...o)}),r}})})}function Ya(n,t){const e=n._chartjs;if(!e)return;const i=e.listeners,s=i.indexOf(t);s!==-1&&i.splice(s,1),!(i.length>0)&&(qa.forEach(o=>{delete n[o]}),delete n._chartjs)}function Ka(n){const t=new Set(n);return t.size===n.length?n:Array.from(t)}const Xa=function(){return typeof window>"u"?function(n){return n()}:window.requestAnimationFrame}();function Ga(n,t){let e=[],i=!1;return function(...s){e=s,i||(i=!0,Xa.call(window,()=>{i=!1,n.apply(t,e)}))}}function Gy(n,t){let e;return function(...i){return t?(clearTimeout(e),e=setTimeout(n,t,i)):n.apply(this,i),t}}const ro=n=>n==="start"?"left":n==="end"?"right":"center",Mt=(n,t,e)=>n==="start"?t:n==="end"?e:(t+e)/2,Qy=(n,t,e,i)=>n===(i?"left":"right")?e:n==="center"?(t+e)/2:t;function Qa(n,t,e){const i=t.length;let s=0,o=i;if(n._sorted){const{iScale:r,_parsed:a}=n,c=r.axis,{min:d,max:u,minDefined:h,maxDefined:f}=r.getUserBounds();h&&(s=Dt(Math.min(Ee(a,c,d).lo,e?i:Ee(t,c,r.getPixelForValue(d)).lo),0,i-1)),f?o=Dt(Math.max(Ee(a,r.axis,u,!0).hi+1,e?0:Ee(t,c,r.getPixelForValue(u),!0).hi+1),s,i)-s:o=i-s}return{start:s,count:o}}function Ja(n){const{xScale:t,yScale:e,_scaleRanges:i}=n,s={xmin:t.min,xmax:t.max,ymin:e.min,ymax:e.max};if(!i)return n._scaleRanges=s,!0;const o=i.xmin!==t.min||i.xmax!==t.max||i.ymin!==e.min||i.ymax!==e.max;return Object.assign(i,s),o}const Qi=n=>n===0||n===1,Za=(n,t,e)=>-(Math.pow(2,10*(n-=1))*Math.sin((n-t)*pt/e)),tl=(n,t,e)=>Math.pow(2,-10*n)*Math.sin((n-t)*pt/e)+1,ii={linear:n=>n,easeInQuad:n=>n*n,easeOutQuad:n=>-n*(n-2),easeInOutQuad:n=>(n/=.5)<1?.5*n*n:-.5*(--n*(n-2)-1),easeInCubic:n=>n*n*n,easeOutCubic:n=>(n-=1)*n*n+1,easeInOutCubic:n=>(n/=.5)<1?.5*n*n*n:.5*((n-=2)*n*n+2),easeInQuart:n=>n*n*n*n,easeOutQuart:n=>-((n-=1)*n*n*n-1),easeInOutQuart:n=>(n/=.5)<1?.5*n*n*n*n:-.5*((n-=2)*n*n*n-2),easeInQuint:n=>n*n*n*n*n,easeOutQuint:n=>(n-=1)*n*n*n*n+1,easeInOutQuint:n=>(n/=.5)<1?.5*n*n*n*n*n:.5*((n-=2)*n*n*n*n+2),easeInSine:n=>-Math.cos(n*wt)+1,easeOutSine:n=>Math.sin(n*wt),easeInOutSine:n=>-.5*(Math.cos(mt*n)-1),easeInExpo:n=>n===0?0:Math.pow(2,10*(n-1)),easeOutExpo:n=>n===1?1:-Math.pow(2,-10*n)+1,easeInOutExpo:n=>Qi(n)?n:n<.5?.5*Math.pow(2,10*(n*2-1)):.5*(-Math.pow(2,-10*(n*2-1))+2),easeInCirc:n=>n>=1?n:-(Math.sqrt(1-n*n)-1),easeOutCirc:n=>Math.sqrt(1-(n-=1)*n),easeInOutCirc:n=>(n/=.5)<1?-.5*(Math.sqrt(1-n*n)-1):.5*(Math.sqrt(1-(n-=2)*n)+1),easeInElastic:n=>Qi(n)?n:Za(n,.075,.3),easeOutElastic:n=>Qi(n)?n:tl(n,.075,.3),easeInOutElastic(n){return Qi(n)?n:n<.5?.5*Za(n*2,.1125,.45):.5+.5*tl(n*2-1,.1125,.45)},easeInBack(n){return n*n*((1.70158+1)*n-1.70158)},easeOutBack(n){return(n-=1)*n*((1.70158+1)*n+1.70158)+1},easeInOutBack(n){let t=1.70158;return(n/=.5)<1?.5*(n*n*(((t*=1.525)+1)*n-t)):.5*((n-=2)*n*(((t*=1.525)+1)*n+t)+2)},easeInBounce:n=>1-ii.easeOutBounce(1-n),easeOutBounce(n){return n<1/2.75?7.5625*n*n:n<2/2.75?7.5625*(n-=1.5/2.75)*n+.75:n<2.5/2.75?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375},easeInOutBounce:n=>n<.5?ii.easeInBounce(n*2)*.5:ii.easeOutBounce(n*2-1)*.5+.5};function ao(n){if(n&&typeof n=="object"){const t=n.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function el(n){return ao(n)?n:new Qn(n)}function lo(n){return ao(n)?n:new Qn(n).saturate(.5).darken(.1).hexString()}const Jy=["x","y","borderWidth","radius","tension"],Zy=["color","borderColor","backgroundColor"];function tb(n){n.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),n.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>t!=="onProgress"&&t!=="onComplete"&&t!=="fn"}),n.set("animations",{colors:{type:"color",properties:Zy},numbers:{type:"number",properties:Jy}}),n.describe("animations",{_fallback:"animation"}),n.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>t|0}}}})}function eb(n){n.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const nl=new Map;function nb(n,t){t=t||{};const e=n+JSON.stringify(t);let i=nl.get(e);return i||(i=new Intl.NumberFormat(n,t),nl.set(e,i)),i}function si(n,t,e){return nb(t,e).format(n)}const il={values(n){return _t(n)?n:""+n},numeric(n,t,e){if(n===0)return"0";const i=this.chart.options.locale;let s,o=n;if(e.length>1){const d=Math.max(Math.abs(e[0].value),Math.abs(e[e.length-1].value));(d<1e-4||d>1e15)&&(s="scientific"),o=ib(n,e)}const r=Ie(Math.abs(o)),a=isNaN(r)?1:Math.max(Math.min(-1*Math.floor(r),20),0),c={notation:s,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(c,this.options.ticks.format),si(n,i,c)},logarithmic(n,t,e){if(n===0)return"0";const i=e[t].significand||n/Math.pow(10,Math.floor(Ie(n)));return[1,2,3,5,10,15].includes(i)||t>.8*e.length?il.numeric.call(this,n,t,e):""}};function ib(n,t){let e=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(e)>=1&&n!==Math.floor(n)&&(e=n-Math.floor(n)),e}var oi={formatters:il};function sb(n){n.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,e)=>e.lineWidth,tickColor:(t,e)=>e.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:oi.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),n.route("scale.ticks","color","","color"),n.route("scale.grid","color","","borderColor"),n.route("scale.border","color","","borderColor"),n.route("scale.title","color","","color"),n.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&t!=="callback"&&t!=="parser",_indexable:t=>t!=="borderDash"&&t!=="tickBorderDash"&&t!=="dash"}),n.describe("scales",{_fallback:"scale"}),n.describe("scale.ticks",{_scriptable:t=>t!=="backdropPadding"&&t!=="callback",_indexable:t=>t!=="backdropPadding"})}const Je=Object.create(null),co=Object.create(null);function ri(n,t){if(!t)return n;const e=t.split(".");for(let i=0,s=e.length;i<s;++i){const o=e[i];n=n[o]||(n[o]=Object.create(null))}return n}function uo(n,t,e){return typeof t=="string"?Jn(ri(n,t),e):Jn(ri(n,""),t)}class ob{constructor(t,e){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=i=>i.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(i,s)=>lo(s.backgroundColor),this.hoverBorderColor=(i,s)=>lo(s.borderColor),this.hoverColor=(i,s)=>lo(s.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(e)}set(t,e){return uo(this,t,e)}get(t){return ri(this,t)}describe(t,e){return uo(co,t,e)}override(t,e){return uo(Je,t,e)}route(t,e,i,s){const o=ri(this,t),r=ri(this,i),a="_"+e;Object.defineProperties(o,{[a]:{value:o[e],writable:!0},[e]:{enumerable:!0,get(){const c=this[a],d=r[s];return et(c)?Object.assign({},d,c):Q(c,d)},set(c){this[a]=c}}})}apply(t){t.forEach(e=>e(this))}}var gt=new ob({_scriptable:n=>!n.startsWith("on"),_indexable:n=>n!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[tb,eb,sb]);function rb(n){return!n||it(n.size)||it(n.family)?null:(n.style?n.style+" ":"")+(n.weight?n.weight+" ":"")+n.size+"px "+n.family}function Ji(n,t,e,i,s){let o=t[s];return o||(o=t[s]=n.measureText(s).width,e.push(s)),o>i&&(i=o),i}function ab(n,t,e,i){i=i||{};let s=i.data=i.data||{},o=i.garbageCollect=i.garbageCollect||[];i.font!==t&&(s=i.data={},o=i.garbageCollect=[],i.font=t),n.save(),n.font=t;let r=0;const a=e.length;let c,d,u,h,f;for(c=0;c<a;c++)if(h=e[c],h!=null&&!_t(h))r=Ji(n,s,o,r,h);else if(_t(h))for(d=0,u=h.length;d<u;d++)f=h[d],f!=null&&!_t(f)&&(r=Ji(n,s,o,r,f));n.restore();const m=o.length/2;if(m>e.length){for(c=0;c<m;c++)delete s[o[c]];o.splice(0,m)}return r}function Ze(n,t,e){const i=n.currentDevicePixelRatio,s=e!==0?Math.max(e/2,.5):0;return Math.round((t-s)*i)/i+s}function sl(n,t){!t&&!n||(t=t||n.getContext("2d"),t.save(),t.resetTransform(),t.clearRect(0,0,n.width,n.height),t.restore())}function ho(n,t,e,i){ol(n,t,e,i,null)}function ol(n,t,e,i,s){let o,r,a,c,d,u,h,f;const m=t.pointStyle,p=t.rotation,g=t.radius;let y=(p||0)*zy;if(m&&typeof m=="object"&&(o=m.toString(),o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]")){n.save(),n.translate(e,i),n.rotate(y),n.drawImage(m,-m.width/2,-m.height/2,m.width,m.height),n.restore();return}if(!(isNaN(g)||g<=0)){switch(n.beginPath(),m){default:s?n.ellipse(e,i,s/2,g,0,0,pt):n.arc(e,i,g,0,pt),n.closePath();break;case"triangle":u=s?s/2:g,n.moveTo(e+Math.sin(y)*u,i-Math.cos(y)*g),y+=ja,n.lineTo(e+Math.sin(y)*u,i-Math.cos(y)*g),y+=ja,n.lineTo(e+Math.sin(y)*u,i-Math.cos(y)*g),n.closePath();break;case"rectRounded":d=g*.516,c=g-d,r=Math.cos(y+Qe)*c,h=Math.cos(y+Qe)*(s?s/2-d:c),a=Math.sin(y+Qe)*c,f=Math.sin(y+Qe)*(s?s/2-d:c),n.arc(e-h,i-a,d,y-mt,y-wt),n.arc(e+f,i-r,d,y-wt,y),n.arc(e+h,i+a,d,y,y+wt),n.arc(e-f,i+r,d,y+wt,y+mt),n.closePath();break;case"rect":if(!p){c=Math.SQRT1_2*g,u=s?s/2:c,n.rect(e-u,i-c,2*u,2*c);break}y+=Qe;case"rectRot":h=Math.cos(y)*(s?s/2:g),r=Math.cos(y)*g,a=Math.sin(y)*g,f=Math.sin(y)*(s?s/2:g),n.moveTo(e-h,i-a),n.lineTo(e+f,i-r),n.lineTo(e+h,i+a),n.lineTo(e-f,i+r),n.closePath();break;case"crossRot":y+=Qe;case"cross":h=Math.cos(y)*(s?s/2:g),r=Math.cos(y)*g,a=Math.sin(y)*g,f=Math.sin(y)*(s?s/2:g),n.moveTo(e-h,i-a),n.lineTo(e+h,i+a),n.moveTo(e+f,i-r),n.lineTo(e-f,i+r);break;case"star":h=Math.cos(y)*(s?s/2:g),r=Math.cos(y)*g,a=Math.sin(y)*g,f=Math.sin(y)*(s?s/2:g),n.moveTo(e-h,i-a),n.lineTo(e+h,i+a),n.moveTo(e+f,i-r),n.lineTo(e-f,i+r),y+=Qe,h=Math.cos(y)*(s?s/2:g),r=Math.cos(y)*g,a=Math.sin(y)*g,f=Math.sin(y)*(s?s/2:g),n.moveTo(e-h,i-a),n.lineTo(e+h,i+a),n.moveTo(e+f,i-r),n.lineTo(e-f,i+r);break;case"line":r=s?s/2:Math.cos(y)*g,a=Math.sin(y)*g,n.moveTo(e-r,i-a),n.lineTo(e+r,i+a);break;case"dash":n.moveTo(e,i),n.lineTo(e+Math.cos(y)*(s?s/2:g),i+Math.sin(y)*g);break;case!1:n.closePath();break}n.fill(),t.borderWidth>0&&n.stroke()}}function ve(n,t,e){return e=e||.5,!t||n&&n.x>t.left-e&&n.x<t.right+e&&n.y>t.top-e&&n.y<t.bottom+e}function Zi(n,t){n.save(),n.beginPath(),n.rect(t.left,t.top,t.right-t.left,t.bottom-t.top),n.clip()}function ts(n){n.restore()}function lb(n,t,e,i,s){if(!t)return n.lineTo(e.x,e.y);if(s==="middle"){const o=(t.x+e.x)/2;n.lineTo(o,t.y),n.lineTo(o,e.y)}else s==="after"!=!!i?n.lineTo(t.x,e.y):n.lineTo(e.x,t.y);n.lineTo(e.x,e.y)}function cb(n,t,e,i){if(!t)return n.lineTo(e.x,e.y);n.bezierCurveTo(i?t.cp1x:t.cp2x,i?t.cp1y:t.cp2y,i?e.cp2x:e.cp1x,i?e.cp2y:e.cp1y,e.x,e.y)}function db(n,t){t.translation&&n.translate(t.translation[0],t.translation[1]),it(t.rotation)||n.rotate(t.rotation),t.color&&(n.fillStyle=t.color),t.textAlign&&(n.textAlign=t.textAlign),t.textBaseline&&(n.textBaseline=t.textBaseline)}function ub(n,t,e,i,s){if(s.strikethrough||s.underline){const o=n.measureText(i),r=t-o.actualBoundingBoxLeft,a=t+o.actualBoundingBoxRight,c=e-o.actualBoundingBoxAscent,d=e+o.actualBoundingBoxDescent,u=s.strikethrough?(c+d)/2:d;n.strokeStyle=n.fillStyle,n.beginPath(),n.lineWidth=s.decorationWidth||2,n.moveTo(r,u),n.lineTo(a,u),n.stroke()}}function hb(n,t){const e=n.fillStyle;n.fillStyle=t.color,n.fillRect(t.left,t.top,t.width,t.height),n.fillStyle=e}function tn(n,t,e,i,s,o={}){const r=_t(t)?t:[t],a=o.strokeWidth>0&&o.strokeColor!=="";let c,d;for(n.save(),n.font=s.string,db(n,o),c=0;c<r.length;++c)d=r[c],o.backdrop&&hb(n,o.backdrop),a&&(o.strokeColor&&(n.strokeStyle=o.strokeColor),it(o.strokeWidth)||(n.lineWidth=o.strokeWidth),n.strokeText(d,e,i,o.maxWidth)),n.fillText(d,e,i,o.maxWidth),ub(n,e,i,d,o),i+=Number(s.lineHeight);n.restore()}function ai(n,t){const{x:e,y:i,w:s,h:o,radius:r}=t;n.arc(e+r.topLeft,i+r.topLeft,r.topLeft,1.5*mt,mt,!0),n.lineTo(e,i+o-r.bottomLeft),n.arc(e+r.bottomLeft,i+o-r.bottomLeft,r.bottomLeft,mt,wt,!0),n.lineTo(e+s-r.bottomRight,i+o),n.arc(e+s-r.bottomRight,i+o-r.bottomRight,r.bottomRight,wt,0,!0),n.lineTo(e+s,i+r.topRight),n.arc(e+s-r.topRight,i+r.topRight,r.topRight,0,-wt,!0),n.lineTo(e+r.topLeft,i)}const fb=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,mb=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function pb(n,t){const e=(""+n).match(fb);if(!e||e[1]==="normal")return t*1.2;switch(n=+e[2],e[3]){case"px":return n;case"%":n/=100;break}return t*n}const gb=n=>+n||0;function fo(n,t){const e={},i=et(t),s=i?Object.keys(t):t,o=et(n)?i?r=>Q(n[r],n[t[r]]):r=>n[r]:()=>n;for(const r of s)e[r]=gb(o(r));return e}function rl(n){return fo(n,{top:"y",right:"x",bottom:"y",left:"x"})}function en(n){return fo(n,["topLeft","topRight","bottomLeft","bottomRight"])}function Vt(n){const t=rl(n);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function Ct(n,t){n=n||{},t=t||gt.font;let e=Q(n.size,t.size);typeof e=="string"&&(e=parseInt(e,10));let i=Q(n.style,t.style);i&&!(""+i).match(mb)&&(console.warn('Invalid font style specified: "'+i+'"'),i=void 0);const s={family:Q(n.family,t.family),lineHeight:pb(Q(n.lineHeight,t.lineHeight),e),size:e,style:i,weight:Q(n.weight,t.weight),string:""};return s.string=rb(s),s}function li(n,t,e,i){let s,o,r;for(s=0,o=n.length;s<o;++s)if(r=n[s],r!==void 0&&r!==void 0)return r}function yb(n,t,e){const{min:i,max:s}=n,o=$a(t,(s-i)/2),r=(a,c)=>e&&a===0?0:a+c;return{min:r(i,-Math.abs(o)),max:r(s,o)}}function je(n,t){return Object.assign(Object.create(n),t)}function mo(n,t=[""],e,i,s=()=>n[0]){const o=e||n;typeof i>"u"&&(i=ul("_fallback",n));const r={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:n,_rootScopes:o,_fallback:i,_getTarget:s,override:a=>mo([a,...n],t,o,i)};return new Proxy(r,{deleteProperty(a,c){return delete a[c],delete a._keys,delete n[0][c],!0},get(a,c){return ll(a,c,()=>vb(c,t,n,a))},getOwnPropertyDescriptor(a,c){return Reflect.getOwnPropertyDescriptor(a._scopes[0],c)},getPrototypeOf(){return Reflect.getPrototypeOf(n[0])},has(a,c){return hl(a).includes(c)},ownKeys(a){return hl(a)},set(a,c,d){const u=a._storage||(a._storage=s());return a[c]=u[c]=d,delete a._keys,!0}})}function xn(n,t,e,i){const s={_cacheable:!1,_proxy:n,_context:t,_subProxy:e,_stack:new Set,_descriptors:al(n,i),setContext:o=>xn(n,o,e,i),override:o=>xn(n.override(o),t,e,i)};return new Proxy(s,{deleteProperty(o,r){return delete o[r],delete n[r],!0},get(o,r,a){return ll(o,r,()=>_b(o,r,a))},getOwnPropertyDescriptor(o,r){return o._descriptors.allKeys?Reflect.has(n,r)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(n,r)},getPrototypeOf(){return Reflect.getPrototypeOf(n)},has(o,r){return Reflect.has(n,r)},ownKeys(){return Reflect.ownKeys(n)},set(o,r,a){return n[r]=a,delete o[r],!0}})}function al(n,t={scriptable:!0,indexable:!0}){const{_scriptable:e=t.scriptable,_indexable:i=t.indexable,_allKeys:s=t.allKeys}=n;return{allKeys:s,scriptable:e,indexable:i,isScriptable:Le(e)?e:()=>e,isIndexable:Le(i)?i:()=>i}}const bb=(n,t)=>n?n+no(t):t,po=(n,t)=>et(t)&&n!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function ll(n,t,e){if(Object.prototype.hasOwnProperty.call(n,t)||t==="constructor")return n[t];const i=e();return n[t]=i,i}function _b(n,t,e){const{_proxy:i,_context:s,_subProxy:o,_descriptors:r}=n;let a=i[t];return Le(a)&&r.isScriptable(t)&&(a=xb(t,a,n,e)),_t(a)&&a.length&&(a=kb(t,a,n,r.isIndexable)),po(t,a)&&(a=xn(a,s,o&&o[t],r)),a}function xb(n,t,e,i){const{_proxy:s,_context:o,_subProxy:r,_stack:a}=e;if(a.has(n))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+n);a.add(n);let c=t(o,r||i);return a.delete(n),po(n,c)&&(c=go(s._scopes,s,n,c)),c}function kb(n,t,e,i){const{_proxy:s,_context:o,_subProxy:r,_descriptors:a}=e;if(typeof o.index<"u"&&i(n))return t[o.index%t.length];if(et(t[0])){const c=t,d=s._scopes.filter(u=>u!==c);t=[];for(const u of c){const h=go(d,s,n,u);t.push(xn(h,o,r&&r[n],a))}}return t}function cl(n,t,e){return Le(n)?n(t,e):n}const Sb=(n,t)=>n===!0?t:typeof n=="string"?Re(t,n):void 0;function wb(n,t,e,i,s){for(const o of t){const r=Sb(e,o);if(r){n.add(r);const a=cl(r._fallback,e,s);if(typeof a<"u"&&a!==e&&a!==i)return a}else if(r===!1&&typeof i<"u"&&e!==i)return null}return!1}function go(n,t,e,i){const s=t._rootScopes,o=cl(t._fallback,e,i),r=[...n,...s],a=new Set;a.add(i);let c=dl(a,r,e,o||e,i);return c===null||typeof o<"u"&&o!==e&&(c=dl(a,r,o,c,i),c===null)?!1:mo(Array.from(a),[""],s,o,()=>Eb(t,e,i))}function dl(n,t,e,i,s){for(;e;)e=wb(n,t,e,i,s);return e}function Eb(n,t,e){const i=n._getTarget();t in i||(i[t]={});const s=i[t];return _t(s)&&et(e)?e:s||{}}function vb(n,t,e,i){let s;for(const o of t)if(s=ul(bb(o,n),e),typeof s<"u")return po(n,s)?go(e,i,n,s):s}function ul(n,t){for(const e of t){if(!e)continue;const i=e[n];if(typeof i<"u")return i}}function hl(n){let t=n._keys;return t||(t=n._keys=Cb(n._scopes)),t}function Cb(n){const t=new Set;for(const e of n)for(const i of Object.keys(e).filter(s=>!s.startsWith("_")))t.add(i);return Array.from(t)}function fl(n,t,e,i){const{iScale:s}=n,{key:o="r"}=this._parsing,r=new Array(i);let a,c,d,u;for(a=0,c=i;a<c;++a)d=a+e,u=t[d],r[a]={r:s.parse(Re(u,o),d)};return r}const Ob=Number.EPSILON||1e-14,kn=(n,t)=>t<n.length&&!n[t].skip&&n[t],ml=n=>n==="x"?"y":"x";function Db(n,t,e,i){const s=n.skip?t:n,o=t,r=e.skip?t:e,a=so(o,s),c=so(r,o);let d=a/(a+c),u=c/(a+c);d=isNaN(d)?0:d,u=isNaN(u)?0:u;const h=i*d,f=i*u;return{previous:{x:o.x-h*(r.x-s.x),y:o.y-h*(r.y-s.y)},next:{x:o.x+f*(r.x-s.x),y:o.y+f*(r.y-s.y)}}}function Nb(n,t,e){const i=n.length;let s,o,r,a,c,d=kn(n,0);for(let u=0;u<i-1;++u)if(c=d,d=kn(n,u+1),!(!c||!d)){if(ei(t[u],0,Ob)){e[u]=e[u+1]=0;continue}s=e[u]/t[u],o=e[u+1]/t[u],a=Math.pow(s,2)+Math.pow(o,2),!(a<=9)&&(r=3/Math.sqrt(a),e[u]=s*r*t[u],e[u+1]=o*r*t[u])}}function Tb(n,t,e="x"){const i=ml(e),s=n.length;let o,r,a,c=kn(n,0);for(let d=0;d<s;++d){if(r=a,a=c,c=kn(n,d+1),!a)continue;const u=a[e],h=a[i];r&&(o=(u-r[e])/3,a[`cp1${e}`]=u-o,a[`cp1${i}`]=h-o*t[d]),c&&(o=(c[e]-u)/3,a[`cp2${e}`]=u+o,a[`cp2${i}`]=h+o*t[d])}}function Pb(n,t="x"){const e=ml(t),i=n.length,s=Array(i).fill(0),o=Array(i);let r,a,c,d=kn(n,0);for(r=0;r<i;++r)if(a=c,c=d,d=kn(n,r+1),!!c){if(d){const u=d[t]-c[t];s[r]=u!==0?(d[e]-c[e])/u:0}o[r]=a?d?ce(s[r-1])!==ce(s[r])?0:(s[r-1]+s[r])/2:s[r-1]:s[r]}Nb(n,s,o),Tb(n,o,t)}function es(n,t,e){return Math.max(Math.min(n,e),t)}function Mb(n,t){let e,i,s,o,r,a=ve(n[0],t);for(e=0,i=n.length;e<i;++e)r=o,o=a,a=e<i-1&&ve(n[e+1],t),o&&(s=n[e],r&&(s.cp1x=es(s.cp1x,t.left,t.right),s.cp1y=es(s.cp1y,t.top,t.bottom)),a&&(s.cp2x=es(s.cp2x,t.left,t.right),s.cp2y=es(s.cp2y,t.top,t.bottom)))}function Vb(n,t,e,i,s){let o,r,a,c;if(t.spanGaps&&(n=n.filter(d=>!d.skip)),t.cubicInterpolationMode==="monotone")Pb(n,s);else{let d=i?n[n.length-1]:n[0];for(o=0,r=n.length;o<r;++o)a=n[o],c=Db(d,a,n[Math.min(o+1,r-(i?0:1))%r],t.tension),a.cp1x=c.previous.x,a.cp1y=c.previous.y,a.cp2x=c.next.x,a.cp2y=c.next.y,d=a}t.capBezierPoints&&Mb(n,e)}function yo(){return typeof window<"u"&&typeof document<"u"}function bo(n){let t=n.parentNode;return t&&t.toString()==="[object ShadowRoot]"&&(t=t.host),t}function ns(n,t,e){let i;return typeof n=="string"?(i=parseInt(n,10),n.indexOf("%")!==-1&&(i=i/100*t.parentNode[e])):i=n,i}const is=n=>n.ownerDocument.defaultView.getComputedStyle(n,null);function Ab(n,t){return is(n).getPropertyValue(t)}const Fb=["top","right","bottom","left"];function nn(n,t,e){const i={};e=e?"-"+e:"";for(let s=0;s<4;s++){const o=Fb[s];i[o]=parseFloat(n[t+"-"+o+e])||0}return i.width=i.left+i.right,i.height=i.top+i.bottom,i}const Bb=(n,t,e)=>(n>0||t>0)&&(!e||!e.shadowRoot);function $b(n,t){const e=n.touches,i=e&&e.length?e[0]:n,{offsetX:s,offsetY:o}=i;let r=!1,a,c;if(Bb(s,o,n.target))a=s,c=o;else{const d=t.getBoundingClientRect();a=i.clientX-d.left,c=i.clientY-d.top,r=!0}return{x:a,y:c,box:r}}function sn(n,t){if("native"in n)return n;const{canvas:e,currentDevicePixelRatio:i}=t,s=is(e),o=s.boxSizing==="border-box",r=nn(s,"padding"),a=nn(s,"border","width"),{x:c,y:d,box:u}=$b(n,e),h=r.left+(u&&a.left),f=r.top+(u&&a.top);let{width:m,height:p}=t;return o&&(m-=r.width+a.width,p-=r.height+a.height),{x:Math.round((c-h)/m*e.width/i),y:Math.round((d-f)/p*e.height/i)}}function Rb(n,t,e){let i,s;if(t===void 0||e===void 0){const o=n&&bo(n);if(!o)t=n.clientWidth,e=n.clientHeight;else{const r=o.getBoundingClientRect(),a=is(o),c=nn(a,"border","width"),d=nn(a,"padding");t=r.width-d.width-c.width,e=r.height-d.height-c.height,i=ns(a.maxWidth,o,"clientWidth"),s=ns(a.maxHeight,o,"clientHeight")}}return{width:t,height:e,maxWidth:i||Gi,maxHeight:s||Gi}}const ss=n=>Math.round(n*10)/10;function Lb(n,t,e,i){const s=is(n),o=nn(s,"margin"),r=ns(s.maxWidth,n,"clientWidth")||Gi,a=ns(s.maxHeight,n,"clientHeight")||Gi,c=Rb(n,t,e);let{width:d,height:u}=c;if(s.boxSizing==="content-box"){const f=nn(s,"border","width"),m=nn(s,"padding");d-=m.width+f.width,u-=m.height+f.height}return d=Math.max(0,d-o.width),u=Math.max(0,i?d/i:u-o.height),d=ss(Math.min(d,r,c.maxWidth)),u=ss(Math.min(u,a,c.maxHeight)),d&&!u&&(u=ss(d/2)),(t!==void 0||e!==void 0)&&i&&c.height&&u>c.height&&(u=c.height,d=ss(Math.floor(u*i))),{width:d,height:u}}function pl(n,t,e){const i=t||1,s=Math.floor(n.height*i),o=Math.floor(n.width*i);n.height=Math.floor(n.height),n.width=Math.floor(n.width);const r=n.canvas;return r.style&&(e||!r.style.height&&!r.style.width)&&(r.style.height=`${n.height}px`,r.style.width=`${n.width}px`),n.currentDevicePixelRatio!==i||r.height!==s||r.width!==o?(n.currentDevicePixelRatio=i,r.height=s,r.width=o,n.ctx.setTransform(i,0,0,i,0,0),!0):!1}const Ib=function(){let n=!1;try{const t={get passive(){return n=!0,!1}};yo()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch{}return n}();function gl(n,t){const e=Ab(n,t),i=e&&e.match(/^(\d+)(\.\d+)?px$/);return i?+i[1]:void 0}function on(n,t,e,i){return{x:n.x+e*(t.x-n.x),y:n.y+e*(t.y-n.y)}}function jb(n,t,e,i){return{x:n.x+e*(t.x-n.x),y:i==="middle"?e<.5?n.y:t.y:i==="after"?e<1?n.y:t.y:e>0?t.y:n.y}}function zb(n,t,e,i){const s={x:n.cp2x,y:n.cp2y},o={x:t.cp1x,y:t.cp1y},r=on(n,s,e),a=on(s,o,e),c=on(o,t,e),d=on(r,a,e),u=on(a,c,e);return on(d,u,e)}const Wb=function(n,t){return{x(e){return n+n+t-e},setWidth(e){t=e},textAlign(e){return e==="center"?e:e==="right"?"left":"right"},xPlus(e,i){return e-i},leftForLtr(e,i){return e-i}}},Hb=function(){return{x(n){return n},setWidth(n){},textAlign(n){return n},xPlus(n,t){return n+t},leftForLtr(n,t){return n}}};function Sn(n,t,e){return n?Wb(t,e):Hb()}function yl(n,t){let e,i;(t==="ltr"||t==="rtl")&&(e=n.canvas.style,i=[e.getPropertyValue("direction"),e.getPropertyPriority("direction")],e.setProperty("direction",t,"important"),n.prevTextDirection=i)}function bl(n,t){t!==void 0&&(delete n.prevTextDirection,n.canvas.style.setProperty("direction",t[0],t[1]))}function _l(n){return n==="angle"?{between:ni,compare:Uy,normalize:Wt}:{between:we,compare:(t,e)=>t-e,normalize:t=>t}}function xl({start:n,end:t,count:e,loop:i,style:s}){return{start:n%e,end:t%e,loop:i&&(t-n+1)%e===0,style:s}}function Ub(n,t,e){const{property:i,start:s,end:o}=e,{between:r,normalize:a}=_l(i),c=t.length;let{start:d,end:u,loop:h}=n,f,m;if(h){for(d+=c,u+=c,f=0,m=c;f<m&&r(a(t[d%c][i]),s,o);++f)d--,u--;d%=c,u%=c}return u<d&&(u+=c),{start:d,end:u,loop:h,style:n.style}}function kl(n,t,e){if(!e)return[n];const{property:i,start:s,end:o}=e,r=t.length,{compare:a,between:c,normalize:d}=_l(i),{start:u,end:h,loop:f,style:m}=Ub(n,t,e),p=[];let g=!1,y=null,b,_,w;const E=()=>c(s,w,b)&&a(s,w)!==0,k=()=>a(o,b)===0||c(o,w,b),v=()=>g||E(),S=()=>!g||k();for(let x=u,O=u;x<=h;++x)_=t[x%r],!_.skip&&(b=d(_[i]),b!==w&&(g=c(b,s,o),y===null&&v()&&(y=a(b,s)===0?x:O),y!==null&&S()&&(p.push(xl({start:y,end:x,loop:f,count:r,style:m})),y=null),O=x,w=b));return y!==null&&p.push(xl({start:y,end:h,loop:f,count:r,style:m})),p}function Sl(n,t){const e=[],i=n.segments;for(let s=0;s<i.length;s++){const o=kl(i[s],n.points,t);o.length&&e.push(...o)}return e}function qb(n,t,e,i){let s=0,o=t-1;if(e&&!i)for(;s<t&&!n[s].skip;)s++;for(;s<t&&n[s].skip;)s++;for(s%=t,e&&(o+=s);o>s&&n[o%t].skip;)o--;return o%=t,{start:s,end:o}}function Yb(n,t,e,i){const s=n.length,o=[];let r=t,a=n[t],c;for(c=t+1;c<=e;++c){const d=n[c%s];d.skip||d.stop?a.skip||(i=!1,o.push({start:t%s,end:(c-1)%s,loop:i}),t=r=d.stop?c:null):(r=c,a.skip&&(t=c)),a=d}return r!==null&&o.push({start:t%s,end:r%s,loop:i}),o}function Kb(n,t){const e=n.points,i=n.options.spanGaps,s=e.length;if(!s)return[];const o=!!n._loop,{start:r,end:a}=qb(e,s,o,i);if(i===!0)return wl(n,[{start:r,end:a,loop:o}],e,t);const c=a<r?a+s:a,d=!!n._fullLoop&&r===0&&a===s-1;return wl(n,Yb(e,r,c,d),e,t)}function wl(n,t,e,i){return!i||!i.setContext||!e?t:Xb(n,t,e,i)}function Xb(n,t,e,i){const s=n._chart.getContext(),o=El(n.options),{_datasetIndex:r,options:{spanGaps:a}}=n,c=e.length,d=[];let u=o,h=t[0].start,f=h;function m(p,g,y,b){const _=a?-1:1;if(p!==g){for(p+=c;e[p%c].skip;)p-=_;for(;e[g%c].skip;)g+=_;p%c!==g%c&&(d.push({start:p%c,end:g%c,loop:y,style:b}),u=b,h=g%c)}}for(const p of t){h=a?h:p.start;let g=e[h%c],y;for(f=h+1;f<=p.end;f++){const b=e[f%c];y=El(i.setContext(je(s,{type:"segment",p0:g,p1:b,p0DataIndex:(f-1)%c,p1DataIndex:f%c,datasetIndex:r}))),Gb(y,u)&&m(h,f-1,p.loop,u),g=b,u=y}h<f-1&&m(h,f-1,p.loop,u)}return d}function El(n){return{backgroundColor:n.backgroundColor,borderCapStyle:n.borderCapStyle,borderDash:n.borderDash,borderDashOffset:n.borderDashOffset,borderJoinStyle:n.borderJoinStyle,borderWidth:n.borderWidth,borderColor:n.borderColor}}function Gb(n,t){if(!t)return!1;const e=[],i=function(s,o){return ao(o)?(e.includes(o)||e.push(o),e.indexOf(o)):o};return JSON.stringify(n,i)!==JSON.stringify(t,i)}/*!
|
|
166
|
+
*/function Se(){}const Yy=(()=>{let n=0;return()=>n++})();function it(n){return n==null}function _t(n){if(Array.isArray&&Array.isArray(n))return!0;const t=Object.prototype.toString.call(n);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function et(n){return n!==null&&Object.prototype.toString.call(n)==="[object Object]"}function St(n){return(typeof n=="number"||n instanceof Number)&&isFinite(+n)}function zt(n,t){return St(n)?n:t}function Q(n,t){return typeof n>"u"?t:n}const Ky=(n,t)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100:+n/t,Wa=(n,t)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100*t:+n;function ft(n,t,e){if(n&&typeof n.call=="function")return n.apply(e,t)}function lt(n,t,e,i){let s,o,r;if(_t(n))for(o=n.length,s=0;s<o;s++)t.call(e,n[s],s);else if(et(n))for(r=Object.keys(n),o=r.length,s=0;s<o;s++)t.call(e,n[r[s]],r[s])}function Gi(n,t){let e,i,s,o;if(!n||!t||n.length!==t.length)return!1;for(e=0,i=n.length;e<i;++e)if(s=n[e],o=t[e],s.datasetIndex!==o.datasetIndex||s.index!==o.index)return!1;return!0}function Qi(n){if(_t(n))return n.map(Qi);if(et(n)){const t=Object.create(null),e=Object.keys(n),i=e.length;let s=0;for(;s<i;++s)t[e[s]]=Qi(n[e[s]]);return t}return n}function Ha(n){return["__proto__","prototype","constructor"].indexOf(n)===-1}function Xy(n,t,e,i){if(!Ha(n))return;const s=t[n],o=e[n];et(s)&&et(o)?Jn(s,o,i):t[n]=Qi(o)}function Jn(n,t,e){const i=_t(t)?t:[t],s=i.length;if(!et(n))return n;e=e||{};const o=e.merger||Xy;let r;for(let l=0;l<s;++l){if(r=i[l],!et(r))continue;const c=Object.keys(r);for(let d=0,u=c.length;d<u;++d)o(c[d],n,r,e)}return n}function Zn(n,t){return Jn(n,t,{merger:Gy})}function Gy(n,t,e){if(!Ha(n))return;const i=t[n],s=e[n];et(i)&&et(s)?Zn(i,s):Object.prototype.hasOwnProperty.call(t,n)||(t[n]=Qi(s))}const Ua={"":n=>n,x:n=>n.x,y:n=>n.y};function Qy(n){const t=n.split("."),e=[];let i="";for(const s of t)i+=s,i.endsWith("\\")?i=i.slice(0,-1)+".":(e.push(i),i="");return e}function Jy(n){const t=Qy(n);return e=>{for(const i of t){if(i==="")break;e=e&&e[i]}return e}}function Re(n,t){return(Ua[t]||(Ua[t]=Jy(t)))(n)}function oo(n){return n.charAt(0).toUpperCase()+n.slice(1)}const ti=n=>typeof n<"u",Le=n=>typeof n=="function",qa=(n,t)=>{if(n.size!==t.size)return!1;for(const e of n)if(!t.has(e))return!1;return!0};function Zy(n){return n.type==="mouseup"||n.type==="click"||n.type==="contextmenu"}const mt=Math.PI,pt=2*mt,tb=pt+mt,Ji=Number.POSITIVE_INFINITY,eb=mt/180,wt=mt/2,Qe=mt/4,Ya=mt*2/3,Ie=Math.log10,de=Math.sign;function ei(n,t,e){return Math.abs(n-t)<e}function Ka(n){const t=Math.round(n);n=ei(n,t,n/1e3)?t:n;const e=Math.pow(10,Math.floor(Ie(n))),i=n/e;return(i<=1?1:i<=2?2:i<=5?5:10)*e}function nb(n){const t=[],e=Math.sqrt(n);let i;for(i=1;i<e;i++)n%i===0&&(t.push(i),t.push(n/i));return e===(e|0)&&t.push(e),t.sort((s,o)=>s-o).pop(),t}function _n(n){return!isNaN(parseFloat(n))&&isFinite(n)}function ib(n,t){const e=Math.round(n);return e-t<=n&&e+t>=n}function Xa(n,t,e){let i,s,o;for(i=0,s=n.length;i<s;i++)o=n[i][e],isNaN(o)||(t.min=Math.min(t.min,o),t.max=Math.max(t.max,o))}function ie(n){return n*(mt/180)}function ro(n){return n*(180/mt)}function Ga(n){if(!St(n))return;let t=1,e=0;for(;Math.round(n*t)/t!==n;)t*=10,e++;return e}function Qa(n,t){const e=t.x-n.x,i=t.y-n.y,s=Math.sqrt(e*e+i*i);let o=Math.atan2(i,e);return o<-.5*mt&&(o+=pt),{angle:o,distance:s}}function ao(n,t){return Math.sqrt(Math.pow(t.x-n.x,2)+Math.pow(t.y-n.y,2))}function sb(n,t){return(n-t+tb)%pt-mt}function Wt(n){return(n%pt+pt)%pt}function ni(n,t,e,i){const s=Wt(n),o=Wt(t),r=Wt(e),l=Wt(o-s),c=Wt(r-s),d=Wt(s-o),u=Wt(s-r);return s===o||s===r||i&&o===r||l>c&&d<u}function Dt(n,t,e){return Math.max(t,Math.min(e,n))}function ob(n){return Dt(n,-32768,32767)}function we(n,t,e,i=1e-6){return n>=Math.min(t,e)-i&&n<=Math.max(t,e)+i}function lo(n,t,e){e=e||(r=>n[r]<t);let i=n.length-1,s=0,o;for(;i-s>1;)o=s+i>>1,e(o)?s=o:i=o;return{lo:s,hi:i}}const Ee=(n,t,e,i)=>lo(n,e,i?s=>{const o=n[s][t];return o<e||o===e&&n[s+1][t]===e}:s=>n[s][t]<e),rb=(n,t,e)=>lo(n,e,i=>n[i][t]>=e);function ab(n,t,e){let i=0,s=n.length;for(;i<s&&n[i]<t;)i++;for(;s>i&&n[s-1]>e;)s--;return i>0||s<n.length?n.slice(i,s):n}const Ja=["push","pop","shift","splice","unshift"];function lb(n,t){if(n._chartjs){n._chartjs.listeners.push(t);return}Object.defineProperty(n,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[t]}}),Ja.forEach(e=>{const i="_onData"+oo(e),s=n[e];Object.defineProperty(n,e,{configurable:!0,enumerable:!1,value(...o){const r=s.apply(this,o);return n._chartjs.listeners.forEach(l=>{typeof l[i]=="function"&&l[i](...o)}),r}})})}function Za(n,t){const e=n._chartjs;if(!e)return;const i=e.listeners,s=i.indexOf(t);s!==-1&&i.splice(s,1),!(i.length>0)&&(Ja.forEach(o=>{delete n[o]}),delete n._chartjs)}function tl(n){const t=new Set(n);return t.size===n.length?n:Array.from(t)}const el=function(){return typeof window>"u"?function(n){return n()}:window.requestAnimationFrame}();function nl(n,t){let e=[],i=!1;return function(...s){e=s,i||(i=!0,el.call(window,()=>{i=!1,n.apply(t,e)}))}}function cb(n,t){let e;return function(...i){return t?(clearTimeout(e),e=setTimeout(n,t,i)):n.apply(this,i),t}}const co=n=>n==="start"?"left":n==="end"?"right":"center",Mt=(n,t,e)=>n==="start"?t:n==="end"?e:(t+e)/2,db=(n,t,e,i)=>n===(i?"left":"right")?e:n==="center"?(t+e)/2:t;function il(n,t,e){const i=t.length;let s=0,o=i;if(n._sorted){const{iScale:r,_parsed:l}=n,c=r.axis,{min:d,max:u,minDefined:h,maxDefined:f}=r.getUserBounds();h&&(s=Dt(Math.min(Ee(l,c,d).lo,e?i:Ee(t,c,r.getPixelForValue(d)).lo),0,i-1)),f?o=Dt(Math.max(Ee(l,r.axis,u,!0).hi+1,e?0:Ee(t,c,r.getPixelForValue(u),!0).hi+1),s,i)-s:o=i-s}return{start:s,count:o}}function sl(n){const{xScale:t,yScale:e,_scaleRanges:i}=n,s={xmin:t.min,xmax:t.max,ymin:e.min,ymax:e.max};if(!i)return n._scaleRanges=s,!0;const o=i.xmin!==t.min||i.xmax!==t.max||i.ymin!==e.min||i.ymax!==e.max;return Object.assign(i,s),o}const Zi=n=>n===0||n===1,ol=(n,t,e)=>-(Math.pow(2,10*(n-=1))*Math.sin((n-t)*pt/e)),rl=(n,t,e)=>Math.pow(2,-10*n)*Math.sin((n-t)*pt/e)+1,ii={linear:n=>n,easeInQuad:n=>n*n,easeOutQuad:n=>-n*(n-2),easeInOutQuad:n=>(n/=.5)<1?.5*n*n:-.5*(--n*(n-2)-1),easeInCubic:n=>n*n*n,easeOutCubic:n=>(n-=1)*n*n+1,easeInOutCubic:n=>(n/=.5)<1?.5*n*n*n:.5*((n-=2)*n*n+2),easeInQuart:n=>n*n*n*n,easeOutQuart:n=>-((n-=1)*n*n*n-1),easeInOutQuart:n=>(n/=.5)<1?.5*n*n*n*n:-.5*((n-=2)*n*n*n-2),easeInQuint:n=>n*n*n*n*n,easeOutQuint:n=>(n-=1)*n*n*n*n+1,easeInOutQuint:n=>(n/=.5)<1?.5*n*n*n*n*n:.5*((n-=2)*n*n*n*n+2),easeInSine:n=>-Math.cos(n*wt)+1,easeOutSine:n=>Math.sin(n*wt),easeInOutSine:n=>-.5*(Math.cos(mt*n)-1),easeInExpo:n=>n===0?0:Math.pow(2,10*(n-1)),easeOutExpo:n=>n===1?1:-Math.pow(2,-10*n)+1,easeInOutExpo:n=>Zi(n)?n:n<.5?.5*Math.pow(2,10*(n*2-1)):.5*(-Math.pow(2,-10*(n*2-1))+2),easeInCirc:n=>n>=1?n:-(Math.sqrt(1-n*n)-1),easeOutCirc:n=>Math.sqrt(1-(n-=1)*n),easeInOutCirc:n=>(n/=.5)<1?-.5*(Math.sqrt(1-n*n)-1):.5*(Math.sqrt(1-(n-=2)*n)+1),easeInElastic:n=>Zi(n)?n:ol(n,.075,.3),easeOutElastic:n=>Zi(n)?n:rl(n,.075,.3),easeInOutElastic(n){return Zi(n)?n:n<.5?.5*ol(n*2,.1125,.45):.5+.5*rl(n*2-1,.1125,.45)},easeInBack(n){return n*n*((1.70158+1)*n-1.70158)},easeOutBack(n){return(n-=1)*n*((1.70158+1)*n+1.70158)+1},easeInOutBack(n){let t=1.70158;return(n/=.5)<1?.5*(n*n*(((t*=1.525)+1)*n-t)):.5*((n-=2)*n*(((t*=1.525)+1)*n+t)+2)},easeInBounce:n=>1-ii.easeOutBounce(1-n),easeOutBounce(n){return n<1/2.75?7.5625*n*n:n<2/2.75?7.5625*(n-=1.5/2.75)*n+.75:n<2.5/2.75?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375},easeInOutBounce:n=>n<.5?ii.easeInBounce(n*2)*.5:ii.easeOutBounce(n*2-1)*.5+.5};function uo(n){if(n&&typeof n=="object"){const t=n.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function al(n){return uo(n)?n:new Qn(n)}function ho(n){return uo(n)?n:new Qn(n).saturate(.5).darken(.1).hexString()}const ub=["x","y","borderWidth","radius","tension"],hb=["color","borderColor","backgroundColor"];function fb(n){n.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),n.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>t!=="onProgress"&&t!=="onComplete"&&t!=="fn"}),n.set("animations",{colors:{type:"color",properties:hb},numbers:{type:"number",properties:ub}}),n.describe("animations",{_fallback:"animation"}),n.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>t|0}}}})}function mb(n){n.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const ll=new Map;function pb(n,t){t=t||{};const e=n+JSON.stringify(t);let i=ll.get(e);return i||(i=new Intl.NumberFormat(n,t),ll.set(e,i)),i}function si(n,t,e){return pb(t,e).format(n)}const cl={values(n){return _t(n)?n:""+n},numeric(n,t,e){if(n===0)return"0";const i=this.chart.options.locale;let s,o=n;if(e.length>1){const d=Math.max(Math.abs(e[0].value),Math.abs(e[e.length-1].value));(d<1e-4||d>1e15)&&(s="scientific"),o=gb(n,e)}const r=Ie(Math.abs(o)),l=isNaN(r)?1:Math.max(Math.min(-1*Math.floor(r),20),0),c={notation:s,minimumFractionDigits:l,maximumFractionDigits:l};return Object.assign(c,this.options.ticks.format),si(n,i,c)},logarithmic(n,t,e){if(n===0)return"0";const i=e[t].significand||n/Math.pow(10,Math.floor(Ie(n)));return[1,2,3,5,10,15].includes(i)||t>.8*e.length?cl.numeric.call(this,n,t,e):""}};function gb(n,t){let e=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(e)>=1&&n!==Math.floor(n)&&(e=n-Math.floor(n)),e}var oi={formatters:cl};function yb(n){n.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,e)=>e.lineWidth,tickColor:(t,e)=>e.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:oi.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),n.route("scale.ticks","color","","color"),n.route("scale.grid","color","","borderColor"),n.route("scale.border","color","","borderColor"),n.route("scale.title","color","","color"),n.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&t!=="callback"&&t!=="parser",_indexable:t=>t!=="borderDash"&&t!=="tickBorderDash"&&t!=="dash"}),n.describe("scales",{_fallback:"scale"}),n.describe("scale.ticks",{_scriptable:t=>t!=="backdropPadding"&&t!=="callback",_indexable:t=>t!=="backdropPadding"})}const Je=Object.create(null),fo=Object.create(null);function ri(n,t){if(!t)return n;const e=t.split(".");for(let i=0,s=e.length;i<s;++i){const o=e[i];n=n[o]||(n[o]=Object.create(null))}return n}function mo(n,t,e){return typeof t=="string"?Jn(ri(n,t),e):Jn(ri(n,""),t)}class bb{constructor(t,e){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=i=>i.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(i,s)=>ho(s.backgroundColor),this.hoverBorderColor=(i,s)=>ho(s.borderColor),this.hoverColor=(i,s)=>ho(s.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(e)}set(t,e){return mo(this,t,e)}get(t){return ri(this,t)}describe(t,e){return mo(fo,t,e)}override(t,e){return mo(Je,t,e)}route(t,e,i,s){const o=ri(this,t),r=ri(this,i),l="_"+e;Object.defineProperties(o,{[l]:{value:o[e],writable:!0},[e]:{enumerable:!0,get(){const c=this[l],d=r[s];return et(c)?Object.assign({},d,c):Q(c,d)},set(c){this[l]=c}}})}apply(t){t.forEach(e=>e(this))}}var gt=new bb({_scriptable:n=>!n.startsWith("on"),_indexable:n=>n!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[fb,mb,yb]);function _b(n){return!n||it(n.size)||it(n.family)?null:(n.style?n.style+" ":"")+(n.weight?n.weight+" ":"")+n.size+"px "+n.family}function ts(n,t,e,i,s){let o=t[s];return o||(o=t[s]=n.measureText(s).width,e.push(s)),o>i&&(i=o),i}function xb(n,t,e,i){i=i||{};let s=i.data=i.data||{},o=i.garbageCollect=i.garbageCollect||[];i.font!==t&&(s=i.data={},o=i.garbageCollect=[],i.font=t),n.save(),n.font=t;let r=0;const l=e.length;let c,d,u,h,f;for(c=0;c<l;c++)if(h=e[c],h!=null&&!_t(h))r=ts(n,s,o,r,h);else if(_t(h))for(d=0,u=h.length;d<u;d++)f=h[d],f!=null&&!_t(f)&&(r=ts(n,s,o,r,f));n.restore();const m=o.length/2;if(m>e.length){for(c=0;c<m;c++)delete s[o[c]];o.splice(0,m)}return r}function Ze(n,t,e){const i=n.currentDevicePixelRatio,s=e!==0?Math.max(e/2,.5):0;return Math.round((t-s)*i)/i+s}function dl(n,t){!t&&!n||(t=t||n.getContext("2d"),t.save(),t.resetTransform(),t.clearRect(0,0,n.width,n.height),t.restore())}function po(n,t,e,i){ul(n,t,e,i,null)}function ul(n,t,e,i,s){let o,r,l,c,d,u,h,f;const m=t.pointStyle,p=t.rotation,g=t.radius;let y=(p||0)*eb;if(m&&typeof m=="object"&&(o=m.toString(),o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]")){n.save(),n.translate(e,i),n.rotate(y),n.drawImage(m,-m.width/2,-m.height/2,m.width,m.height),n.restore();return}if(!(isNaN(g)||g<=0)){switch(n.beginPath(),m){default:s?n.ellipse(e,i,s/2,g,0,0,pt):n.arc(e,i,g,0,pt),n.closePath();break;case"triangle":u=s?s/2:g,n.moveTo(e+Math.sin(y)*u,i-Math.cos(y)*g),y+=Ya,n.lineTo(e+Math.sin(y)*u,i-Math.cos(y)*g),y+=Ya,n.lineTo(e+Math.sin(y)*u,i-Math.cos(y)*g),n.closePath();break;case"rectRounded":d=g*.516,c=g-d,r=Math.cos(y+Qe)*c,h=Math.cos(y+Qe)*(s?s/2-d:c),l=Math.sin(y+Qe)*c,f=Math.sin(y+Qe)*(s?s/2-d:c),n.arc(e-h,i-l,d,y-mt,y-wt),n.arc(e+f,i-r,d,y-wt,y),n.arc(e+h,i+l,d,y,y+wt),n.arc(e-f,i+r,d,y+wt,y+mt),n.closePath();break;case"rect":if(!p){c=Math.SQRT1_2*g,u=s?s/2:c,n.rect(e-u,i-c,2*u,2*c);break}y+=Qe;case"rectRot":h=Math.cos(y)*(s?s/2:g),r=Math.cos(y)*g,l=Math.sin(y)*g,f=Math.sin(y)*(s?s/2:g),n.moveTo(e-h,i-l),n.lineTo(e+f,i-r),n.lineTo(e+h,i+l),n.lineTo(e-f,i+r),n.closePath();break;case"crossRot":y+=Qe;case"cross":h=Math.cos(y)*(s?s/2:g),r=Math.cos(y)*g,l=Math.sin(y)*g,f=Math.sin(y)*(s?s/2:g),n.moveTo(e-h,i-l),n.lineTo(e+h,i+l),n.moveTo(e+f,i-r),n.lineTo(e-f,i+r);break;case"star":h=Math.cos(y)*(s?s/2:g),r=Math.cos(y)*g,l=Math.sin(y)*g,f=Math.sin(y)*(s?s/2:g),n.moveTo(e-h,i-l),n.lineTo(e+h,i+l),n.moveTo(e+f,i-r),n.lineTo(e-f,i+r),y+=Qe,h=Math.cos(y)*(s?s/2:g),r=Math.cos(y)*g,l=Math.sin(y)*g,f=Math.sin(y)*(s?s/2:g),n.moveTo(e-h,i-l),n.lineTo(e+h,i+l),n.moveTo(e+f,i-r),n.lineTo(e-f,i+r);break;case"line":r=s?s/2:Math.cos(y)*g,l=Math.sin(y)*g,n.moveTo(e-r,i-l),n.lineTo(e+r,i+l);break;case"dash":n.moveTo(e,i),n.lineTo(e+Math.cos(y)*(s?s/2:g),i+Math.sin(y)*g);break;case!1:n.closePath();break}n.fill(),t.borderWidth>0&&n.stroke()}}function Ce(n,t,e){return e=e||.5,!t||n&&n.x>t.left-e&&n.x<t.right+e&&n.y>t.top-e&&n.y<t.bottom+e}function es(n,t){n.save(),n.beginPath(),n.rect(t.left,t.top,t.right-t.left,t.bottom-t.top),n.clip()}function ns(n){n.restore()}function kb(n,t,e,i,s){if(!t)return n.lineTo(e.x,e.y);if(s==="middle"){const o=(t.x+e.x)/2;n.lineTo(o,t.y),n.lineTo(o,e.y)}else s==="after"!=!!i?n.lineTo(t.x,e.y):n.lineTo(e.x,t.y);n.lineTo(e.x,e.y)}function Sb(n,t,e,i){if(!t)return n.lineTo(e.x,e.y);n.bezierCurveTo(i?t.cp1x:t.cp2x,i?t.cp1y:t.cp2y,i?e.cp2x:e.cp1x,i?e.cp2y:e.cp1y,e.x,e.y)}function wb(n,t){t.translation&&n.translate(t.translation[0],t.translation[1]),it(t.rotation)||n.rotate(t.rotation),t.color&&(n.fillStyle=t.color),t.textAlign&&(n.textAlign=t.textAlign),t.textBaseline&&(n.textBaseline=t.textBaseline)}function Eb(n,t,e,i,s){if(s.strikethrough||s.underline){const o=n.measureText(i),r=t-o.actualBoundingBoxLeft,l=t+o.actualBoundingBoxRight,c=e-o.actualBoundingBoxAscent,d=e+o.actualBoundingBoxDescent,u=s.strikethrough?(c+d)/2:d;n.strokeStyle=n.fillStyle,n.beginPath(),n.lineWidth=s.decorationWidth||2,n.moveTo(r,u),n.lineTo(l,u),n.stroke()}}function Cb(n,t){const e=n.fillStyle;n.fillStyle=t.color,n.fillRect(t.left,t.top,t.width,t.height),n.fillStyle=e}function tn(n,t,e,i,s,o={}){const r=_t(t)?t:[t],l=o.strokeWidth>0&&o.strokeColor!=="";let c,d;for(n.save(),n.font=s.string,wb(n,o),c=0;c<r.length;++c)d=r[c],o.backdrop&&Cb(n,o.backdrop),l&&(o.strokeColor&&(n.strokeStyle=o.strokeColor),it(o.strokeWidth)||(n.lineWidth=o.strokeWidth),n.strokeText(d,e,i,o.maxWidth)),n.fillText(d,e,i,o.maxWidth),Eb(n,e,i,d,o),i+=Number(s.lineHeight);n.restore()}function ai(n,t){const{x:e,y:i,w:s,h:o,radius:r}=t;n.arc(e+r.topLeft,i+r.topLeft,r.topLeft,1.5*mt,mt,!0),n.lineTo(e,i+o-r.bottomLeft),n.arc(e+r.bottomLeft,i+o-r.bottomLeft,r.bottomLeft,mt,wt,!0),n.lineTo(e+s-r.bottomRight,i+o),n.arc(e+s-r.bottomRight,i+o-r.bottomRight,r.bottomRight,wt,0,!0),n.lineTo(e+s,i+r.topRight),n.arc(e+s-r.topRight,i+r.topRight,r.topRight,0,-wt,!0),n.lineTo(e+r.topLeft,i)}const vb=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,Ob=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function Db(n,t){const e=(""+n).match(vb);if(!e||e[1]==="normal")return t*1.2;switch(n=+e[2],e[3]){case"px":return n;case"%":n/=100;break}return t*n}const Nb=n=>+n||0;function go(n,t){const e={},i=et(t),s=i?Object.keys(t):t,o=et(n)?i?r=>Q(n[r],n[t[r]]):r=>n[r]:()=>n;for(const r of s)e[r]=Nb(o(r));return e}function hl(n){return go(n,{top:"y",right:"x",bottom:"y",left:"x"})}function en(n){return go(n,["topLeft","topRight","bottomLeft","bottomRight"])}function Vt(n){const t=hl(n);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function vt(n,t){n=n||{},t=t||gt.font;let e=Q(n.size,t.size);typeof e=="string"&&(e=parseInt(e,10));let i=Q(n.style,t.style);i&&!(""+i).match(Ob)&&(console.warn('Invalid font style specified: "'+i+'"'),i=void 0);const s={family:Q(n.family,t.family),lineHeight:Db(Q(n.lineHeight,t.lineHeight),e),size:e,style:i,weight:Q(n.weight,t.weight),string:""};return s.string=_b(s),s}function li(n,t,e,i){let s,o,r;for(s=0,o=n.length;s<o;++s)if(r=n[s],r!==void 0&&r!==void 0)return r}function Tb(n,t,e){const{min:i,max:s}=n,o=Wa(t,(s-i)/2),r=(l,c)=>e&&l===0?0:l+c;return{min:r(i,-Math.abs(o)),max:r(s,o)}}function je(n,t){return Object.assign(Object.create(n),t)}function yo(n,t=[""],e,i,s=()=>n[0]){const o=e||n;typeof i>"u"&&(i=yl("_fallback",n));const r={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:n,_rootScopes:o,_fallback:i,_getTarget:s,override:l=>yo([l,...n],t,o,i)};return new Proxy(r,{deleteProperty(l,c){return delete l[c],delete l._keys,delete n[0][c],!0},get(l,c){return ml(l,c,()=>Rb(c,t,n,l))},getOwnPropertyDescriptor(l,c){return Reflect.getOwnPropertyDescriptor(l._scopes[0],c)},getPrototypeOf(){return Reflect.getPrototypeOf(n[0])},has(l,c){return bl(l).includes(c)},ownKeys(l){return bl(l)},set(l,c,d){const u=l._storage||(l._storage=s());return l[c]=u[c]=d,delete l._keys,!0}})}function xn(n,t,e,i){const s={_cacheable:!1,_proxy:n,_context:t,_subProxy:e,_stack:new Set,_descriptors:fl(n,i),setContext:o=>xn(n,o,e,i),override:o=>xn(n.override(o),t,e,i)};return new Proxy(s,{deleteProperty(o,r){return delete o[r],delete n[r],!0},get(o,r,l){return ml(o,r,()=>Mb(o,r,l))},getOwnPropertyDescriptor(o,r){return o._descriptors.allKeys?Reflect.has(n,r)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(n,r)},getPrototypeOf(){return Reflect.getPrototypeOf(n)},has(o,r){return Reflect.has(n,r)},ownKeys(){return Reflect.ownKeys(n)},set(o,r,l){return n[r]=l,delete o[r],!0}})}function fl(n,t={scriptable:!0,indexable:!0}){const{_scriptable:e=t.scriptable,_indexable:i=t.indexable,_allKeys:s=t.allKeys}=n;return{allKeys:s,scriptable:e,indexable:i,isScriptable:Le(e)?e:()=>e,isIndexable:Le(i)?i:()=>i}}const Pb=(n,t)=>n?n+oo(t):t,bo=(n,t)=>et(t)&&n!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function ml(n,t,e){if(Object.prototype.hasOwnProperty.call(n,t)||t==="constructor")return n[t];const i=e();return n[t]=i,i}function Mb(n,t,e){const{_proxy:i,_context:s,_subProxy:o,_descriptors:r}=n;let l=i[t];return Le(l)&&r.isScriptable(t)&&(l=Vb(t,l,n,e)),_t(l)&&l.length&&(l=Ab(t,l,n,r.isIndexable)),bo(t,l)&&(l=xn(l,s,o&&o[t],r)),l}function Vb(n,t,e,i){const{_proxy:s,_context:o,_subProxy:r,_stack:l}=e;if(l.has(n))throw new Error("Recursion detected: "+Array.from(l).join("->")+"->"+n);l.add(n);let c=t(o,r||i);return l.delete(n),bo(n,c)&&(c=_o(s._scopes,s,n,c)),c}function Ab(n,t,e,i){const{_proxy:s,_context:o,_subProxy:r,_descriptors:l}=e;if(typeof o.index<"u"&&i(n))return t[o.index%t.length];if(et(t[0])){const c=t,d=s._scopes.filter(u=>u!==c);t=[];for(const u of c){const h=_o(d,s,n,u);t.push(xn(h,o,r&&r[n],l))}}return t}function pl(n,t,e){return Le(n)?n(t,e):n}const Bb=(n,t)=>n===!0?t:typeof n=="string"?Re(t,n):void 0;function Fb(n,t,e,i,s){for(const o of t){const r=Bb(e,o);if(r){n.add(r);const l=pl(r._fallback,e,s);if(typeof l<"u"&&l!==e&&l!==i)return l}else if(r===!1&&typeof i<"u"&&e!==i)return null}return!1}function _o(n,t,e,i){const s=t._rootScopes,o=pl(t._fallback,e,i),r=[...n,...s],l=new Set;l.add(i);let c=gl(l,r,e,o||e,i);return c===null||typeof o<"u"&&o!==e&&(c=gl(l,r,o,c,i),c===null)?!1:yo(Array.from(l),[""],s,o,()=>$b(t,e,i))}function gl(n,t,e,i,s){for(;e;)e=Fb(n,t,e,i,s);return e}function $b(n,t,e){const i=n._getTarget();t in i||(i[t]={});const s=i[t];return _t(s)&&et(e)?e:s||{}}function Rb(n,t,e,i){let s;for(const o of t)if(s=yl(Pb(o,n),e),typeof s<"u")return bo(n,s)?_o(e,i,n,s):s}function yl(n,t){for(const e of t){if(!e)continue;const i=e[n];if(typeof i<"u")return i}}function bl(n){let t=n._keys;return t||(t=n._keys=Lb(n._scopes)),t}function Lb(n){const t=new Set;for(const e of n)for(const i of Object.keys(e).filter(s=>!s.startsWith("_")))t.add(i);return Array.from(t)}function _l(n,t,e,i){const{iScale:s}=n,{key:o="r"}=this._parsing,r=new Array(i);let l,c,d,u;for(l=0,c=i;l<c;++l)d=l+e,u=t[d],r[l]={r:s.parse(Re(u,o),d)};return r}const Ib=Number.EPSILON||1e-14,kn=(n,t)=>t<n.length&&!n[t].skip&&n[t],xl=n=>n==="x"?"y":"x";function jb(n,t,e,i){const s=n.skip?t:n,o=t,r=e.skip?t:e,l=ao(o,s),c=ao(r,o);let d=l/(l+c),u=c/(l+c);d=isNaN(d)?0:d,u=isNaN(u)?0:u;const h=i*d,f=i*u;return{previous:{x:o.x-h*(r.x-s.x),y:o.y-h*(r.y-s.y)},next:{x:o.x+f*(r.x-s.x),y:o.y+f*(r.y-s.y)}}}function zb(n,t,e){const i=n.length;let s,o,r,l,c,d=kn(n,0);for(let u=0;u<i-1;++u)if(c=d,d=kn(n,u+1),!(!c||!d)){if(ei(t[u],0,Ib)){e[u]=e[u+1]=0;continue}s=e[u]/t[u],o=e[u+1]/t[u],l=Math.pow(s,2)+Math.pow(o,2),!(l<=9)&&(r=3/Math.sqrt(l),e[u]=s*r*t[u],e[u+1]=o*r*t[u])}}function Wb(n,t,e="x"){const i=xl(e),s=n.length;let o,r,l,c=kn(n,0);for(let d=0;d<s;++d){if(r=l,l=c,c=kn(n,d+1),!l)continue;const u=l[e],h=l[i];r&&(o=(u-r[e])/3,l[`cp1${e}`]=u-o,l[`cp1${i}`]=h-o*t[d]),c&&(o=(c[e]-u)/3,l[`cp2${e}`]=u+o,l[`cp2${i}`]=h+o*t[d])}}function Hb(n,t="x"){const e=xl(t),i=n.length,s=Array(i).fill(0),o=Array(i);let r,l,c,d=kn(n,0);for(r=0;r<i;++r)if(l=c,c=d,d=kn(n,r+1),!!c){if(d){const u=d[t]-c[t];s[r]=u!==0?(d[e]-c[e])/u:0}o[r]=l?d?de(s[r-1])!==de(s[r])?0:(s[r-1]+s[r])/2:s[r-1]:s[r]}zb(n,s,o),Wb(n,o,t)}function is(n,t,e){return Math.max(Math.min(n,e),t)}function Ub(n,t){let e,i,s,o,r,l=Ce(n[0],t);for(e=0,i=n.length;e<i;++e)r=o,o=l,l=e<i-1&&Ce(n[e+1],t),o&&(s=n[e],r&&(s.cp1x=is(s.cp1x,t.left,t.right),s.cp1y=is(s.cp1y,t.top,t.bottom)),l&&(s.cp2x=is(s.cp2x,t.left,t.right),s.cp2y=is(s.cp2y,t.top,t.bottom)))}function qb(n,t,e,i,s){let o,r,l,c;if(t.spanGaps&&(n=n.filter(d=>!d.skip)),t.cubicInterpolationMode==="monotone")Hb(n,s);else{let d=i?n[n.length-1]:n[0];for(o=0,r=n.length;o<r;++o)l=n[o],c=jb(d,l,n[Math.min(o+1,r-(i?0:1))%r],t.tension),l.cp1x=c.previous.x,l.cp1y=c.previous.y,l.cp2x=c.next.x,l.cp2y=c.next.y,d=l}t.capBezierPoints&&Ub(n,e)}function xo(){return typeof window<"u"&&typeof document<"u"}function ko(n){let t=n.parentNode;return t&&t.toString()==="[object ShadowRoot]"&&(t=t.host),t}function ss(n,t,e){let i;return typeof n=="string"?(i=parseInt(n,10),n.indexOf("%")!==-1&&(i=i/100*t.parentNode[e])):i=n,i}const os=n=>n.ownerDocument.defaultView.getComputedStyle(n,null);function Yb(n,t){return os(n).getPropertyValue(t)}const Kb=["top","right","bottom","left"];function nn(n,t,e){const i={};e=e?"-"+e:"";for(let s=0;s<4;s++){const o=Kb[s];i[o]=parseFloat(n[t+"-"+o+e])||0}return i.width=i.left+i.right,i.height=i.top+i.bottom,i}const Xb=(n,t,e)=>(n>0||t>0)&&(!e||!e.shadowRoot);function Gb(n,t){const e=n.touches,i=e&&e.length?e[0]:n,{offsetX:s,offsetY:o}=i;let r=!1,l,c;if(Xb(s,o,n.target))l=s,c=o;else{const d=t.getBoundingClientRect();l=i.clientX-d.left,c=i.clientY-d.top,r=!0}return{x:l,y:c,box:r}}function sn(n,t){if("native"in n)return n;const{canvas:e,currentDevicePixelRatio:i}=t,s=os(e),o=s.boxSizing==="border-box",r=nn(s,"padding"),l=nn(s,"border","width"),{x:c,y:d,box:u}=Gb(n,e),h=r.left+(u&&l.left),f=r.top+(u&&l.top);let{width:m,height:p}=t;return o&&(m-=r.width+l.width,p-=r.height+l.height),{x:Math.round((c-h)/m*e.width/i),y:Math.round((d-f)/p*e.height/i)}}function Qb(n,t,e){let i,s;if(t===void 0||e===void 0){const o=n&&ko(n);if(!o)t=n.clientWidth,e=n.clientHeight;else{const r=o.getBoundingClientRect(),l=os(o),c=nn(l,"border","width"),d=nn(l,"padding");t=r.width-d.width-c.width,e=r.height-d.height-c.height,i=ss(l.maxWidth,o,"clientWidth"),s=ss(l.maxHeight,o,"clientHeight")}}return{width:t,height:e,maxWidth:i||Ji,maxHeight:s||Ji}}const rs=n=>Math.round(n*10)/10;function Jb(n,t,e,i){const s=os(n),o=nn(s,"margin"),r=ss(s.maxWidth,n,"clientWidth")||Ji,l=ss(s.maxHeight,n,"clientHeight")||Ji,c=Qb(n,t,e);let{width:d,height:u}=c;if(s.boxSizing==="content-box"){const f=nn(s,"border","width"),m=nn(s,"padding");d-=m.width+f.width,u-=m.height+f.height}return d=Math.max(0,d-o.width),u=Math.max(0,i?d/i:u-o.height),d=rs(Math.min(d,r,c.maxWidth)),u=rs(Math.min(u,l,c.maxHeight)),d&&!u&&(u=rs(d/2)),(t!==void 0||e!==void 0)&&i&&c.height&&u>c.height&&(u=c.height,d=rs(Math.floor(u*i))),{width:d,height:u}}function kl(n,t,e){const i=t||1,s=Math.floor(n.height*i),o=Math.floor(n.width*i);n.height=Math.floor(n.height),n.width=Math.floor(n.width);const r=n.canvas;return r.style&&(e||!r.style.height&&!r.style.width)&&(r.style.height=`${n.height}px`,r.style.width=`${n.width}px`),n.currentDevicePixelRatio!==i||r.height!==s||r.width!==o?(n.currentDevicePixelRatio=i,r.height=s,r.width=o,n.ctx.setTransform(i,0,0,i,0,0),!0):!1}const Zb=function(){let n=!1;try{const t={get passive(){return n=!0,!1}};xo()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch{}return n}();function Sl(n,t){const e=Yb(n,t),i=e&&e.match(/^(\d+)(\.\d+)?px$/);return i?+i[1]:void 0}function on(n,t,e,i){return{x:n.x+e*(t.x-n.x),y:n.y+e*(t.y-n.y)}}function t_(n,t,e,i){return{x:n.x+e*(t.x-n.x),y:i==="middle"?e<.5?n.y:t.y:i==="after"?e<1?n.y:t.y:e>0?t.y:n.y}}function e_(n,t,e,i){const s={x:n.cp2x,y:n.cp2y},o={x:t.cp1x,y:t.cp1y},r=on(n,s,e),l=on(s,o,e),c=on(o,t,e),d=on(r,l,e),u=on(l,c,e);return on(d,u,e)}const n_=function(n,t){return{x(e){return n+n+t-e},setWidth(e){t=e},textAlign(e){return e==="center"?e:e==="right"?"left":"right"},xPlus(e,i){return e-i},leftForLtr(e,i){return e-i}}},i_=function(){return{x(n){return n},setWidth(n){},textAlign(n){return n},xPlus(n,t){return n+t},leftForLtr(n,t){return n}}};function Sn(n,t,e){return n?n_(t,e):i_()}function wl(n,t){let e,i;(t==="ltr"||t==="rtl")&&(e=n.canvas.style,i=[e.getPropertyValue("direction"),e.getPropertyPriority("direction")],e.setProperty("direction",t,"important"),n.prevTextDirection=i)}function El(n,t){t!==void 0&&(delete n.prevTextDirection,n.canvas.style.setProperty("direction",t[0],t[1]))}function Cl(n){return n==="angle"?{between:ni,compare:sb,normalize:Wt}:{between:we,compare:(t,e)=>t-e,normalize:t=>t}}function vl({start:n,end:t,count:e,loop:i,style:s}){return{start:n%e,end:t%e,loop:i&&(t-n+1)%e===0,style:s}}function s_(n,t,e){const{property:i,start:s,end:o}=e,{between:r,normalize:l}=Cl(i),c=t.length;let{start:d,end:u,loop:h}=n,f,m;if(h){for(d+=c,u+=c,f=0,m=c;f<m&&r(l(t[d%c][i]),s,o);++f)d--,u--;d%=c,u%=c}return u<d&&(u+=c),{start:d,end:u,loop:h,style:n.style}}function Ol(n,t,e){if(!e)return[n];const{property:i,start:s,end:o}=e,r=t.length,{compare:l,between:c,normalize:d}=Cl(i),{start:u,end:h,loop:f,style:m}=s_(n,t,e),p=[];let g=!1,y=null,b,_,w;const E=()=>c(s,w,b)&&l(s,w)!==0,k=()=>l(o,b)===0||c(o,w,b),C=()=>g||E(),S=()=>!g||k();for(let x=u,O=u;x<=h;++x)_=t[x%r],!_.skip&&(b=d(_[i]),b!==w&&(g=c(b,s,o),y===null&&C()&&(y=l(b,s)===0?x:O),y!==null&&S()&&(p.push(vl({start:y,end:x,loop:f,count:r,style:m})),y=null),O=x,w=b));return y!==null&&p.push(vl({start:y,end:h,loop:f,count:r,style:m})),p}function Dl(n,t){const e=[],i=n.segments;for(let s=0;s<i.length;s++){const o=Ol(i[s],n.points,t);o.length&&e.push(...o)}return e}function o_(n,t,e,i){let s=0,o=t-1;if(e&&!i)for(;s<t&&!n[s].skip;)s++;for(;s<t&&n[s].skip;)s++;for(s%=t,e&&(o+=s);o>s&&n[o%t].skip;)o--;return o%=t,{start:s,end:o}}function r_(n,t,e,i){const s=n.length,o=[];let r=t,l=n[t],c;for(c=t+1;c<=e;++c){const d=n[c%s];d.skip||d.stop?l.skip||(i=!1,o.push({start:t%s,end:(c-1)%s,loop:i}),t=r=d.stop?c:null):(r=c,l.skip&&(t=c)),l=d}return r!==null&&o.push({start:t%s,end:r%s,loop:i}),o}function a_(n,t){const e=n.points,i=n.options.spanGaps,s=e.length;if(!s)return[];const o=!!n._loop,{start:r,end:l}=o_(e,s,o,i);if(i===!0)return Nl(n,[{start:r,end:l,loop:o}],e,t);const c=l<r?l+s:l,d=!!n._fullLoop&&r===0&&l===s-1;return Nl(n,r_(e,r,c,d),e,t)}function Nl(n,t,e,i){return!i||!i.setContext||!e?t:l_(n,t,e,i)}function l_(n,t,e,i){const s=n._chart.getContext(),o=Tl(n.options),{_datasetIndex:r,options:{spanGaps:l}}=n,c=e.length,d=[];let u=o,h=t[0].start,f=h;function m(p,g,y,b){const _=l?-1:1;if(p!==g){for(p+=c;e[p%c].skip;)p-=_;for(;e[g%c].skip;)g+=_;p%c!==g%c&&(d.push({start:p%c,end:g%c,loop:y,style:b}),u=b,h=g%c)}}for(const p of t){h=l?h:p.start;let g=e[h%c],y;for(f=h+1;f<=p.end;f++){const b=e[f%c];y=Tl(i.setContext(je(s,{type:"segment",p0:g,p1:b,p0DataIndex:(f-1)%c,p1DataIndex:f%c,datasetIndex:r}))),c_(y,u)&&m(h,f-1,p.loop,u),g=b,u=y}h<f-1&&m(h,f-1,p.loop,u)}return d}function Tl(n){return{backgroundColor:n.backgroundColor,borderCapStyle:n.borderCapStyle,borderDash:n.borderDash,borderDashOffset:n.borderDashOffset,borderJoinStyle:n.borderJoinStyle,borderWidth:n.borderWidth,borderColor:n.borderColor}}function c_(n,t){if(!t)return!1;const e=[],i=function(s,o){return uo(o)?(e.includes(o)||e.push(o),e.indexOf(o)):o};return JSON.stringify(n,i)!==JSON.stringify(t,i)}/*!
|
|
167
167
|
* Chart.js v4.4.7
|
|
168
168
|
* https://www.chartjs.org
|
|
169
169
|
* (c) 2024 Chart.js Contributors
|
|
170
170
|
* Released under the MIT License
|
|
171
|
-
*/class Qb{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,i,s){const o=e.listeners[s],r=e.duration;o.forEach(a=>a({chart:t,initial:e.initial,numSteps:r,currentStep:Math.min(i-e.start,r)}))}_refresh(){this._request||(this._running=!0,this._request=Xa.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((i,s)=>{if(!i.running||!i.items.length)return;const o=i.items;let r=o.length-1,a=!1,c;for(;r>=0;--r)c=o[r],c._active?(c._total>i.duration&&(i.duration=c._total),c.tick(t),a=!0):(o[r]=o[o.length-1],o.pop());a&&(s.draw(),this._notify(s,i,t,"progress")),o.length||(i.running=!1,this._notify(s,i,t,"complete"),i.initial=!1),e+=o.length}),this._lastDate=t,e===0&&(this._running=!1)}_getAnims(t){const e=this._charts;let i=e.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,i)),i}listen(t,e,i){this._getAnims(t).listeners[e].push(i)}add(t,e){!e||!e.length||this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((i,s)=>Math.max(i,s._duration),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!(!e||!e.running||!e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const i=e.items;let s=i.length-1;for(;s>=0;--s)i[s].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var de=new Qb;const vl="transparent",Jb={boolean(n,t,e){return e>.5?t:n},color(n,t,e){const i=el(n||vl),s=i.valid&&el(t||vl);return s&&s.valid?s.mix(i,e).hexString():t},number(n,t,e){return n+(t-n)*e}};class Cl{constructor(t,e,i,s){const o=e[i];s=li([t.to,s,o,t.from]);const r=li([t.from,o,s]);this._active=!0,this._fn=t.fn||Jb[t.type||typeof r],this._easing=ii[t.easing]||ii.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=i,this._from=r,this._to=s,this._promises=void 0}active(){return this._active}update(t,e,i){if(this._active){this._notify(!1);const s=this._target[this._prop],o=i-this._start,r=this._duration-o;this._start=i,this._duration=Math.floor(Math.max(r,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=li([t.to,e,s,t.from]),this._from=li([t.from,s,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,i=this._duration,s=this._prop,o=this._from,r=this._loop,a=this._to;let c;if(this._active=o!==a&&(r||e<i),!this._active){this._target[s]=a,this._notify(!0);return}if(e<0){this._target[s]=o;return}c=e/i%2,c=r&&c>1?2-c:c,c=this._easing(Math.min(1,Math.max(0,c))),this._target[s]=this._fn(o,a,c)}wait(){const t=this._promises||(this._promises=[]);return new Promise((e,i)=>{t.push({res:e,rej:i})})}_notify(t){const e=t?"res":"rej",i=this._promises||[];for(let s=0;s<i.length;s++)i[s][e]()}}class _o{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!et(t))return;const e=Object.keys(gt.animation),i=this._properties;Object.getOwnPropertyNames(t).forEach(s=>{const o=t[s];if(!et(o))return;const r={};for(const a of e)r[a]=o[a];(_t(o.properties)&&o.properties||[s]).forEach(a=>{(a===s||!i.has(a))&&i.set(a,r)})})}_animateOptions(t,e){const i=e.options,s=t_(t,i);if(!s)return[];const o=this._createAnimations(s,i);return i.$shared&&Zb(t.options.$animations,i).then(()=>{t.options=i},()=>{}),o}_createAnimations(t,e){const i=this._properties,s=[],o=t.$animations||(t.$animations={}),r=Object.keys(e),a=Date.now();let c;for(c=r.length-1;c>=0;--c){const d=r[c];if(d.charAt(0)==="$")continue;if(d==="options"){s.push(...this._animateOptions(t,e));continue}const u=e[d];let h=o[d];const f=i.get(d);if(h)if(f&&h.active()){h.update(f,u,a);continue}else h.cancel();if(!f||!f.duration){t[d]=u;continue}o[d]=h=new Cl(f,t,d,u),s.push(h)}return s}update(t,e){if(this._properties.size===0){Object.assign(t,e);return}const i=this._createAnimations(t,e);if(i.length)return de.add(this._chart,i),!0}}function Zb(n,t){const e=[],i=Object.keys(t);for(let s=0;s<i.length;s++){const o=n[i[s]];o&&o.active()&&e.push(o.wait())}return Promise.all(e)}function t_(n,t){if(!t)return;let e=n.options;if(!e){n.options=t;return}return e.$shared&&(n.options=e=Object.assign({},e,{$shared:!1,$animations:{}})),e}function Ol(n,t){const e=n&&n.options||{},i=e.reverse,s=e.min===void 0?t:0,o=e.max===void 0?t:0;return{start:i?o:s,end:i?s:o}}function e_(n,t,e){if(e===!1)return!1;const i=Ol(n,e),s=Ol(t,e);return{top:s.end,right:i.end,bottom:s.start,left:i.start}}function n_(n){let t,e,i,s;return et(n)?(t=n.top,e=n.right,i=n.bottom,s=n.left):t=e=i=s=n,{top:t,right:e,bottom:i,left:s,disabled:n===!1}}function Dl(n,t){const e=[],i=n._getSortedDatasetMetas(t);let s,o;for(s=0,o=i.length;s<o;++s)e.push(i[s].index);return e}function Nl(n,t,e,i={}){const s=n.keys,o=i.mode==="single";let r,a,c,d;if(t===null)return;let u=!1;for(r=0,a=s.length;r<a;++r){if(c=+s[r],c===e){if(u=!0,i.all)continue;break}d=n.values[c],St(d)&&(o||t===0||ce(t)===ce(d))&&(t+=d)}return!u&&!i.all?0:t}function i_(n,t){const{iScale:e,vScale:i}=t,s=e.axis==="x"?"x":"y",o=i.axis==="x"?"x":"y",r=Object.keys(n),a=new Array(r.length);let c,d,u;for(c=0,d=r.length;c<d;++c)u=r[c],a[c]={[s]:u,[o]:n[u]};return a}function xo(n,t){const e=n&&n.options.stacked;return e||e===void 0&&t.stack!==void 0}function s_(n,t,e){return`${n.id}.${t.id}.${e.stack||e.type}`}function o_(n){const{min:t,max:e,minDefined:i,maxDefined:s}=n.getUserBounds();return{min:i?t:Number.NEGATIVE_INFINITY,max:s?e:Number.POSITIVE_INFINITY}}function r_(n,t,e){const i=n[t]||(n[t]={});return i[e]||(i[e]={})}function Tl(n,t,e,i){for(const s of t.getMatchingVisibleMetas(i).reverse()){const o=n[s.index];if(e&&o>0||!e&&o<0)return s.index}return null}function Pl(n,t){const{chart:e,_cachedMeta:i}=n,s=e._stacks||(e._stacks={}),{iScale:o,vScale:r,index:a}=i,c=o.axis,d=r.axis,u=s_(o,r,i),h=t.length;let f;for(let m=0;m<h;++m){const p=t[m],{[c]:g,[d]:y}=p,b=p._stacks||(p._stacks={});f=b[d]=r_(s,u,g),f[a]=y,f._top=Tl(f,r,!0,i.type),f._bottom=Tl(f,r,!1,i.type);const _=f._visualValues||(f._visualValues={});_[a]=y}}function ko(n,t){const e=n.scales;return Object.keys(e).filter(i=>e[i].axis===t).shift()}function a_(n,t){return je(n,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function l_(n,t,e){return je(n,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:e,index:t,mode:"default",type:"data"})}function ci(n,t){const e=n.controller.index,i=n.vScale&&n.vScale.axis;if(i){t=t||n._parsed;for(const s of t){const o=s._stacks;if(!o||o[i]===void 0||o[i][e]===void 0)return;delete o[i][e],o[i]._visualValues!==void 0&&o[i]._visualValues[e]!==void 0&&delete o[i]._visualValues[e]}}}const So=n=>n==="reset"||n==="none",Ml=(n,t)=>t?n:Object.assign({},n),c_=(n,t,e)=>n&&!t.hidden&&t._stacked&&{keys:Dl(e,!0),values:null};class Kt{constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=xo(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&ci(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,i=this.getDataset(),s=(h,f,m,p)=>h==="x"?f:h==="r"?p:m,o=e.xAxisID=Q(i.xAxisID,ko(t,"x")),r=e.yAxisID=Q(i.yAxisID,ko(t,"y")),a=e.rAxisID=Q(i.rAxisID,ko(t,"r")),c=e.indexAxis,d=e.iAxisID=s(c,o,r,a),u=e.vAxisID=s(c,r,o,a);e.xScale=this.getScaleForId(o),e.yScale=this.getScaleForId(r),e.rScale=this.getScaleForId(a),e.iScale=this.getScaleForId(d),e.vScale=this.getScaleForId(u)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&Ya(this._data,this),t._stacked&&ci(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if(et(e)){const s=this._cachedMeta;this._data=i_(e,s)}else if(i!==e){if(i){Ya(i,this);const s=this._cachedMeta;ci(s),s._parsed=[]}e&&Object.isExtensible(e)&&Xy(e,this),this._syncList=[],this._data=e}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const e=this._cachedMeta,i=this.getDataset();let s=!1;this._dataCheck();const o=e._stacked;e._stacked=xo(e.vScale,e),e.stack!==i.stack&&(s=!0,ci(e),e.stack=i.stack),this._resyncElements(t),(s||o!==e._stacked)&&(Pl(this,e._parsed),e._stacked=xo(e.vScale,e))}configure(){const t=this.chart.config,e=t.datasetScopeKeys(this._type),i=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){const{_cachedMeta:i,_data:s}=this,{iScale:o,_stacked:r}=i,a=o.axis;let c=t===0&&e===s.length?!0:i._sorted,d=t>0&&i._parsed[t-1],u,h,f;if(this._parsing===!1)i._parsed=s,i._sorted=!0,f=s;else{_t(s[t])?f=this.parseArrayData(i,s,t,e):et(s[t])?f=this.parseObjectData(i,s,t,e):f=this.parsePrimitiveData(i,s,t,e);const m=()=>h[a]===null||d&&h[a]<d[a];for(u=0;u<e;++u)i._parsed[u+t]=h=f[u],c&&(m()&&(c=!1),d=h);i._sorted=c}r&&Pl(this,f)}parsePrimitiveData(t,e,i,s){const{iScale:o,vScale:r}=t,a=o.axis,c=r.axis,d=o.getLabels(),u=o===r,h=new Array(s);let f,m,p;for(f=0,m=s;f<m;++f)p=f+i,h[f]={[a]:u||o.parse(d[p],p),[c]:r.parse(e[p],p)};return h}parseArrayData(t,e,i,s){const{xScale:o,yScale:r}=t,a=new Array(s);let c,d,u,h;for(c=0,d=s;c<d;++c)u=c+i,h=e[u],a[c]={x:o.parse(h[0],u),y:r.parse(h[1],u)};return a}parseObjectData(t,e,i,s){const{xScale:o,yScale:r}=t,{xAxisKey:a="x",yAxisKey:c="y"}=this._parsing,d=new Array(s);let u,h,f,m;for(u=0,h=s;u<h;++u)f=u+i,m=e[f],d[u]={x:o.parse(Re(m,a),f),y:r.parse(Re(m,c),f)};return d}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,e,i){const s=this.chart,o=this._cachedMeta,r=e[t.axis],a={keys:Dl(s,!0),values:e._stacks[t.axis]._visualValues};return Nl(a,r,o.index,{mode:i})}updateRangeFromParsed(t,e,i,s){const o=i[e.axis];let r=o===null?NaN:o;const a=s&&i._stacks[e.axis];s&&a&&(s.values=a,r=Nl(s,o,this._cachedMeta.index)),t.min=Math.min(t.min,r),t.max=Math.max(t.max,r)}getMinMax(t,e){const i=this._cachedMeta,s=i._parsed,o=i._sorted&&t===i.iScale,r=s.length,a=this._getOtherScale(t),c=c_(e,i,this.chart),d={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:u,max:h}=o_(a);let f,m;function p(){m=s[f];const g=m[a.axis];return!St(m[t.axis])||u>g||h<g}for(f=0;f<r&&!(!p()&&(this.updateRangeFromParsed(d,t,m,c),o));++f);if(o){for(f=r-1;f>=0;--f)if(!p()){this.updateRangeFromParsed(d,t,m,c);break}}return d}getAllParsedValues(t){const e=this._cachedMeta._parsed,i=[];let s,o,r;for(s=0,o=e.length;s<o;++s)r=e[s][t.axis],St(r)&&i.push(r);return i}getMaxOverflow(){return!1}getLabelAndValue(t){const e=this._cachedMeta,i=e.iScale,s=e.vScale,o=this.getParsed(t);return{label:i?""+i.getLabelForValue(o[i.axis]):"",value:s?""+s.getLabelForValue(o[s.axis]):""}}_update(t){const e=this._cachedMeta;this.update(t||"default"),e._clip=n_(Q(this.options.clip,e_(e.xScale,e.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,e=this.chart,i=this._cachedMeta,s=i.data||[],o=e.chartArea,r=[],a=this._drawStart||0,c=this._drawCount||s.length-a,d=this.options.drawActiveElementsOnTop;let u;for(i.dataset&&i.dataset.draw(t,o,a,c),u=a;u<a+c;++u){const h=s[u];h.hidden||(h.active&&d?r.push(h):h.draw(t,o))}for(u=0;u<r.length;++u)r[u].draw(t,o)}getStyle(t,e){const i=e?"active":"default";return t===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(i):this.resolveDataElementOptions(t||0,i)}getContext(t,e,i){const s=this.getDataset();let o;if(t>=0&&t<this._cachedMeta.data.length){const r=this._cachedMeta.data[t];o=r.$context||(r.$context=l_(this.getContext(),t,r)),o.parsed=this.getParsed(t),o.raw=s.data[t],o.index=o.dataIndex=t}else o=this.$context||(this.$context=a_(this.chart.getContext(),this.index)),o.dataset=s,o.index=o.datasetIndex=this.index;return o.active=!!e,o.mode=i,o}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,e){return this._resolveElementOptions(this.dataElementType.id,e,t)}_resolveElementOptions(t,e="default",i){const s=e==="active",o=this._cachedDataOpts,r=t+"-"+e,a=o[r],c=this.enableOptionSharing&&ti(i);if(a)return Ml(a,c);const d=this.chart.config,u=d.datasetElementScopeKeys(this._type,t),h=s?[`${t}Hover`,"hover",t,""]:[t,""],f=d.getOptionScopes(this.getDataset(),u),m=Object.keys(gt.elements[t]),p=()=>this.getContext(i,s,e),g=d.resolveNamedOptions(f,m,p,h);return g.$shared&&(g.$shared=c,o[r]=Object.freeze(Ml(g,c))),g}_resolveAnimations(t,e,i){const s=this.chart,o=this._cachedDataOpts,r=`animation-${e}`,a=o[r];if(a)return a;let c;if(s.options.animation!==!1){const u=this.chart.config,h=u.datasetAnimationScopeKeys(this._type,e),f=u.getOptionScopes(this.getDataset(),h);c=u.createResolver(f,this.getContext(t,i,e))}const d=new _o(s,c&&c.animations);return c&&c._cacheable&&(o[r]=Object.freeze(d)),d}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||So(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const i=this.resolveDataElementOptions(t,e),s=this._sharedOptions,o=this.getSharedOptions(i),r=this.includeOptions(e,o)||o!==s;return this.updateSharedOptions(o,e,i),{sharedOptions:o,includeOptions:r}}updateElement(t,e,i,s){So(s)?Object.assign(t,i):this._resolveAnimations(e,s).update(t,i)}updateSharedOptions(t,e,i){t&&!So(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,s){t.active=s;const o=this.getStyle(e,s);this._resolveAnimations(e,i,s).update(t,{options:!s&&this.getSharedOptions(o)||o})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const e=this._data,i=this._cachedMeta.data;for(const[a,c,d]of this._syncList)this[a](c,d);this._syncList=[];const s=i.length,o=e.length,r=Math.min(o,s);r&&this.parse(0,r),o>s?this._insertElements(s,o-s,t):o<s&&this._removeElements(o,s-o)}_insertElements(t,e,i=!0){const s=this._cachedMeta,o=s.data,r=t+e;let a;const c=d=>{for(d.length+=e,a=d.length-1;a>=r;a--)d[a]=d[a-e]};for(c(o),a=t;a<r;++a)o[a]=new this.dataElementType;this._parsing&&c(s._parsed),this.parse(t,e),i&&this.updateElements(o,t,e,"reset")}updateElements(t,e,i,s){}_removeElements(t,e){const i=this._cachedMeta;if(this._parsing){const s=i._parsed.splice(t,e);i._stacked&&ci(i,s)}i.data.splice(t,e)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[e,i,s]=t;this[e](i,s)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){const t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,e){e&&this._sync(["_removeElements",t,e]);const i=arguments.length-2;i&&this._sync(["_insertElements",t,i])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}L(Kt,"defaults",{}),L(Kt,"datasetElementType",null),L(Kt,"dataElementType",null);function d_(n,t){if(!n._cache.$bar){const e=n.getMatchingVisibleMetas(t);let i=[];for(let s=0,o=e.length;s<o;s++)i=i.concat(e[s].controller.getAllParsedValues(n));n._cache.$bar=Ka(i.sort((s,o)=>s-o))}return n._cache.$bar}function u_(n){const t=n.iScale,e=d_(t,n.type);let i=t._length,s,o,r,a;const c=()=>{r===32767||r===-32768||(ti(a)&&(i=Math.min(i,Math.abs(r-a)||i)),a=r)};for(s=0,o=e.length;s<o;++s)r=t.getPixelForValue(e[s]),c();for(a=void 0,s=0,o=t.ticks.length;s<o;++s)r=t.getPixelForTick(s),c();return i}function h_(n,t,e,i){const s=e.barThickness;let o,r;return it(s)?(o=t.min*e.categoryPercentage,r=e.barPercentage):(o=s*i,r=1),{chunk:o/i,ratio:r,start:t.pixels[n]-o/2}}function f_(n,t,e,i){const s=t.pixels,o=s[n];let r=n>0?s[n-1]:null,a=n<s.length-1?s[n+1]:null;const c=e.categoryPercentage;r===null&&(r=o-(a===null?t.end-t.start:a-o)),a===null&&(a=o+o-r);const d=o-(o-Math.min(r,a))/2*c;return{chunk:Math.abs(a-r)/2*c/i,ratio:e.barPercentage,start:d}}function m_(n,t,e,i){const s=e.parse(n[0],i),o=e.parse(n[1],i),r=Math.min(s,o),a=Math.max(s,o);let c=r,d=a;Math.abs(r)>Math.abs(a)&&(c=a,d=r),t[e.axis]=d,t._custom={barStart:c,barEnd:d,start:s,end:o,min:r,max:a}}function Vl(n,t,e,i){return _t(n)?m_(n,t,e,i):t[e.axis]=e.parse(n,i),t}function Al(n,t,e,i){const s=n.iScale,o=n.vScale,r=s.getLabels(),a=s===o,c=[];let d,u,h,f;for(d=e,u=e+i;d<u;++d)f=t[d],h={},h[s.axis]=a||s.parse(r[d],d),c.push(Vl(f,h,o,d));return c}function wo(n){return n&&n.barStart!==void 0&&n.barEnd!==void 0}function p_(n,t,e){return n!==0?ce(n):(t.isHorizontal()?1:-1)*(t.min>=e?1:-1)}function g_(n){let t,e,i,s,o;return n.horizontal?(t=n.base>n.x,e="left",i="right"):(t=n.base<n.y,e="bottom",i="top"),t?(s="end",o="start"):(s="start",o="end"),{start:e,end:i,reverse:t,top:s,bottom:o}}function y_(n,t,e,i){let s=t.borderSkipped;const o={};if(!s){n.borderSkipped=o;return}if(s===!0){n.borderSkipped={top:!0,right:!0,bottom:!0,left:!0};return}const{start:r,end:a,reverse:c,top:d,bottom:u}=g_(n);s==="middle"&&e&&(n.enableBorderRadius=!0,(e._top||0)===i?s=d:(e._bottom||0)===i?s=u:(o[Fl(u,r,a,c)]=!0,s=d)),o[Fl(s,r,a,c)]=!0,n.borderSkipped=o}function Fl(n,t,e,i){return i?(n=b_(n,t,e),n=Bl(n,e,t)):n=Bl(n,t,e),n}function b_(n,t,e){return n===t?e:n===e?t:n}function Bl(n,t,e){return n==="start"?t:n==="end"?e:n}function __(n,{inflateAmount:t},e){n.inflateAmount=t==="auto"?e===1?.33:0:t}class di extends Kt{parsePrimitiveData(t,e,i,s){return Al(t,e,i,s)}parseArrayData(t,e,i,s){return Al(t,e,i,s)}parseObjectData(t,e,i,s){const{iScale:o,vScale:r}=t,{xAxisKey:a="x",yAxisKey:c="y"}=this._parsing,d=o.axis==="x"?a:c,u=r.axis==="x"?a:c,h=[];let f,m,p,g;for(f=i,m=i+s;f<m;++f)g=e[f],p={},p[o.axis]=o.parse(Re(g,d),f),h.push(Vl(Re(g,u),p,r,f));return h}updateRangeFromParsed(t,e,i,s){super.updateRangeFromParsed(t,e,i,s);const o=i._custom;o&&e===this._cachedMeta.vScale&&(t.min=Math.min(t.min,o.min),t.max=Math.max(t.max,o.max))}getMaxOverflow(){return 0}getLabelAndValue(t){const e=this._cachedMeta,{iScale:i,vScale:s}=e,o=this.getParsed(t),r=o._custom,a=wo(r)?"["+r.start+", "+r.end+"]":""+s.getLabelForValue(o[s.axis]);return{label:""+i.getLabelForValue(o[i.axis]),value:a}}initialize(){this.enableOptionSharing=!0,super.initialize();const t=this._cachedMeta;t.stack=this.getDataset().stack}update(t){const e=this._cachedMeta;this.updateElements(e.data,0,e.data.length,t)}updateElements(t,e,i,s){const o=s==="reset",{index:r,_cachedMeta:{vScale:a}}=this,c=a.getBasePixel(),d=a.isHorizontal(),u=this._getRuler(),{sharedOptions:h,includeOptions:f}=this._getSharedOptions(e,s);for(let m=e;m<e+i;m++){const p=this.getParsed(m),g=o||it(p[a.axis])?{base:c,head:c}:this._calculateBarValuePixels(m),y=this._calculateBarIndexPixels(m,u),b=(p._stacks||{})[a.axis],_={horizontal:d,base:g.base,enableBorderRadius:!b||wo(p._custom)||r===b._top||r===b._bottom,x:d?g.head:y.center,y:d?y.center:g.head,height:d?y.size:Math.abs(g.size),width:d?Math.abs(g.size):y.size};f&&(_.options=h||this.resolveDataElementOptions(m,t[m].active?"active":s));const w=_.options||t[m].options;y_(_,w,b,r),__(_,w,u.ratio),this.updateElement(t[m],m,_,s)}}_getStacks(t,e){const{iScale:i}=this._cachedMeta,s=i.getMatchingVisibleMetas(this._type).filter(u=>u.controller.options.grouped),o=i.options.stacked,r=[],a=this._cachedMeta.controller.getParsed(e),c=a&&a[i.axis],d=u=>{const h=u._parsed.find(m=>m[i.axis]===c),f=h&&h[u.vScale.axis];if(it(f)||isNaN(f))return!0};for(const u of s)if(!(e!==void 0&&d(u))&&((o===!1||r.indexOf(u.stack)===-1||o===void 0&&u.stack===void 0)&&r.push(u.stack),u.index===t))break;return r.length||r.push(void 0),r}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,i){const s=this._getStacks(t,i),o=e!==void 0?s.indexOf(e):-1;return o===-1?s.length-1:o}_getRuler(){const t=this.options,e=this._cachedMeta,i=e.iScale,s=[];let o,r;for(o=0,r=e.data.length;o<r;++o)s.push(i.getPixelForValue(this.getParsed(o)[i.axis],o));const a=t.barThickness;return{min:a||u_(e),pixels:s,start:i._startPixel,end:i._endPixel,stackCount:this._getStackCount(),scale:i,grouped:t.grouped,ratio:a?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){const{_cachedMeta:{vScale:e,_stacked:i,index:s},options:{base:o,minBarLength:r}}=this,a=o||0,c=this.getParsed(t),d=c._custom,u=wo(d);let h=c[e.axis],f=0,m=i?this.applyStack(e,c,i):h,p,g;m!==h&&(f=m-h,m=h),u&&(h=d.barStart,m=d.barEnd-d.barStart,h!==0&&ce(h)!==ce(d.barEnd)&&(f=0),f+=h);const y=!it(o)&&!u?o:f;let b=e.getPixelForValue(y);if(this.chart.getDataVisibility(t)?p=e.getPixelForValue(f+m):p=b,g=p-b,Math.abs(g)<r){g=p_(g,e,a)*r,h===a&&(b-=g/2);const _=e.getPixelForDecimal(0),w=e.getPixelForDecimal(1),E=Math.min(_,w),k=Math.max(_,w);b=Math.max(Math.min(b,k),E),p=b+g,i&&!u&&(c._stacks[e.axis]._visualValues[s]=e.getValueForPixel(p)-e.getValueForPixel(b))}if(b===e.getPixelForValue(a)){const _=ce(g)*e.getLineWidthForValue(a)/2;b+=_,g-=_}return{size:g,base:b,head:p,center:p+g/2}}_calculateBarIndexPixels(t,e){const i=e.scale,s=this.options,o=s.skipNull,r=Q(s.maxBarThickness,1/0);let a,c;if(e.grouped){const d=o?this._getStackCount(t):e.stackCount,u=s.barThickness==="flex"?f_(t,e,s,d):h_(t,e,s,d),h=this._getStackIndex(this.index,this._cachedMeta.stack,o?t:void 0);a=u.start+u.chunk*h+u.chunk/2,c=Math.min(r,u.chunk*u.ratio)}else a=i.getPixelForValue(this.getParsed(t)[i.axis],t),c=Math.min(r,e.min*e.ratio);return{base:a-c/2,head:a+c/2,center:a,size:c}}draw(){const t=this._cachedMeta,e=t.vScale,i=t.data,s=i.length;let o=0;for(;o<s;++o)this.getParsed(o)[e.axis]!==null&&!i[o].hidden&&i[o].draw(this._ctx)}}L(di,"id","bar"),L(di,"defaults",{datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}}),L(di,"overrides",{scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}});class ui extends Kt{initialize(){this.enableOptionSharing=!0,super.initialize()}parsePrimitiveData(t,e,i,s){const o=super.parsePrimitiveData(t,e,i,s);for(let r=0;r<o.length;r++)o[r]._custom=this.resolveDataElementOptions(r+i).radius;return o}parseArrayData(t,e,i,s){const o=super.parseArrayData(t,e,i,s);for(let r=0;r<o.length;r++){const a=e[i+r];o[r]._custom=Q(a[2],this.resolveDataElementOptions(r+i).radius)}return o}parseObjectData(t,e,i,s){const o=super.parseObjectData(t,e,i,s);for(let r=0;r<o.length;r++){const a=e[i+r];o[r]._custom=Q(a&&a.r&&+a.r,this.resolveDataElementOptions(r+i).radius)}return o}getMaxOverflow(){const t=this._cachedMeta.data;let e=0;for(let i=t.length-1;i>=0;--i)e=Math.max(e,t[i].size(this.resolveDataElementOptions(i))/2);return e>0&&e}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart.data.labels||[],{xScale:s,yScale:o}=e,r=this.getParsed(t),a=s.getLabelForValue(r.x),c=o.getLabelForValue(r.y),d=r._custom;return{label:i[t]||"",value:"("+a+", "+c+(d?", "+d:"")+")"}}update(t){const e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,i,s){const o=s==="reset",{iScale:r,vScale:a}=this._cachedMeta,{sharedOptions:c,includeOptions:d}=this._getSharedOptions(e,s),u=r.axis,h=a.axis;for(let f=e;f<e+i;f++){const m=t[f],p=!o&&this.getParsed(f),g={},y=g[u]=o?r.getPixelForDecimal(.5):r.getPixelForValue(p[u]),b=g[h]=o?a.getBasePixel():a.getPixelForValue(p[h]);g.skip=isNaN(y)||isNaN(b),d&&(g.options=c||this.resolveDataElementOptions(f,m.active?"active":s),o&&(g.options.radius=0)),this.updateElement(m,f,g,s)}}resolveDataElementOptions(t,e){const i=this.getParsed(t);let s=super.resolveDataElementOptions(t,e);s.$shared&&(s=Object.assign({},s,{$shared:!1}));const o=s.radius;return e!=="active"&&(s.radius=0),s.radius+=Q(i&&i._custom,o),s}}L(ui,"id","bubble"),L(ui,"defaults",{datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}}),L(ui,"overrides",{scales:{x:{type:"linear"},y:{type:"linear"}}});function x_(n,t,e){let i=1,s=1,o=0,r=0;if(t<pt){const a=n,c=a+t,d=Math.cos(a),u=Math.sin(a),h=Math.cos(c),f=Math.sin(c),m=(w,E,k)=>ni(w,a,c,!0)?1:Math.max(E,E*e,k,k*e),p=(w,E,k)=>ni(w,a,c,!0)?-1:Math.min(E,E*e,k,k*e),g=m(0,d,h),y=m(wt,u,f),b=p(mt,d,h),_=p(mt+wt,u,f);i=(g-b)/2,s=(y-_)/2,o=-(g+b)/2,r=-(y+_)/2}return{ratioX:i,ratioY:s,offsetX:o,offsetY:r}}class ze extends Kt{constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){const i=this.getDataset().data,s=this._cachedMeta;if(this._parsing===!1)s._parsed=i;else{let o=c=>+i[c];if(et(i[t])){const{key:c="value"}=this._parsing;o=d=>+Re(i[d],c)}let r,a;for(r=t,a=t+e;r<a;++r)s._parsed[r]=o(r)}}_getRotation(){return ie(this.options.rotation-90)}_getCircumference(){return ie(this.options.circumference)}_getRotationExtents(){let t=pt,e=-pt;for(let i=0;i<this.chart.data.datasets.length;++i)if(this.chart.isDatasetVisible(i)&&this.chart.getDatasetMeta(i).type===this._type){const s=this.chart.getDatasetMeta(i).controller,o=s._getRotation(),r=s._getCircumference();t=Math.min(t,o),e=Math.max(e,o+r)}return{rotation:t,circumference:e-t}}update(t){const e=this.chart,{chartArea:i}=e,s=this._cachedMeta,o=s.data,r=this.getMaxBorderWidth()+this.getMaxOffset(o)+this.options.spacing,a=Math.max((Math.min(i.width,i.height)-r)/2,0),c=Math.min(Fy(this.options.cutout,a),1),d=this._getRingWeight(this.index),{circumference:u,rotation:h}=this._getRotationExtents(),{ratioX:f,ratioY:m,offsetX:p,offsetY:g}=x_(h,u,c),y=(i.width-r)/f,b=(i.height-r)/m,_=Math.max(Math.min(y,b)/2,0),w=$a(this.options.radius,_),E=Math.max(w*c,0),k=(w-E)/this._getVisibleDatasetWeightTotal();this.offsetX=p*w,this.offsetY=g*w,s.total=this.calculateTotal(),this.outerRadius=w-k*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-k*d,0),this.updateElements(o,0,o.length,t)}_circumference(t,e){const i=this.options,s=this._cachedMeta,o=this._getCircumference();return e&&i.animation.animateRotate||!this.chart.getDataVisibility(t)||s._parsed[t]===null||s.data[t].hidden?0:this.calculateCircumference(s._parsed[t]*o/pt)}updateElements(t,e,i,s){const o=s==="reset",r=this.chart,a=r.chartArea,d=r.options.animation,u=(a.left+a.right)/2,h=(a.top+a.bottom)/2,f=o&&d.animateScale,m=f?0:this.innerRadius,p=f?0:this.outerRadius,{sharedOptions:g,includeOptions:y}=this._getSharedOptions(e,s);let b=this._getRotation(),_;for(_=0;_<e;++_)b+=this._circumference(_,o);for(_=e;_<e+i;++_){const w=this._circumference(_,o),E=t[_],k={x:u+this.offsetX,y:h+this.offsetY,startAngle:b,endAngle:b+w,circumference:w,outerRadius:p,innerRadius:m};y&&(k.options=g||this.resolveDataElementOptions(_,E.active?"active":s)),b+=w,this.updateElement(E,_,k,s)}}calculateTotal(){const t=this._cachedMeta,e=t.data;let i=0,s;for(s=0;s<e.length;s++){const o=t._parsed[s];o!==null&&!isNaN(o)&&this.chart.getDataVisibility(s)&&!e[s].hidden&&(i+=Math.abs(o))}return i}calculateCircumference(t){const e=this._cachedMeta.total;return e>0&&!isNaN(t)?pt*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,s=i.data.labels||[],o=si(e._parsed[t],i.options.locale);return{label:s[t]||"",value:o}}getMaxBorderWidth(t){let e=0;const i=this.chart;let s,o,r,a,c;if(!t){for(s=0,o=i.data.datasets.length;s<o;++s)if(i.isDatasetVisible(s)){r=i.getDatasetMeta(s),t=r.data,a=r.controller;break}}if(!t)return 0;for(s=0,o=t.length;s<o;++s)c=a.resolveDataElementOptions(s),c.borderAlign!=="inner"&&(e=Math.max(e,c.borderWidth||0,c.hoverBorderWidth||0));return e}getMaxOffset(t){let e=0;for(let i=0,s=t.length;i<s;++i){const o=this.resolveDataElementOptions(i);e=Math.max(e,o.offset||0,o.hoverOffset||0)}return e}_getRingWeightOffset(t){let e=0;for(let i=0;i<t;++i)this.chart.isDatasetVisible(i)&&(e+=this._getRingWeight(i));return e}_getRingWeight(t){return Math.max(Q(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}L(ze,"id","doughnut"),L(ze,"defaults",{datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"}),L(ze,"descriptors",{_scriptable:t=>t!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")}),L(ze,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i,color:s}}=t.legend.options;return e.labels.map((o,r)=>{const c=t.getDatasetMeta(0).controller.getStyle(r);return{text:o,fillStyle:c.backgroundColor,strokeStyle:c.borderColor,fontColor:s,lineWidth:c.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(r),index:r}})}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}}});class hi extends Kt{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const e=this._cachedMeta,{dataset:i,data:s=[],_dataset:o}=e,r=this.chart._animationsDisabled;let{start:a,count:c}=Qa(e,s,r);this._drawStart=a,this._drawCount=c,Ja(e)&&(a=0,c=s.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!o._decimated,i.points=s;const d=this.resolveDatasetElementOptions(t);this.options.showLine||(d.borderWidth=0),d.segment=this.options.segment,this.updateElement(i,void 0,{animated:!r,options:d},t),this.updateElements(s,a,c,t)}updateElements(t,e,i,s){const o=s==="reset",{iScale:r,vScale:a,_stacked:c,_dataset:d}=this._cachedMeta,{sharedOptions:u,includeOptions:h}=this._getSharedOptions(e,s),f=r.axis,m=a.axis,{spanGaps:p,segment:g}=this.options,y=_n(p)?p:Number.POSITIVE_INFINITY,b=this.chart._animationsDisabled||o||s==="none",_=e+i,w=t.length;let E=e>0&&this.getParsed(e-1);for(let k=0;k<w;++k){const v=t[k],S=b?v:{};if(k<e||k>=_){S.skip=!0;continue}const x=this.getParsed(k),O=it(x[m]),M=S[f]=r.getPixelForValue(x[f],k),C=S[m]=o||O?a.getBasePixel():a.getPixelForValue(c?this.applyStack(a,x,c):x[m],k);S.skip=isNaN(M)||isNaN(C)||O,S.stop=k>0&&Math.abs(x[f]-E[f])>y,g&&(S.parsed=x,S.raw=d.data[k]),h&&(S.options=u||this.resolveDataElementOptions(k,v.active?"active":s)),b||this.updateElement(v,k,S,s),E=x}}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,i=e.options&&e.options.borderWidth||0,s=t.data||[];if(!s.length)return i;const o=s[0].size(this.resolveDataElementOptions(0)),r=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(i,o,r)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}L(hi,"id","line"),L(hi,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),L(hi,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}});class wn extends Kt{constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,s=i.data.labels||[],o=si(e._parsed[t].r,i.options.locale);return{label:s[t]||"",value:o}}parseObjectData(t,e,i,s){return fl.bind(this)(t,e,i,s)}update(t){const e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){const t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((i,s)=>{const o=this.getParsed(s).r;!isNaN(o)&&this.chart.getDataVisibility(s)&&(o<e.min&&(e.min=o),o>e.max&&(e.max=o))}),e}_updateRadius(){const t=this.chart,e=t.chartArea,i=t.options,s=Math.min(e.right-e.left,e.bottom-e.top),o=Math.max(s/2,0),r=Math.max(i.cutoutPercentage?o/100*i.cutoutPercentage:1,0),a=(o-r)/t.getVisibleDatasetCount();this.outerRadius=o-a*this.index,this.innerRadius=this.outerRadius-a}updateElements(t,e,i,s){const o=s==="reset",r=this.chart,c=r.options.animation,d=this._cachedMeta.rScale,u=d.xCenter,h=d.yCenter,f=d.getIndexAngle(0)-.5*mt;let m=f,p;const g=360/this.countVisibleElements();for(p=0;p<e;++p)m+=this._computeAngle(p,s,g);for(p=e;p<e+i;p++){const y=t[p];let b=m,_=m+this._computeAngle(p,s,g),w=r.getDataVisibility(p)?d.getDistanceFromCenterForValue(this.getParsed(p).r):0;m=_,o&&(c.animateScale&&(w=0),c.animateRotate&&(b=_=f));const E={x:u,y:h,innerRadius:0,outerRadius:w,startAngle:b,endAngle:_,options:this.resolveDataElementOptions(p,y.active?"active":s)};this.updateElement(y,p,E,s)}}countVisibleElements(){const t=this._cachedMeta;let e=0;return t.data.forEach((i,s)=>{!isNaN(this.getParsed(s).r)&&this.chart.getDataVisibility(s)&&e++}),e}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?ie(this.resolveDataElementOptions(t,e).angle||i):0}}L(wn,"id","polarArea"),L(wn,"defaults",{dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0}),L(wn,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i,color:s}}=t.legend.options;return e.labels.map((o,r)=>{const c=t.getDatasetMeta(0).controller.getStyle(r);return{text:o,fillStyle:c.backgroundColor,strokeStyle:c.borderColor,fontColor:s,lineWidth:c.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(r),index:r}})}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}});class os extends ze{}L(os,"id","pie"),L(os,"defaults",{cutout:0,rotation:0,circumference:360,radius:"100%"});class fi extends Kt{getLabelAndValue(t){const e=this._cachedMeta.vScale,i=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(i[e.axis])}}parseObjectData(t,e,i,s){return fl.bind(this)(t,e,i,s)}update(t){const e=this._cachedMeta,i=e.dataset,s=e.data||[],o=e.iScale.getLabels();if(i.points=s,t!=="resize"){const r=this.resolveDatasetElementOptions(t);this.options.showLine||(r.borderWidth=0);const a={_loop:!0,_fullLoop:o.length===s.length,options:r};this.updateElement(i,void 0,a,t)}this.updateElements(s,0,s.length,t)}updateElements(t,e,i,s){const o=this._cachedMeta.rScale,r=s==="reset";for(let a=e;a<e+i;a++){const c=t[a],d=this.resolveDataElementOptions(a,c.active?"active":s),u=o.getPointPositionForValue(a,this.getParsed(a).r),h=r?o.xCenter:u.x,f=r?o.yCenter:u.y,m={x:h,y:f,angle:u.angle,skip:isNaN(h)||isNaN(f),options:d};this.updateElement(c,a,m,s)}}}L(fi,"id","radar"),L(fi,"defaults",{datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}}),L(fi,"overrides",{aspectRatio:1,scales:{r:{type:"radialLinear"}}});class mi extends Kt{getLabelAndValue(t){const e=this._cachedMeta,i=this.chart.data.labels||[],{xScale:s,yScale:o}=e,r=this.getParsed(t),a=s.getLabelForValue(r.x),c=o.getLabelForValue(r.y);return{label:i[t]||"",value:"("+a+", "+c+")"}}update(t){const e=this._cachedMeta,{data:i=[]}=e,s=this.chart._animationsDisabled;let{start:o,count:r}=Qa(e,i,s);if(this._drawStart=o,this._drawCount=r,Ja(e)&&(o=0,r=i.length),this.options.showLine){this.datasetElementType||this.addElements();const{dataset:a,_dataset:c}=e;a._chart=this.chart,a._datasetIndex=this.index,a._decimated=!!c._decimated,a.points=i;const d=this.resolveDatasetElementOptions(t);d.segment=this.options.segment,this.updateElement(a,void 0,{animated:!s,options:d},t)}else this.datasetElementType&&(delete e.dataset,this.datasetElementType=!1);this.updateElements(i,o,r,t)}addElements(){const{showLine:t}=this.options;!this.datasetElementType&&t&&(this.datasetElementType=this.chart.registry.getElement("line")),super.addElements()}updateElements(t,e,i,s){const o=s==="reset",{iScale:r,vScale:a,_stacked:c,_dataset:d}=this._cachedMeta,u=this.resolveDataElementOptions(e,s),h=this.getSharedOptions(u),f=this.includeOptions(s,h),m=r.axis,p=a.axis,{spanGaps:g,segment:y}=this.options,b=_n(g)?g:Number.POSITIVE_INFINITY,_=this.chart._animationsDisabled||o||s==="none";let w=e>0&&this.getParsed(e-1);for(let E=e;E<e+i;++E){const k=t[E],v=this.getParsed(E),S=_?k:{},x=it(v[p]),O=S[m]=r.getPixelForValue(v[m],E),M=S[p]=o||x?a.getBasePixel():a.getPixelForValue(c?this.applyStack(a,v,c):v[p],E);S.skip=isNaN(O)||isNaN(M)||x,S.stop=E>0&&Math.abs(v[m]-w[m])>b,y&&(S.parsed=v,S.raw=d.data[E]),f&&(S.options=h||this.resolveDataElementOptions(E,k.active?"active":s)),_||this.updateElement(k,E,S,s),w=v}this.updateSharedOptions(h,s,u)}getMaxOverflow(){const t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let a=0;for(let c=e.length-1;c>=0;--c)a=Math.max(a,e[c].size(this.resolveDataElementOptions(c))/2);return a>0&&a}const i=t.dataset,s=i.options&&i.options.borderWidth||0;if(!e.length)return s;const o=e[0].size(this.resolveDataElementOptions(0)),r=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(s,o,r)/2}}L(mi,"id","scatter"),L(mi,"defaults",{datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1}),L(mi,"overrides",{interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}});var $l=Object.freeze({__proto__:null,BarController:di,BubbleController:ui,DoughnutController:ze,LineController:hi,PieController:os,PolarAreaController:wn,RadarController:fi,ScatterController:mi});function rn(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class Eo{constructor(t){L(this,"options");this.options=t||{}}static override(t){Object.assign(Eo.prototype,t)}init(){}formats(){return rn()}parse(){return rn()}format(){return rn()}add(){return rn()}diff(){return rn()}startOf(){return rn()}endOf(){return rn()}}var Rl={_date:Eo};function k_(n,t,e,i){const{controller:s,data:o,_sorted:r}=n,a=s._cachedMeta.iScale;if(a&&t===a.axis&&t!=="r"&&r&&o.length){const c=a._reversePixels?Yy:Ee;if(i){if(s._sharedOptions){const d=o[0],u=typeof d.getRange=="function"&&d.getRange(t);if(u){const h=c(o,t,e-u),f=c(o,t,e+u);return{lo:h.lo,hi:f.hi}}}}else return c(o,t,e)}return{lo:0,hi:o.length-1}}function pi(n,t,e,i,s){const o=n.getSortedVisibleDatasetMetas(),r=e[t];for(let a=0,c=o.length;a<c;++a){const{index:d,data:u}=o[a],{lo:h,hi:f}=k_(o[a],t,r,s);for(let m=h;m<=f;++m){const p=u[m];p.skip||i(p,d,m)}}}function S_(n){const t=n.indexOf("x")!==-1,e=n.indexOf("y")!==-1;return function(i,s){const o=t?Math.abs(i.x-s.x):0,r=e?Math.abs(i.y-s.y):0;return Math.sqrt(Math.pow(o,2)+Math.pow(r,2))}}function vo(n,t,e,i,s){const o=[];return!s&&!n.isPointInArea(t)||pi(n,e,t,function(a,c,d){!s&&!ve(a,n.chartArea,0)||a.inRange(t.x,t.y,i)&&o.push({element:a,datasetIndex:c,index:d})},!0),o}function w_(n,t,e,i){let s=[];function o(r,a,c){const{startAngle:d,endAngle:u}=r.getProps(["startAngle","endAngle"],i),{angle:h}=Ua(r,{x:t.x,y:t.y});ni(h,d,u)&&s.push({element:r,datasetIndex:a,index:c})}return pi(n,e,t,o),s}function E_(n,t,e,i,s,o){let r=[];const a=S_(e);let c=Number.POSITIVE_INFINITY;function d(u,h,f){const m=u.inRange(t.x,t.y,s);if(i&&!m)return;const p=u.getCenterPoint(s);if(!(!!o||n.isPointInArea(p))&&!m)return;const y=a(t,p);y<c?(r=[{element:u,datasetIndex:h,index:f}],c=y):y===c&&r.push({element:u,datasetIndex:h,index:f})}return pi(n,e,t,d),r}function Co(n,t,e,i,s,o){return!o&&!n.isPointInArea(t)?[]:e==="r"&&!i?w_(n,t,e,s):E_(n,t,e,i,s,o)}function Ll(n,t,e,i,s){const o=[],r=e==="x"?"inXRange":"inYRange";let a=!1;return pi(n,e,t,(c,d,u)=>{c[r]&&c[r](t[e],s)&&(o.push({element:c,datasetIndex:d,index:u}),a=a||c.inRange(t.x,t.y,s))}),i&&!a?[]:o}var Il={evaluateInteractionItems:pi,modes:{index(n,t,e,i){const s=sn(t,n),o=e.axis||"x",r=e.includeInvisible||!1,a=e.intersect?vo(n,s,o,i,r):Co(n,s,o,!1,i,r),c=[];return a.length?(n.getSortedVisibleDatasetMetas().forEach(d=>{const u=a[0].index,h=d.data[u];h&&!h.skip&&c.push({element:h,datasetIndex:d.index,index:u})}),c):[]},dataset(n,t,e,i){const s=sn(t,n),o=e.axis||"xy",r=e.includeInvisible||!1;let a=e.intersect?vo(n,s,o,i,r):Co(n,s,o,!1,i,r);if(a.length>0){const c=a[0].datasetIndex,d=n.getDatasetMeta(c).data;a=[];for(let u=0;u<d.length;++u)a.push({element:d[u],datasetIndex:c,index:u})}return a},point(n,t,e,i){const s=sn(t,n),o=e.axis||"xy",r=e.includeInvisible||!1;return vo(n,s,o,i,r)},nearest(n,t,e,i){const s=sn(t,n),o=e.axis||"xy",r=e.includeInvisible||!1;return Co(n,s,o,e.intersect,i,r)},x(n,t,e,i){const s=sn(t,n);return Ll(n,s,"x",e.intersect,i)},y(n,t,e,i){const s=sn(t,n);return Ll(n,s,"y",e.intersect,i)}}};const jl=["left","top","right","bottom"];function gi(n,t){return n.filter(e=>e.pos===t)}function zl(n,t){return n.filter(e=>jl.indexOf(e.pos)===-1&&e.box.axis===t)}function yi(n,t){return n.sort((e,i)=>{const s=t?i:e,o=t?e:i;return s.weight===o.weight?s.index-o.index:s.weight-o.weight})}function v_(n){const t=[];let e,i,s,o,r,a;for(e=0,i=(n||[]).length;e<i;++e)s=n[e],{position:o,options:{stack:r,stackWeight:a=1}}=s,t.push({index:e,box:s,pos:o,horizontal:s.isHorizontal(),weight:s.weight,stack:r&&o+r,stackWeight:a});return t}function C_(n){const t={};for(const e of n){const{stack:i,pos:s,stackWeight:o}=e;if(!i||!jl.includes(s))continue;const r=t[i]||(t[i]={count:0,placed:0,weight:0,size:0});r.count++,r.weight+=o}return t}function O_(n,t){const e=C_(n),{vBoxMaxWidth:i,hBoxMaxHeight:s}=t;let o,r,a;for(o=0,r=n.length;o<r;++o){a=n[o];const{fullSize:c}=a.box,d=e[a.stack],u=d&&a.stackWeight/d.weight;a.horizontal?(a.width=u?u*i:c&&t.availableWidth,a.height=s):(a.width=i,a.height=u?u*s:c&&t.availableHeight)}return e}function D_(n){const t=v_(n),e=yi(t.filter(d=>d.box.fullSize),!0),i=yi(gi(t,"left"),!0),s=yi(gi(t,"right")),o=yi(gi(t,"top"),!0),r=yi(gi(t,"bottom")),a=zl(t,"x"),c=zl(t,"y");return{fullSize:e,leftAndTop:i.concat(o),rightAndBottom:s.concat(c).concat(r).concat(a),chartArea:gi(t,"chartArea"),vertical:i.concat(s).concat(c),horizontal:o.concat(r).concat(a)}}function Wl(n,t,e,i){return Math.max(n[e],t[e])+Math.max(n[i],t[i])}function Hl(n,t){n.top=Math.max(n.top,t.top),n.left=Math.max(n.left,t.left),n.bottom=Math.max(n.bottom,t.bottom),n.right=Math.max(n.right,t.right)}function N_(n,t,e,i){const{pos:s,box:o}=e,r=n.maxPadding;if(!et(s)){e.size&&(n[s]-=e.size);const h=i[e.stack]||{size:0,count:1};h.size=Math.max(h.size,e.horizontal?o.height:o.width),e.size=h.size/h.count,n[s]+=e.size}o.getPadding&&Hl(r,o.getPadding());const a=Math.max(0,t.outerWidth-Wl(r,n,"left","right")),c=Math.max(0,t.outerHeight-Wl(r,n,"top","bottom")),d=a!==n.w,u=c!==n.h;return n.w=a,n.h=c,e.horizontal?{same:d,other:u}:{same:u,other:d}}function T_(n){const t=n.maxPadding;function e(i){const s=Math.max(t[i]-n[i],0);return n[i]+=s,s}n.y+=e("top"),n.x+=e("left"),e("right"),e("bottom")}function P_(n,t){const e=t.maxPadding;function i(s){const o={left:0,top:0,right:0,bottom:0};return s.forEach(r=>{o[r]=Math.max(t[r],e[r])}),o}return i(n?["left","right"]:["top","bottom"])}function bi(n,t,e,i){const s=[];let o,r,a,c,d,u;for(o=0,r=n.length,d=0;o<r;++o){a=n[o],c=a.box,c.update(a.width||t.w,a.height||t.h,P_(a.horizontal,t));const{same:h,other:f}=N_(t,e,a,i);d|=h&&s.length,u=u||f,c.fullSize||s.push(a)}return d&&bi(s,t,e,i)||u}function rs(n,t,e,i,s){n.top=e,n.left=t,n.right=t+i,n.bottom=e+s,n.width=i,n.height=s}function Ul(n,t,e,i){const s=e.padding;let{x:o,y:r}=t;for(const a of n){const c=a.box,d=i[a.stack]||{count:1,placed:0,weight:1},u=a.stackWeight/d.weight||1;if(a.horizontal){const h=t.w*u,f=d.size||c.height;ti(d.start)&&(r=d.start),c.fullSize?rs(c,s.left,r,e.outerWidth-s.right-s.left,f):rs(c,t.left+d.placed,r,h,f),d.start=r,d.placed+=h,r=c.bottom}else{const h=t.h*u,f=d.size||c.width;ti(d.start)&&(o=d.start),c.fullSize?rs(c,o,s.top,f,e.outerHeight-s.bottom-s.top):rs(c,o,t.top+d.placed,f,h),d.start=o,d.placed+=h,o=c.right}}t.x=o,t.y=r}var Pt={addBox(n,t){n.boxes||(n.boxes=[]),t.fullSize=t.fullSize||!1,t.position=t.position||"top",t.weight=t.weight||0,t._layers=t._layers||function(){return[{z:0,draw(e){t.draw(e)}}]},n.boxes.push(t)},removeBox(n,t){const e=n.boxes?n.boxes.indexOf(t):-1;e!==-1&&n.boxes.splice(e,1)},configure(n,t,e){t.fullSize=e.fullSize,t.position=e.position,t.weight=e.weight},update(n,t,e,i){if(!n)return;const s=Vt(n.options.layout.padding),o=Math.max(t-s.width,0),r=Math.max(e-s.height,0),a=D_(n.boxes),c=a.vertical,d=a.horizontal;lt(n.boxes,g=>{typeof g.beforeLayout=="function"&&g.beforeLayout()});const u=c.reduce((g,y)=>y.box.options&&y.box.options.display===!1?g:g+1,0)||1,h=Object.freeze({outerWidth:t,outerHeight:e,padding:s,availableWidth:o,availableHeight:r,vBoxMaxWidth:o/2/u,hBoxMaxHeight:r/2}),f=Object.assign({},s);Hl(f,Vt(i));const m=Object.assign({maxPadding:f,w:o,h:r,x:s.left,y:s.top},s),p=O_(c.concat(d),h);bi(a.fullSize,m,h,p),bi(c,m,h,p),bi(d,m,h,p)&&bi(c,m,h,p),T_(m),Ul(a.leftAndTop,m,h,p),m.x+=m.w,m.y+=m.h,Ul(a.rightAndBottom,m,h,p),n.chartArea={left:m.left,top:m.top,right:m.left+m.w,bottom:m.top+m.h,height:m.h,width:m.w},lt(a.chartArea,g=>{const y=g.box;Object.assign(y,n.chartArea),y.update(m.w,m.h,{left:0,top:0,right:0,bottom:0})})}};class Oo{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,s){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,s?Math.floor(e/s):i)}}isAttached(t){return!0}updateConfig(t){}}class ql extends Oo{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const as="$chartjs",M_={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Yl=n=>n===null||n==="";function V_(n,t){const e=n.style,i=n.getAttribute("height"),s=n.getAttribute("width");if(n[as]={initial:{height:i,width:s,style:{display:e.display,height:e.height,width:e.width}}},e.display=e.display||"block",e.boxSizing=e.boxSizing||"border-box",Yl(s)){const o=gl(n,"width");o!==void 0&&(n.width=o)}if(Yl(i))if(n.style.height==="")n.height=n.width/(t||2);else{const o=gl(n,"height");o!==void 0&&(n.height=o)}return n}const Kl=Ib?{passive:!0}:!1;function A_(n,t,e){n&&n.addEventListener(t,e,Kl)}function F_(n,t,e){n&&n.canvas&&n.canvas.removeEventListener(t,e,Kl)}function B_(n,t){const e=M_[n.type]||n.type,{x:i,y:s}=sn(n,t);return{type:e,chart:t,native:n,x:i!==void 0?i:null,y:s!==void 0?s:null}}function ls(n,t){for(const e of n)if(e===t||e.contains(t))return!0}function $_(n,t,e){const i=n.canvas,s=new MutationObserver(o=>{let r=!1;for(const a of o)r=r||ls(a.addedNodes,i),r=r&&!ls(a.removedNodes,i);r&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}function R_(n,t,e){const i=n.canvas,s=new MutationObserver(o=>{let r=!1;for(const a of o)r=r||ls(a.removedNodes,i),r=r&&!ls(a.addedNodes,i);r&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}const _i=new Map;let Xl=0;function Gl(){const n=window.devicePixelRatio;n!==Xl&&(Xl=n,_i.forEach((t,e)=>{e.currentDevicePixelRatio!==n&&t()}))}function L_(n,t){_i.size||window.addEventListener("resize",Gl),_i.set(n,t)}function I_(n){_i.delete(n),_i.size||window.removeEventListener("resize",Gl)}function j_(n,t,e){const i=n.canvas,s=i&&bo(i);if(!s)return;const o=Ga((a,c)=>{const d=s.clientWidth;e(a,c),d<s.clientWidth&&e()},window),r=new ResizeObserver(a=>{const c=a[0],d=c.contentRect.width,u=c.contentRect.height;d===0&&u===0||o(d,u)});return r.observe(s),L_(n,o),r}function Do(n,t,e){e&&e.disconnect(),t==="resize"&&I_(n)}function z_(n,t,e){const i=n.canvas,s=Ga(o=>{n.ctx!==null&&e(B_(o,n))},n);return A_(i,t,s),s}class Ql extends Oo{acquireContext(t,e){const i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(V_(t,e),i):null}releaseContext(t){const e=t.canvas;if(!e[as])return!1;const i=e[as].initial;["height","width"].forEach(o=>{const r=i[o];it(r)?e.removeAttribute(o):e.setAttribute(o,r)});const s=i.style||{};return Object.keys(s).forEach(o=>{e.style[o]=s[o]}),e.width=e.width,delete e[as],!0}addEventListener(t,e,i){this.removeEventListener(t,e);const s=t.$proxies||(t.$proxies={}),r={attach:$_,detach:R_,resize:j_}[e]||z_;s[e]=r(t,e,i)}removeEventListener(t,e){const i=t.$proxies||(t.$proxies={}),s=i[e];if(!s)return;({attach:Do,detach:Do,resize:Do}[e]||F_)(t,e,s),i[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,s){return Lb(t,e,i,s)}isAttached(t){const e=t&&bo(t);return!!(e&&e.isConnected)}}function Jl(n){return!yo()||typeof OffscreenCanvas<"u"&&n instanceof OffscreenCanvas?ql:Ql}class Xt{constructor(){L(this,"x");L(this,"y");L(this,"active",!1);L(this,"options");L(this,"$animations")}tooltipPosition(t){const{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}hasValue(){return _n(this.x)&&_n(this.y)}getProps(t,e){const i=this.$animations;if(!e||!i)return this;const s={};return t.forEach(o=>{s[o]=i[o]&&i[o].active()?i[o]._to:this[o]}),s}}L(Xt,"defaults",{}),L(Xt,"defaultRoutes");function W_(n,t){const e=n.options.ticks,i=H_(n),s=Math.min(e.maxTicksLimit||i,i),o=e.major.enabled?q_(t):[],r=o.length,a=o[0],c=o[r-1],d=[];if(r>s)return Y_(t,d,o,r/s),d;const u=U_(o,t,s);if(r>0){let h,f;const m=r>1?Math.round((c-a)/(r-1)):null;for(cs(t,d,u,it(m)?0:a-m,a),h=0,f=r-1;h<f;h++)cs(t,d,u,o[h],o[h+1]);return cs(t,d,u,c,it(m)?t.length:c+m),d}return cs(t,d,u),d}function H_(n){const t=n.options.offset,e=n._tickSize(),i=n._length/e+(t?0:1),s=n._maxLength/e;return Math.floor(Math.min(i,s))}function U_(n,t,e){const i=K_(n),s=t.length/e;if(!i)return Math.max(s,1);const o=Wy(i);for(let r=0,a=o.length-1;r<a;r++){const c=o[r];if(c>s)return c}return Math.max(s,1)}function q_(n){const t=[];let e,i;for(e=0,i=n.length;e<i;e++)n[e].major&&t.push(e);return t}function Y_(n,t,e,i){let s=0,o=e[0],r;for(i=Math.ceil(i),r=0;r<n.length;r++)r===o&&(t.push(n[r]),s++,o=e[s*i])}function cs(n,t,e,i,s){const o=Q(i,0),r=Math.min(Q(s,n.length),n.length);let a=0,c,d,u;for(e=Math.ceil(e),s&&(c=s-i,e=c/Math.floor(c/e)),u=o;u<0;)a++,u=Math.round(o+a*e);for(d=Math.max(o,0);d<r;d++)d===u&&(t.push(n[d]),a++,u=Math.round(o+a*e))}function K_(n){const t=n.length;let e,i;if(t<2)return!1;for(i=n[0],e=1;e<t;++e)if(n[e]-n[e-1]!==i)return!1;return i}const X_=n=>n==="left"?"right":n==="right"?"left":n,Zl=(n,t,e)=>t==="top"||t==="left"?n[t]+e:n[t]-e,tc=(n,t)=>Math.min(t||n,n);function ec(n,t){const e=[],i=n.length/t,s=n.length;let o=0;for(;o<s;o+=i)e.push(n[Math.floor(o)]);return e}function G_(n,t,e){const i=n.ticks.length,s=Math.min(t,i-1),o=n._startPixel,r=n._endPixel,a=1e-6;let c=n.getPixelForTick(s),d;if(!(e&&(i===1?d=Math.max(c-o,r-c):t===0?d=(n.getPixelForTick(1)-c)/2:d=(c-n.getPixelForTick(s-1))/2,c+=s<t?d:-d,c<o-a||c>r+a)))return c}function Q_(n,t){lt(n,e=>{const i=e.gc,s=i.length/2;let o;if(s>t){for(o=0;o<s;++o)delete e.data[i[o]];i.splice(0,s)}})}function xi(n){return n.drawTicks?n.tickLength:0}function nc(n,t){if(!n.display)return 0;const e=Ct(n.font,t),i=Vt(n.padding);return(_t(n.text)?n.text.length:1)*e.lineHeight+i.height}function J_(n,t){return je(n,{scale:t,type:"scale"})}function Z_(n,t,e){return je(n,{tick:e,index:t,type:"tick"})}function t0(n,t,e){let i=ro(n);return(e&&t!=="right"||!e&&t==="right")&&(i=X_(i)),i}function e0(n,t,e,i){const{top:s,left:o,bottom:r,right:a,chart:c}=n,{chartArea:d,scales:u}=c;let h=0,f,m,p;const g=r-s,y=a-o;if(n.isHorizontal()){if(m=Mt(i,o,a),et(e)){const b=Object.keys(e)[0],_=e[b];p=u[b].getPixelForValue(_)+g-t}else e==="center"?p=(d.bottom+d.top)/2+g-t:p=Zl(n,e,t);f=a-o}else{if(et(e)){const b=Object.keys(e)[0],_=e[b];m=u[b].getPixelForValue(_)-y+t}else e==="center"?m=(d.left+d.right)/2-y+t:m=Zl(n,e,t);p=Mt(i,r,s),h=e==="left"?-wt:wt}return{titleX:m,titleY:p,maxWidth:f,rotation:h}}class We extends Xt{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,e){return t}getUserBounds(){let{_userMin:t,_userMax:e,_suggestedMin:i,_suggestedMax:s}=this;return t=zt(t,Number.POSITIVE_INFINITY),e=zt(e,Number.NEGATIVE_INFINITY),i=zt(i,Number.POSITIVE_INFINITY),s=zt(s,Number.NEGATIVE_INFINITY),{min:zt(t,i),max:zt(e,s),minDefined:St(t),maxDefined:St(e)}}getMinMax(t){let{min:e,max:i,minDefined:s,maxDefined:o}=this.getUserBounds(),r;if(s&&o)return{min:e,max:i};const a=this.getMatchingVisibleMetas();for(let c=0,d=a.length;c<d;++c)r=a[c].controller.getMinMax(this,t),s||(e=Math.min(e,r.min)),o||(i=Math.max(i,r.max));return e=o&&e>i?i:e,i=s&&e>i?e:i,{min:zt(e,zt(i,e)),max:zt(i,zt(e,i))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){ft(this.options.beforeUpdate,[this])}update(t,e,i){const{beginAtZero:s,grace:o,ticks:r}=this.options,a=r.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=yb(this,o,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const c=a<this.ticks.length;this._convertTicksToLabels(c?ec(this.ticks,a):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),r.display&&(r.autoSkip||r.source==="auto")&&(this.ticks=W_(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),c&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t=this.options.reverse,e,i;this.isHorizontal()?(e=this.left,i=this.right):(e=this.top,i=this.bottom,t=!t),this._startPixel=e,this._endPixel=i,this._reversePixels=t,this._length=i-e,this._alignToPixels=this.options.alignToPixels}afterUpdate(){ft(this.options.afterUpdate,[this])}beforeSetDimensions(){ft(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){ft(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),ft(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){ft(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){const e=this.options.ticks;let i,s,o;for(i=0,s=t.length;i<s;i++)o=t[i],o.label=ft(e.callback,[o.value,i,t],this)}afterTickToLabelConversion(){ft(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){ft(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,e=t.ticks,i=tc(this.ticks.length,t.ticks.maxTicksLimit),s=e.minRotation||0,o=e.maxRotation;let r=s,a,c,d;if(!this._isVisible()||!e.display||s>=o||i<=1||!this.isHorizontal()){this.labelRotation=s;return}const u=this._getLabelSizes(),h=u.widest.width,f=u.highest.height,m=Dt(this.chart.width-h,0,this.maxWidth);a=t.offset?this.maxWidth/i:m/(i-1),h+6>a&&(a=m/(i-(t.offset?.5:1)),c=this.maxHeight-xi(t.grid)-e.padding-nc(t.title,this.chart.options.font),d=Math.sqrt(h*h+f*f),r=io(Math.min(Math.asin(Dt((u.highest.height+6)/a,-1,1)),Math.asin(Dt(c/d,-1,1))-Math.asin(Dt(f/d,-1,1)))),r=Math.max(s,Math.min(o,r))),this.labelRotation=r}afterCalculateLabelRotation(){ft(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){ft(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:i,title:s,grid:o}}=this,r=this._isVisible(),a=this.isHorizontal();if(r){const c=nc(s,e.options.font);if(a?(t.width=this.maxWidth,t.height=xi(o)+c):(t.height=this.maxHeight,t.width=xi(o)+c),i.display&&this.ticks.length){const{first:d,last:u,widest:h,highest:f}=this._getLabelSizes(),m=i.padding*2,p=ie(this.labelRotation),g=Math.cos(p),y=Math.sin(p);if(a){const b=i.mirror?0:y*h.width+g*f.height;t.height=Math.min(this.maxHeight,t.height+b+m)}else{const b=i.mirror?0:g*h.width+y*f.height;t.width=Math.min(this.maxWidth,t.width+b+m)}this._calculatePadding(d,u,y,g)}}this._handleMargins(),a?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,i,s){const{ticks:{align:o,padding:r},position:a}=this.options,c=this.labelRotation!==0,d=a!=="top"&&this.axis==="x";if(this.isHorizontal()){const u=this.getPixelForTick(0)-this.left,h=this.right-this.getPixelForTick(this.ticks.length-1);let f=0,m=0;c?d?(f=s*t.width,m=i*e.height):(f=i*t.height,m=s*e.width):o==="start"?m=e.width:o==="end"?f=t.width:o!=="inner"&&(f=t.width/2,m=e.width/2),this.paddingLeft=Math.max((f-u+r)*this.width/(this.width-u),0),this.paddingRight=Math.max((m-h+r)*this.width/(this.width-h),0)}else{let u=e.height/2,h=t.height/2;o==="start"?(u=0,h=t.height):o==="end"&&(u=e.height,h=0),this.paddingTop=u+r,this.paddingBottom=h+r}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){ft(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:e}=this.options;return e==="top"||e==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let e,i;for(e=0,i=t.length;e<i;e++)it(t[e].label)&&(t.splice(e,1),i--,e--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){const e=this.options.ticks.sampleSize;let i=this.ticks;e<i.length&&(i=ec(i,e)),this._labelSizes=t=this._computeLabelSizes(i,i.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,e,i){const{ctx:s,_longestTextCache:o}=this,r=[],a=[],c=Math.floor(e/tc(e,i));let d=0,u=0,h,f,m,p,g,y,b,_,w,E,k;for(h=0;h<e;h+=c){if(p=t[h].label,g=this._resolveTickFontOptions(h),s.font=y=g.string,b=o[y]=o[y]||{data:{},gc:[]},_=g.lineHeight,w=E=0,!it(p)&&!_t(p))w=Ji(s,b.data,b.gc,w,p),E=_;else if(_t(p))for(f=0,m=p.length;f<m;++f)k=p[f],!it(k)&&!_t(k)&&(w=Ji(s,b.data,b.gc,w,k),E+=_);r.push(w),a.push(E),d=Math.max(w,d),u=Math.max(E,u)}Q_(o,e);const v=r.indexOf(d),S=a.indexOf(u),x=O=>({width:r[O]||0,height:a[O]||0});return{first:x(0),last:x(e-1),widest:x(v),highest:x(S),widths:r,heights:a}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return qy(this._alignToPixels?Ze(this.chart,e,0):e)}getDecimalForPixel(t){const e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){const e=this.ticks||[];if(t>=0&&t<e.length){const i=e[t];return i.$context||(i.$context=Z_(this.getContext(),t,i))}return this.$context||(this.$context=J_(this.chart.getContext(),this))}_tickSize(){const t=this.options.ticks,e=ie(this.labelRotation),i=Math.abs(Math.cos(e)),s=Math.abs(Math.sin(e)),o=this._getLabelSizes(),r=t.autoSkipPadding||0,a=o?o.widest.width+r:0,c=o?o.highest.height+r:0;return this.isHorizontal()?c*i>a*s?a/i:c/s:c*s<a*i?c/i:a/s}_isVisible(){const t=this.options.display;return t!=="auto"?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){const e=this.axis,i=this.chart,s=this.options,{grid:o,position:r,border:a}=s,c=o.offset,d=this.isHorizontal(),h=this.ticks.length+(c?1:0),f=xi(o),m=[],p=a.setContext(this.getContext()),g=p.display?p.width:0,y=g/2,b=function(B){return Ze(i,B,g)};let _,w,E,k,v,S,x,O,M,C,T,$;if(r==="top")_=b(this.bottom),S=this.bottom-f,O=_-y,C=b(t.top)+y,$=t.bottom;else if(r==="bottom")_=b(this.top),C=t.top,$=b(t.bottom)-y,S=_+y,O=this.top+f;else if(r==="left")_=b(this.right),v=this.right-f,x=_-y,M=b(t.left)+y,T=t.right;else if(r==="right")_=b(this.left),M=t.left,T=b(t.right)-y,v=_+y,x=this.left+f;else if(e==="x"){if(r==="center")_=b((t.top+t.bottom)/2+.5);else if(et(r)){const B=Object.keys(r)[0],I=r[B];_=b(this.chart.scales[B].getPixelForValue(I))}C=t.top,$=t.bottom,S=_+y,O=S+f}else if(e==="y"){if(r==="center")_=b((t.left+t.right)/2);else if(et(r)){const B=Object.keys(r)[0],I=r[B];_=b(this.chart.scales[B].getPixelForValue(I))}v=_-y,x=v-f,M=t.left,T=t.right}const U=Q(s.ticks.maxTicksLimit,h),H=Math.max(1,Math.ceil(h/U));for(w=0;w<h;w+=H){const B=this.getContext(w),I=o.setContext(B),F=a.setContext(B),P=I.lineWidth,R=I.color,W=F.dash||[],J=F.dashOffset,G=I.tickWidth,ot=I.tickColor,nt=I.tickBorderDash||[],Y=I.tickBorderDashOffset;E=G_(this,w,c),E!==void 0&&(k=Ze(i,E,P),d?v=x=M=T=k:S=O=C=$=k,m.push({tx1:v,ty1:S,tx2:x,ty2:O,x1:M,y1:C,x2:T,y2:$,width:P,color:R,borderDash:W,borderDashOffset:J,tickWidth:G,tickColor:ot,tickBorderDash:nt,tickBorderDashOffset:Y}))}return this._ticksLength=h,this._borderValue=_,m}_computeLabelItems(t){const e=this.axis,i=this.options,{position:s,ticks:o}=i,r=this.isHorizontal(),a=this.ticks,{align:c,crossAlign:d,padding:u,mirror:h}=o,f=xi(i.grid),m=f+u,p=h?-u:m,g=-ie(this.labelRotation),y=[];let b,_,w,E,k,v,S,x,O,M,C,T,$="middle";if(s==="top")v=this.bottom-p,S=this._getXAxisLabelAlignment();else if(s==="bottom")v=this.top+p,S=this._getXAxisLabelAlignment();else if(s==="left"){const H=this._getYAxisLabelAlignment(f);S=H.textAlign,k=H.x}else if(s==="right"){const H=this._getYAxisLabelAlignment(f);S=H.textAlign,k=H.x}else if(e==="x"){if(s==="center")v=(t.top+t.bottom)/2+m;else if(et(s)){const H=Object.keys(s)[0],B=s[H];v=this.chart.scales[H].getPixelForValue(B)+m}S=this._getXAxisLabelAlignment()}else if(e==="y"){if(s==="center")k=(t.left+t.right)/2-m;else if(et(s)){const H=Object.keys(s)[0],B=s[H];k=this.chart.scales[H].getPixelForValue(B)}S=this._getYAxisLabelAlignment(f).textAlign}e==="y"&&(c==="start"?$="top":c==="end"&&($="bottom"));const U=this._getLabelSizes();for(b=0,_=a.length;b<_;++b){w=a[b],E=w.label;const H=o.setContext(this.getContext(b));x=this.getPixelForTick(b)+o.labelOffset,O=this._resolveTickFontOptions(b),M=O.lineHeight,C=_t(E)?E.length:1;const B=C/2,I=H.color,F=H.textStrokeColor,P=H.textStrokeWidth;let R=S;r?(k=x,S==="inner"&&(b===_-1?R=this.options.reverse?"left":"right":b===0?R=this.options.reverse?"right":"left":R="center"),s==="top"?d==="near"||g!==0?T=-C*M+M/2:d==="center"?T=-U.highest.height/2-B*M+M:T=-U.highest.height+M/2:d==="near"||g!==0?T=M/2:d==="center"?T=U.highest.height/2-B*M:T=U.highest.height-C*M,h&&(T*=-1),g!==0&&!H.showLabelBackdrop&&(k+=M/2*Math.sin(g))):(v=x,T=(1-C)*M/2);let W;if(H.showLabelBackdrop){const J=Vt(H.backdropPadding),G=U.heights[b],ot=U.widths[b];let nt=T-J.top,Y=0-J.left;switch($){case"middle":nt-=G/2;break;case"bottom":nt-=G;break}switch(S){case"center":Y-=ot/2;break;case"right":Y-=ot;break;case"inner":b===_-1?Y-=ot:b>0&&(Y-=ot/2);break}W={left:Y,top:nt,width:ot+J.width,height:G+J.height,color:H.backdropColor}}y.push({label:E,font:O,textOffset:T,options:{rotation:g,color:I,strokeColor:F,strokeWidth:P,textAlign:R,textBaseline:$,translation:[k,v],backdrop:W}})}return y}_getXAxisLabelAlignment(){const{position:t,ticks:e}=this.options;if(-ie(this.labelRotation))return t==="top"?"left":"right";let s="center";return e.align==="start"?s="left":e.align==="end"?s="right":e.align==="inner"&&(s="inner"),s}_getYAxisLabelAlignment(t){const{position:e,ticks:{crossAlign:i,mirror:s,padding:o}}=this.options,r=this._getLabelSizes(),a=t+o,c=r.widest.width;let d,u;return e==="left"?s?(u=this.right+o,i==="near"?d="left":i==="center"?(d="center",u+=c/2):(d="right",u+=c)):(u=this.right-a,i==="near"?d="right":i==="center"?(d="center",u-=c/2):(d="left",u=this.left)):e==="right"?s?(u=this.left+o,i==="near"?d="right":i==="center"?(d="center",u-=c/2):(d="left",u-=c)):(u=this.left+a,i==="near"?d="left":i==="center"?(d="center",u+=c/2):(d="right",u=this.right)):d="right",{textAlign:d,x:u}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,e=this.options.position;if(e==="left"||e==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(e==="top"||e==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){const{ctx:t,options:{backgroundColor:e},left:i,top:s,width:o,height:r}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(i,s,o,r),t.restore())}getLineWidthForValue(t){const e=this.options.grid;if(!this._isVisible()||!e.display)return 0;const s=this.ticks.findIndex(o=>o.value===t);return s>=0?e.setContext(this.getContext(s)).lineWidth:0}drawGrid(t){const e=this.options.grid,i=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let o,r;const a=(c,d,u)=>{!u.width||!u.color||(i.save(),i.lineWidth=u.width,i.strokeStyle=u.color,i.setLineDash(u.borderDash||[]),i.lineDashOffset=u.borderDashOffset,i.beginPath(),i.moveTo(c.x,c.y),i.lineTo(d.x,d.y),i.stroke(),i.restore())};if(e.display)for(o=0,r=s.length;o<r;++o){const c=s[o];e.drawOnChartArea&&a({x:c.x1,y:c.y1},{x:c.x2,y:c.y2},c),e.drawTicks&&a({x:c.tx1,y:c.ty1},{x:c.tx2,y:c.ty2},{color:c.tickColor,width:c.tickWidth,borderDash:c.tickBorderDash,borderDashOffset:c.tickBorderDashOffset})}}drawBorder(){const{chart:t,ctx:e,options:{border:i,grid:s}}=this,o=i.setContext(this.getContext()),r=i.display?o.width:0;if(!r)return;const a=s.setContext(this.getContext(0)).lineWidth,c=this._borderValue;let d,u,h,f;this.isHorizontal()?(d=Ze(t,this.left,r)-r/2,u=Ze(t,this.right,a)+a/2,h=f=c):(h=Ze(t,this.top,r)-r/2,f=Ze(t,this.bottom,a)+a/2,d=u=c),e.save(),e.lineWidth=o.width,e.strokeStyle=o.color,e.beginPath(),e.moveTo(d,h),e.lineTo(u,f),e.stroke(),e.restore()}drawLabels(t){if(!this.options.ticks.display)return;const i=this.ctx,s=this._computeLabelArea();s&&Zi(i,s);const o=this.getLabelItems(t);for(const r of o){const a=r.options,c=r.font,d=r.label,u=r.textOffset;tn(i,d,0,u,c,a)}s&&ts(i)}drawTitle(){const{ctx:t,options:{position:e,title:i,reverse:s}}=this;if(!i.display)return;const o=Ct(i.font),r=Vt(i.padding),a=i.align;let c=o.lineHeight/2;e==="bottom"||e==="center"||et(e)?(c+=r.bottom,_t(i.text)&&(c+=o.lineHeight*(i.text.length-1))):c+=r.top;const{titleX:d,titleY:u,maxWidth:h,rotation:f}=e0(this,c,e,a);tn(t,i.text,0,0,o,{color:i.color,maxWidth:h,rotation:f,textAlign:t0(a,e,s),textBaseline:"middle",translation:[d,u]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){const t=this.options,e=t.ticks&&t.ticks.z||0,i=Q(t.grid&&t.grid.z,-1),s=Q(t.border&&t.border.z,0);return!this._isVisible()||this.draw!==We.prototype.draw?[{z:e,draw:o=>{this.draw(o)}}]:[{z:i,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:s,draw:()=>{this.drawBorder()}},{z:e,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",s=[];let o,r;for(o=0,r=e.length;o<r;++o){const a=e[o];a[i]===this.id&&(!t||a.type===t)&&s.push(a)}return s}_resolveTickFontOptions(t){const e=this.options.ticks.setContext(this.getContext(t));return Ct(e.font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class ds{constructor(t,e,i){this.type=t,this.scope=e,this.override=i,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){const e=Object.getPrototypeOf(t);let i;s0(e)&&(i=this.register(e));const s=this.items,o=t.id,r=this.scope+"."+o;if(!o)throw new Error("class does not have id: "+t);return o in s||(s[o]=t,n0(t,r,i),this.override&>.override(t.id,t.overrides)),r}get(t){return this.items[t]}unregister(t){const e=this.items,i=t.id,s=this.scope;i in e&&delete e[i],s&&i in gt[s]&&(delete gt[s][i],this.override&&delete Je[i])}}function n0(n,t,e){const i=Jn(Object.create(null),[e?gt.get(e):{},gt.get(t),n.defaults]);gt.set(t,i),n.defaultRoutes&&i0(t,n.defaultRoutes),n.descriptors&>.describe(t,n.descriptors)}function i0(n,t){Object.keys(t).forEach(e=>{const i=e.split("."),s=i.pop(),o=[n].concat(i).join("."),r=t[e].split("."),a=r.pop(),c=r.join(".");gt.route(o,s,c,a)})}function s0(n){return"id"in n&&"defaults"in n}class o0{constructor(){this.controllers=new ds(Kt,"datasets",!0),this.elements=new ds(Xt,"elements"),this.plugins=new ds(Object,"plugins"),this.scales=new ds(We,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,i){[...e].forEach(s=>{const o=i||this._getRegistryForType(s);i||o.isForType(s)||o===this.plugins&&s.id?this._exec(t,o,s):lt(s,r=>{const a=i||this._getRegistryForType(r);this._exec(t,a,r)})})}_exec(t,e,i){const s=no(t);ft(i["before"+s],[],i),e[t](i),ft(i["after"+s],[],i)}_getRegistryForType(t){for(let e=0;e<this._typedRegistries.length;e++){const i=this._typedRegistries[e];if(i.isForType(t))return i}return this.plugins}_get(t,e,i){const s=e.get(t);if(s===void 0)throw new Error('"'+t+'" is not a registered '+i+".");return s}}var se=new o0;class r0{constructor(){this._init=[]}notify(t,e,i,s){e==="beforeInit"&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install"));const o=s?this._descriptors(t).filter(s):this._descriptors(t),r=this._notify(o,t,e,i);return e==="afterDestroy"&&(this._notify(o,t,"stop"),this._notify(this._init,t,"uninstall")),r}_notify(t,e,i,s){s=s||{};for(const o of t){const r=o.plugin,a=r[i],c=[e,s,o.options];if(ft(a,c,r)===!1&&s.cancelable)return!1}return!0}invalidate(){it(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const e=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),e}_createDescriptors(t,e){const i=t&&t.config,s=Q(i.options&&i.options.plugins,{}),o=a0(i);return s===!1&&!e?[]:c0(t,o,s,e)}_notifyStateChanges(t){const e=this._oldCache||[],i=this._cache,s=(o,r)=>o.filter(a=>!r.some(c=>a.plugin.id===c.plugin.id));this._notify(s(e,i),t,"stop"),this._notify(s(i,e),t,"start")}}function a0(n){const t={},e=[],i=Object.keys(se.plugins.items);for(let o=0;o<i.length;o++)e.push(se.getPlugin(i[o]));const s=n.plugins||[];for(let o=0;o<s.length;o++){const r=s[o];e.indexOf(r)===-1&&(e.push(r),t[r.id]=!0)}return{plugins:e,localIds:t}}function l0(n,t){return!t&&n===!1?null:n===!0?{}:n}function c0(n,{plugins:t,localIds:e},i,s){const o=[],r=n.getContext();for(const a of t){const c=a.id,d=l0(i[c],s);d!==null&&o.push({plugin:a,options:d0(n.config,{plugin:a,local:e[c]},d,r)})}return o}function d0(n,{plugin:t,local:e},i,s){const o=n.pluginScopeKeys(t),r=n.getOptionScopes(i,o);return e&&t.defaults&&r.push(t.defaults),n.createResolver(r,s,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function No(n,t){const e=gt.datasets[n]||{};return((t.datasets||{})[n]||{}).indexAxis||t.indexAxis||e.indexAxis||"x"}function u0(n,t){let e=n;return n==="_index_"?e=t:n==="_value_"&&(e=t==="x"?"y":"x"),e}function h0(n,t){return n===t?"_index_":"_value_"}function ic(n){if(n==="x"||n==="y"||n==="r")return n}function f0(n){if(n==="top"||n==="bottom")return"x";if(n==="left"||n==="right")return"y"}function To(n,...t){if(ic(n))return n;for(const e of t){const i=e.axis||f0(e.position)||n.length>1&&ic(n[0].toLowerCase());if(i)return i}throw new Error(`Cannot determine type of '${n}' axis. Please provide 'axis' or 'position' option.`)}function sc(n,t,e){if(e[t+"AxisID"]===n)return{axis:t}}function m0(n,t){if(t.data&&t.data.datasets){const e=t.data.datasets.filter(i=>i.xAxisID===n||i.yAxisID===n);if(e.length)return sc(n,"x",e[0])||sc(n,"y",e[0])}return{}}function p0(n,t){const e=Je[n.type]||{scales:{}},i=t.scales||{},s=No(n.type,t),o=Object.create(null);return Object.keys(i).forEach(r=>{const a=i[r];if(!et(a))return console.error(`Invalid scale configuration for scale: ${r}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${r}`);const c=To(r,a,m0(r,n),gt.scales[a.type]),d=h0(c,s),u=e.scales||{};o[r]=Zn(Object.create(null),[{axis:c},a,u[c],u[d]])}),n.data.datasets.forEach(r=>{const a=r.type||n.type,c=r.indexAxis||No(a,t),u=(Je[a]||{}).scales||{};Object.keys(u).forEach(h=>{const f=u0(h,c),m=r[f+"AxisID"]||f;o[m]=o[m]||Object.create(null),Zn(o[m],[{axis:f},i[m],u[h]])})}),Object.keys(o).forEach(r=>{const a=o[r];Zn(a,[gt.scales[a.type],gt.scale])}),o}function oc(n){const t=n.options||(n.options={});t.plugins=Q(t.plugins,{}),t.scales=p0(n,t)}function rc(n){return n=n||{},n.datasets=n.datasets||[],n.labels=n.labels||[],n}function g0(n){return n=n||{},n.data=rc(n.data),oc(n),n}const ac=new Map,lc=new Set;function us(n,t){let e=ac.get(n);return e||(e=t(),ac.set(n,e),lc.add(e)),e}const ki=(n,t,e)=>{const i=Re(t,e);i!==void 0&&n.add(i)};class y0{constructor(t){this._config=g0(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=rc(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),oc(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return us(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return us(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return us(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){const e=t.id,i=this.type;return us(`${i}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){const i=this._scopeCache;let s=i.get(t);return(!s||e)&&(s=new Map,i.set(t,s)),s}getOptionScopes(t,e,i){const{options:s,type:o}=this,r=this._cachedScopes(t,i),a=r.get(e);if(a)return a;const c=new Set;e.forEach(u=>{t&&(c.add(t),u.forEach(h=>ki(c,t,h))),u.forEach(h=>ki(c,s,h)),u.forEach(h=>ki(c,Je[o]||{},h)),u.forEach(h=>ki(c,gt,h)),u.forEach(h=>ki(c,co,h))});const d=Array.from(c);return d.length===0&&d.push(Object.create(null)),lc.has(e)&&r.set(e,d),d}chartOptionScopes(){const{options:t,type:e}=this;return[t,Je[e]||{},gt.datasets[e]||{},{type:e},gt,co]}resolveNamedOptions(t,e,i,s=[""]){const o={$shared:!0},{resolver:r,subPrefixes:a}=cc(this._resolverCache,t,s);let c=r;if(_0(r,e)){o.$shared=!1,i=Le(i)?i():i;const d=this.createResolver(t,i,a);c=xn(r,i,d)}for(const d of e)o[d]=c[d];return o}createResolver(t,e,i=[""],s){const{resolver:o}=cc(this._resolverCache,t,i);return et(e)?xn(o,e,void 0,s):o}}function cc(n,t,e){let i=n.get(t);i||(i=new Map,n.set(t,i));const s=e.join();let o=i.get(s);return o||(o={resolver:mo(t,e),subPrefixes:e.filter(a=>!a.toLowerCase().includes("hover"))},i.set(s,o)),o}const b0=n=>et(n)&&Object.getOwnPropertyNames(n).some(t=>Le(n[t]));function _0(n,t){const{isScriptable:e,isIndexable:i}=al(n);for(const s of t){const o=e(s),r=i(s),a=(r||o)&&n[s];if(o&&(Le(a)||b0(a))||r&&_t(a))return!0}return!1}var x0="4.4.7";const k0=["top","bottom","left","right","chartArea"];function dc(n,t){return n==="top"||n==="bottom"||k0.indexOf(n)===-1&&t==="x"}function uc(n,t){return function(e,i){return e[n]===i[n]?e[t]-i[t]:e[n]-i[n]}}function hc(n){const t=n.chart,e=t.options.animation;t.notifyPlugins("afterRender"),ft(e&&e.onComplete,[n],t)}function S0(n){const t=n.chart,e=t.options.animation;ft(e&&e.onProgress,[n],t)}function fc(n){return yo()&&typeof n=="string"?n=document.getElementById(n):n&&n.length&&(n=n[0]),n&&n.canvas&&(n=n.canvas),n}const hs={},mc=n=>{const t=fc(n);return Object.values(hs).filter(e=>e.canvas===t).pop()};function w0(n,t,e){const i=Object.keys(n);for(const s of i){const o=+s;if(o>=t){const r=n[s];delete n[s],(e>0||o>t)&&(n[o+e]=r)}}}function E0(n,t,e,i){return!e||n.type==="mouseout"?null:i?t:n}function fs(n,t,e){return n.options.clip?n[e]:t[e]}function v0(n,t){const{xScale:e,yScale:i}=n;return e&&i?{left:fs(e,t,"left"),right:fs(e,t,"right"),top:fs(i,t,"top"),bottom:fs(i,t,"bottom")}:t}class ue{static register(...t){se.add(...t),pc()}static unregister(...t){se.remove(...t),pc()}constructor(t,e){const i=this.config=new y0(e),s=fc(t),o=mc(s);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const r=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||Jl(s)),this.platform.updateConfig(i);const a=this.platform.acquireContext(s,r.aspectRatio),c=a&&a.canvas,d=c&&c.height,u=c&&c.width;if(this.id=Ay(),this.ctx=a,this.canvas=c,this.width=u,this.height=d,this._options=r,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new r0,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=Gy(h=>this.update(h),r.resizeDelay||0),this._dataChanges=[],hs[this.id]=this,!a||!c){console.error("Failed to create chart: can't acquire context from the given item");return}de.listen(this,"complete",hc),de.listen(this,"progress",S0),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:s,_aspectRatio:o}=this;return it(t)?e&&o?o:s?i/s:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return se}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():pl(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return sl(this.canvas,this.ctx),this}stop(){return de.stop(this),this}resize(t,e){de.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const i=this.options,s=this.canvas,o=i.maintainAspectRatio&&this.aspectRatio,r=this.platform.getMaximumSize(s,t,e,o),a=i.devicePixelRatio||this.platform.getDevicePixelRatio(),c=this.width?"resize":"attach";this.width=r.width,this.height=r.height,this._aspectRatio=this.aspectRatio,pl(this,a,!0)&&(this.notifyPlugins("resize",{size:r}),ft(i.onResize,[this,r],this),this.attached&&this._doResize(c)&&this.render())}ensureScalesHaveIDs(){const e=this.options.scales||{};lt(e,(i,s)=>{i.id=s})}buildOrUpdateScales(){const t=this.options,e=t.scales,i=this.scales,s=Object.keys(i).reduce((r,a)=>(r[a]=!1,r),{});let o=[];e&&(o=o.concat(Object.keys(e).map(r=>{const a=e[r],c=To(r,a),d=c==="r",u=c==="x";return{options:a,dposition:d?"chartArea":u?"bottom":"left",dtype:d?"radialLinear":u?"category":"linear"}}))),lt(o,r=>{const a=r.options,c=a.id,d=To(c,a),u=Q(a.type,r.dtype);(a.position===void 0||dc(a.position,d)!==dc(r.dposition))&&(a.position=r.dposition),s[c]=!0;let h=null;if(c in i&&i[c].type===u)h=i[c];else{const f=se.getScale(u);h=new f({id:c,type:u,ctx:this.ctx,chart:this}),i[h.id]=h}h.init(a,t)}),lt(s,(r,a)=>{r||delete i[a]}),lt(i,r=>{Pt.configure(this,r,r.options),Pt.addBox(this,r)})}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,i=t.length;if(t.sort((s,o)=>s.index-o.index),i>e){for(let s=e;s<i;++s)this._destroyDatasetMeta(s);t.splice(e,i-e)}this._sortedMetasets=t.slice(0).sort(uc("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:e}}=this;t.length>e.length&&delete this._stacks,t.forEach((i,s)=>{e.filter(o=>o===i._dataset).length===0&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let i,s;for(this._removeUnreferencedMetasets(),i=0,s=e.length;i<s;i++){const o=e[i];let r=this.getDatasetMeta(i);const a=o.type||this.config.type;if(r.type&&r.type!==a&&(this._destroyDatasetMeta(i),r=this.getDatasetMeta(i)),r.type=a,r.indexAxis=o.indexAxis||No(a,this.options),r.order=o.order||0,r.index=i,r.label=""+o.label,r.visible=this.isDatasetVisible(i),r.controller)r.controller.updateIndex(i),r.controller.linkScales();else{const c=se.getController(a),{datasetElementType:d,dataElementType:u}=gt.datasets[a];Object.assign(c,{dataElementType:se.getElement(u),datasetElementType:d&&se.getElement(d)}),r.controller=new c(this,i),t.push(r.controller)}}return this._updateMetasets(),t}_resetElements(){lt(this.data.datasets,(t,e)=>{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this.config;e.update();const i=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let r=0;for(let d=0,u=this.data.datasets.length;d<u;d++){const{controller:h}=this.getDatasetMeta(d),f=!s&&o.indexOf(h)===-1;h.buildOrUpdateElements(f),r=Math.max(+h.getMaxOverflow(),r)}r=this._minPadding=i.layout.autoPadding?r:0,this._updateLayout(r),s||lt(o,d=>{d.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(uc("z","_idx"));const{_active:a,_lastEvent:c}=this;c?this._eventHandler(c,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){lt(this.scales,t=>{Pt.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);(!Ia(e,i)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:i,start:s,count:o}of e){const r=i==="_removeElements"?-o:o;w0(t,s,r)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,i=o=>new Set(t.filter(r=>r[0]===o).map((r,a)=>a+","+r.splice(1).join(","))),s=i(0);for(let o=1;o<e;o++)if(!Ia(s,i(o)))return;return Array.from(s).map(o=>o.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;Pt.update(this,this.width,this.height,t);const e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],lt(this.boxes,s=>{i&&s.position==="chartArea"||(s.configure&&s.configure(),this._layers.push(...s._layers()))},this),this._layers.forEach((s,o)=>{s._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let e=0,i=this.data.datasets.length;e<i;++e)this.getDatasetMeta(e).controller.configure();for(let e=0,i=this.data.datasets.length;e<i;++e)this._updateDataset(e,Le(t)?t({datasetIndex:e}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,e){const i=this.getDatasetMeta(t),s={meta:i,index:t,mode:e,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",s)!==!1&&(i.controller._update(e),s.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",s))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(de.has(this)?this.attached&&!de.running(this)&&de.start(this):(this.draw(),hc({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:i,height:s}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(i,s)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;const e=this._layers;for(t=0;t<e.length&&e[t].z<=0;++t)e[t].draw(this.chartArea);for(this._drawDatasets();t<e.length;++t)e[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const e=this._sortedMetasets,i=[];let s,o;for(s=0,o=e.length;s<o;++s){const r=e[s];(!t||r.visible)&&i.push(r)}return i}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;const t=this.getSortedVisibleDatasetMetas();for(let e=t.length-1;e>=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,i=t._clip,s=!i.disabled,o=v0(t,this.chartArea),r={meta:t,index:t.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",r)!==!1&&(s&&Zi(e,{left:i.left===!1?0:o.left-i.left,right:i.right===!1?this.width:o.right+i.right,top:i.top===!1?0:o.top-i.top,bottom:i.bottom===!1?this.height:o.bottom+i.bottom}),t.controller.draw(),s&&ts(e),r.cancelable=!1,this.notifyPlugins("afterDatasetDraw",r))}isPointInArea(t){return ve(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,i,s){const o=Il.modes[e];return typeof o=="function"?o(this,t,i,s):[]}getDatasetMeta(t){const e=this.data.datasets[t],i=this._metasets;let s=i.filter(o=>o&&o._dataset===e).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},i.push(s)),s}getContext(){return this.$context||(this.$context=je(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const i=this.getDatasetMeta(t);return typeof i.hidden=="boolean"?!i.hidden:!e.hidden}setDatasetVisibility(t,e){const i=this.getDatasetMeta(t);i.hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,i){const s=i?"show":"hide",o=this.getDatasetMeta(t),r=o.controller._resolveAnimations(void 0,s);ti(e)?(o.data[e].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),r.update(o,{visible:i}),this.update(a=>a.datasetIndex===t?s:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),de.remove(this),t=0,e=this.data.datasets.length;t<e;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:t,ctx:e}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),sl(t,e),this.platform.releaseContext(e),this.canvas=null,this.ctx=null),delete hs[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const t=this._listeners,e=this.platform,i=(o,r)=>{e.addEventListener(this,o,r),t[o]=r},s=(o,r,a)=>{o.offsetX=r,o.offsetY=a,this._eventHandler(o)};lt(this.options.events,o=>i(o,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,i=(c,d)=>{e.addEventListener(this,c,d),t[c]=d},s=(c,d)=>{t[c]&&(e.removeEventListener(this,c,d),delete t[c])},o=(c,d)=>{this.canvas&&this.resize(c,d)};let r;const a=()=>{s("attach",a),this.attached=!0,this.resize(),i("resize",o),i("detach",r)};r=()=>{this.attached=!1,s("resize",o),this._stop(),this._resize(0,0),i("attach",a)},e.isAttached(this.canvas)?a():r()}unbindEvents(){lt(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},lt(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){const s=i?"set":"remove";let o,r,a,c;for(e==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+s+"DatasetHoverStyle"]()),a=0,c=t.length;a<c;++a){r=t[a];const d=r&&this.getDatasetMeta(r.datasetIndex).controller;d&&d[s+"HoverStyle"](r.element,r.datasetIndex,r.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const e=this._active||[],i=t.map(({datasetIndex:o,index:r})=>{const a=this.getDatasetMeta(o);if(!a)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:a.data[r],index:r}});!Ki(i,e)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,e))}notifyPlugins(t,e,i){return this._plugins.notify(this,t,e,i)}isPluginEnabled(t){return this._plugins._cache.filter(e=>e.plugin.id===t).length===1}_updateHoverStyles(t,e,i){const s=this.options.hover,o=(c,d)=>c.filter(u=>!d.some(h=>u.datasetIndex===h.datasetIndex&&u.index===h.index)),r=o(e,t),a=i?t:o(t,e);r.length&&this.updateHoverStyle(r,s.mode,!1),a.length&&s.mode&&this.updateHoverStyle(a,s.mode,!0)}_eventHandler(t,e){const i={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},s=r=>(r.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",i,s)===!1)return;const o=this._handleEvent(t,e,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,s),(o||i.changed)&&this.render(),this}_handleEvent(t,e,i){const{_active:s=[],options:o}=this,r=e,a=this._getActiveElements(t,s,i,r),c=Iy(t),d=E0(t,this._lastEvent,i,c);i&&(this._lastEvent=null,ft(o.onHover,[t,a,this],this),c&&ft(o.onClick,[t,a,this],this));const u=!Ki(a,s);return(u||e)&&(this._active=a,this._updateHoverStyles(a,s,e)),this._lastEvent=d,u}_getActiveElements(t,e,i,s){if(t.type==="mouseout")return[];if(!i)return e;const o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,s)}}L(ue,"defaults",gt),L(ue,"instances",hs),L(ue,"overrides",Je),L(ue,"registry",se),L(ue,"version",x0),L(ue,"getChart",mc);function pc(){return lt(ue.instances,n=>n._plugins.invalidate())}function C0(n,t,e){const{startAngle:i,pixelMargin:s,x:o,y:r,outerRadius:a,innerRadius:c}=t;let d=s/a;n.beginPath(),n.arc(o,r,a,i-d,e+d),c>s?(d=s/c,n.arc(o,r,c,e+d,i-d,!0)):n.arc(o,r,s,e+wt,i-wt),n.closePath(),n.clip()}function O0(n){return fo(n,["outerStart","outerEnd","innerStart","innerEnd"])}function D0(n,t,e,i){const s=O0(n.options.borderRadius),o=(e-t)/2,r=Math.min(o,i*t/2),a=c=>{const d=(e-Math.min(o,c))*i/2;return Dt(c,0,Math.min(o,d))};return{outerStart:a(s.outerStart),outerEnd:a(s.outerEnd),innerStart:Dt(s.innerStart,0,r),innerEnd:Dt(s.innerEnd,0,r)}}function En(n,t,e,i){return{x:e+n*Math.cos(t),y:i+n*Math.sin(t)}}function ms(n,t,e,i,s,o){const{x:r,y:a,startAngle:c,pixelMargin:d,innerRadius:u}=t,h=Math.max(t.outerRadius+i+e-d,0),f=u>0?u+i+e+d:0;let m=0;const p=s-c;if(i){const H=u>0?u-i:0,B=h>0?h-i:0,I=(H+B)/2,F=I!==0?p*I/(I+i):p;m=(p-F)/2}const g=Math.max(.001,p*h-e/mt)/h,y=(p-g)/2,b=c+y+m,_=s-y-m,{outerStart:w,outerEnd:E,innerStart:k,innerEnd:v}=D0(t,f,h,_-b),S=h-w,x=h-E,O=b+w/S,M=_-E/x,C=f+k,T=f+v,$=b+k/C,U=_-v/T;if(n.beginPath(),o){const H=(O+M)/2;if(n.arc(r,a,h,O,H),n.arc(r,a,h,H,M),E>0){const P=En(x,M,r,a);n.arc(P.x,P.y,E,M,_+wt)}const B=En(T,_,r,a);if(n.lineTo(B.x,B.y),v>0){const P=En(T,U,r,a);n.arc(P.x,P.y,v,_+wt,U+Math.PI)}const I=(_-v/f+(b+k/f))/2;if(n.arc(r,a,f,_-v/f,I,!0),n.arc(r,a,f,I,b+k/f,!0),k>0){const P=En(C,$,r,a);n.arc(P.x,P.y,k,$+Math.PI,b-wt)}const F=En(S,b,r,a);if(n.lineTo(F.x,F.y),w>0){const P=En(S,O,r,a);n.arc(P.x,P.y,w,b-wt,O)}}else{n.moveTo(r,a);const H=Math.cos(O)*h+r,B=Math.sin(O)*h+a;n.lineTo(H,B);const I=Math.cos(M)*h+r,F=Math.sin(M)*h+a;n.lineTo(I,F)}n.closePath()}function N0(n,t,e,i,s){const{fullCircles:o,startAngle:r,circumference:a}=t;let c=t.endAngle;if(o){ms(n,t,e,i,c,s);for(let d=0;d<o;++d)n.fill();isNaN(a)||(c=r+(a%pt||pt))}return ms(n,t,e,i,c,s),n.fill(),c}function T0(n,t,e,i,s){const{fullCircles:o,startAngle:r,circumference:a,options:c}=t,{borderWidth:d,borderJoinStyle:u,borderDash:h,borderDashOffset:f}=c,m=c.borderAlign==="inner";if(!d)return;n.setLineDash(h||[]),n.lineDashOffset=f,m?(n.lineWidth=d*2,n.lineJoin=u||"round"):(n.lineWidth=d,n.lineJoin=u||"bevel");let p=t.endAngle;if(o){ms(n,t,e,i,p,s);for(let g=0;g<o;++g)n.stroke();isNaN(a)||(p=r+(a%pt||pt))}m&&C0(n,t,p),o||(ms(n,t,e,i,p,s),n.stroke())}class vn extends Xt{constructor(e){super();L(this,"circumference");L(this,"endAngle");L(this,"fullCircles");L(this,"innerRadius");L(this,"outerRadius");L(this,"pixelMargin");L(this,"startAngle");this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,e&&Object.assign(this,e)}inRange(e,i,s){const o=this.getProps(["x","y"],s),{angle:r,distance:a}=Ua(o,{x:e,y:i}),{startAngle:c,endAngle:d,innerRadius:u,outerRadius:h,circumference:f}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],s),m=(this.options.spacing+this.options.borderWidth)/2,p=Q(f,d-c),g=ni(r,c,d)&&c!==d,y=p>=pt||g,b=we(a,u+m,h+m);return y&&b}getCenterPoint(e){const{x:i,y:s,startAngle:o,endAngle:r,innerRadius:a,outerRadius:c}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],e),{offset:d,spacing:u}=this.options,h=(o+r)/2,f=(a+c+u+d)/2;return{x:i+Math.cos(h)*f,y:s+Math.sin(h)*f}}tooltipPosition(e){return this.getCenterPoint(e)}draw(e){const{options:i,circumference:s}=this,o=(i.offset||0)/4,r=(i.spacing||0)/2,a=i.circular;if(this.pixelMargin=i.borderAlign==="inner"?.33:0,this.fullCircles=s>pt?Math.floor(s/pt):0,s===0||this.innerRadius<0||this.outerRadius<0)return;e.save();const c=(this.startAngle+this.endAngle)/2;e.translate(Math.cos(c)*o,Math.sin(c)*o);const d=1-Math.sin(Math.min(mt,s||0)),u=o*d;e.fillStyle=i.backgroundColor,e.strokeStyle=i.borderColor,N0(e,this,u,r,a),T0(e,this,u,r,a),e.restore()}}L(vn,"id","arc"),L(vn,"defaults",{borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0}),L(vn,"defaultRoutes",{backgroundColor:"backgroundColor"}),L(vn,"descriptors",{_scriptable:!0,_indexable:e=>e!=="borderDash"});function gc(n,t,e=t){n.lineCap=Q(e.borderCapStyle,t.borderCapStyle),n.setLineDash(Q(e.borderDash,t.borderDash)),n.lineDashOffset=Q(e.borderDashOffset,t.borderDashOffset),n.lineJoin=Q(e.borderJoinStyle,t.borderJoinStyle),n.lineWidth=Q(e.borderWidth,t.borderWidth),n.strokeStyle=Q(e.borderColor,t.borderColor)}function P0(n,t,e){n.lineTo(e.x,e.y)}function M0(n){return n.stepped?lb:n.tension||n.cubicInterpolationMode==="monotone"?cb:P0}function yc(n,t,e={}){const i=n.length,{start:s=0,end:o=i-1}=e,{start:r,end:a}=t,c=Math.max(s,r),d=Math.min(o,a),u=s<r&&o<r||s>a&&o>a;return{count:i,start:c,loop:t.loop,ilen:d<c&&!u?i+d-c:d-c}}function V0(n,t,e,i){const{points:s,options:o}=t,{count:r,start:a,loop:c,ilen:d}=yc(s,e,i),u=M0(o);let{move:h=!0,reverse:f}=i||{},m,p,g;for(m=0;m<=d;++m)p=s[(a+(f?d-m:m))%r],!p.skip&&(h?(n.moveTo(p.x,p.y),h=!1):u(n,g,p,f,o.stepped),g=p);return c&&(p=s[(a+(f?d:0))%r],u(n,g,p,f,o.stepped)),!!c}function A0(n,t,e,i){const s=t.points,{count:o,start:r,ilen:a}=yc(s,e,i),{move:c=!0,reverse:d}=i||{};let u=0,h=0,f,m,p,g,y,b;const _=E=>(r+(d?a-E:E))%o,w=()=>{g!==y&&(n.lineTo(u,y),n.lineTo(u,g),n.lineTo(u,b))};for(c&&(m=s[_(0)],n.moveTo(m.x,m.y)),f=0;f<=a;++f){if(m=s[_(f)],m.skip)continue;const E=m.x,k=m.y,v=E|0;v===p?(k<g?g=k:k>y&&(y=k),u=(h*u+E)/++h):(w(),n.lineTo(E,k),p=v,h=0,g=y=k),b=k}w()}function Po(n){const t=n.options,e=t.borderDash&&t.borderDash.length;return!n._decimated&&!n._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!e?A0:V0}function F0(n){return n.stepped?jb:n.tension||n.cubicInterpolationMode==="monotone"?zb:on}function B0(n,t,e,i){let s=t._path;s||(s=t._path=new Path2D,t.path(s,e,i)&&s.closePath()),gc(n,t.options),n.stroke(s)}function $0(n,t,e,i){const{segments:s,options:o}=t,r=Po(t);for(const a of s)gc(n,o,a.style),n.beginPath(),r(n,t,a,{start:e,end:e+i-1})&&n.closePath(),n.stroke()}const R0=typeof Path2D=="function";function L0(n,t,e,i){R0&&!t.options.segment?B0(n,t,e,i):$0(n,t,e,i)}class Ce extends Xt{constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){const i=this.options;if((i.tension||i.cubicInterpolationMode==="monotone")&&!i.stepped&&!this._pointsUpdated){const s=i.spanGaps?this._loop:this._fullLoop;Vb(this._points,i,t,s,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=Kb(this,this.options.segment))}first(){const t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){const t=this.segments,e=this.points,i=t.length;return i&&e[t[i-1].end]}interpolate(t,e){const i=this.options,s=t[e],o=this.points,r=Sl(this,{property:e,start:s,end:s});if(!r.length)return;const a=[],c=F0(i);let d,u;for(d=0,u=r.length;d<u;++d){const{start:h,end:f}=r[d],m=o[h],p=o[f];if(m===p){a.push(m);continue}const g=Math.abs((s-m[e])/(p[e]-m[e])),y=c(m,p,g,i.stepped);y[e]=t[e],a.push(y)}return a.length===1?a[0]:a}pathSegment(t,e,i){return Po(this)(t,this,e,i)}path(t,e,i){const s=this.segments,o=Po(this);let r=this._loop;e=e||0,i=i||this.points.length-e;for(const a of s)r&=o(t,this,a,{start:e,end:e+i-1});return!!r}draw(t,e,i,s){const o=this.options||{};(this.points||[]).length&&o.borderWidth&&(t.save(),L0(t,this,i,s),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}L(Ce,"id","line"),L(Ce,"defaults",{borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0}),L(Ce,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"}),L(Ce,"descriptors",{_scriptable:!0,_indexable:t=>t!=="borderDash"&&t!=="fill"});function bc(n,t,e,i){const s=n.options,{[e]:o}=n.getProps([e],i);return Math.abs(t-o)<s.radius+s.hitRadius}class Si extends Xt{constructor(e){super();L(this,"parsed");L(this,"skip");L(this,"stop");this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,e&&Object.assign(this,e)}inRange(e,i,s){const o=this.options,{x:r,y:a}=this.getProps(["x","y"],s);return Math.pow(e-r,2)+Math.pow(i-a,2)<Math.pow(o.hitRadius+o.radius,2)}inXRange(e,i){return bc(this,e,"x",i)}inYRange(e,i){return bc(this,e,"y",i)}getCenterPoint(e){const{x:i,y:s}=this.getProps(["x","y"],e);return{x:i,y:s}}size(e){e=e||this.options||{};let i=e.radius||0;i=Math.max(i,i&&e.hoverRadius||0);const s=i&&e.borderWidth||0;return(i+s)*2}draw(e,i){const s=this.options;this.skip||s.radius<.1||!ve(this,i,this.size(s)/2)||(e.strokeStyle=s.borderColor,e.lineWidth=s.borderWidth,e.fillStyle=s.backgroundColor,ho(e,s,this.x,this.y))}getRange(){const e=this.options||{};return e.radius+e.hitRadius}}L(Si,"id","point"),L(Si,"defaults",{borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0}),L(Si,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});function _c(n,t){const{x:e,y:i,base:s,width:o,height:r}=n.getProps(["x","y","base","width","height"],t);let a,c,d,u,h;return n.horizontal?(h=r/2,a=Math.min(e,s),c=Math.max(e,s),d=i-h,u=i+h):(h=o/2,a=e-h,c=e+h,d=Math.min(i,s),u=Math.max(i,s)),{left:a,top:d,right:c,bottom:u}}function He(n,t,e,i){return n?0:Dt(t,e,i)}function I0(n,t,e){const i=n.options.borderWidth,s=n.borderSkipped,o=rl(i);return{t:He(s.top,o.top,0,e),r:He(s.right,o.right,0,t),b:He(s.bottom,o.bottom,0,e),l:He(s.left,o.left,0,t)}}function j0(n,t,e){const{enableBorderRadius:i}=n.getProps(["enableBorderRadius"]),s=n.options.borderRadius,o=en(s),r=Math.min(t,e),a=n.borderSkipped,c=i||et(s);return{topLeft:He(!c||a.top||a.left,o.topLeft,0,r),topRight:He(!c||a.top||a.right,o.topRight,0,r),bottomLeft:He(!c||a.bottom||a.left,o.bottomLeft,0,r),bottomRight:He(!c||a.bottom||a.right,o.bottomRight,0,r)}}function z0(n){const t=_c(n),e=t.right-t.left,i=t.bottom-t.top,s=I0(n,e/2,i/2),o=j0(n,e/2,i/2);return{outer:{x:t.left,y:t.top,w:e,h:i,radius:o},inner:{x:t.left+s.l,y:t.top+s.t,w:e-s.l-s.r,h:i-s.t-s.b,radius:{topLeft:Math.max(0,o.topLeft-Math.max(s.t,s.l)),topRight:Math.max(0,o.topRight-Math.max(s.t,s.r)),bottomLeft:Math.max(0,o.bottomLeft-Math.max(s.b,s.l)),bottomRight:Math.max(0,o.bottomRight-Math.max(s.b,s.r))}}}}function Mo(n,t,e,i){const s=t===null,o=e===null,a=n&&!(s&&o)&&_c(n,i);return a&&(s||we(t,a.left,a.right))&&(o||we(e,a.top,a.bottom))}function W0(n){return n.topLeft||n.topRight||n.bottomLeft||n.bottomRight}function H0(n,t){n.rect(t.x,t.y,t.w,t.h)}function Vo(n,t,e={}){const i=n.x!==e.x?-t:0,s=n.y!==e.y?-t:0,o=(n.x+n.w!==e.x+e.w?t:0)-i,r=(n.y+n.h!==e.y+e.h?t:0)-s;return{x:n.x+i,y:n.y+s,w:n.w+o,h:n.h+r,radius:n.radius}}class wi extends Xt{constructor(t){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,t&&Object.assign(this,t)}draw(t){const{inflateAmount:e,options:{borderColor:i,backgroundColor:s}}=this,{inner:o,outer:r}=z0(this),a=W0(r.radius)?ai:H0;t.save(),(r.w!==o.w||r.h!==o.h)&&(t.beginPath(),a(t,Vo(r,e,o)),t.clip(),a(t,Vo(o,-e,r)),t.fillStyle=i,t.fill("evenodd")),t.beginPath(),a(t,Vo(o,e)),t.fillStyle=s,t.fill(),t.restore()}inRange(t,e,i){return Mo(this,t,e,i)}inXRange(t,e){return Mo(this,t,null,e)}inYRange(t,e){return Mo(this,null,t,e)}getCenterPoint(t){const{x:e,y:i,base:s,horizontal:o}=this.getProps(["x","y","base","horizontal"],t);return{x:o?(e+s)/2:e,y:o?i:(i+s)/2}}getRange(t){return t==="x"?this.width/2:this.height/2}}L(wi,"id","bar"),L(wi,"defaults",{borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0}),L(wi,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});var xc=Object.freeze({__proto__:null,ArcElement:vn,BarElement:wi,LineElement:Ce,PointElement:Si});const Ao=["rgb(54, 162, 235)","rgb(255, 99, 132)","rgb(255, 159, 64)","rgb(255, 205, 86)","rgb(75, 192, 192)","rgb(153, 102, 255)","rgb(201, 203, 207)"],kc=Ao.map(n=>n.replace("rgb(","rgba(").replace(")",", 0.5)"));function Sc(n){return Ao[n%Ao.length]}function wc(n){return kc[n%kc.length]}function U0(n,t){return n.borderColor=Sc(t),n.backgroundColor=wc(t),++t}function q0(n,t){return n.backgroundColor=n.data.map(()=>Sc(t++)),t}function Y0(n,t){return n.backgroundColor=n.data.map(()=>wc(t++)),t}function K0(n){let t=0;return(e,i)=>{const s=n.getDatasetMeta(i).controller;s instanceof ze?t=q0(e,t):s instanceof wn?t=Y0(e,t):s&&(t=U0(e,t))}}function Ec(n){let t;for(t in n)if(n[t].borderColor||n[t].backgroundColor)return!0;return!1}function X0(n){return n&&(n.borderColor||n.backgroundColor)}function G0(){return gt.borderColor!=="rgba(0,0,0,0.1)"||gt.backgroundColor!=="rgba(0,0,0,0.1)"}var vc={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(n,t,e){if(!e.enabled)return;const{data:{datasets:i},options:s}=n.config,{elements:o}=s,r=Ec(i)||X0(s)||o&&Ec(o)||G0();if(!e.forceOverride&&r)return;const a=K0(n);i.forEach(a)}};function Q0(n,t,e,i,s){const o=s.samples||i;if(o>=e)return n.slice(t,t+e);const r=[],a=(e-2)/(o-2);let c=0;const d=t+e-1;let u=t,h,f,m,p,g;for(r[c++]=n[u],h=0;h<o-2;h++){let y=0,b=0,_;const w=Math.floor((h+1)*a)+1+t,E=Math.min(Math.floor((h+2)*a)+1,e)+t,k=E-w;for(_=w;_<E;_++)y+=n[_].x,b+=n[_].y;y/=k,b/=k;const v=Math.floor(h*a)+1+t,S=Math.min(Math.floor((h+1)*a)+1,e)+t,{x,y:O}=n[u];for(m=p=-1,_=v;_<S;_++)p=.5*Math.abs((x-y)*(n[_].y-O)-(x-n[_].x)*(b-O)),p>m&&(m=p,f=n[_],g=_);r[c++]=f,u=g}return r[c++]=n[d],r}function J0(n,t,e,i){let s=0,o=0,r,a,c,d,u,h,f,m,p,g;const y=[],b=t+e-1,_=n[t].x,E=n[b].x-_;for(r=t;r<t+e;++r){a=n[r],c=(a.x-_)/E*i,d=a.y;const k=c|0;if(k===u)d<p?(p=d,h=r):d>g&&(g=d,f=r),s=(o*s+a.x)/++o;else{const v=r-1;if(!it(h)&&!it(f)){const S=Math.min(h,f),x=Math.max(h,f);S!==m&&S!==v&&y.push({...n[S],x:s}),x!==m&&x!==v&&y.push({...n[x],x:s})}r>0&&v!==m&&y.push(n[v]),y.push(a),u=k,o=0,p=g=d,h=f=m=r}}return y}function Cc(n){if(n._decimated){const t=n._data;delete n._decimated,delete n._data,Object.defineProperty(n,"data",{configurable:!0,enumerable:!0,writable:!0,value:t})}}function Oc(n){n.data.datasets.forEach(t=>{Cc(t)})}function Z0(n,t){const e=t.length;let i=0,s;const{iScale:o}=n,{min:r,max:a,minDefined:c,maxDefined:d}=o.getUserBounds();return c&&(i=Dt(Ee(t,o.axis,r).lo,0,e-1)),d?s=Dt(Ee(t,o.axis,a).hi+1,i,e)-i:s=e-i,{start:i,count:s}}var Dc={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(n,t,e)=>{if(!e.enabled){Oc(n);return}const i=n.width;n.data.datasets.forEach((s,o)=>{const{_data:r,indexAxis:a}=s,c=n.getDatasetMeta(o),d=r||s.data;if(li([a,n.options.indexAxis])==="y"||!c.controller.supportsDecimation)return;const u=n.scales[c.xAxisID];if(u.type!=="linear"&&u.type!=="time"||n.options.parsing)return;let{start:h,count:f}=Z0(c,d);const m=e.threshold||4*i;if(f<=m){Cc(s);return}it(r)&&(s._data=d,delete s.data,Object.defineProperty(s,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(g){this._data=g}}));let p;switch(e.algorithm){case"lttb":p=Q0(d,h,f,i,e);break;case"min-max":p=J0(d,h,f,i);break;default:throw new Error(`Unsupported decimation algorithm '${e.algorithm}'`)}s._decimated=p})},destroy(n){Oc(n)}};function tx(n,t,e){const i=n.segments,s=n.points,o=t.points,r=[];for(const a of i){let{start:c,end:d}=a;d=Bo(c,d,s);const u=Fo(e,s[c],s[d],a.loop);if(!t.segments){r.push({source:a,target:u,start:s[c],end:s[d]});continue}const h=Sl(t,u);for(const f of h){const m=Fo(e,o[f.start],o[f.end],f.loop),p=kl(a,s,m);for(const g of p)r.push({source:g,target:f,start:{[e]:Nc(u,m,"start",Math.max)},end:{[e]:Nc(u,m,"end",Math.min)}})}}return r}function Fo(n,t,e,i){if(i)return;let s=t[n],o=e[n];return n==="angle"&&(s=Wt(s),o=Wt(o)),{property:n,start:s,end:o}}function ex(n,t){const{x:e=null,y:i=null}=n||{},s=t.points,o=[];return t.segments.forEach(({start:r,end:a})=>{a=Bo(r,a,s);const c=s[r],d=s[a];i!==null?(o.push({x:c.x,y:i}),o.push({x:d.x,y:i})):e!==null&&(o.push({x:e,y:c.y}),o.push({x:e,y:d.y}))}),o}function Bo(n,t,e){for(;t>n;t--){const i=e[t];if(!isNaN(i.x)&&!isNaN(i.y))break}return t}function Nc(n,t,e,i){return n&&t?i(n[e],t[e]):n?n[e]:t?t[e]:0}function Tc(n,t){let e=[],i=!1;return _t(n)?(i=!0,e=n):e=ex(n,t),e.length?new Ce({points:e,options:{tension:0},_loop:i,_fullLoop:i}):null}function Pc(n){return n&&n.fill!==!1}function nx(n,t,e){let s=n[t].fill;const o=[t];let r;if(!e)return s;for(;s!==!1&&o.indexOf(s)===-1;){if(!St(s))return s;if(r=n[s],!r)return!1;if(r.visible)return s;o.push(s),s=r.fill}return!1}function ix(n,t,e){const i=ax(n);if(et(i))return isNaN(i.value)?!1:i;let s=parseFloat(i);return St(s)&&Math.floor(s)===s?sx(i[0],t,s,e):["origin","start","end","stack","shape"].indexOf(i)>=0&&i}function sx(n,t,e,i){return(n==="-"||n==="+")&&(e=t+e),e===t||e<0||e>=i?!1:e}function ox(n,t){let e=null;return n==="start"?e=t.bottom:n==="end"?e=t.top:et(n)?e=t.getPixelForValue(n.value):t.getBasePixel&&(e=t.getBasePixel()),e}function rx(n,t,e){let i;return n==="start"?i=e:n==="end"?i=t.options.reverse?t.min:t.max:et(n)?i=n.value:i=t.getBaseValue(),i}function ax(n){const t=n.options,e=t.fill;let i=Q(e&&e.target,e);return i===void 0&&(i=!!t.backgroundColor),i===!1||i===null?!1:i===!0?"origin":i}function lx(n){const{scale:t,index:e,line:i}=n,s=[],o=i.segments,r=i.points,a=cx(t,e);a.push(Tc({x:null,y:t.bottom},i));for(let c=0;c<o.length;c++){const d=o[c];for(let u=d.start;u<=d.end;u++)dx(s,r[u],a)}return new Ce({points:s,options:{}})}function cx(n,t){const e=[],i=n.getMatchingVisibleMetas("line");for(let s=0;s<i.length;s++){const o=i[s];if(o.index===t)break;o.hidden||e.unshift(o.dataset)}return e}function dx(n,t,e){const i=[];for(let s=0;s<e.length;s++){const o=e[s],{first:r,last:a,point:c}=ux(o,t,"x");if(!(!c||r&&a)){if(r)i.unshift(c);else if(n.push(c),!a)break}}n.push(...i)}function ux(n,t,e){const i=n.interpolate(t,e);if(!i)return{};const s=i[e],o=n.segments,r=n.points;let a=!1,c=!1;for(let d=0;d<o.length;d++){const u=o[d],h=r[u.start][e],f=r[u.end][e];if(we(s,h,f)){a=s===h,c=s===f;break}}return{first:a,last:c,point:i}}class Mc{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,e,i){const{x:s,y:o,radius:r}=this;return e=e||{start:0,end:pt},t.arc(s,o,r,e.end,e.start,!0),!i.bounds}interpolate(t){const{x:e,y:i,radius:s}=this,o=t.angle;return{x:e+Math.cos(o)*s,y:i+Math.sin(o)*s,angle:o}}}function hx(n){const{chart:t,fill:e,line:i}=n;if(St(e))return fx(t,e);if(e==="stack")return lx(n);if(e==="shape")return!0;const s=mx(n);return s instanceof Mc?s:Tc(s,i)}function fx(n,t){const e=n.getDatasetMeta(t);return e&&n.isDatasetVisible(t)?e.dataset:null}function mx(n){return(n.scale||{}).getPointPositionForValue?gx(n):px(n)}function px(n){const{scale:t={},fill:e}=n,i=ox(e,t);if(St(i)){const s=t.isHorizontal();return{x:s?i:null,y:s?null:i}}return null}function gx(n){const{scale:t,fill:e}=n,i=t.options,s=t.getLabels().length,o=i.reverse?t.max:t.min,r=rx(e,t,o),a=[];if(i.grid.circular){const c=t.getPointPositionForValue(0,o);return new Mc({x:c.x,y:c.y,radius:t.getDistanceFromCenterForValue(r)})}for(let c=0;c<s;++c)a.push(t.getPointPositionForValue(c,r));return a}function $o(n,t,e){const i=hx(t),{line:s,scale:o,axis:r}=t,a=s.options,c=a.fill,d=a.backgroundColor,{above:u=d,below:h=d}=c||{};i&&s.points.length&&(Zi(n,e),yx(n,{line:s,target:i,above:u,below:h,area:e,scale:o,axis:r}),ts(n))}function yx(n,t){const{line:e,target:i,above:s,below:o,area:r,scale:a}=t,c=e._loop?"angle":t.axis;n.save(),c==="x"&&o!==s&&(Vc(n,i,r.top),Ac(n,{line:e,target:i,color:s,scale:a,property:c}),n.restore(),n.save(),Vc(n,i,r.bottom)),Ac(n,{line:e,target:i,color:o,scale:a,property:c}),n.restore()}function Vc(n,t,e){const{segments:i,points:s}=t;let o=!0,r=!1;n.beginPath();for(const a of i){const{start:c,end:d}=a,u=s[c],h=s[Bo(c,d,s)];o?(n.moveTo(u.x,u.y),o=!1):(n.lineTo(u.x,e),n.lineTo(u.x,u.y)),r=!!t.pathSegment(n,a,{move:r}),r?n.closePath():n.lineTo(h.x,e)}n.lineTo(t.first().x,e),n.closePath(),n.clip()}function Ac(n,t){const{line:e,target:i,property:s,color:o,scale:r}=t,a=tx(e,i,s);for(const{source:c,target:d,start:u,end:h}of a){const{style:{backgroundColor:f=o}={}}=c,m=i!==!0;n.save(),n.fillStyle=f,bx(n,r,m&&Fo(s,u,h)),n.beginPath();const p=!!e.pathSegment(n,c);let g;if(m){p?n.closePath():Fc(n,i,h,s);const y=!!i.pathSegment(n,d,{move:p,reverse:!0});g=p&&y,g||Fc(n,i,u,s)}n.closePath(),n.fill(g?"evenodd":"nonzero"),n.restore()}}function bx(n,t,e){const{top:i,bottom:s}=t.chart.chartArea,{property:o,start:r,end:a}=e||{};o==="x"&&(n.beginPath(),n.rect(r,i,a-r,s-i),n.clip())}function Fc(n,t,e,i){const s=t.interpolate(e,i);s&&n.lineTo(s.x,s.y)}var Bc={id:"filler",afterDatasetsUpdate(n,t,e){const i=(n.data.datasets||[]).length,s=[];let o,r,a,c;for(r=0;r<i;++r)o=n.getDatasetMeta(r),a=o.dataset,c=null,a&&a.options&&a instanceof Ce&&(c={visible:n.isDatasetVisible(r),index:r,fill:ix(a,r,i),chart:n,axis:o.controller.options.indexAxis,scale:o.vScale,line:a}),o.$filler=c,s.push(c);for(r=0;r<i;++r)c=s[r],!(!c||c.fill===!1)&&(c.fill=nx(s,r,e.propagate))},beforeDraw(n,t,e){const i=e.drawTime==="beforeDraw",s=n.getSortedVisibleDatasetMetas(),o=n.chartArea;for(let r=s.length-1;r>=0;--r){const a=s[r].$filler;a&&(a.line.updateControlPoints(o,a.axis),i&&a.fill&&$o(n.ctx,a,o))}},beforeDatasetsDraw(n,t,e){if(e.drawTime!=="beforeDatasetsDraw")return;const i=n.getSortedVisibleDatasetMetas();for(let s=i.length-1;s>=0;--s){const o=i[s].$filler;Pc(o)&&$o(n.ctx,o,n.chartArea)}},beforeDatasetDraw(n,t,e){const i=t.meta.$filler;!Pc(i)||e.drawTime!=="beforeDatasetDraw"||$o(n.ctx,i,n.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const $c=(n,t)=>{let{boxHeight:e=t,boxWidth:i=t}=n;return n.usePointStyle&&(e=Math.min(e,t),i=n.pointStyleWidth||Math.min(i,t)),{boxWidth:i,boxHeight:e,itemHeight:Math.max(t,e)}},_x=(n,t)=>n!==null&&t!==null&&n.datasetIndex===t.datasetIndex&&n.index===t.index;class Rc extends Xt{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,i){this.maxWidth=t,this.maxHeight=e,this._margins=i,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let e=ft(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter(i=>t.filter(i,this.chart.data))),t.sort&&(e=e.sort((i,s)=>t.sort(i,s,this.chart.data))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){const{options:t,ctx:e}=this;if(!t.display){this.width=this.height=0;return}const i=t.labels,s=Ct(i.font),o=s.size,r=this._computeTitleHeight(),{boxWidth:a,itemHeight:c}=$c(i,o);let d,u;e.font=s.string,this.isHorizontal()?(d=this.maxWidth,u=this._fitRows(r,o,a,c)+10):(u=this.maxHeight,d=this._fitCols(r,s,a,c)+10),this.width=Math.min(d,t.maxWidth||this.maxWidth),this.height=Math.min(u,t.maxHeight||this.maxHeight)}_fitRows(t,e,i,s){const{ctx:o,maxWidth:r,options:{labels:{padding:a}}}=this,c=this.legendHitBoxes=[],d=this.lineWidths=[0],u=s+a;let h=t;o.textAlign="left",o.textBaseline="middle";let f=-1,m=-u;return this.legendItems.forEach((p,g)=>{const y=i+e/2+o.measureText(p.text).width;(g===0||d[d.length-1]+y+2*a>r)&&(h+=u,d[d.length-(g>0?0:1)]=0,m+=u,f++),c[g]={left:0,top:m,row:f,width:y,height:s},d[d.length-1]+=y+a}),h}_fitCols(t,e,i,s){const{ctx:o,maxHeight:r,options:{labels:{padding:a}}}=this,c=this.legendHitBoxes=[],d=this.columnSizes=[],u=r-t;let h=a,f=0,m=0,p=0,g=0;return this.legendItems.forEach((y,b)=>{const{itemWidth:_,itemHeight:w}=xx(i,e,o,y,s);b>0&&m+w+2*a>u&&(h+=f+a,d.push({width:f,height:m}),p+=f+a,g++,f=m=0),c[b]={left:p,top:m,col:g,width:_,height:w},f=Math.max(f,_),m+=w+a}),h+=f,d.push({width:f,height:m}),h}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:i,labels:{padding:s},rtl:o}}=this,r=Sn(o,this.left,this.width);if(this.isHorizontal()){let a=0,c=Mt(i,this.left+s,this.right-this.lineWidths[a]);for(const d of e)a!==d.row&&(a=d.row,c=Mt(i,this.left+s,this.right-this.lineWidths[a])),d.top+=this.top+t+s,d.left=r.leftForLtr(r.x(c),d.width),c+=d.width+s}else{let a=0,c=Mt(i,this.top+t+s,this.bottom-this.columnSizes[a].height);for(const d of e)d.col!==a&&(a=d.col,c=Mt(i,this.top+t+s,this.bottom-this.columnSizes[a].height)),d.top=c,d.left+=this.left+s,d.left=r.leftForLtr(r.x(d.left),d.width),c+=d.height+s}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const t=this.ctx;Zi(t,this),this._draw(),ts(t)}}_draw(){const{options:t,columnSizes:e,lineWidths:i,ctx:s}=this,{align:o,labels:r}=t,a=gt.color,c=Sn(t.rtl,this.left,this.width),d=Ct(r.font),{padding:u}=r,h=d.size,f=h/2;let m;this.drawTitle(),s.textAlign=c.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=d.string;const{boxWidth:p,boxHeight:g,itemHeight:y}=$c(r,h),b=function(v,S,x){if(isNaN(p)||p<=0||isNaN(g)||g<0)return;s.save();const O=Q(x.lineWidth,1);if(s.fillStyle=Q(x.fillStyle,a),s.lineCap=Q(x.lineCap,"butt"),s.lineDashOffset=Q(x.lineDashOffset,0),s.lineJoin=Q(x.lineJoin,"miter"),s.lineWidth=O,s.strokeStyle=Q(x.strokeStyle,a),s.setLineDash(Q(x.lineDash,[])),r.usePointStyle){const M={radius:g*Math.SQRT2/2,pointStyle:x.pointStyle,rotation:x.rotation,borderWidth:O},C=c.xPlus(v,p/2),T=S+f;ol(s,M,C,T,r.pointStyleWidth&&p)}else{const M=S+Math.max((h-g)/2,0),C=c.leftForLtr(v,p),T=en(x.borderRadius);s.beginPath(),Object.values(T).some($=>$!==0)?ai(s,{x:C,y:M,w:p,h:g,radius:T}):s.rect(C,M,p,g),s.fill(),O!==0&&s.stroke()}s.restore()},_=function(v,S,x){tn(s,x.text,v,S+y/2,d,{strikethrough:x.hidden,textAlign:c.textAlign(x.textAlign)})},w=this.isHorizontal(),E=this._computeTitleHeight();w?m={x:Mt(o,this.left+u,this.right-i[0]),y:this.top+u+E,line:0}:m={x:this.left+u,y:Mt(o,this.top+E+u,this.bottom-e[0].height),line:0},yl(this.ctx,t.textDirection);const k=y+u;this.legendItems.forEach((v,S)=>{s.strokeStyle=v.fontColor,s.fillStyle=v.fontColor;const x=s.measureText(v.text).width,O=c.textAlign(v.textAlign||(v.textAlign=r.textAlign)),M=p+f+x;let C=m.x,T=m.y;c.setWidth(this.width),w?S>0&&C+M+u>this.right&&(T=m.y+=k,m.line++,C=m.x=Mt(o,this.left+u,this.right-i[m.line])):S>0&&T+k>this.bottom&&(C=m.x=C+e[m.line].width+u,m.line++,T=m.y=Mt(o,this.top+E+u,this.bottom-e[m.line].height));const $=c.x(C);if(b($,T,v),C=Qy(O,C+p+f,w?C+M:this.right,t.rtl),_(c.x(C),T,v),w)m.x+=M+u;else if(typeof v.text!="string"){const U=d.lineHeight;m.y+=Lc(v,U)+u}else m.y+=k}),bl(this.ctx,t.textDirection)}drawTitle(){const t=this.options,e=t.title,i=Ct(e.font),s=Vt(e.padding);if(!e.display)return;const o=Sn(t.rtl,this.left,this.width),r=this.ctx,a=e.position,c=i.size/2,d=s.top+c;let u,h=this.left,f=this.width;if(this.isHorizontal())f=Math.max(...this.lineWidths),u=this.top+d,h=Mt(t.align,h,this.right-f);else{const p=this.columnSizes.reduce((g,y)=>Math.max(g,y.height),0);u=d+Mt(t.align,this.top,this.bottom-p-t.labels.padding-this._computeTitleHeight())}const m=Mt(a,h,h+f);r.textAlign=o.textAlign(ro(a)),r.textBaseline="middle",r.strokeStyle=e.color,r.fillStyle=e.color,r.font=i.string,tn(r,e.text,m,u,i)}_computeTitleHeight(){const t=this.options.title,e=Ct(t.font),i=Vt(t.padding);return t.display?e.lineHeight+i.height:0}_getLegendItemAt(t,e){let i,s,o;if(we(t,this.left,this.right)&&we(e,this.top,this.bottom)){for(o=this.legendHitBoxes,i=0;i<o.length;++i)if(s=o[i],we(t,s.left,s.left+s.width)&&we(e,s.top,s.top+s.height))return this.legendItems[i]}return null}handleEvent(t){const e=this.options;if(!wx(t.type,e))return;const i=this._getLegendItemAt(t.x,t.y);if(t.type==="mousemove"||t.type==="mouseout"){const s=this._hoveredItem,o=_x(s,i);s&&!o&&ft(e.onLeave,[t,s,this],this),this._hoveredItem=i,i&&!o&&ft(e.onHover,[t,i,this],this)}else i&&ft(e.onClick,[t,i,this],this)}}function xx(n,t,e,i,s){const o=kx(i,n,t,e),r=Sx(s,i,t.lineHeight);return{itemWidth:o,itemHeight:r}}function kx(n,t,e,i){let s=n.text;return s&&typeof s!="string"&&(s=s.reduce((o,r)=>o.length>r.length?o:r)),t+e.size/2+i.measureText(s).width}function Sx(n,t,e){let i=n;return typeof t.text!="string"&&(i=Lc(t,e)),i}function Lc(n,t){const e=n.text?n.text.length:0;return t*e}function wx(n,t){return!!((n==="mousemove"||n==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(n==="click"||n==="mouseup"))}var Ic={id:"legend",_element:Rc,start(n,t,e){const i=n.legend=new Rc({ctx:n.ctx,options:e,chart:n});Pt.configure(n,i,e),Pt.addBox(n,i)},stop(n){Pt.removeBox(n,n.legend),delete n.legend},beforeUpdate(n,t,e){const i=n.legend;Pt.configure(n,i,e),i.options=e},afterUpdate(n){const t=n.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(n,t){t.replay||n.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(n,t,e){const i=t.datasetIndex,s=e.chart;s.isDatasetVisible(i)?(s.hide(i),t.hidden=!0):(s.show(i),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:n=>n.chart.options.color,boxWidth:40,padding:10,generateLabels(n){const t=n.data.datasets,{labels:{usePointStyle:e,pointStyle:i,textAlign:s,color:o,useBorderRadius:r,borderRadius:a}}=n.legend.options;return n._getSortedDatasetMetas().map(c=>{const d=c.controller.getStyle(e?0:void 0),u=Vt(d.borderWidth);return{text:t[c.index].label,fillStyle:d.backgroundColor,fontColor:o,hidden:!c.visible,lineCap:d.borderCapStyle,lineDash:d.borderDash,lineDashOffset:d.borderDashOffset,lineJoin:d.borderJoinStyle,lineWidth:(u.width+u.height)/4,strokeStyle:d.borderColor,pointStyle:i||d.pointStyle,rotation:d.rotation,textAlign:s||d.textAlign,borderRadius:r&&(a||d.borderRadius),datasetIndex:c.index}},this)}},title:{color:n=>n.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:n=>!n.startsWith("on"),labels:{_scriptable:n=>!["generateLabels","filter","sort"].includes(n)}}};class Ro extends Xt{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e){const i=this.options;if(this.left=0,this.top=0,!i.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=t,this.height=this.bottom=e;const s=_t(i.text)?i.text.length:1;this._padding=Vt(i.padding);const o=s*Ct(i.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){const t=this.options.position;return t==="top"||t==="bottom"}_drawArgs(t){const{top:e,left:i,bottom:s,right:o,options:r}=this,a=r.align;let c=0,d,u,h;return this.isHorizontal()?(u=Mt(a,i,o),h=e+t,d=o-i):(r.position==="left"?(u=i+t,h=Mt(a,s,e),c=mt*-.5):(u=o-t,h=Mt(a,e,s),c=mt*.5),d=s-e),{titleX:u,titleY:h,maxWidth:d,rotation:c}}draw(){const t=this.ctx,e=this.options;if(!e.display)return;const i=Ct(e.font),o=i.lineHeight/2+this._padding.top,{titleX:r,titleY:a,maxWidth:c,rotation:d}=this._drawArgs(o);tn(t,e.text,0,0,i,{color:e.color,maxWidth:c,rotation:d,textAlign:ro(e.align),textBaseline:"middle",translation:[r,a]})}}function Ex(n,t){const e=new Ro({ctx:n.ctx,options:t,chart:n});Pt.configure(n,e,t),Pt.addBox(n,e),n.titleBlock=e}var jc={id:"title",_element:Ro,start(n,t,e){Ex(n,e)},stop(n){const t=n.titleBlock;Pt.removeBox(n,t),delete n.titleBlock},beforeUpdate(n,t,e){const i=n.titleBlock;Pt.configure(n,i,e),i.options=e},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const ps=new WeakMap;var zc={id:"subtitle",start(n,t,e){const i=new Ro({ctx:n.ctx,options:e,chart:n});Pt.configure(n,i,e),Pt.addBox(n,i),ps.set(n,i)},stop(n){Pt.removeBox(n,ps.get(n)),ps.delete(n)},beforeUpdate(n,t,e){const i=ps.get(n);Pt.configure(n,i,e),i.options=e},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const Ei={average(n){if(!n.length)return!1;let t,e,i=new Set,s=0,o=0;for(t=0,e=n.length;t<e;++t){const a=n[t].element;if(a&&a.hasValue()){const c=a.tooltipPosition();i.add(c.x),s+=c.y,++o}}return o===0||i.size===0?!1:{x:[...i].reduce((a,c)=>a+c)/i.size,y:s/o}},nearest(n,t){if(!n.length)return!1;let e=t.x,i=t.y,s=Number.POSITIVE_INFINITY,o,r,a;for(o=0,r=n.length;o<r;++o){const c=n[o].element;if(c&&c.hasValue()){const d=c.getCenterPoint(),u=so(t,d);u<s&&(s=u,a=c)}}if(a){const c=a.tooltipPosition();e=c.x,i=c.y}return{x:e,y:i}}};function he(n,t){return t&&(_t(t)?Array.prototype.push.apply(n,t):n.push(t)),n}function Oe(n){return(typeof n=="string"||n instanceof String)&&n.indexOf(`
|
|
171
|
+
*/class d_{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,i,s){const o=e.listeners[s],r=e.duration;o.forEach(l=>l({chart:t,initial:e.initial,numSteps:r,currentStep:Math.min(i-e.start,r)}))}_refresh(){this._request||(this._running=!0,this._request=el.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((i,s)=>{if(!i.running||!i.items.length)return;const o=i.items;let r=o.length-1,l=!1,c;for(;r>=0;--r)c=o[r],c._active?(c._total>i.duration&&(i.duration=c._total),c.tick(t),l=!0):(o[r]=o[o.length-1],o.pop());l&&(s.draw(),this._notify(s,i,t,"progress")),o.length||(i.running=!1,this._notify(s,i,t,"complete"),i.initial=!1),e+=o.length}),this._lastDate=t,e===0&&(this._running=!1)}_getAnims(t){const e=this._charts;let i=e.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,i)),i}listen(t,e,i){this._getAnims(t).listeners[e].push(i)}add(t,e){!e||!e.length||this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((i,s)=>Math.max(i,s._duration),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!(!e||!e.running||!e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const i=e.items;let s=i.length-1;for(;s>=0;--s)i[s].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var ue=new d_;const Pl="transparent",u_={boolean(n,t,e){return e>.5?t:n},color(n,t,e){const i=al(n||Pl),s=i.valid&&al(t||Pl);return s&&s.valid?s.mix(i,e).hexString():t},number(n,t,e){return n+(t-n)*e}};class Ml{constructor(t,e,i,s){const o=e[i];s=li([t.to,s,o,t.from]);const r=li([t.from,o,s]);this._active=!0,this._fn=t.fn||u_[t.type||typeof r],this._easing=ii[t.easing]||ii.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=i,this._from=r,this._to=s,this._promises=void 0}active(){return this._active}update(t,e,i){if(this._active){this._notify(!1);const s=this._target[this._prop],o=i-this._start,r=this._duration-o;this._start=i,this._duration=Math.floor(Math.max(r,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=li([t.to,e,s,t.from]),this._from=li([t.from,s,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,i=this._duration,s=this._prop,o=this._from,r=this._loop,l=this._to;let c;if(this._active=o!==l&&(r||e<i),!this._active){this._target[s]=l,this._notify(!0);return}if(e<0){this._target[s]=o;return}c=e/i%2,c=r&&c>1?2-c:c,c=this._easing(Math.min(1,Math.max(0,c))),this._target[s]=this._fn(o,l,c)}wait(){const t=this._promises||(this._promises=[]);return new Promise((e,i)=>{t.push({res:e,rej:i})})}_notify(t){const e=t?"res":"rej",i=this._promises||[];for(let s=0;s<i.length;s++)i[s][e]()}}class So{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!et(t))return;const e=Object.keys(gt.animation),i=this._properties;Object.getOwnPropertyNames(t).forEach(s=>{const o=t[s];if(!et(o))return;const r={};for(const l of e)r[l]=o[l];(_t(o.properties)&&o.properties||[s]).forEach(l=>{(l===s||!i.has(l))&&i.set(l,r)})})}_animateOptions(t,e){const i=e.options,s=f_(t,i);if(!s)return[];const o=this._createAnimations(s,i);return i.$shared&&h_(t.options.$animations,i).then(()=>{t.options=i},()=>{}),o}_createAnimations(t,e){const i=this._properties,s=[],o=t.$animations||(t.$animations={}),r=Object.keys(e),l=Date.now();let c;for(c=r.length-1;c>=0;--c){const d=r[c];if(d.charAt(0)==="$")continue;if(d==="options"){s.push(...this._animateOptions(t,e));continue}const u=e[d];let h=o[d];const f=i.get(d);if(h)if(f&&h.active()){h.update(f,u,l);continue}else h.cancel();if(!f||!f.duration){t[d]=u;continue}o[d]=h=new Ml(f,t,d,u),s.push(h)}return s}update(t,e){if(this._properties.size===0){Object.assign(t,e);return}const i=this._createAnimations(t,e);if(i.length)return ue.add(this._chart,i),!0}}function h_(n,t){const e=[],i=Object.keys(t);for(let s=0;s<i.length;s++){const o=n[i[s]];o&&o.active()&&e.push(o.wait())}return Promise.all(e)}function f_(n,t){if(!t)return;let e=n.options;if(!e){n.options=t;return}return e.$shared&&(n.options=e=Object.assign({},e,{$shared:!1,$animations:{}})),e}function Vl(n,t){const e=n&&n.options||{},i=e.reverse,s=e.min===void 0?t:0,o=e.max===void 0?t:0;return{start:i?o:s,end:i?s:o}}function m_(n,t,e){if(e===!1)return!1;const i=Vl(n,e),s=Vl(t,e);return{top:s.end,right:i.end,bottom:s.start,left:i.start}}function p_(n){let t,e,i,s;return et(n)?(t=n.top,e=n.right,i=n.bottom,s=n.left):t=e=i=s=n,{top:t,right:e,bottom:i,left:s,disabled:n===!1}}function Al(n,t){const e=[],i=n._getSortedDatasetMetas(t);let s,o;for(s=0,o=i.length;s<o;++s)e.push(i[s].index);return e}function Bl(n,t,e,i={}){const s=n.keys,o=i.mode==="single";let r,l,c,d;if(t===null)return;let u=!1;for(r=0,l=s.length;r<l;++r){if(c=+s[r],c===e){if(u=!0,i.all)continue;break}d=n.values[c],St(d)&&(o||t===0||de(t)===de(d))&&(t+=d)}return!u&&!i.all?0:t}function g_(n,t){const{iScale:e,vScale:i}=t,s=e.axis==="x"?"x":"y",o=i.axis==="x"?"x":"y",r=Object.keys(n),l=new Array(r.length);let c,d,u;for(c=0,d=r.length;c<d;++c)u=r[c],l[c]={[s]:u,[o]:n[u]};return l}function wo(n,t){const e=n&&n.options.stacked;return e||e===void 0&&t.stack!==void 0}function y_(n,t,e){return`${n.id}.${t.id}.${e.stack||e.type}`}function b_(n){const{min:t,max:e,minDefined:i,maxDefined:s}=n.getUserBounds();return{min:i?t:Number.NEGATIVE_INFINITY,max:s?e:Number.POSITIVE_INFINITY}}function __(n,t,e){const i=n[t]||(n[t]={});return i[e]||(i[e]={})}function Fl(n,t,e,i){for(const s of t.getMatchingVisibleMetas(i).reverse()){const o=n[s.index];if(e&&o>0||!e&&o<0)return s.index}return null}function $l(n,t){const{chart:e,_cachedMeta:i}=n,s=e._stacks||(e._stacks={}),{iScale:o,vScale:r,index:l}=i,c=o.axis,d=r.axis,u=y_(o,r,i),h=t.length;let f;for(let m=0;m<h;++m){const p=t[m],{[c]:g,[d]:y}=p,b=p._stacks||(p._stacks={});f=b[d]=__(s,u,g),f[l]=y,f._top=Fl(f,r,!0,i.type),f._bottom=Fl(f,r,!1,i.type);const _=f._visualValues||(f._visualValues={});_[l]=y}}function Eo(n,t){const e=n.scales;return Object.keys(e).filter(i=>e[i].axis===t).shift()}function x_(n,t){return je(n,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function k_(n,t,e){return je(n,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:e,index:t,mode:"default",type:"data"})}function ci(n,t){const e=n.controller.index,i=n.vScale&&n.vScale.axis;if(i){t=t||n._parsed;for(const s of t){const o=s._stacks;if(!o||o[i]===void 0||o[i][e]===void 0)return;delete o[i][e],o[i]._visualValues!==void 0&&o[i]._visualValues[e]!==void 0&&delete o[i]._visualValues[e]}}}const Co=n=>n==="reset"||n==="none",Rl=(n,t)=>t?n:Object.assign({},n),S_=(n,t,e)=>n&&!t.hidden&&t._stacked&&{keys:Al(e,!0),values:null};class Kt{constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=wo(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&ci(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,i=this.getDataset(),s=(h,f,m,p)=>h==="x"?f:h==="r"?p:m,o=e.xAxisID=Q(i.xAxisID,Eo(t,"x")),r=e.yAxisID=Q(i.yAxisID,Eo(t,"y")),l=e.rAxisID=Q(i.rAxisID,Eo(t,"r")),c=e.indexAxis,d=e.iAxisID=s(c,o,r,l),u=e.vAxisID=s(c,r,o,l);e.xScale=this.getScaleForId(o),e.yScale=this.getScaleForId(r),e.rScale=this.getScaleForId(l),e.iScale=this.getScaleForId(d),e.vScale=this.getScaleForId(u)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&Za(this._data,this),t._stacked&&ci(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if(et(e)){const s=this._cachedMeta;this._data=g_(e,s)}else if(i!==e){if(i){Za(i,this);const s=this._cachedMeta;ci(s),s._parsed=[]}e&&Object.isExtensible(e)&&lb(e,this),this._syncList=[],this._data=e}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const e=this._cachedMeta,i=this.getDataset();let s=!1;this._dataCheck();const o=e._stacked;e._stacked=wo(e.vScale,e),e.stack!==i.stack&&(s=!0,ci(e),e.stack=i.stack),this._resyncElements(t),(s||o!==e._stacked)&&($l(this,e._parsed),e._stacked=wo(e.vScale,e))}configure(){const t=this.chart.config,e=t.datasetScopeKeys(this._type),i=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){const{_cachedMeta:i,_data:s}=this,{iScale:o,_stacked:r}=i,l=o.axis;let c=t===0&&e===s.length?!0:i._sorted,d=t>0&&i._parsed[t-1],u,h,f;if(this._parsing===!1)i._parsed=s,i._sorted=!0,f=s;else{_t(s[t])?f=this.parseArrayData(i,s,t,e):et(s[t])?f=this.parseObjectData(i,s,t,e):f=this.parsePrimitiveData(i,s,t,e);const m=()=>h[l]===null||d&&h[l]<d[l];for(u=0;u<e;++u)i._parsed[u+t]=h=f[u],c&&(m()&&(c=!1),d=h);i._sorted=c}r&&$l(this,f)}parsePrimitiveData(t,e,i,s){const{iScale:o,vScale:r}=t,l=o.axis,c=r.axis,d=o.getLabels(),u=o===r,h=new Array(s);let f,m,p;for(f=0,m=s;f<m;++f)p=f+i,h[f]={[l]:u||o.parse(d[p],p),[c]:r.parse(e[p],p)};return h}parseArrayData(t,e,i,s){const{xScale:o,yScale:r}=t,l=new Array(s);let c,d,u,h;for(c=0,d=s;c<d;++c)u=c+i,h=e[u],l[c]={x:o.parse(h[0],u),y:r.parse(h[1],u)};return l}parseObjectData(t,e,i,s){const{xScale:o,yScale:r}=t,{xAxisKey:l="x",yAxisKey:c="y"}=this._parsing,d=new Array(s);let u,h,f,m;for(u=0,h=s;u<h;++u)f=u+i,m=e[f],d[u]={x:o.parse(Re(m,l),f),y:r.parse(Re(m,c),f)};return d}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,e,i){const s=this.chart,o=this._cachedMeta,r=e[t.axis],l={keys:Al(s,!0),values:e._stacks[t.axis]._visualValues};return Bl(l,r,o.index,{mode:i})}updateRangeFromParsed(t,e,i,s){const o=i[e.axis];let r=o===null?NaN:o;const l=s&&i._stacks[e.axis];s&&l&&(s.values=l,r=Bl(s,o,this._cachedMeta.index)),t.min=Math.min(t.min,r),t.max=Math.max(t.max,r)}getMinMax(t,e){const i=this._cachedMeta,s=i._parsed,o=i._sorted&&t===i.iScale,r=s.length,l=this._getOtherScale(t),c=S_(e,i,this.chart),d={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:u,max:h}=b_(l);let f,m;function p(){m=s[f];const g=m[l.axis];return!St(m[t.axis])||u>g||h<g}for(f=0;f<r&&!(!p()&&(this.updateRangeFromParsed(d,t,m,c),o));++f);if(o){for(f=r-1;f>=0;--f)if(!p()){this.updateRangeFromParsed(d,t,m,c);break}}return d}getAllParsedValues(t){const e=this._cachedMeta._parsed,i=[];let s,o,r;for(s=0,o=e.length;s<o;++s)r=e[s][t.axis],St(r)&&i.push(r);return i}getMaxOverflow(){return!1}getLabelAndValue(t){const e=this._cachedMeta,i=e.iScale,s=e.vScale,o=this.getParsed(t);return{label:i?""+i.getLabelForValue(o[i.axis]):"",value:s?""+s.getLabelForValue(o[s.axis]):""}}_update(t){const e=this._cachedMeta;this.update(t||"default"),e._clip=p_(Q(this.options.clip,m_(e.xScale,e.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,e=this.chart,i=this._cachedMeta,s=i.data||[],o=e.chartArea,r=[],l=this._drawStart||0,c=this._drawCount||s.length-l,d=this.options.drawActiveElementsOnTop;let u;for(i.dataset&&i.dataset.draw(t,o,l,c),u=l;u<l+c;++u){const h=s[u];h.hidden||(h.active&&d?r.push(h):h.draw(t,o))}for(u=0;u<r.length;++u)r[u].draw(t,o)}getStyle(t,e){const i=e?"active":"default";return t===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(i):this.resolveDataElementOptions(t||0,i)}getContext(t,e,i){const s=this.getDataset();let o;if(t>=0&&t<this._cachedMeta.data.length){const r=this._cachedMeta.data[t];o=r.$context||(r.$context=k_(this.getContext(),t,r)),o.parsed=this.getParsed(t),o.raw=s.data[t],o.index=o.dataIndex=t}else o=this.$context||(this.$context=x_(this.chart.getContext(),this.index)),o.dataset=s,o.index=o.datasetIndex=this.index;return o.active=!!e,o.mode=i,o}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,e){return this._resolveElementOptions(this.dataElementType.id,e,t)}_resolveElementOptions(t,e="default",i){const s=e==="active",o=this._cachedDataOpts,r=t+"-"+e,l=o[r],c=this.enableOptionSharing&&ti(i);if(l)return Rl(l,c);const d=this.chart.config,u=d.datasetElementScopeKeys(this._type,t),h=s?[`${t}Hover`,"hover",t,""]:[t,""],f=d.getOptionScopes(this.getDataset(),u),m=Object.keys(gt.elements[t]),p=()=>this.getContext(i,s,e),g=d.resolveNamedOptions(f,m,p,h);return g.$shared&&(g.$shared=c,o[r]=Object.freeze(Rl(g,c))),g}_resolveAnimations(t,e,i){const s=this.chart,o=this._cachedDataOpts,r=`animation-${e}`,l=o[r];if(l)return l;let c;if(s.options.animation!==!1){const u=this.chart.config,h=u.datasetAnimationScopeKeys(this._type,e),f=u.getOptionScopes(this.getDataset(),h);c=u.createResolver(f,this.getContext(t,i,e))}const d=new So(s,c&&c.animations);return c&&c._cacheable&&(o[r]=Object.freeze(d)),d}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||Co(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const i=this.resolveDataElementOptions(t,e),s=this._sharedOptions,o=this.getSharedOptions(i),r=this.includeOptions(e,o)||o!==s;return this.updateSharedOptions(o,e,i),{sharedOptions:o,includeOptions:r}}updateElement(t,e,i,s){Co(s)?Object.assign(t,i):this._resolveAnimations(e,s).update(t,i)}updateSharedOptions(t,e,i){t&&!Co(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,s){t.active=s;const o=this.getStyle(e,s);this._resolveAnimations(e,i,s).update(t,{options:!s&&this.getSharedOptions(o)||o})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const e=this._data,i=this._cachedMeta.data;for(const[l,c,d]of this._syncList)this[l](c,d);this._syncList=[];const s=i.length,o=e.length,r=Math.min(o,s);r&&this.parse(0,r),o>s?this._insertElements(s,o-s,t):o<s&&this._removeElements(o,s-o)}_insertElements(t,e,i=!0){const s=this._cachedMeta,o=s.data,r=t+e;let l;const c=d=>{for(d.length+=e,l=d.length-1;l>=r;l--)d[l]=d[l-e]};for(c(o),l=t;l<r;++l)o[l]=new this.dataElementType;this._parsing&&c(s._parsed),this.parse(t,e),i&&this.updateElements(o,t,e,"reset")}updateElements(t,e,i,s){}_removeElements(t,e){const i=this._cachedMeta;if(this._parsing){const s=i._parsed.splice(t,e);i._stacked&&ci(i,s)}i.data.splice(t,e)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[e,i,s]=t;this[e](i,s)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){const t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,e){e&&this._sync(["_removeElements",t,e]);const i=arguments.length-2;i&&this._sync(["_insertElements",t,i])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}L(Kt,"defaults",{}),L(Kt,"datasetElementType",null),L(Kt,"dataElementType",null);function w_(n,t){if(!n._cache.$bar){const e=n.getMatchingVisibleMetas(t);let i=[];for(let s=0,o=e.length;s<o;s++)i=i.concat(e[s].controller.getAllParsedValues(n));n._cache.$bar=tl(i.sort((s,o)=>s-o))}return n._cache.$bar}function E_(n){const t=n.iScale,e=w_(t,n.type);let i=t._length,s,o,r,l;const c=()=>{r===32767||r===-32768||(ti(l)&&(i=Math.min(i,Math.abs(r-l)||i)),l=r)};for(s=0,o=e.length;s<o;++s)r=t.getPixelForValue(e[s]),c();for(l=void 0,s=0,o=t.ticks.length;s<o;++s)r=t.getPixelForTick(s),c();return i}function C_(n,t,e,i){const s=e.barThickness;let o,r;return it(s)?(o=t.min*e.categoryPercentage,r=e.barPercentage):(o=s*i,r=1),{chunk:o/i,ratio:r,start:t.pixels[n]-o/2}}function v_(n,t,e,i){const s=t.pixels,o=s[n];let r=n>0?s[n-1]:null,l=n<s.length-1?s[n+1]:null;const c=e.categoryPercentage;r===null&&(r=o-(l===null?t.end-t.start:l-o)),l===null&&(l=o+o-r);const d=o-(o-Math.min(r,l))/2*c;return{chunk:Math.abs(l-r)/2*c/i,ratio:e.barPercentage,start:d}}function O_(n,t,e,i){const s=e.parse(n[0],i),o=e.parse(n[1],i),r=Math.min(s,o),l=Math.max(s,o);let c=r,d=l;Math.abs(r)>Math.abs(l)&&(c=l,d=r),t[e.axis]=d,t._custom={barStart:c,barEnd:d,start:s,end:o,min:r,max:l}}function Ll(n,t,e,i){return _t(n)?O_(n,t,e,i):t[e.axis]=e.parse(n,i),t}function Il(n,t,e,i){const s=n.iScale,o=n.vScale,r=s.getLabels(),l=s===o,c=[];let d,u,h,f;for(d=e,u=e+i;d<u;++d)f=t[d],h={},h[s.axis]=l||s.parse(r[d],d),c.push(Ll(f,h,o,d));return c}function vo(n){return n&&n.barStart!==void 0&&n.barEnd!==void 0}function D_(n,t,e){return n!==0?de(n):(t.isHorizontal()?1:-1)*(t.min>=e?1:-1)}function N_(n){let t,e,i,s,o;return n.horizontal?(t=n.base>n.x,e="left",i="right"):(t=n.base<n.y,e="bottom",i="top"),t?(s="end",o="start"):(s="start",o="end"),{start:e,end:i,reverse:t,top:s,bottom:o}}function T_(n,t,e,i){let s=t.borderSkipped;const o={};if(!s){n.borderSkipped=o;return}if(s===!0){n.borderSkipped={top:!0,right:!0,bottom:!0,left:!0};return}const{start:r,end:l,reverse:c,top:d,bottom:u}=N_(n);s==="middle"&&e&&(n.enableBorderRadius=!0,(e._top||0)===i?s=d:(e._bottom||0)===i?s=u:(o[jl(u,r,l,c)]=!0,s=d)),o[jl(s,r,l,c)]=!0,n.borderSkipped=o}function jl(n,t,e,i){return i?(n=P_(n,t,e),n=zl(n,e,t)):n=zl(n,t,e),n}function P_(n,t,e){return n===t?e:n===e?t:n}function zl(n,t,e){return n==="start"?t:n==="end"?e:n}function M_(n,{inflateAmount:t},e){n.inflateAmount=t==="auto"?e===1?.33:0:t}class di extends Kt{parsePrimitiveData(t,e,i,s){return Il(t,e,i,s)}parseArrayData(t,e,i,s){return Il(t,e,i,s)}parseObjectData(t,e,i,s){const{iScale:o,vScale:r}=t,{xAxisKey:l="x",yAxisKey:c="y"}=this._parsing,d=o.axis==="x"?l:c,u=r.axis==="x"?l:c,h=[];let f,m,p,g;for(f=i,m=i+s;f<m;++f)g=e[f],p={},p[o.axis]=o.parse(Re(g,d),f),h.push(Ll(Re(g,u),p,r,f));return h}updateRangeFromParsed(t,e,i,s){super.updateRangeFromParsed(t,e,i,s);const o=i._custom;o&&e===this._cachedMeta.vScale&&(t.min=Math.min(t.min,o.min),t.max=Math.max(t.max,o.max))}getMaxOverflow(){return 0}getLabelAndValue(t){const e=this._cachedMeta,{iScale:i,vScale:s}=e,o=this.getParsed(t),r=o._custom,l=vo(r)?"["+r.start+", "+r.end+"]":""+s.getLabelForValue(o[s.axis]);return{label:""+i.getLabelForValue(o[i.axis]),value:l}}initialize(){this.enableOptionSharing=!0,super.initialize();const t=this._cachedMeta;t.stack=this.getDataset().stack}update(t){const e=this._cachedMeta;this.updateElements(e.data,0,e.data.length,t)}updateElements(t,e,i,s){const o=s==="reset",{index:r,_cachedMeta:{vScale:l}}=this,c=l.getBasePixel(),d=l.isHorizontal(),u=this._getRuler(),{sharedOptions:h,includeOptions:f}=this._getSharedOptions(e,s);for(let m=e;m<e+i;m++){const p=this.getParsed(m),g=o||it(p[l.axis])?{base:c,head:c}:this._calculateBarValuePixels(m),y=this._calculateBarIndexPixels(m,u),b=(p._stacks||{})[l.axis],_={horizontal:d,base:g.base,enableBorderRadius:!b||vo(p._custom)||r===b._top||r===b._bottom,x:d?g.head:y.center,y:d?y.center:g.head,height:d?y.size:Math.abs(g.size),width:d?Math.abs(g.size):y.size};f&&(_.options=h||this.resolveDataElementOptions(m,t[m].active?"active":s));const w=_.options||t[m].options;T_(_,w,b,r),M_(_,w,u.ratio),this.updateElement(t[m],m,_,s)}}_getStacks(t,e){const{iScale:i}=this._cachedMeta,s=i.getMatchingVisibleMetas(this._type).filter(u=>u.controller.options.grouped),o=i.options.stacked,r=[],l=this._cachedMeta.controller.getParsed(e),c=l&&l[i.axis],d=u=>{const h=u._parsed.find(m=>m[i.axis]===c),f=h&&h[u.vScale.axis];if(it(f)||isNaN(f))return!0};for(const u of s)if(!(e!==void 0&&d(u))&&((o===!1||r.indexOf(u.stack)===-1||o===void 0&&u.stack===void 0)&&r.push(u.stack),u.index===t))break;return r.length||r.push(void 0),r}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,i){const s=this._getStacks(t,i),o=e!==void 0?s.indexOf(e):-1;return o===-1?s.length-1:o}_getRuler(){const t=this.options,e=this._cachedMeta,i=e.iScale,s=[];let o,r;for(o=0,r=e.data.length;o<r;++o)s.push(i.getPixelForValue(this.getParsed(o)[i.axis],o));const l=t.barThickness;return{min:l||E_(e),pixels:s,start:i._startPixel,end:i._endPixel,stackCount:this._getStackCount(),scale:i,grouped:t.grouped,ratio:l?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){const{_cachedMeta:{vScale:e,_stacked:i,index:s},options:{base:o,minBarLength:r}}=this,l=o||0,c=this.getParsed(t),d=c._custom,u=vo(d);let h=c[e.axis],f=0,m=i?this.applyStack(e,c,i):h,p,g;m!==h&&(f=m-h,m=h),u&&(h=d.barStart,m=d.barEnd-d.barStart,h!==0&&de(h)!==de(d.barEnd)&&(f=0),f+=h);const y=!it(o)&&!u?o:f;let b=e.getPixelForValue(y);if(this.chart.getDataVisibility(t)?p=e.getPixelForValue(f+m):p=b,g=p-b,Math.abs(g)<r){g=D_(g,e,l)*r,h===l&&(b-=g/2);const _=e.getPixelForDecimal(0),w=e.getPixelForDecimal(1),E=Math.min(_,w),k=Math.max(_,w);b=Math.max(Math.min(b,k),E),p=b+g,i&&!u&&(c._stacks[e.axis]._visualValues[s]=e.getValueForPixel(p)-e.getValueForPixel(b))}if(b===e.getPixelForValue(l)){const _=de(g)*e.getLineWidthForValue(l)/2;b+=_,g-=_}return{size:g,base:b,head:p,center:p+g/2}}_calculateBarIndexPixels(t,e){const i=e.scale,s=this.options,o=s.skipNull,r=Q(s.maxBarThickness,1/0);let l,c;if(e.grouped){const d=o?this._getStackCount(t):e.stackCount,u=s.barThickness==="flex"?v_(t,e,s,d):C_(t,e,s,d),h=this._getStackIndex(this.index,this._cachedMeta.stack,o?t:void 0);l=u.start+u.chunk*h+u.chunk/2,c=Math.min(r,u.chunk*u.ratio)}else l=i.getPixelForValue(this.getParsed(t)[i.axis],t),c=Math.min(r,e.min*e.ratio);return{base:l-c/2,head:l+c/2,center:l,size:c}}draw(){const t=this._cachedMeta,e=t.vScale,i=t.data,s=i.length;let o=0;for(;o<s;++o)this.getParsed(o)[e.axis]!==null&&!i[o].hidden&&i[o].draw(this._ctx)}}L(di,"id","bar"),L(di,"defaults",{datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}}),L(di,"overrides",{scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}});class ui extends Kt{initialize(){this.enableOptionSharing=!0,super.initialize()}parsePrimitiveData(t,e,i,s){const o=super.parsePrimitiveData(t,e,i,s);for(let r=0;r<o.length;r++)o[r]._custom=this.resolveDataElementOptions(r+i).radius;return o}parseArrayData(t,e,i,s){const o=super.parseArrayData(t,e,i,s);for(let r=0;r<o.length;r++){const l=e[i+r];o[r]._custom=Q(l[2],this.resolveDataElementOptions(r+i).radius)}return o}parseObjectData(t,e,i,s){const o=super.parseObjectData(t,e,i,s);for(let r=0;r<o.length;r++){const l=e[i+r];o[r]._custom=Q(l&&l.r&&+l.r,this.resolveDataElementOptions(r+i).radius)}return o}getMaxOverflow(){const t=this._cachedMeta.data;let e=0;for(let i=t.length-1;i>=0;--i)e=Math.max(e,t[i].size(this.resolveDataElementOptions(i))/2);return e>0&&e}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart.data.labels||[],{xScale:s,yScale:o}=e,r=this.getParsed(t),l=s.getLabelForValue(r.x),c=o.getLabelForValue(r.y),d=r._custom;return{label:i[t]||"",value:"("+l+", "+c+(d?", "+d:"")+")"}}update(t){const e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,i,s){const o=s==="reset",{iScale:r,vScale:l}=this._cachedMeta,{sharedOptions:c,includeOptions:d}=this._getSharedOptions(e,s),u=r.axis,h=l.axis;for(let f=e;f<e+i;f++){const m=t[f],p=!o&&this.getParsed(f),g={},y=g[u]=o?r.getPixelForDecimal(.5):r.getPixelForValue(p[u]),b=g[h]=o?l.getBasePixel():l.getPixelForValue(p[h]);g.skip=isNaN(y)||isNaN(b),d&&(g.options=c||this.resolveDataElementOptions(f,m.active?"active":s),o&&(g.options.radius=0)),this.updateElement(m,f,g,s)}}resolveDataElementOptions(t,e){const i=this.getParsed(t);let s=super.resolveDataElementOptions(t,e);s.$shared&&(s=Object.assign({},s,{$shared:!1}));const o=s.radius;return e!=="active"&&(s.radius=0),s.radius+=Q(i&&i._custom,o),s}}L(ui,"id","bubble"),L(ui,"defaults",{datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}}),L(ui,"overrides",{scales:{x:{type:"linear"},y:{type:"linear"}}});function V_(n,t,e){let i=1,s=1,o=0,r=0;if(t<pt){const l=n,c=l+t,d=Math.cos(l),u=Math.sin(l),h=Math.cos(c),f=Math.sin(c),m=(w,E,k)=>ni(w,l,c,!0)?1:Math.max(E,E*e,k,k*e),p=(w,E,k)=>ni(w,l,c,!0)?-1:Math.min(E,E*e,k,k*e),g=m(0,d,h),y=m(wt,u,f),b=p(mt,d,h),_=p(mt+wt,u,f);i=(g-b)/2,s=(y-_)/2,o=-(g+b)/2,r=-(y+_)/2}return{ratioX:i,ratioY:s,offsetX:o,offsetY:r}}class ze extends Kt{constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){const i=this.getDataset().data,s=this._cachedMeta;if(this._parsing===!1)s._parsed=i;else{let o=c=>+i[c];if(et(i[t])){const{key:c="value"}=this._parsing;o=d=>+Re(i[d],c)}let r,l;for(r=t,l=t+e;r<l;++r)s._parsed[r]=o(r)}}_getRotation(){return ie(this.options.rotation-90)}_getCircumference(){return ie(this.options.circumference)}_getRotationExtents(){let t=pt,e=-pt;for(let i=0;i<this.chart.data.datasets.length;++i)if(this.chart.isDatasetVisible(i)&&this.chart.getDatasetMeta(i).type===this._type){const s=this.chart.getDatasetMeta(i).controller,o=s._getRotation(),r=s._getCircumference();t=Math.min(t,o),e=Math.max(e,o+r)}return{rotation:t,circumference:e-t}}update(t){const e=this.chart,{chartArea:i}=e,s=this._cachedMeta,o=s.data,r=this.getMaxBorderWidth()+this.getMaxOffset(o)+this.options.spacing,l=Math.max((Math.min(i.width,i.height)-r)/2,0),c=Math.min(Ky(this.options.cutout,l),1),d=this._getRingWeight(this.index),{circumference:u,rotation:h}=this._getRotationExtents(),{ratioX:f,ratioY:m,offsetX:p,offsetY:g}=V_(h,u,c),y=(i.width-r)/f,b=(i.height-r)/m,_=Math.max(Math.min(y,b)/2,0),w=Wa(this.options.radius,_),E=Math.max(w*c,0),k=(w-E)/this._getVisibleDatasetWeightTotal();this.offsetX=p*w,this.offsetY=g*w,s.total=this.calculateTotal(),this.outerRadius=w-k*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-k*d,0),this.updateElements(o,0,o.length,t)}_circumference(t,e){const i=this.options,s=this._cachedMeta,o=this._getCircumference();return e&&i.animation.animateRotate||!this.chart.getDataVisibility(t)||s._parsed[t]===null||s.data[t].hidden?0:this.calculateCircumference(s._parsed[t]*o/pt)}updateElements(t,e,i,s){const o=s==="reset",r=this.chart,l=r.chartArea,d=r.options.animation,u=(l.left+l.right)/2,h=(l.top+l.bottom)/2,f=o&&d.animateScale,m=f?0:this.innerRadius,p=f?0:this.outerRadius,{sharedOptions:g,includeOptions:y}=this._getSharedOptions(e,s);let b=this._getRotation(),_;for(_=0;_<e;++_)b+=this._circumference(_,o);for(_=e;_<e+i;++_){const w=this._circumference(_,o),E=t[_],k={x:u+this.offsetX,y:h+this.offsetY,startAngle:b,endAngle:b+w,circumference:w,outerRadius:p,innerRadius:m};y&&(k.options=g||this.resolveDataElementOptions(_,E.active?"active":s)),b+=w,this.updateElement(E,_,k,s)}}calculateTotal(){const t=this._cachedMeta,e=t.data;let i=0,s;for(s=0;s<e.length;s++){const o=t._parsed[s];o!==null&&!isNaN(o)&&this.chart.getDataVisibility(s)&&!e[s].hidden&&(i+=Math.abs(o))}return i}calculateCircumference(t){const e=this._cachedMeta.total;return e>0&&!isNaN(t)?pt*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,s=i.data.labels||[],o=si(e._parsed[t],i.options.locale);return{label:s[t]||"",value:o}}getMaxBorderWidth(t){let e=0;const i=this.chart;let s,o,r,l,c;if(!t){for(s=0,o=i.data.datasets.length;s<o;++s)if(i.isDatasetVisible(s)){r=i.getDatasetMeta(s),t=r.data,l=r.controller;break}}if(!t)return 0;for(s=0,o=t.length;s<o;++s)c=l.resolveDataElementOptions(s),c.borderAlign!=="inner"&&(e=Math.max(e,c.borderWidth||0,c.hoverBorderWidth||0));return e}getMaxOffset(t){let e=0;for(let i=0,s=t.length;i<s;++i){const o=this.resolveDataElementOptions(i);e=Math.max(e,o.offset||0,o.hoverOffset||0)}return e}_getRingWeightOffset(t){let e=0;for(let i=0;i<t;++i)this.chart.isDatasetVisible(i)&&(e+=this._getRingWeight(i));return e}_getRingWeight(t){return Math.max(Q(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}L(ze,"id","doughnut"),L(ze,"defaults",{datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"}),L(ze,"descriptors",{_scriptable:t=>t!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")}),L(ze,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i,color:s}}=t.legend.options;return e.labels.map((o,r)=>{const c=t.getDatasetMeta(0).controller.getStyle(r);return{text:o,fillStyle:c.backgroundColor,strokeStyle:c.borderColor,fontColor:s,lineWidth:c.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(r),index:r}})}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}}});class hi extends Kt{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const e=this._cachedMeta,{dataset:i,data:s=[],_dataset:o}=e,r=this.chart._animationsDisabled;let{start:l,count:c}=il(e,s,r);this._drawStart=l,this._drawCount=c,sl(e)&&(l=0,c=s.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!o._decimated,i.points=s;const d=this.resolveDatasetElementOptions(t);this.options.showLine||(d.borderWidth=0),d.segment=this.options.segment,this.updateElement(i,void 0,{animated:!r,options:d},t),this.updateElements(s,l,c,t)}updateElements(t,e,i,s){const o=s==="reset",{iScale:r,vScale:l,_stacked:c,_dataset:d}=this._cachedMeta,{sharedOptions:u,includeOptions:h}=this._getSharedOptions(e,s),f=r.axis,m=l.axis,{spanGaps:p,segment:g}=this.options,y=_n(p)?p:Number.POSITIVE_INFINITY,b=this.chart._animationsDisabled||o||s==="none",_=e+i,w=t.length;let E=e>0&&this.getParsed(e-1);for(let k=0;k<w;++k){const C=t[k],S=b?C:{};if(k<e||k>=_){S.skip=!0;continue}const x=this.getParsed(k),O=it(x[m]),M=S[f]=r.getPixelForValue(x[f],k),v=S[m]=o||O?l.getBasePixel():l.getPixelForValue(c?this.applyStack(l,x,c):x[m],k);S.skip=isNaN(M)||isNaN(v)||O,S.stop=k>0&&Math.abs(x[f]-E[f])>y,g&&(S.parsed=x,S.raw=d.data[k]),h&&(S.options=u||this.resolveDataElementOptions(k,C.active?"active":s)),b||this.updateElement(C,k,S,s),E=x}}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,i=e.options&&e.options.borderWidth||0,s=t.data||[];if(!s.length)return i;const o=s[0].size(this.resolveDataElementOptions(0)),r=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(i,o,r)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}L(hi,"id","line"),L(hi,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),L(hi,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}});class wn extends Kt{constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,s=i.data.labels||[],o=si(e._parsed[t].r,i.options.locale);return{label:s[t]||"",value:o}}parseObjectData(t,e,i,s){return _l.bind(this)(t,e,i,s)}update(t){const e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){const t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((i,s)=>{const o=this.getParsed(s).r;!isNaN(o)&&this.chart.getDataVisibility(s)&&(o<e.min&&(e.min=o),o>e.max&&(e.max=o))}),e}_updateRadius(){const t=this.chart,e=t.chartArea,i=t.options,s=Math.min(e.right-e.left,e.bottom-e.top),o=Math.max(s/2,0),r=Math.max(i.cutoutPercentage?o/100*i.cutoutPercentage:1,0),l=(o-r)/t.getVisibleDatasetCount();this.outerRadius=o-l*this.index,this.innerRadius=this.outerRadius-l}updateElements(t,e,i,s){const o=s==="reset",r=this.chart,c=r.options.animation,d=this._cachedMeta.rScale,u=d.xCenter,h=d.yCenter,f=d.getIndexAngle(0)-.5*mt;let m=f,p;const g=360/this.countVisibleElements();for(p=0;p<e;++p)m+=this._computeAngle(p,s,g);for(p=e;p<e+i;p++){const y=t[p];let b=m,_=m+this._computeAngle(p,s,g),w=r.getDataVisibility(p)?d.getDistanceFromCenterForValue(this.getParsed(p).r):0;m=_,o&&(c.animateScale&&(w=0),c.animateRotate&&(b=_=f));const E={x:u,y:h,innerRadius:0,outerRadius:w,startAngle:b,endAngle:_,options:this.resolveDataElementOptions(p,y.active?"active":s)};this.updateElement(y,p,E,s)}}countVisibleElements(){const t=this._cachedMeta;let e=0;return t.data.forEach((i,s)=>{!isNaN(this.getParsed(s).r)&&this.chart.getDataVisibility(s)&&e++}),e}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?ie(this.resolveDataElementOptions(t,e).angle||i):0}}L(wn,"id","polarArea"),L(wn,"defaults",{dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0}),L(wn,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i,color:s}}=t.legend.options;return e.labels.map((o,r)=>{const c=t.getDatasetMeta(0).controller.getStyle(r);return{text:o,fillStyle:c.backgroundColor,strokeStyle:c.borderColor,fontColor:s,lineWidth:c.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(r),index:r}})}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}});class as extends ze{}L(as,"id","pie"),L(as,"defaults",{cutout:0,rotation:0,circumference:360,radius:"100%"});class fi extends Kt{getLabelAndValue(t){const e=this._cachedMeta.vScale,i=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(i[e.axis])}}parseObjectData(t,e,i,s){return _l.bind(this)(t,e,i,s)}update(t){const e=this._cachedMeta,i=e.dataset,s=e.data||[],o=e.iScale.getLabels();if(i.points=s,t!=="resize"){const r=this.resolveDatasetElementOptions(t);this.options.showLine||(r.borderWidth=0);const l={_loop:!0,_fullLoop:o.length===s.length,options:r};this.updateElement(i,void 0,l,t)}this.updateElements(s,0,s.length,t)}updateElements(t,e,i,s){const o=this._cachedMeta.rScale,r=s==="reset";for(let l=e;l<e+i;l++){const c=t[l],d=this.resolveDataElementOptions(l,c.active?"active":s),u=o.getPointPositionForValue(l,this.getParsed(l).r),h=r?o.xCenter:u.x,f=r?o.yCenter:u.y,m={x:h,y:f,angle:u.angle,skip:isNaN(h)||isNaN(f),options:d};this.updateElement(c,l,m,s)}}}L(fi,"id","radar"),L(fi,"defaults",{datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}}),L(fi,"overrides",{aspectRatio:1,scales:{r:{type:"radialLinear"}}});class mi extends Kt{getLabelAndValue(t){const e=this._cachedMeta,i=this.chart.data.labels||[],{xScale:s,yScale:o}=e,r=this.getParsed(t),l=s.getLabelForValue(r.x),c=o.getLabelForValue(r.y);return{label:i[t]||"",value:"("+l+", "+c+")"}}update(t){const e=this._cachedMeta,{data:i=[]}=e,s=this.chart._animationsDisabled;let{start:o,count:r}=il(e,i,s);if(this._drawStart=o,this._drawCount=r,sl(e)&&(o=0,r=i.length),this.options.showLine){this.datasetElementType||this.addElements();const{dataset:l,_dataset:c}=e;l._chart=this.chart,l._datasetIndex=this.index,l._decimated=!!c._decimated,l.points=i;const d=this.resolveDatasetElementOptions(t);d.segment=this.options.segment,this.updateElement(l,void 0,{animated:!s,options:d},t)}else this.datasetElementType&&(delete e.dataset,this.datasetElementType=!1);this.updateElements(i,o,r,t)}addElements(){const{showLine:t}=this.options;!this.datasetElementType&&t&&(this.datasetElementType=this.chart.registry.getElement("line")),super.addElements()}updateElements(t,e,i,s){const o=s==="reset",{iScale:r,vScale:l,_stacked:c,_dataset:d}=this._cachedMeta,u=this.resolveDataElementOptions(e,s),h=this.getSharedOptions(u),f=this.includeOptions(s,h),m=r.axis,p=l.axis,{spanGaps:g,segment:y}=this.options,b=_n(g)?g:Number.POSITIVE_INFINITY,_=this.chart._animationsDisabled||o||s==="none";let w=e>0&&this.getParsed(e-1);for(let E=e;E<e+i;++E){const k=t[E],C=this.getParsed(E),S=_?k:{},x=it(C[p]),O=S[m]=r.getPixelForValue(C[m],E),M=S[p]=o||x?l.getBasePixel():l.getPixelForValue(c?this.applyStack(l,C,c):C[p],E);S.skip=isNaN(O)||isNaN(M)||x,S.stop=E>0&&Math.abs(C[m]-w[m])>b,y&&(S.parsed=C,S.raw=d.data[E]),f&&(S.options=h||this.resolveDataElementOptions(E,k.active?"active":s)),_||this.updateElement(k,E,S,s),w=C}this.updateSharedOptions(h,s,u)}getMaxOverflow(){const t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let l=0;for(let c=e.length-1;c>=0;--c)l=Math.max(l,e[c].size(this.resolveDataElementOptions(c))/2);return l>0&&l}const i=t.dataset,s=i.options&&i.options.borderWidth||0;if(!e.length)return s;const o=e[0].size(this.resolveDataElementOptions(0)),r=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(s,o,r)/2}}L(mi,"id","scatter"),L(mi,"defaults",{datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1}),L(mi,"overrides",{interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}});var Wl=Object.freeze({__proto__:null,BarController:di,BubbleController:ui,DoughnutController:ze,LineController:hi,PieController:as,PolarAreaController:wn,RadarController:fi,ScatterController:mi});function rn(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class Oo{constructor(t){L(this,"options");this.options=t||{}}static override(t){Object.assign(Oo.prototype,t)}init(){}formats(){return rn()}parse(){return rn()}format(){return rn()}add(){return rn()}diff(){return rn()}startOf(){return rn()}endOf(){return rn()}}var Hl={_date:Oo};function A_(n,t,e,i){const{controller:s,data:o,_sorted:r}=n,l=s._cachedMeta.iScale;if(l&&t===l.axis&&t!=="r"&&r&&o.length){const c=l._reversePixels?rb:Ee;if(i){if(s._sharedOptions){const d=o[0],u=typeof d.getRange=="function"&&d.getRange(t);if(u){const h=c(o,t,e-u),f=c(o,t,e+u);return{lo:h.lo,hi:f.hi}}}}else return c(o,t,e)}return{lo:0,hi:o.length-1}}function pi(n,t,e,i,s){const o=n.getSortedVisibleDatasetMetas(),r=e[t];for(let l=0,c=o.length;l<c;++l){const{index:d,data:u}=o[l],{lo:h,hi:f}=A_(o[l],t,r,s);for(let m=h;m<=f;++m){const p=u[m];p.skip||i(p,d,m)}}}function B_(n){const t=n.indexOf("x")!==-1,e=n.indexOf("y")!==-1;return function(i,s){const o=t?Math.abs(i.x-s.x):0,r=e?Math.abs(i.y-s.y):0;return Math.sqrt(Math.pow(o,2)+Math.pow(r,2))}}function Do(n,t,e,i,s){const o=[];return!s&&!n.isPointInArea(t)||pi(n,e,t,function(l,c,d){!s&&!Ce(l,n.chartArea,0)||l.inRange(t.x,t.y,i)&&o.push({element:l,datasetIndex:c,index:d})},!0),o}function F_(n,t,e,i){let s=[];function o(r,l,c){const{startAngle:d,endAngle:u}=r.getProps(["startAngle","endAngle"],i),{angle:h}=Qa(r,{x:t.x,y:t.y});ni(h,d,u)&&s.push({element:r,datasetIndex:l,index:c})}return pi(n,e,t,o),s}function $_(n,t,e,i,s,o){let r=[];const l=B_(e);let c=Number.POSITIVE_INFINITY;function d(u,h,f){const m=u.inRange(t.x,t.y,s);if(i&&!m)return;const p=u.getCenterPoint(s);if(!(!!o||n.isPointInArea(p))&&!m)return;const y=l(t,p);y<c?(r=[{element:u,datasetIndex:h,index:f}],c=y):y===c&&r.push({element:u,datasetIndex:h,index:f})}return pi(n,e,t,d),r}function No(n,t,e,i,s,o){return!o&&!n.isPointInArea(t)?[]:e==="r"&&!i?F_(n,t,e,s):$_(n,t,e,i,s,o)}function Ul(n,t,e,i,s){const o=[],r=e==="x"?"inXRange":"inYRange";let l=!1;return pi(n,e,t,(c,d,u)=>{c[r]&&c[r](t[e],s)&&(o.push({element:c,datasetIndex:d,index:u}),l=l||c.inRange(t.x,t.y,s))}),i&&!l?[]:o}var ql={evaluateInteractionItems:pi,modes:{index(n,t,e,i){const s=sn(t,n),o=e.axis||"x",r=e.includeInvisible||!1,l=e.intersect?Do(n,s,o,i,r):No(n,s,o,!1,i,r),c=[];return l.length?(n.getSortedVisibleDatasetMetas().forEach(d=>{const u=l[0].index,h=d.data[u];h&&!h.skip&&c.push({element:h,datasetIndex:d.index,index:u})}),c):[]},dataset(n,t,e,i){const s=sn(t,n),o=e.axis||"xy",r=e.includeInvisible||!1;let l=e.intersect?Do(n,s,o,i,r):No(n,s,o,!1,i,r);if(l.length>0){const c=l[0].datasetIndex,d=n.getDatasetMeta(c).data;l=[];for(let u=0;u<d.length;++u)l.push({element:d[u],datasetIndex:c,index:u})}return l},point(n,t,e,i){const s=sn(t,n),o=e.axis||"xy",r=e.includeInvisible||!1;return Do(n,s,o,i,r)},nearest(n,t,e,i){const s=sn(t,n),o=e.axis||"xy",r=e.includeInvisible||!1;return No(n,s,o,e.intersect,i,r)},x(n,t,e,i){const s=sn(t,n);return Ul(n,s,"x",e.intersect,i)},y(n,t,e,i){const s=sn(t,n);return Ul(n,s,"y",e.intersect,i)}}};const Yl=["left","top","right","bottom"];function gi(n,t){return n.filter(e=>e.pos===t)}function Kl(n,t){return n.filter(e=>Yl.indexOf(e.pos)===-1&&e.box.axis===t)}function yi(n,t){return n.sort((e,i)=>{const s=t?i:e,o=t?e:i;return s.weight===o.weight?s.index-o.index:s.weight-o.weight})}function R_(n){const t=[];let e,i,s,o,r,l;for(e=0,i=(n||[]).length;e<i;++e)s=n[e],{position:o,options:{stack:r,stackWeight:l=1}}=s,t.push({index:e,box:s,pos:o,horizontal:s.isHorizontal(),weight:s.weight,stack:r&&o+r,stackWeight:l});return t}function L_(n){const t={};for(const e of n){const{stack:i,pos:s,stackWeight:o}=e;if(!i||!Yl.includes(s))continue;const r=t[i]||(t[i]={count:0,placed:0,weight:0,size:0});r.count++,r.weight+=o}return t}function I_(n,t){const e=L_(n),{vBoxMaxWidth:i,hBoxMaxHeight:s}=t;let o,r,l;for(o=0,r=n.length;o<r;++o){l=n[o];const{fullSize:c}=l.box,d=e[l.stack],u=d&&l.stackWeight/d.weight;l.horizontal?(l.width=u?u*i:c&&t.availableWidth,l.height=s):(l.width=i,l.height=u?u*s:c&&t.availableHeight)}return e}function j_(n){const t=R_(n),e=yi(t.filter(d=>d.box.fullSize),!0),i=yi(gi(t,"left"),!0),s=yi(gi(t,"right")),o=yi(gi(t,"top"),!0),r=yi(gi(t,"bottom")),l=Kl(t,"x"),c=Kl(t,"y");return{fullSize:e,leftAndTop:i.concat(o),rightAndBottom:s.concat(c).concat(r).concat(l),chartArea:gi(t,"chartArea"),vertical:i.concat(s).concat(c),horizontal:o.concat(r).concat(l)}}function Xl(n,t,e,i){return Math.max(n[e],t[e])+Math.max(n[i],t[i])}function Gl(n,t){n.top=Math.max(n.top,t.top),n.left=Math.max(n.left,t.left),n.bottom=Math.max(n.bottom,t.bottom),n.right=Math.max(n.right,t.right)}function z_(n,t,e,i){const{pos:s,box:o}=e,r=n.maxPadding;if(!et(s)){e.size&&(n[s]-=e.size);const h=i[e.stack]||{size:0,count:1};h.size=Math.max(h.size,e.horizontal?o.height:o.width),e.size=h.size/h.count,n[s]+=e.size}o.getPadding&&Gl(r,o.getPadding());const l=Math.max(0,t.outerWidth-Xl(r,n,"left","right")),c=Math.max(0,t.outerHeight-Xl(r,n,"top","bottom")),d=l!==n.w,u=c!==n.h;return n.w=l,n.h=c,e.horizontal?{same:d,other:u}:{same:u,other:d}}function W_(n){const t=n.maxPadding;function e(i){const s=Math.max(t[i]-n[i],0);return n[i]+=s,s}n.y+=e("top"),n.x+=e("left"),e("right"),e("bottom")}function H_(n,t){const e=t.maxPadding;function i(s){const o={left:0,top:0,right:0,bottom:0};return s.forEach(r=>{o[r]=Math.max(t[r],e[r])}),o}return i(n?["left","right"]:["top","bottom"])}function bi(n,t,e,i){const s=[];let o,r,l,c,d,u;for(o=0,r=n.length,d=0;o<r;++o){l=n[o],c=l.box,c.update(l.width||t.w,l.height||t.h,H_(l.horizontal,t));const{same:h,other:f}=z_(t,e,l,i);d|=h&&s.length,u=u||f,c.fullSize||s.push(l)}return d&&bi(s,t,e,i)||u}function ls(n,t,e,i,s){n.top=e,n.left=t,n.right=t+i,n.bottom=e+s,n.width=i,n.height=s}function Ql(n,t,e,i){const s=e.padding;let{x:o,y:r}=t;for(const l of n){const c=l.box,d=i[l.stack]||{count:1,placed:0,weight:1},u=l.stackWeight/d.weight||1;if(l.horizontal){const h=t.w*u,f=d.size||c.height;ti(d.start)&&(r=d.start),c.fullSize?ls(c,s.left,r,e.outerWidth-s.right-s.left,f):ls(c,t.left+d.placed,r,h,f),d.start=r,d.placed+=h,r=c.bottom}else{const h=t.h*u,f=d.size||c.width;ti(d.start)&&(o=d.start),c.fullSize?ls(c,o,s.top,f,e.outerHeight-s.bottom-s.top):ls(c,o,t.top+d.placed,f,h),d.start=o,d.placed+=h,o=c.right}}t.x=o,t.y=r}var Pt={addBox(n,t){n.boxes||(n.boxes=[]),t.fullSize=t.fullSize||!1,t.position=t.position||"top",t.weight=t.weight||0,t._layers=t._layers||function(){return[{z:0,draw(e){t.draw(e)}}]},n.boxes.push(t)},removeBox(n,t){const e=n.boxes?n.boxes.indexOf(t):-1;e!==-1&&n.boxes.splice(e,1)},configure(n,t,e){t.fullSize=e.fullSize,t.position=e.position,t.weight=e.weight},update(n,t,e,i){if(!n)return;const s=Vt(n.options.layout.padding),o=Math.max(t-s.width,0),r=Math.max(e-s.height,0),l=j_(n.boxes),c=l.vertical,d=l.horizontal;lt(n.boxes,g=>{typeof g.beforeLayout=="function"&&g.beforeLayout()});const u=c.reduce((g,y)=>y.box.options&&y.box.options.display===!1?g:g+1,0)||1,h=Object.freeze({outerWidth:t,outerHeight:e,padding:s,availableWidth:o,availableHeight:r,vBoxMaxWidth:o/2/u,hBoxMaxHeight:r/2}),f=Object.assign({},s);Gl(f,Vt(i));const m=Object.assign({maxPadding:f,w:o,h:r,x:s.left,y:s.top},s),p=I_(c.concat(d),h);bi(l.fullSize,m,h,p),bi(c,m,h,p),bi(d,m,h,p)&&bi(c,m,h,p),W_(m),Ql(l.leftAndTop,m,h,p),m.x+=m.w,m.y+=m.h,Ql(l.rightAndBottom,m,h,p),n.chartArea={left:m.left,top:m.top,right:m.left+m.w,bottom:m.top+m.h,height:m.h,width:m.w},lt(l.chartArea,g=>{const y=g.box;Object.assign(y,n.chartArea),y.update(m.w,m.h,{left:0,top:0,right:0,bottom:0})})}};class To{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,s){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,s?Math.floor(e/s):i)}}isAttached(t){return!0}updateConfig(t){}}class Jl extends To{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const cs="$chartjs",U_={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Zl=n=>n===null||n==="";function q_(n,t){const e=n.style,i=n.getAttribute("height"),s=n.getAttribute("width");if(n[cs]={initial:{height:i,width:s,style:{display:e.display,height:e.height,width:e.width}}},e.display=e.display||"block",e.boxSizing=e.boxSizing||"border-box",Zl(s)){const o=Sl(n,"width");o!==void 0&&(n.width=o)}if(Zl(i))if(n.style.height==="")n.height=n.width/(t||2);else{const o=Sl(n,"height");o!==void 0&&(n.height=o)}return n}const tc=Zb?{passive:!0}:!1;function Y_(n,t,e){n&&n.addEventListener(t,e,tc)}function K_(n,t,e){n&&n.canvas&&n.canvas.removeEventListener(t,e,tc)}function X_(n,t){const e=U_[n.type]||n.type,{x:i,y:s}=sn(n,t);return{type:e,chart:t,native:n,x:i!==void 0?i:null,y:s!==void 0?s:null}}function ds(n,t){for(const e of n)if(e===t||e.contains(t))return!0}function G_(n,t,e){const i=n.canvas,s=new MutationObserver(o=>{let r=!1;for(const l of o)r=r||ds(l.addedNodes,i),r=r&&!ds(l.removedNodes,i);r&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}function Q_(n,t,e){const i=n.canvas,s=new MutationObserver(o=>{let r=!1;for(const l of o)r=r||ds(l.removedNodes,i),r=r&&!ds(l.addedNodes,i);r&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}const _i=new Map;let ec=0;function nc(){const n=window.devicePixelRatio;n!==ec&&(ec=n,_i.forEach((t,e)=>{e.currentDevicePixelRatio!==n&&t()}))}function J_(n,t){_i.size||window.addEventListener("resize",nc),_i.set(n,t)}function Z_(n){_i.delete(n),_i.size||window.removeEventListener("resize",nc)}function t0(n,t,e){const i=n.canvas,s=i&&ko(i);if(!s)return;const o=nl((l,c)=>{const d=s.clientWidth;e(l,c),d<s.clientWidth&&e()},window),r=new ResizeObserver(l=>{const c=l[0],d=c.contentRect.width,u=c.contentRect.height;d===0&&u===0||o(d,u)});return r.observe(s),J_(n,o),r}function Po(n,t,e){e&&e.disconnect(),t==="resize"&&Z_(n)}function e0(n,t,e){const i=n.canvas,s=nl(o=>{n.ctx!==null&&e(X_(o,n))},n);return Y_(i,t,s),s}class ic extends To{acquireContext(t,e){const i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(q_(t,e),i):null}releaseContext(t){const e=t.canvas;if(!e[cs])return!1;const i=e[cs].initial;["height","width"].forEach(o=>{const r=i[o];it(r)?e.removeAttribute(o):e.setAttribute(o,r)});const s=i.style||{};return Object.keys(s).forEach(o=>{e.style[o]=s[o]}),e.width=e.width,delete e[cs],!0}addEventListener(t,e,i){this.removeEventListener(t,e);const s=t.$proxies||(t.$proxies={}),r={attach:G_,detach:Q_,resize:t0}[e]||e0;s[e]=r(t,e,i)}removeEventListener(t,e){const i=t.$proxies||(t.$proxies={}),s=i[e];if(!s)return;({attach:Po,detach:Po,resize:Po}[e]||K_)(t,e,s),i[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,s){return Jb(t,e,i,s)}isAttached(t){const e=t&&ko(t);return!!(e&&e.isConnected)}}function sc(n){return!xo()||typeof OffscreenCanvas<"u"&&n instanceof OffscreenCanvas?Jl:ic}class Xt{constructor(){L(this,"x");L(this,"y");L(this,"active",!1);L(this,"options");L(this,"$animations")}tooltipPosition(t){const{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}hasValue(){return _n(this.x)&&_n(this.y)}getProps(t,e){const i=this.$animations;if(!e||!i)return this;const s={};return t.forEach(o=>{s[o]=i[o]&&i[o].active()?i[o]._to:this[o]}),s}}L(Xt,"defaults",{}),L(Xt,"defaultRoutes");function n0(n,t){const e=n.options.ticks,i=i0(n),s=Math.min(e.maxTicksLimit||i,i),o=e.major.enabled?o0(t):[],r=o.length,l=o[0],c=o[r-1],d=[];if(r>s)return r0(t,d,o,r/s),d;const u=s0(o,t,s);if(r>0){let h,f;const m=r>1?Math.round((c-l)/(r-1)):null;for(us(t,d,u,it(m)?0:l-m,l),h=0,f=r-1;h<f;h++)us(t,d,u,o[h],o[h+1]);return us(t,d,u,c,it(m)?t.length:c+m),d}return us(t,d,u),d}function i0(n){const t=n.options.offset,e=n._tickSize(),i=n._length/e+(t?0:1),s=n._maxLength/e;return Math.floor(Math.min(i,s))}function s0(n,t,e){const i=a0(n),s=t.length/e;if(!i)return Math.max(s,1);const o=nb(i);for(let r=0,l=o.length-1;r<l;r++){const c=o[r];if(c>s)return c}return Math.max(s,1)}function o0(n){const t=[];let e,i;for(e=0,i=n.length;e<i;e++)n[e].major&&t.push(e);return t}function r0(n,t,e,i){let s=0,o=e[0],r;for(i=Math.ceil(i),r=0;r<n.length;r++)r===o&&(t.push(n[r]),s++,o=e[s*i])}function us(n,t,e,i,s){const o=Q(i,0),r=Math.min(Q(s,n.length),n.length);let l=0,c,d,u;for(e=Math.ceil(e),s&&(c=s-i,e=c/Math.floor(c/e)),u=o;u<0;)l++,u=Math.round(o+l*e);for(d=Math.max(o,0);d<r;d++)d===u&&(t.push(n[d]),l++,u=Math.round(o+l*e))}function a0(n){const t=n.length;let e,i;if(t<2)return!1;for(i=n[0],e=1;e<t;++e)if(n[e]-n[e-1]!==i)return!1;return i}const l0=n=>n==="left"?"right":n==="right"?"left":n,oc=(n,t,e)=>t==="top"||t==="left"?n[t]+e:n[t]-e,rc=(n,t)=>Math.min(t||n,n);function ac(n,t){const e=[],i=n.length/t,s=n.length;let o=0;for(;o<s;o+=i)e.push(n[Math.floor(o)]);return e}function c0(n,t,e){const i=n.ticks.length,s=Math.min(t,i-1),o=n._startPixel,r=n._endPixel,l=1e-6;let c=n.getPixelForTick(s),d;if(!(e&&(i===1?d=Math.max(c-o,r-c):t===0?d=(n.getPixelForTick(1)-c)/2:d=(c-n.getPixelForTick(s-1))/2,c+=s<t?d:-d,c<o-l||c>r+l)))return c}function d0(n,t){lt(n,e=>{const i=e.gc,s=i.length/2;let o;if(s>t){for(o=0;o<s;++o)delete e.data[i[o]];i.splice(0,s)}})}function xi(n){return n.drawTicks?n.tickLength:0}function lc(n,t){if(!n.display)return 0;const e=vt(n.font,t),i=Vt(n.padding);return(_t(n.text)?n.text.length:1)*e.lineHeight+i.height}function u0(n,t){return je(n,{scale:t,type:"scale"})}function h0(n,t,e){return je(n,{tick:e,index:t,type:"tick"})}function f0(n,t,e){let i=co(n);return(e&&t!=="right"||!e&&t==="right")&&(i=l0(i)),i}function m0(n,t,e,i){const{top:s,left:o,bottom:r,right:l,chart:c}=n,{chartArea:d,scales:u}=c;let h=0,f,m,p;const g=r-s,y=l-o;if(n.isHorizontal()){if(m=Mt(i,o,l),et(e)){const b=Object.keys(e)[0],_=e[b];p=u[b].getPixelForValue(_)+g-t}else e==="center"?p=(d.bottom+d.top)/2+g-t:p=oc(n,e,t);f=l-o}else{if(et(e)){const b=Object.keys(e)[0],_=e[b];m=u[b].getPixelForValue(_)-y+t}else e==="center"?m=(d.left+d.right)/2-y+t:m=oc(n,e,t);p=Mt(i,r,s),h=e==="left"?-wt:wt}return{titleX:m,titleY:p,maxWidth:f,rotation:h}}class We extends Xt{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,e){return t}getUserBounds(){let{_userMin:t,_userMax:e,_suggestedMin:i,_suggestedMax:s}=this;return t=zt(t,Number.POSITIVE_INFINITY),e=zt(e,Number.NEGATIVE_INFINITY),i=zt(i,Number.POSITIVE_INFINITY),s=zt(s,Number.NEGATIVE_INFINITY),{min:zt(t,i),max:zt(e,s),minDefined:St(t),maxDefined:St(e)}}getMinMax(t){let{min:e,max:i,minDefined:s,maxDefined:o}=this.getUserBounds(),r;if(s&&o)return{min:e,max:i};const l=this.getMatchingVisibleMetas();for(let c=0,d=l.length;c<d;++c)r=l[c].controller.getMinMax(this,t),s||(e=Math.min(e,r.min)),o||(i=Math.max(i,r.max));return e=o&&e>i?i:e,i=s&&e>i?e:i,{min:zt(e,zt(i,e)),max:zt(i,zt(e,i))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){ft(this.options.beforeUpdate,[this])}update(t,e,i){const{beginAtZero:s,grace:o,ticks:r}=this.options,l=r.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=Tb(this,o,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const c=l<this.ticks.length;this._convertTicksToLabels(c?ac(this.ticks,l):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),r.display&&(r.autoSkip||r.source==="auto")&&(this.ticks=n0(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),c&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t=this.options.reverse,e,i;this.isHorizontal()?(e=this.left,i=this.right):(e=this.top,i=this.bottom,t=!t),this._startPixel=e,this._endPixel=i,this._reversePixels=t,this._length=i-e,this._alignToPixels=this.options.alignToPixels}afterUpdate(){ft(this.options.afterUpdate,[this])}beforeSetDimensions(){ft(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){ft(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),ft(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){ft(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){const e=this.options.ticks;let i,s,o;for(i=0,s=t.length;i<s;i++)o=t[i],o.label=ft(e.callback,[o.value,i,t],this)}afterTickToLabelConversion(){ft(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){ft(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,e=t.ticks,i=rc(this.ticks.length,t.ticks.maxTicksLimit),s=e.minRotation||0,o=e.maxRotation;let r=s,l,c,d;if(!this._isVisible()||!e.display||s>=o||i<=1||!this.isHorizontal()){this.labelRotation=s;return}const u=this._getLabelSizes(),h=u.widest.width,f=u.highest.height,m=Dt(this.chart.width-h,0,this.maxWidth);l=t.offset?this.maxWidth/i:m/(i-1),h+6>l&&(l=m/(i-(t.offset?.5:1)),c=this.maxHeight-xi(t.grid)-e.padding-lc(t.title,this.chart.options.font),d=Math.sqrt(h*h+f*f),r=ro(Math.min(Math.asin(Dt((u.highest.height+6)/l,-1,1)),Math.asin(Dt(c/d,-1,1))-Math.asin(Dt(f/d,-1,1)))),r=Math.max(s,Math.min(o,r))),this.labelRotation=r}afterCalculateLabelRotation(){ft(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){ft(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:i,title:s,grid:o}}=this,r=this._isVisible(),l=this.isHorizontal();if(r){const c=lc(s,e.options.font);if(l?(t.width=this.maxWidth,t.height=xi(o)+c):(t.height=this.maxHeight,t.width=xi(o)+c),i.display&&this.ticks.length){const{first:d,last:u,widest:h,highest:f}=this._getLabelSizes(),m=i.padding*2,p=ie(this.labelRotation),g=Math.cos(p),y=Math.sin(p);if(l){const b=i.mirror?0:y*h.width+g*f.height;t.height=Math.min(this.maxHeight,t.height+b+m)}else{const b=i.mirror?0:g*h.width+y*f.height;t.width=Math.min(this.maxWidth,t.width+b+m)}this._calculatePadding(d,u,y,g)}}this._handleMargins(),l?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,i,s){const{ticks:{align:o,padding:r},position:l}=this.options,c=this.labelRotation!==0,d=l!=="top"&&this.axis==="x";if(this.isHorizontal()){const u=this.getPixelForTick(0)-this.left,h=this.right-this.getPixelForTick(this.ticks.length-1);let f=0,m=0;c?d?(f=s*t.width,m=i*e.height):(f=i*t.height,m=s*e.width):o==="start"?m=e.width:o==="end"?f=t.width:o!=="inner"&&(f=t.width/2,m=e.width/2),this.paddingLeft=Math.max((f-u+r)*this.width/(this.width-u),0),this.paddingRight=Math.max((m-h+r)*this.width/(this.width-h),0)}else{let u=e.height/2,h=t.height/2;o==="start"?(u=0,h=t.height):o==="end"&&(u=e.height,h=0),this.paddingTop=u+r,this.paddingBottom=h+r}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){ft(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:e}=this.options;return e==="top"||e==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let e,i;for(e=0,i=t.length;e<i;e++)it(t[e].label)&&(t.splice(e,1),i--,e--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){const e=this.options.ticks.sampleSize;let i=this.ticks;e<i.length&&(i=ac(i,e)),this._labelSizes=t=this._computeLabelSizes(i,i.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,e,i){const{ctx:s,_longestTextCache:o}=this,r=[],l=[],c=Math.floor(e/rc(e,i));let d=0,u=0,h,f,m,p,g,y,b,_,w,E,k;for(h=0;h<e;h+=c){if(p=t[h].label,g=this._resolveTickFontOptions(h),s.font=y=g.string,b=o[y]=o[y]||{data:{},gc:[]},_=g.lineHeight,w=E=0,!it(p)&&!_t(p))w=ts(s,b.data,b.gc,w,p),E=_;else if(_t(p))for(f=0,m=p.length;f<m;++f)k=p[f],!it(k)&&!_t(k)&&(w=ts(s,b.data,b.gc,w,k),E+=_);r.push(w),l.push(E),d=Math.max(w,d),u=Math.max(E,u)}d0(o,e);const C=r.indexOf(d),S=l.indexOf(u),x=O=>({width:r[O]||0,height:l[O]||0});return{first:x(0),last:x(e-1),widest:x(C),highest:x(S),widths:r,heights:l}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return ob(this._alignToPixels?Ze(this.chart,e,0):e)}getDecimalForPixel(t){const e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){const e=this.ticks||[];if(t>=0&&t<e.length){const i=e[t];return i.$context||(i.$context=h0(this.getContext(),t,i))}return this.$context||(this.$context=u0(this.chart.getContext(),this))}_tickSize(){const t=this.options.ticks,e=ie(this.labelRotation),i=Math.abs(Math.cos(e)),s=Math.abs(Math.sin(e)),o=this._getLabelSizes(),r=t.autoSkipPadding||0,l=o?o.widest.width+r:0,c=o?o.highest.height+r:0;return this.isHorizontal()?c*i>l*s?l/i:c/s:c*s<l*i?c/i:l/s}_isVisible(){const t=this.options.display;return t!=="auto"?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){const e=this.axis,i=this.chart,s=this.options,{grid:o,position:r,border:l}=s,c=o.offset,d=this.isHorizontal(),h=this.ticks.length+(c?1:0),f=xi(o),m=[],p=l.setContext(this.getContext()),g=p.display?p.width:0,y=g/2,b=function(F){return Ze(i,F,g)};let _,w,E,k,C,S,x,O,M,v,T,$;if(r==="top")_=b(this.bottom),S=this.bottom-f,O=_-y,v=b(t.top)+y,$=t.bottom;else if(r==="bottom")_=b(this.top),v=t.top,$=b(t.bottom)-y,S=_+y,O=this.top+f;else if(r==="left")_=b(this.right),C=this.right-f,x=_-y,M=b(t.left)+y,T=t.right;else if(r==="right")_=b(this.left),M=t.left,T=b(t.right)-y,C=_+y,x=this.left+f;else if(e==="x"){if(r==="center")_=b((t.top+t.bottom)/2+.5);else if(et(r)){const F=Object.keys(r)[0],I=r[F];_=b(this.chart.scales[F].getPixelForValue(I))}v=t.top,$=t.bottom,S=_+y,O=S+f}else if(e==="y"){if(r==="center")_=b((t.left+t.right)/2);else if(et(r)){const F=Object.keys(r)[0],I=r[F];_=b(this.chart.scales[F].getPixelForValue(I))}C=_-y,x=C-f,M=t.left,T=t.right}const U=Q(s.ticks.maxTicksLimit,h),H=Math.max(1,Math.ceil(h/U));for(w=0;w<h;w+=H){const F=this.getContext(w),I=o.setContext(F),B=l.setContext(F),P=I.lineWidth,R=I.color,W=B.dash||[],J=B.dashOffset,G=I.tickWidth,ot=I.tickColor,nt=I.tickBorderDash||[],Y=I.tickBorderDashOffset;E=c0(this,w,c),E!==void 0&&(k=Ze(i,E,P),d?C=x=M=T=k:S=O=v=$=k,m.push({tx1:C,ty1:S,tx2:x,ty2:O,x1:M,y1:v,x2:T,y2:$,width:P,color:R,borderDash:W,borderDashOffset:J,tickWidth:G,tickColor:ot,tickBorderDash:nt,tickBorderDashOffset:Y}))}return this._ticksLength=h,this._borderValue=_,m}_computeLabelItems(t){const e=this.axis,i=this.options,{position:s,ticks:o}=i,r=this.isHorizontal(),l=this.ticks,{align:c,crossAlign:d,padding:u,mirror:h}=o,f=xi(i.grid),m=f+u,p=h?-u:m,g=-ie(this.labelRotation),y=[];let b,_,w,E,k,C,S,x,O,M,v,T,$="middle";if(s==="top")C=this.bottom-p,S=this._getXAxisLabelAlignment();else if(s==="bottom")C=this.top+p,S=this._getXAxisLabelAlignment();else if(s==="left"){const H=this._getYAxisLabelAlignment(f);S=H.textAlign,k=H.x}else if(s==="right"){const H=this._getYAxisLabelAlignment(f);S=H.textAlign,k=H.x}else if(e==="x"){if(s==="center")C=(t.top+t.bottom)/2+m;else if(et(s)){const H=Object.keys(s)[0],F=s[H];C=this.chart.scales[H].getPixelForValue(F)+m}S=this._getXAxisLabelAlignment()}else if(e==="y"){if(s==="center")k=(t.left+t.right)/2-m;else if(et(s)){const H=Object.keys(s)[0],F=s[H];k=this.chart.scales[H].getPixelForValue(F)}S=this._getYAxisLabelAlignment(f).textAlign}e==="y"&&(c==="start"?$="top":c==="end"&&($="bottom"));const U=this._getLabelSizes();for(b=0,_=l.length;b<_;++b){w=l[b],E=w.label;const H=o.setContext(this.getContext(b));x=this.getPixelForTick(b)+o.labelOffset,O=this._resolveTickFontOptions(b),M=O.lineHeight,v=_t(E)?E.length:1;const F=v/2,I=H.color,B=H.textStrokeColor,P=H.textStrokeWidth;let R=S;r?(k=x,S==="inner"&&(b===_-1?R=this.options.reverse?"left":"right":b===0?R=this.options.reverse?"right":"left":R="center"),s==="top"?d==="near"||g!==0?T=-v*M+M/2:d==="center"?T=-U.highest.height/2-F*M+M:T=-U.highest.height+M/2:d==="near"||g!==0?T=M/2:d==="center"?T=U.highest.height/2-F*M:T=U.highest.height-v*M,h&&(T*=-1),g!==0&&!H.showLabelBackdrop&&(k+=M/2*Math.sin(g))):(C=x,T=(1-v)*M/2);let W;if(H.showLabelBackdrop){const J=Vt(H.backdropPadding),G=U.heights[b],ot=U.widths[b];let nt=T-J.top,Y=0-J.left;switch($){case"middle":nt-=G/2;break;case"bottom":nt-=G;break}switch(S){case"center":Y-=ot/2;break;case"right":Y-=ot;break;case"inner":b===_-1?Y-=ot:b>0&&(Y-=ot/2);break}W={left:Y,top:nt,width:ot+J.width,height:G+J.height,color:H.backdropColor}}y.push({label:E,font:O,textOffset:T,options:{rotation:g,color:I,strokeColor:B,strokeWidth:P,textAlign:R,textBaseline:$,translation:[k,C],backdrop:W}})}return y}_getXAxisLabelAlignment(){const{position:t,ticks:e}=this.options;if(-ie(this.labelRotation))return t==="top"?"left":"right";let s="center";return e.align==="start"?s="left":e.align==="end"?s="right":e.align==="inner"&&(s="inner"),s}_getYAxisLabelAlignment(t){const{position:e,ticks:{crossAlign:i,mirror:s,padding:o}}=this.options,r=this._getLabelSizes(),l=t+o,c=r.widest.width;let d,u;return e==="left"?s?(u=this.right+o,i==="near"?d="left":i==="center"?(d="center",u+=c/2):(d="right",u+=c)):(u=this.right-l,i==="near"?d="right":i==="center"?(d="center",u-=c/2):(d="left",u=this.left)):e==="right"?s?(u=this.left+o,i==="near"?d="right":i==="center"?(d="center",u-=c/2):(d="left",u-=c)):(u=this.left+l,i==="near"?d="left":i==="center"?(d="center",u+=c/2):(d="right",u=this.right)):d="right",{textAlign:d,x:u}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,e=this.options.position;if(e==="left"||e==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(e==="top"||e==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){const{ctx:t,options:{backgroundColor:e},left:i,top:s,width:o,height:r}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(i,s,o,r),t.restore())}getLineWidthForValue(t){const e=this.options.grid;if(!this._isVisible()||!e.display)return 0;const s=this.ticks.findIndex(o=>o.value===t);return s>=0?e.setContext(this.getContext(s)).lineWidth:0}drawGrid(t){const e=this.options.grid,i=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let o,r;const l=(c,d,u)=>{!u.width||!u.color||(i.save(),i.lineWidth=u.width,i.strokeStyle=u.color,i.setLineDash(u.borderDash||[]),i.lineDashOffset=u.borderDashOffset,i.beginPath(),i.moveTo(c.x,c.y),i.lineTo(d.x,d.y),i.stroke(),i.restore())};if(e.display)for(o=0,r=s.length;o<r;++o){const c=s[o];e.drawOnChartArea&&l({x:c.x1,y:c.y1},{x:c.x2,y:c.y2},c),e.drawTicks&&l({x:c.tx1,y:c.ty1},{x:c.tx2,y:c.ty2},{color:c.tickColor,width:c.tickWidth,borderDash:c.tickBorderDash,borderDashOffset:c.tickBorderDashOffset})}}drawBorder(){const{chart:t,ctx:e,options:{border:i,grid:s}}=this,o=i.setContext(this.getContext()),r=i.display?o.width:0;if(!r)return;const l=s.setContext(this.getContext(0)).lineWidth,c=this._borderValue;let d,u,h,f;this.isHorizontal()?(d=Ze(t,this.left,r)-r/2,u=Ze(t,this.right,l)+l/2,h=f=c):(h=Ze(t,this.top,r)-r/2,f=Ze(t,this.bottom,l)+l/2,d=u=c),e.save(),e.lineWidth=o.width,e.strokeStyle=o.color,e.beginPath(),e.moveTo(d,h),e.lineTo(u,f),e.stroke(),e.restore()}drawLabels(t){if(!this.options.ticks.display)return;const i=this.ctx,s=this._computeLabelArea();s&&es(i,s);const o=this.getLabelItems(t);for(const r of o){const l=r.options,c=r.font,d=r.label,u=r.textOffset;tn(i,d,0,u,c,l)}s&&ns(i)}drawTitle(){const{ctx:t,options:{position:e,title:i,reverse:s}}=this;if(!i.display)return;const o=vt(i.font),r=Vt(i.padding),l=i.align;let c=o.lineHeight/2;e==="bottom"||e==="center"||et(e)?(c+=r.bottom,_t(i.text)&&(c+=o.lineHeight*(i.text.length-1))):c+=r.top;const{titleX:d,titleY:u,maxWidth:h,rotation:f}=m0(this,c,e,l);tn(t,i.text,0,0,o,{color:i.color,maxWidth:h,rotation:f,textAlign:f0(l,e,s),textBaseline:"middle",translation:[d,u]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){const t=this.options,e=t.ticks&&t.ticks.z||0,i=Q(t.grid&&t.grid.z,-1),s=Q(t.border&&t.border.z,0);return!this._isVisible()||this.draw!==We.prototype.draw?[{z:e,draw:o=>{this.draw(o)}}]:[{z:i,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:s,draw:()=>{this.drawBorder()}},{z:e,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",s=[];let o,r;for(o=0,r=e.length;o<r;++o){const l=e[o];l[i]===this.id&&(!t||l.type===t)&&s.push(l)}return s}_resolveTickFontOptions(t){const e=this.options.ticks.setContext(this.getContext(t));return vt(e.font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class hs{constructor(t,e,i){this.type=t,this.scope=e,this.override=i,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){const e=Object.getPrototypeOf(t);let i;y0(e)&&(i=this.register(e));const s=this.items,o=t.id,r=this.scope+"."+o;if(!o)throw new Error("class does not have id: "+t);return o in s||(s[o]=t,p0(t,r,i),this.override&>.override(t.id,t.overrides)),r}get(t){return this.items[t]}unregister(t){const e=this.items,i=t.id,s=this.scope;i in e&&delete e[i],s&&i in gt[s]&&(delete gt[s][i],this.override&&delete Je[i])}}function p0(n,t,e){const i=Jn(Object.create(null),[e?gt.get(e):{},gt.get(t),n.defaults]);gt.set(t,i),n.defaultRoutes&&g0(t,n.defaultRoutes),n.descriptors&>.describe(t,n.descriptors)}function g0(n,t){Object.keys(t).forEach(e=>{const i=e.split("."),s=i.pop(),o=[n].concat(i).join("."),r=t[e].split("."),l=r.pop(),c=r.join(".");gt.route(o,s,c,l)})}function y0(n){return"id"in n&&"defaults"in n}class b0{constructor(){this.controllers=new hs(Kt,"datasets",!0),this.elements=new hs(Xt,"elements"),this.plugins=new hs(Object,"plugins"),this.scales=new hs(We,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,i){[...e].forEach(s=>{const o=i||this._getRegistryForType(s);i||o.isForType(s)||o===this.plugins&&s.id?this._exec(t,o,s):lt(s,r=>{const l=i||this._getRegistryForType(r);this._exec(t,l,r)})})}_exec(t,e,i){const s=oo(t);ft(i["before"+s],[],i),e[t](i),ft(i["after"+s],[],i)}_getRegistryForType(t){for(let e=0;e<this._typedRegistries.length;e++){const i=this._typedRegistries[e];if(i.isForType(t))return i}return this.plugins}_get(t,e,i){const s=e.get(t);if(s===void 0)throw new Error('"'+t+'" is not a registered '+i+".");return s}}var se=new b0;class _0{constructor(){this._init=[]}notify(t,e,i,s){e==="beforeInit"&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install"));const o=s?this._descriptors(t).filter(s):this._descriptors(t),r=this._notify(o,t,e,i);return e==="afterDestroy"&&(this._notify(o,t,"stop"),this._notify(this._init,t,"uninstall")),r}_notify(t,e,i,s){s=s||{};for(const o of t){const r=o.plugin,l=r[i],c=[e,s,o.options];if(ft(l,c,r)===!1&&s.cancelable)return!1}return!0}invalidate(){it(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const e=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),e}_createDescriptors(t,e){const i=t&&t.config,s=Q(i.options&&i.options.plugins,{}),o=x0(i);return s===!1&&!e?[]:S0(t,o,s,e)}_notifyStateChanges(t){const e=this._oldCache||[],i=this._cache,s=(o,r)=>o.filter(l=>!r.some(c=>l.plugin.id===c.plugin.id));this._notify(s(e,i),t,"stop"),this._notify(s(i,e),t,"start")}}function x0(n){const t={},e=[],i=Object.keys(se.plugins.items);for(let o=0;o<i.length;o++)e.push(se.getPlugin(i[o]));const s=n.plugins||[];for(let o=0;o<s.length;o++){const r=s[o];e.indexOf(r)===-1&&(e.push(r),t[r.id]=!0)}return{plugins:e,localIds:t}}function k0(n,t){return!t&&n===!1?null:n===!0?{}:n}function S0(n,{plugins:t,localIds:e},i,s){const o=[],r=n.getContext();for(const l of t){const c=l.id,d=k0(i[c],s);d!==null&&o.push({plugin:l,options:w0(n.config,{plugin:l,local:e[c]},d,r)})}return o}function w0(n,{plugin:t,local:e},i,s){const o=n.pluginScopeKeys(t),r=n.getOptionScopes(i,o);return e&&t.defaults&&r.push(t.defaults),n.createResolver(r,s,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function Mo(n,t){const e=gt.datasets[n]||{};return((t.datasets||{})[n]||{}).indexAxis||t.indexAxis||e.indexAxis||"x"}function E0(n,t){let e=n;return n==="_index_"?e=t:n==="_value_"&&(e=t==="x"?"y":"x"),e}function C0(n,t){return n===t?"_index_":"_value_"}function cc(n){if(n==="x"||n==="y"||n==="r")return n}function v0(n){if(n==="top"||n==="bottom")return"x";if(n==="left"||n==="right")return"y"}function Vo(n,...t){if(cc(n))return n;for(const e of t){const i=e.axis||v0(e.position)||n.length>1&&cc(n[0].toLowerCase());if(i)return i}throw new Error(`Cannot determine type of '${n}' axis. Please provide 'axis' or 'position' option.`)}function dc(n,t,e){if(e[t+"AxisID"]===n)return{axis:t}}function O0(n,t){if(t.data&&t.data.datasets){const e=t.data.datasets.filter(i=>i.xAxisID===n||i.yAxisID===n);if(e.length)return dc(n,"x",e[0])||dc(n,"y",e[0])}return{}}function D0(n,t){const e=Je[n.type]||{scales:{}},i=t.scales||{},s=Mo(n.type,t),o=Object.create(null);return Object.keys(i).forEach(r=>{const l=i[r];if(!et(l))return console.error(`Invalid scale configuration for scale: ${r}`);if(l._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${r}`);const c=Vo(r,l,O0(r,n),gt.scales[l.type]),d=C0(c,s),u=e.scales||{};o[r]=Zn(Object.create(null),[{axis:c},l,u[c],u[d]])}),n.data.datasets.forEach(r=>{const l=r.type||n.type,c=r.indexAxis||Mo(l,t),u=(Je[l]||{}).scales||{};Object.keys(u).forEach(h=>{const f=E0(h,c),m=r[f+"AxisID"]||f;o[m]=o[m]||Object.create(null),Zn(o[m],[{axis:f},i[m],u[h]])})}),Object.keys(o).forEach(r=>{const l=o[r];Zn(l,[gt.scales[l.type],gt.scale])}),o}function uc(n){const t=n.options||(n.options={});t.plugins=Q(t.plugins,{}),t.scales=D0(n,t)}function hc(n){return n=n||{},n.datasets=n.datasets||[],n.labels=n.labels||[],n}function N0(n){return n=n||{},n.data=hc(n.data),uc(n),n}const fc=new Map,mc=new Set;function fs(n,t){let e=fc.get(n);return e||(e=t(),fc.set(n,e),mc.add(e)),e}const ki=(n,t,e)=>{const i=Re(t,e);i!==void 0&&n.add(i)};class T0{constructor(t){this._config=N0(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=hc(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),uc(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return fs(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return fs(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return fs(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){const e=t.id,i=this.type;return fs(`${i}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){const i=this._scopeCache;let s=i.get(t);return(!s||e)&&(s=new Map,i.set(t,s)),s}getOptionScopes(t,e,i){const{options:s,type:o}=this,r=this._cachedScopes(t,i),l=r.get(e);if(l)return l;const c=new Set;e.forEach(u=>{t&&(c.add(t),u.forEach(h=>ki(c,t,h))),u.forEach(h=>ki(c,s,h)),u.forEach(h=>ki(c,Je[o]||{},h)),u.forEach(h=>ki(c,gt,h)),u.forEach(h=>ki(c,fo,h))});const d=Array.from(c);return d.length===0&&d.push(Object.create(null)),mc.has(e)&&r.set(e,d),d}chartOptionScopes(){const{options:t,type:e}=this;return[t,Je[e]||{},gt.datasets[e]||{},{type:e},gt,fo]}resolveNamedOptions(t,e,i,s=[""]){const o={$shared:!0},{resolver:r,subPrefixes:l}=pc(this._resolverCache,t,s);let c=r;if(M0(r,e)){o.$shared=!1,i=Le(i)?i():i;const d=this.createResolver(t,i,l);c=xn(r,i,d)}for(const d of e)o[d]=c[d];return o}createResolver(t,e,i=[""],s){const{resolver:o}=pc(this._resolverCache,t,i);return et(e)?xn(o,e,void 0,s):o}}function pc(n,t,e){let i=n.get(t);i||(i=new Map,n.set(t,i));const s=e.join();let o=i.get(s);return o||(o={resolver:yo(t,e),subPrefixes:e.filter(l=>!l.toLowerCase().includes("hover"))},i.set(s,o)),o}const P0=n=>et(n)&&Object.getOwnPropertyNames(n).some(t=>Le(n[t]));function M0(n,t){const{isScriptable:e,isIndexable:i}=fl(n);for(const s of t){const o=e(s),r=i(s),l=(r||o)&&n[s];if(o&&(Le(l)||P0(l))||r&&_t(l))return!0}return!1}var V0="4.4.7";const A0=["top","bottom","left","right","chartArea"];function gc(n,t){return n==="top"||n==="bottom"||A0.indexOf(n)===-1&&t==="x"}function yc(n,t){return function(e,i){return e[n]===i[n]?e[t]-i[t]:e[n]-i[n]}}function bc(n){const t=n.chart,e=t.options.animation;t.notifyPlugins("afterRender"),ft(e&&e.onComplete,[n],t)}function B0(n){const t=n.chart,e=t.options.animation;ft(e&&e.onProgress,[n],t)}function _c(n){return xo()&&typeof n=="string"?n=document.getElementById(n):n&&n.length&&(n=n[0]),n&&n.canvas&&(n=n.canvas),n}const ms={},xc=n=>{const t=_c(n);return Object.values(ms).filter(e=>e.canvas===t).pop()};function F0(n,t,e){const i=Object.keys(n);for(const s of i){const o=+s;if(o>=t){const r=n[s];delete n[s],(e>0||o>t)&&(n[o+e]=r)}}}function $0(n,t,e,i){return!e||n.type==="mouseout"?null:i?t:n}function ps(n,t,e){return n.options.clip?n[e]:t[e]}function R0(n,t){const{xScale:e,yScale:i}=n;return e&&i?{left:ps(e,t,"left"),right:ps(e,t,"right"),top:ps(i,t,"top"),bottom:ps(i,t,"bottom")}:t}class he{static register(...t){se.add(...t),kc()}static unregister(...t){se.remove(...t),kc()}constructor(t,e){const i=this.config=new T0(e),s=_c(t),o=xc(s);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const r=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||sc(s)),this.platform.updateConfig(i);const l=this.platform.acquireContext(s,r.aspectRatio),c=l&&l.canvas,d=c&&c.height,u=c&&c.width;if(this.id=Yy(),this.ctx=l,this.canvas=c,this.width=u,this.height=d,this._options=r,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new _0,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=cb(h=>this.update(h),r.resizeDelay||0),this._dataChanges=[],ms[this.id]=this,!l||!c){console.error("Failed to create chart: can't acquire context from the given item");return}ue.listen(this,"complete",bc),ue.listen(this,"progress",B0),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:s,_aspectRatio:o}=this;return it(t)?e&&o?o:s?i/s:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return se}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():kl(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return dl(this.canvas,this.ctx),this}stop(){return ue.stop(this),this}resize(t,e){ue.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const i=this.options,s=this.canvas,o=i.maintainAspectRatio&&this.aspectRatio,r=this.platform.getMaximumSize(s,t,e,o),l=i.devicePixelRatio||this.platform.getDevicePixelRatio(),c=this.width?"resize":"attach";this.width=r.width,this.height=r.height,this._aspectRatio=this.aspectRatio,kl(this,l,!0)&&(this.notifyPlugins("resize",{size:r}),ft(i.onResize,[this,r],this),this.attached&&this._doResize(c)&&this.render())}ensureScalesHaveIDs(){const e=this.options.scales||{};lt(e,(i,s)=>{i.id=s})}buildOrUpdateScales(){const t=this.options,e=t.scales,i=this.scales,s=Object.keys(i).reduce((r,l)=>(r[l]=!1,r),{});let o=[];e&&(o=o.concat(Object.keys(e).map(r=>{const l=e[r],c=Vo(r,l),d=c==="r",u=c==="x";return{options:l,dposition:d?"chartArea":u?"bottom":"left",dtype:d?"radialLinear":u?"category":"linear"}}))),lt(o,r=>{const l=r.options,c=l.id,d=Vo(c,l),u=Q(l.type,r.dtype);(l.position===void 0||gc(l.position,d)!==gc(r.dposition))&&(l.position=r.dposition),s[c]=!0;let h=null;if(c in i&&i[c].type===u)h=i[c];else{const f=se.getScale(u);h=new f({id:c,type:u,ctx:this.ctx,chart:this}),i[h.id]=h}h.init(l,t)}),lt(s,(r,l)=>{r||delete i[l]}),lt(i,r=>{Pt.configure(this,r,r.options),Pt.addBox(this,r)})}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,i=t.length;if(t.sort((s,o)=>s.index-o.index),i>e){for(let s=e;s<i;++s)this._destroyDatasetMeta(s);t.splice(e,i-e)}this._sortedMetasets=t.slice(0).sort(yc("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:e}}=this;t.length>e.length&&delete this._stacks,t.forEach((i,s)=>{e.filter(o=>o===i._dataset).length===0&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let i,s;for(this._removeUnreferencedMetasets(),i=0,s=e.length;i<s;i++){const o=e[i];let r=this.getDatasetMeta(i);const l=o.type||this.config.type;if(r.type&&r.type!==l&&(this._destroyDatasetMeta(i),r=this.getDatasetMeta(i)),r.type=l,r.indexAxis=o.indexAxis||Mo(l,this.options),r.order=o.order||0,r.index=i,r.label=""+o.label,r.visible=this.isDatasetVisible(i),r.controller)r.controller.updateIndex(i),r.controller.linkScales();else{const c=se.getController(l),{datasetElementType:d,dataElementType:u}=gt.datasets[l];Object.assign(c,{dataElementType:se.getElement(u),datasetElementType:d&&se.getElement(d)}),r.controller=new c(this,i),t.push(r.controller)}}return this._updateMetasets(),t}_resetElements(){lt(this.data.datasets,(t,e)=>{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this.config;e.update();const i=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let r=0;for(let d=0,u=this.data.datasets.length;d<u;d++){const{controller:h}=this.getDatasetMeta(d),f=!s&&o.indexOf(h)===-1;h.buildOrUpdateElements(f),r=Math.max(+h.getMaxOverflow(),r)}r=this._minPadding=i.layout.autoPadding?r:0,this._updateLayout(r),s||lt(o,d=>{d.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(yc("z","_idx"));const{_active:l,_lastEvent:c}=this;c?this._eventHandler(c,!0):l.length&&this._updateHoverStyles(l,l,!0),this.render()}_updateScales(){lt(this.scales,t=>{Pt.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);(!qa(e,i)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:i,start:s,count:o}of e){const r=i==="_removeElements"?-o:o;F0(t,s,r)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,i=o=>new Set(t.filter(r=>r[0]===o).map((r,l)=>l+","+r.splice(1).join(","))),s=i(0);for(let o=1;o<e;o++)if(!qa(s,i(o)))return;return Array.from(s).map(o=>o.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;Pt.update(this,this.width,this.height,t);const e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],lt(this.boxes,s=>{i&&s.position==="chartArea"||(s.configure&&s.configure(),this._layers.push(...s._layers()))},this),this._layers.forEach((s,o)=>{s._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let e=0,i=this.data.datasets.length;e<i;++e)this.getDatasetMeta(e).controller.configure();for(let e=0,i=this.data.datasets.length;e<i;++e)this._updateDataset(e,Le(t)?t({datasetIndex:e}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,e){const i=this.getDatasetMeta(t),s={meta:i,index:t,mode:e,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",s)!==!1&&(i.controller._update(e),s.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",s))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(ue.has(this)?this.attached&&!ue.running(this)&&ue.start(this):(this.draw(),bc({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:i,height:s}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(i,s)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;const e=this._layers;for(t=0;t<e.length&&e[t].z<=0;++t)e[t].draw(this.chartArea);for(this._drawDatasets();t<e.length;++t)e[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const e=this._sortedMetasets,i=[];let s,o;for(s=0,o=e.length;s<o;++s){const r=e[s];(!t||r.visible)&&i.push(r)}return i}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;const t=this.getSortedVisibleDatasetMetas();for(let e=t.length-1;e>=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,i=t._clip,s=!i.disabled,o=R0(t,this.chartArea),r={meta:t,index:t.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",r)!==!1&&(s&&es(e,{left:i.left===!1?0:o.left-i.left,right:i.right===!1?this.width:o.right+i.right,top:i.top===!1?0:o.top-i.top,bottom:i.bottom===!1?this.height:o.bottom+i.bottom}),t.controller.draw(),s&&ns(e),r.cancelable=!1,this.notifyPlugins("afterDatasetDraw",r))}isPointInArea(t){return Ce(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,i,s){const o=ql.modes[e];return typeof o=="function"?o(this,t,i,s):[]}getDatasetMeta(t){const e=this.data.datasets[t],i=this._metasets;let s=i.filter(o=>o&&o._dataset===e).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},i.push(s)),s}getContext(){return this.$context||(this.$context=je(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const i=this.getDatasetMeta(t);return typeof i.hidden=="boolean"?!i.hidden:!e.hidden}setDatasetVisibility(t,e){const i=this.getDatasetMeta(t);i.hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,i){const s=i?"show":"hide",o=this.getDatasetMeta(t),r=o.controller._resolveAnimations(void 0,s);ti(e)?(o.data[e].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),r.update(o,{visible:i}),this.update(l=>l.datasetIndex===t?s:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),ue.remove(this),t=0,e=this.data.datasets.length;t<e;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:t,ctx:e}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),dl(t,e),this.platform.releaseContext(e),this.canvas=null,this.ctx=null),delete ms[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const t=this._listeners,e=this.platform,i=(o,r)=>{e.addEventListener(this,o,r),t[o]=r},s=(o,r,l)=>{o.offsetX=r,o.offsetY=l,this._eventHandler(o)};lt(this.options.events,o=>i(o,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,i=(c,d)=>{e.addEventListener(this,c,d),t[c]=d},s=(c,d)=>{t[c]&&(e.removeEventListener(this,c,d),delete t[c])},o=(c,d)=>{this.canvas&&this.resize(c,d)};let r;const l=()=>{s("attach",l),this.attached=!0,this.resize(),i("resize",o),i("detach",r)};r=()=>{this.attached=!1,s("resize",o),this._stop(),this._resize(0,0),i("attach",l)},e.isAttached(this.canvas)?l():r()}unbindEvents(){lt(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},lt(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){const s=i?"set":"remove";let o,r,l,c;for(e==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+s+"DatasetHoverStyle"]()),l=0,c=t.length;l<c;++l){r=t[l];const d=r&&this.getDatasetMeta(r.datasetIndex).controller;d&&d[s+"HoverStyle"](r.element,r.datasetIndex,r.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const e=this._active||[],i=t.map(({datasetIndex:o,index:r})=>{const l=this.getDatasetMeta(o);if(!l)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:l.data[r],index:r}});!Gi(i,e)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,e))}notifyPlugins(t,e,i){return this._plugins.notify(this,t,e,i)}isPluginEnabled(t){return this._plugins._cache.filter(e=>e.plugin.id===t).length===1}_updateHoverStyles(t,e,i){const s=this.options.hover,o=(c,d)=>c.filter(u=>!d.some(h=>u.datasetIndex===h.datasetIndex&&u.index===h.index)),r=o(e,t),l=i?t:o(t,e);r.length&&this.updateHoverStyle(r,s.mode,!1),l.length&&s.mode&&this.updateHoverStyle(l,s.mode,!0)}_eventHandler(t,e){const i={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},s=r=>(r.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",i,s)===!1)return;const o=this._handleEvent(t,e,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,s),(o||i.changed)&&this.render(),this}_handleEvent(t,e,i){const{_active:s=[],options:o}=this,r=e,l=this._getActiveElements(t,s,i,r),c=Zy(t),d=$0(t,this._lastEvent,i,c);i&&(this._lastEvent=null,ft(o.onHover,[t,l,this],this),c&&ft(o.onClick,[t,l,this],this));const u=!Gi(l,s);return(u||e)&&(this._active=l,this._updateHoverStyles(l,s,e)),this._lastEvent=d,u}_getActiveElements(t,e,i,s){if(t.type==="mouseout")return[];if(!i)return e;const o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,s)}}L(he,"defaults",gt),L(he,"instances",ms),L(he,"overrides",Je),L(he,"registry",se),L(he,"version",V0),L(he,"getChart",xc);function kc(){return lt(he.instances,n=>n._plugins.invalidate())}function L0(n,t,e){const{startAngle:i,pixelMargin:s,x:o,y:r,outerRadius:l,innerRadius:c}=t;let d=s/l;n.beginPath(),n.arc(o,r,l,i-d,e+d),c>s?(d=s/c,n.arc(o,r,c,e+d,i-d,!0)):n.arc(o,r,s,e+wt,i-wt),n.closePath(),n.clip()}function I0(n){return go(n,["outerStart","outerEnd","innerStart","innerEnd"])}function j0(n,t,e,i){const s=I0(n.options.borderRadius),o=(e-t)/2,r=Math.min(o,i*t/2),l=c=>{const d=(e-Math.min(o,c))*i/2;return Dt(c,0,Math.min(o,d))};return{outerStart:l(s.outerStart),outerEnd:l(s.outerEnd),innerStart:Dt(s.innerStart,0,r),innerEnd:Dt(s.innerEnd,0,r)}}function En(n,t,e,i){return{x:e+n*Math.cos(t),y:i+n*Math.sin(t)}}function gs(n,t,e,i,s,o){const{x:r,y:l,startAngle:c,pixelMargin:d,innerRadius:u}=t,h=Math.max(t.outerRadius+i+e-d,0),f=u>0?u+i+e+d:0;let m=0;const p=s-c;if(i){const H=u>0?u-i:0,F=h>0?h-i:0,I=(H+F)/2,B=I!==0?p*I/(I+i):p;m=(p-B)/2}const g=Math.max(.001,p*h-e/mt)/h,y=(p-g)/2,b=c+y+m,_=s-y-m,{outerStart:w,outerEnd:E,innerStart:k,innerEnd:C}=j0(t,f,h,_-b),S=h-w,x=h-E,O=b+w/S,M=_-E/x,v=f+k,T=f+C,$=b+k/v,U=_-C/T;if(n.beginPath(),o){const H=(O+M)/2;if(n.arc(r,l,h,O,H),n.arc(r,l,h,H,M),E>0){const P=En(x,M,r,l);n.arc(P.x,P.y,E,M,_+wt)}const F=En(T,_,r,l);if(n.lineTo(F.x,F.y),C>0){const P=En(T,U,r,l);n.arc(P.x,P.y,C,_+wt,U+Math.PI)}const I=(_-C/f+(b+k/f))/2;if(n.arc(r,l,f,_-C/f,I,!0),n.arc(r,l,f,I,b+k/f,!0),k>0){const P=En(v,$,r,l);n.arc(P.x,P.y,k,$+Math.PI,b-wt)}const B=En(S,b,r,l);if(n.lineTo(B.x,B.y),w>0){const P=En(S,O,r,l);n.arc(P.x,P.y,w,b-wt,O)}}else{n.moveTo(r,l);const H=Math.cos(O)*h+r,F=Math.sin(O)*h+l;n.lineTo(H,F);const I=Math.cos(M)*h+r,B=Math.sin(M)*h+l;n.lineTo(I,B)}n.closePath()}function z0(n,t,e,i,s){const{fullCircles:o,startAngle:r,circumference:l}=t;let c=t.endAngle;if(o){gs(n,t,e,i,c,s);for(let d=0;d<o;++d)n.fill();isNaN(l)||(c=r+(l%pt||pt))}return gs(n,t,e,i,c,s),n.fill(),c}function W0(n,t,e,i,s){const{fullCircles:o,startAngle:r,circumference:l,options:c}=t,{borderWidth:d,borderJoinStyle:u,borderDash:h,borderDashOffset:f}=c,m=c.borderAlign==="inner";if(!d)return;n.setLineDash(h||[]),n.lineDashOffset=f,m?(n.lineWidth=d*2,n.lineJoin=u||"round"):(n.lineWidth=d,n.lineJoin=u||"bevel");let p=t.endAngle;if(o){gs(n,t,e,i,p,s);for(let g=0;g<o;++g)n.stroke();isNaN(l)||(p=r+(l%pt||pt))}m&&L0(n,t,p),o||(gs(n,t,e,i,p,s),n.stroke())}class Cn extends Xt{constructor(e){super();L(this,"circumference");L(this,"endAngle");L(this,"fullCircles");L(this,"innerRadius");L(this,"outerRadius");L(this,"pixelMargin");L(this,"startAngle");this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,e&&Object.assign(this,e)}inRange(e,i,s){const o=this.getProps(["x","y"],s),{angle:r,distance:l}=Qa(o,{x:e,y:i}),{startAngle:c,endAngle:d,innerRadius:u,outerRadius:h,circumference:f}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],s),m=(this.options.spacing+this.options.borderWidth)/2,p=Q(f,d-c),g=ni(r,c,d)&&c!==d,y=p>=pt||g,b=we(l,u+m,h+m);return y&&b}getCenterPoint(e){const{x:i,y:s,startAngle:o,endAngle:r,innerRadius:l,outerRadius:c}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],e),{offset:d,spacing:u}=this.options,h=(o+r)/2,f=(l+c+u+d)/2;return{x:i+Math.cos(h)*f,y:s+Math.sin(h)*f}}tooltipPosition(e){return this.getCenterPoint(e)}draw(e){const{options:i,circumference:s}=this,o=(i.offset||0)/4,r=(i.spacing||0)/2,l=i.circular;if(this.pixelMargin=i.borderAlign==="inner"?.33:0,this.fullCircles=s>pt?Math.floor(s/pt):0,s===0||this.innerRadius<0||this.outerRadius<0)return;e.save();const c=(this.startAngle+this.endAngle)/2;e.translate(Math.cos(c)*o,Math.sin(c)*o);const d=1-Math.sin(Math.min(mt,s||0)),u=o*d;e.fillStyle=i.backgroundColor,e.strokeStyle=i.borderColor,z0(e,this,u,r,l),W0(e,this,u,r,l),e.restore()}}L(Cn,"id","arc"),L(Cn,"defaults",{borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0}),L(Cn,"defaultRoutes",{backgroundColor:"backgroundColor"}),L(Cn,"descriptors",{_scriptable:!0,_indexable:e=>e!=="borderDash"});function Sc(n,t,e=t){n.lineCap=Q(e.borderCapStyle,t.borderCapStyle),n.setLineDash(Q(e.borderDash,t.borderDash)),n.lineDashOffset=Q(e.borderDashOffset,t.borderDashOffset),n.lineJoin=Q(e.borderJoinStyle,t.borderJoinStyle),n.lineWidth=Q(e.borderWidth,t.borderWidth),n.strokeStyle=Q(e.borderColor,t.borderColor)}function H0(n,t,e){n.lineTo(e.x,e.y)}function U0(n){return n.stepped?kb:n.tension||n.cubicInterpolationMode==="monotone"?Sb:H0}function wc(n,t,e={}){const i=n.length,{start:s=0,end:o=i-1}=e,{start:r,end:l}=t,c=Math.max(s,r),d=Math.min(o,l),u=s<r&&o<r||s>l&&o>l;return{count:i,start:c,loop:t.loop,ilen:d<c&&!u?i+d-c:d-c}}function q0(n,t,e,i){const{points:s,options:o}=t,{count:r,start:l,loop:c,ilen:d}=wc(s,e,i),u=U0(o);let{move:h=!0,reverse:f}=i||{},m,p,g;for(m=0;m<=d;++m)p=s[(l+(f?d-m:m))%r],!p.skip&&(h?(n.moveTo(p.x,p.y),h=!1):u(n,g,p,f,o.stepped),g=p);return c&&(p=s[(l+(f?d:0))%r],u(n,g,p,f,o.stepped)),!!c}function Y0(n,t,e,i){const s=t.points,{count:o,start:r,ilen:l}=wc(s,e,i),{move:c=!0,reverse:d}=i||{};let u=0,h=0,f,m,p,g,y,b;const _=E=>(r+(d?l-E:E))%o,w=()=>{g!==y&&(n.lineTo(u,y),n.lineTo(u,g),n.lineTo(u,b))};for(c&&(m=s[_(0)],n.moveTo(m.x,m.y)),f=0;f<=l;++f){if(m=s[_(f)],m.skip)continue;const E=m.x,k=m.y,C=E|0;C===p?(k<g?g=k:k>y&&(y=k),u=(h*u+E)/++h):(w(),n.lineTo(E,k),p=C,h=0,g=y=k),b=k}w()}function Ao(n){const t=n.options,e=t.borderDash&&t.borderDash.length;return!n._decimated&&!n._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!e?Y0:q0}function K0(n){return n.stepped?t_:n.tension||n.cubicInterpolationMode==="monotone"?e_:on}function X0(n,t,e,i){let s=t._path;s||(s=t._path=new Path2D,t.path(s,e,i)&&s.closePath()),Sc(n,t.options),n.stroke(s)}function G0(n,t,e,i){const{segments:s,options:o}=t,r=Ao(t);for(const l of s)Sc(n,o,l.style),n.beginPath(),r(n,t,l,{start:e,end:e+i-1})&&n.closePath(),n.stroke()}const Q0=typeof Path2D=="function";function J0(n,t,e,i){Q0&&!t.options.segment?X0(n,t,e,i):G0(n,t,e,i)}class ve extends Xt{constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){const i=this.options;if((i.tension||i.cubicInterpolationMode==="monotone")&&!i.stepped&&!this._pointsUpdated){const s=i.spanGaps?this._loop:this._fullLoop;qb(this._points,i,t,s,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=a_(this,this.options.segment))}first(){const t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){const t=this.segments,e=this.points,i=t.length;return i&&e[t[i-1].end]}interpolate(t,e){const i=this.options,s=t[e],o=this.points,r=Dl(this,{property:e,start:s,end:s});if(!r.length)return;const l=[],c=K0(i);let d,u;for(d=0,u=r.length;d<u;++d){const{start:h,end:f}=r[d],m=o[h],p=o[f];if(m===p){l.push(m);continue}const g=Math.abs((s-m[e])/(p[e]-m[e])),y=c(m,p,g,i.stepped);y[e]=t[e],l.push(y)}return l.length===1?l[0]:l}pathSegment(t,e,i){return Ao(this)(t,this,e,i)}path(t,e,i){const s=this.segments,o=Ao(this);let r=this._loop;e=e||0,i=i||this.points.length-e;for(const l of s)r&=o(t,this,l,{start:e,end:e+i-1});return!!r}draw(t,e,i,s){const o=this.options||{};(this.points||[]).length&&o.borderWidth&&(t.save(),J0(t,this,i,s),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}L(ve,"id","line"),L(ve,"defaults",{borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0}),L(ve,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"}),L(ve,"descriptors",{_scriptable:!0,_indexable:t=>t!=="borderDash"&&t!=="fill"});function Ec(n,t,e,i){const s=n.options,{[e]:o}=n.getProps([e],i);return Math.abs(t-o)<s.radius+s.hitRadius}class Si extends Xt{constructor(e){super();L(this,"parsed");L(this,"skip");L(this,"stop");this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,e&&Object.assign(this,e)}inRange(e,i,s){const o=this.options,{x:r,y:l}=this.getProps(["x","y"],s);return Math.pow(e-r,2)+Math.pow(i-l,2)<Math.pow(o.hitRadius+o.radius,2)}inXRange(e,i){return Ec(this,e,"x",i)}inYRange(e,i){return Ec(this,e,"y",i)}getCenterPoint(e){const{x:i,y:s}=this.getProps(["x","y"],e);return{x:i,y:s}}size(e){e=e||this.options||{};let i=e.radius||0;i=Math.max(i,i&&e.hoverRadius||0);const s=i&&e.borderWidth||0;return(i+s)*2}draw(e,i){const s=this.options;this.skip||s.radius<.1||!Ce(this,i,this.size(s)/2)||(e.strokeStyle=s.borderColor,e.lineWidth=s.borderWidth,e.fillStyle=s.backgroundColor,po(e,s,this.x,this.y))}getRange(){const e=this.options||{};return e.radius+e.hitRadius}}L(Si,"id","point"),L(Si,"defaults",{borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0}),L(Si,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});function Cc(n,t){const{x:e,y:i,base:s,width:o,height:r}=n.getProps(["x","y","base","width","height"],t);let l,c,d,u,h;return n.horizontal?(h=r/2,l=Math.min(e,s),c=Math.max(e,s),d=i-h,u=i+h):(h=o/2,l=e-h,c=e+h,d=Math.min(i,s),u=Math.max(i,s)),{left:l,top:d,right:c,bottom:u}}function He(n,t,e,i){return n?0:Dt(t,e,i)}function Z0(n,t,e){const i=n.options.borderWidth,s=n.borderSkipped,o=hl(i);return{t:He(s.top,o.top,0,e),r:He(s.right,o.right,0,t),b:He(s.bottom,o.bottom,0,e),l:He(s.left,o.left,0,t)}}function tx(n,t,e){const{enableBorderRadius:i}=n.getProps(["enableBorderRadius"]),s=n.options.borderRadius,o=en(s),r=Math.min(t,e),l=n.borderSkipped,c=i||et(s);return{topLeft:He(!c||l.top||l.left,o.topLeft,0,r),topRight:He(!c||l.top||l.right,o.topRight,0,r),bottomLeft:He(!c||l.bottom||l.left,o.bottomLeft,0,r),bottomRight:He(!c||l.bottom||l.right,o.bottomRight,0,r)}}function ex(n){const t=Cc(n),e=t.right-t.left,i=t.bottom-t.top,s=Z0(n,e/2,i/2),o=tx(n,e/2,i/2);return{outer:{x:t.left,y:t.top,w:e,h:i,radius:o},inner:{x:t.left+s.l,y:t.top+s.t,w:e-s.l-s.r,h:i-s.t-s.b,radius:{topLeft:Math.max(0,o.topLeft-Math.max(s.t,s.l)),topRight:Math.max(0,o.topRight-Math.max(s.t,s.r)),bottomLeft:Math.max(0,o.bottomLeft-Math.max(s.b,s.l)),bottomRight:Math.max(0,o.bottomRight-Math.max(s.b,s.r))}}}}function Bo(n,t,e,i){const s=t===null,o=e===null,l=n&&!(s&&o)&&Cc(n,i);return l&&(s||we(t,l.left,l.right))&&(o||we(e,l.top,l.bottom))}function nx(n){return n.topLeft||n.topRight||n.bottomLeft||n.bottomRight}function ix(n,t){n.rect(t.x,t.y,t.w,t.h)}function Fo(n,t,e={}){const i=n.x!==e.x?-t:0,s=n.y!==e.y?-t:0,o=(n.x+n.w!==e.x+e.w?t:0)-i,r=(n.y+n.h!==e.y+e.h?t:0)-s;return{x:n.x+i,y:n.y+s,w:n.w+o,h:n.h+r,radius:n.radius}}class wi extends Xt{constructor(t){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,t&&Object.assign(this,t)}draw(t){const{inflateAmount:e,options:{borderColor:i,backgroundColor:s}}=this,{inner:o,outer:r}=ex(this),l=nx(r.radius)?ai:ix;t.save(),(r.w!==o.w||r.h!==o.h)&&(t.beginPath(),l(t,Fo(r,e,o)),t.clip(),l(t,Fo(o,-e,r)),t.fillStyle=i,t.fill("evenodd")),t.beginPath(),l(t,Fo(o,e)),t.fillStyle=s,t.fill(),t.restore()}inRange(t,e,i){return Bo(this,t,e,i)}inXRange(t,e){return Bo(this,t,null,e)}inYRange(t,e){return Bo(this,null,t,e)}getCenterPoint(t){const{x:e,y:i,base:s,horizontal:o}=this.getProps(["x","y","base","horizontal"],t);return{x:o?(e+s)/2:e,y:o?i:(i+s)/2}}getRange(t){return t==="x"?this.width/2:this.height/2}}L(wi,"id","bar"),L(wi,"defaults",{borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0}),L(wi,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});var vc=Object.freeze({__proto__:null,ArcElement:Cn,BarElement:wi,LineElement:ve,PointElement:Si});const $o=["rgb(54, 162, 235)","rgb(255, 99, 132)","rgb(255, 159, 64)","rgb(255, 205, 86)","rgb(75, 192, 192)","rgb(153, 102, 255)","rgb(201, 203, 207)"],Oc=$o.map(n=>n.replace("rgb(","rgba(").replace(")",", 0.5)"));function Dc(n){return $o[n%$o.length]}function Nc(n){return Oc[n%Oc.length]}function sx(n,t){return n.borderColor=Dc(t),n.backgroundColor=Nc(t),++t}function ox(n,t){return n.backgroundColor=n.data.map(()=>Dc(t++)),t}function rx(n,t){return n.backgroundColor=n.data.map(()=>Nc(t++)),t}function ax(n){let t=0;return(e,i)=>{const s=n.getDatasetMeta(i).controller;s instanceof ze?t=ox(e,t):s instanceof wn?t=rx(e,t):s&&(t=sx(e,t))}}function Tc(n){let t;for(t in n)if(n[t].borderColor||n[t].backgroundColor)return!0;return!1}function lx(n){return n&&(n.borderColor||n.backgroundColor)}function cx(){return gt.borderColor!=="rgba(0,0,0,0.1)"||gt.backgroundColor!=="rgba(0,0,0,0.1)"}var Pc={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(n,t,e){if(!e.enabled)return;const{data:{datasets:i},options:s}=n.config,{elements:o}=s,r=Tc(i)||lx(s)||o&&Tc(o)||cx();if(!e.forceOverride&&r)return;const l=ax(n);i.forEach(l)}};function dx(n,t,e,i,s){const o=s.samples||i;if(o>=e)return n.slice(t,t+e);const r=[],l=(e-2)/(o-2);let c=0;const d=t+e-1;let u=t,h,f,m,p,g;for(r[c++]=n[u],h=0;h<o-2;h++){let y=0,b=0,_;const w=Math.floor((h+1)*l)+1+t,E=Math.min(Math.floor((h+2)*l)+1,e)+t,k=E-w;for(_=w;_<E;_++)y+=n[_].x,b+=n[_].y;y/=k,b/=k;const C=Math.floor(h*l)+1+t,S=Math.min(Math.floor((h+1)*l)+1,e)+t,{x,y:O}=n[u];for(m=p=-1,_=C;_<S;_++)p=.5*Math.abs((x-y)*(n[_].y-O)-(x-n[_].x)*(b-O)),p>m&&(m=p,f=n[_],g=_);r[c++]=f,u=g}return r[c++]=n[d],r}function ux(n,t,e,i){let s=0,o=0,r,l,c,d,u,h,f,m,p,g;const y=[],b=t+e-1,_=n[t].x,E=n[b].x-_;for(r=t;r<t+e;++r){l=n[r],c=(l.x-_)/E*i,d=l.y;const k=c|0;if(k===u)d<p?(p=d,h=r):d>g&&(g=d,f=r),s=(o*s+l.x)/++o;else{const C=r-1;if(!it(h)&&!it(f)){const S=Math.min(h,f),x=Math.max(h,f);S!==m&&S!==C&&y.push({...n[S],x:s}),x!==m&&x!==C&&y.push({...n[x],x:s})}r>0&&C!==m&&y.push(n[C]),y.push(l),u=k,o=0,p=g=d,h=f=m=r}}return y}function Mc(n){if(n._decimated){const t=n._data;delete n._decimated,delete n._data,Object.defineProperty(n,"data",{configurable:!0,enumerable:!0,writable:!0,value:t})}}function Vc(n){n.data.datasets.forEach(t=>{Mc(t)})}function hx(n,t){const e=t.length;let i=0,s;const{iScale:o}=n,{min:r,max:l,minDefined:c,maxDefined:d}=o.getUserBounds();return c&&(i=Dt(Ee(t,o.axis,r).lo,0,e-1)),d?s=Dt(Ee(t,o.axis,l).hi+1,i,e)-i:s=e-i,{start:i,count:s}}var Ac={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(n,t,e)=>{if(!e.enabled){Vc(n);return}const i=n.width;n.data.datasets.forEach((s,o)=>{const{_data:r,indexAxis:l}=s,c=n.getDatasetMeta(o),d=r||s.data;if(li([l,n.options.indexAxis])==="y"||!c.controller.supportsDecimation)return;const u=n.scales[c.xAxisID];if(u.type!=="linear"&&u.type!=="time"||n.options.parsing)return;let{start:h,count:f}=hx(c,d);const m=e.threshold||4*i;if(f<=m){Mc(s);return}it(r)&&(s._data=d,delete s.data,Object.defineProperty(s,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(g){this._data=g}}));let p;switch(e.algorithm){case"lttb":p=dx(d,h,f,i,e);break;case"min-max":p=ux(d,h,f,i);break;default:throw new Error(`Unsupported decimation algorithm '${e.algorithm}'`)}s._decimated=p})},destroy(n){Vc(n)}};function fx(n,t,e){const i=n.segments,s=n.points,o=t.points,r=[];for(const l of i){let{start:c,end:d}=l;d=Lo(c,d,s);const u=Ro(e,s[c],s[d],l.loop);if(!t.segments){r.push({source:l,target:u,start:s[c],end:s[d]});continue}const h=Dl(t,u);for(const f of h){const m=Ro(e,o[f.start],o[f.end],f.loop),p=Ol(l,s,m);for(const g of p)r.push({source:g,target:f,start:{[e]:Bc(u,m,"start",Math.max)},end:{[e]:Bc(u,m,"end",Math.min)}})}}return r}function Ro(n,t,e,i){if(i)return;let s=t[n],o=e[n];return n==="angle"&&(s=Wt(s),o=Wt(o)),{property:n,start:s,end:o}}function mx(n,t){const{x:e=null,y:i=null}=n||{},s=t.points,o=[];return t.segments.forEach(({start:r,end:l})=>{l=Lo(r,l,s);const c=s[r],d=s[l];i!==null?(o.push({x:c.x,y:i}),o.push({x:d.x,y:i})):e!==null&&(o.push({x:e,y:c.y}),o.push({x:e,y:d.y}))}),o}function Lo(n,t,e){for(;t>n;t--){const i=e[t];if(!isNaN(i.x)&&!isNaN(i.y))break}return t}function Bc(n,t,e,i){return n&&t?i(n[e],t[e]):n?n[e]:t?t[e]:0}function Fc(n,t){let e=[],i=!1;return _t(n)?(i=!0,e=n):e=mx(n,t),e.length?new ve({points:e,options:{tension:0},_loop:i,_fullLoop:i}):null}function $c(n){return n&&n.fill!==!1}function px(n,t,e){let s=n[t].fill;const o=[t];let r;if(!e)return s;for(;s!==!1&&o.indexOf(s)===-1;){if(!St(s))return s;if(r=n[s],!r)return!1;if(r.visible)return s;o.push(s),s=r.fill}return!1}function gx(n,t,e){const i=xx(n);if(et(i))return isNaN(i.value)?!1:i;let s=parseFloat(i);return St(s)&&Math.floor(s)===s?yx(i[0],t,s,e):["origin","start","end","stack","shape"].indexOf(i)>=0&&i}function yx(n,t,e,i){return(n==="-"||n==="+")&&(e=t+e),e===t||e<0||e>=i?!1:e}function bx(n,t){let e=null;return n==="start"?e=t.bottom:n==="end"?e=t.top:et(n)?e=t.getPixelForValue(n.value):t.getBasePixel&&(e=t.getBasePixel()),e}function _x(n,t,e){let i;return n==="start"?i=e:n==="end"?i=t.options.reverse?t.min:t.max:et(n)?i=n.value:i=t.getBaseValue(),i}function xx(n){const t=n.options,e=t.fill;let i=Q(e&&e.target,e);return i===void 0&&(i=!!t.backgroundColor),i===!1||i===null?!1:i===!0?"origin":i}function kx(n){const{scale:t,index:e,line:i}=n,s=[],o=i.segments,r=i.points,l=Sx(t,e);l.push(Fc({x:null,y:t.bottom},i));for(let c=0;c<o.length;c++){const d=o[c];for(let u=d.start;u<=d.end;u++)wx(s,r[u],l)}return new ve({points:s,options:{}})}function Sx(n,t){const e=[],i=n.getMatchingVisibleMetas("line");for(let s=0;s<i.length;s++){const o=i[s];if(o.index===t)break;o.hidden||e.unshift(o.dataset)}return e}function wx(n,t,e){const i=[];for(let s=0;s<e.length;s++){const o=e[s],{first:r,last:l,point:c}=Ex(o,t,"x");if(!(!c||r&&l)){if(r)i.unshift(c);else if(n.push(c),!l)break}}n.push(...i)}function Ex(n,t,e){const i=n.interpolate(t,e);if(!i)return{};const s=i[e],o=n.segments,r=n.points;let l=!1,c=!1;for(let d=0;d<o.length;d++){const u=o[d],h=r[u.start][e],f=r[u.end][e];if(we(s,h,f)){l=s===h,c=s===f;break}}return{first:l,last:c,point:i}}class Rc{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,e,i){const{x:s,y:o,radius:r}=this;return e=e||{start:0,end:pt},t.arc(s,o,r,e.end,e.start,!0),!i.bounds}interpolate(t){const{x:e,y:i,radius:s}=this,o=t.angle;return{x:e+Math.cos(o)*s,y:i+Math.sin(o)*s,angle:o}}}function Cx(n){const{chart:t,fill:e,line:i}=n;if(St(e))return vx(t,e);if(e==="stack")return kx(n);if(e==="shape")return!0;const s=Ox(n);return s instanceof Rc?s:Fc(s,i)}function vx(n,t){const e=n.getDatasetMeta(t);return e&&n.isDatasetVisible(t)?e.dataset:null}function Ox(n){return(n.scale||{}).getPointPositionForValue?Nx(n):Dx(n)}function Dx(n){const{scale:t={},fill:e}=n,i=bx(e,t);if(St(i)){const s=t.isHorizontal();return{x:s?i:null,y:s?null:i}}return null}function Nx(n){const{scale:t,fill:e}=n,i=t.options,s=t.getLabels().length,o=i.reverse?t.max:t.min,r=_x(e,t,o),l=[];if(i.grid.circular){const c=t.getPointPositionForValue(0,o);return new Rc({x:c.x,y:c.y,radius:t.getDistanceFromCenterForValue(r)})}for(let c=0;c<s;++c)l.push(t.getPointPositionForValue(c,r));return l}function Io(n,t,e){const i=Cx(t),{line:s,scale:o,axis:r}=t,l=s.options,c=l.fill,d=l.backgroundColor,{above:u=d,below:h=d}=c||{};i&&s.points.length&&(es(n,e),Tx(n,{line:s,target:i,above:u,below:h,area:e,scale:o,axis:r}),ns(n))}function Tx(n,t){const{line:e,target:i,above:s,below:o,area:r,scale:l}=t,c=e._loop?"angle":t.axis;n.save(),c==="x"&&o!==s&&(Lc(n,i,r.top),Ic(n,{line:e,target:i,color:s,scale:l,property:c}),n.restore(),n.save(),Lc(n,i,r.bottom)),Ic(n,{line:e,target:i,color:o,scale:l,property:c}),n.restore()}function Lc(n,t,e){const{segments:i,points:s}=t;let o=!0,r=!1;n.beginPath();for(const l of i){const{start:c,end:d}=l,u=s[c],h=s[Lo(c,d,s)];o?(n.moveTo(u.x,u.y),o=!1):(n.lineTo(u.x,e),n.lineTo(u.x,u.y)),r=!!t.pathSegment(n,l,{move:r}),r?n.closePath():n.lineTo(h.x,e)}n.lineTo(t.first().x,e),n.closePath(),n.clip()}function Ic(n,t){const{line:e,target:i,property:s,color:o,scale:r}=t,l=fx(e,i,s);for(const{source:c,target:d,start:u,end:h}of l){const{style:{backgroundColor:f=o}={}}=c,m=i!==!0;n.save(),n.fillStyle=f,Px(n,r,m&&Ro(s,u,h)),n.beginPath();const p=!!e.pathSegment(n,c);let g;if(m){p?n.closePath():jc(n,i,h,s);const y=!!i.pathSegment(n,d,{move:p,reverse:!0});g=p&&y,g||jc(n,i,u,s)}n.closePath(),n.fill(g?"evenodd":"nonzero"),n.restore()}}function Px(n,t,e){const{top:i,bottom:s}=t.chart.chartArea,{property:o,start:r,end:l}=e||{};o==="x"&&(n.beginPath(),n.rect(r,i,l-r,s-i),n.clip())}function jc(n,t,e,i){const s=t.interpolate(e,i);s&&n.lineTo(s.x,s.y)}var zc={id:"filler",afterDatasetsUpdate(n,t,e){const i=(n.data.datasets||[]).length,s=[];let o,r,l,c;for(r=0;r<i;++r)o=n.getDatasetMeta(r),l=o.dataset,c=null,l&&l.options&&l instanceof ve&&(c={visible:n.isDatasetVisible(r),index:r,fill:gx(l,r,i),chart:n,axis:o.controller.options.indexAxis,scale:o.vScale,line:l}),o.$filler=c,s.push(c);for(r=0;r<i;++r)c=s[r],!(!c||c.fill===!1)&&(c.fill=px(s,r,e.propagate))},beforeDraw(n,t,e){const i=e.drawTime==="beforeDraw",s=n.getSortedVisibleDatasetMetas(),o=n.chartArea;for(let r=s.length-1;r>=0;--r){const l=s[r].$filler;l&&(l.line.updateControlPoints(o,l.axis),i&&l.fill&&Io(n.ctx,l,o))}},beforeDatasetsDraw(n,t,e){if(e.drawTime!=="beforeDatasetsDraw")return;const i=n.getSortedVisibleDatasetMetas();for(let s=i.length-1;s>=0;--s){const o=i[s].$filler;$c(o)&&Io(n.ctx,o,n.chartArea)}},beforeDatasetDraw(n,t,e){const i=t.meta.$filler;!$c(i)||e.drawTime!=="beforeDatasetDraw"||Io(n.ctx,i,n.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const Wc=(n,t)=>{let{boxHeight:e=t,boxWidth:i=t}=n;return n.usePointStyle&&(e=Math.min(e,t),i=n.pointStyleWidth||Math.min(i,t)),{boxWidth:i,boxHeight:e,itemHeight:Math.max(t,e)}},Mx=(n,t)=>n!==null&&t!==null&&n.datasetIndex===t.datasetIndex&&n.index===t.index;class Hc extends Xt{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,i){this.maxWidth=t,this.maxHeight=e,this._margins=i,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let e=ft(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter(i=>t.filter(i,this.chart.data))),t.sort&&(e=e.sort((i,s)=>t.sort(i,s,this.chart.data))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){const{options:t,ctx:e}=this;if(!t.display){this.width=this.height=0;return}const i=t.labels,s=vt(i.font),o=s.size,r=this._computeTitleHeight(),{boxWidth:l,itemHeight:c}=Wc(i,o);let d,u;e.font=s.string,this.isHorizontal()?(d=this.maxWidth,u=this._fitRows(r,o,l,c)+10):(u=this.maxHeight,d=this._fitCols(r,s,l,c)+10),this.width=Math.min(d,t.maxWidth||this.maxWidth),this.height=Math.min(u,t.maxHeight||this.maxHeight)}_fitRows(t,e,i,s){const{ctx:o,maxWidth:r,options:{labels:{padding:l}}}=this,c=this.legendHitBoxes=[],d=this.lineWidths=[0],u=s+l;let h=t;o.textAlign="left",o.textBaseline="middle";let f=-1,m=-u;return this.legendItems.forEach((p,g)=>{const y=i+e/2+o.measureText(p.text).width;(g===0||d[d.length-1]+y+2*l>r)&&(h+=u,d[d.length-(g>0?0:1)]=0,m+=u,f++),c[g]={left:0,top:m,row:f,width:y,height:s},d[d.length-1]+=y+l}),h}_fitCols(t,e,i,s){const{ctx:o,maxHeight:r,options:{labels:{padding:l}}}=this,c=this.legendHitBoxes=[],d=this.columnSizes=[],u=r-t;let h=l,f=0,m=0,p=0,g=0;return this.legendItems.forEach((y,b)=>{const{itemWidth:_,itemHeight:w}=Vx(i,e,o,y,s);b>0&&m+w+2*l>u&&(h+=f+l,d.push({width:f,height:m}),p+=f+l,g++,f=m=0),c[b]={left:p,top:m,col:g,width:_,height:w},f=Math.max(f,_),m+=w+l}),h+=f,d.push({width:f,height:m}),h}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:i,labels:{padding:s},rtl:o}}=this,r=Sn(o,this.left,this.width);if(this.isHorizontal()){let l=0,c=Mt(i,this.left+s,this.right-this.lineWidths[l]);for(const d of e)l!==d.row&&(l=d.row,c=Mt(i,this.left+s,this.right-this.lineWidths[l])),d.top+=this.top+t+s,d.left=r.leftForLtr(r.x(c),d.width),c+=d.width+s}else{let l=0,c=Mt(i,this.top+t+s,this.bottom-this.columnSizes[l].height);for(const d of e)d.col!==l&&(l=d.col,c=Mt(i,this.top+t+s,this.bottom-this.columnSizes[l].height)),d.top=c,d.left+=this.left+s,d.left=r.leftForLtr(r.x(d.left),d.width),c+=d.height+s}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const t=this.ctx;es(t,this),this._draw(),ns(t)}}_draw(){const{options:t,columnSizes:e,lineWidths:i,ctx:s}=this,{align:o,labels:r}=t,l=gt.color,c=Sn(t.rtl,this.left,this.width),d=vt(r.font),{padding:u}=r,h=d.size,f=h/2;let m;this.drawTitle(),s.textAlign=c.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=d.string;const{boxWidth:p,boxHeight:g,itemHeight:y}=Wc(r,h),b=function(C,S,x){if(isNaN(p)||p<=0||isNaN(g)||g<0)return;s.save();const O=Q(x.lineWidth,1);if(s.fillStyle=Q(x.fillStyle,l),s.lineCap=Q(x.lineCap,"butt"),s.lineDashOffset=Q(x.lineDashOffset,0),s.lineJoin=Q(x.lineJoin,"miter"),s.lineWidth=O,s.strokeStyle=Q(x.strokeStyle,l),s.setLineDash(Q(x.lineDash,[])),r.usePointStyle){const M={radius:g*Math.SQRT2/2,pointStyle:x.pointStyle,rotation:x.rotation,borderWidth:O},v=c.xPlus(C,p/2),T=S+f;ul(s,M,v,T,r.pointStyleWidth&&p)}else{const M=S+Math.max((h-g)/2,0),v=c.leftForLtr(C,p),T=en(x.borderRadius);s.beginPath(),Object.values(T).some($=>$!==0)?ai(s,{x:v,y:M,w:p,h:g,radius:T}):s.rect(v,M,p,g),s.fill(),O!==0&&s.stroke()}s.restore()},_=function(C,S,x){tn(s,x.text,C,S+y/2,d,{strikethrough:x.hidden,textAlign:c.textAlign(x.textAlign)})},w=this.isHorizontal(),E=this._computeTitleHeight();w?m={x:Mt(o,this.left+u,this.right-i[0]),y:this.top+u+E,line:0}:m={x:this.left+u,y:Mt(o,this.top+E+u,this.bottom-e[0].height),line:0},wl(this.ctx,t.textDirection);const k=y+u;this.legendItems.forEach((C,S)=>{s.strokeStyle=C.fontColor,s.fillStyle=C.fontColor;const x=s.measureText(C.text).width,O=c.textAlign(C.textAlign||(C.textAlign=r.textAlign)),M=p+f+x;let v=m.x,T=m.y;c.setWidth(this.width),w?S>0&&v+M+u>this.right&&(T=m.y+=k,m.line++,v=m.x=Mt(o,this.left+u,this.right-i[m.line])):S>0&&T+k>this.bottom&&(v=m.x=v+e[m.line].width+u,m.line++,T=m.y=Mt(o,this.top+E+u,this.bottom-e[m.line].height));const $=c.x(v);if(b($,T,C),v=db(O,v+p+f,w?v+M:this.right,t.rtl),_(c.x(v),T,C),w)m.x+=M+u;else if(typeof C.text!="string"){const U=d.lineHeight;m.y+=Uc(C,U)+u}else m.y+=k}),El(this.ctx,t.textDirection)}drawTitle(){const t=this.options,e=t.title,i=vt(e.font),s=Vt(e.padding);if(!e.display)return;const o=Sn(t.rtl,this.left,this.width),r=this.ctx,l=e.position,c=i.size/2,d=s.top+c;let u,h=this.left,f=this.width;if(this.isHorizontal())f=Math.max(...this.lineWidths),u=this.top+d,h=Mt(t.align,h,this.right-f);else{const p=this.columnSizes.reduce((g,y)=>Math.max(g,y.height),0);u=d+Mt(t.align,this.top,this.bottom-p-t.labels.padding-this._computeTitleHeight())}const m=Mt(l,h,h+f);r.textAlign=o.textAlign(co(l)),r.textBaseline="middle",r.strokeStyle=e.color,r.fillStyle=e.color,r.font=i.string,tn(r,e.text,m,u,i)}_computeTitleHeight(){const t=this.options.title,e=vt(t.font),i=Vt(t.padding);return t.display?e.lineHeight+i.height:0}_getLegendItemAt(t,e){let i,s,o;if(we(t,this.left,this.right)&&we(e,this.top,this.bottom)){for(o=this.legendHitBoxes,i=0;i<o.length;++i)if(s=o[i],we(t,s.left,s.left+s.width)&&we(e,s.top,s.top+s.height))return this.legendItems[i]}return null}handleEvent(t){const e=this.options;if(!Fx(t.type,e))return;const i=this._getLegendItemAt(t.x,t.y);if(t.type==="mousemove"||t.type==="mouseout"){const s=this._hoveredItem,o=Mx(s,i);s&&!o&&ft(e.onLeave,[t,s,this],this),this._hoveredItem=i,i&&!o&&ft(e.onHover,[t,i,this],this)}else i&&ft(e.onClick,[t,i,this],this)}}function Vx(n,t,e,i,s){const o=Ax(i,n,t,e),r=Bx(s,i,t.lineHeight);return{itemWidth:o,itemHeight:r}}function Ax(n,t,e,i){let s=n.text;return s&&typeof s!="string"&&(s=s.reduce((o,r)=>o.length>r.length?o:r)),t+e.size/2+i.measureText(s).width}function Bx(n,t,e){let i=n;return typeof t.text!="string"&&(i=Uc(t,e)),i}function Uc(n,t){const e=n.text?n.text.length:0;return t*e}function Fx(n,t){return!!((n==="mousemove"||n==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(n==="click"||n==="mouseup"))}var qc={id:"legend",_element:Hc,start(n,t,e){const i=n.legend=new Hc({ctx:n.ctx,options:e,chart:n});Pt.configure(n,i,e),Pt.addBox(n,i)},stop(n){Pt.removeBox(n,n.legend),delete n.legend},beforeUpdate(n,t,e){const i=n.legend;Pt.configure(n,i,e),i.options=e},afterUpdate(n){const t=n.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(n,t){t.replay||n.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(n,t,e){const i=t.datasetIndex,s=e.chart;s.isDatasetVisible(i)?(s.hide(i),t.hidden=!0):(s.show(i),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:n=>n.chart.options.color,boxWidth:40,padding:10,generateLabels(n){const t=n.data.datasets,{labels:{usePointStyle:e,pointStyle:i,textAlign:s,color:o,useBorderRadius:r,borderRadius:l}}=n.legend.options;return n._getSortedDatasetMetas().map(c=>{const d=c.controller.getStyle(e?0:void 0),u=Vt(d.borderWidth);return{text:t[c.index].label,fillStyle:d.backgroundColor,fontColor:o,hidden:!c.visible,lineCap:d.borderCapStyle,lineDash:d.borderDash,lineDashOffset:d.borderDashOffset,lineJoin:d.borderJoinStyle,lineWidth:(u.width+u.height)/4,strokeStyle:d.borderColor,pointStyle:i||d.pointStyle,rotation:d.rotation,textAlign:s||d.textAlign,borderRadius:r&&(l||d.borderRadius),datasetIndex:c.index}},this)}},title:{color:n=>n.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:n=>!n.startsWith("on"),labels:{_scriptable:n=>!["generateLabels","filter","sort"].includes(n)}}};class jo extends Xt{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e){const i=this.options;if(this.left=0,this.top=0,!i.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=t,this.height=this.bottom=e;const s=_t(i.text)?i.text.length:1;this._padding=Vt(i.padding);const o=s*vt(i.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){const t=this.options.position;return t==="top"||t==="bottom"}_drawArgs(t){const{top:e,left:i,bottom:s,right:o,options:r}=this,l=r.align;let c=0,d,u,h;return this.isHorizontal()?(u=Mt(l,i,o),h=e+t,d=o-i):(r.position==="left"?(u=i+t,h=Mt(l,s,e),c=mt*-.5):(u=o-t,h=Mt(l,e,s),c=mt*.5),d=s-e),{titleX:u,titleY:h,maxWidth:d,rotation:c}}draw(){const t=this.ctx,e=this.options;if(!e.display)return;const i=vt(e.font),o=i.lineHeight/2+this._padding.top,{titleX:r,titleY:l,maxWidth:c,rotation:d}=this._drawArgs(o);tn(t,e.text,0,0,i,{color:e.color,maxWidth:c,rotation:d,textAlign:co(e.align),textBaseline:"middle",translation:[r,l]})}}function $x(n,t){const e=new jo({ctx:n.ctx,options:t,chart:n});Pt.configure(n,e,t),Pt.addBox(n,e),n.titleBlock=e}var Yc={id:"title",_element:jo,start(n,t,e){$x(n,e)},stop(n){const t=n.titleBlock;Pt.removeBox(n,t),delete n.titleBlock},beforeUpdate(n,t,e){const i=n.titleBlock;Pt.configure(n,i,e),i.options=e},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const ys=new WeakMap;var Kc={id:"subtitle",start(n,t,e){const i=new jo({ctx:n.ctx,options:e,chart:n});Pt.configure(n,i,e),Pt.addBox(n,i),ys.set(n,i)},stop(n){Pt.removeBox(n,ys.get(n)),ys.delete(n)},beforeUpdate(n,t,e){const i=ys.get(n);Pt.configure(n,i,e),i.options=e},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const Ei={average(n){if(!n.length)return!1;let t,e,i=new Set,s=0,o=0;for(t=0,e=n.length;t<e;++t){const l=n[t].element;if(l&&l.hasValue()){const c=l.tooltipPosition();i.add(c.x),s+=c.y,++o}}return o===0||i.size===0?!1:{x:[...i].reduce((l,c)=>l+c)/i.size,y:s/o}},nearest(n,t){if(!n.length)return!1;let e=t.x,i=t.y,s=Number.POSITIVE_INFINITY,o,r,l;for(o=0,r=n.length;o<r;++o){const c=n[o].element;if(c&&c.hasValue()){const d=c.getCenterPoint(),u=ao(t,d);u<s&&(s=u,l=c)}}if(l){const c=l.tooltipPosition();e=c.x,i=c.y}return{x:e,y:i}}};function fe(n,t){return t&&(_t(t)?Array.prototype.push.apply(n,t):n.push(t)),n}function Oe(n){return(typeof n=="string"||n instanceof String)&&n.indexOf(`
|
|
172
172
|
`)>-1?n.split(`
|
|
173
|
-
`):n}function vx(n,t){const{element:e,datasetIndex:i,index:s}=t,o=n.getDatasetMeta(i).controller,{label:r,value:a}=o.getLabelAndValue(s);return{chart:n,label:r,parsed:o.getParsed(s),raw:n.data.datasets[i].data[s],formattedValue:a,dataset:o.getDataset(),dataIndex:s,datasetIndex:i,element:e}}function Wc(n,t){const e=n.chart.ctx,{body:i,footer:s,title:o}=n,{boxWidth:r,boxHeight:a}=t,c=Ct(t.bodyFont),d=Ct(t.titleFont),u=Ct(t.footerFont),h=o.length,f=s.length,m=i.length,p=Vt(t.padding);let g=p.height,y=0,b=i.reduce((E,k)=>E+k.before.length+k.lines.length+k.after.length,0);if(b+=n.beforeBody.length+n.afterBody.length,h&&(g+=h*d.lineHeight+(h-1)*t.titleSpacing+t.titleMarginBottom),b){const E=t.displayColors?Math.max(a,c.lineHeight):c.lineHeight;g+=m*E+(b-m)*c.lineHeight+(b-1)*t.bodySpacing}f&&(g+=t.footerMarginTop+f*u.lineHeight+(f-1)*t.footerSpacing);let _=0;const w=function(E){y=Math.max(y,e.measureText(E).width+_)};return e.save(),e.font=d.string,lt(n.title,w),e.font=c.string,lt(n.beforeBody.concat(n.afterBody),w),_=t.displayColors?r+2+t.boxPadding:0,lt(i,E=>{lt(E.before,w),lt(E.lines,w),lt(E.after,w)}),_=0,e.font=u.string,lt(n.footer,w),e.restore(),y+=p.width,{width:y,height:g}}function Cx(n,t){const{y:e,height:i}=t;return e<i/2?"top":e>n.height-i/2?"bottom":"center"}function Ox(n,t,e,i){const{x:s,width:o}=i,r=e.caretSize+e.caretPadding;if(n==="left"&&s+o+r>t.width||n==="right"&&s-o-r<0)return!0}function Dx(n,t,e,i){const{x:s,width:o}=e,{width:r,chartArea:{left:a,right:c}}=n;let d="center";return i==="center"?d=s<=(a+c)/2?"left":"right":s<=o/2?d="left":s>=r-o/2&&(d="right"),Ox(d,n,t,e)&&(d="center"),d}function Hc(n,t,e){const i=e.yAlign||t.yAlign||Cx(n,e);return{xAlign:e.xAlign||t.xAlign||Dx(n,t,e,i),yAlign:i}}function Nx(n,t){let{x:e,width:i}=n;return t==="right"?e-=i:t==="center"&&(e-=i/2),e}function Tx(n,t,e){let{y:i,height:s}=n;return t==="top"?i+=e:t==="bottom"?i-=s+e:i-=s/2,i}function Uc(n,t,e,i){const{caretSize:s,caretPadding:o,cornerRadius:r}=n,{xAlign:a,yAlign:c}=e,d=s+o,{topLeft:u,topRight:h,bottomLeft:f,bottomRight:m}=en(r);let p=Nx(t,a);const g=Tx(t,c,d);return c==="center"?a==="left"?p+=d:a==="right"&&(p-=d):a==="left"?p-=Math.max(u,f)+s:a==="right"&&(p+=Math.max(h,m)+s),{x:Dt(p,0,i.width-t.width),y:Dt(g,0,i.height-t.height)}}function gs(n,t,e){const i=Vt(e.padding);return t==="center"?n.x+n.width/2:t==="right"?n.x+n.width-i.right:n.x+i.left}function qc(n){return he([],Oe(n))}function Px(n,t,e){return je(n,{tooltip:t,tooltipItems:e,type:"tooltip"})}function Yc(n,t){const e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?n.override(e):n}const Kc={beforeTitle:Se,title(n){if(n.length>0){const t=n[0],e=t.chart.data.labels,i=e?e.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(i>0&&t.dataIndex<i)return e[t.dataIndex]}return""},afterTitle:Se,beforeBody:Se,beforeLabel:Se,label(n){if(this&&this.options&&this.options.mode==="dataset")return n.label+": "+n.formattedValue||n.formattedValue;let t=n.dataset.label||"";t&&(t+=": ");const e=n.formattedValue;return it(e)||(t+=e),t},labelColor(n){const e=n.chart.getDatasetMeta(n.datasetIndex).controller.getStyle(n.dataIndex);return{borderColor:e.borderColor,backgroundColor:e.backgroundColor,borderWidth:e.borderWidth,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(n){const e=n.chart.getDatasetMeta(n.datasetIndex).controller.getStyle(n.dataIndex);return{pointStyle:e.pointStyle,rotation:e.rotation}},afterLabel:Se,afterBody:Se,beforeFooter:Se,footer:Se,afterFooter:Se};function Rt(n,t,e,i){const s=n[t].call(e,i);return typeof s>"u"?Kc[t].call(e,i):s}class Lo extends Xt{constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const e=this.chart,i=this.options.setContext(this.getContext()),s=i.enabled&&e.options.animation&&i.animations,o=new _o(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=Px(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,e){const{callbacks:i}=e,s=Rt(i,"beforeTitle",this,t),o=Rt(i,"title",this,t),r=Rt(i,"afterTitle",this,t);let a=[];return a=he(a,Oe(s)),a=he(a,Oe(o)),a=he(a,Oe(r)),a}getBeforeBody(t,e){return qc(Rt(e.callbacks,"beforeBody",this,t))}getBody(t,e){const{callbacks:i}=e,s=[];return lt(t,o=>{const r={before:[],lines:[],after:[]},a=Yc(i,o);he(r.before,Oe(Rt(a,"beforeLabel",this,o))),he(r.lines,Rt(a,"label",this,o)),he(r.after,Oe(Rt(a,"afterLabel",this,o))),s.push(r)}),s}getAfterBody(t,e){return qc(Rt(e.callbacks,"afterBody",this,t))}getFooter(t,e){const{callbacks:i}=e,s=Rt(i,"beforeFooter",this,t),o=Rt(i,"footer",this,t),r=Rt(i,"afterFooter",this,t);let a=[];return a=he(a,Oe(s)),a=he(a,Oe(o)),a=he(a,Oe(r)),a}_createItems(t){const e=this._active,i=this.chart.data,s=[],o=[],r=[];let a=[],c,d;for(c=0,d=e.length;c<d;++c)a.push(vx(this.chart,e[c]));return t.filter&&(a=a.filter((u,h,f)=>t.filter(u,h,f,i))),t.itemSort&&(a=a.sort((u,h)=>t.itemSort(u,h,i))),lt(a,u=>{const h=Yc(t.callbacks,u);s.push(Rt(h,"labelColor",this,u)),o.push(Rt(h,"labelPointStyle",this,u)),r.push(Rt(h,"labelTextColor",this,u))}),this.labelColors=s,this.labelPointStyles=o,this.labelTextColors=r,this.dataPoints=a,a}update(t,e){const i=this.options.setContext(this.getContext()),s=this._active;let o,r=[];if(!s.length)this.opacity!==0&&(o={opacity:0});else{const a=Ei[i.position].call(this,s,this._eventPosition);r=this._createItems(i),this.title=this.getTitle(r,i),this.beforeBody=this.getBeforeBody(r,i),this.body=this.getBody(r,i),this.afterBody=this.getAfterBody(r,i),this.footer=this.getFooter(r,i);const c=this._size=Wc(this,i),d=Object.assign({},a,c),u=Hc(this.chart,i,d),h=Uc(i,d,u,this.chart);this.xAlign=u.xAlign,this.yAlign=u.yAlign,o={opacity:1,x:h.x,y:h.y,width:c.width,height:c.height,caretX:a.x,caretY:a.y}}this._tooltipItems=r,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,i,s){const o=this.getCaretPosition(t,i,s);e.lineTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.lineTo(o.x3,o.y3)}getCaretPosition(t,e,i){const{xAlign:s,yAlign:o}=this,{caretSize:r,cornerRadius:a}=i,{topLeft:c,topRight:d,bottomLeft:u,bottomRight:h}=en(a),{x:f,y:m}=t,{width:p,height:g}=e;let y,b,_,w,E,k;return o==="center"?(E=m+g/2,s==="left"?(y=f,b=y-r,w=E+r,k=E-r):(y=f+p,b=y+r,w=E-r,k=E+r),_=y):(s==="left"?b=f+Math.max(c,u)+r:s==="right"?b=f+p-Math.max(d,h)-r:b=this.caretX,o==="top"?(w=m,E=w-r,y=b-r,_=b+r):(w=m+g,E=w+r,y=b+r,_=b-r),k=w),{x1:y,x2:b,x3:_,y1:w,y2:E,y3:k}}drawTitle(t,e,i){const s=this.title,o=s.length;let r,a,c;if(o){const d=Sn(i.rtl,this.x,this.width);for(t.x=gs(this,i.titleAlign,i),e.textAlign=d.textAlign(i.titleAlign),e.textBaseline="middle",r=Ct(i.titleFont),a=i.titleSpacing,e.fillStyle=i.titleColor,e.font=r.string,c=0;c<o;++c)e.fillText(s[c],d.x(t.x),t.y+r.lineHeight/2),t.y+=r.lineHeight+a,c+1===o&&(t.y+=i.titleMarginBottom-a)}}_drawColorBox(t,e,i,s,o){const r=this.labelColors[i],a=this.labelPointStyles[i],{boxHeight:c,boxWidth:d}=o,u=Ct(o.bodyFont),h=gs(this,"left",o),f=s.x(h),m=c<u.lineHeight?(u.lineHeight-c)/2:0,p=e.y+m;if(o.usePointStyle){const g={radius:Math.min(d,c)/2,pointStyle:a.pointStyle,rotation:a.rotation,borderWidth:1},y=s.leftForLtr(f,d)+d/2,b=p+c/2;t.strokeStyle=o.multiKeyBackground,t.fillStyle=o.multiKeyBackground,ho(t,g,y,b),t.strokeStyle=r.borderColor,t.fillStyle=r.backgroundColor,ho(t,g,y,b)}else{t.lineWidth=et(r.borderWidth)?Math.max(...Object.values(r.borderWidth)):r.borderWidth||1,t.strokeStyle=r.borderColor,t.setLineDash(r.borderDash||[]),t.lineDashOffset=r.borderDashOffset||0;const g=s.leftForLtr(f,d),y=s.leftForLtr(s.xPlus(f,1),d-2),b=en(r.borderRadius);Object.values(b).some(_=>_!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,ai(t,{x:g,y:p,w:d,h:c,radius:b}),t.fill(),t.stroke(),t.fillStyle=r.backgroundColor,t.beginPath(),ai(t,{x:y,y:p+1,w:d-2,h:c-2,radius:b}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(g,p,d,c),t.strokeRect(g,p,d,c),t.fillStyle=r.backgroundColor,t.fillRect(y,p+1,d-2,c-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,e,i){const{body:s}=this,{bodySpacing:o,bodyAlign:r,displayColors:a,boxHeight:c,boxWidth:d,boxPadding:u}=i,h=Ct(i.bodyFont);let f=h.lineHeight,m=0;const p=Sn(i.rtl,this.x,this.width),g=function(x){e.fillText(x,p.x(t.x+m),t.y+f/2),t.y+=f+o},y=p.textAlign(r);let b,_,w,E,k,v,S;for(e.textAlign=r,e.textBaseline="middle",e.font=h.string,t.x=gs(this,y,i),e.fillStyle=i.bodyColor,lt(this.beforeBody,g),m=a&&y!=="right"?r==="center"?d/2+u:d+2+u:0,E=0,v=s.length;E<v;++E){for(b=s[E],_=this.labelTextColors[E],e.fillStyle=_,lt(b.before,g),w=b.lines,a&&w.length&&(this._drawColorBox(e,t,E,p,i),f=Math.max(h.lineHeight,c)),k=0,S=w.length;k<S;++k)g(w[k]),f=h.lineHeight;lt(b.after,g)}m=0,f=h.lineHeight,lt(this.afterBody,g),t.y-=o}drawFooter(t,e,i){const s=this.footer,o=s.length;let r,a;if(o){const c=Sn(i.rtl,this.x,this.width);for(t.x=gs(this,i.footerAlign,i),t.y+=i.footerMarginTop,e.textAlign=c.textAlign(i.footerAlign),e.textBaseline="middle",r=Ct(i.footerFont),e.fillStyle=i.footerColor,e.font=r.string,a=0;a<o;++a)e.fillText(s[a],c.x(t.x),t.y+r.lineHeight/2),t.y+=r.lineHeight+i.footerSpacing}}drawBackground(t,e,i,s){const{xAlign:o,yAlign:r}=this,{x:a,y:c}=t,{width:d,height:u}=i,{topLeft:h,topRight:f,bottomLeft:m,bottomRight:p}=en(s.cornerRadius);e.fillStyle=s.backgroundColor,e.strokeStyle=s.borderColor,e.lineWidth=s.borderWidth,e.beginPath(),e.moveTo(a+h,c),r==="top"&&this.drawCaret(t,e,i,s),e.lineTo(a+d-f,c),e.quadraticCurveTo(a+d,c,a+d,c+f),r==="center"&&o==="right"&&this.drawCaret(t,e,i,s),e.lineTo(a+d,c+u-p),e.quadraticCurveTo(a+d,c+u,a+d-p,c+u),r==="bottom"&&this.drawCaret(t,e,i,s),e.lineTo(a+m,c+u),e.quadraticCurveTo(a,c+u,a,c+u-m),r==="center"&&o==="left"&&this.drawCaret(t,e,i,s),e.lineTo(a,c+h),e.quadraticCurveTo(a,c,a+h,c),e.closePath(),e.fill(),s.borderWidth>0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,i=this.$animations,s=i&&i.x,o=i&&i.y;if(s||o){const r=Ei[t.position].call(this,this._active,this._eventPosition);if(!r)return;const a=this._size=Wc(this,t),c=Object.assign({},r,this._size),d=Hc(e,t,c),u=Uc(t,c,d,e);(s._to!==u.x||o._to!==u.y)&&(this.xAlign=d.xAlign,this.yAlign=d.yAlign,this.width=a.width,this.height=a.height,this.caretX=r.x,this.caretY=r.y,this._resolveAnimations().update(this,u))}}_willRender(){return!!this.opacity}draw(t){const e=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(e);const s={width:this.width,height:this.height},o={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const r=Vt(e.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&a&&(t.save(),t.globalAlpha=i,this.drawBackground(o,t,s,e),yl(t,e.textDirection),o.y+=r.top,this.drawTitle(o,t,e),this.drawBody(o,t,e),this.drawFooter(o,t,e),bl(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const i=this._active,s=t.map(({datasetIndex:a,index:c})=>{const d=this.chart.getDatasetMeta(a);if(!d)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:d.data[c],index:c}}),o=!Ki(i,s),r=this._positionChanged(s,e);(o||r)&&(this._active=s,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,i=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,o=this._active||[],r=this._getActiveElements(t,o,e,i),a=this._positionChanged(r,t),c=e||!Ki(r,o)||a;return c&&(this._active=r,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),c}_getActiveElements(t,e,i,s){const o=this.options;if(t.type==="mouseout")return[];if(!s)return e.filter(a=>this.chart.data.datasets[a.datasetIndex]&&this.chart.getDatasetMeta(a.datasetIndex).controller.getParsed(a.index)!==void 0);const r=this.chart.getElementsAtEventForMode(t,o.mode,o,i);return o.reverse&&r.reverse(),r}_positionChanged(t,e){const{caretX:i,caretY:s,options:o}=this,r=Ei[o.position].call(this,t,e);return r!==!1&&(i!==r.x||s!==r.y)}}L(Lo,"positioners",Ei);var Xc={id:"tooltip",_element:Lo,positioners:Ei,afterInit(n,t,e){e&&(n.tooltip=new Lo({chart:n,options:e}))},beforeUpdate(n,t,e){n.tooltip&&n.tooltip.initialize(e)},reset(n,t,e){n.tooltip&&n.tooltip.initialize(e)},afterDraw(n){const t=n.tooltip;if(t&&t._willRender()){const e={tooltip:t};if(n.notifyPlugins("beforeTooltipDraw",{...e,cancelable:!0})===!1)return;t.draw(n.ctx),n.notifyPlugins("afterTooltipDraw",e)}},afterEvent(n,t){if(n.tooltip){const e=t.replay;n.tooltip.handleEvent(t.event,e,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(n,t)=>t.bodyFont.size,boxWidth:(n,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:Kc},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:n=>n!=="filter"&&n!=="itemSort"&&n!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},Gc=Object.freeze({__proto__:null,Colors:vc,Decimation:Dc,Filler:Bc,Legend:Ic,SubTitle:zc,Title:jc,Tooltip:Xc});const Mx=(n,t,e,i)=>(typeof t=="string"?(e=n.push(t)-1,i.unshift({index:e,label:t})):isNaN(t)&&(e=null),e);function Vx(n,t,e,i){const s=n.indexOf(t);if(s===-1)return Mx(n,t,e,i);const o=n.lastIndexOf(t);return s!==o?e:s}const Ax=(n,t)=>n===null?null:Dt(Math.round(n),0,t);function Qc(n){const t=this.getLabels();return n>=0&&n<t.length?t[n]:n}class ys extends We{constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const e=this._addedLabels;if(e.length){const i=this.getLabels();for(const{index:s,label:o}of e)i[s]===o&&i.splice(s,1);this._addedLabels=[]}super.init(t)}parse(t,e){if(it(t))return null;const i=this.getLabels();return e=isFinite(e)&&i[e]===t?e:Vx(i,t,Q(e,t),this._addedLabels),Ax(e,i.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let{min:i,max:s}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(i=0),e||(s=this.getLabels().length-1)),this.min=i,this.max=s}buildTicks(){const t=this.min,e=this.max,i=this.options.offset,s=[];let o=this.getLabels();o=t===0&&e===o.length-1?o:o.slice(t,e+1),this._valueRange=Math.max(o.length-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let r=t;r<=e;r++)s.push({value:r});return s}getLabelForValue(t){return Qc.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return typeof t!="number"&&(t=this.parse(t)),t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}L(ys,"id","category"),L(ys,"defaults",{ticks:{callback:Qc}});function Fx(n,t){const e=[],{bounds:s,step:o,min:r,max:a,precision:c,count:d,maxTicks:u,maxDigits:h,includeBounds:f}=n,m=o||1,p=u-1,{min:g,max:y}=t,b=!it(r),_=!it(a),w=!it(d),E=(y-g)/(h+1);let k=za((y-g)/p/m)*m,v,S,x,O;if(k<1e-14&&!b&&!_)return[{value:g},{value:y}];O=Math.ceil(y/k)-Math.floor(g/k),O>p&&(k=za(O*k/p/m)*m),it(c)||(v=Math.pow(10,c),k=Math.ceil(k*v)/v),s==="ticks"?(S=Math.floor(g/k)*k,x=Math.ceil(y/k)*k):(S=g,x=y),b&&_&&o&&Hy((a-r)/o,k/1e3)?(O=Math.round(Math.min((a-r)/k,u)),k=(a-r)/O,S=r,x=a):w?(S=b?r:S,x=_?a:x,O=d-1,k=(x-S)/O):(O=(x-S)/k,ei(O,Math.round(O),k/1e3)?O=Math.round(O):O=Math.ceil(O));const M=Math.max(Ha(k),Ha(S));v=Math.pow(10,it(c)?M:c),S=Math.round(S*v)/v,x=Math.round(x*v)/v;let C=0;for(b&&(f&&S!==r?(e.push({value:r}),S<r&&C++,ei(Math.round((S+C*k)*v)/v,r,Jc(r,E,n))&&C++):S<r&&C++);C<O;++C){const T=Math.round((S+C*k)*v)/v;if(_&&T>a)break;e.push({value:T})}return _&&f&&x!==a?e.length&&ei(e[e.length-1].value,a,Jc(a,E,n))?e[e.length-1].value=a:e.push({value:a}):(!_||x===a)&&e.push({value:x}),e}function Jc(n,t,{horizontal:e,minRotation:i}){const s=ie(i),o=(e?Math.sin(s):Math.cos(s))||.001,r=.75*t*(""+n).length;return Math.min(t/o,r)}class bs extends We{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return it(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:e,maxDefined:i}=this.getUserBounds();let{min:s,max:o}=this;const r=c=>s=e?s:c,a=c=>o=i?o:c;if(t){const c=ce(s),d=ce(o);c<0&&d<0?a(0):c>0&&d>0&&r(0)}if(s===o){let c=o===0?1:Math.abs(o*.05);a(o+c),t||r(s-c)}this.min=s,this.max=o}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:e,stepSize:i}=t,s;return i?(s=Math.ceil(this.max/i)-Math.floor(this.min/i)+1,s>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${i} would result generating up to ${s} ticks. Limiting to 1000.`),s=1e3)):(s=this.computeTickLimit(),e=e||11),e&&(s=Math.min(e,s)),s}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let i=this.getTickLimit();i=Math.max(2,i);const s={maxTicks:i,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:e.includeBounds!==!1},o=this._range||this,r=Fx(s,o);return t.bounds==="ticks"&&Wa(r,this,"value"),t.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}configure(){const t=this.ticks;let e=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){const s=(i-e)/Math.max(t.length-1,1)/2;e-=s,i+=s}this._startValue=e,this._endValue=i,this._valueRange=i-e}getLabelForValue(t){return si(t,this.chart.options.locale,this.options.ticks.format)}}class _s extends bs{determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=St(t)?t:0,this.max=St(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,i=ie(this.options.ticks.minRotation),s=(t?Math.sin(i):Math.cos(i))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,o.lineHeight/s))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}L(_s,"id","linear"),L(_s,"defaults",{ticks:{callback:oi.formatters.numeric}});const vi=n=>Math.floor(Ie(n)),an=(n,t)=>Math.pow(10,vi(n)+t);function Zc(n){return n/Math.pow(10,vi(n))===1}function td(n,t,e){const i=Math.pow(10,e),s=Math.floor(n/i);return Math.ceil(t/i)-s}function Bx(n,t){const e=t-n;let i=vi(e);for(;td(n,t,i)>10;)i++;for(;td(n,t,i)<10;)i--;return Math.min(i,vi(n))}function $x(n,{min:t,max:e}){t=zt(n.min,t);const i=[],s=vi(t);let o=Bx(t,e),r=o<0?Math.pow(10,Math.abs(o)):1;const a=Math.pow(10,o),c=s>o?Math.pow(10,s):0,d=Math.round((t-c)*r)/r,u=Math.floor((t-c)/a/10)*a*10;let h=Math.floor((d-u)/Math.pow(10,o)),f=zt(n.min,Math.round((c+u+h*Math.pow(10,o))*r)/r);for(;f<e;)i.push({value:f,major:Zc(f),significand:h}),h>=10?h=h<15?15:20:h++,h>=20&&(o++,h=2,r=o>=0?1:r),f=Math.round((c+u+h*Math.pow(10,o))*r)/r;const m=zt(n.max,f);return i.push({value:m,major:Zc(m),significand:h}),i}class xs extends We{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){const i=bs.prototype.parse.apply(this,[t,e]);if(i===0){this._zero=!0;return}return St(i)&&i>0?i:null}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=St(t)?Math.max(0,t):null,this.max=St(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!St(this._userMin)&&(this.min=t===an(this.min,0)?an(this.min,-1):an(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let i=this.min,s=this.max;const o=a=>i=t?i:a,r=a=>s=e?s:a;i===s&&(i<=0?(o(1),r(10)):(o(an(i,-1)),r(an(s,1)))),i<=0&&o(an(s,-1)),s<=0&&r(an(i,1)),this.min=i,this.max=s}buildTicks(){const t=this.options,e={min:this._userMin,max:this._userMax},i=$x(e,this);return t.bounds==="ticks"&&Wa(i,this,"value"),t.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}getLabelForValue(t){return t===void 0?"0":si(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=Ie(t),this._valueRange=Ie(this.max)-Ie(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(Ie(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}}L(xs,"id","logarithmic"),L(xs,"defaults",{ticks:{callback:oi.formatters.logarithmic,major:{enabled:!0}}});function Io(n){const t=n.ticks;if(t.display&&n.display){const e=Vt(t.backdropPadding);return Q(t.font&&t.font.size,gt.font.size)+e.height}return 0}function Rx(n,t,e){return e=_t(e)?e:[e],{w:ab(n,t.string,e),h:e.length*t.lineHeight}}function ed(n,t,e,i,s){return n===i||n===s?{start:t-e/2,end:t+e/2}:n<i||n>s?{start:t-e,end:t}:{start:t,end:t+e}}function Lx(n){const t={l:n.left+n._padding.left,r:n.right-n._padding.right,t:n.top+n._padding.top,b:n.bottom-n._padding.bottom},e=Object.assign({},t),i=[],s=[],o=n._pointLabels.length,r=n.options.pointLabels,a=r.centerPointLabels?mt/o:0;for(let c=0;c<o;c++){const d=r.setContext(n.getPointLabelContext(c));s[c]=d.padding;const u=n.getPointPosition(c,n.drawingArea+s[c],a),h=Ct(d.font),f=Rx(n.ctx,h,n._pointLabels[c]);i[c]=f;const m=Wt(n.getIndexAngle(c)+a),p=Math.round(io(m)),g=ed(p,u.x,f.w,0,180),y=ed(p,u.y,f.h,90,270);Ix(e,t,m,g,y)}n.setCenterPoint(t.l-e.l,e.r-t.r,t.t-e.t,e.b-t.b),n._pointLabelItems=Wx(n,i,s)}function Ix(n,t,e,i,s){const o=Math.abs(Math.sin(e)),r=Math.abs(Math.cos(e));let a=0,c=0;i.start<t.l?(a=(t.l-i.start)/o,n.l=Math.min(n.l,t.l-a)):i.end>t.r&&(a=(i.end-t.r)/o,n.r=Math.max(n.r,t.r+a)),s.start<t.t?(c=(t.t-s.start)/r,n.t=Math.min(n.t,t.t-c)):s.end>t.b&&(c=(s.end-t.b)/r,n.b=Math.max(n.b,t.b+c))}function jx(n,t,e){const i=n.drawingArea,{extra:s,additionalAngle:o,padding:r,size:a}=e,c=n.getPointPosition(t,i+s+r,o),d=Math.round(io(Wt(c.angle+wt))),u=qx(c.y,a.h,d),h=Hx(d),f=Ux(c.x,a.w,h);return{visible:!0,x:c.x,y:u,textAlign:h,left:f,top:u,right:f+a.w,bottom:u+a.h}}function zx(n,t){if(!t)return!0;const{left:e,top:i,right:s,bottom:o}=n;return!(ve({x:e,y:i},t)||ve({x:e,y:o},t)||ve({x:s,y:i},t)||ve({x:s,y:o},t))}function Wx(n,t,e){const i=[],s=n._pointLabels.length,o=n.options,{centerPointLabels:r,display:a}=o.pointLabels,c={extra:Io(o)/2,additionalAngle:r?mt/s:0};let d;for(let u=0;u<s;u++){c.padding=e[u],c.size=t[u];const h=jx(n,u,c);i.push(h),a==="auto"&&(h.visible=zx(h,d),h.visible&&(d=h))}return i}function Hx(n){return n===0||n===180?"center":n<180?"left":"right"}function Ux(n,t,e){return e==="right"?n-=t:e==="center"&&(n-=t/2),n}function qx(n,t,e){return e===90||e===270?n-=t/2:(e>270||e<90)&&(n-=t),n}function Yx(n,t,e){const{left:i,top:s,right:o,bottom:r}=e,{backdropColor:a}=t;if(!it(a)){const c=en(t.borderRadius),d=Vt(t.backdropPadding);n.fillStyle=a;const u=i-d.left,h=s-d.top,f=o-i+d.width,m=r-s+d.height;Object.values(c).some(p=>p!==0)?(n.beginPath(),ai(n,{x:u,y:h,w:f,h:m,radius:c}),n.fill()):n.fillRect(u,h,f,m)}}function Kx(n,t){const{ctx:e,options:{pointLabels:i}}=n;for(let s=t-1;s>=0;s--){const o=n._pointLabelItems[s];if(!o.visible)continue;const r=i.setContext(n.getPointLabelContext(s));Yx(e,r,o);const a=Ct(r.font),{x:c,y:d,textAlign:u}=o;tn(e,n._pointLabels[s],c,d+a.lineHeight/2,a,{color:r.color,textAlign:u,textBaseline:"middle"})}}function nd(n,t,e,i){const{ctx:s}=n;if(e)s.arc(n.xCenter,n.yCenter,t,0,pt);else{let o=n.getPointPosition(0,t);s.moveTo(o.x,o.y);for(let r=1;r<i;r++)o=n.getPointPosition(r,t),s.lineTo(o.x,o.y)}}function Xx(n,t,e,i,s){const o=n.ctx,r=t.circular,{color:a,lineWidth:c}=t;!r&&!i||!a||!c||e<0||(o.save(),o.strokeStyle=a,o.lineWidth=c,o.setLineDash(s.dash||[]),o.lineDashOffset=s.dashOffset,o.beginPath(),nd(n,e,r,i),o.closePath(),o.stroke(),o.restore())}function Gx(n,t,e){return je(n,{label:e,index:t,type:"pointLabel"})}class Cn extends bs{constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){const t=this._padding=Vt(Io(this.options)/2),e=this.width=this.maxWidth-t.width,i=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+e/2+t.left),this.yCenter=Math.floor(this.top+i/2+t.top),this.drawingArea=Math.floor(Math.min(e,i)/2)}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!1);this.min=St(t)&&!isNaN(t)?t:0,this.max=St(e)&&!isNaN(e)?e:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/Io(this.options))}generateTickLabels(t){bs.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((e,i)=>{const s=ft(this.options.pointLabels.callback,[e,i],this);return s||s===0?s:""}).filter((e,i)=>this.chart.getDataVisibility(i))}fit(){const t=this.options;t.display&&t.pointLabels.display?Lx(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,i,s){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((i-s)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,i,s))}getIndexAngle(t){const e=pt/(this._pointLabels.length||1),i=this.options.startAngle||0;return Wt(t*e+ie(i))}getDistanceFromCenterForValue(t){if(it(t))return NaN;const e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(it(t))return NaN;const e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){const e=this._pointLabels||[];if(t>=0&&t<e.length){const i=e[t];return Gx(this.getContext(),t,i)}}getPointPosition(t,e,i=0){const s=this.getIndexAngle(t)-wt+i;return{x:Math.cos(s)*e+this.xCenter,y:Math.sin(s)*e+this.yCenter,angle:s}}getPointPositionForValue(t,e){return this.getPointPosition(t,this.getDistanceFromCenterForValue(e))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}getPointLabelPosition(t){const{left:e,top:i,right:s,bottom:o}=this._pointLabelItems[t];return{left:e,top:i,right:s,bottom:o}}drawBackground(){const{backgroundColor:t,grid:{circular:e}}=this.options;if(t){const i=this.ctx;i.save(),i.beginPath(),nd(this,this.getDistanceFromCenterForValue(this._endValue),e,this._pointLabels.length),i.closePath(),i.fillStyle=t,i.fill(),i.restore()}}drawGrid(){const t=this.ctx,e=this.options,{angleLines:i,grid:s,border:o}=e,r=this._pointLabels.length;let a,c,d;if(e.pointLabels.display&&Kx(this,r),s.display&&this.ticks.forEach((u,h)=>{if(h!==0||h===0&&this.min<0){c=this.getDistanceFromCenterForValue(u.value);const f=this.getContext(h),m=s.setContext(f),p=o.setContext(f);Xx(this,m,c,r,p)}}),i.display){for(t.save(),a=r-1;a>=0;a--){const u=i.setContext(this.getPointLabelContext(a)),{color:h,lineWidth:f}=u;!f||!h||(t.lineWidth=f,t.strokeStyle=h,t.setLineDash(u.borderDash),t.lineDashOffset=u.borderDashOffset,c=this.getDistanceFromCenterForValue(e.reverse?this.min:this.max),d=this.getPointPosition(a,c),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(d.x,d.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,e=this.options,i=e.ticks;if(!i.display)return;const s=this.getIndexAngle(0);let o,r;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(s),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((a,c)=>{if(c===0&&this.min>=0&&!e.reverse)return;const d=i.setContext(this.getContext(c)),u=Ct(d.font);if(o=this.getDistanceFromCenterForValue(this.ticks[c].value),d.showLabelBackdrop){t.font=u.string,r=t.measureText(a.label).width,t.fillStyle=d.backdropColor;const h=Vt(d.backdropPadding);t.fillRect(-r/2-h.left,-o-u.size/2-h.top,r+h.width,u.size+h.height)}tn(t,a.label,0,-o,u,{color:d.color,strokeColor:d.textStrokeColor,strokeWidth:d.textStrokeWidth})}),t.restore()}drawTitle(){}}L(Cn,"id","radialLinear"),L(Cn,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:oi.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}}),L(Cn,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),L(Cn,"descriptors",{angleLines:{_fallback:"grid"}});const ks={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},Lt=Object.keys(ks);function id(n,t){return n-t}function sd(n,t){if(it(t))return null;const e=n._adapter,{parser:i,round:s,isoWeekday:o}=n._parseOpts;let r=t;return typeof i=="function"&&(r=i(r)),St(r)||(r=typeof i=="string"?e.parse(r,i):e.parse(r)),r===null?null:(s&&(r=s==="week"&&(_n(o)||o===!0)?e.startOf(r,"isoWeek",o):e.startOf(r,s)),+r)}function od(n,t,e,i){const s=Lt.length;for(let o=Lt.indexOf(n);o<s-1;++o){const r=ks[Lt[o]],a=r.steps?r.steps:Number.MAX_SAFE_INTEGER;if(r.common&&Math.ceil((e-t)/(a*r.size))<=i)return Lt[o]}return Lt[s-1]}function Qx(n,t,e,i,s){for(let o=Lt.length-1;o>=Lt.indexOf(e);o--){const r=Lt[o];if(ks[r].common&&n._adapter.diff(s,i,r)>=t-1)return r}return Lt[e?Lt.indexOf(e):0]}function Jx(n){for(let t=Lt.indexOf(n)+1,e=Lt.length;t<e;++t)if(ks[Lt[t]].common)return Lt[t]}function rd(n,t,e){if(!e)n[t]=!0;else if(e.length){const{lo:i,hi:s}=oo(e,t),o=e[i]>=t?e[i]:e[s];n[o]=!0}}function Zx(n,t,e,i){const s=n._adapter,o=+s.startOf(t[0].value,i),r=t[t.length-1].value;let a,c;for(a=o;a<=r;a=+s.add(a,1,i))c=e[a],c>=0&&(t[c].major=!0);return t}function ad(n,t,e){const i=[],s={},o=t.length;let r,a;for(r=0;r<o;++r)a=t[r],s[a]=r,i.push({value:a,major:!1});return o===0||!e?i:Zx(n,i,s,e)}class On extends We{constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,e={}){const i=t.time||(t.time={}),s=this._adapter=new Rl._date(t.adapters.date);s.init(e),Zn(i.displayFormats,s.formats()),this._parseOpts={parser:i.parser,round:i.round,isoWeekday:i.isoWeekday},super.init(t),this._normalized=e.normalized}parse(t,e){return t===void 0?null:sd(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,e=this._adapter,i=t.time.unit||"day";let{min:s,max:o,minDefined:r,maxDefined:a}=this.getUserBounds();function c(d){!r&&!isNaN(d.min)&&(s=Math.min(s,d.min)),!a&&!isNaN(d.max)&&(o=Math.max(o,d.max))}(!r||!a)&&(c(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&c(this.getMinMax(!1))),s=St(s)&&!isNaN(s)?s:+e.startOf(Date.now(),i),o=St(o)&&!isNaN(o)?o:+e.endOf(Date.now(),i)+1,this.min=Math.min(s,o-1),this.max=Math.max(s+1,o)}_getLabelBounds(){const t=this.getLabelTimestamps();let e=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;return t.length&&(e=t[0],i=t[t.length-1]),{min:e,max:i}}buildTicks(){const t=this.options,e=t.time,i=t.ticks,s=i.source==="labels"?this.getLabelTimestamps():this._generate();t.bounds==="ticks"&&s.length&&(this.min=this._userMin||s[0],this.max=this._userMax||s[s.length-1]);const o=this.min,r=this.max,a=Ky(s,o,r);return this._unit=e.unit||(i.autoSkip?od(e.minUnit,this.min,this.max,this._getLabelCapacity(o)):Qx(this,a.length,e.minUnit,this.min,this.max)),this._majorUnit=!i.major.enabled||this._unit==="year"?void 0:Jx(this._unit),this.initOffsets(s),t.reverse&&a.reverse(),ad(this,a,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let e=0,i=0,s,o;this.options.offset&&t.length&&(s=this.getDecimalForValue(t[0]),t.length===1?e=1-s:e=(this.getDecimalForValue(t[1])-s)/2,o=this.getDecimalForValue(t[t.length-1]),t.length===1?i=o:i=(o-this.getDecimalForValue(t[t.length-2]))/2);const r=t.length<3?.5:.25;e=Dt(e,0,r),i=Dt(i,0,r),this._offsets={start:e,end:i,factor:1/(e+1+i)}}_generate(){const t=this._adapter,e=this.min,i=this.max,s=this.options,o=s.time,r=o.unit||od(o.minUnit,e,i,this._getLabelCapacity(e)),a=Q(s.ticks.stepSize,1),c=r==="week"?o.isoWeekday:!1,d=_n(c)||c===!0,u={};let h=e,f,m;if(d&&(h=+t.startOf(h,"isoWeek",c)),h=+t.startOf(h,d?"day":r),t.diff(i,e,r)>1e5*a)throw new Error(e+" and "+i+" are too far apart with stepSize of "+a+" "+r);const p=s.ticks.source==="data"&&this.getDataTimestamps();for(f=h,m=0;f<i;f=+t.add(f,a,r),m++)rd(u,f,p);return(f===i||s.bounds==="ticks"||m===1)&&rd(u,f,p),Object.keys(u).sort(id).map(g=>+g)}getLabelForValue(t){const e=this._adapter,i=this.options.time;return i.tooltipFormat?e.format(t,i.tooltipFormat):e.format(t,i.displayFormats.datetime)}format(t,e){const s=this.options.time.displayFormats,o=this._unit,r=e||s[o];return this._adapter.format(t,r)}_tickFormatFunction(t,e,i,s){const o=this.options,r=o.ticks.callback;if(r)return ft(r,[t,e,i],this);const a=o.time.displayFormats,c=this._unit,d=this._majorUnit,u=c&&a[c],h=d&&a[d],f=i[e],m=d&&h&&f&&f.major;return this._adapter.format(t,s||(m?h:u))}generateTickLabels(t){let e,i,s;for(e=0,i=t.length;e<i;++e)s=t[e],s.label=this._tickFormatFunction(s.value,e,t)}getDecimalForValue(t){return t===null?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const e=this._offsets,i=this.getDecimalForValue(t);return this.getPixelForDecimal((e.start+i)*e.factor)}getValueForPixel(t){const e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return this.min+i*(this.max-this.min)}_getLabelSize(t){const e=this.options.ticks,i=this.ctx.measureText(t).width,s=ie(this.isHorizontal()?e.maxRotation:e.minRotation),o=Math.cos(s),r=Math.sin(s),a=this._resolveTickFontOptions(0).size;return{w:i*o+a*r,h:i*r+a*o}}_getLabelCapacity(t){const e=this.options.time,i=e.displayFormats,s=i[e.unit]||i.millisecond,o=this._tickFormatFunction(t,0,ad(this,[t],this._majorUnit),s),r=this._getLabelSize(o),a=Math.floor(this.isHorizontal()?this.width/r.w:this.height/r.h)-1;return a>0?a:1}getDataTimestamps(){let t=this._cache.data||[],e,i;if(t.length)return t;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(e=0,i=s.length;e<i;++e)t=t.concat(s[e].controller.getAllParsedValues(this));return this._cache.data=this.normalize(t)}getLabelTimestamps(){const t=this._cache.labels||[];let e,i;if(t.length)return t;const s=this.getLabels();for(e=0,i=s.length;e<i;++e)t.push(sd(this,s[e]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return Ka(t.sort(id))}}L(On,"id","time"),L(On,"defaults",{bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}});function Ss(n,t,e){let i=0,s=n.length-1,o,r,a,c;e?(t>=n[i].pos&&t<=n[s].pos&&({lo:i,hi:s}=Ee(n,"pos",t)),{pos:o,time:a}=n[i],{pos:r,time:c}=n[s]):(t>=n[i].time&&t<=n[s].time&&({lo:i,hi:s}=Ee(n,"time",t)),{time:o,pos:a}=n[i],{time:r,pos:c}=n[s]);const d=r-o;return d?a+(c-a)*(t-o)/d:a}class ws extends On{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=Ss(e,this.min),this._tableRange=Ss(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:i}=this,s=[],o=[];let r,a,c,d,u;for(r=0,a=t.length;r<a;++r)d=t[r],d>=e&&d<=i&&s.push(d);if(s.length<2)return[{time:e,pos:0},{time:i,pos:1}];for(r=0,a=s.length;r<a;++r)u=s[r+1],c=s[r-1],d=s[r],Math.round((u+c)/2)!==d&&o.push({time:d,pos:r/(a-1)});return o}_generate(){const t=this.min,e=this.max;let i=super.getDataTimestamps();return(!i.includes(t)||!i.length)&&i.splice(0,0,t),(!i.includes(e)||i.length===1)&&i.push(e),i.sort((s,o)=>s-o)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const e=this.getDataTimestamps(),i=this.getLabelTimestamps();return e.length&&i.length?t=this.normalize(e.concat(i)):t=e.length?e:i,t=this._cache.all=t,t}getDecimalForValue(t){return(Ss(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return Ss(this._table,i*this._tableRange+this._minPos,!0)}}L(ws,"id","timeseries"),L(ws,"defaults",On.defaults);var ld=Object.freeze({__proto__:null,CategoryScale:ys,LinearScale:_s,LogarithmicScale:xs,RadialLinearScale:Cn,TimeScale:On,TimeSeriesScale:ws});const cd=[$l,xc,Gc,ld];ue.register(...cd);const tk=Object.freeze(Object.defineProperty({__proto__:null,Animation:Cl,Animations:_o,ArcElement:vn,BarController:di,BarElement:wi,BasePlatform:Oo,BasicPlatform:ql,BubbleController:ui,CategoryScale:ys,Chart:ue,Colors:vc,DatasetController:Kt,Decimation:Dc,DomPlatform:Ql,DoughnutController:ze,Element:Xt,Filler:Bc,Interaction:Il,Legend:Ic,LineController:hi,LineElement:Ce,LinearScale:_s,LogarithmicScale:xs,PieController:os,PointElement:Si,PolarAreaController:wn,RadarController:fi,RadialLinearScale:Cn,Scale:We,ScatterController:mi,SubTitle:zc,Ticks:oi,TimeScale:On,TimeSeriesScale:ws,Title:jc,Tooltip:Xc,_adapters:Rl,_detectPlatform:Jl,animator:de,controllers:$l,default:ue,defaults:gt,elements:xc,layouts:Pt,plugins:Gc,registerables:cd,registry:se,scales:ld},Symbol.toStringTag,{value:"Module"}));Tt.default=og,Tt.useEntitiesStore=Lr,Tt.useGlobalConfigsStore=me,Object.defineProperties(Tt,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
173
|
+
`):n}function Rx(n,t){const{element:e,datasetIndex:i,index:s}=t,o=n.getDatasetMeta(i).controller,{label:r,value:l}=o.getLabelAndValue(s);return{chart:n,label:r,parsed:o.getParsed(s),raw:n.data.datasets[i].data[s],formattedValue:l,dataset:o.getDataset(),dataIndex:s,datasetIndex:i,element:e}}function Xc(n,t){const e=n.chart.ctx,{body:i,footer:s,title:o}=n,{boxWidth:r,boxHeight:l}=t,c=vt(t.bodyFont),d=vt(t.titleFont),u=vt(t.footerFont),h=o.length,f=s.length,m=i.length,p=Vt(t.padding);let g=p.height,y=0,b=i.reduce((E,k)=>E+k.before.length+k.lines.length+k.after.length,0);if(b+=n.beforeBody.length+n.afterBody.length,h&&(g+=h*d.lineHeight+(h-1)*t.titleSpacing+t.titleMarginBottom),b){const E=t.displayColors?Math.max(l,c.lineHeight):c.lineHeight;g+=m*E+(b-m)*c.lineHeight+(b-1)*t.bodySpacing}f&&(g+=t.footerMarginTop+f*u.lineHeight+(f-1)*t.footerSpacing);let _=0;const w=function(E){y=Math.max(y,e.measureText(E).width+_)};return e.save(),e.font=d.string,lt(n.title,w),e.font=c.string,lt(n.beforeBody.concat(n.afterBody),w),_=t.displayColors?r+2+t.boxPadding:0,lt(i,E=>{lt(E.before,w),lt(E.lines,w),lt(E.after,w)}),_=0,e.font=u.string,lt(n.footer,w),e.restore(),y+=p.width,{width:y,height:g}}function Lx(n,t){const{y:e,height:i}=t;return e<i/2?"top":e>n.height-i/2?"bottom":"center"}function Ix(n,t,e,i){const{x:s,width:o}=i,r=e.caretSize+e.caretPadding;if(n==="left"&&s+o+r>t.width||n==="right"&&s-o-r<0)return!0}function jx(n,t,e,i){const{x:s,width:o}=e,{width:r,chartArea:{left:l,right:c}}=n;let d="center";return i==="center"?d=s<=(l+c)/2?"left":"right":s<=o/2?d="left":s>=r-o/2&&(d="right"),Ix(d,n,t,e)&&(d="center"),d}function Gc(n,t,e){const i=e.yAlign||t.yAlign||Lx(n,e);return{xAlign:e.xAlign||t.xAlign||jx(n,t,e,i),yAlign:i}}function zx(n,t){let{x:e,width:i}=n;return t==="right"?e-=i:t==="center"&&(e-=i/2),e}function Wx(n,t,e){let{y:i,height:s}=n;return t==="top"?i+=e:t==="bottom"?i-=s+e:i-=s/2,i}function Qc(n,t,e,i){const{caretSize:s,caretPadding:o,cornerRadius:r}=n,{xAlign:l,yAlign:c}=e,d=s+o,{topLeft:u,topRight:h,bottomLeft:f,bottomRight:m}=en(r);let p=zx(t,l);const g=Wx(t,c,d);return c==="center"?l==="left"?p+=d:l==="right"&&(p-=d):l==="left"?p-=Math.max(u,f)+s:l==="right"&&(p+=Math.max(h,m)+s),{x:Dt(p,0,i.width-t.width),y:Dt(g,0,i.height-t.height)}}function bs(n,t,e){const i=Vt(e.padding);return t==="center"?n.x+n.width/2:t==="right"?n.x+n.width-i.right:n.x+i.left}function Jc(n){return fe([],Oe(n))}function Hx(n,t,e){return je(n,{tooltip:t,tooltipItems:e,type:"tooltip"})}function Zc(n,t){const e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?n.override(e):n}const td={beforeTitle:Se,title(n){if(n.length>0){const t=n[0],e=t.chart.data.labels,i=e?e.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(i>0&&t.dataIndex<i)return e[t.dataIndex]}return""},afterTitle:Se,beforeBody:Se,beforeLabel:Se,label(n){if(this&&this.options&&this.options.mode==="dataset")return n.label+": "+n.formattedValue||n.formattedValue;let t=n.dataset.label||"";t&&(t+=": ");const e=n.formattedValue;return it(e)||(t+=e),t},labelColor(n){const e=n.chart.getDatasetMeta(n.datasetIndex).controller.getStyle(n.dataIndex);return{borderColor:e.borderColor,backgroundColor:e.backgroundColor,borderWidth:e.borderWidth,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(n){const e=n.chart.getDatasetMeta(n.datasetIndex).controller.getStyle(n.dataIndex);return{pointStyle:e.pointStyle,rotation:e.rotation}},afterLabel:Se,afterBody:Se,beforeFooter:Se,footer:Se,afterFooter:Se};function Lt(n,t,e,i){const s=n[t].call(e,i);return typeof s>"u"?td[t].call(e,i):s}class zo extends Xt{constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const e=this.chart,i=this.options.setContext(this.getContext()),s=i.enabled&&e.options.animation&&i.animations,o=new So(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=Hx(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,e){const{callbacks:i}=e,s=Lt(i,"beforeTitle",this,t),o=Lt(i,"title",this,t),r=Lt(i,"afterTitle",this,t);let l=[];return l=fe(l,Oe(s)),l=fe(l,Oe(o)),l=fe(l,Oe(r)),l}getBeforeBody(t,e){return Jc(Lt(e.callbacks,"beforeBody",this,t))}getBody(t,e){const{callbacks:i}=e,s=[];return lt(t,o=>{const r={before:[],lines:[],after:[]},l=Zc(i,o);fe(r.before,Oe(Lt(l,"beforeLabel",this,o))),fe(r.lines,Lt(l,"label",this,o)),fe(r.after,Oe(Lt(l,"afterLabel",this,o))),s.push(r)}),s}getAfterBody(t,e){return Jc(Lt(e.callbacks,"afterBody",this,t))}getFooter(t,e){const{callbacks:i}=e,s=Lt(i,"beforeFooter",this,t),o=Lt(i,"footer",this,t),r=Lt(i,"afterFooter",this,t);let l=[];return l=fe(l,Oe(s)),l=fe(l,Oe(o)),l=fe(l,Oe(r)),l}_createItems(t){const e=this._active,i=this.chart.data,s=[],o=[],r=[];let l=[],c,d;for(c=0,d=e.length;c<d;++c)l.push(Rx(this.chart,e[c]));return t.filter&&(l=l.filter((u,h,f)=>t.filter(u,h,f,i))),t.itemSort&&(l=l.sort((u,h)=>t.itemSort(u,h,i))),lt(l,u=>{const h=Zc(t.callbacks,u);s.push(Lt(h,"labelColor",this,u)),o.push(Lt(h,"labelPointStyle",this,u)),r.push(Lt(h,"labelTextColor",this,u))}),this.labelColors=s,this.labelPointStyles=o,this.labelTextColors=r,this.dataPoints=l,l}update(t,e){const i=this.options.setContext(this.getContext()),s=this._active;let o,r=[];if(!s.length)this.opacity!==0&&(o={opacity:0});else{const l=Ei[i.position].call(this,s,this._eventPosition);r=this._createItems(i),this.title=this.getTitle(r,i),this.beforeBody=this.getBeforeBody(r,i),this.body=this.getBody(r,i),this.afterBody=this.getAfterBody(r,i),this.footer=this.getFooter(r,i);const c=this._size=Xc(this,i),d=Object.assign({},l,c),u=Gc(this.chart,i,d),h=Qc(i,d,u,this.chart);this.xAlign=u.xAlign,this.yAlign=u.yAlign,o={opacity:1,x:h.x,y:h.y,width:c.width,height:c.height,caretX:l.x,caretY:l.y}}this._tooltipItems=r,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,i,s){const o=this.getCaretPosition(t,i,s);e.lineTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.lineTo(o.x3,o.y3)}getCaretPosition(t,e,i){const{xAlign:s,yAlign:o}=this,{caretSize:r,cornerRadius:l}=i,{topLeft:c,topRight:d,bottomLeft:u,bottomRight:h}=en(l),{x:f,y:m}=t,{width:p,height:g}=e;let y,b,_,w,E,k;return o==="center"?(E=m+g/2,s==="left"?(y=f,b=y-r,w=E+r,k=E-r):(y=f+p,b=y+r,w=E-r,k=E+r),_=y):(s==="left"?b=f+Math.max(c,u)+r:s==="right"?b=f+p-Math.max(d,h)-r:b=this.caretX,o==="top"?(w=m,E=w-r,y=b-r,_=b+r):(w=m+g,E=w+r,y=b+r,_=b-r),k=w),{x1:y,x2:b,x3:_,y1:w,y2:E,y3:k}}drawTitle(t,e,i){const s=this.title,o=s.length;let r,l,c;if(o){const d=Sn(i.rtl,this.x,this.width);for(t.x=bs(this,i.titleAlign,i),e.textAlign=d.textAlign(i.titleAlign),e.textBaseline="middle",r=vt(i.titleFont),l=i.titleSpacing,e.fillStyle=i.titleColor,e.font=r.string,c=0;c<o;++c)e.fillText(s[c],d.x(t.x),t.y+r.lineHeight/2),t.y+=r.lineHeight+l,c+1===o&&(t.y+=i.titleMarginBottom-l)}}_drawColorBox(t,e,i,s,o){const r=this.labelColors[i],l=this.labelPointStyles[i],{boxHeight:c,boxWidth:d}=o,u=vt(o.bodyFont),h=bs(this,"left",o),f=s.x(h),m=c<u.lineHeight?(u.lineHeight-c)/2:0,p=e.y+m;if(o.usePointStyle){const g={radius:Math.min(d,c)/2,pointStyle:l.pointStyle,rotation:l.rotation,borderWidth:1},y=s.leftForLtr(f,d)+d/2,b=p+c/2;t.strokeStyle=o.multiKeyBackground,t.fillStyle=o.multiKeyBackground,po(t,g,y,b),t.strokeStyle=r.borderColor,t.fillStyle=r.backgroundColor,po(t,g,y,b)}else{t.lineWidth=et(r.borderWidth)?Math.max(...Object.values(r.borderWidth)):r.borderWidth||1,t.strokeStyle=r.borderColor,t.setLineDash(r.borderDash||[]),t.lineDashOffset=r.borderDashOffset||0;const g=s.leftForLtr(f,d),y=s.leftForLtr(s.xPlus(f,1),d-2),b=en(r.borderRadius);Object.values(b).some(_=>_!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,ai(t,{x:g,y:p,w:d,h:c,radius:b}),t.fill(),t.stroke(),t.fillStyle=r.backgroundColor,t.beginPath(),ai(t,{x:y,y:p+1,w:d-2,h:c-2,radius:b}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(g,p,d,c),t.strokeRect(g,p,d,c),t.fillStyle=r.backgroundColor,t.fillRect(y,p+1,d-2,c-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,e,i){const{body:s}=this,{bodySpacing:o,bodyAlign:r,displayColors:l,boxHeight:c,boxWidth:d,boxPadding:u}=i,h=vt(i.bodyFont);let f=h.lineHeight,m=0;const p=Sn(i.rtl,this.x,this.width),g=function(x){e.fillText(x,p.x(t.x+m),t.y+f/2),t.y+=f+o},y=p.textAlign(r);let b,_,w,E,k,C,S;for(e.textAlign=r,e.textBaseline="middle",e.font=h.string,t.x=bs(this,y,i),e.fillStyle=i.bodyColor,lt(this.beforeBody,g),m=l&&y!=="right"?r==="center"?d/2+u:d+2+u:0,E=0,C=s.length;E<C;++E){for(b=s[E],_=this.labelTextColors[E],e.fillStyle=_,lt(b.before,g),w=b.lines,l&&w.length&&(this._drawColorBox(e,t,E,p,i),f=Math.max(h.lineHeight,c)),k=0,S=w.length;k<S;++k)g(w[k]),f=h.lineHeight;lt(b.after,g)}m=0,f=h.lineHeight,lt(this.afterBody,g),t.y-=o}drawFooter(t,e,i){const s=this.footer,o=s.length;let r,l;if(o){const c=Sn(i.rtl,this.x,this.width);for(t.x=bs(this,i.footerAlign,i),t.y+=i.footerMarginTop,e.textAlign=c.textAlign(i.footerAlign),e.textBaseline="middle",r=vt(i.footerFont),e.fillStyle=i.footerColor,e.font=r.string,l=0;l<o;++l)e.fillText(s[l],c.x(t.x),t.y+r.lineHeight/2),t.y+=r.lineHeight+i.footerSpacing}}drawBackground(t,e,i,s){const{xAlign:o,yAlign:r}=this,{x:l,y:c}=t,{width:d,height:u}=i,{topLeft:h,topRight:f,bottomLeft:m,bottomRight:p}=en(s.cornerRadius);e.fillStyle=s.backgroundColor,e.strokeStyle=s.borderColor,e.lineWidth=s.borderWidth,e.beginPath(),e.moveTo(l+h,c),r==="top"&&this.drawCaret(t,e,i,s),e.lineTo(l+d-f,c),e.quadraticCurveTo(l+d,c,l+d,c+f),r==="center"&&o==="right"&&this.drawCaret(t,e,i,s),e.lineTo(l+d,c+u-p),e.quadraticCurveTo(l+d,c+u,l+d-p,c+u),r==="bottom"&&this.drawCaret(t,e,i,s),e.lineTo(l+m,c+u),e.quadraticCurveTo(l,c+u,l,c+u-m),r==="center"&&o==="left"&&this.drawCaret(t,e,i,s),e.lineTo(l,c+h),e.quadraticCurveTo(l,c,l+h,c),e.closePath(),e.fill(),s.borderWidth>0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,i=this.$animations,s=i&&i.x,o=i&&i.y;if(s||o){const r=Ei[t.position].call(this,this._active,this._eventPosition);if(!r)return;const l=this._size=Xc(this,t),c=Object.assign({},r,this._size),d=Gc(e,t,c),u=Qc(t,c,d,e);(s._to!==u.x||o._to!==u.y)&&(this.xAlign=d.xAlign,this.yAlign=d.yAlign,this.width=l.width,this.height=l.height,this.caretX=r.x,this.caretY=r.y,this._resolveAnimations().update(this,u))}}_willRender(){return!!this.opacity}draw(t){const e=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(e);const s={width:this.width,height:this.height},o={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const r=Vt(e.padding),l=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&l&&(t.save(),t.globalAlpha=i,this.drawBackground(o,t,s,e),wl(t,e.textDirection),o.y+=r.top,this.drawTitle(o,t,e),this.drawBody(o,t,e),this.drawFooter(o,t,e),El(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const i=this._active,s=t.map(({datasetIndex:l,index:c})=>{const d=this.chart.getDatasetMeta(l);if(!d)throw new Error("Cannot find a dataset at index "+l);return{datasetIndex:l,element:d.data[c],index:c}}),o=!Gi(i,s),r=this._positionChanged(s,e);(o||r)&&(this._active=s,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,i=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,o=this._active||[],r=this._getActiveElements(t,o,e,i),l=this._positionChanged(r,t),c=e||!Gi(r,o)||l;return c&&(this._active=r,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),c}_getActiveElements(t,e,i,s){const o=this.options;if(t.type==="mouseout")return[];if(!s)return e.filter(l=>this.chart.data.datasets[l.datasetIndex]&&this.chart.getDatasetMeta(l.datasetIndex).controller.getParsed(l.index)!==void 0);const r=this.chart.getElementsAtEventForMode(t,o.mode,o,i);return o.reverse&&r.reverse(),r}_positionChanged(t,e){const{caretX:i,caretY:s,options:o}=this,r=Ei[o.position].call(this,t,e);return r!==!1&&(i!==r.x||s!==r.y)}}L(zo,"positioners",Ei);var ed={id:"tooltip",_element:zo,positioners:Ei,afterInit(n,t,e){e&&(n.tooltip=new zo({chart:n,options:e}))},beforeUpdate(n,t,e){n.tooltip&&n.tooltip.initialize(e)},reset(n,t,e){n.tooltip&&n.tooltip.initialize(e)},afterDraw(n){const t=n.tooltip;if(t&&t._willRender()){const e={tooltip:t};if(n.notifyPlugins("beforeTooltipDraw",{...e,cancelable:!0})===!1)return;t.draw(n.ctx),n.notifyPlugins("afterTooltipDraw",e)}},afterEvent(n,t){if(n.tooltip){const e=t.replay;n.tooltip.handleEvent(t.event,e,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(n,t)=>t.bodyFont.size,boxWidth:(n,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:td},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:n=>n!=="filter"&&n!=="itemSort"&&n!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},nd=Object.freeze({__proto__:null,Colors:Pc,Decimation:Ac,Filler:zc,Legend:qc,SubTitle:Kc,Title:Yc,Tooltip:ed});const Ux=(n,t,e,i)=>(typeof t=="string"?(e=n.push(t)-1,i.unshift({index:e,label:t})):isNaN(t)&&(e=null),e);function qx(n,t,e,i){const s=n.indexOf(t);if(s===-1)return Ux(n,t,e,i);const o=n.lastIndexOf(t);return s!==o?e:s}const Yx=(n,t)=>n===null?null:Dt(Math.round(n),0,t);function id(n){const t=this.getLabels();return n>=0&&n<t.length?t[n]:n}class _s extends We{constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const e=this._addedLabels;if(e.length){const i=this.getLabels();for(const{index:s,label:o}of e)i[s]===o&&i.splice(s,1);this._addedLabels=[]}super.init(t)}parse(t,e){if(it(t))return null;const i=this.getLabels();return e=isFinite(e)&&i[e]===t?e:qx(i,t,Q(e,t),this._addedLabels),Yx(e,i.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let{min:i,max:s}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(i=0),e||(s=this.getLabels().length-1)),this.min=i,this.max=s}buildTicks(){const t=this.min,e=this.max,i=this.options.offset,s=[];let o=this.getLabels();o=t===0&&e===o.length-1?o:o.slice(t,e+1),this._valueRange=Math.max(o.length-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let r=t;r<=e;r++)s.push({value:r});return s}getLabelForValue(t){return id.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return typeof t!="number"&&(t=this.parse(t)),t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}L(_s,"id","category"),L(_s,"defaults",{ticks:{callback:id}});function Kx(n,t){const e=[],{bounds:s,step:o,min:r,max:l,precision:c,count:d,maxTicks:u,maxDigits:h,includeBounds:f}=n,m=o||1,p=u-1,{min:g,max:y}=t,b=!it(r),_=!it(l),w=!it(d),E=(y-g)/(h+1);let k=Ka((y-g)/p/m)*m,C,S,x,O;if(k<1e-14&&!b&&!_)return[{value:g},{value:y}];O=Math.ceil(y/k)-Math.floor(g/k),O>p&&(k=Ka(O*k/p/m)*m),it(c)||(C=Math.pow(10,c),k=Math.ceil(k*C)/C),s==="ticks"?(S=Math.floor(g/k)*k,x=Math.ceil(y/k)*k):(S=g,x=y),b&&_&&o&&ib((l-r)/o,k/1e3)?(O=Math.round(Math.min((l-r)/k,u)),k=(l-r)/O,S=r,x=l):w?(S=b?r:S,x=_?l:x,O=d-1,k=(x-S)/O):(O=(x-S)/k,ei(O,Math.round(O),k/1e3)?O=Math.round(O):O=Math.ceil(O));const M=Math.max(Ga(k),Ga(S));C=Math.pow(10,it(c)?M:c),S=Math.round(S*C)/C,x=Math.round(x*C)/C;let v=0;for(b&&(f&&S!==r?(e.push({value:r}),S<r&&v++,ei(Math.round((S+v*k)*C)/C,r,sd(r,E,n))&&v++):S<r&&v++);v<O;++v){const T=Math.round((S+v*k)*C)/C;if(_&&T>l)break;e.push({value:T})}return _&&f&&x!==l?e.length&&ei(e[e.length-1].value,l,sd(l,E,n))?e[e.length-1].value=l:e.push({value:l}):(!_||x===l)&&e.push({value:x}),e}function sd(n,t,{horizontal:e,minRotation:i}){const s=ie(i),o=(e?Math.sin(s):Math.cos(s))||.001,r=.75*t*(""+n).length;return Math.min(t/o,r)}class xs extends We{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return it(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:e,maxDefined:i}=this.getUserBounds();let{min:s,max:o}=this;const r=c=>s=e?s:c,l=c=>o=i?o:c;if(t){const c=de(s),d=de(o);c<0&&d<0?l(0):c>0&&d>0&&r(0)}if(s===o){let c=o===0?1:Math.abs(o*.05);l(o+c),t||r(s-c)}this.min=s,this.max=o}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:e,stepSize:i}=t,s;return i?(s=Math.ceil(this.max/i)-Math.floor(this.min/i)+1,s>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${i} would result generating up to ${s} ticks. Limiting to 1000.`),s=1e3)):(s=this.computeTickLimit(),e=e||11),e&&(s=Math.min(e,s)),s}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let i=this.getTickLimit();i=Math.max(2,i);const s={maxTicks:i,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:e.includeBounds!==!1},o=this._range||this,r=Kx(s,o);return t.bounds==="ticks"&&Xa(r,this,"value"),t.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}configure(){const t=this.ticks;let e=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){const s=(i-e)/Math.max(t.length-1,1)/2;e-=s,i+=s}this._startValue=e,this._endValue=i,this._valueRange=i-e}getLabelForValue(t){return si(t,this.chart.options.locale,this.options.ticks.format)}}class ks extends xs{determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=St(t)?t:0,this.max=St(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,i=ie(this.options.ticks.minRotation),s=(t?Math.sin(i):Math.cos(i))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,o.lineHeight/s))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}L(ks,"id","linear"),L(ks,"defaults",{ticks:{callback:oi.formatters.numeric}});const Ci=n=>Math.floor(Ie(n)),an=(n,t)=>Math.pow(10,Ci(n)+t);function od(n){return n/Math.pow(10,Ci(n))===1}function rd(n,t,e){const i=Math.pow(10,e),s=Math.floor(n/i);return Math.ceil(t/i)-s}function Xx(n,t){const e=t-n;let i=Ci(e);for(;rd(n,t,i)>10;)i++;for(;rd(n,t,i)<10;)i--;return Math.min(i,Ci(n))}function Gx(n,{min:t,max:e}){t=zt(n.min,t);const i=[],s=Ci(t);let o=Xx(t,e),r=o<0?Math.pow(10,Math.abs(o)):1;const l=Math.pow(10,o),c=s>o?Math.pow(10,s):0,d=Math.round((t-c)*r)/r,u=Math.floor((t-c)/l/10)*l*10;let h=Math.floor((d-u)/Math.pow(10,o)),f=zt(n.min,Math.round((c+u+h*Math.pow(10,o))*r)/r);for(;f<e;)i.push({value:f,major:od(f),significand:h}),h>=10?h=h<15?15:20:h++,h>=20&&(o++,h=2,r=o>=0?1:r),f=Math.round((c+u+h*Math.pow(10,o))*r)/r;const m=zt(n.max,f);return i.push({value:m,major:od(m),significand:h}),i}class Ss extends We{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){const i=xs.prototype.parse.apply(this,[t,e]);if(i===0){this._zero=!0;return}return St(i)&&i>0?i:null}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=St(t)?Math.max(0,t):null,this.max=St(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!St(this._userMin)&&(this.min=t===an(this.min,0)?an(this.min,-1):an(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let i=this.min,s=this.max;const o=l=>i=t?i:l,r=l=>s=e?s:l;i===s&&(i<=0?(o(1),r(10)):(o(an(i,-1)),r(an(s,1)))),i<=0&&o(an(s,-1)),s<=0&&r(an(i,1)),this.min=i,this.max=s}buildTicks(){const t=this.options,e={min:this._userMin,max:this._userMax},i=Gx(e,this);return t.bounds==="ticks"&&Xa(i,this,"value"),t.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}getLabelForValue(t){return t===void 0?"0":si(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=Ie(t),this._valueRange=Ie(this.max)-Ie(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(Ie(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}}L(Ss,"id","logarithmic"),L(Ss,"defaults",{ticks:{callback:oi.formatters.logarithmic,major:{enabled:!0}}});function Wo(n){const t=n.ticks;if(t.display&&n.display){const e=Vt(t.backdropPadding);return Q(t.font&&t.font.size,gt.font.size)+e.height}return 0}function Qx(n,t,e){return e=_t(e)?e:[e],{w:xb(n,t.string,e),h:e.length*t.lineHeight}}function ad(n,t,e,i,s){return n===i||n===s?{start:t-e/2,end:t+e/2}:n<i||n>s?{start:t-e,end:t}:{start:t,end:t+e}}function Jx(n){const t={l:n.left+n._padding.left,r:n.right-n._padding.right,t:n.top+n._padding.top,b:n.bottom-n._padding.bottom},e=Object.assign({},t),i=[],s=[],o=n._pointLabels.length,r=n.options.pointLabels,l=r.centerPointLabels?mt/o:0;for(let c=0;c<o;c++){const d=r.setContext(n.getPointLabelContext(c));s[c]=d.padding;const u=n.getPointPosition(c,n.drawingArea+s[c],l),h=vt(d.font),f=Qx(n.ctx,h,n._pointLabels[c]);i[c]=f;const m=Wt(n.getIndexAngle(c)+l),p=Math.round(ro(m)),g=ad(p,u.x,f.w,0,180),y=ad(p,u.y,f.h,90,270);Zx(e,t,m,g,y)}n.setCenterPoint(t.l-e.l,e.r-t.r,t.t-e.t,e.b-t.b),n._pointLabelItems=nk(n,i,s)}function Zx(n,t,e,i,s){const o=Math.abs(Math.sin(e)),r=Math.abs(Math.cos(e));let l=0,c=0;i.start<t.l?(l=(t.l-i.start)/o,n.l=Math.min(n.l,t.l-l)):i.end>t.r&&(l=(i.end-t.r)/o,n.r=Math.max(n.r,t.r+l)),s.start<t.t?(c=(t.t-s.start)/r,n.t=Math.min(n.t,t.t-c)):s.end>t.b&&(c=(s.end-t.b)/r,n.b=Math.max(n.b,t.b+c))}function tk(n,t,e){const i=n.drawingArea,{extra:s,additionalAngle:o,padding:r,size:l}=e,c=n.getPointPosition(t,i+s+r,o),d=Math.round(ro(Wt(c.angle+wt))),u=ok(c.y,l.h,d),h=ik(d),f=sk(c.x,l.w,h);return{visible:!0,x:c.x,y:u,textAlign:h,left:f,top:u,right:f+l.w,bottom:u+l.h}}function ek(n,t){if(!t)return!0;const{left:e,top:i,right:s,bottom:o}=n;return!(Ce({x:e,y:i},t)||Ce({x:e,y:o},t)||Ce({x:s,y:i},t)||Ce({x:s,y:o},t))}function nk(n,t,e){const i=[],s=n._pointLabels.length,o=n.options,{centerPointLabels:r,display:l}=o.pointLabels,c={extra:Wo(o)/2,additionalAngle:r?mt/s:0};let d;for(let u=0;u<s;u++){c.padding=e[u],c.size=t[u];const h=tk(n,u,c);i.push(h),l==="auto"&&(h.visible=ek(h,d),h.visible&&(d=h))}return i}function ik(n){return n===0||n===180?"center":n<180?"left":"right"}function sk(n,t,e){return e==="right"?n-=t:e==="center"&&(n-=t/2),n}function ok(n,t,e){return e===90||e===270?n-=t/2:(e>270||e<90)&&(n-=t),n}function rk(n,t,e){const{left:i,top:s,right:o,bottom:r}=e,{backdropColor:l}=t;if(!it(l)){const c=en(t.borderRadius),d=Vt(t.backdropPadding);n.fillStyle=l;const u=i-d.left,h=s-d.top,f=o-i+d.width,m=r-s+d.height;Object.values(c).some(p=>p!==0)?(n.beginPath(),ai(n,{x:u,y:h,w:f,h:m,radius:c}),n.fill()):n.fillRect(u,h,f,m)}}function ak(n,t){const{ctx:e,options:{pointLabels:i}}=n;for(let s=t-1;s>=0;s--){const o=n._pointLabelItems[s];if(!o.visible)continue;const r=i.setContext(n.getPointLabelContext(s));rk(e,r,o);const l=vt(r.font),{x:c,y:d,textAlign:u}=o;tn(e,n._pointLabels[s],c,d+l.lineHeight/2,l,{color:r.color,textAlign:u,textBaseline:"middle"})}}function ld(n,t,e,i){const{ctx:s}=n;if(e)s.arc(n.xCenter,n.yCenter,t,0,pt);else{let o=n.getPointPosition(0,t);s.moveTo(o.x,o.y);for(let r=1;r<i;r++)o=n.getPointPosition(r,t),s.lineTo(o.x,o.y)}}function lk(n,t,e,i,s){const o=n.ctx,r=t.circular,{color:l,lineWidth:c}=t;!r&&!i||!l||!c||e<0||(o.save(),o.strokeStyle=l,o.lineWidth=c,o.setLineDash(s.dash||[]),o.lineDashOffset=s.dashOffset,o.beginPath(),ld(n,e,r,i),o.closePath(),o.stroke(),o.restore())}function ck(n,t,e){return je(n,{label:e,index:t,type:"pointLabel"})}class vn extends xs{constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){const t=this._padding=Vt(Wo(this.options)/2),e=this.width=this.maxWidth-t.width,i=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+e/2+t.left),this.yCenter=Math.floor(this.top+i/2+t.top),this.drawingArea=Math.floor(Math.min(e,i)/2)}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!1);this.min=St(t)&&!isNaN(t)?t:0,this.max=St(e)&&!isNaN(e)?e:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/Wo(this.options))}generateTickLabels(t){xs.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((e,i)=>{const s=ft(this.options.pointLabels.callback,[e,i],this);return s||s===0?s:""}).filter((e,i)=>this.chart.getDataVisibility(i))}fit(){const t=this.options;t.display&&t.pointLabels.display?Jx(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,i,s){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((i-s)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,i,s))}getIndexAngle(t){const e=pt/(this._pointLabels.length||1),i=this.options.startAngle||0;return Wt(t*e+ie(i))}getDistanceFromCenterForValue(t){if(it(t))return NaN;const e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(it(t))return NaN;const e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){const e=this._pointLabels||[];if(t>=0&&t<e.length){const i=e[t];return ck(this.getContext(),t,i)}}getPointPosition(t,e,i=0){const s=this.getIndexAngle(t)-wt+i;return{x:Math.cos(s)*e+this.xCenter,y:Math.sin(s)*e+this.yCenter,angle:s}}getPointPositionForValue(t,e){return this.getPointPosition(t,this.getDistanceFromCenterForValue(e))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}getPointLabelPosition(t){const{left:e,top:i,right:s,bottom:o}=this._pointLabelItems[t];return{left:e,top:i,right:s,bottom:o}}drawBackground(){const{backgroundColor:t,grid:{circular:e}}=this.options;if(t){const i=this.ctx;i.save(),i.beginPath(),ld(this,this.getDistanceFromCenterForValue(this._endValue),e,this._pointLabels.length),i.closePath(),i.fillStyle=t,i.fill(),i.restore()}}drawGrid(){const t=this.ctx,e=this.options,{angleLines:i,grid:s,border:o}=e,r=this._pointLabels.length;let l,c,d;if(e.pointLabels.display&&ak(this,r),s.display&&this.ticks.forEach((u,h)=>{if(h!==0||h===0&&this.min<0){c=this.getDistanceFromCenterForValue(u.value);const f=this.getContext(h),m=s.setContext(f),p=o.setContext(f);lk(this,m,c,r,p)}}),i.display){for(t.save(),l=r-1;l>=0;l--){const u=i.setContext(this.getPointLabelContext(l)),{color:h,lineWidth:f}=u;!f||!h||(t.lineWidth=f,t.strokeStyle=h,t.setLineDash(u.borderDash),t.lineDashOffset=u.borderDashOffset,c=this.getDistanceFromCenterForValue(e.reverse?this.min:this.max),d=this.getPointPosition(l,c),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(d.x,d.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,e=this.options,i=e.ticks;if(!i.display)return;const s=this.getIndexAngle(0);let o,r;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(s),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((l,c)=>{if(c===0&&this.min>=0&&!e.reverse)return;const d=i.setContext(this.getContext(c)),u=vt(d.font);if(o=this.getDistanceFromCenterForValue(this.ticks[c].value),d.showLabelBackdrop){t.font=u.string,r=t.measureText(l.label).width,t.fillStyle=d.backdropColor;const h=Vt(d.backdropPadding);t.fillRect(-r/2-h.left,-o-u.size/2-h.top,r+h.width,u.size+h.height)}tn(t,l.label,0,-o,u,{color:d.color,strokeColor:d.textStrokeColor,strokeWidth:d.textStrokeWidth})}),t.restore()}drawTitle(){}}L(vn,"id","radialLinear"),L(vn,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:oi.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}}),L(vn,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),L(vn,"descriptors",{angleLines:{_fallback:"grid"}});const ws={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},It=Object.keys(ws);function cd(n,t){return n-t}function dd(n,t){if(it(t))return null;const e=n._adapter,{parser:i,round:s,isoWeekday:o}=n._parseOpts;let r=t;return typeof i=="function"&&(r=i(r)),St(r)||(r=typeof i=="string"?e.parse(r,i):e.parse(r)),r===null?null:(s&&(r=s==="week"&&(_n(o)||o===!0)?e.startOf(r,"isoWeek",o):e.startOf(r,s)),+r)}function ud(n,t,e,i){const s=It.length;for(let o=It.indexOf(n);o<s-1;++o){const r=ws[It[o]],l=r.steps?r.steps:Number.MAX_SAFE_INTEGER;if(r.common&&Math.ceil((e-t)/(l*r.size))<=i)return It[o]}return It[s-1]}function dk(n,t,e,i,s){for(let o=It.length-1;o>=It.indexOf(e);o--){const r=It[o];if(ws[r].common&&n._adapter.diff(s,i,r)>=t-1)return r}return It[e?It.indexOf(e):0]}function uk(n){for(let t=It.indexOf(n)+1,e=It.length;t<e;++t)if(ws[It[t]].common)return It[t]}function hd(n,t,e){if(!e)n[t]=!0;else if(e.length){const{lo:i,hi:s}=lo(e,t),o=e[i]>=t?e[i]:e[s];n[o]=!0}}function hk(n,t,e,i){const s=n._adapter,o=+s.startOf(t[0].value,i),r=t[t.length-1].value;let l,c;for(l=o;l<=r;l=+s.add(l,1,i))c=e[l],c>=0&&(t[c].major=!0);return t}function fd(n,t,e){const i=[],s={},o=t.length;let r,l;for(r=0;r<o;++r)l=t[r],s[l]=r,i.push({value:l,major:!1});return o===0||!e?i:hk(n,i,s,e)}class On extends We{constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,e={}){const i=t.time||(t.time={}),s=this._adapter=new Hl._date(t.adapters.date);s.init(e),Zn(i.displayFormats,s.formats()),this._parseOpts={parser:i.parser,round:i.round,isoWeekday:i.isoWeekday},super.init(t),this._normalized=e.normalized}parse(t,e){return t===void 0?null:dd(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,e=this._adapter,i=t.time.unit||"day";let{min:s,max:o,minDefined:r,maxDefined:l}=this.getUserBounds();function c(d){!r&&!isNaN(d.min)&&(s=Math.min(s,d.min)),!l&&!isNaN(d.max)&&(o=Math.max(o,d.max))}(!r||!l)&&(c(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&c(this.getMinMax(!1))),s=St(s)&&!isNaN(s)?s:+e.startOf(Date.now(),i),o=St(o)&&!isNaN(o)?o:+e.endOf(Date.now(),i)+1,this.min=Math.min(s,o-1),this.max=Math.max(s+1,o)}_getLabelBounds(){const t=this.getLabelTimestamps();let e=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;return t.length&&(e=t[0],i=t[t.length-1]),{min:e,max:i}}buildTicks(){const t=this.options,e=t.time,i=t.ticks,s=i.source==="labels"?this.getLabelTimestamps():this._generate();t.bounds==="ticks"&&s.length&&(this.min=this._userMin||s[0],this.max=this._userMax||s[s.length-1]);const o=this.min,r=this.max,l=ab(s,o,r);return this._unit=e.unit||(i.autoSkip?ud(e.minUnit,this.min,this.max,this._getLabelCapacity(o)):dk(this,l.length,e.minUnit,this.min,this.max)),this._majorUnit=!i.major.enabled||this._unit==="year"?void 0:uk(this._unit),this.initOffsets(s),t.reverse&&l.reverse(),fd(this,l,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let e=0,i=0,s,o;this.options.offset&&t.length&&(s=this.getDecimalForValue(t[0]),t.length===1?e=1-s:e=(this.getDecimalForValue(t[1])-s)/2,o=this.getDecimalForValue(t[t.length-1]),t.length===1?i=o:i=(o-this.getDecimalForValue(t[t.length-2]))/2);const r=t.length<3?.5:.25;e=Dt(e,0,r),i=Dt(i,0,r),this._offsets={start:e,end:i,factor:1/(e+1+i)}}_generate(){const t=this._adapter,e=this.min,i=this.max,s=this.options,o=s.time,r=o.unit||ud(o.minUnit,e,i,this._getLabelCapacity(e)),l=Q(s.ticks.stepSize,1),c=r==="week"?o.isoWeekday:!1,d=_n(c)||c===!0,u={};let h=e,f,m;if(d&&(h=+t.startOf(h,"isoWeek",c)),h=+t.startOf(h,d?"day":r),t.diff(i,e,r)>1e5*l)throw new Error(e+" and "+i+" are too far apart with stepSize of "+l+" "+r);const p=s.ticks.source==="data"&&this.getDataTimestamps();for(f=h,m=0;f<i;f=+t.add(f,l,r),m++)hd(u,f,p);return(f===i||s.bounds==="ticks"||m===1)&&hd(u,f,p),Object.keys(u).sort(cd).map(g=>+g)}getLabelForValue(t){const e=this._adapter,i=this.options.time;return i.tooltipFormat?e.format(t,i.tooltipFormat):e.format(t,i.displayFormats.datetime)}format(t,e){const s=this.options.time.displayFormats,o=this._unit,r=e||s[o];return this._adapter.format(t,r)}_tickFormatFunction(t,e,i,s){const o=this.options,r=o.ticks.callback;if(r)return ft(r,[t,e,i],this);const l=o.time.displayFormats,c=this._unit,d=this._majorUnit,u=c&&l[c],h=d&&l[d],f=i[e],m=d&&h&&f&&f.major;return this._adapter.format(t,s||(m?h:u))}generateTickLabels(t){let e,i,s;for(e=0,i=t.length;e<i;++e)s=t[e],s.label=this._tickFormatFunction(s.value,e,t)}getDecimalForValue(t){return t===null?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const e=this._offsets,i=this.getDecimalForValue(t);return this.getPixelForDecimal((e.start+i)*e.factor)}getValueForPixel(t){const e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return this.min+i*(this.max-this.min)}_getLabelSize(t){const e=this.options.ticks,i=this.ctx.measureText(t).width,s=ie(this.isHorizontal()?e.maxRotation:e.minRotation),o=Math.cos(s),r=Math.sin(s),l=this._resolveTickFontOptions(0).size;return{w:i*o+l*r,h:i*r+l*o}}_getLabelCapacity(t){const e=this.options.time,i=e.displayFormats,s=i[e.unit]||i.millisecond,o=this._tickFormatFunction(t,0,fd(this,[t],this._majorUnit),s),r=this._getLabelSize(o),l=Math.floor(this.isHorizontal()?this.width/r.w:this.height/r.h)-1;return l>0?l:1}getDataTimestamps(){let t=this._cache.data||[],e,i;if(t.length)return t;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(e=0,i=s.length;e<i;++e)t=t.concat(s[e].controller.getAllParsedValues(this));return this._cache.data=this.normalize(t)}getLabelTimestamps(){const t=this._cache.labels||[];let e,i;if(t.length)return t;const s=this.getLabels();for(e=0,i=s.length;e<i;++e)t.push(dd(this,s[e]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return tl(t.sort(cd))}}L(On,"id","time"),L(On,"defaults",{bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}});function Es(n,t,e){let i=0,s=n.length-1,o,r,l,c;e?(t>=n[i].pos&&t<=n[s].pos&&({lo:i,hi:s}=Ee(n,"pos",t)),{pos:o,time:l}=n[i],{pos:r,time:c}=n[s]):(t>=n[i].time&&t<=n[s].time&&({lo:i,hi:s}=Ee(n,"time",t)),{time:o,pos:l}=n[i],{time:r,pos:c}=n[s]);const d=r-o;return d?l+(c-l)*(t-o)/d:l}class Cs extends On{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=Es(e,this.min),this._tableRange=Es(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:i}=this,s=[],o=[];let r,l,c,d,u;for(r=0,l=t.length;r<l;++r)d=t[r],d>=e&&d<=i&&s.push(d);if(s.length<2)return[{time:e,pos:0},{time:i,pos:1}];for(r=0,l=s.length;r<l;++r)u=s[r+1],c=s[r-1],d=s[r],Math.round((u+c)/2)!==d&&o.push({time:d,pos:r/(l-1)});return o}_generate(){const t=this.min,e=this.max;let i=super.getDataTimestamps();return(!i.includes(t)||!i.length)&&i.splice(0,0,t),(!i.includes(e)||i.length===1)&&i.push(e),i.sort((s,o)=>s-o)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const e=this.getDataTimestamps(),i=this.getLabelTimestamps();return e.length&&i.length?t=this.normalize(e.concat(i)):t=e.length?e:i,t=this._cache.all=t,t}getDecimalForValue(t){return(Es(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return Es(this._table,i*this._tableRange+this._minPos,!0)}}L(Cs,"id","timeseries"),L(Cs,"defaults",On.defaults);var md=Object.freeze({__proto__:null,CategoryScale:_s,LinearScale:ks,LogarithmicScale:Ss,RadialLinearScale:vn,TimeScale:On,TimeSeriesScale:Cs});const pd=[Wl,vc,nd,md];he.register(...pd);const fk=Object.freeze(Object.defineProperty({__proto__:null,Animation:Ml,Animations:So,ArcElement:Cn,BarController:di,BarElement:wi,BasePlatform:To,BasicPlatform:Jl,BubbleController:ui,CategoryScale:_s,Chart:he,Colors:Pc,DatasetController:Kt,Decimation:Ac,DomPlatform:ic,DoughnutController:ze,Element:Xt,Filler:zc,Interaction:ql,Legend:qc,LineController:hi,LineElement:ve,LinearScale:ks,LogarithmicScale:Ss,PieController:as,PointElement:Si,PolarAreaController:wn,RadarController:fi,RadialLinearScale:vn,Scale:We,ScatterController:mi,SubTitle:Kc,Ticks:oi,TimeScale:On,TimeSeriesScale:Cs,Title:Yc,Tooltip:ed,_adapters:Hl,_detectPlatform:sc,animator:ue,controllers:Wl,default:he,defaults:gt,elements:vc,layouts:Pt,plugins:nd,registerables:pd,registry:se,scales:md},Symbol.toStringTag,{value:"Module"}));Tt.default=bg,Tt.useEntitiesStore=zr,Tt.useGlobalConfigsStore=re,Object.defineProperties(Tt,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|