UNPKG

@decidables/detectable-elements

Version:

detectable-elements: Web Components for visualizing Signal Detection Theory

23 lines 307 kB
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).detectableElements={})}(this,(function(t){"use strict"; /** * @license * Copyright 2019 Google LLC * SPDX-License-Identifier: BSD-3-Clause */const e=globalThis,r=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,n=Symbol(),i=new WeakMap;let s=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==n)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(r&&void 0===t){const r=void 0!==e&&1===e.length;r&&(t=i.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&i.set(e,t))}return t}toString(){return this.cssText}};const a=t=>new s("string"==typeof t?t:t+"",void 0,n),o=(t,...e)=>{const r=1===t.length?t[0]:e.reduce(((e,r,n)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+t[n+1]),t[0]);return new s(r,t,n)},l=r?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const r of t.cssRules)e+=r.cssText;return a(e)})(t):t /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */,{is:c,defineProperty:h,getOwnPropertyDescriptor:u,getOwnPropertyNames:d,getOwnPropertySymbols:f,getPrototypeOf:p}=Object,m=globalThis,b=m.trustedTypes,g=b?b.emptyScript:"",v=m.reactiveElementPolyfillSupport,y=(t,e)=>t,w={toAttribute(t,e){switch(e){case Boolean:t=t?g:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let r=t;switch(e){case Boolean:r=null!==t;break;case Number:r=null===t?null:Number(t);break;case Object:case Array:try{r=JSON.parse(t)}catch(t){r=null}}return r}},x=(t,e)=>!c(t,e),$={attribute:!0,type:String,converter:w,reflect:!1,hasChanged:x};Symbol.metadata??=Symbol("metadata"),m.litPropertyMetadata??=new WeakMap;let k=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=$){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){const r=Symbol(),n=this.getPropertyDescriptor(t,r,e);void 0!==n&&h(this.prototype,t,n)}}static getPropertyDescriptor(t,e,r){const{get:n,set:i}=u(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get(){return n?.call(this)},set(e){const s=n?.call(this);i.call(this,e),this.requestUpdate(t,s,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??$}static _$Ei(){if(this.hasOwnProperty(y("elementProperties")))return;const t=p(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(y("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(y("properties"))){const t=this.properties,e=[...d(t),...f(t)];for(const r of e)this.createProperty(r,t[r])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,r]of e)this.elementProperties.set(t,r)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const r=this._$Eu(t,e);void 0!==r&&this._$Eh.set(r,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const r=new Set(t.flat(1/0).reverse());for(const t of r)e.unshift(l(t))}else void 0!==t&&e.push(l(t));return e}static _$Eu(t,e){const r=e.attribute;return!1===r?void 0:"string"==typeof r?r:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const r of e.keys())this.hasOwnProperty(r)&&(t.set(r,this[r]),delete this[r]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((t,n)=>{if(r)t.adoptedStyleSheets=n.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const r of n){const n=document.createElement("style"),i=e.litNonce;void 0!==i&&n.setAttribute("nonce",i),n.textContent=r.cssText,t.appendChild(n)}})(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((t=>t.hostConnected?.()))}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()))}attributeChangedCallback(t,e,r){this._$AK(t,r)}_$EC(t,e){const r=this.constructor.elementProperties.get(t),n=this.constructor._$Eu(t,r);if(void 0!==n&&!0===r.reflect){const i=(void 0!==r.converter?.toAttribute?r.converter:w).toAttribute(e,r.type);this._$Em=t,null==i?this.removeAttribute(n):this.setAttribute(n,i),this._$Em=null}}_$AK(t,e){const r=this.constructor,n=r._$Eh.get(t);if(void 0!==n&&this._$Em!==n){const t=r.getPropertyOptions(n),i="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:w;this._$Em=n,this[n]=i.fromAttribute(e,t.type),this._$Em=null}}requestUpdate(t,e,r){if(void 0!==t){if(r??=this.constructor.getPropertyOptions(t),!(r.hasChanged??x)(this[t],e))return;this.P(t,e,r)}!1===this.isUpdatePending&&(this._$ES=this._$ET())}P(t,e,r){this._$AL.has(t)||this._$AL.set(t,e),!0===r.reflect&&this._$Em!==t&&(this._$Ej??=new Set).add(t)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,r]of t)!0!==r.wrapped||this._$AL.has(e)||void 0===this[e]||this.P(e,this[e],r)}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(e)):this._$EU()}catch(e){throw t=!1,this._$EU(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Ej&&=this._$Ej.forEach((t=>this._$EC(t,this[t]))),this._$EU()}updated(t){}firstUpdated(t){}};k.elementStyles=[],k.shadowRootOptions={mode:"open"},k[y("elementProperties")]=new Map,k[y("finalized")]=new Map,v?.({ReactiveElement:k}),(m.reactiveElementVersions??=[]).push("2.0.4"); /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const _=globalThis,S=_.trustedTypes,A=S?S.createPolicy("lit-html",{createHTML:t=>t}):void 0,E="$lit$",T=`lit$${Math.random().toFixed(9).slice(2)}$`,M="?"+T,C=`<${M}>`,N=document,R=()=>N.createComment(""),q=t=>null===t||"object"!=typeof t&&"function"!=typeof t,P=Array.isArray,z="[ \t\n\f\r]",F=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,O=/-->/g,U=/>/g,H=RegExp(`>|${z}(?:([^\\s"'>=/]+)(${z}*=${z}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),D=/'/g,I=/"/g,L=/^(?:script|style|textarea|title)$/i,j=t=>(e,...r)=>({_$litType$:t,strings:e,values:r}),B=j(1),V=j(2),K=Symbol.for("lit-noChange"),X=Symbol.for("lit-nothing"),W=new WeakMap,G=N.createTreeWalker(N,129);function Y(t,e){if(!P(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==A?A.createHTML(e):e}const Z=(t,e)=>{const r=t.length-1,n=[];let i,s=2===e?"<svg>":3===e?"<math>":"",a=F;for(let e=0;e<r;e++){const r=t[e];let o,l,c=-1,h=0;for(;h<r.length&&(a.lastIndex=h,l=a.exec(r),null!==l);)h=a.lastIndex,a===F?"!--"===l[1]?a=O:void 0!==l[1]?a=U:void 0!==l[2]?(L.test(l[2])&&(i=RegExp("</"+l[2],"g")),a=H):void 0!==l[3]&&(a=H):a===H?">"===l[0]?(a=i??F,c=-1):void 0===l[1]?c=-2:(c=a.lastIndex-l[2].length,o=l[1],a=void 0===l[3]?H:'"'===l[3]?I:D):a===I||a===D?a=H:a===O||a===U?a=F:(a=H,i=void 0);const u=a===H&&t[e+1].startsWith("/>")?" ":"";s+=a===F?r+C:c>=0?(n.push(o),r.slice(0,c)+E+r.slice(c)+T+u):r+T+(-2===c?e:u)}return[Y(t,s+(t[r]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),n]};class Q{constructor({strings:t,_$litType$:e},r){let n;this.parts=[];let i=0,s=0;const a=t.length-1,o=this.parts,[l,c]=Z(t,e);if(this.el=Q.createElement(l,r),G.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(n=G.nextNode())&&o.length<a;){if(1===n.nodeType){if(n.hasAttributes())for(const t of n.getAttributeNames())if(t.endsWith(E)){const e=c[s++],r=n.getAttribute(t).split(T),a=/([.?@])?(.*)/.exec(e);o.push({type:1,index:i,name:a[2],strings:r,ctor:"."===a[1]?nt:"?"===a[1]?it:"@"===a[1]?st:rt}),n.removeAttribute(t)}else t.startsWith(T)&&(o.push({type:6,index:i}),n.removeAttribute(t));if(L.test(n.tagName)){const t=n.textContent.split(T),e=t.length-1;if(e>0){n.textContent=S?S.emptyScript:"";for(let r=0;r<e;r++)n.append(t[r],R()),G.nextNode(),o.push({type:2,index:++i});n.append(t[e],R())}}}else if(8===n.nodeType)if(n.data===M)o.push({type:2,index:i});else{let t=-1;for(;-1!==(t=n.data.indexOf(T,t+1));)o.push({type:7,index:i}),t+=T.length-1}i++}}static createElement(t,e){const r=N.createElement("template");return r.innerHTML=t,r}}function J(t,e,r=t,n){if(e===K)return e;let i=void 0!==n?r._$Co?.[n]:r._$Cl;const s=q(e)?void 0:e._$litDirective$;return i?.constructor!==s&&(i?._$AO?.(!1),void 0===s?i=void 0:(i=new s(t),i._$AT(t,r,n)),void 0!==n?(r._$Co??=[])[n]=i:r._$Cl=i),void 0!==i&&(e=J(t,i._$AS(t,e.values),i,n)),e}class tt{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:r}=this._$AD,n=(t?.creationScope??N).importNode(e,!0);G.currentNode=n;let i=G.nextNode(),s=0,a=0,o=r[0];for(;void 0!==o;){if(s===o.index){let e;2===o.type?e=new et(i,i.nextSibling,this,t):1===o.type?e=new o.ctor(i,o.name,o.strings,this,t):6===o.type&&(e=new at(i,this,t)),this._$AV.push(e),o=r[++a]}s!==o?.index&&(i=G.nextNode(),s++)}return G.currentNode=N,n}p(t){let e=0;for(const r of this._$AV)void 0!==r&&(void 0!==r.strings?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}}class et{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,r,n){this.type=2,this._$AH=X,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=n,this._$Cv=n?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t?.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=J(this,t,e),q(t)?t===X||null==t||""===t?(this._$AH!==X&&this._$AR(),this._$AH=X):t!==this._$AH&&t!==K&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>P(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==X&&q(this._$AH)?this._$AA.nextSibling.data=t:this.T(N.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:r}=t,n="number"==typeof r?this._$AC(t):(void 0===r.el&&(r.el=Q.createElement(Y(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===n)this._$AH.p(e);else{const t=new tt(n,this),r=t.u(this.options);t.p(e),this.T(r),this._$AH=t}}_$AC(t){let e=W.get(t.strings);return void 0===e&&W.set(t.strings,e=new Q(t)),e}k(t){P(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let r,n=0;for(const i of t)n===e.length?e.push(r=new et(this.O(R()),this.O(R()),this,this.options)):r=e[n],r._$AI(i),n++;n<e.length&&(this._$AR(r&&r._$AB.nextSibling,n),e.length=n)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class rt{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,n,i){this.type=1,this._$AH=X,this._$AN=void 0,this.element=t,this.name=e,this._$AM=n,this.options=i,r.length>2||""!==r[0]||""!==r[1]?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=X}_$AI(t,e=this,r,n){const i=this.strings;let s=!1;if(void 0===i)t=J(this,t,e,0),s=!q(t)||t!==this._$AH&&t!==K,s&&(this._$AH=t);else{const n=t;let a,o;for(t=i[0],a=0;a<i.length-1;a++)o=J(this,n[r+a],e,a),o===K&&(o=this._$AH[a]),s||=!q(o)||o!==this._$AH[a],o===X?t=X:t!==X&&(t+=(o??"")+i[a+1]),this._$AH[a]=o}s&&!n&&this.j(t)}j(t){t===X?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class nt extends rt{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===X?void 0:t}}class it extends rt{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==X)}}class st extends rt{constructor(t,e,r,n,i){super(t,e,r,n,i),this.type=5}_$AI(t,e=this){if((t=J(this,t,e,0)??X)===K)return;const r=this._$AH,n=t===X&&r!==X||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,i=t!==X&&(r===X||n);n&&this.element.removeEventListener(this.name,this,r),i&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class at{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){J(this,t)}}const ot=_.litHtmlPolyfillSupport;ot?.(Q,et),(_.litHtmlVersions??=[]).push("3.2.1"); /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ class lt extends k{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,r)=>{const n=r?.renderBefore??e;let i=n._$litPart$;if(void 0===i){const t=r?.renderBefore??null;n._$litPart$=i=new et(e.insertBefore(R(),t),t,void 0,r??{})}return i._$AI(t),i})(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return K}}lt._$litElement$=!0,lt.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:lt});const ct=globalThis.litElementPolyfillSupport;function ht(t,e){return null==t||null==e?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function ut(t,e){return null==t||null==e?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function dt(t){let e,r,n;function i(t,n,i=0,s=t.length){if(i<s){if(0!==e(n,n))return s;do{const e=i+s>>>1;r(t[e],n)<0?i=e+1:s=e}while(i<s)}return i}return 2!==t.length?(e=ht,r=(e,r)=>ht(t(e),r),n=(e,r)=>t(e)-r):(e=t===ht||t===ut?t:ft,r=t,n=t),{left:i,center:function(t,e,r=0,s=t.length){const a=i(t,e,r,s-1);return a>r&&n(t[a-1],e)>-n(t[a],e)?a-1:a},right:function(t,n,i=0,s=t.length){if(i<s){if(0!==e(n,n))return s;do{const e=i+s>>>1;r(t[e],n)<=0?i=e+1:s=e}while(i<s)}return i}}}function ft(){return 0}ct?.({LitElement:lt}),(globalThis.litElementVersions??=[]).push("4.1.1");const pt=dt(ht).right;function mt(t,e){let r,n;if(void 0===e)for(const e of t)null!=e&&(void 0===r?e>=e&&(r=n=e):(r>e&&(r=e),n<e&&(n=e)));else{let i=-1;for(let s of t)null!=(s=e(s,++i,t))&&(void 0===r?s>=s&&(r=n=s):(r>s&&(r=s),n<s&&(n=s)))}return[r,n]}dt((function(t){return null===t?NaN:+t})).center;class bt{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){const e=this._partials;let r=0;for(let n=0;n<this._n&&n<32;n++){const i=e[n],s=t+i,a=Math.abs(t)<Math.abs(i)?t-(s-i):i-(s-t);a&&(e[r++]=a),t=s}return e[r]=t,this._n=r+1,this}valueOf(){const t=this._partials;let e,r,n,i=this._n,s=0;if(i>0){for(s=t[--i];i>0&&(e=s,r=t[--i],s=e+r,n=r-(s-e),!n););i>0&&(n<0&&t[i-1]<0||n>0&&t[i-1]>0)&&(r=2*n,e=s+r,r==e-s&&(s=e))}return s}}function gt(t){return t}var vt=Array.prototype.slice;function yt(t){return()=>t}const wt=Math.sqrt(50),xt=Math.sqrt(10),$t=Math.sqrt(2);function kt(t,e,r){const n=(e-t)/Math.max(0,r),i=Math.floor(Math.log10(n)),s=n/Math.pow(10,i),a=s>=wt?10:s>=xt?5:s>=$t?2:1;let o,l,c;return i<0?(c=Math.pow(10,-i)/a,o=Math.round(t*c),l=Math.round(e*c),o/c<t&&++o,l/c>e&&--l,c=-c):(c=Math.pow(10,i)*a,o=Math.round(t/c),l=Math.round(e/c),o*c<t&&++o,l*c>e&&--l),l<o&&.5<=r&&r<2?kt(t,e,2*r):[o,l,c]}function _t(t,e,r){if(!((r=+r)>0))return[];if((t=+t)===(e=+e))return[t];const n=e<t,[i,s,a]=n?kt(e,t,r):kt(t,e,r);if(!(s>=i))return[];const o=s-i+1,l=new Array(o);if(n)if(a<0)for(let t=0;t<o;++t)l[t]=(s-t)/-a;else for(let t=0;t<o;++t)l[t]=(s-t)*a;else if(a<0)for(let t=0;t<o;++t)l[t]=(i+t)/-a;else for(let t=0;t<o;++t)l[t]=(i+t)*a;return l}function St(t,e,r){return kt(t=+t,e=+e,r=+r)[2]}function At(t,e,r){let n;for(;;){const i=St(t,e,r);if(i===n||0===i||!isFinite(i))return[t,e];i>0?(t=Math.floor(t/i)*i,e=Math.ceil(e/i)*i):i<0&&(t=Math.ceil(t*i)/i,e=Math.floor(e*i)/i),n=i}}function Et(t){return Math.max(1,Math.ceil(Math.log(function(t,e){let r=0;for(let e of t)null!=e&&(e=+e)>=e&&++r;return r}(t))/Math.LN2)+1)}function Tt(t,e,r){t=+t,e=+e,r=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+r;for(var n=-1,i=0|Math.max(0,Math.ceil((e-t)/r)),s=new Array(i);++n<i;)s[n]=t+n*r;return s}function Mt(t){return t}var Ct=1,Nt=2,Rt=3,qt=4,Pt=1e-6;function zt(t){return"translate("+t+",0)"}function Ft(t){return"translate(0,"+t+")"}function Ot(t){return e=>+t(e)}function Ut(t,e){return e=Math.max(0,t.bandwidth()-2*e)/2,t.round()&&(e=Math.round(e)),r=>+t(r)+e}function Ht(){return!this.__axis}function Dt(t,e){var r=[],n=null,i=null,s=6,a=6,o=3,l="undefined"!=typeof window&&window.devicePixelRatio>1?0:.5,c=t===Ct||t===qt?-1:1,h=t===qt||t===Nt?"x":"y",u=t===Ct||t===Rt?zt:Ft;function d(d){var f=null==n?e.ticks?e.ticks.apply(e,r):e.domain():n,p=null==i?e.tickFormat?e.tickFormat.apply(e,r):Mt:i,m=Math.max(s,0)+o,b=e.range(),g=+b[0]+l,v=+b[b.length-1]+l,y=(e.bandwidth?Ut:Ot)(e.copy(),l),w=d.selection?d.selection():d,x=w.selectAll(".domain").data([null]),$=w.selectAll(".tick").data(f,e).order(),k=$.exit(),_=$.enter().append("g").attr("class","tick"),S=$.select("line"),A=$.select("text");x=x.merge(x.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),$=$.merge(_),S=S.merge(_.append("line").attr("stroke","currentColor").attr(h+"2",c*s)),A=A.merge(_.append("text").attr("fill","currentColor").attr(h,c*m).attr("dy",t===Ct?"0em":t===Rt?"0.71em":"0.32em")),d!==w&&(x=x.transition(d),$=$.transition(d),S=S.transition(d),A=A.transition(d),k=k.transition(d).attr("opacity",Pt).attr("transform",(function(t){return isFinite(t=y(t))?u(t+l):this.getAttribute("transform")})),_.attr("opacity",Pt).attr("transform",(function(t){var e=this.parentNode.__axis;return u((e&&isFinite(e=e(t))?e:y(t))+l)}))),k.remove(),x.attr("d",t===qt||t===Nt?a?"M"+c*a+","+g+"H"+l+"V"+v+"H"+c*a:"M"+l+","+g+"V"+v:a?"M"+g+","+c*a+"V"+l+"H"+v+"V"+c*a:"M"+g+","+l+"H"+v),$.attr("opacity",1).attr("transform",(function(t){return u(y(t)+l)})),S.attr(h+"2",c*s),A.attr(h,c*m).text(p),w.filter(Ht).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",t===Nt?"start":t===qt?"end":"middle"),w.each((function(){this.__axis=y}))}return d.scale=function(t){return arguments.length?(e=t,d):e},d.ticks=function(){return r=Array.from(arguments),d},d.tickArguments=function(t){return arguments.length?(r=null==t?[]:Array.from(t),d):r.slice()},d.tickValues=function(t){return arguments.length?(n=null==t?null:Array.from(t),d):n&&n.slice()},d.tickFormat=function(t){return arguments.length?(i=t,d):i},d.tickSize=function(t){return arguments.length?(s=a=+t,d):s},d.tickSizeInner=function(t){return arguments.length?(s=+t,d):s},d.tickSizeOuter=function(t){return arguments.length?(a=+t,d):a},d.tickPadding=function(t){return arguments.length?(o=+t,d):o},d.offset=function(t){return arguments.length?(l=+t,d):l},d}function It(t){return Dt(Rt,t)}function Lt(t){return Dt(qt,t)}var jt={value:()=>{}};function Bt(){for(var t,e=0,r=arguments.length,n={};e<r;++e){if(!(t=arguments[e]+"")||t in n||/[\s.]/.test(t))throw new Error("illegal type: "+t);n[t]=[]}return new Vt(n)}function Vt(t){this._=t}function Kt(t,e){for(var r,n=0,i=t.length;n<i;++n)if((r=t[n]).name===e)return r.value}function Xt(t,e,r){for(var n=0,i=t.length;n<i;++n)if(t[n].name===e){t[n]=jt,t=t.slice(0,n).concat(t.slice(n+1));break}return null!=r&&t.push({name:e,value:r}),t}Vt.prototype=Bt.prototype={constructor:Vt,on:function(t,e){var r,n,i=this._,s=(n=i,(t+"").trim().split(/^|\s+/).map((function(t){var e="",r=t.indexOf(".");if(r>=0&&(e=t.slice(r+1),t=t.slice(0,r)),t&&!n.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))),a=-1,o=s.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++a<o;)if(r=(t=s[a]).type)i[r]=Xt(i[r],t.name,e);else if(null==e)for(r in i)i[r]=Xt(i[r],t.name,null);return this}for(;++a<o;)if((r=(t=s[a]).type)&&(r=Kt(i[r],t.name)))return r},copy:function(){var t={},e=this._;for(var r in e)t[r]=e[r].slice();return new Vt(t)},call:function(t,e){if((r=arguments.length-2)>0)for(var r,n,i=new Array(r),s=0;s<r;++s)i[s]=arguments[s+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(s=0,r=(n=this._[t]).length;s<r;++s)n[s].value.apply(e,i)},apply:function(t,e,r){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var n=this._[t],i=0,s=n.length;i<s;++i)n[i].value.apply(e,r)}};var Wt="http://www.w3.org/1999/xhtml",Gt={svg:"http://www.w3.org/2000/svg",xhtml:Wt,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Yt(t){var e=t+="",r=e.indexOf(":");return r>=0&&"xmlns"!==(e=t.slice(0,r))&&(t=t.slice(r+1)),Gt.hasOwnProperty(e)?{space:Gt[e],local:t}:t}function Zt(t){return function(){var e=this.ownerDocument,r=this.namespaceURI;return r===Wt&&e.documentElement.namespaceURI===Wt?e.createElement(t):e.createElementNS(r,t)}}function Qt(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function Jt(t){var e=Yt(t);return(e.local?Qt:Zt)(e)}function te(){}function ee(t){return null==t?te:function(){return this.querySelector(t)}}function re(){return[]}function ne(t){return null==t?re:function(){return this.querySelectorAll(t)}}function ie(t){return function(){return function(t){return null==t?[]:Array.isArray(t)?t:Array.from(t)}(t.apply(this,arguments))}}function se(t){return function(){return this.matches(t)}}function ae(t){return function(e){return e.matches(t)}}var oe=Array.prototype.find;function le(){return this.firstElementChild}var ce=Array.prototype.filter;function he(){return Array.from(this.children)}function ue(t){return new Array(t.length)}function de(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function fe(t,e,r,n,i,s){for(var a,o=0,l=e.length,c=s.length;o<c;++o)(a=e[o])?(a.__data__=s[o],n[o]=a):r[o]=new de(t,s[o]);for(;o<l;++o)(a=e[o])&&(i[o]=a)}function pe(t,e,r,n,i,s,a){var o,l,c,h=new Map,u=e.length,d=s.length,f=new Array(u);for(o=0;o<u;++o)(l=e[o])&&(f[o]=c=a.call(l,l.__data__,o,e)+"",h.has(c)?i[o]=l:h.set(c,l));for(o=0;o<d;++o)c=a.call(t,s[o],o,s)+"",(l=h.get(c))?(n[o]=l,l.__data__=s[o],h.delete(c)):r[o]=new de(t,s[o]);for(o=0;o<u;++o)(l=e[o])&&h.get(f[o])===l&&(i[o]=l)}function me(t){return t.__data__}function be(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function ge(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function ve(t){return function(){this.removeAttribute(t)}}function ye(t){return function(){this.removeAttributeNS(t.space,t.local)}}function we(t,e){return function(){this.setAttribute(t,e)}}function xe(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function $e(t,e){return function(){var r=e.apply(this,arguments);null==r?this.removeAttribute(t):this.setAttribute(t,r)}}function ke(t,e){return function(){var r=e.apply(this,arguments);null==r?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,r)}}function _e(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function Se(t){return function(){this.style.removeProperty(t)}}function Ae(t,e,r){return function(){this.style.setProperty(t,e,r)}}function Ee(t,e,r){return function(){var n=e.apply(this,arguments);null==n?this.style.removeProperty(t):this.style.setProperty(t,n,r)}}function Te(t,e){return t.style.getPropertyValue(e)||_e(t).getComputedStyle(t,null).getPropertyValue(e)}function Me(t){return function(){delete this[t]}}function Ce(t,e){return function(){this[t]=e}}function Ne(t,e){return function(){var r=e.apply(this,arguments);null==r?delete this[t]:this[t]=r}}function Re(t){return t.trim().split(/^|\s+/)}function qe(t){return t.classList||new Pe(t)}function Pe(t){this._node=t,this._names=Re(t.getAttribute("class")||"")}function ze(t,e){for(var r=qe(t),n=-1,i=e.length;++n<i;)r.add(e[n])}function Fe(t,e){for(var r=qe(t),n=-1,i=e.length;++n<i;)r.remove(e[n])}function Oe(t){return function(){ze(this,t)}}function Ue(t){return function(){Fe(this,t)}}function He(t,e){return function(){(e.apply(this,arguments)?ze:Fe)(this,t)}}function De(){this.textContent=""}function Ie(t){return function(){this.textContent=t}}function Le(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}function je(){this.innerHTML=""}function Be(t){return function(){this.innerHTML=t}}function Ve(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}function Ke(){this.nextSibling&&this.parentNode.appendChild(this)}function Xe(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function We(){return null}function Ge(){var t=this.parentNode;t&&t.removeChild(this)}function Ye(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Ze(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Qe(t){return function(){var e=this.__on;if(e){for(var r,n=0,i=-1,s=e.length;n<s;++n)r=e[n],t.type&&r.type!==t.type||r.name!==t.name?e[++i]=r:this.removeEventListener(r.type,r.listener,r.options);++i?e.length=i:delete this.__on}}}function Je(t,e,r){return function(){var n,i=this.__on,s=function(t){return function(e){t.call(this,e,this.__data__)}}(e);if(i)for(var a=0,o=i.length;a<o;++a)if((n=i[a]).type===t.type&&n.name===t.name)return this.removeEventListener(n.type,n.listener,n.options),this.addEventListener(n.type,n.listener=s,n.options=r),void(n.value=e);this.addEventListener(t.type,s,r),n={type:t.type,name:t.name,value:e,listener:s,options:r},i?i.push(n):this.__on=[n]}}function tr(t,e,r){var n=_e(t),i=n.CustomEvent;"function"==typeof i?i=new i(e,r):(i=n.document.createEvent("Event"),r?(i.initEvent(e,r.bubbles,r.cancelable),i.detail=r.detail):i.initEvent(e,!1,!1)),t.dispatchEvent(i)}function er(t,e){return function(){return tr(this,t,e)}}function rr(t,e){return function(){return tr(this,t,e.apply(this,arguments))}}de.prototype={constructor:de,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}},Pe.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var nr=[null];function ir(t,e){this._groups=t,this._parents=e}function sr(){return new ir([[document.documentElement]],nr)}function ar(t){return"string"==typeof t?new ir([[document.querySelector(t)]],[document.documentElement]):new ir([[t]],nr)}function or(t,e){if(t=function(t){let e;for(;e=t.sourceEvent;)t=e;return t}(t),void 0===e&&(e=t.currentTarget),e){var r=e.ownerSVGElement||e;if(r.createSVGPoint){var n=r.createSVGPoint();return n.x=t.clientX,n.y=t.clientY,[(n=n.matrixTransform(e.getScreenCTM().inverse())).x,n.y]}if(e.getBoundingClientRect){var i=e.getBoundingClientRect();return[t.clientX-i.left-e.clientLeft,t.clientY-i.top-e.clientTop]}}return[t.pageX,t.pageY]}ir.prototype=sr.prototype={constructor:ir,select:function(t){"function"!=typeof t&&(t=ee(t));for(var e=this._groups,r=e.length,n=new Array(r),i=0;i<r;++i)for(var s,a,o=e[i],l=o.length,c=n[i]=new Array(l),h=0;h<l;++h)(s=o[h])&&(a=t.call(s,s.__data__,h,o))&&("__data__"in s&&(a.__data__=s.__data__),c[h]=a);return new ir(n,this._parents)},selectAll:function(t){t="function"==typeof t?ie(t):ne(t);for(var e=this._groups,r=e.length,n=[],i=[],s=0;s<r;++s)for(var a,o=e[s],l=o.length,c=0;c<l;++c)(a=o[c])&&(n.push(t.call(a,a.__data__,c,o)),i.push(a));return new ir(n,i)},selectChild:function(t){return this.select(null==t?le:function(t){return function(){return oe.call(this.children,t)}}("function"==typeof t?t:ae(t)))},selectChildren:function(t){return this.selectAll(null==t?he:function(t){return function(){return ce.call(this.children,t)}}("function"==typeof t?t:ae(t)))},filter:function(t){"function"!=typeof t&&(t=se(t));for(var e=this._groups,r=e.length,n=new Array(r),i=0;i<r;++i)for(var s,a=e[i],o=a.length,l=n[i]=[],c=0;c<o;++c)(s=a[c])&&t.call(s,s.__data__,c,a)&&l.push(s);return new ir(n,this._parents)},data:function(t,e){if(!arguments.length)return Array.from(this,me);var r=e?pe:fe,n=this._parents,i=this._groups;"function"!=typeof t&&(t=function(t){return function(){return t}}(t));for(var s=i.length,a=new Array(s),o=new Array(s),l=new Array(s),c=0;c<s;++c){var h=n[c],u=i[c],d=u.length,f=be(t.call(h,h&&h.__data__,c,n)),p=f.length,m=o[c]=new Array(p),b=a[c]=new Array(p);r(h,u,m,b,l[c]=new Array(d),f,e);for(var g,v,y=0,w=0;y<p;++y)if(g=m[y]){for(y>=w&&(w=y+1);!(v=b[w])&&++w<p;);g._next=v||null}}return(a=new ir(a,n))._enter=o,a._exit=l,a},enter:function(){return new ir(this._enter||this._groups.map(ue),this._parents)},exit:function(){return new ir(this._exit||this._groups.map(ue),this._parents)},join:function(t,e,r){var n=this.enter(),i=this,s=this.exit();return"function"==typeof t?(n=t(n))&&(n=n.selection()):n=n.append(t+""),null!=e&&(i=e(i))&&(i=i.selection()),null==r?s.remove():r(s),n&&i?n.merge(i).order():i},merge:function(t){for(var e=t.selection?t.selection():t,r=this._groups,n=e._groups,i=r.length,s=n.length,a=Math.min(i,s),o=new Array(i),l=0;l<a;++l)for(var c,h=r[l],u=n[l],d=h.length,f=o[l]=new Array(d),p=0;p<d;++p)(c=h[p]||u[p])&&(f[p]=c);for(;l<i;++l)o[l]=r[l];return new ir(o,this._parents)},selection:function(){return this},order:function(){for(var t=this._groups,e=-1,r=t.length;++e<r;)for(var n,i=t[e],s=i.length-1,a=i[s];--s>=0;)(n=i[s])&&(a&&4^n.compareDocumentPosition(a)&&a.parentNode.insertBefore(n,a),a=n);return this},sort:function(t){function e(e,r){return e&&r?t(e.__data__,r.__data__):!e-!r}t||(t=ge);for(var r=this._groups,n=r.length,i=new Array(n),s=0;s<n;++s){for(var a,o=r[s],l=o.length,c=i[s]=new Array(l),h=0;h<l;++h)(a=o[h])&&(c[h]=a);c.sort(e)}return new ir(i,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var t=this._groups,e=0,r=t.length;e<r;++e)for(var n=t[e],i=0,s=n.length;i<s;++i){var a=n[i];if(a)return a}return null},size:function(){let t=0;for(const e of this)++t;return t},empty:function(){return!this.node()},each:function(t){for(var e=this._groups,r=0,n=e.length;r<n;++r)for(var i,s=e[r],a=0,o=s.length;a<o;++a)(i=s[a])&&t.call(i,i.__data__,a,s);return this},attr:function(t,e){var r=Yt(t);if(arguments.length<2){var n=this.node();return r.local?n.getAttributeNS(r.space,r.local):n.getAttribute(r)}return this.each((null==e?r.local?ye:ve:"function"==typeof e?r.local?ke:$e:r.local?xe:we)(r,e))},style:function(t,e,r){return arguments.length>1?this.each((null==e?Se:"function"==typeof e?Ee:Ae)(t,e,null==r?"":r)):Te(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?Me:"function"==typeof e?Ne:Ce)(t,e)):this.node()[t]},classed:function(t,e){var r=Re(t+"");if(arguments.length<2){for(var n=qe(this.node()),i=-1,s=r.length;++i<s;)if(!n.contains(r[i]))return!1;return!0}return this.each(("function"==typeof e?He:e?Oe:Ue)(r,e))},text:function(t){return arguments.length?this.each(null==t?De:("function"==typeof t?Le:Ie)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?je:("function"==typeof t?Ve:Be)(t)):this.node().innerHTML},raise:function(){return this.each(Ke)},lower:function(){return this.each(Xe)},append:function(t){var e="function"==typeof t?t:Jt(t);return this.select((function(){return this.appendChild(e.apply(this,arguments))}))},insert:function(t,e){var r="function"==typeof t?t:Jt(t),n=null==e?We:"function"==typeof e?e:ee(e);return this.select((function(){return this.insertBefore(r.apply(this,arguments),n.apply(this,arguments)||null)}))},remove:function(){return this.each(Ge)},clone:function(t){return this.select(t?Ze:Ye)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,e,r){var n,i,s=function(t){return t.trim().split(/^|\s+/).map((function(t){var e="",r=t.indexOf(".");return r>=0&&(e=t.slice(r+1),t=t.slice(0,r)),{type:t,name:e}}))}(t+""),a=s.length;if(!(arguments.length<2)){for(o=e?Je:Qe,n=0;n<a;++n)this.each(o(s[n],e,r));return this}var o=this.node().__on;if(o)for(var l,c=0,h=o.length;c<h;++c)for(n=0,l=o[c];n<a;++n)if((i=s[n]).type===l.type&&i.name===l.name)return l.value},dispatch:function(t,e){return this.each(("function"==typeof e?rr:er)(t,e))},[Symbol.iterator]:function*(){for(var t=this._groups,e=0,r=t.length;e<r;++e)for(var n,i=t[e],s=0,a=i.length;s<a;++s)(n=i[s])&&(yield n)}};const lr={passive:!1},cr={capture:!0,passive:!1};function hr(t){t.stopImmediatePropagation()}function ur(t){t.preventDefault(),t.stopImmediatePropagation()}var dr=t=>()=>t;function fr(t,{sourceEvent:e,subject:r,target:n,identifier:i,active:s,x:a,y:o,dx:l,dy:c,dispatch:h}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:r,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:o,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:h}})}function pr(t){return!t.ctrlKey&&!t.button}function mr(){return this.parentNode}function br(t,e){return null==e?{x:t.x,y:t.y}:e}function gr(){return navigator.maxTouchPoints||"ontouchstart"in this}function vr(){var t,e,r,n,i=pr,s=mr,a=br,o=gr,l={},c=Bt("start","drag","end"),h=0,u=0;function d(t){t.on("mousedown.drag",f).filter(o).on("touchstart.drag",b).on("touchmove.drag",g,lr).on("touchend.drag touchcancel.drag",v).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function f(a,o){if(!n&&i.call(this,a,o)){var l=y(this,s.call(this,a,o),a,o,"mouse");l&&(ar(a.view).on("mousemove.drag",p,cr).on("mouseup.drag",m,cr),function(t){var e=t.document.documentElement,r=ar(t).on("dragstart.drag",ur,cr);"onselectstart"in e?r.on("selectstart.drag",ur,cr):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}(a.view),hr(a),r=!1,t=a.clientX,e=a.clientY,l("start",a))}}function p(n){if(ur(n),!r){var i=n.clientX-t,s=n.clientY-e;r=i*i+s*s>u}l.mouse("drag",n)}function m(t){ar(t.view).on("mousemove.drag mouseup.drag",null),function(t,e){var r=t.document.documentElement,n=ar(t).on("dragstart.drag",null);e&&(n.on("click.drag",ur,cr),setTimeout((function(){n.on("click.drag",null)}),0)),"onselectstart"in r?n.on("selectstart.drag",null):(r.style.MozUserSelect=r.__noselect,delete r.__noselect)}(t.view,r),ur(t),l.mouse("end",t)}function b(t,e){if(i.call(this,t,e)){var r,n,a=t.changedTouches,o=s.call(this,t,e),l=a.length;for(r=0;r<l;++r)(n=y(this,o,t,e,a[r].identifier,a[r]))&&(hr(t),n("start",t,a[r]))}}function g(t){var e,r,n=t.changedTouches,i=n.length;for(e=0;e<i;++e)(r=l[n[e].identifier])&&(ur(t),r("drag",t,n[e]))}function v(t){var e,r,i=t.changedTouches,s=i.length;for(n&&clearTimeout(n),n=setTimeout((function(){n=null}),500),e=0;e<s;++e)(r=l[i[e].identifier])&&(hr(t),r("end",t,i[e]))}function y(t,e,r,n,i,s){var o,u,f,p=c.copy(),m=or(s||r,e);if(null!=(f=a.call(t,new fr("beforestart",{sourceEvent:r,target:d,identifier:i,active:h,x:m[0],y:m[1],dx:0,dy:0,dispatch:p}),n)))return o=f.x-m[0]||0,u=f.y-m[1]||0,function r(s,a,c){var b,g=m;switch(s){case"start":l[i]=r,b=h++;break;case"end":delete l[i],--h;case"drag":m=or(c||a,e),b=h}p.call(s,t,new fr(s,{sourceEvent:a,subject:f,target:d,identifier:i,active:b,x:m[0]+o,y:m[1]+u,dx:m[0]-g[0],dy:m[1]-g[1],dispatch:p}),n)}}return d.filter=function(t){return arguments.length?(i="function"==typeof t?t:dr(!!t),d):i},d.container=function(t){return arguments.length?(s="function"==typeof t?t:dr(t),d):s},d.subject=function(t){return arguments.length?(a="function"==typeof t?t:dr(t),d):a},d.touchable=function(t){return arguments.length?(o="function"==typeof t?t:dr(!!t),d):o},d.on=function(){var t=c.on.apply(c,arguments);return t===c?d:t},d.clickDistance=function(t){return arguments.length?(u=(t=+t)*t,d):Math.sqrt(u)},d}function yr(t,e,r){t.prototype=e.prototype=r,r.constructor=t}function wr(t,e){var r=Object.create(t.prototype);for(var n in e)r[n]=e[n];return r}function xr(){}fr.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};var $r=.7,kr=1/$r,_r="\\s*([+-]?\\d+)\\s*",Sr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ar="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Er=/^#([0-9a-f]{3,8})$/,Tr=new RegExp(`^rgb\\(${_r},${_r},${_r}\\)$`),Mr=new RegExp(`^rgb\\(${Ar},${Ar},${Ar}\\)$`),Cr=new RegExp(`^rgba\\(${_r},${_r},${_r},${Sr}\\)$`),Nr=new RegExp(`^rgba\\(${Ar},${Ar},${Ar},${Sr}\\)$`),Rr=new RegExp(`^hsl\\(${Sr},${Ar},${Ar}\\)$`),qr=new RegExp(`^hsla\\(${Sr},${Ar},${Ar},${Sr}\\)$`),Pr={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function zr(){return this.rgb().formatHex()}function Fr(){return this.rgb().formatRgb()}function Or(t){var e,r;return t=(t+"").trim().toLowerCase(),(e=Er.exec(t))?(r=e[1].length,e=parseInt(e[1],16),6===r?Ur(e):3===r?new Ir(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===r?Hr(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===r?Hr(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=Tr.exec(t))?new Ir(e[1],e[2],e[3],1):(e=Mr.exec(t))?new Ir(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=Cr.exec(t))?Hr(e[1],e[2],e[3],e[4]):(e=Nr.exec(t))?Hr(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=Rr.exec(t))?Xr(e[1],e[2]/100,e[3]/100,1):(e=qr.exec(t))?Xr(e[1],e[2]/100,e[3]/100,e[4]):Pr.hasOwnProperty(t)?Ur(Pr[t]):"transparent"===t?new Ir(NaN,NaN,NaN,0):null}function Ur(t){return new Ir(t>>16&255,t>>8&255,255&t,1)}function Hr(t,e,r,n){return n<=0&&(t=e=r=NaN),new Ir(t,e,r,n)}function Dr(t,e,r,n){return 1===arguments.length?function(t){return t instanceof xr||(t=Or(t)),t?new Ir((t=t.rgb()).r,t.g,t.b,t.opacity):new Ir}(t):new Ir(t,e,r,null==n?1:n)}function Ir(t,e,r,n){this.r=+t,this.g=+e,this.b=+r,this.opacity=+n}function Lr(){return`#${Kr(this.r)}${Kr(this.g)}${Kr(this.b)}`}function jr(){const t=Br(this.opacity);return`${1===t?"rgb(":"rgba("}${Vr(this.r)}, ${Vr(this.g)}, ${Vr(this.b)}${1===t?")":`, ${t})`}`}function Br(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Vr(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Kr(t){return((t=Vr(t))<16?"0":"")+t.toString(16)}function Xr(t,e,r,n){return n<=0?t=e=r=NaN:r<=0||r>=1?t=e=NaN:e<=0&&(t=NaN),new Gr(t,e,r,n)}function Wr(t){if(t instanceof Gr)return new Gr(t.h,t.s,t.l,t.opacity);if(t instanceof xr||(t=Or(t)),!t)return new Gr;if(t instanceof Gr)return t;var e=(t=t.rgb()).r/255,r=t.g/255,n=t.b/255,i=Math.min(e,r,n),s=Math.max(e,r,n),a=NaN,o=s-i,l=(s+i)/2;return o?(a=e===s?(r-n)/o+6*(r<n):r===s?(n-e)/o+2:(e-r)/o+4,o/=l<.5?s+i:2-s-i,a*=60):o=l>0&&l<1?0:a,new Gr(a,o,l,t.opacity)}function Gr(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}function Yr(t){return(t=(t||0)%360)<0?t+360:t}function Zr(t){return Math.max(0,Math.min(1,t||0))}function Qr(t,e,r){return 255*(t<60?e+(r-e)*t/60:t<180?r:t<240?e+(r-e)*(240-t)/60:e)}yr(xr,Or,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:zr,formatHex:zr,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Wr(this).formatHsl()},formatRgb:Fr,toString:Fr}),yr(Ir,Dr,wr(xr,{brighter(t){return t=null==t?kr:Math.pow(kr,t),new Ir(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?$r:Math.pow($r,t),new Ir(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Ir(Vr(this.r),Vr(this.g),Vr(this.b),Br(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Lr,formatHex:Lr,formatHex8:function(){return`#${Kr(this.r)}${Kr(this.g)}${Kr(this.b)}${Kr(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:jr,toString:jr})),yr(Gr,(function(t,e,r,n){return 1===arguments.length?Wr(t):new Gr(t,e,r,null==n?1:n)}),wr(xr,{brighter(t){return t=null==t?kr:Math.pow(kr,t),new Gr(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?$r:Math.pow($r,t),new Gr(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*e,i=2*r-n;return new Ir(Qr(t>=240?t-240:t+120,i,n),Qr(t,i,n),Qr(t<120?t+240:t-120,i,n),this.opacity)},clamp(){return new Gr(Yr(this.h),Zr(this.s),Zr(this.l),Br(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=Br(this.opacity);return`${1===t?"hsl(":"hsla("}${Yr(this.h)}, ${100*Zr(this.s)}%, ${100*Zr(this.l)}%${1===t?")":`, ${t})`}`}}));var Jr=t=>()=>t;function tn(t){return 1==(t=+t)?en:function(e,r){return r-e?function(t,e,r){return t=Math.pow(t,r),e=Math.pow(e,r)-t,r=1/r,function(n){return Math.pow(t+n*e,r)}}(e,r,t):Jr(isNaN(e)?r:e)}}function en(t,e){var r=e-t;return r?function(t,e){return function(r){return t+r*e}}(t,r):Jr(isNaN(t)?e:t)}var rn=function t(e){var r=tn(e);function n(t,e){var n=r((t=Dr(t)).r,(e=Dr(e)).r),i=r(t.g,e.g),s=r(t.b,e.b),a=en(t.opacity,e.opacity);return function(e){return t.r=n(e),t.g=i(e),t.b=s(e),t.opacity=a(e),t+""}}return n.gamma=t,n}(1);function nn(t,e){e||(e=[]);var r,n=t?Math.min(e.length,t.length):0,i=e.slice();return function(s){for(r=0;r<n;++r)i[r]=t[r]*(1-s)+e[r]*s;return i}}function sn(t,e){var r,n=e?e.length:0,i=t?Math.min(n,t.length):0,s=new Array(i),a=new Array(n);for(r=0;r<i;++r)s[r]=dn(t[r],e[r]);for(;r<n;++r)a[r]=e[r];return function(t){for(r=0;r<i;++r)a[r]=s[r](t);return a}}function an(t,e){var r=new Date;return t=+t,e=+e,function(n){return r.setTime(t*(1-n)+e*n),r}}function on(t,e){return t=+t,e=+e,function(r){return t*(1-r)+e*r}}function ln(t,e){var r,n={},i={};for(r in null!==t&&"object"==typeof t||(t={}),null!==e&&"object"==typeof e||(e={}),e)r in t?n[r]=dn(t[r],e[r]):i[r]=e[r];return function(t){for(r in n)i[r]=n[r](t);return i}}var cn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,hn=new RegExp(cn.source,"g");function un(t,e){var r,n,i,s=cn.lastIndex=hn.lastIndex=0,a=-1,o=[],l=[];for(t+="",e+="";(r=cn.exec(t))&&(n=hn.exec(e));)(i=n.index)>s&&(i=e.slice(s,i),o[a]?o[a]+=i:o[++a]=i),(r=r[0])===(n=n[0])?o[a]?o[a]+=n:o[++a]=n:(o[++a]=null,l.push({i:a,x:on(r,n)})),s=hn.lastIndex;return s<e.length&&(i=e.slice(s),o[a]?o[a]+=i:o[++a]=i),o.length<2?l[0]?function(t){return function(e){return t(e)+""}}(l[0].x):function(t){return function(){return t}}(e):(e=l.length,function(t){for(var r,n=0;n<e;++n)o[(r=l[n]).i]=r.x(t);return o.join("")})}function dn(t,e){var r,n=typeof e;return null==e||"boolean"===n?Jr(e):("number"===n?on:"string"===n?(r=Or(e))?(e=r,rn):un:e instanceof Or?rn:e instanceof Date?an:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}(e)?nn:Array.isArray(e)?sn:"function"!=typeof e.valueOf&&"function"!=typeof e.toString||isNaN(e)?ln:on)(t,e)}function fn(t,e){return t=+t,e=+e,function(r){return Math.round(t*(1-r)+e*r)}}var pn,mn=180/Math.PI,bn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function gn(t,e,r,n,i,s){var a,o,l;return(a=Math.sqrt(t*t+e*e))&&(t/=a,e/=a),(l=t*r+e*n)&&(r-=t*l,n-=e*l),(o=Math.sqrt(r*r+n*n))&&(r/=o,n/=o,l/=o),t*n<e*r&&(t=-t,e=-e,l=-l,a=-a),{translateX:i,translateY:s,rotate:Math.atan2(e,t)*mn,skewX:Math.atan(l)*mn,scaleX:a,scaleY:o}}function vn(t,e,r,n){function i(t){return t.length?t.pop()+" ":""}return function(s,a){var o=[],l=[];return s=t(s),a=t(a),function(t,n,i,s,a,o){if(t!==i||n!==s){var l=a.push("translate(",null,e,null,r);o.push({i:l-4,x:on(t,i)},{i:l-2,x:on(n,s)})}else(i||s)&&a.push("translate("+i+e+s+r)}(s.translateX,s.translateY,a.translateX,a.translateY,o,l),function(t,e,r,s){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),s.push({i:r.push(i(r)+"rotate(",null,n)-2,x:on(t,e)})):e&&r.push(i(r)+"rotate("+e+n)}(s.rotate,a.rotate,o,l),function(t,e,r,s){t!==e?s.push({i:r.push(i(r)+"skewX(",null,n)-2,x:on(t,e)}):e&&r.push(i(r)+"skewX("+e+n)}(s.skewX,a.skewX,o,l),function(t,e,r,n,s,a){if(t!==r||e!==n){var o=s.push(i(s)+"scale(",null,",",null,")");a.push({i:o-4,x:on(t,r)},{i:o-2,x:on(e,n)})}else 1===r&&1===n||s.push(i(s)+"scale("+r+","+n+")")}(s.scaleX,s.scaleY,a.scaleX,a.scaleY,o,l),s=a=null,function(t){for(var e,r=-1,n=l.length;++r<n;)o[(e=l[r]).i]=e.x(t);return o.join("")}}}var yn,wn,xn=vn((function(t){const e=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?bn:gn(e.a,e.b,e.c,e.d,e.e,e.f)}),"px, ","px)","deg)"),$n=vn((function(t){return null==t?bn:(pn||(pn=document.createElementNS("http://www.w3.org/2000/svg","g")),pn.setAttribute("transform",t),(t=pn.transform.baseVal.consolidate())?gn((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):bn)}),", ",")",")"),kn=0,_n=0,Sn=0,An=1e3,En=0,Tn=0,Mn=0,Cn="object"==typeof performance&&performance.now?performance:Date,Nn="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Rn(){return Tn||(Nn(qn),Tn=Cn.now()+Mn)}function qn(){Tn=