@nyaruka/temba-components 0.130.4 → 0.131.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/CHANGELOG.md +10 -13
- package/demo/sortable-rules-demo.html +155 -0
- package/dist/temba-components.js +150 -159
- package/dist/temba-components.js.map +1 -1
- package/out-tsc/src/events.js.map +1 -1
- package/out-tsc/src/flow/CanvasNode.js +13 -7
- package/out-tsc/src/flow/CanvasNode.js.map +1 -1
- package/out-tsc/src/flow/actions/send_msg.js +1 -0
- package/out-tsc/src/flow/actions/send_msg.js.map +1 -1
- package/out-tsc/src/flow/nodes/split_by_groups.js +149 -1
- package/out-tsc/src/flow/nodes/split_by_groups.js.map +1 -1
- package/out-tsc/src/flow/nodes/split_by_llm_categorize.js +1 -0
- package/out-tsc/src/flow/nodes/split_by_llm_categorize.js.map +1 -1
- package/out-tsc/src/flow/nodes/split_by_random.js +1 -0
- package/out-tsc/src/flow/nodes/split_by_random.js.map +1 -1
- package/out-tsc/src/flow/nodes/wait_for_response.js +332 -137
- package/out-tsc/src/flow/nodes/wait_for_response.js.map +1 -1
- package/out-tsc/src/form/ArrayEditor.js +301 -30
- package/out-tsc/src/form/ArrayEditor.js.map +1 -1
- package/out-tsc/src/form/select/Omnibox.js +4 -0
- package/out-tsc/src/form/select/Omnibox.js.map +1 -1
- package/out-tsc/src/form/select/Select.js +21 -25
- package/out-tsc/src/form/select/Select.js.map +1 -1
- package/out-tsc/src/list/SortableList.js +214 -140
- package/out-tsc/src/list/SortableList.js.map +1 -1
- package/out-tsc/src/live/ContactChat.js +9 -5
- package/out-tsc/src/live/ContactChat.js.map +1 -1
- package/out-tsc/test/nodes/split_by_groups.test.js +130 -0
- package/out-tsc/test/nodes/split_by_groups.test.js.map +1 -0
- package/out-tsc/test/nodes/wait_for_response.test.js +522 -8
- package/out-tsc/test/nodes/wait_for_response.test.js.map +1 -1
- package/out-tsc/test/temba-field-config.test.js +56 -0
- package/out-tsc/test/temba-field-config.test.js.map +1 -1
- package/package.json +1 -1
- package/screenshots/truth/actions/add_contact_groups/render/descriptive-group-names.png +0 -0
- package/screenshots/truth/actions/add_contact_groups/render/long-group-names.png +0 -0
- package/screenshots/truth/actions/add_contact_groups/render/many-groups.png +0 -0
- package/screenshots/truth/actions/add_contact_groups/render/multiple-groups.png +0 -0
- package/screenshots/truth/actions/add_contact_groups/render/single-group.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/render/cleanup-groups.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/render/long-descriptive-group-names.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/render/many-groups.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/render/multiple-groups.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/render/remove-from-all-groups.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/render/single-group.png +0 -0
- package/screenshots/truth/actions/send_email/render/complex-business-email.png +0 -0
- package/screenshots/truth/actions/send_email/render/empty-body.png +0 -0
- package/screenshots/truth/actions/send_email/render/empty-subject.png +0 -0
- package/screenshots/truth/actions/send_email/render/multiline-body.png +0 -0
- package/screenshots/truth/actions/send_email/render/multiple-recipients.png +0 -0
- package/screenshots/truth/actions/send_email/render/simple-email.png +0 -0
- package/screenshots/truth/actions/send_email/render/with-expressions.png +0 -0
- package/screenshots/truth/actions/send_msg/render/long-quick-replies.png +0 -0
- package/screenshots/truth/actions/send_msg/render/multiline-text-with-replies.png +0 -0
- package/screenshots/truth/actions/send_msg/render/simple-text.png +0 -0
- package/screenshots/truth/actions/send_msg/render/text-with-linebreaks.png +0 -0
- package/screenshots/truth/actions/send_msg/render/text-with-many-quick-replies.png +0 -0
- package/screenshots/truth/actions/send_msg/render/text-with-quick-replies.png +0 -0
- package/screenshots/truth/actions/send_msg/render/text-without-quick-replies.png +0 -0
- package/screenshots/truth/editor/wait.png +0 -0
- package/screenshots/truth/field-renderer/select-with-label.png +0 -0
- package/screenshots/truth/list/fields-dragging.png +0 -0
- package/screenshots/truth/list/sortable-dragging.png +0 -0
- package/screenshots/truth/nodes/split_by_llm/editor/information-extraction.png +0 -0
- package/screenshots/truth/nodes/split_by_llm/editor/sentiment-analysis.png +0 -0
- package/screenshots/truth/nodes/split_by_llm/editor/summarization.png +0 -0
- package/screenshots/truth/nodes/split_by_llm/editor/translation-task.png +0 -0
- package/screenshots/truth/nodes/split_by_llm_categorize/editor/basic-categorization.png +0 -0
- package/screenshots/truth/nodes/split_by_llm_categorize/editor/custom-input-and-result-name.png +0 -0
- package/screenshots/truth/nodes/split_by_llm_categorize/editor/feedback-categorization.png +0 -0
- package/screenshots/truth/nodes/split_by_llm_categorize/editor/many-categories.png +0 -0
- package/screenshots/truth/nodes/split_by_llm_categorize/editor/minimal-categories.png +0 -0
- package/screenshots/truth/nodes/split_by_random/editor/ab-test-multiple-variants.png +0 -0
- package/screenshots/truth/nodes/split_by_random/editor/sampling-split.png +0 -0
- package/screenshots/truth/nodes/split_by_random/editor/three-way-split.png +0 -0
- package/screenshots/truth/nodes/split_by_random/editor/two-bucket-split.png +0 -0
- package/screenshots/truth/nodes/wait_for_response/editor/basic-wait.png +0 -0
- package/screenshots/truth/nodes/wait_for_response/editor/custom-result-name.png +0 -0
- package/screenshots/truth/nodes/wait_for_response/editor/no-timeout.png +0 -0
- package/screenshots/truth/nodes/wait_for_response/editor/short-timeout.png +0 -0
- package/screenshots/truth/nodes/wait_for_response/render/basic-wait.png +0 -0
- package/screenshots/truth/nodes/wait_for_response/render/custom-result-name.png +0 -0
- package/screenshots/truth/nodes/wait_for_response/render/no-timeout.png +0 -0
- package/screenshots/truth/nodes/wait_for_response/render/short-timeout.png +0 -0
- package/screenshots/truth/select/search-enabled.png +0 -0
- package/screenshots/truth/select/search-selected-focus.png +0 -0
- package/screenshots/truth/select/search-selected.png +0 -0
- package/screenshots/truth/templates/default.png +0 -0
- package/screenshots/truth/templates/unapproved.png +0 -0
- package/src/events.ts +6 -6
- package/src/flow/CanvasNode.ts +15 -13
- package/src/flow/actions/send_msg.ts +1 -0
- package/src/flow/nodes/split_by_groups.ts +190 -1
- package/src/flow/nodes/split_by_llm_categorize.ts +1 -0
- package/src/flow/nodes/split_by_random.ts +1 -0
- package/src/flow/nodes/wait_for_response.ts +424 -145
- package/src/form/ArrayEditor.ts +372 -30
- package/src/form/select/Omnibox.ts +3 -0
- package/src/form/select/Select.ts +24 -25
- package/src/list/SortableList.ts +250 -149
- package/src/live/ContactChat.ts +11 -5
- package/test/nodes/split_by_groups.test.ts +165 -0
- package/test/nodes/wait_for_response.test.ts +608 -8
- package/test/temba-field-config.test.ts +69 -0
package/dist/temba-components.js
CHANGED
|
@@ -842,6 +842,8 @@ let rl=ja,al=!1;const ll=["es","fr","pt"],cl="data:image/png;base64,iVBORw0KGgoA
|
|
|
842
842
|
.container {
|
|
843
843
|
user-select: none;
|
|
844
844
|
position: relative;
|
|
845
|
+
display: grid;
|
|
846
|
+
grid-template-columns: 1fr;
|
|
845
847
|
}
|
|
846
848
|
|
|
847
849
|
.container.horizontal {
|
|
@@ -854,58 +856,6 @@ let rl=ja,al=!1;const ll=["es","fr","pt"],cl="data:image/png;base64,iVBORw0KGgoA
|
|
|
854
856
|
background: var(--color-selection);
|
|
855
857
|
}
|
|
856
858
|
|
|
857
|
-
.dragged-item {
|
|
858
|
-
opacity: 0;
|
|
859
|
-
pointer-events: none;
|
|
860
|
-
}
|
|
861
|
-
|
|
862
|
-
.sortable {
|
|
863
|
-
transition: all 300ms ease-in-out;
|
|
864
|
-
display: flex;
|
|
865
|
-
padding: 0.4em 0;
|
|
866
|
-
}
|
|
867
|
-
|
|
868
|
-
.container.horizontal .sortable {
|
|
869
|
-
padding: 0;
|
|
870
|
-
margin-right: 0.25em;
|
|
871
|
-
margin-bottom: 0.25em;
|
|
872
|
-
}
|
|
873
|
-
|
|
874
|
-
.drop-indicator {
|
|
875
|
-
position: absolute;
|
|
876
|
-
background: var(--color-primary-dark, #1c7cd6);
|
|
877
|
-
z-index: 1000;
|
|
878
|
-
pointer-events: none;
|
|
879
|
-
}
|
|
880
|
-
|
|
881
|
-
.container.horizontal .drop-indicator {
|
|
882
|
-
width: 2px;
|
|
883
|
-
margin-top: -5px;
|
|
884
|
-
padding-bottom: 10px;
|
|
885
|
-
}
|
|
886
|
-
|
|
887
|
-
.container:not(.horizontal) .drop-indicator {
|
|
888
|
-
height: 2px;
|
|
889
|
-
left: 0;
|
|
890
|
-
}
|
|
891
|
-
|
|
892
|
-
.sortable:hover temba-icon {
|
|
893
|
-
opacity: 1;
|
|
894
|
-
cursor: move;
|
|
895
|
-
}
|
|
896
|
-
|
|
897
|
-
.ghost {
|
|
898
|
-
position: absolute;
|
|
899
|
-
opacity: 0.7;
|
|
900
|
-
transition: none;
|
|
901
|
-
background: var(--color-background, white);
|
|
902
|
-
border: 1px solid var(--color-primary, #1c7cd6);
|
|
903
|
-
border-radius: 4px;
|
|
904
|
-
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
|
|
905
|
-
pointer-events: none;
|
|
906
|
-
z-index: 999;
|
|
907
|
-
}
|
|
908
|
-
|
|
909
859
|
.slot {
|
|
910
860
|
flex-grow: 1;
|
|
911
861
|
}
|
|
@@ -919,11 +869,14 @@ let rl=ja,al=!1;const ll=["es","fr","pt"],cl="data:image/png;base64,iVBORw0KGgoA
|
|
|
919
869
|
padding: 0.2em 0.5em;
|
|
920
870
|
transition: all 300ms ease-in-out;
|
|
921
871
|
}
|
|
922
|
-
`}constructor(){super(),this.horizontal=!1,this.ghostElement=null,this.downEle=null,this.xOffset=0,this.yOffset=0,this.yDown=0,this.xDown=0,this.draggingIdx=-1,this.draggingEle=null,this.
|
|
923
|
-
<div
|
|
872
|
+
`}constructor(){super(),this.horizontal=!1,this.gap="0em",this.ghostElement=null,this.downEle=null,this.originalElementRect=null,this.originalDragIndex=-1,this.xOffset=0,this.yOffset=0,this.yDown=0,this.xDown=0,this.draggingIdx=-1,this.draggingEle=null,this.dropPlaceholder=null,this.pendingDropIndex=-1,this.pendingTargetElement=null,this.clickBlocker=null,this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this)}getSortableElements(){return this.shadowRoot.querySelector("slot").assignedElements().filter((t=>t.classList.contains("sortable")&&!t.classList.contains("drop-placeholder")))}cloneElementWithState(t){const e=t.cloneNode(!0);return((t,e)=>{try{const i=t.querySelectorAll("input, textarea, select"),n=e.querySelectorAll("input, textarea, select");i.forEach(((t,e)=>{const i=n[e];if(i)if(t instanceof HTMLInputElement){const e=t,n=i;"checkbox"===e.type||"radio"===e.type?n.checked=e.checked:n.value=e.value}else t instanceof HTMLTextAreaElement?i.value=t.value:t instanceof HTMLSelectElement&&(i.selectedIndex=t.selectedIndex)}));const o=Array.from(t.querySelectorAll("*")),s=Array.from(e.querySelectorAll("*"));o.forEach(((t,e)=>{const i=s[e];if(i&&t)if(t.tagName&&t.tagName.toLowerCase().startsWith("temba-"))try{["value","values","selectedValue","checked","selected","textContent"].forEach((e=>{e in t&&void 0!==t[e]&&(i[e]=t[e])})),Array.from(t.attributes).forEach((t=>{i.setAttribute(t.name,t.value)}))}catch(t){}else{try{"value"in t&&void 0!==t.value&&(i.value=t.value)}catch(t){}try{Array.from(t.attributes).forEach((t=>{(t.name.startsWith("data-")||t.name.startsWith("aria-"))&&i.setAttribute(t.name,t.value)}))}catch(t){}}}))}catch(t){console.warn("Failed to copy form values in cloneElementWithState:",t)}})(t,e),e}getIds(){return this.getSortableElements().map((t=>t.id))}getRowIndex(t){return this.getSortableElements().findIndex((e=>e.id===t))}getDropTargetInfo(t,e){const i=this.getSortableElements().filter((t=>{var e;return t.id!==(null===(e=this.draggingEle)||void 0===e?void 0:e.id)}));if(0===i.length)return null;if(this.horizontal){for(let e=0;e<i.length;e++){const n=i[e],o=n.getBoundingClientRect();if(t<o.left+o.width/2)return{element:n,insertAfter:!1}}return{element:i[i.length-1],insertAfter:!0}}for(let t=0;t<i.length;t++){const n=i[t],o=n.getBoundingClientRect();if(e<o.top+o.height/2)return{element:n,insertAfter:!1}}return{element:i[i.length-1],insertAfter:!0}}showDropPlaceholder(t,e){if(this.hideDropPlaceholder(),t&&this.draggingEle&&t!==this.draggingEle){if(this.dropPlaceholder=document.createElement("div"),this.dropPlaceholder.className="drop-placeholder sortable",this.originalElementRect){const t=this.originalElementRect;this.dropPlaceholder.style.width=t.width+"px",this.dropPlaceholder.style.height=t.height+"px",this.dropPlaceholder.style.minHeight=t.height+"px",this.dropPlaceholder.style.borderRadius="var(--curvature)",this.dropPlaceholder.style.flexShrink="0"}e?t.insertAdjacentElement("afterend",this.dropPlaceholder):t.insertAdjacentElement("beforebegin",this.dropPlaceholder)}}hideDropPlaceholder(){this.dropPlaceholder&&(this.dropPlaceholder.remove(),this.dropPlaceholder=null)}showInitialPlaceholder(){if(!this.downEle||!this.originalElementRect)return;this.dropPlaceholder=document.createElement("div"),this.dropPlaceholder.className="drop-placeholder sortable";const t=this.originalElementRect;this.dropPlaceholder.style.width=t.width+"px",this.dropPlaceholder.style.height=t.height+"px",this.dropPlaceholder.style.minHeight=t.height+"px",this.dropPlaceholder.style.borderRadius="var(--curvature)",this.dropPlaceholder.style.flexShrink="0",this.dropPlaceholder.style.background="rgba(var(--color-primary-rgb), 0.1)",this.dropPlaceholder.style.border="2px dashed rgba(var(--color-primary-rgb), 0.3)",this.downEle.insertAdjacentElement("afterend",this.dropPlaceholder)}handleMouseDown(t){let e=t.target;if((!this.dragHandle||e.classList.contains(this.dragHandle))&&(e=e.closest(".sortable"),e)){t.preventDefault(),t.stopPropagation(),this.downEle=e,this.draggingId=e.id,this.draggingIdx=this.getRowIndex(e.id),this.draggingEle=e;const i=e.getBoundingClientRect();this.originalElementRect=i,this.xOffset=t.clientX-i.left,this.yOffset=t.clientY-i.top,this.yDown=t.clientY,this.xDown=t.clientX,document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("mouseup",this.handleMouseUp)}}handleMouseMove(t){if(!this.ghostElement&&this.downEle&&(Math.abs(t.clientY-this.yDown)>2||Math.abs(t.clientX-this.xDown)>2)){this.fireCustomEvent(xn.DragStart,{id:this.downEle.id}),this.originalDragIndex=this.getRowIndex(this.downEle.id),this.ghostElement=this.cloneElementWithState(this.downEle),this.originalDownDisplay=this.downEle.style.display,this.downEle.style.display="none",this.ghostElement.classList.add("ghost");const e=this.originalElementRect;this.ghostElement.style.position="fixed",this.ghostElement.style.left=t.clientX-this.xOffset+"px",this.ghostElement.style.top=t.clientY-this.yOffset+"px",this.ghostElement.style.width=e.width+"px",this.ghostElement.style.height=e.height+"px",this.ghostElement.style.zIndex="99999",this.ghostElement.style.opacity="0.8",this.ghostElement.style.transform="scale(1.03)",this.prepareGhost&&this.prepareGhost(this.ghostElement),document.body.appendChild(this.ghostElement),this.showInitialPlaceholder(),this.clickBlocker||(this.clickBlocker=t=>{t.stopPropagation(),t.preventDefault()},document.addEventListener("click",this.clickBlocker,!0))}if(this.ghostElement){this.ghostElement.style.left=t.clientX-this.xOffset+"px",this.ghostElement.style.top=t.clientY-this.yOffset+"px";const e=this.getDropTargetInfo(t.clientX,t.clientY);if(e){const{element:t,insertAfter:i}=e,n=this.getRowIndex(t.id);let o;o=n<this.originalDragIndex?i?n+1:n:i?n:n-1,this.dropTargetId=t.id,this.pendingDropIndex=o,this.pendingTargetElement=t,this.showDropPlaceholder(t,i)}else this.hideDropPlaceholder(),this.dropTargetId=null,this.pendingDropIndex=-1,this.pendingTargetElement=null}}handleMouseUp(t){if(this.draggingId&&this.ghostElement){if(t.preventDefault(),t.stopPropagation(),this.ghostElement&&this.ghostElement.remove(),this.downEle&&(this.downEle.style.display=this.originalDownDisplay),this.hideDropPlaceholder(),this.pendingDropIndex>=0&&this.pendingTargetElement){const t=this.originalDragIndex,e=this.pendingDropIndex;t!==e&&this.fireCustomEvent(xn.OrderChanged,{swap:[t,e]})}this.fireCustomEvent(xn.DragStop,{id:this.draggingId}),this.draggingId=null,this.dropTargetId=null,this.downEle=null,this.originalElementRect=null,this.originalDragIndex=-1,this.pendingDropIndex=-1,this.pendingTargetElement=null,this.ghostElement=null,this.hideDropPlaceholder(),this.clickBlocker&&setTimeout((()=>{this.clickBlocker&&(document.removeEventListener("click",this.clickBlocker,!0),this.clickBlocker=null)}),100)}document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),this.dispatchEvent(new Event("change"))}render(){return U`
|
|
873
|
+
<div
|
|
874
|
+
class="container ${this.horizontal?"horizontal":""}"
|
|
875
|
+
style="gap: ${this.gap}"
|
|
876
|
+
>
|
|
924
877
|
<slot @mousedown=${this.handleMouseDown}></slot>
|
|
925
878
|
</div>
|
|
926
|
-
`}}t([mt({type:String})],uc.prototype,"draggingId",void 0),t([mt({type:Boolean})],uc.prototype,"horizontal",void 0),t([mt({type:String})],uc.prototype,"dropTargetId",void 0),t([mt({type:String})],uc.prototype,"dragHandle",void 0),t([mt({attribute:!1})],uc.prototype,"prepareGhost",void 0);const pc=(t,e,i)=>{const n=t.substring(1);if("("===n[0])return!0;{const t=n.split(".")[0].toLowerCase();if(!i)return e.indexOf(t)>=0;for(const i of e)if(o=t,0===i.indexOf(o,0))return!0;return!1}var o},mc=t=>t>="a"&&t<="z"||t>="A"&&t<="Z"||t>="0"&&t<="9"||"_"===t,gc=t=>{let e=0;for(const i of t)'"'===i&&e++;return e%2!=0};class fc{constructor(t,e){this.expressionPrefix=t,this.allowedTopLevels=e}expressionContext(t){const e=this.findExpressions(t);if(0===e.length)return null;const i=e[e.length-1];return i.end<t.length||i.closed?null:i.text.substring(1)}autoCompleteContext(t){if(gc(t))return null;const e=[];let i="",n=!1,o=!1,s="";for(let r=t.length-1;r>=0;r--){const a=t[r];if(" "===a&&(n=!0),","===a&&(n=!0,"("!==e[e.length-1]&&e.push("(")),")"!==a||o||(n=!0,e.push("("),e.push("(")),'"'===a&&(o=!o),n&&("("!==a||o||("("===e[e.length-1]&&e.pop(),0===e.length&&(n=!1))),"("===a&&""===i&&(s="#"),!(n||o||"("===a&&""===i)){if(!mc(a)&&"."!==a)break;i=a+i}}return i.match(/[A-Za-z][\w]*(\.[\w]+)*/)?s+i:null}functionContext(t){let e=gc(t)?4:6,i="",n="("===t[-1]?0:1;for(let o=t.length-1;o>=0;o--){const s=t[o];if("@"===s)return"";if(6===e)0!==n||!mc(s)&&"."!==s?'"'===s?e=4:"("===s?n--:")"===s&&n++:(e=2,i=s+i);else if(2===e){if(!mc(s)&&"."!==s)return i;i=s+i}else 4===e&&'"'===s&&(e=6)}return""}getContactFields(t){const e={},i=/((parent|child\.)*contact\.)*fields\.([a-z0-9_]+)/g,n=this.findExpressions(t);for(const t of n){let n;for(;n=i.exec(t.text);)e[n[3]]=!0}return Object.keys(e)}findExpressions(t){const e=[];let i=0,n=null,o=0;for(let s=0;s<t.length;s++){const r=t[s],a=s<t.length-1?t[s+1]:0,l=s<t.length-2?t[s+2]:0;if(0===i?r!==this.expressionPrefix||!mc(a)&&"("!==a?r===this.expressionPrefix&&a===this.expressionPrefix&&(i=5):(i=1,n={start:s,end:null,text:r,closed:!1}):1===i?(mc(r)?i=2:"("===r&&(i=3,o+=1),n.text+=r):2===i?n.text+=r:3===i?("("===r?o+=1:")"===r?o-=1:'"'===r&&(i=4),n.text+=r,0===o&&(n.end=s+1)):4===i?('"'===r&&(i=3),n.text+=r):5===i&&(i=0),2===i&&(!mc(a)&&"."!==a||"."===a&&!mc(l))&&(n.end=s+1),null!=n&&(null!=n.end||0===a)){const t=0===a;pc(n.text,this.allowedTopLevels,t)&&(n.closed="("===n.text[1]&&0===o,n.end=s+1,e.push(n)),n=null,i=0}}return e}}const vc=new fc("@",["contact","fields","globals","urns"]),yc=new fc("@",["contact","fields","globals","locals","urns","results","input","run","child","parent","node","webhook","ticket","trigger","resume"]),bc=(t,e)=>{if(t.signature){const i=t.signature.indexOf("("),n=t.signature.substr(0,i),o=t.signature.substr(i);return U`
|
|
879
|
+
`}}t([mt({type:String})],uc.prototype,"draggingId",void 0),t([mt({type:Boolean})],uc.prototype,"horizontal",void 0),t([mt({type:String})],uc.prototype,"dropTargetId",void 0),t([mt({type:String})],uc.prototype,"dragHandle",void 0),t([mt({type:String})],uc.prototype,"gap",void 0),t([mt({attribute:!1})],uc.prototype,"prepareGhost",void 0);const pc=(t,e,i)=>{const n=t.substring(1);if("("===n[0])return!0;{const t=n.split(".")[0].toLowerCase();if(!i)return e.indexOf(t)>=0;for(const i of e)if(o=t,0===i.indexOf(o,0))return!0;return!1}var o},mc=t=>t>="a"&&t<="z"||t>="A"&&t<="Z"||t>="0"&&t<="9"||"_"===t,gc=t=>{let e=0;for(const i of t)'"'===i&&e++;return e%2!=0};class fc{constructor(t,e){this.expressionPrefix=t,this.allowedTopLevels=e}expressionContext(t){const e=this.findExpressions(t);if(0===e.length)return null;const i=e[e.length-1];return i.end<t.length||i.closed?null:i.text.substring(1)}autoCompleteContext(t){if(gc(t))return null;const e=[];let i="",n=!1,o=!1,s="";for(let r=t.length-1;r>=0;r--){const a=t[r];if(" "===a&&(n=!0),","===a&&(n=!0,"("!==e[e.length-1]&&e.push("(")),")"!==a||o||(n=!0,e.push("("),e.push("(")),'"'===a&&(o=!o),n&&("("!==a||o||("("===e[e.length-1]&&e.pop(),0===e.length&&(n=!1))),"("===a&&""===i&&(s="#"),!(n||o||"("===a&&""===i)){if(!mc(a)&&"."!==a)break;i=a+i}}return i.match(/[A-Za-z][\w]*(\.[\w]+)*/)?s+i:null}functionContext(t){let e=gc(t)?4:6,i="",n="("===t[-1]?0:1;for(let o=t.length-1;o>=0;o--){const s=t[o];if("@"===s)return"";if(6===e)0!==n||!mc(s)&&"."!==s?'"'===s?e=4:"("===s?n--:")"===s&&n++:(e=2,i=s+i);else if(2===e){if(!mc(s)&&"."!==s)return i;i=s+i}else 4===e&&'"'===s&&(e=6)}return""}getContactFields(t){const e={},i=/((parent|child\.)*contact\.)*fields\.([a-z0-9_]+)/g,n=this.findExpressions(t);for(const t of n){let n;for(;n=i.exec(t.text);)e[n[3]]=!0}return Object.keys(e)}findExpressions(t){const e=[];let i=0,n=null,o=0;for(let s=0;s<t.length;s++){const r=t[s],a=s<t.length-1?t[s+1]:0,l=s<t.length-2?t[s+2]:0;if(0===i?r!==this.expressionPrefix||!mc(a)&&"("!==a?r===this.expressionPrefix&&a===this.expressionPrefix&&(i=5):(i=1,n={start:s,end:null,text:r,closed:!1}):1===i?(mc(r)?i=2:"("===r&&(i=3,o+=1),n.text+=r):2===i?n.text+=r:3===i?("("===r?o+=1:")"===r?o-=1:'"'===r&&(i=4),n.text+=r,0===o&&(n.end=s+1)):4===i?('"'===r&&(i=3),n.text+=r):5===i&&(i=0),2===i&&(!mc(a)&&"."!==a||"."===a&&!mc(l))&&(n.end=s+1),null!=n&&(null!=n.end||0===a)){const t=0===a;pc(n.text,this.allowedTopLevels,t)&&(n.closed="("===n.text[1]&&0===o,n.end=s+1,e.push(n)),n=null,i=0}}return e}}const vc=new fc("@",["contact","fields","globals","urns"]),yc=new fc("@",["contact","fields","globals","locals","urns","results","input","run","child","parent","node","webhook","ticket","trigger","resume"]),bc=(t,e)=>{if(t.signature){const i=t.signature.indexOf("("),n=t.signature.substr(0,i),o=t.signature.substr(i);return U`
|
|
927
880
|
<div style="${e?"font-weight: 400":""}">
|
|
928
881
|
<div style="display:inline-block;margin-right: 5px">ƒ</div>
|
|
929
882
|
<div style="display:inline-block">${n}</div>
|
|
@@ -1149,13 +1102,15 @@ let rl=ja,al=!1;const ll=["es","fr","pt"],cl="data:image/png;base64,iVBORw0KGgoA
|
|
|
1149
1102
|
|
|
1150
1103
|
.input-wrapper:focus-within {
|
|
1151
1104
|
min-width: 1px;
|
|
1105
|
+
display: flex;
|
|
1152
1106
|
}
|
|
1153
1107
|
|
|
1154
1108
|
.input-wrapper {
|
|
1155
1109
|
min-width: 1px;
|
|
1156
1110
|
margin-left: 6px;
|
|
1157
1111
|
margin-right: -6px;
|
|
1158
|
-
display:
|
|
1112
|
+
display: none;
|
|
1113
|
+
pointer-events: none;
|
|
1159
1114
|
}
|
|
1160
1115
|
|
|
1161
1116
|
.multi .input-wrapper {
|
|
@@ -1214,6 +1169,7 @@ let rl=ja,al=!1;const ll=["es","fr","pt"],cl="data:image/png;base64,iVBORw0KGgoA
|
|
|
1214
1169
|
display: none;
|
|
1215
1170
|
line-height: var(--temba-select-selected-line-height);
|
|
1216
1171
|
margin-left: 6px;
|
|
1172
|
+
pointer-events: none;
|
|
1217
1173
|
}
|
|
1218
1174
|
|
|
1219
1175
|
.empty .placeholder {
|
|
@@ -1273,10 +1229,6 @@ let rl=ja,al=!1;const ll=["es","fr","pt"],cl="data:image/png;base64,iVBORw0KGgoA
|
|
|
1273
1229
|
pointer-events: none;
|
|
1274
1230
|
padding: 0px;
|
|
1275
1231
|
}
|
|
1276
|
-
|
|
1277
|
-
.ghost .remove-item {
|
|
1278
|
-
display: none !important;
|
|
1279
|
-
}
|
|
1280
1232
|
`}set values(t){this._values=Array.isArray(t)?t:[],this.requestUpdate("values")}get values(){return this._values||[]}constructor(){super(),this.hiddenInputs=[],this.inputStyle={},this.multi=!1,this.searchOnFocus=!1,this.placeholder="",this.name="",this.allowCreate=!1,this.nameKey="name",this.valueKey="value",this.maxItems=0,this.maxItemsText="Maximum items reached",this.queryParam=null,this.input="",this.visibleOptions=[],this.completionOptions=[],this.quietMillis=0,this.searchable=!1,this.cache=!0,this.cacheKey="",this.focused=!1,this.disabled=!1,this.attemptedOpen=!1,this.selectedIndex=-1,this.anchorPosition={left:0,top:0},this.tags=!1,this.emails=!1,this.flavor="default",this.infoText="",this._values=[],this.getName=t=>t[this.nameKey||"name"],this.isMatch=this.isMatchDefault,this.getValue=t=>t[this.valueKey||"value"]||t.id,this.sortFunction=null,this.renderOptionDetail=()=>U``,this.renderSelectedItem=this.renderSelectedItemDefault,this.createArbitraryOption=this.createArbitraryOptionDefault,this.getOptions=this.getOptionsDefault,this.prepareOptions=this.prepareOptionsDefault,this.isComplete=this.isCompleteDefault,this.staticOptions=[],this.allowAnchor=!0,this.alphaSort=(t,e)=>this.endpoint?this.getNameInternal(t).localeCompare(this.getNameInternal(e)):0,this.next=null,this.lruCache=kn(20,6e4),this.getNameInternal=t=>this.getName?this.getName(t):t[this.nameKey||"name"]||"",this.renderOptionDefault=this.renderOptionDefault.bind(this),this.renderSelectedItemDefault=this.renderSelectedItemDefault.bind(this),this.prepareOptionsDefault=this.prepareOptionsDefault.bind(this),this.isMatchDefault=this.isMatchDefault.bind(this),this.handleOrderChanged=this.handleOrderChanged.bind(this),this.createArbitraryOption=this.createArbitraryOptionDefault.bind(this)}prepareOptionsDefault(t){return t}isMatchDefault(t,e){return(this.getNameInternal(t)||"").toLowerCase().indexOf(e)>-1}handleSlotChange(){if(this.staticOptions&&0===this.staticOptions.length)for(const t of this.children)if("TEMBA-OPTION"===t.tagName){const e={};for(const i of t.attributes)e[i.name]=i.value;if(e){let t=!1;void 0!==e.selected&&(delete e.selected,t=!0);const i=this.value||this.getAttribute("value");if(i){this.getValue(e)==i&&(t=!0)}this.staticOptions.push(e),t&&(this.isMultiMode?this.addValue(e):this.setValues([e]))}}this.searchable&&0===this.staticOptions.length&&(this.quietMillis=200)}checkSelectedOption(){if(this.value&&0==this.values.length&&0==this.staticOptions.length&&this.endpoint){const t=this.value;this.resolving=!0,oe(this.endpoint).then((e=>{if(e&&e.length>0){if(t){const i=e.find((e=>this.getValue(e)===t));if(i)return this.resolving=!1,this.fetching=!1,void this.setValues([i])}this.setValues([e[0]]),this.resolving=!1}}))}else this.staticOptions.length>0&&(null!==this.getAttribute("multi")?this.addValue(this.staticOptions[0]):this.getAttribute("value")?this.setSelectedValue(this.getAttribute("value")):this.setValues([this.staticOptions[0]]))}firstUpdated(t){super.firstUpdated(t),this.anchorElement=this.shadowRoot.querySelector(".select-container"),this.anchorExpressions=this.shadowRoot.querySelector("#anchor"),this.shadowRoot.addEventListener("slotchange",this.handleSlotChange.bind(this))}updated(t){super.updated(t),t.has("createArbitraryOption")&&(this.createArbitraryOption||(this.createArbitraryOption=this.createArbitraryOptionDefault.bind(this))),t.has("sorted")&&(this.sortFunction=this.sorted?this.alphaSort:null),t.has("value")&&this.value&&!this.values.length&&this.setSelectedValue(this.value),t.has("values")&&(this.updateInputs(),this.hasChanges(t.get("values"))&&this.fireEvent("change")),t.has("cacheKey")&&this.lruCache.clear(),t.has("input")&&!t.has("values")&&!t.has("options")&&this.focused&&(this.lastQuery&&window.clearTimeout(this.lastQuery),this.lastQuery=window.setTimeout((()=>{this.expressions&&this.input.indexOf("@")>-1?this.fetchExpressions():this.fetchOptions(this.input)}),this.quietMillis)),this.endpoint&&t.has("fetching")&&(this.fetching||this.isPastFetchThreshold()||this.fireCustomEvent(xn.FetchComplete)),(t.has("cursorIndex")||t.has("visibleOptions"))&&this.endpoint&&!this.fetching&&this.isPastFetchThreshold()&&(this.next?this.fetchOptions(null,null,this.next):this.fetchOptions(this.query,this.page+1)),0===this.values.length&&!this.placeholder&&this.staticOptions.length>0&&this.setValues([this.staticOptions[0]])}hasChanges(t){if(void 0===t)return!1;let e;void 0!==t&&(e=(t||[]).map((t=>this.getValue(t))).join(","));return e!==(this.values||[]).map((t=>t.arbitrary||this.getValue(t))).join(",")}setSelectedValue(t){if(this.staticOptions.length>0){const e=this.staticOptions.find((e=>this.getValue(e)===t));e&&this.setValues([e])}else this.checkSelectedOption()}updateInputs(){for(let t=null;t=this.hiddenInputs.pop();)t.remove();if(0===this.values.length)this.value=null;else{const t=this.getAttribute("name");t&&(this.isMultiMode||1!==this.values.length?this.inputRoot.parentElement&&this.values.forEach((e=>{const i=document.createElement("input");i.setAttribute("type","hidden"),i.setAttribute("name",t),i.setAttribute("value",this.serializeValue(e)),this.hiddenInputs.push(i),this.inputRoot.parentElement.appendChild(i)})):(this.selection=this.values[0],this.value=this.serializeValue(this.values[0]),this.internals&&this.internals.setFormValue(this.value)))}}setSelectedOption(t){this.isMultiMode?this.addValue(t):this.setValues([t]),this.isMultiMode&&this.searchable||(this.blur(),this.focused=!1),this.visibleOptions=[],this.attemptedOpen=!1,this.input="",this.next=null,this.complete=!0,this.selectedIndex=-1}isPastFetchThreshold(){return(this.visibleOptions.length>0||this.next)&&!this.complete&&(this.cursorIndex||0)>this.visibleOptions.length-20}handleOptionSelection(t){if(this.isMultiMode&&this.maxItems>0&&this.values.length>=this.maxItems)return void(this.infoText=this.maxItemsText);this.infoText="";const e=t.detail.selected;e.arbitrary&&this.allowCreate&&this.endpoint?(this.resolving=!0,le(this.endpoint,e).then((t=>{t.status>=200&&t.status<300?(this.setSelectedOption(t.json),this.lruCache=kn(20,6e4),this.errors=[]):(this.setSelectedOption(e),setTimeout((()=>{this.errors=['There was an error creating "'+this.getNameInternal(e)+'"']}),0),this.blur()),this.resolving=!1}))):(this.setSelectedOption(e),this.errors=[])}handleExpressionSelection(t){const e=t.detail.selected,i=t.detail.tabbed,n=this.shadowRoot.querySelector(".searchbox");kc(this.query,n,e),this.query="",this.completionOptions=[],i?this.fetchExpressions():-1===this.input.indexOf("(")&&this.addInputAsValue()}getOptionsDefault(t){return t.json.results}isCompleteDefault(t,e){const i=e.json;return!i.more&&!i.next}handleRemoveSelection(t){if(this.removeValue(t),this.visibleOptions=[],this.errors=[],this.allowCreate){const t=this.values.find((t=>t.arbitrary));t&&setTimeout((()=>{this.errors=['There was an error creating "'+this.getNameInternal(t)+'"']}),0)}}createArbitraryOptionDefault(t,e){return this.emails&&t&&this.isValidEmail(t)||this.tags&&t?{name:t,value:t}:null}isValidEmail(t){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t)}get isMultiMode(){return this.multi||this.emails}open(){this.shadowRoot.querySelector(".select-container").click()}isOpen(){return this.visibleOptions.length>0||this.attemptedOpen&&this.focused}setOptions(t){this.staticOptions=t}setVisibleOptions(t){if(t=t.filter((t=>!!this.getNameInternal(t)&&(!this.shouldExclude||!this.shouldExclude(t)))),this.input){if(this.searchable&&!this.queryParam){const e=this.input.trim().toLowerCase();t=t.filter((t=>this.isMatch(t,e)))}const e=this.createArbitraryOption(this.input,t);if(e){e.arbitrary=!0;t.find((t=>this.getValue(t)===this.getValue(e)))||(t.length>0&&t[0].arbitrary?t[0]=e:t.unshift(e))}}this.values.length>0&&(this.isMultiMode?t=t.filter((t=>!this.values.find((e=>this.getValue(e)===this.getValue(t))))):(this.input?this.cursorIndex=0:this.cursorIndex=t.findIndex((t=>this.getValue(t)===this.getValue(this.values[0]))),this.requestUpdate("cursorIndex"))),this.isMultiMode&&this.maxItems>0&&this.values.length>=this.maxItems&&(t=[],this.infoText=this.maxItemsText),this.sortFunction&&t.sort(this.sortFunction),this.visibleOptions=t,this.fireCustomEvent(xn.ContentChanged,{options:this.visibleOptions})}fetchExpressions(){const t=document.querySelector("temba-store");if(this.expressions&&t){const t=this.shadowRoot.querySelector(".searchbox"),e=Cc(t,"session"===this.expressions);return this.query=e.query,this.completionOptions=e.options,this.visibleOptions=[],this.anchorPosition=e.anchorPosition,void this.fireCustomEvent(xn.FetchComplete)}}fetchOptions(t,e=0,i=null){if(this.completionOptions=[],!this.fetching){this.fetching=!0;const n=[...this.staticOptions],o=(t||"").trim().toLowerCase();if(this.tags&&o&&(n.find((t=>this.getValue(t)&&this.getValue(t).toLowerCase()===o))||n.splice(0,0,{name:t,value:t})),this.emails&&o&&this.isValidEmail(o)&&!n.find((t=>this.getValue(t)&&this.getValue(t).toLowerCase()===o))&&n.splice(0,0,{name:t,value:t}),this.endpoint){let s=this.endpoint;i?s=i:(t&&this.queryParam&&(s.indexOf("?")>-1?s+="&":s+="?",s+=this.queryParam+"="+encodeURIComponent(t)),e&&(s.indexOf("?")>-1?s+="&":s+="?",s+="page="+e));const r=this.lruCache.get(s);if(this.cache&&!this.tags&&!this.emails&&r)return 0!==e||this.next?this.setVisibleOptions([...this.visibleOptions,...r.options]):(this.cursorIndex=0,this.setVisibleOptions([...n,...r.options])),this.complete=r.complete,this.next=r.next,void(this.fetching=!1);this.searchable&&!this.queryParam?oe(s).then((t=>{t=this.prepareOptions(t),!this.cache||this.tags||this.emails||(this.lruCache.set(s,{options:t,complete:!0,next:null}),this.complete=!0,this.next=null,this.setVisibleOptions([...n,...t]),this.fetching=!1)})):ee(s).then((i=>{let r=this.getOptions(i).filter((t=>this.isMatch(t,o)));r=this.prepareOptions(r),this.next=null;const a=i.json;a.next&&(this.next=a.next),0!==e||this.next?(r.length>0&&this.setVisibleOptions([...this.visibleOptions,...r]),this.complete=this.isComplete(r,i)):(this.cursorIndex=0,this.setVisibleOptions([...n,...r]),this.query=t,this.complete=this.isComplete(this.visibleOptions,i)),!this.cache||this.tags||this.emails||this.lruCache.set(s,{options:r,complete:this.complete,next:this.next}),this.fetching=!1,this.page=e})).catch((t=>{this.fetching=!1,console.error(t)}))}else this.fetching=!1,this.setVisibleOptions(n)}}handleFocus(){this.focused||0!==this.visibleOptions.length||(this.focused=!0)}handleBlur(){this.focused=!1,this.attemptedOpen=!1,this.visibleOptions.length>0&&(this.input="",this.next=null,this.complete=!0,this.visibleOptions=[],this.cursorIndex=0),this.isMultiMode&&this.maxItems>0&&this.values.length>=this.maxItems&&(this.infoText="")}handleClick(){this.selectedIndex=-1,this.requestUpdate("input")}addInputAsValue(){const t=this.shadowRoot.querySelector(".searchbox"),e={name:t.value,value:t.value,expression:!0};this.isMultiMode?this.values.find((t=>t.expression&&t.value&&e.value&&t.value.toLowerCase().trim()==e.value.toLowerCase().trim()))||this.addValue(e):this.setValues([e]),this.input="",this.isMultiMode||this.blur()}handleKeyDown(t){if("Enter"===t.key&&this.expressions&&0===this.completionOptions.length&&this.input.indexOf("@")>-1)this.addInputAsValue();else if("Enter"===t.key&&this.emails&&this.input&&this.isValidEmail(this.input.trim())&&0===this.visibleOptions.length){t.preventDefault();const e={name:this.input.trim(),value:this.input.trim()};this.setSelectedOption(e)}else{if(("Enter"===t.key||"ArrowDown"===t.key||"n"===t.key&&t.ctrlKey)&&0===this.visibleOptions.length&&0===this.completionOptions.length&&!this.input)return this.attemptedOpen=!0,void this.requestUpdate("input");if(this.isMultiMode&&"Backspace"===t.key&&!this.input){if(this.visibleOptions.length>0)return void(this.visibleOptions=[]);-1===this.selectedIndex?(this.selectedIndex=this.values.length-1,this.visibleOptions=[]):(this.popValue(),this.selectedIndex=-1)}else this.selectedIndex=-1}}getStaticOptions(){return this.staticOptions}handleInput(t){const e=t.currentTarget;this.input=e.value}handleCancel(){this.visibleOptions=[],this.attemptedOpen=!1}handleCursorChanged(t){this.cursorIndex=t.detail.index}handleContainerClick(t){if(this.disabled)return t.stopPropagation(),void t.preventDefault();if(this.focused=!0,"INPUT"!==t.target.tagName){const t=this.shadowRoot.querySelector("input");if(t)return t.click(),void t.focus();this.isOpen()?(this.visibleOptions=[],this.attemptedOpen=!1):(this.attemptedOpen=!0,this.requestUpdate("input"),this.requestUpdate())}}getEventHandlers(){return[{event:xn.Canceled,method:this.handleCancel},{event:xn.CursorChanged,method:this.handleCursorChanged},{event:"blur",method:this.handleBlur},{event:"focus",method:this.handleFocus}]}handleArrowClick(t){this.disabled||this.isOpen()&&(t.preventDefault(),t.stopPropagation(),this.blur())}renderOptionDefault(t){if(!t)return null;const e=t.icon;return U`
|
|
1281
1233
|
<div
|
|
1282
1234
|
class="option-name"
|
|
@@ -1299,10 +1251,13 @@ let rl=ja,al=!1;const ll=["es","fr","pt"],cl="data:image/png;base64,iVBORw0KGgoA
|
|
|
1299
1251
|
class="clear-button"
|
|
1300
1252
|
@click=${this.handleClear}
|
|
1301
1253
|
/>`:null,n=ie({multi:this.isMultiMode,single:!this.isMultiMode,searchable:this.searchable,empty:0===this.values.length,options:this.visibleOptions.length>0,focused:this.focused,"search-input":this.input.length>0,"no-search-input":0===this.input.length,[this.flavor]:null!==this.flavor,disabled:this.disabled}),o=this.anchorPosition?{top:"0px",left:this.anchorPosition.left-10+"px"}:{},s=this.searchable?U`
|
|
1302
|
-
<div
|
|
1254
|
+
<div
|
|
1255
|
+
class="input-wrapper"
|
|
1256
|
+
style="${this.focused?"display:flex;":""}"
|
|
1257
|
+
>
|
|
1303
1258
|
<input
|
|
1304
1259
|
class="searchbox"
|
|
1305
|
-
style
|
|
1260
|
+
style="${this.inputStyle?gn(this.inputStyle):""};"
|
|
1306
1261
|
@input=${this.handleInput}
|
|
1307
1262
|
@keydown=${this.handleKeyDown}
|
|
1308
1263
|
@click=${this.handleClick}
|
|
@@ -1316,11 +1271,10 @@ let rl=ja,al=!1;const ll=["es","fr","pt"],cl="data:image/png;base64,iVBORw0KGgoA
|
|
|
1316
1271
|
<temba-sortable-list
|
|
1317
1272
|
horizontal
|
|
1318
1273
|
@temba-order-changed=${this.handleOrderChanged}
|
|
1319
|
-
.prepareGhost=${t=>{t.style.transform="scale(1)",t.querySelector(".remove-item").style.display="none"}}
|
|
1320
1274
|
>
|
|
1321
1275
|
${this.values.map(((t,e)=>U`
|
|
1322
1276
|
<div
|
|
1323
|
-
class="selected-item
|
|
1277
|
+
class="sortable selected-item ${e===this.selectedIndex?"focused":""} ${this.draggingId===`selected-${e}`?"dragging":""}"
|
|
1324
1278
|
id="selected-${e}"
|
|
1325
1279
|
style="
|
|
1326
1280
|
vertical-align: middle;
|
|
@@ -1363,7 +1317,7 @@ let rl=ja,al=!1;const ll=["es","fr","pt"],cl="data:image/png;base64,iVBORw0KGgoA
|
|
|
1363
1317
|
${this.renderSelectedItem(t)}
|
|
1364
1318
|
</div>
|
|
1365
1319
|
`))}
|
|
1366
|
-
${
|
|
1320
|
+
${s}
|
|
1367
1321
|
</temba-sortable-list>
|
|
1368
1322
|
`:U`${this.values.map(((t,e)=>U`
|
|
1369
1323
|
<div
|
|
@@ -1380,15 +1334,9 @@ let rl=ja,al=!1;const ll=["es","fr","pt"],cl="data:image/png;base64,iVBORw0KGgoA
|
|
|
1380
1334
|
${this.isMultiMode?U`
|
|
1381
1335
|
<div
|
|
1382
1336
|
class="remove-item"
|
|
1383
|
-
style="
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
padding: 3px 6px;
|
|
1387
|
-
border-right: 1px solid rgba(100,100,100,0.2);
|
|
1388
|
-
margin: 0;
|
|
1389
|
-
background: rgba(100,100,100,0.05);
|
|
1390
|
-
margin-top:1px;
|
|
1391
|
-
"
|
|
1337
|
+
style="cursor: pointer; display: inline-block; padding: 3px 6px;
|
|
1338
|
+
border-right: 1px solid rgba(100,100,100,0.2);
|
|
1339
|
+
margin: 0; background: rgba(100,100,100,0.05); margin-top:1px;"
|
|
1392
1340
|
@click=${e=>{e.preventDefault(),e.stopPropagation(),this.handleRemoveSelection(t)}}
|
|
1393
1341
|
>
|
|
1394
1342
|
<temba-icon
|
|
@@ -1410,9 +1358,9 @@ let rl=ja,al=!1;const ll=["es","fr","pt"],cl="data:image/png;base64,iVBORw0KGgoA
|
|
|
1410
1358
|
class="select-container ${n}"
|
|
1411
1359
|
@click=${this.handleContainerClick}
|
|
1412
1360
|
>
|
|
1413
|
-
<div class="left-side"
|
|
1361
|
+
<div class="left-side">
|
|
1414
1362
|
<slot name="prefix"></slot>
|
|
1415
|
-
<div class="selected"
|
|
1363
|
+
<div class="selected">
|
|
1416
1364
|
${this.resolving?U`<temba-loading
|
|
1417
1365
|
style="margin-left:1em"
|
|
1418
1366
|
></temba-loading>`:r}
|
|
@@ -1423,7 +1371,9 @@ let rl=ja,al=!1;const ll=["es","fr","pt"],cl="data:image/png;base64,iVBORw0KGgoA
|
|
|
1423
1371
|
|
|
1424
1372
|
${i}
|
|
1425
1373
|
|
|
1426
|
-
<slot name="right"
|
|
1374
|
+
<slot name="right">${this.fetching?U`<temba-loading
|
|
1375
|
+
style="position:absolute;background:rgba(255,255,255,0.7);padding:2px;border-radius:var(--curvature);right:25px"
|
|
1376
|
+
></temba-loading>`:null}</slot>
|
|
1427
1377
|
${this.tags||this.emails?null:U`<div
|
|
1428
1378
|
class="right-side arrow"
|
|
1429
1379
|
style="display:block;margin-right:5px"
|
|
@@ -3006,7 +2956,7 @@ let rl=ja,al=!1;const ll=["es","fr","pt"],cl="data:image/png;base64,iVBORw0KGgoA
|
|
|
3006
2956
|
`}constructor(){super(),this.contactsEndpoint="/api/v2/contacts.json",this.currentNote="",this.showDetails=!0,this.currentTicket=null,this.currentContact=null,this.agent="",this.blockFetching=!1,this.showInterrupt=!1,this.avatar=cl,this.ticket=null,this.lastEventTime=null,this.newestEventTime=null,this.refreshId=null,this.polling=!1}firstUpdated(t){super.firstUpdated(t)}connectedCallback(){super.connectedCallback(),this.chat=this.shadowRoot.querySelector("temba-chat")}disconnectedCallback(){super.disconnectedCallback(),this.refreshId&&clearInterval(this.refreshId)}updated(t){super.updated(t),(t.has("data")||t.has("currentContact"))&&(this.refreshId&&(clearTimeout(this.refreshId),this.refreshId=null),this.currentContact=this.data),t.has("currentContact")&&(this.chat=this.shadowRoot.querySelector("temba-chat"),this.reset(),this.fetchPreviousMessages())}reset(){this.chat&&this.chat.reset(),this.blockFetching=!1,this.ticket=null,this.lastEventTime=null,this.newestEventTime=null,this.refreshId=null,this.polling=!1,this.errorMessage=null;const t=this.shadowRoot.querySelector("temba-compose");t&&t.reset()}handleInterrupt(){this.fireCustomEvent(xn.Interrupt,{contact:this.currentContact})}handleRetry(){this.shadowRoot.querySelector("temba-compose").triggerSend()}handleSend(t){this.errorMessage=null;const e=t.currentTarget,i=t.detail.langValues.und,n={contact:this.currentContact.uuid},o=i.text;o&&o.length>0&&(n.text=o);const s=i.attachments;if(s&&s.length>0){const t=s.map((t=>t.uuid));n.attachments=t}this.currentTicket&&(n.ticket=this.currentTicket.uuid);const r="Send failed, please try again.";le("/api/v2/messages.json",n).then((t=>{t.status<400?(this.checkForNewMessages(),e.reset(),this.fireCustomEvent(xn.MessageSent,{msg:n})):this.errorMessage=r})).catch((()=>{this.errorMessage=r}))}getEndpoint(){return this.contact?`/contact/history/${this.contact}/?_format=json`:null}scheduleRefresh(){let t=(new Date).getTime()-this.newestEventTime/1e3-5e3;this.refreshId&&(clearTimeout(this.refreshId),this.refreshId=null),t=Math.min(t,15e3),t=Math.max(t,2e3),this.refreshId=setTimeout((()=>{this.checkForNewMessages()}),t)}getEventMessage(t){let e=null;switch(t.type){case Xc.AIRTIME_TRANSFERRED:e={type:Wc.Inline,text:ah(t)};break;case Xc.CALL_CREATED:case Xc.CALL_MISSED:case Xc.CALL_RECEIVED:e={type:Wc.Inline,text:hh(t)};break;case Xc.CHAT_STARTED:e={type:Wc.Inline,text:th(t)};break;case Xc.CONTACT_FIELD_CHANGED:e={type:Wc.Inline,text:eh(t)};break;case Xc.CONTACT_GROUPS_CHANGED:e={type:Wc.Inline,text:rh(t)};break;case Xc.CONTACT_LANGUAGE_CHANGED:e={type:Wc.Inline,text:lh(t)};break;case Xc.CONTACT_NAME_CHANGED:e={type:Wc.Inline,text:ih(t)};break;case Xc.CONTACT_STATUS_CHANGED:e={type:Wc.Inline,text:ch(t)};break;case Xc.CONTACT_URNS_CHANGED:e={type:Wc.Inline,text:nh(t)};break;case Xc.OPTIN_REQUESTED:case Xc.OPTIN_STARTED:case Xc.OPTIN_STOPPED:e={type:Wc.Inline,text:dh(t)};break;case Xc.RUN_STARTED:case Xc.RUN_ENDED:e={type:Wc.Inline,text:Jc(t)};break;case Xc.TICKET_ASSIGNEE_CHANGED:e={type:Wc.Inline,text:sh(t)};break;case Xc.TICKET_CLOSED:e={type:Wc.Inline,text:oh(t,"closed")};break;case Xc.TICKET_OPENED:e={type:Wc.Inline,text:oh(t,"opened")};break;case Xc.TICKET_REOPENED:e={type:Wc.Inline,text:oh(t,"reopened")};break;case Xc.TICKET_TOPIC_CHANGED:e={type:Wc.Inline,text:U`<div>
|
|
3007
2957
|
Topic changed to
|
|
3008
2958
|
<strong>${t.topic.name}</strong>
|
|
3009
|
-
</div>`};break;case Xc.CHANNEL_EVENT:e={type:Wc.Inline,text:Qc(t)};break;default:console.error("Unknown event type",t)}return e&&(e.id=t.uuid,e.date=new Date(t.created_on)),e}getUserForEvent(t){return"msg_received"===t.type?{name:this.currentContact.name}:t._user?t._user:t.created_by?{email:t.created_by.email,name:`${t.created_by.first_name} ${t.created_by.last_name}`.trim(),avatar:t.created_by.avatar}:null}createMessages(t){if(t.events){let e=[];return t.events.forEach((t=>{const i=1e3*new Date(t.created_on).getTime();if(i>this.newestEventTime&&(this.newestEventTime=i),"ticket_note_added"===t.type){const i=t;e.push({type:Wc.Note,id:t.created_on+t.type,user:this.getUserForEvent(i),date:new Date(i.created_on),text:i.note})}else if("ticket_opened"===t.type){const i=t;e.push({type:Wc.Note,id:t.created_on+t.type+"_note",user:this.getUserForEvent(i),date:new Date(i.created_on),text:i.note}),e.push(this.getEventMessage(t))}else if("msg_created"===t.type||"msg_received"===t.type||"ivr_created"===t.type||"broadcast_created"===t.type){const i=t;e.push({id:t.uuid,type:"msg_received"===i.type?"msg_in":"msg_out",user:this.getUserForEvent(i),date:new Date(i.created_on),attachments:i.msg.attachments,text:i.msg.text,sendError:"E"===
|
|
2959
|
+
</div>`};break;case Xc.CHANNEL_EVENT:e={type:Wc.Inline,text:Qc(t)};break;default:console.error("Unknown event type",t)}return e&&(e.id=t.uuid,e.date=new Date(t.created_on)),e}getUserForEvent(t){return"msg_received"===t.type?{name:this.currentContact.name}:t._user?t._user:t.created_by?{email:t.created_by.email,name:`${t.created_by.first_name} ${t.created_by.last_name}`.trim(),avatar:t.created_by.avatar}:null}createMessages(t){if(t.events){let e=[];return t.events.forEach((t=>{const i=1e3*new Date(t.created_on).getTime();if(i>this.newestEventTime&&(this.newestEventTime=i),"ticket_note_added"===t.type){const i=t;e.push({type:Wc.Note,id:t.created_on+t.type,user:this.getUserForEvent(i),date:new Date(i.created_on),text:i.note})}else if("ticket_opened"===t.type){const i=t;e.push({type:Wc.Note,id:t.created_on+t.type+"_note",user:this.getUserForEvent(i),date:new Date(i.created_on),text:i.note}),e.push(this.getEventMessage(t))}else if("msg_created"===t.type||"msg_received"===t.type||"ivr_created"===t.type||"broadcast_created"===t.type){const i=t,n=i.status||i._status,o=i.failed_reason_display||i._failed_reason;e.push({id:t.uuid,type:"msg_received"===i.type?"msg_in":"msg_out",user:this.getUserForEvent(i),date:new Date(i.created_on),attachments:i.msg.attachments,text:i.msg.text,sendError:"E"===n||"F"===n,popup:U`<div
|
|
3010
2960
|
style="display: flex; flex-direction: row; align-items:center; justify-content: space-between;font-size:0.9em;line-height:1em;min-width:10em"
|
|
3011
2961
|
>
|
|
3012
2962
|
<div style="justify-content:left;text-align:left">
|
|
@@ -3018,15 +2968,17 @@ let rl=ja,al=!1;const ll=["es","fr","pt"],cl="data:image/png;base64,iVBORw0KGgoA
|
|
|
3018
2968
|
${i.optin?U`<div style="font-size:0.9em;color:#aaa">
|
|
3019
2969
|
${i.optin.name}
|
|
3020
2970
|
</div>`:null}
|
|
3021
|
-
${
|
|
2971
|
+
${o?U`
|
|
3022
2972
|
<div
|
|
3023
2973
|
style="margin-top:0.2em;margin-right: 0.5em;min-width:10em;max-width:15em;color:var(--color-error);font-size:0.9em"
|
|
3024
2974
|
>
|
|
3025
|
-
${
|
|
2975
|
+
${o}
|
|
3026
2976
|
</div>
|
|
3027
2977
|
`:null}
|
|
3028
2978
|
</div>
|
|
3029
|
-
${i.logs_url?U`<a
|
|
2979
|
+
${i.logs_url||i._logs_url?U`<a
|
|
2980
|
+
style="margin-left:0.5em"
|
|
2981
|
+
href="${i.logs_url||i._logs_url}"
|
|
3030
2982
|
><temba-icon name="log"></temba-icon
|
|
3031
2983
|
></a>`:null}
|
|
3032
2984
|
</div> `})}else{const i=this.getEventMessage(t);i&&e.push(i)}})),e=e.filter((t=>!!t)),e}return[]}checkForNewMessages(){var t;if(this.polling)return;const e=this.chat,i=this;if(this.currentContact&&this.newestEventTime){this.polling=!0;const n=this.getEndpoint();if(!n)return;const o=this.currentContact.uuid;ph(!1,n,null===(t=this.currentTicket)||void 0===t?void 0:t.uuid,null,this.newestEventTime).then((t=>{if(o===this.currentContact.uuid){this.lastEventTime=t.next_before;const n=this.createMessages(t);0===n.length&&(i.blockFetching=!0),n.reverse(),e.addMessages(n,null,!0)}this.polling=!1,this.scheduleRefresh()}))}}fetchPreviousMessages(){var t;const e=this.chat,i=this;if(e&&!e.fetching&&!i.blockFetching&&(e.fetching=!0,this.currentContact)){const n=this.getEndpoint();if(!n)return;ph(!1,n,null===(t=this.currentTicket)||void 0===t?void 0:t.uuid,this.lastEventTime).then((t=>{this.lastEventTime=t.next_before;const n=this.createMessages(t);n.reverse(),0===n.length&&(i.blockFetching=!0),e.addMessages(n),this.scheduleRefresh()}))}}fetchComplete(){this.chat&&(this.chat.fetching=!1)}getTembaCompose(){return this.currentTicket?this.currentContact&&"active"!==this.currentContact.status||this.currentTicket.closed_on?null:this.getCompose():this.currentContact&&"active"!==this.currentContact.status?null:this.getCompose()}getCompose(){return U`<div class="border"></div>
|
|
@@ -3682,7 +3634,7 @@ let rl=ja,al=!1;const ll=["es","fr","pt"],cl="data:image/png;base64,iVBORw0KGgoA
|
|
|
3682
3634
|
/>
|
|
3683
3635
|
</svg>
|
|
3684
3636
|
</div>
|
|
3685
|
-
`}}var wh;t([mt({type:String})],_h.prototype,"name",void 0),t([mt({type:String})],_h.prototype,"prefix",void 0),t([mt({type:String})],_h.prototype,"id",void 0),t([mt({type:Number})],_h.prototype,"size",void 0),t([mt({type:Boolean})],_h.prototype,"spin",void 0),t([mt({type:Boolean})],_h.prototype,"clickable",void 0),t([mt({type:Boolean})],_h.prototype,"circled",void 0),t([mt({type:String})],_h.prototype,"animateChange",void 0),t([mt({type:String})],_h.prototype,"animateClick",void 0),t([mt({type:Number})],_h.prototype,"animationDuration",void 0),t([mt({type:String})],_h.prototype,"src",void 0),t([mt({type:Number,attribute:!1})],_h.prototype,"steps",void 0),t([mt({type:Number,attribute:!1})],_h.prototype,"animationStep",void 0),t([mt({type:String})],_h.prototype,"easing",void 0),function(t){t.Group="group",t.Contact="contact"}(wh||(wh={}));const kh={color:"var(--color-text-dark)",padding:"0px 6px",fontSize:"12px"};class Ch extends Sc{constructor(){super(...arguments),this.valueKey="uuid",this.groups=!1,this.contacts=!1,this.placeholder="Select recipients",this.multi=!0,this.searchable=!0,this.searchOnFocus=!0,this.queryParam="search"}update(t){if(super.update(t),(t.has("groups")||t.has("contacts"))&&(this.groups||this.contacts)){let t="&types=";this.groups&&(t+="g"),this.contacts&&(t+="c"),this.endpoint=this.endpoint+t}}renderOptionDefault(t){return U`
|
|
3637
|
+
`}}var wh;t([mt({type:String})],_h.prototype,"name",void 0),t([mt({type:String})],_h.prototype,"prefix",void 0),t([mt({type:String})],_h.prototype,"id",void 0),t([mt({type:Number})],_h.prototype,"size",void 0),t([mt({type:Boolean})],_h.prototype,"spin",void 0),t([mt({type:Boolean})],_h.prototype,"clickable",void 0),t([mt({type:Boolean})],_h.prototype,"circled",void 0),t([mt({type:String})],_h.prototype,"animateChange",void 0),t([mt({type:String})],_h.prototype,"animateClick",void 0),t([mt({type:Number})],_h.prototype,"animationDuration",void 0),t([mt({type:String})],_h.prototype,"src",void 0),t([mt({type:Number,attribute:!1})],_h.prototype,"steps",void 0),t([mt({type:Number,attribute:!1})],_h.prototype,"animationStep",void 0),t([mt({type:String})],_h.prototype,"easing",void 0),function(t){t.Group="group",t.Contact="contact"}(wh||(wh={}));const kh={color:"var(--color-text-dark)",padding:"0px 6px",fontSize:"12px"};class Ch extends Sc{constructor(){super(...arguments),this.valueKey="uuid",this.groups=!1,this.contacts=!1,this.placeholder="Select recipients",this.multi=!0,this.jsonValue=!0,this.searchable=!0,this.searchOnFocus=!0,this.queryParam="search"}update(t){if(super.update(t),(t.has("groups")||t.has("contacts"))&&(this.groups||this.contacts)){let t="&types=";this.groups&&(t+="g"),this.contacts&&(t+="c"),this.endpoint=this.endpoint+t}}renderOptionDefault(t){return U`
|
|
3686
3638
|
<div style="display:flex;">
|
|
3687
3639
|
<div style="margin-right: 8px">${this.getIcon(t)}</div>
|
|
3688
3640
|
<div style="flex: 1">${t.name}</div>
|
|
@@ -3713,7 +3665,7 @@ let rl=ja,al=!1;const ll=["es","fr","pt"],cl="data:image/png;base64,iVBORw0KGgoA
|
|
|
3713
3665
|
${this.getPostName(t)}
|
|
3714
3666
|
</div>
|
|
3715
3667
|
</div>
|
|
3716
|
-
`}getIcon(t){return t.type===wh.Group?U`<temba-icon name="${hn.group}"></temba-icon>`:t.type===wh.Contact?U`<temba-icon name="${hn.contact}"></temba-icon>`:void 0}}t([mt({type:String})],Ch.prototype,"valueKey",void 0),t([mt({type:Boolean})],Ch.prototype,"groups",void 0),t([mt({type:Boolean})],Ch.prototype,"contacts",void 0),t([mt({type:String})],Ch.prototype,"placeholder",void 0),t([mt({type:Boolean})],Ch.prototype,"multi",void 0),t([mt({type:Boolean})],Ch.prototype,"searchable",void 0),t([mt({type:Boolean})],Ch.prototype,"searchOnFocus",void 0),t([mt({type:Boolean})],Ch.prototype,"queryParam",void 0);class Sh extends Ae{constructor(){super(...arguments),this.visible=!1,this.position="auto",this.lastEnter=0,this.failSafe=0}static get styles(){return a`
|
|
3668
|
+
`}getIcon(t){return t.type===wh.Group?U`<temba-icon name="${hn.group}"></temba-icon>`:t.type===wh.Contact?U`<temba-icon name="${hn.contact}"></temba-icon>`:void 0}}t([mt({type:String})],Ch.prototype,"valueKey",void 0),t([mt({type:Boolean})],Ch.prototype,"groups",void 0),t([mt({type:Boolean})],Ch.prototype,"contacts",void 0),t([mt({type:String})],Ch.prototype,"placeholder",void 0),t([mt({type:Boolean})],Ch.prototype,"multi",void 0),t([mt({type:Boolean})],Ch.prototype,"jsonValue",void 0),t([mt({type:Boolean})],Ch.prototype,"searchable",void 0),t([mt({type:Boolean})],Ch.prototype,"searchOnFocus",void 0),t([mt({type:Boolean})],Ch.prototype,"queryParam",void 0);class Sh extends Ae{constructor(){super(...arguments),this.visible=!1,this.position="auto",this.lastEnter=0,this.failSafe=0}static get styles(){return a`
|
|
3717
3669
|
.tip {
|
|
3718
3670
|
transition: opacity 200ms ease-in-out;
|
|
3719
3671
|
margin: 0px;
|
|
@@ -8249,7 +8201,7 @@ const{I:vd}=at,yd=()=>document.createComment(""),bd=(t,e,i)=>{const n=t._$AA.par
|
|
|
8249
8201
|
<div style="margin-left:0.5em">${e.template.name}</div>
|
|
8250
8202
|
</div>`:null}
|
|
8251
8203
|
</div>`:null}
|
|
8252
|
-
`},form:{text:{type:"message-editor",label:"Message",helpText:"Enter the message to send with optional attachments. You can use expressions like @contact.name",required:!0,evaluated:!0,placeholder:"Type your message here...",maxAttachments:10,accept:"",endpoint:"/api/v2/media.json",counter:"temba-charcount",gsm:!0,autogrow:!0},quick_replies:{type:"select",options:[],multi:!0,tags:!0,searchable:!0,placeholder:"Add quick replies...",maxItems:10,evaluated:!0},runtime_attachments:{type:"array",helpText:"Add dynamic attachments using expressions",itemLabel:"Attachment",maxItems:10,isEmptyItem:t=>!t.expression||""===t.expression.trim(),itemConfig:{type:{type:"select",options:[{value:"image",name:"Image"},{value:"audio",name:"Audio"},{value:"video",name:"Video"},{value:"document",name:"Document"}],required:!0,searchable:!1},expression:{type:"text",placeholder:"Expression (e.g. @contact.photo)",required:!0,evaluated:!0}}}},layout:["text",{type:"group",label:"Quick Replies",items:["quick_replies"],collapsible:!0,collapsed:t=>!t.quick_replies||0===t.quick_replies.length,getGroupValueCount:t=>{var e;return(null===(e=t.quick_replies)||void 0===e?void 0:e.length)||0}},{type:"group",label:"Runtime Attachments",items:["runtime_attachments"],collapsible:!0,collapsed:!0,helpText:"Add dynamic attachments that are evaluated at runtime",getGroupValueCount:t=>{var e;return(null===(e=t.runtime_attachments)||void 0===e?void 0:e.filter((t=>t&&t.expression&&""!==t.expression.trim())).length)||0}}],toFormData:t=>{const e=[],i=[];return t.attachments&&Array.isArray(t.attachments)&&t.attachments.forEach((t=>{if("string"==typeof t&&t.includes(":")){const n=t.indexOf(":"),o=t.substring(0,n),s=t.substring(n+1);o.includes("/")?i.push(t):e.push({type:{name:Ce(o),value:o},expression:s})}})),{uuid:t.uuid,text:t.text||"",attachments:i,runtime_attachments:e,quick_replies:(t.quick_replies||[]).map((t=>({name:t,value:t})))}},fromFormData:t=>{const e={uuid:t.uuid,type:"send_msg",text:t.text||"",attachments:[],quick_replies:(t.quick_replies||[]).map((t=>"string"==typeof t?t:t.value||t.name||t))},i=t.attachments||[],n=(t.runtime_attachments||[]).filter((t=>t&&t.type&&t.expression)).map((t=>`${t.type[0].value}:${t.expression}`));return e.attachments=[...i,...n],0===e.quick_replies.length&&delete e.quick_replies,e},sanitize:t=>{t.text&&"string"==typeof t.text&&(t.text=t.text.trim())},validate:t=>{const e={};t.text&&""!==t.text.trim()||(e.text="Message text is required");const i=t.attachments||[];if(i.length>10){const t=i.filter((t=>"string"==typeof t&&t.substring(0,t.indexOf(":")).includes("/")));if(i.filter((t=>"string"==typeof t&&!t.substring(0,t.indexOf(":")).includes("/"))).length>0&&(e.runtime_attachments="Each message can only have up to 10 attachments"),t.length>0){const t="Each message can only have up to 10 total attachments";e.text?e.text+=` ${t}`:e.text=t}}return{valid:0===Object.keys(e).length,errors:e}}},Ob={name:"Send Email",color:pb,render:(t,e)=>U`<div>
|
|
8204
|
+
`},form:{text:{type:"message-editor",label:"Message",helpText:"Enter the message to send with optional attachments. You can use expressions like @contact.name",required:!0,evaluated:!0,placeholder:"Type your message here...",maxAttachments:10,accept:"",endpoint:"/api/v2/media.json",counter:"temba-charcount",gsm:!0,autogrow:!0},quick_replies:{type:"select",options:[],multi:!0,tags:!0,searchable:!0,placeholder:"Add quick replies...",maxItems:10,evaluated:!0},runtime_attachments:{type:"array",helpText:"Add dynamic attachments using expressions",itemLabel:"Attachment",sortable:!0,maxItems:10,isEmptyItem:t=>!t.expression||""===t.expression.trim(),itemConfig:{type:{type:"select",options:[{value:"image",name:"Image"},{value:"audio",name:"Audio"},{value:"video",name:"Video"},{value:"document",name:"Document"}],required:!0,searchable:!1},expression:{type:"text",placeholder:"Expression (e.g. @contact.photo)",required:!0,evaluated:!0}}}},layout:["text",{type:"group",label:"Quick Replies",items:["quick_replies"],collapsible:!0,collapsed:t=>!t.quick_replies||0===t.quick_replies.length,getGroupValueCount:t=>{var e;return(null===(e=t.quick_replies)||void 0===e?void 0:e.length)||0}},{type:"group",label:"Runtime Attachments",items:["runtime_attachments"],collapsible:!0,collapsed:!0,helpText:"Add dynamic attachments that are evaluated at runtime",getGroupValueCount:t=>{var e;return(null===(e=t.runtime_attachments)||void 0===e?void 0:e.filter((t=>t&&t.expression&&""!==t.expression.trim())).length)||0}}],toFormData:t=>{const e=[],i=[];return t.attachments&&Array.isArray(t.attachments)&&t.attachments.forEach((t=>{if("string"==typeof t&&t.includes(":")){const n=t.indexOf(":"),o=t.substring(0,n),s=t.substring(n+1);o.includes("/")?i.push(t):e.push({type:{name:Ce(o),value:o},expression:s})}})),{uuid:t.uuid,text:t.text||"",attachments:i,runtime_attachments:e,quick_replies:(t.quick_replies||[]).map((t=>({name:t,value:t})))}},fromFormData:t=>{const e={uuid:t.uuid,type:"send_msg",text:t.text||"",attachments:[],quick_replies:(t.quick_replies||[]).map((t=>"string"==typeof t?t:t.value||t.name||t))},i=t.attachments||[],n=(t.runtime_attachments||[]).filter((t=>t&&t.type&&t.expression)).map((t=>`${t.type[0].value}:${t.expression}`));return e.attachments=[...i,...n],0===e.quick_replies.length&&delete e.quick_replies,e},sanitize:t=>{t.text&&"string"==typeof t.text&&(t.text=t.text.trim())},validate:t=>{const e={};t.text&&""!==t.text.trim()||(e.text="Message text is required");const i=t.attachments||[];if(i.length>10){const t=i.filter((t=>"string"==typeof t&&t.substring(0,t.indexOf(":")).includes("/")));if(i.filter((t=>"string"==typeof t&&!t.substring(0,t.indexOf(":")).includes("/"))).length>0&&(e.runtime_attachments="Each message can only have up to 10 attachments"),t.length>0){const t="Each message can only have up to 10 total attachments";e.text?e.text+=` ${t}`:e.text=t}}return{valid:0===Object.keys(e).length,errors:e}}},Ob={name:"Send Email",color:pb,render:(t,e)=>U`<div>
|
|
8253
8205
|
<div>${wb(e.addresses,hn.email)}</div>
|
|
8254
8206
|
<div style="margin-top: 0.5em">
|
|
8255
8207
|
<div
|
|
@@ -8258,7 +8210,7 @@ const{I:vd}=at,yd=()=>document.createComment(""),bd=(t,e,i)=>{const n=t._$AA.par
|
|
|
8258
8210
|
${e.subject}
|
|
8259
8211
|
</div>
|
|
8260
8212
|
</div>
|
|
8261
|
-
</div>`,form:{addresses:{type:"select",label:"Recipients",options:[],multi:!0,searchable:!0,placeholder:"Search for contacts...",emails:!0},subject:{type:"text",label:"Subject",required:!0,placeholder:"Enter email subject",maxLength:255},body:{type:"textarea",required:!0,evaluated:!0,minHeight:175}},fromFormData:t=>({uuid:t.uuid,type:"send_email",addresses:t.addresses.map((t=>t.value)),subject:t.subject,body:t.body}),validate:t=>{const e={};return t.addresses&&0!==t.addresses.length||(e.addresses="At least one recipient email address is required"),{valid:0===Object.keys(e).length,errors:e}}},$b={name:"Start Session",color:yb,render:(t,e)=>U`<div>Start Session</div>`},Lb={name:"Call Classifier",color:gb,render:(t,e)=>U`<div>Call Classifier</div>`},zb={name:"Call Resthook",color:gb,render:(t,e)=>U`<div>Call Resthook</div>`},Rb={name:"Transfer Airtime",color:pb,render:(t,e)=>U`<div>Transfer Airtime</div>`},Nb={name:"Update Name",color:mb,render:(t,e)=>U`<div>Set to <strong>${e.name}</strong></div>`,form:{name:{type:"text",label:"Name",placeholder:"Enter contact name...",required:!0,evaluated:!0,helpText:"The new name for the contact. You can use expressions like @contact.name"}},validate:t=>{const e={};return t.name&&""!==t.name.trim()||(e.name="Name is required"),{valid:0===Object.keys(e).length,errors:e}},sanitize:t=>{t.name&&"string"==typeof t.name&&(t.name=t.name.trim())}},jb={name:"Add to Group",color:mb,render:(t,e)=>U`<div>${_b(e.groups,"group")}</div>`,toFormData:t=>({groups:t.groups||[],uuid:t.uuid}),form:{groups:{type:"select",label:"Groups",helpText:"Select the groups to add the contact to",required:!0,options:[],multi:!0,searchable:!0,endpoint:"/api/v2/groups.json",valueKey:"uuid",nameKey:"name",placeholder:"Search for groups...",allowCreate:!0,createArbitraryOption:(t,e)=>!e.find((e=>e.name.toLowerCase().trim()===t.toLowerCase().trim()))&&t.trim()?{name:t.trim(),arbitrary:!0}:null}},fromFormData:t=>({uuid:t.uuid,type:"add_contact_groups",groups:t.groups||[]})},Bb={name:"Remove from Group",color:mb,render:(t,e)=>e.all_groups?U`<div>Remove from all groups</div>`:U`<div>${_b(e.groups,"group")}</div>`,toFormData:t=>({uuid:t.uuid,all_groups:t.all_groups||!1,groups:t.groups||[]}),form:{groups:{type:"select",label:"Groups",helpText:"Select the groups to remove the contact from",options:[],multi:!0,searchable:!0,endpoint:"/api/v2/groups.json",valueKey:"uuid",nameKey:"name",placeholder:"Search for groups...",conditions:{visible:t=>!t.all_groups}},all_groups:{type:"checkbox",label:"Remove from All Groups",helpText:"Check this to remove the contact from all groups instead of specific ones"}},validate:t=>{const e={};return t.all_groups||t.groups&&0!==t.groups.length||(e.groups='At least one group must be selected or check "Remove from All Groups"'),{valid:0===Object.keys(e).length,errors:e}},fromFormData:t=>({uuid:t.uuid,type:"remove_contact_groups",groups:t.all_groups?[]:t.groups||[],all_groups:t.all_groups||!1})},Fb={name:"Request Opt-in",color:pb,render:(t,e)=>U`<div>Request Opt-in</div>`},qb={name:"Say Message",color:pb,render:(t,e)=>U`<div>Say Message</div>`},Vb={name:"Play Audio",color:pb,render:(t,e)=>U`<div>Play Audio</div>`},Hb={type:"split_by_airtime",name:"Split by Airtime Transfer",color:pb,action:Rb},Ub={type:"split_by_contact_field",name:"Split by <Contact Field Name>",color:vb},Wb={type:"split_by_expression",name:"Split by Expression",color:vb},Gb={type:"split_by_groups",name:"Split by Group",color:vb},Zb={type:"split_by_random",name:"Split by Random",color:vb,form:{categories:{type:"array",label:"Buckets",helpText:"Define the buckets to randomly split contacts into",required:!0,itemLabel:"Bucket",minItems:2,maxItems:10,isEmptyItem:t=>!t.name||""===t.name.trim(),itemConfig:{name:{type:"text",placeholder:"Bucket name",required:!0}}}},layout:["categories"],validate:t=>{const e={};if(t.categories&&Array.isArray(t.categories)){const i=t.categories.filter((t=>(null==t?void 0:t.name)&&""!==t.name.trim()));i.length<2&&(e.categories="At least 2 buckets are required for random split");const n=[],o=new Map;if(i.forEach((t=>{const e=t.name.trim().toLowerCase();o.has(e)||o.set(e,[]),o.get(e).push(t.name.trim())})),o.forEach((t=>{t.length>1&&n.push(...t)})),n.length>0){const t=[...new Set(n)];e.categories=`Duplicate bucket names found: ${t.join(", ")}`}}return{valid:0===Object.keys(e).length,errors:e}},toFormData:t=>{var e,i;const n=(null===(i=null===(e=t.router)||void 0===e?void 0:e.categories)||void 0===i?void 0:i.map((t=>({name:t.name}))))||[];return{uuid:t.uuid,categories:n}},fromFormData:(t,e)=>{var i;const n=(t.categories||[]).filter((t=>{var e;return null===(e=null==t?void 0:t.name)||void 0===e?void 0:e.trim()})).map((t=>t.name.trim())),o=(null===(i=e.router)||void 0===i?void 0:i.categories)||[],s=e.exits||[],{router:r,exits:a}=((t,e=[],i=[])=>{const n=[],o=[];return t.forEach((t=>{const s=e.find((e=>e.name===t)),r=s?i.find((t=>t.uuid===s.exit_uuid)):null,a=(null==r?void 0:r.uuid)||Yt(),l=(null==s?void 0:s.uuid)||Yt();n.push({uuid:l,name:t,exit_uuid:a}),o.push({uuid:a,destination_uuid:(null==r?void 0:r.destination_uuid)||null})})),{router:{type:"random",categories:n},exits:o}})(n,o,s);return{uuid:e.uuid,actions:e.actions||[],router:r,exits:a}},router:{type:"random"}},Yb={type:"split_by_run_result",name:"Split by Flow Result",color:vb},Xb={type:"split_by_scheme",name:"Split by URN Type",color:vb},Kb={type:"split_by_subflow",name:"Enter a Flow",color:yb,form:{flow:{type:"select",required:!0,placeholder:"Select a flow...",helpText:"Once the subflow is complete or expires, the contact will return here",endpoint:"/api/v2/flows.json",valueKey:"uuid",nameKey:"name"}},layout:["flow"],render:t=>{var e,i;const n=null===(e=t.actions)||void 0===e?void 0:e.find((t=>"enter_flow"===t.type));return U`
|
|
8213
|
+
</div>`,form:{addresses:{type:"select",label:"Recipients",options:[],multi:!0,searchable:!0,placeholder:"Search for contacts...",emails:!0},subject:{type:"text",label:"Subject",required:!0,placeholder:"Enter email subject",maxLength:255},body:{type:"textarea",required:!0,evaluated:!0,minHeight:175}},fromFormData:t=>({uuid:t.uuid,type:"send_email",addresses:t.addresses.map((t=>t.value)),subject:t.subject,body:t.body}),validate:t=>{const e={};return t.addresses&&0!==t.addresses.length||(e.addresses="At least one recipient email address is required"),{valid:0===Object.keys(e).length,errors:e}}},$b={name:"Start Session",color:yb,render:(t,e)=>U`<div>Start Session</div>`},Lb={name:"Call Classifier",color:gb,render:(t,e)=>U`<div>Call Classifier</div>`},zb={name:"Call Resthook",color:gb,render:(t,e)=>U`<div>Call Resthook</div>`},Rb={name:"Transfer Airtime",color:pb,render:(t,e)=>U`<div>Transfer Airtime</div>`},Nb={name:"Update Name",color:mb,render:(t,e)=>U`<div>Set to <strong>${e.name}</strong></div>`,form:{name:{type:"text",label:"Name",placeholder:"Enter contact name...",required:!0,evaluated:!0,helpText:"The new name for the contact. You can use expressions like @contact.name"}},validate:t=>{const e={};return t.name&&""!==t.name.trim()||(e.name="Name is required"),{valid:0===Object.keys(e).length,errors:e}},sanitize:t=>{t.name&&"string"==typeof t.name&&(t.name=t.name.trim())}},jb={name:"Add to Group",color:mb,render:(t,e)=>U`<div>${_b(e.groups,"group")}</div>`,toFormData:t=>({groups:t.groups||[],uuid:t.uuid}),form:{groups:{type:"select",label:"Groups",helpText:"Select the groups to add the contact to",required:!0,options:[],multi:!0,searchable:!0,endpoint:"/api/v2/groups.json",valueKey:"uuid",nameKey:"name",placeholder:"Search for groups...",allowCreate:!0,createArbitraryOption:(t,e)=>!e.find((e=>e.name.toLowerCase().trim()===t.toLowerCase().trim()))&&t.trim()?{name:t.trim(),arbitrary:!0}:null}},fromFormData:t=>({uuid:t.uuid,type:"add_contact_groups",groups:t.groups||[]})},Bb={name:"Remove from Group",color:mb,render:(t,e)=>e.all_groups?U`<div>Remove from all groups</div>`:U`<div>${_b(e.groups,"group")}</div>`,toFormData:t=>({uuid:t.uuid,all_groups:t.all_groups||!1,groups:t.groups||[]}),form:{groups:{type:"select",label:"Groups",helpText:"Select the groups to remove the contact from",options:[],multi:!0,searchable:!0,endpoint:"/api/v2/groups.json",valueKey:"uuid",nameKey:"name",placeholder:"Search for groups...",conditions:{visible:t=>!t.all_groups}},all_groups:{type:"checkbox",label:"Remove from All Groups",helpText:"Check this to remove the contact from all groups instead of specific ones"}},validate:t=>{const e={};return t.all_groups||t.groups&&0!==t.groups.length||(e.groups='At least one group must be selected or check "Remove from All Groups"'),{valid:0===Object.keys(e).length,errors:e}},fromFormData:t=>({uuid:t.uuid,type:"remove_contact_groups",groups:t.all_groups?[]:t.groups||[],all_groups:t.all_groups||!1})},Fb={name:"Request Opt-in",color:pb,render:(t,e)=>U`<div>Request Opt-in</div>`},qb={name:"Say Message",color:pb,render:(t,e)=>U`<div>Say Message</div>`},Vb={name:"Play Audio",color:pb,render:(t,e)=>U`<div>Play Audio</div>`},Hb={type:"split_by_airtime",name:"Split by Airtime Transfer",color:pb,action:Rb},Ub={type:"split_by_contact_field",name:"Split by <Contact Field Name>",color:vb},Wb={type:"split_by_expression",name:"Split by Expression",color:vb},Gb={type:"split_by_groups",name:"Split by Group",color:vb,form:{groups:{type:"select",label:"Groups",helpText:"Select the groups to split contacts by. Contacts will be routed based on their group membership.",required:!0,options:[],multi:!0,searchable:!0,endpoint:"/api/v2/groups.json",valueKey:"uuid",nameKey:"name",placeholder:"Search for groups...",allowCreate:!0,createArbitraryOption:(t,e)=>!e.find((e=>e.name.toLowerCase().trim()===t.toLowerCase().trim()))&&t.trim()?{name:t.trim(),arbitrary:!0}:null}},layout:["groups"],validate:t=>{const e={};return t.groups&&Array.isArray(t.groups)&&0!==t.groups.length||(e.groups="At least one group is required"),{valid:0===Object.keys(e).length,errors:e}},toFormData:t=>{var e;const i=[];return(null===(e=t.router)||void 0===e?void 0:e.cases)&&t.router.cases.forEach((t=>{var e;"has_group"===t.type&&(null===(e=t.arguments)||void 0===e?void 0:e.length)>=2&&i.push({uuid:t.arguments[0],name:t.arguments[1]})})),{uuid:t.uuid,groups:i}},fromFormData:(t,e)=>{var i,n;const o=(t.groups||[]).filter((t=>(null==t?void 0:t.uuid)||(null==t?void 0:t.arbitrary))).map((t=>({uuid:t.uuid||Yt(),name:t.name}))),s=(null===(i=e.router)||void 0===i?void 0:i.categories)||[],r=e.exits||[],a=(null===(n=e.router)||void 0===n?void 0:n.cases)||[],{router:l,exits:c}=((t,e=[],i=[],n=[])=>{const o=[],s=[],r=[];t.forEach((t=>{const a=e.find((e=>e.name===t.name)),l=a?i.find((t=>t.uuid===a.exit_uuid)):null,c=n.find((e=>{var i;return(null===(i=e.arguments)||void 0===i?void 0:i[0])===t.uuid})),h=(null==l?void 0:l.uuid)||Yt(),d=(null==a?void 0:a.uuid)||Yt(),u=(null==c?void 0:c.uuid)||Yt();o.push({uuid:d,name:t.name,exit_uuid:h}),s.push({uuid:h,destination_uuid:(null==l?void 0:l.destination_uuid)||null}),r.push({uuid:u,type:"has_group",arguments:[t.uuid,t.name],category_uuid:d})}));const a=e.find((e=>"Other"===e.name&&!t.some((t=>t.name===e.name)))),l=a?i.find((t=>t.uuid===a.exit_uuid)):null,c=(null==l?void 0:l.uuid)||Yt(),h=(null==a?void 0:a.uuid)||Yt();return o.push({uuid:h,name:"Other",exit_uuid:c}),s.push({uuid:c,destination_uuid:(null==l?void 0:l.destination_uuid)||null}),{router:{type:"switch",cases:r,categories:o,default_category_uuid:h,operand:"@contact.groups",result_name:""},exits:s}})(o,s,r,a);return{uuid:e.uuid,actions:e.actions||[],router:l,exits:c}},router:{type:"switch",operand:"@contact.groups"}},Zb={type:"split_by_random",name:"Split by Random",color:vb,form:{categories:{type:"array",label:"Buckets",helpText:"Define the buckets to randomly split contacts into",required:!0,itemLabel:"Bucket",sortable:!0,minItems:2,maxItems:10,isEmptyItem:t=>!t.name||""===t.name.trim(),itemConfig:{name:{type:"text",placeholder:"Bucket name",required:!0}}}},layout:["categories"],validate:t=>{const e={};if(t.categories&&Array.isArray(t.categories)){const i=t.categories.filter((t=>(null==t?void 0:t.name)&&""!==t.name.trim()));i.length<2&&(e.categories="At least 2 buckets are required for random split");const n=[],o=new Map;if(i.forEach((t=>{const e=t.name.trim().toLowerCase();o.has(e)||o.set(e,[]),o.get(e).push(t.name.trim())})),o.forEach((t=>{t.length>1&&n.push(...t)})),n.length>0){const t=[...new Set(n)];e.categories=`Duplicate bucket names found: ${t.join(", ")}`}}return{valid:0===Object.keys(e).length,errors:e}},toFormData:t=>{var e,i;const n=(null===(i=null===(e=t.router)||void 0===e?void 0:e.categories)||void 0===i?void 0:i.map((t=>({name:t.name}))))||[];return{uuid:t.uuid,categories:n}},fromFormData:(t,e)=>{var i;const n=(t.categories||[]).filter((t=>{var e;return null===(e=null==t?void 0:t.name)||void 0===e?void 0:e.trim()})).map((t=>t.name.trim())),o=(null===(i=e.router)||void 0===i?void 0:i.categories)||[],s=e.exits||[],{router:r,exits:a}=((t,e=[],i=[])=>{const n=[],o=[];return t.forEach((t=>{const s=e.find((e=>e.name===t)),r=s?i.find((t=>t.uuid===s.exit_uuid)):null,a=(null==r?void 0:r.uuid)||Yt(),l=(null==s?void 0:s.uuid)||Yt();n.push({uuid:l,name:t,exit_uuid:a}),o.push({uuid:a,destination_uuid:(null==r?void 0:r.destination_uuid)||null})})),{router:{type:"random",categories:n},exits:o}})(n,o,s);return{uuid:e.uuid,actions:e.actions||[],router:r,exits:a}},router:{type:"random"}},Yb={type:"split_by_run_result",name:"Split by Flow Result",color:vb},Xb={type:"split_by_scheme",name:"Split by URN Type",color:vb},Kb={type:"split_by_subflow",name:"Enter a Flow",color:yb,form:{flow:{type:"select",required:!0,placeholder:"Select a flow...",helpText:"Once the subflow is complete or expires, the contact will return here",endpoint:"/api/v2/flows.json",valueKey:"uuid",nameKey:"name"}},layout:["flow"],render:t=>{var e,i;const n=null===(e=t.actions)||void 0===e?void 0:e.find((t=>"enter_flow"===t.type));return U`
|
|
8262
8214
|
<div class="body">
|
|
8263
8215
|
${(null===(i=null==n?void 0:n.flow)||void 0===i?void 0:i.name)||"Configure subflow"}
|
|
8264
8216
|
</div>
|
|
@@ -8280,9 +8232,9 @@ const{I:vd}=at,yd=()=>document.createComment(""),bd=(t,e,i)=>{const n=t._$AA.par
|
|
|
8280
8232
|
>
|
|
8281
8233
|
${(null==i?void 0:i.instructions)||"Configure AI instructions"}
|
|
8282
8234
|
</div>
|
|
8283
|
-
`},form:{llm:{type:"select",label:"LLM",required:!0,options:[],endpoint:"/test-assets/select/llms.json",searchable:!0,valueKey:"uuid",nameKey:"name",placeholder:"Select an LLM..."},input:{type:"text",label:"Input",helpText:"The input the AI will process",required:!0,evaluated:!0,placeholder:"@input"},instructions:{type:"textarea",label:"Instructions",helpText:"Tell the AI what to do with the input. The result can be referenced as **`@locals._llm_output`**",required:!0,evaluated:!0,placeholder:"Enter instructions for the AI model...",minHeight:130}},layout:["llm","input","instructions"],toFormData:t=>{var e;const i=null===(e=t.actions)||void 0===e?void 0:e.find((t=>"call_llm"===t.type));return{uuid:t.uuid,llm:(null==i?void 0:i.llm)?[{value:i.llm.uuid,name:i.llm.name}]:[],input:(null==i?void 0:i.input)||"@input",instructions:(null==i?void 0:i.instructions)||""}},fromFormData:(t,e)=>{var i,n,o;const s=Array.isArray(t.llm)&&t.llm.length>0?t.llm[0]:null,r=null===(i=e.actions)||void 0===i?void 0:i.find((t=>"call_llm"===t.type)),a={type:"call_llm",uuid:(null==r?void 0:r.uuid)||Yt(),llm:s?{uuid:s.value,name:s.name}:{uuid:"",name:""},input:t.input||"@input",instructions:t.instructions||"",output_local:"_llm_output"},l=(null===(n=e.router)||void 0===n?void 0:n.categories)||[],c=e.exits||[],h=(null===(o=e.router)||void 0===o?void 0:o.cases)||[],{router:d,exits:u}=ke("@locals._llm_output",{type:"has_text",arguments:[]},l,c,h);return{uuid:e.uuid,actions:[a],router:d,exits:u}}},ix={type:"split_by_llm_categorize",name:"Split by AI",color:gb,form:{llm:{type:"select",label:"LLM",helpText:"Select the LLM to use for categorization",required:!0,endpoint:"/test-assets/select/llms.json",valueKey:"uuid",nameKey:"name",placeholder:"Select an LLM..."},input:{type:"text",label:"Input",helpText:"The input to categorize (usually @input)",required:!0,evaluated:!0,placeholder:"@input"},categories:{type:"array",label:"Categories",helpText:"Define the categories for classification",required:!0,itemLabel:"Category",minItems:1,maxItems:10,isEmptyItem:t=>!t.name||""===t.name.trim(),itemConfig:{name:{type:"text",placeholder:"Category name",required:!0}}}},layout:["llm","input","categories"],validate:t=>{const e={};if(t.categories&&Array.isArray(t.categories)){const i=t.categories.filter((t=>(null==t?void 0:t.name)&&""!==t.name.trim())),n=[],o=new Map;if(i.forEach((t=>{const e=t.name.trim().toLowerCase();o.has(e)||o.set(e,[]),o.get(e).push(t.name.trim())})),o.forEach((t=>{t.length>1&&n.push(...t)})),n.length>0){const t=[...new Set(n)];e.categories=`Duplicate category names found: ${t.join(", ")}`}}return{valid:0===Object.keys(e).length,errors:e}},render:t=>{var e;const i=null===(e=t.actions)||void 0===e?void 0:e.find((t=>"call_llm"===t.type));return U`
|
|
8235
|
+
`},form:{llm:{type:"select",label:"LLM",required:!0,options:[],endpoint:"/test-assets/select/llms.json",searchable:!0,valueKey:"uuid",nameKey:"name",placeholder:"Select an LLM..."},input:{type:"text",label:"Input",helpText:"The input the AI will process",required:!0,evaluated:!0,placeholder:"@input"},instructions:{type:"textarea",label:"Instructions",helpText:"Tell the AI what to do with the input. The result can be referenced as **`@locals._llm_output`**",required:!0,evaluated:!0,placeholder:"Enter instructions for the AI model...",minHeight:130}},layout:["llm","input","instructions"],toFormData:t=>{var e;const i=null===(e=t.actions)||void 0===e?void 0:e.find((t=>"call_llm"===t.type));return{uuid:t.uuid,llm:(null==i?void 0:i.llm)?[{value:i.llm.uuid,name:i.llm.name}]:[],input:(null==i?void 0:i.input)||"@input",instructions:(null==i?void 0:i.instructions)||""}},fromFormData:(t,e)=>{var i,n,o;const s=Array.isArray(t.llm)&&t.llm.length>0?t.llm[0]:null,r=null===(i=e.actions)||void 0===i?void 0:i.find((t=>"call_llm"===t.type)),a={type:"call_llm",uuid:(null==r?void 0:r.uuid)||Yt(),llm:s?{uuid:s.value,name:s.name}:{uuid:"",name:""},input:t.input||"@input",instructions:t.instructions||"",output_local:"_llm_output"},l=(null===(n=e.router)||void 0===n?void 0:n.categories)||[],c=e.exits||[],h=(null===(o=e.router)||void 0===o?void 0:o.cases)||[],{router:d,exits:u}=ke("@locals._llm_output",{type:"has_text",arguments:[]},l,c,h);return{uuid:e.uuid,actions:[a],router:d,exits:u}}},ix={type:"split_by_llm_categorize",name:"Split by AI",color:gb,form:{llm:{type:"select",label:"LLM",helpText:"Select the LLM to use for categorization",required:!0,endpoint:"/test-assets/select/llms.json",valueKey:"uuid",nameKey:"name",placeholder:"Select an LLM..."},input:{type:"text",label:"Input",helpText:"The input to categorize (usually @input)",required:!0,evaluated:!0,placeholder:"@input"},categories:{type:"array",label:"Categories",helpText:"Define the categories for classification",required:!0,sortable:!0,itemLabel:"Category",minItems:1,maxItems:10,isEmptyItem:t=>!t.name||""===t.name.trim(),itemConfig:{name:{type:"text",placeholder:"Category name",required:!0}}}},layout:["llm","input","categories"],validate:t=>{const e={};if(t.categories&&Array.isArray(t.categories)){const i=t.categories.filter((t=>(null==t?void 0:t.name)&&""!==t.name.trim())),n=[],o=new Map;if(i.forEach((t=>{const e=t.name.trim().toLowerCase();o.has(e)||o.set(e,[]),o.get(e).push(t.name.trim())})),o.forEach((t=>{t.length>1&&n.push(...t)})),n.length>0){const t=[...new Set(n)];e.categories=`Duplicate category names found: ${t.join(", ")}`}}return{valid:0===Object.keys(e).length,errors:e}},render:t=>{var e;const i=null===(e=t.actions)||void 0===e?void 0:e.find((t=>"call_llm"===t.type));return U`
|
|
8284
8236
|
<div class="body">Categorize with ${i.llm.name}</div>
|
|
8285
|
-
`},toFormData:t=>{var e,i,n;const o=null===(e=t.actions)||void 0===e?void 0:e.find((t=>"call_llm"===t.type)),s=(null===(n=null===(i=t.router)||void 0===i?void 0:i.categories)||void 0===n?void 0:n.filter((t=>"Other"!==t.name&&"Failure"!==t.name)).map((t=>({name:t.name}))))||[];return{uuid:t.uuid,llm:(null==o?void 0:o.llm)?[{value:o.llm.uuid,name:o.llm.name}]:[],input:(null==o?void 0:o.input)||"@input",categories:s}},fromFormData:(t,e)=>{var i,n,o;const s=Array.isArray(t.llm)&&t.llm.length>0?t.llm[0]:null,r=(t.categories||[]).filter((t=>{var e;return null===(e=null==t?void 0:t.name)||void 0===e?void 0:e.trim()})).map((t=>t.name.trim())),a=null===(i=e.actions)||void 0===i?void 0:i.find((t=>"call_llm"===t.type)),l={type:"call_llm",uuid:(null==a?void 0:a.uuid)||Yt(),llm:s?{uuid:s.value,name:s.name}:{uuid:"",name:""},instructions:'@(prompt("categorize", slice(node.categories, 0, -2)))',input:t.input||"@input",output_local:"_llm_output"},c=(null===(n=e.router)||void 0===n?void 0:n.categories)||[],h=e.exits||[],d=(null===(o=e.router)||void 0===o?void 0:o.cases)||[],{router:u,exits:p}=((t,e,i,n=[],o=[],s=[])=>{const r=[],a=[],l=[];e.forEach((t=>{const e=we({name:t,existingCategories:n,existingExits:o,existingCases:s,caseConfig:i(t)});r.push(e.category),a.push(e.exit),e.case&&l.push(e.case)}));const c=we({name:"Other",existingCategories:n,existingExits:o});r.push(c.category),a.push(c.exit);const h=we({name:"Failure",existingCategories:n,existingExits:o,existingCases:s,caseConfig:{type:"has_only_text",arguments:["<ERROR>"]}});return r.push(h.category),a.push(h.exit),h.case&&l.push(h.case),{router:{type:"switch",categories:r,default_category_uuid:c.category.uuid,operand:t,cases:l},exits:a}})("@locals._llm_output",r,(t=>({type:"has_only_text",arguments:[t]})),c,h,d);return{uuid:e.uuid,actions:[l],router:u,exits:p}}},nx={type:"wait_for_audio",name:"Wait for Audio",color:bb},ox={type:"wait_for_digits",name:"Wait for Digits",color:bb},sx={type:"wait_for_image",name:"Wait for Image",color:bb},rx={type:"wait_for_location",name:"Wait for Location",color:bb},ax={type:"wait_for_menu",name:"Wait for Menu Selection",color:bb},lx=[{type:"has_any_word",name:"has any of the words",operands:1},{type:"has_all_words",name:"has all of the words",operands:1},{type:"has_phrase",name:"has the phrase",operands:1},{type:"has_only_phrase",name:"has only the phrase",operands:1},{type:"has_beginning",name:"starts with",operands:1},{type:"has_text",name:"has some text",operands:0,categoryName:"Has Text"},{type:"has_pattern",name:"matches regex",operands:1},{type:"has_number",name:"has a number",operands:0,categoryName:"Has Number"},{type:"has_number_between",name:"has a number between",operands:2},{type:"has_number_lt",name:"has a number below",operands:1},{type:"has_number_lte",name:"has a number at or below",operands:1},{type:"has_number_eq",name:"has a number equal to",operands:1},{type:"has_number_gte",name:"has a number at or above",operands:1},{type:"has_number_gt",name:"has a number above",operands:1},{type:"has_date",name:"has a date",operands:0,categoryName:"Has Date"},{type:"has_date_lt",name:"has a date before",operands:1},{type:"has_date_eq",name:"has a date equal to",operands:1},{type:"has_date_gt",name:"has a date after",operands:1},{type:"has_time",name:"has a time",operands:0,categoryName:"Has Time"},{type:"has_phone",name:"has a phone number",operands:0,categoryName:"Has Phone"},{type:"has_email",name:"has an email",operands:0,categoryName:"Has Email"},{type:"has_state",name:"has state",operands:0,categoryName:"Has State",filter:"HAS_LOCATIONS"},{type:"has_district",name:"has district",operands:1,categoryName:"Has District",filter:"HAS_LOCATIONS"},{type:"has_ward",name:"has ward",operands:2,categoryName:"Has Ward",filter:"HAS_LOCATIONS"},{type:"has_group",name:"is in the group",operands:1,visibility:"hidden"},{type:"has_category",name:"has the category",operands:0,visibility:"hidden"},{type:"has_error",name:"has an error",operands:0,categoryName:"Has Error",visibility:"hidden"},{type:"has_value",name:"is not empty",operands:0,categoryName:"Not Empty",visibility:"hidden"}],cx=t=>lx.find((e=>e.type===t)),hx=[{value:"60",name:"1 minute"},{value:"120",name:"2 minutes"},{value:"180",name:"3 minutes"},{value:"240",name:"4 minutes"},{value:"300",name:"5 minutes"},{value:"600",name:"10 minutes"},{value:"900",name:"15 minutes"},{value:"1800",name:"30 minutes"},{value:"3600",name:"1 hour"},{value:"7200",name:"2 hours"},{value:"10800",name:"3 hours"},{value:"21600",name:"6 hours"},{value:"43200",name:"12 hours"},{value:"64800",name:"18 hours"},{value:"86400",name:"1 day"},{value:"172800",name:"2 days"},{value:"259200",name:"3 days"},{value:"604800",name:"1 week"}],dx={type:"wait_for_response",name:"Wait for Response",color:bb,dialogSize:"large",form:{rules:{type:"array",helpText:"Define rules to categorize responses",itemLabel:"Rule",minItems:0,maxItems:100,maintainEmptyItem:!0,isEmptyItem:t=>{const e=(t=>{if("string"==typeof t)return t.trim();if(Array.isArray(t)&&t.length>0){const e=t[0];if(e&&"object"==typeof e&&e.value)return e.value.trim()}else if(t&&"object"==typeof t&&t.value)return t.value.trim();return""})(t.operator);if(!e||!t.category||""===t.category.trim())return!0;const i=cx(e);return i&&1===i.operands?!t.value1||""===t.value1.trim():!(!i||2!==i.operands)&&(!t.value1||""===t.value1.trim()||!t.value2||""===t.value2.trim())},itemConfig:{operator:{type:"select",required:!0,multi:!1,options:(ux=lx.filter((t=>"hidden"!==t.visibility&&!t.filter)),ux.map((t=>({value:t.type,name:t.name})))),flavor:"xsmall",width:"200px"},value1:{type:"text",flavor:"xsmall",conditions:{visible:t=>{const e=(t=>{if("string"==typeof t)return t.trim();if(Array.isArray(t)&&t.length>0){const e=t[0];if(e&&"object"==typeof e&&e.value)return e.value.trim()}else if(t&&"object"==typeof t&&t.value)return t.value.trim();return""})(t.operator),i=cx(e);return!i||i.operands>=1}}},value2:{type:"text",flavor:"xsmall",conditions:{visible:t=>{const e=(t=>{if("string"==typeof t)return t.trim();if(Array.isArray(t)&&t.length>0){const e=t[0];if(e&&"object"==typeof e&&e.value)return e.value.trim()}else if(t&&"object"==typeof t&&t.value)return t.value.trim();return""})(t.operator),i=cx(e);return!!i&&2===i.operands}}},category:{type:"text",placeholder:"Category",required:!0,maxWidth:"120px",flavor:"xsmall"}}},timeout_enabled:{type:"checkbox",label:t=>t.timeout_enabled?"Continue when there is no response for":"Continue when there is no response..",labelPadding:"4px 8px"},timeout_duration:{type:"select",placeholder:"5 minutes",multi:!1,maxWidth:"150px",flavor:"xsmall",options:hx,conditions:{visible:t=>!0===t.timeout_enabled}},result_name:{type:"text",label:"Result Name",helpText:"The name to save the response as",placeholder:"response"}},layout:["rules","result_name"],gutter:[{type:"row",items:["timeout_enabled","timeout_duration"],gap:"0.5rem"}],validate:t=>{const e={};return{valid:0===Object.keys(e).length,errors:e}},toFormData:t=>{var e,i,n,o,s,r;const a=[];(null===(e=t.router)||void 0===e?void 0:e.cases)&&(null===(i=t.router)||void 0===i?void 0:i.categories)&&t.router.cases.forEach((e=>{const i=t.router.categories.find((t=>t.uuid===e.category_uuid));if(i&&"No Response"!==i.name&&"Other"!==i.name){const t=cx(e.type),n=t?t.name:e.type;let o="",s="";t&&0===t.operands?(o="",s=""):t&&1===t.operands?(o=e.arguments.join(" "),s=""):t&&2===t.operands?(o=e.arguments[0]||"",s=e.arguments[1]||""):(o=e.arguments.join(" "),s=""),a.push({operator:{value:e.type,name:n},value1:o,value2:s,category:i.name})}}));const l=null===(s=null===(o=null===(n=t.router)||void 0===n?void 0:n.wait)||void 0===o?void 0:o.timeout)||void 0===s?void 0:s.seconds;let c=hx.find((t=>t.value===String(l)));return c||(c={value:"300",name:"5 minutes"}),{uuid:t.uuid,rules:a,timeout_enabled:!!l,timeout_duration:c,result_name:(null===(r=t.router)||void 0===r?void 0:r.result_name)||"response"}},fromFormData:(t,e)=>{var i,n,o,s,r,a,l,c,h,d;const u=t=>{if("string"==typeof t)return t.trim();if(Array.isArray(t)&&t.length>0){const e=t[0];if(e&&"object"==typeof e&&e.value)return e.value.trim()}else if(t&&"object"==typeof t&&t.value)return t.value.trim();return""},p=(t.rules||[]).filter((t=>{const e=u(null==t?void 0:t.operator);if(!e||!(null==t?void 0:t.category)||""===e||""===t.category.trim())return!1;const i=cx(e);return i&&1===i.operands?(null==t?void 0:t.value1)&&""!==t.value1.trim():!i||2!==i.operands||(null==t?void 0:t.value1)&&""!==t.value1.trim()&&(null==t?void 0:t.value2)&&""!==t.value2.trim()})).map((t=>{const e=u(t.operator),i=cx(e);let n="";if(i&&1===i.operands)n=t.value1?t.value1.trim():"";else if(i&&2===i.operands){n=`${t.value1?t.value1.trim():""} ${t.value2?t.value2.trim():""}`.trim()}else n="";return{operator:e,value:n,category:t.category.trim()}}));if(0===p.length){const s={...e.router,result_name:t.result_name||"response"};void 0!==(null===(i=e.router)||void 0===i?void 0:i.cases)&&(s.cases=[]);const r={type:"msg"};if(t.timeout_enabled){let i;i=t.timeout_duration?Array.isArray(t.timeout_duration)&&t.timeout_duration.length>0?parseInt(t.timeout_duration[0].value,10):"string"==typeof t.timeout_duration?parseInt(t.timeout_duration,10):t.timeout_duration&&"object"==typeof t.timeout_duration&&t.timeout_duration.value?parseInt(t.timeout_duration.value,10):300:300,(isNaN(i)||i<=0)&&(i=300);let a=null===(o=null===(n=e.router)||void 0===n?void 0:n.categories)||void 0===o?void 0:o.find((t=>"No Response"===t.name));a||(a={uuid:Yt(),name:"No Response",exit_uuid:Yt()},s.categories=s.categories||[],s.categories.push(a)),r.timeout={seconds:i,category_uuid:a.uuid}}return s.wait=r,{...e,router:s}}const m=(null===(s=e.router)||void 0===s?void 0:s.categories)||[],g=e.exits||[],f=(null===(r=e.router)||void 0===r?void 0:r.cases)||[],{router:v,exits:y}=((t,e=[],i=[],n=[])=>{var o;const s=[],r=[],a=[],l=e.filter((t=>"No Response"!==t.name&&"Other"!==t.name&&"Timeout"!==t.name)),c=new Map;t.forEach((t=>{const e=t.category.trim().toLowerCase();c.has(e)||c.set(e,[]),c.get(e).push(t)}));const h=[];if(t.forEach((t=>{const e=t.category.trim().toLowerCase();h.includes(e)||h.push(e)})),h.forEach(((e,o)=>{const h=c.get(e),d=h[0].category.trim(),u=l[o],p=u?i.find((t=>t.uuid===u.exit_uuid)):null,m=(null==p?void 0:p.uuid)||Yt(),g=(null==u?void 0:u.uuid)||Yt();s.push({uuid:g,name:d,exit_uuid:m}),r.push({uuid:m,destination_uuid:(null==p?void 0:p.destination_uuid)||null}),h.forEach((e=>{const i=t.findIndex((t=>t===e)),o=n[i],s=(null==o?void 0:o.uuid)||Yt(),r=cx(e.operator);let l=[];l=r?0===r.operands?[]:2===r.operands?e.value.split(" ").filter((t=>t.trim())):e.value&&e.value.trim()?e.value.trim().split(/\s+/).filter((t=>t.length>0)):[]:e.value&&e.value.trim()?e.value.trim().split(/\s+/).filter((t=>t.length>0)):[],a.push({uuid:s,type:e.operator,arguments:l,category_uuid:g})}))})),e.forEach((t=>{if("No Response"===t.name||"Timeout"===t.name){const e=i.find((e=>e.uuid===t.exit_uuid));e&&(s.push(t),r.push(e))}})),t.length>0){const t=e.find((t=>"Other"===t.name)),n=t?i.find((e=>e.uuid===t.exit_uuid)):null,o=(null==n?void 0:n.uuid)||Yt(),a=(null==t?void 0:t.uuid)||Yt();s.push({uuid:a,name:"Other",exit_uuid:o}),r.push({uuid:o,destination_uuid:(null==n?void 0:n.destination_uuid)||null})}return{router:{type:"switch",categories:s,default_category_uuid:null===(o=s.find((t=>"Other"===t.name)))||void 0===o?void 0:o.uuid,operand:"@input.text",cases:a},exits:r}})(p,m,g,f),b={...v,result_name:t.result_name||"response"},x={type:"msg"};try{if(t.timeout_enabled){let i;if(t.timeout_duration)try{i=parseInt(t.timeout_duration[0].value,10)}catch(t){i=300}const n=null===(l=null===(a=e.router)||void 0===a?void 0:a.categories)||void 0===l?void 0:l.find((t=>"No Response"===t.name)),o=n||{uuid:Yt(),name:"No Response",exit_uuid:Yt()};if(x.timeout={seconds:i,category_uuid:o.uuid},!(null===(c=v.categories)||void 0===c?void 0:c.some((t=>"No Response"===t.name)))&&(v.categories=v.categories||[],v.categories.push(o),!y.some((t=>t.uuid===o.exit_uuid)))){const t={uuid:o.exit_uuid,destination_uuid:(null==n?void 0:n.exit_uuid)&&(null===(d=null===(h=e.exits)||void 0===h?void 0:h.find((t=>t.uuid===n.exit_uuid)))||void 0===d?void 0:d.destination_uuid)||null};y.push(t)}}else if(v.categories){const t=v.categories.findIndex((t=>"No Response"===t.name));if(-1!==t){const e=v.categories[t];v.categories.splice(t,1);const i=y.findIndex((t=>t.uuid===e.exit_uuid));-1!==i&&y.splice(i,1)}}}catch(t){console.error("Error processing timeout configuration:",t)}return b.wait=x,{...e,router:b,exits:y}}};var ux;const px={add_input_labels:Cb,add_contact_urn:Sb,set_contact_field:Eb,set_contact_channel:Ab,set_contact_language:Mb,set_contact_status:Tb,send_broadcast:Pb,set_run_result:Db,send_msg:Ib,send_email:Ob,start_session:$b,call_classifier:Lb,call_resthook:zb,transfer_airtime:Rb,set_contact_name:Nb,add_contact_groups:jb,remove_contact_groups:Bb,request_optin:Fb,say_msg:qb,play_audio:Vb},mx={execute_actions:{type:"execute_actions"},split_by_airtime:Hb,split_by_contact_field:Ub,split_by_expression:Wb,split_by_groups:Gb,split_by_llm:ex,split_by_llm_categorize:ix,split_by_random:Zb,split_by_run_result:Yb,split_by_scheme:Xb,split_by_subflow:Kb,split_by_ticket:Qb,split_by_webhook:tx,wait_for_audio:nx,wait_for_digits:ox,wait_for_image:sx,wait_for_location:rx,wait_for_menu:ax,wait_for_response:dx,wait_for_video:{type:"wait_for_video",name:"Wait for Video",color:bb}};class gx extends Ae{createRenderRoot(){return this}static get styles(){return a`
|
|
8237
|
+
`},toFormData:t=>{var e,i,n;const o=null===(e=t.actions)||void 0===e?void 0:e.find((t=>"call_llm"===t.type)),s=(null===(n=null===(i=t.router)||void 0===i?void 0:i.categories)||void 0===n?void 0:n.filter((t=>"Other"!==t.name&&"Failure"!==t.name)).map((t=>({name:t.name}))))||[];return{uuid:t.uuid,llm:(null==o?void 0:o.llm)?[{value:o.llm.uuid,name:o.llm.name}]:[],input:(null==o?void 0:o.input)||"@input",categories:s}},fromFormData:(t,e)=>{var i,n,o;const s=Array.isArray(t.llm)&&t.llm.length>0?t.llm[0]:null,r=(t.categories||[]).filter((t=>{var e;return null===(e=null==t?void 0:t.name)||void 0===e?void 0:e.trim()})).map((t=>t.name.trim())),a=null===(i=e.actions)||void 0===i?void 0:i.find((t=>"call_llm"===t.type)),l={type:"call_llm",uuid:(null==a?void 0:a.uuid)||Yt(),llm:s?{uuid:s.value,name:s.name}:{uuid:"",name:""},instructions:'@(prompt("categorize", slice(node.categories, 0, -2)))',input:t.input||"@input",output_local:"_llm_output"},c=(null===(n=e.router)||void 0===n?void 0:n.categories)||[],h=e.exits||[],d=(null===(o=e.router)||void 0===o?void 0:o.cases)||[],{router:u,exits:p}=((t,e,i,n=[],o=[],s=[])=>{const r=[],a=[],l=[];e.forEach((t=>{const e=we({name:t,existingCategories:n,existingExits:o,existingCases:s,caseConfig:i(t)});r.push(e.category),a.push(e.exit),e.case&&l.push(e.case)}));const c=we({name:"Other",existingCategories:n,existingExits:o});r.push(c.category),a.push(c.exit);const h=we({name:"Failure",existingCategories:n,existingExits:o,existingCases:s,caseConfig:{type:"has_only_text",arguments:["<ERROR>"]}});return r.push(h.category),a.push(h.exit),h.case&&l.push(h.case),{router:{type:"switch",categories:r,default_category_uuid:c.category.uuid,operand:t,cases:l},exits:a}})("@locals._llm_output",r,(t=>({type:"has_only_text",arguments:[t]})),c,h,d);return{uuid:e.uuid,actions:[l],router:u,exits:p}}},nx={type:"wait_for_audio",name:"Wait for Audio",color:bb},ox={type:"wait_for_digits",name:"Wait for Digits",color:bb},sx={type:"wait_for_image",name:"Wait for Image",color:bb},rx={type:"wait_for_location",name:"Wait for Location",color:bb},ax={type:"wait_for_menu",name:"Wait for Menu Selection",color:bb},lx=[{type:"has_any_word",name:"has any of the words",operands:1},{type:"has_all_words",name:"has all of the words",operands:1},{type:"has_phrase",name:"has the phrase",operands:1},{type:"has_only_phrase",name:"has only the phrase",operands:1},{type:"has_beginning",name:"starts with",operands:1},{type:"has_text",name:"has some text",operands:0,categoryName:"Has Text"},{type:"has_pattern",name:"matches regex",operands:1},{type:"has_number",name:"has a number",operands:0,categoryName:"Has Number"},{type:"has_number_between",name:"has a number between",operands:2},{type:"has_number_lt",name:"has a number below",operands:1},{type:"has_number_lte",name:"has a number at or below",operands:1},{type:"has_number_eq",name:"has a number equal to",operands:1},{type:"has_number_gte",name:"has a number at or above",operands:1},{type:"has_number_gt",name:"has a number above",operands:1},{type:"has_date",name:"has a date",operands:0,categoryName:"Has Date"},{type:"has_date_lt",name:"has a date before",operands:1},{type:"has_date_eq",name:"has a date equal to",operands:1},{type:"has_date_gt",name:"has a date after",operands:1},{type:"has_time",name:"has a time",operands:0,categoryName:"Has Time"},{type:"has_phone",name:"has a phone number",operands:0,categoryName:"Has Phone"},{type:"has_email",name:"has an email",operands:0,categoryName:"Has Email"},{type:"has_state",name:"has state",operands:0,categoryName:"Has State",filter:"HAS_LOCATIONS"},{type:"has_district",name:"has district",operands:1,categoryName:"Has District",filter:"HAS_LOCATIONS"},{type:"has_ward",name:"has ward",operands:2,categoryName:"Has Ward",filter:"HAS_LOCATIONS"},{type:"has_group",name:"is in the group",operands:1,visibility:"hidden"},{type:"has_category",name:"has the category",operands:0,visibility:"hidden"},{type:"has_error",name:"has an error",operands:0,categoryName:"Has Error",visibility:"hidden"},{type:"has_value",name:"is not empty",operands:0,categoryName:"Not Empty",visibility:"hidden"}],cx=t=>lx.find((e=>e.type===t)),hx=[{value:"60",name:"1 minute"},{value:"120",name:"2 minutes"},{value:"180",name:"3 minutes"},{value:"240",name:"4 minutes"},{value:"300",name:"5 minutes"},{value:"600",name:"10 minutes"},{value:"900",name:"15 minutes"},{value:"1800",name:"30 minutes"},{value:"3600",name:"1 hour"},{value:"7200",name:"2 hours"},{value:"10800",name:"3 hours"},{value:"21600",name:"6 hours"},{value:"43200",name:"12 hours"},{value:"64800",name:"18 hours"},{value:"86400",name:"1 day"},{value:"172800",name:"2 days"},{value:"259200",name:"3 days"},{value:"604800",name:"1 week"}],dx=t=>["No Response","Other","All Responses","Timeout"].includes(t),ux=(t,e)=>{const i=e.find((e=>e.uuid===t));return!!i&&dx(i.name)},px=(t,e,i)=>{const n=cx(t);if(!n)return"";if(0===n.operands)return n.categoryName||"";const o=(e||"").trim(),s=(i||"").trim(),r=t=>t?t.charAt(0).toUpperCase()+t.slice(1).toLowerCase():"";switch(t){case"has_any_word":case"has_all_words":case"has_phrase":case"has_only_phrase":case"has_beginning":default:return o?r(o):"";case"has_pattern":return o;case"has_number_eq":return o?`= ${o}`:"";case"has_number_lt":return o?`< ${o}`:"";case"has_number_lte":return o?`≤ ${o}`:"";case"has_number_gt":return o?`> ${o}`:"";case"has_number_gte":return o?`≥ ${o}`:"";case"has_number_between":return o&&s?`${o} - ${s}`:"";case"has_date_lt":case"has_date_lte":if(o){const t=o.match(/^(today)\s*([+-])\s*(\d+)$/i);if(t){const[,e,i,n]=t;return`Before ${e} ${i} ${n} ${"1"===n?"day":"days"}`}return`Before ${o}`}return"";case"has_date_gt":case"has_date_gte":if(o){const t=o.match(/^(today)\s*([+-])\s*(\d+)$/i);if(t){const[,e,i,n]=t;return`After ${e} ${i} ${n} ${"1"===n?"day":"days"}`}return`After ${o}`}return"";case"has_date_eq":if(o){const t=o.match(/^(today)\s*([+-])\s*(\d+)$/i);if(t){const[,e,i,n]=t;return`${e} ${i} ${n} ${"1"===n?"day":"days"}`}return o}return""}},mx=(t,e=[],i=[],n=[])=>{const o=[],s=[],r=[],a=e.filter((t=>!dx(t.name))),l=new Map;t.forEach(((t,c)=>{const h=t.category.trim().toLowerCase(),d=t.category.trim();let u=l.get(h);if(!u){let t=a.find((t=>t.name.toLowerCase()===h));const n=Array.from(l.keys()).length;if(!t&&n<a.length){const i=a[n];i&&!ux(i.uuid,e)&&(t=i)}const r=t?i.find((e=>e.uuid===t.exit_uuid)):null;let c=(null==r?void 0:r.uuid)||Yt(),p=(null==t?void 0:t.uuid)||Yt();ux(p,e)&&(p=Yt(),c=Yt()),u={uuid:p,name:d,exit_uuid:c},l.set(h,u),o.push({uuid:p,name:d,exit_uuid:c}),s.push({uuid:c,destination_uuid:(null==r?void 0:r.destination_uuid)||null})}let p=n[c];!p&&n.length>0&&(p=n.find((i=>{const n=e.find((t=>t.uuid===i.category_uuid));return i.type===t.operator&&(null==n?void 0:n.name.toLowerCase())===h})));const m=(null==p?void 0:p.uuid)||Yt(),g=cx(t.operator);let f=[];f=g?0===g.operands?[]:2===g.operands?t.value.split(" ").filter((t=>t.trim())):t.value&&t.value.trim()?t.value.trim().split(/\s+/).filter((t=>t.length>0)):[]:t.value&&t.value.trim()?t.value.trim().split(/\s+/).filter((t=>t.length>0)):[],r.push({uuid:m,type:t.operator,arguments:f,category_uuid:u.uuid})}));const c=t.length>0?"Other":"All Responses";let h=e.find((t=>t.name===c));if(!h){const i=t.length>0?"All Responses":"Other";h=e.find((t=>t.name===i))}const d=h?i.find((t=>t.uuid===h.exit_uuid)):null,u=(null==d?void 0:d.uuid)||Yt(),p=(null==h?void 0:h.uuid)||Yt();o.push({uuid:p,name:c,exit_uuid:u}),s.push({uuid:u,destination_uuid:(null==d?void 0:d.destination_uuid)||null});const m=e.find((t=>"No Response"===t.name||"Timeout"===t.name));if(m){const t=i.find((t=>t.uuid===m.exit_uuid));t&&(o.push(m),s.push(t))}const g=o.find((t=>"Other"===t.name||"All Responses"===t.name));return{router:{type:"switch",categories:o,default_category_uuid:null==g?void 0:g.uuid,operand:"@input.text",cases:r},exits:s}},gx={type:"wait_for_response",name:"Wait for Response",color:bb,dialogSize:"large",form:{rules:{type:"array",helpText:"Define rules to categorize responses",itemLabel:"Rule",minItems:0,maxItems:100,sortable:!0,maintainEmptyItem:!0,isEmptyItem:t=>{const e=(t=>{if("string"==typeof t)return t.trim();if(Array.isArray(t)&&t.length>0){const e=t[0];if(e&&"object"==typeof e&&e.value)return e.value.trim()}else if(t&&"object"==typeof t&&t.value)return t.value.trim();return""})(t.operator);if(!e||!t.category||""===t.category.trim())return!0;const i=cx(e);return i&&1===i.operands?!t.value1||""===t.value1.trim():!(!i||2!==i.operands)&&(!t.value1||""===t.value1.trim()||!t.value2||""===t.value2.trim())},onItemChange:(t,e,i,n)=>{const o=[...n],s={...o[t]},r=t=>{if("string"==typeof t)return t.trim();if(Array.isArray(t)&&t.length>0){const e=t[0];if(e&&"object"==typeof e&&e.value)return e.value.trim()}else if(t&&"object"==typeof t&&t.value)return t.value.trim();return""};s[e]=i;const a=n[t]||{},l=r("operator"===e?a.operator:s.operator),c=r(s.operator),h=px(l,"value1"===e?a.value1:s.value1,"value2"===e?a.value2:s.value2),d=px(c,s.value1,s.value2);return(!s.category||""===s.category.trim()||s.category===h)&&d&&(s.category=d),o[t]=s,o},itemConfig:{operator:{type:"select",required:!0,multi:!1,options:(fx=lx.filter((t=>"hidden"!==t.visibility&&!t.filter)),fx.map((t=>({value:t.type,name:t.name})))),flavor:"xsmall",width:"200px"},value1:{type:"text",flavor:"xsmall",conditions:{visible:t=>{const e=(t=>{if("string"==typeof t)return t.trim();if(Array.isArray(t)&&t.length>0){const e=t[0];if(e&&"object"==typeof e&&e.value)return e.value.trim()}else if(t&&"object"==typeof t&&t.value)return t.value.trim();return""})(t.operator),i=cx(e);return!i||i.operands>=1}}},value2:{type:"text",flavor:"xsmall",conditions:{visible:t=>{const e=(t=>{if("string"==typeof t)return t.trim();if(Array.isArray(t)&&t.length>0){const e=t[0];if(e&&"object"==typeof e&&e.value)return e.value.trim()}else if(t&&"object"==typeof t&&t.value)return t.value.trim();return""})(t.operator),i=cx(e);return!!i&&2===i.operands}}},category:{type:"text",placeholder:"Category",required:!0,maxWidth:"120px",flavor:"xsmall"}}},timeout_enabled:{type:"checkbox",label:t=>t.timeout_enabled?"Continue when there is no response for":"Continue when there is no response..",labelPadding:"4px 8px"},timeout_duration:{type:"select",placeholder:"5 minutes",multi:!1,maxWidth:"150px",flavor:"xsmall",options:hx,conditions:{visible:t=>!0===t.timeout_enabled}},result_name:{type:"text",label:"Result Name",helpText:"The name to save the response as",placeholder:"response"}},layout:["rules","result_name"],gutter:[{type:"row",items:["timeout_enabled","timeout_duration"],gap:"0.5rem"}],validate:t=>{const e={};return{valid:0===Object.keys(e).length,errors:e}},toFormData:t=>{var e,i,n,o,s,r;const a=[];(null===(e=t.router)||void 0===e?void 0:e.cases)&&(null===(i=t.router)||void 0===i?void 0:i.categories)&&t.router.cases.forEach((e=>{const i=t.router.categories.find((t=>t.uuid===e.category_uuid));if(i&&!dx(i.name)){const t=cx(e.type),n=t?t.name:e.type;let o="",s="";t&&0===t.operands?(o="",s=""):t&&1===t.operands?(o=e.arguments.join(" "),s=""):t&&2===t.operands?(o=e.arguments[0]||"",s=e.arguments[1]||""):(o=e.arguments.join(" "),s=""),a.push({operator:{value:e.type,name:n},value1:o,value2:s,category:i.name})}}));const l=null===(s=null===(o=null===(n=t.router)||void 0===n?void 0:n.wait)||void 0===o?void 0:o.timeout)||void 0===s?void 0:s.seconds;let c=hx.find((t=>t.value===String(l)));return c||(c={value:"300",name:"5 minutes"}),{uuid:t.uuid,rules:a,timeout_enabled:!!l,timeout_duration:c,result_name:(null===(r=t.router)||void 0===r?void 0:r.result_name)||"response"}},fromFormData:(t,e)=>{var i,n,o,s,r,a,l,c;const h=t=>{if("string"==typeof t)return t.trim();if(Array.isArray(t)&&t.length>0){const e=t[0];if(e&&"object"==typeof e&&e.value)return e.value.trim()}else if(t&&"object"==typeof t&&t.value)return t.value.trim();return""},d=(t.rules||[]).filter((t=>{const e=h(null==t?void 0:t.operator);if(!e||!(null==t?void 0:t.category)||""===e||""===t.category.trim())return!1;const i=cx(e);return i&&1===i.operands?(null==t?void 0:t.value1)&&""!==t.value1.trim():!i||2!==i.operands||(null==t?void 0:t.value1)&&""!==t.value1.trim()&&(null==t?void 0:t.value2)&&""!==t.value2.trim()})).map((t=>{const e=h(t.operator),i=cx(e);let n="";if(i&&1===i.operands)n=t.value1?t.value1.trim():"";else if(i&&2===i.operands){n=`${t.value1?t.value1.trim():""} ${t.value2?t.value2.trim():""}`.trim()}else n="";return{operator:e,value:n,category:t.category.trim()}}));if(0===d.length){let n=(null===(i=e.router)||void 0===i?void 0:i.categories)||[];const o=[...e.exits||[]];if(t.timeout_enabled){let t=n.find((t=>"No Response"===t.name));if(!t){const e=Yt();t={uuid:Yt(),name:"No Response",exit_uuid:e},n=[...n,t],o.find((t=>t.uuid===e))||o.push({uuid:e,destination_uuid:null})}}else n=n.filter((t=>"No Response"!==t.name));const{router:s,exits:r}=mx([],n,o,[]),a={...s,result_name:t.result_name||"response",cases:[]},l={type:"msg"};if(t.timeout_enabled){let e;e=t.timeout_duration?Array.isArray(t.timeout_duration)&&t.timeout_duration.length>0?parseInt(t.timeout_duration[0].value,10):"string"==typeof t.timeout_duration?parseInt(t.timeout_duration,10):t.timeout_duration&&"object"==typeof t.timeout_duration&&t.timeout_duration.value?parseInt(t.timeout_duration.value,10):300:300,(isNaN(e)||e<=0)&&(e=300);const i=a.categories.find((t=>"No Response"===t.name));i&&(l.timeout={seconds:e,category_uuid:i.uuid})}return a.wait=l,{...e,router:a,exits:r}}const u=(null===(n=e.router)||void 0===n?void 0:n.categories)||[],p=e.exits||[],m=(null===(o=e.router)||void 0===o?void 0:o.cases)||[],{router:g,exits:f}=mx(d,u,p,m),v={...g,result_name:t.result_name||"response"},y={type:"msg"};try{if(t.timeout_enabled){let i;if(t.timeout_duration)try{i=parseInt(t.timeout_duration[0].value,10)}catch(t){i=300}const n=null===(r=null===(s=e.router)||void 0===s?void 0:s.categories)||void 0===r?void 0:r.find((t=>"No Response"===t.name)),o=n||{uuid:Yt(),name:"No Response",exit_uuid:Yt()};if(y.timeout={seconds:i,category_uuid:o.uuid},!(null===(a=g.categories)||void 0===a?void 0:a.some((t=>"No Response"===t.name)))&&(g.categories=g.categories||[],g.categories.push(o),!f.some((t=>t.uuid===o.exit_uuid)))){const t={uuid:o.exit_uuid,destination_uuid:(null==n?void 0:n.exit_uuid)&&(null===(c=null===(l=e.exits)||void 0===l?void 0:l.find((t=>t.uuid===n.exit_uuid)))||void 0===c?void 0:c.destination_uuid)||null};f.push(t)}}else if(g.categories){const t=g.categories.findIndex((t=>"No Response"===t.name));if(-1!==t){const e=g.categories[t];g.categories.splice(t,1);const i=f.findIndex((t=>t.uuid===e.exit_uuid));-1!==i&&f.splice(i,1)}}}catch(t){console.error("Error processing timeout configuration:",t)}return v.wait=y,{...e,router:v,exits:f}}};var fx;const vx={add_input_labels:Cb,add_contact_urn:Sb,set_contact_field:Eb,set_contact_channel:Ab,set_contact_language:Mb,set_contact_status:Tb,send_broadcast:Pb,set_run_result:Db,send_msg:Ib,send_email:Ob,start_session:$b,call_classifier:Lb,call_resthook:zb,transfer_airtime:Rb,set_contact_name:Nb,add_contact_groups:jb,remove_contact_groups:Bb,request_optin:Fb,say_msg:qb,play_audio:Vb},yx={execute_actions:{type:"execute_actions"},split_by_airtime:Hb,split_by_contact_field:Ub,split_by_expression:Wb,split_by_groups:Gb,split_by_llm:ex,split_by_llm_categorize:ix,split_by_random:Zb,split_by_run_result:Yb,split_by_scheme:Xb,split_by_subflow:Kb,split_by_ticket:Qb,split_by_webhook:tx,wait_for_audio:nx,wait_for_digits:ox,wait_for_image:sx,wait_for_location:rx,wait_for_menu:ax,wait_for_response:gx,wait_for_video:{type:"wait_for_video",name:"Wait for Video",color:bb}};class bx extends Ae{createRenderRoot(){return this}static get styles(){return a`
|
|
8286
8238
|
|
|
8287
8239
|
.node {
|
|
8288
8240
|
background-color: #fff;
|
|
@@ -8301,8 +8253,14 @@ const{I:vd}=at,yd=()=>document.createComment(""),bd=(t,e,i)=>{const n=t._$AA.par
|
|
|
8301
8253
|
max-width: 200px;
|
|
8302
8254
|
}
|
|
8303
8255
|
|
|
8304
|
-
.node:
|
|
8305
|
-
|
|
8256
|
+
.node .action:last-child {
|
|
8257
|
+
border-bottom-left-radius: var(--curvature);
|
|
8258
|
+
border-bottom-right-radius: var(--curvature);
|
|
8259
|
+
}
|
|
8260
|
+
|
|
8261
|
+
.node .action:first-child {
|
|
8262
|
+
border-top-left-radius: var(--curvature);
|
|
8263
|
+
border-top-right-radius: var(--curvature);
|
|
8306
8264
|
}
|
|
8307
8265
|
|
|
8308
8266
|
.node.dragging {
|
|
@@ -8461,8 +8419,8 @@ const{I:vd}=at,yd=()=>document.createComment(""),bd=(t,e,i)=>{const n=t._$AA.par
|
|
|
8461
8419
|
}
|
|
8462
8420
|
|
|
8463
8421
|
.action-exits {
|
|
8464
|
-
padding-bottom: 0.
|
|
8465
|
-
margin-top: -0.
|
|
8422
|
+
padding-bottom: 0.7em;
|
|
8423
|
+
margin-top: -0.7em;
|
|
8466
8424
|
}
|
|
8467
8425
|
|
|
8468
8426
|
.category .cn-title {
|
|
@@ -8592,7 +8550,7 @@ const{I:vd}=at,yd=()=>document.createComment(""),bd=(t,e,i)=>{const n=t._$AA.par
|
|
|
8592
8550
|
>
|
|
8593
8551
|
✕
|
|
8594
8552
|
</div>
|
|
8595
|
-
</div>`}renderAction(t,e,i){const n=
|
|
8553
|
+
</div>`}renderAction(t,e,i){const n=vx[e.type],o=this.actionRemovingState.has(e.uuid);return n?U`<div
|
|
8596
8554
|
class="action sortable ${e.type} ${o?"removing":""}"
|
|
8597
8555
|
id="action-${i}"
|
|
8598
8556
|
>
|
|
@@ -8600,7 +8558,7 @@ const{I:vd}=at,yd=()=>document.createComment(""),bd=(t,e,i)=>{const n=t._$AA.par
|
|
|
8600
8558
|
class="action-content"
|
|
8601
8559
|
@mousedown=${t=>this.handleActionMouseDown(t,e)}
|
|
8602
8560
|
@mouseup=${t=>this.handleActionMouseUp(t,e)}
|
|
8603
|
-
style="cursor: pointer;"
|
|
8561
|
+
style="cursor: pointer; background: #fff"
|
|
8604
8562
|
>
|
|
8605
8563
|
${this.renderTitle(n,e,i,o)}
|
|
8606
8564
|
<div class="body">
|
|
@@ -8619,7 +8577,7 @@ const{I:vd}=at,yd=()=>document.createComment(""),bd=(t,e,i)=>{const n=t._$AA.par
|
|
|
8619
8577
|
✕
|
|
8620
8578
|
</div>
|
|
8621
8579
|
${e.type}
|
|
8622
|
-
</div>`}renderRouter(t,e){if(
|
|
8580
|
+
</div>`}renderRouter(t,e){if(yx[e.type])return U`<div class="router" style="position: relative;">
|
|
8623
8581
|
${t.result_name?U`<div
|
|
8624
8582
|
class="body"
|
|
8625
8583
|
@mousedown=${t=>this.handleNodeMouseDown(t)}
|
|
@@ -8645,7 +8603,7 @@ const{I:vd}=at,yd=()=>document.createComment(""),bd=(t,e,i)=>{const n=t._$AA.par
|
|
|
8645
8603
|
class=${ie({exit:!0,connected:!!t.destination_uuid,removing:this.exitRemovingState.has(t.uuid)})}
|
|
8646
8604
|
@click=${e=>this.handleExitClick(e,t)}
|
|
8647
8605
|
></div>
|
|
8648
|
-
</div>`}render(){if(!this.node||!this.ui)return U`<div class="node">Loading...</div>`;const t=
|
|
8606
|
+
</div>`}render(){if(!this.node||!this.ui)return U`<div class="node">Loading...</div>`;const t=yx[this.ui.type];return U`
|
|
8649
8607
|
<div
|
|
8650
8608
|
id="${this.node.uuid}"
|
|
8651
8609
|
class="node ${"execute_actions"===this.ui.type?"execute-actions":""}"
|
|
@@ -8664,14 +8622,14 @@ const{I:vd}=at,yd=()=>document.createComment(""),bd=(t,e,i)=>{const n=t._$AA.par
|
|
|
8664
8622
|
dragHandle="drag-handle"
|
|
8665
8623
|
@temba-order-changed="${this.handleActionOrderChanged}"
|
|
8666
8624
|
>
|
|
8667
|
-
${
|
|
8668
|
-
</temba-sortable-list>`:U`${
|
|
8625
|
+
${this.node.actions.map(((t,e)=>this.renderAction(this.node,t,e)))}
|
|
8626
|
+
</temba-sortable-list>`:U`${this.node.actions.map(((t,e)=>this.renderAction(this.node,t,e)))}`:""}
|
|
8669
8627
|
${this.node.router?U` ${this.renderRouter(this.node.router,this.ui)}
|
|
8670
8628
|
${this.renderCategories(this.node)}`:U`<div class="action-exits">
|
|
8671
8629
|
${Cd(this.node.exits,(t=>t.uuid),(t=>this.renderExit(t)))}
|
|
8672
8630
|
</div>`}
|
|
8673
8631
|
</div>
|
|
8674
|
-
`}}function
|
|
8632
|
+
`}}function xx(t){const e=20*Math.round(t/20);return Math.max(e,0)}t([mt({type:Object})],bx.prototype,"plumber",void 0),t([mt({type:Object})],bx.prototype,"node",void 0),t([mt({type:Object})],bx.prototype,"ui",void 0);class _x extends Ae{createRenderRoot(){return this}get dragging(){return this.isDragging}static get styles(){return a`
|
|
8675
8633
|
#editor {
|
|
8676
8634
|
overflow: scroll;
|
|
8677
8635
|
flex: 1;
|
|
@@ -8816,9 +8774,9 @@ const{I:vd}=at,yd=()=>document.createComment(""),bd=(t,e,i)=>{const n=t._$AA.par
|
|
|
8816
8774
|
`}constructor(){super(),this.saveTimer=null,this.isDragging=!1,this.isMouseDown=!1,this.dragStartPos={x:0,y:0},this.currentDragItem=null,this.startPos={left:0,top:0},this.selectedItems=new Set,this.isSelecting=!1,this.selectionBox=null,this.targetId=null,this.sourceId=null,this.dragFromNodeId=null,this.isValidTarget=!0,this.editingNode=null,this.editingNodeUI=null,this.editingAction=null,this.canvasMouseDown=!1,this.boundMouseMove=this.handleMouseMove.bind(this),this.boundMouseUp=this.handleMouseUp.bind(this),this.boundGlobalMouseDown=this.handleGlobalMouseDown.bind(this),this.boundKeyDown=this.handleKeyDown.bind(this),this.boundCanvasDoubleClick=this.handleCanvasDoubleClick.bind(this)}firstUpdated(t){super.firstUpdated(t),this.plumber=new ub(this.querySelector("#canvas")),this.setupGlobalEventListeners(),t.has("flow")&&cc().getState().fetchRevision(`/flow/revisions/${this.flow}`),this.plumber.on("connection:drag",(t=>{this.dragFromNodeId=document.getElementById(t.sourceId).closest(".node").id,this.sourceId=t.sourceId})),this.plumber.on("connection:abort",(()=>{this.makeConnection()})),this.plumber.on("connection:detach",(()=>{this.makeConnection()}))}makeConnection(){this.sourceId&&this.targetId&&this.isValidTarget&&(this.plumber.connectIds(this.dragFromNodeId,this.sourceId,this.targetId),cc().getState().updateConnection(this.dragFromNodeId,this.sourceId,this.targetId),setTimeout((()=>{this.plumber.repaintEverything()}),100)),document.querySelectorAll("temba-flow-node").forEach((t=>{t.classList.remove("connection-target-valid","connection-target-invalid")})),this.sourceId=null,this.targetId=null,this.dragFromNodeId=null,this.isValidTarget=!0}updated(t){super.updated(t),t.has("canvasSize"),t.has("definition")&&this.updateCanvasSize(),t.has("dirtyDate")&&this.dirtyDate&&this.debouncedSave()}debouncedSave(){null!==this.saveTimer&&clearTimeout(this.saveTimer),this.saveTimer=window.setTimeout((()=>{(new Date).getTime()-this.dirtyDate.getTime()>=500?(this.saveChanges(),this.saveTimer=null):this.debouncedSave()}),500)}saveChanges(){cc().postJSON(`/flow/revisions/${this.flow}`,this.definition).then((t=>{t.json&&t.json.info&&cc().getState().setFlowInfo(t.json.info)})).catch((t=>{console.error("Failed to save flow:",t)})),cc().getState().setDirtyDate(null)}disconnectedCallback(){super.disconnectedCallback(),null!==this.saveTimer&&(clearTimeout(this.saveTimer),this.saveTimer=null),document.removeEventListener("mousemove",this.boundMouseMove),document.removeEventListener("mouseup",this.boundMouseUp),document.removeEventListener("mousedown",this.boundGlobalMouseDown),document.removeEventListener("keydown",this.boundKeyDown);const t=this.querySelector("#canvas");t&&t.removeEventListener("dblclick",this.boundCanvasDoubleClick)}setupGlobalEventListeners(){document.addEventListener("mousemove",this.boundMouseMove),document.addEventListener("mouseup",this.boundMouseUp),document.addEventListener("mousedown",this.boundGlobalMouseDown),document.addEventListener("keydown",this.boundKeyDown);const t=this.querySelector("#canvas");t&&t.addEventListener("dblclick",this.boundCanvasDoubleClick),this.addEventListener(xn.ActionEditRequested,this.handleActionEditRequested.bind(this)),this.addEventListener(xn.NodeEditRequested,this.handleNodeEditRequested.bind(this))}getPosition(t,e){var i,n,o;return"node"===e?null===(i=this.definition._ui.nodes[t])||void 0===i?void 0:i.position:null===(o=null===(n=this.definition._ui.stickies)||void 0===n?void 0:n[t])||void 0===o?void 0:o.position}handleMouseDown(t){if(0!==t.button)return;const e=t.currentTarget,i=t.target;if(i.classList.contains("exit")||i.closest(".exit"))return;const n=e.getAttribute("uuid"),o="TEMBA-FLOW-NODE"===e.tagName?"node":"sticky",s=this.getPosition(n,o);s&&(this.selectedItems.has(n)||t.ctrlKey||t.metaKey?this.selectedItems.has(n)||this.selectedItems.add(n):this.selectedItems.clear(),this.isMouseDown=!0,this.dragStartPos={x:t.clientX,y:t.clientY},this.startPos={left:s.left,top:s.top},this.currentDragItem={uuid:n,position:s,element:e,type:o},t.preventDefault(),t.stopPropagation())}handleGlobalMouseDown(t){var e;if(0!==t.button)return;const i=null===(e=this.querySelector("#grid"))||void 0===e?void 0:e.getBoundingClientRect();if(!i)return;if(!(t.clientX>=i.left&&t.clientX<=i.right&&t.clientY>=i.top&&t.clientY<=i.bottom))return;t.target.closest(".draggable")||this.handleCanvasMouseDown(t)}handleCanvasMouseDown(t){var e;const i=t.target;if("canvas"===i.id||"grid"===i.id){this.canvasMouseDown=!0,this.dragStartPos={x:t.clientX,y:t.clientY};const i=null===(e=this.querySelector("#canvas"))||void 0===e?void 0:e.getBoundingClientRect();if(i){this.selectedItems.clear();const e=t.clientX-i.left,n=t.clientY-i.top;this.selectionBox={startX:e,startY:n,endX:e,endY:n}}t.preventDefault()}}handleKeyDown(t){"Delete"!==t.key&&"Backspace"!==t.key||this.selectedItems.size>0&&this.showDeleteConfirmation(),"Escape"===t.key&&(this.selectedItems.clear(),this.requestUpdate())}showDeleteConfirmation(){const t=this.selectedItems.size,e=1===t?"item":"items",i=document.createElement("temba-dialog");i.header="Delete Items",i.primaryButtonName="Delete",i.cancelButtonName="Cancel",i.destructive=!0,i.innerHTML=`<div style="padding: 20px;">Are you sure you want to delete ${t} ${e}?</div>`,i.addEventListener("temba-button-clicked",(t=>{"Delete"===t.detail.button.name&&(this.deleteSelectedItems(),i.open=!1)})),document.body.appendChild(i),i.open=!0,i.addEventListener("temba-dialog-hidden",(()=>{document.body.removeChild(i)}))}deleteNodes(t){t.forEach((t=>{this.plumber.removeNodeConnections(t)})),t.length>0&&this.plumber&&cc().getState().removeNodes(t)}deleteSelectedItems(){const t=Array.from(this.selectedItems).filter((t=>this.definition.nodes.some((e=>e.uuid===t))));this.deleteNodes(Array.from(t));const e=Array.from(this.selectedItems).filter((t=>{var e,i;return null===(i=null===(e=this.definition._ui)||void 0===e?void 0:e.stickies)||void 0===i?void 0:i[t]}));cc().getState().removeStickyNotes(e),this.selectedItems.clear()}updateSelectionBox(t){var e;if(!this.selectionBox||!this.canvasMouseDown)return;const i=null===(e=this.querySelector("#canvas"))||void 0===e?void 0:e.getBoundingClientRect();if(!i)return;const n=t.clientX-i.left,o=t.clientY-i.top;this.selectionBox={...this.selectionBox,endX:n,endY:o},this.updateSelectedItemsFromBox()}updateSelectedItemsFromBox(){var t,e,i;if(!this.selectionBox)return;const n=new Set,o=Math.min(this.selectionBox.startX,this.selectionBox.endX),s=Math.min(this.selectionBox.startY,this.selectionBox.endY),r=Math.max(this.selectionBox.startX,this.selectionBox.endX),a=Math.max(this.selectionBox.startY,this.selectionBox.endY);null===(t=this.definition)||void 0===t||t.nodes.forEach((t=>{var e,i,l;const c=this.querySelector(`[id="${t.uuid}"]`);if(c){const h=null===(i=null===(e=this.definition._ui)||void 0===e?void 0:e.nodes[t.uuid])||void 0===i?void 0:i.position;if(h){const e=c.getBoundingClientRect();if(null===(l=this.querySelector("#canvas"))||void 0===l?void 0:l.getBoundingClientRect()){const i=h.left,l=h.top,c=i+e.width,d=l+e.height;o<c&&r>i&&s<d&&a>l&&n.add(t.uuid)}}}}));const l=(null===(i=null===(e=this.definition)||void 0===e?void 0:e._ui)||void 0===i?void 0:i.stickies)||{};Object.entries(l).forEach((([t,e])=>{if(e.position){const i=this.querySelector(`temba-sticky-note[uuid="${t}"]`);if(i){const l=i.clientWidth,c=i.clientHeight,h=e.position.left,d=e.position.top;o<h+l&&r>h&&s<d+c&&a>d&&n.add(t)}}})),this.selectedItems=n}renderSelectionBox(){if(!this.selectionBox||!this.isSelecting)return"";const t=Math.min(this.selectionBox.startX,this.selectionBox.endX),e=Math.min(this.selectionBox.startY,this.selectionBox.endY),i=Math.abs(this.selectionBox.endX-this.selectionBox.startX),n=Math.abs(this.selectionBox.endY-this.selectionBox.startY);return U`<div
|
|
8817
8775
|
class="selection-box"
|
|
8818
8776
|
style="left: ${t}px; top: ${e}px; width: ${i}px; height: ${n}px;"
|
|
8819
|
-
></div>`}handleMouseMove(t){if(this.canvasMouseDown&&!this.isMouseDown)return this.isSelecting=!0,this.updateSelectionBox(t),void this.requestUpdate();if(this.plumber.connectionDragging){const t=document.querySelector("temba-flow-node:hover");document.querySelectorAll("temba-flow-node").forEach((t=>{t.classList.remove("connection-target-valid","connection-target-invalid")})),t?(this.targetId=t.getAttribute("uuid"),this.isValidTarget=this.targetId!==this.dragFromNodeId,this.isValidTarget?t.classList.add("connection-target-valid"):t.classList.add("connection-target-invalid")):(this.targetId=null,this.isValidTarget=!0)}if(!this.isMouseDown||!this.currentDragItem)return;const e=t.clientX-this.dragStartPos.x,i=t.clientY-this.dragStartPos.y,n=Math.sqrt(e*e+i*i);if(!this.isDragging&&n>5&&(this.isDragging=!0),this.isDragging){const t=this.selectedItems.has(this.currentDragItem.uuid)&&this.selectedItems.size>1?Array.from(this.selectedItems):[this.currentDragItem.uuid];t.forEach((t=>{const n=this.querySelector(`[uuid="${t}"]`);if(n){const o="TEMBA-FLOW-NODE"===n.tagName?"node":"sticky",s=this.getPosition(t,o);if(s){const t=s.left+e,o=s.top+i;n.style.left=`${t}px`,n.style.top=`${o}px`,n.classList.add("dragging")}}})),this.plumber.revalidate(t)}}handleMouseUp(t){if(this.canvasMouseDown&&this.isSelecting)return this.isSelecting=!1,this.selectionBox=null,this.canvasMouseDown=!1,void this.requestUpdate();if(!this.canvasMouseDown||this.isSelecting){if(this.isMouseDown&&this.currentDragItem){if(this.isDragging){const e=t.clientX-this.dragStartPos.x,i=t.clientY-this.dragStartPos.y,n=this.selectedItems.has(this.currentDragItem.uuid)&&this.selectedItems.size>1?Array.from(this.selectedItems):[this.currentDragItem.uuid],o={};n.forEach((t=>{const n=this.definition.nodes.find((e=>e.uuid===t))?"node":"sticky",s=this.getPosition(t,n);if(s){const n=s.left+e,r=s.top+i,a=
|
|
8820
|
-
${r(
|
|
8821
|
-
${r(
|
|
8777
|
+
></div>`}handleMouseMove(t){if(this.canvasMouseDown&&!this.isMouseDown)return this.isSelecting=!0,this.updateSelectionBox(t),void this.requestUpdate();if(this.plumber.connectionDragging){const t=document.querySelector("temba-flow-node:hover");document.querySelectorAll("temba-flow-node").forEach((t=>{t.classList.remove("connection-target-valid","connection-target-invalid")})),t?(this.targetId=t.getAttribute("uuid"),this.isValidTarget=this.targetId!==this.dragFromNodeId,this.isValidTarget?t.classList.add("connection-target-valid"):t.classList.add("connection-target-invalid")):(this.targetId=null,this.isValidTarget=!0)}if(!this.isMouseDown||!this.currentDragItem)return;const e=t.clientX-this.dragStartPos.x,i=t.clientY-this.dragStartPos.y,n=Math.sqrt(e*e+i*i);if(!this.isDragging&&n>5&&(this.isDragging=!0),this.isDragging){const t=this.selectedItems.has(this.currentDragItem.uuid)&&this.selectedItems.size>1?Array.from(this.selectedItems):[this.currentDragItem.uuid];t.forEach((t=>{const n=this.querySelector(`[uuid="${t}"]`);if(n){const o="TEMBA-FLOW-NODE"===n.tagName?"node":"sticky",s=this.getPosition(t,o);if(s){const t=s.left+e,o=s.top+i;n.style.left=`${t}px`,n.style.top=`${o}px`,n.classList.add("dragging")}}})),this.plumber.revalidate(t)}}handleMouseUp(t){if(this.canvasMouseDown&&this.isSelecting)return this.isSelecting=!1,this.selectionBox=null,this.canvasMouseDown=!1,void this.requestUpdate();if(!this.canvasMouseDown||this.isSelecting){if(this.isMouseDown&&this.currentDragItem){if(this.isDragging){const e=t.clientX-this.dragStartPos.x,i=t.clientY-this.dragStartPos.y,n=this.selectedItems.has(this.currentDragItem.uuid)&&this.selectedItems.size>1?Array.from(this.selectedItems):[this.currentDragItem.uuid],o={};n.forEach((t=>{const n=this.definition.nodes.find((e=>e.uuid===t))?"node":"sticky",s=this.getPosition(t,n);if(s){const n=s.left+e,r=s.top+i,a=xx(n),l=xx(r),c={left:a,top:l};o[t]=c;const h=this.querySelector(`[uuid="${t}"]`);h&&(h.classList.remove("dragging"),h.style.left=`${a}px`,h.style.top=`${l}px`)}})),Object.keys(o).length>0&&(cc().getState().updateCanvasPositions(o),setTimeout((()=>{this.plumber.repaintEverything()}),0)),this.selectedItems.clear()}this.isDragging=!1,this.isMouseDown=!1,this.currentDragItem=null,this.canvasMouseDown=!1}}else this.canvasMouseDown=!1}updateCanvasSize(){var t;if(!this.definition)return;const e=cc();if(!e)return;let i=0,n=0;this.definition.nodes.forEach((t=>{const e=this.definition._ui.nodes[t.uuid];if(e&&e.position){const o=this.querySelector(`[id="${t.uuid}"]`);if(o){const t=o.getBoundingClientRect();i=Math.max(i,e.position.left+t.width),n=Math.max(n,e.position.top+t.height)}}}));const o=(null===(t=this.definition._ui)||void 0===t?void 0:t.stickies)||{};Object.entries(o).forEach((([t,e])=>{if(e.position){const o=this.querySelector(`temba-sticky-note[uuid="${t}"]`);if(o){const t=o.clientWidth,s=o.clientHeight;i=Math.max(i,e.position.left+t),n=Math.max(n,e.position.top+s)}else i=Math.max(i,e.position.left+200),n=Math.max(n,e.position.top+100)}})),e.getState().expandCanvas(i,n)}handleCanvasDoubleClick(t){if("canvas"!==t.target.id)return;const e=this.querySelector("#canvas");if(!e)return;const i=e.getBoundingClientRect(),n=t.clientX-i.left-10,o=t.clientY-i.top-10,s=xx(n),r=xx(o);cc().getState().createStickyNote({left:s,top:r}),t.preventDefault(),t.stopPropagation()}handleActionEditRequested(t){this.editingAction=t.detail.action;const e=t.detail.nodeUuid,i=this.definition.nodes.find((t=>t.uuid===e));i&&(this.editingNode=i,this.editingNodeUI=this.definition._ui.nodes[e])}handleNodeEditRequested(t){this.editingNode=t.detail.node,this.editingNodeUI=t.detail.nodeUI}handleActionSaved(t){var e;if(this.editingNode&&this.editingAction){const i=this.editingNode.actions.map((e=>e.uuid===this.editingAction.uuid?t:e)),n={...this.editingNode,actions:i};null===(e=cc())||void 0===e||e.getState().updateNode(this.editingNode.uuid,n),this.plumber&&requestAnimationFrame((()=>{this.plumber.repaintEverything()}))}this.closeNodeEditor()}closeNodeEditor(){this.editingNode=null,this.editingNodeUI=null,this.editingAction=null}handleActionEditCanceled(){this.closeNodeEditor()}handleNodeSaved(t){var e;if(this.editingNode){if(this.plumber){const e=this.editingNode.exits||[],i=t.exits||[];e.filter((t=>!i.find((e=>e.uuid===t.uuid)))).forEach((t=>{this.plumber.removeExitConnection(t.uuid)}))}this.plumber.revalidate([t.uuid]),null===(e=cc())||void 0===e||e.getState().updateNode(this.editingNode.uuid,t),this.plumber&&requestAnimationFrame((()=>{this.plumber.repaintEverything()}))}this.closeNodeEditor()}handleNodeEditCanceled(){this.closeNodeEditor()}render(){var t,e;const i=U`<style>
|
|
8778
|
+
${r(_x.styles.cssText)}
|
|
8779
|
+
${r(bx.styles.cssText)}
|
|
8822
8780
|
</style>`,n=(null===(e=null===(t=this.definition)||void 0===t?void 0:t._ui)||void 0===e?void 0:e.stickies)||{};return U`${i}
|
|
8823
8781
|
<div id="editor">
|
|
8824
8782
|
<div
|
|
@@ -8857,7 +8815,7 @@ const{I:vd}=at,yd=()=>document.createComment(""),bd=(t,e,i)=>{const n=t._$AA.par
|
|
|
8857
8815
|
@temba-node-saved=${t=>this.handleNodeSaved(t.detail.node)}
|
|
8858
8816
|
@temba-action-saved=${t=>this.handleActionSaved(t.detail.action)}
|
|
8859
8817
|
@temba-node-edit-cancelled=${this.handleNodeEditCanceled}
|
|
8860
|
-
></temba-node-editor>`:""} `}}t([mt({type:String})],
|
|
8818
|
+
></temba-node-editor>`:""} `}}t([mt({type:String})],_x.prototype,"flow",void 0),t([mt({type:String})],_x.prototype,"version",void 0),t([ac(sc,(t=>t.flowDefinition))],_x.prototype,"definition",void 0),t([ac(sc,(t=>t.canvasSize))],_x.prototype,"canvasSize",void 0),t([ac(sc,(t=>t.dirtyDate))],_x.prototype,"dirtyDate",void 0),t([gt()],_x.prototype,"isDragging",void 0),t([gt()],_x.prototype,"currentDragItem",void 0),t([gt()],_x.prototype,"selectedItems",void 0),t([gt()],_x.prototype,"isSelecting",void 0),t([gt()],_x.prototype,"selectionBox",void 0),t([gt()],_x.prototype,"targetId",void 0),t([gt()],_x.prototype,"sourceId",void 0),t([gt()],_x.prototype,"dragFromNodeId",void 0),t([gt()],_x.prototype,"isValidTarget",void 0),t([gt()],_x.prototype,"editingNode",void 0),t([gt()],_x.prototype,"editingNodeUI",void 0),t([gt()],_x.prototype,"editingAction",void 0);class wx extends Ae{constructor(){super(...arguments),this.dragging=!1,this.selected=!1,this.colorPickerExpanded=!1}static get styles(){return a`
|
|
8861
8819
|
:host {
|
|
8862
8820
|
--sticky-color: #fef08a;
|
|
8863
8821
|
--sticky-border-color: #facc15;
|
|
@@ -9149,7 +9107,7 @@ const{I:vd}=at,yd=()=>document.createComment(""),bd=(t,e,i)=>{const n=t._$AA.par
|
|
|
9149
9107
|
</div>
|
|
9150
9108
|
</div>
|
|
9151
9109
|
</div>
|
|
9152
|
-
`}}t([mt({type:String})],
|
|
9110
|
+
`}}t([mt({type:String})],wx.prototype,"uuid",void 0),t([mt({type:Object})],wx.prototype,"data",void 0),t([mt({type:Boolean})],wx.prototype,"dragging",void 0),t([mt({type:Boolean})],wx.prototype,"selected",void 0),t([mt({type:Boolean})],wx.prototype,"colorPickerExpanded",void 0);class kx extends Hc{constructor(){super(...arguments),this.dirtyMessage="You have unsaved changes to the contact notepad. Are you sure you want to contiunue?"}static get styles(){return a`
|
|
9153
9111
|
:host {
|
|
9154
9112
|
height: 100%;
|
|
9155
9113
|
display: flex;
|
|
@@ -9219,7 +9177,7 @@ const{I:vd}=at,yd=()=>document.createComment(""),bd=(t,e,i)=>{const n=t._$AA.par
|
|
|
9219
9177
|
`:null}
|
|
9220
9178
|
</div>
|
|
9221
9179
|
</div>
|
|
9222
|
-
`:super.render();var t}}t([mt({type:Object,attribute:!1})],
|
|
9180
|
+
`:super.render();var t}}t([mt({type:Object,attribute:!1})],kx.prototype,"note",void 0),t([mt({type:String})],kx.prototype,"dirtyMessage",void 0);class Cx extends Ae{constructor(){super(...arguments),this.total=100,this.current=0,this.pct=0,this.done=!1,this.showEstimatedCompletion=!1,this.showPercentage=!1}updated(t){if(t.has("eta")&&this.eta&&(this.estimatedCompletionDate=new Date(this.eta),this.showEstimatedCompletion=this.estimatedCompletionDate>new Date),t.has("current")){const t=Math.floor(Math.min(this.current/this.total*100,100));Number.isNaN(t)?this.showPercentage=!1:(this.pct=t,this.showPercentage=!0),this.done=this.pct>=100}}render(){return U`<div class="wrapper ${this.done?"complete":""}">
|
|
9223
9181
|
<div class="meter ${this.done?"done":""}">
|
|
9224
9182
|
${this.message?U`<div class="message">${this.message}</div>`:null}
|
|
9225
9183
|
<span class="complete" style="flex-basis: ${this.pct}%"></span>
|
|
@@ -9236,7 +9194,7 @@ const{I:vd}=at,yd=()=>document.createComment(""),bd=(t,e,i)=>{const n=t._$AA.par
|
|
|
9236
9194
|
</div>`:null}
|
|
9237
9195
|
|
|
9238
9196
|
<slot></slot>
|
|
9239
|
-
</div>`}}
|
|
9197
|
+
</div>`}}Cx.styles=a`
|
|
9240
9198
|
.wrapper {
|
|
9241
9199
|
display: flex;
|
|
9242
9200
|
box-sizing: content-box;
|
|
@@ -9358,7 +9316,7 @@ const{I:vd}=at,yd=()=>document.createComment(""),bd=(t,e,i)=>{const n=t._$AA.par
|
|
|
9358
9316
|
.meter.done > span {
|
|
9359
9317
|
background: rgb(var(--success-rgb));
|
|
9360
9318
|
}
|
|
9361
|
-
`,t([mt({type:Number})],
|
|
9319
|
+
`,t([mt({type:Number})],Cx.prototype,"total",void 0),t([mt({type:Number})],Cx.prototype,"current",void 0),t([mt({type:Number})],Cx.prototype,"pct",void 0),t([mt({type:Boolean})],Cx.prototype,"done",void 0),t([mt({type:String})],Cx.prototype,"eta",void 0),t([mt({type:String,attribute:!1})],Cx.prototype,"estimatedCompletionDate",void 0),t([mt({type:Boolean})],Cx.prototype,"showEstimatedCompletion",void 0),t([mt({type:Boolean})],Cx.prototype,"showPercentage",void 0),t([mt({type:String})],Cx.prototype,"message",void 0);class Sx extends Ae{constructor(){super(...arguments),this.refreshes=0,this.complete=!1,this.running=!1}updated(t){super.updated(t),t.has("id")&&this.refresh()}interruptStart(){var t,e;t=this.interruptTitle,e=this.interruptEndpoint,window.showModax(t,e)}refresh(){oe(this.statusEndpoint,this.getHeaders()).then((t=>{if(t.length>0){this.refreshes++;const e=t[0];if(this.current=e.progress.current,this.total=e.progress.total,this.complete="Completed"==e.status||"Failed"==e.status||"Interrupted"==e.status,this.running="Started"===e.status,"Pending"===e.status?this.message="Preparing to start..":"Queued"===e.status?this.message="Waiting..":this.message=null,"Started"===e.status){const t=(new Date).getTime()-new Date(e.modified_on).getTime(),i=this.current/t;if(i>.1){const t=new Date((new Date).getTime()+(this.total-this.current)/i),e=new Date;e.setMonth(e.getMonth()+2),this.eta=t>e?null:t.toISOString()}}!this.complete&&this.current<this.total&&setTimeout((()=>{this.refresh()}),Math.min(1e3*this.refreshes,6e4)),this.complete&&this.scheduleRemoval()}}))}scheduleRemoval(){setTimeout((()=>{this.remove()}),5e3)}render(){return U`<temba-progress
|
|
9362
9320
|
total=${this.total}
|
|
9363
9321
|
current=${this.current}
|
|
9364
9322
|
eta=${this.eta}
|
|
@@ -9368,7 +9326,7 @@ const{I:vd}=at,yd=()=>document.createComment(""),bd=(t,e,i)=>{const n=t._$AA.par
|
|
|
9368
9326
|
name="close"
|
|
9369
9327
|
@click=${this.interruptStart}
|
|
9370
9328
|
></temba-icon>`:null}
|
|
9371
|
-
</temba-progress>`}}
|
|
9329
|
+
</temba-progress>`}}Sx.styles=a`
|
|
9372
9330
|
temba-icon[name='close'] {
|
|
9373
9331
|
cursor: pointer;
|
|
9374
9332
|
margin: 0 4px;
|
|
@@ -9377,7 +9335,7 @@ const{I:vd}=at,yd=()=>document.createComment(""),bd=(t,e,i)=>{const n=t._$AA.par
|
|
|
9377
9335
|
temba-icon[name='close']:hover {
|
|
9378
9336
|
color: var(--color-primary-dark);
|
|
9379
9337
|
}
|
|
9380
|
-
`,t([mt({type:String})],
|
|
9338
|
+
`,t([mt({type:String})],Sx.prototype,"id",void 0),t([mt({type:Number})],Sx.prototype,"current",void 0),t([mt({type:Number})],Sx.prototype,"total",void 0),t([mt({type:Number})],Sx.prototype,"refreshes",void 0),t([mt({type:String})],Sx.prototype,"eta",void 0),t([mt({type:Boolean})],Sx.prototype,"complete",void 0),t([mt({type:Boolean})],Sx.prototype,"running",void 0),t([mt({type:String})],Sx.prototype,"message",void 0),t([mt({type:String})],Sx.prototype,"statusEndpoint",void 0),t([mt({type:String})],Sx.prototype,"interruptTitle",void 0),t([mt({type:String})],Sx.prototype,"interruptEndpoint",void 0);class Ex extends qc{static get styles(){return a`
|
|
9381
9339
|
temba-options {
|
|
9382
9340
|
display: block;
|
|
9383
9341
|
width: 100%;
|
|
@@ -9442,7 +9400,7 @@ const{I:vd}=at,yd=()=>document.createComment(""),bd=(t,e,i)=>{const n=t._$AA.par
|
|
|
9442
9400
|
.cursorIndex=${this.cursorIndex}
|
|
9443
9401
|
.options=${this.filteredShortcuts}
|
|
9444
9402
|
></temba-options>
|
|
9445
|
-
`}}t([mt({type:String})],
|
|
9403
|
+
`}}t([mt({type:String})],Ex.prototype,"filter",void 0),t([mt({type:Array})],Ex.prototype,"filteredShortcuts",void 0),t([mt({type:Number})],Ex.prototype,"cursorIndex",void 0);class Ax extends Ae{constructor(){super(...arguments),this.placeholder="",this.endpoint=""}handleChange(){this.blur()}render(){return U`
|
|
9446
9404
|
<div>
|
|
9447
9405
|
<temba-dropdown>
|
|
9448
9406
|
<div slot="toggle"><slot name="toggle"></slot></div>
|
|
@@ -9457,7 +9415,7 @@ const{I:vd}=at,yd=()=>document.createComment(""),bd=(t,e,i)=>{const n=t._$AA.par
|
|
|
9457
9415
|
</div>
|
|
9458
9416
|
</temba-dropdown>
|
|
9459
9417
|
</div>
|
|
9460
|
-
`}}
|
|
9418
|
+
`}}Ax.styles=a`
|
|
9461
9419
|
:host {
|
|
9462
9420
|
}
|
|
9463
9421
|
|
|
@@ -9474,7 +9432,7 @@ const{I:vd}=at,yd=()=>document.createComment(""),bd=(t,e,i)=>{const n=t._$AA.par
|
|
|
9474
9432
|
--color-widget-border: transparent;
|
|
9475
9433
|
--widget-box-shadow: none;
|
|
9476
9434
|
}
|
|
9477
|
-
`,t([mt({type:String})],
|
|
9435
|
+
`,t([mt({type:String})],Ax.prototype,"placeholder",void 0),t([mt({type:String})],Ax.prototype,"endpoint",void 0);class Mx extends Sc{static get styles(){return a`
|
|
9478
9436
|
${super.styles}
|
|
9479
9437
|
|
|
9480
9438
|
:host {
|
|
@@ -9486,7 +9444,7 @@ const{I:vd}=at,yd=()=>document.createComment(""),bd=(t,e,i)=>{const n=t._$AA.par
|
|
|
9486
9444
|
name=${t.name}
|
|
9487
9445
|
avatar=${t.avatar}
|
|
9488
9446
|
showname
|
|
9489
|
-
></temba-user>`:U``}}t([mt({type:String})],
|
|
9447
|
+
></temba-user>`:U``}}t([mt({type:String})],Mx.prototype,"endpoint",void 0),t([mt({type:String})],Mx.prototype,"nameKey",void 0),t([mt({type:String})],Mx.prototype,"valueKey",void 0),t([mt({type:String})],Mx.prototype,"placeholder",void 0),t([mt({type:Boolean})],Mx.prototype,"sorted",void 0),t([mt({type:Object})],Mx.prototype,"user",void 0);class Tx extends Sc{static get styles(){return a`
|
|
9490
9448
|
${super.styles}
|
|
9491
9449
|
|
|
9492
9450
|
:host {
|
|
@@ -9499,33 +9457,33 @@ const{I:vd}=at,yd=()=>document.createComment(""),bd=(t,e,i)=>{const n=t._$AA.par
|
|
|
9499
9457
|
* (c) 2024 Jukka Kurkela
|
|
9500
9458
|
* Released under the MIT License
|
|
9501
9459
|
*/
|
|
9502
|
-
function
|
|
9460
|
+
function Px(t){return t+.5|0}t([mt({type:String})],Tx.prototype,"endpoint",void 0),t([mt({type:String})],Tx.prototype,"nameKey",void 0),t([mt({type:String})],Tx.prototype,"valueKey",void 0),t([mt({type:String})],Tx.prototype,"placeholder",void 0),t([mt({type:Boolean})],Tx.prototype,"sorted",void 0),t([mt({type:Object})],Tx.prototype,"workspace",void 0);const Dx=(t,e,i)=>Math.max(Math.min(t,i),e);function Ix(t){return Dx(Px(2.55*t),0,255)}function Ox(t){return Dx(Px(255*t),0,255)}function $x(t){return Dx(Px(t/2.55)/100,0,1)}function Lx(t){return Dx(Px(100*t),0,100)}const zx={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},Rx=[..."0123456789ABCDEF"],Nx=t=>Rx[15&t],jx=t=>Rx[(240&t)>>4]+Rx[15&t],Bx=t=>(240&t)>>4==(15&t);function Fx(t){var e=(t=>Bx(t.r)&&Bx(t.g)&&Bx(t.b)&&Bx(t.a))(t)?Nx:jx;return t?"#"+e(t.r)+e(t.g)+e(t.b)+((t,e)=>t<255?e(t):"")(t.a,e):void 0}const qx=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function Vx(t,e,i){const n=e*Math.min(i,1-i),o=(e,o=(e+t/30)%12)=>i-n*Math.max(Math.min(o-3,9-o,1),-1);return[o(0),o(8),o(4)]}function Hx(t,e,i){const n=(n,o=(n+t/60)%6)=>i-i*e*Math.max(Math.min(o,4-o,1),0);return[n(5),n(3),n(1)]}function Ux(t,e,i){const n=Vx(t,1,.5);let o;for(e+i>1&&(o=1/(e+i),e*=o,i*=o),o=0;o<3;o++)n[o]*=1-e-i,n[o]+=e;return n}function Wx(t){const e=t.r/255,i=t.g/255,n=t.b/255,o=Math.max(e,i,n),s=Math.min(e,i,n),r=(o+s)/2;let a,l,c;return o!==s&&(c=o-s,l=r>.5?c/(2-o-s):c/(o+s),a=function(t,e,i,n,o){return t===o?(e-i)/n+(e<i?6:0):e===o?(i-t)/n+2:(t-e)/n+4}(e,i,n,c,o),a=60*a+.5),[0|a,l||0,r]}function Gx(t,e,i,n){return(Array.isArray(e)?t(e[0],e[1],e[2]):t(e,i,n)).map(Ox)}function Zx(t,e,i){return Gx(Vx,t,e,i)}function Yx(t){return(t%360+360)%360}function Xx(t){const e=qx.exec(t);let i,n=255;if(!e)return;e[5]!==i&&(n=e[6]?Ix(+e[5]):Ox(+e[5]));const o=Yx(+e[2]),s=+e[3]/100,r=+e[4]/100;return i="hwb"===e[1]?function(t,e,i){return Gx(Ux,t,e,i)}(o,s,r):"hsv"===e[1]?function(t,e,i){return Gx(Hx,t,e,i)}(o,s,r):Zx(o,s,r),{r:i[0],g:i[1],b:i[2],a:n}}const Kx={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},Qx={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};let Jx;function t_(t){Jx||(Jx=function(){const t={},e=Object.keys(Qx),i=Object.keys(Kx);let n,o,s,r,a;for(n=0;n<e.length;n++){for(r=a=e[n],o=0;o<i.length;o++)s=i[o],a=a.replace(s,Kx[s]);s=parseInt(Qx[r],16),t[a]=[s>>16&255,s>>8&255,255&s]}return t}(),Jx.transparent=[0,0,0,0]);const e=Jx[t.toLowerCase()];return e&&{r:e[0],g:e[1],b:e[2],a:4===e.length?e[3]:255}}const e_=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;const i_=t=>t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055,n_=t=>t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4);function o_(t,e,i){if(t){let n=Wx(t);n[e]=Math.max(0,Math.min(n[e]+n[e]*i,0===e?360:1)),n=Zx(n),t.r=n[0],t.g=n[1],t.b=n[2]}}function s_(t,e){return t?Object.assign(e||{},t):t}function r_(t){var e={r:0,g:0,b:0,a:255};return Array.isArray(t)?t.length>=3&&(e={r:t[0],g:t[1],b:t[2],a:255},t.length>3&&(e.a=Ox(t[3]))):(e=s_(t,{r:0,g:0,b:0,a:1})).a=Ox(e.a),e}function a_(t){return"r"===t.charAt(0)?function(t){const e=e_.exec(t);let i,n,o,s=255;if(e){if(e[7]!==i){const t=+e[7];s=e[8]?Ix(t):Dx(255*t,0,255)}return i=+e[1],n=+e[3],o=+e[5],i=255&(e[2]?Ix(i):Dx(i,0,255)),n=255&(e[4]?Ix(n):Dx(n,0,255)),o=255&(e[6]?Ix(o):Dx(o,0,255)),{r:i,g:n,b:o,a:s}}}(t):Xx(t)}class l_{constructor(t){if(t instanceof l_)return t;const e=typeof t;let i;var n,o,s;"object"===e?i=r_(t):"string"===e&&(s=(n=t).length,"#"===n[0]&&(4===s||5===s?o={r:255&17*zx[n[1]],g:255&17*zx[n[2]],b:255&17*zx[n[3]],a:5===s?17*zx[n[4]]:255}:7!==s&&9!==s||(o={r:zx[n[1]]<<4|zx[n[2]],g:zx[n[3]]<<4|zx[n[4]],b:zx[n[5]]<<4|zx[n[6]],a:9===s?zx[n[7]]<<4|zx[n[8]]:255})),i=o||t_(t)||a_(t)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var t=s_(this._rgb);return t&&(t.a=$x(t.a)),t}set rgb(t){this._rgb=r_(t)}rgbString(){return this._valid?function(t){return t&&(t.a<255?`rgba(${t.r}, ${t.g}, ${t.b}, ${$x(t.a)})`:`rgb(${t.r}, ${t.g}, ${t.b})`)}(this._rgb):void 0}hexString(){return this._valid?Fx(this._rgb):void 0}hslString(){return this._valid?function(t){if(!t)return;const e=Wx(t),i=e[0],n=Lx(e[1]),o=Lx(e[2]);return t.a<255?`hsla(${i}, ${n}%, ${o}%, ${$x(t.a)})`:`hsl(${i}, ${n}%, ${o}%)`}(this._rgb):void 0}mix(t,e){if(t){const i=this.rgb,n=t.rgb;let o;const s=e===o?.5:e,r=2*s-1,a=i.a-n.a,l=((r*a==-1?r:(r+a)/(1+r*a))+1)/2;o=1-l,i.r=255&l*i.r+o*n.r+.5,i.g=255&l*i.g+o*n.g+.5,i.b=255&l*i.b+o*n.b+.5,i.a=s*i.a+(1-s)*n.a,this.rgb=i}return this}interpolate(t,e){return t&&(this._rgb=function(t,e,i){const n=n_($x(t.r)),o=n_($x(t.g)),s=n_($x(t.b));return{r:Ox(i_(n+i*(n_($x(e.r))-n))),g:Ox(i_(o+i*(n_($x(e.g))-o))),b:Ox(i_(s+i*(n_($x(e.b))-s))),a:t.a+i*(e.a-t.a)}}(this._rgb,t._rgb,e)),this}clone(){return new l_(this.rgb)}alpha(t){return this._rgb.a=Ox(t),this}clearer(t){return this._rgb.a*=1-t,this}greyscale(){const t=this._rgb,e=Px(.3*t.r+.59*t.g+.11*t.b);return t.r=t.g=t.b=e,this}opaquer(t){return this._rgb.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return o_(this._rgb,2,t),this}darken(t){return o_(this._rgb,2,-t),this}saturate(t){return o_(this._rgb,1,t),this}desaturate(t){return o_(this._rgb,1,-t),this}rotate(t){return function(t,e){var i=Wx(t);i[0]=Yx(i[0]+e),i=Zx(i),t.r=i[0],t.g=i[1],t.b=i[2]}(this._rgb,t),this}}
|
|
9503
9461
|
/*!
|
|
9504
9462
|
* Chart.js v4.4.8
|
|
9505
9463
|
* https://www.chartjs.org
|
|
9506
9464
|
* (c) 2025 Chart.js Contributors
|
|
9507
9465
|
* Released under the MIT License
|
|
9508
|
-
*/function s_(){}const r_=(()=>{let t=0;return()=>t++})();function a_(t){return null==t}function l_(t){if(Array.isArray&&Array.isArray(t))return!0;const e=Object.prototype.toString.call(t);return"[object"===e.slice(0,7)&&"Array]"===e.slice(-6)}function c_(t){return null!==t&&"[object Object]"===Object.prototype.toString.call(t)}function h_(t){return("number"==typeof t||t instanceof Number)&&isFinite(+t)}function d_(t,e){return h_(t)?t:e}function u_(t,e){return void 0===t?e:t}const p_=(t,e)=>"string"==typeof t&&t.endsWith("%")?parseFloat(t)/100*e:+t;function m_(t,e,i){if(t&&"function"==typeof t.call)return t.apply(i,e)}function g_(t,e,i,n){let o,s,r;if(l_(t))if(s=t.length,n)for(o=s-1;o>=0;o--)e.call(i,t[o],o);else for(o=0;o<s;o++)e.call(i,t[o],o);else if(c_(t))for(r=Object.keys(t),s=r.length,o=0;o<s;o++)e.call(i,t[r[o]],r[o])}function f_(t,e){let i,n,o,s;if(!t||!e||t.length!==e.length)return!1;for(i=0,n=t.length;i<n;++i)if(o=t[i],s=e[i],o.datasetIndex!==s.datasetIndex||o.index!==s.index)return!1;return!0}function v_(t){if(l_(t))return t.map(v_);if(c_(t)){const e=Object.create(null),i=Object.keys(t),n=i.length;let o=0;for(;o<n;++o)e[i[o]]=v_(t[i[o]]);return e}return t}function y_(t){return-1===["__proto__","prototype","constructor"].indexOf(t)}function b_(t,e,i,n){if(!y_(t))return;const o=e[t],s=i[t];c_(o)&&c_(s)?x_(o,s,n):e[t]=v_(s)}function x_(t,e,i){const n=l_(e)?e:[e],o=n.length;if(!c_(t))return t;const s=(i=i||{}).merger||b_;let r;for(let e=0;e<o;++e){if(r=n[e],!c_(r))continue;const o=Object.keys(r);for(let e=0,n=o.length;e<n;++e)s(o[e],t,r,i)}return t}function __(t,e){return x_(t,e,{merger:w_})}function w_(t,e,i){if(!y_(t))return;const n=e[t],o=i[t];c_(n)&&c_(o)?__(n,o):Object.prototype.hasOwnProperty.call(e,t)||(e[t]=v_(o))}const k_={"":t=>t,x:t=>t.x,y:t=>t.y};function C_(t,e){const i=k_[e]||(k_[e]=function(t){const e=function(t){const e=t.split("."),i=[];let n="";for(const t of e)n+=t,n.endsWith("\\")?n=n.slice(0,-1)+".":(i.push(n),n="");return i}(t);return t=>{for(const i of e){if(""===i)break;t=t&&t[i]}return t}}(e));return i(t)}function S_(t){return t.charAt(0).toUpperCase()+t.slice(1)}const E_=t=>void 0!==t,A_=t=>"function"==typeof t,M_=(t,e)=>{if(t.size!==e.size)return!1;for(const i of t)if(!e.has(i))return!1;return!0};const T_=Math.PI,P_=2*T_,D_=P_+T_,I_=Number.POSITIVE_INFINITY,O_=T_/180,$_=T_/2,L_=T_/4,z_=2*T_/3,R_=Math.log10,N_=Math.sign;function j_(t,e,i){return Math.abs(t-e)<i}function B_(t){const e=Math.round(t);t=j_(t,e,t/1e3)?e:t;const i=Math.pow(10,Math.floor(R_(t))),n=t/i;return(n<=1?1:n<=2?2:n<=5?5:10)*i}function F_(t){return!function(t){return"symbol"==typeof t||"object"==typeof t&&null!==t&&!(Symbol.toPrimitive in t||"toString"in t||"valueOf"in t)}(t)&&!isNaN(parseFloat(t))&&isFinite(t)}function q_(t,e,i){let n,o,s;for(n=0,o=t.length;n<o;n++)s=t[n][i],isNaN(s)||(e.min=Math.min(e.min,s),e.max=Math.max(e.max,s))}function V_(t){return t*(T_/180)}function H_(t){return t*(180/T_)}function U_(t){if(!h_(t))return;let e=1,i=0;for(;Math.round(t*e)/e!==t;)e*=10,i++;return i}function W_(t,e){const i=e.x-t.x,n=e.y-t.y,o=Math.sqrt(i*i+n*n);let s=Math.atan2(n,i);return s<-.5*T_&&(s+=P_),{angle:s,distance:o}}function G_(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Z_(t,e){return(t-e+D_)%P_-T_}function Y_(t){return(t%P_+P_)%P_}function X_(t,e,i,n){const o=Y_(t),s=Y_(e),r=Y_(i),a=Y_(s-o),l=Y_(r-o),c=Y_(o-s),h=Y_(o-r);return o===s||o===r||n&&s===r||a>l&&c<h}function K_(t,e,i){return Math.max(e,Math.min(i,t))}function Q_(t,e,i,n=1e-6){return t>=Math.min(e,i)-n&&t<=Math.max(e,i)+n}function J_(t,e,i){i=i||(i=>t[i]<e);let n,o=t.length-1,s=0;for(;o-s>1;)n=s+o>>1,i(n)?s=n:o=n;return{lo:s,hi:o}}const tw=(t,e,i,n)=>J_(t,i,n?n=>{const o=t[n][e];return o<i||o===i&&t[n+1][e]===i}:n=>t[n][e]<i),ew=(t,e,i)=>J_(t,i,(n=>t[n][e]>=i));const iw=["push","pop","shift","splice","unshift"];function nw(t,e){const i=t._chartjs;if(!i)return;const n=i.listeners,o=n.indexOf(e);-1!==o&&n.splice(o,1),n.length>0||(iw.forEach((e=>{delete t[e]})),delete t._chartjs)}function ow(t){const e=new Set(t);return e.size===t.length?t:Array.from(e)}const sw="undefined"==typeof window?function(t){return t()}:window.requestAnimationFrame;function rw(t,e){let i=[],n=!1;return function(...o){i=o,n||(n=!0,sw.call(window,(()=>{n=!1,t.apply(e,i)})))}}const aw=t=>"start"===t?"left":"end"===t?"right":"center",lw=(t,e,i)=>"start"===t?e:"end"===t?i:(e+i)/2;function cw(t,e,i){const n=e.length;let o=0,s=n;if(t._sorted){const{iScale:r,vScale:a,_parsed:l}=t,c=t.dataset&&t.dataset.options?t.dataset.options.spanGaps:null,h=r.axis,{min:d,max:u,minDefined:p,maxDefined:m}=r.getUserBounds();if(p){if(o=Math.min(tw(l,h,d).lo,i?n:tw(e,h,r.getPixelForValue(d)).lo),c){const t=l.slice(0,o+1).reverse().findIndex((t=>!a_(t[a.axis])));o-=Math.max(0,t)}o=K_(o,0,n-1)}if(m){let t=Math.max(tw(l,r.axis,u,!0).hi+1,i?0:tw(e,h,r.getPixelForValue(u),!0).hi+1);if(c){const e=l.slice(t-1).findIndex((t=>!a_(t[a.axis])));t+=Math.max(0,e)}s=K_(t,o,n)-o}else s=n-o}return{start:o,count:s}}function hw(t){const{xScale:e,yScale:i,_scaleRanges:n}=t,o={xmin:e.min,xmax:e.max,ymin:i.min,ymax:i.max};if(!n)return t._scaleRanges=o,!0;const s=n.xmin!==e.min||n.xmax!==e.max||n.ymin!==i.min||n.ymax!==i.max;return Object.assign(n,o),s}const dw=t=>0===t||1===t,uw=(t,e,i)=>-Math.pow(2,10*(t-=1))*Math.sin((t-e)*P_/i),pw=(t,e,i)=>Math.pow(2,-10*t)*Math.sin((t-e)*P_/i)+1,mw={linear:t=>t,easeInQuad:t=>t*t,easeOutQuad:t=>-t*(t-2),easeInOutQuad:t=>(t/=.5)<1?.5*t*t:-.5*(--t*(t-2)-1),easeInCubic:t=>t*t*t,easeOutCubic:t=>(t-=1)*t*t+1,easeInOutCubic:t=>(t/=.5)<1?.5*t*t*t:.5*((t-=2)*t*t+2),easeInQuart:t=>t*t*t*t,easeOutQuart:t=>-((t-=1)*t*t*t-1),easeInOutQuart:t=>(t/=.5)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2),easeInQuint:t=>t*t*t*t*t,easeOutQuint:t=>(t-=1)*t*t*t*t+1,easeInOutQuint:t=>(t/=.5)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2),easeInSine:t=>1-Math.cos(t*$_),easeOutSine:t=>Math.sin(t*$_),easeInOutSine:t=>-.5*(Math.cos(T_*t)-1),easeInExpo:t=>0===t?0:Math.pow(2,10*(t-1)),easeOutExpo:t=>1===t?1:1-Math.pow(2,-10*t),easeInOutExpo:t=>dw(t)?t:t<.5?.5*Math.pow(2,10*(2*t-1)):.5*(2-Math.pow(2,-10*(2*t-1))),easeInCirc:t=>t>=1?t:-(Math.sqrt(1-t*t)-1),easeOutCirc:t=>Math.sqrt(1-(t-=1)*t),easeInOutCirc:t=>(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1),easeInElastic:t=>dw(t)?t:uw(t,.075,.3),easeOutElastic:t=>dw(t)?t:pw(t,.075,.3),easeInOutElastic(t){const e=.1125;return dw(t)?t:t<.5?.5*uw(2*t,e,.45):.5+.5*pw(2*t-1,e,.45)},easeInBack(t){const e=1.70158;return t*t*((e+1)*t-e)},easeOutBack(t){const e=1.70158;return(t-=1)*t*((e+1)*t+e)+1},easeInOutBack(t){let e=1.70158;return(t/=.5)<1?t*t*((1+(e*=1.525))*t-e)*.5:.5*((t-=2)*t*((1+(e*=1.525))*t+e)+2)},easeInBounce:t=>1-mw.easeOutBounce(1-t),easeOutBounce(t){const e=7.5625,i=2.75;return t<1/i?e*t*t:t<2/i?e*(t-=1.5/i)*t+.75:t<2.5/i?e*(t-=2.25/i)*t+.9375:e*(t-=2.625/i)*t+.984375},easeInOutBounce:t=>t<.5?.5*mw.easeInBounce(2*t):.5*mw.easeOutBounce(2*t-1)+.5};function gw(t){if(t&&"object"==typeof t){const e=t.toString();return"[object CanvasPattern]"===e||"[object CanvasGradient]"===e}return!1}function fw(t){return gw(t)?t:new o_(t)}function vw(t){return gw(t)?t:new o_(t).saturate(.5).darken(.1).hexString()}const yw=["x","y","borderWidth","radius","tension"],bw=["color","borderColor","backgroundColor"];const xw=new Map;function _w(t,e,i){return function(t,e){e=e||{};const i=t+JSON.stringify(e);let n=xw.get(i);return n||(n=new Intl.NumberFormat(t,e),xw.set(i,n)),n}(e,i).format(t)}const ww={values:t=>l_(t)?t:""+t,numeric(t,e,i){if(0===t)return"0";const n=this.chart.options.locale;let o,s=t;if(i.length>1){const e=Math.max(Math.abs(i[0].value),Math.abs(i[i.length-1].value));(e<1e-4||e>1e15)&&(o="scientific"),s=function(t,e){let i=e.length>3?e[2].value-e[1].value:e[1].value-e[0].value;Math.abs(i)>=1&&t!==Math.floor(t)&&(i=t-Math.floor(t));return i}(t,i)}const r=R_(Math.abs(s)),a=isNaN(r)?1:Math.max(Math.min(-1*Math.floor(r),20),0),l={notation:o,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(l,this.options.ticks.format),_w(t,n,l)},logarithmic(t,e,i){if(0===t)return"0";const n=i[e].significand||t/Math.pow(10,Math.floor(R_(t)));return[1,2,3,5,10,15].includes(n)||e>.8*i.length?ww.numeric.call(this,t,e,i):""}};var kw={formatters:ww};const Cw=Object.create(null),Sw=Object.create(null);function Ew(t,e){if(!e)return t;const i=e.split(".");for(let e=0,n=i.length;e<n;++e){const n=i[e];t=t[n]||(t[n]=Object.create(null))}return t}function Aw(t,e,i){return"string"==typeof e?x_(Ew(t,e),i):x_(Ew(t,""),e)}class Mw{constructor(t,e){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=t=>t.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(t,e)=>vw(e.backgroundColor),this.hoverBorderColor=(t,e)=>vw(e.borderColor),this.hoverColor=(t,e)=>vw(e.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(e)}set(t,e){return Aw(this,t,e)}get(t){return Ew(this,t)}describe(t,e){return Aw(Sw,t,e)}override(t,e){return Aw(Cw,t,e)}route(t,e,i,n){const o=Ew(this,t),s=Ew(this,i),r="_"+e;Object.defineProperties(o,{[r]:{value:o[e],writable:!0},[e]:{enumerable:!0,get(){const t=this[r],e=s[n];return c_(t)?Object.assign({},e,t):u_(t,e)},set(t){this[r]=t}}})}apply(t){t.forEach((t=>t(this)))}}var Tw=new Mw({_scriptable:t=>!t.startsWith("on"),_indexable:t=>"events"!==t,hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[function(t){t.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),t.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>"onProgress"!==t&&"onComplete"!==t&&"fn"!==t}),t.set("animations",{colors:{type:"color",properties:bw},numbers:{type:"number",properties:yw}}),t.describe("animations",{_fallback:"animation"}),t.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>0|t}}}})},function(t){t.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})},function(t){t.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,e)=>e.lineWidth,tickColor:(t,e)=>e.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:kw.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),t.route("scale.ticks","color","","color"),t.route("scale.grid","color","","borderColor"),t.route("scale.border","color","","borderColor"),t.route("scale.title","color","","color"),t.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&"callback"!==t&&"parser"!==t,_indexable:t=>"borderDash"!==t&&"tickBorderDash"!==t&&"dash"!==t}),t.describe("scales",{_fallback:"scale"}),t.describe("scale.ticks",{_scriptable:t=>"backdropPadding"!==t&&"callback"!==t,_indexable:t=>"backdropPadding"!==t})}]);function Pw(t,e,i,n,o){let s=e[o];return s||(s=e[o]=t.measureText(o).width,i.push(o)),s>n&&(n=s),n}function Dw(t,e,i,n){let o=(n=n||{}).data=n.data||{},s=n.garbageCollect=n.garbageCollect||[];n.font!==e&&(o=n.data={},s=n.garbageCollect=[],n.font=e),t.save(),t.font=e;let r=0;const a=i.length;let l,c,h,d,u;for(l=0;l<a;l++)if(d=i[l],null==d||l_(d)){if(l_(d))for(c=0,h=d.length;c<h;c++)u=d[c],null==u||l_(u)||(r=Pw(t,o,s,r,u))}else r=Pw(t,o,s,r,d);t.restore();const p=s.length/2;if(p>i.length){for(l=0;l<p;l++)delete o[s[l]];s.splice(0,p)}return r}function Iw(t,e,i){const n=t.currentDevicePixelRatio,o=0!==i?Math.max(i/2,.5):0;return Math.round((e-o)*n)/n+o}function Ow(t,e){(e||t)&&((e=e||t.getContext("2d")).save(),e.resetTransform(),e.clearRect(0,0,t.width,t.height),e.restore())}function $w(t,e,i,n){Lw(t,e,i,n,null)}function Lw(t,e,i,n,o){let s,r,a,l,c,h,d,u;const p=e.pointStyle,m=e.rotation,g=e.radius;let f=(m||0)*O_;if(p&&"object"==typeof p&&(s=p.toString(),"[object HTMLImageElement]"===s||"[object HTMLCanvasElement]"===s))return t.save(),t.translate(i,n),t.rotate(f),t.drawImage(p,-p.width/2,-p.height/2,p.width,p.height),void t.restore();if(!(isNaN(g)||g<=0)){switch(t.beginPath(),p){default:o?t.ellipse(i,n,o/2,g,0,0,P_):t.arc(i,n,g,0,P_),t.closePath();break;case"triangle":h=o?o/2:g,t.moveTo(i+Math.sin(f)*h,n-Math.cos(f)*g),f+=z_,t.lineTo(i+Math.sin(f)*h,n-Math.cos(f)*g),f+=z_,t.lineTo(i+Math.sin(f)*h,n-Math.cos(f)*g),t.closePath();break;case"rectRounded":c=.516*g,l=g-c,r=Math.cos(f+L_)*l,d=Math.cos(f+L_)*(o?o/2-c:l),a=Math.sin(f+L_)*l,u=Math.sin(f+L_)*(o?o/2-c:l),t.arc(i-d,n-a,c,f-T_,f-$_),t.arc(i+u,n-r,c,f-$_,f),t.arc(i+d,n+a,c,f,f+$_),t.arc(i-u,n+r,c,f+$_,f+T_),t.closePath();break;case"rect":if(!m){l=Math.SQRT1_2*g,h=o?o/2:l,t.rect(i-h,n-l,2*h,2*l);break}f+=L_;case"rectRot":d=Math.cos(f)*(o?o/2:g),r=Math.cos(f)*g,a=Math.sin(f)*g,u=Math.sin(f)*(o?o/2:g),t.moveTo(i-d,n-a),t.lineTo(i+u,n-r),t.lineTo(i+d,n+a),t.lineTo(i-u,n+r),t.closePath();break;case"crossRot":f+=L_;case"cross":d=Math.cos(f)*(o?o/2:g),r=Math.cos(f)*g,a=Math.sin(f)*g,u=Math.sin(f)*(o?o/2:g),t.moveTo(i-d,n-a),t.lineTo(i+d,n+a),t.moveTo(i+u,n-r),t.lineTo(i-u,n+r);break;case"star":d=Math.cos(f)*(o?o/2:g),r=Math.cos(f)*g,a=Math.sin(f)*g,u=Math.sin(f)*(o?o/2:g),t.moveTo(i-d,n-a),t.lineTo(i+d,n+a),t.moveTo(i+u,n-r),t.lineTo(i-u,n+r),f+=L_,d=Math.cos(f)*(o?o/2:g),r=Math.cos(f)*g,a=Math.sin(f)*g,u=Math.sin(f)*(o?o/2:g),t.moveTo(i-d,n-a),t.lineTo(i+d,n+a),t.moveTo(i+u,n-r),t.lineTo(i-u,n+r);break;case"line":r=o?o/2:Math.cos(f)*g,a=Math.sin(f)*g,t.moveTo(i-r,n-a),t.lineTo(i+r,n+a);break;case"dash":t.moveTo(i,n),t.lineTo(i+Math.cos(f)*(o?o/2:g),n+Math.sin(f)*g);break;case!1:t.closePath()}t.fill(),e.borderWidth>0&&t.stroke()}}function zw(t,e,i){return i=i||.5,!e||t&&t.x>e.left-i&&t.x<e.right+i&&t.y>e.top-i&&t.y<e.bottom+i}function Rw(t,e){t.save(),t.beginPath(),t.rect(e.left,e.top,e.right-e.left,e.bottom-e.top),t.clip()}function Nw(t){t.restore()}function jw(t,e,i,n,o){if(!e)return t.lineTo(i.x,i.y);if("middle"===o){const n=(e.x+i.x)/2;t.lineTo(n,e.y),t.lineTo(n,i.y)}else"after"===o!=!!n?t.lineTo(e.x,i.y):t.lineTo(i.x,e.y);t.lineTo(i.x,i.y)}function Bw(t,e,i,n){if(!e)return t.lineTo(i.x,i.y);t.bezierCurveTo(n?e.cp1x:e.cp2x,n?e.cp1y:e.cp2y,n?i.cp2x:i.cp1x,n?i.cp2y:i.cp1y,i.x,i.y)}function Fw(t,e,i,n,o){if(o.strikethrough||o.underline){const s=t.measureText(n),r=e-s.actualBoundingBoxLeft,a=e+s.actualBoundingBoxRight,l=i-s.actualBoundingBoxAscent,c=i+s.actualBoundingBoxDescent,h=o.strikethrough?(l+c)/2:c;t.strokeStyle=t.fillStyle,t.beginPath(),t.lineWidth=o.decorationWidth||2,t.moveTo(r,h),t.lineTo(a,h),t.stroke()}}function qw(t,e){const i=t.fillStyle;t.fillStyle=e.color,t.fillRect(e.left,e.top,e.width,e.height),t.fillStyle=i}function Vw(t,e,i,n,o,s={}){const r=l_(e)?e:[e],a=s.strokeWidth>0&&""!==s.strokeColor;let l,c;for(t.save(),t.font=o.string,function(t,e){e.translation&&t.translate(e.translation[0],e.translation[1]),a_(e.rotation)||t.rotate(e.rotation),e.color&&(t.fillStyle=e.color),e.textAlign&&(t.textAlign=e.textAlign),e.textBaseline&&(t.textBaseline=e.textBaseline)}(t,s),l=0;l<r.length;++l)c=r[l],s.backdrop&&qw(t,s.backdrop),a&&(s.strokeColor&&(t.strokeStyle=s.strokeColor),a_(s.strokeWidth)||(t.lineWidth=s.strokeWidth),t.strokeText(c,i,n,s.maxWidth)),t.fillText(c,i,n,s.maxWidth),Fw(t,i,n,c,s),n+=Number(o.lineHeight);t.restore()}function Hw(t,e){const{x:i,y:n,w:o,h:s,radius:r}=e;t.arc(i+r.topLeft,n+r.topLeft,r.topLeft,1.5*T_,T_,!0),t.lineTo(i,n+s-r.bottomLeft),t.arc(i+r.bottomLeft,n+s-r.bottomLeft,r.bottomLeft,T_,$_,!0),t.lineTo(i+o-r.bottomRight,n+s),t.arc(i+o-r.bottomRight,n+s-r.bottomRight,r.bottomRight,$_,0,!0),t.lineTo(i+o,n+r.topRight),t.arc(i+o-r.topRight,n+r.topRight,r.topRight,0,-$_,!0),t.lineTo(i+r.topLeft,n)}const Uw=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,Ww=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function Gw(t,e){const i=(""+t).match(Uw);if(!i||"normal"===i[1])return 1.2*e;switch(t=+i[2],i[3]){case"px":return t;case"%":t/=100}return e*t}const Zw=t=>+t||0;function Yw(t,e){const i={},n=c_(e),o=n?Object.keys(e):e,s=c_(t)?n?i=>u_(t[i],t[e[i]]):e=>t[e]:()=>t;for(const t of o)i[t]=Zw(s(t));return i}function Xw(t){return Yw(t,{top:"y",right:"x",bottom:"y",left:"x"})}function Kw(t){return Yw(t,["topLeft","topRight","bottomLeft","bottomRight"])}function Qw(t){const e=Xw(t);return e.width=e.left+e.right,e.height=e.top+e.bottom,e}function Jw(t,e){t=t||{},e=e||Tw.font;let i=u_(t.size,e.size);"string"==typeof i&&(i=parseInt(i,10));let n=u_(t.style,e.style);n&&!(""+n).match(Ww)&&(console.warn('Invalid font style specified: "'+n+'"'),n=void 0);const o={family:u_(t.family,e.family),lineHeight:Gw(u_(t.lineHeight,e.lineHeight),i),size:i,style:n,weight:u_(t.weight,e.weight),string:""};return o.string=function(t){return!t||a_(t.size)||a_(t.family)?null:(t.style?t.style+" ":"")+(t.weight?t.weight+" ":"")+t.size+"px "+t.family}(o),o}function tk(t,e,i,n){let o,s,r,a=!0;for(o=0,s=t.length;o<s;++o)if(r=t[o],void 0!==r&&(void 0!==e&&"function"==typeof r&&(r=r(e),a=!1),void 0!==i&&l_(r)&&(r=r[i%r.length],a=!1),void 0!==r))return n&&!a&&(n.cacheable=!1),r}function ek(t,e){return Object.assign(Object.create(t),e)}function ik(t,e=[""],i,n,o=(()=>t[0])){const s=i||t;void 0===n&&(n=pk("_fallback",t));const r={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:t,_rootScopes:s,_fallback:n,_getTarget:o,override:i=>ik([i,...t],e,s,n)};return new Proxy(r,{deleteProperty:(e,i)=>(delete e[i],delete e._keys,delete t[0][i],!0),get:(i,n)=>ak(i,n,(()=>function(t,e,i,n){let o;for(const s of e)if(o=pk(sk(s,t),i),void 0!==o)return rk(t,o)?dk(i,n,t,o):o}(n,e,t,i))),getOwnPropertyDescriptor:(t,e)=>Reflect.getOwnPropertyDescriptor(t._scopes[0],e),getPrototypeOf:()=>Reflect.getPrototypeOf(t[0]),has:(t,e)=>mk(t).includes(e),ownKeys:t=>mk(t),set(t,e,i){const n=t._storage||(t._storage=o());return t[e]=n[e]=i,delete t._keys,!0}})}function nk(t,e,i,n){const o={_cacheable:!1,_proxy:t,_context:e,_subProxy:i,_stack:new Set,_descriptors:ok(t,n),setContext:e=>nk(t,e,i,n),override:o=>nk(t.override(o),e,i,n)};return new Proxy(o,{deleteProperty:(e,i)=>(delete e[i],delete t[i],!0),get:(t,e,i)=>ak(t,e,(()=>function(t,e,i){const{_proxy:n,_context:o,_subProxy:s,_descriptors:r}=t;let a=n[e];A_(a)&&r.isScriptable(e)&&(a=function(t,e,i,n){const{_proxy:o,_context:s,_subProxy:r,_stack:a}=i;if(a.has(t))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+t);a.add(t);let l=e(s,r||n);a.delete(t),rk(t,l)&&(l=dk(o._scopes,o,t,l));return l}(e,a,t,i));l_(a)&&a.length&&(a=function(t,e,i,n){const{_proxy:o,_context:s,_subProxy:r,_descriptors:a}=i;if(void 0!==s.index&&n(t))return e[s.index%e.length];if(c_(e[0])){const i=e,n=o._scopes.filter((t=>t!==i));e=[];for(const l of i){const i=dk(n,o,t,l);e.push(nk(i,s,r&&r[t],a))}}return e}(e,a,t,r.isIndexable));rk(e,a)&&(a=nk(a,o,s&&s[e],r));return a}(t,e,i))),getOwnPropertyDescriptor:(e,i)=>e._descriptors.allKeys?Reflect.has(t,i)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(t,i),getPrototypeOf:()=>Reflect.getPrototypeOf(t),has:(e,i)=>Reflect.has(t,i),ownKeys:()=>Reflect.ownKeys(t),set:(e,i,n)=>(t[i]=n,delete e[i],!0)})}function ok(t,e={scriptable:!0,indexable:!0}){const{_scriptable:i=e.scriptable,_indexable:n=e.indexable,_allKeys:o=e.allKeys}=t;return{allKeys:o,scriptable:i,indexable:n,isScriptable:A_(i)?i:()=>i,isIndexable:A_(n)?n:()=>n}}const sk=(t,e)=>t?t+S_(e):e,rk=(t,e)=>c_(e)&&"adapters"!==t&&(null===Object.getPrototypeOf(e)||e.constructor===Object);function ak(t,e,i){if(Object.prototype.hasOwnProperty.call(t,e)||"constructor"===e)return t[e];const n=i();return t[e]=n,n}function lk(t,e,i){return A_(t)?t(e,i):t}const ck=(t,e)=>!0===t?e:"string"==typeof t?C_(e,t):void 0;function hk(t,e,i,n,o){for(const s of e){const e=ck(i,s);if(e){t.add(e);const s=lk(e._fallback,i,o);if(void 0!==s&&s!==i&&s!==n)return s}else if(!1===e&&void 0!==n&&i!==n)return null}return!1}function dk(t,e,i,n){const o=e._rootScopes,s=lk(e._fallback,i,n),r=[...t,...o],a=new Set;a.add(n);let l=uk(a,r,i,s||i,n);return null!==l&&((void 0===s||s===i||(l=uk(a,r,s,l,n),null!==l))&&ik(Array.from(a),[""],o,s,(()=>function(t,e,i){const n=t._getTarget();e in n||(n[e]={});const o=n[e];if(l_(o)&&c_(i))return i;return o||{}}(e,i,n))))}function uk(t,e,i,n,o){for(;i;)i=hk(t,e,i,n,o);return i}function pk(t,e){for(const i of e){if(!i)continue;const e=i[t];if(void 0!==e)return e}}function mk(t){let e=t._keys;return e||(e=t._keys=function(t){const e=new Set;for(const i of t)for(const t of Object.keys(i).filter((t=>!t.startsWith("_"))))e.add(t);return Array.from(e)}(t._scopes)),e}function gk(t,e,i,n){const{iScale:o}=t,{key:s="r"}=this._parsing,r=new Array(n);let a,l,c,h;for(a=0,l=n;a<l;++a)c=a+i,h=e[c],r[a]={r:o.parse(C_(h,s),c)};return r}const fk=Number.EPSILON||1e-14,vk=(t,e)=>e<t.length&&!t[e].skip&&t[e],yk=t=>"x"===t?"y":"x";function bk(t,e,i,n){const o=t.skip?e:t,s=e,r=i.skip?e:i,a=G_(s,o),l=G_(r,s);let c=a/(a+l),h=l/(a+l);c=isNaN(c)?0:c,h=isNaN(h)?0:h;const d=n*c,u=n*h;return{previous:{x:s.x-d*(r.x-o.x),y:s.y-d*(r.y-o.y)},next:{x:s.x+u*(r.x-o.x),y:s.y+u*(r.y-o.y)}}}function xk(t,e="x"){const i=yk(e),n=t.length,o=Array(n).fill(0),s=Array(n);let r,a,l,c=vk(t,0);for(r=0;r<n;++r)if(a=l,l=c,c=vk(t,r+1),l){if(c){const t=c[e]-l[e];o[r]=0!==t?(c[i]-l[i])/t:0}s[r]=a?c?N_(o[r-1])!==N_(o[r])?0:(o[r-1]+o[r])/2:o[r-1]:o[r]}!function(t,e,i){const n=t.length;let o,s,r,a,l,c=vk(t,0);for(let h=0;h<n-1;++h)l=c,c=vk(t,h+1),l&&c&&(j_(e[h],0,fk)?i[h]=i[h+1]=0:(o=i[h]/e[h],s=i[h+1]/e[h],a=Math.pow(o,2)+Math.pow(s,2),a<=9||(r=3/Math.sqrt(a),i[h]=o*r*e[h],i[h+1]=s*r*e[h])))}(t,o,s),function(t,e,i="x"){const n=yk(i),o=t.length;let s,r,a,l=vk(t,0);for(let c=0;c<o;++c){if(r=a,a=l,l=vk(t,c+1),!a)continue;const o=a[i],h=a[n];r&&(s=(o-r[i])/3,a[`cp1${i}`]=o-s,a[`cp1${n}`]=h-s*e[c]),l&&(s=(l[i]-o)/3,a[`cp2${i}`]=o+s,a[`cp2${n}`]=h+s*e[c])}}(t,s,e)}function _k(t,e,i){return Math.max(Math.min(t,i),e)}function wk(t,e,i,n,o){let s,r,a,l;if(e.spanGaps&&(t=t.filter((t=>!t.skip))),"monotone"===e.cubicInterpolationMode)xk(t,o);else{let i=n?t[t.length-1]:t[0];for(s=0,r=t.length;s<r;++s)a=t[s],l=bk(i,a,t[Math.min(s+1,r-(n?0:1))%r],e.tension),a.cp1x=l.previous.x,a.cp1y=l.previous.y,a.cp2x=l.next.x,a.cp2y=l.next.y,i=a}e.capBezierPoints&&function(t,e){let i,n,o,s,r,a=zw(t[0],e);for(i=0,n=t.length;i<n;++i)r=s,s=a,a=i<n-1&&zw(t[i+1],e),s&&(o=t[i],r&&(o.cp1x=_k(o.cp1x,e.left,e.right),o.cp1y=_k(o.cp1y,e.top,e.bottom)),a&&(o.cp2x=_k(o.cp2x,e.left,e.right),o.cp2y=_k(o.cp2y,e.top,e.bottom)))}(t,i)}function kk(){return"undefined"!=typeof window&&"undefined"!=typeof document}function Ck(t){let e=t.parentNode;return e&&"[object ShadowRoot]"===e.toString()&&(e=e.host),e}function Sk(t,e,i){let n;return"string"==typeof t?(n=parseInt(t,10),-1!==t.indexOf("%")&&(n=n/100*e.parentNode[i])):n=t,n}const Ek=t=>t.ownerDocument.defaultView.getComputedStyle(t,null);const Ak=["top","right","bottom","left"];function Mk(t,e,i){const n={};i=i?"-"+i:"";for(let o=0;o<4;o++){const s=Ak[o];n[s]=parseFloat(t[e+"-"+s+i])||0}return n.width=n.left+n.right,n.height=n.top+n.bottom,n}const Tk=(t,e,i)=>(t>0||e>0)&&(!i||!i.shadowRoot);function Pk(t,e){if("native"in t)return t;const{canvas:i,currentDevicePixelRatio:n}=e,o=Ek(i),s="border-box"===o.boxSizing,r=Mk(o,"padding"),a=Mk(o,"border","width"),{x:l,y:c,box:h}=function(t,e){const i=t.touches,n=i&&i.length?i[0]:t,{offsetX:o,offsetY:s}=n;let r,a,l=!1;if(Tk(o,s,t.target))r=o,a=s;else{const t=e.getBoundingClientRect();r=n.clientX-t.left,a=n.clientY-t.top,l=!0}return{x:r,y:a,box:l}}(t,i),d=r.left+(h&&a.left),u=r.top+(h&&a.top);let{width:p,height:m}=e;return s&&(p-=r.width+a.width,m-=r.height+a.height),{x:Math.round((l-d)/p*i.width/n),y:Math.round((c-u)/m*i.height/n)}}const Dk=t=>Math.round(10*t)/10;function Ik(t,e,i,n){const o=Ek(t),s=Mk(o,"margin"),r=Sk(o.maxWidth,t,"clientWidth")||I_,a=Sk(o.maxHeight,t,"clientHeight")||I_,l=function(t,e,i){let n,o;if(void 0===e||void 0===i){const s=t&&Ck(t);if(s){const t=s.getBoundingClientRect(),r=Ek(s),a=Mk(r,"border","width"),l=Mk(r,"padding");e=t.width-l.width-a.width,i=t.height-l.height-a.height,n=Sk(r.maxWidth,s,"clientWidth"),o=Sk(r.maxHeight,s,"clientHeight")}else e=t.clientWidth,i=t.clientHeight}return{width:e,height:i,maxWidth:n||I_,maxHeight:o||I_}}(t,e,i);let{width:c,height:h}=l;if("content-box"===o.boxSizing){const t=Mk(o,"border","width"),e=Mk(o,"padding");c-=e.width+t.width,h-=e.height+t.height}c=Math.max(0,c-s.width),h=Math.max(0,n?c/n:h-s.height),c=Dk(Math.min(c,r,l.maxWidth)),h=Dk(Math.min(h,a,l.maxHeight)),c&&!h&&(h=Dk(c/2));return(void 0!==e||void 0!==i)&&n&&l.height&&h>l.height&&(h=l.height,c=Dk(Math.floor(h*n))),{width:c,height:h}}function Ok(t,e,i){const n=e||1,o=Math.floor(t.height*n),s=Math.floor(t.width*n);t.height=Math.floor(t.height),t.width=Math.floor(t.width);const r=t.canvas;return r.style&&(i||!r.style.height&&!r.style.width)&&(r.style.height=`${t.height}px`,r.style.width=`${t.width}px`),(t.currentDevicePixelRatio!==n||r.height!==o||r.width!==s)&&(t.currentDevicePixelRatio=n,r.height=o,r.width=s,t.ctx.setTransform(n,0,0,n,0,0),!0)}const $k=function(){let t=!1;try{const e={get passive(){return t=!0,!1}};kk()&&(window.addEventListener("test",null,e),window.removeEventListener("test",null,e))}catch(t){}return t}();function Lk(t,e){const i=function(t,e){return Ek(t).getPropertyValue(e)}(t,e),n=i&&i.match(/^(\d+)(\.\d+)?px$/);return n?+n[1]:void 0}function zk(t,e,i,n){return{x:t.x+i*(e.x-t.x),y:t.y+i*(e.y-t.y)}}function Rk(t,e,i,n){return{x:t.x+i*(e.x-t.x),y:"middle"===n?i<.5?t.y:e.y:"after"===n?i<1?t.y:e.y:i>0?e.y:t.y}}function Nk(t,e,i,n){const o={x:t.cp2x,y:t.cp2y},s={x:e.cp1x,y:e.cp1y},r=zk(t,o,i),a=zk(o,s,i),l=zk(s,e,i),c=zk(r,a,i),h=zk(a,l,i);return zk(c,h,i)}function jk(t,e,i){return t?function(t,e){return{x:i=>t+t+e-i,setWidth(t){e=t},textAlign:t=>"center"===t?t:"right"===t?"left":"right",xPlus:(t,e)=>t-e,leftForLtr:(t,e)=>t-e}}(e,i):{x:t=>t,setWidth(t){},textAlign:t=>t,xPlus:(t,e)=>t+e,leftForLtr:(t,e)=>t}}function Bk(t,e){let i,n;"ltr"!==e&&"rtl"!==e||(i=t.canvas.style,n=[i.getPropertyValue("direction"),i.getPropertyPriority("direction")],i.setProperty("direction",e,"important"),t.prevTextDirection=n)}function Fk(t,e){void 0!==e&&(delete t.prevTextDirection,t.canvas.style.setProperty("direction",e[0],e[1]))}function qk(t){return"angle"===t?{between:X_,compare:Z_,normalize:Y_}:{between:Q_,compare:(t,e)=>t-e,normalize:t=>t}}function Vk({start:t,end:e,count:i,loop:n,style:o}){return{start:t%i,end:e%i,loop:n&&(e-t+1)%i==0,style:o}}function Hk(t,e,i){if(!i)return[t];const{property:n,start:o,end:s}=i,r=e.length,{compare:a,between:l,normalize:c}=qk(n),{start:h,end:d,loop:u,style:p}=function(t,e,i){const{property:n,start:o,end:s}=i,{between:r,normalize:a}=qk(n),l=e.length;let c,h,{start:d,end:u,loop:p}=t;if(p){for(d+=l,u+=l,c=0,h=l;c<h&&r(a(e[d%l][n]),o,s);++c)d--,u--;d%=l,u%=l}return u<d&&(u+=l),{start:d,end:u,loop:p,style:t.style}}(t,e,i),m=[];let g,f,v,y=!1,b=null;const x=()=>y||l(o,v,g)&&0!==a(o,v),_=()=>!y||0===a(s,g)||l(s,v,g);for(let t=h,i=h;t<=d;++t)f=e[t%r],f.skip||(g=c(f[n]),g!==v&&(y=l(g,o,s),null===b&&x()&&(b=0===a(g,o)?t:i),null!==b&&_()&&(m.push(Vk({start:b,end:t,loop:u,count:r,style:p})),b=null),i=t,v=g));return null!==b&&m.push(Vk({start:b,end:d,loop:u,count:r,style:p})),m}function Uk(t,e){const i=[],n=t.segments;for(let o=0;o<n.length;o++){const s=Hk(n[o],t.points,e);s.length&&i.push(...s)}return i}function Wk(t,e,i,n){return n&&n.setContext&&i?function(t,e,i,n){const o=t._chart.getContext(),s=Gk(t.options),{_datasetIndex:r,options:{spanGaps:a}}=t,l=i.length,c=[];let h=s,d=e[0].start,u=d;function p(t,e,n,o){const s=a?-1:1;if(t!==e){for(t+=l;i[t%l].skip;)t-=s;for(;i[e%l].skip;)e+=s;t%l!=e%l&&(c.push({start:t%l,end:e%l,loop:n,style:o}),h=o,d=e%l)}}for(const t of e){d=a?d:t.start;let e,s=i[d%l];for(u=d+1;u<=t.end;u++){const a=i[u%l];e=Gk(n.setContext(ek(o,{type:"segment",p0:s,p1:a,p0DataIndex:(u-1)%l,p1DataIndex:u%l,datasetIndex:r}))),Zk(e,h)&&p(d,u-1,t.loop,h),s=a,h=e}d<u-1&&p(d,u-1,t.loop,h)}return c}(t,e,i,n):e}function Gk(t){return{backgroundColor:t.backgroundColor,borderCapStyle:t.borderCapStyle,borderDash:t.borderDash,borderDashOffset:t.borderDashOffset,borderJoinStyle:t.borderJoinStyle,borderWidth:t.borderWidth,borderColor:t.borderColor}}function Zk(t,e){if(!e)return!1;const i=[],n=function(t,e){return gw(e)?(i.includes(e)||i.push(e),i.indexOf(e)):e};return JSON.stringify(t,n)!==JSON.stringify(e,n)}
|
|
9466
|
+
*/function c_(){}const h_=(()=>{let t=0;return()=>t++})();function d_(t){return null==t}function u_(t){if(Array.isArray&&Array.isArray(t))return!0;const e=Object.prototype.toString.call(t);return"[object"===e.slice(0,7)&&"Array]"===e.slice(-6)}function p_(t){return null!==t&&"[object Object]"===Object.prototype.toString.call(t)}function m_(t){return("number"==typeof t||t instanceof Number)&&isFinite(+t)}function g_(t,e){return m_(t)?t:e}function f_(t,e){return void 0===t?e:t}const v_=(t,e)=>"string"==typeof t&&t.endsWith("%")?parseFloat(t)/100*e:+t;function y_(t,e,i){if(t&&"function"==typeof t.call)return t.apply(i,e)}function b_(t,e,i,n){let o,s,r;if(u_(t))if(s=t.length,n)for(o=s-1;o>=0;o--)e.call(i,t[o],o);else for(o=0;o<s;o++)e.call(i,t[o],o);else if(p_(t))for(r=Object.keys(t),s=r.length,o=0;o<s;o++)e.call(i,t[r[o]],r[o])}function x_(t,e){let i,n,o,s;if(!t||!e||t.length!==e.length)return!1;for(i=0,n=t.length;i<n;++i)if(o=t[i],s=e[i],o.datasetIndex!==s.datasetIndex||o.index!==s.index)return!1;return!0}function __(t){if(u_(t))return t.map(__);if(p_(t)){const e=Object.create(null),i=Object.keys(t),n=i.length;let o=0;for(;o<n;++o)e[i[o]]=__(t[i[o]]);return e}return t}function w_(t){return-1===["__proto__","prototype","constructor"].indexOf(t)}function k_(t,e,i,n){if(!w_(t))return;const o=e[t],s=i[t];p_(o)&&p_(s)?C_(o,s,n):e[t]=__(s)}function C_(t,e,i){const n=u_(e)?e:[e],o=n.length;if(!p_(t))return t;const s=(i=i||{}).merger||k_;let r;for(let e=0;e<o;++e){if(r=n[e],!p_(r))continue;const o=Object.keys(r);for(let e=0,n=o.length;e<n;++e)s(o[e],t,r,i)}return t}function S_(t,e){return C_(t,e,{merger:E_})}function E_(t,e,i){if(!w_(t))return;const n=e[t],o=i[t];p_(n)&&p_(o)?S_(n,o):Object.prototype.hasOwnProperty.call(e,t)||(e[t]=__(o))}const A_={"":t=>t,x:t=>t.x,y:t=>t.y};function M_(t,e){const i=A_[e]||(A_[e]=function(t){const e=function(t){const e=t.split("."),i=[];let n="";for(const t of e)n+=t,n.endsWith("\\")?n=n.slice(0,-1)+".":(i.push(n),n="");return i}(t);return t=>{for(const i of e){if(""===i)break;t=t&&t[i]}return t}}(e));return i(t)}function T_(t){return t.charAt(0).toUpperCase()+t.slice(1)}const P_=t=>void 0!==t,D_=t=>"function"==typeof t,I_=(t,e)=>{if(t.size!==e.size)return!1;for(const i of t)if(!e.has(i))return!1;return!0};const O_=Math.PI,$_=2*O_,L_=$_+O_,z_=Number.POSITIVE_INFINITY,R_=O_/180,N_=O_/2,j_=O_/4,B_=2*O_/3,F_=Math.log10,q_=Math.sign;function V_(t,e,i){return Math.abs(t-e)<i}function H_(t){const e=Math.round(t);t=V_(t,e,t/1e3)?e:t;const i=Math.pow(10,Math.floor(F_(t))),n=t/i;return(n<=1?1:n<=2?2:n<=5?5:10)*i}function U_(t){return!function(t){return"symbol"==typeof t||"object"==typeof t&&null!==t&&!(Symbol.toPrimitive in t||"toString"in t||"valueOf"in t)}(t)&&!isNaN(parseFloat(t))&&isFinite(t)}function W_(t,e,i){let n,o,s;for(n=0,o=t.length;n<o;n++)s=t[n][i],isNaN(s)||(e.min=Math.min(e.min,s),e.max=Math.max(e.max,s))}function G_(t){return t*(O_/180)}function Z_(t){return t*(180/O_)}function Y_(t){if(!m_(t))return;let e=1,i=0;for(;Math.round(t*e)/e!==t;)e*=10,i++;return i}function X_(t,e){const i=e.x-t.x,n=e.y-t.y,o=Math.sqrt(i*i+n*n);let s=Math.atan2(n,i);return s<-.5*O_&&(s+=$_),{angle:s,distance:o}}function K_(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Q_(t,e){return(t-e+L_)%$_-O_}function J_(t){return(t%$_+$_)%$_}function tw(t,e,i,n){const o=J_(t),s=J_(e),r=J_(i),a=J_(s-o),l=J_(r-o),c=J_(o-s),h=J_(o-r);return o===s||o===r||n&&s===r||a>l&&c<h}function ew(t,e,i){return Math.max(e,Math.min(i,t))}function iw(t,e,i,n=1e-6){return t>=Math.min(e,i)-n&&t<=Math.max(e,i)+n}function nw(t,e,i){i=i||(i=>t[i]<e);let n,o=t.length-1,s=0;for(;o-s>1;)n=s+o>>1,i(n)?s=n:o=n;return{lo:s,hi:o}}const ow=(t,e,i,n)=>nw(t,i,n?n=>{const o=t[n][e];return o<i||o===i&&t[n+1][e]===i}:n=>t[n][e]<i),sw=(t,e,i)=>nw(t,i,(n=>t[n][e]>=i));const rw=["push","pop","shift","splice","unshift"];function aw(t,e){const i=t._chartjs;if(!i)return;const n=i.listeners,o=n.indexOf(e);-1!==o&&n.splice(o,1),n.length>0||(rw.forEach((e=>{delete t[e]})),delete t._chartjs)}function lw(t){const e=new Set(t);return e.size===t.length?t:Array.from(e)}const cw="undefined"==typeof window?function(t){return t()}:window.requestAnimationFrame;function hw(t,e){let i=[],n=!1;return function(...o){i=o,n||(n=!0,cw.call(window,(()=>{n=!1,t.apply(e,i)})))}}const dw=t=>"start"===t?"left":"end"===t?"right":"center",uw=(t,e,i)=>"start"===t?e:"end"===t?i:(e+i)/2;function pw(t,e,i){const n=e.length;let o=0,s=n;if(t._sorted){const{iScale:r,vScale:a,_parsed:l}=t,c=t.dataset&&t.dataset.options?t.dataset.options.spanGaps:null,h=r.axis,{min:d,max:u,minDefined:p,maxDefined:m}=r.getUserBounds();if(p){if(o=Math.min(ow(l,h,d).lo,i?n:ow(e,h,r.getPixelForValue(d)).lo),c){const t=l.slice(0,o+1).reverse().findIndex((t=>!d_(t[a.axis])));o-=Math.max(0,t)}o=ew(o,0,n-1)}if(m){let t=Math.max(ow(l,r.axis,u,!0).hi+1,i?0:ow(e,h,r.getPixelForValue(u),!0).hi+1);if(c){const e=l.slice(t-1).findIndex((t=>!d_(t[a.axis])));t+=Math.max(0,e)}s=ew(t,o,n)-o}else s=n-o}return{start:o,count:s}}function mw(t){const{xScale:e,yScale:i,_scaleRanges:n}=t,o={xmin:e.min,xmax:e.max,ymin:i.min,ymax:i.max};if(!n)return t._scaleRanges=o,!0;const s=n.xmin!==e.min||n.xmax!==e.max||n.ymin!==i.min||n.ymax!==i.max;return Object.assign(n,o),s}const gw=t=>0===t||1===t,fw=(t,e,i)=>-Math.pow(2,10*(t-=1))*Math.sin((t-e)*$_/i),vw=(t,e,i)=>Math.pow(2,-10*t)*Math.sin((t-e)*$_/i)+1,yw={linear:t=>t,easeInQuad:t=>t*t,easeOutQuad:t=>-t*(t-2),easeInOutQuad:t=>(t/=.5)<1?.5*t*t:-.5*(--t*(t-2)-1),easeInCubic:t=>t*t*t,easeOutCubic:t=>(t-=1)*t*t+1,easeInOutCubic:t=>(t/=.5)<1?.5*t*t*t:.5*((t-=2)*t*t+2),easeInQuart:t=>t*t*t*t,easeOutQuart:t=>-((t-=1)*t*t*t-1),easeInOutQuart:t=>(t/=.5)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2),easeInQuint:t=>t*t*t*t*t,easeOutQuint:t=>(t-=1)*t*t*t*t+1,easeInOutQuint:t=>(t/=.5)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2),easeInSine:t=>1-Math.cos(t*N_),easeOutSine:t=>Math.sin(t*N_),easeInOutSine:t=>-.5*(Math.cos(O_*t)-1),easeInExpo:t=>0===t?0:Math.pow(2,10*(t-1)),easeOutExpo:t=>1===t?1:1-Math.pow(2,-10*t),easeInOutExpo:t=>gw(t)?t:t<.5?.5*Math.pow(2,10*(2*t-1)):.5*(2-Math.pow(2,-10*(2*t-1))),easeInCirc:t=>t>=1?t:-(Math.sqrt(1-t*t)-1),easeOutCirc:t=>Math.sqrt(1-(t-=1)*t),easeInOutCirc:t=>(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1),easeInElastic:t=>gw(t)?t:fw(t,.075,.3),easeOutElastic:t=>gw(t)?t:vw(t,.075,.3),easeInOutElastic(t){const e=.1125;return gw(t)?t:t<.5?.5*fw(2*t,e,.45):.5+.5*vw(2*t-1,e,.45)},easeInBack(t){const e=1.70158;return t*t*((e+1)*t-e)},easeOutBack(t){const e=1.70158;return(t-=1)*t*((e+1)*t+e)+1},easeInOutBack(t){let e=1.70158;return(t/=.5)<1?t*t*((1+(e*=1.525))*t-e)*.5:.5*((t-=2)*t*((1+(e*=1.525))*t+e)+2)},easeInBounce:t=>1-yw.easeOutBounce(1-t),easeOutBounce(t){const e=7.5625,i=2.75;return t<1/i?e*t*t:t<2/i?e*(t-=1.5/i)*t+.75:t<2.5/i?e*(t-=2.25/i)*t+.9375:e*(t-=2.625/i)*t+.984375},easeInOutBounce:t=>t<.5?.5*yw.easeInBounce(2*t):.5*yw.easeOutBounce(2*t-1)+.5};function bw(t){if(t&&"object"==typeof t){const e=t.toString();return"[object CanvasPattern]"===e||"[object CanvasGradient]"===e}return!1}function xw(t){return bw(t)?t:new l_(t)}function _w(t){return bw(t)?t:new l_(t).saturate(.5).darken(.1).hexString()}const ww=["x","y","borderWidth","radius","tension"],kw=["color","borderColor","backgroundColor"];const Cw=new Map;function Sw(t,e,i){return function(t,e){e=e||{};const i=t+JSON.stringify(e);let n=Cw.get(i);return n||(n=new Intl.NumberFormat(t,e),Cw.set(i,n)),n}(e,i).format(t)}const Ew={values:t=>u_(t)?t:""+t,numeric(t,e,i){if(0===t)return"0";const n=this.chart.options.locale;let o,s=t;if(i.length>1){const e=Math.max(Math.abs(i[0].value),Math.abs(i[i.length-1].value));(e<1e-4||e>1e15)&&(o="scientific"),s=function(t,e){let i=e.length>3?e[2].value-e[1].value:e[1].value-e[0].value;Math.abs(i)>=1&&t!==Math.floor(t)&&(i=t-Math.floor(t));return i}(t,i)}const r=F_(Math.abs(s)),a=isNaN(r)?1:Math.max(Math.min(-1*Math.floor(r),20),0),l={notation:o,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(l,this.options.ticks.format),Sw(t,n,l)},logarithmic(t,e,i){if(0===t)return"0";const n=i[e].significand||t/Math.pow(10,Math.floor(F_(t)));return[1,2,3,5,10,15].includes(n)||e>.8*i.length?Ew.numeric.call(this,t,e,i):""}};var Aw={formatters:Ew};const Mw=Object.create(null),Tw=Object.create(null);function Pw(t,e){if(!e)return t;const i=e.split(".");for(let e=0,n=i.length;e<n;++e){const n=i[e];t=t[n]||(t[n]=Object.create(null))}return t}function Dw(t,e,i){return"string"==typeof e?C_(Pw(t,e),i):C_(Pw(t,""),e)}class Iw{constructor(t,e){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=t=>t.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(t,e)=>_w(e.backgroundColor),this.hoverBorderColor=(t,e)=>_w(e.borderColor),this.hoverColor=(t,e)=>_w(e.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(e)}set(t,e){return Dw(this,t,e)}get(t){return Pw(this,t)}describe(t,e){return Dw(Tw,t,e)}override(t,e){return Dw(Mw,t,e)}route(t,e,i,n){const o=Pw(this,t),s=Pw(this,i),r="_"+e;Object.defineProperties(o,{[r]:{value:o[e],writable:!0},[e]:{enumerable:!0,get(){const t=this[r],e=s[n];return p_(t)?Object.assign({},e,t):f_(t,e)},set(t){this[r]=t}}})}apply(t){t.forEach((t=>t(this)))}}var Ow=new Iw({_scriptable:t=>!t.startsWith("on"),_indexable:t=>"events"!==t,hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[function(t){t.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),t.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>"onProgress"!==t&&"onComplete"!==t&&"fn"!==t}),t.set("animations",{colors:{type:"color",properties:kw},numbers:{type:"number",properties:ww}}),t.describe("animations",{_fallback:"animation"}),t.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>0|t}}}})},function(t){t.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})},function(t){t.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,e)=>e.lineWidth,tickColor:(t,e)=>e.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:Aw.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),t.route("scale.ticks","color","","color"),t.route("scale.grid","color","","borderColor"),t.route("scale.border","color","","borderColor"),t.route("scale.title","color","","color"),t.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&"callback"!==t&&"parser"!==t,_indexable:t=>"borderDash"!==t&&"tickBorderDash"!==t&&"dash"!==t}),t.describe("scales",{_fallback:"scale"}),t.describe("scale.ticks",{_scriptable:t=>"backdropPadding"!==t&&"callback"!==t,_indexable:t=>"backdropPadding"!==t})}]);function $w(t,e,i,n,o){let s=e[o];return s||(s=e[o]=t.measureText(o).width,i.push(o)),s>n&&(n=s),n}function Lw(t,e,i,n){let o=(n=n||{}).data=n.data||{},s=n.garbageCollect=n.garbageCollect||[];n.font!==e&&(o=n.data={},s=n.garbageCollect=[],n.font=e),t.save(),t.font=e;let r=0;const a=i.length;let l,c,h,d,u;for(l=0;l<a;l++)if(d=i[l],null==d||u_(d)){if(u_(d))for(c=0,h=d.length;c<h;c++)u=d[c],null==u||u_(u)||(r=$w(t,o,s,r,u))}else r=$w(t,o,s,r,d);t.restore();const p=s.length/2;if(p>i.length){for(l=0;l<p;l++)delete o[s[l]];s.splice(0,p)}return r}function zw(t,e,i){const n=t.currentDevicePixelRatio,o=0!==i?Math.max(i/2,.5):0;return Math.round((e-o)*n)/n+o}function Rw(t,e){(e||t)&&((e=e||t.getContext("2d")).save(),e.resetTransform(),e.clearRect(0,0,t.width,t.height),e.restore())}function Nw(t,e,i,n){jw(t,e,i,n,null)}function jw(t,e,i,n,o){let s,r,a,l,c,h,d,u;const p=e.pointStyle,m=e.rotation,g=e.radius;let f=(m||0)*R_;if(p&&"object"==typeof p&&(s=p.toString(),"[object HTMLImageElement]"===s||"[object HTMLCanvasElement]"===s))return t.save(),t.translate(i,n),t.rotate(f),t.drawImage(p,-p.width/2,-p.height/2,p.width,p.height),void t.restore();if(!(isNaN(g)||g<=0)){switch(t.beginPath(),p){default:o?t.ellipse(i,n,o/2,g,0,0,$_):t.arc(i,n,g,0,$_),t.closePath();break;case"triangle":h=o?o/2:g,t.moveTo(i+Math.sin(f)*h,n-Math.cos(f)*g),f+=B_,t.lineTo(i+Math.sin(f)*h,n-Math.cos(f)*g),f+=B_,t.lineTo(i+Math.sin(f)*h,n-Math.cos(f)*g),t.closePath();break;case"rectRounded":c=.516*g,l=g-c,r=Math.cos(f+j_)*l,d=Math.cos(f+j_)*(o?o/2-c:l),a=Math.sin(f+j_)*l,u=Math.sin(f+j_)*(o?o/2-c:l),t.arc(i-d,n-a,c,f-O_,f-N_),t.arc(i+u,n-r,c,f-N_,f),t.arc(i+d,n+a,c,f,f+N_),t.arc(i-u,n+r,c,f+N_,f+O_),t.closePath();break;case"rect":if(!m){l=Math.SQRT1_2*g,h=o?o/2:l,t.rect(i-h,n-l,2*h,2*l);break}f+=j_;case"rectRot":d=Math.cos(f)*(o?o/2:g),r=Math.cos(f)*g,a=Math.sin(f)*g,u=Math.sin(f)*(o?o/2:g),t.moveTo(i-d,n-a),t.lineTo(i+u,n-r),t.lineTo(i+d,n+a),t.lineTo(i-u,n+r),t.closePath();break;case"crossRot":f+=j_;case"cross":d=Math.cos(f)*(o?o/2:g),r=Math.cos(f)*g,a=Math.sin(f)*g,u=Math.sin(f)*(o?o/2:g),t.moveTo(i-d,n-a),t.lineTo(i+d,n+a),t.moveTo(i+u,n-r),t.lineTo(i-u,n+r);break;case"star":d=Math.cos(f)*(o?o/2:g),r=Math.cos(f)*g,a=Math.sin(f)*g,u=Math.sin(f)*(o?o/2:g),t.moveTo(i-d,n-a),t.lineTo(i+d,n+a),t.moveTo(i+u,n-r),t.lineTo(i-u,n+r),f+=j_,d=Math.cos(f)*(o?o/2:g),r=Math.cos(f)*g,a=Math.sin(f)*g,u=Math.sin(f)*(o?o/2:g),t.moveTo(i-d,n-a),t.lineTo(i+d,n+a),t.moveTo(i+u,n-r),t.lineTo(i-u,n+r);break;case"line":r=o?o/2:Math.cos(f)*g,a=Math.sin(f)*g,t.moveTo(i-r,n-a),t.lineTo(i+r,n+a);break;case"dash":t.moveTo(i,n),t.lineTo(i+Math.cos(f)*(o?o/2:g),n+Math.sin(f)*g);break;case!1:t.closePath()}t.fill(),e.borderWidth>0&&t.stroke()}}function Bw(t,e,i){return i=i||.5,!e||t&&t.x>e.left-i&&t.x<e.right+i&&t.y>e.top-i&&t.y<e.bottom+i}function Fw(t,e){t.save(),t.beginPath(),t.rect(e.left,e.top,e.right-e.left,e.bottom-e.top),t.clip()}function qw(t){t.restore()}function Vw(t,e,i,n,o){if(!e)return t.lineTo(i.x,i.y);if("middle"===o){const n=(e.x+i.x)/2;t.lineTo(n,e.y),t.lineTo(n,i.y)}else"after"===o!=!!n?t.lineTo(e.x,i.y):t.lineTo(i.x,e.y);t.lineTo(i.x,i.y)}function Hw(t,e,i,n){if(!e)return t.lineTo(i.x,i.y);t.bezierCurveTo(n?e.cp1x:e.cp2x,n?e.cp1y:e.cp2y,n?i.cp2x:i.cp1x,n?i.cp2y:i.cp1y,i.x,i.y)}function Uw(t,e,i,n,o){if(o.strikethrough||o.underline){const s=t.measureText(n),r=e-s.actualBoundingBoxLeft,a=e+s.actualBoundingBoxRight,l=i-s.actualBoundingBoxAscent,c=i+s.actualBoundingBoxDescent,h=o.strikethrough?(l+c)/2:c;t.strokeStyle=t.fillStyle,t.beginPath(),t.lineWidth=o.decorationWidth||2,t.moveTo(r,h),t.lineTo(a,h),t.stroke()}}function Ww(t,e){const i=t.fillStyle;t.fillStyle=e.color,t.fillRect(e.left,e.top,e.width,e.height),t.fillStyle=i}function Gw(t,e,i,n,o,s={}){const r=u_(e)?e:[e],a=s.strokeWidth>0&&""!==s.strokeColor;let l,c;for(t.save(),t.font=o.string,function(t,e){e.translation&&t.translate(e.translation[0],e.translation[1]),d_(e.rotation)||t.rotate(e.rotation),e.color&&(t.fillStyle=e.color),e.textAlign&&(t.textAlign=e.textAlign),e.textBaseline&&(t.textBaseline=e.textBaseline)}(t,s),l=0;l<r.length;++l)c=r[l],s.backdrop&&Ww(t,s.backdrop),a&&(s.strokeColor&&(t.strokeStyle=s.strokeColor),d_(s.strokeWidth)||(t.lineWidth=s.strokeWidth),t.strokeText(c,i,n,s.maxWidth)),t.fillText(c,i,n,s.maxWidth),Uw(t,i,n,c,s),n+=Number(o.lineHeight);t.restore()}function Zw(t,e){const{x:i,y:n,w:o,h:s,radius:r}=e;t.arc(i+r.topLeft,n+r.topLeft,r.topLeft,1.5*O_,O_,!0),t.lineTo(i,n+s-r.bottomLeft),t.arc(i+r.bottomLeft,n+s-r.bottomLeft,r.bottomLeft,O_,N_,!0),t.lineTo(i+o-r.bottomRight,n+s),t.arc(i+o-r.bottomRight,n+s-r.bottomRight,r.bottomRight,N_,0,!0),t.lineTo(i+o,n+r.topRight),t.arc(i+o-r.topRight,n+r.topRight,r.topRight,0,-N_,!0),t.lineTo(i+r.topLeft,n)}const Yw=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,Xw=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function Kw(t,e){const i=(""+t).match(Yw);if(!i||"normal"===i[1])return 1.2*e;switch(t=+i[2],i[3]){case"px":return t;case"%":t/=100}return e*t}const Qw=t=>+t||0;function Jw(t,e){const i={},n=p_(e),o=n?Object.keys(e):e,s=p_(t)?n?i=>f_(t[i],t[e[i]]):e=>t[e]:()=>t;for(const t of o)i[t]=Qw(s(t));return i}function tk(t){return Jw(t,{top:"y",right:"x",bottom:"y",left:"x"})}function ek(t){return Jw(t,["topLeft","topRight","bottomLeft","bottomRight"])}function ik(t){const e=tk(t);return e.width=e.left+e.right,e.height=e.top+e.bottom,e}function nk(t,e){t=t||{},e=e||Ow.font;let i=f_(t.size,e.size);"string"==typeof i&&(i=parseInt(i,10));let n=f_(t.style,e.style);n&&!(""+n).match(Xw)&&(console.warn('Invalid font style specified: "'+n+'"'),n=void 0);const o={family:f_(t.family,e.family),lineHeight:Kw(f_(t.lineHeight,e.lineHeight),i),size:i,style:n,weight:f_(t.weight,e.weight),string:""};return o.string=function(t){return!t||d_(t.size)||d_(t.family)?null:(t.style?t.style+" ":"")+(t.weight?t.weight+" ":"")+t.size+"px "+t.family}(o),o}function ok(t,e,i,n){let o,s,r,a=!0;for(o=0,s=t.length;o<s;++o)if(r=t[o],void 0!==r&&(void 0!==e&&"function"==typeof r&&(r=r(e),a=!1),void 0!==i&&u_(r)&&(r=r[i%r.length],a=!1),void 0!==r))return n&&!a&&(n.cacheable=!1),r}function sk(t,e){return Object.assign(Object.create(t),e)}function rk(t,e=[""],i,n,o=(()=>t[0])){const s=i||t;void 0===n&&(n=vk("_fallback",t));const r={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:t,_rootScopes:s,_fallback:n,_getTarget:o,override:i=>rk([i,...t],e,s,n)};return new Proxy(r,{deleteProperty:(e,i)=>(delete e[i],delete e._keys,delete t[0][i],!0),get:(i,n)=>dk(i,n,(()=>function(t,e,i,n){let o;for(const s of e)if(o=vk(ck(s,t),i),void 0!==o)return hk(t,o)?gk(i,n,t,o):o}(n,e,t,i))),getOwnPropertyDescriptor:(t,e)=>Reflect.getOwnPropertyDescriptor(t._scopes[0],e),getPrototypeOf:()=>Reflect.getPrototypeOf(t[0]),has:(t,e)=>yk(t).includes(e),ownKeys:t=>yk(t),set(t,e,i){const n=t._storage||(t._storage=o());return t[e]=n[e]=i,delete t._keys,!0}})}function ak(t,e,i,n){const o={_cacheable:!1,_proxy:t,_context:e,_subProxy:i,_stack:new Set,_descriptors:lk(t,n),setContext:e=>ak(t,e,i,n),override:o=>ak(t.override(o),e,i,n)};return new Proxy(o,{deleteProperty:(e,i)=>(delete e[i],delete t[i],!0),get:(t,e,i)=>dk(t,e,(()=>function(t,e,i){const{_proxy:n,_context:o,_subProxy:s,_descriptors:r}=t;let a=n[e];D_(a)&&r.isScriptable(e)&&(a=function(t,e,i,n){const{_proxy:o,_context:s,_subProxy:r,_stack:a}=i;if(a.has(t))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+t);a.add(t);let l=e(s,r||n);a.delete(t),hk(t,l)&&(l=gk(o._scopes,o,t,l));return l}(e,a,t,i));u_(a)&&a.length&&(a=function(t,e,i,n){const{_proxy:o,_context:s,_subProxy:r,_descriptors:a}=i;if(void 0!==s.index&&n(t))return e[s.index%e.length];if(p_(e[0])){const i=e,n=o._scopes.filter((t=>t!==i));e=[];for(const l of i){const i=gk(n,o,t,l);e.push(ak(i,s,r&&r[t],a))}}return e}(e,a,t,r.isIndexable));hk(e,a)&&(a=ak(a,o,s&&s[e],r));return a}(t,e,i))),getOwnPropertyDescriptor:(e,i)=>e._descriptors.allKeys?Reflect.has(t,i)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(t,i),getPrototypeOf:()=>Reflect.getPrototypeOf(t),has:(e,i)=>Reflect.has(t,i),ownKeys:()=>Reflect.ownKeys(t),set:(e,i,n)=>(t[i]=n,delete e[i],!0)})}function lk(t,e={scriptable:!0,indexable:!0}){const{_scriptable:i=e.scriptable,_indexable:n=e.indexable,_allKeys:o=e.allKeys}=t;return{allKeys:o,scriptable:i,indexable:n,isScriptable:D_(i)?i:()=>i,isIndexable:D_(n)?n:()=>n}}const ck=(t,e)=>t?t+T_(e):e,hk=(t,e)=>p_(e)&&"adapters"!==t&&(null===Object.getPrototypeOf(e)||e.constructor===Object);function dk(t,e,i){if(Object.prototype.hasOwnProperty.call(t,e)||"constructor"===e)return t[e];const n=i();return t[e]=n,n}function uk(t,e,i){return D_(t)?t(e,i):t}const pk=(t,e)=>!0===t?e:"string"==typeof t?M_(e,t):void 0;function mk(t,e,i,n,o){for(const s of e){const e=pk(i,s);if(e){t.add(e);const s=uk(e._fallback,i,o);if(void 0!==s&&s!==i&&s!==n)return s}else if(!1===e&&void 0!==n&&i!==n)return null}return!1}function gk(t,e,i,n){const o=e._rootScopes,s=uk(e._fallback,i,n),r=[...t,...o],a=new Set;a.add(n);let l=fk(a,r,i,s||i,n);return null!==l&&((void 0===s||s===i||(l=fk(a,r,s,l,n),null!==l))&&rk(Array.from(a),[""],o,s,(()=>function(t,e,i){const n=t._getTarget();e in n||(n[e]={});const o=n[e];if(u_(o)&&p_(i))return i;return o||{}}(e,i,n))))}function fk(t,e,i,n,o){for(;i;)i=mk(t,e,i,n,o);return i}function vk(t,e){for(const i of e){if(!i)continue;const e=i[t];if(void 0!==e)return e}}function yk(t){let e=t._keys;return e||(e=t._keys=function(t){const e=new Set;for(const i of t)for(const t of Object.keys(i).filter((t=>!t.startsWith("_"))))e.add(t);return Array.from(e)}(t._scopes)),e}function bk(t,e,i,n){const{iScale:o}=t,{key:s="r"}=this._parsing,r=new Array(n);let a,l,c,h;for(a=0,l=n;a<l;++a)c=a+i,h=e[c],r[a]={r:o.parse(M_(h,s),c)};return r}const xk=Number.EPSILON||1e-14,_k=(t,e)=>e<t.length&&!t[e].skip&&t[e],wk=t=>"x"===t?"y":"x";function kk(t,e,i,n){const o=t.skip?e:t,s=e,r=i.skip?e:i,a=K_(s,o),l=K_(r,s);let c=a/(a+l),h=l/(a+l);c=isNaN(c)?0:c,h=isNaN(h)?0:h;const d=n*c,u=n*h;return{previous:{x:s.x-d*(r.x-o.x),y:s.y-d*(r.y-o.y)},next:{x:s.x+u*(r.x-o.x),y:s.y+u*(r.y-o.y)}}}function Ck(t,e="x"){const i=wk(e),n=t.length,o=Array(n).fill(0),s=Array(n);let r,a,l,c=_k(t,0);for(r=0;r<n;++r)if(a=l,l=c,c=_k(t,r+1),l){if(c){const t=c[e]-l[e];o[r]=0!==t?(c[i]-l[i])/t:0}s[r]=a?c?q_(o[r-1])!==q_(o[r])?0:(o[r-1]+o[r])/2:o[r-1]:o[r]}!function(t,e,i){const n=t.length;let o,s,r,a,l,c=_k(t,0);for(let h=0;h<n-1;++h)l=c,c=_k(t,h+1),l&&c&&(V_(e[h],0,xk)?i[h]=i[h+1]=0:(o=i[h]/e[h],s=i[h+1]/e[h],a=Math.pow(o,2)+Math.pow(s,2),a<=9||(r=3/Math.sqrt(a),i[h]=o*r*e[h],i[h+1]=s*r*e[h])))}(t,o,s),function(t,e,i="x"){const n=wk(i),o=t.length;let s,r,a,l=_k(t,0);for(let c=0;c<o;++c){if(r=a,a=l,l=_k(t,c+1),!a)continue;const o=a[i],h=a[n];r&&(s=(o-r[i])/3,a[`cp1${i}`]=o-s,a[`cp1${n}`]=h-s*e[c]),l&&(s=(l[i]-o)/3,a[`cp2${i}`]=o+s,a[`cp2${n}`]=h+s*e[c])}}(t,s,e)}function Sk(t,e,i){return Math.max(Math.min(t,i),e)}function Ek(t,e,i,n,o){let s,r,a,l;if(e.spanGaps&&(t=t.filter((t=>!t.skip))),"monotone"===e.cubicInterpolationMode)Ck(t,o);else{let i=n?t[t.length-1]:t[0];for(s=0,r=t.length;s<r;++s)a=t[s],l=kk(i,a,t[Math.min(s+1,r-(n?0:1))%r],e.tension),a.cp1x=l.previous.x,a.cp1y=l.previous.y,a.cp2x=l.next.x,a.cp2y=l.next.y,i=a}e.capBezierPoints&&function(t,e){let i,n,o,s,r,a=Bw(t[0],e);for(i=0,n=t.length;i<n;++i)r=s,s=a,a=i<n-1&&Bw(t[i+1],e),s&&(o=t[i],r&&(o.cp1x=Sk(o.cp1x,e.left,e.right),o.cp1y=Sk(o.cp1y,e.top,e.bottom)),a&&(o.cp2x=Sk(o.cp2x,e.left,e.right),o.cp2y=Sk(o.cp2y,e.top,e.bottom)))}(t,i)}function Ak(){return"undefined"!=typeof window&&"undefined"!=typeof document}function Mk(t){let e=t.parentNode;return e&&"[object ShadowRoot]"===e.toString()&&(e=e.host),e}function Tk(t,e,i){let n;return"string"==typeof t?(n=parseInt(t,10),-1!==t.indexOf("%")&&(n=n/100*e.parentNode[i])):n=t,n}const Pk=t=>t.ownerDocument.defaultView.getComputedStyle(t,null);const Dk=["top","right","bottom","left"];function Ik(t,e,i){const n={};i=i?"-"+i:"";for(let o=0;o<4;o++){const s=Dk[o];n[s]=parseFloat(t[e+"-"+s+i])||0}return n.width=n.left+n.right,n.height=n.top+n.bottom,n}const Ok=(t,e,i)=>(t>0||e>0)&&(!i||!i.shadowRoot);function $k(t,e){if("native"in t)return t;const{canvas:i,currentDevicePixelRatio:n}=e,o=Pk(i),s="border-box"===o.boxSizing,r=Ik(o,"padding"),a=Ik(o,"border","width"),{x:l,y:c,box:h}=function(t,e){const i=t.touches,n=i&&i.length?i[0]:t,{offsetX:o,offsetY:s}=n;let r,a,l=!1;if(Ok(o,s,t.target))r=o,a=s;else{const t=e.getBoundingClientRect();r=n.clientX-t.left,a=n.clientY-t.top,l=!0}return{x:r,y:a,box:l}}(t,i),d=r.left+(h&&a.left),u=r.top+(h&&a.top);let{width:p,height:m}=e;return s&&(p-=r.width+a.width,m-=r.height+a.height),{x:Math.round((l-d)/p*i.width/n),y:Math.round((c-u)/m*i.height/n)}}const Lk=t=>Math.round(10*t)/10;function zk(t,e,i,n){const o=Pk(t),s=Ik(o,"margin"),r=Tk(o.maxWidth,t,"clientWidth")||z_,a=Tk(o.maxHeight,t,"clientHeight")||z_,l=function(t,e,i){let n,o;if(void 0===e||void 0===i){const s=t&&Mk(t);if(s){const t=s.getBoundingClientRect(),r=Pk(s),a=Ik(r,"border","width"),l=Ik(r,"padding");e=t.width-l.width-a.width,i=t.height-l.height-a.height,n=Tk(r.maxWidth,s,"clientWidth"),o=Tk(r.maxHeight,s,"clientHeight")}else e=t.clientWidth,i=t.clientHeight}return{width:e,height:i,maxWidth:n||z_,maxHeight:o||z_}}(t,e,i);let{width:c,height:h}=l;if("content-box"===o.boxSizing){const t=Ik(o,"border","width"),e=Ik(o,"padding");c-=e.width+t.width,h-=e.height+t.height}c=Math.max(0,c-s.width),h=Math.max(0,n?c/n:h-s.height),c=Lk(Math.min(c,r,l.maxWidth)),h=Lk(Math.min(h,a,l.maxHeight)),c&&!h&&(h=Lk(c/2));return(void 0!==e||void 0!==i)&&n&&l.height&&h>l.height&&(h=l.height,c=Lk(Math.floor(h*n))),{width:c,height:h}}function Rk(t,e,i){const n=e||1,o=Math.floor(t.height*n),s=Math.floor(t.width*n);t.height=Math.floor(t.height),t.width=Math.floor(t.width);const r=t.canvas;return r.style&&(i||!r.style.height&&!r.style.width)&&(r.style.height=`${t.height}px`,r.style.width=`${t.width}px`),(t.currentDevicePixelRatio!==n||r.height!==o||r.width!==s)&&(t.currentDevicePixelRatio=n,r.height=o,r.width=s,t.ctx.setTransform(n,0,0,n,0,0),!0)}const Nk=function(){let t=!1;try{const e={get passive(){return t=!0,!1}};Ak()&&(window.addEventListener("test",null,e),window.removeEventListener("test",null,e))}catch(t){}return t}();function jk(t,e){const i=function(t,e){return Pk(t).getPropertyValue(e)}(t,e),n=i&&i.match(/^(\d+)(\.\d+)?px$/);return n?+n[1]:void 0}function Bk(t,e,i,n){return{x:t.x+i*(e.x-t.x),y:t.y+i*(e.y-t.y)}}function Fk(t,e,i,n){return{x:t.x+i*(e.x-t.x),y:"middle"===n?i<.5?t.y:e.y:"after"===n?i<1?t.y:e.y:i>0?e.y:t.y}}function qk(t,e,i,n){const o={x:t.cp2x,y:t.cp2y},s={x:e.cp1x,y:e.cp1y},r=Bk(t,o,i),a=Bk(o,s,i),l=Bk(s,e,i),c=Bk(r,a,i),h=Bk(a,l,i);return Bk(c,h,i)}function Vk(t,e,i){return t?function(t,e){return{x:i=>t+t+e-i,setWidth(t){e=t},textAlign:t=>"center"===t?t:"right"===t?"left":"right",xPlus:(t,e)=>t-e,leftForLtr:(t,e)=>t-e}}(e,i):{x:t=>t,setWidth(t){},textAlign:t=>t,xPlus:(t,e)=>t+e,leftForLtr:(t,e)=>t}}function Hk(t,e){let i,n;"ltr"!==e&&"rtl"!==e||(i=t.canvas.style,n=[i.getPropertyValue("direction"),i.getPropertyPriority("direction")],i.setProperty("direction",e,"important"),t.prevTextDirection=n)}function Uk(t,e){void 0!==e&&(delete t.prevTextDirection,t.canvas.style.setProperty("direction",e[0],e[1]))}function Wk(t){return"angle"===t?{between:tw,compare:Q_,normalize:J_}:{between:iw,compare:(t,e)=>t-e,normalize:t=>t}}function Gk({start:t,end:e,count:i,loop:n,style:o}){return{start:t%i,end:e%i,loop:n&&(e-t+1)%i==0,style:o}}function Zk(t,e,i){if(!i)return[t];const{property:n,start:o,end:s}=i,r=e.length,{compare:a,between:l,normalize:c}=Wk(n),{start:h,end:d,loop:u,style:p}=function(t,e,i){const{property:n,start:o,end:s}=i,{between:r,normalize:a}=Wk(n),l=e.length;let c,h,{start:d,end:u,loop:p}=t;if(p){for(d+=l,u+=l,c=0,h=l;c<h&&r(a(e[d%l][n]),o,s);++c)d--,u--;d%=l,u%=l}return u<d&&(u+=l),{start:d,end:u,loop:p,style:t.style}}(t,e,i),m=[];let g,f,v,y=!1,b=null;const x=()=>y||l(o,v,g)&&0!==a(o,v),_=()=>!y||0===a(s,g)||l(s,v,g);for(let t=h,i=h;t<=d;++t)f=e[t%r],f.skip||(g=c(f[n]),g!==v&&(y=l(g,o,s),null===b&&x()&&(b=0===a(g,o)?t:i),null!==b&&_()&&(m.push(Gk({start:b,end:t,loop:u,count:r,style:p})),b=null),i=t,v=g));return null!==b&&m.push(Gk({start:b,end:d,loop:u,count:r,style:p})),m}function Yk(t,e){const i=[],n=t.segments;for(let o=0;o<n.length;o++){const s=Zk(n[o],t.points,e);s.length&&i.push(...s)}return i}function Xk(t,e,i,n){return n&&n.setContext&&i?function(t,e,i,n){const o=t._chart.getContext(),s=Kk(t.options),{_datasetIndex:r,options:{spanGaps:a}}=t,l=i.length,c=[];let h=s,d=e[0].start,u=d;function p(t,e,n,o){const s=a?-1:1;if(t!==e){for(t+=l;i[t%l].skip;)t-=s;for(;i[e%l].skip;)e+=s;t%l!=e%l&&(c.push({start:t%l,end:e%l,loop:n,style:o}),h=o,d=e%l)}}for(const t of e){d=a?d:t.start;let e,s=i[d%l];for(u=d+1;u<=t.end;u++){const a=i[u%l];e=Kk(n.setContext(sk(o,{type:"segment",p0:s,p1:a,p0DataIndex:(u-1)%l,p1DataIndex:u%l,datasetIndex:r}))),Qk(e,h)&&p(d,u-1,t.loop,h),s=a,h=e}d<u-1&&p(d,u-1,t.loop,h)}return c}(t,e,i,n):e}function Kk(t){return{backgroundColor:t.backgroundColor,borderCapStyle:t.borderCapStyle,borderDash:t.borderDash,borderDashOffset:t.borderDashOffset,borderJoinStyle:t.borderJoinStyle,borderWidth:t.borderWidth,borderColor:t.borderColor}}function Qk(t,e){if(!e)return!1;const i=[],n=function(t,e){return bw(e)?(i.includes(e)||i.push(e),i.indexOf(e)):e};return JSON.stringify(t,n)!==JSON.stringify(e,n)}
|
|
9509
9467
|
/*!
|
|
9510
9468
|
* Chart.js v4.4.8
|
|
9511
9469
|
* https://www.chartjs.org
|
|
9512
9470
|
* (c) 2025 Chart.js Contributors
|
|
9513
9471
|
* Released under the MIT License
|
|
9514
|
-
*/class Yk{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,i,n){const o=e.listeners[n],s=e.duration;o.forEach((n=>n({chart:t,initial:e.initial,numSteps:s,currentStep:Math.min(i-e.start,s)})))}_refresh(){this._request||(this._running=!0,this._request=sw.call(window,(()=>{this._update(),this._request=null,this._running&&this._refresh()})))}_update(t=Date.now()){let e=0;this._charts.forEach(((i,n)=>{if(!i.running||!i.items.length)return;const o=i.items;let s,r=o.length-1,a=!1;for(;r>=0;--r)s=o[r],s._active?(s._total>i.duration&&(i.duration=s._total),s.tick(t),a=!0):(o[r]=o[o.length-1],o.pop());a&&(n.draw(),this._notify(n,i,t,"progress")),o.length||(i.running=!1,this._notify(n,i,t,"complete"),i.initial=!1),e+=o.length})),this._lastDate=t,0===e&&(this._running=!1)}_getAnims(t){const e=this._charts;let i=e.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,i)),i}listen(t,e,i){this._getAnims(t).listeners[e].push(i)}add(t,e){e&&e.length&&this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce(((t,e)=>Math.max(t,e._duration)),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!!(e&&e.running&&e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const i=e.items;let n=i.length-1;for(;n>=0;--n)i[n].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var Xk=new Yk;const Kk="transparent",Qk={boolean:(t,e,i)=>i>.5?e:t,color(t,e,i){const n=fw(t||Kk),o=n.valid&&fw(e||Kk);return o&&o.valid?o.mix(n,i).hexString():e},number:(t,e,i)=>t+(e-t)*i};class Jk{constructor(t,e,i,n){const o=e[i];n=tk([t.to,n,o,t.from]);const s=tk([t.from,o,n]);this._active=!0,this._fn=t.fn||Qk[t.type||typeof s],this._easing=mw[t.easing]||mw.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=i,this._from=s,this._to=n,this._promises=void 0}active(){return this._active}update(t,e,i){if(this._active){this._notify(!1);const n=this._target[this._prop],o=i-this._start,s=this._duration-o;this._start=i,this._duration=Math.floor(Math.max(s,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=tk([t.to,e,n,t.from]),this._from=tk([t.from,n,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,i=this._duration,n=this._prop,o=this._from,s=this._loop,r=this._to;let a;if(this._active=o!==r&&(s||e<i),!this._active)return this._target[n]=r,void this._notify(!0);e<0?this._target[n]=o:(a=e/i%2,a=s&&a>1?2-a:a,a=this._easing(Math.min(1,Math.max(0,a))),this._target[n]=this._fn(o,r,a))}wait(){const t=this._promises||(this._promises=[]);return new Promise(((e,i)=>{t.push({res:e,rej:i})}))}_notify(t){const e=t?"res":"rej",i=this._promises||[];for(let t=0;t<i.length;t++)i[t][e]()}}class tC{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!c_(t))return;const e=Object.keys(Tw.animation),i=this._properties;Object.getOwnPropertyNames(t).forEach((n=>{const o=t[n];if(!c_(o))return;const s={};for(const t of e)s[t]=o[t];(l_(o.properties)&&o.properties||[n]).forEach((t=>{t!==n&&i.has(t)||i.set(t,s)}))}))}_animateOptions(t,e){const i=e.options,n=function(t,e){if(!e)return;let i=t.options;if(!i)return void(t.options=e);i.$shared&&(t.options=i=Object.assign({},i,{$shared:!1,$animations:{}}));return i}(t,i);if(!n)return[];const o=this._createAnimations(n,i);return i.$shared&&function(t,e){const i=[],n=Object.keys(e);for(let e=0;e<n.length;e++){const o=t[n[e]];o&&o.active()&&i.push(o.wait())}return Promise.all(i)}(t.options.$animations,i).then((()=>{t.options=i}),(()=>{})),o}_createAnimations(t,e){const i=this._properties,n=[],o=t.$animations||(t.$animations={}),s=Object.keys(e),r=Date.now();let a;for(a=s.length-1;a>=0;--a){const l=s[a];if("$"===l.charAt(0))continue;if("options"===l){n.push(...this._animateOptions(t,e));continue}const c=e[l];let h=o[l];const d=i.get(l);if(h){if(d&&h.active()){h.update(d,c,r);continue}h.cancel()}d&&d.duration?(o[l]=h=new Jk(d,t,l,c),n.push(h)):t[l]=c}return n}update(t,e){if(0===this._properties.size)return void Object.assign(t,e);const i=this._createAnimations(t,e);return i.length?(Xk.add(this._chart,i),!0):void 0}}function eC(t,e){const i=t&&t.options||{},n=i.reverse,o=void 0===i.min?e:0,s=void 0===i.max?e:0;return{start:n?s:o,end:n?o:s}}function iC(t,e){const i=[],n=t._getSortedDatasetMetas(e);let o,s;for(o=0,s=n.length;o<s;++o)i.push(n[o].index);return i}function nC(t,e,i,n={}){const o=t.keys,s="single"===n.mode;let r,a,l,c;if(null===e)return;let h=!1;for(r=0,a=o.length;r<a;++r){if(l=+o[r],l===i){if(h=!0,n.all)continue;break}c=t.values[l],h_(c)&&(s||0===e||N_(e)===N_(c))&&(e+=c)}return h||n.all?e:0}function oC(t,e){const i=t&&t.options.stacked;return i||void 0===i&&void 0!==e.stack}function sC(t,e,i){const n=t[e]||(t[e]={});return n[i]||(n[i]={})}function rC(t,e,i,n){for(const o of e.getMatchingVisibleMetas(n).reverse()){const e=t[o.index];if(i&&e>0||!i&&e<0)return o.index}return null}function aC(t,e){const{chart:i,_cachedMeta:n}=t,o=i._stacks||(i._stacks={}),{iScale:s,vScale:r,index:a}=n,l=s.axis,c=r.axis,h=function(t,e,i){return`${t.id}.${e.id}.${i.stack||i.type}`}(s,r,n),d=e.length;let u;for(let t=0;t<d;++t){const i=e[t],{[l]:s,[c]:d}=i;u=(i._stacks||(i._stacks={}))[c]=sC(o,h,s),u[a]=d,u._top=rC(u,r,!0,n.type),u._bottom=rC(u,r,!1,n.type);(u._visualValues||(u._visualValues={}))[a]=d}}function lC(t,e){const i=t.scales;return Object.keys(i).filter((t=>i[t].axis===e)).shift()}function cC(t,e){const i=t.controller.index,n=t.vScale&&t.vScale.axis;if(n){e=e||t._parsed;for(const t of e){const e=t._stacks;if(!e||void 0===e[n]||void 0===e[n][i])return;delete e[n][i],void 0!==e[n]._visualValues&&void 0!==e[n]._visualValues[i]&&delete e[n]._visualValues[i]}}}const hC=t=>"reset"===t||"none"===t,dC=(t,e)=>e?t:Object.assign({},t);class uC{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=oC(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&cC(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,i=this.getDataset(),n=(t,e,i,n)=>"x"===t?e:"r"===t?n:i,o=e.xAxisID=u_(i.xAxisID,lC(t,"x")),s=e.yAxisID=u_(i.yAxisID,lC(t,"y")),r=e.rAxisID=u_(i.rAxisID,lC(t,"r")),a=e.indexAxis,l=e.iAxisID=n(a,o,s,r),c=e.vAxisID=n(a,s,o,r);e.xScale=this.getScaleForId(o),e.yScale=this.getScaleForId(s),e.rScale=this.getScaleForId(r),e.iScale=this.getScaleForId(l),e.vScale=this.getScaleForId(c)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&nw(this._data,this),t._stacked&&cC(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if(c_(e)){const t=this._cachedMeta;this._data=function(t,e){const{iScale:i,vScale:n}=e,o="x"===i.axis?"x":"y",s="x"===n.axis?"x":"y",r=Object.keys(t),a=new Array(r.length);let l,c,h;for(l=0,c=r.length;l<c;++l)h=r[l],a[l]={[o]:h,[s]:t[h]};return a}(e,t)}else if(i!==e){if(i){nw(i,this);const t=this._cachedMeta;cC(t),t._parsed=[]}e&&Object.isExtensible(e)&&(o=this,(n=e)._chartjs?n._chartjs.listeners.push(o):(Object.defineProperty(n,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[o]}}),iw.forEach((t=>{const e="_onData"+S_(t),i=n[t];Object.defineProperty(n,t,{configurable:!0,enumerable:!1,value(...t){const o=i.apply(this,t);return n._chartjs.listeners.forEach((i=>{"function"==typeof i[e]&&i[e](...t)})),o}})})))),this._syncList=[],this._data=e}var n,o}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const e=this._cachedMeta,i=this.getDataset();let n=!1;this._dataCheck();const o=e._stacked;e._stacked=oC(e.vScale,e),e.stack!==i.stack&&(n=!0,cC(e),e.stack=i.stack),this._resyncElements(t),(n||o!==e._stacked)&&(aC(this,e._parsed),e._stacked=oC(e.vScale,e))}configure(){const t=this.chart.config,e=t.datasetScopeKeys(this._type),i=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){const{_cachedMeta:i,_data:n}=this,{iScale:o,_stacked:s}=i,r=o.axis;let a,l,c,h=0===t&&e===n.length||i._sorted,d=t>0&&i._parsed[t-1];if(!1===this._parsing)i._parsed=n,i._sorted=!0,c=n;else{c=l_(n[t])?this.parseArrayData(i,n,t,e):c_(n[t])?this.parseObjectData(i,n,t,e):this.parsePrimitiveData(i,n,t,e);const o=()=>null===l[r]||d&&l[r]<d[r];for(a=0;a<e;++a)i._parsed[a+t]=l=c[a],h&&(o()&&(h=!1),d=l);i._sorted=h}s&&aC(this,c)}parsePrimitiveData(t,e,i,n){const{iScale:o,vScale:s}=t,r=o.axis,a=s.axis,l=o.getLabels(),c=o===s,h=new Array(n);let d,u,p;for(d=0,u=n;d<u;++d)p=d+i,h[d]={[r]:c||o.parse(l[p],p),[a]:s.parse(e[p],p)};return h}parseArrayData(t,e,i,n){const{xScale:o,yScale:s}=t,r=new Array(n);let a,l,c,h;for(a=0,l=n;a<l;++a)c=a+i,h=e[c],r[a]={x:o.parse(h[0],c),y:s.parse(h[1],c)};return r}parseObjectData(t,e,i,n){const{xScale:o,yScale:s}=t,{xAxisKey:r="x",yAxisKey:a="y"}=this._parsing,l=new Array(n);let c,h,d,u;for(c=0,h=n;c<h;++c)d=c+i,u=e[d],l[c]={x:o.parse(C_(u,r),d),y:s.parse(C_(u,a),d)};return l}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,e,i){const n=this.chart,o=this._cachedMeta,s=e[t.axis];return nC({keys:iC(n,!0),values:e._stacks[t.axis]._visualValues},s,o.index,{mode:i})}updateRangeFromParsed(t,e,i,n){const o=i[e.axis];let s=null===o?NaN:o;const r=n&&i._stacks[e.axis];n&&r&&(n.values=r,s=nC(n,o,this._cachedMeta.index)),t.min=Math.min(t.min,s),t.max=Math.max(t.max,s)}getMinMax(t,e){const i=this._cachedMeta,n=i._parsed,o=i._sorted&&t===i.iScale,s=n.length,r=this._getOtherScale(t),a=((t,e,i)=>t&&!e.hidden&&e._stacked&&{keys:iC(i,!0),values:null})(e,i,this.chart),l={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:c,max:h}=function(t){const{min:e,max:i,minDefined:n,maxDefined:o}=t.getUserBounds();return{min:n?e:Number.NEGATIVE_INFINITY,max:o?i:Number.POSITIVE_INFINITY}}(r);let d,u;function p(){u=n[d];const e=u[r.axis];return!h_(u[t.axis])||c>e||h<e}for(d=0;d<s&&(p()||(this.updateRangeFromParsed(l,t,u,a),!o));++d);if(o)for(d=s-1;d>=0;--d)if(!p()){this.updateRangeFromParsed(l,t,u,a);break}return l}getAllParsedValues(t){const e=this._cachedMeta._parsed,i=[];let n,o,s;for(n=0,o=e.length;n<o;++n)s=e[n][t.axis],h_(s)&&i.push(s);return i}getMaxOverflow(){return!1}getLabelAndValue(t){const e=this._cachedMeta,i=e.iScale,n=e.vScale,o=this.getParsed(t);return{label:i?""+i.getLabelForValue(o[i.axis]):"",value:n?""+n.getLabelForValue(o[n.axis]):""}}_update(t){const e=this._cachedMeta;this.update(t||"default"),e._clip=function(t){let e,i,n,o;return c_(t)?(e=t.top,i=t.right,n=t.bottom,o=t.left):e=i=n=o=t,{top:e,right:i,bottom:n,left:o,disabled:!1===t}}(u_(this.options.clip,function(t,e,i){if(!1===i)return!1;const n=eC(t,i),o=eC(e,i);return{top:o.end,right:n.end,bottom:o.start,left:n.start}}(e.xScale,e.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,e=this.chart,i=this._cachedMeta,n=i.data||[],o=e.chartArea,s=[],r=this._drawStart||0,a=this._drawCount||n.length-r,l=this.options.drawActiveElementsOnTop;let c;for(i.dataset&&i.dataset.draw(t,o,r,a),c=r;c<r+a;++c){const e=n[c];e.hidden||(e.active&&l?s.push(e):e.draw(t,o))}for(c=0;c<s.length;++c)s[c].draw(t,o)}getStyle(t,e){const i=e?"active":"default";return void 0===t&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(i):this.resolveDataElementOptions(t||0,i)}getContext(t,e,i){const n=this.getDataset();let o;if(t>=0&&t<this._cachedMeta.data.length){const e=this._cachedMeta.data[t];o=e.$context||(e.$context=function(t,e,i){return ek(t,{active:!1,dataIndex:e,parsed:void 0,raw:void 0,element:i,index:e,mode:"default",type:"data"})}(this.getContext(),t,e)),o.parsed=this.getParsed(t),o.raw=n.data[t],o.index=o.dataIndex=t}else o=this.$context||(this.$context=function(t,e){return ek(t,{active:!1,dataset:void 0,datasetIndex:e,index:e,mode:"default",type:"dataset"})}(this.chart.getContext(),this.index)),o.dataset=n,o.index=o.datasetIndex=this.index;return o.active=!!e,o.mode=i,o}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,e){return this._resolveElementOptions(this.dataElementType.id,e,t)}_resolveElementOptions(t,e="default",i){const n="active"===e,o=this._cachedDataOpts,s=t+"-"+e,r=o[s],a=this.enableOptionSharing&&E_(i);if(r)return dC(r,a);const l=this.chart.config,c=l.datasetElementScopeKeys(this._type,t),h=n?[`${t}Hover`,"hover",t,""]:[t,""],d=l.getOptionScopes(this.getDataset(),c),u=Object.keys(Tw.elements[t]),p=l.resolveNamedOptions(d,u,(()=>this.getContext(i,n,e)),h);return p.$shared&&(p.$shared=a,o[s]=Object.freeze(dC(p,a))),p}_resolveAnimations(t,e,i){const n=this.chart,o=this._cachedDataOpts,s=`animation-${e}`,r=o[s];if(r)return r;let a;if(!1!==n.options.animation){const n=this.chart.config,o=n.datasetAnimationScopeKeys(this._type,e),s=n.getOptionScopes(this.getDataset(),o);a=n.createResolver(s,this.getContext(t,i,e))}const l=new tC(n,a&&a.animations);return a&&a._cacheable&&(o[s]=Object.freeze(l)),l}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||hC(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const i=this.resolveDataElementOptions(t,e),n=this._sharedOptions,o=this.getSharedOptions(i),s=this.includeOptions(e,o)||o!==n;return this.updateSharedOptions(o,e,i),{sharedOptions:o,includeOptions:s}}updateElement(t,e,i,n){hC(n)?Object.assign(t,i):this._resolveAnimations(e,n).update(t,i)}updateSharedOptions(t,e,i){t&&!hC(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,n){t.active=n;const o=this.getStyle(e,n);this._resolveAnimations(e,i,n).update(t,{options:!n&&this.getSharedOptions(o)||o})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const e=this._data,i=this._cachedMeta.data;for(const[t,e,i]of this._syncList)this[t](e,i);this._syncList=[];const n=i.length,o=e.length,s=Math.min(o,n);s&&this.parse(0,s),o>n?this._insertElements(n,o-n,t):o<n&&this._removeElements(o,n-o)}_insertElements(t,e,i=!0){const n=this._cachedMeta,o=n.data,s=t+e;let r;const a=t=>{for(t.length+=e,r=t.length-1;r>=s;r--)t[r]=t[r-e]};for(a(o),r=t;r<s;++r)o[r]=new this.dataElementType;this._parsing&&a(n._parsed),this.parse(t,e),i&&this.updateElements(o,t,e,"reset")}updateElements(t,e,i,n){}_removeElements(t,e){const i=this._cachedMeta;if(this._parsing){const n=i._parsed.splice(t,e);i._stacked&&cC(i,n)}i.data.splice(t,e)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[e,i,n]=t;this[e](i,n)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){const t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,e){e&&this._sync(["_removeElements",t,e]);const i=arguments.length-2;i&&this._sync(["_insertElements",t,i])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}function pC(t){const e=t.iScale,i=function(t,e){if(!t._cache.$bar){const i=t.getMatchingVisibleMetas(e);let n=[];for(let e=0,o=i.length;e<o;e++)n=n.concat(i[e].controller.getAllParsedValues(t));t._cache.$bar=ow(n.sort(((t,e)=>t-e)))}return t._cache.$bar}(e,t.type);let n,o,s,r,a=e._length;const l=()=>{32767!==s&&-32768!==s&&(E_(r)&&(a=Math.min(a,Math.abs(s-r)||a)),r=s)};for(n=0,o=i.length;n<o;++n)s=e.getPixelForValue(i[n]),l();for(r=void 0,n=0,o=e.ticks.length;n<o;++n)s=e.getPixelForTick(n),l();return a}function mC(t,e,i,n){return l_(t)?function(t,e,i,n){const o=i.parse(t[0],n),s=i.parse(t[1],n),r=Math.min(o,s),a=Math.max(o,s);let l=r,c=a;Math.abs(r)>Math.abs(a)&&(l=a,c=r),e[i.axis]=c,e._custom={barStart:l,barEnd:c,start:o,end:s,min:r,max:a}}(t,e,i,n):e[i.axis]=i.parse(t,n),e}function gC(t,e,i,n){const o=t.iScale,s=t.vScale,r=o.getLabels(),a=o===s,l=[];let c,h,d,u;for(c=i,h=i+n;c<h;++c)u=e[c],d={},d[o.axis]=a||o.parse(r[c],c),l.push(mC(u,d,s,c));return l}function fC(t){return t&&void 0!==t.barStart&&void 0!==t.barEnd}function vC(t,e,i,n){let o=e.borderSkipped;const s={};if(!o)return void(t.borderSkipped=s);if(!0===o)return void(t.borderSkipped={top:!0,right:!0,bottom:!0,left:!0});const{start:r,end:a,reverse:l,top:c,bottom:h}=function(t){let e,i,n,o,s;return t.horizontal?(e=t.base>t.x,i="left",n="right"):(e=t.base<t.y,i="bottom",n="top"),e?(o="end",s="start"):(o="start",s="end"),{start:i,end:n,reverse:e,top:o,bottom:s}}(t);"middle"===o&&i&&(t.enableBorderRadius=!0,(i._top||0)===n?o=c:(i._bottom||0)===n?o=h:(s[yC(h,r,a,l)]=!0,o=c)),s[yC(o,r,a,l)]=!0,t.borderSkipped=s}function yC(t,e,i,n){var o,s,r;return n?(r=i,t=bC(t=(o=t)===(s=e)?r:o===r?s:o,i,e)):t=bC(t,e,i),t}function bC(t,e,i){return"start"===t?e:"end"===t?i:t}function xC(t,{inflateAmount:e},i){t.inflateAmount="auto"===e?1===i?.33:0:e}class _C extends uC{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,indexAxis:"r"};static descriptors={_scriptable:t=>"spacing"!==t,_indexable:t=>"spacing"!==t&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i,color:n}}=t.legend.options;return e.labels.map(((e,o)=>{const s=t.getDatasetMeta(0).controller.getStyle(o);return{text:e,fillStyle:s.backgroundColor,strokeStyle:s.borderColor,fontColor:n,lineWidth:s.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(o),index:o}}))}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}}};constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){const i=this.getDataset().data,n=this._cachedMeta;if(!1===this._parsing)n._parsed=i;else{let o,s,r=t=>+i[t];if(c_(i[t])){const{key:t="value"}=this._parsing;r=e=>+C_(i[e],t)}for(o=t,s=t+e;o<s;++o)n._parsed[o]=r(o)}}_getRotation(){return V_(this.options.rotation-90)}_getCircumference(){return V_(this.options.circumference)}_getRotationExtents(){let t=P_,e=-P_;for(let i=0;i<this.chart.data.datasets.length;++i)if(this.chart.isDatasetVisible(i)&&this.chart.getDatasetMeta(i).type===this._type){const n=this.chart.getDatasetMeta(i).controller,o=n._getRotation(),s=n._getCircumference();t=Math.min(t,o),e=Math.max(e,o+s)}return{rotation:t,circumference:e-t}}update(t){const e=this.chart,{chartArea:i}=e,n=this._cachedMeta,o=n.data,s=this.getMaxBorderWidth()+this.getMaxOffset(o)+this.options.spacing,r=Math.max((Math.min(i.width,i.height)-s)/2,0),a=Math.min((l=this.options.cutout,c=r,"string"==typeof l&&l.endsWith("%")?parseFloat(l)/100:+l/c),1);var l,c;const h=this._getRingWeight(this.index),{circumference:d,rotation:u}=this._getRotationExtents(),{ratioX:p,ratioY:m,offsetX:g,offsetY:f}=function(t,e,i){let n=1,o=1,s=0,r=0;if(e<P_){const a=t,l=a+e,c=Math.cos(a),h=Math.sin(a),d=Math.cos(l),u=Math.sin(l),p=(t,e,n)=>X_(t,a,l,!0)?1:Math.max(e,e*i,n,n*i),m=(t,e,n)=>X_(t,a,l,!0)?-1:Math.min(e,e*i,n,n*i),g=p(0,c,d),f=p($_,h,u),v=m(T_,c,d),y=m(T_+$_,h,u);n=(g-v)/2,o=(f-y)/2,s=-(g+v)/2,r=-(f+y)/2}return{ratioX:n,ratioY:o,offsetX:s,offsetY:r}}(u,d,a),v=(i.width-s)/p,y=(i.height-s)/m,b=Math.max(Math.min(v,y)/2,0),x=p_(this.options.radius,b),_=(x-Math.max(x*a,0))/this._getVisibleDatasetWeightTotal();this.offsetX=g*x,this.offsetY=f*x,n.total=this.calculateTotal(),this.outerRadius=x-_*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-_*h,0),this.updateElements(o,0,o.length,t)}_circumference(t,e){const i=this.options,n=this._cachedMeta,o=this._getCircumference();return e&&i.animation.animateRotate||!this.chart.getDataVisibility(t)||null===n._parsed[t]||n.data[t].hidden?0:this.calculateCircumference(n._parsed[t]*o/P_)}updateElements(t,e,i,n){const o="reset"===n,s=this.chart,r=s.chartArea,a=s.options.animation,l=(r.left+r.right)/2,c=(r.top+r.bottom)/2,h=o&&a.animateScale,d=h?0:this.innerRadius,u=h?0:this.outerRadius,{sharedOptions:p,includeOptions:m}=this._getSharedOptions(e,n);let g,f=this._getRotation();for(g=0;g<e;++g)f+=this._circumference(g,o);for(g=e;g<e+i;++g){const e=this._circumference(g,o),i=t[g],s={x:l+this.offsetX,y:c+this.offsetY,startAngle:f,endAngle:f+e,circumference:e,outerRadius:u,innerRadius:d};m&&(s.options=p||this.resolveDataElementOptions(g,i.active?"active":n)),f+=e,this.updateElement(i,g,s,n)}}calculateTotal(){const t=this._cachedMeta,e=t.data;let i,n=0;for(i=0;i<e.length;i++){const o=t._parsed[i];null===o||isNaN(o)||!this.chart.getDataVisibility(i)||e[i].hidden||(n+=Math.abs(o))}return n}calculateCircumference(t){const e=this._cachedMeta.total;return e>0&&!isNaN(t)?P_*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,n=i.data.labels||[],o=_w(e._parsed[t],i.options.locale);return{label:n[t]||"",value:o}}getMaxBorderWidth(t){let e=0;const i=this.chart;let n,o,s,r,a;if(!t)for(n=0,o=i.data.datasets.length;n<o;++n)if(i.isDatasetVisible(n)){s=i.getDatasetMeta(n),t=s.data,r=s.controller;break}if(!t)return 0;for(n=0,o=t.length;n<o;++n)a=r.resolveDataElementOptions(n),"inner"!==a.borderAlign&&(e=Math.max(e,a.borderWidth||0,a.hoverBorderWidth||0));return e}getMaxOffset(t){let e=0;for(let i=0,n=t.length;i<n;++i){const t=this.resolveDataElementOptions(i);e=Math.max(e,t.offset||0,t.hoverOffset||0)}return e}_getRingWeightOffset(t){let e=0;for(let i=0;i<t;++i)this.chart.isDatasetVisible(i)&&(e+=this._getRingWeight(i));return e}_getRingWeight(t){return Math.max(u_(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}class wC extends uC{static id="polarArea";static defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i,color:n}}=t.legend.options;return e.labels.map(((e,o)=>{const s=t.getDatasetMeta(0).controller.getStyle(o);return{text:e,fillStyle:s.backgroundColor,strokeStyle:s.borderColor,fontColor:n,lineWidth:s.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(o),index:o}}))}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,n=i.data.labels||[],o=_w(e._parsed[t].r,i.options.locale);return{label:n[t]||"",value:o}}parseObjectData(t,e,i,n){return gk.bind(this)(t,e,i,n)}update(t){const e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){const t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach(((t,i)=>{const n=this.getParsed(i).r;!isNaN(n)&&this.chart.getDataVisibility(i)&&(n<e.min&&(e.min=n),n>e.max&&(e.max=n))})),e}_updateRadius(){const t=this.chart,e=t.chartArea,i=t.options,n=Math.min(e.right-e.left,e.bottom-e.top),o=Math.max(n/2,0),s=(o-Math.max(i.cutoutPercentage?o/100*i.cutoutPercentage:1,0))/t.getVisibleDatasetCount();this.outerRadius=o-s*this.index,this.innerRadius=this.outerRadius-s}updateElements(t,e,i,n){const o="reset"===n,s=this.chart,r=s.options.animation,a=this._cachedMeta.rScale,l=a.xCenter,c=a.yCenter,h=a.getIndexAngle(0)-.5*T_;let d,u=h;const p=360/this.countVisibleElements();for(d=0;d<e;++d)u+=this._computeAngle(d,n,p);for(d=e;d<e+i;d++){const e=t[d];let i=u,m=u+this._computeAngle(d,n,p),g=s.getDataVisibility(d)?a.getDistanceFromCenterForValue(this.getParsed(d).r):0;u=m,o&&(r.animateScale&&(g=0),r.animateRotate&&(i=m=h));const f={x:l,y:c,innerRadius:0,outerRadius:g,startAngle:i,endAngle:m,options:this.resolveDataElementOptions(d,e.active?"active":n)};this.updateElement(e,d,f,n)}}countVisibleElements(){const t=this._cachedMeta;let e=0;return t.data.forEach(((t,i)=>{!isNaN(this.getParsed(i).r)&&this.chart.getDataVisibility(i)&&e++})),e}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?V_(this.resolveDataElementOptions(t,e).angle||i):0}}var kC=Object.freeze({__proto__:null,BarController:class extends uC{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(t,e,i,n){return gC(t,e,i,n)}parseArrayData(t,e,i,n){return gC(t,e,i,n)}parseObjectData(t,e,i,n){const{iScale:o,vScale:s}=t,{xAxisKey:r="x",yAxisKey:a="y"}=this._parsing,l="x"===o.axis?r:a,c="x"===s.axis?r:a,h=[];let d,u,p,m;for(d=i,u=i+n;d<u;++d)m=e[d],p={},p[o.axis]=o.parse(C_(m,l),d),h.push(mC(C_(m,c),p,s,d));return h}updateRangeFromParsed(t,e,i,n){super.updateRangeFromParsed(t,e,i,n);const o=i._custom;o&&e===this._cachedMeta.vScale&&(t.min=Math.min(t.min,o.min),t.max=Math.max(t.max,o.max))}getMaxOverflow(){return 0}getLabelAndValue(t){const e=this._cachedMeta,{iScale:i,vScale:n}=e,o=this.getParsed(t),s=o._custom,r=fC(s)?"["+s.start+", "+s.end+"]":""+n.getLabelForValue(o[n.axis]);return{label:""+i.getLabelForValue(o[i.axis]),value:r}}initialize(){this.enableOptionSharing=!0,super.initialize();this._cachedMeta.stack=this.getDataset().stack}update(t){const e=this._cachedMeta;this.updateElements(e.data,0,e.data.length,t)}updateElements(t,e,i,n){const o="reset"===n,{index:s,_cachedMeta:{vScale:r}}=this,a=r.getBasePixel(),l=r.isHorizontal(),c=this._getRuler(),{sharedOptions:h,includeOptions:d}=this._getSharedOptions(e,n);for(let u=e;u<e+i;u++){const e=this.getParsed(u),i=o||a_(e[r.axis])?{base:a,head:a}:this._calculateBarValuePixels(u),p=this._calculateBarIndexPixels(u,c),m=(e._stacks||{})[r.axis],g={horizontal:l,base:i.base,enableBorderRadius:!m||fC(e._custom)||s===m._top||s===m._bottom,x:l?i.head:p.center,y:l?p.center:i.head,height:l?p.size:Math.abs(i.size),width:l?Math.abs(i.size):p.size};d&&(g.options=h||this.resolveDataElementOptions(u,t[u].active?"active":n));const f=g.options||t[u].options;vC(g,f,m,s),xC(g,f,c.ratio),this.updateElement(t[u],u,g,n)}}_getStacks(t,e){const{iScale:i}=this._cachedMeta,n=i.getMatchingVisibleMetas(this._type).filter((t=>t.controller.options.grouped)),o=i.options.stacked,s=[],r=this._cachedMeta.controller.getParsed(e),a=r&&r[i.axis],l=t=>{const e=t._parsed.find((t=>t[i.axis]===a)),n=e&&e[t.vScale.axis];if(a_(n)||isNaN(n))return!0};for(const i of n)if((void 0===e||!l(i))&&((!1===o||-1===s.indexOf(i.stack)||void 0===o&&void 0===i.stack)&&s.push(i.stack),i.index===t))break;return s.length||s.push(void 0),s}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,i){const n=this._getStacks(t,i),o=void 0!==e?n.indexOf(e):-1;return-1===o?n.length-1:o}_getRuler(){const t=this.options,e=this._cachedMeta,i=e.iScale,n=[];let o,s;for(o=0,s=e.data.length;o<s;++o)n.push(i.getPixelForValue(this.getParsed(o)[i.axis],o));const r=t.barThickness;return{min:r||pC(e),pixels:n,start:i._startPixel,end:i._endPixel,stackCount:this._getStackCount(),scale:i,grouped:t.grouped,ratio:r?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){const{_cachedMeta:{vScale:e,_stacked:i,index:n},options:{base:o,minBarLength:s}}=this,r=o||0,a=this.getParsed(t),l=a._custom,c=fC(l);let h,d,u=a[e.axis],p=0,m=i?this.applyStack(e,a,i):u;m!==u&&(p=m-u,m=u),c&&(u=l.barStart,m=l.barEnd-l.barStart,0!==u&&N_(u)!==N_(l.barEnd)&&(p=0),p+=u);const g=a_(o)||c?p:o;let f=e.getPixelForValue(g);if(h=this.chart.getDataVisibility(t)?e.getPixelForValue(p+m):f,d=h-f,Math.abs(d)<s){d=function(t,e,i){return 0!==t?N_(t):(e.isHorizontal()?1:-1)*(e.min>=i?1:-1)}(d,e,r)*s,u===r&&(f-=d/2);const t=e.getPixelForDecimal(0),o=e.getPixelForDecimal(1),l=Math.min(t,o),p=Math.max(t,o);f=Math.max(Math.min(f,p),l),h=f+d,i&&!c&&(a._stacks[e.axis]._visualValues[n]=e.getValueForPixel(h)-e.getValueForPixel(f))}if(f===e.getPixelForValue(r)){const t=N_(d)*e.getLineWidthForValue(r)/2;f+=t,d-=t}return{size:d,base:f,head:h,center:h+d/2}}_calculateBarIndexPixels(t,e){const i=e.scale,n=this.options,o=n.skipNull,s=u_(n.maxBarThickness,1/0);let r,a;if(e.grouped){const i=o?this._getStackCount(t):e.stackCount,l="flex"===n.barThickness?function(t,e,i,n){const o=e.pixels,s=o[t];let r=t>0?o[t-1]:null,a=t<o.length-1?o[t+1]:null;const l=i.categoryPercentage;null===r&&(r=s-(null===a?e.end-e.start:a-s)),null===a&&(a=s+s-r);const c=s-(s-Math.min(r,a))/2*l;return{chunk:Math.abs(a-r)/2*l/n,ratio:i.barPercentage,start:c}}(t,e,n,i):function(t,e,i,n){const o=i.barThickness;let s,r;return a_(o)?(s=e.min*i.categoryPercentage,r=i.barPercentage):(s=o*n,r=1),{chunk:s/n,ratio:r,start:e.pixels[t]-s/2}}(t,e,n,i),c=this._getStackIndex(this.index,this._cachedMeta.stack,o?t:void 0);r=l.start+l.chunk*c+l.chunk/2,a=Math.min(s,l.chunk*l.ratio)}else r=i.getPixelForValue(this.getParsed(t)[i.axis],t),a=Math.min(s,e.min*e.ratio);return{base:r-a/2,head:r+a/2,center:r,size:a}}draw(){const t=this._cachedMeta,e=t.vScale,i=t.data,n=i.length;let o=0;for(;o<n;++o)null===this.getParsed(o)[e.axis]||i[o].hidden||i[o].draw(this._ctx)}},BubbleController:class extends uC{static id="bubble";static defaults={datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}};static overrides={scales:{x:{type:"linear"},y:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,super.initialize()}parsePrimitiveData(t,e,i,n){const o=super.parsePrimitiveData(t,e,i,n);for(let t=0;t<o.length;t++)o[t]._custom=this.resolveDataElementOptions(t+i).radius;return o}parseArrayData(t,e,i,n){const o=super.parseArrayData(t,e,i,n);for(let t=0;t<o.length;t++){const n=e[i+t];o[t]._custom=u_(n[2],this.resolveDataElementOptions(t+i).radius)}return o}parseObjectData(t,e,i,n){const o=super.parseObjectData(t,e,i,n);for(let t=0;t<o.length;t++){const n=e[i+t];o[t]._custom=u_(n&&n.r&&+n.r,this.resolveDataElementOptions(t+i).radius)}return o}getMaxOverflow(){const t=this._cachedMeta.data;let e=0;for(let i=t.length-1;i>=0;--i)e=Math.max(e,t[i].size(this.resolveDataElementOptions(i))/2);return e>0&&e}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart.data.labels||[],{xScale:n,yScale:o}=e,s=this.getParsed(t),r=n.getLabelForValue(s.x),a=o.getLabelForValue(s.y),l=s._custom;return{label:i[t]||"",value:"("+r+", "+a+(l?", "+l:"")+")"}}update(t){const e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,i,n){const o="reset"===n,{iScale:s,vScale:r}=this._cachedMeta,{sharedOptions:a,includeOptions:l}=this._getSharedOptions(e,n),c=s.axis,h=r.axis;for(let d=e;d<e+i;d++){const e=t[d],i=!o&&this.getParsed(d),u={},p=u[c]=o?s.getPixelForDecimal(.5):s.getPixelForValue(i[c]),m=u[h]=o?r.getBasePixel():r.getPixelForValue(i[h]);u.skip=isNaN(p)||isNaN(m),l&&(u.options=a||this.resolveDataElementOptions(d,e.active?"active":n),o&&(u.options.radius=0)),this.updateElement(e,d,u,n)}}resolveDataElementOptions(t,e){const i=this.getParsed(t);let n=super.resolveDataElementOptions(t,e);n.$shared&&(n=Object.assign({},n,{$shared:!1}));const o=n.radius;return"active"!==e&&(n.radius=0),n.radius+=u_(i&&i._custom,o),n}},DoughnutController:_C,LineController:class extends uC{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(t){const e=this._cachedMeta,{dataset:i,data:n=[],_dataset:o}=e,s=this.chart._animationsDisabled;let{start:r,count:a}=cw(e,n,s);this._drawStart=r,this._drawCount=a,hw(e)&&(r=0,a=n.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!o._decimated,i.points=n;const l=this.resolveDatasetElementOptions(t);this.options.showLine||(l.borderWidth=0),l.segment=this.options.segment,this.updateElement(i,void 0,{animated:!s,options:l},t),this.updateElements(n,r,a,t)}updateElements(t,e,i,n){const o="reset"===n,{iScale:s,vScale:r,_stacked:a,_dataset:l}=this._cachedMeta,{sharedOptions:c,includeOptions:h}=this._getSharedOptions(e,n),d=s.axis,u=r.axis,{spanGaps:p,segment:m}=this.options,g=F_(p)?p:Number.POSITIVE_INFINITY,f=this.chart._animationsDisabled||o||"none"===n,v=e+i,y=t.length;let b=e>0&&this.getParsed(e-1);for(let i=0;i<y;++i){const p=t[i],y=f?p:{};if(i<e||i>=v){y.skip=!0;continue}const x=this.getParsed(i),_=a_(x[u]),w=y[d]=s.getPixelForValue(x[d],i),k=y[u]=o||_?r.getBasePixel():r.getPixelForValue(a?this.applyStack(r,x,a):x[u],i);y.skip=isNaN(w)||isNaN(k)||_,y.stop=i>0&&Math.abs(x[d]-b[d])>g,m&&(y.parsed=x,y.raw=l.data[i]),h&&(y.options=c||this.resolveDataElementOptions(i,p.active?"active":n)),f||this.updateElement(p,i,y,n),b=x}}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,i=e.options&&e.options.borderWidth||0,n=t.data||[];if(!n.length)return i;const o=n[0].size(this.resolveDataElementOptions(0)),s=n[n.length-1].size(this.resolveDataElementOptions(n.length-1));return Math.max(i,o,s)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}},PieController:class extends _C{static id="pie";static defaults={cutout:0,rotation:0,circumference:360,radius:"100%"}},PolarAreaController:wC,RadarController:class extends uC{static id="radar";static defaults={datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}};static overrides={aspectRatio:1,scales:{r:{type:"radialLinear"}}};getLabelAndValue(t){const e=this._cachedMeta.vScale,i=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(i[e.axis])}}parseObjectData(t,e,i,n){return gk.bind(this)(t,e,i,n)}update(t){const e=this._cachedMeta,i=e.dataset,n=e.data||[],o=e.iScale.getLabels();if(i.points=n,"resize"!==t){const e=this.resolveDatasetElementOptions(t);this.options.showLine||(e.borderWidth=0);const s={_loop:!0,_fullLoop:o.length===n.length,options:e};this.updateElement(i,void 0,s,t)}this.updateElements(n,0,n.length,t)}updateElements(t,e,i,n){const o=this._cachedMeta.rScale,s="reset"===n;for(let r=e;r<e+i;r++){const e=t[r],i=this.resolveDataElementOptions(r,e.active?"active":n),a=o.getPointPositionForValue(r,this.getParsed(r).r),l=s?o.xCenter:a.x,c=s?o.yCenter:a.y,h={x:l,y:c,angle:a.angle,skip:isNaN(l)||isNaN(c),options:i};this.updateElement(e,r,h,n)}}},ScatterController:class extends uC{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(t){const e=this._cachedMeta,i=this.chart.data.labels||[],{xScale:n,yScale:o}=e,s=this.getParsed(t),r=n.getLabelForValue(s.x),a=o.getLabelForValue(s.y);return{label:i[t]||"",value:"("+r+", "+a+")"}}update(t){const e=this._cachedMeta,{data:i=[]}=e,n=this.chart._animationsDisabled;let{start:o,count:s}=cw(e,i,n);if(this._drawStart=o,this._drawCount=s,hw(e)&&(o=0,s=i.length),this.options.showLine){this.datasetElementType||this.addElements();const{dataset:o,_dataset:s}=e;o._chart=this.chart,o._datasetIndex=this.index,o._decimated=!!s._decimated,o.points=i;const r=this.resolveDatasetElementOptions(t);r.segment=this.options.segment,this.updateElement(o,void 0,{animated:!n,options:r},t)}else this.datasetElementType&&(delete e.dataset,this.datasetElementType=!1);this.updateElements(i,o,s,t)}addElements(){const{showLine:t}=this.options;!this.datasetElementType&&t&&(this.datasetElementType=this.chart.registry.getElement("line")),super.addElements()}updateElements(t,e,i,n){const o="reset"===n,{iScale:s,vScale:r,_stacked:a,_dataset:l}=this._cachedMeta,c=this.resolveDataElementOptions(e,n),h=this.getSharedOptions(c),d=this.includeOptions(n,h),u=s.axis,p=r.axis,{spanGaps:m,segment:g}=this.options,f=F_(m)?m:Number.POSITIVE_INFINITY,v=this.chart._animationsDisabled||o||"none"===n;let y=e>0&&this.getParsed(e-1);for(let c=e;c<e+i;++c){const e=t[c],i=this.getParsed(c),m=v?e:{},b=a_(i[p]),x=m[u]=s.getPixelForValue(i[u],c),_=m[p]=o||b?r.getBasePixel():r.getPixelForValue(a?this.applyStack(r,i,a):i[p],c);m.skip=isNaN(x)||isNaN(_)||b,m.stop=c>0&&Math.abs(i[u]-y[u])>f,g&&(m.parsed=i,m.raw=l.data[c]),d&&(m.options=h||this.resolveDataElementOptions(c,e.active?"active":n)),v||this.updateElement(e,c,m,n),y=i}this.updateSharedOptions(h,n,c)}getMaxOverflow(){const t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let t=0;for(let i=e.length-1;i>=0;--i)t=Math.max(t,e[i].size(this.resolveDataElementOptions(i))/2);return t>0&&t}const i=t.dataset,n=i.options&&i.options.borderWidth||0;if(!e.length)return n;const o=e[0].size(this.resolveDataElementOptions(0)),s=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(n,o,s)/2}}});function CC(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class SC{static override(t){Object.assign(SC.prototype,t)}options;constructor(t){this.options=t||{}}init(){}formats(){return CC()}parse(){return CC()}format(){return CC()}add(){return CC()}diff(){return CC()}startOf(){return CC()}endOf(){return CC()}}var EC={_date:SC};function AC(t,e,i,n){const{controller:o,data:s,_sorted:r}=t,a=o._cachedMeta.iScale,l=t.dataset&&t.dataset.options?t.dataset.options.spanGaps:null;if(a&&e===a.axis&&"r"!==e&&r&&s.length){const r=a._reversePixels?ew:tw;if(!n){const n=r(s,e,i);if(l){const{vScale:e}=o._cachedMeta,{_parsed:i}=t,s=i.slice(0,n.lo+1).reverse().findIndex((t=>!a_(t[e.axis])));n.lo-=Math.max(0,s);const r=i.slice(n.hi).findIndex((t=>!a_(t[e.axis])));n.hi+=Math.max(0,r)}return n}if(o._sharedOptions){const t=s[0],n="function"==typeof t.getRange&&t.getRange(e);if(n){const t=r(s,e,i-n),o=r(s,e,i+n);return{lo:t.lo,hi:o.hi}}}}return{lo:0,hi:s.length-1}}function MC(t,e,i,n,o){const s=t.getSortedVisibleDatasetMetas(),r=i[e];for(let t=0,i=s.length;t<i;++t){const{index:i,data:a}=s[t],{lo:l,hi:c}=AC(s[t],e,r,o);for(let t=l;t<=c;++t){const e=a[t];e.skip||n(e,i,t)}}}function TC(t,e,i,n,o){const s=[];if(!o&&!t.isPointInArea(e))return s;return MC(t,i,e,(function(i,r,a){(o||zw(i,t.chartArea,0))&&i.inRange(e.x,e.y,n)&&s.push({element:i,datasetIndex:r,index:a})}),!0),s}function PC(t,e,i,n,o,s){let r=[];const a=function(t){const e=-1!==t.indexOf("x"),i=-1!==t.indexOf("y");return function(t,n){const o=e?Math.abs(t.x-n.x):0,s=i?Math.abs(t.y-n.y):0;return Math.sqrt(Math.pow(o,2)+Math.pow(s,2))}}(i);let l=Number.POSITIVE_INFINITY;return MC(t,i,e,(function(i,c,h){const d=i.inRange(e.x,e.y,o);if(n&&!d)return;const u=i.getCenterPoint(o);if(!(!!s||t.isPointInArea(u))&&!d)return;const p=a(e,u);p<l?(r=[{element:i,datasetIndex:c,index:h}],l=p):p===l&&r.push({element:i,datasetIndex:c,index:h})})),r}function DC(t,e,i,n,o,s){return s||t.isPointInArea(e)?"r"!==i||n?PC(t,e,i,n,o,s):function(t,e,i,n){let o=[];return MC(t,i,e,(function(t,i,s){const{startAngle:r,endAngle:a}=t.getProps(["startAngle","endAngle"],n),{angle:l}=W_(t,{x:e.x,y:e.y});X_(l,r,a)&&o.push({element:t,datasetIndex:i,index:s})})),o}(t,e,i,o):[]}function IC(t,e,i,n,o){const s=[],r="x"===i?"inXRange":"inYRange";let a=!1;return MC(t,i,e,((t,n,l)=>{t[r]&&t[r](e[i],o)&&(s.push({element:t,datasetIndex:n,index:l}),a=a||t.inRange(e.x,e.y,o))})),n&&!a?[]:s}var OC={evaluateInteractionItems:MC,modes:{index(t,e,i,n){const o=Pk(e,t),s=i.axis||"x",r=i.includeInvisible||!1,a=i.intersect?TC(t,o,s,n,r):DC(t,o,s,!1,n,r),l=[];return a.length?(t.getSortedVisibleDatasetMetas().forEach((t=>{const e=a[0].index,i=t.data[e];i&&!i.skip&&l.push({element:i,datasetIndex:t.index,index:e})})),l):[]},dataset(t,e,i,n){const o=Pk(e,t),s=i.axis||"xy",r=i.includeInvisible||!1;let a=i.intersect?TC(t,o,s,n,r):DC(t,o,s,!1,n,r);if(a.length>0){const e=a[0].datasetIndex,i=t.getDatasetMeta(e).data;a=[];for(let t=0;t<i.length;++t)a.push({element:i[t],datasetIndex:e,index:t})}return a},point:(t,e,i,n)=>TC(t,Pk(e,t),i.axis||"xy",n,i.includeInvisible||!1),nearest(t,e,i,n){const o=Pk(e,t),s=i.axis||"xy",r=i.includeInvisible||!1;return DC(t,o,s,i.intersect,n,r)},x:(t,e,i,n)=>IC(t,Pk(e,t),"x",i.intersect,n),y:(t,e,i,n)=>IC(t,Pk(e,t),"y",i.intersect,n)}};const $C=["left","top","right","bottom"];function LC(t,e){return t.filter((t=>t.pos===e))}function zC(t,e){return t.filter((t=>-1===$C.indexOf(t.pos)&&t.box.axis===e))}function RC(t,e){return t.sort(((t,i)=>{const n=e?i:t,o=e?t:i;return n.weight===o.weight?n.index-o.index:n.weight-o.weight}))}function NC(t,e){const i=function(t){const e={};for(const i of t){const{stack:t,pos:n,stackWeight:o}=i;if(!t||!$C.includes(n))continue;const s=e[t]||(e[t]={count:0,placed:0,weight:0,size:0});s.count++,s.weight+=o}return e}(t),{vBoxMaxWidth:n,hBoxMaxHeight:o}=e;let s,r,a;for(s=0,r=t.length;s<r;++s){a=t[s];const{fullSize:r}=a.box,l=i[a.stack],c=l&&a.stackWeight/l.weight;a.horizontal?(a.width=c?c*n:r&&e.availableWidth,a.height=o):(a.width=n,a.height=c?c*o:r&&e.availableHeight)}return i}function jC(t,e,i,n){return Math.max(t[i],e[i])+Math.max(t[n],e[n])}function BC(t,e){t.top=Math.max(t.top,e.top),t.left=Math.max(t.left,e.left),t.bottom=Math.max(t.bottom,e.bottom),t.right=Math.max(t.right,e.right)}function FC(t,e,i,n){const{pos:o,box:s}=i,r=t.maxPadding;if(!c_(o)){i.size&&(t[o]-=i.size);const e=n[i.stack]||{size:0,count:1};e.size=Math.max(e.size,i.horizontal?s.height:s.width),i.size=e.size/e.count,t[o]+=i.size}s.getPadding&&BC(r,s.getPadding());const a=Math.max(0,e.outerWidth-jC(r,t,"left","right")),l=Math.max(0,e.outerHeight-jC(r,t,"top","bottom")),c=a!==t.w,h=l!==t.h;return t.w=a,t.h=l,i.horizontal?{same:c,other:h}:{same:h,other:c}}function qC(t,e){const i=e.maxPadding;function n(t){const n={left:0,top:0,right:0,bottom:0};return t.forEach((t=>{n[t]=Math.max(e[t],i[t])})),n}return n(t?["left","right"]:["top","bottom"])}function VC(t,e,i,n){const o=[];let s,r,a,l,c,h;for(s=0,r=t.length,c=0;s<r;++s){a=t[s],l=a.box,l.update(a.width||e.w,a.height||e.h,qC(a.horizontal,e));const{same:r,other:d}=FC(e,i,a,n);c|=r&&o.length,h=h||d,l.fullSize||o.push(a)}return c&&VC(o,e,i,n)||h}function HC(t,e,i,n,o){t.top=i,t.left=e,t.right=e+n,t.bottom=i+o,t.width=n,t.height=o}function UC(t,e,i,n){const o=i.padding;let{x:s,y:r}=e;for(const a of t){const t=a.box,l=n[a.stack]||{count:1,placed:0,weight:1},c=a.stackWeight/l.weight||1;if(a.horizontal){const n=e.w*c,s=l.size||t.height;E_(l.start)&&(r=l.start),t.fullSize?HC(t,o.left,r,i.outerWidth-o.right-o.left,s):HC(t,e.left+l.placed,r,n,s),l.start=r,l.placed+=n,r=t.bottom}else{const n=e.h*c,r=l.size||t.width;E_(l.start)&&(s=l.start),t.fullSize?HC(t,s,o.top,r,i.outerHeight-o.bottom-o.top):HC(t,s,e.top+l.placed,r,n),l.start=s,l.placed+=n,s=t.right}}e.x=s,e.y=r}var WC={addBox(t,e){t.boxes||(t.boxes=[]),e.fullSize=e.fullSize||!1,e.position=e.position||"top",e.weight=e.weight||0,e._layers=e._layers||function(){return[{z:0,draw(t){e.draw(t)}}]},t.boxes.push(e)},removeBox(t,e){const i=t.boxes?t.boxes.indexOf(e):-1;-1!==i&&t.boxes.splice(i,1)},configure(t,e,i){e.fullSize=i.fullSize,e.position=i.position,e.weight=i.weight},update(t,e,i,n){if(!t)return;const o=Qw(t.options.layout.padding),s=Math.max(e-o.width,0),r=Math.max(i-o.height,0),a=function(t){const e=function(t){const e=[];let i,n,o,s,r,a;for(i=0,n=(t||[]).length;i<n;++i)o=t[i],({position:s,options:{stack:r,stackWeight:a=1}}=o),e.push({index:i,box:o,pos:s,horizontal:o.isHorizontal(),weight:o.weight,stack:r&&s+r,stackWeight:a});return e}(t),i=RC(e.filter((t=>t.box.fullSize)),!0),n=RC(LC(e,"left"),!0),o=RC(LC(e,"right")),s=RC(LC(e,"top"),!0),r=RC(LC(e,"bottom")),a=zC(e,"x"),l=zC(e,"y");return{fullSize:i,leftAndTop:n.concat(s),rightAndBottom:o.concat(l).concat(r).concat(a),chartArea:LC(e,"chartArea"),vertical:n.concat(o).concat(l),horizontal:s.concat(r).concat(a)}}(t.boxes),l=a.vertical,c=a.horizontal;g_(t.boxes,(t=>{"function"==typeof t.beforeLayout&&t.beforeLayout()}));const h=l.reduce(((t,e)=>e.box.options&&!1===e.box.options.display?t:t+1),0)||1,d=Object.freeze({outerWidth:e,outerHeight:i,padding:o,availableWidth:s,availableHeight:r,vBoxMaxWidth:s/2/h,hBoxMaxHeight:r/2}),u=Object.assign({},o);BC(u,Qw(n));const p=Object.assign({maxPadding:u,w:s,h:r,x:o.left,y:o.top},o),m=NC(l.concat(c),d);VC(a.fullSize,p,d,m),VC(l,p,d,m),VC(c,p,d,m)&&VC(l,p,d,m),function(t){const e=t.maxPadding;function i(i){const n=Math.max(e[i]-t[i],0);return t[i]+=n,n}t.y+=i("top"),t.x+=i("left"),i("right"),i("bottom")}(p),UC(a.leftAndTop,p,d,m),p.x+=p.w,p.y+=p.h,UC(a.rightAndBottom,p,d,m),t.chartArea={left:p.left,top:p.top,right:p.left+p.w,bottom:p.top+p.h,height:p.h,width:p.w},g_(a.chartArea,(e=>{const i=e.box;Object.assign(i,t.chartArea),i.update(p.w,p.h,{left:0,top:0,right:0,bottom:0})}))}};class GC{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,n){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,n?Math.floor(e/n):i)}}isAttached(t){return!0}updateConfig(t){}}class ZC extends GC{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const YC="$chartjs",XC={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},KC=t=>null===t||""===t;const QC=!!$k&&{passive:!0};function JC(t,e,i){t&&t.canvas&&t.canvas.removeEventListener(e,i,QC)}function tS(t,e){for(const i of t)if(i===e||i.contains(e))return!0}function eS(t,e,i){const n=t.canvas,o=new MutationObserver((t=>{let e=!1;for(const i of t)e=e||tS(i.addedNodes,n),e=e&&!tS(i.removedNodes,n);e&&i()}));return o.observe(document,{childList:!0,subtree:!0}),o}function iS(t,e,i){const n=t.canvas,o=new MutationObserver((t=>{let e=!1;for(const i of t)e=e||tS(i.removedNodes,n),e=e&&!tS(i.addedNodes,n);e&&i()}));return o.observe(document,{childList:!0,subtree:!0}),o}const nS=new Map;let oS=0;function sS(){const t=window.devicePixelRatio;t!==oS&&(oS=t,nS.forEach(((e,i)=>{i.currentDevicePixelRatio!==t&&e()})))}function rS(t,e,i){const n=t.canvas,o=n&&Ck(n);if(!o)return;const s=rw(((t,e)=>{const n=o.clientWidth;i(t,e),n<o.clientWidth&&i()}),window),r=new ResizeObserver((t=>{const e=t[0],i=e.contentRect.width,n=e.contentRect.height;0===i&&0===n||s(i,n)}));return r.observe(o),function(t,e){nS.size||window.addEventListener("resize",sS),nS.set(t,e)}(t,s),r}function aS(t,e,i){i&&i.disconnect(),"resize"===e&&function(t){nS.delete(t),nS.size||window.removeEventListener("resize",sS)}(t)}function lS(t,e,i){const n=t.canvas,o=rw((e=>{null!==t.ctx&&i(function(t,e){const i=XC[t.type]||t.type,{x:n,y:o}=Pk(t,e);return{type:i,chart:e,native:t,x:void 0!==n?n:null,y:void 0!==o?o:null}}(e,t))}),t);return function(t,e,i){t&&t.addEventListener(e,i,QC)}(n,e,o),o}class cS extends GC{acquireContext(t,e){const i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(function(t,e){const i=t.style,n=t.getAttribute("height"),o=t.getAttribute("width");if(t[YC]={initial:{height:n,width:o,style:{display:i.display,height:i.height,width:i.width}}},i.display=i.display||"block",i.boxSizing=i.boxSizing||"border-box",KC(o)){const e=Lk(t,"width");void 0!==e&&(t.width=e)}if(KC(n))if(""===t.style.height)t.height=t.width/(e||2);else{const e=Lk(t,"height");void 0!==e&&(t.height=e)}}(t,e),i):null}releaseContext(t){const e=t.canvas;if(!e[YC])return!1;const i=e[YC].initial;["height","width"].forEach((t=>{const n=i[t];a_(n)?e.removeAttribute(t):e.setAttribute(t,n)}));const n=i.style||{};return Object.keys(n).forEach((t=>{e.style[t]=n[t]})),e.width=e.width,delete e[YC],!0}addEventListener(t,e,i){this.removeEventListener(t,e);const n=t.$proxies||(t.$proxies={}),o={attach:eS,detach:iS,resize:rS}[e]||lS;n[e]=o(t,e,i)}removeEventListener(t,e){const i=t.$proxies||(t.$proxies={}),n=i[e];if(!n)return;({attach:aS,detach:aS,resize:aS}[e]||JC)(t,e,n),i[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,n){return Ik(t,e,i,n)}isAttached(t){const e=t&&Ck(t);return!(!e||!e.isConnected)}}let hS=class{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(t){const{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}hasValue(){return F_(this.x)&&F_(this.y)}getProps(t,e){const i=this.$animations;if(!e||!i)return this;const n={};return t.forEach((t=>{n[t]=i[t]&&i[t].active()?i[t]._to:this[t]})),n}};function dS(t,e){const i=t.options.ticks,n=function(t){const e=t.options.offset,i=t._tickSize(),n=t._length/i+(e?0:1),o=t._maxLength/i;return Math.floor(Math.min(n,o))}(t),o=Math.min(i.maxTicksLimit||n,n),s=i.major.enabled?function(t){const e=[];let i,n;for(i=0,n=t.length;i<n;i++)t[i].major&&e.push(i);return e}(e):[],r=s.length,a=s[0],l=s[r-1],c=[];if(r>o)return function(t,e,i,n){let o,s=0,r=i[0];for(n=Math.ceil(n),o=0;o<t.length;o++)o===r&&(e.push(t[o]),s++,r=i[s*n])}(e,c,s,r/o),c;const h=function(t,e,i){const n=function(t){const e=t.length;let i,n;if(e<2)return!1;for(n=t[0],i=1;i<e;++i)if(t[i]-t[i-1]!==n)return!1;return n}(t),o=e.length/i;if(!n)return Math.max(o,1);const s=function(t){const e=[],i=Math.sqrt(t);let n;for(n=1;n<i;n++)t%n==0&&(e.push(n),e.push(t/n));return i===(0|i)&&e.push(i),e.sort(((t,e)=>t-e)).pop(),e}(n);for(let t=0,e=s.length-1;t<e;t++){const e=s[t];if(e>o)return e}return Math.max(o,1)}(s,e,o);if(r>0){let t,i;const n=r>1?Math.round((l-a)/(r-1)):null;for(uS(e,c,h,a_(n)?0:a-n,a),t=0,i=r-1;t<i;t++)uS(e,c,h,s[t],s[t+1]);return uS(e,c,h,l,a_(n)?e.length:l+n),c}return uS(e,c,h),c}function uS(t,e,i,n,o){const s=u_(n,0),r=Math.min(u_(o,t.length),t.length);let a,l,c,h=0;for(i=Math.ceil(i),o&&(a=o-n,i=a/Math.floor(a/i)),c=s;c<0;)h++,c=Math.round(s+h*i);for(l=Math.max(s,0);l<r;l++)l===c&&(e.push(t[l]),h++,c=Math.round(s+h*i))}const pS=(t,e,i)=>"top"===e||"left"===e?t[e]+i:t[e]-i,mS=(t,e)=>Math.min(e||t,t);function gS(t,e){const i=[],n=t.length/e,o=t.length;let s=0;for(;s<o;s+=n)i.push(t[Math.floor(s)]);return i}function fS(t,e,i){const n=t.ticks.length,o=Math.min(e,n-1),s=t._startPixel,r=t._endPixel,a=1e-6;let l,c=t.getPixelForTick(o);if(!(i&&(l=1===n?Math.max(c-s,r-c):0===e?(t.getPixelForTick(1)-c)/2:(c-t.getPixelForTick(o-1))/2,c+=o<e?l:-l,c<s-a||c>r+a)))return c}function vS(t){return t.drawTicks?t.tickLength:0}function yS(t,e){if(!t.display)return 0;const i=Jw(t.font,e),n=Qw(t.padding);return(l_(t.text)?t.text.length:1)*i.lineHeight+n.height}function bS(t,e,i){let n=aw(t);return(i&&"right"!==e||!i&&"right"===e)&&(n=(t=>"left"===t?"right":"right"===t?"left":t)(n)),n}class xS extends hS{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,e){return t}getUserBounds(){let{_userMin:t,_userMax:e,_suggestedMin:i,_suggestedMax:n}=this;return t=d_(t,Number.POSITIVE_INFINITY),e=d_(e,Number.NEGATIVE_INFINITY),i=d_(i,Number.POSITIVE_INFINITY),n=d_(n,Number.NEGATIVE_INFINITY),{min:d_(t,i),max:d_(e,n),minDefined:h_(t),maxDefined:h_(e)}}getMinMax(t){let e,{min:i,max:n,minDefined:o,maxDefined:s}=this.getUserBounds();if(o&&s)return{min:i,max:n};const r=this.getMatchingVisibleMetas();for(let a=0,l=r.length;a<l;++a)e=r[a].controller.getMinMax(this,t),o||(i=Math.min(i,e.min)),s||(n=Math.max(n,e.max));return i=s&&i>n?n:i,n=o&&i>n?i:n,{min:d_(i,d_(n,i)),max:d_(n,d_(i,n))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){m_(this.options.beforeUpdate,[this])}update(t,e,i){const{beginAtZero:n,grace:o,ticks:s}=this.options,r=s.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=function(t,e,i){const{min:n,max:o}=t,s=p_(e,(o-n)/2),r=(t,e)=>i&&0===t?0:t+e;return{min:r(n,-Math.abs(s)),max:r(o,s)}}(this,o,n),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const a=r<this.ticks.length;this._convertTicksToLabels(a?gS(this.ticks,r):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),s.display&&(s.autoSkip||"auto"===s.source)&&(this.ticks=dS(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),a&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t,e,i=this.options.reverse;this.isHorizontal()?(t=this.left,e=this.right):(t=this.top,e=this.bottom,i=!i),this._startPixel=t,this._endPixel=e,this._reversePixels=i,this._length=e-t,this._alignToPixels=this.options.alignToPixels}afterUpdate(){m_(this.options.afterUpdate,[this])}beforeSetDimensions(){m_(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(){m_(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),m_(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){m_(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){const e=this.options.ticks;let i,n,o;for(i=0,n=t.length;i<n;i++)o=t[i],o.label=m_(e.callback,[o.value,i,t],this)}afterTickToLabelConversion(){m_(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){m_(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,e=t.ticks,i=mS(this.ticks.length,t.ticks.maxTicksLimit),n=e.minRotation||0,o=e.maxRotation;let s,r,a,l=n;if(!this._isVisible()||!e.display||n>=o||i<=1||!this.isHorizontal())return void(this.labelRotation=n);const c=this._getLabelSizes(),h=c.widest.width,d=c.highest.height,u=K_(this.chart.width-h,0,this.maxWidth);s=t.offset?this.maxWidth/i:u/(i-1),h+6>s&&(s=u/(i-(t.offset?.5:1)),r=this.maxHeight-vS(t.grid)-e.padding-yS(t.title,this.chart.options.font),a=Math.sqrt(h*h+d*d),l=H_(Math.min(Math.asin(K_((c.highest.height+6)/s,-1,1)),Math.asin(K_(r/a,-1,1))-Math.asin(K_(d/a,-1,1)))),l=Math.max(n,Math.min(o,l))),this.labelRotation=l}afterCalculateLabelRotation(){m_(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){m_(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:i,title:n,grid:o}}=this,s=this._isVisible(),r=this.isHorizontal();if(s){const s=yS(n,e.options.font);if(r?(t.width=this.maxWidth,t.height=vS(o)+s):(t.height=this.maxHeight,t.width=vS(o)+s),i.display&&this.ticks.length){const{first:e,last:n,widest:o,highest:s}=this._getLabelSizes(),a=2*i.padding,l=V_(this.labelRotation),c=Math.cos(l),h=Math.sin(l);if(r){const e=i.mirror?0:h*o.width+c*s.height;t.height=Math.min(this.maxHeight,t.height+e+a)}else{const e=i.mirror?0:c*o.width+h*s.height;t.width=Math.min(this.maxWidth,t.width+e+a)}this._calculatePadding(e,n,h,c)}}this._handleMargins(),r?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,i,n){const{ticks:{align:o,padding:s},position:r}=this.options,a=0!==this.labelRotation,l="top"!==r&&"x"===this.axis;if(this.isHorizontal()){const r=this.getPixelForTick(0)-this.left,c=this.right-this.getPixelForTick(this.ticks.length-1);let h=0,d=0;a?l?(h=n*t.width,d=i*e.height):(h=i*t.height,d=n*e.width):"start"===o?d=e.width:"end"===o?h=t.width:"inner"!==o&&(h=t.width/2,d=e.width/2),this.paddingLeft=Math.max((h-r+s)*this.width/(this.width-r),0),this.paddingRight=Math.max((d-c+s)*this.width/(this.width-c),0)}else{let i=e.height/2,n=t.height/2;"start"===o?(i=0,n=t.height):"end"===o&&(i=e.height,n=0),this.paddingTop=i+s,this.paddingBottom=n+s}}_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(){m_(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:e}=this.options;return"top"===e||"bottom"===e||"x"===t}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){let e,i;for(this.beforeTickToLabelConversion(),this.generateTickLabels(t),e=0,i=t.length;e<i;e++)a_(t[e].label)&&(t.splice(e,1),i--,e--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){const e=this.options.ticks.sampleSize;let i=this.ticks;e<i.length&&(i=gS(i,e)),this._labelSizes=t=this._computeLabelSizes(i,i.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,e,i){const{ctx:n,_longestTextCache:o}=this,s=[],r=[],a=Math.floor(e/mS(e,i));let l,c,h,d,u,p,m,g,f,v,y,b=0,x=0;for(l=0;l<e;l+=a){if(d=t[l].label,u=this._resolveTickFontOptions(l),n.font=p=u.string,m=o[p]=o[p]||{data:{},gc:[]},g=u.lineHeight,f=v=0,a_(d)||l_(d)){if(l_(d))for(c=0,h=d.length;c<h;++c)y=d[c],a_(y)||l_(y)||(f=Pw(n,m.data,m.gc,f,y),v+=g)}else f=Pw(n,m.data,m.gc,f,d),v=g;s.push(f),r.push(v),b=Math.max(f,b),x=Math.max(v,x)}!function(t,e){g_(t,(t=>{const i=t.gc,n=i.length/2;let o;if(n>e){for(o=0;o<n;++o)delete t.data[i[o]];i.splice(0,n)}}))}(o,e);const _=s.indexOf(b),w=r.indexOf(x),k=t=>({width:s[t]||0,height:r[t]||0});return{first:k(0),last:k(e-1),widest:k(_),highest:k(w),widths:s,heights:r}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return K_(this._alignToPixels?Iw(this.chart,e,0):e,-32768,32767)}getDecimalForPixel(t){const e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){const e=this.ticks||[];if(t>=0&&t<e.length){const i=e[t];return i.$context||(i.$context=function(t,e,i){return ek(t,{tick:i,index:e,type:"tick"})}(this.getContext(),t,i))}return this.$context||(this.$context=ek(this.chart.getContext(),{scale:this,type:"scale"}))}_tickSize(){const t=this.options.ticks,e=V_(this.labelRotation),i=Math.abs(Math.cos(e)),n=Math.abs(Math.sin(e)),o=this._getLabelSizes(),s=t.autoSkipPadding||0,r=o?o.widest.width+s:0,a=o?o.highest.height+s:0;return this.isHorizontal()?a*i>r*n?r/i:a/n:a*n<r*i?a/i:r/n}_isVisible(){const t=this.options.display;return"auto"!==t?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){const e=this.axis,i=this.chart,n=this.options,{grid:o,position:s,border:r}=n,a=o.offset,l=this.isHorizontal(),c=this.ticks.length+(a?1:0),h=vS(o),d=[],u=r.setContext(this.getContext()),p=u.display?u.width:0,m=p/2,g=function(t){return Iw(i,t,p)};let f,v,y,b,x,_,w,k,C,S,E,A;if("top"===s)f=g(this.bottom),_=this.bottom-h,k=f-m,S=g(t.top)+m,A=t.bottom;else if("bottom"===s)f=g(this.top),S=t.top,A=g(t.bottom)-m,_=f+m,k=this.top+h;else if("left"===s)f=g(this.right),x=this.right-h,w=f-m,C=g(t.left)+m,E=t.right;else if("right"===s)f=g(this.left),C=t.left,E=g(t.right)-m,x=f+m,w=this.left+h;else if("x"===e){if("center"===s)f=g((t.top+t.bottom)/2+.5);else if(c_(s)){const t=Object.keys(s)[0],e=s[t];f=g(this.chart.scales[t].getPixelForValue(e))}S=t.top,A=t.bottom,_=f+m,k=_+h}else if("y"===e){if("center"===s)f=g((t.left+t.right)/2);else if(c_(s)){const t=Object.keys(s)[0],e=s[t];f=g(this.chart.scales[t].getPixelForValue(e))}x=f-m,w=x-h,C=t.left,E=t.right}const M=u_(n.ticks.maxTicksLimit,c),T=Math.max(1,Math.ceil(c/M));for(v=0;v<c;v+=T){const t=this.getContext(v),e=o.setContext(t),n=r.setContext(t),s=e.lineWidth,c=e.color,h=n.dash||[],u=n.dashOffset,p=e.tickWidth,m=e.tickColor,g=e.tickBorderDash||[],f=e.tickBorderDashOffset;y=fS(this,v,a),void 0!==y&&(b=Iw(i,y,s),l?x=w=C=E=b:_=k=S=A=b,d.push({tx1:x,ty1:_,tx2:w,ty2:k,x1:C,y1:S,x2:E,y2:A,width:s,color:c,borderDash:h,borderDashOffset:u,tickWidth:p,tickColor:m,tickBorderDash:g,tickBorderDashOffset:f}))}return this._ticksLength=c,this._borderValue=f,d}_computeLabelItems(t){const e=this.axis,i=this.options,{position:n,ticks:o}=i,s=this.isHorizontal(),r=this.ticks,{align:a,crossAlign:l,padding:c,mirror:h}=o,d=vS(i.grid),u=d+c,p=h?-c:u,m=-V_(this.labelRotation),g=[];let f,v,y,b,x,_,w,k,C,S,E,A,M="middle";if("top"===n)_=this.bottom-p,w=this._getXAxisLabelAlignment();else if("bottom"===n)_=this.top+p,w=this._getXAxisLabelAlignment();else if("left"===n){const t=this._getYAxisLabelAlignment(d);w=t.textAlign,x=t.x}else if("right"===n){const t=this._getYAxisLabelAlignment(d);w=t.textAlign,x=t.x}else if("x"===e){if("center"===n)_=(t.top+t.bottom)/2+u;else if(c_(n)){const t=Object.keys(n)[0],e=n[t];_=this.chart.scales[t].getPixelForValue(e)+u}w=this._getXAxisLabelAlignment()}else if("y"===e){if("center"===n)x=(t.left+t.right)/2-u;else if(c_(n)){const t=Object.keys(n)[0],e=n[t];x=this.chart.scales[t].getPixelForValue(e)}w=this._getYAxisLabelAlignment(d).textAlign}"y"===e&&("start"===a?M="top":"end"===a&&(M="bottom"));const T=this._getLabelSizes();for(f=0,v=r.length;f<v;++f){y=r[f],b=y.label;const t=o.setContext(this.getContext(f));k=this.getPixelForTick(f)+o.labelOffset,C=this._resolveTickFontOptions(f),S=C.lineHeight,E=l_(b)?b.length:1;const e=E/2,i=t.color,a=t.textStrokeColor,c=t.textStrokeWidth;let d,u=w;if(s?(x=k,"inner"===w&&(u=f===v-1?this.options.reverse?"left":"right":0===f?this.options.reverse?"right":"left":"center"),A="top"===n?"near"===l||0!==m?-E*S+S/2:"center"===l?-T.highest.height/2-e*S+S:-T.highest.height+S/2:"near"===l||0!==m?S/2:"center"===l?T.highest.height/2-e*S:T.highest.height-E*S,h&&(A*=-1),0===m||t.showLabelBackdrop||(x+=S/2*Math.sin(m))):(_=k,A=(1-E)*S/2),t.showLabelBackdrop){const e=Qw(t.backdropPadding),i=T.heights[f],n=T.widths[f];let o=A-e.top,s=0-e.left;switch(M){case"middle":o-=i/2;break;case"bottom":o-=i}switch(w){case"center":s-=n/2;break;case"right":s-=n;break;case"inner":f===v-1?s-=n:f>0&&(s-=n/2)}d={left:s,top:o,width:n+e.width,height:i+e.height,color:t.backdropColor}}g.push({label:b,font:C,textOffset:A,options:{rotation:m,color:i,strokeColor:a,strokeWidth:c,textAlign:u,textBaseline:M,translation:[x,_],backdrop:d}})}return g}_getXAxisLabelAlignment(){const{position:t,ticks:e}=this.options;if(-V_(this.labelRotation))return"top"===t?"left":"right";let i="center";return"start"===e.align?i="left":"end"===e.align?i="right":"inner"===e.align&&(i="inner"),i}_getYAxisLabelAlignment(t){const{position:e,ticks:{crossAlign:i,mirror:n,padding:o}}=this.options,s=t+o,r=this._getLabelSizes().widest.width;let a,l;return"left"===e?n?(l=this.right+o,"near"===i?a="left":"center"===i?(a="center",l+=r/2):(a="right",l+=r)):(l=this.right-s,"near"===i?a="right":"center"===i?(a="center",l-=r/2):(a="left",l=this.left)):"right"===e?n?(l=this.left+o,"near"===i?a="right":"center"===i?(a="center",l-=r/2):(a="left",l-=r)):(l=this.left+s,"near"===i?a="left":"center"===i?(a="center",l+=r/2):(a="right",l=this.right)):a="right",{textAlign:a,x:l}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,e=this.options.position;return"left"===e||"right"===e?{top:0,left:this.left,bottom:t.height,right:this.right}:"top"===e||"bottom"===e?{top:this.top,left:0,bottom:this.bottom,right:t.width}:void 0}drawBackground(){const{ctx:t,options:{backgroundColor:e},left:i,top:n,width:o,height:s}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(i,n,o,s),t.restore())}getLineWidthForValue(t){const e=this.options.grid;if(!this._isVisible()||!e.display)return 0;const i=this.ticks.findIndex((e=>e.value===t));if(i>=0){return e.setContext(this.getContext(i)).lineWidth}return 0}drawGrid(t){const e=this.options.grid,i=this.ctx,n=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let o,s;const r=(t,e,n)=>{n.width&&n.color&&(i.save(),i.lineWidth=n.width,i.strokeStyle=n.color,i.setLineDash(n.borderDash||[]),i.lineDashOffset=n.borderDashOffset,i.beginPath(),i.moveTo(t.x,t.y),i.lineTo(e.x,e.y),i.stroke(),i.restore())};if(e.display)for(o=0,s=n.length;o<s;++o){const t=n[o];e.drawOnChartArea&&r({x:t.x1,y:t.y1},{x:t.x2,y:t.y2},t),e.drawTicks&&r({x:t.tx1,y:t.ty1},{x:t.tx2,y:t.ty2},{color:t.tickColor,width:t.tickWidth,borderDash:t.tickBorderDash,borderDashOffset:t.tickBorderDashOffset})}}drawBorder(){const{chart:t,ctx:e,options:{border:i,grid:n}}=this,o=i.setContext(this.getContext()),s=i.display?o.width:0;if(!s)return;const r=n.setContext(this.getContext(0)).lineWidth,a=this._borderValue;let l,c,h,d;this.isHorizontal()?(l=Iw(t,this.left,s)-s/2,c=Iw(t,this.right,r)+r/2,h=d=a):(h=Iw(t,this.top,s)-s/2,d=Iw(t,this.bottom,r)+r/2,l=c=a),e.save(),e.lineWidth=o.width,e.strokeStyle=o.color,e.beginPath(),e.moveTo(l,h),e.lineTo(c,d),e.stroke(),e.restore()}drawLabels(t){if(!this.options.ticks.display)return;const e=this.ctx,i=this._computeLabelArea();i&&Rw(e,i);const n=this.getLabelItems(t);for(const t of n){const i=t.options,n=t.font;Vw(e,t.label,0,t.textOffset,n,i)}i&&Nw(e)}drawTitle(){const{ctx:t,options:{position:e,title:i,reverse:n}}=this;if(!i.display)return;const o=Jw(i.font),s=Qw(i.padding),r=i.align;let a=o.lineHeight/2;"bottom"===e||"center"===e||c_(e)?(a+=s.bottom,l_(i.text)&&(a+=o.lineHeight*(i.text.length-1))):a+=s.top;const{titleX:l,titleY:c,maxWidth:h,rotation:d}=function(t,e,i,n){const{top:o,left:s,bottom:r,right:a,chart:l}=t,{chartArea:c,scales:h}=l;let d,u,p,m=0;const g=r-o,f=a-s;if(t.isHorizontal()){if(u=lw(n,s,a),c_(i)){const t=Object.keys(i)[0],n=i[t];p=h[t].getPixelForValue(n)+g-e}else p="center"===i?(c.bottom+c.top)/2+g-e:pS(t,i,e);d=a-s}else{if(c_(i)){const t=Object.keys(i)[0],n=i[t];u=h[t].getPixelForValue(n)-f+e}else u="center"===i?(c.left+c.right)/2-f+e:pS(t,i,e);p=lw(n,r,o),m="left"===i?-$_:$_}return{titleX:u,titleY:p,maxWidth:d,rotation:m}}(this,a,e,r);Vw(t,i.text,0,0,o,{color:i.color,maxWidth:h,rotation:d,textAlign:bS(r,e,n),textBaseline:"middle",translation:[l,c]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){const t=this.options,e=t.ticks&&t.ticks.z||0,i=u_(t.grid&&t.grid.z,-1),n=u_(t.border&&t.border.z,0);return this._isVisible()&&this.draw===xS.prototype.draw?[{z:i,draw:t=>{this.drawBackground(),this.drawGrid(t),this.drawTitle()}},{z:n,draw:()=>{this.drawBorder()}},{z:e,draw:t=>{this.drawLabels(t)}}]:[{z:e,draw:t=>{this.draw(t)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",n=[];let o,s;for(o=0,s=e.length;o<s;++o){const s=e[o];s[i]!==this.id||t&&s.type!==t||n.push(s)}return n}_resolveTickFontOptions(t){return Jw(this.options.ticks.setContext(this.getContext(t)).font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class _S{constructor(t,e,i){this.type=t,this.scope=e,this.override=i,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){const e=Object.getPrototypeOf(t);let i;(function(t){return"id"in t&&"defaults"in t})(e)&&(i=this.register(e));const n=this.items,o=t.id,s=this.scope+"."+o;if(!o)throw new Error("class does not have id: "+t);return o in n||(n[o]=t,function(t,e,i){const n=x_(Object.create(null),[i?Tw.get(i):{},Tw.get(e),t.defaults]);Tw.set(e,n),t.defaultRoutes&&function(t,e){Object.keys(e).forEach((i=>{const n=i.split("."),o=n.pop(),s=[t].concat(n).join("."),r=e[i].split("."),a=r.pop(),l=r.join(".");Tw.route(s,o,l,a)}))}(e,t.defaultRoutes);t.descriptors&&Tw.describe(e,t.descriptors)}(t,s,i),this.override&&Tw.override(t.id,t.overrides)),s}get(t){return this.items[t]}unregister(t){const e=this.items,i=t.id,n=this.scope;i in e&&delete e[i],n&&i in Tw[n]&&(delete Tw[n][i],this.override&&delete Cw[i])}}class wS{constructor(){this.controllers=new _S(uC,"datasets",!0),this.elements=new _S(hS,"elements"),this.plugins=new _S(Object,"plugins"),this.scales=new _S(xS,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,i){[...e].forEach((e=>{const n=i||this._getRegistryForType(e);i||n.isForType(e)||n===this.plugins&&e.id?this._exec(t,n,e):g_(e,(e=>{const n=i||this._getRegistryForType(e);this._exec(t,n,e)}))}))}_exec(t,e,i){const n=S_(t);m_(i["before"+n],[],i),e[t](i),m_(i["after"+n],[],i)}_getRegistryForType(t){for(let e=0;e<this._typedRegistries.length;e++){const i=this._typedRegistries[e];if(i.isForType(t))return i}return this.plugins}_get(t,e,i){const n=e.get(t);if(void 0===n)throw new Error('"'+t+'" is not a registered '+i+".");return n}}var kS=new wS;class CS{constructor(){this._init=[]}notify(t,e,i,n){"beforeInit"===e&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install"));const o=n?this._descriptors(t).filter(n):this._descriptors(t),s=this._notify(o,t,e,i);return"afterDestroy"===e&&(this._notify(o,t,"stop"),this._notify(this._init,t,"uninstall")),s}_notify(t,e,i,n){n=n||{};for(const o of t){const t=o.plugin;if(!1===m_(t[i],[e,n,o.options],t)&&n.cancelable)return!1}return!0}invalidate(){a_(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const e=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),e}_createDescriptors(t,e){const i=t&&t.config,n=u_(i.options&&i.options.plugins,{}),o=function(t){const e={},i=[],n=Object.keys(kS.plugins.items);for(let t=0;t<n.length;t++)i.push(kS.getPlugin(n[t]));const o=t.plugins||[];for(let t=0;t<o.length;t++){const n=o[t];-1===i.indexOf(n)&&(i.push(n),e[n.id]=!0)}return{plugins:i,localIds:e}}(i);return!1!==n||e?function(t,{plugins:e,localIds:i},n,o){const s=[],r=t.getContext();for(const a of e){const e=a.id,l=SS(n[e],o);null!==l&&s.push({plugin:a,options:ES(t.config,{plugin:a,local:i[e]},l,r)})}return s}(t,o,n,e):[]}_notifyStateChanges(t){const e=this._oldCache||[],i=this._cache,n=(t,e)=>t.filter((t=>!e.some((e=>t.plugin.id===e.plugin.id))));this._notify(n(e,i),t,"stop"),this._notify(n(i,e),t,"start")}}function SS(t,e){return e||!1!==t?!0===t?{}:t:null}function ES(t,{plugin:e,local:i},n,o){const s=t.pluginScopeKeys(e),r=t.getOptionScopes(n,s);return i&&e.defaults&&r.push(e.defaults),t.createResolver(r,o,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function AS(t,e){const i=Tw.datasets[t]||{};return((e.datasets||{})[t]||{}).indexAxis||e.indexAxis||i.indexAxis||"x"}function MS(t){if("x"===t||"y"===t||"r"===t)return t}function TS(t,...e){if(MS(t))return t;for(const n of e){const e=n.axis||("top"===(i=n.position)||"bottom"===i?"x":"left"===i||"right"===i?"y":void 0)||t.length>1&&MS(t[0].toLowerCase());if(e)return e}var i;throw new Error(`Cannot determine type of '${t}' axis. Please provide 'axis' or 'position' option.`)}function PS(t,e,i){if(i[e+"AxisID"]===t)return{axis:e}}function DS(t,e){const i=Cw[t.type]||{scales:{}},n=e.scales||{},o=AS(t.type,e),s=Object.create(null);return Object.keys(n).forEach((e=>{const r=n[e];if(!c_(r))return console.error(`Invalid scale configuration for scale: ${e}`);if(r._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${e}`);const a=TS(e,r,function(t,e){if(e.data&&e.data.datasets){const i=e.data.datasets.filter((e=>e.xAxisID===t||e.yAxisID===t));if(i.length)return PS(t,"x",i[0])||PS(t,"y",i[0])}return{}}(e,t),Tw.scales[r.type]),l=function(t,e){return t===e?"_index_":"_value_"}(a,o),c=i.scales||{};s[e]=__(Object.create(null),[{axis:a},r,c[a],c[l]])})),t.data.datasets.forEach((i=>{const o=i.type||t.type,r=i.indexAxis||AS(o,e),a=(Cw[o]||{}).scales||{};Object.keys(a).forEach((t=>{const e=function(t,e){let i=t;return"_index_"===t?i=e:"_value_"===t&&(i="x"===e?"y":"x"),i}(t,r),o=i[e+"AxisID"]||e;s[o]=s[o]||Object.create(null),__(s[o],[{axis:e},n[o],a[t]])}))})),Object.keys(s).forEach((t=>{const e=s[t];__(e,[Tw.scales[e.type],Tw.scale])})),s}function IS(t){const e=t.options||(t.options={});e.plugins=u_(e.plugins,{}),e.scales=DS(t,e)}function OS(t){return(t=t||{}).datasets=t.datasets||[],t.labels=t.labels||[],t}const $S=new Map,LS=new Set;function zS(t,e){let i=$S.get(t);return i||(i=e(),$S.set(t,i),LS.add(i)),i}const RS=(t,e,i)=>{const n=C_(e,i);void 0!==n&&t.add(n)};class NS{constructor(t){this._config=function(t){return(t=t||{}).data=OS(t.data),IS(t),t}(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=OS(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),IS(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return zS(t,(()=>[[`datasets.${t}`,""]]))}datasetAnimationScopeKeys(t,e){return zS(`${t}.transition.${e}`,(()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]]))}datasetElementScopeKeys(t,e){return zS(`${t}-${e}`,(()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]]))}pluginScopeKeys(t){const e=t.id;return zS(`${this.type}-plugin-${e}`,(()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]]))}_cachedScopes(t,e){const i=this._scopeCache;let n=i.get(t);return n&&!e||(n=new Map,i.set(t,n)),n}getOptionScopes(t,e,i){const{options:n,type:o}=this,s=this._cachedScopes(t,i),r=s.get(e);if(r)return r;const a=new Set;e.forEach((e=>{t&&(a.add(t),e.forEach((e=>RS(a,t,e)))),e.forEach((t=>RS(a,n,t))),e.forEach((t=>RS(a,Cw[o]||{},t))),e.forEach((t=>RS(a,Tw,t))),e.forEach((t=>RS(a,Sw,t)))}));const l=Array.from(a);return 0===l.length&&l.push(Object.create(null)),LS.has(e)&&s.set(e,l),l}chartOptionScopes(){const{options:t,type:e}=this;return[t,Cw[e]||{},Tw.datasets[e]||{},{type:e},Tw,Sw]}resolveNamedOptions(t,e,i,n=[""]){const o={$shared:!0},{resolver:s,subPrefixes:r}=jS(this._resolverCache,t,n);let a=s;if(function(t,e){const{isScriptable:i,isIndexable:n}=ok(t);for(const o of e){const e=i(o),s=n(o),r=(s||e)&&t[o];if(e&&(A_(r)||BS(r))||s&&l_(r))return!0}return!1}(s,e)){o.$shared=!1;a=nk(s,i=A_(i)?i():i,this.createResolver(t,i,r))}for(const t of e)o[t]=a[t];return o}createResolver(t,e,i=[""],n){const{resolver:o}=jS(this._resolverCache,t,i);return c_(e)?nk(o,e,void 0,n):o}}function jS(t,e,i){let n=t.get(e);n||(n=new Map,t.set(e,n));const o=i.join();let s=n.get(o);if(!s){s={resolver:ik(e,i),subPrefixes:i.filter((t=>!t.toLowerCase().includes("hover")))},n.set(o,s)}return s}const BS=t=>c_(t)&&Object.getOwnPropertyNames(t).some((e=>A_(t[e])));const FS=["top","bottom","left","right","chartArea"];function qS(t,e){return"top"===t||"bottom"===t||-1===FS.indexOf(t)&&"x"===e}function VS(t,e){return function(i,n){return i[t]===n[t]?i[e]-n[e]:i[t]-n[t]}}function HS(t){const e=t.chart,i=e.options.animation;e.notifyPlugins("afterRender"),m_(i&&i.onComplete,[t],e)}function US(t){const e=t.chart,i=e.options.animation;m_(i&&i.onProgress,[t],e)}function WS(t){return kk()&&"string"==typeof t?t=document.getElementById(t):t&&t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t}const GS={},ZS=t=>{const e=WS(t);return Object.values(GS).filter((t=>t.canvas===e)).pop()};function YS(t,e,i){const n=Object.keys(t);for(const o of n){const n=+o;if(n>=e){const s=t[o];delete t[o],(i>0||n>e)&&(t[n+i]=s)}}}function XS(t,e,i){return t.options.clip?t[i]:e[i]}class KS{static defaults=Tw;static instances=GS;static overrides=Cw;static registry=kS;static version="4.4.8";static getChart=ZS;static register(...t){kS.add(...t),QS()}static unregister(...t){kS.remove(...t),QS()}constructor(t,e){const i=this.config=new NS(e),n=WS(t),o=ZS(n);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const s=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||function(t){return!kk()||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas?ZC:cS}(n)),this.platform.updateConfig(i);const r=this.platform.acquireContext(n,s.aspectRatio),a=r&&r.canvas,l=a&&a.height,c=a&&a.width;this.id=r_(),this.ctx=r,this.canvas=a,this.width=c,this.height=l,this._options=s,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 CS,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=function(t,e){let i;return function(...n){return e?(clearTimeout(i),i=setTimeout(t,e,n)):t.apply(this,n),e}}((t=>this.update(t)),s.resizeDelay||0),this._dataChanges=[],GS[this.id]=this,r&&a?(Xk.listen(this,"complete",HS),Xk.listen(this,"progress",US),this._initialize(),this.attached&&this.update()):console.error("Failed to create chart: can't acquire context from the given item")}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:n,_aspectRatio:o}=this;return a_(t)?e&&o?o:n?i/n:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return kS}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():Ok(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return Ow(this.canvas,this.ctx),this}stop(){return Xk.stop(this),this}resize(t,e){Xk.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const i=this.options,n=this.canvas,o=i.maintainAspectRatio&&this.aspectRatio,s=this.platform.getMaximumSize(n,t,e,o),r=i.devicePixelRatio||this.platform.getDevicePixelRatio(),a=this.width?"resize":"attach";this.width=s.width,this.height=s.height,this._aspectRatio=this.aspectRatio,Ok(this,r,!0)&&(this.notifyPlugins("resize",{size:s}),m_(i.onResize,[this,s],this),this.attached&&this._doResize(a)&&this.render())}ensureScalesHaveIDs(){g_(this.options.scales||{},((t,e)=>{t.id=e}))}buildOrUpdateScales(){const t=this.options,e=t.scales,i=this.scales,n=Object.keys(i).reduce(((t,e)=>(t[e]=!1,t)),{});let o=[];e&&(o=o.concat(Object.keys(e).map((t=>{const i=e[t],n=TS(t,i),o="r"===n,s="x"===n;return{options:i,dposition:o?"chartArea":s?"bottom":"left",dtype:o?"radialLinear":s?"category":"linear"}})))),g_(o,(e=>{const o=e.options,s=o.id,r=TS(s,o),a=u_(o.type,e.dtype);void 0!==o.position&&qS(o.position,r)===qS(e.dposition)||(o.position=e.dposition),n[s]=!0;let l=null;if(s in i&&i[s].type===a)l=i[s];else{l=new(kS.getScale(a))({id:s,type:a,ctx:this.ctx,chart:this}),i[l.id]=l}l.init(o,t)})),g_(n,((t,e)=>{t||delete i[e]})),g_(i,(t=>{WC.configure(this,t,t.options),WC.addBox(this,t)}))}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,i=t.length;if(t.sort(((t,e)=>t.index-e.index)),i>e){for(let t=e;t<i;++t)this._destroyDatasetMeta(t);t.splice(e,i-e)}this._sortedMetasets=t.slice(0).sort(VS("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:e}}=this;t.length>e.length&&delete this._stacks,t.forEach(((t,i)=>{0===e.filter((e=>e===t._dataset)).length&&this._destroyDatasetMeta(i)}))}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let i,n;for(this._removeUnreferencedMetasets(),i=0,n=e.length;i<n;i++){const n=e[i];let o=this.getDatasetMeta(i);const s=n.type||this.config.type;if(o.type&&o.type!==s&&(this._destroyDatasetMeta(i),o=this.getDatasetMeta(i)),o.type=s,o.indexAxis=n.indexAxis||AS(s,this.options),o.order=n.order||0,o.index=i,o.label=""+n.label,o.visible=this.isDatasetVisible(i),o.controller)o.controller.updateIndex(i),o.controller.linkScales();else{const e=kS.getController(s),{datasetElementType:n,dataElementType:r}=Tw.datasets[s];Object.assign(e,{dataElementType:kS.getElement(r),datasetElementType:n&&kS.getElement(n)}),o.controller=new e(this,i),t.push(o.controller)}}return this._updateMetasets(),t}_resetElements(){g_(this.data.datasets,((t,e)=>{this.getDatasetMeta(e).controller.reset()}),this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this.config;e.update();const i=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),n=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),!1===this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0}))return;const o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let s=0;for(let t=0,e=this.data.datasets.length;t<e;t++){const{controller:e}=this.getDatasetMeta(t),i=!n&&-1===o.indexOf(e);e.buildOrUpdateElements(i),s=Math.max(+e.getMaxOverflow(),s)}s=this._minPadding=i.layout.autoPadding?s:0,this._updateLayout(s),n||g_(o,(t=>{t.reset()})),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(VS("z","_idx"));const{_active:r,_lastEvent:a}=this;a?this._eventHandler(a,!0):r.length&&this._updateHoverStyles(r,r,!0),this.render()}_updateScales(){g_(this.scales,(t=>{WC.removeBox(this,t)})),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);M_(e,i)&&!!this._responsiveListeners===t.responsive||(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:i,start:n,count:o}of e){YS(t,n,"_removeElements"===i?-o:o)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,i=e=>new Set(t.filter((t=>t[0]===e)).map(((t,e)=>e+","+t.splice(1).join(",")))),n=i(0);for(let t=1;t<e;t++)if(!M_(n,i(t)))return;return Array.from(n).map((t=>t.split(","))).map((t=>({method:t[1],start:+t[2],count:+t[3]})))}_updateLayout(t){if(!1===this.notifyPlugins("beforeLayout",{cancelable:!0}))return;WC.update(this,this.width,this.height,t);const e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],g_(this.boxes,(t=>{i&&"chartArea"===t.position||(t.configure&&t.configure(),this._layers.push(...t._layers()))}),this),this._layers.forEach(((t,e)=>{t._idx=e})),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(!1!==this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})){for(let t=0,e=this.data.datasets.length;t<e;++t)this.getDatasetMeta(t).controller.configure();for(let e=0,i=this.data.datasets.length;e<i;++e)this._updateDataset(e,A_(t)?t({datasetIndex:e}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,e){const i=this.getDatasetMeta(t),n={meta:i,index:t,mode:e,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetUpdate",n)&&(i.controller._update(e),n.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",n))}render(){!1!==this.notifyPlugins("beforeRender",{cancelable:!0})&&(Xk.has(this)?this.attached&&!Xk.running(this)&&Xk.start(this):(this.draw(),HS({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:t,height:e}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(t,e)}if(this.clear(),this.width<=0||this.height<=0)return;if(!1===this.notifyPlugins("beforeDraw",{cancelable:!0}))return;const e=this._layers;for(t=0;t<e.length&&e[t].z<=0;++t)e[t].draw(this.chartArea);for(this._drawDatasets();t<e.length;++t)e[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const e=this._sortedMetasets,i=[];let n,o;for(n=0,o=e.length;n<o;++n){const o=e[n];t&&!o.visible||i.push(o)}return i}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(!1===this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0}))return;const t=this.getSortedVisibleDatasetMetas();for(let e=t.length-1;e>=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,i=t._clip,n=!i.disabled,o=function(t,e){const{xScale:i,yScale:n}=t;return i&&n?{left:XS(i,e,"left"),right:XS(i,e,"right"),top:XS(n,e,"top"),bottom:XS(n,e,"bottom")}:e}(t,this.chartArea),s={meta:t,index:t.index,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetDraw",s)&&(n&&Rw(e,{left:!1===i.left?0:o.left-i.left,right:!1===i.right?this.width:o.right+i.right,top:!1===i.top?0:o.top-i.top,bottom:!1===i.bottom?this.height:o.bottom+i.bottom}),t.controller.draw(),n&&Nw(e),s.cancelable=!1,this.notifyPlugins("afterDatasetDraw",s))}isPointInArea(t){return zw(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,i,n){const o=OC.modes[e];return"function"==typeof o?o(this,t,i,n):[]}getDatasetMeta(t){const e=this.data.datasets[t],i=this._metasets;let n=i.filter((t=>t&&t._dataset===e)).pop();return n||(n={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},i.push(n)),n}getContext(){return this.$context||(this.$context=ek(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const i=this.getDatasetMeta(t);return"boolean"==typeof i.hidden?!i.hidden:!e.hidden}setDatasetVisibility(t,e){this.getDatasetMeta(t).hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,i){const n=i?"show":"hide",o=this.getDatasetMeta(t),s=o.controller._resolveAnimations(void 0,n);E_(e)?(o.data[e].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),s.update(o,{visible:i}),this.update((e=>e.datasetIndex===t?n:void 0)))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),Xk.remove(this),t=0,e=this.data.datasets.length;t<e;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:t,ctx:e}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),Ow(t,e),this.platform.releaseContext(e),this.canvas=null,this.ctx=null),delete GS[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const t=this._listeners,e=this.platform,i=(i,n)=>{e.addEventListener(this,i,n),t[i]=n},n=(t,e,i)=>{t.offsetX=e,t.offsetY=i,this._eventHandler(t)};g_(this.options.events,(t=>i(t,n)))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,i=(i,n)=>{e.addEventListener(this,i,n),t[i]=n},n=(i,n)=>{t[i]&&(e.removeEventListener(this,i,n),delete t[i])},o=(t,e)=>{this.canvas&&this.resize(t,e)};let s;const r=()=>{n("attach",r),this.attached=!0,this.resize(),i("resize",o),i("detach",s)};s=()=>{this.attached=!1,n("resize",o),this._stop(),this._resize(0,0),i("attach",r)},e.isAttached(this.canvas)?r():s()}unbindEvents(){g_(this._listeners,((t,e)=>{this.platform.removeEventListener(this,e,t)})),this._listeners={},g_(this._responsiveListeners,((t,e)=>{this.platform.removeEventListener(this,e,t)})),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){const n=i?"set":"remove";let o,s,r,a;for("dataset"===e&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+n+"DatasetHoverStyle"]()),r=0,a=t.length;r<a;++r){s=t[r];const e=s&&this.getDatasetMeta(s.datasetIndex).controller;e&&e[n+"HoverStyle"](s.element,s.datasetIndex,s.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const e=this._active||[],i=t.map((({datasetIndex:t,index:e})=>{const i=this.getDatasetMeta(t);if(!i)throw new Error("No dataset found at index "+t);return{datasetIndex:t,element:i.data[e],index:e}}));!f_(i,e)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,e))}notifyPlugins(t,e,i){return this._plugins.notify(this,t,e,i)}isPluginEnabled(t){return 1===this._plugins._cache.filter((e=>e.plugin.id===t)).length}_updateHoverStyles(t,e,i){const n=this.options.hover,o=(t,e)=>t.filter((t=>!e.some((e=>t.datasetIndex===e.datasetIndex&&t.index===e.index)))),s=o(e,t),r=i?t:o(t,e);s.length&&this.updateHoverStyle(s,n.mode,!1),r.length&&n.mode&&this.updateHoverStyle(r,n.mode,!0)}_eventHandler(t,e){const i={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},n=e=>(e.options.events||this.options.events).includes(t.native.type);if(!1===this.notifyPlugins("beforeEvent",i,n))return;const o=this._handleEvent(t,e,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,n),(o||i.changed)&&this.render(),this}_handleEvent(t,e,i){const{_active:n=[],options:o}=this,s=e,r=this._getActiveElements(t,n,i,s),a=function(t){return"mouseup"===t.type||"click"===t.type||"contextmenu"===t.type}(t),l=function(t,e,i,n){return i&&"mouseout"!==t.type?n?e:t:null}(t,this._lastEvent,i,a);i&&(this._lastEvent=null,m_(o.onHover,[t,r,this],this),a&&m_(o.onClick,[t,r,this],this));const c=!f_(r,n);return(c||e)&&(this._active=r,this._updateHoverStyles(r,n,e)),this._lastEvent=l,c}_getActiveElements(t,e,i,n){if("mouseout"===t.type)return[];if(!i)return e;const o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,n)}}function QS(){return g_(KS.instances,(t=>t._plugins.invalidate()))}function JS(t,e,i,n){const o=Yw(t.options.borderRadius,["outerStart","outerEnd","innerStart","innerEnd"]);const s=(i-e)/2,r=Math.min(s,n*e/2),a=t=>{const e=(i-Math.min(s,t))*n/2;return K_(t,0,Math.min(s,e))};return{outerStart:a(o.outerStart),outerEnd:a(o.outerEnd),innerStart:K_(o.innerStart,0,r),innerEnd:K_(o.innerEnd,0,r)}}function tE(t,e,i,n){return{x:i+t*Math.cos(e),y:n+t*Math.sin(e)}}function eE(t,e,i,n,o,s){const{x:r,y:a,startAngle:l,pixelMargin:c,innerRadius:h}=e,d=Math.max(e.outerRadius+n+i-c,0),u=h>0?h+n+i+c:0;let p=0;const m=o-l;if(n){const t=((h>0?h-n:0)+(d>0?d-n:0))/2;p=(m-(0!==t?m*t/(t+n):m))/2}const g=(m-Math.max(.001,m*d-i/T_)/d)/2,f=l+g+p,v=o-g-p,{outerStart:y,outerEnd:b,innerStart:x,innerEnd:_}=JS(e,u,d,v-f),w=d-y,k=d-b,C=f+y/w,S=v-b/k,E=u+x,A=u+_,M=f+x/E,T=v-_/A;if(t.beginPath(),s){const e=(C+S)/2;if(t.arc(r,a,d,C,e),t.arc(r,a,d,e,S),b>0){const e=tE(k,S,r,a);t.arc(e.x,e.y,b,S,v+$_)}const i=tE(A,v,r,a);if(t.lineTo(i.x,i.y),_>0){const e=tE(A,T,r,a);t.arc(e.x,e.y,_,v+$_,T+Math.PI)}const n=(v-_/u+(f+x/u))/2;if(t.arc(r,a,u,v-_/u,n,!0),t.arc(r,a,u,n,f+x/u,!0),x>0){const e=tE(E,M,r,a);t.arc(e.x,e.y,x,M+Math.PI,f-$_)}const o=tE(w,f,r,a);if(t.lineTo(o.x,o.y),y>0){const e=tE(w,C,r,a);t.arc(e.x,e.y,y,f-$_,C)}}else{t.moveTo(r,a);const e=Math.cos(C)*d+r,i=Math.sin(C)*d+a;t.lineTo(e,i);const n=Math.cos(S)*d+r,o=Math.sin(S)*d+a;t.lineTo(n,o)}t.closePath()}function iE(t,e,i,n,o){const{fullCircles:s,startAngle:r,circumference:a,options:l}=e,{borderWidth:c,borderJoinStyle:h,borderDash:d,borderDashOffset:u}=l,p="inner"===l.borderAlign;if(!c)return;t.setLineDash(d||[]),t.lineDashOffset=u,p?(t.lineWidth=2*c,t.lineJoin=h||"round"):(t.lineWidth=c,t.lineJoin=h||"bevel");let m=e.endAngle;if(s){eE(t,e,i,n,m,o);for(let e=0;e<s;++e)t.stroke();isNaN(a)||(m=r+(a%P_||P_))}p&&function(t,e,i){const{startAngle:n,pixelMargin:o,x:s,y:r,outerRadius:a,innerRadius:l}=e;let c=o/a;t.beginPath(),t.arc(s,r,a,n-c,i+c),l>o?(c=o/l,t.arc(s,r,l,i+c,n-c,!0)):t.arc(s,r,o,i+$_,n-$_),t.closePath(),t.clip()}(t,e,m),s||(eE(t,e,i,n,m,o),t.stroke())}class nE extends hS{static id="arc";static defaults={borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0};static defaultRoutes={backgroundColor:"backgroundColor"};static descriptors={_scriptable:!0,_indexable:t=>"borderDash"!==t};circumference;endAngle;fullCircles;innerRadius;outerRadius;pixelMargin;startAngle;constructor(t){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,t&&Object.assign(this,t)}inRange(t,e,i){const n=this.getProps(["x","y"],i),{angle:o,distance:s}=W_(n,{x:t,y:e}),{startAngle:r,endAngle:a,innerRadius:l,outerRadius:c,circumference:h}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],i),d=(this.options.spacing+this.options.borderWidth)/2,u=u_(h,a-r),p=X_(o,r,a)&&r!==a,m=u>=P_||p,g=Q_(s,l+d,c+d);return m&&g}getCenterPoint(t){const{x:e,y:i,startAngle:n,endAngle:o,innerRadius:s,outerRadius:r}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],t),{offset:a,spacing:l}=this.options,c=(n+o)/2,h=(s+r+l+a)/2;return{x:e+Math.cos(c)*h,y:i+Math.sin(c)*h}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){const{options:e,circumference:i}=this,n=(e.offset||0)/4,o=(e.spacing||0)/2,s=e.circular;if(this.pixelMargin="inner"===e.borderAlign?.33:0,this.fullCircles=i>P_?Math.floor(i/P_):0,0===i||this.innerRadius<0||this.outerRadius<0)return;t.save();const r=(this.startAngle+this.endAngle)/2;t.translate(Math.cos(r)*n,Math.sin(r)*n);const a=n*(1-Math.sin(Math.min(T_,i||0)));t.fillStyle=e.backgroundColor,t.strokeStyle=e.borderColor,function(t,e,i,n,o){const{fullCircles:s,startAngle:r,circumference:a}=e;let l=e.endAngle;if(s){eE(t,e,i,n,l,o);for(let e=0;e<s;++e)t.fill();isNaN(a)||(l=r+(a%P_||P_))}eE(t,e,i,n,l,o),t.fill()}(t,this,a,o,s),iE(t,this,a,o,s),t.restore()}}function oE(t,e,i=e){t.lineCap=u_(i.borderCapStyle,e.borderCapStyle),t.setLineDash(u_(i.borderDash,e.borderDash)),t.lineDashOffset=u_(i.borderDashOffset,e.borderDashOffset),t.lineJoin=u_(i.borderJoinStyle,e.borderJoinStyle),t.lineWidth=u_(i.borderWidth,e.borderWidth),t.strokeStyle=u_(i.borderColor,e.borderColor)}function sE(t,e,i){t.lineTo(i.x,i.y)}function rE(t,e,i={}){const n=t.length,{start:o=0,end:s=n-1}=i,{start:r,end:a}=e,l=Math.max(o,r),c=Math.min(s,a),h=o<r&&s<r||o>a&&s>a;return{count:n,start:l,loop:e.loop,ilen:c<l&&!h?n+c-l:c-l}}function aE(t,e,i,n){const{points:o,options:s}=e,{count:r,start:a,loop:l,ilen:c}=rE(o,i,n),h=function(t){return t.stepped?jw:t.tension||"monotone"===t.cubicInterpolationMode?Bw:sE}(s);let d,u,p,{move:m=!0,reverse:g}=n||{};for(d=0;d<=c;++d)u=o[(a+(g?c-d:d))%r],u.skip||(m?(t.moveTo(u.x,u.y),m=!1):h(t,p,u,g,s.stepped),p=u);return l&&(u=o[(a+(g?c:0))%r],h(t,p,u,g,s.stepped)),!!l}function lE(t,e,i,n){const o=e.points,{count:s,start:r,ilen:a}=rE(o,i,n),{move:l=!0,reverse:c}=n||{};let h,d,u,p,m,g,f=0,v=0;const y=t=>(r+(c?a-t:t))%s,b=()=>{p!==m&&(t.lineTo(f,m),t.lineTo(f,p),t.lineTo(f,g))};for(l&&(d=o[y(0)],t.moveTo(d.x,d.y)),h=0;h<=a;++h){if(d=o[y(h)],d.skip)continue;const e=d.x,i=d.y,n=0|e;n===u?(i<p?p=i:i>m&&(m=i),f=(v*f+e)/++v):(b(),t.lineTo(e,i),u=n,v=0,p=m=i),g=i}b()}function cE(t){const e=t.options,i=e.borderDash&&e.borderDash.length;return!(t._decimated||t._loop||e.tension||"monotone"===e.cubicInterpolationMode||e.stepped||i)?lE:aE}const hE="function"==typeof Path2D;function dE(t,e,i,n){hE&&!e.options.segment?function(t,e,i,n){let o=e._path;o||(o=e._path=new Path2D,e.path(o,i,n)&&o.closePath()),oE(t,e.options),t.stroke(o)}(t,e,i,n):function(t,e,i,n){const{segments:o,options:s}=e,r=cE(e);for(const a of o)oE(t,s,a.style),t.beginPath(),r(t,e,a,{start:i,end:i+n-1})&&t.closePath(),t.stroke()}(t,e,i,n)}class uE extends hS{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:t=>"borderDash"!==t&&"fill"!==t};constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){const i=this.options;if((i.tension||"monotone"===i.cubicInterpolationMode)&&!i.stepped&&!this._pointsUpdated){const n=i.spanGaps?this._loop:this._fullLoop;wk(this._points,i,t,n,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=function(t,e){const i=t.points,n=t.options.spanGaps,o=i.length;if(!o)return[];const s=!!t._loop,{start:r,end:a}=function(t,e,i,n){let o=0,s=e-1;if(i&&!n)for(;o<e&&!t[o].skip;)o++;for(;o<e&&t[o].skip;)o++;for(o%=e,i&&(s+=o);s>o&&t[s%e].skip;)s--;return s%=e,{start:o,end:s}}(i,o,s,n);return Wk(t,!0===n?[{start:r,end:a,loop:s}]:function(t,e,i,n){const o=t.length,s=[];let r,a=e,l=t[e];for(r=e+1;r<=i;++r){const i=t[r%o];i.skip||i.stop?l.skip||(n=!1,s.push({start:e%o,end:(r-1)%o,loop:n}),e=a=i.stop?r:null):(a=r,l.skip&&(e=r)),l=i}return null!==a&&s.push({start:e%o,end:a%o,loop:n}),s}(i,r,a<r?a+o:a,!!t._fullLoop&&0===r&&a===o-1),i,e)}(this,this.options.segment))}first(){const t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){const t=this.segments,e=this.points,i=t.length;return i&&e[t[i-1].end]}interpolate(t,e){const i=this.options,n=t[e],o=this.points,s=Uk(this,{property:e,start:n,end:n});if(!s.length)return;const r=[],a=function(t){return t.stepped?Rk:t.tension||"monotone"===t.cubicInterpolationMode?Nk:zk}(i);let l,c;for(l=0,c=s.length;l<c;++l){const{start:c,end:h}=s[l],d=o[c],u=o[h];if(d===u){r.push(d);continue}const p=a(d,u,Math.abs((n-d[e])/(u[e]-d[e])),i.stepped);p[e]=t[e],r.push(p)}return 1===r.length?r[0]:r}pathSegment(t,e,i){return cE(this)(t,this,e,i)}path(t,e,i){const n=this.segments,o=cE(this);let s=this._loop;e=e||0,i=i||this.points.length-e;for(const r of n)s&=o(t,this,r,{start:e,end:e+i-1});return!!s}draw(t,e,i,n){const o=this.options||{};(this.points||[]).length&&o.borderWidth&&(t.save(),dE(t,this,i,n),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}function pE(t,e,i,n){const o=t.options,{[i]:s}=t.getProps([i],n);return Math.abs(e-s)<o.radius+o.hitRadius}class mE extends hS{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(t){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,t&&Object.assign(this,t)}inRange(t,e,i){const n=this.options,{x:o,y:s}=this.getProps(["x","y"],i);return Math.pow(t-o,2)+Math.pow(e-s,2)<Math.pow(n.hitRadius+n.radius,2)}inXRange(t,e){return pE(this,t,"x",e)}inYRange(t,e){return pE(this,t,"y",e)}getCenterPoint(t){const{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}size(t){let e=(t=t||this.options||{}).radius||0;e=Math.max(e,e&&t.hoverRadius||0);return 2*(e+(e&&t.borderWidth||0))}draw(t,e){const i=this.options;this.skip||i.radius<.1||!zw(this,e,this.size(i)/2)||(t.strokeStyle=i.borderColor,t.lineWidth=i.borderWidth,t.fillStyle=i.backgroundColor,$w(t,i,this.x,this.y))}getRange(){const t=this.options||{};return t.radius+t.hitRadius}}function gE(t,e){const{x:i,y:n,base:o,width:s,height:r}=t.getProps(["x","y","base","width","height"],e);let a,l,c,h,d;return t.horizontal?(d=r/2,a=Math.min(i,o),l=Math.max(i,o),c=n-d,h=n+d):(d=s/2,a=i-d,l=i+d,c=Math.min(n,o),h=Math.max(n,o)),{left:a,top:c,right:l,bottom:h}}function fE(t,e,i,n){return t?0:K_(e,i,n)}function vE(t){const e=gE(t),i=e.right-e.left,n=e.bottom-e.top,o=function(t,e,i){const n=t.options.borderWidth,o=t.borderSkipped,s=Xw(n);return{t:fE(o.top,s.top,0,i),r:fE(o.right,s.right,0,e),b:fE(o.bottom,s.bottom,0,i),l:fE(o.left,s.left,0,e)}}(t,i/2,n/2),s=function(t,e,i){const{enableBorderRadius:n}=t.getProps(["enableBorderRadius"]),o=t.options.borderRadius,s=Kw(o),r=Math.min(e,i),a=t.borderSkipped,l=n||c_(o);return{topLeft:fE(!l||a.top||a.left,s.topLeft,0,r),topRight:fE(!l||a.top||a.right,s.topRight,0,r),bottomLeft:fE(!l||a.bottom||a.left,s.bottomLeft,0,r),bottomRight:fE(!l||a.bottom||a.right,s.bottomRight,0,r)}}(t,i/2,n/2);return{outer:{x:e.left,y:e.top,w:i,h:n,radius:s},inner:{x:e.left+o.l,y:e.top+o.t,w:i-o.l-o.r,h:n-o.t-o.b,radius:{topLeft:Math.max(0,s.topLeft-Math.max(o.t,o.l)),topRight:Math.max(0,s.topRight-Math.max(o.t,o.r)),bottomLeft:Math.max(0,s.bottomLeft-Math.max(o.b,o.l)),bottomRight:Math.max(0,s.bottomRight-Math.max(o.b,o.r))}}}}function yE(t,e,i,n){const o=null===e,s=null===i,r=t&&!(o&&s)&&gE(t,n);return r&&(o||Q_(e,r.left,r.right))&&(s||Q_(i,r.top,r.bottom))}function bE(t,e){t.rect(e.x,e.y,e.w,e.h)}function xE(t,e,i={}){const n=t.x!==i.x?-e:0,o=t.y!==i.y?-e:0,s=(t.x+t.w!==i.x+i.w?e:0)-n,r=(t.y+t.h!==i.y+i.h?e:0)-o;return{x:t.x+n,y:t.y+o,w:t.w+s,h:t.h+r,radius:t.radius}}class _E extends hS{static id="bar";static defaults={borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,t&&Object.assign(this,t)}draw(t){const{inflateAmount:e,options:{borderColor:i,backgroundColor:n}}=this,{inner:o,outer:s}=vE(this),r=(a=s.radius).topLeft||a.topRight||a.bottomLeft||a.bottomRight?Hw:bE;var a;t.save(),s.w===o.w&&s.h===o.h||(t.beginPath(),r(t,xE(s,e,o)),t.clip(),r(t,xE(o,-e,s)),t.fillStyle=i,t.fill("evenodd")),t.beginPath(),r(t,xE(o,e)),t.fillStyle=n,t.fill(),t.restore()}inRange(t,e,i){return yE(this,t,e,i)}inXRange(t,e){return yE(this,t,null,e)}inYRange(t,e){return yE(this,null,t,e)}getCenterPoint(t){const{x:e,y:i,base:n,horizontal:o}=this.getProps(["x","y","base","horizontal"],t);return{x:o?(e+n)/2:e,y:o?i:(i+n)/2}}getRange(t){return"x"===t?this.width/2:this.height/2}}var wE=Object.freeze({__proto__:null,ArcElement:nE,BarElement:_E,LineElement:uE,PointElement:mE});const kE=["rgb(54, 162, 235)","rgb(255, 99, 132)","rgb(255, 159, 64)","rgb(255, 205, 86)","rgb(75, 192, 192)","rgb(153, 102, 255)","rgb(201, 203, 207)"],CE=kE.map((t=>t.replace("rgb(","rgba(").replace(")",", 0.5)")));function SE(t){return kE[t%kE.length]}function EE(t){return CE[t%CE.length]}function AE(t){let e=0;return(i,n)=>{const o=t.getDatasetMeta(n).controller;o instanceof _C?e=function(t,e){return t.backgroundColor=t.data.map((()=>SE(e++))),e}(i,e):o instanceof wC?e=function(t,e){return t.backgroundColor=t.data.map((()=>EE(e++))),e}(i,e):o&&(e=function(t,e){return t.borderColor=SE(e),t.backgroundColor=EE(e),++e}(i,e))}}function ME(t){let e;for(e in t)if(t[e].borderColor||t[e].backgroundColor)return!0;return!1}var TE={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(t,e,i){if(!i.enabled)return;const{data:{datasets:n},options:o}=t.config,{elements:s}=o,r=ME(n)||(a=o)&&(a.borderColor||a.backgroundColor)||s&&ME(s)||"rgba(0,0,0,0.1)"!==Tw.borderColor||"rgba(0,0,0,0.1)"!==Tw.backgroundColor;var a;if(!i.forceOverride&&r)return;const l=AE(t);n.forEach(l)}};function PE(t){if(t._decimated){const e=t._data;delete t._decimated,delete t._data,Object.defineProperty(t,"data",{configurable:!0,enumerable:!0,writable:!0,value:e})}}function DE(t){t.data.datasets.forEach((t=>{PE(t)}))}var IE={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(t,e,i)=>{if(!i.enabled)return void DE(t);const n=t.width;t.data.datasets.forEach(((e,o)=>{const{_data:s,indexAxis:r}=e,a=t.getDatasetMeta(o),l=s||e.data;if("y"===tk([r,t.options.indexAxis]))return;if(!a.controller.supportsDecimation)return;const c=t.scales[a.xAxisID];if("linear"!==c.type&&"time"!==c.type)return;if(t.options.parsing)return;let{start:h,count:d}=function(t,e){const i=e.length;let n,o=0;const{iScale:s}=t,{min:r,max:a,minDefined:l,maxDefined:c}=s.getUserBounds();return l&&(o=K_(tw(e,s.axis,r).lo,0,i-1)),n=c?K_(tw(e,s.axis,a).hi+1,o,i)-o:i-o,{start:o,count:n}}(a,l);if(d<=(i.threshold||4*n))return void PE(e);let u;switch(a_(s)&&(e._data=l,delete e.data,Object.defineProperty(e,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(t){this._data=t}})),i.algorithm){case"lttb":u=function(t,e,i,n,o){const s=o.samples||n;if(s>=i)return t.slice(e,e+i);const r=[],a=(i-2)/(s-2);let l=0;const c=e+i-1;let h,d,u,p,m,g=e;for(r[l++]=t[g],h=0;h<s-2;h++){let n,o=0,s=0;const c=Math.floor((h+1)*a)+1+e,f=Math.min(Math.floor((h+2)*a)+1,i)+e,v=f-c;for(n=c;n<f;n++)o+=t[n].x,s+=t[n].y;o/=v,s/=v;const y=Math.floor(h*a)+1+e,b=Math.min(Math.floor((h+1)*a)+1,i)+e,{x:x,y:_}=t[g];for(u=p=-1,n=y;n<b;n++)p=.5*Math.abs((x-o)*(t[n].y-_)-(x-t[n].x)*(s-_)),p>u&&(u=p,d=t[n],m=n);r[l++]=d,g=m}return r[l++]=t[c],r}(l,h,d,n,i);break;case"min-max":u=function(t,e,i,n){let o,s,r,a,l,c,h,d,u,p,m=0,g=0;const f=[],v=e+i-1,y=t[e].x,b=t[v].x-y;for(o=e;o<e+i;++o){s=t[o],r=(s.x-y)/b*n,a=s.y;const e=0|r;if(e===l)a<u?(u=a,c=o):a>p&&(p=a,h=o),m=(g*m+s.x)/++g;else{const i=o-1;if(!a_(c)&&!a_(h)){const e=Math.min(c,h),n=Math.max(c,h);e!==d&&e!==i&&f.push({...t[e],x:m}),n!==d&&n!==i&&f.push({...t[n],x:m})}o>0&&i!==d&&f.push(t[i]),f.push(s),l=e,g=0,u=p=a,c=h=d=o}}return f}(l,h,d,n);break;default:throw new Error(`Unsupported decimation algorithm '${i.algorithm}'`)}e._decimated=u}))},destroy(t){DE(t)}};function OE(t,e,i,n){if(n)return;let o=e[t],s=i[t];return"angle"===t&&(o=Y_(o),s=Y_(s)),{property:t,start:o,end:s}}function $E(t,e,i){for(;e>t;e--){const t=i[e];if(!isNaN(t.x)&&!isNaN(t.y))break}return e}function LE(t,e,i,n){return t&&e?n(t[i],e[i]):t?t[i]:e?e[i]:0}function zE(t,e){let i=[],n=!1;return l_(t)?(n=!0,i=t):i=function(t,e){const{x:i=null,y:n=null}=t||{},o=e.points,s=[];return e.segments.forEach((({start:t,end:e})=>{e=$E(t,e,o);const r=o[t],a=o[e];null!==n?(s.push({x:r.x,y:n}),s.push({x:a.x,y:n})):null!==i&&(s.push({x:i,y:r.y}),s.push({x:i,y:a.y}))})),s}(t,e),i.length?new uE({points:i,options:{tension:0},_loop:n,_fullLoop:n}):null}function RE(t){return t&&!1!==t.fill}function NE(t,e,i){let n=t[e].fill;const o=[e];let s;if(!i)return n;for(;!1!==n&&-1===o.indexOf(n);){if(!h_(n))return n;if(s=t[n],!s)return!1;if(s.visible)return n;o.push(n),n=s.fill}return!1}function jE(t,e,i){const n=function(t){const e=t.options,i=e.fill;let n=u_(i&&i.target,i);void 0===n&&(n=!!e.backgroundColor);if(!1===n||null===n)return!1;if(!0===n)return"origin";return n}(t);if(c_(n))return!isNaN(n.value)&&n;let o=parseFloat(n);return h_(o)&&Math.floor(o)===o?function(t,e,i,n){"-"!==t&&"+"!==t||(i=e+i);if(i===e||i<0||i>=n)return!1;return i}(n[0],e,o,i):["origin","start","end","stack","shape"].indexOf(n)>=0&&n}function BE(t,e,i){const n=[];for(let o=0;o<i.length;o++){const s=i[o],{first:r,last:a,point:l}=FE(s,e,"x");if(!(!l||r&&a))if(r)n.unshift(l);else if(t.push(l),!a)break}t.push(...n)}function FE(t,e,i){const n=t.interpolate(e,i);if(!n)return{};const o=n[i],s=t.segments,r=t.points;let a=!1,l=!1;for(let t=0;t<s.length;t++){const e=s[t],n=r[e.start][i],c=r[e.end][i];if(Q_(o,n,c)){a=o===n,l=o===c;break}}return{first:a,last:l,point:n}}class qE{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,e,i){const{x:n,y:o,radius:s}=this;return e=e||{start:0,end:P_},t.arc(n,o,s,e.end,e.start,!0),!i.bounds}interpolate(t){const{x:e,y:i,radius:n}=this,o=t.angle;return{x:e+Math.cos(o)*n,y:i+Math.sin(o)*n,angle:o}}}function VE(t){const{chart:e,fill:i,line:n}=t;if(h_(i))return function(t,e){const i=t.getDatasetMeta(e),n=i&&t.isDatasetVisible(e);return n?i.dataset:null}(e,i);if("stack"===i)return function(t){const{scale:e,index:i,line:n}=t,o=[],s=n.segments,r=n.points,a=function(t,e){const i=[],n=t.getMatchingVisibleMetas("line");for(let t=0;t<n.length;t++){const o=n[t];if(o.index===e)break;o.hidden||i.unshift(o.dataset)}return i}(e,i);a.push(zE({x:null,y:e.bottom},n));for(let t=0;t<s.length;t++){const e=s[t];for(let t=e.start;t<=e.end;t++)BE(o,r[t],a)}return new uE({points:o,options:{}})}(t);if("shape"===i)return!0;const o=function(t){const e=t.scale||{};if(e.getPointPositionForValue)return function(t){const{scale:e,fill:i}=t,n=e.options,o=e.getLabels().length,s=n.reverse?e.max:e.min,r=function(t,e,i){let n;return n="start"===t?i:"end"===t?e.options.reverse?e.min:e.max:c_(t)?t.value:e.getBaseValue(),n}(i,e,s),a=[];if(n.grid.circular){const t=e.getPointPositionForValue(0,s);return new qE({x:t.x,y:t.y,radius:e.getDistanceFromCenterForValue(r)})}for(let t=0;t<o;++t)a.push(e.getPointPositionForValue(t,r));return a}(t);return function(t){const{scale:e={},fill:i}=t,n=function(t,e){let i=null;return"start"===t?i=e.bottom:"end"===t?i=e.top:c_(t)?i=e.getPixelForValue(t.value):e.getBasePixel&&(i=e.getBasePixel()),i}(i,e);if(h_(n)){const t=e.isHorizontal();return{x:t?n:null,y:t?null:n}}return null}(t)}(t);return o instanceof qE?o:zE(o,n)}function HE(t,e,i){const n=VE(e),{line:o,scale:s,axis:r}=e,a=o.options,l=a.fill,c=a.backgroundColor,{above:h=c,below:d=c}=l||{};n&&o.points.length&&(Rw(t,i),function(t,e){const{line:i,target:n,above:o,below:s,area:r,scale:a}=e,l=i._loop?"angle":e.axis;t.save(),"x"===l&&s!==o&&(UE(t,n,r.top),WE(t,{line:i,target:n,color:o,scale:a,property:l}),t.restore(),t.save(),UE(t,n,r.bottom));WE(t,{line:i,target:n,color:s,scale:a,property:l}),t.restore()}(t,{line:o,target:n,above:h,below:d,area:i,scale:s,axis:r}),Nw(t))}function UE(t,e,i){const{segments:n,points:o}=e;let s=!0,r=!1;t.beginPath();for(const a of n){const{start:n,end:l}=a,c=o[n],h=o[$E(n,l,o)];s?(t.moveTo(c.x,c.y),s=!1):(t.lineTo(c.x,i),t.lineTo(c.x,c.y)),r=!!e.pathSegment(t,a,{move:r}),r?t.closePath():t.lineTo(h.x,i)}t.lineTo(e.first().x,i),t.closePath(),t.clip()}function WE(t,e){const{line:i,target:n,property:o,color:s,scale:r}=e,a=function(t,e,i){const n=t.segments,o=t.points,s=e.points,r=[];for(const t of n){let{start:n,end:a}=t;a=$E(n,a,o);const l=OE(i,o[n],o[a],t.loop);if(!e.segments){r.push({source:t,target:l,start:o[n],end:o[a]});continue}const c=Uk(e,l);for(const e of c){const n=OE(i,s[e.start],s[e.end],e.loop),a=Hk(t,o,n);for(const t of a)r.push({source:t,target:e,start:{[i]:LE(l,n,"start",Math.max)},end:{[i]:LE(l,n,"end",Math.min)}})}}return r}(i,n,o);for(const{source:e,target:l,start:c,end:h}of a){const{style:{backgroundColor:a=s}={}}=e,d=!0!==n;t.save(),t.fillStyle=a,GE(t,r,d&&OE(o,c,h)),t.beginPath();const u=!!i.pathSegment(t,e);let p;if(d){u?t.closePath():ZE(t,n,h,o);const e=!!n.pathSegment(t,l,{move:u,reverse:!0});p=u&&e,p||ZE(t,n,c,o)}t.closePath(),t.fill(p?"evenodd":"nonzero"),t.restore()}}function GE(t,e,i){const{top:n,bottom:o}=e.chart.chartArea,{property:s,start:r,end:a}=i||{};"x"===s&&(t.beginPath(),t.rect(r,n,a-r,o-n),t.clip())}function ZE(t,e,i,n){const o=e.interpolate(i,n);o&&t.lineTo(o.x,o.y)}var YE={id:"filler",afterDatasetsUpdate(t,e,i){const n=(t.data.datasets||[]).length,o=[];let s,r,a,l;for(r=0;r<n;++r)s=t.getDatasetMeta(r),a=s.dataset,l=null,a&&a.options&&a instanceof uE&&(l={visible:t.isDatasetVisible(r),index:r,fill:jE(a,r,n),chart:t,axis:s.controller.options.indexAxis,scale:s.vScale,line:a}),s.$filler=l,o.push(l);for(r=0;r<n;++r)l=o[r],l&&!1!==l.fill&&(l.fill=NE(o,r,i.propagate))},beforeDraw(t,e,i){const n="beforeDraw"===i.drawTime,o=t.getSortedVisibleDatasetMetas(),s=t.chartArea;for(let e=o.length-1;e>=0;--e){const i=o[e].$filler;i&&(i.line.updateControlPoints(s,i.axis),n&&i.fill&&HE(t.ctx,i,s))}},beforeDatasetsDraw(t,e,i){if("beforeDatasetsDraw"!==i.drawTime)return;const n=t.getSortedVisibleDatasetMetas();for(let e=n.length-1;e>=0;--e){const i=n[e].$filler;RE(i)&&HE(t.ctx,i,t.chartArea)}},beforeDatasetDraw(t,e,i){const n=e.meta.$filler;RE(n)&&"beforeDatasetDraw"===i.drawTime&&HE(t.ctx,n,t.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const XE=(t,e)=>{let{boxHeight:i=e,boxWidth:n=e}=t;return t.usePointStyle&&(i=Math.min(i,e),n=t.pointStyleWidth||Math.min(n,e)),{boxWidth:n,boxHeight:i,itemHeight:Math.max(e,i)}};class KE extends hS{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,i){this.maxWidth=t,this.maxHeight=e,this._margins=i,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let e=m_(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter((e=>t.filter(e,this.chart.data)))),t.sort&&(e=e.sort(((e,i)=>t.sort(e,i,this.chart.data)))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){const{options:t,ctx:e}=this;if(!t.display)return void(this.width=this.height=0);const i=t.labels,n=Jw(i.font),o=n.size,s=this._computeTitleHeight(),{boxWidth:r,itemHeight:a}=XE(i,o);let l,c;e.font=n.string,this.isHorizontal()?(l=this.maxWidth,c=this._fitRows(s,o,r,a)+10):(c=this.maxHeight,l=this._fitCols(s,n,r,a)+10),this.width=Math.min(l,t.maxWidth||this.maxWidth),this.height=Math.min(c,t.maxHeight||this.maxHeight)}_fitRows(t,e,i,n){const{ctx:o,maxWidth:s,options:{labels:{padding:r}}}=this,a=this.legendHitBoxes=[],l=this.lineWidths=[0],c=n+r;let h=t;o.textAlign="left",o.textBaseline="middle";let d=-1,u=-c;return this.legendItems.forEach(((t,p)=>{const m=i+e/2+o.measureText(t.text).width;(0===p||l[l.length-1]+m+2*r>s)&&(h+=c,l[l.length-(p>0?0:1)]=0,u+=c,d++),a[p]={left:0,top:u,row:d,width:m,height:n},l[l.length-1]+=m+r})),h}_fitCols(t,e,i,n){const{ctx:o,maxHeight:s,options:{labels:{padding:r}}}=this,a=this.legendHitBoxes=[],l=this.columnSizes=[],c=s-t;let h=r,d=0,u=0,p=0,m=0;return this.legendItems.forEach(((t,s)=>{const{itemWidth:g,itemHeight:f}=function(t,e,i,n,o){const s=function(t,e,i,n){let o=t.text;o&&"string"!=typeof o&&(o=o.reduce(((t,e)=>t.length>e.length?t:e)));return e+i.size/2+n.measureText(o).width}(n,t,e,i),r=function(t,e,i){let n=t;"string"!=typeof e.text&&(n=QE(e,i));return n}(o,n,e.lineHeight);return{itemWidth:s,itemHeight:r}}(i,e,o,t,n);s>0&&u+f+2*r>c&&(h+=d+r,l.push({width:d,height:u}),p+=d+r,m++,d=u=0),a[s]={left:p,top:u,col:m,width:g,height:f},d=Math.max(d,g),u+=f+r})),h+=d,l.push({width:d,height:u}),h}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:i,labels:{padding:n},rtl:o}}=this,s=jk(o,this.left,this.width);if(this.isHorizontal()){let o=0,r=lw(i,this.left+n,this.right-this.lineWidths[o]);for(const a of e)o!==a.row&&(o=a.row,r=lw(i,this.left+n,this.right-this.lineWidths[o])),a.top+=this.top+t+n,a.left=s.leftForLtr(s.x(r),a.width),r+=a.width+n}else{let o=0,r=lw(i,this.top+t+n,this.bottom-this.columnSizes[o].height);for(const a of e)a.col!==o&&(o=a.col,r=lw(i,this.top+t+n,this.bottom-this.columnSizes[o].height)),a.top=r,a.left+=this.left+n,a.left=s.leftForLtr(s.x(a.left),a.width),r+=a.height+n}}isHorizontal(){return"top"===this.options.position||"bottom"===this.options.position}draw(){if(this.options.display){const t=this.ctx;Rw(t,this),this._draw(),Nw(t)}}_draw(){const{options:t,columnSizes:e,lineWidths:i,ctx:n}=this,{align:o,labels:s}=t,r=Tw.color,a=jk(t.rtl,this.left,this.width),l=Jw(s.font),{padding:c}=s,h=l.size,d=h/2;let u;this.drawTitle(),n.textAlign=a.textAlign("left"),n.textBaseline="middle",n.lineWidth=.5,n.font=l.string;const{boxWidth:p,boxHeight:m,itemHeight:g}=XE(s,h),f=this.isHorizontal(),v=this._computeTitleHeight();u=f?{x:lw(o,this.left+c,this.right-i[0]),y:this.top+c+v,line:0}:{x:this.left+c,y:lw(o,this.top+v+c,this.bottom-e[0].height),line:0},Bk(this.ctx,t.textDirection);const y=g+c;this.legendItems.forEach(((b,x)=>{n.strokeStyle=b.fontColor,n.fillStyle=b.fontColor;const _=n.measureText(b.text).width,w=a.textAlign(b.textAlign||(b.textAlign=s.textAlign)),k=p+d+_;let C=u.x,S=u.y;a.setWidth(this.width),f?x>0&&C+k+c>this.right&&(S=u.y+=y,u.line++,C=u.x=lw(o,this.left+c,this.right-i[u.line])):x>0&&S+y>this.bottom&&(C=u.x=C+e[u.line].width+c,u.line++,S=u.y=lw(o,this.top+v+c,this.bottom-e[u.line].height));if(function(t,e,i){if(isNaN(p)||p<=0||isNaN(m)||m<0)return;n.save();const o=u_(i.lineWidth,1);if(n.fillStyle=u_(i.fillStyle,r),n.lineCap=u_(i.lineCap,"butt"),n.lineDashOffset=u_(i.lineDashOffset,0),n.lineJoin=u_(i.lineJoin,"miter"),n.lineWidth=o,n.strokeStyle=u_(i.strokeStyle,r),n.setLineDash(u_(i.lineDash,[])),s.usePointStyle){const r={radius:m*Math.SQRT2/2,pointStyle:i.pointStyle,rotation:i.rotation,borderWidth:o},l=a.xPlus(t,p/2);Lw(n,r,l,e+d,s.pointStyleWidth&&p)}else{const s=e+Math.max((h-m)/2,0),r=a.leftForLtr(t,p),l=Kw(i.borderRadius);n.beginPath(),Object.values(l).some((t=>0!==t))?Hw(n,{x:r,y:s,w:p,h:m,radius:l}):n.rect(r,s,p,m),n.fill(),0!==o&&n.stroke()}n.restore()}(a.x(C),S,b),C=((t,e,i,n)=>t===(n?"left":"right")?i:"center"===t?(e+i)/2:e)(w,C+p+d,f?C+k:this.right,t.rtl),function(t,e,i){Vw(n,i.text,t,e+g/2,l,{strikethrough:i.hidden,textAlign:a.textAlign(i.textAlign)})}(a.x(C),S,b),f)u.x+=k+c;else if("string"!=typeof b.text){const t=l.lineHeight;u.y+=QE(b,t)+c}else u.y+=y})),Fk(this.ctx,t.textDirection)}drawTitle(){const t=this.options,e=t.title,i=Jw(e.font),n=Qw(e.padding);if(!e.display)return;const o=jk(t.rtl,this.left,this.width),s=this.ctx,r=e.position,a=i.size/2,l=n.top+a;let c,h=this.left,d=this.width;if(this.isHorizontal())d=Math.max(...this.lineWidths),c=this.top+l,h=lw(t.align,h,this.right-d);else{const e=this.columnSizes.reduce(((t,e)=>Math.max(t,e.height)),0);c=l+lw(t.align,this.top,this.bottom-e-t.labels.padding-this._computeTitleHeight())}const u=lw(r,h,h+d);s.textAlign=o.textAlign(aw(r)),s.textBaseline="middle",s.strokeStyle=e.color,s.fillStyle=e.color,s.font=i.string,Vw(s,e.text,u,c,i)}_computeTitleHeight(){const t=this.options.title,e=Jw(t.font),i=Qw(t.padding);return t.display?e.lineHeight+i.height:0}_getLegendItemAt(t,e){let i,n,o;if(Q_(t,this.left,this.right)&&Q_(e,this.top,this.bottom))for(o=this.legendHitBoxes,i=0;i<o.length;++i)if(n=o[i],Q_(t,n.left,n.left+n.width)&&Q_(e,n.top,n.top+n.height))return this.legendItems[i];return null}handleEvent(t){const e=this.options;if(!function(t,e){if(("mousemove"===t||"mouseout"===t)&&(e.onHover||e.onLeave))return!0;if(e.onClick&&("click"===t||"mouseup"===t))return!0;return!1}(t.type,e))return;const i=this._getLegendItemAt(t.x,t.y);if("mousemove"===t.type||"mouseout"===t.type){const n=this._hoveredItem,o=((t,e)=>null!==t&&null!==e&&t.datasetIndex===e.datasetIndex&&t.index===e.index)(n,i);n&&!o&&m_(e.onLeave,[t,n,this],this),this._hoveredItem=i,i&&!o&&m_(e.onHover,[t,i,this],this)}else i&&m_(e.onClick,[t,i,this],this)}}function QE(t,e){return e*(t.text?t.text.length:0)}var JE={id:"legend",_element:KE,start(t,e,i){const n=t.legend=new KE({ctx:t.ctx,options:i,chart:t});WC.configure(t,n,i),WC.addBox(t,n)},stop(t){WC.removeBox(t,t.legend),delete t.legend},beforeUpdate(t,e,i){const n=t.legend;WC.configure(t,n,i),n.options=i},afterUpdate(t){const e=t.legend;e.buildLabels(),e.adjustHitBoxes()},afterEvent(t,e){e.replay||t.legend.handleEvent(e.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(t,e,i){const n=e.datasetIndex,o=i.chart;o.isDatasetVisible(n)?(o.hide(n),e.hidden=!0):(o.show(n),e.hidden=!1)},onHover:null,onLeave:null,labels:{color:t=>t.chart.options.color,boxWidth:40,padding:10,generateLabels(t){const e=t.data.datasets,{labels:{usePointStyle:i,pointStyle:n,textAlign:o,color:s,useBorderRadius:r,borderRadius:a}}=t.legend.options;return t._getSortedDatasetMetas().map((t=>{const l=t.controller.getStyle(i?0:void 0),c=Qw(l.borderWidth);return{text:e[t.index].label,fillStyle:l.backgroundColor,fontColor:s,hidden:!t.visible,lineCap:l.borderCapStyle,lineDash:l.borderDash,lineDashOffset:l.borderDashOffset,lineJoin:l.borderJoinStyle,lineWidth:(c.width+c.height)/4,strokeStyle:l.borderColor,pointStyle:n||l.pointStyle,rotation:l.rotation,textAlign:o||l.textAlign,borderRadius:r&&(a||l.borderRadius),datasetIndex:t.index}}),this)}},title:{color:t=>t.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:t=>!t.startsWith("on"),labels:{_scriptable:t=>!["generateLabels","filter","sort"].includes(t)}}};class tA extends hS{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e){const i=this.options;if(this.left=0,this.top=0,!i.display)return void(this.width=this.height=this.right=this.bottom=0);this.width=this.right=t,this.height=this.bottom=e;const n=l_(i.text)?i.text.length:1;this._padding=Qw(i.padding);const o=n*Jw(i.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){const t=this.options.position;return"top"===t||"bottom"===t}_drawArgs(t){const{top:e,left:i,bottom:n,right:o,options:s}=this,r=s.align;let a,l,c,h=0;return this.isHorizontal()?(l=lw(r,i,o),c=e+t,a=o-i):("left"===s.position?(l=i+t,c=lw(r,n,e),h=-.5*T_):(l=o-t,c=lw(r,e,n),h=.5*T_),a=n-e),{titleX:l,titleY:c,maxWidth:a,rotation:h}}draw(){const t=this.ctx,e=this.options;if(!e.display)return;const i=Jw(e.font),n=i.lineHeight/2+this._padding.top,{titleX:o,titleY:s,maxWidth:r,rotation:a}=this._drawArgs(n);Vw(t,e.text,0,0,i,{color:e.color,maxWidth:r,rotation:a,textAlign:aw(e.align),textBaseline:"middle",translation:[o,s]})}}var eA={id:"title",_element:tA,start(t,e,i){!function(t,e){const i=new tA({ctx:t.ctx,options:e,chart:t});WC.configure(t,i,e),WC.addBox(t,i),t.titleBlock=i}(t,i)},stop(t){const e=t.titleBlock;WC.removeBox(t,e),delete t.titleBlock},beforeUpdate(t,e,i){const n=t.titleBlock;WC.configure(t,n,i),n.options=i},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const iA=new WeakMap;var nA={id:"subtitle",start(t,e,i){const n=new tA({ctx:t.ctx,options:i,chart:t});WC.configure(t,n,i),WC.addBox(t,n),iA.set(t,n)},stop(t){WC.removeBox(t,iA.get(t)),iA.delete(t)},beforeUpdate(t,e,i){const n=iA.get(t);WC.configure(t,n,i),n.options=i},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const oA={average(t){if(!t.length)return!1;let e,i,n=new Set,o=0,s=0;for(e=0,i=t.length;e<i;++e){const i=t[e].element;if(i&&i.hasValue()){const t=i.tooltipPosition();n.add(t.x),o+=t.y,++s}}if(0===s||0===n.size)return!1;const r=[...n].reduce(((t,e)=>t+e))/n.size;return{x:r,y:o/s}},nearest(t,e){if(!t.length)return!1;let i,n,o,s=e.x,r=e.y,a=Number.POSITIVE_INFINITY;for(i=0,n=t.length;i<n;++i){const n=t[i].element;if(n&&n.hasValue()){const t=G_(e,n.getCenterPoint());t<a&&(a=t,o=n)}}if(o){const t=o.tooltipPosition();s=t.x,r=t.y}return{x:s,y:r}}};function sA(t,e){return e&&(l_(e)?Array.prototype.push.apply(t,e):t.push(e)),t}function rA(t){return("string"==typeof t||t instanceof String)&&t.indexOf("\n")>-1?t.split("\n"):t}function aA(t,e){const{element:i,datasetIndex:n,index:o}=e,s=t.getDatasetMeta(n).controller,{label:r,value:a}=s.getLabelAndValue(o);return{chart:t,label:r,parsed:s.getParsed(o),raw:t.data.datasets[n].data[o],formattedValue:a,dataset:s.getDataset(),dataIndex:o,datasetIndex:n,element:i}}function lA(t,e){const i=t.chart.ctx,{body:n,footer:o,title:s}=t,{boxWidth:r,boxHeight:a}=e,l=Jw(e.bodyFont),c=Jw(e.titleFont),h=Jw(e.footerFont),d=s.length,u=o.length,p=n.length,m=Qw(e.padding);let g=m.height,f=0,v=n.reduce(((t,e)=>t+e.before.length+e.lines.length+e.after.length),0);if(v+=t.beforeBody.length+t.afterBody.length,d&&(g+=d*c.lineHeight+(d-1)*e.titleSpacing+e.titleMarginBottom),v){g+=p*(e.displayColors?Math.max(a,l.lineHeight):l.lineHeight)+(v-p)*l.lineHeight+(v-1)*e.bodySpacing}u&&(g+=e.footerMarginTop+u*h.lineHeight+(u-1)*e.footerSpacing);let y=0;const b=function(t){f=Math.max(f,i.measureText(t).width+y)};return i.save(),i.font=c.string,g_(t.title,b),i.font=l.string,g_(t.beforeBody.concat(t.afterBody),b),y=e.displayColors?r+2+e.boxPadding:0,g_(n,(t=>{g_(t.before,b),g_(t.lines,b),g_(t.after,b)})),y=0,i.font=h.string,g_(t.footer,b),i.restore(),f+=m.width,{width:f,height:g}}function cA(t,e,i,n){const{x:o,width:s}=i,{width:r,chartArea:{left:a,right:l}}=t;let c="center";return"center"===n?c=o<=(a+l)/2?"left":"right":o<=s/2?c="left":o>=r-s/2&&(c="right"),function(t,e,i,n){const{x:o,width:s}=n,r=i.caretSize+i.caretPadding;return"left"===t&&o+s+r>e.width||"right"===t&&o-s-r<0||void 0}(c,t,e,i)&&(c="center"),c}function hA(t,e,i){const n=i.yAlign||e.yAlign||function(t,e){const{y:i,height:n}=e;return i<n/2?"top":i>t.height-n/2?"bottom":"center"}(t,i);return{xAlign:i.xAlign||e.xAlign||cA(t,e,i,n),yAlign:n}}function dA(t,e,i,n){const{caretSize:o,caretPadding:s,cornerRadius:r}=t,{xAlign:a,yAlign:l}=i,c=o+s,{topLeft:h,topRight:d,bottomLeft:u,bottomRight:p}=Kw(r);let m=function(t,e){let{x:i,width:n}=t;return"right"===e?i-=n:"center"===e&&(i-=n/2),i}(e,a);const g=function(t,e,i){let{y:n,height:o}=t;return"top"===e?n+=i:n-="bottom"===e?o+i:o/2,n}(e,l,c);return"center"===l?"left"===a?m+=c:"right"===a&&(m-=c):"left"===a?m-=Math.max(h,u)+o:"right"===a&&(m+=Math.max(d,p)+o),{x:K_(m,0,n.width-e.width),y:K_(g,0,n.height-e.height)}}function uA(t,e,i){const n=Qw(i.padding);return"center"===e?t.x+t.width/2:"right"===e?t.x+t.width-n.right:t.x+n.left}function pA(t){return sA([],rA(t))}function mA(t,e){const i=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return i?t.override(i):t}const gA={beforeTitle:s_,title(t){if(t.length>0){const e=t[0],i=e.chart.data.labels,n=i?i.length:0;if(this&&this.options&&"dataset"===this.options.mode)return e.dataset.label||"";if(e.label)return e.label;if(n>0&&e.dataIndex<n)return i[e.dataIndex]}return""},afterTitle:s_,beforeBody:s_,beforeLabel:s_,label(t){if(this&&this.options&&"dataset"===this.options.mode)return t.label+": "+t.formattedValue||t.formattedValue;let e=t.dataset.label||"";e&&(e+=": ");const i=t.formattedValue;return a_(i)||(e+=i),e},labelColor(t){const e=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{borderColor:e.borderColor,backgroundColor:e.backgroundColor,borderWidth:e.borderWidth,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(t){const e=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{pointStyle:e.pointStyle,rotation:e.rotation}},afterLabel:s_,afterBody:s_,beforeFooter:s_,footer:s_,afterFooter:s_};function fA(t,e,i,n){const o=t[e].call(i,n);return void 0===o?gA[e].call(i,n):o}class vA extends hS{static positioners=oA;constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const e=this.chart,i=this.options.setContext(this.getContext()),n=i.enabled&&e.options.animation&&i.animations,o=new tC(this.chart,n);return n._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=(t=this.chart.getContext(),e=this,i=this._tooltipItems,ek(t,{tooltip:e,tooltipItems:i,type:"tooltip"})));var t,e,i}getTitle(t,e){const{callbacks:i}=e,n=fA(i,"beforeTitle",this,t),o=fA(i,"title",this,t),s=fA(i,"afterTitle",this,t);let r=[];return r=sA(r,rA(n)),r=sA(r,rA(o)),r=sA(r,rA(s)),r}getBeforeBody(t,e){return pA(fA(e.callbacks,"beforeBody",this,t))}getBody(t,e){const{callbacks:i}=e,n=[];return g_(t,(t=>{const e={before:[],lines:[],after:[]},o=mA(i,t);sA(e.before,rA(fA(o,"beforeLabel",this,t))),sA(e.lines,fA(o,"label",this,t)),sA(e.after,rA(fA(o,"afterLabel",this,t))),n.push(e)})),n}getAfterBody(t,e){return pA(fA(e.callbacks,"afterBody",this,t))}getFooter(t,e){const{callbacks:i}=e,n=fA(i,"beforeFooter",this,t),o=fA(i,"footer",this,t),s=fA(i,"afterFooter",this,t);let r=[];return r=sA(r,rA(n)),r=sA(r,rA(o)),r=sA(r,rA(s)),r}_createItems(t){const e=this._active,i=this.chart.data,n=[],o=[],s=[];let r,a,l=[];for(r=0,a=e.length;r<a;++r)l.push(aA(this.chart,e[r]));return t.filter&&(l=l.filter(((e,n,o)=>t.filter(e,n,o,i)))),t.itemSort&&(l=l.sort(((e,n)=>t.itemSort(e,n,i)))),g_(l,(e=>{const i=mA(t.callbacks,e);n.push(fA(i,"labelColor",this,e)),o.push(fA(i,"labelPointStyle",this,e)),s.push(fA(i,"labelTextColor",this,e))})),this.labelColors=n,this.labelPointStyles=o,this.labelTextColors=s,this.dataPoints=l,l}update(t,e){const i=this.options.setContext(this.getContext()),n=this._active;let o,s=[];if(n.length){const t=oA[i.position].call(this,n,this._eventPosition);s=this._createItems(i),this.title=this.getTitle(s,i),this.beforeBody=this.getBeforeBody(s,i),this.body=this.getBody(s,i),this.afterBody=this.getAfterBody(s,i),this.footer=this.getFooter(s,i);const e=this._size=lA(this,i),r=Object.assign({},t,e),a=hA(this.chart,i,r),l=dA(i,r,a,this.chart);this.xAlign=a.xAlign,this.yAlign=a.yAlign,o={opacity:1,x:l.x,y:l.y,width:e.width,height:e.height,caretX:t.x,caretY:t.y}}else 0!==this.opacity&&(o={opacity:0});this._tooltipItems=s,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,i,n){const o=this.getCaretPosition(t,i,n);e.lineTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.lineTo(o.x3,o.y3)}getCaretPosition(t,e,i){const{xAlign:n,yAlign:o}=this,{caretSize:s,cornerRadius:r}=i,{topLeft:a,topRight:l,bottomLeft:c,bottomRight:h}=Kw(r),{x:d,y:u}=t,{width:p,height:m}=e;let g,f,v,y,b,x;return"center"===o?(b=u+m/2,"left"===n?(g=d,f=g-s,y=b+s,x=b-s):(g=d+p,f=g+s,y=b-s,x=b+s),v=g):(f="left"===n?d+Math.max(a,c)+s:"right"===n?d+p-Math.max(l,h)-s:this.caretX,"top"===o?(y=u,b=y-s,g=f-s,v=f+s):(y=u+m,b=y+s,g=f+s,v=f-s),x=y),{x1:g,x2:f,x3:v,y1:y,y2:b,y3:x}}drawTitle(t,e,i){const n=this.title,o=n.length;let s,r,a;if(o){const l=jk(i.rtl,this.x,this.width);for(t.x=uA(this,i.titleAlign,i),e.textAlign=l.textAlign(i.titleAlign),e.textBaseline="middle",s=Jw(i.titleFont),r=i.titleSpacing,e.fillStyle=i.titleColor,e.font=s.string,a=0;a<o;++a)e.fillText(n[a],l.x(t.x),t.y+s.lineHeight/2),t.y+=s.lineHeight+r,a+1===o&&(t.y+=i.titleMarginBottom-r)}}_drawColorBox(t,e,i,n,o){const s=this.labelColors[i],r=this.labelPointStyles[i],{boxHeight:a,boxWidth:l}=o,c=Jw(o.bodyFont),h=uA(this,"left",o),d=n.x(h),u=a<c.lineHeight?(c.lineHeight-a)/2:0,p=e.y+u;if(o.usePointStyle){const e={radius:Math.min(l,a)/2,pointStyle:r.pointStyle,rotation:r.rotation,borderWidth:1},i=n.leftForLtr(d,l)+l/2,c=p+a/2;t.strokeStyle=o.multiKeyBackground,t.fillStyle=o.multiKeyBackground,$w(t,e,i,c),t.strokeStyle=s.borderColor,t.fillStyle=s.backgroundColor,$w(t,e,i,c)}else{t.lineWidth=c_(s.borderWidth)?Math.max(...Object.values(s.borderWidth)):s.borderWidth||1,t.strokeStyle=s.borderColor,t.setLineDash(s.borderDash||[]),t.lineDashOffset=s.borderDashOffset||0;const e=n.leftForLtr(d,l),i=n.leftForLtr(n.xPlus(d,1),l-2),r=Kw(s.borderRadius);Object.values(r).some((t=>0!==t))?(t.beginPath(),t.fillStyle=o.multiKeyBackground,Hw(t,{x:e,y:p,w:l,h:a,radius:r}),t.fill(),t.stroke(),t.fillStyle=s.backgroundColor,t.beginPath(),Hw(t,{x:i,y:p+1,w:l-2,h:a-2,radius:r}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(e,p,l,a),t.strokeRect(e,p,l,a),t.fillStyle=s.backgroundColor,t.fillRect(i,p+1,l-2,a-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,e,i){const{body:n}=this,{bodySpacing:o,bodyAlign:s,displayColors:r,boxHeight:a,boxWidth:l,boxPadding:c}=i,h=Jw(i.bodyFont);let d=h.lineHeight,u=0;const p=jk(i.rtl,this.x,this.width),m=function(i){e.fillText(i,p.x(t.x+u),t.y+d/2),t.y+=d+o},g=p.textAlign(s);let f,v,y,b,x,_,w;for(e.textAlign=s,e.textBaseline="middle",e.font=h.string,t.x=uA(this,g,i),e.fillStyle=i.bodyColor,g_(this.beforeBody,m),u=r&&"right"!==g?"center"===s?l/2+c:l+2+c:0,b=0,_=n.length;b<_;++b){for(f=n[b],v=this.labelTextColors[b],e.fillStyle=v,g_(f.before,m),y=f.lines,r&&y.length&&(this._drawColorBox(e,t,b,p,i),d=Math.max(h.lineHeight,a)),x=0,w=y.length;x<w;++x)m(y[x]),d=h.lineHeight;g_(f.after,m)}u=0,d=h.lineHeight,g_(this.afterBody,m),t.y-=o}drawFooter(t,e,i){const n=this.footer,o=n.length;let s,r;if(o){const a=jk(i.rtl,this.x,this.width);for(t.x=uA(this,i.footerAlign,i),t.y+=i.footerMarginTop,e.textAlign=a.textAlign(i.footerAlign),e.textBaseline="middle",s=Jw(i.footerFont),e.fillStyle=i.footerColor,e.font=s.string,r=0;r<o;++r)e.fillText(n[r],a.x(t.x),t.y+s.lineHeight/2),t.y+=s.lineHeight+i.footerSpacing}}drawBackground(t,e,i,n){const{xAlign:o,yAlign:s}=this,{x:r,y:a}=t,{width:l,height:c}=i,{topLeft:h,topRight:d,bottomLeft:u,bottomRight:p}=Kw(n.cornerRadius);e.fillStyle=n.backgroundColor,e.strokeStyle=n.borderColor,e.lineWidth=n.borderWidth,e.beginPath(),e.moveTo(r+h,a),"top"===s&&this.drawCaret(t,e,i,n),e.lineTo(r+l-d,a),e.quadraticCurveTo(r+l,a,r+l,a+d),"center"===s&&"right"===o&&this.drawCaret(t,e,i,n),e.lineTo(r+l,a+c-p),e.quadraticCurveTo(r+l,a+c,r+l-p,a+c),"bottom"===s&&this.drawCaret(t,e,i,n),e.lineTo(r+u,a+c),e.quadraticCurveTo(r,a+c,r,a+c-u),"center"===s&&"left"===o&&this.drawCaret(t,e,i,n),e.lineTo(r,a+h),e.quadraticCurveTo(r,a,r+h,a),e.closePath(),e.fill(),n.borderWidth>0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,i=this.$animations,n=i&&i.x,o=i&&i.y;if(n||o){const i=oA[t.position].call(this,this._active,this._eventPosition);if(!i)return;const s=this._size=lA(this,t),r=Object.assign({},i,this._size),a=hA(e,t,r),l=dA(t,r,a,e);n._to===l.x&&o._to===l.y||(this.xAlign=a.xAlign,this.yAlign=a.yAlign,this.width=s.width,this.height=s.height,this.caretX=i.x,this.caretY=i.y,this._resolveAnimations().update(this,l))}}_willRender(){return!!this.opacity}draw(t){const e=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(e);const n={width:this.width,height:this.height},o={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const s=Qw(e.padding),r=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&r&&(t.save(),t.globalAlpha=i,this.drawBackground(o,t,n,e),Bk(t,e.textDirection),o.y+=s.top,this.drawTitle(o,t,e),this.drawBody(o,t,e),this.drawFooter(o,t,e),Fk(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const i=this._active,n=t.map((({datasetIndex:t,index:e})=>{const i=this.chart.getDatasetMeta(t);if(!i)throw new Error("Cannot find a dataset at index "+t);return{datasetIndex:t,element:i.data[e],index:e}})),o=!f_(i,n),s=this._positionChanged(n,e);(o||s)&&(this._active=n,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,i=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const n=this.options,o=this._active||[],s=this._getActiveElements(t,o,e,i),r=this._positionChanged(s,t),a=e||!f_(s,o)||r;return a&&(this._active=s,(n.enabled||n.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),a}_getActiveElements(t,e,i,n){const o=this.options;if("mouseout"===t.type)return[];if(!n)return e.filter((t=>this.chart.data.datasets[t.datasetIndex]&&void 0!==this.chart.getDatasetMeta(t.datasetIndex).controller.getParsed(t.index)));const s=this.chart.getElementsAtEventForMode(t,o.mode,o,i);return o.reverse&&s.reverse(),s}_positionChanged(t,e){const{caretX:i,caretY:n,options:o}=this,s=oA[o.position].call(this,t,e);return!1!==s&&(i!==s.x||n!==s.y)}}var yA={id:"tooltip",_element:vA,positioners:oA,afterInit(t,e,i){i&&(t.tooltip=new vA({chart:t,options:i}))},beforeUpdate(t,e,i){t.tooltip&&t.tooltip.initialize(i)},reset(t,e,i){t.tooltip&&t.tooltip.initialize(i)},afterDraw(t){const e=t.tooltip;if(e&&e._willRender()){const i={tooltip:e};if(!1===t.notifyPlugins("beforeTooltipDraw",{...i,cancelable:!0}))return;e.draw(t.ctx),t.notifyPlugins("afterTooltipDraw",i)}},afterEvent(t,e){if(t.tooltip){const i=e.replay;t.tooltip.handleEvent(e.event,i,e.inChartArea)&&(e.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:(t,e)=>e.bodyFont.size,boxWidth:(t,e)=>e.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:gA},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:t=>"filter"!==t&&"itemSort"!==t&&"external"!==t,_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},bA=Object.freeze({__proto__:null,Colors:TE,Decimation:IE,Filler:YE,Legend:JE,SubTitle:nA,Title:eA,Tooltip:yA});function xA(t,e,i,n){const o=t.indexOf(e);if(-1===o)return((t,e,i,n)=>("string"==typeof e?(i=t.push(e)-1,n.unshift({index:i,label:e})):isNaN(e)&&(i=null),i))(t,e,i,n);return o!==t.lastIndexOf(e)?i:o}function _A(t){const e=this.getLabels();return t>=0&&t<e.length?e[t]:t}function wA(t,e){const i=[],{bounds:n,step:o,min:s,max:r,precision:a,count:l,maxTicks:c,maxDigits:h,includeBounds:d}=t,u=o||1,p=c-1,{min:m,max:g}=e,f=!a_(s),v=!a_(r),y=!a_(l),b=(g-m)/(h+1);let x,_,w,k,C=B_((g-m)/p/u)*u;if(C<1e-14&&!f&&!v)return[{value:m},{value:g}];k=Math.ceil(g/C)-Math.floor(m/C),k>p&&(C=B_(k*C/p/u)*u),a_(a)||(x=Math.pow(10,a),C=Math.ceil(C*x)/x),"ticks"===n?(_=Math.floor(m/C)*C,w=Math.ceil(g/C)*C):(_=m,w=g),f&&v&&o&&function(t,e){const i=Math.round(t);return i-e<=t&&i+e>=t}((r-s)/o,C/1e3)?(k=Math.round(Math.min((r-s)/C,c)),C=(r-s)/k,_=s,w=r):y?(_=f?s:_,w=v?r:w,k=l-1,C=(w-_)/k):(k=(w-_)/C,k=j_(k,Math.round(k),C/1e3)?Math.round(k):Math.ceil(k));const S=Math.max(U_(C),U_(_));x=Math.pow(10,a_(a)?S:a),_=Math.round(_*x)/x,w=Math.round(w*x)/x;let E=0;for(f&&(d&&_!==s?(i.push({value:s}),_<s&&E++,j_(Math.round((_+E*C)*x)/x,s,kA(s,b,t))&&E++):_<s&&E++);E<k;++E){const t=Math.round((_+E*C)*x)/x;if(v&&t>r)break;i.push({value:t})}return v&&d&&w!==r?i.length&&j_(i[i.length-1].value,r,kA(r,b,t))?i[i.length-1].value=r:i.push({value:r}):v&&w!==r||i.push({value:w}),i}function kA(t,e,{horizontal:i,minRotation:n}){const o=V_(n),s=(i?Math.sin(o):Math.cos(o))||.001,r=.75*e*(""+t).length;return Math.min(e/s,r)}class CA extends xS{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return a_(t)||("number"==typeof t||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:e,maxDefined:i}=this.getUserBounds();let{min:n,max:o}=this;const s=t=>n=e?n:t,r=t=>o=i?o:t;if(t){const t=N_(n),e=N_(o);t<0&&e<0?r(0):t>0&&e>0&&s(0)}if(n===o){let e=0===o?1:Math.abs(.05*o);r(o+e),t||s(n-e)}this.min=n,this.max=o}getTickLimit(){const t=this.options.ticks;let e,{maxTicksLimit:i,stepSize:n}=t;return n?(e=Math.ceil(this.max/n)-Math.floor(this.min/n)+1,e>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${n} would result generating up to ${e} ticks. Limiting to 1000.`),e=1e3)):(e=this.computeTickLimit(),i=i||11),i&&(e=Math.min(i,e)),e}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let i=this.getTickLimit();i=Math.max(2,i);const n=wA({maxTicks:i,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:!1!==e.includeBounds},this._range||this);return"ticks"===t.bounds&&q_(n,this,"value"),t.reverse?(n.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),n}configure(){const t=this.ticks;let e=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){const n=(i-e)/Math.max(t.length-1,1)/2;e-=n,i+=n}this._startValue=e,this._endValue=i,this._valueRange=i-e}getLabelForValue(t){return _w(t,this.chart.options.locale,this.options.ticks.format)}}class SA extends CA{static id="linear";static defaults={ticks:{callback:kw.formatters.numeric}};determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=h_(t)?t:0,this.max=h_(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,i=V_(this.options.ticks.minRotation),n=(t?Math.sin(i):Math.cos(i))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,o.lineHeight/n))}getPixelForValue(t){return null===t?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}const EA=t=>Math.floor(R_(t)),AA=(t,e)=>Math.pow(10,EA(t)+e);function MA(t){return 1===t/Math.pow(10,EA(t))}function TA(t,e,i){const n=Math.pow(10,i),o=Math.floor(t/n);return Math.ceil(e/n)-o}function PA(t,{min:e,max:i}){e=d_(t.min,e);const n=[],o=EA(e);let s=function(t,e){let i=EA(e-t);for(;TA(t,e,i)>10;)i++;for(;TA(t,e,i)<10;)i--;return Math.min(i,EA(t))}(e,i),r=s<0?Math.pow(10,Math.abs(s)):1;const a=Math.pow(10,s),l=o>s?Math.pow(10,o):0,c=Math.round((e-l)*r)/r,h=Math.floor((e-l)/a/10)*a*10;let d=Math.floor((c-h)/Math.pow(10,s)),u=d_(t.min,Math.round((l+h+d*Math.pow(10,s))*r)/r);for(;u<i;)n.push({value:u,major:MA(u),significand:d}),d>=10?d=d<15?15:20:d++,d>=20&&(s++,d=2,r=s>=0?1:r),u=Math.round((l+h+d*Math.pow(10,s))*r)/r;const p=d_(t.max,u);return n.push({value:p,major:MA(p),significand:d}),n}class DA extends xS{static id="logarithmic";static defaults={ticks:{callback:kw.formatters.logarithmic,major:{enabled:!0}}};constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){const i=CA.prototype.parse.apply(this,[t,e]);if(0!==i)return h_(i)&&i>0?i:null;this._zero=!0}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=h_(t)?Math.max(0,t):null,this.max=h_(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!h_(this._userMin)&&(this.min=t===AA(this.min,0)?AA(this.min,-1):AA(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let i=this.min,n=this.max;const o=e=>i=t?i:e,s=t=>n=e?n:t;i===n&&(i<=0?(o(1),s(10)):(o(AA(i,-1)),s(AA(n,1)))),i<=0&&o(AA(n,-1)),n<=0&&s(AA(i,1)),this.min=i,this.max=n}buildTicks(){const t=this.options,e=PA({min:this._userMin,max:this._userMax},this);return"ticks"===t.bounds&&q_(e,this,"value"),t.reverse?(e.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),e}getLabelForValue(t){return void 0===t?"0":_w(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=R_(t),this._valueRange=R_(this.max)-R_(t)}getPixelForValue(t){return void 0!==t&&0!==t||(t=this.min),null===t||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(R_(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}}function IA(t){const e=t.ticks;if(e.display&&t.display){const t=Qw(e.backdropPadding);return u_(e.font&&e.font.size,Tw.font.size)+t.height}return 0}function OA(t,e,i,n,o){return t===n||t===o?{start:e-i/2,end:e+i/2}:t<n||t>o?{start:e-i,end:e}:{start:e,end:e+i}}function $A(t){const e={l:t.left+t._padding.left,r:t.right-t._padding.right,t:t.top+t._padding.top,b:t.bottom-t._padding.bottom},i=Object.assign({},e),n=[],o=[],s=t._pointLabels.length,r=t.options.pointLabels,a=r.centerPointLabels?T_/s:0;for(let d=0;d<s;d++){const s=r.setContext(t.getPointLabelContext(d));o[d]=s.padding;const u=t.getPointPosition(d,t.drawingArea+o[d],a),p=Jw(s.font),m=(l=t.ctx,c=p,h=l_(h=t._pointLabels[d])?h:[h],{w:Dw(l,c.string,h),h:h.length*c.lineHeight});n[d]=m;const g=Y_(t.getIndexAngle(d)+a),f=Math.round(H_(g));LA(i,e,g,OA(f,u.x,m.w,0,180),OA(f,u.y,m.h,90,270))}var l,c,h;t.setCenterPoint(e.l-i.l,i.r-e.r,e.t-i.t,i.b-e.b),t._pointLabelItems=function(t,e,i){const n=[],o=t._pointLabels.length,s=t.options,{centerPointLabels:r,display:a}=s.pointLabels,l={extra:IA(s)/2,additionalAngle:r?T_/o:0};let c;for(let s=0;s<o;s++){l.padding=i[s],l.size=e[s];const o=zA(t,s,l);n.push(o),"auto"===a&&(o.visible=RA(o,c),o.visible&&(c=o))}return n}(t,n,o)}function LA(t,e,i,n,o){const s=Math.abs(Math.sin(i)),r=Math.abs(Math.cos(i));let a=0,l=0;n.start<e.l?(a=(e.l-n.start)/s,t.l=Math.min(t.l,e.l-a)):n.end>e.r&&(a=(n.end-e.r)/s,t.r=Math.max(t.r,e.r+a)),o.start<e.t?(l=(e.t-o.start)/r,t.t=Math.min(t.t,e.t-l)):o.end>e.b&&(l=(o.end-e.b)/r,t.b=Math.max(t.b,e.b+l))}function zA(t,e,i){const n=t.drawingArea,{extra:o,additionalAngle:s,padding:r,size:a}=i,l=t.getPointPosition(e,n+o+r,s),c=Math.round(H_(Y_(l.angle+$_))),h=function(t,e,i){90===i||270===i?t-=e/2:(i>270||i<90)&&(t-=e);return t}(l.y,a.h,c),d=function(t){if(0===t||180===t)return"center";if(t<180)return"left";return"right"}(c),u=function(t,e,i){"right"===i?t-=e:"center"===i&&(t-=e/2);return t}(l.x,a.w,d);return{visible:!0,x:l.x,y:h,textAlign:d,left:u,top:h,right:u+a.w,bottom:h+a.h}}function RA(t,e){if(!e)return!0;const{left:i,top:n,right:o,bottom:s}=t;return!(zw({x:i,y:n},e)||zw({x:i,y:s},e)||zw({x:o,y:n},e)||zw({x:o,y:s},e))}function NA(t,e,i){const{left:n,top:o,right:s,bottom:r}=i,{backdropColor:a}=e;if(!a_(a)){const i=Kw(e.borderRadius),l=Qw(e.backdropPadding);t.fillStyle=a;const c=n-l.left,h=o-l.top,d=s-n+l.width,u=r-o+l.height;Object.values(i).some((t=>0!==t))?(t.beginPath(),Hw(t,{x:c,y:h,w:d,h:u,radius:i}),t.fill()):t.fillRect(c,h,d,u)}}function jA(t,e,i,n){const{ctx:o}=t;if(i)o.arc(t.xCenter,t.yCenter,e,0,P_);else{let i=t.getPointPosition(0,e);o.moveTo(i.x,i.y);for(let s=1;s<n;s++)i=t.getPointPosition(s,e),o.lineTo(i.x,i.y)}}class BA extends CA{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:kw.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback:t=>t,padding:5,centerPointLabels:!1}};static defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"};static descriptors={angleLines:{_fallback:"grid"}};constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){const t=this._padding=Qw(IA(this.options)/2),e=this.width=this.maxWidth-t.width,i=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+e/2+t.left),this.yCenter=Math.floor(this.top+i/2+t.top),this.drawingArea=Math.floor(Math.min(e,i)/2)}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!1);this.min=h_(t)&&!isNaN(t)?t:0,this.max=h_(e)&&!isNaN(e)?e:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/IA(this.options))}generateTickLabels(t){CA.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map(((t,e)=>{const i=m_(this.options.pointLabels.callback,[t,e],this);return i||0===i?i:""})).filter(((t,e)=>this.chart.getDataVisibility(e)))}fit(){const t=this.options;t.display&&t.pointLabels.display?$A(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,i,n){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((i-n)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,i,n))}getIndexAngle(t){return Y_(t*(P_/(this._pointLabels.length||1))+V_(this.options.startAngle||0))}getDistanceFromCenterForValue(t){if(a_(t))return NaN;const e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(a_(t))return NaN;const e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){const e=this._pointLabels||[];if(t>=0&&t<e.length){const i=e[t];return function(t,e,i){return ek(t,{label:i,index:e,type:"pointLabel"})}(this.getContext(),t,i)}}getPointPosition(t,e,i=0){const n=this.getIndexAngle(t)-$_+i;return{x:Math.cos(n)*e+this.xCenter,y:Math.sin(n)*e+this.yCenter,angle:n}}getPointPositionForValue(t,e){return this.getPointPosition(t,this.getDistanceFromCenterForValue(e))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}getPointLabelPosition(t){const{left:e,top:i,right:n,bottom:o}=this._pointLabelItems[t];return{left:e,top:i,right:n,bottom:o}}drawBackground(){const{backgroundColor:t,grid:{circular:e}}=this.options;if(t){const i=this.ctx;i.save(),i.beginPath(),jA(this,this.getDistanceFromCenterForValue(this._endValue),e,this._pointLabels.length),i.closePath(),i.fillStyle=t,i.fill(),i.restore()}}drawGrid(){const t=this.ctx,e=this.options,{angleLines:i,grid:n,border:o}=e,s=this._pointLabels.length;let r,a,l;if(e.pointLabels.display&&function(t,e){const{ctx:i,options:{pointLabels:n}}=t;for(let o=e-1;o>=0;o--){const e=t._pointLabelItems[o];if(!e.visible)continue;const s=n.setContext(t.getPointLabelContext(o));NA(i,s,e);const r=Jw(s.font),{x:a,y:l,textAlign:c}=e;Vw(i,t._pointLabels[o],a,l+r.lineHeight/2,r,{color:s.color,textAlign:c,textBaseline:"middle"})}}(this,s),n.display&&this.ticks.forEach(((t,e)=>{if(0!==e||0===e&&this.min<0){a=this.getDistanceFromCenterForValue(t.value);const i=this.getContext(e),r=n.setContext(i),l=o.setContext(i);!function(t,e,i,n,o){const s=t.ctx,r=e.circular,{color:a,lineWidth:l}=e;!r&&!n||!a||!l||i<0||(s.save(),s.strokeStyle=a,s.lineWidth=l,s.setLineDash(o.dash||[]),s.lineDashOffset=o.dashOffset,s.beginPath(),jA(t,i,r,n),s.closePath(),s.stroke(),s.restore())}(this,r,a,s,l)}})),i.display){for(t.save(),r=s-1;r>=0;r--){const n=i.setContext(this.getPointLabelContext(r)),{color:o,lineWidth:s}=n;s&&o&&(t.lineWidth=s,t.strokeStyle=o,t.setLineDash(n.borderDash),t.lineDashOffset=n.borderDashOffset,a=this.getDistanceFromCenterForValue(e.reverse?this.min:this.max),l=this.getPointPosition(r,a),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(l.x,l.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,e=this.options,i=e.ticks;if(!i.display)return;const n=this.getIndexAngle(0);let o,s;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(n),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach(((n,r)=>{if(0===r&&this.min>=0&&!e.reverse)return;const a=i.setContext(this.getContext(r)),l=Jw(a.font);if(o=this.getDistanceFromCenterForValue(this.ticks[r].value),a.showLabelBackdrop){t.font=l.string,s=t.measureText(n.label).width,t.fillStyle=a.backdropColor;const e=Qw(a.backdropPadding);t.fillRect(-s/2-e.left,-o-l.size/2-e.top,s+e.width,l.size+e.height)}Vw(t,n.label,0,-o,l,{color:a.color,strokeColor:a.textStrokeColor,strokeWidth:a.textStrokeWidth})})),t.restore()}drawTitle(){}}const FA={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}},qA=Object.keys(FA);function VA(t,e){return t-e}function HA(t,e){if(a_(e))return null;const i=t._adapter,{parser:n,round:o,isoWeekday:s}=t._parseOpts;let r=e;return"function"==typeof n&&(r=n(r)),h_(r)||(r="string"==typeof n?i.parse(r,n):i.parse(r)),null===r?null:(o&&(r="week"!==o||!F_(s)&&!0!==s?i.startOf(r,o):i.startOf(r,"isoWeek",s)),+r)}function UA(t,e,i,n){const o=qA.length;for(let s=qA.indexOf(t);s<o-1;++s){const t=FA[qA[s]],o=t.steps?t.steps:Number.MAX_SAFE_INTEGER;if(t.common&&Math.ceil((i-e)/(o*t.size))<=n)return qA[s]}return qA[o-1]}function WA(t,e,i){if(i){if(i.length){const{lo:n,hi:o}=J_(i,e);t[i[n]>=e?i[n]:i[o]]=!0}}else t[e]=!0}function GA(t,e,i){const n=[],o={},s=e.length;let r,a;for(r=0;r<s;++r)a=e[r],o[a]=r,n.push({value:a,major:!1});return 0!==s&&i?function(t,e,i,n){const o=t._adapter,s=+o.startOf(e[0].value,n),r=e[e.length-1].value;let a,l;for(a=s;a<=r;a=+o.add(a,1,n))l=i[a],l>=0&&(e[l].major=!0);return e}(t,n,o,i):n}class ZA extends xS{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(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,e={}){const i=t.time||(t.time={}),n=this._adapter=new EC._date(t.adapters.date);n.init(e),__(i.displayFormats,n.formats()),this._parseOpts={parser:i.parser,round:i.round,isoWeekday:i.isoWeekday},super.init(t),this._normalized=e.normalized}parse(t,e){return void 0===t?null:HA(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,e=this._adapter,i=t.time.unit||"day";let{min:n,max:o,minDefined:s,maxDefined:r}=this.getUserBounds();function a(t){s||isNaN(t.min)||(n=Math.min(n,t.min)),r||isNaN(t.max)||(o=Math.max(o,t.max))}s&&r||(a(this._getLabelBounds()),"ticks"===t.bounds&&"labels"===t.ticks.source||a(this.getMinMax(!1))),n=h_(n)&&!isNaN(n)?n:+e.startOf(Date.now(),i),o=h_(o)&&!isNaN(o)?o:+e.endOf(Date.now(),i)+1,this.min=Math.min(n,o-1),this.max=Math.max(n+1,o)}_getLabelBounds(){const t=this.getLabelTimestamps();let e=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;return t.length&&(e=t[0],i=t[t.length-1]),{min:e,max:i}}buildTicks(){const t=this.options,e=t.time,i=t.ticks,n="labels"===i.source?this.getLabelTimestamps():this._generate();"ticks"===t.bounds&&n.length&&(this.min=this._userMin||n[0],this.max=this._userMax||n[n.length-1]);const o=this.min,s=function(t,e,i){let n=0,o=t.length;for(;n<o&&t[n]<e;)n++;for(;o>n&&t[o-1]>i;)o--;return n>0||o<t.length?t.slice(n,o):t}(n,o,this.max);return this._unit=e.unit||(i.autoSkip?UA(e.minUnit,this.min,this.max,this._getLabelCapacity(o)):function(t,e,i,n,o){for(let s=qA.length-1;s>=qA.indexOf(i);s--){const i=qA[s];if(FA[i].common&&t._adapter.diff(o,n,i)>=e-1)return i}return qA[i?qA.indexOf(i):0]}(this,s.length,e.minUnit,this.min,this.max)),this._majorUnit=i.major.enabled&&"year"!==this._unit?function(t){for(let e=qA.indexOf(t)+1,i=qA.length;e<i;++e)if(FA[qA[e]].common)return qA[e]}(this._unit):void 0,this.initOffsets(n),t.reverse&&s.reverse(),GA(this,s,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map((t=>+t.value)))}initOffsets(t=[]){let e,i,n=0,o=0;this.options.offset&&t.length&&(e=this.getDecimalForValue(t[0]),n=1===t.length?1-e:(this.getDecimalForValue(t[1])-e)/2,i=this.getDecimalForValue(t[t.length-1]),o=1===t.length?i:(i-this.getDecimalForValue(t[t.length-2]))/2);const s=t.length<3?.5:.25;n=K_(n,0,s),o=K_(o,0,s),this._offsets={start:n,end:o,factor:1/(n+1+o)}}_generate(){const t=this._adapter,e=this.min,i=this.max,n=this.options,o=n.time,s=o.unit||UA(o.minUnit,e,i,this._getLabelCapacity(e)),r=u_(n.ticks.stepSize,1),a="week"===s&&o.isoWeekday,l=F_(a)||!0===a,c={};let h,d,u=e;if(l&&(u=+t.startOf(u,"isoWeek",a)),u=+t.startOf(u,l?"day":s),t.diff(i,e,s)>1e5*r)throw new Error(e+" and "+i+" are too far apart with stepSize of "+r+" "+s);const p="data"===n.ticks.source&&this.getDataTimestamps();for(h=u,d=0;h<i;h=+t.add(h,r,s),d++)WA(c,h,p);return h!==i&&"ticks"!==n.bounds&&1!==d||WA(c,h,p),Object.keys(c).sort(VA).map((t=>+t))}getLabelForValue(t){const e=this._adapter,i=this.options.time;return i.tooltipFormat?e.format(t,i.tooltipFormat):e.format(t,i.displayFormats.datetime)}format(t,e){const i=this.options.time.displayFormats,n=this._unit,o=e||i[n];return this._adapter.format(t,o)}_tickFormatFunction(t,e,i,n){const o=this.options,s=o.ticks.callback;if(s)return m_(s,[t,e,i],this);const r=o.time.displayFormats,a=this._unit,l=this._majorUnit,c=a&&r[a],h=l&&r[l],d=i[e],u=l&&h&&d&&d.major;return this._adapter.format(t,n||(u?h:c))}generateTickLabels(t){let e,i,n;for(e=0,i=t.length;e<i;++e)n=t[e],n.label=this._tickFormatFunction(n.value,e,t)}getDecimalForValue(t){return null===t?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const e=this._offsets,i=this.getDecimalForValue(t);return this.getPixelForDecimal((e.start+i)*e.factor)}getValueForPixel(t){const e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return this.min+i*(this.max-this.min)}_getLabelSize(t){const e=this.options.ticks,i=this.ctx.measureText(t).width,n=V_(this.isHorizontal()?e.maxRotation:e.minRotation),o=Math.cos(n),s=Math.sin(n),r=this._resolveTickFontOptions(0).size;return{w:i*o+r*s,h:i*s+r*o}}_getLabelCapacity(t){const e=this.options.time,i=e.displayFormats,n=i[e.unit]||i.millisecond,o=this._tickFormatFunction(t,0,GA(this,[t],this._majorUnit),n),s=this._getLabelSize(o),r=Math.floor(this.isHorizontal()?this.width/s.w:this.height/s.h)-1;return r>0?r:1}getDataTimestamps(){let t,e,i=this._cache.data||[];if(i.length)return i;const n=this.getMatchingVisibleMetas();if(this._normalized&&n.length)return this._cache.data=n[0].controller.getAllParsedValues(this);for(t=0,e=n.length;t<e;++t)i=i.concat(n[t].controller.getAllParsedValues(this));return this._cache.data=this.normalize(i)}getLabelTimestamps(){const t=this._cache.labels||[];let e,i;if(t.length)return t;const n=this.getLabels();for(e=0,i=n.length;e<i;++e)t.push(HA(this,n[e]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return ow(t.sort(VA))}}function YA(t,e,i){let n,o,s,r,a=0,l=t.length-1;i?(e>=t[a].pos&&e<=t[l].pos&&({lo:a,hi:l}=tw(t,"pos",e)),({pos:n,time:s}=t[a]),({pos:o,time:r}=t[l])):(e>=t[a].time&&e<=t[l].time&&({lo:a,hi:l}=tw(t,"time",e)),({time:n,pos:s}=t[a]),({time:o,pos:r}=t[l]));const c=o-n;return c?s+(r-s)*(e-n)/c:s}var XA=Object.freeze({__proto__:null,CategoryScale:class extends xS{static id="category";static defaults={ticks:{callback:_A}};constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const e=this._addedLabels;if(e.length){const t=this.getLabels();for(const{index:i,label:n}of e)t[i]===n&&t.splice(i,1);this._addedLabels=[]}super.init(t)}parse(t,e){if(a_(t))return null;const i=this.getLabels();return((t,e)=>null===t?null:K_(Math.round(t),0,e))(e=isFinite(e)&&i[e]===t?e:xA(i,t,u_(e,t),this._addedLabels),i.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let{min:i,max:n}=this.getMinMax(!0);"ticks"===this.options.bounds&&(t||(i=0),e||(n=this.getLabels().length-1)),this.min=i,this.max=n}buildTicks(){const t=this.min,e=this.max,i=this.options.offset,n=[];let o=this.getLabels();o=0===t&&e===o.length-1?o:o.slice(t,e+1),this._valueRange=Math.max(o.length-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let i=t;i<=e;i++)n.push({value:i});return n}getLabelForValue(t){return _A.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return"number"!=typeof t&&(t=this.parse(t)),null===t?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}},LinearScale:SA,LogarithmicScale:DA,RadialLinearScale:BA,TimeScale:ZA,TimeSeriesScale:class extends ZA{static id="timeseries";static defaults=ZA.defaults;constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=YA(e,this.min),this._tableRange=YA(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:i}=this,n=[],o=[];let s,r,a,l,c;for(s=0,r=t.length;s<r;++s)l=t[s],l>=e&&l<=i&&n.push(l);if(n.length<2)return[{time:e,pos:0},{time:i,pos:1}];for(s=0,r=n.length;s<r;++s)c=n[s+1],a=n[s-1],l=n[s],Math.round((c+a)/2)!==l&&o.push({time:l,pos:s/(r-1)});return o}_generate(){const t=this.min,e=this.max;let i=super.getDataTimestamps();return i.includes(t)&&i.length||i.splice(0,0,t),i.includes(e)&&1!==i.length||i.push(e),i.sort(((t,e)=>t-e))}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const e=this.getDataTimestamps(),i=this.getLabelTimestamps();return t=e.length&&i.length?this.normalize(e.concat(i)):e.length?e:i,t=this._cache.all=t,t}getDecimalForValue(t){return(YA(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return YA(this._table,i*this._tableRange+this._minPos,!0)}}});const KA=[kC,wE,bA,XA];KS.register(...KA);
|
|
9472
|
+
*/class Jk{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,i,n){const o=e.listeners[n],s=e.duration;o.forEach((n=>n({chart:t,initial:e.initial,numSteps:s,currentStep:Math.min(i-e.start,s)})))}_refresh(){this._request||(this._running=!0,this._request=cw.call(window,(()=>{this._update(),this._request=null,this._running&&this._refresh()})))}_update(t=Date.now()){let e=0;this._charts.forEach(((i,n)=>{if(!i.running||!i.items.length)return;const o=i.items;let s,r=o.length-1,a=!1;for(;r>=0;--r)s=o[r],s._active?(s._total>i.duration&&(i.duration=s._total),s.tick(t),a=!0):(o[r]=o[o.length-1],o.pop());a&&(n.draw(),this._notify(n,i,t,"progress")),o.length||(i.running=!1,this._notify(n,i,t,"complete"),i.initial=!1),e+=o.length})),this._lastDate=t,0===e&&(this._running=!1)}_getAnims(t){const e=this._charts;let i=e.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,i)),i}listen(t,e,i){this._getAnims(t).listeners[e].push(i)}add(t,e){e&&e.length&&this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce(((t,e)=>Math.max(t,e._duration)),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!!(e&&e.running&&e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const i=e.items;let n=i.length-1;for(;n>=0;--n)i[n].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var tC=new Jk;const eC="transparent",iC={boolean:(t,e,i)=>i>.5?e:t,color(t,e,i){const n=xw(t||eC),o=n.valid&&xw(e||eC);return o&&o.valid?o.mix(n,i).hexString():e},number:(t,e,i)=>t+(e-t)*i};class nC{constructor(t,e,i,n){const o=e[i];n=ok([t.to,n,o,t.from]);const s=ok([t.from,o,n]);this._active=!0,this._fn=t.fn||iC[t.type||typeof s],this._easing=yw[t.easing]||yw.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=i,this._from=s,this._to=n,this._promises=void 0}active(){return this._active}update(t,e,i){if(this._active){this._notify(!1);const n=this._target[this._prop],o=i-this._start,s=this._duration-o;this._start=i,this._duration=Math.floor(Math.max(s,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=ok([t.to,e,n,t.from]),this._from=ok([t.from,n,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,i=this._duration,n=this._prop,o=this._from,s=this._loop,r=this._to;let a;if(this._active=o!==r&&(s||e<i),!this._active)return this._target[n]=r,void this._notify(!0);e<0?this._target[n]=o:(a=e/i%2,a=s&&a>1?2-a:a,a=this._easing(Math.min(1,Math.max(0,a))),this._target[n]=this._fn(o,r,a))}wait(){const t=this._promises||(this._promises=[]);return new Promise(((e,i)=>{t.push({res:e,rej:i})}))}_notify(t){const e=t?"res":"rej",i=this._promises||[];for(let t=0;t<i.length;t++)i[t][e]()}}class oC{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!p_(t))return;const e=Object.keys(Ow.animation),i=this._properties;Object.getOwnPropertyNames(t).forEach((n=>{const o=t[n];if(!p_(o))return;const s={};for(const t of e)s[t]=o[t];(u_(o.properties)&&o.properties||[n]).forEach((t=>{t!==n&&i.has(t)||i.set(t,s)}))}))}_animateOptions(t,e){const i=e.options,n=function(t,e){if(!e)return;let i=t.options;if(!i)return void(t.options=e);i.$shared&&(t.options=i=Object.assign({},i,{$shared:!1,$animations:{}}));return i}(t,i);if(!n)return[];const o=this._createAnimations(n,i);return i.$shared&&function(t,e){const i=[],n=Object.keys(e);for(let e=0;e<n.length;e++){const o=t[n[e]];o&&o.active()&&i.push(o.wait())}return Promise.all(i)}(t.options.$animations,i).then((()=>{t.options=i}),(()=>{})),o}_createAnimations(t,e){const i=this._properties,n=[],o=t.$animations||(t.$animations={}),s=Object.keys(e),r=Date.now();let a;for(a=s.length-1;a>=0;--a){const l=s[a];if("$"===l.charAt(0))continue;if("options"===l){n.push(...this._animateOptions(t,e));continue}const c=e[l];let h=o[l];const d=i.get(l);if(h){if(d&&h.active()){h.update(d,c,r);continue}h.cancel()}d&&d.duration?(o[l]=h=new nC(d,t,l,c),n.push(h)):t[l]=c}return n}update(t,e){if(0===this._properties.size)return void Object.assign(t,e);const i=this._createAnimations(t,e);return i.length?(tC.add(this._chart,i),!0):void 0}}function sC(t,e){const i=t&&t.options||{},n=i.reverse,o=void 0===i.min?e:0,s=void 0===i.max?e:0;return{start:n?s:o,end:n?o:s}}function rC(t,e){const i=[],n=t._getSortedDatasetMetas(e);let o,s;for(o=0,s=n.length;o<s;++o)i.push(n[o].index);return i}function aC(t,e,i,n={}){const o=t.keys,s="single"===n.mode;let r,a,l,c;if(null===e)return;let h=!1;for(r=0,a=o.length;r<a;++r){if(l=+o[r],l===i){if(h=!0,n.all)continue;break}c=t.values[l],m_(c)&&(s||0===e||q_(e)===q_(c))&&(e+=c)}return h||n.all?e:0}function lC(t,e){const i=t&&t.options.stacked;return i||void 0===i&&void 0!==e.stack}function cC(t,e,i){const n=t[e]||(t[e]={});return n[i]||(n[i]={})}function hC(t,e,i,n){for(const o of e.getMatchingVisibleMetas(n).reverse()){const e=t[o.index];if(i&&e>0||!i&&e<0)return o.index}return null}function dC(t,e){const{chart:i,_cachedMeta:n}=t,o=i._stacks||(i._stacks={}),{iScale:s,vScale:r,index:a}=n,l=s.axis,c=r.axis,h=function(t,e,i){return`${t.id}.${e.id}.${i.stack||i.type}`}(s,r,n),d=e.length;let u;for(let t=0;t<d;++t){const i=e[t],{[l]:s,[c]:d}=i;u=(i._stacks||(i._stacks={}))[c]=cC(o,h,s),u[a]=d,u._top=hC(u,r,!0,n.type),u._bottom=hC(u,r,!1,n.type);(u._visualValues||(u._visualValues={}))[a]=d}}function uC(t,e){const i=t.scales;return Object.keys(i).filter((t=>i[t].axis===e)).shift()}function pC(t,e){const i=t.controller.index,n=t.vScale&&t.vScale.axis;if(n){e=e||t._parsed;for(const t of e){const e=t._stacks;if(!e||void 0===e[n]||void 0===e[n][i])return;delete e[n][i],void 0!==e[n]._visualValues&&void 0!==e[n]._visualValues[i]&&delete e[n]._visualValues[i]}}}const mC=t=>"reset"===t||"none"===t,gC=(t,e)=>e?t:Object.assign({},t);class fC{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=lC(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&pC(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,i=this.getDataset(),n=(t,e,i,n)=>"x"===t?e:"r"===t?n:i,o=e.xAxisID=f_(i.xAxisID,uC(t,"x")),s=e.yAxisID=f_(i.yAxisID,uC(t,"y")),r=e.rAxisID=f_(i.rAxisID,uC(t,"r")),a=e.indexAxis,l=e.iAxisID=n(a,o,s,r),c=e.vAxisID=n(a,s,o,r);e.xScale=this.getScaleForId(o),e.yScale=this.getScaleForId(s),e.rScale=this.getScaleForId(r),e.iScale=this.getScaleForId(l),e.vScale=this.getScaleForId(c)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&aw(this._data,this),t._stacked&&pC(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if(p_(e)){const t=this._cachedMeta;this._data=function(t,e){const{iScale:i,vScale:n}=e,o="x"===i.axis?"x":"y",s="x"===n.axis?"x":"y",r=Object.keys(t),a=new Array(r.length);let l,c,h;for(l=0,c=r.length;l<c;++l)h=r[l],a[l]={[o]:h,[s]:t[h]};return a}(e,t)}else if(i!==e){if(i){aw(i,this);const t=this._cachedMeta;pC(t),t._parsed=[]}e&&Object.isExtensible(e)&&(o=this,(n=e)._chartjs?n._chartjs.listeners.push(o):(Object.defineProperty(n,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[o]}}),rw.forEach((t=>{const e="_onData"+T_(t),i=n[t];Object.defineProperty(n,t,{configurable:!0,enumerable:!1,value(...t){const o=i.apply(this,t);return n._chartjs.listeners.forEach((i=>{"function"==typeof i[e]&&i[e](...t)})),o}})})))),this._syncList=[],this._data=e}var n,o}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const e=this._cachedMeta,i=this.getDataset();let n=!1;this._dataCheck();const o=e._stacked;e._stacked=lC(e.vScale,e),e.stack!==i.stack&&(n=!0,pC(e),e.stack=i.stack),this._resyncElements(t),(n||o!==e._stacked)&&(dC(this,e._parsed),e._stacked=lC(e.vScale,e))}configure(){const t=this.chart.config,e=t.datasetScopeKeys(this._type),i=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){const{_cachedMeta:i,_data:n}=this,{iScale:o,_stacked:s}=i,r=o.axis;let a,l,c,h=0===t&&e===n.length||i._sorted,d=t>0&&i._parsed[t-1];if(!1===this._parsing)i._parsed=n,i._sorted=!0,c=n;else{c=u_(n[t])?this.parseArrayData(i,n,t,e):p_(n[t])?this.parseObjectData(i,n,t,e):this.parsePrimitiveData(i,n,t,e);const o=()=>null===l[r]||d&&l[r]<d[r];for(a=0;a<e;++a)i._parsed[a+t]=l=c[a],h&&(o()&&(h=!1),d=l);i._sorted=h}s&&dC(this,c)}parsePrimitiveData(t,e,i,n){const{iScale:o,vScale:s}=t,r=o.axis,a=s.axis,l=o.getLabels(),c=o===s,h=new Array(n);let d,u,p;for(d=0,u=n;d<u;++d)p=d+i,h[d]={[r]:c||o.parse(l[p],p),[a]:s.parse(e[p],p)};return h}parseArrayData(t,e,i,n){const{xScale:o,yScale:s}=t,r=new Array(n);let a,l,c,h;for(a=0,l=n;a<l;++a)c=a+i,h=e[c],r[a]={x:o.parse(h[0],c),y:s.parse(h[1],c)};return r}parseObjectData(t,e,i,n){const{xScale:o,yScale:s}=t,{xAxisKey:r="x",yAxisKey:a="y"}=this._parsing,l=new Array(n);let c,h,d,u;for(c=0,h=n;c<h;++c)d=c+i,u=e[d],l[c]={x:o.parse(M_(u,r),d),y:s.parse(M_(u,a),d)};return l}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,e,i){const n=this.chart,o=this._cachedMeta,s=e[t.axis];return aC({keys:rC(n,!0),values:e._stacks[t.axis]._visualValues},s,o.index,{mode:i})}updateRangeFromParsed(t,e,i,n){const o=i[e.axis];let s=null===o?NaN:o;const r=n&&i._stacks[e.axis];n&&r&&(n.values=r,s=aC(n,o,this._cachedMeta.index)),t.min=Math.min(t.min,s),t.max=Math.max(t.max,s)}getMinMax(t,e){const i=this._cachedMeta,n=i._parsed,o=i._sorted&&t===i.iScale,s=n.length,r=this._getOtherScale(t),a=((t,e,i)=>t&&!e.hidden&&e._stacked&&{keys:rC(i,!0),values:null})(e,i,this.chart),l={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:c,max:h}=function(t){const{min:e,max:i,minDefined:n,maxDefined:o}=t.getUserBounds();return{min:n?e:Number.NEGATIVE_INFINITY,max:o?i:Number.POSITIVE_INFINITY}}(r);let d,u;function p(){u=n[d];const e=u[r.axis];return!m_(u[t.axis])||c>e||h<e}for(d=0;d<s&&(p()||(this.updateRangeFromParsed(l,t,u,a),!o));++d);if(o)for(d=s-1;d>=0;--d)if(!p()){this.updateRangeFromParsed(l,t,u,a);break}return l}getAllParsedValues(t){const e=this._cachedMeta._parsed,i=[];let n,o,s;for(n=0,o=e.length;n<o;++n)s=e[n][t.axis],m_(s)&&i.push(s);return i}getMaxOverflow(){return!1}getLabelAndValue(t){const e=this._cachedMeta,i=e.iScale,n=e.vScale,o=this.getParsed(t);return{label:i?""+i.getLabelForValue(o[i.axis]):"",value:n?""+n.getLabelForValue(o[n.axis]):""}}_update(t){const e=this._cachedMeta;this.update(t||"default"),e._clip=function(t){let e,i,n,o;return p_(t)?(e=t.top,i=t.right,n=t.bottom,o=t.left):e=i=n=o=t,{top:e,right:i,bottom:n,left:o,disabled:!1===t}}(f_(this.options.clip,function(t,e,i){if(!1===i)return!1;const n=sC(t,i),o=sC(e,i);return{top:o.end,right:n.end,bottom:o.start,left:n.start}}(e.xScale,e.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,e=this.chart,i=this._cachedMeta,n=i.data||[],o=e.chartArea,s=[],r=this._drawStart||0,a=this._drawCount||n.length-r,l=this.options.drawActiveElementsOnTop;let c;for(i.dataset&&i.dataset.draw(t,o,r,a),c=r;c<r+a;++c){const e=n[c];e.hidden||(e.active&&l?s.push(e):e.draw(t,o))}for(c=0;c<s.length;++c)s[c].draw(t,o)}getStyle(t,e){const i=e?"active":"default";return void 0===t&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(i):this.resolveDataElementOptions(t||0,i)}getContext(t,e,i){const n=this.getDataset();let o;if(t>=0&&t<this._cachedMeta.data.length){const e=this._cachedMeta.data[t];o=e.$context||(e.$context=function(t,e,i){return sk(t,{active:!1,dataIndex:e,parsed:void 0,raw:void 0,element:i,index:e,mode:"default",type:"data"})}(this.getContext(),t,e)),o.parsed=this.getParsed(t),o.raw=n.data[t],o.index=o.dataIndex=t}else o=this.$context||(this.$context=function(t,e){return sk(t,{active:!1,dataset:void 0,datasetIndex:e,index:e,mode:"default",type:"dataset"})}(this.chart.getContext(),this.index)),o.dataset=n,o.index=o.datasetIndex=this.index;return o.active=!!e,o.mode=i,o}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,e){return this._resolveElementOptions(this.dataElementType.id,e,t)}_resolveElementOptions(t,e="default",i){const n="active"===e,o=this._cachedDataOpts,s=t+"-"+e,r=o[s],a=this.enableOptionSharing&&P_(i);if(r)return gC(r,a);const l=this.chart.config,c=l.datasetElementScopeKeys(this._type,t),h=n?[`${t}Hover`,"hover",t,""]:[t,""],d=l.getOptionScopes(this.getDataset(),c),u=Object.keys(Ow.elements[t]),p=l.resolveNamedOptions(d,u,(()=>this.getContext(i,n,e)),h);return p.$shared&&(p.$shared=a,o[s]=Object.freeze(gC(p,a))),p}_resolveAnimations(t,e,i){const n=this.chart,o=this._cachedDataOpts,s=`animation-${e}`,r=o[s];if(r)return r;let a;if(!1!==n.options.animation){const n=this.chart.config,o=n.datasetAnimationScopeKeys(this._type,e),s=n.getOptionScopes(this.getDataset(),o);a=n.createResolver(s,this.getContext(t,i,e))}const l=new oC(n,a&&a.animations);return a&&a._cacheable&&(o[s]=Object.freeze(l)),l}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||mC(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const i=this.resolveDataElementOptions(t,e),n=this._sharedOptions,o=this.getSharedOptions(i),s=this.includeOptions(e,o)||o!==n;return this.updateSharedOptions(o,e,i),{sharedOptions:o,includeOptions:s}}updateElement(t,e,i,n){mC(n)?Object.assign(t,i):this._resolveAnimations(e,n).update(t,i)}updateSharedOptions(t,e,i){t&&!mC(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,n){t.active=n;const o=this.getStyle(e,n);this._resolveAnimations(e,i,n).update(t,{options:!n&&this.getSharedOptions(o)||o})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const e=this._data,i=this._cachedMeta.data;for(const[t,e,i]of this._syncList)this[t](e,i);this._syncList=[];const n=i.length,o=e.length,s=Math.min(o,n);s&&this.parse(0,s),o>n?this._insertElements(n,o-n,t):o<n&&this._removeElements(o,n-o)}_insertElements(t,e,i=!0){const n=this._cachedMeta,o=n.data,s=t+e;let r;const a=t=>{for(t.length+=e,r=t.length-1;r>=s;r--)t[r]=t[r-e]};for(a(o),r=t;r<s;++r)o[r]=new this.dataElementType;this._parsing&&a(n._parsed),this.parse(t,e),i&&this.updateElements(o,t,e,"reset")}updateElements(t,e,i,n){}_removeElements(t,e){const i=this._cachedMeta;if(this._parsing){const n=i._parsed.splice(t,e);i._stacked&&pC(i,n)}i.data.splice(t,e)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[e,i,n]=t;this[e](i,n)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){const t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,e){e&&this._sync(["_removeElements",t,e]);const i=arguments.length-2;i&&this._sync(["_insertElements",t,i])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}function vC(t){const e=t.iScale,i=function(t,e){if(!t._cache.$bar){const i=t.getMatchingVisibleMetas(e);let n=[];for(let e=0,o=i.length;e<o;e++)n=n.concat(i[e].controller.getAllParsedValues(t));t._cache.$bar=lw(n.sort(((t,e)=>t-e)))}return t._cache.$bar}(e,t.type);let n,o,s,r,a=e._length;const l=()=>{32767!==s&&-32768!==s&&(P_(r)&&(a=Math.min(a,Math.abs(s-r)||a)),r=s)};for(n=0,o=i.length;n<o;++n)s=e.getPixelForValue(i[n]),l();for(r=void 0,n=0,o=e.ticks.length;n<o;++n)s=e.getPixelForTick(n),l();return a}function yC(t,e,i,n){return u_(t)?function(t,e,i,n){const o=i.parse(t[0],n),s=i.parse(t[1],n),r=Math.min(o,s),a=Math.max(o,s);let l=r,c=a;Math.abs(r)>Math.abs(a)&&(l=a,c=r),e[i.axis]=c,e._custom={barStart:l,barEnd:c,start:o,end:s,min:r,max:a}}(t,e,i,n):e[i.axis]=i.parse(t,n),e}function bC(t,e,i,n){const o=t.iScale,s=t.vScale,r=o.getLabels(),a=o===s,l=[];let c,h,d,u;for(c=i,h=i+n;c<h;++c)u=e[c],d={},d[o.axis]=a||o.parse(r[c],c),l.push(yC(u,d,s,c));return l}function xC(t){return t&&void 0!==t.barStart&&void 0!==t.barEnd}function _C(t,e,i,n){let o=e.borderSkipped;const s={};if(!o)return void(t.borderSkipped=s);if(!0===o)return void(t.borderSkipped={top:!0,right:!0,bottom:!0,left:!0});const{start:r,end:a,reverse:l,top:c,bottom:h}=function(t){let e,i,n,o,s;return t.horizontal?(e=t.base>t.x,i="left",n="right"):(e=t.base<t.y,i="bottom",n="top"),e?(o="end",s="start"):(o="start",s="end"),{start:i,end:n,reverse:e,top:o,bottom:s}}(t);"middle"===o&&i&&(t.enableBorderRadius=!0,(i._top||0)===n?o=c:(i._bottom||0)===n?o=h:(s[wC(h,r,a,l)]=!0,o=c)),s[wC(o,r,a,l)]=!0,t.borderSkipped=s}function wC(t,e,i,n){var o,s,r;return n?(r=i,t=kC(t=(o=t)===(s=e)?r:o===r?s:o,i,e)):t=kC(t,e,i),t}function kC(t,e,i){return"start"===t?e:"end"===t?i:t}function CC(t,{inflateAmount:e},i){t.inflateAmount="auto"===e?1===i?.33:0:e}class SC extends fC{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,indexAxis:"r"};static descriptors={_scriptable:t=>"spacing"!==t,_indexable:t=>"spacing"!==t&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i,color:n}}=t.legend.options;return e.labels.map(((e,o)=>{const s=t.getDatasetMeta(0).controller.getStyle(o);return{text:e,fillStyle:s.backgroundColor,strokeStyle:s.borderColor,fontColor:n,lineWidth:s.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(o),index:o}}))}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}}};constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){const i=this.getDataset().data,n=this._cachedMeta;if(!1===this._parsing)n._parsed=i;else{let o,s,r=t=>+i[t];if(p_(i[t])){const{key:t="value"}=this._parsing;r=e=>+M_(i[e],t)}for(o=t,s=t+e;o<s;++o)n._parsed[o]=r(o)}}_getRotation(){return G_(this.options.rotation-90)}_getCircumference(){return G_(this.options.circumference)}_getRotationExtents(){let t=$_,e=-$_;for(let i=0;i<this.chart.data.datasets.length;++i)if(this.chart.isDatasetVisible(i)&&this.chart.getDatasetMeta(i).type===this._type){const n=this.chart.getDatasetMeta(i).controller,o=n._getRotation(),s=n._getCircumference();t=Math.min(t,o),e=Math.max(e,o+s)}return{rotation:t,circumference:e-t}}update(t){const e=this.chart,{chartArea:i}=e,n=this._cachedMeta,o=n.data,s=this.getMaxBorderWidth()+this.getMaxOffset(o)+this.options.spacing,r=Math.max((Math.min(i.width,i.height)-s)/2,0),a=Math.min((l=this.options.cutout,c=r,"string"==typeof l&&l.endsWith("%")?parseFloat(l)/100:+l/c),1);var l,c;const h=this._getRingWeight(this.index),{circumference:d,rotation:u}=this._getRotationExtents(),{ratioX:p,ratioY:m,offsetX:g,offsetY:f}=function(t,e,i){let n=1,o=1,s=0,r=0;if(e<$_){const a=t,l=a+e,c=Math.cos(a),h=Math.sin(a),d=Math.cos(l),u=Math.sin(l),p=(t,e,n)=>tw(t,a,l,!0)?1:Math.max(e,e*i,n,n*i),m=(t,e,n)=>tw(t,a,l,!0)?-1:Math.min(e,e*i,n,n*i),g=p(0,c,d),f=p(N_,h,u),v=m(O_,c,d),y=m(O_+N_,h,u);n=(g-v)/2,o=(f-y)/2,s=-(g+v)/2,r=-(f+y)/2}return{ratioX:n,ratioY:o,offsetX:s,offsetY:r}}(u,d,a),v=(i.width-s)/p,y=(i.height-s)/m,b=Math.max(Math.min(v,y)/2,0),x=v_(this.options.radius,b),_=(x-Math.max(x*a,0))/this._getVisibleDatasetWeightTotal();this.offsetX=g*x,this.offsetY=f*x,n.total=this.calculateTotal(),this.outerRadius=x-_*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-_*h,0),this.updateElements(o,0,o.length,t)}_circumference(t,e){const i=this.options,n=this._cachedMeta,o=this._getCircumference();return e&&i.animation.animateRotate||!this.chart.getDataVisibility(t)||null===n._parsed[t]||n.data[t].hidden?0:this.calculateCircumference(n._parsed[t]*o/$_)}updateElements(t,e,i,n){const o="reset"===n,s=this.chart,r=s.chartArea,a=s.options.animation,l=(r.left+r.right)/2,c=(r.top+r.bottom)/2,h=o&&a.animateScale,d=h?0:this.innerRadius,u=h?0:this.outerRadius,{sharedOptions:p,includeOptions:m}=this._getSharedOptions(e,n);let g,f=this._getRotation();for(g=0;g<e;++g)f+=this._circumference(g,o);for(g=e;g<e+i;++g){const e=this._circumference(g,o),i=t[g],s={x:l+this.offsetX,y:c+this.offsetY,startAngle:f,endAngle:f+e,circumference:e,outerRadius:u,innerRadius:d};m&&(s.options=p||this.resolveDataElementOptions(g,i.active?"active":n)),f+=e,this.updateElement(i,g,s,n)}}calculateTotal(){const t=this._cachedMeta,e=t.data;let i,n=0;for(i=0;i<e.length;i++){const o=t._parsed[i];null===o||isNaN(o)||!this.chart.getDataVisibility(i)||e[i].hidden||(n+=Math.abs(o))}return n}calculateCircumference(t){const e=this._cachedMeta.total;return e>0&&!isNaN(t)?$_*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,n=i.data.labels||[],o=Sw(e._parsed[t],i.options.locale);return{label:n[t]||"",value:o}}getMaxBorderWidth(t){let e=0;const i=this.chart;let n,o,s,r,a;if(!t)for(n=0,o=i.data.datasets.length;n<o;++n)if(i.isDatasetVisible(n)){s=i.getDatasetMeta(n),t=s.data,r=s.controller;break}if(!t)return 0;for(n=0,o=t.length;n<o;++n)a=r.resolveDataElementOptions(n),"inner"!==a.borderAlign&&(e=Math.max(e,a.borderWidth||0,a.hoverBorderWidth||0));return e}getMaxOffset(t){let e=0;for(let i=0,n=t.length;i<n;++i){const t=this.resolveDataElementOptions(i);e=Math.max(e,t.offset||0,t.hoverOffset||0)}return e}_getRingWeightOffset(t){let e=0;for(let i=0;i<t;++i)this.chart.isDatasetVisible(i)&&(e+=this._getRingWeight(i));return e}_getRingWeight(t){return Math.max(f_(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}class EC extends fC{static id="polarArea";static defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i,color:n}}=t.legend.options;return e.labels.map(((e,o)=>{const s=t.getDatasetMeta(0).controller.getStyle(o);return{text:e,fillStyle:s.backgroundColor,strokeStyle:s.borderColor,fontColor:n,lineWidth:s.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(o),index:o}}))}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,n=i.data.labels||[],o=Sw(e._parsed[t].r,i.options.locale);return{label:n[t]||"",value:o}}parseObjectData(t,e,i,n){return bk.bind(this)(t,e,i,n)}update(t){const e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){const t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach(((t,i)=>{const n=this.getParsed(i).r;!isNaN(n)&&this.chart.getDataVisibility(i)&&(n<e.min&&(e.min=n),n>e.max&&(e.max=n))})),e}_updateRadius(){const t=this.chart,e=t.chartArea,i=t.options,n=Math.min(e.right-e.left,e.bottom-e.top),o=Math.max(n/2,0),s=(o-Math.max(i.cutoutPercentage?o/100*i.cutoutPercentage:1,0))/t.getVisibleDatasetCount();this.outerRadius=o-s*this.index,this.innerRadius=this.outerRadius-s}updateElements(t,e,i,n){const o="reset"===n,s=this.chart,r=s.options.animation,a=this._cachedMeta.rScale,l=a.xCenter,c=a.yCenter,h=a.getIndexAngle(0)-.5*O_;let d,u=h;const p=360/this.countVisibleElements();for(d=0;d<e;++d)u+=this._computeAngle(d,n,p);for(d=e;d<e+i;d++){const e=t[d];let i=u,m=u+this._computeAngle(d,n,p),g=s.getDataVisibility(d)?a.getDistanceFromCenterForValue(this.getParsed(d).r):0;u=m,o&&(r.animateScale&&(g=0),r.animateRotate&&(i=m=h));const f={x:l,y:c,innerRadius:0,outerRadius:g,startAngle:i,endAngle:m,options:this.resolveDataElementOptions(d,e.active?"active":n)};this.updateElement(e,d,f,n)}}countVisibleElements(){const t=this._cachedMeta;let e=0;return t.data.forEach(((t,i)=>{!isNaN(this.getParsed(i).r)&&this.chart.getDataVisibility(i)&&e++})),e}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?G_(this.resolveDataElementOptions(t,e).angle||i):0}}var AC=Object.freeze({__proto__:null,BarController:class extends fC{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(t,e,i,n){return bC(t,e,i,n)}parseArrayData(t,e,i,n){return bC(t,e,i,n)}parseObjectData(t,e,i,n){const{iScale:o,vScale:s}=t,{xAxisKey:r="x",yAxisKey:a="y"}=this._parsing,l="x"===o.axis?r:a,c="x"===s.axis?r:a,h=[];let d,u,p,m;for(d=i,u=i+n;d<u;++d)m=e[d],p={},p[o.axis]=o.parse(M_(m,l),d),h.push(yC(M_(m,c),p,s,d));return h}updateRangeFromParsed(t,e,i,n){super.updateRangeFromParsed(t,e,i,n);const o=i._custom;o&&e===this._cachedMeta.vScale&&(t.min=Math.min(t.min,o.min),t.max=Math.max(t.max,o.max))}getMaxOverflow(){return 0}getLabelAndValue(t){const e=this._cachedMeta,{iScale:i,vScale:n}=e,o=this.getParsed(t),s=o._custom,r=xC(s)?"["+s.start+", "+s.end+"]":""+n.getLabelForValue(o[n.axis]);return{label:""+i.getLabelForValue(o[i.axis]),value:r}}initialize(){this.enableOptionSharing=!0,super.initialize();this._cachedMeta.stack=this.getDataset().stack}update(t){const e=this._cachedMeta;this.updateElements(e.data,0,e.data.length,t)}updateElements(t,e,i,n){const o="reset"===n,{index:s,_cachedMeta:{vScale:r}}=this,a=r.getBasePixel(),l=r.isHorizontal(),c=this._getRuler(),{sharedOptions:h,includeOptions:d}=this._getSharedOptions(e,n);for(let u=e;u<e+i;u++){const e=this.getParsed(u),i=o||d_(e[r.axis])?{base:a,head:a}:this._calculateBarValuePixels(u),p=this._calculateBarIndexPixels(u,c),m=(e._stacks||{})[r.axis],g={horizontal:l,base:i.base,enableBorderRadius:!m||xC(e._custom)||s===m._top||s===m._bottom,x:l?i.head:p.center,y:l?p.center:i.head,height:l?p.size:Math.abs(i.size),width:l?Math.abs(i.size):p.size};d&&(g.options=h||this.resolveDataElementOptions(u,t[u].active?"active":n));const f=g.options||t[u].options;_C(g,f,m,s),CC(g,f,c.ratio),this.updateElement(t[u],u,g,n)}}_getStacks(t,e){const{iScale:i}=this._cachedMeta,n=i.getMatchingVisibleMetas(this._type).filter((t=>t.controller.options.grouped)),o=i.options.stacked,s=[],r=this._cachedMeta.controller.getParsed(e),a=r&&r[i.axis],l=t=>{const e=t._parsed.find((t=>t[i.axis]===a)),n=e&&e[t.vScale.axis];if(d_(n)||isNaN(n))return!0};for(const i of n)if((void 0===e||!l(i))&&((!1===o||-1===s.indexOf(i.stack)||void 0===o&&void 0===i.stack)&&s.push(i.stack),i.index===t))break;return s.length||s.push(void 0),s}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,i){const n=this._getStacks(t,i),o=void 0!==e?n.indexOf(e):-1;return-1===o?n.length-1:o}_getRuler(){const t=this.options,e=this._cachedMeta,i=e.iScale,n=[];let o,s;for(o=0,s=e.data.length;o<s;++o)n.push(i.getPixelForValue(this.getParsed(o)[i.axis],o));const r=t.barThickness;return{min:r||vC(e),pixels:n,start:i._startPixel,end:i._endPixel,stackCount:this._getStackCount(),scale:i,grouped:t.grouped,ratio:r?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){const{_cachedMeta:{vScale:e,_stacked:i,index:n},options:{base:o,minBarLength:s}}=this,r=o||0,a=this.getParsed(t),l=a._custom,c=xC(l);let h,d,u=a[e.axis],p=0,m=i?this.applyStack(e,a,i):u;m!==u&&(p=m-u,m=u),c&&(u=l.barStart,m=l.barEnd-l.barStart,0!==u&&q_(u)!==q_(l.barEnd)&&(p=0),p+=u);const g=d_(o)||c?p:o;let f=e.getPixelForValue(g);if(h=this.chart.getDataVisibility(t)?e.getPixelForValue(p+m):f,d=h-f,Math.abs(d)<s){d=function(t,e,i){return 0!==t?q_(t):(e.isHorizontal()?1:-1)*(e.min>=i?1:-1)}(d,e,r)*s,u===r&&(f-=d/2);const t=e.getPixelForDecimal(0),o=e.getPixelForDecimal(1),l=Math.min(t,o),p=Math.max(t,o);f=Math.max(Math.min(f,p),l),h=f+d,i&&!c&&(a._stacks[e.axis]._visualValues[n]=e.getValueForPixel(h)-e.getValueForPixel(f))}if(f===e.getPixelForValue(r)){const t=q_(d)*e.getLineWidthForValue(r)/2;f+=t,d-=t}return{size:d,base:f,head:h,center:h+d/2}}_calculateBarIndexPixels(t,e){const i=e.scale,n=this.options,o=n.skipNull,s=f_(n.maxBarThickness,1/0);let r,a;if(e.grouped){const i=o?this._getStackCount(t):e.stackCount,l="flex"===n.barThickness?function(t,e,i,n){const o=e.pixels,s=o[t];let r=t>0?o[t-1]:null,a=t<o.length-1?o[t+1]:null;const l=i.categoryPercentage;null===r&&(r=s-(null===a?e.end-e.start:a-s)),null===a&&(a=s+s-r);const c=s-(s-Math.min(r,a))/2*l;return{chunk:Math.abs(a-r)/2*l/n,ratio:i.barPercentage,start:c}}(t,e,n,i):function(t,e,i,n){const o=i.barThickness;let s,r;return d_(o)?(s=e.min*i.categoryPercentage,r=i.barPercentage):(s=o*n,r=1),{chunk:s/n,ratio:r,start:e.pixels[t]-s/2}}(t,e,n,i),c=this._getStackIndex(this.index,this._cachedMeta.stack,o?t:void 0);r=l.start+l.chunk*c+l.chunk/2,a=Math.min(s,l.chunk*l.ratio)}else r=i.getPixelForValue(this.getParsed(t)[i.axis],t),a=Math.min(s,e.min*e.ratio);return{base:r-a/2,head:r+a/2,center:r,size:a}}draw(){const t=this._cachedMeta,e=t.vScale,i=t.data,n=i.length;let o=0;for(;o<n;++o)null===this.getParsed(o)[e.axis]||i[o].hidden||i[o].draw(this._ctx)}},BubbleController:class extends fC{static id="bubble";static defaults={datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}};static overrides={scales:{x:{type:"linear"},y:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,super.initialize()}parsePrimitiveData(t,e,i,n){const o=super.parsePrimitiveData(t,e,i,n);for(let t=0;t<o.length;t++)o[t]._custom=this.resolveDataElementOptions(t+i).radius;return o}parseArrayData(t,e,i,n){const o=super.parseArrayData(t,e,i,n);for(let t=0;t<o.length;t++){const n=e[i+t];o[t]._custom=f_(n[2],this.resolveDataElementOptions(t+i).radius)}return o}parseObjectData(t,e,i,n){const o=super.parseObjectData(t,e,i,n);for(let t=0;t<o.length;t++){const n=e[i+t];o[t]._custom=f_(n&&n.r&&+n.r,this.resolveDataElementOptions(t+i).radius)}return o}getMaxOverflow(){const t=this._cachedMeta.data;let e=0;for(let i=t.length-1;i>=0;--i)e=Math.max(e,t[i].size(this.resolveDataElementOptions(i))/2);return e>0&&e}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart.data.labels||[],{xScale:n,yScale:o}=e,s=this.getParsed(t),r=n.getLabelForValue(s.x),a=o.getLabelForValue(s.y),l=s._custom;return{label:i[t]||"",value:"("+r+", "+a+(l?", "+l:"")+")"}}update(t){const e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,i,n){const o="reset"===n,{iScale:s,vScale:r}=this._cachedMeta,{sharedOptions:a,includeOptions:l}=this._getSharedOptions(e,n),c=s.axis,h=r.axis;for(let d=e;d<e+i;d++){const e=t[d],i=!o&&this.getParsed(d),u={},p=u[c]=o?s.getPixelForDecimal(.5):s.getPixelForValue(i[c]),m=u[h]=o?r.getBasePixel():r.getPixelForValue(i[h]);u.skip=isNaN(p)||isNaN(m),l&&(u.options=a||this.resolveDataElementOptions(d,e.active?"active":n),o&&(u.options.radius=0)),this.updateElement(e,d,u,n)}}resolveDataElementOptions(t,e){const i=this.getParsed(t);let n=super.resolveDataElementOptions(t,e);n.$shared&&(n=Object.assign({},n,{$shared:!1}));const o=n.radius;return"active"!==e&&(n.radius=0),n.radius+=f_(i&&i._custom,o),n}},DoughnutController:SC,LineController:class extends fC{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(t){const e=this._cachedMeta,{dataset:i,data:n=[],_dataset:o}=e,s=this.chart._animationsDisabled;let{start:r,count:a}=pw(e,n,s);this._drawStart=r,this._drawCount=a,mw(e)&&(r=0,a=n.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!o._decimated,i.points=n;const l=this.resolveDatasetElementOptions(t);this.options.showLine||(l.borderWidth=0),l.segment=this.options.segment,this.updateElement(i,void 0,{animated:!s,options:l},t),this.updateElements(n,r,a,t)}updateElements(t,e,i,n){const o="reset"===n,{iScale:s,vScale:r,_stacked:a,_dataset:l}=this._cachedMeta,{sharedOptions:c,includeOptions:h}=this._getSharedOptions(e,n),d=s.axis,u=r.axis,{spanGaps:p,segment:m}=this.options,g=U_(p)?p:Number.POSITIVE_INFINITY,f=this.chart._animationsDisabled||o||"none"===n,v=e+i,y=t.length;let b=e>0&&this.getParsed(e-1);for(let i=0;i<y;++i){const p=t[i],y=f?p:{};if(i<e||i>=v){y.skip=!0;continue}const x=this.getParsed(i),_=d_(x[u]),w=y[d]=s.getPixelForValue(x[d],i),k=y[u]=o||_?r.getBasePixel():r.getPixelForValue(a?this.applyStack(r,x,a):x[u],i);y.skip=isNaN(w)||isNaN(k)||_,y.stop=i>0&&Math.abs(x[d]-b[d])>g,m&&(y.parsed=x,y.raw=l.data[i]),h&&(y.options=c||this.resolveDataElementOptions(i,p.active?"active":n)),f||this.updateElement(p,i,y,n),b=x}}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,i=e.options&&e.options.borderWidth||0,n=t.data||[];if(!n.length)return i;const o=n[0].size(this.resolveDataElementOptions(0)),s=n[n.length-1].size(this.resolveDataElementOptions(n.length-1));return Math.max(i,o,s)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}},PieController:class extends SC{static id="pie";static defaults={cutout:0,rotation:0,circumference:360,radius:"100%"}},PolarAreaController:EC,RadarController:class extends fC{static id="radar";static defaults={datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}};static overrides={aspectRatio:1,scales:{r:{type:"radialLinear"}}};getLabelAndValue(t){const e=this._cachedMeta.vScale,i=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(i[e.axis])}}parseObjectData(t,e,i,n){return bk.bind(this)(t,e,i,n)}update(t){const e=this._cachedMeta,i=e.dataset,n=e.data||[],o=e.iScale.getLabels();if(i.points=n,"resize"!==t){const e=this.resolveDatasetElementOptions(t);this.options.showLine||(e.borderWidth=0);const s={_loop:!0,_fullLoop:o.length===n.length,options:e};this.updateElement(i,void 0,s,t)}this.updateElements(n,0,n.length,t)}updateElements(t,e,i,n){const o=this._cachedMeta.rScale,s="reset"===n;for(let r=e;r<e+i;r++){const e=t[r],i=this.resolveDataElementOptions(r,e.active?"active":n),a=o.getPointPositionForValue(r,this.getParsed(r).r),l=s?o.xCenter:a.x,c=s?o.yCenter:a.y,h={x:l,y:c,angle:a.angle,skip:isNaN(l)||isNaN(c),options:i};this.updateElement(e,r,h,n)}}},ScatterController:class extends fC{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(t){const e=this._cachedMeta,i=this.chart.data.labels||[],{xScale:n,yScale:o}=e,s=this.getParsed(t),r=n.getLabelForValue(s.x),a=o.getLabelForValue(s.y);return{label:i[t]||"",value:"("+r+", "+a+")"}}update(t){const e=this._cachedMeta,{data:i=[]}=e,n=this.chart._animationsDisabled;let{start:o,count:s}=pw(e,i,n);if(this._drawStart=o,this._drawCount=s,mw(e)&&(o=0,s=i.length),this.options.showLine){this.datasetElementType||this.addElements();const{dataset:o,_dataset:s}=e;o._chart=this.chart,o._datasetIndex=this.index,o._decimated=!!s._decimated,o.points=i;const r=this.resolveDatasetElementOptions(t);r.segment=this.options.segment,this.updateElement(o,void 0,{animated:!n,options:r},t)}else this.datasetElementType&&(delete e.dataset,this.datasetElementType=!1);this.updateElements(i,o,s,t)}addElements(){const{showLine:t}=this.options;!this.datasetElementType&&t&&(this.datasetElementType=this.chart.registry.getElement("line")),super.addElements()}updateElements(t,e,i,n){const o="reset"===n,{iScale:s,vScale:r,_stacked:a,_dataset:l}=this._cachedMeta,c=this.resolveDataElementOptions(e,n),h=this.getSharedOptions(c),d=this.includeOptions(n,h),u=s.axis,p=r.axis,{spanGaps:m,segment:g}=this.options,f=U_(m)?m:Number.POSITIVE_INFINITY,v=this.chart._animationsDisabled||o||"none"===n;let y=e>0&&this.getParsed(e-1);for(let c=e;c<e+i;++c){const e=t[c],i=this.getParsed(c),m=v?e:{},b=d_(i[p]),x=m[u]=s.getPixelForValue(i[u],c),_=m[p]=o||b?r.getBasePixel():r.getPixelForValue(a?this.applyStack(r,i,a):i[p],c);m.skip=isNaN(x)||isNaN(_)||b,m.stop=c>0&&Math.abs(i[u]-y[u])>f,g&&(m.parsed=i,m.raw=l.data[c]),d&&(m.options=h||this.resolveDataElementOptions(c,e.active?"active":n)),v||this.updateElement(e,c,m,n),y=i}this.updateSharedOptions(h,n,c)}getMaxOverflow(){const t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let t=0;for(let i=e.length-1;i>=0;--i)t=Math.max(t,e[i].size(this.resolveDataElementOptions(i))/2);return t>0&&t}const i=t.dataset,n=i.options&&i.options.borderWidth||0;if(!e.length)return n;const o=e[0].size(this.resolveDataElementOptions(0)),s=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(n,o,s)/2}}});function MC(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class TC{static override(t){Object.assign(TC.prototype,t)}options;constructor(t){this.options=t||{}}init(){}formats(){return MC()}parse(){return MC()}format(){return MC()}add(){return MC()}diff(){return MC()}startOf(){return MC()}endOf(){return MC()}}var PC={_date:TC};function DC(t,e,i,n){const{controller:o,data:s,_sorted:r}=t,a=o._cachedMeta.iScale,l=t.dataset&&t.dataset.options?t.dataset.options.spanGaps:null;if(a&&e===a.axis&&"r"!==e&&r&&s.length){const r=a._reversePixels?sw:ow;if(!n){const n=r(s,e,i);if(l){const{vScale:e}=o._cachedMeta,{_parsed:i}=t,s=i.slice(0,n.lo+1).reverse().findIndex((t=>!d_(t[e.axis])));n.lo-=Math.max(0,s);const r=i.slice(n.hi).findIndex((t=>!d_(t[e.axis])));n.hi+=Math.max(0,r)}return n}if(o._sharedOptions){const t=s[0],n="function"==typeof t.getRange&&t.getRange(e);if(n){const t=r(s,e,i-n),o=r(s,e,i+n);return{lo:t.lo,hi:o.hi}}}}return{lo:0,hi:s.length-1}}function IC(t,e,i,n,o){const s=t.getSortedVisibleDatasetMetas(),r=i[e];for(let t=0,i=s.length;t<i;++t){const{index:i,data:a}=s[t],{lo:l,hi:c}=DC(s[t],e,r,o);for(let t=l;t<=c;++t){const e=a[t];e.skip||n(e,i,t)}}}function OC(t,e,i,n,o){const s=[];if(!o&&!t.isPointInArea(e))return s;return IC(t,i,e,(function(i,r,a){(o||Bw(i,t.chartArea,0))&&i.inRange(e.x,e.y,n)&&s.push({element:i,datasetIndex:r,index:a})}),!0),s}function $C(t,e,i,n,o,s){let r=[];const a=function(t){const e=-1!==t.indexOf("x"),i=-1!==t.indexOf("y");return function(t,n){const o=e?Math.abs(t.x-n.x):0,s=i?Math.abs(t.y-n.y):0;return Math.sqrt(Math.pow(o,2)+Math.pow(s,2))}}(i);let l=Number.POSITIVE_INFINITY;return IC(t,i,e,(function(i,c,h){const d=i.inRange(e.x,e.y,o);if(n&&!d)return;const u=i.getCenterPoint(o);if(!(!!s||t.isPointInArea(u))&&!d)return;const p=a(e,u);p<l?(r=[{element:i,datasetIndex:c,index:h}],l=p):p===l&&r.push({element:i,datasetIndex:c,index:h})})),r}function LC(t,e,i,n,o,s){return s||t.isPointInArea(e)?"r"!==i||n?$C(t,e,i,n,o,s):function(t,e,i,n){let o=[];return IC(t,i,e,(function(t,i,s){const{startAngle:r,endAngle:a}=t.getProps(["startAngle","endAngle"],n),{angle:l}=X_(t,{x:e.x,y:e.y});tw(l,r,a)&&o.push({element:t,datasetIndex:i,index:s})})),o}(t,e,i,o):[]}function zC(t,e,i,n,o){const s=[],r="x"===i?"inXRange":"inYRange";let a=!1;return IC(t,i,e,((t,n,l)=>{t[r]&&t[r](e[i],o)&&(s.push({element:t,datasetIndex:n,index:l}),a=a||t.inRange(e.x,e.y,o))})),n&&!a?[]:s}var RC={evaluateInteractionItems:IC,modes:{index(t,e,i,n){const o=$k(e,t),s=i.axis||"x",r=i.includeInvisible||!1,a=i.intersect?OC(t,o,s,n,r):LC(t,o,s,!1,n,r),l=[];return a.length?(t.getSortedVisibleDatasetMetas().forEach((t=>{const e=a[0].index,i=t.data[e];i&&!i.skip&&l.push({element:i,datasetIndex:t.index,index:e})})),l):[]},dataset(t,e,i,n){const o=$k(e,t),s=i.axis||"xy",r=i.includeInvisible||!1;let a=i.intersect?OC(t,o,s,n,r):LC(t,o,s,!1,n,r);if(a.length>0){const e=a[0].datasetIndex,i=t.getDatasetMeta(e).data;a=[];for(let t=0;t<i.length;++t)a.push({element:i[t],datasetIndex:e,index:t})}return a},point:(t,e,i,n)=>OC(t,$k(e,t),i.axis||"xy",n,i.includeInvisible||!1),nearest(t,e,i,n){const o=$k(e,t),s=i.axis||"xy",r=i.includeInvisible||!1;return LC(t,o,s,i.intersect,n,r)},x:(t,e,i,n)=>zC(t,$k(e,t),"x",i.intersect,n),y:(t,e,i,n)=>zC(t,$k(e,t),"y",i.intersect,n)}};const NC=["left","top","right","bottom"];function jC(t,e){return t.filter((t=>t.pos===e))}function BC(t,e){return t.filter((t=>-1===NC.indexOf(t.pos)&&t.box.axis===e))}function FC(t,e){return t.sort(((t,i)=>{const n=e?i:t,o=e?t:i;return n.weight===o.weight?n.index-o.index:n.weight-o.weight}))}function qC(t,e){const i=function(t){const e={};for(const i of t){const{stack:t,pos:n,stackWeight:o}=i;if(!t||!NC.includes(n))continue;const s=e[t]||(e[t]={count:0,placed:0,weight:0,size:0});s.count++,s.weight+=o}return e}(t),{vBoxMaxWidth:n,hBoxMaxHeight:o}=e;let s,r,a;for(s=0,r=t.length;s<r;++s){a=t[s];const{fullSize:r}=a.box,l=i[a.stack],c=l&&a.stackWeight/l.weight;a.horizontal?(a.width=c?c*n:r&&e.availableWidth,a.height=o):(a.width=n,a.height=c?c*o:r&&e.availableHeight)}return i}function VC(t,e,i,n){return Math.max(t[i],e[i])+Math.max(t[n],e[n])}function HC(t,e){t.top=Math.max(t.top,e.top),t.left=Math.max(t.left,e.left),t.bottom=Math.max(t.bottom,e.bottom),t.right=Math.max(t.right,e.right)}function UC(t,e,i,n){const{pos:o,box:s}=i,r=t.maxPadding;if(!p_(o)){i.size&&(t[o]-=i.size);const e=n[i.stack]||{size:0,count:1};e.size=Math.max(e.size,i.horizontal?s.height:s.width),i.size=e.size/e.count,t[o]+=i.size}s.getPadding&&HC(r,s.getPadding());const a=Math.max(0,e.outerWidth-VC(r,t,"left","right")),l=Math.max(0,e.outerHeight-VC(r,t,"top","bottom")),c=a!==t.w,h=l!==t.h;return t.w=a,t.h=l,i.horizontal?{same:c,other:h}:{same:h,other:c}}function WC(t,e){const i=e.maxPadding;function n(t){const n={left:0,top:0,right:0,bottom:0};return t.forEach((t=>{n[t]=Math.max(e[t],i[t])})),n}return n(t?["left","right"]:["top","bottom"])}function GC(t,e,i,n){const o=[];let s,r,a,l,c,h;for(s=0,r=t.length,c=0;s<r;++s){a=t[s],l=a.box,l.update(a.width||e.w,a.height||e.h,WC(a.horizontal,e));const{same:r,other:d}=UC(e,i,a,n);c|=r&&o.length,h=h||d,l.fullSize||o.push(a)}return c&&GC(o,e,i,n)||h}function ZC(t,e,i,n,o){t.top=i,t.left=e,t.right=e+n,t.bottom=i+o,t.width=n,t.height=o}function YC(t,e,i,n){const o=i.padding;let{x:s,y:r}=e;for(const a of t){const t=a.box,l=n[a.stack]||{count:1,placed:0,weight:1},c=a.stackWeight/l.weight||1;if(a.horizontal){const n=e.w*c,s=l.size||t.height;P_(l.start)&&(r=l.start),t.fullSize?ZC(t,o.left,r,i.outerWidth-o.right-o.left,s):ZC(t,e.left+l.placed,r,n,s),l.start=r,l.placed+=n,r=t.bottom}else{const n=e.h*c,r=l.size||t.width;P_(l.start)&&(s=l.start),t.fullSize?ZC(t,s,o.top,r,i.outerHeight-o.bottom-o.top):ZC(t,s,e.top+l.placed,r,n),l.start=s,l.placed+=n,s=t.right}}e.x=s,e.y=r}var XC={addBox(t,e){t.boxes||(t.boxes=[]),e.fullSize=e.fullSize||!1,e.position=e.position||"top",e.weight=e.weight||0,e._layers=e._layers||function(){return[{z:0,draw(t){e.draw(t)}}]},t.boxes.push(e)},removeBox(t,e){const i=t.boxes?t.boxes.indexOf(e):-1;-1!==i&&t.boxes.splice(i,1)},configure(t,e,i){e.fullSize=i.fullSize,e.position=i.position,e.weight=i.weight},update(t,e,i,n){if(!t)return;const o=ik(t.options.layout.padding),s=Math.max(e-o.width,0),r=Math.max(i-o.height,0),a=function(t){const e=function(t){const e=[];let i,n,o,s,r,a;for(i=0,n=(t||[]).length;i<n;++i)o=t[i],({position:s,options:{stack:r,stackWeight:a=1}}=o),e.push({index:i,box:o,pos:s,horizontal:o.isHorizontal(),weight:o.weight,stack:r&&s+r,stackWeight:a});return e}(t),i=FC(e.filter((t=>t.box.fullSize)),!0),n=FC(jC(e,"left"),!0),o=FC(jC(e,"right")),s=FC(jC(e,"top"),!0),r=FC(jC(e,"bottom")),a=BC(e,"x"),l=BC(e,"y");return{fullSize:i,leftAndTop:n.concat(s),rightAndBottom:o.concat(l).concat(r).concat(a),chartArea:jC(e,"chartArea"),vertical:n.concat(o).concat(l),horizontal:s.concat(r).concat(a)}}(t.boxes),l=a.vertical,c=a.horizontal;b_(t.boxes,(t=>{"function"==typeof t.beforeLayout&&t.beforeLayout()}));const h=l.reduce(((t,e)=>e.box.options&&!1===e.box.options.display?t:t+1),0)||1,d=Object.freeze({outerWidth:e,outerHeight:i,padding:o,availableWidth:s,availableHeight:r,vBoxMaxWidth:s/2/h,hBoxMaxHeight:r/2}),u=Object.assign({},o);HC(u,ik(n));const p=Object.assign({maxPadding:u,w:s,h:r,x:o.left,y:o.top},o),m=qC(l.concat(c),d);GC(a.fullSize,p,d,m),GC(l,p,d,m),GC(c,p,d,m)&&GC(l,p,d,m),function(t){const e=t.maxPadding;function i(i){const n=Math.max(e[i]-t[i],0);return t[i]+=n,n}t.y+=i("top"),t.x+=i("left"),i("right"),i("bottom")}(p),YC(a.leftAndTop,p,d,m),p.x+=p.w,p.y+=p.h,YC(a.rightAndBottom,p,d,m),t.chartArea={left:p.left,top:p.top,right:p.left+p.w,bottom:p.top+p.h,height:p.h,width:p.w},b_(a.chartArea,(e=>{const i=e.box;Object.assign(i,t.chartArea),i.update(p.w,p.h,{left:0,top:0,right:0,bottom:0})}))}};class KC{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,n){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,n?Math.floor(e/n):i)}}isAttached(t){return!0}updateConfig(t){}}class QC extends KC{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const JC="$chartjs",tS={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},eS=t=>null===t||""===t;const iS=!!Nk&&{passive:!0};function nS(t,e,i){t&&t.canvas&&t.canvas.removeEventListener(e,i,iS)}function oS(t,e){for(const i of t)if(i===e||i.contains(e))return!0}function sS(t,e,i){const n=t.canvas,o=new MutationObserver((t=>{let e=!1;for(const i of t)e=e||oS(i.addedNodes,n),e=e&&!oS(i.removedNodes,n);e&&i()}));return o.observe(document,{childList:!0,subtree:!0}),o}function rS(t,e,i){const n=t.canvas,o=new MutationObserver((t=>{let e=!1;for(const i of t)e=e||oS(i.removedNodes,n),e=e&&!oS(i.addedNodes,n);e&&i()}));return o.observe(document,{childList:!0,subtree:!0}),o}const aS=new Map;let lS=0;function cS(){const t=window.devicePixelRatio;t!==lS&&(lS=t,aS.forEach(((e,i)=>{i.currentDevicePixelRatio!==t&&e()})))}function hS(t,e,i){const n=t.canvas,o=n&&Mk(n);if(!o)return;const s=hw(((t,e)=>{const n=o.clientWidth;i(t,e),n<o.clientWidth&&i()}),window),r=new ResizeObserver((t=>{const e=t[0],i=e.contentRect.width,n=e.contentRect.height;0===i&&0===n||s(i,n)}));return r.observe(o),function(t,e){aS.size||window.addEventListener("resize",cS),aS.set(t,e)}(t,s),r}function dS(t,e,i){i&&i.disconnect(),"resize"===e&&function(t){aS.delete(t),aS.size||window.removeEventListener("resize",cS)}(t)}function uS(t,e,i){const n=t.canvas,o=hw((e=>{null!==t.ctx&&i(function(t,e){const i=tS[t.type]||t.type,{x:n,y:o}=$k(t,e);return{type:i,chart:e,native:t,x:void 0!==n?n:null,y:void 0!==o?o:null}}(e,t))}),t);return function(t,e,i){t&&t.addEventListener(e,i,iS)}(n,e,o),o}class pS extends KC{acquireContext(t,e){const i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(function(t,e){const i=t.style,n=t.getAttribute("height"),o=t.getAttribute("width");if(t[JC]={initial:{height:n,width:o,style:{display:i.display,height:i.height,width:i.width}}},i.display=i.display||"block",i.boxSizing=i.boxSizing||"border-box",eS(o)){const e=jk(t,"width");void 0!==e&&(t.width=e)}if(eS(n))if(""===t.style.height)t.height=t.width/(e||2);else{const e=jk(t,"height");void 0!==e&&(t.height=e)}}(t,e),i):null}releaseContext(t){const e=t.canvas;if(!e[JC])return!1;const i=e[JC].initial;["height","width"].forEach((t=>{const n=i[t];d_(n)?e.removeAttribute(t):e.setAttribute(t,n)}));const n=i.style||{};return Object.keys(n).forEach((t=>{e.style[t]=n[t]})),e.width=e.width,delete e[JC],!0}addEventListener(t,e,i){this.removeEventListener(t,e);const n=t.$proxies||(t.$proxies={}),o={attach:sS,detach:rS,resize:hS}[e]||uS;n[e]=o(t,e,i)}removeEventListener(t,e){const i=t.$proxies||(t.$proxies={}),n=i[e];if(!n)return;({attach:dS,detach:dS,resize:dS}[e]||nS)(t,e,n),i[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,n){return zk(t,e,i,n)}isAttached(t){const e=t&&Mk(t);return!(!e||!e.isConnected)}}let mS=class{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(t){const{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}hasValue(){return U_(this.x)&&U_(this.y)}getProps(t,e){const i=this.$animations;if(!e||!i)return this;const n={};return t.forEach((t=>{n[t]=i[t]&&i[t].active()?i[t]._to:this[t]})),n}};function gS(t,e){const i=t.options.ticks,n=function(t){const e=t.options.offset,i=t._tickSize(),n=t._length/i+(e?0:1),o=t._maxLength/i;return Math.floor(Math.min(n,o))}(t),o=Math.min(i.maxTicksLimit||n,n),s=i.major.enabled?function(t){const e=[];let i,n;for(i=0,n=t.length;i<n;i++)t[i].major&&e.push(i);return e}(e):[],r=s.length,a=s[0],l=s[r-1],c=[];if(r>o)return function(t,e,i,n){let o,s=0,r=i[0];for(n=Math.ceil(n),o=0;o<t.length;o++)o===r&&(e.push(t[o]),s++,r=i[s*n])}(e,c,s,r/o),c;const h=function(t,e,i){const n=function(t){const e=t.length;let i,n;if(e<2)return!1;for(n=t[0],i=1;i<e;++i)if(t[i]-t[i-1]!==n)return!1;return n}(t),o=e.length/i;if(!n)return Math.max(o,1);const s=function(t){const e=[],i=Math.sqrt(t);let n;for(n=1;n<i;n++)t%n==0&&(e.push(n),e.push(t/n));return i===(0|i)&&e.push(i),e.sort(((t,e)=>t-e)).pop(),e}(n);for(let t=0,e=s.length-1;t<e;t++){const e=s[t];if(e>o)return e}return Math.max(o,1)}(s,e,o);if(r>0){let t,i;const n=r>1?Math.round((l-a)/(r-1)):null;for(fS(e,c,h,d_(n)?0:a-n,a),t=0,i=r-1;t<i;t++)fS(e,c,h,s[t],s[t+1]);return fS(e,c,h,l,d_(n)?e.length:l+n),c}return fS(e,c,h),c}function fS(t,e,i,n,o){const s=f_(n,0),r=Math.min(f_(o,t.length),t.length);let a,l,c,h=0;for(i=Math.ceil(i),o&&(a=o-n,i=a/Math.floor(a/i)),c=s;c<0;)h++,c=Math.round(s+h*i);for(l=Math.max(s,0);l<r;l++)l===c&&(e.push(t[l]),h++,c=Math.round(s+h*i))}const vS=(t,e,i)=>"top"===e||"left"===e?t[e]+i:t[e]-i,yS=(t,e)=>Math.min(e||t,t);function bS(t,e){const i=[],n=t.length/e,o=t.length;let s=0;for(;s<o;s+=n)i.push(t[Math.floor(s)]);return i}function xS(t,e,i){const n=t.ticks.length,o=Math.min(e,n-1),s=t._startPixel,r=t._endPixel,a=1e-6;let l,c=t.getPixelForTick(o);if(!(i&&(l=1===n?Math.max(c-s,r-c):0===e?(t.getPixelForTick(1)-c)/2:(c-t.getPixelForTick(o-1))/2,c+=o<e?l:-l,c<s-a||c>r+a)))return c}function _S(t){return t.drawTicks?t.tickLength:0}function wS(t,e){if(!t.display)return 0;const i=nk(t.font,e),n=ik(t.padding);return(u_(t.text)?t.text.length:1)*i.lineHeight+n.height}function kS(t,e,i){let n=dw(t);return(i&&"right"!==e||!i&&"right"===e)&&(n=(t=>"left"===t?"right":"right"===t?"left":t)(n)),n}class CS extends mS{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,e){return t}getUserBounds(){let{_userMin:t,_userMax:e,_suggestedMin:i,_suggestedMax:n}=this;return t=g_(t,Number.POSITIVE_INFINITY),e=g_(e,Number.NEGATIVE_INFINITY),i=g_(i,Number.POSITIVE_INFINITY),n=g_(n,Number.NEGATIVE_INFINITY),{min:g_(t,i),max:g_(e,n),minDefined:m_(t),maxDefined:m_(e)}}getMinMax(t){let e,{min:i,max:n,minDefined:o,maxDefined:s}=this.getUserBounds();if(o&&s)return{min:i,max:n};const r=this.getMatchingVisibleMetas();for(let a=0,l=r.length;a<l;++a)e=r[a].controller.getMinMax(this,t),o||(i=Math.min(i,e.min)),s||(n=Math.max(n,e.max));return i=s&&i>n?n:i,n=o&&i>n?i:n,{min:g_(i,g_(n,i)),max:g_(n,g_(i,n))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){y_(this.options.beforeUpdate,[this])}update(t,e,i){const{beginAtZero:n,grace:o,ticks:s}=this.options,r=s.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=function(t,e,i){const{min:n,max:o}=t,s=v_(e,(o-n)/2),r=(t,e)=>i&&0===t?0:t+e;return{min:r(n,-Math.abs(s)),max:r(o,s)}}(this,o,n),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const a=r<this.ticks.length;this._convertTicksToLabels(a?bS(this.ticks,r):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),s.display&&(s.autoSkip||"auto"===s.source)&&(this.ticks=gS(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),a&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t,e,i=this.options.reverse;this.isHorizontal()?(t=this.left,e=this.right):(t=this.top,e=this.bottom,i=!i),this._startPixel=t,this._endPixel=e,this._reversePixels=i,this._length=e-t,this._alignToPixels=this.options.alignToPixels}afterUpdate(){y_(this.options.afterUpdate,[this])}beforeSetDimensions(){y_(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(){y_(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),y_(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){y_(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){const e=this.options.ticks;let i,n,o;for(i=0,n=t.length;i<n;i++)o=t[i],o.label=y_(e.callback,[o.value,i,t],this)}afterTickToLabelConversion(){y_(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){y_(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,e=t.ticks,i=yS(this.ticks.length,t.ticks.maxTicksLimit),n=e.minRotation||0,o=e.maxRotation;let s,r,a,l=n;if(!this._isVisible()||!e.display||n>=o||i<=1||!this.isHorizontal())return void(this.labelRotation=n);const c=this._getLabelSizes(),h=c.widest.width,d=c.highest.height,u=ew(this.chart.width-h,0,this.maxWidth);s=t.offset?this.maxWidth/i:u/(i-1),h+6>s&&(s=u/(i-(t.offset?.5:1)),r=this.maxHeight-_S(t.grid)-e.padding-wS(t.title,this.chart.options.font),a=Math.sqrt(h*h+d*d),l=Z_(Math.min(Math.asin(ew((c.highest.height+6)/s,-1,1)),Math.asin(ew(r/a,-1,1))-Math.asin(ew(d/a,-1,1)))),l=Math.max(n,Math.min(o,l))),this.labelRotation=l}afterCalculateLabelRotation(){y_(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){y_(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:i,title:n,grid:o}}=this,s=this._isVisible(),r=this.isHorizontal();if(s){const s=wS(n,e.options.font);if(r?(t.width=this.maxWidth,t.height=_S(o)+s):(t.height=this.maxHeight,t.width=_S(o)+s),i.display&&this.ticks.length){const{first:e,last:n,widest:o,highest:s}=this._getLabelSizes(),a=2*i.padding,l=G_(this.labelRotation),c=Math.cos(l),h=Math.sin(l);if(r){const e=i.mirror?0:h*o.width+c*s.height;t.height=Math.min(this.maxHeight,t.height+e+a)}else{const e=i.mirror?0:c*o.width+h*s.height;t.width=Math.min(this.maxWidth,t.width+e+a)}this._calculatePadding(e,n,h,c)}}this._handleMargins(),r?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,i,n){const{ticks:{align:o,padding:s},position:r}=this.options,a=0!==this.labelRotation,l="top"!==r&&"x"===this.axis;if(this.isHorizontal()){const r=this.getPixelForTick(0)-this.left,c=this.right-this.getPixelForTick(this.ticks.length-1);let h=0,d=0;a?l?(h=n*t.width,d=i*e.height):(h=i*t.height,d=n*e.width):"start"===o?d=e.width:"end"===o?h=t.width:"inner"!==o&&(h=t.width/2,d=e.width/2),this.paddingLeft=Math.max((h-r+s)*this.width/(this.width-r),0),this.paddingRight=Math.max((d-c+s)*this.width/(this.width-c),0)}else{let i=e.height/2,n=t.height/2;"start"===o?(i=0,n=t.height):"end"===o&&(i=e.height,n=0),this.paddingTop=i+s,this.paddingBottom=n+s}}_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(){y_(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:e}=this.options;return"top"===e||"bottom"===e||"x"===t}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){let e,i;for(this.beforeTickToLabelConversion(),this.generateTickLabels(t),e=0,i=t.length;e<i;e++)d_(t[e].label)&&(t.splice(e,1),i--,e--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){const e=this.options.ticks.sampleSize;let i=this.ticks;e<i.length&&(i=bS(i,e)),this._labelSizes=t=this._computeLabelSizes(i,i.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,e,i){const{ctx:n,_longestTextCache:o}=this,s=[],r=[],a=Math.floor(e/yS(e,i));let l,c,h,d,u,p,m,g,f,v,y,b=0,x=0;for(l=0;l<e;l+=a){if(d=t[l].label,u=this._resolveTickFontOptions(l),n.font=p=u.string,m=o[p]=o[p]||{data:{},gc:[]},g=u.lineHeight,f=v=0,d_(d)||u_(d)){if(u_(d))for(c=0,h=d.length;c<h;++c)y=d[c],d_(y)||u_(y)||(f=$w(n,m.data,m.gc,f,y),v+=g)}else f=$w(n,m.data,m.gc,f,d),v=g;s.push(f),r.push(v),b=Math.max(f,b),x=Math.max(v,x)}!function(t,e){b_(t,(t=>{const i=t.gc,n=i.length/2;let o;if(n>e){for(o=0;o<n;++o)delete t.data[i[o]];i.splice(0,n)}}))}(o,e);const _=s.indexOf(b),w=r.indexOf(x),k=t=>({width:s[t]||0,height:r[t]||0});return{first:k(0),last:k(e-1),widest:k(_),highest:k(w),widths:s,heights:r}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return ew(this._alignToPixels?zw(this.chart,e,0):e,-32768,32767)}getDecimalForPixel(t){const e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){const e=this.ticks||[];if(t>=0&&t<e.length){const i=e[t];return i.$context||(i.$context=function(t,e,i){return sk(t,{tick:i,index:e,type:"tick"})}(this.getContext(),t,i))}return this.$context||(this.$context=sk(this.chart.getContext(),{scale:this,type:"scale"}))}_tickSize(){const t=this.options.ticks,e=G_(this.labelRotation),i=Math.abs(Math.cos(e)),n=Math.abs(Math.sin(e)),o=this._getLabelSizes(),s=t.autoSkipPadding||0,r=o?o.widest.width+s:0,a=o?o.highest.height+s:0;return this.isHorizontal()?a*i>r*n?r/i:a/n:a*n<r*i?a/i:r/n}_isVisible(){const t=this.options.display;return"auto"!==t?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){const e=this.axis,i=this.chart,n=this.options,{grid:o,position:s,border:r}=n,a=o.offset,l=this.isHorizontal(),c=this.ticks.length+(a?1:0),h=_S(o),d=[],u=r.setContext(this.getContext()),p=u.display?u.width:0,m=p/2,g=function(t){return zw(i,t,p)};let f,v,y,b,x,_,w,k,C,S,E,A;if("top"===s)f=g(this.bottom),_=this.bottom-h,k=f-m,S=g(t.top)+m,A=t.bottom;else if("bottom"===s)f=g(this.top),S=t.top,A=g(t.bottom)-m,_=f+m,k=this.top+h;else if("left"===s)f=g(this.right),x=this.right-h,w=f-m,C=g(t.left)+m,E=t.right;else if("right"===s)f=g(this.left),C=t.left,E=g(t.right)-m,x=f+m,w=this.left+h;else if("x"===e){if("center"===s)f=g((t.top+t.bottom)/2+.5);else if(p_(s)){const t=Object.keys(s)[0],e=s[t];f=g(this.chart.scales[t].getPixelForValue(e))}S=t.top,A=t.bottom,_=f+m,k=_+h}else if("y"===e){if("center"===s)f=g((t.left+t.right)/2);else if(p_(s)){const t=Object.keys(s)[0],e=s[t];f=g(this.chart.scales[t].getPixelForValue(e))}x=f-m,w=x-h,C=t.left,E=t.right}const M=f_(n.ticks.maxTicksLimit,c),T=Math.max(1,Math.ceil(c/M));for(v=0;v<c;v+=T){const t=this.getContext(v),e=o.setContext(t),n=r.setContext(t),s=e.lineWidth,c=e.color,h=n.dash||[],u=n.dashOffset,p=e.tickWidth,m=e.tickColor,g=e.tickBorderDash||[],f=e.tickBorderDashOffset;y=xS(this,v,a),void 0!==y&&(b=zw(i,y,s),l?x=w=C=E=b:_=k=S=A=b,d.push({tx1:x,ty1:_,tx2:w,ty2:k,x1:C,y1:S,x2:E,y2:A,width:s,color:c,borderDash:h,borderDashOffset:u,tickWidth:p,tickColor:m,tickBorderDash:g,tickBorderDashOffset:f}))}return this._ticksLength=c,this._borderValue=f,d}_computeLabelItems(t){const e=this.axis,i=this.options,{position:n,ticks:o}=i,s=this.isHorizontal(),r=this.ticks,{align:a,crossAlign:l,padding:c,mirror:h}=o,d=_S(i.grid),u=d+c,p=h?-c:u,m=-G_(this.labelRotation),g=[];let f,v,y,b,x,_,w,k,C,S,E,A,M="middle";if("top"===n)_=this.bottom-p,w=this._getXAxisLabelAlignment();else if("bottom"===n)_=this.top+p,w=this._getXAxisLabelAlignment();else if("left"===n){const t=this._getYAxisLabelAlignment(d);w=t.textAlign,x=t.x}else if("right"===n){const t=this._getYAxisLabelAlignment(d);w=t.textAlign,x=t.x}else if("x"===e){if("center"===n)_=(t.top+t.bottom)/2+u;else if(p_(n)){const t=Object.keys(n)[0],e=n[t];_=this.chart.scales[t].getPixelForValue(e)+u}w=this._getXAxisLabelAlignment()}else if("y"===e){if("center"===n)x=(t.left+t.right)/2-u;else if(p_(n)){const t=Object.keys(n)[0],e=n[t];x=this.chart.scales[t].getPixelForValue(e)}w=this._getYAxisLabelAlignment(d).textAlign}"y"===e&&("start"===a?M="top":"end"===a&&(M="bottom"));const T=this._getLabelSizes();for(f=0,v=r.length;f<v;++f){y=r[f],b=y.label;const t=o.setContext(this.getContext(f));k=this.getPixelForTick(f)+o.labelOffset,C=this._resolveTickFontOptions(f),S=C.lineHeight,E=u_(b)?b.length:1;const e=E/2,i=t.color,a=t.textStrokeColor,c=t.textStrokeWidth;let d,u=w;if(s?(x=k,"inner"===w&&(u=f===v-1?this.options.reverse?"left":"right":0===f?this.options.reverse?"right":"left":"center"),A="top"===n?"near"===l||0!==m?-E*S+S/2:"center"===l?-T.highest.height/2-e*S+S:-T.highest.height+S/2:"near"===l||0!==m?S/2:"center"===l?T.highest.height/2-e*S:T.highest.height-E*S,h&&(A*=-1),0===m||t.showLabelBackdrop||(x+=S/2*Math.sin(m))):(_=k,A=(1-E)*S/2),t.showLabelBackdrop){const e=ik(t.backdropPadding),i=T.heights[f],n=T.widths[f];let o=A-e.top,s=0-e.left;switch(M){case"middle":o-=i/2;break;case"bottom":o-=i}switch(w){case"center":s-=n/2;break;case"right":s-=n;break;case"inner":f===v-1?s-=n:f>0&&(s-=n/2)}d={left:s,top:o,width:n+e.width,height:i+e.height,color:t.backdropColor}}g.push({label:b,font:C,textOffset:A,options:{rotation:m,color:i,strokeColor:a,strokeWidth:c,textAlign:u,textBaseline:M,translation:[x,_],backdrop:d}})}return g}_getXAxisLabelAlignment(){const{position:t,ticks:e}=this.options;if(-G_(this.labelRotation))return"top"===t?"left":"right";let i="center";return"start"===e.align?i="left":"end"===e.align?i="right":"inner"===e.align&&(i="inner"),i}_getYAxisLabelAlignment(t){const{position:e,ticks:{crossAlign:i,mirror:n,padding:o}}=this.options,s=t+o,r=this._getLabelSizes().widest.width;let a,l;return"left"===e?n?(l=this.right+o,"near"===i?a="left":"center"===i?(a="center",l+=r/2):(a="right",l+=r)):(l=this.right-s,"near"===i?a="right":"center"===i?(a="center",l-=r/2):(a="left",l=this.left)):"right"===e?n?(l=this.left+o,"near"===i?a="right":"center"===i?(a="center",l-=r/2):(a="left",l-=r)):(l=this.left+s,"near"===i?a="left":"center"===i?(a="center",l+=r/2):(a="right",l=this.right)):a="right",{textAlign:a,x:l}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,e=this.options.position;return"left"===e||"right"===e?{top:0,left:this.left,bottom:t.height,right:this.right}:"top"===e||"bottom"===e?{top:this.top,left:0,bottom:this.bottom,right:t.width}:void 0}drawBackground(){const{ctx:t,options:{backgroundColor:e},left:i,top:n,width:o,height:s}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(i,n,o,s),t.restore())}getLineWidthForValue(t){const e=this.options.grid;if(!this._isVisible()||!e.display)return 0;const i=this.ticks.findIndex((e=>e.value===t));if(i>=0){return e.setContext(this.getContext(i)).lineWidth}return 0}drawGrid(t){const e=this.options.grid,i=this.ctx,n=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let o,s;const r=(t,e,n)=>{n.width&&n.color&&(i.save(),i.lineWidth=n.width,i.strokeStyle=n.color,i.setLineDash(n.borderDash||[]),i.lineDashOffset=n.borderDashOffset,i.beginPath(),i.moveTo(t.x,t.y),i.lineTo(e.x,e.y),i.stroke(),i.restore())};if(e.display)for(o=0,s=n.length;o<s;++o){const t=n[o];e.drawOnChartArea&&r({x:t.x1,y:t.y1},{x:t.x2,y:t.y2},t),e.drawTicks&&r({x:t.tx1,y:t.ty1},{x:t.tx2,y:t.ty2},{color:t.tickColor,width:t.tickWidth,borderDash:t.tickBorderDash,borderDashOffset:t.tickBorderDashOffset})}}drawBorder(){const{chart:t,ctx:e,options:{border:i,grid:n}}=this,o=i.setContext(this.getContext()),s=i.display?o.width:0;if(!s)return;const r=n.setContext(this.getContext(0)).lineWidth,a=this._borderValue;let l,c,h,d;this.isHorizontal()?(l=zw(t,this.left,s)-s/2,c=zw(t,this.right,r)+r/2,h=d=a):(h=zw(t,this.top,s)-s/2,d=zw(t,this.bottom,r)+r/2,l=c=a),e.save(),e.lineWidth=o.width,e.strokeStyle=o.color,e.beginPath(),e.moveTo(l,h),e.lineTo(c,d),e.stroke(),e.restore()}drawLabels(t){if(!this.options.ticks.display)return;const e=this.ctx,i=this._computeLabelArea();i&&Fw(e,i);const n=this.getLabelItems(t);for(const t of n){const i=t.options,n=t.font;Gw(e,t.label,0,t.textOffset,n,i)}i&&qw(e)}drawTitle(){const{ctx:t,options:{position:e,title:i,reverse:n}}=this;if(!i.display)return;const o=nk(i.font),s=ik(i.padding),r=i.align;let a=o.lineHeight/2;"bottom"===e||"center"===e||p_(e)?(a+=s.bottom,u_(i.text)&&(a+=o.lineHeight*(i.text.length-1))):a+=s.top;const{titleX:l,titleY:c,maxWidth:h,rotation:d}=function(t,e,i,n){const{top:o,left:s,bottom:r,right:a,chart:l}=t,{chartArea:c,scales:h}=l;let d,u,p,m=0;const g=r-o,f=a-s;if(t.isHorizontal()){if(u=uw(n,s,a),p_(i)){const t=Object.keys(i)[0],n=i[t];p=h[t].getPixelForValue(n)+g-e}else p="center"===i?(c.bottom+c.top)/2+g-e:vS(t,i,e);d=a-s}else{if(p_(i)){const t=Object.keys(i)[0],n=i[t];u=h[t].getPixelForValue(n)-f+e}else u="center"===i?(c.left+c.right)/2-f+e:vS(t,i,e);p=uw(n,r,o),m="left"===i?-N_:N_}return{titleX:u,titleY:p,maxWidth:d,rotation:m}}(this,a,e,r);Gw(t,i.text,0,0,o,{color:i.color,maxWidth:h,rotation:d,textAlign:kS(r,e,n),textBaseline:"middle",translation:[l,c]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){const t=this.options,e=t.ticks&&t.ticks.z||0,i=f_(t.grid&&t.grid.z,-1),n=f_(t.border&&t.border.z,0);return this._isVisible()&&this.draw===CS.prototype.draw?[{z:i,draw:t=>{this.drawBackground(),this.drawGrid(t),this.drawTitle()}},{z:n,draw:()=>{this.drawBorder()}},{z:e,draw:t=>{this.drawLabels(t)}}]:[{z:e,draw:t=>{this.draw(t)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",n=[];let o,s;for(o=0,s=e.length;o<s;++o){const s=e[o];s[i]!==this.id||t&&s.type!==t||n.push(s)}return n}_resolveTickFontOptions(t){return nk(this.options.ticks.setContext(this.getContext(t)).font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class SS{constructor(t,e,i){this.type=t,this.scope=e,this.override=i,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){const e=Object.getPrototypeOf(t);let i;(function(t){return"id"in t&&"defaults"in t})(e)&&(i=this.register(e));const n=this.items,o=t.id,s=this.scope+"."+o;if(!o)throw new Error("class does not have id: "+t);return o in n||(n[o]=t,function(t,e,i){const n=C_(Object.create(null),[i?Ow.get(i):{},Ow.get(e),t.defaults]);Ow.set(e,n),t.defaultRoutes&&function(t,e){Object.keys(e).forEach((i=>{const n=i.split("."),o=n.pop(),s=[t].concat(n).join("."),r=e[i].split("."),a=r.pop(),l=r.join(".");Ow.route(s,o,l,a)}))}(e,t.defaultRoutes);t.descriptors&&Ow.describe(e,t.descriptors)}(t,s,i),this.override&&Ow.override(t.id,t.overrides)),s}get(t){return this.items[t]}unregister(t){const e=this.items,i=t.id,n=this.scope;i in e&&delete e[i],n&&i in Ow[n]&&(delete Ow[n][i],this.override&&delete Mw[i])}}class ES{constructor(){this.controllers=new SS(fC,"datasets",!0),this.elements=new SS(mS,"elements"),this.plugins=new SS(Object,"plugins"),this.scales=new SS(CS,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,i){[...e].forEach((e=>{const n=i||this._getRegistryForType(e);i||n.isForType(e)||n===this.plugins&&e.id?this._exec(t,n,e):b_(e,(e=>{const n=i||this._getRegistryForType(e);this._exec(t,n,e)}))}))}_exec(t,e,i){const n=T_(t);y_(i["before"+n],[],i),e[t](i),y_(i["after"+n],[],i)}_getRegistryForType(t){for(let e=0;e<this._typedRegistries.length;e++){const i=this._typedRegistries[e];if(i.isForType(t))return i}return this.plugins}_get(t,e,i){const n=e.get(t);if(void 0===n)throw new Error('"'+t+'" is not a registered '+i+".");return n}}var AS=new ES;class MS{constructor(){this._init=[]}notify(t,e,i,n){"beforeInit"===e&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install"));const o=n?this._descriptors(t).filter(n):this._descriptors(t),s=this._notify(o,t,e,i);return"afterDestroy"===e&&(this._notify(o,t,"stop"),this._notify(this._init,t,"uninstall")),s}_notify(t,e,i,n){n=n||{};for(const o of t){const t=o.plugin;if(!1===y_(t[i],[e,n,o.options],t)&&n.cancelable)return!1}return!0}invalidate(){d_(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const e=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),e}_createDescriptors(t,e){const i=t&&t.config,n=f_(i.options&&i.options.plugins,{}),o=function(t){const e={},i=[],n=Object.keys(AS.plugins.items);for(let t=0;t<n.length;t++)i.push(AS.getPlugin(n[t]));const o=t.plugins||[];for(let t=0;t<o.length;t++){const n=o[t];-1===i.indexOf(n)&&(i.push(n),e[n.id]=!0)}return{plugins:i,localIds:e}}(i);return!1!==n||e?function(t,{plugins:e,localIds:i},n,o){const s=[],r=t.getContext();for(const a of e){const e=a.id,l=TS(n[e],o);null!==l&&s.push({plugin:a,options:PS(t.config,{plugin:a,local:i[e]},l,r)})}return s}(t,o,n,e):[]}_notifyStateChanges(t){const e=this._oldCache||[],i=this._cache,n=(t,e)=>t.filter((t=>!e.some((e=>t.plugin.id===e.plugin.id))));this._notify(n(e,i),t,"stop"),this._notify(n(i,e),t,"start")}}function TS(t,e){return e||!1!==t?!0===t?{}:t:null}function PS(t,{plugin:e,local:i},n,o){const s=t.pluginScopeKeys(e),r=t.getOptionScopes(n,s);return i&&e.defaults&&r.push(e.defaults),t.createResolver(r,o,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function DS(t,e){const i=Ow.datasets[t]||{};return((e.datasets||{})[t]||{}).indexAxis||e.indexAxis||i.indexAxis||"x"}function IS(t){if("x"===t||"y"===t||"r"===t)return t}function OS(t,...e){if(IS(t))return t;for(const n of e){const e=n.axis||("top"===(i=n.position)||"bottom"===i?"x":"left"===i||"right"===i?"y":void 0)||t.length>1&&IS(t[0].toLowerCase());if(e)return e}var i;throw new Error(`Cannot determine type of '${t}' axis. Please provide 'axis' or 'position' option.`)}function $S(t,e,i){if(i[e+"AxisID"]===t)return{axis:e}}function LS(t,e){const i=Mw[t.type]||{scales:{}},n=e.scales||{},o=DS(t.type,e),s=Object.create(null);return Object.keys(n).forEach((e=>{const r=n[e];if(!p_(r))return console.error(`Invalid scale configuration for scale: ${e}`);if(r._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${e}`);const a=OS(e,r,function(t,e){if(e.data&&e.data.datasets){const i=e.data.datasets.filter((e=>e.xAxisID===t||e.yAxisID===t));if(i.length)return $S(t,"x",i[0])||$S(t,"y",i[0])}return{}}(e,t),Ow.scales[r.type]),l=function(t,e){return t===e?"_index_":"_value_"}(a,o),c=i.scales||{};s[e]=S_(Object.create(null),[{axis:a},r,c[a],c[l]])})),t.data.datasets.forEach((i=>{const o=i.type||t.type,r=i.indexAxis||DS(o,e),a=(Mw[o]||{}).scales||{};Object.keys(a).forEach((t=>{const e=function(t,e){let i=t;return"_index_"===t?i=e:"_value_"===t&&(i="x"===e?"y":"x"),i}(t,r),o=i[e+"AxisID"]||e;s[o]=s[o]||Object.create(null),S_(s[o],[{axis:e},n[o],a[t]])}))})),Object.keys(s).forEach((t=>{const e=s[t];S_(e,[Ow.scales[e.type],Ow.scale])})),s}function zS(t){const e=t.options||(t.options={});e.plugins=f_(e.plugins,{}),e.scales=LS(t,e)}function RS(t){return(t=t||{}).datasets=t.datasets||[],t.labels=t.labels||[],t}const NS=new Map,jS=new Set;function BS(t,e){let i=NS.get(t);return i||(i=e(),NS.set(t,i),jS.add(i)),i}const FS=(t,e,i)=>{const n=M_(e,i);void 0!==n&&t.add(n)};class qS{constructor(t){this._config=function(t){return(t=t||{}).data=RS(t.data),zS(t),t}(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=RS(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),zS(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return BS(t,(()=>[[`datasets.${t}`,""]]))}datasetAnimationScopeKeys(t,e){return BS(`${t}.transition.${e}`,(()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]]))}datasetElementScopeKeys(t,e){return BS(`${t}-${e}`,(()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]]))}pluginScopeKeys(t){const e=t.id;return BS(`${this.type}-plugin-${e}`,(()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]]))}_cachedScopes(t,e){const i=this._scopeCache;let n=i.get(t);return n&&!e||(n=new Map,i.set(t,n)),n}getOptionScopes(t,e,i){const{options:n,type:o}=this,s=this._cachedScopes(t,i),r=s.get(e);if(r)return r;const a=new Set;e.forEach((e=>{t&&(a.add(t),e.forEach((e=>FS(a,t,e)))),e.forEach((t=>FS(a,n,t))),e.forEach((t=>FS(a,Mw[o]||{},t))),e.forEach((t=>FS(a,Ow,t))),e.forEach((t=>FS(a,Tw,t)))}));const l=Array.from(a);return 0===l.length&&l.push(Object.create(null)),jS.has(e)&&s.set(e,l),l}chartOptionScopes(){const{options:t,type:e}=this;return[t,Mw[e]||{},Ow.datasets[e]||{},{type:e},Ow,Tw]}resolveNamedOptions(t,e,i,n=[""]){const o={$shared:!0},{resolver:s,subPrefixes:r}=VS(this._resolverCache,t,n);let a=s;if(function(t,e){const{isScriptable:i,isIndexable:n}=lk(t);for(const o of e){const e=i(o),s=n(o),r=(s||e)&&t[o];if(e&&(D_(r)||HS(r))||s&&u_(r))return!0}return!1}(s,e)){o.$shared=!1;a=ak(s,i=D_(i)?i():i,this.createResolver(t,i,r))}for(const t of e)o[t]=a[t];return o}createResolver(t,e,i=[""],n){const{resolver:o}=VS(this._resolverCache,t,i);return p_(e)?ak(o,e,void 0,n):o}}function VS(t,e,i){let n=t.get(e);n||(n=new Map,t.set(e,n));const o=i.join();let s=n.get(o);if(!s){s={resolver:rk(e,i),subPrefixes:i.filter((t=>!t.toLowerCase().includes("hover")))},n.set(o,s)}return s}const HS=t=>p_(t)&&Object.getOwnPropertyNames(t).some((e=>D_(t[e])));const US=["top","bottom","left","right","chartArea"];function WS(t,e){return"top"===t||"bottom"===t||-1===US.indexOf(t)&&"x"===e}function GS(t,e){return function(i,n){return i[t]===n[t]?i[e]-n[e]:i[t]-n[t]}}function ZS(t){const e=t.chart,i=e.options.animation;e.notifyPlugins("afterRender"),y_(i&&i.onComplete,[t],e)}function YS(t){const e=t.chart,i=e.options.animation;y_(i&&i.onProgress,[t],e)}function XS(t){return Ak()&&"string"==typeof t?t=document.getElementById(t):t&&t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t}const KS={},QS=t=>{const e=XS(t);return Object.values(KS).filter((t=>t.canvas===e)).pop()};function JS(t,e,i){const n=Object.keys(t);for(const o of n){const n=+o;if(n>=e){const s=t[o];delete t[o],(i>0||n>e)&&(t[n+i]=s)}}}function tE(t,e,i){return t.options.clip?t[i]:e[i]}class eE{static defaults=Ow;static instances=KS;static overrides=Mw;static registry=AS;static version="4.4.8";static getChart=QS;static register(...t){AS.add(...t),iE()}static unregister(...t){AS.remove(...t),iE()}constructor(t,e){const i=this.config=new qS(e),n=XS(t),o=QS(n);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const s=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||function(t){return!Ak()||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas?QC:pS}(n)),this.platform.updateConfig(i);const r=this.platform.acquireContext(n,s.aspectRatio),a=r&&r.canvas,l=a&&a.height,c=a&&a.width;this.id=h_(),this.ctx=r,this.canvas=a,this.width=c,this.height=l,this._options=s,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 MS,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=function(t,e){let i;return function(...n){return e?(clearTimeout(i),i=setTimeout(t,e,n)):t.apply(this,n),e}}((t=>this.update(t)),s.resizeDelay||0),this._dataChanges=[],KS[this.id]=this,r&&a?(tC.listen(this,"complete",ZS),tC.listen(this,"progress",YS),this._initialize(),this.attached&&this.update()):console.error("Failed to create chart: can't acquire context from the given item")}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:n,_aspectRatio:o}=this;return d_(t)?e&&o?o:n?i/n:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return AS}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():Rk(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return Rw(this.canvas,this.ctx),this}stop(){return tC.stop(this),this}resize(t,e){tC.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const i=this.options,n=this.canvas,o=i.maintainAspectRatio&&this.aspectRatio,s=this.platform.getMaximumSize(n,t,e,o),r=i.devicePixelRatio||this.platform.getDevicePixelRatio(),a=this.width?"resize":"attach";this.width=s.width,this.height=s.height,this._aspectRatio=this.aspectRatio,Rk(this,r,!0)&&(this.notifyPlugins("resize",{size:s}),y_(i.onResize,[this,s],this),this.attached&&this._doResize(a)&&this.render())}ensureScalesHaveIDs(){b_(this.options.scales||{},((t,e)=>{t.id=e}))}buildOrUpdateScales(){const t=this.options,e=t.scales,i=this.scales,n=Object.keys(i).reduce(((t,e)=>(t[e]=!1,t)),{});let o=[];e&&(o=o.concat(Object.keys(e).map((t=>{const i=e[t],n=OS(t,i),o="r"===n,s="x"===n;return{options:i,dposition:o?"chartArea":s?"bottom":"left",dtype:o?"radialLinear":s?"category":"linear"}})))),b_(o,(e=>{const o=e.options,s=o.id,r=OS(s,o),a=f_(o.type,e.dtype);void 0!==o.position&&WS(o.position,r)===WS(e.dposition)||(o.position=e.dposition),n[s]=!0;let l=null;if(s in i&&i[s].type===a)l=i[s];else{l=new(AS.getScale(a))({id:s,type:a,ctx:this.ctx,chart:this}),i[l.id]=l}l.init(o,t)})),b_(n,((t,e)=>{t||delete i[e]})),b_(i,(t=>{XC.configure(this,t,t.options),XC.addBox(this,t)}))}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,i=t.length;if(t.sort(((t,e)=>t.index-e.index)),i>e){for(let t=e;t<i;++t)this._destroyDatasetMeta(t);t.splice(e,i-e)}this._sortedMetasets=t.slice(0).sort(GS("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:e}}=this;t.length>e.length&&delete this._stacks,t.forEach(((t,i)=>{0===e.filter((e=>e===t._dataset)).length&&this._destroyDatasetMeta(i)}))}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let i,n;for(this._removeUnreferencedMetasets(),i=0,n=e.length;i<n;i++){const n=e[i];let o=this.getDatasetMeta(i);const s=n.type||this.config.type;if(o.type&&o.type!==s&&(this._destroyDatasetMeta(i),o=this.getDatasetMeta(i)),o.type=s,o.indexAxis=n.indexAxis||DS(s,this.options),o.order=n.order||0,o.index=i,o.label=""+n.label,o.visible=this.isDatasetVisible(i),o.controller)o.controller.updateIndex(i),o.controller.linkScales();else{const e=AS.getController(s),{datasetElementType:n,dataElementType:r}=Ow.datasets[s];Object.assign(e,{dataElementType:AS.getElement(r),datasetElementType:n&&AS.getElement(n)}),o.controller=new e(this,i),t.push(o.controller)}}return this._updateMetasets(),t}_resetElements(){b_(this.data.datasets,((t,e)=>{this.getDatasetMeta(e).controller.reset()}),this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this.config;e.update();const i=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),n=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),!1===this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0}))return;const o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let s=0;for(let t=0,e=this.data.datasets.length;t<e;t++){const{controller:e}=this.getDatasetMeta(t),i=!n&&-1===o.indexOf(e);e.buildOrUpdateElements(i),s=Math.max(+e.getMaxOverflow(),s)}s=this._minPadding=i.layout.autoPadding?s:0,this._updateLayout(s),n||b_(o,(t=>{t.reset()})),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(GS("z","_idx"));const{_active:r,_lastEvent:a}=this;a?this._eventHandler(a,!0):r.length&&this._updateHoverStyles(r,r,!0),this.render()}_updateScales(){b_(this.scales,(t=>{XC.removeBox(this,t)})),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);I_(e,i)&&!!this._responsiveListeners===t.responsive||(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:i,start:n,count:o}of e){JS(t,n,"_removeElements"===i?-o:o)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,i=e=>new Set(t.filter((t=>t[0]===e)).map(((t,e)=>e+","+t.splice(1).join(",")))),n=i(0);for(let t=1;t<e;t++)if(!I_(n,i(t)))return;return Array.from(n).map((t=>t.split(","))).map((t=>({method:t[1],start:+t[2],count:+t[3]})))}_updateLayout(t){if(!1===this.notifyPlugins("beforeLayout",{cancelable:!0}))return;XC.update(this,this.width,this.height,t);const e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],b_(this.boxes,(t=>{i&&"chartArea"===t.position||(t.configure&&t.configure(),this._layers.push(...t._layers()))}),this),this._layers.forEach(((t,e)=>{t._idx=e})),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(!1!==this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})){for(let t=0,e=this.data.datasets.length;t<e;++t)this.getDatasetMeta(t).controller.configure();for(let e=0,i=this.data.datasets.length;e<i;++e)this._updateDataset(e,D_(t)?t({datasetIndex:e}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,e){const i=this.getDatasetMeta(t),n={meta:i,index:t,mode:e,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetUpdate",n)&&(i.controller._update(e),n.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",n))}render(){!1!==this.notifyPlugins("beforeRender",{cancelable:!0})&&(tC.has(this)?this.attached&&!tC.running(this)&&tC.start(this):(this.draw(),ZS({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:t,height:e}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(t,e)}if(this.clear(),this.width<=0||this.height<=0)return;if(!1===this.notifyPlugins("beforeDraw",{cancelable:!0}))return;const e=this._layers;for(t=0;t<e.length&&e[t].z<=0;++t)e[t].draw(this.chartArea);for(this._drawDatasets();t<e.length;++t)e[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const e=this._sortedMetasets,i=[];let n,o;for(n=0,o=e.length;n<o;++n){const o=e[n];t&&!o.visible||i.push(o)}return i}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(!1===this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0}))return;const t=this.getSortedVisibleDatasetMetas();for(let e=t.length-1;e>=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,i=t._clip,n=!i.disabled,o=function(t,e){const{xScale:i,yScale:n}=t;return i&&n?{left:tE(i,e,"left"),right:tE(i,e,"right"),top:tE(n,e,"top"),bottom:tE(n,e,"bottom")}:e}(t,this.chartArea),s={meta:t,index:t.index,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetDraw",s)&&(n&&Fw(e,{left:!1===i.left?0:o.left-i.left,right:!1===i.right?this.width:o.right+i.right,top:!1===i.top?0:o.top-i.top,bottom:!1===i.bottom?this.height:o.bottom+i.bottom}),t.controller.draw(),n&&qw(e),s.cancelable=!1,this.notifyPlugins("afterDatasetDraw",s))}isPointInArea(t){return Bw(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,i,n){const o=RC.modes[e];return"function"==typeof o?o(this,t,i,n):[]}getDatasetMeta(t){const e=this.data.datasets[t],i=this._metasets;let n=i.filter((t=>t&&t._dataset===e)).pop();return n||(n={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},i.push(n)),n}getContext(){return this.$context||(this.$context=sk(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const i=this.getDatasetMeta(t);return"boolean"==typeof i.hidden?!i.hidden:!e.hidden}setDatasetVisibility(t,e){this.getDatasetMeta(t).hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,i){const n=i?"show":"hide",o=this.getDatasetMeta(t),s=o.controller._resolveAnimations(void 0,n);P_(e)?(o.data[e].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),s.update(o,{visible:i}),this.update((e=>e.datasetIndex===t?n:void 0)))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),tC.remove(this),t=0,e=this.data.datasets.length;t<e;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:t,ctx:e}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),Rw(t,e),this.platform.releaseContext(e),this.canvas=null,this.ctx=null),delete KS[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const t=this._listeners,e=this.platform,i=(i,n)=>{e.addEventListener(this,i,n),t[i]=n},n=(t,e,i)=>{t.offsetX=e,t.offsetY=i,this._eventHandler(t)};b_(this.options.events,(t=>i(t,n)))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,i=(i,n)=>{e.addEventListener(this,i,n),t[i]=n},n=(i,n)=>{t[i]&&(e.removeEventListener(this,i,n),delete t[i])},o=(t,e)=>{this.canvas&&this.resize(t,e)};let s;const r=()=>{n("attach",r),this.attached=!0,this.resize(),i("resize",o),i("detach",s)};s=()=>{this.attached=!1,n("resize",o),this._stop(),this._resize(0,0),i("attach",r)},e.isAttached(this.canvas)?r():s()}unbindEvents(){b_(this._listeners,((t,e)=>{this.platform.removeEventListener(this,e,t)})),this._listeners={},b_(this._responsiveListeners,((t,e)=>{this.platform.removeEventListener(this,e,t)})),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){const n=i?"set":"remove";let o,s,r,a;for("dataset"===e&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+n+"DatasetHoverStyle"]()),r=0,a=t.length;r<a;++r){s=t[r];const e=s&&this.getDatasetMeta(s.datasetIndex).controller;e&&e[n+"HoverStyle"](s.element,s.datasetIndex,s.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const e=this._active||[],i=t.map((({datasetIndex:t,index:e})=>{const i=this.getDatasetMeta(t);if(!i)throw new Error("No dataset found at index "+t);return{datasetIndex:t,element:i.data[e],index:e}}));!x_(i,e)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,e))}notifyPlugins(t,e,i){return this._plugins.notify(this,t,e,i)}isPluginEnabled(t){return 1===this._plugins._cache.filter((e=>e.plugin.id===t)).length}_updateHoverStyles(t,e,i){const n=this.options.hover,o=(t,e)=>t.filter((t=>!e.some((e=>t.datasetIndex===e.datasetIndex&&t.index===e.index)))),s=o(e,t),r=i?t:o(t,e);s.length&&this.updateHoverStyle(s,n.mode,!1),r.length&&n.mode&&this.updateHoverStyle(r,n.mode,!0)}_eventHandler(t,e){const i={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},n=e=>(e.options.events||this.options.events).includes(t.native.type);if(!1===this.notifyPlugins("beforeEvent",i,n))return;const o=this._handleEvent(t,e,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,n),(o||i.changed)&&this.render(),this}_handleEvent(t,e,i){const{_active:n=[],options:o}=this,s=e,r=this._getActiveElements(t,n,i,s),a=function(t){return"mouseup"===t.type||"click"===t.type||"contextmenu"===t.type}(t),l=function(t,e,i,n){return i&&"mouseout"!==t.type?n?e:t:null}(t,this._lastEvent,i,a);i&&(this._lastEvent=null,y_(o.onHover,[t,r,this],this),a&&y_(o.onClick,[t,r,this],this));const c=!x_(r,n);return(c||e)&&(this._active=r,this._updateHoverStyles(r,n,e)),this._lastEvent=l,c}_getActiveElements(t,e,i,n){if("mouseout"===t.type)return[];if(!i)return e;const o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,n)}}function iE(){return b_(eE.instances,(t=>t._plugins.invalidate()))}function nE(t,e,i,n){const o=Jw(t.options.borderRadius,["outerStart","outerEnd","innerStart","innerEnd"]);const s=(i-e)/2,r=Math.min(s,n*e/2),a=t=>{const e=(i-Math.min(s,t))*n/2;return ew(t,0,Math.min(s,e))};return{outerStart:a(o.outerStart),outerEnd:a(o.outerEnd),innerStart:ew(o.innerStart,0,r),innerEnd:ew(o.innerEnd,0,r)}}function oE(t,e,i,n){return{x:i+t*Math.cos(e),y:n+t*Math.sin(e)}}function sE(t,e,i,n,o,s){const{x:r,y:a,startAngle:l,pixelMargin:c,innerRadius:h}=e,d=Math.max(e.outerRadius+n+i-c,0),u=h>0?h+n+i+c:0;let p=0;const m=o-l;if(n){const t=((h>0?h-n:0)+(d>0?d-n:0))/2;p=(m-(0!==t?m*t/(t+n):m))/2}const g=(m-Math.max(.001,m*d-i/O_)/d)/2,f=l+g+p,v=o-g-p,{outerStart:y,outerEnd:b,innerStart:x,innerEnd:_}=nE(e,u,d,v-f),w=d-y,k=d-b,C=f+y/w,S=v-b/k,E=u+x,A=u+_,M=f+x/E,T=v-_/A;if(t.beginPath(),s){const e=(C+S)/2;if(t.arc(r,a,d,C,e),t.arc(r,a,d,e,S),b>0){const e=oE(k,S,r,a);t.arc(e.x,e.y,b,S,v+N_)}const i=oE(A,v,r,a);if(t.lineTo(i.x,i.y),_>0){const e=oE(A,T,r,a);t.arc(e.x,e.y,_,v+N_,T+Math.PI)}const n=(v-_/u+(f+x/u))/2;if(t.arc(r,a,u,v-_/u,n,!0),t.arc(r,a,u,n,f+x/u,!0),x>0){const e=oE(E,M,r,a);t.arc(e.x,e.y,x,M+Math.PI,f-N_)}const o=oE(w,f,r,a);if(t.lineTo(o.x,o.y),y>0){const e=oE(w,C,r,a);t.arc(e.x,e.y,y,f-N_,C)}}else{t.moveTo(r,a);const e=Math.cos(C)*d+r,i=Math.sin(C)*d+a;t.lineTo(e,i);const n=Math.cos(S)*d+r,o=Math.sin(S)*d+a;t.lineTo(n,o)}t.closePath()}function rE(t,e,i,n,o){const{fullCircles:s,startAngle:r,circumference:a,options:l}=e,{borderWidth:c,borderJoinStyle:h,borderDash:d,borderDashOffset:u}=l,p="inner"===l.borderAlign;if(!c)return;t.setLineDash(d||[]),t.lineDashOffset=u,p?(t.lineWidth=2*c,t.lineJoin=h||"round"):(t.lineWidth=c,t.lineJoin=h||"bevel");let m=e.endAngle;if(s){sE(t,e,i,n,m,o);for(let e=0;e<s;++e)t.stroke();isNaN(a)||(m=r+(a%$_||$_))}p&&function(t,e,i){const{startAngle:n,pixelMargin:o,x:s,y:r,outerRadius:a,innerRadius:l}=e;let c=o/a;t.beginPath(),t.arc(s,r,a,n-c,i+c),l>o?(c=o/l,t.arc(s,r,l,i+c,n-c,!0)):t.arc(s,r,o,i+N_,n-N_),t.closePath(),t.clip()}(t,e,m),s||(sE(t,e,i,n,m,o),t.stroke())}class aE extends mS{static id="arc";static defaults={borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0};static defaultRoutes={backgroundColor:"backgroundColor"};static descriptors={_scriptable:!0,_indexable:t=>"borderDash"!==t};circumference;endAngle;fullCircles;innerRadius;outerRadius;pixelMargin;startAngle;constructor(t){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,t&&Object.assign(this,t)}inRange(t,e,i){const n=this.getProps(["x","y"],i),{angle:o,distance:s}=X_(n,{x:t,y:e}),{startAngle:r,endAngle:a,innerRadius:l,outerRadius:c,circumference:h}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],i),d=(this.options.spacing+this.options.borderWidth)/2,u=f_(h,a-r),p=tw(o,r,a)&&r!==a,m=u>=$_||p,g=iw(s,l+d,c+d);return m&&g}getCenterPoint(t){const{x:e,y:i,startAngle:n,endAngle:o,innerRadius:s,outerRadius:r}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],t),{offset:a,spacing:l}=this.options,c=(n+o)/2,h=(s+r+l+a)/2;return{x:e+Math.cos(c)*h,y:i+Math.sin(c)*h}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){const{options:e,circumference:i}=this,n=(e.offset||0)/4,o=(e.spacing||0)/2,s=e.circular;if(this.pixelMargin="inner"===e.borderAlign?.33:0,this.fullCircles=i>$_?Math.floor(i/$_):0,0===i||this.innerRadius<0||this.outerRadius<0)return;t.save();const r=(this.startAngle+this.endAngle)/2;t.translate(Math.cos(r)*n,Math.sin(r)*n);const a=n*(1-Math.sin(Math.min(O_,i||0)));t.fillStyle=e.backgroundColor,t.strokeStyle=e.borderColor,function(t,e,i,n,o){const{fullCircles:s,startAngle:r,circumference:a}=e;let l=e.endAngle;if(s){sE(t,e,i,n,l,o);for(let e=0;e<s;++e)t.fill();isNaN(a)||(l=r+(a%$_||$_))}sE(t,e,i,n,l,o),t.fill()}(t,this,a,o,s),rE(t,this,a,o,s),t.restore()}}function lE(t,e,i=e){t.lineCap=f_(i.borderCapStyle,e.borderCapStyle),t.setLineDash(f_(i.borderDash,e.borderDash)),t.lineDashOffset=f_(i.borderDashOffset,e.borderDashOffset),t.lineJoin=f_(i.borderJoinStyle,e.borderJoinStyle),t.lineWidth=f_(i.borderWidth,e.borderWidth),t.strokeStyle=f_(i.borderColor,e.borderColor)}function cE(t,e,i){t.lineTo(i.x,i.y)}function hE(t,e,i={}){const n=t.length,{start:o=0,end:s=n-1}=i,{start:r,end:a}=e,l=Math.max(o,r),c=Math.min(s,a),h=o<r&&s<r||o>a&&s>a;return{count:n,start:l,loop:e.loop,ilen:c<l&&!h?n+c-l:c-l}}function dE(t,e,i,n){const{points:o,options:s}=e,{count:r,start:a,loop:l,ilen:c}=hE(o,i,n),h=function(t){return t.stepped?Vw:t.tension||"monotone"===t.cubicInterpolationMode?Hw:cE}(s);let d,u,p,{move:m=!0,reverse:g}=n||{};for(d=0;d<=c;++d)u=o[(a+(g?c-d:d))%r],u.skip||(m?(t.moveTo(u.x,u.y),m=!1):h(t,p,u,g,s.stepped),p=u);return l&&(u=o[(a+(g?c:0))%r],h(t,p,u,g,s.stepped)),!!l}function uE(t,e,i,n){const o=e.points,{count:s,start:r,ilen:a}=hE(o,i,n),{move:l=!0,reverse:c}=n||{};let h,d,u,p,m,g,f=0,v=0;const y=t=>(r+(c?a-t:t))%s,b=()=>{p!==m&&(t.lineTo(f,m),t.lineTo(f,p),t.lineTo(f,g))};for(l&&(d=o[y(0)],t.moveTo(d.x,d.y)),h=0;h<=a;++h){if(d=o[y(h)],d.skip)continue;const e=d.x,i=d.y,n=0|e;n===u?(i<p?p=i:i>m&&(m=i),f=(v*f+e)/++v):(b(),t.lineTo(e,i),u=n,v=0,p=m=i),g=i}b()}function pE(t){const e=t.options,i=e.borderDash&&e.borderDash.length;return!(t._decimated||t._loop||e.tension||"monotone"===e.cubicInterpolationMode||e.stepped||i)?uE:dE}const mE="function"==typeof Path2D;function gE(t,e,i,n){mE&&!e.options.segment?function(t,e,i,n){let o=e._path;o||(o=e._path=new Path2D,e.path(o,i,n)&&o.closePath()),lE(t,e.options),t.stroke(o)}(t,e,i,n):function(t,e,i,n){const{segments:o,options:s}=e,r=pE(e);for(const a of o)lE(t,s,a.style),t.beginPath(),r(t,e,a,{start:i,end:i+n-1})&&t.closePath(),t.stroke()}(t,e,i,n)}class fE extends mS{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:t=>"borderDash"!==t&&"fill"!==t};constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){const i=this.options;if((i.tension||"monotone"===i.cubicInterpolationMode)&&!i.stepped&&!this._pointsUpdated){const n=i.spanGaps?this._loop:this._fullLoop;Ek(this._points,i,t,n,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=function(t,e){const i=t.points,n=t.options.spanGaps,o=i.length;if(!o)return[];const s=!!t._loop,{start:r,end:a}=function(t,e,i,n){let o=0,s=e-1;if(i&&!n)for(;o<e&&!t[o].skip;)o++;for(;o<e&&t[o].skip;)o++;for(o%=e,i&&(s+=o);s>o&&t[s%e].skip;)s--;return s%=e,{start:o,end:s}}(i,o,s,n);return Xk(t,!0===n?[{start:r,end:a,loop:s}]:function(t,e,i,n){const o=t.length,s=[];let r,a=e,l=t[e];for(r=e+1;r<=i;++r){const i=t[r%o];i.skip||i.stop?l.skip||(n=!1,s.push({start:e%o,end:(r-1)%o,loop:n}),e=a=i.stop?r:null):(a=r,l.skip&&(e=r)),l=i}return null!==a&&s.push({start:e%o,end:a%o,loop:n}),s}(i,r,a<r?a+o:a,!!t._fullLoop&&0===r&&a===o-1),i,e)}(this,this.options.segment))}first(){const t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){const t=this.segments,e=this.points,i=t.length;return i&&e[t[i-1].end]}interpolate(t,e){const i=this.options,n=t[e],o=this.points,s=Yk(this,{property:e,start:n,end:n});if(!s.length)return;const r=[],a=function(t){return t.stepped?Fk:t.tension||"monotone"===t.cubicInterpolationMode?qk:Bk}(i);let l,c;for(l=0,c=s.length;l<c;++l){const{start:c,end:h}=s[l],d=o[c],u=o[h];if(d===u){r.push(d);continue}const p=a(d,u,Math.abs((n-d[e])/(u[e]-d[e])),i.stepped);p[e]=t[e],r.push(p)}return 1===r.length?r[0]:r}pathSegment(t,e,i){return pE(this)(t,this,e,i)}path(t,e,i){const n=this.segments,o=pE(this);let s=this._loop;e=e||0,i=i||this.points.length-e;for(const r of n)s&=o(t,this,r,{start:e,end:e+i-1});return!!s}draw(t,e,i,n){const o=this.options||{};(this.points||[]).length&&o.borderWidth&&(t.save(),gE(t,this,i,n),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}function vE(t,e,i,n){const o=t.options,{[i]:s}=t.getProps([i],n);return Math.abs(e-s)<o.radius+o.hitRadius}class yE extends mS{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(t){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,t&&Object.assign(this,t)}inRange(t,e,i){const n=this.options,{x:o,y:s}=this.getProps(["x","y"],i);return Math.pow(t-o,2)+Math.pow(e-s,2)<Math.pow(n.hitRadius+n.radius,2)}inXRange(t,e){return vE(this,t,"x",e)}inYRange(t,e){return vE(this,t,"y",e)}getCenterPoint(t){const{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}size(t){let e=(t=t||this.options||{}).radius||0;e=Math.max(e,e&&t.hoverRadius||0);return 2*(e+(e&&t.borderWidth||0))}draw(t,e){const i=this.options;this.skip||i.radius<.1||!Bw(this,e,this.size(i)/2)||(t.strokeStyle=i.borderColor,t.lineWidth=i.borderWidth,t.fillStyle=i.backgroundColor,Nw(t,i,this.x,this.y))}getRange(){const t=this.options||{};return t.radius+t.hitRadius}}function bE(t,e){const{x:i,y:n,base:o,width:s,height:r}=t.getProps(["x","y","base","width","height"],e);let a,l,c,h,d;return t.horizontal?(d=r/2,a=Math.min(i,o),l=Math.max(i,o),c=n-d,h=n+d):(d=s/2,a=i-d,l=i+d,c=Math.min(n,o),h=Math.max(n,o)),{left:a,top:c,right:l,bottom:h}}function xE(t,e,i,n){return t?0:ew(e,i,n)}function _E(t){const e=bE(t),i=e.right-e.left,n=e.bottom-e.top,o=function(t,e,i){const n=t.options.borderWidth,o=t.borderSkipped,s=tk(n);return{t:xE(o.top,s.top,0,i),r:xE(o.right,s.right,0,e),b:xE(o.bottom,s.bottom,0,i),l:xE(o.left,s.left,0,e)}}(t,i/2,n/2),s=function(t,e,i){const{enableBorderRadius:n}=t.getProps(["enableBorderRadius"]),o=t.options.borderRadius,s=ek(o),r=Math.min(e,i),a=t.borderSkipped,l=n||p_(o);return{topLeft:xE(!l||a.top||a.left,s.topLeft,0,r),topRight:xE(!l||a.top||a.right,s.topRight,0,r),bottomLeft:xE(!l||a.bottom||a.left,s.bottomLeft,0,r),bottomRight:xE(!l||a.bottom||a.right,s.bottomRight,0,r)}}(t,i/2,n/2);return{outer:{x:e.left,y:e.top,w:i,h:n,radius:s},inner:{x:e.left+o.l,y:e.top+o.t,w:i-o.l-o.r,h:n-o.t-o.b,radius:{topLeft:Math.max(0,s.topLeft-Math.max(o.t,o.l)),topRight:Math.max(0,s.topRight-Math.max(o.t,o.r)),bottomLeft:Math.max(0,s.bottomLeft-Math.max(o.b,o.l)),bottomRight:Math.max(0,s.bottomRight-Math.max(o.b,o.r))}}}}function wE(t,e,i,n){const o=null===e,s=null===i,r=t&&!(o&&s)&&bE(t,n);return r&&(o||iw(e,r.left,r.right))&&(s||iw(i,r.top,r.bottom))}function kE(t,e){t.rect(e.x,e.y,e.w,e.h)}function CE(t,e,i={}){const n=t.x!==i.x?-e:0,o=t.y!==i.y?-e:0,s=(t.x+t.w!==i.x+i.w?e:0)-n,r=(t.y+t.h!==i.y+i.h?e:0)-o;return{x:t.x+n,y:t.y+o,w:t.w+s,h:t.h+r,radius:t.radius}}class SE extends mS{static id="bar";static defaults={borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,t&&Object.assign(this,t)}draw(t){const{inflateAmount:e,options:{borderColor:i,backgroundColor:n}}=this,{inner:o,outer:s}=_E(this),r=(a=s.radius).topLeft||a.topRight||a.bottomLeft||a.bottomRight?Zw:kE;var a;t.save(),s.w===o.w&&s.h===o.h||(t.beginPath(),r(t,CE(s,e,o)),t.clip(),r(t,CE(o,-e,s)),t.fillStyle=i,t.fill("evenodd")),t.beginPath(),r(t,CE(o,e)),t.fillStyle=n,t.fill(),t.restore()}inRange(t,e,i){return wE(this,t,e,i)}inXRange(t,e){return wE(this,t,null,e)}inYRange(t,e){return wE(this,null,t,e)}getCenterPoint(t){const{x:e,y:i,base:n,horizontal:o}=this.getProps(["x","y","base","horizontal"],t);return{x:o?(e+n)/2:e,y:o?i:(i+n)/2}}getRange(t){return"x"===t?this.width/2:this.height/2}}var EE=Object.freeze({__proto__:null,ArcElement:aE,BarElement:SE,LineElement:fE,PointElement:yE});const AE=["rgb(54, 162, 235)","rgb(255, 99, 132)","rgb(255, 159, 64)","rgb(255, 205, 86)","rgb(75, 192, 192)","rgb(153, 102, 255)","rgb(201, 203, 207)"],ME=AE.map((t=>t.replace("rgb(","rgba(").replace(")",", 0.5)")));function TE(t){return AE[t%AE.length]}function PE(t){return ME[t%ME.length]}function DE(t){let e=0;return(i,n)=>{const o=t.getDatasetMeta(n).controller;o instanceof SC?e=function(t,e){return t.backgroundColor=t.data.map((()=>TE(e++))),e}(i,e):o instanceof EC?e=function(t,e){return t.backgroundColor=t.data.map((()=>PE(e++))),e}(i,e):o&&(e=function(t,e){return t.borderColor=TE(e),t.backgroundColor=PE(e),++e}(i,e))}}function IE(t){let e;for(e in t)if(t[e].borderColor||t[e].backgroundColor)return!0;return!1}var OE={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(t,e,i){if(!i.enabled)return;const{data:{datasets:n},options:o}=t.config,{elements:s}=o,r=IE(n)||(a=o)&&(a.borderColor||a.backgroundColor)||s&&IE(s)||"rgba(0,0,0,0.1)"!==Ow.borderColor||"rgba(0,0,0,0.1)"!==Ow.backgroundColor;var a;if(!i.forceOverride&&r)return;const l=DE(t);n.forEach(l)}};function $E(t){if(t._decimated){const e=t._data;delete t._decimated,delete t._data,Object.defineProperty(t,"data",{configurable:!0,enumerable:!0,writable:!0,value:e})}}function LE(t){t.data.datasets.forEach((t=>{$E(t)}))}var zE={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(t,e,i)=>{if(!i.enabled)return void LE(t);const n=t.width;t.data.datasets.forEach(((e,o)=>{const{_data:s,indexAxis:r}=e,a=t.getDatasetMeta(o),l=s||e.data;if("y"===ok([r,t.options.indexAxis]))return;if(!a.controller.supportsDecimation)return;const c=t.scales[a.xAxisID];if("linear"!==c.type&&"time"!==c.type)return;if(t.options.parsing)return;let{start:h,count:d}=function(t,e){const i=e.length;let n,o=0;const{iScale:s}=t,{min:r,max:a,minDefined:l,maxDefined:c}=s.getUserBounds();return l&&(o=ew(ow(e,s.axis,r).lo,0,i-1)),n=c?ew(ow(e,s.axis,a).hi+1,o,i)-o:i-o,{start:o,count:n}}(a,l);if(d<=(i.threshold||4*n))return void $E(e);let u;switch(d_(s)&&(e._data=l,delete e.data,Object.defineProperty(e,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(t){this._data=t}})),i.algorithm){case"lttb":u=function(t,e,i,n,o){const s=o.samples||n;if(s>=i)return t.slice(e,e+i);const r=[],a=(i-2)/(s-2);let l=0;const c=e+i-1;let h,d,u,p,m,g=e;for(r[l++]=t[g],h=0;h<s-2;h++){let n,o=0,s=0;const c=Math.floor((h+1)*a)+1+e,f=Math.min(Math.floor((h+2)*a)+1,i)+e,v=f-c;for(n=c;n<f;n++)o+=t[n].x,s+=t[n].y;o/=v,s/=v;const y=Math.floor(h*a)+1+e,b=Math.min(Math.floor((h+1)*a)+1,i)+e,{x:x,y:_}=t[g];for(u=p=-1,n=y;n<b;n++)p=.5*Math.abs((x-o)*(t[n].y-_)-(x-t[n].x)*(s-_)),p>u&&(u=p,d=t[n],m=n);r[l++]=d,g=m}return r[l++]=t[c],r}(l,h,d,n,i);break;case"min-max":u=function(t,e,i,n){let o,s,r,a,l,c,h,d,u,p,m=0,g=0;const f=[],v=e+i-1,y=t[e].x,b=t[v].x-y;for(o=e;o<e+i;++o){s=t[o],r=(s.x-y)/b*n,a=s.y;const e=0|r;if(e===l)a<u?(u=a,c=o):a>p&&(p=a,h=o),m=(g*m+s.x)/++g;else{const i=o-1;if(!d_(c)&&!d_(h)){const e=Math.min(c,h),n=Math.max(c,h);e!==d&&e!==i&&f.push({...t[e],x:m}),n!==d&&n!==i&&f.push({...t[n],x:m})}o>0&&i!==d&&f.push(t[i]),f.push(s),l=e,g=0,u=p=a,c=h=d=o}}return f}(l,h,d,n);break;default:throw new Error(`Unsupported decimation algorithm '${i.algorithm}'`)}e._decimated=u}))},destroy(t){LE(t)}};function RE(t,e,i,n){if(n)return;let o=e[t],s=i[t];return"angle"===t&&(o=J_(o),s=J_(s)),{property:t,start:o,end:s}}function NE(t,e,i){for(;e>t;e--){const t=i[e];if(!isNaN(t.x)&&!isNaN(t.y))break}return e}function jE(t,e,i,n){return t&&e?n(t[i],e[i]):t?t[i]:e?e[i]:0}function BE(t,e){let i=[],n=!1;return u_(t)?(n=!0,i=t):i=function(t,e){const{x:i=null,y:n=null}=t||{},o=e.points,s=[];return e.segments.forEach((({start:t,end:e})=>{e=NE(t,e,o);const r=o[t],a=o[e];null!==n?(s.push({x:r.x,y:n}),s.push({x:a.x,y:n})):null!==i&&(s.push({x:i,y:r.y}),s.push({x:i,y:a.y}))})),s}(t,e),i.length?new fE({points:i,options:{tension:0},_loop:n,_fullLoop:n}):null}function FE(t){return t&&!1!==t.fill}function qE(t,e,i){let n=t[e].fill;const o=[e];let s;if(!i)return n;for(;!1!==n&&-1===o.indexOf(n);){if(!m_(n))return n;if(s=t[n],!s)return!1;if(s.visible)return n;o.push(n),n=s.fill}return!1}function VE(t,e,i){const n=function(t){const e=t.options,i=e.fill;let n=f_(i&&i.target,i);void 0===n&&(n=!!e.backgroundColor);if(!1===n||null===n)return!1;if(!0===n)return"origin";return n}(t);if(p_(n))return!isNaN(n.value)&&n;let o=parseFloat(n);return m_(o)&&Math.floor(o)===o?function(t,e,i,n){"-"!==t&&"+"!==t||(i=e+i);if(i===e||i<0||i>=n)return!1;return i}(n[0],e,o,i):["origin","start","end","stack","shape"].indexOf(n)>=0&&n}function HE(t,e,i){const n=[];for(let o=0;o<i.length;o++){const s=i[o],{first:r,last:a,point:l}=UE(s,e,"x");if(!(!l||r&&a))if(r)n.unshift(l);else if(t.push(l),!a)break}t.push(...n)}function UE(t,e,i){const n=t.interpolate(e,i);if(!n)return{};const o=n[i],s=t.segments,r=t.points;let a=!1,l=!1;for(let t=0;t<s.length;t++){const e=s[t],n=r[e.start][i],c=r[e.end][i];if(iw(o,n,c)){a=o===n,l=o===c;break}}return{first:a,last:l,point:n}}class WE{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,e,i){const{x:n,y:o,radius:s}=this;return e=e||{start:0,end:$_},t.arc(n,o,s,e.end,e.start,!0),!i.bounds}interpolate(t){const{x:e,y:i,radius:n}=this,o=t.angle;return{x:e+Math.cos(o)*n,y:i+Math.sin(o)*n,angle:o}}}function GE(t){const{chart:e,fill:i,line:n}=t;if(m_(i))return function(t,e){const i=t.getDatasetMeta(e),n=i&&t.isDatasetVisible(e);return n?i.dataset:null}(e,i);if("stack"===i)return function(t){const{scale:e,index:i,line:n}=t,o=[],s=n.segments,r=n.points,a=function(t,e){const i=[],n=t.getMatchingVisibleMetas("line");for(let t=0;t<n.length;t++){const o=n[t];if(o.index===e)break;o.hidden||i.unshift(o.dataset)}return i}(e,i);a.push(BE({x:null,y:e.bottom},n));for(let t=0;t<s.length;t++){const e=s[t];for(let t=e.start;t<=e.end;t++)HE(o,r[t],a)}return new fE({points:o,options:{}})}(t);if("shape"===i)return!0;const o=function(t){const e=t.scale||{};if(e.getPointPositionForValue)return function(t){const{scale:e,fill:i}=t,n=e.options,o=e.getLabels().length,s=n.reverse?e.max:e.min,r=function(t,e,i){let n;return n="start"===t?i:"end"===t?e.options.reverse?e.min:e.max:p_(t)?t.value:e.getBaseValue(),n}(i,e,s),a=[];if(n.grid.circular){const t=e.getPointPositionForValue(0,s);return new WE({x:t.x,y:t.y,radius:e.getDistanceFromCenterForValue(r)})}for(let t=0;t<o;++t)a.push(e.getPointPositionForValue(t,r));return a}(t);return function(t){const{scale:e={},fill:i}=t,n=function(t,e){let i=null;return"start"===t?i=e.bottom:"end"===t?i=e.top:p_(t)?i=e.getPixelForValue(t.value):e.getBasePixel&&(i=e.getBasePixel()),i}(i,e);if(m_(n)){const t=e.isHorizontal();return{x:t?n:null,y:t?null:n}}return null}(t)}(t);return o instanceof WE?o:BE(o,n)}function ZE(t,e,i){const n=GE(e),{line:o,scale:s,axis:r}=e,a=o.options,l=a.fill,c=a.backgroundColor,{above:h=c,below:d=c}=l||{};n&&o.points.length&&(Fw(t,i),function(t,e){const{line:i,target:n,above:o,below:s,area:r,scale:a}=e,l=i._loop?"angle":e.axis;t.save(),"x"===l&&s!==o&&(YE(t,n,r.top),XE(t,{line:i,target:n,color:o,scale:a,property:l}),t.restore(),t.save(),YE(t,n,r.bottom));XE(t,{line:i,target:n,color:s,scale:a,property:l}),t.restore()}(t,{line:o,target:n,above:h,below:d,area:i,scale:s,axis:r}),qw(t))}function YE(t,e,i){const{segments:n,points:o}=e;let s=!0,r=!1;t.beginPath();for(const a of n){const{start:n,end:l}=a,c=o[n],h=o[NE(n,l,o)];s?(t.moveTo(c.x,c.y),s=!1):(t.lineTo(c.x,i),t.lineTo(c.x,c.y)),r=!!e.pathSegment(t,a,{move:r}),r?t.closePath():t.lineTo(h.x,i)}t.lineTo(e.first().x,i),t.closePath(),t.clip()}function XE(t,e){const{line:i,target:n,property:o,color:s,scale:r}=e,a=function(t,e,i){const n=t.segments,o=t.points,s=e.points,r=[];for(const t of n){let{start:n,end:a}=t;a=NE(n,a,o);const l=RE(i,o[n],o[a],t.loop);if(!e.segments){r.push({source:t,target:l,start:o[n],end:o[a]});continue}const c=Yk(e,l);for(const e of c){const n=RE(i,s[e.start],s[e.end],e.loop),a=Zk(t,o,n);for(const t of a)r.push({source:t,target:e,start:{[i]:jE(l,n,"start",Math.max)},end:{[i]:jE(l,n,"end",Math.min)}})}}return r}(i,n,o);for(const{source:e,target:l,start:c,end:h}of a){const{style:{backgroundColor:a=s}={}}=e,d=!0!==n;t.save(),t.fillStyle=a,KE(t,r,d&&RE(o,c,h)),t.beginPath();const u=!!i.pathSegment(t,e);let p;if(d){u?t.closePath():QE(t,n,h,o);const e=!!n.pathSegment(t,l,{move:u,reverse:!0});p=u&&e,p||QE(t,n,c,o)}t.closePath(),t.fill(p?"evenodd":"nonzero"),t.restore()}}function KE(t,e,i){const{top:n,bottom:o}=e.chart.chartArea,{property:s,start:r,end:a}=i||{};"x"===s&&(t.beginPath(),t.rect(r,n,a-r,o-n),t.clip())}function QE(t,e,i,n){const o=e.interpolate(i,n);o&&t.lineTo(o.x,o.y)}var JE={id:"filler",afterDatasetsUpdate(t,e,i){const n=(t.data.datasets||[]).length,o=[];let s,r,a,l;for(r=0;r<n;++r)s=t.getDatasetMeta(r),a=s.dataset,l=null,a&&a.options&&a instanceof fE&&(l={visible:t.isDatasetVisible(r),index:r,fill:VE(a,r,n),chart:t,axis:s.controller.options.indexAxis,scale:s.vScale,line:a}),s.$filler=l,o.push(l);for(r=0;r<n;++r)l=o[r],l&&!1!==l.fill&&(l.fill=qE(o,r,i.propagate))},beforeDraw(t,e,i){const n="beforeDraw"===i.drawTime,o=t.getSortedVisibleDatasetMetas(),s=t.chartArea;for(let e=o.length-1;e>=0;--e){const i=o[e].$filler;i&&(i.line.updateControlPoints(s,i.axis),n&&i.fill&&ZE(t.ctx,i,s))}},beforeDatasetsDraw(t,e,i){if("beforeDatasetsDraw"!==i.drawTime)return;const n=t.getSortedVisibleDatasetMetas();for(let e=n.length-1;e>=0;--e){const i=n[e].$filler;FE(i)&&ZE(t.ctx,i,t.chartArea)}},beforeDatasetDraw(t,e,i){const n=e.meta.$filler;FE(n)&&"beforeDatasetDraw"===i.drawTime&&ZE(t.ctx,n,t.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const tA=(t,e)=>{let{boxHeight:i=e,boxWidth:n=e}=t;return t.usePointStyle&&(i=Math.min(i,e),n=t.pointStyleWidth||Math.min(n,e)),{boxWidth:n,boxHeight:i,itemHeight:Math.max(e,i)}};class eA extends mS{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,i){this.maxWidth=t,this.maxHeight=e,this._margins=i,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let e=y_(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter((e=>t.filter(e,this.chart.data)))),t.sort&&(e=e.sort(((e,i)=>t.sort(e,i,this.chart.data)))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){const{options:t,ctx:e}=this;if(!t.display)return void(this.width=this.height=0);const i=t.labels,n=nk(i.font),o=n.size,s=this._computeTitleHeight(),{boxWidth:r,itemHeight:a}=tA(i,o);let l,c;e.font=n.string,this.isHorizontal()?(l=this.maxWidth,c=this._fitRows(s,o,r,a)+10):(c=this.maxHeight,l=this._fitCols(s,n,r,a)+10),this.width=Math.min(l,t.maxWidth||this.maxWidth),this.height=Math.min(c,t.maxHeight||this.maxHeight)}_fitRows(t,e,i,n){const{ctx:o,maxWidth:s,options:{labels:{padding:r}}}=this,a=this.legendHitBoxes=[],l=this.lineWidths=[0],c=n+r;let h=t;o.textAlign="left",o.textBaseline="middle";let d=-1,u=-c;return this.legendItems.forEach(((t,p)=>{const m=i+e/2+o.measureText(t.text).width;(0===p||l[l.length-1]+m+2*r>s)&&(h+=c,l[l.length-(p>0?0:1)]=0,u+=c,d++),a[p]={left:0,top:u,row:d,width:m,height:n},l[l.length-1]+=m+r})),h}_fitCols(t,e,i,n){const{ctx:o,maxHeight:s,options:{labels:{padding:r}}}=this,a=this.legendHitBoxes=[],l=this.columnSizes=[],c=s-t;let h=r,d=0,u=0,p=0,m=0;return this.legendItems.forEach(((t,s)=>{const{itemWidth:g,itemHeight:f}=function(t,e,i,n,o){const s=function(t,e,i,n){let o=t.text;o&&"string"!=typeof o&&(o=o.reduce(((t,e)=>t.length>e.length?t:e)));return e+i.size/2+n.measureText(o).width}(n,t,e,i),r=function(t,e,i){let n=t;"string"!=typeof e.text&&(n=iA(e,i));return n}(o,n,e.lineHeight);return{itemWidth:s,itemHeight:r}}(i,e,o,t,n);s>0&&u+f+2*r>c&&(h+=d+r,l.push({width:d,height:u}),p+=d+r,m++,d=u=0),a[s]={left:p,top:u,col:m,width:g,height:f},d=Math.max(d,g),u+=f+r})),h+=d,l.push({width:d,height:u}),h}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:i,labels:{padding:n},rtl:o}}=this,s=Vk(o,this.left,this.width);if(this.isHorizontal()){let o=0,r=uw(i,this.left+n,this.right-this.lineWidths[o]);for(const a of e)o!==a.row&&(o=a.row,r=uw(i,this.left+n,this.right-this.lineWidths[o])),a.top+=this.top+t+n,a.left=s.leftForLtr(s.x(r),a.width),r+=a.width+n}else{let o=0,r=uw(i,this.top+t+n,this.bottom-this.columnSizes[o].height);for(const a of e)a.col!==o&&(o=a.col,r=uw(i,this.top+t+n,this.bottom-this.columnSizes[o].height)),a.top=r,a.left+=this.left+n,a.left=s.leftForLtr(s.x(a.left),a.width),r+=a.height+n}}isHorizontal(){return"top"===this.options.position||"bottom"===this.options.position}draw(){if(this.options.display){const t=this.ctx;Fw(t,this),this._draw(),qw(t)}}_draw(){const{options:t,columnSizes:e,lineWidths:i,ctx:n}=this,{align:o,labels:s}=t,r=Ow.color,a=Vk(t.rtl,this.left,this.width),l=nk(s.font),{padding:c}=s,h=l.size,d=h/2;let u;this.drawTitle(),n.textAlign=a.textAlign("left"),n.textBaseline="middle",n.lineWidth=.5,n.font=l.string;const{boxWidth:p,boxHeight:m,itemHeight:g}=tA(s,h),f=this.isHorizontal(),v=this._computeTitleHeight();u=f?{x:uw(o,this.left+c,this.right-i[0]),y:this.top+c+v,line:0}:{x:this.left+c,y:uw(o,this.top+v+c,this.bottom-e[0].height),line:0},Hk(this.ctx,t.textDirection);const y=g+c;this.legendItems.forEach(((b,x)=>{n.strokeStyle=b.fontColor,n.fillStyle=b.fontColor;const _=n.measureText(b.text).width,w=a.textAlign(b.textAlign||(b.textAlign=s.textAlign)),k=p+d+_;let C=u.x,S=u.y;a.setWidth(this.width),f?x>0&&C+k+c>this.right&&(S=u.y+=y,u.line++,C=u.x=uw(o,this.left+c,this.right-i[u.line])):x>0&&S+y>this.bottom&&(C=u.x=C+e[u.line].width+c,u.line++,S=u.y=uw(o,this.top+v+c,this.bottom-e[u.line].height));if(function(t,e,i){if(isNaN(p)||p<=0||isNaN(m)||m<0)return;n.save();const o=f_(i.lineWidth,1);if(n.fillStyle=f_(i.fillStyle,r),n.lineCap=f_(i.lineCap,"butt"),n.lineDashOffset=f_(i.lineDashOffset,0),n.lineJoin=f_(i.lineJoin,"miter"),n.lineWidth=o,n.strokeStyle=f_(i.strokeStyle,r),n.setLineDash(f_(i.lineDash,[])),s.usePointStyle){const r={radius:m*Math.SQRT2/2,pointStyle:i.pointStyle,rotation:i.rotation,borderWidth:o},l=a.xPlus(t,p/2);jw(n,r,l,e+d,s.pointStyleWidth&&p)}else{const s=e+Math.max((h-m)/2,0),r=a.leftForLtr(t,p),l=ek(i.borderRadius);n.beginPath(),Object.values(l).some((t=>0!==t))?Zw(n,{x:r,y:s,w:p,h:m,radius:l}):n.rect(r,s,p,m),n.fill(),0!==o&&n.stroke()}n.restore()}(a.x(C),S,b),C=((t,e,i,n)=>t===(n?"left":"right")?i:"center"===t?(e+i)/2:e)(w,C+p+d,f?C+k:this.right,t.rtl),function(t,e,i){Gw(n,i.text,t,e+g/2,l,{strikethrough:i.hidden,textAlign:a.textAlign(i.textAlign)})}(a.x(C),S,b),f)u.x+=k+c;else if("string"!=typeof b.text){const t=l.lineHeight;u.y+=iA(b,t)+c}else u.y+=y})),Uk(this.ctx,t.textDirection)}drawTitle(){const t=this.options,e=t.title,i=nk(e.font),n=ik(e.padding);if(!e.display)return;const o=Vk(t.rtl,this.left,this.width),s=this.ctx,r=e.position,a=i.size/2,l=n.top+a;let c,h=this.left,d=this.width;if(this.isHorizontal())d=Math.max(...this.lineWidths),c=this.top+l,h=uw(t.align,h,this.right-d);else{const e=this.columnSizes.reduce(((t,e)=>Math.max(t,e.height)),0);c=l+uw(t.align,this.top,this.bottom-e-t.labels.padding-this._computeTitleHeight())}const u=uw(r,h,h+d);s.textAlign=o.textAlign(dw(r)),s.textBaseline="middle",s.strokeStyle=e.color,s.fillStyle=e.color,s.font=i.string,Gw(s,e.text,u,c,i)}_computeTitleHeight(){const t=this.options.title,e=nk(t.font),i=ik(t.padding);return t.display?e.lineHeight+i.height:0}_getLegendItemAt(t,e){let i,n,o;if(iw(t,this.left,this.right)&&iw(e,this.top,this.bottom))for(o=this.legendHitBoxes,i=0;i<o.length;++i)if(n=o[i],iw(t,n.left,n.left+n.width)&&iw(e,n.top,n.top+n.height))return this.legendItems[i];return null}handleEvent(t){const e=this.options;if(!function(t,e){if(("mousemove"===t||"mouseout"===t)&&(e.onHover||e.onLeave))return!0;if(e.onClick&&("click"===t||"mouseup"===t))return!0;return!1}(t.type,e))return;const i=this._getLegendItemAt(t.x,t.y);if("mousemove"===t.type||"mouseout"===t.type){const n=this._hoveredItem,o=((t,e)=>null!==t&&null!==e&&t.datasetIndex===e.datasetIndex&&t.index===e.index)(n,i);n&&!o&&y_(e.onLeave,[t,n,this],this),this._hoveredItem=i,i&&!o&&y_(e.onHover,[t,i,this],this)}else i&&y_(e.onClick,[t,i,this],this)}}function iA(t,e){return e*(t.text?t.text.length:0)}var nA={id:"legend",_element:eA,start(t,e,i){const n=t.legend=new eA({ctx:t.ctx,options:i,chart:t});XC.configure(t,n,i),XC.addBox(t,n)},stop(t){XC.removeBox(t,t.legend),delete t.legend},beforeUpdate(t,e,i){const n=t.legend;XC.configure(t,n,i),n.options=i},afterUpdate(t){const e=t.legend;e.buildLabels(),e.adjustHitBoxes()},afterEvent(t,e){e.replay||t.legend.handleEvent(e.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(t,e,i){const n=e.datasetIndex,o=i.chart;o.isDatasetVisible(n)?(o.hide(n),e.hidden=!0):(o.show(n),e.hidden=!1)},onHover:null,onLeave:null,labels:{color:t=>t.chart.options.color,boxWidth:40,padding:10,generateLabels(t){const e=t.data.datasets,{labels:{usePointStyle:i,pointStyle:n,textAlign:o,color:s,useBorderRadius:r,borderRadius:a}}=t.legend.options;return t._getSortedDatasetMetas().map((t=>{const l=t.controller.getStyle(i?0:void 0),c=ik(l.borderWidth);return{text:e[t.index].label,fillStyle:l.backgroundColor,fontColor:s,hidden:!t.visible,lineCap:l.borderCapStyle,lineDash:l.borderDash,lineDashOffset:l.borderDashOffset,lineJoin:l.borderJoinStyle,lineWidth:(c.width+c.height)/4,strokeStyle:l.borderColor,pointStyle:n||l.pointStyle,rotation:l.rotation,textAlign:o||l.textAlign,borderRadius:r&&(a||l.borderRadius),datasetIndex:t.index}}),this)}},title:{color:t=>t.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:t=>!t.startsWith("on"),labels:{_scriptable:t=>!["generateLabels","filter","sort"].includes(t)}}};class oA extends mS{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e){const i=this.options;if(this.left=0,this.top=0,!i.display)return void(this.width=this.height=this.right=this.bottom=0);this.width=this.right=t,this.height=this.bottom=e;const n=u_(i.text)?i.text.length:1;this._padding=ik(i.padding);const o=n*nk(i.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){const t=this.options.position;return"top"===t||"bottom"===t}_drawArgs(t){const{top:e,left:i,bottom:n,right:o,options:s}=this,r=s.align;let a,l,c,h=0;return this.isHorizontal()?(l=uw(r,i,o),c=e+t,a=o-i):("left"===s.position?(l=i+t,c=uw(r,n,e),h=-.5*O_):(l=o-t,c=uw(r,e,n),h=.5*O_),a=n-e),{titleX:l,titleY:c,maxWidth:a,rotation:h}}draw(){const t=this.ctx,e=this.options;if(!e.display)return;const i=nk(e.font),n=i.lineHeight/2+this._padding.top,{titleX:o,titleY:s,maxWidth:r,rotation:a}=this._drawArgs(n);Gw(t,e.text,0,0,i,{color:e.color,maxWidth:r,rotation:a,textAlign:dw(e.align),textBaseline:"middle",translation:[o,s]})}}var sA={id:"title",_element:oA,start(t,e,i){!function(t,e){const i=new oA({ctx:t.ctx,options:e,chart:t});XC.configure(t,i,e),XC.addBox(t,i),t.titleBlock=i}(t,i)},stop(t){const e=t.titleBlock;XC.removeBox(t,e),delete t.titleBlock},beforeUpdate(t,e,i){const n=t.titleBlock;XC.configure(t,n,i),n.options=i},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const rA=new WeakMap;var aA={id:"subtitle",start(t,e,i){const n=new oA({ctx:t.ctx,options:i,chart:t});XC.configure(t,n,i),XC.addBox(t,n),rA.set(t,n)},stop(t){XC.removeBox(t,rA.get(t)),rA.delete(t)},beforeUpdate(t,e,i){const n=rA.get(t);XC.configure(t,n,i),n.options=i},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const lA={average(t){if(!t.length)return!1;let e,i,n=new Set,o=0,s=0;for(e=0,i=t.length;e<i;++e){const i=t[e].element;if(i&&i.hasValue()){const t=i.tooltipPosition();n.add(t.x),o+=t.y,++s}}if(0===s||0===n.size)return!1;const r=[...n].reduce(((t,e)=>t+e))/n.size;return{x:r,y:o/s}},nearest(t,e){if(!t.length)return!1;let i,n,o,s=e.x,r=e.y,a=Number.POSITIVE_INFINITY;for(i=0,n=t.length;i<n;++i){const n=t[i].element;if(n&&n.hasValue()){const t=K_(e,n.getCenterPoint());t<a&&(a=t,o=n)}}if(o){const t=o.tooltipPosition();s=t.x,r=t.y}return{x:s,y:r}}};function cA(t,e){return e&&(u_(e)?Array.prototype.push.apply(t,e):t.push(e)),t}function hA(t){return("string"==typeof t||t instanceof String)&&t.indexOf("\n")>-1?t.split("\n"):t}function dA(t,e){const{element:i,datasetIndex:n,index:o}=e,s=t.getDatasetMeta(n).controller,{label:r,value:a}=s.getLabelAndValue(o);return{chart:t,label:r,parsed:s.getParsed(o),raw:t.data.datasets[n].data[o],formattedValue:a,dataset:s.getDataset(),dataIndex:o,datasetIndex:n,element:i}}function uA(t,e){const i=t.chart.ctx,{body:n,footer:o,title:s}=t,{boxWidth:r,boxHeight:a}=e,l=nk(e.bodyFont),c=nk(e.titleFont),h=nk(e.footerFont),d=s.length,u=o.length,p=n.length,m=ik(e.padding);let g=m.height,f=0,v=n.reduce(((t,e)=>t+e.before.length+e.lines.length+e.after.length),0);if(v+=t.beforeBody.length+t.afterBody.length,d&&(g+=d*c.lineHeight+(d-1)*e.titleSpacing+e.titleMarginBottom),v){g+=p*(e.displayColors?Math.max(a,l.lineHeight):l.lineHeight)+(v-p)*l.lineHeight+(v-1)*e.bodySpacing}u&&(g+=e.footerMarginTop+u*h.lineHeight+(u-1)*e.footerSpacing);let y=0;const b=function(t){f=Math.max(f,i.measureText(t).width+y)};return i.save(),i.font=c.string,b_(t.title,b),i.font=l.string,b_(t.beforeBody.concat(t.afterBody),b),y=e.displayColors?r+2+e.boxPadding:0,b_(n,(t=>{b_(t.before,b),b_(t.lines,b),b_(t.after,b)})),y=0,i.font=h.string,b_(t.footer,b),i.restore(),f+=m.width,{width:f,height:g}}function pA(t,e,i,n){const{x:o,width:s}=i,{width:r,chartArea:{left:a,right:l}}=t;let c="center";return"center"===n?c=o<=(a+l)/2?"left":"right":o<=s/2?c="left":o>=r-s/2&&(c="right"),function(t,e,i,n){const{x:o,width:s}=n,r=i.caretSize+i.caretPadding;return"left"===t&&o+s+r>e.width||"right"===t&&o-s-r<0||void 0}(c,t,e,i)&&(c="center"),c}function mA(t,e,i){const n=i.yAlign||e.yAlign||function(t,e){const{y:i,height:n}=e;return i<n/2?"top":i>t.height-n/2?"bottom":"center"}(t,i);return{xAlign:i.xAlign||e.xAlign||pA(t,e,i,n),yAlign:n}}function gA(t,e,i,n){const{caretSize:o,caretPadding:s,cornerRadius:r}=t,{xAlign:a,yAlign:l}=i,c=o+s,{topLeft:h,topRight:d,bottomLeft:u,bottomRight:p}=ek(r);let m=function(t,e){let{x:i,width:n}=t;return"right"===e?i-=n:"center"===e&&(i-=n/2),i}(e,a);const g=function(t,e,i){let{y:n,height:o}=t;return"top"===e?n+=i:n-="bottom"===e?o+i:o/2,n}(e,l,c);return"center"===l?"left"===a?m+=c:"right"===a&&(m-=c):"left"===a?m-=Math.max(h,u)+o:"right"===a&&(m+=Math.max(d,p)+o),{x:ew(m,0,n.width-e.width),y:ew(g,0,n.height-e.height)}}function fA(t,e,i){const n=ik(i.padding);return"center"===e?t.x+t.width/2:"right"===e?t.x+t.width-n.right:t.x+n.left}function vA(t){return cA([],hA(t))}function yA(t,e){const i=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return i?t.override(i):t}const bA={beforeTitle:c_,title(t){if(t.length>0){const e=t[0],i=e.chart.data.labels,n=i?i.length:0;if(this&&this.options&&"dataset"===this.options.mode)return e.dataset.label||"";if(e.label)return e.label;if(n>0&&e.dataIndex<n)return i[e.dataIndex]}return""},afterTitle:c_,beforeBody:c_,beforeLabel:c_,label(t){if(this&&this.options&&"dataset"===this.options.mode)return t.label+": "+t.formattedValue||t.formattedValue;let e=t.dataset.label||"";e&&(e+=": ");const i=t.formattedValue;return d_(i)||(e+=i),e},labelColor(t){const e=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{borderColor:e.borderColor,backgroundColor:e.backgroundColor,borderWidth:e.borderWidth,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(t){const e=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{pointStyle:e.pointStyle,rotation:e.rotation}},afterLabel:c_,afterBody:c_,beforeFooter:c_,footer:c_,afterFooter:c_};function xA(t,e,i,n){const o=t[e].call(i,n);return void 0===o?bA[e].call(i,n):o}class _A extends mS{static positioners=lA;constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const e=this.chart,i=this.options.setContext(this.getContext()),n=i.enabled&&e.options.animation&&i.animations,o=new oC(this.chart,n);return n._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=(t=this.chart.getContext(),e=this,i=this._tooltipItems,sk(t,{tooltip:e,tooltipItems:i,type:"tooltip"})));var t,e,i}getTitle(t,e){const{callbacks:i}=e,n=xA(i,"beforeTitle",this,t),o=xA(i,"title",this,t),s=xA(i,"afterTitle",this,t);let r=[];return r=cA(r,hA(n)),r=cA(r,hA(o)),r=cA(r,hA(s)),r}getBeforeBody(t,e){return vA(xA(e.callbacks,"beforeBody",this,t))}getBody(t,e){const{callbacks:i}=e,n=[];return b_(t,(t=>{const e={before:[],lines:[],after:[]},o=yA(i,t);cA(e.before,hA(xA(o,"beforeLabel",this,t))),cA(e.lines,xA(o,"label",this,t)),cA(e.after,hA(xA(o,"afterLabel",this,t))),n.push(e)})),n}getAfterBody(t,e){return vA(xA(e.callbacks,"afterBody",this,t))}getFooter(t,e){const{callbacks:i}=e,n=xA(i,"beforeFooter",this,t),o=xA(i,"footer",this,t),s=xA(i,"afterFooter",this,t);let r=[];return r=cA(r,hA(n)),r=cA(r,hA(o)),r=cA(r,hA(s)),r}_createItems(t){const e=this._active,i=this.chart.data,n=[],o=[],s=[];let r,a,l=[];for(r=0,a=e.length;r<a;++r)l.push(dA(this.chart,e[r]));return t.filter&&(l=l.filter(((e,n,o)=>t.filter(e,n,o,i)))),t.itemSort&&(l=l.sort(((e,n)=>t.itemSort(e,n,i)))),b_(l,(e=>{const i=yA(t.callbacks,e);n.push(xA(i,"labelColor",this,e)),o.push(xA(i,"labelPointStyle",this,e)),s.push(xA(i,"labelTextColor",this,e))})),this.labelColors=n,this.labelPointStyles=o,this.labelTextColors=s,this.dataPoints=l,l}update(t,e){const i=this.options.setContext(this.getContext()),n=this._active;let o,s=[];if(n.length){const t=lA[i.position].call(this,n,this._eventPosition);s=this._createItems(i),this.title=this.getTitle(s,i),this.beforeBody=this.getBeforeBody(s,i),this.body=this.getBody(s,i),this.afterBody=this.getAfterBody(s,i),this.footer=this.getFooter(s,i);const e=this._size=uA(this,i),r=Object.assign({},t,e),a=mA(this.chart,i,r),l=gA(i,r,a,this.chart);this.xAlign=a.xAlign,this.yAlign=a.yAlign,o={opacity:1,x:l.x,y:l.y,width:e.width,height:e.height,caretX:t.x,caretY:t.y}}else 0!==this.opacity&&(o={opacity:0});this._tooltipItems=s,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,i,n){const o=this.getCaretPosition(t,i,n);e.lineTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.lineTo(o.x3,o.y3)}getCaretPosition(t,e,i){const{xAlign:n,yAlign:o}=this,{caretSize:s,cornerRadius:r}=i,{topLeft:a,topRight:l,bottomLeft:c,bottomRight:h}=ek(r),{x:d,y:u}=t,{width:p,height:m}=e;let g,f,v,y,b,x;return"center"===o?(b=u+m/2,"left"===n?(g=d,f=g-s,y=b+s,x=b-s):(g=d+p,f=g+s,y=b-s,x=b+s),v=g):(f="left"===n?d+Math.max(a,c)+s:"right"===n?d+p-Math.max(l,h)-s:this.caretX,"top"===o?(y=u,b=y-s,g=f-s,v=f+s):(y=u+m,b=y+s,g=f+s,v=f-s),x=y),{x1:g,x2:f,x3:v,y1:y,y2:b,y3:x}}drawTitle(t,e,i){const n=this.title,o=n.length;let s,r,a;if(o){const l=Vk(i.rtl,this.x,this.width);for(t.x=fA(this,i.titleAlign,i),e.textAlign=l.textAlign(i.titleAlign),e.textBaseline="middle",s=nk(i.titleFont),r=i.titleSpacing,e.fillStyle=i.titleColor,e.font=s.string,a=0;a<o;++a)e.fillText(n[a],l.x(t.x),t.y+s.lineHeight/2),t.y+=s.lineHeight+r,a+1===o&&(t.y+=i.titleMarginBottom-r)}}_drawColorBox(t,e,i,n,o){const s=this.labelColors[i],r=this.labelPointStyles[i],{boxHeight:a,boxWidth:l}=o,c=nk(o.bodyFont),h=fA(this,"left",o),d=n.x(h),u=a<c.lineHeight?(c.lineHeight-a)/2:0,p=e.y+u;if(o.usePointStyle){const e={radius:Math.min(l,a)/2,pointStyle:r.pointStyle,rotation:r.rotation,borderWidth:1},i=n.leftForLtr(d,l)+l/2,c=p+a/2;t.strokeStyle=o.multiKeyBackground,t.fillStyle=o.multiKeyBackground,Nw(t,e,i,c),t.strokeStyle=s.borderColor,t.fillStyle=s.backgroundColor,Nw(t,e,i,c)}else{t.lineWidth=p_(s.borderWidth)?Math.max(...Object.values(s.borderWidth)):s.borderWidth||1,t.strokeStyle=s.borderColor,t.setLineDash(s.borderDash||[]),t.lineDashOffset=s.borderDashOffset||0;const e=n.leftForLtr(d,l),i=n.leftForLtr(n.xPlus(d,1),l-2),r=ek(s.borderRadius);Object.values(r).some((t=>0!==t))?(t.beginPath(),t.fillStyle=o.multiKeyBackground,Zw(t,{x:e,y:p,w:l,h:a,radius:r}),t.fill(),t.stroke(),t.fillStyle=s.backgroundColor,t.beginPath(),Zw(t,{x:i,y:p+1,w:l-2,h:a-2,radius:r}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(e,p,l,a),t.strokeRect(e,p,l,a),t.fillStyle=s.backgroundColor,t.fillRect(i,p+1,l-2,a-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,e,i){const{body:n}=this,{bodySpacing:o,bodyAlign:s,displayColors:r,boxHeight:a,boxWidth:l,boxPadding:c}=i,h=nk(i.bodyFont);let d=h.lineHeight,u=0;const p=Vk(i.rtl,this.x,this.width),m=function(i){e.fillText(i,p.x(t.x+u),t.y+d/2),t.y+=d+o},g=p.textAlign(s);let f,v,y,b,x,_,w;for(e.textAlign=s,e.textBaseline="middle",e.font=h.string,t.x=fA(this,g,i),e.fillStyle=i.bodyColor,b_(this.beforeBody,m),u=r&&"right"!==g?"center"===s?l/2+c:l+2+c:0,b=0,_=n.length;b<_;++b){for(f=n[b],v=this.labelTextColors[b],e.fillStyle=v,b_(f.before,m),y=f.lines,r&&y.length&&(this._drawColorBox(e,t,b,p,i),d=Math.max(h.lineHeight,a)),x=0,w=y.length;x<w;++x)m(y[x]),d=h.lineHeight;b_(f.after,m)}u=0,d=h.lineHeight,b_(this.afterBody,m),t.y-=o}drawFooter(t,e,i){const n=this.footer,o=n.length;let s,r;if(o){const a=Vk(i.rtl,this.x,this.width);for(t.x=fA(this,i.footerAlign,i),t.y+=i.footerMarginTop,e.textAlign=a.textAlign(i.footerAlign),e.textBaseline="middle",s=nk(i.footerFont),e.fillStyle=i.footerColor,e.font=s.string,r=0;r<o;++r)e.fillText(n[r],a.x(t.x),t.y+s.lineHeight/2),t.y+=s.lineHeight+i.footerSpacing}}drawBackground(t,e,i,n){const{xAlign:o,yAlign:s}=this,{x:r,y:a}=t,{width:l,height:c}=i,{topLeft:h,topRight:d,bottomLeft:u,bottomRight:p}=ek(n.cornerRadius);e.fillStyle=n.backgroundColor,e.strokeStyle=n.borderColor,e.lineWidth=n.borderWidth,e.beginPath(),e.moveTo(r+h,a),"top"===s&&this.drawCaret(t,e,i,n),e.lineTo(r+l-d,a),e.quadraticCurveTo(r+l,a,r+l,a+d),"center"===s&&"right"===o&&this.drawCaret(t,e,i,n),e.lineTo(r+l,a+c-p),e.quadraticCurveTo(r+l,a+c,r+l-p,a+c),"bottom"===s&&this.drawCaret(t,e,i,n),e.lineTo(r+u,a+c),e.quadraticCurveTo(r,a+c,r,a+c-u),"center"===s&&"left"===o&&this.drawCaret(t,e,i,n),e.lineTo(r,a+h),e.quadraticCurveTo(r,a,r+h,a),e.closePath(),e.fill(),n.borderWidth>0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,i=this.$animations,n=i&&i.x,o=i&&i.y;if(n||o){const i=lA[t.position].call(this,this._active,this._eventPosition);if(!i)return;const s=this._size=uA(this,t),r=Object.assign({},i,this._size),a=mA(e,t,r),l=gA(t,r,a,e);n._to===l.x&&o._to===l.y||(this.xAlign=a.xAlign,this.yAlign=a.yAlign,this.width=s.width,this.height=s.height,this.caretX=i.x,this.caretY=i.y,this._resolveAnimations().update(this,l))}}_willRender(){return!!this.opacity}draw(t){const e=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(e);const n={width:this.width,height:this.height},o={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const s=ik(e.padding),r=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&r&&(t.save(),t.globalAlpha=i,this.drawBackground(o,t,n,e),Hk(t,e.textDirection),o.y+=s.top,this.drawTitle(o,t,e),this.drawBody(o,t,e),this.drawFooter(o,t,e),Uk(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const i=this._active,n=t.map((({datasetIndex:t,index:e})=>{const i=this.chart.getDatasetMeta(t);if(!i)throw new Error("Cannot find a dataset at index "+t);return{datasetIndex:t,element:i.data[e],index:e}})),o=!x_(i,n),s=this._positionChanged(n,e);(o||s)&&(this._active=n,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,i=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const n=this.options,o=this._active||[],s=this._getActiveElements(t,o,e,i),r=this._positionChanged(s,t),a=e||!x_(s,o)||r;return a&&(this._active=s,(n.enabled||n.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),a}_getActiveElements(t,e,i,n){const o=this.options;if("mouseout"===t.type)return[];if(!n)return e.filter((t=>this.chart.data.datasets[t.datasetIndex]&&void 0!==this.chart.getDatasetMeta(t.datasetIndex).controller.getParsed(t.index)));const s=this.chart.getElementsAtEventForMode(t,o.mode,o,i);return o.reverse&&s.reverse(),s}_positionChanged(t,e){const{caretX:i,caretY:n,options:o}=this,s=lA[o.position].call(this,t,e);return!1!==s&&(i!==s.x||n!==s.y)}}var wA={id:"tooltip",_element:_A,positioners:lA,afterInit(t,e,i){i&&(t.tooltip=new _A({chart:t,options:i}))},beforeUpdate(t,e,i){t.tooltip&&t.tooltip.initialize(i)},reset(t,e,i){t.tooltip&&t.tooltip.initialize(i)},afterDraw(t){const e=t.tooltip;if(e&&e._willRender()){const i={tooltip:e};if(!1===t.notifyPlugins("beforeTooltipDraw",{...i,cancelable:!0}))return;e.draw(t.ctx),t.notifyPlugins("afterTooltipDraw",i)}},afterEvent(t,e){if(t.tooltip){const i=e.replay;t.tooltip.handleEvent(e.event,i,e.inChartArea)&&(e.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:(t,e)=>e.bodyFont.size,boxWidth:(t,e)=>e.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:bA},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:t=>"filter"!==t&&"itemSort"!==t&&"external"!==t,_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},kA=Object.freeze({__proto__:null,Colors:OE,Decimation:zE,Filler:JE,Legend:nA,SubTitle:aA,Title:sA,Tooltip:wA});function CA(t,e,i,n){const o=t.indexOf(e);if(-1===o)return((t,e,i,n)=>("string"==typeof e?(i=t.push(e)-1,n.unshift({index:i,label:e})):isNaN(e)&&(i=null),i))(t,e,i,n);return o!==t.lastIndexOf(e)?i:o}function SA(t){const e=this.getLabels();return t>=0&&t<e.length?e[t]:t}function EA(t,e){const i=[],{bounds:n,step:o,min:s,max:r,precision:a,count:l,maxTicks:c,maxDigits:h,includeBounds:d}=t,u=o||1,p=c-1,{min:m,max:g}=e,f=!d_(s),v=!d_(r),y=!d_(l),b=(g-m)/(h+1);let x,_,w,k,C=H_((g-m)/p/u)*u;if(C<1e-14&&!f&&!v)return[{value:m},{value:g}];k=Math.ceil(g/C)-Math.floor(m/C),k>p&&(C=H_(k*C/p/u)*u),d_(a)||(x=Math.pow(10,a),C=Math.ceil(C*x)/x),"ticks"===n?(_=Math.floor(m/C)*C,w=Math.ceil(g/C)*C):(_=m,w=g),f&&v&&o&&function(t,e){const i=Math.round(t);return i-e<=t&&i+e>=t}((r-s)/o,C/1e3)?(k=Math.round(Math.min((r-s)/C,c)),C=(r-s)/k,_=s,w=r):y?(_=f?s:_,w=v?r:w,k=l-1,C=(w-_)/k):(k=(w-_)/C,k=V_(k,Math.round(k),C/1e3)?Math.round(k):Math.ceil(k));const S=Math.max(Y_(C),Y_(_));x=Math.pow(10,d_(a)?S:a),_=Math.round(_*x)/x,w=Math.round(w*x)/x;let E=0;for(f&&(d&&_!==s?(i.push({value:s}),_<s&&E++,V_(Math.round((_+E*C)*x)/x,s,AA(s,b,t))&&E++):_<s&&E++);E<k;++E){const t=Math.round((_+E*C)*x)/x;if(v&&t>r)break;i.push({value:t})}return v&&d&&w!==r?i.length&&V_(i[i.length-1].value,r,AA(r,b,t))?i[i.length-1].value=r:i.push({value:r}):v&&w!==r||i.push({value:w}),i}function AA(t,e,{horizontal:i,minRotation:n}){const o=G_(n),s=(i?Math.sin(o):Math.cos(o))||.001,r=.75*e*(""+t).length;return Math.min(e/s,r)}class MA extends CS{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return d_(t)||("number"==typeof t||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:e,maxDefined:i}=this.getUserBounds();let{min:n,max:o}=this;const s=t=>n=e?n:t,r=t=>o=i?o:t;if(t){const t=q_(n),e=q_(o);t<0&&e<0?r(0):t>0&&e>0&&s(0)}if(n===o){let e=0===o?1:Math.abs(.05*o);r(o+e),t||s(n-e)}this.min=n,this.max=o}getTickLimit(){const t=this.options.ticks;let e,{maxTicksLimit:i,stepSize:n}=t;return n?(e=Math.ceil(this.max/n)-Math.floor(this.min/n)+1,e>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${n} would result generating up to ${e} ticks. Limiting to 1000.`),e=1e3)):(e=this.computeTickLimit(),i=i||11),i&&(e=Math.min(i,e)),e}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let i=this.getTickLimit();i=Math.max(2,i);const n=EA({maxTicks:i,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:!1!==e.includeBounds},this._range||this);return"ticks"===t.bounds&&W_(n,this,"value"),t.reverse?(n.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),n}configure(){const t=this.ticks;let e=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){const n=(i-e)/Math.max(t.length-1,1)/2;e-=n,i+=n}this._startValue=e,this._endValue=i,this._valueRange=i-e}getLabelForValue(t){return Sw(t,this.chart.options.locale,this.options.ticks.format)}}class TA extends MA{static id="linear";static defaults={ticks:{callback:Aw.formatters.numeric}};determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=m_(t)?t:0,this.max=m_(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,i=G_(this.options.ticks.minRotation),n=(t?Math.sin(i):Math.cos(i))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,o.lineHeight/n))}getPixelForValue(t){return null===t?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}const PA=t=>Math.floor(F_(t)),DA=(t,e)=>Math.pow(10,PA(t)+e);function IA(t){return 1===t/Math.pow(10,PA(t))}function OA(t,e,i){const n=Math.pow(10,i),o=Math.floor(t/n);return Math.ceil(e/n)-o}function $A(t,{min:e,max:i}){e=g_(t.min,e);const n=[],o=PA(e);let s=function(t,e){let i=PA(e-t);for(;OA(t,e,i)>10;)i++;for(;OA(t,e,i)<10;)i--;return Math.min(i,PA(t))}(e,i),r=s<0?Math.pow(10,Math.abs(s)):1;const a=Math.pow(10,s),l=o>s?Math.pow(10,o):0,c=Math.round((e-l)*r)/r,h=Math.floor((e-l)/a/10)*a*10;let d=Math.floor((c-h)/Math.pow(10,s)),u=g_(t.min,Math.round((l+h+d*Math.pow(10,s))*r)/r);for(;u<i;)n.push({value:u,major:IA(u),significand:d}),d>=10?d=d<15?15:20:d++,d>=20&&(s++,d=2,r=s>=0?1:r),u=Math.round((l+h+d*Math.pow(10,s))*r)/r;const p=g_(t.max,u);return n.push({value:p,major:IA(p),significand:d}),n}class LA extends CS{static id="logarithmic";static defaults={ticks:{callback:Aw.formatters.logarithmic,major:{enabled:!0}}};constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){const i=MA.prototype.parse.apply(this,[t,e]);if(0!==i)return m_(i)&&i>0?i:null;this._zero=!0}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=m_(t)?Math.max(0,t):null,this.max=m_(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!m_(this._userMin)&&(this.min=t===DA(this.min,0)?DA(this.min,-1):DA(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let i=this.min,n=this.max;const o=e=>i=t?i:e,s=t=>n=e?n:t;i===n&&(i<=0?(o(1),s(10)):(o(DA(i,-1)),s(DA(n,1)))),i<=0&&o(DA(n,-1)),n<=0&&s(DA(i,1)),this.min=i,this.max=n}buildTicks(){const t=this.options,e=$A({min:this._userMin,max:this._userMax},this);return"ticks"===t.bounds&&W_(e,this,"value"),t.reverse?(e.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),e}getLabelForValue(t){return void 0===t?"0":Sw(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=F_(t),this._valueRange=F_(this.max)-F_(t)}getPixelForValue(t){return void 0!==t&&0!==t||(t=this.min),null===t||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(F_(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}}function zA(t){const e=t.ticks;if(e.display&&t.display){const t=ik(e.backdropPadding);return f_(e.font&&e.font.size,Ow.font.size)+t.height}return 0}function RA(t,e,i,n,o){return t===n||t===o?{start:e-i/2,end:e+i/2}:t<n||t>o?{start:e-i,end:e}:{start:e,end:e+i}}function NA(t){const e={l:t.left+t._padding.left,r:t.right-t._padding.right,t:t.top+t._padding.top,b:t.bottom-t._padding.bottom},i=Object.assign({},e),n=[],o=[],s=t._pointLabels.length,r=t.options.pointLabels,a=r.centerPointLabels?O_/s:0;for(let d=0;d<s;d++){const s=r.setContext(t.getPointLabelContext(d));o[d]=s.padding;const u=t.getPointPosition(d,t.drawingArea+o[d],a),p=nk(s.font),m=(l=t.ctx,c=p,h=u_(h=t._pointLabels[d])?h:[h],{w:Lw(l,c.string,h),h:h.length*c.lineHeight});n[d]=m;const g=J_(t.getIndexAngle(d)+a),f=Math.round(Z_(g));jA(i,e,g,RA(f,u.x,m.w,0,180),RA(f,u.y,m.h,90,270))}var l,c,h;t.setCenterPoint(e.l-i.l,i.r-e.r,e.t-i.t,i.b-e.b),t._pointLabelItems=function(t,e,i){const n=[],o=t._pointLabels.length,s=t.options,{centerPointLabels:r,display:a}=s.pointLabels,l={extra:zA(s)/2,additionalAngle:r?O_/o:0};let c;for(let s=0;s<o;s++){l.padding=i[s],l.size=e[s];const o=BA(t,s,l);n.push(o),"auto"===a&&(o.visible=FA(o,c),o.visible&&(c=o))}return n}(t,n,o)}function jA(t,e,i,n,o){const s=Math.abs(Math.sin(i)),r=Math.abs(Math.cos(i));let a=0,l=0;n.start<e.l?(a=(e.l-n.start)/s,t.l=Math.min(t.l,e.l-a)):n.end>e.r&&(a=(n.end-e.r)/s,t.r=Math.max(t.r,e.r+a)),o.start<e.t?(l=(e.t-o.start)/r,t.t=Math.min(t.t,e.t-l)):o.end>e.b&&(l=(o.end-e.b)/r,t.b=Math.max(t.b,e.b+l))}function BA(t,e,i){const n=t.drawingArea,{extra:o,additionalAngle:s,padding:r,size:a}=i,l=t.getPointPosition(e,n+o+r,s),c=Math.round(Z_(J_(l.angle+N_))),h=function(t,e,i){90===i||270===i?t-=e/2:(i>270||i<90)&&(t-=e);return t}(l.y,a.h,c),d=function(t){if(0===t||180===t)return"center";if(t<180)return"left";return"right"}(c),u=function(t,e,i){"right"===i?t-=e:"center"===i&&(t-=e/2);return t}(l.x,a.w,d);return{visible:!0,x:l.x,y:h,textAlign:d,left:u,top:h,right:u+a.w,bottom:h+a.h}}function FA(t,e){if(!e)return!0;const{left:i,top:n,right:o,bottom:s}=t;return!(Bw({x:i,y:n},e)||Bw({x:i,y:s},e)||Bw({x:o,y:n},e)||Bw({x:o,y:s},e))}function qA(t,e,i){const{left:n,top:o,right:s,bottom:r}=i,{backdropColor:a}=e;if(!d_(a)){const i=ek(e.borderRadius),l=ik(e.backdropPadding);t.fillStyle=a;const c=n-l.left,h=o-l.top,d=s-n+l.width,u=r-o+l.height;Object.values(i).some((t=>0!==t))?(t.beginPath(),Zw(t,{x:c,y:h,w:d,h:u,radius:i}),t.fill()):t.fillRect(c,h,d,u)}}function VA(t,e,i,n){const{ctx:o}=t;if(i)o.arc(t.xCenter,t.yCenter,e,0,$_);else{let i=t.getPointPosition(0,e);o.moveTo(i.x,i.y);for(let s=1;s<n;s++)i=t.getPointPosition(s,e),o.lineTo(i.x,i.y)}}class HA extends MA{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:Aw.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback:t=>t,padding:5,centerPointLabels:!1}};static defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"};static descriptors={angleLines:{_fallback:"grid"}};constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){const t=this._padding=ik(zA(this.options)/2),e=this.width=this.maxWidth-t.width,i=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+e/2+t.left),this.yCenter=Math.floor(this.top+i/2+t.top),this.drawingArea=Math.floor(Math.min(e,i)/2)}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!1);this.min=m_(t)&&!isNaN(t)?t:0,this.max=m_(e)&&!isNaN(e)?e:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/zA(this.options))}generateTickLabels(t){MA.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map(((t,e)=>{const i=y_(this.options.pointLabels.callback,[t,e],this);return i||0===i?i:""})).filter(((t,e)=>this.chart.getDataVisibility(e)))}fit(){const t=this.options;t.display&&t.pointLabels.display?NA(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,i,n){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((i-n)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,i,n))}getIndexAngle(t){return J_(t*($_/(this._pointLabels.length||1))+G_(this.options.startAngle||0))}getDistanceFromCenterForValue(t){if(d_(t))return NaN;const e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(d_(t))return NaN;const e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){const e=this._pointLabels||[];if(t>=0&&t<e.length){const i=e[t];return function(t,e,i){return sk(t,{label:i,index:e,type:"pointLabel"})}(this.getContext(),t,i)}}getPointPosition(t,e,i=0){const n=this.getIndexAngle(t)-N_+i;return{x:Math.cos(n)*e+this.xCenter,y:Math.sin(n)*e+this.yCenter,angle:n}}getPointPositionForValue(t,e){return this.getPointPosition(t,this.getDistanceFromCenterForValue(e))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}getPointLabelPosition(t){const{left:e,top:i,right:n,bottom:o}=this._pointLabelItems[t];return{left:e,top:i,right:n,bottom:o}}drawBackground(){const{backgroundColor:t,grid:{circular:e}}=this.options;if(t){const i=this.ctx;i.save(),i.beginPath(),VA(this,this.getDistanceFromCenterForValue(this._endValue),e,this._pointLabels.length),i.closePath(),i.fillStyle=t,i.fill(),i.restore()}}drawGrid(){const t=this.ctx,e=this.options,{angleLines:i,grid:n,border:o}=e,s=this._pointLabels.length;let r,a,l;if(e.pointLabels.display&&function(t,e){const{ctx:i,options:{pointLabels:n}}=t;for(let o=e-1;o>=0;o--){const e=t._pointLabelItems[o];if(!e.visible)continue;const s=n.setContext(t.getPointLabelContext(o));qA(i,s,e);const r=nk(s.font),{x:a,y:l,textAlign:c}=e;Gw(i,t._pointLabels[o],a,l+r.lineHeight/2,r,{color:s.color,textAlign:c,textBaseline:"middle"})}}(this,s),n.display&&this.ticks.forEach(((t,e)=>{if(0!==e||0===e&&this.min<0){a=this.getDistanceFromCenterForValue(t.value);const i=this.getContext(e),r=n.setContext(i),l=o.setContext(i);!function(t,e,i,n,o){const s=t.ctx,r=e.circular,{color:a,lineWidth:l}=e;!r&&!n||!a||!l||i<0||(s.save(),s.strokeStyle=a,s.lineWidth=l,s.setLineDash(o.dash||[]),s.lineDashOffset=o.dashOffset,s.beginPath(),VA(t,i,r,n),s.closePath(),s.stroke(),s.restore())}(this,r,a,s,l)}})),i.display){for(t.save(),r=s-1;r>=0;r--){const n=i.setContext(this.getPointLabelContext(r)),{color:o,lineWidth:s}=n;s&&o&&(t.lineWidth=s,t.strokeStyle=o,t.setLineDash(n.borderDash),t.lineDashOffset=n.borderDashOffset,a=this.getDistanceFromCenterForValue(e.reverse?this.min:this.max),l=this.getPointPosition(r,a),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(l.x,l.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,e=this.options,i=e.ticks;if(!i.display)return;const n=this.getIndexAngle(0);let o,s;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(n),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach(((n,r)=>{if(0===r&&this.min>=0&&!e.reverse)return;const a=i.setContext(this.getContext(r)),l=nk(a.font);if(o=this.getDistanceFromCenterForValue(this.ticks[r].value),a.showLabelBackdrop){t.font=l.string,s=t.measureText(n.label).width,t.fillStyle=a.backdropColor;const e=ik(a.backdropPadding);t.fillRect(-s/2-e.left,-o-l.size/2-e.top,s+e.width,l.size+e.height)}Gw(t,n.label,0,-o,l,{color:a.color,strokeColor:a.textStrokeColor,strokeWidth:a.textStrokeWidth})})),t.restore()}drawTitle(){}}const UA={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}},WA=Object.keys(UA);function GA(t,e){return t-e}function ZA(t,e){if(d_(e))return null;const i=t._adapter,{parser:n,round:o,isoWeekday:s}=t._parseOpts;let r=e;return"function"==typeof n&&(r=n(r)),m_(r)||(r="string"==typeof n?i.parse(r,n):i.parse(r)),null===r?null:(o&&(r="week"!==o||!U_(s)&&!0!==s?i.startOf(r,o):i.startOf(r,"isoWeek",s)),+r)}function YA(t,e,i,n){const o=WA.length;for(let s=WA.indexOf(t);s<o-1;++s){const t=UA[WA[s]],o=t.steps?t.steps:Number.MAX_SAFE_INTEGER;if(t.common&&Math.ceil((i-e)/(o*t.size))<=n)return WA[s]}return WA[o-1]}function XA(t,e,i){if(i){if(i.length){const{lo:n,hi:o}=nw(i,e);t[i[n]>=e?i[n]:i[o]]=!0}}else t[e]=!0}function KA(t,e,i){const n=[],o={},s=e.length;let r,a;for(r=0;r<s;++r)a=e[r],o[a]=r,n.push({value:a,major:!1});return 0!==s&&i?function(t,e,i,n){const o=t._adapter,s=+o.startOf(e[0].value,n),r=e[e.length-1].value;let a,l;for(a=s;a<=r;a=+o.add(a,1,n))l=i[a],l>=0&&(e[l].major=!0);return e}(t,n,o,i):n}class QA extends CS{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(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,e={}){const i=t.time||(t.time={}),n=this._adapter=new PC._date(t.adapters.date);n.init(e),S_(i.displayFormats,n.formats()),this._parseOpts={parser:i.parser,round:i.round,isoWeekday:i.isoWeekday},super.init(t),this._normalized=e.normalized}parse(t,e){return void 0===t?null:ZA(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,e=this._adapter,i=t.time.unit||"day";let{min:n,max:o,minDefined:s,maxDefined:r}=this.getUserBounds();function a(t){s||isNaN(t.min)||(n=Math.min(n,t.min)),r||isNaN(t.max)||(o=Math.max(o,t.max))}s&&r||(a(this._getLabelBounds()),"ticks"===t.bounds&&"labels"===t.ticks.source||a(this.getMinMax(!1))),n=m_(n)&&!isNaN(n)?n:+e.startOf(Date.now(),i),o=m_(o)&&!isNaN(o)?o:+e.endOf(Date.now(),i)+1,this.min=Math.min(n,o-1),this.max=Math.max(n+1,o)}_getLabelBounds(){const t=this.getLabelTimestamps();let e=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;return t.length&&(e=t[0],i=t[t.length-1]),{min:e,max:i}}buildTicks(){const t=this.options,e=t.time,i=t.ticks,n="labels"===i.source?this.getLabelTimestamps():this._generate();"ticks"===t.bounds&&n.length&&(this.min=this._userMin||n[0],this.max=this._userMax||n[n.length-1]);const o=this.min,s=function(t,e,i){let n=0,o=t.length;for(;n<o&&t[n]<e;)n++;for(;o>n&&t[o-1]>i;)o--;return n>0||o<t.length?t.slice(n,o):t}(n,o,this.max);return this._unit=e.unit||(i.autoSkip?YA(e.minUnit,this.min,this.max,this._getLabelCapacity(o)):function(t,e,i,n,o){for(let s=WA.length-1;s>=WA.indexOf(i);s--){const i=WA[s];if(UA[i].common&&t._adapter.diff(o,n,i)>=e-1)return i}return WA[i?WA.indexOf(i):0]}(this,s.length,e.minUnit,this.min,this.max)),this._majorUnit=i.major.enabled&&"year"!==this._unit?function(t){for(let e=WA.indexOf(t)+1,i=WA.length;e<i;++e)if(UA[WA[e]].common)return WA[e]}(this._unit):void 0,this.initOffsets(n),t.reverse&&s.reverse(),KA(this,s,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map((t=>+t.value)))}initOffsets(t=[]){let e,i,n=0,o=0;this.options.offset&&t.length&&(e=this.getDecimalForValue(t[0]),n=1===t.length?1-e:(this.getDecimalForValue(t[1])-e)/2,i=this.getDecimalForValue(t[t.length-1]),o=1===t.length?i:(i-this.getDecimalForValue(t[t.length-2]))/2);const s=t.length<3?.5:.25;n=ew(n,0,s),o=ew(o,0,s),this._offsets={start:n,end:o,factor:1/(n+1+o)}}_generate(){const t=this._adapter,e=this.min,i=this.max,n=this.options,o=n.time,s=o.unit||YA(o.minUnit,e,i,this._getLabelCapacity(e)),r=f_(n.ticks.stepSize,1),a="week"===s&&o.isoWeekday,l=U_(a)||!0===a,c={};let h,d,u=e;if(l&&(u=+t.startOf(u,"isoWeek",a)),u=+t.startOf(u,l?"day":s),t.diff(i,e,s)>1e5*r)throw new Error(e+" and "+i+" are too far apart with stepSize of "+r+" "+s);const p="data"===n.ticks.source&&this.getDataTimestamps();for(h=u,d=0;h<i;h=+t.add(h,r,s),d++)XA(c,h,p);return h!==i&&"ticks"!==n.bounds&&1!==d||XA(c,h,p),Object.keys(c).sort(GA).map((t=>+t))}getLabelForValue(t){const e=this._adapter,i=this.options.time;return i.tooltipFormat?e.format(t,i.tooltipFormat):e.format(t,i.displayFormats.datetime)}format(t,e){const i=this.options.time.displayFormats,n=this._unit,o=e||i[n];return this._adapter.format(t,o)}_tickFormatFunction(t,e,i,n){const o=this.options,s=o.ticks.callback;if(s)return y_(s,[t,e,i],this);const r=o.time.displayFormats,a=this._unit,l=this._majorUnit,c=a&&r[a],h=l&&r[l],d=i[e],u=l&&h&&d&&d.major;return this._adapter.format(t,n||(u?h:c))}generateTickLabels(t){let e,i,n;for(e=0,i=t.length;e<i;++e)n=t[e],n.label=this._tickFormatFunction(n.value,e,t)}getDecimalForValue(t){return null===t?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const e=this._offsets,i=this.getDecimalForValue(t);return this.getPixelForDecimal((e.start+i)*e.factor)}getValueForPixel(t){const e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return this.min+i*(this.max-this.min)}_getLabelSize(t){const e=this.options.ticks,i=this.ctx.measureText(t).width,n=G_(this.isHorizontal()?e.maxRotation:e.minRotation),o=Math.cos(n),s=Math.sin(n),r=this._resolveTickFontOptions(0).size;return{w:i*o+r*s,h:i*s+r*o}}_getLabelCapacity(t){const e=this.options.time,i=e.displayFormats,n=i[e.unit]||i.millisecond,o=this._tickFormatFunction(t,0,KA(this,[t],this._majorUnit),n),s=this._getLabelSize(o),r=Math.floor(this.isHorizontal()?this.width/s.w:this.height/s.h)-1;return r>0?r:1}getDataTimestamps(){let t,e,i=this._cache.data||[];if(i.length)return i;const n=this.getMatchingVisibleMetas();if(this._normalized&&n.length)return this._cache.data=n[0].controller.getAllParsedValues(this);for(t=0,e=n.length;t<e;++t)i=i.concat(n[t].controller.getAllParsedValues(this));return this._cache.data=this.normalize(i)}getLabelTimestamps(){const t=this._cache.labels||[];let e,i;if(t.length)return t;const n=this.getLabels();for(e=0,i=n.length;e<i;++e)t.push(ZA(this,n[e]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return lw(t.sort(GA))}}function JA(t,e,i){let n,o,s,r,a=0,l=t.length-1;i?(e>=t[a].pos&&e<=t[l].pos&&({lo:a,hi:l}=ow(t,"pos",e)),({pos:n,time:s}=t[a]),({pos:o,time:r}=t[l])):(e>=t[a].time&&e<=t[l].time&&({lo:a,hi:l}=ow(t,"time",e)),({time:n,pos:s}=t[a]),({time:o,pos:r}=t[l]));const c=o-n;return c?s+(r-s)*(e-n)/c:s}var tM=Object.freeze({__proto__:null,CategoryScale:class extends CS{static id="category";static defaults={ticks:{callback:SA}};constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const e=this._addedLabels;if(e.length){const t=this.getLabels();for(const{index:i,label:n}of e)t[i]===n&&t.splice(i,1);this._addedLabels=[]}super.init(t)}parse(t,e){if(d_(t))return null;const i=this.getLabels();return((t,e)=>null===t?null:ew(Math.round(t),0,e))(e=isFinite(e)&&i[e]===t?e:CA(i,t,f_(e,t),this._addedLabels),i.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let{min:i,max:n}=this.getMinMax(!0);"ticks"===this.options.bounds&&(t||(i=0),e||(n=this.getLabels().length-1)),this.min=i,this.max=n}buildTicks(){const t=this.min,e=this.max,i=this.options.offset,n=[];let o=this.getLabels();o=0===t&&e===o.length-1?o:o.slice(t,e+1),this._valueRange=Math.max(o.length-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let i=t;i<=e;i++)n.push({value:i});return n}getLabelForValue(t){return SA.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return"number"!=typeof t&&(t=this.parse(t)),null===t?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}},LinearScale:TA,LogarithmicScale:LA,RadialLinearScale:HA,TimeScale:QA,TimeSeriesScale:class extends QA{static id="timeseries";static defaults=QA.defaults;constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=JA(e,this.min),this._tableRange=JA(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:i}=this,n=[],o=[];let s,r,a,l,c;for(s=0,r=t.length;s<r;++s)l=t[s],l>=e&&l<=i&&n.push(l);if(n.length<2)return[{time:e,pos:0},{time:i,pos:1}];for(s=0,r=n.length;s<r;++s)c=n[s+1],a=n[s-1],l=n[s],Math.round((c+a)/2)!==l&&o.push({time:l,pos:s/(r-1)});return o}_generate(){const t=this.min,e=this.max;let i=super.getDataTimestamps();return i.includes(t)&&i.length||i.splice(0,0,t),i.includes(e)&&1!==i.length||i.push(e),i.sort(((t,e)=>t-e))}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const e=this.getDataTimestamps(),i=this.getLabelTimestamps();return t=e.length&&i.length?this.normalize(e.concat(i)):e.length?e:i,t=this._cache.all=t,t}getDecimalForValue(t){return(JA(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return JA(this._table,i*this._tableRange+this._minPos,!0)}}});const eM=[AC,EE,kA,tM];eE.register(...eM);
|
|
9515
9473
|
/*!
|
|
9516
9474
|
* chartjs-adapter-luxon v1.3.1
|
|
9517
9475
|
* https://www.chartjs.org
|
|
9518
9476
|
* (c) 2023 chartjs-adapter-luxon Contributors
|
|
9519
9477
|
* Released under the MIT license
|
|
9520
9478
|
*/
|
|
9521
|
-
const
|
|
9479
|
+
const iM={datetime:za.DATETIME_MED_WITH_SECONDS,millisecond:"h:mm:ss.SSS a",second:za.TIME_WITH_SECONDS,minute:za.TIME_SIMPLE,hour:{hour:"numeric"},day:{day:"numeric",month:"short"},week:"DD",month:{month:"short",year:"numeric"},quarter:"'Q'q - yyyy",year:{year:"numeric"}};PC._date.override({_id:"luxon",_create:function(t){return za.fromMillis(t,this.options)},init(t){this.options.locale||(this.options.locale=t.locale)},formats:function(){return iM},parse:function(t,e){const i=this.options,n=typeof t;return null===t||"undefined"===n?null:("number"===n?t=this._create(t):"string"===n?t="string"==typeof e?za.fromFormat(t,e,i):za.fromISO(t,i):t instanceof Date?t=za.fromJSDate(t,i):"object"!==n||t instanceof za||(t=za.fromObject(t,i)),t.isValid?t.valueOf():null)},format:function(t,e){const i=this._create(t);return"string"==typeof e?i.toFormat(e):i.toLocaleString(e)},add:function(t,e,i){const n={};return n[i]=e,this._create(t).plus(n).valueOf()},diff:function(t,e,i){return this._create(t).diff(this._create(e)).as(i).valueOf()},startOf:function(t,e,i){if("isoWeek"===e){i=Math.trunc(Math.min(Math.max(0,i),6));const e=this._create(t);return e.minus({days:(e.weekday-i+7)%7}).startOf("day").valueOf()}return e?this._create(t).startOf(e).valueOf():t},endOf:function(t,e){return this._create(t).endOf(e).valueOf()}});
|
|
9522
9480
|
/*!
|
|
9523
9481
|
* chartjs-plugin-datalabels v2.2.0
|
|
9524
9482
|
* https://chartjs-plugin-datalabels.netlify.app
|
|
9525
9483
|
* (c) 2017-2022 chartjs-plugin-datalabels contributors
|
|
9526
9484
|
* Released under the MIT license
|
|
9527
9485
|
*/
|
|
9528
|
-
var JA=function(){if("undefined"!=typeof window){if(window.devicePixelRatio)return window.devicePixelRatio;var t=window.screen;if(t)return(t.deviceXDPI||1)/(t.logicalXDPI||1)}return 1}(),tM=function(t){var e,i=[];for(t=[].concat(t);t.length;)"string"==typeof(e=t.pop())?i.unshift.apply(i,e.split("\n")):Array.isArray(e)?t.push.apply(t,e):a_(t)||i.unshift(""+e);return i},eM=function(t,e,i){var n,o=[].concat(e),s=o.length,r=t.font,a=0;for(t.font=i.string,n=0;n<s;++n)a=Math.max(t.measureText(o[n]).width,a);return t.font=r,{height:s*i.lineHeight,width:a}},iM=function(t,e,i){return Math.max(t,Math.min(e,i))},nM=function(t,e){var i,n,o,s,r=t.slice(),a=[];for(i=0,o=e.length;i<o;++i)s=e[i],-1===(n=r.indexOf(s))?a.push([s,1]):r.splice(n,1);for(i=0,o=r.length;i<o;++i)a.push([r[i],-1]);return a},oM=function(t){return Math.round(t*JA)/JA};function sM(t,e){var i=e.x,n=e.y;if(null===i)return{x:0,y:-1};if(null===n)return{x:1,y:0};var o=t.x-i,s=t.y-n,r=Math.sqrt(o*o+s*s);return{x:r?o/r:0,y:r?s/r:-1}}var rM=0,aM=1,lM=2,cM=4,hM=8;function dM(t,e,i){var n=rM;return t<i.left?n|=aM:t>i.right&&(n|=lM),e<i.top?n|=hM:e>i.bottom&&(n|=cM),n}function uM(t,e){var i,n,o=e.anchor,s=t;return e.clamp&&(s=function(t,e){for(var i,n,o,s=t.x0,r=t.y0,a=t.x1,l=t.y1,c=dM(s,r,e),h=dM(a,l,e);c|h&&!(c&h);)(i=c||h)&hM?(n=s+(a-s)*(e.top-r)/(l-r),o=e.top):i&cM?(n=s+(a-s)*(e.bottom-r)/(l-r),o=e.bottom):i&lM?(o=r+(l-r)*(e.right-s)/(a-s),n=e.right):i&aM&&(o=r+(l-r)*(e.left-s)/(a-s),n=e.left),i===c?c=dM(s=n,r=o,e):h=dM(a=n,l=o,e);return{x0:s,x1:a,y0:r,y1:l}}(s,e.area)),"start"===o?(i=s.x0,n=s.y0):"end"===o?(i=s.x1,n=s.y1):(i=(s.x0+s.x1)/2,n=(s.y0+s.y1)/2),function(t,e,i,n,o){switch(o){case"center":i=n=0;break;case"bottom":i=0,n=1;break;case"right":i=1,n=0;break;case"left":i=-1,n=0;break;case"top":i=0,n=-1;break;case"start":i=-i,n=-n;break;case"end":break;default:o*=Math.PI/180,i=Math.cos(o),n=Math.sin(o)}return{x:t,y:e,vx:i,vy:n}}(i,n,t.vx,t.vy,e.align)}var pM=function(t,e){var i=(t.startAngle+t.endAngle)/2,n=Math.cos(i),o=Math.sin(i),s=t.innerRadius,r=t.outerRadius;return uM({x0:t.x+n*s,y0:t.y+o*s,x1:t.x+n*r,y1:t.y+o*r,vx:n,vy:o},e)},mM=function(t,e){var i=sM(t,e.origin),n=i.x*t.options.radius,o=i.y*t.options.radius;return uM({x0:t.x-n,y0:t.y-o,x1:t.x+n,y1:t.y+o,vx:i.x,vy:i.y},e)},gM=function(t,e){var i=sM(t,e.origin),n=t.x,o=t.y,s=0,r=0;return t.horizontal?(n=Math.min(t.x,t.base),s=Math.abs(t.base-t.x)):(o=Math.min(t.y,t.base),r=Math.abs(t.base-t.y)),uM({x0:n,y0:o+r,x1:n+s,y1:o,vx:i.x,vy:i.y},e)},fM=function(t,e){var i=sM(t,e.origin);return uM({x0:t.x,y0:t.y,x1:t.x+(t.width||0),y1:t.y+(t.height||0),vx:i.x,vy:i.y},e)},vM=oM;function yM(t,e){var i=e.chart.getDatasetMeta(e.datasetIndex).vScale;if(!i)return null;if(void 0!==i.xCenter&&void 0!==i.yCenter)return{x:i.xCenter,y:i.yCenter};var n=i.getBasePixel();return t.horizontal?{x:n,y:null}:{x:null,y:n}}function bM(t,e,i){var n=i.backgroundColor,o=i.borderColor,s=i.borderWidth;(n||o&&s)&&(t.beginPath(),function(t,e,i,n,o,s){var r=Math.PI/2;if(s){var a=Math.min(s,o/2,n/2),l=e+a,c=i+a,h=e+n-a,d=i+o-a;t.moveTo(e,c),l<h&&c<d?(t.arc(l,c,a,-Math.PI,-r),t.arc(h,c,a,-r,0),t.arc(h,d,a,0,r),t.arc(l,d,a,r,Math.PI)):l<h?(t.moveTo(l,i),t.arc(h,c,a,-r,r),t.arc(l,c,a,r,Math.PI+r)):c<d?(t.arc(l,c,a,-Math.PI,0),t.arc(l,d,a,0,Math.PI)):t.arc(l,c,a,-Math.PI,Math.PI),t.closePath(),t.moveTo(e,i)}else t.rect(e,i,n,o)}(t,vM(e.x)+s/2,vM(e.y)+s/2,vM(e.w)-s,vM(e.h)-s,i.borderRadius),t.closePath(),n&&(t.fillStyle=n,t.fill()),o&&s&&(t.strokeStyle=o,t.lineWidth=s,t.lineJoin="miter",t.stroke()))}function xM(t,e,i){var n=t.shadowBlur,o=i.stroked,s=vM(i.x),r=vM(i.y),a=vM(i.w);o&&t.strokeText(e,s,r,a),i.filled&&(n&&o&&(t.shadowBlur=0),t.fillText(e,s,r,a),n&&o&&(t.shadowBlur=n))}var _M=function(t,e,i,n){var o=this;o._config=t,o._index=n,o._model=null,o._rects=null,o._ctx=e,o._el=i};x_(_M.prototype,{_modelize:function(t,e,i,n){var o,s=this,r=s._index,a=Jw(tk([i.font,{}],n,r)),l=tk([i.color,Tw.color],n,r);return{align:tk([i.align,"center"],n,r),anchor:tk([i.anchor,"center"],n,r),area:n.chart.chartArea,backgroundColor:tk([i.backgroundColor,null],n,r),borderColor:tk([i.borderColor,null],n,r),borderRadius:tk([i.borderRadius,0],n,r),borderWidth:tk([i.borderWidth,0],n,r),clamp:tk([i.clamp,!1],n,r),clip:tk([i.clip,!1],n,r),color:l,display:t,font:a,lines:e,offset:tk([i.offset,4],n,r),opacity:tk([i.opacity,1],n,r),origin:yM(s._el,n),padding:Qw(tk([i.padding,4],n,r)),positioner:(o=s._el,o instanceof nE?pM:o instanceof mE?mM:o instanceof _E?gM:fM),rotation:tk([i.rotation,0],n,r)*(Math.PI/180),size:eM(s._ctx,e,a),textAlign:tk([i.textAlign,"start"],n,r),textShadowBlur:tk([i.textShadowBlur,0],n,r),textShadowColor:tk([i.textShadowColor,l],n,r),textStrokeColor:tk([i.textStrokeColor,l],n,r),textStrokeWidth:tk([i.textStrokeWidth,0],n,r)}},update:function(t){var e,i,n,o=this,s=null,r=null,a=o._index,l=o._config,c=tk([l.display,!0],t,a);c&&(e=t.dataset.data[a],(n=a_(i=u_(m_(l.formatter,[e,t]),e))?[]:tM(i)).length&&(r=function(t){var e=t.borderWidth||0,i=t.padding,n=t.size.height,o=t.size.width,s=-o/2,r=-n/2;return{frame:{x:s-i.left-e,y:r-i.top-e,w:o+i.width+2*e,h:n+i.height+2*e},text:{x:s,y:r,w:o,h:n}}}(s=o._modelize(c,n,l,t)))),o._model=s,o._rects=r},geometry:function(){return this._rects?this._rects.frame:{}},rotation:function(){return this._model?this._model.rotation:0},visible:function(){return this._model&&this._model.opacity},model:function(){return this._model},draw:function(t,e){var i,n=t.ctx,o=this._model,s=this._rects;this.visible()&&(n.save(),o.clip&&(i=o.area,n.beginPath(),n.rect(i.left,i.top,i.right-i.left,i.bottom-i.top),n.clip()),n.globalAlpha=iM(0,o.opacity,1),n.translate(vM(e.x),vM(e.y)),n.rotate(o.rotation),bM(n,s.frame,o),function(t,e,i,n){var o,s=n.textAlign,r=n.color,a=!!r,l=n.font,c=e.length,h=n.textStrokeColor,d=n.textStrokeWidth,u=h&&d;if(c&&(a||u))for(i=function(t,e,i){var n=i.lineHeight,o=t.w,s=t.x;return"center"===e?s+=o/2:"end"!==e&&"right"!==e||(s+=o),{h:n,w:o,x:s,y:t.y+n/2}}(i,s,l),t.font=l.string,t.textAlign=s,t.textBaseline="middle",t.shadowBlur=n.textShadowBlur,t.shadowColor=n.textShadowColor,a&&(t.fillStyle=r),u&&(t.lineJoin="round",t.lineWidth=d,t.strokeStyle=h),o=0,c=e.length;o<c;++o)xM(t,e[o],{stroked:u,filled:a,w:i.w,x:i.x,y:i.y+i.h*o})}(n,o.lines,s.text,o),n.restore())}});var wM=Number.MIN_SAFE_INTEGER||-9007199254740991,kM=Number.MAX_SAFE_INTEGER||9007199254740991;function CM(t,e,i){var n=Math.cos(i),o=Math.sin(i),s=e.x,r=e.y;return{x:s+n*(t.x-s)-o*(t.y-r),y:r+o*(t.x-s)+n*(t.y-r)}}function SM(t,e){var i,n,o,s,r,a=kM,l=wM,c=e.origin;for(i=0;i<t.length;++i)o=(n=t[i]).x-c.x,s=n.y-c.y,r=e.vx*o+e.vy*s,a=Math.min(a,r),l=Math.max(l,r);return{min:a,max:l}}function EM(t,e){var i=e.x-t.x,n=e.y-t.y,o=Math.sqrt(i*i+n*n);return{vx:(e.x-t.x)/o,vy:(e.y-t.y)/o,origin:t,ln:o}}var AM=function(){this._rotation=0,this._rect={x:0,y:0,w:0,h:0}};function MM(t,e,i){var n=e.positioner(t,e),o=n.vx,s=n.vy;if(!o&&!s)return{x:n.x,y:n.y};var r=i.w,a=i.h,l=e.rotation,c=Math.abs(r/2*Math.cos(l))+Math.abs(a/2*Math.sin(l)),h=Math.abs(r/2*Math.sin(l))+Math.abs(a/2*Math.cos(l)),d=1/Math.max(Math.abs(o),Math.abs(s));return c*=o*d,h*=s*d,c+=e.offset*o,h+=e.offset*s,{x:n.x+c,y:n.y+h}}x_(AM.prototype,{center:function(){var t=this._rect;return{x:t.x+t.w/2,y:t.y+t.h/2}},update:function(t,e,i){this._rotation=i,this._rect={x:e.x+t.x,y:e.y+t.y,w:e.w,h:e.h}},contains:function(t){var e=this,i=e._rect;return!((t=CM(t,e.center(),-e._rotation)).x<i.x-1||t.y<i.y-1||t.x>i.x+i.w+2||t.y>i.y+i.h+2)},intersects:function(t){var e,i,n,o=this._points(),s=t._points(),r=[EM(o[0],o[1]),EM(o[0],o[3])];for(this._rotation!==t._rotation&&r.push(EM(s[0],s[1]),EM(s[0],s[3])),e=0;e<r.length;++e)if(i=SM(o,r[e]),n=SM(s,r[e]),i.max<n.min||n.max<i.min)return!1;return!0},_points:function(){var t=this,e=t._rect,i=t._rotation,n=t.center();return[CM({x:e.x,y:e.y},n,i),CM({x:e.x+e.w,y:e.y},n,i),CM({x:e.x+e.w,y:e.y+e.h},n,i),CM({x:e.x,y:e.y+e.h},n,i)]}});var TM={prepare:function(t){var e,i,n,o,s,r=[];for(e=0,n=t.length;e<n;++e)for(i=0,o=t[e].length;i<o;++i)s=t[e][i],r.push(s),s.$layout={_box:new AM,_hidable:!1,_visible:!0,_set:e,_idx:s._index};return r.sort((function(t,e){var i=t.$layout,n=e.$layout;return i._idx===n._idx?n._set-i._set:n._idx-i._idx})),this.update(r),r},update:function(t){var e,i,n,o,s,r=!1;for(e=0,i=t.length;e<i;++e)o=(n=t[e]).model(),(s=n.$layout)._hidable=o&&"auto"===o.display,s._visible=n.visible(),r|=s._hidable;r&&function(t){var e,i,n,o,s,r,a;for(e=0,i=t.length;e<i;++e)(o=(n=t[e]).$layout)._visible&&(a=new Proxy(n._el,{get:(t,e)=>t.getProps([e],!0)[e]}),s=n.geometry(),r=MM(a,n.model(),s),o._box.update(r,s,n.rotation()));(function(t,e){var i,n,o,s;for(i=t.length-1;i>=0;--i)for(o=t[i].$layout,n=i-1;n>=0&&o._visible;--n)(s=t[n].$layout)._visible&&o._box.intersects(s._box)&&e(o,s)})(t,(function(t,e){var i=t._hidable,n=e._hidable;i&&n||n?e._visible=!1:i&&(t._visible=!1)}))}(t)},lookup:function(t,e){var i,n;for(i=t.length-1;i>=0;--i)if((n=t[i].$layout)&&n._visible&&n._box.contains(e))return t[i];return null},draw:function(t,e){var i,n,o,s,r,a;for(i=0,n=e.length;i<n;++i)(s=(o=e[i]).$layout)._visible&&(r=o.geometry(),a=MM(o._el,o.model(),r),s._box.update(a,r,o.rotation()),o.draw(t,a))}},PM={align:"center",anchor:"center",backgroundColor:null,borderColor:null,borderRadius:0,borderWidth:0,clamp:!1,clip:!1,color:void 0,display:!0,font:{family:void 0,lineHeight:1.2,size:void 0,style:void 0,weight:null},formatter:function(t){if(a_(t))return null;var e,i,n,o=t;if(c_(t))if(a_(t.label))if(a_(t.r))for(o="",n=0,i=(e=Object.keys(t)).length;n<i;++n)o+=(0!==n?", ":"")+e[n]+": "+t[e[n]];else o=t.r;else o=t.label;return""+o},labels:void 0,listeners:{},offset:4,opacity:1,padding:{top:4,right:4,bottom:4,left:4},rotation:0,textAlign:"start",textStrokeColor:void 0,textStrokeWidth:0,textShadowBlur:0,textShadowColor:void 0},DM="$datalabels",IM="$default";function OM(t,e,i,n){if(e){var o,s=i.$context,r=i.$groups;e[r._set]&&(o=e[r._set][r._key])&&!0===m_(o,[s,n])&&(t[DM]._dirty=!0,i.update(s))}}function $M(t,e){var i,n,o=t[DM],s=o._listeners;if(s.enter||s.leave){if("mousemove"===e.type)n=TM.lookup(o._labels,e);else if("mouseout"!==e.type)return;i=o._hovered,o._hovered=n,function(t,e,i,n,o){var s,r;(i||n)&&(i?n?i!==n&&(r=s=!0):r=!0:s=!0,r&&OM(t,e.leave,i,o),s&&OM(t,e.enter,n,o))}(t,s,i,n,e)}}var LM={id:"datalabels",defaults:PM,beforeInit:function(t){t[DM]={_actives:[]}},beforeUpdate:function(t){var e=t[DM];e._listened=!1,e._listeners={},e._datasets=[],e._labels=[]},afterDatasetUpdate:function(t,e,i){var n,o,s,r,a,l,c,h,d=e.index,u=t[DM],p=u._datasets[d]=[],m=t.isDatasetVisible(d),g=t.data.datasets[d],f=function(t,e){var i,n,o,s=t.datalabels,r=[];return!1===s?null:(!0===s&&(s={}),e=x_({},[e,s]),n=e.labels||{},o=Object.keys(n),delete e.labels,o.length?o.forEach((function(t){n[t]&&r.push(x_({},[e,n[t],{_key:t}]))})):r.push(e),i=r.reduce((function(t,e){return g_(e.listeners||{},(function(i,n){t[n]=t[n]||{},t[n][e._key||IM]=i})),delete e.listeners,t}),{}),{labels:r,listeners:i})}(g,i),v=e.meta.data||[],y=t.ctx;for(y.save(),n=0,s=v.length;n<s;++n)if((c=v[n])[DM]=[],m&&c&&t.getDataVisibility(n)&&!c.skip)for(o=0,r=f.labels.length;o<r;++o)l=(a=f.labels[o])._key,(h=new _M(a,y,c,n)).$groups={_set:d,_key:l||IM},h.$context={active:!1,chart:t,dataIndex:n,dataset:g,datasetIndex:d},h.update(h.$context),c[DM].push(h),p.push(h);y.restore(),x_(u._listeners,f.listeners,{merger:function(t,i,n){i[t]=i[t]||{},i[t][e.index]=n[t],u._listened=!0}})},afterUpdate:function(t){t[DM]._labels=TM.prepare(t[DM]._datasets)},afterDatasetsDraw:function(t){TM.draw(t,t[DM]._labels)},beforeEvent:function(t,e){if(t[DM]._listened){var i=e.event;switch(i.type){case"mousemove":case"mouseout":$M(t,i);break;case"click":!function(t,e){var i=t[DM],n=i._listeners.click,o=n&&TM.lookup(i._labels,e);o&&OM(t,n,o,e)}(t,i)}}},afterEvent:function(t){var e,i,n,o,s,r,a,l=t[DM],c=l._actives,h=l._actives=t.getActiveElements(),d=nM(c,h);for(e=0,i=d.length;e<i;++e)if((s=d[e])[1])for(n=0,o=(a=s[0].element[DM]||[]).length;n<o;++n)(r=a[n]).$context.active=1===s[1],r.update(r.$context);(l._dirty||d.length)&&(TM.update(l._labels),t.render()),delete l._dirty}};KS.register(LM);const zM={"qualitative-set1":["#5ea3db","#c186e3","#66c2a5","#fc8d62","#a6d854","#ffd92f","#e5c494","#b3b3b3"],"qualitative-set2":["#377eb8","#984ea3","#4daf4a","#ff7f00","#e41a1c","#a65628","#f781bf","#ffff33"],"qualitative-set3":["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d"],"qualitative-paired":["#1f78b4","#a6cee3","#6a3d9a","#cab2d6","#33a02c","#b2df8a","#e31a1c","#fb9a99","#ff7f00","#fdbf6f"],"qualitative-accent":["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"],"qualitative-pastel1":["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec"],"qualitative-pastel2":["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc"],"diverging-prgn":["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],"diverging-spectral":["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],"diverging-piyg":["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],"diverging-rdylgn":["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],"diverging-brbg":["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],"sequential-blues":["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"],"sequential-greens":["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"],"sequential-oranges":["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"],"sequential-purples":["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"],"sequential-reds":["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"],"sequential-ylgnbu":["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"]},RM="rgba(212, 212, 212, 0.5)";function NM(t){if(0===t)return"0s";const e=Math.floor(t/86400),i=t%86400,n=Math.floor(i/3600),o=i%3600,s=Math.floor(o/60),r=o%60,a=[];return e>0&&a.push(`${e}d`),n>0&&a.push(`${n}h`),s>0&&a.length<2&&a.push(`${s}m`),r>0&&a.length<2&&a.push(`${r}s`),a.slice(0,2).join(" ")}class jM extends Ae{getInflatedMax(){if(!this.showPercent||!this.data)return;const t=Array(this.data.labels.length).fill(0);for(const e of this.datasets)e.data.forEach(((e,i)=>t[i]+=e));const e=Math.max(...t);return e>0?1.15*e:void 0}static get styles(){return a`
|
|
9486
|
+
var nM=function(){if("undefined"!=typeof window){if(window.devicePixelRatio)return window.devicePixelRatio;var t=window.screen;if(t)return(t.deviceXDPI||1)/(t.logicalXDPI||1)}return 1}(),oM=function(t){var e,i=[];for(t=[].concat(t);t.length;)"string"==typeof(e=t.pop())?i.unshift.apply(i,e.split("\n")):Array.isArray(e)?t.push.apply(t,e):d_(t)||i.unshift(""+e);return i},sM=function(t,e,i){var n,o=[].concat(e),s=o.length,r=t.font,a=0;for(t.font=i.string,n=0;n<s;++n)a=Math.max(t.measureText(o[n]).width,a);return t.font=r,{height:s*i.lineHeight,width:a}},rM=function(t,e,i){return Math.max(t,Math.min(e,i))},aM=function(t,e){var i,n,o,s,r=t.slice(),a=[];for(i=0,o=e.length;i<o;++i)s=e[i],-1===(n=r.indexOf(s))?a.push([s,1]):r.splice(n,1);for(i=0,o=r.length;i<o;++i)a.push([r[i],-1]);return a},lM=function(t){return Math.round(t*nM)/nM};function cM(t,e){var i=e.x,n=e.y;if(null===i)return{x:0,y:-1};if(null===n)return{x:1,y:0};var o=t.x-i,s=t.y-n,r=Math.sqrt(o*o+s*s);return{x:r?o/r:0,y:r?s/r:-1}}var hM=0,dM=1,uM=2,pM=4,mM=8;function gM(t,e,i){var n=hM;return t<i.left?n|=dM:t>i.right&&(n|=uM),e<i.top?n|=mM:e>i.bottom&&(n|=pM),n}function fM(t,e){var i,n,o=e.anchor,s=t;return e.clamp&&(s=function(t,e){for(var i,n,o,s=t.x0,r=t.y0,a=t.x1,l=t.y1,c=gM(s,r,e),h=gM(a,l,e);c|h&&!(c&h);)(i=c||h)&mM?(n=s+(a-s)*(e.top-r)/(l-r),o=e.top):i&pM?(n=s+(a-s)*(e.bottom-r)/(l-r),o=e.bottom):i&uM?(o=r+(l-r)*(e.right-s)/(a-s),n=e.right):i&dM&&(o=r+(l-r)*(e.left-s)/(a-s),n=e.left),i===c?c=gM(s=n,r=o,e):h=gM(a=n,l=o,e);return{x0:s,x1:a,y0:r,y1:l}}(s,e.area)),"start"===o?(i=s.x0,n=s.y0):"end"===o?(i=s.x1,n=s.y1):(i=(s.x0+s.x1)/2,n=(s.y0+s.y1)/2),function(t,e,i,n,o){switch(o){case"center":i=n=0;break;case"bottom":i=0,n=1;break;case"right":i=1,n=0;break;case"left":i=-1,n=0;break;case"top":i=0,n=-1;break;case"start":i=-i,n=-n;break;case"end":break;default:o*=Math.PI/180,i=Math.cos(o),n=Math.sin(o)}return{x:t,y:e,vx:i,vy:n}}(i,n,t.vx,t.vy,e.align)}var vM=function(t,e){var i=(t.startAngle+t.endAngle)/2,n=Math.cos(i),o=Math.sin(i),s=t.innerRadius,r=t.outerRadius;return fM({x0:t.x+n*s,y0:t.y+o*s,x1:t.x+n*r,y1:t.y+o*r,vx:n,vy:o},e)},yM=function(t,e){var i=cM(t,e.origin),n=i.x*t.options.radius,o=i.y*t.options.radius;return fM({x0:t.x-n,y0:t.y-o,x1:t.x+n,y1:t.y+o,vx:i.x,vy:i.y},e)},bM=function(t,e){var i=cM(t,e.origin),n=t.x,o=t.y,s=0,r=0;return t.horizontal?(n=Math.min(t.x,t.base),s=Math.abs(t.base-t.x)):(o=Math.min(t.y,t.base),r=Math.abs(t.base-t.y)),fM({x0:n,y0:o+r,x1:n+s,y1:o,vx:i.x,vy:i.y},e)},xM=function(t,e){var i=cM(t,e.origin);return fM({x0:t.x,y0:t.y,x1:t.x+(t.width||0),y1:t.y+(t.height||0),vx:i.x,vy:i.y},e)},_M=lM;function wM(t,e){var i=e.chart.getDatasetMeta(e.datasetIndex).vScale;if(!i)return null;if(void 0!==i.xCenter&&void 0!==i.yCenter)return{x:i.xCenter,y:i.yCenter};var n=i.getBasePixel();return t.horizontal?{x:n,y:null}:{x:null,y:n}}function kM(t,e,i){var n=i.backgroundColor,o=i.borderColor,s=i.borderWidth;(n||o&&s)&&(t.beginPath(),function(t,e,i,n,o,s){var r=Math.PI/2;if(s){var a=Math.min(s,o/2,n/2),l=e+a,c=i+a,h=e+n-a,d=i+o-a;t.moveTo(e,c),l<h&&c<d?(t.arc(l,c,a,-Math.PI,-r),t.arc(h,c,a,-r,0),t.arc(h,d,a,0,r),t.arc(l,d,a,r,Math.PI)):l<h?(t.moveTo(l,i),t.arc(h,c,a,-r,r),t.arc(l,c,a,r,Math.PI+r)):c<d?(t.arc(l,c,a,-Math.PI,0),t.arc(l,d,a,0,Math.PI)):t.arc(l,c,a,-Math.PI,Math.PI),t.closePath(),t.moveTo(e,i)}else t.rect(e,i,n,o)}(t,_M(e.x)+s/2,_M(e.y)+s/2,_M(e.w)-s,_M(e.h)-s,i.borderRadius),t.closePath(),n&&(t.fillStyle=n,t.fill()),o&&s&&(t.strokeStyle=o,t.lineWidth=s,t.lineJoin="miter",t.stroke()))}function CM(t,e,i){var n=t.shadowBlur,o=i.stroked,s=_M(i.x),r=_M(i.y),a=_M(i.w);o&&t.strokeText(e,s,r,a),i.filled&&(n&&o&&(t.shadowBlur=0),t.fillText(e,s,r,a),n&&o&&(t.shadowBlur=n))}var SM=function(t,e,i,n){var o=this;o._config=t,o._index=n,o._model=null,o._rects=null,o._ctx=e,o._el=i};C_(SM.prototype,{_modelize:function(t,e,i,n){var o,s=this,r=s._index,a=nk(ok([i.font,{}],n,r)),l=ok([i.color,Ow.color],n,r);return{align:ok([i.align,"center"],n,r),anchor:ok([i.anchor,"center"],n,r),area:n.chart.chartArea,backgroundColor:ok([i.backgroundColor,null],n,r),borderColor:ok([i.borderColor,null],n,r),borderRadius:ok([i.borderRadius,0],n,r),borderWidth:ok([i.borderWidth,0],n,r),clamp:ok([i.clamp,!1],n,r),clip:ok([i.clip,!1],n,r),color:l,display:t,font:a,lines:e,offset:ok([i.offset,4],n,r),opacity:ok([i.opacity,1],n,r),origin:wM(s._el,n),padding:ik(ok([i.padding,4],n,r)),positioner:(o=s._el,o instanceof aE?vM:o instanceof yE?yM:o instanceof SE?bM:xM),rotation:ok([i.rotation,0],n,r)*(Math.PI/180),size:sM(s._ctx,e,a),textAlign:ok([i.textAlign,"start"],n,r),textShadowBlur:ok([i.textShadowBlur,0],n,r),textShadowColor:ok([i.textShadowColor,l],n,r),textStrokeColor:ok([i.textStrokeColor,l],n,r),textStrokeWidth:ok([i.textStrokeWidth,0],n,r)}},update:function(t){var e,i,n,o=this,s=null,r=null,a=o._index,l=o._config,c=ok([l.display,!0],t,a);c&&(e=t.dataset.data[a],(n=d_(i=f_(y_(l.formatter,[e,t]),e))?[]:oM(i)).length&&(r=function(t){var e=t.borderWidth||0,i=t.padding,n=t.size.height,o=t.size.width,s=-o/2,r=-n/2;return{frame:{x:s-i.left-e,y:r-i.top-e,w:o+i.width+2*e,h:n+i.height+2*e},text:{x:s,y:r,w:o,h:n}}}(s=o._modelize(c,n,l,t)))),o._model=s,o._rects=r},geometry:function(){return this._rects?this._rects.frame:{}},rotation:function(){return this._model?this._model.rotation:0},visible:function(){return this._model&&this._model.opacity},model:function(){return this._model},draw:function(t,e){var i,n=t.ctx,o=this._model,s=this._rects;this.visible()&&(n.save(),o.clip&&(i=o.area,n.beginPath(),n.rect(i.left,i.top,i.right-i.left,i.bottom-i.top),n.clip()),n.globalAlpha=rM(0,o.opacity,1),n.translate(_M(e.x),_M(e.y)),n.rotate(o.rotation),kM(n,s.frame,o),function(t,e,i,n){var o,s=n.textAlign,r=n.color,a=!!r,l=n.font,c=e.length,h=n.textStrokeColor,d=n.textStrokeWidth,u=h&&d;if(c&&(a||u))for(i=function(t,e,i){var n=i.lineHeight,o=t.w,s=t.x;return"center"===e?s+=o/2:"end"!==e&&"right"!==e||(s+=o),{h:n,w:o,x:s,y:t.y+n/2}}(i,s,l),t.font=l.string,t.textAlign=s,t.textBaseline="middle",t.shadowBlur=n.textShadowBlur,t.shadowColor=n.textShadowColor,a&&(t.fillStyle=r),u&&(t.lineJoin="round",t.lineWidth=d,t.strokeStyle=h),o=0,c=e.length;o<c;++o)CM(t,e[o],{stroked:u,filled:a,w:i.w,x:i.x,y:i.y+i.h*o})}(n,o.lines,s.text,o),n.restore())}});var EM=Number.MIN_SAFE_INTEGER||-9007199254740991,AM=Number.MAX_SAFE_INTEGER||9007199254740991;function MM(t,e,i){var n=Math.cos(i),o=Math.sin(i),s=e.x,r=e.y;return{x:s+n*(t.x-s)-o*(t.y-r),y:r+o*(t.x-s)+n*(t.y-r)}}function TM(t,e){var i,n,o,s,r,a=AM,l=EM,c=e.origin;for(i=0;i<t.length;++i)o=(n=t[i]).x-c.x,s=n.y-c.y,r=e.vx*o+e.vy*s,a=Math.min(a,r),l=Math.max(l,r);return{min:a,max:l}}function PM(t,e){var i=e.x-t.x,n=e.y-t.y,o=Math.sqrt(i*i+n*n);return{vx:(e.x-t.x)/o,vy:(e.y-t.y)/o,origin:t,ln:o}}var DM=function(){this._rotation=0,this._rect={x:0,y:0,w:0,h:0}};function IM(t,e,i){var n=e.positioner(t,e),o=n.vx,s=n.vy;if(!o&&!s)return{x:n.x,y:n.y};var r=i.w,a=i.h,l=e.rotation,c=Math.abs(r/2*Math.cos(l))+Math.abs(a/2*Math.sin(l)),h=Math.abs(r/2*Math.sin(l))+Math.abs(a/2*Math.cos(l)),d=1/Math.max(Math.abs(o),Math.abs(s));return c*=o*d,h*=s*d,c+=e.offset*o,h+=e.offset*s,{x:n.x+c,y:n.y+h}}C_(DM.prototype,{center:function(){var t=this._rect;return{x:t.x+t.w/2,y:t.y+t.h/2}},update:function(t,e,i){this._rotation=i,this._rect={x:e.x+t.x,y:e.y+t.y,w:e.w,h:e.h}},contains:function(t){var e=this,i=e._rect;return!((t=MM(t,e.center(),-e._rotation)).x<i.x-1||t.y<i.y-1||t.x>i.x+i.w+2||t.y>i.y+i.h+2)},intersects:function(t){var e,i,n,o=this._points(),s=t._points(),r=[PM(o[0],o[1]),PM(o[0],o[3])];for(this._rotation!==t._rotation&&r.push(PM(s[0],s[1]),PM(s[0],s[3])),e=0;e<r.length;++e)if(i=TM(o,r[e]),n=TM(s,r[e]),i.max<n.min||n.max<i.min)return!1;return!0},_points:function(){var t=this,e=t._rect,i=t._rotation,n=t.center();return[MM({x:e.x,y:e.y},n,i),MM({x:e.x+e.w,y:e.y},n,i),MM({x:e.x+e.w,y:e.y+e.h},n,i),MM({x:e.x,y:e.y+e.h},n,i)]}});var OM={prepare:function(t){var e,i,n,o,s,r=[];for(e=0,n=t.length;e<n;++e)for(i=0,o=t[e].length;i<o;++i)s=t[e][i],r.push(s),s.$layout={_box:new DM,_hidable:!1,_visible:!0,_set:e,_idx:s._index};return r.sort((function(t,e){var i=t.$layout,n=e.$layout;return i._idx===n._idx?n._set-i._set:n._idx-i._idx})),this.update(r),r},update:function(t){var e,i,n,o,s,r=!1;for(e=0,i=t.length;e<i;++e)o=(n=t[e]).model(),(s=n.$layout)._hidable=o&&"auto"===o.display,s._visible=n.visible(),r|=s._hidable;r&&function(t){var e,i,n,o,s,r,a;for(e=0,i=t.length;e<i;++e)(o=(n=t[e]).$layout)._visible&&(a=new Proxy(n._el,{get:(t,e)=>t.getProps([e],!0)[e]}),s=n.geometry(),r=IM(a,n.model(),s),o._box.update(r,s,n.rotation()));(function(t,e){var i,n,o,s;for(i=t.length-1;i>=0;--i)for(o=t[i].$layout,n=i-1;n>=0&&o._visible;--n)(s=t[n].$layout)._visible&&o._box.intersects(s._box)&&e(o,s)})(t,(function(t,e){var i=t._hidable,n=e._hidable;i&&n||n?e._visible=!1:i&&(t._visible=!1)}))}(t)},lookup:function(t,e){var i,n;for(i=t.length-1;i>=0;--i)if((n=t[i].$layout)&&n._visible&&n._box.contains(e))return t[i];return null},draw:function(t,e){var i,n,o,s,r,a;for(i=0,n=e.length;i<n;++i)(s=(o=e[i]).$layout)._visible&&(r=o.geometry(),a=IM(o._el,o.model(),r),s._box.update(a,r,o.rotation()),o.draw(t,a))}},$M={align:"center",anchor:"center",backgroundColor:null,borderColor:null,borderRadius:0,borderWidth:0,clamp:!1,clip:!1,color:void 0,display:!0,font:{family:void 0,lineHeight:1.2,size:void 0,style:void 0,weight:null},formatter:function(t){if(d_(t))return null;var e,i,n,o=t;if(p_(t))if(d_(t.label))if(d_(t.r))for(o="",n=0,i=(e=Object.keys(t)).length;n<i;++n)o+=(0!==n?", ":"")+e[n]+": "+t[e[n]];else o=t.r;else o=t.label;return""+o},labels:void 0,listeners:{},offset:4,opacity:1,padding:{top:4,right:4,bottom:4,left:4},rotation:0,textAlign:"start",textStrokeColor:void 0,textStrokeWidth:0,textShadowBlur:0,textShadowColor:void 0},LM="$datalabels",zM="$default";function RM(t,e,i,n){if(e){var o,s=i.$context,r=i.$groups;e[r._set]&&(o=e[r._set][r._key])&&!0===y_(o,[s,n])&&(t[LM]._dirty=!0,i.update(s))}}function NM(t,e){var i,n,o=t[LM],s=o._listeners;if(s.enter||s.leave){if("mousemove"===e.type)n=OM.lookup(o._labels,e);else if("mouseout"!==e.type)return;i=o._hovered,o._hovered=n,function(t,e,i,n,o){var s,r;(i||n)&&(i?n?i!==n&&(r=s=!0):r=!0:s=!0,r&&RM(t,e.leave,i,o),s&&RM(t,e.enter,n,o))}(t,s,i,n,e)}}var jM={id:"datalabels",defaults:$M,beforeInit:function(t){t[LM]={_actives:[]}},beforeUpdate:function(t){var e=t[LM];e._listened=!1,e._listeners={},e._datasets=[],e._labels=[]},afterDatasetUpdate:function(t,e,i){var n,o,s,r,a,l,c,h,d=e.index,u=t[LM],p=u._datasets[d]=[],m=t.isDatasetVisible(d),g=t.data.datasets[d],f=function(t,e){var i,n,o,s=t.datalabels,r=[];return!1===s?null:(!0===s&&(s={}),e=C_({},[e,s]),n=e.labels||{},o=Object.keys(n),delete e.labels,o.length?o.forEach((function(t){n[t]&&r.push(C_({},[e,n[t],{_key:t}]))})):r.push(e),i=r.reduce((function(t,e){return b_(e.listeners||{},(function(i,n){t[n]=t[n]||{},t[n][e._key||zM]=i})),delete e.listeners,t}),{}),{labels:r,listeners:i})}(g,i),v=e.meta.data||[],y=t.ctx;for(y.save(),n=0,s=v.length;n<s;++n)if((c=v[n])[LM]=[],m&&c&&t.getDataVisibility(n)&&!c.skip)for(o=0,r=f.labels.length;o<r;++o)l=(a=f.labels[o])._key,(h=new SM(a,y,c,n)).$groups={_set:d,_key:l||zM},h.$context={active:!1,chart:t,dataIndex:n,dataset:g,datasetIndex:d},h.update(h.$context),c[LM].push(h),p.push(h);y.restore(),C_(u._listeners,f.listeners,{merger:function(t,i,n){i[t]=i[t]||{},i[t][e.index]=n[t],u._listened=!0}})},afterUpdate:function(t){t[LM]._labels=OM.prepare(t[LM]._datasets)},afterDatasetsDraw:function(t){OM.draw(t,t[LM]._labels)},beforeEvent:function(t,e){if(t[LM]._listened){var i=e.event;switch(i.type){case"mousemove":case"mouseout":NM(t,i);break;case"click":!function(t,e){var i=t[LM],n=i._listeners.click,o=n&&OM.lookup(i._labels,e);o&&RM(t,n,o,e)}(t,i)}}},afterEvent:function(t){var e,i,n,o,s,r,a,l=t[LM],c=l._actives,h=l._actives=t.getActiveElements(),d=aM(c,h);for(e=0,i=d.length;e<i;++e)if((s=d[e])[1])for(n=0,o=(a=s[0].element[LM]||[]).length;n<o;++n)(r=a[n]).$context.active=1===s[1],r.update(r.$context);(l._dirty||d.length)&&(OM.update(l._labels),t.render()),delete l._dirty}};eE.register(jM);const BM={"qualitative-set1":["#5ea3db","#c186e3","#66c2a5","#fc8d62","#a6d854","#ffd92f","#e5c494","#b3b3b3"],"qualitative-set2":["#377eb8","#984ea3","#4daf4a","#ff7f00","#e41a1c","#a65628","#f781bf","#ffff33"],"qualitative-set3":["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d"],"qualitative-paired":["#1f78b4","#a6cee3","#6a3d9a","#cab2d6","#33a02c","#b2df8a","#e31a1c","#fb9a99","#ff7f00","#fdbf6f"],"qualitative-accent":["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"],"qualitative-pastel1":["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec"],"qualitative-pastel2":["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc"],"diverging-prgn":["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],"diverging-spectral":["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],"diverging-piyg":["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],"diverging-rdylgn":["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],"diverging-brbg":["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],"sequential-blues":["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"],"sequential-greens":["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"],"sequential-oranges":["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"],"sequential-purples":["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"],"sequential-reds":["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"],"sequential-ylgnbu":["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"]},FM="rgba(212, 212, 212, 0.5)";function qM(t){if(0===t)return"0s";const e=Math.floor(t/86400),i=t%86400,n=Math.floor(i/3600),o=i%3600,s=Math.floor(o/60),r=o%60,a=[];return e>0&&a.push(`${e}d`),n>0&&a.push(`${n}h`),s>0&&a.length<2&&a.push(`${s}m`),r>0&&a.length<2&&a.push(`${r}s`),a.slice(0,2).join(" ")}class VM extends Ae{getInflatedMax(){if(!this.showPercent||!this.data)return;const t=Array(this.data.labels.length).fill(0);for(const e of this.datasets)e.data.forEach(((e,i)=>t[i]+=e));const e=Math.max(...t);return e>0?1.15*e:void 0}static get styles(){return a`
|
|
9529
9487
|
.chart-title {
|
|
9530
9488
|
font-size: 1.2em;
|
|
9531
9489
|
font-weight: 600;
|
|
@@ -9566,7 +9524,7 @@ var JA=function(){if("undefined"!=typeof window){if(window.devicePixelRatio)retu
|
|
|
9566
9524
|
padding: 2em 1em 1.5em 1em;
|
|
9567
9525
|
max-height: 50px;
|
|
9568
9526
|
}
|
|
9569
|
-
`}constructor(){super(),this.chartType="bar",this.horizontal=!1,this.header="",this.other=!1,this.datasets=[],this.maxSplits=2,this.xType="category",this.xMaxTicks=10,this.yType="count",this.xFormat="auto",this.maxChartHeight=250,this.hideOther=!1,this.splits=[],this.dataname="Counts",this.single=!1,this.legend=!1,this.config=!1,this.showAll=!1,this.requireWindow=!1,this.colorIndex=0,this.showConfig=!1,this.opacity=1,this.seriesBorderRadius=2,this.seriesBorderWidth=1,this.showPercent=!1}firstUpdated(t){super.firstUpdated(t);const e=this.shadowRoot.querySelector("#canvas-wrapper");this.canvas=document.createElement("canvas"),this.canvas.setAttribute("height","300px"),e.appendChild(this.canvas),this.ctx=this.canvas.getContext("2d")}updated(t){if(super.updated(t),t.has("splitNames")&&(this.splits=this.splitNames.split(",").map((t=>t.trim()))),(t.has("data")||t.has("splits"))&&this.calculateSplits(),t.has("datasets")&&this.updateChart(),t.has("horizontal")&&this.updateChart(),(t.has("url")||t.has("start")||t.has("end"))&&this.url&&(!this.requireWindow||this.start&&this.end)){const t=cc();let e=this.url;const i=new URLSearchParams;if(this.start&&i.append("since",this.start),this.end&&i.append("until",this.end),i.toString()){const t=this.url.includes("?")?"&":"?";e=`${this.url}${t}${i.toString()}`}t.getUrl(e,{skipCache:!0}).then((t=>{this.data=t.json.data}))}if(t.has("chartType")&&"line"===this.chartType&&(this.seriesBorderWidth=Math.max(1,this.seriesBorderWidth)),t.has("showPercent")&&this.chart){const t=this.horizontal?this.chart.options.scales.x:this.chart.options.scales.y;t.ticks.display=!this.showPercent,t.grid.display=!this.showPercent,t.border.display=!this.showPercent,t.max=this.showPercent?this.getInflatedMax():void 0,this.chart.update()}}get colors(){const t=
|
|
9527
|
+
`}constructor(){super(),this.chartType="bar",this.horizontal=!1,this.header="",this.other=!1,this.datasets=[],this.maxSplits=2,this.xType="category",this.xMaxTicks=10,this.yType="count",this.xFormat="auto",this.maxChartHeight=250,this.hideOther=!1,this.splits=[],this.dataname="Counts",this.single=!1,this.legend=!1,this.config=!1,this.showAll=!1,this.requireWindow=!1,this.colorIndex=0,this.showConfig=!1,this.opacity=1,this.seriesBorderRadius=2,this.seriesBorderWidth=1,this.showPercent=!1}firstUpdated(t){super.firstUpdated(t);const e=this.shadowRoot.querySelector("#canvas-wrapper");this.canvas=document.createElement("canvas"),this.canvas.setAttribute("height","300px"),e.appendChild(this.canvas),this.ctx=this.canvas.getContext("2d")}updated(t){if(super.updated(t),t.has("splitNames")&&(this.splits=this.splitNames.split(",").map((t=>t.trim()))),(t.has("data")||t.has("splits"))&&this.calculateSplits(),t.has("datasets")&&this.updateChart(),t.has("horizontal")&&this.updateChart(),(t.has("url")||t.has("start")||t.has("end"))&&this.url&&(!this.requireWindow||this.start&&this.end)){const t=cc();let e=this.url;const i=new URLSearchParams;if(this.start&&i.append("since",this.start),this.end&&i.append("until",this.end),i.toString()){const t=this.url.includes("?")?"&":"?";e=`${this.url}${t}${i.toString()}`}t.getUrl(e,{skipCache:!0}).then((t=>{this.data=t.json.data}))}if(t.has("chartType")&&"line"===this.chartType&&(this.seriesBorderWidth=Math.max(1,this.seriesBorderWidth)),t.has("showPercent")&&this.chart){const t=this.horizontal?this.chart.options.scales.x:this.chart.options.scales.y;t.ticks.display=!this.showPercent,t.grid.display=!this.showPercent,t.border.display=!this.showPercent,t.max=this.showPercent?this.getInflatedMax():void 0,this.chart.update()}}get colors(){const t=BM[this.palette]||BM["qualitative-set1"],e=Math.max(0,Math.min(1,this.opacity)),i=t.map((t=>be(t,.25))),n=t.map((t=>{if(t.startsWith("rgba"))return t.replace(/rgba\(([^,]+),([^,]+),([^,]+),([^)]+)\)/,((t,i,n,o)=>`rgba(${i},${n},${o},${e})`));if(t.startsWith("rgb("))return t.replace(/rgb\(([^,]+),([^,]+),([^,]+)\)/,((t,i,n,o)=>`rgba(${i},${n},${o},${e})`));if(t.startsWith("#")){let i=t.replace("#","");3===i.length&&(i=i.split("").map((t=>t+t)).join(""));const n=parseInt(i,16);return`rgba(${n>>16&255},${n>>8&255},${255&n},${e})`}return t}));return[n,i]}handleResize(){if(this.chart){const t=this.shadowRoot.querySelector("#canvas-wrapper");t&&t.clientHeight>this.maxChartHeight&&(this.canvas.style.height=`${this.maxChartHeight}px`,this.chart.resize())}}calculateSplits(){if(this.data){const t=[],e=[],[i,n]=this.colors;for(const o of this.data.datasets)if(this.showAll||void 0!==this.splits.find((t=>t===o.label))){const e=(t.length+this.colorIndex)%i.length,s=i[e],r=n[e];t.push({...o,backgroundColor:s,borderColor:r,borderWidth:this.seriesBorderWidth,borderRadius:this.seriesBorderRadius})}else for(let t=0;t<o.data.length;t++)void 0===e[t]?e[t]=o.data[t]:e[t]+=o.data[t];if(0===t.length){const o=this.colorIndex%i.length;t.push({label:this.single?this.dataname:`All ${this.dataname}`,data:e,backgroundColor:i[o],borderColor:n[o],borderWidth:this.seriesBorderWidth,borderRadius:this.seriesBorderRadius})}else this.hideOther||this.showAll||t.push({label:"Other",data:e,backgroundColor:FM,borderColor:be(FM,.05),borderWidth:1,borderRadius:this.seriesBorderRadius});this.datasets=t}}updateChart(){var t;if((null===(t=this.datasets)||void 0===t?void 0:t.length)>0){const t=this.datasets.reduce(((t,e)=>t+e.data.reduce(((t,e)=>t+(null!=e?e:0)),0)),0)||void 0,e=e=>{const i=t?e/t*100:0;return 0===i?"":`${Math.round(i)}%`};if(this.chart){this.chart.data.labels=this.data.labels,this.chart.data.datasets=this.datasets,this.showPercent&&(this.chart.options.scales.y.max=this.getInflatedMax());const t=this.chart.options.plugins.datalabels||{};t.display=this.showPercent,this.showPercent?t.formatter=e:delete t.formatter,this.chart.options.plugins.datalabels=t,this.horizontal?(this.chart.options.scales.x=this.getValueAxisConfig(),this.chart.options.scales.y=this.getCategoryAxisConfig()):(this.chart.options.scales.x=this.getCategoryAxisConfig(),this.chart.options.scales.y=this.getValueAxisConfig()),this.chart.update()}else{const t={type:this.chartType,data:{labels:this.data.labels,datasets:this.datasets},options:{...this.horizontal&&{indexAxis:"y"},maxBarThickness:80,plugins:{legend:{display:this.legend},tooltip:{callbacks:{label:t=>{const e=t.dataset.label||"",i=this.horizontal?t.parsed.x:t.parsed.y;return"duration"===this.yType?`${e}: ${qM(i)}`:`${e}: ${i}`}}},datalabels:{display:this.showPercent,anchor:"end",align:"end",offset:-3,clamp:!0,...this.showPercent&&{formatter:e},color:"#666",font:{weight:"600"}}},responsive:!0,aspectRatio:2,onResize:this.handleResize.bind(this),maintainAspectRatio:!1,animation:!1,animations:{x:{duration:0},y:{duration:0}},scales:this.horizontal?{x:this.getValueAxisConfig(),y:this.getCategoryAxisConfig()}:{y:this.getValueAxisConfig(),x:this.getCategoryAxisConfig()}}};this.chart=new eE(this.ctx,t)}}}handleSplitsChanged(t){const e=t.target;this.splits=e.values.map((t=>t.value))}handleToggleConfig(){this.showConfig=!this.showConfig,this.showConfig||(this.splits=[])}getValueAxisConfig(){return{min:0,...this.showPercent&&{max:this.getInflatedMax()},stacked:!0,grid:{color:"rgba(0,0,0,0.04)",display:!this.showPercent,drawBorder:!this.showPercent},border:{display:!this.showPercent},ticks:{display:!this.showPercent,..."duration"===this.yType&&!this.showPercent&&{callback:t=>qM(t)}}}}getCategoryAxisConfig(){let t=this.xFormat;if("time"===this.xType&&"auto"===this.xFormat){const e=this.data.labels[0],i=this.data.labels[this.data.labels.length-1],n=Date.parse(e),o=Date.parse(i);t="MMM dd",Math.ceil((o-n)/864e5)>365&&(t="MMM yyyy")}return{max:"time"===this.xType?this.end:this.xMaxTicks,min:"time"===this.xType?this.start:0,type:this.xType,grid:{display:!1},stacked:!0,ticks:{maxTicksLimit:this.xMaxTicks},..."time"===this.xType&&{time:{unit:"day",tooltipFormat:"DDD",displayFormats:{day:t}}}}}render(){var t,e,i;return U`<div>
|
|
9570
9528
|
${this.header?U`<div class="chart-title">${this.header}</div>`:null}
|
|
9571
9529
|
<div id="canvas-wrapper"></div>
|
|
9572
9530
|
${this.config&&this.data?U`
|
|
@@ -9598,7 +9556,7 @@ var JA=function(){if("undefined"!=typeof window){if(window.devicePixelRatio)retu
|
|
|
9598
9556
|
</temba-select>
|
|
9599
9557
|
<div></div>
|
|
9600
9558
|
</div>
|
|
9601
|
-
</div>`}}t([mt({type:String})],
|
|
9559
|
+
</div>`}}t([mt({type:String})],VM.prototype,"chartType",void 0),t([mt({type:Boolean})],VM.prototype,"horizontal",void 0),t([mt({type:String})],VM.prototype,"url",void 0),t([mt({type:String})],VM.prototype,"start",void 0),t([mt({type:String})],VM.prototype,"end",void 0),t([mt({type:String})],VM.prototype,"header",void 0),t([mt({type:Boolean})],VM.prototype,"other",void 0),t([mt({type:Object})],VM.prototype,"data",void 0),t([gt()],VM.prototype,"datasets",void 0),t([mt({type:Number})],VM.prototype,"maxSplits",void 0),t([mt({type:String,attribute:"splits"})],VM.prototype,"splitNames",void 0),t([mt({type:String})],VM.prototype,"xType",void 0),t([mt({type:Number})],VM.prototype,"xMaxTicks",void 0),t([mt({type:String})],VM.prototype,"yType",void 0),t([mt({type:String})],VM.prototype,"xFormat",void 0),t([mt({type:Number})],VM.prototype,"maxChartHeight",void 0),t([mt({type:Boolean})],VM.prototype,"hideOther",void 0),t([gt()],VM.prototype,"splits",void 0),t([mt({type:String})],VM.prototype,"dataname",void 0),t([mt({type:Boolean})],VM.prototype,"single",void 0),t([mt({type:Boolean})],VM.prototype,"legend",void 0),t([mt({type:Boolean})],VM.prototype,"config",void 0),t([mt({type:Boolean})],VM.prototype,"showAll",void 0),t([mt({type:Boolean})],VM.prototype,"requireWindow",void 0),t([mt({type:Number})],VM.prototype,"colorIndex",void 0),t([gt()],VM.prototype,"showConfig",void 0),t([mt({type:String})],VM.prototype,"palette",void 0),t([mt({type:Number})],VM.prototype,"opacity",void 0),t([mt({type:Number})],VM.prototype,"seriesBorderRadius",void 0),t([mt({type:Number})],VM.prototype,"seriesBorderWidth",void 0),t([mt({type:Boolean,attribute:"percent"})],VM.prototype,"showPercent",void 0);class HM extends Ae{constructor(){super(...arguments),this.startDate="",this.endDate="",this.editingStart=!1,this.editingEnd=!1,this.selectedRange="",this.minDate="2012-01-01",this.maxDate=za.now().toISODate()}handleStartClick(){this.editingStart=!0}handleEndClick(){this.editingEnd=!0}setRange(t){const e=za.now().toISODate();let i="";"W"===t?i=za.now().minus({days:6}).toISODate():"M"===t?i=za.now().minus({months:1}).plus({days:1}).toISODate():"Y"===t?i=za.now().minus({years:1}).plus({days:1}).toISODate():"ALL"===t&&(i=this.minDate||"2012-01-01"),this.startDate=i,this.endDate=e,this.selectedRange=t,this.editingStart=!1,this.editingEnd=!1,this.fireCustomEvent(xn.DateRangeChanged,{start:this.startDate,end:this.endDate,range:this.selectedRange})}setValidRange(t,e){let i=e;i<this.minDate&&(i=this.minDate),i>this.maxDate&&(i=this.maxDate);const n=za.fromISO("start"===t?i:this.startDate),o=za.fromISO("end"===t?i:this.endDate);n.isValid&&o.isValid&&(n>o?"start"===t?(this.startDate=i,this.endDate=n.toISODate()):(this.endDate=i,this.startDate=o.toISODate()):"start"===t?this.startDate=i:this.endDate=i,this.fireCustomEvent(xn.DateRangeChanged,{start:this.startDate,end:this.endDate,range:this.selectedRange}))}canNavigatePrevious(){if("ALL"===this.selectedRange)return!1;const t=za.fromISO(this.startDate);let e;if("W"===this.selectedRange)e=t.minus({weeks:1});else if("M"===this.selectedRange)e=t.minus({months:1});else if("Y"===this.selectedRange)e=t.minus({years:1});else{if(""!==this.selectedRange)return!1;{const i=this.getCustomRangeInterval();if("days"===i.type)e=t.minus({days:i.amount});else if("months"===i.type)e=t.minus({months:i.amount});else{if("years"!==i.type)return!1;e=t.minus({years:i.amount})}}}return e.toISODate()>=this.minDate}canNavigateNext(){if("ALL"===this.selectedRange)return!1;const t=za.fromISO(this.endDate);let e;if("W"===this.selectedRange)e=t.plus({weeks:1});else if("M"===this.selectedRange)e=t.plus({months:1});else if("Y"===this.selectedRange)e=t.plus({years:1});else{if(""!==this.selectedRange)return!1;{const i=this.getCustomRangeInterval();if("days"===i.type)e=t.plus({days:i.amount});else if("months"===i.type)e=t.plus({months:i.amount});else{if("years"!==i.type)return!1;e=t.plus({years:i.amount})}}}return e.toISODate()<=this.maxDate}getCustomRangeInterval(){const t=za.fromISO(this.startDate),e=za.fromISO(this.endDate);if(!t.isValid||!e.isValid)return{type:"days",amount:1};const i=e.day===e.daysInMonth;if(1===t.day&&i){if(t.month===e.month&&t.year===e.year)return{type:"months",amount:1};const i=t.startOf("month"),n=e.endOf("month").diff(i,"months").months+1;if(n>0&&Number.isInteger(n))return{type:"months",amount:Math.round(n)}}if(1===t.month&&1===t.day&&12===e.month&&31===e.day){if(t.year===e.year)return{type:"years",amount:1};const i=e.year-t.year+1;if(i>0)return{type:"years",amount:i}}const n=e.diff(t,"days").days+1;return{type:"days",amount:Math.max(1,Math.round(n))}}navigatePrevious(){if(!this.canNavigatePrevious())return;const t=za.fromISO(this.startDate),e=za.fromISO(this.endDate);let i,n;if("W"===this.selectedRange)i=t.minus({weeks:1}),n=e.minus({weeks:1});else if("M"===this.selectedRange){const o=this.getCustomRangeInterval();"months"===o.type?(i=t.minus({months:1}).startOf("month"),n=i.plus({months:o.amount}).minus({days:1}).endOf("day")):(i=t.minus({months:1}),n=e.minus({months:1}))}else if("Y"===this.selectedRange)i=t.minus({years:1}),n=e.minus({years:1});else{if(""!==this.selectedRange)return;{const o=this.getCustomRangeInterval();if("days"===o.type)i=t.minus({days:o.amount}),n=e.minus({days:o.amount});else if("months"===o.type)i=t.minus({months:o.amount}).startOf("month"),n=i.plus({months:o.amount}).minus({days:1}).endOf("day");else{if("years"!==o.type)return;i=t.minus({years:o.amount}),n=e.minus({years:o.amount})}}}const o=za.fromISO(this.minDate),s=za.fromISO(this.maxDate),r=i<o?this.minDate:i.toISODate(),a=n>s?this.maxDate:n.toISODate();this.startDate=r,this.endDate=a,this.fireCustomEvent(xn.DateRangeChanged,{start:this.startDate,end:this.endDate,range:this.selectedRange})}navigateNext(){if(!this.canNavigateNext())return;const t=za.fromISO(this.startDate),e=za.fromISO(this.endDate);let i,n;if("W"===this.selectedRange)i=t.plus({weeks:1}),n=e.plus({weeks:1});else if("M"===this.selectedRange){const o=this.getCustomRangeInterval();"months"===o.type?(i=t.plus({months:1}).startOf("month"),n=i.plus({months:o.amount}).minus({days:1}).endOf("day")):(i=t.plus({months:1}),n=e.plus({months:1}))}else if("Y"===this.selectedRange)i=t.plus({years:1}),n=e.plus({years:1});else{if(""!==this.selectedRange)return;{const o=this.getCustomRangeInterval();if("days"===o.type)i=t.plus({days:o.amount}),n=e.plus({days:o.amount});else if("months"===o.type)i=t.plus({months:o.amount}).startOf("month"),n=i.plus({months:o.amount}).minus({days:1}).endOf("day");else{if("years"!==o.type)return;i=t.plus({years:o.amount}),n=e.plus({years:o.amount})}}}const o=za.fromISO(this.minDate),s=za.fromISO(this.maxDate),r=i<o?this.minDate:i.toISODate(),a=n>s?this.maxDate:n.toISODate();this.startDate=r,this.endDate=a,this.fireCustomEvent(xn.DateRangeChanged,{start:this.startDate,end:this.endDate,range:this.selectedRange})}getNavigationLabel(t){const e=this.getCustomRangeInterval(),i=e.amount;return`${"previous"===t?"Previous":"Next"} ${i} ${"days"===e.type?1===i?"day":"days":"months"===e.type?1===i?"month":"months":1===i?"year":"years"}`}updated(t){super.updated(t),!t.has("startDate")||!t.has("endDate")||this.startDate&&this.endDate||this.setRange("M"),t.has("editingStart")&&this.editingStart&&setTimeout((()=>{var t;const e=null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector("temba-datepicker.start-picker");e&&e.handleClicked()}),0),t.has("editingEnd")&&this.editingEnd&&setTimeout((()=>{var t;const e=null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector("temba-datepicker.end-picker");e&&e.handleClicked()}),0)}formatDateForDisplay(t){if(!t)return"";const e=za.fromISO(t);return e.isValid?e.toLocaleString():t}render(){return U`
|
|
9602
9560
|
<div class="range-container">
|
|
9603
9561
|
${this.editingStart?U`<temba-datepicker
|
|
9604
9562
|
class="start-picker"
|
|
@@ -9666,7 +9624,7 @@ var JA=function(){if("undefined"!=typeof window){if(window.devicePixelRatio)retu
|
|
|
9666
9624
|
</button>
|
|
9667
9625
|
</div>
|
|
9668
9626
|
</div>
|
|
9669
|
-
`}}
|
|
9627
|
+
`}}HM.styles=a`
|
|
9670
9628
|
.range-container {
|
|
9671
9629
|
display: flex;
|
|
9672
9630
|
gap: 0.5em;
|
|
@@ -9758,7 +9716,7 @@ var JA=function(){if("undefined"!=typeof window){if(window.devicePixelRatio)retu
|
|
|
9758
9716
|
background: #e0eaff;
|
|
9759
9717
|
border-color: #3399ff;
|
|
9760
9718
|
}
|
|
9761
|
-
`,t([mt({type:String,attribute:"start"})],
|
|
9719
|
+
`,t([mt({type:String,attribute:"start"})],HM.prototype,"startDate",void 0),t([mt({type:String,attribute:"end"})],HM.prototype,"endDate",void 0),t([mt({type:Boolean})],HM.prototype,"editingStart",void 0),t([mt({type:Boolean})],HM.prototype,"editingEnd",void 0),t([mt({type:String})],HM.prototype,"selectedRange",void 0),t([mt({type:String,attribute:"min"})],HM.prototype,"minDate",void 0),t([mt({type:String,attribute:"max"})],HM.prototype,"maxDate",void 0),customElements.define("temba-range-picker",HM);class UM{static renderField(t,e,i,n={}){switch(e.type){case"text":return UM.renderTextInput(t,e,i,n);case"textarea":return UM.renderTextarea(t,e,i,n);case"select":return UM.renderSelect(t,e,i,n);case"checkbox":return UM.renderCheckbox(t,e,i,n);case"key-value":return UM.renderKeyValue(t,e,i,n);case"array":return UM.renderArray(t,e,i,n);case"message-editor":return UM.renderMessageEditor(t,e,i,n);default:return U`<div>Unsupported field type: ${e.type}</div>`}}static renderTextInput(t,e,i,n){const{errors:o=[],onChange:s,showLabel:r=!0,extraClasses:a,style:l}=n;return e.evaluated?U`<temba-completion
|
|
9762
9720
|
name="${t}"
|
|
9763
9721
|
label="${r?e.label:""}"
|
|
9764
9722
|
?required="${e.required}"
|
|
@@ -9907,7 +9865,7 @@ var JA=function(){if("undefined"!=typeof window){if(window.devicePixelRatio)retu
|
|
|
9907
9865
|
class="${a}"
|
|
9908
9866
|
style="${l}"
|
|
9909
9867
|
@change="${s||(()=>{})}"
|
|
9910
|
-
></temba-message-editor>`}}class
|
|
9868
|
+
></temba-message-editor>`}}class WM extends Ae{constructor(){super(...arguments),this.isOpen=!1,this.formData={},this.originalFormData={},this.errors={},this.groupCollapseState={},this.groupHoverState={}}static get styles(){return a`
|
|
9911
9869
|
.node-editor-form {
|
|
9912
9870
|
padding: 20px;
|
|
9913
9871
|
display: flex;
|
|
@@ -10165,7 +10123,7 @@ var JA=function(){if("undefined"!=typeof window){if(window.devicePixelRatio)retu
|
|
|
10165
10123
|
.gutter-fields temba-select {
|
|
10166
10124
|
min-width: 120px;
|
|
10167
10125
|
}
|
|
10168
|
-
`}connectedCallback(){super.connectedCallback(),this.initializeFormData()}updated(t){super.updated(t),(t.has("node")||t.has("action")||t.has("nodeUI"))&&(!this.action||this.node&&this.nodeUI?this.node&&this.nodeUI?this.openDialog():this.action||this.node&&this.nodeUI||(this.isOpen=!1):this.openDialog())}openDialog(){this.initializeFormData(),this.errors={},this.isOpen=!0}initializeFormData(){const t=this.getNodeConfig();if(t&&"execute_actions"!==t.type||!this.action){if(this.node){const t=this.getNodeConfig();(null==t?void 0:t.toFormData)?this.formData=t.toFormData(this.node):this.formData={...this.node},this.processFormDataForEditing(),this.originalFormData=JSON.parse(JSON.stringify(this.formData))}}else{const t=px[this.action.type];(null==t?void 0:t.toFormData)?this.formData=t.toFormData(this.action):this.formData={...this.action},this.processFormDataForEditing(),this.originalFormData=JSON.parse(JSON.stringify(this.formData))}Object.keys(this.formData).forEach((t=>{const e=this.formData[t];Array.isArray(e)?this.formData[t]=[...e]:e&&"object"==typeof e&&(this.formData[t]={...e})}))}processFormDataForEditing(){const t={...this.formData};Object.keys(t).forEach((e=>{const i=t[e];if(i&&"object"==typeof i&&!Array.isArray(i)){this.isKeyValueField(e)&&(t[e]=Object.entries(i).map((([t,e])=>({key:t,value:e}))))}}));const e=this.getConfig();(null==e?void 0:e.form)&&this.processSelectFields(t,e.form),this.formData=t}processSelectFields(t,e){Object.entries(e).forEach((([e,i])=>{const n=t[e];"select"===i.type&&n&&(t[e]=this.convertToSelectArray(n)),"array"===i.type&&Array.isArray(n)&&i.itemConfig&&n.forEach((t=>{this.processSelectFields(t,i.itemConfig)}))}))}convertToSelectArray(t){return Array.isArray(t)?t.map((t=>"string"==typeof t?{name:t,value:t}:t)):"string"==typeof t?[{name:t,value:t}]:[t]}isKeyValueField(t){var e;const i=this.getConfig(),n=null==i?void 0:i.form;return"key-value"===(null===(e=null==n?void 0:n[t])||void 0===e?void 0:e.type)}getConfig(){if(this.node&&this.nodeUI){const t=this.getNodeConfig();if("execute_actions"===this.nodeUI.type&&this.action)return px[this.action.type]||null;if(t)return t}return this.action&&px[this.action.type]||null}getNodeConfig(){return this.nodeUI&&this.nodeUI.type?mx[this.nodeUI.type]:null}getHeaderColor(){const t=this.getConfig();return(null==t?void 0:t.color)||"#666666"}handleDialogButtonClick(t){const e=t.detail.button;"Save"===e.name?this.handleSave():"Cancel"===e.name&&this.handleCancel()}handleSave(){const t=this.validateForm();if(!t.valid)return this.errors=t.errors,void this.expandGroupsWithErrors(t.errors);const e=this.processFormDataForSave();if(this.node&&this.node.router){const t=this.formDataToNode(e);this.fireCustomEvent(xn.NodeSaved,{node:t})}else if(this.action){const t=this.formDataToAction(e);this.fireCustomEvent(xn.ActionSaved,{action:t})}else if(this.node){const t=this.formDataToNode(e);this.fireCustomEvent(xn.NodeSaved,{node:t})}}processFormDataForSave(){const t={...this.formData};return Object.keys(t).forEach((e=>{const i=t[e];if(Array.isArray(i)&&i.length>0&&"object"==typeof i[0]&&"key"in i[0]&&"value"in i[0]){const n={};i.forEach((({key:t,value:e})=>{""===t.trim()&&""===e.trim()||(n[t]=e)})),t[e]=n}else if(Array.isArray(i)&&0===i.length){this.isKeyValueField(e)&&(t[e]={})}})),t}handleCancel(){this.fireCustomEvent(xn.NodeEditCancelled,{})}validateForm(){const t={},e=this.getConfig();if(e&&(e.form&&Object.entries(e.form).forEach((([e,i])=>{const n=this.formData[e];if("select"===i.type&&i.allowCreate){let i=this.formData[e];i=Array.isArray(i)?i.find((t=>t.arbitrary)):null,i&&i.arbitrary&&(t[e]='There was an error creating "'+i.name+'"')}i.required&&(!n||Array.isArray(n)&&0===n.length)&&(t[e]=`${i.label||e} is required.`),"string"==typeof n&&i.minLength&&n.length<i.minLength&&(t[e]=`${i.label||e} must be at least ${i.minLength} characters`),"string"==typeof n&&i.maxLength&&n.length>i.maxLength&&(t[e]=`${i.label||e} must be no more than ${i.maxLength} characters`)})),this.validateCategoryNames(t),e.validate)){let i;e.sanitize&&e.sanitize(this.formData),i=this.action?e.validate({...this.action,...this.formData}):e.validate(this.formData),Object.assign(t,i.errors)}return this.validateKeyValueUniqueness(t),{valid:0===Object.keys(t).length,errors:t}}validateKeyValueUniqueness(t){Object.entries(this.formData).forEach((([e,i])=>{if(Array.isArray(i)&&i.length>0&&"object"==typeof i[0]&&"key"in i[0]&&"value"in i[0]){let n=!1;i.forEach((({key:t,value:e})=>{""===t.trim()&&""!==e.trim()&&(n=!0)}));const o=i.filter((({key:t})=>""!==t.trim())).map((({key:t})=>t.trim())),s=new Set(o);o.length!==s.size&&(n=!0),n&&(t[e]="Please resolve validation errors to continue")}}))}validateCategoryNames(t){const e=["other","failure","success","all responses","no response"];Object.entries(this.formData).forEach((([i,n])=>{if(Array.isArray(n)&&"categories"===i){const o=n.filter((t=>(null==t?void 0:t.name)&&""!==t.name.trim())).filter((t=>{const i=t.name.trim().toLowerCase();return e.includes(i)})).map((t=>t.name.trim()));o.length>0&&(t[i]=`Reserved category names cannot be used: ${o.join(", ")}`)}}))}formDataToNode(t=this.formData){var e;if(!this.node)throw new Error("No node to update");let i={...this.node};if(this.node.actions&&this.node.actions.length>0&&(i.actions=this.node.actions.map((e=>{if(this.action&&e.uuid===this.action.uuid){const i=px[e.type];return(null==i?void 0:i.fromFormData)?i.fromFormData(t):{...e,...t}}return e}))),this.node.router){const n=this.getNodeConfig();if(null==n?void 0:n.fromFormData)i=n.fromFormData(t,i);else if(i.router={...this.node.router},void 0!==t.result_name&&(i.router.result_name=t.result_name),null===(e=null==n?void 0:n.router)||void 0===e?void 0:e.rules){const t=i.router.categories||[],e=i.exits||[],o=[],s=[],r=new Map;if(n.router.rules.forEach((t=>{r.has(t.categoryName)||r.set(t.categoryName,[]),r.get(t.categoryName).push(t)})),r.forEach(((i,n)=>{const r=t.find((t=>t.name===n));if(r){o.push(r);const t=e.find((t=>t.uuid===r.exit_uuid));t&&s.push(t)}else{const t=Yt(),e=Yt();o.push({uuid:t,name:n,exit_uuid:e}),s.push({uuid:e,destination_uuid:null})}})),n.router.defaultCategory){if(!o.find((t=>t.name===n.router.defaultCategory))){const i=t.find((t=>t.name===n.router.defaultCategory));if(i){o.push(i);const t=e.find((t=>t.uuid===i.exit_uuid));t&&s.push(t)}else{const t=Yt(),e=Yt();o.push({uuid:t,name:n.router.defaultCategory,exit_uuid:e}),s.push({uuid:e,destination_uuid:null})}}}i.router.categories=o,i.exits=s}}else Object.keys(t).forEach((e=>{"uuid"!==e&&"actions"!==e&&"exits"!==e&&"router"!==e&&(i[e]=t[e])}));return i}formDataToAction(t=this.formData){if(!this.action)throw new Error("No action to update");const e=px[this.action.type];return(null==e?void 0:e.fromFormData)?e.fromFormData(t):{...this.action,...t}}handleFormFieldChange(t,e){const i=e.target;let n;if(n="TEMBA-CHECKBOX"===i.tagName?i.checked:void 0!==i.values?i.values:i.value,this.formData={...this.formData,[t]:n},this.errors[t]){const e={...this.errors};delete e[t],this.errors=e}this.updateComputedFields(t),this.updateGroupCollapseStates(),this.requestUpdate()}updateGroupCollapseStates(){const t=this.getConfig();(null==t?void 0:t.layout)&&this.updateGroupCollapseStatesRecursive(t.layout)}updateGroupCollapseStatesRecursive(t){t.forEach((t=>{if("object"==typeof t&&"group"===t.type){const{label:e,collapsed:i,collapsible:n}=t;if(n&&"function"==typeof i){const t=i(this.formData);this.groupCollapseState[e]!==t&&(this.groupCollapseState={...this.groupCollapseState,[e]:t})}this.updateGroupCollapseStatesRecursive(t.items)}else"object"==typeof t&&"row"===t.type&&this.updateGroupCollapseStatesRecursive(t.items)}))}updateComputedFields(t){const e=this.getConfig();(null==e?void 0:e.form)&&Object.entries(e.form).forEach((([e,i])=>{var n;if((null===(n=i.dependsOn)||void 0===n?void 0:n.includes(t))&&i.computeValue){const t=this.formData[e],n=i.computeValue(this.formData,t,this.originalFormData);this.formData={...this.formData,[e]:n}}}))}renderNewField(t,e,i){var n;if(null===(n=e.conditions)||void 0===n?void 0:n.visible)try{if(!e.conditions.visible(this.formData))return U``}catch(e){console.error(`Error checking visibility for ${t}:`,e)}const o=this.errors[t]?[this.errors[t]]:[],s=e.maxWidth?`max-width: ${e.maxWidth};`:"",r=this.renderFieldContent(t,e,i,o);return s?U`<div style="${s}">${r}</div>`:r}renderFieldContent(t,e,i,n){return FM.renderField(t,e,i,{errors:n,onChange:i=>{if(t&&"key-value"===e.type){const e=i;e.detail&&this.handleNewFieldChange(t,e.detail.value)}else t&&"array"===e.type?this.handleNewFieldChange(t,i.target.value):t&&"message-editor"===e.type?this.handleMessageEditorChange(t,i):this.handleFormFieldChange(t,i)},showLabel:!0,formData:this.formData,additionalData:{attachments:this.formData.attachments||[]}})}handleGroupToggle(t){this.groupCollapseState={...this.groupCollapseState,[t]:!this.groupCollapseState[t]}}handleGroupMouseEnter(t){this.groupHoverState={...this.groupHoverState,[t]:!0}}handleGroupMouseLeave(t){this.groupHoverState={...this.groupHoverState,[t]:!1}}expandGroupsWithErrors(t){const e=this.getConfig();if(!(null==e?void 0:e.layout))return;const i=new Set(Object.keys(t));this.expandGroupsWithErrorsRecursive(e.layout,i)}expandGroupsWithErrorsRecursive(t,e){t.forEach((t=>{if("object"==typeof t&&"group"===t.type){this.collectFieldsFromItems(t.items).some((t=>e.has(t)))&&(this.groupCollapseState={...this.groupCollapseState,[t.label]:!1}),this.expandGroupsWithErrorsRecursive(t.items,e)}else"object"==typeof t&&"row"===t.type&&this.expandGroupsWithErrorsRecursive(t.items,e)}))}renderLayoutItem(t,e,i){if("string"==typeof t)return this.renderLayoutItem({type:"field",field:t},e,i);switch(t.type){case"field":return e.form[t.field]&&!i.has(t.field)?(i.add(t.field),this.renderNewField(t.field,e.form[t.field],this.formData[t.field])):U``;case"row":return this.renderRow(t,e,i);case"group":return this.renderGroup(t,e,i);default:return U``}}renderRow(t,e,i){const{items:n,gap:o="1rem"}=t,s=this.collectFieldsFromItems(n).filter((t=>{var i;return null===(i=e.form)||void 0===i?void 0:i[t]}));if(0===s.length)return U``;const r=s.map((t=>e.form[t].maxWidth||"1fr"));return U`
|
|
10126
|
+
`}connectedCallback(){super.connectedCallback(),this.initializeFormData()}updated(t){super.updated(t),(t.has("node")||t.has("action")||t.has("nodeUI"))&&(!this.action||this.node&&this.nodeUI?this.node&&this.nodeUI?this.openDialog():this.action||this.node&&this.nodeUI||(this.isOpen=!1):this.openDialog())}openDialog(){this.initializeFormData(),this.errors={},this.isOpen=!0}initializeFormData(){const t=this.getNodeConfig();if(t&&"execute_actions"!==t.type||!this.action){if(this.node){const t=this.getNodeConfig();(null==t?void 0:t.toFormData)?this.formData=t.toFormData(this.node):this.formData={...this.node},this.processFormDataForEditing(),this.originalFormData=JSON.parse(JSON.stringify(this.formData))}}else{const t=vx[this.action.type];(null==t?void 0:t.toFormData)?this.formData=t.toFormData(this.action):this.formData={...this.action},this.processFormDataForEditing(),this.originalFormData=JSON.parse(JSON.stringify(this.formData))}Object.keys(this.formData).forEach((t=>{const e=this.formData[t];Array.isArray(e)?this.formData[t]=[...e]:e&&"object"==typeof e&&(this.formData[t]={...e})}))}processFormDataForEditing(){const t={...this.formData};Object.keys(t).forEach((e=>{const i=t[e];if(i&&"object"==typeof i&&!Array.isArray(i)){this.isKeyValueField(e)&&(t[e]=Object.entries(i).map((([t,e])=>({key:t,value:e}))))}}));const e=this.getConfig();(null==e?void 0:e.form)&&this.processSelectFields(t,e.form),this.formData=t}processSelectFields(t,e){Object.entries(e).forEach((([e,i])=>{const n=t[e];"select"===i.type&&n&&(t[e]=this.convertToSelectArray(n)),"array"===i.type&&Array.isArray(n)&&i.itemConfig&&n.forEach((t=>{this.processSelectFields(t,i.itemConfig)}))}))}convertToSelectArray(t){return Array.isArray(t)?t.map((t=>"string"==typeof t?{name:t,value:t}:t)):"string"==typeof t?[{name:t,value:t}]:[t]}isKeyValueField(t){var e;const i=this.getConfig(),n=null==i?void 0:i.form;return"key-value"===(null===(e=null==n?void 0:n[t])||void 0===e?void 0:e.type)}getConfig(){if(this.node&&this.nodeUI){const t=this.getNodeConfig();if("execute_actions"===this.nodeUI.type&&this.action)return vx[this.action.type]||null;if(t)return t}return this.action&&vx[this.action.type]||null}getNodeConfig(){return this.nodeUI&&this.nodeUI.type?yx[this.nodeUI.type]:null}getHeaderColor(){const t=this.getConfig();return(null==t?void 0:t.color)||"#666666"}handleDialogButtonClick(t){const e=t.detail.button;"Save"===e.name?this.handleSave():"Cancel"===e.name&&this.handleCancel()}handleSave(){const t=this.validateForm();if(!t.valid)return this.errors=t.errors,void this.expandGroupsWithErrors(t.errors);const e=this.processFormDataForSave();if(this.node&&this.node.router){const t=this.formDataToNode(e);this.fireCustomEvent(xn.NodeSaved,{node:t})}else if(this.action){const t=this.formDataToAction(e);this.fireCustomEvent(xn.ActionSaved,{action:t})}else if(this.node){const t=this.formDataToNode(e);this.fireCustomEvent(xn.NodeSaved,{node:t})}}processFormDataForSave(){const t={...this.formData};return Object.keys(t).forEach((e=>{const i=t[e];if(Array.isArray(i)&&i.length>0&&"object"==typeof i[0]&&"key"in i[0]&&"value"in i[0]){const n={};i.forEach((({key:t,value:e})=>{""===t.trim()&&""===e.trim()||(n[t]=e)})),t[e]=n}else if(Array.isArray(i)&&0===i.length){this.isKeyValueField(e)&&(t[e]={})}})),t}handleCancel(){this.fireCustomEvent(xn.NodeEditCancelled,{})}validateForm(){const t={},e=this.getConfig();if(e&&(e.form&&Object.entries(e.form).forEach((([e,i])=>{const n=this.formData[e];if("select"===i.type&&i.allowCreate){let i=this.formData[e];i=Array.isArray(i)?i.find((t=>t.arbitrary)):null,i&&i.arbitrary&&(t[e]='There was an error creating "'+i.name+'"')}i.required&&(!n||Array.isArray(n)&&0===n.length)&&(t[e]=`${i.label||e} is required.`),"string"==typeof n&&i.minLength&&n.length<i.minLength&&(t[e]=`${i.label||e} must be at least ${i.minLength} characters`),"string"==typeof n&&i.maxLength&&n.length>i.maxLength&&(t[e]=`${i.label||e} must be no more than ${i.maxLength} characters`)})),this.validateCategoryNames(t),e.validate)){let i;e.sanitize&&e.sanitize(this.formData),i=this.action?e.validate({...this.action,...this.formData}):e.validate(this.formData),Object.assign(t,i.errors)}return this.validateKeyValueUniqueness(t),{valid:0===Object.keys(t).length,errors:t}}validateKeyValueUniqueness(t){Object.entries(this.formData).forEach((([e,i])=>{if(Array.isArray(i)&&i.length>0&&"object"==typeof i[0]&&"key"in i[0]&&"value"in i[0]){let n=!1;i.forEach((({key:t,value:e})=>{""===t.trim()&&""!==e.trim()&&(n=!0)}));const o=i.filter((({key:t})=>""!==t.trim())).map((({key:t})=>t.trim())),s=new Set(o);o.length!==s.size&&(n=!0),n&&(t[e]="Please resolve validation errors to continue")}}))}validateCategoryNames(t){const e=["other","failure","success","all responses","no response"];Object.entries(this.formData).forEach((([i,n])=>{if(Array.isArray(n)&&"categories"===i){const o=n.filter((t=>(null==t?void 0:t.name)&&""!==t.name.trim())).filter((t=>{const i=t.name.trim().toLowerCase();return e.includes(i)})).map((t=>t.name.trim()));o.length>0&&(t[i]=`Reserved category names cannot be used: ${o.join(", ")}`)}}))}formDataToNode(t=this.formData){var e;if(!this.node)throw new Error("No node to update");let i={...this.node};if(this.node.actions&&this.node.actions.length>0&&(i.actions=this.node.actions.map((e=>{if(this.action&&e.uuid===this.action.uuid){const i=vx[e.type];return(null==i?void 0:i.fromFormData)?i.fromFormData(t):{...e,...t}}return e}))),this.node.router){const n=this.getNodeConfig();if(null==n?void 0:n.fromFormData)i=n.fromFormData(t,i);else if(i.router={...this.node.router},void 0!==t.result_name&&(i.router.result_name=t.result_name),null===(e=null==n?void 0:n.router)||void 0===e?void 0:e.rules){const t=i.router.categories||[],e=i.exits||[],o=[],s=[],r=new Map;if(n.router.rules.forEach((t=>{r.has(t.categoryName)||r.set(t.categoryName,[]),r.get(t.categoryName).push(t)})),r.forEach(((i,n)=>{const r=t.find((t=>t.name===n));if(r){o.push(r);const t=e.find((t=>t.uuid===r.exit_uuid));t&&s.push(t)}else{const t=Yt(),e=Yt();o.push({uuid:t,name:n,exit_uuid:e}),s.push({uuid:e,destination_uuid:null})}})),n.router.defaultCategory){if(!o.find((t=>t.name===n.router.defaultCategory))){const i=t.find((t=>t.name===n.router.defaultCategory));if(i){o.push(i);const t=e.find((t=>t.uuid===i.exit_uuid));t&&s.push(t)}else{const t=Yt(),e=Yt();o.push({uuid:t,name:n.router.defaultCategory,exit_uuid:e}),s.push({uuid:e,destination_uuid:null})}}}i.router.categories=o,i.exits=s}}else Object.keys(t).forEach((e=>{"uuid"!==e&&"actions"!==e&&"exits"!==e&&"router"!==e&&(i[e]=t[e])}));return i}formDataToAction(t=this.formData){if(!this.action)throw new Error("No action to update");const e=vx[this.action.type];return(null==e?void 0:e.fromFormData)?e.fromFormData(t):{...this.action,...t}}handleFormFieldChange(t,e){const i=e.target;let n;if(n="TEMBA-CHECKBOX"===i.tagName?i.checked:void 0!==i.values?i.values:i.value,this.formData={...this.formData,[t]:n},this.errors[t]){const e={...this.errors};delete e[t],this.errors=e}this.updateComputedFields(t),this.updateGroupCollapseStates(),this.requestUpdate()}updateGroupCollapseStates(){const t=this.getConfig();(null==t?void 0:t.layout)&&this.updateGroupCollapseStatesRecursive(t.layout)}updateGroupCollapseStatesRecursive(t){t.forEach((t=>{if("object"==typeof t&&"group"===t.type){const{label:e,collapsed:i,collapsible:n}=t;if(n&&"function"==typeof i){const t=i(this.formData);this.groupCollapseState[e]!==t&&(this.groupCollapseState={...this.groupCollapseState,[e]:t})}this.updateGroupCollapseStatesRecursive(t.items)}else"object"==typeof t&&"row"===t.type&&this.updateGroupCollapseStatesRecursive(t.items)}))}updateComputedFields(t){const e=this.getConfig();(null==e?void 0:e.form)&&Object.entries(e.form).forEach((([e,i])=>{var n;if((null===(n=i.dependsOn)||void 0===n?void 0:n.includes(t))&&i.computeValue){const t=this.formData[e],n=i.computeValue(this.formData,t,this.originalFormData);this.formData={...this.formData,[e]:n}}}))}renderNewField(t,e,i){var n;if(null===(n=e.conditions)||void 0===n?void 0:n.visible)try{if(!e.conditions.visible(this.formData))return U``}catch(e){console.error(`Error checking visibility for ${t}:`,e)}const o=this.errors[t]?[this.errors[t]]:[],s=e.maxWidth?`max-width: ${e.maxWidth};`:"",r=this.renderFieldContent(t,e,i,o);return s?U`<div style="${s}">${r}</div>`:r}renderFieldContent(t,e,i,n){return UM.renderField(t,e,i,{errors:n,onChange:i=>{if(t&&"key-value"===e.type){const e=i;e.detail&&this.handleNewFieldChange(t,e.detail.value)}else t&&"array"===e.type?this.handleNewFieldChange(t,i.target.value):t&&"message-editor"===e.type?this.handleMessageEditorChange(t,i):this.handleFormFieldChange(t,i)},showLabel:!0,formData:this.formData,additionalData:{attachments:this.formData.attachments||[]}})}handleGroupToggle(t){this.groupCollapseState={...this.groupCollapseState,[t]:!this.groupCollapseState[t]}}handleGroupMouseEnter(t){this.groupHoverState={...this.groupHoverState,[t]:!0}}handleGroupMouseLeave(t){this.groupHoverState={...this.groupHoverState,[t]:!1}}expandGroupsWithErrors(t){const e=this.getConfig();if(!(null==e?void 0:e.layout))return;const i=new Set(Object.keys(t));this.expandGroupsWithErrorsRecursive(e.layout,i)}expandGroupsWithErrorsRecursive(t,e){t.forEach((t=>{if("object"==typeof t&&"group"===t.type){this.collectFieldsFromItems(t.items).some((t=>e.has(t)))&&(this.groupCollapseState={...this.groupCollapseState,[t.label]:!1}),this.expandGroupsWithErrorsRecursive(t.items,e)}else"object"==typeof t&&"row"===t.type&&this.expandGroupsWithErrorsRecursive(t.items,e)}))}renderLayoutItem(t,e,i){if("string"==typeof t)return this.renderLayoutItem({type:"field",field:t},e,i);switch(t.type){case"field":return e.form[t.field]&&!i.has(t.field)?(i.add(t.field),this.renderNewField(t.field,e.form[t.field],this.formData[t.field])):U``;case"row":return this.renderRow(t,e,i);case"group":return this.renderGroup(t,e,i);default:return U``}}renderRow(t,e,i){const{items:n,gap:o="1rem"}=t,s=this.collectFieldsFromItems(n).filter((t=>{var i;return null===(i=e.form)||void 0===i?void 0:i[t]}));if(0===s.length)return U``;const r=s.map((t=>e.form[t].maxWidth||"1fr"));return U`
|
|
10169
10127
|
<div
|
|
10170
10128
|
class="form-row"
|
|
10171
10129
|
style="display: grid; grid-template-columns: ${r.join(" ")}; gap: ${o};"
|
|
@@ -10266,7 +10224,7 @@ var JA=function(){if("undefined"!=typeof window){if(window.devicePixelRatio)retu
|
|
|
10266
10224
|
|
|
10267
10225
|
<div slot="gutter">${this.renderGutter()}</div>
|
|
10268
10226
|
</temba-dialog>
|
|
10269
|
-
`}}t([mt({type:Object})],
|
|
10227
|
+
`}}t([mt({type:Object})],WM.prototype,"action",void 0),t([mt({type:Object})],WM.prototype,"node",void 0),t([mt({type:Object})],WM.prototype,"nodeUI",void 0),t([mt({type:Boolean})],WM.prototype,"isOpen",void 0),t([gt()],WM.prototype,"formData",void 0),t([gt()],WM.prototype,"originalFormData",void 0),t([gt()],WM.prototype,"errors",void 0),t([gt()],WM.prototype,"groupCollapseState",void 0),t([gt()],WM.prototype,"groupHoverState",void 0);class GM extends cn{constructor(){super(...arguments),this._items=[],this.minItems=0,this.maintainEmptyItem=!1}getContainerClass(){return"base-list-editor"}renderAddButton(){return U`
|
|
10270
10228
|
<button class="add-btn" @click=${()=>this.addItem()}>Add Item</button>
|
|
10271
10229
|
`}shouldShowAddButton(){return!this.maintainEmptyItem&&(!this.maxItems||this._items.length<this.maxItems)}renderWidget(){const t=this.displayItems;return U`
|
|
10272
10230
|
<div class=${this.getContainerClass()}>
|
|
@@ -10278,7 +10236,7 @@ var JA=function(){if("undefined"!=typeof window){if(window.devicePixelRatio)retu
|
|
|
10278
10236
|
</div>
|
|
10279
10237
|
${this.shouldShowAddButton()?this.renderAddButton():""}
|
|
10280
10238
|
</div>
|
|
10281
|
-
`}cleanItems(t){return this.maintainEmptyItem?t.filter((t=>!this.isEmptyItem(t))):t}get displayItems(){const t=[...this._items];if(this.maintainEmptyItem){t.some((t=>this.isEmptyItem(t)))||this.maxItems&&!(t.length<this.maxItems)||t.push(this.createEmptyItem())}return t}handleItemChange(t,e){const i=[...this._items];i[t]=e,this.updateValue(i)}handleFieldChange(t,e,i){const n=[...this._items];if(t>=this._items.length){if(this.maxItems&&this._items.length>=this.maxItems)return;for(;n.length<=t;)n.push(this.createEmptyItem())}const o=n[t]||this.createEmptyItem();n[t]={...o,[e]:i},this.updateValue(n)}addItem(t){if(this.maxItems&&this._items.length>=this.maxItems)return;const e=t||this.createEmptyItem(),i=[...this._items,e];this.updateValue(i)}removeItem(t){if(this._items.length<=this.minItems)return;const e=this._items.filter(((e,i)=>i!==t));this.updateValue(e)}canRemoveItem(t){const e=this.displayItems[t];return!(this._items.length<=this.minItems)&&(!this.maintainEmptyItem||!this.isEmptyItem(e))}updateValue(t){this._items=t,this.dispatchEvent(new CustomEvent("change",{detail:{value:this.cleanItems(t)},bubbles:!0}))}itemsEqual(t,e){return JSON.stringify(t)===JSON.stringify(e)}}t([mt({attribute:!1})],
|
|
10239
|
+
`}cleanItems(t){return this.maintainEmptyItem?t.filter((t=>!this.isEmptyItem(t))):t}get displayItems(){const t=[...this._items];if(this.maintainEmptyItem){t.some((t=>this.isEmptyItem(t)))||this.maxItems&&!(t.length<this.maxItems)||t.push(this.createEmptyItem())}return t}handleItemChange(t,e){const i=[...this._items];i[t]=e,this.updateValue(i)}handleFieldChange(t,e,i){const n=[...this._items];if(t>=this._items.length){if(this.maxItems&&this._items.length>=this.maxItems)return;for(;n.length<=t;)n.push(this.createEmptyItem())}const o=n[t]||this.createEmptyItem();n[t]={...o,[e]:i},this.updateValue(n)}addItem(t){if(this.maxItems&&this._items.length>=this.maxItems)return;const e=t||this.createEmptyItem(),i=[...this._items,e];this.updateValue(i)}removeItem(t){if(this._items.length<=this.minItems)return;const e=this._items.filter(((e,i)=>i!==t));this.updateValue(e)}canRemoveItem(t){const e=this.displayItems[t];return!(this._items.length<=this.minItems)&&(!this.maintainEmptyItem||!this.isEmptyItem(e))}updateValue(t){this._items=t,this.dispatchEvent(new CustomEvent("change",{detail:{value:this.cleanItems(t)},bubbles:!0}))}itemsEqual(t,e){return JSON.stringify(t)===JSON.stringify(e)}}t([mt({attribute:!1})],GM.prototype,"_items",void 0),t([mt({type:Number})],GM.prototype,"minItems",void 0),t([mt({type:Number})],GM.prototype,"maxItems",void 0),t([mt({type:Boolean})],GM.prototype,"maintainEmptyItem",void 0);let ZM=class extends GM{constructor(){super(),this.keyPlaceholder="Key",this.valuePlaceholder="Value",this.showValidation=!0,this.keyErrors={},this.maintainEmptyItem=!0,this._items=[]}get value(){return this._items.filter((({key:t,value:e})=>""!==t.trim()||""!==e.trim()))}set value(t){Array.isArray(t)?this._items=[...t]:this._items=Object.entries(t||{}).map((([t,e])=>({key:t,value:"string"==typeof e?e:String(e)}))),this.requestUpdate()}isEmptyItem(t){return""===t.key.trim()&&""===t.value.trim()}createEmptyItem(){return{key:"",value:""}}cleanItems(t){return t.filter((({key:t,value:e})=>""!==t.trim()||""!==e.trim()))}toRecord(){const t={};return this._items.forEach((({key:e,value:i})=>{""===e.trim()&&""===i.trim()||(t[e]=i)})),t}validateKeys(){const t={};this._items.forEach((({key:e,value:i},n)=>{""===e.trim()&&""!==i.trim()&&(t[n]="Key is required when value is provided")}));const e=this._items.map((({key:t},e)=>({key:t.trim(),index:e}))).filter((({key:t})=>""!==t)),i=new Map;return e.forEach((({key:t,index:e})=>{i.has(t)||i.set(t,[]),i.get(t).push(e)})),i.forEach(((e,i)=>{e.length>1&&e.forEach((e=>{t[e]||(t[e]=`Duplicate key "${i}"`)}))})),this.keyErrors=t,0===Object.keys(t).length}clearKeyErrors(){this.keyErrors={}}updateValue(t){this._items=t,this.clearKeyErrors(),this.validateKeys(),this.dispatchEvent(new CustomEvent("change",{detail:{value:this.cleanItems(t)},bubbles:!0})),this.requestUpdate()}handleKeyChange(t,e){const i=this.displayItems[t];if(this.keyErrors[t]){const e={...this.keyErrors};delete e[t],this.keyErrors=e}this.handleItemChange(t,{key:e,value:i.value})}handleValueChange(t,e){const i=this.displayItems[t];if(this.keyErrors[t]){const e={...this.keyErrors};delete e[t],this.keyErrors=e}this.handleItemChange(t,{key:i.key,value:e})}renderItem(t,e){const i=this.canRemoveItem(e),n=this.showValidation&&this.keyErrors[e]?this.keyErrors[e]:"";return U`
|
|
10282
10240
|
<div class="row">
|
|
10283
10241
|
<temba-textinput
|
|
10284
10242
|
.value=${t.key}
|
|
@@ -10340,19 +10298,62 @@ var JA=function(){if("undefined"!=typeof window){if(window.devicePixelRatio)retu
|
|
|
10340
10298
|
width: 32px;
|
|
10341
10299
|
height: 32px;
|
|
10342
10300
|
}
|
|
10343
|
-
`}};t([mt({type:String})],
|
|
10301
|
+
`}};t([mt({type:String})],ZM.prototype,"keyPlaceholder",void 0),t([mt({type:String})],ZM.prototype,"valuePlaceholder",void 0),t([mt({type:Boolean})],ZM.prototype,"showValidation",void 0),t([gt()],ZM.prototype,"keyErrors",void 0),t([mt({type:Array})],ZM.prototype,"value",null),ZM=t([dt("temba-key-value-editor")],ZM);let YM=class extends GM{constructor(){super(),this.itemConfig={},this.itemLabel="Item",this.sortable=!1,this.maintainEmptyItem=!0,this.focusInfo=null,this._items=[]}get value(){return[...this._items]}set value(t){this._items=t||[],this.requestUpdate()}isEmptyItem(t){if(this.isEmptyItemFn)return this.isEmptyItemFn(t);const e=Object.values(t);return 0===e.length||e.every((t=>null==t||""===t))}cleanItems(t){return t.filter((t=>{const e=Object.values(t);return e.length>0&&e.some((t=>null!=t&&""!==t))}))}captureFocus(){var t,e,i,n,o,s,r;const a=null===(t=this.shadowRoot)||void 0===t?void 0:t.activeElement,l=document.activeElement;let c=a||l;if(l&&(null===(e=this.shadowRoot)||void 0===e?void 0:e.contains(l))&&(c=l),!c)return void(this.focusInfo=null);let h=c,d=null;for(;h;){if(null===(i=h.classList)||void 0===i?void 0:i.contains("array-item")){d=h;break}if(h.parentElement)h=h.parentElement;else{if(!h.parentNode||!h.parentNode.host)break;h=h.parentNode.host}}if(!d)return void(this.focusInfo=null);const u=null===(n=d.id)||void 0===n?void 0:n.match(/array-item-(\d+)/);if(!u)return void(this.focusInfo=null);const p=parseInt(u[1],10);let m="";if((null===(o=c.tagName)||void 0===o?void 0:o.toLowerCase().startsWith("temba-"))&&(m=c.name||c.getAttribute("name")||""),!m&&c.hasAttribute&&c.hasAttribute("name")&&(m=c.getAttribute("name")||""),!m){let t=c;for(;t&&t!==d;){if(t.hasAttribute&&t.hasAttribute("data-field-name")){m=t.getAttribute("data-field-name")||"";break}t=t.parentElement}}if(!m)return void(this.focusInfo=null);let g=c;if(null===(s=c.tagName)||void 0===s?void 0:s.toLowerCase().startsWith("temba-")){const t=(null===(r=c.shadowRoot)||void 0===r?void 0:r.querySelector("input, textarea"))||c.querySelector("input, textarea");t&&(g=t)}const f=g.selectionStart,v=g.selectionEnd;this.focusInfo={itemIndex:p,fieldName:m,selectionStart:f,selectionEnd:v}}restoreFocus(){var t,e;if(!this.focusInfo)return;const{itemIndex:i,fieldName:n,selectionStart:o,selectionEnd:s}=this.focusInfo,r=`array-item-${i}`,a=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById(r);if(a)this.attemptFocusRestore(a,n,o,s),this.focusInfo=null;else{const t=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelectorAll(".array-item");if(t&&t.length>i){const e=t[i];e&&this.attemptFocusRestore(e,n,o,s)}this.focusInfo=null}}attemptFocusRestore(t,e,i,n){const o=t.querySelector(`[data-field-name="${e}"]`);let s=null;if(o&&(s=o.querySelector("temba-textinput, temba-completion, input, textarea")),!s){const i=[`temba-textinput[name="${e}"]`,`temba-completion[name="${e}"]`,`input[name="${e}"]`,`textarea[name="${e}"]`,`[name="${e}"]`];for(const e of i)if(s=t.querySelector(e),s)break}s&&requestAnimationFrame((()=>{requestAnimationFrame((()=>{var t,e;try{if(s.focus(),void 0!==i&&void 0!==n){let o=s;if(null===(t=s.tagName)||void 0===t?void 0:t.toLowerCase().startsWith("temba-")){const t=(null===(e=s.shadowRoot)||void 0===e?void 0:e.querySelector("input, textarea"))||s.querySelector("input, textarea");t&&"setSelectionRange"in t&&(o=t)}"setSelectionRange"in o&&o.setSelectionRange(i,n)}}catch(t){}}))}))}createEmptyItem(){return{}}handleFieldChange(t,e,i){let n;this.onItemChange?n=this.onItemChange(t,e,i,this._items):(n=[...this._items],n[t]={...n[t],[e]:i}),this.updateValue(n)}willUpdate(t){super.willUpdate(t),(t.has("_items")||t.has("value"))&&this.captureFocus()}updated(t){super.updated(t),(t.has("_items")||t.has("value"))&&this.restoreFocus()}handleOrderChanged(t){const e=t.detail;if(e.swap&&Array.isArray(e.swap)&&2===e.swap.length){const[t,i]=e.swap;if(t!==i&&t>=0&&i>=0&&t<this._items.length&&i<this._items.length){const e=[...this._items],n=e.splice(t,1)[0];e.splice(i,0,n),this.updateValue(e)}}}renderWidget(){const t=this.displayItems.map(((t,e)=>{const i=this.renderItem(t,e);return this.sortable&&!this.isEmptyItem(t)?U`
|
|
10302
|
+
<div class="sortable" id="array-item-${e}">${i}</div>
|
|
10303
|
+
`:i}));return this.sortable?U`
|
|
10304
|
+
<div class=${this.getContainerClass()}>
|
|
10305
|
+
<temba-sortable-list
|
|
10306
|
+
dragHandle="drag-handle"
|
|
10307
|
+
gap="0.4em"
|
|
10308
|
+
@temba-order-changed=${this.handleOrderChanged}
|
|
10309
|
+
style="display: grid; grid-template-columns: 1fr; gap: 8px;"
|
|
10310
|
+
>
|
|
10311
|
+
${t}
|
|
10312
|
+
</temba-sortable-list>
|
|
10313
|
+
${this.shouldShowAddButton()?this.renderAddButton():""}
|
|
10314
|
+
</div>
|
|
10315
|
+
`:U`
|
|
10316
|
+
<div class=${this.getContainerClass()}>
|
|
10317
|
+
<div
|
|
10318
|
+
class="list-items"
|
|
10319
|
+
style="display: grid; grid-template-columns: 1fr; gap: 8px;"
|
|
10320
|
+
>
|
|
10321
|
+
${t}
|
|
10322
|
+
</div>
|
|
10323
|
+
${this.shouldShowAddButton()?this.renderAddButton():""}
|
|
10324
|
+
</div>
|
|
10325
|
+
`}computeFieldValue(t,e,i){const n=this._items[t]||{},o=n[e];return i.computeValue?i.computeValue(n,o):o}renderArrayField(t,e,i){const n=this.computeFieldValue(t,e,i),o="select"===i.type&&i.flavor||"small";let s="";i.width?s=`width: ${i.width};`:i.maxWidth&&(s=`max-width: ${i.maxWidth};`);const r=UM.renderField(e,i,n,{showLabel:!1,flavor:o,extraClasses:"form-control",onChange:n=>{let o;const s=n.target;o="select"===i.type?s.values:s.value,this.handleFieldChange(t,e,o)}});return s?U`<div style="${s}">${r}</div>`:r}renderItem(t,e){const i=this.canRemoveItem(e),n=[];let o=!1;return Object.entries(this.itemConfig).forEach((([t,i])=>{var s;let r=!0;if(null===(s=i.conditions)||void 0===s?void 0:s.visible)try{const t=this._items[e]||{};r=i.conditions.visible(t)}catch(e){console.error(`Error checking visibility for ${t}:`,e)}if(r){!i.width&&!i.maxWidth&&"text"===i.type&&(o=!0),n.push(U`
|
|
10344
10326
|
<div
|
|
10345
|
-
|
|
10327
|
+
data-field-name="${t}"
|
|
10328
|
+
style="${i.width||i.maxWidth||"select"===i.type?"flex:none":"flex:1"}"
|
|
10346
10329
|
>
|
|
10347
10330
|
${this.renderArrayField(e,t,i)}
|
|
10348
10331
|
</div>
|
|
10349
|
-
`)}})),o||n.splice(-1,0,U`<div class="field field-flex spacer"></div>`),U`
|
|
10350
|
-
<div class="array-item">
|
|
10351
|
-
<div
|
|
10332
|
+
`)}})),o||n.splice(-1,0,U`<div class="field field-flex spacer" style="flex-grow:1"></div>`),U`
|
|
10333
|
+
<div class="array-item" id="array-item-${e}">
|
|
10334
|
+
<div
|
|
10335
|
+
class="item-fields ${i?"":"removable"}"
|
|
10336
|
+
style="display: flex; gap: 12px; align-items: center"
|
|
10337
|
+
>
|
|
10338
|
+
${this.sortable?U`<temba-icon
|
|
10339
|
+
name=${hn.sort}
|
|
10340
|
+
style="margin-right: -6px;"
|
|
10341
|
+
class="drag-handle"
|
|
10342
|
+
></temba-icon>`:null}
|
|
10352
10343
|
${n}
|
|
10353
10344
|
<button
|
|
10354
10345
|
@click=${i?()=>this.removeItem(e):void 0}
|
|
10355
|
-
class="remove-btn
|
|
10346
|
+
class="remove-btn"
|
|
10347
|
+
style="
|
|
10348
|
+
padding: 4px;
|
|
10349
|
+
border: 1px solid #ccc;
|
|
10350
|
+
border-radius: 4px;
|
|
10351
|
+
background: white;
|
|
10352
|
+
cursor: pointer;
|
|
10353
|
+
background: #fefefe;
|
|
10354
|
+
color: #999;
|
|
10355
|
+
font-size: 14px;
|
|
10356
|
+
"
|
|
10356
10357
|
?disabled=${!i}
|
|
10357
10358
|
>
|
|
10358
10359
|
<temba-icon name="x"></temba-icon>
|
|
@@ -10362,12 +10363,6 @@ var JA=function(){if("undefined"!=typeof window){if(window.devicePixelRatio)retu
|
|
|
10362
10363
|
`}getContainerClass(){return"array-editor"}static get styles(){return a`
|
|
10363
10364
|
${super.styles}
|
|
10364
10365
|
|
|
10365
|
-
.array-editor {
|
|
10366
|
-
}
|
|
10367
|
-
|
|
10368
|
-
.array-item {
|
|
10369
|
-
}
|
|
10370
|
-
|
|
10371
10366
|
.item-header {
|
|
10372
10367
|
display: flex;
|
|
10373
10368
|
justify-content: space-between;
|
|
@@ -10379,24 +10374,10 @@ var JA=function(){if("undefined"!=typeof window){if(window.devicePixelRatio)retu
|
|
|
10379
10374
|
color: #333;
|
|
10380
10375
|
}
|
|
10381
10376
|
|
|
10382
|
-
.item-fields {
|
|
10383
|
-
display: flex;
|
|
10384
|
-
gap: 12px;
|
|
10385
|
-
align-items: center;
|
|
10386
|
-
}
|
|
10387
|
-
|
|
10388
10377
|
.field {
|
|
10389
10378
|
/* Base field styles */
|
|
10390
10379
|
}
|
|
10391
10380
|
|
|
10392
|
-
.field-flex {
|
|
10393
|
-
flex: 1; /* Grow to fill remaining space */
|
|
10394
|
-
}
|
|
10395
|
-
|
|
10396
|
-
.field-fixed {
|
|
10397
|
-
flex: none; /* Don't grow, use content/maxWidth size */
|
|
10398
|
-
}
|
|
10399
|
-
|
|
10400
10381
|
.spacer {
|
|
10401
10382
|
/* Empty spacer to maintain layout alignment */
|
|
10402
10383
|
}
|
|
@@ -10421,11 +10402,21 @@ var JA=function(){if("undefined"!=typeof window){if(window.devicePixelRatio)retu
|
|
|
10421
10402
|
color: #999;
|
|
10422
10403
|
}
|
|
10423
10404
|
|
|
10424
|
-
.remove-btn
|
|
10405
|
+
.removable .remove-btn {
|
|
10425
10406
|
visibility: hidden;
|
|
10426
10407
|
cursor: default;
|
|
10427
10408
|
}
|
|
10428
|
-
|
|
10409
|
+
|
|
10410
|
+
.removable .drag-handle {
|
|
10411
|
+
visibility: hidden;
|
|
10412
|
+
cursor: default;
|
|
10413
|
+
}
|
|
10414
|
+
|
|
10415
|
+
.drag-handle {
|
|
10416
|
+
cursor: grab;
|
|
10417
|
+
color: #ccc;
|
|
10418
|
+
}
|
|
10419
|
+
`}};t([mt({type:Object})],YM.prototype,"itemConfig",void 0),t([mt({type:String})],YM.prototype,"itemLabel",void 0),t([mt({type:Function})],YM.prototype,"onItemChange",void 0),t([mt({type:Function})],YM.prototype,"isEmptyItemFn",void 0),t([mt({type:Boolean})],YM.prototype,"sortable",void 0),t([mt({type:Boolean})],YM.prototype,"maintainEmptyItem",void 0),t([mt({type:Array})],YM.prototype,"value",null),YM=t([dt("temba-array-editor")],YM);class XM extends cn{constructor(){super(...arguments),this.name="",this.placeholder="",this.textarea=!0,this.autogrow=!0,this.minHeight=60,this.submitOnEnter=!1,this.attachments=[],this.accept="",this.maxAttachments=3,this.endpoint="",this.pendingDrop=!1,this.uploading=!1}static get styles(){return a`
|
|
10429
10420
|
${super.styles}
|
|
10430
10421
|
:host {
|
|
10431
10422
|
display: block;
|
|
@@ -10591,7 +10582,7 @@ var JA=function(){if("undefined"!=typeof window){if(window.devicePixelRatio)retu
|
|
|
10591
10582
|
ignoreDrops
|
|
10592
10583
|
></temba-media-picker>`}
|
|
10593
10584
|
</div>
|
|
10594
|
-
`}}function
|
|
10585
|
+
`}}function KM(t,e){window.customElements.get(t)||window.customElements.define(t,e)}t([mt({type:String})],XM.prototype,"name",void 0),t([mt({type:String})],XM.prototype,"placeholder",void 0),t([mt({type:Boolean})],XM.prototype,"textarea",void 0),t([mt({type:Boolean})],XM.prototype,"autogrow",void 0),t([mt({type:Number})],XM.prototype,"minHeight",void 0),t([mt({type:Number})],XM.prototype,"maxLength",void 0),t([mt({type:Boolean})],XM.prototype,"session",void 0),t([mt({type:Boolean})],XM.prototype,"submitOnEnter",void 0),t([mt({type:Boolean})],XM.prototype,"gsm",void 0),t([mt({type:Boolean})],XM.prototype,"disableCompletion",void 0),t([mt({type:String})],XM.prototype,"counter",void 0),t([mt({type:Array})],XM.prototype,"attachments",void 0),t([mt({type:String})],XM.prototype,"accept",void 0),t([mt({type:Number,attribute:"max-attachments"})],XM.prototype,"maxAttachments",void 0),t([mt({type:String})],XM.prototype,"endpoint",void 0),t([mt({type:Boolean,attribute:!1})],XM.prototype,"pendingDrop",void 0),t([mt({type:Boolean,attribute:!1})],XM.prototype,"uploading",void 0),KM("temba-anchor",Mh),KM("temba-alert",bh),KM("temba-store",hc),KM("temba-textinput",_n),KM("temba-datepicker",Gh),KM("temba-range-picker",HM),KM("temba-date",ed),KM("temba-completion",Ec),KM("temba-checkbox",dn),KM("temba-select",Sc),KM("temba-options",dc),KM("temba-loading",Ic),KM("temba-lightbox",nd),KM("temba-button",Dc),KM("temba-omnibox",Ch),KM("temba-tip",Sh),KM("temba-contact-name",Oh),KM("temba-contact-name-fetch",Wh),KM("temba-contact-field",Rh),KM("temba-contact-fields",Lh),KM("temba-field-manager",Xh),KM("temba-urn",$h),KM("temba-content-menu",Jh),KM("temba-dialog",Tc),KM("temba-modax",Pc),KM("temba-charcount",Fc),KM("temba-contact-chat",uh),KM("temba-contact-details",class extends Hc{static get styles(){return a`
|
|
10595
10586
|
.urn {
|
|
10596
10587
|
display: flex;
|
|
10597
10588
|
padding: 0.4em 1em 0.8em 1em;
|
|
@@ -10672,7 +10663,7 @@ var JA=function(){if("undefined"!=typeof window){if(window.devicePixelRatio)retu
|
|
|
10672
10663
|
disabled
|
|
10673
10664
|
></temba-contact-field>
|
|
10674
10665
|
</div>
|
|
10675
|
-
`}}),
|
|
10666
|
+
`}}),KM("temba-ticket-list",fh),KM("temba-notification-list",class extends gh{static get styles(){return a`
|
|
10676
10667
|
:host {
|
|
10677
10668
|
--option-hover-bg: #f9f9f9;
|
|
10678
10669
|
}
|
|
@@ -10715,7 +10706,7 @@ var JA=function(){if("undefined"!=typeof window){if(window.devicePixelRatio)retu
|
|
|
10715
10706
|
</div>`}}renderHeader(){return U`<div class="header">
|
|
10716
10707
|
<temba-icon name="notification"></temba-icon>
|
|
10717
10708
|
<div class="title">Notifications</div>
|
|
10718
|
-
</div>`}scrollToTop(){window.setTimeout((()=>{this.shadowRoot.querySelector("temba-options").scrollToTop()}),1e3)}}),
|
|
10709
|
+
</div>`}scrollToTop(){window.setTimeout((()=>{this.shadowRoot.querySelector("temba-options").scrollToTop()}),1e3)}}),KM("temba-list",gh),KM("temba-sortable-list",uc),KM("temba-run-list",Hh),KM("temba-flow-details",Uh),KM("temba-label",Ih),KM("temba-menu",Ah),KM("temba-contact-search",xh),KM("temba-icon",_h),KM("temba-dropdown",Th),KM("temba-tabs",Ph),KM("temba-tab",Dh),KM("temba-contact-badges",jh),KM("temba-contact-pending",Fh),KM("temba-slider",qh),KM("temba-content-menu",Jh),KM("temba-compose",id),KM("temba-color-picker",od),KM("temba-resizer",sd),KM("temba-thumbnail",cd),KM("temba-webchat",ud),KM("temba-image-picker",md),KM("temba-mask",gd),KM("temba-user",dl),KM("temba-template-editor",fd),KM("temba-toast",Sd),KM("temba-chat",Yc),KM("temba-media-picker",Ad),KM("temba-flow-editor",_x),KM("temba-node-editor",WM),KM("temba-flow-node",bx),KM("temba-sticky-note",wx),KM("temba-contact-notepad",kx),KM("temba-progress",Cx),KM("temba-start-progress",Sx),KM("temba-shortcuts",Ex),KM("temba-popup-select",Ax),KM("temba-user-select",Mx),KM("temba-workspace-select",Tx),KM("temba-chart",VM),KM("temba-key-value-editor",ZM),KM("temba-array-editor",YM),KM("temba-message-editor",XM);class QM extends ct{static get styles(){return a`
|
|
10719
10710
|
:host {
|
|
10720
10711
|
line-height: normal;
|
|
10721
10712
|
}
|
|
@@ -10923,7 +10914,7 @@ var JA=function(){if("undefined"!=typeof window){if(window.devicePixelRatio)retu
|
|
|
10923
10914
|
></temba-textinput>
|
|
10924
10915
|
</div>
|
|
10925
10916
|
</temba-dialog>
|
|
10926
|
-
`}}t([mt({type:Array,attribute:!1})],ZM.prototype,"path",void 0),t([mt()],ZM.prototype,"endpoint",void 0),t([mt()],ZM.prototype,"osmId",void 0),t([mt({type:Object})],ZM.prototype,"hovered",void 0),t([mt({type:Object})],ZM.prototype,"editFeature",void 0),t([mt({type:String,attribute:!1})],ZM.prototype,"editFeatureAliases",void 0);"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var YM={exports:{}};(function(t){var e="1.5.1+build.2e3e0ffb",i=Object.freeze;function n(t){var e,i,n,o;for(i=1,n=arguments.length;i<n;i++)for(e in o=arguments[i])t[e]=o[e];return t}Object.freeze=function(t){return t};var o=Object.create||function(){function t(){}return function(e){return t.prototype=e,new t}}();function s(t,e){var i=Array.prototype.slice;if(t.bind)return t.bind.apply(t,i.call(arguments,1));var n=i.call(arguments,2);return function(){return t.apply(e,n.length?n.concat(i.call(arguments)):arguments)}}var r=0;function a(t){return t._leaflet_id=t._leaflet_id||++r,t._leaflet_id}function l(t,e,i){var n,o,s,r;return r=function(){n=!1,o&&(s.apply(i,o),o=!1)},s=function(){n?o=arguments:(t.apply(i,arguments),setTimeout(r,e),n=!0)},s}function c(t,e,i){var n=e[1],o=e[0],s=n-o;return t===n&&i?t:((t-o)%s+s)%s+o}function h(){return!1}function d(t,e){return e=void 0===e?6:e,+(Math.round(t+"e+"+e)+"e-"+e)}function u(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function p(t){return u(t).split(/\s+/)}function m(t,e){for(var i in t.hasOwnProperty("options")||(t.options=t.options?o(t.options):{}),e)t.options[i]=e[i];return t.options}function g(t,e,i){var n=[];for(var o in t)n.push(encodeURIComponent(i?o.toUpperCase():o)+"="+encodeURIComponent(t[o]));return(e&&-1!==e.indexOf("?")?"&":"?")+n.join("&")}var f=/\{ *([\w_-]+) *\}/g;function v(t,e){return t.replace(f,(function(t,i){var n=e[i];if(void 0===n)throw new Error("No value provided for variable "+t);return"function"==typeof n&&(n=n(e)),n}))}var y=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function b(t,e){for(var i=0;i<t.length;i++)if(t[i]===e)return i;return-1}var x="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=";function _(t){return window["webkit"+t]||window["moz"+t]||window["ms"+t]}var w=0;function k(t){var e=+new Date,i=Math.max(0,16-(e-w));return w=e+i,window.setTimeout(t,i)}var C=window.requestAnimationFrame||_("RequestAnimationFrame")||k,S=window.cancelAnimationFrame||_("CancelAnimationFrame")||_("CancelRequestAnimationFrame")||function(t){window.clearTimeout(t)};function E(t,e,i){if(!i||C!==k)return C.call(window,s(t,e));t.call(e)}function A(t){t&&S.call(window,t)}var M=(Object.freeze||Object)({freeze:i,extend:n,create:o,bind:s,lastId:r,stamp:a,throttle:l,wrapNum:c,falseFn:h,formatNum:d,trim:u,splitWords:p,setOptions:m,getParamString:g,template:v,isArray:y,indexOf:b,emptyImageUrl:x,requestFn:C,cancelFn:S,requestAnimFrame:E,cancelAnimFrame:A});function T(){}function P(t){if("undefined"!=typeof L&&L&&L.Mixin){t=y(t)?t:[t];for(var e=0;e<t.length;e++)t[e]===L.Mixin.Events&&console.warn("Deprecated include of L.Mixin.Events: this property will be removed in future releases, please inherit from L.Evented instead.",(new Error).stack)}}T.extend=function(t){var e=function(){this.initialize&&this.initialize.apply(this,arguments),this.callInitHooks()},i=e.__super__=this.prototype,s=o(i);for(var r in s.constructor=e,e.prototype=s,this)this.hasOwnProperty(r)&&"prototype"!==r&&"__super__"!==r&&(e[r]=this[r]);return t.statics&&(n(e,t.statics),delete t.statics),t.includes&&(P(t.includes),n.apply(null,[s].concat(t.includes)),delete t.includes),s.options&&(t.options=n(o(s.options),t.options)),n(s,t),s._initHooks=[],s.callInitHooks=function(){if(!this._initHooksCalled){i.callInitHooks&&i.callInitHooks.call(this),this._initHooksCalled=!0;for(var t=0,e=s._initHooks.length;t<e;t++)s._initHooks[t].call(this)}},e},T.include=function(t){return n(this.prototype,t),this},T.mergeOptions=function(t){return n(this.prototype.options,t),this},T.addInitHook=function(t){var e=Array.prototype.slice.call(arguments,1),i="function"==typeof t?t:function(){this[t].apply(this,e)};return this.prototype._initHooks=this.prototype._initHooks||[],this.prototype._initHooks.push(i),this};var D={on:function(t,e,i){if("object"==typeof t)for(var n in t)this._on(n,t[n],e);else for(var o=0,s=(t=p(t)).length;o<s;o++)this._on(t[o],e,i);return this},off:function(t,e,i){if(t)if("object"==typeof t)for(var n in t)this._off(n,t[n],e);else for(var o=0,s=(t=p(t)).length;o<s;o++)this._off(t[o],e,i);else delete this._events;return this},_on:function(t,e,i){this._events=this._events||{};var n=this._events[t];n||(n=[],this._events[t]=n),i===this&&(i=void 0);for(var o={fn:e,ctx:i},s=n,r=0,a=s.length;r<a;r++)if(s[r].fn===e&&s[r].ctx===i)return;s.push(o)},_off:function(t,e,i){var n,o,s;if(this._events&&(n=this._events[t]))if(e){if(i===this&&(i=void 0),n)for(o=0,s=n.length;o<s;o++){var r=n[o];if(r.ctx===i&&r.fn===e)return r.fn=h,this._firingCount&&(this._events[t]=n=n.slice()),void n.splice(o,1)}}else{for(o=0,s=n.length;o<s;o++)n[o].fn=h;delete this._events[t]}},fire:function(t,e,i){if(!this.listens(t,i))return this;var o=n({},e,{type:t,target:this,sourceTarget:e&&e.sourceTarget||this});if(this._events){var s=this._events[t];if(s){this._firingCount=this._firingCount+1||1;for(var r=0,a=s.length;r<a;r++){var l=s[r];l.fn.call(l.ctx||this,o)}this._firingCount--}}return i&&this._propagateEvent(o),this},listens:function(t,e){var i=this._events&&this._events[t];if(i&&i.length)return!0;if(e)for(var n in this._eventParents)if(this._eventParents[n].listens(t,e))return!0;return!1},once:function(t,e,i){if("object"==typeof t){for(var n in t)this.once(n,t[n],e);return this}var o=s((function(){this.off(t,e,i).off(t,o,i)}),this);return this.on(t,e,i).on(t,o,i)},addEventParent:function(t){return this._eventParents=this._eventParents||{},this._eventParents[a(t)]=t,this},removeEventParent:function(t){return this._eventParents&&delete this._eventParents[a(t)],this},_propagateEvent:function(t){for(var e in this._eventParents)this._eventParents[e].fire(t.type,n({layer:t.target,propagatedFrom:t.target},t),!0)}};D.addEventListener=D.on,D.removeEventListener=D.clearAllEventListeners=D.off,D.addOneTimeEventListener=D.once,D.fireEvent=D.fire,D.hasEventListeners=D.listens;var I=T.extend(D);function O(t,e,i){this.x=i?Math.round(t):t,this.y=i?Math.round(e):e}var $=Math.trunc||function(t){return t>0?Math.floor(t):Math.ceil(t)};function z(t,e,i){return t instanceof O?t:y(t)?new O(t[0],t[1]):null==t?t:"object"==typeof t&&"x"in t&&"y"in t?new O(t.x,t.y):new O(t,e,i)}function R(t,e){if(t)for(var i=e?[t,e]:t,n=0,o=i.length;n<o;n++)this.extend(i[n])}function N(t,e){return!t||t instanceof R?t:new R(t,e)}function j(t,e){if(t)for(var i=e?[t,e]:t,n=0,o=i.length;n<o;n++)this.extend(i[n])}function B(t,e){return t instanceof j?t:new j(t,e)}function F(t,e,i){if(isNaN(t)||isNaN(e))throw new Error("Invalid LatLng object: ("+t+", "+e+")");this.lat=+t,this.lng=+e,void 0!==i&&(this.alt=+i)}function q(t,e,i){return t instanceof F?t:y(t)&&"object"!=typeof t[0]?3===t.length?new F(t[0],t[1],t[2]):2===t.length?new F(t[0],t[1]):null:null==t?t:"object"==typeof t&&"lat"in t?new F(t.lat,"lng"in t?t.lng:t.lon,t.alt):void 0===e?null:new F(t,e,i)}O.prototype={clone:function(){return new O(this.x,this.y)},add:function(t){return this.clone()._add(z(t))},_add:function(t){return this.x+=t.x,this.y+=t.y,this},subtract:function(t){return this.clone()._subtract(z(t))},_subtract:function(t){return this.x-=t.x,this.y-=t.y,this},divideBy:function(t){return this.clone()._divideBy(t)},_divideBy:function(t){return this.x/=t,this.y/=t,this},multiplyBy:function(t){return this.clone()._multiplyBy(t)},_multiplyBy:function(t){return this.x*=t,this.y*=t,this},scaleBy:function(t){return new O(this.x*t.x,this.y*t.y)},unscaleBy:function(t){return new O(this.x/t.x,this.y/t.y)},round:function(){return this.clone()._round()},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},floor:function(){return this.clone()._floor()},_floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.clone()._ceil()},_ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},trunc:function(){return this.clone()._trunc()},_trunc:function(){return this.x=$(this.x),this.y=$(this.y),this},distanceTo:function(t){var e=(t=z(t)).x-this.x,i=t.y-this.y;return Math.sqrt(e*e+i*i)},equals:function(t){return(t=z(t)).x===this.x&&t.y===this.y},contains:function(t){return t=z(t),Math.abs(t.x)<=Math.abs(this.x)&&Math.abs(t.y)<=Math.abs(this.y)},toString:function(){return"Point("+d(this.x)+", "+d(this.y)+")"}},R.prototype={extend:function(t){return t=z(t),this.min||this.max?(this.min.x=Math.min(t.x,this.min.x),this.max.x=Math.max(t.x,this.max.x),this.min.y=Math.min(t.y,this.min.y),this.max.y=Math.max(t.y,this.max.y)):(this.min=t.clone(),this.max=t.clone()),this},getCenter:function(t){return new O((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,t)},getBottomLeft:function(){return new O(this.min.x,this.max.y)},getTopRight:function(){return new O(this.max.x,this.min.y)},getTopLeft:function(){return this.min},getBottomRight:function(){return this.max},getSize:function(){return this.max.subtract(this.min)},contains:function(t){var e,i;return(t="number"==typeof t[0]||t instanceof O?z(t):N(t))instanceof R?(e=t.min,i=t.max):e=i=t,e.x>=this.min.x&&i.x<=this.max.x&&e.y>=this.min.y&&i.y<=this.max.y},intersects:function(t){t=N(t);var e=this.min,i=this.max,n=t.min,o=t.max,s=o.x>=e.x&&n.x<=i.x,r=o.y>=e.y&&n.y<=i.y;return s&&r},overlaps:function(t){t=N(t);var e=this.min,i=this.max,n=t.min,o=t.max,s=o.x>e.x&&n.x<i.x,r=o.y>e.y&&n.y<i.y;return s&&r},isValid:function(){return!(!this.min||!this.max)}},j.prototype={extend:function(t){var e,i,n=this._southWest,o=this._northEast;if(t instanceof F)e=t,i=t;else{if(!(t instanceof j))return t?this.extend(q(t)||B(t)):this;if(e=t._southWest,i=t._northEast,!e||!i)return this}return n||o?(n.lat=Math.min(e.lat,n.lat),n.lng=Math.min(e.lng,n.lng),o.lat=Math.max(i.lat,o.lat),o.lng=Math.max(i.lng,o.lng)):(this._southWest=new F(e.lat,e.lng),this._northEast=new F(i.lat,i.lng)),this},pad:function(t){var e=this._southWest,i=this._northEast,n=Math.abs(e.lat-i.lat)*t,o=Math.abs(e.lng-i.lng)*t;return new j(new F(e.lat-n,e.lng-o),new F(i.lat+n,i.lng+o))},getCenter:function(){return new F((this._southWest.lat+this._northEast.lat)/2,(this._southWest.lng+this._northEast.lng)/2)},getSouthWest:function(){return this._southWest},getNorthEast:function(){return this._northEast},getNorthWest:function(){return new F(this.getNorth(),this.getWest())},getSouthEast:function(){return new F(this.getSouth(),this.getEast())},getWest:function(){return this._southWest.lng},getSouth:function(){return this._southWest.lat},getEast:function(){return this._northEast.lng},getNorth:function(){return this._northEast.lat},contains:function(t){t="number"==typeof t[0]||t instanceof F||"lat"in t?q(t):B(t);var e,i,n=this._southWest,o=this._northEast;return t instanceof j?(e=t.getSouthWest(),i=t.getNorthEast()):e=i=t,e.lat>=n.lat&&i.lat<=o.lat&&e.lng>=n.lng&&i.lng<=o.lng},intersects:function(t){t=B(t);var e=this._southWest,i=this._northEast,n=t.getSouthWest(),o=t.getNorthEast(),s=o.lat>=e.lat&&n.lat<=i.lat,r=o.lng>=e.lng&&n.lng<=i.lng;return s&&r},overlaps:function(t){t=B(t);var e=this._southWest,i=this._northEast,n=t.getSouthWest(),o=t.getNorthEast(),s=o.lat>e.lat&&n.lat<i.lat,r=o.lng>e.lng&&n.lng<i.lng;return s&&r},toBBoxString:function(){return[this.getWest(),this.getSouth(),this.getEast(),this.getNorth()].join(",")},equals:function(t,e){return!!t&&(t=B(t),this._southWest.equals(t.getSouthWest(),e)&&this._northEast.equals(t.getNorthEast(),e))},isValid:function(){return!(!this._southWest||!this._northEast)}},F.prototype={equals:function(t,e){return!!t&&(t=q(t),Math.max(Math.abs(this.lat-t.lat),Math.abs(this.lng-t.lng))<=(void 0===e?1e-9:e))},toString:function(t){return"LatLng("+d(this.lat,t)+", "+d(this.lng,t)+")"},distanceTo:function(t){return H.distance(this,q(t))},wrap:function(){return H.wrapLatLng(this)},toBounds:function(t){var e=180*t/40075017,i=e/Math.cos(Math.PI/180*this.lat);return B([this.lat-e,this.lng-i],[this.lat+e,this.lng+i])},clone:function(){return new F(this.lat,this.lng,this.alt)}};var V={latLngToPoint:function(t,e){var i=this.projection.project(t),n=this.scale(e);return this.transformation._transform(i,n)},pointToLatLng:function(t,e){var i=this.scale(e),n=this.transformation.untransform(t,i);return this.projection.unproject(n)},project:function(t){return this.projection.project(t)},unproject:function(t){return this.projection.unproject(t)},scale:function(t){return 256*Math.pow(2,t)},zoom:function(t){return Math.log(t/256)/Math.LN2},getProjectedBounds:function(t){if(this.infinite)return null;var e=this.projection.bounds,i=this.scale(t);return new R(this.transformation.transform(e.min,i),this.transformation.transform(e.max,i))},infinite:!1,wrapLatLng:function(t){var e=this.wrapLng?c(t.lng,this.wrapLng,!0):t.lng;return new F(this.wrapLat?c(t.lat,this.wrapLat,!0):t.lat,e,t.alt)},wrapLatLngBounds:function(t){var e=t.getCenter(),i=this.wrapLatLng(e),n=e.lat-i.lat,o=e.lng-i.lng;if(0===n&&0===o)return t;var s=t.getSouthWest(),r=t.getNorthEast();return new j(new F(s.lat-n,s.lng-o),new F(r.lat-n,r.lng-o))}},H=n({},V,{wrapLng:[-180,180],R:6371e3,distance:function(t,e){var i=Math.PI/180,n=t.lat*i,o=e.lat*i,s=Math.sin((e.lat-t.lat)*i/2),r=Math.sin((e.lng-t.lng)*i/2),a=s*s+Math.cos(n)*Math.cos(o)*r*r,l=2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a));return this.R*l}}),U=6378137,W={R:U,MAX_LATITUDE:85.0511287798,project:function(t){var e=Math.PI/180,i=this.MAX_LATITUDE,n=Math.max(Math.min(i,t.lat),-i),o=Math.sin(n*e);return new O(this.R*t.lng*e,this.R*Math.log((1+o)/(1-o))/2)},unproject:function(t){var e=180/Math.PI;return new F((2*Math.atan(Math.exp(t.y/this.R))-Math.PI/2)*e,t.x*e/this.R)},bounds:function(){var t=U*Math.PI;return new R([-t,-t],[t,t])}()};function G(t,e,i,n){if(y(t))return this._a=t[0],this._b=t[1],this._c=t[2],void(this._d=t[3]);this._a=t,this._b=e,this._c=i,this._d=n}function Z(t,e,i,n){return new G(t,e,i,n)}G.prototype={transform:function(t,e){return this._transform(t.clone(),e)},_transform:function(t,e){return e=e||1,t.x=e*(this._a*t.x+this._b),t.y=e*(this._c*t.y+this._d),t},untransform:function(t,e){return e=e||1,new O((t.x/e-this._b)/this._a,(t.y/e-this._d)/this._c)}};var Y=n({},H,{code:"EPSG:3857",projection:W,transformation:function(){var t=.5/(Math.PI*W.R);return Z(t,.5,-t,.5)}()}),X=n({},Y,{code:"EPSG:900913"});function K(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function Q(t,e){var i,n,o,s,r,a,l="";for(i=0,o=t.length;i<o;i++){for(n=0,s=(r=t[i]).length;n<s;n++)l+=(n?"L":"M")+(a=r[n]).x+" "+a.y;l+=e?Tt?"z":"x":""}return l||"M0 0"}var J=document.documentElement.style,tt="ActiveXObject"in window,et=tt&&!document.addEventListener,it="msLaunchUri"in navigator&&!("documentMode"in document),nt=Dt("webkit"),ot=Dt("android"),st=Dt("android 2")||Dt("android 3"),rt=parseInt(/WebKit\/([0-9]+)|$/.exec(navigator.userAgent)[1],10),at=ot&&Dt("Google")&&rt<537&&!("AudioNode"in window),lt=!!window.opera,ct=Dt("chrome"),ht=Dt("gecko")&&!nt&&!lt&&!tt,dt=!ct&&Dt("safari"),ut=Dt("phantom"),pt="OTransition"in J,mt=0===navigator.platform.indexOf("Win"),gt=tt&&"transition"in J,ft="WebKitCSSMatrix"in window&&"m11"in new window.WebKitCSSMatrix&&!st,vt="MozPerspective"in J,yt=!window.L_DISABLE_3D&&(gt||ft||vt)&&!pt&&!ut,bt="undefined"!=typeof orientation||Dt("mobile"),xt=bt&&nt,_t=bt&&ft,wt=!window.PointerEvent&&window.MSPointerEvent,kt=!(!window.PointerEvent&&!wt),Ct=!window.L_NO_TOUCH&&(kt||"ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch),St=bt&<,Et=bt&&ht,At=(window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI)>1,Mt=!!document.createElement("canvas").getContext,Tt=!(!document.createElementNS||!K("svg").createSVGRect),Pt=!Tt&&function(){try{var t=document.createElement("div");t.innerHTML='<v:shape adj="1"/>';var e=t.firstChild;return e.style.behavior="url(#default#VML)",e&&"object"==typeof e.adj}catch(t){return!1}}();function Dt(t){return navigator.userAgent.toLowerCase().indexOf(t)>=0}var It=(Object.freeze||Object)({ie:tt,ielt9:et,edge:it,webkit:nt,android:ot,android23:st,androidStock:at,opera:lt,chrome:ct,gecko:ht,safari:dt,phantom:ut,opera12:pt,win:mt,ie3d:gt,webkit3d:ft,gecko3d:vt,any3d:yt,mobile:bt,mobileWebkit:xt,mobileWebkit3d:_t,msPointer:wt,pointer:kt,touch:Ct,mobileOpera:St,mobileGecko:Et,retina:At,canvas:Mt,svg:Tt,vml:Pt}),Ot=wt?"MSPointerDown":"pointerdown",$t=wt?"MSPointerMove":"pointermove",Lt=wt?"MSPointerUp":"pointerup",zt=wt?"MSPointerCancel":"pointercancel",Rt=["INPUT","SELECT","OPTION"],Nt={},jt=!1,Bt=0;function Ft(t,e,i,n){return"touchstart"===e?Vt(t,i,n):"touchmove"===e?Zt(t,i,n):"touchend"===e&&Yt(t,i,n),this}function qt(t,e,i){var n=t["_leaflet_"+e+i];return"touchstart"===e?t.removeEventListener(Ot,n,!1):"touchmove"===e?t.removeEventListener($t,n,!1):"touchend"===e&&(t.removeEventListener(Lt,n,!1),t.removeEventListener(zt,n,!1)),this}function Vt(t,e,i){var n=s((function(t){if("mouse"!==t.pointerType&&t.MSPOINTER_TYPE_MOUSE&&t.pointerType!==t.MSPOINTER_TYPE_MOUSE){if(!(Rt.indexOf(t.target.tagName)<0))return;Ve(t)}Gt(t,e)}));t["_leaflet_touchstart"+i]=n,t.addEventListener(Ot,n,!1),jt||(document.documentElement.addEventListener(Ot,Ht,!0),document.documentElement.addEventListener($t,Ut,!0),document.documentElement.addEventListener(Lt,Wt,!0),document.documentElement.addEventListener(zt,Wt,!0),jt=!0)}function Ht(t){Nt[t.pointerId]=t,Bt++}function Ut(t){Nt[t.pointerId]&&(Nt[t.pointerId]=t)}function Wt(t){delete Nt[t.pointerId],Bt--}function Gt(t,e){for(var i in t.touches=[],Nt)t.touches.push(Nt[i]);t.changedTouches=[t],e(t)}function Zt(t,e,i){var n=function(t){(t.pointerType!==t.MSPOINTER_TYPE_MOUSE&&"mouse"!==t.pointerType||0!==t.buttons)&&Gt(t,e)};t["_leaflet_touchmove"+i]=n,t.addEventListener($t,n,!1)}function Yt(t,e,i){var n=function(t){Gt(t,e)};t["_leaflet_touchend"+i]=n,t.addEventListener(Lt,n,!1),t.addEventListener(zt,n,!1)}var Xt=wt?"MSPointerDown":kt?"pointerdown":"touchstart",Kt=wt?"MSPointerUp":kt?"pointerup":"touchend",Qt="_leaflet_";function Jt(t,e,i){var n,o,s=!1,r=250;function a(t){var e;if(kt){if(!it||"mouse"===t.pointerType)return;e=Bt}else e=t.touches.length;if(!(e>1)){var i=Date.now(),a=i-(n||i);o=t.touches?t.touches[0]:t,s=a>0&&a<=r,n=i}}function l(t){if(s&&!o.cancelBubble){if(kt){if(!it||"mouse"===t.pointerType)return;var i,r,a={};for(r in o)i=o[r],a[r]=i&&i.bind?i.bind(o):i;o=a}o.type="dblclick",o.button=0,e(o),n=null}}return t[Qt+Xt+i]=a,t[Qt+Kt+i]=l,t[Qt+"dblclick"+i]=e,t.addEventListener(Xt,a,!1),t.addEventListener(Kt,l,!1),t.addEventListener("dblclick",e,!1),this}function te(t,e){var i=t[Qt+Xt+e],n=t[Qt+Kt+e],o=t[Qt+"dblclick"+e];return t.removeEventListener(Xt,i,!1),t.removeEventListener(Kt,n,!1),it||t.removeEventListener("dblclick",o,!1),this}var ee,ie,ne,oe,se,re=ke(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),ae=ke(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),le="webkitTransition"===ae||"OTransition"===ae?ae+"End":"transitionend";function ce(t){return"string"==typeof t?document.getElementById(t):t}function he(t,e){var i=t.style[e]||t.currentStyle&&t.currentStyle[e];if((!i||"auto"===i)&&document.defaultView){var n=document.defaultView.getComputedStyle(t,null);i=n?n[e]:null}return"auto"===i?null:i}function de(t,e,i){var n=document.createElement(t);return n.className=e||"",i&&i.appendChild(n),n}function ue(t){var e=t.parentNode;e&&e.removeChild(t)}function pe(t){for(;t.firstChild;)t.removeChild(t.firstChild)}function me(t){var e=t.parentNode;e&&e.lastChild!==t&&e.appendChild(t)}function ge(t){var e=t.parentNode;e&&e.firstChild!==t&&e.insertBefore(t,e.firstChild)}function fe(t,e){if(void 0!==t.classList)return t.classList.contains(e);var i=xe(t);return i.length>0&&new RegExp("(^|\\s)"+e+"(\\s|$)").test(i)}function ve(t,e){if(void 0!==t.classList)for(var i=p(e),n=0,o=i.length;n<o;n++)t.classList.add(i[n]);else if(!fe(t,e)){var s=xe(t);be(t,(s?s+" ":"")+e)}}function ye(t,e){void 0!==t.classList?t.classList.remove(e):be(t,u((" "+xe(t)+" ").replace(" "+e+" "," ")))}function be(t,e){void 0===t.className.baseVal?t.className=e:t.className.baseVal=e}function xe(t){return t.correspondingElement&&(t=t.correspondingElement),void 0===t.className.baseVal?t.className:t.className.baseVal}function _e(t,e){"opacity"in t.style?t.style.opacity=e:"filter"in t.style&&we(t,e)}function we(t,e){var i=!1,n="DXImageTransform.Microsoft.Alpha";try{i=t.filters.item(n)}catch(t){if(1===e)return}e=Math.round(100*e),i?(i.Enabled=100!==e,i.Opacity=e):t.style.filter+=" progid:"+n+"(opacity="+e+")"}function ke(t){for(var e=document.documentElement.style,i=0;i<t.length;i++)if(t[i]in e)return t[i];return!1}function Ce(t,e,i){var n=e||new O(0,0);t.style[re]=(gt?"translate("+n.x+"px,"+n.y+"px)":"translate3d("+n.x+"px,"+n.y+"px,0)")+(i?" scale("+i+")":"")}function Se(t,e){t._leaflet_pos=e,yt?Ce(t,e):(t.style.left=e.x+"px",t.style.top=e.y+"px")}function Ee(t){return t._leaflet_pos||new O(0,0)}if("onselectstart"in document)ee=function(){Le(window,"selectstart",Ve)},ie=function(){Re(window,"selectstart",Ve)};else{var Ae=ke(["userSelect","WebkitUserSelect","OUserSelect","MozUserSelect","msUserSelect"]);ee=function(){if(Ae){var t=document.documentElement.style;ne=t[Ae],t[Ae]="none"}},ie=function(){Ae&&(document.documentElement.style[Ae]=ne,ne=void 0)}}function Me(){Le(window,"dragstart",Ve)}function Te(){Re(window,"dragstart",Ve)}function Pe(t){for(;-1===t.tabIndex;)t=t.parentNode;t.style&&(De(),oe=t,se=t.style.outline,t.style.outline="none",Le(window,"keydown",De))}function De(){oe&&(oe.style.outline=se,oe=void 0,se=void 0,Re(window,"keydown",De))}function Ie(t){do{t=t.parentNode}while(!(t.offsetWidth&&t.offsetHeight||t===document.body));return t}function Oe(t){var e=t.getBoundingClientRect();return{x:e.width/t.offsetWidth||1,y:e.height/t.offsetHeight||1,boundingClientRect:e}}var $e=(Object.freeze||Object)({TRANSFORM:re,TRANSITION:ae,TRANSITION_END:le,get:ce,getStyle:he,create:de,remove:ue,empty:pe,toFront:me,toBack:ge,hasClass:fe,addClass:ve,removeClass:ye,setClass:be,getClass:xe,setOpacity:_e,testProp:ke,setTransform:Ce,setPosition:Se,getPosition:Ee,disableTextSelection:ee,enableTextSelection:ie,disableImageDrag:Me,enableImageDrag:Te,preventOutline:Pe,restoreOutline:De,getSizedParentNode:Ie,getScale:Oe});function Le(t,e,i,n){if("object"==typeof e)for(var o in e)Ne(t,o,e[o],i);else for(var s=0,r=(e=p(e)).length;s<r;s++)Ne(t,e[s],i,n);return this}var ze="_leaflet_events";function Re(t,e,i,n){if("object"==typeof e)for(var o in e)je(t,o,e[o],i);else if(e)for(var s=0,r=(e=p(e)).length;s<r;s++)je(t,e[s],i,n);else{for(var a in t[ze])je(t,a,t[ze][a]);delete t[ze]}return this}function Ne(t,e,i,n){var o=e+a(i)+(n?"_"+a(n):"");if(t[ze]&&t[ze][o])return this;var s=function(e){return i.call(n||t,e||window.event)},r=s;kt&&0===e.indexOf("touch")?Ft(t,e,s,o):!Ct||"dblclick"!==e||!Jt||kt&&ct?"addEventListener"in t?"mousewheel"===e?t.addEventListener("onwheel"in t?"wheel":"mousewheel",s,!1):"mouseenter"===e||"mouseleave"===e?(s=function(e){e=e||window.event,Qe(t,e)&&r(e)},t.addEventListener("mouseenter"===e?"mouseover":"mouseout",s,!1)):("click"===e&&ot&&(s=function(t){Je(t,r)}),t.addEventListener(e,s,!1)):"attachEvent"in t&&t.attachEvent("on"+e,s):Jt(t,s,o),t[ze]=t[ze]||{},t[ze][o]=s}function je(t,e,i,n){var o=e+a(i)+(n?"_"+a(n):""),s=t[ze]&&t[ze][o];if(!s)return this;kt&&0===e.indexOf("touch")?qt(t,e,o):!Ct||"dblclick"!==e||!te||kt&&ct?"removeEventListener"in t?"mousewheel"===e?t.removeEventListener("onwheel"in t?"wheel":"mousewheel",s,!1):t.removeEventListener("mouseenter"===e?"mouseover":"mouseleave"===e?"mouseout":e,s,!1):"detachEvent"in t&&t.detachEvent("on"+e,s):te(t,o),t[ze][o]=null}function Be(t){return t.stopPropagation?t.stopPropagation():t.originalEvent?t.originalEvent._stopped=!0:t.cancelBubble=!0,Ke(t),this}function Fe(t){return Ne(t,"mousewheel",Be),this}function qe(t){return Le(t,"mousedown touchstart dblclick",Be),Ne(t,"click",Xe),this}function Ve(t){return t.preventDefault?t.preventDefault():t.returnValue=!1,this}function He(t){return Ve(t),Be(t),this}function Ue(t,e){if(!e)return new O(t.clientX,t.clientY);var i=Oe(e),n=i.boundingClientRect;return new O((t.clientX-n.left)/i.x-e.clientLeft,(t.clientY-n.top)/i.y-e.clientTop)}var We=mt&&ct?2*window.devicePixelRatio:ht?window.devicePixelRatio:1;function Ge(t){return it?t.wheelDeltaY/2:t.deltaY&&0===t.deltaMode?-t.deltaY/We:t.deltaY&&1===t.deltaMode?20*-t.deltaY:t.deltaY&&2===t.deltaMode?60*-t.deltaY:t.deltaX||t.deltaZ?0:t.wheelDelta?(t.wheelDeltaY||t.wheelDelta)/2:t.detail&&Math.abs(t.detail)<32765?20*-t.detail:t.detail?t.detail/-32765*60:0}var Ze,Ye={};function Xe(t){Ye[t.type]=!0}function Ke(t){var e=Ye[t.type];return Ye[t.type]=!1,e}function Qe(t,e){var i=e.relatedTarget;if(!i)return!0;try{for(;i&&i!==t;)i=i.parentNode}catch(t){return!1}return i!==t}function Je(t,e){var i=t.timeStamp||t.originalEvent&&t.originalEvent.timeStamp,n=Ze&&i-Ze;n&&n>100&&n<500||t.target._simulatedClick&&!t._simulated?He(t):(Ze=i,e(t))}var ti=(Object.freeze||Object)({on:Le,off:Re,stopPropagation:Be,disableScrollPropagation:Fe,disableClickPropagation:qe,preventDefault:Ve,stop:He,getMousePosition:Ue,getWheelDelta:Ge,fakeStop:Xe,skipped:Ke,isExternalTarget:Qe,addListener:Le,removeListener:Re}),ei=I.extend({run:function(t,e,i,n){this.stop(),this._el=t,this._inProgress=!0,this._duration=i||.25,this._easeOutPower=1/Math.max(n||.5,.2),this._startPos=Ee(t),this._offset=e.subtract(this._startPos),this._startTime=+new Date,this.fire("start"),this._animate()},stop:function(){this._inProgress&&(this._step(!0),this._complete())},_animate:function(){this._animId=E(this._animate,this),this._step()},_step:function(t){var e=+new Date-this._startTime,i=1e3*this._duration;e<i?this._runFrame(this._easeOut(e/i),t):(this._runFrame(1),this._complete())},_runFrame:function(t,e){var i=this._startPos.add(this._offset.multiplyBy(t));e&&i._round(),Se(this._el,i),this.fire("step")},_complete:function(){A(this._animId),this._inProgress=!1,this.fire("end")},_easeOut:function(t){return 1-Math.pow(1-t,this._easeOutPower)}}),ii=I.extend({options:{crs:Y,center:void 0,zoom:void 0,minZoom:void 0,maxZoom:void 0,layers:[],maxBounds:void 0,renderer:void 0,zoomAnimation:!0,zoomAnimationThreshold:4,fadeAnimation:!0,markerZoomAnimation:!0,transform3DLimit:8388608,zoomSnap:1,zoomDelta:1,trackResize:!0},initialize:function(t,e){e=m(this,e),this._handlers=[],this._layers={},this._zoomBoundLayers={},this._sizeChanged=!0,this._initContainer(t),this._initLayout(),this._onResize=s(this._onResize,this),this._initEvents(),e.maxBounds&&this.setMaxBounds(e.maxBounds),void 0!==e.zoom&&(this._zoom=this._limitZoom(e.zoom)),e.center&&void 0!==e.zoom&&this.setView(q(e.center),e.zoom,{reset:!0}),this.callInitHooks(),this._zoomAnimated=ae&&yt&&!St&&this.options.zoomAnimation,this._zoomAnimated&&(this._createAnimProxy(),Le(this._proxy,le,this._catchTransitionEnd,this)),this._addLayers(this.options.layers)},setView:function(t,e,i){return e=void 0===e?this._zoom:this._limitZoom(e),t=this._limitCenter(q(t),e,this.options.maxBounds),i=i||{},this._stop(),this._loaded&&!i.reset&&!0!==i&&(void 0!==i.animate&&(i.zoom=n({animate:i.animate},i.zoom),i.pan=n({animate:i.animate,duration:i.duration},i.pan)),this._zoom!==e?this._tryAnimatedZoom&&this._tryAnimatedZoom(t,e,i.zoom):this._tryAnimatedPan(t,i.pan))?(clearTimeout(this._sizeTimer),this):(this._resetView(t,e),this)},setZoom:function(t,e){return this._loaded?this.setView(this.getCenter(),t,{zoom:e}):(this._zoom=t,this)},zoomIn:function(t,e){return t=t||(yt?this.options.zoomDelta:1),this.setZoom(this._zoom+t,e)},zoomOut:function(t,e){return t=t||(yt?this.options.zoomDelta:1),this.setZoom(this._zoom-t,e)},setZoomAround:function(t,e,i){var n=this.getZoomScale(e),o=this.getSize().divideBy(2),s=(t instanceof O?t:this.latLngToContainerPoint(t)).subtract(o).multiplyBy(1-1/n),r=this.containerPointToLatLng(o.add(s));return this.setView(r,e,{zoom:i})},_getBoundsCenterZoom:function(t,e){e=e||{},t=t.getBounds?t.getBounds():B(t);var i=z(e.paddingTopLeft||e.padding||[0,0]),n=z(e.paddingBottomRight||e.padding||[0,0]),o=this.getBoundsZoom(t,!1,i.add(n));if((o="number"==typeof e.maxZoom?Math.min(e.maxZoom,o):o)===1/0)return{center:t.getCenter(),zoom:o};var s=n.subtract(i).divideBy(2),r=this.project(t.getSouthWest(),o),a=this.project(t.getNorthEast(),o);return{center:this.unproject(r.add(a).divideBy(2).add(s),o),zoom:o}},fitBounds:function(t,e){if(!(t=B(t)).isValid())throw new Error("Bounds are not valid.");var i=this._getBoundsCenterZoom(t,e);return this.setView(i.center,i.zoom,e)},fitWorld:function(t){return this.fitBounds([[-90,-180],[90,180]],t)},panTo:function(t,e){return this.setView(t,this._zoom,{pan:e})},panBy:function(t,e){if(e=e||{},!(t=z(t).round()).x&&!t.y)return this.fire("moveend");if(!0!==e.animate&&!this.getSize().contains(t))return this._resetView(this.unproject(this.project(this.getCenter()).add(t)),this.getZoom()),this;if(this._panAnim||(this._panAnim=new ei,this._panAnim.on({step:this._onPanTransitionStep,end:this._onPanTransitionEnd},this)),e.noMoveStart||this.fire("movestart"),!1!==e.animate){ve(this._mapPane,"leaflet-pan-anim");var i=this._getMapPanePos().subtract(t).round();this._panAnim.run(this._mapPane,i,e.duration||.25,e.easeLinearity)}else this._rawPanBy(t),this.fire("move").fire("moveend");return this},flyTo:function(t,e,i){if(!1===(i=i||{}).animate||!yt)return this.setView(t,e,i);this._stop();var n=this.project(this.getCenter()),o=this.project(t),s=this.getSize(),r=this._zoom;t=q(t),e=void 0===e?r:e;var a=Math.max(s.x,s.y),l=a*this.getZoomScale(r,e),c=o.distanceTo(n)||1,h=1.42,d=h*h;function u(t){var e=(l*l-a*a+(t?-1:1)*d*d*c*c)/(2*(t?l:a)*d*c),i=Math.sqrt(e*e+1)-e;return i<1e-9?-18:Math.log(i)}function p(t){return(Math.exp(t)-Math.exp(-t))/2}function m(t){return(Math.exp(t)+Math.exp(-t))/2}function g(t){return p(t)/m(t)}var f=u(0);function v(t){return a*(m(f)/m(f+h*t))}function y(t){return a*(m(f)*g(f+h*t)-p(f))/d}function b(t){return 1-Math.pow(1-t,1.5)}var x=Date.now(),_=(u(1)-f)/h,w=i.duration?1e3*i.duration:1e3*_*.8;function k(){var i=(Date.now()-x)/w,s=b(i)*_;i<=1?(this._flyToFrame=E(k,this),this._move(this.unproject(n.add(o.subtract(n).multiplyBy(y(s)/c)),r),this.getScaleZoom(a/v(s),r),{flyTo:!0})):this._move(t,e)._moveEnd(!0)}return this._moveStart(!0,i.noMoveStart),k.call(this),this},flyToBounds:function(t,e){var i=this._getBoundsCenterZoom(t,e);return this.flyTo(i.center,i.zoom,e)},setMaxBounds:function(t){return(t=B(t)).isValid()?(this.options.maxBounds&&this.off("moveend",this._panInsideMaxBounds),this.options.maxBounds=t,this._loaded&&this._panInsideMaxBounds(),this.on("moveend",this._panInsideMaxBounds)):(this.options.maxBounds=null,this.off("moveend",this._panInsideMaxBounds))},setMinZoom:function(t){var e=this.options.minZoom;return this.options.minZoom=t,this._loaded&&e!==t&&(this.fire("zoomlevelschange"),this.getZoom()<this.options.minZoom)?this.setZoom(t):this},setMaxZoom:function(t){var e=this.options.maxZoom;return this.options.maxZoom=t,this._loaded&&e!==t&&(this.fire("zoomlevelschange"),this.getZoom()>this.options.maxZoom)?this.setZoom(t):this},panInsideBounds:function(t,e){this._enforcingBounds=!0;var i=this.getCenter(),n=this._limitCenter(i,this._zoom,B(t));return i.equals(n)||this.panTo(n,e),this._enforcingBounds=!1,this},panInside:function(t,e){var i=z((e=e||{}).paddingTopLeft||e.padding||[0,0]),n=z(e.paddingBottomRight||e.padding||[0,0]),o=this.getCenter(),s=this.project(o),r=this.project(t),a=this.getPixelBounds(),l=a.getSize().divideBy(2),c=N([a.min.add(i),a.max.subtract(n)]);if(!c.contains(r)){this._enforcingBounds=!0;var h=s.subtract(r),d=z(r.x+h.x,r.y+h.y);(r.x<c.min.x||r.x>c.max.x)&&(d.x=s.x-h.x,h.x>0?d.x+=l.x-i.x:d.x-=l.x-n.x),(r.y<c.min.y||r.y>c.max.y)&&(d.y=s.y-h.y,h.y>0?d.y+=l.y-i.y:d.y-=l.y-n.y),this.panTo(this.unproject(d),e),this._enforcingBounds=!1}return this},invalidateSize:function(t){if(!this._loaded)return this;t=n({animate:!1,pan:!0},!0===t?{animate:!0}:t);var e=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var i=this.getSize(),o=e.divideBy(2).round(),r=i.divideBy(2).round(),a=o.subtract(r);return a.x||a.y?(t.animate&&t.pan?this.panBy(a):(t.pan&&this._rawPanBy(a),this.fire("move"),t.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(s(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:e,newSize:i})):this},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(t){if(t=this._locateOptions=n({timeout:1e4,watch:!1},t),!("geolocation"in navigator))return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var e=s(this._handleGeolocationResponse,this),i=s(this._handleGeolocationError,this);return t.watch?this._locationWatchId=navigator.geolocation.watchPosition(e,i,t):navigator.geolocation.getCurrentPosition(e,i,t),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(t){var e=t.code,i=t.message||(1===e?"permission denied":2===e?"position unavailable":"timeout");this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:e,message:"Geolocation error: "+i+"."})},_handleGeolocationResponse:function(t){var e=new F(t.coords.latitude,t.coords.longitude),i=e.toBounds(2*t.coords.accuracy),n=this._locateOptions;if(n.setView){var o=this.getBoundsZoom(i);this.setView(e,n.maxZoom?Math.min(o,n.maxZoom):o)}var s={latlng:e,bounds:i,timestamp:t.timestamp};for(var r in t.coords)"number"==typeof t.coords[r]&&(s[r]=t.coords[r]);this.fire("locationfound",s)},addHandler:function(t,e){if(!e)return this;var i=this[t]=new e(this);return this._handlers.push(i),this.options[t]&&i.enable(),this},remove:function(){if(this._initEvents(!0),this._containerId!==this._container._leaflet_id)throw new Error("Map container is being reused by another instance");try{delete this._container._leaflet_id,delete this._containerId}catch(t){this._container._leaflet_id=void 0,this._containerId=void 0}var t;for(t in void 0!==this._locationWatchId&&this.stopLocate(),this._stop(),ue(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(A(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload"),this._layers)this._layers[t].remove();for(t in this._panes)ue(this._panes[t]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(t,e){var i=de("div","leaflet-pane"+(t?" leaflet-"+t.replace("Pane","")+"-pane":""),e||this._mapPane);return t&&(this._panes[t]=i),i},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter:this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var t=this.getPixelBounds();return new j(this.unproject(t.getBottomLeft()),this.unproject(t.getTopRight()))},getMinZoom:function(){return void 0===this.options.minZoom?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return void 0===this.options.maxZoom?void 0===this._layersMaxZoom?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(t,e,i){t=B(t),i=z(i||[0,0]);var n=this.getZoom()||0,o=this.getMinZoom(),s=this.getMaxZoom(),r=t.getNorthWest(),a=t.getSouthEast(),l=this.getSize().subtract(i),c=N(this.project(a,n),this.project(r,n)).getSize(),h=yt?this.options.zoomSnap:1,d=l.x/c.x,u=l.y/c.y,p=e?Math.max(d,u):Math.min(d,u);return n=this.getScaleZoom(p,n),h&&(n=Math.round(n/(h/100))*(h/100),n=e?Math.ceil(n/h)*h:Math.floor(n/h)*h),Math.max(o,Math.min(s,n))},getSize:function(){return this._size&&!this._sizeChanged||(this._size=new O(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(t,e){var i=this._getTopLeftPoint(t,e);return new R(i,i.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(t){return this.options.crs.getProjectedBounds(void 0===t?this.getZoom():t)},getPane:function(t){return"string"==typeof t?this._panes[t]:t},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(t,e){var i=this.options.crs;return e=void 0===e?this._zoom:e,i.scale(t)/i.scale(e)},getScaleZoom:function(t,e){var i=this.options.crs;e=void 0===e?this._zoom:e;var n=i.zoom(t*i.scale(e));return isNaN(n)?1/0:n},project:function(t,e){return e=void 0===e?this._zoom:e,this.options.crs.latLngToPoint(q(t),e)},unproject:function(t,e){return e=void 0===e?this._zoom:e,this.options.crs.pointToLatLng(z(t),e)},layerPointToLatLng:function(t){var e=z(t).add(this.getPixelOrigin());return this.unproject(e)},latLngToLayerPoint:function(t){return this.project(q(t))._round()._subtract(this.getPixelOrigin())},wrapLatLng:function(t){return this.options.crs.wrapLatLng(q(t))},wrapLatLngBounds:function(t){return this.options.crs.wrapLatLngBounds(B(t))},distance:function(t,e){return this.options.crs.distance(q(t),q(e))},containerPointToLayerPoint:function(t){return z(t).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(t){return z(t).add(this._getMapPanePos())},containerPointToLatLng:function(t){var e=this.containerPointToLayerPoint(z(t));return this.layerPointToLatLng(e)},latLngToContainerPoint:function(t){return this.layerPointToContainerPoint(this.latLngToLayerPoint(q(t)))},mouseEventToContainerPoint:function(t){return Ue(t,this._container)},mouseEventToLayerPoint:function(t){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(t))},mouseEventToLatLng:function(t){return this.layerPointToLatLng(this.mouseEventToLayerPoint(t))},_initContainer:function(t){var e=this._container=ce(t);if(!e)throw new Error("Map container not found.");if(e._leaflet_id)throw new Error("Map container is already initialized.");Le(e,"scroll",this._onScroll,this),this._containerId=a(e)},_initLayout:function(){var t=this._container;this._fadeAnimated=this.options.fadeAnimation&&yt,ve(t,"leaflet-container"+(Ct?" leaflet-touch":"")+(At?" leaflet-retina":"")+(et?" leaflet-oldie":"")+(dt?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var e=he(t,"position");"absolute"!==e&&"relative"!==e&&"fixed"!==e&&(t.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var t=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),Se(this._mapPane,new O(0,0)),this.createPane("tilePane"),this.createPane("shadowPane"),this.createPane("overlayPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(ve(t.markerPane,"leaflet-zoom-hide"),ve(t.shadowPane,"leaflet-zoom-hide"))},_resetView:function(t,e){Se(this._mapPane,new O(0,0));var i=!this._loaded;this._loaded=!0,e=this._limitZoom(e),this.fire("viewprereset");var n=this._zoom!==e;this._moveStart(n,!1)._move(t,e)._moveEnd(n),this.fire("viewreset"),i&&this.fire("load")},_moveStart:function(t,e){return t&&this.fire("zoomstart"),e||this.fire("movestart"),this},_move:function(t,e,i){void 0===e&&(e=this._zoom);var n=this._zoom!==e;return this._zoom=e,this._lastCenter=t,this._pixelOrigin=this._getNewPixelOrigin(t),(n||i&&i.pinch)&&this.fire("zoom",i),this.fire("move",i)},_moveEnd:function(t){return t&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return A(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(t){Se(this._mapPane,this._getMapPanePos().subtract(t))},_getZoomSpan:function(){return this.getMaxZoom()-this.getMinZoom()},_panInsideMaxBounds:function(){this._enforcingBounds||this.panInsideBounds(this.options.maxBounds)},_checkIfLoaded:function(){if(!this._loaded)throw new Error("Set map center and zoom first.")},_initEvents:function(t){this._targets={},this._targets[a(this._container)]=this;var e=t?Re:Le;e(this._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",this._handleDOMEvent,this),this.options.trackResize&&e(window,"resize",this._onResize,this),yt&&this.options.transform3DLimit&&(t?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){A(this._resizeRequest),this._resizeRequest=E((function(){this.invalidateSize({debounceMoveend:!0})}),this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var t=this._getMapPanePos();Math.max(Math.abs(t.x),Math.abs(t.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(t,e){for(var i,n=[],o="mouseout"===e||"mouseover"===e,s=t.target||t.srcElement,r=!1;s;){if((i=this._targets[a(s)])&&("click"===e||"preclick"===e)&&!t._simulated&&this._draggableMoved(i)){r=!0;break}if(i&&i.listens(e,!0)){if(o&&!Qe(s,t))break;if(n.push(i),o)break}if(s===this._container)break;s=s.parentNode}return n.length||r||o||!Qe(s,t)||(n=[this]),n},_handleDOMEvent:function(t){if(this._loaded&&!Ke(t)){var e=t.type;"mousedown"!==e&&"keypress"!==e&&"keyup"!==e&&"keydown"!==e||Pe(t.target||t.srcElement),this._fireDOMEvent(t,e)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(t,e,i){if("click"===t.type){var o=n({},t);o.type="preclick",this._fireDOMEvent(o,o.type,i)}if(!t._stopped&&(i=(i||[]).concat(this._findEventTargets(t,e))).length){var s=i[0];"contextmenu"===e&&s.listens(e,!0)&&Ve(t);var r={originalEvent:t};if("keypress"!==t.type&&"keydown"!==t.type&&"keyup"!==t.type){var a=s.getLatLng&&(!s._radius||s._radius<=10);r.containerPoint=a?this.latLngToContainerPoint(s.getLatLng()):this.mouseEventToContainerPoint(t),r.layerPoint=this.containerPointToLayerPoint(r.containerPoint),r.latlng=a?s.getLatLng():this.layerPointToLatLng(r.layerPoint)}for(var l=0;l<i.length;l++)if(i[l].fire(e,r,!0),r.originalEvent._stopped||!1===i[l].options.bubblingMouseEvents&&-1!==b(this._mouseEvents,e))return}},_draggableMoved:function(t){return(t=t.dragging&&t.dragging.enabled()?t:this).dragging&&t.dragging.moved()||this.boxZoom&&this.boxZoom.moved()},_clearHandlers:function(){for(var t=0,e=this._handlers.length;t<e;t++)this._handlers[t].disable()},whenReady:function(t,e){return this._loaded?t.call(e||this,{target:this}):this.on("load",t,e),this},_getMapPanePos:function(){return Ee(this._mapPane)||new O(0,0)},_moved:function(){var t=this._getMapPanePos();return t&&!t.equals([0,0])},_getTopLeftPoint:function(t,e){return(t&&void 0!==e?this._getNewPixelOrigin(t,e):this.getPixelOrigin()).subtract(this._getMapPanePos())},_getNewPixelOrigin:function(t,e){var i=this.getSize()._divideBy(2);return this.project(t,e)._subtract(i)._add(this._getMapPanePos())._round()},_latLngToNewLayerPoint:function(t,e,i){var n=this._getNewPixelOrigin(i,e);return this.project(t,e)._subtract(n)},_latLngBoundsToNewLayerBounds:function(t,e,i){var n=this._getNewPixelOrigin(i,e);return N([this.project(t.getSouthWest(),e)._subtract(n),this.project(t.getNorthWest(),e)._subtract(n),this.project(t.getSouthEast(),e)._subtract(n),this.project(t.getNorthEast(),e)._subtract(n)])},_getCenterLayerPoint:function(){return this.containerPointToLayerPoint(this.getSize()._divideBy(2))},_getCenterOffset:function(t){return this.latLngToLayerPoint(t).subtract(this._getCenterLayerPoint())},_limitCenter:function(t,e,i){if(!i)return t;var n=this.project(t,e),o=this.getSize().divideBy(2),s=new R(n.subtract(o),n.add(o)),r=this._getBoundsOffset(s,i,e);return r.round().equals([0,0])?t:this.unproject(n.add(r),e)},_limitOffset:function(t,e){if(!e)return t;var i=this.getPixelBounds(),n=new R(i.min.add(t),i.max.add(t));return t.add(this._getBoundsOffset(n,e))},_getBoundsOffset:function(t,e,i){var n=N(this.project(e.getNorthEast(),i),this.project(e.getSouthWest(),i)),o=n.min.subtract(t.min),s=n.max.subtract(t.max);return new O(this._rebound(o.x,-s.x),this._rebound(o.y,-s.y))},_rebound:function(t,e){return t+e>0?Math.round(t-e)/2:Math.max(0,Math.ceil(t))-Math.max(0,Math.floor(e))},_limitZoom:function(t){var e=this.getMinZoom(),i=this.getMaxZoom(),n=yt?this.options.zoomSnap:1;return n&&(t=Math.round(t/n)*n),Math.max(e,Math.min(i,t))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){ye(this._mapPane,"leaflet-pan-anim"),this.fire("moveend")},_tryAnimatedPan:function(t,e){var i=this._getCenterOffset(t)._trunc();return!(!0!==(e&&e.animate)&&!this.getSize().contains(i)||(this.panBy(i,e),0))},_createAnimProxy:function(){var t=this._proxy=de("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(t),this.on("zoomanim",(function(t){var e=re,i=this._proxy.style[e];Ce(this._proxy,this.project(t.center,t.zoom),this.getZoomScale(t.zoom,1)),i===this._proxy.style[e]&&this._animatingZoom&&this._onZoomTransitionEnd()}),this),this.on("load moveend",(function(){var t=this.getCenter(),e=this.getZoom();Ce(this._proxy,this.project(t,e),this.getZoomScale(e,1))}),this),this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){ue(this._proxy),delete this._proxy},_catchTransitionEnd:function(t){this._animatingZoom&&t.propertyName.indexOf("transform")>=0&&this._onZoomTransitionEnd()},_nothingToAnimate:function(){return!this._container.getElementsByClassName("leaflet-zoom-animated").length},_tryAnimatedZoom:function(t,e,i){if(this._animatingZoom)return!0;if(i=i||{},!this._zoomAnimated||!1===i.animate||this._nothingToAnimate()||Math.abs(e-this._zoom)>this.options.zoomAnimationThreshold)return!1;var n=this.getZoomScale(e),o=this._getCenterOffset(t)._divideBy(1-1/n);return!(!0!==i.animate&&!this.getSize().contains(o)||(E((function(){this._moveStart(!0,!1)._animateZoom(t,e,!0)}),this),0))},_animateZoom:function(t,e,i,n){this._mapPane&&(i&&(this._animatingZoom=!0,this._animateToCenter=t,this._animateToZoom=e,ve(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:t,zoom:e,noUpdate:n}),setTimeout(s(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&ye(this._mapPane,"leaflet-zoom-anim"),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom),E((function(){this._moveEnd(!0)}),this))}});function ni(t,e){return new ii(t,e)}var oi=T.extend({options:{position:"topright"},initialize:function(t){m(this,t)},getPosition:function(){return this.options.position},setPosition:function(t){var e=this._map;return e&&e.removeControl(this),this.options.position=t,e&&e.addControl(this),this},getContainer:function(){return this._container},addTo:function(t){this.remove(),this._map=t;var e=this._container=this.onAdd(t),i=this.getPosition(),n=t._controlCorners[i];return ve(e,"leaflet-control"),-1!==i.indexOf("bottom")?n.insertBefore(e,n.firstChild):n.appendChild(e),this._map.on("unload",this.remove,this),this},remove:function(){return this._map?(ue(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null,this):this},_refocusOnMap:function(t){this._map&&t&&t.screenX>0&&t.screenY>0&&this._map.getContainer().focus()}}),si=function(t){return new oi(t)};ii.include({addControl:function(t){return t.addTo(this),this},removeControl:function(t){return t.remove(),this},_initControlPos:function(){var t=this._controlCorners={},e="leaflet-",i=this._controlContainer=de("div",e+"control-container",this._container);function n(n,o){var s=e+n+" "+e+o;t[n+o]=de("div",s,i)}n("top","left"),n("top","right"),n("bottom","left"),n("bottom","right")},_clearControlPos:function(){for(var t in this._controlCorners)ue(this._controlCorners[t]);ue(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var ri=oi.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(t,e,i,n){return i<n?-1:n<i?1:0}},initialize:function(t,e,i){for(var n in m(this,i),this._layerControlInputs=[],this._layers=[],this._lastZIndex=0,this._handlingClick=!1,t)this._addLayer(t[n],n);for(n in e)this._addLayer(e[n],n,!0)},onAdd:function(t){this._initLayout(),this._update(),this._map=t,t.on("zoomend",this._checkDisabledLayers,this);for(var e=0;e<this._layers.length;e++)this._layers[e].layer.on("add remove",this._onLayerChange,this);return this._container},addTo:function(t){return oi.prototype.addTo.call(this,t),this._expandIfNotCollapsed()},onRemove:function(){this._map.off("zoomend",this._checkDisabledLayers,this);for(var t=0;t<this._layers.length;t++)this._layers[t].layer.off("add remove",this._onLayerChange,this)},addBaseLayer:function(t,e){return this._addLayer(t,e),this._map?this._update():this},addOverlay:function(t,e){return this._addLayer(t,e,!0),this._map?this._update():this},removeLayer:function(t){t.off("add remove",this._onLayerChange,this);var e=this._getLayer(a(t));return e&&this._layers.splice(this._layers.indexOf(e),1),this._map?this._update():this},expand:function(){ve(this._container,"leaflet-control-layers-expanded"),this._section.style.height=null;var t=this._map.getSize().y-(this._container.offsetTop+50);return t<this._section.clientHeight?(ve(this._section,"leaflet-control-layers-scrollbar"),this._section.style.height=t+"px"):ye(this._section,"leaflet-control-layers-scrollbar"),this._checkDisabledLayers(),this},collapse:function(){return ye(this._container,"leaflet-control-layers-expanded"),this},_initLayout:function(){var t="leaflet-control-layers",e=this._container=de("div",t),i=this.options.collapsed;e.setAttribute("aria-haspopup",!0),qe(e),Fe(e);var n=this._section=de("section",t+"-list");i&&(this._map.on("click",this.collapse,this),ot||Le(e,{mouseenter:this.expand,mouseleave:this.collapse},this));var o=this._layersLink=de("a",t+"-toggle",e);o.href="#",o.title="Layers",Ct?(Le(o,"click",He),Le(o,"click",this.expand,this)):Le(o,"focus",this.expand,this),i||this.expand(),this._baseLayersList=de("div",t+"-base",n),this._separator=de("div",t+"-separator",n),this._overlaysList=de("div",t+"-overlays",n),e.appendChild(n)},_getLayer:function(t){for(var e=0;e<this._layers.length;e++)if(this._layers[e]&&a(this._layers[e].layer)===t)return this._layers[e]},_addLayer:function(t,e,i){this._map&&t.on("add remove",this._onLayerChange,this),this._layers.push({layer:t,name:e,overlay:i}),this.options.sortLayers&&this._layers.sort(s((function(t,e){return this.options.sortFunction(t.layer,e.layer,t.name,e.name)}),this)),this.options.autoZIndex&&t.setZIndex&&(this._lastZIndex++,t.setZIndex(this._lastZIndex)),this._expandIfNotCollapsed()},_update:function(){if(!this._container)return this;pe(this._baseLayersList),pe(this._overlaysList),this._layerControlInputs=[];var t,e,i,n,o=0;for(i=0;i<this._layers.length;i++)n=this._layers[i],this._addItem(n),e=e||n.overlay,t=t||!n.overlay,o+=n.overlay?0:1;return this.options.hideSingleBase&&(t=t&&o>1,this._baseLayersList.style.display=t?"":"none"),this._separator.style.display=e&&t?"":"none",this},_onLayerChange:function(t){this._handlingClick||this._update();var e=this._getLayer(a(t.target)),i=e.overlay?"add"===t.type?"overlayadd":"overlayremove":"add"===t.type?"baselayerchange":null;i&&this._map.fire(i,e)},_createRadioElement:function(t,e){var i='<input type="radio" class="leaflet-control-layers-selector" name="'+t+'"'+(e?' checked="checked"':"")+"/>",n=document.createElement("div");return n.innerHTML=i,n.firstChild},_addItem:function(t){var e,i=document.createElement("label"),n=this._map.hasLayer(t.layer);t.overlay?((e=document.createElement("input")).type="checkbox",e.className="leaflet-control-layers-selector",e.defaultChecked=n):e=this._createRadioElement("leaflet-base-layers_"+a(this),n),this._layerControlInputs.push(e),e.layerId=a(t.layer),Le(e,"click",this._onInputClick,this);var o=document.createElement("span");o.innerHTML=" "+t.name;var s=document.createElement("div");return i.appendChild(s),s.appendChild(e),s.appendChild(o),(t.overlay?this._overlaysList:this._baseLayersList).appendChild(i),this._checkDisabledLayers(),i},_onInputClick:function(){var t,e,i=this._layerControlInputs,n=[],o=[];this._handlingClick=!0;for(var s=i.length-1;s>=0;s--)t=i[s],e=this._getLayer(t.layerId).layer,t.checked?n.push(e):t.checked||o.push(e);for(s=0;s<o.length;s++)this._map.hasLayer(o[s])&&this._map.removeLayer(o[s]);for(s=0;s<n.length;s++)this._map.hasLayer(n[s])||this._map.addLayer(n[s]);this._handlingClick=!1,this._refocusOnMap()},_checkDisabledLayers:function(){for(var t,e,i=this._layerControlInputs,n=this._map.getZoom(),o=i.length-1;o>=0;o--)t=i[o],e=this._getLayer(t.layerId).layer,t.disabled=void 0!==e.options.minZoom&&n<e.options.minZoom||void 0!==e.options.maxZoom&&n>e.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expand:function(){return this.expand()},_collapse:function(){return this.collapse()}}),ai=function(t,e,i){return new ri(t,e,i)},li=oi.extend({options:{position:"topleft",zoomInText:"+",zoomInTitle:"Zoom in",zoomOutText:"−",zoomOutTitle:"Zoom out"},onAdd:function(t){var e="leaflet-control-zoom",i=de("div",e+" leaflet-bar"),n=this.options;return this._zoomInButton=this._createButton(n.zoomInText,n.zoomInTitle,e+"-in",i,this._zoomIn),this._zoomOutButton=this._createButton(n.zoomOutText,n.zoomOutTitle,e+"-out",i,this._zoomOut),this._updateDisabled(),t.on("zoomend zoomlevelschange",this._updateDisabled,this),i},onRemove:function(t){t.off("zoomend zoomlevelschange",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(t){!this._disabled&&this._map._zoom<this._map.getMaxZoom()&&this._map.zoomIn(this._map.options.zoomDelta*(t.shiftKey?3:1))},_zoomOut:function(t){!this._disabled&&this._map._zoom>this._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(t.shiftKey?3:1))},_createButton:function(t,e,i,n,o){var s=de("a",i,n);return s.innerHTML=t,s.href="#",s.title=e,s.setAttribute("role","button"),s.setAttribute("aria-label",e),qe(s),Le(s,"click",He),Le(s,"click",o,this),Le(s,"click",this._refocusOnMap,this),s},_updateDisabled:function(){var t=this._map,e="leaflet-disabled";ye(this._zoomInButton,e),ye(this._zoomOutButton,e),(this._disabled||t._zoom===t.getMinZoom())&&ve(this._zoomOutButton,e),(this._disabled||t._zoom===t.getMaxZoom())&&ve(this._zoomInButton,e)}});ii.mergeOptions({zoomControl:!0}),ii.addInitHook((function(){this.options.zoomControl&&(this.zoomControl=new li,this.addControl(this.zoomControl))}));var ci=function(t){return new li(t)},hi=oi.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(t){var e="leaflet-control-scale",i=de("div",e),n=this.options;return this._addScales(n,e+"-line",i),t.on(n.updateWhenIdle?"moveend":"move",this._update,this),t.whenReady(this._update,this),i},onRemove:function(t){t.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(t,e,i){t.metric&&(this._mScale=de("div",e,i)),t.imperial&&(this._iScale=de("div",e,i))},_update:function(){var t=this._map,e=t.getSize().y/2,i=t.distance(t.containerPointToLatLng([0,e]),t.containerPointToLatLng([this.options.maxWidth,e]));this._updateScales(i)},_updateScales:function(t){this.options.metric&&t&&this._updateMetric(t),this.options.imperial&&t&&this._updateImperial(t)},_updateMetric:function(t){var e=this._getRoundNum(t),i=e<1e3?e+" m":e/1e3+" km";this._updateScale(this._mScale,i,e/t)},_updateImperial:function(t){var e,i,n,o=3.2808399*t;o>5280?(e=o/5280,i=this._getRoundNum(e),this._updateScale(this._iScale,i+" mi",i/e)):(n=this._getRoundNum(o),this._updateScale(this._iScale,n+" ft",n/o))},_updateScale:function(t,e,i){t.style.width=Math.round(this.options.maxWidth*i)+"px",t.innerHTML=e},_getRoundNum:function(t){var e=Math.pow(10,(Math.floor(t)+"").length-1),i=t/e;return e*(i=i>=10?10:i>=5?5:i>=3?3:i>=2?2:1)}}),di=function(t){return new hi(t)},ui=oi.extend({options:{position:"bottomright",prefix:'<a href="https://leafletjs.com" title="A JS library for interactive maps">Leaflet</a>'},initialize:function(t){m(this,t),this._attributions={}},onAdd:function(t){for(var e in t.attributionControl=this,this._container=de("div","leaflet-control-attribution"),qe(this._container),t._layers)t._layers[e].getAttribution&&this.addAttribution(t._layers[e].getAttribution());return this._update(),this._container},setPrefix:function(t){return this.options.prefix=t,this._update(),this},addAttribution:function(t){return t?(this._attributions[t]||(this._attributions[t]=0),this._attributions[t]++,this._update(),this):this},removeAttribution:function(t){return t?(this._attributions[t]&&(this._attributions[t]--,this._update()),this):this},_update:function(){if(this._map){var t=[];for(var e in this._attributions)this._attributions[e]&&t.push(e);var i=[];this.options.prefix&&i.push(this.options.prefix),t.length&&i.push(t.join(", ")),this._container.innerHTML=i.join(" | ")}}});ii.mergeOptions({attributionControl:!0}),ii.addInitHook((function(){this.options.attributionControl&&(new ui).addTo(this)}));var pi=function(t){return new ui(t)};oi.Layers=ri,oi.Zoom=li,oi.Scale=hi,oi.Attribution=ui,si.layers=ai,si.zoom=ci,si.scale=di,si.attribution=pi;var mi=T.extend({initialize:function(t){this._map=t},enable:function(){return this._enabled||(this._enabled=!0,this.addHooks()),this},disable:function(){return this._enabled?(this._enabled=!1,this.removeHooks(),this):this},enabled:function(){return!!this._enabled}});mi.addTo=function(t,e){return t.addHandler(e,this),this};var gi,fi={Events:D},vi=Ct?"touchstart mousedown":"mousedown",yi={mousedown:"mouseup",touchstart:"touchend",pointerdown:"touchend",MSPointerDown:"touchend"},bi={mousedown:"mousemove",touchstart:"touchmove",pointerdown:"touchmove",MSPointerDown:"touchmove"},xi=I.extend({options:{clickTolerance:3},initialize:function(t,e,i,n){m(this,n),this._element=t,this._dragStartTarget=e||t,this._preventOutline=i},enable:function(){this._enabled||(Le(this._dragStartTarget,vi,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(xi._dragging===this&&this.finishDrag(),Re(this._dragStartTarget,vi,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(t){if(!t._simulated&&this._enabled&&(this._moved=!1,!fe(this._element,"leaflet-zoom-anim")&&!(xi._dragging||t.shiftKey||1!==t.which&&1!==t.button&&!t.touches||(xi._dragging=this,this._preventOutline&&Pe(this._element),Me(),ee(),this._moving)))){this.fire("down");var e=t.touches?t.touches[0]:t,i=Ie(this._element);this._startPoint=new O(e.clientX,e.clientY),this._parentScale=Oe(i),Le(document,bi[t.type],this._onMove,this),Le(document,yi[t.type],this._onUp,this)}},_onMove:function(t){if(!t._simulated&&this._enabled)if(t.touches&&t.touches.length>1)this._moved=!0;else{var e=t.touches&&1===t.touches.length?t.touches[0]:t,i=new O(e.clientX,e.clientY)._subtract(this._startPoint);(i.x||i.y)&&(Math.abs(i.x)+Math.abs(i.y)<this.options.clickTolerance||(i.x/=this._parentScale.x,i.y/=this._parentScale.y,Ve(t),this._moved||(this.fire("dragstart"),this._moved=!0,this._startPos=Ee(this._element).subtract(i),ve(document.body,"leaflet-dragging"),this._lastTarget=t.target||t.srcElement,window.SVGElementInstance&&this._lastTarget instanceof SVGElementInstance&&(this._lastTarget=this._lastTarget.correspondingUseElement),ve(this._lastTarget,"leaflet-drag-target")),this._newPos=this._startPos.add(i),this._moving=!0,A(this._animRequest),this._lastEvent=t,this._animRequest=E(this._updatePosition,this,!0)))}},_updatePosition:function(){var t={originalEvent:this._lastEvent};this.fire("predrag",t),Se(this._element,this._newPos),this.fire("drag",t)},_onUp:function(t){!t._simulated&&this._enabled&&this.finishDrag()},finishDrag:function(){for(var t in ye(document.body,"leaflet-dragging"),this._lastTarget&&(ye(this._lastTarget,"leaflet-drag-target"),this._lastTarget=null),bi)Re(document,bi[t],this._onMove,this),Re(document,yi[t],this._onUp,this);Te(),ie(),this._moved&&this._moving&&(A(this._animRequest),this.fire("dragend",{distance:this._newPos.distanceTo(this._startPos)})),this._moving=!1,xi._dragging=!1}});function _i(t,e){if(!e||!t.length)return t.slice();var i=e*e;return t=Ci(t=Ei(t,i),i)}function wi(t,e,i){return Math.sqrt(Di(t,e,i,!0))}function ki(t,e,i){return Di(t,e,i)}function Ci(t,e){var i=t.length,n=new(typeof Uint8Array!=void 0+""?Uint8Array:Array)(i);n[0]=n[i-1]=1,Si(t,n,e,0,i-1);var o,s=[];for(o=0;o<i;o++)n[o]&&s.push(t[o]);return s}function Si(t,e,i,n,o){var s,r,a,l=0;for(r=n+1;r<=o-1;r++)(a=Di(t[r],t[n],t[o],!0))>l&&(s=r,l=a);l>i&&(e[s]=1,Si(t,e,i,n,s),Si(t,e,i,s,o))}function Ei(t,e){for(var i=[t[0]],n=1,o=0,s=t.length;n<s;n++)Pi(t[n],t[o])>e&&(i.push(t[n]),o=n);return o<s-1&&i.push(t[s-1]),i}function Ai(t,e,i,n,o){var s,r,a,l=n?gi:Ti(t,i),c=Ti(e,i);for(gi=c;;){if(!(l|c))return[t,e];if(l&c)return!1;a=Ti(r=Mi(t,e,s=l||c,i,o),i),s===l?(t=r,l=a):(e=r,c=a)}}function Mi(t,e,i,n,o){var s,r,a=e.x-t.x,l=e.y-t.y,c=n.min,h=n.max;return 8&i?(s=t.x+a*(h.y-t.y)/l,r=h.y):4&i?(s=t.x+a*(c.y-t.y)/l,r=c.y):2&i?(s=h.x,r=t.y+l*(h.x-t.x)/a):1&i&&(s=c.x,r=t.y+l*(c.x-t.x)/a),new O(s,r,o)}function Ti(t,e){var i=0;return t.x<e.min.x?i|=1:t.x>e.max.x&&(i|=2),t.y<e.min.y?i|=4:t.y>e.max.y&&(i|=8),i}function Pi(t,e){var i=e.x-t.x,n=e.y-t.y;return i*i+n*n}function Di(t,e,i,n){var o,s=e.x,r=e.y,a=i.x-s,l=i.y-r,c=a*a+l*l;return c>0&&((o=((t.x-s)*a+(t.y-r)*l)/c)>1?(s=i.x,r=i.y):o>0&&(s+=a*o,r+=l*o)),a=t.x-s,l=t.y-r,n?a*a+l*l:new O(s,r)}function Ii(t){return!y(t[0])||"object"!=typeof t[0][0]&&void 0!==t[0][0]}function Oi(t){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),Ii(t)}var $i=(Object.freeze||Object)({simplify:_i,pointToSegmentDistance:wi,closestPointOnSegment:ki,clipSegment:Ai,_getEdgeIntersection:Mi,_getBitCode:Ti,_sqClosestPointOnSegment:Di,isFlat:Ii,_flat:Oi});function Li(t,e,i){var n,o,s,r,a,l,c,h,d,u=[1,4,2,8];for(o=0,c=t.length;o<c;o++)t[o]._code=Ti(t[o],e);for(r=0;r<4;r++){for(h=u[r],n=[],o=0,s=(c=t.length)-1;o<c;s=o++)a=t[o],l=t[s],a._code&h?l._code&h||((d=Mi(l,a,h,e,i))._code=Ti(d,e),n.push(d)):(l._code&h&&((d=Mi(l,a,h,e,i))._code=Ti(d,e),n.push(d)),n.push(a));t=n}return t}var zi=(Object.freeze||Object)({clipPolygon:Li}),Ri={project:function(t){return new O(t.lng,t.lat)},unproject:function(t){return new F(t.y,t.x)},bounds:new R([-180,-90],[180,90])},Ni={R:6378137,R_MINOR:6356752.314245179,bounds:new R([-20037508.34279,-15496570.73972],[20037508.34279,18764656.23138]),project:function(t){var e=Math.PI/180,i=this.R,n=t.lat*e,o=this.R_MINOR/i,s=Math.sqrt(1-o*o),r=s*Math.sin(n),a=Math.tan(Math.PI/4-n/2)/Math.pow((1-r)/(1+r),s/2);return n=-i*Math.log(Math.max(a,1e-10)),new O(t.lng*e*i,n)},unproject:function(t){for(var e,i=180/Math.PI,n=this.R,o=this.R_MINOR/n,s=Math.sqrt(1-o*o),r=Math.exp(-t.y/n),a=Math.PI/2-2*Math.atan(r),l=0,c=.1;l<15&&Math.abs(c)>1e-7;l++)e=s*Math.sin(a),e=Math.pow((1-e)/(1+e),s/2),a+=c=Math.PI/2-2*Math.atan(r*e)-a;return new F(a*i,t.x*i/n)}},ji=(Object.freeze||Object)({LonLat:Ri,Mercator:Ni,SphericalMercator:W}),Bi=n({},H,{code:"EPSG:3395",projection:Ni,transformation:function(){var t=.5/(Math.PI*Ni.R);return Z(t,.5,-t,.5)}()}),Fi=n({},H,{code:"EPSG:4326",projection:Ri,transformation:Z(1/180,1,-1/180,.5)}),qi=n({},V,{projection:Ri,transformation:Z(1,0,-1,0),scale:function(t){return Math.pow(2,t)},zoom:function(t){return Math.log(t)/Math.LN2},distance:function(t,e){var i=e.lng-t.lng,n=e.lat-t.lat;return Math.sqrt(i*i+n*n)},infinite:!0});V.Earth=H,V.EPSG3395=Bi,V.EPSG3857=Y,V.EPSG900913=X,V.EPSG4326=Fi,V.Simple=qi;var Vi=I.extend({options:{pane:"overlayPane",attribution:null,bubblingMouseEvents:!0},addTo:function(t){return t.addLayer(this),this},remove:function(){return this.removeFrom(this._map||this._mapToAdd)},removeFrom:function(t){return t&&t.removeLayer(this),this},getPane:function(t){return this._map.getPane(t?this.options[t]||t:this.options.pane)},addInteractiveTarget:function(t){return this._map._targets[a(t)]=this,this},removeInteractiveTarget:function(t){return delete this._map._targets[a(t)],this},getAttribution:function(){return this.options.attribution},_layerAdd:function(t){var e=t.target;if(e.hasLayer(this)){if(this._map=e,this._zoomAnimated=e._zoomAnimated,this.getEvents){var i=this.getEvents();e.on(i,this),this.once("remove",(function(){e.off(i,this)}),this)}this.onAdd(e),this.getAttribution&&e.attributionControl&&e.attributionControl.addAttribution(this.getAttribution()),this.fire("add"),e.fire("layeradd",{layer:this})}}});ii.include({addLayer:function(t){if(!t._layerAdd)throw new Error("The provided object is not a Layer.");var e=a(t);return this._layers[e]||(this._layers[e]=t,t._mapToAdd=this,t.beforeAdd&&t.beforeAdd(this),this.whenReady(t._layerAdd,t)),this},removeLayer:function(t){var e=a(t);return this._layers[e]?(this._loaded&&t.onRemove(this),t.getAttribution&&this.attributionControl&&this.attributionControl.removeAttribution(t.getAttribution()),delete this._layers[e],this._loaded&&(this.fire("layerremove",{layer:t}),t.fire("remove")),t._map=t._mapToAdd=null,this):this},hasLayer:function(t){return!!t&&a(t)in this._layers},eachLayer:function(t,e){for(var i in this._layers)t.call(e,this._layers[i]);return this},_addLayers:function(t){for(var e=0,i=(t=t?y(t)?t:[t]:[]).length;e<i;e++)this.addLayer(t[e])},_addZoomLimit:function(t){!isNaN(t.options.maxZoom)&&isNaN(t.options.minZoom)||(this._zoomBoundLayers[a(t)]=t,this._updateZoomLevels())},_removeZoomLimit:function(t){var e=a(t);this._zoomBoundLayers[e]&&(delete this._zoomBoundLayers[e],this._updateZoomLevels())},_updateZoomLevels:function(){var t=1/0,e=-1/0,i=this._getZoomSpan();for(var n in this._zoomBoundLayers){var o=this._zoomBoundLayers[n].options;t=void 0===o.minZoom?t:Math.min(t,o.minZoom),e=void 0===o.maxZoom?e:Math.max(e,o.maxZoom)}this._layersMaxZoom=e===-1/0?void 0:e,this._layersMinZoom=t===1/0?void 0:t,i!==this._getZoomSpan()&&this.fire("zoomlevelschange"),void 0===this.options.maxZoom&&this._layersMaxZoom&&this.getZoom()>this._layersMaxZoom&&this.setZoom(this._layersMaxZoom),void 0===this.options.minZoom&&this._layersMinZoom&&this.getZoom()<this._layersMinZoom&&this.setZoom(this._layersMinZoom)}});var Hi=Vi.extend({initialize:function(t,e){var i,n;if(m(this,e),this._layers={},t)for(i=0,n=t.length;i<n;i++)this.addLayer(t[i])},addLayer:function(t){var e=this.getLayerId(t);return this._layers[e]=t,this._map&&this._map.addLayer(t),this},removeLayer:function(t){var e=t in this._layers?t:this.getLayerId(t);return this._map&&this._layers[e]&&this._map.removeLayer(this._layers[e]),delete this._layers[e],this},hasLayer:function(t){return!!t&&(t in this._layers||this.getLayerId(t)in this._layers)},clearLayers:function(){return this.eachLayer(this.removeLayer,this)},invoke:function(t){var e,i,n=Array.prototype.slice.call(arguments,1);for(e in this._layers)(i=this._layers[e])[t]&&i[t].apply(i,n);return this},onAdd:function(t){this.eachLayer(t.addLayer,t)},onRemove:function(t){this.eachLayer(t.removeLayer,t)},eachLayer:function(t,e){for(var i in this._layers)t.call(e,this._layers[i]);return this},getLayer:function(t){return this._layers[t]},getLayers:function(){var t=[];return this.eachLayer(t.push,t),t},setZIndex:function(t){return this.invoke("setZIndex",t)},getLayerId:function(t){return a(t)}}),Ui=function(t,e){return new Hi(t,e)},Wi=Hi.extend({addLayer:function(t){return this.hasLayer(t)?this:(t.addEventParent(this),Hi.prototype.addLayer.call(this,t),this.fire("layeradd",{layer:t}))},removeLayer:function(t){return this.hasLayer(t)?(t in this._layers&&(t=this._layers[t]),t.removeEventParent(this),Hi.prototype.removeLayer.call(this,t),this.fire("layerremove",{layer:t})):this},setStyle:function(t){return this.invoke("setStyle",t)},bringToFront:function(){return this.invoke("bringToFront")},bringToBack:function(){return this.invoke("bringToBack")},getBounds:function(){var t=new j;for(var e in this._layers){var i=this._layers[e];t.extend(i.getBounds?i.getBounds():i.getLatLng())}return t}}),Gi=function(t){return new Wi(t)},Zi=T.extend({options:{popupAnchor:[0,0],tooltipAnchor:[0,0]},initialize:function(t){m(this,t)},createIcon:function(t){return this._createIcon("icon",t)},createShadow:function(t){return this._createIcon("shadow",t)},_createIcon:function(t,e){var i=this._getIconUrl(t);if(!i){if("icon"===t)throw new Error("iconUrl not set in Icon options (see the docs).");return null}var n=this._createImg(i,e&&"IMG"===e.tagName?e:null);return this._setIconStyles(n,t),n},_setIconStyles:function(t,e){var i=this.options,n=i[e+"Size"];"number"==typeof n&&(n=[n,n]);var o=z(n),s=z("shadow"===e&&i.shadowAnchor||i.iconAnchor||o&&o.divideBy(2,!0));t.className="leaflet-marker-"+e+" "+(i.className||""),s&&(t.style.marginLeft=-s.x+"px",t.style.marginTop=-s.y+"px"),o&&(t.style.width=o.x+"px",t.style.height=o.y+"px")},_createImg:function(t,e){return(e=e||document.createElement("img")).src=t,e},_getIconUrl:function(t){return At&&this.options[t+"RetinaUrl"]||this.options[t+"Url"]}});function Yi(t){return new Zi(t)}var Xi=Zi.extend({options:{iconUrl:"marker-icon.png",iconRetinaUrl:"marker-icon-2x.png",shadowUrl:"marker-shadow.png",iconSize:[25,41],iconAnchor:[12,41],popupAnchor:[1,-34],tooltipAnchor:[16,-28],shadowSize:[41,41]},_getIconUrl:function(t){return Xi.imagePath||(Xi.imagePath=this._detectIconPath()),(this.options.imagePath||Xi.imagePath)+Zi.prototype._getIconUrl.call(this,t)},_detectIconPath:function(){var t=de("div","leaflet-default-icon-path",document.body),e=he(t,"background-image")||he(t,"backgroundImage");return document.body.removeChild(t),e=null===e||0!==e.indexOf("url")?"":e.replace(/^url\(["']?/,"").replace(/marker-icon\.png["']?\)$/,"")}}),Ki=mi.extend({initialize:function(t){this._marker=t},addHooks:function(){var t=this._marker._icon;this._draggable||(this._draggable=new xi(t,t,!0)),this._draggable.on({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).enable(),ve(t,"leaflet-marker-draggable")},removeHooks:function(){this._draggable.off({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).disable(),this._marker._icon&&ye(this._marker._icon,"leaflet-marker-draggable")},moved:function(){return this._draggable&&this._draggable._moved},_adjustPan:function(t){var e=this._marker,i=e._map,n=this._marker.options.autoPanSpeed,o=this._marker.options.autoPanPadding,s=Ee(e._icon),r=i.getPixelBounds(),a=i.getPixelOrigin(),l=N(r.min._subtract(a).add(o),r.max._subtract(a).subtract(o));if(!l.contains(s)){var c=z((Math.max(l.max.x,s.x)-l.max.x)/(r.max.x-l.max.x)-(Math.min(l.min.x,s.x)-l.min.x)/(r.min.x-l.min.x),(Math.max(l.max.y,s.y)-l.max.y)/(r.max.y-l.max.y)-(Math.min(l.min.y,s.y)-l.min.y)/(r.min.y-l.min.y)).multiplyBy(n);i.panBy(c,{animate:!1}),this._draggable._newPos._add(c),this._draggable._startPos._add(c),Se(e._icon,this._draggable._newPos),this._onDrag(t),this._panRequest=E(this._adjustPan.bind(this,t))}},_onDragStart:function(){this._oldLatLng=this._marker.getLatLng(),this._marker.closePopup().fire("movestart").fire("dragstart")},_onPreDrag:function(t){this._marker.options.autoPan&&(A(this._panRequest),this._panRequest=E(this._adjustPan.bind(this,t)))},_onDrag:function(t){var e=this._marker,i=e._shadow,n=Ee(e._icon),o=e._map.layerPointToLatLng(n);i&&Se(i,n),e._latlng=o,t.latlng=o,t.oldLatLng=this._oldLatLng,e.fire("move",t).fire("drag",t)},_onDragEnd:function(t){A(this._panRequest),delete this._oldLatLng,this._marker.fire("moveend").fire("dragend",t)}}),Qi=Vi.extend({options:{icon:new Xi,interactive:!0,keyboard:!0,title:"",alt:"",zIndexOffset:0,opacity:1,riseOnHover:!1,riseOffset:250,pane:"markerPane",shadowPane:"shadowPane",bubblingMouseEvents:!1,draggable:!1,autoPan:!1,autoPanPadding:[50,50],autoPanSpeed:10},initialize:function(t,e){m(this,e),this._latlng=q(t)},onAdd:function(t){this._zoomAnimated=this._zoomAnimated&&t.options.markerZoomAnimation,this._zoomAnimated&&t.on("zoomanim",this._animateZoom,this),this._initIcon(),this.update()},onRemove:function(t){this.dragging&&this.dragging.enabled()&&(this.options.draggable=!0,this.dragging.removeHooks()),delete this.dragging,this._zoomAnimated&&t.off("zoomanim",this._animateZoom,this),this._removeIcon(),this._removeShadow()},getEvents:function(){return{zoom:this.update,viewreset:this.update}},getLatLng:function(){return this._latlng},setLatLng:function(t){var e=this._latlng;return this._latlng=q(t),this.update(),this.fire("move",{oldLatLng:e,latlng:this._latlng})},setZIndexOffset:function(t){return this.options.zIndexOffset=t,this.update()},getIcon:function(){return this.options.icon},setIcon:function(t){return this.options.icon=t,this._map&&(this._initIcon(),this.update()),this._popup&&this.bindPopup(this._popup,this._popup.options),this},getElement:function(){return this._icon},update:function(){if(this._icon&&this._map){var t=this._map.latLngToLayerPoint(this._latlng).round();this._setPos(t)}return this},_initIcon:function(){var t=this.options,e="leaflet-zoom-"+(this._zoomAnimated?"animated":"hide"),i=t.icon.createIcon(this._icon),n=!1;i!==this._icon&&(this._icon&&this._removeIcon(),n=!0,t.title&&(i.title=t.title),"IMG"===i.tagName&&(i.alt=t.alt||"")),ve(i,e),t.keyboard&&(i.tabIndex="0"),this._icon=i,t.riseOnHover&&this.on({mouseover:this._bringToFront,mouseout:this._resetZIndex});var o=t.icon.createShadow(this._shadow),s=!1;o!==this._shadow&&(this._removeShadow(),s=!0),o&&(ve(o,e),o.alt=""),this._shadow=o,t.opacity<1&&this._updateOpacity(),n&&this.getPane().appendChild(this._icon),this._initInteraction(),o&&s&&this.getPane(t.shadowPane).appendChild(this._shadow)},_removeIcon:function(){this.options.riseOnHover&&this.off({mouseover:this._bringToFront,mouseout:this._resetZIndex}),ue(this._icon),this.removeInteractiveTarget(this._icon),this._icon=null},_removeShadow:function(){this._shadow&&ue(this._shadow),this._shadow=null},_setPos:function(t){Se(this._icon,t),this._shadow&&Se(this._shadow,t),this._zIndex=t.y+this.options.zIndexOffset,this._resetZIndex()},_updateZIndex:function(t){this._icon.style.zIndex=this._zIndex+t},_animateZoom:function(t){var e=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center).round();this._setPos(e)},_initInteraction:function(){if(this.options.interactive&&(ve(this._icon,"leaflet-interactive"),this.addInteractiveTarget(this._icon),Ki)){var t=this.options.draggable;this.dragging&&(t=this.dragging.enabled(),this.dragging.disable()),this.dragging=new Ki(this),t&&this.dragging.enable()}},setOpacity:function(t){return this.options.opacity=t,this._map&&this._updateOpacity(),this},_updateOpacity:function(){var t=this.options.opacity;this._icon&&_e(this._icon,t),this._shadow&&_e(this._shadow,t)},_bringToFront:function(){this._updateZIndex(this.options.riseOffset)},_resetZIndex:function(){this._updateZIndex(0)},_getPopupAnchor:function(){return this.options.icon.options.popupAnchor},_getTooltipAnchor:function(){return this.options.icon.options.tooltipAnchor}});function Ji(t,e){return new Qi(t,e)}var tn=Vi.extend({options:{stroke:!0,color:"#3388ff",weight:3,opacity:1,lineCap:"round",lineJoin:"round",dashArray:null,dashOffset:null,fill:!1,fillColor:null,fillOpacity:.2,fillRule:"evenodd",interactive:!0,bubblingMouseEvents:!0},beforeAdd:function(t){this._renderer=t.getRenderer(this)},onAdd:function(){this._renderer._initPath(this),this._reset(),this._renderer._addPath(this)},onRemove:function(){this._renderer._removePath(this)},redraw:function(){return this._map&&this._renderer._updatePath(this),this},setStyle:function(t){return m(this,t),this._renderer&&(this._renderer._updateStyle(this),this.options.stroke&&t.hasOwnProperty("weight")&&this._updateBounds()),this},bringToFront:function(){return this._renderer&&this._renderer._bringToFront(this),this},bringToBack:function(){return this._renderer&&this._renderer._bringToBack(this),this},getElement:function(){return this._path},_reset:function(){this._project(),this._update()},_clickTolerance:function(){return(this.options.stroke?this.options.weight/2:0)+this._renderer.options.tolerance}}),en=tn.extend({options:{fill:!0,radius:10},initialize:function(t,e){m(this,e),this._latlng=q(t),this._radius=this.options.radius},setLatLng:function(t){return this._latlng=q(t),this.redraw(),this.fire("move",{latlng:this._latlng})},getLatLng:function(){return this._latlng},setRadius:function(t){return this.options.radius=this._radius=t,this.redraw()},getRadius:function(){return this._radius},setStyle:function(t){var e=t&&t.radius||this._radius;return tn.prototype.setStyle.call(this,t),this.setRadius(e),this},_project:function(){this._point=this._map.latLngToLayerPoint(this._latlng),this._updateBounds()},_updateBounds:function(){var t=this._radius,e=this._radiusY||t,i=this._clickTolerance(),n=[t+i,e+i];this._pxBounds=new R(this._point.subtract(n),this._point.add(n))},_update:function(){this._map&&this._updatePath()},_updatePath:function(){this._renderer._updateCircle(this)},_empty:function(){return this._radius&&!this._renderer._bounds.intersects(this._pxBounds)},_containsPoint:function(t){return t.distanceTo(this._point)<=this._radius+this._clickTolerance()}});function nn(t,e){return new en(t,e)}var on=en.extend({initialize:function(t,e,i){if("number"==typeof e&&(e=n({},i,{radius:e})),m(this,e),this._latlng=q(t),isNaN(this.options.radius))throw new Error("Circle radius cannot be NaN");this._mRadius=this.options.radius},setRadius:function(t){return this._mRadius=t,this.redraw()},getRadius:function(){return this._mRadius},getBounds:function(){var t=[this._radius,this._radiusY||this._radius];return new j(this._map.layerPointToLatLng(this._point.subtract(t)),this._map.layerPointToLatLng(this._point.add(t)))},setStyle:tn.prototype.setStyle,_project:function(){var t=this._latlng.lng,e=this._latlng.lat,i=this._map,n=i.options.crs;if(n.distance===H.distance){var o=Math.PI/180,s=this._mRadius/H.R/o,r=i.project([e+s,t]),a=i.project([e-s,t]),l=r.add(a).divideBy(2),c=i.unproject(l).lat,h=Math.acos((Math.cos(s*o)-Math.sin(e*o)*Math.sin(c*o))/(Math.cos(e*o)*Math.cos(c*o)))/o;(isNaN(h)||0===h)&&(h=s/Math.cos(Math.PI/180*e)),this._point=l.subtract(i.getPixelOrigin()),this._radius=isNaN(h)?0:l.x-i.project([c,t-h]).x,this._radiusY=l.y-r.y}else{var d=n.unproject(n.project(this._latlng).subtract([this._mRadius,0]));this._point=i.latLngToLayerPoint(this._latlng),this._radius=this._point.x-i.latLngToLayerPoint(d).x}this._updateBounds()}});function sn(t,e,i){return new on(t,e,i)}var rn=tn.extend({options:{smoothFactor:1,noClip:!1},initialize:function(t,e){m(this,e),this._setLatLngs(t)},getLatLngs:function(){return this._latlngs},setLatLngs:function(t){return this._setLatLngs(t),this.redraw()},isEmpty:function(){return!this._latlngs.length},closestLayerPoint:function(t){for(var e,i,n=1/0,o=null,s=Di,r=0,a=this._parts.length;r<a;r++)for(var l=this._parts[r],c=1,h=l.length;c<h;c++){var d=s(t,e=l[c-1],i=l[c],!0);d<n&&(n=d,o=s(t,e,i))}return o&&(o.distance=Math.sqrt(n)),o},getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");var t,e,i,n,o,s,r,a=this._rings[0],l=a.length;if(!l)return null;for(t=0,e=0;t<l-1;t++)e+=a[t].distanceTo(a[t+1])/2;if(0===e)return this._map.layerPointToLatLng(a[0]);for(t=0,n=0;t<l-1;t++)if(o=a[t],s=a[t+1],(n+=i=o.distanceTo(s))>e)return r=(n-e)/i,this._map.layerPointToLatLng([s.x-r*(s.x-o.x),s.y-r*(s.y-o.y)])},getBounds:function(){return this._bounds},addLatLng:function(t,e){return e=e||this._defaultShape(),t=q(t),e.push(t),this._bounds.extend(t),this.redraw()},_setLatLngs:function(t){this._bounds=new j,this._latlngs=this._convertLatLngs(t)},_defaultShape:function(){return Ii(this._latlngs)?this._latlngs:this._latlngs[0]},_convertLatLngs:function(t){for(var e=[],i=Ii(t),n=0,o=t.length;n<o;n++)i?(e[n]=q(t[n]),this._bounds.extend(e[n])):e[n]=this._convertLatLngs(t[n]);return e},_project:function(){var t=new R;this._rings=[],this._projectLatlngs(this._latlngs,this._rings,t),this._bounds.isValid()&&t.isValid()&&(this._rawPxBounds=t,this._updateBounds())},_updateBounds:function(){var t=this._clickTolerance(),e=new O(t,t);this._pxBounds=new R([this._rawPxBounds.min.subtract(e),this._rawPxBounds.max.add(e)])},_projectLatlngs:function(t,e,i){var n,o,s=t[0]instanceof F,r=t.length;if(s){for(o=[],n=0;n<r;n++)o[n]=this._map.latLngToLayerPoint(t[n]),i.extend(o[n]);e.push(o)}else for(n=0;n<r;n++)this._projectLatlngs(t[n],e,i)},_clipPoints:function(){var t=this._renderer._bounds;if(this._parts=[],this._pxBounds&&this._pxBounds.intersects(t))if(this.options.noClip)this._parts=this._rings;else{var e,i,n,o,s,r,a,l=this._parts;for(e=0,n=0,o=this._rings.length;e<o;e++)for(i=0,s=(a=this._rings[e]).length;i<s-1;i++)(r=Ai(a[i],a[i+1],t,i,!0))&&(l[n]=l[n]||[],l[n].push(r[0]),r[1]===a[i+1]&&i!==s-2||(l[n].push(r[1]),n++))}},_simplifyPoints:function(){for(var t=this._parts,e=this.options.smoothFactor,i=0,n=t.length;i<n;i++)t[i]=_i(t[i],e)},_update:function(){this._map&&(this._clipPoints(),this._simplifyPoints(),this._updatePath())},_updatePath:function(){this._renderer._updatePoly(this)},_containsPoint:function(t,e){var i,n,o,s,r,a,l=this._clickTolerance();if(!this._pxBounds||!this._pxBounds.contains(t))return!1;for(i=0,s=this._parts.length;i<s;i++)for(n=0,o=(r=(a=this._parts[i]).length)-1;n<r;o=n++)if((e||0!==n)&&wi(t,a[o],a[n])<=l)return!0;return!1}});function an(t,e){return new rn(t,e)}rn._flat=Oi;var ln=rn.extend({options:{fill:!0},isEmpty:function(){return!this._latlngs.length||!this._latlngs[0].length},getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");var t,e,i,n,o,s,r,a,l,c=this._rings[0],h=c.length;if(!h)return null;for(s=r=a=0,t=0,e=h-1;t<h;e=t++)i=c[t],n=c[e],o=i.y*n.x-n.y*i.x,r+=(i.x+n.x)*o,a+=(i.y+n.y)*o,s+=3*o;return l=0===s?c[0]:[r/s,a/s],this._map.layerPointToLatLng(l)},_convertLatLngs:function(t){var e=rn.prototype._convertLatLngs.call(this,t),i=e.length;return i>=2&&e[0]instanceof F&&e[0].equals(e[i-1])&&e.pop(),e},_setLatLngs:function(t){rn.prototype._setLatLngs.call(this,t),Ii(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return Ii(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var t=this._renderer._bounds,e=this.options.weight,i=new O(e,e);if(t=new R(t.min.subtract(i),t.max.add(i)),this._parts=[],this._pxBounds&&this._pxBounds.intersects(t))if(this.options.noClip)this._parts=this._rings;else for(var n,o=0,s=this._rings.length;o<s;o++)(n=Li(this._rings[o],t,!0)).length&&this._parts.push(n)},_updatePath:function(){this._renderer._updatePoly(this,!0)},_containsPoint:function(t){var e,i,n,o,s,r,a,l,c=!1;if(!this._pxBounds||!this._pxBounds.contains(t))return!1;for(o=0,a=this._parts.length;o<a;o++)for(s=0,r=(l=(e=this._parts[o]).length)-1;s<l;r=s++)i=e[s],n=e[r],i.y>t.y!=n.y>t.y&&t.x<(n.x-i.x)*(t.y-i.y)/(n.y-i.y)+i.x&&(c=!c);return c||rn.prototype._containsPoint.call(this,t,!0)}});function cn(t,e){return new ln(t,e)}var hn=Wi.extend({initialize:function(t,e){m(this,e),this._layers={},t&&this.addData(t)},addData:function(t){var e,i,n,o=y(t)?t:t.features;if(o){for(e=0,i=o.length;e<i;e++)((n=o[e]).geometries||n.geometry||n.features||n.coordinates)&&this.addData(n);return this}var s=this.options;if(s.filter&&!s.filter(t))return this;var r=dn(t,s);return r?(r.feature=vn(t),r.defaultOptions=r.options,this.resetStyle(r),s.onEachFeature&&s.onEachFeature(t,r),this.addLayer(r)):this},resetStyle:function(t){return t.options=n({},t.defaultOptions),this._setLayerStyle(t,this.options.style),this},setStyle:function(t){return this.eachLayer((function(e){this._setLayerStyle(e,t)}),this)},_setLayerStyle:function(t,e){t.setStyle&&("function"==typeof e&&(e=e(t.feature)),t.setStyle(e))}});function dn(t,e){var i,n,o,s,r="Feature"===t.type?t.geometry:t,a=r?r.coordinates:null,l=[],c=e&&e.pointToLayer,h=e&&e.coordsToLatLng||un;if(!a&&!r)return null;switch(r.type){case"Point":return i=h(a),c?c(t,i):new Qi(i);case"MultiPoint":for(o=0,s=a.length;o<s;o++)i=h(a[o]),l.push(c?c(t,i):new Qi(i));return new Wi(l);case"LineString":case"MultiLineString":return n=pn(a,"LineString"===r.type?0:1,h),new rn(n,e);case"Polygon":case"MultiPolygon":return n=pn(a,"Polygon"===r.type?1:2,h),new ln(n,e);case"GeometryCollection":for(o=0,s=r.geometries.length;o<s;o++){var d=dn({geometry:r.geometries[o],type:"Feature",properties:t.properties},e);d&&l.push(d)}return new Wi(l);default:throw new Error("Invalid GeoJSON object.")}}function un(t){return new F(t[1],t[0],t[2])}function pn(t,e,i){for(var n,o=[],s=0,r=t.length;s<r;s++)n=e?pn(t[s],e-1,i):(i||un)(t[s]),o.push(n);return o}function mn(t,e){return e="number"==typeof e?e:6,void 0!==t.alt?[d(t.lng,e),d(t.lat,e),d(t.alt,e)]:[d(t.lng,e),d(t.lat,e)]}function gn(t,e,i,n){for(var o=[],s=0,r=t.length;s<r;s++)o.push(e?gn(t[s],e-1,i,n):mn(t[s],n));return!e&&i&&o.push(o[0]),o}function fn(t,e){return t.feature?n({},t.feature,{geometry:e}):vn(e)}function vn(t){return"Feature"===t.type||"FeatureCollection"===t.type?t:{type:"Feature",properties:{},geometry:t}}var yn={toGeoJSON:function(t){return fn(this,{type:"Point",coordinates:mn(this.getLatLng(),t)})}};function bn(t,e){return new hn(t,e)}Qi.include(yn),on.include(yn),en.include(yn),rn.include({toGeoJSON:function(t){var e=!Ii(this._latlngs);return fn(this,{type:(e?"Multi":"")+"LineString",coordinates:gn(this._latlngs,e?1:0,!1,t)})}}),ln.include({toGeoJSON:function(t){var e=!Ii(this._latlngs),i=e&&!Ii(this._latlngs[0]),n=gn(this._latlngs,i?2:e?1:0,!0,t);return e||(n=[n]),fn(this,{type:(i?"Multi":"")+"Polygon",coordinates:n})}}),Hi.include({toMultiPoint:function(t){var e=[];return this.eachLayer((function(i){e.push(i.toGeoJSON(t).geometry.coordinates)})),fn(this,{type:"MultiPoint",coordinates:e})},toGeoJSON:function(t){var e=this.feature&&this.feature.geometry&&this.feature.geometry.type;if("MultiPoint"===e)return this.toMultiPoint(t);var i="GeometryCollection"===e,n=[];return this.eachLayer((function(e){if(e.toGeoJSON){var o=e.toGeoJSON(t);if(i)n.push(o.geometry);else{var s=vn(o);"FeatureCollection"===s.type?n.push.apply(n,s.features):n.push(s)}}})),i?fn(this,{geometries:n,type:"GeometryCollection"}):{type:"FeatureCollection",features:n}}});var xn=bn,_n=Vi.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(t,e,i){this._url=t,this._bounds=B(e),m(this,i)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(ve(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){ue(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},setOpacity:function(t){return this.options.opacity=t,this._image&&this._updateOpacity(),this},setStyle:function(t){return t.opacity&&this.setOpacity(t.opacity),this},bringToFront:function(){return this._map&&me(this._image),this},bringToBack:function(){return this._map&&ge(this._image),this},setUrl:function(t){return this._url=t,this._image&&(this._image.src=t),this},setBounds:function(t){return this._bounds=B(t),this._map&&this._reset(),this},getEvents:function(){var t={zoom:this._reset,viewreset:this._reset};return this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},getBounds:function(){return this._bounds},getElement:function(){return this._image},_initImage:function(){var t="IMG"===this._url.tagName,e=this._image=t?this._url:de("img");ve(e,"leaflet-image-layer"),this._zoomAnimated&&ve(e,"leaflet-zoom-animated"),this.options.className&&ve(e,this.options.className),e.onselectstart=h,e.onmousemove=h,e.onload=s(this.fire,this,"load"),e.onerror=s(this._overlayOnError,this,"error"),(this.options.crossOrigin||""===this.options.crossOrigin)&&(e.crossOrigin=!0===this.options.crossOrigin?"":this.options.crossOrigin),this.options.zIndex&&this._updateZIndex(),t?this._url=e.src:(e.src=this._url,e.alt=this.options.alt)},_animateZoom:function(t){var e=this._map.getZoomScale(t.zoom),i=this._map._latLngBoundsToNewLayerBounds(this._bounds,t.zoom,t.center).min;Ce(this._image,i,e)},_reset:function(){var t=this._image,e=new R(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),i=e.getSize();Se(t,e.min),t.style.width=i.x+"px",t.style.height=i.y+"px"},_updateOpacity:function(){_e(this._image,this.options.opacity)},_updateZIndex:function(){this._image&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._image.style.zIndex=this.options.zIndex)},_overlayOnError:function(){this.fire("error");var t=this.options.errorOverlayUrl;t&&this._url!==t&&(this._url=t,this._image.src=t)}}),wn=function(t,e,i){return new _n(t,e,i)},kn=_n.extend({options:{autoplay:!0,loop:!0,keepAspectRatio:!0},_initImage:function(){var t="VIDEO"===this._url.tagName,e=this._image=t?this._url:de("video");if(ve(e,"leaflet-image-layer"),this._zoomAnimated&&ve(e,"leaflet-zoom-animated"),e.onselectstart=h,e.onmousemove=h,e.onloadeddata=s(this.fire,this,"load"),t){for(var i=e.getElementsByTagName("source"),n=[],o=0;o<i.length;o++)n.push(i[o].src);this._url=i.length>0?n:[e.src]}else{y(this._url)||(this._url=[this._url]),!this.options.keepAspectRatio&&e.style.hasOwnProperty("objectFit")&&(e.style.objectFit="fill"),e.autoplay=!!this.options.autoplay,e.loop=!!this.options.loop;for(var r=0;r<this._url.length;r++){var a=de("source");a.src=this._url[r],e.appendChild(a)}}}});function Cn(t,e,i){return new kn(t,e,i)}var Sn=_n.extend({_initImage:function(){var t=this._image=this._url;ve(t,"leaflet-image-layer"),this._zoomAnimated&&ve(t,"leaflet-zoom-animated"),t.onselectstart=h,t.onmousemove=h}});function En(t,e,i){return new Sn(t,e,i)}var An=Vi.extend({options:{offset:[0,7],className:"",pane:"popupPane"},initialize:function(t,e){m(this,t),this._source=e},onAdd:function(t){this._zoomAnimated=t._zoomAnimated,this._container||this._initLayout(),t._fadeAnimated&&_e(this._container,0),clearTimeout(this._removeTimeout),this.getPane().appendChild(this._container),this.update(),t._fadeAnimated&&_e(this._container,1),this.bringToFront()},onRemove:function(t){t._fadeAnimated?(_e(this._container,0),this._removeTimeout=setTimeout(s(ue,void 0,this._container),200)):ue(this._container)},getLatLng:function(){return this._latlng},setLatLng:function(t){return this._latlng=q(t),this._map&&(this._updatePosition(),this._adjustPan()),this},getContent:function(){return this._content},setContent:function(t){return this._content=t,this.update(),this},getElement:function(){return this._container},update:function(){this._map&&(this._container.style.visibility="hidden",this._updateContent(),this._updateLayout(),this._updatePosition(),this._container.style.visibility="",this._adjustPan())},getEvents:function(){var t={zoom:this._updatePosition,viewreset:this._updatePosition};return this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},isOpen:function(){return!!this._map&&this._map.hasLayer(this)},bringToFront:function(){return this._map&&me(this._container),this},bringToBack:function(){return this._map&&ge(this._container),this},_prepareOpen:function(t,e,i){if(e instanceof Vi||(i=e,e=t),e instanceof Wi)for(var n in t._layers){e=t._layers[n];break}if(!i)if(e.getCenter)i=e.getCenter();else{if(!e.getLatLng)throw new Error("Unable to get source layer LatLng.");i=e.getLatLng()}return this._source=e,this.update(),i},_updateContent:function(){if(this._content){var t=this._contentNode,e="function"==typeof this._content?this._content(this._source||this):this._content;if("string"==typeof e)t.innerHTML=e;else{for(;t.hasChildNodes();)t.removeChild(t.firstChild);t.appendChild(e)}this.fire("contentupdate")}},_updatePosition:function(){if(this._map){var t=this._map.latLngToLayerPoint(this._latlng),e=z(this.options.offset),i=this._getAnchor();this._zoomAnimated?Se(this._container,t.add(i)):e=e.add(t).add(i);var n=this._containerBottom=-e.y,o=this._containerLeft=-Math.round(this._containerWidth/2)+e.x;this._container.style.bottom=n+"px",this._container.style.left=o+"px"}},_getAnchor:function(){return[0,0]}}),Mn=An.extend({options:{maxWidth:300,minWidth:50,maxHeight:null,autoPan:!0,autoPanPaddingTopLeft:null,autoPanPaddingBottomRight:null,autoPanPadding:[5,5],keepInView:!1,closeButton:!0,autoClose:!0,closeOnEscapeKey:!0,className:""},openOn:function(t){return t.openPopup(this),this},onAdd:function(t){An.prototype.onAdd.call(this,t),t.fire("popupopen",{popup:this}),this._source&&(this._source.fire("popupopen",{popup:this},!0),this._source instanceof tn||this._source.on("preclick",Be))},onRemove:function(t){An.prototype.onRemove.call(this,t),t.fire("popupclose",{popup:this}),this._source&&(this._source.fire("popupclose",{popup:this},!0),this._source instanceof tn||this._source.off("preclick",Be))},getEvents:function(){var t=An.prototype.getEvents.call(this);return(void 0!==this.options.closeOnClick?this.options.closeOnClick:this._map.options.closePopupOnClick)&&(t.preclick=this._close),this.options.keepInView&&(t.moveend=this._adjustPan),t},_close:function(){this._map&&this._map.closePopup(this)},_initLayout:function(){var t="leaflet-popup",e=this._container=de("div",t+" "+(this.options.className||"")+" leaflet-zoom-animated"),i=this._wrapper=de("div",t+"-content-wrapper",e);if(this._contentNode=de("div",t+"-content",i),qe(i),Fe(this._contentNode),Le(i,"contextmenu",Be),this._tipContainer=de("div",t+"-tip-container",e),this._tip=de("div",t+"-tip",this._tipContainer),this.options.closeButton){var n=this._closeButton=de("a",t+"-close-button",e);n.href="#close",n.innerHTML="×",Le(n,"click",this._onCloseButtonClick,this)}},_updateLayout:function(){var t=this._contentNode,e=t.style;e.width="",e.whiteSpace="nowrap";var i=t.offsetWidth;i=Math.min(i,this.options.maxWidth),i=Math.max(i,this.options.minWidth),e.width=i+1+"px",e.whiteSpace="",e.height="";var n=t.offsetHeight,o=this.options.maxHeight,s="leaflet-popup-scrolled";o&&n>o?(e.height=o+"px",ve(t,s)):ye(t,s),this._containerWidth=this._container.offsetWidth},_animateZoom:function(t){var e=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center),i=this._getAnchor();Se(this._container,e.add(i))},_adjustPan:function(){if(this.options.autoPan){this._map._panAnim&&this._map._panAnim.stop();var t=this._map,e=parseInt(he(this._container,"marginBottom"),10)||0,i=this._container.offsetHeight+e,n=this._containerWidth,o=new O(this._containerLeft,-i-this._containerBottom);o._add(Ee(this._container));var s=t.layerPointToContainerPoint(o),r=z(this.options.autoPanPadding),a=z(this.options.autoPanPaddingTopLeft||r),l=z(this.options.autoPanPaddingBottomRight||r),c=t.getSize(),h=0,d=0;s.x+n+l.x>c.x&&(h=s.x+n-c.x+l.x),s.x-h-a.x<0&&(h=s.x-a.x),s.y+i+l.y>c.y&&(d=s.y+i-c.y+l.y),s.y-d-a.y<0&&(d=s.y-a.y),(h||d)&&t.fire("autopanstart").panBy([h,d])}},_onCloseButtonClick:function(t){this._close(),He(t)},_getAnchor:function(){return z(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),Tn=function(t,e){return new Mn(t,e)};ii.mergeOptions({closePopupOnClick:!0}),ii.include({openPopup:function(t,e,i){return t instanceof Mn||(t=new Mn(i).setContent(t)),e&&t.setLatLng(e),this.hasLayer(t)?this:(this._popup&&this._popup.options.autoClose&&this.closePopup(),this._popup=t,this.addLayer(t))},closePopup:function(t){return t&&t!==this._popup||(t=this._popup,this._popup=null),t&&this.removeLayer(t),this}}),Vi.include({bindPopup:function(t,e){return t instanceof Mn?(m(t,e),this._popup=t,t._source=this):(this._popup&&!e||(this._popup=new Mn(e,this)),this._popup.setContent(t)),this._popupHandlersAdded||(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,this._popup=null),this},openPopup:function(t,e){return this._popup&&this._map&&(e=this._popup._prepareOpen(this,t,e),this._map.openPopup(this._popup,e)),this},closePopup:function(){return this._popup&&this._popup._close(),this},togglePopup:function(t){return this._popup&&(this._popup._map?this.closePopup():this.openPopup(t)),this},isPopupOpen:function(){return!!this._popup&&this._popup.isOpen()},setPopupContent:function(t){return this._popup&&this._popup.setContent(t),this},getPopup:function(){return this._popup},_openPopup:function(t){var e=t.layer||t.target;this._popup&&this._map&&(He(t),e instanceof tn?this.openPopup(t.layer||t.target,t.latlng):this._map.hasLayer(this._popup)&&this._popup._source===e?this.closePopup():this.openPopup(e,t.latlng))},_movePopup:function(t){this._popup.setLatLng(t.latlng)},_onKeyPress:function(t){13===t.originalEvent.keyCode&&this._openPopup(t)}});var Pn=An.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,interactive:!1,opacity:.9},onAdd:function(t){An.prototype.onAdd.call(this,t),this.setOpacity(this.options.opacity),t.fire("tooltipopen",{tooltip:this}),this._source&&this._source.fire("tooltipopen",{tooltip:this},!0)},onRemove:function(t){An.prototype.onRemove.call(this,t),t.fire("tooltipclose",{tooltip:this}),this._source&&this._source.fire("tooltipclose",{tooltip:this},!0)},getEvents:function(){var t=An.prototype.getEvents.call(this);return Ct&&!this.options.permanent&&(t.preclick=this._close),t},_close:function(){this._map&&this._map.closeTooltip(this)},_initLayout:function(){var t="leaflet-tooltip "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=de("div",t)},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(t){var e=this._map,i=this._container,n=e.latLngToContainerPoint(e.getCenter()),o=e.layerPointToContainerPoint(t),s=this.options.direction,r=i.offsetWidth,a=i.offsetHeight,l=z(this.options.offset),c=this._getAnchor();"top"===s?t=t.add(z(-r/2+l.x,-a+l.y+c.y,!0)):"bottom"===s?t=t.subtract(z(r/2-l.x,-l.y,!0)):"center"===s?t=t.subtract(z(r/2+l.x,a/2-c.y+l.y,!0)):"right"===s||"auto"===s&&o.x<n.x?(s="right",t=t.add(z(l.x+c.x,c.y-a/2+l.y,!0))):(s="left",t=t.subtract(z(r+c.x-l.x,a/2-c.y-l.y,!0))),ye(i,"leaflet-tooltip-right"),ye(i,"leaflet-tooltip-left"),ye(i,"leaflet-tooltip-top"),ye(i,"leaflet-tooltip-bottom"),ve(i,"leaflet-tooltip-"+s),Se(i,t)},_updatePosition:function(){var t=this._map.latLngToLayerPoint(this._latlng);this._setPosition(t)},setOpacity:function(t){this.options.opacity=t,this._container&&_e(this._container,t)},_animateZoom:function(t){var e=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center);this._setPosition(e)},_getAnchor:function(){return z(this._source&&this._source._getTooltipAnchor&&!this.options.sticky?this._source._getTooltipAnchor():[0,0])}}),Dn=function(t,e){return new Pn(t,e)};ii.include({openTooltip:function(t,e,i){return t instanceof Pn||(t=new Pn(i).setContent(t)),e&&t.setLatLng(e),this.hasLayer(t)?this:this.addLayer(t)},closeTooltip:function(t){return t&&this.removeLayer(t),this}}),Vi.include({bindTooltip:function(t,e){return t instanceof Pn?(m(t,e),this._tooltip=t,t._source=this):(this._tooltip&&!e||(this._tooltip=new Pn(e,this)),this._tooltip.setContent(t)),this._initTooltipInteractions(),this._tooltip.options.permanent&&this._map&&this._map.hasLayer(this)&&this.openTooltip(),this},unbindTooltip:function(){return this._tooltip&&(this._initTooltipInteractions(!0),this.closeTooltip(),this._tooltip=null),this},_initTooltipInteractions:function(t){if(t||!this._tooltipHandlersAdded){var e=t?"off":"on",i={remove:this.closeTooltip,move:this._moveTooltip};this._tooltip.options.permanent?i.add=this._openTooltip:(i.mouseover=this._openTooltip,i.mouseout=this.closeTooltip,this._tooltip.options.sticky&&(i.mousemove=this._moveTooltip),Ct&&(i.click=this._openTooltip)),this[e](i),this._tooltipHandlersAdded=!t}},openTooltip:function(t,e){return this._tooltip&&this._map&&(e=this._tooltip._prepareOpen(this,t,e),this._map.openTooltip(this._tooltip,e),this._tooltip.options.interactive&&this._tooltip._container&&(ve(this._tooltip._container,"leaflet-clickable"),this.addInteractiveTarget(this._tooltip._container))),this},closeTooltip:function(){return this._tooltip&&(this._tooltip._close(),this._tooltip.options.interactive&&this._tooltip._container&&(ye(this._tooltip._container,"leaflet-clickable"),this.removeInteractiveTarget(this._tooltip._container))),this},toggleTooltip:function(t){return this._tooltip&&(this._tooltip._map?this.closeTooltip():this.openTooltip(t)),this},isTooltipOpen:function(){return this._tooltip.isOpen()},setTooltipContent:function(t){return this._tooltip&&this._tooltip.setContent(t),this},getTooltip:function(){return this._tooltip},_openTooltip:function(t){var e=t.layer||t.target;this._tooltip&&this._map&&this.openTooltip(e,this._tooltip.options.sticky?t.latlng:void 0)},_moveTooltip:function(t){var e,i,n=t.latlng;this._tooltip.options.sticky&&t.originalEvent&&(e=this._map.mouseEventToContainerPoint(t.originalEvent),i=this._map.containerPointToLayerPoint(e),n=this._map.layerPointToLatLng(i)),this._tooltip.setLatLng(n)}});var In=Zi.extend({options:{iconSize:[12,12],html:!1,bgPos:null,className:"leaflet-div-icon"},createIcon:function(t){var e=t&&"DIV"===t.tagName?t:document.createElement("div"),i=this.options;if(i.html instanceof Element?(pe(e),e.appendChild(i.html)):e.innerHTML=!1!==i.html?i.html:"",i.bgPos){var n=z(i.bgPos);e.style.backgroundPosition=-n.x+"px "+-n.y+"px"}return this._setIconStyles(e,"icon"),e},createShadow:function(){return null}});function On(t){return new In(t)}Zi.Default=Xi;var $n=Vi.extend({options:{tileSize:256,opacity:1,updateWhenIdle:bt,updateWhenZooming:!0,updateInterval:200,zIndex:1,bounds:null,minZoom:0,maxZoom:void 0,maxNativeZoom:void 0,minNativeZoom:void 0,noWrap:!1,pane:"tilePane",className:"",keepBuffer:2},initialize:function(t){m(this,t)},onAdd:function(){this._initContainer(),this._levels={},this._tiles={},this._resetView(),this._update()},beforeAdd:function(t){t._addZoomLimit(this)},onRemove:function(t){this._removeAllTiles(),ue(this._container),t._removeZoomLimit(this),this._container=null,this._tileZoom=void 0},bringToFront:function(){return this._map&&(me(this._container),this._setAutoZIndex(Math.max)),this},bringToBack:function(){return this._map&&(ge(this._container),this._setAutoZIndex(Math.min)),this},getContainer:function(){return this._container},setOpacity:function(t){return this.options.opacity=t,this._updateOpacity(),this},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},isLoading:function(){return this._loading},redraw:function(){return this._map&&(this._removeAllTiles(),this._update()),this},getEvents:function(){var t={viewprereset:this._invalidateAll,viewreset:this._resetView,zoom:this._resetView,moveend:this._onMoveEnd};return this.options.updateWhenIdle||(this._onMove||(this._onMove=l(this._onMoveEnd,this.options.updateInterval,this)),t.move=this._onMove),this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},createTile:function(){return document.createElement("div")},getTileSize:function(){var t=this.options.tileSize;return t instanceof O?t:new O(t,t)},_updateZIndex:function(){this._container&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._container.style.zIndex=this.options.zIndex)},_setAutoZIndex:function(t){for(var e,i=this.getPane().children,n=-t(-1/0,1/0),o=0,s=i.length;o<s;o++)e=i[o].style.zIndex,i[o]!==this._container&&e&&(n=t(n,+e));isFinite(n)&&(this.options.zIndex=n+t(-1,1),this._updateZIndex())},_updateOpacity:function(){if(this._map&&!et){_e(this._container,this.options.opacity);var t=+new Date,e=!1,i=!1;for(var n in this._tiles){var o=this._tiles[n];if(o.current&&o.loaded){var s=Math.min(1,(t-o.loaded)/200);_e(o.el,s),s<1?e=!0:(o.active?i=!0:this._onOpaqueTile(o),o.active=!0)}}i&&!this._noPrune&&this._pruneTiles(),e&&(A(this._fadeFrame),this._fadeFrame=E(this._updateOpacity,this))}},_onOpaqueTile:h,_initContainer:function(){this._container||(this._container=de("div","leaflet-layer "+(this.options.className||"")),this._updateZIndex(),this.options.opacity<1&&this._updateOpacity(),this.getPane().appendChild(this._container))},_updateLevels:function(){var t=this._tileZoom,e=this.options.maxZoom;if(void 0!==t){for(var i in this._levels)this._levels[i].el.children.length||i===t?(this._levels[i].el.style.zIndex=e-Math.abs(t-i),this._onUpdateLevel(i)):(ue(this._levels[i].el),this._removeTilesAtZoom(i),this._onRemoveLevel(i),delete this._levels[i]);var n=this._levels[t],o=this._map;return n||((n=this._levels[t]={}).el=de("div","leaflet-tile-container leaflet-zoom-animated",this._container),n.el.style.zIndex=e,n.origin=o.project(o.unproject(o.getPixelOrigin()),t).round(),n.zoom=t,this._setZoomTransform(n,o.getCenter(),o.getZoom()),h(n.el.offsetWidth),this._onCreateLevel(n)),this._level=n,n}},_onUpdateLevel:h,_onRemoveLevel:h,_onCreateLevel:h,_pruneTiles:function(){if(this._map){var t,e,i=this._map.getZoom();if(i>this.options.maxZoom||i<this.options.minZoom)this._removeAllTiles();else{for(t in this._tiles)(e=this._tiles[t]).retain=e.current;for(t in this._tiles)if((e=this._tiles[t]).current&&!e.active){var n=e.coords;this._retainParent(n.x,n.y,n.z,n.z-5)||this._retainChildren(n.x,n.y,n.z,n.z+2)}for(t in this._tiles)this._tiles[t].retain||this._removeTile(t)}}},_removeTilesAtZoom:function(t){for(var e in this._tiles)this._tiles[e].coords.z===t&&this._removeTile(e)},_removeAllTiles:function(){for(var t in this._tiles)this._removeTile(t)},_invalidateAll:function(){for(var t in this._levels)ue(this._levels[t].el),this._onRemoveLevel(t),delete this._levels[t];this._removeAllTiles(),this._tileZoom=void 0},_retainParent:function(t,e,i,n){var o=Math.floor(t/2),s=Math.floor(e/2),r=i-1,a=new O(+o,+s);a.z=+r;var l=this._tileCoordsToKey(a),c=this._tiles[l];return c&&c.active?(c.retain=!0,!0):(c&&c.loaded&&(c.retain=!0),r>n&&this._retainParent(o,s,r,n))},_retainChildren:function(t,e,i,n){for(var o=2*t;o<2*t+2;o++)for(var s=2*e;s<2*e+2;s++){var r=new O(o,s);r.z=i+1;var a=this._tileCoordsToKey(r),l=this._tiles[a];l&&l.active?l.retain=!0:(l&&l.loaded&&(l.retain=!0),i+1<n&&this._retainChildren(o,s,i+1,n))}},_resetView:function(t){var e=t&&(t.pinch||t.flyTo);this._setView(this._map.getCenter(),this._map.getZoom(),e,e)},_animateZoom:function(t){this._setView(t.center,t.zoom,!0,t.noUpdate)},_clampZoom:function(t){var e=this.options;return void 0!==e.minNativeZoom&&t<e.minNativeZoom?e.minNativeZoom:void 0!==e.maxNativeZoom&&e.maxNativeZoom<t?e.maxNativeZoom:t},_setView:function(t,e,i,n){var o=this._clampZoom(Math.round(e));(void 0!==this.options.maxZoom&&o>this.options.maxZoom||void 0!==this.options.minZoom&&o<this.options.minZoom)&&(o=void 0);var s=this.options.updateWhenZooming&&o!==this._tileZoom;n&&!s||(this._tileZoom=o,this._abortLoading&&this._abortLoading(),this._updateLevels(),this._resetGrid(),void 0!==o&&this._update(t),i||this._pruneTiles(),this._noPrune=!!i),this._setZoomTransforms(t,e)},_setZoomTransforms:function(t,e){for(var i in this._levels)this._setZoomTransform(this._levels[i],t,e)},_setZoomTransform:function(t,e,i){var n=this._map.getZoomScale(i,t.zoom),o=t.origin.multiplyBy(n).subtract(this._map._getNewPixelOrigin(e,i)).round();yt?Ce(t.el,o,n):Se(t.el,o)},_resetGrid:function(){var t=this._map,e=t.options.crs,i=this._tileSize=this.getTileSize(),n=this._tileZoom,o=this._map.getPixelWorldBounds(this._tileZoom);o&&(this._globalTileRange=this._pxBoundsToTileRange(o)),this._wrapX=e.wrapLng&&!this.options.noWrap&&[Math.floor(t.project([0,e.wrapLng[0]],n).x/i.x),Math.ceil(t.project([0,e.wrapLng[1]],n).x/i.y)],this._wrapY=e.wrapLat&&!this.options.noWrap&&[Math.floor(t.project([e.wrapLat[0],0],n).y/i.x),Math.ceil(t.project([e.wrapLat[1],0],n).y/i.y)]},_onMoveEnd:function(){this._map&&!this._map._animatingZoom&&this._update()},_getTiledPixelBounds:function(t){var e=this._map,i=e._animatingZoom?Math.max(e._animateToZoom,e.getZoom()):e.getZoom(),n=e.getZoomScale(i,this._tileZoom),o=e.project(t,this._tileZoom).floor(),s=e.getSize().divideBy(2*n);return new R(o.subtract(s),o.add(s))},_update:function(t){var e=this._map;if(e){var i=this._clampZoom(e.getZoom());if(void 0===t&&(t=e.getCenter()),void 0!==this._tileZoom){var n=this._getTiledPixelBounds(t),o=this._pxBoundsToTileRange(n),s=o.getCenter(),r=[],a=this.options.keepBuffer,l=new R(o.getBottomLeft().subtract([a,-a]),o.getTopRight().add([a,-a]));if(!(isFinite(o.min.x)&&isFinite(o.min.y)&&isFinite(o.max.x)&&isFinite(o.max.y)))throw new Error("Attempted to load an infinite number of tiles");for(var c in this._tiles){var h=this._tiles[c].coords;h.z===this._tileZoom&&l.contains(new O(h.x,h.y))||(this._tiles[c].current=!1)}if(Math.abs(i-this._tileZoom)>1)this._setView(t,i);else{for(var d=o.min.y;d<=o.max.y;d++)for(var u=o.min.x;u<=o.max.x;u++){var p=new O(u,d);if(p.z=this._tileZoom,this._isValidTile(p)){var m=this._tiles[this._tileCoordsToKey(p)];m?m.current=!0:r.push(p)}}if(r.sort((function(t,e){return t.distanceTo(s)-e.distanceTo(s)})),0!==r.length){this._loading||(this._loading=!0,this.fire("loading"));var g=document.createDocumentFragment();for(u=0;u<r.length;u++)this._addTile(r[u],g);this._level.el.appendChild(g)}}}}},_isValidTile:function(t){var e=this._map.options.crs;if(!e.infinite){var i=this._globalTileRange;if(!e.wrapLng&&(t.x<i.min.x||t.x>i.max.x)||!e.wrapLat&&(t.y<i.min.y||t.y>i.max.y))return!1}if(!this.options.bounds)return!0;var n=this._tileCoordsToBounds(t);return B(this.options.bounds).overlaps(n)},_keyToBounds:function(t){return this._tileCoordsToBounds(this._keyToTileCoords(t))},_tileCoordsToNwSe:function(t){var e=this._map,i=this.getTileSize(),n=t.scaleBy(i),o=n.add(i);return[e.unproject(n,t.z),e.unproject(o,t.z)]},_tileCoordsToBounds:function(t){var e=this._tileCoordsToNwSe(t),i=new j(e[0],e[1]);return this.options.noWrap||(i=this._map.wrapLatLngBounds(i)),i},_tileCoordsToKey:function(t){return t.x+":"+t.y+":"+t.z},_keyToTileCoords:function(t){var e=t.split(":"),i=new O(+e[0],+e[1]);return i.z=+e[2],i},_removeTile:function(t){var e=this._tiles[t];e&&(ue(e.el),delete this._tiles[t],this.fire("tileunload",{tile:e.el,coords:this._keyToTileCoords(t)}))},_initTile:function(t){ve(t,"leaflet-tile");var e=this.getTileSize();t.style.width=e.x+"px",t.style.height=e.y+"px",t.onselectstart=h,t.onmousemove=h,et&&this.options.opacity<1&&_e(t,this.options.opacity),ot&&!st&&(t.style.WebkitBackfaceVisibility="hidden")},_addTile:function(t,e){var i=this._getTilePos(t),n=this._tileCoordsToKey(t),o=this.createTile(this._wrapCoords(t),s(this._tileReady,this,t));this._initTile(o),this.createTile.length<2&&E(s(this._tileReady,this,t,null,o)),Se(o,i),this._tiles[n]={el:o,coords:t,current:!0},e.appendChild(o),this.fire("tileloadstart",{tile:o,coords:t})},_tileReady:function(t,e,i){e&&this.fire("tileerror",{error:e,tile:i,coords:t});var n=this._tileCoordsToKey(t);(i=this._tiles[n])&&(i.loaded=+new Date,this._map._fadeAnimated?(_e(i.el,0),A(this._fadeFrame),this._fadeFrame=E(this._updateOpacity,this)):(i.active=!0,this._pruneTiles()),e||(ve(i.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:i.el,coords:t})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),et||!this._map._fadeAnimated?E(this._pruneTiles,this):setTimeout(s(this._pruneTiles,this),250)))},_getTilePos:function(t){return t.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(t){var e=new O(this._wrapX?c(t.x,this._wrapX):t.x,this._wrapY?c(t.y,this._wrapY):t.y);return e.z=t.z,e},_pxBoundsToTileRange:function(t){var e=this.getTileSize();return new R(t.min.unscaleBy(e).floor(),t.max.unscaleBy(e).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var t in this._tiles)if(!this._tiles[t].loaded)return!1;return!0}});function Ln(t){return new $n(t)}var zn=$n.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1},initialize:function(t,e){this._url=t,(e=m(this,e)).detectRetina&&At&&e.maxZoom>0&&(e.tileSize=Math.floor(e.tileSize/2),e.zoomReverse?(e.zoomOffset--,e.minZoom++):(e.zoomOffset++,e.maxZoom--),e.minZoom=Math.max(0,e.minZoom)),"string"==typeof e.subdomains&&(e.subdomains=e.subdomains.split("")),ot||this.on("tileunload",this._onTileRemove)},setUrl:function(t,e){return this._url===t&&void 0===e&&(e=!0),this._url=t,e||this.redraw(),this},createTile:function(t,e){var i=document.createElement("img");return Le(i,"load",s(this._tileOnLoad,this,e,i)),Le(i,"error",s(this._tileOnError,this,e,i)),(this.options.crossOrigin||""===this.options.crossOrigin)&&(i.crossOrigin=!0===this.options.crossOrigin?"":this.options.crossOrigin),i.alt="",i.setAttribute("role","presentation"),i.src=this.getTileUrl(t),i},getTileUrl:function(t){var e={r:At?"@2x":"",s:this._getSubdomain(t),x:t.x,y:t.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var i=this._globalTileRange.max.y-t.y;this.options.tms&&(e.y=i),e["-y"]=i}return v(this._url,n(e,this.options))},_tileOnLoad:function(t,e){et?setTimeout(s(t,this,null,e),0):t(null,e)},_tileOnError:function(t,e,i){var n=this.options.errorTileUrl;n&&e.getAttribute("src")!==n&&(e.src=n),t(i,e)},_onTileRemove:function(t){t.tile.onload=null},_getZoomForUrl:function(){var t=this._tileZoom,e=this.options.maxZoom;return this.options.zoomReverse&&(t=e-t),t+this.options.zoomOffset},_getSubdomain:function(t){var e=Math.abs(t.x+t.y)%this.options.subdomains.length;return this.options.subdomains[e]},_abortLoading:function(){var t,e;for(t in this._tiles)this._tiles[t].coords.z!==this._tileZoom&&((e=this._tiles[t].el).onload=h,e.onerror=h,e.complete||(e.src=x,ue(e),delete this._tiles[t]))},_removeTile:function(t){var e=this._tiles[t];if(e)return at||e.el.setAttribute("src",x),$n.prototype._removeTile.call(this,t)},_tileReady:function(t,e,i){if(this._map&&(!i||i.getAttribute("src")!==x))return $n.prototype._tileReady.call(this,t,e,i)}});function Rn(t,e){return new zn(t,e)}var Nn=zn.extend({defaultWmsParams:{service:"WMS",request:"GetMap",layers:"",styles:"",format:"image/jpeg",transparent:!1,version:"1.1.1"},options:{crs:null,uppercase:!1},initialize:function(t,e){this._url=t;var i=n({},this.defaultWmsParams);for(var o in e)o in this.options||(i[o]=e[o]);var s=(e=m(this,e)).detectRetina&&At?2:1,r=this.getTileSize();i.width=r.x*s,i.height=r.y*s,this.wmsParams=i},onAdd:function(t){this._crs=this.options.crs||t.options.crs,this._wmsVersion=parseFloat(this.wmsParams.version);var e=this._wmsVersion>=1.3?"crs":"srs";this.wmsParams[e]=this._crs.code,zn.prototype.onAdd.call(this,t)},getTileUrl:function(t){var e=this._tileCoordsToNwSe(t),i=this._crs,n=N(i.project(e[0]),i.project(e[1])),o=n.min,s=n.max,r=(this._wmsVersion>=1.3&&this._crs===Fi?[o.y,o.x,s.y,s.x]:[o.x,o.y,s.x,s.y]).join(","),a=zn.prototype.getTileUrl.call(this,t);return a+g(this.wmsParams,a,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+r},setParams:function(t,e){return n(this.wmsParams,t),e||this.redraw(),this}});function jn(t,e){return new Nn(t,e)}zn.WMS=Nn,Rn.wms=jn;var Bn=Vi.extend({options:{padding:.1,tolerance:0},initialize:function(t){m(this,t),a(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),this._zoomAnimated&&ve(this._container,"leaflet-zoom-animated")),this.getPane().appendChild(this._container),this._update(),this.on("update",this._updatePaths,this)},onRemove:function(){this.off("update",this._updatePaths,this),this._destroyContainer()},getEvents:function(){var t={viewreset:this._reset,zoom:this._onZoom,moveend:this._update,zoomend:this._onZoomEnd};return this._zoomAnimated&&(t.zoomanim=this._onAnimZoom),t},_onAnimZoom:function(t){this._updateTransform(t.center,t.zoom)},_onZoom:function(){this._updateTransform(this._map.getCenter(),this._map.getZoom())},_updateTransform:function(t,e){var i=this._map.getZoomScale(e,this._zoom),n=Ee(this._container),o=this._map.getSize().multiplyBy(.5+this.options.padding),s=this._map.project(this._center,e),r=this._map.project(t,e).subtract(s),a=o.multiplyBy(-i).add(n).add(o).subtract(r);yt?Ce(this._container,a,i):Se(this._container,a)},_reset:function(){for(var t in this._update(),this._updateTransform(this._center,this._zoom),this._layers)this._layers[t]._reset()},_onZoomEnd:function(){for(var t in this._layers)this._layers[t]._project()},_updatePaths:function(){for(var t in this._layers)this._layers[t]._update()},_update:function(){var t=this.options.padding,e=this._map.getSize(),i=this._map.containerPointToLayerPoint(e.multiplyBy(-t)).round();this._bounds=new R(i,i.add(e.multiplyBy(1+2*t)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),Fn=Bn.extend({getEvents:function(){var t=Bn.prototype.getEvents.call(this);return t.viewprereset=this._onViewPreReset,t},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){Bn.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var t=this._container=document.createElement("canvas");Le(t,"mousemove",l(this._onMouseMove,32,this),this),Le(t,"click dblclick mousedown mouseup contextmenu",this._onClick,this),Le(t,"mouseout",this._handleMouseOut,this),this._ctx=t.getContext("2d")},_destroyContainer:function(){A(this._redrawRequest),delete this._ctx,ue(this._container),Re(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){for(var t in this._redrawBounds=null,this._layers)this._layers[t]._update();this._redraw()}},_update:function(){if(!this._map._animatingZoom||!this._bounds){Bn.prototype._update.call(this);var t=this._bounds,e=this._container,i=t.getSize(),n=At?2:1;Se(e,t.min),e.width=n*i.x,e.height=n*i.y,e.style.width=i.x+"px",e.style.height=i.y+"px",At&&this._ctx.scale(2,2),this._ctx.translate(-t.min.x,-t.min.y),this.fire("update")}},_reset:function(){Bn.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(t){this._updateDashArray(t),this._layers[a(t)]=t;var e=t._order={layer:t,prev:this._drawLast,next:null};this._drawLast&&(this._drawLast.next=e),this._drawLast=e,this._drawFirst=this._drawFirst||this._drawLast},_addPath:function(t){this._requestRedraw(t)},_removePath:function(t){var e=t._order,i=e.next,n=e.prev;i?i.prev=n:this._drawLast=n,n?n.next=i:this._drawFirst=i,delete t._order,delete this._layers[a(t)],this._requestRedraw(t)},_updatePath:function(t){this._extendRedrawBounds(t),t._project(),t._update(),this._requestRedraw(t)},_updateStyle:function(t){this._updateDashArray(t),this._requestRedraw(t)},_updateDashArray:function(t){if("string"==typeof t.options.dashArray){var e,i,n=t.options.dashArray.split(/[, ]+/),o=[];for(i=0;i<n.length;i++){if(e=Number(n[i]),isNaN(e))return;o.push(e)}t.options._dashArray=o}else t.options._dashArray=t.options.dashArray},_requestRedraw:function(t){this._map&&(this._extendRedrawBounds(t),this._redrawRequest=this._redrawRequest||E(this._redraw,this))},_extendRedrawBounds:function(t){if(t._pxBounds){var e=(t.options.weight||0)+1;this._redrawBounds=this._redrawBounds||new R,this._redrawBounds.extend(t._pxBounds.min.subtract([e,e])),this._redrawBounds.extend(t._pxBounds.max.add([e,e]))}},_redraw:function(){this._redrawRequest=null,this._redrawBounds&&(this._redrawBounds.min._floor(),this._redrawBounds.max._ceil()),this._clear(),this._draw(),this._redrawBounds=null},_clear:function(){var t=this._redrawBounds;if(t){var e=t.getSize();this._ctx.clearRect(t.min.x,t.min.y,e.x,e.y)}else this._ctx.clearRect(0,0,this._container.width,this._container.height)},_draw:function(){var t,e=this._redrawBounds;if(this._ctx.save(),e){var i=e.getSize();this._ctx.beginPath(),this._ctx.rect(e.min.x,e.min.y,i.x,i.y),this._ctx.clip()}this._drawing=!0;for(var n=this._drawFirst;n;n=n.next)t=n.layer,(!e||t._pxBounds&&t._pxBounds.intersects(e))&&t._updatePath();this._drawing=!1,this._ctx.restore()},_updatePoly:function(t,e){if(this._drawing){var i,n,o,s,r=t._parts,a=r.length,l=this._ctx;if(a){for(l.beginPath(),i=0;i<a;i++){for(n=0,o=r[i].length;n<o;n++)s=r[i][n],l[n?"lineTo":"moveTo"](s.x,s.y);e&&l.closePath()}this._fillStroke(l,t)}}},_updateCircle:function(t){if(this._drawing&&!t._empty()){var e=t._point,i=this._ctx,n=Math.max(Math.round(t._radius),1),o=(Math.max(Math.round(t._radiusY),1)||n)/n;1!==o&&(i.save(),i.scale(1,o)),i.beginPath(),i.arc(e.x,e.y/o,n,0,2*Math.PI,!1),1!==o&&i.restore(),this._fillStroke(i,t)}},_fillStroke:function(t,e){var i=e.options;i.fill&&(t.globalAlpha=i.fillOpacity,t.fillStyle=i.fillColor||i.color,t.fill(i.fillRule||"evenodd")),i.stroke&&0!==i.weight&&(t.setLineDash&&t.setLineDash(e.options&&e.options._dashArray||[]),t.globalAlpha=i.opacity,t.lineWidth=i.weight,t.strokeStyle=i.color,t.lineCap=i.lineCap,t.lineJoin=i.lineJoin,t.stroke())},_onClick:function(t){for(var e,i,n=this._map.mouseEventToLayerPoint(t),o=this._drawFirst;o;o=o.next)(e=o.layer).options.interactive&&e._containsPoint(n)&&!this._map._draggableMoved(e)&&(i=e);i&&(Xe(t),this._fireEvent([i],t))},_onMouseMove:function(t){if(this._map&&!this._map.dragging.moving()&&!this._map._animatingZoom){var e=this._map.mouseEventToLayerPoint(t);this._handleMouseHover(t,e)}},_handleMouseOut:function(t){var e=this._hoveredLayer;e&&(ye(this._container,"leaflet-interactive"),this._fireEvent([e],t,"mouseout"),this._hoveredLayer=null)},_handleMouseHover:function(t,e){for(var i,n,o=this._drawFirst;o;o=o.next)(i=o.layer).options.interactive&&i._containsPoint(e)&&(n=i);n!==this._hoveredLayer&&(this._handleMouseOut(t),n&&(ve(this._container,"leaflet-interactive"),this._fireEvent([n],t,"mouseover"),this._hoveredLayer=n)),this._hoveredLayer&&this._fireEvent([this._hoveredLayer],t)},_fireEvent:function(t,e,i){this._map._fireDOMEvent(e,i||e.type,t)},_bringToFront:function(t){var e=t._order;if(e){var i=e.next,n=e.prev;i&&(i.prev=n,n?n.next=i:i&&(this._drawFirst=i),e.prev=this._drawLast,this._drawLast.next=e,e.next=null,this._drawLast=e,this._requestRedraw(t))}},_bringToBack:function(t){var e=t._order;if(e){var i=e.next,n=e.prev;n&&(n.next=i,i?i.prev=n:n&&(this._drawLast=n),e.prev=null,e.next=this._drawFirst,this._drawFirst.prev=e,this._drawFirst=e,this._requestRedraw(t))}}});function qn(t){return Mt?new Fn(t):null}var Vn=function(){try{return document.namespaces.add("lvml","urn:schemas-microsoft-com:vml"),function(t){return document.createElement("<lvml:"+t+' class="lvml">')}}catch(t){return function(t){return document.createElement("<"+t+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}}(),Hn={_initContainer:function(){this._container=de("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(Bn.prototype._update.call(this),this.fire("update"))},_initPath:function(t){var e=t._container=Vn("shape");ve(e,"leaflet-vml-shape "+(this.options.className||"")),e.coordsize="1 1",t._path=Vn("path"),e.appendChild(t._path),this._updateStyle(t),this._layers[a(t)]=t},_addPath:function(t){var e=t._container;this._container.appendChild(e),t.options.interactive&&t.addInteractiveTarget(e)},_removePath:function(t){var e=t._container;ue(e),t.removeInteractiveTarget(e),delete this._layers[a(t)]},_updateStyle:function(t){var e=t._stroke,i=t._fill,n=t.options,o=t._container;o.stroked=!!n.stroke,o.filled=!!n.fill,n.stroke?(e||(e=t._stroke=Vn("stroke")),o.appendChild(e),e.weight=n.weight+"px",e.color=n.color,e.opacity=n.opacity,n.dashArray?e.dashStyle=y(n.dashArray)?n.dashArray.join(" "):n.dashArray.replace(/( *, *)/g," "):e.dashStyle="",e.endcap=n.lineCap.replace("butt","flat"),e.joinstyle=n.lineJoin):e&&(o.removeChild(e),t._stroke=null),n.fill?(i||(i=t._fill=Vn("fill")),o.appendChild(i),i.color=n.fillColor||n.color,i.opacity=n.fillOpacity):i&&(o.removeChild(i),t._fill=null)},_updateCircle:function(t){var e=t._point.round(),i=Math.round(t._radius),n=Math.round(t._radiusY||i);this._setPath(t,t._empty()?"M0 0":"AL "+e.x+","+e.y+" "+i+","+n+" 0,23592600")},_setPath:function(t,e){t._path.v=e},_bringToFront:function(t){me(t._container)},_bringToBack:function(t){ge(t._container)}},Un=Pt?Vn:K,Wn=Bn.extend({getEvents:function(){var t=Bn.prototype.getEvents.call(this);return t.zoomstart=this._onZoomStart,t},_initContainer:function(){this._container=Un("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=Un("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){ue(this._container),Re(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_onZoomStart:function(){this._update()},_update:function(){if(!this._map._animatingZoom||!this._bounds){Bn.prototype._update.call(this);var t=this._bounds,e=t.getSize(),i=this._container;this._svgSize&&this._svgSize.equals(e)||(this._svgSize=e,i.setAttribute("width",e.x),i.setAttribute("height",e.y)),Se(i,t.min),i.setAttribute("viewBox",[t.min.x,t.min.y,e.x,e.y].join(" ")),this.fire("update")}},_initPath:function(t){var e=t._path=Un("path");t.options.className&&ve(e,t.options.className),t.options.interactive&&ve(e,"leaflet-interactive"),this._updateStyle(t),this._layers[a(t)]=t},_addPath:function(t){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(t._path),t.addInteractiveTarget(t._path)},_removePath:function(t){ue(t._path),t.removeInteractiveTarget(t._path),delete this._layers[a(t)]},_updatePath:function(t){t._project(),t._update()},_updateStyle:function(t){var e=t._path,i=t.options;e&&(i.stroke?(e.setAttribute("stroke",i.color),e.setAttribute("stroke-opacity",i.opacity),e.setAttribute("stroke-width",i.weight),e.setAttribute("stroke-linecap",i.lineCap),e.setAttribute("stroke-linejoin",i.lineJoin),i.dashArray?e.setAttribute("stroke-dasharray",i.dashArray):e.removeAttribute("stroke-dasharray"),i.dashOffset?e.setAttribute("stroke-dashoffset",i.dashOffset):e.removeAttribute("stroke-dashoffset")):e.setAttribute("stroke","none"),i.fill?(e.setAttribute("fill",i.fillColor||i.color),e.setAttribute("fill-opacity",i.fillOpacity),e.setAttribute("fill-rule",i.fillRule||"evenodd")):e.setAttribute("fill","none"))},_updatePoly:function(t,e){this._setPath(t,Q(t._parts,e))},_updateCircle:function(t){var e=t._point,i=Math.max(Math.round(t._radius),1),n="a"+i+","+(Math.max(Math.round(t._radiusY),1)||i)+" 0 1,0 ",o=t._empty()?"M0 0":"M"+(e.x-i)+","+e.y+n+2*i+",0 "+n+2*-i+",0 ";this._setPath(t,o)},_setPath:function(t,e){t._path.setAttribute("d",e)},_bringToFront:function(t){me(t._path)},_bringToBack:function(t){ge(t._path)}});function Gn(t){return Tt||Pt?new Wn(t):null}Pt&&Wn.include(Hn),ii.include({getRenderer:function(t){var e=t.options.renderer||this._getPaneRenderer(t.options.pane)||this.options.renderer||this._renderer;return e||(e=this._renderer=this._createRenderer()),this.hasLayer(e)||this.addLayer(e),e},_getPaneRenderer:function(t){if("overlayPane"===t||void 0===t)return!1;var e=this._paneRenderers[t];return void 0===e&&(e=this._createRenderer({pane:t}),this._paneRenderers[t]=e),e},_createRenderer:function(t){return this.options.preferCanvas&&qn(t)||Gn(t)}});var Zn=ln.extend({initialize:function(t,e){ln.prototype.initialize.call(this,this._boundsToLatLngs(t),e)},setBounds:function(t){return this.setLatLngs(this._boundsToLatLngs(t))},_boundsToLatLngs:function(t){return[(t=B(t)).getSouthWest(),t.getNorthWest(),t.getNorthEast(),t.getSouthEast()]}});function Yn(t,e){return new Zn(t,e)}Wn.create=Un,Wn.pointsToPath=Q,hn.geometryToLayer=dn,hn.coordsToLatLng=un,hn.coordsToLatLngs=pn,hn.latLngToCoords=mn,hn.latLngsToCoords=gn,hn.getFeature=fn,hn.asFeature=vn,ii.mergeOptions({boxZoom:!0});var Xn=mi.extend({initialize:function(t){this._map=t,this._container=t._container,this._pane=t._panes.overlayPane,this._resetStateTimeout=0,t.on("unload",this._destroy,this)},addHooks:function(){Le(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){Re(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){ue(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){0!==this._resetStateTimeout&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(t){if(!t.shiftKey||1!==t.which&&1!==t.button)return!1;this._clearDeferredResetState(),this._resetState(),ee(),Me(),this._startPoint=this._map.mouseEventToContainerPoint(t),Le(document,{contextmenu:He,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(t){this._moved||(this._moved=!0,this._box=de("div","leaflet-zoom-box",this._container),ve(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(t);var e=new R(this._point,this._startPoint),i=e.getSize();Se(this._box,e.min),this._box.style.width=i.x+"px",this._box.style.height=i.y+"px"},_finish:function(){this._moved&&(ue(this._box),ye(this._container,"leaflet-crosshair")),ie(),Te(),Re(document,{contextmenu:He,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(t){if((1===t.which||1===t.button)&&(this._finish(),this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(s(this._resetState,this),0);var e=new j(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(e).fire("boxzoomend",{boxZoomBounds:e})}},_onKeyDown:function(t){27===t.keyCode&&this._finish()}});ii.addInitHook("addHandler","boxZoom",Xn),ii.mergeOptions({doubleClickZoom:!0});var Kn=mi.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(t){var e=this._map,i=e.getZoom(),n=e.options.zoomDelta,o=t.originalEvent.shiftKey?i-n:i+n;"center"===e.options.doubleClickZoom?e.setZoom(o):e.setZoomAround(t.containerPoint,o)}});ii.addInitHook("addHandler","doubleClickZoom",Kn),ii.mergeOptions({dragging:!0,inertia:!st,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var Qn=mi.extend({addHooks:function(){if(!this._draggable){var t=this._map;this._draggable=new xi(t._mapPane,t._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),t.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),t.on("zoomend",this._onZoomEnd,this),t.whenReady(this._onZoomEnd,this))}ve(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){ye(this._map._container,"leaflet-grab"),ye(this._map._container,"leaflet-touch-drag"),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var t=this._map;if(t._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var e=B(this._map.options.maxBounds);this._offsetLimit=N(this._map.latLngToContainerPoint(e.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(e.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))}else this._offsetLimit=null;t.fire("movestart").fire("dragstart"),t.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(t){if(this._map.options.inertia){var e=this._lastTime=+new Date,i=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(i),this._times.push(e),this._prunePositions(e)}this._map.fire("move",t).fire("drag",t)},_prunePositions:function(t){for(;this._positions.length>1&&t-this._times[0]>50;)this._positions.shift(),this._times.shift()},_onZoomEnd:function(){var t=this._map.getSize().divideBy(2),e=this._map.latLngToLayerPoint([0,0]);this._initialWorldOffset=e.subtract(t).x,this._worldWidth=this._map.getPixelWorldBounds().getSize().x},_viscousLimit:function(t,e){return t-(t-e)*this._viscosity},_onPreDragLimit:function(){if(this._viscosity&&this._offsetLimit){var t=this._draggable._newPos.subtract(this._draggable._startPos),e=this._offsetLimit;t.x<e.min.x&&(t.x=this._viscousLimit(t.x,e.min.x)),t.y<e.min.y&&(t.y=this._viscousLimit(t.y,e.min.y)),t.x>e.max.x&&(t.x=this._viscousLimit(t.x,e.max.x)),t.y>e.max.y&&(t.y=this._viscousLimit(t.y,e.max.y)),this._draggable._newPos=this._draggable._startPos.add(t)}},_onPreDragWrap:function(){var t=this._worldWidth,e=Math.round(t/2),i=this._initialWorldOffset,n=this._draggable._newPos.x,o=(n-e+i)%t+e-i,s=(n+e+i)%t-e-i,r=Math.abs(o+i)<Math.abs(s+i)?o:s;this._draggable._absPos=this._draggable._newPos.clone(),this._draggable._newPos.x=r},_onDragEnd:function(t){var e=this._map,i=e.options,n=!i.inertia||this._times.length<2;if(e.fire("dragend",t),n)e.fire("moveend");else{this._prunePositions(+new Date);var o=this._lastPos.subtract(this._positions[0]),s=(this._lastTime-this._times[0])/1e3,r=i.easeLinearity,a=o.multiplyBy(r/s),l=a.distanceTo([0,0]),c=Math.min(i.inertiaMaxSpeed,l),h=a.multiplyBy(c/l),d=c/(i.inertiaDeceleration*r),u=h.multiplyBy(-d/2).round();u.x||u.y?(u=e._limitOffset(u,e.options.maxBounds),E((function(){e.panBy(u,{duration:d,easeLinearity:r,noMoveStart:!0,animate:!0})}))):e.fire("moveend")}}});ii.addInitHook("addHandler","dragging",Qn),ii.mergeOptions({keyboard:!0,keyboardPanDelta:80});var Jn=mi.extend({keyCodes:{left:[37],right:[39],down:[40],up:[38],zoomIn:[187,107,61,171],zoomOut:[189,109,54,173]},initialize:function(t){this._map=t,this._setPanDelta(t.options.keyboardPanDelta),this._setZoomDelta(t.options.zoomDelta)},addHooks:function(){var t=this._map._container;t.tabIndex<=0&&(t.tabIndex="0"),Le(t,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.on({focus:this._addHooks,blur:this._removeHooks},this)},removeHooks:function(){this._removeHooks(),Re(this._map._container,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.off({focus:this._addHooks,blur:this._removeHooks},this)},_onMouseDown:function(){if(!this._focused){var t=document.body,e=document.documentElement,i=t.scrollTop||e.scrollTop,n=t.scrollLeft||e.scrollLeft;this._map._container.focus(),window.scrollTo(n,i)}},_onFocus:function(){this._focused=!0,this._map.fire("focus")},_onBlur:function(){this._focused=!1,this._map.fire("blur")},_setPanDelta:function(t){var e,i,n=this._panKeys={},o=this.keyCodes;for(e=0,i=o.left.length;e<i;e++)n[o.left[e]]=[-1*t,0];for(e=0,i=o.right.length;e<i;e++)n[o.right[e]]=[t,0];for(e=0,i=o.down.length;e<i;e++)n[o.down[e]]=[0,t];for(e=0,i=o.up.length;e<i;e++)n[o.up[e]]=[0,-1*t]},_setZoomDelta:function(t){var e,i,n=this._zoomKeys={},o=this.keyCodes;for(e=0,i=o.zoomIn.length;e<i;e++)n[o.zoomIn[e]]=t;for(e=0,i=o.zoomOut.length;e<i;e++)n[o.zoomOut[e]]=-t},_addHooks:function(){Le(document,"keydown",this._onKeyDown,this)},_removeHooks:function(){Re(document,"keydown",this._onKeyDown,this)},_onKeyDown:function(t){if(!(t.altKey||t.ctrlKey||t.metaKey)){var e,i=t.keyCode,n=this._map;if(i in this._panKeys)n._panAnim&&n._panAnim._inProgress||(e=this._panKeys[i],t.shiftKey&&(e=z(e).multiplyBy(3)),n.panBy(e),n.options.maxBounds&&n.panInsideBounds(n.options.maxBounds));else if(i in this._zoomKeys)n.setZoom(n.getZoom()+(t.shiftKey?3:1)*this._zoomKeys[i]);else{if(27!==i||!n._popup||!n._popup.options.closeOnEscapeKey)return;n.closePopup()}He(t)}}});ii.addInitHook("addHandler","keyboard",Jn),ii.mergeOptions({scrollWheelZoom:!0,wheelDebounceTime:40,wheelPxPerZoomLevel:60});var to=mi.extend({addHooks:function(){Le(this._map._container,"mousewheel",this._onWheelScroll,this),this._delta=0},removeHooks:function(){Re(this._map._container,"mousewheel",this._onWheelScroll,this)},_onWheelScroll:function(t){var e=Ge(t),i=this._map.options.wheelDebounceTime;this._delta+=e,this._lastMousePos=this._map.mouseEventToContainerPoint(t),this._startTime||(this._startTime=+new Date);var n=Math.max(i-(+new Date-this._startTime),0);clearTimeout(this._timer),this._timer=setTimeout(s(this._performZoom,this),n),He(t)},_performZoom:function(){var t=this._map,e=t.getZoom(),i=this._map.options.zoomSnap||0;t._stop();var n=this._delta/(4*this._map.options.wheelPxPerZoomLevel),o=4*Math.log(2/(1+Math.exp(-Math.abs(n))))/Math.LN2,s=i?Math.ceil(o/i)*i:o,r=t._limitZoom(e+(this._delta>0?s:-s))-e;this._delta=0,this._startTime=null,r&&("center"===t.options.scrollWheelZoom?t.setZoom(e+r):t.setZoomAround(this._lastMousePos,e+r))}});ii.addInitHook("addHandler","scrollWheelZoom",to),ii.mergeOptions({tap:!0,tapTolerance:15});var eo=mi.extend({addHooks:function(){Le(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){Re(this._map._container,"touchstart",this._onDown,this)},_onDown:function(t){if(t.touches){if(Ve(t),this._fireClick=!0,t.touches.length>1)return this._fireClick=!1,void clearTimeout(this._holdTimeout);var e=t.touches[0],i=e.target;this._startPos=this._newPos=new O(e.clientX,e.clientY),i.tagName&&"a"===i.tagName.toLowerCase()&&ve(i,"leaflet-active"),this._holdTimeout=setTimeout(s((function(){this._isTapValid()&&(this._fireClick=!1,this._onUp(),this._simulateEvent("contextmenu",e))}),this),1e3),this._simulateEvent("mousedown",e),Le(document,{touchmove:this._onMove,touchend:this._onUp},this)}},_onUp:function(t){if(clearTimeout(this._holdTimeout),Re(document,{touchmove:this._onMove,touchend:this._onUp},this),this._fireClick&&t&&t.changedTouches){var e=t.changedTouches[0],i=e.target;i&&i.tagName&&"a"===i.tagName.toLowerCase()&&ye(i,"leaflet-active"),this._simulateEvent("mouseup",e),this._isTapValid()&&this._simulateEvent("click",e)}},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_onMove:function(t){var e=t.touches[0];this._newPos=new O(e.clientX,e.clientY),this._simulateEvent("mousemove",e)},_simulateEvent:function(t,e){var i=document.createEvent("MouseEvents");i._simulated=!0,e.target._simulatedClick=!0,i.initMouseEvent(t,!0,!0,window,1,e.screenX,e.screenY,e.clientX,e.clientY,!1,!1,!1,!1,0,null),e.target.dispatchEvent(i)}});Ct&&!kt&&ii.addInitHook("addHandler","tap",eo),ii.mergeOptions({touchZoom:Ct&&!st,bounceAtZoomLimits:!0});var io=mi.extend({addHooks:function(){ve(this._map._container,"leaflet-touch-zoom"),Le(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){ye(this._map._container,"leaflet-touch-zoom"),Re(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(t){var e=this._map;if(t.touches&&2===t.touches.length&&!e._animatingZoom&&!this._zooming){var i=e.mouseEventToContainerPoint(t.touches[0]),n=e.mouseEventToContainerPoint(t.touches[1]);this._centerPoint=e.getSize()._divideBy(2),this._startLatLng=e.containerPointToLatLng(this._centerPoint),"center"!==e.options.touchZoom&&(this._pinchStartLatLng=e.containerPointToLatLng(i.add(n)._divideBy(2))),this._startDist=i.distanceTo(n),this._startZoom=e.getZoom(),this._moved=!1,this._zooming=!0,e._stop(),Le(document,"touchmove",this._onTouchMove,this),Le(document,"touchend",this._onTouchEnd,this),Ve(t)}},_onTouchMove:function(t){if(t.touches&&2===t.touches.length&&this._zooming){var e=this._map,i=e.mouseEventToContainerPoint(t.touches[0]),n=e.mouseEventToContainerPoint(t.touches[1]),o=i.distanceTo(n)/this._startDist;if(this._zoom=e.getScaleZoom(o,this._startZoom),!e.options.bounceAtZoomLimits&&(this._zoom<e.getMinZoom()&&o<1||this._zoom>e.getMaxZoom()&&o>1)&&(this._zoom=e._limitZoom(this._zoom)),"center"===e.options.touchZoom){if(this._center=this._startLatLng,1===o)return}else{var r=i._add(n)._divideBy(2)._subtract(this._centerPoint);if(1===o&&0===r.x&&0===r.y)return;this._center=e.unproject(e.project(this._pinchStartLatLng,this._zoom).subtract(r),this._zoom)}this._moved||(e._moveStart(!0,!1),this._moved=!0),A(this._animRequest);var a=s(e._move,e,this._center,this._zoom,{pinch:!0,round:!1});this._animRequest=E(a,this,!0),Ve(t)}},_onTouchEnd:function(){this._moved&&this._zooming?(this._zooming=!1,A(this._animRequest),Re(document,"touchmove",this._onTouchMove),Re(document,"touchend",this._onTouchEnd),this._map.options.zoomAnimation?this._map._animateZoom(this._center,this._map._limitZoom(this._zoom),!0,this._map.options.zoomSnap):this._map._resetView(this._center,this._map._limitZoom(this._zoom))):this._zooming=!1}});ii.addInitHook("addHandler","touchZoom",io),ii.BoxZoom=Xn,ii.DoubleClickZoom=Kn,ii.Drag=Qn,ii.Keyboard=Jn,ii.ScrollWheelZoom=to,ii.Tap=eo,ii.TouchZoom=io,Object.freeze=i,t.version=e,t.Control=oi,t.control=si,t.Browser=It,t.Evented=I,t.Mixin=fi,t.Util=M,t.Class=T,t.Handler=mi,t.extend=n,t.bind=s,t.stamp=a,t.setOptions=m,t.DomEvent=ti,t.DomUtil=$e,t.PosAnimation=ei,t.Draggable=xi,t.LineUtil=$i,t.PolyUtil=zi,t.Point=O,t.point=z,t.Bounds=R,t.bounds=N,t.Transformation=G,t.transformation=Z,t.Projection=ji,t.LatLng=F,t.latLng=q,t.LatLngBounds=j,t.latLngBounds=B,t.CRS=V,t.GeoJSON=hn,t.geoJSON=bn,t.geoJson=xn,t.Layer=Vi,t.LayerGroup=Hi,t.layerGroup=Ui,t.FeatureGroup=Wi,t.featureGroup=Gi,t.ImageOverlay=_n,t.imageOverlay=wn,t.VideoOverlay=kn,t.videoOverlay=Cn,t.SVGOverlay=Sn,t.svgOverlay=En,t.DivOverlay=An,t.Popup=Mn,t.popup=Tn,t.Tooltip=Pn,t.tooltip=Dn,t.Icon=Zi,t.icon=Yi,t.DivIcon=In,t.divIcon=On,t.Marker=Qi,t.marker=Ji,t.TileLayer=zn,t.tileLayer=Rn,t.GridLayer=$n,t.gridLayer=Ln,t.SVG=Wn,t.svg=Gn,t.Renderer=Bn,t.Canvas=Fn,t.canvas=qn,t.Path=tn,t.CircleMarker=en,t.circleMarker=nn,t.Circle=on,t.circle=sn,t.Polyline=rn,t.polyline=an,t.Polygon=ln,t.polygon=cn,t.Rectangle=Zn,t.rectangle=Yn,t.Map=ii,t.map=ni;var no=window.L;t.noConflict=function(){return window.L=no,this},window.L=t})(YM.exports);var XM=YM.exports;const KM={weight:1,opacity:1,color:"white",fillOpacity:.7,fillColor:"#2387ca"},QM={weight:3,color:"white",fillOpacity:1,fillColor:"#2387ca"},JM=()=>KM;class tT extends ct{static get styles(){return a`
|
|
10917
|
+
`}}t([mt({type:Array,attribute:!1})],QM.prototype,"path",void 0),t([mt()],QM.prototype,"endpoint",void 0),t([mt()],QM.prototype,"osmId",void 0),t([mt({type:Object})],QM.prototype,"hovered",void 0),t([mt({type:Object})],QM.prototype,"editFeature",void 0),t([mt({type:String,attribute:!1})],QM.prototype,"editFeatureAliases",void 0);"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var JM={exports:{}};(function(t){var e="1.5.1+build.2e3e0ffb",i=Object.freeze;function n(t){var e,i,n,o;for(i=1,n=arguments.length;i<n;i++)for(e in o=arguments[i])t[e]=o[e];return t}Object.freeze=function(t){return t};var o=Object.create||function(){function t(){}return function(e){return t.prototype=e,new t}}();function s(t,e){var i=Array.prototype.slice;if(t.bind)return t.bind.apply(t,i.call(arguments,1));var n=i.call(arguments,2);return function(){return t.apply(e,n.length?n.concat(i.call(arguments)):arguments)}}var r=0;function a(t){return t._leaflet_id=t._leaflet_id||++r,t._leaflet_id}function l(t,e,i){var n,o,s,r;return r=function(){n=!1,o&&(s.apply(i,o),o=!1)},s=function(){n?o=arguments:(t.apply(i,arguments),setTimeout(r,e),n=!0)},s}function c(t,e,i){var n=e[1],o=e[0],s=n-o;return t===n&&i?t:((t-o)%s+s)%s+o}function h(){return!1}function d(t,e){return e=void 0===e?6:e,+(Math.round(t+"e+"+e)+"e-"+e)}function u(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function p(t){return u(t).split(/\s+/)}function m(t,e){for(var i in t.hasOwnProperty("options")||(t.options=t.options?o(t.options):{}),e)t.options[i]=e[i];return t.options}function g(t,e,i){var n=[];for(var o in t)n.push(encodeURIComponent(i?o.toUpperCase():o)+"="+encodeURIComponent(t[o]));return(e&&-1!==e.indexOf("?")?"&":"?")+n.join("&")}var f=/\{ *([\w_-]+) *\}/g;function v(t,e){return t.replace(f,(function(t,i){var n=e[i];if(void 0===n)throw new Error("No value provided for variable "+t);return"function"==typeof n&&(n=n(e)),n}))}var y=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function b(t,e){for(var i=0;i<t.length;i++)if(t[i]===e)return i;return-1}var x="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=";function _(t){return window["webkit"+t]||window["moz"+t]||window["ms"+t]}var w=0;function k(t){var e=+new Date,i=Math.max(0,16-(e-w));return w=e+i,window.setTimeout(t,i)}var C=window.requestAnimationFrame||_("RequestAnimationFrame")||k,S=window.cancelAnimationFrame||_("CancelAnimationFrame")||_("CancelRequestAnimationFrame")||function(t){window.clearTimeout(t)};function E(t,e,i){if(!i||C!==k)return C.call(window,s(t,e));t.call(e)}function A(t){t&&S.call(window,t)}var M=(Object.freeze||Object)({freeze:i,extend:n,create:o,bind:s,lastId:r,stamp:a,throttle:l,wrapNum:c,falseFn:h,formatNum:d,trim:u,splitWords:p,setOptions:m,getParamString:g,template:v,isArray:y,indexOf:b,emptyImageUrl:x,requestFn:C,cancelFn:S,requestAnimFrame:E,cancelAnimFrame:A});function T(){}function P(t){if("undefined"!=typeof L&&L&&L.Mixin){t=y(t)?t:[t];for(var e=0;e<t.length;e++)t[e]===L.Mixin.Events&&console.warn("Deprecated include of L.Mixin.Events: this property will be removed in future releases, please inherit from L.Evented instead.",(new Error).stack)}}T.extend=function(t){var e=function(){this.initialize&&this.initialize.apply(this,arguments),this.callInitHooks()},i=e.__super__=this.prototype,s=o(i);for(var r in s.constructor=e,e.prototype=s,this)this.hasOwnProperty(r)&&"prototype"!==r&&"__super__"!==r&&(e[r]=this[r]);return t.statics&&(n(e,t.statics),delete t.statics),t.includes&&(P(t.includes),n.apply(null,[s].concat(t.includes)),delete t.includes),s.options&&(t.options=n(o(s.options),t.options)),n(s,t),s._initHooks=[],s.callInitHooks=function(){if(!this._initHooksCalled){i.callInitHooks&&i.callInitHooks.call(this),this._initHooksCalled=!0;for(var t=0,e=s._initHooks.length;t<e;t++)s._initHooks[t].call(this)}},e},T.include=function(t){return n(this.prototype,t),this},T.mergeOptions=function(t){return n(this.prototype.options,t),this},T.addInitHook=function(t){var e=Array.prototype.slice.call(arguments,1),i="function"==typeof t?t:function(){this[t].apply(this,e)};return this.prototype._initHooks=this.prototype._initHooks||[],this.prototype._initHooks.push(i),this};var D={on:function(t,e,i){if("object"==typeof t)for(var n in t)this._on(n,t[n],e);else for(var o=0,s=(t=p(t)).length;o<s;o++)this._on(t[o],e,i);return this},off:function(t,e,i){if(t)if("object"==typeof t)for(var n in t)this._off(n,t[n],e);else for(var o=0,s=(t=p(t)).length;o<s;o++)this._off(t[o],e,i);else delete this._events;return this},_on:function(t,e,i){this._events=this._events||{};var n=this._events[t];n||(n=[],this._events[t]=n),i===this&&(i=void 0);for(var o={fn:e,ctx:i},s=n,r=0,a=s.length;r<a;r++)if(s[r].fn===e&&s[r].ctx===i)return;s.push(o)},_off:function(t,e,i){var n,o,s;if(this._events&&(n=this._events[t]))if(e){if(i===this&&(i=void 0),n)for(o=0,s=n.length;o<s;o++){var r=n[o];if(r.ctx===i&&r.fn===e)return r.fn=h,this._firingCount&&(this._events[t]=n=n.slice()),void n.splice(o,1)}}else{for(o=0,s=n.length;o<s;o++)n[o].fn=h;delete this._events[t]}},fire:function(t,e,i){if(!this.listens(t,i))return this;var o=n({},e,{type:t,target:this,sourceTarget:e&&e.sourceTarget||this});if(this._events){var s=this._events[t];if(s){this._firingCount=this._firingCount+1||1;for(var r=0,a=s.length;r<a;r++){var l=s[r];l.fn.call(l.ctx||this,o)}this._firingCount--}}return i&&this._propagateEvent(o),this},listens:function(t,e){var i=this._events&&this._events[t];if(i&&i.length)return!0;if(e)for(var n in this._eventParents)if(this._eventParents[n].listens(t,e))return!0;return!1},once:function(t,e,i){if("object"==typeof t){for(var n in t)this.once(n,t[n],e);return this}var o=s((function(){this.off(t,e,i).off(t,o,i)}),this);return this.on(t,e,i).on(t,o,i)},addEventParent:function(t){return this._eventParents=this._eventParents||{},this._eventParents[a(t)]=t,this},removeEventParent:function(t){return this._eventParents&&delete this._eventParents[a(t)],this},_propagateEvent:function(t){for(var e in this._eventParents)this._eventParents[e].fire(t.type,n({layer:t.target,propagatedFrom:t.target},t),!0)}};D.addEventListener=D.on,D.removeEventListener=D.clearAllEventListeners=D.off,D.addOneTimeEventListener=D.once,D.fireEvent=D.fire,D.hasEventListeners=D.listens;var I=T.extend(D);function O(t,e,i){this.x=i?Math.round(t):t,this.y=i?Math.round(e):e}var $=Math.trunc||function(t){return t>0?Math.floor(t):Math.ceil(t)};function z(t,e,i){return t instanceof O?t:y(t)?new O(t[0],t[1]):null==t?t:"object"==typeof t&&"x"in t&&"y"in t?new O(t.x,t.y):new O(t,e,i)}function R(t,e){if(t)for(var i=e?[t,e]:t,n=0,o=i.length;n<o;n++)this.extend(i[n])}function N(t,e){return!t||t instanceof R?t:new R(t,e)}function j(t,e){if(t)for(var i=e?[t,e]:t,n=0,o=i.length;n<o;n++)this.extend(i[n])}function B(t,e){return t instanceof j?t:new j(t,e)}function F(t,e,i){if(isNaN(t)||isNaN(e))throw new Error("Invalid LatLng object: ("+t+", "+e+")");this.lat=+t,this.lng=+e,void 0!==i&&(this.alt=+i)}function q(t,e,i){return t instanceof F?t:y(t)&&"object"!=typeof t[0]?3===t.length?new F(t[0],t[1],t[2]):2===t.length?new F(t[0],t[1]):null:null==t?t:"object"==typeof t&&"lat"in t?new F(t.lat,"lng"in t?t.lng:t.lon,t.alt):void 0===e?null:new F(t,e,i)}O.prototype={clone:function(){return new O(this.x,this.y)},add:function(t){return this.clone()._add(z(t))},_add:function(t){return this.x+=t.x,this.y+=t.y,this},subtract:function(t){return this.clone()._subtract(z(t))},_subtract:function(t){return this.x-=t.x,this.y-=t.y,this},divideBy:function(t){return this.clone()._divideBy(t)},_divideBy:function(t){return this.x/=t,this.y/=t,this},multiplyBy:function(t){return this.clone()._multiplyBy(t)},_multiplyBy:function(t){return this.x*=t,this.y*=t,this},scaleBy:function(t){return new O(this.x*t.x,this.y*t.y)},unscaleBy:function(t){return new O(this.x/t.x,this.y/t.y)},round:function(){return this.clone()._round()},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},floor:function(){return this.clone()._floor()},_floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.clone()._ceil()},_ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},trunc:function(){return this.clone()._trunc()},_trunc:function(){return this.x=$(this.x),this.y=$(this.y),this},distanceTo:function(t){var e=(t=z(t)).x-this.x,i=t.y-this.y;return Math.sqrt(e*e+i*i)},equals:function(t){return(t=z(t)).x===this.x&&t.y===this.y},contains:function(t){return t=z(t),Math.abs(t.x)<=Math.abs(this.x)&&Math.abs(t.y)<=Math.abs(this.y)},toString:function(){return"Point("+d(this.x)+", "+d(this.y)+")"}},R.prototype={extend:function(t){return t=z(t),this.min||this.max?(this.min.x=Math.min(t.x,this.min.x),this.max.x=Math.max(t.x,this.max.x),this.min.y=Math.min(t.y,this.min.y),this.max.y=Math.max(t.y,this.max.y)):(this.min=t.clone(),this.max=t.clone()),this},getCenter:function(t){return new O((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,t)},getBottomLeft:function(){return new O(this.min.x,this.max.y)},getTopRight:function(){return new O(this.max.x,this.min.y)},getTopLeft:function(){return this.min},getBottomRight:function(){return this.max},getSize:function(){return this.max.subtract(this.min)},contains:function(t){var e,i;return(t="number"==typeof t[0]||t instanceof O?z(t):N(t))instanceof R?(e=t.min,i=t.max):e=i=t,e.x>=this.min.x&&i.x<=this.max.x&&e.y>=this.min.y&&i.y<=this.max.y},intersects:function(t){t=N(t);var e=this.min,i=this.max,n=t.min,o=t.max,s=o.x>=e.x&&n.x<=i.x,r=o.y>=e.y&&n.y<=i.y;return s&&r},overlaps:function(t){t=N(t);var e=this.min,i=this.max,n=t.min,o=t.max,s=o.x>e.x&&n.x<i.x,r=o.y>e.y&&n.y<i.y;return s&&r},isValid:function(){return!(!this.min||!this.max)}},j.prototype={extend:function(t){var e,i,n=this._southWest,o=this._northEast;if(t instanceof F)e=t,i=t;else{if(!(t instanceof j))return t?this.extend(q(t)||B(t)):this;if(e=t._southWest,i=t._northEast,!e||!i)return this}return n||o?(n.lat=Math.min(e.lat,n.lat),n.lng=Math.min(e.lng,n.lng),o.lat=Math.max(i.lat,o.lat),o.lng=Math.max(i.lng,o.lng)):(this._southWest=new F(e.lat,e.lng),this._northEast=new F(i.lat,i.lng)),this},pad:function(t){var e=this._southWest,i=this._northEast,n=Math.abs(e.lat-i.lat)*t,o=Math.abs(e.lng-i.lng)*t;return new j(new F(e.lat-n,e.lng-o),new F(i.lat+n,i.lng+o))},getCenter:function(){return new F((this._southWest.lat+this._northEast.lat)/2,(this._southWest.lng+this._northEast.lng)/2)},getSouthWest:function(){return this._southWest},getNorthEast:function(){return this._northEast},getNorthWest:function(){return new F(this.getNorth(),this.getWest())},getSouthEast:function(){return new F(this.getSouth(),this.getEast())},getWest:function(){return this._southWest.lng},getSouth:function(){return this._southWest.lat},getEast:function(){return this._northEast.lng},getNorth:function(){return this._northEast.lat},contains:function(t){t="number"==typeof t[0]||t instanceof F||"lat"in t?q(t):B(t);var e,i,n=this._southWest,o=this._northEast;return t instanceof j?(e=t.getSouthWest(),i=t.getNorthEast()):e=i=t,e.lat>=n.lat&&i.lat<=o.lat&&e.lng>=n.lng&&i.lng<=o.lng},intersects:function(t){t=B(t);var e=this._southWest,i=this._northEast,n=t.getSouthWest(),o=t.getNorthEast(),s=o.lat>=e.lat&&n.lat<=i.lat,r=o.lng>=e.lng&&n.lng<=i.lng;return s&&r},overlaps:function(t){t=B(t);var e=this._southWest,i=this._northEast,n=t.getSouthWest(),o=t.getNorthEast(),s=o.lat>e.lat&&n.lat<i.lat,r=o.lng>e.lng&&n.lng<i.lng;return s&&r},toBBoxString:function(){return[this.getWest(),this.getSouth(),this.getEast(),this.getNorth()].join(",")},equals:function(t,e){return!!t&&(t=B(t),this._southWest.equals(t.getSouthWest(),e)&&this._northEast.equals(t.getNorthEast(),e))},isValid:function(){return!(!this._southWest||!this._northEast)}},F.prototype={equals:function(t,e){return!!t&&(t=q(t),Math.max(Math.abs(this.lat-t.lat),Math.abs(this.lng-t.lng))<=(void 0===e?1e-9:e))},toString:function(t){return"LatLng("+d(this.lat,t)+", "+d(this.lng,t)+")"},distanceTo:function(t){return H.distance(this,q(t))},wrap:function(){return H.wrapLatLng(this)},toBounds:function(t){var e=180*t/40075017,i=e/Math.cos(Math.PI/180*this.lat);return B([this.lat-e,this.lng-i],[this.lat+e,this.lng+i])},clone:function(){return new F(this.lat,this.lng,this.alt)}};var V={latLngToPoint:function(t,e){var i=this.projection.project(t),n=this.scale(e);return this.transformation._transform(i,n)},pointToLatLng:function(t,e){var i=this.scale(e),n=this.transformation.untransform(t,i);return this.projection.unproject(n)},project:function(t){return this.projection.project(t)},unproject:function(t){return this.projection.unproject(t)},scale:function(t){return 256*Math.pow(2,t)},zoom:function(t){return Math.log(t/256)/Math.LN2},getProjectedBounds:function(t){if(this.infinite)return null;var e=this.projection.bounds,i=this.scale(t);return new R(this.transformation.transform(e.min,i),this.transformation.transform(e.max,i))},infinite:!1,wrapLatLng:function(t){var e=this.wrapLng?c(t.lng,this.wrapLng,!0):t.lng;return new F(this.wrapLat?c(t.lat,this.wrapLat,!0):t.lat,e,t.alt)},wrapLatLngBounds:function(t){var e=t.getCenter(),i=this.wrapLatLng(e),n=e.lat-i.lat,o=e.lng-i.lng;if(0===n&&0===o)return t;var s=t.getSouthWest(),r=t.getNorthEast();return new j(new F(s.lat-n,s.lng-o),new F(r.lat-n,r.lng-o))}},H=n({},V,{wrapLng:[-180,180],R:6371e3,distance:function(t,e){var i=Math.PI/180,n=t.lat*i,o=e.lat*i,s=Math.sin((e.lat-t.lat)*i/2),r=Math.sin((e.lng-t.lng)*i/2),a=s*s+Math.cos(n)*Math.cos(o)*r*r,l=2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a));return this.R*l}}),U=6378137,W={R:U,MAX_LATITUDE:85.0511287798,project:function(t){var e=Math.PI/180,i=this.MAX_LATITUDE,n=Math.max(Math.min(i,t.lat),-i),o=Math.sin(n*e);return new O(this.R*t.lng*e,this.R*Math.log((1+o)/(1-o))/2)},unproject:function(t){var e=180/Math.PI;return new F((2*Math.atan(Math.exp(t.y/this.R))-Math.PI/2)*e,t.x*e/this.R)},bounds:function(){var t=U*Math.PI;return new R([-t,-t],[t,t])}()};function G(t,e,i,n){if(y(t))return this._a=t[0],this._b=t[1],this._c=t[2],void(this._d=t[3]);this._a=t,this._b=e,this._c=i,this._d=n}function Z(t,e,i,n){return new G(t,e,i,n)}G.prototype={transform:function(t,e){return this._transform(t.clone(),e)},_transform:function(t,e){return e=e||1,t.x=e*(this._a*t.x+this._b),t.y=e*(this._c*t.y+this._d),t},untransform:function(t,e){return e=e||1,new O((t.x/e-this._b)/this._a,(t.y/e-this._d)/this._c)}};var Y=n({},H,{code:"EPSG:3857",projection:W,transformation:function(){var t=.5/(Math.PI*W.R);return Z(t,.5,-t,.5)}()}),X=n({},Y,{code:"EPSG:900913"});function K(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function Q(t,e){var i,n,o,s,r,a,l="";for(i=0,o=t.length;i<o;i++){for(n=0,s=(r=t[i]).length;n<s;n++)l+=(n?"L":"M")+(a=r[n]).x+" "+a.y;l+=e?Tt?"z":"x":""}return l||"M0 0"}var J=document.documentElement.style,tt="ActiveXObject"in window,et=tt&&!document.addEventListener,it="msLaunchUri"in navigator&&!("documentMode"in document),nt=Dt("webkit"),ot=Dt("android"),st=Dt("android 2")||Dt("android 3"),rt=parseInt(/WebKit\/([0-9]+)|$/.exec(navigator.userAgent)[1],10),at=ot&&Dt("Google")&&rt<537&&!("AudioNode"in window),lt=!!window.opera,ct=Dt("chrome"),ht=Dt("gecko")&&!nt&&!lt&&!tt,dt=!ct&&Dt("safari"),ut=Dt("phantom"),pt="OTransition"in J,mt=0===navigator.platform.indexOf("Win"),gt=tt&&"transition"in J,ft="WebKitCSSMatrix"in window&&"m11"in new window.WebKitCSSMatrix&&!st,vt="MozPerspective"in J,yt=!window.L_DISABLE_3D&&(gt||ft||vt)&&!pt&&!ut,bt="undefined"!=typeof orientation||Dt("mobile"),xt=bt&&nt,_t=bt&&ft,wt=!window.PointerEvent&&window.MSPointerEvent,kt=!(!window.PointerEvent&&!wt),Ct=!window.L_NO_TOUCH&&(kt||"ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch),St=bt&<,Et=bt&&ht,At=(window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI)>1,Mt=!!document.createElement("canvas").getContext,Tt=!(!document.createElementNS||!K("svg").createSVGRect),Pt=!Tt&&function(){try{var t=document.createElement("div");t.innerHTML='<v:shape adj="1"/>';var e=t.firstChild;return e.style.behavior="url(#default#VML)",e&&"object"==typeof e.adj}catch(t){return!1}}();function Dt(t){return navigator.userAgent.toLowerCase().indexOf(t)>=0}var It=(Object.freeze||Object)({ie:tt,ielt9:et,edge:it,webkit:nt,android:ot,android23:st,androidStock:at,opera:lt,chrome:ct,gecko:ht,safari:dt,phantom:ut,opera12:pt,win:mt,ie3d:gt,webkit3d:ft,gecko3d:vt,any3d:yt,mobile:bt,mobileWebkit:xt,mobileWebkit3d:_t,msPointer:wt,pointer:kt,touch:Ct,mobileOpera:St,mobileGecko:Et,retina:At,canvas:Mt,svg:Tt,vml:Pt}),Ot=wt?"MSPointerDown":"pointerdown",$t=wt?"MSPointerMove":"pointermove",Lt=wt?"MSPointerUp":"pointerup",zt=wt?"MSPointerCancel":"pointercancel",Rt=["INPUT","SELECT","OPTION"],Nt={},jt=!1,Bt=0;function Ft(t,e,i,n){return"touchstart"===e?Vt(t,i,n):"touchmove"===e?Zt(t,i,n):"touchend"===e&&Yt(t,i,n),this}function qt(t,e,i){var n=t["_leaflet_"+e+i];return"touchstart"===e?t.removeEventListener(Ot,n,!1):"touchmove"===e?t.removeEventListener($t,n,!1):"touchend"===e&&(t.removeEventListener(Lt,n,!1),t.removeEventListener(zt,n,!1)),this}function Vt(t,e,i){var n=s((function(t){if("mouse"!==t.pointerType&&t.MSPOINTER_TYPE_MOUSE&&t.pointerType!==t.MSPOINTER_TYPE_MOUSE){if(!(Rt.indexOf(t.target.tagName)<0))return;Ve(t)}Gt(t,e)}));t["_leaflet_touchstart"+i]=n,t.addEventListener(Ot,n,!1),jt||(document.documentElement.addEventListener(Ot,Ht,!0),document.documentElement.addEventListener($t,Ut,!0),document.documentElement.addEventListener(Lt,Wt,!0),document.documentElement.addEventListener(zt,Wt,!0),jt=!0)}function Ht(t){Nt[t.pointerId]=t,Bt++}function Ut(t){Nt[t.pointerId]&&(Nt[t.pointerId]=t)}function Wt(t){delete Nt[t.pointerId],Bt--}function Gt(t,e){for(var i in t.touches=[],Nt)t.touches.push(Nt[i]);t.changedTouches=[t],e(t)}function Zt(t,e,i){var n=function(t){(t.pointerType!==t.MSPOINTER_TYPE_MOUSE&&"mouse"!==t.pointerType||0!==t.buttons)&&Gt(t,e)};t["_leaflet_touchmove"+i]=n,t.addEventListener($t,n,!1)}function Yt(t,e,i){var n=function(t){Gt(t,e)};t["_leaflet_touchend"+i]=n,t.addEventListener(Lt,n,!1),t.addEventListener(zt,n,!1)}var Xt=wt?"MSPointerDown":kt?"pointerdown":"touchstart",Kt=wt?"MSPointerUp":kt?"pointerup":"touchend",Qt="_leaflet_";function Jt(t,e,i){var n,o,s=!1,r=250;function a(t){var e;if(kt){if(!it||"mouse"===t.pointerType)return;e=Bt}else e=t.touches.length;if(!(e>1)){var i=Date.now(),a=i-(n||i);o=t.touches?t.touches[0]:t,s=a>0&&a<=r,n=i}}function l(t){if(s&&!o.cancelBubble){if(kt){if(!it||"mouse"===t.pointerType)return;var i,r,a={};for(r in o)i=o[r],a[r]=i&&i.bind?i.bind(o):i;o=a}o.type="dblclick",o.button=0,e(o),n=null}}return t[Qt+Xt+i]=a,t[Qt+Kt+i]=l,t[Qt+"dblclick"+i]=e,t.addEventListener(Xt,a,!1),t.addEventListener(Kt,l,!1),t.addEventListener("dblclick",e,!1),this}function te(t,e){var i=t[Qt+Xt+e],n=t[Qt+Kt+e],o=t[Qt+"dblclick"+e];return t.removeEventListener(Xt,i,!1),t.removeEventListener(Kt,n,!1),it||t.removeEventListener("dblclick",o,!1),this}var ee,ie,ne,oe,se,re=ke(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),ae=ke(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),le="webkitTransition"===ae||"OTransition"===ae?ae+"End":"transitionend";function ce(t){return"string"==typeof t?document.getElementById(t):t}function he(t,e){var i=t.style[e]||t.currentStyle&&t.currentStyle[e];if((!i||"auto"===i)&&document.defaultView){var n=document.defaultView.getComputedStyle(t,null);i=n?n[e]:null}return"auto"===i?null:i}function de(t,e,i){var n=document.createElement(t);return n.className=e||"",i&&i.appendChild(n),n}function ue(t){var e=t.parentNode;e&&e.removeChild(t)}function pe(t){for(;t.firstChild;)t.removeChild(t.firstChild)}function me(t){var e=t.parentNode;e&&e.lastChild!==t&&e.appendChild(t)}function ge(t){var e=t.parentNode;e&&e.firstChild!==t&&e.insertBefore(t,e.firstChild)}function fe(t,e){if(void 0!==t.classList)return t.classList.contains(e);var i=xe(t);return i.length>0&&new RegExp("(^|\\s)"+e+"(\\s|$)").test(i)}function ve(t,e){if(void 0!==t.classList)for(var i=p(e),n=0,o=i.length;n<o;n++)t.classList.add(i[n]);else if(!fe(t,e)){var s=xe(t);be(t,(s?s+" ":"")+e)}}function ye(t,e){void 0!==t.classList?t.classList.remove(e):be(t,u((" "+xe(t)+" ").replace(" "+e+" "," ")))}function be(t,e){void 0===t.className.baseVal?t.className=e:t.className.baseVal=e}function xe(t){return t.correspondingElement&&(t=t.correspondingElement),void 0===t.className.baseVal?t.className:t.className.baseVal}function _e(t,e){"opacity"in t.style?t.style.opacity=e:"filter"in t.style&&we(t,e)}function we(t,e){var i=!1,n="DXImageTransform.Microsoft.Alpha";try{i=t.filters.item(n)}catch(t){if(1===e)return}e=Math.round(100*e),i?(i.Enabled=100!==e,i.Opacity=e):t.style.filter+=" progid:"+n+"(opacity="+e+")"}function ke(t){for(var e=document.documentElement.style,i=0;i<t.length;i++)if(t[i]in e)return t[i];return!1}function Ce(t,e,i){var n=e||new O(0,0);t.style[re]=(gt?"translate("+n.x+"px,"+n.y+"px)":"translate3d("+n.x+"px,"+n.y+"px,0)")+(i?" scale("+i+")":"")}function Se(t,e){t._leaflet_pos=e,yt?Ce(t,e):(t.style.left=e.x+"px",t.style.top=e.y+"px")}function Ee(t){return t._leaflet_pos||new O(0,0)}if("onselectstart"in document)ee=function(){Le(window,"selectstart",Ve)},ie=function(){Re(window,"selectstart",Ve)};else{var Ae=ke(["userSelect","WebkitUserSelect","OUserSelect","MozUserSelect","msUserSelect"]);ee=function(){if(Ae){var t=document.documentElement.style;ne=t[Ae],t[Ae]="none"}},ie=function(){Ae&&(document.documentElement.style[Ae]=ne,ne=void 0)}}function Me(){Le(window,"dragstart",Ve)}function Te(){Re(window,"dragstart",Ve)}function Pe(t){for(;-1===t.tabIndex;)t=t.parentNode;t.style&&(De(),oe=t,se=t.style.outline,t.style.outline="none",Le(window,"keydown",De))}function De(){oe&&(oe.style.outline=se,oe=void 0,se=void 0,Re(window,"keydown",De))}function Ie(t){do{t=t.parentNode}while(!(t.offsetWidth&&t.offsetHeight||t===document.body));return t}function Oe(t){var e=t.getBoundingClientRect();return{x:e.width/t.offsetWidth||1,y:e.height/t.offsetHeight||1,boundingClientRect:e}}var $e=(Object.freeze||Object)({TRANSFORM:re,TRANSITION:ae,TRANSITION_END:le,get:ce,getStyle:he,create:de,remove:ue,empty:pe,toFront:me,toBack:ge,hasClass:fe,addClass:ve,removeClass:ye,setClass:be,getClass:xe,setOpacity:_e,testProp:ke,setTransform:Ce,setPosition:Se,getPosition:Ee,disableTextSelection:ee,enableTextSelection:ie,disableImageDrag:Me,enableImageDrag:Te,preventOutline:Pe,restoreOutline:De,getSizedParentNode:Ie,getScale:Oe});function Le(t,e,i,n){if("object"==typeof e)for(var o in e)Ne(t,o,e[o],i);else for(var s=0,r=(e=p(e)).length;s<r;s++)Ne(t,e[s],i,n);return this}var ze="_leaflet_events";function Re(t,e,i,n){if("object"==typeof e)for(var o in e)je(t,o,e[o],i);else if(e)for(var s=0,r=(e=p(e)).length;s<r;s++)je(t,e[s],i,n);else{for(var a in t[ze])je(t,a,t[ze][a]);delete t[ze]}return this}function Ne(t,e,i,n){var o=e+a(i)+(n?"_"+a(n):"");if(t[ze]&&t[ze][o])return this;var s=function(e){return i.call(n||t,e||window.event)},r=s;kt&&0===e.indexOf("touch")?Ft(t,e,s,o):!Ct||"dblclick"!==e||!Jt||kt&&ct?"addEventListener"in t?"mousewheel"===e?t.addEventListener("onwheel"in t?"wheel":"mousewheel",s,!1):"mouseenter"===e||"mouseleave"===e?(s=function(e){e=e||window.event,Qe(t,e)&&r(e)},t.addEventListener("mouseenter"===e?"mouseover":"mouseout",s,!1)):("click"===e&&ot&&(s=function(t){Je(t,r)}),t.addEventListener(e,s,!1)):"attachEvent"in t&&t.attachEvent("on"+e,s):Jt(t,s,o),t[ze]=t[ze]||{},t[ze][o]=s}function je(t,e,i,n){var o=e+a(i)+(n?"_"+a(n):""),s=t[ze]&&t[ze][o];if(!s)return this;kt&&0===e.indexOf("touch")?qt(t,e,o):!Ct||"dblclick"!==e||!te||kt&&ct?"removeEventListener"in t?"mousewheel"===e?t.removeEventListener("onwheel"in t?"wheel":"mousewheel",s,!1):t.removeEventListener("mouseenter"===e?"mouseover":"mouseleave"===e?"mouseout":e,s,!1):"detachEvent"in t&&t.detachEvent("on"+e,s):te(t,o),t[ze][o]=null}function Be(t){return t.stopPropagation?t.stopPropagation():t.originalEvent?t.originalEvent._stopped=!0:t.cancelBubble=!0,Ke(t),this}function Fe(t){return Ne(t,"mousewheel",Be),this}function qe(t){return Le(t,"mousedown touchstart dblclick",Be),Ne(t,"click",Xe),this}function Ve(t){return t.preventDefault?t.preventDefault():t.returnValue=!1,this}function He(t){return Ve(t),Be(t),this}function Ue(t,e){if(!e)return new O(t.clientX,t.clientY);var i=Oe(e),n=i.boundingClientRect;return new O((t.clientX-n.left)/i.x-e.clientLeft,(t.clientY-n.top)/i.y-e.clientTop)}var We=mt&&ct?2*window.devicePixelRatio:ht?window.devicePixelRatio:1;function Ge(t){return it?t.wheelDeltaY/2:t.deltaY&&0===t.deltaMode?-t.deltaY/We:t.deltaY&&1===t.deltaMode?20*-t.deltaY:t.deltaY&&2===t.deltaMode?60*-t.deltaY:t.deltaX||t.deltaZ?0:t.wheelDelta?(t.wheelDeltaY||t.wheelDelta)/2:t.detail&&Math.abs(t.detail)<32765?20*-t.detail:t.detail?t.detail/-32765*60:0}var Ze,Ye={};function Xe(t){Ye[t.type]=!0}function Ke(t){var e=Ye[t.type];return Ye[t.type]=!1,e}function Qe(t,e){var i=e.relatedTarget;if(!i)return!0;try{for(;i&&i!==t;)i=i.parentNode}catch(t){return!1}return i!==t}function Je(t,e){var i=t.timeStamp||t.originalEvent&&t.originalEvent.timeStamp,n=Ze&&i-Ze;n&&n>100&&n<500||t.target._simulatedClick&&!t._simulated?He(t):(Ze=i,e(t))}var ti=(Object.freeze||Object)({on:Le,off:Re,stopPropagation:Be,disableScrollPropagation:Fe,disableClickPropagation:qe,preventDefault:Ve,stop:He,getMousePosition:Ue,getWheelDelta:Ge,fakeStop:Xe,skipped:Ke,isExternalTarget:Qe,addListener:Le,removeListener:Re}),ei=I.extend({run:function(t,e,i,n){this.stop(),this._el=t,this._inProgress=!0,this._duration=i||.25,this._easeOutPower=1/Math.max(n||.5,.2),this._startPos=Ee(t),this._offset=e.subtract(this._startPos),this._startTime=+new Date,this.fire("start"),this._animate()},stop:function(){this._inProgress&&(this._step(!0),this._complete())},_animate:function(){this._animId=E(this._animate,this),this._step()},_step:function(t){var e=+new Date-this._startTime,i=1e3*this._duration;e<i?this._runFrame(this._easeOut(e/i),t):(this._runFrame(1),this._complete())},_runFrame:function(t,e){var i=this._startPos.add(this._offset.multiplyBy(t));e&&i._round(),Se(this._el,i),this.fire("step")},_complete:function(){A(this._animId),this._inProgress=!1,this.fire("end")},_easeOut:function(t){return 1-Math.pow(1-t,this._easeOutPower)}}),ii=I.extend({options:{crs:Y,center:void 0,zoom:void 0,minZoom:void 0,maxZoom:void 0,layers:[],maxBounds:void 0,renderer:void 0,zoomAnimation:!0,zoomAnimationThreshold:4,fadeAnimation:!0,markerZoomAnimation:!0,transform3DLimit:8388608,zoomSnap:1,zoomDelta:1,trackResize:!0},initialize:function(t,e){e=m(this,e),this._handlers=[],this._layers={},this._zoomBoundLayers={},this._sizeChanged=!0,this._initContainer(t),this._initLayout(),this._onResize=s(this._onResize,this),this._initEvents(),e.maxBounds&&this.setMaxBounds(e.maxBounds),void 0!==e.zoom&&(this._zoom=this._limitZoom(e.zoom)),e.center&&void 0!==e.zoom&&this.setView(q(e.center),e.zoom,{reset:!0}),this.callInitHooks(),this._zoomAnimated=ae&&yt&&!St&&this.options.zoomAnimation,this._zoomAnimated&&(this._createAnimProxy(),Le(this._proxy,le,this._catchTransitionEnd,this)),this._addLayers(this.options.layers)},setView:function(t,e,i){return e=void 0===e?this._zoom:this._limitZoom(e),t=this._limitCenter(q(t),e,this.options.maxBounds),i=i||{},this._stop(),this._loaded&&!i.reset&&!0!==i&&(void 0!==i.animate&&(i.zoom=n({animate:i.animate},i.zoom),i.pan=n({animate:i.animate,duration:i.duration},i.pan)),this._zoom!==e?this._tryAnimatedZoom&&this._tryAnimatedZoom(t,e,i.zoom):this._tryAnimatedPan(t,i.pan))?(clearTimeout(this._sizeTimer),this):(this._resetView(t,e),this)},setZoom:function(t,e){return this._loaded?this.setView(this.getCenter(),t,{zoom:e}):(this._zoom=t,this)},zoomIn:function(t,e){return t=t||(yt?this.options.zoomDelta:1),this.setZoom(this._zoom+t,e)},zoomOut:function(t,e){return t=t||(yt?this.options.zoomDelta:1),this.setZoom(this._zoom-t,e)},setZoomAround:function(t,e,i){var n=this.getZoomScale(e),o=this.getSize().divideBy(2),s=(t instanceof O?t:this.latLngToContainerPoint(t)).subtract(o).multiplyBy(1-1/n),r=this.containerPointToLatLng(o.add(s));return this.setView(r,e,{zoom:i})},_getBoundsCenterZoom:function(t,e){e=e||{},t=t.getBounds?t.getBounds():B(t);var i=z(e.paddingTopLeft||e.padding||[0,0]),n=z(e.paddingBottomRight||e.padding||[0,0]),o=this.getBoundsZoom(t,!1,i.add(n));if((o="number"==typeof e.maxZoom?Math.min(e.maxZoom,o):o)===1/0)return{center:t.getCenter(),zoom:o};var s=n.subtract(i).divideBy(2),r=this.project(t.getSouthWest(),o),a=this.project(t.getNorthEast(),o);return{center:this.unproject(r.add(a).divideBy(2).add(s),o),zoom:o}},fitBounds:function(t,e){if(!(t=B(t)).isValid())throw new Error("Bounds are not valid.");var i=this._getBoundsCenterZoom(t,e);return this.setView(i.center,i.zoom,e)},fitWorld:function(t){return this.fitBounds([[-90,-180],[90,180]],t)},panTo:function(t,e){return this.setView(t,this._zoom,{pan:e})},panBy:function(t,e){if(e=e||{},!(t=z(t).round()).x&&!t.y)return this.fire("moveend");if(!0!==e.animate&&!this.getSize().contains(t))return this._resetView(this.unproject(this.project(this.getCenter()).add(t)),this.getZoom()),this;if(this._panAnim||(this._panAnim=new ei,this._panAnim.on({step:this._onPanTransitionStep,end:this._onPanTransitionEnd},this)),e.noMoveStart||this.fire("movestart"),!1!==e.animate){ve(this._mapPane,"leaflet-pan-anim");var i=this._getMapPanePos().subtract(t).round();this._panAnim.run(this._mapPane,i,e.duration||.25,e.easeLinearity)}else this._rawPanBy(t),this.fire("move").fire("moveend");return this},flyTo:function(t,e,i){if(!1===(i=i||{}).animate||!yt)return this.setView(t,e,i);this._stop();var n=this.project(this.getCenter()),o=this.project(t),s=this.getSize(),r=this._zoom;t=q(t),e=void 0===e?r:e;var a=Math.max(s.x,s.y),l=a*this.getZoomScale(r,e),c=o.distanceTo(n)||1,h=1.42,d=h*h;function u(t){var e=(l*l-a*a+(t?-1:1)*d*d*c*c)/(2*(t?l:a)*d*c),i=Math.sqrt(e*e+1)-e;return i<1e-9?-18:Math.log(i)}function p(t){return(Math.exp(t)-Math.exp(-t))/2}function m(t){return(Math.exp(t)+Math.exp(-t))/2}function g(t){return p(t)/m(t)}var f=u(0);function v(t){return a*(m(f)/m(f+h*t))}function y(t){return a*(m(f)*g(f+h*t)-p(f))/d}function b(t){return 1-Math.pow(1-t,1.5)}var x=Date.now(),_=(u(1)-f)/h,w=i.duration?1e3*i.duration:1e3*_*.8;function k(){var i=(Date.now()-x)/w,s=b(i)*_;i<=1?(this._flyToFrame=E(k,this),this._move(this.unproject(n.add(o.subtract(n).multiplyBy(y(s)/c)),r),this.getScaleZoom(a/v(s),r),{flyTo:!0})):this._move(t,e)._moveEnd(!0)}return this._moveStart(!0,i.noMoveStart),k.call(this),this},flyToBounds:function(t,e){var i=this._getBoundsCenterZoom(t,e);return this.flyTo(i.center,i.zoom,e)},setMaxBounds:function(t){return(t=B(t)).isValid()?(this.options.maxBounds&&this.off("moveend",this._panInsideMaxBounds),this.options.maxBounds=t,this._loaded&&this._panInsideMaxBounds(),this.on("moveend",this._panInsideMaxBounds)):(this.options.maxBounds=null,this.off("moveend",this._panInsideMaxBounds))},setMinZoom:function(t){var e=this.options.minZoom;return this.options.minZoom=t,this._loaded&&e!==t&&(this.fire("zoomlevelschange"),this.getZoom()<this.options.minZoom)?this.setZoom(t):this},setMaxZoom:function(t){var e=this.options.maxZoom;return this.options.maxZoom=t,this._loaded&&e!==t&&(this.fire("zoomlevelschange"),this.getZoom()>this.options.maxZoom)?this.setZoom(t):this},panInsideBounds:function(t,e){this._enforcingBounds=!0;var i=this.getCenter(),n=this._limitCenter(i,this._zoom,B(t));return i.equals(n)||this.panTo(n,e),this._enforcingBounds=!1,this},panInside:function(t,e){var i=z((e=e||{}).paddingTopLeft||e.padding||[0,0]),n=z(e.paddingBottomRight||e.padding||[0,0]),o=this.getCenter(),s=this.project(o),r=this.project(t),a=this.getPixelBounds(),l=a.getSize().divideBy(2),c=N([a.min.add(i),a.max.subtract(n)]);if(!c.contains(r)){this._enforcingBounds=!0;var h=s.subtract(r),d=z(r.x+h.x,r.y+h.y);(r.x<c.min.x||r.x>c.max.x)&&(d.x=s.x-h.x,h.x>0?d.x+=l.x-i.x:d.x-=l.x-n.x),(r.y<c.min.y||r.y>c.max.y)&&(d.y=s.y-h.y,h.y>0?d.y+=l.y-i.y:d.y-=l.y-n.y),this.panTo(this.unproject(d),e),this._enforcingBounds=!1}return this},invalidateSize:function(t){if(!this._loaded)return this;t=n({animate:!1,pan:!0},!0===t?{animate:!0}:t);var e=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var i=this.getSize(),o=e.divideBy(2).round(),r=i.divideBy(2).round(),a=o.subtract(r);return a.x||a.y?(t.animate&&t.pan?this.panBy(a):(t.pan&&this._rawPanBy(a),this.fire("move"),t.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(s(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:e,newSize:i})):this},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(t){if(t=this._locateOptions=n({timeout:1e4,watch:!1},t),!("geolocation"in navigator))return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var e=s(this._handleGeolocationResponse,this),i=s(this._handleGeolocationError,this);return t.watch?this._locationWatchId=navigator.geolocation.watchPosition(e,i,t):navigator.geolocation.getCurrentPosition(e,i,t),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(t){var e=t.code,i=t.message||(1===e?"permission denied":2===e?"position unavailable":"timeout");this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:e,message:"Geolocation error: "+i+"."})},_handleGeolocationResponse:function(t){var e=new F(t.coords.latitude,t.coords.longitude),i=e.toBounds(2*t.coords.accuracy),n=this._locateOptions;if(n.setView){var o=this.getBoundsZoom(i);this.setView(e,n.maxZoom?Math.min(o,n.maxZoom):o)}var s={latlng:e,bounds:i,timestamp:t.timestamp};for(var r in t.coords)"number"==typeof t.coords[r]&&(s[r]=t.coords[r]);this.fire("locationfound",s)},addHandler:function(t,e){if(!e)return this;var i=this[t]=new e(this);return this._handlers.push(i),this.options[t]&&i.enable(),this},remove:function(){if(this._initEvents(!0),this._containerId!==this._container._leaflet_id)throw new Error("Map container is being reused by another instance");try{delete this._container._leaflet_id,delete this._containerId}catch(t){this._container._leaflet_id=void 0,this._containerId=void 0}var t;for(t in void 0!==this._locationWatchId&&this.stopLocate(),this._stop(),ue(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(A(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload"),this._layers)this._layers[t].remove();for(t in this._panes)ue(this._panes[t]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(t,e){var i=de("div","leaflet-pane"+(t?" leaflet-"+t.replace("Pane","")+"-pane":""),e||this._mapPane);return t&&(this._panes[t]=i),i},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter:this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var t=this.getPixelBounds();return new j(this.unproject(t.getBottomLeft()),this.unproject(t.getTopRight()))},getMinZoom:function(){return void 0===this.options.minZoom?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return void 0===this.options.maxZoom?void 0===this._layersMaxZoom?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(t,e,i){t=B(t),i=z(i||[0,0]);var n=this.getZoom()||0,o=this.getMinZoom(),s=this.getMaxZoom(),r=t.getNorthWest(),a=t.getSouthEast(),l=this.getSize().subtract(i),c=N(this.project(a,n),this.project(r,n)).getSize(),h=yt?this.options.zoomSnap:1,d=l.x/c.x,u=l.y/c.y,p=e?Math.max(d,u):Math.min(d,u);return n=this.getScaleZoom(p,n),h&&(n=Math.round(n/(h/100))*(h/100),n=e?Math.ceil(n/h)*h:Math.floor(n/h)*h),Math.max(o,Math.min(s,n))},getSize:function(){return this._size&&!this._sizeChanged||(this._size=new O(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(t,e){var i=this._getTopLeftPoint(t,e);return new R(i,i.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(t){return this.options.crs.getProjectedBounds(void 0===t?this.getZoom():t)},getPane:function(t){return"string"==typeof t?this._panes[t]:t},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(t,e){var i=this.options.crs;return e=void 0===e?this._zoom:e,i.scale(t)/i.scale(e)},getScaleZoom:function(t,e){var i=this.options.crs;e=void 0===e?this._zoom:e;var n=i.zoom(t*i.scale(e));return isNaN(n)?1/0:n},project:function(t,e){return e=void 0===e?this._zoom:e,this.options.crs.latLngToPoint(q(t),e)},unproject:function(t,e){return e=void 0===e?this._zoom:e,this.options.crs.pointToLatLng(z(t),e)},layerPointToLatLng:function(t){var e=z(t).add(this.getPixelOrigin());return this.unproject(e)},latLngToLayerPoint:function(t){return this.project(q(t))._round()._subtract(this.getPixelOrigin())},wrapLatLng:function(t){return this.options.crs.wrapLatLng(q(t))},wrapLatLngBounds:function(t){return this.options.crs.wrapLatLngBounds(B(t))},distance:function(t,e){return this.options.crs.distance(q(t),q(e))},containerPointToLayerPoint:function(t){return z(t).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(t){return z(t).add(this._getMapPanePos())},containerPointToLatLng:function(t){var e=this.containerPointToLayerPoint(z(t));return this.layerPointToLatLng(e)},latLngToContainerPoint:function(t){return this.layerPointToContainerPoint(this.latLngToLayerPoint(q(t)))},mouseEventToContainerPoint:function(t){return Ue(t,this._container)},mouseEventToLayerPoint:function(t){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(t))},mouseEventToLatLng:function(t){return this.layerPointToLatLng(this.mouseEventToLayerPoint(t))},_initContainer:function(t){var e=this._container=ce(t);if(!e)throw new Error("Map container not found.");if(e._leaflet_id)throw new Error("Map container is already initialized.");Le(e,"scroll",this._onScroll,this),this._containerId=a(e)},_initLayout:function(){var t=this._container;this._fadeAnimated=this.options.fadeAnimation&&yt,ve(t,"leaflet-container"+(Ct?" leaflet-touch":"")+(At?" leaflet-retina":"")+(et?" leaflet-oldie":"")+(dt?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var e=he(t,"position");"absolute"!==e&&"relative"!==e&&"fixed"!==e&&(t.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var t=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),Se(this._mapPane,new O(0,0)),this.createPane("tilePane"),this.createPane("shadowPane"),this.createPane("overlayPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(ve(t.markerPane,"leaflet-zoom-hide"),ve(t.shadowPane,"leaflet-zoom-hide"))},_resetView:function(t,e){Se(this._mapPane,new O(0,0));var i=!this._loaded;this._loaded=!0,e=this._limitZoom(e),this.fire("viewprereset");var n=this._zoom!==e;this._moveStart(n,!1)._move(t,e)._moveEnd(n),this.fire("viewreset"),i&&this.fire("load")},_moveStart:function(t,e){return t&&this.fire("zoomstart"),e||this.fire("movestart"),this},_move:function(t,e,i){void 0===e&&(e=this._zoom);var n=this._zoom!==e;return this._zoom=e,this._lastCenter=t,this._pixelOrigin=this._getNewPixelOrigin(t),(n||i&&i.pinch)&&this.fire("zoom",i),this.fire("move",i)},_moveEnd:function(t){return t&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return A(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(t){Se(this._mapPane,this._getMapPanePos().subtract(t))},_getZoomSpan:function(){return this.getMaxZoom()-this.getMinZoom()},_panInsideMaxBounds:function(){this._enforcingBounds||this.panInsideBounds(this.options.maxBounds)},_checkIfLoaded:function(){if(!this._loaded)throw new Error("Set map center and zoom first.")},_initEvents:function(t){this._targets={},this._targets[a(this._container)]=this;var e=t?Re:Le;e(this._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",this._handleDOMEvent,this),this.options.trackResize&&e(window,"resize",this._onResize,this),yt&&this.options.transform3DLimit&&(t?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){A(this._resizeRequest),this._resizeRequest=E((function(){this.invalidateSize({debounceMoveend:!0})}),this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var t=this._getMapPanePos();Math.max(Math.abs(t.x),Math.abs(t.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(t,e){for(var i,n=[],o="mouseout"===e||"mouseover"===e,s=t.target||t.srcElement,r=!1;s;){if((i=this._targets[a(s)])&&("click"===e||"preclick"===e)&&!t._simulated&&this._draggableMoved(i)){r=!0;break}if(i&&i.listens(e,!0)){if(o&&!Qe(s,t))break;if(n.push(i),o)break}if(s===this._container)break;s=s.parentNode}return n.length||r||o||!Qe(s,t)||(n=[this]),n},_handleDOMEvent:function(t){if(this._loaded&&!Ke(t)){var e=t.type;"mousedown"!==e&&"keypress"!==e&&"keyup"!==e&&"keydown"!==e||Pe(t.target||t.srcElement),this._fireDOMEvent(t,e)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(t,e,i){if("click"===t.type){var o=n({},t);o.type="preclick",this._fireDOMEvent(o,o.type,i)}if(!t._stopped&&(i=(i||[]).concat(this._findEventTargets(t,e))).length){var s=i[0];"contextmenu"===e&&s.listens(e,!0)&&Ve(t);var r={originalEvent:t};if("keypress"!==t.type&&"keydown"!==t.type&&"keyup"!==t.type){var a=s.getLatLng&&(!s._radius||s._radius<=10);r.containerPoint=a?this.latLngToContainerPoint(s.getLatLng()):this.mouseEventToContainerPoint(t),r.layerPoint=this.containerPointToLayerPoint(r.containerPoint),r.latlng=a?s.getLatLng():this.layerPointToLatLng(r.layerPoint)}for(var l=0;l<i.length;l++)if(i[l].fire(e,r,!0),r.originalEvent._stopped||!1===i[l].options.bubblingMouseEvents&&-1!==b(this._mouseEvents,e))return}},_draggableMoved:function(t){return(t=t.dragging&&t.dragging.enabled()?t:this).dragging&&t.dragging.moved()||this.boxZoom&&this.boxZoom.moved()},_clearHandlers:function(){for(var t=0,e=this._handlers.length;t<e;t++)this._handlers[t].disable()},whenReady:function(t,e){return this._loaded?t.call(e||this,{target:this}):this.on("load",t,e),this},_getMapPanePos:function(){return Ee(this._mapPane)||new O(0,0)},_moved:function(){var t=this._getMapPanePos();return t&&!t.equals([0,0])},_getTopLeftPoint:function(t,e){return(t&&void 0!==e?this._getNewPixelOrigin(t,e):this.getPixelOrigin()).subtract(this._getMapPanePos())},_getNewPixelOrigin:function(t,e){var i=this.getSize()._divideBy(2);return this.project(t,e)._subtract(i)._add(this._getMapPanePos())._round()},_latLngToNewLayerPoint:function(t,e,i){var n=this._getNewPixelOrigin(i,e);return this.project(t,e)._subtract(n)},_latLngBoundsToNewLayerBounds:function(t,e,i){var n=this._getNewPixelOrigin(i,e);return N([this.project(t.getSouthWest(),e)._subtract(n),this.project(t.getNorthWest(),e)._subtract(n),this.project(t.getSouthEast(),e)._subtract(n),this.project(t.getNorthEast(),e)._subtract(n)])},_getCenterLayerPoint:function(){return this.containerPointToLayerPoint(this.getSize()._divideBy(2))},_getCenterOffset:function(t){return this.latLngToLayerPoint(t).subtract(this._getCenterLayerPoint())},_limitCenter:function(t,e,i){if(!i)return t;var n=this.project(t,e),o=this.getSize().divideBy(2),s=new R(n.subtract(o),n.add(o)),r=this._getBoundsOffset(s,i,e);return r.round().equals([0,0])?t:this.unproject(n.add(r),e)},_limitOffset:function(t,e){if(!e)return t;var i=this.getPixelBounds(),n=new R(i.min.add(t),i.max.add(t));return t.add(this._getBoundsOffset(n,e))},_getBoundsOffset:function(t,e,i){var n=N(this.project(e.getNorthEast(),i),this.project(e.getSouthWest(),i)),o=n.min.subtract(t.min),s=n.max.subtract(t.max);return new O(this._rebound(o.x,-s.x),this._rebound(o.y,-s.y))},_rebound:function(t,e){return t+e>0?Math.round(t-e)/2:Math.max(0,Math.ceil(t))-Math.max(0,Math.floor(e))},_limitZoom:function(t){var e=this.getMinZoom(),i=this.getMaxZoom(),n=yt?this.options.zoomSnap:1;return n&&(t=Math.round(t/n)*n),Math.max(e,Math.min(i,t))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){ye(this._mapPane,"leaflet-pan-anim"),this.fire("moveend")},_tryAnimatedPan:function(t,e){var i=this._getCenterOffset(t)._trunc();return!(!0!==(e&&e.animate)&&!this.getSize().contains(i)||(this.panBy(i,e),0))},_createAnimProxy:function(){var t=this._proxy=de("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(t),this.on("zoomanim",(function(t){var e=re,i=this._proxy.style[e];Ce(this._proxy,this.project(t.center,t.zoom),this.getZoomScale(t.zoom,1)),i===this._proxy.style[e]&&this._animatingZoom&&this._onZoomTransitionEnd()}),this),this.on("load moveend",(function(){var t=this.getCenter(),e=this.getZoom();Ce(this._proxy,this.project(t,e),this.getZoomScale(e,1))}),this),this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){ue(this._proxy),delete this._proxy},_catchTransitionEnd:function(t){this._animatingZoom&&t.propertyName.indexOf("transform")>=0&&this._onZoomTransitionEnd()},_nothingToAnimate:function(){return!this._container.getElementsByClassName("leaflet-zoom-animated").length},_tryAnimatedZoom:function(t,e,i){if(this._animatingZoom)return!0;if(i=i||{},!this._zoomAnimated||!1===i.animate||this._nothingToAnimate()||Math.abs(e-this._zoom)>this.options.zoomAnimationThreshold)return!1;var n=this.getZoomScale(e),o=this._getCenterOffset(t)._divideBy(1-1/n);return!(!0!==i.animate&&!this.getSize().contains(o)||(E((function(){this._moveStart(!0,!1)._animateZoom(t,e,!0)}),this),0))},_animateZoom:function(t,e,i,n){this._mapPane&&(i&&(this._animatingZoom=!0,this._animateToCenter=t,this._animateToZoom=e,ve(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:t,zoom:e,noUpdate:n}),setTimeout(s(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&ye(this._mapPane,"leaflet-zoom-anim"),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom),E((function(){this._moveEnd(!0)}),this))}});function ni(t,e){return new ii(t,e)}var oi=T.extend({options:{position:"topright"},initialize:function(t){m(this,t)},getPosition:function(){return this.options.position},setPosition:function(t){var e=this._map;return e&&e.removeControl(this),this.options.position=t,e&&e.addControl(this),this},getContainer:function(){return this._container},addTo:function(t){this.remove(),this._map=t;var e=this._container=this.onAdd(t),i=this.getPosition(),n=t._controlCorners[i];return ve(e,"leaflet-control"),-1!==i.indexOf("bottom")?n.insertBefore(e,n.firstChild):n.appendChild(e),this._map.on("unload",this.remove,this),this},remove:function(){return this._map?(ue(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null,this):this},_refocusOnMap:function(t){this._map&&t&&t.screenX>0&&t.screenY>0&&this._map.getContainer().focus()}}),si=function(t){return new oi(t)};ii.include({addControl:function(t){return t.addTo(this),this},removeControl:function(t){return t.remove(),this},_initControlPos:function(){var t=this._controlCorners={},e="leaflet-",i=this._controlContainer=de("div",e+"control-container",this._container);function n(n,o){var s=e+n+" "+e+o;t[n+o]=de("div",s,i)}n("top","left"),n("top","right"),n("bottom","left"),n("bottom","right")},_clearControlPos:function(){for(var t in this._controlCorners)ue(this._controlCorners[t]);ue(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var ri=oi.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(t,e,i,n){return i<n?-1:n<i?1:0}},initialize:function(t,e,i){for(var n in m(this,i),this._layerControlInputs=[],this._layers=[],this._lastZIndex=0,this._handlingClick=!1,t)this._addLayer(t[n],n);for(n in e)this._addLayer(e[n],n,!0)},onAdd:function(t){this._initLayout(),this._update(),this._map=t,t.on("zoomend",this._checkDisabledLayers,this);for(var e=0;e<this._layers.length;e++)this._layers[e].layer.on("add remove",this._onLayerChange,this);return this._container},addTo:function(t){return oi.prototype.addTo.call(this,t),this._expandIfNotCollapsed()},onRemove:function(){this._map.off("zoomend",this._checkDisabledLayers,this);for(var t=0;t<this._layers.length;t++)this._layers[t].layer.off("add remove",this._onLayerChange,this)},addBaseLayer:function(t,e){return this._addLayer(t,e),this._map?this._update():this},addOverlay:function(t,e){return this._addLayer(t,e,!0),this._map?this._update():this},removeLayer:function(t){t.off("add remove",this._onLayerChange,this);var e=this._getLayer(a(t));return e&&this._layers.splice(this._layers.indexOf(e),1),this._map?this._update():this},expand:function(){ve(this._container,"leaflet-control-layers-expanded"),this._section.style.height=null;var t=this._map.getSize().y-(this._container.offsetTop+50);return t<this._section.clientHeight?(ve(this._section,"leaflet-control-layers-scrollbar"),this._section.style.height=t+"px"):ye(this._section,"leaflet-control-layers-scrollbar"),this._checkDisabledLayers(),this},collapse:function(){return ye(this._container,"leaflet-control-layers-expanded"),this},_initLayout:function(){var t="leaflet-control-layers",e=this._container=de("div",t),i=this.options.collapsed;e.setAttribute("aria-haspopup",!0),qe(e),Fe(e);var n=this._section=de("section",t+"-list");i&&(this._map.on("click",this.collapse,this),ot||Le(e,{mouseenter:this.expand,mouseleave:this.collapse},this));var o=this._layersLink=de("a",t+"-toggle",e);o.href="#",o.title="Layers",Ct?(Le(o,"click",He),Le(o,"click",this.expand,this)):Le(o,"focus",this.expand,this),i||this.expand(),this._baseLayersList=de("div",t+"-base",n),this._separator=de("div",t+"-separator",n),this._overlaysList=de("div",t+"-overlays",n),e.appendChild(n)},_getLayer:function(t){for(var e=0;e<this._layers.length;e++)if(this._layers[e]&&a(this._layers[e].layer)===t)return this._layers[e]},_addLayer:function(t,e,i){this._map&&t.on("add remove",this._onLayerChange,this),this._layers.push({layer:t,name:e,overlay:i}),this.options.sortLayers&&this._layers.sort(s((function(t,e){return this.options.sortFunction(t.layer,e.layer,t.name,e.name)}),this)),this.options.autoZIndex&&t.setZIndex&&(this._lastZIndex++,t.setZIndex(this._lastZIndex)),this._expandIfNotCollapsed()},_update:function(){if(!this._container)return this;pe(this._baseLayersList),pe(this._overlaysList),this._layerControlInputs=[];var t,e,i,n,o=0;for(i=0;i<this._layers.length;i++)n=this._layers[i],this._addItem(n),e=e||n.overlay,t=t||!n.overlay,o+=n.overlay?0:1;return this.options.hideSingleBase&&(t=t&&o>1,this._baseLayersList.style.display=t?"":"none"),this._separator.style.display=e&&t?"":"none",this},_onLayerChange:function(t){this._handlingClick||this._update();var e=this._getLayer(a(t.target)),i=e.overlay?"add"===t.type?"overlayadd":"overlayremove":"add"===t.type?"baselayerchange":null;i&&this._map.fire(i,e)},_createRadioElement:function(t,e){var i='<input type="radio" class="leaflet-control-layers-selector" name="'+t+'"'+(e?' checked="checked"':"")+"/>",n=document.createElement("div");return n.innerHTML=i,n.firstChild},_addItem:function(t){var e,i=document.createElement("label"),n=this._map.hasLayer(t.layer);t.overlay?((e=document.createElement("input")).type="checkbox",e.className="leaflet-control-layers-selector",e.defaultChecked=n):e=this._createRadioElement("leaflet-base-layers_"+a(this),n),this._layerControlInputs.push(e),e.layerId=a(t.layer),Le(e,"click",this._onInputClick,this);var o=document.createElement("span");o.innerHTML=" "+t.name;var s=document.createElement("div");return i.appendChild(s),s.appendChild(e),s.appendChild(o),(t.overlay?this._overlaysList:this._baseLayersList).appendChild(i),this._checkDisabledLayers(),i},_onInputClick:function(){var t,e,i=this._layerControlInputs,n=[],o=[];this._handlingClick=!0;for(var s=i.length-1;s>=0;s--)t=i[s],e=this._getLayer(t.layerId).layer,t.checked?n.push(e):t.checked||o.push(e);for(s=0;s<o.length;s++)this._map.hasLayer(o[s])&&this._map.removeLayer(o[s]);for(s=0;s<n.length;s++)this._map.hasLayer(n[s])||this._map.addLayer(n[s]);this._handlingClick=!1,this._refocusOnMap()},_checkDisabledLayers:function(){for(var t,e,i=this._layerControlInputs,n=this._map.getZoom(),o=i.length-1;o>=0;o--)t=i[o],e=this._getLayer(t.layerId).layer,t.disabled=void 0!==e.options.minZoom&&n<e.options.minZoom||void 0!==e.options.maxZoom&&n>e.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expand:function(){return this.expand()},_collapse:function(){return this.collapse()}}),ai=function(t,e,i){return new ri(t,e,i)},li=oi.extend({options:{position:"topleft",zoomInText:"+",zoomInTitle:"Zoom in",zoomOutText:"−",zoomOutTitle:"Zoom out"},onAdd:function(t){var e="leaflet-control-zoom",i=de("div",e+" leaflet-bar"),n=this.options;return this._zoomInButton=this._createButton(n.zoomInText,n.zoomInTitle,e+"-in",i,this._zoomIn),this._zoomOutButton=this._createButton(n.zoomOutText,n.zoomOutTitle,e+"-out",i,this._zoomOut),this._updateDisabled(),t.on("zoomend zoomlevelschange",this._updateDisabled,this),i},onRemove:function(t){t.off("zoomend zoomlevelschange",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(t){!this._disabled&&this._map._zoom<this._map.getMaxZoom()&&this._map.zoomIn(this._map.options.zoomDelta*(t.shiftKey?3:1))},_zoomOut:function(t){!this._disabled&&this._map._zoom>this._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(t.shiftKey?3:1))},_createButton:function(t,e,i,n,o){var s=de("a",i,n);return s.innerHTML=t,s.href="#",s.title=e,s.setAttribute("role","button"),s.setAttribute("aria-label",e),qe(s),Le(s,"click",He),Le(s,"click",o,this),Le(s,"click",this._refocusOnMap,this),s},_updateDisabled:function(){var t=this._map,e="leaflet-disabled";ye(this._zoomInButton,e),ye(this._zoomOutButton,e),(this._disabled||t._zoom===t.getMinZoom())&&ve(this._zoomOutButton,e),(this._disabled||t._zoom===t.getMaxZoom())&&ve(this._zoomInButton,e)}});ii.mergeOptions({zoomControl:!0}),ii.addInitHook((function(){this.options.zoomControl&&(this.zoomControl=new li,this.addControl(this.zoomControl))}));var ci=function(t){return new li(t)},hi=oi.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(t){var e="leaflet-control-scale",i=de("div",e),n=this.options;return this._addScales(n,e+"-line",i),t.on(n.updateWhenIdle?"moveend":"move",this._update,this),t.whenReady(this._update,this),i},onRemove:function(t){t.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(t,e,i){t.metric&&(this._mScale=de("div",e,i)),t.imperial&&(this._iScale=de("div",e,i))},_update:function(){var t=this._map,e=t.getSize().y/2,i=t.distance(t.containerPointToLatLng([0,e]),t.containerPointToLatLng([this.options.maxWidth,e]));this._updateScales(i)},_updateScales:function(t){this.options.metric&&t&&this._updateMetric(t),this.options.imperial&&t&&this._updateImperial(t)},_updateMetric:function(t){var e=this._getRoundNum(t),i=e<1e3?e+" m":e/1e3+" km";this._updateScale(this._mScale,i,e/t)},_updateImperial:function(t){var e,i,n,o=3.2808399*t;o>5280?(e=o/5280,i=this._getRoundNum(e),this._updateScale(this._iScale,i+" mi",i/e)):(n=this._getRoundNum(o),this._updateScale(this._iScale,n+" ft",n/o))},_updateScale:function(t,e,i){t.style.width=Math.round(this.options.maxWidth*i)+"px",t.innerHTML=e},_getRoundNum:function(t){var e=Math.pow(10,(Math.floor(t)+"").length-1),i=t/e;return e*(i=i>=10?10:i>=5?5:i>=3?3:i>=2?2:1)}}),di=function(t){return new hi(t)},ui=oi.extend({options:{position:"bottomright",prefix:'<a href="https://leafletjs.com" title="A JS library for interactive maps">Leaflet</a>'},initialize:function(t){m(this,t),this._attributions={}},onAdd:function(t){for(var e in t.attributionControl=this,this._container=de("div","leaflet-control-attribution"),qe(this._container),t._layers)t._layers[e].getAttribution&&this.addAttribution(t._layers[e].getAttribution());return this._update(),this._container},setPrefix:function(t){return this.options.prefix=t,this._update(),this},addAttribution:function(t){return t?(this._attributions[t]||(this._attributions[t]=0),this._attributions[t]++,this._update(),this):this},removeAttribution:function(t){return t?(this._attributions[t]&&(this._attributions[t]--,this._update()),this):this},_update:function(){if(this._map){var t=[];for(var e in this._attributions)this._attributions[e]&&t.push(e);var i=[];this.options.prefix&&i.push(this.options.prefix),t.length&&i.push(t.join(", ")),this._container.innerHTML=i.join(" | ")}}});ii.mergeOptions({attributionControl:!0}),ii.addInitHook((function(){this.options.attributionControl&&(new ui).addTo(this)}));var pi=function(t){return new ui(t)};oi.Layers=ri,oi.Zoom=li,oi.Scale=hi,oi.Attribution=ui,si.layers=ai,si.zoom=ci,si.scale=di,si.attribution=pi;var mi=T.extend({initialize:function(t){this._map=t},enable:function(){return this._enabled||(this._enabled=!0,this.addHooks()),this},disable:function(){return this._enabled?(this._enabled=!1,this.removeHooks(),this):this},enabled:function(){return!!this._enabled}});mi.addTo=function(t,e){return t.addHandler(e,this),this};var gi,fi={Events:D},vi=Ct?"touchstart mousedown":"mousedown",yi={mousedown:"mouseup",touchstart:"touchend",pointerdown:"touchend",MSPointerDown:"touchend"},bi={mousedown:"mousemove",touchstart:"touchmove",pointerdown:"touchmove",MSPointerDown:"touchmove"},xi=I.extend({options:{clickTolerance:3},initialize:function(t,e,i,n){m(this,n),this._element=t,this._dragStartTarget=e||t,this._preventOutline=i},enable:function(){this._enabled||(Le(this._dragStartTarget,vi,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(xi._dragging===this&&this.finishDrag(),Re(this._dragStartTarget,vi,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(t){if(!t._simulated&&this._enabled&&(this._moved=!1,!fe(this._element,"leaflet-zoom-anim")&&!(xi._dragging||t.shiftKey||1!==t.which&&1!==t.button&&!t.touches||(xi._dragging=this,this._preventOutline&&Pe(this._element),Me(),ee(),this._moving)))){this.fire("down");var e=t.touches?t.touches[0]:t,i=Ie(this._element);this._startPoint=new O(e.clientX,e.clientY),this._parentScale=Oe(i),Le(document,bi[t.type],this._onMove,this),Le(document,yi[t.type],this._onUp,this)}},_onMove:function(t){if(!t._simulated&&this._enabled)if(t.touches&&t.touches.length>1)this._moved=!0;else{var e=t.touches&&1===t.touches.length?t.touches[0]:t,i=new O(e.clientX,e.clientY)._subtract(this._startPoint);(i.x||i.y)&&(Math.abs(i.x)+Math.abs(i.y)<this.options.clickTolerance||(i.x/=this._parentScale.x,i.y/=this._parentScale.y,Ve(t),this._moved||(this.fire("dragstart"),this._moved=!0,this._startPos=Ee(this._element).subtract(i),ve(document.body,"leaflet-dragging"),this._lastTarget=t.target||t.srcElement,window.SVGElementInstance&&this._lastTarget instanceof SVGElementInstance&&(this._lastTarget=this._lastTarget.correspondingUseElement),ve(this._lastTarget,"leaflet-drag-target")),this._newPos=this._startPos.add(i),this._moving=!0,A(this._animRequest),this._lastEvent=t,this._animRequest=E(this._updatePosition,this,!0)))}},_updatePosition:function(){var t={originalEvent:this._lastEvent};this.fire("predrag",t),Se(this._element,this._newPos),this.fire("drag",t)},_onUp:function(t){!t._simulated&&this._enabled&&this.finishDrag()},finishDrag:function(){for(var t in ye(document.body,"leaflet-dragging"),this._lastTarget&&(ye(this._lastTarget,"leaflet-drag-target"),this._lastTarget=null),bi)Re(document,bi[t],this._onMove,this),Re(document,yi[t],this._onUp,this);Te(),ie(),this._moved&&this._moving&&(A(this._animRequest),this.fire("dragend",{distance:this._newPos.distanceTo(this._startPos)})),this._moving=!1,xi._dragging=!1}});function _i(t,e){if(!e||!t.length)return t.slice();var i=e*e;return t=Ci(t=Ei(t,i),i)}function wi(t,e,i){return Math.sqrt(Di(t,e,i,!0))}function ki(t,e,i){return Di(t,e,i)}function Ci(t,e){var i=t.length,n=new(typeof Uint8Array!=void 0+""?Uint8Array:Array)(i);n[0]=n[i-1]=1,Si(t,n,e,0,i-1);var o,s=[];for(o=0;o<i;o++)n[o]&&s.push(t[o]);return s}function Si(t,e,i,n,o){var s,r,a,l=0;for(r=n+1;r<=o-1;r++)(a=Di(t[r],t[n],t[o],!0))>l&&(s=r,l=a);l>i&&(e[s]=1,Si(t,e,i,n,s),Si(t,e,i,s,o))}function Ei(t,e){for(var i=[t[0]],n=1,o=0,s=t.length;n<s;n++)Pi(t[n],t[o])>e&&(i.push(t[n]),o=n);return o<s-1&&i.push(t[s-1]),i}function Ai(t,e,i,n,o){var s,r,a,l=n?gi:Ti(t,i),c=Ti(e,i);for(gi=c;;){if(!(l|c))return[t,e];if(l&c)return!1;a=Ti(r=Mi(t,e,s=l||c,i,o),i),s===l?(t=r,l=a):(e=r,c=a)}}function Mi(t,e,i,n,o){var s,r,a=e.x-t.x,l=e.y-t.y,c=n.min,h=n.max;return 8&i?(s=t.x+a*(h.y-t.y)/l,r=h.y):4&i?(s=t.x+a*(c.y-t.y)/l,r=c.y):2&i?(s=h.x,r=t.y+l*(h.x-t.x)/a):1&i&&(s=c.x,r=t.y+l*(c.x-t.x)/a),new O(s,r,o)}function Ti(t,e){var i=0;return t.x<e.min.x?i|=1:t.x>e.max.x&&(i|=2),t.y<e.min.y?i|=4:t.y>e.max.y&&(i|=8),i}function Pi(t,e){var i=e.x-t.x,n=e.y-t.y;return i*i+n*n}function Di(t,e,i,n){var o,s=e.x,r=e.y,a=i.x-s,l=i.y-r,c=a*a+l*l;return c>0&&((o=((t.x-s)*a+(t.y-r)*l)/c)>1?(s=i.x,r=i.y):o>0&&(s+=a*o,r+=l*o)),a=t.x-s,l=t.y-r,n?a*a+l*l:new O(s,r)}function Ii(t){return!y(t[0])||"object"!=typeof t[0][0]&&void 0!==t[0][0]}function Oi(t){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),Ii(t)}var $i=(Object.freeze||Object)({simplify:_i,pointToSegmentDistance:wi,closestPointOnSegment:ki,clipSegment:Ai,_getEdgeIntersection:Mi,_getBitCode:Ti,_sqClosestPointOnSegment:Di,isFlat:Ii,_flat:Oi});function Li(t,e,i){var n,o,s,r,a,l,c,h,d,u=[1,4,2,8];for(o=0,c=t.length;o<c;o++)t[o]._code=Ti(t[o],e);for(r=0;r<4;r++){for(h=u[r],n=[],o=0,s=(c=t.length)-1;o<c;s=o++)a=t[o],l=t[s],a._code&h?l._code&h||((d=Mi(l,a,h,e,i))._code=Ti(d,e),n.push(d)):(l._code&h&&((d=Mi(l,a,h,e,i))._code=Ti(d,e),n.push(d)),n.push(a));t=n}return t}var zi=(Object.freeze||Object)({clipPolygon:Li}),Ri={project:function(t){return new O(t.lng,t.lat)},unproject:function(t){return new F(t.y,t.x)},bounds:new R([-180,-90],[180,90])},Ni={R:6378137,R_MINOR:6356752.314245179,bounds:new R([-20037508.34279,-15496570.73972],[20037508.34279,18764656.23138]),project:function(t){var e=Math.PI/180,i=this.R,n=t.lat*e,o=this.R_MINOR/i,s=Math.sqrt(1-o*o),r=s*Math.sin(n),a=Math.tan(Math.PI/4-n/2)/Math.pow((1-r)/(1+r),s/2);return n=-i*Math.log(Math.max(a,1e-10)),new O(t.lng*e*i,n)},unproject:function(t){for(var e,i=180/Math.PI,n=this.R,o=this.R_MINOR/n,s=Math.sqrt(1-o*o),r=Math.exp(-t.y/n),a=Math.PI/2-2*Math.atan(r),l=0,c=.1;l<15&&Math.abs(c)>1e-7;l++)e=s*Math.sin(a),e=Math.pow((1-e)/(1+e),s/2),a+=c=Math.PI/2-2*Math.atan(r*e)-a;return new F(a*i,t.x*i/n)}},ji=(Object.freeze||Object)({LonLat:Ri,Mercator:Ni,SphericalMercator:W}),Bi=n({},H,{code:"EPSG:3395",projection:Ni,transformation:function(){var t=.5/(Math.PI*Ni.R);return Z(t,.5,-t,.5)}()}),Fi=n({},H,{code:"EPSG:4326",projection:Ri,transformation:Z(1/180,1,-1/180,.5)}),qi=n({},V,{projection:Ri,transformation:Z(1,0,-1,0),scale:function(t){return Math.pow(2,t)},zoom:function(t){return Math.log(t)/Math.LN2},distance:function(t,e){var i=e.lng-t.lng,n=e.lat-t.lat;return Math.sqrt(i*i+n*n)},infinite:!0});V.Earth=H,V.EPSG3395=Bi,V.EPSG3857=Y,V.EPSG900913=X,V.EPSG4326=Fi,V.Simple=qi;var Vi=I.extend({options:{pane:"overlayPane",attribution:null,bubblingMouseEvents:!0},addTo:function(t){return t.addLayer(this),this},remove:function(){return this.removeFrom(this._map||this._mapToAdd)},removeFrom:function(t){return t&&t.removeLayer(this),this},getPane:function(t){return this._map.getPane(t?this.options[t]||t:this.options.pane)},addInteractiveTarget:function(t){return this._map._targets[a(t)]=this,this},removeInteractiveTarget:function(t){return delete this._map._targets[a(t)],this},getAttribution:function(){return this.options.attribution},_layerAdd:function(t){var e=t.target;if(e.hasLayer(this)){if(this._map=e,this._zoomAnimated=e._zoomAnimated,this.getEvents){var i=this.getEvents();e.on(i,this),this.once("remove",(function(){e.off(i,this)}),this)}this.onAdd(e),this.getAttribution&&e.attributionControl&&e.attributionControl.addAttribution(this.getAttribution()),this.fire("add"),e.fire("layeradd",{layer:this})}}});ii.include({addLayer:function(t){if(!t._layerAdd)throw new Error("The provided object is not a Layer.");var e=a(t);return this._layers[e]||(this._layers[e]=t,t._mapToAdd=this,t.beforeAdd&&t.beforeAdd(this),this.whenReady(t._layerAdd,t)),this},removeLayer:function(t){var e=a(t);return this._layers[e]?(this._loaded&&t.onRemove(this),t.getAttribution&&this.attributionControl&&this.attributionControl.removeAttribution(t.getAttribution()),delete this._layers[e],this._loaded&&(this.fire("layerremove",{layer:t}),t.fire("remove")),t._map=t._mapToAdd=null,this):this},hasLayer:function(t){return!!t&&a(t)in this._layers},eachLayer:function(t,e){for(var i in this._layers)t.call(e,this._layers[i]);return this},_addLayers:function(t){for(var e=0,i=(t=t?y(t)?t:[t]:[]).length;e<i;e++)this.addLayer(t[e])},_addZoomLimit:function(t){!isNaN(t.options.maxZoom)&&isNaN(t.options.minZoom)||(this._zoomBoundLayers[a(t)]=t,this._updateZoomLevels())},_removeZoomLimit:function(t){var e=a(t);this._zoomBoundLayers[e]&&(delete this._zoomBoundLayers[e],this._updateZoomLevels())},_updateZoomLevels:function(){var t=1/0,e=-1/0,i=this._getZoomSpan();for(var n in this._zoomBoundLayers){var o=this._zoomBoundLayers[n].options;t=void 0===o.minZoom?t:Math.min(t,o.minZoom),e=void 0===o.maxZoom?e:Math.max(e,o.maxZoom)}this._layersMaxZoom=e===-1/0?void 0:e,this._layersMinZoom=t===1/0?void 0:t,i!==this._getZoomSpan()&&this.fire("zoomlevelschange"),void 0===this.options.maxZoom&&this._layersMaxZoom&&this.getZoom()>this._layersMaxZoom&&this.setZoom(this._layersMaxZoom),void 0===this.options.minZoom&&this._layersMinZoom&&this.getZoom()<this._layersMinZoom&&this.setZoom(this._layersMinZoom)}});var Hi=Vi.extend({initialize:function(t,e){var i,n;if(m(this,e),this._layers={},t)for(i=0,n=t.length;i<n;i++)this.addLayer(t[i])},addLayer:function(t){var e=this.getLayerId(t);return this._layers[e]=t,this._map&&this._map.addLayer(t),this},removeLayer:function(t){var e=t in this._layers?t:this.getLayerId(t);return this._map&&this._layers[e]&&this._map.removeLayer(this._layers[e]),delete this._layers[e],this},hasLayer:function(t){return!!t&&(t in this._layers||this.getLayerId(t)in this._layers)},clearLayers:function(){return this.eachLayer(this.removeLayer,this)},invoke:function(t){var e,i,n=Array.prototype.slice.call(arguments,1);for(e in this._layers)(i=this._layers[e])[t]&&i[t].apply(i,n);return this},onAdd:function(t){this.eachLayer(t.addLayer,t)},onRemove:function(t){this.eachLayer(t.removeLayer,t)},eachLayer:function(t,e){for(var i in this._layers)t.call(e,this._layers[i]);return this},getLayer:function(t){return this._layers[t]},getLayers:function(){var t=[];return this.eachLayer(t.push,t),t},setZIndex:function(t){return this.invoke("setZIndex",t)},getLayerId:function(t){return a(t)}}),Ui=function(t,e){return new Hi(t,e)},Wi=Hi.extend({addLayer:function(t){return this.hasLayer(t)?this:(t.addEventParent(this),Hi.prototype.addLayer.call(this,t),this.fire("layeradd",{layer:t}))},removeLayer:function(t){return this.hasLayer(t)?(t in this._layers&&(t=this._layers[t]),t.removeEventParent(this),Hi.prototype.removeLayer.call(this,t),this.fire("layerremove",{layer:t})):this},setStyle:function(t){return this.invoke("setStyle",t)},bringToFront:function(){return this.invoke("bringToFront")},bringToBack:function(){return this.invoke("bringToBack")},getBounds:function(){var t=new j;for(var e in this._layers){var i=this._layers[e];t.extend(i.getBounds?i.getBounds():i.getLatLng())}return t}}),Gi=function(t){return new Wi(t)},Zi=T.extend({options:{popupAnchor:[0,0],tooltipAnchor:[0,0]},initialize:function(t){m(this,t)},createIcon:function(t){return this._createIcon("icon",t)},createShadow:function(t){return this._createIcon("shadow",t)},_createIcon:function(t,e){var i=this._getIconUrl(t);if(!i){if("icon"===t)throw new Error("iconUrl not set in Icon options (see the docs).");return null}var n=this._createImg(i,e&&"IMG"===e.tagName?e:null);return this._setIconStyles(n,t),n},_setIconStyles:function(t,e){var i=this.options,n=i[e+"Size"];"number"==typeof n&&(n=[n,n]);var o=z(n),s=z("shadow"===e&&i.shadowAnchor||i.iconAnchor||o&&o.divideBy(2,!0));t.className="leaflet-marker-"+e+" "+(i.className||""),s&&(t.style.marginLeft=-s.x+"px",t.style.marginTop=-s.y+"px"),o&&(t.style.width=o.x+"px",t.style.height=o.y+"px")},_createImg:function(t,e){return(e=e||document.createElement("img")).src=t,e},_getIconUrl:function(t){return At&&this.options[t+"RetinaUrl"]||this.options[t+"Url"]}});function Yi(t){return new Zi(t)}var Xi=Zi.extend({options:{iconUrl:"marker-icon.png",iconRetinaUrl:"marker-icon-2x.png",shadowUrl:"marker-shadow.png",iconSize:[25,41],iconAnchor:[12,41],popupAnchor:[1,-34],tooltipAnchor:[16,-28],shadowSize:[41,41]},_getIconUrl:function(t){return Xi.imagePath||(Xi.imagePath=this._detectIconPath()),(this.options.imagePath||Xi.imagePath)+Zi.prototype._getIconUrl.call(this,t)},_detectIconPath:function(){var t=de("div","leaflet-default-icon-path",document.body),e=he(t,"background-image")||he(t,"backgroundImage");return document.body.removeChild(t),e=null===e||0!==e.indexOf("url")?"":e.replace(/^url\(["']?/,"").replace(/marker-icon\.png["']?\)$/,"")}}),Ki=mi.extend({initialize:function(t){this._marker=t},addHooks:function(){var t=this._marker._icon;this._draggable||(this._draggable=new xi(t,t,!0)),this._draggable.on({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).enable(),ve(t,"leaflet-marker-draggable")},removeHooks:function(){this._draggable.off({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).disable(),this._marker._icon&&ye(this._marker._icon,"leaflet-marker-draggable")},moved:function(){return this._draggable&&this._draggable._moved},_adjustPan:function(t){var e=this._marker,i=e._map,n=this._marker.options.autoPanSpeed,o=this._marker.options.autoPanPadding,s=Ee(e._icon),r=i.getPixelBounds(),a=i.getPixelOrigin(),l=N(r.min._subtract(a).add(o),r.max._subtract(a).subtract(o));if(!l.contains(s)){var c=z((Math.max(l.max.x,s.x)-l.max.x)/(r.max.x-l.max.x)-(Math.min(l.min.x,s.x)-l.min.x)/(r.min.x-l.min.x),(Math.max(l.max.y,s.y)-l.max.y)/(r.max.y-l.max.y)-(Math.min(l.min.y,s.y)-l.min.y)/(r.min.y-l.min.y)).multiplyBy(n);i.panBy(c,{animate:!1}),this._draggable._newPos._add(c),this._draggable._startPos._add(c),Se(e._icon,this._draggable._newPos),this._onDrag(t),this._panRequest=E(this._adjustPan.bind(this,t))}},_onDragStart:function(){this._oldLatLng=this._marker.getLatLng(),this._marker.closePopup().fire("movestart").fire("dragstart")},_onPreDrag:function(t){this._marker.options.autoPan&&(A(this._panRequest),this._panRequest=E(this._adjustPan.bind(this,t)))},_onDrag:function(t){var e=this._marker,i=e._shadow,n=Ee(e._icon),o=e._map.layerPointToLatLng(n);i&&Se(i,n),e._latlng=o,t.latlng=o,t.oldLatLng=this._oldLatLng,e.fire("move",t).fire("drag",t)},_onDragEnd:function(t){A(this._panRequest),delete this._oldLatLng,this._marker.fire("moveend").fire("dragend",t)}}),Qi=Vi.extend({options:{icon:new Xi,interactive:!0,keyboard:!0,title:"",alt:"",zIndexOffset:0,opacity:1,riseOnHover:!1,riseOffset:250,pane:"markerPane",shadowPane:"shadowPane",bubblingMouseEvents:!1,draggable:!1,autoPan:!1,autoPanPadding:[50,50],autoPanSpeed:10},initialize:function(t,e){m(this,e),this._latlng=q(t)},onAdd:function(t){this._zoomAnimated=this._zoomAnimated&&t.options.markerZoomAnimation,this._zoomAnimated&&t.on("zoomanim",this._animateZoom,this),this._initIcon(),this.update()},onRemove:function(t){this.dragging&&this.dragging.enabled()&&(this.options.draggable=!0,this.dragging.removeHooks()),delete this.dragging,this._zoomAnimated&&t.off("zoomanim",this._animateZoom,this),this._removeIcon(),this._removeShadow()},getEvents:function(){return{zoom:this.update,viewreset:this.update}},getLatLng:function(){return this._latlng},setLatLng:function(t){var e=this._latlng;return this._latlng=q(t),this.update(),this.fire("move",{oldLatLng:e,latlng:this._latlng})},setZIndexOffset:function(t){return this.options.zIndexOffset=t,this.update()},getIcon:function(){return this.options.icon},setIcon:function(t){return this.options.icon=t,this._map&&(this._initIcon(),this.update()),this._popup&&this.bindPopup(this._popup,this._popup.options),this},getElement:function(){return this._icon},update:function(){if(this._icon&&this._map){var t=this._map.latLngToLayerPoint(this._latlng).round();this._setPos(t)}return this},_initIcon:function(){var t=this.options,e="leaflet-zoom-"+(this._zoomAnimated?"animated":"hide"),i=t.icon.createIcon(this._icon),n=!1;i!==this._icon&&(this._icon&&this._removeIcon(),n=!0,t.title&&(i.title=t.title),"IMG"===i.tagName&&(i.alt=t.alt||"")),ve(i,e),t.keyboard&&(i.tabIndex="0"),this._icon=i,t.riseOnHover&&this.on({mouseover:this._bringToFront,mouseout:this._resetZIndex});var o=t.icon.createShadow(this._shadow),s=!1;o!==this._shadow&&(this._removeShadow(),s=!0),o&&(ve(o,e),o.alt=""),this._shadow=o,t.opacity<1&&this._updateOpacity(),n&&this.getPane().appendChild(this._icon),this._initInteraction(),o&&s&&this.getPane(t.shadowPane).appendChild(this._shadow)},_removeIcon:function(){this.options.riseOnHover&&this.off({mouseover:this._bringToFront,mouseout:this._resetZIndex}),ue(this._icon),this.removeInteractiveTarget(this._icon),this._icon=null},_removeShadow:function(){this._shadow&&ue(this._shadow),this._shadow=null},_setPos:function(t){Se(this._icon,t),this._shadow&&Se(this._shadow,t),this._zIndex=t.y+this.options.zIndexOffset,this._resetZIndex()},_updateZIndex:function(t){this._icon.style.zIndex=this._zIndex+t},_animateZoom:function(t){var e=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center).round();this._setPos(e)},_initInteraction:function(){if(this.options.interactive&&(ve(this._icon,"leaflet-interactive"),this.addInteractiveTarget(this._icon),Ki)){var t=this.options.draggable;this.dragging&&(t=this.dragging.enabled(),this.dragging.disable()),this.dragging=new Ki(this),t&&this.dragging.enable()}},setOpacity:function(t){return this.options.opacity=t,this._map&&this._updateOpacity(),this},_updateOpacity:function(){var t=this.options.opacity;this._icon&&_e(this._icon,t),this._shadow&&_e(this._shadow,t)},_bringToFront:function(){this._updateZIndex(this.options.riseOffset)},_resetZIndex:function(){this._updateZIndex(0)},_getPopupAnchor:function(){return this.options.icon.options.popupAnchor},_getTooltipAnchor:function(){return this.options.icon.options.tooltipAnchor}});function Ji(t,e){return new Qi(t,e)}var tn=Vi.extend({options:{stroke:!0,color:"#3388ff",weight:3,opacity:1,lineCap:"round",lineJoin:"round",dashArray:null,dashOffset:null,fill:!1,fillColor:null,fillOpacity:.2,fillRule:"evenodd",interactive:!0,bubblingMouseEvents:!0},beforeAdd:function(t){this._renderer=t.getRenderer(this)},onAdd:function(){this._renderer._initPath(this),this._reset(),this._renderer._addPath(this)},onRemove:function(){this._renderer._removePath(this)},redraw:function(){return this._map&&this._renderer._updatePath(this),this},setStyle:function(t){return m(this,t),this._renderer&&(this._renderer._updateStyle(this),this.options.stroke&&t.hasOwnProperty("weight")&&this._updateBounds()),this},bringToFront:function(){return this._renderer&&this._renderer._bringToFront(this),this},bringToBack:function(){return this._renderer&&this._renderer._bringToBack(this),this},getElement:function(){return this._path},_reset:function(){this._project(),this._update()},_clickTolerance:function(){return(this.options.stroke?this.options.weight/2:0)+this._renderer.options.tolerance}}),en=tn.extend({options:{fill:!0,radius:10},initialize:function(t,e){m(this,e),this._latlng=q(t),this._radius=this.options.radius},setLatLng:function(t){return this._latlng=q(t),this.redraw(),this.fire("move",{latlng:this._latlng})},getLatLng:function(){return this._latlng},setRadius:function(t){return this.options.radius=this._radius=t,this.redraw()},getRadius:function(){return this._radius},setStyle:function(t){var e=t&&t.radius||this._radius;return tn.prototype.setStyle.call(this,t),this.setRadius(e),this},_project:function(){this._point=this._map.latLngToLayerPoint(this._latlng),this._updateBounds()},_updateBounds:function(){var t=this._radius,e=this._radiusY||t,i=this._clickTolerance(),n=[t+i,e+i];this._pxBounds=new R(this._point.subtract(n),this._point.add(n))},_update:function(){this._map&&this._updatePath()},_updatePath:function(){this._renderer._updateCircle(this)},_empty:function(){return this._radius&&!this._renderer._bounds.intersects(this._pxBounds)},_containsPoint:function(t){return t.distanceTo(this._point)<=this._radius+this._clickTolerance()}});function nn(t,e){return new en(t,e)}var on=en.extend({initialize:function(t,e,i){if("number"==typeof e&&(e=n({},i,{radius:e})),m(this,e),this._latlng=q(t),isNaN(this.options.radius))throw new Error("Circle radius cannot be NaN");this._mRadius=this.options.radius},setRadius:function(t){return this._mRadius=t,this.redraw()},getRadius:function(){return this._mRadius},getBounds:function(){var t=[this._radius,this._radiusY||this._radius];return new j(this._map.layerPointToLatLng(this._point.subtract(t)),this._map.layerPointToLatLng(this._point.add(t)))},setStyle:tn.prototype.setStyle,_project:function(){var t=this._latlng.lng,e=this._latlng.lat,i=this._map,n=i.options.crs;if(n.distance===H.distance){var o=Math.PI/180,s=this._mRadius/H.R/o,r=i.project([e+s,t]),a=i.project([e-s,t]),l=r.add(a).divideBy(2),c=i.unproject(l).lat,h=Math.acos((Math.cos(s*o)-Math.sin(e*o)*Math.sin(c*o))/(Math.cos(e*o)*Math.cos(c*o)))/o;(isNaN(h)||0===h)&&(h=s/Math.cos(Math.PI/180*e)),this._point=l.subtract(i.getPixelOrigin()),this._radius=isNaN(h)?0:l.x-i.project([c,t-h]).x,this._radiusY=l.y-r.y}else{var d=n.unproject(n.project(this._latlng).subtract([this._mRadius,0]));this._point=i.latLngToLayerPoint(this._latlng),this._radius=this._point.x-i.latLngToLayerPoint(d).x}this._updateBounds()}});function sn(t,e,i){return new on(t,e,i)}var rn=tn.extend({options:{smoothFactor:1,noClip:!1},initialize:function(t,e){m(this,e),this._setLatLngs(t)},getLatLngs:function(){return this._latlngs},setLatLngs:function(t){return this._setLatLngs(t),this.redraw()},isEmpty:function(){return!this._latlngs.length},closestLayerPoint:function(t){for(var e,i,n=1/0,o=null,s=Di,r=0,a=this._parts.length;r<a;r++)for(var l=this._parts[r],c=1,h=l.length;c<h;c++){var d=s(t,e=l[c-1],i=l[c],!0);d<n&&(n=d,o=s(t,e,i))}return o&&(o.distance=Math.sqrt(n)),o},getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");var t,e,i,n,o,s,r,a=this._rings[0],l=a.length;if(!l)return null;for(t=0,e=0;t<l-1;t++)e+=a[t].distanceTo(a[t+1])/2;if(0===e)return this._map.layerPointToLatLng(a[0]);for(t=0,n=0;t<l-1;t++)if(o=a[t],s=a[t+1],(n+=i=o.distanceTo(s))>e)return r=(n-e)/i,this._map.layerPointToLatLng([s.x-r*(s.x-o.x),s.y-r*(s.y-o.y)])},getBounds:function(){return this._bounds},addLatLng:function(t,e){return e=e||this._defaultShape(),t=q(t),e.push(t),this._bounds.extend(t),this.redraw()},_setLatLngs:function(t){this._bounds=new j,this._latlngs=this._convertLatLngs(t)},_defaultShape:function(){return Ii(this._latlngs)?this._latlngs:this._latlngs[0]},_convertLatLngs:function(t){for(var e=[],i=Ii(t),n=0,o=t.length;n<o;n++)i?(e[n]=q(t[n]),this._bounds.extend(e[n])):e[n]=this._convertLatLngs(t[n]);return e},_project:function(){var t=new R;this._rings=[],this._projectLatlngs(this._latlngs,this._rings,t),this._bounds.isValid()&&t.isValid()&&(this._rawPxBounds=t,this._updateBounds())},_updateBounds:function(){var t=this._clickTolerance(),e=new O(t,t);this._pxBounds=new R([this._rawPxBounds.min.subtract(e),this._rawPxBounds.max.add(e)])},_projectLatlngs:function(t,e,i){var n,o,s=t[0]instanceof F,r=t.length;if(s){for(o=[],n=0;n<r;n++)o[n]=this._map.latLngToLayerPoint(t[n]),i.extend(o[n]);e.push(o)}else for(n=0;n<r;n++)this._projectLatlngs(t[n],e,i)},_clipPoints:function(){var t=this._renderer._bounds;if(this._parts=[],this._pxBounds&&this._pxBounds.intersects(t))if(this.options.noClip)this._parts=this._rings;else{var e,i,n,o,s,r,a,l=this._parts;for(e=0,n=0,o=this._rings.length;e<o;e++)for(i=0,s=(a=this._rings[e]).length;i<s-1;i++)(r=Ai(a[i],a[i+1],t,i,!0))&&(l[n]=l[n]||[],l[n].push(r[0]),r[1]===a[i+1]&&i!==s-2||(l[n].push(r[1]),n++))}},_simplifyPoints:function(){for(var t=this._parts,e=this.options.smoothFactor,i=0,n=t.length;i<n;i++)t[i]=_i(t[i],e)},_update:function(){this._map&&(this._clipPoints(),this._simplifyPoints(),this._updatePath())},_updatePath:function(){this._renderer._updatePoly(this)},_containsPoint:function(t,e){var i,n,o,s,r,a,l=this._clickTolerance();if(!this._pxBounds||!this._pxBounds.contains(t))return!1;for(i=0,s=this._parts.length;i<s;i++)for(n=0,o=(r=(a=this._parts[i]).length)-1;n<r;o=n++)if((e||0!==n)&&wi(t,a[o],a[n])<=l)return!0;return!1}});function an(t,e){return new rn(t,e)}rn._flat=Oi;var ln=rn.extend({options:{fill:!0},isEmpty:function(){return!this._latlngs.length||!this._latlngs[0].length},getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");var t,e,i,n,o,s,r,a,l,c=this._rings[0],h=c.length;if(!h)return null;for(s=r=a=0,t=0,e=h-1;t<h;e=t++)i=c[t],n=c[e],o=i.y*n.x-n.y*i.x,r+=(i.x+n.x)*o,a+=(i.y+n.y)*o,s+=3*o;return l=0===s?c[0]:[r/s,a/s],this._map.layerPointToLatLng(l)},_convertLatLngs:function(t){var e=rn.prototype._convertLatLngs.call(this,t),i=e.length;return i>=2&&e[0]instanceof F&&e[0].equals(e[i-1])&&e.pop(),e},_setLatLngs:function(t){rn.prototype._setLatLngs.call(this,t),Ii(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return Ii(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var t=this._renderer._bounds,e=this.options.weight,i=new O(e,e);if(t=new R(t.min.subtract(i),t.max.add(i)),this._parts=[],this._pxBounds&&this._pxBounds.intersects(t))if(this.options.noClip)this._parts=this._rings;else for(var n,o=0,s=this._rings.length;o<s;o++)(n=Li(this._rings[o],t,!0)).length&&this._parts.push(n)},_updatePath:function(){this._renderer._updatePoly(this,!0)},_containsPoint:function(t){var e,i,n,o,s,r,a,l,c=!1;if(!this._pxBounds||!this._pxBounds.contains(t))return!1;for(o=0,a=this._parts.length;o<a;o++)for(s=0,r=(l=(e=this._parts[o]).length)-1;s<l;r=s++)i=e[s],n=e[r],i.y>t.y!=n.y>t.y&&t.x<(n.x-i.x)*(t.y-i.y)/(n.y-i.y)+i.x&&(c=!c);return c||rn.prototype._containsPoint.call(this,t,!0)}});function cn(t,e){return new ln(t,e)}var hn=Wi.extend({initialize:function(t,e){m(this,e),this._layers={},t&&this.addData(t)},addData:function(t){var e,i,n,o=y(t)?t:t.features;if(o){for(e=0,i=o.length;e<i;e++)((n=o[e]).geometries||n.geometry||n.features||n.coordinates)&&this.addData(n);return this}var s=this.options;if(s.filter&&!s.filter(t))return this;var r=dn(t,s);return r?(r.feature=vn(t),r.defaultOptions=r.options,this.resetStyle(r),s.onEachFeature&&s.onEachFeature(t,r),this.addLayer(r)):this},resetStyle:function(t){return t.options=n({},t.defaultOptions),this._setLayerStyle(t,this.options.style),this},setStyle:function(t){return this.eachLayer((function(e){this._setLayerStyle(e,t)}),this)},_setLayerStyle:function(t,e){t.setStyle&&("function"==typeof e&&(e=e(t.feature)),t.setStyle(e))}});function dn(t,e){var i,n,o,s,r="Feature"===t.type?t.geometry:t,a=r?r.coordinates:null,l=[],c=e&&e.pointToLayer,h=e&&e.coordsToLatLng||un;if(!a&&!r)return null;switch(r.type){case"Point":return i=h(a),c?c(t,i):new Qi(i);case"MultiPoint":for(o=0,s=a.length;o<s;o++)i=h(a[o]),l.push(c?c(t,i):new Qi(i));return new Wi(l);case"LineString":case"MultiLineString":return n=pn(a,"LineString"===r.type?0:1,h),new rn(n,e);case"Polygon":case"MultiPolygon":return n=pn(a,"Polygon"===r.type?1:2,h),new ln(n,e);case"GeometryCollection":for(o=0,s=r.geometries.length;o<s;o++){var d=dn({geometry:r.geometries[o],type:"Feature",properties:t.properties},e);d&&l.push(d)}return new Wi(l);default:throw new Error("Invalid GeoJSON object.")}}function un(t){return new F(t[1],t[0],t[2])}function pn(t,e,i){for(var n,o=[],s=0,r=t.length;s<r;s++)n=e?pn(t[s],e-1,i):(i||un)(t[s]),o.push(n);return o}function mn(t,e){return e="number"==typeof e?e:6,void 0!==t.alt?[d(t.lng,e),d(t.lat,e),d(t.alt,e)]:[d(t.lng,e),d(t.lat,e)]}function gn(t,e,i,n){for(var o=[],s=0,r=t.length;s<r;s++)o.push(e?gn(t[s],e-1,i,n):mn(t[s],n));return!e&&i&&o.push(o[0]),o}function fn(t,e){return t.feature?n({},t.feature,{geometry:e}):vn(e)}function vn(t){return"Feature"===t.type||"FeatureCollection"===t.type?t:{type:"Feature",properties:{},geometry:t}}var yn={toGeoJSON:function(t){return fn(this,{type:"Point",coordinates:mn(this.getLatLng(),t)})}};function bn(t,e){return new hn(t,e)}Qi.include(yn),on.include(yn),en.include(yn),rn.include({toGeoJSON:function(t){var e=!Ii(this._latlngs);return fn(this,{type:(e?"Multi":"")+"LineString",coordinates:gn(this._latlngs,e?1:0,!1,t)})}}),ln.include({toGeoJSON:function(t){var e=!Ii(this._latlngs),i=e&&!Ii(this._latlngs[0]),n=gn(this._latlngs,i?2:e?1:0,!0,t);return e||(n=[n]),fn(this,{type:(i?"Multi":"")+"Polygon",coordinates:n})}}),Hi.include({toMultiPoint:function(t){var e=[];return this.eachLayer((function(i){e.push(i.toGeoJSON(t).geometry.coordinates)})),fn(this,{type:"MultiPoint",coordinates:e})},toGeoJSON:function(t){var e=this.feature&&this.feature.geometry&&this.feature.geometry.type;if("MultiPoint"===e)return this.toMultiPoint(t);var i="GeometryCollection"===e,n=[];return this.eachLayer((function(e){if(e.toGeoJSON){var o=e.toGeoJSON(t);if(i)n.push(o.geometry);else{var s=vn(o);"FeatureCollection"===s.type?n.push.apply(n,s.features):n.push(s)}}})),i?fn(this,{geometries:n,type:"GeometryCollection"}):{type:"FeatureCollection",features:n}}});var xn=bn,_n=Vi.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(t,e,i){this._url=t,this._bounds=B(e),m(this,i)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(ve(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){ue(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},setOpacity:function(t){return this.options.opacity=t,this._image&&this._updateOpacity(),this},setStyle:function(t){return t.opacity&&this.setOpacity(t.opacity),this},bringToFront:function(){return this._map&&me(this._image),this},bringToBack:function(){return this._map&&ge(this._image),this},setUrl:function(t){return this._url=t,this._image&&(this._image.src=t),this},setBounds:function(t){return this._bounds=B(t),this._map&&this._reset(),this},getEvents:function(){var t={zoom:this._reset,viewreset:this._reset};return this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},getBounds:function(){return this._bounds},getElement:function(){return this._image},_initImage:function(){var t="IMG"===this._url.tagName,e=this._image=t?this._url:de("img");ve(e,"leaflet-image-layer"),this._zoomAnimated&&ve(e,"leaflet-zoom-animated"),this.options.className&&ve(e,this.options.className),e.onselectstart=h,e.onmousemove=h,e.onload=s(this.fire,this,"load"),e.onerror=s(this._overlayOnError,this,"error"),(this.options.crossOrigin||""===this.options.crossOrigin)&&(e.crossOrigin=!0===this.options.crossOrigin?"":this.options.crossOrigin),this.options.zIndex&&this._updateZIndex(),t?this._url=e.src:(e.src=this._url,e.alt=this.options.alt)},_animateZoom:function(t){var e=this._map.getZoomScale(t.zoom),i=this._map._latLngBoundsToNewLayerBounds(this._bounds,t.zoom,t.center).min;Ce(this._image,i,e)},_reset:function(){var t=this._image,e=new R(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),i=e.getSize();Se(t,e.min),t.style.width=i.x+"px",t.style.height=i.y+"px"},_updateOpacity:function(){_e(this._image,this.options.opacity)},_updateZIndex:function(){this._image&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._image.style.zIndex=this.options.zIndex)},_overlayOnError:function(){this.fire("error");var t=this.options.errorOverlayUrl;t&&this._url!==t&&(this._url=t,this._image.src=t)}}),wn=function(t,e,i){return new _n(t,e,i)},kn=_n.extend({options:{autoplay:!0,loop:!0,keepAspectRatio:!0},_initImage:function(){var t="VIDEO"===this._url.tagName,e=this._image=t?this._url:de("video");if(ve(e,"leaflet-image-layer"),this._zoomAnimated&&ve(e,"leaflet-zoom-animated"),e.onselectstart=h,e.onmousemove=h,e.onloadeddata=s(this.fire,this,"load"),t){for(var i=e.getElementsByTagName("source"),n=[],o=0;o<i.length;o++)n.push(i[o].src);this._url=i.length>0?n:[e.src]}else{y(this._url)||(this._url=[this._url]),!this.options.keepAspectRatio&&e.style.hasOwnProperty("objectFit")&&(e.style.objectFit="fill"),e.autoplay=!!this.options.autoplay,e.loop=!!this.options.loop;for(var r=0;r<this._url.length;r++){var a=de("source");a.src=this._url[r],e.appendChild(a)}}}});function Cn(t,e,i){return new kn(t,e,i)}var Sn=_n.extend({_initImage:function(){var t=this._image=this._url;ve(t,"leaflet-image-layer"),this._zoomAnimated&&ve(t,"leaflet-zoom-animated"),t.onselectstart=h,t.onmousemove=h}});function En(t,e,i){return new Sn(t,e,i)}var An=Vi.extend({options:{offset:[0,7],className:"",pane:"popupPane"},initialize:function(t,e){m(this,t),this._source=e},onAdd:function(t){this._zoomAnimated=t._zoomAnimated,this._container||this._initLayout(),t._fadeAnimated&&_e(this._container,0),clearTimeout(this._removeTimeout),this.getPane().appendChild(this._container),this.update(),t._fadeAnimated&&_e(this._container,1),this.bringToFront()},onRemove:function(t){t._fadeAnimated?(_e(this._container,0),this._removeTimeout=setTimeout(s(ue,void 0,this._container),200)):ue(this._container)},getLatLng:function(){return this._latlng},setLatLng:function(t){return this._latlng=q(t),this._map&&(this._updatePosition(),this._adjustPan()),this},getContent:function(){return this._content},setContent:function(t){return this._content=t,this.update(),this},getElement:function(){return this._container},update:function(){this._map&&(this._container.style.visibility="hidden",this._updateContent(),this._updateLayout(),this._updatePosition(),this._container.style.visibility="",this._adjustPan())},getEvents:function(){var t={zoom:this._updatePosition,viewreset:this._updatePosition};return this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},isOpen:function(){return!!this._map&&this._map.hasLayer(this)},bringToFront:function(){return this._map&&me(this._container),this},bringToBack:function(){return this._map&&ge(this._container),this},_prepareOpen:function(t,e,i){if(e instanceof Vi||(i=e,e=t),e instanceof Wi)for(var n in t._layers){e=t._layers[n];break}if(!i)if(e.getCenter)i=e.getCenter();else{if(!e.getLatLng)throw new Error("Unable to get source layer LatLng.");i=e.getLatLng()}return this._source=e,this.update(),i},_updateContent:function(){if(this._content){var t=this._contentNode,e="function"==typeof this._content?this._content(this._source||this):this._content;if("string"==typeof e)t.innerHTML=e;else{for(;t.hasChildNodes();)t.removeChild(t.firstChild);t.appendChild(e)}this.fire("contentupdate")}},_updatePosition:function(){if(this._map){var t=this._map.latLngToLayerPoint(this._latlng),e=z(this.options.offset),i=this._getAnchor();this._zoomAnimated?Se(this._container,t.add(i)):e=e.add(t).add(i);var n=this._containerBottom=-e.y,o=this._containerLeft=-Math.round(this._containerWidth/2)+e.x;this._container.style.bottom=n+"px",this._container.style.left=o+"px"}},_getAnchor:function(){return[0,0]}}),Mn=An.extend({options:{maxWidth:300,minWidth:50,maxHeight:null,autoPan:!0,autoPanPaddingTopLeft:null,autoPanPaddingBottomRight:null,autoPanPadding:[5,5],keepInView:!1,closeButton:!0,autoClose:!0,closeOnEscapeKey:!0,className:""},openOn:function(t){return t.openPopup(this),this},onAdd:function(t){An.prototype.onAdd.call(this,t),t.fire("popupopen",{popup:this}),this._source&&(this._source.fire("popupopen",{popup:this},!0),this._source instanceof tn||this._source.on("preclick",Be))},onRemove:function(t){An.prototype.onRemove.call(this,t),t.fire("popupclose",{popup:this}),this._source&&(this._source.fire("popupclose",{popup:this},!0),this._source instanceof tn||this._source.off("preclick",Be))},getEvents:function(){var t=An.prototype.getEvents.call(this);return(void 0!==this.options.closeOnClick?this.options.closeOnClick:this._map.options.closePopupOnClick)&&(t.preclick=this._close),this.options.keepInView&&(t.moveend=this._adjustPan),t},_close:function(){this._map&&this._map.closePopup(this)},_initLayout:function(){var t="leaflet-popup",e=this._container=de("div",t+" "+(this.options.className||"")+" leaflet-zoom-animated"),i=this._wrapper=de("div",t+"-content-wrapper",e);if(this._contentNode=de("div",t+"-content",i),qe(i),Fe(this._contentNode),Le(i,"contextmenu",Be),this._tipContainer=de("div",t+"-tip-container",e),this._tip=de("div",t+"-tip",this._tipContainer),this.options.closeButton){var n=this._closeButton=de("a",t+"-close-button",e);n.href="#close",n.innerHTML="×",Le(n,"click",this._onCloseButtonClick,this)}},_updateLayout:function(){var t=this._contentNode,e=t.style;e.width="",e.whiteSpace="nowrap";var i=t.offsetWidth;i=Math.min(i,this.options.maxWidth),i=Math.max(i,this.options.minWidth),e.width=i+1+"px",e.whiteSpace="",e.height="";var n=t.offsetHeight,o=this.options.maxHeight,s="leaflet-popup-scrolled";o&&n>o?(e.height=o+"px",ve(t,s)):ye(t,s),this._containerWidth=this._container.offsetWidth},_animateZoom:function(t){var e=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center),i=this._getAnchor();Se(this._container,e.add(i))},_adjustPan:function(){if(this.options.autoPan){this._map._panAnim&&this._map._panAnim.stop();var t=this._map,e=parseInt(he(this._container,"marginBottom"),10)||0,i=this._container.offsetHeight+e,n=this._containerWidth,o=new O(this._containerLeft,-i-this._containerBottom);o._add(Ee(this._container));var s=t.layerPointToContainerPoint(o),r=z(this.options.autoPanPadding),a=z(this.options.autoPanPaddingTopLeft||r),l=z(this.options.autoPanPaddingBottomRight||r),c=t.getSize(),h=0,d=0;s.x+n+l.x>c.x&&(h=s.x+n-c.x+l.x),s.x-h-a.x<0&&(h=s.x-a.x),s.y+i+l.y>c.y&&(d=s.y+i-c.y+l.y),s.y-d-a.y<0&&(d=s.y-a.y),(h||d)&&t.fire("autopanstart").panBy([h,d])}},_onCloseButtonClick:function(t){this._close(),He(t)},_getAnchor:function(){return z(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),Tn=function(t,e){return new Mn(t,e)};ii.mergeOptions({closePopupOnClick:!0}),ii.include({openPopup:function(t,e,i){return t instanceof Mn||(t=new Mn(i).setContent(t)),e&&t.setLatLng(e),this.hasLayer(t)?this:(this._popup&&this._popup.options.autoClose&&this.closePopup(),this._popup=t,this.addLayer(t))},closePopup:function(t){return t&&t!==this._popup||(t=this._popup,this._popup=null),t&&this.removeLayer(t),this}}),Vi.include({bindPopup:function(t,e){return t instanceof Mn?(m(t,e),this._popup=t,t._source=this):(this._popup&&!e||(this._popup=new Mn(e,this)),this._popup.setContent(t)),this._popupHandlersAdded||(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,this._popup=null),this},openPopup:function(t,e){return this._popup&&this._map&&(e=this._popup._prepareOpen(this,t,e),this._map.openPopup(this._popup,e)),this},closePopup:function(){return this._popup&&this._popup._close(),this},togglePopup:function(t){return this._popup&&(this._popup._map?this.closePopup():this.openPopup(t)),this},isPopupOpen:function(){return!!this._popup&&this._popup.isOpen()},setPopupContent:function(t){return this._popup&&this._popup.setContent(t),this},getPopup:function(){return this._popup},_openPopup:function(t){var e=t.layer||t.target;this._popup&&this._map&&(He(t),e instanceof tn?this.openPopup(t.layer||t.target,t.latlng):this._map.hasLayer(this._popup)&&this._popup._source===e?this.closePopup():this.openPopup(e,t.latlng))},_movePopup:function(t){this._popup.setLatLng(t.latlng)},_onKeyPress:function(t){13===t.originalEvent.keyCode&&this._openPopup(t)}});var Pn=An.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,interactive:!1,opacity:.9},onAdd:function(t){An.prototype.onAdd.call(this,t),this.setOpacity(this.options.opacity),t.fire("tooltipopen",{tooltip:this}),this._source&&this._source.fire("tooltipopen",{tooltip:this},!0)},onRemove:function(t){An.prototype.onRemove.call(this,t),t.fire("tooltipclose",{tooltip:this}),this._source&&this._source.fire("tooltipclose",{tooltip:this},!0)},getEvents:function(){var t=An.prototype.getEvents.call(this);return Ct&&!this.options.permanent&&(t.preclick=this._close),t},_close:function(){this._map&&this._map.closeTooltip(this)},_initLayout:function(){var t="leaflet-tooltip "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=de("div",t)},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(t){var e=this._map,i=this._container,n=e.latLngToContainerPoint(e.getCenter()),o=e.layerPointToContainerPoint(t),s=this.options.direction,r=i.offsetWidth,a=i.offsetHeight,l=z(this.options.offset),c=this._getAnchor();"top"===s?t=t.add(z(-r/2+l.x,-a+l.y+c.y,!0)):"bottom"===s?t=t.subtract(z(r/2-l.x,-l.y,!0)):"center"===s?t=t.subtract(z(r/2+l.x,a/2-c.y+l.y,!0)):"right"===s||"auto"===s&&o.x<n.x?(s="right",t=t.add(z(l.x+c.x,c.y-a/2+l.y,!0))):(s="left",t=t.subtract(z(r+c.x-l.x,a/2-c.y-l.y,!0))),ye(i,"leaflet-tooltip-right"),ye(i,"leaflet-tooltip-left"),ye(i,"leaflet-tooltip-top"),ye(i,"leaflet-tooltip-bottom"),ve(i,"leaflet-tooltip-"+s),Se(i,t)},_updatePosition:function(){var t=this._map.latLngToLayerPoint(this._latlng);this._setPosition(t)},setOpacity:function(t){this.options.opacity=t,this._container&&_e(this._container,t)},_animateZoom:function(t){var e=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center);this._setPosition(e)},_getAnchor:function(){return z(this._source&&this._source._getTooltipAnchor&&!this.options.sticky?this._source._getTooltipAnchor():[0,0])}}),Dn=function(t,e){return new Pn(t,e)};ii.include({openTooltip:function(t,e,i){return t instanceof Pn||(t=new Pn(i).setContent(t)),e&&t.setLatLng(e),this.hasLayer(t)?this:this.addLayer(t)},closeTooltip:function(t){return t&&this.removeLayer(t),this}}),Vi.include({bindTooltip:function(t,e){return t instanceof Pn?(m(t,e),this._tooltip=t,t._source=this):(this._tooltip&&!e||(this._tooltip=new Pn(e,this)),this._tooltip.setContent(t)),this._initTooltipInteractions(),this._tooltip.options.permanent&&this._map&&this._map.hasLayer(this)&&this.openTooltip(),this},unbindTooltip:function(){return this._tooltip&&(this._initTooltipInteractions(!0),this.closeTooltip(),this._tooltip=null),this},_initTooltipInteractions:function(t){if(t||!this._tooltipHandlersAdded){var e=t?"off":"on",i={remove:this.closeTooltip,move:this._moveTooltip};this._tooltip.options.permanent?i.add=this._openTooltip:(i.mouseover=this._openTooltip,i.mouseout=this.closeTooltip,this._tooltip.options.sticky&&(i.mousemove=this._moveTooltip),Ct&&(i.click=this._openTooltip)),this[e](i),this._tooltipHandlersAdded=!t}},openTooltip:function(t,e){return this._tooltip&&this._map&&(e=this._tooltip._prepareOpen(this,t,e),this._map.openTooltip(this._tooltip,e),this._tooltip.options.interactive&&this._tooltip._container&&(ve(this._tooltip._container,"leaflet-clickable"),this.addInteractiveTarget(this._tooltip._container))),this},closeTooltip:function(){return this._tooltip&&(this._tooltip._close(),this._tooltip.options.interactive&&this._tooltip._container&&(ye(this._tooltip._container,"leaflet-clickable"),this.removeInteractiveTarget(this._tooltip._container))),this},toggleTooltip:function(t){return this._tooltip&&(this._tooltip._map?this.closeTooltip():this.openTooltip(t)),this},isTooltipOpen:function(){return this._tooltip.isOpen()},setTooltipContent:function(t){return this._tooltip&&this._tooltip.setContent(t),this},getTooltip:function(){return this._tooltip},_openTooltip:function(t){var e=t.layer||t.target;this._tooltip&&this._map&&this.openTooltip(e,this._tooltip.options.sticky?t.latlng:void 0)},_moveTooltip:function(t){var e,i,n=t.latlng;this._tooltip.options.sticky&&t.originalEvent&&(e=this._map.mouseEventToContainerPoint(t.originalEvent),i=this._map.containerPointToLayerPoint(e),n=this._map.layerPointToLatLng(i)),this._tooltip.setLatLng(n)}});var In=Zi.extend({options:{iconSize:[12,12],html:!1,bgPos:null,className:"leaflet-div-icon"},createIcon:function(t){var e=t&&"DIV"===t.tagName?t:document.createElement("div"),i=this.options;if(i.html instanceof Element?(pe(e),e.appendChild(i.html)):e.innerHTML=!1!==i.html?i.html:"",i.bgPos){var n=z(i.bgPos);e.style.backgroundPosition=-n.x+"px "+-n.y+"px"}return this._setIconStyles(e,"icon"),e},createShadow:function(){return null}});function On(t){return new In(t)}Zi.Default=Xi;var $n=Vi.extend({options:{tileSize:256,opacity:1,updateWhenIdle:bt,updateWhenZooming:!0,updateInterval:200,zIndex:1,bounds:null,minZoom:0,maxZoom:void 0,maxNativeZoom:void 0,minNativeZoom:void 0,noWrap:!1,pane:"tilePane",className:"",keepBuffer:2},initialize:function(t){m(this,t)},onAdd:function(){this._initContainer(),this._levels={},this._tiles={},this._resetView(),this._update()},beforeAdd:function(t){t._addZoomLimit(this)},onRemove:function(t){this._removeAllTiles(),ue(this._container),t._removeZoomLimit(this),this._container=null,this._tileZoom=void 0},bringToFront:function(){return this._map&&(me(this._container),this._setAutoZIndex(Math.max)),this},bringToBack:function(){return this._map&&(ge(this._container),this._setAutoZIndex(Math.min)),this},getContainer:function(){return this._container},setOpacity:function(t){return this.options.opacity=t,this._updateOpacity(),this},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},isLoading:function(){return this._loading},redraw:function(){return this._map&&(this._removeAllTiles(),this._update()),this},getEvents:function(){var t={viewprereset:this._invalidateAll,viewreset:this._resetView,zoom:this._resetView,moveend:this._onMoveEnd};return this.options.updateWhenIdle||(this._onMove||(this._onMove=l(this._onMoveEnd,this.options.updateInterval,this)),t.move=this._onMove),this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},createTile:function(){return document.createElement("div")},getTileSize:function(){var t=this.options.tileSize;return t instanceof O?t:new O(t,t)},_updateZIndex:function(){this._container&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._container.style.zIndex=this.options.zIndex)},_setAutoZIndex:function(t){for(var e,i=this.getPane().children,n=-t(-1/0,1/0),o=0,s=i.length;o<s;o++)e=i[o].style.zIndex,i[o]!==this._container&&e&&(n=t(n,+e));isFinite(n)&&(this.options.zIndex=n+t(-1,1),this._updateZIndex())},_updateOpacity:function(){if(this._map&&!et){_e(this._container,this.options.opacity);var t=+new Date,e=!1,i=!1;for(var n in this._tiles){var o=this._tiles[n];if(o.current&&o.loaded){var s=Math.min(1,(t-o.loaded)/200);_e(o.el,s),s<1?e=!0:(o.active?i=!0:this._onOpaqueTile(o),o.active=!0)}}i&&!this._noPrune&&this._pruneTiles(),e&&(A(this._fadeFrame),this._fadeFrame=E(this._updateOpacity,this))}},_onOpaqueTile:h,_initContainer:function(){this._container||(this._container=de("div","leaflet-layer "+(this.options.className||"")),this._updateZIndex(),this.options.opacity<1&&this._updateOpacity(),this.getPane().appendChild(this._container))},_updateLevels:function(){var t=this._tileZoom,e=this.options.maxZoom;if(void 0!==t){for(var i in this._levels)this._levels[i].el.children.length||i===t?(this._levels[i].el.style.zIndex=e-Math.abs(t-i),this._onUpdateLevel(i)):(ue(this._levels[i].el),this._removeTilesAtZoom(i),this._onRemoveLevel(i),delete this._levels[i]);var n=this._levels[t],o=this._map;return n||((n=this._levels[t]={}).el=de("div","leaflet-tile-container leaflet-zoom-animated",this._container),n.el.style.zIndex=e,n.origin=o.project(o.unproject(o.getPixelOrigin()),t).round(),n.zoom=t,this._setZoomTransform(n,o.getCenter(),o.getZoom()),h(n.el.offsetWidth),this._onCreateLevel(n)),this._level=n,n}},_onUpdateLevel:h,_onRemoveLevel:h,_onCreateLevel:h,_pruneTiles:function(){if(this._map){var t,e,i=this._map.getZoom();if(i>this.options.maxZoom||i<this.options.minZoom)this._removeAllTiles();else{for(t in this._tiles)(e=this._tiles[t]).retain=e.current;for(t in this._tiles)if((e=this._tiles[t]).current&&!e.active){var n=e.coords;this._retainParent(n.x,n.y,n.z,n.z-5)||this._retainChildren(n.x,n.y,n.z,n.z+2)}for(t in this._tiles)this._tiles[t].retain||this._removeTile(t)}}},_removeTilesAtZoom:function(t){for(var e in this._tiles)this._tiles[e].coords.z===t&&this._removeTile(e)},_removeAllTiles:function(){for(var t in this._tiles)this._removeTile(t)},_invalidateAll:function(){for(var t in this._levels)ue(this._levels[t].el),this._onRemoveLevel(t),delete this._levels[t];this._removeAllTiles(),this._tileZoom=void 0},_retainParent:function(t,e,i,n){var o=Math.floor(t/2),s=Math.floor(e/2),r=i-1,a=new O(+o,+s);a.z=+r;var l=this._tileCoordsToKey(a),c=this._tiles[l];return c&&c.active?(c.retain=!0,!0):(c&&c.loaded&&(c.retain=!0),r>n&&this._retainParent(o,s,r,n))},_retainChildren:function(t,e,i,n){for(var o=2*t;o<2*t+2;o++)for(var s=2*e;s<2*e+2;s++){var r=new O(o,s);r.z=i+1;var a=this._tileCoordsToKey(r),l=this._tiles[a];l&&l.active?l.retain=!0:(l&&l.loaded&&(l.retain=!0),i+1<n&&this._retainChildren(o,s,i+1,n))}},_resetView:function(t){var e=t&&(t.pinch||t.flyTo);this._setView(this._map.getCenter(),this._map.getZoom(),e,e)},_animateZoom:function(t){this._setView(t.center,t.zoom,!0,t.noUpdate)},_clampZoom:function(t){var e=this.options;return void 0!==e.minNativeZoom&&t<e.minNativeZoom?e.minNativeZoom:void 0!==e.maxNativeZoom&&e.maxNativeZoom<t?e.maxNativeZoom:t},_setView:function(t,e,i,n){var o=this._clampZoom(Math.round(e));(void 0!==this.options.maxZoom&&o>this.options.maxZoom||void 0!==this.options.minZoom&&o<this.options.minZoom)&&(o=void 0);var s=this.options.updateWhenZooming&&o!==this._tileZoom;n&&!s||(this._tileZoom=o,this._abortLoading&&this._abortLoading(),this._updateLevels(),this._resetGrid(),void 0!==o&&this._update(t),i||this._pruneTiles(),this._noPrune=!!i),this._setZoomTransforms(t,e)},_setZoomTransforms:function(t,e){for(var i in this._levels)this._setZoomTransform(this._levels[i],t,e)},_setZoomTransform:function(t,e,i){var n=this._map.getZoomScale(i,t.zoom),o=t.origin.multiplyBy(n).subtract(this._map._getNewPixelOrigin(e,i)).round();yt?Ce(t.el,o,n):Se(t.el,o)},_resetGrid:function(){var t=this._map,e=t.options.crs,i=this._tileSize=this.getTileSize(),n=this._tileZoom,o=this._map.getPixelWorldBounds(this._tileZoom);o&&(this._globalTileRange=this._pxBoundsToTileRange(o)),this._wrapX=e.wrapLng&&!this.options.noWrap&&[Math.floor(t.project([0,e.wrapLng[0]],n).x/i.x),Math.ceil(t.project([0,e.wrapLng[1]],n).x/i.y)],this._wrapY=e.wrapLat&&!this.options.noWrap&&[Math.floor(t.project([e.wrapLat[0],0],n).y/i.x),Math.ceil(t.project([e.wrapLat[1],0],n).y/i.y)]},_onMoveEnd:function(){this._map&&!this._map._animatingZoom&&this._update()},_getTiledPixelBounds:function(t){var e=this._map,i=e._animatingZoom?Math.max(e._animateToZoom,e.getZoom()):e.getZoom(),n=e.getZoomScale(i,this._tileZoom),o=e.project(t,this._tileZoom).floor(),s=e.getSize().divideBy(2*n);return new R(o.subtract(s),o.add(s))},_update:function(t){var e=this._map;if(e){var i=this._clampZoom(e.getZoom());if(void 0===t&&(t=e.getCenter()),void 0!==this._tileZoom){var n=this._getTiledPixelBounds(t),o=this._pxBoundsToTileRange(n),s=o.getCenter(),r=[],a=this.options.keepBuffer,l=new R(o.getBottomLeft().subtract([a,-a]),o.getTopRight().add([a,-a]));if(!(isFinite(o.min.x)&&isFinite(o.min.y)&&isFinite(o.max.x)&&isFinite(o.max.y)))throw new Error("Attempted to load an infinite number of tiles");for(var c in this._tiles){var h=this._tiles[c].coords;h.z===this._tileZoom&&l.contains(new O(h.x,h.y))||(this._tiles[c].current=!1)}if(Math.abs(i-this._tileZoom)>1)this._setView(t,i);else{for(var d=o.min.y;d<=o.max.y;d++)for(var u=o.min.x;u<=o.max.x;u++){var p=new O(u,d);if(p.z=this._tileZoom,this._isValidTile(p)){var m=this._tiles[this._tileCoordsToKey(p)];m?m.current=!0:r.push(p)}}if(r.sort((function(t,e){return t.distanceTo(s)-e.distanceTo(s)})),0!==r.length){this._loading||(this._loading=!0,this.fire("loading"));var g=document.createDocumentFragment();for(u=0;u<r.length;u++)this._addTile(r[u],g);this._level.el.appendChild(g)}}}}},_isValidTile:function(t){var e=this._map.options.crs;if(!e.infinite){var i=this._globalTileRange;if(!e.wrapLng&&(t.x<i.min.x||t.x>i.max.x)||!e.wrapLat&&(t.y<i.min.y||t.y>i.max.y))return!1}if(!this.options.bounds)return!0;var n=this._tileCoordsToBounds(t);return B(this.options.bounds).overlaps(n)},_keyToBounds:function(t){return this._tileCoordsToBounds(this._keyToTileCoords(t))},_tileCoordsToNwSe:function(t){var e=this._map,i=this.getTileSize(),n=t.scaleBy(i),o=n.add(i);return[e.unproject(n,t.z),e.unproject(o,t.z)]},_tileCoordsToBounds:function(t){var e=this._tileCoordsToNwSe(t),i=new j(e[0],e[1]);return this.options.noWrap||(i=this._map.wrapLatLngBounds(i)),i},_tileCoordsToKey:function(t){return t.x+":"+t.y+":"+t.z},_keyToTileCoords:function(t){var e=t.split(":"),i=new O(+e[0],+e[1]);return i.z=+e[2],i},_removeTile:function(t){var e=this._tiles[t];e&&(ue(e.el),delete this._tiles[t],this.fire("tileunload",{tile:e.el,coords:this._keyToTileCoords(t)}))},_initTile:function(t){ve(t,"leaflet-tile");var e=this.getTileSize();t.style.width=e.x+"px",t.style.height=e.y+"px",t.onselectstart=h,t.onmousemove=h,et&&this.options.opacity<1&&_e(t,this.options.opacity),ot&&!st&&(t.style.WebkitBackfaceVisibility="hidden")},_addTile:function(t,e){var i=this._getTilePos(t),n=this._tileCoordsToKey(t),o=this.createTile(this._wrapCoords(t),s(this._tileReady,this,t));this._initTile(o),this.createTile.length<2&&E(s(this._tileReady,this,t,null,o)),Se(o,i),this._tiles[n]={el:o,coords:t,current:!0},e.appendChild(o),this.fire("tileloadstart",{tile:o,coords:t})},_tileReady:function(t,e,i){e&&this.fire("tileerror",{error:e,tile:i,coords:t});var n=this._tileCoordsToKey(t);(i=this._tiles[n])&&(i.loaded=+new Date,this._map._fadeAnimated?(_e(i.el,0),A(this._fadeFrame),this._fadeFrame=E(this._updateOpacity,this)):(i.active=!0,this._pruneTiles()),e||(ve(i.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:i.el,coords:t})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),et||!this._map._fadeAnimated?E(this._pruneTiles,this):setTimeout(s(this._pruneTiles,this),250)))},_getTilePos:function(t){return t.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(t){var e=new O(this._wrapX?c(t.x,this._wrapX):t.x,this._wrapY?c(t.y,this._wrapY):t.y);return e.z=t.z,e},_pxBoundsToTileRange:function(t){var e=this.getTileSize();return new R(t.min.unscaleBy(e).floor(),t.max.unscaleBy(e).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var t in this._tiles)if(!this._tiles[t].loaded)return!1;return!0}});function Ln(t){return new $n(t)}var zn=$n.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1},initialize:function(t,e){this._url=t,(e=m(this,e)).detectRetina&&At&&e.maxZoom>0&&(e.tileSize=Math.floor(e.tileSize/2),e.zoomReverse?(e.zoomOffset--,e.minZoom++):(e.zoomOffset++,e.maxZoom--),e.minZoom=Math.max(0,e.minZoom)),"string"==typeof e.subdomains&&(e.subdomains=e.subdomains.split("")),ot||this.on("tileunload",this._onTileRemove)},setUrl:function(t,e){return this._url===t&&void 0===e&&(e=!0),this._url=t,e||this.redraw(),this},createTile:function(t,e){var i=document.createElement("img");return Le(i,"load",s(this._tileOnLoad,this,e,i)),Le(i,"error",s(this._tileOnError,this,e,i)),(this.options.crossOrigin||""===this.options.crossOrigin)&&(i.crossOrigin=!0===this.options.crossOrigin?"":this.options.crossOrigin),i.alt="",i.setAttribute("role","presentation"),i.src=this.getTileUrl(t),i},getTileUrl:function(t){var e={r:At?"@2x":"",s:this._getSubdomain(t),x:t.x,y:t.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var i=this._globalTileRange.max.y-t.y;this.options.tms&&(e.y=i),e["-y"]=i}return v(this._url,n(e,this.options))},_tileOnLoad:function(t,e){et?setTimeout(s(t,this,null,e),0):t(null,e)},_tileOnError:function(t,e,i){var n=this.options.errorTileUrl;n&&e.getAttribute("src")!==n&&(e.src=n),t(i,e)},_onTileRemove:function(t){t.tile.onload=null},_getZoomForUrl:function(){var t=this._tileZoom,e=this.options.maxZoom;return this.options.zoomReverse&&(t=e-t),t+this.options.zoomOffset},_getSubdomain:function(t){var e=Math.abs(t.x+t.y)%this.options.subdomains.length;return this.options.subdomains[e]},_abortLoading:function(){var t,e;for(t in this._tiles)this._tiles[t].coords.z!==this._tileZoom&&((e=this._tiles[t].el).onload=h,e.onerror=h,e.complete||(e.src=x,ue(e),delete this._tiles[t]))},_removeTile:function(t){var e=this._tiles[t];if(e)return at||e.el.setAttribute("src",x),$n.prototype._removeTile.call(this,t)},_tileReady:function(t,e,i){if(this._map&&(!i||i.getAttribute("src")!==x))return $n.prototype._tileReady.call(this,t,e,i)}});function Rn(t,e){return new zn(t,e)}var Nn=zn.extend({defaultWmsParams:{service:"WMS",request:"GetMap",layers:"",styles:"",format:"image/jpeg",transparent:!1,version:"1.1.1"},options:{crs:null,uppercase:!1},initialize:function(t,e){this._url=t;var i=n({},this.defaultWmsParams);for(var o in e)o in this.options||(i[o]=e[o]);var s=(e=m(this,e)).detectRetina&&At?2:1,r=this.getTileSize();i.width=r.x*s,i.height=r.y*s,this.wmsParams=i},onAdd:function(t){this._crs=this.options.crs||t.options.crs,this._wmsVersion=parseFloat(this.wmsParams.version);var e=this._wmsVersion>=1.3?"crs":"srs";this.wmsParams[e]=this._crs.code,zn.prototype.onAdd.call(this,t)},getTileUrl:function(t){var e=this._tileCoordsToNwSe(t),i=this._crs,n=N(i.project(e[0]),i.project(e[1])),o=n.min,s=n.max,r=(this._wmsVersion>=1.3&&this._crs===Fi?[o.y,o.x,s.y,s.x]:[o.x,o.y,s.x,s.y]).join(","),a=zn.prototype.getTileUrl.call(this,t);return a+g(this.wmsParams,a,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+r},setParams:function(t,e){return n(this.wmsParams,t),e||this.redraw(),this}});function jn(t,e){return new Nn(t,e)}zn.WMS=Nn,Rn.wms=jn;var Bn=Vi.extend({options:{padding:.1,tolerance:0},initialize:function(t){m(this,t),a(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),this._zoomAnimated&&ve(this._container,"leaflet-zoom-animated")),this.getPane().appendChild(this._container),this._update(),this.on("update",this._updatePaths,this)},onRemove:function(){this.off("update",this._updatePaths,this),this._destroyContainer()},getEvents:function(){var t={viewreset:this._reset,zoom:this._onZoom,moveend:this._update,zoomend:this._onZoomEnd};return this._zoomAnimated&&(t.zoomanim=this._onAnimZoom),t},_onAnimZoom:function(t){this._updateTransform(t.center,t.zoom)},_onZoom:function(){this._updateTransform(this._map.getCenter(),this._map.getZoom())},_updateTransform:function(t,e){var i=this._map.getZoomScale(e,this._zoom),n=Ee(this._container),o=this._map.getSize().multiplyBy(.5+this.options.padding),s=this._map.project(this._center,e),r=this._map.project(t,e).subtract(s),a=o.multiplyBy(-i).add(n).add(o).subtract(r);yt?Ce(this._container,a,i):Se(this._container,a)},_reset:function(){for(var t in this._update(),this._updateTransform(this._center,this._zoom),this._layers)this._layers[t]._reset()},_onZoomEnd:function(){for(var t in this._layers)this._layers[t]._project()},_updatePaths:function(){for(var t in this._layers)this._layers[t]._update()},_update:function(){var t=this.options.padding,e=this._map.getSize(),i=this._map.containerPointToLayerPoint(e.multiplyBy(-t)).round();this._bounds=new R(i,i.add(e.multiplyBy(1+2*t)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),Fn=Bn.extend({getEvents:function(){var t=Bn.prototype.getEvents.call(this);return t.viewprereset=this._onViewPreReset,t},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){Bn.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var t=this._container=document.createElement("canvas");Le(t,"mousemove",l(this._onMouseMove,32,this),this),Le(t,"click dblclick mousedown mouseup contextmenu",this._onClick,this),Le(t,"mouseout",this._handleMouseOut,this),this._ctx=t.getContext("2d")},_destroyContainer:function(){A(this._redrawRequest),delete this._ctx,ue(this._container),Re(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){for(var t in this._redrawBounds=null,this._layers)this._layers[t]._update();this._redraw()}},_update:function(){if(!this._map._animatingZoom||!this._bounds){Bn.prototype._update.call(this);var t=this._bounds,e=this._container,i=t.getSize(),n=At?2:1;Se(e,t.min),e.width=n*i.x,e.height=n*i.y,e.style.width=i.x+"px",e.style.height=i.y+"px",At&&this._ctx.scale(2,2),this._ctx.translate(-t.min.x,-t.min.y),this.fire("update")}},_reset:function(){Bn.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(t){this._updateDashArray(t),this._layers[a(t)]=t;var e=t._order={layer:t,prev:this._drawLast,next:null};this._drawLast&&(this._drawLast.next=e),this._drawLast=e,this._drawFirst=this._drawFirst||this._drawLast},_addPath:function(t){this._requestRedraw(t)},_removePath:function(t){var e=t._order,i=e.next,n=e.prev;i?i.prev=n:this._drawLast=n,n?n.next=i:this._drawFirst=i,delete t._order,delete this._layers[a(t)],this._requestRedraw(t)},_updatePath:function(t){this._extendRedrawBounds(t),t._project(),t._update(),this._requestRedraw(t)},_updateStyle:function(t){this._updateDashArray(t),this._requestRedraw(t)},_updateDashArray:function(t){if("string"==typeof t.options.dashArray){var e,i,n=t.options.dashArray.split(/[, ]+/),o=[];for(i=0;i<n.length;i++){if(e=Number(n[i]),isNaN(e))return;o.push(e)}t.options._dashArray=o}else t.options._dashArray=t.options.dashArray},_requestRedraw:function(t){this._map&&(this._extendRedrawBounds(t),this._redrawRequest=this._redrawRequest||E(this._redraw,this))},_extendRedrawBounds:function(t){if(t._pxBounds){var e=(t.options.weight||0)+1;this._redrawBounds=this._redrawBounds||new R,this._redrawBounds.extend(t._pxBounds.min.subtract([e,e])),this._redrawBounds.extend(t._pxBounds.max.add([e,e]))}},_redraw:function(){this._redrawRequest=null,this._redrawBounds&&(this._redrawBounds.min._floor(),this._redrawBounds.max._ceil()),this._clear(),this._draw(),this._redrawBounds=null},_clear:function(){var t=this._redrawBounds;if(t){var e=t.getSize();this._ctx.clearRect(t.min.x,t.min.y,e.x,e.y)}else this._ctx.clearRect(0,0,this._container.width,this._container.height)},_draw:function(){var t,e=this._redrawBounds;if(this._ctx.save(),e){var i=e.getSize();this._ctx.beginPath(),this._ctx.rect(e.min.x,e.min.y,i.x,i.y),this._ctx.clip()}this._drawing=!0;for(var n=this._drawFirst;n;n=n.next)t=n.layer,(!e||t._pxBounds&&t._pxBounds.intersects(e))&&t._updatePath();this._drawing=!1,this._ctx.restore()},_updatePoly:function(t,e){if(this._drawing){var i,n,o,s,r=t._parts,a=r.length,l=this._ctx;if(a){for(l.beginPath(),i=0;i<a;i++){for(n=0,o=r[i].length;n<o;n++)s=r[i][n],l[n?"lineTo":"moveTo"](s.x,s.y);e&&l.closePath()}this._fillStroke(l,t)}}},_updateCircle:function(t){if(this._drawing&&!t._empty()){var e=t._point,i=this._ctx,n=Math.max(Math.round(t._radius),1),o=(Math.max(Math.round(t._radiusY),1)||n)/n;1!==o&&(i.save(),i.scale(1,o)),i.beginPath(),i.arc(e.x,e.y/o,n,0,2*Math.PI,!1),1!==o&&i.restore(),this._fillStroke(i,t)}},_fillStroke:function(t,e){var i=e.options;i.fill&&(t.globalAlpha=i.fillOpacity,t.fillStyle=i.fillColor||i.color,t.fill(i.fillRule||"evenodd")),i.stroke&&0!==i.weight&&(t.setLineDash&&t.setLineDash(e.options&&e.options._dashArray||[]),t.globalAlpha=i.opacity,t.lineWidth=i.weight,t.strokeStyle=i.color,t.lineCap=i.lineCap,t.lineJoin=i.lineJoin,t.stroke())},_onClick:function(t){for(var e,i,n=this._map.mouseEventToLayerPoint(t),o=this._drawFirst;o;o=o.next)(e=o.layer).options.interactive&&e._containsPoint(n)&&!this._map._draggableMoved(e)&&(i=e);i&&(Xe(t),this._fireEvent([i],t))},_onMouseMove:function(t){if(this._map&&!this._map.dragging.moving()&&!this._map._animatingZoom){var e=this._map.mouseEventToLayerPoint(t);this._handleMouseHover(t,e)}},_handleMouseOut:function(t){var e=this._hoveredLayer;e&&(ye(this._container,"leaflet-interactive"),this._fireEvent([e],t,"mouseout"),this._hoveredLayer=null)},_handleMouseHover:function(t,e){for(var i,n,o=this._drawFirst;o;o=o.next)(i=o.layer).options.interactive&&i._containsPoint(e)&&(n=i);n!==this._hoveredLayer&&(this._handleMouseOut(t),n&&(ve(this._container,"leaflet-interactive"),this._fireEvent([n],t,"mouseover"),this._hoveredLayer=n)),this._hoveredLayer&&this._fireEvent([this._hoveredLayer],t)},_fireEvent:function(t,e,i){this._map._fireDOMEvent(e,i||e.type,t)},_bringToFront:function(t){var e=t._order;if(e){var i=e.next,n=e.prev;i&&(i.prev=n,n?n.next=i:i&&(this._drawFirst=i),e.prev=this._drawLast,this._drawLast.next=e,e.next=null,this._drawLast=e,this._requestRedraw(t))}},_bringToBack:function(t){var e=t._order;if(e){var i=e.next,n=e.prev;n&&(n.next=i,i?i.prev=n:n&&(this._drawLast=n),e.prev=null,e.next=this._drawFirst,this._drawFirst.prev=e,this._drawFirst=e,this._requestRedraw(t))}}});function qn(t){return Mt?new Fn(t):null}var Vn=function(){try{return document.namespaces.add("lvml","urn:schemas-microsoft-com:vml"),function(t){return document.createElement("<lvml:"+t+' class="lvml">')}}catch(t){return function(t){return document.createElement("<"+t+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}}(),Hn={_initContainer:function(){this._container=de("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(Bn.prototype._update.call(this),this.fire("update"))},_initPath:function(t){var e=t._container=Vn("shape");ve(e,"leaflet-vml-shape "+(this.options.className||"")),e.coordsize="1 1",t._path=Vn("path"),e.appendChild(t._path),this._updateStyle(t),this._layers[a(t)]=t},_addPath:function(t){var e=t._container;this._container.appendChild(e),t.options.interactive&&t.addInteractiveTarget(e)},_removePath:function(t){var e=t._container;ue(e),t.removeInteractiveTarget(e),delete this._layers[a(t)]},_updateStyle:function(t){var e=t._stroke,i=t._fill,n=t.options,o=t._container;o.stroked=!!n.stroke,o.filled=!!n.fill,n.stroke?(e||(e=t._stroke=Vn("stroke")),o.appendChild(e),e.weight=n.weight+"px",e.color=n.color,e.opacity=n.opacity,n.dashArray?e.dashStyle=y(n.dashArray)?n.dashArray.join(" "):n.dashArray.replace(/( *, *)/g," "):e.dashStyle="",e.endcap=n.lineCap.replace("butt","flat"),e.joinstyle=n.lineJoin):e&&(o.removeChild(e),t._stroke=null),n.fill?(i||(i=t._fill=Vn("fill")),o.appendChild(i),i.color=n.fillColor||n.color,i.opacity=n.fillOpacity):i&&(o.removeChild(i),t._fill=null)},_updateCircle:function(t){var e=t._point.round(),i=Math.round(t._radius),n=Math.round(t._radiusY||i);this._setPath(t,t._empty()?"M0 0":"AL "+e.x+","+e.y+" "+i+","+n+" 0,23592600")},_setPath:function(t,e){t._path.v=e},_bringToFront:function(t){me(t._container)},_bringToBack:function(t){ge(t._container)}},Un=Pt?Vn:K,Wn=Bn.extend({getEvents:function(){var t=Bn.prototype.getEvents.call(this);return t.zoomstart=this._onZoomStart,t},_initContainer:function(){this._container=Un("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=Un("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){ue(this._container),Re(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_onZoomStart:function(){this._update()},_update:function(){if(!this._map._animatingZoom||!this._bounds){Bn.prototype._update.call(this);var t=this._bounds,e=t.getSize(),i=this._container;this._svgSize&&this._svgSize.equals(e)||(this._svgSize=e,i.setAttribute("width",e.x),i.setAttribute("height",e.y)),Se(i,t.min),i.setAttribute("viewBox",[t.min.x,t.min.y,e.x,e.y].join(" ")),this.fire("update")}},_initPath:function(t){var e=t._path=Un("path");t.options.className&&ve(e,t.options.className),t.options.interactive&&ve(e,"leaflet-interactive"),this._updateStyle(t),this._layers[a(t)]=t},_addPath:function(t){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(t._path),t.addInteractiveTarget(t._path)},_removePath:function(t){ue(t._path),t.removeInteractiveTarget(t._path),delete this._layers[a(t)]},_updatePath:function(t){t._project(),t._update()},_updateStyle:function(t){var e=t._path,i=t.options;e&&(i.stroke?(e.setAttribute("stroke",i.color),e.setAttribute("stroke-opacity",i.opacity),e.setAttribute("stroke-width",i.weight),e.setAttribute("stroke-linecap",i.lineCap),e.setAttribute("stroke-linejoin",i.lineJoin),i.dashArray?e.setAttribute("stroke-dasharray",i.dashArray):e.removeAttribute("stroke-dasharray"),i.dashOffset?e.setAttribute("stroke-dashoffset",i.dashOffset):e.removeAttribute("stroke-dashoffset")):e.setAttribute("stroke","none"),i.fill?(e.setAttribute("fill",i.fillColor||i.color),e.setAttribute("fill-opacity",i.fillOpacity),e.setAttribute("fill-rule",i.fillRule||"evenodd")):e.setAttribute("fill","none"))},_updatePoly:function(t,e){this._setPath(t,Q(t._parts,e))},_updateCircle:function(t){var e=t._point,i=Math.max(Math.round(t._radius),1),n="a"+i+","+(Math.max(Math.round(t._radiusY),1)||i)+" 0 1,0 ",o=t._empty()?"M0 0":"M"+(e.x-i)+","+e.y+n+2*i+",0 "+n+2*-i+",0 ";this._setPath(t,o)},_setPath:function(t,e){t._path.setAttribute("d",e)},_bringToFront:function(t){me(t._path)},_bringToBack:function(t){ge(t._path)}});function Gn(t){return Tt||Pt?new Wn(t):null}Pt&&Wn.include(Hn),ii.include({getRenderer:function(t){var e=t.options.renderer||this._getPaneRenderer(t.options.pane)||this.options.renderer||this._renderer;return e||(e=this._renderer=this._createRenderer()),this.hasLayer(e)||this.addLayer(e),e},_getPaneRenderer:function(t){if("overlayPane"===t||void 0===t)return!1;var e=this._paneRenderers[t];return void 0===e&&(e=this._createRenderer({pane:t}),this._paneRenderers[t]=e),e},_createRenderer:function(t){return this.options.preferCanvas&&qn(t)||Gn(t)}});var Zn=ln.extend({initialize:function(t,e){ln.prototype.initialize.call(this,this._boundsToLatLngs(t),e)},setBounds:function(t){return this.setLatLngs(this._boundsToLatLngs(t))},_boundsToLatLngs:function(t){return[(t=B(t)).getSouthWest(),t.getNorthWest(),t.getNorthEast(),t.getSouthEast()]}});function Yn(t,e){return new Zn(t,e)}Wn.create=Un,Wn.pointsToPath=Q,hn.geometryToLayer=dn,hn.coordsToLatLng=un,hn.coordsToLatLngs=pn,hn.latLngToCoords=mn,hn.latLngsToCoords=gn,hn.getFeature=fn,hn.asFeature=vn,ii.mergeOptions({boxZoom:!0});var Xn=mi.extend({initialize:function(t){this._map=t,this._container=t._container,this._pane=t._panes.overlayPane,this._resetStateTimeout=0,t.on("unload",this._destroy,this)},addHooks:function(){Le(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){Re(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){ue(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){0!==this._resetStateTimeout&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(t){if(!t.shiftKey||1!==t.which&&1!==t.button)return!1;this._clearDeferredResetState(),this._resetState(),ee(),Me(),this._startPoint=this._map.mouseEventToContainerPoint(t),Le(document,{contextmenu:He,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(t){this._moved||(this._moved=!0,this._box=de("div","leaflet-zoom-box",this._container),ve(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(t);var e=new R(this._point,this._startPoint),i=e.getSize();Se(this._box,e.min),this._box.style.width=i.x+"px",this._box.style.height=i.y+"px"},_finish:function(){this._moved&&(ue(this._box),ye(this._container,"leaflet-crosshair")),ie(),Te(),Re(document,{contextmenu:He,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(t){if((1===t.which||1===t.button)&&(this._finish(),this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(s(this._resetState,this),0);var e=new j(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(e).fire("boxzoomend",{boxZoomBounds:e})}},_onKeyDown:function(t){27===t.keyCode&&this._finish()}});ii.addInitHook("addHandler","boxZoom",Xn),ii.mergeOptions({doubleClickZoom:!0});var Kn=mi.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(t){var e=this._map,i=e.getZoom(),n=e.options.zoomDelta,o=t.originalEvent.shiftKey?i-n:i+n;"center"===e.options.doubleClickZoom?e.setZoom(o):e.setZoomAround(t.containerPoint,o)}});ii.addInitHook("addHandler","doubleClickZoom",Kn),ii.mergeOptions({dragging:!0,inertia:!st,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var Qn=mi.extend({addHooks:function(){if(!this._draggable){var t=this._map;this._draggable=new xi(t._mapPane,t._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),t.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),t.on("zoomend",this._onZoomEnd,this),t.whenReady(this._onZoomEnd,this))}ve(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){ye(this._map._container,"leaflet-grab"),ye(this._map._container,"leaflet-touch-drag"),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var t=this._map;if(t._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var e=B(this._map.options.maxBounds);this._offsetLimit=N(this._map.latLngToContainerPoint(e.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(e.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))}else this._offsetLimit=null;t.fire("movestart").fire("dragstart"),t.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(t){if(this._map.options.inertia){var e=this._lastTime=+new Date,i=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(i),this._times.push(e),this._prunePositions(e)}this._map.fire("move",t).fire("drag",t)},_prunePositions:function(t){for(;this._positions.length>1&&t-this._times[0]>50;)this._positions.shift(),this._times.shift()},_onZoomEnd:function(){var t=this._map.getSize().divideBy(2),e=this._map.latLngToLayerPoint([0,0]);this._initialWorldOffset=e.subtract(t).x,this._worldWidth=this._map.getPixelWorldBounds().getSize().x},_viscousLimit:function(t,e){return t-(t-e)*this._viscosity},_onPreDragLimit:function(){if(this._viscosity&&this._offsetLimit){var t=this._draggable._newPos.subtract(this._draggable._startPos),e=this._offsetLimit;t.x<e.min.x&&(t.x=this._viscousLimit(t.x,e.min.x)),t.y<e.min.y&&(t.y=this._viscousLimit(t.y,e.min.y)),t.x>e.max.x&&(t.x=this._viscousLimit(t.x,e.max.x)),t.y>e.max.y&&(t.y=this._viscousLimit(t.y,e.max.y)),this._draggable._newPos=this._draggable._startPos.add(t)}},_onPreDragWrap:function(){var t=this._worldWidth,e=Math.round(t/2),i=this._initialWorldOffset,n=this._draggable._newPos.x,o=(n-e+i)%t+e-i,s=(n+e+i)%t-e-i,r=Math.abs(o+i)<Math.abs(s+i)?o:s;this._draggable._absPos=this._draggable._newPos.clone(),this._draggable._newPos.x=r},_onDragEnd:function(t){var e=this._map,i=e.options,n=!i.inertia||this._times.length<2;if(e.fire("dragend",t),n)e.fire("moveend");else{this._prunePositions(+new Date);var o=this._lastPos.subtract(this._positions[0]),s=(this._lastTime-this._times[0])/1e3,r=i.easeLinearity,a=o.multiplyBy(r/s),l=a.distanceTo([0,0]),c=Math.min(i.inertiaMaxSpeed,l),h=a.multiplyBy(c/l),d=c/(i.inertiaDeceleration*r),u=h.multiplyBy(-d/2).round();u.x||u.y?(u=e._limitOffset(u,e.options.maxBounds),E((function(){e.panBy(u,{duration:d,easeLinearity:r,noMoveStart:!0,animate:!0})}))):e.fire("moveend")}}});ii.addInitHook("addHandler","dragging",Qn),ii.mergeOptions({keyboard:!0,keyboardPanDelta:80});var Jn=mi.extend({keyCodes:{left:[37],right:[39],down:[40],up:[38],zoomIn:[187,107,61,171],zoomOut:[189,109,54,173]},initialize:function(t){this._map=t,this._setPanDelta(t.options.keyboardPanDelta),this._setZoomDelta(t.options.zoomDelta)},addHooks:function(){var t=this._map._container;t.tabIndex<=0&&(t.tabIndex="0"),Le(t,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.on({focus:this._addHooks,blur:this._removeHooks},this)},removeHooks:function(){this._removeHooks(),Re(this._map._container,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.off({focus:this._addHooks,blur:this._removeHooks},this)},_onMouseDown:function(){if(!this._focused){var t=document.body,e=document.documentElement,i=t.scrollTop||e.scrollTop,n=t.scrollLeft||e.scrollLeft;this._map._container.focus(),window.scrollTo(n,i)}},_onFocus:function(){this._focused=!0,this._map.fire("focus")},_onBlur:function(){this._focused=!1,this._map.fire("blur")},_setPanDelta:function(t){var e,i,n=this._panKeys={},o=this.keyCodes;for(e=0,i=o.left.length;e<i;e++)n[o.left[e]]=[-1*t,0];for(e=0,i=o.right.length;e<i;e++)n[o.right[e]]=[t,0];for(e=0,i=o.down.length;e<i;e++)n[o.down[e]]=[0,t];for(e=0,i=o.up.length;e<i;e++)n[o.up[e]]=[0,-1*t]},_setZoomDelta:function(t){var e,i,n=this._zoomKeys={},o=this.keyCodes;for(e=0,i=o.zoomIn.length;e<i;e++)n[o.zoomIn[e]]=t;for(e=0,i=o.zoomOut.length;e<i;e++)n[o.zoomOut[e]]=-t},_addHooks:function(){Le(document,"keydown",this._onKeyDown,this)},_removeHooks:function(){Re(document,"keydown",this._onKeyDown,this)},_onKeyDown:function(t){if(!(t.altKey||t.ctrlKey||t.metaKey)){var e,i=t.keyCode,n=this._map;if(i in this._panKeys)n._panAnim&&n._panAnim._inProgress||(e=this._panKeys[i],t.shiftKey&&(e=z(e).multiplyBy(3)),n.panBy(e),n.options.maxBounds&&n.panInsideBounds(n.options.maxBounds));else if(i in this._zoomKeys)n.setZoom(n.getZoom()+(t.shiftKey?3:1)*this._zoomKeys[i]);else{if(27!==i||!n._popup||!n._popup.options.closeOnEscapeKey)return;n.closePopup()}He(t)}}});ii.addInitHook("addHandler","keyboard",Jn),ii.mergeOptions({scrollWheelZoom:!0,wheelDebounceTime:40,wheelPxPerZoomLevel:60});var to=mi.extend({addHooks:function(){Le(this._map._container,"mousewheel",this._onWheelScroll,this),this._delta=0},removeHooks:function(){Re(this._map._container,"mousewheel",this._onWheelScroll,this)},_onWheelScroll:function(t){var e=Ge(t),i=this._map.options.wheelDebounceTime;this._delta+=e,this._lastMousePos=this._map.mouseEventToContainerPoint(t),this._startTime||(this._startTime=+new Date);var n=Math.max(i-(+new Date-this._startTime),0);clearTimeout(this._timer),this._timer=setTimeout(s(this._performZoom,this),n),He(t)},_performZoom:function(){var t=this._map,e=t.getZoom(),i=this._map.options.zoomSnap||0;t._stop();var n=this._delta/(4*this._map.options.wheelPxPerZoomLevel),o=4*Math.log(2/(1+Math.exp(-Math.abs(n))))/Math.LN2,s=i?Math.ceil(o/i)*i:o,r=t._limitZoom(e+(this._delta>0?s:-s))-e;this._delta=0,this._startTime=null,r&&("center"===t.options.scrollWheelZoom?t.setZoom(e+r):t.setZoomAround(this._lastMousePos,e+r))}});ii.addInitHook("addHandler","scrollWheelZoom",to),ii.mergeOptions({tap:!0,tapTolerance:15});var eo=mi.extend({addHooks:function(){Le(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){Re(this._map._container,"touchstart",this._onDown,this)},_onDown:function(t){if(t.touches){if(Ve(t),this._fireClick=!0,t.touches.length>1)return this._fireClick=!1,void clearTimeout(this._holdTimeout);var e=t.touches[0],i=e.target;this._startPos=this._newPos=new O(e.clientX,e.clientY),i.tagName&&"a"===i.tagName.toLowerCase()&&ve(i,"leaflet-active"),this._holdTimeout=setTimeout(s((function(){this._isTapValid()&&(this._fireClick=!1,this._onUp(),this._simulateEvent("contextmenu",e))}),this),1e3),this._simulateEvent("mousedown",e),Le(document,{touchmove:this._onMove,touchend:this._onUp},this)}},_onUp:function(t){if(clearTimeout(this._holdTimeout),Re(document,{touchmove:this._onMove,touchend:this._onUp},this),this._fireClick&&t&&t.changedTouches){var e=t.changedTouches[0],i=e.target;i&&i.tagName&&"a"===i.tagName.toLowerCase()&&ye(i,"leaflet-active"),this._simulateEvent("mouseup",e),this._isTapValid()&&this._simulateEvent("click",e)}},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_onMove:function(t){var e=t.touches[0];this._newPos=new O(e.clientX,e.clientY),this._simulateEvent("mousemove",e)},_simulateEvent:function(t,e){var i=document.createEvent("MouseEvents");i._simulated=!0,e.target._simulatedClick=!0,i.initMouseEvent(t,!0,!0,window,1,e.screenX,e.screenY,e.clientX,e.clientY,!1,!1,!1,!1,0,null),e.target.dispatchEvent(i)}});Ct&&!kt&&ii.addInitHook("addHandler","tap",eo),ii.mergeOptions({touchZoom:Ct&&!st,bounceAtZoomLimits:!0});var io=mi.extend({addHooks:function(){ve(this._map._container,"leaflet-touch-zoom"),Le(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){ye(this._map._container,"leaflet-touch-zoom"),Re(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(t){var e=this._map;if(t.touches&&2===t.touches.length&&!e._animatingZoom&&!this._zooming){var i=e.mouseEventToContainerPoint(t.touches[0]),n=e.mouseEventToContainerPoint(t.touches[1]);this._centerPoint=e.getSize()._divideBy(2),this._startLatLng=e.containerPointToLatLng(this._centerPoint),"center"!==e.options.touchZoom&&(this._pinchStartLatLng=e.containerPointToLatLng(i.add(n)._divideBy(2))),this._startDist=i.distanceTo(n),this._startZoom=e.getZoom(),this._moved=!1,this._zooming=!0,e._stop(),Le(document,"touchmove",this._onTouchMove,this),Le(document,"touchend",this._onTouchEnd,this),Ve(t)}},_onTouchMove:function(t){if(t.touches&&2===t.touches.length&&this._zooming){var e=this._map,i=e.mouseEventToContainerPoint(t.touches[0]),n=e.mouseEventToContainerPoint(t.touches[1]),o=i.distanceTo(n)/this._startDist;if(this._zoom=e.getScaleZoom(o,this._startZoom),!e.options.bounceAtZoomLimits&&(this._zoom<e.getMinZoom()&&o<1||this._zoom>e.getMaxZoom()&&o>1)&&(this._zoom=e._limitZoom(this._zoom)),"center"===e.options.touchZoom){if(this._center=this._startLatLng,1===o)return}else{var r=i._add(n)._divideBy(2)._subtract(this._centerPoint);if(1===o&&0===r.x&&0===r.y)return;this._center=e.unproject(e.project(this._pinchStartLatLng,this._zoom).subtract(r),this._zoom)}this._moved||(e._moveStart(!0,!1),this._moved=!0),A(this._animRequest);var a=s(e._move,e,this._center,this._zoom,{pinch:!0,round:!1});this._animRequest=E(a,this,!0),Ve(t)}},_onTouchEnd:function(){this._moved&&this._zooming?(this._zooming=!1,A(this._animRequest),Re(document,"touchmove",this._onTouchMove),Re(document,"touchend",this._onTouchEnd),this._map.options.zoomAnimation?this._map._animateZoom(this._center,this._map._limitZoom(this._zoom),!0,this._map.options.zoomSnap):this._map._resetView(this._center,this._map._limitZoom(this._zoom))):this._zooming=!1}});ii.addInitHook("addHandler","touchZoom",io),ii.BoxZoom=Xn,ii.DoubleClickZoom=Kn,ii.Drag=Qn,ii.Keyboard=Jn,ii.ScrollWheelZoom=to,ii.Tap=eo,ii.TouchZoom=io,Object.freeze=i,t.version=e,t.Control=oi,t.control=si,t.Browser=It,t.Evented=I,t.Mixin=fi,t.Util=M,t.Class=T,t.Handler=mi,t.extend=n,t.bind=s,t.stamp=a,t.setOptions=m,t.DomEvent=ti,t.DomUtil=$e,t.PosAnimation=ei,t.Draggable=xi,t.LineUtil=$i,t.PolyUtil=zi,t.Point=O,t.point=z,t.Bounds=R,t.bounds=N,t.Transformation=G,t.transformation=Z,t.Projection=ji,t.LatLng=F,t.latLng=q,t.LatLngBounds=j,t.latLngBounds=B,t.CRS=V,t.GeoJSON=hn,t.geoJSON=bn,t.geoJson=xn,t.Layer=Vi,t.LayerGroup=Hi,t.layerGroup=Ui,t.FeatureGroup=Wi,t.featureGroup=Gi,t.ImageOverlay=_n,t.imageOverlay=wn,t.VideoOverlay=kn,t.videoOverlay=Cn,t.SVGOverlay=Sn,t.svgOverlay=En,t.DivOverlay=An,t.Popup=Mn,t.popup=Tn,t.Tooltip=Pn,t.tooltip=Dn,t.Icon=Zi,t.icon=Yi,t.DivIcon=In,t.divIcon=On,t.Marker=Qi,t.marker=Ji,t.TileLayer=zn,t.tileLayer=Rn,t.GridLayer=$n,t.gridLayer=Ln,t.SVG=Wn,t.svg=Gn,t.Renderer=Bn,t.Canvas=Fn,t.canvas=qn,t.Path=tn,t.CircleMarker=en,t.circleMarker=nn,t.Circle=on,t.circle=sn,t.Polyline=rn,t.polyline=an,t.Polygon=ln,t.polygon=cn,t.Rectangle=Zn,t.rectangle=Yn,t.Map=ii,t.map=ni;var no=window.L;t.noConflict=function(){return window.L=no,this},window.L=t})(JM.exports);var tT=JM.exports;const eT={weight:1,opacity:1,color:"white",fillOpacity:.7,fillColor:"#2387ca"},iT={weight:3,color:"white",fillOpacity:1,fillColor:"#2387ca"},nT=()=>eT;class oT extends ct{static get styles(){return a`
|
|
10927
10918
|
:host {
|
|
10928
10919
|
display: block;
|
|
10929
10920
|
padding: 0px;
|
|
@@ -10958,11 +10949,11 @@ var JA=function(){if("undefined"!=typeof window){if(window.devicePixelRatio)retu
|
|
|
10958
10949
|
color: var(--color-link-primary);
|
|
10959
10950
|
cursor: pointer;
|
|
10960
10951
|
}
|
|
10961
|
-
`}constructor(){super(),this.osmId="",this.endpoint="",this.hovered=null,this.path=[],this.renderedMap=null,this.states=null,this.paths={},this.lastHovered=null}getRenderRoot(){return this.renderRoot}getEndpoint(){return this.endpoint+(this.endpoint.endsWith("/")?"":"/")}refreshMap(){const t=(t,e)=>{this.paths[t.properties.osm_id]=e,e.on({click:t=>{const e=t.target.feature.properties;if(e.osm_id!==this.path[this.path.length-1].osm_id){const i=t.originalEvent;i.stopPropagation(),i.preventDefault(),this.onFeatureClicked&&this.onFeatureClicked(e),this.hovered=null,this.path.push(e),this.osmId=e.osm_id,this.refreshMap()}},mouseover:t=>{const e=t.target.feature.properties;e.osm_id!==this.path[this.path.length-1].osm_id&&(t.target.setStyle(
|
|
10952
|
+
`}constructor(){super(),this.osmId="",this.endpoint="",this.hovered=null,this.path=[],this.renderedMap=null,this.states=null,this.paths={},this.lastHovered=null}getRenderRoot(){return this.renderRoot}getEndpoint(){return this.endpoint+(this.endpoint.endsWith("/")?"":"/")}refreshMap(){const t=(t,e)=>{this.paths[t.properties.osm_id]=e,e.on({click:t=>{const e=t.target.feature.properties;if(e.osm_id!==this.path[this.path.length-1].osm_id){const i=t.originalEvent;i.stopPropagation(),i.preventDefault(),this.onFeatureClicked&&this.onFeatureClicked(e),this.hovered=null,this.path.push(e),this.osmId=e.osm_id,this.refreshMap()}},mouseover:t=>{const e=t.target.feature.properties;e.osm_id!==this.path[this.path.length-1].osm_id&&(t.target.setStyle(iT),this.hovered=e)},mouseout:t=>{t.target.setStyle(eT),this.hovered=null}})};ee(this.getEndpoint()+"geometry/"+this.osmId+"/").then((e=>{this.states&&this.renderedMap.removeLayer(this.states);const i=e.json;0===this.path.length&&(this.path=[{name:i.name,osm_id:this.osmId,level:0}]),this.states=tT.geoJSON(i.geometry,{style:nT,onEachFeature:t}),this.renderedMap.fitBounds(this.states.getBounds(),{}),this.states.addTo(this.renderedMap)}))}updated(t){if(t.has("hovered")&&(this.lastHovered&&this.lastHovered.setStyle(eT),this.hovered)){const t=this.paths[this.hovered.osm_id];this.lastHovered=t,t&&t.setStyle(iT)}if(t.has("feature")&&this.feature&&(this.hovered=null,0!==this.path.length&&this.path[this.path.length-1].osm_id===this.feature.osm_id||this.path.push(this.feature)),t.has("osmId")){const t=[];for(const e of this.path)if(t.push(e),e.osm_id===this.osmId){this.onFeatureClicked&&this.onFeatureClicked(e);break}this.path=t,this.refreshMap()}}firstUpdated(t){const e=this.getRenderRoot().getElementById("alias-map");this.renderedMap=tT.map(e,{attributionControl:!1,scrollWheelZoom:!1,zoomControl:!1}).setView([0,1],4),this.renderedMap.dragging.disable(),this.renderedMap.doubleClickZoom.disable(),this.refreshMap(),super.firstUpdated(t)}handleClickedBreadcrumb(t){this.osmId=t.currentTarget.getAttribute("data-osmid");const e=[];for(const t of this.path)if(e.push(t),t.osm_id===this.osmId){this.onFeatureClicked&&this.onFeatureClicked(t);break}this.path=e,this.refreshMap()}render(){return this.osmId?U`
|
|
10962
10953
|
<link
|
|
10963
10954
|
rel="stylesheet"
|
|
10964
10955
|
href="https://unpkg.com/leaflet@1.5.1/dist/leaflet.css"
|
|
10965
10956
|
/>
|
|
10966
10957
|
<div id="alias-map"></div>
|
|
10967
|
-
`:U`<div>No osm map id</div>`}}t([mt()],
|
|
10958
|
+
`:U`<div>No osm map id</div>`}}t([mt()],oT.prototype,"feature",void 0),t([mt()],oT.prototype,"osmId",void 0),t([mt()],oT.prototype,"endpoint",void 0),t([mt()],oT.prototype,"onFeatureClicked",void 0),t([mt()],oT.prototype,"hovered",void 0),t([mt()],oT.prototype,"path",void 0),KM("leaflet-map",oT),KM("alias-editor",QM)}();
|
|
10968
10959
|
//# sourceMappingURL=temba-components.js.map
|