From a2c7921c1fec286f6687230e40db8ee3f045c5e3 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Fri, 20 Nov 2020 23:42:14 +0100 Subject: [PATCH] admin: migrate login stats chart to web component --- .../templates/administration/overview.html | 59 +-- .../admin/templates/administration/shell.html | 1 - passbook/core/templates/base/skeleton.html | 2 +- passbook/static/static/package-lock.json | 8 + passbook/static/static/package.json | 1 + passbook/static/static/passbook/main.js | 352 +++++++++--------- passbook/static/static/passbook/main.js.map | 2 +- passbook/static/static/rollup.config.js | 3 +- .../static/static/src/AdminLoginsChart.ts | 101 +++++ passbook/static/static/src/main.ts | 1 + 10 files changed, 296 insertions(+), 234 deletions(-) create mode 100644 passbook/static/static/src/AdminLoginsChart.ts diff --git a/passbook/admin/templates/administration/overview.html b/passbook/admin/templates/administration/overview.html index 47d607ae1..95d97c031 100644 --- a/passbook/admin/templates/administration/overview.html +++ b/passbook/admin/templates/administration/overview.html @@ -17,8 +17,8 @@ {% trans 'Logins over the last 24 hours' %} -
- +
+
- - {% endblock %} diff --git a/passbook/admin/templates/administration/shell.html b/passbook/admin/templates/administration/shell.html index 9972d215e..8c656948d 100644 --- a/passbook/admin/templates/administration/shell.html +++ b/passbook/admin/templates/administration/shell.html @@ -15,7 +15,6 @@ - {% endblock %} {% block page_content %} diff --git a/passbook/core/templates/base/skeleton.html b/passbook/core/templates/base/skeleton.html index a0e21e352..3db493985 100644 --- a/passbook/core/templates/base/skeleton.html +++ b/passbook/core/templates/base/skeleton.html @@ -17,7 +17,7 @@ - + {% block head %} {% endblock %} diff --git a/passbook/static/static/package-lock.json b/passbook/static/static/package-lock.json index e633745ee..f282deb1a 100644 --- a/passbook/static/static/package-lock.json +++ b/passbook/static/static/package-lock.json @@ -73,6 +73,14 @@ } } }, + "@types/chart.js": { + "version": "2.9.28", + "resolved": "https://registry.npmjs.org/@types/chart.js/-/chart.js-2.9.28.tgz", + "integrity": "sha512-9YYhsxRngRJb0dkuaU5BezkF+zvvVHnwdRw+rtlahtFb4zqNf9YSgWsOq+dLYeh0fqsWmHUYLR64eNigh02F+w==", + "requires": { + "moment": "^2.10.2" + } + }, "@types/clean-css": { "version": "4.2.2", "resolved": "https://registry.npmjs.org/@types/clean-css/-/clean-css-4.2.2.tgz", diff --git a/passbook/static/static/package.json b/passbook/static/static/package.json index 9a47b5686..b9cfd9d2b 100644 --- a/passbook/static/static/package.json +++ b/passbook/static/static/package.json @@ -7,6 +7,7 @@ "dependencies": { "@fortawesome/fontawesome-free": "^5.15.1", "@patternfly/patternfly": "^4.59.1", + "@types/chart.js": "^2.9.28", "chart.js": "^2.9.4", "codemirror": "^5.58.2", "lit-element": "^2.4.0", diff --git a/passbook/static/static/passbook/main.js b/passbook/static/static/passbook/main.js index e076a10f4..d2d65f9b6 100644 --- a/passbook/static/static/passbook/main.js +++ b/passbook/static/static/passbook/main.js @@ -1,189 +1,197 @@ -!function(){"use strict";document.querySelectorAll("input[type=search]").forEach((e=>{e.addEventListener("search",(t=>{""===e.value&&e.parentElement.submit()}))})),document.querySelectorAll("[data-pb-fetch-fill]").forEach((e=>{const t=e.dataset.pbFetchFill,s=e.dataset.pbFetchKey;fetch(t).then((e=>e.json())).then((t=>{e.textContent=t[s],e.value=t[s]}))})),document.querySelectorAll("[data-target='modal']").forEach((e=>{e.addEventListener("click",(e=>{const t=e.target.closest('[data-target="modal"]').attributes["data-modal"].value;document.querySelector("#"+t).removeAttribute("hidden")}))})),document.querySelectorAll(".pf-c-modal-box [data-modal-close]").forEach((e=>{e.addEventListener("click",(e=>{e.target.closest(".pf-c-backdrop").setAttribute("hidden",!0)}))})),document.querySelectorAll(".pf-c-check__label").forEach((e=>{e.addEventListener("click",(e=>{const t=e.target.parentElement.querySelector("input[type=checkbox]");t.checked=!t.checked}))})),document.querySelectorAll(".codemirror").forEach((e=>{let t="xml";"data-cm-mode"in e.attributes&&(t=e.attributes["data-cm-mode"].value),e.removeAttribute("required"),CodeMirror.fromTextArea(e,{mode:t,theme:"monokai",lineNumbers:!1,readOnly:e.readOnly,autoRefresh:!0})})); +document.querySelectorAll("input[type=search]").forEach((t=>{t.addEventListener("search",(e=>{""===t.value&&t.parentElement.submit()}))})),document.querySelectorAll("[data-pb-fetch-fill]").forEach((t=>{const e=t.dataset.pbFetchFill,n=t.dataset.pbFetchKey;fetch(e).then((t=>t.json())).then((e=>{t.textContent=e[n],t.value=e[n]}))})),document.querySelectorAll("[data-target='modal']").forEach((t=>{t.addEventListener("click",(t=>{const e=t.target.closest('[data-target="modal"]').attributes["data-modal"].value;document.querySelector("#"+e).removeAttribute("hidden")}))})),document.querySelectorAll(".pf-c-modal-box [data-modal-close]").forEach((t=>{t.addEventListener("click",(t=>{t.target.closest(".pf-c-backdrop").setAttribute("hidden",!0)}))})),document.querySelectorAll(".pf-c-check__label").forEach((t=>{t.addEventListener("click",(t=>{const e=t.target.parentElement.querySelector("input[type=checkbox]");e.checked=!e.checked}))})),document.querySelectorAll(".codemirror").forEach((t=>{let e="xml";"data-cm-mode"in t.attributes&&(e=t.attributes["data-cm-mode"].value),t.removeAttribute("required"),CodeMirror.fromTextArea(t,{mode:e,theme:"monokai",lineNumbers:!1,readOnly:t.readOnly,autoRefresh:!0})})); /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. +Copyright (c) Microsoft Corporation. - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted. +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. - ***************************************************************************** */ -function e(e,t,s,n){var r,i=arguments.length,o=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,s):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,s,n);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(i<3?r(o):i>3?r(t,s,o):r(t,s))||o);return i>3&&o&&Object.defineProperty(t,s,o),o}document.querySelectorAll("input[name=name]").forEach((e=>{e.addEventListener("input",(e=>{const t=e.target.closest("form");if(null===t)return;t.querySelector("input[name=slug]").value=e.target.value.toLowerCase().replace(/ /g,"-").replace(/[^\w-]+/g,"")}))})),document.querySelectorAll(".pf-c-page__header-brand-toggle>button").forEach((e=>{e.addEventListener("click",(e=>{const t=document.querySelector(".pf-c-page__sidebar");t.classList.contains("pf-m-expanded")?(t.classList.remove("pf-m-expanded"),t.style.zIndex=0):(t.classList.add("pf-m-expanded"),t.style.zIndex=200)}))})),document.querySelectorAll(".pf-m-expandable>.pf-c-nav__link").forEach((e=>{e.addEventListener("click",(t=>{t.preventDefault(),e.parentElement.classList.toggle("pf-m-expanded")}))})); +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ +function t(t,e,n,i){var r,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(o=(a<3?r(o):a>3?r(e,n,o):r(e,n))||o);return a>3&&o&&Object.defineProperty(e,n,o),o /** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -const t="undefined"!=typeof window&&null!=window.customElements&&void 0!==window.customElements.polyfillWrapFlushCallback,s=(e,t,s=null)=>{for(;t!==s;){const s=t.nextSibling;e.removeChild(t),t=s}},n=`{{lit-${String(Math.random()).slice(2)}}}`,r=`\x3c!--${n}--\x3e`,i=new RegExp(`${n}|${r}`),o="$lit$";class a{constructor(e,t){this.parts=[],this.element=t;const s=[],r=[],a=document.createTreeWalker(t.content,133,null,!1);let c=0,p=-1,u=0;const{strings:f,values:{length:m}}=e;for(;u0;){const t=f[u],s=h.exec(t)[2],n=s.toLowerCase()+o,r=e.getAttribute(n);e.removeAttribute(n);const a=r.split(i);this.parts.push({type:"attribute",index:p,name:s,strings:a}),u+=a.length-1}}"TEMPLATE"===e.tagName&&(r.push(e),a.currentNode=e.content)}else if(3===e.nodeType){const t=e.data;if(t.indexOf(n)>=0){const n=e.parentNode,r=t.split(i),a=r.length-1;for(let t=0;t{const s=e.length-t.length;return s>=0&&e.slice(s)===t},c=e=>-1!==e.index,d=()=>document.createComment(""),h=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;function p(e,t){const{element:{content:s},parts:n}=e,r=document.createTreeWalker(s,133,null,!1);let i=f(n),o=n[i],a=-1,l=0;const c=[];let d=null;for(;r.nextNode();){a++;const e=r.currentNode;for(e.previousSibling===d&&(d=null),t.has(e)&&(c.push(e),null===d&&(d=e)),null!==d&&l++;void 0!==o&&o.index===a;)o.index=null!==d?-1:o.index-l,i=f(n,i),o=n[i]}c.forEach((e=>e.parentNode.removeChild(e)))}const u=e=>{let t=11===e.nodeType?0:1;const s=document.createTreeWalker(e,133,null,!1);for(;s.nextNode();)t++;return t},f=(e,t=-1)=>{for(let s=t+1;s{t.addEventListener("input",(t=>{const e=t.target.closest("form");if(null===e)return;e.querySelector("input[name=slug]").value=t.target.value.toLowerCase().replace(/ /g,"-").replace(/[^\w-]+/g,"")}))})),document.querySelectorAll(".pf-c-page__header-brand-toggle>button").forEach((t=>{t.addEventListener("click",(t=>{const e=document.querySelector(".pf-c-page__sidebar");e.classList.contains("pf-m-expanded")?(e.classList.remove("pf-m-expanded"),e.style.zIndex=0):(e.classList.add("pf-m-expanded"),e.style.zIndex=200)}))})),document.querySelectorAll(".pf-m-expandable>.pf-c-nav__link").forEach((t=>{t.addEventListener("click",(e=>{e.preventDefault(),t.parentElement.classList.toggle("pf-m-expanded")}))}));const e="undefined"!=typeof window&&null!=window.customElements&&void 0!==window.customElements.polyfillWrapFlushCallback,n=(t,e,n=null)=>{for(;e!==n;){const n=e.nextSibling;t.removeChild(e),e=n}},i=`{{lit-${String(Math.random()).slice(2)}}}`,r=`\x3c!--${i}--\x3e`,a=new RegExp(`${i}|${r}`);class o{constructor(t,e){this.parts=[],this.element=e;const n=[],r=[],o=document.createTreeWalker(e.content,133,null,!1);let l=0,c=-1,h=0;const{strings:f,values:{length:p}}=t;for(;h0;){const e=f[h],n=d.exec(e)[2],i=n.toLowerCase()+"$lit$",r=t.getAttribute(i);t.removeAttribute(i);const o=r.split(a);this.parts.push({type:"attribute",index:c,name:n,strings:o}),h+=o.length-1}}"TEMPLATE"===t.tagName&&(r.push(t),o.currentNode=t.content)}else if(3===t.nodeType){const e=t.data;if(e.indexOf(i)>=0){const i=t.parentNode,r=e.split(a),o=r.length-1;for(let e=0;e{const n=t.length-e.length;return n>=0&&t.slice(n)===e},l=t=>-1!==t.index,u=()=>document.createComment(""),d=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;function c(t,e){const{element:{content:n},parts:i}=t,r=document.createTreeWalker(n,133,null,!1);let a=f(i),o=i[a],s=-1,l=0;const u=[];let d=null;for(;r.nextNode();){s++;const t=r.currentNode;for(t.previousSibling===d&&(d=null),e.has(t)&&(u.push(t),null===d&&(d=t)),null!==d&&l++;void 0!==o&&o.index===s;)o.index=null!==d?-1:o.index-l,a=f(i,a),o=i[a]}u.forEach((t=>t.parentNode.removeChild(t)))}const h=t=>{let e=11===t.nodeType?0:1;const n=document.createTreeWalker(t,133,null,!1);for(;n.nextNode();)e++;return e},f=(t,e=-1)=>{for(let n=e+1;n"function"==typeof e&&m.has(e),g={},_={}; + * @license + * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at + * http://polymer.github.io/LICENSE.txt + * The complete set of authors may be found at + * http://polymer.github.io/AUTHORS.txt + * The complete set of contributors may be found at + * http://polymer.github.io/CONTRIBUTORS.txt + * Code distributed by Google as part of the polymer project is also + * subject to an additional IP rights grant found at + * http://polymer.github.io/PATENTS.txt + */ +const p=new WeakMap,g=t=>"function"==typeof t&&p.has(t),m={},v={}; /** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -class v{constructor(e,t,s){this.__parts=[],this.template=e,this.processor=t,this.options=s}update(e){let t=0;for(const s of this.__parts)void 0!==s&&s.setValue(e[t]),t++;for(const e of this.__parts)void 0!==e&&e.commit()}_clone(){const e=t?this.template.element.content.cloneNode(!0):document.importNode(this.template.element.content,!0),s=[],n=this.template.parts,r=document.createTreeWalker(e,133,null,!1);let i,o=0,a=0,l=r.nextNode();for(;oe}),S=` ${n} `;class w{constructor(e,t,s,n){this.strings=e,this.values=t,this.type=s,this.processor=n}getHTML(){const e=this.strings.length-1;let t="",s=!1;for(let i=0;i-1||s)&&-1===e.indexOf("--\x3e",a+1);const l=h.exec(e);t+=null===l?e+(s?S:r):e.substr(0,l.index)+l[1]+l[2]+o+l[3]+n}return t+=this.strings[e],t}getTemplateElement(){const e=document.createElement("template");let t=this.getHTML();return void 0!==b&&(t=b.createHTML(t)),e.innerHTML=t,e}} + * @license + * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at + * http://polymer.github.io/LICENSE.txt + * The complete set of authors may be found at + * http://polymer.github.io/AUTHORS.txt + * The complete set of contributors may be found at + * http://polymer.github.io/CONTRIBUTORS.txt + * Code distributed by Google as part of the polymer project is also + * subject to an additional IP rights grant found at + * http://polymer.github.io/PATENTS.txt + */const b=window.trustedTypes&&trustedTypes.createPolicy("lit-html",{createHTML:t=>t}),_=` ${i} `;class x{constructor(t,e,n,i){this.strings=t,this.values=e,this.type=n,this.processor=i}getHTML(){const t=this.strings.length-1;let e="",n=!1;for(let a=0;a-1||n)&&-1===t.indexOf("--\x3e",o+1);const s=d.exec(t);e+=null===s?t+(n?_:r):t.substr(0,s.index)+s[1]+s[2]+"$lit$"+s[3]+i}return e+=this.strings[t],e}getTemplateElement(){const t=document.createElement("template");let e=this.getHTML();return void 0!==b&&(e=b.createHTML(e)),t.innerHTML=e,t}} /** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */const x=e=>null===e||!("object"==typeof e||"function"==typeof e),P=e=>Array.isArray(e)||!(!e||!e[Symbol.iterator]);class A{constructor(e,t,s){this.dirty=!0,this.element=e,this.name=t,this.strings=s,this.parts=[];for(let e=0;e{try{const e={get capture(){return q=!0,!1}};window.addEventListener("test",e,e),window.removeEventListener("test",e,e)}catch(e){}})();class U{constructor(e,t,s){this.value=void 0,this.__pendingValue=void 0,this.element=e,this.eventName=t,this.eventContext=s,this.__boundHandleEvent=e=>this.handleEvent(e)}setValue(e){this.__pendingValue=e}commit(){for(;y(this.__pendingValue);){const e=this.__pendingValue;this.__pendingValue=g,e(this)}if(this.__pendingValue===g)return;const e=this.__pendingValue,t=this.value,s=null==e||null!=t&&(e.capture!==t.capture||e.once!==t.once||e.passive!==t.passive),n=null!=e&&(null==t||s);s&&this.element.removeEventListener(this.eventName,this.__boundHandleEvent,this.__options),n&&(this.__options=R(e),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=e,this.__pendingValue=g}handleEvent(e){"function"==typeof this.value?this.value.call(this.eventContext||this.element,e):this.value.handleEvent(e)}}const R=e=>e&&(q?{capture:e.capture,passive:e.passive,once:e.once}:e.capture) + * @license + * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at + * http://polymer.github.io/LICENSE.txt + * The complete set of authors may be found at + * http://polymer.github.io/AUTHORS.txt + * The complete set of contributors may be found at + * http://polymer.github.io/CONTRIBUTORS.txt + * Code distributed by Google as part of the polymer project is also + * subject to an additional IP rights grant found at + * http://polymer.github.io/PATENTS.txt + */const w=t=>null===t||!("object"==typeof t||"function"==typeof t),k=t=>Array.isArray(t)||!(!t||!t[Symbol.iterator]);class S{constructor(t,e,n){this.dirty=!0,this.element=t,this.name=e,this.strings=n,this.parts=[];for(let t=0;t{try{const t={get capture(){return A=!0,!1}};window.addEventListener("test",t,t),window.removeEventListener("test",t,t)}catch(t){}})();class O{constructor(t,e,n){this.value=void 0,this.__pendingValue=void 0,this.element=t,this.eventName=e,this.eventContext=n,this.__boundHandleEvent=t=>this.handleEvent(t)}setValue(t){this.__pendingValue=t}commit(){for(;g(this.__pendingValue);){const t=this.__pendingValue;this.__pendingValue=m,t(this)}if(this.__pendingValue===m)return;const t=this.__pendingValue,e=this.value,n=null==t||null!=e&&(t.capture!==e.capture||t.once!==e.once||t.passive!==e.passive),i=null!=t&&(null==e||n);n&&this.element.removeEventListener(this.eventName,this.__boundHandleEvent,this.__options),i&&(this.__options=N(t),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=t,this.__pendingValue=m}handleEvent(t){"function"==typeof this.value?this.value.call(this.eventContext||this.element,t):this.value.handleEvent(t)}}const N=t=>t&&(A?{capture:t.capture,passive:t.passive,once:t.once}:t.capture) /** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */;function L(e){let t=V.get(e.type);void 0===t&&(t={stringsArray:new WeakMap,keyString:new Map},V.set(e.type,t));let s=t.stringsArray.get(e.strings);if(void 0!==s)return s;const r=e.strings.join(n);return s=t.keyString.get(r),void 0===s&&(s=new a(e,e.getTemplateElement()),t.keyString.set(r,s)),t.stringsArray.set(e.strings,s),s}const V=new Map,M=new WeakMap; + * @license + * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at + * http://polymer.github.io/LICENSE.txt + * The complete set of authors may be found at + * http://polymer.github.io/AUTHORS.txt + * The complete set of contributors may be found at + * http://polymer.github.io/CONTRIBUTORS.txt + * Code distributed by Google as part of the polymer project is also + * subject to an additional IP rights grant found at + * http://polymer.github.io/PATENTS.txt + */;function F(t){let e=I.get(t.type);void 0===e&&(e={stringsArray:new WeakMap,keyString:new Map},I.set(t.type,e));let n=e.stringsArray.get(t.strings);if(void 0!==n)return n;const r=t.strings.join(i);return n=e.keyString.get(r),void 0===n&&(n=new o(t,t.getTemplateElement()),e.keyString.set(r,n)),e.stringsArray.set(t.strings,n),n}const I=new Map,R=new WeakMap; /** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */const O=new + * @license + * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at + * http://polymer.github.io/LICENSE.txt + * The complete set of authors may be found at + * http://polymer.github.io/AUTHORS.txt + * The complete set of contributors may be found at + * http://polymer.github.io/CONTRIBUTORS.txt + * Code distributed by Google as part of the polymer project is also + * subject to an additional IP rights grant found at + * http://polymer.github.io/PATENTS.txt + */const L=new /** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -class{handleAttributeExpressions(e,t,s,n){const r=t[0];if("."===r){return new k(e,t.slice(1),s).parts}if("@"===r)return[new U(e,t.slice(1),n.eventContext)];if("?"===r)return[new N(e,t.slice(1),s)];return new A(e,t,s).parts}handleTextExpression(e){return new C(e)}}; + * @license + * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at + * http://polymer.github.io/LICENSE.txt + * The complete set of authors may be found at + * http://polymer.github.io/AUTHORS.txt + * The complete set of contributors may be found at + * http://polymer.github.io/CONTRIBUTORS.txt + * Code distributed by Google as part of the polymer project is also + * subject to an additional IP rights grant found at + * http://polymer.github.io/PATENTS.txt + */ +class{handleAttributeExpressions(t,e,n,i){const r=e[0];if("."===r){return new P(t,e.slice(1),n).parts}if("@"===r)return[new O(t,e.slice(1),i.eventContext)];if("?"===r)return[new C(t,e.slice(1),n)];return new S(t,e,n).parts}handleTextExpression(t){return new D(t)}}; /** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */"undefined"!=typeof window&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.3.0");const F=(e,...t)=>new w(e,t,"html",O) + * @license + * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at + * http://polymer.github.io/LICENSE.txt + * The complete set of authors may be found at + * http://polymer.github.io/AUTHORS.txt + * The complete set of contributors may be found at + * http://polymer.github.io/CONTRIBUTORS.txt + * Code distributed by Google as part of the polymer project is also + * subject to an additional IP rights grant found at + * http://polymer.github.io/PATENTS.txt + */"undefined"!=typeof window&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.3.0");const E=(t,...e)=>new x(t,e,"html",L) /** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */,j=(e,t)=>`${e}--${t}`;let $=!0;void 0===window.ShadyCSS?$=!1:void 0===window.ShadyCSS.prepareTemplateDom&&(console.warn("Incompatible ShadyCSS version detected. Please update to at least @webcomponents/webcomponentsjs@2.0.2 and @webcomponents/shadycss@1.3.1."),$=!1);const B=e=>t=>{const s=j(t.type,e);let r=V.get(s);void 0===r&&(r={stringsArray:new WeakMap,keyString:new Map},V.set(s,r));let i=r.stringsArray.get(t.strings);if(void 0!==i)return i;const o=t.strings.join(n);if(i=r.keyString.get(o),void 0===i){const s=t.getTemplateElement();$&&window.ShadyCSS.prepareTemplateDom(s,e),i=new a(t,s),r.keyString.set(o,i)}return r.stringsArray.set(t.strings,i),i},I=["html","svg"],H=new Set,z=(e,t,s)=>{H.add(e);const n=s?s.element:document.createElement("template"),r=t.querySelectorAll("style"),{length:i}=r;if(0===i)return void window.ShadyCSS.prepareTemplateStyles(n,e);const o=document.createElement("style");for(let e=0;e{I.forEach((t=>{const s=V.get(j(t,e));void 0!==s&&s.keyString.forEach((e=>{const{element:{content:t}}=e,s=new Set;Array.from(t.querySelectorAll("style")).forEach((e=>{s.add(e)})),p(e,s)}))}))})(e);const a=n.content;s?function(e,t,s=null){const{element:{content:n},parts:r}=e;if(null==s)return void n.appendChild(t);const i=document.createTreeWalker(n,133,null,!1);let o=f(r),a=0,l=-1;for(;i.nextNode();)for(l++,i.currentNode===s&&(a=u(t),s.parentNode.insertBefore(t,s));-1!==o&&r[o].index===l;){if(a>0){for(;-1!==o;)r[o].index+=a,o=f(r,o);return}o=f(r,o)}}(s,o,a.firstChild):a.insertBefore(o,a.firstChild),window.ShadyCSS.prepareTemplateStyles(n,e);const l=a.querySelector("style");if(window.ShadyCSS.nativeShadow&&null!==l)t.insertBefore(l.cloneNode(!0),t.firstChild);else if(s){a.insertBefore(o,a.firstChild);const e=new Set;e.add(o),p(s,e)}};window.JSCompiler_renameProperty=(e,t)=>e;const D={toAttribute(e,t){switch(t){case Boolean:return e?"":null;case Object:case Array:return null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){switch(t){case Boolean:return null!==e;case Number:return null===e?null:Number(e);case Object:case Array:return JSON.parse(e)}return e}},W=(e,t)=>t!==e&&(t==t||e==e),J={attribute:!0,type:String,converter:D,reflect:!1,hasChanged:W},K="finalized";class X extends HTMLElement{constructor(){super(),this.initialize()}static get observedAttributes(){this.finalize();const e=[];return this._classProperties.forEach(((t,s)=>{const n=this._attributeNameForProperty(s,t);void 0!==n&&(this._attributeToPropertyMap.set(n,s),e.push(n))})),e}static _ensureClassProperties(){if(!this.hasOwnProperty(JSCompiler_renameProperty("_classProperties",this))){this._classProperties=new Map;const e=Object.getPrototypeOf(this)._classProperties;void 0!==e&&e.forEach(((e,t)=>this._classProperties.set(t,e)))}}static createProperty(e,t=J){if(this._ensureClassProperties(),this._classProperties.set(e,t),t.noAccessor||this.prototype.hasOwnProperty(e))return;const s="symbol"==typeof e?Symbol():"__"+e,n=this.getPropertyDescriptor(e,s,t);void 0!==n&&Object.defineProperty(this.prototype,e,n)}static getPropertyDescriptor(e,t,s){return{get(){return this[t]},set(n){const r=this[e];this[t]=n,this.requestUpdateInternal(e,r,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this._classProperties&&this._classProperties.get(e)||J}static finalize(){const e=Object.getPrototypeOf(this);if(e.hasOwnProperty(K)||e.finalize(),this.finalized=!0,this._ensureClassProperties(),this._attributeToPropertyMap=new Map,this.hasOwnProperty(JSCompiler_renameProperty("properties",this))){const e=this.properties,t=[...Object.getOwnPropertyNames(e),..."function"==typeof Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e):[]];for(const s of t)this.createProperty(s,e[s])}}static _attributeNameForProperty(e,t){const s=t.attribute;return!1===s?void 0:"string"==typeof s?s:"string"==typeof e?e.toLowerCase():void 0}static _valueHasChanged(e,t,s=W){return s(e,t)}static _propertyValueFromAttribute(e,t){const s=t.type,n=t.converter||D,r="function"==typeof n?n:n.fromAttribute;return r?r(e,s):e}static _propertyValueToAttribute(e,t){if(void 0===t.reflect)return;const s=t.type,n=t.converter;return(n&&n.toAttribute||D.toAttribute)(e,s)}initialize(){this._updateState=0,this._updatePromise=new Promise((e=>this._enableUpdatingResolver=e)),this._changedProperties=new Map,this._saveInstanceProperties(),this.requestUpdateInternal()}_saveInstanceProperties(){this.constructor._classProperties.forEach(((e,t)=>{if(this.hasOwnProperty(t)){const e=this[t];delete this[t],this._instanceProperties||(this._instanceProperties=new Map),this._instanceProperties.set(t,e)}}))}_applyInstanceProperties(){this._instanceProperties.forEach(((e,t)=>this[t]=e)),this._instanceProperties=void 0}connectedCallback(){this.enableUpdating()}enableUpdating(){void 0!==this._enableUpdatingResolver&&(this._enableUpdatingResolver(),this._enableUpdatingResolver=void 0)}disconnectedCallback(){}attributeChangedCallback(e,t,s){t!==s&&this._attributeToProperty(e,s)}_propertyToAttribute(e,t,s=J){const n=this.constructor,r=n._attributeNameForProperty(e,s);if(void 0!==r){const e=n._propertyValueToAttribute(t,s);if(void 0===e)return;this._updateState=8|this._updateState,null==e?this.removeAttribute(r):this.setAttribute(r,e),this._updateState=-9&this._updateState}}_attributeToProperty(e,t){if(8&this._updateState)return;const s=this.constructor,n=s._attributeToPropertyMap.get(e);if(void 0!==n){const e=s.getPropertyOptions(n);this._updateState=16|this._updateState,this[n]=s._propertyValueFromAttribute(t,e),this._updateState=-17&this._updateState}}requestUpdateInternal(e,t,s){let n=!0;if(void 0!==e){const r=this.constructor;s=s||r.getPropertyOptions(e),r._valueHasChanged(this[e],t,s.hasChanged)?(this._changedProperties.has(e)||this._changedProperties.set(e,t),!0!==s.reflect||16&this._updateState||(void 0===this._reflectingProperties&&(this._reflectingProperties=new Map),this._reflectingProperties.set(e,s))):n=!1}!this._hasRequestedUpdate&&n&&(this._updatePromise=this._enqueueUpdate())}requestUpdate(e,t){return this.requestUpdateInternal(e,t),this.updateComplete}async _enqueueUpdate(){this._updateState=4|this._updateState;try{await this._updatePromise}catch(e){}const e=this.performUpdate();return null!=e&&await e,!this._hasRequestedUpdate}get _hasRequestedUpdate(){return 4&this._updateState}get hasUpdated(){return 1&this._updateState}performUpdate(){if(!this._hasRequestedUpdate)return;this._instanceProperties&&this._applyInstanceProperties();let e=!1;const t=this._changedProperties;try{e=this.shouldUpdate(t),e?this.update(t):this._markUpdated()}catch(t){throw e=!1,this._markUpdated(),t}e&&(1&this._updateState||(this._updateState=1|this._updateState,this.firstUpdated(t)),this.updated(t))}_markUpdated(){this._changedProperties=new Map,this._updateState=-5&this._updateState}get updateComplete(){return this._getUpdateComplete()}_getUpdateComplete(){return this._updatePromise}shouldUpdate(e){return!0}update(e){void 0!==this._reflectingProperties&&this._reflectingProperties.size>0&&(this._reflectingProperties.forEach(((e,t)=>this._propertyToAttribute(t,this[t],e))),this._reflectingProperties=void 0),this._markUpdated()}updated(e){}firstUpdated(e){}}X.finalized=!0; + * @license + * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at + * http://polymer.github.io/LICENSE.txt + * The complete set of authors may be found at + * http://polymer.github.io/AUTHORS.txt + * The complete set of contributors may be found at + * http://polymer.github.io/CONTRIBUTORS.txt + * Code distributed by Google as part of the polymer project is also + * subject to an additional IP rights grant found at + * http://polymer.github.io/PATENTS.txt + */,W=(t,e)=>`${t}--${e}`;let Y=!0;void 0===window.ShadyCSS?Y=!1:void 0===window.ShadyCSS.prepareTemplateDom&&(console.warn("Incompatible ShadyCSS version detected. Please update to at least @webcomponents/webcomponentsjs@2.0.2 and @webcomponents/shadycss@1.3.1."),Y=!1);const V=t=>e=>{const n=W(e.type,t);let r=I.get(n);void 0===r&&(r={stringsArray:new WeakMap,keyString:new Map},I.set(n,r));let a=r.stringsArray.get(e.strings);if(void 0!==a)return a;const s=e.strings.join(i);if(a=r.keyString.get(s),void 0===a){const n=e.getTemplateElement();Y&&window.ShadyCSS.prepareTemplateDom(n,t),a=new o(e,n),r.keyString.set(s,a)}return r.stringsArray.set(e.strings,a),a},z=["html","svg"],B=new Set,H=(t,e,n)=>{B.add(t);const i=n?n.element:document.createElement("template"),r=e.querySelectorAll("style"),{length:a}=r;if(0===a)return void window.ShadyCSS.prepareTemplateStyles(i,t);const o=document.createElement("style");for(let t=0;t{z.forEach((e=>{const n=I.get(W(e,t));void 0!==n&&n.keyString.forEach((t=>{const{element:{content:e}}=t,n=new Set;Array.from(e.querySelectorAll("style")).forEach((t=>{n.add(t)})),c(t,n)}))}))})(t);const s=i.content;n?function(t,e,n=null){const{element:{content:i},parts:r}=t;if(null==n)return void i.appendChild(e);const a=document.createTreeWalker(i,133,null,!1);let o=f(r),s=0,l=-1;for(;a.nextNode();)for(l++,a.currentNode===n&&(s=h(e),n.parentNode.insertBefore(e,n));-1!==o&&r[o].index===l;){if(s>0){for(;-1!==o;)r[o].index+=s,o=f(r,o);return}o=f(r,o)}}(n,o,s.firstChild):s.insertBefore(o,s.firstChild),window.ShadyCSS.prepareTemplateStyles(i,t);const l=s.querySelector("style");if(window.ShadyCSS.nativeShadow&&null!==l)e.insertBefore(l.cloneNode(!0),e.firstChild);else if(n){s.insertBefore(o,s.firstChild);const t=new Set;t.add(o),c(n,t)}};window.JSCompiler_renameProperty=(t,e)=>t;const U={toAttribute(t,e){switch(e){case Boolean:return t?"":null;case Object:case Array:return null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){switch(e){case Boolean:return null!==t;case Number:return null===t?null:Number(t);case Object:case Array:return JSON.parse(t)}return t}},j=(t,e)=>e!==t&&(e==e||t==t),q={attribute:!0,type:String,converter:U,reflect:!1,hasChanged:j};class G extends HTMLElement{constructor(){super(),this.initialize()}static get observedAttributes(){this.finalize();const t=[];return this._classProperties.forEach(((e,n)=>{const i=this._attributeNameForProperty(n,e);void 0!==i&&(this._attributeToPropertyMap.set(i,n),t.push(i))})),t}static _ensureClassProperties(){if(!this.hasOwnProperty(JSCompiler_renameProperty("_classProperties",this))){this._classProperties=new Map;const t=Object.getPrototypeOf(this)._classProperties;void 0!==t&&t.forEach(((t,e)=>this._classProperties.set(e,t)))}}static createProperty(t,e=q){if(this._ensureClassProperties(),this._classProperties.set(t,e),e.noAccessor||this.prototype.hasOwnProperty(t))return;const n="symbol"==typeof t?Symbol():"__"+t,i=this.getPropertyDescriptor(t,n,e);void 0!==i&&Object.defineProperty(this.prototype,t,i)}static getPropertyDescriptor(t,e,n){return{get(){return this[e]},set(i){const r=this[t];this[e]=i,this.requestUpdateInternal(t,r,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this._classProperties&&this._classProperties.get(t)||q}static finalize(){const t=Object.getPrototypeOf(this);if(t.hasOwnProperty("finalized")||t.finalize(),this.finalized=!0,this._ensureClassProperties(),this._attributeToPropertyMap=new Map,this.hasOwnProperty(JSCompiler_renameProperty("properties",this))){const t=this.properties,e=[...Object.getOwnPropertyNames(t),..."function"==typeof Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(t):[]];for(const n of e)this.createProperty(n,t[n])}}static _attributeNameForProperty(t,e){const n=e.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof t?t.toLowerCase():void 0}static _valueHasChanged(t,e,n=j){return n(t,e)}static _propertyValueFromAttribute(t,e){const n=e.type,i=e.converter||U,r="function"==typeof i?i:i.fromAttribute;return r?r(t,n):t}static _propertyValueToAttribute(t,e){if(void 0===e.reflect)return;const n=e.type,i=e.converter;return(i&&i.toAttribute||U.toAttribute)(t,n)}initialize(){this._updateState=0,this._updatePromise=new Promise((t=>this._enableUpdatingResolver=t)),this._changedProperties=new Map,this._saveInstanceProperties(),this.requestUpdateInternal()}_saveInstanceProperties(){this.constructor._classProperties.forEach(((t,e)=>{if(this.hasOwnProperty(e)){const t=this[e];delete this[e],this._instanceProperties||(this._instanceProperties=new Map),this._instanceProperties.set(e,t)}}))}_applyInstanceProperties(){this._instanceProperties.forEach(((t,e)=>this[e]=t)),this._instanceProperties=void 0}connectedCallback(){this.enableUpdating()}enableUpdating(){void 0!==this._enableUpdatingResolver&&(this._enableUpdatingResolver(),this._enableUpdatingResolver=void 0)}disconnectedCallback(){}attributeChangedCallback(t,e,n){e!==n&&this._attributeToProperty(t,n)}_propertyToAttribute(t,e,n=q){const i=this.constructor,r=i._attributeNameForProperty(t,n);if(void 0!==r){const t=i._propertyValueToAttribute(e,n);if(void 0===t)return;this._updateState=8|this._updateState,null==t?this.removeAttribute(r):this.setAttribute(r,t),this._updateState=-9&this._updateState}}_attributeToProperty(t,e){if(8&this._updateState)return;const n=this.constructor,i=n._attributeToPropertyMap.get(t);if(void 0!==i){const t=n.getPropertyOptions(i);this._updateState=16|this._updateState,this[i]=n._propertyValueFromAttribute(e,t),this._updateState=-17&this._updateState}}requestUpdateInternal(t,e,n){let i=!0;if(void 0!==t){const r=this.constructor;n=n||r.getPropertyOptions(t),r._valueHasChanged(this[t],e,n.hasChanged)?(this._changedProperties.has(t)||this._changedProperties.set(t,e),!0!==n.reflect||16&this._updateState||(void 0===this._reflectingProperties&&(this._reflectingProperties=new Map),this._reflectingProperties.set(t,n))):i=!1}!this._hasRequestedUpdate&&i&&(this._updatePromise=this._enqueueUpdate())}requestUpdate(t,e){return this.requestUpdateInternal(t,e),this.updateComplete}async _enqueueUpdate(){this._updateState=4|this._updateState;try{await this._updatePromise}catch(t){}const t=this.performUpdate();return null!=t&&await t,!this._hasRequestedUpdate}get _hasRequestedUpdate(){return 4&this._updateState}get hasUpdated(){return 1&this._updateState}performUpdate(){if(!this._hasRequestedUpdate)return;this._instanceProperties&&this._applyInstanceProperties();let t=!1;const e=this._changedProperties;try{t=this.shouldUpdate(e),t?this.update(e):this._markUpdated()}catch(e){throw t=!1,this._markUpdated(),e}t&&(1&this._updateState||(this._updateState=1|this._updateState,this.firstUpdated(e)),this.updated(e))}_markUpdated(){this._changedProperties=new Map,this._updateState=-5&this._updateState}get updateComplete(){return this._getUpdateComplete()}_getUpdateComplete(){return this._updatePromise}shouldUpdate(t){return!0}update(t){void 0!==this._reflectingProperties&&this._reflectingProperties.size>0&&(this._reflectingProperties.forEach(((t,e)=>this._propertyToAttribute(e,this[e],t))),this._reflectingProperties=void 0),this._markUpdated()}updated(t){}firstUpdated(t){}}G.finalized=!0; /** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -const G=e=>t=>"function"==typeof t?((e,t)=>(window.customElements.define(e,t),t))(e,t):((e,t)=>{const{kind:s,elements:n}=t;return{kind:s,elements:n,finisher(t){window.customElements.define(e,t)}}})(e,t),Q=(e,t)=>"method"===t.kind&&t.descriptor&&!("value"in t.descriptor)?Object.assign(Object.assign({},t),{finisher(s){s.createProperty(t.key,e)}}):{kind:"field",key:Symbol(),placement:"own",descriptor:{},initializer(){"function"==typeof t.initializer&&(this[t.key]=t.initializer.call(this))},finisher(s){s.createProperty(t.key,e)}};function Y(e){return(t,s)=>void 0!==s?((e,t,s)=>{t.constructor.createProperty(s,e)})(e,t,s):Q(e,t)} + * @license + * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at + * http://polymer.github.io/LICENSE.txt + * The complete set of authors may be found at + * http://polymer.github.io/AUTHORS.txt + * The complete set of contributors may be found at + * http://polymer.github.io/CONTRIBUTORS.txt + * Code distributed by Google as part of the polymer project is also + * subject to an additional IP rights grant found at + * http://polymer.github.io/PATENTS.txt + */ +const $=t=>e=>"function"==typeof e?((t,e)=>(window.customElements.define(t,e),e))(t,e):((t,e)=>{const{kind:n,elements:i}=e;return{kind:n,elements:i,finisher(e){window.customElements.define(t,e)}}})(t,e),Z=(t,e)=>"method"===e.kind&&e.descriptor&&!("value"in e.descriptor)?Object.assign(Object.assign({},e),{finisher(n){n.createProperty(e.key,t)}}):{kind:"field",key:Symbol(),placement:"own",descriptor:{},initializer(){"function"==typeof e.initializer&&(this[e.key]=e.initializer.call(this))},finisher(n){n.createProperty(e.key,t)}};function X(t){return(e,n)=>void 0!==n?((t,e,n)=>{e.constructor.createProperty(n,t)})(t,e,n):Z(t,e)} /** - @license - Copyright (c) 2019 The Polymer Project Authors. All rights reserved. - This code may only be used under the BSD style license found at - http://polymer.github.io/LICENSE.txt The complete set of authors may be found at - http://polymer.github.io/AUTHORS.txt The complete set of contributors may be - found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as - part of the polymer project is also subject to an additional IP rights grant - found at http://polymer.github.io/PATENTS.txt - */const Z=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,ee=Symbol();class te{constructor(e,t){if(t!==ee)throw new Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e}get styleSheet(){return void 0===this._styleSheet&&(Z?(this._styleSheet=new CSSStyleSheet,this._styleSheet.replaceSync(this.cssText)):this._styleSheet=null),this._styleSheet}toString(){return this.cssText}} +@license +Copyright (c) 2019 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at +http://polymer.github.io/LICENSE.txt The complete set of authors may be found at +http://polymer.github.io/AUTHORS.txt The complete set of contributors may be +found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as +part of the polymer project is also subject to an additional IP rights grant +found at http://polymer.github.io/PATENTS.txt +*/const J=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,K=Symbol();class Q{constructor(t,e){if(e!==K)throw new Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t}get styleSheet(){return void 0===this._styleSheet&&(J?(this._styleSheet=new CSSStyleSheet,this._styleSheet.replaceSync(this.cssText)):this._styleSheet=null),this._styleSheet}toString(){return this.cssText}}const tt=(t,...e)=>{const n=e.reduce(((e,n,i)=>e+(t=>{if(t instanceof Q)return t.cssText;if("number"==typeof t)return t;throw new Error(`Value passed to 'css' function must be a 'css' function result: ${t}. Use 'unsafeCSS' to pass non-literal values, but\n take care to ensure page security.`)})(n)+t[i+1]),t[0]);return new Q(n,K)}; /** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -(window.litElementVersions||(window.litElementVersions=[])).push("2.4.0");const se={};class ne extends X{static getStyles(){return this.styles}static _getUniqueStyles(){if(this.hasOwnProperty(JSCompiler_renameProperty("_styles",this)))return;const e=this.getStyles();if(Array.isArray(e)){const t=(e,s)=>e.reduceRight(((e,s)=>Array.isArray(s)?t(s,e):(e.add(s),e)),s),s=t(e,new Set),n=[];s.forEach((e=>n.unshift(e))),this._styles=n}else this._styles=void 0===e?[]:[e];this._styles=this._styles.map((e=>{if(e instanceof CSSStyleSheet&&!Z){const t=Array.prototype.slice.call(e.cssRules).reduce(((e,t)=>e+t.cssText),"");return new te(String(t),ee)}return e}))}initialize(){super.initialize(),this.constructor._getUniqueStyles(),this.renderRoot=this.createRenderRoot(),window.ShadowRoot&&this.renderRoot instanceof window.ShadowRoot&&this.adoptStyles()}createRenderRoot(){return this.attachShadow({mode:"open"})}adoptStyles(){const e=this.constructor._styles;0!==e.length&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow?Z?this.renderRoot.adoptedStyleSheets=e.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet)):this._needsShimAdoptedStyleSheets=!0:window.ShadyCSS.ScopingShim.prepareAdoptedCssText(e.map((e=>e.cssText)),this.localName))}connectedCallback(){super.connectedCallback(),this.hasUpdated&&void 0!==window.ShadyCSS&&window.ShadyCSS.styleElement(this)}update(e){const t=this.render();super.update(e),t!==se&&this.constructor.render(t,this.renderRoot,{scopeName:this.localName,eventContext:this}),this._needsShimAdoptedStyleSheets&&(this._needsShimAdoptedStyleSheets=!1,this.constructor._styles.forEach((e=>{const t=document.createElement("style");t.textContent=e.cssText,this.renderRoot.appendChild(t)})))}render(){return se}}ne.finalized=!0,ne.render=(e,t,n)=>{if(!n||"object"!=typeof n||!n.scopeName)throw new Error("The `scopeName` option is required.");const r=n.scopeName,i=M.has(t),o=$&&11===t.nodeType&&!!t.host,a=o&&!H.has(r),l=a?document.createDocumentFragment():t;if(((e,t,n)=>{let r=M.get(t);void 0===r&&(s(t,t.firstChild),M.set(t,r=new C(Object.assign({templateFactory:L},n))),r.appendInto(t)),r.setValue(e),r.commit()})(e,l,Object.assign({templateFactory:B(r)},n)),a){const e=M.get(l);M.delete(l);const n=e.value instanceof v?e.value.template:void 0;z(r,l,n),s(t,t.firstChild),t.appendChild(l),M.set(t,e)}!i&&o&&window.ShadyCSS.styleElement(t.host)};const re={error:"fas fa-exclamation-circle",warning:"fas fa-exclamation-triangle",success:"fas fa-check-circle",info:"fas fa-info"};function ie(){(null===document||void 0===document?void 0:document.querySelector("pb-messages")).fetchMessages()}let oe=class extends ne{constructor(){super(...arguments),this.url="",this.messages=[]}createRenderRoot(){return this}firstUpdated(){this.fetchMessages()}fetchMessages(){return fetch(this.url).then((e=>e.json())).then((e=>this.messages=e)).then((e=>{const t=this.querySelector(".pf-c-alert-group");e.forEach((e=>{const s=this.renderMessage(e);t.appendChild(s)}))}))}renderMessage(e){const t="pb-message"+Math.random().toString(36).substr(2,9);const s=document.createElement("template");return s.innerHTML=`
  • \n
    \n
    \n \n
    \n

    \n ${e.message}\n

    \n
    \n
  • `,setTimeout((()=>{var e;null===(e=this.querySelector("#"+t))||void 0===e||e.remove()}),1500),s.content.firstChild}render(){return F`
      `}};e([Y()],oe.prototype,"url",void 0),e([Y()],oe.prototype,"messages",void 0),oe=e([G("pb-messages")],oe);const ae="pf-m-primary",le=["pf-m-progress","pf-m-in-progress"];let ce=class extends ne{constructor(){var e;super(),this.url="",this.isRunning=!1,null===(e=this.querySelector("button"))||void 0===e||e.addEventListener("click",(e=>this.callAction()))}setLoading(){this.isRunning=!0,this.classList.add(...le)}setDone(e){this.isRunning=!1,this.classList.remove(...le),this.classList.replace(ae,e),ie(),setTimeout((()=>{this.classList.replace(e,ae)}),1e3)}callAction(){if(!0===this.isRunning)return;this.setLoading();const e=function(e){let t=null;if(document.cookie&&""!==document.cookie){const s=document.cookie.split(";");for(let n=0;ne.json())).then((e=>{this.setDone("pf-m-success")})).catch((()=>{this.setDone("pf-m-danger")}))}render(){return F``}};e([Y()],ce.prototype,"url",void 0),ce=e([G("pb-action-button")],ce);let de=class extends ne{constructor(){super();const e=this.querySelector(".pf-c-dropdown__menu");this.querySelectorAll("button").forEach((t=>{t.addEventListener("click",(t=>{e.hidden=!e.hidden}))}))}render(){return F``}};de=e([G("pb-dropdown")],de);let he=class extends ne{constructor(){super(...arguments),this.url="",this.key="",this.value=""}comparison(e){let t={"<":function(e,t){return e":function(e,t){return e>t},">=":function(e,t){return e>=t},"<=":function(e,t){return e<=t},"==":function(e,t){return e==t},"!=":function(e,t){return e!=t},"===":function(e,t){return e===t},"!==":function(e,t){return e!==t}};const s=e.split(" ");if(s.length<3)throw new Error("nah");let n=s[0];n="value"===n?this.value:parseInt(n,10);let r=s[2];r="value"===r?this.value:parseInt(r,10);const i=s[1];if(!(i in t))throw new Error("Invalid comparison");return t[i](n,r)}firstUpdated(){fetch(this.url).then((e=>e.json())).then((e=>e[this.key])).then((e=>this.value=e))}render(){if(void 0===this.value)return F``;let e="";return this.querySelectorAll("[slot]").forEach((t=>{const s=t.getAttribute("slot");this.comparison(s)&&(e=s)})),this.querySelectorAll("[data-value]").forEach((e=>{e.textContent=this.value})),F``}};var pe;e([Y()],he.prototype,"url",void 0),e([Y()],he.prototype,"key",void 0),e([Y()],he.prototype,"value",void 0),he=e([G("fetch-fill-slot")],he),function(e){e[e.redirect=0]="redirect",e[e.template=1]="template"}(pe||(pe={}));let ue=class extends ne{constructor(){super(...arguments),this.flowBodyUrl="",this.flowBody=void 0}createRenderRoot(){return this}firstUpdated(){fetch(this.flowBodyUrl).then((e=>{if(!e.ok)throw Error(e.statusText);return e})).then((e=>e.json())).then((e=>{this.updateCard(e)})).catch((e=>{this.errorMessage(e)}))}async updateCard(e){switch(e.type){case pe.redirect:window.location.assign(e.to);break;case pe.template:this.flowBody=e.body,await this.requestUpdate(),this.checkAutofocus(),ie(),this.loadFormCode(),this.setFormSubmitHandlers()}}loadFormCode(){this.querySelectorAll("script").forEach((e=>{let t=document.createElement("script");t.src=e.src,document.head.appendChild(t)}))}checkAutofocus(){const e=this.querySelector("[autofocus]");null!==e&&e.focus()}updateFormAction(e){for(let t=0;t{console.log("passbook/flows: Checking for autosubmit attribute "+e),this.checkAutosubmit(e),console.log("passbook/flows: Setting action for form "+e),this.updateFormAction(e),console.log("passbook/flows: Adding handler for form "+e),e.addEventListener("submit",(t=>{t.preventDefault();let s=new FormData(e);this.flowBody=void 0,fetch(this.flowBodyUrl,{method:"post",body:s}).then((e=>e.json())).then((e=>{this.updateCard(e)})).catch((e=>{this.errorMessage(e)}))})),e.classList.add("pb-flow-wrapped")}))}errorMessage(e){this.flowBody=`\n \n \n `}loading(){return F``}render(){return void 0!==this.flowBody?F`${this.flowBody}`:this.loading()}};e([Y()],ue.prototype,"flowBodyUrl",void 0),e([Y()],ue.prototype,"flowBody",void 0),ue=e([G("flow-shell-card")],ue);let fe=class extends ne{constructor(){super(...arguments),this._currentPage="",this._firstPage=""}get currentPage(){return this._currentPage}set currentPage(e){var t,s;try{null===(t=this.querySelector(`.pf-c-tab-content[tab-name='${e}']`))||void 0===t||t.removeAttribute("hidden"),null===(s=this.querySelector(`.pf-c-tabs__item[tab-name='${e}']`))||void 0===s||s.classList.add("pf-m-current"),this.querySelectorAll(`.pf-c-tab-content:not([tab-name='${e}'])`).forEach((e=>{e.setAttribute("hidden","")})),this.querySelectorAll(`.pf-c-tabs__item:not([tab-name='${e}'])`).forEach((e=>{e.classList.remove("pf-m-current")})),window.location.hash="#"+e,this._currentPage=e}catch(e){this.currentPage=this._firstPage}}createRenderRoot(){return this}firstUpdated(){var e;this._firstPage=null===(e=this.querySelector(".pf-c-tab-content"))||void 0===e?void 0:e.getAttribute("tab-name"),window.location.hash?this.currentPage=window.location.hash:this.currentPage=this._firstPage,this.querySelectorAll(".pf-c-tabs__item > button").forEach((e=>{e.addEventListener("click",(t=>{var s;let n=null===(s=e.parentElement)||void 0===s?void 0:s.getAttribute("tab-name");this.currentPage=n}))}))}};fe=e([G("pb-tabs")],fe);let me=class extends ne{constructor(){super(),this.href="",this.addEventListener("click",(e=>this.callAction(e)))}getModal(){return F`
      `}callAction(e){e.preventDefault();const t=new Request(this.href);fetch(t,{method:"POST",mode:"same-origin"}).then((e=>{})).catch((()=>{}))}};e([Y()],me.prototype,"href",void 0),me=e([G("pb-modal-button")],me);let ye=class extends ne{set defaultUrl(e){""===window.location.hash&&void 0!==e&&(window.location.hash="#"+e)}createRenderRoot(){return this}constructor(){super(),this.loadContent(),window.addEventListener("hashchange",(e=>this.loadContent()))}loadContent(){let e=window.location.hash.slice(1,1/0);""!==e&&fetch(e).then((e=>e.text())).then((e=>{this.innerHTML=e})).then((()=>{this.querySelectorAll("a").forEach((e=>{if(""!==e.href)try{const t=new URL(e.href),s=t.search||"";e.href=`#${t.pathname}${s}`}catch(t){e.href="#"+e.href}}))}))}render(){return F`${this.innerHTML}`}};e([Y()],ye.prototype,"defaultUrl",null),ye=e([G("pb-admin-shell")],ye)}(); + * @license + * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at + * http://polymer.github.io/LICENSE.txt + * The complete set of authors may be found at + * http://polymer.github.io/AUTHORS.txt + * The complete set of contributors may be found at + * http://polymer.github.io/CONTRIBUTORS.txt + * Code distributed by Google as part of the polymer project is also + * subject to an additional IP rights grant found at + * http://polymer.github.io/PATENTS.txt + */ +(window.litElementVersions||(window.litElementVersions=[])).push("2.4.0");const et={};class nt extends G{static getStyles(){return this.styles}static _getUniqueStyles(){if(this.hasOwnProperty(JSCompiler_renameProperty("_styles",this)))return;const t=this.getStyles();if(Array.isArray(t)){const e=(t,n)=>t.reduceRight(((t,n)=>Array.isArray(n)?e(n,t):(t.add(n),t)),n),n=e(t,new Set),i=[];n.forEach((t=>i.unshift(t))),this._styles=i}else this._styles=void 0===t?[]:[t];this._styles=this._styles.map((t=>{if(t instanceof CSSStyleSheet&&!J){const e=Array.prototype.slice.call(t.cssRules).reduce(((t,e)=>t+e.cssText),"");return new Q(String(e),K)}return t}))}initialize(){super.initialize(),this.constructor._getUniqueStyles(),this.renderRoot=this.createRenderRoot(),window.ShadowRoot&&this.renderRoot instanceof window.ShadowRoot&&this.adoptStyles()}createRenderRoot(){return this.attachShadow({mode:"open"})}adoptStyles(){const t=this.constructor._styles;0!==t.length&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow?J?this.renderRoot.adoptedStyleSheets=t.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):this._needsShimAdoptedStyleSheets=!0:window.ShadyCSS.ScopingShim.prepareAdoptedCssText(t.map((t=>t.cssText)),this.localName))}connectedCallback(){super.connectedCallback(),this.hasUpdated&&void 0!==window.ShadyCSS&&window.ShadyCSS.styleElement(this)}update(t){const e=this.render();super.update(t),e!==et&&this.constructor.render(e,this.renderRoot,{scopeName:this.localName,eventContext:this}),this._needsShimAdoptedStyleSheets&&(this._needsShimAdoptedStyleSheets=!1,this.constructor._styles.forEach((t=>{const e=document.createElement("style");e.textContent=t.cssText,this.renderRoot.appendChild(e)})))}render(){return et}}nt.finalized=!0,nt.render=(t,e,i)=>{if(!i||"object"!=typeof i||!i.scopeName)throw new Error("The `scopeName` option is required.");const r=i.scopeName,a=R.has(e),o=Y&&11===e.nodeType&&!!e.host,s=o&&!B.has(r),l=s?document.createDocumentFragment():e;if(((t,e,i)=>{let r=R.get(e);void 0===r&&(n(e,e.firstChild),R.set(e,r=new D(Object.assign({templateFactory:F},i))),r.appendInto(e)),r.setValue(t),r.commit()})(t,l,Object.assign({templateFactory:V(r)},i)),s){const t=R.get(l);R.delete(l);const i=t.value instanceof y?t.value.template:void 0;H(r,l,i),n(e,e.firstChild),e.appendChild(l),R.set(e,t)}!a&&o&&window.ShadyCSS.styleElement(e.host)};"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function it(){throw new Error("Dynamic requires are not currently supported by rollup-plugin-commonjs")}function rt(t,e){return t(e={exports:{}},e.exports),e.exports}var at=rt((function(t,e){t.exports=function(){var e,n;function i(){return e.apply(null,arguments)}function r(t){e=t}function a(t){return t instanceof Array||"[object Array]"===Object.prototype.toString.call(t)}function o(t){return null!=t&&"[object Object]"===Object.prototype.toString.call(t)}function s(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function l(t){if(Object.getOwnPropertyNames)return 0===Object.getOwnPropertyNames(t).length;var e;for(e in t)if(s(t,e))return!1;return!0}function u(t){return void 0===t}function d(t){return"number"==typeof t||"[object Number]"===Object.prototype.toString.call(t)}function c(t){return t instanceof Date||"[object Date]"===Object.prototype.toString.call(t)}function h(t,e){var n,i=[];for(n=0;n>>0;for(e=0;e0)for(n=0;n=0?n?"+":"":"-")+Math.pow(10,Math.max(0,r)).toString().substr(1)+i}var L=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,E=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,W={},Y={};function V(t,e,n,i){var r=i;"string"==typeof i&&(r=function(){return this[i]()}),t&&(Y[t]=r),e&&(Y[e[0]]=function(){return R(r.apply(this,arguments),e[1],e[2])}),n&&(Y[n]=function(){return this.localeData().ordinal(r.apply(this,arguments),t)})}function z(t){return t.match(/\[[\s\S]/)?t.replace(/^\[|\]$/g,""):t.replace(/\\/g,"")}function B(t){var e,n,i=t.match(L);for(e=0,n=i.length;e=0&&E.test(t);)t=t.replace(E,i),E.lastIndex=0,n-=1;return t}var j={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};function q(t){var e=this._longDateFormat[t],n=this._longDateFormat[t.toUpperCase()];return e||!n?e:(this._longDateFormat[t]=n.match(L).map((function(t){return"MMMM"===t||"MM"===t||"DD"===t||"dddd"===t?t.slice(1):t})).join(""),this._longDateFormat[t])}var G="Invalid date";function $(){return this._invalidDate}var Z="%d",X=/\d{1,2}/;function J(t){return this._ordinal.replace("%d",t)}var K={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function Q(t,e,n,i){var r=this._relativeTime[n];return T(r)?r(t,e,n,i):r.replace(/%d/i,t)}function tt(t,e){var n=this._relativeTime[t>0?"future":"past"];return T(n)?n(e):n.replace(/%s/i,e)}var et={};function nt(t,e){var n=t.toLowerCase();et[n]=et[n+"s"]=et[e]=t}function rt(t){return"string"==typeof t?et[t]||et[t.toLowerCase()]:void 0}function at(t){var e,n,i={};for(n in t)s(t,n)&&(e=rt(n))&&(i[e]=t[n]);return i}var ot={};function st(t,e){ot[t]=e}function lt(t){var e,n=[];for(e in t)s(t,e)&&n.push({unit:e,priority:ot[e]});return n.sort((function(t,e){return t.priority-e.priority})),n}function ut(t){return t%4==0&&t%100!=0||t%400==0}function dt(t){return t<0?Math.ceil(t)||0:Math.floor(t)}function ct(t){var e=+t,n=0;return 0!==e&&isFinite(e)&&(n=dt(e)),n}function ht(t,e){return function(n){return null!=n?(pt(this,t,n),i.updateOffset(this,e),this):ft(this,t)}}function ft(t,e){return t.isValid()?t._d["get"+(t._isUTC?"UTC":"")+e]():NaN}function pt(t,e,n){t.isValid()&&!isNaN(n)&&("FullYear"===e&&ut(t.year())&&1===t.month()&&29===t.date()?(n=ct(n),t._d["set"+(t._isUTC?"UTC":"")+e](n,t.month(),te(n,t.month()))):t._d["set"+(t._isUTC?"UTC":"")+e](n))}function gt(t){return T(this[t=rt(t)])?this[t]():this}function mt(t,e){if("object"==typeof t){var n,i=lt(t=at(t));for(n=0;n68?1900:2e3)};var ve=ht("FullYear",!0);function ye(){return ut(this.year())}function be(t,e,n,i,r,a,o){var s;return t<100&&t>=0?(s=new Date(t+400,e,n,i,r,a,o),isFinite(s.getFullYear())&&s.setFullYear(t)):s=new Date(t,e,n,i,r,a,o),s}function _e(t){var e,n;return t<100&&t>=0?((n=Array.prototype.slice.call(arguments))[0]=t+400,e=new Date(Date.UTC.apply(null,n)),isFinite(e.getUTCFullYear())&&e.setUTCFullYear(t)):e=new Date(Date.UTC.apply(null,arguments)),e}function xe(t,e,n){var i=7+e-n;return-(7+_e(t,0,i).getUTCDay()-e)%7+i-1}function we(t,e,n,i,r){var a,o,s=1+7*(e-1)+(7+n-i)%7+xe(t,i,r);return s<=0?o=me(a=t-1)+s:s>me(t)?(a=t+1,o=s-me(t)):(a=t,o=s),{year:a,dayOfYear:o}}function ke(t,e,n){var i,r,a=xe(t.year(),e,n),o=Math.floor((t.dayOfYear()-a-1)/7)+1;return o<1?i=o+Se(r=t.year()-1,e,n):o>Se(t.year(),e,n)?(i=o-Se(t.year(),e,n),r=t.year()+1):(r=t.year(),i=o),{week:i,year:r}}function Se(t,e,n){var i=xe(t,e,n),r=xe(t+1,e,n);return(me(t)-i+r)/7}function Me(t){return ke(t,this._week.dow,this._week.doy).week}V("w",["ww",2],"wo","week"),V("W",["WW",2],"Wo","isoWeek"),nt("week","w"),nt("isoWeek","W"),st("week",5),st("isoWeek",5),Rt("w",kt),Rt("ww",kt,bt),Rt("W",kt),Rt("WW",kt,bt),zt(["w","ww","W","WW"],(function(t,e,n,i){e[i.substr(0,1)]=ct(t)}));var De={dow:0,doy:6};function Ce(){return this._week.dow}function Pe(){return this._week.doy}function Te(t){var e=this.localeData().week(this);return null==t?e:this.add(7*(t-e),"d")}function Ae(t){var e=ke(this,1,4).week;return null==t?e:this.add(7*(t-e),"d")}function Oe(t,e){return"string"!=typeof t?t:isNaN(t)?"number"==typeof(t=e.weekdaysParse(t))?t:null:parseInt(t,10)}function Ne(t,e){return"string"==typeof t?e.weekdaysParse(t)%7||7:isNaN(t)?null:t}function Fe(t,e){return t.slice(e,7).concat(t.slice(0,e))}V("d",0,"do","day"),V("dd",0,0,(function(t){return this.localeData().weekdaysMin(this,t)})),V("ddd",0,0,(function(t){return this.localeData().weekdaysShort(this,t)})),V("dddd",0,0,(function(t){return this.localeData().weekdays(this,t)})),V("e",0,0,"weekday"),V("E",0,0,"isoWeekday"),nt("day","d"),nt("weekday","e"),nt("isoWeekday","E"),st("day",11),st("weekday",11),st("isoWeekday",11),Rt("d",kt),Rt("e",kt),Rt("E",kt),Rt("dd",(function(t,e){return e.weekdaysMinRegex(t)})),Rt("ddd",(function(t,e){return e.weekdaysShortRegex(t)})),Rt("dddd",(function(t,e){return e.weekdaysRegex(t)})),zt(["dd","ddd","dddd"],(function(t,e,n,i){var r=n._locale.weekdaysParse(t,i,n._strict);null!=r?e.d=r:m(n).invalidWeekday=t})),zt(["d","e","E"],(function(t,e,n,i){e[i]=ct(t)}));var Ie="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Re="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),Le="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),Ee=It,We=It,Ye=It;function Ve(t,e){var n=a(this._weekdays)?this._weekdays:this._weekdays[t&&!0!==t&&this._weekdays.isFormat.test(e)?"format":"standalone"];return!0===t?Fe(n,this._week.dow):t?n[t.day()]:n}function ze(t){return!0===t?Fe(this._weekdaysShort,this._week.dow):t?this._weekdaysShort[t.day()]:this._weekdaysShort}function Be(t){return!0===t?Fe(this._weekdaysMin,this._week.dow):t?this._weekdaysMin[t.day()]:this._weekdaysMin}function He(t,e,n){var i,r,a,o=t.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],i=0;i<7;++i)a=p([2e3,1]).day(i),this._minWeekdaysParse[i]=this.weekdaysMin(a,"").toLocaleLowerCase(),this._shortWeekdaysParse[i]=this.weekdaysShort(a,"").toLocaleLowerCase(),this._weekdaysParse[i]=this.weekdays(a,"").toLocaleLowerCase();return n?"dddd"===e?-1!==(r=Ht.call(this._weekdaysParse,o))?r:null:"ddd"===e?-1!==(r=Ht.call(this._shortWeekdaysParse,o))?r:null:-1!==(r=Ht.call(this._minWeekdaysParse,o))?r:null:"dddd"===e?-1!==(r=Ht.call(this._weekdaysParse,o))||-1!==(r=Ht.call(this._shortWeekdaysParse,o))||-1!==(r=Ht.call(this._minWeekdaysParse,o))?r:null:"ddd"===e?-1!==(r=Ht.call(this._shortWeekdaysParse,o))||-1!==(r=Ht.call(this._weekdaysParse,o))||-1!==(r=Ht.call(this._minWeekdaysParse,o))?r:null:-1!==(r=Ht.call(this._minWeekdaysParse,o))||-1!==(r=Ht.call(this._weekdaysParse,o))||-1!==(r=Ht.call(this._shortWeekdaysParse,o))?r:null}function Ue(t,e,n){var i,r,a;if(this._weekdaysParseExact)return He.call(this,t,e,n);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),i=0;i<7;i++){if(r=p([2e3,1]).day(i),n&&!this._fullWeekdaysParse[i]&&(this._fullWeekdaysParse[i]=new RegExp("^"+this.weekdays(r,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[i]=new RegExp("^"+this.weekdaysShort(r,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[i]=new RegExp("^"+this.weekdaysMin(r,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[i]||(a="^"+this.weekdays(r,"")+"|^"+this.weekdaysShort(r,"")+"|^"+this.weekdaysMin(r,""),this._weekdaysParse[i]=new RegExp(a.replace(".",""),"i")),n&&"dddd"===e&&this._fullWeekdaysParse[i].test(t))return i;if(n&&"ddd"===e&&this._shortWeekdaysParse[i].test(t))return i;if(n&&"dd"===e&&this._minWeekdaysParse[i].test(t))return i;if(!n&&this._weekdaysParse[i].test(t))return i}}function je(t){if(!this.isValid())return null!=t?this:NaN;var e=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=t?(t=Oe(t,this.localeData()),this.add(t-e,"d")):e}function qe(t){if(!this.isValid())return null!=t?this:NaN;var e=(this.day()+7-this.localeData()._week.dow)%7;return null==t?e:this.add(t-e,"d")}function Ge(t){if(!this.isValid())return null!=t?this:NaN;if(null!=t){var e=Ne(t,this.localeData());return this.day(this.day()%7?e:e-7)}return this.day()||7}function $e(t){return this._weekdaysParseExact?(s(this,"_weekdaysRegex")||Je.call(this),t?this._weekdaysStrictRegex:this._weekdaysRegex):(s(this,"_weekdaysRegex")||(this._weekdaysRegex=Ee),this._weekdaysStrictRegex&&t?this._weekdaysStrictRegex:this._weekdaysRegex)}function Ze(t){return this._weekdaysParseExact?(s(this,"_weekdaysRegex")||Je.call(this),t?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(s(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=We),this._weekdaysShortStrictRegex&&t?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function Xe(t){return this._weekdaysParseExact?(s(this,"_weekdaysRegex")||Je.call(this),t?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(s(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=Ye),this._weekdaysMinStrictRegex&&t?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function Je(){function t(t,e){return e.length-t.length}var e,n,i,r,a,o=[],s=[],l=[],u=[];for(e=0;e<7;e++)n=p([2e3,1]).day(e),i=Wt(this.weekdaysMin(n,"")),r=Wt(this.weekdaysShort(n,"")),a=Wt(this.weekdays(n,"")),o.push(i),s.push(r),l.push(a),u.push(i),u.push(r),u.push(a);o.sort(t),s.sort(t),l.sort(t),u.sort(t),this._weekdaysRegex=new RegExp("^("+u.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+l.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+s.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+o.join("|")+")","i")}function Ke(){return this.hours()%12||12}function Qe(){return this.hours()||24}function tn(t,e){V(t,0,0,(function(){return this.localeData().meridiem(this.hours(),this.minutes(),e)}))}function en(t,e){return e._meridiemParse}function nn(t){return"p"===(t+"").toLowerCase().charAt(0)}V("H",["HH",2],0,"hour"),V("h",["hh",2],0,Ke),V("k",["kk",2],0,Qe),V("hmm",0,0,(function(){return""+Ke.apply(this)+R(this.minutes(),2)})),V("hmmss",0,0,(function(){return""+Ke.apply(this)+R(this.minutes(),2)+R(this.seconds(),2)})),V("Hmm",0,0,(function(){return""+this.hours()+R(this.minutes(),2)})),V("Hmmss",0,0,(function(){return""+this.hours()+R(this.minutes(),2)+R(this.seconds(),2)})),tn("a",!0),tn("A",!1),nt("hour","h"),st("hour",13),Rt("a",en),Rt("A",en),Rt("H",kt),Rt("h",kt),Rt("k",kt),Rt("HH",kt,bt),Rt("hh",kt,bt),Rt("kk",kt,bt),Rt("hmm",St),Rt("hmmss",Mt),Rt("Hmm",St),Rt("Hmmss",Mt),Vt(["H","HH"],Gt),Vt(["k","kk"],(function(t,e,n){var i=ct(t);e[Gt]=24===i?0:i})),Vt(["a","A"],(function(t,e,n){n._isPm=n._locale.isPM(t),n._meridiem=t})),Vt(["h","hh"],(function(t,e,n){e[Gt]=ct(t),m(n).bigHour=!0})),Vt("hmm",(function(t,e,n){var i=t.length-2;e[Gt]=ct(t.substr(0,i)),e[$t]=ct(t.substr(i)),m(n).bigHour=!0})),Vt("hmmss",(function(t,e,n){var i=t.length-4,r=t.length-2;e[Gt]=ct(t.substr(0,i)),e[$t]=ct(t.substr(i,2)),e[Zt]=ct(t.substr(r)),m(n).bigHour=!0})),Vt("Hmm",(function(t,e,n){var i=t.length-2;e[Gt]=ct(t.substr(0,i)),e[$t]=ct(t.substr(i))})),Vt("Hmmss",(function(t,e,n){var i=t.length-4,r=t.length-2;e[Gt]=ct(t.substr(0,i)),e[$t]=ct(t.substr(i,2)),e[Zt]=ct(t.substr(r))}));var rn=/[ap]\.?m?\.?/i,an=ht("Hours",!0);function on(t,e,n){return t>11?n?"pm":"PM":n?"am":"AM"}var sn,ln={calendar:F,longDateFormat:j,invalidDate:G,ordinal:Z,dayOfMonthOrdinalParse:X,relativeTime:K,months:ee,monthsShort:ne,week:De,weekdays:Ie,weekdaysMin:Le,weekdaysShort:Re,meridiemParse:rn},un={},dn={};function cn(t,e){var n,i=Math.min(t.length,e.length);for(n=0;n0;){if(i=pn(r.slice(0,e).join("-")))return i;if(n&&n.length>=e&&cn(r,n)>=e-1)break;e--}a++}return sn}function pn(e){var n=null;if(void 0===un[e]&&t&&t.exports)try{n=sn._abbr,it(),gn(n)}catch(t){un[e]=null}return un[e]}function gn(t,e){var n;return t&&((n=u(e)?yn(t):mn(t,e))?sn=n:"undefined"!=typeof console&&console.warn&&console.warn("Locale "+t+" not found. Did you forget to load it?")),sn._abbr}function mn(t,e){if(null!==e){var n,i=ln;if(e.abbr=t,null!=un[t])P("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),i=un[t]._config;else if(null!=e.parentLocale)if(null!=un[e.parentLocale])i=un[e.parentLocale]._config;else{if(null==(n=pn(e.parentLocale)))return dn[e.parentLocale]||(dn[e.parentLocale]=[]),dn[e.parentLocale].push({name:t,config:e}),null;i=n._config}return un[t]=new N(O(i,e)),dn[t]&&dn[t].forEach((function(t){mn(t.name,t.config)})),gn(t),un[t]}return delete un[t],null}function vn(t,e){if(null!=e){var n,i,r=ln;null!=un[t]&&null!=un[t].parentLocale?un[t].set(O(un[t]._config,e)):(null!=(i=pn(t))&&(r=i._config),e=O(r,e),null==i&&(e.abbr=t),(n=new N(e)).parentLocale=un[t],un[t]=n),gn(t)}else null!=un[t]&&(null!=un[t].parentLocale?(un[t]=un[t].parentLocale,t===gn()&&gn(t)):null!=un[t]&&delete un[t]);return un[t]}function yn(t){var e;if(t&&t._locale&&t._locale._abbr&&(t=t._locale._abbr),!t)return sn;if(!a(t)){if(e=pn(t))return e;t=[t]}return fn(t)}function bn(){return D(un)}function _n(t){var e,n=t._a;return n&&-2===m(t).overflow&&(e=n[jt]<0||n[jt]>11?jt:n[qt]<1||n[qt]>te(n[Ut],n[jt])?qt:n[Gt]<0||n[Gt]>24||24===n[Gt]&&(0!==n[$t]||0!==n[Zt]||0!==n[Xt])?Gt:n[$t]<0||n[$t]>59?$t:n[Zt]<0||n[Zt]>59?Zt:n[Xt]<0||n[Xt]>999?Xt:-1,m(t)._overflowDayOfYear&&(eqt)&&(e=qt),m(t)._overflowWeeks&&-1===e&&(e=Jt),m(t)._overflowWeekday&&-1===e&&(e=Kt),m(t).overflow=e),t}var xn=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,wn=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,kn=/Z|[+-]\d\d(?::?\d\d)?/,Sn=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],Mn=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],Dn=/^\/?Date\((-?\d+)/i,Cn=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,Pn={UT:0,GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function Tn(t){var e,n,i,r,a,o,s=t._i,l=xn.exec(s)||wn.exec(s);if(l){for(m(t).iso=!0,e=0,n=Sn.length;eme(a)||0===t._dayOfYear)&&(m(t)._overflowDayOfYear=!0),n=_e(a,0,t._dayOfYear),t._a[jt]=n.getUTCMonth(),t._a[qt]=n.getUTCDate()),e=0;e<3&&null==t._a[e];++e)t._a[e]=o[e]=i[e];for(;e<7;e++)t._a[e]=o[e]=null==t._a[e]?2===e?1:0:t._a[e];24===t._a[Gt]&&0===t._a[$t]&&0===t._a[Zt]&&0===t._a[Xt]&&(t._nextDay=!0,t._a[Gt]=0),t._d=(t._useUTC?_e:be).apply(null,o),r=t._useUTC?t._d.getUTCDay():t._d.getDay(),null!=t._tzm&&t._d.setUTCMinutes(t._d.getUTCMinutes()-t._tzm),t._nextDay&&(t._a[Gt]=24),t._w&&void 0!==t._w.d&&t._w.d!==r&&(m(t).weekdayMismatch=!0)}}function Vn(t){var e,n,i,r,a,o,s,l,u;null!=(e=t._w).GG||null!=e.W||null!=e.E?(a=1,o=4,n=En(e.GG,t._a[Ut],ke(Zn(),1,4).year),i=En(e.W,1),((r=En(e.E,1))<1||r>7)&&(l=!0)):(a=t._locale._week.dow,o=t._locale._week.doy,u=ke(Zn(),a,o),n=En(e.gg,t._a[Ut],u.year),i=En(e.w,u.week),null!=e.d?((r=e.d)<0||r>6)&&(l=!0):null!=e.e?(r=e.e+a,(e.e<0||e.e>6)&&(l=!0)):r=a),i<1||i>Se(n,a,o)?m(t)._overflowWeeks=!0:null!=l?m(t)._overflowWeekday=!0:(s=we(n,i,r,a,o),t._a[Ut]=s.year,t._dayOfYear=s.dayOfYear)}function zn(t){if(t._f!==i.ISO_8601)if(t._f!==i.RFC_2822){t._a=[],m(t).empty=!0;var e,n,r,a,o,s,l=""+t._i,u=l.length,d=0;for(r=U(t._f,t._locale).match(L)||[],e=0;e0&&m(t).unusedInput.push(o),l=l.slice(l.indexOf(n)+n.length),d+=n.length),Y[a]?(n?m(t).empty=!1:m(t).unusedTokens.push(a),Bt(a,n,t)):t._strict&&!n&&m(t).unusedTokens.push(a);m(t).charsLeftOver=u-d,l.length>0&&m(t).unusedInput.push(l),t._a[Gt]<=12&&!0===m(t).bigHour&&t._a[Gt]>0&&(m(t).bigHour=void 0),m(t).parsedDateParts=t._a.slice(0),m(t).meridiem=t._meridiem,t._a[Gt]=Bn(t._locale,t._a[Gt],t._meridiem),null!==(s=m(t).era)&&(t._a[Ut]=t._locale.erasConvertYear(s,t._a[Ut])),Yn(t),_n(t)}else Rn(t);else Tn(t)}function Bn(t,e,n){var i;return null==n?e:null!=t.meridiemHour?t.meridiemHour(e,n):null!=t.isPM?((i=t.isPM(n))&&e<12&&(e+=12),i||12!==e||(e=0),e):e}function Hn(t){var e,n,i,r,a,o,s=!1;if(0===t._f.length)return m(t).invalidFormat=!0,void(t._d=new Date(NaN));for(r=0;rthis?this:t:y()}));function Kn(t,e){var n,i;if(1===e.length&&a(e[0])&&(e=e[0]),!e.length)return Zn();for(n=e[0],i=1;ithis.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function wi(){if(!u(this._isDSTShifted))return this._isDSTShifted;var t,e={};return x(e,this),(e=qn(e))._a?(t=e._isUTC?p(e._a):Zn(e._a),this._isDSTShifted=this.isValid()&&ui(e._a,t.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function ki(){return!!this.isValid()&&!this._isUTC}function Si(){return!!this.isValid()&&this._isUTC}function Mi(){return!!this.isValid()&&this._isUTC&&0===this._offset}i.updateOffset=function(){};var Di=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,Ci=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function Pi(t,e){var n,i,r,a=t,o=null;return si(t)?a={ms:t._milliseconds,d:t._days,M:t._months}:d(t)||!isNaN(+t)?(a={},e?a[e]=+t:a.milliseconds=+t):(o=Di.exec(t))?(n="-"===o[1]?-1:1,a={y:0,d:ct(o[qt])*n,h:ct(o[Gt])*n,m:ct(o[$t])*n,s:ct(o[Zt])*n,ms:ct(li(1e3*o[Xt]))*n}):(o=Ci.exec(t))?(n="-"===o[1]?-1:1,a={y:Ti(o[2],n),M:Ti(o[3],n),w:Ti(o[4],n),d:Ti(o[5],n),h:Ti(o[6],n),m:Ti(o[7],n),s:Ti(o[8],n)}):null==a?a={}:"object"==typeof a&&("from"in a||"to"in a)&&(r=Oi(Zn(a.from),Zn(a.to)),(a={}).ms=r.milliseconds,a.M=r.months),i=new oi(a),si(t)&&s(t,"_locale")&&(i._locale=t._locale),si(t)&&s(t,"_isValid")&&(i._isValid=t._isValid),i}function Ti(t,e){var n=t&&parseFloat(t.replace(",","."));return(isNaN(n)?0:n)*e}function Ai(t,e){var n={};return n.months=e.month()-t.month()+12*(e.year()-t.year()),t.clone().add(n.months,"M").isAfter(e)&&--n.months,n.milliseconds=+e-+t.clone().add(n.months,"M"),n}function Oi(t,e){var n;return t.isValid()&&e.isValid()?(e=fi(e,t),t.isBefore(e)?n=Ai(t,e):((n=Ai(e,t)).milliseconds=-n.milliseconds,n.months=-n.months),n):{milliseconds:0,months:0}}function Ni(t,e){return function(n,i){var r;return null===i||isNaN(+i)||(P(e,"moment()."+e+"(period, number) is deprecated. Please use moment()."+e+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),r=n,n=i,i=r),Fi(this,Pi(n,i),t),this}}function Fi(t,e,n,r){var a=e._milliseconds,o=li(e._days),s=li(e._months);t.isValid()&&(r=null==r||r,s&&de(t,ft(t,"Month")+s*n),o&&pt(t,"Date",ft(t,"Date")+o*n),a&&t._d.setTime(t._d.valueOf()+a*n),r&&i.updateOffset(t,o||s))}Pi.fn=oi.prototype,Pi.invalid=ai;var Ii=Ni(1,"add"),Ri=Ni(-1,"subtract");function Li(t){return"string"==typeof t||t instanceof String}function Ei(t){return k(t)||c(t)||Li(t)||d(t)||Yi(t)||Wi(t)||null==t}function Wi(t){var e,n,i=o(t)&&!l(t),r=!1,a=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"];for(e=0;en.valueOf():n.valueOf()9999?H(n,e?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):T(Date.prototype.toISOString)?e?this.toDate().toISOString():new Date(this.valueOf()+60*this.utcOffset()*1e3).toISOString().replace("Z",H(n,"Z")):H(n,e?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function tr(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var t,e,n,i,r="moment",a="";return this.isLocal()||(r=0===this.utcOffset()?"moment.utc":"moment.parseZone",a="Z"),t="["+r+'("]',e=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",n="-MM-DD[T]HH:mm:ss.SSS",i=a+'[")]',this.format(t+e+n+i)}function er(t){t||(t=this.isUtc()?i.defaultFormatUtc:i.defaultFormat);var e=H(this,t);return this.localeData().postformat(e)}function nr(t,e){return this.isValid()&&(k(t)&&t.isValid()||Zn(t).isValid())?Pi({to:this,from:t}).locale(this.locale()).humanize(!e):this.localeData().invalidDate()}function ir(t){return this.from(Zn(),t)}function rr(t,e){return this.isValid()&&(k(t)&&t.isValid()||Zn(t).isValid())?Pi({from:this,to:t}).locale(this.locale()).humanize(!e):this.localeData().invalidDate()}function ar(t){return this.to(Zn(),t)}function or(t){var e;return void 0===t?this._locale._abbr:(null!=(e=yn(t))&&(this._locale=e),this)}i.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",i.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var sr=M("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",(function(t){return void 0===t?this.localeData():this.locale(t)}));function lr(){return this._locale}var ur=1e3,dr=60*ur,cr=60*dr,hr=3506328*cr;function fr(t,e){return(t%e+e)%e}function pr(t,e,n){return t<100&&t>=0?new Date(t+400,e,n)-hr:new Date(t,e,n).valueOf()}function gr(t,e,n){return t<100&&t>=0?Date.UTC(t+400,e,n)-hr:Date.UTC(t,e,n)}function mr(t){var e,n;if(void 0===(t=rt(t))||"millisecond"===t||!this.isValid())return this;switch(n=this._isUTC?gr:pr,t){case"year":e=n(this.year(),0,1);break;case"quarter":e=n(this.year(),this.month()-this.month()%3,1);break;case"month":e=n(this.year(),this.month(),1);break;case"week":e=n(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":e=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":e=n(this.year(),this.month(),this.date());break;case"hour":e=this._d.valueOf(),e-=fr(e+(this._isUTC?0:this.utcOffset()*dr),cr);break;case"minute":e=this._d.valueOf(),e-=fr(e,dr);break;case"second":e=this._d.valueOf(),e-=fr(e,ur)}return this._d.setTime(e),i.updateOffset(this,!0),this}function vr(t){var e,n;if(void 0===(t=rt(t))||"millisecond"===t||!this.isValid())return this;switch(n=this._isUTC?gr:pr,t){case"year":e=n(this.year()+1,0,1)-1;break;case"quarter":e=n(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":e=n(this.year(),this.month()+1,1)-1;break;case"week":e=n(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":e=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":e=n(this.year(),this.month(),this.date()+1)-1;break;case"hour":e=this._d.valueOf(),e+=cr-fr(e+(this._isUTC?0:this.utcOffset()*dr),cr)-1;break;case"minute":e=this._d.valueOf(),e+=dr-fr(e,dr)-1;break;case"second":e=this._d.valueOf(),e+=ur-fr(e,ur)-1}return this._d.setTime(e),i.updateOffset(this,!0),this}function yr(){return this._d.valueOf()-6e4*(this._offset||0)}function br(){return Math.floor(this.valueOf()/1e3)}function _r(){return new Date(this.valueOf())}function xr(){var t=this;return[t.year(),t.month(),t.date(),t.hour(),t.minute(),t.second(),t.millisecond()]}function wr(){var t=this;return{years:t.year(),months:t.month(),date:t.date(),hours:t.hours(),minutes:t.minutes(),seconds:t.seconds(),milliseconds:t.milliseconds()}}function kr(){return this.isValid()?this.toISOString():null}function Sr(){return v(this)}function Mr(){return f({},m(this))}function Dr(){return m(this).overflow}function Cr(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}function Pr(t,e){var n,r,a,o=this._eras||yn("en")._eras;for(n=0,r=o.length;n=0)return l[i]}function Ar(t,e){var n=t.since<=t.until?1:-1;return void 0===e?i(t.since).year():i(t.since).year()+(e-t.offset)*n}function Or(){var t,e,n,i=this.localeData().eras();for(t=0,e=i.length;t(a=Se(t,i,r))&&(e=a),Jr.call(this,t,e,n,i,r))}function Jr(t,e,n,i,r){var a=we(t,e,n,i,r),o=_e(a.year,0,a.dayOfYear);return this.year(o.getUTCFullYear()),this.month(o.getUTCMonth()),this.date(o.getUTCDate()),this}function Kr(t){return null==t?Math.ceil((this.month()+1)/3):this.month(3*(t-1)+this.month()%3)}V("N",0,0,"eraAbbr"),V("NN",0,0,"eraAbbr"),V("NNN",0,0,"eraAbbr"),V("NNNN",0,0,"eraName"),V("NNNNN",0,0,"eraNarrow"),V("y",["y",1],"yo","eraYear"),V("y",["yy",2],0,"eraYear"),V("y",["yyy",3],0,"eraYear"),V("y",["yyyy",4],0,"eraYear"),Rt("N",Wr),Rt("NN",Wr),Rt("NNN",Wr),Rt("NNNN",Yr),Rt("NNNNN",Vr),Vt(["N","NN","NNN","NNNN","NNNNN"],(function(t,e,n,i){var r=n._locale.erasParse(t,i,n._strict);r?m(n).era=r:m(n).invalidEra=t})),Rt("y",Tt),Rt("yy",Tt),Rt("yyy",Tt),Rt("yyyy",Tt),Rt("yo",zr),Vt(["y","yy","yyy","yyyy"],Ut),Vt(["yo"],(function(t,e,n,i){var r;n._locale._eraYearOrdinalRegex&&(r=t.match(n._locale._eraYearOrdinalRegex)),n._locale.eraYearOrdinalParse?e[Ut]=n._locale.eraYearOrdinalParse(t,r):e[Ut]=parseInt(t,10)})),V(0,["gg",2],0,(function(){return this.weekYear()%100})),V(0,["GG",2],0,(function(){return this.isoWeekYear()%100})),Hr("gggg","weekYear"),Hr("ggggg","weekYear"),Hr("GGGG","isoWeekYear"),Hr("GGGGG","isoWeekYear"),nt("weekYear","gg"),nt("isoWeekYear","GG"),st("weekYear",1),st("isoWeekYear",1),Rt("G",At),Rt("g",At),Rt("GG",kt,bt),Rt("gg",kt,bt),Rt("GGGG",Ct,xt),Rt("gggg",Ct,xt),Rt("GGGGG",Pt,wt),Rt("ggggg",Pt,wt),zt(["gggg","ggggg","GGGG","GGGGG"],(function(t,e,n,i){e[i.substr(0,2)]=ct(t)})),zt(["gg","GG"],(function(t,e,n,r){e[r]=i.parseTwoDigitYear(t)})),V("Q",0,"Qo","quarter"),nt("quarter","Q"),st("quarter",7),Rt("Q",yt),Vt("Q",(function(t,e){e[jt]=3*(ct(t)-1)})),V("D",["DD",2],"Do","date"),nt("date","D"),st("date",9),Rt("D",kt),Rt("DD",kt,bt),Rt("Do",(function(t,e){return t?e._dayOfMonthOrdinalParse||e._ordinalParse:e._dayOfMonthOrdinalParseLenient})),Vt(["D","DD"],qt),Vt("Do",(function(t,e){e[qt]=ct(t.match(kt)[0])}));var Qr=ht("Date",!0);function ta(t){var e=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==t?e:this.add(t-e,"d")}V("DDD",["DDDD",3],"DDDo","dayOfYear"),nt("dayOfYear","DDD"),st("dayOfYear",4),Rt("DDD",Dt),Rt("DDDD",_t),Vt(["DDD","DDDD"],(function(t,e,n){n._dayOfYear=ct(t)})),V("m",["mm",2],0,"minute"),nt("minute","m"),st("minute",14),Rt("m",kt),Rt("mm",kt,bt),Vt(["m","mm"],$t);var ea=ht("Minutes",!1);V("s",["ss",2],0,"second"),nt("second","s"),st("second",15),Rt("s",kt),Rt("ss",kt,bt),Vt(["s","ss"],Zt);var na,ia,ra=ht("Seconds",!1);for(V("S",0,0,(function(){return~~(this.millisecond()/100)})),V(0,["SS",2],0,(function(){return~~(this.millisecond()/10)})),V(0,["SSS",3],0,"millisecond"),V(0,["SSSS",4],0,(function(){return 10*this.millisecond()})),V(0,["SSSSS",5],0,(function(){return 100*this.millisecond()})),V(0,["SSSSSS",6],0,(function(){return 1e3*this.millisecond()})),V(0,["SSSSSSS",7],0,(function(){return 1e4*this.millisecond()})),V(0,["SSSSSSSS",8],0,(function(){return 1e5*this.millisecond()})),V(0,["SSSSSSSSS",9],0,(function(){return 1e6*this.millisecond()})),nt("millisecond","ms"),st("millisecond",16),Rt("S",Dt,yt),Rt("SS",Dt,bt),Rt("SSS",Dt,_t),na="SSSS";na.length<=9;na+="S")Rt(na,Tt);function aa(t,e){e[Xt]=ct(1e3*("0."+t))}for(na="S";na.length<=9;na+="S")Vt(na,aa);function oa(){return this._isUTC?"UTC":""}function sa(){return this._isUTC?"Coordinated Universal Time":""}ia=ht("Milliseconds",!1),V("z",0,0,"zoneAbbr"),V("zz",0,0,"zoneName");var la=w.prototype;function ua(t){return Zn(1e3*t)}function da(){return Zn.apply(null,arguments).parseZone()}function ca(t){return t}la.add=Ii,la.calendar=Bi,la.clone=Hi,la.diff=Xi,la.endOf=vr,la.format=er,la.from=nr,la.fromNow=ir,la.to=rr,la.toNow=ar,la.get=gt,la.invalidAt=Dr,la.isAfter=Ui,la.isBefore=ji,la.isBetween=qi,la.isSame=Gi,la.isSameOrAfter=$i,la.isSameOrBefore=Zi,la.isValid=Sr,la.lang=sr,la.locale=or,la.localeData=lr,la.max=Jn,la.min=Xn,la.parsingFlags=Mr,la.set=mt,la.startOf=mr,la.subtract=Ri,la.toArray=xr,la.toObject=wr,la.toDate=_r,la.toISOString=Qi,la.inspect=tr,"undefined"!=typeof Symbol&&null!=Symbol.for&&(la[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),la.toJSON=kr,la.toString=Ki,la.unix=br,la.valueOf=yr,la.creationData=Cr,la.eraName=Or,la.eraNarrow=Nr,la.eraAbbr=Fr,la.eraYear=Ir,la.year=ve,la.isLeapYear=ye,la.weekYear=Ur,la.isoWeekYear=jr,la.quarter=la.quarters=Kr,la.month=ce,la.daysInMonth=he,la.week=la.weeks=Te,la.isoWeek=la.isoWeeks=Ae,la.weeksInYear=$r,la.weeksInWeekYear=Zr,la.isoWeeksInYear=qr,la.isoWeeksInISOWeekYear=Gr,la.date=Qr,la.day=la.days=je,la.weekday=qe,la.isoWeekday=Ge,la.dayOfYear=ta,la.hour=la.hours=an,la.minute=la.minutes=ea,la.second=la.seconds=ra,la.millisecond=la.milliseconds=ia,la.utcOffset=gi,la.utc=vi,la.local=yi,la.parseZone=bi,la.hasAlignedHourOffset=_i,la.isDST=xi,la.isLocal=ki,la.isUtcOffset=Si,la.isUtc=Mi,la.isUTC=Mi,la.zoneAbbr=oa,la.zoneName=sa,la.dates=M("dates accessor is deprecated. Use date instead.",Qr),la.months=M("months accessor is deprecated. Use month instead",ce),la.years=M("years accessor is deprecated. Use year instead",ve),la.zone=M("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",mi),la.isDSTShifted=M("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",wi);var ha=N.prototype;function fa(t,e,n,i){var r=yn(),a=p().set(i,e);return r[n](a,t)}function pa(t,e,n){if(d(t)&&(e=t,t=void 0),t=t||"",null!=e)return fa(t,e,n,"month");var i,r=[];for(i=0;i<12;i++)r[i]=fa(t,i,n,"month");return r}function ga(t,e,n,i){"boolean"==typeof t?(d(e)&&(n=e,e=void 0),e=e||""):(n=e=t,t=!1,d(e)&&(n=e,e=void 0),e=e||"");var r,a=yn(),o=t?a._week.dow:0,s=[];if(null!=n)return fa(e,(n+o)%7,i,"day");for(r=0;r<7;r++)s[r]=fa(e,(r+o)%7,i,"day");return s}function ma(t,e){return pa(t,e,"months")}function va(t,e){return pa(t,e,"monthsShort")}function ya(t,e,n){return ga(t,e,n,"weekdays")}function ba(t,e,n){return ga(t,e,n,"weekdaysShort")}function _a(t,e,n){return ga(t,e,n,"weekdaysMin")}ha.calendar=I,ha.longDateFormat=q,ha.invalidDate=$,ha.ordinal=J,ha.preparse=ca,ha.postformat=ca,ha.relativeTime=Q,ha.pastFuture=tt,ha.set=A,ha.eras=Pr,ha.erasParse=Tr,ha.erasConvertYear=Ar,ha.erasAbbrRegex=Lr,ha.erasNameRegex=Rr,ha.erasNarrowRegex=Er,ha.months=oe,ha.monthsShort=se,ha.monthsParse=ue,ha.monthsRegex=pe,ha.monthsShortRegex=fe,ha.week=Me,ha.firstDayOfYear=Pe,ha.firstDayOfWeek=Ce,ha.weekdays=Ve,ha.weekdaysMin=Be,ha.weekdaysShort=ze,ha.weekdaysParse=Ue,ha.weekdaysRegex=$e,ha.weekdaysShortRegex=Ze,ha.weekdaysMinRegex=Xe,ha.isPM=nn,ha.meridiem=on,gn("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(t){var e=t%10;return t+(1===ct(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th")}}),i.lang=M("moment.lang is deprecated. Use moment.locale instead.",gn),i.langData=M("moment.langData is deprecated. Use moment.localeData instead.",yn);var xa=Math.abs;function wa(){var t=this._data;return this._milliseconds=xa(this._milliseconds),this._days=xa(this._days),this._months=xa(this._months),t.milliseconds=xa(t.milliseconds),t.seconds=xa(t.seconds),t.minutes=xa(t.minutes),t.hours=xa(t.hours),t.months=xa(t.months),t.years=xa(t.years),this}function ka(t,e,n,i){var r=Pi(e,n);return t._milliseconds+=i*r._milliseconds,t._days+=i*r._days,t._months+=i*r._months,t._bubble()}function Sa(t,e){return ka(this,t,e,1)}function Ma(t,e){return ka(this,t,e,-1)}function Da(t){return t<0?Math.floor(t):Math.ceil(t)}function Ca(){var t,e,n,i,r,a=this._milliseconds,o=this._days,s=this._months,l=this._data;return a>=0&&o>=0&&s>=0||a<=0&&o<=0&&s<=0||(a+=864e5*Da(Ta(s)+o),o=0,s=0),l.milliseconds=a%1e3,t=dt(a/1e3),l.seconds=t%60,e=dt(t/60),l.minutes=e%60,n=dt(e/60),l.hours=n%24,o+=dt(n/24),s+=r=dt(Pa(o)),o-=Da(Ta(r)),i=dt(s/12),s%=12,l.days=o,l.months=s,l.years=i,this}function Pa(t){return 4800*t/146097}function Ta(t){return 146097*t/4800}function Aa(t){if(!this.isValid())return NaN;var e,n,i=this._milliseconds;if("month"===(t=rt(t))||"quarter"===t||"year"===t)switch(e=this._days+i/864e5,n=this._months+Pa(e),t){case"month":return n;case"quarter":return n/3;case"year":return n/12}else switch(e=this._days+Math.round(Ta(this._months)),t){case"week":return e/7+i/6048e5;case"day":return e+i/864e5;case"hour":return 24*e+i/36e5;case"minute":return 1440*e+i/6e4;case"second":return 86400*e+i/1e3;case"millisecond":return Math.floor(864e5*e)+i;default:throw new Error("Unknown unit "+t)}}function Oa(){return this.isValid()?this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*ct(this._months/12):NaN}function Na(t){return function(){return this.as(t)}}var Fa=Na("ms"),Ia=Na("s"),Ra=Na("m"),La=Na("h"),Ea=Na("d"),Wa=Na("w"),Ya=Na("M"),Va=Na("Q"),za=Na("y");function Ba(){return Pi(this)}function Ha(t){return t=rt(t),this.isValid()?this[t+"s"]():NaN}function Ua(t){return function(){return this.isValid()?this._data[t]:NaN}}var ja=Ua("milliseconds"),qa=Ua("seconds"),Ga=Ua("minutes"),$a=Ua("hours"),Za=Ua("days"),Xa=Ua("months"),Ja=Ua("years");function Ka(){return dt(this.days()/7)}var Qa=Math.round,to={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function eo(t,e,n,i,r){return r.relativeTime(e||1,!!n,t,i)}function no(t,e,n,i){var r=Pi(t).abs(),a=Qa(r.as("s")),o=Qa(r.as("m")),s=Qa(r.as("h")),l=Qa(r.as("d")),u=Qa(r.as("M")),d=Qa(r.as("w")),c=Qa(r.as("y")),h=a<=n.ss&&["s",a]||a0,h[4]=i,eo.apply(null,h)}function io(t){return void 0===t?Qa:"function"==typeof t&&(Qa=t,!0)}function ro(t,e){return void 0!==to[t]&&(void 0===e?to[t]:(to[t]=e,"s"===t&&(to.ss=e-1),!0))}function ao(t,e){if(!this.isValid())return this.localeData().invalidDate();var n,i,r=!1,a=to;return"object"==typeof t&&(e=t,t=!1),"boolean"==typeof t&&(r=t),"object"==typeof e&&(a=Object.assign({},to,e),null!=e.s&&null==e.ss&&(a.ss=e.s-1)),i=no(this,!r,a,n=this.localeData()),r&&(i=n.pastFuture(+this,i)),n.postformat(i)}var oo=Math.abs;function so(t){return(t>0)-(t<0)||+t}function lo(){if(!this.isValid())return this.localeData().invalidDate();var t,e,n,i,r,a,o,s,l=oo(this._milliseconds)/1e3,u=oo(this._days),d=oo(this._months),c=this.asSeconds();return c?(t=dt(l/60),e=dt(t/60),l%=60,t%=60,n=dt(d/12),d%=12,i=l?l.toFixed(3).replace(/\.?0+$/,""):"",r=c<0?"-":"",a=so(this._months)!==so(c)?"-":"",o=so(this._days)!==so(c)?"-":"",s=so(this._milliseconds)!==so(c)?"-":"",r+"P"+(n?a+n+"Y":"")+(d?a+d+"M":"")+(u?o+u+"D":"")+(e||t||l?"T":"")+(e?s+e+"H":"")+(t?s+t+"M":"")+(l?s+i+"S":"")):"P0D"}var uo=oi.prototype;return uo.isValid=ri,uo.abs=wa,uo.add=Sa,uo.subtract=Ma,uo.as=Aa,uo.asMilliseconds=Fa,uo.asSeconds=Ia,uo.asMinutes=Ra,uo.asHours=La,uo.asDays=Ea,uo.asWeeks=Wa,uo.asMonths=Ya,uo.asQuarters=Va,uo.asYears=za,uo.valueOf=Oa,uo._bubble=Ca,uo.clone=Ba,uo.get=Ha,uo.milliseconds=ja,uo.seconds=qa,uo.minutes=Ga,uo.hours=$a,uo.days=Za,uo.weeks=Ka,uo.months=Xa,uo.years=Ja,uo.humanize=ao,uo.toISOString=lo,uo.toString=lo,uo.toJSON=lo,uo.locale=or,uo.localeData=lr,uo.toIsoString=M("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",lo),uo.lang=sr,V("X",0,0,"unix"),V("x",0,0,"valueOf"),Rt("x",At),Rt("X",Ft),Vt("X",(function(t,e,n){n._d=new Date(1e3*parseFloat(t))})),Vt("x",(function(t,e,n){n._d=new Date(ct(t))})), +//! moment.js +i.version="2.29.1",r(Zn),i.fn=la,i.min=Qn,i.max=ti,i.now=ei,i.utc=p,i.unix=ua,i.months=ma,i.isDate=c,i.locale=gn,i.invalid=y,i.duration=Pi,i.isMoment=k,i.weekdays=ya,i.parseZone=da,i.localeData=yn,i.isDuration=si,i.monthsShort=va,i.weekdaysMin=_a,i.defineLocale=mn,i.updateLocale=vn,i.locales=bn,i.weekdaysShort=ba,i.normalizeUnits=rt,i.relativeTimeRounding=io,i.relativeTimeThreshold=ro,i.calendarFormat=zi,i.prototype=la,i.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},i}()})),ot=rt((function(t,e){ +/*! + * Chart.js v2.9.4 + * https://www.chartjs.org + * (c) 2020 Chart.js Contributors + * Released under the MIT License + */ +t.exports=function(t){function e(t,e){return t(e={exports:{}},e.exports),e.exports}function n(t){return t&&t.default||t}t=t&&t.hasOwnProperty("default")?t.default:t;var i={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},r=e((function(t){var e={};for(var n in i)i.hasOwnProperty(n)&&(e[i[n]]=n);var r=t.exports={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};for(var a in r)if(r.hasOwnProperty(a)){if(!("channels"in r[a]))throw new Error("missing channels property: "+a);if(!("labels"in r[a]))throw new Error("missing channel labels property: "+a);if(r[a].labels.length!==r[a].channels)throw new Error("channel and label counts mismatch: "+a);var o=r[a].channels,s=r[a].labels;delete r[a].channels,delete r[a].labels,Object.defineProperty(r[a],"channels",{value:o}),Object.defineProperty(r[a],"labels",{value:s})}function l(t,e){return Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2)+Math.pow(t[2]-e[2],2)}r.rgb.hsl=function(t){var e,n,i=t[0]/255,r=t[1]/255,a=t[2]/255,o=Math.min(i,r,a),s=Math.max(i,r,a),l=s-o;return s===o?e=0:i===s?e=(r-a)/l:r===s?e=2+(a-i)/l:a===s&&(e=4+(i-r)/l),(e=Math.min(60*e,360))<0&&(e+=360),n=(o+s)/2,[e,100*(s===o?0:n<=.5?l/(s+o):l/(2-s-o)),100*n]},r.rgb.hsv=function(t){var e,n,i,r,a,o=t[0]/255,s=t[1]/255,l=t[2]/255,u=Math.max(o,s,l),d=u-Math.min(o,s,l),c=function(t){return(u-t)/6/d+.5};return 0===d?r=a=0:(a=d/u,e=c(o),n=c(s),i=c(l),o===u?r=i-n:s===u?r=1/3+e-i:l===u&&(r=2/3+n-e),r<0?r+=1:r>1&&(r-=1)),[360*r,100*a,100*u]},r.rgb.hwb=function(t){var e=t[0],n=t[1],i=t[2];return[r.rgb.hsl(t)[0],1/255*Math.min(e,Math.min(n,i))*100,100*(i=1-1/255*Math.max(e,Math.max(n,i)))]},r.rgb.cmyk=function(t){var e,n=t[0]/255,i=t[1]/255,r=t[2]/255;return[100*((1-n-(e=Math.min(1-n,1-i,1-r)))/(1-e)||0),100*((1-i-e)/(1-e)||0),100*((1-r-e)/(1-e)||0),100*e]},r.rgb.keyword=function(t){var n=e[t];if(n)return n;var r,a=1/0;for(var o in i)if(i.hasOwnProperty(o)){var s=l(t,i[o]);s.04045?Math.pow((e+.055)/1.055,2.4):e/12.92)+.3576*(n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92)+.1805*(i=i>.04045?Math.pow((i+.055)/1.055,2.4):i/12.92)),100*(.2126*e+.7152*n+.0722*i),100*(.0193*e+.1192*n+.9505*i)]},r.rgb.lab=function(t){var e=r.rgb.xyz(t),n=e[0],i=e[1],a=e[2];return i/=100,a/=108.883,n=(n/=95.047)>.008856?Math.pow(n,1/3):7.787*n+16/116,[116*(i=i>.008856?Math.pow(i,1/3):7.787*i+16/116)-16,500*(n-i),200*(i-(a=a>.008856?Math.pow(a,1/3):7.787*a+16/116))]},r.hsl.rgb=function(t){var e,n,i,r,a,o=t[0]/360,s=t[1]/100,l=t[2]/100;if(0===s)return[a=255*l,a,a];e=2*l-(n=l<.5?l*(1+s):l+s-l*s),r=[0,0,0];for(var u=0;u<3;u++)(i=o+1/3*-(u-1))<0&&i++,i>1&&i--,a=6*i<1?e+6*(n-e)*i:2*i<1?n:3*i<2?e+(n-e)*(2/3-i)*6:e,r[u]=255*a;return r},r.hsl.hsv=function(t){var e=t[0],n=t[1]/100,i=t[2]/100,r=n,a=Math.max(i,.01);return n*=(i*=2)<=1?i:2-i,r*=a<=1?a:2-a,[e,100*(0===i?2*r/(a+r):2*n/(i+n)),(i+n)/2*100]},r.hsv.rgb=function(t){var e=t[0]/60,n=t[1]/100,i=t[2]/100,r=Math.floor(e)%6,a=e-Math.floor(e),o=255*i*(1-n),s=255*i*(1-n*a),l=255*i*(1-n*(1-a));switch(i*=255,r){case 0:return[i,l,o];case 1:return[s,i,o];case 2:return[o,i,l];case 3:return[o,s,i];case 4:return[l,o,i];case 5:return[i,o,s]}},r.hsv.hsl=function(t){var e,n,i,r=t[0],a=t[1]/100,o=t[2]/100,s=Math.max(o,.01);return i=(2-a)*o,n=a*s,[r,100*(n=(n/=(e=(2-a)*s)<=1?e:2-e)||0),100*(i/=2)]},r.hwb.rgb=function(t){var e,n,i,r,a,o,s,l=t[0]/360,u=t[1]/100,d=t[2]/100,c=u+d;switch(c>1&&(u/=c,d/=c),i=6*l-(e=Math.floor(6*l)),0!=(1&e)&&(i=1-i),r=u+i*((n=1-d)-u),e){default:case 6:case 0:a=n,o=r,s=u;break;case 1:a=r,o=n,s=u;break;case 2:a=u,o=n,s=r;break;case 3:a=u,o=r,s=n;break;case 4:a=r,o=u,s=n;break;case 5:a=n,o=u,s=r}return[255*a,255*o,255*s]},r.cmyk.rgb=function(t){var e=t[0]/100,n=t[1]/100,i=t[2]/100,r=t[3]/100;return[255*(1-Math.min(1,e*(1-r)+r)),255*(1-Math.min(1,n*(1-r)+r)),255*(1-Math.min(1,i*(1-r)+r))]},r.xyz.rgb=function(t){var e,n,i,r=t[0]/100,a=t[1]/100,o=t[2]/100;return n=-.9689*r+1.8758*a+.0415*o,i=.0557*r+-.204*a+1.057*o,e=(e=3.2406*r+-1.5372*a+-.4986*o)>.0031308?1.055*Math.pow(e,1/2.4)-.055:12.92*e,n=n>.0031308?1.055*Math.pow(n,1/2.4)-.055:12.92*n,i=i>.0031308?1.055*Math.pow(i,1/2.4)-.055:12.92*i,[255*(e=Math.min(Math.max(0,e),1)),255*(n=Math.min(Math.max(0,n),1)),255*(i=Math.min(Math.max(0,i),1))]},r.xyz.lab=function(t){var e=t[0],n=t[1],i=t[2];return n/=100,i/=108.883,e=(e/=95.047)>.008856?Math.pow(e,1/3):7.787*e+16/116,[116*(n=n>.008856?Math.pow(n,1/3):7.787*n+16/116)-16,500*(e-n),200*(n-(i=i>.008856?Math.pow(i,1/3):7.787*i+16/116))]},r.lab.xyz=function(t){var e,n,i,r=t[0];e=t[1]/500+(n=(r+16)/116),i=n-t[2]/200;var a=Math.pow(n,3),o=Math.pow(e,3),s=Math.pow(i,3);return n=a>.008856?a:(n-16/116)/7.787,e=o>.008856?o:(e-16/116)/7.787,i=s>.008856?s:(i-16/116)/7.787,[e*=95.047,n*=100,i*=108.883]},r.lab.lch=function(t){var e,n=t[0],i=t[1],r=t[2];return(e=360*Math.atan2(r,i)/2/Math.PI)<0&&(e+=360),[n,Math.sqrt(i*i+r*r),e]},r.lch.lab=function(t){var e,n=t[0],i=t[1];return e=t[2]/360*2*Math.PI,[n,i*Math.cos(e),i*Math.sin(e)]},r.rgb.ansi16=function(t){var e=t[0],n=t[1],i=t[2],a=1 in arguments?arguments[1]:r.rgb.hsv(t)[2];if(0===(a=Math.round(a/50)))return 30;var o=30+(Math.round(i/255)<<2|Math.round(n/255)<<1|Math.round(e/255));return 2===a&&(o+=60),o},r.hsv.ansi16=function(t){return r.rgb.ansi16(r.hsv.rgb(t),t[2])},r.rgb.ansi256=function(t){var e=t[0],n=t[1],i=t[2];return e===n&&n===i?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(n/255*5)+Math.round(i/255*5)},r.ansi16.rgb=function(t){var e=t%10;if(0===e||7===e)return t>50&&(e+=3.5),[e=e/10.5*255,e,e];var n=.5*(1+~~(t>50));return[(1&e)*n*255,(e>>1&1)*n*255,(e>>2&1)*n*255]},r.ansi256.rgb=function(t){if(t>=232){var e=10*(t-232)+8;return[e,e,e]}var n;return t-=16,[Math.floor(t/36)/5*255,Math.floor((n=t%36)/6)/5*255,n%6/5*255]},r.rgb.hex=function(t){var e=(((255&Math.round(t[0]))<<16)+((255&Math.round(t[1]))<<8)+(255&Math.round(t[2]))).toString(16).toUpperCase();return"000000".substring(e.length)+e},r.hex.rgb=function(t){var e=t.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];var n=e[0];3===e[0].length&&(n=n.split("").map((function(t){return t+t})).join(""));var i=parseInt(n,16);return[i>>16&255,i>>8&255,255&i]},r.rgb.hcg=function(t){var e,n=t[0]/255,i=t[1]/255,r=t[2]/255,a=Math.max(Math.max(n,i),r),o=Math.min(Math.min(n,i),r),s=a-o;return e=s<=0?0:a===n?(i-r)/s%6:a===i?2+(r-n)/s:4+(n-i)/s+4,e/=6,[360*(e%=1),100*s,100*(s<1?o/(1-s):0)]},r.hsl.hcg=function(t){var e=t[1]/100,n=t[2]/100,i=1,r=0;return(i=n<.5?2*e*n:2*e*(1-n))<1&&(r=(n-.5*i)/(1-i)),[t[0],100*i,100*r]},r.hsv.hcg=function(t){var e=t[1]/100,n=t[2]/100,i=e*n,r=0;return i<1&&(r=(n-i)/(1-i)),[t[0],100*i,100*r]},r.hcg.rgb=function(t){var e=t[0]/360,n=t[1]/100,i=t[2]/100;if(0===n)return[255*i,255*i,255*i];var r=[0,0,0],a=e%1*6,o=a%1,s=1-o,l=0;switch(Math.floor(a)){case 0:r[0]=1,r[1]=o,r[2]=0;break;case 1:r[0]=s,r[1]=1,r[2]=0;break;case 2:r[0]=0,r[1]=1,r[2]=o;break;case 3:r[0]=0,r[1]=s,r[2]=1;break;case 4:r[0]=o,r[1]=0,r[2]=1;break;default:r[0]=1,r[1]=0,r[2]=s}return l=(1-n)*i,[255*(n*r[0]+l),255*(n*r[1]+l),255*(n*r[2]+l)]},r.hcg.hsv=function(t){var e=t[1]/100,n=e+t[2]/100*(1-e),i=0;return n>0&&(i=e/n),[t[0],100*i,100*n]},r.hcg.hsl=function(t){var e=t[1]/100,n=t[2]/100*(1-e)+.5*e,i=0;return n>0&&n<.5?i=e/(2*n):n>=.5&&n<1&&(i=e/(2*(1-n))),[t[0],100*i,100*n]},r.hcg.hwb=function(t){var e=t[1]/100,n=e+t[2]/100*(1-e);return[t[0],100*(n-e),100*(1-n)]},r.hwb.hcg=function(t){var e=t[1]/100,n=1-t[2]/100,i=n-e,r=0;return i<1&&(r=(n-i)/(1-i)),[t[0],100*i,100*r]},r.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]},r.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]},r.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]},r.gray.hsl=r.gray.hsv=function(t){return[0,0,t[0]]},r.gray.hwb=function(t){return[0,100,t[0]]},r.gray.cmyk=function(t){return[0,0,0,t[0]]},r.gray.lab=function(t){return[t[0],0,0]},r.gray.hex=function(t){var e=255&Math.round(t[0]/100*255),n=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".substring(n.length)+n},r.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]}}));function a(){for(var t={},e=Object.keys(r),n=e.length,i=0;i1&&(e=Array.prototype.slice.call(arguments)),t(e))};return"conversion"in t&&(e.conversion=t.conversion),e}function h(t){var e=function(e){if(null==e)return e;arguments.length>1&&(e=Array.prototype.slice.call(arguments));var n=t(e);if("object"==typeof n)for(var i=n.length,r=0;r=0&&e<1?N(Math.round(255*e)):"")}function k(t,e){return e<1||t[3]&&t[3]<1?S(t,e):"rgb("+t[0]+", "+t[1]+", "+t[2]+")"}function S(t,e){return void 0===e&&(e=void 0!==t[3]?t[3]:1),"rgba("+t[0]+", "+t[1]+", "+t[2]+", "+e+")"}function M(t,e){return e<1||t[3]&&t[3]<1?D(t,e):"rgb("+Math.round(t[0]/255*100)+"%, "+Math.round(t[1]/255*100)+"%, "+Math.round(t[2]/255*100)+"%)"}function D(t,e){return"rgba("+Math.round(t[0]/255*100)+"%, "+Math.round(t[1]/255*100)+"%, "+Math.round(t[2]/255*100)+"%, "+(e||t[3]||1)+")"}function C(t,e){return e<1||t[3]&&t[3]<1?P(t,e):"hsl("+t[0]+", "+t[1]+"%, "+t[2]+"%)"}function P(t,e){return void 0===e&&(e=void 0!==t[3]?t[3]:1),"hsla("+t[0]+", "+t[1]+"%, "+t[2]+"%, "+e+")"}function T(t,e){return void 0===e&&(e=void 0!==t[3]?t[3]:1),"hwb("+t[0]+", "+t[1]+"%, "+t[2]+"%"+(void 0!==e&&1!==e?", "+e:"")+")"}function A(t){return F[t.slice(0,3)]}function O(t,e,n){return Math.min(Math.max(e,t),n)}function N(t){var e=t.toString(16).toUpperCase();return e.length<2?"0"+e:e}var F={};for(var I in p)F[p[I]]=I;var R=function(t){return t instanceof R?t:this instanceof R?(this.valid=!1,this.values={rgb:[0,0,0],hsl:[0,0,0],hsv:[0,0,0],hwb:[0,0,0],cmyk:[0,0,0,0],alpha:1},void("string"==typeof t?(e=g.getRgba(t))?this.setValues("rgb",e):(e=g.getHsla(t))?this.setValues("hsl",e):(e=g.getHwb(t))&&this.setValues("hwb",e):"object"==typeof t&&(void 0!==(e=t).r||void 0!==e.red?this.setValues("rgb",e):void 0!==e.l||void 0!==e.lightness?this.setValues("hsl",e):void 0!==e.v||void 0!==e.value?this.setValues("hsv",e):void 0!==e.w||void 0!==e.whiteness?this.setValues("hwb",e):void 0===e.c&&void 0===e.cyan||this.setValues("cmyk",e)))):new R(t);var e};R.prototype={isValid:function(){return this.valid},rgb:function(){return this.setSpace("rgb",arguments)},hsl:function(){return this.setSpace("hsl",arguments)},hsv:function(){return this.setSpace("hsv",arguments)},hwb:function(){return this.setSpace("hwb",arguments)},cmyk:function(){return this.setSpace("cmyk",arguments)},rgbArray:function(){return this.values.rgb},hslArray:function(){return this.values.hsl},hsvArray:function(){return this.values.hsv},hwbArray:function(){var t=this.values;return 1!==t.alpha?t.hwb.concat([t.alpha]):t.hwb},cmykArray:function(){return this.values.cmyk},rgbaArray:function(){var t=this.values;return t.rgb.concat([t.alpha])},hslaArray:function(){var t=this.values;return t.hsl.concat([t.alpha])},alpha:function(t){return void 0===t?this.values.alpha:(this.setValues("alpha",t),this)},red:function(t){return this.setChannel("rgb",0,t)},green:function(t){return this.setChannel("rgb",1,t)},blue:function(t){return this.setChannel("rgb",2,t)},hue:function(t){return t&&(t=(t%=360)<0?360+t:t),this.setChannel("hsl",0,t)},saturation:function(t){return this.setChannel("hsl",1,t)},lightness:function(t){return this.setChannel("hsl",2,t)},saturationv:function(t){return this.setChannel("hsv",1,t)},whiteness:function(t){return this.setChannel("hwb",1,t)},blackness:function(t){return this.setChannel("hwb",2,t)},value:function(t){return this.setChannel("hsv",2,t)},cyan:function(t){return this.setChannel("cmyk",0,t)},magenta:function(t){return this.setChannel("cmyk",1,t)},yellow:function(t){return this.setChannel("cmyk",2,t)},black:function(t){return this.setChannel("cmyk",3,t)},hexString:function(){return g.hexString(this.values.rgb)},rgbString:function(){return g.rgbString(this.values.rgb,this.values.alpha)},rgbaString:function(){return g.rgbaString(this.values.rgb,this.values.alpha)},percentString:function(){return g.percentString(this.values.rgb,this.values.alpha)},hslString:function(){return g.hslString(this.values.hsl,this.values.alpha)},hslaString:function(){return g.hslaString(this.values.hsl,this.values.alpha)},hwbString:function(){return g.hwbString(this.values.hwb,this.values.alpha)},keyword:function(){return g.keyword(this.values.rgb,this.values.alpha)},rgbNumber:function(){var t=this.values.rgb;return t[0]<<16|t[1]<<8|t[2]},luminosity:function(){for(var t=this.values.rgb,e=[],n=0;nn?(e+.05)/(n+.05):(n+.05)/(e+.05)},level:function(t){var e=this.contrast(t);return e>=7.1?"AAA":e>=4.5?"AA":""},dark:function(){var t=this.values.rgb;return(299*t[0]+587*t[1]+114*t[2])/1e3<128},light:function(){return!this.dark()},negate:function(){for(var t=[],e=0;e<3;e++)t[e]=255-this.values.rgb[e];return this.setValues("rgb",t),this},lighten:function(t){var e=this.values.hsl;return e[2]+=e[2]*t,this.setValues("hsl",e),this},darken:function(t){var e=this.values.hsl;return e[2]-=e[2]*t,this.setValues("hsl",e),this},saturate:function(t){var e=this.values.hsl;return e[1]+=e[1]*t,this.setValues("hsl",e),this},desaturate:function(t){var e=this.values.hsl;return e[1]-=e[1]*t,this.setValues("hsl",e),this},whiten:function(t){var e=this.values.hwb;return e[1]+=e[1]*t,this.setValues("hwb",e),this},blacken:function(t){var e=this.values.hwb;return e[2]+=e[2]*t,this.setValues("hwb",e),this},greyscale:function(){var t=this.values.rgb,e=.3*t[0]+.59*t[1]+.11*t[2];return this.setValues("rgb",[e,e,e]),this},clearer:function(t){var e=this.values.alpha;return this.setValues("alpha",e-e*t),this},opaquer:function(t){var e=this.values.alpha;return this.setValues("alpha",e+e*t),this},rotate:function(t){var e=this.values.hsl,n=(e[0]+t)%360;return e[0]=n<0?360+n:n,this.setValues("hsl",e),this},mix:function(t,e){var n=this,i=t,r=void 0===e?.5:e,a=2*r-1,o=n.alpha()-i.alpha(),s=((a*o==-1?a:(a+o)/(1+a*o))+1)/2,l=1-s;return this.rgb(s*n.red()+l*i.red(),s*n.green()+l*i.green(),s*n.blue()+l*i.blue()).alpha(n.alpha()*r+i.alpha()*(1-r))},toJSON:function(){return this.rgb()},clone:function(){var t,e,n=new R,i=this.values,r=n.values;for(var a in i)i.hasOwnProperty(a)&&(t=i[a],"[object Array]"===(e={}.toString.call(t))?r[a]=t.slice(0):"[object Number]"===e?r[a]=t:console.error("unexpected color value:",t));return n}},R.prototype.spaces={rgb:["red","green","blue"],hsl:["hue","saturation","lightness"],hsv:["hue","saturation","value"],hwb:["hue","whiteness","blackness"],cmyk:["cyan","magenta","yellow","black"]},R.prototype.maxes={rgb:[255,255,255],hsl:[360,100,100],hsv:[360,100,100],hwb:[360,100,100],cmyk:[100,100,100,100]},R.prototype.getValues=function(t){for(var e=this.values,n={},i=0;i=0;r--)e.call(n,t[r],r);else for(r=0;r=1?t:-(Math.sqrt(1-t*t)-1)},easeOutCirc:function(t){return Math.sqrt(1-(t-=1)*t)},easeInOutCirc:function(t){return(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)},easeInElastic:function(t){var e=1.70158,n=0,i=1;return 0===t?0:1===t?1:(n||(n=.3),e=n/(2*Math.PI)*Math.asin(1/i),-i*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/n))},easeOutElastic:function(t){var e=1.70158,n=0,i=1;return 0===t?0:1===t?1:(n||(n=.3),e=n/(2*Math.PI)*Math.asin(1/i),i*Math.pow(2,-10*t)*Math.sin((t-e)*(2*Math.PI)/n)+1)},easeInOutElastic:function(t){var e=1.70158,n=0,i=1;return 0===t?0:2==(t/=.5)?1:(n||(n=.45),e=n/(2*Math.PI)*Math.asin(1/i),t<1?i*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/n)*-.5:i*Math.pow(2,-10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/n)*.5+1)},easeInBack:function(t){var e=1.70158;return t*t*((e+1)*t-e)},easeOutBack:function(t){var e=1.70158;return(t-=1)*t*((e+1)*t+e)+1},easeInOutBack:function(t){var 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:function(t){return 1-z.easeOutBounce(1-t)},easeOutBounce:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},easeInOutBounce:function(t){return t<.5?.5*z.easeInBounce(2*t):.5*z.easeOutBounce(2*t-1)+.5}},B={effects:z};V.easingEffects=z;var H=Math.PI,U=H/180,j=2*H,q=H/2,G=H/4,$=2*H/3,Z={clear:function(t){t.ctx.clearRect(0,0,t.width,t.height)},roundedRect:function(t,e,n,i,r,a){if(a){var o=Math.min(a,r/2,i/2),s=e+o,l=n+o,u=e+i-o,d=n+r-o;t.moveTo(e,l),se.left-n&&t.xe.top-n&&t.y0&&t.requestAnimationFrame()},advance:function(){for(var t,e,n,i,r=this.animations,a=0;a=n?(ot.callback(t.onAnimationComplete,[t],e),e.animating=!1,r.splice(a,1)):++a}},yt=ot.options.resolve,bt=["push","pop","shift","splice","unshift"];function _t(t,e){t._chartjs?t._chartjs.listeners.push(e):(Object.defineProperty(t,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[e]}}),bt.forEach((function(e){var n="onData"+e.charAt(0).toUpperCase()+e.slice(1),i=t[e];Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value:function(){var e=Array.prototype.slice.call(arguments),r=i.apply(this,e);return ot.each(t._chartjs.listeners,(function(t){"function"==typeof t[n]&&t[n].apply(t,e)})),r}})})))}function xt(t,e){var n=t._chartjs;if(n){var i=n.listeners,r=i.indexOf(e);-1!==r&&i.splice(r,1),i.length>0||(bt.forEach((function(e){delete t[e]})),delete t._chartjs)}}var wt=function(t,e){this.initialize(t,e)};ot.extend(wt.prototype,{datasetElementType:null,dataElementType:null,_datasetElementOptions:["backgroundColor","borderCapStyle","borderColor","borderDash","borderDashOffset","borderJoinStyle","borderWidth"],_dataElementOptions:["backgroundColor","borderColor","borderWidth","pointStyle"],initialize:function(t,e){var n=this;n.chart=t,n.index=e,n.linkScales(),n.addElements(),n._type=n.getMeta().type},updateIndex:function(t){this.index=t},linkScales:function(){var t=this,e=t.getMeta(),n=t.chart,i=n.scales,r=t.getDataset(),a=n.options.scales;null!==e.xAxisID&&e.xAxisID in i&&!r.xAxisID||(e.xAxisID=r.xAxisID||a.xAxes[0].id),null!==e.yAxisID&&e.yAxisID in i&&!r.yAxisID||(e.yAxisID=r.yAxisID||a.yAxes[0].id)},getDataset:function(){return this.chart.data.datasets[this.index]},getMeta:function(){return this.chart.getDatasetMeta(this.index)},getScaleForId:function(t){return this.chart.scales[t]},_getValueScaleId:function(){return this.getMeta().yAxisID},_getIndexScaleId:function(){return this.getMeta().xAxisID},_getValueScale:function(){return this.getScaleForId(this._getValueScaleId())},_getIndexScale:function(){return this.getScaleForId(this._getIndexScaleId())},reset:function(){this._update(!0)},destroy:function(){this._data&&xt(this._data,this)},createMetaDataset:function(){var t=this,e=t.datasetElementType;return e&&new e({_chart:t.chart,_datasetIndex:t.index})},createMetaData:function(t){var e=this,n=e.dataElementType;return n&&new n({_chart:e.chart,_datasetIndex:e.index,_index:t})},addElements:function(){var t,e,n=this,i=n.getMeta(),r=n.getDataset().data||[],a=i.data;for(t=0,e=r.length;ti&&t.insertElements(i,r-i)},insertElements:function(t,e){for(var n=0;nr?(a=r/e.innerRadius,t.arc(o,s,e.innerRadius-r,i+a,n-a,!0)):t.arc(o,s,r,i+Math.PI/2,n-Math.PI/2),t.closePath(),t.clip()}function Dt(t,e,n,i){var r,a=n.endAngle;for(i&&(n.endAngle=n.startAngle+St,Mt(t,n),n.endAngle=a,n.endAngle===n.startAngle&&n.fullCircles&&(n.endAngle+=St,n.fullCircles--)),t.beginPath(),t.arc(n.x,n.y,n.innerRadius,n.startAngle+St,n.startAngle,!0),r=0;rs;)r-=St;for(;r=o&&r<=s,u=a>=n.innerRadius&&a<=n.outerRadius;return l&&u}return!1},getCenterPoint:function(){var t=this._view,e=(t.startAngle+t.endAngle)/2,n=(t.innerRadius+t.outerRadius)/2;return{x:t.x+Math.cos(e)*n,y:t.y+Math.sin(e)*n}},getArea:function(){var t=this._view;return Math.PI*((t.endAngle-t.startAngle)/(2*Math.PI))*(Math.pow(t.outerRadius,2)-Math.pow(t.innerRadius,2))},tooltipPosition:function(){var t=this._view,e=t.startAngle+(t.endAngle-t.startAngle)/2,n=(t.outerRadius-t.innerRadius)/2+t.innerRadius;return{x:t.x+Math.cos(e)*n,y:t.y+Math.sin(e)*n}},draw:function(){var t,e=this._chart.ctx,n=this._view,i="inner"===n.borderAlign?.33:0,r={x:n.x,y:n.y,innerRadius:n.innerRadius,outerRadius:Math.max(n.outerRadius-i,0),pixelMargin:i,startAngle:n.startAngle,endAngle:n.endAngle,fullCircles:Math.floor(n.circumference/St)};if(e.save(),e.fillStyle=n.backgroundColor,e.strokeStyle=n.borderColor,r.fullCircles){for(r.endAngle=r.startAngle+St,e.beginPath(),e.arc(r.x,r.y,r.outerRadius,r.startAngle,r.endAngle),e.arc(r.x,r.y,r.innerRadius,r.endAngle,r.startAngle,!0),e.closePath(),t=0;tt.x&&(e=Vt(e,"left","right")):t.basen?n:i,r:l.right||r<0?0:r>e?e:r,b:l.bottom||a<0?0:a>n?n:a,l:l.left||o<0?0:o>e?e:o}}function Ht(t){var e=Yt(t),n=e.right-e.left,i=e.bottom-e.top,r=Bt(t,n/2,i/2);return{outer:{x:e.left,y:e.top,w:n,h:i},inner:{x:e.left+r.l,y:e.top+r.t,w:n-r.l-r.r,h:i-r.t-r.b}}}function Ut(t,e,n){var i=null===e,r=null===n,a=!(!t||i&&r)&&Yt(t);return a&&(i||e>=a.left&&e<=a.right)&&(r||n>=a.top&&n<=a.bottom)}K._set("global",{elements:{rectangle:{backgroundColor:Et,borderColor:Et,borderSkipped:"bottom",borderWidth:0}}});var jt=pt.extend({_type:"rectangle",draw:function(){var t=this._chart.ctx,e=this._view,n=Ht(e),i=n.outer,r=n.inner;t.fillStyle=e.backgroundColor,t.fillRect(i.x,i.y,i.w,i.h),i.w===r.w&&i.h===r.h||(t.save(),t.beginPath(),t.rect(i.x,i.y,i.w,i.h),t.clip(),t.fillStyle=e.borderColor,t.rect(r.x,r.y,r.w,r.h),t.fill("evenodd"),t.restore())},height:function(){var t=this._view;return t.base-t.y},inRange:function(t,e){return Ut(this._view,t,e)},inLabelRange:function(t,e){var n=this._view;return Wt(n)?Ut(n,t,null):Ut(n,null,e)},inXRange:function(t){return Ut(this._view,t,null)},inYRange:function(t){return Ut(this._view,null,t)},getCenterPoint:function(){var t,e,n=this._view;return Wt(n)?(t=n.x,e=(n.y+n.base)/2):(t=(n.x+n.base)/2,e=n.y),{x:t,y:e}},getArea:function(){var t=this._view;return Wt(t)?t.width*Math.abs(t.y-t.base):t.height*Math.abs(t.x-t.base)},tooltipPosition:function(){var t=this._view;return{x:t.x,y:t.y}}}),qt={},Gt=Pt,$t=Ot,Zt=Lt,Xt=jt;qt.Arc=Gt,qt.Line=$t,qt.Point=Zt,qt.Rectangle=Xt;var Jt=ot._deprecated,Kt=ot.valueOrDefault;function Qt(t,e){var n,i,r,a,o=t._length;for(r=1,a=e.length;r0?Math.min(o,Math.abs(i-n)):o,n=i;return o}function te(t,e,n){var i,r,a=n.barThickness,o=e.stackCount,s=e.pixels[t],l=ot.isNullOrUndef(a)?Qt(e.scale,e.pixels):-1;return ot.isNullOrUndef(a)?(i=l*n.categoryPercentage,r=n.barPercentage):(i=a*o,r=1),{chunk:i/o,ratio:r,start:s-i/2}}function ee(t,e,n){var i,r=e.pixels,a=r[t],o=t>0?r[t-1]:null,s=t=0&&m.min>=0?m.min:m.max,x=void 0===m.start?m.end:m.max>=0&&m.min>=0?m.max-m.min:m.min-m.max,w=g.length;if(y||void 0===y&&void 0!==b)for(i=0;i=0&&u.max>=0?u.max:u.min,(m.min<0&&a<0||m.max>=0&&a>0)&&(_+=a));return o=h.getPixelForValue(_),l=(s=h.getPixelForValue(_+x))-o,void 0!==v&&Math.abs(l)=0&&!f||x<0&&f?o-v:o+v),{size:l,base:o,head:s,center:s+l/2}},calculateBarIndexPixels:function(t,e,n,i){var r=this,a="flex"===i.barThickness?ee(e,n,i):te(e,n,i),o=r.getStackIndex(t,r.getMeta().stack),s=a.start+a.chunk*o+a.chunk/2,l=Math.min(Kt(i.maxBarThickness,1/0),a.chunk*a.ratio);return{base:s-l/2,head:s+l/2,center:s,size:l}},draw:function(){var t=this,e=t.chart,n=t._getValueScale(),i=t.getMeta().data,r=t.getDataset(),a=i.length,o=0;for(ot.canvas.clipArea(e.ctx,e.chartArea);o=se?-le:y<-se?le:0)+m,_=Math.cos(y),x=Math.sin(y),w=Math.cos(b),k=Math.sin(b),S=y<=0&&b>=0||b>=le,M=y<=ue&&b>=ue||b>=le+ue,D=y<=-ue&&b>=-ue||b>=se+ue,C=y===-se||b>=se?-1:Math.min(_,_*g,w,w*g),P=D?-1:Math.min(x,x*g,k,k*g),T=S?1:Math.max(_,_*g,w,w*g),A=M?1:Math.max(x,x*g,k,k*g);u=(T-C)/2,d=(A-P)/2,c=-(T+C)/2,h=-(A+P)/2}for(i=0,r=p.length;i0&&!isNaN(t)?le*(Math.abs(t)/e):0},getMaxBorderWidth:function(t){var e,n,i,r,a,o,s,l,u=this,d=0,c=u.chart;if(!t)for(e=0,n=c.data.datasets.length;e(d=s>d?s:d)?l:d);return d},setHoverStyle:function(t){var e=t._model,n=t._options,i=ot.getHoverColor;t.$previousStyle={backgroundColor:e.backgroundColor,borderColor:e.borderColor,borderWidth:e.borderWidth},e.backgroundColor=oe(n.hoverBackgroundColor,i(n.backgroundColor)),e.borderColor=oe(n.hoverBorderColor,i(n.borderColor)),e.borderWidth=oe(n.hoverBorderWidth,n.borderWidth)},_getRingWeightOffset:function(t){for(var e=0,n=0;n0&&pe(u[t-1]._model,l)&&(n.controlPointPreviousX=d(n.controlPointPreviousX,l.left,l.right),n.controlPointPreviousY=d(n.controlPointPreviousY,l.top,l.bottom)),t0&&(a=t.getDatasetMeta(a[0]._datasetIndex).data),a},"x-axis":function(t,e){return Ae(t,e,{intersect:!1})},point:function(t,e){return Ce(t,Me(e,t))},nearest:function(t,e,n){var i=Me(e,t);n.axis=n.axis||"xy";var r=Te(n.axis);return Pe(t,i,n.intersect,r)},x:function(t,e,n){var i=Me(e,t),r=[],a=!1;return De(t,(function(t){t.inXRange(i.x)&&r.push(t),t.inRange(i.x,i.y)&&(a=!0)})),n.intersect&&!a&&(r=[]),r},y:function(t,e,n){var i=Me(e,t),r=[],a=!1;return De(t,(function(t){t.inYRange(i.y)&&r.push(t),t.inRange(i.x,i.y)&&(a=!0)})),n.intersect&&!a&&(r=[]),r}}},Ne=ot.extend;function Fe(t,e){return ot.where(t,(function(t){return t.pos===e}))}function Ie(t,e){return t.sort((function(t,n){var i=e?n:t,r=e?t:n;return i.weight===r.weight?i.index-r.index:i.weight-r.weight}))}function Re(t){var e,n,i,r=[];for(e=0,n=(t||[]).length;e div {\r\n\tposition: absolute;\r\n\twidth: 1000000px;\r\n\theight: 1000000px;\r\n\tleft: 0;\r\n\ttop: 0;\r\n}\r\n\r\n.chartjs-size-monitor-shrink > div {\r\n\tposition: absolute;\r\n\twidth: 200%;\r\n\theight: 200%;\r\n\tleft: 0;\r\n\ttop: 0;\r\n}\r\n",Ge=n(Object.freeze({__proto__:null,default:qe})),$e="$chartjs",Ze="chartjs-",Xe=Ze+"size-monitor",Je=Ze+"render-monitor",Ke=Ze+"render-animation",Qe=["animationstart","webkitAnimationStart"],tn={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"};function en(t,e){var n=ot.getStyle(t,e),i=n&&n.match(/^(\d+)(\.\d+)?px$/);return i?Number(i[1]):void 0}function nn(t,e){var n=t.style,i=t.getAttribute("height"),r=t.getAttribute("width");if(t[$e]={initial:{height:i,width:r,style:{display:n.display,height:n.height,width:n.width}}},n.display=n.display||"block",null===r||""===r){var a=en(t,"width");void 0!==a&&(t.width=a)}if(null===i||""===i)if(""===t.style.height)t.height=t.width/(e.options.aspectRatio||2);else{var o=en(t,"height");void 0!==a&&(t.height=o)}return t}var rn=!!function(){var t=!1;try{var e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("e",null,e)}catch(t){}return t}()&&{passive:!0};function an(t,e,n){t.addEventListener(e,n,rn)}function on(t,e,n){t.removeEventListener(e,n,rn)}function sn(t,e,n,i,r){return{type:t,chart:e,native:r||null,x:void 0!==n?n:null,y:void 0!==i?i:null}}function ln(t,e){var n=tn[t.type]||t.type,i=ot.getRelativePosition(t,e);return sn(n,e,i.x,i.y,t)}function un(t,e){var n=!1,i=[];return function(){i=Array.prototype.slice.call(arguments),e=e||this,n||(n=!0,ot.requestAnimFrame.call(window,(function(){n=!1,t.apply(e,i)})))}}function dn(t){var e=document.createElement("div");return e.className=t||"",e}function cn(t){var e=1e6,n=dn(Xe),i=dn(Xe+"-expand"),r=dn(Xe+"-shrink");i.appendChild(dn()),r.appendChild(dn()),n.appendChild(i),n.appendChild(r),n._reset=function(){i.scrollLeft=e,i.scrollTop=e,r.scrollLeft=e,r.scrollTop=e};var a=function(){n._reset(),t()};return an(i,"scroll",a.bind(i,"expand")),an(r,"scroll",a.bind(r,"shrink")),n}function hn(t,e){var n=t[$e]||(t[$e]={}),i=n.renderProxy=function(t){t.animationName===Ke&&e()};ot.each(Qe,(function(e){an(t,e,i)})),n.reflow=!!t.offsetParent,t.classList.add(Je)}function fn(t){var e=t[$e]||{},n=e.renderProxy;n&&(ot.each(Qe,(function(e){on(t,e,n)})),delete e.renderProxy),t.classList.remove(Je)}function pn(t,e,n){var i=t[$e]||(t[$e]={}),r=i.resizer=cn(un((function(){if(i.resizer){var r=n.options.maintainAspectRatio&&t.parentNode,a=r?r.clientWidth:0;e(sn("resize",n)),r&&r.clientWidth0){var a=t[0];a.label?n=a.label:a.xLabel?n=a.xLabel:r>0&&a.index-1?t.split("\n"):t}function Cn(t){var e=t._xScale,n=t._yScale||t._scale,i=t._index,r=t._datasetIndex,a=t._chart.getDatasetMeta(r).controller,o=a._getIndexScale(),s=a._getValueScale();return{xLabel:e?e.getLabelForIndex(i,r):"",yLabel:n?n.getLabelForIndex(i,r):"",label:o?""+o.getLabelForIndex(i,r):"",value:s?""+s.getLabelForIndex(i,r):"",index:i,datasetIndex:r,x:t._model.x,y:t._model.y}}function Pn(t){var e=K.global;return{xPadding:t.xPadding,yPadding:t.yPadding,xAlign:t.xAlign,yAlign:t.yAlign,rtl:t.rtl,textDirection:t.textDirection,bodyFontColor:t.bodyFontColor,_bodyFontFamily:wn(t.bodyFontFamily,e.defaultFontFamily),_bodyFontStyle:wn(t.bodyFontStyle,e.defaultFontStyle),_bodyAlign:t.bodyAlign,bodyFontSize:wn(t.bodyFontSize,e.defaultFontSize),bodySpacing:t.bodySpacing,titleFontColor:t.titleFontColor,_titleFontFamily:wn(t.titleFontFamily,e.defaultFontFamily),_titleFontStyle:wn(t.titleFontStyle,e.defaultFontStyle),titleFontSize:wn(t.titleFontSize,e.defaultFontSize),_titleAlign:t.titleAlign,titleSpacing:t.titleSpacing,titleMarginBottom:t.titleMarginBottom,footerFontColor:t.footerFontColor,_footerFontFamily:wn(t.footerFontFamily,e.defaultFontFamily),_footerFontStyle:wn(t.footerFontStyle,e.defaultFontStyle),footerFontSize:wn(t.footerFontSize,e.defaultFontSize),_footerAlign:t.footerAlign,footerSpacing:t.footerSpacing,footerMarginTop:t.footerMarginTop,caretSize:t.caretSize,cornerRadius:t.cornerRadius,backgroundColor:t.backgroundColor,opacity:0,legendColorBackground:t.multiKeyBackground,displayColors:t.displayColors,borderColor:t.borderColor,borderWidth:t.borderWidth}}function Tn(t,e){var n=t._chart.ctx,i=2*e.yPadding,r=0,a=e.body,o=a.reduce((function(t,e){return t+e.before.length+e.lines.length+e.after.length}),0);o+=e.beforeBody.length+e.afterBody.length;var s=e.title.length,l=e.footer.length,u=e.titleFontSize,d=e.bodyFontSize,c=e.footerFontSize;i+=s*u,i+=s?(s-1)*e.titleSpacing:0,i+=s?e.titleMarginBottom:0,i+=o*d,i+=o?(o-1)*e.bodySpacing:0,i+=l?e.footerMarginTop:0,i+=l*c,i+=l?(l-1)*e.footerSpacing:0;var h=0,f=function(t){r=Math.max(r,n.measureText(t).width+h)};return n.font=ot.fontString(u,e._titleFontStyle,e._titleFontFamily),ot.each(e.title,f),n.font=ot.fontString(d,e._bodyFontStyle,e._bodyFontFamily),ot.each(e.beforeBody.concat(e.afterBody),f),h=e.displayColors?d+2:0,ot.each(a,(function(t){ot.each(t.before,f),ot.each(t.lines,f),ot.each(t.after,f)})),h=0,n.font=ot.fontString(c,e._footerFontStyle,e._footerFontFamily),ot.each(e.footer,f),{width:r+=2*e.xPadding,height:i}}function An(t,e){var n,i,r,a,o,s=t._model,l=t._chart,u=t._chart.chartArea,d="center",c="center";s.yl.height-e.height&&(c="bottom");var h=(u.left+u.right)/2,f=(u.top+u.bottom)/2;"center"===c?(n=function(t){return t<=h},i=function(t){return t>h}):(n=function(t){return t<=e.width/2},i=function(t){return t>=l.width-e.width/2}),r=function(t){return t+e.width+s.caretSize+s.caretPadding>l.width},a=function(t){return t-e.width-s.caretSize-s.caretPadding<0},o=function(t){return t<=f?"top":"bottom"},n(s.x)?(d="left",r(s.x)&&(d="center",c=o(s.y))):i(s.x)&&(d="right",a(s.x)&&(d="center",c=o(s.y)));var p=t._options;return{xAlign:p.xAlign?p.xAlign:d,yAlign:p.yAlign?p.yAlign:c}}function On(t,e,n,i){var r=t.x,a=t.y,o=t.caretSize,s=t.caretPadding,l=t.cornerRadius,u=n.xAlign,d=n.yAlign,c=o+s,h=l+s;return"right"===u?r-=e.width:"center"===u&&((r-=e.width/2)+e.width>i.width&&(r=i.width-e.width),r<0&&(r=0)),"top"===d?a+=c:a-="bottom"===d?e.height+c:e.height/2,"center"===d?"left"===u?r+=c:"right"===u&&(r-=c):"left"===u?r-=h:"right"===u&&(r+=h),{x:r,y:a}}function Nn(t,e){return"center"===e?t.x+t.width/2:"right"===e?t.x+t.width-t.xPadding:t.x+t.xPadding}function Fn(t){return Mn([],Dn(t))}var In=pt.extend({initialize:function(){this._model=Pn(this._options),this._lastActive=[]},getTitle:function(){var t=this,e=t._options.callbacks,n=e.beforeTitle.apply(t,arguments),i=e.title.apply(t,arguments),r=e.afterTitle.apply(t,arguments),a=[];return a=Mn(a,Dn(n)),a=Mn(a,Dn(i)),a=Mn(a,Dn(r))},getBeforeBody:function(){return Fn(this._options.callbacks.beforeBody.apply(this,arguments))},getBody:function(t,e){var n=this,i=n._options.callbacks,r=[];return ot.each(t,(function(t){var a={before:[],lines:[],after:[]};Mn(a.before,Dn(i.beforeLabel.call(n,t,e))),Mn(a.lines,i.label.call(n,t,e)),Mn(a.after,Dn(i.afterLabel.call(n,t,e))),r.push(a)})),r},getAfterBody:function(){return Fn(this._options.callbacks.afterBody.apply(this,arguments))},getFooter:function(){var t=this,e=t._options.callbacks,n=e.beforeFooter.apply(t,arguments),i=e.footer.apply(t,arguments),r=e.afterFooter.apply(t,arguments),a=[];return a=Mn(a,Dn(n)),a=Mn(a,Dn(i)),a=Mn(a,Dn(r))},update:function(t){var e,n,i=this,r=i._options,a=i._model,o=i._model=Pn(r),s=i._active,l=i._data,u={xAlign:a.xAlign,yAlign:a.yAlign},d={x:a.x,y:a.y},c={width:a.width,height:a.height},h={x:a.caretX,y:a.caretY};if(s.length){o.opacity=1;var f=[],p=[];h=Sn[r.position].call(i,s,i._eventPosition);var g=[];for(e=0,n=s.length;e0&&n.stroke()},draw:function(){var t=this._chart.ctx,e=this._view;if(0!==e.opacity){var n={width:e.width,height:e.height},i={x:e.x,y:e.y},r=Math.abs(e.opacity<.001)?0:e.opacity,a=e.title.length||e.beforeBody.length||e.body.length||e.afterBody.length||e.footer.length;this._options.enabled&&a&&(t.save(),t.globalAlpha=r,this.drawBackground(i,e,t,n),i.y+=e.yPadding,ot.rtl.overrideTextDirection(t,e.textDirection),this.drawTitle(i,e,t),this.drawBody(i,e,t),this.drawFooter(i,e,t),ot.rtl.restoreTextDirection(t,e.textDirection),t.restore())}},handleEvent:function(t){var e=this,n=e._options,i=!1;return e._lastActive=e._lastActive||[],"mouseout"===t.type?e._active=[]:(e._active=e._chart.getElementsAtEventForMode(t,n.mode,n),n.reverse&&e._active.reverse()),(i=!ot.arrayEquals(e._active,e._lastActive))&&(e._lastActive=e._active,(n.enabled||n.custom)&&(e._eventPosition={x:t.x,y:t.y},e.update(!0),e.pivot())),i}}),Rn=Sn,Ln=In;Ln.positioners=Rn;var En=ot.valueOrDefault;function Wn(){return ot.merge(Object.create(null),[].slice.call(arguments),{merger:function(t,e,n,i){if("xAxes"===t||"yAxes"===t){var r,a,o,s=n[t].length;for(e[t]||(e[t]=[]),r=0;r=e[t].length&&e[t].push({}),!e[t][r].type||o.type&&o.type!==e[t][r].type?ot.merge(e[t][r],[xn.getScaleDefaults(a),o]):ot.merge(e[t][r],o)}else ot._merger(t,e,n,i)}})}function Yn(){return ot.merge(Object.create(null),[].slice.call(arguments),{merger:function(t,e,n,i){var r=e[t]||Object.create(null),a=n[t];"scales"===t?e[t]=Wn(r,a):"scale"===t?e[t]=ot.merge(r,[xn.getScaleDefaults(a.type),a]):ot._merger(t,e,n,i)}})}function Vn(t){var e=(t=t||Object.create(null)).data=t.data||{};return e.datasets=e.datasets||[],e.labels=e.labels||[],t.options=Yn(K.global,K[t.type],t.options||{}),t}function zn(t){var e=t.options;ot.each(t.scales,(function(e){Ue.removeBox(t,e)})),e=Yn(K.global,K[t.config.type],e),t.options=t.config.options=e,t.ensureScalesHaveIDs(),t.buildOrUpdateScales(),t.tooltip._options=e.tooltips,t.tooltip.initialize()}function Bn(t,e,n){var i,r=function(t){return t.id===i};do{i=e+n++}while(ot.findIndex(t,r)>=0);return i}function Hn(t){return"top"===t||"bottom"===t}function Un(t,e){return function(n,i){return n[t]===i[t]?n[e]-i[e]:n[t]-i[t]}}K._set("global",{elements:{},events:["mousemove","mouseout","click","touchstart","touchmove"],hover:{onHover:null,mode:"nearest",intersect:!0,animationDuration:400},onClick:null,maintainAspectRatio:!0,responsive:!0,responsiveAnimationDuration:0});var jn=function(t,e){return this.construct(t,e),this};ot.extend(jn.prototype,{construct:function(t,e){var n=this;e=Vn(e);var i=bn.acquireContext(t,e),r=i&&i.canvas,a=r&&r.height,o=r&&r.width;n.id=ot.uid(),n.ctx=i,n.canvas=r,n.config=e,n.width=o,n.height=a,n.aspectRatio=a?o/a:null,n.options=e.options,n._bufferedRender=!1,n._layers=[],n.chart=n,n.controller=n,jn.instances[n.id]=n,Object.defineProperty(n,"data",{get:function(){return n.config.data},set:function(t){n.config.data=t}}),i&&r?(n.initialize(),n.update()):console.error("Failed to create chart: can't acquire context from the given item")},initialize:function(){var t=this;return _n.notify(t,"beforeInit"),ot.retinaScale(t,t.options.devicePixelRatio),t.bindEvents(),t.options.responsive&&t.resize(!0),t.initToolTip(),_n.notify(t,"afterInit"),t},clear:function(){return ot.canvas.clear(this),this},stop:function(){return vt.cancelAnimation(this),this},resize:function(t){var e=this,n=e.options,i=e.canvas,r=n.maintainAspectRatio&&e.aspectRatio||null,a=Math.max(0,Math.floor(ot.getMaximumWidth(i))),o=Math.max(0,Math.floor(r?a/r:ot.getMaximumHeight(i)));if((e.width!==a||e.height!==o)&&(i.width=e.width=a,i.height=e.height=o,i.style.width=a+"px",i.style.height=o+"px",ot.retinaScale(e,n.devicePixelRatio),!t)){var s={width:a,height:o};_n.notify(e,"resize",[s]),n.onResize&&n.onResize(e,s),e.stop(),e.update({duration:n.responsiveAnimationDuration})}},ensureScalesHaveIDs:function(){var t=this.options,e=t.scales||{},n=t.scale;ot.each(e.xAxes,(function(t,n){t.id||(t.id=Bn(e.xAxes,"x-axis-",n))})),ot.each(e.yAxes,(function(t,n){t.id||(t.id=Bn(e.yAxes,"y-axis-",n))})),n&&(n.id=n.id||"scale")},buildOrUpdateScales:function(){var t=this,e=t.options,n=t.scales||{},i=[],r=Object.keys(n).reduce((function(t,e){return t[e]=!1,t}),{});e.scales&&(i=i.concat((e.scales.xAxes||[]).map((function(t){return{options:t,dtype:"category",dposition:"bottom"}})),(e.scales.yAxes||[]).map((function(t){return{options:t,dtype:"linear",dposition:"left"}})))),e.scale&&i.push({options:e.scale,dtype:"radialLinear",isDefault:!0,dposition:"chartArea"}),ot.each(i,(function(e){var i=e.options,a=i.id,o=En(i.type,e.dtype);Hn(i.position)!==Hn(e.dposition)&&(i.position=e.dposition),r[a]=!0;var s=null;if(a in n&&n[a].type===o)(s=n[a]).options=i,s.ctx=t.ctx,s.chart=t;else{var l=xn.getScaleConstructor(o);if(!l)return;s=new l({id:a,type:o,options:i,ctx:t.ctx,chart:t}),n[s.id]=s}s.mergeTicksOptions(),e.isDefault&&(t.scale=s)})),ot.each(r,(function(t,e){t||delete n[e]})),t.scales=n,xn.addScalesToLayout(this)},buildOrUpdateControllers:function(){var t,e,n=this,i=[],r=n.data.datasets;for(t=0,e=r.length;t=0;--n)i.drawDataset(e[n],t);_n.notify(i,"afterDatasetsDraw",[t])}},drawDataset:function(t,e){var n=this,i={meta:t,index:t.index,easingValue:e};!1!==_n.notify(n,"beforeDatasetDraw",[i])&&(t.controller.draw(e),_n.notify(n,"afterDatasetDraw",[i]))},_drawTooltip:function(t){var e=this,n=e.tooltip,i={tooltip:n,easingValue:t};!1!==_n.notify(e,"beforeTooltipDraw",[i])&&(n.draw(),_n.notify(e,"afterTooltipDraw",[i]))},getElementAtEvent:function(t){return Oe.modes.single(this,t)},getElementsAtEvent:function(t){return Oe.modes.label(this,t,{intersect:!0})},getElementsAtXAxis:function(t){return Oe.modes["x-axis"](this,t,{intersect:!0})},getElementsAtEventForMode:function(t,e,n){var i=Oe.modes[e];return"function"==typeof i?i(this,t,n):[]},getDatasetAtEvent:function(t){return Oe.modes.dataset(this,t,{intersect:!0})},getDatasetMeta:function(t){var e=this,n=e.data.datasets[t];n._meta||(n._meta={});var i=n._meta[e.id];return i||(i=n._meta[e.id]={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:n.order||0,index:t}),i},getVisibleDatasetCount:function(){for(var t=0,e=0,n=this.data.datasets.length;e=0;i--){var r=t[i];if(e(r))return r}},ot.isNumber=function(t){return!isNaN(parseFloat(t))&&isFinite(t)},ot.almostEquals=function(t,e,n){return Math.abs(t-e)=t},ot.max=function(t){return t.reduce((function(t,e){return isNaN(e)?t:Math.max(t,e)}),Number.NEGATIVE_INFINITY)},ot.min=function(t){return t.reduce((function(t,e){return isNaN(e)?t:Math.min(t,e)}),Number.POSITIVE_INFINITY)},ot.sign=Math.sign?function(t){return Math.sign(t)}:function(t){return 0==(t=+t)||isNaN(t)?t:t>0?1:-1},ot.toRadians=function(t){return t*(Math.PI/180)},ot.toDegrees=function(t){return t*(180/Math.PI)},ot._decimalPlaces=function(t){if(ot.isFinite(t)){for(var e=1,n=0;Math.round(t*e)/e!==t;)e*=10,n++;return n}},ot.getAngleFromPoint=function(t,e){var n=e.x-t.x,i=e.y-t.y,r=Math.sqrt(n*n+i*i),a=Math.atan2(i,n);return a<-.5*Math.PI&&(a+=2*Math.PI),{angle:a,distance:r}},ot.distanceBetweenPoints=function(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))},ot.aliasPixel=function(t){return t%2==0?0:.5},ot._alignPixel=function(t,e,n){var i=t.currentDevicePixelRatio,r=n/2;return Math.round((e-r)*i)/i+r},ot.splineCurve=function(t,e,n,i){var r=t.skip?e:t,a=e,o=n.skip?e:n,s=Math.sqrt(Math.pow(a.x-r.x,2)+Math.pow(a.y-r.y,2)),l=Math.sqrt(Math.pow(o.x-a.x,2)+Math.pow(o.y-a.y,2)),u=s/(s+l),d=l/(s+l),c=i*(u=isNaN(u)?0:u),h=i*(d=isNaN(d)?0:d);return{previous:{x:a.x-c*(o.x-r.x),y:a.y-c*(o.y-r.y)},next:{x:a.x+h*(o.x-r.x),y:a.y+h*(o.y-r.y)}}},ot.EPSILON=Number.EPSILON||1e-14,ot.splineCurveMonotone=function(t){var e,n,i,r,a,o,s,l,u,d=(t||[]).map((function(t){return{model:t._model,deltaK:0,mK:0}})),c=d.length;for(e=0;e0?d[e-1]:null,(r=e0?d[e-1]:null,r=e=t.length-1?t[0]:t[e+1]:e>=t.length-1?t[t.length-1]:t[e+1]},ot.previousItem=function(t,e,n){return n?e<=0?t[t.length-1]:t[e-1]:e<=0?t[0]:t[e-1]},ot.niceNum=function(t,e){var n=Math.floor(ot.log10(t)),i=t/Math.pow(10,n);return(e?i<1.5?1:i<3?2:i<7?5:10:i<=1?1:i<=2?2:i<=5?5:10)*Math.pow(10,n)},ot.requestAnimFrame="undefined"==typeof window?function(t){t()}:window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){return window.setTimeout(t,1e3/60)},ot.getRelativePosition=function(t,e){var n,i,r=t.originalEvent||t,a=t.target||t.srcElement,o=a.getBoundingClientRect(),s=r.touches;s&&s.length>0?(n=s[0].clientX,i=s[0].clientY):(n=r.clientX,i=r.clientY);var l=parseFloat(ot.getStyle(a,"padding-left")),u=parseFloat(ot.getStyle(a,"padding-top")),d=parseFloat(ot.getStyle(a,"padding-right")),c=parseFloat(ot.getStyle(a,"padding-bottom")),h=o.right-o.left-l-d,f=o.bottom-o.top-u-c;return{x:n=Math.round((n-o.left-l)/h*a.width/e.currentDevicePixelRatio),y:i=Math.round((i-o.top-u)/f*a.height/e.currentDevicePixelRatio)}},ot.getConstraintWidth=function(t){return n(t,"max-width","clientWidth")},ot.getConstraintHeight=function(t){return n(t,"max-height","clientHeight")},ot._calculatePadding=function(t,e,n){return(e=ot.getStyle(t,e)).indexOf("%")>-1?n*parseInt(e,10)/100:parseInt(e,10)},ot._getParentNode=function(t){var e=t.parentNode;return e&&"[object ShadowRoot]"===e.toString()&&(e=e.host),e},ot.getMaximumWidth=function(t){var e=ot._getParentNode(t);if(!e)return t.clientWidth;var n=e.clientWidth,i=n-ot._calculatePadding(e,"padding-left",n)-ot._calculatePadding(e,"padding-right",n),r=ot.getConstraintWidth(t);return isNaN(r)?i:Math.min(i,r)},ot.getMaximumHeight=function(t){var e=ot._getParentNode(t);if(!e)return t.clientHeight;var n=e.clientHeight,i=n-ot._calculatePadding(e,"padding-top",n)-ot._calculatePadding(e,"padding-bottom",n),r=ot.getConstraintHeight(t);return isNaN(r)?i:Math.min(i,r)},ot.getStyle=function(t,e){return t.currentStyle?t.currentStyle[e]:document.defaultView.getComputedStyle(t,null).getPropertyValue(e)},ot.retinaScale=function(t,e){var n=t.currentDevicePixelRatio=e||"undefined"!=typeof window&&window.devicePixelRatio||1;if(1!==n){var i=t.canvas,r=t.height,a=t.width;i.height=r*n,i.width=a*n,t.ctx.scale(n,n),i.style.height||i.style.width||(i.style.height=r+"px",i.style.width=a+"px")}},ot.fontString=function(t,e,n){return e+" "+t+"px "+n},ot.longestText=function(t,e,n,i){var r=(i=i||{}).data=i.data||{},a=i.garbageCollect=i.garbageCollect||[];i.font!==e&&(r=i.data={},a=i.garbageCollect=[],i.font=e),t.font=e;var o,s,l,u,d,c=0,h=n.length;for(o=0;on.length){for(o=0;oi&&(i=a),i},ot.numberOfLabelLines=function(t){var e=1;return ot.each(t,(function(t){ot.isArray(t)&&t.length>e&&(e=t.length)})),e},ot.color=L?function(t){return t instanceof CanvasGradient&&(t=K.global.defaultColor),L(t)}:function(t){return console.error("Color.js not found!"),t},ot.getHoverColor=function(t){return t instanceof CanvasPattern||t instanceof CanvasGradient?t:ot.color(t).saturate(.5).darken(.1).rgbString()}};function $n(){throw new Error("This method is not implemented: either no adapter can be found or an incomplete integration was provided.")}function Zn(t){this.options=t||{}}ot.extend(Zn.prototype,{formats:$n,parse:$n,format:$n,add:$n,diff:$n,startOf:$n,endOf:$n,_create:function(t){return t}}),Zn.override=function(t){ot.extend(Zn.prototype,t)};var Xn={_date:Zn},Jn={formatters:{values:function(t){return ot.isArray(t)?t:""+t},linear:function(t,e,n){var i=n.length>3?n[2]-n[1]:n[1]-n[0];Math.abs(i)>1&&t!==Math.floor(t)&&(i=t-Math.floor(t));var r=ot.log10(Math.abs(i)),a="";if(0!==t)if(Math.max(Math.abs(n[0]),Math.abs(n[n.length-1]))<1e-4){var o=ot.log10(Math.abs(t)),s=Math.floor(o)-Math.floor(r);s=Math.max(Math.min(s,20),0),a=t.toExponential(s)}else{var l=-1*Math.floor(r);l=Math.max(Math.min(l,20),0),a=t.toFixed(l)}else a="0";return a},logarithmic:function(t,e,n){var i=t/Math.pow(10,Math.floor(ot.log10(t)));return 0===t?"0":1===i||2===i||5===i||0===e||e===n.length-1?t.toExponential():""}}},Kn=ot.isArray,Qn=ot.isNullOrUndef,ti=ot.valueOrDefault,ei=ot.valueAtIndexOrDefault;function ni(t,e){for(var n=[],i=t.length/e,r=0,a=t.length;rl+u)))return o}function ri(t,e){ot.each(t,(function(t){var n,i=t.gc,r=i.length/2;if(r>e){for(n=0;nu)return a;return Math.max(u,1)}function fi(t){var e,n,i=[];for(e=0,n=t.length;e=h||d<=1||!s.isHorizontal()?s.labelRotation=c:(e=(t=s._getLabelSizes()).widest.width,n=t.highest.height-t.highest.offset,i=Math.min(s.maxWidth,s.chart.width-e),e+6>(r=l.offset?s.maxWidth/d:i/(d-1))&&(r=i/(d-(l.offset?.5:1)),a=s.maxHeight-oi(l.gridLines)-u.padding-si(l.scaleLabel),o=Math.sqrt(e*e+n*n),f=ot.toDegrees(Math.min(Math.asin(Math.min((t.highest.height+6)/r,1)),Math.asin(Math.min(a/o,1))-Math.asin(n/o))),f=Math.max(c,Math.min(h,f))),s.labelRotation=f)},afterCalculateTickRotation:function(){ot.callback(this.options.afterCalculateTickRotation,[this])},beforeFit:function(){ot.callback(this.options.beforeFit,[this])},fit:function(){var t=this,e=t.minSize={width:0,height:0},n=t.chart,i=t.options,r=i.ticks,a=i.scaleLabel,o=i.gridLines,s=t._isVisible(),l="bottom"===i.position,u=t.isHorizontal();if(u?e.width=t.maxWidth:s&&(e.width=oi(o)+si(a)),u?s&&(e.height=oi(o)+si(a)):e.height=t.maxHeight,r.display&&s){var d=ui(r),c=t._getLabelSizes(),h=c.first,f=c.last,p=c.widest,g=c.highest,m=.4*d.minor.lineHeight,v=r.padding;if(u){var y=0!==t.labelRotation,b=ot.toRadians(t.labelRotation),_=Math.cos(b),x=Math.sin(b),w=x*p.width+_*(g.height-(y?g.offset:0))+(y?0:m);e.height=Math.min(t.maxHeight,e.height+w+v);var k,S,M=t.getPixelForTick(0)-t.left,D=t.right-t.getPixelForTick(t.getTicks().length-1);y?(k=l?_*h.width+x*h.offset:x*(h.height-h.offset),S=l?x*(f.height-f.offset):_*f.width+x*f.offset):(k=h.width/2,S=f.width/2),t.paddingLeft=Math.max((k-M)*t.width/(t.width-M),0)+3,t.paddingRight=Math.max((S-D)*t.width/(t.width-D),0)+3}else{var C=r.mirror?0:p.width+v+m;e.width=Math.min(t.maxWidth,e.width+C),t.paddingTop=h.height/2,t.paddingBottom=f.height/2}}t.handleMargins(),u?(t.width=t._length=n.width-t.margins.left-t.margins.right,t.height=e.height):(t.width=e.width,t.height=t._length=n.height-t.margins.top-t.margins.bottom)},handleMargins:function(){var t=this;t.margins&&(t.margins.left=Math.max(t.paddingLeft,t.margins.left),t.margins.top=Math.max(t.paddingTop,t.margins.top),t.margins.right=Math.max(t.paddingRight,t.margins.right),t.margins.bottom=Math.max(t.paddingBottom,t.margins.bottom))},afterFit:function(){ot.callback(this.options.afterFit,[this])},isHorizontal:function(){var t=this.options.position;return"top"===t||"bottom"===t},isFullWidth:function(){return this.options.fullWidth},getRightValue:function(t){if(Qn(t))return NaN;if(("number"==typeof t||t instanceof Number)&&!isFinite(t))return NaN;if(t)if(this.isHorizontal()){if(void 0!==t.x)return this.getRightValue(t.x)}else if(void 0!==t.y)return this.getRightValue(t.y);return t},_convertTicksToLabels:function(t){var e,n,i,r=this;for(r.ticks=t.map((function(t){return t.value})),r.beforeTickToLabelConversion(),e=r.convertTicksToLabels(t)||r.ticks,r.afterTickToLabelConversion(),n=0,i=t.length;ni-1?null:e.getPixelForDecimal(t*r+(n?r/2:0))},getPixelForDecimal:function(t){var e=this;return e._reversePixels&&(t=1-t),e._startPixel+t*e._length},getDecimalForPixel:function(t){var e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e},getBasePixel:function(){return this.getPixelForValue(this.getBaseValue())},getBaseValue:function(){var t=this,e=t.min,n=t.max;return t.beginAtZero?0:e<0&&n<0?n:e>0&&n>0?e:0},_autoSkip:function(t){var e,n,i,r,a=this,o=a.options.ticks,s=a._length,l=o.maxTicksLimit||s/a._tickSize()+1,u=o.major.enabled?fi(t):[],d=u.length,c=u[0],h=u[d-1];if(d>l)return pi(t,u,d/l),di(t);if(i=hi(u,t,s,l),d>0){for(e=0,n=d-1;e1?(h-c)/(d-1):null,gi(t,i,ot.isNullOrUndef(r)?0:c-r,c),gi(t,i,h,ot.isNullOrUndef(r)?t.length:h+r),di(t)}return gi(t,i),di(t)},_tickSize:function(){var t=this,e=t.options.ticks,n=ot.toRadians(t.labelRotation),i=Math.abs(Math.cos(n)),r=Math.abs(Math.sin(n)),a=t._getLabelSizes(),o=e.autoSkipPadding||0,s=a?a.widest.width+o:0,l=a?a.highest.height+o:0;return t.isHorizontal()?l*i>s*r?s/i:l/r:l*r=0&&(o=t),void 0!==a&&(t=n.indexOf(a))>=0&&(s=t),e.minIndex=o,e.maxIndex=s,e.min=n[o],e.max=n[s]},buildTicks:function(){var t=this,e=t._getLabels(),n=t.minIndex,i=t.maxIndex;t.ticks=0===n&&i===e.length-1?e:e.slice(n,i+1)},getLabelForIndex:function(t,e){var n=this,i=n.chart;return i.getDatasetMeta(e).controller._getValueScaleId()===n.id?n.getRightValue(i.data.datasets[e].data[t]):n._getLabels()[t]},_configure:function(){var t=this,e=t.options.offset,n=t.ticks;vi.prototype._configure.call(t),t.isHorizontal()||(t._reversePixels=!t._reversePixels),n&&(t._startValue=t.minIndex-(e?.5:0),t._valueRange=Math.max(n.length-(e?0:1),1))},getPixelForValue:function(t,e,n){var i,r,a,o=this;return yi(e)||yi(n)||(t=o.chart.data.datasets[n].data[e]),yi(t)||(i=o.isHorizontal()?t.x:t.y),(void 0!==i||void 0!==t&&isNaN(e))&&(r=o._getLabels(),t=ot.valueOrDefault(i,t),e=-1!==(a=r.indexOf(t))?a:e,isNaN(e)&&(e=t)),o.getPixelForDecimal((e-o._startValue)/o._valueRange)},getPixelForTick:function(t){var e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t],t+this.minIndex)},getValueForPixel:function(t){var e=this,n=Math.round(e._startValue+e.getDecimalForPixel(t)*e._valueRange);return Math.min(Math.max(n,0),e.ticks.length-1)},getBasePixel:function(){return this.bottom}}),xi=bi;_i._defaults=xi;var wi=ot.noop,ki=ot.isNullOrUndef;function Si(t,e){var n,i,r,a,o=[],s=1e-14,l=t.stepSize,u=l||1,d=t.maxTicks-1,c=t.min,h=t.max,f=t.precision,p=e.min,g=e.max,m=ot.niceNum((g-p)/d/u)*u;if(md&&(m=ot.niceNum(a*m/d/u)*u),l||ki(f)?n=Math.pow(10,ot._decimalPlaces(m)):(n=Math.pow(10,f),m=Math.ceil(m*n)/n),i=Math.floor(p/m)*m,r=Math.ceil(g/m)*m,l&&(!ki(c)&&ot.almostWhole(c/m,m/1e3)&&(i=c),!ki(h)&&ot.almostWhole(h/m,m/1e3)&&(r=h)),a=(r-i)/m,a=ot.almostEquals(a,Math.round(a),m/1e3)?Math.round(a):Math.ceil(a),i=Math.round(i*n)/n,r=Math.round(r*n)/n,o.push(ki(c)?i:c);for(var v=1;v0&&i>0&&(t.min=0)}var r=void 0!==e.min||void 0!==e.suggestedMin,a=void 0!==e.max||void 0!==e.suggestedMax;void 0!==e.min?t.min=e.min:void 0!==e.suggestedMin&&(null===t.min?t.min=e.suggestedMin:t.min=Math.min(t.min,e.suggestedMin)),void 0!==e.max?t.max=e.max:void 0!==e.suggestedMax&&(null===t.max?t.max=e.suggestedMax:t.max=Math.max(t.max,e.suggestedMax)),r!==a&&t.min>=t.max&&(r?t.max=t.min+1:t.min=t.max-1),t.min===t.max&&(t.max++,e.beginAtZero||t.min--)},getTickLimit:function(){var t,e=this,n=e.options.ticks,i=n.stepSize,r=n.maxTicksLimit;return i?t=Math.ceil(e.max/i)-Math.floor(e.min/i)+1:(t=e._computeTickLimit(),r=r||11),r&&(t=Math.min(r,t)),t},_computeTickLimit:function(){return Number.POSITIVE_INFINITY},handleDirectionalChanges:wi,buildTicks:function(){var t=this,e=t.options.ticks,n=t.getTickLimit(),i={maxTicks:n=Math.max(2,n),min:e.min,max:e.max,precision:e.precision,stepSize:ot.valueOrDefault(e.fixedStepSize,e.stepSize)},r=t.ticks=Si(i,t);t.handleDirectionalChanges(),t.max=ot.max(r),t.min=ot.min(r),e.reverse?(r.reverse(),t.start=t.max,t.end=t.min):(t.start=t.min,t.end=t.max)},convertTicksToLabels:function(){var t=this;t.ticksAsNumbers=t.ticks.slice(),t.zeroLineIndex=t.ticks.indexOf(0),vi.prototype.convertTicksToLabels.call(t)},_configure:function(){var t,e=this,n=e.getTicks(),i=e.min,r=e.max;vi.prototype._configure.call(e),e.options.offset&&n.length&&(i-=t=(r-i)/Math.max(n.length-1,1)/2,r+=t),e._startValue=i,e._endValue=r,e._valueRange=r-i}}),Di={position:"left",ticks:{callback:Jn.formatters.linear}},Ci=0,Pi=1;function Ti(t,e,n){var i=[n.type,void 0===e&&void 0===n.stack?n.index:"",n.stack].join(".");return void 0===t[i]&&(t[i]={pos:[],neg:[]}),t[i]}function Ai(t,e,n,i){var r,a,o=t.options,s=Ti(e,o.stacked,n),l=s.pos,u=s.neg,d=i.length;for(r=0;re.length-1?null:this.getPixelForValue(e[t])}}),Fi=Di;Ni._defaults=Fi;var Ii=ot.valueOrDefault,Ri=ot.math.log10;function Li(t,e){var n,i,r=[],a=Ii(t.min,Math.pow(10,Math.floor(Ri(e.min)))),o=Math.floor(Ri(e.max)),s=Math.ceil(e.max/Math.pow(10,o));0===a?(n=Math.floor(Ri(e.minNotZero)),i=Math.floor(e.minNotZero/Math.pow(10,n)),r.push(a),a=i*Math.pow(10,n)):(n=Math.floor(Ri(a)),i=Math.floor(a/Math.pow(10,n)));var l=n<0?Math.pow(10,Math.abs(n)):1;do{r.push(a),10==++i&&(i=1,l=++n>=0?1:l),a=Math.round(i*Math.pow(10,n)*l)/l}while(n=0?t:e}var Yi=vi.extend({determineDataLimits:function(){var t,e,n,i,r,a,o=this,s=o.options,l=o.chart,u=l.data.datasets,d=o.isHorizontal();function c(t){return d?t.xAxisID===o.id:t.yAxisID===o.id}o.min=Number.POSITIVE_INFINITY,o.max=Number.NEGATIVE_INFINITY,o.minNotZero=Number.POSITIVE_INFINITY;var h=s.stacked;if(void 0===h)for(t=0;t0){var e=ot.min(t),n=ot.max(t);o.min=Math.min(o.min,e),o.max=Math.max(o.max,n)}}))}else for(t=0;t0?t.minNotZero=t.min:t.max<1?t.minNotZero=Math.pow(10,Math.floor(Ri(t.max))):t.minNotZero=n)},buildTicks:function(){var t=this,e=t.options.ticks,n=!t.isHorizontal(),i={min:Wi(e.min),max:Wi(e.max)},r=t.ticks=Li(i,t);t.max=ot.max(r),t.min=ot.min(r),e.reverse?(n=!n,t.start=t.max,t.end=t.min):(t.start=t.min,t.end=t.max),n&&r.reverse()},convertTicksToLabels:function(){this.tickValues=this.ticks.slice(),vi.prototype.convertTicksToLabels.call(this)},getLabelForIndex:function(t,e){return this._getScaleLabel(this.chart.data.datasets[e].data[t])},getPixelForTick:function(t){var e=this.tickValues;return t<0||t>e.length-1?null:this.getPixelForValue(e[t])},_getFirstTickValue:function(t){var e=Math.floor(Ri(t));return Math.floor(t/Math.pow(10,e))*Math.pow(10,e)},_configure:function(){var t=this,e=t.min,n=0;vi.prototype._configure.call(t),0===e&&(e=t._getFirstTickValue(t.minNotZero),n=Ii(t.options.ticks.fontSize,K.global.defaultFontSize)/t._length),t._startValue=Ri(e),t._valueOffset=n,t._valueRange=(Ri(t.max)-Ri(e))/(1-n)},getPixelForValue:function(t){var e=this,n=0;return(t=+e.getRightValue(t))>e.min&&t>0&&(n=(Ri(t)-e._startValue)/e._valueRange+e._valueOffset),e.getPixelForDecimal(n)},getValueForPixel:function(t){var e=this,n=e.getDecimalForPixel(t);return 0===n&&0===e.min?0:Math.pow(10,e._startValue+(n-e._valueOffset)*e._valueRange)}}),Vi=Ei;Yi._defaults=Vi;var zi=ot.valueOrDefault,Bi=ot.valueAtIndexOrDefault,Hi=ot.options.resolve,Ui={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,color:"rgba(0,0,0,0.1)",lineWidth:1,borderDash:[],borderDashOffset:0},gridLines:{circular:!1},ticks:{showLabelBackdrop:!0,backdropColor:"rgba(255,255,255,0.75)",backdropPaddingY:2,backdropPaddingX:2,callback:Jn.formatters.linear},pointLabels:{display:!0,fontSize:10,callback:function(t){return t}}};function ji(t){var e=t.ticks;return e.display&&t.display?zi(e.fontSize,K.global.defaultFontSize)+2*e.backdropPaddingY:0}function qi(t,e,n){return ot.isArray(n)?{w:ot.longestText(t,t.font,n),h:n.length*e}:{w:t.measureText(n).width,h:e}}function Gi(t,e,n,i,r){return t===i||t===r?{start:e-n/2,end:e+n/2}:tr?{start:e-n,end:e}:{start:e,end:e+n}}function $i(t){var e,n,i,r=ot.options._parseFont(t.options.pointLabels),a={l:0,r:t.width,t:0,b:t.height-t.paddingTop},o={};t.ctx.font=r.string,t._pointLabelSizes=[];var s=t.chart.data.labels.length;for(e=0;ea.r&&(a.r=d.end,o.r=l),c.starta.b&&(a.b=c.end,o.b=l)}t.setReductions(t.drawingArea,a,o)}function Zi(t){return 0===t||180===t?"center":t<180?"left":"right"}function Xi(t,e,n,i){var r,a,o=n.y+i/2;if(ot.isArray(e))for(r=0,a=e.length;r270||t<90)&&(n.y-=e.h)}function Ki(t){var e=t.ctx,n=t.options,i=n.pointLabels,r=ji(n),a=t.getDistanceFromCenterForValue(n.ticks.reverse?t.min:t.max),o=ot.options._parseFont(i);e.save(),e.font=o.string,e.textBaseline="middle";for(var s=t.chart.data.labels.length-1;s>=0;s--){var l=0===s?r/2:0,u=t.getPointPosition(s,a+l+5),d=Bi(i.fontColor,s,K.global.defaultFontColor);e.fillStyle=d;var c=t.getIndexAngle(s),h=ot.toDegrees(c);e.textAlign=Zi(h),Ji(h,t._pointLabelSizes[s],u),Xi(e,t.pointLabels[s],u,o.lineHeight)}e.restore()}function Qi(t,e,n,i){var r,a=t.ctx,o=e.circular,s=t.chart.data.labels.length,l=Bi(e.color,i-1),u=Bi(e.lineWidth,i-1);if((o||s)&&l&&u){if(a.save(),a.strokeStyle=l,a.lineWidth=u,a.setLineDash&&(a.setLineDash(e.borderDash||[]),a.lineDashOffset=e.borderDashOffset||0),a.beginPath(),o)a.arc(t.xCenter,t.yCenter,n,0,2*Math.PI);else{r=t.getPointPosition(0,n),a.moveTo(r.x,r.y);for(var d=1;d0&&i>0?n:0)},_drawGrid:function(){var t,e,n,i=this,r=i.ctx,a=i.options,o=a.gridLines,s=a.angleLines,l=zi(s.lineWidth,o.lineWidth),u=zi(s.color,o.color);if(a.pointLabels.display&&Ki(i),o.display&&ot.each(i.ticks,(function(t,n){0!==n&&(e=i.getDistanceFromCenterForValue(i.ticksAsNumbers[n]),Qi(i,o,e,n))})),s.display&&l&&u){for(r.save(),r.lineWidth=l,r.strokeStyle=u,r.setLineDash&&(r.setLineDash(Hi([s.borderDash,o.borderDash,[]])),r.lineDashOffset=Hi([s.borderDashOffset,o.borderDashOffset,0])),t=i.chart.data.labels.length-1;t>=0;t--)e=i.getDistanceFromCenterForValue(a.ticks.reverse?i.min:i.max),n=i.getPointPosition(t,e),r.beginPath(),r.moveTo(i.xCenter,i.yCenter),r.lineTo(n.x,n.y),r.stroke();r.restore()}},_drawLabels:function(){var t=this,e=t.ctx,n=t.options.ticks;if(n.display){var i,r,a=t.getIndexAngle(0),o=ot.options._parseFont(n),s=zi(n.fontColor,K.global.defaultFontColor);e.save(),e.font=o.string,e.translate(t.xCenter,t.yCenter),e.rotate(a),e.textAlign="center",e.textBaseline="middle",ot.each(t.ticks,(function(a,l){(0!==l||n.reverse)&&(i=t.getDistanceFromCenterForValue(t.ticksAsNumbers[l]),n.showLabelBackdrop&&(r=e.measureText(a).width,e.fillStyle=n.backdropColor,e.fillRect(-r/2-n.backdropPaddingX,-i-o.size/2-n.backdropPaddingY,r+2*n.backdropPaddingX,o.size+2*n.backdropPaddingY)),e.fillStyle=s,e.fillText(a,0,-i))})),e.restore()}},_drawTitle:ot.noop}),nr=Ui;er._defaults=nr;var ir=ot._deprecated,rr=ot.options.resolve,ar=ot.valueOrDefault,or=Number.MIN_SAFE_INTEGER||-9007199254740991,sr=Number.MAX_SAFE_INTEGER||9007199254740991,lr={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}},ur=Object.keys(lr);function dr(t,e){return t-e}function cr(t){var e,n,i,r={},a=[];for(e=0,n=t.length;ee&&s=0&&o<=s;){if(r=t[(i=o+s>>1)-1]||null,a=t[i],!r)return{lo:null,hi:a};if(a[e]n))return{lo:r,hi:a};s=i-1}}return{lo:a,hi:null}}function mr(t,e,n,i){var r=gr(t,e,n),a=r.lo?r.hi?r.lo:t[t.length-2]:t[0],o=r.lo?r.hi?r.hi:t[t.length-1]:t[1],s=o[e]-a[e],l=s?(n-a[e])/s:0,u=(o[i]-a[i])*l;return a[i]+u}function vr(t,e){var n=t._adapter,i=t.options.time,r=i.parser,a=r||i.format,o=e;return"function"==typeof r&&(o=r(o)),ot.isFinite(o)||(o="string"==typeof a?n.parse(o,a):n.parse(o)),null!==o?+o:(r||"function"!=typeof a||(o=a(e),ot.isFinite(o)||(o=n.parse(o))),o)}function yr(t,e){if(ot.isNullOrUndef(e))return null;var n=t.options.time,i=vr(t,t.getRightValue(e));return null===i||n.round&&(i=+t._adapter.startOf(i,n.round)),i}function br(t,e,n,i){var r,a,o,s=ur.length;for(r=ur.indexOf(t);r=ur.indexOf(n);a--)if(o=ur[a],lr[o].common&&t._adapter.diff(r,i,o)>=e-1)return o;return ur[n?ur.indexOf(n):0]}function xr(t){for(var e=ur.indexOf(t)+1,n=ur.length;e1e5*u)throw e+" and "+n+" are too far apart with stepSize of "+u+" "+l;for(r=c;r=0&&(e[a].major=!0);return e}function Mr(t,e,n){var i,r,a=[],o={},s=e.length;for(i=0;i1?cr(p).sort(dr):p.sort(dr),h=Math.min(h,p[0]),f=Math.max(f,p[p.length-1])),h=yr(s,hr(d))||h,f=yr(s,fr(d))||f,h=h===sr?+u.startOf(Date.now(),c):h,f=f===or?+u.endOf(Date.now(),c)+1:f,s.min=Math.min(h,f),s.max=Math.max(h+1,f),s._table=[],s._timestamps={data:p,datasets:g,labels:m}},buildTicks:function(){var t,e,n,i=this,r=i.min,a=i.max,o=i.options,s=o.ticks,l=o.time,u=i._timestamps,d=[],c=i.getLabelCapacity(r),h=s.source,f=o.distribution;for(u="data"===h||"auto"===h&&"series"===f?u.data:"labels"===h?u.labels:wr(i,r,a,c),"ticks"===o.bounds&&u.length&&(r=u[0],a=u[u.length-1]),r=yr(i,hr(o))||r,a=yr(i,fr(o))||a,t=0,e=u.length;t=r&&n<=a&&d.push(n);return i.min=r,i.max=a,i._unit=l.unit||(s.autoSkip?br(l.minUnit,i.min,i.max,c):_r(i,d.length,l.minUnit,i.min,i.max)),i._majorUnit=s.major.enabled&&"year"!==i._unit?xr(i._unit):void 0,i._table=pr(i._timestamps.data,r,a,f),i._offsets=kr(i._table,d,r,a,o),s.reverse&&d.reverse(),Mr(i,d,i._majorUnit)},getLabelForIndex:function(t,e){var n=this,i=n._adapter,r=n.chart.data,a=n.options.time,o=r.labels&&t=0&&t0?s:1}}),Pr=Dr;Cr._defaults=Pr;var Tr={category:_i,linear:Ni,logarithmic:Yi,radialLinear:er,time:Cr},Ar={datetime:"MMM D, YYYY, h:mm:ss a",millisecond:"h:mm:ss.SSS a",second:"h:mm:ss a",minute:"h:mm a",hour:"hA",day:"MMM D",week:"ll",month:"MMM YYYY",quarter:"[Q]Q - YYYY",year:"YYYY"};Xn._date.override("function"==typeof t?{_id:"moment",formats:function(){return Ar},parse:function(e,n){return"string"==typeof e&&"string"==typeof n?e=t(e,n):e instanceof t||(e=t(e)),e.isValid()?e.valueOf():null},format:function(e,n){return t(e).format(n)},add:function(e,n,i){return t(e).add(n,i).valueOf()},diff:function(e,n,i){return t(e).diff(t(n),i)},startOf:function(e,n,i){return e=t(e),"isoWeek"===n?e.isoWeekday(i).valueOf():e.startOf(n).valueOf()},endOf:function(e,n){return t(e).endOf(n).valueOf()},_create:function(e){return t(e)}}:{}),K._set("global",{plugins:{filler:{propagate:!0}}});var Or={dataset:function(t){var e=t.fill,n=t.chart,i=n.getDatasetMeta(e),r=i&&n.isDatasetVisible(e)&&i.dataset._children||[],a=r.length||0;return a?function(t,e){return e=n)&&i;switch(a){case"bottom":return"start";case"top":return"end";case"zero":return"origin";case"origin":case"start":case"end":return a;default:return!1}}function Fr(t){var e,n=t.el._model||{},i=t.el._scale||{},r=t.fill,a=null;if(isFinite(r))return null;if("start"===r?a=void 0===n.scaleBottom?i.bottom:n.scaleBottom:"end"===r?a=void 0===n.scaleTop?i.top:n.scaleTop:void 0!==n.scaleZero?a=n.scaleZero:i.getBasePixel&&(a=i.getBasePixel()),null!=a){if(void 0!==a.x&&void 0!==a.y)return a;if(ot.isFinite(a))return{x:(e=i.isHorizontal())?a:null,y:e?null:a}}return null}function Ir(t){var e,n,i,r,a,o=t.el._scale,s=o.options,l=o.chart.data.labels.length,u=t.fill,d=[];if(!l)return null;for(e=s.ticks.reverse?o.max:o.min,n=s.ticks.reverse?o.min:o.max,i=o.getPointPositionForValue(0,e),r=0;r0;--a)ot.canvas.lineTo(t,n[a],n[a-1],!0);else for(o=n[0].cx,s=n[0].cy,l=Math.sqrt(Math.pow(n[0].x-o,2)+Math.pow(n[0].y-s,2)),a=r-1;a>0;--a)t.arc(o,s,l,n[a].angle,n[a-1].angle,!0)}}function Vr(t,e,n,i,r,a){var o,s,l,u,d,c,h,f,p=e.length,g=i.spanGaps,m=[],v=[],y=0,b=0;for(t.beginPath(),o=0,s=p;o=0;--n)(e=l[n].$filler)&&e.visible&&(r=(i=e.el)._view,a=i._children||[],o=e.mapper,s=r.backgroundColor||K.global.defaultColor,o&&s&&a.length&&(ot.canvas.clipArea(u,t.chartArea),Vr(u,a,o,r,s,i._loop),ot.canvas.unclipArea(u)))}},Br=ot.rtl.getRtlAdapter,Hr=ot.noop,Ur=ot.valueOrDefault;function jr(t,e){return t.usePointStyle&&t.boxWidth>e?e:t.boxWidth}K._set("global",{legend:{display:!0,position:"top",align:"center",fullWidth:!0,reverse:!1,weight:1e3,onClick:function(t,e){var n=e.datasetIndex,i=this.chart,r=i.getDatasetMeta(n);r.hidden=null===r.hidden?!i.data.datasets[n].hidden:null,i.update()},onHover:null,onLeave:null,labels:{boxWidth:40,padding:10,generateLabels:function(t){var e=t.data.datasets,n=t.options.legend||{},i=n.labels&&n.labels.usePointStyle;return t._getSortedDatasetMetas().map((function(n){var r=n.controller.getStyle(i?0:void 0);return{text:e[n.index].label,fillStyle:r.backgroundColor,hidden:!t.isDatasetVisible(n.index),lineCap:r.borderCapStyle,lineDash:r.borderDash,lineDashOffset:r.borderDashOffset,lineJoin:r.borderJoinStyle,lineWidth:r.borderWidth,strokeStyle:r.borderColor,pointStyle:r.pointStyle,rotation:r.rotation,datasetIndex:n.index}}),this)}}},legendCallback:function(t){var e,n,i,r=document.createElement("ul"),a=t.data.datasets;for(r.setAttribute("class",t.id+"-legend"),e=0,n=a.length;el.width)&&(c+=o+n.padding,d[d.length-(e>0?0:1)]=0),s[e]={left:0,top:0,width:i,height:o},d[d.length-1]+=i+n.padding})),l.height+=c}else{var h=n.padding,f=t.columnWidths=[],p=t.columnHeights=[],g=n.padding,m=0,v=0;ot.each(t.legendItems,(function(t,e){var i=jr(n,o)+o/2+r.measureText(t.text).width;e>0&&v+o+2*h>l.height&&(g+=m+n.padding,f.push(m),p.push(v),m=0,v=0),m=Math.max(m,i),v+=o+h,s[e]={left:0,top:0,width:i,height:o}})),g+=m,f.push(m),p.push(v),l.width+=g}t.width=l.width,t.height=l.height}else t.width=l.width=t.height=l.height=0},afterFit:Hr,isHorizontal:function(){return"top"===this.options.position||"bottom"===this.options.position},draw:function(){var t=this,e=t.options,n=e.labels,i=K.global,r=i.defaultColor,a=i.elements.line,o=t.height,s=t.columnHeights,l=t.width,u=t.lineWidths;if(e.display){var d,c=Br(e.rtl,t.left,t.minSize.width),h=t.ctx,f=Ur(n.fontColor,i.defaultFontColor),p=ot.options._parseFont(n),g=p.size;h.textAlign=c.textAlign("left"),h.textBaseline="middle",h.lineWidth=.5,h.strokeStyle=f,h.fillStyle=f,h.font=p.string;var m=jr(n,g),v=t.legendHitBoxes,y=function(t,e,i){if(!(isNaN(m)||m<=0)){h.save();var o=Ur(i.lineWidth,a.borderWidth);if(h.fillStyle=Ur(i.fillStyle,r),h.lineCap=Ur(i.lineCap,a.borderCapStyle),h.lineDashOffset=Ur(i.lineDashOffset,a.borderDashOffset),h.lineJoin=Ur(i.lineJoin,a.borderJoinStyle),h.lineWidth=o,h.strokeStyle=Ur(i.strokeStyle,r),h.setLineDash&&h.setLineDash(Ur(i.lineDash,a.borderDash)),n&&n.usePointStyle){var s=m*Math.SQRT2/2,l=c.xPlus(t,m/2),u=e+g/2;ot.canvas.drawPoint(h,i.pointStyle,s,l,u,i.rotation)}else h.fillRect(c.leftForLtr(t,m),e,m,g),0!==o&&h.strokeRect(c.leftForLtr(t,m),e,m,g);h.restore()}},b=function(t,e,n,i){var r=g/2,a=c.xPlus(t,m+r),o=e+r;h.fillText(n.text,a,o),n.hidden&&(h.beginPath(),h.lineWidth=2,h.moveTo(a,o),h.lineTo(c.xPlus(a,i),o),h.stroke())},_=function(t,i){switch(e.align){case"start":return n.padding;case"end":return t-i;default:return(t-i+n.padding)/2}},x=t.isHorizontal();d=x?{x:t.left+_(l,u[0]),y:t.top+n.padding,line:0}:{x:t.left+n.padding,y:t.top+_(o,s[0]),line:0},ot.rtl.overrideTextDirection(t.ctx,e.textDirection);var w=g+n.padding;ot.each(t.legendItems,(function(e,i){var r=h.measureText(e.text).width,a=m+g/2+r,f=d.x,p=d.y;c.setWidth(t.minSize.width),x?i>0&&f+a+n.padding>t.left+t.minSize.width&&(p=d.y+=w,d.line++,f=d.x=t.left+_(l,u[d.line])):i>0&&p+w>t.top+t.minSize.height&&(f=d.x=f+t.columnWidths[d.line]+n.padding,d.line++,p=d.y=t.top+_(o,s[d.line]));var k=c.x(f);y(k,p,e),v[i].left=c.leftForLtr(k,v[i].width),v[i].top=p,b(k,p,e,r),x?d.x+=a+n.padding:d.y+=w})),ot.rtl.restoreTextDirection(t.ctx,e.textDirection)}},_getLegendItemAt:function(t,e){var n,i,r,a=this;if(t>=a.left&&t<=a.right&&e>=a.top&&e<=a.bottom)for(r=a.legendHitBoxes,n=0;n=(i=r[n]).left&&t<=i.left+i.width&&e>=i.top&&e<=i.top+i.height)return a.legendItems[n];return null},handleEvent:function(t){var e,n=this,i=n.options,r="mouseup"===t.type?"click":t.type;if("mousemove"===r){if(!i.onHover&&!i.onLeave)return}else{if("click"!==r)return;if(!i.onClick)return}e=n._getLegendItemAt(t.x,t.y),"click"===r?e&&i.onClick&&i.onClick.call(n,t.native,e):(i.onLeave&&e!==n._hoveredItem&&(n._hoveredItem&&i.onLeave.call(n,t.native,n._hoveredItem),n._hoveredItem=e),i.onHover&&e&&i.onHover.call(n,t.native,e))}});function Gr(t,e){var n=new qr({ctx:t.ctx,options:e,chart:t});Ue.configure(t,n,e),Ue.addBox(t,n),t.legend=n}var $r={id:"legend",_element:qr,beforeInit:function(t){var e=t.options.legend;e&&Gr(t,e)},beforeUpdate:function(t){var e=t.options.legend,n=t.legend;e?(ot.mergeIf(e,K.global.legend),n?(Ue.configure(t,n,e),n.options=e):Gr(t,e)):n&&(Ue.removeBox(t,n),delete t.legend)},afterEvent:function(t,e){var n=t.legend;n&&n.handleEvent(e)}},Zr=ot.noop;K._set("global",{title:{display:!1,fontStyle:"bold",fullWidth:!0,padding:10,position:"top",text:"",weight:2e3}});var Xr=pt.extend({initialize:function(t){var e=this;ot.extend(e,t),e.legendHitBoxes=[]},beforeUpdate:Zr,update:function(t,e,n){var i=this;return i.beforeUpdate(),i.maxWidth=t,i.maxHeight=e,i.margins=n,i.beforeSetDimensions(),i.setDimensions(),i.afterSetDimensions(),i.beforeBuildLabels(),i.buildLabels(),i.afterBuildLabels(),i.beforeFit(),i.fit(),i.afterFit(),i.afterUpdate(),i.minSize},afterUpdate:Zr,beforeSetDimensions:Zr,setDimensions:function(){var t=this;t.isHorizontal()?(t.width=t.maxWidth,t.left=0,t.right=t.width):(t.height=t.maxHeight,t.top=0,t.bottom=t.height),t.paddingLeft=0,t.paddingTop=0,t.paddingRight=0,t.paddingBottom=0,t.minSize={width:0,height:0}},afterSetDimensions:Zr,beforeBuildLabels:Zr,buildLabels:Zr,afterBuildLabels:Zr,beforeFit:Zr,fit:function(){var t,e=this,n=e.options,i=e.minSize={},r=e.isHorizontal();n.display?(t=(ot.isArray(n.text)?n.text.length:1)*ot.options._parseFont(n).lineHeight+2*n.padding,e.width=i.width=r?e.maxWidth:t,e.height=i.height=r?t:e.maxHeight):e.width=i.width=e.height=i.height=0},afterFit:Zr,isHorizontal:function(){var t=this.options.position;return"top"===t||"bottom"===t},draw:function(){var t=this,e=t.ctx,n=t.options;if(n.display){var i,r,a,o=ot.options._parseFont(n),s=o.lineHeight,l=s/2+n.padding,u=0,d=t.top,c=t.left,h=t.bottom,f=t.right;e.fillStyle=ot.valueOrDefault(n.fontColor,K.global.defaultFontColor),e.font=o.string,t.isHorizontal()?(r=c+(f-c)/2,a=d+l,i=f-c):(r="left"===n.position?c+l:f-l,a=d+(h-d)/2,i=h-d,u=Math.PI*("left"===n.position?-.5:.5)),e.save(),e.translate(r,a),e.rotate(u),e.textAlign="center",e.textBaseline="middle";var p=n.text;if(ot.isArray(p))for(var g=0,m=0;m{this.chart&&this.chart.resize()}))}static get styles(){return tt`:host{position:relative;height:100%;width:100%;display:block;min-height:25rem}canvas{width:100px;height:100px}`}firstUpdated(){fetch(this.url).then((t=>t.json())).catch((t=>console.error(t))).then((t=>{var e;let n=(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector("canvas")).getContext("2d");this.chart=new ot(n,{type:"bar",data:{datasets:[{label:"Failed Logins",backgroundColor:"rgba(201, 25, 11, .5)",spanGaps:!0,data:t.logins_failed_per_1h},{label:"Successful Logins",backgroundColor:"rgba(189, 229, 184, .5)",spanGaps:!0,data:t.logins_per_1h}]},options:{maintainAspectRatio:!1,spanGaps:!0,scales:{xAxes:[{stacked:!0,gridLines:{color:"rgba(0, 0, 0, 0)"},type:"time",offset:!0,ticks:{callback:function(t,e,n){const i=n[e],r=Date.now()-i.value;return Math.round(r/1e3/3600)+" Hours ago"},autoSkip:!0,maxTicksLimit:8}}],yAxes:[{stacked:!0,gridLines:{color:"rgba(0, 0, 0, 0)"}}]}}})}))}render(){return E``}};t([X()],st.prototype,"url",void 0),st=t([$("pb-admin-logins-chart")],st);const lt={error:"fas fa-exclamation-circle",warning:"fas fa-exclamation-triangle",success:"fas fa-check-circle",info:"fas fa-info"};function ut(){(null===document||void 0===document?void 0:document.querySelector("pb-messages")).fetchMessages()}let dt=class extends nt{constructor(){super(...arguments),this.url="",this.messages=[]}createRenderRoot(){return this}firstUpdated(){this.fetchMessages()}fetchMessages(){return fetch(this.url).then((t=>t.json())).then((t=>this.messages=t)).then((t=>{const e=this.querySelector(".pf-c-alert-group");t.forEach((t=>{const n=this.renderMessage(t);e.appendChild(n)}))}))}renderMessage(t){const e="pb-message"+Math.random().toString(36).substr(2,9);const n=document.createElement("template");return n.innerHTML=`
    • \n
      \n
      \n \n
      \n

      \n ${t.message}\n

      \n
      \n
    • `,setTimeout((()=>{var t;null===(t=this.querySelector("#"+e))||void 0===t||t.remove()}),1500),n.content.firstChild}render(){return E`
        `}};t([X()],dt.prototype,"url",void 0),t([X()],dt.prototype,"messages",void 0),dt=t([$("pb-messages")],dt);const ct=["pf-m-progress","pf-m-in-progress"];let ht=class extends nt{constructor(){var t;super(),this.url="",this.isRunning=!1,null===(t=this.querySelector("button"))||void 0===t||t.addEventListener("click",(t=>this.callAction()))}setLoading(){this.isRunning=!0,this.classList.add(...ct)}setDone(t){this.isRunning=!1,this.classList.remove(...ct),this.classList.replace("pf-m-primary",t),ut(),setTimeout((()=>{this.classList.replace(t,"pf-m-primary")}),1e3)}callAction(){if(!0===this.isRunning)return;this.setLoading();const t=function(t){let e=null;if(document.cookie&&""!==document.cookie){const n=document.cookie.split(";");for(let i=0;it.json())).then((t=>{this.setDone("pf-m-success")})).catch((()=>{this.setDone("pf-m-danger")}))}render(){return E``}};t([X()],ht.prototype,"url",void 0),ht=t([$("pb-action-button")],ht);let ft=class extends nt{constructor(){super();const t=this.querySelector(".pf-c-dropdown__menu");this.querySelectorAll("button").forEach((e=>{e.addEventListener("click",(e=>{t.hidden=!t.hidden}))}))}render(){return E``}};ft=t([$("pb-dropdown")],ft);let pt=class extends nt{constructor(){super(...arguments),this.url="",this.key="",this.value=""}comparison(t){let e={"<":function(t,e){return t":function(t,e){return t>e},">=":function(t,e){return t>=e},"<=":function(t,e){return t<=e},"==":function(t,e){return t==e},"!=":function(t,e){return t!=e},"===":function(t,e){return t===e},"!==":function(t,e){return t!==e}};const n=t.split(" ");if(n.length<3)throw new Error("nah");let i=n[0];i="value"===i?this.value:parseInt(i,10);let r=n[2];r="value"===r?this.value:parseInt(r,10);const a=n[1];if(!(a in e))throw new Error("Invalid comparison");return e[a](i,r)}firstUpdated(){fetch(this.url).then((t=>t.json())).then((t=>t[this.key])).then((t=>this.value=t))}render(){if(void 0===this.value)return E``;let t="";return this.querySelectorAll("[slot]").forEach((e=>{const n=e.getAttribute("slot");this.comparison(n)&&(t=n)})),this.querySelectorAll("[data-value]").forEach((t=>{t.textContent=this.value})),E``}};var gt;t([X()],pt.prototype,"url",void 0),t([X()],pt.prototype,"key",void 0),t([X()],pt.prototype,"value",void 0),pt=t([$("fetch-fill-slot")],pt),function(t){t[t.redirect=0]="redirect",t[t.template=1]="template"}(gt||(gt={}));let mt=class extends nt{constructor(){super(...arguments),this.flowBodyUrl="",this.flowBody=void 0}createRenderRoot(){return this}firstUpdated(){fetch(this.flowBodyUrl).then((t=>{if(!t.ok)throw Error(t.statusText);return t})).then((t=>t.json())).then((t=>{this.updateCard(t)})).catch((t=>{this.errorMessage(t)}))}async updateCard(t){switch(t.type){case gt.redirect:window.location.assign(t.to);break;case gt.template:this.flowBody=t.body,await this.requestUpdate(),this.checkAutofocus(),ut(),this.loadFormCode(),this.setFormSubmitHandlers()}}loadFormCode(){this.querySelectorAll("script").forEach((t=>{let e=document.createElement("script");e.src=t.src,document.head.appendChild(e)}))}checkAutofocus(){const t=this.querySelector("[autofocus]");null!==t&&t.focus()}updateFormAction(t){for(let e=0;e{console.log("passbook/flows: Checking for autosubmit attribute "+t),this.checkAutosubmit(t),console.log("passbook/flows: Setting action for form "+t),this.updateFormAction(t),console.log("passbook/flows: Adding handler for form "+t),t.addEventListener("submit",(e=>{e.preventDefault();let n=new FormData(t);this.flowBody=void 0,fetch(this.flowBodyUrl,{method:"post",body:n}).then((t=>t.json())).then((t=>{this.updateCard(t)})).catch((t=>{this.errorMessage(t)}))})),t.classList.add("pb-flow-wrapped")}))}errorMessage(t){this.flowBody=`\n \n \n `}loading(){return E``}render(){return void 0!==this.flowBody?E`${this.flowBody}`:this.loading()}};t([X()],mt.prototype,"flowBodyUrl",void 0),t([X()],mt.prototype,"flowBody",void 0),mt=t([$("flow-shell-card")],mt);let vt=class extends nt{constructor(){super(...arguments),this._currentPage="",this._firstPage=""}get currentPage(){return this._currentPage}set currentPage(t){var e,n;try{null===(e=this.querySelector(`.pf-c-tab-content[tab-name='${t}']`))||void 0===e||e.removeAttribute("hidden"),null===(n=this.querySelector(`.pf-c-tabs__item[tab-name='${t}']`))||void 0===n||n.classList.add("pf-m-current"),this.querySelectorAll(`.pf-c-tab-content:not([tab-name='${t}'])`).forEach((t=>{t.setAttribute("hidden","")})),this.querySelectorAll(`.pf-c-tabs__item:not([tab-name='${t}'])`).forEach((t=>{t.classList.remove("pf-m-current")})),window.location.hash="#"+t,this._currentPage=t}catch(t){this.currentPage=this._firstPage}}createRenderRoot(){return this}firstUpdated(){var t;this._firstPage=null===(t=this.querySelector(".pf-c-tab-content"))||void 0===t?void 0:t.getAttribute("tab-name"),window.location.hash?this.currentPage=window.location.hash:this.currentPage=this._firstPage,this.querySelectorAll(".pf-c-tabs__item > button").forEach((t=>{t.addEventListener("click",(e=>{var n;let i=null===(n=t.parentElement)||void 0===n?void 0:n.getAttribute("tab-name");this.currentPage=i}))}))}};vt=t([$("pb-tabs")],vt);let yt=class extends nt{constructor(){super(),this.href="",this.addEventListener("click",(t=>this.callAction(t)))}getModal(){return E`
        `}callAction(t){t.preventDefault();const e=new Request(this.href);fetch(e,{method:"POST",mode:"same-origin"}).then((t=>{})).catch((()=>{}))}};t([X()],yt.prototype,"href",void 0),yt=t([$("pb-modal-button")],yt);let bt=class extends nt{set defaultUrl(t){""===window.location.hash&&void 0!==t&&(window.location.hash="#"+t)}createRenderRoot(){return this}constructor(){super(),this.loadContent(),window.addEventListener("hashchange",(t=>this.loadContent()))}loadContent(){let t=window.location.hash.slice(1,1/0);""!==t&&fetch(t).then((t=>t.text())).then((t=>{this.innerHTML=t})).then((()=>{this.querySelectorAll("a").forEach((t=>{if(""!==t.href)try{const e=new URL(t.href),n=e.search||"";t.href=`#${e.pathname}${n}`}catch(e){t.href="#"+t.href}}))}))}render(){return E`${this.innerHTML}`}};t([X()],bt.prototype,"defaultUrl",null),bt=t([$("pb-admin-shell")],bt); //# sourceMappingURL=main.js.map diff --git a/passbook/static/static/passbook/main.js.map b/passbook/static/static/passbook/main.js.map index e4ef4a981..c8621fdaf 100644 --- a/passbook/static/static/passbook/main.js.map +++ b/passbook/static/static/passbook/main.js.map @@ -1 +1 @@ -{"version":3,"file":"main.js","sources":["../src/legacy.js","../node_modules/tslib/tslib.es6.js","../node_modules/lit-html/src/lib/dom.ts","../node_modules/lit-html/src/lib/template.ts","../node_modules/lit-html/src/lib/modify-template.ts","../node_modules/lit-html/src/lib/directive.ts","../node_modules/lit-html/src/lib/part.ts","../node_modules/lit-html/src/lib/template-instance.ts","../node_modules/lit-html/src/lib/template-result.ts","../node_modules/lit-html/src/lib/parts.ts","../node_modules/lit-html/src/lib/template-factory.ts","../node_modules/lit-html/src/lib/render.ts","../node_modules/lit-html/src/lib/default-template-processor.ts","../node_modules/lit-html/src/lit-html.ts","../node_modules/lit-html/src/lib/shady-render.ts","../node_modules/lit-element/src/lib/updating-element.ts","../node_modules/lit-element/src/lib/decorators.ts","../node_modules/lit-element/src/lib/css-tag.ts","../node_modules/lit-element/src/lit-element.ts","../src/Messages.ts","../src/ActionButton.ts","../src/utils.ts","../src/Dropdown.ts","../src/FetchFillSlot.ts","../src/FlowShellCard.ts","../src/Tabs.ts","../src/ModalButton.ts","../src/AdminSiteShell.ts"],"sourcesContent":["// Search clearing\ndocument.querySelectorAll(\"input[type=search]\").forEach((si) => {\n si.addEventListener(\"search\", (e) => {\n if (si.value === \"\") {\n si.parentElement.submit();\n }\n });\n});\n\n// Fetch from data-attributes\ndocument.querySelectorAll(\"[data-pb-fetch-fill]\").forEach((el) => {\n const url = el.dataset.pbFetchFill;\n const key = el.dataset.pbFetchKey;\n fetch(url).then(r => r.json()).then(r => {\n el.textContent = r[key];\n el.value = r[key];\n });\n});\n\n// Modal\ndocument.querySelectorAll(\"[data-target='modal']\").forEach((m) => {\n m.addEventListener(\"click\", (e) => {\n const parentContainer = e.target.closest('[data-target=\"modal\"]');\n const modalId = parentContainer.attributes['data-modal'].value;\n document.querySelector(`#${modalId}`).removeAttribute(\"hidden\");\n });\n});\ndocument.querySelectorAll(\".pf-c-modal-box [data-modal-close]\").forEach((b) => {\n b.addEventListener(\"click\", (e) => {\n const parentContainer = e.target.closest('.pf-c-backdrop');\n parentContainer.setAttribute(\"hidden\", true);\n });\n});\n\n// Make Checkbox label click trigger checkbox toggle\ndocument.querySelectorAll(\".pf-c-check__label\").forEach((checkLabel) => {\n checkLabel.addEventListener(\"click\", (e) => {\n const checkbox = e.target.parentElement.querySelector(\"input[type=checkbox]\");\n checkbox.checked = !checkbox.checked;\n });\n});\n\n// CodeMirror\ndocument.querySelectorAll(\".codemirror\").forEach((cm) => {\n let cmMode = 'xml';\n if ('data-cm-mode' in cm.attributes) {\n cmMode = cm.attributes['data-cm-mode'].value;\n }\n // https://github.com/codemirror/CodeMirror/issues/5092\n cm.removeAttribute(\"required\");\n CodeMirror.fromTextArea(cm, {\n mode: cmMode,\n theme: 'monokai',\n lineNumbers: false,\n readOnly: cm.readOnly,\n autoRefresh: true,\n });\n});\n\n// Automatic slug fields\nconst convertToSlug = (text) => {\n return text\n .toLowerCase()\n .replace(/ /g, '-')\n .replace(/[^\\w-]+/g, '');\n};\n\ndocument.querySelectorAll(\"input[name=name]\").forEach((input) => {\n input.addEventListener(\"input\", (e) => {\n const form = e.target.closest(\"form\");\n if (form === null) {\n return;\n }\n const slugField = form.querySelector(\"input[name=slug]\");\n slugField.value = convertToSlug(e.target.value);\n });\n});\n\n// Hamburger Menu\ndocument.querySelectorAll(\".pf-c-page__header-brand-toggle>button\").forEach((toggle) => {\n toggle.addEventListener(\"click\", (e) => {\n const sidebar = document.querySelector(\".pf-c-page__sidebar\");\n if (sidebar.classList.contains(\"pf-m-expanded\")) {\n // Sidebar already expanded\n sidebar.classList.remove(\"pf-m-expanded\");\n sidebar.style.zIndex = 0;\n } else {\n // Sidebar not expanded yet\n sidebar.classList.add(\"pf-m-expanded\");\n sidebar.style.zIndex = 200;\n }\n });\n});\n\n// Collapsable Menus in Sidebar\ndocument.querySelectorAll(\".pf-m-expandable>.pf-c-nav__link\").forEach((menu) => {\n menu.addEventListener(\"click\", (e) => {\n e.preventDefault();\n menu.parentElement.classList.toggle(\"pf-m-expanded\");\n });\n});\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\ninterface MaybePolyfilledCe extends CustomElementRegistry {\n readonly polyfillWrapFlushCallback?: object;\n}\n\n/**\n * True if the custom elements polyfill is in use.\n */\nexport const isCEPolyfill = typeof window !== 'undefined' &&\n window.customElements != null &&\n (window.customElements as MaybePolyfilledCe).polyfillWrapFlushCallback !==\n undefined;\n\n/**\n * Reparents nodes, starting from `start` (inclusive) to `end` (exclusive),\n * into another container (could be the same container), before `before`. If\n * `before` is null, it appends the nodes to the container.\n */\nexport const reparentNodes =\n (container: Node,\n start: Node|null,\n end: Node|null = null,\n before: Node|null = null): void => {\n while (start !== end) {\n const n = start!.nextSibling;\n container.insertBefore(start!, before);\n start = n;\n }\n };\n\n/**\n * Removes nodes, starting from `start` (inclusive) to `end` (exclusive), from\n * `container`.\n */\nexport const removeNodes =\n (container: Node, start: Node|null, end: Node|null = null): void => {\n while (start !== end) {\n const n = start!.nextSibling;\n container.removeChild(start!);\n start = n;\n }\n };\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {TemplateResult} from './template-result.js';\n\n/**\n * An expression marker with embedded unique key to avoid collision with\n * possible text in templates.\n */\nexport const marker = `{{lit-${String(Math.random()).slice(2)}}}`;\n\n/**\n * An expression marker used text-positions, multi-binding attributes, and\n * attributes with markup-like text values.\n */\nexport const nodeMarker = ``;\n\nexport const markerRegex = new RegExp(`${marker}|${nodeMarker}`);\n\n/**\n * Suffix appended to all bound attribute names.\n */\nexport const boundAttributeSuffix = '$lit$';\n\n/**\n * An updatable Template that tracks the location of dynamic parts.\n */\nexport class Template {\n readonly parts: TemplatePart[] = [];\n readonly element: HTMLTemplateElement;\n\n constructor(result: TemplateResult, element: HTMLTemplateElement) {\n this.element = element;\n\n const nodesToRemove: Node[] = [];\n const stack: Node[] = [];\n // Edge needs all 4 parameters present; IE11 needs 3rd parameter to be null\n const walker = document.createTreeWalker(\n element.content,\n 133 /* NodeFilter.SHOW_{ELEMENT|COMMENT|TEXT} */,\n null,\n false);\n // Keeps track of the last index associated with a part. We try to delete\n // unnecessary nodes, but we never want to associate two different parts\n // to the same index. They must have a constant node between.\n let lastPartIndex = 0;\n let index = -1;\n let partIndex = 0;\n const {strings, values: {length}} = result;\n while (partIndex < length) {\n const node = walker.nextNode() as Element | Comment | Text | null;\n if (node === null) {\n // We've exhausted the content inside a nested template element.\n // Because we still have parts (the outer for-loop), we know:\n // - There is a template in the stack\n // - The walker will find a nextNode outside the template\n walker.currentNode = stack.pop()!;\n continue;\n }\n index++;\n\n if (node.nodeType === 1 /* Node.ELEMENT_NODE */) {\n if ((node as Element).hasAttributes()) {\n const attributes = (node as Element).attributes;\n const {length} = attributes;\n // Per\n // https://developer.mozilla.org/en-US/docs/Web/API/NamedNodeMap,\n // attributes are not guaranteed to be returned in document order.\n // In particular, Edge/IE can return them out of order, so we cannot\n // assume a correspondence between part index and attribute index.\n let count = 0;\n for (let i = 0; i < length; i++) {\n if (endsWith(attributes[i].name, boundAttributeSuffix)) {\n count++;\n }\n }\n while (count-- > 0) {\n // Get the template literal section leading up to the first\n // expression in this attribute\n const stringForPart = strings[partIndex];\n // Find the attribute name\n const name = lastAttributeNameRegex.exec(stringForPart)![2];\n // Find the corresponding attribute\n // All bound attributes have had a suffix added in\n // TemplateResult#getHTML to opt out of special attribute\n // handling. To look up the attribute value we also need to add\n // the suffix.\n const attributeLookupName =\n name.toLowerCase() + boundAttributeSuffix;\n const attributeValue =\n (node as Element).getAttribute(attributeLookupName)!;\n (node as Element).removeAttribute(attributeLookupName);\n const statics = attributeValue.split(markerRegex);\n this.parts.push({type: 'attribute', index, name, strings: statics});\n partIndex += statics.length - 1;\n }\n }\n if ((node as Element).tagName === 'TEMPLATE') {\n stack.push(node);\n walker.currentNode = (node as HTMLTemplateElement).content;\n }\n } else if (node.nodeType === 3 /* Node.TEXT_NODE */) {\n const data = (node as Text).data;\n if (data.indexOf(marker) >= 0) {\n const parent = node.parentNode!;\n const strings = data.split(markerRegex);\n const lastIndex = strings.length - 1;\n // Generate a new text node for each literal section\n // These nodes are also used as the markers for node parts\n for (let i = 0; i < lastIndex; i++) {\n let insert: Node;\n let s = strings[i];\n if (s === '') {\n insert = createMarker();\n } else {\n const match = lastAttributeNameRegex.exec(s);\n if (match !== null && endsWith(match[2], boundAttributeSuffix)) {\n s = s.slice(0, match.index) + match[1] +\n match[2].slice(0, -boundAttributeSuffix.length) + match[3];\n }\n insert = document.createTextNode(s);\n }\n parent.insertBefore(insert, node);\n this.parts.push({type: 'node', index: ++index});\n }\n // If there's no text, we must insert a comment to mark our place.\n // Else, we can trust it will stick around after cloning.\n if (strings[lastIndex] === '') {\n parent.insertBefore(createMarker(), node);\n nodesToRemove.push(node);\n } else {\n (node as Text).data = strings[lastIndex];\n }\n // We have a part for each match found\n partIndex += lastIndex;\n }\n } else if (node.nodeType === 8 /* Node.COMMENT_NODE */) {\n if ((node as Comment).data === marker) {\n const parent = node.parentNode!;\n // Add a new marker node to be the startNode of the Part if any of\n // the following are true:\n // * We don't have a previousSibling\n // * The previousSibling is already the start of a previous part\n if (node.previousSibling === null || index === lastPartIndex) {\n index++;\n parent.insertBefore(createMarker(), node);\n }\n lastPartIndex = index;\n this.parts.push({type: 'node', index});\n // If we don't have a nextSibling, keep this node so we have an end.\n // Else, we can remove it to save future costs.\n if (node.nextSibling === null) {\n (node as Comment).data = '';\n } else {\n nodesToRemove.push(node);\n index--;\n }\n partIndex++;\n } else {\n let i = -1;\n while ((i = (node as Comment).data.indexOf(marker, i + 1)) !== -1) {\n // Comment node has a binding marker inside, make an inactive part\n // The binding won't work, but subsequent bindings will\n // TODO (justinfagnani): consider whether it's even worth it to\n // make bindings in comments work\n this.parts.push({type: 'node', index: -1});\n partIndex++;\n }\n }\n }\n }\n\n // Remove text binding nodes after the walk to not disturb the TreeWalker\n for (const n of nodesToRemove) {\n n.parentNode!.removeChild(n);\n }\n }\n}\n\nconst endsWith = (str: string, suffix: string): boolean => {\n const index = str.length - suffix.length;\n return index >= 0 && str.slice(index) === suffix;\n};\n\n/**\n * A placeholder for a dynamic expression in an HTML template.\n *\n * There are two built-in part types: AttributePart and NodePart. NodeParts\n * always represent a single dynamic expression, while AttributeParts may\n * represent as many expressions are contained in the attribute.\n *\n * A Template's parts are mutable, so parts can be replaced or modified\n * (possibly to implement different template semantics). The contract is that\n * parts can only be replaced, not removed, added or reordered, and parts must\n * always consume the correct number of values in their `update()` method.\n *\n * TODO(justinfagnani): That requirement is a little fragile. A\n * TemplateInstance could instead be more careful about which values it gives\n * to Part.update().\n */\nexport type TemplatePart = {\n readonly type: 'node'; index: number;\n}|{\n readonly type: 'attribute';\n index: number;\n readonly name: string;\n readonly strings: ReadonlyArray;\n};\n\nexport const isTemplatePartActive = (part: TemplatePart) => part.index !== -1;\n\n// Allows `document.createComment('')` to be renamed for a\n// small manual size-savings.\nexport const createMarker = () => document.createComment('');\n\n/**\n * This regex extracts the attribute name preceding an attribute-position\n * expression. It does this by matching the syntax allowed for attributes\n * against the string literal directly preceding the expression, assuming that\n * the expression is in an attribute-value position.\n *\n * See attributes in the HTML spec:\n * https://www.w3.org/TR/html5/syntax.html#elements-attributes\n *\n * \" \\x09\\x0a\\x0c\\x0d\" are HTML space characters:\n * https://www.w3.org/TR/html5/infrastructure.html#space-characters\n *\n * \"\\0-\\x1F\\x7F-\\x9F\" are Unicode control characters, which includes every\n * space character except \" \".\n *\n * So an attribute is:\n * * The name: any character except a control character, space character, ('),\n * (\"), \">\", \"=\", or \"/\"\n * * Followed by zero or more space characters\n * * Followed by \"=\"\n * * Followed by zero or more space characters\n * * Followed by:\n * * Any character except space, ('), (\"), \"<\", \">\", \"=\", (`), or\n * * (\") then any non-(\"), or\n * * (') then any non-(')\n */\nexport const lastAttributeNameRegex =\n // eslint-disable-next-line no-control-regex\n /([ \\x09\\x0a\\x0c\\x0d])([^\\0-\\x1F\\x7F-\\x9F \"'>=/]+)([ \\x09\\x0a\\x0c\\x0d]*=[ \\x09\\x0a\\x0c\\x0d]*(?:[^ \\x09\\x0a\\x0c\\x0d\"'`<>=]*|\"[^\"]*|'[^']*))$/;\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {isTemplatePartActive, Template, TemplatePart} from './template.js';\n\nconst walkerNodeFilter = 133 /* NodeFilter.SHOW_{ELEMENT|COMMENT|TEXT} */;\n\n/**\n * Removes the list of nodes from a Template safely. In addition to removing\n * nodes from the Template, the Template part indices are updated to match\n * the mutated Template DOM.\n *\n * As the template is walked the removal state is tracked and\n * part indices are adjusted as needed.\n *\n * div\n * div#1 (remove) <-- start removing (removing node is div#1)\n * div\n * div#2 (remove) <-- continue removing (removing node is still div#1)\n * div\n * div <-- stop removing since previous sibling is the removing node (div#1,\n * removed 4 nodes)\n */\nexport function removeNodesFromTemplate(\n template: Template, nodesToRemove: Set) {\n const {element: {content}, parts} = template;\n const walker =\n document.createTreeWalker(content, walkerNodeFilter, null, false);\n let partIndex = nextActiveIndexInTemplateParts(parts);\n let part = parts[partIndex];\n let nodeIndex = -1;\n let removeCount = 0;\n const nodesToRemoveInTemplate = [];\n let currentRemovingNode: Node|null = null;\n while (walker.nextNode()) {\n nodeIndex++;\n const node = walker.currentNode as Element;\n // End removal if stepped past the removing node\n if (node.previousSibling === currentRemovingNode) {\n currentRemovingNode = null;\n }\n // A node to remove was found in the template\n if (nodesToRemove.has(node)) {\n nodesToRemoveInTemplate.push(node);\n // Track node we're removing\n if (currentRemovingNode === null) {\n currentRemovingNode = node;\n }\n }\n // When removing, increment count by which to adjust subsequent part indices\n if (currentRemovingNode !== null) {\n removeCount++;\n }\n while (part !== undefined && part.index === nodeIndex) {\n // If part is in a removed node deactivate it by setting index to -1 or\n // adjust the index as needed.\n part.index = currentRemovingNode !== null ? -1 : part.index - removeCount;\n // go to the next active part.\n partIndex = nextActiveIndexInTemplateParts(parts, partIndex);\n part = parts[partIndex];\n }\n }\n nodesToRemoveInTemplate.forEach((n) => n.parentNode!.removeChild(n));\n}\n\nconst countNodes = (node: Node) => {\n let count = (node.nodeType === 11 /* Node.DOCUMENT_FRAGMENT_NODE */) ? 0 : 1;\n const walker = document.createTreeWalker(node, walkerNodeFilter, null, false);\n while (walker.nextNode()) {\n count++;\n }\n return count;\n};\n\nconst nextActiveIndexInTemplateParts =\n (parts: TemplatePart[], startIndex = -1) => {\n for (let i = startIndex + 1; i < parts.length; i++) {\n const part = parts[i];\n if (isTemplatePartActive(part)) {\n return i;\n }\n }\n return -1;\n };\n\n/**\n * Inserts the given node into the Template, optionally before the given\n * refNode. In addition to inserting the node into the Template, the Template\n * part indices are updated to match the mutated Template DOM.\n */\nexport function insertNodeIntoTemplate(\n template: Template, node: Node, refNode: Node|null = null) {\n const {element: {content}, parts} = template;\n // If there's no refNode, then put node at end of template.\n // No part indices need to be shifted in this case.\n if (refNode === null || refNode === undefined) {\n content.appendChild(node);\n return;\n }\n const walker =\n document.createTreeWalker(content, walkerNodeFilter, null, false);\n let partIndex = nextActiveIndexInTemplateParts(parts);\n let insertCount = 0;\n let walkerIndex = -1;\n while (walker.nextNode()) {\n walkerIndex++;\n const walkerNode = walker.currentNode as Element;\n if (walkerNode === refNode) {\n insertCount = countNodes(node);\n refNode.parentNode!.insertBefore(node, refNode);\n }\n while (partIndex !== -1 && parts[partIndex].index === walkerIndex) {\n // If we've inserted the node, simply adjust all subsequent parts\n if (insertCount > 0) {\n while (partIndex !== -1) {\n parts[partIndex].index += insertCount;\n partIndex = nextActiveIndexInTemplateParts(parts, partIndex);\n }\n return;\n }\n partIndex = nextActiveIndexInTemplateParts(parts, partIndex);\n }\n }\n}\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {Part} from './part.js';\n\nconst directives = new WeakMap();\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type DirectiveFactory = (...args: any[]) => object;\n\nexport type DirectiveFn = (part: Part) => void;\n\n/**\n * Brands a function as a directive factory function so that lit-html will call\n * the function during template rendering, rather than passing as a value.\n *\n * A _directive_ is a function that takes a Part as an argument. It has the\n * signature: `(part: Part) => void`.\n *\n * A directive _factory_ is a function that takes arguments for data and\n * configuration and returns a directive. Users of directive usually refer to\n * the directive factory as the directive. For example, \"The repeat directive\".\n *\n * Usually a template author will invoke a directive factory in their template\n * with relevant arguments, which will then return a directive function.\n *\n * Here's an example of using the `repeat()` directive factory that takes an\n * array and a function to render an item:\n *\n * ```js\n * html`
          <${repeat(items, (item) => html`
        • ${item}
        • `)}
        `\n * ```\n *\n * When `repeat` is invoked, it returns a directive function that closes over\n * `items` and the template function. When the outer template is rendered, the\n * return directive function is called with the Part for the expression.\n * `repeat` then performs it's custom logic to render multiple items.\n *\n * @param f The directive factory function. Must be a function that returns a\n * function of the signature `(part: Part) => void`. The returned function will\n * be called with the part object.\n *\n * @example\n *\n * import {directive, html} from 'lit-html';\n *\n * const immutable = directive((v) => (part) => {\n * if (part.value !== v) {\n * part.setValue(v)\n * }\n * });\n */\nexport const directive = (f: F): F =>\n ((...args: unknown[]) => {\n const d = f(...args);\n directives.set(d, true);\n return d;\n }) as F;\n\nexport const isDirective = (o: unknown): o is DirectiveFn => {\n return typeof o === 'function' && directives.has(o);\n};\n","/**\n * @license\n * Copyright (c) 2018 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/**\n * The Part interface represents a dynamic part of a template instance rendered\n * by lit-html.\n */\nexport interface Part {\n readonly value: unknown;\n\n /**\n * Sets the current part value, but does not write it to the DOM.\n * @param value The value that will be committed.\n */\n setValue(value: unknown): void;\n\n /**\n * Commits the current part value, causing it to actually be written to the\n * DOM.\n *\n * Directives are run at the start of `commit`, so that if they call\n * `part.setValue(...)` synchronously that value will be used in the current\n * commit, and there's no need to call `part.commit()` within the directive.\n * If directives set a part value asynchronously, then they must call\n * `part.commit()` manually.\n */\n commit(): void;\n}\n\n/**\n * A sentinel value that signals that a value was handled by a directive and\n * should not be written to the DOM.\n */\nexport const noChange = {};\n\n/**\n * A sentinel value that signals a NodePart to fully clear its content.\n */\nexport const nothing = {};\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {isCEPolyfill} from './dom.js';\nimport {Part} from './part.js';\nimport {RenderOptions} from './render-options.js';\nimport {TemplateProcessor} from './template-processor.js';\nimport {isTemplatePartActive, Template, TemplatePart} from './template.js';\n\n/**\n * An instance of a `Template` that can be attached to the DOM and updated\n * with new values.\n */\nexport class TemplateInstance {\n private readonly __parts: Array = [];\n readonly processor: TemplateProcessor;\n readonly options: RenderOptions;\n readonly template: Template;\n\n constructor(\n template: Template, processor: TemplateProcessor,\n options: RenderOptions) {\n this.template = template;\n this.processor = processor;\n this.options = options;\n }\n\n update(values: readonly unknown[]) {\n let i = 0;\n for (const part of this.__parts) {\n if (part !== undefined) {\n part.setValue(values[i]);\n }\n i++;\n }\n for (const part of this.__parts) {\n if (part !== undefined) {\n part.commit();\n }\n }\n }\n\n _clone(): DocumentFragment {\n // There are a number of steps in the lifecycle of a template instance's\n // DOM fragment:\n // 1. Clone - create the instance fragment\n // 2. Adopt - adopt into the main document\n // 3. Process - find part markers and create parts\n // 4. Upgrade - upgrade custom elements\n // 5. Update - set node, attribute, property, etc., values\n // 6. Connect - connect to the document. Optional and outside of this\n // method.\n //\n // We have a few constraints on the ordering of these steps:\n // * We need to upgrade before updating, so that property values will pass\n // through any property setters.\n // * We would like to process before upgrading so that we're sure that the\n // cloned fragment is inert and not disturbed by self-modifying DOM.\n // * We want custom elements to upgrade even in disconnected fragments.\n //\n // Given these constraints, with full custom elements support we would\n // prefer the order: Clone, Process, Adopt, Upgrade, Update, Connect\n //\n // But Safari does not implement CustomElementRegistry#upgrade, so we\n // can not implement that order and still have upgrade-before-update and\n // upgrade disconnected fragments. So we instead sacrifice the\n // process-before-upgrade constraint, since in Custom Elements v1 elements\n // must not modify their light DOM in the constructor. We still have issues\n // when co-existing with CEv0 elements like Polymer 1, and with polyfills\n // that don't strictly adhere to the no-modification rule because shadow\n // DOM, which may be created in the constructor, is emulated by being placed\n // in the light DOM.\n //\n // The resulting order is on native is: Clone, Adopt, Upgrade, Process,\n // Update, Connect. document.importNode() performs Clone, Adopt, and Upgrade\n // in one step.\n //\n // The Custom Elements v1 polyfill supports upgrade(), so the order when\n // polyfilled is the more ideal: Clone, Process, Adopt, Upgrade, Update,\n // Connect.\n\n const fragment = isCEPolyfill ?\n this.template.element.content.cloneNode(true) as DocumentFragment :\n document.importNode(this.template.element.content, true);\n\n const stack: Node[] = [];\n const parts = this.template.parts;\n // Edge needs all 4 parameters present; IE11 needs 3rd parameter to be null\n const walker = document.createTreeWalker(\n fragment,\n 133 /* NodeFilter.SHOW_{ELEMENT|COMMENT|TEXT} */,\n null,\n false);\n let partIndex = 0;\n let nodeIndex = 0;\n let part: TemplatePart;\n let node = walker.nextNode();\n // Loop through all the nodes and parts of a template\n while (partIndex < parts.length) {\n part = parts[partIndex];\n if (!isTemplatePartActive(part)) {\n this.__parts.push(undefined);\n partIndex++;\n continue;\n }\n\n // Progress the tree walker until we find our next part's node.\n // Note that multiple parts may share the same node (attribute parts\n // on a single element), so this loop may not run at all.\n while (nodeIndex < part.index) {\n nodeIndex++;\n if (node!.nodeName === 'TEMPLATE') {\n stack.push(node!);\n walker.currentNode = (node as HTMLTemplateElement).content;\n }\n if ((node = walker.nextNode()) === null) {\n // We've exhausted the content inside a nested template element.\n // Because we still have parts (the outer for-loop), we know:\n // - There is a template in the stack\n // - The walker will find a nextNode outside the template\n walker.currentNode = stack.pop()!;\n node = walker.nextNode();\n }\n }\n\n // We've arrived at our part's node.\n if (part.type === 'node') {\n const part = this.processor.handleTextExpression(this.options);\n part.insertAfterNode(node!.previousSibling!);\n this.__parts.push(part);\n } else {\n this.__parts.push(...this.processor.handleAttributeExpressions(\n node as Element, part.name, part.strings, this.options));\n }\n partIndex++;\n }\n\n if (isCEPolyfill) {\n document.adoptNode(fragment);\n customElements.upgrade(fragment);\n }\n return fragment;\n }\n}\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/**\n * @module lit-html\n */\n\nimport {reparentNodes} from './dom.js';\nimport {TemplateProcessor} from './template-processor.js';\nimport {boundAttributeSuffix, lastAttributeNameRegex, marker, nodeMarker} from './template.js';\n\ndeclare const trustedTypes: typeof window.trustedTypes;\n/**\n * Our TrustedTypePolicy for HTML which is declared using the html template\n * tag function.\n *\n * That HTML is a developer-authored constant, and is parsed with innerHTML\n * before any untrusted expressions have been mixed in. Therefor it is\n * considered safe by construction.\n */\nconst policy = window.trustedTypes &&\n trustedTypes!.createPolicy('lit-html', {createHTML: (s) => s});\n\nconst commentMarker = ` ${marker} `;\n\n/**\n * The return type of `html`, which holds a Template and the values from\n * interpolated expressions.\n */\nexport class TemplateResult {\n readonly strings: TemplateStringsArray;\n readonly values: readonly unknown[];\n readonly type: string;\n readonly processor: TemplateProcessor;\n\n constructor(\n strings: TemplateStringsArray, values: readonly unknown[], type: string,\n processor: TemplateProcessor) {\n this.strings = strings;\n this.values = values;\n this.type = type;\n this.processor = processor;\n }\n\n /**\n * Returns a string of HTML used to create a `