@indaco/garmin-personal-mcp 0.1.1 → 0.2.0
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/README.md +99 -93
- package/dist/dashboard.html +1 -1
- package/dist/index.js +2339 -481
- package/package.json +1 -1
- package/prompts/dashboard-setup.md +3 -3
- package/prompts/training-dashboard-freeform.md +4 -0
- package/prompts/training-dashboard.md +8 -0
package/dist/dashboard.html
CHANGED
|
@@ -75,6 +75,6 @@ function Mt(){}let Nt=(()=>{let e=0;return()=>e++})();function O(e){return e==nu
|
|
|
75
75
|
*/
|
|
76
76
|
var Ji=/* #__PURE__ */ new class{constructor(){this._request=null,this._charts=/* @__PURE__ */ new Map,this._running=!1,this._lastDate=void 0}_notify(e,t,n,r){let i=t.listeners[r],a=t.duration;i.forEach(r=>r({chart:e,initial:t.initial,numSteps:a,currentStep:Math.min(n-t.start,a)}))}_refresh(){this._request||=(this._running=!0,jn.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(e=Date.now()){let t=0;this._charts.forEach((n,r)=>{if(!n.running||!n.items.length)return;let i=n.items,a=i.length-1,o=!1,s;for(;a>=0;--a)s=i[a],s._active?(s._total>n.duration&&(n.duration=s._total),s.tick(e),o=!0):(i[a]=i[i.length-1],i.pop());o&&(r.draw(),this._notify(r,n,e,`progress`)),i.length||(n.running=!1,this._notify(r,n,e,`complete`),n.initial=!1),t+=i.length}),this._lastDate=e,t===0&&(this._running=!1)}_getAnims(e){let t=this._charts,n=t.get(e);return n||(n={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},t.set(e,n)),n}listen(e,t,n){this._getAnims(e).listeners[t].push(n)}add(e,t){t&&t.length&&this._getAnims(e).items.push(...t)}has(e){return this._getAnims(e).items.length>0}start(e){let t=this._charts.get(e);t&&(t.running=!0,t.start=Date.now(),t.duration=t.items.reduce((e,t)=>Math.max(e,t._duration),0),this._refresh())}running(e){if(!this._running)return!1;let t=this._charts.get(e);return!(!t||!t.running||!t.items.length)}stop(e){let t=this._charts.get(e);if(!t||!t.items.length)return;let n=t.items,r=n.length-1;for(;r>=0;--r)n[r].cancel();t.items=[],this._notify(e,t,Date.now(),`complete`)}remove(e){return this._charts.delete(e)}};let Yi=`transparent`,Xi={boolean(e,t,n){return n>.5?t:e},color(e,t,n){let r=Wn(e||Yi),i=r.valid&&Wn(t||Yi);return i&&i.valid?i.mix(r,n).hexString():t},number(e,t,n){return e+(t-e)*n}};var Zi=class{constructor(e,t,n,r){let i=t[n];r=jr([e.to,r,i,e.from]);let a=jr([e.from,i,r]);this._active=!0,this._fn=e.fn||Xi[e.type||typeof a],this._easing=Hn[e.easing]||Hn.linear,this._start=Math.floor(Date.now()+(e.delay||0)),this._duration=this._total=Math.floor(e.duration),this._loop=!!e.loop,this._target=t,this._prop=n,this._from=a,this._to=r,this._promises=void 0}active(){return this._active}update(e,t,n){if(this._active){this._notify(!1);let r=this._target[this._prop],i=n-this._start,a=this._duration-i;this._start=n,this._duration=Math.floor(Math.max(a,e.duration)),this._total+=i,this._loop=!!e.loop,this._to=jr([e.to,t,r,e.from]),this._from=jr([e.from,r,t])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(e){let t=e-this._start,n=this._duration,r=this._prop,i=this._from,a=this._loop,o=this._to,s;this._active=i!==o&&(a||t<n),this._active?t<0?this._target[r]=i:(s=t/n%2,s=a&&s>1?2-s:s,s=this._easing(Math.min(1,Math.max(0,s))),this._target[r]=this._fn(i,o,s)):(this._target[r]=o,this._notify(!0))}wait(){let e=this._promises||=[];return new Promise((t,n)=>{e.push({res:t,rej:n})})}_notify(e){let t=e?`res`:`rej`,n=this._promises||[];for(let e=0;e<n.length;e++)n[e][t]()}},Qi=class{constructor(e,t){this._chart=e,this._properties=/* @__PURE__ */ new Map,this.configure(t)}configure(e){if(!A(e))return;let t=Object.keys(B.animation),n=this._properties;Object.getOwnPropertyNames(e).forEach(r=>{let i=e[r];if(!A(i))return;let a={};for(let e of t)a[e]=i[e];(k(i.properties)&&i.properties||[r]).forEach(e=>{e!==r&&n.has(e)||n.set(e,a)})})}_animateOptions(e,t){let n=t.options,r=ea(e,n);if(!r)return[];let i=this._createAnimations(r,n);return n.$shared&&$i(e.options.$animations,n).then(()=>{e.options=n},()=>{}),i}_createAnimations(e,t){let n=this._properties,r=[],i=e.$animations||={},a=Object.keys(t),o=Date.now(),s;for(s=a.length-1;s>=0;--s){let c=a[s];if(c.charAt(0)===`$`)continue;if(c===`options`){r.push(...this._animateOptions(e,t));continue}let l=t[c],u=i[c],d=n.get(c);if(u){if(d&&u.active()){u.update(d,l,o);continue}u.cancel()}!d||!d.duration?e[c]=l:(i[c]=u=new Zi(d,e,c,l),r.push(u))}return r}update(e,t){if(this._properties.size===0){Object.assign(e,t);return}let n=this._createAnimations(e,t);if(n.length)return Ji.add(this._chart,n),!0}};function $i(e,t){let n=[],r=Object.keys(t);for(let t=0;t<r.length;t++){let i=e[r[t]];i&&i.active()&&n.push(i.wait())}return Promise.all(n)}function ea(e,t){if(!t)return;let n=e.options;if(!n)e.options=t;else return n.$shared&&(e.options=n=Object.assign({},n,{$shared:!1,$animations:{}})),n}function ta(e,t){let n=e&&e.options||{},r=n.reverse,i=n.min===void 0?t:0,a=n.max===void 0?t:0;return{start:r?a:i,end:r?i:a}}function na(e,t,n){if(n===!1)return!1;let r=ta(e,n),i=ta(t,n);return{top:i.end,right:r.end,bottom:i.start,left:r.start}}function ra(e){let t,n,r,i;return A(e)?(t=e.top,n=e.right,r=e.bottom,i=e.left):t=n=r=i=e,{top:t,right:n,bottom:r,left:i,disabled:e===!1}}function ia(e,t){let n=[],r=e._getSortedDatasetMetas(t),i,a;for(i=0,a=r.length;i<a;++i)n.push(r[i].index);return n}function aa(e,t,n,r={}){let i=e.keys,a=r.mode===`single`,o,s,c,l;if(t===null)return;let u=!1;for(o=0,s=i.length;o<s;++o){if(c=+i[o],c===n){if(u=!0,r.all)continue;break}l=e.values[c],j(l)&&(a||t===0||on(t)===on(l))&&(t+=l)}return!u&&!r.all?0:t}function oa(e,t){let{iScale:n,vScale:r}=t,i=n.axis===`x`?`x`:`y`,a=r.axis===`x`?`x`:`y`,o=Object.keys(e),s=Array(o.length),c,l,u;for(c=0,l=o.length;c<l;++c)u=o[c],s[c]={[i]:u,[a]:e[u]};return s}function sa(e,t){let n=e&&e.options.stacked;return n||n===void 0&&t.stack!==void 0}function ca(e,t,n){return`${e.id}.${t.id}.${n.stack||n.type}`}function la(e){let{min:t,max:n,minDefined:r,maxDefined:i}=e.getUserBounds();return{min:r?t:-1/0,max:i?n:1/0}}function ua(e,t,n){let r=e[t]||(e[t]={});return r[n]||(r[n]={})}function da(e,t,n,r){for(let i of t.getMatchingVisibleMetas(r).reverse()){let t=e[i.index];if(n&&t>0||!n&&t<0)return i.index}return null}function fa(e,t){let{chart:n,_cachedMeta:r}=e,i=n._stacks||={},{iScale:a,vScale:o,index:s}=r,c=a.axis,l=o.axis,u=ca(a,o,r),d=t.length,f;for(let e=0;e<d;++e){let n=t[e],{[c]:a,[l]:d}=n,p=n._stacks||={};f=p[l]=ua(i,u,a),f[s]=d,f._top=da(f,o,!0,r.type),f._bottom=da(f,o,!1,r.type);let m=f._visualValues||(f._visualValues={});m[s]=d}}function pa(e,t){let n=e.scales;return Object.keys(n).filter(e=>n[e].axis===t).shift()}function ma(e,t){return Nr(e,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:`default`,type:`dataset`})}function ha(e,t,n){return Nr(e,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:n,index:t,mode:`default`,type:`data`})}function ga(e,t){let n=e.controller.index,r=e.vScale&&e.vScale.axis;if(r){t||=e._parsed;for(let e of t){let t=e._stacks;t&&t[r]!==void 0&&t[r][n]!==void 0&&(delete t[r][n],t[r]._visualValues!==void 0&&t[r]._visualValues[n]!==void 0&&delete t[r]._visualValues[n])}}}let _a=e=>e===`reset`||e===`none`,va=(e,t)=>t?e:Object.assign({},e),ya=(e,t,n)=>e&&!t.hidden&&t._stacked&&{keys:ia(n,!0),values:null};var ba=class{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(e,t){this.chart=e,this._ctx=e.ctx,this.index=t,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(){let e=this._cachedMeta;this.configure(),this.linkScales(),e._stacked=sa(e.vScale,e),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(e){this.index!==e&&ga(this._cachedMeta),this.index=e}linkScales(){let e=this.chart,t=this._cachedMeta,n=this.getDataset(),r=(e,t,n,r)=>e===`x`?t:e===`r`?r:n,i=t.xAxisID=M(n.xAxisID,pa(e,`x`)),a=t.yAxisID=M(n.yAxisID,pa(e,`y`)),o=t.rAxisID=M(n.rAxisID,pa(e,`r`)),s=t.indexAxis,c=t.iAxisID=r(s,i,a,o),l=t.vAxisID=r(s,a,i,o);t.xScale=this.getScaleForId(i),t.yScale=this.getScaleForId(a),t.rScale=this.getScaleForId(o),t.iScale=this.getScaleForId(c),t.vScale=this.getScaleForId(l)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(e){return this.chart.scales[e]}_getOtherScale(e){let t=this._cachedMeta;return e===t.iScale?t.vScale:t.iScale}reset(){this._update(`reset`)}_destroy(){let e=this._cachedMeta;this._data&&kn(this._data,this),e._stacked&&ga(e)}_dataCheck(){let e=this.getDataset(),t=e.data||=[],n=this._data;if(A(t)){let e=this._cachedMeta;this._data=oa(t,e)}else if(n!==t){if(n){kn(n,this);let e=this._cachedMeta;ga(e),e._parsed=[]}t&&Object.isExtensible(t)&&On(t,this),this._syncList=[],this._data=t}}addElements(){let e=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(e.dataset=new this.datasetElementType)}buildOrUpdateElements(e){let t=this._cachedMeta,n=this.getDataset(),r=!1;this._dataCheck();let i=t._stacked;t._stacked=sa(t.vScale,t),t.stack!==n.stack&&(r=!0,ga(t),t.stack=n.stack),this._resyncElements(e),(r||i!==t._stacked)&&(fa(this,t._parsed),t._stacked=sa(t.vScale,t))}configure(){let e=this.chart.config,t=e.datasetScopeKeys(this._type),n=e.getOptionScopes(this.getDataset(),t,!0);this.options=e.createResolver(n,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(e,t){let{_cachedMeta:n,_data:r}=this,{iScale:i,_stacked:a}=n,o=i.axis,s=e===0&&t===r.length||n._sorted,c=e>0&&n._parsed[e-1],l,u,d;if(this._parsing===!1)n._parsed=r,n._sorted=!0,d=r;else{d=k(r[e])?this.parseArrayData(n,r,e,t):A(r[e])?this.parseObjectData(n,r,e,t):this.parsePrimitiveData(n,r,e,t);let i=()=>u[o]===null||c&&u[o]<c[o];for(l=0;l<t;++l)n._parsed[l+e]=u=d[l],s&&(i()&&(s=!1),c=u);n._sorted=s}a&&fa(this,d)}parsePrimitiveData(e,t,n,r){let{iScale:i,vScale:a}=e,o=i.axis,s=a.axis,c=i.getLabels(),l=i===a,u=Array(r),d,f,p;for(d=0,f=r;d<f;++d)p=d+n,u[d]={[o]:l||i.parse(c[p],p),[s]:a.parse(t[p],p)};return u}parseArrayData(e,t,n,r){let{xScale:i,yScale:a}=e,o=Array(r),s,c,l,u;for(s=0,c=r;s<c;++s)l=s+n,u=t[l],o[s]={x:i.parse(u[0],l),y:a.parse(u[1],l)};return o}parseObjectData(e,t,n,r){let{xScale:i,yScale:a}=e,{xAxisKey:o=`x`,yAxisKey:s=`y`}=this._parsing,c=Array(r),l,u,d,f;for(l=0,u=r;l<u;++l)d=l+n,f=t[d],c[l]={x:i.parse(qt(f,o),d),y:a.parse(qt(f,s),d)};return c}getParsed(e){return this._cachedMeta._parsed[e]}getDataElement(e){return this._cachedMeta.data[e]}applyStack(e,t,n){let r=this.chart,i=this._cachedMeta,a=t[e.axis];return aa({keys:ia(r,!0),values:t._stacks[e.axis]._visualValues},a,i.index,{mode:n})}updateRangeFromParsed(e,t,n,r){let i=n[t.axis],a=i===null?NaN:i,o=r&&n._stacks[t.axis];r&&o&&(r.values=o,a=aa(r,i,this._cachedMeta.index)),e.min=Math.min(e.min,a),e.max=Math.max(e.max,a)}getMinMax(e,t){let n=this._cachedMeta,r=n._parsed,i=n._sorted&&e===n.iScale,a=r.length,o=this._getOtherScale(e),s=ya(t,n,this.chart),c={min:1/0,max:-1/0},{min:l,max:u}=la(o),d,f;function p(){f=r[d];let t=f[o.axis];return!j(f[e.axis])||l>t||u<t}for(d=0;d<a&&!(!p()&&(this.updateRangeFromParsed(c,e,f,s),i));++d);if(i){for(d=a-1;d>=0;--d)if(!p()){this.updateRangeFromParsed(c,e,f,s);break}}return c}getAllParsedValues(e){let t=this._cachedMeta._parsed,n=[],r,i,a;for(r=0,i=t.length;r<i;++r)a=t[r][e.axis],j(a)&&n.push(a);return n}getMaxOverflow(){return!1}getLabelAndValue(e){let t=this._cachedMeta,n=t.iScale,r=t.vScale,i=this.getParsed(e);return{label:n?``+n.getLabelForValue(i[n.axis]):``,value:r?``+r.getLabelForValue(i[r.axis]):``}}_update(e){let t=this._cachedMeta;this.update(e||`default`),t._clip=ra(M(this.options.clip,na(t.xScale,t.yScale,this.getMaxOverflow())))}update(e){}draw(){let e=this._ctx,t=this.chart,n=this._cachedMeta,r=n.data||[],i=t.chartArea,a=[],o=this._drawStart||0,s=this._drawCount||r.length-o,c=this.options.drawActiveElementsOnTop,l;for(n.dataset&&n.dataset.draw(e,i,o,s),l=o;l<o+s;++l){let t=r[l];t.hidden||(t.active&&c?a.push(t):t.draw(e,i))}for(l=0;l<a.length;++l)a[l].draw(e,i)}getStyle(e,t){let n=t?`active`:`default`;return e===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(n):this.resolveDataElementOptions(e||0,n)}getContext(e,t,n){let r=this.getDataset(),i;if(e>=0&&e<this._cachedMeta.data.length){let t=this._cachedMeta.data[e];i=t.$context||=ha(this.getContext(),e,t),i.parsed=this.getParsed(e),i.raw=r.data[e],i.index=i.dataIndex=e}else i=this.$context||=ma(this.chart.getContext(),this.index),i.dataset=r,i.index=i.datasetIndex=this.index;return i.active=!!t,i.mode=n,i}resolveDatasetElementOptions(e){return this._resolveElementOptions(this.datasetElementType.id,e)}resolveDataElementOptions(e,t){return this._resolveElementOptions(this.dataElementType.id,t,e)}_resolveElementOptions(e,t=`default`,n){let r=t===`active`,i=this._cachedDataOpts,a=e+`-`+t,o=i[a],s=this.enableOptionSharing&&Yt(n);if(o)return va(o,s);let c=this.chart.config,l=c.datasetElementScopeKeys(this._type,e),u=r?[`${e}Hover`,`hover`,e,``]:[e,``],d=c.getOptionScopes(this.getDataset(),l),f=Object.keys(B.elements[e]),p=c.resolveNamedOptions(d,f,()=>this.getContext(n,r,t),u);return p.$shared&&(p.$shared=s,i[a]=Object.freeze(va(p,s))),p}_resolveAnimations(e,t,n){let r=this.chart,i=this._cachedDataOpts,a=`animation-${t}`,o=i[a];if(o)return o;let s;if(r.options.animation!==!1){let r=this.chart.config,i=r.datasetAnimationScopeKeys(this._type,t),a=r.getOptionScopes(this.getDataset(),i);s=r.createResolver(a,this.getContext(e,n,t))}let c=new Qi(r,s&&s.animations);return s&&s._cacheable&&(i[a]=Object.freeze(c)),c}getSharedOptions(e){if(e.$shared)return this._sharedOptions||=Object.assign({},e)}includeOptions(e,t){return!t||_a(e)||this.chart._animationsDisabled}_getSharedOptions(e,t){let n=this.resolveDataElementOptions(e,t),r=this._sharedOptions,i=this.getSharedOptions(n),a=this.includeOptions(t,i)||i!==r;return this.updateSharedOptions(i,t,n),{sharedOptions:i,includeOptions:a}}updateElement(e,t,n,r){_a(r)?Object.assign(e,n):this._resolveAnimations(t,r).update(e,n)}updateSharedOptions(e,t,n){e&&!_a(t)&&this._resolveAnimations(void 0,t).update(e,n)}_setStyle(e,t,n,r){e.active=r;let i=this.getStyle(t,r);this._resolveAnimations(t,n,r).update(e,{options:!r&&this.getSharedOptions(i)||i})}removeHoverStyle(e,t,n){this._setStyle(e,n,`active`,!1)}setHoverStyle(e,t,n){this._setStyle(e,n,`active`,!0)}_removeDatasetHoverStyle(){let e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,`active`,!1)}_setDatasetHoverStyle(){let e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,`active`,!0)}_resyncElements(e){let t=this._data,n=this._cachedMeta.data;for(let[e,t,n]of this._syncList)this[e](t,n);this._syncList=[];let r=n.length,i=t.length,a=Math.min(i,r);a&&this.parse(0,a),i>r?this._insertElements(r,i-r,e):i<r&&this._removeElements(i,r-i)}_insertElements(e,t,n=!0){let r=this._cachedMeta,i=r.data,a=e+t,o,s=e=>{for(e.length+=t,o=e.length-1;o>=a;o--)e[o]=e[o-t]};for(s(i),o=e;o<a;++o)i[o]=new this.dataElementType;this._parsing&&s(r._parsed),this.parse(e,t),n&&this.updateElements(i,e,t,`reset`)}updateElements(e,t,n,r){}_removeElements(e,t){let n=this._cachedMeta;if(this._parsing){let r=n._parsed.splice(e,t);n._stacked&&ga(n,r)}n.data.splice(e,t)}_sync(e){if(this._parsing)this._syncList.push(e);else{let[t,n,r]=e;this[t](n,r)}this.chart._dataChanges.push([this.index,...e])}_onDataPush(){let e=arguments.length;this._sync([`_insertElements`,this.getDataset().data.length-e,e])}_onDataPop(){this._sync([`_removeElements`,this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync([`_removeElements`,0,1])}_onDataSplice(e,t){t&&this._sync([`_removeElements`,e,t]);let n=arguments.length-2;n&&this._sync([`_insertElements`,e,n])}_onDataUnshift(){this._sync([`_insertElements`,0,arguments.length])}};function xa(e,t){if(!e._cache.$bar){let n=e.getMatchingVisibleMetas(t),r=[];for(let t=0,i=n.length;t<i;t++)r=r.concat(n[t].controller.getAllParsedValues(e));e._cache.$bar=An(r.sort((e,t)=>e-t))}return e._cache.$bar}function Sa(e){let t=e.iScale,n=xa(t,e.type),r=t._length,i,a,o,s,c=()=>{o!==32767&&o!==-32768&&(Yt(s)&&(r=Math.min(r,Math.abs(o-s)||r)),s=o)};for(i=0,a=n.length;i<a;++i)o=t.getPixelForValue(n[i]),c();for(s=void 0,i=0,a=t.ticks.length;i<a;++i)o=t.getPixelForTick(i),c();return r}function Ca(e,t,n,r){let i=n.barThickness,a,o;return O(i)?(a=t.min*n.categoryPercentage,o=n.barPercentage):(a=i*r,o=1),{chunk:a/r,ratio:o,start:t.pixels[e]-a/2}}function wa(e,t,n,r){let i=t.pixels,a=i[e],o=e>0?i[e-1]:null,s=e<i.length-1?i[e+1]:null,c=n.categoryPercentage;o===null&&(o=a-(s===null?t.end-t.start:s-a)),s===null&&(s=a+a-o);let l=a-(a-Math.min(o,s))/2*c;return{chunk:Math.abs(s-o)/2*c/r,ratio:n.barPercentage,start:l}}function Ta(e,t,n,r){let i=n.parse(e[0],r),a=n.parse(e[1],r),o=Math.min(i,a),s=Math.max(i,a),c=o,l=s;Math.abs(o)>Math.abs(s)&&(c=s,l=o),t[n.axis]=l,t._custom={barStart:c,barEnd:l,start:i,end:a,min:o,max:s}}function Ea(e,t,n,r){return k(e)?Ta(e,t,n,r):t[n.axis]=n.parse(e,r),t}function Da(e,t,n,r){let i=e.iScale,a=e.vScale,o=i.getLabels(),s=i===a,c=[],l,u,d,f;for(l=n,u=n+r;l<u;++l)f=t[l],d={},d[i.axis]=s||i.parse(o[l],l),c.push(Ea(f,d,a,l));return c}function Oa(e){return e&&e.barStart!==void 0&&e.barEnd!==void 0}function ka(e,t,n){return e===0?(t.isHorizontal()?1:-1)*(t.min>=n?1:-1):on(e)}function Aa(e){let t,n,r,i,a;return e.horizontal?(t=e.base>e.x,n=`left`,r=`right`):(t=e.base<e.y,n=`bottom`,r=`top`),t?(i=`end`,a=`start`):(i=`start`,a=`end`),{start:n,end:r,reverse:t,top:i,bottom:a}}function ja(e,t,n,r){let i=t.borderSkipped,a={};if(!i){e.borderSkipped=a;return}if(i===!0){e.borderSkipped={top:!0,right:!0,bottom:!0,left:!0};return}let{start:o,end:s,reverse:c,top:l,bottom:u}=Aa(e);i===`middle`&&n&&(e.enableBorderRadius=!0,(n._top||0)===r?i=l:(n._bottom||0)===r?i=u:(a[Ma(u,o,s,c)]=!0,i=l)),a[Ma(i,o,s,c)]=!0,e.borderSkipped=a}function Ma(e,t,n,r){return r?(e=Na(e,t,n),e=Pa(e,n,t)):e=Pa(e,t,n),e}function Na(e,t,n){return e===t?n:e===n?t:e}function Pa(e,t,n){return e===`start`?t:e===`end`?n:e}function Fa(e,{inflateAmount:t},n){e.inflateAmount=t===`auto`?n===1?.33:0:t}var Ia=class extends ba{static id=`bar`;static defaults={datasetElementType:!1,dataElementType:`bar`,categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:`number`,properties:[`x`,`y`,`base`,`width`,`height`]}}};static overrides={scales:{_index_:{type:`category`,offset:!0,grid:{offset:!0}},_value_:{type:`linear`,beginAtZero:!0}}};parsePrimitiveData(e,t,n,r){return Da(e,t,n,r)}parseArrayData(e,t,n,r){return Da(e,t,n,r)}parseObjectData(e,t,n,r){let{iScale:i,vScale:a}=e,{xAxisKey:o=`x`,yAxisKey:s=`y`}=this._parsing,c=i.axis===`x`?o:s,l=a.axis===`x`?o:s,u=[],d,f,p,m;for(d=n,f=n+r;d<f;++d)m=t[d],p={},p[i.axis]=i.parse(qt(m,c),d),u.push(Ea(qt(m,l),p,a,d));return u}updateRangeFromParsed(e,t,n,r){super.updateRangeFromParsed(e,t,n,r);let i=n._custom;i&&t===this._cachedMeta.vScale&&(e.min=Math.min(e.min,i.min),e.max=Math.max(e.max,i.max))}getMaxOverflow(){return 0}getLabelAndValue(e){let{iScale:t,vScale:n}=this._cachedMeta,r=this.getParsed(e),i=r._custom,a=Oa(i)?`[`+i.start+`, `+i.end+`]`:``+n.getLabelForValue(r[n.axis]);return{label:``+t.getLabelForValue(r[t.axis]),value:a}}initialize(){this.enableOptionSharing=!0,super.initialize();let e=this._cachedMeta;e.stack=this.getDataset().stack}update(e){let t=this._cachedMeta;this.updateElements(t.data,0,t.data.length,e)}updateElements(e,t,n,r){let i=r===`reset`,{index:a,_cachedMeta:{vScale:o}}=this,s=o.getBasePixel(),c=o.isHorizontal(),l=this._getRuler(),{sharedOptions:u,includeOptions:d}=this._getSharedOptions(t,r);for(let f=t;f<t+n;f++){let t=this.getParsed(f),n=i||O(t[o.axis])?{base:s,head:s}:this._calculateBarValuePixels(f),p=this._calculateBarIndexPixels(f,l),m=(t._stacks||{})[o.axis],h={horizontal:c,base:n.base,enableBorderRadius:!m||Oa(t._custom)||a===m._top||a===m._bottom,x:c?n.head:p.center,y:c?p.center:n.head,height:c?p.size:Math.abs(n.size),width:c?Math.abs(n.size):p.size};d&&(h.options=u||this.resolveDataElementOptions(f,e[f].active?`active`:r));let g=h.options||e[f].options;ja(h,g,m,a),Fa(h,g,l.ratio),this.updateElement(e[f],f,h,r)}}_getStacks(e,t){let{iScale:n}=this._cachedMeta,r=n.getMatchingVisibleMetas(this._type).filter(e=>e.controller.options.grouped),i=n.options.stacked,a=[],o=this._cachedMeta.controller.getParsed(t),s=o&&o[n.axis],c=e=>{let t=e._parsed.find(e=>e[n.axis]===s),r=t&&t[e.vScale.axis];if(O(r)||isNaN(r))return!0};for(let n of r)if(!(t!==void 0&&c(n))&&((i===!1||a.indexOf(n.stack)===-1||i===void 0&&n.stack===void 0)&&a.push(n.stack),n.index===e))break;return a.length||a.push(void 0),a}_getStackCount(e){return this._getStacks(void 0,e).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){let e=this.chart.scales,t=this.chart.options.indexAxis;return Object.keys(e).filter(n=>e[n].axis===t).shift()}_getAxis(){let e={},t=this.getFirstScaleIdForIndexAxis();for(let n of this.chart.data.datasets)e[M(this.chart.options.indexAxis===`x`?n.xAxisID:n.yAxisID,t)]=!0;return Object.keys(e)}_getStackIndex(e,t,n){let r=this._getStacks(e,n),i=t===void 0?-1:r.indexOf(t);return i===-1?r.length-1:i}_getRuler(){let e=this.options,t=this._cachedMeta,n=t.iScale,r=[],i,a;for(i=0,a=t.data.length;i<a;++i)r.push(n.getPixelForValue(this.getParsed(i)[n.axis],i));let o=e.barThickness;return{min:o||Sa(t),pixels:r,start:n._startPixel,end:n._endPixel,stackCount:this._getStackCount(),scale:n,grouped:e.grouped,ratio:o?1:e.categoryPercentage*e.barPercentage}}_calculateBarValuePixels(e){let{_cachedMeta:{vScale:t,_stacked:n,index:r},options:{base:i,minBarLength:a}}=this,o=i||0,s=this.getParsed(e),c=s._custom,l=Oa(c),u=s[t.axis],d=0,f=n?this.applyStack(t,s,n):u,p,m;f!==u&&(d=f-u,f=u),l&&(u=c.barStart,f=c.barEnd-c.barStart,u!==0&&on(u)!==on(c.barEnd)&&(d=0),d+=u);let h=!O(i)&&!l?i:d,g=t.getPixelForValue(h);if(p=this.chart.getDataVisibility(e)?t.getPixelForValue(d+f):g,m=p-g,Math.abs(m)<a){m=ka(m,t,o)*a,u===o&&(g-=m/2);let e=t.getPixelForDecimal(0),i=t.getPixelForDecimal(1);g=Math.max(Math.min(g,Math.max(e,i)),Math.min(e,i)),p=g+m,n&&!l&&(s._stacks[t.axis]._visualValues[r]=t.getValueForPixel(p)-t.getValueForPixel(g))}if(g===t.getPixelForValue(o)){let e=on(m)*t.getLineWidthForValue(o)/2;g+=e,m-=e}return{size:m,base:g,head:p,center:p+m/2}}_calculateBarIndexPixels(e,t){let n=t.scale,r=this.options,i=r.skipNull,a=M(r.maxBarThickness,1/0),o,s,c=this._getAxisCount();if(t.grouped){let n=i?this._getStackCount(e):t.stackCount,l=r.barThickness===`flex`?wa(e,t,r,n*c):Ca(e,t,r,n*c),u=this.chart.options.indexAxis===`x`?this.getDataset().xAxisID:this.getDataset().yAxisID,d=this._getAxis().indexOf(M(u,this.getFirstScaleIdForIndexAxis())),f=this._getStackIndex(this.index,this._cachedMeta.stack,i?e:void 0)+d;o=l.start+l.chunk*f+l.chunk/2,s=Math.min(a,l.chunk*l.ratio)}else o=n.getPixelForValue(this.getParsed(e)[n.axis],e),s=Math.min(a,t.min*t.ratio);return{base:o-s/2,head:o+s/2,center:o,size:s}}draw(){let e=this._cachedMeta,t=e.vScale,n=e.data,r=n.length,i=0;for(;i<r;++i)this.getParsed(i)[t.axis]!==null&&!n[i].hidden&&n[i].draw(this._ctx)}};function La(e,t,n){let r=1,i=1,a=0,o=0;if(t<I){let s=e,c=s+t,l=Math.cos(s),u=Math.sin(s),d=Math.cos(c),f=Math.sin(c),p=(e,t,r)=>bn(e,s,c,!0)?1:Math.max(t,t*n,r,r*n),m=(e,t,r)=>bn(e,s,c,!0)?-1:Math.min(t,t*n,r,r*n),h=p(0,l,d),g=p(L,u,f),_=m(F,l,d),v=m(F+L,u,f);r=(h-_)/2,i=(g-v)/2,a=-(h+_)/2,o=-(g+v)/2}return{ratioX:r,ratioY:i,offsetX:a,offsetY:o}}var Ra=class extends ba{static id=`doughnut`;static 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,spacingMode:`angular`,indexAxis:`r`};static descriptors={_scriptable:e=>e!==`spacing`&&e!==`spacingMode`,_indexable:e=>e!==`spacing`&&e!==`spacingMode`&&!e.startsWith(`borderDash`)&&!e.startsWith(`hoverBorderDash`)};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(e){let t=e.data,{labels:{pointStyle:n,textAlign:r,color:i,useBorderRadius:a,borderRadius:o}}=e.legend.options;return t.labels.length&&t.datasets.length?t.labels.map((t,s)=>{let c=e.getDatasetMeta(0).controller.getStyle(s);return{text:t,fillStyle:c.backgroundColor,fontColor:i,hidden:!e.getDataVisibility(s),lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:c.borderWidth,strokeStyle:c.borderColor,textAlign:r,pointStyle:n,borderRadius:a&&(o||c.borderRadius),index:s}}):[]}},onClick(e,t,n){n.chart.toggleDataVisibility(t.index),n.chart.update()}}}};constructor(e,t){super(e,t),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(e,t){let n=this.getDataset().data,r=this._cachedMeta;if(this._parsing===!1)r._parsed=n;else{let i=e=>+n[e];if(A(n[e])){let{key:e=`value`}=this._parsing;i=t=>+qt(n[t],e)}let a,o;for(a=e,o=e+t;a<o;++a)r._parsed[a]=i(a)}}_getRotation(){return mn(this.options.rotation-90)}_getCircumference(){return mn(this.options.circumference)}_getRotationExtents(){let e=I,t=-I;for(let n=0;n<this.chart.data.datasets.length;++n)if(this.chart.isDatasetVisible(n)&&this.chart.getDatasetMeta(n).type===this._type){let r=this.chart.getDatasetMeta(n).controller,i=r._getRotation(),a=r._getCircumference();e=Math.min(e,i),t=Math.max(t,i+a)}return{rotation:e,circumference:t-e}}update(e){let{chartArea:t}=this.chart,n=this._cachedMeta,r=n.data,i=this.getMaxBorderWidth()+this.getMaxOffset(r)+this.options.spacing,a=Math.max((Math.min(t.width,t.height)-i)/2,0),o=Math.min(Ft(this.options.cutout,a),1),s=this._getRingWeight(this.index),{circumference:c,rotation:l}=this._getRotationExtents(),{ratioX:u,ratioY:d,offsetX:f,offsetY:p}=La(l,c,o),m=(t.width-i)/u,h=(t.height-i)/d,g=Math.max(Math.min(m,h)/2,0),_=It(this.options.radius,g),v=(_-Math.max(_*o,0))/this._getVisibleDatasetWeightTotal();this.offsetX=f*_,this.offsetY=p*_,n.total=this.calculateTotal(),this.outerRadius=_-v*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-v*s,0),this.updateElements(r,0,r.length,e)}_circumference(e,t){let n=this.options,r=this._cachedMeta,i=this._getCircumference();return t&&n.animation.animateRotate||!this.chart.getDataVisibility(e)||r._parsed[e]===null||r.data[e].hidden?0:this.calculateCircumference(r._parsed[e]*i/I)}updateElements(e,t,n,r){let i=r===`reset`,a=this.chart,o=a.chartArea,s=a.options.animation,c=(o.left+o.right)/2,l=(o.top+o.bottom)/2,u=i&&s.animateScale,d=u?0:this.innerRadius,f=u?0:this.outerRadius,{sharedOptions:p,includeOptions:m}=this._getSharedOptions(t,r),h=this._getRotation(),g=0;for(;g<t;++g)h+=this._circumference(g,i);for(g=t;g<t+n;++g){let t=this._circumference(g,i),n=e[g],a={x:c+this.offsetX,y:l+this.offsetY,startAngle:h,endAngle:h+t,circumference:t,outerRadius:f,innerRadius:d};m&&(a.options=p||this.resolveDataElementOptions(g,n.active?`active`:r)),h+=t,this.updateElement(n,g,a,r)}}calculateTotal(){let e=this._cachedMeta,t=e.data,n=0,r=0;for(;r<t.length;r++){let i=e._parsed[r];i!==null&&!isNaN(i)&&this.chart.getDataVisibility(r)&&!t[r].hidden&&(n+=Math.abs(i))}return n}calculateCircumference(e){let t=this._cachedMeta.total;return t>0&&!isNaN(e)?Math.abs(e)/t*I:0}getLabelAndValue(e){let t=this._cachedMeta,n=this.chart,r=n.data.labels||[],i=Qn(t._parsed[e],n.options.locale);return{label:r[e]||``,value:i}}getMaxBorderWidth(e){let t=0,n=this.chart,r,i,a,o,s;if(!e){for(r=0,i=n.data.datasets.length;r<i;++r)if(n.isDatasetVisible(r)){a=n.getDatasetMeta(r),e=a.data,o=a.controller;break}}if(!e)return 0;for(r=0,i=e.length;r<i;++r)s=o.resolveDataElementOptions(r),s.borderAlign!==`inner`&&(t=Math.max(t,s.borderWidth||0,s.hoverBorderWidth||0));return t}getMaxOffset(e){let t=0;for(let n=0,r=e.length;n<r;++n){let e=this.resolveDataElementOptions(n);t=Math.max(t,e.offset||0,e.hoverOffset||0)}return t}_getRingWeightOffset(e){let t=0;for(let n=0;n<e;++n)this.chart.isDatasetVisible(n)&&(t+=this._getRingWeight(n));return t}_getRingWeight(e){return Math.max(M(this.chart.data.datasets[e].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}},za=class extends ba{static id=`line`;static defaults={datasetElementType:`line`,dataElementType:`point`,showLine:!0,spanGaps:!1};static overrides={scales:{_index_:{type:`category`},_value_:{type:`linear`}}};initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(e){let t=this._cachedMeta,{dataset:n,data:r=[],_dataset:i}=t,a=this.chart._animationsDisabled,{start:o,count:s}=Ln(t,r,a);this._drawStart=o,this._drawCount=s,Rn(t)&&(o=0,s=r.length),n._chart=this.chart,n._datasetIndex=this.index,n._decimated=!!i._decimated,n.points=r;let c=this.resolveDatasetElementOptions(e);this.options.showLine||(c.borderWidth=0),c.segment=this.options.segment,this.updateElement(n,void 0,{animated:!a,options:c},e),this.updateElements(r,o,s,e)}updateElements(e,t,n,r){let i=r===`reset`,{iScale:a,vScale:o,_stacked:s,_dataset:c}=this._cachedMeta,{sharedOptions:l,includeOptions:u}=this._getSharedOptions(t,r),d=a.axis,f=o.axis,{spanGaps:p,segment:m}=this.options,h=dn(p)?p:1/0,g=this.chart._animationsDisabled||i||r===`none`,_=t+n,v=e.length,y=t>0&&this.getParsed(t-1);for(let n=0;n<v;++n){let p=e[n],v=g?p:{};if(n<t||n>=_){v.skip=!0;continue}let b=this.getParsed(n),x=O(b[f]),S=v[d]=a.getPixelForValue(b[d],n),C=v[f]=i||x?o.getBasePixel():o.getPixelForValue(s?this.applyStack(o,b,s):b[f],n);v.skip=isNaN(S)||isNaN(C)||x,v.stop=n>0&&Math.abs(b[d]-y[d])>h,m&&(v.parsed=b,v.raw=c.data[n]),u&&(v.options=l||this.resolveDataElementOptions(n,p.active?`active`:r)),g||this.updateElement(p,n,v,r),y=b}}getMaxOverflow(){let e=this._cachedMeta,t=e.dataset,n=t.options&&t.options.borderWidth||0,r=e.data||[];if(!r.length)return n;let i=r[0].size(this.resolveDataElementOptions(0)),a=r[r.length-1].size(this.resolveDataElementOptions(r.length-1));return Math.max(n,i,a)/2}draw(){let e=this._cachedMeta;e.dataset.updateControlPoints(this.chart.chartArea,e.iScale.axis),super.draw()}},Ba=class extends Ra{static id=`pie`;static defaults={cutout:0,rotation:0,circumference:360,radius:`100%`}},Va=class extends ba{static id=`scatter`;static defaults={datasetElementType:!1,dataElementType:`point`,showLine:!1,fill:!1};static overrides={interaction:{mode:`point`},scales:{x:{type:`linear`},y:{type:`linear`}}};getLabelAndValue(e){let t=this._cachedMeta,n=this.chart.data.labels||[],{xScale:r,yScale:i}=t,a=this.getParsed(e),o=r.getLabelForValue(a.x),s=i.getLabelForValue(a.y);return{label:n[e]||``,value:`(`+o+`, `+s+`)`}}update(e){let t=this._cachedMeta,{data:n=[]}=t,r=this.chart._animationsDisabled,{start:i,count:a}=Ln(t,n,r);if(this._drawStart=i,this._drawCount=a,Rn(t)&&(i=0,a=n.length),this.options.showLine){this.datasetElementType||this.addElements();let{dataset:i,_dataset:a}=t;i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!a._decimated,i.points=n;let o=this.resolveDatasetElementOptions(e);o.segment=this.options.segment,this.updateElement(i,void 0,{animated:!r,options:o},e)}else this.datasetElementType&&=(delete t.dataset,!1);this.updateElements(n,i,a,e)}addElements(){let{showLine:e}=this.options;!this.datasetElementType&&e&&(this.datasetElementType=this.chart.registry.getElement(`line`)),super.addElements()}updateElements(e,t,n,r){let i=r===`reset`,{iScale:a,vScale:o,_stacked:s,_dataset:c}=this._cachedMeta,l=this.resolveDataElementOptions(t,r),u=this.getSharedOptions(l),d=this.includeOptions(r,u),f=a.axis,p=o.axis,{spanGaps:m,segment:h}=this.options,g=dn(m)?m:1/0,_=this.chart._animationsDisabled||i||r===`none`,v=t>0&&this.getParsed(t-1);for(let l=t;l<t+n;++l){let t=e[l],n=this.getParsed(l),m=_?t:{},y=O(n[p]),b=m[f]=a.getPixelForValue(n[f],l),x=m[p]=i||y?o.getBasePixel():o.getPixelForValue(s?this.applyStack(o,n,s):n[p],l);m.skip=isNaN(b)||isNaN(x)||y,m.stop=l>0&&Math.abs(n[f]-v[f])>g,h&&(m.parsed=n,m.raw=c.data[l]),d&&(m.options=u||this.resolveDataElementOptions(l,t.active?`active`:r)),_||this.updateElement(t,l,m,r),v=n}this.updateSharedOptions(u,r,l)}getMaxOverflow(){let e=this._cachedMeta,t=e.data||[];if(!this.options.showLine){let e=0;for(let n=t.length-1;n>=0;--n)e=Math.max(e,t[n].size(this.resolveDataElementOptions(n))/2);return e>0&&e}let n=e.dataset,r=n.options&&n.options.borderWidth||0;if(!t.length)return r;let i=t[0].size(this.resolveDataElementOptions(0)),a=t[t.length-1].size(this.resolveDataElementOptions(t.length-1));return Math.max(r,i,a)/2}};function Ha(){throw Error(`This method is not implemented: Check that a complete date adapter is provided.`)}var Ua={_date:class e{static override(t){Object.assign(e.prototype,t)}options;constructor(e){this.options=e||{}}init(){}formats(){return Ha()}parse(){return Ha()}format(){return Ha()}add(){return Ha()}diff(){return Ha()}startOf(){return Ha()}endOf(){return Ha()}}};function Wa(e,t,n,r){let{controller:i,data:a,_sorted:o}=e,s=i._cachedMeta.iScale,c=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null;if(s&&t===s.axis&&t!==`r`&&o&&a.length){let o=s._reversePixels?Tn:wn;if(!r){let r=o(a,t,n);if(c){let{vScale:t}=i._cachedMeta,{_parsed:n}=e,a=n.slice(0,r.lo+1).reverse().findIndex(e=>!O(e[t.axis]));r.lo-=Math.max(0,a);let o=n.slice(r.hi).findIndex(e=>!O(e[t.axis]));r.hi+=Math.max(0,o)}return r}if(i._sharedOptions){let e=a[0],r=typeof e.getRange==`function`&&e.getRange(t);if(r){let e=o(a,t,n-r),i=o(a,t,n+r);return{lo:e.lo,hi:i.hi}}}}return{lo:0,hi:a.length-1}}function Ga(e,t,n,r,i){let a=e.getSortedVisibleDatasetMetas(),o=n[t];for(let e=0,n=a.length;e<n;++e){let{index:n,data:s}=a[e],{lo:c,hi:l}=Wa(a[e],t,o,i);for(let e=c;e<=l;++e){let t=s[e];t.skip||r(t,n,e)}}}function Ka(e){let t=e.indexOf(`x`)!==-1,n=e.indexOf(`y`)!==-1;return function(e,r){let i=t?Math.abs(e.x-r.x):0,a=n?Math.abs(e.y-r.y):0;return Math.sqrt(i**2+a**2)}}function qa(e,t,n,r,i){let a=[];return!i&&!e.isPointInArea(t)||Ga(e,n,t,function(n,o,s){(i||mr(n,e.chartArea,0))&&n.inRange(t.x,t.y,r)&&a.push({element:n,datasetIndex:o,index:s})},!0),a}function Ja(e,t,n,r){let i=[];function a(e,n,a){let{startAngle:o,endAngle:s}=e.getProps([`startAngle`,`endAngle`],r),{angle:c}=_n(e,{x:t.x,y:t.y});bn(c,o,s)&&i.push({element:e,datasetIndex:n,index:a})}return Ga(e,n,t,a),i}function Ya(e,t,n,r,i,a){let o=[],s=Ka(n),c=1/0;function l(n,l,u){let d=n.inRange(t.x,t.y,i);if(r&&!d)return;let f=n.getCenterPoint(i);if(!(a||e.isPointInArea(f))&&!d)return;let p=s(t,f);p<c?(o=[{element:n,datasetIndex:l,index:u}],c=p):p===c&&o.push({element:n,datasetIndex:l,index:u})}return Ga(e,n,t,l),o}function Xa(e,t,n,r,i,a){return!a&&!e.isPointInArea(t)?[]:n===`r`&&!r?Ja(e,t,n,i):Ya(e,t,n,r,i,a)}function Za(e,t,n,r,i){let a=[],o=n===`x`?`inXRange`:`inYRange`,s=!1;return Ga(e,n,t,(e,r,c)=>{e[o]&&e[o](t[n],i)&&(a.push({element:e,datasetIndex:r,index:c}),s||=e.inRange(t.x,t.y,i))}),r&&!s?[]:a}var Qa={evaluateInteractionItems:Ga,modes:{index(e,t,n,r){let i=vi(t,e),a=n.axis||`x`,o=n.includeInvisible||!1,s=n.intersect?qa(e,i,a,r,o):Xa(e,i,a,!1,r,o),c=[];return s.length?(e.getSortedVisibleDatasetMetas().forEach(e=>{let t=s[0].index,n=e.data[t];n&&!n.skip&&c.push({element:n,datasetIndex:e.index,index:t})}),c):[]},dataset(e,t,n,r){let i=vi(t,e),a=n.axis||`xy`,o=n.includeInvisible||!1,s=n.intersect?qa(e,i,a,r,o):Xa(e,i,a,!1,r,o);if(s.length>0){let t=s[0].datasetIndex,n=e.getDatasetMeta(t).data;s=[];for(let e=0;e<n.length;++e)s.push({element:n[e],datasetIndex:t,index:e})}return s},point(e,t,n,r){return qa(e,vi(t,e),n.axis||`xy`,r,n.includeInvisible||!1)},nearest(e,t,n,r){let i=vi(t,e),a=n.axis||`xy`,o=n.includeInvisible||!1;return Xa(e,i,a,n.intersect,r,o)},x(e,t,n,r){return Za(e,vi(t,e),`x`,n.intersect,r)},y(e,t,n,r){return Za(e,vi(t,e),`y`,n.intersect,r)}}};let $a=[`left`,`top`,`right`,`bottom`];function eo(e,t){return e.filter(e=>e.pos===t)}function to(e,t){return e.filter(e=>$a.indexOf(e.pos)===-1&&e.box.axis===t)}function no(e,t){return e.sort((e,n)=>{let r=t?n:e,i=t?e:n;return r.weight===i.weight?r.index-i.index:r.weight-i.weight})}function ro(e){let t=[],n,r,i,a,o,s;for(n=0,r=(e||[]).length;n<r;++n)i=e[n],{position:a,options:{stack:o,stackWeight:s=1}}=i,t.push({index:n,box:i,pos:a,horizontal:i.isHorizontal(),weight:i.weight,stack:o&&a+o,stackWeight:s});return t}function io(e){let t={};for(let n of e){let{stack:e,pos:r,stackWeight:i}=n;if(!e||!$a.includes(r))continue;let a=t[e]||(t[e]={count:0,placed:0,weight:0,size:0});a.count++,a.weight+=i}return t}function ao(e,t){let n=io(e),{vBoxMaxWidth:r,hBoxMaxHeight:i}=t,a,o,s;for(a=0,o=e.length;a<o;++a){s=e[a];let{fullSize:o}=s.box,c=n[s.stack],l=c&&s.stackWeight/c.weight;s.horizontal?(s.width=l?l*r:o&&t.availableWidth,s.height=i):(s.width=r,s.height=l?l*i:o&&t.availableHeight)}return n}function oo(e){let t=ro(e),n=no(t.filter(e=>e.box.fullSize),!0),r=no(eo(t,`left`),!0),i=no(eo(t,`right`)),a=no(eo(t,`top`),!0),o=no(eo(t,`bottom`)),s=to(t,`x`),c=to(t,`y`);return{fullSize:n,leftAndTop:r.concat(a),rightAndBottom:i.concat(c).concat(o).concat(s),chartArea:eo(t,`chartArea`),vertical:r.concat(i).concat(c),horizontal:a.concat(o).concat(s)}}function so(e,t,n,r){return Math.max(e[n],t[n])+Math.max(e[r],t[r])}function co(e,t){e.top=Math.max(e.top,t.top),e.left=Math.max(e.left,t.left),e.bottom=Math.max(e.bottom,t.bottom),e.right=Math.max(e.right,t.right)}function lo(e,t,n,r){let{pos:i,box:a}=n,o=e.maxPadding;if(!A(i)){n.size&&(e[i]-=n.size);let t=r[n.stack]||{size:0,count:1};t.size=Math.max(t.size,n.horizontal?a.height:a.width),n.size=t.size/t.count,e[i]+=n.size}a.getPadding&&co(o,a.getPadding());let s=Math.max(0,t.outerWidth-so(o,e,`left`,`right`)),c=Math.max(0,t.outerHeight-so(o,e,`top`,`bottom`)),l=s!==e.w,u=c!==e.h;return e.w=s,e.h=c,n.horizontal?{same:l,other:u}:{same:u,other:l}}function uo(e){let t=e.maxPadding;function n(n){let r=Math.max(t[n]-e[n],0);return e[n]+=r,r}e.y+=n(`top`),e.x+=n(`left`),n(`right`),n(`bottom`)}function fo(e,t){let n=t.maxPadding;function r(e){let r={left:0,top:0,right:0,bottom:0};return e.forEach(e=>{r[e]=Math.max(t[e],n[e])}),r}return r(e?[`left`,`right`]:[`top`,`bottom`])}function po(e,t,n,r){let i=[],a,o,s,c,l,u;for(a=0,o=e.length,l=0;a<o;++a){s=e[a],c=s.box,c.update(s.width||t.w,s.height||t.h,fo(s.horizontal,t));let{same:o,other:d}=lo(t,n,s,r);l|=o&&i.length,u||=d,c.fullSize||i.push(s)}return l&&po(i,t,n,r)||u}function mo(e,t,n,r,i){e.top=n,e.left=t,e.right=t+r,e.bottom=n+i,e.width=r,e.height=i}function ho(e,t,n,r){let i=n.padding,{x:a,y:o}=t;for(let s of e){let e=s.box,c=r[s.stack]||{count:1,placed:0,weight:1},l=s.stackWeight/c.weight||1;if(s.horizontal){let r=t.w*l,a=c.size||e.height;Yt(c.start)&&(o=c.start),e.fullSize?mo(e,i.left,o,n.outerWidth-i.right-i.left,a):mo(e,t.left+c.placed,o,r,a),c.start=o,c.placed+=r,o=e.bottom}else{let r=t.h*l,o=c.size||e.width;Yt(c.start)&&(a=c.start),e.fullSize?mo(e,a,i.top,o,n.outerHeight-i.bottom-i.top):mo(e,a,t.top+c.placed,o,r),c.start=a,c.placed+=r,a=e.right}}t.x=a,t.y=o}var go={addBox(e,t){e.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)}}]},e.boxes.push(t)},removeBox(e,t){let n=e.boxes?e.boxes.indexOf(t):-1;n!==-1&&e.boxes.splice(n,1)},configure(e,t,n){t.fullSize=n.fullSize,t.position=n.position,t.weight=n.weight},update(e,t,n,r){if(!e)return;let i=V(e.options.layout.padding),a=Math.max(t-i.width,0),o=Math.max(n-i.height,0),s=oo(e.boxes),c=s.vertical,l=s.horizontal;P(e.boxes,e=>{typeof e.beforeLayout==`function`&&e.beforeLayout()});let u=c.reduce((e,t)=>t.box.options&&t.box.options.display===!1?e:e+1,0)||1,d=Object.freeze({outerWidth:t,outerHeight:n,padding:i,availableWidth:a,availableHeight:o,vBoxMaxWidth:a/2/u,hBoxMaxHeight:o/2}),f=Object.assign({},i);co(f,V(r));let p=Object.assign({maxPadding:f,w:a,h:o,x:i.left,y:i.top},i),m=ao(c.concat(l),d);po(s.fullSize,p,d,m),po(c,p,d,m),po(l,p,d,m)&&po(c,p,d,m),uo(p),ho(s.leftAndTop,p,d,m),p.x+=p.w,p.y+=p.h,ho(s.rightAndBottom,p,d,m),e.chartArea={left:p.left,top:p.top,right:p.left+p.w,bottom:p.top+p.h,height:p.h,width:p.w},P(s.chartArea,t=>{let n=t.box;Object.assign(n,e.chartArea),n.update(p.w,p.h,{left:0,top:0,right:0,bottom:0})})}},_o=class{acquireContext(e,t){}releaseContext(e){return!1}addEventListener(e,t,n){}removeEventListener(e,t,n){}getDevicePixelRatio(){return 1}getMaximumSize(e,t,n,r){return t=Math.max(0,t||e.width),n||=e.height,{width:t,height:Math.max(0,r?Math.floor(t/r):n)}}isAttached(e){return!0}updateConfig(e){}},vo=class extends _o{acquireContext(e){return e&&e.getContext&&e.getContext(`2d`)||null}updateConfig(e){e.options.animation=!1}};let yo=`$chartjs`,bo={touchstart:`mousedown`,touchmove:`mousemove`,touchend:`mouseup`,pointerenter:`mouseenter`,pointerdown:`mousedown`,pointermove:`mousemove`,pointerup:`mouseup`,pointerleave:`mouseout`,pointerout:`mouseout`},xo=e=>e===null||e===``;function So(e,t){let n=e.style,r=e.getAttribute(`height`),i=e.getAttribute(`width`);if(e[yo]={initial:{height:r,width:i,style:{display:n.display,height:n.height,width:n.width}}},n.display=n.display||`block`,n.boxSizing=n.boxSizing||`border-box`,xo(i)){let t=wi(e,`width`);t!==void 0&&(e.width=t)}if(xo(r)){if(e.style.height===``)e.height=e.width/(t||2);else{let t=wi(e,`height`);t!==void 0&&(e.height=t)}}return e}let Co=Ci?{passive:!0}:!1;function wo(e,t,n){e&&e.addEventListener(t,n,Co)}function To(e,t,n){e&&e.canvas&&e.canvas.removeEventListener(t,n,Co)}function Eo(e,t){let n=bo[e.type]||e.type,{x:r,y:i}=vi(e,t);return{type:n,chart:t,native:e,x:r===void 0?null:r,y:i===void 0?null:i}}function Do(e,t){for(let n of e)if(n===t||n.contains(t))return!0}function Oo(e,t,n){let r=e.canvas,i=new MutationObserver(e=>{let t=!1;for(let n of e)t||=Do(n.addedNodes,r),t&&=!Do(n.removedNodes,r);t&&n()});return i.observe(document,{childList:!0,subtree:!0}),i}function ko(e,t,n){let r=e.canvas,i=new MutationObserver(e=>{let t=!1;for(let n of e)t||=Do(n.removedNodes,r),t&&=!Do(n.addedNodes,r);t&&n()});return i.observe(document,{childList:!0,subtree:!0}),i}let Ao=/* @__PURE__ */ new Map,jo=0;function Mo(){let e=window.devicePixelRatio;e!==jo&&(jo=e,Ao.forEach((t,n)=>{n.currentDevicePixelRatio!==e&&t()}))}function No(e,t){Ao.size||window.addEventListener(`resize`,Mo),Ao.set(e,t)}function Po(e){Ao.delete(e),Ao.size||window.removeEventListener(`resize`,Mo)}function Fo(e,t,n){let r=e.canvas,i=r&&ui(r);if(!i)return;let a=Mn((e,t)=>{let r=i.clientWidth;n(e,t),r<i.clientWidth&&n()},window),o=new ResizeObserver(e=>{let t=e[0],n=t.contentRect.width,r=t.contentRect.height;(n!==0||r!==0)&&a(n,r)});return o.observe(i),No(e,a),o}function Io(e,t,n){n&&n.disconnect(),t===`resize`&&Po(e)}function Lo(e,t,n){let r=e.canvas,i=Mn(t=>{e.ctx!==null&&n(Eo(t,e))},e);return wo(r,t,i),i}var Ro=class extends _o{acquireContext(e,t){let n=e&&e.getContext&&e.getContext(`2d`);return n&&n.canvas===e?(So(e,t),n):null}releaseContext(e){let t=e.canvas;if(!t[yo])return!1;let n=t[yo].initial;[`height`,`width`].forEach(e=>{let r=n[e];O(r)?t.removeAttribute(e):t.setAttribute(e,r)});let r=n.style||{};return Object.keys(r).forEach(e=>{t.style[e]=r[e]}),t.width=t.width,delete t[yo],!0}addEventListener(e,t,n){this.removeEventListener(e,t);let r=e.$proxies||={};r[t]=({attach:Oo,detach:ko,resize:Fo}[t]||Lo)(e,t,n)}removeEventListener(e,t){let n=e.$proxies||={},r=n[t];r&&(({attach:Io,detach:Io,resize:Io}[t]||To)(e,t,r),n[t]=void 0)}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(e,t,n,r){return xi(e,t,n,r)}isAttached(e){let t=e&&ui(e);return!!(t&&t.isConnected)}};function zo(e){return!li()||typeof OffscreenCanvas<`u`&&e instanceof OffscreenCanvas?vo:Ro}var Bo=class{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(e){let{x:t,y:n}=this.getProps([`x`,`y`],e);return{x:t,y:n}}hasValue(){return dn(this.x)&&dn(this.y)}getProps(e,t){let n=this.$animations;if(!t||!n)return this;let r={};return e.forEach(e=>{r[e]=n[e]&&n[e].active()?n[e]._to:this[e]}),r}};function Vo(e,t){let n=e.options.ticks,r=Ho(e),i=Math.min(n.maxTicksLimit||r,r),a=n.major.enabled?Wo(t):[],o=a.length,s=a[0],c=a[o-1],l=[];if(o>i)return Go(t,l,a,o/i),l;let u=Uo(a,t,i);if(o>0){let e,n,r=o>1?Math.round((c-s)/(o-1)):null;for(Ko(t,l,u,O(r)?0:s-r,s),e=0,n=o-1;e<n;e++)Ko(t,l,u,a[e],a[e+1]);return Ko(t,l,u,c,O(r)?t.length:c+r),l}return Ko(t,l,u),l}function Ho(e){let t=e.options.offset,n=e._tickSize(),r=e._length/n+ +!t,i=e._maxLength/n;return Math.floor(Math.min(r,i))}function Uo(e,t,n){let r=qo(e),i=t.length/n;if(!r)return Math.max(i,1);let a=ln(r);for(let e=0,t=a.length-1;e<t;e++){let t=a[e];if(t>i)return t}return Math.max(i,1)}function Wo(e){let t=[],n,r;for(n=0,r=e.length;n<r;n++)e[n].major&&t.push(n);return t}function Go(e,t,n,r){let i=0,a=n[0],o;for(r=Math.ceil(r),o=0;o<e.length;o++)o===a&&(t.push(e[o]),i++,a=n[i*r])}function Ko(e,t,n,r,i){let a=M(r,0),o=Math.min(M(i,e.length),e.length),s=0,c,l,u;for(n=Math.ceil(n),i&&(c=i-r,n=c/Math.floor(c/n)),u=a;u<0;)s++,u=Math.round(a+s*n);for(l=Math.max(a,0);l<o;l++)l===u&&(t.push(e[l]),s++,u=Math.round(a+s*n))}function qo(e){let t=e.length,n,r;if(t<2)return!1;for(r=e[0],n=1;n<t;++n)if(e[n]-e[n-1]!==r)return!1;return r}let Jo=e=>e===`left`?`right`:e===`right`?`left`:e,Yo=(e,t,n)=>t===`top`||t===`left`?e[t]+n:e[t]-n,Xo=(e,t)=>Math.min(t||e,e);function Zo(e,t){let n=[],r=e.length/t,i=e.length,a=0;for(;a<i;a+=r)n.push(e[Math.floor(a)]);return n}function Qo(e,t,n){let r=e.ticks.length,i=Math.min(t,r-1),a=e._startPixel,o=e._endPixel,s=1e-6,c=e.getPixelForTick(i),l;if(!(n&&(l=r===1?Math.max(c-a,o-c):t===0?(e.getPixelForTick(1)-c)/2:(c-e.getPixelForTick(i-1))/2,c+=i<t?l:-l,c<a-s||c>o+s)))return c}function $o(e,t){P(e,e=>{let n=e.gc,r=n.length/2,i;if(r>t){for(i=0;i<r;++i)delete e.data[n[i]];n.splice(0,r)}})}function es(e){return e.drawTicks?e.tickLength:0}function ts(e,t){if(!e.display)return 0;let n=H(e.font,t),r=V(e.padding);return(k(e.text)?e.text.length:1)*n.lineHeight+r.height}function ns(e,t){return Nr(e,{scale:t,type:`scale`})}function rs(e,t,n){return Nr(e,{tick:n,index:t,type:`tick`})}function is(e,t,n){let r=Pn(e);return(n&&t!==`right`||!n&&t===`right`)&&(r=Jo(r)),r}function as(e,t,n,r){let{top:i,left:a,bottom:o,right:s,chart:c}=e,{chartArea:l,scales:u}=c,d=0,f,p,m,h=o-i,g=s-a;if(e.isHorizontal()){if(p=Fn(r,a,s),A(n)){let e=Object.keys(n)[0],r=n[e];m=u[e].getPixelForValue(r)+h-t}else m=n===`center`?(l.bottom+l.top)/2+h-t:Yo(e,n,t);f=s-a}else{if(A(n)){let e=Object.keys(n)[0],r=n[e];p=u[e].getPixelForValue(r)-g+t}else p=n===`center`?(l.left+l.right)/2-g+t:Yo(e,n,t);m=Fn(r,o,i),d=n===`left`?-L:L}return{titleX:p,titleY:m,maxWidth:f,rotation:d}}var os=class e extends Bo{constructor(e){super(),this.id=e.id,this.type=e.type,this.options=void 0,this.ctx=e.ctx,this.chart=e.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(e){this.options=e.setContext(this.getContext()),this.axis=e.axis,this._userMin=this.parse(e.min),this._userMax=this.parse(e.max),this._suggestedMin=this.parse(e.suggestedMin),this._suggestedMax=this.parse(e.suggestedMax)}parse(e,t){return e}getUserBounds(){let{_userMin:e,_userMax:t,_suggestedMin:n,_suggestedMax:r}=this;return e=Pt(e,1/0),t=Pt(t,-1/0),n=Pt(n,1/0),r=Pt(r,-1/0),{min:Pt(e,n),max:Pt(t,r),minDefined:j(e),maxDefined:j(t)}}getMinMax(e){let{min:t,max:n,minDefined:r,maxDefined:i}=this.getUserBounds(),a;if(r&&i)return{min:t,max:n};let o=this.getMatchingVisibleMetas();for(let s=0,c=o.length;s<c;++s)a=o[s].controller.getMinMax(this,e),r||(t=Math.min(t,a.min)),i||(n=Math.max(n,a.max));return t=i&&t>n?n:t,n=r&&t>n?t:n,{min:Pt(t,Pt(n,t)),max:Pt(n,Pt(t,n))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){let e=this.chart.data;return this.options.labels||(this.isHorizontal()?e.xLabels:e.yLabels)||e.labels||[]}getLabelItems(e=this.chart.chartArea){return this._labelItems||=this._computeLabelItems(e)}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){N(this.options.beforeUpdate,[this])}update(e,t,n){let{beginAtZero:r,grace:i,ticks:a}=this.options,o=a.sampleSize;this.beforeUpdate(),this.maxWidth=e,this.maxHeight=t,this._margins=n=Object.assign({left:0,right:0,top:0,bottom:0},n),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+n.left+n.right:this.height+n.top+n.bottom,this._dataLimitsCached||=(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=Mr(this,i,r),!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();let s=o<this.ticks.length;this._convertTicksToLabels(s?Zo(this.ticks,o):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),a.display&&(a.autoSkip||a.source===`auto`)&&(this.ticks=Vo(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),s&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let e=this.options.reverse,t,n;this.isHorizontal()?(t=this.left,n=this.right):(t=this.top,n=this.bottom,e=!e),this._startPixel=t,this._endPixel=n,this._reversePixels=e,this._length=n-t,this._alignToPixels=this.options.alignToPixels}afterUpdate(){N(this.options.afterUpdate,[this])}beforeSetDimensions(){N(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(){N(this.options.afterSetDimensions,[this])}_callHooks(e){this.chart.notifyPlugins(e,this.getContext()),N(this.options[e],[this])}beforeDataLimits(){this._callHooks(`beforeDataLimits`)}determineDataLimits(){}afterDataLimits(){this._callHooks(`afterDataLimits`)}beforeBuildTicks(){this._callHooks(`beforeBuildTicks`)}buildTicks(){return[]}afterBuildTicks(){this._callHooks(`afterBuildTicks`)}beforeTickToLabelConversion(){N(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(e){let t=this.options.ticks,n,r,i;for(n=0,r=e.length;n<r;n++)i=e[n],i.label=N(t.callback,[i.value,n,e],this)}afterTickToLabelConversion(){N(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){N(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){let e=this.options,t=e.ticks,n=Xo(this.ticks.length,e.ticks.maxTicksLimit),r=t.minRotation||0,i=t.maxRotation,a=r,o,s,c;if(!this._isVisible()||!t.display||r>=i||n<=1||!this.isHorizontal()){this.labelRotation=r;return}let l=this._getLabelSizes(),u=l.widest.width,d=l.highest.height,f=z(this.chart.width-u,0,this.maxWidth);o=e.offset?this.maxWidth/n:f/(n-1),u+6>o&&(o=f/(n-(e.offset?.5:1)),s=this.maxHeight-es(e.grid)-t.padding-ts(e.title,this.chart.options.font),c=Math.sqrt(u*u+d*d),a=hn(Math.min(Math.asin(z((l.highest.height+6)/o,-1,1)),Math.asin(z(s/c,-1,1))-Math.asin(z(d/c,-1,1)))),a=Math.max(r,Math.min(i,a))),this.labelRotation=a}afterCalculateLabelRotation(){N(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){N(this.options.beforeFit,[this])}fit(){let e={width:0,height:0},{chart:t,options:{ticks:n,title:r,grid:i}}=this,a=this._isVisible(),o=this.isHorizontal();if(a){let a=ts(r,t.options.font);if(o?(e.width=this.maxWidth,e.height=es(i)+a):(e.height=this.maxHeight,e.width=es(i)+a),n.display&&this.ticks.length){let{first:t,last:r,widest:i,highest:a}=this._getLabelSizes(),s=n.padding*2,c=mn(this.labelRotation),l=Math.cos(c),u=Math.sin(c);if(o){let t=n.mirror?0:u*i.width+l*a.height;e.height=Math.min(this.maxHeight,e.height+t+s)}else{let t=n.mirror?0:l*i.width+u*a.height;e.width=Math.min(this.maxWidth,e.width+t+s)}this._calculatePadding(t,r,u,l)}}this._handleMargins(),o?(this.width=this._length=t.width-this._margins.left-this._margins.right,this.height=e.height):(this.width=e.width,this.height=this._length=t.height-this._margins.top-this._margins.bottom)}_calculatePadding(e,t,n,r){let{ticks:{align:i,padding:a},position:o}=this.options,s=this.labelRotation!==0,c=o!==`top`&&this.axis===`x`;if(this.isHorizontal()){let o=this.getPixelForTick(0)-this.left,l=this.right-this.getPixelForTick(this.ticks.length-1),u=0,d=0;s?c?(u=r*e.width,d=n*t.height):(u=n*e.height,d=r*t.width):i===`start`?d=t.width:i===`end`?u=e.width:i!==`inner`&&(u=e.width/2,d=t.width/2),this.paddingLeft=Math.max((u-o+a)*this.width/(this.width-o),0),this.paddingRight=Math.max((d-l+a)*this.width/(this.width-l),0)}else{let n=t.height/2,r=e.height/2;i===`start`?(n=0,r=e.height):i===`end`&&(n=t.height,r=0),this.paddingTop=n+a,this.paddingBottom=r+a}}_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(){N(this.options.afterFit,[this])}isHorizontal(){let{axis:e,position:t}=this.options;return t===`top`||t===`bottom`||e===`x`}isFullSize(){return this.options.fullSize}_convertTicksToLabels(e){this.beforeTickToLabelConversion(),this.generateTickLabels(e);let t,n;for(t=0,n=e.length;t<n;t++)O(e[t].label)&&(e.splice(t,1),n--,t--);this.afterTickToLabelConversion()}_getLabelSizes(){let e=this._labelSizes;if(!e){let t=this.options.ticks.sampleSize,n=this.ticks;t<n.length&&(n=Zo(n,t)),this._labelSizes=e=this._computeLabelSizes(n,n.length,this.options.ticks.maxTicksLimit)}return e}_computeLabelSizes(e,t,n){let{ctx:r,_longestTextCache:i}=this,a=[],o=[],s=Math.floor(t/Xo(t,n)),c=0,l=0,u,d,f,p,m,h,g,_,v,y,b;for(u=0;u<t;u+=s){if(p=e[u].label,m=this._resolveTickFontOptions(u),r.font=h=m.string,g=i[h]=i[h]||{data:{},gc:[]},_=m.lineHeight,v=y=0,!O(p)&&!k(p))v=cr(r,g.data,g.gc,v,p),y=_;else if(k(p))for(d=0,f=p.length;d<f;++d)b=p[d],!O(b)&&!k(b)&&(v=cr(r,g.data,g.gc,v,b),y+=_);a.push(v),o.push(y),c=Math.max(v,c),l=Math.max(y,l)}$o(i,t);let x=a.indexOf(c),S=o.indexOf(l),C=e=>({width:a[e]||0,height:o[e]||0});return{first:C(0),last:C(t-1),widest:C(x),highest:C(S),widths:a,heights:o}}getLabelForValue(e){return e}getPixelForValue(e,t){return NaN}getValueForPixel(e){}getPixelForTick(e){let t=this.ticks;return e<0||e>t.length-1?null:this.getPixelForValue(t[e].value)}getPixelForDecimal(e){this._reversePixels&&(e=1-e);let t=this._startPixel+e*this._length;return xn(this._alignToPixels?ur(this.chart,t,0):t)}getDecimalForPixel(e){let t=(e-this._startPixel)/this._length;return this._reversePixels?1-t:t}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){let{min:e,max:t}=this;return e<0&&t<0?t:e>0&&t>0?e:0}getContext(e){let t=this.ticks||[];if(e>=0&&e<t.length){let n=t[e];return n.$context||=rs(this.getContext(),e,n)}return this.$context||=ns(this.chart.getContext(),this)}_tickSize(){let e=this.options.ticks,t=mn(this.labelRotation),n=Math.abs(Math.cos(t)),r=Math.abs(Math.sin(t)),i=this._getLabelSizes(),a=e.autoSkipPadding||0,o=i?i.widest.width+a:0,s=i?i.highest.height+a:0;return this.isHorizontal()?s*n>o*r?o/n:s/r:s*r<o*n?s/n:o/r}_isVisible(){let e=this.options.display;return e===`auto`?this.getMatchingVisibleMetas().length>0:!!e}_computeGridLineItems(e){let t=this.axis,n=this.chart,r=this.options,{grid:i,position:a,border:o}=r,s=i.offset,c=this.isHorizontal(),l=this.ticks.length+ +!!s,u=es(i),d=[],f=o.setContext(this.getContext()),p=f.display?f.width:0,m=p/2,h=function(e){return ur(n,e,p)},g,_,v,y,b,x,S,C,w,T,E,D;if(a===`top`)g=h(this.bottom),x=this.bottom-u,C=g-m,T=h(e.top)+m,D=e.bottom;else if(a===`bottom`)g=h(this.top),T=e.top,D=h(e.bottom)-m,x=g+m,C=this.top+u;else if(a===`left`)g=h(this.right),b=this.right-u,S=g-m,w=h(e.left)+m,E=e.right;else if(a===`right`)g=h(this.left),w=e.left,E=h(e.right)-m,b=g+m,S=this.left+u;else if(t===`x`){if(a===`center`)g=h((e.top+e.bottom)/2+.5);else if(A(a)){let e=Object.keys(a)[0],t=a[e];g=h(this.chart.scales[e].getPixelForValue(t))}T=e.top,D=e.bottom,x=g+m,C=x+u}else if(t===`y`){if(a===`center`)g=h((e.left+e.right)/2);else if(A(a)){let e=Object.keys(a)[0],t=a[e];g=h(this.chart.scales[e].getPixelForValue(t))}b=g-m,S=b-u,w=e.left,E=e.right}let ee=M(r.ticks.maxTicksLimit,l),te=Math.max(1,Math.ceil(l/ee));for(_=0;_<l;_+=te){let e=this.getContext(_),t=i.setContext(e),r=o.setContext(e),a=t.lineWidth,l=t.color,u=r.dash||[],f=r.dashOffset,p=t.tickWidth,m=t.tickColor,h=t.tickBorderDash||[],g=t.tickBorderDashOffset;v=Qo(this,_,s),v!==void 0&&(y=ur(n,v,a),c?b=S=w=E=y:x=C=T=D=y,d.push({tx1:b,ty1:x,tx2:S,ty2:C,x1:w,y1:T,x2:E,y2:D,width:a,color:l,borderDash:u,borderDashOffset:f,tickWidth:p,tickColor:m,tickBorderDash:h,tickBorderDashOffset:g}))}return this._ticksLength=l,this._borderValue=g,d}_computeLabelItems(e){let t=this.axis,n=this.options,{position:r,ticks:i}=n,a=this.isHorizontal(),o=this.ticks,{align:s,crossAlign:c,padding:l,mirror:u}=i,d=es(n.grid),f=d+l,p=u?-l:f,m=-mn(this.labelRotation),h=[],g,_,v,y,b,x,S,C,w,T,E,D,ee=`middle`;if(r===`top`)x=this.bottom-p,S=this._getXAxisLabelAlignment();else if(r===`bottom`)x=this.top+p,S=this._getXAxisLabelAlignment();else if(r===`left`){let e=this._getYAxisLabelAlignment(d);S=e.textAlign,b=e.x}else if(r===`right`){let e=this._getYAxisLabelAlignment(d);S=e.textAlign,b=e.x}else if(t===`x`){if(r===`center`)x=(e.top+e.bottom)/2+f;else if(A(r)){let e=Object.keys(r)[0],t=r[e];x=this.chart.scales[e].getPixelForValue(t)+f}S=this._getXAxisLabelAlignment()}else if(t===`y`){if(r===`center`)b=(e.left+e.right)/2-f;else if(A(r)){let e=Object.keys(r)[0],t=r[e];b=this.chart.scales[e].getPixelForValue(t)}S=this._getYAxisLabelAlignment(d).textAlign}t===`y`&&(s===`start`?ee=`top`:s===`end`&&(ee=`bottom`));let te=this._getLabelSizes();for(g=0,_=o.length;g<_;++g){v=o[g],y=v.label;let e=i.setContext(this.getContext(g));C=this.getPixelForTick(g)+i.labelOffset,w=this._resolveTickFontOptions(g),T=w.lineHeight,E=k(y)?y.length:1;let t=E/2,n=e.color,s=e.textStrokeColor,l=e.textStrokeWidth,d=S;a?(b=C,S===`inner`&&(d=g===_-1?this.options.reverse?`left`:`right`:g===0?this.options.reverse?`right`:`left`:`center`),D=r===`top`?c===`near`||m!==0?-E*T+T/2:c===`center`?-te.highest.height/2-t*T+T:-te.highest.height+T/2:c===`near`||m!==0?T/2:c===`center`?te.highest.height/2-t*T:te.highest.height-E*T,u&&(D*=-1),m!==0&&!e.showLabelBackdrop&&(b+=T/2*Math.sin(m))):(x=C,D=(1-E)*T/2);let f;if(e.showLabelBackdrop){let t=V(e.backdropPadding),n=te.heights[g],r=te.widths[g],i=D-t.top,a=0-t.left;switch(ee){case`middle`:i-=n/2;break;case`bottom`:i-=n}switch(S){case`center`:a-=r/2;break;case`right`:a-=r;break;case`inner`:g===_-1?a-=r:g>0&&(a-=r/2)}f={left:a,top:i,width:r+t.width,height:n+t.height,color:e.backdropColor}}h.push({label:y,font:w,textOffset:D,options:{rotation:m,color:n,strokeColor:s,strokeWidth:l,textAlign:d,textBaseline:ee,translation:[b,x],backdrop:f}})}return h}_getXAxisLabelAlignment(){let{position:e,ticks:t}=this.options;if(-mn(this.labelRotation))return e===`top`?`left`:`right`;let n=`center`;return t.align===`start`?n=`left`:t.align===`end`?n=`right`:t.align===`inner`&&(n=`inner`),n}_getYAxisLabelAlignment(e){let{position:t,ticks:{crossAlign:n,mirror:r,padding:i}}=this.options,a=this._getLabelSizes(),o=e+i,s=a.widest.width,c,l;return t===`left`?r?(l=this.right+i,n===`near`?c=`left`:n===`center`?(c=`center`,l+=s/2):(c=`right`,l+=s)):(l=this.right-o,n===`near`?c=`right`:n===`center`?(c=`center`,l-=s/2):(c=`left`,l=this.left)):t===`right`?r?(l=this.left+i,n===`near`?c=`right`:n===`center`?(c=`center`,l-=s/2):(c=`left`,l-=s)):(l=this.left+o,n===`near`?c=`left`:n===`center`?(c=`center`,l+=s/2):(c=`right`,l=this.right)):c=`right`,{textAlign:c,x:l}}_computeLabelArea(){if(this.options.ticks.mirror)return;let e=this.chart,t=this.options.position;if(t===`left`||t===`right`)return{top:0,left:this.left,bottom:e.height,right:this.right};if(t===`top`||t===`bottom`)return{top:this.top,left:0,bottom:this.bottom,right:e.width}}drawBackground(){let{ctx:e,options:{backgroundColor:t},left:n,top:r,width:i,height:a}=this;t&&(e.save(),e.fillStyle=t,e.fillRect(n,r,i,a),e.restore())}getLineWidthForValue(e){let t=this.options.grid;if(!this._isVisible()||!t.display)return 0;let n=this.ticks.findIndex(t=>t.value===e);return n>=0?t.setContext(this.getContext(n)).lineWidth:0}drawGrid(e){let t=this.options.grid,n=this.ctx,r=this._gridLineItems||=this._computeGridLineItems(e),i,a,o=(e,t,r)=>{r.width&&r.color&&(n.save(),n.lineWidth=r.width,n.strokeStyle=r.color,n.setLineDash(r.borderDash||[]),n.lineDashOffset=r.borderDashOffset,n.beginPath(),n.moveTo(e.x,e.y),n.lineTo(t.x,t.y),n.stroke(),n.restore())};if(t.display)for(i=0,a=r.length;i<a;++i){let e=r[i];t.drawOnChartArea&&o({x:e.x1,y:e.y1},{x:e.x2,y:e.y2},e),t.drawTicks&&o({x:e.tx1,y:e.ty1},{x:e.tx2,y:e.ty2},{color:e.tickColor,width:e.tickWidth,borderDash:e.tickBorderDash,borderDashOffset:e.tickBorderDashOffset})}}drawBorder(){let{chart:e,ctx:t,options:{border:n,grid:r}}=this,i=n.setContext(this.getContext()),a=n.display?i.width:0;if(!a)return;let o=r.setContext(this.getContext(0)).lineWidth,s=this._borderValue,c,l,u,d;this.isHorizontal()?(c=ur(e,this.left,a)-a/2,l=ur(e,this.right,o)+o/2,u=d=s):(u=ur(e,this.top,a)-a/2,d=ur(e,this.bottom,o)+o/2,c=l=s),t.save(),t.lineWidth=i.width,t.strokeStyle=i.color,t.beginPath(),t.moveTo(c,u),t.lineTo(l,d),t.stroke(),t.restore()}drawLabels(e){if(!this.options.ticks.display)return;let t=this.ctx,n=this._computeLabelArea();n&&hr(t,n);let r=this.getLabelItems(e);for(let e of r){let n=e.options,r=e.font,i=e.label,a=e.textOffset;Sr(t,i,0,a,r,n)}n&&gr(t)}drawTitle(){let{ctx:e,options:{position:t,title:n,reverse:r}}=this;if(!n.display)return;let i=H(n.font),a=V(n.padding),o=n.align,s=i.lineHeight/2;t===`bottom`||t===`center`||A(t)?(s+=a.bottom,k(n.text)&&(s+=i.lineHeight*(n.text.length-1))):s+=a.top;let{titleX:c,titleY:l,maxWidth:u,rotation:d}=as(this,s,t,o);Sr(e,n.text,0,0,i,{color:n.color,maxWidth:u,rotation:d,textAlign:is(o,t,r),textBaseline:`middle`,translation:[c,l],strokeColor:n.strokeColor,strokeWidth:n.strokeWidth})}draw(e){this._isVisible()&&(this.drawBackground(),this.drawGrid(e),this.drawBorder(),this.drawTitle(),this.drawLabels(e))}_layers(){let t=this.options,n=t.ticks&&t.ticks.z||0,r=M(t.grid&&t.grid.z,-1),i=M(t.border&&t.border.z,0);return!this._isVisible()||this.draw!==e.prototype.draw?[{z:n,draw:e=>{this.draw(e)}}]:[{z:r,draw:e=>{this.drawBackground(),this.drawGrid(e),this.drawTitle()}},{z:i,draw:()=>{this.drawBorder()}},{z:n,draw:e=>{this.drawLabels(e)}}]}getMatchingVisibleMetas(e){let t=this.chart.getSortedVisibleDatasetMetas(),n=this.axis+`AxisID`,r=[],i,a;for(i=0,a=t.length;i<a;++i){let a=t[i];a[n]!==this.id||e&&a.type!==e||r.push(a)}return r}_resolveTickFontOptions(e){return H(this.options.ticks.setContext(this.getContext(e)).font)}_maxDigits(){let e=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/e}},ss=class{constructor(e,t,n){this.type=e,this.scope=t,this.override=n,this.items=Object.create(null)}isForType(e){return Object.prototype.isPrototypeOf.call(this.type.prototype,e.prototype)}register(e){let t=Object.getPrototypeOf(e),n;us(t)&&(n=this.register(t));let r=this.items,i=e.id,a=this.scope+`.`+i;if(!i)throw Error(`class does not have id: `+e);return i in r||(r[i]=e,cs(e,a,n),this.override&&B.override(e.id,e.overrides)),a}get(e){return this.items[e]}unregister(e){let t=this.items,n=e.id,r=this.scope;n in t&&delete t[n],r&&n in B[r]&&(delete B[r][n],this.override&&delete rr[n])}};function cs(e,t,n){let r=Vt(Object.create(null),[n?B.get(n):{},B.get(t),e.defaults]);B.set(t,r),e.defaultRoutes&&ls(t,e.defaultRoutes),e.descriptors&&B.describe(t,e.descriptors)}function ls(e,t){Object.keys(t).forEach(n=>{let r=n.split(`.`),i=r.pop(),a=[e].concat(r).join(`.`),o=t[n].split(`.`),s=o.pop(),c=o.join(`.`);B.route(a,i,c,s)})}function us(e){return`id`in e&&`defaults`in e}var ds=/* #__PURE__ */ new class{constructor(){this.controllers=new ss(ba,`datasets`,!0),this.elements=new ss(Bo,`elements`),this.plugins=new ss(Object,`plugins`),this.scales=new ss(os,`scales`),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...e){this._each(`register`,e)}remove(...e){this._each(`unregister`,e)}addControllers(...e){this._each(`register`,e,this.controllers)}addElements(...e){this._each(`register`,e,this.elements)}addPlugins(...e){this._each(`register`,e,this.plugins)}addScales(...e){this._each(`register`,e,this.scales)}getController(e){return this._get(e,this.controllers,`controller`)}getElement(e){return this._get(e,this.elements,`element`)}getPlugin(e){return this._get(e,this.plugins,`plugin`)}getScale(e){return this._get(e,this.scales,`scale`)}removeControllers(...e){this._each(`unregister`,e,this.controllers)}removeElements(...e){this._each(`unregister`,e,this.elements)}removePlugins(...e){this._each(`unregister`,e,this.plugins)}removeScales(...e){this._each(`unregister`,e,this.scales)}_each(e,t,n){[...t].forEach(t=>{let r=n||this._getRegistryForType(t);n||r.isForType(t)||r===this.plugins&&t.id?this._exec(e,r,t):P(t,t=>{let r=n||this._getRegistryForType(t);this._exec(e,r,t)})})}_exec(e,t,n){let r=Jt(e);N(n[`before`+r],[],n),t[e](n),N(n[`after`+r],[],n)}_getRegistryForType(e){for(let t=0;t<this._typedRegistries.length;t++){let n=this._typedRegistries[t];if(n.isForType(e))return n}return this.plugins}_get(e,t,n){let r=t.get(e);if(r===void 0)throw Error(`"`+e+`" is not a registered `+n+`.`);return r}},fs=class{constructor(){this._init=void 0}notify(e,t,n,r){if(t===`beforeInit`&&(this._init=this._createDescriptors(e,!0),this._notify(this._init,e,`install`)),this._init===void 0)return;let i=r?this._descriptors(e).filter(r):this._descriptors(e),a=this._notify(i,e,t,n);return t===`afterDestroy`&&(this._notify(i,e,`stop`),this._notify(this._init,e,`uninstall`),this._init=void 0),a}_notify(e,t,n,r){r||={};for(let i of e){let e=i.plugin,a=e[n];if(N(a,[t,r,i.options],e)===!1&&r.cancelable)return!1}return!0}invalidate(){O(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(e){if(this._cache)return this._cache;let t=this._cache=this._createDescriptors(e);return this._notifyStateChanges(e),t}_createDescriptors(e,t){let n=e&&e.config,r=M(n.options&&n.options.plugins,{}),i=ps(n);return r===!1&&!t?[]:hs(e,i,r,t)}_notifyStateChanges(e){let t=this._oldCache||[],n=this._cache,r=(e,t)=>e.filter(e=>!t.some(t=>e.plugin.id===t.plugin.id));this._notify(r(t,n),e,`stop`),this._notify(r(n,t),e,`start`)}};function ps(e){let t={},n=[],r=Object.keys(ds.plugins.items);for(let e=0;e<r.length;e++)n.push(ds.getPlugin(r[e]));let i=e.plugins||[];for(let e=0;e<i.length;e++){let r=i[e];n.indexOf(r)===-1&&(n.push(r),t[r.id]=!0)}return{plugins:n,localIds:t}}function ms(e,t){return!t&&e===!1?null:e===!0?{}:e}function hs(e,{plugins:t,localIds:n},r,i){let a=[],o=e.getContext();for(let s of t){let t=s.id,c=ms(r[t],i);c!==null&&a.push({plugin:s,options:gs(e.config,{plugin:s,local:n[t]},c,o)})}return a}function gs(e,{plugin:t,local:n},r,i){let a=e.pluginScopeKeys(t),o=e.getOptionScopes(r,a);return n&&t.defaults&&o.push(t.defaults),e.createResolver(o,i,[``],{scriptable:!1,indexable:!1,allKeys:!0})}function _s(e,t){let n=B.datasets[e]||{};return((t.datasets||{})[e]||{}).indexAxis||t.indexAxis||n.indexAxis||`x`}function vs(e,t){let n=e;return e===`_index_`?n=t:e===`_value_`&&(n=t===`x`?`y`:`x`),n}function ys(e,t){return e===t?`_index_`:`_value_`}function bs(e){if(e===`x`||e===`y`||e===`r`)return e}function xs(e){if(e===`top`||e===`bottom`)return`x`;if(e===`left`||e===`right`)return`y`}function Ss(e,...t){if(bs(e))return e;for(let n of t){let t=n.axis||xs(n.position)||e.length>1&&bs(e[0].toLowerCase());if(t)return t}throw Error(`Cannot determine type of '${e}' axis. Please provide 'axis' or 'position' option.`)}function Cs(e,t,n){if(n[t+`AxisID`]===e)return{axis:t}}function ws(e,t){if(t.data&&t.data.datasets){let n=t.data.datasets.filter(t=>t.xAxisID===e||t.yAxisID===e);if(n.length)return Cs(e,`x`,n[0])||Cs(e,`y`,n[0])}return{}}function Ts(e,t){let n=rr[e.type]||{scales:{}},r=t.scales||{},i=_s(e.type,t),a=Object.create(null);return Object.keys(r).forEach(t=>{let o=r[t];if(!A(o))return console.error(`Invalid scale configuration for scale: ${t}`);if(o._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${t}`);let s=Ss(t,o,ws(t,e),B.scales[o.type]),c=ys(s,i),l=n.scales||{};a[t]=Ht(Object.create(null),[{axis:s},o,l[s],l[c]])}),e.data.datasets.forEach(n=>{let i=n.type||e.type,o=n.indexAxis||_s(i,t),s=(rr[i]||{}).scales||{};Object.keys(s).forEach(e=>{let t=vs(e,o),i=n[t+`AxisID`]||t;a[i]=a[i]||Object.create(null),Ht(a[i],[{axis:t},r[i],s[e]])})}),Object.keys(a).forEach(e=>{let t=a[e];Ht(t,[B.scales[t.type],B.scale])}),a}function Es(e){let t=e.options||={};t.plugins=M(t.plugins,{}),t.scales=Ts(e,t)}function Ds(e){return e||={},e.datasets=e.datasets||[],e.labels=e.labels||[],e}function Os(e){return e||={},e.data=Ds(e.data),Es(e),e}let ks=/* @__PURE__ */ new Map,As=/* @__PURE__ */ new Set;function js(e,t){let n=ks.get(e);return n||(n=t(),ks.set(e,n),As.add(n)),n}let Ms=(e,t,n)=>{let r=qt(t,n);r!==void 0&&e.add(r)};var Ns=class{constructor(e){this._config=Os(e),this._scopeCache=/* @__PURE__ */ new Map,this._resolverCache=/* @__PURE__ */ new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(e){this._config.type=e}get data(){return this._config.data}set data(e){this._config.data=Ds(e)}get options(){return this._config.options}set options(e){this._config.options=e}get plugins(){return this._config.plugins}update(){let e=this._config;this.clearCache(),Es(e)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(e){return js(e,()=>[[`datasets.${e}`,``]])}datasetAnimationScopeKeys(e,t){return js(`${e}.transition.${t}`,()=>[[`datasets.${e}.transitions.${t}`,`transitions.${t}`],[`datasets.${e}`,``]])}datasetElementScopeKeys(e,t){return js(`${e}-${t}`,()=>[[`datasets.${e}.elements.${t}`,`datasets.${e}`,`elements.${t}`,``]])}pluginScopeKeys(e){let t=e.id,n=this.type;return js(`${n}-plugin-${t}`,()=>[[`plugins.${t}`,...e.additionalOptionScopes||[]]])}_cachedScopes(e,t){let n=this._scopeCache,r=n.get(e);return(!r||t)&&(r=/* @__PURE__ */ new Map,n.set(e,r)),r}getOptionScopes(e,t,n){let{options:r,type:i}=this,a=this._cachedScopes(e,n),o=a.get(t);if(o)return o;let s=/* @__PURE__ */ new Set;t.forEach(t=>{e&&(s.add(e),t.forEach(t=>Ms(s,e,t))),t.forEach(e=>Ms(s,r,e)),t.forEach(e=>Ms(s,rr[i]||{},e)),t.forEach(e=>Ms(s,B,e)),t.forEach(e=>Ms(s,ir,e))});let c=Array.from(s);return c.length===0&&c.push(Object.create(null)),As.has(t)&&a.set(t,c),c}chartOptionScopes(){let{options:e,type:t}=this;return[e,rr[t]||{},B.datasets[t]||{},{type:t},B,ir]}resolveNamedOptions(e,t,n,r=[``]){let i={$shared:!0},{resolver:a,subPrefixes:o}=Ps(this._resolverCache,e,r),s=a;if(Is(a,t)){i.$shared=!1,n=Xt(n)?n():n;let t=this.createResolver(e,n,o);s=Fr(a,n,t)}for(let e of t)i[e]=s[e];return i}createResolver(e,t,n=[``],r){let{resolver:i}=Ps(this._resolverCache,e,n);return A(t)?Fr(i,t,void 0,r):i}};function Ps(e,t,n){let r=e.get(t);r||(r=/* @__PURE__ */ new Map,e.set(t,r));let i=n.join(),a=r.get(i);return a||(a={resolver:Pr(t,n),subPrefixes:n.filter(e=>!e.toLowerCase().includes(`hover`))},r.set(i,a)),a}let Fs=e=>A(e)&&Object.getOwnPropertyNames(e).some(t=>Xt(e[t]));function Is(e,t){let{isScriptable:n,isIndexable:r}=Ir(e);for(let i of t){let t=n(i),a=r(i),o=(a||t)&&e[i];if(t&&(Xt(o)||Fs(o))||a&&k(o))return!0}return!1}var Ls=`4.6.1`;let Rs=[`top`,`bottom`,`left`,`right`,`chartArea`];function zs(e,t){return e===`top`||e===`bottom`||Rs.indexOf(e)===-1&&t===`x`}function Bs(e,t){return function(n,r){return n[e]===r[e]?n[t]-r[t]:n[e]-r[e]}}function Vs(e){let t=e.chart,n=t.options.animation;t.notifyPlugins(`afterRender`),N(n&&n.onComplete,[e],t)}function Hs(e){let t=e.chart,n=t.options.animation;N(n&&n.onProgress,[e],t)}function Us(e){return li()&&typeof e==`string`?e=document.getElementById(e):e&&e.length&&(e=e[0]),e&&e.canvas&&(e=e.canvas),e}let Ws={},Gs=e=>{let t=Us(e);return Object.values(Ws).filter(e=>e.canvas===t).pop()};function Ks(e,t,n){let r=Object.keys(e);for(let i of r){let r=+i;if(r>=t){let a=e[i];delete e[i],(n>0||r>t)&&(e[r+n]=a)}}}function qs(e,t,n,r){return!n||e.type===`mouseout`?null:r?t:e}var U=class{static defaults=B;static instances=Ws;static overrides=rr;static registry=ds;static version=Ls;static getChart=Gs;static register(...e){ds.add(...e),Js()}static unregister(...e){ds.remove(...e),Js()}constructor(e,t){let n=this.config=new Ns(t),r=Us(e),i=Gs(r);if(i)throw Error(`Canvas is already in use. Chart with ID '`+i.id+`' must be destroyed before the canvas with ID '`+i.canvas.id+`' can be reused.`);let a=n.createResolver(n.chartOptionScopes(),this.getContext());this.platform=new(n.platform||(zo(r))),this.platform.updateConfig(n);let o=this.platform.acquireContext(r,a.aspectRatio),s=o&&o.canvas,c=s&&s.height,l=s&&s.width;this.id=Nt(),this.ctx=o,this.canvas=s,this.width=l,this.height=c,this._options=a,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 fs,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=Nn(e=>this.update(e),a.resizeDelay||0),this._dataChanges=[],Ws[this.id]=this,!o||!s?console.error(`Failed to create chart: can't acquire context from the given item`):(Ji.listen(this,`complete`,Vs),Ji.listen(this,`progress`,Hs),this._initialize(),this.attached&&this.update())}get aspectRatio(){let{options:{aspectRatio:e,maintainAspectRatio:t},width:n,height:r,_aspectRatio:i}=this;return O(e)?t&&i?i:r?n/r:null:e}get data(){return this.config.data}set data(e){this.config.data=e}get options(){return this._options}set options(e){this.config.options=e}get registry(){return ds}_initialize(){return this.notifyPlugins(`beforeInit`),this.options.responsive?this.resize():Si(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins(`afterInit`),this}clear(){return dr(this.canvas,this.ctx),this}stop(){return Ji.stop(this),this}resize(e,t){Ji.running(this)?this._resizeBeforeDraw={width:e,height:t}:this._resize(e,t)}_resize(e,t){let n=this.options,r=this.canvas,i=n.maintainAspectRatio&&this.aspectRatio,a=this.platform.getMaximumSize(r,e,t,i),o=n.devicePixelRatio||this.platform.getDevicePixelRatio(),s=this.width?`resize`:`attach`;this.width=a.width,this.height=a.height,this._aspectRatio=this.aspectRatio,Si(this,o,!0)&&(this.notifyPlugins(`resize`,{size:a}),N(n.onResize,[this,a],this),this.attached&&this._doResize(s)&&this.render())}ensureScalesHaveIDs(){P(this.options.scales||{},(e,t)=>{e.id=t})}buildOrUpdateScales(){let e=this.options,t=e.scales,n=this.scales,r=Object.keys(n).reduce((e,t)=>(e[t]=!1,e),{}),i=[];t&&(i=i.concat(Object.keys(t).map(e=>{let n=t[e],r=Ss(e,n),i=r===`r`,a=r===`x`;return{options:n,dposition:i?`chartArea`:a?`bottom`:`left`,dtype:i?`radialLinear`:a?`category`:`linear`}}))),P(i,t=>{let i=t.options,a=i.id,o=Ss(a,i),s=M(i.type,t.dtype);(i.position===void 0||zs(i.position,o)!==zs(t.dposition))&&(i.position=t.dposition),r[a]=!0;let c=null;a in n&&n[a].type===s?c=n[a]:(c=new(ds.getScale(s))({id:a,type:s,ctx:this.ctx,chart:this}),n[c.id]=c),c.init(i,e)}),P(r,(e,t)=>{e||delete n[t]}),P(n,e=>{go.configure(this,e,e.options),go.addBox(this,e)})}_updateMetasets(){let e=this._metasets,t=this.data.datasets.length,n=e.length;if(e.sort((e,t)=>e.index-t.index),n>t){for(let e=t;e<n;++e)this._destroyDatasetMeta(e);e.splice(t,n-t)}this._sortedMetasets=e.slice(0).sort(Bs(`order`,`index`))}_removeUnreferencedMetasets(){let{_metasets:e,data:{datasets:t}}=this;e.length>t.length&&delete this._stacks,e.forEach((e,n)=>{t.filter(t=>t===e._dataset).length===0&&this._destroyDatasetMeta(n)})}buildOrUpdateControllers(){let e=[],t=this.data.datasets,n,r;for(this._removeUnreferencedMetasets(),n=0,r=t.length;n<r;n++){let r=t[n],i=this.getDatasetMeta(n),a=r.type||this.config.type;if(i.type&&i.type!==a&&(this._destroyDatasetMeta(n),i=this.getDatasetMeta(n)),i.type=a,i.indexAxis=r.indexAxis||_s(a,this.options),i.order=r.order||0,i.index=n,i.label=``+r.label,i.visible=this.isDatasetVisible(n),i.controller)i.controller.updateIndex(n),i.controller.linkScales();else{let t=ds.getController(a),{datasetElementType:r,dataElementType:o}=B.datasets[a];Object.assign(t,{dataElementType:ds.getElement(o),datasetElementType:r&&ds.getElement(r)}),i.controller=new t(this,n),e.push(i.controller)}}return this._updateMetasets(),e}_resetElements(){P(this.data.datasets,(e,t)=>{this.getDatasetMeta(t).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins(`reset`)}update(e){let t=this.config;t.update();let n=this._options=t.createResolver(t.chartOptionScopes(),this.getContext()),r=this._animationsDisabled=!n.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins(`beforeUpdate`,{mode:e,cancelable:!0})===!1)return;let i=this.buildOrUpdateControllers();this.notifyPlugins(`beforeElementsUpdate`);let a=0;for(let e=0,t=this.data.datasets.length;e<t;e++){let{controller:t}=this.getDatasetMeta(e),n=!r&&i.indexOf(t)===-1;t.buildOrUpdateElements(n),a=Math.max(+t.getMaxOverflow(),a)}a=this._minPadding=n.layout.autoPadding?a:0,this._updateLayout(a),r||P(i,e=>{e.reset()}),this._updateDatasets(e),this.notifyPlugins(`afterUpdate`,{mode:e}),this._layers.sort(Bs(`z`,`_idx`));let{_active:o,_lastEvent:s}=this;s?this._eventHandler(s,!0):o.length&&this._updateHoverStyles(o,o,!0),this.render()}_updateScales(){P(this.scales,e=>{go.removeBox(this,e)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){let e=this.options,t=new Set(Object.keys(this._listeners)),n=new Set(e.events);Zt(t,n)&&!!this._responsiveListeners===e.responsive||(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){let{_hiddenIndices:e}=this,t=this._getUniformDataChanges()||[];for(let{method:n,start:r,count:i}of t)Ks(e,r,n===`_removeElements`?-i:i)}_getUniformDataChanges(){let e=this._dataChanges;if(!e||!e.length)return;this._dataChanges=[];let t=this.data.datasets.length,n=t=>new Set(e.filter(e=>e[0]===t).map((e,t)=>t+`,`+e.splice(1).join(`,`))),r=n(0);for(let e=1;e<t;e++)if(!Zt(r,n(e)))return;return Array.from(r).map(e=>e.split(`,`)).map(e=>({method:e[1],start:+e[2],count:+e[3]}))}_updateLayout(e){if(this.notifyPlugins(`beforeLayout`,{cancelable:!0})===!1)return;go.update(this,this.width,this.height,e);let t=this.chartArea,n=t.width<=0||t.height<=0;this._layers=[],P(this.boxes,e=>{n&&e.position===`chartArea`||(e.configure&&e.configure(),this._layers.push(...e._layers()))},this),this._layers.forEach((e,t)=>{e._idx=t}),this.notifyPlugins(`afterLayout`)}_updateDatasets(e){if(this.notifyPlugins(`beforeDatasetsUpdate`,{mode:e,cancelable:!0})!==!1){for(let e=0,t=this.data.datasets.length;e<t;++e)this.getDatasetMeta(e).controller.configure();for(let t=0,n=this.data.datasets.length;t<n;++t)this._updateDataset(t,Xt(e)?e({datasetIndex:t}):e);this.notifyPlugins(`afterDatasetsUpdate`,{mode:e})}}_updateDataset(e,t){let n=this.getDatasetMeta(e),r={meta:n,index:e,mode:t,cancelable:!0};this.notifyPlugins(`beforeDatasetUpdate`,r)!==!1&&(n.controller._update(t),r.cancelable=!1,this.notifyPlugins(`afterDatasetUpdate`,r))}render(){this.notifyPlugins(`beforeRender`,{cancelable:!0})!==!1&&(Ji.has(this)?this.attached&&!Ji.running(this)&&Ji.start(this):(this.draw(),Vs({chart:this})))}draw(){let e;if(this._resizeBeforeDraw){let{width:e,height:t}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(e,t)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins(`beforeDraw`,{cancelable:!0})===!1)return;let t=this._layers;for(e=0;e<t.length&&t[e].z<=0;++e)t[e].draw(this.chartArea);for(this._drawDatasets();e<t.length;++e)t[e].draw(this.chartArea);this.notifyPlugins(`afterDraw`)}_getSortedDatasetMetas(e){let t=this._sortedMetasets,n=[],r,i;for(r=0,i=t.length;r<i;++r){let i=t[r];(!e||i.visible)&&n.push(i)}return n}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins(`beforeDatasetsDraw`,{cancelable:!0})===!1)return;let e=this.getSortedVisibleDatasetMetas();for(let t=e.length-1;t>=0;--t)this._drawDataset(e[t]);this.notifyPlugins(`afterDatasetsDraw`)}_drawDataset(e){let t=this.ctx,n={meta:e,index:e.index,cancelable:!0},r=qi(this,e);this.notifyPlugins(`beforeDatasetDraw`,n)!==!1&&(r&&hr(t,r),e.controller.draw(),r&&gr(t),n.cancelable=!1,this.notifyPlugins(`afterDatasetDraw`,n))}isPointInArea(e){return mr(e,this.chartArea,this._minPadding)}getElementsAtEventForMode(e,t,n,r){let i=Qa.modes[t];return typeof i==`function`?i(this,e,n,r):[]}getDatasetMeta(e){let t=this.data.datasets[e],n=this._metasets,r=n.filter(e=>e&&e._dataset===t).pop();return r||(r={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:t&&t.order||0,index:e,_dataset:t,_parsed:[],_sorted:!1},n.push(r)),r}getContext(){return this.$context||=Nr(null,{chart:this,type:`chart`})}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(e){let t=this.data.datasets[e];if(!t)return!1;let n=this.getDatasetMeta(e);return typeof n.hidden==`boolean`?!n.hidden:!t.hidden}setDatasetVisibility(e,t){let n=this.getDatasetMeta(e);n.hidden=!t}toggleDataVisibility(e){this._hiddenIndices[e]=!this._hiddenIndices[e]}getDataVisibility(e){return!this._hiddenIndices[e]}_updateVisibility(e,t,n){let r=n?`show`:`hide`,i=this.getDatasetMeta(e),a=i.controller._resolveAnimations(void 0,r);Yt(t)?(i.data[t].hidden=!n,this.update()):(this.setDatasetVisibility(e,n),a.update(i,{visible:n}),this.update(t=>t.datasetIndex===e?r:void 0))}hide(e,t){this._updateVisibility(e,t,!1)}show(e,t){this._updateVisibility(e,t,!0)}_destroyDatasetMeta(e){let t=this._metasets[e];t&&t.controller&&t.controller._destroy(),delete this._metasets[e]}_stop(){let e,t;for(this.stop(),Ji.remove(this),e=0,t=this.data.datasets.length;e<t;++e)this._destroyDatasetMeta(e)}destroy(){this.notifyPlugins(`beforeDestroy`);let{canvas:e,ctx:t}=this;this._stop(),this.config.clearCache(),e&&(this.unbindEvents(),dr(e,t),this.platform.releaseContext(t),this.canvas=null,this.ctx=null),delete Ws[this.id],this.notifyPlugins(`afterDestroy`)}toBase64Image(...e){return this.canvas.toDataURL(...e)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){let e=this._listeners,t=this.platform,n=(n,r)=>{t.addEventListener(this,n,r),e[n]=r},r=(e,t,n)=>{e.offsetX=t,e.offsetY=n,this._eventHandler(e)};P(this.options.events,e=>n(e,r))}bindResponsiveEvents(){this._responsiveListeners||={};let e=this._responsiveListeners,t=this.platform,n=(n,r)=>{t.addEventListener(this,n,r),e[n]=r},r=(n,r)=>{e[n]&&(t.removeEventListener(this,n,r),delete e[n])},i=(e,t)=>{this.canvas&&this.resize(e,t)},a,o=()=>{r(`attach`,o),this.attached=!0,this.resize(),n(`resize`,i),n(`detach`,a)};a=()=>{this.attached=!1,r(`resize`,i),this._stop(),this._resize(0,0),n(`attach`,o)},t.isAttached(this.canvas)?o():a()}unbindEvents(){P(this._listeners,(e,t)=>{this.platform.removeEventListener(this,t,e)}),this._listeners={},P(this._responsiveListeners,(e,t)=>{this.platform.removeEventListener(this,t,e)}),this._responsiveListeners=void 0}updateHoverStyle(e,t,n){let r=n?`set`:`remove`,i,a,o,s;for(t===`dataset`&&(i=this.getDatasetMeta(e[0].datasetIndex),i.controller[`_`+r+`DatasetHoverStyle`]()),o=0,s=e.length;o<s;++o){a=e[o];let t=a&&this.getDatasetMeta(a.datasetIndex).controller;t&&t[r+`HoverStyle`](a.element,a.datasetIndex,a.index)}}getActiveElements(){return this._active||[]}setActiveElements(e){let t=this._active||[],n=e.map(({datasetIndex:e,index:t})=>{let n=this.getDatasetMeta(e);if(!n)throw Error(`No dataset found at index `+e);return{datasetIndex:e,element:n.data[t],index:t}});Lt(n,t)||(this._active=n,this._lastEvent=null,this._updateHoverStyles(n,t))}notifyPlugins(e,t,n){return this._plugins.notify(this,e,t,n)}isPluginEnabled(e){return this._plugins._cache.filter(t=>t.plugin.id===e).length===1}_updateHoverStyles(e,t,n){let r=this.options.hover,i=(e,t)=>e.filter(e=>!t.some(t=>e.datasetIndex===t.datasetIndex&&e.index===t.index)),a=i(t,e),o=n?e:i(e,t);a.length&&this.updateHoverStyle(a,r.mode,!1),o.length&&r.mode&&this.updateHoverStyle(o,r.mode,!0)}_eventHandler(e,t){let n={event:e,replay:t,cancelable:!0,inChartArea:this.isPointInArea(e)},r=t=>(t.options.events||this.options.events).includes(e.native.type);if(this.notifyPlugins(`beforeEvent`,n,r)===!1)return;let i=this._handleEvent(e,t,n.inChartArea);return n.cancelable=!1,this.notifyPlugins(`afterEvent`,n,r),(i||n.changed)&&this.render(),this}_handleEvent(e,t,n){let{_active:r=[],options:i}=this,a=t,o=this._getActiveElements(e,r,n,a),s=Qt(e),c=qs(e,this._lastEvent,n,s);n&&(this._lastEvent=null,N(i.onHover,[e,o,this],this),s&&N(i.onClick,[e,o,this],this));let l=!Lt(o,r);return(l||t)&&(this._active=o,this._updateHoverStyles(o,r,t)),this._lastEvent=c,l}_getActiveElements(e,t,n,r){if(e.type===`mouseout`)return[];if(!n)return t;let i=this.options.hover;return this.getElementsAtEventForMode(e,i.mode,i,r)}};function Js(){return P(U.instances,e=>e._plugins.invalidate())}function Ys(e,t,n){let{startAngle:r,x:i,y:a,outerRadius:o,innerRadius:s,options:c}=t,{borderWidth:l,borderJoinStyle:u}=c,d=Math.min(l/o,R(r-n));if(e.beginPath(),e.arc(i,a,o-l/2,r+d/2,n-d/2),s>0){let t=Math.min(l/s,R(r-n));e.arc(i,a,s+l/2,n-t/2,r+t/2,!0)}else{let t=Math.min(l/2,o*R(r-n));if(u===`round`)e.arc(i,a,t,n-F/2,r+F/2,!0);else if(u===`bevel`){let o=2*t*t,s=-o*Math.cos(n+F/2)+i,c=-o*Math.sin(n+F/2)+a,l=o*Math.cos(r+F/2)+i,u=o*Math.sin(r+F/2)+a;e.lineTo(s,c),e.lineTo(l,u)}}e.closePath(),e.moveTo(0,0),e.rect(0,0,e.canvas.width,e.canvas.height),e.clip(`evenodd`)}function Xs(e,t,n){let{startAngle:r,pixelMargin:i,x:a,y:o,outerRadius:s,innerRadius:c}=t,l=i/s;e.beginPath(),e.arc(a,o,s,r-l,n+l),c>i?(l=i/c,e.arc(a,o,c,n+l,r-l,!0)):e.arc(a,o,i,n+L,r-L),e.closePath(),e.clip()}function Zs(e){return Or(e,[`outerStart`,`outerEnd`,`innerStart`,`innerEnd`])}function Qs(e,t,n,r){let i=Zs(e.options.borderRadius),a=(n-t)/2,o=Math.min(a,r*t/2),s=e=>{let t=(n-Math.min(a,e))*r/2;return z(e,0,Math.min(a,t))};return{outerStart:s(i.outerStart),outerEnd:s(i.outerEnd),innerStart:z(i.innerStart,0,o),innerEnd:z(i.innerEnd,0,o)}}function $s(e,t,n,r){return{x:n+e*Math.cos(t),y:r+e*Math.sin(t)}}function ec(e,t,n,r){let{x:i,y:a,startAngle:o,pixelMargin:s,innerRadius:c}=t,l=Math.max(t.outerRadius+r+n-s,0),u=c>0?c+r+n+s:0;e.beginPath(),e.arc(i,a,l,o,o+I),u>0&&(e.moveTo(i+Math.cos(o)*u,a+Math.sin(o)*u),e.arc(i,a,u,o+I,o,!0)),e.closePath()}function tc(e,t,n,r,i,a){let{x:o,y:s,startAngle:c,pixelMargin:l,innerRadius:u}=t,{spacingMode:d=`angular`}=t.options,f=i-c;if(a&&t.options.selfJoin&&Math.abs(f)>=I-1e-4){ec(e,t,n,r);return}let p=Math.max(t.outerRadius+r+n-l,0),m=u>0?u+r+n+l:0,h=0,g=0,_=p>0?Math.max(.001,f*p-n/F)/p:.001,v=(f-_)/2;if(r){let e=((u>0?u-r:0)+(p>0?p-r:0))/2,t=(()=>{let t=e===0?f:f*e/(e+r);return(f-t)/2})(),n=e>0?Math.asin(Math.min(1,r/e)):0,i=Math.max(0,_/2-.001),a=Math.sin(i);if(d===`parallel`){if(m===0&&a>0){let e=r/a,t=Math.max(0,p-.001);m=Math.min(e,t)}let e=Math.min(p>0?p*a:1/0,m>0?m*a:1/0),t=Math.min(r,e);h=p>0?Math.asin(Math.min(1,t/p)):Math.min(i,n),g=m>0?Math.asin(Math.min(1,t/m)):h}else d===`proportional`?(h=Math.min(i,t),g=Math.min(i,t)):(h=Math.min(i,n),g=Math.min(i,n))}let y=c+v+h,b=i-v-h,x=c+v+g,S=i-v-g,C=Math.min(b-y,S-x),{outerStart:w,outerEnd:T,innerStart:E,innerEnd:D}=Qs(t,m,p,C),ee=p-w,te=p-T,ne=y+w/ee,re=b-T/te,ie=m+E,ae=m+D,oe=x+E/ie,se=S-D/ae;if(e.beginPath(),a){let t=(ne+re)/2;if(e.arc(o,s,p,ne,t),e.arc(o,s,p,t,re),T>0){let t=$s(te,re,o,s);e.arc(t.x,t.y,T,re,b+L)}let n=$s(ae,S,o,s);if(e.lineTo(n.x,n.y),D>0){let t=$s(ae,se,o,s);e.arc(t.x,t.y,D,S+L,se+Math.PI)}let r=(S-D/m+(x+E/m))/2;if(e.arc(o,s,m,S-D/m,r,!0),e.arc(o,s,m,r,x+E/m,!0),E>0){let t=$s(ie,oe,o,s);e.arc(t.x,t.y,E,oe+Math.PI,x-L)}let i=$s(ee,y,o,s);if(e.lineTo(i.x,i.y),w>0){let t=$s(ee,ne,o,s);e.arc(t.x,t.y,w,y-L,ne)}}else{e.moveTo(o,s);let t=Math.cos(ne)*p+o,n=Math.sin(ne)*p+s;e.lineTo(t,n);let r=Math.cos(re)*p+o,i=Math.sin(re)*p+s;e.lineTo(r,i)}e.closePath()}function nc(e,t,n,r,i){let{fullCircles:a,startAngle:o,circumference:s}=t,c=t.endAngle;if(a){tc(e,t,n,r,c,i);for(let t=0;t<a;++t)e.fill();isNaN(s)||(c=o+(s%I||I))}return tc(e,t,n,r,c,i),e.fill(),c}function rc(e,t,n,r,i){let{fullCircles:a,startAngle:o,circumference:s,options:c}=t,{borderWidth:l,borderJoinStyle:u,borderDash:d,borderDashOffset:f,borderRadius:p}=c,m=c.borderAlign===`inner`;if(!l)return;e.setLineDash(d||[]),e.lineDashOffset=f,m?(e.lineWidth=l*2,e.lineJoin=u||`round`):(e.lineWidth=l,e.lineJoin=u||`bevel`);let h=t.endAngle,g=Math.abs(h-o)>=I-1e-4;if(a){tc(e,t,n,r,h,i);for(let t=0;t<a;++t)e.stroke();isNaN(s)||(h=o+(s%I||I))}m&&Xs(e,t,h),!(g&&t.innerRadius>0)&&c.selfJoin&&h-o>=F&&p===0&&u!==`miter`&&Ys(e,t,h),a||(tc(e,t,n,r,h,i),e.stroke())}var ic=class extends Bo{static id=`arc`;static defaults={borderAlign:`center`,borderColor:`#fff`,borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,spacingMode:`angular`,angle:void 0,circular:!0,selfJoin:!1};static defaultRoutes={backgroundColor:`backgroundColor`};static descriptors={_scriptable:!0,_indexable:e=>e!==`borderDash`};circumference;endAngle;fullCircles;innerRadius;outerRadius;pixelMargin;startAngle;circular;constructor(e){super(),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,this.circular=!1,e&&Object.assign(this,e)}inRange(e,t,n){let{angle:r,distance:i}=_n(this.getProps([`x`,`y`],n),{x:e,y:t}),{startAngle:a,endAngle:o,innerRadius:s,outerRadius:c,circumference:l}=this.getProps([`startAngle`,`endAngle`,`innerRadius`,`outerRadius`,`circumference`],n),u=(this.options.spacing+this.options.borderWidth)/2,d=M(l,o-a),f=bn(r,a,o)&&a!==o,p=d>=I||f,m=Sn(i,s+u,c+u);return p&&m}getCenterPoint(e){let{x:t,y:n,startAngle:r,endAngle:i,innerRadius:a,outerRadius:o}=this.getProps([`x`,`y`,`startAngle`,`endAngle`,`innerRadius`,`outerRadius`],e),{offset:s,spacing:c}=this.options,l=(r+i)/2,u=(a+o+c+s)/2;return{x:t+Math.cos(l)*u,y:n+Math.sin(l)*u}}tooltipPosition(e){return this.getCenterPoint(e)}draw(e){let{options:t,circumference:n}=this,r=(t.offset||0)/4,i=(t.spacing||0)/2,a=t.circular;if(this.pixelMargin=t.borderAlign===`inner`?.33:0,this.fullCircles=n>I?Math.floor(n/I):0,n===0||this.innerRadius<0||this.outerRadius<0)return;e.save();let o=(this.startAngle+this.endAngle)/2;e.translate(Math.cos(o)*r,Math.sin(o)*r);let s=r*(1-Math.sin(Math.min(F,n||0)));e.fillStyle=t.backgroundColor,e.strokeStyle=t.borderColor,nc(e,this,s,i,a),rc(e,this,s,i,a),e.restore()}};function ac(e,t,n=t){e.lineCap=M(n.borderCapStyle,t.borderCapStyle),e.setLineDash(M(n.borderDash,t.borderDash)),e.lineDashOffset=M(n.borderDashOffset,t.borderDashOffset),e.lineJoin=M(n.borderJoinStyle,t.borderJoinStyle),e.lineWidth=M(n.borderWidth,t.borderWidth),e.strokeStyle=M(n.borderColor,t.borderColor)}function oc(e,t,n){e.lineTo(n.x,n.y)}function sc(e){return e.stepped?_r:e.tension||e.cubicInterpolationMode===`monotone`?vr:oc}function cc(e,t,n={}){let r=e.length,{start:i=0,end:a=r-1}=n,{start:o,end:s}=t,c=Math.max(i,o),l=Math.min(a,s),u=i<o&&a<o||i>s&&a>s;return{count:r,start:c,loop:t.loop,ilen:l<c&&!u?r+l-c:l-c}}function lc(e,t,n,r){let{points:i,options:a}=t,{count:o,start:s,loop:c,ilen:l}=cc(i,n,r),u=sc(a),{move:d=!0,reverse:f}=r||{},p,m,h;for(p=0;p<=l;++p)m=i[(s+(f?l-p:p))%o],!m.skip&&(d?(e.moveTo(m.x,m.y),d=!1):u(e,h,m,f,a.stepped),h=m);return c&&(m=i[(s+(f?l:0))%o],u(e,h,m,f,a.stepped)),!!c}function uc(e,t,n,r){let i=t.points,{count:a,start:o,ilen:s}=cc(i,n,r),{move:c=!0,reverse:l}=r||{},u=0,d=0,f,p,m,h,g,_,v=e=>(o+(l?s-e:e))%a,y=()=>{h!==g&&(e.lineTo(u,g),e.lineTo(u,h),e.lineTo(u,_))};for(c&&(p=i[v(0)],e.moveTo(p.x,p.y)),f=0;f<=s;++f){if(p=i[v(f)],p.skip)continue;let t=p.x,n=p.y,r=t|0;r===m?(n<h?h=n:n>g&&(g=n),u=(d*u+t)/++d):(y(),e.lineTo(t,n),m=r,d=0,h=g=n),_=n}y()}function dc(e){let t=e.options,n=t.borderDash&&t.borderDash.length;return!e._decimated&&!e._loop&&!t.tension&&t.cubicInterpolationMode!==`monotone`&&!t.stepped&&!n?uc:lc}function fc(e){return e.stepped?Ei:e.tension||e.cubicInterpolationMode===`monotone`?Di:Ti}function pc(e,t,n,r){let i=t._path;i||(i=t._path=new Path2D,t.path(i,n,r)&&i.closePath()),ac(e,t.options),e.stroke(i)}function mc(e,t,n,r){let{segments:i,options:a}=t,o=dc(t);for(let s of i)ac(e,a,s.style),e.beginPath(),o(e,t,s,{start:n,end:n+r-1})&&e.closePath(),e.stroke()}let hc=typeof Path2D==`function`;function gc(e,t,n,r){hc&&!t.options.segment?pc(e,t,n,r):mc(e,t,n,r)}var _c=class extends Bo{static id=`line`;static defaults={borderCapStyle:`butt`,borderDash:[],borderDashOffset:0,borderJoinStyle:`miter`,borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:`default`,fill:!1,spanGaps:!1,stepped:!1,tension:0};static defaultRoutes={backgroundColor:`backgroundColor`,borderColor:`borderColor`};static descriptors={_scriptable:!0,_indexable:e=>e!==`borderDash`&&e!==`fill`};constructor(e){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,e&&Object.assign(this,e)}updateControlPoints(e,t){let n=this.options;if((n.tension||n.cubicInterpolationMode===`monotone`)&&!n.stepped&&!this._pointsUpdated){let r=n.spanGaps?this._loop:this._fullLoop;ci(this._points,n,e,r,t),this._pointsUpdated=!0}}set points(e){this._points=e,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||=Bi(this,this.options.segment)}first(){let e=this.segments,t=this.points;return e.length&&t[e[0].start]}last(){let e=this.segments,t=this.points,n=e.length;return n&&t[e[n-1].end]}interpolate(e,t){let n=this.options,r=e[t],i=this.points,a=Li(this,{property:t,start:r,end:r});if(!a.length)return;let o=[],s=fc(n),c,l;for(c=0,l=a.length;c<l;++c){let{start:l,end:u}=a[c],d=i[l],f=i[u];if(d===f){o.push(d);continue}let p=s(d,f,Math.abs((r-d[t])/(f[t]-d[t])),n.stepped);p[t]=e[t],o.push(p)}return o.length===1?o[0]:o}pathSegment(e,t,n){return dc(this)(e,this,t,n)}path(e,t,n){let r=this.segments,i=dc(this),a=this._loop;t||=0,n||=this.points.length-t;for(let o of r)a&=i(e,this,o,{start:t,end:t+n-1});return!!a}draw(e,t,n,r){let i=this.options||{};(this.points||[]).length&&i.borderWidth&&(e.save(),gc(e,this,n,r),e.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}};function vc(e,t,n,r){let i=e.options,{[n]:a}=e.getProps([n],r);return Math.abs(t-a)<i.radius+i.hitRadius}var yc=class extends Bo{static id=`point`;parsed;skip;stop;static defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:`circle`,radius:3,rotation:0};static defaultRoutes={backgroundColor:`backgroundColor`,borderColor:`borderColor`};constructor(e){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,e&&Object.assign(this,e)}inRange(e,t,n){let r=this.options,{x:i,y:a}=this.getProps([`x`,`y`],n);return(e-i)**2+(t-a)**2<(r.hitRadius+r.radius)**2}inXRange(e,t){return vc(this,e,`x`,t)}inYRange(e,t){return vc(this,e,`y`,t)}getCenterPoint(e){let{x:t,y:n}=this.getProps([`x`,`y`],e);return{x:t,y:n}}size(e){e=e||this.options||{};let t=e.radius||0;t=Math.max(t,t&&e.hoverRadius||0);let n=t&&e.borderWidth||0;return(t+n)*2}draw(e,t){let n=this.options;this.skip||n.radius<.1||!mr(this,t,this.size(n)/2)||(e.strokeStyle=n.borderColor,e.lineWidth=n.borderWidth,e.fillStyle=n.backgroundColor,fr(e,n,this.x,this.y))}getRange(){let e=this.options||{};return e.radius+e.hitRadius}};function bc(e,t){let{x:n,y:r,base:i,width:a,height:o}=e.getProps([`x`,`y`,`base`,`width`,`height`],t),s,c,l,u,d;return e.horizontal?(d=o/2,s=Math.min(n,i),c=Math.max(n,i),l=r-d,u=r+d):(d=a/2,s=n-d,c=n+d,l=Math.min(r,i),u=Math.max(r,i)),{left:s,top:l,right:c,bottom:u}}function xc(e,t,n,r){return e?0:z(t,n,r)}function Sc(e,t,n){let r=e.options.borderWidth,i=e.borderSkipped,a=kr(r);return{t:xc(i.top,a.top,0,n),r:xc(i.right,a.right,0,t),b:xc(i.bottom,a.bottom,0,n),l:xc(i.left,a.left,0,t)}}function Cc(e,t,n){let{enableBorderRadius:r}=e.getProps([`enableBorderRadius`]),i=e.options.borderRadius,a=Ar(i),o=Math.min(t,n),s=e.borderSkipped,c=r||A(i);return{topLeft:xc(!c||s.top||s.left,a.topLeft,0,o),topRight:xc(!c||s.top||s.right,a.topRight,0,o),bottomLeft:xc(!c||s.bottom||s.left,a.bottomLeft,0,o),bottomRight:xc(!c||s.bottom||s.right,a.bottomRight,0,o)}}function wc(e){let t=bc(e),n=t.right-t.left,r=t.bottom-t.top,i=Sc(e,n/2,r/2),a=Cc(e,n/2,r/2);return{outer:{x:t.left,y:t.top,w:n,h:r,radius:a},inner:{x:t.left+i.l,y:t.top+i.t,w:n-i.l-i.r,h:r-i.t-i.b,radius:{topLeft:Math.max(0,a.topLeft-Math.max(i.t,i.l)),topRight:Math.max(0,a.topRight-Math.max(i.t,i.r)),bottomLeft:Math.max(0,a.bottomLeft-Math.max(i.b,i.l)),bottomRight:Math.max(0,a.bottomRight-Math.max(i.b,i.r))}}}}function Tc(e,t,n,r){let i=t===null,a=n===null,o=e&&!(i&&a)&&bc(e,r);return o&&(i||Sn(t,o.left,o.right))&&(a||Sn(n,o.top,o.bottom))}function Ec(e){return e.topLeft||e.topRight||e.bottomLeft||e.bottomRight}function Dc(e,t){e.rect(t.x,t.y,t.w,t.h)}function Oc(e,t,n={}){let r=e.x===n.x?0:-t,i=e.y===n.y?0:-t,a=(e.x+e.w===n.x+n.w?0:t)-r,o=(e.y+e.h===n.y+n.h?0:t)-i;return{x:e.x+r,y:e.y+i,w:e.w+a,h:e.h+o,radius:e.radius}}var kc=class extends Bo{static id=`bar`;static defaults={borderSkipped:`start`,borderWidth:0,borderRadius:0,inflateAmount:`auto`,pointStyle:void 0};static defaultRoutes={backgroundColor:`backgroundColor`,borderColor:`borderColor`};constructor(e){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,e&&Object.assign(this,e)}draw(e){let{inflateAmount:t,options:{borderColor:n,backgroundColor:r}}=this,{inner:i,outer:a}=wc(this),o=Ec(a.radius)?Cr:Dc;e.save(),(a.w!==i.w||a.h!==i.h)&&(e.beginPath(),o(e,Oc(a,t,i)),e.clip(),o(e,Oc(i,-t,a)),e.fillStyle=n,e.fill(`evenodd`)),e.beginPath(),o(e,Oc(i,t)),e.fillStyle=r,e.fill(),e.restore()}inRange(e,t,n){return Tc(this,e,t,n)}inXRange(e,t){return Tc(this,e,null,t)}inYRange(e,t){return Tc(this,null,e,t)}getCenterPoint(e){let{x:t,y:n,base:r,horizontal:i}=this.getProps([`x`,`y`,`base`,`horizontal`],e);return{x:i?(t+r)/2:t,y:i?n:(n+r)/2}}getRange(e){return e===`x`?this.width/2:this.height/2}};function Ac(e,t,n){let r=e.segments,i=e.points,a=t.points,o=[];for(let e of r){let{start:r,end:s}=e;s=Nc(r,s,i);let c=jc(n,i[r],i[s],e.loop);if(!t.segments){o.push({source:e,target:c,start:i[r],end:i[s]});continue}let l=Li(t,c);for(let t of l){let r=jc(n,a[t.start],a[t.end],t.loop),s=Ii(e,i,r);for(let e of s)o.push({source:e,target:t,start:{[n]:Pc(c,r,`start`,Math.max)},end:{[n]:Pc(c,r,`end`,Math.min)}})}}return o}function jc(e,t,n,r){if(r)return;let i=t[e],a=n[e];return e===`angle`&&(i=R(i),a=R(a)),{property:e,start:i,end:a}}function Mc(e,t){let{x:n=null,y:r=null}=e||{},i=t.points,a=[];return t.segments.forEach(({start:e,end:t})=>{t=Nc(e,t,i);let o=i[e],s=i[t];r===null?n!==null&&(a.push({x:n,y:o.y}),a.push({x:n,y:s.y})):(a.push({x:o.x,y:r}),a.push({x:s.x,y:r}))}),a}function Nc(e,t,n){for(;t>e;t--){let e=n[t];if(!isNaN(e.x)&&!isNaN(e.y))break}return t}function Pc(e,t,n,r){return e&&t?r(e[n],t[n]):e?e[n]:t?t[n]:0}function Fc(e,t){let n=[],r=!1;return k(e)?(r=!0,n=e):n=Mc(e,t),n.length?new _c({points:n,options:{tension:0},_loop:r,_fullLoop:r}):null}function Ic(e){return e&&e.fill!==!1}function Lc(e,t,n){let r=e[t].fill,i=[t],a;if(!n)return r;for(;r!==!1&&i.indexOf(r)===-1;){if(!j(r))return r;if(a=e[r],!a)return!1;if(a.visible)return r;i.push(r),r=a.fill}return!1}function Rc(e,t,n){let r=Hc(e);if(A(r))return!isNaN(r.value)&&r;let i=parseFloat(r);return j(i)&&Math.floor(i)===i?zc(r[0],t,i,n):[`origin`,`start`,`end`,`stack`,`shape`].indexOf(r)>=0&&r}function zc(e,t,n,r){return(e===`-`||e===`+`)&&(n=t+n),n===t||n<0||n>=r?!1:n}function Bc(e,t){let n=null;return e===`start`?n=t.bottom:e===`end`?n=t.top:A(e)?n=t.getPixelForValue(e.value):t.getBasePixel&&(n=t.getBasePixel()),n}function Vc(e,t,n){let r;return r=e===`start`?n:e===`end`?t.options.reverse?t.min:t.max:A(e)?e.value:t.getBaseValue(),r}function Hc(e){let t=e.options,n=t.fill,r=M(n&&n.target,n);return r===void 0&&(r=!!t.backgroundColor),r===!1||r===null?!1:r===!0?`origin`:r}function Uc(e){let{scale:t,index:n,line:r}=e,i=[],a=r.segments,o=r.points,s=Wc(t,n);s.push(Fc({x:null,y:t.bottom},r));for(let e=0;e<a.length;e++){let t=a[e];for(let e=t.start;e<=t.end;e++)Gc(i,o[e],s)}return new _c({points:i,options:{}})}function Wc(e,t){let n=[],r=e.getMatchingVisibleMetas(`line`);for(let e=0;e<r.length;e++){let i=r[e];if(i.index===t)break;i.hidden||n.unshift(i.dataset)}return n}function Gc(e,t,n){let r=[];for(let i=0;i<n.length;i++){let a=n[i],{first:o,last:s,point:c}=Kc(a,t,`x`);if(!(!c||o&&s)){if(o)r.unshift(c);else if(e.push(c),!s)break}}e.push(...r)}function Kc(e,t,n){let r=e.interpolate(t,n);if(!r)return{};let i=r[n],a=e.segments,o=e.points,s=!1,c=!1;for(let e=0;e<a.length;e++){let t=a[e],r=o[t.start][n],l=o[t.end][n];if(Sn(i,r,l)){s=i===r,c=i===l;break}}return{first:s,last:c,point:r}}var qc=class{constructor(e){this.x=e.x,this.y=e.y,this.radius=e.radius}pathSegment(e,t,n){let{x:r,y:i,radius:a}=this;return t||={start:0,end:I},e.arc(r,i,a,t.end,t.start,!0),!n.bounds}interpolate(e){let{x:t,y:n,radius:r}=this,i=e.angle;return{x:t+Math.cos(i)*r,y:n+Math.sin(i)*r,angle:i}}};function Jc(e){let{chart:t,fill:n,line:r}=e;if(j(n))return Yc(t,n);if(n===`stack`)return Uc(e);if(n===`shape`)return!0;let i=Xc(e);return i instanceof qc?i:Fc(i,r)}function Yc(e,t){let n=e.getDatasetMeta(t);return n&&e.isDatasetVisible(t)?n.dataset:null}function Xc(e){return(e.scale||{}).getPointPositionForValue?Qc(e):Zc(e)}function Zc(e){let{scale:t={},fill:n}=e,r=Bc(n,t);if(j(r)){let e=t.isHorizontal();return{x:e?r:null,y:e?null:r}}return null}function Qc(e){let{scale:t,fill:n}=e,r=t.options,i=t.getLabels().length,a=r.reverse?t.max:t.min,o=Vc(n,t,a),s=[];if(r.grid.circular){let e=t.getPointPositionForValue(0,a);return new qc({x:e.x,y:e.y,radius:t.getDistanceFromCenterForValue(o)})}for(let e=0;e<i;++e)s.push(t.getPointPositionForValue(e,o));return s}function $c(e,t,n){let r=Jc(t),{chart:i,index:a,line:o,scale:s,axis:c}=t,l=o.options,u=l.fill,d=l.backgroundColor,{above:f=d,below:p=d}=u||{},m=i.getDatasetMeta(a),h=qi(i,m);r&&o.points.length&&(hr(e,el(n,m.iScale)),tl(e,{line:o,target:r,above:f,below:p,area:n,scale:s,axis:c,clip:h}),gr(e))}function el(e,t){if(!t||t.getPointPositionForValue)return e;let n=t.getPixelForValue(t.min),r=t.getPixelForValue(t.max),i=Math.min(n,r),a=Math.max(n,r);return t.isHorizontal()?{...e,left:Math.max(e.left,i),right:Math.min(e.right,a)}:{...e,top:Math.max(e.top,i),bottom:Math.min(e.bottom,a)}}function tl(e,t){let{line:n,target:r,above:i,below:a,area:o,scale:s,clip:c}=t,l=n._loop?`angle`:t.axis;e.save();let u=a;a!==i&&(l===`x`?(nl(e,r,o.top),il(e,{line:n,target:r,color:i,scale:s,property:l,clip:c}),e.restore(),e.save(),nl(e,r,o.bottom)):l===`y`&&(rl(e,r,o.left),il(e,{line:n,target:r,color:a,scale:s,property:l,clip:c}),e.restore(),e.save(),rl(e,r,o.right),u=i)),il(e,{line:n,target:r,color:u,scale:s,property:l,clip:c}),e.restore()}function nl(e,t,n){let{segments:r,points:i}=t,a=!0,o=!1;e.beginPath();for(let s of r){let{start:r,end:c}=s,l=i[r],u=i[Nc(r,c,i)];a?(e.moveTo(l.x,l.y),a=!1):(e.lineTo(l.x,n),e.lineTo(l.x,l.y)),o=!!t.pathSegment(e,s,{move:o}),o?e.closePath():e.lineTo(u.x,n)}e.lineTo(t.first().x,n),e.closePath(),e.clip()}function rl(e,t,n){let{segments:r,points:i}=t,a=!0,o=!1;e.beginPath();for(let s of r){let{start:r,end:c}=s,l=i[r],u=i[Nc(r,c,i)];a?(e.moveTo(l.x,l.y),a=!1):(e.lineTo(n,l.y),e.lineTo(l.x,l.y)),o=!!t.pathSegment(e,s,{move:o}),o?e.closePath():e.lineTo(n,u.y)}e.lineTo(n,t.first().y),e.closePath(),e.clip()}function il(e,t){let{line:n,target:r,property:i,color:a,scale:o,clip:s}=t,c=Ac(n,r,i);for(let{source:t,target:l,start:u,end:d}of c){let{style:{backgroundColor:c=a}={}}=t,f=r!==!0;e.save(),e.fillStyle=c,al(e,o,s,f&&jc(i,u,d)),e.beginPath();let p=!!n.pathSegment(e,t),m;if(f){p?e.closePath():ol(e,r,d,i);let t=!!r.pathSegment(e,l,{move:p,reverse:!0});m=p&&t,m||ol(e,r,u,i)}e.closePath(),e.fill(m?`evenodd`:`nonzero`),e.restore()}}function al(e,t,n,r){let i=t.chart.chartArea,{property:a,start:o,end:s}=r||{};if(a===`x`||a===`y`){let t,r,c,l;a===`x`?(t=o,r=i.top,c=s,l=i.bottom):(t=i.left,r=o,c=i.right,l=s),e.beginPath(),n&&(t=Math.max(t,n.left),c=Math.min(c,n.right),r=Math.max(r,n.top),l=Math.min(l,n.bottom)),e.rect(t,r,c-t,l-r),e.clip()}}function ol(e,t,n,r){let i=t.interpolate(n,r);i&&e.lineTo(i.x,i.y)}var sl={id:`filler`,afterDatasetsUpdate(e,t,n){let r=(e.data.datasets||[]).length,i=[],a,o,s,c;for(o=0;o<r;++o)a=e.getDatasetMeta(o),s=a.dataset,c=null,s&&s.options&&s instanceof _c&&(c={visible:e.isDatasetVisible(o),index:o,fill:Rc(s,o,r),chart:e,axis:a.controller.options.indexAxis,scale:a.vScale,line:s}),a.$filler=c,i.push(c);for(o=0;o<r;++o)c=i[o],c&&c.fill!==!1&&(c.fill=Lc(i,o,n.propagate))},beforeDraw(e,t,n){let r=n.drawTime===`beforeDraw`,i=e.getSortedVisibleDatasetMetas(),a=e.chartArea;for(let t=i.length-1;t>=0;--t){let n=i[t].$filler;n&&(n.line.updateControlPoints(a,n.axis),r&&n.fill&&$c(e.ctx,n,a))}},beforeDatasetsDraw(e,t,n){if(n.drawTime!==`beforeDatasetsDraw`)return;let r=e.getSortedVisibleDatasetMetas();for(let t=r.length-1;t>=0;--t){let n=r[t].$filler;Ic(n)&&$c(e.ctx,n,e.chartArea)}},beforeDatasetDraw(e,t,n){let r=t.meta.$filler;Ic(r)&&n.drawTime===`beforeDatasetDraw`&&$c(e.ctx,r,e.chartArea)},defaults:{propagate:!0,drawTime:`beforeDatasetDraw`}};let cl=(e,t)=>{let{boxHeight:n=t,boxWidth:r=t}=e;return e.usePointStyle&&(n=Math.min(n,t),r=e.pointStyleWidth||Math.min(r,t)),{boxWidth:r,boxHeight:n,itemHeight:Math.max(t,n)}},ll=(e,t)=>e!==null&&t!==null&&e.datasetIndex===t.datasetIndex&&e.index===t.index;var ul=class extends Bo{constructor(e){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=e.chart,this.options=e.options,this.ctx=e.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(e,t,n){this.maxWidth=e,this.maxHeight=t,this._margins=n,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(){let e=this.options.labels||{},t=N(e.generateLabels,[this.chart],this)||[];e.filter&&(t=t.filter(t=>e.filter(t,this.chart.data))),e.sort&&(t=t.sort((t,n)=>e.sort(t,n,this.chart.data))),this.options.reverse&&t.reverse(),this.legendItems=t}fit(){let{options:e,ctx:t}=this;if(!e.display){this.width=this.height=0;return}let n=e.labels,r=H(n.font),i=r.size,a=this._computeTitleHeight(),{boxWidth:o,itemHeight:s}=cl(n,i),c,l;t.font=r.string,this.isHorizontal()?(c=this.maxWidth,l=this._fitRows(a,i,o,s)+10):(l=this.maxHeight,c=this._fitCols(a,r,o,s)+10),this.width=Math.min(c,e.maxWidth||this.maxWidth),this.height=Math.min(l,e.maxHeight||this.maxHeight)}_fitRows(e,t,n,r){let{ctx:i,maxWidth:a,options:{labels:{padding:o}}}=this,s=this.legendHitBoxes=[],c=this.lineWidths=[0],l=r+o,u=e;i.textAlign=`left`,i.textBaseline=`middle`;let d=-1,f=-l;return this.legendItems.forEach((e,p)=>{let m=n+t/2+i.measureText(e.text).width;(p===0||c[c.length-1]+m+2*o>a)&&(u+=l,c[c.length-(p>0?0:1)]=0,f+=l,d++),s[p]={left:0,top:f,row:d,width:m,height:r},c[c.length-1]+=m+o}),u}_fitCols(e,t,n,r){let{ctx:i,maxHeight:a,options:{labels:{padding:o}}}=this,s=this.legendHitBoxes=[],c=this.columnSizes=[],l=a-e,u=o,d=0,f=0,p=0,m=0;return this.legendItems.forEach((e,a)=>{let{itemWidth:h,itemHeight:g}=dl(n,t,i,e,r);a>0&&f+g+2*o>l&&(u+=d+o,c.push({width:d,height:f}),p+=d+o,m++,d=f=0),s[a]={left:p,top:f,col:m,width:h,height:g},d=Math.max(d,h),f+=g+o}),u+=d,c.push({width:d,height:f}),u}adjustHitBoxes(){if(!this.options.display)return;let e=this._computeTitleHeight(),{legendHitBoxes:t,options:{align:n,labels:{padding:r},rtl:i}}=this,a=Ai(i,this.left,this.width);if(this.isHorizontal()){let i=0,o=Fn(n,this.left+r,this.right-this.lineWidths[i]);for(let s of t)i!==s.row&&(i=s.row,o=Fn(n,this.left+r,this.right-this.lineWidths[i])),s.top+=this.top+e+r,s.left=a.leftForLtr(a.x(o),s.width),o+=s.width+r}else{let i=0,o=Fn(n,this.top+e+r,this.bottom-this.columnSizes[i].height);for(let s of t)s.col!==i&&(i=s.col,o=Fn(n,this.top+e+r,this.bottom-this.columnSizes[i].height)),s.top=o,s.left+=this.left+r,s.left=a.leftForLtr(a.x(s.left),s.width),o+=s.height+r}}isHorizontal(){return this.options.position===`top`||this.options.position===`bottom`}draw(){if(this.options.display){let e=this.ctx;hr(e,this),this._draw(),gr(e)}}_draw(){let{options:e,columnSizes:t,lineWidths:n,ctx:r}=this,{align:i,labels:a}=e,o=B.color,s=Ai(e.rtl,this.left,this.width),c=H(a.font),{padding:l}=a,u=c.size,d=u/2,f;this.drawTitle(),r.textAlign=s.textAlign(`left`),r.textBaseline=`middle`,r.lineWidth=.5,r.font=c.string;let{boxWidth:p,boxHeight:m,itemHeight:h}=cl(a,u),g=function(e,t,n){if(isNaN(p)||p<=0||isNaN(m)||m<0)return;r.save();let i=M(n.lineWidth,1);if(r.fillStyle=M(n.fillStyle,o),r.lineCap=M(n.lineCap,`butt`),r.lineDashOffset=M(n.lineDashOffset,0),r.lineJoin=M(n.lineJoin,`miter`),r.lineWidth=i,r.strokeStyle=M(n.strokeStyle,o),r.setLineDash(M(n.lineDash,[])),a.usePointStyle){let o={radius:m*Math.SQRT2/2,pointStyle:n.pointStyle,rotation:n.rotation,borderWidth:i},c=s.xPlus(e,p/2),l=t+d;pr(r,o,c,l,a.pointStyleWidth&&p)}else{let a=t+Math.max((u-m)/2,0),o=s.leftForLtr(e,p),c=Ar(n.borderRadius);r.beginPath(),Object.values(c).some(e=>e!==0)?Cr(r,{x:o,y:a,w:p,h:m,radius:c}):r.rect(o,a,p,m),r.fill(),i!==0&&r.stroke()}r.restore()},_=function(e,t,n){Sr(r,n.text,e,t+h/2,c,{strikethrough:n.hidden,textAlign:s.textAlign(n.textAlign)})},v=this.isHorizontal(),y=this._computeTitleHeight();f=v?{x:Fn(i,this.left+l,this.right-n[0]),y:this.top+l+y,line:0}:{x:this.left+l,y:Fn(i,this.top+y+l,this.bottom-t[0].height),line:0},ji(this.ctx,e.textDirection);let b=h+l;this.legendItems.forEach((o,u)=>{r.strokeStyle=o.fontColor,r.fillStyle=o.fontColor;let m=r.measureText(o.text).width,h=s.textAlign(o.textAlign||=a.textAlign),x=p+d+m,S=f.x,C=f.y;s.setWidth(this.width),v?u>0&&S+x+l>this.right&&(C=f.y+=b,f.line++,S=f.x=Fn(i,this.left+l,this.right-n[f.line])):u>0&&C+b>this.bottom&&(S=f.x=S+t[f.line].width+l,f.line++,C=f.y=Fn(i,this.top+y+l,this.bottom-t[f.line].height));let w=s.x(S);if(g(w,C,o),S=In(h,S+p+d,v?S+x:this.right,e.rtl),_(s.x(S),C,o),v)f.x+=x+l;else if(typeof o.text!=`string`){let e=c.lineHeight;f.y+=ml(o,e)+l}else f.y+=b}),Mi(this.ctx,e.textDirection)}drawTitle(){let e=this.options,t=e.title,n=H(t.font),r=V(t.padding);if(!t.display)return;let i=Ai(e.rtl,this.left,this.width),a=this.ctx,o=t.position,s=n.size/2,c=r.top+s,l,u=this.left,d=this.width;if(this.isHorizontal())d=Math.max(...this.lineWidths),l=this.top+c,u=Fn(e.align,u,this.right-d);else{let t=this.columnSizes.reduce((e,t)=>Math.max(e,t.height),0);l=c+Fn(e.align,this.top,this.bottom-t-e.labels.padding-this._computeTitleHeight())}let f=Fn(o,u,u+d);a.textAlign=i.textAlign(Pn(o)),a.textBaseline=`middle`,a.strokeStyle=t.color,a.fillStyle=t.color,a.font=n.string,Sr(a,t.text,f,l,n)}_computeTitleHeight(){let e=this.options.title,t=H(e.font),n=V(e.padding);return e.display?t.lineHeight+n.height:0}_getLegendItemAt(e,t){let n,r,i;if(Sn(e,this.left,this.right)&&Sn(t,this.top,this.bottom)){for(i=this.legendHitBoxes,n=0;n<i.length;++n)if(r=i[n],Sn(e,r.left,r.left+r.width)&&Sn(t,r.top,r.top+r.height))return this.legendItems[n]}return null}handleEvent(e){let t=this.options;if(!hl(e.type,t))return;let n=this._getLegendItemAt(e.x,e.y);if(e.type===`mousemove`||e.type===`mouseout`){let r=this._hoveredItem,i=ll(r,n);r&&!i&&N(t.onLeave,[e,r,this],this),this._hoveredItem=n,n&&!i&&N(t.onHover,[e,n,this],this)}else n&&N(t.onClick,[e,n,this],this)}};function dl(e,t,n,r,i){return{itemWidth:fl(r,e,t,n),itemHeight:pl(i,r,t.lineHeight)}}function fl(e,t,n,r){let i=e.text;return i&&typeof i!=`string`&&(i=i.reduce((e,t)=>e.length>t.length?e:t)),t+n.size/2+r.measureText(i).width}function pl(e,t,n){let r=e;return typeof t.text!=`string`&&(r=ml(t,n)),r}function ml(e,t){return t*(e.text?e.text.length:0)}function hl(e,t){return!!((e===`mousemove`||e===`mouseout`)&&(t.onHover||t.onLeave)||t.onClick&&(e===`click`||e===`mouseup`))}var gl={id:`legend`,_element:ul,start(e,t,n){let r=e.legend=new ul({ctx:e.ctx,options:n,chart:e});go.configure(e,r,n),go.addBox(e,r)},stop(e){go.removeBox(e,e.legend),delete e.legend},beforeUpdate(e,t,n){let r=e.legend;go.configure(e,r,n),r.options=n},afterUpdate(e){let t=e.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(e,t){t.replay||e.legend.handleEvent(t.event)},defaults:{display:!0,position:`top`,align:`center`,fullSize:!0,reverse:!1,weight:1e3,onClick(e,t,n){let r=t.datasetIndex,i=n.chart;i.isDatasetVisible(r)?(i.hide(r),t.hidden=!0):(i.show(r),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:e=>e.chart.options.color,boxWidth:40,padding:10,generateLabels(e){let t=e.data.datasets,{labels:{usePointStyle:n,pointStyle:r,textAlign:i,color:a,useBorderRadius:o,borderRadius:s}}=e.legend.options;return e._getSortedDatasetMetas().map(e=>{let c=e.controller.getStyle(n?0:void 0),l=V(c.borderWidth);return{text:t[e.index].label,fillStyle:c.backgroundColor,fontColor:a,hidden:!e.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(l.width+l.height)/4,strokeStyle:c.borderColor,pointStyle:r||c.pointStyle,rotation:c.rotation,textAlign:i||c.textAlign,borderRadius:o&&(s||c.borderRadius),datasetIndex:e.index}},this)}},title:{color:e=>e.chart.options.color,display:!1,position:`center`,text:``}},descriptors:{_scriptable:e=>!e.startsWith(`on`),labels:{_scriptable:e=>![`generateLabels`,`filter`,`sort`].includes(e)}}};let _l={average(e){if(!e.length)return!1;let t,n,r=/* @__PURE__ */ new Set,i=0,a=0;for(t=0,n=e.length;t<n;++t){let n=e[t].element;if(n&&n.hasValue()){let e=n.tooltipPosition();r.add(e.x),i+=e.y,++a}}return a===0||r.size===0?!1:{x:[...r].reduce((e,t)=>e+t)/r.size,y:i/a}},nearest(e,t){if(!e.length)return!1;let n=t.x,r=t.y,i=1/0,a,o,s;for(a=0,o=e.length;a<o;++a){let n=e[a].element;if(n&&n.hasValue()){let e=vn(t,n.getCenterPoint());e<i&&(i=e,s=n)}}if(s){let e=s.tooltipPosition();n=e.x,r=e.y}return{x:n,y:r}}};function vl(e,t){return t&&(k(t)?Array.prototype.push.apply(e,t):e.push(t)),e}function yl(e){return(typeof e==`string`||e instanceof String)&&e.indexOf(`
|
|
77
77
|
`)>-1?e.split(`
|
|
78
|
-
`):e}function bl(e,t){let{element:n,datasetIndex:r,index:i}=t,a=e.getDatasetMeta(r).controller,{label:o,value:s}=a.getLabelAndValue(i);return{chart:e,label:o,parsed:a.getParsed(i),raw:e.data.datasets[r].data[i],formattedValue:s,dataset:a.getDataset(),dataIndex:i,datasetIndex:r,element:n}}function xl(e,t){let n=e.chart.ctx,{body:r,footer:i,title:a}=e,{boxWidth:o,boxHeight:s}=t,c=H(t.bodyFont),l=H(t.titleFont),u=H(t.footerFont),d=a.length,f=i.length,p=r.length,m=V(t.padding),h=m.height,g=0,_=r.reduce((e,t)=>e+t.before.length+t.lines.length+t.after.length,0);if(_+=e.beforeBody.length+e.afterBody.length,d&&(h+=d*l.lineHeight+(d-1)*t.titleSpacing+t.titleMarginBottom),_){let e=t.displayColors?Math.max(s,c.lineHeight):c.lineHeight;h+=p*e+(_-p)*c.lineHeight+(_-1)*t.bodySpacing}f&&(h+=t.footerMarginTop+f*u.lineHeight+(f-1)*t.footerSpacing);let v=0,y=function(e){g=Math.max(g,n.measureText(e).width+v)};return n.save(),n.font=l.string,P(e.title,y),n.font=c.string,P(e.beforeBody.concat(e.afterBody),y),v=t.displayColors?o+2+t.boxPadding:0,P(r,e=>{P(e.before,y),P(e.lines,y),P(e.after,y)}),v=0,n.font=u.string,P(e.footer,y),n.restore(),g+=m.width,{width:g,height:h}}function Sl(e,t){let{y:n,height:r}=t;return n<r/2?`top`:n>e.height-r/2?`bottom`:`center`}function Cl(e,t,n,r){let{x:i,width:a}=r,o=n.caretSize+n.caretPadding;if(e===`left`&&i+a+o>t.width||e===`right`&&i-a-o<0)return!0}function wl(e,t,n,r){let{x:i,width:a}=n,{width:o,chartArea:{left:s,right:c}}=e,l=`center`;return r===`center`?l=i<=(s+c)/2?`left`:`right`:i<=a/2?l=`left`:i>=o-a/2&&(l=`right`),Cl(l,e,t,n)&&(l=`center`),l}function Tl(e,t,n){let r=n.yAlign||t.yAlign||Sl(e,n);return{xAlign:n.xAlign||t.xAlign||wl(e,t,n,r),yAlign:r}}function El(e,t){let{x:n,width:r}=e;return t===`right`?n-=r:t===`center`&&(n-=r/2),n}function Dl(e,t,n){let{y:r,height:i}=e;return t===`top`?r+=n:r-=t===`bottom`?i+n:i/2,r}function Ol(e,t,n,r){let{caretSize:i,caretPadding:a,cornerRadius:o}=e,{xAlign:s,yAlign:c}=n,l=i+a,{topLeft:u,topRight:d,bottomLeft:f,bottomRight:p}=Ar(o),m=El(t,s),h=Dl(t,c,l);return c===`center`?s===`left`?m+=l:s===`right`&&(m-=l):s===`left`?m-=Math.max(u,f)+i:s===`right`&&(m+=Math.max(d,p)+i),{x:z(m,0,r.width-t.width),y:z(h,0,r.height-t.height)}}function kl(e,t,n){let r=V(n.padding);return t===`center`?e.x+e.width/2:t===`right`?e.x+e.width-r.right:e.x+r.left}function Al(e){return vl([],yl(e))}function jl(e,t,n){return Nr(e,{tooltip:t,tooltipItems:n,type:`tooltip`})}function Ml(e,t){let n=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return n?e.override(n):e}let Nl={beforeTitle:Mt,title(e){if(e.length>0){let t=e[0],n=t.chart.data.labels,r=n?n.length:0;if(this&&this.options&&this.options.mode===`dataset`)return t.dataset.label||``;if(t.label)return t.label;if(r>0&&t.dataIndex<r)return n[t.dataIndex]}return``},afterTitle:Mt,beforeBody:Mt,beforeLabel:Mt,label(e){if(this&&this.options&&this.options.mode===`dataset`)return e.label+`: `+e.formattedValue||e.formattedValue;let t=e.dataset.label||``;t&&(t+=`: `);let n=e.formattedValue;return O(n)||(t+=n),t},labelColor(e){let t=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{borderColor:t.borderColor,backgroundColor:t.backgroundColor,borderWidth:t.borderWidth,borderDash:t.borderDash,borderDashOffset:t.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(e){let t=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{pointStyle:t.pointStyle,rotation:t.rotation}},afterLabel:Mt,afterBody:Mt,beforeFooter:Mt,footer:Mt,afterFooter:Mt};function Pl(e,t,n,r){let i=e[t].call(n,r);return i===void 0?Nl[t].call(n,r):i}var Fl=class extends Bo{static positioners=_l;constructor(e){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=e.chart,this.options=e.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(e){this.options=e,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){let e=this._cachedAnimations;if(e)return e;let t=this.chart,n=this.options.setContext(this.getContext()),r=n.enabled&&t.options.animation&&n.animations,i=new Qi(this.chart,r);return r._cacheable&&(this._cachedAnimations=Object.freeze(i)),i}getContext(){return this.$context||=jl(this.chart.getContext(),this,this._tooltipItems)}getTitle(e,t){let{callbacks:n}=t,r=Pl(n,`beforeTitle`,this,e),i=Pl(n,`title`,this,e),a=Pl(n,`afterTitle`,this,e),o=[];return o=vl(o,yl(r)),o=vl(o,yl(i)),o=vl(o,yl(a)),o}getBeforeBody(e,t){return Al(Pl(t.callbacks,`beforeBody`,this,e))}getBody(e,t){let{callbacks:n}=t,r=[];return P(e,e=>{let t={before:[],lines:[],after:[]},i=Ml(n,e);vl(t.before,yl(Pl(i,`beforeLabel`,this,e))),vl(t.lines,Pl(i,`label`,this,e)),vl(t.after,yl(Pl(i,`afterLabel`,this,e))),r.push(t)}),r}getAfterBody(e,t){return Al(Pl(t.callbacks,`afterBody`,this,e))}getFooter(e,t){let{callbacks:n}=t,r=Pl(n,`beforeFooter`,this,e),i=Pl(n,`footer`,this,e),a=Pl(n,`afterFooter`,this,e),o=[];return o=vl(o,yl(r)),o=vl(o,yl(i)),o=vl(o,yl(a)),o}_createItems(e){let t=this._active,n=this.chart.data,r=[],i=[],a=[],o=[],s,c;for(s=0,c=t.length;s<c;++s)o.push(bl(this.chart,t[s]));return e.filter&&(o=o.filter((t,r,i)=>e.filter(t,r,i,n))),e.itemSort&&(o=o.sort((t,r)=>e.itemSort(t,r,n))),P(o,t=>{let n=Ml(e.callbacks,t);r.push(Pl(n,`labelColor`,this,t)),i.push(Pl(n,`labelPointStyle`,this,t)),a.push(Pl(n,`labelTextColor`,this,t))}),this.labelColors=r,this.labelPointStyles=i,this.labelTextColors=a,this.dataPoints=o,o}update(e,t){let n=this.options.setContext(this.getContext()),r=this._active,i,a=[];if(!r.length)this.opacity!==0&&(i={opacity:0});else{let e=_l[n.position].call(this,r,this._eventPosition);a=this._createItems(n),this.title=this.getTitle(a,n),this.beforeBody=this.getBeforeBody(a,n),this.body=this.getBody(a,n),this.afterBody=this.getAfterBody(a,n),this.footer=this.getFooter(a,n);let t=this._size=xl(this,n),o=Object.assign({},e,t),s=Tl(this.chart,n,o),c=Ol(n,o,s,this.chart);this.xAlign=s.xAlign,this.yAlign=s.yAlign,i={opacity:1,x:c.x,y:c.y,width:t.width,height:t.height,caretX:e.x,caretY:e.y}}this._tooltipItems=a,this.$context=void 0,i&&this._resolveAnimations().update(this,i),e&&n.external&&n.external.call(this,{chart:this.chart,tooltip:this,replay:t})}drawCaret(e,t,n,r){let i=this.getCaretPosition(e,n,r);t.lineTo(i.x1,i.y1),t.lineTo(i.x2,i.y2),t.lineTo(i.x3,i.y3)}getCaretPosition(e,t,n){let{xAlign:r,yAlign:i}=this,{caretSize:a,cornerRadius:o}=n,{topLeft:s,topRight:c,bottomLeft:l,bottomRight:u}=Ar(o),{x:d,y:f}=e,{width:p,height:m}=t,h,g,_,v,y,b;return i===`center`?(y=f+m/2,r===`left`?(h=d,g=h-a,v=y+a,b=y-a):(h=d+p,g=h+a,v=y-a,b=y+a),_=h):(g=r===`left`?d+Math.max(s,l)+a:r===`right`?d+p-Math.max(c,u)-a:this.caretX,i===`top`?(v=f,y=v-a,h=g-a,_=g+a):(v=f+m,y=v+a,h=g+a,_=g-a),b=v),{x1:h,x2:g,x3:_,y1:v,y2:y,y3:b}}drawTitle(e,t,n){let r=this.title,i=r.length,a,o,s;if(i){let c=Ai(n.rtl,this.x,this.width);for(e.x=kl(this,n.titleAlign,n),t.textAlign=c.textAlign(n.titleAlign),t.textBaseline=`middle`,a=H(n.titleFont),o=n.titleSpacing,t.fillStyle=n.titleColor,t.font=a.string,s=0;s<i;++s)t.fillText(r[s],c.x(e.x),e.y+a.lineHeight/2),e.y+=a.lineHeight+o,s+1===i&&(e.y+=n.titleMarginBottom-o)}}_drawColorBox(e,t,n,r,i){let a=this.labelColors[n],o=this.labelPointStyles[n],{boxHeight:s,boxWidth:c}=i,l=H(i.bodyFont),u=kl(this,`left`,i),d=r.x(u),f=s<l.lineHeight?(l.lineHeight-s)/2:0,p=t.y+f;if(i.usePointStyle){let t={radius:Math.min(c,s)/2,pointStyle:o.pointStyle,rotation:o.rotation,borderWidth:1},n=r.leftForLtr(d,c)+c/2,l=p+s/2;e.strokeStyle=i.multiKeyBackground,e.fillStyle=i.multiKeyBackground,fr(e,t,n,l),e.strokeStyle=a.borderColor,e.fillStyle=a.backgroundColor,fr(e,t,n,l)}else{e.lineWidth=A(a.borderWidth)?Math.max(...Object.values(a.borderWidth)):a.borderWidth||1,e.strokeStyle=a.borderColor,e.setLineDash(a.borderDash||[]),e.lineDashOffset=a.borderDashOffset||0;let t=r.leftForLtr(d,c),n=r.leftForLtr(r.xPlus(d,1),c-2),o=Ar(a.borderRadius);Object.values(o).some(e=>e!==0)?(e.beginPath(),e.fillStyle=i.multiKeyBackground,Cr(e,{x:t,y:p,w:c,h:s,radius:o}),e.fill(),e.stroke(),e.fillStyle=a.backgroundColor,e.beginPath(),Cr(e,{x:n,y:p+1,w:c-2,h:s-2,radius:o}),e.fill()):(e.fillStyle=i.multiKeyBackground,e.fillRect(t,p,c,s),e.strokeRect(t,p,c,s),e.fillStyle=a.backgroundColor,e.fillRect(n,p+1,c-2,s-2))}e.fillStyle=this.labelTextColors[n]}drawBody(e,t,n){let{body:r}=this,{bodySpacing:i,bodyAlign:a,displayColors:o,boxHeight:s,boxWidth:c,boxPadding:l}=n,u=H(n.bodyFont),d=u.lineHeight,f=0,p=Ai(n.rtl,this.x,this.width),m=function(n){t.fillText(n,p.x(e.x+f),e.y+d/2),e.y+=d+i},h=p.textAlign(a),g,_,v,y,b,x,S;for(t.textAlign=a,t.textBaseline=`middle`,t.font=u.string,e.x=kl(this,h,n),t.fillStyle=n.bodyColor,P(this.beforeBody,m),f=o&&h!==`right`?a===`center`?c/2+l:c+2+l:0,y=0,x=r.length;y<x;++y){for(g=r[y],_=this.labelTextColors[y],t.fillStyle=_,P(g.before,m),v=g.lines,o&&v.length&&(this._drawColorBox(t,e,y,p,n),d=Math.max(u.lineHeight,s)),b=0,S=v.length;b<S;++b)m(v[b]),d=u.lineHeight;P(g.after,m)}f=0,d=u.lineHeight,P(this.afterBody,m),e.y-=i}drawFooter(e,t,n){let r=this.footer,i=r.length,a,o;if(i){let s=Ai(n.rtl,this.x,this.width);for(e.x=kl(this,n.footerAlign,n),e.y+=n.footerMarginTop,t.textAlign=s.textAlign(n.footerAlign),t.textBaseline=`middle`,a=H(n.footerFont),t.fillStyle=n.footerColor,t.font=a.string,o=0;o<i;++o)t.fillText(r[o],s.x(e.x),e.y+a.lineHeight/2),e.y+=a.lineHeight+n.footerSpacing}}drawBackground(e,t,n,r){let{xAlign:i,yAlign:a}=this,{x:o,y:s}=e,{width:c,height:l}=n,{topLeft:u,topRight:d,bottomLeft:f,bottomRight:p}=Ar(r.cornerRadius);t.fillStyle=r.backgroundColor,t.strokeStyle=r.borderColor,t.lineWidth=r.borderWidth,t.beginPath(),t.moveTo(o+u,s),a===`top`&&this.drawCaret(e,t,n,r),t.lineTo(o+c-d,s),t.quadraticCurveTo(o+c,s,o+c,s+d),a===`center`&&i===`right`&&this.drawCaret(e,t,n,r),t.lineTo(o+c,s+l-p),t.quadraticCurveTo(o+c,s+l,o+c-p,s+l),a===`bottom`&&this.drawCaret(e,t,n,r),t.lineTo(o+f,s+l),t.quadraticCurveTo(o,s+l,o,s+l-f),a===`center`&&i===`left`&&this.drawCaret(e,t,n,r),t.lineTo(o,s+u),t.quadraticCurveTo(o,s,o+u,s),t.closePath(),t.fill(),r.borderWidth>0&&t.stroke()}_updateAnimationTarget(e){let t=this.chart,n=this.$animations,r=n&&n.x,i=n&&n.y;if(r||i){let n=_l[e.position].call(this,this._active,this._eventPosition);if(!n)return;let a=this._size=xl(this,e),o=Object.assign({},n,this._size),s=Tl(t,e,o),c=Ol(e,o,s,t);(r._to!==c.x||i._to!==c.y)&&(this.xAlign=s.xAlign,this.yAlign=s.yAlign,this.width=a.width,this.height=a.height,this.caretX=n.x,this.caretY=n.y,this._resolveAnimations().update(this,c))}}_willRender(){return!!this.opacity}draw(e){let t=this.options.setContext(this.getContext()),n=this.opacity;if(!n)return;this._updateAnimationTarget(t);let r={width:this.width,height:this.height},i={x:this.x,y:this.y};n=Math.abs(n)<.001?0:n;let a=V(t.padding),o=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;t.enabled&&o&&(e.save(),e.globalAlpha=n,this.drawBackground(i,e,r,t),ji(e,t.textDirection),i.y+=a.top,this.drawTitle(i,e,t),this.drawBody(i,e,t),this.drawFooter(i,e,t),Mi(e,t.textDirection),e.restore())}getActiveElements(){return this._active||[]}setActiveElements(e,t){let n=this._active,r=e.map(({datasetIndex:e,index:t})=>{let n=this.chart.getDatasetMeta(e);if(!n)throw Error(`Cannot find a dataset at index `+e);return{datasetIndex:e,element:n.data[t],index:t}}),i=!Lt(n,r),a=this._positionChanged(r,t);(i||a)&&(this._active=r,this._eventPosition=t,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(e,t,n=!0){if(t&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;let r=this.options,i=this._active||[],a=this._getActiveElements(e,i,t,n),o=this._positionChanged(a,e),s=t||!Lt(a,i)||o;return s&&(this._active=a,(r.enabled||r.external)&&(this._eventPosition={x:e.x,y:e.y},this.update(!0,t))),s}_getActiveElements(e,t,n,r){let i=this.options;if(e.type===`mouseout`)return[];if(!r)return t.filter(e=>this.chart.data.datasets[e.datasetIndex]&&this.chart.getDatasetMeta(e.datasetIndex).controller.getParsed(e.index)!==void 0);let a=this.chart.getElementsAtEventForMode(e,i.mode,i,n);return i.reverse&&a.reverse(),a}_positionChanged(e,t){let{caretX:n,caretY:r,options:i}=this,a=_l[i.position].call(this,e,t);return a!==!1&&(n!==a.x||r!==a.y)}},Il={id:`tooltip`,_element:Fl,positioners:_l,afterInit(e,t,n){n&&(e.tooltip=new Fl({chart:e,options:n}))},beforeUpdate(e,t,n){e.tooltip&&e.tooltip.initialize(n)},reset(e,t,n){e.tooltip&&e.tooltip.initialize(n)},afterDraw(e){let t=e.tooltip;if(t&&t._willRender()){let n={tooltip:t};if(e.notifyPlugins(`beforeTooltipDraw`,{...n,cancelable:!0})===!1)return;t.draw(e.ctx),e.notifyPlugins(`afterTooltipDraw`,n)}},afterEvent(e,t){if(e.tooltip){let n=t.replay;e.tooltip.handleEvent(t.event,n,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:(e,t)=>t.bodyFont.size,boxWidth:(e,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:Nl},defaultRoutes:{bodyFont:`font`,footerFont:`font`,titleFont:`font`},descriptors:{_scriptable:e=>e!==`filter`&&e!==`itemSort`&&e!==`external`,_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:`animation`}},additionalOptionScopes:[`interaction`]};let Ll=(e,t,n,r)=>(typeof t==`string`?(n=e.push(t)-1,r.unshift({index:n,label:t})):isNaN(t)&&(n=null),n);function Rl(e,t,n,r){let i=e.indexOf(t);return i===-1?Ll(e,t,n,r):i===e.lastIndexOf(t)?i:n}let zl=(e,t)=>e===null?null:z(Math.round(e),0,t);function Bl(e){let t=this.getLabels();return e>=0&&e<t.length?t[e]:e}var Vl=class extends os{static id=`category`;static defaults={ticks:{callback:Bl}};constructor(e){super(e),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(e){let t=this._addedLabels;if(t.length){let e=this.getLabels();for(let{index:n,label:r}of t)e[n]===r&&e.splice(n,1);this._addedLabels=[]}super.init(e)}parse(e,t){if(O(e))return null;let n=this.getLabels();return t=isFinite(t)&&n[t]===e?t:Rl(n,e,M(t,e),this._addedLabels),zl(t,n.length-1)}determineDataLimits(){let{minDefined:e,maxDefined:t}=this.getUserBounds(),{min:n,max:r}=this.getMinMax(!0);this.options.bounds===`ticks`&&(e||(n=0),t||(r=this.getLabels().length-1)),this.min=n,this.max=r}buildTicks(){let e=this.min,t=this.max,n=this.options.offset,r=[],i=this.getLabels();i=e===0&&t===i.length-1?i:i.slice(e,t+1),this._valueRange=Math.max(i.length-+!n,1),this._startValue=this.min-(n?.5:0);for(let n=e;n<=t;n++)r.push({value:n});return r}getLabelForValue(e){return Bl.call(this,e)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(e){return typeof e!=`number`&&(e=this.parse(e)),e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getPixelForTick(e){let t=this.ticks;return e<0||e>t.length-1?null:this.getPixelForValue(t[e].value)}getValueForPixel(e){return Math.round(this._startValue+this.getDecimalForPixel(e)*this._valueRange)}getBasePixel(){return this.bottom}};function Hl(e,t){let n=[],{bounds:r,step:i,min:a,max:o,precision:s,count:c,maxTicks:l,maxDigits:u,includeBounds:d}=e,f=i||1,p=l-1,{min:m,max:h}=t,g=!O(a),_=!O(o),v=!O(c),y=(h-m)/(u+1),b=cn((h-m)/p/f)*f,x,S,C,w;if(b<1e-14&&!g&&!_)return[{value:m},{value:h}];w=Math.ceil(h/b)-Math.floor(m/b),w>p&&(b=cn(w*b/p/f)*f),O(s)||(x=10**s,b=Math.ceil(b*x)/x),r===`ticks`?(S=Math.floor(m/b)*b,C=Math.ceil(h/b)*b):(S=m,C=h),g&&_&&i&&fn((o-a)/i,b/1e3)?(w=Math.round(Math.min((o-a)/b,l)),b=(o-a)/w,S=a,C=o):v?(S=g?a:S,C=_?o:C,w=c-1,b=(C-S)/w):(w=(C-S)/b,w=sn(w,Math.round(w),b/1e3)?Math.round(w):Math.ceil(w));let T=Math.max(gn(b),gn(S));x=10**(O(s)?T:s),S=Math.round(S*x)/x,C=Math.round(C*x)/x;let E=0;for(g&&(d&&S!==a?(n.push({value:a}),S<a&&E++,sn(Math.round((S+E*b)*x)/x,a,Ul(a,y,e))&&E++):S<a&&E++);E<w;++E){let e=Math.round((S+E*b)*x)/x;if(_&&e>o)break;n.push({value:e})}return _&&d&&C!==o?n.length&&sn(n[n.length-1].value,o,Ul(o,y,e))?n[n.length-1].value=o:n.push({value:o}):_&&C!==o||n.push({value:C}),n}function Ul(e,t,{horizontal:n,minRotation:r}){let i=mn(r),a=(n?Math.sin(i):Math.cos(i))||.001,o=.75*t*(``+e).length;return Math.min(t/a,o)}var Wl=class extends os{constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(e,t){return O(e)||(typeof e==`number`||e instanceof Number)&&!isFinite(+e)?null:+e}handleTickRangeOptions(){let{beginAtZero:e}=this.options,{minDefined:t,maxDefined:n}=this.getUserBounds(),{min:r,max:i}=this,a=e=>r=t?r:e,o=e=>i=n?i:e;if(e){let e=on(r),t=on(i);e<0&&t<0?o(0):e>0&&t>0&&a(0)}if(r===i){let t=i===0?1:Math.abs(i*.05);o(i+t),e||a(r-t)}this.min=r,this.max=i}getTickLimit(){let{maxTicksLimit:e,stepSize:t}=this.options.ticks,n;return t?(n=Math.ceil(this.max/t)-Math.floor(this.min/t)+1,n>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${t} would result generating up to ${n} ticks. Limiting to 1000.`),n=1e3)):(n=this.computeTickLimit(),e||=11),e&&(n=Math.min(e,n)),n}computeTickLimit(){return 1/0}buildTicks(){let e=this.options,t=e.ticks,n=this.getTickLimit();n=Math.max(2,n);let r=Hl({maxTicks:n,bounds:e.bounds,min:e.min,max:e.max,precision:t.precision,step:t.stepSize,count:t.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:t.minRotation||0,includeBounds:t.includeBounds!==!1},this._range||this);return e.bounds===`ticks`&&pn(r,this,`value`),e.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}configure(){let e=this.ticks,t=this.min,n=this.max;if(super.configure(),this.options.offset&&e.length){let r=(n-t)/Math.max(e.length-1,1)/2;t-=r,n+=r}this._startValue=t,this._endValue=n,this._valueRange=n-t}getLabelForValue(e){return Qn(e,this.chart.options.locale,this.options.ticks.format)}},Gl=class extends Wl{static id=`linear`;static defaults={ticks:{callback:tr.formatters.numeric}};determineDataLimits(){let{min:e,max:t}=this.getMinMax(!0);this.min=j(e)?e:0,this.max=j(t)?t:1,this.handleTickRangeOptions()}computeTickLimit(){let e=this.isHorizontal(),t=e?this.width:this.height,n=mn(this.options.ticks.minRotation),r=(e?Math.sin(n):Math.cos(n))||.001,i=this._resolveTickFontOptions(0);return Math.ceil(t/Math.min(40,i.lineHeight/r))}getPixelForValue(e){return e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getValueForPixel(e){return this._startValue+this.getDecimalForPixel(e)*this._valueRange}};let Kl=e=>Math.floor(an(e)),ql=(e,t)=>10**(Kl(e)+t);function Jl(e){return e/10**Kl(e)==1}function Yl(e,t,n){let r=10**n,i=Math.floor(e/r);return Math.ceil(t/r)-i}function Xl(e,t){let n=t-e,r=Kl(n);for(;Yl(e,t,r)>10;)r++;for(;Yl(e,t,r)<10;)r--;return Math.min(r,Kl(e))}function Zl(e,{min:t,max:n}){t=Pt(e.min,t);let r=[],i=Kl(t),a=Xl(t,n),o=a<0?10**Math.abs(a):1,s=10**a,c=i>a?10**i:0,l=Math.round((t-c)*o)/o,u=Math.floor((t-c)/s/10)*s*10,d=Math.floor((l-u)/10**a),f=Pt(e.min,Math.round((c+u+d*10**a)*o)/o);for(;f<n;)r.push({value:f,major:Jl(f),significand:d}),d>=10?d=d<15?15:20:d++,d>=20&&(a++,d=2,o=a>=0?1:o),f=Math.round((c+u+d*10**a)*o)/o;let p=Pt(e.max,f);return r.push({value:p,major:Jl(p),significand:d}),r}(class extends os{static id=`logarithmic`;static defaults={ticks:{callback:tr.formatters.logarithmic,major:{enabled:!0}}};constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(e,t){let n=Wl.prototype.parse.apply(this,[e,t]);if(n===0)this._zero=!0;else return j(n)&&n>0?n:null}determineDataLimits(){let{min:e,max:t}=this.getMinMax(!0);this.min=j(e)?Math.max(0,e):null,this.max=j(t)?Math.max(0,t):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!j(this._userMin)&&(this.min=e===ql(this.min,0)?ql(this.min,-1):ql(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){let{minDefined:e,maxDefined:t}=this.getUserBounds(),n=this.min,r=this.max,i=t=>n=e?n:t,a=e=>r=t?r:e;n===r&&(n<=0?(i(1),a(10)):(i(ql(n,-1)),a(ql(r,1)))),n<=0&&i(ql(r,-1)),r<=0&&a(ql(n,1)),this.min=n,this.max=r}buildTicks(){let e=this.options,t=Zl({min:this._userMin,max:this._userMax},this);return e.bounds===`ticks`&&pn(t,this,`value`),e.reverse?(t.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),t}getLabelForValue(e){return e===void 0?`0`:Qn(e,this.chart.options.locale,this.options.ticks.format)}configure(){let e=this.min;super.configure(),this._startValue=an(e),this._valueRange=an(this.max)-an(e)}getPixelForValue(e){return(e===void 0||e===0)&&(e=this.min),e===null||isNaN(e)?NaN:this.getPixelForDecimal(e===this.min?0:(an(e)-this._startValue)/this._valueRange)}getValueForPixel(e){let t=this.getDecimalForPixel(e);return 10**(this._startValue+t*this._valueRange)}});function Ql(e){let t=e.ticks;if(t.display&&e.display){let e=V(t.backdropPadding);return M(t.font&&t.font.size,B.font.size)+e.height}return 0}function $l(e,t,n){return n=k(n)?n:[n],{w:lr(e,t.string,n),h:n.length*t.lineHeight}}function eu(e,t,n,r,i){return e===r||e===i?{start:t-n/2,end:t+n/2}:e<r||e>i?{start:t-n,end:t}:{start:t,end:t+n}}function tu(e){let t={l:e.left+e._padding.left,r:e.right-e._padding.right,t:e.top+e._padding.top,b:e.bottom-e._padding.bottom},n=Object.assign({},t),r=[],i=[],a=e._pointLabels.length,o=e.options.pointLabels,s=o.centerPointLabels?F/a:0;for(let c=0;c<a;c++){let a=o.setContext(e.getPointLabelContext(c));i[c]=a.padding;let l=e.getPointPosition(c,e.drawingArea+i[c],s),u=H(a.font),d=$l(e.ctx,u,e._pointLabels[c]);r[c]=d;let f=R(e.getIndexAngle(c)+s),p=Math.round(hn(f));nu(n,t,f,eu(p,l.x,d.w,0,180),eu(p,l.y,d.h,90,270))}e.setCenterPoint(t.l-n.l,n.r-t.r,t.t-n.t,n.b-t.b),e._pointLabelItems=au(e,r,i)}function nu(e,t,n,r,i){let a=Math.abs(Math.sin(n)),o=Math.abs(Math.cos(n)),s=0,c=0;r.start<t.l?(s=(t.l-r.start)/a,e.l=Math.min(e.l,t.l-s)):r.end>t.r&&(s=(r.end-t.r)/a,e.r=Math.max(e.r,t.r+s)),i.start<t.t?(c=(t.t-i.start)/o,e.t=Math.min(e.t,t.t-c)):i.end>t.b&&(c=(i.end-t.b)/o,e.b=Math.max(e.b,t.b+c))}function ru(e,t,n){let r=e.drawingArea,{extra:i,additionalAngle:a,padding:o,size:s}=n,c=e.getPointPosition(t,r+i+o,a),l=Math.round(hn(R(c.angle+L))),u=cu(c.y,s.h,l),d=ou(l),f=su(c.x,s.w,d);return{visible:!0,x:c.x,y:u,textAlign:d,left:f,top:u,right:f+s.w,bottom:u+s.h}}function iu(e,t){if(!t)return!0;let{left:n,top:r,right:i,bottom:a}=e;return!(mr({x:n,y:r},t)||mr({x:n,y:a},t)||mr({x:i,y:r},t)||mr({x:i,y:a},t))}function au(e,t,n){let r=[],i=e._pointLabels.length,a=e.options,{centerPointLabels:o,display:s}=a.pointLabels,c={extra:Ql(a)/2,additionalAngle:o?F/i:0},l;for(let a=0;a<i;a++){c.padding=n[a],c.size=t[a];let i=ru(e,a,c);r.push(i),s===`auto`&&(i.visible=iu(i,l),i.visible&&(l=i))}return r}function ou(e){return e===0||e===180?`center`:e<180?`left`:`right`}function su(e,t,n){return n===`right`?e-=t:n===`center`&&(e-=t/2),e}function cu(e,t,n){return n===90||n===270?e-=t/2:(n>270||n<90)&&(e-=t),e}function lu(e,t,n){let{left:r,top:i,right:a,bottom:o}=n,{backdropColor:s}=t;if(!O(s)){let n=Ar(t.borderRadius),c=V(t.backdropPadding);e.fillStyle=s;let l=r-c.left,u=i-c.top,d=a-r+c.width,f=o-i+c.height;Object.values(n).some(e=>e!==0)?(e.beginPath(),Cr(e,{x:l,y:u,w:d,h:f,radius:n}),e.fill()):e.fillRect(l,u,d,f)}}function uu(e,t){let{ctx:n,options:{pointLabels:r}}=e;for(let i=t-1;i>=0;i--){let t=e._pointLabelItems[i];if(!t.visible)continue;let a=r.setContext(e.getPointLabelContext(i));lu(n,a,t);let o=H(a.font),{x:s,y:c,textAlign:l}=t;Sr(n,e._pointLabels[i],s,c+o.lineHeight/2,o,{color:a.color,textAlign:l,textBaseline:`middle`})}}function du(e,t,n,r){let{ctx:i}=e;if(n)i.arc(e.xCenter,e.yCenter,t,0,I);else{let n=e.getPointPosition(0,t);i.moveTo(n.x,n.y);for(let a=1;a<r;a++)n=e.getPointPosition(a,t),i.lineTo(n.x,n.y)}}function fu(e,t,n,r,i){let a=e.ctx,o=t.circular,{color:s,lineWidth:c}=t;!o&&!r||!s||!c||n<0||(a.save(),a.strokeStyle=s,a.lineWidth=c,a.setLineDash(i.dash||[]),a.lineDashOffset=i.dashOffset,a.beginPath(),du(e,n,o,r),a.closePath(),a.stroke(),a.restore())}function pu(e,t,n){return Nr(e,{label:n,index:t,type:`pointLabel`})}(class extends Wl{static id=`radialLinear`;static defaults={display:!0,animate:!0,position:`chartArea`,angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:tr.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(e){return e},padding:5,centerPointLabels:!1}};static defaultRoutes={"angleLines.color":`borderColor`,"pointLabels.color":`color`,"ticks.color":`color`};static descriptors={angleLines:{_fallback:`grid`}};constructor(e){super(e),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){let e=this._padding=V(Ql(this.options)/2),t=this.width=this.maxWidth-e.width,n=this.height=this.maxHeight-e.height;this.xCenter=Math.floor(this.left+t/2+e.left),this.yCenter=Math.floor(this.top+n/2+e.top),this.drawingArea=Math.floor(Math.min(t,n)/2)}determineDataLimits(){let{min:e,max:t}=this.getMinMax(!1);this.min=j(e)&&!isNaN(e)?e:0,this.max=j(t)&&!isNaN(t)?t:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/Ql(this.options))}generateTickLabels(e){Wl.prototype.generateTickLabels.call(this,e),this._pointLabels=this.getLabels().map((e,t)=>{let n=N(this.options.pointLabels.callback,[e,t],this);return n||n===0?n:``}).filter((e,t)=>this.chart.getDataVisibility(t))}fit(){let e=this.options;e.display&&e.pointLabels.display?tu(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(e,t,n,r){this.xCenter+=Math.floor((e-t)/2),this.yCenter+=Math.floor((n-r)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(e,t,n,r))}getIndexAngle(e){let t=I/(this._pointLabels.length||1),n=this.options.startAngle||0;return R(e*t+mn(n))}getDistanceFromCenterForValue(e){if(O(e))return NaN;let t=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-e)*t:(e-this.min)*t}getValueForDistanceFromCenter(e){if(O(e))return NaN;let t=e/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-t:this.min+t}getPointLabelContext(e){let t=this._pointLabels||[];if(e>=0&&e<t.length){let n=t[e];return pu(this.getContext(),e,n)}}getPointPosition(e,t,n=0){let r=this.getIndexAngle(e)-L+n;return{x:Math.cos(r)*t+this.xCenter,y:Math.sin(r)*t+this.yCenter,angle:r}}getPointPositionForValue(e,t){return this.getPointPosition(e,this.getDistanceFromCenterForValue(t))}getBasePosition(e){return this.getPointPositionForValue(e||0,this.getBaseValue())}getPointLabelPosition(e){let{left:t,top:n,right:r,bottom:i}=this._pointLabelItems[e];return{left:t,top:n,right:r,bottom:i}}drawBackground(){let{backgroundColor:e,grid:{circular:t}}=this.options;if(e){let n=this.ctx;n.save(),n.beginPath(),du(this,this.getDistanceFromCenterForValue(this._endValue),t,this._pointLabels.length),n.closePath(),n.fillStyle=e,n.fill(),n.restore()}}drawGrid(){let e=this.ctx,t=this.options,{angleLines:n,grid:r,border:i}=t,a=this._pointLabels.length,o,s,c;if(t.pointLabels.display&&uu(this,a),r.display&&this.ticks.forEach((e,t)=>{if(t!==0||t===0&&this.min<0){s=this.getDistanceFromCenterForValue(e.value);let n=this.getContext(t),o=r.setContext(n),c=i.setContext(n);fu(this,o,s,a,c)}}),n.display){for(e.save(),o=a-1;o>=0;o--){let r=n.setContext(this.getPointLabelContext(o)),{color:i,lineWidth:a}=r;a&&i&&(e.lineWidth=a,e.strokeStyle=i,e.setLineDash(r.borderDash),e.lineDashOffset=r.borderDashOffset,s=this.getDistanceFromCenterForValue(t.reverse?this.min:this.max),c=this.getPointPosition(o,s),e.beginPath(),e.moveTo(this.xCenter,this.yCenter),e.lineTo(c.x,c.y),e.stroke())}e.restore()}}drawBorder(){}drawLabels(){let e=this.ctx,t=this.options,n=t.ticks;if(!n.display)return;let r=this.getIndexAngle(0),i,a;e.save(),e.translate(this.xCenter,this.yCenter),e.rotate(r),e.textAlign=`center`,e.textBaseline=`middle`,this.ticks.forEach((r,o)=>{if(o===0&&this.min>=0&&!t.reverse)return;let s=n.setContext(this.getContext(o)),c=H(s.font);if(i=this.getDistanceFromCenterForValue(this.ticks[o].value),s.showLabelBackdrop){e.font=c.string,a=e.measureText(r.label).width,e.fillStyle=s.backdropColor;let t=V(s.backdropPadding);e.fillRect(-a/2-t.left,-i-c.size/2-t.top,a+t.width,c.size+t.height)}Sr(e,r.label,0,-i,c,{color:s.color,strokeColor:s.textStrokeColor,strokeWidth:s.textStrokeWidth})}),e.restore()}drawTitle(){}});let mu={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}},hu=/* #__PURE__ */ Object.keys(mu);function gu(e,t){return e-t}function _u(e,t){if(O(t))return null;let n=e._adapter,{parser:r,round:i,isoWeekday:a}=e._parseOpts,o=t;return typeof r==`function`&&(o=r(o)),j(o)||(o=typeof r==`string`?n.parse(o,r):n.parse(o)),o===null?null:(i&&(o=i===`week`&&(dn(a)||a===!0)?n.startOf(o,`isoWeek`,a):n.startOf(o,i)),+o)}function vu(e,t,n,r){let i=hu.length;for(let a=hu.indexOf(e);a<i-1;++a){let e=mu[hu[a]],i=e.steps?e.steps:2**53-1;if(e.common&&Math.ceil((n-t)/(i*e.size))<=r)return hu[a]}return hu[i-1]}function yu(e,t,n,r,i){for(let a=hu.length-1;a>=hu.indexOf(n);a--){let n=hu[a];if(mu[n].common&&e._adapter.diff(i,r,n)>=t-1)return n}return hu[n?hu.indexOf(n):0]}function bu(e){for(let t=hu.indexOf(e)+1,n=hu.length;t<n;++t)if(mu[hu[t]].common)return hu[t]}function xu(e,t,n){if(!n)e[t]=!0;else if(n.length){let{lo:r,hi:i}=Cn(n,t),a=n[r]>=t?n[r]:n[i];e[a]=!0}}function Su(e,t,n,r){let i=e._adapter,a=+i.startOf(t[0].value,r),o=t[t.length-1].value,s,c;for(s=a;s<=o;s=+i.add(s,1,r))c=n[s],c>=0&&(t[c].major=!0);return t}function Cu(e,t,n){let r=[],i={},a=t.length,o,s;for(o=0;o<a;++o)s=t[o],i[s]=o,r.push({value:s,major:!1});return a===0||!n?r:Su(e,r,i,n)}var wu=class extends os{static id=`time`;static defaults={bounds:`data`,adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:`millisecond`,displayFormats:{}},ticks:{source:`auto`,callback:!1,major:{enabled:!1}}};constructor(e){super(e),this._cache={data:[],labels:[],all:[]},this._unit=`day`,this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(e,t={}){let n=e.time||={},r=this._adapter=new Ua._date(e.adapters.date);r.init(t),Ht(n.displayFormats,r.formats()),this._parseOpts={parser:n.parser,round:n.round,isoWeekday:n.isoWeekday},super.init(e),this._normalized=t.normalized}parse(e,t){return e===void 0?null:_u(this,e)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){let e=this.options,t=this._adapter,n=e.time.unit||`day`,{min:r,max:i,minDefined:a,maxDefined:o}=this.getUserBounds();function s(e){!a&&!isNaN(e.min)&&(r=Math.min(r,e.min)),!o&&!isNaN(e.max)&&(i=Math.max(i,e.max))}a&&o||(s(this._getLabelBounds()),(e.bounds!==`ticks`||e.ticks.source!==`labels`)&&s(this.getMinMax(!1))),r=j(r)&&!isNaN(r)?r:+t.startOf(Date.now(),n),i=j(i)&&!isNaN(i)?i:+t.endOf(Date.now(),n)+1,this.min=Math.min(r,i-1),this.max=Math.max(r+1,i)}_getLabelBounds(){let e=this.getLabelTimestamps(),t=1/0,n=-1/0;return e.length&&(t=e[0],n=e[e.length-1]),{min:t,max:n}}buildTicks(){let e=this.options,t=e.time,n=e.ticks,r=n.source===`labels`?this.getLabelTimestamps():this._generate();e.bounds===`ticks`&&r.length&&(this.min=this._userMin||r[0],this.max=this._userMax||r[r.length-1]);let i=this.min,a=this.max,o=En(r,i,a);return this._unit=t.unit||(n.autoSkip?vu(t.minUnit,this.min,this.max,this._getLabelCapacity(i)):yu(this,o.length,t.minUnit,this.min,this.max)),this._majorUnit=!n.major.enabled||this._unit===`year`?void 0:bu(this._unit),this.initOffsets(r),e.reverse&&o.reverse(),Cu(this,o,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(e=>+e.value))}initOffsets(e=[]){let t=0,n=0,r,i;this.options.offset&&e.length&&(r=this.getDecimalForValue(e[0]),t=e.length===1?1-r:(this.getDecimalForValue(e[1])-r)/2,i=this.getDecimalForValue(e[e.length-1]),n=e.length===1?i:(i-this.getDecimalForValue(e[e.length-2]))/2);let a=e.length<3?.5:.25;t=z(t,0,a),n=z(n,0,a),this._offsets={start:t,end:n,factor:1/(t+1+n)}}_generate(){let e=this._adapter,t=this.min,n=this.max,r=this.options,i=r.time,a=i.unit||vu(i.minUnit,t,n,this._getLabelCapacity(t)),o=M(r.ticks.stepSize,1),s=a===`week`&&i.isoWeekday,c=dn(s)||s===!0,l={},u=t,d,f;if(c&&(u=+e.startOf(u,`isoWeek`,s)),u=+e.startOf(u,c?`day`:a),e.diff(n,t,a)>1e5*o)throw Error(t+` and `+n+` are too far apart with stepSize of `+o+` `+a);let p=r.ticks.source===`data`&&this.getDataTimestamps();for(d=u,f=0;d<n;d=+e.add(d,o,a),f++)xu(l,d,p);return(d===n||r.bounds===`ticks`||f===1)&&xu(l,d,p),Object.keys(l).sort(gu).map(e=>+e)}getLabelForValue(e){let t=this._adapter,n=this.options.time;return n.tooltipFormat?t.format(e,n.tooltipFormat):t.format(e,n.displayFormats.datetime)}format(e,t){let n=this.options.time.displayFormats,r=this._unit,i=t||n[r];return this._adapter.format(e,i)}_tickFormatFunction(e,t,n,r){let i=this.options,a=i.ticks.callback;if(a)return N(a,[e,t,n],this);let o=i.time.displayFormats,s=this._unit,c=this._majorUnit,l=s&&o[s],u=c&&o[c],d=n[t],f=c&&u&&d&&d.major;return this._adapter.format(e,r||(f?u:l))}generateTickLabels(e){let t,n,r;for(t=0,n=e.length;t<n;++t)r=e[t],r.label=this._tickFormatFunction(r.value,t,e)}getDecimalForValue(e){return e===null?NaN:(e-this.min)/(this.max-this.min)}getPixelForValue(e){let t=this._offsets,n=this.getDecimalForValue(e);return this.getPixelForDecimal((t.start+n)*t.factor)}getValueForPixel(e){let t=this._offsets,n=this.getDecimalForPixel(e)/t.factor-t.end;return this.min+n*(this.max-this.min)}_getLabelSize(e){let t=this.options.ticks,n=this.ctx.measureText(e).width,r=mn(this.isHorizontal()?t.maxRotation:t.minRotation),i=Math.cos(r),a=Math.sin(r),o=this._resolveTickFontOptions(0).size;return{w:n*i+o*a,h:n*a+o*i}}_getLabelCapacity(e){let t=this.options.time,n=t.displayFormats,r=n[t.unit]||n.millisecond,i=this._tickFormatFunction(e,0,Cu(this,[e],this._majorUnit),r),a=this._getLabelSize(i),o=Math.floor(this.isHorizontal()?this.width/a.w:this.height/a.h)-1;return o>0?o:1}getDataTimestamps(){let e=this._cache.data||[],t,n;if(e.length)return e;let r=this.getMatchingVisibleMetas();if(this._normalized&&r.length)return this._cache.data=r[0].controller.getAllParsedValues(this);for(t=0,n=r.length;t<n;++t)e=e.concat(r[t].controller.getAllParsedValues(this));return this._cache.data=this.normalize(e)}getLabelTimestamps(){let e=this._cache.labels||[],t,n;if(e.length)return e;let r=this.getLabels();for(t=0,n=r.length;t<n;++t)e.push(_u(this,r[t]));return this._cache.labels=this._normalized?e:this.normalize(e)}normalize(e){return An(e.sort(gu))}};function Tu(e,t,n){let r=0,i=e.length-1,a,o,s,c;n?(t>=e[r].pos&&t<=e[i].pos&&({lo:r,hi:i}=wn(e,`pos`,t)),{pos:a,time:s}=e[r],{pos:o,time:c}=e[i]):(t>=e[r].time&&t<=e[i].time&&({lo:r,hi:i}=wn(e,`time`,t)),{time:a,pos:s}=e[r],{time:o,pos:c}=e[i]);let l=o-a;return l?s+(c-s)*(t-a)/l:s}(class extends wu{static id=`timeseries`;static defaults=wu.defaults;constructor(e){super(e),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){let e=this._getTimestampsForTable(),t=this._table=this.buildLookupTable(e);this._minPos=Tu(t,this.min),this._tableRange=Tu(t,this.max)-this._minPos,super.initOffsets(e)}buildLookupTable(e){let{min:t,max:n}=this,r=[],i=[],a,o,s,c,l;for(a=0,o=e.length;a<o;++a)c=e[a],c>=t&&c<=n&&r.push(c);if(r.length<2)return[{time:t,pos:0},{time:n,pos:1}];for(a=0,o=r.length;a<o;++a)l=r[a+1],s=r[a-1],c=r[a],Math.round((l+s)/2)!==c&&i.push({time:c,pos:a/(o-1)});return i}_generate(){let e=this.min,t=this.max,n=super.getDataTimestamps();return n.includes(e)&&n.length||n.splice(0,0,e),n.includes(t)&&n.length!==1||n.push(t),n.sort((e,t)=>e-t)}_getTimestampsForTable(){let e=this._cache.all||[];if(e.length)return e;let t=this.getDataTimestamps(),n=this.getLabelTimestamps();return e=t.length&&n.length?this.normalize(t.concat(n)):t.length?t:n,e=this._cache.all=e,e}getDecimalForValue(e){return(Tu(this._table,e)-this._minPos)/this._tableRange}getValueForPixel(e){let t=this._offsets,n=this.getDecimalForPixel(e)/t.factor-t.end;return Tu(this._table,n*this._tableRange+this._minPos,!0)}});function W(e,t={},...n){let r=document.createElement(e);for(let[e,n]of Object.entries(t))n!==void 0&&n!==!1&&n!==null&&(e.startsWith(`on`)&&typeof n==`function`?r.addEventListener(e.slice(2).toLowerCase(),n):e===`class`?r.className=String(n):r.setAttribute(e,n===!0?``:String(n)));return G(r,...n),r}function Eu(e){return[...e.querySelectorAll(`button, select, input, textarea, a[href], summary, [tabindex]`)].filter(t=>e.matches(`[data-id]`)||!t.closest(`[data-id]`))}function Du(e){return e.closest(`[data-id]`)??e.closest(`#app > * > *`)}function Ou(e){let t=document.activeElement,n=t instanceof HTMLElement&&t!==document.body?Du(t):null;if(!t||!n)return e();let r=t.id,i=n.dataset.id,a=i===void 0?[...n.parentElement.children].indexOf(n):-1,o=i===void 0?-1:[...document.querySelectorAll(`.tile`)].indexOf(n),s=Eu(n).indexOf(t);if(e(),s<0||t.isConnected||document.activeElement&&document.activeElement!==document.body)return;if(r)return document.getElementById(r)?.focus();let c=i===void 0?document.querySelector(`#app > *`)?.children[a]:document.querySelector(`[data-id="${CSS.escape(i)}"]`)??document.querySelectorAll(`.tile`)[Math.min(o,document.querySelectorAll(`.tile`).length-1)];if(!c)return;let l=Eu(c),u=e=>l[e]&&!l[e].matches(`:disabled`);for(let e=0;e<l.length;e++)for(let t of[s-e,s+e])if(u(t))return l[t].focus()}function ku(e){let t=document.getElementById(`announce`);t||(t=W(`div`,{id:`announce`,class:`sr-only`,"aria-live":`polite`}),document.body.append(t)),t.textContent=e}function G(e,...t){for(let n of t)n!==!1&&n!=null&&e.append(typeof n==`number`?String(n):n)}let Au=[{id:`system`,group:`auto`},{id:`midnight`,group:`dark`},{id:`graphite`,group:`dark`},{id:`ocean`,group:`dark`},{id:`forest`,group:`dark`},{id:`plum`,group:`dark`},{id:`light`,group:`light`},{id:`paper`,group:`light`},{id:`mist`,group:`light`},{id:`hcDark`,group:`accessible`},{id:`hcLight`,group:`accessible`}],ju=e=>`theme.${e}`,Mu={get(e){try{return localStorage.getItem(e)}catch{return null}},set(e,t){try{localStorage.setItem(e,t)}catch{}},remove(e){try{localStorage.removeItem(e)}catch{}}};function Nu(e){return getComputedStyle(document.documentElement).getPropertyValue(`--${e}`).trim()}U.register(Ia,za,Va,Ra,Ba,kc,_c,yc,ic,Vl,Gl,Il,gl,sl);let Pu=e=>e.datasetIndex??e.index??-1;function Fu(e,t,n){let r=n.chart,i=e=>e.datasetIndex===void 0?r.getDataVisibility(e.index??-1):r.isDatasetVisible(e.datasetIndex),a=(e,t)=>{e.datasetIndex===void 0?i(e)!==t&&r.toggleDataVisibility(e.index??-1):r.setDatasetVisibility(e.datasetIndex,t)},o=e.native,s=n.legendItems??[];if(o?.shiftKey||o?.metaKey||o?.ctrlKey)a(t,!i(t));else{let e=s.every(e=>i(e)===(Pu(e)===Pu(t)));for(let n of s)a(n,e||Pu(n)===Pu(t))}r.update()}U.defaults.plugins.legend.onClick=Fu,U.overrides.doughnut.plugins.legend.onClick=Fu,U.overrides.pie.plugins.legend.onClick=Fu;let Iu=[];function Lu(){U.defaults.color=Nu(`muted`),U.defaults.borderColor=Nu(`line`),U.defaults.font.family=getComputedStyle(document.body).fontFamily,U.defaults.maintainAspectRatio=!1,U.defaults.animation=!1,U.defaults.interaction.mode=`index`,U.defaults.interaction.intersect=!1;let e=U.defaults.plugins.tooltip;e.backgroundColor=Nu(`panel2`),e.titleColor=Nu(`text`),e.bodyColor=Nu(`text`),e.borderColor=Nu(`line`),e.borderWidth=1}let Ru=[`bar`,`line`,`scatter`,`doughnut`,`pie`];function zu(e){if(typeof e==`number`)return String(Math.round(e*100)/100);if(e&&typeof e==`object`&&`y`in e){let t=e;return`${zu(t.x)}: ${zu(t.y)}`}return e==null?``:String(e)}function Bu(e,t){let n=e.data.datasets,r=e.data.labels??(n[0]?.data??[]).map((e,t)=>t+1);return W(`div`,{class:`sr-only`},W(`table`,{},W(`caption`,{},t),W(`thead`,{},W(`tr`,{},W(`td`,{}),...n.map(e=>W(`th`,{scope:`col`},String(e.label??``))))),W(`tbody`,{},...r.map((e,t)=>W(`tr`,{},W(`th`,{scope:`row`},zu(e)),...n.map(e=>W(`td`,{},zu(e.data[t]))))))))}function Vu(e,t,n=220){let r=[t.type,...t.data.datasets.map(e=>e.type)].filter(Boolean).find(e=>!Ru.includes(String(e)));if(r)throw Error(`Chart type ${r} is not available: use ${Ru.join(`, `)}`);let i=(e.closest(`.multiple`)?.querySelector(`h3`)??e.closest(`.tile`)?.querySelector(`h2`))?.textContent??``,a=W(`canvas`,{"aria-hidden":`true`});e.append(W(`div`,{class:`chart`,style:`height:${n}px`},a,Bu(t,i)));let o=new U(a,t);return Iu.push(o),o}function Hu(){for(let e of Iu.splice(0))e.destroy()}function Uu(e,t,n){return e.boards[t]??(e.base===`blank`?[]:n(t))}function Wu(e,t,n){return{...e,boards:{...e.boards,[t]:n}}}function Gu(e,t,n){if(e.base===`blank`)return Wu(e,t,n(t));let{[t]:r,...i}=e.boards;return{...e,boards:i}}function Ku(e,t,n){let r=e.find(e=>e.id===t);if(!r||n===t)return e;let i=e.filter(e=>e.id!==t),a=n===null?-1:i.findIndex(e=>e.id===n);return i.splice(a<0?i.length:a,0,r),i}function qu(e,t,n,r,i=1){let a=Math.round((e+r)/(n+r));return Math.max(1,Math.min(t,Math.max(i,a)))}function Ju(e,t,n){return e===n?Math.max(t,e):e}function Yu(e,t,n){return e.map(e=>e.id===t?{...e,span:n}:e)}function Xu(e,t){return e.map(e=>{if(e.id!==t)return e;let{hidden:n,...r}=e;return n?r:{...e,hidden:!0}})}function Zu(e,t,{type:n,span:r=1}){let i=new Set(e.map(e=>e.id)),a=t;for(let e=2;i.has(a);e++)a=`${t}-${e}`;return[...e,{id:a,widget:t,...n?{type:n}:{},span:r}]}function Qu(e,t){return e.filter(e=>e.id!==t)}function $u(e){let t=nd(e)?e:{},n={};for(let[e,r]of Object.entries(nd(t.boards)?t.boards:{})){if(!Array.isArray(r))continue;let t=/* @__PURE__ */ new Set;n[e]=[];for(let i of r){if(!nd(i)||typeof i.id!=`string`||typeof i.widget!=`string`||t.has(i.id))continue;t.add(i.id);let r=Math.min(3,Math.max(1,Math.round(Number(i.span)||1)));n[e].push({id:i.id,widget:i.widget,...typeof i.type==`string`?{type:i.type}:{},span:r,...i.hidden===!0?{hidden:!0}:{}})}}return{rev:typeof t.rev==`string`?t.rev:``,base:t.base===`blank`?`blank`:`preset`,boards:n}}function ed(e,t){return!t||t.baseRev!==e.rev||!nd(t.layout)?e:{...$u(t.layout),rev:e.rev}}function td(e,t){if(!t||t.baseRev===e.rev||!nd(t.layout))return null;let n={...$u(t.layout),rev:e.rev};return JSON.stringify(n)===JSON.stringify(e)?null:n}function nd(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}let rd=e=>e instanceof HTMLElement&&e.classList.contains(`tile`)&&!e.classList.contains(`lifted`),id=e=>[...e.children].filter(rd),ad=e=>Number(/span-(\d)/.exec(e.className)?.[1]??1),od=(e,t)=>{e.className=e.className.replace(/span-\d/,`span-${t}`)};function sd(e){let t=e.nextElementSibling;for(;t&&!rd(t);)t=t.nextElementSibling;return t?.dataset.id??null}function cd(e,t){if(matchMedia(`(prefers-reduced-motion: reduce)`).matches)return t();let n=[...e.children].filter(e=>e instanceof HTMLElement&&!e.classList.contains(`lifted`)),r=new Map(n.map(e=>[e,e.getBoundingClientRect()]));t();for(let e of n){let t=r.get(e),n=e.getBoundingClientRect(),i=t.left-n.left,a=t.top-n.top;(i||a)&&e.animate([{transform:`translate(${i}px, ${a}px)`},{transform:`none`}],{duration:150,easing:`ease-out`})}}function ld(e,t,n){let r=t.closest(`.tile`),i=r?.parentElement;if(e.button!==0||!r||!i)return;e.preventDefault(),t.setPointerCapture(e.pointerId);let a=r.getBoundingClientRect(),o=e.clientX-a.left,s=e.clientY-a.top,c=sd(r),l=W(`div`,{class:`tile-slot span-${ad(r)}`,"aria-hidden":`true`,style:`height:${a.height}px`});r.before(l),r.style.width=`${a.width}px`,r.style.height=`${a.height}px`,r.classList.add(`lifted`),document.documentElement.classList.add(`dragging`);let u=e.clientX,d=e.clientY,f=()=>{r.style.transform=`translate(${u-o}px, ${d-s}px) scale(1.02)`;let e=document.elementFromPoint(u,d)?.closest(`.tile`);if(!e||e===r||e.parentElement!==i)return;let t=e.getBoundingClientRect(),n=(t.width>i.clientWidth*.9?d>t.top+t.height/2:u>t.left+t.width/2)?e.nextElementSibling:e;n!==l&&l.nextElementSibling!==n&&cd(i,()=>i.insertBefore(l,n))},p=0,m=()=>{let e=(document.querySelector(`.edit-bar`)?.getBoundingClientRect().bottom??0)+60,t=innerHeight-60,n=d<e?-(e-d)/3:d>t?(d-t)/3:0;n&&(scrollBy(0,Math.max(-20,Math.min(20,n))),f()),p=requestAnimationFrame(m)};p=requestAnimationFrame(m);let h=e=>{u=e.clientX,d=e.clientY,f()},g=e=>{cancelAnimationFrame(p),t.removeEventListener(`pointermove`,h),t.removeEventListener(`pointerup`,_),t.removeEventListener(`pointercancel`,v),window.removeEventListener(`keydown`,y,!0),document.removeEventListener(`lostpointercapture`,b);let i=sd(l);l.remove(),r.classList.remove(`lifted`),r.style.removeProperty(`width`),r.style.removeProperty(`height`),r.style.removeProperty(`transform`),document.documentElement.classList.remove(`dragging`),e&&i!==c&&n(i)},_=()=>g(!0),v=()=>g(!1),y=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopImmediatePropagation(),g(!1))},b=t=>{t.pointerId===e.pointerId&&g(!1)};t.addEventListener(`pointermove`,h),t.addEventListener(`pointerup`,_),t.addEventListener(`pointercancel`,v),document.addEventListener(`lostpointercapture`,b),window.addEventListener(`keydown`,y,!0),f()}function ud(e,t,n){let r=t.closest(`.tile`),i=r?.parentElement;if(!r||!i)return;let a=id(i),o=a.indexOf(r),s=e.key===` `||e.key===`Enter`;if(!r.classList.contains(`picked`)){if(!s)return;e.preventDefault(),r.classList.add(`picked`),t.setAttribute(`aria-pressed`,`true`),n.picked(o+1,a.length);return}let c={ArrowLeft:o-1,ArrowUp:o-1,ArrowRight:o+1,ArrowDown:o+1,Home:0,End:a.length-1};if(e.key in c){e.preventDefault();let s=Math.max(0,Math.min(a.length-1,c[e.key]));if(s===o)return;cd(i,()=>i.insertBefore(r,s<o?a[s]:a[s].nextElementSibling)),t.focus(),n.moved(s+1,a.length)}else s?(e.preventDefault(),n.drop(sd(r))):(e.key===`Escape`||e.key===`Tab`)&&(e.key===`Escape`&&(e.preventDefault(),e.stopPropagation()),n.cancel())}function dd(e){let t=getComputedStyle(e),n=t.gridTemplateColumns.split(` `).length,r=Number.parseFloat(t.columnGap)||0;return{cols:n,width:(e.clientWidth-r*(n-1))/n,gap:r}}function fd(e,t,n,r){let i=t.closest(`.tile`),a=i?.parentElement;if(e.button!==0||!i||!a)return;e.preventDefault(),t.setPointerCapture(e.pointerId);let{cols:o,width:s,gap:c}=dd(a),l=i.getBoundingClientRect().left,u=ad(i),d=Math.min(u,o),f=d,p=W(`div`,{class:`guides`,"aria-hidden":`true`},...Array.from({length:o},()=>W(`div`,{})));p.style.gridTemplateColumns=getComputedStyle(a).gridTemplateColumns,p.style.columnGap=`${c}px`;let m=W(`span`,{class:`span-badge`,"aria-hidden":`true`}),h=()=>{od(i,f),m.textContent=`${f} / ${o}`,p.style.top=`${i.offsetTop}px`,p.style.height=`${i.offsetHeight}px`};a.append(p),i.append(m),t.classList.add(`active`),document.documentElement.classList.add(`resizing`),h();let g=e=>{let t=qu(e.clientX-l,o,s,c,n);t!==f&&(f=t,h())},_=e=>{t.removeEventListener(`pointermove`,g),t.removeEventListener(`pointerup`,v),t.removeEventListener(`pointercancel`,y),window.removeEventListener(`keydown`,b,!0),document.removeEventListener(`lostpointercapture`,x),p.remove(),m.remove(),t.classList.remove(`active`),document.documentElement.classList.remove(`resizing`),e&&f!==d?r(f,o):od(i,u)},v=()=>_(!0),y=()=>_(!1),b=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopImmediatePropagation(),_(!1))},x=t=>{t.pointerId===e.pointerId&&_(!1)};t.addEventListener(`pointermove`,g),t.addEventListener(`pointerup`,v),t.addEventListener(`pointercancel`,y),document.addEventListener(`lostpointercapture`,x),window.addEventListener(`keydown`,b,!0)}let pd={all:`M2 2h5v5H2zM9 2h5v5H9zM2 9h5v5H2zM9 9h5v5H9z`,recovery:`M8 13.5S2.5 10 2.5 6.25A2.75 2.75 0 0 1 8 5a2.75 2.75 0 0 1 5.5 1.25C13.5 10 8 13.5 8 13.5z`,running:`M10 2.5a1.5 1.5 0 1 1 0 .1M7 5l3 1 1 3 2 1M8 6l-2 4-3 1M9 9l-1 3 2 2`,strengthTraining:`M1 7h2v2H1zM13 7h2v2h-2zM3 5h2v6H3zM11 5h2v6h-2zM5 7.25h6v1.5H5z`,walking:`M8 2.5a1.5 1.5 0 1 1 0 .1M8 5v5l-2 4M8 10l2 4M8 6l-3 2M8 6l3 2`,hiking:`M1 14l5-8 3 4 2-3 4 7z`,cycling:`M4 11a2.5 2.5 0 1 0 .1 0M12 11a2.5 2.5 0 1 0 .1 0M4 11l3-5h4l1 5M7 6l2 5`,swimming:`M1 11c2 0 2-1.5 3.5-1.5S6 11 8 11s2-1.5 3.5-1.5S13 11 15 11M5 8l3-3 3 2`,racket:`M6 2a4 4 0 1 1 0 8 4 4 0 0 1 0-8M8.5 9.5l5 5M13 4a1 1 0 1 1 0 .1`,generic:`M8 2v12M2 8h12`,eye:`M1.5 8S4 3.5 8 3.5 14.5 8 14.5 8 12 12.5 8 12.5 1.5 8 1.5 8zM8 6a2 2 0 1 1 0 4 2 2 0 0 1 0-4`,settings:`M2 4h6M12 4h2M2 8h2M8 8h6M2 12h8M14 12h0M10 2.5v3M6 6.5v3M12 10.5v3`};function md(e){let t=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);t.setAttribute(`viewBox`,`0 0 16 16`),t.setAttribute(`aria-hidden`,`true`),t.setAttribute(`class`,`icon icon-${e}`);let n=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);return n.setAttribute(`d`,pd[e]??pd.generic),t.append(n),t}function hd(){let e=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);return e.setAttribute(`viewBox`,`0 0 32 32`),e.setAttribute(`aria-hidden`,`true`),e.setAttribute(`class`,`logo`),e.innerHTML=`<circle class="logo-track" cx="16" cy="16" r="10"/><path class="logo-arc" d="M16 6a10 10 0 1 1-10 10"/><circle class="logo-dot" cx="16" cy="16" r="3.4"/>`,e}let gd={title:`Training + Recovery`,headline:`Training load, recovery and progress from Garmin Connect`,na:`n/a`,noData:`This page has no data yet. Ask your assistant to write the dashboard.`,period:`{from} to {to}`,inProgress:`* week in progress`,"menu.settings":`Settings`,"menu.theme":`Theme`,"footer.updated":`Data from Garmin Connect, updated {date}`,"footer.failed":`Days not read from Garmin: {n} (their values show n/a)`,"footer.license":`MIT License`,"menu.language":`Language`,"lang.auto":`Auto`,"themeGroup.auto":`Auto`,"themeGroup.dark":`Dark`,"themeGroup.light":`Light`,"themeGroup.accessible":`Accessible`,"theme.system":`System`,"theme.midnight":`Midnight`,"theme.graphite":`Graphite`,"theme.ocean":`Ocean`,"theme.forest":`Forest`,"theme.plum":`Plum`,"theme.light":`Light`,"theme.paper":`Paper`,"theme.mist":`Mist`,"theme.hcDark":`High contrast dark`,"theme.hcLight":`High contrast light`,"window.label":`Weeks`,"window.last":`Last {n}`,"window.all":`All`,"window.from":`From week`,"window.to":`To week`,"type.all":`All`,"type.recovery":`Recovery`,"type.running":`Run`,"type.strengthTraining":`Strength`,"type.walking":`Walk`,"type.hiking":`Hike`,"type.cycling":`Bike`,"type.swimming":`Swim`,"type.racket":`Racket sports`,"type.generic":`Other`,"type.transition":`Transition`,"type.fitnessEquipment":`Fitness equipment`,"type.basketball":`Basketball`,"type.soccer":`Soccer`,"type.tennis":`Tennis`,"type.americanFootball":`American football`,"type.training":`Training`,"type.crossCountrySkiing":`Cross-country skiing`,"type.alpineSkiing":`Alpine skiing`,"type.snowboarding":`Snowboarding`,"type.rowing":`Rowing`,"type.mountaineering":`Mountaineering`,"type.multisport":`Multisport`,"type.paddling":`Paddling`,"type.flying":`Flying`,"type.eBiking":`E-bike`,"type.motorcycling":`Motorcycling`,"type.boating":`Boating`,"type.driving":`Driving`,"type.golf":`Golf`,"type.hangGliding":`Hang gliding`,"type.horsebackRiding":`Horseback riding`,"type.hunting":`Hunting`,"type.fishing":`Fishing`,"type.inlineSkating":`Inline skating`,"type.rockClimbing":`Rock climbing`,"type.sailing":`Sailing`,"type.iceSkating":`Ice skating`,"type.skyDiving":`Skydiving`,"type.snowshoeing":`Snowshoeing`,"type.snowmobiling":`Snowmobiling`,"type.standUpPaddleboarding":`Stand-up paddleboarding`,"type.surfing":`Surfing`,"type.wakeboarding":`Wakeboarding`,"type.waterSkiing":`Water skiing`,"type.kayaking":`Kayaking`,"type.rafting":`Rafting`,"type.windsurfing":`Windsurfing`,"type.kitesurfing":`Kitesurfing`,"type.tactical":`Tactical`,"type.jumpmaster":`Jumpmaster`,"type.boxing":`Boxing`,"type.floorClimbing":`Floor climbing`,"type.baseball":`Baseball`,"type.diving":`Diving`,"type.shooting":`Shooting`,"type.winterSport":`Winter sports`,"type.grinding":`Grinding`,"type.hiit":`HIIT`,"type.videoGaming":`Video gaming`,"type.wheelchairPushWalk":`Wheelchair push walk`,"type.wheelchairPushRun":`Wheelchair push run`,"type.meditation":`Meditation`,"type.paraSport":`Para sport`,"type.discGolf":`Disc golf`,"type.teamSport":`Team sports`,"type.cricket":`Cricket`,"type.rugby":`Rugby`,"type.hockey":`Hockey`,"type.lacrosse":`Lacrosse`,"type.volleyball":`Volleyball`,"type.waterTubing":`Water tubing`,"type.wakesurfing":`Wakesurfing`,"type.waterSport":`Water sports`,"type.archery":`Archery`,"type.mixedMartialArts":`Mixed martial arts`,"type.motorSports":`Motorsports`,"type.snorkeling":`Snorkeling`,"type.dance":`Dance`,"type.jumpRope":`Jump rope`,"type.poolApnea":`Pool apnea`,"type.mobility":`Mobility`,"type.geocaching":`Geocaching`,"type.canoeing":`Canoeing`,"tabs.label":`Activity types`,"edit.start":`Edit layout`,"edit.done":`Done`,"edit.add":`Add widget`,"edit.reset":`Reset board`,"edit.discard":`Discard`,"edit.bar":`Edit layout`,"edit.editing":`Editing · {board}`,"edit.unsaved":`Unsaved changes`,"discard.title":`Discard your changes?`,"discard.text":`The layout goes back to how it was before you selected Edit layout, on every board.`,"discard.keep":`Keep editing`,"discard.confirm":`Discard changes`,"edit.copy":`Copy layout`,"edit.hide":`Hide {title}`,"edit.show":`Show {title}`,"edit.remove":`Remove {title}`,"edit.move":`Move {title}`,"edit.moveHint":`Drag to move, or press Space and then the arrow keys`,"edit.width":`Width of {title}`,"edit.widthValue":`{n} of {cols} columns`,"edit.addHidden":`Add widget · {n} hidden`,"add.addOne":`Add {title}`,"said.picked":`{title} picked up, position {n} of {count}. The arrow keys move it, Space drops it, Escape puts it back.`,"said.position":`Position {n} of {count}`,"said.cancelled":`{title} is back in its place`,"said.moved":`{title} moved to position {n} of {count}`,"said.width":`{title}: {n} of {cols} columns`,"said.hidden":`{title} hidden`,"said.shown":`{title} shown`,"said.removed":`{title} removed`,"said.added":`{title} added`,"said.saved":`Layout saved`,"said.unchanged":`No changes to save`,"said.discarded":`Changes discarded`,"stale.label":`New layout`,"stale.text":`Your assistant wrote a new layout for this dashboard. The layout you made in this browser stays until you choose.`,"stale.keep":`Keep mine`,"stale.new":`Use the new one`,"stale.used":`The new layout is in use`,"stale.kept":`Your layout is in use`,"add.title":`Add a widget`,"add.type":`Type`,"add.add":`Add`,"add.close":`Close`,"add.hiddenGroup":`Hidden on this board`,"add.none":`Every widget is on this board.`,"copy.title":`Copy layout`,"copy.hint":`This layout is saved in this browser only. To keep it in the page, paste this text to your assistant and ask it to save the dashboard layout.`,"copy.copy":`Copy`,"copy.copied":`Copied`,"board.empty":`This board has no widgets.`,"board.emptyEdit":`This board has no widgets: use “Add widget” to put some on it.`,"widget.failed":`This widget failed: {message}`,"widget.unknown":`Unknown widget: {id}`,"empty.window":`No sessions in the selected weeks.`,"w.coachNotes":`Coach notes`,"notes.none":`No notes.`,"notes.disclaimer":`Training suggestions for the data up to {date}. Not medical advice.`,"w.kpis":`Overview`,"kpi.totals":`{km} km · {time} · {n} session|{km} km · {time} · {n} sessions`,"kpi.distance":`Distance · last 7 days`,"kpi.time":`Time · last 7 days`,"kpi.vs4w":`vs 4-week average`,"delta.good":`better`,"delta.bad":`worse`,"kpi.ratio":`Load ratio 7:28`,"kpi.band":`Band 0.8-1.3`,"kpi.ratioAll":`Uses all activities, also with a type filter`,"kpi.hrv":`HRV last night`,"kpi.vsBaseline":`vs 7-day average {v} ms`,"w.readiness":`Readiness today`,"ready.easy":`Go easy`,"ready.push":`Ready to push`,"ready.normal":`Normal`,"ready.hrv":`HRV status`,"ready.sleep":`Sleep score`,"ready.rhr":`Resting HR`,"ready.rhrVs":`7 days before: {avg} bpm`,"ready.ratio":`Load ratio 7:28`,"ready.note":`The dashboard's own rule, not Garmin's readiness. It shows today: the week window does not change it.`,"w.fitnessAge":`Fitness age`,"fa.age":`Fitness age`,"fa.actual":`Actual age`,"fa.achievable":`Achievable`,"fa.details":`Details`,"fa.component":`Component`,"fa.value":`Now`,"fa.target":`Garmin target`,"fa.potential":`Potential age`,"fa.bodyFat":`Body fat %`,"fa.bmi":`BMI`,"fa.rhr":`Resting HR`,"fa.vigorousDaysAvg":`Vigorous days / week`,"fa.vigorousMinutesAvg":`Vigorous minutes / week`,"today.note":`It shows today: the week window does not change it.`,"w.periodComparison":`Period comparison`,"pc.vs":`{from} to {to} against {pfrom} to {pto}`,"pc.partial":`partial: these weeks start before the data`,"pc.type":`Type`,"pc.sessions":`Sessions`,"pc.distance":`Distance`,"pc.time":`Time`,"pc.load":`Load`,"pc.total":`Total`,"w.records":`Records`,"rec.best":`Fastest {d}`,"d.1k":`1 km`,"d.mile":`mile`,"d.5k":`5 km`,"d.10k":`10 km`,"d.half":`half marathon`,"d.marathon":`marathon`,"rec.longestRun":`Longest run`,"rec.longestRide":`Longest ride`,"rec.topSet":`Heaviest set`,"rec.e1rm":`Best est. 1RM · {name}`,"rec.none":`No records in the selected weeks.`,"rec.estimate":`1RM values are estimates (Epley, sets of 1-12 reps).`,"w.weeklyVolume":`Weekly volume`,"m.time":`Time`,"m.distance":`Distance`,"m.sessions":`Sessions`,"m.load":`Load`,"vol.avg":`4-week average`,"w.intensityMinutes":`Intensity minutes`,"im.guide":`Guideline 150 min`,"im.note":`Moderate + 2 x vigorous minutes of the activities only, not of the whole day.`,"w.loadSafety":`Load safety`,"ls.weekLoad":`Load · last 7 days`,"ls.monotony":`Monotony · 7 days`,"ls.monotonyFlag":`Above 2.0`,"ls.strain":`Strain · 7 days`,"ls.flagged":`Weeks above +10%`,"ls.load":`Weekly load`,"ls.ramp":`Change vs week before (%)`,"ls.note":`All activities. Red weeks rose more than 10%; a week in progress is not flagged. Monotony and strain (Foster) are estimates.`,"ls.estimated":`Some loads are estimates: the activity has no Garmin load.`,"w.loadVsRecovery":`Load vs recovery`,"lvr.hrv":`HRV (ms)`,"lvr.note":`Daily load by type (bars) and nightly HRV (line).`,"w.calendar":`Consistency`,"cal.minutes":`{n} min`,"cal.rest":`Rest day`,"cal.label":`Training days, by week; the arrow keys move`,"cal.less":`Less`,"cal.more":`More`,"m.label":`Measure`,skip:`Skip to the board`,"w.hrv":`HRV`,"hrv.low":`Range low`,"hrv.band":`Balanced range`,"hrv.nightly":`Nightly HRV`,"hrv.avg":`7-day average`,rec14:`Last 14 days: the week window does not change it.`,"rec.board":`The recovery widgets show the last 14 days: the week window does not change them.`,"w.restingHr":`Resting HR`,"w.sleep":`Sleep`,"sl.deep":`Deep`,"sl.light":`Light`,"sl.rem":`REM`,"sl.awake":`Awake`,"sl.score":`Score`,"w.sleepNeed":`Sleep need`,"sn.gap":`Short of need · average`,"sn.actual":`Slept`,"sn.need":`Need`,"w.bedtime":`Bedtime`,"bt.spread":`Bedtime spread`,"w.bodyBattery":`Body battery`,"bb.high":`High`,"bb.low":`Low`,"w.activities":`Activities`,"col.date":`Date`,"col.type":`Type`,"col.name":`Name`,"col.distance":`Distance`,"col.time":`Time`,"col.pace":`Pace / speed`,"col.hr":`Avg HR`,"col.ascent":`Ascent`,"col.race":`Race`,"laps.show":`laps`,"lap.n":`Lap`,"lap.intensity":`Intensity`,"act.more":`Show all {n}`,"act.less":`Show fewer`,"one.session":`One session so far: trends start at 2 sessions.`,"w.typeKpis":`Summary`,"tk.sessions":`Sessions`,"tk.time":`Time`,"tk.avg":`{v} per session`,"tk.distance":`Distance`,"tk.speed":`Average speed`,"tk.pace":`Average pace`,"tk.ascent":`Ascent`,"tk.hr":`Average HR`,"tk.peak":`Peak {v} bpm`,"tk.load":`Garmin training load`,"tk.share":`{v}% of all load`,"w.typeWeekly":`Each week`,"w.hrZones":`Time in HR zones`,"zones.approximate":`Approximate: some activities have no zone time, so all their minutes count in the zone of their average HR.`,"form.cadence":`Cadence`,"form.stride":`Stride`,"form.gct":`Ground contact`,"form.vertOsc":`Vertical oscillation`,"form.vertRatio":`Vertical ratio`,"form.power":`Power`,"form.normPower":`Normalized power`,"w.bestEfforts":`Best efforts`,"be.distance":`Distance`,"be.activity":`Activity`,"w.races":`Races`,"races.none":`No races in the selected weeks.`,"te.aerobic":`Aerobic TE`,"te.anaerobic":`Anaerobic TE`,"w.aerobicFitness":`Aerobic fitness`,"af.runs":`Runs (older paler)`,"af.pace":`Pace (min/km)`,"af.weekPace":`Weekly pace`,"af.efficiency":`Efficiency`,"af.effUnit":`m per heartbeat`,"w.intensityShare":`Easy and hard running`,"is.easy":`Z1-2 (easy)`,"is.hard":`Z4-5 (hard)`,"w.runningForm":`Running form`,"w.runWalk":`Run Walk Run`,"rw.none":`No Run Walk Run sessions in the selected weeks.`,"rw.runPace":`Run pace`,"rw.pace":`Overall pace`,"rw.walk":`Walk time`,"w.trainingEffect":`Training effect`,"w.racePredictor":`Race predictor`,"rp.none":`No best effort of 5 km or more in the selected weeks.`,"rp.note":`Estimate (Riegel) from the {d} in {time} on {date}.`,"w.longRuns":`Long runs and pace split`,"lr.share":`Longest run share of weekly km`,"lr.ascent":`Weekly ascent`,"lr.note":`Red weeks: the longest run is more than 35% of the week's km. The table shows races and runs over 15 km with laps.`,"lr.first":`First half`,"lr.second":`Second half`,"lr.split":`Split`,"lr.gap":`Grade-adjusted pace`,"lr.positive":`positive`,"lr.negative":`negative`,"lr.even":`even`,"w.setsPerCategory":`Sets per movement`,"ex.sets":`Completed sets`,"w.muscleBalance":`Muscle-group balance`,"mb.pushPull":`Push : pull sets`,"mb.avg":`Average sets per week`,"mb.perWeek":`sets per week`,"mb.note":`A set counts 1 for each primary muscle group and 0.5 for each secondary one. Usual range: 10-20 sets per week (yellow below, red above).`,"w.exercises":`Exercises`,"ex.groups":`Muscle groups`,"ex.search":`Search exercises`,"ex.name":`Exercise`,"ex.sessions":`Sessions`,"ex.last":`Last`,"ex.top":`Last top set`,"ex.best":`Best est. 1RM`,"ex.change":`Change`,"ex.trend":`Trend`,"ex.groupRow":`{n} exercise · {sets} completed sets|{n} exercises · {sets} completed sets`,"ex.reps":`{n} rep|{n} reps`,"ex.rest":`median rest {v}`,"ex.weight":`Top set (kg)`,"ex.e1rm":`Est. 1RM (kg)`,"ex.volume":`Volume (kg)`,"ex.maxReps":`Max reps`,"ex.totalReps":`Total reps`,"ex.longest":`Longest set (s)`,"ex.restAfter":`rest {v}`,"ex.notDone":`not done`,"w.strengthSessions":`Sessions`,"ss.count":`{n} exercise|{n} exercises`,"mg.chest":`Chest`,"mg.back":`Back`,"mg.shoulders":`Shoulders`,"mg.biceps":`Biceps`,"mg.triceps":`Triceps`,"mg.forearms":`Forearms`,"mg.quads":`Quads`,"mg.hamstrings":`Hamstrings`,"mg.glutes":`Glutes`,"mg.calves":`Calves`,"mg.abs":`Abs`,"mg.hips":`Hips`,"mg.other":`Other`,"w.walkDetails":`Pace and walks`,"wd.steps":`Steps`,"wd.battery":`Body battery change`,"wd.goal":`Step goal`,"wd.floors":`Floors`,"w.steps":`Daily steps`,"w.hikeVertical":`Vertical speed`,"hv.vam":`Vertical m per hour`,"w.bikeDetails":`Rides`,"bd.outdoor":`Outdoor`,"bd.indoor":`Indoor`,"bd.rides":`{n} ride|{n} rides`,"bd.where":`Where`,"w.swimDetails":`Swims`,"sw.pace":`Pace`,"sw.lengths":`Lengths`,"sw.strokes":`Strokes`,"sw.pool":`Pool`,"w.racketDetails":`Sessions and intensity`,"pd.peak":`Peak HR`,"pd.z3":`Time in Z3+`,"pd.z45":`Z4-5 share`,"pd.kcal":`kcal per hour`,"pd.load":`Load / run of same length`,"pd.note":`The second load is an estimate: the average Garmin load per minute of your runs, times the length of the session.`,"col.sport":`Sport`,"sport.tennis":`Tennis`,"sport.padel":`Padel`,"sport.pickleball":`Pickleball`,"sport.racquetball":`Racquetball`,"sport.squash":`Squash`,"sport.badminton":`Badminton`,"sport.tableTennis":`Table tennis`,"sport.platformTennis":`Platform tennis`},_d={en:gd},vd={en:`English`};function yd(e){if(e&&typeof e==`object`)for(let[t,n]of Object.entries(e)){if(!/^[a-z]{2,3}(-[A-Z]{2})?$/.test(t)||!n||typeof n!=`object`)continue;let e=Object.fromEntries(Object.entries(n).filter(([e,t])=>e in gd&&typeof t==`string`));_d[t]={..._d[t]??gd,...e},vd[t]??=bd(t)}}function bd(e){try{let t=new Intl.DisplayNames([e],{type:`language`}).of(e);return t?t[0].toUpperCase()+t.slice(1):e}catch{return e}}function xd(e,t){return e in _d?e:t.flatMap(e=>[e,e.slice(0,2).toLowerCase()]).find(e=>e in _d)??`en`}function Sd(e){let t=_d[e]??gd,n=new Intl.PluralRules(e);return(e,r={})=>{let i=t[e]??gd[e];if(i.includes(`|`)&&typeof r.n==`number`){let[e,t]=i.split(`|`);i=n.select(r.n)===`one`?e:t}return i.replace(/\{(\w+)\}/g,(e,t)=>String(r[t]??e))}}let Cd=e=>typeof e==`number`&&Number.isFinite(e),wd=e=>String(e).padStart(2,`0`);function Td(e){let t=(_d[e]??gd).na,n=/* @__PURE__ */ new Map,r=t=>{let r=n.get(t);return r||(r=new Intl.NumberFormat(e,{minimumFractionDigits:t,maximumFractionDigits:t}),n.set(t,r)),r},i=new Intl.NumberFormat(e,{signDisplay:`exceptZero`,maximumFractionDigits:0}),a=new Intl.DateTimeFormat(e,{day:`numeric`,month:`short`,timeZone:`UTC`}),o=new Intl.DateTimeFormat(e,{day:`numeric`,month:`short`,year:`numeric`,timeZone:`UTC`});return{na:t,num:(e,n=0)=>Cd(e)?r(n).format(e):t,pct:e=>Cd(e)?`${i.format(e)}%`:t,day:e=>e?a.format(/* @__PURE__ */ new Date(`${e}T00:00:00Z`)):t,longDay:e=>e?o.format(/* @__PURE__ */ new Date(`${e}T00:00:00Z`)):t,hms:e=>{if(!Cd(e))return t;let n=Math.round(e),r=Math.floor(n/3600),i=Math.floor(n%3600/60);return r>0?`${r}:${wd(i)}:${wd(n%60)}`:`${i}:${wd(n%60)}`},hours:e=>{if(!Cd(e))return t;let n=Math.round(e/60);return n>=60?`${Math.floor(n/60)}h ${n%60}m`:`${n}m`}}}let Ed={all:[[`kpis`,3],[`readiness`,2],[`calendar`,1],[`periodComparison`,3],[`records`,3],[`weeklyVolume`,2],[`intensityMinutes`,1],[`loadSafety`,3],[`loadVsRecovery`,3],[`activities`,3],[`coachNotes`,3]],recovery:[[`readiness`,2],[`fitnessAge`,1],[`loadVsRecovery`,3],[`hrv`,1],[`restingHr`,1],[`sleep`,1],[`sleepNeed`,1],[`bedtime`,1],[`bodyBattery`,1]],running:[[`typeKpis`,3],[`typeWeekly`,2],[`hrZones`,1],[`bestEfforts`,1],[`races`,2],[`aerobicFitness`,2],[`intensityShare`,1],[`runningForm`,3],[`runWalk`,1],[`trainingEffect`,2],[`racePredictor`,1],[`longRuns`,2],[`activities`,3]],strengthTraining:[[`typeKpis`,3],[`typeWeekly`,2],[`hrZones`,1],[`setsPerCategory`,2],[`muscleBalance`,1],[`exercises`,3],[`strengthSessions`,3]],walking:[[`typeKpis`,3],[`typeWeekly`,2],[`hrZones`,1],[`walkDetails`,2],[`steps`,1],[`activities`,3]],hiking:[[`typeKpis`,3],[`typeWeekly`,2],[`hrZones`,1],[`hikeVertical`,3],[`activities`,3]],cycling:[[`typeKpis`,3],[`typeWeekly`,2],[`hrZones`,1],[`bikeDetails`,3],[`activities`,3]],swimming:[[`typeKpis`,3],[`typeWeekly`,2],[`hrZones`,1],[`swimDetails`,3],[`activities`,3]],racket:[[`typeKpis`,3],[`typeWeekly`,2],[`hrZones`,1],[`racketDetails`,3],[`activities`,3]],generic:[[`typeKpis`,3],[`typeWeekly`,2],[`hrZones`,1],[`activities`,3]]};function Dd(e){return(Ed[e]??Ed.generic).map(([e,t])=>({id:e,widget:e,span:t}))}let Od=[{id:`kpis`,title:`w.kpis`,types:[`all`,...i],span:3},{id:`readiness`,title:`w.readiness`,needs:`recovery`,span:2},{id:`fitnessAge`,title:`w.fitnessAge`,needs:`fitnessAge`,span:1},{id:`periodComparison`,title:`w.periodComparison`,types:[`all`,...i],span:3,minSpan:2},{id:`records`,title:`w.records`,types:[`all`,...i],span:3},{id:`weeklyVolume`,title:`w.weeklyVolume`,types:[`all`,...i],span:2},{id:`intensityMinutes`,title:`w.intensityMinutes`,types:[`all`,...i],span:1},{id:`loadSafety`,title:`w.loadSafety`,span:3},{id:`calendar`,title:`w.calendar`,types:[`all`,...i],span:3},{id:`loadVsRecovery`,title:`w.loadVsRecovery`,needs:`recovery`,types:[`all`,...i],span:3},{id:`hrv`,title:`w.hrv`,needs:`recovery`,span:1},{id:`restingHr`,title:`w.restingHr`,needs:`recovery`,span:1},{id:`sleep`,title:`w.sleep`,needs:`recovery`,span:1},{id:`sleepNeed`,title:`w.sleepNeed`,needs:`recovery`,span:1},{id:`bedtime`,title:`w.bedtime`,needs:`recovery`,span:1},{id:`bodyBattery`,title:`w.bodyBattery`,needs:`recovery`,span:1},{id:`activities`,title:`w.activities`,types:[`all`,...i],span:3,minSpan:2},{id:`coachNotes`,title:`w.coachNotes`,needs:`notes`,span:3},{id:`typeKpis`,title:`w.typeKpis`,types:[`all`,...i],span:3},{id:`typeWeekly`,title:`w.typeWeekly`,types:[`all`,...i],span:2},{id:`hrZones`,title:`w.hrZones`,types:[`all`,...i],span:1},{id:`bestEfforts`,title:`w.bestEfforts`,types:[`running`],span:1},{id:`races`,title:`w.races`,types:[`running`],span:2},{id:`aerobicFitness`,title:`w.aerobicFitness`,types:[`running`],span:2},{id:`intensityShare`,title:`w.intensityShare`,types:[`running`],span:1},{id:`runningForm`,title:`w.runningForm`,types:[`running`],span:3},{id:`runWalk`,title:`w.runWalk`,types:[`running`],span:1},{id:`trainingEffect`,title:`w.trainingEffect`,types:[`running`],span:2},{id:`racePredictor`,title:`w.racePredictor`,types:[`running`],span:1},{id:`longRuns`,title:`w.longRuns`,types:[`running`],span:2},{id:`setsPerCategory`,title:`w.setsPerCategory`,types:[`strengthTraining`],span:2},{id:`muscleBalance`,title:`w.muscleBalance`,types:[`strengthTraining`],span:1},{id:`exercises`,title:`w.exercises`,types:[`strengthTraining`],span:3},{id:`strengthSessions`,title:`w.strengthSessions`,types:[`strengthTraining`],span:3},{id:`walkDetails`,title:`w.walkDetails`,types:[`walking`,`hiking`],span:2},{id:`steps`,title:`w.steps`,needs:`recovery`,span:1},{id:`hikeVertical`,title:`w.hikeVertical`,types:[`hiking`,`walking`,`running`],span:3},{id:`bikeDetails`,title:`w.bikeDetails`,types:[`cycling`],span:3},{id:`swimDetails`,title:`w.swimDetails`,types:[`swimming`],span:3},{id:`racketDetails`,title:`w.racketDetails`,types:[`racket`,`generic`],span:3}],kd=/* @__PURE__ */ new Map;function K(e){let t=Od.find(t=>t.id===e.id);if(!t)throw Error(`widget ${e.id} is not in the catalogue`);kd.set(e.id,{...e,title:e=>e(t.title),types:t.types,span:t.span,minSpan:t.minSpan})}function Ad(e){kd.get(e.id)?.custom===!1||Od.some(t=>t.id===e.id)||kd.set(e.id,{...e,custom:!0})}let jd=/* @__PURE__ */ new Set;function Md(e){for(let t of Od)t.needs&&e.includes(t.needs)&&(kd.delete(t.id),jd.add(t.id))}let Nd=e=>kd.get(e),Pd=()=>[...kd.values()];function Fd(e){try{return e?decodeURIComponent(e):void 0}catch{return}}function Id(e,t,n){let[,r,i,a,o]=/^#?([a-zA-Z]+)?(?:@(\d{4}-\d{2}-\d{2})_(\d{4}-\d{2}-\d{2}))?(?:\/(.+))?$/.exec(e)??[],s=Fd(o),c=i&&a&&i<=a&&n.includes(i)&&n.includes(a)?{from:i,to:a}:{from:n[0],to:n.at(-1)};return{tab:r&&t.includes(r)?r:`all`,...c,...s===void 0?{}:{item:s}}}function Ld(e){return`#${e.tab}@${e.from}_${e.to}${e.item?`/${encodeURIComponent(e.item)}`:``}`}let Rd=(e,t)=>`type.${t}`in gd?e(`type.${t}`):t,zd=(e,t,n)=>t===e.fmt.na?t:`${t}${n}`;function q(e,t,...n){return W(`div`,{class:`kpi`},W(`div`,{class:`kpi-label`},e),W(`div`,{class:`kpi-value`},t),...n.map(e=>e&&W(`div`,{class:`kpi-sub`},e)))}let Bd=(...e)=>W(`div`,{class:`kpis`},...e);function Vd(e,t,n){if(t.length===0)return!1;let r=`garmin-open:${e.board}:${e.id}`,i=W(`button`,{class:`btn more`,"aria-controls":t.map((t,n)=>t.id||=`open-${e.board}-${e.id}-${n}`).join(` `)}),a=r=>{for(let e of t)e.hidden=!r;i.setAttribute(`aria-expanded`,String(r)),i.textContent=r?e.t(`act.less`):e.t(`act.more`,{n})};return i.addEventListener(`click`,()=>{let e=i.getAttribute(`aria-expanded`)!==`true`;a(e),e?Mu.set(r,`1`):Mu.remove(r)}),a(Mu.get(r)===`1`),i}function Hd(e,t,n){if(t===null)return W(`span`,{});let r=n?e.calc.changeClass(t,n===`up`):`same`,i=Math.abs(t)<.5;return W(`span`,{class:`delta ${n?r:``}`},i?``:t>0?`▲ `:`▼ `,e.fmt.pct(Math.abs(t)).replace(`+`,``),r!==`same`&&W(`span`,{class:`sr-only`},` (${e.t(`delta.${r}`)})`))}function Ud(e,t,n=[]){let r=e=>n.includes(e)?`num`:void 0;return W(`table`,{class:`data`},W(`thead`,{},W(`tr`,{},...e.map((e,t)=>W(`th`,{class:r(t),scope:`col`},e)))),W(`tbody`,{},...t.map(e=>W(`tr`,{},...e.map((e,t)=>W(`td`,{class:r(t)},e))))))}function Wd(e,t){let n=c(t);return W(`span`,{class:`type type-${n}`},md(n),Rd(e.t,n))}function Gd(e,t){let n=t===g(e.data.end)&&(/* @__PURE__ */ new Date(`${e.data.end}T00:00:00Z`)).getUTCDay()!==0;return`${e.fmt.day(t)}${n?`*`:``}`}function Kd(e){let t=n(e.to,6);return t<e.data.end?t:e.data.end}function qd(e){return[...e.data.activities,...e.data.previousActivities]}function Jd(e,t,n,r=`all`){return e.filter(e=>{let i=typeof e.start==`string`?e.start.slice(0,10):``;return i>=t&&i<=n&&(r===`all`||c(e)===r)})}let Yd=e=>e.calc.zonesOf(e.data.zones).maxHR;function Xd(e,t){let n=Yd(e);return t.reduce((t,r)=>{let i=e.calc.loadOf(r,n);return{sessions:t.sessions+1,km:t.km+(typeof r.km==`number`?r.km:0),seconds:t.seconds+m(r),load:t.load+(i?.value??0),loadKnown:t.loadKnown+ +!!i}},{sessions:0,km:0,seconds:0,load:0,loadKnown:0})}let Zd=(e,t)=>t.sessions>0&&t.loadKnown===0?e.fmt.na:e.fmt.num(t.load);function Qd(e,t){return/^#[0-9a-f]{6}$/i.test(e)?`${e}${Math.round(t*255).toString(16).padStart(2,`0`)}`:e}let $d=/* @__PURE__ */ new Map;function ef(e,t,n,r){let i=`${e.board}/${e.id}/${t}`,a=$d.get(i)??n[0][0];return[a,W(`div`,{class:`picker`,role:`group`,"aria-label":r},...n.map(([t,n])=>W(`button`,{class:`chip small`,"aria-pressed":String(t===a),onclick:()=>{$d.set(i,t),e.refresh()}},n)))]}let J=e=>W(`p`,{class:`muted small note`},e),tf=/* @__PURE__ */ new Set;K({id:`activities`,render(e,t){let{t:n,fmt:r}=t,i=t.activities;if(i.length===0){t.empty(e);return}let a=Ud([n(`col.date`),n(`col.type`),n(`col.name`),n(`col.distance`),n(`col.time`),n(`col.pace`),n(`col.hr`),n(`col.ascent`)],[],[3,4,5,6,7]),o=a.querySelector(`tbody`),s=[];for(let[e,a]of i.entries()){let i=o.childElementCount,c=String(a.id),l=Array.isArray(a.laps)?a.laps:[],u=tf.has(c),d=W(`span`,{},a.name??``,a.race===!0&&W(`span`,{class:`tag`},n(`col.race`))),f=[r.day(String(a.start).slice(0,10)),Wd(t,a),l.length>0?W(`button`,{class:`linkish`,"aria-expanded":String(u),onclick:()=>{u?tf.delete(c):tf.add(c),t.refresh()}},d,` · ${n(`laps.show`)}`):d,typeof a.km==`number`?`${r.num(a.km,2)} km`:``,r.hms(t.calc.sessionSeconds(a)),nf(a,r.num),typeof a.avgHR==`number`?r.num(a.avgHR):``,typeof a.ascentM==`number`?`${r.num(a.ascentM)} m`:``];o.append(W(`tr`,{},...f.map((e,t)=>W(`td`,{class:t>=3?`num`:void 0},e)))),u&&o.append(W(`tr`,{class:`laps-row`},W(`td`,{colspan:`8`},Ud([n(`lap.n`),n(`col.distance`),n(`col.time`),n(`col.pace`),n(`col.hr`),n(`lap.intensity`)],l.map(e=>[String(e.lap??``),typeof e.km==`number`?`${r.num(e.km,2)} km`:``,String(e.time??``),String(e.pace??(typeof e.kmh==`number`?`${r.num(e.kmh,1)} km/h`:``)),typeof e.avgHR==`number`?r.num(e.avgHR):``,String(e.intensity??``)]),[1,2,3,4])))),e>=15&&s.push(...[...o.children].slice(i))}G(e,a,Vd(t,s,i.length))}});function nf(e,t){let n=c(e);if(n===`strengthTraining`||n===`racket`)return``;let r=f(e.duration)/3600;return n===`cycling`?typeof e.km==`number`&&r>0?`${t(e.km/r,1)} km/h`:``:typeof e.pace==`string`?e.pace:``}K({id:`coachNotes`,render(e,t){let n=(t.data.notes??[]).slice(0,5);if(n.length===0){t.empty(e,t.t(`notes.none`));return}let r=W(`ul`,{class:`notes`});for(let e of n)r.append(W(`li`,{},e));G(e,r,W(`p`,{class:`muted small`},t.t(`notes.disclaimer`,{date:t.fmt.longDay(t.data.end)})))}});let rf=e=>typeof e==`number`&&Number.isFinite(e)?e:void 0,af=e=>e.at(-1),of=(e,t)=>e.filter(e=>c(e)===t);K({id:`kpis`,render(e,t){let{t:r,fmt:i,calc:a}=t,o=Xd(t,t.activities),s=Kd(t),c=t.ofType(qd(t)),l=Xd(t,Jd(c,n(s,-6),s)),u=Xd(t,Jd(c,n(s,-34),n(s,-7))),d=a.loadRatio(qd(t),s,Yd(t)).ratio,f=af(t.data.hrv.filter(e=>String(e.date)<=s)),p=rf(f?.hrv),m=rf(f?.weeklyAvg),h=t.type!==`all`;G(e,W(`p`,{class:`totals`},r(`kpi.totals`,{km:i.num(o.km,1),time:i.hours(o.seconds),n:o.sessions})),Bd(q(r(`kpi.distance`),`${i.num(l.km,1)} km`,W(`span`,{},Hd(t,a.change(l.km,u.km/4)),` `,r(`kpi.vs4w`))),q(r(`kpi.time`),i.hours(l.seconds),W(`span`,{},Hd(t,a.change(l.seconds,u.seconds/4)),` `,r(`kpi.vs4w`))),q(r(`kpi.ratio`),d===null?i.na:i.num(d,2),W(`span`,{class:d!==null&&(d<.8||d>1.3)?`warn`:`good`},r(`kpi.band`)),h&&r(`kpi.ratioAll`)),q(r(`kpi.hrv`),p===void 0?i.na:`${i.num(p)} ms`,p!==void 0&&m!==void 0&&W(`span`,{},Hd(t,a.change(p,m),`up`),` `,r(`kpi.vsBaseline`,{v:i.num(m)})))))}}),K({id:`readiness`,render(e,t){let{t:n,fmt:r,calc:i,data:a}=t,o=af(a.hrv),s=a.recovery,c=af(s),l=s.slice(-8,-1).map(e=>rf(e.rhr)).filter(e=>e!==void 0),u=i.mean(l)??void 0,d=i.loadRatio(qd(t),a.end,Yd(t)).ratio,f={hrvStatus:typeof o?.status==`string`?o.status:void 0,sleepScore:rf(c?.sleepScore),rhr:rf(c?.rhr),rhrAvg:u,ratio:d},p=i.readiness(f);G(e,W(`p`,{class:`verdict verdict-${p??`none`}`},p?n(`ready.${p}`):r.na),Bd(q(n(`ready.hrv`),f.hrvStatus??r.na),q(n(`ready.sleep`),r.num(f.sleepScore)),q(n(`ready.rhr`),f.rhr===void 0?r.na:`${r.num(f.rhr)} bpm`,u!==void 0&&n(`ready.rhrVs`,{avg:r.num(u,1)})),q(n(`ready.ratio`),d===null?r.na:r.num(d,2))),J(n(`ready.note`)))}}),K({id:`fitnessAge`,render(e,t){let{t:n,fmt:r}=t,i=t.data.fitnessAge;if(!i||rf(i.fitnessAge)===void 0){t.empty(e,r.na);return}let a=Object.entries(i.components??{}),o=/* @__PURE__ */ new Set([`bodyFat`,`bmi`,`rhr`,`vigorousDaysAvg`,`vigorousMinutesAvg`]);G(e,Bd(q(n(`fa.age`),r.num(rf(i.fitnessAge),1)),q(n(`fa.actual`),r.num(rf(i.chronologicalAge))),q(n(`fa.achievable`),r.num(rf(i.achievableFitnessAge),1))),a.length>0&&W(`details`,{class:`more-details`},W(`summary`,{},n(`fa.details`)),Ud([n(`fa.component`),n(`fa.value`),n(`fa.target`),n(`fa.potential`)],a.map(([e,t])=>[o.has(e)?n(`fa.${e}`):e,r.num(rf(t.value),1),r.num(rf(t.targetValue),1),r.num(rf(t.potentialAge),1)]),[1,2,3])),J(n(`today.note`)))}}),K({id:`periodComparison`,render(e,t){let{t:n,fmt:r,calc:i}=t,a=Kd(t),o=i.periodWindow(t.from,t.to,t.data.prevStart),s=t.activities,c=t.ofType(Jd(qd(t),o.from,o.to)),l=u([...s,...c]),d=(e,n,a)=>{let o=Xd(t,n),s=Xd(t,a),c=(e,n)=>W(`span`,{},e,` `,Hd(t,n));return[e,c(r.num(o.sessions),i.change(o.sessions,s.sessions)),o.km>0||s.km>0?c(`${r.num(o.km,1)} km`,i.change(o.km,s.km)):``,c(r.hours(o.seconds),i.change(o.seconds,s.seconds)),c(Zd(t,o),o.loadKnown&&s.loadKnown?i.change(o.load,s.load):null)]};G(e,W(`p`,{class:`muted small`},n(`pc.vs`,{from:r.day(t.from),to:r.day(a),pfrom:r.day(o.from),pto:r.day(o.to)}),o.partial&&` (${n(`pc.partial`)})`),Ud([n(`pc.type`),n(`pc.sessions`),n(`pc.distance`),n(`pc.time`),n(`pc.load`)],[...l.map(e=>d(Rd(n,e),of(s,e),of(c,e))),...l.length>1?[d(W(`strong`,{},n(`pc.total`)),s,c)]:[]],[1,2,3,4]))}}),K({id:`records`,render(e,t){let{t:n,fmt:r,calc:i}=t,a=[],o=[],s=(e,t,n)=>W(`div`,{class:`badge`},W(`div`,{class:`kpi-label`},e),W(`div`,{class:`badge-value`},t),W(`div`,{class:`muted small`},`${r.day(String(n.start).slice(0,10))} · ${n.name??``}`));for(let e of[`1k`,`mile`,`5k`,`10k`,`half`,`marathon`]){let c=t.activities.map(t=>({a:t,s:i.seconds(t.best?.[e])})).filter(e=>e.s>0).toSorted((e,t)=>e.s-t.s)[0];c&&(a.push(s(n(`rec.best`,{d:n(`d.${e}`)}),r.hms(c.s),c.a)),o[0]=a.at(-1))}let l=e=>t.activities.filter(t=>c(t)===e&&typeof t.km==`number`).toSorted((e,t)=>(t.km??0)-(e.km??0))[0],u=l(`running`);u&&a.push(o[1]=s(n(`rec.longestRun`),`${r.num(u.km,1)} km`,u));let d=l(`cycling`);d&&a.push(o[2]=s(n(`rec.longestRide`),`${r.num(d.km,1)} km`,d));let f,p=/* @__PURE__ */ new Map;for(let e of t.activities)for(let t of e.exercises??[])for(let n of t.sets){if(!(n.reps>0&&n.kg>0))continue;(!f||n.kg>f.kg)&&(f={kg:n.kg,reps:n.reps,name:t.exercise,a:e});let r=i.epley(n.kg,n.reps);r!==void 0&&r>(p.get(t.exercise)?.v??0)&&p.set(t.exercise,{v:r,a:e})}f&&a.push(s(n(`rec.topSet`),`${f.name}: ${r.num(f.kg,1)} kg × ${f.reps}`,f.a));for(let[e,{v:t,a:i}]of[...p].toSorted((e,t)=>t[1].v-e[1].v))a.push(s(n(`rec.e1rm`,{name:e}),`${r.num(t,1)} kg`,i)),o[3]??=a.at(-1);if(a.length===0){t.empty(e,n(`rec.none`));return}let m=o.filter(e=>e!==void 0),h=[...m,...a.filter(e=>!m.includes(e))];G(e,W(`div`,{class:`badges`},...h),p.size>0&&J(n(`rec.estimate`)),Vd(t,h.slice(4),h.length))}});let sf=e=>typeof e==`number`&&Number.isFinite(e)?e:null,cf=(e,t)=>e.map(e=>sf(e[t]));function lf(e){return e.data.recovery.slice(-14)}function uf(e,t){return t.map(t=>e.fmt.day(String(t.date)))}function df(e,t,n){return n.length===0&&t.empty(e,t.fmt.na),n.length===0}function ff(e,t){t.board!==`recovery`&&G(e,J(t.t(`rec14`)))}let pf=e=>`${String(Math.floor(e/60)%24).padStart(2,`0`)}:${String(Math.round(e%60)).padStart(2,`0`)}`;K({id:`hrv`,render(e,t){let{t:n,calc:r}=t,i=t.data.hrv.slice(-14);if(df(e,t,i))return;let a=cf(i,`hrv`);t.chart(e,{type:`line`,data:{labels:uf(t,i),datasets:[{label:n(`hrv.low`),data:cf(i,`low`),borderColor:`transparent`,pointRadius:0,fill:!1},{label:n(`hrv.band`),data:cf(i,`high`),borderColor:`transparent`,backgroundColor:`${t.color(`good`)}22`,pointRadius:0,fill:`-1`},{label:n(`hrv.nightly`),data:a,borderColor:t.color(`accent`),pointRadius:2,spanGaps:!0},{label:n(`hrv.avg`),data:r.rolling(a,7),borderColor:t.color(`text`),borderDash:[4,3],pointRadius:0}]},options:{scales:{y:{title:{display:!0,text:`ms`}}},plugins:{legend:{labels:{filter:e=>e.text!==n(`hrv.low`)}}}}}),ff(e,t)}}),K({id:`restingHr`,render(e,t){let n=lf(t);df(e,t,n)||(t.chart(e,{type:`line`,data:{labels:uf(t,n),datasets:[{label:t.t(`w.restingHr`),data:cf(n,`rhr`),borderColor:t.color(`bad`),pointRadius:2,spanGaps:!0}]},options:{scales:{y:{title:{display:!0,text:`bpm`}}}}}),ff(e,t))}}),K({id:`sleep`,render(e,t){let{t:n}=t,r=lf(t);if(df(e,t,r))return;let i=(e,t,n)=>({type:`bar`,label:t,data:cf(r,e),backgroundColor:n,stack:`s`,yAxisID:`y`});t.chart(e,{type:`bar`,data:{labels:uf(t,r),datasets:[i(`deep`,n(`sl.deep`),t.color(`strengthTraining`)),i(`light`,n(`sl.light`),t.color(`cycling`)),i(`rem`,n(`sl.rem`),t.color(`swimming`)),i(`awake`,n(`sl.awake`),t.color(`racket`)),{type:`line`,label:n(`sl.score`),data:cf(r,`sleepScore`),borderColor:t.color(`text`),pointRadius:2,yAxisID:`y1`,spanGaps:!0}]},options:{scales:{x:{stacked:!0},y:{stacked:!0,title:{display:!0,text:`h`}},y1:{position:`right`,min:0,max:100,grid:{drawOnChartArea:!1}}}}}),ff(e,t)}}),K({id:`sleepNeed`,render(e,t){let{t:n,fmt:r,calc:i}=t,a=lf(t);if(df(e,t,a))return;let o=a.flatMap(e=>sf(e.sleepH)!==null&&sf(e.needH)!==null?[sf(e.needH)-sf(e.sleepH)]:[]),s=i.mean(o);G(e,Bd(q(n(`sn.gap`),s===null?r.na:`${r.num(s*60)} min`))),t.chart(e,{type:`bar`,data:{labels:uf(t,a),datasets:[{type:`bar`,label:n(`sn.actual`),data:cf(a,`sleepH`),backgroundColor:t.color(`accent`)},{type:`line`,label:n(`sn.need`),data:cf(a,`needH`),borderColor:t.color(`warn`),pointRadius:2,spanGaps:!0}]},options:{scales:{y:{title:{display:!0,text:`h`}}}}},180),ff(e,t)}}),K({id:`bedtime`,render(e,t){let{t:n,fmt:r,calc:i}=t,a=lf(t);if(df(e,t,a))return;let o=cf(a,`bedMin`).map(e=>e===null?null:e<720?e+1440:e),s=i.bedtimeSpread(o.filter(e=>e!==null));G(e,Bd(q(n(`bt.spread`),s===null?r.na:`± ${r.num(s)} min`))),t.chart(e,{type:`line`,data:{labels:uf(t,a),datasets:[{label:n(`w.bedtime`),data:o,borderColor:t.color(`accent`),pointRadius:3,showLine:!1}]},options:{scales:{y:{reverse:!0,ticks:{callback:e=>pf(Number(e))}}},plugins:{tooltip:{callbacks:{label:e=>pf(e.parsed.y??0)}}}}},180),ff(e,t)}}),K({id:`bodyBattery`,render(e,t){let{t:n}=t,r=lf(t);df(e,t,r)||(t.chart(e,{type:`bar`,data:{labels:uf(t,r),datasets:[{label:n(`bb.high`),data:cf(r,`bbHigh`),backgroundColor:t.color(`good`)},{label:n(`bb.low`),data:cf(r,`bbLow`),backgroundColor:Qd(t.color(`bad`),.35),borderColor:t.color(`bad`),borderWidth:1.5}]},options:{scales:{y:{min:0,max:100}}}}),ff(e,t))}});let mf=e=>e===0?0:e<30?1:e<60?2:e<90?3:4;function hf(e,t){return u(e.activities).map(n=>({type:`bar`,label:Rd(e.t,n),data:e.calc.weekly(e.activities.filter(e=>c(e)===n),e.weeks,t),backgroundColor:e.color(n),stack:`types`}))}function gf(e,t,n){let{t:r,fmt:i,calc:a}=t,o=Yd(t),s={time:[r(`m.time`),`h`,e=>m(e)/3600],distance:[r(`m.distance`),`km`,e=>typeof e.km==`number`?e.km:0],sessions:[r(`m.sessions`),``,()=>1],load:[r(`m.load`),``,e=>a.loadOf(e,o)?.value??0]},[c,l]=ef(t,`metric`,Object.entries(s).filter(([e])=>!n||n.includes(e)).map(([e,[t]])=>[e,t]),r(`m.label`)),[,u,d]=s[c],f=a.weekly(t.activities,t.weeks,d);G(e,l),t.activities.length===0?t.empty(e):t.chart(e,{type:`bar`,data:{labels:t.weeks.map(e=>Gd(t,e)),datasets:[...hf(t,d),{type:`line`,label:r(`vol.avg`),data:a.rolling(f,4),borderColor:t.color(`text`),borderDash:[4,3],pointRadius:2}]},options:{scales:{x:{stacked:!0},y:{stacked:!0,title:{display:!!u,text:u}}},plugins:{tooltip:{callbacks:{label:e=>`${e.dataset.label}: ${i.num(e.parsed.y??void 0,1)} ${u}`}}}}})}K({id:`weeklyVolume`,render:(e,t)=>gf(e,t)}),K({id:`intensityMinutes`,render(e,t){let{t:n,calc:r}=t;if(t.activities.length===0){t.empty(e);return}let i=r.weekly(t.activities,t.weeks,r.intensityMinutes);t.chart(e,{type:`bar`,data:{labels:t.weeks.map(e=>Gd(t,e)),datasets:[{type:`bar`,label:n(`w.intensityMinutes`),data:i,backgroundColor:i.map(e=>t.color(e>=150?`good`:`accent`))},{type:`line`,label:n(`im.guide`),data:t.weeks.map(()=>150),borderColor:t.color(`warn`),borderDash:[5,4],pointRadius:0}]},options:{scales:{y:{title:{display:!0,text:`min`}}}}}),G(e,J(n(`im.note`)))}}),K({id:`loadSafety`,render(e,t){let{t:r,fmt:i,calc:a}=t,o=Yd(t),s=t.allActivities,c=a.weekly(s,t.weeks,e=>a.loadOf(e,o)?.value??0),l=a.ramp(c);(/* @__PURE__ */ new Date(`${t.data.end}T00:00:00Z`)).getUTCDay()!==0&&t.weeks.at(-1)===t.calc.mondayOf(t.data.end)&&(l[l.length-1]=null);let u=l.map(e=>e!==null&&e>10),d=Kd(t),f=a.monotony(a.dailyLoads(s,n(d,-6),d,o)),p=s.filter(e=>{let t=h(e);return t!==void 0&&t>=n(d,-6)&&t<=d}),m=p.length>0&&!p.some(e=>a.loadOf(e,o)),g=s.some(e=>a.loadOf(e,o)?.estimate);G(e,Bd(q(r(`ls.weekLoad`),m?i.na:i.num(f.weekLoad)),q(r(`ls.monotony`),m||f.monotony===null?i.na:i.num(f.monotony,2),f.monotony!==null&&f.monotony>2&&W(`span`,{class:`bad`},r(`ls.monotonyFlag`))),q(r(`ls.strain`),m||f.strain===null?i.na:i.num(f.strain)),q(r(`ls.flagged`),String(u.filter(Boolean).length)))),t.chart(e,{type:`bar`,data:{labels:t.weeks.map(e=>Gd(t,e)),datasets:[{type:`bar`,label:r(`ls.load`),data:c,backgroundColor:u.map(e=>e?t.color(`bad`):Qd(t.color(`muted`),.6)),yAxisID:`y`},{type:`line`,label:r(`ls.ramp`),data:l,borderColor:t.color(`warn`),yAxisID:`y1`,spanGaps:!0}]},options:{scales:{y:{title:{display:!0,text:r(`ls.load`)}},y1:{position:`right`,grid:{drawOnChartArea:!1},title:{display:!0,text:`%`}}}}}),G(e,J(r(`ls.note`)),g&&J(r(`ls.estimated`)))}}),K({id:`loadVsRecovery`,render(e,t){let{t:r,calc:i}=t,a=Yd(t),o=Kd(t),s=[];for(let e=t.from;e<=o;e=n(e,1))s.push(e);let l=new Map(t.data.hrv.map(e=>[String(e.date),typeof e.hrv==`number`?e.hrv:null]));t.chart(e,{type:`bar`,data:{labels:s.map(e=>t.fmt.day(e)),datasets:[...u(t.activities).map(e=>({type:`bar`,label:Rd(t.t,e),data:i.dailyLoads(t.activities.filter(t=>c(t)===e),t.from,o,a),backgroundColor:t.color(e),stack:`load`,yAxisID:`y`})),{type:`line`,label:r(`lvr.hrv`),data:s.map(e=>l.get(e)??null),borderColor:t.color(`text`),pointRadius:1,yAxisID:`y1`,spanGaps:!0}]},options:{scales:{x:{stacked:!0},y:{stacked:!0,title:{display:!0,text:r(`ls.load`)}},y1:{position:`right`,grid:{drawOnChartArea:!1},title:{display:!0,text:`HRV (ms)`}}}}},260),G(e,J(r(`lvr.note`)))}}),K({id:`calendar`,render(e,t){let{t:r,fmt:i}=t,a=/* @__PURE__ */ new Map;for(let e of t.activities){let t=h(e);t&&a.set(t,[...a.get(t)??[],e])}let o=e=>(a.get(e)??[]).reduce((e,t)=>e+m(t)/60,0),s=new Intl.DateTimeFormat(t.lang,{weekday:`short`,timeZone:`UTC`}),c=W(`div`,{class:`cal-tip`,role:`status`,hidden:!0}),l=Kd(t),u=(t,n)=>{let s=a.get(n)??[];c.replaceChildren(W(`strong`,{},i.longDay(n)),W(`div`,{},s.length?r(`cal.minutes`,{n:i.num(o(n))}):r(`cal.rest`)),...s.map(e=>W(`div`,{class:`small`},`${e.name??``} · ${typeof e.km==`number`?`${i.num(e.km,1)} km · `:``}${i.hours(m(e))}`))),c.hidden=!1;let l=t.getBoundingClientRect(),u=e.getBoundingClientRect();c.style.left=`${Math.min(l.left-u.left,u.width-220)}px`,c.style.top=`${l.bottom-u.top+6}px`},d=W(`div`,{class:`cal`,role:`group`,"aria-label":r(`cal.label`),style:`grid-template-columns: auto repeat(${t.weeks.length}, minmax(10px, 20px))`,onkeydown:e=>{let t=e.target.closest(`.cal-cell[data-date]`);if(!t)return;if(e.key===`Escape`){c.hidden=!0;return}let r={ArrowUp:-1,ArrowDown:1,ArrowLeft:-7,ArrowRight:7}[e.key];if(r===void 0)return;e.preventDefault();let i=d.querySelector(`[data-date="${n(t.dataset.date,r)}"]`);i&&(t.tabIndex=-1,i.tabIndex=0,i.focus())}});for(let e=0;e<7;e++){d.append(W(`span`,{class:`cal-day muted small`},e%2==0?s.format(new Date(Date.UTC(2026,0,5+e))):``));for(let s of t.weeks){let f=n(s,e);if(f>t.data.end){d.append(W(`span`,{class:`cal-cell out`}));continue}let p=W(`button`,{class:`cal-cell l${mf(o(f))}`,"data-date":f,tabindex:f===l?`0`:`-1`,"aria-label":`${i.longDay(f)}: ${a.has(f)?r(`cal.minutes`,{n:i.num(o(f))}):r(`cal.rest`)}`,onpointerenter:()=>u(p,f),onfocus:()=>u(p,f),onclick:()=>u(p,f),onpointerleave:()=>c.hidden=!0,onblur:()=>c.hidden=!0});d.append(p)}}let f=W(`div`,{class:`cal-legend muted small`,"aria-hidden":`true`},r(`cal.less`),...[0,1,2,3,4].map(e=>W(`span`,{class:`cal-cell l${e}`})),r(`cal.more`));G(e,W(`div`,{class:`cal-wrap`},d,c),f)}});let _f=/* @__PURE__ */ new Set([`running`,`walking`,`hiking`,`cycling`,`swimming`]);function vf(e,t){return t.activities.length===0?(t.empty(e),!0):t.activities.length===1&&(t.empty(e,t.t(`one.session`)),!0)}K({id:`typeKpis`,render(e,t){let{t:r,fmt:i,calc:a}=t,o=t.activities;if(o.length===0){t.empty(e);return}let s=Xd(t,o),c=a.timedDistance(o),l=Xd(t,t.allActivities),u=o.map(e=>e.avgHR).filter(e=>typeof e==`number`),d=Math.max(...o.map(e=>typeof e.maxHR==`number`?e.maxHR:0)),f=Kd(t),p=t.ofType(qd(t)),m=Xd(t,Jd(p,n(f,-6),f)),h=Xd(t,Jd(p,n(f,-34),n(f,-7))),g=(e,n)=>W(`span`,{},Hd(t,a.change(e,n/4)),` `,r(`kpi.vs4w`)),_=t.type!==`all`&&_f.has(t.type),v=o.reduce((e,t)=>e+(typeof t.ascentM==`number`?t.ascentM:0),0),y=[q(r(`tk.sessions`),i.num(s.sessions),g(m.sessions,h.sessions)),q(r(`tk.time`),i.hours(s.seconds),r(`tk.avg`,{v:i.hours(s.seconds/s.sessions)})),_&&q(r(`tk.distance`),`${i.num(s.km,1)} km`,g(m.km,h.km)),_&&c.km>0&&(t.type===`cycling`?q(r(`tk.speed`),`${i.num(c.km/(c.seconds/3600),1)} km/h`):q(r(`tk.pace`),`${i.hms(c.seconds/c.km)}/km`)),t.type===`cycling`&&q(r(`tk.ascent`),`${i.num(v)} m`),q(r(`tk.hr`),zd(t,i.num(a.mean(u)??void 0),` bpm`),d>0&&r(`tk.peak`,{v:i.num(d)})),q(r(`tk.load`),Zd(t,s),s.loadKnown>0&&l.load>0&&r(`tk.share`,{v:i.num(s.load/l.load*100)}))].filter(e=>e instanceof HTMLElement);G(e,Bd(...y),o.length===1&&J(r(`one.session`)))}}),K({id:`typeWeekly`,render(e,t){if(vf(e,t))return;let n=[`time`,`sessions`];(t.type===`all`||_f.has(t.type))&&n.splice(1,0,`distance`),gf(e,t,n)}}),K({id:`hrZones`,render(e,t){let{t:r,calc:i,fmt:a}=t;if(vf(e,t))return;let o=i.zonesOf(t.data.zones).floors,s=t.weeks.map(()=>[0,0,0,0,0]),c=!1;for(let e of t.activities){let r=i.zoneSeconds(e,o),a=String(e.start).slice(0,10),l=t.weeks.findIndex(e=>a>=e&&a<=n(e,6));!r||l<0||(c||=r.approximate,r.sec.forEach((e,t)=>s[l][t]+=e/60))}let l=[`muted`,`cycling`,`walking`,`racket`,`bad`];t.chart(e,{type:`bar`,data:{labels:t.weeks.map(e=>Gd(t,e)),datasets:[0,1,2,3,4].map(e=>({label:`Z${e+1}${o[e]?` (${o[e]}+)`:``}`,data:s.map(t=>t[e]),backgroundColor:t.color(l[e])}))},options:{scales:{x:{stacked:!0},y:{stacked:!0,title:{display:!0,text:`min`}}},plugins:{tooltip:{callbacks:{label:e=>`${e.dataset.label}: ${a.num(e.parsed.y??void 0)} min`}}}}}),G(e,c&&J(r(`zones.approximate`)))}});let yf=[`1k`,`mile`,`5k`,`10k`,`half`,`marathon`],bf=[[`cadenceSpm`,`form.cadence`,`spm`,0],[`gctMs`,`form.gct`,`ms`,0],[`strideCm`,`form.stride`,`cm`,0],[`vertOscCm`,`form.vertOsc`,`cm`,1],[`vertRatioPct`,`form.vertRatio`,`%`,1],[`avgPowerW`,`form.power`,`W`,0],[`normPowerW`,`form.normPower`,`W`,0]],xf=e=>e.activities.filter(e=>c(e)===`running`),Sf=e=>String(e.start).slice(0,10),Cf=e=>typeof e==`number`&&Number.isFinite(e)?e:void 0,wf=(e,t)=>e.weeks.findIndex(e=>Sf(t)>=e&&Sf(t)<=n(e,6));function Tf(e){let t={};for(let n of xf(e))for(let[r,i]of Object.entries(n.best??{})){let a=e.calc.seconds(i);a>0&&(!t[r]||a<t[r].s)&&(t[r]={s:a,a:n})}return t}K({id:`bestEfforts`,render(e,t){let{t:n,fmt:r}=t,i=Tf(t),a=yf.filter(e=>i[e]).map(e=>[n(`d.${e}`),r.hms(i[e].s),`${r.day(Sf(i[e].a))} · ${i[e].a.name??``}`]);if(a.length===0)return t.empty(e);G(e,Ud([n(`be.distance`),n(`col.time`),n(`be.activity`)],a,[1]))}}),K({id:`races`,render(e,t){let{t:n,fmt:r}=t,i=xf(t).filter(e=>e.race===!0);if(i.length===0)return t.empty(e,n(`races.none`));G(e,Ud([n(`col.date`),n(`col.name`),n(`col.distance`),n(`col.time`),n(`col.pace`),n(`col.hr`),n(`form.power`),n(`te.aerobic`)],i.map(e=>[r.day(Sf(e)),e.name??``,zd(t,r.num(Cf(e.km),2),` km`),r.hms(t.calc.seconds(e.duration)),String(e.pace??``),r.num(Cf(e.avgHR)),Cf(e.avgPowerW)===void 0?r.na:`${r.num(Cf(e.avgPowerW))} W`,r.num(Cf(e.aerobicTE),1)]),[2,3,4,5,6,7]))}}),K({id:`aerobicFitness`,render(e,t){let{t:n,fmt:r,calc:i}=t;if(vf(e,t))return;let a=xf(t).filter(e=>i.paceSeconds(e)&&typeof e.avgHR==`number`).toReversed(),o=t.color(`accent`);t.chart(e,{type:`scatter`,data:{datasets:[{label:n(`af.runs`),data:a.map(e=>({x:e.avgHR,y:i.paceSeconds(e)})),backgroundColor:a.map((e,t)=>Qd(o,.2+.8*(t+1)/a.length)),pointRadius:4}]},options:{interaction:{mode:`nearest`,intersect:!0},scales:{x:{title:{display:!0,text:n(`col.hr`)}},y:{reverse:!0,title:{display:!0,text:n(`af.pace`)},ticks:{callback:e=>r.hms(Number(e))}}},plugins:{tooltip:{callbacks:{label:e=>{let t=a[e.dataIndex];return`${r.day(Sf(t))} ${t.name??``}: ${r.hms(e.parsed.y??0)}/km · ${r.num(e.parsed.x??0)} bpm`}}}}}});let s=t.weeks.map((e,n)=>xf(t).filter(e=>wf(t,e)===n)),c=s.map(e=>{let t=i.timedDistance(e);return t.km>0?t.seconds/t.km:null}),l=s.map(e=>i.mean(e.map(e=>i.efficiency(e)).filter(e=>e!==void 0)));t.chart(e,{type:`line`,data:{labels:t.weeks.map(e=>Gd(t,e)),datasets:[{label:n(`af.weekPace`),data:c,borderColor:t.color(`running`),yAxisID:`y`,spanGaps:!0},{label:n(`af.efficiency`),data:l,borderColor:t.color(`good`),yAxisID:`y1`,spanGaps:!0}]},options:{scales:{y:{reverse:!0,ticks:{callback:e=>r.hms(Number(e))},title:{display:!0,text:n(`af.pace`)}},y1:{position:`right`,grid:{drawOnChartArea:!1},title:{display:!0,text:n(`af.effUnit`)}}},plugins:{tooltip:{callbacks:{label:e=>e.datasetIndex===0?`${e.dataset.label}: ${r.hms(e.parsed.y??0)}/km`:`${e.dataset.label}: ${r.num(e.parsed.y??void 0,2)}`}}}}},180)}}),K({id:`intensityShare`,render(e,t){let{t:n,calc:r,fmt:i}=t;if(vf(e,t))return;let a=r.zonesOf(t.data.zones).floors,o=t.weeks.map(()=>[0,0,0]);for(let e of xf(t)){let n=r.zoneSeconds(e,a),i=wf(t,e);!n||i<0||(o[i][0]+=n.sec[0]+n.sec[1],o[i][1]+=n.sec[3]+n.sec[4],o[i][2]+=n.sec.reduce((e,t)=>e+t,0))}let s=e=>o.map(t=>t[2]>0?t[e]/t[2]*100:null);t.chart(e,{type:`line`,data:{labels:t.weeks.map(e=>Gd(t,e)),datasets:[{label:n(`is.easy`),data:s(0),borderColor:t.color(`good`),spanGaps:!0},{label:n(`is.hard`),data:s(1),borderColor:t.color(`bad`),borderDash:[6,4],spanGaps:!0}]},options:{scales:{y:{min:0,max:100,title:{display:!0,text:`%`}}},plugins:{tooltip:{callbacks:{label:e=>`${e.dataset.label}: ${i.num(e.parsed.y??void 0)}%`}}}}})}}),K({id:`runningForm`,render(e,t){let{t:n,fmt:r,calc:i}=t;if(vf(e,t))return;let a=bf.filter(([e])=>xf(t).some(t=>Cf(t[e])!==void 0));if(a.length===0)return t.empty(e,r.na);let o=W(`div`,{class:`multiples`});G(e,o);let s=[];for(let[e,c,l,u]of a){let a=W(`div`,{class:`multiple`},W(`h3`,{},`${n(c)} (${l})`));o.append(a),s.push(a);let d=t.weeks.map((n,r)=>i.mean(xf(t).filter(e=>wf(t,e)===r).map(t=>Cf(t[e])).filter(e=>e!==void 0)));t.chart(a,{type:`line`,data:{labels:t.weeks.map(e=>Gd(t,e)),datasets:[{label:n(c),data:d,borderColor:t.color(`running`),spanGaps:!0,pointRadius:2}]},options:{plugins:{legend:{display:!1},tooltip:{callbacks:{label:e=>`${r.num(e.parsed.y??void 0,u)} ${l}`}}},scales:{y:{title:{display:!0,text:l}}}}},140)}G(e,Vd(t,s.slice(2),s.length))}}),K({id:`runWalk`,render(e,t){let{t:n,fmt:r}=t,i=xf(t).filter(e=>e.runWalk&&typeof e.runWalk==`object`);if(i.length===0)return t.empty(e,n(`rw.none`));G(e,Ud([n(`col.date`),n(`rw.runPace`),n(`rw.pace`),n(`rw.walk`)],i.map(e=>{let t=e.runWalk;return[r.day(Sf(e)),String(t.runPace??r.na),String(e.pace??r.na),String(t.walkTime??r.na)]}),[1,2,3]))}}),K({id:`trainingEffect`,render(e,t){let{t:n,fmt:r}=t;if(vf(e,t))return;let i=xf(t).toReversed();t.chart(e,{type:`line`,data:{labels:i.map(e=>r.day(Sf(e))),datasets:[{label:n(`te.aerobic`),data:i.map(e=>Cf(e.aerobicTE)??null),borderColor:t.color(`accent`),showLine:!1,pointRadius:3},{label:n(`te.anaerobic`),data:i.map(e=>Cf(e.anaerobicTE)??null),borderColor:t.color(`racket`),showLine:!1,pointRadius:3}]},options:{scales:{y:{min:0,max:5}}}},180);let a=[...new Set(i.map(e=>String(e.teLabel??``)).filter(Boolean))],o=[`accent`,`good`,`warn`,`bad`,`strengthTraining`,`swimming`,`hiking`,`generic`];t.chart(e,{type:`bar`,data:{labels:t.weeks.map(e=>Gd(t,e)),datasets:a.map((e,n)=>({label:e.replaceAll(`_`,` `),data:t.weeks.map((n,r)=>xf(t).filter(n=>wf(t,n)===r&&n.teLabel===e).length),backgroundColor:t.color(o[n%o.length])}))},options:{scales:{x:{stacked:!0},y:{stacked:!0,ticks:{precision:0}}}}},160)}}),K({id:`racePredictor`,render(e,t){let{t:n,fmt:r,calc:i}=t,a=Tf(t),o=i.predictRaces(Object.fromEntries(Object.entries(a).map(([e,t])=>[e,t.s])));if(!o)return t.empty(e,n(`rp.none`));let s=a[o.from.distance];G(e,Bd(...Object.entries(o.times).map(([e,t])=>q(n(`d.${e}`),r.hms(t)))),J(n(`rp.note`,{d:n(`d.${o.from.distance}`),time:r.hms(o.from.seconds),date:r.day(Sf(s.a))})))}}),K({id:`longRuns`,render(e,t){let{t:n,fmt:r,calc:i}=t;if(vf(e,t))return;let a=t.weeks.map((e,n)=>xf(t).filter(e=>wf(t,e)===n)),o=a.map(e=>{let t=e.reduce((e,t)=>e+(Cf(t.km)??0),0),n=Math.max(0,...e.map(e=>Cf(e.km)??0));return t>0?n/t*100:null}),s=a.map(e=>e.reduce((e,t)=>e+(Cf(t.ascentM)??0),0));t.chart(e,{type:`bar`,data:{labels:t.weeks.map(e=>Gd(t,e)),datasets:[{type:`bar`,label:n(`lr.share`),data:o,backgroundColor:o.map(e=>t.color(e!==null&&e>35?`bad`:`running`)),yAxisID:`y`},{type:`line`,label:n(`lr.ascent`),data:s,borderColor:t.color(`hiking`),yAxisID:`y1`}]},options:{scales:{y:{min:0,max:100,title:{display:!0,text:`%`}},y1:{position:`right`,grid:{drawOnChartArea:!1},title:{display:!0,text:`m`}}}}},200);let c=xf(t).filter(e=>Array.isArray(e.laps)&&(e.race===!0||(Cf(e.km)??0)>15)).map(e=>({a:e,s:i.splitOf(e.laps)})).filter(e=>e.s);G(e,J(n(`lr.note`)),c.length>0&&Ud([n(`col.date`),n(`col.name`),n(`lr.first`),n(`lr.second`),n(`lr.split`),n(`lr.gap`)],c.map(({a:e,s:t})=>[r.day(Sf(e)),e.name??``,`${r.hms(t.first)}/km`,`${r.hms(t.second)}/km`,W(`span`,{class:t.kind===`positive`?`bad`:t.kind===`negative`?`good`:`same`},n(`lr.${t.kind}`)),String(e.gap??r.na)]),[2,3,5]))}});let Y=e=>typeof e==`number`&&Number.isFinite(e)?e:void 0,Ef=e=>String(e.start).slice(0,10);function Df(e){let t=f(e.duration)/3600;return typeof e.km==`number`&&t>0?e.km/t:void 0}let Of=(e,t)=>e.weeks.findIndex(e=>Ef(t)>=e&&Ef(t)<=n(e,6));K({id:`walkDetails`,render(e,t){let{t:n,fmt:r,calc:i}=t;if(vf(e,t))return;let a=t.weeks.map((e,n)=>t.activities.filter(e=>Of(t,e)===n)),o=a.map(e=>{let t=i.timedDistance(e);return t.km>0?t.seconds/t.km:null}),s=a.map(e=>i.mean(e.map(e=>e.avgHR).filter(e=>typeof e==`number`)));t.chart(e,{type:`line`,data:{labels:t.weeks.map(e=>Gd(t,e)),datasets:[{label:n(`af.weekPace`),data:o,borderColor:t.color(t.type===`hiking`?`hiking`:`walking`),yAxisID:`y`,spanGaps:!0},{label:n(`col.hr`),data:s,borderColor:t.color(`bad`),yAxisID:`y1`,spanGaps:!0}]},options:{scales:{y:{reverse:!0,ticks:{callback:e=>r.hms(Number(e))},title:{display:!0,text:n(`af.pace`)}},y1:{position:`right`,grid:{drawOnChartArea:!1},title:{display:!0,text:`bpm`}}},plugins:{tooltip:{callbacks:{label:e=>e.datasetIndex===0?`${e.dataset.label}: ${r.hms(e.parsed.y??0)}/km`:`${e.dataset.label}: ${r.num(e.parsed.y??void 0)} bpm`}}}}},200),G(e,Ud([n(`col.date`),n(`col.name`),n(`wd.steps`),n(`form.cadence`),n(`wd.battery`)],t.activities.map(e=>[r.day(Ef(e)),e.name??``,r.num(Y(e.steps)),r.num(Y(e.cadenceSpm)),r.num(Y(e.bodyBatteryDelta))]),[2,3,4]))}}),K({id:`steps`,render(e,t){let{t:n}=t,r=t.data.recovery.slice(-14);if(r.length===0)return t.empty(e,t.fmt.na);let i=e=>r.map(t=>Y(t[e])??null);t.chart(e,{type:`bar`,data:{labels:r.map(e=>t.fmt.day(String(e.date))),datasets:[{type:`bar`,label:n(`wd.steps`),data:i(`steps`),backgroundColor:t.color(`walking`),yAxisID:`y`},{type:`line`,label:n(`wd.goal`),data:i(`stepGoal`),borderColor:t.color(`warn`),pointRadius:0,yAxisID:`y`,spanGaps:!0},{type:`line`,label:n(`wd.floors`),data:i(`floors`),borderColor:t.color(`hiking`),yAxisID:`y1`,spanGaps:!0}]},options:{scales:{y1:{position:`right`,grid:{drawOnChartArea:!1},ticks:{precision:0}}}}}),G(e,J(n(`rec14`)))}}),K({id:`hikeVertical`,render(e,t){let{t:n,fmt:r,calc:i}=t,a=t.activities.filter(e=>i.verticalPerHour(e)!==void 0);if(a.length===0)return t.empty(e);G(e,Ud([n(`col.date`),n(`col.name`),n(`col.distance`),n(`col.ascent`),n(`hv.vam`)],a.map(e=>[r.day(Ef(e)),e.name??``,zd(t,r.num(Y(e.km),1),` km`),zd(t,r.num(Y(e.ascentM)),` m`),zd(t,r.num(i.verticalPerHour(e)),` m/h`)]),[2,3,4]))}}),K({id:`bikeDetails`,render(e,t){let{t:n,fmt:r,calc:i}=t,a=t.activities;if(a.length===0)return t.empty(e);let o=a.filter(e=>d(e.type??``)),s=a.filter(e=>!d(e.type??``)).reduce((e,t)=>e+m(t),0),c=o.reduce((e,t)=>e+m(t),0);if(G(e,Bd(q(n(`bd.outdoor`),r.hours(s),n(`bd.rides`,{n:a.length-o.length})),q(n(`bd.indoor`),r.hours(c),n(`bd.rides`,{n:o.length})))),a.length>1){let r=t.weeks.map((e,n)=>a.filter(e=>Of(t,e)===n));t.chart(e,{type:`bar`,data:{labels:t.weeks.map(e=>Gd(t,e)),datasets:[{type:`line`,label:n(`tk.speed`),data:r.map(e=>{let t=i.timedDistance(e);return t.seconds>0?t.km/(t.seconds/3600):null}),borderColor:t.color(`cycling`),yAxisID:`y`,spanGaps:!0},{type:`bar`,label:n(`lr.ascent`),data:r.map(e=>e.reduce((e,t)=>e+(Y(t.ascentM)??0),0)),backgroundColor:`${t.color(`hiking`)}88`,yAxisID:`y1`}]},options:{scales:{y:{title:{display:!0,text:`km/h`}},y1:{position:`right`,grid:{drawOnChartArea:!1},title:{display:!0,text:`m`}}}}},200)}G(e,Ud([n(`col.date`),n(`col.name`),n(`col.distance`),n(`tk.speed`),n(`col.ascent`),n(`bd.where`)],a.map(e=>[r.day(Ef(e)),e.name??``,zd(t,r.num(Y(e.km),1),` km`),zd(t,r.num(Df(e),1),` km/h`),zd(t,r.num(Y(e.ascentM)),` m`),d(e.type??``)?n(`bd.indoor`):n(`bd.outdoor`)]),[2,3,4]))}}),K({id:`swimDetails`,render(e,t){let{t:n,fmt:r,calc:i}=t;if(t.activities.length===0)return t.empty(e);G(e,Ud([n(`col.date`),n(`col.name`),n(`col.distance`),n(`sw.pace`),`SWOLF`,n(`sw.lengths`),n(`sw.strokes`),n(`sw.pool`)],t.activities.map(e=>[r.day(Ef(e)),e.name??``,zd(t,r.num(Y(e.km),2),` km`),zd(t,r.hms(i.swimPace(e)),`/100 m`),r.num(Y(e.swolf)),r.num(Y(e.lengths)),r.num(Y(e.strokes)),zd(t,r.num(Y(e.poolLengthM)),` m`)]),[2,3,4,5,6,7]))}}),K({id:`racketDetails`,render(e,t){let{t:n,fmt:r,calc:i}=t;if(t.activities.length===0)return t.empty(e);let a=i.zonesOf(t.data.zones).floors,o=i.runLoadPerMinute(qd(t)),c=!1,l=t.activities.map(e=>{let t=i.zoneSeconds(e,a);c||=!!t?.approximate;let l=o===null?void 0:o*m(e)/60,u=s(e.type??``);return[r.day(Ef(e)),e.name??``,u?n(`sport.${u}`):(e.type??``).replaceAll(`_`,` `),r.hours(m(e)),r.num(Y(e.avgHR)),r.num(Y(e.maxHR)),t?`${r.num((t.sec[2]+t.sec[3]+t.sec[4])/60)} min`:r.na,t?`${r.num(i.zoneShare(t.sec,[3,4])??void 0)}%`:r.na,r.num(Y(e.calories)===void 0?void 0:i.perHour(Y(e.calories),e)),r.num(Y(e.aerobicTE),1),`${r.num(Y(e.trainingLoad))} / ${r.num(l)}`]});G(e,Ud([n(`col.date`),n(`col.name`),n(`col.sport`),n(`col.time`),n(`col.hr`),n(`pd.peak`),n(`pd.z3`),n(`pd.z45`),n(`pd.kcal`),n(`te.aerobic`),n(`pd.load`)],l,[3,4,5,6,7,8,9,10]),J(n(`pd.note`)),c&&J(n(`zones.approximate`)))}});let kf=e=>`mg.${e}`,Af=[`strengthTraining`,`accent`,`good`,`warn`,`bad`,`swimming`,`hiking`,`racket`,`cycling`,`running`,`generic`];K({id:`setsPerCategory`,render(e,t){if(vf(e,t))return;let n=t.calc.setsByCategory(t.activities,t.weeks),r=Object.keys(n).toSorted((e,t)=>jf(n[t])-jf(n[e]));t.chart(e,{type:`bar`,data:{labels:t.weeks.map(e=>Gd(t,e)),datasets:r.map((e,r)=>({label:e,data:n[e],backgroundColor:t.color(Af[r%Af.length])}))},options:{scales:{x:{stacked:!0},y:{stacked:!0,ticks:{precision:0},title:{display:!0,text:t.t(`ex.sets`)}}}}},260)}});let jf=e=>e.reduce((e,t)=>e+t,0);K({id:`muscleBalance`,render(e,t){let{t:n,fmt:r,calc:i}=t;if(vf(e,t))return;let a=i.muscleSets(t.activities,t.weeks),o=i.MUSCLE_GROUPS.filter(e=>a[e]),s=o.map(e=>jf(a[e])/t.weeks.length),c=i.pushPull(a);G(e,Bd(q(n(`mb.pushPull`),c===null?r.na:`${r.num(c,2)} : 1`))),t.chart(e,{type:`bar`,data:{labels:o.map(e=>n(kf(e))),datasets:[{label:n(`mb.avg`),data:s,backgroundColor:s.map(e=>t.color(e<10?`warn`:e>20?`bad`:`good`))}]},options:{indexAxis:`y`,plugins:{legend:{display:!1},tooltip:{callbacks:{label:e=>`${r.num(e.parsed.x??void 0,1)} ${n(`mb.perWeek`)}`}}},scales:{x:{title:{display:!0,text:n(`mb.perWeek`)}}}}},Math.max(160,o.length*26)),G(e,J(n(`mb.note`)))}});let Mf=/* @__PURE__ */ new Map;K({id:`exercises`,render(e,t){let{t:n,calc:r}=t,i=r.exerciseStats(t.activities);if(i.length===0)return t.empty(e);let a=`${t.board}/${t.id}`,o=Mf.get(a)??{sort:`group`,desc:!1,group:null,search:``};Mf.set(a,o);let s=r.MUSCLE_GROUPS.filter(e=>i.some(t=>t.muscle===e)),c=W(`div`,{class:`ex-table`}),l=W(`div`,{class:`chips`,role:`group`,"aria-label":n(`ex.groups`)}),u=W(`input`,{type:`search`,class:`search`,placeholder:n(`ex.search`),"aria-label":n(`ex.search`),value:o.search});u.addEventListener(`input`,()=>{o.search=u.value,f()});let d=()=>Ou(()=>l.replaceChildren(W(`button`,{class:`chip`,"aria-pressed":String(o.group===null),onclick:()=>{o.group=null,d(),f()}},n(`type.all`)),...s.map(e=>W(`button`,{class:`chip`,"aria-pressed":String(o.group===e),onclick:()=>{o.group=o.group===e?null:e,d(),f()}},n(kf(e))))));d();let f=()=>Ou(()=>c.replaceChildren(Nf(t,i,o,f)));f(),G(e,W(`div`,{class:`ex-tools`},l,u),c);let p=i.find(e=>r.slug(e.name)===t.item);p&&G(e,Lf(t,p)),G(e,J(n(`rec.estimate`)))}});function Nf(e,t,n,r){let{t:i,fmt:a,calc:o}=e,s={name:e=>e.name,sessions:e=>e.sessions.length,last:e=>e.sessions.at(-1).date,top:e=>e.sessions.at(-1).top?.kg??e.sessions.at(-1).maxReps,best:e=>e.best1rm??0,change:e=>e.change??-1/0},c=[[`name`,`ex.name`],[`sessions`,`ex.sessions`],[`last`,`ex.last`],[`top`,`ex.top`],[`best`,`ex.best`],[`change`,`ex.change`]],l=e=>{n.desc=n.sort===e?!n.desc:e!==`name`,n.sort=e,r()},u=W(`tr`,{},...c.map(([e,t],r)=>W(`th`,{scope:`col`,class:r>0?`num`:void 0,"aria-sort":n.sort===e?n.desc?`descending`:`ascending`:void 0},W(`button`,{class:`sort`,onclick:()=>l(e)},i(t),n.sort===e?n.desc?` ↓`:` ↑`:``))),W(`th`,{scope:`col`},i(`ex.trend`))),d=W(`tbody`),f=n.search.trim().toLowerCase();for(let r of o.MUSCLE_GROUPS){if(n.group&&n.group!==r)continue;let c=t.filter(e=>e.muscle===r&&(!f||e.name.toLowerCase().includes(f)));if(c.length===0)continue;let l=n.sort===`group`?`name`:n.sort;c.sort((t,r)=>{let i=s[l](t),a=s[l](r),o=typeof i==`string`?i.localeCompare(String(a),e.lang):i-a;return n.desc?-o:o}),d.append(W(`tr`,{class:`group-row`},W(`th`,{colspan:`7`,scope:`rowgroup`},`${i(kf(r))} · ${i(`ex.groupRow`,{n:c.length,sets:c.reduce((e,t)=>e+t.completedSets,0)})}`)));for(let t of c){let n=t.sessions.at(-1),r=e.item===o.slug(t.name),i=()=>{e.setItem(r?void 0:o.slug(t.name)),r||document.getElementById(`ex-detail-${e.id}`)?.querySelector(`h3`)?.focus()};d.append(W(`tr`,{class:`ex-row${r?` selected`:``}`,"data-exercise":o.slug(t.name),onclick:i},W(`td`,{},W(`button`,{class:`linkish`,"aria-expanded":String(r),"aria-controls":`ex-detail-${e.id}`,onclick:e=>{e.stopPropagation(),i()}},t.name)),W(`td`,{class:`num`},String(t.sessions.length)),W(`td`,{class:`num`},a.day(n.date)),W(`td`,{class:`num`},Pf(e,t,n)),W(`td`,{class:`num`},t.best1rm===void 0?``:`${a.num(t.best1rm,1)} kg`),W(`td`,{class:`num`},t.change===null?``:W(`span`,{class:o.changeClass(t.change,!0)},`${t.change>0?`↑`:t.change<0?`↓`:`→`} ${a.pct(t.change)}`)),W(`td`,{},If(t))))}}return W(`table`,{class:`data exercises`},W(`thead`,{},u),d)}function Pf(e,t,n){return t.kind===`weight`?n.top?`${e.fmt.num(n.top.kg,1)} kg × ${n.top.reps}`:``:t.kind===`reps`?e.t(`ex.reps`,{n:n.maxReps}):`${n.longest} s`}function Ff(e,t){return t.kg?`${e.fmt.num(t.kg,1)} × ${t.reps??0}`:e.calc.timed(t)?`${t.seconds} s`:e.t(`ex.reps`,{n:t.reps??0})}function If(e){let t=e.sessions.map(t=>e.kind===`weight`?t.top?.kg??0:e.kind===`reps`?t.maxReps:t.longest),n=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);if(n.setAttribute(`viewBox`,`0 0 80 20`),n.setAttribute(`class`,`spark`),n.setAttribute(`aria-hidden`,`true`),t.length>1){let e=Math.min(...t),r=Math.max(...t)-e||1,i=document.createElementNS(`http://www.w3.org/2000/svg`,`polyline`);i.setAttribute(`points`,t.map((n,i)=>`${i/(t.length-1)*78+1},${19-(n-e)/r*18}`).join(` `)),n.append(i)}return n}function Lf(e,t){let{t:n,fmt:r}=e,i=W(`section`,{class:`detail`,id:`ex-detail-${e.id}`,"aria-label":t.name},W(`header`,{class:`detail-head`},W(`h3`,{tabindex:`-1`},t.name),W(`span`,{class:`muted small`},`${n(kf(t.muscle))}${t.medianRest===void 0?``:` · ${n(`ex.rest`,{v:r.hms(t.medianRest)})}`}`),W(`button`,{class:`tool`,"aria-label":n(`add.close`),onclick:()=>e.setItem(void 0)},`✕`)));if(t.sessions.length>1){let a=t.sessions.map(e=>r.day(e.date)),o=(t,n,r)=>({type:`line`,label:t,data:n,borderColor:e.color(r),yAxisID:`y`,spanGaps:!0}),s=t.kind===`weight`?[o(n(`ex.weight`),t.sessions.map(e=>e.top?.kg??null),`strengthTraining`),o(n(`ex.e1rm`),t.sessions.map(e=>e.e1rm??null),`accent`),{type:`bar`,label:n(`ex.volume`),data:t.sessions.map(e=>e.volume),backgroundColor:`${e.color(`muted`)}55`,yAxisID:`y1`}]:t.kind===`reps`?[o(n(`ex.maxReps`),t.sessions.map(e=>e.maxReps),`strengthTraining`),{type:`bar`,label:n(`ex.totalReps`),data:t.sessions.map(e=>e.reps),backgroundColor:`${e.color(`muted`)}55`,yAxisID:`y1`}]:[o(n(`ex.longest`),t.sessions.map(e=>e.longest),`strengthTraining`)];e.chart(i,{type:`bar`,data:{labels:a,datasets:s},options:{scales:{y:{position:`left`},y1:{position:`right`,grid:{drawOnChartArea:!1},display:s.length>2||t.kind===`reps`}}}},200)}else G(i,J(n(`one.session`)));let a=W(`ol`,{class:`ex-sessions`,reversed:!0});for(let i of t.sessions.toReversed()){let o=i.sets.map(i=>{let a=e.calc.completed(i),o=Ff(e,i),s=i.kg&&i.reps&&t.best1rm?` (${r.num(i.kg/t.best1rm*100)}%)`:``,c=i.restSec?` · ${n(`ex.restAfter`,{v:r.hms(i.restSec)})}`:``;return W(`li`,{class:a?void 0:`not-done`},`${o}${s}${c}${a?``:` · ${n(`ex.notDone`)}`}`)});a.append(W(`li`,{},W(`strong`,{},`${r.day(i.date)} · ${i.workout}`),W(`ul`,{class:`sets`},...o)))}return G(i,a),i}K({id:`strengthSessions`,render(e,t){let{t:n,fmt:r,calc:i}=t,a=t.activities.filter(e=>i.exercisesOf(e).length>0);if(a.length===0)return t.empty(e);let o=[];for(let e of a){let a=i.exercisesOf(e);o.push(W(`details`,{class:`session`},W(`summary`,{},`${r.day(String(e.start).slice(0,10))} · ${e.name??``} · ${n(`ss.count`,{n:a.length})}`),W(`ol`,{class:`ex-sessions`},...a.map(e=>W(`li`,{},W(`strong`,{},e.exercise),W(`span`,{class:`muted small`},` · ${n(kf(i.exerciseGroup(e)))}`),W(`div`,{class:`small`},e.sets.map(e=>Ff(t,e)).join(`, `)))))))}G(e,...o,Vd(t,o.slice(6),o.length))}});let Rf=window.GARMIN??{data:null,layout:null,widgets:[]},zf=e=>new DOMParser().parseFromString(e,`text/html`).documentElement.textContent??``;Rf.data?.notes&&(Rf.data.notes=Rf.data.notes.map(zf));let Bf=window.GARMIN_SETTINGS??{},Vf=`garmin-layout:${location.pathname}`,Hf=[`running`,`strengthTraining`,`walking`,`cycling`,`racket`],Uf=Mu.get(`garmin-lang`)??Bf.language??`auto`,Wf=`en`,X=Sd(`en`),Gf=Td(`en`),Kf=$u(Rf.layout),qf=ed(Kf,Op()),Jf=td(Kf,Op()),Z,Yf=!1,Xf=null,Zf=!1,Qf=!1,$f=[],Q=[];function ep(){window.Chart=U,yd(Rf.languages),yd(Rf.i18n),Bf.languages&&!Bf.languages.includes(`en`)&&delete vd.en,Md(Bf.exclude??[]);for(let e of Array.isArray(Rf.widgets)?Rf.widgets:[]){let t=Rp(e);t&&Ad(t)}tp(Uf);let e=Rf.data;if(e){let t=new Set(e.activities.map(c)),n=Bf.sports;$f=[`all`,...Bf.exclude?.includes(`recovery`)?[]:[`recovery`],...l(t).filter(e=>n?n.includes(e):Hf.includes(e)||t.has(e))],Q=_(e.start,e.end)}Z=Id(location.hash,$f,Q),window.addEventListener(`hashchange`,()=>{Z=Id(location.hash,$f,Q),$()}),matchMedia(`(prefers-color-scheme: light)`).addEventListener(`change`,()=>$()),document.addEventListener(`click`,e=>{let t=document.querySelector(`.account[open]`);t&&!t.contains(e.target)&&(t.open=!1)}),document.addEventListener(`keydown`,e=>{if(e.key!==`Escape`)return;let t=document.querySelector(`.account[open]`);t?(t.open=!1,t.querySelector(`summary`).focus()):Yf&&!document.querySelector(`dialog[open]`)&&(e.preventDefault(),hp())}),window.addEventListener(`beforeunload`,e=>{fp()&&e.preventDefault()}),document.addEventListener(`focusin`,e=>{let t=document.querySelector(`.account[open]`);t&&!t.contains(e.target)&&(t.open=!1)}),ku(``),$()}function tp(e){Uf=e,Wf=xd(e,navigator.languages??[navigator.language]),Wf in vd||(Wf=Object.keys(vd)[0]),X=Sd(Wf),Gf=Td(Wf),document.documentElement.lang=Wf}function $(){let e=document.getElementById(`app`);if(Hu(),Lu(),document.title=ip(),!Rf.data){e.replaceChildren(W(`main`,{class:`page`},W(`h1`,{},ip()),W(`p`,{},X(`noData`)),rp()));return}history.replaceState(null,``,Ld(Z)),Zf=document.querySelector(`.account[open]`)!==null;let t=Rf.data;Ou(()=>e.replaceChildren(W(`div`,{class:`page`},W(`a`,{class:`skip`,href:`#board`,onclick:e=>{e.preventDefault(),document.getElementById(`board`)?.focus()}},X(`skip`)),ap(t),Yf&&Np(),vp(t),rp(t))))}let np=`https://github.com/indaco/garmin-personal-mcp`;function rp(e){let t=Number(e?.sync?.failedDays)||0;return W(`footer`,{class:`foot`},e&&W(`div`,{class:`source`},e.generated&&W(`p`,{},X(`footer.updated`,{date:Gf.longDay(e.generated)})),t>0&&W(`p`,{class:`gap`},X(`footer.failed`,{n:t}))),W(`p`,{class:`made`},W(`a`,{class:`brand`,href:np},hd(),`garmin-personal-mcp`),`·`,W(`a`,{href:`${np}/blob/main/LICENSE`,rel:`noopener`},X(`footer.license`))))}let ip=()=>Bf.title??X(`title`);function ap(e){let t=(/* @__PURE__ */ new Date(`${e.end}T00:00:00Z`)).getUTCDay()!==0;return W(`header`,{class:`top`},W(`div`,{class:`title-row`},W(`div`,{class:`title`},hd(),W(`div`,{},W(`h1`,{},ip()),W(`h2`,{class:`headline`},Bf.headline??X(`headline`)),W(`p`,{class:`muted`},X(`period`,{from:Gf.longDay(e.start),to:Gf.longDay(e.end)})))),W(`div`,{class:`menus`},op())),gp(t),_p(e))}function op(){return W(`details`,{class:`account`,open:Zf},W(`summary`,{"aria-label":X(`menu.settings`),title:X(`menu.settings`)},md(`settings`)),W(`div`,{class:`account-panel`},!Yf&&up(),!Yf&&W(`hr`,{class:`menu-sep`}),Object.keys(vd).length>1&&sp(),cp().length>1&&lp()))}function sp(){let e=W(`select`,{id:`lang`,onchange:e=>{let t=e.target.value;Mu.set(`garmin-lang`,t),tp(t),$()}},W(`option`,{value:`auto`,selected:Uf===`auto`},X(`lang.auto`)),...Object.entries(vd).map(([e,t])=>W(`option`,{value:e,lang:e,selected:Uf===e},t)));return W(`label`,{class:`menu`},W(`span`,{},X(`menu.language`)),e)}let cp=()=>Au.filter(e=>!Bf.themes||Bf.themes.includes(e.id));function lp(){let e=document.documentElement.dataset.theme??`midnight`,t=cp(),n=W(`select`,{id:`theme`,onchange:e=>{let t=e.target.value;document.documentElement.dataset.theme=t,Mu.set(`garmin-theme`,t),$()}},...[`auto`,`dark`,`light`,`accessible`].filter(e=>t.some(t=>t.group===e)).map(n=>W(`optgroup`,{label:X(`themeGroup.${n}`)},...t.filter(e=>e.group===n).map(t=>W(`option`,{value:t.id,selected:t.id===e},X(ju(t.id)))))));return W(`label`,{class:`menu`},W(`span`,{},X(`menu.theme`)),n)}function up(){return W(`button`,{class:`btn edit-start`,onclick:dp},X(`edit.start`))}function dp(){document.querySelector(`.account[open]`)?.removeAttribute(`open`),Yf=!0,Xf=qf,$(),document.querySelector(`.edit-bar .btn`)?.focus()}function fp(){return Xf!==null&&JSON.stringify(Xf)!==JSON.stringify(qf)}function pp(){Yf=!1,Xf=null,$(),document.querySelector(`.account summary`)?.focus()}function mp(){let e=fp();e&&Dp(Xf),pp(),ku(X(e?`said.saved`:`said.unchanged`))}function hp(){if(!fp())return pp();let e=W(`button`,{class:`btn`},X(`discard.keep`)),t=W(`button`,{class:`btn primary`},X(`discard.confirm`)),n=Pp(X(`discard.title`),W(`p`,{},X(`discard.text`)),W(`div`,{class:`dialog-actions`},e,t));e.addEventListener(`click`,()=>n.close()),t.addEventListener(`click`,()=>{n.close(),pp(),ku(X(`said.discarded`))}),e.focus()}function gp(e){let t=(e,t)=>{Z={...Z,from:e,to:t},$()},n=[4,8,12].filter(e=>e<Q.length),r=e=>Z.to===Q.at(-1)&&Z.from===Q[Q.length-e],i=(t,n)=>`${Gf.day(t)}${e&&n===Q.length-1?` *`:``}`,a=(e,t,n)=>W(`select`,{id:e,onchange:e=>n(e.target.value)},...Q.map((e,n)=>W(`option`,{value:e,selected:e===t},i(e,n)))),o=n.find(r),s=o===void 0?Z.from===Q[0]&&Z.to===Q.at(-1)?X(`window.all`):`${Gf.day(Z.from)} – ${Gf.day(Z.to)}`:X(`window.last`,{n:o});return W(`div`,{class:`window`},W(`button`,{class:`chip window-toggle`,"aria-expanded":String(Qf),"aria-controls":`window-bar`,onclick:()=>{Qf=!Qf,$()}},`${X(`window.label`)}: ${s}`,W(`span`,{"aria-hidden":`true`},` ▾`)),W(`div`,{id:`window-bar`,class:`window-bar${Qf?` open`:``}`,role:`group`,"aria-label":X(`window.label`)},...n.map(e=>W(`button`,{class:`chip`,"aria-pressed":String(r(e)),onclick:()=>t(Q[Q.length-e],Q.at(-1))},X(`window.last`,{n:e}))),W(`button`,{class:`chip`,"aria-pressed":String(Z.from===Q[0]&&Z.to===Q.at(-1)),onclick:()=>t(Q[0],Q.at(-1))},X(`window.all`)),W(`label`,{class:`menu`},W(`span`,{},X(`window.from`)),a(`from`,Z.from,e=>t(e,e>Z.to?e:Z.to))),W(`label`,{class:`menu`},W(`span`,{},X(`window.to`)),a(`to`,Z.to,e=>t(e<Z.from?e:Z.from,e))),e&&W(`span`,{class:`muted small`},X(`inProgress`))))}function _p(e){let t=v(e.activities,Z.from,Z.to),n=e=>e===`all`?t.length:t.filter(t=>c(t)===e).length,r=e=>{Z={tab:e,from:Z.from,to:Z.to},$(),document.querySelector(`[role=tab][data-tab="${e}"]`)?.focus()},i=W(`nav`,{class:`tabs`,role:`tablist`,"aria-label":X(`tabs.label`),onkeydown:e=>{let t=$f.indexOf(Z.tab);if(e.key===`ArrowRight`)r($f[(t+1)%$f.length]);else if(e.key===`ArrowLeft`)r($f[(t-1+$f.length)%$f.length]);else if(e.key===`Home`)r($f[0]);else if(e.key===`End`)r($f.at(-1));else return;e.preventDefault()}},...$f.map(e=>W(`button`,{role:`tab`,id:`tab-${e}`,"aria-controls":`board`,"data-tab":e,"aria-selected":String(e===Z.tab),tabindex:e===Z.tab?`0`:`-1`,class:`tab tab-${e}`,onclick:()=>r(e)},md(e),W(`span`,{},Rd(X,e)),e!==`recovery`&&W(`span`,{class:`count`},n(e))))),a=()=>i.classList.toggle(`more`,i.scrollLeft+i.clientWidth<i.scrollWidth-4);return i.addEventListener(`scroll`,a),new ResizeObserver(a).observe(i),i}function vp(e){let t=Uu(Xf??qf,Z.tab,Dd),n=W(`div`,{class:`grid${Yf?` editing`:``}`});for(let r of t){let t=Nd(r.widget);!r.hidden&&(t||Yf&&!jd.has(r.widget))&&n.append(Sp(e,r,t))}n.childElementCount===0&&n.append(W(`div`,{class:`board-empty`},W(`p`,{},X(Yf?`board.emptyEdit`:`board.empty`)),!Yf&&W(`button`,{class:`btn primary`,onclick:dp},X(`edit.start`))));let r=Z.tab===`recovery`&&W(`p`,{class:`muted board-note`},X(`rec.board`));return W(`main`,{id:`board`,role:`tabpanel`,"aria-labelledby":`tab-${Z.tab}`,tabindex:`-1`},Jf&&!Yf&&yp(Jf),r,n)}function yp(e){return W(`div`,{class:`banner`,role:`region`,"aria-label":X(`stale.label`)},W(`p`,{},X(`stale.text`)),W(`button`,{class:`btn`,onclick:()=>{Dp(e),ku(X(`stale.kept`))}},X(`stale.keep`)),W(`button`,{class:`btn`,onclick:()=>{Mu.remove(Vf),Jf=null,$(),ku(X(`stale.used`))}},X(`stale.new`)))}function bp(){return Z.tab===`recovery`?`all`:Z.tab}function xp(e,t){if(!t)return X(`widget.unknown`,{id:e.widget});let n=e.type&&e.type!==bp()?` · ${Rd(X,e.type)}`:``;return t.title(X)+n}function Sp(e,t,n){let r=xp(t,n),i=`h-${t.id}`,a=W(`div`,{class:`tile-body`}),o=W(`section`,{class:`tile span-${Math.max(t.span,n?.minSpan??1)}`,"data-id":t.id,"data-widget":t.widget,"aria-labelledby":i},W(`header`,{class:`tile-head`},W(`h2`,{id:i},r),Yf&&kp(t,r)),a,Yf&&Mp(t,r,n));if(n)try{n.render(a,Cp(e,t))}catch(e){a.replaceChildren(W(`p`,{class:`error`},X(`widget.failed`,{message:e.message}))),console.warn(`widget ${t.widget}:`,e)}return o}function Cp(e,t){let n=t.type??bp(),i=v(e.activities,Z.from,Z.to),a=e=>n===`all`?e:e.filter(e=>c(e)===n);return{data:e,id:t.id,board:Z.tab,type:n,from:Z.from,to:Z.to,weeks:Q.filter(e=>e>=Z.from&&e<=Z.to),activities:a(i),ofType:a,allActivities:i,lang:Wf,t:X,fmt:Gf,calc:{...r,...y,...de,...be,...Fe},chart:Vu,color:e=>Nu(e)||Nu(`generic`),empty:(e,t)=>e.replaceChildren(W(`p`,{class:`muted empty`},t??X(`empty.window`))),item:Z.item,setItem:e=>{Z={...Z,item:e},$()},refresh:$}}function wp(){return Uu(Xf??qf,Z.tab,Dd)}function Tp(e){Ep(Wu(Xf??qf,Z.tab,e))}function Ep(e){Xf=e,$()}function Dp(e){qf=e,Jf=null,Mu.set(Vf,JSON.stringify({baseRev:Kf.rev,layout:qf})),$()}function Op(){try{let e=JSON.parse(Mu.get(Vf)??`null`);return e&&typeof e==`object`&&`baseRev`in e?e:null}catch{return null}}function kp(e,t){let n=W(`button`,{class:`tool grip`,"aria-label":X(`edit.move`,{title:t}),title:X(`edit.moveHint`),"aria-pressed":`false`},`⠿`);n.addEventListener(`pointerdown`,r=>ld(r,n,n=>Ap(e.id,t,n))),n.addEventListener(`keydown`,r=>ud(r,n,{picked:(e,n)=>ku(X(`said.picked`,{title:t,n:e,count:n})),moved:(e,t)=>ku(X(`said.position`,{n:e,count:t})),drop:n=>Ap(e.id,t,n),cancel:()=>{$(),ku(X(`said.cancelled`,{title:t}))}}));let r=X(`edit.hide`,{title:t});return W(`div`,{class:`tools`},n,W(`button`,{class:`tool`,"aria-label":r,title:r,onclick:()=>{Tp(Xu(wp(),e.id)),ku(X(`said.hidden`,{title:t}))}},md(`eye`)))}function Ap(e,t,n){let r=Ku(wp(),e,n);Tp(r);let i=r.filter(e=>!e.hidden),a=i.findIndex(t=>t.id===e)+1;ku(X(`said.moved`,{title:t,n:a,count:i.length}))}let jp=()=>matchMedia(`(max-width: 700px)`).matches?1:matchMedia(`(max-width: 1100px)`).matches?2:3;function Mp(e,t,n){let r=n?.minSpan??1,i=jp(),a=Math.min(e.span,i),o=(n,r)=>{let i=Ju(n,e.span,r);i!==e.span&&(Tp(Yu(wp(),e.id,i)),ku(X(`said.width`,{title:t,n,cols:r})))},s=W(`div`,{class:`resize`,role:`slider`,tabindex:`0`,"aria-label":X(`edit.width`,{title:t}),"aria-valuemin":Math.min(r,i),"aria-valuemax":i,"aria-valuenow":a,"aria-valuetext":X(`edit.widthValue`,{n:a,cols:i}),title:X(`edit.width`,{title:t}),onkeydown:e=>{let t={ArrowRight:a+1,ArrowUp:a+1,ArrowLeft:a-1,ArrowDown:a-1,Home:r,End:i};e.key in t&&(e.preventDefault(),o(Math.max(Math.min(r,i),Math.min(i,t[e.key])),i))}});return s.addEventListener(`pointerdown`,e=>fd(e,s,r,o)),s}function Np(){let e=wp().filter(e=>e.hidden).length;return W(`div`,{class:`edit-bar`,role:`toolbar`,"aria-label":X(`edit.bar`)},W(`strong`,{},X(`edit.editing`,{board:Rd(X,Z.tab)})),fp()&&W(`span`,{class:`unsaved muted small`},X(`edit.unsaved`)),W(`span`,{class:`spacer`}),W(`button`,{class:`btn`,onclick:Ip},e>0?X(`edit.addHidden`,{n:e}):X(`edit.add`)),W(`button`,{class:`btn`,onclick:()=>Ep(Gu(Xf??qf,Z.tab,Dd))},X(`edit.reset`)),W(`button`,{class:`btn`,onclick:Lp},X(`edit.copy`)),W(`button`,{class:`btn`,onclick:hp},X(`edit.discard`)),W(`button`,{class:`btn primary`,onclick:mp},X(`edit.done`)))}function Pp(e,...t){let n=W(`dialog`,{class:`dialog`,"aria-label":e,onclose:()=>n.remove()},W(`header`,{class:`dialog-head`},W(`h2`,{},e),W(`button`,{class:`tool`,"aria-label":X(`add.close`),onclick:()=>n.close()},`✕`)),...t);return document.body.append(n),n.showModal(),n}let Fp=e=>e!==`all`&&e!==`recovery`&&!i.includes(e);function Ip(){let e=wp(),t=bp(),n=W(`ul`,{class:`catalogue`}),r=Pp(X(`add.title`),n),i=(n,i)=>{r.close(),Tp(Zu(e,n.id,{type:i===t?void 0:i,span:n.span??1})),ku(X(`said.added`,{title:n.title(X)}))},a=Pd().filter(t=>t.types!==void 0||!e.some(e=>e.widget===t.id)).toSorted((e,t)=>e.title(X).localeCompare(t.title(X),Wf));for(let e of a){let r=e.types?.flatMap(e=>e===`generic`?[...$f.filter(Fp),e]:[e]).filter(e=>e===`all`||$f.includes(e)),a=r&&r.length>0?W(`select`,{"aria-label":X(`add.type`)},...r.map(e=>W(`option`,{value:e,selected:e===t},Rd(X,e)))):void 0;n.append(W(`li`,{},W(`span`,{},e.title(X)),a,W(`button`,{class:`btn`,"aria-label":X(`add.addOne`,{title:e.title(X)}),onclick:()=>i(e,a?.value)},X(`add.add`))))}let o=e.filter(e=>e.hidden);if(o.length>0){n.append(W(`li`,{class:`group`},X(`add.hiddenGroup`)));for(let t of o){let i=xp(t,Nd(t.widget));n.append(W(`li`,{},W(`span`,{},i),W(`button`,{class:`btn`,onclick:()=>{r.close(),Tp(Xu(e,t.id)),ku(X(`said.shown`,{title:i}))}},X(`edit.show`,{title:i})),W(`button`,{class:`btn`,onclick:()=>{r.close(),Tp(Qu(e,t.id)),ku(X(`said.removed`,{title:i}))}},X(`edit.remove`,{title:i}))))}}n.childElementCount===0&&n.append(W(`li`,{},X(`add.none`)))}function Lp(){let e=Xf??qf,t=JSON.stringify({base:e.base,boards:e.boards}),n=W(`textarea`,{class:`layout-text`,readonly:!0,rows:6},t),r=W(`button`,{class:`btn`},X(`copy.copy`));r.addEventListener(`click`,async()=>{n.select();try{await navigator.clipboard.writeText(t)}catch{document.execCommand(`copy`)}r.textContent=X(`copy.copied`)}),Pp(X(`copy.title`),W(`p`,{},X(`copy.hint`)),n,W(`div`,{class:`dialog-actions`},r))}function Rp(e){if(!e||typeof e!=`object`)return;let{id:t,title:n,code:r,span:i,types:a}=e;if(typeof t!=`string`||typeof r!=`string`)return;let o;try{o=Function(`el`,`ctx`,r)}catch(e){o=()=>{throw Error(e.message,{cause:e})}}return{id:t,title:()=>typeof n==`string`?n:t,span:Math.min(3,Math.max(1,Math.round(Number(i)||1))),types:Array.isArray(a)?a:void 0,render:o}}ep()})();</script>
|
|
78
|
+
`):e}function bl(e,t){let{element:n,datasetIndex:r,index:i}=t,a=e.getDatasetMeta(r).controller,{label:o,value:s}=a.getLabelAndValue(i);return{chart:e,label:o,parsed:a.getParsed(i),raw:e.data.datasets[r].data[i],formattedValue:s,dataset:a.getDataset(),dataIndex:i,datasetIndex:r,element:n}}function xl(e,t){let n=e.chart.ctx,{body:r,footer:i,title:a}=e,{boxWidth:o,boxHeight:s}=t,c=H(t.bodyFont),l=H(t.titleFont),u=H(t.footerFont),d=a.length,f=i.length,p=r.length,m=V(t.padding),h=m.height,g=0,_=r.reduce((e,t)=>e+t.before.length+t.lines.length+t.after.length,0);if(_+=e.beforeBody.length+e.afterBody.length,d&&(h+=d*l.lineHeight+(d-1)*t.titleSpacing+t.titleMarginBottom),_){let e=t.displayColors?Math.max(s,c.lineHeight):c.lineHeight;h+=p*e+(_-p)*c.lineHeight+(_-1)*t.bodySpacing}f&&(h+=t.footerMarginTop+f*u.lineHeight+(f-1)*t.footerSpacing);let v=0,y=function(e){g=Math.max(g,n.measureText(e).width+v)};return n.save(),n.font=l.string,P(e.title,y),n.font=c.string,P(e.beforeBody.concat(e.afterBody),y),v=t.displayColors?o+2+t.boxPadding:0,P(r,e=>{P(e.before,y),P(e.lines,y),P(e.after,y)}),v=0,n.font=u.string,P(e.footer,y),n.restore(),g+=m.width,{width:g,height:h}}function Sl(e,t){let{y:n,height:r}=t;return n<r/2?`top`:n>e.height-r/2?`bottom`:`center`}function Cl(e,t,n,r){let{x:i,width:a}=r,o=n.caretSize+n.caretPadding;if(e===`left`&&i+a+o>t.width||e===`right`&&i-a-o<0)return!0}function wl(e,t,n,r){let{x:i,width:a}=n,{width:o,chartArea:{left:s,right:c}}=e,l=`center`;return r===`center`?l=i<=(s+c)/2?`left`:`right`:i<=a/2?l=`left`:i>=o-a/2&&(l=`right`),Cl(l,e,t,n)&&(l=`center`),l}function Tl(e,t,n){let r=n.yAlign||t.yAlign||Sl(e,n);return{xAlign:n.xAlign||t.xAlign||wl(e,t,n,r),yAlign:r}}function El(e,t){let{x:n,width:r}=e;return t===`right`?n-=r:t===`center`&&(n-=r/2),n}function Dl(e,t,n){let{y:r,height:i}=e;return t===`top`?r+=n:r-=t===`bottom`?i+n:i/2,r}function Ol(e,t,n,r){let{caretSize:i,caretPadding:a,cornerRadius:o}=e,{xAlign:s,yAlign:c}=n,l=i+a,{topLeft:u,topRight:d,bottomLeft:f,bottomRight:p}=Ar(o),m=El(t,s),h=Dl(t,c,l);return c===`center`?s===`left`?m+=l:s===`right`&&(m-=l):s===`left`?m-=Math.max(u,f)+i:s===`right`&&(m+=Math.max(d,p)+i),{x:z(m,0,r.width-t.width),y:z(h,0,r.height-t.height)}}function kl(e,t,n){let r=V(n.padding);return t===`center`?e.x+e.width/2:t===`right`?e.x+e.width-r.right:e.x+r.left}function Al(e){return vl([],yl(e))}function jl(e,t,n){return Nr(e,{tooltip:t,tooltipItems:n,type:`tooltip`})}function Ml(e,t){let n=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return n?e.override(n):e}let Nl={beforeTitle:Mt,title(e){if(e.length>0){let t=e[0],n=t.chart.data.labels,r=n?n.length:0;if(this&&this.options&&this.options.mode===`dataset`)return t.dataset.label||``;if(t.label)return t.label;if(r>0&&t.dataIndex<r)return n[t.dataIndex]}return``},afterTitle:Mt,beforeBody:Mt,beforeLabel:Mt,label(e){if(this&&this.options&&this.options.mode===`dataset`)return e.label+`: `+e.formattedValue||e.formattedValue;let t=e.dataset.label||``;t&&(t+=`: `);let n=e.formattedValue;return O(n)||(t+=n),t},labelColor(e){let t=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{borderColor:t.borderColor,backgroundColor:t.backgroundColor,borderWidth:t.borderWidth,borderDash:t.borderDash,borderDashOffset:t.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(e){let t=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{pointStyle:t.pointStyle,rotation:t.rotation}},afterLabel:Mt,afterBody:Mt,beforeFooter:Mt,footer:Mt,afterFooter:Mt};function Pl(e,t,n,r){let i=e[t].call(n,r);return i===void 0?Nl[t].call(n,r):i}var Fl=class extends Bo{static positioners=_l;constructor(e){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=e.chart,this.options=e.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(e){this.options=e,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){let e=this._cachedAnimations;if(e)return e;let t=this.chart,n=this.options.setContext(this.getContext()),r=n.enabled&&t.options.animation&&n.animations,i=new Qi(this.chart,r);return r._cacheable&&(this._cachedAnimations=Object.freeze(i)),i}getContext(){return this.$context||=jl(this.chart.getContext(),this,this._tooltipItems)}getTitle(e,t){let{callbacks:n}=t,r=Pl(n,`beforeTitle`,this,e),i=Pl(n,`title`,this,e),a=Pl(n,`afterTitle`,this,e),o=[];return o=vl(o,yl(r)),o=vl(o,yl(i)),o=vl(o,yl(a)),o}getBeforeBody(e,t){return Al(Pl(t.callbacks,`beforeBody`,this,e))}getBody(e,t){let{callbacks:n}=t,r=[];return P(e,e=>{let t={before:[],lines:[],after:[]},i=Ml(n,e);vl(t.before,yl(Pl(i,`beforeLabel`,this,e))),vl(t.lines,Pl(i,`label`,this,e)),vl(t.after,yl(Pl(i,`afterLabel`,this,e))),r.push(t)}),r}getAfterBody(e,t){return Al(Pl(t.callbacks,`afterBody`,this,e))}getFooter(e,t){let{callbacks:n}=t,r=Pl(n,`beforeFooter`,this,e),i=Pl(n,`footer`,this,e),a=Pl(n,`afterFooter`,this,e),o=[];return o=vl(o,yl(r)),o=vl(o,yl(i)),o=vl(o,yl(a)),o}_createItems(e){let t=this._active,n=this.chart.data,r=[],i=[],a=[],o=[],s,c;for(s=0,c=t.length;s<c;++s)o.push(bl(this.chart,t[s]));return e.filter&&(o=o.filter((t,r,i)=>e.filter(t,r,i,n))),e.itemSort&&(o=o.sort((t,r)=>e.itemSort(t,r,n))),P(o,t=>{let n=Ml(e.callbacks,t);r.push(Pl(n,`labelColor`,this,t)),i.push(Pl(n,`labelPointStyle`,this,t)),a.push(Pl(n,`labelTextColor`,this,t))}),this.labelColors=r,this.labelPointStyles=i,this.labelTextColors=a,this.dataPoints=o,o}update(e,t){let n=this.options.setContext(this.getContext()),r=this._active,i,a=[];if(!r.length)this.opacity!==0&&(i={opacity:0});else{let e=_l[n.position].call(this,r,this._eventPosition);a=this._createItems(n),this.title=this.getTitle(a,n),this.beforeBody=this.getBeforeBody(a,n),this.body=this.getBody(a,n),this.afterBody=this.getAfterBody(a,n),this.footer=this.getFooter(a,n);let t=this._size=xl(this,n),o=Object.assign({},e,t),s=Tl(this.chart,n,o),c=Ol(n,o,s,this.chart);this.xAlign=s.xAlign,this.yAlign=s.yAlign,i={opacity:1,x:c.x,y:c.y,width:t.width,height:t.height,caretX:e.x,caretY:e.y}}this._tooltipItems=a,this.$context=void 0,i&&this._resolveAnimations().update(this,i),e&&n.external&&n.external.call(this,{chart:this.chart,tooltip:this,replay:t})}drawCaret(e,t,n,r){let i=this.getCaretPosition(e,n,r);t.lineTo(i.x1,i.y1),t.lineTo(i.x2,i.y2),t.lineTo(i.x3,i.y3)}getCaretPosition(e,t,n){let{xAlign:r,yAlign:i}=this,{caretSize:a,cornerRadius:o}=n,{topLeft:s,topRight:c,bottomLeft:l,bottomRight:u}=Ar(o),{x:d,y:f}=e,{width:p,height:m}=t,h,g,_,v,y,b;return i===`center`?(y=f+m/2,r===`left`?(h=d,g=h-a,v=y+a,b=y-a):(h=d+p,g=h+a,v=y-a,b=y+a),_=h):(g=r===`left`?d+Math.max(s,l)+a:r===`right`?d+p-Math.max(c,u)-a:this.caretX,i===`top`?(v=f,y=v-a,h=g-a,_=g+a):(v=f+m,y=v+a,h=g+a,_=g-a),b=v),{x1:h,x2:g,x3:_,y1:v,y2:y,y3:b}}drawTitle(e,t,n){let r=this.title,i=r.length,a,o,s;if(i){let c=Ai(n.rtl,this.x,this.width);for(e.x=kl(this,n.titleAlign,n),t.textAlign=c.textAlign(n.titleAlign),t.textBaseline=`middle`,a=H(n.titleFont),o=n.titleSpacing,t.fillStyle=n.titleColor,t.font=a.string,s=0;s<i;++s)t.fillText(r[s],c.x(e.x),e.y+a.lineHeight/2),e.y+=a.lineHeight+o,s+1===i&&(e.y+=n.titleMarginBottom-o)}}_drawColorBox(e,t,n,r,i){let a=this.labelColors[n],o=this.labelPointStyles[n],{boxHeight:s,boxWidth:c}=i,l=H(i.bodyFont),u=kl(this,`left`,i),d=r.x(u),f=s<l.lineHeight?(l.lineHeight-s)/2:0,p=t.y+f;if(i.usePointStyle){let t={radius:Math.min(c,s)/2,pointStyle:o.pointStyle,rotation:o.rotation,borderWidth:1},n=r.leftForLtr(d,c)+c/2,l=p+s/2;e.strokeStyle=i.multiKeyBackground,e.fillStyle=i.multiKeyBackground,fr(e,t,n,l),e.strokeStyle=a.borderColor,e.fillStyle=a.backgroundColor,fr(e,t,n,l)}else{e.lineWidth=A(a.borderWidth)?Math.max(...Object.values(a.borderWidth)):a.borderWidth||1,e.strokeStyle=a.borderColor,e.setLineDash(a.borderDash||[]),e.lineDashOffset=a.borderDashOffset||0;let t=r.leftForLtr(d,c),n=r.leftForLtr(r.xPlus(d,1),c-2),o=Ar(a.borderRadius);Object.values(o).some(e=>e!==0)?(e.beginPath(),e.fillStyle=i.multiKeyBackground,Cr(e,{x:t,y:p,w:c,h:s,radius:o}),e.fill(),e.stroke(),e.fillStyle=a.backgroundColor,e.beginPath(),Cr(e,{x:n,y:p+1,w:c-2,h:s-2,radius:o}),e.fill()):(e.fillStyle=i.multiKeyBackground,e.fillRect(t,p,c,s),e.strokeRect(t,p,c,s),e.fillStyle=a.backgroundColor,e.fillRect(n,p+1,c-2,s-2))}e.fillStyle=this.labelTextColors[n]}drawBody(e,t,n){let{body:r}=this,{bodySpacing:i,bodyAlign:a,displayColors:o,boxHeight:s,boxWidth:c,boxPadding:l}=n,u=H(n.bodyFont),d=u.lineHeight,f=0,p=Ai(n.rtl,this.x,this.width),m=function(n){t.fillText(n,p.x(e.x+f),e.y+d/2),e.y+=d+i},h=p.textAlign(a),g,_,v,y,b,x,S;for(t.textAlign=a,t.textBaseline=`middle`,t.font=u.string,e.x=kl(this,h,n),t.fillStyle=n.bodyColor,P(this.beforeBody,m),f=o&&h!==`right`?a===`center`?c/2+l:c+2+l:0,y=0,x=r.length;y<x;++y){for(g=r[y],_=this.labelTextColors[y],t.fillStyle=_,P(g.before,m),v=g.lines,o&&v.length&&(this._drawColorBox(t,e,y,p,n),d=Math.max(u.lineHeight,s)),b=0,S=v.length;b<S;++b)m(v[b]),d=u.lineHeight;P(g.after,m)}f=0,d=u.lineHeight,P(this.afterBody,m),e.y-=i}drawFooter(e,t,n){let r=this.footer,i=r.length,a,o;if(i){let s=Ai(n.rtl,this.x,this.width);for(e.x=kl(this,n.footerAlign,n),e.y+=n.footerMarginTop,t.textAlign=s.textAlign(n.footerAlign),t.textBaseline=`middle`,a=H(n.footerFont),t.fillStyle=n.footerColor,t.font=a.string,o=0;o<i;++o)t.fillText(r[o],s.x(e.x),e.y+a.lineHeight/2),e.y+=a.lineHeight+n.footerSpacing}}drawBackground(e,t,n,r){let{xAlign:i,yAlign:a}=this,{x:o,y:s}=e,{width:c,height:l}=n,{topLeft:u,topRight:d,bottomLeft:f,bottomRight:p}=Ar(r.cornerRadius);t.fillStyle=r.backgroundColor,t.strokeStyle=r.borderColor,t.lineWidth=r.borderWidth,t.beginPath(),t.moveTo(o+u,s),a===`top`&&this.drawCaret(e,t,n,r),t.lineTo(o+c-d,s),t.quadraticCurveTo(o+c,s,o+c,s+d),a===`center`&&i===`right`&&this.drawCaret(e,t,n,r),t.lineTo(o+c,s+l-p),t.quadraticCurveTo(o+c,s+l,o+c-p,s+l),a===`bottom`&&this.drawCaret(e,t,n,r),t.lineTo(o+f,s+l),t.quadraticCurveTo(o,s+l,o,s+l-f),a===`center`&&i===`left`&&this.drawCaret(e,t,n,r),t.lineTo(o,s+u),t.quadraticCurveTo(o,s,o+u,s),t.closePath(),t.fill(),r.borderWidth>0&&t.stroke()}_updateAnimationTarget(e){let t=this.chart,n=this.$animations,r=n&&n.x,i=n&&n.y;if(r||i){let n=_l[e.position].call(this,this._active,this._eventPosition);if(!n)return;let a=this._size=xl(this,e),o=Object.assign({},n,this._size),s=Tl(t,e,o),c=Ol(e,o,s,t);(r._to!==c.x||i._to!==c.y)&&(this.xAlign=s.xAlign,this.yAlign=s.yAlign,this.width=a.width,this.height=a.height,this.caretX=n.x,this.caretY=n.y,this._resolveAnimations().update(this,c))}}_willRender(){return!!this.opacity}draw(e){let t=this.options.setContext(this.getContext()),n=this.opacity;if(!n)return;this._updateAnimationTarget(t);let r={width:this.width,height:this.height},i={x:this.x,y:this.y};n=Math.abs(n)<.001?0:n;let a=V(t.padding),o=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;t.enabled&&o&&(e.save(),e.globalAlpha=n,this.drawBackground(i,e,r,t),ji(e,t.textDirection),i.y+=a.top,this.drawTitle(i,e,t),this.drawBody(i,e,t),this.drawFooter(i,e,t),Mi(e,t.textDirection),e.restore())}getActiveElements(){return this._active||[]}setActiveElements(e,t){let n=this._active,r=e.map(({datasetIndex:e,index:t})=>{let n=this.chart.getDatasetMeta(e);if(!n)throw Error(`Cannot find a dataset at index `+e);return{datasetIndex:e,element:n.data[t],index:t}}),i=!Lt(n,r),a=this._positionChanged(r,t);(i||a)&&(this._active=r,this._eventPosition=t,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(e,t,n=!0){if(t&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;let r=this.options,i=this._active||[],a=this._getActiveElements(e,i,t,n),o=this._positionChanged(a,e),s=t||!Lt(a,i)||o;return s&&(this._active=a,(r.enabled||r.external)&&(this._eventPosition={x:e.x,y:e.y},this.update(!0,t))),s}_getActiveElements(e,t,n,r){let i=this.options;if(e.type===`mouseout`)return[];if(!r)return t.filter(e=>this.chart.data.datasets[e.datasetIndex]&&this.chart.getDatasetMeta(e.datasetIndex).controller.getParsed(e.index)!==void 0);let a=this.chart.getElementsAtEventForMode(e,i.mode,i,n);return i.reverse&&a.reverse(),a}_positionChanged(e,t){let{caretX:n,caretY:r,options:i}=this,a=_l[i.position].call(this,e,t);return a!==!1&&(n!==a.x||r!==a.y)}},Il={id:`tooltip`,_element:Fl,positioners:_l,afterInit(e,t,n){n&&(e.tooltip=new Fl({chart:e,options:n}))},beforeUpdate(e,t,n){e.tooltip&&e.tooltip.initialize(n)},reset(e,t,n){e.tooltip&&e.tooltip.initialize(n)},afterDraw(e){let t=e.tooltip;if(t&&t._willRender()){let n={tooltip:t};if(e.notifyPlugins(`beforeTooltipDraw`,{...n,cancelable:!0})===!1)return;t.draw(e.ctx),e.notifyPlugins(`afterTooltipDraw`,n)}},afterEvent(e,t){if(e.tooltip){let n=t.replay;e.tooltip.handleEvent(t.event,n,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:(e,t)=>t.bodyFont.size,boxWidth:(e,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:Nl},defaultRoutes:{bodyFont:`font`,footerFont:`font`,titleFont:`font`},descriptors:{_scriptable:e=>e!==`filter`&&e!==`itemSort`&&e!==`external`,_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:`animation`}},additionalOptionScopes:[`interaction`]};let Ll=(e,t,n,r)=>(typeof t==`string`?(n=e.push(t)-1,r.unshift({index:n,label:t})):isNaN(t)&&(n=null),n);function Rl(e,t,n,r){let i=e.indexOf(t);return i===-1?Ll(e,t,n,r):i===e.lastIndexOf(t)?i:n}let zl=(e,t)=>e===null?null:z(Math.round(e),0,t);function Bl(e){let t=this.getLabels();return e>=0&&e<t.length?t[e]:e}var Vl=class extends os{static id=`category`;static defaults={ticks:{callback:Bl}};constructor(e){super(e),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(e){let t=this._addedLabels;if(t.length){let e=this.getLabels();for(let{index:n,label:r}of t)e[n]===r&&e.splice(n,1);this._addedLabels=[]}super.init(e)}parse(e,t){if(O(e))return null;let n=this.getLabels();return t=isFinite(t)&&n[t]===e?t:Rl(n,e,M(t,e),this._addedLabels),zl(t,n.length-1)}determineDataLimits(){let{minDefined:e,maxDefined:t}=this.getUserBounds(),{min:n,max:r}=this.getMinMax(!0);this.options.bounds===`ticks`&&(e||(n=0),t||(r=this.getLabels().length-1)),this.min=n,this.max=r}buildTicks(){let e=this.min,t=this.max,n=this.options.offset,r=[],i=this.getLabels();i=e===0&&t===i.length-1?i:i.slice(e,t+1),this._valueRange=Math.max(i.length-+!n,1),this._startValue=this.min-(n?.5:0);for(let n=e;n<=t;n++)r.push({value:n});return r}getLabelForValue(e){return Bl.call(this,e)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(e){return typeof e!=`number`&&(e=this.parse(e)),e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getPixelForTick(e){let t=this.ticks;return e<0||e>t.length-1?null:this.getPixelForValue(t[e].value)}getValueForPixel(e){return Math.round(this._startValue+this.getDecimalForPixel(e)*this._valueRange)}getBasePixel(){return this.bottom}};function Hl(e,t){let n=[],{bounds:r,step:i,min:a,max:o,precision:s,count:c,maxTicks:l,maxDigits:u,includeBounds:d}=e,f=i||1,p=l-1,{min:m,max:h}=t,g=!O(a),_=!O(o),v=!O(c),y=(h-m)/(u+1),b=cn((h-m)/p/f)*f,x,S,C,w;if(b<1e-14&&!g&&!_)return[{value:m},{value:h}];w=Math.ceil(h/b)-Math.floor(m/b),w>p&&(b=cn(w*b/p/f)*f),O(s)||(x=10**s,b=Math.ceil(b*x)/x),r===`ticks`?(S=Math.floor(m/b)*b,C=Math.ceil(h/b)*b):(S=m,C=h),g&&_&&i&&fn((o-a)/i,b/1e3)?(w=Math.round(Math.min((o-a)/b,l)),b=(o-a)/w,S=a,C=o):v?(S=g?a:S,C=_?o:C,w=c-1,b=(C-S)/w):(w=(C-S)/b,w=sn(w,Math.round(w),b/1e3)?Math.round(w):Math.ceil(w));let T=Math.max(gn(b),gn(S));x=10**(O(s)?T:s),S=Math.round(S*x)/x,C=Math.round(C*x)/x;let E=0;for(g&&(d&&S!==a?(n.push({value:a}),S<a&&E++,sn(Math.round((S+E*b)*x)/x,a,Ul(a,y,e))&&E++):S<a&&E++);E<w;++E){let e=Math.round((S+E*b)*x)/x;if(_&&e>o)break;n.push({value:e})}return _&&d&&C!==o?n.length&&sn(n[n.length-1].value,o,Ul(o,y,e))?n[n.length-1].value=o:n.push({value:o}):_&&C!==o||n.push({value:C}),n}function Ul(e,t,{horizontal:n,minRotation:r}){let i=mn(r),a=(n?Math.sin(i):Math.cos(i))||.001,o=.75*t*(``+e).length;return Math.min(t/a,o)}var Wl=class extends os{constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(e,t){return O(e)||(typeof e==`number`||e instanceof Number)&&!isFinite(+e)?null:+e}handleTickRangeOptions(){let{beginAtZero:e}=this.options,{minDefined:t,maxDefined:n}=this.getUserBounds(),{min:r,max:i}=this,a=e=>r=t?r:e,o=e=>i=n?i:e;if(e){let e=on(r),t=on(i);e<0&&t<0?o(0):e>0&&t>0&&a(0)}if(r===i){let t=i===0?1:Math.abs(i*.05);o(i+t),e||a(r-t)}this.min=r,this.max=i}getTickLimit(){let{maxTicksLimit:e,stepSize:t}=this.options.ticks,n;return t?(n=Math.ceil(this.max/t)-Math.floor(this.min/t)+1,n>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${t} would result generating up to ${n} ticks. Limiting to 1000.`),n=1e3)):(n=this.computeTickLimit(),e||=11),e&&(n=Math.min(e,n)),n}computeTickLimit(){return 1/0}buildTicks(){let e=this.options,t=e.ticks,n=this.getTickLimit();n=Math.max(2,n);let r=Hl({maxTicks:n,bounds:e.bounds,min:e.min,max:e.max,precision:t.precision,step:t.stepSize,count:t.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:t.minRotation||0,includeBounds:t.includeBounds!==!1},this._range||this);return e.bounds===`ticks`&&pn(r,this,`value`),e.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}configure(){let e=this.ticks,t=this.min,n=this.max;if(super.configure(),this.options.offset&&e.length){let r=(n-t)/Math.max(e.length-1,1)/2;t-=r,n+=r}this._startValue=t,this._endValue=n,this._valueRange=n-t}getLabelForValue(e){return Qn(e,this.chart.options.locale,this.options.ticks.format)}},Gl=class extends Wl{static id=`linear`;static defaults={ticks:{callback:tr.formatters.numeric}};determineDataLimits(){let{min:e,max:t}=this.getMinMax(!0);this.min=j(e)?e:0,this.max=j(t)?t:1,this.handleTickRangeOptions()}computeTickLimit(){let e=this.isHorizontal(),t=e?this.width:this.height,n=mn(this.options.ticks.minRotation),r=(e?Math.sin(n):Math.cos(n))||.001,i=this._resolveTickFontOptions(0);return Math.ceil(t/Math.min(40,i.lineHeight/r))}getPixelForValue(e){return e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getValueForPixel(e){return this._startValue+this.getDecimalForPixel(e)*this._valueRange}};let Kl=e=>Math.floor(an(e)),ql=(e,t)=>10**(Kl(e)+t);function Jl(e){return e/10**Kl(e)==1}function Yl(e,t,n){let r=10**n,i=Math.floor(e/r);return Math.ceil(t/r)-i}function Xl(e,t){let n=t-e,r=Kl(n);for(;Yl(e,t,r)>10;)r++;for(;Yl(e,t,r)<10;)r--;return Math.min(r,Kl(e))}function Zl(e,{min:t,max:n}){t=Pt(e.min,t);let r=[],i=Kl(t),a=Xl(t,n),o=a<0?10**Math.abs(a):1,s=10**a,c=i>a?10**i:0,l=Math.round((t-c)*o)/o,u=Math.floor((t-c)/s/10)*s*10,d=Math.floor((l-u)/10**a),f=Pt(e.min,Math.round((c+u+d*10**a)*o)/o);for(;f<n;)r.push({value:f,major:Jl(f),significand:d}),d>=10?d=d<15?15:20:d++,d>=20&&(a++,d=2,o=a>=0?1:o),f=Math.round((c+u+d*10**a)*o)/o;let p=Pt(e.max,f);return r.push({value:p,major:Jl(p),significand:d}),r}(class extends os{static id=`logarithmic`;static defaults={ticks:{callback:tr.formatters.logarithmic,major:{enabled:!0}}};constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(e,t){let n=Wl.prototype.parse.apply(this,[e,t]);if(n===0)this._zero=!0;else return j(n)&&n>0?n:null}determineDataLimits(){let{min:e,max:t}=this.getMinMax(!0);this.min=j(e)?Math.max(0,e):null,this.max=j(t)?Math.max(0,t):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!j(this._userMin)&&(this.min=e===ql(this.min,0)?ql(this.min,-1):ql(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){let{minDefined:e,maxDefined:t}=this.getUserBounds(),n=this.min,r=this.max,i=t=>n=e?n:t,a=e=>r=t?r:e;n===r&&(n<=0?(i(1),a(10)):(i(ql(n,-1)),a(ql(r,1)))),n<=0&&i(ql(r,-1)),r<=0&&a(ql(n,1)),this.min=n,this.max=r}buildTicks(){let e=this.options,t=Zl({min:this._userMin,max:this._userMax},this);return e.bounds===`ticks`&&pn(t,this,`value`),e.reverse?(t.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),t}getLabelForValue(e){return e===void 0?`0`:Qn(e,this.chart.options.locale,this.options.ticks.format)}configure(){let e=this.min;super.configure(),this._startValue=an(e),this._valueRange=an(this.max)-an(e)}getPixelForValue(e){return(e===void 0||e===0)&&(e=this.min),e===null||isNaN(e)?NaN:this.getPixelForDecimal(e===this.min?0:(an(e)-this._startValue)/this._valueRange)}getValueForPixel(e){let t=this.getDecimalForPixel(e);return 10**(this._startValue+t*this._valueRange)}});function Ql(e){let t=e.ticks;if(t.display&&e.display){let e=V(t.backdropPadding);return M(t.font&&t.font.size,B.font.size)+e.height}return 0}function $l(e,t,n){return n=k(n)?n:[n],{w:lr(e,t.string,n),h:n.length*t.lineHeight}}function eu(e,t,n,r,i){return e===r||e===i?{start:t-n/2,end:t+n/2}:e<r||e>i?{start:t-n,end:t}:{start:t,end:t+n}}function tu(e){let t={l:e.left+e._padding.left,r:e.right-e._padding.right,t:e.top+e._padding.top,b:e.bottom-e._padding.bottom},n=Object.assign({},t),r=[],i=[],a=e._pointLabels.length,o=e.options.pointLabels,s=o.centerPointLabels?F/a:0;for(let c=0;c<a;c++){let a=o.setContext(e.getPointLabelContext(c));i[c]=a.padding;let l=e.getPointPosition(c,e.drawingArea+i[c],s),u=H(a.font),d=$l(e.ctx,u,e._pointLabels[c]);r[c]=d;let f=R(e.getIndexAngle(c)+s),p=Math.round(hn(f));nu(n,t,f,eu(p,l.x,d.w,0,180),eu(p,l.y,d.h,90,270))}e.setCenterPoint(t.l-n.l,n.r-t.r,t.t-n.t,n.b-t.b),e._pointLabelItems=au(e,r,i)}function nu(e,t,n,r,i){let a=Math.abs(Math.sin(n)),o=Math.abs(Math.cos(n)),s=0,c=0;r.start<t.l?(s=(t.l-r.start)/a,e.l=Math.min(e.l,t.l-s)):r.end>t.r&&(s=(r.end-t.r)/a,e.r=Math.max(e.r,t.r+s)),i.start<t.t?(c=(t.t-i.start)/o,e.t=Math.min(e.t,t.t-c)):i.end>t.b&&(c=(i.end-t.b)/o,e.b=Math.max(e.b,t.b+c))}function ru(e,t,n){let r=e.drawingArea,{extra:i,additionalAngle:a,padding:o,size:s}=n,c=e.getPointPosition(t,r+i+o,a),l=Math.round(hn(R(c.angle+L))),u=cu(c.y,s.h,l),d=ou(l),f=su(c.x,s.w,d);return{visible:!0,x:c.x,y:u,textAlign:d,left:f,top:u,right:f+s.w,bottom:u+s.h}}function iu(e,t){if(!t)return!0;let{left:n,top:r,right:i,bottom:a}=e;return!(mr({x:n,y:r},t)||mr({x:n,y:a},t)||mr({x:i,y:r},t)||mr({x:i,y:a},t))}function au(e,t,n){let r=[],i=e._pointLabels.length,a=e.options,{centerPointLabels:o,display:s}=a.pointLabels,c={extra:Ql(a)/2,additionalAngle:o?F/i:0},l;for(let a=0;a<i;a++){c.padding=n[a],c.size=t[a];let i=ru(e,a,c);r.push(i),s===`auto`&&(i.visible=iu(i,l),i.visible&&(l=i))}return r}function ou(e){return e===0||e===180?`center`:e<180?`left`:`right`}function su(e,t,n){return n===`right`?e-=t:n===`center`&&(e-=t/2),e}function cu(e,t,n){return n===90||n===270?e-=t/2:(n>270||n<90)&&(e-=t),e}function lu(e,t,n){let{left:r,top:i,right:a,bottom:o}=n,{backdropColor:s}=t;if(!O(s)){let n=Ar(t.borderRadius),c=V(t.backdropPadding);e.fillStyle=s;let l=r-c.left,u=i-c.top,d=a-r+c.width,f=o-i+c.height;Object.values(n).some(e=>e!==0)?(e.beginPath(),Cr(e,{x:l,y:u,w:d,h:f,radius:n}),e.fill()):e.fillRect(l,u,d,f)}}function uu(e,t){let{ctx:n,options:{pointLabels:r}}=e;for(let i=t-1;i>=0;i--){let t=e._pointLabelItems[i];if(!t.visible)continue;let a=r.setContext(e.getPointLabelContext(i));lu(n,a,t);let o=H(a.font),{x:s,y:c,textAlign:l}=t;Sr(n,e._pointLabels[i],s,c+o.lineHeight/2,o,{color:a.color,textAlign:l,textBaseline:`middle`})}}function du(e,t,n,r){let{ctx:i}=e;if(n)i.arc(e.xCenter,e.yCenter,t,0,I);else{let n=e.getPointPosition(0,t);i.moveTo(n.x,n.y);for(let a=1;a<r;a++)n=e.getPointPosition(a,t),i.lineTo(n.x,n.y)}}function fu(e,t,n,r,i){let a=e.ctx,o=t.circular,{color:s,lineWidth:c}=t;!o&&!r||!s||!c||n<0||(a.save(),a.strokeStyle=s,a.lineWidth=c,a.setLineDash(i.dash||[]),a.lineDashOffset=i.dashOffset,a.beginPath(),du(e,n,o,r),a.closePath(),a.stroke(),a.restore())}function pu(e,t,n){return Nr(e,{label:n,index:t,type:`pointLabel`})}(class extends Wl{static id=`radialLinear`;static defaults={display:!0,animate:!0,position:`chartArea`,angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:tr.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(e){return e},padding:5,centerPointLabels:!1}};static defaultRoutes={"angleLines.color":`borderColor`,"pointLabels.color":`color`,"ticks.color":`color`};static descriptors={angleLines:{_fallback:`grid`}};constructor(e){super(e),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){let e=this._padding=V(Ql(this.options)/2),t=this.width=this.maxWidth-e.width,n=this.height=this.maxHeight-e.height;this.xCenter=Math.floor(this.left+t/2+e.left),this.yCenter=Math.floor(this.top+n/2+e.top),this.drawingArea=Math.floor(Math.min(t,n)/2)}determineDataLimits(){let{min:e,max:t}=this.getMinMax(!1);this.min=j(e)&&!isNaN(e)?e:0,this.max=j(t)&&!isNaN(t)?t:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/Ql(this.options))}generateTickLabels(e){Wl.prototype.generateTickLabels.call(this,e),this._pointLabels=this.getLabels().map((e,t)=>{let n=N(this.options.pointLabels.callback,[e,t],this);return n||n===0?n:``}).filter((e,t)=>this.chart.getDataVisibility(t))}fit(){let e=this.options;e.display&&e.pointLabels.display?tu(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(e,t,n,r){this.xCenter+=Math.floor((e-t)/2),this.yCenter+=Math.floor((n-r)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(e,t,n,r))}getIndexAngle(e){let t=I/(this._pointLabels.length||1),n=this.options.startAngle||0;return R(e*t+mn(n))}getDistanceFromCenterForValue(e){if(O(e))return NaN;let t=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-e)*t:(e-this.min)*t}getValueForDistanceFromCenter(e){if(O(e))return NaN;let t=e/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-t:this.min+t}getPointLabelContext(e){let t=this._pointLabels||[];if(e>=0&&e<t.length){let n=t[e];return pu(this.getContext(),e,n)}}getPointPosition(e,t,n=0){let r=this.getIndexAngle(e)-L+n;return{x:Math.cos(r)*t+this.xCenter,y:Math.sin(r)*t+this.yCenter,angle:r}}getPointPositionForValue(e,t){return this.getPointPosition(e,this.getDistanceFromCenterForValue(t))}getBasePosition(e){return this.getPointPositionForValue(e||0,this.getBaseValue())}getPointLabelPosition(e){let{left:t,top:n,right:r,bottom:i}=this._pointLabelItems[e];return{left:t,top:n,right:r,bottom:i}}drawBackground(){let{backgroundColor:e,grid:{circular:t}}=this.options;if(e){let n=this.ctx;n.save(),n.beginPath(),du(this,this.getDistanceFromCenterForValue(this._endValue),t,this._pointLabels.length),n.closePath(),n.fillStyle=e,n.fill(),n.restore()}}drawGrid(){let e=this.ctx,t=this.options,{angleLines:n,grid:r,border:i}=t,a=this._pointLabels.length,o,s,c;if(t.pointLabels.display&&uu(this,a),r.display&&this.ticks.forEach((e,t)=>{if(t!==0||t===0&&this.min<0){s=this.getDistanceFromCenterForValue(e.value);let n=this.getContext(t),o=r.setContext(n),c=i.setContext(n);fu(this,o,s,a,c)}}),n.display){for(e.save(),o=a-1;o>=0;o--){let r=n.setContext(this.getPointLabelContext(o)),{color:i,lineWidth:a}=r;a&&i&&(e.lineWidth=a,e.strokeStyle=i,e.setLineDash(r.borderDash),e.lineDashOffset=r.borderDashOffset,s=this.getDistanceFromCenterForValue(t.reverse?this.min:this.max),c=this.getPointPosition(o,s),e.beginPath(),e.moveTo(this.xCenter,this.yCenter),e.lineTo(c.x,c.y),e.stroke())}e.restore()}}drawBorder(){}drawLabels(){let e=this.ctx,t=this.options,n=t.ticks;if(!n.display)return;let r=this.getIndexAngle(0),i,a;e.save(),e.translate(this.xCenter,this.yCenter),e.rotate(r),e.textAlign=`center`,e.textBaseline=`middle`,this.ticks.forEach((r,o)=>{if(o===0&&this.min>=0&&!t.reverse)return;let s=n.setContext(this.getContext(o)),c=H(s.font);if(i=this.getDistanceFromCenterForValue(this.ticks[o].value),s.showLabelBackdrop){e.font=c.string,a=e.measureText(r.label).width,e.fillStyle=s.backdropColor;let t=V(s.backdropPadding);e.fillRect(-a/2-t.left,-i-c.size/2-t.top,a+t.width,c.size+t.height)}Sr(e,r.label,0,-i,c,{color:s.color,strokeColor:s.textStrokeColor,strokeWidth:s.textStrokeWidth})}),e.restore()}drawTitle(){}});let mu={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}},hu=/* #__PURE__ */ Object.keys(mu);function gu(e,t){return e-t}function _u(e,t){if(O(t))return null;let n=e._adapter,{parser:r,round:i,isoWeekday:a}=e._parseOpts,o=t;return typeof r==`function`&&(o=r(o)),j(o)||(o=typeof r==`string`?n.parse(o,r):n.parse(o)),o===null?null:(i&&(o=i===`week`&&(dn(a)||a===!0)?n.startOf(o,`isoWeek`,a):n.startOf(o,i)),+o)}function vu(e,t,n,r){let i=hu.length;for(let a=hu.indexOf(e);a<i-1;++a){let e=mu[hu[a]],i=e.steps?e.steps:2**53-1;if(e.common&&Math.ceil((n-t)/(i*e.size))<=r)return hu[a]}return hu[i-1]}function yu(e,t,n,r,i){for(let a=hu.length-1;a>=hu.indexOf(n);a--){let n=hu[a];if(mu[n].common&&e._adapter.diff(i,r,n)>=t-1)return n}return hu[n?hu.indexOf(n):0]}function bu(e){for(let t=hu.indexOf(e)+1,n=hu.length;t<n;++t)if(mu[hu[t]].common)return hu[t]}function xu(e,t,n){if(!n)e[t]=!0;else if(n.length){let{lo:r,hi:i}=Cn(n,t),a=n[r]>=t?n[r]:n[i];e[a]=!0}}function Su(e,t,n,r){let i=e._adapter,a=+i.startOf(t[0].value,r),o=t[t.length-1].value,s,c;for(s=a;s<=o;s=+i.add(s,1,r))c=n[s],c>=0&&(t[c].major=!0);return t}function Cu(e,t,n){let r=[],i={},a=t.length,o,s;for(o=0;o<a;++o)s=t[o],i[s]=o,r.push({value:s,major:!1});return a===0||!n?r:Su(e,r,i,n)}var wu=class extends os{static id=`time`;static defaults={bounds:`data`,adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:`millisecond`,displayFormats:{}},ticks:{source:`auto`,callback:!1,major:{enabled:!1}}};constructor(e){super(e),this._cache={data:[],labels:[],all:[]},this._unit=`day`,this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(e,t={}){let n=e.time||={},r=this._adapter=new Ua._date(e.adapters.date);r.init(t),Ht(n.displayFormats,r.formats()),this._parseOpts={parser:n.parser,round:n.round,isoWeekday:n.isoWeekday},super.init(e),this._normalized=t.normalized}parse(e,t){return e===void 0?null:_u(this,e)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){let e=this.options,t=this._adapter,n=e.time.unit||`day`,{min:r,max:i,minDefined:a,maxDefined:o}=this.getUserBounds();function s(e){!a&&!isNaN(e.min)&&(r=Math.min(r,e.min)),!o&&!isNaN(e.max)&&(i=Math.max(i,e.max))}a&&o||(s(this._getLabelBounds()),(e.bounds!==`ticks`||e.ticks.source!==`labels`)&&s(this.getMinMax(!1))),r=j(r)&&!isNaN(r)?r:+t.startOf(Date.now(),n),i=j(i)&&!isNaN(i)?i:+t.endOf(Date.now(),n)+1,this.min=Math.min(r,i-1),this.max=Math.max(r+1,i)}_getLabelBounds(){let e=this.getLabelTimestamps(),t=1/0,n=-1/0;return e.length&&(t=e[0],n=e[e.length-1]),{min:t,max:n}}buildTicks(){let e=this.options,t=e.time,n=e.ticks,r=n.source===`labels`?this.getLabelTimestamps():this._generate();e.bounds===`ticks`&&r.length&&(this.min=this._userMin||r[0],this.max=this._userMax||r[r.length-1]);let i=this.min,a=this.max,o=En(r,i,a);return this._unit=t.unit||(n.autoSkip?vu(t.minUnit,this.min,this.max,this._getLabelCapacity(i)):yu(this,o.length,t.minUnit,this.min,this.max)),this._majorUnit=!n.major.enabled||this._unit===`year`?void 0:bu(this._unit),this.initOffsets(r),e.reverse&&o.reverse(),Cu(this,o,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(e=>+e.value))}initOffsets(e=[]){let t=0,n=0,r,i;this.options.offset&&e.length&&(r=this.getDecimalForValue(e[0]),t=e.length===1?1-r:(this.getDecimalForValue(e[1])-r)/2,i=this.getDecimalForValue(e[e.length-1]),n=e.length===1?i:(i-this.getDecimalForValue(e[e.length-2]))/2);let a=e.length<3?.5:.25;t=z(t,0,a),n=z(n,0,a),this._offsets={start:t,end:n,factor:1/(t+1+n)}}_generate(){let e=this._adapter,t=this.min,n=this.max,r=this.options,i=r.time,a=i.unit||vu(i.minUnit,t,n,this._getLabelCapacity(t)),o=M(r.ticks.stepSize,1),s=a===`week`&&i.isoWeekday,c=dn(s)||s===!0,l={},u=t,d,f;if(c&&(u=+e.startOf(u,`isoWeek`,s)),u=+e.startOf(u,c?`day`:a),e.diff(n,t,a)>1e5*o)throw Error(t+` and `+n+` are too far apart with stepSize of `+o+` `+a);let p=r.ticks.source===`data`&&this.getDataTimestamps();for(d=u,f=0;d<n;d=+e.add(d,o,a),f++)xu(l,d,p);return(d===n||r.bounds===`ticks`||f===1)&&xu(l,d,p),Object.keys(l).sort(gu).map(e=>+e)}getLabelForValue(e){let t=this._adapter,n=this.options.time;return n.tooltipFormat?t.format(e,n.tooltipFormat):t.format(e,n.displayFormats.datetime)}format(e,t){let n=this.options.time.displayFormats,r=this._unit,i=t||n[r];return this._adapter.format(e,i)}_tickFormatFunction(e,t,n,r){let i=this.options,a=i.ticks.callback;if(a)return N(a,[e,t,n],this);let o=i.time.displayFormats,s=this._unit,c=this._majorUnit,l=s&&o[s],u=c&&o[c],d=n[t],f=c&&u&&d&&d.major;return this._adapter.format(e,r||(f?u:l))}generateTickLabels(e){let t,n,r;for(t=0,n=e.length;t<n;++t)r=e[t],r.label=this._tickFormatFunction(r.value,t,e)}getDecimalForValue(e){return e===null?NaN:(e-this.min)/(this.max-this.min)}getPixelForValue(e){let t=this._offsets,n=this.getDecimalForValue(e);return this.getPixelForDecimal((t.start+n)*t.factor)}getValueForPixel(e){let t=this._offsets,n=this.getDecimalForPixel(e)/t.factor-t.end;return this.min+n*(this.max-this.min)}_getLabelSize(e){let t=this.options.ticks,n=this.ctx.measureText(e).width,r=mn(this.isHorizontal()?t.maxRotation:t.minRotation),i=Math.cos(r),a=Math.sin(r),o=this._resolveTickFontOptions(0).size;return{w:n*i+o*a,h:n*a+o*i}}_getLabelCapacity(e){let t=this.options.time,n=t.displayFormats,r=n[t.unit]||n.millisecond,i=this._tickFormatFunction(e,0,Cu(this,[e],this._majorUnit),r),a=this._getLabelSize(i),o=Math.floor(this.isHorizontal()?this.width/a.w:this.height/a.h)-1;return o>0?o:1}getDataTimestamps(){let e=this._cache.data||[],t,n;if(e.length)return e;let r=this.getMatchingVisibleMetas();if(this._normalized&&r.length)return this._cache.data=r[0].controller.getAllParsedValues(this);for(t=0,n=r.length;t<n;++t)e=e.concat(r[t].controller.getAllParsedValues(this));return this._cache.data=this.normalize(e)}getLabelTimestamps(){let e=this._cache.labels||[],t,n;if(e.length)return e;let r=this.getLabels();for(t=0,n=r.length;t<n;++t)e.push(_u(this,r[t]));return this._cache.labels=this._normalized?e:this.normalize(e)}normalize(e){return An(e.sort(gu))}};function Tu(e,t,n){let r=0,i=e.length-1,a,o,s,c;n?(t>=e[r].pos&&t<=e[i].pos&&({lo:r,hi:i}=wn(e,`pos`,t)),{pos:a,time:s}=e[r],{pos:o,time:c}=e[i]):(t>=e[r].time&&t<=e[i].time&&({lo:r,hi:i}=wn(e,`time`,t)),{time:a,pos:s}=e[r],{time:o,pos:c}=e[i]);let l=o-a;return l?s+(c-s)*(t-a)/l:s}(class extends wu{static id=`timeseries`;static defaults=wu.defaults;constructor(e){super(e),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){let e=this._getTimestampsForTable(),t=this._table=this.buildLookupTable(e);this._minPos=Tu(t,this.min),this._tableRange=Tu(t,this.max)-this._minPos,super.initOffsets(e)}buildLookupTable(e){let{min:t,max:n}=this,r=[],i=[],a,o,s,c,l;for(a=0,o=e.length;a<o;++a)c=e[a],c>=t&&c<=n&&r.push(c);if(r.length<2)return[{time:t,pos:0},{time:n,pos:1}];for(a=0,o=r.length;a<o;++a)l=r[a+1],s=r[a-1],c=r[a],Math.round((l+s)/2)!==c&&i.push({time:c,pos:a/(o-1)});return i}_generate(){let e=this.min,t=this.max,n=super.getDataTimestamps();return n.includes(e)&&n.length||n.splice(0,0,e),n.includes(t)&&n.length!==1||n.push(t),n.sort((e,t)=>e-t)}_getTimestampsForTable(){let e=this._cache.all||[];if(e.length)return e;let t=this.getDataTimestamps(),n=this.getLabelTimestamps();return e=t.length&&n.length?this.normalize(t.concat(n)):t.length?t:n,e=this._cache.all=e,e}getDecimalForValue(e){return(Tu(this._table,e)-this._minPos)/this._tableRange}getValueForPixel(e){let t=this._offsets,n=this.getDecimalForPixel(e)/t.factor-t.end;return Tu(this._table,n*this._tableRange+this._minPos,!0)}});function W(e,t={},...n){let r=document.createElement(e);for(let[e,n]of Object.entries(t))n!==void 0&&n!==!1&&n!==null&&(e.startsWith(`on`)&&typeof n==`function`?r.addEventListener(e.slice(2).toLowerCase(),n):e===`class`?r.className=String(n):r.setAttribute(e,n===!0?``:String(n)));return G(r,...n),r}function Eu(e){return[...e.querySelectorAll(`button, select, input, textarea, a[href], summary, [tabindex]`)].filter(t=>e.matches(`[data-id]`)||!t.closest(`[data-id]`))}function Du(e){return e.closest(`[data-id]`)??e.closest(`#app > * > *`)}function Ou(e){let t=document.activeElement,n=t instanceof HTMLElement&&t!==document.body?Du(t):null;if(!t||!n)return e();let r=t.id,i=n.dataset.id,a=i===void 0?[...n.parentElement.children].indexOf(n):-1,o=i===void 0?-1:[...document.querySelectorAll(`.tile`)].indexOf(n),s=Eu(n).indexOf(t);if(e(),s<0||t.isConnected||document.activeElement&&document.activeElement!==document.body)return;if(r)return document.getElementById(r)?.focus();let c=i===void 0?document.querySelector(`#app > *`)?.children[a]:document.querySelector(`[data-id="${CSS.escape(i)}"]`)??document.querySelectorAll(`.tile`)[Math.min(o,document.querySelectorAll(`.tile`).length-1)];if(!c)return;let l=Eu(c),u=e=>l[e]&&!l[e].matches(`:disabled`);for(let e=0;e<l.length;e++)for(let t of[s-e,s+e])if(u(t))return l[t].focus()}function ku(e){let t=document.getElementById(`announce`);t||(t=W(`div`,{id:`announce`,class:`sr-only`,"aria-live":`polite`}),document.body.append(t)),t.textContent=e}function G(e,...t){for(let n of t)n!==!1&&n!=null&&e.append(typeof n==`number`?String(n):n)}let Au=[{id:`system`,group:`auto`},{id:`midnight`,group:`dark`},{id:`graphite`,group:`dark`},{id:`ocean`,group:`dark`},{id:`forest`,group:`dark`},{id:`plum`,group:`dark`},{id:`light`,group:`light`},{id:`paper`,group:`light`},{id:`mist`,group:`light`},{id:`hcDark`,group:`accessible`},{id:`hcLight`,group:`accessible`}],ju=e=>`theme.${e}`,Mu={get(e){try{return localStorage.getItem(e)}catch{return null}},set(e,t){try{localStorage.setItem(e,t)}catch{}},remove(e){try{localStorage.removeItem(e)}catch{}}};function Nu(e){return getComputedStyle(document.documentElement).getPropertyValue(`--${e}`).trim()}U.register(Ia,za,Va,Ra,Ba,kc,_c,yc,ic,Vl,Gl,Il,gl,sl);let Pu=e=>e.datasetIndex??e.index??-1;function Fu(e,t,n){let r=n.chart,i=e=>e.datasetIndex===void 0?r.getDataVisibility(e.index??-1):r.isDatasetVisible(e.datasetIndex),a=(e,t)=>{e.datasetIndex===void 0?i(e)!==t&&r.toggleDataVisibility(e.index??-1):r.setDatasetVisibility(e.datasetIndex,t)},o=e.native,s=n.legendItems??[];if(o?.shiftKey||o?.metaKey||o?.ctrlKey)a(t,!i(t));else{let e=s.every(e=>i(e)===(Pu(e)===Pu(t)));for(let n of s)a(n,e||Pu(n)===Pu(t))}r.update()}U.defaults.plugins.legend.onClick=Fu,U.overrides.doughnut.plugins.legend.onClick=Fu,U.overrides.pie.plugins.legend.onClick=Fu;let Iu=[];function Lu(){U.defaults.color=Nu(`muted`),U.defaults.borderColor=Nu(`line`),U.defaults.font.family=getComputedStyle(document.body).fontFamily,U.defaults.maintainAspectRatio=!1,U.defaults.animation=!1,U.defaults.interaction.mode=`index`,U.defaults.interaction.intersect=!1;let e=U.defaults.plugins.tooltip;e.backgroundColor=Nu(`panel2`),e.titleColor=Nu(`text`),e.bodyColor=Nu(`text`),e.borderColor=Nu(`line`),e.borderWidth=1}let Ru=[`bar`,`line`,`scatter`,`doughnut`,`pie`];function zu(e){if(typeof e==`number`)return String(Math.round(e*100)/100);if(e&&typeof e==`object`&&`y`in e){let t=e;return`${zu(t.x)}: ${zu(t.y)}`}return e==null?``:String(e)}function Bu(e,t){let n=e.data.datasets,r=e.data.labels??(n[0]?.data??[]).map((e,t)=>t+1);return W(`div`,{class:`sr-only`},W(`table`,{},W(`caption`,{},t),W(`thead`,{},W(`tr`,{},W(`td`,{}),...n.map(e=>W(`th`,{scope:`col`},String(e.label??``))))),W(`tbody`,{},...r.map((e,t)=>W(`tr`,{},W(`th`,{scope:`row`},zu(e)),...n.map(e=>W(`td`,{},zu(e.data[t]))))))))}function Vu(e,t,n=220){let r=[t.type,...t.data.datasets.map(e=>e.type)].filter(Boolean).find(e=>!Ru.includes(String(e)));if(r)throw Error(`Chart type ${r} is not available: use ${Ru.join(`, `)}`);let i=(e.closest(`.multiple`)?.querySelector(`h3`)??e.closest(`.tile`)?.querySelector(`h2`))?.textContent??``,a=W(`canvas`,{"aria-hidden":`true`});e.append(W(`div`,{class:`chart`,style:`height:${n}px`},a,Bu(t,i)));let o=new U(a,t);return Iu.push(o),o}function Hu(){for(let e of Iu.splice(0))e.destroy()}function Uu(e,t,n){return e.boards[t]??(e.base===`blank`?[]:n(t))}function Wu(e,t,n){return{...e,boards:{...e.boards,[t]:n}}}function Gu(e,t,n){if(e.base===`blank`)return Wu(e,t,n(t));let{[t]:r,...i}=e.boards;return{...e,boards:i}}function Ku(e,t,n){let r=e.find(e=>e.id===t);if(!r||n===t)return e;let i=e.filter(e=>e.id!==t),a=n===null?-1:i.findIndex(e=>e.id===n);return i.splice(a<0?i.length:a,0,r),i}function qu(e,t,n,r,i=1){let a=Math.round((e+r)/(n+r));return Math.max(1,Math.min(t,Math.max(i,a)))}function Ju(e,t,n){return e===n?Math.max(t,e):e}function Yu(e,t,n){return e.map(e=>e.id===t?{...e,span:n}:e)}function Xu(e,t){return e.map(e=>{if(e.id!==t)return e;let{hidden:n,...r}=e;return n?r:{...e,hidden:!0}})}function Zu(e,t,{type:n,span:r=1}){let i=new Set(e.map(e=>e.id)),a=t;for(let e=2;i.has(a);e++)a=`${t}-${e}`;return[...e,{id:a,widget:t,...n?{type:n}:{},span:r}]}function Qu(e,t){return e.filter(e=>e.id!==t)}function $u(e){let t=nd(e)?e:{},n={};for(let[e,r]of Object.entries(nd(t.boards)?t.boards:{})){if(!Array.isArray(r))continue;let t=/* @__PURE__ */ new Set;n[e]=[];for(let i of r){if(!nd(i)||typeof i.id!=`string`||typeof i.widget!=`string`||t.has(i.id))continue;t.add(i.id);let r=Math.min(3,Math.max(1,Math.round(Number(i.span)||1)));n[e].push({id:i.id,widget:i.widget,...typeof i.type==`string`?{type:i.type}:{},span:r,...i.hidden===!0?{hidden:!0}:{}})}}return{rev:typeof t.rev==`string`?t.rev:``,base:t.base===`blank`?`blank`:`preset`,boards:n}}function ed(e,t){return!t||t.baseRev!==e.rev||!nd(t.layout)?e:{...$u(t.layout),rev:e.rev}}function td(e,t){if(!t||t.baseRev===e.rev||!nd(t.layout))return null;let n={...$u(t.layout),rev:e.rev};return JSON.stringify(n)===JSON.stringify(e)?null:n}function nd(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}let rd=e=>e instanceof HTMLElement&&e.classList.contains(`tile`)&&!e.classList.contains(`lifted`),id=e=>[...e.children].filter(rd),ad=e=>Number(/span-(\d)/.exec(e.className)?.[1]??1),od=(e,t)=>{e.className=e.className.replace(/span-\d/,`span-${t}`)};function sd(e){let t=e.nextElementSibling;for(;t&&!rd(t);)t=t.nextElementSibling;return t?.dataset.id??null}function cd(e,t){if(matchMedia(`(prefers-reduced-motion: reduce)`).matches)return t();let n=[...e.children].filter(e=>e instanceof HTMLElement&&!e.classList.contains(`lifted`)),r=new Map(n.map(e=>[e,e.getBoundingClientRect()]));t();for(let e of n){let t=r.get(e),n=e.getBoundingClientRect(),i=t.left-n.left,a=t.top-n.top;(i||a)&&e.animate([{transform:`translate(${i}px, ${a}px)`},{transform:`none`}],{duration:150,easing:`ease-out`})}}function ld(e,t,n){let r=t.closest(`.tile`),i=r?.parentElement;if(e.button!==0||!r||!i)return;e.preventDefault(),t.setPointerCapture(e.pointerId);let a=r.getBoundingClientRect(),o=e.clientX-a.left,s=e.clientY-a.top,c=sd(r),l=W(`div`,{class:`tile-slot span-${ad(r)}`,"aria-hidden":`true`,style:`height:${a.height}px`});r.before(l),r.style.width=`${a.width}px`,r.style.height=`${a.height}px`,r.classList.add(`lifted`),document.documentElement.classList.add(`dragging`);let u=e.clientX,d=e.clientY,f=()=>{r.style.transform=`translate(${u-o}px, ${d-s}px) scale(1.02)`;let e=document.elementFromPoint(u,d)?.closest(`.tile`);if(!e||e===r||e.parentElement!==i)return;let t=e.getBoundingClientRect(),n=(t.width>i.clientWidth*.9?d>t.top+t.height/2:u>t.left+t.width/2)?e.nextElementSibling:e;n!==l&&l.nextElementSibling!==n&&cd(i,()=>i.insertBefore(l,n))},p=0,m=()=>{let e=(document.querySelector(`.edit-bar`)?.getBoundingClientRect().bottom??0)+60,t=innerHeight-60,n=d<e?-(e-d)/3:d>t?(d-t)/3:0;n&&(scrollBy(0,Math.max(-20,Math.min(20,n))),f()),p=requestAnimationFrame(m)};p=requestAnimationFrame(m);let h=e=>{u=e.clientX,d=e.clientY,f()},g=e=>{cancelAnimationFrame(p),t.removeEventListener(`pointermove`,h),t.removeEventListener(`pointerup`,_),t.removeEventListener(`pointercancel`,v),window.removeEventListener(`keydown`,y,!0),document.removeEventListener(`lostpointercapture`,b);let i=sd(l);l.remove(),r.classList.remove(`lifted`),r.style.removeProperty(`width`),r.style.removeProperty(`height`),r.style.removeProperty(`transform`),document.documentElement.classList.remove(`dragging`),e&&i!==c&&n(i)},_=()=>g(!0),v=()=>g(!1),y=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopImmediatePropagation(),g(!1))},b=t=>{t.pointerId===e.pointerId&&g(!1)};t.addEventListener(`pointermove`,h),t.addEventListener(`pointerup`,_),t.addEventListener(`pointercancel`,v),document.addEventListener(`lostpointercapture`,b),window.addEventListener(`keydown`,y,!0),f()}function ud(e,t,n){let r=t.closest(`.tile`),i=r?.parentElement;if(!r||!i)return;let a=id(i),o=a.indexOf(r),s=e.key===` `||e.key===`Enter`;if(!r.classList.contains(`picked`)){if(!s)return;e.preventDefault(),r.classList.add(`picked`),t.setAttribute(`aria-pressed`,`true`),n.picked(o+1,a.length);return}let c={ArrowLeft:o-1,ArrowUp:o-1,ArrowRight:o+1,ArrowDown:o+1,Home:0,End:a.length-1};if(e.key in c){e.preventDefault();let s=Math.max(0,Math.min(a.length-1,c[e.key]));if(s===o)return;cd(i,()=>i.insertBefore(r,s<o?a[s]:a[s].nextElementSibling)),t.focus(),n.moved(s+1,a.length)}else s?(e.preventDefault(),n.drop(sd(r))):(e.key===`Escape`||e.key===`Tab`)&&(e.key===`Escape`&&(e.preventDefault(),e.stopPropagation()),n.cancel())}function dd(e){let t=getComputedStyle(e),n=t.gridTemplateColumns.split(` `).length,r=Number.parseFloat(t.columnGap)||0;return{cols:n,width:(e.clientWidth-r*(n-1))/n,gap:r}}function fd(e,t,n,r){let i=t.closest(`.tile`),a=i?.parentElement;if(e.button!==0||!i||!a)return;e.preventDefault(),t.setPointerCapture(e.pointerId);let{cols:o,width:s,gap:c}=dd(a),l=i.getBoundingClientRect().left,u=ad(i),d=Math.min(u,o),f=d,p=W(`div`,{class:`guides`,"aria-hidden":`true`},...Array.from({length:o},()=>W(`div`,{})));p.style.gridTemplateColumns=getComputedStyle(a).gridTemplateColumns,p.style.columnGap=`${c}px`;let m=W(`span`,{class:`span-badge`,"aria-hidden":`true`}),h=()=>{od(i,f),m.textContent=`${f} / ${o}`,p.style.top=`${i.offsetTop}px`,p.style.height=`${i.offsetHeight}px`};a.append(p),i.append(m),t.classList.add(`active`),document.documentElement.classList.add(`resizing`),h();let g=e=>{let t=qu(e.clientX-l,o,s,c,n);t!==f&&(f=t,h())},_=e=>{t.removeEventListener(`pointermove`,g),t.removeEventListener(`pointerup`,v),t.removeEventListener(`pointercancel`,y),window.removeEventListener(`keydown`,b,!0),document.removeEventListener(`lostpointercapture`,x),p.remove(),m.remove(),t.classList.remove(`active`),document.documentElement.classList.remove(`resizing`),e&&f!==d?r(f,o):od(i,u)},v=()=>_(!0),y=()=>_(!1),b=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopImmediatePropagation(),_(!1))},x=t=>{t.pointerId===e.pointerId&&_(!1)};t.addEventListener(`pointermove`,g),t.addEventListener(`pointerup`,v),t.addEventListener(`pointercancel`,y),document.addEventListener(`lostpointercapture`,x),window.addEventListener(`keydown`,b,!0)}let pd={all:`M2 2h5v5H2zM9 2h5v5H9zM2 9h5v5H2zM9 9h5v5H9z`,recovery:`M8 13.5S2.5 10 2.5 6.25A2.75 2.75 0 0 1 8 5a2.75 2.75 0 0 1 5.5 1.25C13.5 10 8 13.5 8 13.5z`,running:`M10 2.5a1.5 1.5 0 1 1 0 .1M7 5l3 1 1 3 2 1M8 6l-2 4-3 1M9 9l-1 3 2 2`,strengthTraining:`M1 7h2v2H1zM13 7h2v2h-2zM3 5h2v6H3zM11 5h2v6h-2zM5 7.25h6v1.5H5z`,walking:`M8 2.5a1.5 1.5 0 1 1 0 .1M8 5v5l-2 4M8 10l2 4M8 6l-3 2M8 6l3 2`,hiking:`M1 14l5-8 3 4 2-3 4 7z`,cycling:`M4 11a2.5 2.5 0 1 0 .1 0M12 11a2.5 2.5 0 1 0 .1 0M4 11l3-5h4l1 5M7 6l2 5`,swimming:`M1 11c2 0 2-1.5 3.5-1.5S6 11 8 11s2-1.5 3.5-1.5S13 11 15 11M5 8l3-3 3 2`,racket:`M6 2a4 4 0 1 1 0 8 4 4 0 0 1 0-8M8.5 9.5l5 5M13 4a1 1 0 1 1 0 .1`,generic:`M8 2v12M2 8h12`,eye:`M1.5 8S4 3.5 8 3.5 14.5 8 14.5 8 12 12.5 8 12.5 1.5 8 1.5 8zM8 6a2 2 0 1 1 0 4 2 2 0 0 1 0-4`,settings:`M2 4h6M12 4h2M2 8h2M8 8h6M2 12h8M14 12h0M10 2.5v3M6 6.5v3M12 10.5v3`};function md(e){let t=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);t.setAttribute(`viewBox`,`0 0 16 16`),t.setAttribute(`aria-hidden`,`true`),t.setAttribute(`class`,`icon icon-${e}`);let n=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);return n.setAttribute(`d`,pd[e]??pd.generic),t.append(n),t}function hd(){let e=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);return e.setAttribute(`viewBox`,`0 0 32 32`),e.setAttribute(`aria-hidden`,`true`),e.setAttribute(`class`,`logo`),e.innerHTML=`<circle class="logo-track" cx="16" cy="16" r="10"/><path class="logo-arc" d="M16 6a10 10 0 1 1-10 10"/><circle class="logo-dot" cx="16" cy="16" r="3.4"/>`,e}var gd={title:`Training + Recovery`,headline:`Training load, recovery and progress from Garmin Connect`,na:`n/a`,noData:`This page has no data yet. Ask your assistant to write the dashboard.`,period:`{from} to {to}`,inProgress:`* week in progress`,"menu.settings":`Settings`,"menu.theme":`Theme`,"footer.updated":`Data from Garmin Connect, updated {date}`,"footer.failed":`Days not read from Garmin: {n} (their values show n/a)`,"footer.license":`MIT License`,"menu.language":`Language`,"lang.auto":`Auto`,"themeGroup.auto":`Auto`,"themeGroup.dark":`Dark`,"themeGroup.light":`Light`,"themeGroup.accessible":`Accessible`,"theme.system":`System`,"theme.midnight":`Midnight`,"theme.graphite":`Graphite`,"theme.ocean":`Ocean`,"theme.forest":`Forest`,"theme.plum":`Plum`,"theme.light":`Light`,"theme.paper":`Paper`,"theme.mist":`Mist`,"theme.hcDark":`High contrast dark`,"theme.hcLight":`High contrast light`,"window.label":`Weeks`,"window.last":`Last {n}`,"window.all":`All`,"window.from":`From week`,"window.to":`To week`,"type.all":`All`,"type.recovery":`Recovery`,"type.running":`Run`,"type.strengthTraining":`Strength`,"type.walking":`Walk`,"type.hiking":`Hike`,"type.cycling":`Bike`,"type.swimming":`Swim`,"type.racket":`Racket sports`,"type.generic":`Other`,"type.transition":`Transition`,"type.fitnessEquipment":`Fitness equipment`,"type.basketball":`Basketball`,"type.soccer":`Soccer`,"type.tennis":`Tennis`,"type.americanFootball":`American football`,"type.training":`Training`,"type.crossCountrySkiing":`Cross-country skiing`,"type.alpineSkiing":`Alpine skiing`,"type.snowboarding":`Snowboarding`,"type.rowing":`Rowing`,"type.mountaineering":`Mountaineering`,"type.multisport":`Multisport`,"type.paddling":`Paddling`,"type.flying":`Flying`,"type.eBiking":`E-bike`,"type.motorcycling":`Motorcycling`,"type.boating":`Boating`,"type.driving":`Driving`,"type.golf":`Golf`,"type.hangGliding":`Hang gliding`,"type.horsebackRiding":`Horseback riding`,"type.hunting":`Hunting`,"type.fishing":`Fishing`,"type.inlineSkating":`Inline skating`,"type.rockClimbing":`Rock climbing`,"type.sailing":`Sailing`,"type.iceSkating":`Ice skating`,"type.skyDiving":`Skydiving`,"type.snowshoeing":`Snowshoeing`,"type.snowmobiling":`Snowmobiling`,"type.standUpPaddleboarding":`Stand-up paddleboarding`,"type.surfing":`Surfing`,"type.wakeboarding":`Wakeboarding`,"type.waterSkiing":`Water skiing`,"type.kayaking":`Kayaking`,"type.rafting":`Rafting`,"type.windsurfing":`Windsurfing`,"type.kitesurfing":`Kitesurfing`,"type.tactical":`Tactical`,"type.jumpmaster":`Jumpmaster`,"type.boxing":`Boxing`,"type.floorClimbing":`Floor climbing`,"type.baseball":`Baseball`,"type.diving":`Diving`,"type.shooting":`Shooting`,"type.winterSport":`Winter sports`,"type.grinding":`Grinding`,"type.hiit":`HIIT`,"type.videoGaming":`Video gaming`,"type.wheelchairPushWalk":`Wheelchair push walk`,"type.wheelchairPushRun":`Wheelchair push run`,"type.meditation":`Meditation`,"type.paraSport":`Para sport`,"type.discGolf":`Disc golf`,"type.teamSport":`Team sports`,"type.cricket":`Cricket`,"type.rugby":`Rugby`,"type.hockey":`Hockey`,"type.lacrosse":`Lacrosse`,"type.volleyball":`Volleyball`,"type.waterTubing":`Water tubing`,"type.wakesurfing":`Wakesurfing`,"type.waterSport":`Water sports`,"type.archery":`Archery`,"type.mixedMartialArts":`Mixed martial arts`,"type.motorSports":`Motorsports`,"type.snorkeling":`Snorkeling`,"type.dance":`Dance`,"type.jumpRope":`Jump rope`,"type.poolApnea":`Pool apnea`,"type.mobility":`Mobility`,"type.geocaching":`Geocaching`,"type.canoeing":`Canoeing`,"tabs.label":`Activity types`,"edit.start":`Edit layout`,"edit.done":`Done`,"edit.add":`Add widget`,"edit.reset":`Reset board`,"edit.discard":`Discard`,"edit.bar":`Edit layout`,"edit.editing":`Editing · {board}`,"edit.unsaved":`Unsaved changes`,"discard.title":`Discard your changes?`,"discard.text":`The layout goes back to how it was before you selected Edit layout, on every board.`,"discard.keep":`Keep editing`,"discard.confirm":`Discard changes`,"edit.copy":`Copy layout`,"edit.hide":`Hide {title}`,"edit.show":`Show {title}`,"edit.remove":`Remove {title}`,"edit.move":`Move {title}`,"edit.moveHint":`Drag to move, or press Space and then the arrow keys`,"edit.width":`Width of {title}`,"edit.widthValue":`{n} of {cols} columns`,"edit.addHidden":`Add widget · {n} hidden`,"add.addOne":`Add {title}`,"said.picked":`{title} picked up, position {n} of {count}. The arrow keys move it, Space drops it, Escape puts it back.`,"said.position":`Position {n} of {count}`,"said.cancelled":`{title} is back in its place`,"said.moved":`{title} moved to position {n} of {count}`,"said.width":`{title}: {n} of {cols} columns`,"said.hidden":`{title} hidden`,"said.shown":`{title} shown`,"said.removed":`{title} removed`,"said.added":`{title} added`,"said.saved":`Layout saved`,"said.unchanged":`No changes to save`,"said.discarded":`Changes discarded`,"stale.label":`New layout`,"stale.text":`Your assistant wrote a new layout for this dashboard. The layout you made in this browser stays until you choose.`,"stale.keep":`Keep mine`,"stale.new":`Use the new one`,"stale.used":`The new layout is in use`,"stale.kept":`Your layout is in use`,"add.title":`Add a widget`,"add.type":`Type`,"add.add":`Add`,"add.close":`Close`,"add.hiddenGroup":`Hidden on this board`,"add.none":`Every widget is on this board.`,"copy.title":`Copy layout`,"copy.hint":`This layout is saved in this browser only. To keep it in the page, paste this text to your assistant and ask it to save the dashboard layout.`,"copy.copy":`Copy`,"copy.copied":`Copied`,"board.empty":`This board has no widgets.`,"board.emptyEdit":`This board has no widgets: use “Add widget” to put some on it.`,"widget.failed":`This widget failed: {message}`,"widget.unknown":`Unknown widget: {id}`,"empty.window":`No sessions in the selected weeks.`,"w.coachNotes":`Coach notes`,"notes.none":`No notes.`,"notes.disclaimer":`Training suggestions for the data up to {date}. Not medical advice.`,"w.kpis":`Overview`,"kpi.totals":`{distance} · {time} · {n} session|{distance} · {time} · {n} sessions`,"kpi.distance":`Distance · last 7 days`,"kpi.time":`Time · last 7 days`,"kpi.vs4w":`vs 4-week average`,"delta.good":`better`,"delta.bad":`worse`,"kpi.ratio":`Load ratio 7:28`,"kpi.band":`Band 0.8-1.3`,"kpi.ratioAll":`Uses all activities, also with a type filter`,"kpi.hrv":`HRV last night`,"kpi.vsBaseline":`vs 7-day average {v} ms`,"w.readiness":`Readiness today`,"ready.easy":`Go easy`,"ready.push":`Ready to push`,"ready.normal":`Normal`,"ready.hrv":`HRV status`,"ready.sleep":`Sleep score`,"ready.rhr":`Resting HR`,"ready.rhrVs":`7 days before: {avg} bpm`,"ready.ratio":`Load ratio 7:28`,"ready.note":`The dashboard's own rule, not Garmin's readiness. It shows today: the week window does not change it.`,"w.fitnessAge":`Fitness age`,"fa.age":`Fitness age`,"fa.actual":`Actual age`,"fa.achievable":`Achievable`,"fa.details":`Details`,"fa.component":`Component`,"fa.value":`Now`,"fa.target":`Garmin target`,"fa.potential":`Potential age`,"fa.bodyFat":`Body fat %`,"fa.bmi":`BMI`,"fa.rhr":`Resting HR`,"fa.vigorousDaysAvg":`Vigorous days / week`,"fa.vigorousMinutesAvg":`Vigorous minutes / week`,"today.note":`It shows today: the week window does not change it.`,"w.periodComparison":`Period comparison`,"pc.vs":`{from} to {to} against {pfrom} to {pto}`,"pc.partial":`partial: these weeks start before the data`,"pc.type":`Type`,"pc.sessions":`Sessions`,"pc.distance":`Distance`,"pc.time":`Time`,"pc.load":`Load`,"pc.total":`Total`,"w.records":`Records`,"rec.best":`Fastest {d}`,"d.1k":`1 km`,"d.mile":`mile`,"d.5k":`5 km`,"d.10k":`10 km`,"d.half":`half marathon`,"d.marathon":`marathon`,"rec.longestRun":`Longest run`,"rec.longestRide":`Longest ride`,"rec.topSet":`Heaviest set`,"rec.e1rm":`Best est. 1RM · {name}`,"rec.none":`No records in the selected weeks.`,"rec.estimate":`1RM values are estimates (Epley, sets of 1-12 reps).`,"w.weeklyVolume":`Weekly volume`,"m.time":`Time`,"m.distance":`Distance`,"m.sessions":`Sessions`,"m.load":`Load`,"vol.avg":`4-week average`,"w.intensityMinutes":`Intensity minutes`,"im.guide":`Guideline 150 min`,"im.note":`Moderate + 2 x vigorous minutes of the activities only, not of the whole day.`,"w.loadSafety":`Load safety`,"ls.weekLoad":`Load · last 7 days`,"ls.monotony":`Monotony · 7 days`,"ls.monotonyFlag":`Above 2.0`,"ls.strain":`Strain · 7 days`,"ls.flagged":`Weeks above +10%`,"ls.load":`Weekly load`,"ls.ramp":`Change vs week before (%)`,"ls.note":`All activities. Red weeks rose more than 10%; a week in progress is not flagged. Monotony and strain (Foster) are estimates.`,"ls.estimated":`Some loads are estimates: the activity has no Garmin load.`,"w.loadVsRecovery":`Load vs recovery`,"lvr.hrv":`HRV (ms)`,"lvr.note":`Daily load by type (bars) and nightly HRV (line).`,"w.calendar":`Consistency`,"cal.minutes":`{n} min`,"cal.rest":`Rest day`,"cal.label":`Training days, by week; the arrow keys move`,"cal.less":`Less`,"cal.more":`More`,"m.label":`Measure`,skip:`Skip to the board`,"w.hrv":`HRV`,"hrv.low":`Range low`,"hrv.band":`Balanced range`,"hrv.nightly":`Nightly HRV`,"hrv.avg":`7-day average`,rec14:`Last 14 days: the week window does not change it.`,"rec.board":`The recovery widgets show the last 14 days: the week window does not change them.`,"w.restingHr":`Resting HR`,"w.sleep":`Sleep`,"sl.deep":`Deep`,"sl.light":`Light`,"sl.rem":`REM`,"sl.awake":`Awake`,"sl.score":`Score`,"w.sleepNeed":`Sleep need`,"sn.gap":`Short of need · average`,"sn.actual":`Slept`,"sn.need":`Need`,"w.bedtime":`Bedtime`,"bt.spread":`Bedtime spread`,"w.bodyBattery":`Body battery`,"bb.high":`High`,"bb.low":`Low`,"w.activities":`Activities`,"col.date":`Date`,"col.type":`Type`,"col.name":`Name`,"col.distance":`Distance`,"col.time":`Time`,"col.pace":`Pace / speed`,"col.hr":`Avg HR`,"col.ascent":`Ascent`,"col.race":`Race`,"laps.show":`laps`,"lap.n":`Lap`,"lap.intensity":`Intensity`,"act.more":`Show all {n}`,"act.less":`Show fewer`,"one.session":`One session so far: trends start at 2 sessions.`,"w.typeKpis":`Summary`,"tk.sessions":`Sessions`,"tk.time":`Time`,"tk.avg":`{v} per session`,"tk.distance":`Distance`,"tk.speed":`Average speed`,"tk.pace":`Average pace`,"tk.ascent":`Ascent`,"tk.hr":`Average HR`,"tk.peak":`Peak {v} bpm`,"tk.load":`Garmin training load`,"tk.share":`{v}% of all load`,"w.typeWeekly":`Each week`,"w.hrZones":`Time in HR zones`,"zones.approximate":`Approximate: some activities have no zone time, so all their minutes count in the zone of their average HR.`,"form.cadence":`Cadence`,"form.stride":`Stride`,"form.gct":`Ground contact`,"form.vertOsc":`Vertical oscillation`,"form.vertRatio":`Vertical ratio`,"form.power":`Power`,"form.normPower":`Normalized power`,"w.bestEfforts":`Best efforts`,"be.distance":`Distance`,"be.activity":`Activity`,"w.races":`Races`,"races.none":`No races in the selected weeks.`,"te.aerobic":`Aerobic TE`,"te.anaerobic":`Anaerobic TE`,"w.aerobicFitness":`Aerobic fitness`,"af.runs":`Runs (older paler)`,"af.pace":`Pace (min{unit})`,"af.weekPace":`Weekly pace`,"af.efficiency":`Efficiency`,"af.effUnit":`m per heartbeat`,"w.intensityShare":`Easy and hard running`,"is.easy":`Z1-2 (easy)`,"is.hard":`Z4-5 (hard)`,"w.runningForm":`Running form`,"w.runWalk":`Run Walk Run`,"rw.none":`No Run Walk Run sessions in the selected weeks.`,"rw.runPace":`Run pace`,"rw.pace":`Overall pace`,"rw.walk":`Walk time`,"w.trainingEffect":`Training effect`,"w.racePredictor":`Race predictor`,"rp.none":`No best effort of 5 km or more in the selected weeks.`,"rp.note":`Estimate (Riegel) from the {d} in {time} on {date}.`,"w.longRuns":`Long runs and pace split`,"lr.share":`Longest run share of weekly distance`,"lr.ascent":`Weekly ascent`,"lr.note":`Red weeks: the longest run is more than 35% of the week's distance. The table shows races and runs over 15 km with laps.`,"lr.first":`First half`,"lr.second":`Second half`,"lr.split":`Split`,"lr.gap":`Grade-adjusted pace`,"lr.positive":`positive`,"lr.negative":`negative`,"lr.even":`even`,"w.setsPerCategory":`Sets per movement`,"ex.sets":`Completed sets`,"w.muscleBalance":`Muscle-group balance`,"mb.pushPull":`Push : pull sets`,"mb.avg":`Average sets per week`,"mb.perWeek":`sets per week`,"mb.note":`A set counts 1 for each primary muscle group and 0.5 for each secondary one. Usual range: 10-20 sets per week (yellow below, red above).`,"w.exercises":`Exercises`,"ex.groups":`Muscle groups`,"ex.search":`Search exercises`,"ex.name":`Exercise`,"ex.sessions":`Sessions`,"ex.last":`Last`,"ex.top":`Last top set`,"ex.best":`Best est. 1RM`,"ex.change":`Change`,"ex.trend":`Trend`,"ex.groupRow":`{n} exercise · {sets} completed sets|{n} exercises · {sets} completed sets`,"ex.reps":`{n} rep|{n} reps`,"ex.rest":`median rest {v}`,"ex.weight":`Top set ({unit})`,"ex.e1rm":`Est. 1RM ({unit})`,"ex.volume":`Volume ({unit})`,"ex.maxReps":`Max reps`,"ex.totalReps":`Total reps`,"ex.longest":`Longest set (s)`,"ex.restAfter":`rest {v}`,"ex.notDone":`not done`,"w.strengthSessions":`Sessions`,"ss.count":`{n} exercise|{n} exercises`,"mg.chest":`Chest`,"mg.back":`Back`,"mg.shoulders":`Shoulders`,"mg.biceps":`Biceps`,"mg.triceps":`Triceps`,"mg.forearms":`Forearms`,"mg.quads":`Quads`,"mg.hamstrings":`Hamstrings`,"mg.glutes":`Glutes`,"mg.calves":`Calves`,"mg.abs":`Abs`,"mg.hips":`Hips`,"mg.other":`Other`,"w.walkDetails":`Pace and walks`,"wd.steps":`Steps`,"wd.battery":`Body battery change`,"wd.goal":`Step goal`,"wd.floors":`Floors`,"w.steps":`Daily steps`,"w.hikeVertical":`Vertical speed`,"hv.vam":`Vertical {unit} per hour`,"w.bikeDetails":`Rides`,"bd.outdoor":`Outdoor`,"bd.indoor":`Indoor`,"bd.rides":`{n} ride|{n} rides`,"bd.where":`Where`,"w.swimDetails":`Swims`,"sw.pace":`Pace`,"sw.lengths":`Lengths`,"sw.strokes":`Strokes`,"sw.pool":`Pool`,"w.racketDetails":`Sessions and intensity`,"pd.peak":`Peak HR`,"pd.z3":`Time in Z3+`,"pd.z45":`Z4-5 share`,"pd.kcal":`kcal per hour`,"pd.load":`Load / run of same length`,"pd.note":`The second load is an estimate: the average Garmin load per minute of your runs, times the length of the session.`,"col.sport":`Sport`,"sport.tennis":`Tennis`,"sport.padel":`Padel`,"sport.pickleball":`Pickleball`,"sport.racquetball":`Racquetball`,"sport.squash":`Squash`,"sport.badminton":`Badminton`,"sport.tableTennis":`Table tennis`,"sport.platformTennis":`Platform tennis`};let _d={en:gd},vd={en:`English`};function yd(e){if(e&&typeof e==`object`)for(let[t,n]of Object.entries(e)){if(!/^[a-z]{2,3}(-[A-Z]{2})?$/.test(t)||!n||typeof n!=`object`)continue;let e=Object.fromEntries(Object.entries(n).filter(([e,t])=>e in gd&&typeof t==`string`));_d[t]={..._d[t]??gd,...e},vd[t]??=bd(t)}}function bd(e){try{let t=new Intl.DisplayNames([e],{type:`language`}).of(e);return t?t[0].toUpperCase()+t.slice(1):e}catch{return e}}function xd(e,t){return e in _d?e:t.flatMap(e=>[e,e.slice(0,2).toLowerCase()]).find(e=>e in _d)??`en`}function Sd(e){let t=_d[e]??gd,n=new Intl.PluralRules(e);return(e,r={})=>{let i=t[e]??gd[e];if(i.includes(`|`)&&typeof r.n==`number`){let[e,t]=i.split(`|`);i=n.select(r.n)===`one`?e:t}return i.replace(/\{(\w+)\}/g,(e,t)=>String(r[t]??e))}}let Cd=e=>typeof e==`number`&&Number.isFinite(e),wd=e=>String(e).padStart(2,`0`),Td=1.609344,Ed=.45359237,Dd={metric:{dist:[`km`,1],elev:[`m`,1],mass:[`kg`,1],swim:[`100 m`,1],speed:`km/h`},statute_us:{dist:[`mi`,Td],elev:[`ft`,.3048],mass:[`lb`,Ed],swim:[`100 yd`,.9144],speed:`mph`},statute_uk:{dist:[`mi`,Td],elev:[`m`,1],mass:[`lb`,Ed],swim:[`100 m`,1],speed:`mph`}};function Od(e,t=`metric`){let n=(_d[e]??gd).na,r=/* @__PURE__ */ new Map,i=t=>{let n=r.get(t);return n||(n=new Intl.NumberFormat(e,{minimumFractionDigits:t,maximumFractionDigits:t}),r.set(t,n)),n},a=new Intl.NumberFormat(e,{signDisplay:`exceptZero`,maximumFractionDigits:0}),o=new Intl.DateTimeFormat(e,{day:`numeric`,month:`short`,timeZone:`UTC`}),s=new Intl.DateTimeFormat(e,{day:`numeric`,month:`short`,year:`numeric`,timeZone:`UTC`}),c=(e,t=0)=>Cd(e)?i(t).format(e):n,l=e=>{if(!Cd(e))return n;let t=Math.round(e),r=Math.floor(t/3600),i=Math.floor(t%3600/60);return r>0?`${r}:${wd(i)}:${wd(t%60)}`:`${i}:${wd(t%60)}`},u=Dd[t]??Dd.metric,d={dist:e=>e/u.dist[1],pace:e=>e*u.dist[1],speed:e=>e/u.dist[1],elev:e=>e/u.elev[1],mass:e=>e/u.mass[1],swim:e=>e*u.swim[1]},f={dist:u.dist[0],pace:`/${u.dist[0]}`,speed:u.speed,elev:u.elev[0],mass:u.mass[0],swim:`/${u.swim[0]}`},p=(e,t,r,i)=>Cd(e)?`${c(t(e),r)} ${i}`:n;return{na:n,num:c,to:d,unit:f,dist:(e,t=1)=>p(e,d.dist,t,f.dist),pace:e=>Cd(e)?`${l(d.pace(e))}${f.pace}`:n,speed:(e,t=1)=>p(e,d.speed,t,f.speed),elev:(e,t=0)=>p(e,d.elev,t,f.elev),mass:(e,t=1)=>p(e,d.mass,t,f.mass),swimPace:e=>Cd(e)?`${l(d.swim(e))}${f.swim}`:n,pct:e=>Cd(e)?`${a.format(e)}%`:n,day:e=>e?o.format(/* @__PURE__ */ new Date(`${e}T00:00:00Z`)):n,longDay:e=>e?s.format(/* @__PURE__ */ new Date(`${e}T00:00:00Z`)):n,hms:l,hours:e=>{if(!Cd(e))return n;let t=Math.round(e/60);return t>=60?`${Math.floor(t/60)}h ${t%60}m`:`${t}m`}}}let kd={all:[[`kpis`,3],[`readiness`,2],[`calendar`,1],[`periodComparison`,3],[`records`,3],[`weeklyVolume`,2],[`intensityMinutes`,1],[`loadSafety`,3],[`loadVsRecovery`,3],[`activities`,3],[`coachNotes`,3]],recovery:[[`readiness`,2],[`fitnessAge`,1],[`loadVsRecovery`,3],[`hrv`,1],[`restingHr`,1],[`sleep`,1],[`sleepNeed`,1],[`bedtime`,1],[`bodyBattery`,1]],running:[[`typeKpis`,3],[`typeWeekly`,2],[`hrZones`,1],[`bestEfforts`,1],[`races`,2],[`aerobicFitness`,2],[`intensityShare`,1],[`runningForm`,3],[`runWalk`,1],[`trainingEffect`,2],[`racePredictor`,1],[`longRuns`,2],[`activities`,3]],strengthTraining:[[`typeKpis`,3],[`typeWeekly`,2],[`hrZones`,1],[`setsPerCategory`,2],[`muscleBalance`,1],[`exercises`,3],[`strengthSessions`,3]],walking:[[`typeKpis`,3],[`typeWeekly`,2],[`hrZones`,1],[`walkDetails`,2],[`steps`,1],[`activities`,3]],hiking:[[`typeKpis`,3],[`typeWeekly`,2],[`hrZones`,1],[`hikeVertical`,3],[`activities`,3]],cycling:[[`typeKpis`,3],[`typeWeekly`,2],[`hrZones`,1],[`bikeDetails`,3],[`activities`,3]],swimming:[[`typeKpis`,3],[`typeWeekly`,2],[`hrZones`,1],[`swimDetails`,3],[`activities`,3]],racket:[[`typeKpis`,3],[`typeWeekly`,2],[`hrZones`,1],[`racketDetails`,3],[`activities`,3]],generic:[[`typeKpis`,3],[`typeWeekly`,2],[`hrZones`,1],[`activities`,3]]};function Ad(e){return(kd[e]??kd.generic).map(([e,t])=>({id:e,widget:e,span:t}))}let jd=[{id:`kpis`,title:`w.kpis`,types:[`all`,...i],span:3},{id:`readiness`,title:`w.readiness`,needs:`recovery`,span:2},{id:`fitnessAge`,title:`w.fitnessAge`,needs:`fitnessAge`,span:1},{id:`periodComparison`,title:`w.periodComparison`,types:[`all`,...i],span:3,minSpan:2},{id:`records`,title:`w.records`,types:[`all`,...i],span:3},{id:`weeklyVolume`,title:`w.weeklyVolume`,types:[`all`,...i],span:2},{id:`intensityMinutes`,title:`w.intensityMinutes`,types:[`all`,...i],span:1},{id:`loadSafety`,title:`w.loadSafety`,span:3},{id:`calendar`,title:`w.calendar`,types:[`all`,...i],span:3},{id:`loadVsRecovery`,title:`w.loadVsRecovery`,needs:`recovery`,types:[`all`,...i],span:3},{id:`hrv`,title:`w.hrv`,needs:`recovery`,span:1},{id:`restingHr`,title:`w.restingHr`,needs:`recovery`,span:1},{id:`sleep`,title:`w.sleep`,needs:`recovery`,span:1},{id:`sleepNeed`,title:`w.sleepNeed`,needs:`recovery`,span:1},{id:`bedtime`,title:`w.bedtime`,needs:`recovery`,span:1},{id:`bodyBattery`,title:`w.bodyBattery`,needs:`recovery`,span:1},{id:`activities`,title:`w.activities`,types:[`all`,...i],span:3,minSpan:2},{id:`coachNotes`,title:`w.coachNotes`,needs:`notes`,span:3},{id:`typeKpis`,title:`w.typeKpis`,types:[`all`,...i],span:3},{id:`typeWeekly`,title:`w.typeWeekly`,types:[`all`,...i],span:2},{id:`hrZones`,title:`w.hrZones`,types:[`all`,...i],span:1},{id:`bestEfforts`,title:`w.bestEfforts`,types:[`running`],span:1},{id:`races`,title:`w.races`,types:[`running`],span:2},{id:`aerobicFitness`,title:`w.aerobicFitness`,types:[`running`],span:2},{id:`intensityShare`,title:`w.intensityShare`,types:[`running`],span:1},{id:`runningForm`,title:`w.runningForm`,types:[`running`],span:3},{id:`runWalk`,title:`w.runWalk`,types:[`running`],span:1},{id:`trainingEffect`,title:`w.trainingEffect`,types:[`running`],span:2},{id:`racePredictor`,title:`w.racePredictor`,types:[`running`],span:1},{id:`longRuns`,title:`w.longRuns`,types:[`running`],span:2},{id:`setsPerCategory`,title:`w.setsPerCategory`,types:[`strengthTraining`],span:2},{id:`muscleBalance`,title:`w.muscleBalance`,types:[`strengthTraining`],span:1},{id:`exercises`,title:`w.exercises`,types:[`strengthTraining`],span:3},{id:`strengthSessions`,title:`w.strengthSessions`,types:[`strengthTraining`],span:3},{id:`walkDetails`,title:`w.walkDetails`,types:[`walking`,`hiking`],span:2},{id:`steps`,title:`w.steps`,needs:`recovery`,span:1},{id:`hikeVertical`,title:`w.hikeVertical`,types:[`hiking`,`walking`,`running`],span:3},{id:`bikeDetails`,title:`w.bikeDetails`,types:[`cycling`],span:3},{id:`swimDetails`,title:`w.swimDetails`,types:[`swimming`],span:3},{id:`racketDetails`,title:`w.racketDetails`,types:[`racket`,`generic`],span:3}],Md=/* @__PURE__ */ new Map;function K(e){let t=jd.find(t=>t.id===e.id);if(!t)throw Error(`widget ${e.id} is not in the catalogue`);Md.set(e.id,{...e,title:e=>e(t.title),types:t.types,span:t.span,minSpan:t.minSpan})}function Nd(e){Md.get(e.id)?.custom===!1||jd.some(t=>t.id===e.id)||Md.set(e.id,{...e,custom:!0})}let Pd=/* @__PURE__ */ new Set;function Fd(e){for(let t of jd)t.needs&&e.includes(t.needs)&&(Md.delete(t.id),Pd.add(t.id))}let Id=e=>Md.get(e),Ld=()=>[...Md.values()];function Rd(e){try{return e?decodeURIComponent(e):void 0}catch{return}}function zd(e,t,n){let[,r,i,a,o]=/^#?([a-zA-Z]+)?(?:@(\d{4}-\d{2}-\d{2})_(\d{4}-\d{2}-\d{2}))?(?:\/(.+))?$/.exec(e)??[],s=Rd(o),c=i&&a&&i<=a&&n.includes(i)&&n.includes(a)?{from:i,to:a}:{from:n[0],to:n.at(-1)};return{tab:r&&t.includes(r)?r:`all`,...c,...s===void 0?{}:{item:s}}}function Bd(e){return`#${e.tab}@${e.from}_${e.to}${e.item?`/${encodeURIComponent(e.item)}`:``}`}let Vd=(e,t)=>`type.${t}`in gd?e(`type.${t}`):t,Hd=(e,t,n)=>t===e.fmt.na?t:`${t}${n}`;function q(e,t,...n){return W(`div`,{class:`kpi`},W(`div`,{class:`kpi-label`},e),W(`div`,{class:`kpi-value`},t),...n.map(e=>e&&W(`div`,{class:`kpi-sub`},e)))}let Ud=(...e)=>W(`div`,{class:`kpis`},...e);function Wd(e,t,n){if(t.length===0)return!1;let r=`garmin-open:${e.board}:${e.id}`,i=W(`button`,{class:`btn more`,"aria-controls":t.map((t,n)=>t.id||=`open-${e.board}-${e.id}-${n}`).join(` `)}),a=r=>{for(let e of t)e.hidden=!r;i.setAttribute(`aria-expanded`,String(r)),i.textContent=r?e.t(`act.less`):e.t(`act.more`,{n})};return i.addEventListener(`click`,()=>{let e=i.getAttribute(`aria-expanded`)!==`true`;a(e),e?Mu.set(r,`1`):Mu.remove(r)}),a(Mu.get(r)===`1`),i}function Gd(e,t,n){if(t===null)return W(`span`,{});let r=n?e.calc.changeClass(t,n===`up`):`same`,i=Math.abs(t)<.5;return W(`span`,{class:`delta ${n?r:``}`},i?``:t>0?`▲ `:`▼ `,e.fmt.pct(Math.abs(t)).replace(`+`,``),r!==`same`&&W(`span`,{class:`sr-only`},` (${e.t(`delta.${r}`)})`))}function Kd(e,t,n=[]){let r=e=>n.includes(e)?`num`:void 0;return W(`table`,{class:`data`},W(`thead`,{},W(`tr`,{},...e.map((e,t)=>W(`th`,{class:r(t),scope:`col`},e)))),W(`tbody`,{},...t.map(e=>W(`tr`,{},...e.map((e,t)=>W(`td`,{class:r(t)},e))))))}function qd(e,t){let n=c(t);return W(`span`,{class:`type type-${n}`},md(n),Vd(e.t,n))}function Jd(e,t){let n=t===g(e.data.end)&&(/* @__PURE__ */ new Date(`${e.data.end}T00:00:00Z`)).getUTCDay()!==0;return`${e.fmt.day(t)}${n?`*`:``}`}function Yd(e){let t=n(e.to,6);return t<e.data.end?t:e.data.end}function Xd(e){return[...e.data.activities,...e.data.previousActivities]}function Zd(e,t,n,r=`all`){return e.filter(e=>{let i=typeof e.start==`string`?e.start.slice(0,10):``;return i>=t&&i<=n&&(r===`all`||c(e)===r)})}let Qd=e=>e.calc.zonesOf(e.data.zones).maxHR;function $d(e,t){let n=Qd(e);return t.reduce((t,r)=>{let i=e.calc.loadOf(r,n);return{sessions:t.sessions+1,km:t.km+(typeof r.km==`number`?r.km:0),seconds:t.seconds+m(r),load:t.load+(i?.value??0),loadKnown:t.loadKnown+ +!!i}},{sessions:0,km:0,seconds:0,load:0,loadKnown:0})}let ef=(e,t)=>t.sessions>0&&t.loadKnown===0?e.fmt.na:e.fmt.num(t.load);function tf(e,t){return/^#[0-9a-f]{6}$/i.test(e)?`${e}${Math.round(t*255).toString(16).padStart(2,`0`)}`:e}let nf=/* @__PURE__ */ new Map;function rf(e,t,n,r){let i=`${e.board}/${e.id}/${t}`,a=nf.get(i)??n[0][0];return[a,W(`div`,{class:`picker`,role:`group`,"aria-label":r},...n.map(([t,n])=>W(`button`,{class:`chip small`,"aria-pressed":String(t===a),onclick:()=>{nf.set(i,t),e.refresh()}},n)))]}let J=e=>W(`p`,{class:`muted small note`},e),af=/* @__PURE__ */ new Set;K({id:`activities`,render(e,t){let{t:n,fmt:r}=t,i=t.activities;if(i.length===0){t.empty(e);return}let a=Kd([n(`col.date`),n(`col.type`),n(`col.name`),n(`col.distance`),n(`col.time`),n(`col.pace`),n(`col.hr`),n(`col.ascent`)],[],[3,4,5,6,7]),o=a.querySelector(`tbody`),s=[];for(let[e,a]of i.entries()){let i=o.childElementCount,c=String(a.id),l=Array.isArray(a.laps)?a.laps:[],u=af.has(c),d=W(`span`,{},a.name??``,a.race===!0&&W(`span`,{class:`tag`},n(`col.race`))),p=[r.day(String(a.start).slice(0,10)),qd(t,a),l.length>0?W(`button`,{class:`linkish`,"aria-expanded":String(u),onclick:()=>{u?af.delete(c):af.add(c),t.refresh()}},d,` · ${n(`laps.show`)}`):d,typeof a.km==`number`?r.dist(a.km,2):``,r.hms(t.calc.sessionSeconds(a)),of(a,r),typeof a.avgHR==`number`?r.num(a.avgHR):``,typeof a.ascentM==`number`?r.elev(a.ascentM):``];o.append(W(`tr`,{},...p.map((e,t)=>W(`td`,{class:t>=3?`num`:void 0},e)))),u&&o.append(W(`tr`,{class:`laps-row`},W(`td`,{colspan:`8`},Kd([n(`lap.n`),n(`col.distance`),n(`col.time`),n(`col.pace`),n(`col.hr`),n(`lap.intensity`)],l.map(e=>[String(e.lap??``),typeof e.km==`number`?r.dist(e.km,2):``,String(e.time??``),f(e.pace)>0?r.pace(f(e.pace)):typeof e.kmh==`number`?r.speed(e.kmh):``,typeof e.avgHR==`number`?r.num(e.avgHR):``,String(e.intensity??``)]),[1,2,3,4])))),e>=15&&s.push(...[...o.children].slice(i))}G(e,a,Wd(t,s,i.length))}});function of(e,t){let n=c(e);if(n===`strengthTraining`||n===`racket`)return``;let r=f(e.duration)/3600;return n===`cycling`?typeof e.km==`number`&&r>0?t.speed(e.km/r):``:f(e.pace)>0?t.pace(f(e.pace)):``}K({id:`coachNotes`,render(e,t){let n=(t.data.notes??[]).slice(0,5);if(n.length===0){t.empty(e,t.t(`notes.none`));return}let r=W(`ul`,{class:`notes`});for(let e of n)r.append(W(`li`,{},e));G(e,r,W(`p`,{class:`muted small`},t.t(`notes.disclaimer`,{date:t.fmt.longDay(t.data.end)})))}});let sf=e=>typeof e==`number`&&Number.isFinite(e)?e:void 0,cf=e=>e.at(-1),lf=(e,t)=>e.filter(e=>c(e)===t);K({id:`kpis`,render(e,t){let{t:r,fmt:i,calc:a}=t,o=$d(t,t.activities),s=Yd(t),c=t.ofType(Xd(t)),l=$d(t,Zd(c,n(s,-6),s)),u=$d(t,Zd(c,n(s,-34),n(s,-7))),d=a.loadRatio(Xd(t),s,Qd(t)).ratio,f=cf(t.data.hrv.filter(e=>String(e.date)<=s)),p=sf(f?.hrv),m=sf(f?.weeklyAvg),h=t.type!==`all`;G(e,W(`p`,{class:`totals`},r(`kpi.totals`,{distance:i.dist(o.km),km:i.num(o.km,1),time:i.hours(o.seconds),n:o.sessions})),Ud(q(r(`kpi.distance`),i.dist(l.km),W(`span`,{},Gd(t,a.change(l.km,u.km/4)),` `,r(`kpi.vs4w`))),q(r(`kpi.time`),i.hours(l.seconds),W(`span`,{},Gd(t,a.change(l.seconds,u.seconds/4)),` `,r(`kpi.vs4w`))),q(r(`kpi.ratio`),d===null?i.na:i.num(d,2),W(`span`,{class:d!==null&&(d<.8||d>1.3)?`warn`:`good`},r(`kpi.band`)),h&&r(`kpi.ratioAll`)),q(r(`kpi.hrv`),p===void 0?i.na:`${i.num(p)} ms`,p!==void 0&&m!==void 0&&W(`span`,{},Gd(t,a.change(p,m),`up`),` `,r(`kpi.vsBaseline`,{v:i.num(m)})))))}}),K({id:`readiness`,render(e,t){let{t:n,fmt:r,calc:i,data:a}=t,o=cf(a.hrv),s=a.recovery,c=cf(s),l=s.slice(-8,-1).map(e=>sf(e.rhr)).filter(e=>e!==void 0),u=i.mean(l)??void 0,d=i.loadRatio(Xd(t),a.end,Qd(t)).ratio,f={hrvStatus:typeof o?.status==`string`?o.status:void 0,sleepScore:sf(c?.sleepScore),rhr:sf(c?.rhr),rhrAvg:u,ratio:d},p=i.readiness(f);G(e,W(`p`,{class:`verdict verdict-${p??`none`}`},p?n(`ready.${p}`):r.na),Ud(q(n(`ready.hrv`),f.hrvStatus??r.na),q(n(`ready.sleep`),r.num(f.sleepScore)),q(n(`ready.rhr`),f.rhr===void 0?r.na:`${r.num(f.rhr)} bpm`,u!==void 0&&n(`ready.rhrVs`,{avg:r.num(u,1)})),q(n(`ready.ratio`),d===null?r.na:r.num(d,2))),J(n(`ready.note`)))}}),K({id:`fitnessAge`,render(e,t){let{t:n,fmt:r}=t,i=t.data.fitnessAge;if(!i||sf(i.fitnessAge)===void 0){t.empty(e,r.na);return}let a=Object.entries(i.components??{}),o=/* @__PURE__ */ new Set([`bodyFat`,`bmi`,`rhr`,`vigorousDaysAvg`,`vigorousMinutesAvg`]);G(e,Ud(q(n(`fa.age`),r.num(sf(i.fitnessAge),1)),q(n(`fa.actual`),r.num(sf(i.chronologicalAge))),q(n(`fa.achievable`),r.num(sf(i.achievableFitnessAge),1))),a.length>0&&W(`details`,{class:`more-details`},W(`summary`,{},n(`fa.details`)),Kd([n(`fa.component`),n(`fa.value`),n(`fa.target`),n(`fa.potential`)],a.map(([e,t])=>[o.has(e)?n(`fa.${e}`):e,r.num(sf(t.value),1),r.num(sf(t.targetValue),1),r.num(sf(t.potentialAge),1)]),[1,2,3])),J(n(`today.note`)))}}),K({id:`periodComparison`,render(e,t){let{t:n,fmt:r,calc:i}=t,a=Yd(t),o=i.periodWindow(t.from,t.to,t.data.prevStart),s=t.activities,c=t.ofType(Zd(Xd(t),o.from,o.to)),l=u([...s,...c]),d=(e,n,a)=>{let o=$d(t,n),s=$d(t,a),c=(e,n)=>W(`span`,{},e,` `,Gd(t,n));return[e,c(r.num(o.sessions),i.change(o.sessions,s.sessions)),o.km>0||s.km>0?c(r.dist(o.km),i.change(o.km,s.km)):``,c(r.hours(o.seconds),i.change(o.seconds,s.seconds)),c(ef(t,o),o.loadKnown&&s.loadKnown?i.change(o.load,s.load):null)]};G(e,W(`p`,{class:`muted small`},n(`pc.vs`,{from:r.day(t.from),to:r.day(a),pfrom:r.day(o.from),pto:r.day(o.to)}),o.partial&&` (${n(`pc.partial`)})`),Kd([n(`pc.type`),n(`pc.sessions`),n(`pc.distance`),n(`pc.time`),n(`pc.load`)],[...l.map(e=>d(Vd(n,e),lf(s,e),lf(c,e))),...l.length>1?[d(W(`strong`,{},n(`pc.total`)),s,c)]:[]],[1,2,3,4]))}}),K({id:`records`,render(e,t){let{t:n,fmt:r,calc:i}=t,a=[],o=[],s=(e,t,n)=>W(`div`,{class:`badge`},W(`div`,{class:`kpi-label`},e),W(`div`,{class:`badge-value`},t),W(`div`,{class:`muted small`},`${r.day(String(n.start).slice(0,10))} · ${n.name??``}`));for(let e of[`1k`,`mile`,`5k`,`10k`,`half`,`marathon`]){let c=t.activities.map(t=>({a:t,s:i.seconds(t.best?.[e])})).filter(e=>e.s>0).toSorted((e,t)=>e.s-t.s)[0];c&&(a.push(s(n(`rec.best`,{d:n(`d.${e}`)}),r.hms(c.s),c.a)),o[0]=a.at(-1))}let l=e=>t.activities.filter(t=>c(t)===e&&typeof t.km==`number`).toSorted((e,t)=>(t.km??0)-(e.km??0))[0],u=l(`running`);u&&a.push(o[1]=s(n(`rec.longestRun`),r.dist(u.km),u));let d=l(`cycling`);d&&a.push(o[2]=s(n(`rec.longestRide`),r.dist(d.km),d));let f,p=/* @__PURE__ */ new Map;for(let e of t.activities)for(let t of e.exercises??[])for(let n of t.sets){if(!(n.reps>0&&n.kg>0))continue;(!f||n.kg>f.kg)&&(f={kg:n.kg,reps:n.reps,name:t.exercise,a:e});let r=i.epley(n.kg,n.reps);r!==void 0&&r>(p.get(t.exercise)?.v??0)&&p.set(t.exercise,{v:r,a:e})}f&&a.push(s(n(`rec.topSet`),`${f.name}: ${r.mass(f.kg)} × ${f.reps}`,f.a));for(let[e,{v:t,a:i}]of[...p].toSorted((e,t)=>t[1].v-e[1].v))a.push(s(n(`rec.e1rm`,{name:e}),r.mass(t),i)),o[3]??=a.at(-1);if(a.length===0){t.empty(e,n(`rec.none`));return}let m=o.filter(e=>e!==void 0),h=[...m,...a.filter(e=>!m.includes(e))];G(e,W(`div`,{class:`badges`},...h),p.size>0&&J(n(`rec.estimate`)),Wd(t,h.slice(4),h.length))}});let uf=e=>typeof e==`number`&&Number.isFinite(e)?e:null,df=(e,t)=>e.map(e=>uf(e[t]));function ff(e){return e.data.recovery.slice(-14)}function pf(e,t){return t.map(t=>e.fmt.day(String(t.date)))}function mf(e,t,n){return n.length===0&&t.empty(e,t.fmt.na),n.length===0}function hf(e,t){t.board!==`recovery`&&G(e,J(t.t(`rec14`)))}let gf=e=>`${String(Math.floor(e/60)%24).padStart(2,`0`)}:${String(Math.round(e%60)).padStart(2,`0`)}`;K({id:`hrv`,render(e,t){let{t:n,calc:r}=t,i=t.data.hrv.slice(-14);if(mf(e,t,i))return;let a=df(i,`hrv`);t.chart(e,{type:`line`,data:{labels:pf(t,i),datasets:[{label:n(`hrv.low`),data:df(i,`low`),borderColor:`transparent`,pointRadius:0,fill:!1},{label:n(`hrv.band`),data:df(i,`high`),borderColor:`transparent`,backgroundColor:`${t.color(`good`)}22`,pointRadius:0,fill:`-1`},{label:n(`hrv.nightly`),data:a,borderColor:t.color(`accent`),pointRadius:2,spanGaps:!0},{label:n(`hrv.avg`),data:r.rolling(a,7),borderColor:t.color(`text`),borderDash:[4,3],pointRadius:0}]},options:{scales:{y:{title:{display:!0,text:`ms`}}},plugins:{legend:{labels:{filter:e=>e.text!==n(`hrv.low`)}}}}}),hf(e,t)}}),K({id:`restingHr`,render(e,t){let n=ff(t);mf(e,t,n)||(t.chart(e,{type:`line`,data:{labels:pf(t,n),datasets:[{label:t.t(`w.restingHr`),data:df(n,`rhr`),borderColor:t.color(`bad`),pointRadius:2,spanGaps:!0}]},options:{scales:{y:{title:{display:!0,text:`bpm`}}}}}),hf(e,t))}}),K({id:`sleep`,render(e,t){let{t:n}=t,r=ff(t);if(mf(e,t,r))return;let i=(e,t,n)=>({type:`bar`,label:t,data:df(r,e),backgroundColor:n,stack:`s`,yAxisID:`y`});t.chart(e,{type:`bar`,data:{labels:pf(t,r),datasets:[i(`deep`,n(`sl.deep`),t.color(`strengthTraining`)),i(`light`,n(`sl.light`),t.color(`cycling`)),i(`rem`,n(`sl.rem`),t.color(`swimming`)),i(`awake`,n(`sl.awake`),t.color(`racket`)),{type:`line`,label:n(`sl.score`),data:df(r,`sleepScore`),borderColor:t.color(`text`),pointRadius:2,yAxisID:`y1`,spanGaps:!0}]},options:{scales:{x:{stacked:!0},y:{stacked:!0,title:{display:!0,text:`h`}},y1:{position:`right`,min:0,max:100,grid:{drawOnChartArea:!1}}}}}),hf(e,t)}}),K({id:`sleepNeed`,render(e,t){let{t:n,fmt:r,calc:i}=t,a=ff(t);if(mf(e,t,a))return;let o=a.flatMap(e=>uf(e.sleepH)!==null&&uf(e.needH)!==null?[uf(e.needH)-uf(e.sleepH)]:[]),s=i.mean(o);G(e,Ud(q(n(`sn.gap`),s===null?r.na:`${r.num(s*60)} min`))),t.chart(e,{type:`bar`,data:{labels:pf(t,a),datasets:[{type:`bar`,label:n(`sn.actual`),data:df(a,`sleepH`),backgroundColor:t.color(`accent`)},{type:`line`,label:n(`sn.need`),data:df(a,`needH`),borderColor:t.color(`warn`),pointRadius:2,spanGaps:!0}]},options:{scales:{y:{title:{display:!0,text:`h`}}}}},180),hf(e,t)}}),K({id:`bedtime`,render(e,t){let{t:n,fmt:r,calc:i}=t,a=ff(t);if(mf(e,t,a))return;let o=df(a,`bedMin`).map(e=>e===null?null:e<720?e+1440:e),s=i.bedtimeSpread(o.filter(e=>e!==null));G(e,Ud(q(n(`bt.spread`),s===null?r.na:`± ${r.num(s)} min`))),t.chart(e,{type:`line`,data:{labels:pf(t,a),datasets:[{label:n(`w.bedtime`),data:o,borderColor:t.color(`accent`),pointRadius:3,showLine:!1}]},options:{scales:{y:{reverse:!0,ticks:{callback:e=>gf(Number(e))}}},plugins:{tooltip:{callbacks:{label:e=>gf(e.parsed.y??0)}}}}},180),hf(e,t)}}),K({id:`bodyBattery`,render(e,t){let{t:n}=t,r=ff(t);mf(e,t,r)||(t.chart(e,{type:`bar`,data:{labels:pf(t,r),datasets:[{label:n(`bb.high`),data:df(r,`bbHigh`),backgroundColor:t.color(`good`)},{label:n(`bb.low`),data:df(r,`bbLow`),backgroundColor:tf(t.color(`bad`),.35),borderColor:t.color(`bad`),borderWidth:1.5}]},options:{scales:{y:{min:0,max:100}}}}),hf(e,t))}});let _f=e=>e===0?0:e<30?1:e<60?2:e<90?3:4;function vf(e,t){return u(e.activities).map(n=>({type:`bar`,label:Vd(e.t,n),data:e.calc.weekly(e.activities.filter(e=>c(e)===n),e.weeks,t),backgroundColor:e.color(n),stack:`types`}))}function yf(e,t,n){let{t:r,fmt:i,calc:a}=t,o=Qd(t),s={time:[r(`m.time`),`h`,e=>m(e)/3600],distance:[r(`m.distance`),i.unit.dist,e=>typeof e.km==`number`?i.to.dist(e.km):0],sessions:[r(`m.sessions`),``,()=>1],load:[r(`m.load`),``,e=>a.loadOf(e,o)?.value??0]},[c,l]=rf(t,`metric`,Object.entries(s).filter(([e])=>!n||n.includes(e)).map(([e,[t]])=>[e,t]),r(`m.label`)),[,u,d]=s[c],f=a.weekly(t.activities,t.weeks,d);G(e,l),t.activities.length===0?t.empty(e):t.chart(e,{type:`bar`,data:{labels:t.weeks.map(e=>Jd(t,e)),datasets:[...vf(t,d),{type:`line`,label:r(`vol.avg`),data:a.rolling(f,4),borderColor:t.color(`text`),borderDash:[4,3],pointRadius:2}]},options:{scales:{x:{stacked:!0},y:{stacked:!0,title:{display:!!u,text:u}}},plugins:{tooltip:{callbacks:{label:e=>`${e.dataset.label}: ${i.num(e.parsed.y??void 0,1)} ${u}`}}}}})}K({id:`weeklyVolume`,render:(e,t)=>yf(e,t)}),K({id:`intensityMinutes`,render(e,t){let{t:n,calc:r}=t;if(t.activities.length===0){t.empty(e);return}let i=r.weekly(t.activities,t.weeks,r.intensityMinutes);t.chart(e,{type:`bar`,data:{labels:t.weeks.map(e=>Jd(t,e)),datasets:[{type:`bar`,label:n(`w.intensityMinutes`),data:i,backgroundColor:i.map(e=>t.color(e>=150?`good`:`accent`))},{type:`line`,label:n(`im.guide`),data:t.weeks.map(()=>150),borderColor:t.color(`warn`),borderDash:[5,4],pointRadius:0}]},options:{scales:{y:{title:{display:!0,text:`min`}}}}}),G(e,J(n(`im.note`)))}}),K({id:`loadSafety`,render(e,t){let{t:r,fmt:i,calc:a}=t,o=Qd(t),s=t.allActivities,c=a.weekly(s,t.weeks,e=>a.loadOf(e,o)?.value??0),l=a.ramp(c);(/* @__PURE__ */ new Date(`${t.data.end}T00:00:00Z`)).getUTCDay()!==0&&t.weeks.at(-1)===t.calc.mondayOf(t.data.end)&&(l[l.length-1]=null);let u=l.map(e=>e!==null&&e>10),d=Yd(t),f=a.monotony(a.dailyLoads(s,n(d,-6),d,o)),p=s.filter(e=>{let t=h(e);return t!==void 0&&t>=n(d,-6)&&t<=d}),m=p.length>0&&!p.some(e=>a.loadOf(e,o)),g=s.some(e=>a.loadOf(e,o)?.estimate);G(e,Ud(q(r(`ls.weekLoad`),m?i.na:i.num(f.weekLoad)),q(r(`ls.monotony`),m||f.monotony===null?i.na:i.num(f.monotony,2),f.monotony!==null&&f.monotony>2&&W(`span`,{class:`bad`},r(`ls.monotonyFlag`))),q(r(`ls.strain`),m||f.strain===null?i.na:i.num(f.strain)),q(r(`ls.flagged`),String(u.filter(Boolean).length)))),t.chart(e,{type:`bar`,data:{labels:t.weeks.map(e=>Jd(t,e)),datasets:[{type:`bar`,label:r(`ls.load`),data:c,backgroundColor:u.map(e=>e?t.color(`bad`):tf(t.color(`muted`),.6)),yAxisID:`y`},{type:`line`,label:r(`ls.ramp`),data:l,borderColor:t.color(`warn`),yAxisID:`y1`,spanGaps:!0}]},options:{scales:{y:{title:{display:!0,text:r(`ls.load`)}},y1:{position:`right`,grid:{drawOnChartArea:!1},title:{display:!0,text:`%`}}}}}),G(e,J(r(`ls.note`)),g&&J(r(`ls.estimated`)))}}),K({id:`loadVsRecovery`,render(e,t){let{t:r,calc:i}=t,a=Qd(t),o=Yd(t),s=[];for(let e=t.from;e<=o;e=n(e,1))s.push(e);let l=new Map(t.data.hrv.map(e=>[String(e.date),typeof e.hrv==`number`?e.hrv:null]));t.chart(e,{type:`bar`,data:{labels:s.map(e=>t.fmt.day(e)),datasets:[...u(t.activities).map(e=>({type:`bar`,label:Vd(t.t,e),data:i.dailyLoads(t.activities.filter(t=>c(t)===e),t.from,o,a),backgroundColor:t.color(e),stack:`load`,yAxisID:`y`})),{type:`line`,label:r(`lvr.hrv`),data:s.map(e=>l.get(e)??null),borderColor:t.color(`text`),pointRadius:1,yAxisID:`y1`,spanGaps:!0}]},options:{scales:{x:{stacked:!0},y:{stacked:!0,title:{display:!0,text:r(`ls.load`)}},y1:{position:`right`,grid:{drawOnChartArea:!1},title:{display:!0,text:`HRV (ms)`}}}}},260),G(e,J(r(`lvr.note`)))}}),K({id:`calendar`,render(e,t){let{t:r,fmt:i}=t,a=/* @__PURE__ */ new Map;for(let e of t.activities){let t=h(e);t&&a.set(t,[...a.get(t)??[],e])}let o=e=>(a.get(e)??[]).reduce((e,t)=>e+m(t)/60,0),s=new Intl.DateTimeFormat(t.lang,{weekday:`short`,timeZone:`UTC`}),c=W(`div`,{class:`cal-tip`,role:`status`,hidden:!0}),l=Yd(t),u=(t,n)=>{let s=a.get(n)??[];c.replaceChildren(W(`strong`,{},i.longDay(n)),W(`div`,{},s.length?r(`cal.minutes`,{n:i.num(o(n))}):r(`cal.rest`)),...s.map(e=>W(`div`,{class:`small`},`${e.name??``} · ${typeof e.km==`number`?`${i.dist(e.km)} · `:``}${i.hours(m(e))}`))),c.hidden=!1;let l=t.getBoundingClientRect(),u=e.getBoundingClientRect();c.style.left=`${Math.min(l.left-u.left,u.width-220)}px`,c.style.top=`${l.bottom-u.top+6}px`},d=W(`div`,{class:`cal`,role:`group`,"aria-label":r(`cal.label`),style:`grid-template-columns: auto repeat(${t.weeks.length}, minmax(10px, 20px))`,onkeydown:e=>{let t=e.target.closest(`.cal-cell[data-date]`);if(!t)return;if(e.key===`Escape`){c.hidden=!0;return}let r={ArrowUp:-1,ArrowDown:1,ArrowLeft:-7,ArrowRight:7}[e.key];if(r===void 0)return;e.preventDefault();let i=d.querySelector(`[data-date="${n(t.dataset.date,r)}"]`);i&&(t.tabIndex=-1,i.tabIndex=0,i.focus())}});for(let e=0;e<7;e++){d.append(W(`span`,{class:`cal-day muted small`},e%2==0?s.format(new Date(Date.UTC(2026,0,5+e))):``));for(let s of t.weeks){let f=n(s,e);if(f>t.data.end){d.append(W(`span`,{class:`cal-cell out`}));continue}let p=W(`button`,{class:`cal-cell l${_f(o(f))}`,"data-date":f,tabindex:f===l?`0`:`-1`,"aria-label":`${i.longDay(f)}: ${a.has(f)?r(`cal.minutes`,{n:i.num(o(f))}):r(`cal.rest`)}`,onpointerenter:()=>u(p,f),onfocus:()=>u(p,f),onclick:()=>u(p,f),onpointerleave:()=>c.hidden=!0,onblur:()=>c.hidden=!0});d.append(p)}}let f=W(`div`,{class:`cal-legend muted small`,"aria-hidden":`true`},r(`cal.less`),...[0,1,2,3,4].map(e=>W(`span`,{class:`cal-cell l${e}`})),r(`cal.more`));G(e,W(`div`,{class:`cal-wrap`},d,c),f)}});let bf=/* @__PURE__ */ new Set([`running`,`walking`,`hiking`,`cycling`,`swimming`]);function xf(e,t){return t.activities.length===0?(t.empty(e),!0):t.activities.length===1&&(t.empty(e,t.t(`one.session`)),!0)}K({id:`typeKpis`,render(e,t){let{t:r,fmt:i,calc:a}=t,o=t.activities;if(o.length===0){t.empty(e);return}let s=$d(t,o),c=a.timedDistance(o),l=$d(t,t.allActivities),u=o.map(e=>e.avgHR).filter(e=>typeof e==`number`),d=Math.max(...o.map(e=>typeof e.maxHR==`number`?e.maxHR:0)),f=Yd(t),p=t.ofType(Xd(t)),m=$d(t,Zd(p,n(f,-6),f)),h=$d(t,Zd(p,n(f,-34),n(f,-7))),g=(e,n)=>W(`span`,{},Gd(t,a.change(e,n/4)),` `,r(`kpi.vs4w`)),_=t.type!==`all`&&bf.has(t.type),v=o.reduce((e,t)=>e+(typeof t.ascentM==`number`?t.ascentM:0),0),y=[q(r(`tk.sessions`),i.num(s.sessions),g(m.sessions,h.sessions)),q(r(`tk.time`),i.hours(s.seconds),r(`tk.avg`,{v:i.hours(s.seconds/s.sessions)})),_&&q(r(`tk.distance`),i.dist(s.km),g(m.km,h.km)),_&&c.km>0&&(t.type===`cycling`?q(r(`tk.speed`),i.speed(c.km/(c.seconds/3600))):q(r(`tk.pace`),i.pace(c.seconds/c.km))),t.type===`cycling`&&q(r(`tk.ascent`),i.elev(v)),q(r(`tk.hr`),Hd(t,i.num(a.mean(u)??void 0),` bpm`),d>0&&r(`tk.peak`,{v:i.num(d)})),q(r(`tk.load`),ef(t,s),s.loadKnown>0&&l.load>0&&r(`tk.share`,{v:i.num(s.load/l.load*100)}))].filter(e=>e instanceof HTMLElement);G(e,Ud(...y),o.length===1&&J(r(`one.session`)))}}),K({id:`typeWeekly`,render(e,t){if(xf(e,t))return;let n=[`time`,`sessions`];(t.type===`all`||bf.has(t.type))&&n.splice(1,0,`distance`),yf(e,t,n)}}),K({id:`hrZones`,render(e,t){let{t:r,calc:i,fmt:a}=t;if(xf(e,t))return;let o=i.zonesOf(t.data.zones).floors,s=t.weeks.map(()=>[0,0,0,0,0]),c=!1;for(let e of t.activities){let r=i.zoneSeconds(e,o),a=String(e.start).slice(0,10),l=t.weeks.findIndex(e=>a>=e&&a<=n(e,6));!r||l<0||(c||=r.approximate,r.sec.forEach((e,t)=>s[l][t]+=e/60))}let l=[`muted`,`cycling`,`walking`,`racket`,`bad`];t.chart(e,{type:`bar`,data:{labels:t.weeks.map(e=>Jd(t,e)),datasets:[0,1,2,3,4].map(e=>({label:`Z${e+1}${o[e]?` (${o[e]}+)`:``}`,data:s.map(t=>t[e]),backgroundColor:t.color(l[e])}))},options:{scales:{x:{stacked:!0},y:{stacked:!0,title:{display:!0,text:`min`}}},plugins:{tooltip:{callbacks:{label:e=>`${e.dataset.label}: ${a.num(e.parsed.y??void 0)} min`}}}}}),G(e,c&&J(r(`zones.approximate`)))}});let Sf=[`1k`,`mile`,`5k`,`10k`,`half`,`marathon`],Cf=[[`cadenceSpm`,`form.cadence`,`spm`,0],[`gctMs`,`form.gct`,`ms`,0],[`strideCm`,`form.stride`,`cm`,0],[`vertOscCm`,`form.vertOsc`,`cm`,1],[`vertRatioPct`,`form.vertRatio`,`%`,1],[`avgPowerW`,`form.power`,`W`,0],[`normPowerW`,`form.normPower`,`W`,0]],wf=e=>e.activities.filter(e=>c(e)===`running`),Tf=e=>String(e.start).slice(0,10),Ef=e=>typeof e==`number`&&Number.isFinite(e)?e:void 0,Df=(e,t)=>e.weeks.findIndex(e=>Tf(t)>=e&&Tf(t)<=n(e,6));function Of(e){let t={};for(let n of wf(e))for(let[r,i]of Object.entries(n.best??{})){let a=e.calc.seconds(i);a>0&&(!t[r]||a<t[r].s)&&(t[r]={s:a,a:n})}return t}K({id:`bestEfforts`,render(e,t){let{t:n,fmt:r}=t,i=Of(t),a=Sf.filter(e=>i[e]).map(e=>[n(`d.${e}`),r.hms(i[e].s),`${r.day(Tf(i[e].a))} · ${i[e].a.name??``}`]);if(a.length===0)return t.empty(e);G(e,Kd([n(`be.distance`),n(`col.time`),n(`be.activity`)],a,[1]))}}),K({id:`races`,render(e,t){let{t:n,fmt:r}=t,i=wf(t).filter(e=>e.race===!0);if(i.length===0)return t.empty(e,n(`races.none`));G(e,Kd([n(`col.date`),n(`col.name`),n(`col.distance`),n(`col.time`),n(`col.pace`),n(`col.hr`),n(`form.power`),n(`te.aerobic`)],i.map(e=>[r.day(Tf(e)),e.name??``,r.dist(Ef(e.km),2),r.hms(t.calc.seconds(e.duration)),t.calc.seconds(e.pace)>0?r.pace(t.calc.seconds(e.pace)):``,r.num(Ef(e.avgHR)),Ef(e.avgPowerW)===void 0?r.na:`${r.num(Ef(e.avgPowerW))} W`,r.num(Ef(e.aerobicTE),1)]),[2,3,4,5,6,7]))}}),K({id:`aerobicFitness`,render(e,t){let{t:n,fmt:r,calc:i}=t;if(xf(e,t))return;let a=wf(t).filter(e=>i.paceSeconds(e)&&typeof e.avgHR==`number`).toReversed(),o=t.color(`accent`);t.chart(e,{type:`scatter`,data:{datasets:[{label:n(`af.runs`),data:a.map(e=>({x:e.avgHR,y:r.to.pace(i.paceSeconds(e))})),backgroundColor:a.map((e,t)=>tf(o,.2+.8*(t+1)/a.length)),pointRadius:4}]},options:{interaction:{mode:`nearest`,intersect:!0},scales:{x:{title:{display:!0,text:n(`col.hr`)}},y:{reverse:!0,title:{display:!0,text:n(`af.pace`,{unit:r.unit.pace})},ticks:{callback:e=>r.hms(Number(e))}}},plugins:{tooltip:{callbacks:{label:e=>{let t=a[e.dataIndex];return`${r.day(Tf(t))} ${t.name??``}: ${r.hms(e.parsed.y??0)}${r.unit.pace} · ${r.num(e.parsed.x??0)} bpm`}}}}}});let s=t.weeks.map((e,n)=>wf(t).filter(e=>Df(t,e)===n)),c=s.map(e=>{let t=i.timedDistance(e);return t.km>0?r.to.pace(t.seconds/t.km):null}),l=s.map(e=>i.mean(e.map(e=>i.efficiency(e)).filter(e=>e!==void 0)));t.chart(e,{type:`line`,data:{labels:t.weeks.map(e=>Jd(t,e)),datasets:[{label:n(`af.weekPace`),data:c,borderColor:t.color(`running`),yAxisID:`y`,spanGaps:!0},{label:n(`af.efficiency`),data:l,borderColor:t.color(`good`),yAxisID:`y1`,spanGaps:!0}]},options:{scales:{y:{reverse:!0,ticks:{callback:e=>r.hms(Number(e))},title:{display:!0,text:n(`af.pace`,{unit:r.unit.pace})}},y1:{position:`right`,grid:{drawOnChartArea:!1},title:{display:!0,text:n(`af.effUnit`)}}},plugins:{tooltip:{callbacks:{label:e=>e.datasetIndex===0?`${e.dataset.label}: ${r.hms(e.parsed.y??0)}${r.unit.pace}`:`${e.dataset.label}: ${r.num(e.parsed.y??void 0,2)}`}}}}},180)}}),K({id:`intensityShare`,render(e,t){let{t:n,calc:r,fmt:i}=t;if(xf(e,t))return;let a=r.zonesOf(t.data.zones).floors,o=t.weeks.map(()=>[0,0,0]);for(let e of wf(t)){let n=r.zoneSeconds(e,a),i=Df(t,e);!n||i<0||(o[i][0]+=n.sec[0]+n.sec[1],o[i][1]+=n.sec[3]+n.sec[4],o[i][2]+=n.sec.reduce((e,t)=>e+t,0))}let s=e=>o.map(t=>t[2]>0?t[e]/t[2]*100:null);t.chart(e,{type:`line`,data:{labels:t.weeks.map(e=>Jd(t,e)),datasets:[{label:n(`is.easy`),data:s(0),borderColor:t.color(`good`),spanGaps:!0},{label:n(`is.hard`),data:s(1),borderColor:t.color(`bad`),borderDash:[6,4],spanGaps:!0}]},options:{scales:{y:{min:0,max:100,title:{display:!0,text:`%`}}},plugins:{tooltip:{callbacks:{label:e=>`${e.dataset.label}: ${i.num(e.parsed.y??void 0)}%`}}}}})}}),K({id:`runningForm`,render(e,t){let{t:n,fmt:r,calc:i}=t;if(xf(e,t))return;let a=Cf.filter(([e])=>wf(t).some(t=>Ef(t[e])!==void 0));if(a.length===0)return t.empty(e,r.na);let o=W(`div`,{class:`multiples`});G(e,o);let s=[];for(let[e,c,l,u]of a){let a=W(`div`,{class:`multiple`},W(`h3`,{},`${n(c)} (${l})`));o.append(a),s.push(a);let d=t.weeks.map((n,r)=>i.mean(wf(t).filter(e=>Df(t,e)===r).map(t=>Ef(t[e])).filter(e=>e!==void 0)));t.chart(a,{type:`line`,data:{labels:t.weeks.map(e=>Jd(t,e)),datasets:[{label:n(c),data:d,borderColor:t.color(`running`),spanGaps:!0,pointRadius:2}]},options:{plugins:{legend:{display:!1},tooltip:{callbacks:{label:e=>`${r.num(e.parsed.y??void 0,u)} ${l}`}}},scales:{y:{title:{display:!0,text:l}}}}},140)}G(e,Wd(t,s.slice(2),s.length))}}),K({id:`runWalk`,render(e,t){let{t:n,fmt:r}=t,i=wf(t).filter(e=>e.runWalk&&typeof e.runWalk==`object`);if(i.length===0)return t.empty(e,n(`rw.none`));G(e,Kd([n(`col.date`),n(`rw.runPace`),n(`rw.pace`),n(`rw.walk`)],i.map(e=>{let n=e.runWalk;return[r.day(Tf(e)),kf(t,n.runPace),kf(t,e.pace),String(n.walkTime??r.na)]}),[1,2,3]))}}),K({id:`trainingEffect`,render(e,t){let{t:n,fmt:r}=t;if(xf(e,t))return;let i=wf(t).toReversed();t.chart(e,{type:`line`,data:{labels:i.map(e=>r.day(Tf(e))),datasets:[{label:n(`te.aerobic`),data:i.map(e=>Ef(e.aerobicTE)??null),borderColor:t.color(`accent`),showLine:!1,pointRadius:3},{label:n(`te.anaerobic`),data:i.map(e=>Ef(e.anaerobicTE)??null),borderColor:t.color(`racket`),showLine:!1,pointRadius:3}]},options:{scales:{y:{min:0,max:5}}}},180);let a=[...new Set(i.map(e=>String(e.teLabel??``)).filter(Boolean))],o=[`accent`,`good`,`warn`,`bad`,`strengthTraining`,`swimming`,`hiking`,`generic`];t.chart(e,{type:`bar`,data:{labels:t.weeks.map(e=>Jd(t,e)),datasets:a.map((e,n)=>({label:e.replaceAll(`_`,` `),data:t.weeks.map((n,r)=>wf(t).filter(n=>Df(t,n)===r&&n.teLabel===e).length),backgroundColor:t.color(o[n%o.length])}))},options:{scales:{x:{stacked:!0},y:{stacked:!0,ticks:{precision:0}}}}},160)}}),K({id:`racePredictor`,render(e,t){let{t:n,fmt:r,calc:i}=t,a=Of(t),o=i.predictRaces(Object.fromEntries(Object.entries(a).map(([e,t])=>[e,t.s])));if(!o)return t.empty(e,n(`rp.none`));let s=a[o.from.distance];G(e,Ud(...Object.entries(o.times).map(([e,t])=>q(n(`d.${e}`),r.hms(t)))),J(n(`rp.note`,{d:n(`d.${o.from.distance}`),time:r.hms(o.from.seconds),date:r.day(Tf(s.a))})))}}),K({id:`longRuns`,render(e,t){let{t:n,fmt:r,calc:i}=t;if(xf(e,t))return;let a=t.weeks.map((e,n)=>wf(t).filter(e=>Df(t,e)===n)),o=a.map(e=>{let t=e.reduce((e,t)=>e+(Ef(t.km)??0),0),n=Math.max(0,...e.map(e=>Ef(e.km)??0));return t>0?n/t*100:null}),s=a.map(e=>r.to.elev(e.reduce((e,t)=>e+(Ef(t.ascentM)??0),0)));t.chart(e,{type:`bar`,data:{labels:t.weeks.map(e=>Jd(t,e)),datasets:[{type:`bar`,label:n(`lr.share`),data:o,backgroundColor:o.map(e=>t.color(e!==null&&e>35?`bad`:`running`)),yAxisID:`y`},{type:`line`,label:n(`lr.ascent`),data:s,borderColor:t.color(`hiking`),yAxisID:`y1`}]},options:{scales:{y:{min:0,max:100,title:{display:!0,text:`%`}},y1:{position:`right`,grid:{drawOnChartArea:!1},title:{display:!0,text:r.unit.elev}}}}},200);let c=wf(t).filter(e=>Array.isArray(e.laps)&&(e.race===!0||(Ef(e.km)??0)>15)).map(e=>({a:e,s:i.splitOf(e.laps)})).filter(e=>e.s);G(e,J(n(`lr.note`)),c.length>0&&Kd([n(`col.date`),n(`col.name`),n(`lr.first`),n(`lr.second`),n(`lr.split`),n(`lr.gap`)],c.map(({a:e,s:i})=>[r.day(Tf(e)),e.name??``,r.pace(i.first),r.pace(i.second),W(`span`,{class:i.kind===`positive`?`bad`:i.kind===`negative`?`good`:`same`},n(`lr.${i.kind}`)),kf(t,e.gap)]),[2,3,5]))}});let kf=(e,t)=>e.calc.seconds(t)>0?e.fmt.pace(e.calc.seconds(t)):e.fmt.na,Y=e=>typeof e==`number`&&Number.isFinite(e)?e:void 0,Af=e=>String(e.start).slice(0,10);function jf(e){let t=f(e.duration)/3600;return typeof e.km==`number`&&t>0?e.km/t:void 0}let Mf=(e,t)=>e.weeks.findIndex(e=>Af(t)>=e&&Af(t)<=n(e,6));K({id:`walkDetails`,render(e,t){let{t:n,fmt:r,calc:i}=t;if(xf(e,t))return;let a=t.weeks.map((e,n)=>t.activities.filter(e=>Mf(t,e)===n)),o=a.map(e=>{let t=i.timedDistance(e);return t.km>0?r.to.pace(t.seconds/t.km):null}),s=a.map(e=>i.mean(e.map(e=>e.avgHR).filter(e=>typeof e==`number`)));t.chart(e,{type:`line`,data:{labels:t.weeks.map(e=>Jd(t,e)),datasets:[{label:n(`af.weekPace`),data:o,borderColor:t.color(t.type===`hiking`?`hiking`:`walking`),yAxisID:`y`,spanGaps:!0},{label:n(`col.hr`),data:s,borderColor:t.color(`bad`),yAxisID:`y1`,spanGaps:!0}]},options:{scales:{y:{reverse:!0,ticks:{callback:e=>r.hms(Number(e))},title:{display:!0,text:n(`af.pace`,{unit:r.unit.pace})}},y1:{position:`right`,grid:{drawOnChartArea:!1},title:{display:!0,text:`bpm`}}},plugins:{tooltip:{callbacks:{label:e=>e.datasetIndex===0?`${e.dataset.label}: ${r.hms(e.parsed.y??0)}${r.unit.pace}`:`${e.dataset.label}: ${r.num(e.parsed.y??void 0)} bpm`}}}}},200),G(e,Kd([n(`col.date`),n(`col.name`),n(`wd.steps`),n(`form.cadence`),n(`wd.battery`)],t.activities.map(e=>[r.day(Af(e)),e.name??``,r.num(Y(e.steps)),r.num(Y(e.cadenceSpm)),r.num(Y(e.bodyBatteryDelta))]),[2,3,4]))}}),K({id:`steps`,render(e,t){let{t:n}=t,r=t.data.recovery.slice(-14);if(r.length===0)return t.empty(e,t.fmt.na);let i=e=>r.map(t=>Y(t[e])??null);t.chart(e,{type:`bar`,data:{labels:r.map(e=>t.fmt.day(String(e.date))),datasets:[{type:`bar`,label:n(`wd.steps`),data:i(`steps`),backgroundColor:t.color(`walking`),yAxisID:`y`},{type:`line`,label:n(`wd.goal`),data:i(`stepGoal`),borderColor:t.color(`warn`),pointRadius:0,yAxisID:`y`,spanGaps:!0},{type:`line`,label:n(`wd.floors`),data:i(`floors`),borderColor:t.color(`hiking`),yAxisID:`y1`,spanGaps:!0}]},options:{scales:{y1:{position:`right`,grid:{drawOnChartArea:!1},ticks:{precision:0}}}}}),G(e,J(n(`rec14`)))}}),K({id:`hikeVertical`,render(e,t){let{t:n,fmt:r,calc:i}=t,a=t.activities.filter(e=>i.verticalPerHour(e)!==void 0);if(a.length===0)return t.empty(e);G(e,Kd([n(`col.date`),n(`col.name`),n(`col.distance`),n(`col.ascent`),n(`hv.vam`,{unit:r.unit.elev})],a.map(e=>[r.day(Af(e)),e.name??``,r.dist(Y(e.km)),r.elev(Y(e.ascentM)),Hd(t,r.elev(i.verticalPerHour(e)),`/h`)]),[2,3,4]))}}),K({id:`bikeDetails`,render(e,t){let{t:n,fmt:r,calc:i}=t,a=t.activities;if(a.length===0)return t.empty(e);let o=a.filter(e=>d(e.type??``)),s=a.filter(e=>!d(e.type??``)).reduce((e,t)=>e+m(t),0),c=o.reduce((e,t)=>e+m(t),0);if(G(e,Ud(q(n(`bd.outdoor`),r.hours(s),n(`bd.rides`,{n:a.length-o.length})),q(n(`bd.indoor`),r.hours(c),n(`bd.rides`,{n:o.length})))),a.length>1){let o=t.weeks.map((e,n)=>a.filter(e=>Mf(t,e)===n));t.chart(e,{type:`bar`,data:{labels:t.weeks.map(e=>Jd(t,e)),datasets:[{type:`line`,label:n(`tk.speed`),data:o.map(e=>{let t=i.timedDistance(e);return t.seconds>0?r.to.speed(t.km/(t.seconds/3600)):null}),borderColor:t.color(`cycling`),yAxisID:`y`,spanGaps:!0},{type:`bar`,label:n(`lr.ascent`),data:o.map(e=>r.to.elev(e.reduce((e,t)=>e+(Y(t.ascentM)??0),0))),backgroundColor:`${t.color(`hiking`)}88`,yAxisID:`y1`}]},options:{scales:{y:{title:{display:!0,text:r.unit.speed}},y1:{position:`right`,grid:{drawOnChartArea:!1},title:{display:!0,text:r.unit.elev}}}}},200)}G(e,Kd([n(`col.date`),n(`col.name`),n(`col.distance`),n(`tk.speed`),n(`col.ascent`),n(`bd.where`)],a.map(e=>[r.day(Af(e)),e.name??``,r.dist(Y(e.km)),r.speed(jf(e)),r.elev(Y(e.ascentM)),d(e.type??``)?n(`bd.indoor`):n(`bd.outdoor`)]),[2,3,4]))}}),K({id:`swimDetails`,render(e,t){let{t:n,fmt:r,calc:i}=t;if(t.activities.length===0)return t.empty(e);G(e,Kd([n(`col.date`),n(`col.name`),n(`col.distance`),n(`sw.pace`),`SWOLF`,n(`sw.lengths`),n(`sw.strokes`),n(`sw.pool`)],t.activities.map(e=>[r.day(Af(e)),e.name??``,r.dist(Y(e.km),2),r.swimPace(i.swimPace(e)),r.num(Y(e.swolf)),r.num(Y(e.lengths)),r.num(Y(e.strokes)),Hd(t,r.num(Y(e.poolLengthM)),` m`)]),[2,3,4,5,6,7]))}}),K({id:`racketDetails`,render(e,t){let{t:n,fmt:r,calc:i}=t;if(t.activities.length===0)return t.empty(e);let a=i.zonesOf(t.data.zones).floors,o=i.runLoadPerMinute(Xd(t)),c=!1,l=t.activities.map(e=>{let t=i.zoneSeconds(e,a);c||=!!t?.approximate;let l=o===null?void 0:o*m(e)/60,u=s(e.type??``);return[r.day(Af(e)),e.name??``,u?n(`sport.${u}`):(e.type??``).replaceAll(`_`,` `),r.hours(m(e)),r.num(Y(e.avgHR)),r.num(Y(e.maxHR)),t?`${r.num((t.sec[2]+t.sec[3]+t.sec[4])/60)} min`:r.na,t?`${r.num(i.zoneShare(t.sec,[3,4])??void 0)}%`:r.na,r.num(Y(e.calories)===void 0?void 0:i.perHour(Y(e.calories),e)),r.num(Y(e.aerobicTE),1),`${r.num(Y(e.trainingLoad))} / ${r.num(l)}`]});G(e,Kd([n(`col.date`),n(`col.name`),n(`col.sport`),n(`col.time`),n(`col.hr`),n(`pd.peak`),n(`pd.z3`),n(`pd.z45`),n(`pd.kcal`),n(`te.aerobic`),n(`pd.load`)],l,[3,4,5,6,7,8,9,10]),J(n(`pd.note`)),c&&J(n(`zones.approximate`)))}});let Nf=e=>`mg.${e}`,Pf=[`strengthTraining`,`accent`,`good`,`warn`,`bad`,`swimming`,`hiking`,`racket`,`cycling`,`running`,`generic`];K({id:`setsPerCategory`,render(e,t){if(xf(e,t))return;let n=t.calc.setsByCategory(t.activities,t.weeks),r=Object.keys(n).toSorted((e,t)=>Ff(n[t])-Ff(n[e]));t.chart(e,{type:`bar`,data:{labels:t.weeks.map(e=>Jd(t,e)),datasets:r.map((e,r)=>({label:e,data:n[e],backgroundColor:t.color(Pf[r%Pf.length])}))},options:{scales:{x:{stacked:!0},y:{stacked:!0,ticks:{precision:0},title:{display:!0,text:t.t(`ex.sets`)}}}}},260)}});let Ff=e=>e.reduce((e,t)=>e+t,0);K({id:`muscleBalance`,render(e,t){let{t:n,fmt:r,calc:i}=t;if(xf(e,t))return;let a=i.muscleSets(t.activities,t.weeks),o=i.MUSCLE_GROUPS.filter(e=>a[e]),s=o.map(e=>Ff(a[e])/t.weeks.length),c=i.pushPull(a);G(e,Ud(q(n(`mb.pushPull`),c===null?r.na:`${r.num(c,2)} : 1`))),t.chart(e,{type:`bar`,data:{labels:o.map(e=>n(Nf(e))),datasets:[{label:n(`mb.avg`),data:s,backgroundColor:s.map(e=>t.color(e<10?`warn`:e>20?`bad`:`good`))}]},options:{indexAxis:`y`,plugins:{legend:{display:!1},tooltip:{callbacks:{label:e=>`${r.num(e.parsed.x??void 0,1)} ${n(`mb.perWeek`)}`}}},scales:{x:{title:{display:!0,text:n(`mb.perWeek`)}}}}},Math.max(160,o.length*26)),G(e,J(n(`mb.note`)))}});let If=/* @__PURE__ */ new Map;K({id:`exercises`,render(e,t){let{t:n,calc:r}=t,i=r.exerciseStats(t.activities);if(i.length===0)return t.empty(e);let a=`${t.board}/${t.id}`,o=If.get(a)??{sort:`group`,desc:!1,group:null,search:``};If.set(a,o);let s=r.MUSCLE_GROUPS.filter(e=>i.some(t=>t.muscle===e)),c=W(`div`,{class:`ex-table`}),l=W(`div`,{class:`chips`,role:`group`,"aria-label":n(`ex.groups`)}),u=W(`input`,{type:`search`,class:`search`,placeholder:n(`ex.search`),"aria-label":n(`ex.search`),value:o.search});u.addEventListener(`input`,()=>{o.search=u.value,f()});let d=()=>Ou(()=>l.replaceChildren(W(`button`,{class:`chip`,"aria-pressed":String(o.group===null),onclick:()=>{o.group=null,d(),f()}},n(`type.all`)),...s.map(e=>W(`button`,{class:`chip`,"aria-pressed":String(o.group===e),onclick:()=>{o.group=o.group===e?null:e,d(),f()}},n(Nf(e))))));d();let f=()=>Ou(()=>c.replaceChildren(Lf(t,i,o,f)));f(),G(e,W(`div`,{class:`ex-tools`},l,u),c);let p=i.find(e=>r.slug(e.name)===t.item);p&&G(e,Vf(t,p)),G(e,J(n(`rec.estimate`)))}});function Lf(e,t,n,r){let{t:i,fmt:a,calc:o}=e,s={name:e=>e.name,sessions:e=>e.sessions.length,last:e=>e.sessions.at(-1).date,top:e=>e.sessions.at(-1).top?.kg??e.sessions.at(-1).maxReps,best:e=>e.best1rm??0,change:e=>e.change??-1/0},c=[[`name`,`ex.name`],[`sessions`,`ex.sessions`],[`last`,`ex.last`],[`top`,`ex.top`],[`best`,`ex.best`],[`change`,`ex.change`]],l=e=>{n.desc=n.sort===e?!n.desc:e!==`name`,n.sort=e,r()},u=W(`tr`,{},...c.map(([e,t],r)=>W(`th`,{scope:`col`,class:r>0?`num`:void 0,"aria-sort":n.sort===e?n.desc?`descending`:`ascending`:void 0},W(`button`,{class:`sort`,onclick:()=>l(e)},i(t),n.sort===e?n.desc?` ↓`:` ↑`:``))),W(`th`,{scope:`col`},i(`ex.trend`))),d=W(`tbody`),f=n.search.trim().toLowerCase();for(let r of o.MUSCLE_GROUPS){if(n.group&&n.group!==r)continue;let c=t.filter(e=>e.muscle===r&&(!f||e.name.toLowerCase().includes(f)));if(c.length===0)continue;let l=n.sort===`group`?`name`:n.sort;c.sort((t,r)=>{let i=s[l](t),a=s[l](r),o=typeof i==`string`?i.localeCompare(String(a),e.lang):i-a;return n.desc?-o:o}),d.append(W(`tr`,{class:`group-row`},W(`th`,{colspan:`7`,scope:`rowgroup`},`${i(Nf(r))} · ${i(`ex.groupRow`,{n:c.length,sets:c.reduce((e,t)=>e+t.completedSets,0)})}`)));for(let t of c){let n=t.sessions.at(-1),r=e.item===o.slug(t.name),i=()=>{e.setItem(r?void 0:o.slug(t.name)),r||document.getElementById(`ex-detail-${e.id}`)?.querySelector(`h3`)?.focus()};d.append(W(`tr`,{class:`ex-row${r?` selected`:``}`,"data-exercise":o.slug(t.name),onclick:i},W(`td`,{},W(`button`,{class:`linkish`,"aria-expanded":String(r),"aria-controls":`ex-detail-${e.id}`,onclick:e=>{e.stopPropagation(),i()}},t.name)),W(`td`,{class:`num`},String(t.sessions.length)),W(`td`,{class:`num`},a.day(n.date)),W(`td`,{class:`num`},Rf(e,t,n)),W(`td`,{class:`num`},t.best1rm===void 0?``:a.mass(t.best1rm)),W(`td`,{class:`num`},t.change===null?``:W(`span`,{class:o.changeClass(t.change,!0)},`${t.change>0?`↑`:t.change<0?`↓`:`→`} ${a.pct(t.change)}`)),W(`td`,{},Bf(t))))}}return W(`table`,{class:`data exercises`},W(`thead`,{},u),d)}function Rf(e,t,n){return t.kind===`weight`?n.top?`${e.fmt.mass(n.top.kg)} × ${n.top.reps}`:``:t.kind===`reps`?e.t(`ex.reps`,{n:n.maxReps}):`${n.longest} s`}function zf(e,t){return t.kg?`${e.fmt.num(e.fmt.to.mass(t.kg),1)} × ${t.reps??0}`:e.calc.timed(t)?`${t.seconds} s`:e.t(`ex.reps`,{n:t.reps??0})}function Bf(e){let t=e.sessions.map(t=>e.kind===`weight`?t.top?.kg??0:e.kind===`reps`?t.maxReps:t.longest),n=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);if(n.setAttribute(`viewBox`,`0 0 80 20`),n.setAttribute(`class`,`spark`),n.setAttribute(`aria-hidden`,`true`),t.length>1){let e=Math.min(...t),r=Math.max(...t)-e||1,i=document.createElementNS(`http://www.w3.org/2000/svg`,`polyline`);i.setAttribute(`points`,t.map((n,i)=>`${i/(t.length-1)*78+1},${19-(n-e)/r*18}`).join(` `)),n.append(i)}return n}function Vf(e,t){let{t:n,fmt:r}=e,i=W(`section`,{class:`detail`,id:`ex-detail-${e.id}`,"aria-label":t.name},W(`header`,{class:`detail-head`},W(`h3`,{tabindex:`-1`},t.name),W(`span`,{class:`muted small`},`${n(Nf(t.muscle))}${t.medianRest===void 0?``:` · ${n(`ex.rest`,{v:r.hms(t.medianRest)})}`}`),W(`button`,{class:`tool`,"aria-label":n(`add.close`),onclick:()=>e.setItem(void 0)},`✕`)));if(t.sessions.length>1){let a=t.sessions.map(e=>r.day(e.date)),o=(t,n,r)=>({type:`line`,label:t,data:n,borderColor:e.color(r),yAxisID:`y`,spanGaps:!0}),s=t.kind===`weight`?[o(n(`ex.weight`,{unit:r.unit.mass}),t.sessions.map(e=>e.top?r.to.mass(e.top.kg):null),`strengthTraining`),o(n(`ex.e1rm`,{unit:r.unit.mass}),t.sessions.map(e=>e.e1rm===void 0?null:r.to.mass(e.e1rm)),`accent`),{type:`bar`,label:n(`ex.volume`,{unit:r.unit.mass}),data:t.sessions.map(e=>r.to.mass(e.volume)),backgroundColor:`${e.color(`muted`)}55`,yAxisID:`y1`}]:t.kind===`reps`?[o(n(`ex.maxReps`),t.sessions.map(e=>e.maxReps),`strengthTraining`),{type:`bar`,label:n(`ex.totalReps`),data:t.sessions.map(e=>e.reps),backgroundColor:`${e.color(`muted`)}55`,yAxisID:`y1`}]:[o(n(`ex.longest`),t.sessions.map(e=>e.longest),`strengthTraining`)];e.chart(i,{type:`bar`,data:{labels:a,datasets:s},options:{scales:{y:{position:`left`},y1:{position:`right`,grid:{drawOnChartArea:!1},display:s.length>2||t.kind===`reps`}}}},200)}else G(i,J(n(`one.session`)));let a=W(`ol`,{class:`ex-sessions`,reversed:!0});for(let i of t.sessions.toReversed()){let o=i.sets.map(i=>{let a=e.calc.completed(i),o=zf(e,i),s=i.kg&&i.reps&&t.best1rm?` (${r.num(i.kg/t.best1rm*100)}%)`:``,c=i.restSec?` · ${n(`ex.restAfter`,{v:r.hms(i.restSec)})}`:``;return W(`li`,{class:a?void 0:`not-done`},`${o}${s}${c}${a?``:` · ${n(`ex.notDone`)}`}`)});a.append(W(`li`,{},W(`strong`,{},`${r.day(i.date)} · ${i.workout}`),W(`ul`,{class:`sets`},...o)))}return G(i,a),i}K({id:`strengthSessions`,render(e,t){let{t:n,fmt:r,calc:i}=t,a=t.activities.filter(e=>i.exercisesOf(e).length>0);if(a.length===0)return t.empty(e);let o=[];for(let e of a){let a=i.exercisesOf(e);o.push(W(`details`,{class:`session`},W(`summary`,{},`${r.day(String(e.start).slice(0,10))} · ${e.name??``} · ${n(`ss.count`,{n:a.length})}`),W(`ol`,{class:`ex-sessions`},...a.map(e=>W(`li`,{},W(`strong`,{},e.exercise),W(`span`,{class:`muted small`},` · ${n(Nf(i.exerciseGroup(e)))}`),W(`div`,{class:`small`},e.sets.map(e=>zf(t,e)).join(`, `)))))))}G(e,...o,Wd(t,o.slice(6),o.length))}});let Hf=window.GARMIN??{data:null,layout:null,widgets:[]},Uf=e=>new DOMParser().parseFromString(e,`text/html`).documentElement.textContent??``;Hf.data?.notes&&(Hf.data.notes=Hf.data.notes.map(Uf));let Wf=window.GARMIN_SETTINGS??{},Gf=`garmin-layout:${location.pathname}`,Kf=[`running`,`strengthTraining`,`walking`,`cycling`,`racket`],qf=Mu.get(`garmin-lang`)??Wf.language??`auto`,Jf=`en`,X=Sd(`en`),Yf=Od(`en`),Xf=$u(Hf.layout),Zf=ed(Xf,Mp()),Qf=td(Xf,Mp()),Z,$f=!1,ep=null,tp=!1,np=!1,rp=[],Q=[];function ip(){window.Chart=U,yd(Hf.languages),yd(Hf.i18n),Wf.languages&&!Wf.languages.includes(`en`)&&delete vd.en,Fd(Wf.exclude??[]);for(let e of Array.isArray(Hf.widgets)?Hf.widgets:[]){let t=Hp(e);t&&Nd(t)}let e=Hf.data?.locale??``;ap(Mu.get(`garmin-lang`)??Wf.language??[e,e.slice(0,2)].find(e=>e in vd)??`auto`);let t=Hf.data;if(t){let e=new Set(t.activities.map(c)),n=Wf.sports;rp=[`all`,...Wf.exclude?.includes(`recovery`)?[]:[`recovery`],...l(e).filter(t=>n?n.includes(t):Kf.includes(t)||e.has(t))],Q=_(t.start,t.end)}Z=zd(location.hash,rp,Q),window.addEventListener(`hashchange`,()=>{Z=zd(location.hash,rp,Q),$()}),matchMedia(`(prefers-color-scheme: light)`).addEventListener(`change`,()=>$()),document.addEventListener(`click`,e=>{let t=document.querySelector(`.account[open]`);t&&!t.contains(e.target)&&(t.open=!1)}),document.addEventListener(`keydown`,e=>{if(e.key!==`Escape`)return;let t=document.querySelector(`.account[open]`);t?(t.open=!1,t.querySelector(`summary`).focus()):$f&&!document.querySelector(`dialog[open]`)&&(e.preventDefault(),yp())}),window.addEventListener(`beforeunload`,e=>{gp()&&e.preventDefault()}),document.addEventListener(`focusin`,e=>{let t=document.querySelector(`.account[open]`);t&&!t.contains(e.target)&&(t.open=!1)}),ku(``),$()}function ap(e){qf=e,Jf=xd(e,navigator.languages??[navigator.language]),Jf in vd||(Jf=Object.keys(vd)[0]),X=Sd(Jf),Yf=Od(Jf,Hf.data?.units),document.documentElement.lang=Jf}function $(){let e=document.getElementById(`app`);if(Hu(),Lu(),document.title=cp(),!Hf.data){e.replaceChildren(W(`main`,{class:`page`},W(`h1`,{},cp()),W(`p`,{},X(`noData`)),sp()));return}history.replaceState(null,``,Bd(Z)),tp=document.querySelector(`.account[open]`)!==null;let t=Hf.data;Ou(()=>e.replaceChildren(W(`div`,{class:`page`},W(`a`,{class:`skip`,href:`#board`,onclick:e=>{e.preventDefault(),document.getElementById(`board`)?.focus()}},X(`skip`)),lp(t),$f&&Lp(),Sp(t),sp(t))))}let op=`https://github.com/indaco/garmin-personal-mcp`;function sp(e){let t=Number(e?.sync?.failedDays)||0;return W(`footer`,{class:`foot`},e&&W(`div`,{class:`source`},e.generated&&W(`p`,{},X(`footer.updated`,{date:Yf.longDay(e.generated)})),t>0&&W(`p`,{class:`gap`},X(`footer.failed`,{n:t}))),W(`p`,{class:`made`},W(`a`,{class:`brand`,href:op},hd(),`garmin-personal-mcp`),`·`,W(`a`,{href:`${op}/blob/main/LICENSE`,rel:`noopener`},X(`footer.license`))))}let cp=()=>Wf.title??X(`title`);function lp(e){let t=(/* @__PURE__ */ new Date(`${e.end}T00:00:00Z`)).getUTCDay()!==0;return W(`header`,{class:`top`},W(`div`,{class:`title-row`},W(`div`,{class:`title`},hd(),W(`div`,{},W(`h1`,{},cp()),W(`h2`,{class:`headline`},Wf.headline??X(`headline`)),W(`p`,{class:`muted`},X(`period`,{from:Yf.longDay(e.start),to:Yf.longDay(e.end)})))),W(`div`,{class:`menus`},up())),bp(t),xp(e))}function up(){return W(`details`,{class:`account`,open:tp},W(`summary`,{"aria-label":X(`menu.settings`),title:X(`menu.settings`)},md(`settings`)),W(`div`,{class:`account-panel`},!$f&&mp(),!$f&&W(`hr`,{class:`menu-sep`}),Object.keys(vd).length>1&&dp(),fp().length>1&&pp()))}function dp(){let e=W(`select`,{id:`lang`,onchange:e=>{let t=e.target.value;Mu.set(`garmin-lang`,t),ap(t),$()}},W(`option`,{value:`auto`,selected:qf===`auto`},X(`lang.auto`)),...Object.entries(vd).map(([e,t])=>W(`option`,{value:e,lang:e,selected:qf===e},t)));return W(`label`,{class:`menu`},W(`span`,{},X(`menu.language`)),e)}let fp=()=>Au.filter(e=>!Wf.themes||Wf.themes.includes(e.id));function pp(){let e=document.documentElement.dataset.theme??`midnight`,t=fp(),n=W(`select`,{id:`theme`,onchange:e=>{let t=e.target.value;document.documentElement.dataset.theme=t,Mu.set(`garmin-theme`,t),$()}},...[`auto`,`dark`,`light`,`accessible`].filter(e=>t.some(t=>t.group===e)).map(n=>W(`optgroup`,{label:X(`themeGroup.${n}`)},...t.filter(e=>e.group===n).map(t=>W(`option`,{value:t.id,selected:t.id===e},X(ju(t.id)))))));return W(`label`,{class:`menu`},W(`span`,{},X(`menu.theme`)),n)}function mp(){return W(`button`,{class:`btn edit-start`,onclick:hp},X(`edit.start`))}function hp(){document.querySelector(`.account[open]`)?.removeAttribute(`open`),$f=!0,ep=Zf,$(),document.querySelector(`.edit-bar .btn`)?.focus()}function gp(){return ep!==null&&JSON.stringify(ep)!==JSON.stringify(Zf)}function _p(){$f=!1,ep=null,$(),document.querySelector(`.account summary`)?.focus()}function vp(){let e=gp();e&&jp(ep),_p(),ku(X(e?`said.saved`:`said.unchanged`))}function yp(){if(!gp())return _p();let e=W(`button`,{class:`btn`},X(`discard.keep`)),t=W(`button`,{class:`btn primary`},X(`discard.confirm`)),n=Rp(X(`discard.title`),W(`p`,{},X(`discard.text`)),W(`div`,{class:`dialog-actions`},e,t));e.addEventListener(`click`,()=>n.close()),t.addEventListener(`click`,()=>{n.close(),_p(),ku(X(`said.discarded`))}),e.focus()}function bp(e){let t=(e,t)=>{Z={...Z,from:e,to:t},$()},n=[4,8,12].filter(e=>e<Q.length),r=e=>Z.to===Q.at(-1)&&Z.from===Q[Q.length-e],i=(t,n)=>`${Yf.day(t)}${e&&n===Q.length-1?` *`:``}`,a=(e,t,n)=>W(`select`,{id:e,onchange:e=>n(e.target.value)},...Q.map((e,n)=>W(`option`,{value:e,selected:e===t},i(e,n)))),o=n.find(r),s=o===void 0?Z.from===Q[0]&&Z.to===Q.at(-1)?X(`window.all`):`${Yf.day(Z.from)} – ${Yf.day(Z.to)}`:X(`window.last`,{n:o});return W(`div`,{class:`window`},W(`button`,{class:`chip window-toggle`,"aria-expanded":String(np),"aria-controls":`window-bar`,onclick:()=>{np=!np,$()}},`${X(`window.label`)}: ${s}`,W(`span`,{"aria-hidden":`true`},` ▾`)),W(`div`,{id:`window-bar`,class:`window-bar${np?` open`:``}`,role:`group`,"aria-label":X(`window.label`)},...n.map(e=>W(`button`,{class:`chip`,"aria-pressed":String(r(e)),onclick:()=>t(Q[Q.length-e],Q.at(-1))},X(`window.last`,{n:e}))),W(`button`,{class:`chip`,"aria-pressed":String(Z.from===Q[0]&&Z.to===Q.at(-1)),onclick:()=>t(Q[0],Q.at(-1))},X(`window.all`)),W(`label`,{class:`menu`},W(`span`,{},X(`window.from`)),a(`from`,Z.from,e=>t(e,e>Z.to?e:Z.to))),W(`label`,{class:`menu`},W(`span`,{},X(`window.to`)),a(`to`,Z.to,e=>t(e<Z.from?e:Z.from,e))),e&&W(`span`,{class:`muted small`},X(`inProgress`))))}function xp(e){let t=v(e.activities,Z.from,Z.to),n=e=>e===`all`?t.length:t.filter(t=>c(t)===e).length,r=e=>{Z={tab:e,from:Z.from,to:Z.to},$(),document.querySelector(`[role=tab][data-tab="${e}"]`)?.focus()},i=W(`nav`,{class:`tabs`,role:`tablist`,"aria-label":X(`tabs.label`),onkeydown:e=>{let t=rp.indexOf(Z.tab);if(e.key===`ArrowRight`)r(rp[(t+1)%rp.length]);else if(e.key===`ArrowLeft`)r(rp[(t-1+rp.length)%rp.length]);else if(e.key===`Home`)r(rp[0]);else if(e.key===`End`)r(rp.at(-1));else return;e.preventDefault()}},...rp.map(e=>W(`button`,{role:`tab`,id:`tab-${e}`,"aria-controls":`board`,"data-tab":e,"aria-selected":String(e===Z.tab),tabindex:e===Z.tab?`0`:`-1`,class:`tab tab-${e}`,onclick:()=>r(e)},md(e),W(`span`,{},Vd(X,e)),e!==`recovery`&&W(`span`,{class:`count`},n(e))))),a=()=>i.classList.toggle(`more`,i.scrollLeft+i.clientWidth<i.scrollWidth-4);return i.addEventListener(`scroll`,a),new ResizeObserver(a).observe(i),i}function Sp(e){let t=Uu(ep??Zf,Z.tab,Ad),n=W(`div`,{class:`grid${$f?` editing`:``}`});for(let r of t){let t=Id(r.widget);!r.hidden&&(t||$f&&!Pd.has(r.widget))&&n.append(Ep(e,r,t))}n.childElementCount===0&&n.append(W(`div`,{class:`board-empty`},W(`p`,{},X($f?`board.emptyEdit`:`board.empty`)),!$f&&W(`button`,{class:`btn primary`,onclick:hp},X(`edit.start`))));let r=Z.tab===`recovery`&&W(`p`,{class:`muted board-note`},X(`rec.board`));return W(`main`,{id:`board`,role:`tabpanel`,"aria-labelledby":`tab-${Z.tab}`,tabindex:`-1`},Qf&&!$f&&Cp(Qf),r,n)}function Cp(e){return W(`div`,{class:`banner`,role:`region`,"aria-label":X(`stale.label`)},W(`p`,{},X(`stale.text`)),W(`button`,{class:`btn`,onclick:()=>{jp(e),ku(X(`stale.kept`))}},X(`stale.keep`)),W(`button`,{class:`btn`,onclick:()=>{Mu.remove(Gf),Qf=null,$(),ku(X(`stale.used`))}},X(`stale.new`)))}function wp(){return Z.tab===`recovery`?`all`:Z.tab}function Tp(e,t){if(!t)return X(`widget.unknown`,{id:e.widget});let n=e.type&&e.type!==wp()?` · ${Vd(X,e.type)}`:``;return t.title(X)+n}function Ep(e,t,n){let r=Tp(t,n),i=`h-${t.id}`,a=W(`div`,{class:`tile-body`}),o=W(`section`,{class:`tile span-${Math.max(t.span,n?.minSpan??1)}`,"data-id":t.id,"data-widget":t.widget,"aria-labelledby":i},W(`header`,{class:`tile-head`},W(`h2`,{id:i},r),$f&&Np(t,r)),a,$f&&Ip(t,r,n));if(n)try{n.render(a,Dp(e,t))}catch(e){a.replaceChildren(W(`p`,{class:`error`},X(`widget.failed`,{message:e.message}))),console.warn(`widget ${t.widget}:`,e)}return o}function Dp(e,t){let n=t.type??wp(),i=v(e.activities,Z.from,Z.to),a=e=>n===`all`?e:e.filter(e=>c(e)===n);return{data:e,id:t.id,board:Z.tab,type:n,from:Z.from,to:Z.to,weeks:Q.filter(e=>e>=Z.from&&e<=Z.to),activities:a(i),ofType:a,allActivities:i,lang:Jf,t:X,fmt:Yf,calc:{...r,...y,...de,...be,...Fe},chart:Vu,color:e=>Nu(e)||Nu(`generic`),empty:(e,t)=>e.replaceChildren(W(`p`,{class:`muted empty`},t??X(`empty.window`))),item:Z.item,setItem:e=>{Z={...Z,item:e},$()},refresh:$}}function Op(){return Uu(ep??Zf,Z.tab,Ad)}function kp(e){Ap(Wu(ep??Zf,Z.tab,e))}function Ap(e){ep=e,$()}function jp(e){Zf=e,Qf=null,Mu.set(Gf,JSON.stringify({baseRev:Xf.rev,layout:Zf})),$()}function Mp(){try{let e=JSON.parse(Mu.get(Gf)??`null`);return e&&typeof e==`object`&&`baseRev`in e?e:null}catch{return null}}function Np(e,t){let n=W(`button`,{class:`tool grip`,"aria-label":X(`edit.move`,{title:t}),title:X(`edit.moveHint`),"aria-pressed":`false`},`⠿`);n.addEventListener(`pointerdown`,r=>ld(r,n,n=>Pp(e.id,t,n))),n.addEventListener(`keydown`,r=>ud(r,n,{picked:(e,n)=>ku(X(`said.picked`,{title:t,n:e,count:n})),moved:(e,t)=>ku(X(`said.position`,{n:e,count:t})),drop:n=>Pp(e.id,t,n),cancel:()=>{$(),ku(X(`said.cancelled`,{title:t}))}}));let r=X(`edit.hide`,{title:t});return W(`div`,{class:`tools`},n,W(`button`,{class:`tool`,"aria-label":r,title:r,onclick:()=>{kp(Xu(Op(),e.id)),ku(X(`said.hidden`,{title:t}))}},md(`eye`)))}function Pp(e,t,n){let r=Ku(Op(),e,n);kp(r);let i=r.filter(e=>!e.hidden),a=i.findIndex(t=>t.id===e)+1;ku(X(`said.moved`,{title:t,n:a,count:i.length}))}let Fp=()=>matchMedia(`(max-width: 700px)`).matches?1:matchMedia(`(max-width: 1100px)`).matches?2:3;function Ip(e,t,n){let r=n?.minSpan??1,i=Fp(),a=Math.min(e.span,i),o=(n,r)=>{let i=Ju(n,e.span,r);i!==e.span&&(kp(Yu(Op(),e.id,i)),ku(X(`said.width`,{title:t,n,cols:r})))},s=W(`div`,{class:`resize`,role:`slider`,tabindex:`0`,"aria-label":X(`edit.width`,{title:t}),"aria-valuemin":Math.min(r,i),"aria-valuemax":i,"aria-valuenow":a,"aria-valuetext":X(`edit.widthValue`,{n:a,cols:i}),title:X(`edit.width`,{title:t}),onkeydown:e=>{let t={ArrowRight:a+1,ArrowUp:a+1,ArrowLeft:a-1,ArrowDown:a-1,Home:r,End:i};e.key in t&&(e.preventDefault(),o(Math.max(Math.min(r,i),Math.min(i,t[e.key])),i))}});return s.addEventListener(`pointerdown`,e=>fd(e,s,r,o)),s}function Lp(){let e=Op().filter(e=>e.hidden).length;return W(`div`,{class:`edit-bar`,role:`toolbar`,"aria-label":X(`edit.bar`)},W(`strong`,{},X(`edit.editing`,{board:Vd(X,Z.tab)})),gp()&&W(`span`,{class:`unsaved muted small`},X(`edit.unsaved`)),W(`span`,{class:`spacer`}),W(`button`,{class:`btn`,onclick:Bp},e>0?X(`edit.addHidden`,{n:e}):X(`edit.add`)),W(`button`,{class:`btn`,onclick:()=>Ap(Gu(ep??Zf,Z.tab,Ad))},X(`edit.reset`)),W(`button`,{class:`btn`,onclick:Vp},X(`edit.copy`)),W(`button`,{class:`btn`,onclick:yp},X(`edit.discard`)),W(`button`,{class:`btn primary`,onclick:vp},X(`edit.done`)))}function Rp(e,...t){let n=W(`dialog`,{class:`dialog`,"aria-label":e,onclose:()=>n.remove()},W(`header`,{class:`dialog-head`},W(`h2`,{},e),W(`button`,{class:`tool`,"aria-label":X(`add.close`),onclick:()=>n.close()},`✕`)),...t);return document.body.append(n),n.showModal(),n}let zp=e=>e!==`all`&&e!==`recovery`&&!i.includes(e);function Bp(){let e=Op(),t=wp(),n=W(`ul`,{class:`catalogue`}),r=Rp(X(`add.title`),n),i=(n,i)=>{r.close(),kp(Zu(e,n.id,{type:i===t?void 0:i,span:n.span??1})),ku(X(`said.added`,{title:n.title(X)}))},a=Ld().filter(t=>t.types!==void 0||!e.some(e=>e.widget===t.id)).toSorted((e,t)=>e.title(X).localeCompare(t.title(X),Jf));for(let e of a){let r=e.types?.flatMap(e=>e===`generic`?[...rp.filter(zp),e]:[e]).filter(e=>e===`all`||rp.includes(e)),a=r&&r.length>0?W(`select`,{"aria-label":X(`add.type`)},...r.map(e=>W(`option`,{value:e,selected:e===t},Vd(X,e)))):void 0;n.append(W(`li`,{},W(`span`,{},e.title(X)),a,W(`button`,{class:`btn`,"aria-label":X(`add.addOne`,{title:e.title(X)}),onclick:()=>i(e,a?.value)},X(`add.add`))))}let o=e.filter(e=>e.hidden);if(o.length>0){n.append(W(`li`,{class:`group`},X(`add.hiddenGroup`)));for(let t of o){let i=Tp(t,Id(t.widget));n.append(W(`li`,{},W(`span`,{},i),W(`button`,{class:`btn`,onclick:()=>{r.close(),kp(Xu(e,t.id)),ku(X(`said.shown`,{title:i}))}},X(`edit.show`,{title:i})),W(`button`,{class:`btn`,onclick:()=>{r.close(),kp(Qu(e,t.id)),ku(X(`said.removed`,{title:i}))}},X(`edit.remove`,{title:i}))))}}n.childElementCount===0&&n.append(W(`li`,{},X(`add.none`)))}function Vp(){let e=ep??Zf,t=JSON.stringify({base:e.base,boards:e.boards}),n=W(`textarea`,{class:`layout-text`,readonly:!0,rows:6},t),r=W(`button`,{class:`btn`},X(`copy.copy`));r.addEventListener(`click`,async()=>{n.select();try{await navigator.clipboard.writeText(t)}catch{document.execCommand(`copy`)}r.textContent=X(`copy.copied`)}),Rp(X(`copy.title`),W(`p`,{},X(`copy.hint`)),n,W(`div`,{class:`dialog-actions`},r))}function Hp(e){if(!e||typeof e!=`object`)return;let{id:t,title:n,code:r,span:i,types:a}=e;if(typeof t!=`string`||typeof r!=`string`)return;let o;try{o=Function(`el`,`ctx`,r)}catch(e){o=()=>{throw Error(e.message,{cause:e})}}return{id:t,title:()=>typeof n==`string`?n:t,span:Math.min(3,Math.max(1,Math.round(Number(i)||1))),types:Array.isArray(a)?a:void 0,render:o}}ip()})();</script>
|
|
79
79
|
</body>
|
|
80
80
|
</html>
|