@decidables/accumulable-elements 0.3.4 → 0.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,12 +14,12 @@
14
14
  * Copyright 2017 Google LLC
15
15
  * SPDX-License-Identifier: BSD-3-Clause
16
16
  */
17
- const C=globalThis,v=C.trustedTypes,A=v?v.createPolicy("lit-html",{createHTML:t=>t}):void 0,x="$lit$",E=`lit$${Math.random().toFixed(9).slice(2)}$`,R="?"+E,S=`<${R}>`,N=document,L=()=>N.createComment(""),w=t=>null===t||"object"!=typeof t&&"function"!=typeof t,D=Array.isArray,M="[ \t\n\f\r]",k=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,T=/-->/g,V=/>/g,$=RegExp(`>|${M}(?:([^\\s"'>=/]+)(${M}*=${M}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),H=/'/g,z=/"/g,G=/^(?:script|style|textarea|title)$/i,Y=t=>(e,...i)=>({_$litType$:t,strings:e,values:i}),X=Y(1),J=Y(2),W=Symbol.for("lit-noChange"),_=Symbol.for("lit-nothing"),K=new WeakMap,Z=N.createTreeWalker(N,129);function P(t,e){if(!D(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==A?A.createHTML(e):e}const O=(t,e)=>{const i=t.length-1,s=[];let r,a=2===e?"<svg>":3===e?"<math>":"",n=k;for(let e=0;e<i;e++){const i=t[e];let o,l,c=-1,d=0;for(;d<i.length&&(n.lastIndex=d,l=n.exec(i),null!==l);)d=n.lastIndex,n===k?"!--"===l[1]?n=T:void 0!==l[1]?n=V:void 0!==l[2]?(G.test(l[2])&&(r=RegExp("</"+l[2],"g")),n=$):void 0!==l[3]&&(n=$):n===$?">"===l[0]?(n=r??k,c=-1):void 0===l[1]?c=-2:(c=n.lastIndex-l[2].length,o=l[1],n=void 0===l[3]?$:'"'===l[3]?z:H):n===z||n===H?n=$:n===T||n===V?n=k:(n=$,r=void 0);const u=n===$&&t[e+1].startsWith("/>")?" ":"";a+=n===k?i+S:c>=0?(s.push(o),i.slice(0,c)+x+i.slice(c)+E+u):i+E+(-2===c?e:u)}return[P(t,a+(t[i]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),s]};class j{constructor({strings:t,_$litType$:e},i){let s;this.parts=[];let r=0,a=0;const n=t.length-1,o=this.parts,[l,c]=O(t,e);if(this.el=j.createElement(l,i),Z.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(s=Z.nextNode())&&o.length<n;){if(1===s.nodeType){if(s.hasAttributes())for(const t of s.getAttributeNames())if(t.endsWith(x)){const e=c[a++],i=s.getAttribute(t).split(E),n=/([.?@])?(.*)/.exec(e);o.push({type:1,index:r,name:n[2],strings:i,ctor:"."===n[1]?st:"?"===n[1]?rt:"@"===n[1]?at:it}),s.removeAttribute(t)}else t.startsWith(E)&&(o.push({type:6,index:r}),s.removeAttribute(t));if(G.test(s.tagName)){const t=s.textContent.split(E),e=t.length-1;if(e>0){s.textContent=v?v.emptyScript:"";for(let i=0;i<e;i++)s.append(t[i],L()),Z.nextNode(),o.push({type:2,index:++r});s.append(t[e],L())}}}else if(8===s.nodeType)if(s.data===R)o.push({type:2,index:r});else{let t=-1;for(;-1!==(t=s.data.indexOf(E,t+1));)o.push({type:7,index:r}),t+=E.length-1}r++}}static createElement(t,e){const i=N.createElement("template");return i.innerHTML=t,i}}function q(t,e,i=t,s){if(e===W)return e;let r=void 0!==s?i._$Co?.[s]:i._$Cl;const a=w(e)?void 0:e._$litDirective$;return r?.constructor!==a&&(r?._$AO?.(!1),void 0===a?r=void 0:(r=new a(t),r._$AT(t,i,s)),void 0!==s?(i._$Co??=[])[s]=r:i._$Cl=r),void 0!==r&&(e=q(t,r._$AS(t,e.values),r,s)),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:i}=this._$AD,s=(t?.creationScope??N).importNode(e,!0);Z.currentNode=s;let r=Z.nextNode(),a=0,n=0,o=i[0];for(;void 0!==o;){if(a===o.index){let e;2===o.type?e=new et(r,r.nextSibling,this,t):1===o.type?e=new o.ctor(r,o.name,o.strings,this,t):6===o.type&&(e=new nt(r,this,t)),this._$AV.push(e),o=i[++n]}a!==o?.index&&(r=Z.nextNode(),a++)}return Z.currentNode=N,s}p(t){let e=0;for(const i of this._$AV)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class et{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,i,s){this.type=2,this._$AH=_,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=s,this._$Cv=s?.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),w(t)?t===_||null==t||""===t?(this._$AH!==_&&this._$AR(),this._$AH=_):t!==this._$AH&&t!==W&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>D(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!==_&&w(this._$AH)?this._$AA.nextSibling.data=t:this.T(N.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:i}=t,s="number"==typeof i?this._$AC(t):(void 0===i.el&&(i.el=j.createElement(P(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===s)this._$AH.p(e);else{const t=new tt(s,this),i=t.u(this.options);t.p(e),this.T(i),this._$AH=t}}_$AC(t){let e=K.get(t.strings);return void 0===e&&K.set(t.strings,e=new j(t)),e}k(t){D(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,s=0;for(const r of t)s===e.length?e.push(i=new et(this.O(L()),this.O(L()),this,this.options)):i=e[s],i._$AI(r),s++;s<e.length&&(this._$AR(i&&i._$AB.nextSibling,s),e.length=s)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class it{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,i,s,r){this.type=1,this._$AH=_,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=r,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=_}_$AI(t,e=this,i,s){const r=this.strings;let a=!1;if(void 0===r)t=q(this,t,e,0),a=!w(t)||t!==this._$AH&&t!==W,a&&(this._$AH=t);else{const s=t;let n,o;for(t=r[0],n=0;n<r.length-1;n++)o=q(this,s[i+n],e,n),o===W&&(o=this._$AH[n]),a||=!w(o)||o!==this._$AH[n],o===_?t=_:t!==_&&(t+=(o??"")+r[n+1]),this._$AH[n]=o}a&&!s&&this.j(t)}j(t){t===_?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class st extends it{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===_?void 0:t}}class rt extends it{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==_)}}class at extends it{constructor(t,e,i,s,r){super(t,e,i,s,r),this.type=5}_$AI(t,e=this){if((t=q(this,t,e,0)??_)===W)return;const i=this._$AH,s=t===_&&i!==_||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,r=t!==_&&(i===_||s);s&&this.element.removeEventListener(this.name,this,i),r&&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 nt{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){q(this,t)}}const ot=C.litHtmlPolyfillSupport;ot?.(j,et),(C.litHtmlVersions??=[]).push("3.3.1");const lt=globalThis;
17
+ const C=globalThis,v=C.trustedTypes,A=v?v.createPolicy("lit-html",{createHTML:t=>t}):void 0,x="$lit$",E=`lit$${Math.random().toFixed(9).slice(2)}$`,R="?"+E,S=`<${R}>`,N=document,L=()=>N.createComment(""),w=t=>null===t||"object"!=typeof t&&"function"!=typeof t,D=Array.isArray,M="[ \t\n\f\r]",k=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,T=/-->/g,V=/>/g,$=RegExp(`>|${M}(?:([^\\s"'>=/]+)(${M}*=${M}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),H=/'/g,z=/"/g,G=/^(?:script|style|textarea|title)$/i,Y=t=>(e,...i)=>({_$litType$:t,strings:e,values:i}),X=Y(1),J=Y(2),W=Symbol.for("lit-noChange"),_=Symbol.for("lit-nothing"),K=new WeakMap,P=N.createTreeWalker(N,129);function Z(t,e){if(!D(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==A?A.createHTML(e):e}const O=(t,e)=>{const i=t.length-1,s=[];let r,a=2===e?"<svg>":3===e?"<math>":"",n=k;for(let e=0;e<i;e++){const i=t[e];let o,l,c=-1,d=0;for(;d<i.length&&(n.lastIndex=d,l=n.exec(i),null!==l);)d=n.lastIndex,n===k?"!--"===l[1]?n=T:void 0!==l[1]?n=V:void 0!==l[2]?(G.test(l[2])&&(r=RegExp("</"+l[2],"g")),n=$):void 0!==l[3]&&(n=$):n===$?">"===l[0]?(n=r??k,c=-1):void 0===l[1]?c=-2:(c=n.lastIndex-l[2].length,o=l[1],n=void 0===l[3]?$:'"'===l[3]?z:H):n===z||n===H?n=$:n===T||n===V?n=k:(n=$,r=void 0);const u=n===$&&t[e+1].startsWith("/>")?" ":"";a+=n===k?i+S:c>=0?(s.push(o),i.slice(0,c)+x+i.slice(c)+E+u):i+E+(-2===c?e:u)}return[Z(t,a+(t[i]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),s]};class j{constructor({strings:t,_$litType$:e},i){let s;this.parts=[];let r=0,a=0;const n=t.length-1,o=this.parts,[l,c]=O(t,e);if(this.el=j.createElement(l,i),P.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(s=P.nextNode())&&o.length<n;){if(1===s.nodeType){if(s.hasAttributes())for(const t of s.getAttributeNames())if(t.endsWith(x)){const e=c[a++],i=s.getAttribute(t).split(E),n=/([.?@])?(.*)/.exec(e);o.push({type:1,index:r,name:n[2],strings:i,ctor:"."===n[1]?st:"?"===n[1]?rt:"@"===n[1]?at:it}),s.removeAttribute(t)}else t.startsWith(E)&&(o.push({type:6,index:r}),s.removeAttribute(t));if(G.test(s.tagName)){const t=s.textContent.split(E),e=t.length-1;if(e>0){s.textContent=v?v.emptyScript:"";for(let i=0;i<e;i++)s.append(t[i],L()),P.nextNode(),o.push({type:2,index:++r});s.append(t[e],L())}}}else if(8===s.nodeType)if(s.data===R)o.push({type:2,index:r});else{let t=-1;for(;-1!==(t=s.data.indexOf(E,t+1));)o.push({type:7,index:r}),t+=E.length-1}r++}}static createElement(t,e){const i=N.createElement("template");return i.innerHTML=t,i}}function q(t,e,i=t,s){if(e===W)return e;let r=void 0!==s?i._$Co?.[s]:i._$Cl;const a=w(e)?void 0:e._$litDirective$;return r?.constructor!==a&&(r?._$AO?.(!1),void 0===a?r=void 0:(r=new a(t),r._$AT(t,i,s)),void 0!==s?(i._$Co??=[])[s]=r:i._$Cl=r),void 0!==r&&(e=q(t,r._$AS(t,e.values),r,s)),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:i}=this._$AD,s=(t?.creationScope??N).importNode(e,!0);P.currentNode=s;let r=P.nextNode(),a=0,n=0,o=i[0];for(;void 0!==o;){if(a===o.index){let e;2===o.type?e=new et(r,r.nextSibling,this,t):1===o.type?e=new o.ctor(r,o.name,o.strings,this,t):6===o.type&&(e=new nt(r,this,t)),this._$AV.push(e),o=i[++n]}a!==o?.index&&(r=P.nextNode(),a++)}return P.currentNode=N,s}p(t){let e=0;for(const i of this._$AV)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class et{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,i,s){this.type=2,this._$AH=_,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=s,this._$Cv=s?.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),w(t)?t===_||null==t||""===t?(this._$AH!==_&&this._$AR(),this._$AH=_):t!==this._$AH&&t!==W&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>D(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!==_&&w(this._$AH)?this._$AA.nextSibling.data=t:this.T(N.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:i}=t,s="number"==typeof i?this._$AC(t):(void 0===i.el&&(i.el=j.createElement(Z(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===s)this._$AH.p(e);else{const t=new tt(s,this),i=t.u(this.options);t.p(e),this.T(i),this._$AH=t}}_$AC(t){let e=K.get(t.strings);return void 0===e&&K.set(t.strings,e=new j(t)),e}k(t){D(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,s=0;for(const r of t)s===e.length?e.push(i=new et(this.O(L()),this.O(L()),this,this.options)):i=e[s],i._$AI(r),s++;s<e.length&&(this._$AR(i&&i._$AB.nextSibling,s),e.length=s)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class it{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,i,s,r){this.type=1,this._$AH=_,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=r,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=_}_$AI(t,e=this,i,s){const r=this.strings;let a=!1;if(void 0===r)t=q(this,t,e,0),a=!w(t)||t!==this._$AH&&t!==W,a&&(this._$AH=t);else{const s=t;let n,o;for(t=r[0],n=0;n<r.length-1;n++)o=q(this,s[i+n],e,n),o===W&&(o=this._$AH[n]),a||=!w(o)||o!==this._$AH[n],o===_?t=_:t!==_&&(t+=(o??"")+r[n+1]),this._$AH[n]=o}a&&!s&&this.j(t)}j(t){t===_?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class st extends it{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===_?void 0:t}}class rt extends it{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==_)}}class at extends it{constructor(t,e,i,s,r){super(t,e,i,s,r),this.type=5}_$AI(t,e=this){if((t=q(this,t,e,0)??_)===W)return;const i=this._$AH,s=t===_&&i!==_||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,r=t!==_&&(i===_||s);s&&this.element.removeEventListener(this.name,this,i),r&&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 nt{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){q(this,t)}}const ot=C.litHtmlPolyfillSupport;ot?.(j,et),(C.litHtmlVersions??=[]).push("3.3.1");const lt=globalThis;
18
18
  /**
19
19
  * @license
20
20
  * Copyright 2017 Google LLC
21
21
  * SPDX-License-Identifier: BSD-3-Clause
22
- */class ct extends f{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,i)=>{const s=i?.renderBefore??e;let r=s._$litPart$;if(void 0===r){const t=i?.renderBefore??null;s._$litPart$=r=new et(e.insertBefore(L(),t),t,void 0,i??{})}return r._$AI(t),r})(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return W}}ct._$litElement$=!0,ct.finalized=!0,lt.litElementHydrateSupport?.({LitElement:ct});const dt=lt.litElementPolyfillSupport;function ut(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 gt(t){let e,i,s;function r(t,s,r=0,a=t.length){if(r<a){if(0!==e(s,s))return a;do{const e=r+a>>>1;i(t[e],s)<0?r=e+1:a=e}while(r<a)}return r}return 2!==t.length?(e=ut,i=(e,i)=>ut(t(e),i),s=(e,i)=>t(e)-i):(e=t===ut||t===ht?t:pt,i=t,s=t),{left:r,center:function(t,e,i=0,a=t.length){const n=r(t,e,i,a-1);return n>i&&s(t[n-1],e)>-s(t[n],e)?n-1:n},right:function(t,s,r=0,a=t.length){if(r<a){if(0!==e(s,s))return a;do{const e=r+a>>>1;i(t[e],s)<=0?r=e+1:a=e}while(r<a)}return r}}}function pt(){return 0}dt?.({LitElement:ct}),(lt.litElementVersions??=[]).push("4.2.1");const mt=gt(ut).right;gt(function(t){return null===t?NaN:+t}).center;const bt=Math.sqrt(50),yt=Math.sqrt(10),Qt=Math.sqrt(2);function Bt(t,e,i){const s=(e-t)/Math.max(0,i),r=Math.floor(Math.log10(s)),a=s/Math.pow(10,r),n=a>=bt?10:a>=yt?5:a>=Qt?2:1;let o,l,c;return r<0?(c=Math.pow(10,-r)/n,o=Math.round(t*c),l=Math.round(e*c),o/c<t&&++o,l/c>e&&--l,c=-c):(c=Math.pow(10,r)*n,o=Math.round(t/c),l=Math.round(e/c),o*c<t&&++o,l*c>e&&--l),l<o&&.5<=i&&i<2?Bt(t,e,2*i):[o,l,c]}function Ut(t,e,i){return Bt(t=+t,e=+e,i=+i)[2]}function Ft(t){return t}var It=1e-6;function ft(t){return"translate("+t+",0)"}function Ct(t){return"translate(0,"+t+")"}function vt(t){return e=>+t(e)}function At(t,e){return e=Math.max(0,t.bandwidth()-2*e)/2,t.round()&&(e=Math.round(e)),i=>+t(i)+e}function xt(){return!this.__axis}function Et(t,e){var i=[],s=null,r=null,a=6,n=6,o=3,l="undefined"!=typeof window&&window.devicePixelRatio>1?0:.5,c=1===t||4===t?-1:1,d=4===t||2===t?"x":"y",u=1===t||3===t?ft:Ct;function h(h){var g=null==s?e.ticks?e.ticks.apply(e,i):e.domain():s,p=null==r?e.tickFormat?e.tickFormat.apply(e,i):Ft:r,m=Math.max(a,0)+o,b=e.range(),y=+b[0]+l,Q=+b[b.length-1]+l,B=(e.bandwidth?At:vt)(e.copy(),l),U=h.selection?h.selection():h,F=U.selectAll(".domain").data([null]),I=U.selectAll(".tick").data(g,e).order(),f=I.exit(),C=I.enter().append("g").attr("class","tick"),v=I.select("line"),A=I.select("text");F=F.merge(F.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),I=I.merge(C),v=v.merge(C.append("line").attr("stroke","currentColor").attr(d+"2",c*a)),A=A.merge(C.append("text").attr("fill","currentColor").attr(d,c*m).attr("dy",1===t?"0em":3===t?"0.71em":"0.32em")),h!==U&&(F=F.transition(h),I=I.transition(h),v=v.transition(h),A=A.transition(h),f=f.transition(h).attr("opacity",It).attr("transform",function(t){return isFinite(t=B(t))?u(t+l):this.getAttribute("transform")}),C.attr("opacity",It).attr("transform",function(t){var e=this.parentNode.__axis;return u((e&&isFinite(e=e(t))?e:B(t))+l)})),f.remove(),F.attr("d",4===t||2===t?n?"M"+c*n+","+y+"H"+l+"V"+Q+"H"+c*n:"M"+l+","+y+"V"+Q:n?"M"+y+","+c*n+"V"+l+"H"+Q+"V"+c*n:"M"+y+","+l+"H"+Q),I.attr("opacity",1).attr("transform",function(t){return u(B(t)+l)}),v.attr(d+"2",c*a),A.attr(d,c*m).text(p),U.filter(xt).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",2===t?"start":4===t?"end":"middle"),U.each(function(){this.__axis=B})}return h.scale=function(t){return arguments.length?(e=t,h):e},h.ticks=function(){return i=Array.from(arguments),h},h.tickArguments=function(t){return arguments.length?(i=null==t?[]:Array.from(t),h):i.slice()},h.tickValues=function(t){return arguments.length?(s=null==t?null:Array.from(t),h):s&&s.slice()},h.tickFormat=function(t){return arguments.length?(r=t,h):r},h.tickSize=function(t){return arguments.length?(a=n=+t,h):a},h.tickSizeInner=function(t){return arguments.length?(a=+t,h):a},h.tickSizeOuter=function(t){return arguments.length?(n=+t,h):n},h.tickPadding=function(t){return arguments.length?(o=+t,h):o},h.offset=function(t){return arguments.length?(l=+t,h):l},h}function Rt(t){return Et(4,t)}var St={value:()=>{}};function Nt(){for(var t,e=0,i=arguments.length,s={};e<i;++e){if(!(t=arguments[e]+"")||t in s||/[\s.]/.test(t))throw new Error("illegal type: "+t);s[t]=[]}return new Lt(s)}function Lt(t){this._=t}function wt(t,e){for(var i,s=0,r=t.length;s<r;++s)if((i=t[s]).name===e)return i.value}function Dt(t,e,i){for(var s=0,r=t.length;s<r;++s)if(t[s].name===e){t[s]=St,t=t.slice(0,s).concat(t.slice(s+1));break}return null!=i&&t.push({name:e,value:i}),t}Lt.prototype=Nt.prototype={constructor:Lt,on:function(t,e){var i,s,r=this._,a=(s=r,(t+"").trim().split(/^|\s+/).map(function(t){var e="",i=t.indexOf(".");if(i>=0&&(e=t.slice(i+1),t=t.slice(0,i)),t&&!s.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}})),n=-1,o=a.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++n<o;)if(i=(t=a[n]).type)r[i]=Dt(r[i],t.name,e);else if(null==e)for(i in r)r[i]=Dt(r[i],t.name,null);return this}for(;++n<o;)if((i=(t=a[n]).type)&&(i=wt(r[i],t.name)))return i},copy:function(){var t={},e=this._;for(var i in e)t[i]=e[i].slice();return new Lt(t)},call:function(t,e){if((i=arguments.length-2)>0)for(var i,s,r=new Array(i),a=0;a<i;++a)r[a]=arguments[a+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(a=0,i=(s=this._[t]).length;a<i;++a)s[a].value.apply(e,r)},apply:function(t,e,i){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var s=this._[t],r=0,a=s.length;r<a;++r)s[r].value.apply(e,i)}};var Mt="http://www.w3.org/1999/xhtml",kt={svg:"http://www.w3.org/2000/svg",xhtml:Mt,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Tt(t){var e=t+="",i=e.indexOf(":");return i>=0&&"xmlns"!==(e=t.slice(0,i))&&(t=t.slice(i+1)),kt.hasOwnProperty(e)?{space:kt[e],local:t}:t}function Vt(t){return function(){var e=this.ownerDocument,i=this.namespaceURI;return i===Mt&&e.documentElement.namespaceURI===Mt?e.createElement(t):e.createElementNS(i,t)}}function $t(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function Ht(t){var e=Tt(t);return(e.local?$t:Vt)(e)}function zt(){}function Gt(t){return null==t?zt:function(){return this.querySelector(t)}}function Yt(){return[]}function Xt(t){return null==t?Yt:function(){return this.querySelectorAll(t)}}function Jt(t){return function(){return function(t){return null==t?[]:Array.isArray(t)?t:Array.from(t)}(t.apply(this,arguments))}}function Wt(t){return function(){return this.matches(t)}}function _t(t){return function(e){return e.matches(t)}}var Kt=Array.prototype.find;function Zt(){return this.firstElementChild}var Pt=Array.prototype.filter;function Ot(){return Array.from(this.children)}function jt(t){return new Array(t.length)}function qt(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function te(t,e,i,s,r,a){for(var n,o=0,l=e.length,c=a.length;o<c;++o)(n=e[o])?(n.__data__=a[o],s[o]=n):i[o]=new qt(t,a[o]);for(;o<l;++o)(n=e[o])&&(r[o]=n)}function ee(t,e,i,s,r,a,n){var o,l,c,d=new Map,u=e.length,h=a.length,g=new Array(u);for(o=0;o<u;++o)(l=e[o])&&(g[o]=c=n.call(l,l.__data__,o,e)+"",d.has(c)?r[o]=l:d.set(c,l));for(o=0;o<h;++o)c=n.call(t,a[o],o,a)+"",(l=d.get(c))?(s[o]=l,l.__data__=a[o],d.delete(c)):i[o]=new qt(t,a[o]);for(o=0;o<u;++o)(l=e[o])&&d.get(g[o])===l&&(r[o]=l)}function ie(t){return t.__data__}function se(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function re(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function ae(t){return function(){this.removeAttribute(t)}}function ne(t){return function(){this.removeAttributeNS(t.space,t.local)}}function oe(t,e){return function(){this.setAttribute(t,e)}}function le(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function ce(t,e){return function(){var i=e.apply(this,arguments);null==i?this.removeAttribute(t):this.setAttribute(t,i)}}function de(t,e){return function(){var i=e.apply(this,arguments);null==i?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,i)}}function ue(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function he(t){return function(){this.style.removeProperty(t)}}function ge(t,e,i){return function(){this.style.setProperty(t,e,i)}}function pe(t,e,i){return function(){var s=e.apply(this,arguments);null==s?this.style.removeProperty(t):this.style.setProperty(t,s,i)}}function me(t,e){return t.style.getPropertyValue(e)||ue(t).getComputedStyle(t,null).getPropertyValue(e)}function be(t){return function(){delete this[t]}}function ye(t,e){return function(){this[t]=e}}function Qe(t,e){return function(){var i=e.apply(this,arguments);null==i?delete this[t]:this[t]=i}}function Be(t){return t.trim().split(/^|\s+/)}function Ue(t){return t.classList||new Fe(t)}function Fe(t){this._node=t,this._names=Be(t.getAttribute("class")||"")}function Ie(t,e){for(var i=Ue(t),s=-1,r=e.length;++s<r;)i.add(e[s])}function fe(t,e){for(var i=Ue(t),s=-1,r=e.length;++s<r;)i.remove(e[s])}function Ce(t){return function(){Ie(this,t)}}function ve(t){return function(){fe(this,t)}}function Ae(t,e){return function(){(e.apply(this,arguments)?Ie:fe)(this,t)}}function xe(){this.textContent=""}function Ee(t){return function(){this.textContent=t}}function Re(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}function Se(){this.innerHTML=""}function Ne(t){return function(){this.innerHTML=t}}function Le(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}function we(){this.nextSibling&&this.parentNode.appendChild(this)}function De(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Me(){return null}function ke(){var t=this.parentNode;t&&t.removeChild(this)}function Te(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Ve(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function $e(t){return function(){var e=this.__on;if(e){for(var i,s=0,r=-1,a=e.length;s<a;++s)i=e[s],t.type&&i.type!==t.type||i.name!==t.name?e[++r]=i:this.removeEventListener(i.type,i.listener,i.options);++r?e.length=r:delete this.__on}}}function He(t,e,i){return function(){var s,r=this.__on,a=function(t){return function(e){t.call(this,e,this.__data__)}}(e);if(r)for(var n=0,o=r.length;n<o;++n)if((s=r[n]).type===t.type&&s.name===t.name)return this.removeEventListener(s.type,s.listener,s.options),this.addEventListener(s.type,s.listener=a,s.options=i),void(s.value=e);this.addEventListener(t.type,a,i),s={type:t.type,name:t.name,value:e,listener:a,options:i},r?r.push(s):this.__on=[s]}}function ze(t,e,i){var s=ue(t),r=s.CustomEvent;"function"==typeof r?r=new r(e,i):(r=s.document.createEvent("Event"),i?(r.initEvent(e,i.bubbles,i.cancelable),r.detail=i.detail):r.initEvent(e,!1,!1)),t.dispatchEvent(r)}function Ge(t,e){return function(){return ze(this,t,e)}}function Ye(t,e){return function(){return ze(this,t,e.apply(this,arguments))}}qt.prototype={constructor:qt,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)}},Fe.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 Xe=[null];function Je(t,e){this._groups=t,this._parents=e}function We(){return new Je([[document.documentElement]],Xe)}function _e(t){return"string"==typeof t?new Je([[document.querySelector(t)]],[document.documentElement]):new Je([[t]],Xe)}Je.prototype=We.prototype={constructor:Je,select:function(t){"function"!=typeof t&&(t=Gt(t));for(var e=this._groups,i=e.length,s=new Array(i),r=0;r<i;++r)for(var a,n,o=e[r],l=o.length,c=s[r]=new Array(l),d=0;d<l;++d)(a=o[d])&&(n=t.call(a,a.__data__,d,o))&&("__data__"in a&&(n.__data__=a.__data__),c[d]=n);return new Je(s,this._parents)},selectAll:function(t){t="function"==typeof t?Jt(t):Xt(t);for(var e=this._groups,i=e.length,s=[],r=[],a=0;a<i;++a)for(var n,o=e[a],l=o.length,c=0;c<l;++c)(n=o[c])&&(s.push(t.call(n,n.__data__,c,o)),r.push(n));return new Je(s,r)},selectChild:function(t){return this.select(null==t?Zt:function(t){return function(){return Kt.call(this.children,t)}}("function"==typeof t?t:_t(t)))},selectChildren:function(t){return this.selectAll(null==t?Ot:function(t){return function(){return Pt.call(this.children,t)}}("function"==typeof t?t:_t(t)))},filter:function(t){"function"!=typeof t&&(t=Wt(t));for(var e=this._groups,i=e.length,s=new Array(i),r=0;r<i;++r)for(var a,n=e[r],o=n.length,l=s[r]=[],c=0;c<o;++c)(a=n[c])&&t.call(a,a.__data__,c,n)&&l.push(a);return new Je(s,this._parents)},data:function(t,e){if(!arguments.length)return Array.from(this,ie);var i=e?ee:te,s=this._parents,r=this._groups;"function"!=typeof t&&(t=function(t){return function(){return t}}(t));for(var a=r.length,n=new Array(a),o=new Array(a),l=new Array(a),c=0;c<a;++c){var d=s[c],u=r[c],h=u.length,g=se(t.call(d,d&&d.__data__,c,s)),p=g.length,m=o[c]=new Array(p),b=n[c]=new Array(p);i(d,u,m,b,l[c]=new Array(h),g,e);for(var y,Q,B=0,U=0;B<p;++B)if(y=m[B]){for(B>=U&&(U=B+1);!(Q=b[U])&&++U<p;);y._next=Q||null}}return(n=new Je(n,s))._enter=o,n._exit=l,n},enter:function(){return new Je(this._enter||this._groups.map(jt),this._parents)},exit:function(){return new Je(this._exit||this._groups.map(jt),this._parents)},join:function(t,e,i){var s=this.enter(),r=this,a=this.exit();return"function"==typeof t?(s=t(s))&&(s=s.selection()):s=s.append(t+""),null!=e&&(r=e(r))&&(r=r.selection()),null==i?a.remove():i(a),s&&r?s.merge(r).order():r},merge:function(t){for(var e=t.selection?t.selection():t,i=this._groups,s=e._groups,r=i.length,a=s.length,n=Math.min(r,a),o=new Array(r),l=0;l<n;++l)for(var c,d=i[l],u=s[l],h=d.length,g=o[l]=new Array(h),p=0;p<h;++p)(c=d[p]||u[p])&&(g[p]=c);for(;l<r;++l)o[l]=i[l];return new Je(o,this._parents)},selection:function(){return this},order:function(){for(var t=this._groups,e=-1,i=t.length;++e<i;)for(var s,r=t[e],a=r.length-1,n=r[a];--a>=0;)(s=r[a])&&(n&&4^s.compareDocumentPosition(n)&&n.parentNode.insertBefore(s,n),n=s);return this},sort:function(t){function e(e,i){return e&&i?t(e.__data__,i.__data__):!e-!i}t||(t=re);for(var i=this._groups,s=i.length,r=new Array(s),a=0;a<s;++a){for(var n,o=i[a],l=o.length,c=r[a]=new Array(l),d=0;d<l;++d)(n=o[d])&&(c[d]=n);c.sort(e)}return new Je(r,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,i=t.length;e<i;++e)for(var s=t[e],r=0,a=s.length;r<a;++r){var n=s[r];if(n)return n}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,i=0,s=e.length;i<s;++i)for(var r,a=e[i],n=0,o=a.length;n<o;++n)(r=a[n])&&t.call(r,r.__data__,n,a);return this},attr:function(t,e){var i=Tt(t);if(arguments.length<2){var s=this.node();return i.local?s.getAttributeNS(i.space,i.local):s.getAttribute(i)}return this.each((null==e?i.local?ne:ae:"function"==typeof e?i.local?de:ce:i.local?le:oe)(i,e))},style:function(t,e,i){return arguments.length>1?this.each((null==e?he:"function"==typeof e?pe:ge)(t,e,null==i?"":i)):me(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?be:"function"==typeof e?Qe:ye)(t,e)):this.node()[t]},classed:function(t,e){var i=Be(t+"");if(arguments.length<2){for(var s=Ue(this.node()),r=-1,a=i.length;++r<a;)if(!s.contains(i[r]))return!1;return!0}return this.each(("function"==typeof e?Ae:e?Ce:ve)(i,e))},text:function(t){return arguments.length?this.each(null==t?xe:("function"==typeof t?Re:Ee)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?Se:("function"==typeof t?Le:Ne)(t)):this.node().innerHTML},raise:function(){return this.each(we)},lower:function(){return this.each(De)},append:function(t){var e="function"==typeof t?t:Ht(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})},insert:function(t,e){var i="function"==typeof t?t:Ht(t),s=null==e?Me:"function"==typeof e?e:Gt(e);return this.select(function(){return this.insertBefore(i.apply(this,arguments),s.apply(this,arguments)||null)})},remove:function(){return this.each(ke)},clone:function(t){return this.select(t?Ve:Te)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,e,i){var s,r,a=function(t){return t.trim().split(/^|\s+/).map(function(t){var e="",i=t.indexOf(".");return i>=0&&(e=t.slice(i+1),t=t.slice(0,i)),{type:t,name:e}})}(t+""),n=a.length;if(!(arguments.length<2)){for(o=e?He:$e,s=0;s<n;++s)this.each(o(a[s],e,i));return this}var o=this.node().__on;if(o)for(var l,c=0,d=o.length;c<d;++c)for(s=0,l=o[c];s<n;++s)if((r=a[s]).type===l.type&&r.name===l.name)return l.value},dispatch:function(t,e){return this.each(("function"==typeof e?Ye:Ge)(t,e))},[Symbol.iterator]:function*(){for(var t=this._groups,e=0,i=t.length;e<i;++e)for(var s,r=t[e],a=0,n=r.length;a<n;++a)(s=r[a])&&(yield s)}};var Ke=0;function Ze(){return new Pe}function Pe(){this._="@"+(++Ke).toString(36)}function Oe(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 i=e.ownerSVGElement||e;if(i.createSVGPoint){var s=i.createSVGPoint();return s.x=t.clientX,s.y=t.clientY,[(s=s.matrixTransform(e.getScreenCTM().inverse())).x,s.y]}if(e.getBoundingClientRect){var r=e.getBoundingClientRect();return[t.clientX-r.left-e.clientLeft,t.clientY-r.top-e.clientTop]}}return[t.pageX,t.pageY]}Pe.prototype=Ze.prototype={constructor:Pe,get:function(t){for(var e=this._;!(e in t);)if(!(t=t.parentNode))return;return t[e]},set:function(t,e){return t[this._]=e},remove:function(t){return this._ in t&&delete t[this._]},toString:function(){return this._}};const je={passive:!1},qe={capture:!0,passive:!1};function ti(t){t.stopImmediatePropagation()}function ei(t){t.preventDefault(),t.stopImmediatePropagation()}var ii=t=>()=>t;function si(t,{sourceEvent:e,subject:i,target:s,identifier:r,active:a,x:n,y:o,dx:l,dy:c,dispatch:d}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:i,enumerable:!0,configurable:!0},target:{value:s,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:n,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:d}})}function ri(t){return!t.ctrlKey&&!t.button}function ai(){return this.parentNode}function ni(t,e){return null==e?{x:t.x,y:t.y}:e}function oi(){return navigator.maxTouchPoints||"ontouchstart"in this}function li(){var t,e,i,s,r=ri,a=ai,n=ni,o=oi,l={},c=Nt("start","drag","end"),d=0,u=0;function h(t){t.on("mousedown.drag",g).filter(o).on("touchstart.drag",b).on("touchmove.drag",y,je).on("touchend.drag touchcancel.drag",Q).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(n,o){if(!s&&r.call(this,n,o)){var l=B(this,a.call(this,n,o),n,o,"mouse");l&&(_e(n.view).on("mousemove.drag",p,qe).on("mouseup.drag",m,qe),function(t){var e=t.document.documentElement,i=_e(t).on("dragstart.drag",ei,qe);"onselectstart"in e?i.on("selectstart.drag",ei,qe):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}(n.view),ti(n),i=!1,t=n.clientX,e=n.clientY,l("start",n))}}function p(s){if(ei(s),!i){var r=s.clientX-t,a=s.clientY-e;i=r*r+a*a>u}l.mouse("drag",s)}function m(t){_e(t.view).on("mousemove.drag mouseup.drag",null),function(t,e){var i=t.document.documentElement,s=_e(t).on("dragstart.drag",null);e&&(s.on("click.drag",ei,qe),setTimeout(function(){s.on("click.drag",null)},0)),"onselectstart"in i?s.on("selectstart.drag",null):(i.style.MozUserSelect=i.__noselect,delete i.__noselect)}(t.view,i),ei(t),l.mouse("end",t)}function b(t,e){if(r.call(this,t,e)){var i,s,n=t.changedTouches,o=a.call(this,t,e),l=n.length;for(i=0;i<l;++i)(s=B(this,o,t,e,n[i].identifier,n[i]))&&(ti(t),s("start",t,n[i]))}}function y(t){var e,i,s=t.changedTouches,r=s.length;for(e=0;e<r;++e)(i=l[s[e].identifier])&&(ei(t),i("drag",t,s[e]))}function Q(t){var e,i,r=t.changedTouches,a=r.length;for(s&&clearTimeout(s),s=setTimeout(function(){s=null},500),e=0;e<a;++e)(i=l[r[e].identifier])&&(ti(t),i("end",t,r[e]))}function B(t,e,i,s,r,a){var o,u,g,p=c.copy(),m=Oe(a||i,e);if(null!=(g=n.call(t,new si("beforestart",{sourceEvent:i,target:h,identifier:r,active:d,x:m[0],y:m[1],dx:0,dy:0,dispatch:p}),s)))return o=g.x-m[0]||0,u=g.y-m[1]||0,function i(a,n,c){var b,y=m;switch(a){case"start":l[r]=i,b=d++;break;case"end":delete l[r],--d;case"drag":m=Oe(c||n,e),b=d}p.call(a,t,new si(a,{sourceEvent:n,subject:g,target:h,identifier:r,active:b,x:m[0]+o,y:m[1]+u,dx:m[0]-y[0],dy:m[1]-y[1],dispatch:p}),s)}}return h.filter=function(t){return arguments.length?(r="function"==typeof t?t:ii(!!t),h):r},h.container=function(t){return arguments.length?(a="function"==typeof t?t:ii(t),h):a},h.subject=function(t){return arguments.length?(n="function"==typeof t?t:ii(t),h):n},h.touchable=function(t){return arguments.length?(o="function"==typeof t?t:ii(!!t),h):o},h.on=function(){var t=c.on.apply(c,arguments);return t===c?h:t},h.clickDistance=function(t){return arguments.length?(u=(t=+t)*t,h):Math.sqrt(u)},h}function ci(t,e,i){t.prototype=e.prototype=i,i.constructor=t}function di(t,e){var i=Object.create(t.prototype);for(var s in e)i[s]=e[s];return i}function ui(){}si.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};var hi=.7,gi=1/hi,pi="\\s*([+-]?\\d+)\\s*",mi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",bi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",yi=/^#([0-9a-f]{3,8})$/,Qi=new RegExp(`^rgb\\(${pi},${pi},${pi}\\)$`),Bi=new RegExp(`^rgb\\(${bi},${bi},${bi}\\)$`),Ui=new RegExp(`^rgba\\(${pi},${pi},${pi},${mi}\\)$`),Fi=new RegExp(`^rgba\\(${bi},${bi},${bi},${mi}\\)$`),Ii=new RegExp(`^hsl\\(${mi},${bi},${bi}\\)$`),fi=new RegExp(`^hsla\\(${mi},${bi},${bi},${mi}\\)$`),Ci={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 vi(){return this.rgb().formatHex()}function Ai(){return this.rgb().formatRgb()}function xi(t){var e,i;return t=(t+"").trim().toLowerCase(),(e=yi.exec(t))?(i=e[1].length,e=parseInt(e[1],16),6===i?Ei(e):3===i?new Ni(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===i?Ri(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===i?Ri(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=Qi.exec(t))?new Ni(e[1],e[2],e[3],1):(e=Bi.exec(t))?new Ni(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=Ui.exec(t))?Ri(e[1],e[2],e[3],e[4]):(e=Fi.exec(t))?Ri(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=Ii.exec(t))?Ti(e[1],e[2]/100,e[3]/100,1):(e=fi.exec(t))?Ti(e[1],e[2]/100,e[3]/100,e[4]):Ci.hasOwnProperty(t)?Ei(Ci[t]):"transparent"===t?new Ni(NaN,NaN,NaN,0):null}function Ei(t){return new Ni(t>>16&255,t>>8&255,255&t,1)}function Ri(t,e,i,s){return s<=0&&(t=e=i=NaN),new Ni(t,e,i,s)}function Si(t,e,i,s){return 1===arguments.length?function(t){return t instanceof ui||(t=xi(t)),t?new Ni((t=t.rgb()).r,t.g,t.b,t.opacity):new Ni}(t):new Ni(t,e,i,null==s?1:s)}function Ni(t,e,i,s){this.r=+t,this.g=+e,this.b=+i,this.opacity=+s}function Li(){return`#${ki(this.r)}${ki(this.g)}${ki(this.b)}`}function wi(){const t=Di(this.opacity);return`${1===t?"rgb(":"rgba("}${Mi(this.r)}, ${Mi(this.g)}, ${Mi(this.b)}${1===t?")":`, ${t})`}`}function Di(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Mi(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function ki(t){return((t=Mi(t))<16?"0":"")+t.toString(16)}function Ti(t,e,i,s){return s<=0?t=e=i=NaN:i<=0||i>=1?t=e=NaN:e<=0&&(t=NaN),new $i(t,e,i,s)}function Vi(t){if(t instanceof $i)return new $i(t.h,t.s,t.l,t.opacity);if(t instanceof ui||(t=xi(t)),!t)return new $i;if(t instanceof $i)return t;var e=(t=t.rgb()).r/255,i=t.g/255,s=t.b/255,r=Math.min(e,i,s),a=Math.max(e,i,s),n=NaN,o=a-r,l=(a+r)/2;return o?(n=e===a?(i-s)/o+6*(i<s):i===a?(s-e)/o+2:(e-i)/o+4,o/=l<.5?a+r:2-a-r,n*=60):o=l>0&&l<1?0:n,new $i(n,o,l,t.opacity)}function $i(t,e,i,s){this.h=+t,this.s=+e,this.l=+i,this.opacity=+s}function Hi(t){return(t=(t||0)%360)<0?t+360:t}function zi(t){return Math.max(0,Math.min(1,t||0))}function Gi(t,e,i){return 255*(t<60?e+(i-e)*t/60:t<180?i:t<240?e+(i-e)*(240-t)/60:e)}ci(ui,xi,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:vi,formatHex:vi,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Vi(this).formatHsl()},formatRgb:Ai,toString:Ai}),ci(Ni,Si,di(ui,{brighter(t){return t=null==t?gi:Math.pow(gi,t),new Ni(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?hi:Math.pow(hi,t),new Ni(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Ni(Mi(this.r),Mi(this.g),Mi(this.b),Di(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:Li,formatHex:Li,formatHex8:function(){return`#${ki(this.r)}${ki(this.g)}${ki(this.b)}${ki(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:wi,toString:wi})),ci($i,function(t,e,i,s){return 1===arguments.length?Vi(t):new $i(t,e,i,null==s?1:s)},di(ui,{brighter(t){return t=null==t?gi:Math.pow(gi,t),new $i(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?hi:Math.pow(hi,t),new $i(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,i=this.l,s=i+(i<.5?i:1-i)*e,r=2*i-s;return new Ni(Gi(t>=240?t-240:t+120,r,s),Gi(t,r,s),Gi(t<120?t+240:t-120,r,s),this.opacity)},clamp(){return new $i(Hi(this.h),zi(this.s),zi(this.l),Di(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=Di(this.opacity);return`${1===t?"hsl(":"hsla("}${Hi(this.h)}, ${100*zi(this.s)}%, ${100*zi(this.l)}%${1===t?")":`, ${t})`}`}}));var Yi=t=>()=>t;function Xi(t){return 1===(t=+t)?Ji:function(e,i){return i-e?function(t,e,i){return t=Math.pow(t,i),e=Math.pow(e,i)-t,i=1/i,function(s){return Math.pow(t+s*e,i)}}(e,i,t):Yi(isNaN(e)?i:e)}}function Ji(t,e){var i=e-t;return i?function(t,e){return function(i){return t+i*e}}(t,i):Yi(isNaN(t)?e:t)}var Wi=function t(e){var i=Xi(e);function s(t,e){var s=i((t=Si(t)).r,(e=Si(e)).r),r=i(t.g,e.g),a=i(t.b,e.b),n=Ji(t.opacity,e.opacity);return function(e){return t.r=s(e),t.g=r(e),t.b=a(e),t.opacity=n(e),t+""}}return s.gamma=t,s}(1);function _i(t,e){e||(e=[]);var i,s=t?Math.min(e.length,t.length):0,r=e.slice();return function(a){for(i=0;i<s;++i)r[i]=t[i]*(1-a)+e[i]*a;return r}}function Ki(t,e){var i,s=e?e.length:0,r=t?Math.min(s,t.length):0,a=new Array(r),n=new Array(s);for(i=0;i<r;++i)a[i]=es(t[i],e[i]);for(;i<s;++i)n[i]=e[i];return function(t){for(i=0;i<r;++i)n[i]=a[i](t);return n}}function Zi(t,e){var i=new Date;return t=+t,e=+e,function(s){return i.setTime(t*(1-s)+e*s),i}}function Pi(t,e){return t=+t,e=+e,function(i){return t*(1-i)+e*i}}function Oi(t,e){var i,s={},r={};for(i in null!==t&&"object"==typeof t||(t={}),null!==e&&"object"==typeof e||(e={}),e)i in t?s[i]=es(t[i],e[i]):r[i]=e[i];return function(t){for(i in s)r[i]=s[i](t);return r}}var ji=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,qi=new RegExp(ji.source,"g");function ts(t,e){var i,s,r,a=ji.lastIndex=qi.lastIndex=0,n=-1,o=[],l=[];for(t+="",e+="";(i=ji.exec(t))&&(s=qi.exec(e));)(r=s.index)>a&&(r=e.slice(a,r),o[n]?o[n]+=r:o[++n]=r),(i=i[0])===(s=s[0])?o[n]?o[n]+=s:o[++n]=s:(o[++n]=null,l.push({i:n,x:Pi(i,s)})),a=qi.lastIndex;return a<e.length&&(r=e.slice(a),o[n]?o[n]+=r:o[++n]=r),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 i,s=0;s<e;++s)o[(i=l[s]).i]=i.x(t);return o.join("")})}function es(t,e){var i,s=typeof e;return null==e||"boolean"===s?Yi(e):("number"===s?Pi:"string"===s?(i=xi(e))?(e=i,Wi):ts:e instanceof xi?Wi:e instanceof Date?Zi:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}(e)?_i:Array.isArray(e)?Ki:"function"!=typeof e.valueOf&&"function"!=typeof e.toString||isNaN(e)?Oi:Pi)(t,e)}function is(t,e){return t=+t,e=+e,function(i){return Math.round(t*(1-i)+e*i)}}var ss,rs=180/Math.PI,as={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function ns(t,e,i,s,r,a){var n,o,l;return(n=Math.sqrt(t*t+e*e))&&(t/=n,e/=n),(l=t*i+e*s)&&(i-=t*l,s-=e*l),(o=Math.sqrt(i*i+s*s))&&(i/=o,s/=o,l/=o),t*s<e*i&&(t=-t,e=-e,l=-l,n=-n),{translateX:r,translateY:a,rotate:Math.atan2(e,t)*rs,skewX:Math.atan(l)*rs,scaleX:n,scaleY:o}}function os(t,e,i,s){function r(t){return t.length?t.pop()+" ":""}return function(a,n){var o=[],l=[];return a=t(a),n=t(n),function(t,s,r,a,n,o){if(t!==r||s!==a){var l=n.push("translate(",null,e,null,i);o.push({i:l-4,x:Pi(t,r)},{i:l-2,x:Pi(s,a)})}else(r||a)&&n.push("translate("+r+e+a+i)}(a.translateX,a.translateY,n.translateX,n.translateY,o,l),function(t,e,i,a){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),a.push({i:i.push(r(i)+"rotate(",null,s)-2,x:Pi(t,e)})):e&&i.push(r(i)+"rotate("+e+s)}(a.rotate,n.rotate,o,l),function(t,e,i,a){t!==e?a.push({i:i.push(r(i)+"skewX(",null,s)-2,x:Pi(t,e)}):e&&i.push(r(i)+"skewX("+e+s)}(a.skewX,n.skewX,o,l),function(t,e,i,s,a,n){if(t!==i||e!==s){var o=a.push(r(a)+"scale(",null,",",null,")");n.push({i:o-4,x:Pi(t,i)},{i:o-2,x:Pi(e,s)})}else 1===i&&1===s||a.push(r(a)+"scale("+i+","+s+")")}(a.scaleX,a.scaleY,n.scaleX,n.scaleY,o,l),a=n=null,function(t){for(var e,i=-1,s=l.length;++i<s;)o[(e=l[i]).i]=e.x(t);return o.join("")}}}var ls,cs,ds=os(function(t){const e=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?as:ns(e.a,e.b,e.c,e.d,e.e,e.f)},"px, ","px)","deg)"),us=os(function(t){return null==t?as:(ss||(ss=document.createElementNS("http://www.w3.org/2000/svg","g")),ss.setAttribute("transform",t),(t=ss.transform.baseVal.consolidate())?ns((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):as)},", ",")",")"),hs=0,gs=0,ps=0,ms=0,bs=0,ys=0,Qs="object"==typeof performance&&performance.now?performance:Date,Bs="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Us(){return bs||(Bs(Fs),bs=Qs.now()+ys)}function Fs(){bs=0}function Is(){this._call=this._time=this._next=null}function fs(t,e,i){var s=new Is;return s.restart(t,e,i),s}function Cs(){bs=(ms=Qs.now())+ys,hs=gs=0;try{!function(){Us(),++hs;for(var t,e=ls;e;)(t=bs-e._time)>=0&&e._call.call(void 0,t),e=e._next;--hs}()}finally{hs=0,function(){var t,e,i=ls,s=1/0;for(;i;)i._call?(s>i._time&&(s=i._time),t=i,i=i._next):(e=i._next,i._next=null,i=t?t._next=e:ls=e);cs=t,As(s)}(),bs=0}}function vs(){var t=Qs.now(),e=t-ms;e>1e3&&(ys-=e,ms=t)}function As(t){hs||(gs&&(gs=clearTimeout(gs)),t-bs>24?(t<1/0&&(gs=setTimeout(Cs,t-Qs.now()-ys)),ps&&(ps=clearInterval(ps))):(ps||(ms=Qs.now(),ps=setInterval(vs,1e3)),hs=1,Bs(Cs)))}function xs(t,e,i){var s=new Is;return e=null==e?0:+e,s.restart(i=>{s.stop(),t(i+e)},e,i),s}Is.prototype=fs.prototype={constructor:Is,restart:function(t,e,i){if("function"!=typeof t)throw new TypeError("callback is not a function");i=(null==i?Us():+i)+(null==e?0:+e),this._next||cs===this||(cs?cs._next=this:ls=this,cs=this),this._call=t,this._time=i,As()},stop:function(){this._call&&(this._call=null,this._time=1/0,As())}};var Es=Nt("start","end","cancel","interrupt"),Rs=[];function Ss(t,e,i,s,r,a){var n=t.__transition;if(n){if(i in n)return}else t.__transition={};!function(t,e,i){var s,r=t.__transition;function a(t){i.state=1,i.timer.restart(n,i.delay,i.time),i.delay<=t&&n(t-i.delay)}function n(a){var c,d,u,h;if(1!==i.state)return l();for(c in r)if((h=r[c]).name===i.name){if(3===h.state)return xs(n);4===h.state?(h.state=6,h.timer.stop(),h.on.call("interrupt",t,t.__data__,h.index,h.group),delete r[c]):+c<e&&(h.state=6,h.timer.stop(),h.on.call("cancel",t,t.__data__,h.index,h.group),delete r[c])}if(xs(function(){3===i.state&&(i.state=4,i.timer.restart(o,i.delay,i.time),o(a))}),i.state=2,i.on.call("start",t,t.__data__,i.index,i.group),2===i.state){for(i.state=3,s=new Array(u=i.tween.length),c=0,d=-1;c<u;++c)(h=i.tween[c].value.call(t,t.__data__,i.index,i.group))&&(s[++d]=h);s.length=d+1}}function o(e){for(var r=e<i.duration?i.ease.call(null,e/i.duration):(i.timer.restart(l),i.state=5,1),a=-1,n=s.length;++a<n;)s[a].call(t,r);5===i.state&&(i.on.call("end",t,t.__data__,i.index,i.group),l())}function l(){for(var s in i.state=6,i.timer.stop(),delete r[e],r)return;delete t.__transition}r[e]=i,i.timer=fs(a,0,i.time)}(t,i,{name:e,index:s,group:r,on:Es,tween:Rs,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function Ns(t,e){var i=ws(t,e);if(i.state>0)throw new Error("too late; already scheduled");return i}function Ls(t,e){var i=ws(t,e);if(i.state>3)throw new Error("too late; already running");return i}function ws(t,e){var i=t.__transition;if(!i||!(i=i[e]))throw new Error("transition not found");return i}function Ds(t,e){var i,s;return function(){var r=Ls(this,t),a=r.tween;if(a!==i)for(var n=0,o=(s=i=a).length;n<o;++n)if(s[n].name===e){(s=s.slice()).splice(n,1);break}r.tween=s}}function Ms(t,e,i){var s,r;if("function"!=typeof i)throw new Error;return function(){var a=Ls(this,t),n=a.tween;if(n!==s){r=(s=n).slice();for(var o={name:e,value:i},l=0,c=r.length;l<c;++l)if(r[l].name===e){r[l]=o;break}l===c&&r.push(o)}a.tween=r}}function ks(t,e,i){var s=t._id;return t.each(function(){var t=Ls(this,s);(t.value||(t.value={}))[e]=i.apply(this,arguments)}),function(t){return ws(t,s).value[e]}}function Ts(t,e){var i;return("number"==typeof e?Pi:e instanceof xi?Wi:(i=xi(e))?(e=i,Wi):ts)(t,e)}function Vs(t){return function(){this.removeAttribute(t)}}function $s(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Hs(t,e,i){var s,r,a=i+"";return function(){var n=this.getAttribute(t);return n===a?null:n===s?r:r=e(s=n,i)}}function zs(t,e,i){var s,r,a=i+"";return function(){var n=this.getAttributeNS(t.space,t.local);return n===a?null:n===s?r:r=e(s=n,i)}}function Gs(t,e,i){var s,r,a;return function(){var n,o,l=i(this);if(null!=l)return(n=this.getAttribute(t))===(o=l+"")?null:n===s&&o===r?a:(r=o,a=e(s=n,l));this.removeAttribute(t)}}function Ys(t,e,i){var s,r,a;return function(){var n,o,l=i(this);if(null!=l)return(n=this.getAttributeNS(t.space,t.local))===(o=l+"")?null:n===s&&o===r?a:(r=o,a=e(s=n,l));this.removeAttributeNS(t.space,t.local)}}function Xs(t,e){var i,s;function r(){var r=e.apply(this,arguments);return r!==s&&(i=(s=r)&&function(t,e){return function(i){this.setAttributeNS(t.space,t.local,e.call(this,i))}}(t,r)),i}return r._value=e,r}function Js(t,e){var i,s;function r(){var r=e.apply(this,arguments);return r!==s&&(i=(s=r)&&function(t,e){return function(i){this.setAttribute(t,e.call(this,i))}}(t,r)),i}return r._value=e,r}function Ws(t,e){return function(){Ns(this,t).delay=+e.apply(this,arguments)}}function _s(t,e){return e=+e,function(){Ns(this,t).delay=e}}function Ks(t,e){return function(){Ls(this,t).duration=+e.apply(this,arguments)}}function Zs(t,e){return e=+e,function(){Ls(this,t).duration=e}}var Ps=We.prototype.constructor;function Os(t){return function(){this.style.removeProperty(t)}}var js=0;function qs(t,e,i,s){this._groups=t,this._parents=e,this._name=i,this._id=s}function tr(){return++js}var er=We.prototype;qs.prototype={constructor:qs,select:function(t){var e=this._name,i=this._id;"function"!=typeof t&&(t=Gt(t));for(var s=this._groups,r=s.length,a=new Array(r),n=0;n<r;++n)for(var o,l,c=s[n],d=c.length,u=a[n]=new Array(d),h=0;h<d;++h)(o=c[h])&&(l=t.call(o,o.__data__,h,c))&&("__data__"in o&&(l.__data__=o.__data__),u[h]=l,Ss(u[h],e,i,h,u,ws(o,i)));return new qs(a,this._parents,e,i)},selectAll:function(t){var e=this._name,i=this._id;"function"!=typeof t&&(t=Xt(t));for(var s=this._groups,r=s.length,a=[],n=[],o=0;o<r;++o)for(var l,c=s[o],d=c.length,u=0;u<d;++u)if(l=c[u]){for(var h,g=t.call(l,l.__data__,u,c),p=ws(l,i),m=0,b=g.length;m<b;++m)(h=g[m])&&Ss(h,e,i,m,g,p);a.push(g),n.push(l)}return new qs(a,n,e,i)},selectChild:er.selectChild,selectChildren:er.selectChildren,filter:function(t){"function"!=typeof t&&(t=Wt(t));for(var e=this._groups,i=e.length,s=new Array(i),r=0;r<i;++r)for(var a,n=e[r],o=n.length,l=s[r]=[],c=0;c<o;++c)(a=n[c])&&t.call(a,a.__data__,c,n)&&l.push(a);return new qs(s,this._parents,this._name,this._id)},merge:function(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,i=t._groups,s=e.length,r=i.length,a=Math.min(s,r),n=new Array(s),o=0;o<a;++o)for(var l,c=e[o],d=i[o],u=c.length,h=n[o]=new Array(u),g=0;g<u;++g)(l=c[g]||d[g])&&(h[g]=l);for(;o<s;++o)n[o]=e[o];return new qs(n,this._parents,this._name,this._id)},selection:function(){return new Ps(this._groups,this._parents)},transition:function(){for(var t=this._name,e=this._id,i=tr(),s=this._groups,r=s.length,a=0;a<r;++a)for(var n,o=s[a],l=o.length,c=0;c<l;++c)if(n=o[c]){var d=ws(n,e);Ss(n,t,i,c,o,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new qs(s,this._parents,t,i)},call:er.call,nodes:er.nodes,node:er.node,size:er.size,empty:er.empty,each:er.each,on:function(t,e){var i=this._id;return arguments.length<2?ws(this.node(),i).on.on(t):this.each(function(t,e,i){var s,r,a=function(t){return(t+"").trim().split(/^|\s+/).every(function(t){var e=t.indexOf(".");return e>=0&&(t=t.slice(0,e)),!t||"start"===t})}(e)?Ns:Ls;return function(){var n=a(this,t),o=n.on;o!==s&&(r=(s=o).copy()).on(e,i),n.on=r}}(i,t,e))},attr:function(t,e){var i=Tt(t),s="transform"===i?us:Ts;return this.attrTween(t,"function"==typeof e?(i.local?Ys:Gs)(i,s,ks(this,"attr."+t,e)):null==e?(i.local?$s:Vs)(i):(i.local?zs:Hs)(i,s,e))},attrTween:function(t,e){var i="attr."+t;if(arguments.length<2)return(i=this.tween(i))&&i._value;if(null==e)return this.tween(i,null);if("function"!=typeof e)throw new Error;var s=Tt(t);return this.tween(i,(s.local?Xs:Js)(s,e))},style:function(t,e,i){var s="transform"==(t+="")?ds:Ts;return null==e?this.styleTween(t,function(t,e){var i,s,r;return function(){var a=me(this,t),n=(this.style.removeProperty(t),me(this,t));return a===n?null:a===i&&n===s?r:r=e(i=a,s=n)}}(t,s)).on("end.style."+t,Os(t)):"function"==typeof e?this.styleTween(t,function(t,e,i){var s,r,a;return function(){var n=me(this,t),o=i(this),l=o+"";return null==o&&(this.style.removeProperty(t),l=o=me(this,t)),n===l?null:n===s&&l===r?a:(r=l,a=e(s=n,o))}}(t,s,ks(this,"style."+t,e))).each(function(t,e){var i,s,r,a,n="style."+e,o="end."+n;return function(){var l=Ls(this,t),c=l.on,d=null==l.value[n]?a||(a=Os(e)):void 0;c===i&&r===d||(s=(i=c).copy()).on(o,r=d),l.on=s}}(this._id,t)):this.styleTween(t,function(t,e,i){var s,r,a=i+"";return function(){var n=me(this,t);return n===a?null:n===s?r:r=e(s=n,i)}}(t,s,e),i).on("end.style."+t,null)},styleTween:function(t,e,i){var s="style."+(t+="");if(arguments.length<2)return(s=this.tween(s))&&s._value;if(null==e)return this.tween(s,null);if("function"!=typeof e)throw new Error;return this.tween(s,function(t,e,i){var s,r;function a(){var a=e.apply(this,arguments);return a!==r&&(s=(r=a)&&function(t,e,i){return function(s){this.style.setProperty(t,e.call(this,s),i)}}(t,a,i)),s}return a._value=e,a}(t,e,null==i?"":i))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var e=t(this);this.textContent=null==e?"":e}}(ks(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))},textTween:function(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(null==t)return this.tween(e,null);if("function"!=typeof t)throw new Error;return this.tween(e,function(t){var e,i;function s(){var s=t.apply(this,arguments);return s!==i&&(e=(i=s)&&function(t){return function(e){this.textContent=t.call(this,e)}}(s)),e}return s._value=t,s}(t))},remove:function(){return this.on("end.remove",function(t){return function(){var e=this.parentNode;for(var i in this.__transition)if(+i!==t)return;e&&e.removeChild(this)}}(this._id))},tween:function(t,e){var i=this._id;if(t+="",arguments.length<2){for(var s,r=ws(this.node(),i).tween,a=0,n=r.length;a<n;++a)if((s=r[a]).name===t)return s.value;return null}return this.each((null==e?Ds:Ms)(i,t,e))},delay:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?Ws:_s)(e,t)):ws(this.node(),e).delay},duration:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?Ks:Zs)(e,t)):ws(this.node(),e).duration},ease:function(t){var e=this._id;return arguments.length?this.each(function(t,e){if("function"!=typeof e)throw new Error;return function(){Ls(this,t).ease=e}}(e,t)):ws(this.node(),e).ease},easeVarying:function(t){if("function"!=typeof t)throw new Error;return this.each(function(t,e){return function(){var i=e.apply(this,arguments);if("function"!=typeof i)throw new Error;Ls(this,t).ease=i}}(this._id,t))},end:function(){var t,e,i=this,s=i._id,r=i.size();return new Promise(function(a,n){var o={value:n},l={value:function(){0===--r&&a()}};i.each(function(){var i=Ls(this,s),r=i.on;r!==t&&((e=(t=r).copy())._.cancel.push(o),e._.interrupt.push(o),e._.end.push(l)),i.on=e}),0===r&&a()})},[Symbol.iterator]:er[Symbol.iterator]};const ir=t=>+t;function sr(t){return--t*t*t+1}var rr={time:null,delay:0,duration:250,ease:function(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}};function ar(t,e){for(var i;!(i=t.__transition)||!(i=i[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return i}We.prototype.interrupt=function(t){return this.each(function(){!function(t,e){var i,s,r,a=t.__transition,n=!0;if(a){for(r in e=null==e?null:e+"",a)(i=a[r]).name===e?(s=i.state>2&&i.state<5,i.state=6,i.timer.stop(),i.on.call(s?"interrupt":"cancel",t,t.__data__,i.index,i.group),delete a[r]):n=!1;n&&delete t.__transition}}(this,t)})},We.prototype.transition=function(t){var e,i;t instanceof qs?(e=t._id,t=t._name):(e=tr(),(i=rr).time=Us(),t=null==t?null:t+"");for(var s=this._groups,r=s.length,a=0;a<r;++a)for(var n,o=s[a],l=o.length,c=0;c<l;++c)(n=o[c])&&Ss(n,t,e,c,o,i||ar(n,e));return new qs(s,this._parents,t,e)};const nr=Math.PI,or=2*nr,lr=1e-6,cr=or-lr;function dr(t){this._+=t[0];for(let e=1,i=t.length;e<i;++e)this._+=arguments[e]+t[e]}class ur{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=null==t?dr:function(t){let e=Math.floor(t);if(!(e>=0))throw new Error(`invalid digits: ${t}`);if(e>15)return dr;const i=10**e;return function(t){this._+=t[0];for(let e=1,s=t.length;e<s;++e)this._+=Math.round(arguments[e]*i)/i+t[e]}}(t)}moveTo(t,e){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,e){this._append`L${this._x1=+t},${this._y1=+e}`}quadraticCurveTo(t,e,i,s){this._append`Q${+t},${+e},${this._x1=+i},${this._y1=+s}`}bezierCurveTo(t,e,i,s,r,a){this._append`C${+t},${+e},${+i},${+s},${this._x1=+r},${this._y1=+a}`}arcTo(t,e,i,s,r){if(t=+t,e=+e,i=+i,s=+s,(r=+r)<0)throw new Error(`negative radius: ${r}`);let a=this._x1,n=this._y1,o=i-t,l=s-e,c=a-t,d=n-e,u=c*c+d*d;if(null===this._x1)this._append`M${this._x1=t},${this._y1=e}`;else if(u>lr)if(Math.abs(d*o-l*c)>lr&&r){let h=i-a,g=s-n,p=o*o+l*l,m=h*h+g*g,b=Math.sqrt(p),y=Math.sqrt(u),Q=r*Math.tan((nr-Math.acos((p+u-m)/(2*b*y)))/2),B=Q/y,U=Q/b;Math.abs(B-1)>lr&&this._append`L${t+B*c},${e+B*d}`,this._append`A${r},${r},0,0,${+(d*h>c*g)},${this._x1=t+U*o},${this._y1=e+U*l}`}else this._append`L${this._x1=t},${this._y1=e}`;else;}arc(t,e,i,s,r,a){if(t=+t,e=+e,a=!!a,(i=+i)<0)throw new Error(`negative radius: ${i}`);let n=i*Math.cos(s),o=i*Math.sin(s),l=t+n,c=e+o,d=1^a,u=a?s-r:r-s;null===this._x1?this._append`M${l},${c}`:(Math.abs(this._x1-l)>lr||Math.abs(this._y1-c)>lr)&&this._append`L${l},${c}`,i&&(u<0&&(u=u%or+or),u>cr?this._append`A${i},${i},0,1,${d},${t-n},${e-o}A${i},${i},0,1,${d},${this._x1=l},${this._y1=c}`:u>lr&&this._append`A${i},${i},0,${+(u>=nr)},${d},${this._x1=t+i*Math.cos(r)},${this._y1=e+i*Math.sin(r)}`)}rect(t,e,i,s){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}h${i=+i}v${+s}h${-i}Z`}toString(){return this._}}function hr(t,e){if((i=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var i,s=t.slice(0,i);return[s.length>1?s[0]+s.slice(2):s,+t.slice(i+1)]}function gr(t){return(t=hr(Math.abs(t)))?t[1]:NaN}var pr,mr=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function br(t){if(!(e=mr.exec(t)))throw new Error("invalid format: "+t);var e;return new yr({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function yr(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function Qr(t,e){var i=hr(t,e);if(!i)return t+"";var s=i[0],r=i[1];return r<0?"0."+new Array(-r).join("0")+s:s.length>r+1?s.slice(0,r+1)+"."+s.slice(r+1):s+new Array(r-s.length+2).join("0")}br.prototype=yr.prototype,yr.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var Br={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>Qr(100*t,e),r:Qr,s:function(t,e){var i=hr(t,e);if(!i)return t+"";var s=i[0],r=i[1],a=r-(pr=3*Math.max(-8,Math.min(8,Math.floor(r/3))))+1,n=s.length;return a===n?s:a>n?s+new Array(a-n+1).join("0"):a>0?s.slice(0,a)+"."+s.slice(a):"0."+new Array(1-a).join("0")+hr(t,Math.max(0,e+a-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function Ur(t){return t}var Fr,Ir,fr,Cr=Array.prototype.map,vr=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Ar(t){var e,i,s=void 0===t.grouping||void 0===t.thousands?Ur:(e=Cr.call(t.grouping,Number),i=t.thousands+"",function(t,s){for(var r=t.length,a=[],n=0,o=e[0],l=0;r>0&&o>0&&(l+o+1>s&&(o=Math.max(1,s-l)),a.push(t.substring(r-=o,r+o)),!((l+=o+1)>s));)o=e[n=(n+1)%e.length];return a.reverse().join(i)}),r=void 0===t.currency?"":t.currency[0]+"",a=void 0===t.currency?"":t.currency[1]+"",n=void 0===t.decimal?".":t.decimal+"",o=void 0===t.numerals?Ur:function(t){return function(e){return e.replace(/[0-9]/g,function(e){return t[+e]})}}(Cr.call(t.numerals,String)),l=void 0===t.percent?"%":t.percent+"",c=void 0===t.minus?"−":t.minus+"",d=void 0===t.nan?"NaN":t.nan+"";function u(t){var e=(t=br(t)).fill,i=t.align,u=t.sign,h=t.symbol,g=t.zero,p=t.width,m=t.comma,b=t.precision,y=t.trim,Q=t.type;"n"===Q?(m=!0,Q="g"):Br[Q]||(void 0===b&&(b=12),y=!0,Q="g"),(g||"0"===e&&"="===i)&&(g=!0,e="0",i="=");var B="$"===h?r:"#"===h&&/[boxX]/.test(Q)?"0"+Q.toLowerCase():"",U="$"===h?a:/[%p]/.test(Q)?l:"",F=Br[Q],I=/[defgprs%]/.test(Q);function f(t){var r,a,l,h=B,f=U;if("c"===Q)f=F(t)+f,t="";else{var C=(t=+t)<0||1/t<0;if(t=isNaN(t)?d:F(Math.abs(t),b),y&&(t=function(t){t:for(var e,i=t.length,s=1,r=-1;s<i;++s)switch(t[s]){case".":r=e=s;break;case"0":0===r&&(r=s),e=s;break;default:if(!+t[s])break t;r>0&&(r=0)}return r>0?t.slice(0,r)+t.slice(e+1):t}(t)),C&&0===+t&&"+"!==u&&(C=!1),h=(C?"("===u?u:c:"-"===u||"("===u?"":u)+h,f=("s"===Q?vr[8+pr/3]:"")+f+(C&&"("===u?")":""),I)for(r=-1,a=t.length;++r<a;)if(48>(l=t.charCodeAt(r))||l>57){f=(46===l?n+t.slice(r+1):t.slice(r))+f,t=t.slice(0,r);break}}m&&!g&&(t=s(t,1/0));var v=h.length+t.length+f.length,A=v<p?new Array(p-v+1).join(e):"";switch(m&&g&&(t=s(A+t,A.length?p-f.length:1/0),A=""),i){case"<":t=h+t+f+A;break;case"=":t=h+A+t+f;break;case"^":t=A.slice(0,v=A.length>>1)+h+t+f+A.slice(v);break;default:t=A+h+t+f}return o(t)}return b=void 0===b?6:/[gprs]/.test(Q)?Math.max(1,Math.min(21,b)):Math.max(0,Math.min(20,b)),f.toString=function(){return t+""},f}return{format:u,formatPrefix:function(t,e){var i=u(((t=br(t)).type="f",t)),s=3*Math.max(-8,Math.min(8,Math.floor(gr(e)/3))),r=Math.pow(10,-s),a=vr[8+s/3];return function(t){return i(r*t)+a}}}}Fr=Ar({thousands:",",grouping:[3],currency:["$",""]}),Ir=Fr.format,fr=Fr.formatPrefix;var xr=Math.random,Er=function t(e){function i(t,i){return t=null==t?0:+t,i=null==i?1:+i,1===arguments.length?(i=t,t=0):i-=t,function(){return e()*i+t}}return i.source=t,i}(xr),Rr=function t(e){function i(t,i){var s,r;return t=null==t?0:+t,i=null==i?1:+i,function(){var a;if(null!=s)a=s,s=null;else do{s=2*e()-1,a=2*e()-1,r=s*s+a*a}while(!r||r>1);return t+i*a*Math.sqrt(-2*Math.log(r)/r)}}return i.source=t,i}(xr);const Sr=1/4294967296;function Nr(t=Math.random()){let e=0|(0<=t&&t<1?t/Sr:Math.abs(t));return()=>(e=1664525*e+1013904223|0,Sr*(e>>>0))}function Lr(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}function wr(t){return+t}var Dr=[0,1];function Mr(t){return t}function kr(t,e){return(e-=t=+t)?function(i){return(i-t)/e}:function(t){return function(){return t}}(isNaN(e)?NaN:.5)}function Tr(t,e,i){var s=t[0],r=t[1],a=e[0],n=e[1];return r<s?(s=kr(r,s),a=i(n,a)):(s=kr(s,r),a=i(a,n)),function(t){return a(s(t))}}function Vr(t,e,i){var s=Math.min(t.length,e.length)-1,r=new Array(s),a=new Array(s),n=-1;for(t[s]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++n<s;)r[n]=kr(t[n],t[n+1]),a[n]=i(e[n],e[n+1]);return function(e){var i=mt(t,e,1,s)-1;return a[i](r[i](e))}}function $r(){var t,e,i,s,r,a,n=Dr,o=Dr,l=es,c=Mr;function d(){var t=Math.min(n.length,o.length);return c!==Mr&&(c=function(t,e){var i;return t>e&&(i=t,t=e,e=i),function(i){return Math.max(t,Math.min(e,i))}}(n[0],n[t-1])),s=t>2?Vr:Tr,r=a=null,u}function u(e){return null==e||isNaN(e=+e)?i:(r||(r=s(n.map(t),o,l)))(t(c(e)))}return u.invert=function(i){return c(e((a||(a=s(o,n.map(t),Pi)))(i)))},u.domain=function(t){return arguments.length?(n=Array.from(t,wr),d()):n.slice()},u.range=function(t){return arguments.length?(o=Array.from(t),d()):o.slice()},u.rangeRound=function(t){return o=Array.from(t),l=is,d()},u.clamp=function(t){return arguments.length?(c=!!t||Mr,d()):c!==Mr},u.interpolate=function(t){return arguments.length?(l=t,d()):l},u.unknown=function(t){return arguments.length?(i=t,u):i},function(i,s){return t=i,e=s,d()}}function Hr(t,e,i,s){var r,a=function(t,e,i){i=+i;const s=(e=+e)<(t=+t),r=s?Ut(e,t,i):Ut(t,e,i);return(s?-1:1)*(r<0?1/-r:r)}(t,e,i);switch((s=br(null==s?",f":s)).type){case"s":var n=Math.max(Math.abs(t),Math.abs(e));return null!=s.precision||isNaN(r=function(t,e){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(gr(e)/3)))-gr(Math.abs(t)))}(a,n))||(s.precision=r),fr(s,n);case"":case"e":case"g":case"p":case"r":null!=s.precision||isNaN(r=function(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,gr(e)-gr(t))+1}(a,Math.max(Math.abs(t),Math.abs(e))))||(s.precision=r-("e"===s.type));break;case"f":case"%":null!=s.precision||isNaN(r=function(t){return Math.max(0,-gr(Math.abs(t)))}(a))||(s.precision=r-2*("%"===s.type))}return Ir(s)}function zr(t){var e=t.domain;return t.ticks=function(t){var i=e();return function(t,e,i){if(!((i=+i)>0))return[];if((t=+t)===(e=+e))return[t];const s=e<t,[r,a,n]=s?Bt(e,t,i):Bt(t,e,i);if(!(a>=r))return[];const o=a-r+1,l=new Array(o);if(s)if(n<0)for(let t=0;t<o;++t)l[t]=(a-t)/-n;else for(let t=0;t<o;++t)l[t]=(a-t)*n;else if(n<0)for(let t=0;t<o;++t)l[t]=(r+t)/-n;else for(let t=0;t<o;++t)l[t]=(r+t)*n;return l}(i[0],i[i.length-1],null==t?10:t)},t.tickFormat=function(t,i){var s=e();return Hr(s[0],s[s.length-1],null==t?10:t,i)},t.nice=function(i){null==i&&(i=10);var s,r,a=e(),n=0,o=a.length-1,l=a[n],c=a[o],d=10;for(c<l&&(r=l,l=c,c=r,r=n,n=o,o=r);d-- >0;){if((r=Ut(l,c,i))===s)return a[n]=l,a[o]=c,e(a);if(r>0)l=Math.floor(l/r)*r,c=Math.ceil(c/r)*r;else{if(!(r<0))break;l=Math.ceil(l*r)/r,c=Math.floor(c*r)/r}s=r}return t},t}function Gr(){var t=$r()(Mr,Mr);return t.copy=function(){return e=t,Gr().domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown());var e},Lr.apply(t,arguments),zr(t)}function Yr(t){return function(){return t}}function Xr(t){this._context=t}function Jr(t){return new Xr(t)}function Wr(t){return t[0]}function _r(t){return t[1]}function Kr(t,e){var i=Yr(!0),s=null,r=Jr,a=null,n=function(t){let e=3;return t.digits=function(i){if(!arguments.length)return e;if(null==i)e=null;else{const t=Math.floor(i);if(!(t>=0))throw new RangeError(`invalid digits: ${i}`);e=t}return t},()=>new ur(e)}(o);function o(o){var l,c,d,u=(o=function(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}(o)).length,h=!1;for(null==s&&(a=r(d=n())),l=0;l<=u;++l)!(l<u&&i(c=o[l],l,o))===h&&((h=!h)?a.lineStart():a.lineEnd()),h&&a.point(+t(c,l,o),+e(c,l,o));if(d)return a=null,d+""||null}return t="function"==typeof t?t:void 0===t?Wr:Yr(t),e="function"==typeof e?e:void 0===e?_r:Yr(e),o.x=function(e){return arguments.length?(t="function"==typeof e?e:Yr(+e),o):t},o.y=function(t){return arguments.length?(e="function"==typeof t?t:Yr(+t),o):e},o.defined=function(t){return arguments.length?(i="function"==typeof t?t:Yr(!!t),o):i},o.curve=function(t){return arguments.length?(r=t,null!=s&&(a=r(s)),o):r},o.context=function(t){return arguments.length?(null==t?s=a=null:a=r(s=t),o):s},o}function Zr(t,e,i){this.k=t,this.x=e,this.y=i}Xr.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e)}}},Zr.prototype={constructor:Zr,scale:function(t){return 1===t?this:new Zr(this.k*t,this.x,this.y)},translate:function(t,e){return 0===t&0===e?this:new Zr(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}},Zr.prototype;class Pr extends ct{getComputedStyleValue(t){return getComputedStyle(this).getPropertyValue(t).trim()}firstUpdated(t){super.firstUpdated(t),_e(this.renderRoot.host).classed("keyboard",!0).on("mousemove.keyboard touchstart.keyboard",t=>{_e(t.currentTarget.renderRoot.host).classed("keyboard",!1).on("mousemove.keyboard touchstart.keyboard",null)}).on("keydown.keyboard",t=>{_e(t.currentTarget.renderRoot.host).classed("keyboard",!0).on("keydown.keyboard mousemove.keyboard touchstart.keyboard",null)})}static get greys(){const t="#999999",e={white:"#ffffff"};return e.light75=Wi(t,"#ffffff")(.75),e.light50=Wi(t,"#ffffff")(.5),e.light25=Wi(t,"#ffffff")(.25),e.grey=t,e.dark25=Wi(t,"#000000")(.25),e.dark50=Wi(t,"#000000")(.5),e.dark75=Wi(t,"#000000")(.75),e.black="#000000",e}static get shadows(){return{elevations:[0,2,4,8,16],baselineColor:"#000000",baselineColorString:"0, 0, 0",inverseBaselineColor:"#FFFFFF",inverseBaselineColorString:"255, 255, 255",opacityUmbra:.2,opacityPenumbra:.14,opacityAmbient:.12,opacityBoost:.2,mapUmbra:{0:{x:0,y:0,b:0,s:0},2:{x:0,y:3,b:1,s:-2},4:{x:0,y:2,b:4,s:-1},8:{x:0,y:5,b:5,s:-3},16:{x:0,y:8,b:10,s:-5}},mapPenumbra:{0:{x:0,y:0,b:0,s:0},2:{x:0,y:2,b:2,s:0},4:{x:0,y:4,b:5,s:0},8:{x:0,y:8,b:10,s:1},16:{x:0,y:16,b:24,s:2}},mapAmbient:{0:{x:0,y:0,b:0,s:0},2:{x:0,y:1,b:5,s:0},4:{x:0,y:1,b:10,s:0},8:{x:0,y:3,b:14,s:2},16:{x:0,y:6,b:30,s:5}}}}static cssBoxShadow(t,e=!1,i=!1){const s=this.shadows.opacityUmbra+this.shadows.opacityBoost,r=this.shadows.opacityPenumbra+this.shadows.opacityBoost,a=this.shadows.opacityAmbient+this.shadows.opacityBoost,n=i?`rgba(${this.shadows.inverseBaselineColorString}, ${s})`:`rgba(${this.shadows.baselineColorString}, ${s})`,o=i?`rgba(${this.shadows.inverseBaselineColorString}, ${r})`:`rgba(${this.shadows.baselineColorString}, ${r})`,l=i?`rgba(${this.shadows.inverseBaselineColorString}, ${a})`:`rgba(${this.shadows.baselineColorString}, ${a})`,c=this.shadows.mapUmbra[t],d=this.shadows.mapPenumbra[t],u=this.shadows.mapAmbient[t];return`${e?`${-c.y}px ${c.y/2}px ${c.b}px ${c.s}px`:`${c.y/2}px ${c.y}px ${c.b}px ${c.s}px`} ${n}, ${e?`${-d.y}px ${d.y/2}px ${d.b}px ${d.s}px`:`${d.y/2}px ${d.y}px ${d.b}px ${d.s}px`} ${o}, ${e?`${-u.y}px ${u.y/2}px ${u.b}px ${u.s}px`:`${u.y/2}px ${u.y}px ${u.b}px ${u.s}px`} ${l}`}static get svgDefs(){const t=Pr.shadows,e=t.elevations.map(e=>`\n <filter id=shadow-${e} filterUnits="userSpaceOnUse" x="-100%" y="-100%" width="200%" height="200%">\n <feComponentTransfer in="SourceAlpha" result="solid">\n <feFuncA type="table" tableValues="0 1 1"/>\n </feComponentTransfer>\n <feOffset in="solid" result="offU" dx=${t.mapUmbra[e].y/2} dy=${t.mapUmbra[e].y} />\n <feOffset in="solid" result="offP" dx=${t.mapPenumbra[e].y/2} dy=${t.mapPenumbra[e].y} />\n <feOffset in="solid" result="offA" dx=${t.mapAmbient[e].y/2} dy=${t.mapAmbient[e].y} />\n ${0===t.mapUmbra[e].s?"":`<feMorphology in="offU" result="spreadU" operator=${t.mapUmbra[e].s>0?"dilate":"erode"} radius=${Math.abs(t.mapUmbra[e].s)} />`}\n ${0===t.mapPenumbra[e].s?"":`<feMorphology in="offP" result="spreadP" operator=${t.mapPenumbra[e].s>0?"dilate":"erode"} radius=${Math.abs(t.mapPenumbra[e].s)} />`}\n ${0===t.mapAmbient[e].s?"":`<feMorphology in="offA" result="spreadA" operator=${t.mapAmbient[e].s>0?"dilate":"erode"} radius=${Math.abs(t.mapAmbient[e].s)} />`}\n <feGaussianBlur in=${0===t.mapUmbra[e].s?"offU":"spreadU"} result="blurU" stdDeviation=${t.mapUmbra[e].b/2} />\n <feGaussianBlur in=${0===t.mapPenumbra[e].s?"offP":"spreadP"} result="blurP" stdDeviation=${t.mapPenumbra[e].b/2} />\n <feGaussianBlur in=${0===t.mapAmbient[e].s?"offA":"spreadA"} result="blurA" stdDeviation=${t.mapAmbient[e].b/2} />\n <feFlood in="SourceGraphic" result="opU" flood-color=${t.baselineColor} flood-opacity=${t.opacityUmbra+t.opacityBoost} />\n <feFlood in="SourceGraphic" result="opP" flood-color=${t.baselineColor} flood-opacity=${t.opacityPenumbra+t.opacityBoost} />\n <feFlood in="SourceGraphic" result="opA" flood-color=${t.baselineColor} flood-opacity=${t.opacityAmbient+t.opacityBoost} />\n <feComposite in="opU" in2="blurU" result="shU" operator="in" />\n <feComposite in="opP" in2="blurP" result="shP" operator="in" />\n <feComposite in="opA" in2="blurA" result="shA" operator="in" />\n <feMorphology in="solid" result="smaller" operator="erode" radius="1" />\n <feComposite in="shU" in2="smaller" result="finalU" operator="out" />\n <feComposite in="shP" in2="smaller" result="finalP" operator="out" />\n <feComposite in="shA" in2="smaller" result="finalA" operator="out" />\n <feMerge>\n <feMergeNode in="finalU" />\n <feMergeNode in="finalP" />\n <feMergeNode in="finalA" />\n <feMergeNode in="SourceGraphic" />\n </feMerge>\n </filter>`);return`\n <defs>\n ${e}\n </defs>\n `}static get svgFilters(){const t=Pr.shadows,e=t.elevations.map(e=>J`
22
+ */class ct extends f{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,i)=>{const s=i?.renderBefore??e;let r=s._$litPart$;if(void 0===r){const t=i?.renderBefore??null;s._$litPart$=r=new et(e.insertBefore(L(),t),t,void 0,i??{})}return r._$AI(t),r})(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return W}}ct._$litElement$=!0,ct.finalized=!0,lt.litElementHydrateSupport?.({LitElement:ct});const dt=lt.litElementPolyfillSupport;function ut(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 gt(t){let e,i,s;function r(t,s,r=0,a=t.length){if(r<a){if(0!==e(s,s))return a;do{const e=r+a>>>1;i(t[e],s)<0?r=e+1:a=e}while(r<a)}return r}return 2!==t.length?(e=ut,i=(e,i)=>ut(t(e),i),s=(e,i)=>t(e)-i):(e=t===ut||t===ht?t:pt,i=t,s=t),{left:r,center:function(t,e,i=0,a=t.length){const n=r(t,e,i,a-1);return n>i&&s(t[n-1],e)>-s(t[n],e)?n-1:n},right:function(t,s,r=0,a=t.length){if(r<a){if(0!==e(s,s))return a;do{const e=r+a>>>1;i(t[e],s)<=0?r=e+1:a=e}while(r<a)}return r}}}function pt(){return 0}dt?.({LitElement:ct}),(lt.litElementVersions??=[]).push("4.2.1");const mt=gt(ut).right;gt(function(t){return null===t?NaN:+t}).center;const bt=Math.sqrt(50),yt=Math.sqrt(10),Qt=Math.sqrt(2);function Bt(t,e,i){const s=(e-t)/Math.max(0,i),r=Math.floor(Math.log10(s)),a=s/Math.pow(10,r),n=a>=bt?10:a>=yt?5:a>=Qt?2:1;let o,l,c;return r<0?(c=Math.pow(10,-r)/n,o=Math.round(t*c),l=Math.round(e*c),o/c<t&&++o,l/c>e&&--l,c=-c):(c=Math.pow(10,r)*n,o=Math.round(t/c),l=Math.round(e/c),o*c<t&&++o,l*c>e&&--l),l<o&&.5<=i&&i<2?Bt(t,e,2*i):[o,l,c]}function Ut(t,e,i){return Bt(t=+t,e=+e,i=+i)[2]}function Ft(t){return t}var It=1e-6;function ft(t){return"translate("+t+",0)"}function Ct(t){return"translate(0,"+t+")"}function vt(t){return e=>+t(e)}function At(t,e){return e=Math.max(0,t.bandwidth()-2*e)/2,t.round()&&(e=Math.round(e)),i=>+t(i)+e}function xt(){return!this.__axis}function Et(t,e){var i=[],s=null,r=null,a=6,n=6,o=3,l="undefined"!=typeof window&&window.devicePixelRatio>1?0:.5,c=1===t||4===t?-1:1,d=4===t||2===t?"x":"y",u=1===t||3===t?ft:Ct;function h(h){var g=null==s?e.ticks?e.ticks.apply(e,i):e.domain():s,p=null==r?e.tickFormat?e.tickFormat.apply(e,i):Ft:r,m=Math.max(a,0)+o,b=e.range(),y=+b[0]+l,Q=+b[b.length-1]+l,B=(e.bandwidth?At:vt)(e.copy(),l),U=h.selection?h.selection():h,F=U.selectAll(".domain").data([null]),I=U.selectAll(".tick").data(g,e).order(),f=I.exit(),C=I.enter().append("g").attr("class","tick"),v=I.select("line"),A=I.select("text");F=F.merge(F.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),I=I.merge(C),v=v.merge(C.append("line").attr("stroke","currentColor").attr(d+"2",c*a)),A=A.merge(C.append("text").attr("fill","currentColor").attr(d,c*m).attr("dy",1===t?"0em":3===t?"0.71em":"0.32em")),h!==U&&(F=F.transition(h),I=I.transition(h),v=v.transition(h),A=A.transition(h),f=f.transition(h).attr("opacity",It).attr("transform",function(t){return isFinite(t=B(t))?u(t+l):this.getAttribute("transform")}),C.attr("opacity",It).attr("transform",function(t){var e=this.parentNode.__axis;return u((e&&isFinite(e=e(t))?e:B(t))+l)})),f.remove(),F.attr("d",4===t||2===t?n?"M"+c*n+","+y+"H"+l+"V"+Q+"H"+c*n:"M"+l+","+y+"V"+Q:n?"M"+y+","+c*n+"V"+l+"H"+Q+"V"+c*n:"M"+y+","+l+"H"+Q),I.attr("opacity",1).attr("transform",function(t){return u(B(t)+l)}),v.attr(d+"2",c*a),A.attr(d,c*m).text(p),U.filter(xt).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",2===t?"start":4===t?"end":"middle"),U.each(function(){this.__axis=B})}return h.scale=function(t){return arguments.length?(e=t,h):e},h.ticks=function(){return i=Array.from(arguments),h},h.tickArguments=function(t){return arguments.length?(i=null==t?[]:Array.from(t),h):i.slice()},h.tickValues=function(t){return arguments.length?(s=null==t?null:Array.from(t),h):s&&s.slice()},h.tickFormat=function(t){return arguments.length?(r=t,h):r},h.tickSize=function(t){return arguments.length?(a=n=+t,h):a},h.tickSizeInner=function(t){return arguments.length?(a=+t,h):a},h.tickSizeOuter=function(t){return arguments.length?(n=+t,h):n},h.tickPadding=function(t){return arguments.length?(o=+t,h):o},h.offset=function(t){return arguments.length?(l=+t,h):l},h}function Rt(t){return Et(4,t)}var St={value:()=>{}};function Nt(){for(var t,e=0,i=arguments.length,s={};e<i;++e){if(!(t=arguments[e]+"")||t in s||/[\s.]/.test(t))throw new Error("illegal type: "+t);s[t]=[]}return new Lt(s)}function Lt(t){this._=t}function wt(t,e){for(var i,s=0,r=t.length;s<r;++s)if((i=t[s]).name===e)return i.value}function Dt(t,e,i){for(var s=0,r=t.length;s<r;++s)if(t[s].name===e){t[s]=St,t=t.slice(0,s).concat(t.slice(s+1));break}return null!=i&&t.push({name:e,value:i}),t}Lt.prototype=Nt.prototype={constructor:Lt,on:function(t,e){var i,s,r=this._,a=(s=r,(t+"").trim().split(/^|\s+/).map(function(t){var e="",i=t.indexOf(".");if(i>=0&&(e=t.slice(i+1),t=t.slice(0,i)),t&&!s.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}})),n=-1,o=a.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++n<o;)if(i=(t=a[n]).type)r[i]=Dt(r[i],t.name,e);else if(null==e)for(i in r)r[i]=Dt(r[i],t.name,null);return this}for(;++n<o;)if((i=(t=a[n]).type)&&(i=wt(r[i],t.name)))return i},copy:function(){var t={},e=this._;for(var i in e)t[i]=e[i].slice();return new Lt(t)},call:function(t,e){if((i=arguments.length-2)>0)for(var i,s,r=new Array(i),a=0;a<i;++a)r[a]=arguments[a+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(a=0,i=(s=this._[t]).length;a<i;++a)s[a].value.apply(e,r)},apply:function(t,e,i){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var s=this._[t],r=0,a=s.length;r<a;++r)s[r].value.apply(e,i)}};var Mt="http://www.w3.org/1999/xhtml",kt={svg:"http://www.w3.org/2000/svg",xhtml:Mt,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Tt(t){var e=t+="",i=e.indexOf(":");return i>=0&&"xmlns"!==(e=t.slice(0,i))&&(t=t.slice(i+1)),kt.hasOwnProperty(e)?{space:kt[e],local:t}:t}function Vt(t){return function(){var e=this.ownerDocument,i=this.namespaceURI;return i===Mt&&e.documentElement.namespaceURI===Mt?e.createElement(t):e.createElementNS(i,t)}}function $t(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function Ht(t){var e=Tt(t);return(e.local?$t:Vt)(e)}function zt(){}function Gt(t){return null==t?zt:function(){return this.querySelector(t)}}function Yt(){return[]}function Xt(t){return null==t?Yt:function(){return this.querySelectorAll(t)}}function Jt(t){return function(){return function(t){return null==t?[]:Array.isArray(t)?t:Array.from(t)}(t.apply(this,arguments))}}function Wt(t){return function(){return this.matches(t)}}function _t(t){return function(e){return e.matches(t)}}var Kt=Array.prototype.find;function Pt(){return this.firstElementChild}var Zt=Array.prototype.filter;function Ot(){return Array.from(this.children)}function jt(t){return new Array(t.length)}function qt(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function te(t,e,i,s,r,a){for(var n,o=0,l=e.length,c=a.length;o<c;++o)(n=e[o])?(n.__data__=a[o],s[o]=n):i[o]=new qt(t,a[o]);for(;o<l;++o)(n=e[o])&&(r[o]=n)}function ee(t,e,i,s,r,a,n){var o,l,c,d=new Map,u=e.length,h=a.length,g=new Array(u);for(o=0;o<u;++o)(l=e[o])&&(g[o]=c=n.call(l,l.__data__,o,e)+"",d.has(c)?r[o]=l:d.set(c,l));for(o=0;o<h;++o)c=n.call(t,a[o],o,a)+"",(l=d.get(c))?(s[o]=l,l.__data__=a[o],d.delete(c)):i[o]=new qt(t,a[o]);for(o=0;o<u;++o)(l=e[o])&&d.get(g[o])===l&&(r[o]=l)}function ie(t){return t.__data__}function se(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function re(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function ae(t){return function(){this.removeAttribute(t)}}function ne(t){return function(){this.removeAttributeNS(t.space,t.local)}}function oe(t,e){return function(){this.setAttribute(t,e)}}function le(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function ce(t,e){return function(){var i=e.apply(this,arguments);null==i?this.removeAttribute(t):this.setAttribute(t,i)}}function de(t,e){return function(){var i=e.apply(this,arguments);null==i?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,i)}}function ue(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function he(t){return function(){this.style.removeProperty(t)}}function ge(t,e,i){return function(){this.style.setProperty(t,e,i)}}function pe(t,e,i){return function(){var s=e.apply(this,arguments);null==s?this.style.removeProperty(t):this.style.setProperty(t,s,i)}}function me(t,e){return t.style.getPropertyValue(e)||ue(t).getComputedStyle(t,null).getPropertyValue(e)}function be(t){return function(){delete this[t]}}function ye(t,e){return function(){this[t]=e}}function Qe(t,e){return function(){var i=e.apply(this,arguments);null==i?delete this[t]:this[t]=i}}function Be(t){return t.trim().split(/^|\s+/)}function Ue(t){return t.classList||new Fe(t)}function Fe(t){this._node=t,this._names=Be(t.getAttribute("class")||"")}function Ie(t,e){for(var i=Ue(t),s=-1,r=e.length;++s<r;)i.add(e[s])}function fe(t,e){for(var i=Ue(t),s=-1,r=e.length;++s<r;)i.remove(e[s])}function Ce(t){return function(){Ie(this,t)}}function ve(t){return function(){fe(this,t)}}function Ae(t,e){return function(){(e.apply(this,arguments)?Ie:fe)(this,t)}}function xe(){this.textContent=""}function Ee(t){return function(){this.textContent=t}}function Re(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}function Se(){this.innerHTML=""}function Ne(t){return function(){this.innerHTML=t}}function Le(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}function we(){this.nextSibling&&this.parentNode.appendChild(this)}function De(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Me(){return null}function ke(){var t=this.parentNode;t&&t.removeChild(this)}function Te(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Ve(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function $e(t){return function(){var e=this.__on;if(e){for(var i,s=0,r=-1,a=e.length;s<a;++s)i=e[s],t.type&&i.type!==t.type||i.name!==t.name?e[++r]=i:this.removeEventListener(i.type,i.listener,i.options);++r?e.length=r:delete this.__on}}}function He(t,e,i){return function(){var s,r=this.__on,a=function(t){return function(e){t.call(this,e,this.__data__)}}(e);if(r)for(var n=0,o=r.length;n<o;++n)if((s=r[n]).type===t.type&&s.name===t.name)return this.removeEventListener(s.type,s.listener,s.options),this.addEventListener(s.type,s.listener=a,s.options=i),void(s.value=e);this.addEventListener(t.type,a,i),s={type:t.type,name:t.name,value:e,listener:a,options:i},r?r.push(s):this.__on=[s]}}function ze(t,e,i){var s=ue(t),r=s.CustomEvent;"function"==typeof r?r=new r(e,i):(r=s.document.createEvent("Event"),i?(r.initEvent(e,i.bubbles,i.cancelable),r.detail=i.detail):r.initEvent(e,!1,!1)),t.dispatchEvent(r)}function Ge(t,e){return function(){return ze(this,t,e)}}function Ye(t,e){return function(){return ze(this,t,e.apply(this,arguments))}}qt.prototype={constructor:qt,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)}},Fe.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 Xe=[null];function Je(t,e){this._groups=t,this._parents=e}function We(){return new Je([[document.documentElement]],Xe)}function _e(t){return"string"==typeof t?new Je([[document.querySelector(t)]],[document.documentElement]):new Je([[t]],Xe)}Je.prototype=We.prototype={constructor:Je,select:function(t){"function"!=typeof t&&(t=Gt(t));for(var e=this._groups,i=e.length,s=new Array(i),r=0;r<i;++r)for(var a,n,o=e[r],l=o.length,c=s[r]=new Array(l),d=0;d<l;++d)(a=o[d])&&(n=t.call(a,a.__data__,d,o))&&("__data__"in a&&(n.__data__=a.__data__),c[d]=n);return new Je(s,this._parents)},selectAll:function(t){t="function"==typeof t?Jt(t):Xt(t);for(var e=this._groups,i=e.length,s=[],r=[],a=0;a<i;++a)for(var n,o=e[a],l=o.length,c=0;c<l;++c)(n=o[c])&&(s.push(t.call(n,n.__data__,c,o)),r.push(n));return new Je(s,r)},selectChild:function(t){return this.select(null==t?Pt:function(t){return function(){return Kt.call(this.children,t)}}("function"==typeof t?t:_t(t)))},selectChildren:function(t){return this.selectAll(null==t?Ot:function(t){return function(){return Zt.call(this.children,t)}}("function"==typeof t?t:_t(t)))},filter:function(t){"function"!=typeof t&&(t=Wt(t));for(var e=this._groups,i=e.length,s=new Array(i),r=0;r<i;++r)for(var a,n=e[r],o=n.length,l=s[r]=[],c=0;c<o;++c)(a=n[c])&&t.call(a,a.__data__,c,n)&&l.push(a);return new Je(s,this._parents)},data:function(t,e){if(!arguments.length)return Array.from(this,ie);var i=e?ee:te,s=this._parents,r=this._groups;"function"!=typeof t&&(t=function(t){return function(){return t}}(t));for(var a=r.length,n=new Array(a),o=new Array(a),l=new Array(a),c=0;c<a;++c){var d=s[c],u=r[c],h=u.length,g=se(t.call(d,d&&d.__data__,c,s)),p=g.length,m=o[c]=new Array(p),b=n[c]=new Array(p);i(d,u,m,b,l[c]=new Array(h),g,e);for(var y,Q,B=0,U=0;B<p;++B)if(y=m[B]){for(B>=U&&(U=B+1);!(Q=b[U])&&++U<p;);y._next=Q||null}}return(n=new Je(n,s))._enter=o,n._exit=l,n},enter:function(){return new Je(this._enter||this._groups.map(jt),this._parents)},exit:function(){return new Je(this._exit||this._groups.map(jt),this._parents)},join:function(t,e,i){var s=this.enter(),r=this,a=this.exit();return"function"==typeof t?(s=t(s))&&(s=s.selection()):s=s.append(t+""),null!=e&&(r=e(r))&&(r=r.selection()),null==i?a.remove():i(a),s&&r?s.merge(r).order():r},merge:function(t){for(var e=t.selection?t.selection():t,i=this._groups,s=e._groups,r=i.length,a=s.length,n=Math.min(r,a),o=new Array(r),l=0;l<n;++l)for(var c,d=i[l],u=s[l],h=d.length,g=o[l]=new Array(h),p=0;p<h;++p)(c=d[p]||u[p])&&(g[p]=c);for(;l<r;++l)o[l]=i[l];return new Je(o,this._parents)},selection:function(){return this},order:function(){for(var t=this._groups,e=-1,i=t.length;++e<i;)for(var s,r=t[e],a=r.length-1,n=r[a];--a>=0;)(s=r[a])&&(n&&4^s.compareDocumentPosition(n)&&n.parentNode.insertBefore(s,n),n=s);return this},sort:function(t){function e(e,i){return e&&i?t(e.__data__,i.__data__):!e-!i}t||(t=re);for(var i=this._groups,s=i.length,r=new Array(s),a=0;a<s;++a){for(var n,o=i[a],l=o.length,c=r[a]=new Array(l),d=0;d<l;++d)(n=o[d])&&(c[d]=n);c.sort(e)}return new Je(r,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,i=t.length;e<i;++e)for(var s=t[e],r=0,a=s.length;r<a;++r){var n=s[r];if(n)return n}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,i=0,s=e.length;i<s;++i)for(var r,a=e[i],n=0,o=a.length;n<o;++n)(r=a[n])&&t.call(r,r.__data__,n,a);return this},attr:function(t,e){var i=Tt(t);if(arguments.length<2){var s=this.node();return i.local?s.getAttributeNS(i.space,i.local):s.getAttribute(i)}return this.each((null==e?i.local?ne:ae:"function"==typeof e?i.local?de:ce:i.local?le:oe)(i,e))},style:function(t,e,i){return arguments.length>1?this.each((null==e?he:"function"==typeof e?pe:ge)(t,e,null==i?"":i)):me(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?be:"function"==typeof e?Qe:ye)(t,e)):this.node()[t]},classed:function(t,e){var i=Be(t+"");if(arguments.length<2){for(var s=Ue(this.node()),r=-1,a=i.length;++r<a;)if(!s.contains(i[r]))return!1;return!0}return this.each(("function"==typeof e?Ae:e?Ce:ve)(i,e))},text:function(t){return arguments.length?this.each(null==t?xe:("function"==typeof t?Re:Ee)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?Se:("function"==typeof t?Le:Ne)(t)):this.node().innerHTML},raise:function(){return this.each(we)},lower:function(){return this.each(De)},append:function(t){var e="function"==typeof t?t:Ht(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})},insert:function(t,e){var i="function"==typeof t?t:Ht(t),s=null==e?Me:"function"==typeof e?e:Gt(e);return this.select(function(){return this.insertBefore(i.apply(this,arguments),s.apply(this,arguments)||null)})},remove:function(){return this.each(ke)},clone:function(t){return this.select(t?Ve:Te)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,e,i){var s,r,a=function(t){return t.trim().split(/^|\s+/).map(function(t){var e="",i=t.indexOf(".");return i>=0&&(e=t.slice(i+1),t=t.slice(0,i)),{type:t,name:e}})}(t+""),n=a.length;if(!(arguments.length<2)){for(o=e?He:$e,s=0;s<n;++s)this.each(o(a[s],e,i));return this}var o=this.node().__on;if(o)for(var l,c=0,d=o.length;c<d;++c)for(s=0,l=o[c];s<n;++s)if((r=a[s]).type===l.type&&r.name===l.name)return l.value},dispatch:function(t,e){return this.each(("function"==typeof e?Ye:Ge)(t,e))},[Symbol.iterator]:function*(){for(var t=this._groups,e=0,i=t.length;e<i;++e)for(var s,r=t[e],a=0,n=r.length;a<n;++a)(s=r[a])&&(yield s)}};var Ke=0;function Pe(){return new Ze}function Ze(){this._="@"+(++Ke).toString(36)}function Oe(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 i=e.ownerSVGElement||e;if(i.createSVGPoint){var s=i.createSVGPoint();return s.x=t.clientX,s.y=t.clientY,[(s=s.matrixTransform(e.getScreenCTM().inverse())).x,s.y]}if(e.getBoundingClientRect){var r=e.getBoundingClientRect();return[t.clientX-r.left-e.clientLeft,t.clientY-r.top-e.clientTop]}}return[t.pageX,t.pageY]}Ze.prototype=Pe.prototype={constructor:Ze,get:function(t){for(var e=this._;!(e in t);)if(!(t=t.parentNode))return;return t[e]},set:function(t,e){return t[this._]=e},remove:function(t){return this._ in t&&delete t[this._]},toString:function(){return this._}};const je={passive:!1},qe={capture:!0,passive:!1};function ti(t){t.stopImmediatePropagation()}function ei(t){t.preventDefault(),t.stopImmediatePropagation()}var ii=t=>()=>t;function si(t,{sourceEvent:e,subject:i,target:s,identifier:r,active:a,x:n,y:o,dx:l,dy:c,dispatch:d}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:i,enumerable:!0,configurable:!0},target:{value:s,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:n,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:d}})}function ri(t){return!t.ctrlKey&&!t.button}function ai(){return this.parentNode}function ni(t,e){return null==e?{x:t.x,y:t.y}:e}function oi(){return navigator.maxTouchPoints||"ontouchstart"in this}function li(){var t,e,i,s,r=ri,a=ai,n=ni,o=oi,l={},c=Nt("start","drag","end"),d=0,u=0;function h(t){t.on("mousedown.drag",g).filter(o).on("touchstart.drag",b).on("touchmove.drag",y,je).on("touchend.drag touchcancel.drag",Q).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(n,o){if(!s&&r.call(this,n,o)){var l=B(this,a.call(this,n,o),n,o,"mouse");l&&(_e(n.view).on("mousemove.drag",p,qe).on("mouseup.drag",m,qe),function(t){var e=t.document.documentElement,i=_e(t).on("dragstart.drag",ei,qe);"onselectstart"in e?i.on("selectstart.drag",ei,qe):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}(n.view),ti(n),i=!1,t=n.clientX,e=n.clientY,l("start",n))}}function p(s){if(ei(s),!i){var r=s.clientX-t,a=s.clientY-e;i=r*r+a*a>u}l.mouse("drag",s)}function m(t){_e(t.view).on("mousemove.drag mouseup.drag",null),function(t,e){var i=t.document.documentElement,s=_e(t).on("dragstart.drag",null);e&&(s.on("click.drag",ei,qe),setTimeout(function(){s.on("click.drag",null)},0)),"onselectstart"in i?s.on("selectstart.drag",null):(i.style.MozUserSelect=i.__noselect,delete i.__noselect)}(t.view,i),ei(t),l.mouse("end",t)}function b(t,e){if(r.call(this,t,e)){var i,s,n=t.changedTouches,o=a.call(this,t,e),l=n.length;for(i=0;i<l;++i)(s=B(this,o,t,e,n[i].identifier,n[i]))&&(ti(t),s("start",t,n[i]))}}function y(t){var e,i,s=t.changedTouches,r=s.length;for(e=0;e<r;++e)(i=l[s[e].identifier])&&(ei(t),i("drag",t,s[e]))}function Q(t){var e,i,r=t.changedTouches,a=r.length;for(s&&clearTimeout(s),s=setTimeout(function(){s=null},500),e=0;e<a;++e)(i=l[r[e].identifier])&&(ti(t),i("end",t,r[e]))}function B(t,e,i,s,r,a){var o,u,g,p=c.copy(),m=Oe(a||i,e);if(null!=(g=n.call(t,new si("beforestart",{sourceEvent:i,target:h,identifier:r,active:d,x:m[0],y:m[1],dx:0,dy:0,dispatch:p}),s)))return o=g.x-m[0]||0,u=g.y-m[1]||0,function i(a,n,c){var b,y=m;switch(a){case"start":l[r]=i,b=d++;break;case"end":delete l[r],--d;case"drag":m=Oe(c||n,e),b=d}p.call(a,t,new si(a,{sourceEvent:n,subject:g,target:h,identifier:r,active:b,x:m[0]+o,y:m[1]+u,dx:m[0]-y[0],dy:m[1]-y[1],dispatch:p}),s)}}return h.filter=function(t){return arguments.length?(r="function"==typeof t?t:ii(!!t),h):r},h.container=function(t){return arguments.length?(a="function"==typeof t?t:ii(t),h):a},h.subject=function(t){return arguments.length?(n="function"==typeof t?t:ii(t),h):n},h.touchable=function(t){return arguments.length?(o="function"==typeof t?t:ii(!!t),h):o},h.on=function(){var t=c.on.apply(c,arguments);return t===c?h:t},h.clickDistance=function(t){return arguments.length?(u=(t=+t)*t,h):Math.sqrt(u)},h}function ci(t,e,i){t.prototype=e.prototype=i,i.constructor=t}function di(t,e){var i=Object.create(t.prototype);for(var s in e)i[s]=e[s];return i}function ui(){}si.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};var hi=.7,gi=1/hi,pi="\\s*([+-]?\\d+)\\s*",mi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",bi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",yi=/^#([0-9a-f]{3,8})$/,Qi=new RegExp(`^rgb\\(${pi},${pi},${pi}\\)$`),Bi=new RegExp(`^rgb\\(${bi},${bi},${bi}\\)$`),Ui=new RegExp(`^rgba\\(${pi},${pi},${pi},${mi}\\)$`),Fi=new RegExp(`^rgba\\(${bi},${bi},${bi},${mi}\\)$`),Ii=new RegExp(`^hsl\\(${mi},${bi},${bi}\\)$`),fi=new RegExp(`^hsla\\(${mi},${bi},${bi},${mi}\\)$`),Ci={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 vi(){return this.rgb().formatHex()}function Ai(){return this.rgb().formatRgb()}function xi(t){var e,i;return t=(t+"").trim().toLowerCase(),(e=yi.exec(t))?(i=e[1].length,e=parseInt(e[1],16),6===i?Ei(e):3===i?new Ni(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===i?Ri(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===i?Ri(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=Qi.exec(t))?new Ni(e[1],e[2],e[3],1):(e=Bi.exec(t))?new Ni(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=Ui.exec(t))?Ri(e[1],e[2],e[3],e[4]):(e=Fi.exec(t))?Ri(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=Ii.exec(t))?Ti(e[1],e[2]/100,e[3]/100,1):(e=fi.exec(t))?Ti(e[1],e[2]/100,e[3]/100,e[4]):Ci.hasOwnProperty(t)?Ei(Ci[t]):"transparent"===t?new Ni(NaN,NaN,NaN,0):null}function Ei(t){return new Ni(t>>16&255,t>>8&255,255&t,1)}function Ri(t,e,i,s){return s<=0&&(t=e=i=NaN),new Ni(t,e,i,s)}function Si(t,e,i,s){return 1===arguments.length?function(t){return t instanceof ui||(t=xi(t)),t?new Ni((t=t.rgb()).r,t.g,t.b,t.opacity):new Ni}(t):new Ni(t,e,i,null==s?1:s)}function Ni(t,e,i,s){this.r=+t,this.g=+e,this.b=+i,this.opacity=+s}function Li(){return`#${ki(this.r)}${ki(this.g)}${ki(this.b)}`}function wi(){const t=Di(this.opacity);return`${1===t?"rgb(":"rgba("}${Mi(this.r)}, ${Mi(this.g)}, ${Mi(this.b)}${1===t?")":`, ${t})`}`}function Di(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Mi(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function ki(t){return((t=Mi(t))<16?"0":"")+t.toString(16)}function Ti(t,e,i,s){return s<=0?t=e=i=NaN:i<=0||i>=1?t=e=NaN:e<=0&&(t=NaN),new $i(t,e,i,s)}function Vi(t){if(t instanceof $i)return new $i(t.h,t.s,t.l,t.opacity);if(t instanceof ui||(t=xi(t)),!t)return new $i;if(t instanceof $i)return t;var e=(t=t.rgb()).r/255,i=t.g/255,s=t.b/255,r=Math.min(e,i,s),a=Math.max(e,i,s),n=NaN,o=a-r,l=(a+r)/2;return o?(n=e===a?(i-s)/o+6*(i<s):i===a?(s-e)/o+2:(e-i)/o+4,o/=l<.5?a+r:2-a-r,n*=60):o=l>0&&l<1?0:n,new $i(n,o,l,t.opacity)}function $i(t,e,i,s){this.h=+t,this.s=+e,this.l=+i,this.opacity=+s}function Hi(t){return(t=(t||0)%360)<0?t+360:t}function zi(t){return Math.max(0,Math.min(1,t||0))}function Gi(t,e,i){return 255*(t<60?e+(i-e)*t/60:t<180?i:t<240?e+(i-e)*(240-t)/60:e)}ci(ui,xi,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:vi,formatHex:vi,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Vi(this).formatHsl()},formatRgb:Ai,toString:Ai}),ci(Ni,Si,di(ui,{brighter(t){return t=null==t?gi:Math.pow(gi,t),new Ni(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?hi:Math.pow(hi,t),new Ni(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Ni(Mi(this.r),Mi(this.g),Mi(this.b),Di(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:Li,formatHex:Li,formatHex8:function(){return`#${ki(this.r)}${ki(this.g)}${ki(this.b)}${ki(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:wi,toString:wi})),ci($i,function(t,e,i,s){return 1===arguments.length?Vi(t):new $i(t,e,i,null==s?1:s)},di(ui,{brighter(t){return t=null==t?gi:Math.pow(gi,t),new $i(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?hi:Math.pow(hi,t),new $i(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,i=this.l,s=i+(i<.5?i:1-i)*e,r=2*i-s;return new Ni(Gi(t>=240?t-240:t+120,r,s),Gi(t,r,s),Gi(t<120?t+240:t-120,r,s),this.opacity)},clamp(){return new $i(Hi(this.h),zi(this.s),zi(this.l),Di(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=Di(this.opacity);return`${1===t?"hsl(":"hsla("}${Hi(this.h)}, ${100*zi(this.s)}%, ${100*zi(this.l)}%${1===t?")":`, ${t})`}`}}));var Yi=t=>()=>t;function Xi(t){return 1===(t=+t)?Ji:function(e,i){return i-e?function(t,e,i){return t=Math.pow(t,i),e=Math.pow(e,i)-t,i=1/i,function(s){return Math.pow(t+s*e,i)}}(e,i,t):Yi(isNaN(e)?i:e)}}function Ji(t,e){var i=e-t;return i?function(t,e){return function(i){return t+i*e}}(t,i):Yi(isNaN(t)?e:t)}var Wi=function t(e){var i=Xi(e);function s(t,e){var s=i((t=Si(t)).r,(e=Si(e)).r),r=i(t.g,e.g),a=i(t.b,e.b),n=Ji(t.opacity,e.opacity);return function(e){return t.r=s(e),t.g=r(e),t.b=a(e),t.opacity=n(e),t+""}}return s.gamma=t,s}(1);function _i(t,e){e||(e=[]);var i,s=t?Math.min(e.length,t.length):0,r=e.slice();return function(a){for(i=0;i<s;++i)r[i]=t[i]*(1-a)+e[i]*a;return r}}function Ki(t,e){var i,s=e?e.length:0,r=t?Math.min(s,t.length):0,a=new Array(r),n=new Array(s);for(i=0;i<r;++i)a[i]=es(t[i],e[i]);for(;i<s;++i)n[i]=e[i];return function(t){for(i=0;i<r;++i)n[i]=a[i](t);return n}}function Pi(t,e){var i=new Date;return t=+t,e=+e,function(s){return i.setTime(t*(1-s)+e*s),i}}function Zi(t,e){return t=+t,e=+e,function(i){return t*(1-i)+e*i}}function Oi(t,e){var i,s={},r={};for(i in null!==t&&"object"==typeof t||(t={}),null!==e&&"object"==typeof e||(e={}),e)i in t?s[i]=es(t[i],e[i]):r[i]=e[i];return function(t){for(i in s)r[i]=s[i](t);return r}}var ji=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,qi=new RegExp(ji.source,"g");function ts(t,e){var i,s,r,a=ji.lastIndex=qi.lastIndex=0,n=-1,o=[],l=[];for(t+="",e+="";(i=ji.exec(t))&&(s=qi.exec(e));)(r=s.index)>a&&(r=e.slice(a,r),o[n]?o[n]+=r:o[++n]=r),(i=i[0])===(s=s[0])?o[n]?o[n]+=s:o[++n]=s:(o[++n]=null,l.push({i:n,x:Zi(i,s)})),a=qi.lastIndex;return a<e.length&&(r=e.slice(a),o[n]?o[n]+=r:o[++n]=r),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 i,s=0;s<e;++s)o[(i=l[s]).i]=i.x(t);return o.join("")})}function es(t,e){var i,s=typeof e;return null==e||"boolean"===s?Yi(e):("number"===s?Zi:"string"===s?(i=xi(e))?(e=i,Wi):ts:e instanceof xi?Wi:e instanceof Date?Pi:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}(e)?_i:Array.isArray(e)?Ki:"function"!=typeof e.valueOf&&"function"!=typeof e.toString||isNaN(e)?Oi:Zi)(t,e)}function is(t,e){return t=+t,e=+e,function(i){return Math.round(t*(1-i)+e*i)}}var ss,rs=180/Math.PI,as={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function ns(t,e,i,s,r,a){var n,o,l;return(n=Math.sqrt(t*t+e*e))&&(t/=n,e/=n),(l=t*i+e*s)&&(i-=t*l,s-=e*l),(o=Math.sqrt(i*i+s*s))&&(i/=o,s/=o,l/=o),t*s<e*i&&(t=-t,e=-e,l=-l,n=-n),{translateX:r,translateY:a,rotate:Math.atan2(e,t)*rs,skewX:Math.atan(l)*rs,scaleX:n,scaleY:o}}function os(t,e,i,s){function r(t){return t.length?t.pop()+" ":""}return function(a,n){var o=[],l=[];return a=t(a),n=t(n),function(t,s,r,a,n,o){if(t!==r||s!==a){var l=n.push("translate(",null,e,null,i);o.push({i:l-4,x:Zi(t,r)},{i:l-2,x:Zi(s,a)})}else(r||a)&&n.push("translate("+r+e+a+i)}(a.translateX,a.translateY,n.translateX,n.translateY,o,l),function(t,e,i,a){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),a.push({i:i.push(r(i)+"rotate(",null,s)-2,x:Zi(t,e)})):e&&i.push(r(i)+"rotate("+e+s)}(a.rotate,n.rotate,o,l),function(t,e,i,a){t!==e?a.push({i:i.push(r(i)+"skewX(",null,s)-2,x:Zi(t,e)}):e&&i.push(r(i)+"skewX("+e+s)}(a.skewX,n.skewX,o,l),function(t,e,i,s,a,n){if(t!==i||e!==s){var o=a.push(r(a)+"scale(",null,",",null,")");n.push({i:o-4,x:Zi(t,i)},{i:o-2,x:Zi(e,s)})}else 1===i&&1===s||a.push(r(a)+"scale("+i+","+s+")")}(a.scaleX,a.scaleY,n.scaleX,n.scaleY,o,l),a=n=null,function(t){for(var e,i=-1,s=l.length;++i<s;)o[(e=l[i]).i]=e.x(t);return o.join("")}}}var ls,cs,ds=os(function(t){const e=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?as:ns(e.a,e.b,e.c,e.d,e.e,e.f)},"px, ","px)","deg)"),us=os(function(t){return null==t?as:(ss||(ss=document.createElementNS("http://www.w3.org/2000/svg","g")),ss.setAttribute("transform",t),(t=ss.transform.baseVal.consolidate())?ns((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):as)},", ",")",")"),hs=0,gs=0,ps=0,ms=0,bs=0,ys=0,Qs="object"==typeof performance&&performance.now?performance:Date,Bs="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Us(){return bs||(Bs(Fs),bs=Qs.now()+ys)}function Fs(){bs=0}function Is(){this._call=this._time=this._next=null}function fs(t,e,i){var s=new Is;return s.restart(t,e,i),s}function Cs(){bs=(ms=Qs.now())+ys,hs=gs=0;try{!function(){Us(),++hs;for(var t,e=ls;e;)(t=bs-e._time)>=0&&e._call.call(void 0,t),e=e._next;--hs}()}finally{hs=0,function(){var t,e,i=ls,s=1/0;for(;i;)i._call?(s>i._time&&(s=i._time),t=i,i=i._next):(e=i._next,i._next=null,i=t?t._next=e:ls=e);cs=t,As(s)}(),bs=0}}function vs(){var t=Qs.now(),e=t-ms;e>1e3&&(ys-=e,ms=t)}function As(t){hs||(gs&&(gs=clearTimeout(gs)),t-bs>24?(t<1/0&&(gs=setTimeout(Cs,t-Qs.now()-ys)),ps&&(ps=clearInterval(ps))):(ps||(ms=Qs.now(),ps=setInterval(vs,1e3)),hs=1,Bs(Cs)))}function xs(t,e,i){var s=new Is;return e=null==e?0:+e,s.restart(i=>{s.stop(),t(i+e)},e,i),s}Is.prototype=fs.prototype={constructor:Is,restart:function(t,e,i){if("function"!=typeof t)throw new TypeError("callback is not a function");i=(null==i?Us():+i)+(null==e?0:+e),this._next||cs===this||(cs?cs._next=this:ls=this,cs=this),this._call=t,this._time=i,As()},stop:function(){this._call&&(this._call=null,this._time=1/0,As())}};var Es=Nt("start","end","cancel","interrupt"),Rs=[];function Ss(t,e,i,s,r,a){var n=t.__transition;if(n){if(i in n)return}else t.__transition={};!function(t,e,i){var s,r=t.__transition;function a(t){i.state=1,i.timer.restart(n,i.delay,i.time),i.delay<=t&&n(t-i.delay)}function n(a){var c,d,u,h;if(1!==i.state)return l();for(c in r)if((h=r[c]).name===i.name){if(3===h.state)return xs(n);4===h.state?(h.state=6,h.timer.stop(),h.on.call("interrupt",t,t.__data__,h.index,h.group),delete r[c]):+c<e&&(h.state=6,h.timer.stop(),h.on.call("cancel",t,t.__data__,h.index,h.group),delete r[c])}if(xs(function(){3===i.state&&(i.state=4,i.timer.restart(o,i.delay,i.time),o(a))}),i.state=2,i.on.call("start",t,t.__data__,i.index,i.group),2===i.state){for(i.state=3,s=new Array(u=i.tween.length),c=0,d=-1;c<u;++c)(h=i.tween[c].value.call(t,t.__data__,i.index,i.group))&&(s[++d]=h);s.length=d+1}}function o(e){for(var r=e<i.duration?i.ease.call(null,e/i.duration):(i.timer.restart(l),i.state=5,1),a=-1,n=s.length;++a<n;)s[a].call(t,r);5===i.state&&(i.on.call("end",t,t.__data__,i.index,i.group),l())}function l(){for(var s in i.state=6,i.timer.stop(),delete r[e],r)return;delete t.__transition}r[e]=i,i.timer=fs(a,0,i.time)}(t,i,{name:e,index:s,group:r,on:Es,tween:Rs,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function Ns(t,e){var i=ws(t,e);if(i.state>0)throw new Error("too late; already scheduled");return i}function Ls(t,e){var i=ws(t,e);if(i.state>3)throw new Error("too late; already running");return i}function ws(t,e){var i=t.__transition;if(!i||!(i=i[e]))throw new Error("transition not found");return i}function Ds(t,e){var i,s;return function(){var r=Ls(this,t),a=r.tween;if(a!==i)for(var n=0,o=(s=i=a).length;n<o;++n)if(s[n].name===e){(s=s.slice()).splice(n,1);break}r.tween=s}}function Ms(t,e,i){var s,r;if("function"!=typeof i)throw new Error;return function(){var a=Ls(this,t),n=a.tween;if(n!==s){r=(s=n).slice();for(var o={name:e,value:i},l=0,c=r.length;l<c;++l)if(r[l].name===e){r[l]=o;break}l===c&&r.push(o)}a.tween=r}}function ks(t,e,i){var s=t._id;return t.each(function(){var t=Ls(this,s);(t.value||(t.value={}))[e]=i.apply(this,arguments)}),function(t){return ws(t,s).value[e]}}function Ts(t,e){var i;return("number"==typeof e?Zi:e instanceof xi?Wi:(i=xi(e))?(e=i,Wi):ts)(t,e)}function Vs(t){return function(){this.removeAttribute(t)}}function $s(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Hs(t,e,i){var s,r,a=i+"";return function(){var n=this.getAttribute(t);return n===a?null:n===s?r:r=e(s=n,i)}}function zs(t,e,i){var s,r,a=i+"";return function(){var n=this.getAttributeNS(t.space,t.local);return n===a?null:n===s?r:r=e(s=n,i)}}function Gs(t,e,i){var s,r,a;return function(){var n,o,l=i(this);if(null!=l)return(n=this.getAttribute(t))===(o=l+"")?null:n===s&&o===r?a:(r=o,a=e(s=n,l));this.removeAttribute(t)}}function Ys(t,e,i){var s,r,a;return function(){var n,o,l=i(this);if(null!=l)return(n=this.getAttributeNS(t.space,t.local))===(o=l+"")?null:n===s&&o===r?a:(r=o,a=e(s=n,l));this.removeAttributeNS(t.space,t.local)}}function Xs(t,e){var i,s;function r(){var r=e.apply(this,arguments);return r!==s&&(i=(s=r)&&function(t,e){return function(i){this.setAttributeNS(t.space,t.local,e.call(this,i))}}(t,r)),i}return r._value=e,r}function Js(t,e){var i,s;function r(){var r=e.apply(this,arguments);return r!==s&&(i=(s=r)&&function(t,e){return function(i){this.setAttribute(t,e.call(this,i))}}(t,r)),i}return r._value=e,r}function Ws(t,e){return function(){Ns(this,t).delay=+e.apply(this,arguments)}}function _s(t,e){return e=+e,function(){Ns(this,t).delay=e}}function Ks(t,e){return function(){Ls(this,t).duration=+e.apply(this,arguments)}}function Ps(t,e){return e=+e,function(){Ls(this,t).duration=e}}var Zs=We.prototype.constructor;function Os(t){return function(){this.style.removeProperty(t)}}var js=0;function qs(t,e,i,s){this._groups=t,this._parents=e,this._name=i,this._id=s}function tr(){return++js}var er=We.prototype;qs.prototype={constructor:qs,select:function(t){var e=this._name,i=this._id;"function"!=typeof t&&(t=Gt(t));for(var s=this._groups,r=s.length,a=new Array(r),n=0;n<r;++n)for(var o,l,c=s[n],d=c.length,u=a[n]=new Array(d),h=0;h<d;++h)(o=c[h])&&(l=t.call(o,o.__data__,h,c))&&("__data__"in o&&(l.__data__=o.__data__),u[h]=l,Ss(u[h],e,i,h,u,ws(o,i)));return new qs(a,this._parents,e,i)},selectAll:function(t){var e=this._name,i=this._id;"function"!=typeof t&&(t=Xt(t));for(var s=this._groups,r=s.length,a=[],n=[],o=0;o<r;++o)for(var l,c=s[o],d=c.length,u=0;u<d;++u)if(l=c[u]){for(var h,g=t.call(l,l.__data__,u,c),p=ws(l,i),m=0,b=g.length;m<b;++m)(h=g[m])&&Ss(h,e,i,m,g,p);a.push(g),n.push(l)}return new qs(a,n,e,i)},selectChild:er.selectChild,selectChildren:er.selectChildren,filter:function(t){"function"!=typeof t&&(t=Wt(t));for(var e=this._groups,i=e.length,s=new Array(i),r=0;r<i;++r)for(var a,n=e[r],o=n.length,l=s[r]=[],c=0;c<o;++c)(a=n[c])&&t.call(a,a.__data__,c,n)&&l.push(a);return new qs(s,this._parents,this._name,this._id)},merge:function(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,i=t._groups,s=e.length,r=i.length,a=Math.min(s,r),n=new Array(s),o=0;o<a;++o)for(var l,c=e[o],d=i[o],u=c.length,h=n[o]=new Array(u),g=0;g<u;++g)(l=c[g]||d[g])&&(h[g]=l);for(;o<s;++o)n[o]=e[o];return new qs(n,this._parents,this._name,this._id)},selection:function(){return new Zs(this._groups,this._parents)},transition:function(){for(var t=this._name,e=this._id,i=tr(),s=this._groups,r=s.length,a=0;a<r;++a)for(var n,o=s[a],l=o.length,c=0;c<l;++c)if(n=o[c]){var d=ws(n,e);Ss(n,t,i,c,o,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new qs(s,this._parents,t,i)},call:er.call,nodes:er.nodes,node:er.node,size:er.size,empty:er.empty,each:er.each,on:function(t,e){var i=this._id;return arguments.length<2?ws(this.node(),i).on.on(t):this.each(function(t,e,i){var s,r,a=function(t){return(t+"").trim().split(/^|\s+/).every(function(t){var e=t.indexOf(".");return e>=0&&(t=t.slice(0,e)),!t||"start"===t})}(e)?Ns:Ls;return function(){var n=a(this,t),o=n.on;o!==s&&(r=(s=o).copy()).on(e,i),n.on=r}}(i,t,e))},attr:function(t,e){var i=Tt(t),s="transform"===i?us:Ts;return this.attrTween(t,"function"==typeof e?(i.local?Ys:Gs)(i,s,ks(this,"attr."+t,e)):null==e?(i.local?$s:Vs)(i):(i.local?zs:Hs)(i,s,e))},attrTween:function(t,e){var i="attr."+t;if(arguments.length<2)return(i=this.tween(i))&&i._value;if(null==e)return this.tween(i,null);if("function"!=typeof e)throw new Error;var s=Tt(t);return this.tween(i,(s.local?Xs:Js)(s,e))},style:function(t,e,i){var s="transform"==(t+="")?ds:Ts;return null==e?this.styleTween(t,function(t,e){var i,s,r;return function(){var a=me(this,t),n=(this.style.removeProperty(t),me(this,t));return a===n?null:a===i&&n===s?r:r=e(i=a,s=n)}}(t,s)).on("end.style."+t,Os(t)):"function"==typeof e?this.styleTween(t,function(t,e,i){var s,r,a;return function(){var n=me(this,t),o=i(this),l=o+"";return null==o&&(this.style.removeProperty(t),l=o=me(this,t)),n===l?null:n===s&&l===r?a:(r=l,a=e(s=n,o))}}(t,s,ks(this,"style."+t,e))).each(function(t,e){var i,s,r,a,n="style."+e,o="end."+n;return function(){var l=Ls(this,t),c=l.on,d=null==l.value[n]?a||(a=Os(e)):void 0;c===i&&r===d||(s=(i=c).copy()).on(o,r=d),l.on=s}}(this._id,t)):this.styleTween(t,function(t,e,i){var s,r,a=i+"";return function(){var n=me(this,t);return n===a?null:n===s?r:r=e(s=n,i)}}(t,s,e),i).on("end.style."+t,null)},styleTween:function(t,e,i){var s="style."+(t+="");if(arguments.length<2)return(s=this.tween(s))&&s._value;if(null==e)return this.tween(s,null);if("function"!=typeof e)throw new Error;return this.tween(s,function(t,e,i){var s,r;function a(){var a=e.apply(this,arguments);return a!==r&&(s=(r=a)&&function(t,e,i){return function(s){this.style.setProperty(t,e.call(this,s),i)}}(t,a,i)),s}return a._value=e,a}(t,e,null==i?"":i))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var e=t(this);this.textContent=null==e?"":e}}(ks(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))},textTween:function(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(null==t)return this.tween(e,null);if("function"!=typeof t)throw new Error;return this.tween(e,function(t){var e,i;function s(){var s=t.apply(this,arguments);return s!==i&&(e=(i=s)&&function(t){return function(e){this.textContent=t.call(this,e)}}(s)),e}return s._value=t,s}(t))},remove:function(){return this.on("end.remove",function(t){return function(){var e=this.parentNode;for(var i in this.__transition)if(+i!==t)return;e&&e.removeChild(this)}}(this._id))},tween:function(t,e){var i=this._id;if(t+="",arguments.length<2){for(var s,r=ws(this.node(),i).tween,a=0,n=r.length;a<n;++a)if((s=r[a]).name===t)return s.value;return null}return this.each((null==e?Ds:Ms)(i,t,e))},delay:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?Ws:_s)(e,t)):ws(this.node(),e).delay},duration:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?Ks:Ps)(e,t)):ws(this.node(),e).duration},ease:function(t){var e=this._id;return arguments.length?this.each(function(t,e){if("function"!=typeof e)throw new Error;return function(){Ls(this,t).ease=e}}(e,t)):ws(this.node(),e).ease},easeVarying:function(t){if("function"!=typeof t)throw new Error;return this.each(function(t,e){return function(){var i=e.apply(this,arguments);if("function"!=typeof i)throw new Error;Ls(this,t).ease=i}}(this._id,t))},end:function(){var t,e,i=this,s=i._id,r=i.size();return new Promise(function(a,n){var o={value:n},l={value:function(){0===--r&&a()}};i.each(function(){var i=Ls(this,s),r=i.on;r!==t&&((e=(t=r).copy())._.cancel.push(o),e._.interrupt.push(o),e._.end.push(l)),i.on=e}),0===r&&a()})},[Symbol.iterator]:er[Symbol.iterator]};const ir=t=>+t;function sr(t){return--t*t*t+1}var rr={time:null,delay:0,duration:250,ease:function(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}};function ar(t,e){for(var i;!(i=t.__transition)||!(i=i[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return i}We.prototype.interrupt=function(t){return this.each(function(){!function(t,e){var i,s,r,a=t.__transition,n=!0;if(a){for(r in e=null==e?null:e+"",a)(i=a[r]).name===e?(s=i.state>2&&i.state<5,i.state=6,i.timer.stop(),i.on.call(s?"interrupt":"cancel",t,t.__data__,i.index,i.group),delete a[r]):n=!1;n&&delete t.__transition}}(this,t)})},We.prototype.transition=function(t){var e,i;t instanceof qs?(e=t._id,t=t._name):(e=tr(),(i=rr).time=Us(),t=null==t?null:t+"");for(var s=this._groups,r=s.length,a=0;a<r;++a)for(var n,o=s[a],l=o.length,c=0;c<l;++c)(n=o[c])&&Ss(n,t,e,c,o,i||ar(n,e));return new qs(s,this._parents,t,e)};const nr=Math.PI,or=2*nr,lr=1e-6,cr=or-lr;function dr(t){this._+=t[0];for(let e=1,i=t.length;e<i;++e)this._+=arguments[e]+t[e]}class ur{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=null==t?dr:function(t){let e=Math.floor(t);if(!(e>=0))throw new Error(`invalid digits: ${t}`);if(e>15)return dr;const i=10**e;return function(t){this._+=t[0];for(let e=1,s=t.length;e<s;++e)this._+=Math.round(arguments[e]*i)/i+t[e]}}(t)}moveTo(t,e){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,e){this._append`L${this._x1=+t},${this._y1=+e}`}quadraticCurveTo(t,e,i,s){this._append`Q${+t},${+e},${this._x1=+i},${this._y1=+s}`}bezierCurveTo(t,e,i,s,r,a){this._append`C${+t},${+e},${+i},${+s},${this._x1=+r},${this._y1=+a}`}arcTo(t,e,i,s,r){if(t=+t,e=+e,i=+i,s=+s,(r=+r)<0)throw new Error(`negative radius: ${r}`);let a=this._x1,n=this._y1,o=i-t,l=s-e,c=a-t,d=n-e,u=c*c+d*d;if(null===this._x1)this._append`M${this._x1=t},${this._y1=e}`;else if(u>lr)if(Math.abs(d*o-l*c)>lr&&r){let h=i-a,g=s-n,p=o*o+l*l,m=h*h+g*g,b=Math.sqrt(p),y=Math.sqrt(u),Q=r*Math.tan((nr-Math.acos((p+u-m)/(2*b*y)))/2),B=Q/y,U=Q/b;Math.abs(B-1)>lr&&this._append`L${t+B*c},${e+B*d}`,this._append`A${r},${r},0,0,${+(d*h>c*g)},${this._x1=t+U*o},${this._y1=e+U*l}`}else this._append`L${this._x1=t},${this._y1=e}`;else;}arc(t,e,i,s,r,a){if(t=+t,e=+e,a=!!a,(i=+i)<0)throw new Error(`negative radius: ${i}`);let n=i*Math.cos(s),o=i*Math.sin(s),l=t+n,c=e+o,d=1^a,u=a?s-r:r-s;null===this._x1?this._append`M${l},${c}`:(Math.abs(this._x1-l)>lr||Math.abs(this._y1-c)>lr)&&this._append`L${l},${c}`,i&&(u<0&&(u=u%or+or),u>cr?this._append`A${i},${i},0,1,${d},${t-n},${e-o}A${i},${i},0,1,${d},${this._x1=l},${this._y1=c}`:u>lr&&this._append`A${i},${i},0,${+(u>=nr)},${d},${this._x1=t+i*Math.cos(r)},${this._y1=e+i*Math.sin(r)}`)}rect(t,e,i,s){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}h${i=+i}v${+s}h${-i}Z`}toString(){return this._}}function hr(t,e){if((i=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var i,s=t.slice(0,i);return[s.length>1?s[0]+s.slice(2):s,+t.slice(i+1)]}function gr(t){return(t=hr(Math.abs(t)))?t[1]:NaN}var pr,mr=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function br(t){if(!(e=mr.exec(t)))throw new Error("invalid format: "+t);var e;return new yr({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function yr(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function Qr(t,e){var i=hr(t,e);if(!i)return t+"";var s=i[0],r=i[1];return r<0?"0."+new Array(-r).join("0")+s:s.length>r+1?s.slice(0,r+1)+"."+s.slice(r+1):s+new Array(r-s.length+2).join("0")}br.prototype=yr.prototype,yr.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var Br={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>Qr(100*t,e),r:Qr,s:function(t,e){var i=hr(t,e);if(!i)return t+"";var s=i[0],r=i[1],a=r-(pr=3*Math.max(-8,Math.min(8,Math.floor(r/3))))+1,n=s.length;return a===n?s:a>n?s+new Array(a-n+1).join("0"):a>0?s.slice(0,a)+"."+s.slice(a):"0."+new Array(1-a).join("0")+hr(t,Math.max(0,e+a-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function Ur(t){return t}var Fr,Ir,fr,Cr=Array.prototype.map,vr=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Ar(t){var e,i,s=void 0===t.grouping||void 0===t.thousands?Ur:(e=Cr.call(t.grouping,Number),i=t.thousands+"",function(t,s){for(var r=t.length,a=[],n=0,o=e[0],l=0;r>0&&o>0&&(l+o+1>s&&(o=Math.max(1,s-l)),a.push(t.substring(r-=o,r+o)),!((l+=o+1)>s));)o=e[n=(n+1)%e.length];return a.reverse().join(i)}),r=void 0===t.currency?"":t.currency[0]+"",a=void 0===t.currency?"":t.currency[1]+"",n=void 0===t.decimal?".":t.decimal+"",o=void 0===t.numerals?Ur:function(t){return function(e){return e.replace(/[0-9]/g,function(e){return t[+e]})}}(Cr.call(t.numerals,String)),l=void 0===t.percent?"%":t.percent+"",c=void 0===t.minus?"−":t.minus+"",d=void 0===t.nan?"NaN":t.nan+"";function u(t){var e=(t=br(t)).fill,i=t.align,u=t.sign,h=t.symbol,g=t.zero,p=t.width,m=t.comma,b=t.precision,y=t.trim,Q=t.type;"n"===Q?(m=!0,Q="g"):Br[Q]||(void 0===b&&(b=12),y=!0,Q="g"),(g||"0"===e&&"="===i)&&(g=!0,e="0",i="=");var B="$"===h?r:"#"===h&&/[boxX]/.test(Q)?"0"+Q.toLowerCase():"",U="$"===h?a:/[%p]/.test(Q)?l:"",F=Br[Q],I=/[defgprs%]/.test(Q);function f(t){var r,a,l,h=B,f=U;if("c"===Q)f=F(t)+f,t="";else{var C=(t=+t)<0||1/t<0;if(t=isNaN(t)?d:F(Math.abs(t),b),y&&(t=function(t){t:for(var e,i=t.length,s=1,r=-1;s<i;++s)switch(t[s]){case".":r=e=s;break;case"0":0===r&&(r=s),e=s;break;default:if(!+t[s])break t;r>0&&(r=0)}return r>0?t.slice(0,r)+t.slice(e+1):t}(t)),C&&0===+t&&"+"!==u&&(C=!1),h=(C?"("===u?u:c:"-"===u||"("===u?"":u)+h,f=("s"===Q?vr[8+pr/3]:"")+f+(C&&"("===u?")":""),I)for(r=-1,a=t.length;++r<a;)if(48>(l=t.charCodeAt(r))||l>57){f=(46===l?n+t.slice(r+1):t.slice(r))+f,t=t.slice(0,r);break}}m&&!g&&(t=s(t,1/0));var v=h.length+t.length+f.length,A=v<p?new Array(p-v+1).join(e):"";switch(m&&g&&(t=s(A+t,A.length?p-f.length:1/0),A=""),i){case"<":t=h+t+f+A;break;case"=":t=h+A+t+f;break;case"^":t=A.slice(0,v=A.length>>1)+h+t+f+A.slice(v);break;default:t=A+h+t+f}return o(t)}return b=void 0===b?6:/[gprs]/.test(Q)?Math.max(1,Math.min(21,b)):Math.max(0,Math.min(20,b)),f.toString=function(){return t+""},f}return{format:u,formatPrefix:function(t,e){var i=u(((t=br(t)).type="f",t)),s=3*Math.max(-8,Math.min(8,Math.floor(gr(e)/3))),r=Math.pow(10,-s),a=vr[8+s/3];return function(t){return i(r*t)+a}}}}Fr=Ar({thousands:",",grouping:[3],currency:["$",""]}),Ir=Fr.format,fr=Fr.formatPrefix;var xr=Math.random,Er=function t(e){function i(t,i){return t=null==t?0:+t,i=null==i?1:+i,1===arguments.length?(i=t,t=0):i-=t,function(){return e()*i+t}}return i.source=t,i}(xr),Rr=function t(e){function i(t,i){var s,r;return t=null==t?0:+t,i=null==i?1:+i,function(){var a;if(null!=s)a=s,s=null;else do{s=2*e()-1,a=2*e()-1,r=s*s+a*a}while(!r||r>1);return t+i*a*Math.sqrt(-2*Math.log(r)/r)}}return i.source=t,i}(xr);const Sr=1/4294967296;function Nr(t=Math.random()){let e=0|(0<=t&&t<1?t/Sr:Math.abs(t));return()=>(e=1664525*e+1013904223|0,Sr*(e>>>0))}function Lr(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}function wr(t){return+t}var Dr=[0,1];function Mr(t){return t}function kr(t,e){return(e-=t=+t)?function(i){return(i-t)/e}:function(t){return function(){return t}}(isNaN(e)?NaN:.5)}function Tr(t,e,i){var s=t[0],r=t[1],a=e[0],n=e[1];return r<s?(s=kr(r,s),a=i(n,a)):(s=kr(s,r),a=i(a,n)),function(t){return a(s(t))}}function Vr(t,e,i){var s=Math.min(t.length,e.length)-1,r=new Array(s),a=new Array(s),n=-1;for(t[s]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++n<s;)r[n]=kr(t[n],t[n+1]),a[n]=i(e[n],e[n+1]);return function(e){var i=mt(t,e,1,s)-1;return a[i](r[i](e))}}function $r(){var t,e,i,s,r,a,n=Dr,o=Dr,l=es,c=Mr;function d(){var t=Math.min(n.length,o.length);return c!==Mr&&(c=function(t,e){var i;return t>e&&(i=t,t=e,e=i),function(i){return Math.max(t,Math.min(e,i))}}(n[0],n[t-1])),s=t>2?Vr:Tr,r=a=null,u}function u(e){return null==e||isNaN(e=+e)?i:(r||(r=s(n.map(t),o,l)))(t(c(e)))}return u.invert=function(i){return c(e((a||(a=s(o,n.map(t),Zi)))(i)))},u.domain=function(t){return arguments.length?(n=Array.from(t,wr),d()):n.slice()},u.range=function(t){return arguments.length?(o=Array.from(t),d()):o.slice()},u.rangeRound=function(t){return o=Array.from(t),l=is,d()},u.clamp=function(t){return arguments.length?(c=!!t||Mr,d()):c!==Mr},u.interpolate=function(t){return arguments.length?(l=t,d()):l},u.unknown=function(t){return arguments.length?(i=t,u):i},function(i,s){return t=i,e=s,d()}}function Hr(t,e,i,s){var r,a=function(t,e,i){i=+i;const s=(e=+e)<(t=+t),r=s?Ut(e,t,i):Ut(t,e,i);return(s?-1:1)*(r<0?1/-r:r)}(t,e,i);switch((s=br(null==s?",f":s)).type){case"s":var n=Math.max(Math.abs(t),Math.abs(e));return null!=s.precision||isNaN(r=function(t,e){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(gr(e)/3)))-gr(Math.abs(t)))}(a,n))||(s.precision=r),fr(s,n);case"":case"e":case"g":case"p":case"r":null!=s.precision||isNaN(r=function(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,gr(e)-gr(t))+1}(a,Math.max(Math.abs(t),Math.abs(e))))||(s.precision=r-("e"===s.type));break;case"f":case"%":null!=s.precision||isNaN(r=function(t){return Math.max(0,-gr(Math.abs(t)))}(a))||(s.precision=r-2*("%"===s.type))}return Ir(s)}function zr(t){var e=t.domain;return t.ticks=function(t){var i=e();return function(t,e,i){if(!((i=+i)>0))return[];if((t=+t)===(e=+e))return[t];const s=e<t,[r,a,n]=s?Bt(e,t,i):Bt(t,e,i);if(!(a>=r))return[];const o=a-r+1,l=new Array(o);if(s)if(n<0)for(let t=0;t<o;++t)l[t]=(a-t)/-n;else for(let t=0;t<o;++t)l[t]=(a-t)*n;else if(n<0)for(let t=0;t<o;++t)l[t]=(r+t)/-n;else for(let t=0;t<o;++t)l[t]=(r+t)*n;return l}(i[0],i[i.length-1],null==t?10:t)},t.tickFormat=function(t,i){var s=e();return Hr(s[0],s[s.length-1],null==t?10:t,i)},t.nice=function(i){null==i&&(i=10);var s,r,a=e(),n=0,o=a.length-1,l=a[n],c=a[o],d=10;for(c<l&&(r=l,l=c,c=r,r=n,n=o,o=r);d-- >0;){if((r=Ut(l,c,i))===s)return a[n]=l,a[o]=c,e(a);if(r>0)l=Math.floor(l/r)*r,c=Math.ceil(c/r)*r;else{if(!(r<0))break;l=Math.ceil(l*r)/r,c=Math.floor(c*r)/r}s=r}return t},t}function Gr(){var t=$r()(Mr,Mr);return t.copy=function(){return e=t,Gr().domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown());var e},Lr.apply(t,arguments),zr(t)}function Yr(t){return function(){return t}}function Xr(t){this._context=t}function Jr(t){return new Xr(t)}function Wr(t){return t[0]}function _r(t){return t[1]}function Kr(t,e){var i=Yr(!0),s=null,r=Jr,a=null,n=function(t){let e=3;return t.digits=function(i){if(!arguments.length)return e;if(null==i)e=null;else{const t=Math.floor(i);if(!(t>=0))throw new RangeError(`invalid digits: ${i}`);e=t}return t},()=>new ur(e)}(o);function o(o){var l,c,d,u=(o=function(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}(o)).length,h=!1;for(null==s&&(a=r(d=n())),l=0;l<=u;++l)!(l<u&&i(c=o[l],l,o))===h&&((h=!h)?a.lineStart():a.lineEnd()),h&&a.point(+t(c,l,o),+e(c,l,o));if(d)return a=null,d+""||null}return t="function"==typeof t?t:void 0===t?Wr:Yr(t),e="function"==typeof e?e:void 0===e?_r:Yr(e),o.x=function(e){return arguments.length?(t="function"==typeof e?e:Yr(+e),o):t},o.y=function(t){return arguments.length?(e="function"==typeof t?t:Yr(+t),o):e},o.defined=function(t){return arguments.length?(i="function"==typeof t?t:Yr(!!t),o):i},o.curve=function(t){return arguments.length?(r=t,null!=s&&(a=r(s)),o):r},o.context=function(t){return arguments.length?(null==t?s=a=null:a=r(s=t),o):s},o}function Pr(t,e,i){this.k=t,this.x=e,this.y=i}Xr.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e)}}},Pr.prototype={constructor:Pr,scale:function(t){return 1===t?this:new Pr(this.k*t,this.x,this.y)},translate:function(t,e){return 0===t&0===e?this:new Pr(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}},Pr.prototype;class Zr extends ct{getComputedStyleValue(t){return getComputedStyle(this).getPropertyValue(t).trim()}firstUpdated(t){super.firstUpdated(t),_e(this.renderRoot.host).classed("keyboard",!0).on("mousemove.keyboard touchstart.keyboard",t=>{_e(t.currentTarget.renderRoot.host).classed("keyboard",!1).on("mousemove.keyboard touchstart.keyboard",null)}).on("keydown.keyboard",t=>{_e(t.currentTarget.renderRoot.host).classed("keyboard",!0).on("keydown.keyboard mousemove.keyboard touchstart.keyboard",null)})}static get greys(){const t="#999999",e={white:"#ffffff"};return e.light75=Wi(t,"#ffffff")(.75),e.light50=Wi(t,"#ffffff")(.5),e.light25=Wi(t,"#ffffff")(.25),e.grey=t,e.dark25=Wi(t,"#000000")(.25),e.dark50=Wi(t,"#000000")(.5),e.dark75=Wi(t,"#000000")(.75),e.black="#000000",e}static get shadows(){return{elevations:[0,2,4,8,16],baselineColor:"#000000",baselineColorString:"0, 0, 0",inverseBaselineColor:"#FFFFFF",inverseBaselineColorString:"255, 255, 255",opacityUmbra:.2,opacityPenumbra:.14,opacityAmbient:.12,opacityBoost:.2,mapUmbra:{0:{x:0,y:0,b:0,s:0},2:{x:0,y:3,b:1,s:-2},4:{x:0,y:2,b:4,s:-1},8:{x:0,y:5,b:5,s:-3},16:{x:0,y:8,b:10,s:-5}},mapPenumbra:{0:{x:0,y:0,b:0,s:0},2:{x:0,y:2,b:2,s:0},4:{x:0,y:4,b:5,s:0},8:{x:0,y:8,b:10,s:1},16:{x:0,y:16,b:24,s:2}},mapAmbient:{0:{x:0,y:0,b:0,s:0},2:{x:0,y:1,b:5,s:0},4:{x:0,y:1,b:10,s:0},8:{x:0,y:3,b:14,s:2},16:{x:0,y:6,b:30,s:5}}}}static cssBoxShadow(t,e=!1,i=!1){const s=this.shadows.opacityUmbra+this.shadows.opacityBoost,r=this.shadows.opacityPenumbra+this.shadows.opacityBoost,a=this.shadows.opacityAmbient+this.shadows.opacityBoost,n=i?`rgba(${this.shadows.inverseBaselineColorString}, ${s})`:`rgba(${this.shadows.baselineColorString}, ${s})`,o=i?`rgba(${this.shadows.inverseBaselineColorString}, ${r})`:`rgba(${this.shadows.baselineColorString}, ${r})`,l=i?`rgba(${this.shadows.inverseBaselineColorString}, ${a})`:`rgba(${this.shadows.baselineColorString}, ${a})`,c=this.shadows.mapUmbra[t],d=this.shadows.mapPenumbra[t],u=this.shadows.mapAmbient[t];return`${e?`${-c.y}px ${c.y/2}px ${c.b}px ${c.s}px`:`${c.y/2}px ${c.y}px ${c.b}px ${c.s}px`} ${n}, ${e?`${-d.y}px ${d.y/2}px ${d.b}px ${d.s}px`:`${d.y/2}px ${d.y}px ${d.b}px ${d.s}px`} ${o}, ${e?`${-u.y}px ${u.y/2}px ${u.b}px ${u.s}px`:`${u.y/2}px ${u.y}px ${u.b}px ${u.s}px`} ${l}`}static get svgDefs(){const t=Zr.shadows,e=t.elevations.map(e=>`\n <filter id=shadow-${e} filterUnits="userSpaceOnUse" x="-100%" y="-100%" width="200%" height="200%">\n <feComponentTransfer in="SourceAlpha" result="solid">\n <feFuncA type="table" tableValues="0 1 1"/>\n </feComponentTransfer>\n <feOffset in="solid" result="offU" dx=${t.mapUmbra[e].y/2} dy=${t.mapUmbra[e].y} />\n <feOffset in="solid" result="offP" dx=${t.mapPenumbra[e].y/2} dy=${t.mapPenumbra[e].y} />\n <feOffset in="solid" result="offA" dx=${t.mapAmbient[e].y/2} dy=${t.mapAmbient[e].y} />\n ${0===t.mapUmbra[e].s?"":`<feMorphology in="offU" result="spreadU" operator=${t.mapUmbra[e].s>0?"dilate":"erode"} radius=${Math.abs(t.mapUmbra[e].s)} />`}\n ${0===t.mapPenumbra[e].s?"":`<feMorphology in="offP" result="spreadP" operator=${t.mapPenumbra[e].s>0?"dilate":"erode"} radius=${Math.abs(t.mapPenumbra[e].s)} />`}\n ${0===t.mapAmbient[e].s?"":`<feMorphology in="offA" result="spreadA" operator=${t.mapAmbient[e].s>0?"dilate":"erode"} radius=${Math.abs(t.mapAmbient[e].s)} />`}\n <feGaussianBlur in=${0===t.mapUmbra[e].s?"offU":"spreadU"} result="blurU" stdDeviation=${t.mapUmbra[e].b/2} />\n <feGaussianBlur in=${0===t.mapPenumbra[e].s?"offP":"spreadP"} result="blurP" stdDeviation=${t.mapPenumbra[e].b/2} />\n <feGaussianBlur in=${0===t.mapAmbient[e].s?"offA":"spreadA"} result="blurA" stdDeviation=${t.mapAmbient[e].b/2} />\n <feFlood in="SourceGraphic" result="opU" flood-color=${t.baselineColor} flood-opacity=${t.opacityUmbra+t.opacityBoost} />\n <feFlood in="SourceGraphic" result="opP" flood-color=${t.baselineColor} flood-opacity=${t.opacityPenumbra+t.opacityBoost} />\n <feFlood in="SourceGraphic" result="opA" flood-color=${t.baselineColor} flood-opacity=${t.opacityAmbient+t.opacityBoost} />\n <feComposite in="opU" in2="blurU" result="shU" operator="in" />\n <feComposite in="opP" in2="blurP" result="shP" operator="in" />\n <feComposite in="opA" in2="blurA" result="shA" operator="in" />\n <feMorphology in="solid" result="smaller" operator="erode" radius="1" />\n <feComposite in="shU" in2="smaller" result="finalU" operator="out" />\n <feComposite in="shP" in2="smaller" result="finalP" operator="out" />\n <feComposite in="shA" in2="smaller" result="finalA" operator="out" />\n <feMerge>\n <feMergeNode in="finalU" />\n <feMergeNode in="finalP" />\n <feMergeNode in="finalA" />\n <feMergeNode in="SourceGraphic" />\n </feMerge>\n </filter>`);return`\n <defs>\n ${e}\n </defs>\n `}static get svgFilters(){const t=Zr.shadows,e=t.elevations.map(e=>J`
23
23
  <filter id=${`shadow-${e}`} x="-250%" y="-250%" width="600%" height="600%">
24
24
  <feComponentTransfer in="SourceAlpha" result="solid">
25
25
  <feFuncA type="table" tableValues="0 1 1"/>
@@ -113,7 +113,7 @@ const C=globalThis,v=C.trustedTypes,A=v?v.createPolicy("lit-html",{createHTML:t=
113
113
  width: 0;
114
114
  height: 0;
115
115
  }
116
- `}}customElements.define("decidables-button",class extends Pr{static get properties(){return{disabled:{attribute:"disabled",type:Boolean,reflect:!0}}}constructor(){super(),this.disabled=!1}static get styles(){return[super.styles,o`
116
+ `}}customElements.define("decidables-button",class extends Zr{static get properties(){return{disabled:{attribute:"disabled",type:Boolean,reflect:!0}}}constructor(){super(),this.disabled=!1}static get styles(){return[super.styles,o`
117
117
  :host {
118
118
  ---decidables-button-background-color-disabled: var(--decidables-button-background-color, var(---color-element-disabled));
119
119
  ---decidables-button-background-color-enabled: var(--decidables-button-background-color, var(---color-element-enabled));
@@ -179,7 +179,7 @@ const C=globalThis,v=C.trustedTypes,A=v?v.createPolicy("lit-html",{createHTML:t=
179
179
  * Copyright 2018 Google LLC
180
180
  * SPDX-License-Identifier: BSD-3-Clause
181
181
  */
182
- const Or=t=>t??_;customElements.define("decidables-slider",class extends Pr{static get properties(){return{disabled:{attribute:"disabled",type:Boolean,reflect:!0},scale:{attribute:"scale",type:Boolean,reflect:!0},max:{attribute:"max",type:Number,reflect:!0},min:{attribute:"min",type:Number,reflect:!0},step:{attribute:"step",type:Number,reflect:!0},value:{attribute:"value",type:Number,reflect:!0},nonlinear:{attribute:!1,type:Boolean,reflect:!1}}}constructor(){super(),this.disabled=!1,this.scale=!1,this.max=void 0,this.min=void 0,this.step=void 0,this.value=void 0,this.nonlinear=!1,this.rangeMax=void 0,this.rangeMin=void 0,this.rangeStep=void 0,this.rangeValue=void 0,this.toRange=void 0,this.fromRange=void 0}nonlinearRange(t,e,i){this.nonlinear=t,this.toRange=t?e:void 0,this.fromRange=t?i:void 0}rangeChanged(t){this.value=this.nonlinear?this.fromRange(t.target.value):t.target.value,this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},bubbles:!0}))}rangeInputted(t){this.value=this.nonlinear?this.fromRange(t.target.value):t.target.value}spinnerInputted(t){this.value=t.target.value}willUpdate(){this.rangeMax=void 0===this.max?void 0:this.nonlinear?this.toRange(this.max):this.max,this.rangeMin=void 0===this.min?void 0:this.nonlinear?this.toRange(this.min):this.min,this.rangeStep=void 0===this.step?void 0:this.nonlinear?"any":this.step,this.rangeValue=void 0===this.value?void 0:this.nonlinear?this.toRange(this.value):this.value}static get styles(){return[super.styles,o`
182
+ const Or=t=>t??_;customElements.define("decidables-slider",class extends Zr{static get properties(){return{disabled:{attribute:"disabled",type:Boolean,reflect:!0},scale:{attribute:"scale",type:Boolean,reflect:!0},max:{attribute:"max",type:Number,reflect:!0},min:{attribute:"min",type:Number,reflect:!0},step:{attribute:"step",type:Number,reflect:!0},value:{attribute:"value",type:Number,reflect:!0},nonlinear:{attribute:!1,type:Boolean,reflect:!1}}}constructor(){super(),this.disabled=!1,this.scale=!1,this.max=void 0,this.min=void 0,this.step=void 0,this.value=void 0,this.nonlinear=!1,this.rangeMax=void 0,this.rangeMin=void 0,this.rangeStep=void 0,this.rangeValue=void 0,this.toRange=void 0,this.fromRange=void 0}nonlinearRange(t,e,i){this.nonlinear=t,this.toRange=t?e:void 0,this.fromRange=t?i:void 0}rangeChanged(t){this.value=this.nonlinear?this.fromRange(t.target.value):t.target.value,this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},bubbles:!0}))}rangeInputted(t){this.value=this.nonlinear?this.fromRange(t.target.value):t.target.value}spinnerInputted(t){this.value=t.target.value}willUpdate(){this.rangeMax=void 0===this.max?void 0:this.nonlinear?this.toRange(this.max):this.max,this.rangeMin=void 0===this.min?void 0:this.nonlinear?this.toRange(this.min):this.min,this.rangeStep=void 0===this.step?void 0:this.nonlinear?"any":this.step,this.rangeValue=void 0===this.value?void 0:this.nonlinear?this.toRange(this.value):this.value}static get styles(){return[super.styles,o`
183
183
  :host {
184
184
  ---decidables-slider-background-color: var(--decidables-slider-background-color, var(---color-element-disabled));
185
185
  ---decidables-slider-color: var(--decidables-slider-color, var(---color-element-enabled));
@@ -479,7 +479,7 @@ const Or=t=>t??_;customElements.define("decidables-slider",class extends Pr{stat
479
479
  `:X``}
480
480
  </div>
481
481
  <decidables-spinner ?disabled=${this.disabled} min=${Or(this.min)} max=${Or(this.max)} step=${Or(this.step)} .value=${this.value} @input=${this.spinnerInputted.bind(this)}></decidables-spinner>
482
- `}});customElements.define("decidables-spinner",class extends Pr{static get properties(){return{disabled:{attribute:"disabled",type:Boolean,reflect:!0},max:{attribute:"max",type:Number,reflect:!0},min:{attribute:"min",type:Number,reflect:!0},step:{attribute:"step",type:Number,reflect:!0},value:{attribute:"value",type:Number,reflect:!0}}}constructor(){super(),this.disabled=!1,this.max=void 0,this.min=void 0,this.step=void 0,this.value=void 0}inputted(t){this.value=t.target.value}static get styles(){return[super.styles,o`
482
+ `}});customElements.define("decidables-spinner",class extends Zr{static get properties(){return{disabled:{attribute:"disabled",type:Boolean,reflect:!0},max:{attribute:"max",type:Number,reflect:!0},min:{attribute:"min",type:Number,reflect:!0},step:{attribute:"step",type:Number,reflect:!0},value:{attribute:"value",type:Number,reflect:!0}}}constructor(){super(),this.disabled=!1,this.max=void 0,this.min=void 0,this.step=void 0,this.value=void 0}inputted(t){this.value=t.target.value}static get styles(){return[super.styles,o`
483
483
  :host {
484
484
  ---decidables-spinner-font-size: var(--decidables-spinner-font-size, 1.125rem);
485
485
  ---decidables-spinner-input-width: var(--decidables-spinner-input-width, 4rem);
@@ -578,7 +578,7 @@ const Or=t=>t??_;customElements.define("decidables-slider",class extends Pr{stat
578
578
  <slot></slot>
579
579
  <input ?disabled=${this.disabled} type="number" min=${Or(this.min)} max=${Or(this.max)} step=${Or(this.step)} .value=${this.value} @input=${this.inputted.bind(this)}>
580
580
  </label>
581
- `}});customElements.define("decidables-switch",class extends Pr{static get properties(){return{checked:{attribute:"checked",type:Boolean,reflect:!0},disabled:{attribute:"disabled",type:Boolean,reflect:!0}}}constructor(){super(),this.checked=!1,this.disabled=!1}changed(t){this.checked=t.target.checked,this.dispatchEvent(new CustomEvent("change",{detail:{checked:this.checked},bubbles:!0}))}static get styles(){return[super.styles,o`
581
+ `}});customElements.define("decidables-switch",class extends Zr{static get properties(){return{checked:{attribute:"checked",type:Boolean,reflect:!0},disabled:{attribute:"disabled",type:Boolean,reflect:!0}}}constructor(){super(),this.checked=!1,this.disabled=!1}changed(t){this.checked=t.target.checked,this.dispatchEvent(new CustomEvent("change",{detail:{checked:this.checked},bubbles:!0}))}static get styles(){return[super.styles,o`
582
582
  :host {
583
583
  display: flex;
584
584
 
@@ -705,7 +705,7 @@ const Or=t=>t??_;customElements.define("decidables-slider",class extends Pr{stat
705
705
  <label for="switch">
706
706
  <slot></slot>
707
707
  </label>
708
- `}});customElements.define("decidables-toggle",class extends Pr{static get properties(){return{disabled:{attribute:"disabled",type:Boolean,reflect:!0}}}constructor(){super(),this.disabled=!1}static get styles(){return[super.styles,o`
708
+ `}});customElements.define("decidables-toggle",class extends Zr{static get properties(){return{disabled:{attribute:"disabled",type:Boolean,reflect:!0}}}constructor(){super(),this.disabled=!1}static get styles(){return[super.styles,o`
709
709
  fieldset {
710
710
  display: flex;
711
711
 
@@ -727,7 +727,7 @@ const Or=t=>t??_;customElements.define("decidables-slider",class extends Pr{stat
727
727
  <legend><slot name="label"></slot></legend>
728
728
  <slot></slot>
729
729
  </fieldset>
730
- `}});function jr(t){return class extends t{static get properties(){return{width:{attribute:!1,type:Number,reflect:!1},height:{attribute:!1,type:Number,reflect:!1},rem:{attribute:!1,type:Number,reflect:!1}}}constructor(){super(),this.width=NaN,this.height=NaN,this.rem=NaN}getDimensions(){this.width=parseFloat(this.getComputedStyleValue("width"),10),this.height=parseFloat(this.getComputedStyleValue("height"),10),this.rem=parseFloat(getComputedStyle(document.documentElement).getPropertyValue("font-size"),10)}connectedCallback(){super.connectedCallback(),this.resizeObserver=new ResizeObserver(this.getDimensions.bind(this)),this.resizeObserver.observe(this)}disconnectedCallback(){this.resizeObserver.unobserve(this),super.disconnectedCallback()}}}customElements.define("decidables-toggle-option",class extends Pr{static get properties(){return{checked:{attribute:"checked",type:Boolean,reflect:!0},disabled:{attribute:"disabled",type:Boolean,reflect:!0},name:{attribute:"name",type:String,reflect:!0},value:{attribute:"value",type:String,reflect:!0}}}constructor(){super(),this.checked=!1,this.disabled=!1,this.name=void 0,this.value=void 0}changed(t){this.checked=t.target.checked,this.dispatchEvent(new CustomEvent("change",{detail:{checked:this.checked,value:this.value},bubbles:!0}))}static get styles(){return[super.styles,o`
730
+ `}});function jr(t){return class extends t{static get properties(){return{width:{attribute:!1,type:Number,reflect:!1},height:{attribute:!1,type:Number,reflect:!1},rem:{attribute:!1,type:Number,reflect:!1}}}constructor(){super(),this.width=NaN,this.height=NaN,this.rem=NaN}getDimensions(){this.width=parseFloat(this.getComputedStyleValue("width"),10),this.height=parseFloat(this.getComputedStyleValue("height"),10),this.rem=parseFloat(getComputedStyle(document.documentElement).getPropertyValue("font-size"),10)}connectedCallback(){super.connectedCallback(),this.resizeObserver=new ResizeObserver(this.getDimensions.bind(this)),this.resizeObserver.observe(this)}disconnectedCallback(){this.resizeObserver.unobserve(this),super.disconnectedCallback()}}}customElements.define("decidables-toggle-option",class extends Zr{static get properties(){return{checked:{attribute:"checked",type:Boolean,reflect:!0},disabled:{attribute:"disabled",type:Boolean,reflect:!0},name:{attribute:"name",type:String,reflect:!0},value:{attribute:"value",type:String,reflect:!0}}}constructor(){super(),this.checked=!1,this.disabled=!1,this.name=void 0,this.value=void 0}changed(t){this.checked=t.target.checked,this.dispatchEvent(new CustomEvent("change",{detail:{checked:this.checked,value:this.value},bubbles:!0}))}static get styles(){return[super.styles,o`
731
731
  :host {
732
732
  display: flex;
733
733
  }
@@ -824,7 +824,7 @@ const Or=t=>t??_;customElements.define("decidables-slider",class extends Pr{stat
824
824
  <label for="toggle-option">
825
825
  <slot></slot>
826
826
  </label>
827
- `}});var qr={a:"#e41a1c",z:"#377eb8",v:"#ff7f00",t0:"#f781bf",s:"#999999",left:"#f032e6",right:"#10dbc9",correct:"#4daf4a",error:"#984ea3",nr:"#cccccc"};class ta extends Pr{static get properties(){return{interactive:{attribute:"interactive",type:Boolean,reflect:!0}}}constructor(){super(),this.interactive=!1}static get colors(){return qr}static get lights(){return Object.keys(ta.colors).reduce((t,e)=>(t[e]=Wi(ta.colors[e],"#ffffff")(.5),t),{})}static get darks(){return Object.keys(ta.colors).reduce((t,e)=>(t[e]=Wi(ta.colors[e],"#000000")(.5),t),{})}static get styles(){return[super.styles,o`
827
+ `}});var qr={a:"#e41a1c",z:"#377eb8",v:"#ff7f00",t0:"#f781bf",s:"#999999",left:"#f032e6",right:"#10dbc9",correct:"#4daf4a",error:"#984ea3",nr:"#cccccc"};class ta extends Zr{static get properties(){return{interactive:{attribute:"interactive",type:Boolean,reflect:!0}}}constructor(){super(),this.interactive=!1}static get colors(){return qr}static get lights(){return Object.keys(ta.colors).reduce((t,e)=>(t[e]=Wi(ta.colors[e],"#ffffff")(.5),t),{})}static get darks(){return Object.keys(ta.colors).reduce((t,e)=>(t[e]=Wi(ta.colors[e],"#000000")(.5),t),{})}static get styles(){return[super.styles,o`
828
828
  :host {
829
829
  /* Declare base colors */
830
830
  ${n(Object.keys(ta.colors).map(t=>`---color-${t}: var(--color-${t}, ${this.colors[t]});`).join("\n"))}
@@ -1591,8 +1591,13 @@ const Or=t=>t??_;customElements.define("decidables-slider",class extends Pr{stat
1591
1591
  }
1592
1592
  }
1593
1593
 
1594
- .measure {
1595
- stroke-width: 2;
1594
+ .measure .line.short {
1595
+ stroke-width: 0;
1596
+ }
1597
+
1598
+ .measure .markers {
1599
+ fill: none;
1600
+ stroke-width: 0;
1596
1601
  }
1597
1602
 
1598
1603
  .measure .label {
@@ -1610,12 +1615,6 @@ const Or=t=>t??_;customElements.define("decidables-slider",class extends Pr{stat
1610
1615
  text-anchor: end;
1611
1616
  }
1612
1617
 
1613
- /* Hack to avoid lack of context-stroke and context-fill in Safari */
1614
- .measure-arrow.a {
1615
- fill: var(---color-a);
1616
- stroke: var(---color-a);
1617
- }
1618
-
1619
1618
  .measure.z .line {
1620
1619
  stroke: var(---color-z);
1621
1620
  }
@@ -1627,12 +1626,6 @@ const Or=t=>t??_;customElements.define("decidables-slider",class extends Pr{stat
1627
1626
  text-anchor: start;
1628
1627
  }
1629
1628
 
1630
- /* Hack to avoid lack of context-stroke and context-fill in Safari */
1631
- .measure-arrow.z {
1632
- fill: var(---color-z);
1633
- stroke: var(---color-z);
1634
- }
1635
-
1636
1629
  .measure.v .line {
1637
1630
  stroke: var(---color-v);
1638
1631
  }
@@ -1642,12 +1635,6 @@ const Or=t=>t??_;customElements.define("decidables-slider",class extends Pr{stat
1642
1635
  text-anchor: start;
1643
1636
  }
1644
1637
 
1645
- /* Hack to avoid lack of context-stroke and context-fill in Safari */
1646
- .measure-arrow.v {
1647
- fill: var(---color-v);
1648
- stroke: var(---color-v);
1649
- }
1650
-
1651
1638
  .measure.t0 .line {
1652
1639
  stroke: var(---color-t0);
1653
1640
  }
@@ -1657,6 +1644,37 @@ const Or=t=>t??_;customElements.define("decidables-slider",class extends Pr{stat
1657
1644
  text-anchor: middle;
1658
1645
  }
1659
1646
 
1647
+ .measure-arrow {
1648
+ fill: context-stroke;
1649
+ stroke: context-stroke;
1650
+ }
1651
+
1652
+ .measure-arrow .arrow {
1653
+ stroke-width: 1;
1654
+ }
1655
+
1656
+ .measure-arrow.capped .cap {
1657
+ stroke-width: 2;
1658
+ }
1659
+
1660
+ /* Hack to avoid lack of context-stroke and context-fill in Safari */
1661
+ .measure-arrow.a {
1662
+ fill: var(---color-a);
1663
+ stroke: var(---color-a);
1664
+ }
1665
+
1666
+ /* Hack to avoid lack of context-stroke and context-fill in Safari */
1667
+ .measure-arrow.z {
1668
+ fill: var(---color-z);
1669
+ stroke: var(---color-z);
1670
+ }
1671
+
1672
+ /* Hack to avoid lack of context-stroke and context-fill in Safari */
1673
+ .measure-arrow.v {
1674
+ fill: var(---color-v);
1675
+ stroke: var(---color-v);
1676
+ }
1677
+
1660
1678
  /* Hack to avoid lack of context-stroke and context-fill in Safari */
1661
1679
  .measure-arrow.t0 {
1662
1680
  fill: var(---color-t0);
@@ -1722,7 +1740,7 @@ const Or=t=>t??_;customElements.define("decidables-slider",class extends Pr{stat
1722
1740
  .rt-label.error text {
1723
1741
  dominant-baseline: hanging;
1724
1742
  }
1725
- `]}render(){return X``}willUpdate(){this.alignState()}update(t){if(super.update(t),Number.isNaN(this.width)||Number.isNaN(this.height)||Number.isNaN(this.rem))return;const e=this.width,i=this.height;let s,r;e/i>1.5?(r=i,s=1.5*r):(s=e,r=s/1.5);const a=1*this.rem,n=3*this.rem,o=3.75*this.rem,l=3.25*this.rem,c=r-(a+n),d=s-(o+l),u=.75*this.rem,h=.5*c,g=.25*c-u,p=.75*this.rem,m=.9*d,b=.1*d-p,y=parseInt(this.getComputedStyleValue("---transition-duration"),10),Q=Gr().domain([this.scale.time.min,this.scale.time.max]).range([0,m]),B=Gr().domain([this.scale.evidence.min,this.scale.evidence.max]).range([h,0]),U=Gr().domain([this.scale.density.min,this.scale.density.max]).range([g,0]),F=Gr().domain([this.scale.density.min,this.scale.density.max]).range([0,g]),I=Gr().domain([0,1]).range([0,c]),f=li().subject((t,e)=>({x:Q(e.t0),y:B(e.startingPoint)})).on("start",t=>{_e(t.currentTarget).classed("dragging",!0)}).on("drag",t=>{this.drag=!0;const e=!!t.sourceEvent.shiftKey&&(Math.abs(t.x-t.subject.x)>Math.abs(t.y-t.subject.y)?"t0":"z");let i=Q.invert(t.x),s=(B.invert(t.y)+this.a/2)/this.a;i="z"===e?Q.invert(t.subject.x):i<ia.t0.MIN?ia.t0.MIN:i>ia.t0.MAX?ia.t0.MAX:i,s="t0"===e?(B.invert(t.subject.y)+this.a/2)/this.a:s<ia.z.MIN?ia.z.MIN:s>ia.z.MAX?ia.z.MAX:s,this.t0=i,this.z=s,this.alignState(),this.dispatchEvent(new CustomEvent("ddm-model-t0",{detail:{t0:this.t0},bubbles:!0})),this.dispatchEvent(new CustomEvent("ddm-model-z",{detail:{z:this.z},bubbles:!0}))}).on("end",t=>{_e(t.currentTarget).classed("dragging",!1),this.drag=!1}),C=li().on("start",t=>{_e(t.currentTarget).classed("dragging",!0)}).on("drag",t=>{this.drag=!0;let e=(B.invert(t.y)-this.startingPoint)/(Q.invert(t.x)-this.t0)*1e3;e=e<ia.v.MIN?ia.v.MIN:e>ia.v.MAX?ia.v.MAX:e,this.v=e,this.alignState(),this.dispatchEvent(new CustomEvent("ddm-model-v",{detail:{v:this.v},bubbles:!0}))}).on("end",t=>{_e(t.currentTarget).classed("dragging",!1),this.drag=!1}),v=li().subject((t,e)=>({x:0,y:B(e.value)})).on("start",t=>{_e(t.currentTarget).classed("dragging",!0)}).on("drag",t=>{this.drag=!0;const e=B.invert(t.y);let i=Math.abs(2*e);i=i<ia.a.MIN?ia.a.MIN:i>ia.a.MAX?ia.a.MAX:i,this.a=i,this.alignState(),this.dispatchEvent(new CustomEvent("ddm-model-a",{detail:{a:this.a},bubbles:!0}))}).on("end",t=>{_e(t.currentTarget).classed("dragging",!1),this.drag=!1}),A=Kr().x(t=>Q(t.t)).y(t=>B(t.e)),x=Kr().x(t=>Q(t.t)).y(t=>U(t.d)),E=Kr().x(t=>Q(t.t)).y(t=>F(t.d)),R=_e(this.renderRoot).selectAll(".main").data([{width:this.width,height:this.height,rem:this.rem}]),S=R.enter().append("svg").classed("main",!0).html(ta.svgDefs),N=S.append("defs"),L=t=>{N.append("marker").attr("id",`measure-arrow-${t}`).attr("class",`measure-arrow ${t}`).attr("orient","auto-start-reverse").attr("markerUnits","userSpaceOnUse").attr("viewBox","-5 -5 10 10").attr("refX","2").attr("refY","0").attr("markerWidth","10").attr("markerHeight","10").append("path").attr("stroke","context-stroke").attr("fill","context-stroke").attr("d","M -3 -3 l 6 3 l -6 3 z")},w=t=>{const e=N.append("marker").attr("id",`measure-arrow-cap-${t}`).attr("class",`measure-arrow cap ${t}`).attr("orient","auto-start-reverse").attr("markerUnits","userSpaceOnUse").attr("viewBox","-5 -5 10 10").attr("refX","2").attr("refY","0").attr("markerWidth","10").attr("markerHeight","10");e.append("path").attr("stroke","context-stroke").attr("fill","context-stroke").attr("d","M -3 -3 l 6 3 l -6 3 z"),e.append("path").attr("stroke","context-stroke").attr("fill","context-stroke").attr("stroke-width","2").attr("d","M 4 -4 l 0 8")};L("a"),L("z"),w("v"),L("t0"),w("t0");const D=t=>{N.append("marker").attr("id",`model-sd-cap-${t}`).attr("class",`model-sd cap ${t}`).attr("orient","auto-start-reverse").attr("markerUnits","userSpaceOnUse").attr("viewBox","-5 -5 10 10").attr("refX","0").attr("refY","0").attr("markerWidth","10").attr("markerHeight","10").append("path").attr("stroke","context-stroke").attr("fill","context-stroke").attr("stroke-width","2").attr("d","M 0 -4 l 0 8"),N.append("marker").attr("id",`data-sd-cap-${t}`).attr("class",`data-sd cap ${t}`).attr("orient","auto-start-reverse").attr("markerUnits","userSpaceOnUse").attr("viewBox","-5 -5 10 10").attr("refX","0").attr("refY","0").attr("markerWidth","10").attr("markerHeight","10").append("path").attr("stroke","context-stroke").attr("fill","context-stroke").attr("stroke-width","2").attr("d","M 0 -3 l 0 6")};D("error"),D("correct");const M=N.append("linearGradient").attr("id","path-animate").attr("gradientUnits","userSpaceOnUse").attr("color-interpolation","linearRGB").attr("x1","0").attr("x2","0").attr("y1",B(this.bounds.upper)).attr("y2",B(this.bounds.lower));M.append("stop").classed("stop-0",!0).attr("offset","0%"),M.append("stop").classed("stop-100",!0).attr("offset","100%");const k=S.merge(R).attr("viewBox",`0 0 ${s} ${r}`),T=k.selectAll(".plot.density").data([{outcome:"correct",data:{meanRT:this.data.correctMeanRT,sdRT:this.data.correctSDRT},model:{meanRT:this.model.correctMeanRT,sdRT:this.model.correctSDRT,dist:this.model.correctDist},densityScale:U,densityLine:x,alignDistribution:this.alignCorrectDistribution.bind(this)},{outcome:"error",data:{meanRT:this.data.errorMeanRT,sdRT:this.data.errorSDRT},model:{meanRT:this.model.errorMeanRT,sdRT:this.model.errorSDRT,dist:this.model.errorDist},densityScale:F,densityLine:E,alignDistribution:this.alignErrorDistribution.bind(this)}]),V=S.append("g").classed("plot evidence",!0),$=T.enter().append("g").attr("class",t=>`plot density ${t.outcome}`),H=S.append("g").classed("plot accuracy",!0),z=k.select(".plot.evidence").attr("transform",`translate(${o}, ${a+g+u})`),G=$.merge(T).attr("transform",t=>`translate(${o}, ${"correct"===t.outcome?a:a+g+h+2*u})`),Y=k.select(".plot.accuracy").attr("transform",`translate(${o+m+p}, ${a})`);V.append("clipPath").attr("id","clip-evidence").append("rect"),z.select("clipPath rect").attr("y",B(this.bounds.upper)).attr("height",B(this.bounds.lower)-B(this.bounds.upper)+1).attr("width",m+1);const X=V.append("g").classed("underlayer",!0),J=$.append("g").classed("underlayer",!0),W=H.append("g").classed("underlayer",!0),_=z.select(".underlayer"),K=G.select(".underlayer"),Z=Y.select(".underlayer");V.append("g").classed("content",!0).append("g").classed("paths",!0);const P=$.append("g").classed("content",!0);H.append("g").classed("content",!0);const O=z.select(".content"),j=G.select(".content"),q=Y.select(".content");V.append("g").classed("overlayer",!0),$.append("g").classed("overlayer",!0),H.append("g").classed("overlayer",!0);const tt=z.select(".overlayer"),et=G.select(".overlayer");X.append("rect").classed("background",!0),J.append("rect").classed("background",!0),_.select(".background").transition().duration(this.drag?0:y).ease(sr).attr("y",B(this.bounds.upper)).attr("height",B(this.bounds.lower)-B(this.bounds.upper)).attr("width",m),K.select(".background").transition().duration(y).ease(sr).attr("height",g).attr("width",m),J.filter(t=>"error"===t.outcome).append("g").classed("axis time",!0);const it=K.filter(t=>"error"===t.outcome).select(".axis.time").attr("transform",`translate(0, ${g+.25*this.rem})`);var st;it.transition().duration(y).ease(sr).call((st=Q,Et(3,st))).attr("font-size",null).attr("font-family",null).selectAll("line, path").attr("stroke",null);const rt=J.filter(t=>"error"===t.outcome).append("text").classed("title time",!0).attr("text-anchor","middle");rt.append("tspan").classed("name",!0).text("Time (ms)"),K.filter(t=>"error"===t.outcome).select(".title.time").transition().duration(y).ease(sr).attr("transform",`translate(${m/2}, ${g+2.5*this.rem})`),X.append("g").classed("axis evidence",!0),J.append("g").attr("class",t=>`axis density ${t.outcome}`),W.append("g").classed("axis accuracy",!0);const at=_.select(".axis.evidence").attr("transform",`translate(${-.25*this.rem}, 0)`),nt=K.select(".axis.density").attr("transform",`translate(${-.25*this.rem}, 0)`),ot=Z.select(".axis.accuracy").attr("transform",`translate(${b+.25*this.rem}, 0)`),lt=at.transition().duration(y).ease(sr).call(Rt(B)).attr("font-size",null).attr("font-family",null),ct=nt.transition().duration(y).ease(sr).each((t,e,i)=>{Rt(t.densityScale).ticks(2)(_e(i[e]))}).attr("font-size",null).attr("font-family",null),dt=ot.transition().duration(y).ease(sr).call(function(t){return Et(2,t)}(I)).attr("font-size",null).attr("font-family",null);lt.selectAll("line, path").attr("stroke",null),ct.selectAll("line, path").attr("stroke",null),dt.selectAll("line, path").attr("stroke",null);const ut=X.append("text").classed("title evidence",!0).attr("text-anchor","middle"),ht=J.append("text").attr("class",t=>`title density ${t.outcome}`).attr("text-anchor","middle"),gt=W.append("text").classed("title accuracy",!0).attr("text-anchor","middle");ut.append("tspan").classed("name",!0).text("Evidence"),ht.append("tspan").classed("name",!0).text("Density"),gt.append("tspan").classed("name",!0).text("Accuracy"),_.select(".title.evidence").transition().duration(y).ease(sr).attr("transform",`translate(${-2.5*this.rem}, ${h/2})rotate(-90)`),K.select(".title.density").transition().duration(y).ease(sr).attr("transform",`translate(${-2.5*this.rem}, ${g/2})rotate(-90)`),Z.select(".title.accuracy").transition().duration(y).ease(sr).attr("transform",`translate(${b+2.25*this.rem}, ${c/2})rotate(90)`);const pt=O.select(".paths").selectAll(".path").data(this.data.trials.filter(t=>void 0!==t.path)),mt=Ze(),bt=pt.enter().append("g").classed("path",!0).attr("data-new-trial-ease-time",0).on("pointerenter",(t,e)=>{if(!this.drag){_e(t.currentTarget).classed("highlight",!0).raise();const i=tt.append("g").classed(`rt-label ${e.outcome}`,!0),s=i.append("rect"),r=i.append("text").text(`RT = ${e.rt.toFixed()}`).attr("x",Q(e.rt)).attr("y","correct"===e.outcome?B(this.bounds.upper)-.25*this.rem:B(this.bounds.lower)+.125*this.rem).node().getBBox();s.attr("x",r.x-.125*this.rem).attr("y",r.y+.125*this.rem).attr("width",r.width+.25*this.rem).attr("height",r.height-.25*this.rem),mt.set(t.currentTarget,i)}}).on("pointerout",(t,e)=>{this.drag||(_e(t.currentTarget).classed("highlight",!1).lower(),t.currentTarget.parentNode.insertBefore(t.currentTarget,t.currentTarget.parentNode.children[e.index]),mt.get(t.currentTarget).remove())});bt.append("path").classed("curve",!0).attr("clip-path","url(#clip-evidence)").attr("pathLength",1).attr("stroke-dashoffset",1);const yt=bt.merge(pt).attr("class",t=>`path ${t.outcome}`);yt.select(".curve").transition().duration(this.drag?0:y).ease(sr).attr("stroke",t=>this.getComputedStyleValue(`---color-${t.outcome}`)).attrTween("d",(t,e,i)=>{const s=i[e],r=es(void 0!==s.a?s.a:this.a,this.a),a=es(void 0!==s.z?s.z:this.z,this.z),n=es(void 0!==s.v?s.v:this.v,this.v),o=es(void 0!==s.t0?s.t0:this.t0,this.t0);return e=>{s.a=r(e),s.z=a(e),s.v=n(e),s.t0=o(e);const i=this.alignPath(t.seed,s.a,s.z,s.v,s.t0);return A(i)}});const Qt=yt.filter(t=>t.animate&&!this.paused);if(!Qt.empty()){const t=Qt.attr("data-new-trial-ease-time"),e=e=>Gr().domain([0,1]).range([t,1])(e),i=e=>i=>Gr().domain([e(t),1]).range([0,1])(e(i));Qt.classed("animate",!0).select(".curve").attr("stroke-dasharray",1),Qt.transition("new").duration(e=>Math.floor(1.5*e.rt*(1-t))).ease(e).attr("data-new-trial-ease-time",1).select(".curve").attrTween("stroke-dashoffset",(t,e,s)=>{const r=es(s[e].getAttribute("stroke-dashoffset"),0);return t=>r(i(ir)(t))}).on("end",(t,e,i)=>{_e(i[e].parentElement).classed("animate",!1).attr("data-new-trial-ease-time",null),t.animate=!1,this.animate=!1,this.alignState(),this.requestUpdate(),this.dispatchEvent(new CustomEvent("accumulable-response",{detail:{outcome:t.outcome,data:this.data,model:this.model},bubbles:!0}))})}const Bt=yt.filter(t=>t.animate&&this.paused);if(!Bt.empty()){const t=Bt.attr("data-new-trial-ease-time");Bt.classed("animate",!0).select(".curve").attr("stroke-dasharray",1).attr("stroke-dashoffset",()=>es(1,0)(ir(t)))}yt.filter(t=>!t.animate).attr("data-new-trial-ease-time",null),pt.exit().remove();const Ut=P.append("g").attr("class",t=>`dist ${t.outcome}`);Ut.append("path").classed("curve",!0),j.select(".dist").select(".curve").transition().duration(this.drag?0:y).ease(sr).attrTween("d",(t,e,i)=>{const s=i[e],r=es(void 0!==s.a?s.a:this.a,this.a),a=es(void 0!==s.z?s.z:this.z,this.z),n=es(void 0!==s.v?s.v:this.v,this.v),o=es(void 0!==s.t0?s.t0:this.t0,this.t0);return e=>{s.a=r(e),s.z=a(e),s.v=n(e),s.t0=o(e);const i=t.alignDistribution(s.a,s.z,s.v,s.t0);return t.densityLine(i)}});const Ft=O.selectAll(".rt").data(this.data.trials),It=Ft.enter().append("g");It.append("line").classed("mark",!0).attr("x1",t=>Q(t.rt)).attr("x2",t=>Q(t.rt)).attr("y1",t=>"correct"===t.outcome?B(1)-.125*this.rem:B(-1)+.125*this.rem).attr("y2",t=>"correct"===t.outcome?B(1)-.675*this.rem:B(-1)+.675*this.rem);const ft=It.merge(Ft).attr("class",t=>`rt ${t.outcome}`);ft.filter(t=>!t.animate).select(".mark").transition().duration(this.drag?0:y).ease(sr).attr("stroke",t=>this.getComputedStyleValue(`---color-${t.outcome}`)).attr("x1",t=>Q(t.rt)).attr("x2",t=>Q(t.rt)).attr("y1",t=>"correct"===t.outcome?B(1)-.125*this.rem:B(-1)+.125*this.rem).attr("y2",t=>"correct"===t.outcome?B(1)-.675*this.rem:B(-1)+.675*this.rem),Ft.exit().remove();const Ct=q.selectAll(".accuracy.model").data([this.model.accuracy,1-this.model.accuracy]),vt=Ct.enter().append("g").attr("class",(t,e)=>"accuracy model "+(0===e?"correct":"error"));vt.append("rect").classed("bar",!0).attr("x",0),vt.merge(Ct).select("rect").transition().duration(this.drag?0:y).ease(sr).attr("y",(t,e)=>I(0===e?0:1-t)).attr("width",b).attr("height",t=>I(t)),Ct.exit().remove();const At=q.selectAll(".accuracy.data").data(Number.isNaN(this.data.accuracy)?[]:[this.data.accuracy]),xt=At.enter().append("g").classed("accuracy data",!0);xt.append("line").classed("mark",!0);const St=xt.merge(At).attr("class",t=>"accuracy data "+(t<this.model.accuracy.correct?"correct":"error"));St.select(".mark").transition().duration(this.drag?0:y).ease(sr).attr("x1",0+.25*this.rem).attr("x2",b-.25*this.rem).attr("y1",t=>I(t)-1).attr("y2",t=>I(t)-1),At.exit().remove();const Nt=tt.selectAll(".boundary").data([{bound:"upper",value:this.bounds.upper},{bound:"lower",value:this.bounds.lower}]),Lt=Nt.enter().append("g").attr("class",(t,e)=>"boundary "+(0===e?"correct":"error"));Lt.append("line").classed("line",!0),Lt.append("line").classed("line touch",!0);const wt=Lt.merge(Nt).attr("tabindex",this.interactive?0:null).classed("interactive",this.interactive).on("keydown",this.interactive?(t,e)=>{if(["ArrowUp","ArrowDown"].includes(t.key)){let{a:i}=this;switch(t.key){case"ArrowUp":i+="upper"===e.bound?t.shiftKey?ia.a.STEP:ia.a.JUMP:t.shiftKey?-.01:-.1;break;case"ArrowDown":i+="upper"===e.bound?t.shiftKey?-.01:-.1:t.shiftKey?ia.a.STEP:ia.a.JUMP}i=i<ia.a.MIN?ia.a.MIN:i>ia.a.MAX?ia.a.MAX:i,this.a=i,this.alignState(),this.dispatchEvent(new CustomEvent("ddm-model-a",{detail:{a:this.a},bubbles:!0})),t.preventDefault()}}:null);(this.firstUpdate||t.has("interactive"))&&(this.interactive?wt.call(v):wt.on(".drag",null)),wt.select(".line").transition().duration(this.drag?0:y).ease(sr).attr("x1",Q(this.scale.time.min)).attr("x2",Q(this.scale.time.max)).attr("y1",t=>B(t.value)).attr("y2",t=>B(t.value)),wt.select(".line.touch").transition().duration(this.drag?0:y).ease(sr).attr("x1",Q(this.scale.time.min)).attr("x2",Q(this.scale.time.max)).attr("y1",t=>B(t.value)).attr("y2",t=>B(t.value)),Nt.exit().remove();const Dt=tt.selectAll(".drift").data([{v:this.v,t0:this.t0,startingPoint:this.startingPoint}]),Mt=Dt.enter().append("g").classed("drift",!0);Mt.append("line").classed("line",!0),Mt.append("line").classed("line touch",!0),Mt.append("path").classed("arrow",!0),Mt.append("path").classed("arrow touch",!0);const kt=Mt.merge(Dt).attr("tabindex",this.interactive?0:null).classed("interactive",this.interactive).on("keydown",this.interactive?t=>{if(["ArrowUp","ArrowDown"].includes(t.key)){let{v:e}=this;switch(t.key){case"ArrowUp":e+=t.shiftKey?ia.v.STEP:ia.v.JUMP;break;case"ArrowDown":e-=t.shiftKey?ia.v.STEP:ia.v.JUMP}e=e<ia.v.MIN?ia.v.MIN:e>ia.v.MAX?ia.v.MAX:e,this.v=e,this.alignState(),this.dispatchEvent(new CustomEvent("ddm-model-v",{detail:{v:this.v},bubbles:!0})),t.preventDefault()}}:null);(this.firstUpdate||t.has("interactive"))&&(this.interactive?kt.call(C):kt.on(".drag",null));const Tt=(B(0)-B(1))/(Q(1)-Q(0));kt.transition().duration(this.drag?0:y).ease(sr).attr("transform",t=>`translate(${Q(t.t0)}, ${B(t.startingPoint)})\n rotate(${-Math.atan(t.v/1e3*Tt)*(180/Math.PI)})`),kt.select(".line").attr("x2",Q(200)),kt.select(".line.touch").attr("x2",Q(200)),kt.select(".arrow").attr("d",`\n M ${Q(200)-.5*this.rem},${.5*-this.rem}\n l ${.5*this.rem},${.5*this.rem}\n l ${.5*-this.rem},${.5*this.rem}\n `),kt.select(".arrow.touch").attr("d",`\n M ${Q(200)-.5*this.rem},${.5*-this.rem}\n l ${.5*this.rem},${.5*this.rem}\n l ${.5*-this.rem},${.5*this.rem}\n `),Dt.exit().remove();const Vt=tt.selectAll(".t0z").data([{t0:this.t0,startingPoint:this.startingPoint}]),$t=Vt.enter().append("g").classed("t0z",!0);$t.append("line").classed("line",!0),$t.append("line").classed("line touch",!0),$t.append("circle").classed("point touch",!0);const Ht=$t.merge(Vt).attr("tabindex",this.interactive?0:null).classed("interactive",this.interactive).on("keydown",this.interactive?t=>{if(["ArrowUp","ArrowDown"].includes(t.key)){let{z:e}=this;switch(t.key){case"ArrowUp":e+=t.shiftKey?ia.z.STEP:ia.z.JUMP;break;case"ArrowDown":e-=t.shiftKey?ia.z.STEP:ia.z.JUMP}e=e<ia.z.MIN?ia.z.MIN:e>ia.z.MAX?ia.z.MAX:e,this.z=e,this.alignState(),this.dispatchEvent(new CustomEvent("ddm-model-z",{detail:{z:this.z},bubbles:!0})),t.preventDefault()}if(["ArrowLeft","ArrowRight"].includes(t.key)){let e=this.t0;switch(t.key){case"ArrowRight":e+=t.shiftKey?ia.t0.STEP:ia.t0.JUMP;break;case"ArrowLeft":e-=t.shiftKey?ia.t0.STEP:ia.t0.JUMP}e=e<ia.t0.MIN?ia.t0.MIN:e>ia.t0.MAX?ia.t0.MAX:e,this.t0=e,this.alignState(),this.dispatchEvent(new CustomEvent("ddm-model-t0",{detail:{t0:this.t0},bubbles:!0})),t.preventDefault()}}:null);(this.firstUpdate||t.has("interactive"))&&(this.interactive?Ht.call(f):Ht.on(".drag",null)),Ht.select(".line").transition().duration(this.drag?0:y).ease(sr).attr("x1",Q(0)).attr("x2",t=>Q(t.t0)).attr("y1",t=>B(t.startingPoint)).attr("y2",t=>B(t.startingPoint)),Ht.select(".line.touch").transition().duration(this.drag?0:y).ease(sr).attr("x1",Q(0)).attr("x2",t=>Q(t.t0)).attr("y1",t=>B(t.startingPoint)).attr("y2",t=>B(t.startingPoint)),Ht.select(".point").transition().duration(this.drag?0:y).ease(sr).attr("cx",t=>Q(t.t0)).attr("cy",t=>B(t.startingPoint)),Vt.exit().remove();const zt=tt.selectAll(".measure.a").data(this.measures?[this.a]:[]),Gt=zt.enter().append("g").classed("measure a",!0);Gt.append("line").classed("line",!0).attr("marker-start","url(#measure-arrow-a)").attr("marker-end","url(#measure-arrow-a)");const Yt=Gt.append("text").classed("label",!0);Yt.append("tspan").classed("a math-var",!0).text("a"),Yt.append("tspan").classed("equals",!0).text(" = "),Yt.append("tspan").classed("value",!0);const Xt=Gt.merge(zt);Xt.select(".line").transition().duration(this.drag?0:y).ease(sr).attr("x1",Q(this.scale.time.max)-.75*this.rem).attr("y1",B(this.bounds.upper)+2).attr("x2",Q(this.scale.time.max)-.75*this.rem).attr("y2",B(this.bounds.lower)-2);Xt.select(".label").transition().duration(this.drag?0:y).ease(sr).attr("x",Q(this.scale.time.max)).attr("y",B(this.bounds.upper)-.25*this.rem).select(".value").text(Ir(".2f")(this.a)),zt.exit().remove();const Jt=tt.selectAll(".measure.z").data(this.measures?[this.z]:[]),Wt=Jt.enter().append("g").classed("measure z",!0);Wt.append("line").classed("line",!0).attr("marker-start","url(#measure-arrow-z)").attr("marker-end","url(#measure-arrow-z)");const _t=Wt.append("text").classed("label",!0);_t.append("tspan").classed("z math-var",!0).text("z"),_t.append("tspan").classed("equals",!0).text(" = "),_t.append("tspan").classed("value",!0);const Kt=Wt.merge(Jt);Kt.select(".line").transition().duration(this.drag?0:y).ease(sr).attr("x1",Q(this.scale.time.min)+.75*this.rem).attr("y1",B(this.startingPoint)+2).attr("x2",Q(this.scale.time.min)+.75*this.rem).attr("y2",B(this.bounds.lower)-2);Kt.select(".label").transition().duration(this.drag?0:y).ease(sr).attr("x",Q(this.scale.time.min)).attr("y",B(this.bounds.lower)+.125*this.rem).select(".value").text(Ir(".0%")(this.z)),Jt.exit().remove();const Zt=tt.selectAll(".measure.v").data(this.measures?[this.v]:[]),Pt=Zt.enter().append("g").classed("measure v",!0);Pt.append("path").classed("line",!0).attr("marker-start","url(#measure-arrow-cap-v)").attr("marker-end","url(#measure-arrow-cap-v)");const Ot=Pt.append("text").classed("label",!0);Ot.append("tspan").classed("v math-var",!0).text("v"),Ot.append("tspan").classed("equals",!0).text(" = "),Ot.append("tspan").classed("value",!0);const jt=Q(200)-Q(0)+.75*this.rem,qt=2/jt,te=Math.atan(this.v/1e3*Tt)-qt,ee=Math.cos(te)*jt,ie=Math.sin(te)*jt,se=Pt.merge(Zt);se.select(".line").transition().duration(this.drag?0:y).ease(sr).attr("d",`\n M ${Q(this.t0+200)+.75*this.rem}, ${B(this.startingPoint)-2}\n A ${Q(200)-Q(0)} ${Q(200)-Q(0)} 0 0 0 ${Q(this.t0)+ee} ${B(this.startingPoint)-ie}\n `);se.select(".label").transition().duration(this.drag?0:y).ease(sr).attr("x",Q(this.t0+200)+.5*this.rem).attr("y",B(this.bounds.upper)-.25*this.rem).select(".value").text(Ir(".2f")(this.v)),Zt.exit().remove();const re=tt.selectAll(".measure.t0").data(this.measures?[this.t0]:[]),ae=re.enter().append("g").classed("measure t0",!0);ae.append("line").classed("line",!0).attr("marker-start","url(#measure-arrow-t0)").attr("marker-end","url(#measure-arrow-cap-t0)");const ne=ae.append("text").classed("label",!0);ne.append("tspan").classed("t0 math-var",!0).text("t₀"),ne.append("tspan").classed("equals",!0).text(" = "),ne.append("tspan").classed("value",!0);const oe=ae.merge(re);oe.select(".line").transition().duration(this.drag?0:y).ease(sr).attr("x1",Q(0)+2).attr("y1",B(this.startingPoint)-.75*this.rem).attr("x2",Q(this.t0)-2).attr("y2",B(this.startingPoint)-.75*this.rem);oe.select(".label").transition().duration(this.drag?0:y).ease(sr).attr("x",Q(this.t0)+.25*this.rem).attr("y",B(this.bounds.upper)-.25*this.rem).select(".value").text(Ir("d")(this.t0)),re.exit().remove();const le=et.selectAll(".model.mean").data(t=>this.means?[t]:[]),ce=le.enter().append("g").attr("class",t=>`model mean ${t.outcome}`);ce.append("line").classed("indicator",!0);ce.merge(le).select(".indicator").transition().duration(this.drag?0:y).ease(sr).attr("x1",t=>Q(t.model.meanRT)).attr("x2",t=>Q(t.model.meanRT)).attr("y1",t=>t.densityScale(this.scale.density.min)).attr("y2",t=>t.densityScale(this.scale.density.max)),le.exit().remove();const de=et.selectAll(".data.mean").data(t=>this.means&&!Number.isNaN(t.data.meanRT)?[t]:[]),ue=de.enter().append("g").attr("class",t=>`data mean ${t.outcome}`);ue.append("line").classed("indicator",!0).attr("y1",t=>t.densityScale(0)+("correct"===t.outcome?.125:-.125)*this.rem).attr("y2",t=>t.densityScale(0)+("correct"===t.outcome?.675:-.675)*this.rem);ue.merge(de).select(".indicator").transition().duration(this.drag?0:y).ease(sr).attr("x1",t=>Q(t.data.meanRT)).attr("x2",t=>Q(t.data.meanRT)).attr("y1",t=>t.densityScale(0)+("correct"===t.outcome?.125:-.125)*this.rem).attr("y2",t=>t.densityScale(0)+("correct"===t.outcome?.675:-.675)*this.rem),de.exit().select(".indicator").transition().duration(this.drag?0:y).ease(sr).attr("x1",0).attr("x2",0).on("end",(t,e,i)=>{_e(i[e].parentElement).remove()});const he=et.selectAll(".model.sd").data(t=>this.sds?[t]:[]),ge=he.enter().append("g").attr("class",t=>`model sd ${t.outcome}`);ge.append("line").classed("indicator",!0).attr("marker-start",t=>`url(#model-sd-cap-${t.outcome})`).attr("marker-end",t=>`url(#model-sd-cap-${t.outcome})`);ge.merge(he).select(".indicator").transition().duration(this.drag?0:y).ease(sr).attr("x1",t=>Q(t.model.meanRT-t.model.sdRT/2)).attr("x2",t=>Q(t.model.meanRT+t.model.sdRT/2)).attr("y1",t=>t.densityScale(5)).attr("y2",t=>t.densityScale(5)),he.exit().remove();const pe=et.selectAll(".data.sd").data(t=>!this.sds||Number.isNaN(t.data.meanRT)||Number.isNaN(t.data.sdRT)?[]:[t]),me=pe.enter().append("g").attr("class",t=>`data sd ${t.outcome}`);me.append("line").classed("indicator",!0).attr("marker-start",t=>`url(#data-sd-cap-${t.outcome})`).attr("marker-end",t=>`url(#data-sd-cap-${t.outcome})`).attr("y1",t=>t.densityScale(0)+("correct"===t.outcome?.375:-.375)*this.rem).attr("y2",t=>t.densityScale(0)+("correct"===t.outcome?.375:-.375)*this.rem);me.merge(pe).select(".indicator").transition().duration(this.drag?0:y).ease(sr).attr("x1",t=>Q(t.data.meanRT-t.data.sdRT/2)).attr("x2",t=>Q(t.data.meanRT+t.data.sdRT/2)).attr("y1",t=>t.densityScale(0)+("correct"===t.outcome?.375:-.375)*this.rem).attr("y2",t=>t.densityScale(0)+("correct"===t.outcome?.375:-.375)*this.rem),pe.exit().select(".indicator").transition().duration(this.drag?0:y).ease(sr).attr("x1",0).attr("x2",0).on("end",(t,e,i)=>{_e(i[e].parentElement).remove()}),this.firstUpdate=!1}}customElements.define("ddm-model",da);class ua extends(jr(ta)){static get properties(){return{coherence:{attribute:"coherence",type:Number,reflect:!0},count:{attribute:"count",type:Number,reflect:!0},probability:{attribute:"probability",type:Number,reflect:!0},duration:{attribute:"duration",type:Number,reflect:!0},wait:{attribute:"wait",type:Number,reflect:!0},iti:{attribute:"iti",type:Number,reflect:!0},trials:{attribute:"trials",type:Number,reflect:!0},running:{attribute:"running",type:Boolean,reflect:!0},lifetime:{attribute:!1,type:Number,reflect:!1},speed:{attribute:!1,type:Number,reflect:!1}}}constructor(){super(),this.coherence=.5,this.count=100,this.probability=.5,this.duration=2e3,this.wait=2e3,this.iti=2e3,this.trials=5,this.running=!1,this.lifetime=400,this.speed=50,this.firstUpdate=!0,this.COHERENT=0,this.RANDOM=1,this.dots=[[],[]],this.trial=0,this.states=["resetted","iti","stimulus","wait","ended"],this.state="resetted",this.baseTime=0,this.pauseTime=0,this.startTime=0,this.lastTime=0,this.LEFT=180,this.RIGHT=0,this.currentDirection=void 0,this.signals=["left","right"],this.signal=void 0,this.runner=void 0,this.xScale=void 0,this.yScale=void 0}static get styles(){return[super.styles,o`
1743
+ `]}render(){return X``}willUpdate(){this.alignState()}update(t){if(super.update(t),Number.isNaN(this.width)||Number.isNaN(this.height)||Number.isNaN(this.rem))return;const e=this.width,i=this.height;let s,r;e/i>1.5?(r=i,s=1.5*r):(s=e,r=s/1.5);const a=1*this.rem,n=3*this.rem,o=3.75*this.rem,l=3.25*this.rem,c=r-(a+n),d=s-(o+l),u=.75*this.rem,h=.5*c,g=.25*c-u,p=.75*this.rem,m=.9*d,b=.1*d-p,y=parseInt(this.getComputedStyleValue("---transition-duration"),10),Q=Gr().domain([this.scale.time.min,this.scale.time.max]).range([0,m]),B=Gr().domain([this.scale.evidence.min,this.scale.evidence.max]).range([h,0]),U=Gr().domain([this.scale.density.min,this.scale.density.max]).range([g,0]),F=Gr().domain([this.scale.density.min,this.scale.density.max]).range([0,g]),I=Gr().domain([0,1]).range([0,c]),f=li().subject((t,e)=>({x:Q(e.t0),y:B(e.startingPoint)})).on("start",t=>{_e(t.currentTarget).classed("dragging",!0)}).on("drag",t=>{this.drag=!0;const e=!!t.sourceEvent.shiftKey&&(Math.abs(t.x-t.subject.x)>Math.abs(t.y-t.subject.y)?"t0":"z");let i=Q.invert(t.x),s=(B.invert(t.y)+this.a/2)/this.a;i="z"===e?Q.invert(t.subject.x):i<ia.t0.MIN?ia.t0.MIN:i>ia.t0.MAX?ia.t0.MAX:i,s="t0"===e?(B.invert(t.subject.y)+this.a/2)/this.a:s<ia.z.MIN?ia.z.MIN:s>ia.z.MAX?ia.z.MAX:s,this.t0=i,this.z=s,this.alignState(),this.dispatchEvent(new CustomEvent("ddm-model-t0",{detail:{t0:this.t0},bubbles:!0})),this.dispatchEvent(new CustomEvent("ddm-model-z",{detail:{z:this.z},bubbles:!0}))}).on("end",t=>{_e(t.currentTarget).classed("dragging",!1),this.drag=!1}),C=li().on("start",t=>{_e(t.currentTarget).classed("dragging",!0)}).on("drag",t=>{this.drag=!0;let e=(B.invert(t.y)-this.startingPoint)/(Q.invert(t.x)-this.t0)*1e3;e=e<ia.v.MIN?ia.v.MIN:e>ia.v.MAX?ia.v.MAX:e,this.v=e,this.alignState(),this.dispatchEvent(new CustomEvent("ddm-model-v",{detail:{v:this.v},bubbles:!0}))}).on("end",t=>{_e(t.currentTarget).classed("dragging",!1),this.drag=!1}),v=li().subject((t,e)=>({x:0,y:B(e.value)})).on("start",t=>{_e(t.currentTarget).classed("dragging",!0)}).on("drag",t=>{this.drag=!0;const e=B.invert(t.y);let i=Math.abs(2*e);i=i<ia.a.MIN?ia.a.MIN:i>ia.a.MAX?ia.a.MAX:i,this.a=i,this.alignState(),this.dispatchEvent(new CustomEvent("ddm-model-a",{detail:{a:this.a},bubbles:!0}))}).on("end",t=>{_e(t.currentTarget).classed("dragging",!1),this.drag=!1}),A=Kr().x(t=>Q(t.t)).y(t=>B(t.e)),x=Kr().x(t=>Q(t.t)).y(t=>U(t.d)),E=Kr().x(t=>Q(t.t)).y(t=>F(t.d)),R=_e(this.renderRoot).selectAll(".main").data([{width:this.width,height:this.height,rem:this.rem}]),S=R.enter().append("svg").classed("main",!0).html(ta.svgDefs),N=S.append("defs"),L=t=>{N.append("marker").attr("id",`measure-arrow-${t}`).attr("class",`measure-arrow ${t}`).attr("orient","auto-start-reverse").attr("markerUnits","userSpaceOnUse").attr("viewBox","-10 -6 12 12").attr("refX","0").attr("refY","0").attr("markerWidth","12").attr("markerHeight","12").append("path").attr("class","arrow").attr("d","M -7 -3 l 6 3 l -6 3 z")},w=t=>{const e=N.append("marker").attr("id",`measure-capped-arrow-${t}`).attr("class",`measure-arrow capped ${t}`).attr("orient","auto-start-reverse").attr("markerUnits","userSpaceOnUse").attr("viewBox","-10 -6 12 12").attr("refX","0").attr("refY","0").attr("markerWidth","12").attr("markerHeight","12");e.append("path").attr("class","arrow").attr("d","M -7 -3 l 6 3 l -6 3 z"),e.append("path").attr("class","cap").attr("d","M 0 -4 l 0 8")};L("a"),L("z"),w("v"),L("t0"),w("t0");const D=t=>{N.append("marker").attr("id",`model-sd-cap-${t}`).attr("class",`model-sd cap ${t}`).attr("orient","auto-start-reverse").attr("markerUnits","userSpaceOnUse").attr("viewBox","-5 -5 10 10").attr("refX","0").attr("refY","0").attr("markerWidth","10").attr("markerHeight","10").append("path").attr("stroke","context-stroke").attr("fill","context-stroke").attr("stroke-width","2").attr("d","M 0 -4 l 0 8"),N.append("marker").attr("id",`data-sd-cap-${t}`).attr("class",`data-sd cap ${t}`).attr("orient","auto-start-reverse").attr("markerUnits","userSpaceOnUse").attr("viewBox","-5 -5 10 10").attr("refX","0").attr("refY","0").attr("markerWidth","10").attr("markerHeight","10").append("path").attr("stroke","context-stroke").attr("fill","context-stroke").attr("stroke-width","2").attr("d","M 0 -3 l 0 6")};D("error"),D("correct");const M=N.append("linearGradient").attr("id","path-animate").attr("gradientUnits","userSpaceOnUse").attr("color-interpolation","linearRGB").attr("x1","0").attr("x2","0").attr("y1",B(this.bounds.upper)).attr("y2",B(this.bounds.lower));M.append("stop").classed("stop-0",!0).attr("offset","0%"),M.append("stop").classed("stop-100",!0).attr("offset","100%");const k=S.merge(R).attr("viewBox",`0 0 ${s} ${r}`),T=k.selectAll(".plot.density").data([{outcome:"correct",data:{meanRT:this.data.correctMeanRT,sdRT:this.data.correctSDRT},model:{meanRT:this.model.correctMeanRT,sdRT:this.model.correctSDRT,dist:this.model.correctDist},densityScale:U,densityLine:x,alignDistribution:this.alignCorrectDistribution.bind(this)},{outcome:"error",data:{meanRT:this.data.errorMeanRT,sdRT:this.data.errorSDRT},model:{meanRT:this.model.errorMeanRT,sdRT:this.model.errorSDRT,dist:this.model.errorDist},densityScale:F,densityLine:E,alignDistribution:this.alignErrorDistribution.bind(this)}]),V=S.append("g").classed("plot evidence",!0),$=T.enter().append("g").attr("class",t=>`plot density ${t.outcome}`),H=S.append("g").classed("plot accuracy",!0),z=k.select(".plot.evidence").attr("transform",`translate(${o}, ${a+g+u})`),G=$.merge(T).attr("transform",t=>`translate(${o}, ${"correct"===t.outcome?a:a+g+h+2*u})`),Y=k.select(".plot.accuracy").attr("transform",`translate(${o+m+p}, ${a})`);V.append("clipPath").attr("id","clip-evidence").append("rect"),z.select("clipPath rect").attr("y",B(this.bounds.upper)).attr("height",B(this.bounds.lower)-B(this.bounds.upper)+1).attr("width",m+1);const X=V.append("g").classed("underlayer",!0),J=$.append("g").classed("underlayer",!0),W=H.append("g").classed("underlayer",!0),_=z.select(".underlayer"),K=G.select(".underlayer"),P=Y.select(".underlayer");V.append("g").classed("content",!0).append("g").classed("paths",!0);const Z=$.append("g").classed("content",!0);H.append("g").classed("content",!0);const O=z.select(".content"),j=G.select(".content"),q=Y.select(".content");V.append("g").classed("overlayer",!0),$.append("g").classed("overlayer",!0),H.append("g").classed("overlayer",!0);const tt=z.select(".overlayer"),et=G.select(".overlayer");X.append("rect").classed("background",!0),J.append("rect").classed("background",!0),_.select(".background").transition().duration(this.drag?0:y).ease(sr).attr("y",B(this.bounds.upper)).attr("height",B(this.bounds.lower)-B(this.bounds.upper)).attr("width",m),K.select(".background").transition().duration(y).ease(sr).attr("height",g).attr("width",m),J.filter(t=>"error"===t.outcome).append("g").classed("axis time",!0);const it=K.filter(t=>"error"===t.outcome).select(".axis.time").attr("transform",`translate(0, ${g+.25*this.rem})`);var st;it.transition().duration(y).ease(sr).call((st=Q,Et(3,st))).attr("font-size",null).attr("font-family",null).selectAll("line, path").attr("stroke",null);const rt=J.filter(t=>"error"===t.outcome).append("text").classed("title time",!0).attr("text-anchor","middle");rt.append("tspan").classed("name",!0).text("Time (ms)"),K.filter(t=>"error"===t.outcome).select(".title.time").transition().duration(y).ease(sr).attr("transform",`translate(${m/2}, ${g+2.5*this.rem})`),X.append("g").classed("axis evidence",!0),J.append("g").attr("class",t=>`axis density ${t.outcome}`),W.append("g").classed("axis accuracy",!0);const at=_.select(".axis.evidence").attr("transform",`translate(${-.25*this.rem}, 0)`),nt=K.select(".axis.density").attr("transform",`translate(${-.25*this.rem}, 0)`),ot=P.select(".axis.accuracy").attr("transform",`translate(${b+.25*this.rem}, 0)`),lt=at.transition().duration(y).ease(sr).call(Rt(B)).attr("font-size",null).attr("font-family",null),ct=nt.transition().duration(y).ease(sr).each((t,e,i)=>{Rt(t.densityScale).ticks(2)(_e(i[e]))}).attr("font-size",null).attr("font-family",null),dt=ot.transition().duration(y).ease(sr).call(function(t){return Et(2,t)}(I)).attr("font-size",null).attr("font-family",null);lt.selectAll("line, path").attr("stroke",null),ct.selectAll("line, path").attr("stroke",null),dt.selectAll("line, path").attr("stroke",null);const ut=X.append("text").classed("title evidence",!0).attr("text-anchor","middle"),ht=J.append("text").attr("class",t=>`title density ${t.outcome}`).attr("text-anchor","middle"),gt=W.append("text").classed("title accuracy",!0).attr("text-anchor","middle");ut.append("tspan").classed("name",!0).text("Evidence"),ht.append("tspan").classed("name",!0).text("Density"),gt.append("tspan").classed("name",!0).text("Accuracy"),_.select(".title.evidence").transition().duration(y).ease(sr).attr("transform",`translate(${-2.5*this.rem}, ${h/2})rotate(-90)`),K.select(".title.density").transition().duration(y).ease(sr).attr("transform",`translate(${-2.5*this.rem}, ${g/2})rotate(-90)`),P.select(".title.accuracy").transition().duration(y).ease(sr).attr("transform",`translate(${b+2.25*this.rem}, ${c/2})rotate(90)`);const pt=O.select(".paths").selectAll(".path").data(this.data.trials.filter(t=>void 0!==t.path)),mt=Pe(),bt=pt.enter().append("g").classed("path",!0).attr("data-new-trial-ease-time",0).on("pointerenter",(t,e)=>{if(!this.drag){_e(t.currentTarget).classed("highlight",!0).raise();const i=tt.append("g").classed(`rt-label ${e.outcome}`,!0),s=i.append("rect"),r=i.append("text").text(`RT = ${e.rt.toFixed()}`).attr("x",Q(e.rt)).attr("y","correct"===e.outcome?B(this.bounds.upper)-.25*this.rem:B(this.bounds.lower)+.125*this.rem).node().getBBox();s.attr("x",r.x-.125*this.rem).attr("y",r.y+.125*this.rem).attr("width",r.width+.25*this.rem).attr("height",r.height-.25*this.rem),mt.set(t.currentTarget,i)}}).on("pointerout",(t,e)=>{this.drag||(_e(t.currentTarget).classed("highlight",!1).lower(),t.currentTarget.parentNode.insertBefore(t.currentTarget,t.currentTarget.parentNode.children[e.index]),mt.get(t.currentTarget).remove())});bt.append("path").classed("curve",!0).attr("clip-path","url(#clip-evidence)").attr("pathLength",1).attr("stroke-dashoffset",1);const yt=bt.merge(pt).attr("class",t=>`path ${t.outcome}`);yt.select(".curve").transition().duration(this.drag?0:y).ease(sr).attr("stroke",t=>this.getComputedStyleValue(`---color-${t.outcome}`)).attrTween("d",(t,e,i)=>{const s=i[e],r=es(void 0!==s.a?s.a:this.a,this.a),a=es(void 0!==s.z?s.z:this.z,this.z),n=es(void 0!==s.v?s.v:this.v,this.v),o=es(void 0!==s.t0?s.t0:this.t0,this.t0);return e=>{s.a=r(e),s.z=a(e),s.v=n(e),s.t0=o(e);const i=this.alignPath(t.seed,s.a,s.z,s.v,s.t0);return A(i)}});const Qt=yt.filter(t=>t.animate&&!this.paused);if(!Qt.empty()){const t=Qt.attr("data-new-trial-ease-time"),e=e=>Gr().domain([0,1]).range([t,1])(e),i=e=>i=>Gr().domain([e(t),1]).range([0,1])(e(i));Qt.classed("animate",!0).select(".curve").attr("stroke-dasharray",1),Qt.transition("new").duration(e=>Math.floor(1.5*e.rt*(1-t))).ease(e).attr("data-new-trial-ease-time",1).select(".curve").attrTween("stroke-dashoffset",(t,e,s)=>{const r=es(s[e].getAttribute("stroke-dashoffset"),0);return t=>r(i(ir)(t))}).on("end",(t,e,i)=>{_e(i[e].parentElement).classed("animate",!1).attr("data-new-trial-ease-time",null),t.animate=!1,this.animate=!1,this.alignState(),this.requestUpdate(),this.dispatchEvent(new CustomEvent("accumulable-response",{detail:{outcome:t.outcome,data:this.data,model:this.model},bubbles:!0}))})}const Bt=yt.filter(t=>t.animate&&this.paused);if(!Bt.empty()){const t=Bt.attr("data-new-trial-ease-time");Bt.classed("animate",!0).select(".curve").attr("stroke-dasharray",1).attr("stroke-dashoffset",()=>es(1,0)(ir(t)))}yt.filter(t=>!t.animate).attr("data-new-trial-ease-time",null),pt.exit().remove();const Ut=Z.append("g").attr("class",t=>`dist ${t.outcome}`);Ut.append("path").classed("curve",!0),j.select(".dist").select(".curve").transition().duration(this.drag?0:y).ease(sr).attrTween("d",(t,e,i)=>{const s=i[e],r=es(void 0!==s.a?s.a:this.a,this.a),a=es(void 0!==s.z?s.z:this.z,this.z),n=es(void 0!==s.v?s.v:this.v,this.v),o=es(void 0!==s.t0?s.t0:this.t0,this.t0);return e=>{s.a=r(e),s.z=a(e),s.v=n(e),s.t0=o(e);const i=t.alignDistribution(s.a,s.z,s.v,s.t0);return t.densityLine(i)}});const Ft=O.selectAll(".rt").data(this.data.trials),It=Ft.enter().append("g");It.append("line").classed("mark",!0).attr("x1",t=>Q(t.rt)).attr("x2",t=>Q(t.rt)).attr("y1",t=>"correct"===t.outcome?B(1)-.125*this.rem:B(-1)+.125*this.rem).attr("y2",t=>"correct"===t.outcome?B(1)-.675*this.rem:B(-1)+.675*this.rem);const ft=It.merge(Ft).attr("class",t=>`rt ${t.outcome}`);ft.filter(t=>!t.animate).select(".mark").transition().duration(this.drag?0:y).ease(sr).attr("stroke",t=>this.getComputedStyleValue(`---color-${t.outcome}`)).attr("x1",t=>Q(t.rt)).attr("x2",t=>Q(t.rt)).attr("y1",t=>"correct"===t.outcome?B(1)-.125*this.rem:B(-1)+.125*this.rem).attr("y2",t=>"correct"===t.outcome?B(1)-.675*this.rem:B(-1)+.675*this.rem),Ft.exit().remove();const Ct=q.selectAll(".accuracy.model").data([this.model.accuracy,1-this.model.accuracy]),vt=Ct.enter().append("g").attr("class",(t,e)=>"accuracy model "+(0===e?"correct":"error"));vt.append("rect").classed("bar",!0).attr("x",0),vt.merge(Ct).select("rect").transition().duration(this.drag?0:y).ease(sr).attr("y",(t,e)=>I(0===e?0:1-t)).attr("width",b).attr("height",t=>I(t)),Ct.exit().remove();const At=q.selectAll(".accuracy.data").data(Number.isNaN(this.data.accuracy)?[]:[this.data.accuracy]),xt=At.enter().append("g").classed("accuracy data",!0);xt.append("line").classed("mark",!0);const St=xt.merge(At).attr("class",t=>"accuracy data "+(t<this.model.accuracy.correct?"correct":"error"));St.select(".mark").transition().duration(this.drag?0:y).ease(sr).attr("x1",0+.25*this.rem).attr("x2",b-.25*this.rem).attr("y1",t=>I(t)-1).attr("y2",t=>I(t)-1),At.exit().remove();const Nt=tt.selectAll(".boundary").data([{bound:"upper",value:this.bounds.upper},{bound:"lower",value:this.bounds.lower}]),Lt=Nt.enter().append("g").attr("class",(t,e)=>"boundary "+(0===e?"correct":"error"));Lt.append("line").classed("line",!0),Lt.append("line").classed("line touch",!0);const wt=Lt.merge(Nt).attr("tabindex",this.interactive?0:null).classed("interactive",this.interactive).on("keydown",this.interactive?(t,e)=>{if(["ArrowUp","ArrowDown"].includes(t.key)){let{a:i}=this;switch(t.key){case"ArrowUp":i+="upper"===e.bound?t.shiftKey?ia.a.STEP:ia.a.JUMP:t.shiftKey?-.01:-.1;break;case"ArrowDown":i+="upper"===e.bound?t.shiftKey?-.01:-.1:t.shiftKey?ia.a.STEP:ia.a.JUMP}i=i<ia.a.MIN?ia.a.MIN:i>ia.a.MAX?ia.a.MAX:i,this.a=i,this.alignState(),this.dispatchEvent(new CustomEvent("ddm-model-a",{detail:{a:this.a},bubbles:!0})),t.preventDefault()}}:null);(this.firstUpdate||t.has("interactive"))&&(this.interactive?wt.call(v):wt.on(".drag",null)),wt.select(".line").transition().duration(this.drag?0:y).ease(sr).attr("x1",Q(this.scale.time.min)).attr("x2",Q(this.scale.time.max)).attr("y1",t=>B(t.value)).attr("y2",t=>B(t.value)),wt.select(".line.touch").transition().duration(this.drag?0:y).ease(sr).attr("x1",Q(this.scale.time.min)).attr("x2",Q(this.scale.time.max)).attr("y1",t=>B(t.value)).attr("y2",t=>B(t.value)),Nt.exit().remove();const Dt=tt.selectAll(".drift").data([{v:this.v,t0:this.t0,startingPoint:this.startingPoint}]),Mt=Dt.enter().append("g").classed("drift",!0);Mt.append("line").classed("line",!0),Mt.append("line").classed("line touch",!0),Mt.append("path").classed("arrow",!0),Mt.append("path").classed("arrow touch",!0);const kt=Mt.merge(Dt).attr("tabindex",this.interactive?0:null).classed("interactive",this.interactive).on("keydown",this.interactive?t=>{if(["ArrowUp","ArrowDown"].includes(t.key)){let{v:e}=this;switch(t.key){case"ArrowUp":e+=t.shiftKey?ia.v.STEP:ia.v.JUMP;break;case"ArrowDown":e-=t.shiftKey?ia.v.STEP:ia.v.JUMP}e=e<ia.v.MIN?ia.v.MIN:e>ia.v.MAX?ia.v.MAX:e,this.v=e,this.alignState(),this.dispatchEvent(new CustomEvent("ddm-model-v",{detail:{v:this.v},bubbles:!0})),t.preventDefault()}}:null);(this.firstUpdate||t.has("interactive"))&&(this.interactive?kt.call(C):kt.on(".drag",null));const Tt=(B(0)-B(1))/(Q(1)-Q(0));kt.transition().duration(this.drag?0:y).ease(sr).attr("transform",t=>`translate(${Q(t.t0)}, ${B(t.startingPoint)})\n rotate(${-Math.atan(t.v/1e3*Tt)*(180/Math.PI)})`),kt.select(".line").attr("x2",Q(200)),kt.select(".line.touch").attr("x2",Q(200)),kt.select(".arrow").attr("d",`\n M ${Q(200)-.5*this.rem},${.5*-this.rem}\n l ${.5*this.rem},${.5*this.rem}\n l ${.5*-this.rem},${.5*this.rem}\n `),kt.select(".arrow.touch").attr("d",`\n M ${Q(200)-.5*this.rem},${.5*-this.rem}\n l ${.5*this.rem},${.5*this.rem}\n l ${.5*-this.rem},${.5*this.rem}\n `),Dt.exit().remove();const Vt=tt.selectAll(".t0z").data([{t0:this.t0,startingPoint:this.startingPoint}]),$t=Vt.enter().append("g").classed("t0z",!0);$t.append("line").classed("line",!0),$t.append("line").classed("line touch",!0),$t.append("circle").classed("point touch",!0);const Ht=$t.merge(Vt).attr("tabindex",this.interactive?0:null).classed("interactive",this.interactive).on("keydown",this.interactive?t=>{if(["ArrowUp","ArrowDown"].includes(t.key)){let{z:e}=this;switch(t.key){case"ArrowUp":e+=t.shiftKey?ia.z.STEP:ia.z.JUMP;break;case"ArrowDown":e-=t.shiftKey?ia.z.STEP:ia.z.JUMP}e=e<ia.z.MIN?ia.z.MIN:e>ia.z.MAX?ia.z.MAX:e,this.z=e,this.alignState(),this.dispatchEvent(new CustomEvent("ddm-model-z",{detail:{z:this.z},bubbles:!0})),t.preventDefault()}if(["ArrowLeft","ArrowRight"].includes(t.key)){let e=this.t0;switch(t.key){case"ArrowRight":e+=t.shiftKey?ia.t0.STEP:ia.t0.JUMP;break;case"ArrowLeft":e-=t.shiftKey?ia.t0.STEP:ia.t0.JUMP}e=e<ia.t0.MIN?ia.t0.MIN:e>ia.t0.MAX?ia.t0.MAX:e,this.t0=e,this.alignState(),this.dispatchEvent(new CustomEvent("ddm-model-t0",{detail:{t0:this.t0},bubbles:!0})),t.preventDefault()}}:null);(this.firstUpdate||t.has("interactive"))&&(this.interactive?Ht.call(f):Ht.on(".drag",null)),Ht.select(".line").transition().duration(this.drag?0:y).ease(sr).attr("x1",Q(0)).attr("x2",t=>Q(t.t0)).attr("y1",t=>B(t.startingPoint)).attr("y2",t=>B(t.startingPoint)),Ht.select(".line.touch").transition().duration(this.drag?0:y).ease(sr).attr("x1",Q(0)).attr("x2",t=>Q(t.t0)).attr("y1",t=>B(t.startingPoint)).attr("y2",t=>B(t.startingPoint)),Ht.select(".point").transition().duration(this.drag?0:y).ease(sr).attr("cx",t=>Q(t.t0)).attr("cy",t=>B(t.startingPoint)),Vt.exit().remove();const zt=tt.selectAll(".measure.a").data(this.measures?[this.a]:[]),Gt=zt.enter().append("g").classed("measure a",!0);Gt.append("line").classed("line",!0),Gt.append("line").classed("markers",!0).attr("marker-start","url(#measure-arrow-a)").attr("marker-end","url(#measure-arrow-a)");const Yt=Gt.append("text").classed("label",!0);Yt.append("tspan").classed("a math-var",!0).text("a"),Yt.append("tspan").classed("equals",!0).text(" = "),Yt.append("tspan").classed("value",!0);const Xt=Math.abs(B(this.bounds.upper)-B(this.bounds.lower))<=4,Jt=Gt.merge(zt);Jt.select(".line").classed("short",Xt).transition().duration(this.drag?0:y).ease(sr).attr("x1",Q(this.scale.time.max)-.75*this.rem).attr("y1",B(this.bounds.upper)+2).attr("x2",Q(this.scale.time.max)-.75*this.rem).attr("y2",B(this.bounds.lower)-2),Jt.select(".markers").transition().duration(this.drag?0:y).ease(sr).attr("x1",Q(this.scale.time.max)-.75*this.rem).attr("y1",B(this.bounds.upper)).attr("x2",Q(this.scale.time.max)-.75*this.rem).attr("y2",B(this.bounds.lower));Jt.select(".label").transition().duration(this.drag?0:y).ease(sr).attr("x",Q(this.scale.time.max)).attr("y",B(this.bounds.upper)-.25*this.rem).select(".value").text(Ir(".2f")(this.a)),zt.exit().remove();const Wt=tt.selectAll(".measure.z").data(this.measures?[this.z]:[]),_t=Wt.enter().append("g").classed("measure z",!0);_t.append("line").classed("line",!0),_t.append("line").classed("markers",!0).attr("marker-start","url(#measure-arrow-z)").attr("marker-end","url(#measure-arrow-z)");const Kt=_t.append("text").classed("label",!0);Kt.append("tspan").classed("z math-var",!0).text("z"),Kt.append("tspan").classed("equals",!0).text(" = "),Kt.append("tspan").classed("value",!0);const Pt=Math.abs(B(this.startingPoint)-B(this.bounds.lower))<=4,Zt=_t.merge(Wt);Zt.select(".line").classed("short",Pt).transition().duration(this.drag?0:y).ease(sr).attr("x1",Q(this.scale.time.min)+.75*this.rem).attr("y1",B(this.startingPoint)+2).attr("x2",Q(this.scale.time.min)+.75*this.rem).attr("y2",B(this.bounds.lower)-2),Zt.select(".markers").transition().duration(this.drag?0:y).ease(sr).attr("x1",Q(this.scale.time.min)+.75*this.rem).attr("y1",B(this.startingPoint)).attr("x2",Q(this.scale.time.min)+.75*this.rem).attr("y2",B(this.bounds.lower));Zt.select(".label").transition().duration(this.drag?0:y).ease(sr).attr("x",Q(this.scale.time.min)).attr("y",B(this.bounds.lower)+.125*this.rem).select(".value").text(Ir(".0%")(this.z)),Wt.exit().remove();const Ot=tt.selectAll(".measure.v").data(this.measures?[this.v]:[]),jt=Ot.enter().append("g").classed("measure v",!0);jt.append("path").classed("line",!0),jt.append("path").classed("markers",!0).attr("marker-start","url(#measure-capped-arrow-v)").attr("marker-end","url(#measure-capped-arrow-v)");const qt=jt.append("text").classed("label",!0);qt.append("tspan").classed("v math-var",!0).text("v"),qt.append("tspan").classed("equals",!0).text(" = "),qt.append("tspan").classed("value",!0);const te=Q(200)-Q(0)+.75*this.rem,ee=Math.atan(this.v/1e3*Tt),ie=Math.cos(ee)*te,se=Math.sin(ee)*te,re=2/te,ae=Math.atan(this.v/1e3*Tt)-re,ne=Math.cos(re)*te,oe=Math.sin(re)*te,le=Math.cos(ae)*te,ce=Math.sin(ae)*te,de=ae*te<=4,ue=jt.merge(Ot);ue.select(".line").classed("short",de).transition().duration(this.drag?0:y).ease(sr).attr("d",`\n M ${Q(this.t0)+ne}, ${B(this.startingPoint)-oe}\n A ${Q(200)-Q(0)+.75*this.rem} ${Q(200)-Q(0)+.75*this.rem} 0 0 0 ${Q(this.t0)+le} ${B(this.startingPoint)-ce}\n `),ue.select(".markers").transition().duration(this.drag?0:y).ease(sr).attr("d",`\n M ${Q(this.t0+200)+.75*this.rem}, ${B(this.startingPoint)}\n A ${Q(200)-Q(0)+.75*this.rem} ${Q(200)-Q(0)+.75*this.rem} 0 0 0 ${Q(this.t0)+ie} ${B(this.startingPoint)-se}\n `);ue.select(".label").transition().duration(this.drag?0:y).ease(sr).attr("x",Q(this.t0+200)+.5*this.rem).attr("y",B(this.bounds.upper)-.25*this.rem).select(".value").text(Ir(".2f")(this.v)),Ot.exit().remove();const he=tt.selectAll(".measure.t0").data(this.measures?[this.t0]:[]),ge=he.enter().append("g").classed("measure t0",!0);ge.append("line").classed("line",!0),ge.append("line").classed("markers",!0).attr("marker-start","url(#measure-arrow-t0)").attr("marker-end","url(#measure-capped-arrow-t0)");const pe=ge.append("text").classed("label",!0);pe.append("tspan").classed("t0 math-var",!0).text("t₀"),pe.append("tspan").classed("equals",!0).text(" = "),pe.append("tspan").classed("value",!0);const me=Math.abs(Q(0)-Q(this.t0))<=4,be=ge.merge(he);be.select(".line").classed("short",me).transition().duration(this.drag?0:y).ease(sr).attr("x1",Q(0)+2).attr("y1",B(this.startingPoint)-.75*this.rem).attr("x2",Q(this.t0)-2).attr("y2",B(this.startingPoint)-.75*this.rem),be.select(".markers").transition().duration(this.drag?0:y).ease(sr).attr("x1",Q(0)).attr("y1",B(this.startingPoint)-.75*this.rem).attr("x2",Q(this.t0)).attr("y2",B(this.startingPoint)-.75*this.rem);be.select(".label").transition().duration(this.drag?0:y).ease(sr).attr("x",Q(this.t0)+.25*this.rem).attr("y",B(this.bounds.upper)-.25*this.rem).select(".value").text(Ir("d")(this.t0)),he.exit().remove();const ye=et.selectAll(".model.mean").data(t=>this.means?[t]:[]),Qe=ye.enter().append("g").attr("class",t=>`model mean ${t.outcome}`);Qe.append("line").classed("indicator",!0);Qe.merge(ye).select(".indicator").transition().duration(this.drag?0:y).ease(sr).attr("x1",t=>Q(t.model.meanRT)).attr("x2",t=>Q(t.model.meanRT)).attr("y1",t=>t.densityScale(this.scale.density.min)).attr("y2",t=>t.densityScale(this.scale.density.max)),ye.exit().remove();const Be=et.selectAll(".data.mean").data(t=>this.means&&!Number.isNaN(t.data.meanRT)?[t]:[]),Ue=Be.enter().append("g").attr("class",t=>`data mean ${t.outcome}`);Ue.append("line").classed("indicator",!0).attr("y1",t=>t.densityScale(0)+("correct"===t.outcome?.125:-.125)*this.rem).attr("y2",t=>t.densityScale(0)+("correct"===t.outcome?.675:-.675)*this.rem);Ue.merge(Be).select(".indicator").transition().duration(this.drag?0:y).ease(sr).attr("x1",t=>Q(t.data.meanRT)).attr("x2",t=>Q(t.data.meanRT)).attr("y1",t=>t.densityScale(0)+("correct"===t.outcome?.125:-.125)*this.rem).attr("y2",t=>t.densityScale(0)+("correct"===t.outcome?.675:-.675)*this.rem),Be.exit().select(".indicator").transition().duration(this.drag?0:y).ease(sr).attr("x1",0).attr("x2",0).on("end",(t,e,i)=>{_e(i[e].parentElement).remove()});const Fe=et.selectAll(".model.sd").data(t=>this.sds?[t]:[]),Ie=Fe.enter().append("g").attr("class",t=>`model sd ${t.outcome}`);Ie.append("line").classed("indicator",!0).attr("marker-start",t=>`url(#model-sd-cap-${t.outcome})`).attr("marker-end",t=>`url(#model-sd-cap-${t.outcome})`);Ie.merge(Fe).select(".indicator").transition().duration(this.drag?0:y).ease(sr).attr("x1",t=>Q(t.model.meanRT-t.model.sdRT/2)).attr("x2",t=>Q(t.model.meanRT+t.model.sdRT/2)).attr("y1",t=>t.densityScale(5)).attr("y2",t=>t.densityScale(5)),Fe.exit().remove();const fe=et.selectAll(".data.sd").data(t=>!this.sds||Number.isNaN(t.data.meanRT)||Number.isNaN(t.data.sdRT)?[]:[t]),Ce=fe.enter().append("g").attr("class",t=>`data sd ${t.outcome}`);Ce.append("line").classed("indicator",!0).attr("marker-start",t=>`url(#data-sd-cap-${t.outcome})`).attr("marker-end",t=>`url(#data-sd-cap-${t.outcome})`).attr("y1",t=>t.densityScale(0)+("correct"===t.outcome?.375:-.375)*this.rem).attr("y2",t=>t.densityScale(0)+("correct"===t.outcome?.375:-.375)*this.rem);Ce.merge(fe).select(".indicator").transition().duration(this.drag?0:y).ease(sr).attr("x1",t=>Q(t.data.meanRT-t.data.sdRT/2)).attr("x2",t=>Q(t.data.meanRT+t.data.sdRT/2)).attr("y1",t=>t.densityScale(0)+("correct"===t.outcome?.375:-.375)*this.rem).attr("y2",t=>t.densityScale(0)+("correct"===t.outcome?.375:-.375)*this.rem),fe.exit().select(".indicator").transition().duration(this.drag?0:y).ease(sr).attr("x1",0).attr("x2",0).on("end",(t,e,i)=>{_e(i[e].parentElement).remove()}),this.firstUpdate=!1}}customElements.define("ddm-model",da);class ua extends(jr(ta)){static get properties(){return{coherence:{attribute:"coherence",type:Number,reflect:!0},count:{attribute:"count",type:Number,reflect:!0},probability:{attribute:"probability",type:Number,reflect:!0},duration:{attribute:"duration",type:Number,reflect:!0},wait:{attribute:"wait",type:Number,reflect:!0},iti:{attribute:"iti",type:Number,reflect:!0},trials:{attribute:"trials",type:Number,reflect:!0},running:{attribute:"running",type:Boolean,reflect:!0},lifetime:{attribute:!1,type:Number,reflect:!1},speed:{attribute:!1,type:Number,reflect:!1}}}constructor(){super(),this.coherence=.5,this.count=100,this.probability=.5,this.duration=2e3,this.wait=2e3,this.iti=2e3,this.trials=5,this.running=!1,this.lifetime=400,this.speed=50,this.firstUpdate=!0,this.COHERENT=0,this.RANDOM=1,this.dots=[[],[]],this.trial=0,this.states=["resetted","iti","stimulus","wait","ended"],this.state="resetted",this.baseTime=0,this.pauseTime=0,this.startTime=0,this.lastTime=0,this.LEFT=180,this.RIGHT=0,this.currentDirection=void 0,this.signals=["left","right"],this.signal=void 0,this.runner=void 0,this.xScale=void 0,this.yScale=void 0}static get styles(){return[super.styles,o`
1726
1744
  :host {
1727
1745
  display: inline-block;
1728
1746