@decidables/accumulable-elements 0.3.7 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,12 +3,12 @@
3
3
  * Copyright 2019 Google LLC
4
4
  * SPDX-License-Identifier: BSD-3-Clause
5
5
  */
6
- const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,i=Symbol(),s=new WeakMap;let r=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==i)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const i=this.t;if(e&&void 0===t){const e=void 0!==i&&1===i.length;e&&(t=s.get(i)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&s.set(i,t))}return t}toString(){return this.cssText}};const a=t=>new r("string"==typeof t?t:t+"",void 0,i),n=(t,...e)=>{const s=1===t.length?t[0]:e.reduce((e,i,s)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+t[s+1],t[0]);return new r(s,t,i)},o=e?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return a(e)})(t):t,{is:l,defineProperty:c,getOwnPropertyDescriptor:d,getOwnPropertyNames:h,getOwnPropertySymbols:u,getPrototypeOf:g}=Object,p=globalThis,m=p.trustedTypes,b=m?m.emptyScript:"",y=p.reactiveElementPolyfillSupport,Q=(t,e)=>t,B={toAttribute(t,e){switch(e){case Boolean:t=t?b:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},U=(t,e)=>!l(t,e),F={attribute:!0,type:String,converter:B,reflect:!1,useDefault:!1,hasChanged:U};
6
+ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,i=Symbol(),s=new WeakMap;let r=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==i)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const i=this.t;if(e&&void 0===t){const e=void 0!==i&&1===i.length;e&&(t=s.get(i)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&s.set(i,t))}return t}toString(){return this.cssText}};const a=t=>new r("string"==typeof t?t:t+"",void 0,i),n=(t,...e)=>{const s=1===t.length?t[0]:e.reduce((e,i,s)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+t[s+1],t[0]);return new r(s,t,i)},o=e?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return a(e)})(t):t,{is:l,defineProperty:c,getOwnPropertyDescriptor:d,getOwnPropertyNames:h,getOwnPropertySymbols:u,getPrototypeOf:g}=Object,p=globalThis,m=p.trustedTypes,b=m?m.emptyScript:"",Q=p.reactiveElementPolyfillSupport,B=(t,e)=>t,y={toAttribute(t,e){switch(e){case Boolean:t=t?b:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},U=(t,e)=>!l(t,e),F={attribute:!0,type:String,converter:y,reflect:!1,useDefault:!1,hasChanged:U};
7
7
  /**
8
8
  * @license
9
9
  * Copyright 2017 Google LLC
10
10
  * SPDX-License-Identifier: BSD-3-Clause
11
- */Symbol.metadata??=Symbol("metadata"),p.litPropertyMetadata??=new WeakMap;let I=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=F){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const i=Symbol(),s=this.getPropertyDescriptor(t,i,e);void 0!==s&&c(this.prototype,t,s)}}static getPropertyDescriptor(t,e,i){const{get:s,set:r}=d(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:s,set(e){const a=s?.call(this);r?.call(this,e),this.requestUpdate(t,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??F}static _$Ei(){if(this.hasOwnProperty(Q("elementProperties")))return;const t=g(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(Q("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Q("properties"))){const t=this.properties,e=[...h(t),...u(t)];for(const i of e)this.createProperty(i,t[i])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const i=this._$Eu(t,e);void 0!==i&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(o(t))}else void 0!==t&&e.push(o(t));return e}static _$Eu(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const i of e.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const i=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((i,s)=>{if(e)i.adoptedStyleSheets=s.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const e of s){const s=document.createElement("style"),r=t.litNonce;void 0!==r&&s.setAttribute("nonce",r),s.textContent=e.cssText,i.appendChild(s)}})(i,this.constructor.elementStyles),i}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$ET(t,e){const i=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,i);if(void 0!==s&&!0===i.reflect){const r=(void 0!==i.converter?.toAttribute?i.converter:B).toAttribute(e,i.type);this._$Em=t,null==r?this.removeAttribute(s):this.setAttribute(s,r),this._$Em=null}}_$AK(t,e){const i=this.constructor,s=i._$Eh.get(t);if(void 0!==s&&this._$Em!==s){const t=i.getPropertyOptions(s),r="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:B;this._$Em=s;const a=r.fromAttribute(e,t.type);this[s]=a??this._$Ej?.get(s)??a,this._$Em=null}}requestUpdate(t,e,i){if(void 0!==t){const s=this.constructor,r=this[t];if(i??=s.getPropertyOptions(t),!((i.hasChanged??U)(r,e)||i.useDefault&&i.reflect&&r===this._$Ej?.get(t)&&!this.hasAttribute(s._$Eu(t,i))))return;this.C(t,e,i)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:i,reflect:s,wrapped:r},a){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,a??e??this[t]),!0!==r||void 0!==a)||(this._$AL.has(t)||(this.hasUpdated||i||(e=void 0),this._$AL.set(t,e)),!0===s&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,i]of t){const{wrapped:t}=i,s=this[e];!0!==t||this._$AL.has(e)||void 0===s||this.C(e,void 0,i,s)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(e)):this._$EM()}catch(e){throw t=!1,this._$EM(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(t){}firstUpdated(t){}};I.elementStyles=[],I.shadowRootOptions={mode:"open"},I[Q("elementProperties")]=new Map,I[Q("finalized")]=new Map,y?.({ReactiveElement:I}),(p.reactiveElementVersions??=[]).push("2.1.1");
11
+ */Symbol.metadata??=Symbol("metadata"),p.litPropertyMetadata??=new WeakMap;let I=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=F){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const i=Symbol(),s=this.getPropertyDescriptor(t,i,e);void 0!==s&&c(this.prototype,t,s)}}static getPropertyDescriptor(t,e,i){const{get:s,set:r}=d(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:s,set(e){const a=s?.call(this);r?.call(this,e),this.requestUpdate(t,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??F}static _$Ei(){if(this.hasOwnProperty(B("elementProperties")))return;const t=g(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(B("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(B("properties"))){const t=this.properties,e=[...h(t),...u(t)];for(const i of e)this.createProperty(i,t[i])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const i=this._$Eu(t,e);void 0!==i&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(o(t))}else void 0!==t&&e.push(o(t));return e}static _$Eu(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const i of e.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const i=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((i,s)=>{if(e)i.adoptedStyleSheets=s.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const e of s){const s=document.createElement("style"),r=t.litNonce;void 0!==r&&s.setAttribute("nonce",r),s.textContent=e.cssText,i.appendChild(s)}})(i,this.constructor.elementStyles),i}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$ET(t,e){const i=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,i);if(void 0!==s&&!0===i.reflect){const r=(void 0!==i.converter?.toAttribute?i.converter:y).toAttribute(e,i.type);this._$Em=t,null==r?this.removeAttribute(s):this.setAttribute(s,r),this._$Em=null}}_$AK(t,e){const i=this.constructor,s=i._$Eh.get(t);if(void 0!==s&&this._$Em!==s){const t=i.getPropertyOptions(s),r="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:y;this._$Em=s;const a=r.fromAttribute(e,t.type);this[s]=a??this._$Ej?.get(s)??a,this._$Em=null}}requestUpdate(t,e,i){if(void 0!==t){const s=this.constructor,r=this[t];if(i??=s.getPropertyOptions(t),!((i.hasChanged??U)(r,e)||i.useDefault&&i.reflect&&r===this._$Ej?.get(t)&&!this.hasAttribute(s._$Eu(t,i))))return;this.C(t,e,i)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:i,reflect:s,wrapped:r},a){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,a??e??this[t]),!0!==r||void 0!==a)||(this._$AL.has(t)||(this.hasUpdated||i||(e=void 0),this._$AL.set(t,e)),!0===s&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,i]of t){const{wrapped:t}=i,s=this[e];!0!==t||this._$AL.has(e)||void 0===s||this.C(e,void 0,i,s)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(e)):this._$EM()}catch(e){throw t=!1,this._$EM(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(t){}firstUpdated(t){}};I.elementStyles=[],I.shadowRootOptions={mode:"open"},I[B("elementProperties")]=new Map,I[B("finalized")]=new Map,Q?.({ReactiveElement:I}),(p.reactiveElementVersions??=[]).push("2.1.1");
12
12
  /**
13
13
  * @license
14
14
  * Copyright 2017 Google LLC
@@ -19,7 +19,7 @@ const f=globalThis,C=f.trustedTypes,v=C?C.createPolicy("lit-html",{createHTML:t=
19
19
  * @license
20
20
  * Copyright 2017 Google LLC
21
21
  * SPDX-License-Identifier: BSD-3-Clause
22
- */class ct extends I{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=ot(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return J}}ct._$litElement$=!0,ct.finalized=!0,lt.litElementHydrateSupport?.({LitElement:ct});const dt=lt.litElementPolyfillSupport;function ht(t,e){return null==t||null==e?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function ut(t,e){return null==t||null==e?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function 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=ht,i=(e,i)=>ht(t(e),i),s=(e,i)=>t(e)-i):(e=t===ht||t===ut?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(ht).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",h=1===t||3===t?ft:Ct;function u(u){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=u.selection?u.selection():u,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")),u!==U&&(F=F.transition(u),I=I.transition(u),v=v.transition(u),A=A.transition(u),f=f.transition(u).attr("opacity",It).attr("transform",function(t){return isFinite(t=B(t))?h(t+l):this.getAttribute("transform")}),C.attr("opacity",It).attr("transform",function(t){var e=this.parentNode.__axis;return h((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 h(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 u.scale=function(t){return arguments.length?(e=t,u):e},u.ticks=function(){return i=Array.from(arguments),u},u.tickArguments=function(t){return arguments.length?(i=null==t?[]:Array.from(t),u):i.slice()},u.tickValues=function(t){return arguments.length?(s=null==t?null:Array.from(t),u):s&&s.slice()},u.tickFormat=function(t){return arguments.length?(r=t,u):r},u.tickSize=function(t){return arguments.length?(a=n=+t,u):a},u.tickSizeInner=function(t){return arguments.length?(a=+t,u):a},u.tickSizeOuter=function(t){return arguments.length?(n=+t,u):n},u.tickPadding=function(t){return arguments.length?(o=+t,u):o},u.offset=function(t){return arguments.length?(l=+t,u):l},u}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 Ht(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function $t(t){var e=Tt(t);return(e.local?Ht: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,h=e.length,u=a.length,g=new Array(h);for(o=0;o<h;++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<u;++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<h;++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 he(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function ue(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)||he(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 He(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 $e(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=he(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],h=r[c],u=h.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,h,m,b,l[c]=new Array(u),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],h=s[l],u=d.length,g=o[l]=new Array(u),p=0;p<u;++p)(c=d[p]||h[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?ue:"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:$t(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})},insert:function(t,e){var i="function"==typeof t?t:$t(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?$e:He,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,h=0;function u(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>h}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,h,g,p=c.copy(),m=Oe(a||i,e);if(null!=(g=n.call(t,new si("beforestart",{sourceEvent:i,target:u,identifier:r,active:d,x:m[0],y:m[1],dx:0,dy:0,dispatch:p}),s)))return o=g.x-m[0]||0,h=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:u,identifier:r,active:b,x:m[0]+o,y:m[1]+h,dx:m[0]-y[0],dy:m[1]-y[1],dispatch:p}),s)}}return u.filter=function(t){return arguments.length?(r="function"==typeof t?t:ii(!!t),u):r},u.container=function(t){return arguments.length?(a="function"==typeof t?t:ii(t),u):a},u.subject=function(t){return arguments.length?(n="function"==typeof t?t:ii(t),u):n},u.touchable=function(t){return arguments.length?(o="function"==typeof t?t:ii(!!t),u):o},u.on=function(){var t=c.on.apply(c,arguments);return t===c?u:t},u.clickDistance=function(t){return arguments.length?(h=(t=+t)*t,u):Math.sqrt(h)},u}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 hi(){}si.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};var ui=.7,gi=1/ui,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 hi||(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 Hi(t,e,i,s)}function Vi(t){if(t instanceof Hi)return new Hi(t.h,t.s,t.l,t.opacity);if(t instanceof hi||(t=xi(t)),!t)return new Hi;if(t instanceof Hi)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 Hi(n,o,l,t.opacity)}function Hi(t,e,i,s){this.h=+t,this.s=+e,this.l=+i,this.opacity=+s}function $i(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(hi,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(hi,{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?ui:Math.pow(ui,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(Hi,function(t,e,i,s){return 1===arguments.length?Vi(t):new Hi(t,e,i,null==s?1:s)},di(hi,{brighter(t){return t=null==t?gi:Math.pow(gi,t),new Hi(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?ui:Math.pow(ui,t),new Hi(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 Hi($i(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("}${$i(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)"),hs=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)},", ",")",")"),us=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,us=gs=0;try{!function(){Us(),++us;for(var t,e=ls;e;)(t=bs-e._time)>=0&&e._call.call(void 0,t),e=e._next;--us}()}finally{us=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){us||(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)),us=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,h,u;if(1!==i.state)return l();for(c in r)if((u=r[c]).name===i.name){if(3===u.state)return xs(n);4===u.state?(u.state=6,u.timer.stop(),u.on.call("interrupt",t,t.__data__,u.index,u.group),delete r[c]):+c<e&&(u.state=6,u.timer.stop(),u.on.call("cancel",t,t.__data__,u.index,u.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(h=i.tween.length),c=0,d=-1;c<h;++c)(u=i.tween[c].value.call(t,t.__data__,i.index,i.group))&&(s[++d]=u);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 Hs(t){return function(){this.removeAttributeNS(t.space,t.local)}}function $s(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,h=a[n]=new Array(d),u=0;u<d;++u)(o=c[u])&&(l=t.call(o,o.__data__,u,c))&&("__data__"in o&&(l.__data__=o.__data__),h[u]=l,Ss(h[u],e,i,u,h,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,h=0;h<d;++h)if(l=c[h]){for(var u,g=t.call(l,l.__data__,h,c),p=ws(l,i),m=0,b=g.length;m<b;++m)(u=g[m])&&Ss(u,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],h=c.length,u=n[o]=new Array(h),g=0;g<h;++g)(l=c[g]||d[g])&&(u[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?hs:Ts;return this.attrTween(t,"function"==typeof e?(i.local?Ys:Gs)(i,s,ks(this,"attr."+t,e)):null==e?(i.local?Hs:Vs)(i):(i.local?zs:$s)(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 hr{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,h=c*c+d*d;if(null===this._x1)this._append`M${this._x1=t},${this._y1=e}`;else if(h>lr)if(Math.abs(d*o-l*c)>lr&&r){let u=i-a,g=s-n,p=o*o+l*l,m=u*u+g*g,b=Math.sqrt(p),y=Math.sqrt(h),Q=r*Math.tan((nr-Math.acos((p+h-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*u>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,h=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&&(h<0&&(h=h%or+or),h>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}`:h>lr&&this._append`A${i},${i},0,${+(h>=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 ur(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=ur(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=ur(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=ur(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")+ur(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 h(t){var e=(t=br(t)).fill,i=t.align,h=t.sign,u=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="$"===u?r:"#"===u&&/[boxX]/.test(Q)?"0"+Q.toLowerCase():"",U="$"===u?a:/[%p]/.test(Q)?l:"",F=Br[Q],I=/[defgprs%]/.test(Q);function f(t){var r,a,l,u=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&&"+"!==h&&(C=!1),u=(C?"("===h?h:c:"-"===h||"("===h?"":h)+u,f=("s"===Q?vr[8+pr/3]:"")+f+(C&&"("===h?")":""),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=u.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=u+t+f+A;break;case"=":t=u+A+t+f;break;case"^":t=A.slice(0,v=A.length>>1)+u+t+f+A.slice(v);break;default:t=A+u+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:h,formatPrefix:function(t,e){var i=h(((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 Hr(){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,h}function h(e){return null==e||isNaN(e=+e)?i:(r||(r=s(n.map(t),o,l)))(t(c(e)))}return h.invert=function(i){return c(e((a||(a=s(o,n.map(t),Pi)))(i)))},h.domain=function(t){return arguments.length?(n=Array.from(t,wr),d()):n.slice()},h.range=function(t){return arguments.length?(o=Array.from(t),d()):o.slice()},h.rangeRound=function(t){return o=Array.from(t),l=is,d()},h.clamp=function(t){return arguments.length?(c=!!t||Mr,d()):c!==Mr},h.interpolate=function(t){return arguments.length?(l=t,d()):l},h.unknown=function(t){return arguments.length?(i=t,h):i},function(i,s){return t=i,e=s,d()}}function $r(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 $r(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=Hr()(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 hr(e)}(o);function o(o){var l,c,d,h=(o=function(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}(o)).length,u=!1;for(null==s&&(a=r(d=n())),l=0;l<=h;++l)!(l<h&&i(c=o[l],l,o))===u&&((u=!u)?a.lineStart():a.lineEnd()),u&&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],h=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?`${-h.y}px ${h.y/2}px ${h.b}px ${h.s}px`:`${h.y/2}px ${h.y}px ${h.b}px ${h.s}px`} ${l}`}static get svgFilters(){const t=Pr.shadows,e=t.elevations.map(e=>X`
22
+ */class ct extends I{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=ot(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return J}}ct._$litElement$=!0,ct.finalized=!0,lt.litElementHydrateSupport?.({LitElement:ct});const dt=lt.litElementPolyfillSupport;function ht(t,e){return null==t||null==e?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function ut(t,e){return null==t||null==e?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function 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=ht,i=(e,i)=>ht(t(e),i),s=(e,i)=>t(e)-i):(e=t===ht||t===ut?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(ht).right;gt(function(t){return null===t?NaN:+t}).center;const bt=Math.sqrt(50),Qt=Math.sqrt(10),Bt=Math.sqrt(2);function yt(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>=Qt?5:a>=Bt?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?yt(t,e,2*i):[o,l,c]}function Ut(t,e,i){return yt(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",h=1===t||3===t?ft:Ct;function u(u){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(),Q=+b[0]+l,B=+b[b.length-1]+l,y=(e.bandwidth?At:vt)(e.copy(),l),U=u.selection?u.selection():u,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")),u!==U&&(F=F.transition(u),I=I.transition(u),v=v.transition(u),A=A.transition(u),f=f.transition(u).attr("opacity",It).attr("transform",function(t){return isFinite(t=y(t))?h(t+l):this.getAttribute("transform")}),C.attr("opacity",It).attr("transform",function(t){var e=this.parentNode.__axis;return h((e&&isFinite(e=e(t))?e:y(t))+l)})),f.remove(),F.attr("d",4===t||2===t?n?"M"+c*n+","+Q+"H"+l+"V"+B+"H"+c*n:"M"+l+","+Q+"V"+B:n?"M"+Q+","+c*n+"V"+l+"H"+B+"V"+c*n:"M"+Q+","+l+"H"+B),I.attr("opacity",1).attr("transform",function(t){return h(y(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=y})}return u.scale=function(t){return arguments.length?(e=t,u):e},u.ticks=function(){return i=Array.from(arguments),u},u.tickArguments=function(t){return arguments.length?(i=null==t?[]:Array.from(t),u):i.slice()},u.tickValues=function(t){return arguments.length?(s=null==t?null:Array.from(t),u):s&&s.slice()},u.tickFormat=function(t){return arguments.length?(r=t,u):r},u.tickSize=function(t){return arguments.length?(a=n=+t,u):a},u.tickSizeInner=function(t){return arguments.length?(a=+t,u):a},u.tickSizeOuter=function(t){return arguments.length?(n=+t,u):n},u.tickPadding=function(t){return arguments.length?(o=+t,u):o},u.offset=function(t){return arguments.length?(l=+t,u):l},u}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 Ht(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function $t(t){var e=Tt(t);return(e.local?Ht: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,h=e.length,u=a.length,g=new Array(h);for(o=0;o<h;++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<u;++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<h;++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 he(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function ue(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)||he(t).getComputedStyle(t,null).getPropertyValue(e)}function be(t){return function(){delete this[t]}}function Qe(t,e){return function(){this[t]=e}}function Be(t,e){return function(){var i=e.apply(this,arguments);null==i?delete this[t]:this[t]=i}}function ye(t){return t.trim().split(/^|\s+/)}function Ue(t){return t.classList||new Fe(t)}function Fe(t){this._node=t,this._names=ye(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 He(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 $e(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=he(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],h=r[c],u=h.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,h,m,b,l[c]=new Array(u),g,e);for(var Q,B,y=0,U=0;y<p;++y)if(Q=m[y]){for(y>=U&&(U=y+1);!(B=b[U])&&++U<p;);Q._next=B||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],h=s[l],u=d.length,g=o[l]=new Array(u),p=0;p<u;++p)(c=d[p]||h[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?ue:"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?Be:Qe)(t,e)):this.node()[t]},classed:function(t,e){var i=ye(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:$t(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})},insert:function(t,e){var i="function"==typeof t?t:$t(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?$e:He,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,h=0;function u(t){t.on("mousedown.drag",g).filter(o).on("touchstart.drag",b).on("touchmove.drag",Q,je).on("touchend.drag touchcancel.drag",B).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=y(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>h}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=y(this,o,t,e,n[i].identifier,n[i]))&&(ti(t),s("start",t,n[i]))}}function Q(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 B(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 y(t,e,i,s,r,a){var o,h,g,p=c.copy(),m=Oe(a||i,e);if(null!=(g=n.call(t,new si("beforestart",{sourceEvent:i,target:u,identifier:r,active:d,x:m[0],y:m[1],dx:0,dy:0,dispatch:p}),s)))return o=g.x-m[0]||0,h=g.y-m[1]||0,function i(a,n,c){var b,Q=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:u,identifier:r,active:b,x:m[0]+o,y:m[1]+h,dx:m[0]-Q[0],dy:m[1]-Q[1],dispatch:p}),s)}}return u.filter=function(t){return arguments.length?(r="function"==typeof t?t:ii(!!t),u):r},u.container=function(t){return arguments.length?(a="function"==typeof t?t:ii(t),u):a},u.subject=function(t){return arguments.length?(n="function"==typeof t?t:ii(t),u):n},u.touchable=function(t){return arguments.length?(o="function"==typeof t?t:ii(!!t),u):o},u.on=function(){var t=c.on.apply(c,arguments);return t===c?u:t},u.clickDistance=function(t){return arguments.length?(h=(t=+t)*t,u):Math.sqrt(h)},u}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 hi(){}si.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};var ui=.7,gi=1/ui,pi="\\s*([+-]?\\d+)\\s*",mi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",bi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Qi=/^#([0-9a-f]{3,8})$/,Bi=new RegExp(`^rgb\\(${pi},${pi},${pi}\\)$`),yi=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=Qi.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=Bi.exec(t))?new Ni(e[1],e[2],e[3],1):(e=yi.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 hi||(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 Hi(t,e,i,s)}function Vi(t){if(t instanceof Hi)return new Hi(t.h,t.s,t.l,t.opacity);if(t instanceof hi||(t=xi(t)),!t)return new Hi;if(t instanceof Hi)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 Hi(n,o,l,t.opacity)}function Hi(t,e,i,s){this.h=+t,this.s=+e,this.l=+i,this.opacity=+s}function $i(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(hi,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(hi,{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?ui:Math.pow(ui,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(Hi,function(t,e,i,s){return 1===arguments.length?Vi(t):new Hi(t,e,i,null==s?1:s)},di(hi,{brighter(t){return t=null==t?gi:Math.pow(gi,t),new Hi(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?ui:Math.pow(ui,t),new Hi(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 Hi($i(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("}${$i(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)"),hs=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)},", ",")",")"),us=0,gs=0,ps=0,ms=0,bs=0,Qs=0,Bs="object"==typeof performance&&performance.now?performance:Date,ys="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Us(){return bs||(ys(Fs),bs=Bs.now()+Qs)}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=Bs.now())+Qs,us=gs=0;try{!function(){Us(),++us;for(var t,e=ls;e;)(t=bs-e._time)>=0&&e._call.call(void 0,t),e=e._next;--us}()}finally{us=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=Bs.now(),e=t-ms;e>1e3&&(Qs-=e,ms=t)}function As(t){us||(gs&&(gs=clearTimeout(gs)),t-bs>24?(t<1/0&&(gs=setTimeout(Cs,t-Bs.now()-Qs)),ps&&(ps=clearInterval(ps))):(ps||(ms=Bs.now(),ps=setInterval(vs,1e3)),us=1,ys(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,h,u;if(1!==i.state)return l();for(c in r)if((u=r[c]).name===i.name){if(3===u.state)return xs(n);4===u.state?(u.state=6,u.timer.stop(),u.on.call("interrupt",t,t.__data__,u.index,u.group),delete r[c]):+c<e&&(u.state=6,u.timer.stop(),u.on.call("cancel",t,t.__data__,u.index,u.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(h=i.tween.length),c=0,d=-1;c<h;++c)(u=i.tween[c].value.call(t,t.__data__,i.index,i.group))&&(s[++d]=u);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 Hs(t){return function(){this.removeAttributeNS(t.space,t.local)}}function $s(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,h=a[n]=new Array(d),u=0;u<d;++u)(o=c[u])&&(l=t.call(o,o.__data__,u,c))&&("__data__"in o&&(l.__data__=o.__data__),h[u]=l,Ss(h[u],e,i,u,h,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,h=0;h<d;++h)if(l=c[h]){for(var u,g=t.call(l,l.__data__,h,c),p=ws(l,i),m=0,b=g.length;m<b;++m)(u=g[m])&&Ss(u,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],h=c.length,u=n[o]=new Array(h),g=0;g<h;++g)(l=c[g]||d[g])&&(u[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?hs:Ts;return this.attrTween(t,"function"==typeof e?(i.local?Ys:Gs)(i,s,ks(this,"attr."+t,e)):null==e?(i.local?Hs:Vs)(i):(i.local?zs:$s)(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 hr{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,h=c*c+d*d;if(null===this._x1)this._append`M${this._x1=t},${this._y1=e}`;else if(h>lr)if(Math.abs(d*o-l*c)>lr&&r){let u=i-a,g=s-n,p=o*o+l*l,m=u*u+g*g,b=Math.sqrt(p),Q=Math.sqrt(h),B=r*Math.tan((nr-Math.acos((p+h-m)/(2*b*Q)))/2),y=B/Q,U=B/b;Math.abs(y-1)>lr&&this._append`L${t+y*c},${e+y*d}`,this._append`A${r},${r},0,0,${+(d*u>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,h=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&&(h<0&&(h=h%or+or),h>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}`:h>lr&&this._append`A${i},${i},0,${+(h>=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 ur(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=ur(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 Qr({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 Qr(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 Br(t,e){var i=ur(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=Qr.prototype,Qr.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 yr={"%":(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)=>Br(100*t,e),r:Br,s:function(t,e){var i=ur(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")+ur(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 h(t){var e=(t=br(t)).fill,i=t.align,h=t.sign,u=t.symbol,g=t.zero,p=t.width,m=t.comma,b=t.precision,Q=t.trim,B=t.type;"n"===B?(m=!0,B="g"):yr[B]||(void 0===b&&(b=12),Q=!0,B="g"),(g||"0"===e&&"="===i)&&(g=!0,e="0",i="=");var y="$"===u?r:"#"===u&&/[boxX]/.test(B)?"0"+B.toLowerCase():"",U="$"===u?a:/[%p]/.test(B)?l:"",F=yr[B],I=/[defgprs%]/.test(B);function f(t){var r,a,l,u=y,f=U;if("c"===B)f=F(t)+f,t="";else{var C=(t=+t)<0||1/t<0;if(t=isNaN(t)?d:F(Math.abs(t),b),Q&&(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&&"+"!==h&&(C=!1),u=(C?"("===h?h:c:"-"===h||"("===h?"":h)+u,f=("s"===B?vr[8+pr/3]:"")+f+(C&&"("===h?")":""),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=u.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=u+t+f+A;break;case"=":t=u+A+t+f;break;case"^":t=A.slice(0,v=A.length>>1)+u+t+f+A.slice(v);break;default:t=A+u+t+f}return o(t)}return b=void 0===b?6:/[gprs]/.test(B)?Math.max(1,Math.min(21,b)):Math.max(0,Math.min(20,b)),f.toString=function(){return t+""},f}return{format:h,formatPrefix:function(t,e){var i=h(((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 Hr(){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,h}function h(e){return null==e||isNaN(e=+e)?i:(r||(r=s(n.map(t),o,l)))(t(c(e)))}return h.invert=function(i){return c(e((a||(a=s(o,n.map(t),Pi)))(i)))},h.domain=function(t){return arguments.length?(n=Array.from(t,wr),d()):n.slice()},h.range=function(t){return arguments.length?(o=Array.from(t),d()):o.slice()},h.rangeRound=function(t){return o=Array.from(t),l=is,d()},h.clamp=function(t){return arguments.length?(c=!!t||Mr,d()):c!==Mr},h.interpolate=function(t){return arguments.length?(l=t,d()):l},h.unknown=function(t){return arguments.length?(i=t,h):i},function(i,s){return t=i,e=s,d()}}function $r(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?yt(e,t,i):yt(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 $r(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=Hr()(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 hr(e)}(o);function o(o){var l,c,d,h=(o=function(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}(o)).length,u=!1;for(null==s&&(a=r(d=n())),l=0;l<=h;++l)!(l<h&&i(c=o[l],l,o))===u&&((u=!u)?a.lineStart():a.lineEnd()),u&&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()}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){const i=this.shadows.opacityUmbra+this.shadows.opacityBoost,s=this.shadows.opacityPenumbra+this.shadows.opacityBoost,r=this.shadows.opacityAmbient+this.shadows.opacityBoost,a=e?`rgba(${this.shadows.inverseBaselineColorString}, ${i})`:`rgba(${this.shadows.baselineColorString}, ${i})`,n=e?`rgba(${this.shadows.inverseBaselineColorString}, ${s})`:`rgba(${this.shadows.baselineColorString}, ${s})`,o=e?`rgba(${this.shadows.inverseBaselineColorString}, ${r})`:`rgba(${this.shadows.baselineColorString}, ${r})`,l=this.shadows.mapUmbra[t],c=this.shadows.mapPenumbra[t],d=this.shadows.mapAmbient[t];return`${`${l.y/2}px ${l.y}px ${l.b}px ${l.s}px`} ${a}, ${`${c.y/2}px ${c.y}px ${c.b}px ${c.s}px`} ${n}, ${`${d.y/2}px ${d.y}px ${d.b}px ${d.s}px`} ${o}`}static get svgFilters(){const t=Pr.shadows,e=t.elevations.map(e=>X`
23
23
  <filter id=${`shadow-${e}`} filterUnits="userSpaceOnUse" x="-100%" y="-100%" width="200%" height="200%">
24
24
  <feComponentTransfer in="SourceAlpha" result="solid">
25
25
  <feFuncA type="table" tableValues="0 1 1"/>
@@ -122,49 +122,58 @@ const f=globalThis,C=f.trustedTypes,v=C?C.createPolicy("lit-html",{createHTML:t=
122
122
  button {
123
123
  width: 100%;
124
124
  height: 100%;
125
+
125
126
  padding: 0.375rem 0.75rem;
126
127
 
127
128
  font-family: var(---font-family-base);
128
129
  font-size: 1.125rem;
130
+
129
131
  line-height: 1.5;
132
+
130
133
  color: var(---color-text-inverse);
131
134
 
135
+ outline: none;
136
+
132
137
  border: 0;
133
138
  border-radius: var(---border-radius);
134
- outline: none;
135
139
  }
136
140
 
137
141
  button:disabled {
138
- background-color: var(---decidables-button-background-color-disabled);
139
142
  outline: none;
143
+
144
+ background-color: var(---decidables-button-background-color-disabled);
140
145
  box-shadow: none;
141
146
  }
142
147
 
143
148
  button:enabled {
144
149
  cursor: pointer;
150
+ outline: none;
145
151
 
146
152
  background-color: var(---decidables-button-background-color-enabled);
147
- outline: none;
148
153
  box-shadow: var(---shadow-2);
149
154
  }
150
155
 
151
156
  button:enabled:hover {
152
157
  outline: none;
158
+
153
159
  box-shadow: var(---shadow-4);
154
160
  }
155
161
 
156
162
  button:enabled:active {
157
163
  outline: none;
164
+
158
165
  box-shadow: var(---shadow-8);
159
166
  }
160
167
 
161
- :host(.keyboard) button:enabled:focus {
168
+ button:enabled:focus-visible {
162
169
  outline: none;
170
+
163
171
  box-shadow: var(---shadow-4);
164
172
  }
165
173
 
166
- :host(.keyboard) button:enabled:focus:active {
174
+ button:enabled:focus-visible:active {
167
175
  outline: none;
176
+
168
177
  box-shadow: var(---shadow-8);
169
178
  }
170
179
  `]}render(){return Y`
@@ -183,10 +192,6 @@ const Or=t=>t??W;customElements.define("decidables-slider",class extends Pr{stat
183
192
  ---decidables-slider-color: var(--decidables-slider-color, var(---color-element-enabled));
184
193
  ---decidables-spinner-background-color: var(--decidables-slider-background-color, none);
185
194
 
186
- ---shadow-2-rotate: var(--shadow-2-rotate, ${a(this.cssBoxShadow(2,!0,!1))});
187
- ---shadow-4-rotate: var(--shadow-4-rotate, ${a(this.cssBoxShadow(4,!0,!1))});
188
- ---shadow-8-rotate: var(--shadow-8-rotate, ${a(this.cssBoxShadow(8,!0,!1))});
189
-
190
195
  display: flex;
191
196
 
192
197
  flex-direction: column;
@@ -201,12 +206,14 @@ const Or=t=>t??W;customElements.define("decidables-slider",class extends Pr{stat
201
206
 
202
207
  .range {
203
208
  position: relative;
209
+
204
210
  display: flex;
205
211
 
206
212
  flex-direction: row;
207
213
 
208
214
  width: 3.5rem;
209
215
  height: 4.75rem;
216
+
210
217
  margin: 0 0.25rem 0.25rem;
211
218
  }
212
219
 
@@ -218,21 +225,20 @@ const Or=t=>t??W;customElements.define("decidables-slider",class extends Pr{stat
218
225
  background: var(---decidables-spinner-background-color);
219
226
  }
220
227
 
221
- /* Adapted from http://danielstern.ca/range.css/#/ */
222
228
  /* Overall */
223
229
  input[type=range] {
224
- width: 4.75rem;
225
- height: 3.5rem;
230
+ width: 3.5rem;
231
+ height: 4.75rem;
232
+
226
233
  padding: 0;
227
234
  margin: 0;
235
+
236
+ appearance: none;
228
237
 
229
238
  background-color: unset;
230
239
 
231
- transform: rotate(-90deg);
232
- transform-origin: 2.375rem 2.375rem;
233
-
234
- /* stylelint-disable-next-line property-no-vendor-prefix */
235
- -webkit-appearance: none;
240
+ direction: rtl;
241
+ writing-mode: vertical-lr;
236
242
  }
237
243
 
238
244
  input[type=range]:enabled {
@@ -243,16 +249,10 @@ const Or=t=>t??W;customElements.define("decidables-slider",class extends Pr{stat
243
249
  outline: none;
244
250
  }
245
251
 
246
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
247
- input[type=range]::-ms-tooltip {
248
- display: none;
249
- }
250
-
251
252
  /* Track */
252
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
253
253
  input[type=range]::-webkit-slider-runnable-track {
254
- width: 100%;
255
- height: 4px;
254
+ width: 4px;
255
+ height: 100%;
256
256
 
257
257
  background: var(---decidables-slider-background-color);
258
258
  border: 0;
@@ -264,10 +264,9 @@ const Or=t=>t??W;customElements.define("decidables-slider",class extends Pr{stat
264
264
  background: var(---decidables-slider-background-color);
265
265
  }
266
266
 
267
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
268
267
  input[type=range]::-moz-range-track {
269
- width: 100%;
270
- height: 4px;
268
+ width: 4px;
269
+ height: 100%;
271
270
 
272
271
  background: var(---decidables-slider-background-color);
273
272
  border: 0;
@@ -275,57 +274,17 @@ const Or=t=>t??W;customElements.define("decidables-slider",class extends Pr{stat
275
274
  box-shadow: none;
276
275
  }
277
276
 
278
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
279
- input[type=range]::-ms-track {
280
- width: 100%;
281
- height: 4px;
282
-
283
- color: transparent;
284
-
285
- background: transparent;
286
- border-color: transparent;
287
- }
288
-
289
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
290
- input[type=range]::-ms-fill-lower {
291
- background: #cccccc;
292
- /* background: var(---decidables-slider-background-color); */
293
- border: 0;
294
- border-radius: 2px;
295
- box-shadow: none;
296
- }
297
-
298
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
299
- input[type=range]::-ms-fill-upper {
300
- background: #cccccc;
301
- /* background: var(---decidables-slider-background-color); */
302
- border: 0;
303
- border-radius: 2px;
304
- box-shadow: none;
305
- }
306
-
307
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
308
- input[type=range]:focus::-ms-fill-lower {
309
- background: var(---decidables-slider-background-color);
310
- }
311
-
312
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
313
- input[type=range]:focus::-ms-fill-upper {
314
- background: var(---decidables-slider-background-color);
315
- }
316
-
317
277
  /* Thumb */
318
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
319
278
  input[type=range]::-webkit-slider-thumb {
320
- width: 10px;
321
- height: 20px;
322
- margin-top: -8px;
279
+ width: 20px;
280
+ height: 10px;
281
+
282
+ margin-left: -8px;
283
+
284
+ appearance: none;
323
285
 
324
286
  border: 0;
325
287
  border-radius: 4px;
326
-
327
- /* stylelint-disable-next-line property-no-vendor-prefix */
328
- -webkit-appearance: none;
329
288
  }
330
289
 
331
290
  input[type=range]:disabled::-webkit-slider-thumb {
@@ -335,112 +294,65 @@ const Or=t=>t??W;customElements.define("decidables-slider",class extends Pr{stat
335
294
 
336
295
  input[type=range]:enabled::-webkit-slider-thumb {
337
296
  background: var(---decidables-slider-color);
338
- box-shadow: var(---shadow-2-rotate);
297
+ box-shadow: var(---shadow-2);
339
298
  }
340
299
 
341
300
  input[type=range]:enabled:hover::-webkit-slider-thumb {
342
- box-shadow: var(---shadow-4-rotate);
301
+ box-shadow: var(---shadow-4);
343
302
  }
344
303
 
345
304
  input[type=range]:enabled:active::-webkit-slider-thumb {
346
- box-shadow: var(---shadow-8-rotate);
305
+ box-shadow: var(---shadow-8);
347
306
  }
348
307
 
349
- :host(.keyboard) input[type=range]:enabled:focus::-webkit-slider-thumb {
350
- box-shadow: var(---shadow-4-rotate);
308
+ input[type=range]:enabled:focus-visible::-webkit-slider-thumb {
309
+ box-shadow: var(---shadow-4);
351
310
  }
352
311
 
353
- :host(.keyboard) input[type=range]:focus:active::-webkit-slider-thumb {
354
- box-shadow: var(---shadow-8-rotate);
312
+ input[type=range]:enabled:focus-visible:active::-webkit-slider-thumb {
313
+ box-shadow: var(---shadow-8);
355
314
  }
356
315
 
357
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
358
316
  input[type=range]::-moz-range-thumb {
359
- width: 10px;
360
- height: 20px;
317
+ width: 20px;
318
+ height: 10px;
361
319
 
362
320
  border: 0;
363
321
  border-radius: 4px;
364
322
  }
365
323
 
366
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
367
324
  input[type=range]:disabled::-moz-range-thumb {
368
325
  background: var(---decidables-slider-background-color);
369
326
  box-shadow: none;
370
327
  }
371
328
 
372
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
373
329
  input[type=range]:enabled::-moz-range-thumb {
374
330
  background: var(---decidables-slider-color);
375
- box-shadow: var(---shadow-2-rotate);
331
+ box-shadow: var(---shadow-2);
376
332
  }
377
333
 
378
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
379
334
  input[type=range]:enabled:hover::-moz-range-thumb {
380
- box-shadow: var(---shadow-4-rotate);
335
+ box-shadow: var(---shadow-4);
381
336
  }
382
337
 
383
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
384
338
  input[type=range]:enabled:active::-moz-range-thumb {
385
- box-shadow: var(---shadow-8-rotate);
386
- }
387
-
388
- :host(.keyboard) input[type=range]:enabled:focus::-moz-range-thumb {
389
- box-shadow: var(---shadow-4-rotate);
390
- }
391
-
392
- :host(.keyboard) input[type=range]:enabled:focus:active::-moz-range-thumb {
393
- box-shadow: var(---shadow-8-rotate);
394
- }
395
-
396
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
397
- input[type=range]::-ms-thumb {
398
- width: 10px;
399
- height: 20px;
400
- margin-top: 0;
401
-
402
- background: #999999;
403
- /* background: var(---color-element-enabled); */
404
- border: 0;
405
- border-radius: 4px;
406
- box-shadow: var(---shadow-2-rotate);
407
- }
408
-
409
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
410
- input[type=range]:disabled::-ms-thumb {
411
- background: var(---decidables-slider-background-color);
412
- box-shadow: none;
413
- }
414
-
415
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
416
- input[type=range]:enabled::-ms-thumb {
417
- background: var(---decidables-slider-color);
418
- box-shadow: var(---shadow-2-rotate);
419
- }
420
-
421
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
422
- input[type=range]:enabled:hover::-ms-thumb {
423
- box-shadow: var(---shadow-4-rotate);
424
- }
425
-
426
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
427
- input[type=range]:enabled:active::-ms-thumb {
428
- box-shadow: var(---shadow-8-rotate);
339
+ box-shadow: var(---shadow-8);
429
340
  }
430
341
 
431
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
432
- :host(.keyboard) input[type=range]:enabled:focus::-ms-thumb {
433
- box-shadow: var(---shadow-4-rotate);
342
+ input[type=range]:enabled:focus-visible::-moz-range-thumb {
343
+ box-shadow: var(---shadow-4);
434
344
  }
435
345
 
436
- :host(.keyboard) input[type=range]:enabled:focus:active::-ms-thumb {
437
- box-shadow: var(---shadow-8-rotate);
346
+ input[type=range]:enabled:focus-visible:active::-moz-range-thumb {
347
+ box-shadow: var(---shadow-8);
438
348
  }
439
349
 
440
- datalist {
350
+ /* Tick marks */
351
+ .datalist {
441
352
  position: absolute;
442
353
  left: 2rem;
443
354
  z-index: -1;
355
+
444
356
  display: flex;
445
357
 
446
358
  flex-direction: column;
@@ -453,14 +365,13 @@ const Or=t=>t??W;customElements.define("decidables-slider",class extends Pr{stat
453
365
  font-size: 0.75rem;
454
366
  }
455
367
 
456
- option {
457
- padding: 0;
458
-
368
+ .option {
459
369
  line-height: 0.8;
460
- min-block-size: 0;
370
+
371
+ white-space: nowrap;
461
372
  }
462
373
 
463
- option::before {
374
+ .option::before {
464
375
  content: "– ";
465
376
  }
466
377
  `]}render(){return Y`
@@ -470,10 +381,10 @@ const Or=t=>t??W;customElements.define("decidables-slider",class extends Pr{stat
470
381
  <div class="range">
471
382
  <input ?disabled=${this.disabled} type="range" id="slider" min=${Or(this.rangeMin)} max=${Or(this.rangeMax)} step=${Or(this.rangeStep)} .value=${this.rangeValue} @change=${this.rangeChanged.bind(this)} @input=${this.rangeInputted.bind(this)}>
472
383
  ${this.scale?Y`
473
- <datalist id="ticks">
474
- <option value=${Or(this.rangeMax)} label=${Or(this.max)}></option>
475
- <option value=${Or(this.rangeMin)} label=${Or(this.min)}></option>
476
- </datalist>
384
+ <div class="datalist">
385
+ <div class="option">${Or(this.max)}</div>
386
+ <div class="option">${Or(this.min)}</div>
387
+ </div>
477
388
  `:Y``}
478
389
  </div>
479
390
  <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>
@@ -484,13 +395,14 @@ const Or=t=>t??W;customElements.define("decidables-slider",class extends Pr{stat
484
395
  ---decidables-spinner-prefix: var(--decidables-spinner-prefix, "");
485
396
 
486
397
  ---decidables-spinner-postfix: var(--decidables-spinner-postfix, "");
487
- ---decidables-spinner-postfix-padding: var(--decidables-spinner-postfix-padding, 0);
398
+ ---decidables-spinner-postfix-padding: var(--decidables-spinner-postfix-padding, 0rem);
488
399
 
489
400
  display: block;
490
401
  }
491
402
 
492
403
  label {
493
404
  position: relative;
405
+
494
406
  display: flex;
495
407
 
496
408
  flex-direction: column;
@@ -508,6 +420,7 @@ const Or=t=>t??W;customElements.define("decidables-slider",class extends Pr{stat
508
420
  left: calc(50% - var(---decidables-spinner-input-width) / 2 + 0.25rem);
509
421
 
510
422
  font-size: var(---decidables-spinner-font-size);
423
+
511
424
  line-height: normal;
512
425
 
513
426
  content: var(---decidables-spinner-prefix);
@@ -519,6 +432,7 @@ const Or=t=>t??W;customElements.define("decidables-slider",class extends Pr{stat
519
432
  bottom: 1px;
520
433
 
521
434
  font-size: var(---decidables-spinner-font-size);
435
+
522
436
  line-height: normal;
523
437
 
524
438
  content: var(---decidables-spinner-postfix);
@@ -526,20 +440,24 @@ const Or=t=>t??W;customElements.define("decidables-slider",class extends Pr{stat
526
440
 
527
441
  input[type=number] {
528
442
  width: var(---decidables-spinner-input-width);
529
- padding-right: var(---decidables-spinner-postfix-padding);
443
+
444
+ padding: 1px var(---decidables-spinner-postfix-padding) 1px 2px;
445
+ margin: 0;
530
446
 
531
447
  font-family: var(---font-family-base);
532
448
  font-size: var(---decidables-spinner-font-size);
449
+
533
450
  color: inherit;
451
+
534
452
  text-align: right;
535
453
 
454
+ appearance: none;
455
+ outline: none;
456
+
536
457
  background: none;
537
458
  border: 0;
538
459
  border-radius: 0;
539
- outline: none;
540
460
  box-shadow: var(---shadow-2);
541
-
542
- -webkit-appearance: none; /* stylelint-disable-line property-no-vendor-prefix */
543
461
  }
544
462
 
545
463
  input[type=number]:hover {
@@ -556,20 +474,54 @@ const Or=t=>t??W;customElements.define("decidables-slider",class extends Pr{stat
556
474
 
557
475
  border: 0;
558
476
  box-shadow: none;
477
+ }
478
+
479
+ /* HACK: Manage spinners in Firefox */
480
+ @supports (-moz-appearance: textfield) {
481
+ input[type=number] {
482
+ padding-right: calc(18px + var(---decidables-spinner-postfix-padding));
483
+
484
+ appearance: textfield;
485
+ }
486
+
487
+ input[type=number]:hover,
488
+ input[type=number]:focus,
489
+ input[type=number]:active {
490
+ padding-right: var(---decidables-spinner-postfix-padding);
491
+
492
+ appearance: none;
493
+ }
494
+
495
+ input[type=number]:disabled {
496
+ padding-right: calc(18px + var(---decidables-spinner-postfix-padding));
497
+
498
+ appearance: textfield;
499
+ }
500
+ }
501
+
502
+ /* HACK: Manage spinners in Chrome/Edge/Safari */
503
+ input[type=number]::-webkit-inner-spin-button {
504
+ /* Avoid oversized spinners in Safari */
505
+ font-size: 1.125rem;
559
506
 
560
- /* HACK: Use correct text color in Safari */
561
- -webkit-opacity: 1;
562
- /* HACK: Hide spinners in disabled input for Firefox and Safari */
563
- -moz-appearance: textfield; /* stylelint-disable-line property-no-vendor-prefix */
564
- /* HACK: Use correct text color in Safari */
565
- -webkit-text-fill-color: var(---color-text);
507
+ opacity: 0;
508
+ }
509
+
510
+ input[type=number]:hover::-webkit-inner-spin-button,
511
+ input[type=number]:focus::-webkit-inner-spin-button,
512
+ input[type=number]:active::-webkit-inner-spin-button {
513
+ opacity: 1;
566
514
  }
567
515
 
568
- /* HACK: Hide spinners in disabled input for Firefox and Safari */
569
- input[type=number]:disabled::-webkit-outer-spin-button,
570
516
  input[type=number]:disabled::-webkit-inner-spin-button {
571
- margin: 0;
572
- -webkit-appearance: none; /* stylelint-disable-line property-no-vendor-prefix */
517
+ opacity: 0;
518
+ }
519
+
520
+ /* HACK: Adjust padding on mobile w/o spinners */
521
+ @media only screen and (hover: none) and (pointer: coarse) {
522
+ input[type=number] {
523
+ padding-right: calc(1.125rem + var(---decidables-spinner-postfix-padding));
524
+ }
573
525
  }
574
526
  `]}render(){return Y`
575
527
  <label>
@@ -593,13 +545,16 @@ const Or=t=>t??W;customElements.define("decidables-slider",class extends Pr{stat
593
545
 
594
546
  width: 1px;
595
547
  height: 1px;
548
+
596
549
  padding: 0;
597
550
  margin: -1px;
551
+
598
552
  overflow: hidden;
599
553
 
600
554
  white-space: nowrap;
601
555
 
602
556
  border: 0;
557
+
603
558
  clip-path: inset(100%); /* May cause a performance issue: https://github.com/h5bp/html5-boilerplate/issues/2021 */
604
559
  }
605
560
 
@@ -615,6 +570,7 @@ const Or=t=>t??W;customElements.define("decidables-slider",class extends Pr{stat
615
570
  position: relative;
616
571
 
617
572
  min-width: 24px;
573
+
618
574
  padding: 0 0 36px;
619
575
  margin: 0.25rem 0.25rem 0;
620
576
 
@@ -626,17 +582,17 @@ const Or=t=>t??W;customElements.define("decidables-slider",class extends Pr{stat
626
582
  input[type=checkbox] + label + label::before,
627
583
  input[type=checkbox] + label + label::after {
628
584
  position: absolute;
629
-
630
585
  left: 50%;
631
586
 
632
587
  margin: 0;
633
588
 
634
- content: "";
635
-
636
589
  outline: 0;
637
590
 
638
- transition: all var(---transition-duration) ease;
591
+ content: "";
592
+
639
593
  transform: translate(-50%, 0);
594
+
595
+ transition: all var(---transition-duration) ease;
640
596
  }
641
597
 
642
598
  input[type=checkbox] + label + label::before {
@@ -684,17 +640,14 @@ const Or=t=>t??W;customElements.define("decidables-slider",class extends Pr{stat
684
640
  box-shadow: var(---shadow-8);
685
641
  }
686
642
 
687
- /* stylelint-disable-next-line selector-max-compound-selectors */
688
- :host(.keyboard) input[type=checkbox]:enabled:focus + label + label::after {
643
+ input[type=checkbox]:enabled:focus-visible + label + label::after {
689
644
  box-shadow: var(---shadow-4);
690
645
  }
691
646
 
692
- /* stylelint-disable selector-max-compound-selectors */
693
- :host(.keyboard) input[type=checkbox]:enabled:focus + label + label:active::after,
694
- :host(.keyboard) input[type=checkbox]:enabled:focus:active + label + label::after {
647
+ input[type=checkbox]:enabled:focus-visible + label + label:active::after,
648
+ input[type=checkbox]:enabled:focus-visible:active + label + label::after {
695
649
  box-shadow: var(---shadow-8);
696
650
  }
697
- /* stylelint-enable selector-max-compound-selectors */
698
651
  `]}render(){return Y`
699
652
  <input type="checkbox" id="switch" ?checked=${this.checked} ?disabled=${this.disabled} @change=${this.changed.bind(this)}>
700
653
  <label for="switch">
@@ -736,39 +689,46 @@ const Or=t=>t??W;customElements.define("decidables-slider",class extends Pr{stat
736
689
 
737
690
  width: 1px;
738
691
  height: 1px;
692
+
739
693
  padding: 0;
740
694
  margin: -1px;
695
+
741
696
  overflow: hidden;
742
697
 
743
698
  white-space: nowrap;
744
699
 
745
700
  border: 0;
701
+
746
702
  clip-path: inset(100%); /* May cause a performance issue: https://github.com/h5bp/html5-boilerplate/issues/2021 */
747
703
  }
748
704
 
749
705
  input[type=radio] + label {
750
706
  width: 100%;
707
+
751
708
  padding: 0.375rem 0.75rem;
752
709
 
753
710
  font-family: var(---font-family-base);
754
711
  font-size: 1.125rem;
712
+
755
713
  line-height: 1.5;
714
+
756
715
  color: var(---color-text-inverse);
716
+
757
717
  text-align: center;
758
718
 
759
719
  cursor: pointer;
720
+ outline: none;
760
721
 
761
722
  background-color: var(---color-element-enabled);
762
723
  border: 0;
763
724
  border-radius: 0;
764
- outline: none;
765
-
766
725
  box-shadow: var(---shadow-2);
767
726
  }
768
727
 
769
728
  input[type=radio]:checked + label {
770
- background-color: var(---color-element-selected);
771
729
  outline: none;
730
+
731
+ background-color: var(---color-element-selected);
772
732
  box-shadow: var(---shadow-2);
773
733
  }
774
734
 
@@ -776,6 +736,7 @@ const Or=t=>t??W;customElements.define("decidables-slider",class extends Pr{stat
776
736
  z-index: 1;
777
737
 
778
738
  outline: none;
739
+
779
740
  box-shadow: var(---shadow-4);
780
741
  }
781
742
 
@@ -783,6 +744,7 @@ const Or=t=>t??W;customElements.define("decidables-slider",class extends Pr{stat
783
744
  z-index: 2;
784
745
 
785
746
  outline: none;
747
+
786
748
  box-shadow: var(---shadow-8);
787
749
  }
788
750
 
@@ -796,25 +758,28 @@ const Or=t=>t??W;customElements.define("decidables-slider",class extends Pr{stat
796
758
  border-bottom-left-radius: 0.25rem;
797
759
  }
798
760
 
799
- :host(.keyboard) input[type=radio]:focus + label {
761
+ input[type=radio]:focus-visible + label {
800
762
  z-index: 1;
801
763
 
802
764
  outline: none;
765
+
803
766
  box-shadow: var(---shadow-4);
804
767
  }
805
768
 
806
- :host(.keyboard) input[type=radio]:focus:checked + label {
769
+ input[type=radio]:focus-visible:checked + label {
807
770
  z-index: 1;
808
771
 
809
- background-color: var(---color-element-selected);
810
772
  outline: none;
773
+
774
+ background-color: var(---color-element-selected);
811
775
  box-shadow: var(---shadow-4);
812
776
  }
813
777
 
814
- :host(.keyboard) input[type=radio]:focus + label:active {
778
+ input[type=radio]:focus-visible + label:active {
815
779
  z-index: 2;
816
780
 
817
781
  outline: none;
782
+
818
783
  box-shadow: var(---shadow-8);
819
784
  }
820
785
  `]}render(){return Y`
@@ -950,6 +915,7 @@ const Or=t=>t??W;customElements.define("decidables-slider",class extends Pr{stat
950
915
 
951
916
  width: 6rem;
952
917
  height: 3.5rem;
918
+
953
919
  padding: 0.375rem 0.75rem;
954
920
  margin: 0.25rem;
955
921
 
@@ -978,6 +944,7 @@ const Or=t=>t??W;customElements.define("decidables-slider",class extends Pr{stat
978
944
 
979
945
  .feedback .outcome {
980
946
  font-weight: 600;
947
+
981
948
  line-height: 1.15;
982
949
  }
983
950
 
@@ -1060,6 +1027,7 @@ const Or=t=>t??W;customElements.define("decidables-slider",class extends Pr{stat
1060
1027
  /* Labels */
1061
1028
  .payoff {
1062
1029
  font-weight: 600;
1030
+
1063
1031
  line-height: 0.75rem;
1064
1032
  }
1065
1033
 
@@ -1316,6 +1284,7 @@ const Or=t=>t??W;customElements.define("decidables-slider",class extends Pr{stat
1316
1284
 
1317
1285
  decidables-slider {
1318
1286
  line-height: 1;
1287
+
1319
1288
  text-align: center;
1320
1289
  }
1321
1290
 
@@ -1453,8 +1422,9 @@ const Or=t=>t??W;customElements.define("decidables-slider",class extends Pr{stat
1453
1422
  }
1454
1423
 
1455
1424
  .path.highlight .curve {
1456
- filter: url("#shadow-2");
1457
1425
  opacity: 1;
1426
+
1427
+ filter: url("#shadow-2");
1458
1428
  }
1459
1429
 
1460
1430
  .path.correct .curve {
@@ -1530,8 +1500,9 @@ const Or=t=>t??W;customElements.define("decidables-slider",class extends Pr{stat
1530
1500
 
1531
1501
  .boundary.interactive,
1532
1502
  .t0z.interactive {
1533
- filter: url("#shadow-2");
1534
1503
  outline: none;
1504
+
1505
+ filter: url("#shadow-2");
1535
1506
  }
1536
1507
 
1537
1508
  .boundary.interactive:hover,
@@ -1551,8 +1522,8 @@ const Or=t=>t??W;customElements.define("decidables-slider",class extends Pr{stat
1551
1522
  transform: translateY(0);
1552
1523
  }
1553
1524
 
1554
- :host(.keyboard) .boundary.interactive:focus,
1555
- :host(.keyboard) .t0z.interactive:focus {
1525
+ .boundary.interactive:focus-visible,
1526
+ .t0z.interactive:focus-visible {
1556
1527
  filter: url("#shadow-8");
1557
1528
 
1558
1529
  /* HACK: This gets Safari to correctly apply the filter! */
@@ -1571,15 +1542,15 @@ const Or=t=>t??W;customElements.define("decidables-slider",class extends Pr{stat
1571
1542
 
1572
1543
  fill: none;
1573
1544
  stroke: var(---color-element-emphasis);
1574
- stroke-dasharray: 8 4;
1575
1545
  stroke-width: 2;
1546
+ stroke-dasharray: 8 4;
1576
1547
  }
1577
1548
 
1578
1549
  .drift.interactive {
1579
1550
  cursor: ns-resize;
1551
+ outline: none;
1580
1552
 
1581
1553
  filter: url("#shadow-2");
1582
- outline: none;
1583
1554
 
1584
1555
  /* HACK: This gets Safari to correctly apply the filter! */
1585
1556
  fill: #000000;
@@ -1600,7 +1571,7 @@ const Or=t=>t??W;customElements.define("decidables-slider",class extends Pr{stat
1600
1571
  fill: #00ff00;
1601
1572
  }
1602
1573
 
1603
- :host(.keyboard) .drift.interactive:focus {
1574
+ .drift.interactive:focus-visible {
1604
1575
  filter: url("#shadow-8");
1605
1576
 
1606
1577
  /* HACK: This gets Safari to correctly apply the filter! */
@@ -1614,14 +1585,14 @@ const Or=t=>t??W;customElements.define("decidables-slider",class extends Pr{stat
1614
1585
  /* Make larger targets for touch users */
1615
1586
  .interactive .touch {
1616
1587
  stroke: #000000;
1617
- stroke-dasharray: none;
1618
1588
  stroke-opacity: 0;
1589
+ stroke-dasharray: none;
1619
1590
  }
1620
1591
 
1621
1592
  @media (pointer: coarse) {
1622
1593
  .interactive .touch {
1623
- stroke-linecap: round;
1624
1594
  stroke-width: 12;
1595
+ stroke-linecap: round;
1625
1596
  }
1626
1597
  }
1627
1598
 
@@ -1646,6 +1617,7 @@ const Or=t=>t??W;customElements.define("decidables-slider",class extends Pr{stat
1646
1617
 
1647
1618
  .measure.a .label {
1648
1619
  dominant-baseline: auto;
1620
+
1649
1621
  text-anchor: end;
1650
1622
  }
1651
1623
 
@@ -1657,6 +1629,7 @@ const Or=t=>t??W;customElements.define("decidables-slider",class extends Pr{stat
1657
1629
  /* Hack to avoid Safari weirdness */
1658
1630
  .measure.z .label tspan {
1659
1631
  dominant-baseline: hanging;
1632
+
1660
1633
  text-anchor: start;
1661
1634
  }
1662
1635
 
@@ -1666,6 +1639,7 @@ const Or=t=>t??W;customElements.define("decidables-slider",class extends Pr{stat
1666
1639
 
1667
1640
  .measure.v .label {
1668
1641
  dominant-baseline: auto;
1642
+
1669
1643
  text-anchor: start;
1670
1644
  }
1671
1645
 
@@ -1675,6 +1649,7 @@ const Or=t=>t??W;customElements.define("decidables-slider",class extends Pr{stat
1675
1649
 
1676
1650
  .measure.t0 .label {
1677
1651
  dominant-baseline: auto;
1652
+
1678
1653
  text-anchor: middle;
1679
1654
  }
1680
1655
 
@@ -1774,7 +1749,7 @@ const Or=t=>t??W;customElements.define("decidables-slider",class extends Pr{stat
1774
1749
  .rt-label.error text {
1775
1750
  dominant-baseline: hanging;
1776
1751
  }
1777
- `]}render(){return Y``}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),h=.75*this.rem,u=.5*c,g=.25*c-h,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([u,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).each((t,e,i)=>{ot(ta.svgFilters,i[e])}),N=S.append("defs").classed("markers",!0),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),H=T.enter().append("g").attr("class",t=>`plot density ${t.outcome}`),$=S.append("g").classed("plot accuracy",!0),z=k.select(".plot.evidence").attr("transform",`translate(${o}, ${a+g+h})`),G=H.merge(T).attr("transform",t=>`translate(${o}, ${"correct"===t.outcome?a:a+g+u+2*h})`),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=H.append("g").classed("underlayer",!0),W=$.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=H.append("g").classed("content",!0);$.append("g").classed("content",!0);const O=z.select(".content"),j=G.select(".content"),q=Y.select(".content");V.append("g").classed("overlayer",!0),H.append("g").classed("overlayer",!0),$.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)`),lt=Z.select(".axis.accuracy").attr("transform",`translate(${b+.25*this.rem}, 0)`),ct=at.transition().duration(y).ease(sr).call(Rt(B)).attr("font-size",null).attr("font-family",null),dt=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),ht=lt.transition().duration(y).ease(sr).call(function(t){return Et(2,t)}(I)).attr("font-size",null).attr("font-family",null);ct.selectAll("line, path").attr("stroke",null),dt.selectAll("line, path").attr("stroke",null),ht.selectAll("line, path").attr("stroke",null);const ut=X.append("text").classed("title evidence",!0).attr("text-anchor","middle"),gt=J.append("text").attr("class",t=>`title density ${t.outcome}`).attr("text-anchor","middle"),pt=W.append("text").classed("title accuracy",!0).attr("text-anchor","middle");ut.append("tspan").classed("name",!0).text("Evidence"),gt.append("tspan").classed("name",!0).text("Density"),pt.append("tspan").classed("name",!0).text("Accuracy"),_.select(".title.evidence").transition().duration(y).ease(sr).attr("transform",`translate(${-2.5*this.rem}, ${u/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 mt=O.select(".paths").selectAll(".path").data(this.data.trials.filter(t=>void 0!==t.path)),bt=Ze(),yt=mt.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),bt.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]),bt.get(t.currentTarget).remove())});yt.append("path").classed("curve",!0).attr("clip-path","url(#clip-evidence)").attr("pathLength",1).attr("stroke-dashoffset",1);const Qt=yt.merge(mt).attr("class",t=>`path ${t.outcome}`);Qt.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 Bt=Qt.filter(t=>t.animate&&!this.paused);if(!Bt.empty()){const t=Bt.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));Bt.classed("animate",!0).select(".curve").attr("stroke-dasharray",1),Bt.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 Ut=Qt.filter(t=>t.animate&&this.paused);if(!Ut.empty()){const t=Ut.attr("data-new-trial-ease-time");Ut.classed("animate",!0).select(".curve").attr("stroke-dasharray",1).attr("stroke-dashoffset",()=>es(1,0)(ir(t)))}Qt.filter(t=>!t.animate).attr("data-new-trial-ease-time",null),mt.exit().remove();const Ft=P.append("g").attr("class",t=>`dist ${t.outcome}`);Ft.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 It=O.selectAll(".rt").data(this.data.trials),ft=It.enter().append("g");ft.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 Ct=ft.merge(It).attr("class",t=>`rt ${t.outcome}`);Ct.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),It.exit().remove();const vt=q.selectAll(".accuracy.model").data([this.model.accuracy,1-this.model.accuracy]),At=vt.enter().append("g").attr("class",(t,e)=>"accuracy model "+(0===e?"correct":"error"));At.append("rect").classed("bar",!0).attr("x",0),At.merge(vt).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)),vt.exit().remove();const xt=q.selectAll(".accuracy.data").data(Number.isNaN(this.data.accuracy)?[]:[this.data.accuracy]),St=xt.enter().append("g").classed("accuracy data",!0);St.append("line").classed("mark",!0);const Nt=St.merge(xt).attr("class",t=>"accuracy data "+(t<this.model.accuracy.correct?"correct":"error"));Nt.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),xt.exit().remove();const Lt=tt.selectAll(".boundary").data([{bound:"upper",value:this.bounds.upper},{bound:"lower",value:this.bounds.lower}]),wt=Lt.enter().append("g").attr("class",(t,e)=>"boundary "+(0===e?"correct":"error"));wt.append("line").classed("line",!0),wt.append("line").classed("line touch",!0);const Dt=wt.merge(Lt).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?Dt.call(v):Dt.on(".drag",null)),Dt.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)),Dt.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)),Lt.exit().remove();const Mt=tt.selectAll(".drift").data([{v:this.v,t0:this.t0,startingPoint:this.startingPoint}]),kt=Mt.enter().append("g").classed("drift",!0);kt.append("line").classed("line",!0),kt.append("line").classed("line touch",!0),kt.append("path").classed("arrow",!0),kt.append("path").classed("arrow touch",!0);const Tt=kt.merge(Mt).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?Tt.call(C):Tt.on(".drag",null));const Vt=(B(0)-B(1))/(Q(1)-Q(0));Tt.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*Vt)*(180/Math.PI)})`),Tt.select(".line").attr("x2",Q(200)),Tt.select(".line.touch").attr("x2",Q(200)),Tt.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 `),Tt.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 `),Mt.exit().remove();const Ht=tt.selectAll(".t0z").data([{t0:this.t0,startingPoint:this.startingPoint}]),$t=Ht.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 zt=$t.merge(Ht).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?zt.call(f):zt.on(".drag",null)),zt.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)),zt.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)),zt.select(".point").transition().duration(this.drag?0:y).ease(sr).attr("cx",t=>Q(t.t0)).attr("cy",t=>B(t.startingPoint)),Ht.exit().remove();const Gt=tt.selectAll(".measure.a").data(this.measures?[this.a]:[]),Yt=Gt.enter().append("g").classed("measure a",!0);Yt.append("line").classed("line",!0),Yt.append("line").classed("markers",!0).attr("marker-start","url(#measure-arrow-a)").attr("marker-end","url(#measure-arrow-a)");const Xt=Yt.append("text").classed("label",!0);Xt.append("tspan").classed("a math-var",!0).text("a"),Xt.append("tspan").classed("equals",!0).text(" = "),Xt.append("tspan").classed("value",!0);const Jt=Math.abs(B(this.bounds.upper)-B(this.bounds.lower))<=4,Wt=Yt.merge(Gt);Wt.select(".line").classed("short",Jt).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),Wt.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));Wt.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)),Gt.exit().remove();const _t=tt.selectAll(".measure.z").data(this.measures?[this.z]:[]),Kt=_t.enter().append("g").classed("measure z",!0);Kt.append("line").classed("line",!0),Kt.append("line").classed("markers",!0).attr("marker-start","url(#measure-arrow-z)").attr("marker-end","url(#measure-arrow-z)");const Zt=Kt.append("text").classed("label",!0);Zt.append("tspan").classed("z math-var",!0).text("z"),Zt.append("tspan").classed("equals",!0).text(" = "),Zt.append("tspan").classed("value",!0);const Pt=Math.abs(B(this.startingPoint)-B(this.bounds.lower))<=4,Ot=Kt.merge(_t);Ot.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),Ot.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));Ot.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)),_t.exit().remove();const jt=tt.selectAll(".measure.v").data(this.measures?[this.v]:[]),qt=jt.enter().append("g").classed("measure v",!0);qt.append("path").classed("line",!0),qt.append("path").classed("markers",!0).attr("marker-start","url(#measure-capped-arrow-v)").attr("marker-end","url(#measure-capped-arrow-v)");const te=qt.append("text").classed("label",!0);te.append("tspan").classed("v math-var",!0).text("v"),te.append("tspan").classed("equals",!0).text(" = "),te.append("tspan").classed("value",!0);const ee=Q(200)-Q(0)+.75*this.rem,ie=Math.atan(this.v/1e3*Vt),se=Math.cos(ie)*ee,re=Math.sin(ie)*ee,ae=2/ee,ne=Math.atan(this.v/1e3*Vt)-ae,oe=Math.cos(ae)*ee,le=Math.sin(ae)*ee,ce=Math.cos(ne)*ee,de=Math.sin(ne)*ee,he=ne*ee<=4,ue=qt.merge(jt);ue.select(".line").classed("short",he).transition().duration(this.drag?0:y).ease(sr).attr("d",`\n M ${Q(this.t0)+oe}, ${B(this.startingPoint)-le}\n A ${Q(200)-Q(0)+.75*this.rem} ${Q(200)-Q(0)+.75*this.rem} 0 0 0 ${Q(this.t0)+ce} ${B(this.startingPoint)-de}\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)+se} ${B(this.startingPoint)-re}\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)),jt.exit().remove();const ge=tt.selectAll(".measure.t0").data(this.measures?[this.t0]:[]),pe=ge.enter().append("g").classed("measure t0",!0);pe.append("line").classed("line",!0),pe.append("line").classed("markers",!0).attr("marker-start","url(#measure-arrow-t0)").attr("marker-end","url(#measure-capped-arrow-t0)");const me=pe.append("text").classed("label",!0);me.append("tspan").classed("t0 math-var",!0).text("t₀"),me.append("tspan").classed("equals",!0).text(" = "),me.append("tspan").classed("value",!0);const be=Math.abs(Q(0)-Q(this.t0))<=4,ye=pe.merge(ge);ye.select(".line").classed("short",be).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),ye.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);ye.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)),ge.exit().remove();const Qe=et.selectAll(".model.mean").data(t=>this.means?[t]:[]),Be=Qe.enter().append("g").attr("class",t=>`model mean ${t.outcome}`);Be.append("line").classed("indicator",!0);Be.merge(Qe).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)),Qe.exit().remove();const Ue=et.selectAll(".data.mean").data(t=>this.means&&!Number.isNaN(t.data.meanRT)?[t]:[]),Fe=Ue.enter().append("g").attr("class",t=>`data mean ${t.outcome}`);Fe.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);Fe.merge(Ue).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),Ue.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 Ie=et.selectAll(".model.sd").data(t=>this.sds?[t]:[]),fe=Ie.enter().append("g").attr("class",t=>`model sd ${t.outcome}`);fe.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})`);fe.merge(Ie).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)),Ie.exit().remove();const Ce=et.selectAll(".data.sd").data(t=>!this.sds||Number.isNaN(t.data.meanRT)||Number.isNaN(t.data.sdRT)?[]:[t]),ve=Ce.enter().append("g").attr("class",t=>`data sd ${t.outcome}`);ve.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);ve.merge(Ce).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),Ce.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 ha 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,n`
1752
+ `]}render(){return Y``}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),h=.75*this.rem,u=.5*c,g=.25*c-h,p=.75*this.rem,m=.9*d,b=.1*d-p,Q=parseInt(this.getComputedStyleValue("---transition-duration"),10),B=Gr().domain([this.scale.time.min,this.scale.time.max]).range([0,m]),y=Gr().domain([this.scale.evidence.min,this.scale.evidence.max]).range([u,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:B(e.t0),y:y(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=B.invert(t.x),s=(y.invert(t.y)+this.a/2)/this.a;i="z"===e?B.invert(t.subject.x):i<ia.t0.MIN?ia.t0.MIN:i>ia.t0.MAX?ia.t0.MAX:i,s="t0"===e?(y.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=(y.invert(t.y)-this.startingPoint)/(B.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:y(e.value)})).on("start",t=>{_e(t.currentTarget).classed("dragging",!0)}).on("drag",t=>{this.drag=!0;const e=y.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=>B(t.t)).y(t=>y(t.e)),x=Kr().x(t=>B(t.t)).y(t=>U(t.d)),E=Kr().x(t=>B(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).each((t,e,i)=>{ot(ta.svgFilters,i[e])}),N=S.append("defs").classed("markers",!0),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",y(this.bounds.upper)).attr("y2",y(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),H=T.enter().append("g").attr("class",t=>`plot density ${t.outcome}`),$=S.append("g").classed("plot accuracy",!0),z=k.select(".plot.evidence").attr("transform",`translate(${o}, ${a+g+h})`),G=H.merge(T).attr("transform",t=>`translate(${o}, ${"correct"===t.outcome?a:a+g+u+2*h})`),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",y(this.bounds.upper)).attr("height",y(this.bounds.lower)-y(this.bounds.upper)+1).attr("width",m+1);const X=V.append("g").classed("underlayer",!0),J=H.append("g").classed("underlayer",!0),W=$.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=H.append("g").classed("content",!0);$.append("g").classed("content",!0);const O=z.select(".content"),j=G.select(".content"),q=Y.select(".content");V.append("g").classed("overlayer",!0),H.append("g").classed("overlayer",!0),$.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:Q).ease(sr).attr("y",y(this.bounds.upper)).attr("height",y(this.bounds.lower)-y(this.bounds.upper)).attr("width",m),K.select(".background").transition().duration(Q).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(Q).ease(sr).call((st=B,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(Q).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)`),lt=Z.select(".axis.accuracy").attr("transform",`translate(${b+.25*this.rem}, 0)`),ct=at.transition().duration(Q).ease(sr).call(Rt(y)).attr("font-size",null).attr("font-family",null),dt=nt.transition().duration(Q).ease(sr).each((t,e,i)=>{Rt(t.densityScale).ticks(2)(_e(i[e]))}).attr("font-size",null).attr("font-family",null),ht=lt.transition().duration(Q).ease(sr).call(function(t){return Et(2,t)}(I)).attr("font-size",null).attr("font-family",null);ct.selectAll("line, path").attr("stroke",null),dt.selectAll("line, path").attr("stroke",null),ht.selectAll("line, path").attr("stroke",null);const ut=X.append("text").classed("title evidence",!0).attr("text-anchor","middle"),gt=J.append("text").attr("class",t=>`title density ${t.outcome}`).attr("text-anchor","middle"),pt=W.append("text").classed("title accuracy",!0).attr("text-anchor","middle");ut.append("tspan").classed("name",!0).text("Evidence"),gt.append("tspan").classed("name",!0).text("Density"),pt.append("tspan").classed("name",!0).text("Accuracy"),_.select(".title.evidence").transition().duration(Q).ease(sr).attr("transform",`translate(${-2.5*this.rem}, ${u/2})rotate(-90)`),K.select(".title.density").transition().duration(Q).ease(sr).attr("transform",`translate(${-2.5*this.rem}, ${g/2})rotate(-90)`),Z.select(".title.accuracy").transition().duration(Q).ease(sr).attr("transform",`translate(${b+2.25*this.rem}, ${c/2})rotate(90)`);const mt=O.select(".paths").selectAll(".path").data(this.data.trials.filter(t=>void 0!==t.path)),bt=Ze(),Qt=mt.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",B(e.rt)).attr("y","correct"===e.outcome?y(this.bounds.upper)-.25*this.rem:y(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),bt.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]),bt.get(t.currentTarget).remove())});Qt.append("path").classed("curve",!0).attr("clip-path","url(#clip-evidence)").attr("pathLength",1).attr("stroke-dashoffset",1);const Bt=Qt.merge(mt).attr("class",t=>`path ${t.outcome}`);Bt.select(".curve").transition().duration(this.drag?0:Q).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 yt=Bt.filter(t=>t.animate&&!this.paused);if(!yt.empty()){const t=yt.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));yt.classed("animate",!0).select(".curve").attr("stroke-dasharray",1),yt.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 Ut=Bt.filter(t=>t.animate&&this.paused);if(!Ut.empty()){const t=Ut.attr("data-new-trial-ease-time");Ut.classed("animate",!0).select(".curve").attr("stroke-dasharray",1).attr("stroke-dashoffset",()=>es(1,0)(ir(t)))}Bt.filter(t=>!t.animate).attr("data-new-trial-ease-time",null),mt.exit().remove();const Ft=P.append("g").attr("class",t=>`dist ${t.outcome}`);Ft.append("path").classed("curve",!0),j.select(".dist").select(".curve").transition().duration(this.drag?0:Q).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 It=O.selectAll(".rt").data(this.data.trials),ft=It.enter().append("g");ft.append("line").classed("mark",!0).attr("x1",t=>B(t.rt)).attr("x2",t=>B(t.rt)).attr("y1",t=>"correct"===t.outcome?y(1)-.125*this.rem:y(-1)+.125*this.rem).attr("y2",t=>"correct"===t.outcome?y(1)-.675*this.rem:y(-1)+.675*this.rem);const Ct=ft.merge(It).attr("class",t=>`rt ${t.outcome}`);Ct.filter(t=>!t.animate).select(".mark").transition().duration(this.drag?0:Q).ease(sr).attr("stroke",t=>this.getComputedStyleValue(`---color-${t.outcome}`)).attr("x1",t=>B(t.rt)).attr("x2",t=>B(t.rt)).attr("y1",t=>"correct"===t.outcome?y(1)-.125*this.rem:y(-1)+.125*this.rem).attr("y2",t=>"correct"===t.outcome?y(1)-.675*this.rem:y(-1)+.675*this.rem),It.exit().remove();const vt=q.selectAll(".accuracy.model").data([this.model.accuracy,1-this.model.accuracy]),At=vt.enter().append("g").attr("class",(t,e)=>"accuracy model "+(0===e?"correct":"error"));At.append("rect").classed("bar",!0).attr("x",0),At.merge(vt).select("rect").transition().duration(this.drag?0:Q).ease(sr).attr("y",(t,e)=>I(0===e?0:1-t)).attr("width",b).attr("height",t=>I(t)),vt.exit().remove();const xt=q.selectAll(".accuracy.data").data(Number.isNaN(this.data.accuracy)?[]:[this.data.accuracy]),St=xt.enter().append("g").classed("accuracy data",!0);St.append("line").classed("mark",!0);const Nt=St.merge(xt).attr("class",t=>"accuracy data "+(t<this.model.accuracy.correct?"correct":"error"));Nt.select(".mark").transition().duration(this.drag?0:Q).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),xt.exit().remove();const Lt=tt.selectAll(".boundary").data([{bound:"upper",value:this.bounds.upper},{bound:"lower",value:this.bounds.lower}]),wt=Lt.enter().append("g").attr("class",(t,e)=>"boundary "+(0===e?"correct":"error"));wt.append("line").classed("line",!0),wt.append("line").classed("line touch",!0);const Dt=wt.merge(Lt).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?Dt.call(v):Dt.on(".drag",null)),Dt.select(".line").transition().duration(this.drag?0:Q).ease(sr).attr("x1",B(this.scale.time.min)).attr("x2",B(this.scale.time.max)).attr("y1",t=>y(t.value)).attr("y2",t=>y(t.value)),Dt.select(".line.touch").transition().duration(this.drag?0:Q).ease(sr).attr("x1",B(this.scale.time.min)).attr("x2",B(this.scale.time.max)).attr("y1",t=>y(t.value)).attr("y2",t=>y(t.value)),Lt.exit().remove();const Mt=tt.selectAll(".drift").data([{v:this.v,t0:this.t0,startingPoint:this.startingPoint}]),kt=Mt.enter().append("g").classed("drift",!0);kt.append("line").classed("line",!0),kt.append("line").classed("line touch",!0),kt.append("path").classed("arrow",!0),kt.append("path").classed("arrow touch",!0);const Tt=kt.merge(Mt).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?Tt.call(C):Tt.on(".drag",null));const Vt=(y(0)-y(1))/(B(1)-B(0));Tt.transition().duration(this.drag?0:Q).ease(sr).attr("transform",t=>`translate(${B(t.t0)}, ${y(t.startingPoint)})\n rotate(${-Math.atan(t.v/1e3*Vt)*(180/Math.PI)})`),Tt.select(".line").attr("x2",B(200)),Tt.select(".line.touch").attr("x2",B(200)),Tt.select(".arrow").attr("d",`\n M ${B(200)-.5*this.rem},${.5*-this.rem}\n l ${.5*this.rem},${.5*this.rem}\n l ${.5*-this.rem},${.5*this.rem}\n `),Tt.select(".arrow.touch").attr("d",`\n M ${B(200)-.5*this.rem},${.5*-this.rem}\n l ${.5*this.rem},${.5*this.rem}\n l ${.5*-this.rem},${.5*this.rem}\n `),Mt.exit().remove();const Ht=tt.selectAll(".t0z").data([{t0:this.t0,startingPoint:this.startingPoint}]),$t=Ht.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 zt=$t.merge(Ht).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?zt.call(f):zt.on(".drag",null)),zt.select(".line").transition().duration(this.drag?0:Q).ease(sr).attr("x1",B(0)).attr("x2",t=>B(t.t0)).attr("y1",t=>y(t.startingPoint)).attr("y2",t=>y(t.startingPoint)),zt.select(".line.touch").transition().duration(this.drag?0:Q).ease(sr).attr("x1",B(0)).attr("x2",t=>B(t.t0)).attr("y1",t=>y(t.startingPoint)).attr("y2",t=>y(t.startingPoint)),zt.select(".point").transition().duration(this.drag?0:Q).ease(sr).attr("cx",t=>B(t.t0)).attr("cy",t=>y(t.startingPoint)),Ht.exit().remove();const Gt=tt.selectAll(".measure.a").data(this.measures?[this.a]:[]),Yt=Gt.enter().append("g").classed("measure a",!0);Yt.append("line").classed("line",!0),Yt.append("line").classed("markers",!0).attr("marker-start","url(#measure-arrow-a)").attr("marker-end","url(#measure-arrow-a)");const Xt=Yt.append("text").classed("label",!0);Xt.append("tspan").classed("a math-var",!0).text("a"),Xt.append("tspan").classed("equals",!0).text(" = "),Xt.append("tspan").classed("value",!0);const Jt=Math.abs(y(this.bounds.upper)-y(this.bounds.lower))<=4,Wt=Yt.merge(Gt);Wt.select(".line").classed("short",Jt).transition().duration(this.drag?0:Q).ease(sr).attr("x1",B(this.scale.time.max)-.75*this.rem).attr("y1",y(this.bounds.upper)+2).attr("x2",B(this.scale.time.max)-.75*this.rem).attr("y2",y(this.bounds.lower)-2),Wt.select(".markers").transition().duration(this.drag?0:Q).ease(sr).attr("x1",B(this.scale.time.max)-.75*this.rem).attr("y1",y(this.bounds.upper)).attr("x2",B(this.scale.time.max)-.75*this.rem).attr("y2",y(this.bounds.lower));Wt.select(".label").transition().duration(this.drag?0:Q).ease(sr).attr("x",B(this.scale.time.max)).attr("y",y(this.bounds.upper)-.25*this.rem).select(".value").text(Ir(".2f")(this.a)),Gt.exit().remove();const _t=tt.selectAll(".measure.z").data(this.measures?[this.z]:[]),Kt=_t.enter().append("g").classed("measure z",!0);Kt.append("line").classed("line",!0),Kt.append("line").classed("markers",!0).attr("marker-start","url(#measure-arrow-z)").attr("marker-end","url(#measure-arrow-z)");const Zt=Kt.append("text").classed("label",!0);Zt.append("tspan").classed("z math-var",!0).text("z"),Zt.append("tspan").classed("equals",!0).text(" = "),Zt.append("tspan").classed("value",!0);const Pt=Math.abs(y(this.startingPoint)-y(this.bounds.lower))<=4,Ot=Kt.merge(_t);Ot.select(".line").classed("short",Pt).transition().duration(this.drag?0:Q).ease(sr).attr("x1",B(this.scale.time.min)+.75*this.rem).attr("y1",y(this.startingPoint)+2).attr("x2",B(this.scale.time.min)+.75*this.rem).attr("y2",y(this.bounds.lower)-2),Ot.select(".markers").transition().duration(this.drag?0:Q).ease(sr).attr("x1",B(this.scale.time.min)+.75*this.rem).attr("y1",y(this.startingPoint)).attr("x2",B(this.scale.time.min)+.75*this.rem).attr("y2",y(this.bounds.lower));Ot.select(".label").transition().duration(this.drag?0:Q).ease(sr).attr("x",B(this.scale.time.min)).attr("y",y(this.bounds.lower)+.125*this.rem).select(".value").text(Ir(".0%")(this.z)),_t.exit().remove();const jt=tt.selectAll(".measure.v").data(this.measures?[this.v]:[]),qt=jt.enter().append("g").classed("measure v",!0);qt.append("path").classed("line",!0),qt.append("path").classed("markers",!0).attr("marker-start","url(#measure-capped-arrow-v)").attr("marker-end","url(#measure-capped-arrow-v)");const te=qt.append("text").classed("label",!0);te.append("tspan").classed("v math-var",!0).text("v"),te.append("tspan").classed("equals",!0).text(" = "),te.append("tspan").classed("value",!0);const ee=B(200)-B(0)+.75*this.rem,ie=Math.atan(this.v/1e3*Vt),se=Math.cos(ie)*ee,re=Math.sin(ie)*ee,ae=2/ee,ne=Math.atan(this.v/1e3*Vt)-ae,oe=Math.cos(ae)*ee,le=Math.sin(ae)*ee,ce=Math.cos(ne)*ee,de=Math.sin(ne)*ee,he=ne*ee<=4,ue=qt.merge(jt);ue.select(".line").classed("short",he).transition().duration(this.drag?0:Q).ease(sr).attr("d",`\n M ${B(this.t0)+oe}, ${y(this.startingPoint)-le}\n A ${B(200)-B(0)+.75*this.rem} ${B(200)-B(0)+.75*this.rem} 0 0 0 ${B(this.t0)+ce} ${y(this.startingPoint)-de}\n `),ue.select(".markers").transition().duration(this.drag?0:Q).ease(sr).attr("d",`\n M ${B(this.t0+200)+.75*this.rem}, ${y(this.startingPoint)}\n A ${B(200)-B(0)+.75*this.rem} ${B(200)-B(0)+.75*this.rem} 0 0 0 ${B(this.t0)+se} ${y(this.startingPoint)-re}\n `);ue.select(".label").transition().duration(this.drag?0:Q).ease(sr).attr("x",B(this.t0+200)+.5*this.rem).attr("y",y(this.bounds.upper)-.25*this.rem).select(".value").text(Ir(".2f")(this.v)),jt.exit().remove();const ge=tt.selectAll(".measure.t0").data(this.measures?[this.t0]:[]),pe=ge.enter().append("g").classed("measure t0",!0);pe.append("line").classed("line",!0),pe.append("line").classed("markers",!0).attr("marker-start","url(#measure-arrow-t0)").attr("marker-end","url(#measure-capped-arrow-t0)");const me=pe.append("text").classed("label",!0);me.append("tspan").classed("t0 math-var",!0).text("t₀"),me.append("tspan").classed("equals",!0).text(" = "),me.append("tspan").classed("value",!0);const be=Math.abs(B(0)-B(this.t0))<=4,Qe=pe.merge(ge);Qe.select(".line").classed("short",be).transition().duration(this.drag?0:Q).ease(sr).attr("x1",B(0)+2).attr("y1",y(this.startingPoint)-.75*this.rem).attr("x2",B(this.t0)-2).attr("y2",y(this.startingPoint)-.75*this.rem),Qe.select(".markers").transition().duration(this.drag?0:Q).ease(sr).attr("x1",B(0)).attr("y1",y(this.startingPoint)-.75*this.rem).attr("x2",B(this.t0)).attr("y2",y(this.startingPoint)-.75*this.rem);Qe.select(".label").transition().duration(this.drag?0:Q).ease(sr).attr("x",B(this.t0)+.25*this.rem).attr("y",y(this.bounds.upper)-.25*this.rem).select(".value").text(Ir("d")(this.t0)),ge.exit().remove();const Be=et.selectAll(".model.mean").data(t=>this.means?[t]:[]),ye=Be.enter().append("g").attr("class",t=>`model mean ${t.outcome}`);ye.append("line").classed("indicator",!0);ye.merge(Be).select(".indicator").transition().duration(this.drag?0:Q).ease(sr).attr("x1",t=>B(t.model.meanRT)).attr("x2",t=>B(t.model.meanRT)).attr("y1",t=>t.densityScale(this.scale.density.min)).attr("y2",t=>t.densityScale(this.scale.density.max)),Be.exit().remove();const Ue=et.selectAll(".data.mean").data(t=>this.means&&!Number.isNaN(t.data.meanRT)?[t]:[]),Fe=Ue.enter().append("g").attr("class",t=>`data mean ${t.outcome}`);Fe.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);Fe.merge(Ue).select(".indicator").transition().duration(this.drag?0:Q).ease(sr).attr("x1",t=>B(t.data.meanRT)).attr("x2",t=>B(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),Ue.exit().select(".indicator").transition().duration(this.drag?0:Q).ease(sr).attr("x1",0).attr("x2",0).on("end",(t,e,i)=>{_e(i[e].parentElement).remove()});const Ie=et.selectAll(".model.sd").data(t=>this.sds?[t]:[]),fe=Ie.enter().append("g").attr("class",t=>`model sd ${t.outcome}`);fe.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})`);fe.merge(Ie).select(".indicator").transition().duration(this.drag?0:Q).ease(sr).attr("x1",t=>B(t.model.meanRT-t.model.sdRT/2)).attr("x2",t=>B(t.model.meanRT+t.model.sdRT/2)).attr("y1",t=>t.densityScale(5)).attr("y2",t=>t.densityScale(5)),Ie.exit().remove();const Ce=et.selectAll(".data.sd").data(t=>!this.sds||Number.isNaN(t.data.meanRT)||Number.isNaN(t.data.sdRT)?[]:[t]),ve=Ce.enter().append("g").attr("class",t=>`data sd ${t.outcome}`);ve.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);ve.merge(Ce).select(".indicator").transition().duration(this.drag?0:Q).ease(sr).attr("x1",t=>B(t.data.meanRT-t.data.sdRT/2)).attr("x2",t=>B(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),Ce.exit().select(".indicator").transition().duration(this.drag?0:Q).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 ha 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,n`
1778
1753
  :host {
1779
1754
  display: inline-block;
1780
1755
 
@@ -1819,7 +1794,7 @@ const Or=t=>t??W;customElements.define("decidables-slider",class extends Pr{stat
1819
1794
  font-size: 1.75rem;
1820
1795
  font-weight: 600;
1821
1796
  }
1822
- `]}render(){return Y``}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,s=Math.min(e,i),r=.25*this.rem,a=.25*this.rem,n=.25*this.rem,o=s-(r+a),l=s-(n+.25*this.rem);this.xScale=Gr().domain([-1,1]).range([0,l]),this.yScale=Gr().domain([1,-1]).range([0,o]);const c=_e(this.renderRoot).selectAll(".main").data([{width:this.width,height:this.height,rem:this.rem}]),d=c.enter().append("svg").classed("main",!0),h=d.merge(c).attr("viewBox",`0 0 ${s} ${s}`);d.append("clipPath").attr("id","clip-rdk-task").append("circle"),h.select("clipPath circle").attr("cx",this.xScale(0)).attr("cy",this.yScale(0)).attr("r",this.xScale(1)-this.xScale(0));const u=d.append("g").classed("plot",!0),g=h.select(".plot").attr("transform",`translate(${n}, ${r})`),p=u.append("g").classed("underlayer",!0),m=g.select(".underlayer");p.append("circle").classed("background",!0),m.select(".background").attr("cx",this.xScale(0)).attr("cy",this.yScale(0)).attr("r",this.xScale(1)-this.xScale(0)),u.append("g").classed("content",!0).attr("clip-path","url(#clip-rdk-task)");g.select(".content").selectAll(".dots").data([[],[]]).enter().append("g").classed("dots",!0).classed("coherent",(t,e)=>e===this.COHERENT).classed("random",(t,e)=>e===this.RANDOM);const b=u.append("g").classed("overlayer",!0),y=g.select(".overlayer");b.append("circle").classed("outline",!0),y.select(".outline").attr("cx",this.xScale(0)).attr("cy",this.yScale(0)).attr("r",this.xScale(1)-this.yScale(0)),(this.firstUpdate||t.has("running"))&&(this.running?(this.pauseTime&&(this.baseTime+=Us()-this.pauseTime,this.pauseTime=0),this.runner=function(t,e,i){var s=new Is,r=e;return s._restart=s.restart,s.restart=function(t,e,i){e=+e,i=null==i?Us():+i,s._restart(function a(n){n+=r,s._restart(a,r+=e,i),t(n)},e,i)},s.restart(t,e,i),s}(this.run.bind(this),20)):void 0!==this.runner&&(this.runner.stop(),this.pauseTime=Us())),this.firstUpdate=!1}reset(){void 0!==this.runner&&this.runner.stop(),this.running=!1,this.trial=0,this.state="resetted",this.baseTime=0,this.pauseTime=0,this.startTime=0,this.lastTime=0,this.signal=void 0,this.currentDirection=void 0;const t=_e(this.renderRoot).select(".content").selectAll(".dots").data([[],[]]).selectAll(".dot").data(t=>t);t.exit().remove();_e(this.renderRoot).select(".content").selectAll(".fixation").data([]).exit().remove();_e(this.renderRoot).select(".content").selectAll(".query").data([]).exit().remove()}run(){const t=Us(),e=this.baseTime?t-this.baseTime:0,i=this.baseTime?e-this.startTime:0,s=this.baseTime?e-this.lastTime:0;this.lastTime=e;let r=!1;if("resetted"===this.state?(this.state="iti",this.baseTime=t,this.startTime=0,this.dispatchEvent(new CustomEvent("rdk-block-start",{detail:{trials:this.trials},bubbles:!0}))):"iti"===this.state&&i>=this.iti?(r=!0,this.trial+=1,this.state="stimulus",this.startTime=e,this.signal=Math.random()<this.probability?"left":"right",this.currentDirection="left"===this.signal?this.LEFT:this.RIGHT,this.dispatchEvent(new CustomEvent("rdk-trial-start",{detail:{trials:this.trials,duration:this.duration,wait:this.wait,iti:this.iti,trial:this.trial,signal:this.signal},bubbles:!0}))):"stimulus"===this.state&&i>=this.duration?(this.state="wait",this.startTime=e,this.dispatchEvent(new CustomEvent("rdk-trial-middle",{detail:{trials:this.trials,duration:this.duration,wait:this.wait,iti:this.iti,trial:this.trial,signal:this.signal},bubbles:!0}))):"wait"===this.state&&i>=this.wait&&(this.dispatchEvent(new CustomEvent("rdk-trial-end",{detail:{trials:this.trials,duration:this.duration,wait:this.wait,iti:this.iti,trial:this.trial,signal:this.signal},bubbles:!0})),this.trial>=this.trials?(this.runner.stop(),this.running=!1,this.state="ended",this.baseTime=0,this.pauseTime=0,this.startTime=0,this.lastTime=0,this.signal=void 0,this.currentDirection=void 0,this.dispatchEvent(new CustomEvent("rdk-block-end",{detail:{trials:this.trial},bubbles:!0}))):(this.state="iti",this.startTime=e)),"stimulus"===this.state){this.dots[this.COHERENT].length=Math.round(this.count*this.coherence),this.dots[this.RANDOM].length=this.count-this.dots[this.COHERENT].length;for(let t=0;t<this.dots.length;t+=1)for(let i=0;i<this.dots[t].length;i+=1){const a=void 0===this.dots[t][i];a&&(this.dots[t][i]={});const n=this.dots[t][i];if(r||a){n.direction=t===this.RANDOM?360*Math.random():this.currentDirection,n.birth=e-Math.floor(Math.random()*this.lifetime);const i=2*Math.random()*Math.PI,s=Math.sqrt(Math.random());n.x=this.xScale(s*Math.cos(i)),n.y=this.yScale(s*Math.sin(i))}else if(e>n.birth+this.lifetime){n.birth+=this.lifetime,n.direction=t===this.RANDOM?360*Math.random():this.currentDirection;const e=2*Math.random()*Math.PI,i=Math.sqrt(Math.random());n.x=this.xScale(i*Math.cos(e)),n.y=this.yScale(i*Math.sin(e))}else{t===this.COHERENT&&(n.direction=this.currentDirection);const e=n.direction*(Math.PI/180);n.dx=this.speed*(s/1e3)*Math.cos(e),n.dy=this.speed*(s/1e3)*Math.sin(e),n.x+=n.dx,n.y+=n.dy;(n.x-this.xScale(0))**2+(n.y-this.yScale(0))**2>(this.xScale(1)-this.xScale(0))**2&&(n.x=-(n.x-this.xScale(0))+this.xScale(0),n.y=-(n.y-this.yScale(0))+this.yScale(0))}}}const a=_e(this.renderRoot).select(".content").selectAll(".fixation").data("iti"===this.state?[!0]:[]),n=a.enter().append("g").classed("fixation",!0);n.append("line").attr("x1",this.xScale(-.1)).attr("y1",this.xScale(0)).attr("x2",this.xScale(.1)).attr("y2",this.xScale(0)),n.append("line").attr("x1",this.xScale(0)).attr("y1",this.xScale(-.1)).attr("x2",this.xScale(0)).attr("y2",this.xScale(.1)),a.exit().remove();const o=_e(this.renderRoot).select(".content").selectAll(".dots").data("stimulus"===this.state?this.dots:[[],[]]).selectAll(".dot").data(t=>t);o.enter().append("circle").classed("dot",!0).merge(o).attr("cx",t=>t.x).attr("cy",t=>t.y),o.exit().remove();const l=_e(this.renderRoot).select(".content").selectAll(".query").data("wait"===this.state?[!0]:[]);l.enter().append("g").classed("query",!0).append("text").attr("x",this.xScale(0)).attr("y",this.xScale(0)).attr("text-anchor","middle").attr("alignment-baseline","middle").text("?"),l.exit().remove()}}customElements.define("rdk-2afc-task",ha);class ua extends ta{static get properties(){return{numeric:{attribute:"numeric",type:Boolean,reflect:!0}}}constructor(){super(),this.numeric=!1}static get styles(){return[super.styles,n`
1797
+ `]}render(){return Y``}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,s=Math.min(e,i),r=.25*this.rem,a=.25*this.rem,n=.25*this.rem,o=s-(r+a),l=s-(n+.25*this.rem);this.xScale=Gr().domain([-1,1]).range([0,l]),this.yScale=Gr().domain([1,-1]).range([0,o]);const c=_e(this.renderRoot).selectAll(".main").data([{width:this.width,height:this.height,rem:this.rem}]),d=c.enter().append("svg").classed("main",!0),h=d.merge(c).attr("viewBox",`0 0 ${s} ${s}`);d.append("clipPath").attr("id","clip-rdk-task").append("circle"),h.select("clipPath circle").attr("cx",this.xScale(0)).attr("cy",this.yScale(0)).attr("r",this.xScale(1)-this.xScale(0));const u=d.append("g").classed("plot",!0),g=h.select(".plot").attr("transform",`translate(${n}, ${r})`),p=u.append("g").classed("underlayer",!0),m=g.select(".underlayer");p.append("circle").classed("background",!0),m.select(".background").attr("cx",this.xScale(0)).attr("cy",this.yScale(0)).attr("r",this.xScale(1)-this.xScale(0)),u.append("g").classed("content",!0).attr("clip-path","url(#clip-rdk-task)");g.select(".content").selectAll(".dots").data([[],[]]).enter().append("g").classed("dots",!0).classed("coherent",(t,e)=>e===this.COHERENT).classed("random",(t,e)=>e===this.RANDOM);const b=u.append("g").classed("overlayer",!0),Q=g.select(".overlayer");b.append("circle").classed("outline",!0),Q.select(".outline").attr("cx",this.xScale(0)).attr("cy",this.yScale(0)).attr("r",this.xScale(1)-this.yScale(0)),(this.firstUpdate||t.has("running"))&&(this.running?(this.pauseTime&&(this.baseTime+=Us()-this.pauseTime,this.pauseTime=0),this.runner=function(t,e,i){var s=new Is,r=e;return s._restart=s.restart,s.restart=function(t,e,i){e=+e,i=null==i?Us():+i,s._restart(function a(n){n+=r,s._restart(a,r+=e,i),t(n)},e,i)},s.restart(t,e,i),s}(this.run.bind(this),20)):void 0!==this.runner&&(this.runner.stop(),this.pauseTime=Us())),this.firstUpdate=!1}reset(){void 0!==this.runner&&this.runner.stop(),this.running=!1,this.trial=0,this.state="resetted",this.baseTime=0,this.pauseTime=0,this.startTime=0,this.lastTime=0,this.signal=void 0,this.currentDirection=void 0;const t=_e(this.renderRoot).select(".content").selectAll(".dots").data([[],[]]).selectAll(".dot").data(t=>t);t.exit().remove();_e(this.renderRoot).select(".content").selectAll(".fixation").data([]).exit().remove();_e(this.renderRoot).select(".content").selectAll(".query").data([]).exit().remove()}run(){const t=Us(),e=this.baseTime?t-this.baseTime:0,i=this.baseTime?e-this.startTime:0,s=this.baseTime?e-this.lastTime:0;this.lastTime=e;let r=!1;if("resetted"===this.state?(this.state="iti",this.baseTime=t,this.startTime=0,this.dispatchEvent(new CustomEvent("rdk-block-start",{detail:{trials:this.trials},bubbles:!0}))):"iti"===this.state&&i>=this.iti?(r=!0,this.trial+=1,this.state="stimulus",this.startTime=e,this.signal=Math.random()<this.probability?"left":"right",this.currentDirection="left"===this.signal?this.LEFT:this.RIGHT,this.dispatchEvent(new CustomEvent("rdk-trial-start",{detail:{trials:this.trials,duration:this.duration,wait:this.wait,iti:this.iti,trial:this.trial,signal:this.signal},bubbles:!0}))):"stimulus"===this.state&&i>=this.duration?(this.state="wait",this.startTime=e,this.dispatchEvent(new CustomEvent("rdk-trial-middle",{detail:{trials:this.trials,duration:this.duration,wait:this.wait,iti:this.iti,trial:this.trial,signal:this.signal},bubbles:!0}))):"wait"===this.state&&i>=this.wait&&(this.dispatchEvent(new CustomEvent("rdk-trial-end",{detail:{trials:this.trials,duration:this.duration,wait:this.wait,iti:this.iti,trial:this.trial,signal:this.signal},bubbles:!0})),this.trial>=this.trials?(this.runner.stop(),this.running=!1,this.state="ended",this.baseTime=0,this.pauseTime=0,this.startTime=0,this.lastTime=0,this.signal=void 0,this.currentDirection=void 0,this.dispatchEvent(new CustomEvent("rdk-block-end",{detail:{trials:this.trial},bubbles:!0}))):(this.state="iti",this.startTime=e)),"stimulus"===this.state){this.dots[this.COHERENT].length=Math.round(this.count*this.coherence),this.dots[this.RANDOM].length=this.count-this.dots[this.COHERENT].length;for(let t=0;t<this.dots.length;t+=1)for(let i=0;i<this.dots[t].length;i+=1){const a=void 0===this.dots[t][i];a&&(this.dots[t][i]={});const n=this.dots[t][i];if(r||a){n.direction=t===this.RANDOM?360*Math.random():this.currentDirection,n.birth=e-Math.floor(Math.random()*this.lifetime);const i=2*Math.random()*Math.PI,s=Math.sqrt(Math.random());n.x=this.xScale(s*Math.cos(i)),n.y=this.yScale(s*Math.sin(i))}else if(e>n.birth+this.lifetime){n.birth+=this.lifetime,n.direction=t===this.RANDOM?360*Math.random():this.currentDirection;const e=2*Math.random()*Math.PI,i=Math.sqrt(Math.random());n.x=this.xScale(i*Math.cos(e)),n.y=this.yScale(i*Math.sin(e))}else{t===this.COHERENT&&(n.direction=this.currentDirection);const e=n.direction*(Math.PI/180);n.dx=this.speed*(s/1e3)*Math.cos(e),n.dy=this.speed*(s/1e3)*Math.sin(e),n.x+=n.dx,n.y+=n.dy;(n.x-this.xScale(0))**2+(n.y-this.yScale(0))**2>(this.xScale(1)-this.xScale(0))**2&&(n.x=-(n.x-this.xScale(0))+this.xScale(0),n.y=-(n.y-this.yScale(0))+this.yScale(0))}}}const a=_e(this.renderRoot).select(".content").selectAll(".fixation").data("iti"===this.state?[!0]:[]),n=a.enter().append("g").classed("fixation",!0);n.append("line").attr("x1",this.xScale(-.1)).attr("y1",this.xScale(0)).attr("x2",this.xScale(.1)).attr("y2",this.xScale(0)),n.append("line").attr("x1",this.xScale(0)).attr("y1",this.xScale(-.1)).attr("x2",this.xScale(0)).attr("y2",this.xScale(.1)),a.exit().remove();const o=_e(this.renderRoot).select(".content").selectAll(".dots").data("stimulus"===this.state?this.dots:[[],[]]).selectAll(".dot").data(t=>t);o.enter().append("circle").classed("dot",!0).merge(o).attr("cx",t=>t.x).attr("cy",t=>t.y),o.exit().remove();const l=_e(this.renderRoot).select(".content").selectAll(".query").data("wait"===this.state?[!0]:[]);l.enter().append("g").classed("query",!0).append("text").attr("x",this.xScale(0)).attr("y",this.xScale(0)).attr("text-anchor","middle").attr("alignment-baseline","middle").text("?"),l.exit().remove()}}customElements.define("rdk-2afc-task",ha);class ua extends ta{static get properties(){return{numeric:{attribute:"numeric",type:Boolean,reflect:!0}}}constructor(){super(),this.numeric=!1}static get styles(){return[super.styles,n`
1823
1798
  :host {
1824
1799
  display: block;
1825
1800
 
@@ -1880,11 +1855,13 @@ const Or=t=>t??W;customElements.define("decidables-slider",class extends Pr{stat
1880
1855
 
1881
1856
  .addend {
1882
1857
  position: relative;
1858
+
1883
1859
  display: inline-block;
1884
1860
  }
1885
1861
 
1886
1862
  .comparison {
1887
1863
  position: relative;
1864
+
1888
1865
  display: inline-block;
1889
1866
 
1890
1867
  font-size: 125%;
@@ -2180,5 +2157,5 @@ const Or=t=>t??W;customElements.define("decidables-slider",class extends Pr{stat
2180
2157
  <div class="body">
2181
2158
  <slot>Empty!</slot>
2182
2159
  </div>
2183
- </div>`}}customElements.define("ddm-example",ma);class ba extends ma{static get properties(){return{trials:{attribute:"trials",type:Number,reflect:!0},duration:{attribute:"duration",type:Number,reflect:!0},coherence:{attribute:"coherence",type:Number,reflect:!0},color:{attribute:"color",type:String,reflect:!0},a:{attribute:!1,type:Number,reflect:!1},z:{attribute:!1,type:Number,reflect:!1},v:{attribute:!1,type:Number,reflect:!1},t0:{attribute:!1,type:Number,reflect:!1}}}constructor(){super(),this.trials=10,this.duration=2e3,this.coherence=.5,this.colors=["none","measure","outcome","all"],this.color="outcome",this.a=ia.a.DEFAULT,this.z=ia.z.DEFAULT,this.v=ia.v.DEFAULT,this.t0=ia.t0.DEFAULT,this.accumulableControl=null,this.rdkTask=null,this.accumulableResponse=null,this.accumulableTable=null,this.ddmParameters=null,this.ddmModel=null,this.ddmFit=null,this.data=void 0}connectedCallback(){super.connectedCallback(),this.accumulableControl=this.querySelector("accumulable-control"),this.rdkTask=this.querySelector("rdk-2afc-task"),this.accumulableResponse=this.querySelector("accumulable-response"),this.accumulableTable=this.querySelector("accumulable-table"),this.ddmParameters=this.querySelector("ddm-parameters"),this.ddmModel=this.querySelector("ddm-model"),this.ddmFit=this.querySelector("ddm-fit"),this.ddmModel.clear(),this.accumulableControl&&(this.accumulableControl.addEventListener("accumulable-control-trials",t=>{this.trials=t.detail.trials}),this.accumulableControl.addEventListener("accumulable-control-duration",t=>{this.duration=t.detail.duration}),this.accumulableControl.addEventListener("accumulable-control-coherence",t=>{this.coherence=t.detail.coherence}),this.accumulableControl.addEventListener("accumulable-control-color",t=>{this.color=t.detail.color}),this.accumulableControl.addEventListener("accumulable-control-run",()=>{this.rdkTask&&(this.rdkTask.running=!0)}),this.accumulableControl.addEventListener("accumulable-control-pause",()=>{this.rdkTask&&(this.rdkTask.running=!1)}),this.accumulableControl.addEventListener("accumulable-control-reset",()=>{this.rdkTask&&this.rdkTask.reset(),this.accumulableResponse&&this.accumulableResponse.reset(),this.accumulableTable&&(this.accumulableTable.correctCount=NaN,this.accumulableTable.errorCount=NaN,this.accumulableTable.nrCount=NaN,this.accumulableTable.accuracy=NaN,this.accumulableTable.correctMeanRT=NaN,this.accumulableTable.errorMeanRT=NaN,this.accumulableTable.meanRT=NaN,this.accumulableTable.correctSDRT=NaN,this.accumulableTable.errorSDRT=NaN,this.accumulableTable.sdRT=NaN),this.ddmModel&&this.ddmModel.clear(),this.ddmFit&&this.ddmFit.clear()})),this.rdkTask&&this.rdkTask.addEventListener("rdk-trial-start",t=>{this.accumulableResponse&&this.accumulableResponse.start(t.detail.signal,t.detail.trial)}),this.rdkTask&&this.rdkTask.addEventListener("rdk-trial-end",()=>{this.accumulableResponse&&this.accumulableResponse.stop()}),this.rdkTask&&this.rdkTask.addEventListener("rdk-block-end",()=>{this.accumulableControl&&this.accumulableControl.complete()}),this.accumulableResponse&&this.accumulableResponse.addEventListener("accumulable-response",t=>{this.data=t.detail.data,this.ddmModel&&this.ddmModel.trial({index:t.detail.trial,rt:t.detail.rt,outcome:t.detail.outcome}),this.ddmFit&&this.ddmFit.set({accuracy:t.detail.data.accuracy,correctMeanRT:t.detail.data.correctMeanRT,errorMeanRT:t.detail.data.errorMeanRT,meanRT:t.detail.data.meanRT,correctSDRT:t.detail.data.correctSDRT,errorSDRT:t.detail.data.errorSDRT,sdRT:t.detail.data.sdRT}),this.requestUpdate()}),this.ddmFit&&this.ddmFit.addEventListener("ddm-fit-update",t=>{this.a=t.detail.a,this.z=.5,this.v=t.detail.v,this.t0=t.detail.t0})}update(t){super.update(t),this.accumulableControl&&(this.accumulableControl.trials=null!=this.accumulableControl.trials?this.trials:void 0,this.accumulableControl.duration=null!=this.accumulableControl.duration?this.duration:void 0,this.accumulableControl.coherence=null!=this.accumulableControl.coherence?this.coherence:void 0,this.accumulableControl.color=null!=this.accumulableControl.color?this.color:void 0),this.rdkTask&&(this.rdkTask.trials=this.trials,this.rdkTask.duration=this.duration,this.rdkTask.wait=this.duration,this.rdkTask.iti=this.duration,this.rdkTask.coherence=this.coherence),this.ddmParameters&&(this.ddmParameters.a=null!=this.ddmParameters.a?this.a:void 0,this.ddmParameters.z=null!=this.ddmParameters.z?this.z:void 0,this.ddmParameters.v=null!=this.ddmParameters.a?this.v:void 0,this.ddmParameters.t0=null!=this.ddmParameters.t0?this.t0:void 0),this.ddmModel&&(this.ddmModel.a=+this.a,this.ddmModel.z=+this.z,this.ddmModel.v=+this.v,this.ddmModel.t0=+this.t0),this.accumulableResponse&&(this.accumulableResponse.trialTotal=this.trials),this.accumulableTable&&(this.accumulableTable.color=this.color),this.accumulableTable&&this.data&&(this.accumulableTable.correctCount=this.data.correctCount,this.accumulableTable.errorCount=this.data.errorCount,this.accumulableTable.nrCount=this.data.nrCount,this.accumulableTable.accuracy=this.data.accuracy,this.accumulableTable.correctMeanRT=this.data.correctMeanRT,this.accumulableTable.errorMeanRT=this.data.errorMeanRT,this.accumulableTable.meanRT=this.data.meanRT,this.accumulableTable.correctSDRT=this.data.correctSDRT,this.accumulableTable.errorSDRT=this.data.errorSDRT,this.accumulableTable.sdRT=this.data.sdRT)}}customElements.define("ddm-example-human",ba);class ya extends ma{static get properties(){return{trials:{attribute:"trials",type:Number,reflect:!0},color:{attribute:"color",type:String,reflect:!0},a:{attribute:"boundary-separation",type:Number,reflect:!0},z:{attribute:"starting-point",type:Number,reflect:!0},v:{attribute:"drift-rate",type:Number,reflect:!0},t0:{attribute:"nondecision-time",type:Number,reflect:!0}}}constructor(){super(),this.trials=10,this.colors=["none","measure","outcome","all"],this.color="outcome",this.a=ia.a.DEFAULT,this.z=ia.z.DEFAULT,this.v=ia.v.DEFAULT,this.t0=ia.t0.DEFAULT,this.accumulableControl=null,this.accumulableTable=null,this.ddmParameters=null,this.ddmModel=null,this.data=void 0,this.model=void 0}connectedCallback(){super.connectedCallback(),this.accumulableControl=this.querySelector("accumulable-control"),this.accumulableTable=this.querySelector("accumulable-table"),this.ddmParameters=this.querySelector("ddm-parameters"),this.ddmModel=this.querySelector("ddm-model"),this.accumulableControl&&(this.accumulableControl.addEventListener("accumulable-control-resample",()=>{this.ddmModel?.resample(),this.requestUpdate()}),this.accumulableControl.addEventListener("accumulable-control-trials",t=>{this.trials=t.detail.trials}),this.accumulableControl.addEventListener("accumulable-control-color",t=>{this.color=t.detail.color})),this.ddmParameters&&(this.ddmParameters.addEventListener("ddm-parameters-a",t=>{this.a=t.detail.a}),this.ddmParameters.addEventListener("ddm-parameters-z",t=>{this.z=t.detail.z}),this.ddmParameters.addEventListener("ddm-parameters-v",t=>{this.v=t.detail.v}),this.ddmParameters.addEventListener("ddm-parameters-t0",t=>{this.t0=t.detail.t0})),this.ddmModel&&(this.ddmModel.addEventListener("ddm-model-a",t=>{this.a=t.detail.a}),this.ddmModel.addEventListener("ddm-model-z",t=>{this.z=t.detail.z}),this.ddmModel.addEventListener("ddm-model-v",t=>{this.v=t.detail.v}),this.ddmModel.addEventListener("ddm-model-t0",t=>{this.t0=t.detail.t0}),this.ddmModel.addEventListener("ddm-model-output",t=>{this.data=t.detail.data,this.model=t.detail.model,this.requestUpdate()})),this.requestUpdate()}update(t){super.update(t),this.accumulableControl&&(this.accumulableControl.trials=null!=this.accumulableControl.trials?this.trials:void 0,this.accumulableControl.color=null!=this.accumulableControl.color?this.color:void 0),this.accumulableTable&&(this.accumulableTable.color=this.color),this.accumulableTable&&this.data&&(this.accumulableTable.correctCount=this.data.correctCount,this.accumulableTable.errorCount=this.data.errorCount,this.accumulableTable.nrCount=this.data.nrCount,this.accumulableTable.accuracy=this.data.accuracy,this.accumulableTable.correctMeanRT=this.data.correctMeanRT,this.accumulableTable.errorMeanRT=this.data.errorMeanRT,this.accumulableTable.meanRT=this.data.meanRT,this.accumulableTable.correctSDRT=this.data.correctSDRT,this.accumulableTable.errorSDRT=this.data.errorSDRT,this.accumulableTable.sdRT=this.data.sdRT),this.ddmParameters&&(this.ddmParameters.a=null!=this.ddmParameters.a?this.a:void 0,this.ddmParameters.z=null!=this.ddmParameters.z?this.z:void 0,this.ddmParameters.v=null!=this.ddmParameters.a?this.v:void 0,this.ddmParameters.t0=null!=this.ddmParameters.t0?this.t0:void 0),this.ddmModel&&(this.ddmModel.trials=this.trials,this.ddmModel.a=+this.a,this.ddmModel.z=+this.z,this.ddmModel.v=+this.v,this.ddmModel.t0=+this.t0)}}customElements.define("ddm-example-interactive",ya);class Qa extends ma{static get properties(){return{trials:{attribute:"trials",type:Number,reflect:!0},duration:{attribute:"duration",type:Number,reflect:!0},coherence:{attribute:"coherence",type:Number,reflect:!0},color:{attribute:"color",type:String,reflect:!0},a:{attribute:"boundary-separation",type:Number,reflect:!0},z:{attribute:"starting-point",type:Number,reflect:!0},v:{attribute:"drift-rate",type:Number,reflect:!0},t0:{attribute:"nondecision-time",type:Number,reflect:!0}}}constructor(){super(),this.trials=10,this.duration=2e3,this.coherence=.5,this.colors=["none","measure","outcome","all"],this.color="outcome",this.a=ia.a.DEFAULT,this.z=ia.z.DEFAULT,this.v=ia.v.DEFAULT,this.t0=ia.t0.DEFAULT,this.accumulableControl=null,this.rdkTask=null,this.ddmParameters=null,this.ddmModel=null,this.accumulableResponse=null,this.accumulableTable=null,this.trialCount=0,this.signals=["left","right"],this.signal=void 0,this.data=void 0,this.model=void 0}connectedCallback(){super.connectedCallback(),this.accumulableControl=this.querySelector("accumulable-control"),this.rdkTask=this.querySelector("rdk-2afc-task"),this.ddmParameters=this.querySelector("ddm-parameters"),this.ddmModel=this.querySelector("ddm-model"),this.accumulableResponse=this.querySelector("accumulable-response"),this.accumulableTable=this.querySelector("accumulable-table"),this.accumulableControl&&(this.accumulableControl.addEventListener("accumulable-control-trials",t=>{this.trials=t.detail.trials}),this.accumulableControl.addEventListener("accumulable-control-duration",t=>{this.duration=t.detail.duration}),this.accumulableControl.addEventListener("accumulable-control-color",t=>{this.color=t.detail.color}),this.accumulableControl.addEventListener("accumulable-control-run",()=>{this.rdkTask&&(this.rdkTask.running=!0),this.ddmModel&&this.ddmModel.resumeTrial()}),this.accumulableControl.addEventListener("accumulable-control-pause",()=>{this.rdkTask&&(this.rdkTask.running=!1),this.ddmModel&&this.ddmModel.pauseTrial()}),this.accumulableControl.addEventListener("accumulable-control-reset",()=>{this.trialCount=0,this.signal=void 0,this.rdkTask&&this.rdkTask.reset(),this.ddmModel&&(this.ddmModel.trials=this.trialCount),this.accumulableResponse&&this.accumulableResponse.reset(),this.accumulableTable})),this.rdkTask&&(this.rdkTask.addEventListener("rdk-trial-start",t=>{this.signal=t.detail.signal,this.accumulableResponse&&this.accumulableResponse.start(t.detail.signal,t.detail.trial),this.ddmModel&&(this.trialCount+=1,this.ddmModel.trial())}),this.rdkTask.addEventListener("rdk-trial-end",()=>{this.signal=void 0,this.accumulableResponse&&this.accumulableResponse.stop()}),this.rdkTask.addEventListener("rdk-block-end",()=>{this.accumulableControl&&this.accumulableControl.complete()})),this.ddmParameters&&(this.ddmParameters.addEventListener("ddm-parameters-a",t=>{this.a=t.detail.a}),this.ddmParameters.addEventListener("ddm-parameters-z",t=>{this.z=t.detail.z}),this.ddmParameters.addEventListener("ddm-parameters-v",t=>{this.v=t.detail.v}),this.ddmParameters.addEventListener("ddm-parameters-t0",t=>{this.t0=t.detail.t0})),this.ddmModel&&(this.ddmModel.addEventListener("ddm-model-a",t=>{this.a=t.detail.a}),this.ddmModel.addEventListener("ddm-model-z",t=>{this.z=t.detail.z}),this.ddmModel.addEventListener("ddm-model-v",t=>{this.v=t.detail.v}),this.ddmModel.addEventListener("ddm-model-t0",t=>{this.t0=t.detail.t0}),this.ddmModel.addEventListener("ddm-model-output",t=>{this.data=t.detail.data,this.model=t.detail.model,this.requestUpdate()}),this.ddmModel.addEventListener("accumulable-response",t=>{if(this.accumulableResponse){const e="correct"===t.detail.outcome?this.signal:"left"===this.signal?"right":"left";this.accumulableResponse.responded(e)}this.data=t.detail.data,this.model=t.detail.model,this.requestUpdate()})),this.requestUpdate()}update(t){super.update(t),this.trialCount>this.trials&&(this.trialCount=this.trials),this.accumulableControl&&(this.accumulableControl.trials=null!=this.accumulableControl.trials?this.trials:void 0,this.accumulableControl.duration=null!=this.accumulableControl.duration?this.duration:void 0,this.accumulableControl.coherence=null!=this.accumulableControl.coherence?this.coherence:void 0,this.accumulableControl.color=null!=this.accumulableControl.color?this.color:void 0),this.rdkTask&&(this.rdkTask.trials=this.trials,this.rdkTask.duration=this.duration,this.rdkTask.coherence=this.coherence),this.ddmParameters&&(this.ddmParameters.a=null!=this.ddmParameters.a?this.a:void 0,this.ddmParameters.z=null!=this.ddmParameters.z?this.z:void 0,this.ddmParameters.v=null!=this.ddmParameters.a?this.v:void 0,this.ddmParameters.t0=null!=this.ddmParameters.t0?this.t0:void 0),this.ddmModel&&(this.ddmModel.trials=this.trialCount,this.ddmModel.a=+this.a,this.ddmModel.z=+this.z,this.ddmModel.v=+this.v,this.ddmModel.t0=+this.t0),this.accumulableResponse&&(this.accumulableResponse.trialTotal=this.trials),this.accumulableTable&&(this.accumulableTable.color=this.color),this.accumulableTable&&this.data&&(this.accumulableTable.correctCount=this.data.correctCount,this.accumulableTable.errorCount=this.data.errorCount,this.accumulableTable.nrCount=this.data.nrCount,this.accumulableTable.accuracy=this.data.accuracy,this.accumulableTable.correctMeanRT=this.data.correctMeanRT,this.accumulableTable.errorMeanRT=this.data.errorMeanRT,this.accumulableTable.meanRT=this.data.meanRT,this.accumulableTable.correctSDRT=this.data.correctSDRT,this.accumulableTable.errorSDRT=this.data.errorSDRT,this.accumulableTable.sdRT=this.data.sdRT)}}customElements.define("ddm-example-model",Qa);export{ea as AccumulableControl,ta as AccumulableElement,sa as AccumulableResponse,ra as AccumulableTable,ga as DDMEquationAZV2PC,pa as DDMEquationAZVT02M,ba as DDMExampleHuman,ya as DDMExampleInteractive,Qa as DDMExampleModel,la as DDMFit,da as DDMModel,ca as DDMParameters,ha as RDK2AFCTask};
2160
+ </div>`}}customElements.define("ddm-example",ma);class ba extends ma{static get properties(){return{trials:{attribute:"trials",type:Number,reflect:!0},duration:{attribute:"duration",type:Number,reflect:!0},coherence:{attribute:"coherence",type:Number,reflect:!0},color:{attribute:"color",type:String,reflect:!0},a:{attribute:!1,type:Number,reflect:!1},z:{attribute:!1,type:Number,reflect:!1},v:{attribute:!1,type:Number,reflect:!1},t0:{attribute:!1,type:Number,reflect:!1}}}constructor(){super(),this.trials=10,this.duration=2e3,this.coherence=.5,this.colors=["none","measure","outcome","all"],this.color="outcome",this.a=ia.a.DEFAULT,this.z=ia.z.DEFAULT,this.v=ia.v.DEFAULT,this.t0=ia.t0.DEFAULT,this.accumulableControl=null,this.rdkTask=null,this.accumulableResponse=null,this.accumulableTable=null,this.ddmParameters=null,this.ddmModel=null,this.ddmFit=null,this.data=void 0}connectedCallback(){super.connectedCallback(),this.accumulableControl=this.querySelector("accumulable-control"),this.rdkTask=this.querySelector("rdk-2afc-task"),this.accumulableResponse=this.querySelector("accumulable-response"),this.accumulableTable=this.querySelector("accumulable-table"),this.ddmParameters=this.querySelector("ddm-parameters"),this.ddmModel=this.querySelector("ddm-model"),this.ddmFit=this.querySelector("ddm-fit"),this.ddmModel.clear(),this.accumulableControl&&(this.accumulableControl.addEventListener("accumulable-control-trials",t=>{this.trials=t.detail.trials}),this.accumulableControl.addEventListener("accumulable-control-duration",t=>{this.duration=t.detail.duration}),this.accumulableControl.addEventListener("accumulable-control-coherence",t=>{this.coherence=t.detail.coherence}),this.accumulableControl.addEventListener("accumulable-control-color",t=>{this.color=t.detail.color}),this.accumulableControl.addEventListener("accumulable-control-run",()=>{this.rdkTask&&(this.rdkTask.running=!0)}),this.accumulableControl.addEventListener("accumulable-control-pause",()=>{this.rdkTask&&(this.rdkTask.running=!1)}),this.accumulableControl.addEventListener("accumulable-control-reset",()=>{this.rdkTask&&this.rdkTask.reset(),this.accumulableResponse&&this.accumulableResponse.reset(),this.accumulableTable&&(this.accumulableTable.correctCount=NaN,this.accumulableTable.errorCount=NaN,this.accumulableTable.nrCount=NaN,this.accumulableTable.accuracy=NaN,this.accumulableTable.correctMeanRT=NaN,this.accumulableTable.errorMeanRT=NaN,this.accumulableTable.meanRT=NaN,this.accumulableTable.correctSDRT=NaN,this.accumulableTable.errorSDRT=NaN,this.accumulableTable.sdRT=NaN),this.ddmModel&&this.ddmModel.clear(),this.ddmFit&&this.ddmFit.clear()})),this.rdkTask&&this.rdkTask.addEventListener("rdk-trial-start",t=>{this.accumulableResponse&&this.accumulableResponse.start(t.detail.signal,t.detail.trial)}),this.rdkTask&&this.rdkTask.addEventListener("rdk-trial-end",()=>{this.accumulableResponse&&this.accumulableResponse.stop()}),this.rdkTask&&this.rdkTask.addEventListener("rdk-block-end",()=>{this.accumulableControl&&this.accumulableControl.complete()}),this.accumulableResponse&&this.accumulableResponse.addEventListener("accumulable-response",t=>{this.data=t.detail.data,this.ddmModel&&this.ddmModel.trial({index:t.detail.trial,rt:t.detail.rt,outcome:t.detail.outcome}),this.ddmFit&&this.ddmFit.set({accuracy:t.detail.data.accuracy,correctMeanRT:t.detail.data.correctMeanRT,errorMeanRT:t.detail.data.errorMeanRT,meanRT:t.detail.data.meanRT,correctSDRT:t.detail.data.correctSDRT,errorSDRT:t.detail.data.errorSDRT,sdRT:t.detail.data.sdRT}),this.requestUpdate()}),this.ddmFit&&this.ddmFit.addEventListener("ddm-fit-update",t=>{this.a=t.detail.a,this.z=.5,this.v=t.detail.v,this.t0=t.detail.t0})}update(t){super.update(t),this.accumulableControl&&(this.accumulableControl.trials=null!=this.accumulableControl.trials?this.trials:void 0,this.accumulableControl.duration=null!=this.accumulableControl.duration?this.duration:void 0,this.accumulableControl.coherence=null!=this.accumulableControl.coherence?this.coherence:void 0,this.accumulableControl.color=null!=this.accumulableControl.color?this.color:void 0),this.rdkTask&&(this.rdkTask.trials=this.trials,this.rdkTask.duration=this.duration,this.rdkTask.wait=this.duration,this.rdkTask.iti=this.duration,this.rdkTask.coherence=this.coherence),this.ddmParameters&&(this.ddmParameters.a=null!=this.ddmParameters.a?this.a:void 0,this.ddmParameters.z=null!=this.ddmParameters.z?this.z:void 0,this.ddmParameters.v=null!=this.ddmParameters.a?this.v:void 0,this.ddmParameters.t0=null!=this.ddmParameters.t0?this.t0:void 0),this.ddmModel&&(this.ddmModel.a=+this.a,this.ddmModel.z=+this.z,this.ddmModel.v=+this.v,this.ddmModel.t0=+this.t0),this.accumulableResponse&&(this.accumulableResponse.trialTotal=this.trials),this.accumulableTable&&(this.accumulableTable.color=this.color),this.accumulableTable&&this.data&&(this.accumulableTable.correctCount=this.data.correctCount,this.accumulableTable.errorCount=this.data.errorCount,this.accumulableTable.nrCount=this.data.nrCount,this.accumulableTable.accuracy=this.data.accuracy,this.accumulableTable.correctMeanRT=this.data.correctMeanRT,this.accumulableTable.errorMeanRT=this.data.errorMeanRT,this.accumulableTable.meanRT=this.data.meanRT,this.accumulableTable.correctSDRT=this.data.correctSDRT,this.accumulableTable.errorSDRT=this.data.errorSDRT,this.accumulableTable.sdRT=this.data.sdRT)}}customElements.define("ddm-example-human",ba);class Qa extends ma{static get properties(){return{trials:{attribute:"trials",type:Number,reflect:!0},color:{attribute:"color",type:String,reflect:!0},a:{attribute:"boundary-separation",type:Number,reflect:!0},z:{attribute:"starting-point",type:Number,reflect:!0},v:{attribute:"drift-rate",type:Number,reflect:!0},t0:{attribute:"nondecision-time",type:Number,reflect:!0}}}constructor(){super(),this.trials=10,this.colors=["none","measure","outcome","all"],this.color="outcome",this.a=ia.a.DEFAULT,this.z=ia.z.DEFAULT,this.v=ia.v.DEFAULT,this.t0=ia.t0.DEFAULT,this.accumulableControl=null,this.accumulableTable=null,this.ddmParameters=null,this.ddmModel=null,this.data=void 0,this.model=void 0}connectedCallback(){super.connectedCallback(),this.accumulableControl=this.querySelector("accumulable-control"),this.accumulableTable=this.querySelector("accumulable-table"),this.ddmParameters=this.querySelector("ddm-parameters"),this.ddmModel=this.querySelector("ddm-model"),this.accumulableControl&&(this.accumulableControl.addEventListener("accumulable-control-resample",()=>{this.ddmModel?.resample(),this.requestUpdate()}),this.accumulableControl.addEventListener("accumulable-control-trials",t=>{this.trials=t.detail.trials}),this.accumulableControl.addEventListener("accumulable-control-color",t=>{this.color=t.detail.color})),this.ddmParameters&&(this.ddmParameters.addEventListener("ddm-parameters-a",t=>{this.a=t.detail.a}),this.ddmParameters.addEventListener("ddm-parameters-z",t=>{this.z=t.detail.z}),this.ddmParameters.addEventListener("ddm-parameters-v",t=>{this.v=t.detail.v}),this.ddmParameters.addEventListener("ddm-parameters-t0",t=>{this.t0=t.detail.t0})),this.ddmModel&&(this.ddmModel.addEventListener("ddm-model-a",t=>{this.a=t.detail.a}),this.ddmModel.addEventListener("ddm-model-z",t=>{this.z=t.detail.z}),this.ddmModel.addEventListener("ddm-model-v",t=>{this.v=t.detail.v}),this.ddmModel.addEventListener("ddm-model-t0",t=>{this.t0=t.detail.t0}),this.ddmModel.addEventListener("ddm-model-output",t=>{this.data=t.detail.data,this.model=t.detail.model,this.requestUpdate()})),this.requestUpdate()}update(t){super.update(t),this.accumulableControl&&(this.accumulableControl.trials=null!=this.accumulableControl.trials?this.trials:void 0,this.accumulableControl.color=null!=this.accumulableControl.color?this.color:void 0),this.accumulableTable&&(this.accumulableTable.color=this.color),this.accumulableTable&&this.data&&(this.accumulableTable.correctCount=this.data.correctCount,this.accumulableTable.errorCount=this.data.errorCount,this.accumulableTable.nrCount=this.data.nrCount,this.accumulableTable.accuracy=this.data.accuracy,this.accumulableTable.correctMeanRT=this.data.correctMeanRT,this.accumulableTable.errorMeanRT=this.data.errorMeanRT,this.accumulableTable.meanRT=this.data.meanRT,this.accumulableTable.correctSDRT=this.data.correctSDRT,this.accumulableTable.errorSDRT=this.data.errorSDRT,this.accumulableTable.sdRT=this.data.sdRT),this.ddmParameters&&(this.ddmParameters.a=null!=this.ddmParameters.a?this.a:void 0,this.ddmParameters.z=null!=this.ddmParameters.z?this.z:void 0,this.ddmParameters.v=null!=this.ddmParameters.a?this.v:void 0,this.ddmParameters.t0=null!=this.ddmParameters.t0?this.t0:void 0),this.ddmModel&&(this.ddmModel.trials=this.trials,this.ddmModel.a=+this.a,this.ddmModel.z=+this.z,this.ddmModel.v=+this.v,this.ddmModel.t0=+this.t0)}}customElements.define("ddm-example-interactive",Qa);class Ba extends ma{static get properties(){return{trials:{attribute:"trials",type:Number,reflect:!0},duration:{attribute:"duration",type:Number,reflect:!0},coherence:{attribute:"coherence",type:Number,reflect:!0},color:{attribute:"color",type:String,reflect:!0},a:{attribute:"boundary-separation",type:Number,reflect:!0},z:{attribute:"starting-point",type:Number,reflect:!0},v:{attribute:"drift-rate",type:Number,reflect:!0},t0:{attribute:"nondecision-time",type:Number,reflect:!0}}}constructor(){super(),this.trials=10,this.duration=2e3,this.coherence=.5,this.colors=["none","measure","outcome","all"],this.color="outcome",this.a=ia.a.DEFAULT,this.z=ia.z.DEFAULT,this.v=ia.v.DEFAULT,this.t0=ia.t0.DEFAULT,this.accumulableControl=null,this.rdkTask=null,this.ddmParameters=null,this.ddmModel=null,this.accumulableResponse=null,this.accumulableTable=null,this.trialCount=0,this.signals=["left","right"],this.signal=void 0,this.data=void 0,this.model=void 0}connectedCallback(){super.connectedCallback(),this.accumulableControl=this.querySelector("accumulable-control"),this.rdkTask=this.querySelector("rdk-2afc-task"),this.ddmParameters=this.querySelector("ddm-parameters"),this.ddmModel=this.querySelector("ddm-model"),this.accumulableResponse=this.querySelector("accumulable-response"),this.accumulableTable=this.querySelector("accumulable-table"),this.accumulableControl&&(this.accumulableControl.addEventListener("accumulable-control-trials",t=>{this.trials=t.detail.trials}),this.accumulableControl.addEventListener("accumulable-control-duration",t=>{this.duration=t.detail.duration}),this.accumulableControl.addEventListener("accumulable-control-color",t=>{this.color=t.detail.color}),this.accumulableControl.addEventListener("accumulable-control-run",()=>{this.rdkTask&&(this.rdkTask.running=!0),this.ddmModel&&this.ddmModel.resumeTrial()}),this.accumulableControl.addEventListener("accumulable-control-pause",()=>{this.rdkTask&&(this.rdkTask.running=!1),this.ddmModel&&this.ddmModel.pauseTrial()}),this.accumulableControl.addEventListener("accumulable-control-reset",()=>{this.trialCount=0,this.signal=void 0,this.rdkTask&&this.rdkTask.reset(),this.ddmModel&&(this.ddmModel.trials=this.trialCount),this.accumulableResponse&&this.accumulableResponse.reset(),this.accumulableTable})),this.rdkTask&&(this.rdkTask.addEventListener("rdk-trial-start",t=>{this.signal=t.detail.signal,this.accumulableResponse&&this.accumulableResponse.start(t.detail.signal,t.detail.trial),this.ddmModel&&(this.trialCount+=1,this.ddmModel.trial())}),this.rdkTask.addEventListener("rdk-trial-end",()=>{this.signal=void 0,this.accumulableResponse&&this.accumulableResponse.stop()}),this.rdkTask.addEventListener("rdk-block-end",()=>{this.accumulableControl&&this.accumulableControl.complete()})),this.ddmParameters&&(this.ddmParameters.addEventListener("ddm-parameters-a",t=>{this.a=t.detail.a}),this.ddmParameters.addEventListener("ddm-parameters-z",t=>{this.z=t.detail.z}),this.ddmParameters.addEventListener("ddm-parameters-v",t=>{this.v=t.detail.v}),this.ddmParameters.addEventListener("ddm-parameters-t0",t=>{this.t0=t.detail.t0})),this.ddmModel&&(this.ddmModel.addEventListener("ddm-model-a",t=>{this.a=t.detail.a}),this.ddmModel.addEventListener("ddm-model-z",t=>{this.z=t.detail.z}),this.ddmModel.addEventListener("ddm-model-v",t=>{this.v=t.detail.v}),this.ddmModel.addEventListener("ddm-model-t0",t=>{this.t0=t.detail.t0}),this.ddmModel.addEventListener("ddm-model-output",t=>{this.data=t.detail.data,this.model=t.detail.model,this.requestUpdate()}),this.ddmModel.addEventListener("accumulable-response",t=>{if(this.accumulableResponse){const e="correct"===t.detail.outcome?this.signal:"left"===this.signal?"right":"left";this.accumulableResponse.responded(e)}this.data=t.detail.data,this.model=t.detail.model,this.requestUpdate()})),this.requestUpdate()}update(t){super.update(t),this.trialCount>this.trials&&(this.trialCount=this.trials),this.accumulableControl&&(this.accumulableControl.trials=null!=this.accumulableControl.trials?this.trials:void 0,this.accumulableControl.duration=null!=this.accumulableControl.duration?this.duration:void 0,this.accumulableControl.coherence=null!=this.accumulableControl.coherence?this.coherence:void 0,this.accumulableControl.color=null!=this.accumulableControl.color?this.color:void 0),this.rdkTask&&(this.rdkTask.trials=this.trials,this.rdkTask.duration=this.duration,this.rdkTask.coherence=this.coherence),this.ddmParameters&&(this.ddmParameters.a=null!=this.ddmParameters.a?this.a:void 0,this.ddmParameters.z=null!=this.ddmParameters.z?this.z:void 0,this.ddmParameters.v=null!=this.ddmParameters.a?this.v:void 0,this.ddmParameters.t0=null!=this.ddmParameters.t0?this.t0:void 0),this.ddmModel&&(this.ddmModel.trials=this.trialCount,this.ddmModel.a=+this.a,this.ddmModel.z=+this.z,this.ddmModel.v=+this.v,this.ddmModel.t0=+this.t0),this.accumulableResponse&&(this.accumulableResponse.trialTotal=this.trials),this.accumulableTable&&(this.accumulableTable.color=this.color),this.accumulableTable&&this.data&&(this.accumulableTable.correctCount=this.data.correctCount,this.accumulableTable.errorCount=this.data.errorCount,this.accumulableTable.nrCount=this.data.nrCount,this.accumulableTable.accuracy=this.data.accuracy,this.accumulableTable.correctMeanRT=this.data.correctMeanRT,this.accumulableTable.errorMeanRT=this.data.errorMeanRT,this.accumulableTable.meanRT=this.data.meanRT,this.accumulableTable.correctSDRT=this.data.correctSDRT,this.accumulableTable.errorSDRT=this.data.errorSDRT,this.accumulableTable.sdRT=this.data.sdRT)}}customElements.define("ddm-example-model",Ba);export{ea as AccumulableControl,ta as AccumulableElement,sa as AccumulableResponse,ra as AccumulableTable,ga as DDMEquationAZV2PC,pa as DDMEquationAZVT02M,ba as DDMExampleHuman,Qa as DDMExampleInteractive,Ba as DDMExampleModel,la as DDMFit,da as DDMModel,ca as DDMParameters,ha as RDK2AFCTask};
2184
2161
  //# sourceMappingURL=accumulableElements.esm.min.js.map