@decidables/detectable-elements
Version:
detectable-elements: Web Components for visualizing Signal Detection Theory
23 lines • 307 kB
JavaScript
/**
* @license
* Copyright 2019 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,r=Symbol(),n=new WeakMap;let i=class{constructor(t,e,n){if(this._$cssResult$=!0,n!==r)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const r=this.t;if(e&&void 0===t){const e=void 0!==r&&1===r.length;e&&(t=n.get(r)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&n.set(r,t))}return t}toString(){return this.cssText}};const s=t=>new i("string"==typeof t?t:t+"",void 0,r),a=(t,...e)=>{const n=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 i(n,t,r)},o=e?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const r of t.cssRules)e+=r.cssText;return s(e)})(t):t
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/,{is:l,defineProperty:c,getOwnPropertyDescriptor:h,getOwnPropertyNames:u,getOwnPropertySymbols:d,getPrototypeOf:f}=Object,p=globalThis,m=p.trustedTypes,b=m?m.emptyScript:"",g=p.reactiveElementPolyfillSupport,v=(t,e)=>t,y={toAttribute(t,e){switch(e){case Boolean:t=t?b: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}},w=(t,e)=>!l(t,e),x={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:w};Symbol.metadata??=Symbol("metadata"),p.litPropertyMetadata??=new WeakMap;let $=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=x){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&&c(this.prototype,t,n)}}static getPropertyDescriptor(t,e,r){const{get:n,set:i}=h(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)??x}static _$Ei(){if(this.hasOwnProperty(v("elementProperties")))return;const t=f(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(v("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(v("properties"))){const t=this.properties,e=[...u(t),...d(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(o(t))}else void 0!==t&&e.push(o(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 r=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((r,n)=>{if(e)r.adoptedStyleSheets=n.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const e of n){const n=document.createElement("style"),i=t.litNonce;void 0!==i&&n.setAttribute("nonce",i),n.textContent=e.cssText,r.appendChild(n)}})(r,this.constructor.elementStyles),r}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:y).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:y;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??w)(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){}};$.elementStyles=[],$.shadowRootOptions={mode:"open"},$[v("elementProperties")]=new Map,$[v("finalized")]=new Map,g?.({ReactiveElement:$}),(p.reactiveElementVersions??=[]).push("2.0.4");
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const k=globalThis,_=k.trustedTypes,S=_?_.createPolicy("lit-html",{createHTML:t=>t}):void 0,A="$lit$",E=`lit$${Math.random().toFixed(9).slice(2)}$`,M="?"+E,T=`<${M}>`,C=document,N=()=>C.createComment(""),R=t=>null===t||"object"!=typeof t&&"function"!=typeof t,P=Array.isArray,q="[ \t\n\f\r]",z=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,F=/-->/g,O=/>/g,U=RegExp(`>|${q}(?:([^\\s"'>=/]+)(${q}*=${q}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),I=/'/g,H=/"/g,D=/^(?:script|style|textarea|title)$/i,L=t=>(e,...r)=>({_$litType$:t,strings:e,values:r}),j=L(1),B=L(2),V=Symbol.for("lit-noChange"),K=Symbol.for("lit-nothing"),X=new WeakMap,W=C.createTreeWalker(C,129);function G(t,e){if(!P(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==S?S.createHTML(e):e}const Y=(t,e)=>{const r=t.length-1,n=[];let i,s=2===e?"<svg>":3===e?"<math>":"",a=z;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===z?"!--"===l[1]?a=F:void 0!==l[1]?a=O:void 0!==l[2]?(D.test(l[2])&&(i=RegExp("</"+l[2],"g")),a=U):void 0!==l[3]&&(a=U):a===U?">"===l[0]?(a=i??z,c=-1):void 0===l[1]?c=-2:(c=a.lastIndex-l[2].length,o=l[1],a=void 0===l[3]?U:'"'===l[3]?H:I):a===H||a===I?a=U:a===F||a===O?a=z:(a=U,i=void 0);const u=a===U&&t[e+1].startsWith("/>")?" ":"";s+=a===z?r+T:c>=0?(n.push(o),r.slice(0,c)+A+r.slice(c)+E+u):r+E+(-2===c?e:u)}return[G(t,s+(t[r]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),n]};class Z{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]=Y(t,e);if(this.el=Z.createElement(l,r),W.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(n=W.nextNode())&&o.length<a;){if(1===n.nodeType){if(n.hasAttributes())for(const t of n.getAttributeNames())if(t.endsWith(A)){const e=c[s++],r=n.getAttribute(t).split(E),a=/([.?@])?(.*)/.exec(e);o.push({type:1,index:i,name:a[2],strings:r,ctor:"."===a[1]?rt:"?"===a[1]?nt:"@"===a[1]?it:et}),n.removeAttribute(t)}else t.startsWith(E)&&(o.push({type:6,index:i}),n.removeAttribute(t));if(D.test(n.tagName)){const t=n.textContent.split(E),e=t.length-1;if(e>0){n.textContent=_?_.emptyScript:"";for(let r=0;r<e;r++)n.append(t[r],N()),W.nextNode(),o.push({type:2,index:++i});n.append(t[e],N())}}}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(E,t+1));)o.push({type:7,index:i}),t+=E.length-1}i++}}static createElement(t,e){const r=C.createElement("template");return r.innerHTML=t,r}}function Q(t,e,r=t,n){if(e===V)return e;let i=void 0!==n?r._$Co?.[n]:r._$Cl;const s=R(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=Q(t,i._$AS(t,e.values),i,n)),e}class J{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??C).importNode(e,!0);W.currentNode=n;let i=W.nextNode(),s=0,a=0,o=r[0];for(;void 0!==o;){if(s===o.index){let e;2===o.type?e=new tt(i,i.nextSibling,this,t):1===o.type?e=new o.ctor(i,o.name,o.strings,this,t):6===o.type&&(e=new st(i,this,t)),this._$AV.push(e),o=r[++a]}s!==o?.index&&(i=W.nextNode(),s++)}return W.currentNode=C,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 tt{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,r,n){this.type=2,this._$AH=K,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=Q(this,t,e),R(t)?t===K||null==t||""===t?(this._$AH!==K&&this._$AR(),this._$AH=K):t!==this._$AH&&t!==V&&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!==K&&R(this._$AH)?this._$AA.nextSibling.data=t:this.T(C.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=Z.createElement(G(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===n)this._$AH.p(e);else{const t=new J(n,this),r=t.u(this.options);t.p(e),this.T(r),this._$AH=t}}_$AC(t){let e=X.get(t.strings);return void 0===e&&X.set(t.strings,e=new Z(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 tt(this.O(N()),this.O(N()),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 et{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,n,i){this.type=1,this._$AH=K,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=K}_$AI(t,e=this,r,n){const i=this.strings;let s=!1;if(void 0===i)t=Q(this,t,e,0),s=!R(t)||t!==this._$AH&&t!==V,s&&(this._$AH=t);else{const n=t;let a,o;for(t=i[0],a=0;a<i.length-1;a++)o=Q(this,n[r+a],e,a),o===V&&(o=this._$AH[a]),s||=!R(o)||o!==this._$AH[a],o===K?t=K:t!==K&&(t+=(o??"")+i[a+1]),this._$AH[a]=o}s&&!n&&this.j(t)}j(t){t===K?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class rt extends et{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===K?void 0:t}}class nt extends et{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==K)}}class it extends et{constructor(t,e,r,n,i){super(t,e,r,n,i),this.type=5}_$AI(t,e=this){if((t=Q(this,t,e,0)??K)===V)return;const r=this._$AH,n=t===K&&r!==K||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,i=t!==K&&(r===K||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 st{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){Q(this,t)}}const at=k.litHtmlPolyfillSupport;at?.(Z,tt),(k.litHtmlVersions??=[]).push("3.2.1");
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
class ot extends ${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 tt(e.insertBefore(N(),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 V}}ot._$litElement$=!0,ot.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:ot});const lt=globalThis.litElementPolyfillSupport;function ct(t,e){return null==t||null==e?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function ht(t,e){return null==t||null==e?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function ut(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=ct,r=(e,r)=>ct(t(e),r),n=(e,r)=>t(e)-r):(e=t===ct||t===ht?t:dt,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 dt(){return 0}lt?.({LitElement:ot}),(globalThis.litElementVersions??=[]).push("4.1.1");const ft=ut(ct).right;function pt(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]}ut((function(t){return null===t?NaN:+t})).center;class mt{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 bt(t){return t}var gt=Array.prototype.slice;function vt(t){return()=>t}const yt=Math.sqrt(50),wt=Math.sqrt(10),xt=Math.sqrt(2);function $t(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>=yt?10:s>=wt?5:s>=xt?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?$t(t,e,2*r):[o,l,c]}function kt(t,e,r){if(!((r=+r)>0))return[];if((t=+t)===(e=+e))return[t];const n=e<t,[i,s,a]=n?$t(e,t,r):$t(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 _t(t,e,r){return $t(t=+t,e=+e,r=+r)[2]}function St(t,e,r){let n;for(;;){const i=_t(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 At(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 Et(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 Tt=1,Ct=2,Nt=3,Rt=4,Pt=1e-6;function qt(t){return"translate("+t+",0)"}function zt(t){return"translate(0,"+t+")"}function Ft(t){return e=>+t(e)}function Ot(t,e){return e=Math.max(0,t.bandwidth()-2*e)/2,t.round()&&(e=Math.round(e)),r=>+t(r)+e}function Ut(){return!this.__axis}function It(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===Tt||t===Rt?-1:1,h=t===Rt||t===Ct?"x":"y",u=t===Tt||t===Nt?qt:zt;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?Ot:Ft)(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===Tt?"0em":t===Nt?"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===Rt||t===Ct?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(Ut).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",t===Ct?"start":t===Rt?"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 Ht(t){return It(Nt,t)}function Dt(t){return It(Rt,t)}var Lt={value:()=>{}};function jt(){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 Bt(n)}function Bt(t){this._=t}function Vt(t,e){for(var r,n=0,i=t.length;n<i;++n)if((r=t[n]).name===e)return r.value}function Kt(t,e,r){for(var n=0,i=t.length;n<i;++n)if(t[n].name===e){t[n]=Lt,t=t.slice(0,n).concat(t.slice(n+1));break}return null!=r&&t.push({name:e,value:r}),t}Bt.prototype=jt.prototype={constructor:Bt,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]=Kt(i[r],t.name,e);else if(null==e)for(r in i)i[r]=Kt(i[r],t.name,null);return this}for(;++a<o;)if((r=(t=s[a]).type)&&(r=Vt(i[r],t.name)))return r},copy:function(){var t={},e=this._;for(var r in e)t[r]=e[r].slice();return new Bt(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 Xt="http://www.w3.org/1999/xhtml",Wt={svg:"http://www.w3.org/2000/svg",xhtml:Xt,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Gt(t){var e=t+="",r=e.indexOf(":");return r>=0&&"xmlns"!==(e=t.slice(0,r))&&(t=t.slice(r+1)),Wt.hasOwnProperty(e)?{space:Wt[e],local:t}:t}function Yt(t){return function(){var e=this.ownerDocument,r=this.namespaceURI;return r===Xt&&e.documentElement.namespaceURI===Xt?e.createElement(t):e.createElementNS(r,t)}}function Zt(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function Qt(t){var e=Gt(t);return(e.local?Zt:Yt)(e)}function Jt(){}function te(t){return null==t?Jt:function(){return this.querySelector(t)}}function ee(){return[]}function re(t){return null==t?ee:function(){return this.querySelectorAll(t)}}function ne(t){return function(){return function(t){return null==t?[]:Array.isArray(t)?t:Array.from(t)}(t.apply(this,arguments))}}function ie(t){return function(){return this.matches(t)}}function se(t){return function(e){return e.matches(t)}}var ae=Array.prototype.find;function oe(){return this.firstElementChild}var le=Array.prototype.filter;function ce(){return Array.from(this.children)}function he(t){return new Array(t.length)}function ue(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function de(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 ue(t,s[o]);for(;o<l;++o)(a=e[o])&&(i[o]=a)}function fe(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 ue(t,s[o]);for(o=0;o<u;++o)(l=e[o])&&h.get(f[o])===l&&(i[o]=l)}function pe(t){return t.__data__}function me(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function be(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function ge(t){return function(){this.removeAttribute(t)}}function ve(t){return function(){this.removeAttributeNS(t.space,t.local)}}function ye(t,e){return function(){this.setAttribute(t,e)}}function we(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function xe(t,e){return function(){var r=e.apply(this,arguments);null==r?this.removeAttribute(t):this.setAttribute(t,r)}}function $e(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 ke(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function _e(t){return function(){this.style.removeProperty(t)}}function Se(t,e,r){return function(){this.style.setProperty(t,e,r)}}function Ae(t,e,r){return function(){var n=e.apply(this,arguments);null==n?this.style.removeProperty(t):this.style.setProperty(t,n,r)}}function Ee(t,e){return t.style.getPropertyValue(e)||ke(t).getComputedStyle(t,null).getPropertyValue(e)}function Me(t){return function(){delete this[t]}}function Te(t,e){return function(){this[t]=e}}function Ce(t,e){return function(){var r=e.apply(this,arguments);null==r?delete this[t]:this[t]=r}}function Ne(t){return t.trim().split(/^|\s+/)}function Re(t){return t.classList||new Pe(t)}function Pe(t){this._node=t,this._names=Ne(t.getAttribute("class")||"")}function qe(t,e){for(var r=Re(t),n=-1,i=e.length;++n<i;)r.add(e[n])}function ze(t,e){for(var r=Re(t),n=-1,i=e.length;++n<i;)r.remove(e[n])}function Fe(t){return function(){qe(this,t)}}function Oe(t){return function(){ze(this,t)}}function Ue(t,e){return function(){(e.apply(this,arguments)?qe:ze)(this,t)}}function Ie(){this.textContent=""}function He(t){return function(){this.textContent=t}}function De(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}function Le(){this.innerHTML=""}function je(t){return function(){this.innerHTML=t}}function Be(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}function Ve(){this.nextSibling&&this.parentNode.appendChild(this)}function Ke(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Xe(){return null}function We(){var t=this.parentNode;t&&t.removeChild(this)}function Ge(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Ye(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Ze(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 Qe(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 Je(t,e,r){var n=ke(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 tr(t,e){return function(){return Je(this,t,e)}}function er(t,e){return function(){return Je(this,t,e.apply(this,arguments))}}ue.prototype={constructor:ue,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 rr=[null];function nr(t,e){this._groups=t,this._parents=e}function ir(){return new nr([[document.documentElement]],rr)}function sr(t){return"string"==typeof t?new nr([[document.querySelector(t)]],[document.documentElement]):new nr([[t]],rr)}function ar(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]}nr.prototype=ir.prototype={constructor:nr,select:function(t){"function"!=typeof t&&(t=te(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 nr(n,this._parents)},selectAll:function(t){t="function"==typeof t?ne(t):re(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 nr(n,i)},selectChild:function(t){return this.select(null==t?oe:function(t){return function(){return ae.call(this.children,t)}}("function"==typeof t?t:se(t)))},selectChildren:function(t){return this.selectAll(null==t?ce:function(t){return function(){return le.call(this.children,t)}}("function"==typeof t?t:se(t)))},filter:function(t){"function"!=typeof t&&(t=ie(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 nr(n,this._parents)},data:function(t,e){if(!arguments.length)return Array.from(this,pe);var r=e?fe:de,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=me(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 nr(a,n))._enter=o,a._exit=l,a},enter:function(){return new nr(this._enter||this._groups.map(he),this._parents)},exit:function(){return new nr(this._exit||this._groups.map(he),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 nr(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=be);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 nr(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=Gt(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?ve:ge:"function"==typeof e?r.local?$e:xe:r.local?we:ye)(r,e))},style:function(t,e,r){return arguments.length>1?this.each((null==e?_e:"function"==typeof e?Ae:Se)(t,e,null==r?"":r)):Ee(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?Me:"function"==typeof e?Ce:Te)(t,e)):this.node()[t]},classed:function(t,e){var r=Ne(t+"");if(arguments.length<2){for(var n=Re(this.node()),i=-1,s=r.length;++i<s;)if(!n.contains(r[i]))return!1;return!0}return this.each(("function"==typeof e?Ue:e?Fe:Oe)(r,e))},text:function(t){return arguments.length?this.each(null==t?Ie:("function"==typeof t?De:He)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?Le:("function"==typeof t?Be:je)(t)):this.node().innerHTML},raise:function(){return this.each(Ve)},lower:function(){return this.each(Ke)},append:function(t){var e="function"==typeof t?t:Qt(t);return this.select((function(){return this.appendChild(e.apply(this,arguments))}))},insert:function(t,e){var r="function"==typeof t?t:Qt(t),n=null==e?Xe:"function"==typeof e?e:te(e);return this.select((function(){return this.insertBefore(r.apply(this,arguments),n.apply(this,arguments)||null)}))},remove:function(){return this.each(We)},clone:function(t){return this.select(t?Ye:Ge)},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?Qe:Ze,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?er:tr)(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 or={passive:!1},lr={capture:!0,passive:!1};function cr(t){t.stopImmediatePropagation()}function hr(t){t.preventDefault(),t.stopImmediatePropagation()}var ur=t=>()=>t;function dr(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 fr(t){return!t.ctrlKey&&!t.button}function pr(){return this.parentNode}function mr(t,e){return null==e?{x:t.x,y:t.y}:e}function br(){return navigator.maxTouchPoints||"ontouchstart"in this}function gr(){var t,e,r,n,i=fr,s=pr,a=mr,o=br,l={},c=jt("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,or).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&&(sr(a.view).on("mousemove.drag",p,lr).on("mouseup.drag",m,lr),function(t){var e=t.document.documentElement,r=sr(t).on("dragstart.drag",hr,lr);"onselectstart"in e?r.on("selectstart.drag",hr,lr):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}(a.view),cr(a),r=!1,t=a.clientX,e=a.clientY,l("start",a))}}function p(n){if(hr(n),!r){var i=n.clientX-t,s=n.clientY-e;r=i*i+s*s>u}l.mouse("drag",n)}function m(t){sr(t.view).on("mousemove.drag mouseup.drag",null),function(t,e){var r=t.document.documentElement,n=sr(t).on("dragstart.drag",null);e&&(n.on("click.drag",hr,lr),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),hr(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]))&&(cr(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])&&(hr(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])&&(cr(t),r("end",t,i[e]))}function y(t,e,r,n,i,s){var o,u,f,p=c.copy(),m=ar(s||r,e);if(null!=(f=a.call(t,new dr("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=ar(c||a,e),b=h}p.call(s,t,new dr(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:ur(!!t),d):i},d.container=function(t){return arguments.length?(s="function"==typeof t?t:ur(t),d):s},d.subject=function(t){return arguments.length?(a="function"==typeof t?t:ur(t),d):a},d.touchable=function(t){return arguments.length?(o="function"==typeof t?t:ur(!!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 vr(t,e,r){t.prototype=e.prototype=r,r.constructor=t}function yr(t,e){var r=Object.create(t.prototype);for(var n in e)r[n]=e[n];return r}function wr(){}dr.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};var xr=.7,$r=1/xr,kr="\\s*([+-]?\\d+)\\s*",_r="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Sr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Ar=/^#([0-9a-f]{3,8})$/,Er=new RegExp(`^rgb\\(${kr},${kr},${kr}\\)$`),Mr=new RegExp(`^rgb\\(${Sr},${Sr},${Sr}\\)$`),Tr=new RegExp(`^rgba\\(${kr},${kr},${kr},${_r}\\)$`),Cr=new RegExp(`^rgba\\(${Sr},${Sr},${Sr},${_r}\\)$`),Nr=new RegExp(`^hsl\\(${_r},${Sr},${Sr}\\)$`),Rr=new RegExp(`^hsla\\(${_r},${Sr},${Sr},${_r}\\)$`),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 qr(){return this.rgb().formatHex()}function zr(){return this.rgb().formatRgb()}function Fr(t){var e,r;return t=(t+"").trim().toLowerCase(),(e=Ar.exec(t))?(r=e[1].length,e=parseInt(e[1],16),6===r?Or(e):3===r?new Hr(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===r?Ur(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===r?Ur(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=Er.exec(t))?new Hr(e[1],e[2],e[3],1):(e=Mr.exec(t))?new Hr(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=Tr.exec(t))?Ur(e[1],e[2],e[3],e[4]):(e=Cr.exec(t))?Ur(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=Nr.exec(t))?Kr(e[1],e[2]/100,e[3]/100,1):(e=Rr.exec(t))?Kr(e[1],e[2]/100,e[3]/100,e[4]):Pr.hasOwnProperty(t)?Or(Pr[t]):"transparent"===t?new Hr(NaN,NaN,NaN,0):null}function Or(t){return new Hr(t>>16&255,t>>8&255,255&t,1)}function Ur(t,e,r,n){return n<=0&&(t=e=r=NaN),new Hr(t,e,r,n)}function Ir(t,e,r,n){return 1===arguments.length?function(t){return t instanceof wr||(t=Fr(t)),t?new Hr((t=t.rgb()).r,t.g,t.b,t.opacity):new Hr}(t):new Hr(t,e,r,null==n?1:n)}function Hr(t,e,r,n){this.r=+t,this.g=+e,this.b=+r,this.opacity=+n}function Dr(){return`#${Vr(this.r)}${Vr(this.g)}${Vr(this.b)}`}function Lr(){const t=jr(this.opacity);return`${1===t?"rgb(":"rgba("}${Br(this.r)}, ${Br(this.g)}, ${Br(this.b)}${1===t?")":`, ${t})`}`}function jr(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Br(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Vr(t){return((t=Br(t))<16?"0":"")+t.toString(16)}function Kr(t,e,r,n){return n<=0?t=e=r=NaN:r<=0||r>=1?t=e=NaN:e<=0&&(t=NaN),new Wr(t,e,r,n)}function Xr(t){if(t instanceof Wr)return new Wr(t.h,t.s,t.l,t.opacity);if(t instanceof wr||(t=Fr(t)),!t)return new Wr;if(t instanceof Wr)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 Wr(a,o,l,t.opacity)}function Wr(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}function Gr(t){return(t=(t||0)%360)<0?t+360:t}function Yr(t){return Math.max(0,Math.min(1,t||0))}function Zr(t,e,r){return 255*(t<60?e+(r-e)*t/60:t<180?r:t<240?e+(r-e)*(240-t)/60:e)}vr(wr,Fr,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:qr,formatHex:qr,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Xr(this).formatHsl()},formatRgb:zr,toString:zr}),vr(Hr,Ir,yr(wr,{brighter(t){return t=null==t?$r:Math.pow($r,t),new Hr(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?xr:Math.pow(xr,t),new Hr(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Hr(Br(this.r),Br(this.g),Br(this.b),jr(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:Dr,formatHex:Dr,formatHex8:function(){return`#${Vr(this.r)}${Vr(this.g)}${Vr(this.b)}${Vr(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Lr,toString:Lr})),vr(Wr,(function(t,e,r,n){return 1===arguments.length?Xr(t):new Wr(t,e,r,null==n?1:n)}),yr(wr,{brighter(t){return t=null==t?$r:Math.pow($r,t),new Wr(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?xr:Math.pow(xr,t),new Wr(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 Hr(Zr(t>=240?t-240:t+120,i,n),Zr(t,i,n),Zr(t<120?t+240:t-120,i,n),this.opacity)},clamp(){return new Wr(Gr(this.h),Yr(this.s),Yr(this.l),jr(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=jr(this.opacity);return`${1===t?"hsl(":"hsla("}${Gr(this.h)}, ${100*Yr(this.s)}%, ${100*Yr(this.l)}%${1===t?")":`, ${t})`}`}}));var Qr=t=>()=>t;function Jr(t){return 1==(t=+t)?tn: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):Qr(isNaN(e)?r:e)}}function tn(t,e){var r=e-t;return r?function(t,e){return function(r){return t+r*e}}(t,r):Qr(isNaN(t)?e:t)}var en=function t(e){var r=Jr(e);function n(t,e){var n=r((t=Ir(t)).r,(e=Ir(e)).r),i=r(t.g,e.g),s=r(t.b,e.b),a=tn(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 rn(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 nn(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]=un(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 sn(t,e){var r=new Date;return t=+t,e=+e,function(n){return r.setTime(t*(1-n)+e*n),r}}function an(t,e){return t=+t,e=+e,function(r){return t*(1-r)+e*r}}function on(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]=un(t[r],e[r]):i[r]=e[r];return function(t){for(r in n)i[r]=n[r](t);return i}}var ln=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,cn=new RegExp(ln.source,"g");function hn(t,e){var r,n,i,s=ln.lastIndex=cn.lastIndex=0,a=-1,o=[],l=[];for(t+="",e+="";(r=ln.exec(t))&&(n=cn.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:an(r,n)})),s=cn.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 un(t,e){var r,n=typeof e;return null==e||"boolean"===n?Qr(e):("number"===n?an:"string"===n?(r=Fr(e))?(e=r,en):hn:e instanceof Fr?en:e instanceof Date?sn:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}(e)?rn:Array.isArray(e)?nn:"function"!=typeof e.valueOf&&"function"!=typeof e.toString||isNaN(e)?on:an)(t,e)}function dn(t,e){return t=+t,e=+e,function(r){return Math.round(t*(1-r)+e*r)}}var fn,pn=180/Math.PI,mn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function bn(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)*pn,skewX:Math.atan(l)*pn,scaleX:a,scaleY:o}}function gn(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:an(t,i)},{i:l-2,x:an(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:an(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:an(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:an(t,r)},{i:o-2,x:an(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 vn,yn,wn=gn((function(t){const e=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?mn:bn(e.a,e.b,e.c,e.d,e.e,e.f)}),"px, ","px)","deg)"),xn=gn((function(t){return null==t?mn:(fn||(fn=document.createElementNS("http://www.w3.org/2000/svg","g")),fn.setAttribute("transform",t),(t=fn.transform.baseVal.consolidate())?bn((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):mn)}),", ",")",")"),$n=0,kn=0,_n=0,Sn=1e3,An=0,En=0,Mn=0,Tn="object"==typeof performance&&performance.now?performance:Date,Cn="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Nn(){return En||(Cn(Rn),En=Tn.now()+Mn)}function Rn(){En=0}function Pn(){this._call=this._time=this._next=null}function qn(t,e,r){var n=new Pn;return n.restart(t,e,r),n}function zn(){En=(An=Tn.now())+Mn,$n=kn=0;try{!function(){Nn(),++$n;for(var t,e=vn;e;)(t=En-e._time)>=0&&e._call.call(void 0,t),e=e._next;--$n}()}finally{$n=0,function(){va