@decidables/detectable-elements 0.2.3 → 0.2.5
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.
- package/CHANGELOG.md +17 -0
- package/lib/detectableElements.esm.js +491 -486
- package/lib/detectableElements.esm.js.map +1 -1
- package/lib/detectableElements.esm.min.js +211 -211
- package/lib/detectableElements.esm.min.js.map +1 -1
- package/lib/detectableElements.umd.js +490 -485
- package/lib/detectableElements.umd.js.map +1 -1
- package/lib/detectableElements.umd.min.js +211 -211
- package/lib/detectableElements.umd.min.js.map +1 -1
- package/package.json +7 -7
- package/src/components/detectable-control.js +1 -1
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @license
|
|
4
4
|
* Copyright 2019 Google LLC
|
|
5
5
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
6
|
-
*/const e=window,r=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,n=Symbol(),i=new WeakMap;
|
|
6
|
+
*/const e=window,r=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,n=Symbol(),i=new WeakMap;let s=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==n)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(r&&void 0===t){const r=void 0!==e&&1===e.length;r&&(t=i.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&i.set(e,t))}return t}toString(){return this.cssText}};const a=r?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const r of t.cssRules)e+=r.cssText;return(t=>new s("string"==typeof t?t:t+"",void 0,n))(e)})(t):t
|
|
7
7
|
/**
|
|
8
8
|
* @license
|
|
9
9
|
* Copyright 2017 Google LLC
|
|
@@ -14,30 +14,30 @@
|
|
|
14
14
|
* Copyright 2017 Google LLC
|
|
15
15
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
16
16
|
*/
|
|
17
|
-
var b;m.finalized=!0,m.elementProperties=new Map,m.elementStyles=[],m.shadowRootOptions={mode:"open"},null==u||u({ReactiveElement:m}),(null!==(o=l.reactiveElementVersions)&&void 0!==o?o:l.reactiveElementVersions=[]).push("1.
|
|
17
|
+
var b;m.finalized=!0,m.elementProperties=new Map,m.elementStyles=[],m.shadowRootOptions={mode:"open"},null==u||u({ReactiveElement:m}),(null!==(o=l.reactiveElementVersions)&&void 0!==o?o:l.reactiveElementVersions=[]).push("1.6.1");const v=window,g=v.trustedTypes,y=g?g.createPolicy("lit-html",{createHTML:t=>t}):void 0,w="$lit$",x=`lit$${(Math.random()+"").slice(9)}$`,$="?"+x,_=`<${$}>`,k=document,S=()=>k.createComment(""),A=t=>null===t||"object"!=typeof t&&"function"!=typeof t,E=Array.isArray,M="[ \t\n\f\r]",T=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,C=/-->/g,N=/>/g,R=RegExp(`>|${M}(?:([^\\s"'>=/]+)(${M}*=${M}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),q=/'/g,P=/"/g,z=/^(?:script|style|textarea|title)$/i,F=Symbol.for("lit-noChange"),O=Symbol.for("lit-nothing"),H=new WeakMap,U=k.createTreeWalker(k,129,null,!1);function D(t,e){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==y?y.createHTML(e):e}let I=class t{constructor({strings:e,_$litType$:r},n){let i;this.parts=[];let s=0,a=0;const o=e.length-1,l=this.parts,[c,h]=((t,e)=>{const r=t.length-1,n=[];let i,s=2===e?"<svg>":"",a=T;for(let e=0;e<r;e++){const r=t[e];let o,l,c=-1,h=0;for(;h<r.length&&(a.lastIndex=h,l=a.exec(r),null!==l);)h=a.lastIndex,a===T?"!--"===l[1]?a=C:void 0!==l[1]?a=N:void 0!==l[2]?(z.test(l[2])&&(i=RegExp("</"+l[2],"g")),a=R):void 0!==l[3]&&(a=R):a===R?">"===l[0]?(a=null!=i?i:T,c=-1):void 0===l[1]?c=-2:(c=a.lastIndex-l[2].length,o=l[1],a=void 0===l[3]?R:'"'===l[3]?P:q):a===P||a===q?a=R:a===C||a===N?a=T:(a=R,i=void 0);const u=a===R&&t[e+1].startsWith("/>")?" ":"";s+=a===T?r+_:c>=0?(n.push(o),r.slice(0,c)+w+r.slice(c)+x+u):r+x+(-2===c?(n.push(void 0),e):u)}return[D(t,s+(t[r]||"<?>")+(2===e?"</svg>":"")),n]})(e,r);if(this.el=t.createElement(c,n),U.currentNode=this.el.content,2===r){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(i=U.nextNode())&&l.length<o;){if(1===i.nodeType){if(i.hasAttributes()){const t=[];for(const e of i.getAttributeNames())if(e.endsWith(w)||e.startsWith(x)){const r=h[a++];if(t.push(e),void 0!==r){const t=i.getAttribute(r.toLowerCase()+w).split(x),e=/([.?@])?(.*)/.exec(r);l.push({type:1,index:s,name:e[2],strings:t,ctor:"."===e[1]?K:"?"===e[1]?X:"@"===e[1]?Y:B})}else l.push({type:6,index:s})}for(const e of t)i.removeAttribute(e)}if(z.test(i.tagName)){const t=i.textContent.split(x),e=t.length-1;if(e>0){i.textContent=g?g.emptyScript:"";for(let r=0;r<e;r++)i.append(t[r],S()),U.nextNode(),l.push({type:2,index:++s});i.append(t[e],S())}}}else if(8===i.nodeType)if(i.data===$)l.push({type:2,index:s});else{let t=-1;for(;-1!==(t=i.data.indexOf(x,t+1));)l.push({type:7,index:s}),t+=x.length-1}s++}}static createElement(t,e){const r=k.createElement("template");return r.innerHTML=t,r}};function L(t,e,r=t,n){var i,s,a,o;if(e===F)return e;let l=void 0!==n?null===(i=r._$Co)||void 0===i?void 0:i[n]:r._$Cl;const c=A(e)?void 0:e._$litDirective$;return(null==l?void 0:l.constructor)!==c&&(null===(s=null==l?void 0:l._$AO)||void 0===s||s.call(l,!1),void 0===c?l=void 0:(l=new c(t),l._$AT(t,r,n)),void 0!==n?(null!==(a=(o=r)._$Co)&&void 0!==a?a:o._$Co=[])[n]=l:r._$Cl=l),void 0!==l&&(e=L(t,l._$AS(t,e.values),l,n)),e}let j=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){var e;const{el:{content:r},parts:n}=this._$AD,i=(null!==(e=null==t?void 0:t.creationScope)&&void 0!==e?e:k).importNode(r,!0);U.currentNode=i;let s=U.nextNode(),a=0,o=0,l=n[0];for(;void 0!==l;){if(a===l.index){let e;2===l.type?e=new V(s,s.nextSibling,this,t):1===l.type?e=new l.ctor(s,l.name,l.strings,this,t):6===l.type&&(e=new Z(s,this,t)),this._$AV.push(e),l=n[++o]}a!==(null==l?void 0:l.index)&&(s=U.nextNode(),a++)}return U.currentNode=k,i}v(t){let e=0;for(const r of this._$AV)void 0!==r&&(void 0!==r.strings?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}},V=class t{constructor(t,e,r,n){var i;this.type=2,this._$AH=O,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=n,this._$Cp=null===(i=null==n?void 0:n.isConnected)||void 0===i||i}get _$AU(){var t,e;return null!==(e=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==e?e:this._$Cp}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===(null==t?void 0:t.nodeType)&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=L(this,t,e),A(t)?t===O||null==t||""===t?(this._$AH!==O&&this._$AR(),this._$AH=O):t!==this._$AH&&t!==F&&this._(t):void 0!==t._$litType$?this.g(t):void 0!==t.nodeType?this.$(t):(t=>E(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]))(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==O&&A(this._$AH)?this._$AA.nextSibling.data=t:this.$(k.createTextNode(t)),this._$AH=t}g(t){var e;const{values:r,_$litType$:n}=t,i="number"==typeof n?this._$AC(t):(void 0===n.el&&(n.el=I.createElement(D(n.h,n.h[0]),this.options)),n);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===i)this._$AH.v(r);else{const t=new j(i,this),e=t.u(this.options);t.v(r),this.$(e),this._$AH=t}}_$AC(t){let e=H.get(t.strings);return void 0===e&&H.set(t.strings,e=new I(t)),e}T(e){E(this._$AH)||(this._$AH=[],this._$AR());const r=this._$AH;let n,i=0;for(const s of e)i===r.length?r.push(n=new t(this.k(S()),this.k(S()),this,this.options)):n=r[i],n._$AI(s),i++;i<r.length&&(this._$AR(n&&n._$AB.nextSibling,i),r.length=i)}_$AR(t=this._$AA.nextSibling,e){var r;for(null===(r=this._$AP)||void 0===r||r.call(this,!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){var e;void 0===this._$AM&&(this._$Cp=t,null===(e=this._$AP)||void 0===e||e.call(this,t))}},B=class{constructor(t,e,r,n,i){this.type=1,this._$AH=O,this._$AN=void 0,this.element=t,this.name=e,this._$AM=n,this.options=i,r.length>2||""!==r[0]||""!==r[1]?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=O}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,r,n){const i=this.strings;let s=!1;if(void 0===i)t=L(this,t,e,0),s=!A(t)||t!==this._$AH&&t!==F,s&&(this._$AH=t);else{const n=t;let a,o;for(t=i[0],a=0;a<i.length-1;a++)o=L(this,n[r+a],e,a),o===F&&(o=this._$AH[a]),s||(s=!A(o)||o!==this._$AH[a]),o===O?t=O:t!==O&&(t+=(null!=o?o:"")+i[a+1]),this._$AH[a]=o}s&&!n&&this.j(t)}j(t){t===O?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}},K=class extends B{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===O?void 0:t}};const W=g?g.emptyScript:"";let X=class extends B{constructor(){super(...arguments),this.type=4}j(t){t&&t!==O?this.element.setAttribute(this.name,W):this.element.removeAttribute(this.name)}},Y=class extends B{constructor(t,e,r,n,i){super(t,e,r,n,i),this.type=5}_$AI(t,e=this){var r;if((t=null!==(r=L(this,t,e,0))&&void 0!==r?r:O)===F)return;const n=this._$AH,i=t===O&&n!==O||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,s=t!==O&&(n===O||i);i&&this.element.removeEventListener(this.name,this,n),s&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,r;"function"==typeof this._$AH?this._$AH.call(null!==(r=null===(e=this.options)||void 0===e?void 0:e.host)&&void 0!==r?r:this.element,t):this._$AH.handleEvent(t)}};class Z{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){L(this,t)}}const G=v.litHtmlPolyfillSupport;null==G||G(I,V),(null!==(b=v.litHtmlVersions)&&void 0!==b?b:v.litHtmlVersions=[]).push("2.8.0");
|
|
18
18
|
/**
|
|
19
19
|
* @license
|
|
20
20
|
* Copyright 2019 Google LLC
|
|
21
21
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
22
22
|
*/
|
|
23
|
-
const
|
|
23
|
+
const J=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Q=Symbol(),tt=new Map;let et=class{constructor(t,e){if(this._$cssResult$=!0,e!==Q)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t}get styleSheet(){let t=tt.get(this.cssText);return J&&void 0===t&&(tt.set(this.cssText,t=new CSSStyleSheet),t.replaceSync(this.cssText)),t}toString(){return this.cssText}};const rt=t=>new et("string"==typeof t?t:t+"",Q),nt=(t,...e)=>{const r=1===t.length?t[0]:e.reduce(((e,r,n)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+t[n+1]),t[0]);return new et(r,Q)},it=J?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const r of t.cssRules)e+=r.cssText;return rt(e)})(t):t
|
|
24
24
|
/**
|
|
25
25
|
* @license
|
|
26
26
|
* Copyright 2017 Google LLC
|
|
27
27
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
28
|
-
*/;var
|
|
28
|
+
*/;var st;const at=window.trustedTypes,ot=at?at.emptyScript:"",lt=window.reactiveElementPolyfillSupport,ct={toAttribute(t,e){switch(e){case Boolean:t=t?ot:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let r=t;switch(e){case Boolean:r=null!==t;break;case Number:r=null===t?null:Number(t);break;case Object:case Array:try{r=JSON.parse(t)}catch(t){r=null}}return r}},ht=(t,e)=>e!==t&&(e==e||t==t),ut={attribute:!0,type:String,converter:ct,reflect:!1,hasChanged:ht};let dt=class extends HTMLElement{constructor(){super(),this._$Et=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Ei=null,this.o()}static addInitializer(t){var e;null!==(e=this.l)&&void 0!==e||(this.l=[]),this.l.push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((e,r)=>{const n=this._$Eh(r,e);void 0!==n&&(this._$Eu.set(n,r),t.push(n))})),t}static createProperty(t,e=ut){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const r="symbol"==typeof t?Symbol():"__"+t,n=this.getPropertyDescriptor(t,r,e);void 0!==n&&Object.defineProperty(this.prototype,t,n)}}static getPropertyDescriptor(t,e,r){return{get(){return this[e]},set(n){const i=this[t];this[e]=n,this.requestUpdate(t,i,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||ut}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),this.elementProperties=new Map(t.elementProperties),this._$Eu=new Map,this.hasOwnProperty("properties")){const t=this.properties,e=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const r of e)this.createProperty(r,t[r])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const r=new Set(t.flat(1/0).reverse());for(const t of r)e.unshift(it(t))}else void 0!==t&&e.push(it(t));return e}static _$Eh(t,e){const r=e.attribute;return!1===r?void 0:"string"==typeof r?r:"string"==typeof t?t.toLowerCase():void 0}o(){var t;this._$Ep=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Em(),this.requestUpdate(),null===(t=this.constructor.l)||void 0===t||t.forEach((t=>t(this)))}addController(t){var e,r;(null!==(e=this._$Eg)&&void 0!==e?e:this._$Eg=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(r=t.hostConnected)||void 0===r||r.call(t))}removeController(t){var e;null===(e=this._$Eg)||void 0===e||e.splice(this._$Eg.indexOf(t)>>>0,1)}_$Em(){this.constructor.elementProperties.forEach(((t,e)=>{this.hasOwnProperty(e)&&(this._$Et.set(e,this[e]),delete this[e])}))}createRenderRoot(){var t;const e=null!==(t=this.shadowRoot)&&void 0!==t?t:this.attachShadow(this.constructor.shadowRootOptions);return((t,e)=>{J?t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):e.forEach((e=>{const r=document.createElement("style"),n=window.litNonce;void 0!==n&&r.setAttribute("nonce",n),r.textContent=e.cssText,t.appendChild(r)}))})(e,this.constructor.elementStyles),e}connectedCallback(){var t;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$Eg)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostConnected)||void 0===e?void 0:e.call(t)}))}enableUpdating(t){}disconnectedCallback(){var t;null===(t=this._$Eg)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostDisconnected)||void 0===e?void 0:e.call(t)}))}attributeChangedCallback(t,e,r){this._$AK(t,r)}_$ES(t,e,r=ut){var n,i;const s=this.constructor._$Eh(t,r);if(void 0!==s&&!0===r.reflect){const a=(null!==(i=null===(n=r.converter)||void 0===n?void 0:n.toAttribute)&&void 0!==i?i:ct.toAttribute)(e,r.type);this._$Ei=t,null==a?this.removeAttribute(s):this.setAttribute(s,a),this._$Ei=null}}_$AK(t,e){var r,n,i;const s=this.constructor,a=s._$Eu.get(t);if(void 0!==a&&this._$Ei!==a){const t=s.getPropertyOptions(a),o=t.converter,l=null!==(i=null!==(n=null===(r=o)||void 0===r?void 0:r.fromAttribute)&&void 0!==n?n:"function"==typeof o?o:null)&&void 0!==i?i:ct.fromAttribute;this._$Ei=a,this[a]=l(e,t.type),this._$Ei=null}}requestUpdate(t,e,r){let n=!0;void 0!==t&&(((r=r||this.constructor.getPropertyOptions(t)).hasChanged||ht)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),!0===r.reflect&&this._$Ei!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,r))):n=!1),!this.isUpdatePending&&n&&(this._$Ep=this._$E_())}async _$E_(){this.isUpdatePending=!0;try{await this._$Ep}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Et&&(this._$Et.forEach(((t,e)=>this[e]=t)),this._$Et=void 0);let e=!1;const r=this._$AL;try{e=this.shouldUpdate(r),e?(this.willUpdate(r),null===(t=this._$Eg)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostUpdate)||void 0===e?void 0:e.call(t)})),this.update(r)):this._$EU()}catch(t){throw e=!1,this._$EU(),t}e&&this._$AE(r)}willUpdate(t){}_$AE(t){var e;null===(e=this._$Eg)||void 0===e||e.forEach((t=>{var e;return null===(e=t.hostUpdated)||void 0===e?void 0:e.call(t)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$Ep}shouldUpdate(t){return!0}update(t){void 0!==this._$EC&&(this._$EC.forEach(((t,e)=>this._$ES(e,this[e],t))),this._$EC=void 0),this._$EU()}updated(t){}firstUpdated(t){}};
|
|
29
29
|
/**
|
|
30
30
|
* @license
|
|
31
31
|
* Copyright 2017 Google LLC
|
|
32
32
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
33
33
|
*/
|
|
34
|
-
var
|
|
34
|
+
var pt;dt.finalized=!0,dt.elementProperties=new Map,dt.elementStyles=[],dt.shadowRootOptions={mode:"open"},null==lt||lt({ReactiveElement:dt}),(null!==(st=globalThis.reactiveElementVersions)&&void 0!==st?st:globalThis.reactiveElementVersions=[]).push("1.3.1");const ft=window,mt=ft.trustedTypes,bt=mt?mt.createPolicy("lit-html",{createHTML:t=>t}):void 0,vt="$lit$",gt=`lit$${(Math.random()+"").slice(9)}$`,yt="?"+gt,wt=`<${yt}>`,xt=document,$t=()=>xt.createComment(""),_t=t=>null===t||"object"!=typeof t&&"function"!=typeof t,kt=Array.isArray,St="[ \t\n\f\r]",At=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Et=/-->/g,Mt=/>/g,Tt=RegExp(`>|${St}(?:([^\\s"'>=/]+)(${St}*=${St}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),Ct=/'/g,Nt=/"/g,Rt=/^(?:script|style|textarea|title)$/i,qt=t=>(e,...r)=>({_$litType$:t,strings:e,values:r}),Pt=qt(1),zt=qt(2),Ft=Symbol.for("lit-noChange"),Ot=Symbol.for("lit-nothing"),Ht=new WeakMap,Ut=xt.createTreeWalker(xt,129,null,!1),Dt=(t,e)=>{const r=t.length-1,n=[];let i,s=2===e?"<svg>":"",a=At;for(let e=0;e<r;e++){const r=t[e];let o,l,c=-1,h=0;for(;h<r.length&&(a.lastIndex=h,l=a.exec(r),null!==l);)h=a.lastIndex,a===At?"!--"===l[1]?a=Et:void 0!==l[1]?a=Mt:void 0!==l[2]?(Rt.test(l[2])&&(i=RegExp("</"+l[2],"g")),a=Tt):void 0!==l[3]&&(a=Tt):a===Tt?">"===l[0]?(a=null!=i?i:At,c=-1):void 0===l[1]?c=-2:(c=a.lastIndex-l[2].length,o=l[1],a=void 0===l[3]?Tt:'"'===l[3]?Nt:Ct):a===Nt||a===Ct?a=Tt:a===Et||a===Mt?a=At:(a=Tt,i=void 0);const u=a===Tt&&t[e+1].startsWith("/>")?" ":"";s+=a===At?r+wt:c>=0?(n.push(o),r.slice(0,c)+vt+r.slice(c)+gt+u):r+gt+(-2===c?(n.push(void 0),e):u)}const o=s+(t[r]||"<?>")+(2===e?"</svg>":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==bt?bt.createHTML(o):o,n]};class It{constructor({strings:t,_$litType$:e},r){let n;this.parts=[];let i=0,s=0;const a=t.length-1,o=this.parts,[l,c]=Dt(t,e);if(this.el=It.createElement(l,r),Ut.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(n=Ut.nextNode())&&o.length<a;){if(1===n.nodeType){if(n.hasAttributes()){const t=[];for(const e of n.getAttributeNames())if(e.endsWith(vt)||e.startsWith(gt)){const r=c[s++];if(t.push(e),void 0!==r){const t=n.getAttribute(r.toLowerCase()+vt).split(gt),e=/([.?@])?(.*)/.exec(r);o.push({type:1,index:i,name:e[2],strings:t,ctor:"."===e[1]?Kt:"?"===e[1]?Xt:"@"===e[1]?Yt:Bt})}else o.push({type:6,index:i})}for(const e of t)n.removeAttribute(e)}if(Rt.test(n.tagName)){const t=n.textContent.split(gt),e=t.length-1;if(e>0){n.textContent=mt?mt.emptyScript:"";for(let r=0;r<e;r++)n.append(t[r],$t()),Ut.nextNode(),o.push({type:2,index:++i});n.append(t[e],$t())}}}else if(8===n.nodeType)if(n.data===yt)o.push({type:2,index:i});else{let t=-1;for(;-1!==(t=n.data.indexOf(gt,t+1));)o.push({type:7,index:i}),t+=gt.length-1}i++}}static createElement(t,e){const r=xt.createElement("template");return r.innerHTML=t,r}}function Lt(t,e,r=t,n){var i,s,a,o;if(e===Ft)return e;let l=void 0!==n?null===(i=r._$Co)||void 0===i?void 0:i[n]:r._$Cl;const c=_t(e)?void 0:e._$litDirective$;return(null==l?void 0:l.constructor)!==c&&(null===(s=null==l?void 0:l._$AO)||void 0===s||s.call(l,!1),void 0===c?l=void 0:(l=new c(t),l._$AT(t,r,n)),void 0!==n?(null!==(a=(o=r)._$Co)&&void 0!==a?a:o._$Co=[])[n]=l:r._$Cl=l),void 0!==l&&(e=Lt(t,l._$AS(t,e.values),l,n)),e}class jt{constructor(t,e){this.u=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}v(t){var e;const{el:{content:r},parts:n}=this._$AD,i=(null!==(e=null==t?void 0:t.creationScope)&&void 0!==e?e:xt).importNode(r,!0);Ut.currentNode=i;let s=Ut.nextNode(),a=0,o=0,l=n[0];for(;void 0!==l;){if(a===l.index){let e;2===l.type?e=new Vt(s,s.nextSibling,this,t):1===l.type?e=new l.ctor(s,l.name,l.strings,this,t):6===l.type&&(e=new Zt(s,this,t)),this.u.push(e),l=n[++o]}a!==(null==l?void 0:l.index)&&(s=Ut.nextNode(),a++)}return i}p(t){let e=0;for(const r of this.u)void 0!==r&&(void 0!==r.strings?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}}class Vt{constructor(t,e,r,n){var i;this.type=2,this._$AH=Ot,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=n,this._$Cm=null===(i=null==n?void 0:n.isConnected)||void 0===i||i}get _$AU(){var t,e;return null!==(e=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==e?e:this._$Cm}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===(null==t?void 0:t.nodeType)&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=Lt(this,t,e),_t(t)?t===Ot||null==t||""===t?(this._$AH!==Ot&&this._$AR(),this._$AH=Ot):t!==this._$AH&&t!==Ft&&this.g(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>kt(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]))(t)?this.k(t):this.g(t)}S(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.S(t))}g(t){this._$AH!==Ot&&_t(this._$AH)?this._$AA.nextSibling.data=t:this.T(xt.createTextNode(t)),this._$AH=t}$(t){var e;const{values:r,_$litType$:n}=t,i="number"==typeof n?this._$AC(t):(void 0===n.el&&(n.el=It.createElement(n.h,this.options)),n);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===i)this._$AH.p(r);else{const t=new jt(i,this),e=t.v(this.options);t.p(r),this.T(e),this._$AH=t}}_$AC(t){let e=Ht.get(t.strings);return void 0===e&&Ht.set(t.strings,e=new It(t)),e}k(t){kt(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let r,n=0;for(const i of t)n===e.length?e.push(r=new Vt(this.S($t()),this.S($t()),this,this.options)):r=e[n],r._$AI(i),n++;n<e.length&&(this._$AR(r&&r._$AB.nextSibling,n),e.length=n)}_$AR(t=this._$AA.nextSibling,e){var r;for(null===(r=this._$AP)||void 0===r||r.call(this,!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){var e;void 0===this._$AM&&(this._$Cm=t,null===(e=this._$AP)||void 0===e||e.call(this,t))}}class Bt{constructor(t,e,r,n,i){this.type=1,this._$AH=Ot,this._$AN=void 0,this.element=t,this.name=e,this._$AM=n,this.options=i,r.length>2||""!==r[0]||""!==r[1]?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=Ot}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,r,n){const i=this.strings;let s=!1;if(void 0===i)t=Lt(this,t,e,0),s=!_t(t)||t!==this._$AH&&t!==Ft,s&&(this._$AH=t);else{const n=t;let a,o;for(t=i[0],a=0;a<i.length-1;a++)o=Lt(this,n[r+a],e,a),o===Ft&&(o=this._$AH[a]),s||(s=!_t(o)||o!==this._$AH[a]),o===Ot?t=Ot:t!==Ot&&(t+=(null!=o?o:"")+i[a+1]),this._$AH[a]=o}s&&!n&&this.j(t)}j(t){t===Ot?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class Kt extends Bt{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===Ot?void 0:t}}const Wt=mt?mt.emptyScript:"";class Xt extends Bt{constructor(){super(...arguments),this.type=4}j(t){t&&t!==Ot?this.element.setAttribute(this.name,Wt):this.element.removeAttribute(this.name)}}class Yt extends Bt{constructor(t,e,r,n,i){super(t,e,r,n,i),this.type=5}_$AI(t,e=this){var r;if((t=null!==(r=Lt(this,t,e,0))&&void 0!==r?r:Ot)===Ft)return;const n=this._$AH,i=t===Ot&&n!==Ot||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,s=t!==Ot&&(n===Ot||i);i&&this.element.removeEventListener(this.name,this,n),s&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,r;"function"==typeof this._$AH?this._$AH.call(null!==(r=null===(e=this.options)||void 0===e?void 0:e.host)&&void 0!==r?r:this.element,t):this._$AH.handleEvent(t)}}class Zt{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){Lt(this,t)}}const Gt=ft.litHtmlPolyfillSupport;null==Gt||Gt(It,Vt),(null!==(pt=ft.litHtmlVersions)&&void 0!==pt?pt:ft.litHtmlVersions=[]).push("2.7.0");
|
|
35
35
|
/**
|
|
36
36
|
* @license
|
|
37
37
|
* Copyright 2017 Google LLC
|
|
38
38
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
39
39
|
*/
|
|
40
|
-
var Vt,Kt;null==Bt||Bt(Pt,Ot),(null!==(ct=globalThis.litHtmlVersions)&&void 0!==ct?ct:globalThis.litHtmlVersions=[]).push("2.2.1");class Wt extends lt{constructor(){super(...arguments),this.renderOptions={host:this},this._$Dt=void 0}createRenderRoot(){var t,e;const r=super.createRenderRoot();return null!==(t=(e=this.renderOptions).renderBefore)&&void 0!==t||(e.renderBefore=r.firstChild),r}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Dt=((t,e,r)=>{var n,i;const s=null!==(n=null==r?void 0:r.renderBefore)&&void 0!==n?n:e;let a=s._$litPart$;if(void 0===a){const t=null!==(i=null==r?void 0:r.renderBefore)&&void 0!==i?i:null;s._$litPart$=a=new Ot(e.insertBefore(bt(),t),t,void 0,null!=r?r:{})}return a._$AI(t),a})(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Dt)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Dt)||void 0===t||t.setConnected(!1)}render(){return Tt}}Wt.finalized=!0,Wt._$litElement$=!0,null===(Vt=globalThis.litElementHydrateSupport)||void 0===Vt||Vt.call(globalThis,{LitElement:Wt});const Xt=globalThis.litElementPolyfillSupport;function Yt(t,e){return null==t||null==e?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function Zt(t){let e=t,r=t,n=t;function i(t,e,i=0,s=t.length){if(i<s){if(0!==r(e,e))return s;do{const r=i+s>>>1;n(t[r],e)<0?i=r+1:s=r}while(i<s)}return i}return 2!==t.length&&(e=(e,r)=>t(e)-r,r=Yt,n=(e,r)=>Yt(t(e),r)),{left:i,center:function(t,r,n=0,s=t.length){const a=i(t,r,n,s-1);return a>n&&e(t[a-1],r)>-e(t[a],r)?a-1:a},right:function(t,e,i=0,s=t.length){if(i<s){if(0!==r(e,e))return s;do{const r=i+s>>>1;n(t[r],e)<=0?i=r+1:s=r}while(i<s)}return i}}}null==Xt||Xt({LitElement:Wt}),(null!==(Kt=globalThis.litElementVersions)&&void 0!==Kt?Kt:globalThis.litElementVersions=[]).push("3.2.0");const Gt=Zt(Yt).right;Zt((function(t){return null===t?NaN:+t})).center;var Jt=Gt;function Qt(t,e){let r,n;if(void 0===e)for(const e of t)null!=e&&(void 0===r?e>=e&&(r=n=e):(r>e&&(r=e),n<e&&(n=e)));else{let i=-1;for(let s of t)null!=(s=e(s,++i,t))&&(void 0===r?s>=s&&(r=n=s):(r>s&&(r=s),n<s&&(n=s)))}return[r,n]}class te{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){const e=this._partials;let r=0;for(let n=0;n<this._n&&n<32;n++){const i=e[n],s=t+i,a=Math.abs(t)<Math.abs(i)?t-(s-i):i-(s-t);a&&(e[r++]=a),t=s}return e[r]=t,this._n=r+1,this}valueOf(){const t=this._partials;let e,r,n,i=this._n,s=0;if(i>0){for(s=t[--i];i>0&&(e=s,r=t[--i],s=e+r,n=r-(s-e),!n););i>0&&(n<0&&t[i-1]<0||n>0&&t[i-1]>0)&&(r=2*n,e=s+r,r==e-s&&(s=e))}return s}}function ee(t){return t}var re=Array.prototype.slice;function ne(t){return()=>t}var ie=Math.sqrt(50),se=Math.sqrt(10),ae=Math.sqrt(2);function oe(t,e,r){var n,i,s,a,o=-1;if(r=+r,(t=+t)===(e=+e)&&r>0)return[t];if((n=e<t)&&(i=t,t=e,e=i),0===(a=le(t,e,r))||!isFinite(a))return[];if(a>0){let r=Math.round(t/a),n=Math.round(e/a);for(r*a<t&&++r,n*a>e&&--n,s=new Array(i=n-r+1);++o<i;)s[o]=(r+o)*a}else{a=-a;let r=Math.round(t*a),n=Math.round(e*a);for(r/a<t&&++r,n/a>e&&--n,s=new Array(i=n-r+1);++o<i;)s[o]=(r+o)/a}return n&&s.reverse(),s}function le(t,e,r){var n=(e-t)/Math.max(0,r),i=Math.floor(Math.log(n)/Math.LN10),s=n/Math.pow(10,i);return i>=0?(s>=ie?10:s>=se?5:s>=ae?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(s>=ie?10:s>=se?5:s>=ae?2:1)}function ce(t){return Math.ceil(Math.log(function(t,e){let r=0;if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&++r;else{let n=-1;for(let i of t)null!=(i=e(i,++n,t))&&(i=+i)>=i&&++r}return r}(t))/Math.LN2)+1}function he(){var t=ee,e=Qt,r=ce;function n(n){Array.isArray(n)||(n=Array.from(n));var i,s,a=n.length,o=new Array(a);for(i=0;i<a;++i)o[i]=t(n[i],i,n);var l=e(o),c=l[0],h=l[1],u=r(o,c,h);if(!Array.isArray(u)){const t=h,r=+u;if(e===Qt&&([c,h]=function(t,e,r){let n;for(;;){const i=le(t,e,r);if(i===n||0===i||!isFinite(i))return[t,e];i>0?(t=Math.floor(t/i)*i,e=Math.ceil(e/i)*i):i<0&&(t=Math.ceil(t*i)/i,e=Math.floor(e*i)/i),n=i}}(c,h,r)),(u=oe(c,h,r))[u.length-1]>=h)if(t>=h&&e===Qt){const t=le(c,h,r);isFinite(t)&&(t>0?h=(Math.floor(h/t)+1)*t:t<0&&(h=(Math.ceil(h*-t)+1)/-t))}else u.pop()}for(var d=u.length;u[0]<=c;)u.shift(),--d;for(;u[d-1]>h;)u.pop(),--d;var p,f=new Array(d+1);for(i=0;i<=d;++i)(p=f[i]=[]).x0=i>0?u[i-1]:c,p.x1=i<d?u[i]:h;for(i=0;i<a;++i)null!=(s=o[i])&&c<=s&&s<=h&&f[Jt(u,s,0,d)].push(n[i]);return f}return n.value=function(e){return arguments.length?(t="function"==typeof e?e:ne(e),n):t},n.domain=function(t){return arguments.length?(e="function"==typeof t?t:ne([t[0],t[1]]),n):e},n.thresholds=function(t){return arguments.length?(r="function"==typeof t?t:Array.isArray(t)?ne(re.call(t)):ne(t),n):r},n}function ue(t,e,r){t=+t,e=+e,r=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+r;for(var n=-1,i=0|Math.max(0,Math.ceil((e-t)/r)),s=new Array(i);++n<i;)s[n]=t+n*r;return s}function de(t){return t}var pe=1e-6;function fe(t){return"translate("+t+",0)"}function me(t){return"translate(0,"+t+")"}function be(t){return e=>+t(e)}function ve(t,e){return e=Math.max(0,t.bandwidth()-2*e)/2,t.round()&&(e=Math.round(e)),r=>+t(r)+e}function ge(){return!this.__axis}function ye(t,e){var r=[],n=null,i=null,s=6,a=6,o=3,l="undefined"!=typeof window&&window.devicePixelRatio>1?0:.5,c=1===t||4===t?-1:1,h=4===t||2===t?"x":"y",u=1===t||3===t?fe:me;function d(d){var p=null==n?e.ticks?e.ticks.apply(e,r):e.domain():n,f=null==i?e.tickFormat?e.tickFormat.apply(e,r):de:i,m=Math.max(s,0)+o,b=e.range(),v=+b[0]+l,g=+b[b.length-1]+l,y=(e.bandwidth?ve:be)(e.copy(),l),w=d.selection?d.selection():d,x=w.selectAll(".domain").data([null]),$=w.selectAll(".tick").data(p,e).order(),_=$.exit(),k=$.enter().append("g").attr("class","tick"),S=$.select("line"),A=$.select("text");x=x.merge(x.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),$=$.merge(k),S=S.merge(k.append("line").attr("stroke","currentColor").attr(h+"2",c*s)),A=A.merge(k.append("text").attr("fill","currentColor").attr(h,c*m).attr("dy",1===t?"0em":3===t?"0.71em":"0.32em")),d!==w&&(x=x.transition(d),$=$.transition(d),S=S.transition(d),A=A.transition(d),_=_.transition(d).attr("opacity",pe).attr("transform",(function(t){return isFinite(t=y(t))?u(t+l):this.getAttribute("transform")})),k.attr("opacity",pe).attr("transform",(function(t){var e=this.parentNode.__axis;return u((e&&isFinite(e=e(t))?e:y(t))+l)}))),_.remove(),x.attr("d",4===t||2===t?a?"M"+c*a+","+v+"H"+l+"V"+g+"H"+c*a:"M"+l+","+v+"V"+g:a?"M"+v+","+c*a+"V"+l+"H"+g+"V"+c*a:"M"+v+","+l+"H"+g),$.attr("opacity",1).attr("transform",(function(t){return u(y(t)+l)})),S.attr(h+"2",c*s),A.attr(h,c*m).text(f),w.filter(ge).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",2===t?"start":4===t?"end":"middle"),w.each((function(){this.__axis=y}))}return d.scale=function(t){return arguments.length?(e=t,d):e},d.ticks=function(){return r=Array.from(arguments),d},d.tickArguments=function(t){return arguments.length?(r=null==t?[]:Array.from(t),d):r.slice()},d.tickValues=function(t){return arguments.length?(n=null==t?null:Array.from(t),d):n&&n.slice()},d.tickFormat=function(t){return arguments.length?(i=t,d):i},d.tickSize=function(t){return arguments.length?(s=a=+t,d):s},d.tickSizeInner=function(t){return arguments.length?(s=+t,d):s},d.tickSizeOuter=function(t){return arguments.length?(a=+t,d):a},d.tickPadding=function(t){return arguments.length?(o=+t,d):o},d.offset=function(t){return arguments.length?(l=+t,d):l},d}function we(t){return ye(3,t)}function xe(t){return ye(4,t)}var $e={value:()=>{}};function _e(){for(var t,e=0,r=arguments.length,n={};e<r;++e){if(!(t=arguments[e]+"")||t in n||/[\s.]/.test(t))throw new Error("illegal type: "+t);n[t]=[]}return new ke(n)}function ke(t){this._=t}function Se(t,e){return t.trim().split(/^|\s+/).map((function(t){var r="",n=t.indexOf(".");if(n>=0&&(r=t.slice(n+1),t=t.slice(0,n)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:r}}))}function Ae(t,e){for(var r,n=0,i=t.length;n<i;++n)if((r=t[n]).name===e)return r.value}function Ee(t,e,r){for(var n=0,i=t.length;n<i;++n)if(t[n].name===e){t[n]=$e,t=t.slice(0,n).concat(t.slice(n+1));break}return null!=r&&t.push({name:e,value:r}),t}ke.prototype=_e.prototype={constructor:ke,on:function(t,e){var r,n=this._,i=Se(t+"",n),s=-1,a=i.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++s<a;)if(r=(t=i[s]).type)n[r]=Ee(n[r],t.name,e);else if(null==e)for(r in n)n[r]=Ee(n[r],t.name,null);return this}for(;++s<a;)if((r=(t=i[s]).type)&&(r=Ae(n[r],t.name)))return r},copy:function(){var t={},e=this._;for(var r in e)t[r]=e[r].slice();return new ke(t)},call:function(t,e){if((r=arguments.length-2)>0)for(var r,n,i=new Array(r),s=0;s<r;++s)i[s]=arguments[s+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(s=0,r=(n=this._[t]).length;s<r;++s)n[s].value.apply(e,i)},apply:function(t,e,r){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var n=this._[t],i=0,s=n.length;i<s;++i)n[i].value.apply(e,r)}};var Me="http://www.w3.org/1999/xhtml",Te={svg:"http://www.w3.org/2000/svg",xhtml:Me,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ce(t){var e=t+="",r=e.indexOf(":");return r>=0&&"xmlns"!==(e=t.slice(0,r))&&(t=t.slice(r+1)),Te.hasOwnProperty(e)?{space:Te[e],local:t}:t}function Ne(t){return function(){var e=this.ownerDocument,r=this.namespaceURI;return r===Me&&e.documentElement.namespaceURI===Me?e.createElement(t):e.createElementNS(r,t)}}function Re(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function qe(t){var e=Ce(t);return(e.local?Re:Ne)(e)}function Pe(){}function ze(t){return null==t?Pe:function(){return this.querySelector(t)}}function Fe(t){return null==t?[]:Array.isArray(t)?t:Array.from(t)}function Oe(){return[]}function He(t){return null==t?Oe:function(){return this.querySelectorAll(t)}}function Ue(t){return function(){return this.matches(t)}}function De(t){return function(e){return e.matches(t)}}var Ie=Array.prototype.find;function Le(){return this.firstElementChild}var je=Array.prototype.filter;function Be(){return Array.from(this.children)}function Ve(t){return new Array(t.length)}function Ke(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function We(t){return function(){return t}}function Xe(t,e,r,n,i,s){for(var a,o=0,l=e.length,c=s.length;o<c;++o)(a=e[o])?(a.__data__=s[o],n[o]=a):r[o]=new Ke(t,s[o]);for(;o<l;++o)(a=e[o])&&(i[o]=a)}function Ye(t,e,r,n,i,s,a){var o,l,c,h=new Map,u=e.length,d=s.length,p=new Array(u);for(o=0;o<u;++o)(l=e[o])&&(p[o]=c=a.call(l,l.__data__,o,e)+"",h.has(c)?i[o]=l:h.set(c,l));for(o=0;o<d;++o)c=a.call(t,s[o],o,s)+"",(l=h.get(c))?(n[o]=l,l.__data__=s[o],h.delete(c)):r[o]=new Ke(t,s[o]);for(o=0;o<u;++o)(l=e[o])&&h.get(p[o])===l&&(i[o]=l)}function Ze(t){return t.__data__}function Ge(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function Je(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function Qe(t){return function(){this.removeAttribute(t)}}function tr(t){return function(){this.removeAttributeNS(t.space,t.local)}}function er(t,e){return function(){this.setAttribute(t,e)}}function rr(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function nr(t,e){return function(){var r=e.apply(this,arguments);null==r?this.removeAttribute(t):this.setAttribute(t,r)}}function ir(t,e){return function(){var r=e.apply(this,arguments);null==r?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,r)}}function sr(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function ar(t){return function(){this.style.removeProperty(t)}}function or(t,e,r){return function(){this.style.setProperty(t,e,r)}}function lr(t,e,r){return function(){var n=e.apply(this,arguments);null==n?this.style.removeProperty(t):this.style.setProperty(t,n,r)}}function cr(t,e){return t.style.getPropertyValue(e)||sr(t).getComputedStyle(t,null).getPropertyValue(e)}function hr(t){return function(){delete this[t]}}function ur(t,e){return function(){this[t]=e}}function dr(t,e){return function(){var r=e.apply(this,arguments);null==r?delete this[t]:this[t]=r}}function pr(t){return t.trim().split(/^|\s+/)}function fr(t){return t.classList||new mr(t)}function mr(t){this._node=t,this._names=pr(t.getAttribute("class")||"")}function br(t,e){for(var r=fr(t),n=-1,i=e.length;++n<i;)r.add(e[n])}function vr(t,e){for(var r=fr(t),n=-1,i=e.length;++n<i;)r.remove(e[n])}function gr(t){return function(){br(this,t)}}function yr(t){return function(){vr(this,t)}}function wr(t,e){return function(){(e.apply(this,arguments)?br:vr)(this,t)}}function xr(){this.textContent=""}function $r(t){return function(){this.textContent=t}}function _r(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}function kr(){this.innerHTML=""}function Sr(t){return function(){this.innerHTML=t}}function Ar(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}function Er(){this.nextSibling&&this.parentNode.appendChild(this)}function Mr(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Tr(){return null}function Cr(){var t=this.parentNode;t&&t.removeChild(this)}function Nr(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Rr(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function qr(t){return t.trim().split(/^|\s+/).map((function(t){var e="",r=t.indexOf(".");return r>=0&&(e=t.slice(r+1),t=t.slice(0,r)),{type:t,name:e}}))}function Pr(t){return function(){var e=this.__on;if(e){for(var r,n=0,i=-1,s=e.length;n<s;++n)r=e[n],t.type&&r.type!==t.type||r.name!==t.name?e[++i]=r:this.removeEventListener(r.type,r.listener,r.options);++i?e.length=i:delete this.__on}}}function zr(t,e,r){return function(){var n,i=this.__on,s=function(t){return function(e){t.call(this,e,this.__data__)}}(e);if(i)for(var a=0,o=i.length;a<o;++a)if((n=i[a]).type===t.type&&n.name===t.name)return this.removeEventListener(n.type,n.listener,n.options),this.addEventListener(n.type,n.listener=s,n.options=r),void(n.value=e);this.addEventListener(t.type,s,r),n={type:t.type,name:t.name,value:e,listener:s,options:r},i?i.push(n):this.__on=[n]}}function Fr(t,e,r){var n=sr(t),i=n.CustomEvent;"function"==typeof i?i=new i(e,r):(i=n.document.createEvent("Event"),r?(i.initEvent(e,r.bubbles,r.cancelable),i.detail=r.detail):i.initEvent(e,!1,!1)),t.dispatchEvent(i)}function Or(t,e){return function(){return Fr(this,t,e)}}function Hr(t,e){return function(){return Fr(this,t,e.apply(this,arguments))}}Ke.prototype={constructor:Ke,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)}},mr.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 Ur=[null];function Dr(t,e){this._groups=t,this._parents=e}function Ir(){return new Dr([[document.documentElement]],Ur)}function Lr(t){return"string"==typeof t?new Dr([[document.querySelector(t)]],[document.documentElement]):new Dr([[t]],Ur)}function jr(t,e){if(t=function(t){let e;for(;e=t.sourceEvent;)t=e;return t}(t),void 0===e&&(e=t.currentTarget),e){var r=e.ownerSVGElement||e;if(r.createSVGPoint){var n=r.createSVGPoint();return n.x=t.clientX,n.y=t.clientY,[(n=n.matrixTransform(e.getScreenCTM().inverse())).x,n.y]}if(e.getBoundingClientRect){var i=e.getBoundingClientRect();return[t.clientX-i.left-e.clientLeft,t.clientY-i.top-e.clientTop]}}return[t.pageX,t.pageY]}Dr.prototype=Ir.prototype={constructor:Dr,select:function(t){"function"!=typeof t&&(t=ze(t));for(var e=this._groups,r=e.length,n=new Array(r),i=0;i<r;++i)for(var s,a,o=e[i],l=o.length,c=n[i]=new Array(l),h=0;h<l;++h)(s=o[h])&&(a=t.call(s,s.__data__,h,o))&&("__data__"in s&&(a.__data__=s.__data__),c[h]=a);return new Dr(n,this._parents)},selectAll:function(t){t="function"==typeof t?function(t){return function(){return Fe(t.apply(this,arguments))}}(t):He(t);for(var e=this._groups,r=e.length,n=[],i=[],s=0;s<r;++s)for(var a,o=e[s],l=o.length,c=0;c<l;++c)(a=o[c])&&(n.push(t.call(a,a.__data__,c,o)),i.push(a));return new Dr(n,i)},selectChild:function(t){return this.select(null==t?Le:function(t){return function(){return Ie.call(this.children,t)}}("function"==typeof t?t:De(t)))},selectChildren:function(t){return this.selectAll(null==t?Be:function(t){return function(){return je.call(this.children,t)}}("function"==typeof t?t:De(t)))},filter:function(t){"function"!=typeof t&&(t=Ue(t));for(var e=this._groups,r=e.length,n=new Array(r),i=0;i<r;++i)for(var s,a=e[i],o=a.length,l=n[i]=[],c=0;c<o;++c)(s=a[c])&&t.call(s,s.__data__,c,a)&&l.push(s);return new Dr(n,this._parents)},data:function(t,e){if(!arguments.length)return Array.from(this,Ze);var r=e?Ye:Xe,n=this._parents,i=this._groups;"function"!=typeof t&&(t=We(t));for(var s=i.length,a=new Array(s),o=new Array(s),l=new Array(s),c=0;c<s;++c){var h=n[c],u=i[c],d=u.length,p=Ge(t.call(h,h&&h.__data__,c,n)),f=p.length,m=o[c]=new Array(f),b=a[c]=new Array(f),v=l[c]=new Array(d);r(h,u,m,b,v,p,e);for(var g,y,w=0,x=0;w<f;++w)if(g=m[w]){for(w>=x&&(x=w+1);!(y=b[x])&&++x<f;);g._next=y||null}}return(a=new Dr(a,n))._enter=o,a._exit=l,a},enter:function(){return new Dr(this._enter||this._groups.map(Ve),this._parents)},exit:function(){return new Dr(this._exit||this._groups.map(Ve),this._parents)},join:function(t,e,r){var n=this.enter(),i=this,s=this.exit();return"function"==typeof t?(n=t(n))&&(n=n.selection()):n=n.append(t+""),null!=e&&(i=e(i))&&(i=i.selection()),null==r?s.remove():r(s),n&&i?n.merge(i).order():i},merge:function(t){for(var e=t.selection?t.selection():t,r=this._groups,n=e._groups,i=r.length,s=n.length,a=Math.min(i,s),o=new Array(i),l=0;l<a;++l)for(var c,h=r[l],u=n[l],d=h.length,p=o[l]=new Array(d),f=0;f<d;++f)(c=h[f]||u[f])&&(p[f]=c);for(;l<i;++l)o[l]=r[l];return new Dr(o,this._parents)},selection:function(){return this},order:function(){for(var t=this._groups,e=-1,r=t.length;++e<r;)for(var n,i=t[e],s=i.length-1,a=i[s];--s>=0;)(n=i[s])&&(a&&4^n.compareDocumentPosition(a)&&a.parentNode.insertBefore(n,a),a=n);return this},sort:function(t){function e(e,r){return e&&r?t(e.__data__,r.__data__):!e-!r}t||(t=Je);for(var r=this._groups,n=r.length,i=new Array(n),s=0;s<n;++s){for(var a,o=r[s],l=o.length,c=i[s]=new Array(l),h=0;h<l;++h)(a=o[h])&&(c[h]=a);c.sort(e)}return new Dr(i,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var t=this._groups,e=0,r=t.length;e<r;++e)for(var n=t[e],i=0,s=n.length;i<s;++i){var a=n[i];if(a)return a}return null},size:function(){let t=0;for(const e of this)++t;return t},empty:function(){return!this.node()},each:function(t){for(var e=this._groups,r=0,n=e.length;r<n;++r)for(var i,s=e[r],a=0,o=s.length;a<o;++a)(i=s[a])&&t.call(i,i.__data__,a,s);return this},attr:function(t,e){var r=Ce(t);if(arguments.length<2){var n=this.node();return r.local?n.getAttributeNS(r.space,r.local):n.getAttribute(r)}return this.each((null==e?r.local?tr:Qe:"function"==typeof e?r.local?ir:nr:r.local?rr:er)(r,e))},style:function(t,e,r){return arguments.length>1?this.each((null==e?ar:"function"==typeof e?lr:or)(t,e,null==r?"":r)):cr(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?hr:"function"==typeof e?dr:ur)(t,e)):this.node()[t]},classed:function(t,e){var r=pr(t+"");if(arguments.length<2){for(var n=fr(this.node()),i=-1,s=r.length;++i<s;)if(!n.contains(r[i]))return!1;return!0}return this.each(("function"==typeof e?wr:e?gr:yr)(r,e))},text:function(t){return arguments.length?this.each(null==t?xr:("function"==typeof t?_r:$r)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?kr:("function"==typeof t?Ar:Sr)(t)):this.node().innerHTML},raise:function(){return this.each(Er)},lower:function(){return this.each(Mr)},append:function(t){var e="function"==typeof t?t:qe(t);return this.select((function(){return this.appendChild(e.apply(this,arguments))}))},insert:function(t,e){var r="function"==typeof t?t:qe(t),n=null==e?Tr:"function"==typeof e?e:ze(e);return this.select((function(){return this.insertBefore(r.apply(this,arguments),n.apply(this,arguments)||null)}))},remove:function(){return this.each(Cr)},clone:function(t){return this.select(t?Rr:Nr)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,e,r){var n,i,s=qr(t+""),a=s.length;if(!(arguments.length<2)){for(o=e?zr:Pr,n=0;n<a;++n)this.each(o(s[n],e,r));return this}var o=this.node().__on;if(o)for(var l,c=0,h=o.length;c<h;++c)for(n=0,l=o[c];n<a;++n)if((i=s[n]).type===l.type&&i.name===l.name)return l.value},dispatch:function(t,e){return this.each(("function"==typeof e?Hr:Or)(t,e))},[Symbol.iterator]:function*(){for(var t=this._groups,e=0,r=t.length;e<r;++e)for(var n,i=t[e],s=0,a=i.length;s<a;++s)(n=i[s])&&(yield n)}};const Br={passive:!1},Vr={capture:!0,passive:!1};function Kr(t){t.stopImmediatePropagation()}function Wr(t){t.preventDefault(),t.stopImmediatePropagation()}var Xr=t=>()=>t;function Yr(t,{sourceEvent:e,subject:r,target:n,identifier:i,active:s,x:a,y:o,dx:l,dy:c,dispatch:h}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:r,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:o,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:h}})}function Zr(t){return!t.ctrlKey&&!t.button}function Gr(){return this.parentNode}function Jr(t,e){return null==e?{x:t.x,y:t.y}:e}function Qr(){return navigator.maxTouchPoints||"ontouchstart"in this}function tn(){var t,e,r,n,i=Zr,s=Gr,a=Jr,o=Qr,l={},c=_e("start","drag","end"),h=0,u=0;function d(t){t.on("mousedown.drag",p).filter(o).on("touchstart.drag",b).on("touchmove.drag",v,Br).on("touchend.drag touchcancel.drag",g).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(a,o){if(!n&&i.call(this,a,o)){var l=y(this,s.call(this,a,o),a,o,"mouse");l&&(Lr(a.view).on("mousemove.drag",f,Vr).on("mouseup.drag",m,Vr),function(t){var e=t.document.documentElement,r=Lr(t).on("dragstart.drag",Wr,Vr);"onselectstart"in e?r.on("selectstart.drag",Wr,Vr):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}(a.view),Kr(a),r=!1,t=a.clientX,e=a.clientY,l("start",a))}}function f(n){if(Wr(n),!r){var i=n.clientX-t,s=n.clientY-e;r=i*i+s*s>u}l.mouse("drag",n)}function m(t){Lr(t.view).on("mousemove.drag mouseup.drag",null),function(t,e){var r=t.document.documentElement,n=Lr(t).on("dragstart.drag",null);e&&(n.on("click.drag",Wr,Vr),setTimeout((function(){n.on("click.drag",null)}),0)),"onselectstart"in r?n.on("selectstart.drag",null):(r.style.MozUserSelect=r.__noselect,delete r.__noselect)}(t.view,r),Wr(t),l.mouse("end",t)}function b(t,e){if(i.call(this,t,e)){var r,n,a=t.changedTouches,o=s.call(this,t,e),l=a.length;for(r=0;r<l;++r)(n=y(this,o,t,e,a[r].identifier,a[r]))&&(Kr(t),n("start",t,a[r]))}}function v(t){var e,r,n=t.changedTouches,i=n.length;for(e=0;e<i;++e)(r=l[n[e].identifier])&&(Wr(t),r("drag",t,n[e]))}function g(t){var e,r,i=t.changedTouches,s=i.length;for(n&&clearTimeout(n),n=setTimeout((function(){n=null}),500),e=0;e<s;++e)(r=l[i[e].identifier])&&(Kr(t),r("end",t,i[e]))}function y(t,e,r,n,i,s){var o,u,p,f=c.copy(),m=jr(s||r,e);if(null!=(p=a.call(t,new Yr("beforestart",{sourceEvent:r,target:d,identifier:i,active:h,x:m[0],y:m[1],dx:0,dy:0,dispatch:f}),n)))return o=p.x-m[0]||0,u=p.y-m[1]||0,function r(s,a,c){var b,v=m;switch(s){case"start":l[i]=r,b=h++;break;case"end":delete l[i],--h;case"drag":m=jr(c||a,e),b=h}f.call(s,t,new Yr(s,{sourceEvent:a,subject:p,target:d,identifier:i,active:b,x:m[0]+o,y:m[1]+u,dx:m[0]-v[0],dy:m[1]-v[1],dispatch:f}),n)}}return d.filter=function(t){return arguments.length?(i="function"==typeof t?t:Xr(!!t),d):i},d.container=function(t){return arguments.length?(s="function"==typeof t?t:Xr(t),d):s},d.subject=function(t){return arguments.length?(a="function"==typeof t?t:Xr(t),d):a},d.touchable=function(t){return arguments.length?(o="function"==typeof t?t:Xr(!!t),d):o},d.on=function(){var t=c.on.apply(c,arguments);return t===c?d:t},d.clickDistance=function(t){return arguments.length?(u=(t=+t)*t,d):Math.sqrt(u)},d}function en(t,e,r){t.prototype=e.prototype=r,r.constructor=t}function rn(t,e){var r=Object.create(t.prototype);for(var n in e)r[n]=e[n];return r}function nn(){}Yr.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};var sn=.7,an=1/sn,on="\\s*([+-]?\\d+)\\s*",ln="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",cn="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",hn=/^#([0-9a-f]{3,8})$/,un=new RegExp("^rgb\\("+[on,on,on]+"\\)$"),dn=new RegExp("^rgb\\("+[cn,cn,cn]+"\\)$"),pn=new RegExp("^rgba\\("+[on,on,on,ln]+"\\)$"),fn=new RegExp("^rgba\\("+[cn,cn,cn,ln]+"\\)$"),mn=new RegExp("^hsl\\("+[ln,cn,cn]+"\\)$"),bn=new RegExp("^hsla\\("+[ln,cn,cn,ln]+"\\)$"),vn={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 gn(){return this.rgb().formatHex()}function yn(){return this.rgb().formatRgb()}function wn(t){var e,r;return t=(t+"").trim().toLowerCase(),(e=hn.exec(t))?(r=e[1].length,e=parseInt(e[1],16),6===r?xn(e):3===r?new Sn(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===r?$n(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===r?$n(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=un.exec(t))?new Sn(e[1],e[2],e[3],1):(e=dn.exec(t))?new Sn(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=pn.exec(t))?$n(e[1],e[2],e[3],e[4]):(e=fn.exec(t))?$n(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=mn.exec(t))?Tn(e[1],e[2]/100,e[3]/100,1):(e=bn.exec(t))?Tn(e[1],e[2]/100,e[3]/100,e[4]):vn.hasOwnProperty(t)?xn(vn[t]):"transparent"===t?new Sn(NaN,NaN,NaN,0):null}function xn(t){return new Sn(t>>16&255,t>>8&255,255&t,1)}function $n(t,e,r,n){return n<=0&&(t=e=r=NaN),new Sn(t,e,r,n)}function _n(t){return t instanceof nn||(t=wn(t)),t?new Sn((t=t.rgb()).r,t.g,t.b,t.opacity):new Sn}function kn(t,e,r,n){return 1===arguments.length?_n(t):new Sn(t,e,r,null==n?1:n)}function Sn(t,e,r,n){this.r=+t,this.g=+e,this.b=+r,this.opacity=+n}function An(){return"#"+Mn(this.r)+Mn(this.g)+Mn(this.b)}function En(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}function Mn(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Tn(t,e,r,n){return n<=0?t=e=r=NaN:r<=0||r>=1?t=e=NaN:e<=0&&(t=NaN),new Nn(t,e,r,n)}function Cn(t){if(t instanceof Nn)return new Nn(t.h,t.s,t.l,t.opacity);if(t instanceof nn||(t=wn(t)),!t)return new Nn;if(t instanceof Nn)return t;var e=(t=t.rgb()).r/255,r=t.g/255,n=t.b/255,i=Math.min(e,r,n),s=Math.max(e,r,n),a=NaN,o=s-i,l=(s+i)/2;return o?(a=e===s?(r-n)/o+6*(r<n):r===s?(n-e)/o+2:(e-r)/o+4,o/=l<.5?s+i:2-s-i,a*=60):o=l>0&&l<1?0:a,new Nn(a,o,l,t.opacity)}function Nn(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}function Rn(t,e,r){return 255*(t<60?e+(r-e)*t/60:t<180?r:t<240?e+(r-e)*(240-t)/60:e)}en(nn,wn,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:gn,formatHex:gn,formatHsl:function(){return Cn(this).formatHsl()},formatRgb:yn,toString:yn}),en(Sn,kn,rn(nn,{brighter:function(t){return t=null==t?an:Math.pow(an,t),new Sn(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?sn:Math.pow(sn,t),new Sn(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){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:An,formatHex:An,formatRgb:En,toString:En})),en(Nn,(function(t,e,r,n){return 1===arguments.length?Cn(t):new Nn(t,e,r,null==n?1:n)}),rn(nn,{brighter:function(t){return t=null==t?an:Math.pow(an,t),new Nn(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?sn:Math.pow(sn,t),new Nn(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*e,i=2*r-n;return new Sn(Rn(t>=240?t-240:t+120,i,n),Rn(t,i,n),Rn(t<120?t+240:t-120,i,n),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===t?")":", "+t+")")}}));var qn=t=>()=>t;function Pn(t){return 1==(t=+t)?zn:function(e,r){return r-e?function(t,e,r){return t=Math.pow(t,r),e=Math.pow(e,r)-t,r=1/r,function(n){return Math.pow(t+n*e,r)}}(e,r,t):qn(isNaN(e)?r:e)}}function zn(t,e){var r=e-t;return r?function(t,e){return function(r){return t+r*e}}(t,r):qn(isNaN(t)?e:t)}var Fn=function t(e){var r=Pn(e);function n(t,e){var n=r((t=kn(t)).r,(e=kn(e)).r),i=r(t.g,e.g),s=r(t.b,e.b),a=zn(t.opacity,e.opacity);return function(e){return t.r=n(e),t.g=i(e),t.b=s(e),t.opacity=a(e),t+""}}return n.gamma=t,n}(1);function On(t,e){e||(e=[]);var r,n=t?Math.min(e.length,t.length):0,i=e.slice();return function(s){for(r=0;r<n;++r)i[r]=t[r]*(1-s)+e[r]*s;return i}}function Hn(t,e){var r,n=e?e.length:0,i=t?Math.min(n,t.length):0,s=new Array(i),a=new Array(n);for(r=0;r<i;++r)s[r]=Vn(t[r],e[r]);for(;r<n;++r)a[r]=e[r];return function(t){for(r=0;r<i;++r)a[r]=s[r](t);return a}}function Un(t,e){var r=new Date;return t=+t,e=+e,function(n){return r.setTime(t*(1-n)+e*n),r}}function Dn(t,e){return t=+t,e=+e,function(r){return t*(1-r)+e*r}}function In(t,e){var r,n={},i={};for(r in null!==t&&"object"==typeof t||(t={}),null!==e&&"object"==typeof e||(e={}),e)r in t?n[r]=Vn(t[r],e[r]):i[r]=e[r];return function(t){for(r in n)i[r]=n[r](t);return i}}var Ln=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,jn=new RegExp(Ln.source,"g");function Bn(t,e){var r,n,i,s=Ln.lastIndex=jn.lastIndex=0,a=-1,o=[],l=[];for(t+="",e+="";(r=Ln.exec(t))&&(n=jn.exec(e));)(i=n.index)>s&&(i=e.slice(s,i),o[a]?o[a]+=i:o[++a]=i),(r=r[0])===(n=n[0])?o[a]?o[a]+=n:o[++a]=n:(o[++a]=null,l.push({i:a,x:Dn(r,n)})),s=jn.lastIndex;return s<e.length&&(i=e.slice(s),o[a]?o[a]+=i:o[++a]=i),o.length<2?l[0]?function(t){return function(e){return t(e)+""}}(l[0].x):function(t){return function(){return t}}(e):(e=l.length,function(t){for(var r,n=0;n<e;++n)o[(r=l[n]).i]=r.x(t);return o.join("")})}function Vn(t,e){var r,n=typeof e;return null==e||"boolean"===n?qn(e):("number"===n?Dn:"string"===n?(r=wn(e))?(e=r,Fn):Bn:e instanceof wn?Fn:e instanceof Date?Un:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}(e)?On:Array.isArray(e)?Hn:"function"!=typeof e.valueOf&&"function"!=typeof e.toString||isNaN(e)?In:Dn)(t,e)}function Kn(t,e){return t=+t,e=+e,function(r){return Math.round(t*(1-r)+e*r)}}var Wn,Xn=180/Math.PI,Yn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Zn(t,e,r,n,i,s){var a,o,l;return(a=Math.sqrt(t*t+e*e))&&(t/=a,e/=a),(l=t*r+e*n)&&(r-=t*l,n-=e*l),(o=Math.sqrt(r*r+n*n))&&(r/=o,n/=o,l/=o),t*n<e*r&&(t=-t,e=-e,l=-l,a=-a),{translateX:i,translateY:s,rotate:Math.atan2(e,t)*Xn,skewX:Math.atan(l)*Xn,scaleX:a,scaleY:o}}function Gn(t,e,r,n){function i(t){return t.length?t.pop()+" ":""}return function(s,a){var o=[],l=[];return s=t(s),a=t(a),function(t,n,i,s,a,o){if(t!==i||n!==s){var l=a.push("translate(",null,e,null,r);o.push({i:l-4,x:Dn(t,i)},{i:l-2,x:Dn(n,s)})}else(i||s)&&a.push("translate("+i+e+s+r)}(s.translateX,s.translateY,a.translateX,a.translateY,o,l),function(t,e,r,s){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),s.push({i:r.push(i(r)+"rotate(",null,n)-2,x:Dn(t,e)})):e&&r.push(i(r)+"rotate("+e+n)}(s.rotate,a.rotate,o,l),function(t,e,r,s){t!==e?s.push({i:r.push(i(r)+"skewX(",null,n)-2,x:Dn(t,e)}):e&&r.push(i(r)+"skewX("+e+n)}(s.skewX,a.skewX,o,l),function(t,e,r,n,s,a){if(t!==r||e!==n){var o=s.push(i(s)+"scale(",null,",",null,")");a.push({i:o-4,x:Dn(t,r)},{i:o-2,x:Dn(e,n)})}else 1===r&&1===n||s.push(i(s)+"scale("+r+","+n+")")}(s.scaleX,s.scaleY,a.scaleX,a.scaleY,o,l),s=a=null,function(t){for(var e,r=-1,n=l.length;++r<n;)o[(e=l[r]).i]=e.x(t);return o.join("")}}}var Jn,Qn,ti=Gn((function(t){const e=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?Yn:Zn(e.a,e.b,e.c,e.d,e.e,e.f)}),"px, ","px)","deg)"),ei=Gn((function(t){return null==t?Yn:(Wn||(Wn=document.createElementNS("http://www.w3.org/2000/svg","g")),Wn.setAttribute("transform",t),(t=Wn.transform.baseVal.consolidate())?Zn((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):Yn)}),", ",")",")"),ri=0,ni=0,ii=0,si=0,ai=0,oi=0,li="object"==typeof performance&&performance.now?performance:Date,ci="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function hi(){return ai||(ci(ui),ai=li.now()+oi)}function ui(){ai=0}function di(){this._call=this._time=this._next=null}function pi(t,e,r){var n=new di;return n.restart(t,e,r),n}function fi(){ai=(si=li.now())+oi,ri=ni=0;try{!function(){hi(),++ri;for(var t,e=Jn;e;)(t=ai-e._time)>=0&&e._call.call(void 0,t),e=e._next;--ri}()}finally{ri=0,function(){var t,e,r=Jn,n=1/0;for(;r;)r._call?(n>r._time&&(n=r._time),t=r,r=r._next):(e=r._next,r._next=null,r=t?t._next=e:Jn=e);Qn=t,bi(n)}(),ai=0}}function mi(){var t=li.now(),e=t-si;e>1e3&&(oi-=e,si=t)}function bi(t){ri||(ni&&(ni=clearTimeout(ni)),t-ai>24?(t<1/0&&(ni=setTimeout(fi,t-li.now()-oi)),ii&&(ii=clearInterval(ii))):(ii||(si=li.now(),ii=setInterval(mi,1e3)),ri=1,ci(fi)))}function vi(t,e,r){var n=new di;return e=null==e?0:+e,n.restart((r=>{n.stop(),t(r+e)}),e,r),n}di.prototype=pi.prototype={constructor:di,restart:function(t,e,r){if("function"!=typeof t)throw new TypeError("callback is not a function");r=(null==r?hi():+r)+(null==e?0:+e),this._next||Qn===this||(Qn?Qn._next=this:Jn=this,Qn=this),this._call=t,this._time=r,bi()},stop:function(){this._call&&(this._call=null,this._time=1/0,bi())}};var gi=_e("start","end","cancel","interrupt"),yi=[];function wi(t,e,r,n,i,s){var a=t.__transition;if(a){if(r in a)return}else t.__transition={};!function(t,e,r){var n,i=t.__transition;function s(t){r.state=1,r.timer.restart(a,r.delay,r.time),r.delay<=t&&a(t-r.delay)}function a(s){var c,h,u,d;if(1!==r.state)return l();for(c in i)if((d=i[c]).name===r.name){if(3===d.state)return vi(a);4===d.state?(d.state=6,d.timer.stop(),d.on.call("interrupt",t,t.__data__,d.index,d.group),delete i[c]):+c<e&&(d.state=6,d.timer.stop(),d.on.call("cancel",t,t.__data__,d.index,d.group),delete i[c])}if(vi((function(){3===r.state&&(r.state=4,r.timer.restart(o,r.delay,r.time),o(s))})),r.state=2,r.on.call("start",t,t.__data__,r.index,r.group),2===r.state){for(r.state=3,n=new Array(u=r.tween.length),c=0,h=-1;c<u;++c)(d=r.tween[c].value.call(t,t.__data__,r.index,r.group))&&(n[++h]=d);n.length=h+1}}function o(e){for(var i=e<r.duration?r.ease.call(null,e/r.duration):(r.timer.restart(l),r.state=5,1),s=-1,a=n.length;++s<a;)n[s].call(t,i);5===r.state&&(r.on.call("end",t,t.__data__,r.index,r.group),l())}function l(){for(var n in r.state=6,r.timer.stop(),delete i[e],i)return;delete t.__transition}i[e]=r,r.timer=pi(s,0,r.time)}(t,r,{name:e,index:n,group:i,on:gi,tween:yi,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:0})}function xi(t,e){var r=_i(t,e);if(r.state>0)throw new Error("too late; already scheduled");return r}function $i(t,e){var r=_i(t,e);if(r.state>3)throw new Error("too late; already running");return r}function _i(t,e){var r=t.__transition;if(!r||!(r=r[e]))throw new Error("transition not found");return r}function ki(t,e){var r,n;return function(){var i=$i(this,t),s=i.tween;if(s!==r)for(var a=0,o=(n=r=s).length;a<o;++a)if(n[a].name===e){(n=n.slice()).splice(a,1);break}i.tween=n}}function Si(t,e,r){var n,i;if("function"!=typeof r)throw new Error;return function(){var s=$i(this,t),a=s.tween;if(a!==n){i=(n=a).slice();for(var o={name:e,value:r},l=0,c=i.length;l<c;++l)if(i[l].name===e){i[l]=o;break}l===c&&i.push(o)}s.tween=i}}function Ai(t,e,r){var n=t._id;return t.each((function(){var t=$i(this,n);(t.value||(t.value={}))[e]=r.apply(this,arguments)})),function(t){return _i(t,n).value[e]}}function Ei(t,e){var r;return("number"==typeof e?Dn:e instanceof wn?Fn:(r=wn(e))?(e=r,Fn):Bn)(t,e)}function Mi(t){return function(){this.removeAttribute(t)}}function Ti(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Ci(t,e,r){var n,i,s=r+"";return function(){var a=this.getAttribute(t);return a===s?null:a===n?i:i=e(n=a,r)}}function Ni(t,e,r){var n,i,s=r+"";return function(){var a=this.getAttributeNS(t.space,t.local);return a===s?null:a===n?i:i=e(n=a,r)}}function Ri(t,e,r){var n,i,s;return function(){var a,o,l=r(this);if(null!=l)return(a=this.getAttribute(t))===(o=l+"")?null:a===n&&o===i?s:(i=o,s=e(n=a,l));this.removeAttribute(t)}}function qi(t,e,r){var n,i,s;return function(){var a,o,l=r(this);if(null!=l)return(a=this.getAttributeNS(t.space,t.local))===(o=l+"")?null:a===n&&o===i?s:(i=o,s=e(n=a,l));this.removeAttributeNS(t.space,t.local)}}function Pi(t,e){return function(r){this.setAttribute(t,e.call(this,r))}}function zi(t,e){return function(r){this.setAttributeNS(t.space,t.local,e.call(this,r))}}function Fi(t,e){var r,n;function i(){var i=e.apply(this,arguments);return i!==n&&(r=(n=i)&&zi(t,i)),r}return i._value=e,i}function Oi(t,e){var r,n;function i(){var i=e.apply(this,arguments);return i!==n&&(r=(n=i)&&Pi(t,i)),r}return i._value=e,i}function Hi(t,e){return function(){xi(this,t).delay=+e.apply(this,arguments)}}function Ui(t,e){return e=+e,function(){xi(this,t).delay=e}}function Di(t,e){return function(){$i(this,t).duration=+e.apply(this,arguments)}}function Ii(t,e){return e=+e,function(){$i(this,t).duration=e}}function Li(t,e){if("function"!=typeof e)throw new Error;return function(){$i(this,t).ease=e}}function ji(t,e,r){var n,i,s=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)?xi:$i;return function(){var a=s(this,t),o=a.on;o!==n&&(i=(n=o).copy()).on(e,r),a.on=i}}var Bi=Ir.prototype.constructor;function Vi(t){return function(){this.style.removeProperty(t)}}function Ki(t,e,r){return function(n){this.style.setProperty(t,e.call(this,n),r)}}function Wi(t,e,r){var n,i;function s(){var s=e.apply(this,arguments);return s!==i&&(n=(i=s)&&Ki(t,s,r)),n}return s._value=e,s}function Xi(t){return function(e){this.textContent=t.call(this,e)}}function Yi(t){var e,r;function n(){var n=t.apply(this,arguments);return n!==r&&(e=(r=n)&&Xi(n)),e}return n._value=t,n}var Zi=0;function Gi(t,e,r,n){this._groups=t,this._parents=e,this._name=r,this._id=n}function Ji(){return++Zi}var Qi=Ir.prototype;Gi.prototype={constructor:Gi,select:function(t){var e=this._name,r=this._id;"function"!=typeof t&&(t=ze(t));for(var n=this._groups,i=n.length,s=new Array(i),a=0;a<i;++a)for(var o,l,c=n[a],h=c.length,u=s[a]=new Array(h),d=0;d<h;++d)(o=c[d])&&(l=t.call(o,o.__data__,d,c))&&("__data__"in o&&(l.__data__=o.__data__),u[d]=l,wi(u[d],e,r,d,u,_i(o,r)));return new Gi(s,this._parents,e,r)},selectAll:function(t){var e=this._name,r=this._id;"function"!=typeof t&&(t=He(t));for(var n=this._groups,i=n.length,s=[],a=[],o=0;o<i;++o)for(var l,c=n[o],h=c.length,u=0;u<h;++u)if(l=c[u]){for(var d,p=t.call(l,l.__data__,u,c),f=_i(l,r),m=0,b=p.length;m<b;++m)(d=p[m])&&wi(d,e,r,m,p,f);s.push(p),a.push(l)}return new Gi(s,a,e,r)},selectChild:Qi.selectChild,selectChildren:Qi.selectChildren,filter:function(t){"function"!=typeof t&&(t=Ue(t));for(var e=this._groups,r=e.length,n=new Array(r),i=0;i<r;++i)for(var s,a=e[i],o=a.length,l=n[i]=[],c=0;c<o;++c)(s=a[c])&&t.call(s,s.__data__,c,a)&&l.push(s);return new Gi(n,this._parents,this._name,this._id)},merge:function(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,r=t._groups,n=e.length,i=r.length,s=Math.min(n,i),a=new Array(n),o=0;o<s;++o)for(var l,c=e[o],h=r[o],u=c.length,d=a[o]=new Array(u),p=0;p<u;++p)(l=c[p]||h[p])&&(d[p]=l);for(;o<n;++o)a[o]=e[o];return new Gi(a,this._parents,this._name,this._id)},selection:function(){return new Bi(this._groups,this._parents)},transition:function(){for(var t=this._name,e=this._id,r=Ji(),n=this._groups,i=n.length,s=0;s<i;++s)for(var a,o=n[s],l=o.length,c=0;c<l;++c)if(a=o[c]){var h=_i(a,e);wi(a,t,r,c,o,{time:h.time+h.delay+h.duration,delay:0,duration:h.duration,ease:h.ease})}return new Gi(n,this._parents,t,r)},call:Qi.call,nodes:Qi.nodes,node:Qi.node,size:Qi.size,empty:Qi.empty,each:Qi.each,on:function(t,e){var r=this._id;return arguments.length<2?_i(this.node(),r).on.on(t):this.each(ji(r,t,e))},attr:function(t,e){var r=Ce(t),n="transform"===r?ei:Ei;return this.attrTween(t,"function"==typeof e?(r.local?qi:Ri)(r,n,Ai(this,"attr."+t,e)):null==e?(r.local?Ti:Mi)(r):(r.local?Ni:Ci)(r,n,e))},attrTween:function(t,e){var r="attr."+t;if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==e)return this.tween(r,null);if("function"!=typeof e)throw new Error;var n=Ce(t);return this.tween(r,(n.local?Fi:Oi)(n,e))},style:function(t,e,r){var n="transform"==(t+="")?ti:Ei;return null==e?this.styleTween(t,function(t,e){var r,n,i;return function(){var s=cr(this,t),a=(this.style.removeProperty(t),cr(this,t));return s===a?null:s===r&&a===n?i:i=e(r=s,n=a)}}(t,n)).on("end.style."+t,Vi(t)):"function"==typeof e?this.styleTween(t,function(t,e,r){var n,i,s;return function(){var a=cr(this,t),o=r(this),l=o+"";return null==o&&(this.style.removeProperty(t),l=o=cr(this,t)),a===l?null:a===n&&l===i?s:(i=l,s=e(n=a,o))}}(t,n,Ai(this,"style."+t,e))).each(function(t,e){var r,n,i,s,a="style."+e,o="end."+a;return function(){var l=$i(this,t),c=l.on,h=null==l.value[a]?s||(s=Vi(e)):void 0;c===r&&i===h||(n=(r=c).copy()).on(o,i=h),l.on=n}}(this._id,t)):this.styleTween(t,function(t,e,r){var n,i,s=r+"";return function(){var a=cr(this,t);return a===s?null:a===n?i:i=e(n=a,r)}}(t,n,e),r).on("end.style."+t,null)},styleTween:function(t,e,r){var n="style."+(t+="");if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==e)return this.tween(n,null);if("function"!=typeof e)throw new Error;return this.tween(n,Wi(t,e,null==r?"":r))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var e=t(this);this.textContent=null==e?"":e}}(Ai(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,Yi(t))},remove:function(){return this.on("end.remove",function(t){return function(){var e=this.parentNode;for(var r in this.__transition)if(+r!==t)return;e&&e.removeChild(this)}}(this._id))},tween:function(t,e){var r=this._id;if(t+="",arguments.length<2){for(var n,i=_i(this.node(),r).tween,s=0,a=i.length;s<a;++s)if((n=i[s]).name===t)return n.value;return null}return this.each((null==e?ki:Si)(r,t,e))},delay:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?Hi:Ui)(e,t)):_i(this.node(),e).delay},duration:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?Di:Ii)(e,t)):_i(this.node(),e).duration},ease:function(t){var e=this._id;return arguments.length?this.each(Li(e,t)):_i(this.node(),e).ease},easeVarying:function(t){if("function"!=typeof t)throw new Error;return this.each(function(t,e){return function(){var r=e.apply(this,arguments);if("function"!=typeof r)throw new Error;$i(this,t).ease=r}}(this._id,t))},end:function(){var t,e,r=this,n=r._id,i=r.size();return new Promise((function(s,a){var o={value:a},l={value:function(){0==--i&&s()}};r.each((function(){var r=$i(this,n),i=r.on;i!==t&&((e=(t=i).copy())._.cancel.push(o),e._.interrupt.push(o),e._.end.push(l)),r.on=e})),0===i&&s()}))},[Symbol.iterator]:Qi[Symbol.iterator]};const ts=t=>+t;function es(t){return t*t*t}function rs(t){return--t*t*t+1}var ns={time:null,delay:0,duration:250,ease:function(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}};function is(t,e){for(var r;!(r=t.__transition)||!(r=r[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return r}Ir.prototype.interrupt=function(t){return this.each((function(){!function(t,e){var r,n,i,s=t.__transition,a=!0;if(s){for(i in e=null==e?null:e+"",s)(r=s[i]).name===e?(n=r.state>2&&r.state<5,r.state=6,r.timer.stop(),r.on.call(n?"interrupt":"cancel",t,t.__data__,r.index,r.group),delete s[i]):a=!1;a&&delete t.__transition}}(this,t)}))},Ir.prototype.transition=function(t){var e,r;t instanceof Gi?(e=t._id,t=t._name):(e=Ji(),(r=ns).time=hi(),t=null==t?null:t+"");for(var n=this._groups,i=n.length,s=0;s<i;++s)for(var a,o=n[s],l=o.length,c=0;c<l;++c)(a=o[c])&&wi(a,t,e,c,o,r||is(a,e));return new Gi(n,this._parents,t,e)};const ss=Math.PI,as=2*ss,os=1e-6,ls=as-os;function cs(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function hs(){return new cs}cs.prototype=hs.prototype={constructor:cs,moveTo:function(t,e){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,e){this._+="L"+(this._x1=+t)+","+(this._y1=+e)},quadraticCurveTo:function(t,e,r,n){this._+="Q"+ +t+","+ +e+","+(this._x1=+r)+","+(this._y1=+n)},bezierCurveTo:function(t,e,r,n,i,s){this._+="C"+ +t+","+ +e+","+ +r+","+ +n+","+(this._x1=+i)+","+(this._y1=+s)},arcTo:function(t,e,r,n,i){t=+t,e=+e,r=+r,n=+n,i=+i;var s=this._x1,a=this._y1,o=r-t,l=n-e,c=s-t,h=a-e,u=c*c+h*h;if(i<0)throw new Error("negative radius: "+i);if(null===this._x1)this._+="M"+(this._x1=t)+","+(this._y1=e);else if(u>os)if(Math.abs(h*o-l*c)>os&&i){var d=r-s,p=n-a,f=o*o+l*l,m=d*d+p*p,b=Math.sqrt(f),v=Math.sqrt(u),g=i*Math.tan((ss-Math.acos((f+u-m)/(2*b*v)))/2),y=g/v,w=g/b;Math.abs(y-1)>os&&(this._+="L"+(t+y*c)+","+(e+y*h)),this._+="A"+i+","+i+",0,0,"+ +(h*d>c*p)+","+(this._x1=t+w*o)+","+(this._y1=e+w*l)}else this._+="L"+(this._x1=t)+","+(this._y1=e);else;},arc:function(t,e,r,n,i,s){t=+t,e=+e,s=!!s;var a=(r=+r)*Math.cos(n),o=r*Math.sin(n),l=t+a,c=e+o,h=1^s,u=s?n-i:i-n;if(r<0)throw new Error("negative radius: "+r);null===this._x1?this._+="M"+l+","+c:(Math.abs(this._x1-l)>os||Math.abs(this._y1-c)>os)&&(this._+="L"+l+","+c),r&&(u<0&&(u=u%as+as),u>ls?this._+="A"+r+","+r+",0,1,"+h+","+(t-a)+","+(e-o)+"A"+r+","+r+",0,1,"+h+","+(this._x1=l)+","+(this._y1=c):u>os&&(this._+="A"+r+","+r+",0,"+ +(u>=ss)+","+h+","+(this._x1=t+r*Math.cos(i))+","+(this._y1=e+r*Math.sin(i))))},rect:function(t,e,r,n){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)+"h"+ +r+"v"+ +n+"h"+-r+"Z"},toString:function(){return this._}};var us=Math.sqrt(50),ds=Math.sqrt(10),ps=Math.sqrt(2);function fs(t,e,r){var n,i,s,a,o=-1;if(r=+r,(t=+t)===(e=+e)&&r>0)return[t];if((n=e<t)&&(i=t,t=e,e=i),0===(a=function(t,e,r){var n=(e-t)/Math.max(0,r),i=Math.floor(Math.log(n)/Math.LN10),s=n/Math.pow(10,i);return i>=0?(s>=us?10:s>=ds?5:s>=ps?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(s>=us?10:s>=ds?5:s>=ps?2:1)}(t,e,r))||!isFinite(a))return[];if(a>0){let r=Math.round(t/a),n=Math.round(e/a);for(r*a<t&&++r,n*a>e&&--n,s=new Array(i=n-r+1);++o<i;)s[o]=(r+o)*a}else{a=-a;let r=Math.round(t*a),n=Math.round(e*a);for(r/a<t&&++r,n/a>e&&--n,s=new Array(i=n-r+1);++o<i;)s[o]=(r+o)/a}return n&&s.reverse(),s}function ms(t){return Math.ceil(Math.log(function(t,e){let r=0;if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&++r;else{let n=-1;for(let i of t)null!=(i=e(i,++n,t))&&(i=+i)>=i&&++r}return r}(t))/Math.LN2)+1}var bs=Array.prototype.slice;function vs(t,e){return t-e}var gs=t=>()=>t;function ys(t,e){for(var r,n=-1,i=e.length;++n<i;)if(r=ws(t,e[n]))return r;return 0}function ws(t,e){for(var r=e[0],n=e[1],i=-1,s=0,a=t.length,o=a-1;s<a;o=s++){var l=t[s],c=l[0],h=l[1],u=t[o],d=u[0],p=u[1];if(xs(l,u,e))return 0;h>n!=p>n&&r<(d-c)*(n-h)/(p-h)+c&&(i=-i)}return i}function xs(t,e,r){var n;return function(t,e,r){return(e[0]-t[0])*(r[1]-t[1])==(r[0]-t[0])*(e[1]-t[1])}(t,e,r)&&function(t,e,r){return t<=e&&e<=r||r<=e&&e<=t}(t[n=+(t[0]===e[0])],r[n],e[n])}function $s(){}var _s=[[],[[[1,1.5],[.5,1]]],[[[1.5,1],[1,1.5]]],[[[1.5,1],[.5,1]]],[[[1,.5],[1.5,1]]],[[[1,1.5],[.5,1]],[[1,.5],[1.5,1]]],[[[1,.5],[1,1.5]]],[[[1,.5],[.5,1]]],[[[.5,1],[1,.5]]],[[[1,1.5],[1,.5]]],[[[.5,1],[1,.5]],[[1.5,1],[1,1.5]]],[[[1.5,1],[1,.5]]],[[[.5,1],[1.5,1]]],[[[1,1.5],[1.5,1]]],[[[.5,1],[1,1.5]]],[]];function ks(){var t=1,e=1,r=ms,n=o;function i(t){var e=r(t);if(Array.isArray(e))e=e.slice().sort(vs);else{const r=function(t,e){let r,n;if(void 0===e)for(const e of t)null!=e&&(void 0===r?e>=e&&(r=n=e):(r>e&&(r=e),n<e&&(n=e)));else{let i=-1;for(let s of t)null!=(s=e(s,++i,t))&&(void 0===r?s>=s&&(r=n=s):(r>s&&(r=s),n<s&&(n=s)))}return[r,n]}(t),n=function(t,e,r){var n=Math.abs(e-t)/Math.max(0,r),i=Math.pow(10,Math.floor(Math.log(n)/Math.LN10)),s=n/i;return s>=us?i*=10:s>=ds?i*=5:s>=ps&&(i*=2),e<t?-i:i}(r[0],r[1],e);e=fs(Math.floor(r[0]/n)*n,Math.floor(r[1]/n-1)*n,e)}return e.map((e=>s(t,e)))}function s(r,i){var s=[],o=[];return function(r,n,i){var s,o,l,c,h,u,d=new Array,p=new Array;s=o=-1,c=r[0]>=n,_s[c<<1].forEach(f);for(;++s<t-1;)l=c,c=r[s+1]>=n,_s[l|c<<1].forEach(f);_s[c<<0].forEach(f);for(;++o<e-1;){for(s=-1,c=r[o*t+t]>=n,h=r[o*t]>=n,_s[c<<1|h<<2].forEach(f);++s<t-1;)l=c,c=r[o*t+t+s+1]>=n,u=h,h=r[o*t+s+1]>=n,_s[l|c<<1|h<<2|u<<3].forEach(f);_s[c|h<<3].forEach(f)}s=-1,h=r[o*t]>=n,_s[h<<2].forEach(f);for(;++s<t-1;)u=h,h=r[o*t+s+1]>=n,_s[h<<2|u<<3].forEach(f);function f(t){var e,r,n=[t[0][0]+s,t[0][1]+o],l=[t[1][0]+s,t[1][1]+o],c=a(n),h=a(l);(e=p[c])?(r=d[h])?(delete p[e.end],delete d[r.start],e===r?(e.ring.push(l),i(e.ring)):d[e.start]=p[r.end]={start:e.start,end:r.end,ring:e.ring.concat(r.ring)}):(delete p[e.end],e.ring.push(l),p[e.end=h]=e):(e=d[h])?(r=p[c])?(delete d[e.start],delete p[r.end],e===r?(e.ring.push(l),i(e.ring)):d[r.start]=p[e.end]={start:r.start,end:e.end,ring:r.ring.concat(e.ring)}):(delete d[e.start],e.ring.unshift(n),d[e.start=c]=e):d[c]=p[h]={start:c,end:h,ring:[n,l]}}_s[h<<3].forEach(f)}(r,i,(function(t){n(t,r,i),function(t){for(var e=0,r=t.length,n=t[r-1][1]*t[0][0]-t[r-1][0]*t[0][1];++e<r;)n+=t[e-1][1]*t[e][0]-t[e-1][0]*t[e][1];return n}(t)>0?s.push([t]):o.push(t)})),o.forEach((function(t){for(var e,r=0,n=s.length;r<n;++r)if(-1!==ys((e=s[r])[0],t))return void e.push(t)})),{type:"MultiPolygon",value:i,coordinates:s}}function a(e){return 2*e[0]+e[1]*(t+1)*4}function o(r,n,i){r.forEach((function(r){var s,a=r[0],o=r[1],l=0|a,c=0|o,h=n[c*t+l];a>0&&a<t&&l===a&&(s=n[c*t+l-1],r[0]=a+(i-s)/(h-s)-.5),o>0&&o<e&&c===o&&(s=n[(c-1)*t+l],r[1]=o+(i-s)/(h-s)-.5)}))}return i.contour=s,i.size=function(r){if(!arguments.length)return[t,e];var n=Math.floor(r[0]),s=Math.floor(r[1]);if(!(n>=0&&s>=0))throw new Error("invalid size");return t=n,e=s,i},i.thresholds=function(t){return arguments.length?(r="function"==typeof t?t:Array.isArray(t)?gs(bs.call(t)):gs(t),i):r},i.smooth=function(t){return arguments.length?(n=t?o:$s,i):n===o},i}function Ss(t,e){if((r=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var r,n=t.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+t.slice(r+1)]}function As(t){return(t=Ss(Math.abs(t)))?t[1]:NaN}var Es,Ms=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Ts(t){if(!(e=Ms.exec(t)))throw new Error("invalid format: "+t);var e;return new Cs({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 Cs(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 Ns(t,e){var r=Ss(t,e);if(!r)return t+"";var n=r[0],i=r[1];return i<0?"0."+new Array(-i).join("0")+n:n.length>i+1?n.slice(0,i+1)+"."+n.slice(i+1):n+new Array(i-n.length+2).join("0")}Ts.prototype=Cs.prototype,Cs.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 Rs={"%":(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)=>Ns(100*t,e),r:Ns,s:function(t,e){var r=Ss(t,e);if(!r)return t+"";var n=r[0],i=r[1],s=i-(Es=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,a=n.length;return s===a?n:s>a?n+new Array(s-a+1).join("0"):s>0?n.slice(0,s)+"."+n.slice(s):"0."+new Array(1-s).join("0")+Ss(t,Math.max(0,e+s-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function qs(t){return t}var Ps,zs,Fs,Os=Array.prototype.map,Hs=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Us(t){var e,r,n=void 0===t.grouping||void 0===t.thousands?qs:(e=Os.call(t.grouping,Number),r=t.thousands+"",function(t,n){for(var i=t.length,s=[],a=0,o=e[0],l=0;i>0&&o>0&&(l+o+1>n&&(o=Math.max(1,n-l)),s.push(t.substring(i-=o,i+o)),!((l+=o+1)>n));)o=e[a=(a+1)%e.length];return s.reverse().join(r)}),i=void 0===t.currency?"":t.currency[0]+"",s=void 0===t.currency?"":t.currency[1]+"",a=void 0===t.decimal?".":t.decimal+"",o=void 0===t.numerals?qs:function(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}(Os.call(t.numerals,String)),l=void 0===t.percent?"%":t.percent+"",c=void 0===t.minus?"−":t.minus+"",h=void 0===t.nan?"NaN":t.nan+"";function u(t){var e=(t=Ts(t)).fill,r=t.align,u=t.sign,d=t.symbol,p=t.zero,f=t.width,m=t.comma,b=t.precision,v=t.trim,g=t.type;"n"===g?(m=!0,g="g"):Rs[g]||(void 0===b&&(b=12),v=!0,g="g"),(p||"0"===e&&"="===r)&&(p=!0,e="0",r="=");var y="$"===d?i:"#"===d&&/[boxX]/.test(g)?"0"+g.toLowerCase():"",w="$"===d?s:/[%p]/.test(g)?l:"",x=Rs[g],$=/[defgprs%]/.test(g);function _(t){var i,s,l,d=y,_=w;if("c"===g)_=x(t)+_,t="";else{var k=(t=+t)<0||1/t<0;if(t=isNaN(t)?h:x(Math.abs(t),b),v&&(t=function(t){t:for(var e,r=t.length,n=1,i=-1;n<r;++n)switch(t[n]){case".":i=e=n;break;case"0":0===i&&(i=n),e=n;break;default:if(!+t[n])break t;i>0&&(i=0)}return i>0?t.slice(0,i)+t.slice(e+1):t}(t)),k&&0==+t&&"+"!==u&&(k=!1),d=(k?"("===u?u:c:"-"===u||"("===u?"":u)+d,_=("s"===g?Hs[8+Es/3]:"")+_+(k&&"("===u?")":""),$)for(i=-1,s=t.length;++i<s;)if(48>(l=t.charCodeAt(i))||l>57){_=(46===l?a+t.slice(i+1):t.slice(i))+_,t=t.slice(0,i);break}}m&&!p&&(t=n(t,1/0));var S=d.length+t.length+_.length,A=S<f?new Array(f-S+1).join(e):"";switch(m&&p&&(t=n(A+t,A.length?f-_.length:1/0),A=""),r){case"<":t=d+t+_+A;break;case"=":t=d+A+t+_;break;case"^":t=A.slice(0,S=A.length>>1)+d+t+_+A.slice(S);break;default:t=A+d+t+_}return o(t)}return b=void 0===b?6:/[gprs]/.test(g)?Math.max(1,Math.min(21,b)):Math.max(0,Math.min(20,b)),_.toString=function(){return t+""},_}return{format:u,formatPrefix:function(t,e){var r=u(((t=Ts(t)).type="f",t)),n=3*Math.max(-8,Math.min(8,Math.floor(As(e)/3))),i=Math.pow(10,-n),s=Hs[8+n/3];return function(t){return r(i*t)+s}}}}Ps=Us({thousands:",",grouping:[3],currency:["$",""]}),zs=Ps.format,Fs=Ps.formatPrefix;var Ds=1e-6,Is=Math.PI,Ls=2*Is,js=180/Is,Bs=Is/180,Vs=Math.abs,Ks=Math.cos,Ws=Math.sin,Xs=Math.sqrt;function Ys(){}function Zs(t,e){t&&Js.hasOwnProperty(t.type)&&Js[t.type](t,e)}var Gs={Feature:function(t,e){Zs(t.geometry,e)},FeatureCollection:function(t,e){for(var r=t.features,n=-1,i=r.length;++n<i;)Zs(r[n].geometry,e)}},Js={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates,e.point(t[0],t[1],t[2])},MultiPoint:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)t=r[n],e.point(t[0],t[1],t[2])},LineString:function(t,e){Qs(t.coordinates,e,0)},MultiLineString:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)Qs(r[n],e,0)},Polygon:function(t,e){ta(t.coordinates,e)},MultiPolygon:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)ta(r[n],e)},GeometryCollection:function(t,e){for(var r=t.geometries,n=-1,i=r.length;++n<i;)Zs(r[n],e)}};function Qs(t,e,r){var n,i=-1,s=t.length-r;for(e.lineStart();++i<s;)n=t[i],e.point(n[0],n[1],n[2]);e.lineEnd()}function ta(t,e){var r=-1,n=t.length;for(e.polygonStart();++r<n;)Qs(t[r],e,1);e.polygonEnd()}function ea(t,e){t&&Gs.hasOwnProperty(t.type)?Gs[t.type](t,e):Zs(t,e)}function ra(t,e,r,n){this.x=t,this.z=e,this.o=r,this.e=n,this.v=!1,this.n=this.p=null}function na(t,e,r,n,i){var s,a,o=[],l=[];if(t.forEach((function(t){if(!((e=t.length-1)<=0)){var e,r,n=t[0],a=t[e];if(function(t,e){return Vs(t[0]-e[0])<Ds&&Vs(t[1]-e[1])<Ds}(n,a)){if(!n[2]&&!a[2]){for(i.lineStart(),s=0;s<e;++s)i.point((n=t[s])[0],n[1]);return void i.lineEnd()}a[0]+=2e-6}o.push(r=new ra(n,t,null,!0)),l.push(r.o=new ra(n,null,r,!1)),o.push(r=new ra(a,t,null,!1)),l.push(r.o=new ra(a,null,r,!0))}})),o.length){for(l.sort(e),ia(o),ia(l),s=0,a=l.length;s<a;++s)l[s].e=r=!r;for(var c,h,u=o[0];;){for(var d=u,p=!0;d.v;)if((d=d.n)===u)return;c=d.z,i.lineStart();do{if(d.v=d.o.v=!0,d.e){if(p)for(s=0,a=c.length;s<a;++s)i.point((h=c[s])[0],h[1]);else n(d.x,d.n.x,1,i);d=d.n}else{if(p)for(c=d.p.z,s=c.length-1;s>=0;--s)i.point((h=c[s])[0],h[1]);else n(d.x,d.p.x,-1,i);d=d.p}c=(d=d.o).z,p=!p}while(!d.v);i.lineEnd()}}}function ia(t){if(e=t.length){for(var e,r,n=0,i=t[0];++n<e;)i.n=r=t[n],r.p=i,i=r;i.n=r=t[0],r.p=i}}var sa=1e9,aa=-sa;function oa(t,e,r,n){function i(i,s){return t<=i&&i<=r&&e<=s&&s<=n}function s(i,s,o,c){var h=0,u=0;if(null==i||(h=a(i,o))!==(u=a(s,o))||l(i,s)<0^o>0)do{c.point(0===h||3===h?t:r,h>1?n:e)}while((h=(h+o+4)%4)!==u);else c.point(s[0],s[1])}function a(n,i){return Vs(n[0]-t)<Ds?i>0?0:3:Vs(n[0]-r)<Ds?i>0?2:1:Vs(n[1]-e)<Ds?i>0?1:0:i>0?3:2}function o(t,e){return l(t.x,e.x)}function l(t,e){var r=a(t,1),n=a(e,1);return r!==n?r-n:0===r?e[1]-t[1]:1===r?t[0]-e[0]:2===r?t[1]-e[1]:e[0]-t[0]}return function(a){var l,c,h,u,d,p,f,m,b,v,g,y=a,w=function(){var t,e=[];return{point:function(e,r,n){t.push([e,r,n])},lineStart:function(){e.push(t=[])},lineEnd:Ys,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var r=e;return e=[],t=null,r}}}(),x={point:$,lineStart:function(){x.point=_,c&&c.push(h=[]);v=!0,b=!1,f=m=NaN},lineEnd:function(){l&&(_(u,d),p&&b&&w.rejoin(),l.push(w.result()));x.point=$,b&&y.lineEnd()},polygonStart:function(){y=w,l=[],c=[],g=!0},polygonEnd:function(){var e=function(){for(var e=0,r=0,i=c.length;r<i;++r)for(var s,a,o=c[r],l=1,h=o.length,u=o[0],d=u[0],p=u[1];l<h;++l)s=d,a=p,d=(u=o[l])[0],p=u[1],a<=n?p>n&&(d-s)*(n-a)>(p-a)*(t-s)&&++e:p<=n&&(d-s)*(n-a)<(p-a)*(t-s)&&--e;return e}(),r=g&&e,i=(u=l,l=Array.from(function*(t){for(const e of t)yield*e}(u))).length;var u;(r||i)&&(a.polygonStart(),r&&(a.lineStart(),s(null,null,1,a),a.lineEnd()),i&&na(l,o,e,s,a),a.polygonEnd());y=a,l=c=h=null}};function $(t,e){i(t,e)&&y.point(t,e)}function _(s,a){var o=i(s,a);if(c&&h.push([s,a]),v)u=s,d=a,p=o,v=!1,o&&(y.lineStart(),y.point(s,a));else if(o&&b)y.point(s,a);else{var l=[f=Math.max(aa,Math.min(sa,f)),m=Math.max(aa,Math.min(sa,m))],w=[s=Math.max(aa,Math.min(sa,s)),a=Math.max(aa,Math.min(sa,a))];!function(t,e,r,n,i,s){var a,o=t[0],l=t[1],c=0,h=1,u=e[0]-o,d=e[1]-l;if(a=r-o,u||!(a>0)){if(a/=u,u<0){if(a<c)return;a<h&&(h=a)}else if(u>0){if(a>h)return;a>c&&(c=a)}if(a=i-o,u||!(a<0)){if(a/=u,u<0){if(a>h)return;a>c&&(c=a)}else if(u>0){if(a<c)return;a<h&&(h=a)}if(a=n-l,d||!(a>0)){if(a/=d,d<0){if(a<c)return;a<h&&(h=a)}else if(d>0){if(a>h)return;a>c&&(c=a)}if(a=s-l,d||!(a<0)){if(a/=d,d<0){if(a>h)return;a>c&&(c=a)}else if(d>0){if(a<c)return;a<h&&(h=a)}return c>0&&(t[0]=o+c*u,t[1]=l+c*d),h<1&&(e[0]=o+h*u,e[1]=l+h*d),!0}}}}}(l,w,t,e,r,n)?o&&(y.lineStart(),y.point(s,a),g=!1):(b||(y.lineStart(),y.point(l[0],l[1])),y.point(w[0],w[1]),o||y.lineEnd(),g=!1)}f=s,m=a,b=o}return x}}var la,ca,ha,ua,da=t=>t,pa=new te,fa=new te,ma={point:Ys,lineStart:Ys,lineEnd:Ys,polygonStart:function(){ma.lineStart=ba,ma.lineEnd=ya},polygonEnd:function(){ma.lineStart=ma.lineEnd=ma.point=Ys,pa.add(Vs(fa)),fa=new te},result:function(){var t=pa/2;return pa=new te,t}};function ba(){ma.point=va}function va(t,e){ma.point=ga,la=ha=t,ca=ua=e}function ga(t,e){fa.add(ua*t-ha*e),ha=t,ua=e}function ya(){ga(la,ca)}var wa=ma,xa=1/0,$a=xa,_a=-xa,ka=_a,Sa={point:function(t,e){t<xa&&(xa=t);t>_a&&(_a=t);e<$a&&($a=e);e>ka&&(ka=e)},lineStart:Ys,lineEnd:Ys,polygonStart:Ys,polygonEnd:Ys,result:function(){var t=[[xa,$a],[_a,ka]];return _a=ka=-($a=xa=1/0),t}};var Aa,Ea,Ma,Ta,Ca=Sa,Na=0,Ra=0,qa=0,Pa=0,za=0,Fa=0,Oa=0,Ha=0,Ua=0,Da={point:Ia,lineStart:La,lineEnd:Va,polygonStart:function(){Da.lineStart=Ka,Da.lineEnd=Wa},polygonEnd:function(){Da.point=Ia,Da.lineStart=La,Da.lineEnd=Va},result:function(){var t=Ua?[Oa/Ua,Ha/Ua]:Fa?[Pa/Fa,za/Fa]:qa?[Na/qa,Ra/qa]:[NaN,NaN];return Na=Ra=qa=Pa=za=Fa=Oa=Ha=Ua=0,t}};function Ia(t,e){Na+=t,Ra+=e,++qa}function La(){Da.point=ja}function ja(t,e){Da.point=Ba,Ia(Ma=t,Ta=e)}function Ba(t,e){var r=t-Ma,n=e-Ta,i=Xs(r*r+n*n);Pa+=i*(Ma+t)/2,za+=i*(Ta+e)/2,Fa+=i,Ia(Ma=t,Ta=e)}function Va(){Da.point=Ia}function Ka(){Da.point=Xa}function Wa(){Ya(Aa,Ea)}function Xa(t,e){Da.point=Ya,Ia(Aa=Ma=t,Ea=Ta=e)}function Ya(t,e){var r=t-Ma,n=e-Ta,i=Xs(r*r+n*n);Pa+=i*(Ma+t)/2,za+=i*(Ta+e)/2,Fa+=i,Oa+=(i=Ta*t-Ma*e)*(Ma+t),Ha+=i*(Ta+e),Ua+=3*i,Ia(Ma=t,Ta=e)}var Za=Da;function Ga(t){this._context=t}Ga.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._context.moveTo(t,e),this._point=1;break;case 1:this._context.lineTo(t,e);break;default:this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,Ls)}},result:Ys};var Ja,Qa,to,eo,ro,no=new te,io={point:Ys,lineStart:function(){io.point=so},lineEnd:function(){Ja&&ao(Qa,to),io.point=Ys},polygonStart:function(){Ja=!0},polygonEnd:function(){Ja=null},result:function(){var t=+no;return no=new te,t}};function so(t,e){io.point=ao,Qa=eo=t,to=ro=e}function ao(t,e){eo-=t,ro-=e,no.add(Xs(eo*eo+ro*ro)),eo=t,ro=e}var oo=io;function lo(){this._string=[]}function co(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function ho(t,e){var r,n,i=4.5;function s(t){return t&&("function"==typeof i&&n.pointRadius(+i.apply(this,arguments)),ea(t,r(n))),n.result()}return s.area=function(t){return ea(t,r(wa)),wa.result()},s.measure=function(t){return ea(t,r(oo)),oo.result()},s.bounds=function(t){return ea(t,r(Ca)),Ca.result()},s.centroid=function(t){return ea(t,r(Za)),Za.result()},s.projection=function(e){return arguments.length?(r=null==e?(t=null,da):(t=e).stream,s):t},s.context=function(t){return arguments.length?(n=null==t?(e=null,new lo):new Ga(e=t),"function"!=typeof i&&n.pointRadius(i),s):e},s.pointRadius=function(t){return arguments.length?(i="function"==typeof t?t:(n.pointRadius(+t),+t),s):i},s.projection(t).context(e)}function uo(){}function po(t,e,r){var n=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=n&&t.clipExtent(null),ea(r,t.stream(Ca)),e(Ca.result()),null!=n&&t.clipExtent(n),t}function fo(t,e,r){return po(t,(function(r){var n=e[1][0]-e[0][0],i=e[1][1]-e[0][1],s=Math.min(n/(r[1][0]-r[0][0]),i/(r[1][1]-r[0][1])),a=+e[0][0]+(n-s*(r[1][0]+r[0][0]))/2,o=+e[0][1]+(i-s*(r[1][1]+r[0][1]))/2;t.scale(150*s).translate([a,o])}),r)}function mo(){var t,e,r,n,i,s,a,o,l=1,c=0,h=0,u=1,d=1,p=0,f=null,m=1,b=1,v=(o={point:function(t,e){var r=w([t,e]);this.stream.point(r[0],r[1])}},function(t){var e=new uo;for(var r in o)e[r]=o[r];return e.stream=t,e}),g=da;function y(){return m=l*u,b=l*d,s=a=null,w}function w(r){var n=r[0]*m,i=r[1]*b;if(p){var s=i*t-n*e;n=n*t+i*e,i=s}return[n+c,i+h]}return w.invert=function(r){var n=r[0]-c,i=r[1]-h;if(p){var s=i*t+n*e;n=n*t-i*e,i=s}return[n/m,i/b]},w.stream=function(t){return s&&a===t?s:s=v(g(a=t))},w.postclip=function(t){return arguments.length?(g=t,f=r=n=i=null,y()):g},w.clipExtent=function(t){return arguments.length?(g=null==t?(f=r=n=i=null,da):oa(f=+t[0][0],r=+t[0][1],n=+t[1][0],i=+t[1][1]),y()):null==f?null:[[f,r],[n,i]]},w.scale=function(t){return arguments.length?(l=+t,y()):l},w.translate=function(t){return arguments.length?(c=+t[0],h=+t[1],y()):[c,h]},w.angle=function(r){return arguments.length?(e=Ws(p=r%360*Bs),t=Ks(p),y()):p*js},w.reflectX=function(t){return arguments.length?(u=t?-1:1,y()):u<0},w.reflectY=function(t){return arguments.length?(d=t?-1:1,y()):d<0},w.fitExtent=function(t,e){return fo(w,t,e)},w.fitSize=function(t,e){return function(t,e,r){return fo(t,[[0,0],e],r)}(w,t,e)},w.fitWidth=function(t,e){return function(t,e,r){return po(t,(function(r){var n=+e,i=n/(r[1][0]-r[0][0]),s=(n-i*(r[1][0]+r[0][0]))/2,a=-i*r[0][1];t.scale(150*i).translate([s,a])}),r)}(w,t,e)},w.fitHeight=function(t,e){return function(t,e,r){return po(t,(function(r){var n=+e,i=n/(r[1][1]-r[0][1]),s=-i*r[0][0],a=(n-i*(r[1][1]+r[0][1]))/2;t.scale(150*i).translate([s,a])}),r)}(w,t,e)},w}function bo(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}function vo(t){return+t}lo.prototype={_radius:4.5,_circle:co(4.5),pointRadius:function(t){return(t=+t)!==this._radius&&(this._radius=t,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._string.push("Z"),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._string.push("M",t,",",e),this._point=1;break;case 1:this._string.push("L",t,",",e);break;default:null==this._circle&&(this._circle=co(this._radius)),this._string.push("M",t,",",e,this._circle)}},result:function(){if(this._string.length){var t=this._string.join("");return this._string=[],t}return null}},uo.prototype={constructor:uo,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var go=[0,1];function yo(t){return t}function wo(t,e){return(e-=t=+t)?function(r){return(r-t)/e}:function(t){return function(){return t}}(isNaN(e)?NaN:.5)}function xo(t,e,r){var n=t[0],i=t[1],s=e[0],a=e[1];return i<n?(n=wo(i,n),s=r(a,s)):(n=wo(n,i),s=r(s,a)),function(t){return s(n(t))}}function $o(t,e,r){var n=Math.min(t.length,e.length)-1,i=new Array(n),s=new Array(n),a=-1;for(t[n]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++a<n;)i[a]=wo(t[a],t[a+1]),s[a]=r(e[a],e[a+1]);return function(e){var r=Jt(t,e,1,n)-1;return s[r](i[r](e))}}function _o(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function ko(){var t,e,r,n,i,s,a=go,o=go,l=Vn,c=yo;function h(){var t=Math.min(a.length,o.length);return c!==yo&&(c=function(t,e){var r;return t>e&&(r=t,t=e,e=r),function(r){return Math.max(t,Math.min(e,r))}}(a[0],a[t-1])),n=t>2?$o:xo,i=s=null,u}function u(e){return null==e||isNaN(e=+e)?r:(i||(i=n(a.map(t),o,l)))(t(c(e)))}return u.invert=function(r){return c(e((s||(s=n(o,a.map(t),Dn)))(r)))},u.domain=function(t){return arguments.length?(a=Array.from(t,vo),h()):a.slice()},u.range=function(t){return arguments.length?(o=Array.from(t),h()):o.slice()},u.rangeRound=function(t){return o=Array.from(t),l=Kn,h()},u.clamp=function(t){return arguments.length?(c=!!t||yo,h()):c!==yo},u.interpolate=function(t){return arguments.length?(l=t,h()):l},u.unknown=function(t){return arguments.length?(r=t,u):r},function(r,n){return t=r,e=n,h()}}function So(){return ko()(yo,yo)}function Ao(t,e,r,n){var i,s=function(t,e,r){var n=Math.abs(e-t)/Math.max(0,r),i=Math.pow(10,Math.floor(Math.log(n)/Math.LN10)),s=n/i;return s>=ie?i*=10:s>=se?i*=5:s>=ae&&(i*=2),e<t?-i:i}(t,e,r);switch((n=Ts(null==n?",f":n)).type){case"s":var a=Math.max(Math.abs(t),Math.abs(e));return null!=n.precision||isNaN(i=function(t,e){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(As(e)/3)))-As(Math.abs(t)))}(s,a))||(n.precision=i),Fs(n,a);case"":case"e":case"g":case"p":case"r":null!=n.precision||isNaN(i=function(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,As(e)-As(t))+1}(s,Math.max(Math.abs(t),Math.abs(e))))||(n.precision=i-("e"===n.type));break;case"f":case"%":null!=n.precision||isNaN(i=function(t){return Math.max(0,-As(Math.abs(t)))}(s))||(n.precision=i-2*("%"===n.type))}return zs(n)}function Eo(t){var e=t.domain;return t.ticks=function(t){var r=e();return oe(r[0],r[r.length-1],null==t?10:t)},t.tickFormat=function(t,r){var n=e();return Ao(n[0],n[n.length-1],null==t?10:t,r)},t.nice=function(r){null==r&&(r=10);var n,i,s=e(),a=0,o=s.length-1,l=s[a],c=s[o],h=10;for(c<l&&(i=l,l=c,c=i,i=a,a=o,o=i);h-- >0;){if((i=le(l,c,r))===n)return s[a]=l,s[o]=c,e(s);if(i>0)l=Math.floor(l/i)*i,c=Math.ceil(c/i)*i;else{if(!(i<0))break;l=Math.ceil(l*i)/i,c=Math.floor(c*i)/i}n=i}return t},t}function Mo(){var t=So();return t.copy=function(){return _o(t,Mo())},bo.apply(t,arguments),Eo(t)}var To=function(t){for(var e=t.length/6|0,r=new Array(e),n=0;n<e;)r[n]="#"+t.slice(6*n,6*++n);return r}("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999");function Co(t){return function(){return t}}function No(t){this._context=t}function Ro(t){return new No(t)}function qo(t){return t[0]}function Po(t){return t[1]}function zo(t,e){var r=Co(!0),n=null,i=Ro,s=null;function a(a){var o,l,c,h=(a=function(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}(a)).length,u=!1;for(null==n&&(s=i(c=hs())),o=0;o<=h;++o)!(o<h&&r(l=a[o],o,a))===u&&((u=!u)?s.lineStart():s.lineEnd()),u&&s.point(+t(l,o,a),+e(l,o,a));if(c)return s=null,c+""||null}return t="function"==typeof t?t:void 0===t?qo:Co(t),e="function"==typeof e?e:void 0===e?Po:Co(e),a.x=function(e){return arguments.length?(t="function"==typeof e?e:Co(+e),a):t},a.y=function(t){return arguments.length?(e="function"==typeof t?t:Co(+t),a):e},a.defined=function(t){return arguments.length?(r="function"==typeof t?t:Co(!!t),a):r},a.curve=function(t){return arguments.length?(i=t,null!=n&&(s=i(n)),a):i},a.context=function(t){return arguments.length?(null==t?n=s=null:s=i(n=t),a):n},a}function Fo(t,e,r){this.k=t,this.x=e,this.y=r}No.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)}}},Fo.prototype={constructor:Fo,scale:function(t){return 1===t?this:new Fo(this.k*t,this.x,this.y)},translate:function(t,e){return 0===t&0===e?this:new Fo(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+")"}},new Fo(1,0,0),Fo.prototype;class Oo extends Wt{getComputedStyleValue(t){return getComputedStyle(this).getPropertyValue(t).trim()}firstUpdated(t){super.firstUpdated(t),Lr(this.renderRoot.host).classed("keyboard",!0).on("mousemove.keyboard touchstart.keyboard",(t=>{Lr(t.currentTarget.renderRoot.host).classed("keyboard",!1).on("mousemove.keyboard touchstart.keyboard",null)})).on("keydown.keyboard",(t=>{Lr(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=Fn(t,"#ffffff")(.75),e.light50=Fn(t,"#ffffff")(.5),e.light25=Fn(t,"#ffffff")(.25),e.grey=t,e.dark25=Fn(t,"#000000")(.25),e.dark50=Fn(t,"#000000")(.5),e.dark75=Fn(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,r=!1){const n=this.shadows.opacityUmbra+this.shadows.opacityBoost,i=this.shadows.opacityPenumbra+this.shadows.opacityBoost,s=this.shadows.opacityAmbient+this.shadows.opacityBoost,a=r?`rgba(${this.shadows.inverseBaselineColorString}, ${n})`:`rgba(${this.shadows.baselineColorString}, ${n})`,o=r?`rgba(${this.shadows.inverseBaselineColorString}, ${i})`:`rgba(${this.shadows.baselineColorString}, ${i})`,l=r?`rgba(${this.shadows.inverseBaselineColorString}, ${s})`:`rgba(${this.shadows.baselineColorString}, ${s})`,c=this.shadows.mapUmbra[t],h=this.shadows.mapPenumbra[t],u=this.shadows.mapAmbient[t];return`${e?`${-c.y}px ${c.y/2}px ${c.b}px ${c.s}px`:`${c.y/2}px ${c.y}px ${c.b}px ${c.s}px`} ${a}, ${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`} ${o}, ${e?`${-u.y}px ${u.y/2}px ${u.b}px ${u.s}px`:`${u.y/2}px ${u.y}px ${u.b}px ${u.s}px`} ${l}`}static get svgFilters(){const t=Oo.shadows,e=t.elevations.map((e=>Mt`
|
|
40
|
+
var Jt,Qt;class te extends dt{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,e;const r=super.createRenderRoot();return null!==(t=(e=this.renderOptions).renderBefore)&&void 0!==t||(e.renderBefore=r.firstChild),r}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,r)=>{var n,i;const s=null!==(n=null==r?void 0:r.renderBefore)&&void 0!==n?n:e;let a=s._$litPart$;if(void 0===a){const t=null!==(i=null==r?void 0:r.renderBefore)&&void 0!==i?i:null;s._$litPart$=a=new Vt(e.insertBefore($t(),t),t,void 0,null!=r?r:{})}return a._$AI(t),a})(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!1)}render(){return Ft}}te.finalized=!0,te._$litElement$=!0,null===(Jt=globalThis.litElementHydrateSupport)||void 0===Jt||Jt.call(globalThis,{LitElement:te});const ee=globalThis.litElementPolyfillSupport;function re(t,e){return null==t||null==e?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function ne(t){let e=t,r=t,n=t;function i(t,e,i=0,s=t.length){if(i<s){if(0!==r(e,e))return s;do{const r=i+s>>>1;n(t[r],e)<0?i=r+1:s=r}while(i<s)}return i}return 2!==t.length&&(e=(e,r)=>t(e)-r,r=re,n=(e,r)=>re(t(e),r)),{left:i,center:function(t,r,n=0,s=t.length){const a=i(t,r,n,s-1);return a>n&&e(t[a-1],r)>-e(t[a],r)?a-1:a},right:function(t,e,i=0,s=t.length){if(i<s){if(0!==r(e,e))return s;do{const r=i+s>>>1;n(t[r],e)<=0?i=r+1:s=r}while(i<s)}return i}}}null==ee||ee({LitElement:te}),(null!==(Qt=globalThis.litElementVersions)&&void 0!==Qt?Qt:globalThis.litElementVersions=[]).push("3.3.0");const ie=ne(re).right;ne((function(t){return null===t?NaN:+t})).center;var se=ie;function ae(t,e){let r,n;if(void 0===e)for(const e of t)null!=e&&(void 0===r?e>=e&&(r=n=e):(r>e&&(r=e),n<e&&(n=e)));else{let i=-1;for(let s of t)null!=(s=e(s,++i,t))&&(void 0===r?s>=s&&(r=n=s):(r>s&&(r=s),n<s&&(n=s)))}return[r,n]}class oe{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){const e=this._partials;let r=0;for(let n=0;n<this._n&&n<32;n++){const i=e[n],s=t+i,a=Math.abs(t)<Math.abs(i)?t-(s-i):i-(s-t);a&&(e[r++]=a),t=s}return e[r]=t,this._n=r+1,this}valueOf(){const t=this._partials;let e,r,n,i=this._n,s=0;if(i>0){for(s=t[--i];i>0&&(e=s,r=t[--i],s=e+r,n=r-(s-e),!n););i>0&&(n<0&&t[i-1]<0||n>0&&t[i-1]>0)&&(r=2*n,e=s+r,r==e-s&&(s=e))}return s}}function le(t){return t}var ce=Array.prototype.slice;function he(t){return()=>t}var ue=Math.sqrt(50),de=Math.sqrt(10),pe=Math.sqrt(2);function fe(t,e,r){var n,i,s,a,o=-1;if(r=+r,(t=+t)===(e=+e)&&r>0)return[t];if((n=e<t)&&(i=t,t=e,e=i),0===(a=me(t,e,r))||!isFinite(a))return[];if(a>0){let r=Math.round(t/a),n=Math.round(e/a);for(r*a<t&&++r,n*a>e&&--n,s=new Array(i=n-r+1);++o<i;)s[o]=(r+o)*a}else{a=-a;let r=Math.round(t*a),n=Math.round(e*a);for(r/a<t&&++r,n/a>e&&--n,s=new Array(i=n-r+1);++o<i;)s[o]=(r+o)/a}return n&&s.reverse(),s}function me(t,e,r){var n=(e-t)/Math.max(0,r),i=Math.floor(Math.log(n)/Math.LN10),s=n/Math.pow(10,i);return i>=0?(s>=ue?10:s>=de?5:s>=pe?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(s>=ue?10:s>=de?5:s>=pe?2:1)}function be(t){return Math.ceil(Math.log(function(t,e){let r=0;if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&++r;else{let n=-1;for(let i of t)null!=(i=e(i,++n,t))&&(i=+i)>=i&&++r}return r}(t))/Math.LN2)+1}function ve(){var t=le,e=ae,r=be;function n(n){Array.isArray(n)||(n=Array.from(n));var i,s,a=n.length,o=new Array(a);for(i=0;i<a;++i)o[i]=t(n[i],i,n);var l=e(o),c=l[0],h=l[1],u=r(o,c,h);if(!Array.isArray(u)){const t=h,r=+u;if(e===ae&&([c,h]=function(t,e,r){let n;for(;;){const i=me(t,e,r);if(i===n||0===i||!isFinite(i))return[t,e];i>0?(t=Math.floor(t/i)*i,e=Math.ceil(e/i)*i):i<0&&(t=Math.ceil(t*i)/i,e=Math.floor(e*i)/i),n=i}}(c,h,r)),(u=fe(c,h,r))[u.length-1]>=h)if(t>=h&&e===ae){const t=me(c,h,r);isFinite(t)&&(t>0?h=(Math.floor(h/t)+1)*t:t<0&&(h=(Math.ceil(h*-t)+1)/-t))}else u.pop()}for(var d=u.length;u[0]<=c;)u.shift(),--d;for(;u[d-1]>h;)u.pop(),--d;var p,f=new Array(d+1);for(i=0;i<=d;++i)(p=f[i]=[]).x0=i>0?u[i-1]:c,p.x1=i<d?u[i]:h;for(i=0;i<a;++i)null!=(s=o[i])&&c<=s&&s<=h&&f[se(u,s,0,d)].push(n[i]);return f}return n.value=function(e){return arguments.length?(t="function"==typeof e?e:he(e),n):t},n.domain=function(t){return arguments.length?(e="function"==typeof t?t:he([t[0],t[1]]),n):e},n.thresholds=function(t){return arguments.length?(r="function"==typeof t?t:Array.isArray(t)?he(ce.call(t)):he(t),n):r},n}function ge(t,e,r){t=+t,e=+e,r=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+r;for(var n=-1,i=0|Math.max(0,Math.ceil((e-t)/r)),s=new Array(i);++n<i;)s[n]=t+n*r;return s}function ye(t){return t}var we=1,xe=2,$e=3,_e=4,ke=1e-6;function Se(t){return"translate("+t+",0)"}function Ae(t){return"translate(0,"+t+")"}function Ee(t){return e=>+t(e)}function Me(t,e){return e=Math.max(0,t.bandwidth()-2*e)/2,t.round()&&(e=Math.round(e)),r=>+t(r)+e}function Te(){return!this.__axis}function Ce(t,e){var r=[],n=null,i=null,s=6,a=6,o=3,l="undefined"!=typeof window&&window.devicePixelRatio>1?0:.5,c=t===we||t===_e?-1:1,h=t===_e||t===xe?"x":"y",u=t===we||t===$e?Se:Ae;function d(d){var p=null==n?e.ticks?e.ticks.apply(e,r):e.domain():n,f=null==i?e.tickFormat?e.tickFormat.apply(e,r):ye:i,m=Math.max(s,0)+o,b=e.range(),v=+b[0]+l,g=+b[b.length-1]+l,y=(e.bandwidth?Me:Ee)(e.copy(),l),w=d.selection?d.selection():d,x=w.selectAll(".domain").data([null]),$=w.selectAll(".tick").data(p,e).order(),_=$.exit(),k=$.enter().append("g").attr("class","tick"),S=$.select("line"),A=$.select("text");x=x.merge(x.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),$=$.merge(k),S=S.merge(k.append("line").attr("stroke","currentColor").attr(h+"2",c*s)),A=A.merge(k.append("text").attr("fill","currentColor").attr(h,c*m).attr("dy",t===we?"0em":t===$e?"0.71em":"0.32em")),d!==w&&(x=x.transition(d),$=$.transition(d),S=S.transition(d),A=A.transition(d),_=_.transition(d).attr("opacity",ke).attr("transform",(function(t){return isFinite(t=y(t))?u(t+l):this.getAttribute("transform")})),k.attr("opacity",ke).attr("transform",(function(t){var e=this.parentNode.__axis;return u((e&&isFinite(e=e(t))?e:y(t))+l)}))),_.remove(),x.attr("d",t===_e||t===xe?a?"M"+c*a+","+v+"H"+l+"V"+g+"H"+c*a:"M"+l+","+v+"V"+g:a?"M"+v+","+c*a+"V"+l+"H"+g+"V"+c*a:"M"+v+","+l+"H"+g),$.attr("opacity",1).attr("transform",(function(t){return u(y(t)+l)})),S.attr(h+"2",c*s),A.attr(h,c*m).text(f),w.filter(Te).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",t===xe?"start":t===_e?"end":"middle"),w.each((function(){this.__axis=y}))}return d.scale=function(t){return arguments.length?(e=t,d):e},d.ticks=function(){return r=Array.from(arguments),d},d.tickArguments=function(t){return arguments.length?(r=null==t?[]:Array.from(t),d):r.slice()},d.tickValues=function(t){return arguments.length?(n=null==t?null:Array.from(t),d):n&&n.slice()},d.tickFormat=function(t){return arguments.length?(i=t,d):i},d.tickSize=function(t){return arguments.length?(s=a=+t,d):s},d.tickSizeInner=function(t){return arguments.length?(s=+t,d):s},d.tickSizeOuter=function(t){return arguments.length?(a=+t,d):a},d.tickPadding=function(t){return arguments.length?(o=+t,d):o},d.offset=function(t){return arguments.length?(l=+t,d):l},d}function Ne(t){return Ce($e,t)}function Re(t){return Ce(_e,t)}var qe={value:()=>{}};function Pe(){for(var t,e=0,r=arguments.length,n={};e<r;++e){if(!(t=arguments[e]+"")||t in n||/[\s.]/.test(t))throw new Error("illegal type: "+t);n[t]=[]}return new ze(n)}function ze(t){this._=t}function Fe(t,e){for(var r,n=0,i=t.length;n<i;++n)if((r=t[n]).name===e)return r.value}function Oe(t,e,r){for(var n=0,i=t.length;n<i;++n)if(t[n].name===e){t[n]=qe,t=t.slice(0,n).concat(t.slice(n+1));break}return null!=r&&t.push({name:e,value:r}),t}ze.prototype=Pe.prototype={constructor:ze,on:function(t,e){var r,n,i=this._,s=(n=i,(t+"").trim().split(/^|\s+/).map((function(t){var e="",r=t.indexOf(".");if(r>=0&&(e=t.slice(r+1),t=t.slice(0,r)),t&&!n.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))),a=-1,o=s.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++a<o;)if(r=(t=s[a]).type)i[r]=Oe(i[r],t.name,e);else if(null==e)for(r in i)i[r]=Oe(i[r],t.name,null);return this}for(;++a<o;)if((r=(t=s[a]).type)&&(r=Fe(i[r],t.name)))return r},copy:function(){var t={},e=this._;for(var r in e)t[r]=e[r].slice();return new ze(t)},call:function(t,e){if((r=arguments.length-2)>0)for(var r,n,i=new Array(r),s=0;s<r;++s)i[s]=arguments[s+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(s=0,r=(n=this._[t]).length;s<r;++s)n[s].value.apply(e,i)},apply:function(t,e,r){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var n=this._[t],i=0,s=n.length;i<s;++i)n[i].value.apply(e,r)}};var He="http://www.w3.org/1999/xhtml",Ue={svg:"http://www.w3.org/2000/svg",xhtml:He,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function De(t){var e=t+="",r=e.indexOf(":");return r>=0&&"xmlns"!==(e=t.slice(0,r))&&(t=t.slice(r+1)),Ue.hasOwnProperty(e)?{space:Ue[e],local:t}:t}function Ie(t){return function(){var e=this.ownerDocument,r=this.namespaceURI;return r===He&&e.documentElement.namespaceURI===He?e.createElement(t):e.createElementNS(r,t)}}function Le(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function je(t){var e=De(t);return(e.local?Le:Ie)(e)}function Ve(){}function Be(t){return null==t?Ve:function(){return this.querySelector(t)}}function Ke(){return[]}function We(t){return null==t?Ke:function(){return this.querySelectorAll(t)}}function Xe(t){return function(){return function(t){return null==t?[]:Array.isArray(t)?t:Array.from(t)}(t.apply(this,arguments))}}function Ye(t){return function(){return this.matches(t)}}function Ze(t){return function(e){return e.matches(t)}}var Ge=Array.prototype.find;function Je(){return this.firstElementChild}var Qe=Array.prototype.filter;function tr(){return Array.from(this.children)}function er(t){return new Array(t.length)}function rr(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function nr(t,e,r,n,i,s){for(var a,o=0,l=e.length,c=s.length;o<c;++o)(a=e[o])?(a.__data__=s[o],n[o]=a):r[o]=new rr(t,s[o]);for(;o<l;++o)(a=e[o])&&(i[o]=a)}function ir(t,e,r,n,i,s,a){var o,l,c,h=new Map,u=e.length,d=s.length,p=new Array(u);for(o=0;o<u;++o)(l=e[o])&&(p[o]=c=a.call(l,l.__data__,o,e)+"",h.has(c)?i[o]=l:h.set(c,l));for(o=0;o<d;++o)c=a.call(t,s[o],o,s)+"",(l=h.get(c))?(n[o]=l,l.__data__=s[o],h.delete(c)):r[o]=new rr(t,s[o]);for(o=0;o<u;++o)(l=e[o])&&h.get(p[o])===l&&(i[o]=l)}function sr(t){return t.__data__}function ar(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function or(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function lr(t){return function(){this.removeAttribute(t)}}function cr(t){return function(){this.removeAttributeNS(t.space,t.local)}}function hr(t,e){return function(){this.setAttribute(t,e)}}function ur(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function dr(t,e){return function(){var r=e.apply(this,arguments);null==r?this.removeAttribute(t):this.setAttribute(t,r)}}function pr(t,e){return function(){var r=e.apply(this,arguments);null==r?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,r)}}function fr(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function mr(t){return function(){this.style.removeProperty(t)}}function br(t,e,r){return function(){this.style.setProperty(t,e,r)}}function vr(t,e,r){return function(){var n=e.apply(this,arguments);null==n?this.style.removeProperty(t):this.style.setProperty(t,n,r)}}function gr(t,e){return t.style.getPropertyValue(e)||fr(t).getComputedStyle(t,null).getPropertyValue(e)}function yr(t){return function(){delete this[t]}}function wr(t,e){return function(){this[t]=e}}function xr(t,e){return function(){var r=e.apply(this,arguments);null==r?delete this[t]:this[t]=r}}function $r(t){return t.trim().split(/^|\s+/)}function _r(t){return t.classList||new kr(t)}function kr(t){this._node=t,this._names=$r(t.getAttribute("class")||"")}function Sr(t,e){for(var r=_r(t),n=-1,i=e.length;++n<i;)r.add(e[n])}function Ar(t,e){for(var r=_r(t),n=-1,i=e.length;++n<i;)r.remove(e[n])}function Er(t){return function(){Sr(this,t)}}function Mr(t){return function(){Ar(this,t)}}function Tr(t,e){return function(){(e.apply(this,arguments)?Sr:Ar)(this,t)}}function Cr(){this.textContent=""}function Nr(t){return function(){this.textContent=t}}function Rr(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}function qr(){this.innerHTML=""}function Pr(t){return function(){this.innerHTML=t}}function zr(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}function Fr(){this.nextSibling&&this.parentNode.appendChild(this)}function Or(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Hr(){return null}function Ur(){var t=this.parentNode;t&&t.removeChild(this)}function Dr(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Ir(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Lr(t){return function(){var e=this.__on;if(e){for(var r,n=0,i=-1,s=e.length;n<s;++n)r=e[n],t.type&&r.type!==t.type||r.name!==t.name?e[++i]=r:this.removeEventListener(r.type,r.listener,r.options);++i?e.length=i:delete this.__on}}}function jr(t,e,r){return function(){var n,i=this.__on,s=function(t){return function(e){t.call(this,e,this.__data__)}}(e);if(i)for(var a=0,o=i.length;a<o;++a)if((n=i[a]).type===t.type&&n.name===t.name)return this.removeEventListener(n.type,n.listener,n.options),this.addEventListener(n.type,n.listener=s,n.options=r),void(n.value=e);this.addEventListener(t.type,s,r),n={type:t.type,name:t.name,value:e,listener:s,options:r},i?i.push(n):this.__on=[n]}}function Vr(t,e,r){var n=fr(t),i=n.CustomEvent;"function"==typeof i?i=new i(e,r):(i=n.document.createEvent("Event"),r?(i.initEvent(e,r.bubbles,r.cancelable),i.detail=r.detail):i.initEvent(e,!1,!1)),t.dispatchEvent(i)}function Br(t,e){return function(){return Vr(this,t,e)}}function Kr(t,e){return function(){return Vr(this,t,e.apply(this,arguments))}}rr.prototype={constructor:rr,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)}},kr.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 Wr=[null];function Xr(t,e){this._groups=t,this._parents=e}function Yr(){return new Xr([[document.documentElement]],Wr)}function Zr(t){return"string"==typeof t?new Xr([[document.querySelector(t)]],[document.documentElement]):new Xr([[t]],Wr)}function Gr(t,e){if(t=function(t){let e;for(;e=t.sourceEvent;)t=e;return t}(t),void 0===e&&(e=t.currentTarget),e){var r=e.ownerSVGElement||e;if(r.createSVGPoint){var n=r.createSVGPoint();return n.x=t.clientX,n.y=t.clientY,[(n=n.matrixTransform(e.getScreenCTM().inverse())).x,n.y]}if(e.getBoundingClientRect){var i=e.getBoundingClientRect();return[t.clientX-i.left-e.clientLeft,t.clientY-i.top-e.clientTop]}}return[t.pageX,t.pageY]}Xr.prototype=Yr.prototype={constructor:Xr,select:function(t){"function"!=typeof t&&(t=Be(t));for(var e=this._groups,r=e.length,n=new Array(r),i=0;i<r;++i)for(var s,a,o=e[i],l=o.length,c=n[i]=new Array(l),h=0;h<l;++h)(s=o[h])&&(a=t.call(s,s.__data__,h,o))&&("__data__"in s&&(a.__data__=s.__data__),c[h]=a);return new Xr(n,this._parents)},selectAll:function(t){t="function"==typeof t?Xe(t):We(t);for(var e=this._groups,r=e.length,n=[],i=[],s=0;s<r;++s)for(var a,o=e[s],l=o.length,c=0;c<l;++c)(a=o[c])&&(n.push(t.call(a,a.__data__,c,o)),i.push(a));return new Xr(n,i)},selectChild:function(t){return this.select(null==t?Je:function(t){return function(){return Ge.call(this.children,t)}}("function"==typeof t?t:Ze(t)))},selectChildren:function(t){return this.selectAll(null==t?tr:function(t){return function(){return Qe.call(this.children,t)}}("function"==typeof t?t:Ze(t)))},filter:function(t){"function"!=typeof t&&(t=Ye(t));for(var e=this._groups,r=e.length,n=new Array(r),i=0;i<r;++i)for(var s,a=e[i],o=a.length,l=n[i]=[],c=0;c<o;++c)(s=a[c])&&t.call(s,s.__data__,c,a)&&l.push(s);return new Xr(n,this._parents)},data:function(t,e){if(!arguments.length)return Array.from(this,sr);var r=e?ir:nr,n=this._parents,i=this._groups;"function"!=typeof t&&(t=function(t){return function(){return t}}(t));for(var s=i.length,a=new Array(s),o=new Array(s),l=new Array(s),c=0;c<s;++c){var h=n[c],u=i[c],d=u.length,p=ar(t.call(h,h&&h.__data__,c,n)),f=p.length,m=o[c]=new Array(f),b=a[c]=new Array(f);r(h,u,m,b,l[c]=new Array(d),p,e);for(var v,g,y=0,w=0;y<f;++y)if(v=m[y]){for(y>=w&&(w=y+1);!(g=b[w])&&++w<f;);v._next=g||null}}return(a=new Xr(a,n))._enter=o,a._exit=l,a},enter:function(){return new Xr(this._enter||this._groups.map(er),this._parents)},exit:function(){return new Xr(this._exit||this._groups.map(er),this._parents)},join:function(t,e,r){var n=this.enter(),i=this,s=this.exit();return"function"==typeof t?(n=t(n))&&(n=n.selection()):n=n.append(t+""),null!=e&&(i=e(i))&&(i=i.selection()),null==r?s.remove():r(s),n&&i?n.merge(i).order():i},merge:function(t){for(var e=t.selection?t.selection():t,r=this._groups,n=e._groups,i=r.length,s=n.length,a=Math.min(i,s),o=new Array(i),l=0;l<a;++l)for(var c,h=r[l],u=n[l],d=h.length,p=o[l]=new Array(d),f=0;f<d;++f)(c=h[f]||u[f])&&(p[f]=c);for(;l<i;++l)o[l]=r[l];return new Xr(o,this._parents)},selection:function(){return this},order:function(){for(var t=this._groups,e=-1,r=t.length;++e<r;)for(var n,i=t[e],s=i.length-1,a=i[s];--s>=0;)(n=i[s])&&(a&&4^n.compareDocumentPosition(a)&&a.parentNode.insertBefore(n,a),a=n);return this},sort:function(t){function e(e,r){return e&&r?t(e.__data__,r.__data__):!e-!r}t||(t=or);for(var r=this._groups,n=r.length,i=new Array(n),s=0;s<n;++s){for(var a,o=r[s],l=o.length,c=i[s]=new Array(l),h=0;h<l;++h)(a=o[h])&&(c[h]=a);c.sort(e)}return new Xr(i,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var t=this._groups,e=0,r=t.length;e<r;++e)for(var n=t[e],i=0,s=n.length;i<s;++i){var a=n[i];if(a)return a}return null},size:function(){let t=0;for(const e of this)++t;return t},empty:function(){return!this.node()},each:function(t){for(var e=this._groups,r=0,n=e.length;r<n;++r)for(var i,s=e[r],a=0,o=s.length;a<o;++a)(i=s[a])&&t.call(i,i.__data__,a,s);return this},attr:function(t,e){var r=De(t);if(arguments.length<2){var n=this.node();return r.local?n.getAttributeNS(r.space,r.local):n.getAttribute(r)}return this.each((null==e?r.local?cr:lr:"function"==typeof e?r.local?pr:dr:r.local?ur:hr)(r,e))},style:function(t,e,r){return arguments.length>1?this.each((null==e?mr:"function"==typeof e?vr:br)(t,e,null==r?"":r)):gr(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?yr:"function"==typeof e?xr:wr)(t,e)):this.node()[t]},classed:function(t,e){var r=$r(t+"");if(arguments.length<2){for(var n=_r(this.node()),i=-1,s=r.length;++i<s;)if(!n.contains(r[i]))return!1;return!0}return this.each(("function"==typeof e?Tr:e?Er:Mr)(r,e))},text:function(t){return arguments.length?this.each(null==t?Cr:("function"==typeof t?Rr:Nr)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?qr:("function"==typeof t?zr:Pr)(t)):this.node().innerHTML},raise:function(){return this.each(Fr)},lower:function(){return this.each(Or)},append:function(t){var e="function"==typeof t?t:je(t);return this.select((function(){return this.appendChild(e.apply(this,arguments))}))},insert:function(t,e){var r="function"==typeof t?t:je(t),n=null==e?Hr:"function"==typeof e?e:Be(e);return this.select((function(){return this.insertBefore(r.apply(this,arguments),n.apply(this,arguments)||null)}))},remove:function(){return this.each(Ur)},clone:function(t){return this.select(t?Ir:Dr)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,e,r){var n,i,s=function(t){return t.trim().split(/^|\s+/).map((function(t){var e="",r=t.indexOf(".");return r>=0&&(e=t.slice(r+1),t=t.slice(0,r)),{type:t,name:e}}))}(t+""),a=s.length;if(!(arguments.length<2)){for(o=e?jr:Lr,n=0;n<a;++n)this.each(o(s[n],e,r));return this}var o=this.node().__on;if(o)for(var l,c=0,h=o.length;c<h;++c)for(n=0,l=o[c];n<a;++n)if((i=s[n]).type===l.type&&i.name===l.name)return l.value},dispatch:function(t,e){return this.each(("function"==typeof e?Kr:Br)(t,e))},[Symbol.iterator]:function*(){for(var t=this._groups,e=0,r=t.length;e<r;++e)for(var n,i=t[e],s=0,a=i.length;s<a;++s)(n=i[s])&&(yield n)}};const Jr={passive:!1},Qr={capture:!0,passive:!1};function tn(t){t.stopImmediatePropagation()}function en(t){t.preventDefault(),t.stopImmediatePropagation()}var rn=t=>()=>t;function nn(t,{sourceEvent:e,subject:r,target:n,identifier:i,active:s,x:a,y:o,dx:l,dy:c,dispatch:h}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:r,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:o,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:h}})}function sn(t){return!t.ctrlKey&&!t.button}function an(){return this.parentNode}function on(t,e){return null==e?{x:t.x,y:t.y}:e}function ln(){return navigator.maxTouchPoints||"ontouchstart"in this}function cn(){var t,e,r,n,i=sn,s=an,a=on,o=ln,l={},c=Pe("start","drag","end"),h=0,u=0;function d(t){t.on("mousedown.drag",p).filter(o).on("touchstart.drag",b).on("touchmove.drag",v,Jr).on("touchend.drag touchcancel.drag",g).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(a,o){if(!n&&i.call(this,a,o)){var l=y(this,s.call(this,a,o),a,o,"mouse");l&&(Zr(a.view).on("mousemove.drag",f,Qr).on("mouseup.drag",m,Qr),function(t){var e=t.document.documentElement,r=Zr(t).on("dragstart.drag",en,Qr);"onselectstart"in e?r.on("selectstart.drag",en,Qr):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}(a.view),tn(a),r=!1,t=a.clientX,e=a.clientY,l("start",a))}}function f(n){if(en(n),!r){var i=n.clientX-t,s=n.clientY-e;r=i*i+s*s>u}l.mouse("drag",n)}function m(t){Zr(t.view).on("mousemove.drag mouseup.drag",null),function(t,e){var r=t.document.documentElement,n=Zr(t).on("dragstart.drag",null);e&&(n.on("click.drag",en,Qr),setTimeout((function(){n.on("click.drag",null)}),0)),"onselectstart"in r?n.on("selectstart.drag",null):(r.style.MozUserSelect=r.__noselect,delete r.__noselect)}(t.view,r),en(t),l.mouse("end",t)}function b(t,e){if(i.call(this,t,e)){var r,n,a=t.changedTouches,o=s.call(this,t,e),l=a.length;for(r=0;r<l;++r)(n=y(this,o,t,e,a[r].identifier,a[r]))&&(tn(t),n("start",t,a[r]))}}function v(t){var e,r,n=t.changedTouches,i=n.length;for(e=0;e<i;++e)(r=l[n[e].identifier])&&(en(t),r("drag",t,n[e]))}function g(t){var e,r,i=t.changedTouches,s=i.length;for(n&&clearTimeout(n),n=setTimeout((function(){n=null}),500),e=0;e<s;++e)(r=l[i[e].identifier])&&(tn(t),r("end",t,i[e]))}function y(t,e,r,n,i,s){var o,u,p,f=c.copy(),m=Gr(s||r,e);if(null!=(p=a.call(t,new nn("beforestart",{sourceEvent:r,target:d,identifier:i,active:h,x:m[0],y:m[1],dx:0,dy:0,dispatch:f}),n)))return o=p.x-m[0]||0,u=p.y-m[1]||0,function r(s,a,c){var b,v=m;switch(s){case"start":l[i]=r,b=h++;break;case"end":delete l[i],--h;case"drag":m=Gr(c||a,e),b=h}f.call(s,t,new nn(s,{sourceEvent:a,subject:p,target:d,identifier:i,active:b,x:m[0]+o,y:m[1]+u,dx:m[0]-v[0],dy:m[1]-v[1],dispatch:f}),n)}}return d.filter=function(t){return arguments.length?(i="function"==typeof t?t:rn(!!t),d):i},d.container=function(t){return arguments.length?(s="function"==typeof t?t:rn(t),d):s},d.subject=function(t){return arguments.length?(a="function"==typeof t?t:rn(t),d):a},d.touchable=function(t){return arguments.length?(o="function"==typeof t?t:rn(!!t),d):o},d.on=function(){var t=c.on.apply(c,arguments);return t===c?d:t},d.clickDistance=function(t){return arguments.length?(u=(t=+t)*t,d):Math.sqrt(u)},d}function hn(t,e,r){t.prototype=e.prototype=r,r.constructor=t}function un(t,e){var r=Object.create(t.prototype);for(var n in e)r[n]=e[n];return r}function dn(){}nn.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};var pn=.7,fn=1/pn,mn="\\s*([+-]?\\d+)\\s*",bn="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",vn="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",gn=/^#([0-9a-f]{3,8})$/,yn=new RegExp("^rgb\\("+[mn,mn,mn]+"\\)$"),wn=new RegExp("^rgb\\("+[vn,vn,vn]+"\\)$"),xn=new RegExp("^rgba\\("+[mn,mn,mn,bn]+"\\)$"),$n=new RegExp("^rgba\\("+[vn,vn,vn,bn]+"\\)$"),_n=new RegExp("^hsl\\("+[bn,vn,vn]+"\\)$"),kn=new RegExp("^hsla\\("+[bn,vn,vn,bn]+"\\)$"),Sn={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 An(){return this.rgb().formatHex()}function En(){return this.rgb().formatRgb()}function Mn(t){var e,r;return t=(t+"").trim().toLowerCase(),(e=gn.exec(t))?(r=e[1].length,e=parseInt(e[1],16),6===r?Tn(e):3===r?new Rn(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===r?Cn(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===r?Cn(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=yn.exec(t))?new Rn(e[1],e[2],e[3],1):(e=wn.exec(t))?new Rn(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=xn.exec(t))?Cn(e[1],e[2],e[3],e[4]):(e=$n.exec(t))?Cn(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=_n.exec(t))?Fn(e[1],e[2]/100,e[3]/100,1):(e=kn.exec(t))?Fn(e[1],e[2]/100,e[3]/100,e[4]):Sn.hasOwnProperty(t)?Tn(Sn[t]):"transparent"===t?new Rn(NaN,NaN,NaN,0):null}function Tn(t){return new Rn(t>>16&255,t>>8&255,255&t,1)}function Cn(t,e,r,n){return n<=0&&(t=e=r=NaN),new Rn(t,e,r,n)}function Nn(t,e,r,n){return 1===arguments.length?function(t){return t instanceof dn||(t=Mn(t)),t?new Rn((t=t.rgb()).r,t.g,t.b,t.opacity):new Rn}(t):new Rn(t,e,r,null==n?1:n)}function Rn(t,e,r,n){this.r=+t,this.g=+e,this.b=+r,this.opacity=+n}function qn(){return"#"+zn(this.r)+zn(this.g)+zn(this.b)}function Pn(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}function zn(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Fn(t,e,r,n){return n<=0?t=e=r=NaN:r<=0||r>=1?t=e=NaN:e<=0&&(t=NaN),new Hn(t,e,r,n)}function On(t){if(t instanceof Hn)return new Hn(t.h,t.s,t.l,t.opacity);if(t instanceof dn||(t=Mn(t)),!t)return new Hn;if(t instanceof Hn)return t;var e=(t=t.rgb()).r/255,r=t.g/255,n=t.b/255,i=Math.min(e,r,n),s=Math.max(e,r,n),a=NaN,o=s-i,l=(s+i)/2;return o?(a=e===s?(r-n)/o+6*(r<n):r===s?(n-e)/o+2:(e-r)/o+4,o/=l<.5?s+i:2-s-i,a*=60):o=l>0&&l<1?0:a,new Hn(a,o,l,t.opacity)}function Hn(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}function Un(t,e,r){return 255*(t<60?e+(r-e)*t/60:t<180?r:t<240?e+(r-e)*(240-t)/60:e)}hn(dn,Mn,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:An,formatHex:An,formatHsl:function(){return On(this).formatHsl()},formatRgb:En,toString:En}),hn(Rn,Nn,un(dn,{brighter:function(t){return t=null==t?fn:Math.pow(fn,t),new Rn(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?pn:Math.pow(pn,t),new Rn(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){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:qn,formatHex:qn,formatRgb:Pn,toString:Pn})),hn(Hn,(function(t,e,r,n){return 1===arguments.length?On(t):new Hn(t,e,r,null==n?1:n)}),un(dn,{brighter:function(t){return t=null==t?fn:Math.pow(fn,t),new Hn(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?pn:Math.pow(pn,t),new Hn(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*e,i=2*r-n;return new Rn(Un(t>=240?t-240:t+120,i,n),Un(t,i,n),Un(t<120?t+240:t-120,i,n),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===t?")":", "+t+")")}}));var Dn=t=>()=>t;function In(t){return 1==(t=+t)?Ln:function(e,r){return r-e?function(t,e,r){return t=Math.pow(t,r),e=Math.pow(e,r)-t,r=1/r,function(n){return Math.pow(t+n*e,r)}}(e,r,t):Dn(isNaN(e)?r:e)}}function Ln(t,e){var r=e-t;return r?function(t,e){return function(r){return t+r*e}}(t,r):Dn(isNaN(t)?e:t)}var jn=function t(e){var r=In(e);function n(t,e){var n=r((t=Nn(t)).r,(e=Nn(e)).r),i=r(t.g,e.g),s=r(t.b,e.b),a=Ln(t.opacity,e.opacity);return function(e){return t.r=n(e),t.g=i(e),t.b=s(e),t.opacity=a(e),t+""}}return n.gamma=t,n}(1);function Vn(t,e){e||(e=[]);var r,n=t?Math.min(e.length,t.length):0,i=e.slice();return function(s){for(r=0;r<n;++r)i[r]=t[r]*(1-s)+e[r]*s;return i}}function Bn(t,e){var r,n=e?e.length:0,i=t?Math.min(n,t.length):0,s=new Array(i),a=new Array(n);for(r=0;r<i;++r)s[r]=Jn(t[r],e[r]);for(;r<n;++r)a[r]=e[r];return function(t){for(r=0;r<i;++r)a[r]=s[r](t);return a}}function Kn(t,e){var r=new Date;return t=+t,e=+e,function(n){return r.setTime(t*(1-n)+e*n),r}}function Wn(t,e){return t=+t,e=+e,function(r){return t*(1-r)+e*r}}function Xn(t,e){var r,n={},i={};for(r in null!==t&&"object"==typeof t||(t={}),null!==e&&"object"==typeof e||(e={}),e)r in t?n[r]=Jn(t[r],e[r]):i[r]=e[r];return function(t){for(r in n)i[r]=n[r](t);return i}}var Yn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Zn=new RegExp(Yn.source,"g");function Gn(t,e){var r,n,i,s=Yn.lastIndex=Zn.lastIndex=0,a=-1,o=[],l=[];for(t+="",e+="";(r=Yn.exec(t))&&(n=Zn.exec(e));)(i=n.index)>s&&(i=e.slice(s,i),o[a]?o[a]+=i:o[++a]=i),(r=r[0])===(n=n[0])?o[a]?o[a]+=n:o[++a]=n:(o[++a]=null,l.push({i:a,x:Wn(r,n)})),s=Zn.lastIndex;return s<e.length&&(i=e.slice(s),o[a]?o[a]+=i:o[++a]=i),o.length<2?l[0]?function(t){return function(e){return t(e)+""}}(l[0].x):function(t){return function(){return t}}(e):(e=l.length,function(t){for(var r,n=0;n<e;++n)o[(r=l[n]).i]=r.x(t);return o.join("")})}function Jn(t,e){var r,n=typeof e;return null==e||"boolean"===n?Dn(e):("number"===n?Wn:"string"===n?(r=Mn(e))?(e=r,jn):Gn:e instanceof Mn?jn:e instanceof Date?Kn:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}(e)?Vn:Array.isArray(e)?Bn:"function"!=typeof e.valueOf&&"function"!=typeof e.toString||isNaN(e)?Xn:Wn)(t,e)}function Qn(t,e){return t=+t,e=+e,function(r){return Math.round(t*(1-r)+e*r)}}var ti,ei=180/Math.PI,ri={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function ni(t,e,r,n,i,s){var a,o,l;return(a=Math.sqrt(t*t+e*e))&&(t/=a,e/=a),(l=t*r+e*n)&&(r-=t*l,n-=e*l),(o=Math.sqrt(r*r+n*n))&&(r/=o,n/=o,l/=o),t*n<e*r&&(t=-t,e=-e,l=-l,a=-a),{translateX:i,translateY:s,rotate:Math.atan2(e,t)*ei,skewX:Math.atan(l)*ei,scaleX:a,scaleY:o}}function ii(t,e,r,n){function i(t){return t.length?t.pop()+" ":""}return function(s,a){var o=[],l=[];return s=t(s),a=t(a),function(t,n,i,s,a,o){if(t!==i||n!==s){var l=a.push("translate(",null,e,null,r);o.push({i:l-4,x:Wn(t,i)},{i:l-2,x:Wn(n,s)})}else(i||s)&&a.push("translate("+i+e+s+r)}(s.translateX,s.translateY,a.translateX,a.translateY,o,l),function(t,e,r,s){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),s.push({i:r.push(i(r)+"rotate(",null,n)-2,x:Wn(t,e)})):e&&r.push(i(r)+"rotate("+e+n)}(s.rotate,a.rotate,o,l),function(t,e,r,s){t!==e?s.push({i:r.push(i(r)+"skewX(",null,n)-2,x:Wn(t,e)}):e&&r.push(i(r)+"skewX("+e+n)}(s.skewX,a.skewX,o,l),function(t,e,r,n,s,a){if(t!==r||e!==n){var o=s.push(i(s)+"scale(",null,",",null,")");a.push({i:o-4,x:Wn(t,r)},{i:o-2,x:Wn(e,n)})}else 1===r&&1===n||s.push(i(s)+"scale("+r+","+n+")")}(s.scaleX,s.scaleY,a.scaleX,a.scaleY,o,l),s=a=null,function(t){for(var e,r=-1,n=l.length;++r<n;)o[(e=l[r]).i]=e.x(t);return o.join("")}}}var si,ai,oi=ii((function(t){const e=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?ri:ni(e.a,e.b,e.c,e.d,e.e,e.f)}),"px, ","px)","deg)"),li=ii((function(t){return null==t?ri:(ti||(ti=document.createElementNS("http://www.w3.org/2000/svg","g")),ti.setAttribute("transform",t),(t=ti.transform.baseVal.consolidate())?ni((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):ri)}),", ",")",")"),ci=0,hi=0,ui=0,di=1e3,pi=0,fi=0,mi=0,bi="object"==typeof performance&&performance.now?performance:Date,vi="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function gi(){return fi||(vi(yi),fi=bi.now()+mi)}function yi(){fi=0}function wi(){this._call=this._time=this._next=null}function xi(t,e,r){var n=new wi;return n.restart(t,e,r),n}function $i(){fi=(pi=bi.now())+mi,ci=hi=0;try{!function(){gi(),++ci;for(var t,e=si;e;)(t=fi-e._time)>=0&&e._call.call(void 0,t),e=e._next;--ci}()}finally{ci=0,function(){var t,e,r=si,n=1/0;for(;r;)r._call?(n>r._time&&(n=r._time),t=r,r=r._next):(e=r._next,r._next=null,r=t?t._next=e:si=e);ai=t,ki(n)}(),fi=0}}function _i(){var t=bi.now(),e=t-pi;e>di&&(mi-=e,pi=t)}function ki(t){ci||(hi&&(hi=clearTimeout(hi)),t-fi>24?(t<1/0&&(hi=setTimeout($i,t-bi.now()-mi)),ui&&(ui=clearInterval(ui))):(ui||(pi=bi.now(),ui=setInterval(_i,di)),ci=1,vi($i)))}function Si(t,e,r){var n=new wi;return e=null==e?0:+e,n.restart((r=>{n.stop(),t(r+e)}),e,r),n}wi.prototype=xi.prototype={constructor:wi,restart:function(t,e,r){if("function"!=typeof t)throw new TypeError("callback is not a function");r=(null==r?gi():+r)+(null==e?0:+e),this._next||ai===this||(ai?ai._next=this:si=this,ai=this),this._call=t,this._time=r,ki()},stop:function(){this._call&&(this._call=null,this._time=1/0,ki())}};var Ai=Pe("start","end","cancel","interrupt"),Ei=[],Mi=0,Ti=1,Ci=2,Ni=3,Ri=4,qi=5,Pi=6;function zi(t,e,r,n,i,s){var a=t.__transition;if(a){if(r in a)return}else t.__transition={};!function(t,e,r){var n,i=t.__transition;function s(t){r.state=Ti,r.timer.restart(a,r.delay,r.time),r.delay<=t&&a(t-r.delay)}function a(s){var c,h,u,d;if(r.state!==Ti)return l();for(c in i)if((d=i[c]).name===r.name){if(d.state===Ni)return Si(a);d.state===Ri?(d.state=Pi,d.timer.stop(),d.on.call("interrupt",t,t.__data__,d.index,d.group),delete i[c]):+c<e&&(d.state=Pi,d.timer.stop(),d.on.call("cancel",t,t.__data__,d.index,d.group),delete i[c])}if(Si((function(){r.state===Ni&&(r.state=Ri,r.timer.restart(o,r.delay,r.time),o(s))})),r.state=Ci,r.on.call("start",t,t.__data__,r.index,r.group),r.state===Ci){for(r.state=Ni,n=new Array(u=r.tween.length),c=0,h=-1;c<u;++c)(d=r.tween[c].value.call(t,t.__data__,r.index,r.group))&&(n[++h]=d);n.length=h+1}}function o(e){for(var i=e<r.duration?r.ease.call(null,e/r.duration):(r.timer.restart(l),r.state=qi,1),s=-1,a=n.length;++s<a;)n[s].call(t,i);r.state===qi&&(r.on.call("end",t,t.__data__,r.index,r.group),l())}function l(){for(var n in r.state=Pi,r.timer.stop(),delete i[e],i)return;delete t.__transition}i[e]=r,r.timer=xi(s,0,r.time)}(t,r,{name:e,index:n,group:i,on:Ai,tween:Ei,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:Mi})}function Fi(t,e){var r=Hi(t,e);if(r.state>Mi)throw new Error("too late; already scheduled");return r}function Oi(t,e){var r=Hi(t,e);if(r.state>Ni)throw new Error("too late; already running");return r}function Hi(t,e){var r=t.__transition;if(!r||!(r=r[e]))throw new Error("transition not found");return r}function Ui(t,e){var r,n;return function(){var i=Oi(this,t),s=i.tween;if(s!==r)for(var a=0,o=(n=r=s).length;a<o;++a)if(n[a].name===e){(n=n.slice()).splice(a,1);break}i.tween=n}}function Di(t,e,r){var n,i;if("function"!=typeof r)throw new Error;return function(){var s=Oi(this,t),a=s.tween;if(a!==n){i=(n=a).slice();for(var o={name:e,value:r},l=0,c=i.length;l<c;++l)if(i[l].name===e){i[l]=o;break}l===c&&i.push(o)}s.tween=i}}function Ii(t,e,r){var n=t._id;return t.each((function(){var t=Oi(this,n);(t.value||(t.value={}))[e]=r.apply(this,arguments)})),function(t){return Hi(t,n).value[e]}}function Li(t,e){var r;return("number"==typeof e?Wn:e instanceof Mn?jn:(r=Mn(e))?(e=r,jn):Gn)(t,e)}function ji(t){return function(){this.removeAttribute(t)}}function Vi(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Bi(t,e,r){var n,i,s=r+"";return function(){var a=this.getAttribute(t);return a===s?null:a===n?i:i=e(n=a,r)}}function Ki(t,e,r){var n,i,s=r+"";return function(){var a=this.getAttributeNS(t.space,t.local);return a===s?null:a===n?i:i=e(n=a,r)}}function Wi(t,e,r){var n,i,s;return function(){var a,o,l=r(this);if(null!=l)return(a=this.getAttribute(t))===(o=l+"")?null:a===n&&o===i?s:(i=o,s=e(n=a,l));this.removeAttribute(t)}}function Xi(t,e,r){var n,i,s;return function(){var a,o,l=r(this);if(null!=l)return(a=this.getAttributeNS(t.space,t.local))===(o=l+"")?null:a===n&&o===i?s:(i=o,s=e(n=a,l));this.removeAttributeNS(t.space,t.local)}}function Yi(t,e){var r,n;function i(){var i=e.apply(this,arguments);return i!==n&&(r=(n=i)&&function(t,e){return function(r){this.setAttributeNS(t.space,t.local,e.call(this,r))}}(t,i)),r}return i._value=e,i}function Zi(t,e){var r,n;function i(){var i=e.apply(this,arguments);return i!==n&&(r=(n=i)&&function(t,e){return function(r){this.setAttribute(t,e.call(this,r))}}(t,i)),r}return i._value=e,i}function Gi(t,e){return function(){Fi(this,t).delay=+e.apply(this,arguments)}}function Ji(t,e){return e=+e,function(){Fi(this,t).delay=e}}function Qi(t,e){return function(){Oi(this,t).duration=+e.apply(this,arguments)}}function ts(t,e){return e=+e,function(){Oi(this,t).duration=e}}var es=Yr.prototype.constructor;function rs(t){return function(){this.style.removeProperty(t)}}var ns=0;function is(t,e,r,n){this._groups=t,this._parents=e,this._name=r,this._id=n}function ss(){return++ns}var as=Yr.prototype;is.prototype={constructor:is,select:function(t){var e=this._name,r=this._id;"function"!=typeof t&&(t=Be(t));for(var n=this._groups,i=n.length,s=new Array(i),a=0;a<i;++a)for(var o,l,c=n[a],h=c.length,u=s[a]=new Array(h),d=0;d<h;++d)(o=c[d])&&(l=t.call(o,o.__data__,d,c))&&("__data__"in o&&(l.__data__=o.__data__),u[d]=l,zi(u[d],e,r,d,u,Hi(o,r)));return new is(s,this._parents,e,r)},selectAll:function(t){var e=this._name,r=this._id;"function"!=typeof t&&(t=We(t));for(var n=this._groups,i=n.length,s=[],a=[],o=0;o<i;++o)for(var l,c=n[o],h=c.length,u=0;u<h;++u)if(l=c[u]){for(var d,p=t.call(l,l.__data__,u,c),f=Hi(l,r),m=0,b=p.length;m<b;++m)(d=p[m])&&zi(d,e,r,m,p,f);s.push(p),a.push(l)}return new is(s,a,e,r)},selectChild:as.selectChild,selectChildren:as.selectChildren,filter:function(t){"function"!=typeof t&&(t=Ye(t));for(var e=this._groups,r=e.length,n=new Array(r),i=0;i<r;++i)for(var s,a=e[i],o=a.length,l=n[i]=[],c=0;c<o;++c)(s=a[c])&&t.call(s,s.__data__,c,a)&&l.push(s);return new is(n,this._parents,this._name,this._id)},merge:function(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,r=t._groups,n=e.length,i=r.length,s=Math.min(n,i),a=new Array(n),o=0;o<s;++o)for(var l,c=e[o],h=r[o],u=c.length,d=a[o]=new Array(u),p=0;p<u;++p)(l=c[p]||h[p])&&(d[p]=l);for(;o<n;++o)a[o]=e[o];return new is(a,this._parents,this._name,this._id)},selection:function(){return new es(this._groups,this._parents)},transition:function(){for(var t=this._name,e=this._id,r=ss(),n=this._groups,i=n.length,s=0;s<i;++s)for(var a,o=n[s],l=o.length,c=0;c<l;++c)if(a=o[c]){var h=Hi(a,e);zi(a,t,r,c,o,{time:h.time+h.delay+h.duration,delay:0,duration:h.duration,ease:h.ease})}return new is(n,this._parents,t,r)},call:as.call,nodes:as.nodes,node:as.node,size:as.size,empty:as.empty,each:as.each,on:function(t,e){var r=this._id;return arguments.length<2?Hi(this.node(),r).on.on(t):this.each(function(t,e,r){var n,i,s=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)?Fi:Oi;return function(){var a=s(this,t),o=a.on;o!==n&&(i=(n=o).copy()).on(e,r),a.on=i}}(r,t,e))},attr:function(t,e){var r=De(t),n="transform"===r?li:Li;return this.attrTween(t,"function"==typeof e?(r.local?Xi:Wi)(r,n,Ii(this,"attr."+t,e)):null==e?(r.local?Vi:ji)(r):(r.local?Ki:Bi)(r,n,e))},attrTween:function(t,e){var r="attr."+t;if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==e)return this.tween(r,null);if("function"!=typeof e)throw new Error;var n=De(t);return this.tween(r,(n.local?Yi:Zi)(n,e))},style:function(t,e,r){var n="transform"==(t+="")?oi:Li;return null==e?this.styleTween(t,function(t,e){var r,n,i;return function(){var s=gr(this,t),a=(this.style.removeProperty(t),gr(this,t));return s===a?null:s===r&&a===n?i:i=e(r=s,n=a)}}(t,n)).on("end.style."+t,rs(t)):"function"==typeof e?this.styleTween(t,function(t,e,r){var n,i,s;return function(){var a=gr(this,t),o=r(this),l=o+"";return null==o&&(this.style.removeProperty(t),l=o=gr(this,t)),a===l?null:a===n&&l===i?s:(i=l,s=e(n=a,o))}}(t,n,Ii(this,"style."+t,e))).each(function(t,e){var r,n,i,s,a="style."+e,o="end."+a;return function(){var l=Oi(this,t),c=l.on,h=null==l.value[a]?s||(s=rs(e)):void 0;c===r&&i===h||(n=(r=c).copy()).on(o,i=h),l.on=n}}(this._id,t)):this.styleTween(t,function(t,e,r){var n,i,s=r+"";return function(){var a=gr(this,t);return a===s?null:a===n?i:i=e(n=a,r)}}(t,n,e),r).on("end.style."+t,null)},styleTween:function(t,e,r){var n="style."+(t+="");if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==e)return this.tween(n,null);if("function"!=typeof e)throw new Error;return this.tween(n,function(t,e,r){var n,i;function s(){var s=e.apply(this,arguments);return s!==i&&(n=(i=s)&&function(t,e,r){return function(n){this.style.setProperty(t,e.call(this,n),r)}}(t,s,r)),n}return s._value=e,s}(t,e,null==r?"":r))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var e=t(this);this.textContent=null==e?"":e}}(Ii(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,r;function n(){var n=t.apply(this,arguments);return n!==r&&(e=(r=n)&&function(t){return function(e){this.textContent=t.call(this,e)}}(n)),e}return n._value=t,n}(t))},remove:function(){return this.on("end.remove",function(t){return function(){var e=this.parentNode;for(var r in this.__transition)if(+r!==t)return;e&&e.removeChild(this)}}(this._id))},tween:function(t,e){var r=this._id;if(t+="",arguments.length<2){for(var n,i=Hi(this.node(),r).tween,s=0,a=i.length;s<a;++s)if((n=i[s]).name===t)return n.value;return null}return this.each((null==e?Ui:Di)(r,t,e))},delay:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?Gi:Ji)(e,t)):Hi(this.node(),e).delay},duration:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?Qi:ts)(e,t)):Hi(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(){Oi(this,t).ease=e}}(e,t)):Hi(this.node(),e).ease},easeVarying:function(t){if("function"!=typeof t)throw new Error;return this.each(function(t,e){return function(){var r=e.apply(this,arguments);if("function"!=typeof r)throw new Error;Oi(this,t).ease=r}}(this._id,t))},end:function(){var t,e,r=this,n=r._id,i=r.size();return new Promise((function(s,a){var o={value:a},l={value:function(){0==--i&&s()}};r.each((function(){var r=Oi(this,n),i=r.on;i!==t&&((e=(t=i).copy())._.cancel.push(o),e._.interrupt.push(o),e._.end.push(l)),r.on=e})),0===i&&s()}))},[Symbol.iterator]:as[Symbol.iterator]};const os=t=>+t;function ls(t){return t*t*t}function cs(t){return--t*t*t+1}var hs={time:null,delay:0,duration:250,ease:function(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}};function us(t,e){for(var r;!(r=t.__transition)||!(r=r[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return r}Yr.prototype.interrupt=function(t){return this.each((function(){!function(t,e){var r,n,i,s=t.__transition,a=!0;if(s){for(i in e=null==e?null:e+"",s)(r=s[i]).name===e?(n=r.state>Ci&&r.state<qi,r.state=Pi,r.timer.stop(),r.on.call(n?"interrupt":"cancel",t,t.__data__,r.index,r.group),delete s[i]):a=!1;a&&delete t.__transition}}(this,t)}))},Yr.prototype.transition=function(t){var e,r;t instanceof is?(e=t._id,t=t._name):(e=ss(),(r=hs).time=gi(),t=null==t?null:t+"");for(var n=this._groups,i=n.length,s=0;s<i;++s)for(var a,o=n[s],l=o.length,c=0;c<l;++c)(a=o[c])&&zi(a,t,e,c,o,r||us(a,e));return new is(n,this._parents,t,e)};const ds=Math.PI,ps=2*ds,fs=1e-6,ms=ps-fs;function bs(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function vs(){return new bs}bs.prototype=vs.prototype={constructor:bs,moveTo:function(t,e){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,e){this._+="L"+(this._x1=+t)+","+(this._y1=+e)},quadraticCurveTo:function(t,e,r,n){this._+="Q"+ +t+","+ +e+","+(this._x1=+r)+","+(this._y1=+n)},bezierCurveTo:function(t,e,r,n,i,s){this._+="C"+ +t+","+ +e+","+ +r+","+ +n+","+(this._x1=+i)+","+(this._y1=+s)},arcTo:function(t,e,r,n,i){t=+t,e=+e,r=+r,n=+n,i=+i;var s=this._x1,a=this._y1,o=r-t,l=n-e,c=s-t,h=a-e,u=c*c+h*h;if(i<0)throw new Error("negative radius: "+i);if(null===this._x1)this._+="M"+(this._x1=t)+","+(this._y1=e);else if(u>fs)if(Math.abs(h*o-l*c)>fs&&i){var d=r-s,p=n-a,f=o*o+l*l,m=d*d+p*p,b=Math.sqrt(f),v=Math.sqrt(u),g=i*Math.tan((ds-Math.acos((f+u-m)/(2*b*v)))/2),y=g/v,w=g/b;Math.abs(y-1)>fs&&(this._+="L"+(t+y*c)+","+(e+y*h)),this._+="A"+i+","+i+",0,0,"+ +(h*d>c*p)+","+(this._x1=t+w*o)+","+(this._y1=e+w*l)}else this._+="L"+(this._x1=t)+","+(this._y1=e);else;},arc:function(t,e,r,n,i,s){t=+t,e=+e,s=!!s;var a=(r=+r)*Math.cos(n),o=r*Math.sin(n),l=t+a,c=e+o,h=1^s,u=s?n-i:i-n;if(r<0)throw new Error("negative radius: "+r);null===this._x1?this._+="M"+l+","+c:(Math.abs(this._x1-l)>fs||Math.abs(this._y1-c)>fs)&&(this._+="L"+l+","+c),r&&(u<0&&(u=u%ps+ps),u>ms?this._+="A"+r+","+r+",0,1,"+h+","+(t-a)+","+(e-o)+"A"+r+","+r+",0,1,"+h+","+(this._x1=l)+","+(this._y1=c):u>fs&&(this._+="A"+r+","+r+",0,"+ +(u>=ds)+","+h+","+(this._x1=t+r*Math.cos(i))+","+(this._y1=e+r*Math.sin(i))))},rect:function(t,e,r,n){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)+"h"+ +r+"v"+ +n+"h"+-r+"Z"},toString:function(){return this._}};var gs=Math.sqrt(50),ys=Math.sqrt(10),ws=Math.sqrt(2);function xs(t,e,r){var n,i,s,a,o=-1;if(r=+r,(t=+t)===(e=+e)&&r>0)return[t];if((n=e<t)&&(i=t,t=e,e=i),0===(a=function(t,e,r){var n=(e-t)/Math.max(0,r),i=Math.floor(Math.log(n)/Math.LN10),s=n/Math.pow(10,i);return i>=0?(s>=gs?10:s>=ys?5:s>=ws?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(s>=gs?10:s>=ys?5:s>=ws?2:1)}(t,e,r))||!isFinite(a))return[];if(a>0){let r=Math.round(t/a),n=Math.round(e/a);for(r*a<t&&++r,n*a>e&&--n,s=new Array(i=n-r+1);++o<i;)s[o]=(r+o)*a}else{a=-a;let r=Math.round(t*a),n=Math.round(e*a);for(r/a<t&&++r,n/a>e&&--n,s=new Array(i=n-r+1);++o<i;)s[o]=(r+o)/a}return n&&s.reverse(),s}function $s(t){return Math.ceil(Math.log(function(t,e){let r=0;if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&++r;else{let n=-1;for(let i of t)null!=(i=e(i,++n,t))&&(i=+i)>=i&&++r}return r}(t))/Math.LN2)+1}var _s=Array.prototype.slice;function ks(t,e){return t-e}var Ss=t=>()=>t;function As(t,e){for(var r,n=-1,i=e.length;++n<i;)if(r=Es(t,e[n]))return r;return 0}function Es(t,e){for(var r=e[0],n=e[1],i=-1,s=0,a=t.length,o=a-1;s<a;o=s++){var l=t[s],c=l[0],h=l[1],u=t[o],d=u[0],p=u[1];if(Ms(l,u,e))return 0;h>n!=p>n&&r<(d-c)*(n-h)/(p-h)+c&&(i=-i)}return i}function Ms(t,e,r){var n;return function(t,e,r){return(e[0]-t[0])*(r[1]-t[1])==(r[0]-t[0])*(e[1]-t[1])}(t,e,r)&&function(t,e,r){return t<=e&&e<=r||r<=e&&e<=t}(t[n=+(t[0]===e[0])],r[n],e[n])}function Ts(){}var Cs=[[],[[[1,1.5],[.5,1]]],[[[1.5,1],[1,1.5]]],[[[1.5,1],[.5,1]]],[[[1,.5],[1.5,1]]],[[[1,1.5],[.5,1]],[[1,.5],[1.5,1]]],[[[1,.5],[1,1.5]]],[[[1,.5],[.5,1]]],[[[.5,1],[1,.5]]],[[[1,1.5],[1,.5]]],[[[.5,1],[1,.5]],[[1.5,1],[1,1.5]]],[[[1.5,1],[1,.5]]],[[[.5,1],[1.5,1]]],[[[1,1.5],[1.5,1]]],[[[.5,1],[1,1.5]]],[]];function Ns(){var t=1,e=1,r=$s,n=o;function i(t){var e=r(t);if(Array.isArray(e))e=e.slice().sort(ks);else{const r=function(t,e){let r,n;if(void 0===e)for(const e of t)null!=e&&(void 0===r?e>=e&&(r=n=e):(r>e&&(r=e),n<e&&(n=e)));else{let i=-1;for(let s of t)null!=(s=e(s,++i,t))&&(void 0===r?s>=s&&(r=n=s):(r>s&&(r=s),n<s&&(n=s)))}return[r,n]}(t),n=function(t,e,r){var n=Math.abs(e-t)/Math.max(0,r),i=Math.pow(10,Math.floor(Math.log(n)/Math.LN10)),s=n/i;return s>=gs?i*=10:s>=ys?i*=5:s>=ws&&(i*=2),e<t?-i:i}(r[0],r[1],e);e=xs(Math.floor(r[0]/n)*n,Math.floor(r[1]/n-1)*n,e)}return e.map((e=>s(t,e)))}function s(r,i){var s=[],o=[];return function(r,n,i){var s,o,l,c,h,u,d=new Array,p=new Array;s=o=-1,c=r[0]>=n,Cs[c<<1].forEach(f);for(;++s<t-1;)l=c,c=r[s+1]>=n,Cs[l|c<<1].forEach(f);Cs[c<<0].forEach(f);for(;++o<e-1;){for(s=-1,c=r[o*t+t]>=n,h=r[o*t]>=n,Cs[c<<1|h<<2].forEach(f);++s<t-1;)l=c,c=r[o*t+t+s+1]>=n,u=h,h=r[o*t+s+1]>=n,Cs[l|c<<1|h<<2|u<<3].forEach(f);Cs[c|h<<3].forEach(f)}s=-1,h=r[o*t]>=n,Cs[h<<2].forEach(f);for(;++s<t-1;)u=h,h=r[o*t+s+1]>=n,Cs[h<<2|u<<3].forEach(f);function f(t){var e,r,n=[t[0][0]+s,t[0][1]+o],l=[t[1][0]+s,t[1][1]+o],c=a(n),h=a(l);(e=p[c])?(r=d[h])?(delete p[e.end],delete d[r.start],e===r?(e.ring.push(l),i(e.ring)):d[e.start]=p[r.end]={start:e.start,end:r.end,ring:e.ring.concat(r.ring)}):(delete p[e.end],e.ring.push(l),p[e.end=h]=e):(e=d[h])?(r=p[c])?(delete d[e.start],delete p[r.end],e===r?(e.ring.push(l),i(e.ring)):d[r.start]=p[e.end]={start:r.start,end:e.end,ring:r.ring.concat(e.ring)}):(delete d[e.start],e.ring.unshift(n),d[e.start=c]=e):d[c]=p[h]={start:c,end:h,ring:[n,l]}}Cs[h<<3].forEach(f)}(r,i,(function(t){n(t,r,i),function(t){for(var e=0,r=t.length,n=t[r-1][1]*t[0][0]-t[r-1][0]*t[0][1];++e<r;)n+=t[e-1][1]*t[e][0]-t[e-1][0]*t[e][1];return n}(t)>0?s.push([t]):o.push(t)})),o.forEach((function(t){for(var e,r=0,n=s.length;r<n;++r)if(-1!==As((e=s[r])[0],t))return void e.push(t)})),{type:"MultiPolygon",value:i,coordinates:s}}function a(e){return 2*e[0]+e[1]*(t+1)*4}function o(r,n,i){r.forEach((function(r){var s,a=r[0],o=r[1],l=0|a,c=0|o,h=n[c*t+l];a>0&&a<t&&l===a&&(s=n[c*t+l-1],r[0]=a+(i-s)/(h-s)-.5),o>0&&o<e&&c===o&&(s=n[(c-1)*t+l],r[1]=o+(i-s)/(h-s)-.5)}))}return i.contour=s,i.size=function(r){if(!arguments.length)return[t,e];var n=Math.floor(r[0]),s=Math.floor(r[1]);if(!(n>=0&&s>=0))throw new Error("invalid size");return t=n,e=s,i},i.thresholds=function(t){return arguments.length?(r="function"==typeof t?t:Array.isArray(t)?Ss(_s.call(t)):Ss(t),i):r},i.smooth=function(t){return arguments.length?(n=t?o:Ts,i):n===o},i}function Rs(t,e){if((r=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var r,n=t.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+t.slice(r+1)]}function qs(t){return(t=Rs(Math.abs(t)))?t[1]:NaN}var Ps,zs=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Fs(t){if(!(e=zs.exec(t)))throw new Error("invalid format: "+t);var e;return new Os({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 Os(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 Hs(t,e){var r=Rs(t,e);if(!r)return t+"";var n=r[0],i=r[1];return i<0?"0."+new Array(-i).join("0")+n:n.length>i+1?n.slice(0,i+1)+"."+n.slice(i+1):n+new Array(i-n.length+2).join("0")}Fs.prototype=Os.prototype,Os.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 Us={"%":(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)=>Hs(100*t,e),r:Hs,s:function(t,e){var r=Rs(t,e);if(!r)return t+"";var n=r[0],i=r[1],s=i-(Ps=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,a=n.length;return s===a?n:s>a?n+new Array(s-a+1).join("0"):s>0?n.slice(0,s)+"."+n.slice(s):"0."+new Array(1-s).join("0")+Rs(t,Math.max(0,e+s-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function Ds(t){return t}var Is,Ls,js,Vs=Array.prototype.map,Bs=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Ks(t){var e,r,n=void 0===t.grouping||void 0===t.thousands?Ds:(e=Vs.call(t.grouping,Number),r=t.thousands+"",function(t,n){for(var i=t.length,s=[],a=0,o=e[0],l=0;i>0&&o>0&&(l+o+1>n&&(o=Math.max(1,n-l)),s.push(t.substring(i-=o,i+o)),!((l+=o+1)>n));)o=e[a=(a+1)%e.length];return s.reverse().join(r)}),i=void 0===t.currency?"":t.currency[0]+"",s=void 0===t.currency?"":t.currency[1]+"",a=void 0===t.decimal?".":t.decimal+"",o=void 0===t.numerals?Ds:function(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}(Vs.call(t.numerals,String)),l=void 0===t.percent?"%":t.percent+"",c=void 0===t.minus?"−":t.minus+"",h=void 0===t.nan?"NaN":t.nan+"";function u(t){var e=(t=Fs(t)).fill,r=t.align,u=t.sign,d=t.symbol,p=t.zero,f=t.width,m=t.comma,b=t.precision,v=t.trim,g=t.type;"n"===g?(m=!0,g="g"):Us[g]||(void 0===b&&(b=12),v=!0,g="g"),(p||"0"===e&&"="===r)&&(p=!0,e="0",r="=");var y="$"===d?i:"#"===d&&/[boxX]/.test(g)?"0"+g.toLowerCase():"",w="$"===d?s:/[%p]/.test(g)?l:"",x=Us[g],$=/[defgprs%]/.test(g);function _(t){var i,s,l,d=y,_=w;if("c"===g)_=x(t)+_,t="";else{var k=(t=+t)<0||1/t<0;if(t=isNaN(t)?h:x(Math.abs(t),b),v&&(t=function(t){t:for(var e,r=t.length,n=1,i=-1;n<r;++n)switch(t[n]){case".":i=e=n;break;case"0":0===i&&(i=n),e=n;break;default:if(!+t[n])break t;i>0&&(i=0)}return i>0?t.slice(0,i)+t.slice(e+1):t}(t)),k&&0==+t&&"+"!==u&&(k=!1),d=(k?"("===u?u:c:"-"===u||"("===u?"":u)+d,_=("s"===g?Bs[8+Ps/3]:"")+_+(k&&"("===u?")":""),$)for(i=-1,s=t.length;++i<s;)if(48>(l=t.charCodeAt(i))||l>57){_=(46===l?a+t.slice(i+1):t.slice(i))+_,t=t.slice(0,i);break}}m&&!p&&(t=n(t,1/0));var S=d.length+t.length+_.length,A=S<f?new Array(f-S+1).join(e):"";switch(m&&p&&(t=n(A+t,A.length?f-_.length:1/0),A=""),r){case"<":t=d+t+_+A;break;case"=":t=d+A+t+_;break;case"^":t=A.slice(0,S=A.length>>1)+d+t+_+A.slice(S);break;default:t=A+d+t+_}return o(t)}return b=void 0===b?6:/[gprs]/.test(g)?Math.max(1,Math.min(21,b)):Math.max(0,Math.min(20,b)),_.toString=function(){return t+""},_}return{format:u,formatPrefix:function(t,e){var r=u(((t=Fs(t)).type="f",t)),n=3*Math.max(-8,Math.min(8,Math.floor(qs(e)/3))),i=Math.pow(10,-n),s=Bs[8+n/3];return function(t){return r(i*t)+s}}}}Is=Ks({thousands:",",grouping:[3],currency:["$",""]}),Ls=Is.format,js=Is.formatPrefix;var Ws=1e-6,Xs=Math.PI,Ys=2*Xs,Zs=180/Xs,Gs=Xs/180,Js=Math.abs,Qs=Math.cos,ta=Math.sin,ea=Math.sqrt;function ra(){}function na(t,e){t&&sa.hasOwnProperty(t.type)&&sa[t.type](t,e)}var ia={Feature:function(t,e){na(t.geometry,e)},FeatureCollection:function(t,e){for(var r=t.features,n=-1,i=r.length;++n<i;)na(r[n].geometry,e)}},sa={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates,e.point(t[0],t[1],t[2])},MultiPoint:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)t=r[n],e.point(t[0],t[1],t[2])},LineString:function(t,e){aa(t.coordinates,e,0)},MultiLineString:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)aa(r[n],e,0)},Polygon:function(t,e){oa(t.coordinates,e)},MultiPolygon:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)oa(r[n],e)},GeometryCollection:function(t,e){for(var r=t.geometries,n=-1,i=r.length;++n<i;)na(r[n],e)}};function aa(t,e,r){var n,i=-1,s=t.length-r;for(e.lineStart();++i<s;)n=t[i],e.point(n[0],n[1],n[2]);e.lineEnd()}function oa(t,e){var r=-1,n=t.length;for(e.polygonStart();++r<n;)aa(t[r],e,1);e.polygonEnd()}function la(t,e){t&&ia.hasOwnProperty(t.type)?ia[t.type](t,e):na(t,e)}function ca(t,e,r,n){this.x=t,this.z=e,this.o=r,this.e=n,this.v=!1,this.n=this.p=null}function ha(t,e,r,n,i){var s,a,o=[],l=[];if(t.forEach((function(t){if(!((e=t.length-1)<=0)){var e,r,n=t[0],a=t[e];if(function(t,e){return Js(t[0]-e[0])<Ws&&Js(t[1]-e[1])<Ws}(n,a)){if(!n[2]&&!a[2]){for(i.lineStart(),s=0;s<e;++s)i.point((n=t[s])[0],n[1]);return void i.lineEnd()}a[0]+=2*Ws}o.push(r=new ca(n,t,null,!0)),l.push(r.o=new ca(n,null,r,!1)),o.push(r=new ca(a,t,null,!1)),l.push(r.o=new ca(a,null,r,!0))}})),o.length){for(l.sort(e),ua(o),ua(l),s=0,a=l.length;s<a;++s)l[s].e=r=!r;for(var c,h,u=o[0];;){for(var d=u,p=!0;d.v;)if((d=d.n)===u)return;c=d.z,i.lineStart();do{if(d.v=d.o.v=!0,d.e){if(p)for(s=0,a=c.length;s<a;++s)i.point((h=c[s])[0],h[1]);else n(d.x,d.n.x,1,i);d=d.n}else{if(p)for(c=d.p.z,s=c.length-1;s>=0;--s)i.point((h=c[s])[0],h[1]);else n(d.x,d.p.x,-1,i);d=d.p}c=(d=d.o).z,p=!p}while(!d.v);i.lineEnd()}}}function ua(t){if(e=t.length){for(var e,r,n=0,i=t[0];++n<e;)i.n=r=t[n],r.p=i,i=r;i.n=r=t[0],r.p=i}}var da=1e9,pa=-da;function fa(t,e,r,n){function i(i,s){return t<=i&&i<=r&&e<=s&&s<=n}function s(i,s,o,c){var h=0,u=0;if(null==i||(h=a(i,o))!==(u=a(s,o))||l(i,s)<0^o>0)do{c.point(0===h||3===h?t:r,h>1?n:e)}while((h=(h+o+4)%4)!==u);else c.point(s[0],s[1])}function a(n,i){return Js(n[0]-t)<Ws?i>0?0:3:Js(n[0]-r)<Ws?i>0?2:1:Js(n[1]-e)<Ws?i>0?1:0:i>0?3:2}function o(t,e){return l(t.x,e.x)}function l(t,e){var r=a(t,1),n=a(e,1);return r!==n?r-n:0===r?e[1]-t[1]:1===r?t[0]-e[0]:2===r?t[1]-e[1]:e[0]-t[0]}return function(a){var l,c,h,u,d,p,f,m,b,v,g,y=a,w=function(){var t,e=[];return{point:function(e,r,n){t.push([e,r,n])},lineStart:function(){e.push(t=[])},lineEnd:ra,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var r=e;return e=[],t=null,r}}}(),x={point:$,lineStart:function(){x.point=_,c&&c.push(h=[]);v=!0,b=!1,f=m=NaN},lineEnd:function(){l&&(_(u,d),p&&b&&w.rejoin(),l.push(w.result()));x.point=$,b&&y.lineEnd()},polygonStart:function(){y=w,l=[],c=[],g=!0},polygonEnd:function(){var e=function(){for(var e=0,r=0,i=c.length;r<i;++r)for(var s,a,o=c[r],l=1,h=o.length,u=o[0],d=u[0],p=u[1];l<h;++l)s=d,a=p,d=(u=o[l])[0],p=u[1],a<=n?p>n&&(d-s)*(n-a)>(p-a)*(t-s)&&++e:p<=n&&(d-s)*(n-a)<(p-a)*(t-s)&&--e;return e}(),r=g&&e,i=(u=l,l=Array.from(function*(t){for(const e of t)yield*e}(u))).length;var u;(r||i)&&(a.polygonStart(),r&&(a.lineStart(),s(null,null,1,a),a.lineEnd()),i&&ha(l,o,e,s,a),a.polygonEnd());y=a,l=c=h=null}};function $(t,e){i(t,e)&&y.point(t,e)}function _(s,a){var o=i(s,a);if(c&&h.push([s,a]),v)u=s,d=a,p=o,v=!1,o&&(y.lineStart(),y.point(s,a));else if(o&&b)y.point(s,a);else{var l=[f=Math.max(pa,Math.min(da,f)),m=Math.max(pa,Math.min(da,m))],w=[s=Math.max(pa,Math.min(da,s)),a=Math.max(pa,Math.min(da,a))];!function(t,e,r,n,i,s){var a,o=t[0],l=t[1],c=0,h=1,u=e[0]-o,d=e[1]-l;if(a=r-o,u||!(a>0)){if(a/=u,u<0){if(a<c)return;a<h&&(h=a)}else if(u>0){if(a>h)return;a>c&&(c=a)}if(a=i-o,u||!(a<0)){if(a/=u,u<0){if(a>h)return;a>c&&(c=a)}else if(u>0){if(a<c)return;a<h&&(h=a)}if(a=n-l,d||!(a>0)){if(a/=d,d<0){if(a<c)return;a<h&&(h=a)}else if(d>0){if(a>h)return;a>c&&(c=a)}if(a=s-l,d||!(a<0)){if(a/=d,d<0){if(a>h)return;a>c&&(c=a)}else if(d>0){if(a<c)return;a<h&&(h=a)}return c>0&&(t[0]=o+c*u,t[1]=l+c*d),h<1&&(e[0]=o+h*u,e[1]=l+h*d),!0}}}}}(l,w,t,e,r,n)?o&&(y.lineStart(),y.point(s,a),g=!1):(b||(y.lineStart(),y.point(l[0],l[1])),y.point(w[0],w[1]),o||y.lineEnd(),g=!1)}f=s,m=a,b=o}return x}}var ma,ba,va,ga,ya=t=>t,wa=new oe,xa=new oe,$a={point:ra,lineStart:ra,lineEnd:ra,polygonStart:function(){$a.lineStart=_a,$a.lineEnd=Aa},polygonEnd:function(){$a.lineStart=$a.lineEnd=$a.point=ra,wa.add(Js(xa)),xa=new oe},result:function(){var t=wa/2;return wa=new oe,t}};function _a(){$a.point=ka}function ka(t,e){$a.point=Sa,ma=va=t,ba=ga=e}function Sa(t,e){xa.add(ga*t-va*e),va=t,ga=e}function Aa(){Sa(ma,ba)}var Ea=$a,Ma=1/0,Ta=Ma,Ca=-Ma,Na=Ca,Ra={point:function(t,e){t<Ma&&(Ma=t);t>Ca&&(Ca=t);e<Ta&&(Ta=e);e>Na&&(Na=e)},lineStart:ra,lineEnd:ra,polygonStart:ra,polygonEnd:ra,result:function(){var t=[[Ma,Ta],[Ca,Na]];return Ca=Na=-(Ta=Ma=1/0),t}};var qa,Pa,za,Fa,Oa=Ra,Ha=0,Ua=0,Da=0,Ia=0,La=0,ja=0,Va=0,Ba=0,Ka=0,Wa={point:Xa,lineStart:Ya,lineEnd:Ja,polygonStart:function(){Wa.lineStart=Qa,Wa.lineEnd=to},polygonEnd:function(){Wa.point=Xa,Wa.lineStart=Ya,Wa.lineEnd=Ja},result:function(){var t=Ka?[Va/Ka,Ba/Ka]:ja?[Ia/ja,La/ja]:Da?[Ha/Da,Ua/Da]:[NaN,NaN];return Ha=Ua=Da=Ia=La=ja=Va=Ba=Ka=0,t}};function Xa(t,e){Ha+=t,Ua+=e,++Da}function Ya(){Wa.point=Za}function Za(t,e){Wa.point=Ga,Xa(za=t,Fa=e)}function Ga(t,e){var r=t-za,n=e-Fa,i=ea(r*r+n*n);Ia+=i*(za+t)/2,La+=i*(Fa+e)/2,ja+=i,Xa(za=t,Fa=e)}function Ja(){Wa.point=Xa}function Qa(){Wa.point=eo}function to(){ro(qa,Pa)}function eo(t,e){Wa.point=ro,Xa(qa=za=t,Pa=Fa=e)}function ro(t,e){var r=t-za,n=e-Fa,i=ea(r*r+n*n);Ia+=i*(za+t)/2,La+=i*(Fa+e)/2,ja+=i,Va+=(i=Fa*t-za*e)*(za+t),Ba+=i*(Fa+e),Ka+=3*i,Xa(za=t,Fa=e)}var no=Wa;function io(t){this._context=t}io.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._context.moveTo(t,e),this._point=1;break;case 1:this._context.lineTo(t,e);break;default:this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,Ys)}},result:ra};var so,ao,oo,lo,co,ho=new oe,uo={point:ra,lineStart:function(){uo.point=po},lineEnd:function(){so&&fo(ao,oo),uo.point=ra},polygonStart:function(){so=!0},polygonEnd:function(){so=null},result:function(){var t=+ho;return ho=new oe,t}};function po(t,e){uo.point=fo,ao=lo=t,oo=co=e}function fo(t,e){lo-=t,co-=e,ho.add(ea(lo*lo+co*co)),lo=t,co=e}var mo=uo;function bo(){this._string=[]}function vo(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function go(t,e){var r,n,i=4.5;function s(t){return t&&("function"==typeof i&&n.pointRadius(+i.apply(this,arguments)),la(t,r(n))),n.result()}return s.area=function(t){return la(t,r(Ea)),Ea.result()},s.measure=function(t){return la(t,r(mo)),mo.result()},s.bounds=function(t){return la(t,r(Oa)),Oa.result()},s.centroid=function(t){return la(t,r(no)),no.result()},s.projection=function(e){return arguments.length?(r=null==e?(t=null,ya):(t=e).stream,s):t},s.context=function(t){return arguments.length?(n=null==t?(e=null,new bo):new io(e=t),"function"!=typeof i&&n.pointRadius(i),s):e},s.pointRadius=function(t){return arguments.length?(i="function"==typeof t?t:(n.pointRadius(+t),+t),s):i},s.projection(t).context(e)}function yo(){}function wo(t,e,r){var n=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=n&&t.clipExtent(null),la(r,t.stream(Oa)),e(Oa.result()),null!=n&&t.clipExtent(n),t}function xo(t,e,r){return wo(t,(function(r){var n=e[1][0]-e[0][0],i=e[1][1]-e[0][1],s=Math.min(n/(r[1][0]-r[0][0]),i/(r[1][1]-r[0][1])),a=+e[0][0]+(n-s*(r[1][0]+r[0][0]))/2,o=+e[0][1]+(i-s*(r[1][1]+r[0][1]))/2;t.scale(150*s).translate([a,o])}),r)}function $o(){var t,e,r,n,i,s,a,o,l=1,c=0,h=0,u=1,d=1,p=0,f=null,m=1,b=1,v=(o={point:function(t,e){var r=w([t,e]);this.stream.point(r[0],r[1])}},function(t){var e=new yo;for(var r in o)e[r]=o[r];return e.stream=t,e}),g=ya;function y(){return m=l*u,b=l*d,s=a=null,w}function w(r){var n=r[0]*m,i=r[1]*b;if(p){var s=i*t-n*e;n=n*t+i*e,i=s}return[n+c,i+h]}return w.invert=function(r){var n=r[0]-c,i=r[1]-h;if(p){var s=i*t+n*e;n=n*t-i*e,i=s}return[n/m,i/b]},w.stream=function(t){return s&&a===t?s:s=v(g(a=t))},w.postclip=function(t){return arguments.length?(g=t,f=r=n=i=null,y()):g},w.clipExtent=function(t){return arguments.length?(g=null==t?(f=r=n=i=null,ya):fa(f=+t[0][0],r=+t[0][1],n=+t[1][0],i=+t[1][1]),y()):null==f?null:[[f,r],[n,i]]},w.scale=function(t){return arguments.length?(l=+t,y()):l},w.translate=function(t){return arguments.length?(c=+t[0],h=+t[1],y()):[c,h]},w.angle=function(r){return arguments.length?(e=ta(p=r%360*Gs),t=Qs(p),y()):p*Zs},w.reflectX=function(t){return arguments.length?(u=t?-1:1,y()):u<0},w.reflectY=function(t){return arguments.length?(d=t?-1:1,y()):d<0},w.fitExtent=function(t,e){return xo(w,t,e)},w.fitSize=function(t,e){return function(t,e,r){return xo(t,[[0,0],e],r)}(w,t,e)},w.fitWidth=function(t,e){return function(t,e,r){return wo(t,(function(r){var n=+e,i=n/(r[1][0]-r[0][0]),s=(n-i*(r[1][0]+r[0][0]))/2,a=-i*r[0][1];t.scale(150*i).translate([s,a])}),r)}(w,t,e)},w.fitHeight=function(t,e){return function(t,e,r){return wo(t,(function(r){var n=+e,i=n/(r[1][1]-r[0][1]),s=-i*r[0][0],a=(n-i*(r[1][1]+r[0][1]))/2;t.scale(150*i).translate([s,a])}),r)}(w,t,e)},w}function _o(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}function ko(t){return+t}bo.prototype={_radius:4.5,_circle:vo(4.5),pointRadius:function(t){return(t=+t)!==this._radius&&(this._radius=t,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._string.push("Z"),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._string.push("M",t,",",e),this._point=1;break;case 1:this._string.push("L",t,",",e);break;default:null==this._circle&&(this._circle=vo(this._radius)),this._string.push("M",t,",",e,this._circle)}},result:function(){if(this._string.length){var t=this._string.join("");return this._string=[],t}return null}},yo.prototype={constructor:yo,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var So=[0,1];function Ao(t){return t}function Eo(t,e){return(e-=t=+t)?function(r){return(r-t)/e}:function(t){return function(){return t}}(isNaN(e)?NaN:.5)}function Mo(t,e,r){var n=t[0],i=t[1],s=e[0],a=e[1];return i<n?(n=Eo(i,n),s=r(a,s)):(n=Eo(n,i),s=r(s,a)),function(t){return s(n(t))}}function To(t,e,r){var n=Math.min(t.length,e.length)-1,i=new Array(n),s=new Array(n),a=-1;for(t[n]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++a<n;)i[a]=Eo(t[a],t[a+1]),s[a]=r(e[a],e[a+1]);return function(e){var r=se(t,e,1,n)-1;return s[r](i[r](e))}}function Co(){var t,e,r,n,i,s,a=So,o=So,l=Jn,c=Ao;function h(){var t=Math.min(a.length,o.length);return c!==Ao&&(c=function(t,e){var r;return t>e&&(r=t,t=e,e=r),function(r){return Math.max(t,Math.min(e,r))}}(a[0],a[t-1])),n=t>2?To:Mo,i=s=null,u}function u(e){return null==e||isNaN(e=+e)?r:(i||(i=n(a.map(t),o,l)))(t(c(e)))}return u.invert=function(r){return c(e((s||(s=n(o,a.map(t),Wn)))(r)))},u.domain=function(t){return arguments.length?(a=Array.from(t,ko),h()):a.slice()},u.range=function(t){return arguments.length?(o=Array.from(t),h()):o.slice()},u.rangeRound=function(t){return o=Array.from(t),l=Qn,h()},u.clamp=function(t){return arguments.length?(c=!!t||Ao,h()):c!==Ao},u.interpolate=function(t){return arguments.length?(l=t,h()):l},u.unknown=function(t){return arguments.length?(r=t,u):r},function(r,n){return t=r,e=n,h()}}function No(t,e,r,n){var i,s=function(t,e,r){var n=Math.abs(e-t)/Math.max(0,r),i=Math.pow(10,Math.floor(Math.log(n)/Math.LN10)),s=n/i;return s>=ue?i*=10:s>=de?i*=5:s>=pe&&(i*=2),e<t?-i:i}(t,e,r);switch((n=Fs(null==n?",f":n)).type){case"s":var a=Math.max(Math.abs(t),Math.abs(e));return null!=n.precision||isNaN(i=function(t,e){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(qs(e)/3)))-qs(Math.abs(t)))}(s,a))||(n.precision=i),js(n,a);case"":case"e":case"g":case"p":case"r":null!=n.precision||isNaN(i=function(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,qs(e)-qs(t))+1}(s,Math.max(Math.abs(t),Math.abs(e))))||(n.precision=i-("e"===n.type));break;case"f":case"%":null!=n.precision||isNaN(i=function(t){return Math.max(0,-qs(Math.abs(t)))}(s))||(n.precision=i-2*("%"===n.type))}return Ls(n)}function Ro(){var t=Co()(Ao,Ao);return t.copy=function(){return e=t,Ro().domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown());var e},_o.apply(t,arguments),function(t){var e=t.domain;return t.ticks=function(t){var r=e();return fe(r[0],r[r.length-1],null==t?10:t)},t.tickFormat=function(t,r){var n=e();return No(n[0],n[n.length-1],null==t?10:t,r)},t.nice=function(r){null==r&&(r=10);var n,i,s=e(),a=0,o=s.length-1,l=s[a],c=s[o],h=10;for(c<l&&(i=l,l=c,c=i,i=a,a=o,o=i);h-- >0;){if((i=me(l,c,r))===n)return s[a]=l,s[o]=c,e(s);if(i>0)l=Math.floor(l/i)*i,c=Math.ceil(c/i)*i;else{if(!(i<0))break;l=Math.ceil(l*i)/i,c=Math.floor(c*i)/i}n=i}return t},t}(t)}var qo=function(t){for(var e=t.length/6|0,r=new Array(e),n=0;n<e;)r[n]="#"+t.slice(6*n,6*++n);return r}("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999");function Po(t){return function(){return t}}function zo(t){this._context=t}function Fo(t){return new zo(t)}function Oo(t){return t[0]}function Ho(t){return t[1]}function Uo(t,e){var r=Po(!0),n=null,i=Fo,s=null;function a(a){var o,l,c,h=(a=function(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}(a)).length,u=!1;for(null==n&&(s=i(c=vs())),o=0;o<=h;++o)!(o<h&&r(l=a[o],o,a))===u&&((u=!u)?s.lineStart():s.lineEnd()),u&&s.point(+t(l,o,a),+e(l,o,a));if(c)return s=null,c+""||null}return t="function"==typeof t?t:void 0===t?Oo:Po(t),e="function"==typeof e?e:void 0===e?Ho:Po(e),a.x=function(e){return arguments.length?(t="function"==typeof e?e:Po(+e),a):t},a.y=function(t){return arguments.length?(e="function"==typeof t?t:Po(+t),a):e},a.defined=function(t){return arguments.length?(r="function"==typeof t?t:Po(!!t),a):r},a.curve=function(t){return arguments.length?(i=t,null!=n&&(s=i(n)),a):i},a.context=function(t){return arguments.length?(null==t?n=s=null:s=i(n=t),a):n},a}function Do(t,e,r){this.k=t,this.x=e,this.y=r}zo.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)}}},Do.prototype={constructor:Do,scale:function(t){return 1===t?this:new Do(this.k*t,this.x,this.y)},translate:function(t,e){return 0===t&0===e?this:new Do(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+")"}},Do.prototype;class Io extends te{getComputedStyleValue(t){return getComputedStyle(this).getPropertyValue(t).trim()}firstUpdated(t){super.firstUpdated(t),Zr(this.renderRoot.host).classed("keyboard",!0).on("mousemove.keyboard touchstart.keyboard",(t=>{Zr(t.currentTarget.renderRoot.host).classed("keyboard",!1).on("mousemove.keyboard touchstart.keyboard",null)})).on("keydown.keyboard",(t=>{Zr(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=jn(t,"#ffffff")(.75),e.light50=jn(t,"#ffffff")(.5),e.light25=jn(t,"#ffffff")(.25),e.grey=t,e.dark25=jn(t,"#000000")(.25),e.dark50=jn(t,"#000000")(.5),e.dark75=jn(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,r=!1){const n=this.shadows.opacityUmbra+this.shadows.opacityBoost,i=this.shadows.opacityPenumbra+this.shadows.opacityBoost,s=this.shadows.opacityAmbient+this.shadows.opacityBoost,a=r?`rgba(${this.shadows.inverseBaselineColorString}, ${n})`:`rgba(${this.shadows.baselineColorString}, ${n})`,o=r?`rgba(${this.shadows.inverseBaselineColorString}, ${i})`:`rgba(${this.shadows.baselineColorString}, ${i})`,l=r?`rgba(${this.shadows.inverseBaselineColorString}, ${s})`:`rgba(${this.shadows.baselineColorString}, ${s})`,c=this.shadows.mapUmbra[t],h=this.shadows.mapPenumbra[t],u=this.shadows.mapAmbient[t];return`${e?`${-c.y}px ${c.y/2}px ${c.b}px ${c.s}px`:`${c.y/2}px ${c.y}px ${c.b}px ${c.s}px`} ${a}, ${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`} ${o}, ${e?`${-u.y}px ${u.y/2}px ${u.b}px ${u.s}px`:`${u.y/2}px ${u.y}px ${u.b}px ${u.s}px`} ${l}`}static get svgFilters(){const t=Io.shadows,e=t.elevations.map((e=>zt`
|
|
41
41
|
<filter id=${`shadow-${e}`} x="-250%" y="-250%" width="600%" height="600%">
|
|
42
42
|
<feComponentTransfer in="SourceAlpha" result="solid">
|
|
43
43
|
<feFuncA type="table" tableValues="0 1 1"/>
|
|
@@ -45,9 +45,9 @@ var Vt,Kt;null==Bt||Bt(Pt,Ot),(null!==(ct=globalThis.litHtmlVersions)&&void 0!==
|
|
|
45
45
|
<feOffset in="solid" result="offU" dx=${t.mapUmbra[e].y/2} dy=${t.mapUmbra[e].y} />
|
|
46
46
|
<feOffset in="solid" result="offP" dx=${t.mapPenumbra[e].y/2} dy=${t.mapPenumbra[e].y} />
|
|
47
47
|
<feOffset in="solid" result="offA" dx=${t.mapAmbient[e].y/2} dy=${t.mapAmbient[e].y} />
|
|
48
|
-
${0===t.mapUmbra[e].s?
|
|
49
|
-
${0===t.mapPenumbra[e].s?
|
|
50
|
-
${0===t.mapAmbient[e].s?
|
|
48
|
+
${0===t.mapUmbra[e].s?zt``:zt`<feMorphology in="offU" result="spreadU" operator=${t.mapUmbra[e].s>0?"dilate":"erode"} radius=${Math.abs(t.mapUmbra[e].s)} />`}
|
|
49
|
+
${0===t.mapPenumbra[e].s?zt``:zt`<feMorphology in="offP" result="spreadP" operator=${t.mapPenumbra[e].s>0?"dilate":"erode"} radius=${Math.abs(t.mapPenumbra[e].s)} />`}
|
|
50
|
+
${0===t.mapAmbient[e].s?zt``:zt`<feMorphology in="offA" result="spreadA" operator=${t.mapAmbient[e].s>0?"dilate":"erode"} radius=${Math.abs(t.mapAmbient[e].s)} />`}
|
|
51
51
|
<feGaussianBlur in=${0===t.mapUmbra[e].s?"offU":"spreadU"} result="blurU" stdDeviation=${t.mapUmbra[e].b/2} />
|
|
52
52
|
<feGaussianBlur in=${0===t.mapPenumbra[e].s?"offP":"spreadP"} result="blurP" stdDeviation=${t.mapPenumbra[e].b/2} />
|
|
53
53
|
<feGaussianBlur in=${0===t.mapAmbient[e].s?"offA":"spreadA"} result="blurA" stdDeviation=${t.mapAmbient[e].b/2} />
|
|
@@ -67,30 +67,30 @@ var Vt,Kt;null==Bt||Bt(Pt,Ot),(null!==(ct=globalThis.litHtmlVersions)&&void 0!==
|
|
|
67
67
|
<feMergeNode in="finalA" />
|
|
68
68
|
<feMergeNode in="SourceGraphic" />
|
|
69
69
|
</feMerge>
|
|
70
|
-
</filter>`));return
|
|
70
|
+
</filter>`));return zt`
|
|
71
71
|
<svg class="defs">
|
|
72
72
|
<defs>
|
|
73
73
|
${e}
|
|
74
74
|
</defs>
|
|
75
75
|
</svg>
|
|
76
|
-
`}static get styles(){return
|
|
76
|
+
`}static get styles(){return nt`
|
|
77
77
|
:host {
|
|
78
|
-
---shadow-0: var(--shadow-0, ${
|
|
79
|
-
---shadow-2: var(--shadow-2, ${
|
|
80
|
-
---shadow-4: var(--shadow-4, ${
|
|
81
|
-
---shadow-8: var(--shadow-8, ${
|
|
82
|
-
|
|
83
|
-
---color-background: var(--color-background, ${
|
|
84
|
-
---color-border: var(--color-border, ${
|
|
85
|
-
---color-text: var(--color-text, ${
|
|
86
|
-
---color-text-inverse: var(--color-text-inverse, ${
|
|
87
|
-
---color-link: var(--color-link, ${
|
|
88
|
-
---color-element-background: var(--color-element-background, ${
|
|
89
|
-
---color-element-disabled: var(--color-element-disabled, ${
|
|
90
|
-
---color-element-enabled: var(--color-element-enabled, ${
|
|
91
|
-
---color-element-selected: var(--color-element-selected, ${
|
|
92
|
-
---color-element-border: var(--color-element-border, ${
|
|
93
|
-
---color-element-emphasis: var(--color-element-emphasis, ${
|
|
78
|
+
---shadow-0: var(--shadow-0, ${rt(this.cssBoxShadow(0))});
|
|
79
|
+
---shadow-2: var(--shadow-2, ${rt(this.cssBoxShadow(2))});
|
|
80
|
+
---shadow-4: var(--shadow-4, ${rt(this.cssBoxShadow(4))});
|
|
81
|
+
---shadow-8: var(--shadow-8, ${rt(this.cssBoxShadow(8))});
|
|
82
|
+
|
|
83
|
+
---color-background: var(--color-background, ${rt(this.greys.white)});
|
|
84
|
+
---color-border: var(--color-border, ${rt(this.greys.light75)});
|
|
85
|
+
---color-text: var(--color-text, ${rt(this.greys.dark75)});
|
|
86
|
+
---color-text-inverse: var(--color-text-inverse, ${rt(this.greys.white)});
|
|
87
|
+
---color-link: var(--color-link, ${rt(this.greys.dark25)});
|
|
88
|
+
---color-element-background: var(--color-element-background, ${rt(this.greys.light75)});
|
|
89
|
+
---color-element-disabled: var(--color-element-disabled, ${rt(this.greys.light50)});
|
|
90
|
+
---color-element-enabled: var(--color-element-enabled, ${rt(this.greys.dark25)});
|
|
91
|
+
---color-element-selected: var(--color-element-selected, ${rt(this.greys.grey)});
|
|
92
|
+
---color-element-border: var(--color-element-border, ${rt(this.greys.dark50)});
|
|
93
|
+
---color-element-emphasis: var(--color-element-emphasis, ${rt(this.greys.dark75)});
|
|
94
94
|
|
|
95
95
|
---font-family-base: var(--font-family-base, "Source Sans", sans-serif);
|
|
96
96
|
---font-family-math: var(--font-family-math, "Source Serif", serif);
|
|
@@ -130,7 +130,7 @@ var Vt,Kt;null==Bt||Bt(Pt,Ot),(null!==(ct=globalThis.litHtmlVersions)&&void 0!==
|
|
|
130
130
|
width: 0;
|
|
131
131
|
height: 0;
|
|
132
132
|
}
|
|
133
|
-
`}}customElements.define("decidables-button",class extends
|
|
133
|
+
`}}customElements.define("decidables-button",class extends Io{static get properties(){return{disabled:{attribute:"disabled",type:Boolean,reflect:!0}}}constructor(){super(),this.disabled=!1}static get styles(){return[super.styles,nt`
|
|
134
134
|
:host {
|
|
135
135
|
margin: 0.25rem;
|
|
136
136
|
}
|
|
@@ -183,7 +183,7 @@ var Vt,Kt;null==Bt||Bt(Pt,Ot),(null!==(ct=globalThis.litHtmlVersions)&&void 0!==
|
|
|
183
183
|
outline: none;
|
|
184
184
|
box-shadow: var(---shadow-8);
|
|
185
185
|
}
|
|
186
|
-
`]}render(){return
|
|
186
|
+
`]}render(){return Pt`
|
|
187
187
|
<button ?disabled=${this.disabled}>
|
|
188
188
|
<slot></slot>
|
|
189
189
|
</button>
|
|
@@ -193,11 +193,11 @@ var Vt,Kt;null==Bt||Bt(Pt,Ot),(null!==(ct=globalThis.litHtmlVersions)&&void 0!==
|
|
|
193
193
|
* Copyright 2018 Google LLC
|
|
194
194
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
195
195
|
*/
|
|
196
|
-
const
|
|
196
|
+
const Lo=t=>null!=t?t:O;customElements.define("decidables-slider",class extends Io{static get properties(){return{disabled:{attribute:"disabled",type:Boolean,reflect:!0},max:{attribute:"max",type:Number,reflect:!0},min:{attribute:"min",type:Number,reflect:!0},step:{attribute:"step",type:Number,reflect:!0},value:{attribute:"value",type:Number,reflect:!0}}}constructor(){super(),this.disabled=!1,this.max=void 0,this.min=void 0,this.step=void 0,this.value=void 0}changed(t){this.value=t.target.value,this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},bubbles:!0}))}inputted(t){this.value=t.target.value}static get styles(){return[super.styles,nt`
|
|
197
197
|
:host {
|
|
198
|
-
---shadow-2-rotate: var(--shadow-2-rotate, ${
|
|
199
|
-
---shadow-4-rotate: var(--shadow-4-rotate, ${
|
|
200
|
-
---shadow-8-rotate: var(--shadow-8-rotate, ${
|
|
198
|
+
---shadow-2-rotate: var(--shadow-2-rotate, ${rt(this.cssBoxShadow(2,!0,!1))});
|
|
199
|
+
---shadow-4-rotate: var(--shadow-4-rotate, ${rt(this.cssBoxShadow(4,!0,!1))});
|
|
200
|
+
---shadow-8-rotate: var(--shadow-8-rotate, ${rt(this.cssBoxShadow(8,!0,!1))});
|
|
201
201
|
|
|
202
202
|
display: flex;
|
|
203
203
|
|
|
@@ -443,15 +443,15 @@ const Ho=t=>null!=t?t:z;customElements.define("decidables-slider",class extends
|
|
|
443
443
|
:host(.keyboard) input[type=range]:enabled:focus:active::-ms-thumb {
|
|
444
444
|
box-shadow: var(---shadow-8-rotate);
|
|
445
445
|
}
|
|
446
|
-
`]}render(){return
|
|
446
|
+
`]}render(){return Pt`
|
|
447
447
|
<label for="slider">
|
|
448
448
|
<slot></slot>
|
|
449
449
|
</label>
|
|
450
450
|
<div class="range">
|
|
451
|
-
<input type="range" id="slider" min=${
|
|
451
|
+
<input type="range" id="slider" min=${Lo(this.min)} max=${Lo(this.max)} step=${Lo(this.step)} .value=${this.value} @change=${this.changed.bind(this)} @input=${this.inputted.bind(this)}>
|
|
452
452
|
</div>
|
|
453
|
-
<decidables-spinner min=${
|
|
454
|
-
`}});customElements.define("decidables-spinner",class extends
|
|
453
|
+
<decidables-spinner min=${Lo(this.min)} max=${Lo(this.max)} step=${Lo(this.step)} .value=${this.value} @input=${this.inputted.bind(this)}></decidables-spinner>
|
|
454
|
+
`}});customElements.define("decidables-spinner",class extends Io{static get properties(){return{disabled:{attribute:"disabled",type:Boolean,reflect:!0},max:{attribute:"max",type:Number,reflect:!0},min:{attribute:"min",type:Number,reflect:!0},step:{attribute:"step",type:Number,reflect:!0},value:{attribute:"value",type:Number,reflect:!0}}}constructor(){super(),this.disabled=!1,this.max=void 0,this.min=void 0,this.step=void 0,this.value=void 0}inputted(t){this.value=t.target.value}static get styles(){return[super.styles,nt`
|
|
455
455
|
:host {
|
|
456
456
|
---decidables-spinner-font-size: var(--decidables-spinner-font-size, 1.125rem);
|
|
457
457
|
---decidables-spinner-input-width: var(--decidables-spinner-input-width, 4rem);
|
|
@@ -530,12 +530,12 @@ const Ho=t=>null!=t?t:z;customElements.define("decidables-slider",class extends
|
|
|
530
530
|
margin: 0;
|
|
531
531
|
-webkit-appearance: none; /* stylelint-disable-line property-no-vendor-prefix */
|
|
532
532
|
}
|
|
533
|
-
`]}render(){return
|
|
533
|
+
`]}render(){return Pt`
|
|
534
534
|
<label>
|
|
535
535
|
<slot></slot>
|
|
536
|
-
<input ?disabled=${this.disabled} type="number" min=${
|
|
536
|
+
<input ?disabled=${this.disabled} type="number" min=${Lo(this.min)} max=${Lo(this.max)} step=${Lo(this.step)} .value=${this.value} @input=${this.inputted.bind(this)}>
|
|
537
537
|
</label>
|
|
538
|
-
`}});customElements.define("decidables-switch",class extends
|
|
538
|
+
`}});customElements.define("decidables-switch",class extends Io{static get properties(){return{checked:{attribute:"checked",type:Boolean,reflect:!0},disabled:{attribute:"disabled",type:Boolean,reflect:!0}}}constructor(){super(),this.checked=!1,this.disabled=!1}changed(t){this.checked=t.target.checked,this.dispatchEvent(new CustomEvent("change",{detail:{checked:this.checked},bubbles:!0}))}static get styles(){return[super.styles,nt`
|
|
539
539
|
:host {
|
|
540
540
|
display: flex;
|
|
541
541
|
|
|
@@ -654,7 +654,7 @@ const Ho=t=>null!=t?t:z;customElements.define("decidables-slider",class extends
|
|
|
654
654
|
:host(.keyboard) input[type=checkbox]:enabled:focus:active + label + label::after {
|
|
655
655
|
box-shadow: var(---shadow-8);
|
|
656
656
|
}
|
|
657
|
-
`]}render(){return
|
|
657
|
+
`]}render(){return Pt`
|
|
658
658
|
<input type="checkbox" id="switch" ?checked=${this.checked} ?disabled=${this.disabled} @change=${this.changed.bind(this)}>
|
|
659
659
|
<label for="switch">
|
|
660
660
|
<slot name="off-label"></slot>
|
|
@@ -662,7 +662,7 @@ const Ho=t=>null!=t?t:z;customElements.define("decidables-slider",class extends
|
|
|
662
662
|
<label for="switch">
|
|
663
663
|
<slot></slot>
|
|
664
664
|
</label>
|
|
665
|
-
`}});customElements.define("decidables-toggle",class extends
|
|
665
|
+
`}});customElements.define("decidables-toggle",class extends Io{static get properties(){return{disabled:{attribute:"disabled",type:Boolean,reflect:!0}}}constructor(){super(),this.disabled=!1}static get styles(){return[super.styles,nt`
|
|
666
666
|
fieldset {
|
|
667
667
|
display: flex;
|
|
668
668
|
|
|
@@ -679,12 +679,12 @@ const Ho=t=>null!=t?t:z;customElements.define("decidables-slider",class extends
|
|
|
679
679
|
legend {
|
|
680
680
|
text-align: center;
|
|
681
681
|
}
|
|
682
|
-
`]}render(){return
|
|
682
|
+
`]}render(){return Pt`
|
|
683
683
|
<fieldset ?disabled=${this.disabled}>
|
|
684
684
|
<legend><slot name="label"></slot></legend>
|
|
685
685
|
<slot></slot>
|
|
686
686
|
</fieldset>
|
|
687
|
-
`}});customElements.define("decidables-toggle-option",class extends
|
|
687
|
+
`}});customElements.define("decidables-toggle-option",class extends Io{static get properties(){return{checked:{attribute:"checked",type:Boolean,reflect:!0},disabled:{attribute:"disabled",type:Boolean,reflect:!0},name:{attribute:"name",type:String,reflect:!0},value:{attribute:"value",type:String,reflect:!0}}}constructor(){super(),this.checked=!1,this.disabled=!1,this.name=void 0,this.value=void 0}changed(t){this.checked=t.target.checked,this.dispatchEvent(new CustomEvent("change",{detail:{checked:this.checked,value:this.value},bubbles:!0}))}static get styles(){return[super.styles,nt`
|
|
688
688
|
:host {
|
|
689
689
|
display: flex;
|
|
690
690
|
}
|
|
@@ -777,62 +777,62 @@ const Ho=t=>null!=t?t:z;customElements.define("decidables-slider",class extends
|
|
|
777
777
|
outline: none;
|
|
778
778
|
box-shadow: var(---shadow-8);
|
|
779
779
|
}
|
|
780
|
-
`]}render(){return
|
|
780
|
+
`]}render(){return Pt`
|
|
781
781
|
<input type="radio" id="toggle-option" name=${this.name} value=${this.value} .checked=${this.checked} @change=${this.changed.bind(this)}>
|
|
782
782
|
<label for="toggle-option">
|
|
783
783
|
<slot></slot>
|
|
784
784
|
</label>
|
|
785
|
-
`}});const
|
|
785
|
+
`}});const jo={fromAttribute:t=>t.split(/\s+/).map((t=>Number.parseFloat(t))),toAttribute:t=>t.length?t.map((t=>t.toFixed(3))).join(" "):null},Vo={fromAttribute:t=>new Set(t.split(/\s+/)),toAttribute:t=>t.size?[...t].join(" "):null};class Bo extends Io{static get properties(){return{interactive:{attribute:"interactive",type:Boolean,reflect:!0}}}constructor(){super(),this.interactive=!1}static get colors(){return{h:qo[2],m:qo[4],fa:qo[1],cr:qo[0],hr:qo[5],far:qo[3],acc:qo[8],d:qo[7],c:qo[6],s:"#4545d0",present:"#f032e6",absent:"#10dbc9",correct:"#ffffff",error:"#000000",nr:"#cccccc"}}static get lights(){return Object.keys(Bo.colors).reduce(((t,e)=>(t[e]=jn(Bo.colors[e],"#ffffff")(.5),t)),{})}static get darks(){return Object.keys(Bo.colors).reduce(((t,e)=>(t[e]=jn(Bo.colors[e],"#000000")(.5),t)),{})}static get styles(){return[super.styles,nt`
|
|
786
786
|
:host {
|
|
787
|
-
---color-h: var(--color-h, ${
|
|
788
|
-
---color-m: var(--color-m, ${
|
|
789
|
-
---color-fa: var(--color-fa, ${
|
|
790
|
-
---color-cr: var(--color-cr, ${
|
|
791
|
-
---color-hr: var(--color-hr, ${
|
|
792
|
-
---color-far: var(--color-far, ${
|
|
793
|
-
---color-acc: var(--color-acc, ${
|
|
794
|
-
---color-d: var(--color-d, ${
|
|
795
|
-
---color-c: var(--color-c, ${
|
|
796
|
-
---color-s: var(--color-s, ${
|
|
797
|
-
---color-present: var(--color-present, ${
|
|
798
|
-
---color-absent: var(--color-absent, ${
|
|
799
|
-
---color-correct: var(--color-correct, ${
|
|
800
|
-
---color-error: var(--color-error, ${
|
|
801
|
-
---color-nr: var(--color-nr, ${
|
|
802
|
-
|
|
803
|
-
---color-h-light: var(--color-h-light, ${
|
|
804
|
-
---color-m-light: var(--color-m-light, ${
|
|
805
|
-
---color-fa-light: var(--color-fa-light, ${
|
|
806
|
-
---color-cr-light: var(--color-cr-light, ${
|
|
807
|
-
---color-hr-light: var(--color-hr-light, ${
|
|
808
|
-
---color-far-light: var(--color-far-light, ${
|
|
809
|
-
---color-acc-light: var(--color-acc-light, ${
|
|
810
|
-
---color-d-light: var(--color-d-light, ${
|
|
811
|
-
---color-c-light: var(--color-c-light, ${
|
|
812
|
-
---color-s-light: var(--color-s-light, ${
|
|
813
|
-
---color-present-light: var(--color-present-light, ${
|
|
814
|
-
---color-absent-light: var(--color-absent-light, ${
|
|
815
|
-
---color-correct-light: var(--color-correct-light, ${
|
|
816
|
-
---color-error-light: var(--color-error-light, ${
|
|
817
|
-
---color-nr-light: var(--color-nr-light, ${
|
|
818
|
-
|
|
819
|
-
---color-h-dark: var(--color-h-dark, ${
|
|
820
|
-
---color-m-dark: var(--color-m-dark, ${
|
|
821
|
-
---color-fa-dark: var(--color-fa-dark, ${
|
|
822
|
-
---color-cr-dark: var(--color-cr-dark, ${
|
|
823
|
-
---color-hr-dark: var(--color-hr-dark, ${
|
|
824
|
-
---color-far-dark: var(--color-far-dark, ${
|
|
825
|
-
---color-acc-dark: var(--color-acc-dark, ${
|
|
826
|
-
---color-d-dark: var(--color-d-dark, ${
|
|
827
|
-
---color-c-dark: var(--color-c-dark, ${
|
|
828
|
-
---color-s-dark: var(--color-s-dark, ${
|
|
829
|
-
---color-present-dark: var(--color-present-dark, ${
|
|
830
|
-
---color-absent-dark: var(--color-absent-dark, ${
|
|
831
|
-
---color-correct-dark: var(--color-correct-dark, ${
|
|
832
|
-
---color-error-dark: var(--color-error-dark, ${
|
|
833
|
-
---color-nr-dark: var(--color-nr-dark, ${
|
|
834
|
-
}
|
|
835
|
-
`]}}class
|
|
787
|
+
---color-h: var(--color-h, ${rt(this.colors.h)});
|
|
788
|
+
---color-m: var(--color-m, ${rt(this.colors.m)});
|
|
789
|
+
---color-fa: var(--color-fa, ${rt(this.colors.fa)});
|
|
790
|
+
---color-cr: var(--color-cr, ${rt(this.colors.cr)});
|
|
791
|
+
---color-hr: var(--color-hr, ${rt(this.colors.hr)});
|
|
792
|
+
---color-far: var(--color-far, ${rt(this.colors.far)});
|
|
793
|
+
---color-acc: var(--color-acc, ${rt(this.colors.acc)});
|
|
794
|
+
---color-d: var(--color-d, ${rt(this.colors.d)});
|
|
795
|
+
---color-c: var(--color-c, ${rt(this.colors.c)});
|
|
796
|
+
---color-s: var(--color-s, ${rt(this.colors.s)});
|
|
797
|
+
---color-present: var(--color-present, ${rt(this.colors.present)});
|
|
798
|
+
---color-absent: var(--color-absent, ${rt(this.colors.absent)});
|
|
799
|
+
---color-correct: var(--color-correct, ${rt(this.colors.correct)});
|
|
800
|
+
---color-error: var(--color-error, ${rt(this.colors.error)});
|
|
801
|
+
---color-nr: var(--color-nr, ${rt(this.colors.nr)});
|
|
802
|
+
|
|
803
|
+
---color-h-light: var(--color-h-light, ${rt(this.lights.h)});
|
|
804
|
+
---color-m-light: var(--color-m-light, ${rt(this.lights.m)});
|
|
805
|
+
---color-fa-light: var(--color-fa-light, ${rt(this.lights.fa)});
|
|
806
|
+
---color-cr-light: var(--color-cr-light, ${rt(this.lights.cr)});
|
|
807
|
+
---color-hr-light: var(--color-hr-light, ${rt(this.lights.hr)});
|
|
808
|
+
---color-far-light: var(--color-far-light, ${rt(this.lights.far)});
|
|
809
|
+
---color-acc-light: var(--color-acc-light, ${rt(this.lights.acc)});
|
|
810
|
+
---color-d-light: var(--color-d-light, ${rt(this.lights.d)});
|
|
811
|
+
---color-c-light: var(--color-c-light, ${rt(this.lights.c)});
|
|
812
|
+
---color-s-light: var(--color-s-light, ${rt(this.lights.s)});
|
|
813
|
+
---color-present-light: var(--color-present-light, ${rt(this.lights.present)});
|
|
814
|
+
---color-absent-light: var(--color-absent-light, ${rt(this.lights.absent)});
|
|
815
|
+
---color-correct-light: var(--color-correct-light, ${rt(this.lights.correct)});
|
|
816
|
+
---color-error-light: var(--color-error-light, ${rt(this.lights.error)});
|
|
817
|
+
---color-nr-light: var(--color-nr-light, ${rt(this.lights.nr)});
|
|
818
|
+
|
|
819
|
+
---color-h-dark: var(--color-h-dark, ${rt(this.darks.h)});
|
|
820
|
+
---color-m-dark: var(--color-m-dark, ${rt(this.darks.m)});
|
|
821
|
+
---color-fa-dark: var(--color-fa-dark, ${rt(this.darks.fa)});
|
|
822
|
+
---color-cr-dark: var(--color-cr-dark, ${rt(this.darks.cr)});
|
|
823
|
+
---color-hr-dark: var(--color-hr-dark, ${rt(this.darks.hr)});
|
|
824
|
+
---color-far-dark: var(--color-far-dark, ${rt(this.darks.far)});
|
|
825
|
+
---color-acc-dark: var(--color-acc-dark, ${rt(this.darks.acc)});
|
|
826
|
+
---color-d-dark: var(--color-d-dark, ${rt(this.darks.d)});
|
|
827
|
+
---color-c-dark: var(--color-c-dark, ${rt(this.darks.c)});
|
|
828
|
+
---color-s-dark: var(--color-s-dark, ${rt(this.darks.s)});
|
|
829
|
+
---color-present-dark: var(--color-present-dark, ${rt(this.darks.present)});
|
|
830
|
+
---color-absent-dark: var(--color-absent-dark, ${rt(this.darks.absent)});
|
|
831
|
+
---color-correct-dark: var(--color-correct-dark, ${rt(this.darks.correct)});
|
|
832
|
+
---color-error-dark: var(--color-error-dark, ${rt(this.darks.error)});
|
|
833
|
+
---color-nr-dark: var(--color-nr-dark, ${rt(this.darks.nr)});
|
|
834
|
+
}
|
|
835
|
+
`]}}class Ko extends Bo{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},direction:{attribute:!1,type:Number,reflect:!1},lifetime:{attribute:!1,type:Number,reflect:!1},speed:{attribute:!1,type:Number,reflect:!1},width:{attribute:!1,type:Number,reflect:!1},height:{attribute:!1,type:Number,reflect:!1},rem:{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.direction=-1,this.lifetime=400,this.speed=50,this.width=NaN,this.height=NaN,this.rem=NaN,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.currentDirection=void 0,this.signals=["present","absent"],this.signal=void 0,this.runner=void 0,this.xScale=void 0,this.yScale=void 0}static get styles(){return[super.styles,nt`
|
|
836
836
|
:host {
|
|
837
837
|
display: inline-block;
|
|
838
838
|
|
|
@@ -877,7 +877,7 @@ const Ho=t=>null!=t?t:z;customElements.define("decidables-slider",class extends
|
|
|
877
877
|
font-size: 1.75rem;
|
|
878
878
|
font-weight: 600;
|
|
879
879
|
}
|
|
880
|
-
`]}render(){return Et``}getDimensions(){this.width=parseFloat(this.getComputedStyleValue("width"),10),this.height=parseFloat(this.getComputedStyleValue("height"),10),this.rem=parseFloat(getComputedStyle(document.documentElement).getPropertyValue("font-size"),10)}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.getDimensions.bind(this))}disconnectedCallback(){window.removeEventListener("resize",this.getDimensions.bind(this)),super.disconnectedCallback()}firstUpdated(t){super.firstUpdated(t),this.getDimensions()}update(t){if(super.update(t),Number.isNaN(this.width)||Number.isNaN(this.height)||Number.isNaN(this.rem))return;const e=this.width,r=this.height,n=Math.min(e,r),i=.25*this.rem,s=.25*this.rem,a=.25*this.rem,o=n-(i+s),l=n-(a+.25*this.rem);this.xScale=Mo().domain([-1,1]).range([0,l]),this.yScale=Mo().domain([1,-1]).range([0,o]);const c=Lr(this.renderRoot).selectAll(".main").data([{width:this.width,height:this.height,rem:this.rem}]),h=c.enter().append("svg").classed("main",!0),u=h.merge(c).attr("viewBox",`0 0 ${n} ${n}`);h.append("clipPath").attr("id","clip-rdk-task").append("circle"),u.select("clipPath circle").attr("cx",this.xScale(0)).attr("cy",this.yScale(0)).attr("r",this.xScale(1)-this.xScale(0));const d=h.append("g").classed("plot",!0),p=u.select(".plot").attr("transform",`translate(${a}, ${i})`),f=d.append("g").classed("underlayer",!0),m=p.select(".underlayer");f.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)),d.append("g").classed("content",!0).attr("clip-path","url(#clip-rdk-task)");p.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=d.append("g").classed("overlayer",!0),v=p.select(".overlayer");b.append("circle").classed("outline",!0),v.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+=hi()-this.pauseTime,this.pauseTime=0),this.runner=function(t,e,r){var n=new di,i=e;return null==e?(n.restart(t,e,r),n):(n._restart=n.restart,n.restart=function(t,e,r){e=+e,r=null==r?hi():+r,n._restart((function s(a){a+=i,n._restart(s,i+=e,r),t(a)}),e,r)},n.restart(t,e,r),n)}(this.run.bind(this),20)):void 0!==this.runner&&(this.runner.stop(),this.pauseTime=hi())),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=Lr(this.renderRoot).select(".content").selectAll(".dots").data([[],[]]).selectAll(".dot").data((t=>t));t.exit().remove();Lr(this.renderRoot).select(".content").selectAll(".fixation").data([]).exit().remove();Lr(this.renderRoot).select(".content").selectAll(".query").data([]).exit().remove()}run(){const t=hi(),e=this.baseTime?t-this.baseTime:0,r=this.baseTime?e-this.startTime:0,n=this.baseTime?e-this.lastTime:0;this.lastTime=e;let i=!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&&r>=this.iti?(i=!0,this.trial+=1,this.state="stimulus",this.startTime=e,this.signal=Math.random()<this.probability?"present":"absent",this.currentDirection="absent"===this.signal?void 0:this.direction>=0?this.direction:360*Math.random(),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&&r>=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&&r>=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="present"===this.signal?Math.round(this.count*this.coherence):0,this.dots[this.RANDOM].length="present"===this.signal?this.count-this.dots[this.COHERENT].length:this.count;for(let t=0;t<this.dots.length;t+=1)for(let r=0;r<this.dots[t].length;r+=1){const s=void 0===this.dots[t][r];s&&(this.dots[t][r]={});const a=this.dots[t][r];if(i||s){a.direction=t===this.RANDOM?360*Math.random():this.currentDirection,a.birth=e-Math.floor(Math.random()*this.lifetime);const r=2*Math.random()*Math.PI,n=Math.sqrt(Math.random());a.x=this.xScale(n*Math.cos(r)),a.y=this.yScale(n*Math.sin(r))}else if(e>a.birth+this.lifetime){a.birth+=this.lifetime,a.direction=t===this.RANDOM?360*Math.random():this.currentDirection;const e=2*Math.random()*Math.PI,r=Math.sqrt(Math.random());a.x=this.xScale(r*Math.cos(e)),a.y=this.yScale(r*Math.sin(e))}else{t===this.COHERENT&&(a.direction=this.currentDirection);const e=a.direction*(Math.PI/180);a.dx=this.speed*(n/1e3)*Math.cos(e),a.dy=this.speed*(n/1e3)*Math.sin(e),a.x+=a.dx,a.y+=a.dy;(a.x-this.xScale(0))**2+(a.y-this.yScale(0))**2>(this.xScale(1)-this.xScale(0))**2&&(a.x=-(a.x-this.xScale(0))+this.xScale(0),a.y=-(a.y-this.yScale(0))+this.yScale(0))}}}const s=Lr(this.renderRoot).select(".content").selectAll(".fixation").data("iti"===this.state?[!0]:[]),a=s.enter().append("g").classed("fixation",!0);a.append("line").attr("x1",this.xScale(-.1)).attr("y1",this.xScale(0)).attr("x2",this.xScale(.1)).attr("y2",this.xScale(0)),a.append("line").attr("x1",this.xScale(0)).attr("y1",this.xScale(-.1)).attr("x2",this.xScale(0)).attr("y2",this.xScale(.1)),s.exit().remove();const o=Lr(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=Lr(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-task",Lo);"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var jo={},Bo={get exports(){return jo},set exports(t){jo=t}};!function(t,e){var r;t.exports=(r=function(t,e){var r=Array.prototype.concat,n=Array.prototype.slice,i=Object.prototype.toString;function s(e,r){var n=e>r?e:r;return t.pow(10,17-~~(t.log(n>0?n:-n)*t.LOG10E))}var a=Array.isArray||function(t){return"[object Array]"===i.call(t)};function o(t){return"[object Function]"===i.call(t)}function l(t){return"number"==typeof t&&t-t==0}function c(t){return r.apply([],t)}function h(){return new h._init(arguments)}function u(){return 0}function d(){return 1}function p(t,e){return t===e?1:0}h.fn=h.prototype,h._init=function(t){if(a(t[0]))if(a(t[0][0])){o(t[1])&&(t[0]=h.map(t[0],t[1]));for(var e=0;e<t[0].length;e++)this[e]=t[0][e];this.length=t[0].length}else this[0]=o(t[1])?h.map(t[0],t[1]):t[0],this.length=1;else if(l(t[0]))this[0]=h.seq.apply(null,t),this.length=1;else{if(t[0]instanceof h)return h(t[0].toArray());this[0]=[],this.length=1}return this},h._init.prototype=h.prototype,h._init.constructor=h,h.utils={calcRdx:s,isArray:a,isFunction:o,isNumber:l,toVector:c},h._random_fn=t.random,h.setRandom=function(t){if("function"!=typeof t)throw new TypeError("fn is not a function");h._random_fn=t},h.extend=function(t){var e,r;if(1===arguments.length){for(r in t)h[r]=t[r];return this}for(e=1;e<arguments.length;e++)for(r in arguments[e])t[r]=arguments[e][r];return t},h.rows=function(t){return t.length||1},h.cols=function(t){return t[0].length||1},h.dimensions=function(t){return{rows:h.rows(t),cols:h.cols(t)}},h.row=function(t,e){return a(e)?e.map((function(e){return h.row(t,e)})):t[e]},h.rowa=function(t,e){return h.row(t,e)},h.col=function(t,e){if(a(e)){var r=h.arange(t.length).map((function(){return new Array(e.length)}));return e.forEach((function(e,n){h.arange(t.length).forEach((function(i){r[i][n]=t[i][e]}))})),r}for(var n=new Array(t.length),i=0;i<t.length;i++)n[i]=[t[i][e]];return n},h.cola=function(t,e){return h.col(t,e).map((function(t){return t[0]}))},h.diag=function(t){for(var e=h.rows(t),r=new Array(e),n=0;n<e;n++)r[n]=[t[n][n]];return r},h.antidiag=function(t){for(var e=h.rows(t)-1,r=new Array(e),n=0;e>=0;e--,n++)r[n]=[t[n][e]];return r},h.transpose=function(t){var e,r,n,i,s,o=[];for(a(t[0])||(t=[t]),r=t.length,n=t[0].length,s=0;s<n;s++){for(e=new Array(r),i=0;i<r;i++)e[i]=t[i][s];o.push(e)}return 1===o.length?o[0]:o},h.map=function(t,e,r){var n,i,s,o,l;for(a(t[0])||(t=[t]),i=t.length,s=t[0].length,o=r?t:new Array(i),n=0;n<i;n++)for(o[n]||(o[n]=new Array(s)),l=0;l<s;l++)o[n][l]=e(t[n][l],n,l);return 1===o.length?o[0]:o},h.cumreduce=function(t,e,r){var n,i,s,o,l;for(a(t[0])||(t=[t]),i=t.length,s=t[0].length,o=r?t:new Array(i),n=0;n<i;n++)for(o[n]||(o[n]=new Array(s)),s>0&&(o[n][0]=t[n][0]),l=1;l<s;l++)o[n][l]=e(o[n][l-1],t[n][l]);return 1===o.length?o[0]:o},h.alter=function(t,e){return h.map(t,e,!0)},h.create=function(t,e,r){var n,i,s=new Array(t);for(o(e)&&(r=e,e=t),n=0;n<t;n++)for(s[n]=new Array(e),i=0;i<e;i++)s[n][i]=r(n,i);return s},h.zeros=function(t,e){return l(e)||(e=t),h.create(t,e,u)},h.ones=function(t,e){return l(e)||(e=t),h.create(t,e,d)},h.rand=function(t,e){return l(e)||(e=t),h.create(t,e,h._random_fn)},h.identity=function(t,e){return l(e)||(e=t),h.create(t,e,p)},h.symmetric=function(t){var e,r,n=t.length;if(t.length!==t[0].length)return!1;for(e=0;e<n;e++)for(r=0;r<n;r++)if(t[r][e]!==t[e][r])return!1;return!0},h.clear=function(t){return h.alter(t,u)},h.seq=function(t,e,r,n){o(n)||(n=!1);var i,a=[],l=s(t,e),c=(e*l-t*l)/((r-1)*l),h=t;for(i=0;h<=e&&i<r;h=(t*l+c*l*++i)/l)a.push(n?n(h,i):h);return a},h.arange=function(t,r,n){var i,s=[];if(n=n||1,r===e&&(r=t,t=0),t===r||0===n)return[];if(t<r&&n<0)return[];if(t>r&&n>0)return[];if(n>0)for(i=t;i<r;i+=n)s.push(i);else for(i=t;i>r;i+=n)s.push(i);return s},h.slice=function(){function t(t,r,n,i){var s,a=[],o=t.length;if(r===e&&n===e&&i===e)return h.copy(t);if(i=i||1,(r=(r=r||0)>=0?r:o+r)===(n=(n=n||t.length)>=0?n:o+n)||0===i)return[];if(r<n&&i<0)return[];if(r>n&&i>0)return[];if(i>0)for(s=r;s<n;s+=i)a.push(t[s]);else for(s=r;s>n;s+=i)a.push(t[s]);return a}function r(e,r){var n,i;return l((r=r||{}).row)?l(r.col)?e[r.row][r.col]:t(h.rowa(e,r.row),(n=r.col||{}).start,n.end,n.step):l(r.col)?t(h.cola(e,r.col),(i=r.row||{}).start,i.end,i.step):(i=r.row||{},n=r.col||{},t(e,i.start,i.end,i.step).map((function(e){return t(e,n.start,n.end,n.step)})))}return r}(),h.sliceAssign=function(r,n,i){var s,a;if(l(n.row)){if(l(n.col))return r[n.row][n.col]=i;n.col=n.col||{},n.col.start=n.col.start||0,n.col.end=n.col.end||r[0].length,n.col.step=n.col.step||1,s=h.arange(n.col.start,t.min(r.length,n.col.end),n.col.step);var o=n.row;return s.forEach((function(t,e){r[o][t]=i[e]})),r}if(l(n.col)){n.row=n.row||{},n.row.start=n.row.start||0,n.row.end=n.row.end||r.length,n.row.step=n.row.step||1,a=h.arange(n.row.start,t.min(r[0].length,n.row.end),n.row.step);var c=n.col;return a.forEach((function(t,e){r[t][c]=i[e]})),r}return i[0].length===e&&(i=[i]),n.row.start=n.row.start||0,n.row.end=n.row.end||r.length,n.row.step=n.row.step||1,n.col.start=n.col.start||0,n.col.end=n.col.end||r[0].length,n.col.step=n.col.step||1,a=h.arange(n.row.start,t.min(r.length,n.row.end),n.row.step),s=h.arange(n.col.start,t.min(r[0].length,n.col.end),n.col.step),a.forEach((function(t,e){s.forEach((function(n,s){r[t][n]=i[e][s]}))})),r},h.diagonal=function(t){var e=h.zeros(t.length,t.length);return t.forEach((function(t,r){e[r][r]=t})),e},h.copy=function(t){return t.map((function(t){return l(t)?t:t.map((function(t){return t}))}))};var f=h.prototype;return f.length=0,f.push=Array.prototype.push,f.sort=Array.prototype.sort,f.splice=Array.prototype.splice,f.slice=Array.prototype.slice,f.toArray=function(){return this.length>1?n.call(this):n.call(this)[0]},f.map=function(t,e){return h(h.map(this,t,e))},f.cumreduce=function(t,e){return h(h.cumreduce(this,t,e))},f.alter=function(t){return h.alter(this,t),this},function(t){for(var e=0;e<t.length;e++)!function(t){f[t]=function(e){var r,n=this;return e?(setTimeout((function(){e.call(n,f[t].call(n))})),this):(r=h[t](this),a(r)?h(r):r)}}(t[e])}("transpose clear symmetric rows cols dimensions diag antidiag".split(" ")),function(t){for(var e=0;e<t.length;e++)!function(t){f[t]=function(e,r){var n=this;return r?(setTimeout((function(){r.call(n,f[t].call(n,e))})),this):h(h[t](this,e))}}(t[e])}("row col".split(" ")),function(t){for(var e=0;e<t.length;e++)!function(t){f[t]=function(){return h(h[t].apply(null,arguments))}}(t[e])}("create zeros ones rand identity".split(" ")),h}(Math),function(t,e){var r=t.utils.isFunction;function n(t,e){return t-e}function i(t,r,n){return e.max(r,e.min(t,n))}t.sum=function(t){for(var e=0,r=t.length;--r>=0;)e+=t[r];return e},t.sumsqrd=function(t){for(var e=0,r=t.length;--r>=0;)e+=t[r]*t[r];return e},t.sumsqerr=function(e){for(var r,n=t.mean(e),i=0,s=e.length;--s>=0;)i+=(r=e[s]-n)*r;return i},t.sumrow=function(t){for(var e=0,r=t.length;--r>=0;)e+=t[r];return e},t.product=function(t){for(var e=1,r=t.length;--r>=0;)e*=t[r];return e},t.min=function(t){for(var e=t[0],r=0;++r<t.length;)t[r]<e&&(e=t[r]);return e},t.max=function(t){for(var e=t[0],r=0;++r<t.length;)t[r]>e&&(e=t[r]);return e},t.unique=function(t){for(var e={},r=[],n=0;n<t.length;n++)e[t[n]]||(e[t[n]]=!0,r.push(t[n]));return r},t.mean=function(e){return t.sum(e)/e.length},t.meansqerr=function(e){return t.sumsqerr(e)/e.length},t.geomean=function(r){var n=r.map(e.log),i=t.mean(n);return e.exp(i)},t.median=function(t){var e=t.length,r=t.slice().sort(n);return 1&e?r[e/2|0]:(r[e/2-1]+r[e/2])/2},t.cumsum=function(e){return t.cumreduce(e,(function(t,e){return t+e}))},t.cumprod=function(e){return t.cumreduce(e,(function(t,e){return t*e}))},t.diff=function(t){var e,r=[],n=t.length;for(e=1;e<n;e++)r.push(t[e]-t[e-1]);return r},t.rank=function(t){var e,r=[],i={};for(e=0;e<t.length;e++)i[l=t[e]]?i[l]++:(i[l]=1,r.push(l));var s=r.sort(n),a={},o=1;for(e=0;e<s.length;e++){var l,c=i[l=s[e]],h=(o+(o+c-1))/2;a[l]=h,o+=c}return t.map((function(t){return a[t]}))},t.mode=function(t){var e,r=t.length,i=t.slice().sort(n),s=1,a=0,o=0,l=[];for(e=0;e<r;e++)i[e]===i[e+1]?s++:(s>a?(l=[i[e]],a=s,o=0):s===a&&(l.push(i[e]),o++),s=1);return 0===o?l[0]:l},t.range=function(e){return t.max(e)-t.min(e)},t.variance=function(e,r){return t.sumsqerr(e)/(e.length-(r?1:0))},t.pooledvariance=function(e){var r=e.reduce((function(e,r){return e+t.sumsqerr(r)}),0),n=e.reduce((function(t,e){return t+e.length}),0);return r/(n-e.length)},t.deviation=function(e){for(var r=t.mean(e),n=e.length,i=new Array(n),s=0;s<n;s++)i[s]=e[s]-r;return i},t.stdev=function(r,n){return e.sqrt(t.variance(r,n))},t.pooledstdev=function(r){return e.sqrt(t.pooledvariance(r))},t.meandev=function(r){for(var n=t.mean(r),i=[],s=r.length-1;s>=0;s--)i.push(e.abs(r[s]-n));return t.mean(i)},t.meddev=function(r){for(var n=t.median(r),i=[],s=r.length-1;s>=0;s--)i.push(e.abs(r[s]-n));return t.median(i)},t.coeffvar=function(e){return t.stdev(e)/t.mean(e)},t.quartiles=function(t){var r=t.length,i=t.slice().sort(n);return[i[e.round(r/4)-1],i[e.round(r/2)-1],i[e.round(3*r/4)-1]]},t.quantiles=function(t,r,s,a){var o,l,c,h,u,d=t.slice().sort(n),p=[r.length],f=t.length;for(void 0===s&&(s=3/8),void 0===a&&(a=3/8),o=0;o<r.length;o++)c=f*(l=r[o])+(s+l*(1-s-a)),h=e.floor(i(c,1,f-1)),u=i(c-h,0,1),p[o]=(1-u)*d[h-1]+u*d[h];return p},t.percentile=function(t,e,r){var i=t.slice().sort(n),s=e*(i.length+(r?1:-1))+(r?0:1),a=parseInt(s),o=s-a;return a+1<i.length?i[a-1]+o*(i[a]-i[a-1]):i[a-1]},t.percentileOfScore=function(t,e,r){var n,i,s=0,a=t.length,o=!1;for("strict"===r&&(o=!0),i=0;i<a;i++)n=t[i],(o&&n<e||!o&&n<=e)&&s++;return s/a},t.histogram=function(r,n){n=n||4;var i,s=t.min(r),a=(t.max(r)-s)/n,o=r.length,l=[];for(i=0;i<n;i++)l[i]=0;for(i=0;i<o;i++)l[e.min(e.floor((r[i]-s)/a),n-1)]+=1;return l},t.covariance=function(e,r){var n,i=t.mean(e),s=t.mean(r),a=e.length,o=new Array(a);for(n=0;n<a;n++)o[n]=(e[n]-i)*(r[n]-s);return t.sum(o)/(a-1)},t.corrcoeff=function(e,r){return t.covariance(e,r)/t.stdev(e,1)/t.stdev(r,1)},t.spearmancoeff=function(e,r){return e=t.rank(e),r=t.rank(r),t.corrcoeff(e,r)},t.stanMoment=function(r,n){for(var i=t.mean(r),s=t.stdev(r),a=r.length,o=0,l=0;l<a;l++)o+=e.pow((r[l]-i)/s,n);return o/r.length},t.skewness=function(e){return t.stanMoment(e,3)},t.kurtosis=function(e){return t.stanMoment(e,4)-3};var s=t.prototype;!function(e){for(var n=0;n<e.length;n++)!function(e){s[e]=function(n,i){var a=[],o=0,l=this;if(r(n)&&(i=n,n=!1),i)return setTimeout((function(){i.call(l,s[e].call(l,n))})),this;if(this.length>1){for(l=!0===n?this:this.transpose();o<l.length;o++)a[o]=t[e](l[o]);return a}return t[e](this[0],n)}}(e[n])}("cumsum cumprod".split(" ")),function(e){for(var n=0;n<e.length;n++)!function(e){s[e]=function(n,i){var a=[],o=0,l=this;if(r(n)&&(i=n,n=!1),i)return setTimeout((function(){i.call(l,s[e].call(l,n))})),this;if(this.length>1){for("sumrow"!==e&&(l=!0===n?this:this.transpose());o<l.length;o++)a[o]=t[e](l[o]);return!0===n?t[e](t.utils.toVector(a)):a}return t[e](this[0],n)}}(e[n])}("sum sumsqrd sumsqerr sumrow product min max unique mean meansqerr geomean median diff rank mode range variance deviation stdev meandev meddev coeffvar quartiles histogram skewness kurtosis".split(" ")),function(e){for(var n=0;n<e.length;n++)!function(e){s[e]=function(){var n,i=[],a=0,o=this,l=Array.prototype.slice.call(arguments);if(r(l[l.length-1])){n=l[l.length-1];var c=l.slice(0,l.length-1);return setTimeout((function(){n.call(o,s[e].apply(o,c))})),this}n=void 0;var h=function(r){return t[e].apply(o,[r].concat(l))};if(this.length>1){for(o=o.transpose();a<o.length;a++)i[a]=h(o[a]);return i}return h(this[0])}}(e[n])}("quantiles percentileOfScore".split(" "))}(r,Math),function(t,e){t.gammaln=function(t){var r,n,i,s=0,a=[76.18009172947146,-86.50532032941678,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18],o=1.000000000190015;for(i=(n=r=t)+5.5,i-=(r+.5)*e.log(i);s<6;s++)o+=a[s]/++n;return e.log(2.5066282746310007*o/r)-i},t.loggam=function(t){var r,n,i,s,a,o,l,c=[.08333333333333333,-.002777777777777778,.0007936507936507937,-.0005952380952380952,.0008417508417508418,-.001917526917526918,.00641025641025641,-.02955065359477124,.1796443723688307,-1.3924322169059];if(r=t,l=0,1==t||2==t)return 0;for(t<=7&&(r=t+(l=e.floor(7-t))),n=1/(r*r),i=2*e.PI,a=c[9],o=8;o>=0;o--)a*=n,a+=c[o];if(s=a/r+.5*e.log(i)+(r-.5)*e.log(r)-r,t<=7)for(o=1;o<=l;o++)s-=e.log(r-1),r-=1;return s},t.gammafn=function(t){var r,n,i,s,a=[-1.716185138865495,24.76565080557592,-379.80425647094563,629.3311553128184,866.9662027904133,-31451.272968848367,-36144.413418691176,66456.14382024054],o=[-30.8402300119739,315.35062697960416,-1015.1563674902192,-3107.771671572311,22538.11842098015,4755.846277527881,-134659.9598649693,-115132.2596755535],l=!1,c=0,h=0,u=0,d=t;if(t>171.6243769536076)return 1/0;if(d<=0){if(!(s=d%1+36e-17))return 1/0;l=(1&d?-1:1)*e.PI/e.sin(e.PI*s),d=1-d}for(i=d,n=d<1?d++:(d-=c=(0|d)-1)-1,r=0;r<8;++r)u=(u+a[r])*n,h=h*n+o[r];if(s=u/h+1,i<d)s/=i;else if(i>d)for(r=0;r<c;++r)s*=d,d++;return l&&(s=l/s),s},t.gammap=function(e,r){return t.lowRegGamma(e,r)*t.gammafn(e)},t.lowRegGamma=function(r,n){var i,s=t.gammaln(r),a=r,o=1/r,l=o,c=n+1-r,h=1/1e-30,u=1/c,d=u,p=1,f=-~(8.5*e.log(r>=1?r:1/r)+.4*r+17);if(n<0||r<=0)return NaN;if(n<r+1){for(;p<=f;p++)o+=l*=n/++a;return o*e.exp(-n+r*e.log(n)-s)}for(;p<=f;p++)d*=(u=1/(u=(i=-p*(p-r))*u+(c+=2)))*(h=c+i/h);return 1-d*e.exp(-n+r*e.log(n)-s)},t.factorialln=function(e){return e<0?NaN:t.gammaln(e+1)},t.factorial=function(e){return e<0?NaN:t.gammafn(e+1)},t.combination=function(r,n){return r>170||n>170?e.exp(t.combinationln(r,n)):t.factorial(r)/t.factorial(n)/t.factorial(r-n)},t.combinationln=function(e,r){return t.factorialln(e)-t.factorialln(r)-t.factorialln(e-r)},t.permutation=function(e,r){return t.factorial(e)/t.factorial(e-r)},t.betafn=function(r,n){if(!(r<=0||n<=0))return r+n>170?e.exp(t.betaln(r,n)):t.gammafn(r)*t.gammafn(n)/t.gammafn(r+n)},t.betaln=function(e,r){return t.gammaln(e)+t.gammaln(r)-t.gammaln(e+r)},t.betacf=function(t,r,n){var i,s,a,o,l=1e-30,c=1,h=r+n,u=r+1,d=r-1,p=1,f=1-h*t/u;for(e.abs(f)<l&&(f=l),o=f=1/f;c<=100&&(f=1+(s=c*(n-c)*t/((d+(i=2*c))*(r+i)))*f,e.abs(f)<l&&(f=l),p=1+s/p,e.abs(p)<l&&(p=l),o*=(f=1/f)*p,f=1+(s=-(r+c)*(h+c)*t/((r+i)*(u+i)))*f,e.abs(f)<l&&(f=l),p=1+s/p,e.abs(p)<l&&(p=l),o*=a=(f=1/f)*p,!(e.abs(a-1)<3e-7));c++);return o},t.gammapinv=function(r,n){var i,s,a,o,l,c,h=0,u=n-1,d=1e-8,p=t.gammaln(n);if(r>=1)return e.max(100,n+100*e.sqrt(n));if(r<=0)return 0;for(n>1?(l=e.log(u),c=e.exp(u*(l-1)-p),o=r<.5?r:1-r,i=(2.30753+.27061*(s=e.sqrt(-2*e.log(o))))/(1+s*(.99229+.04481*s))-s,r<.5&&(i=-i),i=e.max(.001,n*e.pow(1-1/(9*n)-i/(3*e.sqrt(n)),3))):i=r<(s=1-n*(.253+.12*n))?e.pow(r/s,1/n):1-e.log(1-(r-s)/(1-s));h<12;h++){if(i<=0)return 0;if((i-=s=(a=(t.lowRegGamma(n,i)-r)/(s=n>1?c*e.exp(-(i-u)+u*(e.log(i)-l)):e.exp(-i+u*e.log(i)-p)))/(1-.5*e.min(1,a*((n-1)/i-1))))<=0&&(i=.5*(i+s)),e.abs(s)<d*i)break}return i},t.erf=function(t){var r,n,i,s,a=[-1.3026537197817094,.6419697923564902,.019476473204185836,-.00956151478680863,-.000946595344482036,.000366839497852761,42523324806907e-18,-20278578112534e-18,-1624290004647e-18,130365583558e-17,1.5626441722e-8,-8.5238095915e-8,6.529054439e-9,5.059343495e-9,-9.91364156e-10,-2.27365122e-10,96467911e-18,2394038e-18,-6886027e-18,894487e-18,313092e-18,-112708e-18,381e-18,7106e-18,-1523e-18,-94e-18,121e-18,-28e-18],o=a.length-1,l=!1,c=0,h=0;for(t<0&&(t=-t,l=!0),n=4*(r=2/(2+t))-2;o>0;o--)i=c,c=n*c-h+a[o],h=i;return s=r*e.exp(-t*t+.5*(a[0]+n*c)-h),l?s-1:1-s},t.erfc=function(e){return 1-t.erf(e)},t.erfcinv=function(r){var n,i,s,a,o=0;if(r>=2)return-100;if(r<=0)return 100;for(a=r<1?r:2-r,n=-.70711*((2.30753+.27061*(s=e.sqrt(-2*e.log(a/2))))/(1+s*(.99229+.04481*s))-s);o<2;o++)n+=(i=t.erfc(n)-a)/(1.1283791670955126*e.exp(-n*n)-n*i);return r<1?n:-n},t.ibetainv=function(r,n,i){var s,a,o,l,c,h,u,d,p,f,m=1e-8,b=n-1,v=i-1,g=0;if(r<=0)return 0;if(r>=1)return 1;for(n>=1&&i>=1?(o=r<.5?r:1-r,h=(2.30753+.27061*(l=e.sqrt(-2*e.log(o))))/(1+l*(.99229+.04481*l))-l,r<.5&&(h=-h),u=(h*h-3)/6,d=2/(1/(2*n-1)+1/(2*i-1)),p=h*e.sqrt(u+d)/d-(1/(2*i-1)-1/(2*n-1))*(u+5/6-2/(3*d)),h=n/(n+i*e.exp(2*p))):(s=e.log(n/(n+i)),a=e.log(i/(n+i)),h=r<(l=e.exp(n*s)/n)/(p=l+(c=e.exp(i*a)/i))?e.pow(n*p*r,1/n):1-e.pow(i*p*(1-r),1/i)),f=-t.gammaln(n)-t.gammaln(i)+t.gammaln(n+i);g<10;g++){if(0===h||1===h)return h;if((h-=l=(c=(t.ibeta(h,n,i)-r)/(l=e.exp(b*e.log(h)+v*e.log(1-h)+f)))/(1-.5*e.min(1,c*(b/h-v/(1-h)))))<=0&&(h=.5*(h+l)),h>=1&&(h=.5*(h+l+1)),e.abs(l)<m*h&&g>0)break}return h},t.ibeta=function(r,n,i){var s=0===r||1===r?0:e.exp(t.gammaln(n+i)-t.gammaln(n)-t.gammaln(i)+n*e.log(r)+i*e.log(1-r));return!(r<0||r>1)&&(r<(n+1)/(n+i+2)?s*t.betacf(r,n,i)/n:1-s*t.betacf(1-r,i,n)/i)},t.randn=function(r,n){var i,s,a,o,l;if(n||(n=r),r)return t.create(r,n,(function(){return t.randn()}));do{i=t._random_fn(),s=1.7156*(t._random_fn()-.5),l=(a=i-.449871)*a+(o=e.abs(s)+.386595)*(.196*o-.25472*a)}while(l>.27597&&(l>.27846||s*s>-4*e.log(i)*i*i));return s/i},t.randg=function(r,n,i){var s,a,o,l,c,h,u=r;if(i||(i=n),r||(r=1),n)return(h=t.zeros(n,i)).alter((function(){return t.randg(r)})),h;r<1&&(r+=1),s=r-1/3,a=1/e.sqrt(9*s);do{do{l=1+a*(c=t.randn())}while(l<=0);l*=l*l,o=t._random_fn()}while(o>1-.331*e.pow(c,4)&&e.log(o)>.5*c*c+s*(1-l+e.log(l)));if(r==u)return s*l;do{o=t._random_fn()}while(0===o);return e.pow(o,1/u)*s*l},function(e){for(var r=0;r<e.length;r++)!function(e){t.fn[e]=function(){return t(t.map(this,(function(r){return t[e](r)})))}}(e[r])}("gammaln gammafn factorial factorialln".split(" ")),function(e){for(var r=0;r<e.length;r++)!function(e){t.fn[e]=function(){return t(t[e].apply(null,arguments))}}(e[r])}("randn".split(" "))}(r,Math),function(t,e){function r(t,r,n,i){for(var s,a=0,o=1,l=1,c=1,h=0,u=0;e.abs((l-u)/l)>i;)u=l,o=c+(s=-(r+h)*(r+n+h)*t/(r+2*h)/(r+2*h+1))*o,l=(a=l+s*a)+(s=(h+=1)*(n-h)*t/(r+2*h-1)/(r+2*h))*l,a/=c=o+s*c,o/=c,l/=c,c=1;return l/r}function n(t){return t/e.abs(t)}function i(r,n,i){var s=12,a=6,o=-30,l=-50,c=60,h=8,u=3,d=2,p=3,f=[.9815606342467192,.9041172563704749,.7699026741943047,.5873179542866175,.3678314989981802,.1252334085114689],m=[.04717533638651183,.10693932599531843,.16007832854334622,.20316742672306592,.2334925365383548,.24914704581340277],b=.5*r;if(b>=h)return 1;var v,g=2*t.normal.cdf(b,0,1,1,0)-1;g=g>=e.exp(l/i)?e.pow(g,i):0;for(var y=b,w=(h-b)/(v=r>u?d:p),x=y+w,$=0,_=i-1,k=1;k<=v;k++){for(var S=0,A=.5*(x+y),E=.5*(x-y),M=1;M<=s;M++){var T,C=A+E*(a<M?f[(T=s-M+1)-1]:-f[(T=M)-1]),N=C*C;if(N>c)break;var R=2*t.normal.cdf(C,0,1,1,0)*.5-2*t.normal.cdf(C,r,1,1,0)*.5;R>=e.exp(o/_)&&(S+=R=m[T-1]*e.exp(-.5*N)*e.pow(R,_))}$+=S*=2*E*i/e.sqrt(2*e.PI),y=x,x+=w}return(g+=$)<=e.exp(o/n)?0:(g=e.pow(g,n))>=1?1:g}function s(t,r,n){var i=.322232421088,s=.099348462606,a=-1,o=.588581570495,l=-.342242088547,c=.531103462366,h=-.204231210125,u=.10353775285,d=-453642210148e-16,p=.0038560700634,f=.8832,m=.2368,b=1.214,v=1.208,g=1.4142,y=120,w=.5-.5*t,x=e.sqrt(e.log(1/(w*w))),$=x+((((x*d+h)*x+l)*x+a)*x+i)/((((x*p+u)*x+c)*x+o)*x+s);n<y&&($+=($*$*$+$)/n/4);var _=f-m*$;return n<y&&(_+=-b/n+v*$/n),$*(_*e.log(r-1)+g)}!function(e){for(var r=0;r<e.length;r++)!function(e){t[e]=function t(e,r,n){return this instanceof t?(this._a=e,this._b=r,this._c=n,this):new t(e,r,n)},t.fn[e]=function(r,n,i){var s=t[e](r,n,i);return s.data=this,s},t[e].prototype.sample=function(r){var n=this._a,i=this._b,s=this._c;return r?t.alter(r,(function(){return t[e].sample(n,i,s)})):t[e].sample(n,i,s)},function(r){for(var n=0;n<r.length;n++)!function(r){t[e].prototype[r]=function(n){var i=this._a,s=this._b,a=this._c;return n||0===n||(n=this.data),"number"!=typeof n?t.fn.map.call(n,(function(n){return t[e][r](n,i,s,a)})):t[e][r](n,i,s,a)}}(r[n])}("pdf cdf inv".split(" ")),function(r){for(var n=0;n<r.length;n++)!function(r){t[e].prototype[r]=function(){return t[e][r](this._a,this._b,this._c)}}(r[n])}("mean median mode variance".split(" "))}(e[r])}("beta centralF cauchy chisquare exponential gamma invgamma kumaraswamy laplace lognormal noncentralt normal pareto studentt weibull uniform binomial negbin hypgeom poisson triangular tukey arcsine".split(" ")),t.extend(t.beta,{pdf:function(r,n,i){return r>1||r<0?0:1==n&&1==i?1:n<512&&i<512?e.pow(r,n-1)*e.pow(1-r,i-1)/t.betafn(n,i):e.exp((n-1)*e.log(r)+(i-1)*e.log(1-r)-t.betaln(n,i))},cdf:function(e,r,n){return e>1||e<0?1*(e>1):t.ibeta(e,r,n)},inv:function(e,r,n){return t.ibetainv(e,r,n)},mean:function(t,e){return t/(t+e)},median:function(e,r){return t.ibetainv(.5,e,r)},mode:function(t,e){return(t-1)/(t+e-2)},sample:function(e,r){var n=t.randg(e);return n/(n+t.randg(r))},variance:function(t,r){return t*r/(e.pow(t+r,2)*(t+r+1))}}),t.extend(t.centralF,{pdf:function(r,n,i){var s;return r<0?0:n<=2?0===r&&n<2?1/0:0===r&&2===n?1:1/t.betafn(n/2,i/2)*e.pow(n/i,n/2)*e.pow(r,n/2-1)*e.pow(1+n/i*r,-(n+i)/2):(s=n*r/(i+r*n),n*(i/(i+r*n))/2*t.binomial.pdf((n-2)/2,(n+i-2)/2,s))},cdf:function(e,r,n){return e<0?0:t.ibeta(r*e/(r*e+n),r/2,n/2)},inv:function(e,r,n){return n/(r*(1/t.ibetainv(e,r/2,n/2)-1))},mean:function(t,e){return e>2?e/(e-2):void 0},mode:function(t,e){return t>2?e*(t-2)/(t*(e+2)):void 0},sample:function(e,r){return 2*t.randg(e/2)/e/(2*t.randg(r/2)/r)},variance:function(t,e){if(!(e<=4))return 2*e*e*(t+e-2)/(t*(e-2)*(e-2)*(e-4))}}),t.extend(t.cauchy,{pdf:function(t,r,n){return n<0?0:n/(e.pow(t-r,2)+e.pow(n,2))/e.PI},cdf:function(t,r,n){return e.atan((t-r)/n)/e.PI+.5},inv:function(t,r,n){return r+n*e.tan(e.PI*(t-.5))},median:function(t){return t},mode:function(t){return t},sample:function(r,n){return t.randn()*e.sqrt(1/(2*t.randg(.5)))*n+r}}),t.extend(t.chisquare,{pdf:function(r,n){return r<0?0:0===r&&2===n?.5:e.exp((n/2-1)*e.log(r)-r/2-n/2*e.log(2)-t.gammaln(n/2))},cdf:function(e,r){return e<0?0:t.lowRegGamma(r/2,e/2)},inv:function(e,r){return 2*t.gammapinv(e,.5*r)},mean:function(t){return t},median:function(t){return t*e.pow(1-2/(9*t),3)},mode:function(t){return t-2>0?t-2:0},sample:function(e){return 2*t.randg(e/2)},variance:function(t){return 2*t}}),t.extend(t.exponential,{pdf:function(t,r){return t<0?0:r*e.exp(-r*t)},cdf:function(t,r){return t<0?0:1-e.exp(-r*t)},inv:function(t,r){return-e.log(1-t)/r},mean:function(t){return 1/t},median:function(t){return 1/t*e.log(2)},mode:function(){return 0},sample:function(r){return-1/r*e.log(t._random_fn())},variance:function(t){return e.pow(t,-2)}}),t.extend(t.gamma,{pdf:function(r,n,i){return r<0?0:0===r&&1===n?1/i:e.exp((n-1)*e.log(r)-r/i-t.gammaln(n)-n*e.log(i))},cdf:function(e,r,n){return e<0?0:t.lowRegGamma(r,e/n)},inv:function(e,r,n){return t.gammapinv(e,r)*n},mean:function(t,e){return t*e},mode:function(t,e){if(t>1)return(t-1)*e},sample:function(e,r){return t.randg(e)*r},variance:function(t,e){return t*e*e}}),t.extend(t.invgamma,{pdf:function(r,n,i){return r<=0?0:e.exp(-(n+1)*e.log(r)-i/r-t.gammaln(n)+n*e.log(i))},cdf:function(e,r,n){return e<=0?0:1-t.lowRegGamma(r,n/e)},inv:function(e,r,n){return n/t.gammapinv(1-e,r)},mean:function(t,e){return t>1?e/(t-1):void 0},mode:function(t,e){return e/(t+1)},sample:function(e,r){return r/t.randg(e)},variance:function(t,e){if(!(t<=2))return e*e/((t-1)*(t-1)*(t-2))}}),t.extend(t.kumaraswamy,{pdf:function(t,r,n){return 0===t&&1===r?n:1===t&&1===n?r:e.exp(e.log(r)+e.log(n)+(r-1)*e.log(t)+(n-1)*e.log(1-e.pow(t,r)))},cdf:function(t,r,n){return t<0?0:t>1?1:1-e.pow(1-e.pow(t,r),n)},inv:function(t,r,n){return e.pow(1-e.pow(1-t,1/n),1/r)},mean:function(e,r){return r*t.gammafn(1+1/e)*t.gammafn(r)/t.gammafn(1+1/e+r)},median:function(t,r){return e.pow(1-e.pow(2,-1/r),1/t)},mode:function(t,r){if(t>=1&&r>=1&&1!==t&&1!==r)return e.pow((t-1)/(t*r-1),1/t)},variance:function(){throw new Error("variance not yet implemented")}}),t.extend(t.lognormal,{pdf:function(t,r,n){return t<=0?0:e.exp(-e.log(t)-.5*e.log(2*e.PI)-e.log(n)-e.pow(e.log(t)-r,2)/(2*n*n))},cdf:function(r,n,i){return r<0?0:.5+.5*t.erf((e.log(r)-n)/e.sqrt(2*i*i))},inv:function(r,n,i){return e.exp(-1.4142135623730951*i*t.erfcinv(2*r)+n)},mean:function(t,r){return e.exp(t+r*r/2)},median:function(t){return e.exp(t)},mode:function(t,r){return e.exp(t-r*r)},sample:function(r,n){return e.exp(t.randn()*n+r)},variance:function(t,r){return(e.exp(r*r)-1)*e.exp(2*t+r*r)}}),t.extend(t.noncentralt,{pdf:function(r,n,i){var s=1e-14;return e.abs(i)<s?t.studentt.pdf(r,n):e.abs(r)<s?e.exp(t.gammaln((n+1)/2)-i*i/2-.5*e.log(e.PI*n)-t.gammaln(n/2)):n/r*(t.noncentralt.cdf(r*e.sqrt(1+2/n),n+2,i)-t.noncentralt.cdf(r,n,i))},cdf:function(r,n,i){var s=1e-14,a=200;if(e.abs(i)<s)return t.studentt.cdf(r,n);var o=!1;r<0&&(o=!0,i=-i);for(var l=t.normal.cdf(-i,0,1),c=s+1,h=c,u=r*r/(r*r+n),d=0,p=e.exp(-i*i/2),f=e.exp(-i*i/2-.5*e.log(2)-t.gammaln(1.5))*i;d<a||h>s||c>s;)h=c,d>0&&(p*=i*i/(2*d),f*=i*i/(2*(d+.5))),l+=.5*(c=p*t.beta.cdf(u,d+.5,n/2)+f*t.beta.cdf(u,d+1,n/2)),d++;return o?1-l:l}}),t.extend(t.normal,{pdf:function(t,r,n){return e.exp(-.5*e.log(2*e.PI)-e.log(n)-e.pow(t-r,2)/(2*n*n))},cdf:function(r,n,i){return.5*(1+t.erf((r-n)/e.sqrt(2*i*i)))},inv:function(e,r,n){return-1.4142135623730951*n*t.erfcinv(2*e)+r},mean:function(t){return t},median:function(t){return t},mode:function(t){return t},sample:function(e,r){return t.randn()*r+e},variance:function(t,e){return e*e}}),t.extend(t.pareto,{pdf:function(t,r,n){return t<r?0:n*e.pow(r,n)/e.pow(t,n+1)},cdf:function(t,r,n){return t<r?0:1-e.pow(r/t,n)},inv:function(t,r,n){return r/e.pow(1-t,1/n)},mean:function(t,r){if(!(r<=1))return r*e.pow(t,r)/(r-1)},median:function(t,r){return t*(r*e.SQRT2)},mode:function(t){return t},variance:function(t,r){if(!(r<=2))return t*t*r/(e.pow(r-1,2)*(r-2))}}),t.extend(t.studentt,{pdf:function(r,n){return n=n>1e100?1e100:n,1/(e.sqrt(n)*t.betafn(.5,n/2))*e.pow(1+r*r/n,-(n+1)/2)},cdf:function(r,n){var i=n/2;return t.ibeta((r+e.sqrt(r*r+n))/(2*e.sqrt(r*r+n)),i,i)},inv:function(r,n){var i=t.ibetainv(2*e.min(r,1-r),.5*n,.5);return i=e.sqrt(n*(1-i)/i),r>.5?i:-i},mean:function(t){return t>1?0:void 0},median:function(){return 0},mode:function(){return 0},sample:function(r){return t.randn()*e.sqrt(r/(2*t.randg(r/2)))},variance:function(t){return t>2?t/(t-2):t>1?1/0:void 0}}),t.extend(t.weibull,{pdf:function(t,r,n){return t<0||r<0||n<0?0:n/r*e.pow(t/r,n-1)*e.exp(-e.pow(t/r,n))},cdf:function(t,r,n){return t<0?0:1-e.exp(-e.pow(t/r,n))},inv:function(t,r,n){return r*e.pow(-e.log(1-t),1/n)},mean:function(e,r){return e*t.gammafn(1+1/r)},median:function(t,r){return t*e.pow(e.log(2),1/r)},mode:function(t,r){return r<=1?0:t*e.pow((r-1)/r,1/r)},sample:function(r,n){return r*e.pow(-e.log(t._random_fn()),1/n)},variance:function(r,n){return r*r*t.gammafn(1+2/n)-e.pow(t.weibull.mean(r,n),2)}}),t.extend(t.uniform,{pdf:function(t,e,r){return t<e||t>r?0:1/(r-e)},cdf:function(t,e,r){return t<e?0:t<r?(t-e)/(r-e):1},inv:function(t,e,r){return e+t*(r-e)},mean:function(t,e){return.5*(t+e)},median:function(e,r){return t.mean(e,r)},mode:function(){throw new Error("mode is not yet implemented")},sample:function(e,r){return e/2+r/2+(r/2-e/2)*(2*t._random_fn()-1)},variance:function(t,r){return e.pow(r-t,2)/12}}),t.extend(t.binomial,{pdf:function(r,n,i){return 0===i||1===i?n*i===r?1:0:t.combination(n,r)*e.pow(i,r)*e.pow(1-i,n-r)},cdf:function(n,i,s){var a,o=1e-10;if(n<0)return 0;if(n>=i)return 1;if(s<0||s>1||i<=0)return NaN;var l=s,c=(n=e.floor(n))+1,h=i-n,u=c+h,d=e.exp(t.gammaln(u)-t.gammaln(h)-t.gammaln(c)+c*e.log(l)+h*e.log(1-l));return a=l<(c+1)/(u+2)?d*r(l,c,h,o):1-d*r(1-l,h,c,o),e.round(1/o*(1-a))/(1/o)}}),t.extend(t.negbin,{pdf:function(r,n,i){return r===r>>>0&&(r<0?0:t.combination(r+n-1,n-1)*e.pow(1-i,r)*e.pow(i,n))},cdf:function(e,r,n){var i=0,s=0;if(e<0)return 0;for(;s<=e;s++)i+=t.negbin.pdf(s,r,n);return i}}),t.extend(t.hypgeom,{pdf:function(r,n,i,s){if(r!=r|0)return!1;if(r<0||r<i-(n-s))return 0;if(r>s||r>i)return 0;if(2*i>n)return 2*s>n?t.hypgeom.pdf(n-i-s+r,n,n-i,n-s):t.hypgeom.pdf(s-r,n,n-i,s);if(2*s>n)return t.hypgeom.pdf(i-r,n,i,n-s);if(i<s)return t.hypgeom.pdf(r,n,s,i);for(var a=1,o=0,l=0;l<r;l++){for(;a>1&&o<s;)a*=1-i/(n-o),o++;a*=(s-l)*(i-l)/((l+1)*(n-i-s+l+1))}for(;o<s;o++)a*=1-i/(n-o);return e.min(1,e.max(0,a))},cdf:function(r,n,i,s){if(r<0||r<i-(n-s))return 0;if(r>=s||r>=i)return 1;if(2*i>n)return 2*s>n?t.hypgeom.cdf(n-i-s+r,n,n-i,n-s):1-t.hypgeom.cdf(s-r-1,n,n-i,s);if(2*s>n)return 1-t.hypgeom.cdf(i-r-1,n,i,n-s);if(i<s)return t.hypgeom.cdf(r,n,s,i);for(var a=1,o=1,l=0,c=0;c<r;c++){for(;a>1&&l<s;){var h=1-i/(n-l);o*=h,a*=h,l++}a+=o*=(s-c)*(i-c)/((c+1)*(n-i-s+c+1))}for(;l<s;l++)a*=1-i/(n-l);return e.min(1,e.max(0,a))}}),t.extend(t.poisson,{pdf:function(r,n){return n<0||r%1!=0||r<0?0:e.pow(n,r)*e.exp(-n)/t.factorial(r)},cdf:function(e,r){var n=[],i=0;if(e<0)return 0;for(;i<=e;i++)n.push(t.poisson.pdf(i,r));return t.sum(n)},mean:function(t){return t},variance:function(t){return t},sampleSmall:function(r){var n=1,i=0,s=e.exp(-r);do{i++,n*=t._random_fn()}while(n>s);return i-1},sampleLarge:function(r){var n,i,s,a,o,l,c,h,u,d,p=r;for(a=e.sqrt(p),o=e.log(p),l=.02483*(c=.931+2.53*a)-.059,h=1.1239+1.1328/(c-3.4),u=.9277-3.6224/(c-2);;){if(i=e.random()-.5,s=e.random(),d=.5-e.abs(i),n=e.floor((2*l/d+c)*i+p+.43),d>=.07&&s<=u)return n;if(!(n<0||d<.013&&s>d)&&e.log(s)+e.log(h)-e.log(l/(d*d)+c)<=n*o-p-t.loggam(n+1))return n}},sample:function(t){return t<10?this.sampleSmall(t):this.sampleLarge(t)}}),t.extend(t.triangular,{pdf:function(t,e,r,n){return r<=e||n<e||n>r?NaN:t<e||t>r?0:t<n?2*(t-e)/((r-e)*(n-e)):t===n?2/(r-e):2*(r-t)/((r-e)*(r-n))},cdf:function(t,r,n,i){return n<=r||i<r||i>n?NaN:t<=r?0:t>=n?1:t<=i?e.pow(t-r,2)/((n-r)*(i-r)):1-e.pow(n-t,2)/((n-r)*(n-i))},inv:function(t,r,n,i){return n<=r||i<r||i>n?NaN:t<=(i-r)/(n-r)?r+(n-r)*e.sqrt(t*((i-r)/(n-r))):r+(n-r)*(1-e.sqrt((1-t)*(1-(i-r)/(n-r))))},mean:function(t,e,r){return(t+e+r)/3},median:function(t,r,n){return n<=(t+r)/2?r-e.sqrt((r-t)*(r-n))/e.sqrt(2):n>(t+r)/2?t+e.sqrt((r-t)*(n-t))/e.sqrt(2):void 0},mode:function(t,e,r){return r},sample:function(r,n,i){var s=t._random_fn();return s<(i-r)/(n-r)?r+e.sqrt(s*(n-r)*(i-r)):n-e.sqrt((1-s)*(n-r)*(n-i))},variance:function(t,e,r){return(t*t+e*e+r*r-t*e-t*r-e*r)/18}}),t.extend(t.arcsine,{pdf:function(t,r,n){return n<=r?NaN:t<=r||t>=n?0:2/e.PI*e.pow(e.pow(n-r,2)-e.pow(2*t-r-n,2),-.5)},cdf:function(t,r,n){return t<r?0:t<n?2/e.PI*e.asin(e.sqrt((t-r)/(n-r))):1},inv:function(t,r,n){return r+(.5-.5*e.cos(e.PI*t))*(n-r)},mean:function(t,e){return e<=t?NaN:(t+e)/2},median:function(t,e){return e<=t?NaN:(t+e)/2},mode:function(){throw new Error("mode is not yet implemented")},sample:function(r,n){return(r+n)/2+(n-r)/2*e.sin(2*e.PI*t.uniform.sample(0,1))},variance:function(t,r){return r<=t?NaN:e.pow(r-t,2)/8}}),t.extend(t.laplace,{pdf:function(t,r,n){return n<=0?0:e.exp(-e.abs(t-r)/n)/(2*n)},cdf:function(t,r,n){return n<=0?0:t<r?.5*e.exp((t-r)/n):1-.5*e.exp(-(t-r)/n)},mean:function(t){return t},median:function(t){return t},mode:function(t){return t},variance:function(t,e){return 2*e*e},sample:function(r,i){var s=t._random_fn()-.5;return r-i*n(s)*e.log(1-2*e.abs(s))}}),t.extend(t.tukey,{cdf:function(r,n,s){var a=1,o=n,l=16,c=8,h=-30,u=1e-14,d=100,p=800,f=5e3,m=25e3,b=1,v=.5,g=.25,y=.125,w=[.9894009349916499,.9445750230732326,.8656312023878318,.755404408355003,.6178762444026438,.45801677765722737,.2816035507792589,.09501250983763744],x=[.027152459411754096,.062253523938647894,.09515851168249279,.12462897125553388,.14959598881657674,.16915651939500254,.18260341504492358,.1894506104550685];if(r<=0)return 0;if(s<2||a<1||o<2)return NaN;if(!Number.isFinite(r))return 1;if(s>m)return i(r,a,o);var $,_=.5*s,k=_*e.log(s)-s*e.log(2)-t.gammaln(_),S=_-1,A=.25*s;$=s<=d?b:s<=p?v:s<=f?g:y,k+=e.log($);for(var E=0,M=1;M<=50;M++){for(var T=0,C=(2*M-1)*$,N=1;N<=l;N++){var R,q;c<N?(R=N-c-1,q=k+S*e.log(C+w[R]*$)-(w[R]*$+C)*A):(R=N-1,q=k+S*e.log(C-w[R]*$)+(w[R]*$-C)*A),q>=h&&(T+=i(c<N?r*e.sqrt(.5*(w[R]*$+C)):r*e.sqrt(.5*(-w[R]*$+C)),a,o)*x[R]*e.exp(q))}if(M*$>=1&&T<=u)break;E+=T}if(T>u)throw new Error("tukey.cdf failed to converge");return E>1&&(E=1),E},inv:function(r,n,i){var a=1e-4,o=50;if(i<2||n<2)return NaN;if(r<0||r>1)return NaN;if(0===r)return 0;if(1===r)return 1/0;var l,c=s(r,n,i),h=t.tukey.cdf(c,n,i)-r;l=h>0?e.max(0,c-1):c+1;for(var u,d=t.tukey.cdf(l,n,i)-r,p=1;p<o;p++)if(u=l-d*(l-c)/(d-h),h=d,c=l,u<0&&(u=0,d=-r),d=t.tukey.cdf(u,n,i)-r,l=u,e.abs(l-c)<a)return u;throw new Error("tukey.inv failed to converge")}})}(r,Math),function(t,e){var r=Array.prototype.push,n=t.utils.isArray;function i(e){return n(e)||e instanceof t}t.extend({add:function(e,r){return i(r)?(i(r[0])||(r=[r]),t.map(e,(function(t,e,n){return t+r[e][n]}))):t.map(e,(function(t){return t+r}))},subtract:function(e,r){return i(r)?(i(r[0])||(r=[r]),t.map(e,(function(t,e,n){return t-r[e][n]||0}))):t.map(e,(function(t){return t-r}))},divide:function(e,r){return i(r)?(i(r[0])||(r=[r]),t.multiply(e,t.inv(r))):t.map(e,(function(t){return t/r}))},multiply:function(e,r){var n,s,a,o,l,c,h,u;if(void 0===e.length&&void 0===r.length)return e*r;if(l=e.length,c=e[0].length,h=t.zeros(l,a=i(r)?r[0].length:c),u=0,i(r)){for(;u<a;u++)for(n=0;n<l;n++){for(o=0,s=0;s<c;s++)o+=e[n][s]*r[s][u];h[n][u]=o}return 1===l&&1===u?h[0][0]:h}return t.map(e,(function(t){return t*r}))},outer:function(e,r){return t.multiply(e.map((function(t){return[t]})),[r])},dot:function(e,r){i(e[0])||(e=[e]),i(r[0])||(r=[r]);for(var n,s,a=1===e[0].length&&1!==e.length?t.transpose(e):e,o=1===r[0].length&&1!==r.length?t.transpose(r):r,l=[],c=0,h=a.length,u=a[0].length;c<h;c++){for(l[c]=[],n=0,s=0;s<u;s++)n+=a[c][s]*o[c][s];l[c]=n}return 1===l.length?l[0]:l},pow:function(r,n){return t.map(r,(function(t){return e.pow(t,n)}))},exp:function(r){return t.map(r,(function(t){return e.exp(t)}))},log:function(r){return t.map(r,(function(t){return e.log(t)}))},abs:function(r){return t.map(r,(function(t){return e.abs(t)}))},norm:function(t,r){var n=0,s=0;for(isNaN(r)&&(r=2),i(t[0])&&(t=t[0]);s<t.length;s++)n+=e.pow(e.abs(t[s]),r);return e.pow(n,1/r)},angle:function(r,n){return e.acos(t.dot(r,n)/(t.norm(r)*t.norm(n)))},aug:function(t,e){var n,i=[];for(n=0;n<t.length;n++)i.push(t[n].slice());for(n=0;n<i.length;n++)r.apply(i[n],e[n]);return i},inv:function(e){for(var r,n=e.length,i=e[0].length,s=t.identity(n,i),a=t.gauss_jordan(e,s),o=[],l=0;l<n;l++)for(o[l]=[],r=i;r<a[0].length;r++)o[l][r-i]=a[l][r];return o},det:function t(e){if(2===e.length)return e[0][0]*e[1][1]-e[0][1]*e[1][0];for(var r=0,n=0;n<e.length;n++){for(var i=[],s=1;s<e.length;s++){i[s-1]=[];for(var a=0;a<e.length;a++)a<n?i[s-1][a]=e[s][a]:a>n&&(i[s-1][a-1]=e[s][a])}var o=n%2?-1:1;r+=t(i)*e[0][n]*o}return r},gauss_elimination:function(r,n){var i,s,a,o,l=0,c=0,h=r.length,u=r[0].length,d=1,p=0,f=[];for(i=(r=t.aug(r,n))[0].length,l=0;l<h;l++){for(s=r[l][l],c=l,o=l+1;o<u;o++)s<e.abs(r[o][l])&&(s=r[o][l],c=o);if(c!=l)for(o=0;o<i;o++)a=r[l][o],r[l][o]=r[c][o],r[c][o]=a;for(c=l+1;c<h;c++)for(d=r[c][l]/r[l][l],o=l;o<i;o++)r[c][o]=r[c][o]-d*r[l][o]}for(l=h-1;l>=0;l--){for(p=0,c=l+1;c<=h-1;c++)p+=f[c]*r[l][c];f[l]=(r[l][i-1]-p)/r[l][l]}return f},gauss_jordan:function(r,n){var i,s,a,o=t.aug(r,n),l=o.length,c=o[0].length,h=0;for(s=0;s<l;s++){var u=s;for(a=s+1;a<l;a++)e.abs(o[a][s])>e.abs(o[u][s])&&(u=a);var d=o[s];for(o[s]=o[u],o[u]=d,a=s+1;a<l;a++)for(h=o[a][s]/o[s][s],i=s;i<c;i++)o[a][i]-=o[s][i]*h}for(s=l-1;s>=0;s--){for(h=o[s][s],a=0;a<s;a++)for(i=c-1;i>s-1;i--)o[a][i]-=o[s][i]*o[a][s]/h;for(o[s][s]/=h,i=l;i<c;i++)o[s][i]/=h}return o},triaUpSolve:function(e,r){var n,i=e[0].length,s=t.zeros(1,i)[0],a=!1;return null!=r[0].length&&(r=r.map((function(t){return t[0]})),a=!0),t.arange(i-1,-1,-1).forEach((function(a){n=t.arange(a+1,i).map((function(t){return s[t]*e[a][t]})),s[a]=(r[a]-t.sum(n))/e[a][a]})),a?s.map((function(t){return[t]})):s},triaLowSolve:function(e,r){var n,i=e[0].length,s=t.zeros(1,i)[0],a=!1;return null!=r[0].length&&(r=r.map((function(t){return t[0]})),a=!0),t.arange(i).forEach((function(i){n=t.arange(i).map((function(t){return e[i][t]*s[t]})),s[i]=(r[i]-t.sum(n))/e[i][i]})),a?s.map((function(t){return[t]})):s},lu:function(e){var r,n=e.length,i=t.identity(n),s=t.zeros(e.length,e[0].length);return t.arange(n).forEach((function(t){s[0][t]=e[0][t]})),t.arange(1,n).forEach((function(a){t.arange(a).forEach((function(n){r=t.arange(n).map((function(t){return i[a][t]*s[t][n]})),i[a][n]=(e[a][n]-t.sum(r))/s[n][n]})),t.arange(a,n).forEach((function(n){r=t.arange(a).map((function(t){return i[a][t]*s[t][n]})),s[a][n]=e[r.length][n]-t.sum(r)}))})),[i,s]},cholesky:function(r){var n,i=r.length,s=t.zeros(r.length,r[0].length);return t.arange(i).forEach((function(a){n=t.arange(a).map((function(t){return e.pow(s[a][t],2)})),s[a][a]=e.sqrt(r[a][a]-t.sum(n)),t.arange(a+1,i).forEach((function(e){n=t.arange(a).map((function(t){return s[a][t]*s[e][t]})),s[e][a]=(r[a][e]-t.sum(n))/s[a][a]}))})),s},gauss_jacobi:function(r,n,i,s){for(var a,o,l,c,h=0,u=0,d=r.length,p=[],f=[],m=[];h<d;h++)for(p[h]=[],f[h]=[],m[h]=[],u=0;u<d;u++)h>u?(p[h][u]=r[h][u],f[h][u]=m[h][u]=0):h<u?(f[h][u]=r[h][u],p[h][u]=m[h][u]=0):(m[h][u]=r[h][u],p[h][u]=f[h][u]=0);for(l=t.multiply(t.multiply(t.inv(m),t.add(p,f)),-1),o=t.multiply(t.inv(m),n),a=i,c=t.add(t.multiply(l,i),o),h=2;e.abs(t.norm(t.subtract(c,a)))>s;)a=c,c=t.add(t.multiply(l,a),o),h++;return c},gauss_seidel:function(r,n,i,s){for(var a,o,l,c,h,u=0,d=r.length,p=[],f=[],m=[];u<d;u++)for(p[u]=[],f[u]=[],m[u]=[],a=0;a<d;a++)u>a?(p[u][a]=r[u][a],f[u][a]=m[u][a]=0):u<a?(f[u][a]=r[u][a],p[u][a]=m[u][a]=0):(m[u][a]=r[u][a],p[u][a]=f[u][a]=0);for(c=t.multiply(t.multiply(t.inv(t.add(m,p)),f),-1),l=t.multiply(t.inv(t.add(m,p)),n),o=i,h=t.add(t.multiply(c,i),l),u=2;e.abs(t.norm(t.subtract(h,o)))>s;)o=h,h=t.add(t.multiply(c,o),l),u+=1;return h},SOR:function(r,n,i,s,a){for(var o,l,c,h,u,d=0,p=r.length,f=[],m=[],b=[];d<p;d++)for(f[d]=[],m[d]=[],b[d]=[],o=0;o<p;o++)d>o?(f[d][o]=r[d][o],m[d][o]=b[d][o]=0):d<o?(m[d][o]=r[d][o],f[d][o]=b[d][o]=0):(b[d][o]=r[d][o],f[d][o]=m[d][o]=0);for(h=t.multiply(t.inv(t.add(b,t.multiply(f,a))),t.subtract(t.multiply(b,1-a),t.multiply(m,a))),c=t.multiply(t.multiply(t.inv(t.add(b,t.multiply(f,a))),n),a),l=i,u=t.add(t.multiply(h,i),c),d=2;e.abs(t.norm(t.subtract(u,l)))>s;)l=u,u=t.add(t.multiply(h,l),c),d++;return u},householder:function(r){for(var n,i,s,a,o=r.length,l=r[0].length,c=0,h=[],u=[];c<o-1;c++){for(n=0,a=c+1;a<l;a++)n+=r[a][c]*r[a][c];for(n=(r[c+1][c]>0?-1:1)*e.sqrt(n),i=e.sqrt((n*n-r[c+1][c]*n)/2),(h=t.zeros(o,1))[c+1][0]=(r[c+1][c]-n)/(2*i),s=c+2;s<o;s++)h[s][0]=r[s][c]/(2*i);u=t.subtract(t.identity(o,l),t.multiply(t.multiply(h,t.transpose(h)),2)),r=t.multiply(u,t.multiply(r,u))}return r},QR:function(){var r=t.sum,n=t.arange;function i(i){var s,a,o,l=i.length,c=i[0].length,h=t.zeros(c,c);for(i=t.copy(i),a=0;a<c;a++){for(h[a][a]=e.sqrt(r(n(l).map((function(t){return i[t][a]*i[t][a]})))),s=0;s<l;s++)i[s][a]=i[s][a]/h[a][a];for(o=a+1;o<c;o++)for(h[a][o]=r(n(l).map((function(t){return i[t][a]*i[t][o]}))),s=0;s<l;s++)i[s][o]=i[s][o]-i[s][a]*h[a][o]}return[i,h]}return i}(),lstsq:function(){function e(e){var r=(e=t.copy(e)).length,n=t.identity(r);return t.arange(r-1,-1,-1).forEach((function(r){t.sliceAssign(n,{row:r},t.divide(t.slice(n,{row:r}),e[r][r])),t.sliceAssign(e,{row:r},t.divide(t.slice(e,{row:r}),e[r][r])),t.arange(r).forEach((function(i){var s=t.multiply(e[i][r],-1),a=t.slice(e,{row:i}),o=t.multiply(t.slice(e,{row:r}),s);t.sliceAssign(e,{row:i},t.add(a,o));var l=t.slice(n,{row:i}),c=t.multiply(t.slice(n,{row:r}),s);t.sliceAssign(n,{row:i},t.add(l,c))}))})),n}function r(r,n){var i=!1;void 0===n[0].length&&(n=n.map((function(t){return[t]})),i=!0);var s=t.QR(r),a=s[0],o=s[1],l=r[0].length,c=t.slice(a,{col:{end:l}}),h=e(t.slice(o,{row:{end:l}})),u=t.transpose(c);void 0===u[0].length&&(u=[u]);var d=t.multiply(t.multiply(h,u),n);return void 0===d.length&&(d=[[d]]),i?d.map((function(t){return t[0]})):d}return r}(),jacobi:function(r){for(var n,i,s,a,o,l,c,h=1,u=r.length,d=t.identity(u,u),p=[];1===h;){for(o=r[0][1],s=0,a=1,n=0;n<u;n++)for(i=0;i<u;i++)n!=i&&o<e.abs(r[n][i])&&(o=e.abs(r[n][i]),s=n,a=i);for(l=r[s][s]===r[a][a]?r[s][a]>0?e.PI/4:-e.PI/4:e.atan(2*r[s][a]/(r[s][s]-r[a][a]))/2,(c=t.identity(u,u))[s][s]=e.cos(l),c[s][a]=-e.sin(l),c[a][s]=e.sin(l),c[a][a]=e.cos(l),d=t.multiply(d,c),r=t.multiply(t.multiply(t.inv(c),r),c),h=0,n=1;n<u;n++)for(i=1;i<u;i++)n!=i&&e.abs(r[n][i])>.001&&(h=1)}for(n=0;n<u;n++)p.push(r[n][n]);return[d,p]},rungekutta:function(t,e,r,n,i,s){var a,o,l;if(2===s)for(;n<=r;)i+=((a=e*t(n,i))+(o=e*t(n+e,i+a)))/2,n+=e;if(4===s)for(;n<=r;)i+=((a=e*t(n,i))+2*(o=e*t(n+e/2,i+a/2))+2*(l=e*t(n+e/2,i+o/2))+e*t(n+e,i+l))/6,n+=e;return i},romberg:function(t,r,n,i){for(var s,a,o,l,c,h=0,u=(n-r)/2,d=[],p=[],f=[];h<i/2;){for(c=t(r),o=r,l=0;o<=n;o+=u,l++)d[l]=o;for(s=d.length,o=1;o<s-1;o++)c+=(o%2!=0?4:2)*t(d[o]);c=u/3*(c+t(n)),f[h]=c,u/=2,h++}for(a=f.length,s=1;1!==a;){for(o=0;o<a-1;o++)p[o]=(e.pow(4,s)*f[o+1]-f[o])/(e.pow(4,s)-1);a=p.length,f=p,p=[],s++}return f},richardson:function(t,r,n,i){function s(t,e){for(var r,n=0,i=t.length;n<i;n++)t[n]===e&&(r=n);return r}for(var a,o,l,c,h,u=e.abs(n-t[s(t,n)+1]),d=0,p=[],f=[];i>=u;)a=s(t,n+i),o=s(t,n),p[d]=(r[a]-2*r[o]+r[2*o-a])/(i*i),i/=2,d++;for(c=p.length,l=1;1!=c;){for(h=0;h<c-1;h++)f[h]=(e.pow(4,l)*p[h+1]-p[h])/(e.pow(4,l)-1);c=f.length,p=f,f=[],l++}return p},simpson:function(t,e,r,n){for(var i,s=(r-e)/n,a=t(e),o=[],l=e,c=0,h=1;l<=r;l+=s,c++)o[c]=l;for(i=o.length;h<i-1;h++)a+=(h%2!=0?4:2)*t(o[h]);return s/3*(a+t(r))},hermite:function(t,e,r,n){for(var i,s=t.length,a=0,o=0,l=[],c=[],h=[],u=[];o<s;o++){for(l[o]=1,i=0;i<s;i++)o!=i&&(l[o]*=(n-t[i])/(t[o]-t[i]));for(c[o]=0,i=0;i<s;i++)o!=i&&(c[o]+=1/(t[o]-t[i]));h[o]=(1-2*(n-t[o])*c[o])*(l[o]*l[o]),u[o]=(n-t[o])*(l[o]*l[o]),a+=h[o]*e[o]+u[o]*r[o]}return a},lagrange:function(t,e,r){for(var n,i,s=0,a=0,o=t.length;a<o;a++){for(i=e[a],n=0;n<o;n++)a!=n&&(i*=(r-t[n])/(t[a]-t[n]));s+=i}return s},cubic_spline:function(e,r,n){for(var i,s=e.length,a=0,o=[],l=[],c=[],h=[],u=[],d=[],p=[];a<s-1;a++)u[a]=e[a+1]-e[a];for(c[0]=0,a=1;a<s-1;a++)c[a]=3/u[a]*(r[a+1]-r[a])-3/u[a-1]*(r[a]-r[a-1]);for(a=1;a<s-1;a++)o[a]=[],l[a]=[],o[a][a-1]=u[a-1],o[a][a]=2*(u[a-1]+u[a]),o[a][a+1]=u[a],l[a][0]=c[a];for(h=t.multiply(t.inv(o),l),i=0;i<s-1;i++)d[i]=(r[i+1]-r[i])/u[i]-u[i]*(h[i+1][0]+2*h[i][0])/3,p[i]=(h[i+1][0]-h[i][0])/(3*u[i]);for(i=0;i<s&&!(e[i]>n);i++);return r[i-=1]+(n-e[i])*d[i]+t.sq(n-e[i])*h[i]+(n-e[i])*t.sq(n-e[i])*p[i]},gauss_quadrature:function(){throw new Error("gauss_quadrature not yet implemented")},PCA:function(e){var r,n,i=e.length,s=e[0].length,a=0,o=[],l=[],c=[],h=[],u=[],d=[],p=[],f=[],m=[],b=[];for(a=0;a<i;a++)o[a]=t.sum(e[a])/s;for(a=0;a<s;a++)for(p[a]=[],r=0;r<i;r++)p[a][r]=e[r][a]-o[r];for(p=t.transpose(p),a=0;a<i;a++)for(f[a]=[],r=0;r<i;r++)f[a][r]=t.dot([p[a]],[p[r]])/(s-1);for(m=(c=t.jacobi(f))[0],l=c[1],b=t.transpose(m),a=0;a<l.length;a++)for(r=a;r<l.length;r++)l[a]<l[r]&&(n=l[a],l[a]=l[r],l[r]=n,h=b[a],b[a]=b[r],b[r]=h);for(d=t.transpose(p),a=0;a<i;a++)for(u[a]=[],r=0;r<d.length;r++)u[a][r]=t.dot([b[a]],[d[r]]);return[e,l,b,u]}}),function(e){for(var r=0;r<e.length;r++)!function(e){t.fn[e]=function(r,n){var i=this;return n?(setTimeout((function(){n.call(i,t.fn[e].call(i,r))}),15),this):"number"==typeof t[e](this,r)?t[e](this,r):t(t[e](this,r))}}(e[r])}("add divide multiply subtract dot pow exp log abs norm angle".split(" "))}(r,Math),function(t,e){var r=[].slice,n=t.utils.isNumber,i=t.utils.isArray;function s(t,r,n,i){if(t>1||n>1||t<=0||n<=0)throw new Error("Proportions should be greater than 0 and less than 1");var s=(t*r+n*i)/(r+i);return(t-n)/e.sqrt(s*(1-s)*(1/r+1/i))}t.extend({zscore:function(){var e=r.call(arguments);return n(e[1])?(e[0]-e[1])/e[2]:(e[0]-t.mean(e[1]))/t.stdev(e[1],e[2])},ztest:function(){var n,s=r.call(arguments);return i(s[1])?(n=t.zscore(s[0],s[1],s[3]),1===s[2]?t.normal.cdf(-e.abs(n),0,1):2*t.normal.cdf(-e.abs(n),0,1)):s.length>2?(n=t.zscore(s[0],s[1],s[2]),1===s[3]?t.normal.cdf(-e.abs(n),0,1):2*t.normal.cdf(-e.abs(n),0,1)):(n=s[0],1===s[1]?t.normal.cdf(-e.abs(n),0,1):2*t.normal.cdf(-e.abs(n),0,1))}}),t.extend(t.fn,{zscore:function(t,e){return(t-this.mean())/this.stdev(e)},ztest:function(r,n,i){var s=e.abs(this.zscore(r,i));return 1===n?t.normal.cdf(-s,0,1):2*t.normal.cdf(-s,0,1)}}),t.extend({tscore:function(){var n=r.call(arguments);return 4===n.length?(n[0]-n[1])/(n[2]/e.sqrt(n[3])):(n[0]-t.mean(n[1]))/(t.stdev(n[1],!0)/e.sqrt(n[1].length))},ttest:function(){var i,s=r.call(arguments);return 5===s.length?(i=e.abs(t.tscore(s[0],s[1],s[2],s[3])),1===s[4]?t.studentt.cdf(-i,s[3]-1):2*t.studentt.cdf(-i,s[3]-1)):n(s[1])?(i=e.abs(s[0]),1==s[2]?t.studentt.cdf(-i,s[1]-1):2*t.studentt.cdf(-i,s[1]-1)):(i=e.abs(t.tscore(s[0],s[1])),1==s[2]?t.studentt.cdf(-i,s[1].length-1):2*t.studentt.cdf(-i,s[1].length-1))}}),t.extend(t.fn,{tscore:function(t){return(t-this.mean())/(this.stdev(!0)/e.sqrt(this.cols()))},ttest:function(r,n){return 1===n?1-t.studentt.cdf(e.abs(this.tscore(r)),this.cols()-1):2*t.studentt.cdf(-e.abs(this.tscore(r)),this.cols()-1)}}),t.extend({anovafscore:function(){var n,i,s,a,o,l,c,h,u=r.call(arguments);if(1===u.length){for(o=new Array(u[0].length),c=0;c<u[0].length;c++)o[c]=u[0][c];u=o}for(i=new Array,c=0;c<u.length;c++)i=i.concat(u[c]);for(s=t.mean(i),n=0,c=0;c<u.length;c++)n+=u[c].length*e.pow(t.mean(u[c])-s,2);for(n/=u.length-1,l=0,c=0;c<u.length;c++)for(a=t.mean(u[c]),h=0;h<u[c].length;h++)l+=e.pow(u[c][h]-a,2);return n/(l/=i.length-u.length)},anovaftest:function(){var e,i,s,a,o=r.call(arguments);if(n(o[0]))return 1-t.centralF.cdf(o[0],o[1],o[2]);var l=t.anovafscore(o);for(e=o.length-1,s=0,a=0;a<o.length;a++)s+=o[a].length;return i=s-e-1,1-t.centralF.cdf(l,e,i)},ftest:function(e,r,n){return 1-t.centralF.cdf(e,r,n)}}),t.extend(t.fn,{anovafscore:function(){return t.anovafscore(this.toArray())},anovaftes:function(){var e,r=0;for(e=0;e<this.length;e++)r+=this[e].length;return t.ftest(this.anovafscore(),this.length-1,r-this.length)}}),t.extend({qscore:function(){var i,s,a,o,l,c=r.call(arguments);return n(c[0])?(i=c[0],s=c[1],a=c[2],o=c[3],l=c[4]):(i=t.mean(c[0]),s=t.mean(c[1]),a=c[0].length,o=c[1].length,l=c[2]),e.abs(i-s)/(l*e.sqrt((1/a+1/o)/2))},qtest:function(){var e,n=r.call(arguments);3===n.length?(e=n[0],n=n.slice(1)):7===n.length?(e=t.qscore(n[0],n[1],n[2],n[3],n[4]),n=n.slice(5)):(e=t.qscore(n[0],n[1],n[2]),n=n.slice(3));var i=n[0],s=n[1];return 1-t.tukey.cdf(e,s,i-s)},tukeyhsd:function(e){for(var r=t.pooledstdev(e),n=e.map((function(e){return t.mean(e)})),i=e.reduce((function(t,e){return t+e.length}),0),s=[],a=0;a<e.length;++a)for(var o=a+1;o<e.length;++o){var l=t.qtest(n[a],n[o],e[a].length,e[o].length,r,i,e.length);s.push([[a,o],l])}return s}}),t.extend({normalci:function(){var n,i=r.call(arguments),s=new Array(2);return n=4===i.length?e.abs(t.normal.inv(i[1]/2,0,1)*i[2]/e.sqrt(i[3])):e.abs(t.normal.inv(i[1]/2,0,1)*t.stdev(i[2])/e.sqrt(i[2].length)),s[0]=i[0]-n,s[1]=i[0]+n,s},tci:function(){var n,i=r.call(arguments),s=new Array(2);return n=4===i.length?e.abs(t.studentt.inv(i[1]/2,i[3]-1)*i[2]/e.sqrt(i[3])):e.abs(t.studentt.inv(i[1]/2,i[2].length-1)*t.stdev(i[2],!0)/e.sqrt(i[2].length)),s[0]=i[0]-n,s[1]=i[0]+n,s},significant:function(t,e){return t<e}}),t.extend(t.fn,{normalci:function(e,r){return t.normalci(e,r,this.toArray())},tci:function(e,r){return t.tci(e,r,this.toArray())}}),t.extend(t.fn,{oneSidedDifferenceOfProportions:function(e,r,n,i){var a=s(e,r,n,i);return t.ztest(a,1)},twoSidedDifferenceOfProportions:function(e,r,n,i){var a=s(e,r,n,i);return t.ztest(a,2)}})}(r,Math),r.models=function(){function t(t){var n=t[0].length,i=r.arange(n).map((function(i){var s=r.arange(n).filter((function(t){return t!==i}));return e(r.col(t,i).map((function(t){return t[0]})),r.col(t,s))}));return i}function e(t,e){var n=t.length,i=e[0].length-1,s=n-i-1,a=r.lstsq(e,t),o=r.multiply(e,a.map((function(t){return[t]}))).map((function(t){return t[0]})),l=r.subtract(t,o),c=r.mean(t),h=r.sum(o.map((function(t){return Math.pow(t-c,2)}))),u=r.sum(t.map((function(t,e){return Math.pow(t-o[e],2)}))),d=h+u;return{exog:e,endog:t,nobs:n,df_model:i,df_resid:s,coef:a,predict:o,resid:l,ybar:c,SST:d,SSE:h,SSR:u,R2:h/d}}function n(e){var n=t(e.exog),i=Math.sqrt(e.SSR/e.df_resid),s=n.map((function(t){var e=t.SST,r=t.R2;return i/Math.sqrt(e*(1-r))})),a=e.coef.map((function(t,e){return(t-0)/s[e]})),o=a.map((function(t){var n=r.studentt.cdf(t,e.df_resid);return 2*(n>.5?1-n:n)})),l=r.studentt.inv(.975,e.df_resid),c=e.coef.map((function(t,e){var r=l*s[e];return[t-r,t+r]}));return{se:s,t:a,p:o,sigmaHat:i,interval95:c}}function i(t){var e=t.R2/t.df_model/((1-t.R2)/t.df_resid),n=function(t,e,n){return r.beta.cdf(t/(n/e+t),e/2,n/2)};return{F_statistic:e,pvalue:1-n(e,t.df_model,t.df_resid)}}function s(t,r){var s=e(t,r),a=n(s),o=i(s),l=1-(1-s.R2)*((s.nobs-1)/s.df_resid);return s.t=a,s.f=o,s.adjust_R2=l,s}return{ols:s}}(),r.extend({buildxmatrix:function(){for(var t=new Array(arguments.length),e=0;e<arguments.length;e++){var n=[1];t[e]=n.concat(arguments[e])}return r(t)},builddxmatrix:function(){for(var t=new Array(arguments[0].length),e=0;e<arguments[0].length;e++){var n=[1];t[e]=n.concat(arguments[0][e])}return r(t)},buildjxmatrix:function(t){for(var e=new Array(t.length),n=0;n<t.length;n++)e[n]=t[n];return r.builddxmatrix(e)},buildymatrix:function(t){return r(t).transpose()},buildjymatrix:function(t){return t.transpose()},matrixmult:function(t,e){var n,i,s,a,o;if(t.cols()==e.rows()){if(e.rows()>1){for(a=[],n=0;n<t.rows();n++)for(a[n]=[],i=0;i<e.cols();i++){for(o=0,s=0;s<t.cols();s++)o+=t.toArray()[n][s]*e.toArray()[s][i];a[n][i]=o}return r(a)}for(a=[],n=0;n<t.rows();n++)for(a[n]=[],i=0;i<e.cols();i++){for(o=0,s=0;s<t.cols();s++)o+=t.toArray()[n][s]*e.toArray()[i];a[n][i]=o}return r(a)}},regress:function(t,e){var n=r.xtranspxinv(t),i=t.transpose(),s=r.matrixmult(r(n),i);return r.matrixmult(s,e)},regresst:function(t,e,n){var i=r.regress(t,e),s={anova:{}},a=r.jMatYBar(t,i);s.yBar=a;var o=e.mean();s.anova.residuals=r.residuals(e,a),s.anova.ssr=r.ssr(a,o),s.anova.msr=s.anova.ssr/(t[0].length-1),s.anova.sse=r.sse(e,a),s.anova.mse=s.anova.sse/(e.length-(t[0].length-1)-1),s.anova.sst=r.sst(e,o),s.anova.mst=s.anova.sst/(e.length-1),s.anova.r2=1-s.anova.sse/s.anova.sst,s.anova.r2<0&&(s.anova.r2=0),s.anova.fratio=s.anova.msr/s.anova.mse,s.anova.pvalue=r.anovaftest(s.anova.fratio,t[0].length-1,e.length-(t[0].length-1)-1),s.anova.rmse=Math.sqrt(s.anova.mse),s.anova.r2adj=1-s.anova.mse/s.anova.mst,s.anova.r2adj<0&&(s.anova.r2adj=0),s.stats=new Array(t[0].length);for(var l,c,h,u=r.xtranspxinv(t),d=0;d<i.length;d++)l=Math.sqrt(s.anova.mse*Math.abs(u[d][d])),c=Math.abs(i[d]/l),h=r.ttest(c,e.length-t[0].length-1,n),s.stats[d]=[i[d],l,c,h];return s.regress=i,s},xtranspx:function(t){return r.matrixmult(t.transpose(),t)},xtranspxinv:function(t){var e=r.matrixmult(t.transpose(),t);return r.inv(e)},jMatYBar:function(t,e){var n=r.matrixmult(t,e);return new r(n)},residuals:function(t,e){return r.matrixsubtract(t,e)},ssr:function(t,e){for(var r=0,n=0;n<t.length;n++)r+=Math.pow(t[n]-e,2);return r},sse:function(t,e){for(var r=0,n=0;n<t.length;n++)r+=Math.pow(t[n]-e[n],2);return r},sst:function(t,e){for(var r=0,n=0;n<t.length;n++)r+=Math.pow(t[n]-e,2);return r},matrixsubtract:function(t,e){for(var n=new Array(t.length),i=0;i<t.length;i++){n[i]=new Array(t[i].length);for(var s=0;s<t[i].length;s++)n[i][s]=t[i][s]-e[i][s]}return r(n)}}),r.jStat=r,r)}(Bo);class Vo{static hM2Hr(t,e){return 0===t&&0===e?0:t/(t+e)}static faCr2Far(t,e){return 0===t&&0===e?0:t/(t+e)}static hMFaCr2Acc(t,e,r,n){return 0===t&&0===e&&0===r&&0===n?0:(t+n)/(t+e+r+n)}static hrFar2Acc(t,e){return(t+(1-e))/2}static hFa2Ppv(t,e){return 0===t&&0===e?0:t/(t+e)}static mCr2Fomr(t,e){return 0===t&&0===e?0:t/(t+e)}static hrFar2D(t,e,r=1){return 1===r?jo.normal.inv(t,0,1)-jo.normal.inv(e,0,1):Math.sqrt(2/(r*r+1))*(r*jo.normal.inv(t,0,1)-jo.normal.inv(e,0,1))}static hrFar2C(t,e,r=1){return 1===r?-(jo.normal.inv(t,0,1)+jo.normal.inv(e,0,1))/2:Math.sqrt(2/(r*r+1))*(r/(r+1))*-(jo.normal.inv(t,0,1)+jo.normal.inv(e,0,1))}static dC2Hr(t,e,r=1){return 1===r?jo.normal.cdf(t/2-e,0,1):jo.normal.cdf(Math.sqrt((r*r+1)/2)*(t/(1+r)-e/r),0,1)}static dC2Far(t,e,r=1){return 1===r?jo.normal.cdf(-(t/2+e),0,1):jo.normal.cdf(Math.sqrt((r*r+1)/2)*-(t/(1+r)+e),0,1)}static dFar2Hr(t,e,r=1){return 1===r?jo.normal.cdf(t+jo.normal.inv(e,0,1),0,1):jo.normal.cdf((Math.sqrt((r*r+1)/2)*t+jo.normal.inv(e,0,1))/r,0,1)}static cFar2Hr(t,e,r=1){return 1===r?jo.normal.cdf(-2*t-jo.normal.inv(e,0,1),0,1):jo.normal.cdf(-Math.sqrt((r*r+1)/2)*((r+1)/r)*t-jo.normal.inv(e,0,1),0,1)}static d2MuN(t,e=1){return 1===e?-t/2:-Math.sqrt((e*e+1)/2)*(1/(e+1))*t}static muN2D(t,e=1){return 1===e?-2*t:-Math.sqrt(2/(e*e+1))*(e+1)*t}static d2MuS(t,e=1){return 1===e?t/2:Math.sqrt((e*e+1)/2)*(e/(e+1))*t}static muS2D(t,e=1){return 1===e?2*t:Math.sqrt(2/(e*e+1))*((e+1)/e)*t}static c2L(t,e=1){return 1===e?t:Math.sqrt((e*e+1)/2)*t}static l2C(t,e=1){return 1===e?t:Math.sqrt(2/(e*e+1))*t}static s2H(t=1){return 1/(t*Math.sqrt(2*Math.PI))}static h2S(t){return 1/(t*Math.sqrt(2*Math.PI))}static hr2Zhr(t){return jo.normal.inv(t,0,1)}static far2Zfar(t){return jo.normal.inv(t,0,1)}static zhr2Hr(t){return jo.normal.cdf(t,0,1)}static zfar2Far(t){return jo.normal.cdf(t,0,1)}}class Ko extends Io{static get properties(){return{contour:{attribute:"contour",type:String,reflect:!0},point:{attribute:"point",type:String,reflect:!0},isoD:{attribute:"iso-d",type:String,reflect:!0},isoC:{attribute:"iso-c",type:String,reflect:!0},zRoc:{attribute:"z-roc",type:Boolean,reflect:!0},far:{attribute:"far",type:Number,reflect:!0},hr:{attribute:"hr",type:Number,reflect:!0},d:{attribute:!1,type:Number,reflect:!1},c:{attribute:!1,type:Number,reflect:!1},s:{attribute:!1,type:Number,reflect:!1},width:{attribute:!1,type:Number,reflect:!1},height:{attribute:!1,type:Number,reflect:!1},rem:{attribute:!1,type:Number,reflect:!1}}}constructor(){super(),this.firstUpdate=!0,this.drag=!1,this.sdt=!1,this.contours=["sensitivity","bias","accuracy"],this.contour=void 0,this.points=["all","first","rest","none"],this.point="all",this.isoDs=["all","first","rest","none"],this.isoD="first",this.isoCs=["all","first","rest","none"],this.isoC="first",this.zRoc=!1,this.far=.25,this.hr=.75,this.s=1,this.label="",this.locations=[{name:"default",far:this.far,hr:this.hr,s:this.s,label:""}],this.pointArray=[],this.isoDArray=[],this.isoCArray=[],this.width=NaN,this.height=NaN,this.rem=NaN,this.alignState()}alignState(){this.locations[0].hr=this.hr,this.locations[0].far=this.far,this.locations[0].s=this.s,this.locations[0].label=this.label,this.d=Vo.hrFar2D(this.hr,this.far,this.s),this.c=Vo.hrFar2C(this.hr,this.far,this.s),this.pointArray=[],this.isoDArray=[],this.isoCArray=[],this.locations.forEach(((t,e)=>{t.d=Vo.hrFar2D(t.hr,t.far,t.s),t.c=Vo.hrFar2C(t.hr,t.far,t.s),0!==e||"first"!==this.point&&"all"!==this.point?e>0&&("rest"===this.point||"all"===this.point)&&this.pointArray.push(t):this.pointArray.push(t),0!==e||"first"!==this.isoD&&"all"!==this.isoD?e>0&&("rest"===this.isoD||"all"===this.isoD)&&this.isoDArray.push(t):this.isoDArray.push(t),0!==e||"first"!==this.isoC&&"all"!==this.isoC?e>0&&("rest"===this.isoC||"all"===this.isoC)&&this.isoCArray.push(t):this.isoCArray.push(t)}))}set(t,e,r="default",n="",i=1){"default"===r&&(this.hr=t,this.far=e,this.s=i,this.label=n);const s=this.locations.find((t=>t.name===r));void 0===s?this.locations.push({name:r,far:e,hr:t,s:i,label:n}):(s.hr=t,s.far=e,s.s=i,s.label=n),this.requestUpdate()}setWithSDT(t,e,r="default",n="",i=1){"default"===r&&(this.hr=Vo.dC2Hr(t,e,i),this.far=Vo.dC2Far(t,e,i),this.s=i,this.label=n);const s=this.locations.find((t=>t.name===r));void 0===s?this.locations.push({name:r,far:Vo.dC2Far(t,e,i),hr:Vo.dC2Hr(t,e,i),s:i,label:n}):(s.hr=Vo.dC2Hr(t,e,i),s.far=Vo.dC2Far(t,e,i),s.s=i,s.label=n),this.sdt=!0,this.requestUpdate()}static get styles(){return[super.styles,Q`
|
|
880
|
+
`]}render(){return Pt``}getDimensions(){this.width=parseFloat(this.getComputedStyleValue("width"),10),this.height=parseFloat(this.getComputedStyleValue("height"),10),this.rem=parseFloat(getComputedStyle(document.documentElement).getPropertyValue("font-size"),10)}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.getDimensions.bind(this))}disconnectedCallback(){window.removeEventListener("resize",this.getDimensions.bind(this)),super.disconnectedCallback()}firstUpdated(t){super.firstUpdated(t),this.getDimensions()}update(t){if(super.update(t),Number.isNaN(this.width)||Number.isNaN(this.height)||Number.isNaN(this.rem))return;const e=this.width,r=this.height,n=Math.min(e,r),i=.25*this.rem,s=.25*this.rem,a=.25*this.rem,o=n-(i+s),l=n-(a+.25*this.rem);this.xScale=Ro().domain([-1,1]).range([0,l]),this.yScale=Ro().domain([1,-1]).range([0,o]);const c=Zr(this.renderRoot).selectAll(".main").data([{width:this.width,height:this.height,rem:this.rem}]),h=c.enter().append("svg").classed("main",!0),u=h.merge(c).attr("viewBox",`0 0 ${n} ${n}`);h.append("clipPath").attr("id","clip-rdk-task").append("circle"),u.select("clipPath circle").attr("cx",this.xScale(0)).attr("cy",this.yScale(0)).attr("r",this.xScale(1)-this.xScale(0));const d=h.append("g").classed("plot",!0),p=u.select(".plot").attr("transform",`translate(${a}, ${i})`),f=d.append("g").classed("underlayer",!0),m=p.select(".underlayer");f.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)),d.append("g").classed("content",!0).attr("clip-path","url(#clip-rdk-task)");p.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=d.append("g").classed("overlayer",!0),v=p.select(".overlayer");b.append("circle").classed("outline",!0),v.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+=gi()-this.pauseTime,this.pauseTime=0),this.runner=function(t,e,r){var n=new wi,i=e;return null==e?(n.restart(t,e,r),n):(n._restart=n.restart,n.restart=function(t,e,r){e=+e,r=null==r?gi():+r,n._restart((function s(a){a+=i,n._restart(s,i+=e,r),t(a)}),e,r)},n.restart(t,e,r),n)}(this.run.bind(this),20)):void 0!==this.runner&&(this.runner.stop(),this.pauseTime=gi())),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=Zr(this.renderRoot).select(".content").selectAll(".dots").data([[],[]]).selectAll(".dot").data((t=>t));t.exit().remove();Zr(this.renderRoot).select(".content").selectAll(".fixation").data([]).exit().remove();Zr(this.renderRoot).select(".content").selectAll(".query").data([]).exit().remove()}run(){const t=gi(),e=this.baseTime?t-this.baseTime:0,r=this.baseTime?e-this.startTime:0,n=this.baseTime?e-this.lastTime:0;this.lastTime=e;let i=!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&&r>=this.iti?(i=!0,this.trial+=1,this.state="stimulus",this.startTime=e,this.signal=Math.random()<this.probability?"present":"absent",this.currentDirection="absent"===this.signal?void 0:this.direction>=0?this.direction:360*Math.random(),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&&r>=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&&r>=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="present"===this.signal?Math.round(this.count*this.coherence):0,this.dots[this.RANDOM].length="present"===this.signal?this.count-this.dots[this.COHERENT].length:this.count;for(let t=0;t<this.dots.length;t+=1)for(let r=0;r<this.dots[t].length;r+=1){const s=void 0===this.dots[t][r];s&&(this.dots[t][r]={});const a=this.dots[t][r];if(i||s){a.direction=t===this.RANDOM?360*Math.random():this.currentDirection,a.birth=e-Math.floor(Math.random()*this.lifetime);const r=2*Math.random()*Math.PI,n=Math.sqrt(Math.random());a.x=this.xScale(n*Math.cos(r)),a.y=this.yScale(n*Math.sin(r))}else if(e>a.birth+this.lifetime){a.birth+=this.lifetime,a.direction=t===this.RANDOM?360*Math.random():this.currentDirection;const e=2*Math.random()*Math.PI,r=Math.sqrt(Math.random());a.x=this.xScale(r*Math.cos(e)),a.y=this.yScale(r*Math.sin(e))}else{t===this.COHERENT&&(a.direction=this.currentDirection);const e=a.direction*(Math.PI/180);a.dx=this.speed*(n/1e3)*Math.cos(e),a.dy=this.speed*(n/1e3)*Math.sin(e),a.x+=a.dx,a.y+=a.dy;(a.x-this.xScale(0))**2+(a.y-this.yScale(0))**2>(this.xScale(1)-this.xScale(0))**2&&(a.x=-(a.x-this.xScale(0))+this.xScale(0),a.y=-(a.y-this.yScale(0))+this.yScale(0))}}}const s=Zr(this.renderRoot).select(".content").selectAll(".fixation").data("iti"===this.state?[!0]:[]),a=s.enter().append("g").classed("fixation",!0);a.append("line").attr("x1",this.xScale(-.1)).attr("y1",this.xScale(0)).attr("x2",this.xScale(.1)).attr("y2",this.xScale(0)),a.append("line").attr("x1",this.xScale(0)).attr("y1",this.xScale(-.1)).attr("x2",this.xScale(0)).attr("y2",this.xScale(.1)),s.exit().remove();const o=Zr(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=Zr(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-task",Ko);"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function Wo(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Xo={exports:{}};!function(t,e){t.exports=function(){var t=function(t,e){var r=Array.prototype.concat,n=Array.prototype.slice,i=Object.prototype.toString;function s(e,r){var n=e>r?e:r;return t.pow(10,17-~~(t.log(n>0?n:-n)*t.LOG10E))}var a=Array.isArray||function(t){return"[object Array]"===i.call(t)};function o(t){return"[object Function]"===i.call(t)}function l(t){return"number"==typeof t&&t-t==0}function c(t){return r.apply([],t)}function h(){return new h._init(arguments)}function u(){return 0}function d(){return 1}function p(t,e){return t===e?1:0}h.fn=h.prototype,h._init=function(t){if(a(t[0]))if(a(t[0][0])){o(t[1])&&(t[0]=h.map(t[0],t[1]));for(var e=0;e<t[0].length;e++)this[e]=t[0][e];this.length=t[0].length}else this[0]=o(t[1])?h.map(t[0],t[1]):t[0],this.length=1;else if(l(t[0]))this[0]=h.seq.apply(null,t),this.length=1;else{if(t[0]instanceof h)return h(t[0].toArray());this[0]=[],this.length=1}return this},h._init.prototype=h.prototype,h._init.constructor=h,h.utils={calcRdx:s,isArray:a,isFunction:o,isNumber:l,toVector:c},h._random_fn=t.random,h.setRandom=function(t){if("function"!=typeof t)throw new TypeError("fn is not a function");h._random_fn=t},h.extend=function(t){var e,r;if(1===arguments.length){for(r in t)h[r]=t[r];return this}for(e=1;e<arguments.length;e++)for(r in arguments[e])t[r]=arguments[e][r];return t},h.rows=function(t){return t.length||1},h.cols=function(t){return t[0].length||1},h.dimensions=function(t){return{rows:h.rows(t),cols:h.cols(t)}},h.row=function(t,e){return a(e)?e.map((function(e){return h.row(t,e)})):t[e]},h.rowa=function(t,e){return h.row(t,e)},h.col=function(t,e){if(a(e)){var r=h.arange(t.length).map((function(){return new Array(e.length)}));return e.forEach((function(e,n){h.arange(t.length).forEach((function(i){r[i][n]=t[i][e]}))})),r}for(var n=new Array(t.length),i=0;i<t.length;i++)n[i]=[t[i][e]];return n},h.cola=function(t,e){return h.col(t,e).map((function(t){return t[0]}))},h.diag=function(t){for(var e=h.rows(t),r=new Array(e),n=0;n<e;n++)r[n]=[t[n][n]];return r},h.antidiag=function(t){for(var e=h.rows(t)-1,r=new Array(e),n=0;e>=0;e--,n++)r[n]=[t[n][e]];return r},h.transpose=function(t){var e,r,n,i,s,o=[];for(a(t[0])||(t=[t]),r=t.length,n=t[0].length,s=0;s<n;s++){for(e=new Array(r),i=0;i<r;i++)e[i]=t[i][s];o.push(e)}return 1===o.length?o[0]:o},h.map=function(t,e,r){var n,i,s,o,l;for(a(t[0])||(t=[t]),i=t.length,s=t[0].length,o=r?t:new Array(i),n=0;n<i;n++)for(o[n]||(o[n]=new Array(s)),l=0;l<s;l++)o[n][l]=e(t[n][l],n,l);return 1===o.length?o[0]:o},h.cumreduce=function(t,e,r){var n,i,s,o,l;for(a(t[0])||(t=[t]),i=t.length,s=t[0].length,o=r?t:new Array(i),n=0;n<i;n++)for(o[n]||(o[n]=new Array(s)),s>0&&(o[n][0]=t[n][0]),l=1;l<s;l++)o[n][l]=e(o[n][l-1],t[n][l]);return 1===o.length?o[0]:o},h.alter=function(t,e){return h.map(t,e,!0)},h.create=function(t,e,r){var n,i,s=new Array(t);for(o(e)&&(r=e,e=t),n=0;n<t;n++)for(s[n]=new Array(e),i=0;i<e;i++)s[n][i]=r(n,i);return s},h.zeros=function(t,e){return l(e)||(e=t),h.create(t,e,u)},h.ones=function(t,e){return l(e)||(e=t),h.create(t,e,d)},h.rand=function(t,e){return l(e)||(e=t),h.create(t,e,h._random_fn)},h.identity=function(t,e){return l(e)||(e=t),h.create(t,e,p)},h.symmetric=function(t){var e,r,n=t.length;if(t.length!==t[0].length)return!1;for(e=0;e<n;e++)for(r=0;r<n;r++)if(t[r][e]!==t[e][r])return!1;return!0},h.clear=function(t){return h.alter(t,u)},h.seq=function(t,e,r,n){o(n)||(n=!1);var i,a=[],l=s(t,e),c=(e*l-t*l)/((r-1)*l),h=t;for(i=0;h<=e&&i<r;h=(t*l+c*l*++i)/l)a.push(n?n(h,i):h);return a},h.arange=function(t,r,n){var i,s=[];if(n=n||1,r===e&&(r=t,t=0),t===r||0===n)return[];if(t<r&&n<0)return[];if(t>r&&n>0)return[];if(n>0)for(i=t;i<r;i+=n)s.push(i);else for(i=t;i>r;i+=n)s.push(i);return s},h.slice=function(){function t(t,r,n,i){var s,a=[],o=t.length;if(r===e&&n===e&&i===e)return h.copy(t);if(i=i||1,(r=(r=r||0)>=0?r:o+r)===(n=(n=n||t.length)>=0?n:o+n)||0===i)return[];if(r<n&&i<0)return[];if(r>n&&i>0)return[];if(i>0)for(s=r;s<n;s+=i)a.push(t[s]);else for(s=r;s>n;s+=i)a.push(t[s]);return a}function r(e,r){var n,i;return l((r=r||{}).row)?l(r.col)?e[r.row][r.col]:t(h.rowa(e,r.row),(n=r.col||{}).start,n.end,n.step):l(r.col)?t(h.cola(e,r.col),(i=r.row||{}).start,i.end,i.step):(i=r.row||{},n=r.col||{},t(e,i.start,i.end,i.step).map((function(e){return t(e,n.start,n.end,n.step)})))}return r}(),h.sliceAssign=function(r,n,i){var s,a;if(l(n.row)){if(l(n.col))return r[n.row][n.col]=i;n.col=n.col||{},n.col.start=n.col.start||0,n.col.end=n.col.end||r[0].length,n.col.step=n.col.step||1,s=h.arange(n.col.start,t.min(r.length,n.col.end),n.col.step);var o=n.row;return s.forEach((function(t,e){r[o][t]=i[e]})),r}if(l(n.col)){n.row=n.row||{},n.row.start=n.row.start||0,n.row.end=n.row.end||r.length,n.row.step=n.row.step||1,a=h.arange(n.row.start,t.min(r[0].length,n.row.end),n.row.step);var c=n.col;return a.forEach((function(t,e){r[t][c]=i[e]})),r}return i[0].length===e&&(i=[i]),n.row.start=n.row.start||0,n.row.end=n.row.end||r.length,n.row.step=n.row.step||1,n.col.start=n.col.start||0,n.col.end=n.col.end||r[0].length,n.col.step=n.col.step||1,a=h.arange(n.row.start,t.min(r.length,n.row.end),n.row.step),s=h.arange(n.col.start,t.min(r[0].length,n.col.end),n.col.step),a.forEach((function(t,e){s.forEach((function(n,s){r[t][n]=i[e][s]}))})),r},h.diagonal=function(t){var e=h.zeros(t.length,t.length);return t.forEach((function(t,r){e[r][r]=t})),e},h.copy=function(t){return t.map((function(t){return l(t)?t:t.map((function(t){return t}))}))};var f=h.prototype;return f.length=0,f.push=Array.prototype.push,f.sort=Array.prototype.sort,f.splice=Array.prototype.splice,f.slice=Array.prototype.slice,f.toArray=function(){return this.length>1?n.call(this):n.call(this)[0]},f.map=function(t,e){return h(h.map(this,t,e))},f.cumreduce=function(t,e){return h(h.cumreduce(this,t,e))},f.alter=function(t){return h.alter(this,t),this},function(t){for(var e=0;e<t.length;e++)!function(t){f[t]=function(e){var r,n=this;return e?(setTimeout((function(){e.call(n,f[t].call(n))})),this):(r=h[t](this),a(r)?h(r):r)}}(t[e])}("transpose clear symmetric rows cols dimensions diag antidiag".split(" ")),function(t){for(var e=0;e<t.length;e++)!function(t){f[t]=function(e,r){var n=this;return r?(setTimeout((function(){r.call(n,f[t].call(n,e))})),this):h(h[t](this,e))}}(t[e])}("row col".split(" ")),function(t){for(var e=0;e<t.length;e++)!function(t){f[t]=function(){return h(h[t].apply(null,arguments))}}(t[e])}("create zeros ones rand identity".split(" ")),h}(Math);return function(t,e){var r=t.utils.isFunction;function n(t,e){return t-e}function i(t,r,n){return e.max(r,e.min(t,n))}t.sum=function(t){for(var e=0,r=t.length;--r>=0;)e+=t[r];return e},t.sumsqrd=function(t){for(var e=0,r=t.length;--r>=0;)e+=t[r]*t[r];return e},t.sumsqerr=function(e){for(var r,n=t.mean(e),i=0,s=e.length;--s>=0;)i+=(r=e[s]-n)*r;return i},t.sumrow=function(t){for(var e=0,r=t.length;--r>=0;)e+=t[r];return e},t.product=function(t){for(var e=1,r=t.length;--r>=0;)e*=t[r];return e},t.min=function(t){for(var e=t[0],r=0;++r<t.length;)t[r]<e&&(e=t[r]);return e},t.max=function(t){for(var e=t[0],r=0;++r<t.length;)t[r]>e&&(e=t[r]);return e},t.unique=function(t){for(var e={},r=[],n=0;n<t.length;n++)e[t[n]]||(e[t[n]]=!0,r.push(t[n]));return r},t.mean=function(e){return t.sum(e)/e.length},t.meansqerr=function(e){return t.sumsqerr(e)/e.length},t.geomean=function(r){var n=r.map(e.log),i=t.mean(n);return e.exp(i)},t.median=function(t){var e=t.length,r=t.slice().sort(n);return 1&e?r[e/2|0]:(r[e/2-1]+r[e/2])/2},t.cumsum=function(e){return t.cumreduce(e,(function(t,e){return t+e}))},t.cumprod=function(e){return t.cumreduce(e,(function(t,e){return t*e}))},t.diff=function(t){var e,r=[],n=t.length;for(e=1;e<n;e++)r.push(t[e]-t[e-1]);return r},t.rank=function(t){var e,r=[],i={};for(e=0;e<t.length;e++)i[l=t[e]]?i[l]++:(i[l]=1,r.push(l));var s=r.sort(n),a={},o=1;for(e=0;e<s.length;e++){var l,c=i[l=s[e]],h=(o+(o+c-1))/2;a[l]=h,o+=c}return t.map((function(t){return a[t]}))},t.mode=function(t){var e,r=t.length,i=t.slice().sort(n),s=1,a=0,o=0,l=[];for(e=0;e<r;e++)i[e]===i[e+1]?s++:(s>a?(l=[i[e]],a=s,o=0):s===a&&(l.push(i[e]),o++),s=1);return 0===o?l[0]:l},t.range=function(e){return t.max(e)-t.min(e)},t.variance=function(e,r){return t.sumsqerr(e)/(e.length-(r?1:0))},t.pooledvariance=function(e){var r=e.reduce((function(e,r){return e+t.sumsqerr(r)}),0),n=e.reduce((function(t,e){return t+e.length}),0);return r/(n-e.length)},t.deviation=function(e){for(var r=t.mean(e),n=e.length,i=new Array(n),s=0;s<n;s++)i[s]=e[s]-r;return i},t.stdev=function(r,n){return e.sqrt(t.variance(r,n))},t.pooledstdev=function(r){return e.sqrt(t.pooledvariance(r))},t.meandev=function(r){for(var n=t.mean(r),i=[],s=r.length-1;s>=0;s--)i.push(e.abs(r[s]-n));return t.mean(i)},t.meddev=function(r){for(var n=t.median(r),i=[],s=r.length-1;s>=0;s--)i.push(e.abs(r[s]-n));return t.median(i)},t.coeffvar=function(e){return t.stdev(e)/t.mean(e)},t.quartiles=function(t){var r=t.length,i=t.slice().sort(n);return[i[e.round(r/4)-1],i[e.round(r/2)-1],i[e.round(3*r/4)-1]]},t.quantiles=function(t,r,s,a){var o,l,c,h,u,d=t.slice().sort(n),p=[r.length],f=t.length;for(void 0===s&&(s=3/8),void 0===a&&(a=3/8),o=0;o<r.length;o++)c=f*(l=r[o])+(s+l*(1-s-a)),h=e.floor(i(c,1,f-1)),u=i(c-h,0,1),p[o]=(1-u)*d[h-1]+u*d[h];return p},t.percentile=function(t,e,r){var i=t.slice().sort(n),s=e*(i.length+(r?1:-1))+(r?0:1),a=parseInt(s),o=s-a;return a+1<i.length?i[a-1]+o*(i[a]-i[a-1]):i[a-1]},t.percentileOfScore=function(t,e,r){var n,i,s=0,a=t.length,o=!1;for("strict"===r&&(o=!0),i=0;i<a;i++)n=t[i],(o&&n<e||!o&&n<=e)&&s++;return s/a},t.histogram=function(r,n){n=n||4;var i,s=t.min(r),a=(t.max(r)-s)/n,o=r.length,l=[];for(i=0;i<n;i++)l[i]=0;for(i=0;i<o;i++)l[e.min(e.floor((r[i]-s)/a),n-1)]+=1;return l},t.covariance=function(e,r){var n,i=t.mean(e),s=t.mean(r),a=e.length,o=new Array(a);for(n=0;n<a;n++)o[n]=(e[n]-i)*(r[n]-s);return t.sum(o)/(a-1)},t.corrcoeff=function(e,r){return t.covariance(e,r)/t.stdev(e,1)/t.stdev(r,1)},t.spearmancoeff=function(e,r){return e=t.rank(e),r=t.rank(r),t.corrcoeff(e,r)},t.stanMoment=function(r,n){for(var i=t.mean(r),s=t.stdev(r),a=r.length,o=0,l=0;l<a;l++)o+=e.pow((r[l]-i)/s,n);return o/r.length},t.skewness=function(e){return t.stanMoment(e,3)},t.kurtosis=function(e){return t.stanMoment(e,4)-3};var s=t.prototype;!function(e){for(var n=0;n<e.length;n++)!function(e){s[e]=function(n,i){var a=[],o=0,l=this;if(r(n)&&(i=n,n=!1),i)return setTimeout((function(){i.call(l,s[e].call(l,n))})),this;if(this.length>1){for(l=!0===n?this:this.transpose();o<l.length;o++)a[o]=t[e](l[o]);return a}return t[e](this[0],n)}}(e[n])}("cumsum cumprod".split(" ")),function(e){for(var n=0;n<e.length;n++)!function(e){s[e]=function(n,i){var a=[],o=0,l=this;if(r(n)&&(i=n,n=!1),i)return setTimeout((function(){i.call(l,s[e].call(l,n))})),this;if(this.length>1){for("sumrow"!==e&&(l=!0===n?this:this.transpose());o<l.length;o++)a[o]=t[e](l[o]);return!0===n?t[e](t.utils.toVector(a)):a}return t[e](this[0],n)}}(e[n])}("sum sumsqrd sumsqerr sumrow product min max unique mean meansqerr geomean median diff rank mode range variance deviation stdev meandev meddev coeffvar quartiles histogram skewness kurtosis".split(" ")),function(e){for(var n=0;n<e.length;n++)!function(e){s[e]=function(){var n,i=[],a=0,o=this,l=Array.prototype.slice.call(arguments);if(r(l[l.length-1])){n=l[l.length-1];var c=l.slice(0,l.length-1);return setTimeout((function(){n.call(o,s[e].apply(o,c))})),this}n=void 0;var h=function(r){return t[e].apply(o,[r].concat(l))};if(this.length>1){for(o=o.transpose();a<o.length;a++)i[a]=h(o[a]);return i}return h(this[0])}}(e[n])}("quantiles percentileOfScore".split(" "))}(t,Math),function(t,e){t.gammaln=function(t){var r,n,i,s=0,a=[76.18009172947146,-86.50532032941678,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18],o=1.000000000190015;for(i=(n=r=t)+5.5,i-=(r+.5)*e.log(i);s<6;s++)o+=a[s]/++n;return e.log(2.5066282746310007*o/r)-i},t.loggam=function(t){var r,n,i,s,a,o,l,c=[.08333333333333333,-.002777777777777778,.0007936507936507937,-.0005952380952380952,.0008417508417508418,-.001917526917526918,.00641025641025641,-.02955065359477124,.1796443723688307,-1.3924322169059];if(r=t,l=0,1==t||2==t)return 0;for(t<=7&&(r=t+(l=e.floor(7-t))),n=1/(r*r),i=2*e.PI,a=c[9],o=8;o>=0;o--)a*=n,a+=c[o];if(s=a/r+.5*e.log(i)+(r-.5)*e.log(r)-r,t<=7)for(o=1;o<=l;o++)s-=e.log(r-1),r-=1;return s},t.gammafn=function(t){var r,n,i,s,a=[-1.716185138865495,24.76565080557592,-379.80425647094563,629.3311553128184,866.9662027904133,-31451.272968848367,-36144.413418691176,66456.14382024054],o=[-30.8402300119739,315.35062697960416,-1015.1563674902192,-3107.771671572311,22538.11842098015,4755.846277527881,-134659.9598649693,-115132.2596755535],l=!1,c=0,h=0,u=0,d=t;if(t>171.6243769536076)return 1/0;if(d<=0){if(!(s=d%1+36e-17))return 1/0;l=(1&d?-1:1)*e.PI/e.sin(e.PI*s),d=1-d}for(i=d,n=d<1?d++:(d-=c=(0|d)-1)-1,r=0;r<8;++r)u=(u+a[r])*n,h=h*n+o[r];if(s=u/h+1,i<d)s/=i;else if(i>d)for(r=0;r<c;++r)s*=d,d++;return l&&(s=l/s),s},t.gammap=function(e,r){return t.lowRegGamma(e,r)*t.gammafn(e)},t.lowRegGamma=function(r,n){var i,s=t.gammaln(r),a=r,o=1/r,l=o,c=n+1-r,h=1/1e-30,u=1/c,d=u,p=1,f=-~(8.5*e.log(r>=1?r:1/r)+.4*r+17);if(n<0||r<=0)return NaN;if(n<r+1){for(;p<=f;p++)o+=l*=n/++a;return o*e.exp(-n+r*e.log(n)-s)}for(;p<=f;p++)d*=(u=1/(u=(i=-p*(p-r))*u+(c+=2)))*(h=c+i/h);return 1-d*e.exp(-n+r*e.log(n)-s)},t.factorialln=function(e){return e<0?NaN:t.gammaln(e+1)},t.factorial=function(e){return e<0?NaN:t.gammafn(e+1)},t.combination=function(r,n){return r>170||n>170?e.exp(t.combinationln(r,n)):t.factorial(r)/t.factorial(n)/t.factorial(r-n)},t.combinationln=function(e,r){return t.factorialln(e)-t.factorialln(r)-t.factorialln(e-r)},t.permutation=function(e,r){return t.factorial(e)/t.factorial(e-r)},t.betafn=function(r,n){if(!(r<=0||n<=0))return r+n>170?e.exp(t.betaln(r,n)):t.gammafn(r)*t.gammafn(n)/t.gammafn(r+n)},t.betaln=function(e,r){return t.gammaln(e)+t.gammaln(r)-t.gammaln(e+r)},t.betacf=function(t,r,n){var i,s,a,o,l=1e-30,c=1,h=r+n,u=r+1,d=r-1,p=1,f=1-h*t/u;for(e.abs(f)<l&&(f=l),o=f=1/f;c<=100&&(f=1+(s=c*(n-c)*t/((d+(i=2*c))*(r+i)))*f,e.abs(f)<l&&(f=l),p=1+s/p,e.abs(p)<l&&(p=l),o*=(f=1/f)*p,f=1+(s=-(r+c)*(h+c)*t/((r+i)*(u+i)))*f,e.abs(f)<l&&(f=l),p=1+s/p,e.abs(p)<l&&(p=l),o*=a=(f=1/f)*p,!(e.abs(a-1)<3e-7));c++);return o},t.gammapinv=function(r,n){var i,s,a,o,l,c,h=0,u=n-1,d=1e-8,p=t.gammaln(n);if(r>=1)return e.max(100,n+100*e.sqrt(n));if(r<=0)return 0;for(n>1?(l=e.log(u),c=e.exp(u*(l-1)-p),o=r<.5?r:1-r,i=(2.30753+.27061*(s=e.sqrt(-2*e.log(o))))/(1+s*(.99229+.04481*s))-s,r<.5&&(i=-i),i=e.max(.001,n*e.pow(1-1/(9*n)-i/(3*e.sqrt(n)),3))):i=r<(s=1-n*(.253+.12*n))?e.pow(r/s,1/n):1-e.log(1-(r-s)/(1-s));h<12;h++){if(i<=0)return 0;if((i-=s=(a=(t.lowRegGamma(n,i)-r)/(s=n>1?c*e.exp(-(i-u)+u*(e.log(i)-l)):e.exp(-i+u*e.log(i)-p)))/(1-.5*e.min(1,a*((n-1)/i-1))))<=0&&(i=.5*(i+s)),e.abs(s)<d*i)break}return i},t.erf=function(t){var r,n,i,s,a=[-1.3026537197817094,.6419697923564902,.019476473204185836,-.00956151478680863,-.000946595344482036,.000366839497852761,42523324806907e-18,-20278578112534e-18,-1624290004647e-18,130365583558e-17,1.5626441722e-8,-8.5238095915e-8,6.529054439e-9,5.059343495e-9,-9.91364156e-10,-2.27365122e-10,96467911e-18,2394038e-18,-6886027e-18,894487e-18,313092e-18,-112708e-18,381e-18,7106e-18,-1523e-18,-94e-18,121e-18,-28e-18],o=a.length-1,l=!1,c=0,h=0;for(t<0&&(t=-t,l=!0),n=4*(r=2/(2+t))-2;o>0;o--)i=c,c=n*c-h+a[o],h=i;return s=r*e.exp(-t*t+.5*(a[0]+n*c)-h),l?s-1:1-s},t.erfc=function(e){return 1-t.erf(e)},t.erfcinv=function(r){var n,i,s,a,o=0;if(r>=2)return-100;if(r<=0)return 100;for(a=r<1?r:2-r,n=-.70711*((2.30753+.27061*(s=e.sqrt(-2*e.log(a/2))))/(1+s*(.99229+.04481*s))-s);o<2;o++)n+=(i=t.erfc(n)-a)/(1.1283791670955126*e.exp(-n*n)-n*i);return r<1?n:-n},t.ibetainv=function(r,n,i){var s,a,o,l,c,h,u,d,p,f,m=1e-8,b=n-1,v=i-1,g=0;if(r<=0)return 0;if(r>=1)return 1;for(n>=1&&i>=1?(o=r<.5?r:1-r,h=(2.30753+.27061*(l=e.sqrt(-2*e.log(o))))/(1+l*(.99229+.04481*l))-l,r<.5&&(h=-h),u=(h*h-3)/6,d=2/(1/(2*n-1)+1/(2*i-1)),p=h*e.sqrt(u+d)/d-(1/(2*i-1)-1/(2*n-1))*(u+5/6-2/(3*d)),h=n/(n+i*e.exp(2*p))):(s=e.log(n/(n+i)),a=e.log(i/(n+i)),h=r<(l=e.exp(n*s)/n)/(p=l+(c=e.exp(i*a)/i))?e.pow(n*p*r,1/n):1-e.pow(i*p*(1-r),1/i)),f=-t.gammaln(n)-t.gammaln(i)+t.gammaln(n+i);g<10;g++){if(0===h||1===h)return h;if((h-=l=(c=(t.ibeta(h,n,i)-r)/(l=e.exp(b*e.log(h)+v*e.log(1-h)+f)))/(1-.5*e.min(1,c*(b/h-v/(1-h)))))<=0&&(h=.5*(h+l)),h>=1&&(h=.5*(h+l+1)),e.abs(l)<m*h&&g>0)break}return h},t.ibeta=function(r,n,i){var s=0===r||1===r?0:e.exp(t.gammaln(n+i)-t.gammaln(n)-t.gammaln(i)+n*e.log(r)+i*e.log(1-r));return!(r<0||r>1)&&(r<(n+1)/(n+i+2)?s*t.betacf(r,n,i)/n:1-s*t.betacf(1-r,i,n)/i)},t.randn=function(r,n){var i,s,a,o,l;if(n||(n=r),r)return t.create(r,n,(function(){return t.randn()}));do{i=t._random_fn(),s=1.7156*(t._random_fn()-.5),l=(a=i-.449871)*a+(o=e.abs(s)+.386595)*(.196*o-.25472*a)}while(l>.27597&&(l>.27846||s*s>-4*e.log(i)*i*i));return s/i},t.randg=function(r,n,i){var s,a,o,l,c,h,u=r;if(i||(i=n),r||(r=1),n)return(h=t.zeros(n,i)).alter((function(){return t.randg(r)})),h;r<1&&(r+=1),s=r-1/3,a=1/e.sqrt(9*s);do{do{l=1+a*(c=t.randn())}while(l<=0);l*=l*l,o=t._random_fn()}while(o>1-.331*e.pow(c,4)&&e.log(o)>.5*c*c+s*(1-l+e.log(l)));if(r==u)return s*l;do{o=t._random_fn()}while(0===o);return e.pow(o,1/u)*s*l},function(e){for(var r=0;r<e.length;r++)!function(e){t.fn[e]=function(){return t(t.map(this,(function(r){return t[e](r)})))}}(e[r])}("gammaln gammafn factorial factorialln".split(" ")),function(e){for(var r=0;r<e.length;r++)!function(e){t.fn[e]=function(){return t(t[e].apply(null,arguments))}}(e[r])}("randn".split(" "))}(t,Math),function(t,e){function r(t,r,n,i){for(var s,a=0,o=1,l=1,c=1,h=0,u=0;e.abs((l-u)/l)>i;)u=l,o=c+(s=-(r+h)*(r+n+h)*t/(r+2*h)/(r+2*h+1))*o,l=(a=l+s*a)+(s=(h+=1)*(n-h)*t/(r+2*h-1)/(r+2*h))*l,a/=c=o+s*c,o/=c,l/=c,c=1;return l/r}function n(t){return t/e.abs(t)}function i(r,n,i){var s=12,a=6,o=-30,l=-50,c=60,h=8,u=3,d=2,p=3,f=[.9815606342467192,.9041172563704749,.7699026741943047,.5873179542866175,.3678314989981802,.1252334085114689],m=[.04717533638651183,.10693932599531843,.16007832854334622,.20316742672306592,.2334925365383548,.24914704581340277],b=.5*r;if(b>=h)return 1;var v,g=2*t.normal.cdf(b,0,1,1,0)-1;g=g>=e.exp(l/i)?e.pow(g,i):0;for(var y=b,w=(h-b)/(v=r>u?d:p),x=y+w,$=0,_=i-1,k=1;k<=v;k++){for(var S=0,A=.5*(x+y),E=.5*(x-y),M=1;M<=s;M++){var T,C=A+E*(a<M?f[(T=s-M+1)-1]:-f[(T=M)-1]),N=C*C;if(N>c)break;var R=2*t.normal.cdf(C,0,1,1,0)*.5-2*t.normal.cdf(C,r,1,1,0)*.5;R>=e.exp(o/_)&&(S+=R=m[T-1]*e.exp(-.5*N)*e.pow(R,_))}$+=S*=2*E*i/e.sqrt(2*e.PI),y=x,x+=w}return(g+=$)<=e.exp(o/n)?0:(g=e.pow(g,n))>=1?1:g}function s(t,r,n){var i=.322232421088,s=.099348462606,a=-1,o=.588581570495,l=-.342242088547,c=.531103462366,h=-.204231210125,u=.10353775285,d=-453642210148e-16,p=.0038560700634,f=.8832,m=.2368,b=1.214,v=1.208,g=1.4142,y=120,w=.5-.5*t,x=e.sqrt(e.log(1/(w*w))),$=x+((((x*d+h)*x+l)*x+a)*x+i)/((((x*p+u)*x+c)*x+o)*x+s);n<y&&($+=($*$*$+$)/n/4);var _=f-m*$;return n<y&&(_+=-b/n+v*$/n),$*(_*e.log(r-1)+g)}!function(e){for(var r=0;r<e.length;r++)!function(e){t[e]=function t(e,r,n){return this instanceof t?(this._a=e,this._b=r,this._c=n,this):new t(e,r,n)},t.fn[e]=function(r,n,i){var s=t[e](r,n,i);return s.data=this,s},t[e].prototype.sample=function(r){var n=this._a,i=this._b,s=this._c;return r?t.alter(r,(function(){return t[e].sample(n,i,s)})):t[e].sample(n,i,s)},function(r){for(var n=0;n<r.length;n++)!function(r){t[e].prototype[r]=function(n){var i=this._a,s=this._b,a=this._c;return n||0===n||(n=this.data),"number"!=typeof n?t.fn.map.call(n,(function(n){return t[e][r](n,i,s,a)})):t[e][r](n,i,s,a)}}(r[n])}("pdf cdf inv".split(" ")),function(r){for(var n=0;n<r.length;n++)!function(r){t[e].prototype[r]=function(){return t[e][r](this._a,this._b,this._c)}}(r[n])}("mean median mode variance".split(" "))}(e[r])}("beta centralF cauchy chisquare exponential gamma invgamma kumaraswamy laplace lognormal noncentralt normal pareto studentt weibull uniform binomial negbin hypgeom poisson triangular tukey arcsine".split(" ")),t.extend(t.beta,{pdf:function(r,n,i){return r>1||r<0?0:1==n&&1==i?1:n<512&&i<512?e.pow(r,n-1)*e.pow(1-r,i-1)/t.betafn(n,i):e.exp((n-1)*e.log(r)+(i-1)*e.log(1-r)-t.betaln(n,i))},cdf:function(e,r,n){return e>1||e<0?1*(e>1):t.ibeta(e,r,n)},inv:function(e,r,n){return t.ibetainv(e,r,n)},mean:function(t,e){return t/(t+e)},median:function(e,r){return t.ibetainv(.5,e,r)},mode:function(t,e){return(t-1)/(t+e-2)},sample:function(e,r){var n=t.randg(e);return n/(n+t.randg(r))},variance:function(t,r){return t*r/(e.pow(t+r,2)*(t+r+1))}}),t.extend(t.centralF,{pdf:function(r,n,i){var s;return r<0?0:n<=2?0===r&&n<2?1/0:0===r&&2===n?1:1/t.betafn(n/2,i/2)*e.pow(n/i,n/2)*e.pow(r,n/2-1)*e.pow(1+n/i*r,-(n+i)/2):(s=n*r/(i+r*n),n*(i/(i+r*n))/2*t.binomial.pdf((n-2)/2,(n+i-2)/2,s))},cdf:function(e,r,n){return e<0?0:t.ibeta(r*e/(r*e+n),r/2,n/2)},inv:function(e,r,n){return n/(r*(1/t.ibetainv(e,r/2,n/2)-1))},mean:function(t,e){return e>2?e/(e-2):void 0},mode:function(t,e){return t>2?e*(t-2)/(t*(e+2)):void 0},sample:function(e,r){return 2*t.randg(e/2)/e/(2*t.randg(r/2)/r)},variance:function(t,e){if(!(e<=4))return 2*e*e*(t+e-2)/(t*(e-2)*(e-2)*(e-4))}}),t.extend(t.cauchy,{pdf:function(t,r,n){return n<0?0:n/(e.pow(t-r,2)+e.pow(n,2))/e.PI},cdf:function(t,r,n){return e.atan((t-r)/n)/e.PI+.5},inv:function(t,r,n){return r+n*e.tan(e.PI*(t-.5))},median:function(t){return t},mode:function(t){return t},sample:function(r,n){return t.randn()*e.sqrt(1/(2*t.randg(.5)))*n+r}}),t.extend(t.chisquare,{pdf:function(r,n){return r<0?0:0===r&&2===n?.5:e.exp((n/2-1)*e.log(r)-r/2-n/2*e.log(2)-t.gammaln(n/2))},cdf:function(e,r){return e<0?0:t.lowRegGamma(r/2,e/2)},inv:function(e,r){return 2*t.gammapinv(e,.5*r)},mean:function(t){return t},median:function(t){return t*e.pow(1-2/(9*t),3)},mode:function(t){return t-2>0?t-2:0},sample:function(e){return 2*t.randg(e/2)},variance:function(t){return 2*t}}),t.extend(t.exponential,{pdf:function(t,r){return t<0?0:r*e.exp(-r*t)},cdf:function(t,r){return t<0?0:1-e.exp(-r*t)},inv:function(t,r){return-e.log(1-t)/r},mean:function(t){return 1/t},median:function(t){return 1/t*e.log(2)},mode:function(){return 0},sample:function(r){return-1/r*e.log(t._random_fn())},variance:function(t){return e.pow(t,-2)}}),t.extend(t.gamma,{pdf:function(r,n,i){return r<0?0:0===r&&1===n?1/i:e.exp((n-1)*e.log(r)-r/i-t.gammaln(n)-n*e.log(i))},cdf:function(e,r,n){return e<0?0:t.lowRegGamma(r,e/n)},inv:function(e,r,n){return t.gammapinv(e,r)*n},mean:function(t,e){return t*e},mode:function(t,e){if(t>1)return(t-1)*e},sample:function(e,r){return t.randg(e)*r},variance:function(t,e){return t*e*e}}),t.extend(t.invgamma,{pdf:function(r,n,i){return r<=0?0:e.exp(-(n+1)*e.log(r)-i/r-t.gammaln(n)+n*e.log(i))},cdf:function(e,r,n){return e<=0?0:1-t.lowRegGamma(r,n/e)},inv:function(e,r,n){return n/t.gammapinv(1-e,r)},mean:function(t,e){return t>1?e/(t-1):void 0},mode:function(t,e){return e/(t+1)},sample:function(e,r){return r/t.randg(e)},variance:function(t,e){if(!(t<=2))return e*e/((t-1)*(t-1)*(t-2))}}),t.extend(t.kumaraswamy,{pdf:function(t,r,n){return 0===t&&1===r?n:1===t&&1===n?r:e.exp(e.log(r)+e.log(n)+(r-1)*e.log(t)+(n-1)*e.log(1-e.pow(t,r)))},cdf:function(t,r,n){return t<0?0:t>1?1:1-e.pow(1-e.pow(t,r),n)},inv:function(t,r,n){return e.pow(1-e.pow(1-t,1/n),1/r)},mean:function(e,r){return r*t.gammafn(1+1/e)*t.gammafn(r)/t.gammafn(1+1/e+r)},median:function(t,r){return e.pow(1-e.pow(2,-1/r),1/t)},mode:function(t,r){if(t>=1&&r>=1&&1!==t&&1!==r)return e.pow((t-1)/(t*r-1),1/t)},variance:function(){throw new Error("variance not yet implemented")}}),t.extend(t.lognormal,{pdf:function(t,r,n){return t<=0?0:e.exp(-e.log(t)-.5*e.log(2*e.PI)-e.log(n)-e.pow(e.log(t)-r,2)/(2*n*n))},cdf:function(r,n,i){return r<0?0:.5+.5*t.erf((e.log(r)-n)/e.sqrt(2*i*i))},inv:function(r,n,i){return e.exp(-1.4142135623730951*i*t.erfcinv(2*r)+n)},mean:function(t,r){return e.exp(t+r*r/2)},median:function(t){return e.exp(t)},mode:function(t,r){return e.exp(t-r*r)},sample:function(r,n){return e.exp(t.randn()*n+r)},variance:function(t,r){return(e.exp(r*r)-1)*e.exp(2*t+r*r)}}),t.extend(t.noncentralt,{pdf:function(r,n,i){var s=1e-14;return e.abs(i)<s?t.studentt.pdf(r,n):e.abs(r)<s?e.exp(t.gammaln((n+1)/2)-i*i/2-.5*e.log(e.PI*n)-t.gammaln(n/2)):n/r*(t.noncentralt.cdf(r*e.sqrt(1+2/n),n+2,i)-t.noncentralt.cdf(r,n,i))},cdf:function(r,n,i){var s=1e-14,a=200;if(e.abs(i)<s)return t.studentt.cdf(r,n);var o=!1;r<0&&(o=!0,i=-i);for(var l=t.normal.cdf(-i,0,1),c=s+1,h=c,u=r*r/(r*r+n),d=0,p=e.exp(-i*i/2),f=e.exp(-i*i/2-.5*e.log(2)-t.gammaln(1.5))*i;d<a||h>s||c>s;)h=c,d>0&&(p*=i*i/(2*d),f*=i*i/(2*(d+.5))),l+=.5*(c=p*t.beta.cdf(u,d+.5,n/2)+f*t.beta.cdf(u,d+1,n/2)),d++;return o?1-l:l}}),t.extend(t.normal,{pdf:function(t,r,n){return e.exp(-.5*e.log(2*e.PI)-e.log(n)-e.pow(t-r,2)/(2*n*n))},cdf:function(r,n,i){return.5*(1+t.erf((r-n)/e.sqrt(2*i*i)))},inv:function(e,r,n){return-1.4142135623730951*n*t.erfcinv(2*e)+r},mean:function(t){return t},median:function(t){return t},mode:function(t){return t},sample:function(e,r){return t.randn()*r+e},variance:function(t,e){return e*e}}),t.extend(t.pareto,{pdf:function(t,r,n){return t<r?0:n*e.pow(r,n)/e.pow(t,n+1)},cdf:function(t,r,n){return t<r?0:1-e.pow(r/t,n)},inv:function(t,r,n){return r/e.pow(1-t,1/n)},mean:function(t,r){if(!(r<=1))return r*e.pow(t,r)/(r-1)},median:function(t,r){return t*(r*e.SQRT2)},mode:function(t){return t},variance:function(t,r){if(!(r<=2))return t*t*r/(e.pow(r-1,2)*(r-2))}}),t.extend(t.studentt,{pdf:function(r,n){return n=n>1e100?1e100:n,1/(e.sqrt(n)*t.betafn(.5,n/2))*e.pow(1+r*r/n,-(n+1)/2)},cdf:function(r,n){var i=n/2;return t.ibeta((r+e.sqrt(r*r+n))/(2*e.sqrt(r*r+n)),i,i)},inv:function(r,n){var i=t.ibetainv(2*e.min(r,1-r),.5*n,.5);return i=e.sqrt(n*(1-i)/i),r>.5?i:-i},mean:function(t){return t>1?0:void 0},median:function(){return 0},mode:function(){return 0},sample:function(r){return t.randn()*e.sqrt(r/(2*t.randg(r/2)))},variance:function(t){return t>2?t/(t-2):t>1?1/0:void 0}}),t.extend(t.weibull,{pdf:function(t,r,n){return t<0||r<0||n<0?0:n/r*e.pow(t/r,n-1)*e.exp(-e.pow(t/r,n))},cdf:function(t,r,n){return t<0?0:1-e.exp(-e.pow(t/r,n))},inv:function(t,r,n){return r*e.pow(-e.log(1-t),1/n)},mean:function(e,r){return e*t.gammafn(1+1/r)},median:function(t,r){return t*e.pow(e.log(2),1/r)},mode:function(t,r){return r<=1?0:t*e.pow((r-1)/r,1/r)},sample:function(r,n){return r*e.pow(-e.log(t._random_fn()),1/n)},variance:function(r,n){return r*r*t.gammafn(1+2/n)-e.pow(t.weibull.mean(r,n),2)}}),t.extend(t.uniform,{pdf:function(t,e,r){return t<e||t>r?0:1/(r-e)},cdf:function(t,e,r){return t<e?0:t<r?(t-e)/(r-e):1},inv:function(t,e,r){return e+t*(r-e)},mean:function(t,e){return.5*(t+e)},median:function(e,r){return t.mean(e,r)},mode:function(){throw new Error("mode is not yet implemented")},sample:function(e,r){return e/2+r/2+(r/2-e/2)*(2*t._random_fn()-1)},variance:function(t,r){return e.pow(r-t,2)/12}}),t.extend(t.binomial,{pdf:function(r,n,i){return 0===i||1===i?n*i===r?1:0:t.combination(n,r)*e.pow(i,r)*e.pow(1-i,n-r)},cdf:function(n,i,s){var a,o=1e-10;if(n<0)return 0;if(n>=i)return 1;if(s<0||s>1||i<=0)return NaN;var l=s,c=(n=e.floor(n))+1,h=i-n,u=c+h,d=e.exp(t.gammaln(u)-t.gammaln(h)-t.gammaln(c)+c*e.log(l)+h*e.log(1-l));return a=l<(c+1)/(u+2)?d*r(l,c,h,o):1-d*r(1-l,h,c,o),e.round(1/o*(1-a))/(1/o)}}),t.extend(t.negbin,{pdf:function(r,n,i){return r===r>>>0&&(r<0?0:t.combination(r+n-1,n-1)*e.pow(1-i,r)*e.pow(i,n))},cdf:function(e,r,n){var i=0,s=0;if(e<0)return 0;for(;s<=e;s++)i+=t.negbin.pdf(s,r,n);return i}}),t.extend(t.hypgeom,{pdf:function(r,n,i,s){if(r!=r|0)return!1;if(r<0||r<i-(n-s))return 0;if(r>s||r>i)return 0;if(2*i>n)return 2*s>n?t.hypgeom.pdf(n-i-s+r,n,n-i,n-s):t.hypgeom.pdf(s-r,n,n-i,s);if(2*s>n)return t.hypgeom.pdf(i-r,n,i,n-s);if(i<s)return t.hypgeom.pdf(r,n,s,i);for(var a=1,o=0,l=0;l<r;l++){for(;a>1&&o<s;)a*=1-i/(n-o),o++;a*=(s-l)*(i-l)/((l+1)*(n-i-s+l+1))}for(;o<s;o++)a*=1-i/(n-o);return e.min(1,e.max(0,a))},cdf:function(r,n,i,s){if(r<0||r<i-(n-s))return 0;if(r>=s||r>=i)return 1;if(2*i>n)return 2*s>n?t.hypgeom.cdf(n-i-s+r,n,n-i,n-s):1-t.hypgeom.cdf(s-r-1,n,n-i,s);if(2*s>n)return 1-t.hypgeom.cdf(i-r-1,n,i,n-s);if(i<s)return t.hypgeom.cdf(r,n,s,i);for(var a=1,o=1,l=0,c=0;c<r;c++){for(;a>1&&l<s;){var h=1-i/(n-l);o*=h,a*=h,l++}a+=o*=(s-c)*(i-c)/((c+1)*(n-i-s+c+1))}for(;l<s;l++)a*=1-i/(n-l);return e.min(1,e.max(0,a))}}),t.extend(t.poisson,{pdf:function(r,n){return n<0||r%1!=0||r<0?0:e.pow(n,r)*e.exp(-n)/t.factorial(r)},cdf:function(e,r){var n=[],i=0;if(e<0)return 0;for(;i<=e;i++)n.push(t.poisson.pdf(i,r));return t.sum(n)},mean:function(t){return t},variance:function(t){return t},sampleSmall:function(r){var n=1,i=0,s=e.exp(-r);do{i++,n*=t._random_fn()}while(n>s);return i-1},sampleLarge:function(r){var n,i,s,a,o,l,c,h,u,d,p=r;for(a=e.sqrt(p),o=e.log(p),l=.02483*(c=.931+2.53*a)-.059,h=1.1239+1.1328/(c-3.4),u=.9277-3.6224/(c-2);;){if(i=e.random()-.5,s=e.random(),d=.5-e.abs(i),n=e.floor((2*l/d+c)*i+p+.43),d>=.07&&s<=u)return n;if(!(n<0||d<.013&&s>d)&&e.log(s)+e.log(h)-e.log(l/(d*d)+c)<=n*o-p-t.loggam(n+1))return n}},sample:function(t){return t<10?this.sampleSmall(t):this.sampleLarge(t)}}),t.extend(t.triangular,{pdf:function(t,e,r,n){return r<=e||n<e||n>r?NaN:t<e||t>r?0:t<n?2*(t-e)/((r-e)*(n-e)):t===n?2/(r-e):2*(r-t)/((r-e)*(r-n))},cdf:function(t,r,n,i){return n<=r||i<r||i>n?NaN:t<=r?0:t>=n?1:t<=i?e.pow(t-r,2)/((n-r)*(i-r)):1-e.pow(n-t,2)/((n-r)*(n-i))},inv:function(t,r,n,i){return n<=r||i<r||i>n?NaN:t<=(i-r)/(n-r)?r+(n-r)*e.sqrt(t*((i-r)/(n-r))):r+(n-r)*(1-e.sqrt((1-t)*(1-(i-r)/(n-r))))},mean:function(t,e,r){return(t+e+r)/3},median:function(t,r,n){return n<=(t+r)/2?r-e.sqrt((r-t)*(r-n))/e.sqrt(2):n>(t+r)/2?t+e.sqrt((r-t)*(n-t))/e.sqrt(2):void 0},mode:function(t,e,r){return r},sample:function(r,n,i){var s=t._random_fn();return s<(i-r)/(n-r)?r+e.sqrt(s*(n-r)*(i-r)):n-e.sqrt((1-s)*(n-r)*(n-i))},variance:function(t,e,r){return(t*t+e*e+r*r-t*e-t*r-e*r)/18}}),t.extend(t.arcsine,{pdf:function(t,r,n){return n<=r?NaN:t<=r||t>=n?0:2/e.PI*e.pow(e.pow(n-r,2)-e.pow(2*t-r-n,2),-.5)},cdf:function(t,r,n){return t<r?0:t<n?2/e.PI*e.asin(e.sqrt((t-r)/(n-r))):1},inv:function(t,r,n){return r+(.5-.5*e.cos(e.PI*t))*(n-r)},mean:function(t,e){return e<=t?NaN:(t+e)/2},median:function(t,e){return e<=t?NaN:(t+e)/2},mode:function(){throw new Error("mode is not yet implemented")},sample:function(r,n){return(r+n)/2+(n-r)/2*e.sin(2*e.PI*t.uniform.sample(0,1))},variance:function(t,r){return r<=t?NaN:e.pow(r-t,2)/8}}),t.extend(t.laplace,{pdf:function(t,r,n){return n<=0?0:e.exp(-e.abs(t-r)/n)/(2*n)},cdf:function(t,r,n){return n<=0?0:t<r?.5*e.exp((t-r)/n):1-.5*e.exp(-(t-r)/n)},mean:function(t){return t},median:function(t){return t},mode:function(t){return t},variance:function(t,e){return 2*e*e},sample:function(r,i){var s=t._random_fn()-.5;return r-i*n(s)*e.log(1-2*e.abs(s))}}),t.extend(t.tukey,{cdf:function(r,n,s){var a=1,o=n,l=16,c=8,h=-30,u=1e-14,d=100,p=800,f=5e3,m=25e3,b=1,v=.5,g=.25,y=.125,w=[.9894009349916499,.9445750230732326,.8656312023878318,.755404408355003,.6178762444026438,.45801677765722737,.2816035507792589,.09501250983763744],x=[.027152459411754096,.062253523938647894,.09515851168249279,.12462897125553388,.14959598881657674,.16915651939500254,.18260341504492358,.1894506104550685];if(r<=0)return 0;if(s<2||a<1||o<2)return NaN;if(!Number.isFinite(r))return 1;if(s>m)return i(r,a,o);var $,_=.5*s,k=_*e.log(s)-s*e.log(2)-t.gammaln(_),S=_-1,A=.25*s;$=s<=d?b:s<=p?v:s<=f?g:y,k+=e.log($);for(var E=0,M=1;M<=50;M++){for(var T=0,C=(2*M-1)*$,N=1;N<=l;N++){var R,q;c<N?(R=N-c-1,q=k+S*e.log(C+w[R]*$)-(w[R]*$+C)*A):(R=N-1,q=k+S*e.log(C-w[R]*$)+(w[R]*$-C)*A),q>=h&&(T+=i(c<N?r*e.sqrt(.5*(w[R]*$+C)):r*e.sqrt(.5*(-w[R]*$+C)),a,o)*x[R]*e.exp(q))}if(M*$>=1&&T<=u)break;E+=T}if(T>u)throw new Error("tukey.cdf failed to converge");return E>1&&(E=1),E},inv:function(r,n,i){var a=1e-4,o=50;if(i<2||n<2)return NaN;if(r<0||r>1)return NaN;if(0===r)return 0;if(1===r)return 1/0;var l,c=s(r,n,i),h=t.tukey.cdf(c,n,i)-r;l=h>0?e.max(0,c-1):c+1;for(var u,d=t.tukey.cdf(l,n,i)-r,p=1;p<o;p++)if(u=l-d*(l-c)/(d-h),h=d,c=l,u<0&&(u=0,d=-r),d=t.tukey.cdf(u,n,i)-r,l=u,e.abs(l-c)<a)return u;throw new Error("tukey.inv failed to converge")}})}(t,Math),function(t,e){var r=Array.prototype.push,n=t.utils.isArray;function i(e){return n(e)||e instanceof t}t.extend({add:function(e,r){return i(r)?(i(r[0])||(r=[r]),t.map(e,(function(t,e,n){return t+r[e][n]}))):t.map(e,(function(t){return t+r}))},subtract:function(e,r){return i(r)?(i(r[0])||(r=[r]),t.map(e,(function(t,e,n){return t-r[e][n]||0}))):t.map(e,(function(t){return t-r}))},divide:function(e,r){return i(r)?(i(r[0])||(r=[r]),t.multiply(e,t.inv(r))):t.map(e,(function(t){return t/r}))},multiply:function(e,r){var n,s,a,o,l,c,h,u;if(void 0===e.length&&void 0===r.length)return e*r;if(l=e.length,c=e[0].length,h=t.zeros(l,a=i(r)?r[0].length:c),u=0,i(r)){for(;u<a;u++)for(n=0;n<l;n++){for(o=0,s=0;s<c;s++)o+=e[n][s]*r[s][u];h[n][u]=o}return 1===l&&1===u?h[0][0]:h}return t.map(e,(function(t){return t*r}))},outer:function(e,r){return t.multiply(e.map((function(t){return[t]})),[r])},dot:function(e,r){i(e[0])||(e=[e]),i(r[0])||(r=[r]);for(var n,s,a=1===e[0].length&&1!==e.length?t.transpose(e):e,o=1===r[0].length&&1!==r.length?t.transpose(r):r,l=[],c=0,h=a.length,u=a[0].length;c<h;c++){for(l[c]=[],n=0,s=0;s<u;s++)n+=a[c][s]*o[c][s];l[c]=n}return 1===l.length?l[0]:l},pow:function(r,n){return t.map(r,(function(t){return e.pow(t,n)}))},exp:function(r){return t.map(r,(function(t){return e.exp(t)}))},log:function(r){return t.map(r,(function(t){return e.log(t)}))},abs:function(r){return t.map(r,(function(t){return e.abs(t)}))},norm:function(t,r){var n=0,s=0;for(isNaN(r)&&(r=2),i(t[0])&&(t=t[0]);s<t.length;s++)n+=e.pow(e.abs(t[s]),r);return e.pow(n,1/r)},angle:function(r,n){return e.acos(t.dot(r,n)/(t.norm(r)*t.norm(n)))},aug:function(t,e){var n,i=[];for(n=0;n<t.length;n++)i.push(t[n].slice());for(n=0;n<i.length;n++)r.apply(i[n],e[n]);return i},inv:function(e){for(var r,n=e.length,i=e[0].length,s=t.identity(n,i),a=t.gauss_jordan(e,s),o=[],l=0;l<n;l++)for(o[l]=[],r=i;r<a[0].length;r++)o[l][r-i]=a[l][r];return o},det:function t(e){if(2===e.length)return e[0][0]*e[1][1]-e[0][1]*e[1][0];for(var r=0,n=0;n<e.length;n++){for(var i=[],s=1;s<e.length;s++){i[s-1]=[];for(var a=0;a<e.length;a++)a<n?i[s-1][a]=e[s][a]:a>n&&(i[s-1][a-1]=e[s][a])}var o=n%2?-1:1;r+=t(i)*e[0][n]*o}return r},gauss_elimination:function(r,n){var i,s,a,o,l=0,c=0,h=r.length,u=r[0].length,d=1,p=0,f=[];for(i=(r=t.aug(r,n))[0].length,l=0;l<h;l++){for(s=r[l][l],c=l,o=l+1;o<u;o++)s<e.abs(r[o][l])&&(s=r[o][l],c=o);if(c!=l)for(o=0;o<i;o++)a=r[l][o],r[l][o]=r[c][o],r[c][o]=a;for(c=l+1;c<h;c++)for(d=r[c][l]/r[l][l],o=l;o<i;o++)r[c][o]=r[c][o]-d*r[l][o]}for(l=h-1;l>=0;l--){for(p=0,c=l+1;c<=h-1;c++)p+=f[c]*r[l][c];f[l]=(r[l][i-1]-p)/r[l][l]}return f},gauss_jordan:function(r,n){var i,s,a,o=t.aug(r,n),l=o.length,c=o[0].length,h=0;for(s=0;s<l;s++){var u=s;for(a=s+1;a<l;a++)e.abs(o[a][s])>e.abs(o[u][s])&&(u=a);var d=o[s];for(o[s]=o[u],o[u]=d,a=s+1;a<l;a++)for(h=o[a][s]/o[s][s],i=s;i<c;i++)o[a][i]-=o[s][i]*h}for(s=l-1;s>=0;s--){for(h=o[s][s],a=0;a<s;a++)for(i=c-1;i>s-1;i--)o[a][i]-=o[s][i]*o[a][s]/h;for(o[s][s]/=h,i=l;i<c;i++)o[s][i]/=h}return o},triaUpSolve:function(e,r){var n,i=e[0].length,s=t.zeros(1,i)[0],a=!1;return null!=r[0].length&&(r=r.map((function(t){return t[0]})),a=!0),t.arange(i-1,-1,-1).forEach((function(a){n=t.arange(a+1,i).map((function(t){return s[t]*e[a][t]})),s[a]=(r[a]-t.sum(n))/e[a][a]})),a?s.map((function(t){return[t]})):s},triaLowSolve:function(e,r){var n,i=e[0].length,s=t.zeros(1,i)[0],a=!1;return null!=r[0].length&&(r=r.map((function(t){return t[0]})),a=!0),t.arange(i).forEach((function(i){n=t.arange(i).map((function(t){return e[i][t]*s[t]})),s[i]=(r[i]-t.sum(n))/e[i][i]})),a?s.map((function(t){return[t]})):s},lu:function(e){var r,n=e.length,i=t.identity(n),s=t.zeros(e.length,e[0].length);return t.arange(n).forEach((function(t){s[0][t]=e[0][t]})),t.arange(1,n).forEach((function(a){t.arange(a).forEach((function(n){r=t.arange(n).map((function(t){return i[a][t]*s[t][n]})),i[a][n]=(e[a][n]-t.sum(r))/s[n][n]})),t.arange(a,n).forEach((function(n){r=t.arange(a).map((function(t){return i[a][t]*s[t][n]})),s[a][n]=e[r.length][n]-t.sum(r)}))})),[i,s]},cholesky:function(r){var n,i=r.length,s=t.zeros(r.length,r[0].length);return t.arange(i).forEach((function(a){n=t.arange(a).map((function(t){return e.pow(s[a][t],2)})),s[a][a]=e.sqrt(r[a][a]-t.sum(n)),t.arange(a+1,i).forEach((function(e){n=t.arange(a).map((function(t){return s[a][t]*s[e][t]})),s[e][a]=(r[a][e]-t.sum(n))/s[a][a]}))})),s},gauss_jacobi:function(r,n,i,s){for(var a,o,l,c,h=0,u=0,d=r.length,p=[],f=[],m=[];h<d;h++)for(p[h]=[],f[h]=[],m[h]=[],u=0;u<d;u++)h>u?(p[h][u]=r[h][u],f[h][u]=m[h][u]=0):h<u?(f[h][u]=r[h][u],p[h][u]=m[h][u]=0):(m[h][u]=r[h][u],p[h][u]=f[h][u]=0);for(l=t.multiply(t.multiply(t.inv(m),t.add(p,f)),-1),o=t.multiply(t.inv(m),n),a=i,c=t.add(t.multiply(l,i),o),h=2;e.abs(t.norm(t.subtract(c,a)))>s;)a=c,c=t.add(t.multiply(l,a),o),h++;return c},gauss_seidel:function(r,n,i,s){for(var a,o,l,c,h,u=0,d=r.length,p=[],f=[],m=[];u<d;u++)for(p[u]=[],f[u]=[],m[u]=[],a=0;a<d;a++)u>a?(p[u][a]=r[u][a],f[u][a]=m[u][a]=0):u<a?(f[u][a]=r[u][a],p[u][a]=m[u][a]=0):(m[u][a]=r[u][a],p[u][a]=f[u][a]=0);for(c=t.multiply(t.multiply(t.inv(t.add(m,p)),f),-1),l=t.multiply(t.inv(t.add(m,p)),n),o=i,h=t.add(t.multiply(c,i),l),u=2;e.abs(t.norm(t.subtract(h,o)))>s;)o=h,h=t.add(t.multiply(c,o),l),u+=1;return h},SOR:function(r,n,i,s,a){for(var o,l,c,h,u,d=0,p=r.length,f=[],m=[],b=[];d<p;d++)for(f[d]=[],m[d]=[],b[d]=[],o=0;o<p;o++)d>o?(f[d][o]=r[d][o],m[d][o]=b[d][o]=0):d<o?(m[d][o]=r[d][o],f[d][o]=b[d][o]=0):(b[d][o]=r[d][o],f[d][o]=m[d][o]=0);for(h=t.multiply(t.inv(t.add(b,t.multiply(f,a))),t.subtract(t.multiply(b,1-a),t.multiply(m,a))),c=t.multiply(t.multiply(t.inv(t.add(b,t.multiply(f,a))),n),a),l=i,u=t.add(t.multiply(h,i),c),d=2;e.abs(t.norm(t.subtract(u,l)))>s;)l=u,u=t.add(t.multiply(h,l),c),d++;return u},householder:function(r){for(var n,i,s,a,o=r.length,l=r[0].length,c=0,h=[],u=[];c<o-1;c++){for(n=0,a=c+1;a<l;a++)n+=r[a][c]*r[a][c];for(n=(r[c+1][c]>0?-1:1)*e.sqrt(n),i=e.sqrt((n*n-r[c+1][c]*n)/2),(h=t.zeros(o,1))[c+1][0]=(r[c+1][c]-n)/(2*i),s=c+2;s<o;s++)h[s][0]=r[s][c]/(2*i);u=t.subtract(t.identity(o,l),t.multiply(t.multiply(h,t.transpose(h)),2)),r=t.multiply(u,t.multiply(r,u))}return r},QR:function(){var r=t.sum,n=t.arange;function i(i){var s,a,o,l=i.length,c=i[0].length,h=t.zeros(c,c);for(i=t.copy(i),a=0;a<c;a++){for(h[a][a]=e.sqrt(r(n(l).map((function(t){return i[t][a]*i[t][a]})))),s=0;s<l;s++)i[s][a]=i[s][a]/h[a][a];for(o=a+1;o<c;o++)for(h[a][o]=r(n(l).map((function(t){return i[t][a]*i[t][o]}))),s=0;s<l;s++)i[s][o]=i[s][o]-i[s][a]*h[a][o]}return[i,h]}return i}(),lstsq:function(){function e(e){var r=(e=t.copy(e)).length,n=t.identity(r);return t.arange(r-1,-1,-1).forEach((function(r){t.sliceAssign(n,{row:r},t.divide(t.slice(n,{row:r}),e[r][r])),t.sliceAssign(e,{row:r},t.divide(t.slice(e,{row:r}),e[r][r])),t.arange(r).forEach((function(i){var s=t.multiply(e[i][r],-1),a=t.slice(e,{row:i}),o=t.multiply(t.slice(e,{row:r}),s);t.sliceAssign(e,{row:i},t.add(a,o));var l=t.slice(n,{row:i}),c=t.multiply(t.slice(n,{row:r}),s);t.sliceAssign(n,{row:i},t.add(l,c))}))})),n}function r(r,n){var i=!1;void 0===n[0].length&&(n=n.map((function(t){return[t]})),i=!0);var s=t.QR(r),a=s[0],o=s[1],l=r[0].length,c=t.slice(a,{col:{end:l}}),h=e(t.slice(o,{row:{end:l}})),u=t.transpose(c);void 0===u[0].length&&(u=[u]);var d=t.multiply(t.multiply(h,u),n);return void 0===d.length&&(d=[[d]]),i?d.map((function(t){return t[0]})):d}return r}(),jacobi:function(r){for(var n,i,s,a,o,l,c,h=1,u=r.length,d=t.identity(u,u),p=[];1===h;){for(o=r[0][1],s=0,a=1,n=0;n<u;n++)for(i=0;i<u;i++)n!=i&&o<e.abs(r[n][i])&&(o=e.abs(r[n][i]),s=n,a=i);for(l=r[s][s]===r[a][a]?r[s][a]>0?e.PI/4:-e.PI/4:e.atan(2*r[s][a]/(r[s][s]-r[a][a]))/2,(c=t.identity(u,u))[s][s]=e.cos(l),c[s][a]=-e.sin(l),c[a][s]=e.sin(l),c[a][a]=e.cos(l),d=t.multiply(d,c),r=t.multiply(t.multiply(t.inv(c),r),c),h=0,n=1;n<u;n++)for(i=1;i<u;i++)n!=i&&e.abs(r[n][i])>.001&&(h=1)}for(n=0;n<u;n++)p.push(r[n][n]);return[d,p]},rungekutta:function(t,e,r,n,i,s){var a,o,l;if(2===s)for(;n<=r;)i+=((a=e*t(n,i))+(o=e*t(n+e,i+a)))/2,n+=e;if(4===s)for(;n<=r;)i+=((a=e*t(n,i))+2*(o=e*t(n+e/2,i+a/2))+2*(l=e*t(n+e/2,i+o/2))+e*t(n+e,i+l))/6,n+=e;return i},romberg:function(t,r,n,i){for(var s,a,o,l,c,h=0,u=(n-r)/2,d=[],p=[],f=[];h<i/2;){for(c=t(r),o=r,l=0;o<=n;o+=u,l++)d[l]=o;for(s=d.length,o=1;o<s-1;o++)c+=(o%2!=0?4:2)*t(d[o]);c=u/3*(c+t(n)),f[h]=c,u/=2,h++}for(a=f.length,s=1;1!==a;){for(o=0;o<a-1;o++)p[o]=(e.pow(4,s)*f[o+1]-f[o])/(e.pow(4,s)-1);a=p.length,f=p,p=[],s++}return f},richardson:function(t,r,n,i){function s(t,e){for(var r,n=0,i=t.length;n<i;n++)t[n]===e&&(r=n);return r}for(var a,o,l,c,h,u=e.abs(n-t[s(t,n)+1]),d=0,p=[],f=[];i>=u;)a=s(t,n+i),o=s(t,n),p[d]=(r[a]-2*r[o]+r[2*o-a])/(i*i),i/=2,d++;for(c=p.length,l=1;1!=c;){for(h=0;h<c-1;h++)f[h]=(e.pow(4,l)*p[h+1]-p[h])/(e.pow(4,l)-1);c=f.length,p=f,f=[],l++}return p},simpson:function(t,e,r,n){for(var i,s=(r-e)/n,a=t(e),o=[],l=e,c=0,h=1;l<=r;l+=s,c++)o[c]=l;for(i=o.length;h<i-1;h++)a+=(h%2!=0?4:2)*t(o[h]);return s/3*(a+t(r))},hermite:function(t,e,r,n){for(var i,s=t.length,a=0,o=0,l=[],c=[],h=[],u=[];o<s;o++){for(l[o]=1,i=0;i<s;i++)o!=i&&(l[o]*=(n-t[i])/(t[o]-t[i]));for(c[o]=0,i=0;i<s;i++)o!=i&&(c[o]+=1/(t[o]-t[i]));h[o]=(1-2*(n-t[o])*c[o])*(l[o]*l[o]),u[o]=(n-t[o])*(l[o]*l[o]),a+=h[o]*e[o]+u[o]*r[o]}return a},lagrange:function(t,e,r){for(var n,i,s=0,a=0,o=t.length;a<o;a++){for(i=e[a],n=0;n<o;n++)a!=n&&(i*=(r-t[n])/(t[a]-t[n]));s+=i}return s},cubic_spline:function(e,r,n){for(var i,s=e.length,a=0,o=[],l=[],c=[],h=[],u=[],d=[],p=[];a<s-1;a++)u[a]=e[a+1]-e[a];for(c[0]=0,a=1;a<s-1;a++)c[a]=3/u[a]*(r[a+1]-r[a])-3/u[a-1]*(r[a]-r[a-1]);for(a=1;a<s-1;a++)o[a]=[],l[a]=[],o[a][a-1]=u[a-1],o[a][a]=2*(u[a-1]+u[a]),o[a][a+1]=u[a],l[a][0]=c[a];for(h=t.multiply(t.inv(o),l),i=0;i<s-1;i++)d[i]=(r[i+1]-r[i])/u[i]-u[i]*(h[i+1][0]+2*h[i][0])/3,p[i]=(h[i+1][0]-h[i][0])/(3*u[i]);for(i=0;i<s&&!(e[i]>n);i++);return r[i-=1]+(n-e[i])*d[i]+t.sq(n-e[i])*h[i]+(n-e[i])*t.sq(n-e[i])*p[i]},gauss_quadrature:function(){throw new Error("gauss_quadrature not yet implemented")},PCA:function(e){var r,n,i=e.length,s=e[0].length,a=0,o=[],l=[],c=[],h=[],u=[],d=[],p=[],f=[],m=[],b=[];for(a=0;a<i;a++)o[a]=t.sum(e[a])/s;for(a=0;a<s;a++)for(p[a]=[],r=0;r<i;r++)p[a][r]=e[r][a]-o[r];for(p=t.transpose(p),a=0;a<i;a++)for(f[a]=[],r=0;r<i;r++)f[a][r]=t.dot([p[a]],[p[r]])/(s-1);for(m=(c=t.jacobi(f))[0],l=c[1],b=t.transpose(m),a=0;a<l.length;a++)for(r=a;r<l.length;r++)l[a]<l[r]&&(n=l[a],l[a]=l[r],l[r]=n,h=b[a],b[a]=b[r],b[r]=h);for(d=t.transpose(p),a=0;a<i;a++)for(u[a]=[],r=0;r<d.length;r++)u[a][r]=t.dot([b[a]],[d[r]]);return[e,l,b,u]}}),function(e){for(var r=0;r<e.length;r++)!function(e){t.fn[e]=function(r,n){var i=this;return n?(setTimeout((function(){n.call(i,t.fn[e].call(i,r))}),15),this):"number"==typeof t[e](this,r)?t[e](this,r):t(t[e](this,r))}}(e[r])}("add divide multiply subtract dot pow exp log abs norm angle".split(" "))}(t,Math),function(t,e){var r=[].slice,n=t.utils.isNumber,i=t.utils.isArray;function s(t,r,n,i){if(t>1||n>1||t<=0||n<=0)throw new Error("Proportions should be greater than 0 and less than 1");var s=(t*r+n*i)/(r+i);return(t-n)/e.sqrt(s*(1-s)*(1/r+1/i))}t.extend({zscore:function(){var e=r.call(arguments);return n(e[1])?(e[0]-e[1])/e[2]:(e[0]-t.mean(e[1]))/t.stdev(e[1],e[2])},ztest:function(){var n,s=r.call(arguments);return i(s[1])?(n=t.zscore(s[0],s[1],s[3]),1===s[2]?t.normal.cdf(-e.abs(n),0,1):2*t.normal.cdf(-e.abs(n),0,1)):s.length>2?(n=t.zscore(s[0],s[1],s[2]),1===s[3]?t.normal.cdf(-e.abs(n),0,1):2*t.normal.cdf(-e.abs(n),0,1)):(n=s[0],1===s[1]?t.normal.cdf(-e.abs(n),0,1):2*t.normal.cdf(-e.abs(n),0,1))}}),t.extend(t.fn,{zscore:function(t,e){return(t-this.mean())/this.stdev(e)},ztest:function(r,n,i){var s=e.abs(this.zscore(r,i));return 1===n?t.normal.cdf(-s,0,1):2*t.normal.cdf(-s,0,1)}}),t.extend({tscore:function(){var n=r.call(arguments);return 4===n.length?(n[0]-n[1])/(n[2]/e.sqrt(n[3])):(n[0]-t.mean(n[1]))/(t.stdev(n[1],!0)/e.sqrt(n[1].length))},ttest:function(){var i,s=r.call(arguments);return 5===s.length?(i=e.abs(t.tscore(s[0],s[1],s[2],s[3])),1===s[4]?t.studentt.cdf(-i,s[3]-1):2*t.studentt.cdf(-i,s[3]-1)):n(s[1])?(i=e.abs(s[0]),1==s[2]?t.studentt.cdf(-i,s[1]-1):2*t.studentt.cdf(-i,s[1]-1)):(i=e.abs(t.tscore(s[0],s[1])),1==s[2]?t.studentt.cdf(-i,s[1].length-1):2*t.studentt.cdf(-i,s[1].length-1))}}),t.extend(t.fn,{tscore:function(t){return(t-this.mean())/(this.stdev(!0)/e.sqrt(this.cols()))},ttest:function(r,n){return 1===n?1-t.studentt.cdf(e.abs(this.tscore(r)),this.cols()-1):2*t.studentt.cdf(-e.abs(this.tscore(r)),this.cols()-1)}}),t.extend({anovafscore:function(){var n,i,s,a,o,l,c,h,u=r.call(arguments);if(1===u.length){for(o=new Array(u[0].length),c=0;c<u[0].length;c++)o[c]=u[0][c];u=o}for(i=new Array,c=0;c<u.length;c++)i=i.concat(u[c]);for(s=t.mean(i),n=0,c=0;c<u.length;c++)n+=u[c].length*e.pow(t.mean(u[c])-s,2);for(n/=u.length-1,l=0,c=0;c<u.length;c++)for(a=t.mean(u[c]),h=0;h<u[c].length;h++)l+=e.pow(u[c][h]-a,2);return n/(l/=i.length-u.length)},anovaftest:function(){var e,i,s,a,o=r.call(arguments);if(n(o[0]))return 1-t.centralF.cdf(o[0],o[1],o[2]);var l=t.anovafscore(o);for(e=o.length-1,s=0,a=0;a<o.length;a++)s+=o[a].length;return i=s-e-1,1-t.centralF.cdf(l,e,i)},ftest:function(e,r,n){return 1-t.centralF.cdf(e,r,n)}}),t.extend(t.fn,{anovafscore:function(){return t.anovafscore(this.toArray())},anovaftes:function(){var e,r=0;for(e=0;e<this.length;e++)r+=this[e].length;return t.ftest(this.anovafscore(),this.length-1,r-this.length)}}),t.extend({qscore:function(){var i,s,a,o,l,c=r.call(arguments);return n(c[0])?(i=c[0],s=c[1],a=c[2],o=c[3],l=c[4]):(i=t.mean(c[0]),s=t.mean(c[1]),a=c[0].length,o=c[1].length,l=c[2]),e.abs(i-s)/(l*e.sqrt((1/a+1/o)/2))},qtest:function(){var e,n=r.call(arguments);3===n.length?(e=n[0],n=n.slice(1)):7===n.length?(e=t.qscore(n[0],n[1],n[2],n[3],n[4]),n=n.slice(5)):(e=t.qscore(n[0],n[1],n[2]),n=n.slice(3));var i=n[0],s=n[1];return 1-t.tukey.cdf(e,s,i-s)},tukeyhsd:function(e){for(var r=t.pooledstdev(e),n=e.map((function(e){return t.mean(e)})),i=e.reduce((function(t,e){return t+e.length}),0),s=[],a=0;a<e.length;++a)for(var o=a+1;o<e.length;++o){var l=t.qtest(n[a],n[o],e[a].length,e[o].length,r,i,e.length);s.push([[a,o],l])}return s}}),t.extend({normalci:function(){var n,i=r.call(arguments),s=new Array(2);return n=4===i.length?e.abs(t.normal.inv(i[1]/2,0,1)*i[2]/e.sqrt(i[3])):e.abs(t.normal.inv(i[1]/2,0,1)*t.stdev(i[2])/e.sqrt(i[2].length)),s[0]=i[0]-n,s[1]=i[0]+n,s},tci:function(){var n,i=r.call(arguments),s=new Array(2);return n=4===i.length?e.abs(t.studentt.inv(i[1]/2,i[3]-1)*i[2]/e.sqrt(i[3])):e.abs(t.studentt.inv(i[1]/2,i[2].length-1)*t.stdev(i[2],!0)/e.sqrt(i[2].length)),s[0]=i[0]-n,s[1]=i[0]+n,s},significant:function(t,e){return t<e}}),t.extend(t.fn,{normalci:function(e,r){return t.normalci(e,r,this.toArray())},tci:function(e,r){return t.tci(e,r,this.toArray())}}),t.extend(t.fn,{oneSidedDifferenceOfProportions:function(e,r,n,i){var a=s(e,r,n,i);return t.ztest(a,1)},twoSidedDifferenceOfProportions:function(e,r,n,i){var a=s(e,r,n,i);return t.ztest(a,2)}})}(t,Math),t.models=function(){function e(e){var n=e[0].length,i=t.arange(n).map((function(i){var s=t.arange(n).filter((function(t){return t!==i}));return r(t.col(e,i).map((function(t){return t[0]})),t.col(e,s))}));return i}function r(e,r){var n=e.length,i=r[0].length-1,s=n-i-1,a=t.lstsq(r,e),o=t.multiply(r,a.map((function(t){return[t]}))).map((function(t){return t[0]})),l=t.subtract(e,o),c=t.mean(e),h=t.sum(o.map((function(t){return Math.pow(t-c,2)}))),u=t.sum(e.map((function(t,e){return Math.pow(t-o[e],2)}))),d=h+u;return{exog:r,endog:e,nobs:n,df_model:i,df_resid:s,coef:a,predict:o,resid:l,ybar:c,SST:d,SSE:h,SSR:u,R2:h/d}}function n(r){var n=e(r.exog),i=Math.sqrt(r.SSR/r.df_resid),s=n.map((function(t){var e=t.SST,r=t.R2;return i/Math.sqrt(e*(1-r))})),a=r.coef.map((function(t,e){return(t-0)/s[e]})),o=a.map((function(e){var n=t.studentt.cdf(e,r.df_resid);return 2*(n>.5?1-n:n)})),l=t.studentt.inv(.975,r.df_resid),c=r.coef.map((function(t,e){var r=l*s[e];return[t-r,t+r]}));return{se:s,t:a,p:o,sigmaHat:i,interval95:c}}function i(e){var r=e.R2/e.df_model/((1-e.R2)/e.df_resid),n=function(e,r,n){return t.beta.cdf(e/(n/r+e),r/2,n/2)};return{F_statistic:r,pvalue:1-n(r,e.df_model,e.df_resid)}}function s(t,e){var s=r(t,e),a=n(s),o=i(s),l=1-(1-s.R2)*((s.nobs-1)/s.df_resid);return s.t=a,s.f=o,s.adjust_R2=l,s}return{ols:s}}(),t.extend({buildxmatrix:function(){for(var e=new Array(arguments.length),r=0;r<arguments.length;r++){var n=[1];e[r]=n.concat(arguments[r])}return t(e)},builddxmatrix:function(){for(var e=new Array(arguments[0].length),r=0;r<arguments[0].length;r++){var n=[1];e[r]=n.concat(arguments[0][r])}return t(e)},buildjxmatrix:function(e){for(var r=new Array(e.length),n=0;n<e.length;n++)r[n]=e[n];return t.builddxmatrix(r)},buildymatrix:function(e){return t(e).transpose()},buildjymatrix:function(t){return t.transpose()},matrixmult:function(e,r){var n,i,s,a,o;if(e.cols()==r.rows()){if(r.rows()>1){for(a=[],n=0;n<e.rows();n++)for(a[n]=[],i=0;i<r.cols();i++){for(o=0,s=0;s<e.cols();s++)o+=e.toArray()[n][s]*r.toArray()[s][i];a[n][i]=o}return t(a)}for(a=[],n=0;n<e.rows();n++)for(a[n]=[],i=0;i<r.cols();i++){for(o=0,s=0;s<e.cols();s++)o+=e.toArray()[n][s]*r.toArray()[i];a[n][i]=o}return t(a)}},regress:function(e,r){var n=t.xtranspxinv(e),i=e.transpose(),s=t.matrixmult(t(n),i);return t.matrixmult(s,r)},regresst:function(e,r,n){var i=t.regress(e,r),s={anova:{}},a=t.jMatYBar(e,i);s.yBar=a;var o=r.mean();s.anova.residuals=t.residuals(r,a),s.anova.ssr=t.ssr(a,o),s.anova.msr=s.anova.ssr/(e[0].length-1),s.anova.sse=t.sse(r,a),s.anova.mse=s.anova.sse/(r.length-(e[0].length-1)-1),s.anova.sst=t.sst(r,o),s.anova.mst=s.anova.sst/(r.length-1),s.anova.r2=1-s.anova.sse/s.anova.sst,s.anova.r2<0&&(s.anova.r2=0),s.anova.fratio=s.anova.msr/s.anova.mse,s.anova.pvalue=t.anovaftest(s.anova.fratio,e[0].length-1,r.length-(e[0].length-1)-1),s.anova.rmse=Math.sqrt(s.anova.mse),s.anova.r2adj=1-s.anova.mse/s.anova.mst,s.anova.r2adj<0&&(s.anova.r2adj=0),s.stats=new Array(e[0].length);for(var l,c,h,u=t.xtranspxinv(e),d=0;d<i.length;d++)l=Math.sqrt(s.anova.mse*Math.abs(u[d][d])),c=Math.abs(i[d]/l),h=t.ttest(c,r.length-e[0].length-1,n),s.stats[d]=[i[d],l,c,h];return s.regress=i,s},xtranspx:function(e){return t.matrixmult(e.transpose(),e)},xtranspxinv:function(e){var r=t.matrixmult(e.transpose(),e);return t.inv(r)},jMatYBar:function(e,r){var n=t.matrixmult(e,r);return new t(n)},residuals:function(e,r){return t.matrixsubtract(e,r)},ssr:function(t,e){for(var r=0,n=0;n<t.length;n++)r+=Math.pow(t[n]-e,2);return r},sse:function(t,e){for(var r=0,n=0;n<t.length;n++)r+=Math.pow(t[n]-e[n],2);return r},sst:function(t,e){for(var r=0,n=0;n<t.length;n++)r+=Math.pow(t[n]-e,2);return r},matrixsubtract:function(e,r){for(var n=new Array(e.length),i=0;i<e.length;i++){n[i]=new Array(e[i].length);for(var s=0;s<e[i].length;s++)n[i][s]=e[i][s]-r[i][s]}return t(n)}}),t.jStat=t,t}()}(Xo);var Yo=Wo(Xo.exports);class Zo{static hM2Hr(t,e){return 0===t&&0===e?0:t/(t+e)}static faCr2Far(t,e){return 0===t&&0===e?0:t/(t+e)}static hMFaCr2Acc(t,e,r,n){return 0===t&&0===e&&0===r&&0===n?0:(t+n)/(t+e+r+n)}static hrFar2Acc(t,e){return(t+(1-e))/2}static hFa2Ppv(t,e){return 0===t&&0===e?0:t/(t+e)}static mCr2Fomr(t,e){return 0===t&&0===e?0:t/(t+e)}static hrFar2D(t,e,r=1){return 1===r?Yo.normal.inv(t,0,1)-Yo.normal.inv(e,0,1):Math.sqrt(2/(r*r+1))*(r*Yo.normal.inv(t,0,1)-Yo.normal.inv(e,0,1))}static hrFar2C(t,e,r=1){return 1===r?-(Yo.normal.inv(t,0,1)+Yo.normal.inv(e,0,1))/2:Math.sqrt(2/(r*r+1))*(r/(r+1))*-(Yo.normal.inv(t,0,1)+Yo.normal.inv(e,0,1))}static dC2Hr(t,e,r=1){return 1===r?Yo.normal.cdf(t/2-e,0,1):Yo.normal.cdf(Math.sqrt((r*r+1)/2)*(t/(1+r)-e/r),0,1)}static dC2Far(t,e,r=1){return 1===r?Yo.normal.cdf(-(t/2+e),0,1):Yo.normal.cdf(Math.sqrt((r*r+1)/2)*-(t/(1+r)+e),0,1)}static dFar2Hr(t,e,r=1){return 1===r?Yo.normal.cdf(t+Yo.normal.inv(e,0,1),0,1):Yo.normal.cdf((Math.sqrt((r*r+1)/2)*t+Yo.normal.inv(e,0,1))/r,0,1)}static cFar2Hr(t,e,r=1){return 1===r?Yo.normal.cdf(-2*t-Yo.normal.inv(e,0,1),0,1):Yo.normal.cdf(-Math.sqrt((r*r+1)/2)*((r+1)/r)*t-Yo.normal.inv(e,0,1),0,1)}static d2MuN(t,e=1){return 1===e?-t/2:-Math.sqrt((e*e+1)/2)*(1/(e+1))*t}static muN2D(t,e=1){return 1===e?-2*t:-Math.sqrt(2/(e*e+1))*(e+1)*t}static d2MuS(t,e=1){return 1===e?t/2:Math.sqrt((e*e+1)/2)*(e/(e+1))*t}static muS2D(t,e=1){return 1===e?2*t:Math.sqrt(2/(e*e+1))*((e+1)/e)*t}static c2L(t,e=1){return 1===e?t:Math.sqrt((e*e+1)/2)*t}static l2C(t,e=1){return 1===e?t:Math.sqrt(2/(e*e+1))*t}static s2H(t=1){return 1/(t*Math.sqrt(2*Math.PI))}static h2S(t){return 1/(t*Math.sqrt(2*Math.PI))}static hr2Zhr(t){return Yo.normal.inv(t,0,1)}static far2Zfar(t){return Yo.normal.inv(t,0,1)}static zhr2Hr(t){return Yo.normal.cdf(t,0,1)}static zfar2Far(t){return Yo.normal.cdf(t,0,1)}}class Go extends Bo{static get properties(){return{contour:{attribute:"contour",type:String,reflect:!0},point:{attribute:"point",type:String,reflect:!0},isoD:{attribute:"iso-d",type:String,reflect:!0},isoC:{attribute:"iso-c",type:String,reflect:!0},zRoc:{attribute:"z-roc",type:Boolean,reflect:!0},far:{attribute:"far",type:Number,reflect:!0},hr:{attribute:"hr",type:Number,reflect:!0},d:{attribute:!1,type:Number,reflect:!1},c:{attribute:!1,type:Number,reflect:!1},s:{attribute:!1,type:Number,reflect:!1},width:{attribute:!1,type:Number,reflect:!1},height:{attribute:!1,type:Number,reflect:!1},rem:{attribute:!1,type:Number,reflect:!1}}}constructor(){super(),this.firstUpdate=!0,this.drag=!1,this.sdt=!1,this.contours=["sensitivity","bias","accuracy"],this.contour=void 0,this.points=["all","first","rest","none"],this.point="all",this.isoDs=["all","first","rest","none"],this.isoD="first",this.isoCs=["all","first","rest","none"],this.isoC="first",this.zRoc=!1,this.far=.25,this.hr=.75,this.s=1,this.label="",this.locations=[{name:"default",far:this.far,hr:this.hr,s:this.s,label:""}],this.pointArray=[],this.isoDArray=[],this.isoCArray=[],this.width=NaN,this.height=NaN,this.rem=NaN,this.alignState()}alignState(){this.locations[0].hr=this.hr,this.locations[0].far=this.far,this.locations[0].s=this.s,this.locations[0].label=this.label,this.d=Zo.hrFar2D(this.hr,this.far,this.s),this.c=Zo.hrFar2C(this.hr,this.far,this.s),this.pointArray=[],this.isoDArray=[],this.isoCArray=[],this.locations.forEach(((t,e)=>{t.d=Zo.hrFar2D(t.hr,t.far,t.s),t.c=Zo.hrFar2C(t.hr,t.far,t.s),0!==e||"first"!==this.point&&"all"!==this.point?e>0&&("rest"===this.point||"all"===this.point)&&this.pointArray.push(t):this.pointArray.push(t),0!==e||"first"!==this.isoD&&"all"!==this.isoD?e>0&&("rest"===this.isoD||"all"===this.isoD)&&this.isoDArray.push(t):this.isoDArray.push(t),0!==e||"first"!==this.isoC&&"all"!==this.isoC?e>0&&("rest"===this.isoC||"all"===this.isoC)&&this.isoCArray.push(t):this.isoCArray.push(t)}))}set(t,e,r="default",n="",i=1){"default"===r&&(this.hr=t,this.far=e,this.s=i,this.label=n);const s=this.locations.find((t=>t.name===r));void 0===s?this.locations.push({name:r,far:e,hr:t,s:i,label:n}):(s.hr=t,s.far=e,s.s=i,s.label=n),this.requestUpdate()}setWithSDT(t,e,r="default",n="",i=1){"default"===r&&(this.hr=Zo.dC2Hr(t,e,i),this.far=Zo.dC2Far(t,e,i),this.s=i,this.label=n);const s=this.locations.find((t=>t.name===r));void 0===s?this.locations.push({name:r,far:Zo.dC2Far(t,e,i),hr:Zo.dC2Hr(t,e,i),s:i,label:n}):(s.hr=Zo.dC2Hr(t,e,i),s.far=Zo.dC2Far(t,e,i),s.s=i,s.label=n),this.sdt=!0,this.requestUpdate()}static get styles(){return[super.styles,nt`
|
|
881
881
|
:host {
|
|
882
882
|
display: inline-block;
|
|
883
883
|
|
|
@@ -1009,9 +1009,9 @@ const Ho=t=>null!=t?t:z;customElements.define("decidables-slider",class extends
|
|
|
1009
1009
|
|
|
1010
1010
|
fill: var(---color-text-inverse);
|
|
1011
1011
|
}
|
|
1012
|
-
`]}render(){return
|
|
1013
|
-
${
|
|
1014
|
-
`}getDimensions(){this.width=parseFloat(this.getComputedStyleValue("width"),10),this.height=parseFloat(this.getComputedStyleValue("height"),10),this.rem=parseFloat(getComputedStyle(document.documentElement).getPropertyValue("font-size"),10)}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.getDimensions.bind(this))}disconnectedCallback(){window.removeEventListener("resize",this.getDimensions.bind(this)),super.disconnectedCallback()}firstUpdated(t){super.firstUpdated(t),this.getDimensions()}update(t){if(super.update(t),this.alignState(),Number.isNaN(this.width)||Number.isNaN(this.height)||Number.isNaN(this.rem))return;const e=this.width,r=this.height,n=Math.min(e,r),i=2*this.rem,s=3*this.rem,a=3*this.rem,o=n-(i+s),l=n-(a+2*this.rem),c=parseInt(this.getComputedStyleValue("---transition-duration"),10),h=Mo().domain(this.zRoc?[-3,3]:[0,1]).range([0,l]);this.xScale=h;const u=Mo().domain(this.zRoc?[3,-3]:[1,0]).range([0,o]);this.yScale=u;const d=tn().subject(((t,e)=>({x:this.xScale(this.zRoc?Vo.far2Zfar(e.far):e.far),y:this.yScale(this.zRoc?Vo.hr2Zhr(e.hr):e.hr)}))).on("start",(t=>{Lr(t.currentTarget).classed("dragging",!0)})).on("drag",((t,e)=>{this.drag=!0;const r=this.zRoc?Vo.zfar2Far(this.xScale.invert(t.x)):this.xScale.invert(t.x),n=this.zRoc?Vo.zhr2Hr(this.yScale.invert(t.y)):this.yScale.invert(t.y);e.far=r<.001?.001:r>.999?.999:r,e.hr=n<=.001?.001:n>=.999?.999:n,"default"===e.name&&(this.far=e.far,this.hr=e.hr),this.alignState(),this.requestUpdate(),this.dispatchEvent(new CustomEvent("roc-point-change",{detail:{name:e.name,far:e.far,hr:e.hr,d:e.d,c:e.c,s:e.s,label:e.label},bubbles:!0}))})).on("end",(t=>{Lr(t.currentTarget).classed("dragging",!1)})),p=zo().x((t=>h(this.zRoc?Vo.far2Zfar(t.far):t.far))).y((t=>u(this.zRoc?Vo.hr2Zhr(t.hr):t.hr))),f=Lr(this.renderRoot).selectAll(".main").data([{width:this.width,height:this.height,rem:this.rem}]),m=f.enter().append("svg").classed("main",!0),b=m.merge(f).attr("viewBox",`0 0 ${n} ${n}`),v=m.append("g").classed("plot",!0),g=b.select(".plot").attr("transform",`translate(${a}, ${i})`);v.append("clipPath").attr("id","clip-roc-space").append("rect"),g.select("clipPath rect").attr("height",o+1).attr("width",l+1);const y=v.append("g").classed("underlayer",!0),w=g.select(".underlayer");if(y.append("rect").classed("background",!0),w.select(".background").attr("height",o).attr("width",l),this.firstUpdate||t.has("contour")||t.has("zRoc")||t.has("width")||t.has("height")||t.has("rem")||t.has("s"))if(void 0!==this.contour){const t=100,e=[];for(let r=.5,n=0;r<t;r+=1)for(let i=.5;i<t;i+=1,n+=1){const s=this.zRoc?Vo.zhr2Hr(i/t*6-3):i/t,a=this.zRoc?Vo.zfar2Far(6*(1-r/t)-3):1-r/t;e[n]="bias"===this.contour?Vo.hrFar2C(s,a,this.s):"sensitivity"===this.contour?Vo.hrFar2D(s,a,this.s):"accuracy"===this.contour?Vo.hrFar2Acc(s,a):null}const r="bias"===this.contour?ue(-3,3,.25):"sensitivity"===this.contour?ue(-6,6,.5):"accuracy"===this.contour?ue(0,1,.05):null,n=ks().size([t,t]).thresholds(r),i=this.getComputedStyleValue("bias"===this.contour?"---color-element-background":"sensitivity"===this.contour?"---color-d":"accuracy"===this.contour?"---color-acc-dark":null),s=this.getComputedStyleValue("bias"===this.contour?"---color-c":"sensitivity"===this.contour||"accuracy"===this.contour?"---color-element-background":null),a=Mo().domain(Qt(r)).interpolate((()=>Fn(i,s))),o=w.selectAll(".plot-contour").data([this.contour]),h=o.enter().append("g").classed("plot-contour",!0).merge(o).selectAll(".contour").data(n(e));h.enter().append("path").classed("contour",!0).merge(h).transition().duration(2*c).ease(rs).attr("d",ho(mo().scale(l/t))).attr("fill",(t=>a(t.value))),h.exit().remove();const u=w.selectAll(".title-contour").data([this.contour]);u.enter().append("text").classed("title-contour",!0).attr("text-anchor","middle").merge(u).classed("math-var","bias"===this.contour||"sensitivity"===this.contour).attr("transform","bias"===this.contour||"sensitivity"===this.contour?`translate(${l+1.25*this.rem}, ${this.rem})`:"accuracy"===this.contour?`translate(${l+1.125*this.rem}, ${this.rem})`:null).text("bias"===this.contour?"c":"sensitivity"===this.contour?"d′":"accuracy"===this.contour?"Acc":null);const d=100,p=[];for(let e=.5,r=0;e<d;e+=1,r+=4)p[r]="bias"===this.contour?-(e/t*6-3):"sensitivity"===this.contour?e/t*12-6:"accuracy"===this.contour?e/t:null,p[r+1]=p[r],p[r+2]=p[r],p[r+3]=p[r];const f=ks().size([4,d]).thresholds(r),m=Mo().domain("bias"===this.contour?[3,-3]:"sensitivity"===this.contour?[6,-6]:"accuracy"===this.contour?[1,0]:null).range([0,10*this.rem]),b=w.selectAll(".legend-contour").data([this.contour]),v=b.enter().append("g").classed("legend-contour",!0),g=v.merge(b).attr("transform","bias"===this.contour||"sensitivity"===this.contour?`translate(${l+1.25*this.rem}, ${1.5*this.rem})`:"accuracy"===this.contour?`translate(${l+1.5*this.rem}, ${1.5*this.rem})`:null);b.exit().remove(),v.append("g").classed("axis-contour",!0),g.select(".axis-contour").call(xe(m).ticks(7).tickSize(0)).attr("font-size",null).attr("font-family",null);const y=g.selectAll(".contour").data(f(p));y.enter().append("path").classed("contour",!0).merge(y).attr("d",ho(mo().scale(10*this.rem/d))).attr("fill",(t=>a(t.value))),y.exit().remove()}else{w.selectAll(".plot-contour").data([]).exit().remove();w.selectAll(".title-contour").data([]).exit().remove();w.selectAll(".legend-contour").data([]).exit().remove()}y.append("g").classed("axis-x",!0);w.select(".axis-x").attr("transform",`translate(0, ${o})`).transition().duration(2*c).ease(rs).call(we(h)).attr("font-size",null).attr("font-family",null).selectAll("line, path").attr("stroke",null);const x=y.append("text").classed("title-x",!0).attr("text-anchor","middle");x.append("tspan").classed("z math-var",!0),x.append("tspan").classed("name",!0);const $=w.select(".title-x").attr("transform",`translate(${l/2}, ${o+2.25*this.rem})`);$.select("tspan.z").text(this.zRoc?"z":""),$.select("tspan.name").text(this.zRoc?"(False Alarm Rate)":"False Alarm Rate"),y.append("g").classed("axis-y",!0);w.select(".axis-y").transition().duration(2*c).ease(rs).call(xe(u)).attr("font-size",null).attr("font-family",null).selectAll("line, path").attr("stroke",null);const _=y.append("text").classed("title-y",!0).attr("text-anchor","middle");_.append("tspan").classed("z math-var",!0),_.append("tspan").classed("name",!0);const k=w.select(".title-y").attr("transform",`translate(${-2*this.rem}, ${o/2})rotate(-90)`);k.select("tspan.z").text(this.zRoc?"z":""),k.select("tspan.name").text(this.zRoc?"(Hit Rate)":"Hit Rate"),y.append("line").classed("diagonal",!0),w.select(".diagonal").attr("x1",this.zRoc?h(-3):h(0)).attr("y1",this.zRoc?u(-3):u(0)).attr("x2",this.zRoc?h(3):h(1)).attr("y2",this.zRoc?u(3):u(1)),v.append("g").classed("content",!0);const S=g.select(".content"),A=S.selectAll(".curve-iso-d").data(this.isoDArray,(t=>t.name)),E=A.enter().append("path").classed("curve-iso-d",!0).attr("clip-path","url(#clip-roc-space)").merge(A);this.firstUpdate||t.has("zRoc")?E.transition().duration(this.drag?0:2*c).ease(rs).attr("d",(t=>p(ue(h.range()[0],h.range()[1]+1,1).map((e=>({far:this.zRoc?Vo.zfar2Far(h.invert(e)):h.invert(e),hr:this.zRoc?Vo.dFar2Hr(t.d,Vo.zfar2Far(h.invert(e)),t.s):Vo.dFar2Hr(t.d,h.invert(e),t.s)})))))):this.sdt?E.transition().duration(this.drag?0:c).ease(rs).attrTween("d",((t,e,r)=>{const n=r[e];n.hr=void 0,n.far=void 0;const i=Vn(void 0!==n.d?n.d:t.d,t.d),s=Vn(void 0!==n.s?n.s:t.s,t.s);return t=>{n.d=i(t),n.s=s(t);const e=ue(h.range()[0],h.range()[1]+1,1).map((t=>({far:this.zRoc?Vo.zfar2Far(h.invert(t)):h.invert(t),hr:this.zRoc?Vo.dFar2Hr(n.d,Vo.zfar2Far(h.invert(t)),n.s):Vo.dFar2Hr(n.d,h.invert(t),n.s)})));return p(e)}})):E.transition().duration(this.drag?0:c).ease(rs).attrTween("d",((t,e,r)=>{const n=r[e];n.d=void 0,n.s=void 0;const i=Vn(void 0!==n.hr?n.hr:t.hr,t.hr),s=Vn(void 0!==n.far?n.far:t.far,t.far);return e=>{n.hr=i(e),n.far=s(e);const r=ue(h.range()[0],h.range()[1]+1,1).map((e=>({far:this.zRoc?Vo.zfar2Far(h.invert(e)):h.invert(e),hr:this.zRoc?Vo.dFar2Hr(Vo.hrFar2D(n.hr,n.far,t.s),Vo.zfar2Far(h.invert(e)),t.s):Vo.dFar2Hr(Vo.hrFar2D(n.hr,n.far,t.s),h.invert(e),t.s)})));return p(r)}})),A.exit().remove();const M=S.selectAll(".curve-iso-c").data(this.isoCArray,(t=>t.name)),T=M.enter().append("path").classed("curve-iso-c",!0).attr("clip-path","url(#clip-roc-space)").merge(M);this.firstUpdate||t.has("zRoc")?T.transition().duration(this.drag?0:2*c).ease(rs).attr("d",(t=>p(ue(h.range()[0],h.range()[1]+1,1).map((e=>({far:this.zRoc?Vo.zfar2Far(h.invert(e)):h.invert(e),hr:this.zRoc?Vo.cFar2Hr(t.c,Vo.zfar2Far(h.invert(e)),t.s):Vo.cFar2Hr(t.c,h.invert(e),t.s)})))))):this.sdt?T.transition().duration(this.drag?0:c).ease(rs).attrTween("d",((t,e,r)=>{const n=r[e];n.hr=void 0,n.far=void 0;const i=Vn(void 0!==n.c?n.c:t.c,t.c),s=Vn(void 0!==n.s?n.s:t.s,t.s);return t=>{n.c=i(t),n.s=s(t);const e=ue(h.range()[0],h.range()[1]+1,1).map((t=>({far:this.zRoc?Vo.zfar2Far(h.invert(t)):h.invert(t),hr:this.zRoc?Vo.cFar2Hr(n.c,Vo.zfar2Far(h.invert(t)),n.s):Vo.cFar2Hr(n.c,h.invert(t),n.s)})));return p(e)}})):T.transition().duration(this.drag?0:c).ease(rs).attrTween("d",((t,e,r)=>{const n=r[e];n.c=void 0,n.s=void 0;const i=Vn(void 0!==n.hr?n.hr:t.hr,t.hr),s=Vn(void 0!==n.far?n.far:t.far,t.far);return e=>{n.hr=i(e),n.far=s(e);const r=ue(h.range()[0],h.range()[1]+1,1).map((e=>({far:this.zRoc?Vo.zfar2Far(h.invert(e)):h.invert(e),hr:this.zRoc?Vo.cFar2Hr(Vo.hrFar2C(n.hr,n.far,t.s),Vo.zfar2Far(h.invert(e)),t.s):Vo.cFar2Hr(Vo.hrFar2C(n.hr,n.far,t.s),h.invert(e),t.s)})));return p(r)}})),M.exit().remove();const C=S.selectAll(".point").data(this.pointArray,(t=>t.name)),N=C.enter().append("g").classed("point",!0);N.append("circle").classed("circle",!0),N.append("text").classed("label",!0);const R=N.merge(C);R.select("text").text((t=>t.label)),(this.firstUpdate||t.has("interactive"))&&(this.interactive?R.attr("tabindex",0).classed("interactive",!0).call(d).on("keydown",((t,e)=>{if(["ArrowUp","ArrowDown","ArrowRight","ArrowLeft"].includes(t.key)){let r=this.zRoc?Vo.hr2Zhr(e.hr):e.hr,n=this.zRoc?Vo.far2Zfar(e.far):e.far;switch(t.key){case"ArrowUp":r+=this.zRoc?t.shiftKey?.05:.25:t.shiftKey?.01:.05;break;case"ArrowDown":r-=this.zRoc?t.shiftKey?.05:.25:t.shiftKey?.01:.05;break;case"ArrowRight":n+=this.zRoc?t.shiftKey?.05:.25:t.shiftKey?.01:.05;break;case"ArrowLeft":n-=this.zRoc?t.shiftKey?.05:.25:t.shiftKey?.01:.05}r=this.zRoc?Vo.zhr2Hr(r):r,n=this.zRoc?Vo.zfar2Far(n):n,r=r<.001?.001:r>.999?.999:r,n=n<.001?.001:n>.999?.999:n,r===e.hr&&n===e.far||(e.hr=r,e.far=n,"default"===e.name&&(this.hr=e.hr,this.far=e.far),this.alignState(),this.requestUpdate(),this.dispatchEvent(new CustomEvent("roc-point-change",{detail:{name:e.name,far:e.far,hr:e.hr,d:e.d,c:e.c,s:e.s,label:e.label},bubbles:!0}))),t.preventDefault()}})):R.attr("tabindex",null).classed("interactive",!1).on("drag",null).on("keydown",null)),this.firstUpdate||t.has("zRoc")?R.transition().duration(this.drag?0:2*c).ease(rs).attr("transform",((t,e,r)=>{const n=r[e];return n.d=void 0,n.c=void 0,n.s=void 0,`translate(\n ${h(this.zRoc?Vo.far2Zfar(t.far):t.far)},\n ${u(this.zRoc?Vo.hr2Zhr(t.hr):t.hr)}\n )`})):this.sdt?R.transition().duration(this.drag?0:c).ease(rs).attrTween("transform",((t,e,r)=>{const n=r[e],i=Vn(void 0!==n.d?n.d:t.d,t.d),s=Vn(void 0!==n.c?n.c:t.c,t.c),a=Vn(void 0!==n.s?n.s:t.s,t.s);return t=>(n.d=i(t),n.c=s(t),n.s=a(t),`translate(\n ${h(this.zRoc?Vo.far2Zfar(Vo.dC2Far(n.d,n.c,n.s)):Vo.dC2Far(n.d,n.c,n.s))},\n ${u(this.zRoc?Vo.hr2Zhr(Vo.dC2Hr(n.d,n.c,n.s)):Vo.dC2Hr(n.d,n.c,n.s))}\n )`)})):R.transition().duration(this.drag?0:c).ease(rs).attr("transform",((t,e,r)=>{const n=r[e];return n.d=void 0,n.c=void 0,n.s=void 0,`translate(\n ${h(this.zRoc?Vo.far2Zfar(t.far):t.far)},\n ${u(this.zRoc?Vo.hr2Zhr(t.hr):t.hr)}\n )`})),C.exit().remove(),this.drag=!1,this.sdt=!1,this.firstUpdate=!1}}customElements.define("roc-space",Ko);class Wo extends Io{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},payoff:{attribute:"payoff",type:Number,reflect:!0},color:{attribute:"color",type:String,reflect:!0},zRoc:{attribute:"z-roc",type:Boolean,reflect:!0},run:{attribute:"run",type:Boolean,reflect:!0},pause:{attribute:"pause",type:Boolean,reflect:!0},reset:{attribute:"reset",type:Boolean,reflect:!0},state:{atribute:!1,type:String,reflect:!1}}}constructor(){super(),this.trials=void 0,this.duration=void 0,this.coherence=void 0,this.payoff=void 0,this.colors=["none","accuracy","stimulus","response","outcome","all"],this.color=void 0,this.zRoc=void 0,this.run=!1,this.pause=!1,this.reset=!1,this.states=["resetted","running","paused","ended"],this.state="resetted"}setTrials(t){this.trials=t.target.value,this.dispatchEvent(new CustomEvent("detectable-control-trials",{detail:{trials:this.trials},bubbles:!0}))}setDuration(t){this.duration=t.target.value,this.dispatchEvent(new CustomEvent("detectable-control-duration",{detail:{duration:this.duration},bubbles:!0}))}setCoherence(t){this.coherence=t.target.value,this.dispatchEvent(new CustomEvent("detectable-control-coherence",{detail:{coherence:this.coherence},bubbles:!0}))}setPayoff(t){this.payoff=t.target.value,this.dispatchEvent(new CustomEvent("detectable-control-payoff",{detail:{payoff:this.payoff},bubbles:!0}))}chooseColor(t){this.color=t.target.value,this.dispatchEvent(new CustomEvent("detectable-control-color",{detail:{color:this.color},bubbles:!0}))}flipZRoc(t){this.zRoc=t.target.checked,this.dispatchEvent(new CustomEvent("detectable-control-z-roc",{detail:{zRoc:this.zRoc},bubbles:!0}))}doRun(){this.state="running",this.dispatchEvent(new CustomEvent("detectable-control-run",{detail:{},bubbles:!0}))}doPause(){this.state="paused",this.dispatchEvent(new CustomEvent("detectable-control-pause",{detail:{},bubbles:!0}))}doReset(){this.state="resetted",this.dispatchEvent(new CustomEvent("detectable-control-reset",{detail:{},bubbles:!0}))}complete(){this.state="ended"}static get styles(){return[super.styles,Q`
|
|
1012
|
+
`]}render(){return Pt`
|
|
1013
|
+
${Bo.svgFilters}
|
|
1014
|
+
`}getDimensions(){this.width=parseFloat(this.getComputedStyleValue("width"),10),this.height=parseFloat(this.getComputedStyleValue("height"),10),this.rem=parseFloat(getComputedStyle(document.documentElement).getPropertyValue("font-size"),10)}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.getDimensions.bind(this))}disconnectedCallback(){window.removeEventListener("resize",this.getDimensions.bind(this)),super.disconnectedCallback()}firstUpdated(t){super.firstUpdated(t),this.getDimensions()}update(t){if(super.update(t),this.alignState(),Number.isNaN(this.width)||Number.isNaN(this.height)||Number.isNaN(this.rem))return;const e=this.width,r=this.height,n=Math.min(e,r),i=2*this.rem,s=3*this.rem,a=3*this.rem,o=n-(i+s),l=n-(a+2*this.rem),c=parseInt(this.getComputedStyleValue("---transition-duration"),10),h=Ro().domain(this.zRoc?[-3,3]:[0,1]).range([0,l]);this.xScale=h;const u=Ro().domain(this.zRoc?[3,-3]:[1,0]).range([0,o]);this.yScale=u;const d=cn().subject(((t,e)=>({x:this.xScale(this.zRoc?Zo.far2Zfar(e.far):e.far),y:this.yScale(this.zRoc?Zo.hr2Zhr(e.hr):e.hr)}))).on("start",(t=>{Zr(t.currentTarget).classed("dragging",!0)})).on("drag",((t,e)=>{this.drag=!0;const r=this.zRoc?Zo.zfar2Far(this.xScale.invert(t.x)):this.xScale.invert(t.x),n=this.zRoc?Zo.zhr2Hr(this.yScale.invert(t.y)):this.yScale.invert(t.y);e.far=r<.001?.001:r>.999?.999:r,e.hr=n<=.001?.001:n>=.999?.999:n,"default"===e.name&&(this.far=e.far,this.hr=e.hr),this.alignState(),this.requestUpdate(),this.dispatchEvent(new CustomEvent("roc-point-change",{detail:{name:e.name,far:e.far,hr:e.hr,d:e.d,c:e.c,s:e.s,label:e.label},bubbles:!0}))})).on("end",(t=>{Zr(t.currentTarget).classed("dragging",!1)})),p=Uo().x((t=>h(this.zRoc?Zo.far2Zfar(t.far):t.far))).y((t=>u(this.zRoc?Zo.hr2Zhr(t.hr):t.hr))),f=Zr(this.renderRoot).selectAll(".main").data([{width:this.width,height:this.height,rem:this.rem}]),m=f.enter().append("svg").classed("main",!0),b=m.merge(f).attr("viewBox",`0 0 ${n} ${n}`),v=m.append("g").classed("plot",!0),g=b.select(".plot").attr("transform",`translate(${a}, ${i})`);v.append("clipPath").attr("id","clip-roc-space").append("rect"),g.select("clipPath rect").attr("height",o+1).attr("width",l+1);const y=v.append("g").classed("underlayer",!0),w=g.select(".underlayer");if(y.append("rect").classed("background",!0),w.select(".background").attr("height",o).attr("width",l),this.firstUpdate||t.has("contour")||t.has("zRoc")||t.has("width")||t.has("height")||t.has("rem")||t.has("s"))if(void 0!==this.contour){const t=100,e=[];for(let r=.5,n=0;r<t;r+=1)for(let i=.5;i<t;i+=1,n+=1){const s=this.zRoc?Zo.zhr2Hr(i/t*6-3):i/t,a=this.zRoc?Zo.zfar2Far(6*(1-r/t)-3):1-r/t;e[n]="bias"===this.contour?Zo.hrFar2C(s,a,this.s):"sensitivity"===this.contour?Zo.hrFar2D(s,a,this.s):"accuracy"===this.contour?Zo.hrFar2Acc(s,a):null}const r="bias"===this.contour?ge(-3,3,.25):"sensitivity"===this.contour?ge(-6,6,.5):"accuracy"===this.contour?ge(0,1,.05):null,n=Ns().size([t,t]).thresholds(r),i=this.getComputedStyleValue("bias"===this.contour?"---color-element-background":"sensitivity"===this.contour?"---color-d":"accuracy"===this.contour?"---color-acc-dark":null),s=this.getComputedStyleValue("bias"===this.contour?"---color-c":"sensitivity"===this.contour||"accuracy"===this.contour?"---color-element-background":null),a=Ro().domain(ae(r)).interpolate((()=>jn(i,s))),o=w.selectAll(".plot-contour").data([this.contour]),h=o.enter().append("g").classed("plot-contour",!0).merge(o).selectAll(".contour").data(n(e));h.enter().append("path").classed("contour",!0).merge(h).transition().duration(2*c).ease(cs).attr("d",go($o().scale(l/t))).attr("fill",(t=>a(t.value))),h.exit().remove();const u=w.selectAll(".title-contour").data([this.contour]);u.enter().append("text").classed("title-contour",!0).attr("text-anchor","middle").merge(u).classed("math-var","bias"===this.contour||"sensitivity"===this.contour).attr("transform","bias"===this.contour||"sensitivity"===this.contour?`translate(${l+1.25*this.rem}, ${this.rem})`:"accuracy"===this.contour?`translate(${l+1.125*this.rem}, ${this.rem})`:null).text("bias"===this.contour?"c":"sensitivity"===this.contour?"d′":"accuracy"===this.contour?"Acc":null);const d=100,p=[];for(let e=.5,r=0;e<d;e+=1,r+=4)p[r]="bias"===this.contour?-(e/t*6-3):"sensitivity"===this.contour?e/t*12-6:"accuracy"===this.contour?e/t:null,p[r+1]=p[r],p[r+2]=p[r],p[r+3]=p[r];const f=Ns().size([4,d]).thresholds(r),m=Ro().domain("bias"===this.contour?[3,-3]:"sensitivity"===this.contour?[6,-6]:"accuracy"===this.contour?[1,0]:null).range([0,10*this.rem]),b=w.selectAll(".legend-contour").data([this.contour]),v=b.enter().append("g").classed("legend-contour",!0),g=v.merge(b).attr("transform","bias"===this.contour||"sensitivity"===this.contour?`translate(${l+1.25*this.rem}, ${1.5*this.rem})`:"accuracy"===this.contour?`translate(${l+1.5*this.rem}, ${1.5*this.rem})`:null);b.exit().remove(),v.append("g").classed("axis-contour",!0),g.select(".axis-contour").call(Re(m).ticks(7).tickSize(0)).attr("font-size",null).attr("font-family",null);const y=g.selectAll(".contour").data(f(p));y.enter().append("path").classed("contour",!0).merge(y).attr("d",go($o().scale(10*this.rem/d))).attr("fill",(t=>a(t.value))),y.exit().remove()}else{w.selectAll(".plot-contour").data([]).exit().remove();w.selectAll(".title-contour").data([]).exit().remove();w.selectAll(".legend-contour").data([]).exit().remove()}y.append("g").classed("axis-x",!0);w.select(".axis-x").attr("transform",`translate(0, ${o})`).transition().duration(2*c).ease(cs).call(Ne(h)).attr("font-size",null).attr("font-family",null).selectAll("line, path").attr("stroke",null);const x=y.append("text").classed("title-x",!0).attr("text-anchor","middle");x.append("tspan").classed("z math-var",!0),x.append("tspan").classed("name",!0);const $=w.select(".title-x").attr("transform",`translate(${l/2}, ${o+2.25*this.rem})`);$.select("tspan.z").text(this.zRoc?"z":""),$.select("tspan.name").text(this.zRoc?"(False Alarm Rate)":"False Alarm Rate"),y.append("g").classed("axis-y",!0);w.select(".axis-y").transition().duration(2*c).ease(cs).call(Re(u)).attr("font-size",null).attr("font-family",null).selectAll("line, path").attr("stroke",null);const _=y.append("text").classed("title-y",!0).attr("text-anchor","middle");_.append("tspan").classed("z math-var",!0),_.append("tspan").classed("name",!0);const k=w.select(".title-y").attr("transform",`translate(${-2*this.rem}, ${o/2})rotate(-90)`);k.select("tspan.z").text(this.zRoc?"z":""),k.select("tspan.name").text(this.zRoc?"(Hit Rate)":"Hit Rate"),y.append("line").classed("diagonal",!0),w.select(".diagonal").attr("x1",this.zRoc?h(-3):h(0)).attr("y1",this.zRoc?u(-3):u(0)).attr("x2",this.zRoc?h(3):h(1)).attr("y2",this.zRoc?u(3):u(1)),v.append("g").classed("content",!0);const S=g.select(".content"),A=S.selectAll(".curve-iso-d").data(this.isoDArray,(t=>t.name)),E=A.enter().append("path").classed("curve-iso-d",!0).attr("clip-path","url(#clip-roc-space)").merge(A);this.firstUpdate||t.has("zRoc")?E.transition().duration(this.drag?0:2*c).ease(cs).attr("d",(t=>p(ge(h.range()[0],h.range()[1]+1,1).map((e=>({far:this.zRoc?Zo.zfar2Far(h.invert(e)):h.invert(e),hr:this.zRoc?Zo.dFar2Hr(t.d,Zo.zfar2Far(h.invert(e)),t.s):Zo.dFar2Hr(t.d,h.invert(e),t.s)})))))):this.sdt?E.transition().duration(this.drag?0:c).ease(cs).attrTween("d",((t,e,r)=>{const n=r[e];n.hr=void 0,n.far=void 0;const i=Jn(void 0!==n.d?n.d:t.d,t.d),s=Jn(void 0!==n.s?n.s:t.s,t.s);return t=>{n.d=i(t),n.s=s(t);const e=ge(h.range()[0],h.range()[1]+1,1).map((t=>({far:this.zRoc?Zo.zfar2Far(h.invert(t)):h.invert(t),hr:this.zRoc?Zo.dFar2Hr(n.d,Zo.zfar2Far(h.invert(t)),n.s):Zo.dFar2Hr(n.d,h.invert(t),n.s)})));return p(e)}})):E.transition().duration(this.drag?0:c).ease(cs).attrTween("d",((t,e,r)=>{const n=r[e];n.d=void 0,n.s=void 0;const i=Jn(void 0!==n.hr?n.hr:t.hr,t.hr),s=Jn(void 0!==n.far?n.far:t.far,t.far);return e=>{n.hr=i(e),n.far=s(e);const r=ge(h.range()[0],h.range()[1]+1,1).map((e=>({far:this.zRoc?Zo.zfar2Far(h.invert(e)):h.invert(e),hr:this.zRoc?Zo.dFar2Hr(Zo.hrFar2D(n.hr,n.far,t.s),Zo.zfar2Far(h.invert(e)),t.s):Zo.dFar2Hr(Zo.hrFar2D(n.hr,n.far,t.s),h.invert(e),t.s)})));return p(r)}})),A.exit().remove();const M=S.selectAll(".curve-iso-c").data(this.isoCArray,(t=>t.name)),T=M.enter().append("path").classed("curve-iso-c",!0).attr("clip-path","url(#clip-roc-space)").merge(M);this.firstUpdate||t.has("zRoc")?T.transition().duration(this.drag?0:2*c).ease(cs).attr("d",(t=>p(ge(h.range()[0],h.range()[1]+1,1).map((e=>({far:this.zRoc?Zo.zfar2Far(h.invert(e)):h.invert(e),hr:this.zRoc?Zo.cFar2Hr(t.c,Zo.zfar2Far(h.invert(e)),t.s):Zo.cFar2Hr(t.c,h.invert(e),t.s)})))))):this.sdt?T.transition().duration(this.drag?0:c).ease(cs).attrTween("d",((t,e,r)=>{const n=r[e];n.hr=void 0,n.far=void 0;const i=Jn(void 0!==n.c?n.c:t.c,t.c),s=Jn(void 0!==n.s?n.s:t.s,t.s);return t=>{n.c=i(t),n.s=s(t);const e=ge(h.range()[0],h.range()[1]+1,1).map((t=>({far:this.zRoc?Zo.zfar2Far(h.invert(t)):h.invert(t),hr:this.zRoc?Zo.cFar2Hr(n.c,Zo.zfar2Far(h.invert(t)),n.s):Zo.cFar2Hr(n.c,h.invert(t),n.s)})));return p(e)}})):T.transition().duration(this.drag?0:c).ease(cs).attrTween("d",((t,e,r)=>{const n=r[e];n.c=void 0,n.s=void 0;const i=Jn(void 0!==n.hr?n.hr:t.hr,t.hr),s=Jn(void 0!==n.far?n.far:t.far,t.far);return e=>{n.hr=i(e),n.far=s(e);const r=ge(h.range()[0],h.range()[1]+1,1).map((e=>({far:this.zRoc?Zo.zfar2Far(h.invert(e)):h.invert(e),hr:this.zRoc?Zo.cFar2Hr(Zo.hrFar2C(n.hr,n.far,t.s),Zo.zfar2Far(h.invert(e)),t.s):Zo.cFar2Hr(Zo.hrFar2C(n.hr,n.far,t.s),h.invert(e),t.s)})));return p(r)}})),M.exit().remove();const C=S.selectAll(".point").data(this.pointArray,(t=>t.name)),N=C.enter().append("g").classed("point",!0);N.append("circle").classed("circle",!0),N.append("text").classed("label",!0);const R=N.merge(C);R.select("text").text((t=>t.label)),(this.firstUpdate||t.has("interactive"))&&(this.interactive?R.attr("tabindex",0).classed("interactive",!0).call(d).on("keydown",((t,e)=>{if(["ArrowUp","ArrowDown","ArrowRight","ArrowLeft"].includes(t.key)){let r=this.zRoc?Zo.hr2Zhr(e.hr):e.hr,n=this.zRoc?Zo.far2Zfar(e.far):e.far;switch(t.key){case"ArrowUp":r+=this.zRoc?t.shiftKey?.05:.25:t.shiftKey?.01:.05;break;case"ArrowDown":r-=this.zRoc?t.shiftKey?.05:.25:t.shiftKey?.01:.05;break;case"ArrowRight":n+=this.zRoc?t.shiftKey?.05:.25:t.shiftKey?.01:.05;break;case"ArrowLeft":n-=this.zRoc?t.shiftKey?.05:.25:t.shiftKey?.01:.05}r=this.zRoc?Zo.zhr2Hr(r):r,n=this.zRoc?Zo.zfar2Far(n):n,r=r<.001?.001:r>.999?.999:r,n=n<.001?.001:n>.999?.999:n,r===e.hr&&n===e.far||(e.hr=r,e.far=n,"default"===e.name&&(this.hr=e.hr,this.far=e.far),this.alignState(),this.requestUpdate(),this.dispatchEvent(new CustomEvent("roc-point-change",{detail:{name:e.name,far:e.far,hr:e.hr,d:e.d,c:e.c,s:e.s,label:e.label},bubbles:!0}))),t.preventDefault()}})):R.attr("tabindex",null).classed("interactive",!1).on("drag",null).on("keydown",null)),this.firstUpdate||t.has("zRoc")?R.transition().duration(this.drag?0:2*c).ease(cs).attr("transform",((t,e,r)=>{const n=r[e];return n.d=void 0,n.c=void 0,n.s=void 0,`translate(\n ${h(this.zRoc?Zo.far2Zfar(t.far):t.far)},\n ${u(this.zRoc?Zo.hr2Zhr(t.hr):t.hr)}\n )`})):this.sdt?R.transition().duration(this.drag?0:c).ease(cs).attrTween("transform",((t,e,r)=>{const n=r[e],i=Jn(void 0!==n.d?n.d:t.d,t.d),s=Jn(void 0!==n.c?n.c:t.c,t.c),a=Jn(void 0!==n.s?n.s:t.s,t.s);return t=>(n.d=i(t),n.c=s(t),n.s=a(t),`translate(\n ${h(this.zRoc?Zo.far2Zfar(Zo.dC2Far(n.d,n.c,n.s)):Zo.dC2Far(n.d,n.c,n.s))},\n ${u(this.zRoc?Zo.hr2Zhr(Zo.dC2Hr(n.d,n.c,n.s)):Zo.dC2Hr(n.d,n.c,n.s))}\n )`)})):R.transition().duration(this.drag?0:c).ease(cs).attr("transform",((t,e,r)=>{const n=r[e];return n.d=void 0,n.c=void 0,n.s=void 0,`translate(\n ${h(this.zRoc?Zo.far2Zfar(t.far):t.far)},\n ${u(this.zRoc?Zo.hr2Zhr(t.hr):t.hr)}\n )`})),C.exit().remove(),this.drag=!1,this.sdt=!1,this.firstUpdate=!1}}customElements.define("roc-space",Go);class Jo extends Bo{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},payoff:{attribute:"payoff",type:Number,reflect:!0},color:{attribute:"color",type:String,reflect:!0},zRoc:{attribute:"z-roc",type:Boolean,reflect:!0},run:{attribute:"run",type:Boolean,reflect:!0},pause:{attribute:"pause",type:Boolean,reflect:!0},reset:{attribute:"reset",type:Boolean,reflect:!0},state:{attribute:!1,type:String,reflect:!1}}}constructor(){super(),this.trials=void 0,this.duration=void 0,this.coherence=void 0,this.payoff=void 0,this.colors=["none","accuracy","stimulus","response","outcome","all"],this.color=void 0,this.zRoc=void 0,this.run=!1,this.pause=!1,this.reset=!1,this.states=["resetted","running","paused","ended"],this.state="resetted"}setTrials(t){this.trials=t.target.value,this.dispatchEvent(new CustomEvent("detectable-control-trials",{detail:{trials:this.trials},bubbles:!0}))}setDuration(t){this.duration=t.target.value,this.dispatchEvent(new CustomEvent("detectable-control-duration",{detail:{duration:this.duration},bubbles:!0}))}setCoherence(t){this.coherence=t.target.value,this.dispatchEvent(new CustomEvent("detectable-control-coherence",{detail:{coherence:this.coherence},bubbles:!0}))}setPayoff(t){this.payoff=t.target.value,this.dispatchEvent(new CustomEvent("detectable-control-payoff",{detail:{payoff:this.payoff},bubbles:!0}))}chooseColor(t){this.color=t.target.value,this.dispatchEvent(new CustomEvent("detectable-control-color",{detail:{color:this.color},bubbles:!0}))}flipZRoc(t){this.zRoc=t.target.checked,this.dispatchEvent(new CustomEvent("detectable-control-z-roc",{detail:{zRoc:this.zRoc},bubbles:!0}))}doRun(){this.state="running",this.dispatchEvent(new CustomEvent("detectable-control-run",{detail:{},bubbles:!0}))}doPause(){this.state="paused",this.dispatchEvent(new CustomEvent("detectable-control-pause",{detail:{},bubbles:!0}))}doReset(){this.state="resetted",this.dispatchEvent(new CustomEvent("detectable-control-reset",{detail:{},bubbles:!0}))}complete(){this.state="ended"}static get styles(){return[super.styles,nt`
|
|
1015
1015
|
:host {
|
|
1016
1016
|
display: inline-block;
|
|
1017
1017
|
}
|
|
@@ -1038,13 +1038,13 @@ const Ho=t=>null!=t?t:z;customElements.define("decidables-slider",class extends
|
|
|
1038
1038
|
.payoff {
|
|
1039
1039
|
--decidables-spinner-prefix: "$";
|
|
1040
1040
|
}
|
|
1041
|
-
`]}render(){return
|
|
1041
|
+
`]}render(){return Pt`
|
|
1042
1042
|
<div class="holder">
|
|
1043
|
-
${this.trials?
|
|
1044
|
-
${this.duration?
|
|
1045
|
-
${this.coherence?
|
|
1046
|
-
${this.payoff?
|
|
1047
|
-
${void 0!==this.color?
|
|
1043
|
+
${this.trials?Pt`<decidables-slider min="1" max="100" step="1" .value=${this.trials} @change=${this.setTrials.bind(this)} @input=${this.setTrials.bind(this)}>Trials</decidables-slider>`:Pt``}
|
|
1044
|
+
${this.duration?Pt`<decidables-slider min="10" max="2000" step="10" .value=${this.duration} @change=${this.setDuration.bind(this)} @input=${this.setDuration.bind(this)}>Duration</decidables-slider>`:Pt``}
|
|
1045
|
+
${this.coherence?Pt`<decidables-slider min="0" max="1" step=".01" .value=${this.coherence} @change=${this.setCoherence.bind(this)} @input=${this.setCoherence.bind(this)}>Coherence</decidables-slider>`:Pt``}
|
|
1046
|
+
${this.payoff?Pt`<decidables-slider class="payoff" min="0" max="100" step="1" .value=${this.payoff} @change=${this.setPayoff.bind(this)} @input=${this.setPayoff.bind(this)}>Payoff</decidables-slider>`:Pt``}
|
|
1047
|
+
${void 0!==this.color?Pt`
|
|
1048
1048
|
<decidables-toggle @change=${this.chooseColor.bind(this)}>
|
|
1049
1049
|
<span slot="label">Emphasis</span>
|
|
1050
1050
|
<decidables-toggle-option name="toggle" value="none" ?checked=${"none"===this.color}>None</decidables-toggle-option>
|
|
@@ -1054,21 +1054,21 @@ const Ho=t=>null!=t?t:z;customElements.define("decidables-slider",class extends
|
|
|
1054
1054
|
<decidables-toggle-option name="toggle" value="outcome" ?checked=${"outcome"===this.color}>Outcome</decidables-toggle-option>
|
|
1055
1055
|
<decidables-toggle-option name="toggle" value="all" ?checked=${"all"===this.color}>All</decidables-toggle-option>
|
|
1056
1056
|
</decidables-toggle>
|
|
1057
|
-
`:
|
|
1058
|
-
${void 0!==this.zRoc?
|
|
1057
|
+
`:Pt``}
|
|
1058
|
+
${void 0!==this.zRoc?Pt`
|
|
1059
1059
|
<decidables-switch ?checked=${this.zRoc} @change=${this.flipZRoc.bind(this)}>
|
|
1060
1060
|
<span class="math-var">z</span>ROC
|
|
1061
1061
|
<span slot="off-label">ROC</span>
|
|
1062
1062
|
</decidables-switch>
|
|
1063
|
-
`:
|
|
1064
|
-
${this.run||this.pause||this.reset?
|
|
1063
|
+
`:Pt``}
|
|
1064
|
+
${this.run||this.pause||this.reset?Pt`
|
|
1065
1065
|
<div class="buttons">
|
|
1066
|
-
${this.run?
|
|
1067
|
-
${this.pause?
|
|
1068
|
-
${this.reset?
|
|
1066
|
+
${this.run?Pt`<decidables-button name="run" ?disabled=${"running"===this.state||"ended"===this.state} @click=${this.doRun.bind(this)}>Run</decidables-button>`:Pt``}
|
|
1067
|
+
${this.pause?Pt`<decidables-button name="pause" ?disabled=${"running"!==this.state} @click=${this.doPause.bind(this)}>Pause</decidables-button>`:Pt``}
|
|
1068
|
+
${this.reset?Pt`<decidables-button name="reset" ?disabled=${"resetted"===this.state} @click=${this.doReset.bind(this)}>Reset</decidables-button>`:Pt``}
|
|
1069
1069
|
</div>
|
|
1070
|
-
`:
|
|
1071
|
-
</div>`}}customElements.define("detectable-control",
|
|
1070
|
+
`:Pt``}
|
|
1071
|
+
</div>`}}customElements.define("detectable-control",Jo);class Qo extends Bo{static get properties(){return{color:{attribute:"color",type:String,reflect:!0},distributions:{attribute:"distributions",type:Boolean,reflect:!0},threshold:{attribute:"threshold",type:Boolean,reflect:!0},unequal:{attribute:"unequal",type:Boolean,reflect:!0},sensitivity:{attribute:"sensitivity",type:Boolean,reflect:!0},bias:{attribute:"bias",type:Boolean,reflect:!0},variance:{attribute:"variance",type:Boolean,reflect:!0},histogram:{attribute:"histogram",type:Boolean,reflect:!0},d:{attribute:"d",type:Number,reflect:!0},c:{attribute:"c",type:Number,reflect:!0},s:{attribute:"s",type:Number,reflect:!0},far:{attribute:!1,type:Number,reflect:!1},hr:{attribute:!1,type:Number,reflect:!1},binWidth:{attribute:!1,type:Number,reflect:!1},trials:{attribute:!1,type:Array,reflect:!1},width:{attribute:!1,type:Number,reflect:!1},height:{attribute:!1,type:Number,reflect:!1},rem:{attribute:!1,type:Number,reflect:!1}}}constructor(){super(),this.colors=["outcome","response","stimulus","none"],this.color="outcome",this.distributions=!1,this.threshold=!1,this.unequal=!1,this.sensitivity=!1,this.bias=!1,this.variance=!1,this.histogram=!1,this.d=1,this.c=0,this.s=1,this.binWidth=.25,this.signals=["present","absent"],this.responses=["present","absent"],this.trials=[],this.width=NaN,this.height=NaN,this.rem=NaN,this.muN=NaN,this.muS=NaN,this.l=NaN,this.hS=NaN,this.binRange=[-3,3],this.h=0,this.m=0,this.fa=0,this.cr=0,this.firstUpdate=!0,this.drag=!1,this.alignState()}reset(){this.trials=[],this.h=0,this.m=0,this.fa=0,this.cr=0}trial(t,e,r,n,i){const s={new:!0,paused:!1};s.trial=t,s.signal=e,s.duration=r,s.wait=n,s.iti=i,s.evidence=Yo.normal.sample(0,1),this.alignTrial(s),this.trials.push(s),this.requestUpdate()}alignTrial(t){return"present"===t.signal?(t.trueEvidence=t.evidence*this.s+this.muS,t.response=t.trueEvidence>this.l?"present":"absent",t.outcome="present"===t.response?"h":"m"):(t.trueEvidence=t.evidence+this.muN,t.response=t.trueEvidence>this.l?"present":"absent",t.outcome="present"===t.response?"fa":"cr"),t.new||(this[t.outcome]+=1),t}alignState(){this.far=Zo.dC2Far(this.d,this.c,this.s),this.hr=Zo.dC2Hr(this.d,this.c,this.s),this.muN=Zo.d2MuN(this.d,this.s),this.muS=Zo.d2MuS(this.d,this.s),this.l=Zo.c2L(this.c,this.s),this.hS=Zo.s2H(this.s),this.h=0,this.m=0,this.fa=0,this.cr=0;for(let t=0;t<this.trials.length;t+=1)this.alignTrial(this.trials[t])}static get styles(){return[super.styles,nt`
|
|
1072
1072
|
:host {
|
|
1073
1073
|
display: inline-block;
|
|
1074
1074
|
|
|
@@ -1310,9 +1310,9 @@ const Ho=t=>null!=t?t:z;customElements.define("decidables-slider",class extends
|
|
|
1310
1310
|
text-anchor: middle;
|
|
1311
1311
|
fill: currentColor;
|
|
1312
1312
|
}
|
|
1313
|
-
`]}render(){return
|
|
1314
|
-
${
|
|
1315
|
-
`}sendEvent(){this.dispatchEvent(new CustomEvent("sdt-model-change",{detail:{d:this.d,c:this.c,s:this.s,far:this.far,hr:this.hr,h:this.h,m:this.m,fa:this.fa,cr:this.cr},bubbles:!0}))}getDimensions(){this.width=parseFloat(this.getComputedStyleValue("width"),10),this.height=parseFloat(this.getComputedStyleValue("height"),10),this.rem=parseFloat(getComputedStyle(document.documentElement).getPropertyValue("font-size"),10)}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.getDimensions.bind(this))}disconnectedCallback(){window.removeEventListener("resize",this.getDimensions.bind(this)),super.disconnectedCallback()}firstUpdated(t){super.firstUpdated(t),this.getDimensions()}update(t){if(super.update(t),this.alignState(),Number.isNaN(this.width)||Number.isNaN(this.height)||Number.isNaN(this.rem))return;const e=this.width,r=this.height;let n,i;e/r>1.8?(i=r,n=1.8*i):(n=e,i=n/1.8);const s=2*this.rem,a=3*this.rem,o=3*this.rem,l=i-(s+a),c=n-(o+(this.histogram&&this.distributions?3:.75)*this.rem),h=parseInt(this.getComputedStyleValue("---transition-duration"),10),u=Mo().domain([-3,3]).range([0,c]),d=Mo().domain([.5,0]).range([0,l]),p=u(this.binWidth)-u(0),f=Mo().domain([l/p,0]).range([0,l]),m=tn().subject((()=>({x:u(this.l),y:0}))).on("start",(t=>{Lr(t.currentTarget).classed("dragging",!0)})).on("drag",(t=>{this.drag=!0;let e=u.invert(t.x);e=e<u.domain()[0]?u.domain()[0]:e>u.domain()[1]?u.domain()[1]:e,this.c=Vo.l2C(e,this.s),this.alignState(),this.sendEvent()})).on("end",(t=>{Lr(t.currentTarget).classed("dragging",!1)})),b=tn().subject((()=>({x:u(this.muN),y:0}))).on("start",(t=>{Lr(t.currentTarget).classed("dragging",!0)})).on("drag",(t=>{this.drag=!0;let e=u.invert(t.x);e=e<u.domain()[0]?u.domain()[0]:e>u.domain()[1]?u.domain()[1]:e,this.d=Vo.muN2D(e,this.s),this.alignState(),this.sendEvent()})).on("end",(t=>{Lr(t.currentTarget).classed("dragging",!1)})),v=tn().subject((()=>({x:u(this.muS),y:d(this.hS)}))).on("start",((t,e)=>{Lr(t.currentTarget).classed("dragging",!0),e.startX=t.x,e.startY=t.y,e.startHS=this.hS,e.startMuS=this.muS})).on("drag",((t,e)=>{this.drag=!0;let r=this.muS;this.interactive&&(r=u.invert(t.x),r=r<u.domain()[0]?u.domain()[0]:r>u.domain()[1]?u.domain()[1]:r);let n=this.hS;this.unequal&&(n=d.invert(t.y),n=n<.01?.01:n>d.domain()[0]?d.domain()[0]:n),this.interactive&&this.unequal&&t.sourceEvent.shiftKey&&(Math.abs(t.x-e.startX)>Math.abs(t.y-e.startY)?n=e.startHS:r=e.startMuS),this.unequal&&(this.s=Vo.h2S(n),this.c=Vo.l2C(this.l,this.s)),this.d=Vo.muS2D(r,this.s),this.alignState(),this.sendEvent()})).on("end",(t=>{Lr(t.currentTarget).classed("dragging",!1)})),g=zo().x((t=>u(t.e))).y((t=>d(t.p))),y=Lr(this.renderRoot).selectAll(".main").data([{width:this.width,height:this.height,rem:this.rem}]),w=y.enter().append("svg").classed("main",!0),x=w.merge(y).attr("viewBox",`0 0 ${n} ${i}`),$=w.append("g").classed("plot",!0),_=x.select(".plot").attr("transform",`translate(${o}, ${s})`),k=$.append("g").classed("underlayer",!0),S=_.select(".underlayer");k.append("rect").classed("background",!0),S.select(".background").attr("height",l).attr("width",c),k.append("g").classed("axis-x",!0);S.select(".axis-x").attr("transform",`translate(0, ${l})`).call(we(u)).attr("font-size",null).attr("font-family",null).selectAll("line, path").attr("stroke",null),k.append("text").classed("title-x",!0).attr("text-anchor","middle").text("Evidence"),S.select(".title-x").attr("transform",`translate(${c/2}, ${l+2.25*this.rem})`);const A=S.selectAll(".axis-y").data(this.distributions?[{}]:[]);A.enter().append("g").classed("axis-y",!0).merge(A).call(xe(d).ticks(5)).attr("font-size",null).attr("font-family",null).selectAll("line, path").attr("stroke",null),A.exit().remove();const E=S.selectAll(".title-y").data(this.distributions?[{}]:[]);E.enter().append("text").classed("title-y",!0).attr("text-anchor","middle").text("Probability").merge(E).attr("transform",`translate(${-2*this.rem}, ${l/2})rotate(-90)`),E.exit().remove();const M=S.selectAll(".axis-y2").data(this.histogram?[{}]:[]);var T;M.enter().append("g").classed("axis-y2",!0).merge(M).attr("transform",this.distributions?`translate(${c}, 0)`:"").call(this.distributions?(T=f,ye(2,T)).ticks(10):xe(f).ticks(10)).attr("font-size",null).attr("font-family",null).selectAll("line, path").attr("stroke",null),M.exit().remove();const C=S.selectAll(".title-y2").data(this.histogram?[{}]:[]);C.enter().append("text").classed("title-y2",!0).attr("text-anchor","middle").text("Count").merge(C).attr("transform",this.distributions?`translate(${c+1.5*this.rem}, ${l/2})rotate(90)`:`translate(${-1.5*this.rem}, ${l/2})rotate(-90)`),C.exit().remove(),$.append("g").classed("content",!0);const N=_.select(".content"),R=N.selectAll(".signal-noise").data(this.distributions?[{}]:[]),q=R.enter().append("g").classed("signal-noise",!0),P=q.merge(R);R.exit().remove();const z=q.append("g").classed("noise",!0),F=P.selectAll(".noise").attr("tabindex",this.interactive?0:null).classed("interactive",this.interactive).on("keydown",this.interactive?t=>{if(["ArrowRight","ArrowLeft"].includes(t.key)){let e=this.muN;switch(t.key){case"ArrowRight":e+=t.shiftKey?.01:.1;break;case"ArrowLeft":e-=t.shiftKey?.01:.1}e=e<u.domain()[0]?u.domain()[0]:e>u.domain()[1]?u.domain()[1]:e,e!==this.muN&&(this.d=Vo.muN2D(e,this.s),this.alignState(),this.sendEvent()),t.preventDefault()}}:null);(this.firstUpdate||t.has("interactive"))&&(this.interactive?F.call(b):F.on(".drag",null)),z.append("path").classed("curve-cr",!0),F.select(".curve-cr").transition().duration(this.drag?0:h).ease(rs).attrTween("d",((t,e,r)=>{const n=r[e],i=Vn(void 0!==n.d?n.d:this.d,this.d),s=Vn(void 0!==n.c?n.c:this.c,this.c),a=Vn(void 0!==n.s?n.s:this.s,this.s);return t=>{n.d=i(t),n.c=s(t),n.s=a(t);const e=ue(u.domain()[0],Vo.c2L(n.c,n.s),.05).map((t=>({e:t,p:jo.normal.pdf(t,Vo.d2MuN(n.d,n.s),1)})));return e.push({e:Vo.c2L(n.c,n.s),p:jo.normal.pdf(Vo.c2L(n.c,n.s),Vo.d2MuN(n.d,n.s),1)}),e.push({e:Vo.c2L(n.c,n.s),p:0}),e.push({e:u.domain()[0],p:0}),g(e)}})),z.append("path").classed("curve-fa",!0),F.select(".curve-fa").transition().duration(this.drag?0:h).ease(rs).attrTween("d",((t,e,r)=>{const n=r[e],i=Vn(void 0!==n.d?n.d:this.d,this.d),s=Vn(void 0!==n.c?n.c:this.c,this.c),a=Vn(void 0!==n.s?n.s:this.s,this.s);return t=>{n.d=i(t),n.c=s(t),n.s=a(t);const e=ue(Vo.c2L(n.c,n.s),u.domain()[1],.05).map((t=>({e:t,p:jo.normal.pdf(t,Vo.d2MuN(n.d,n.s),1)})));return e.push({e:u.domain()[1],p:jo.normal.pdf(u.domain()[1],Vo.d2MuN(n.d,n.s),1)}),e.push({e:u.domain()[1],p:0}),e.push({e:Vo.c2L(n.c,n.s),p:0}),g(e)}})),z.append("path").classed("curve-noise",!0),F.select(".curve-noise").transition().duration(this.drag?0:h).ease(rs).attrTween("d",((t,e,r)=>{const n=r[e],i=Vn(void 0!==n.d?n.d:this.d,this.d),s=Vn(void 0!==n.s?n.s:this.s,this.s);return t=>{n.d=i(t),n.s=s(t);const e=ue(u.domain()[0],u.domain()[1],.05).map((t=>({e:t,p:jo.normal.pdf(t,Vo.d2MuN(n.d,n.s),1)})));return e.push({e:u.domain()[1],p:jo.normal.pdf(u.domain()[1],Vo.d2MuN(n.d,n.s),1)}),g(e)}}));const O=q.append("g").classed("signal",!0),H=P.selectAll(".signal").attr("tabindex",this.interactive||this.unequal?0:null).classed("interactive",this.interactive).classed("unequal",this.unequal).on("keydown.sensitivity",this.interactive?t=>{if(["ArrowRight","ArrowLeft"].includes(t.key)){let e=this.muS;switch(t.key){case"ArrowRight":e+=t.shiftKey?.01:.1;break;case"ArrowLeft":e-=t.shiftKey?.01:.1}e=e<u.domain()[0]?u.domain()[0]:e>u.domain()[1]?u.domain()[1]:e,e!==this.muS&&(this.d=Vo.muS2D(e,this.s),this.alignState(),this.sendEvent()),t.preventDefault()}}:null).on("keydown.variance",this.unequal?t=>{if(["ArrowUp","ArrowDown"].includes(t.key)){let e=this.hS;switch(t.key){case"ArrowUp":e+=t.shiftKey?.002:.02;break;case"ArrowDown":e-=t.shiftKey?.002:.02}e=e<.01?.01:e>d.domain()[0]?d.domain()[0]:e,e!==this.hS&&(this.s=Vo.h2S(e),this.d=Vo.muN2D(this.muN,this.s),this.c=Vo.l2C(this.l,this.s),this.alignState(),this.sendEvent()),t.preventDefault()}}:null);(this.firstUpdate||t.has("interactive")||t.has("unequal"))&&(this.interactive||this.unequal?H.call(v):H.on(".drag",null)),O.append("path").classed("curve-m",!0),H.select(".curve-m").transition().duration(this.drag?0:h).ease(rs).attrTween("d",((t,e,r)=>{const n=r[e],i=Vn(void 0!==n.d?n.d:this.d,this.d),s=Vn(void 0!==n.c?n.c:this.c,this.c),a=Vn(void 0!==n.s?n.s:this.s,this.s);return t=>{n.d=i(t),n.c=s(t),n.s=a(t);const e=ue(u.domain()[0],Vo.c2L(n.c,n.s),.05).map((t=>({e:t,p:jo.normal.pdf(t,Vo.d2MuS(n.d,n.s),n.s)})));return e.push({e:Vo.c2L(n.c,n.s),p:jo.normal.pdf(Vo.c2L(n.c,n.s),Vo.d2MuS(n.d,n.s),n.s)}),e.push({e:Vo.c2L(n.c,n.s),p:0}),e.push({e:u.domain()[0],p:0}),g(e)}})),O.append("path").classed("curve-h",!0),H.select(".curve-h").transition().duration(this.drag?0:h).ease(rs).attrTween("d",((t,e,r)=>{const n=r[e],i=Vn(void 0!==n.d?n.d:this.d,this.d),s=Vn(void 0!==n.c?n.c:this.c,this.c),a=Vn(void 0!==n.s?n.s:this.s,this.s);return t=>{n.d=i(t),n.c=s(t),n.s=a(t);const e=ue(Vo.c2L(n.c,n.s),u.domain()[1],.05).map((t=>({e:t,p:jo.normal.pdf(t,Vo.d2MuS(n.d,n.s),n.s)})));return e.push({e:u.domain()[1],p:jo.normal.pdf(u.domain()[1],Vo.d2MuS(n.d,n.s),n.s)}),e.push({e:u.domain()[1],p:0}),e.push({e:Vo.c2L(n.c,n.s),p:0}),g(e)}})),O.append("path").classed("curve-signal",!0),H.select(".curve-signal").transition().duration(this.drag?0:h).ease(rs).attrTween("d",((t,e,r)=>{const n=r[e],i=Vn(void 0!==n.d?n.d:this.d,this.d),s=Vn(void 0!==n.s?n.s:this.s,this.s);return t=>{n.d=i(t),n.s=s(t);const e=ue(u.domain()[0],u.domain()[1],.05).map((t=>({e:t,p:jo.normal.pdf(t,Vo.d2MuS(n.d,n.s),n.s)})));return e.push({e:u.domain()[1],p:jo.normal.pdf(u.domain()[1],Vo.d2MuS(n.d,n.s),n.s)}),g(e)}}));const U=N.selectAll(".measure-d").data(this.sensitivity?[{}]:[]),D=U.enter().append("g").classed("measure-d",!0);D.append("line").classed("line",!0),D.append("line").classed("cap-left",!0),D.append("line").classed("cap-right",!0);const I=D.append("text").classed("label",!0);I.append("tspan").classed("d math-var",!0).text("d′"),I.append("tspan").classed("equals",!0).text(" = "),I.append("tspan").classed("value",!0);const L=D.merge(U);L.select(".line").transition().duration(this.drag?0:h).ease(rs).attr("x1",u(this.muN)).attr("y1",d(.43)).attr("x2",u(this.muS)).attr("y2",d(.43)),L.select(".cap-left").transition().duration(this.drag?0:h).ease(rs).attr("x1",u(this.muN)).attr("y1",d(.43)+5).attr("x2",u(this.muN)).attr("y2",d(.43)-5),L.select(".cap-right").transition().duration(this.drag?0:h).ease(rs).attr("x1",u(this.muS)).attr("y1",d(.43)+5).attr("x2",u(this.muS)).attr("y2",d(.43)-5);L.select(".label").transition().duration(this.drag?0:h).ease(rs).attr("x",u(this.muN>this.muS?this.muN:this.muS)+5).attr("y",d(.43)+3).select(".value").tween("text",((t,e,r)=>{const n=r[e],i=Vn(void 0!==n.d?n.d:this.d,this.d);return t=>{n.d=i(t),Lr(n).text(zs(".3")(n.d))}})),U.exit().remove();const j=N.selectAll(".measure-c").data(this.bias?[{}]:[]),B=j.enter().append("g").classed("measure-c",!0);B.append("line").classed("line",!0),B.append("line").classed("cap-zero",!0);const V=B.append("text").classed("label",!0);V.append("tspan").classed("c math-var",!0).text("c"),V.append("tspan").classed("equals",!0).text(" = "),V.append("tspan").classed("value",!0);const K=B.merge(j);K.select(".line").transition().duration(this.drag?0:h).ease(rs).attr("x1",u(this.l)).attr("y1",d(.47)).attr("x2",u(0)).attr("y2",d(.47)),K.select(".cap-zero").transition().duration(this.drag?0:h).ease(rs).attr("x1",u(0)).attr("y1",d(.47)+5).attr("x2",u(0)).attr("y2",d(.47)-5);K.select(".label").transition().duration(this.drag?0:h).ease(rs).attr("x",u(0)+(this.l<0?5:-5)).attr("y",d(.47)+3).attr("text-anchor",this.c<0?"start":"end").select(".value").tween("text",((t,e,r)=>{const n=r[e],i=Vn(void 0!==n.c?n.c:this.c,this.c);return t=>{n.c=i(t),Lr(n).text(zs(".3")(n.c))}})),j.exit().remove();const W=N.selectAll(".measure-s").data(this.variance?[{}]:[]),X=W.enter().append("g").classed("measure-s",!0);X.append("line").classed("line",!0),X.append("line").classed("cap-left",!0),X.append("line").classed("cap-right",!0);const Y=X.append("text").classed("label",!0);Y.append("tspan").classed("s math-var",!0).text("σ"),Y.append("tspan").classed("equals",!0).text(" = "),Y.append("tspan").classed("value",!0);const Z=X.merge(W);Z.select(".line").transition().duration(this.drag?0:h).ease(rs).attr("x1",u(this.muS-this.s)).attr("y1",d(jo.normal.pdf(this.s,0,this.s))+10/this.s).attr("x2",u(this.muS+this.s)).attr("y2",d(jo.normal.pdf(this.s,0,this.s))+10/this.s),Z.select(".cap-left").transition().duration(this.drag?0:h).ease(rs).attr("x1",u(this.muS-this.s)).attr("y1",d(jo.normal.pdf(this.s,0,this.s))+10/this.s+5).attr("x2",u(this.muS-this.s)).attr("y2",d(jo.normal.pdf(this.s,0,this.s))+10/this.s-5),Z.select(".cap-right").transition().duration(this.drag?0:h).ease(rs).attr("x1",u(this.muS+this.s)).attr("y1",d(jo.normal.pdf(this.s,0,this.s))+10/this.s+5).attr("x2",u(this.muS+this.s)).attr("y2",d(jo.normal.pdf(this.s,0,this.s))+10/this.s-5);Z.select(".label").transition().duration(this.drag?0:h).ease(rs).attr("x",u(this.muS)).attr("y",d(jo.normal.pdf(this.s,0,this.s))+10/this.s-3).select(".value").tween("text",((t,e,r)=>{const n=r[e],i=Vn(void 0!==n.s?n.s:this.s,this.s);return t=>{n.s=i(t),Lr(n).text(zs(".3")(n.s))}})),W.exit().remove();const G=N.selectAll(".threshold").data(this.threshold?[{}]:[]),J=G.enter().append("g").classed("threshold",!0);J.append("line").classed("line",!0),J.append("circle").classed("handle",!0);const Q=J.merge(G).attr("tabindex",this.interactive?0:null).classed("interactive",this.interactive);(this.firstUpdate||t.has("interactive"))&&(this.interactive?Q.call(m).on("keydown",(t=>{if(["ArrowRight","ArrowLeft"].includes(t.key)){let e=this.l;switch(t.key){case"ArrowRight":e+=t.shiftKey?.01:.1;break;case"ArrowLeft":e-=t.shiftKey?.01:.1}e=e<u.domain()[0]?u.domain()[0]:e>u.domain()[1]?u.domain()[1]:e,e!==this.l&&(this.c=Vo.l2C(e,this.s),this.alignState(),this.sendEvent()),t.preventDefault()}})):Q.on("drag",null).on("keydown",null)),Q.select(".line").transition().duration(this.drag?0:h).ease(rs).attr("x1",u(this.l)).attr("y1",d(0)).attr("x2",u(this.l)).attr("y2",d(.54)),Q.select(".handle").transition().duration(this.drag?0:h).ease(rs).attr("cx",u(this.l)).attr("cy",d(.54)),G.exit().remove();const tt=N.selectAll(".histogram").data(this.histogram?[{}]:[]),et=tt.enter().append("g").classed("histogram",!0).merge(tt);if(tt.exit().remove(),this.histogram){const t=he().value((t=>t.trueEvidence)).domain(u.domain()).thresholds(ue(this.binRange[0],this.binRange[1],this.binWidth)),e=t(this.trials);let r=-1,n=-1;for(let t=0;t<e.length;t+=1)for(let i=0;i<e[t].length;i+=1)e[t][i].binValue=e[t].x0,e[t][i].binCount=i,0===t&&(r=i),t===e.length-1&&(n=i);for(let t=0;t<this.trials.length;t+=1)this.trials[t].trueEvidence<this.binRange[0]&&(r+=1,this.trials[t].binCount=r,this.trials[t].binValue=e[0].x0),this.trials[t].trueEvidence>this.binRange[1]&&(n+=1,this.trials[t].binCount=n,this.trials[t].binValue=e[e.length-1].x0);const i=et.selectAll(".trial").data(this.trials,(t=>t.trial)),s=i.enter().append("rect").attr("stroke-width",3).attr("data-new-trial-ease-time",0).attr("stroke",this.getComputedStyleValue("---color-acc")).attr("fill",this.getComputedStyleValue("---color-acc-light")).merge(i).attr("class",(t=>`trial ${t.outcome}`)).attr("width",p-3).attr("height",p-3),a=s.filter((t=>t.new&&!t.paused));if(!a.empty()){const t=a.attr("data-new-trial-ease-time"),e=e=>Mo().domain([0,1]).range([t,1])(e),r=e=>r=>Mo().domain([e(t),1]).range([0,1])(e(r));a.transition("new").duration((e=>Math.floor((.75*e.duration+.25*e.wait)*(1-t)))).ease(e).attr("data-new-trial-ease-time",1).attrTween("stroke",((t,e,n)=>{const i=n[e],s=Fn(i.getAttribute("stroke"),"stimulus"===this.color?"present"===t.signal?this.getComputedStyleValue("---color-hr"):this.getComputedStyleValue("---color-far"):"response"===this.color?this.getComputedStyleValue(`---color-${t.response}`):"outcome"===this.color?this.getComputedStyleValue(`---color-${t.outcome}`):this.getComputedStyleValue("---color-acc"));return t=>s(r(es)(t))})).attrTween("fill",((t,e,n)=>{const i=n[e],s=Fn(i.getAttribute("fill"),"stimulus"===this.color?"present"===t.signal?this.getComputedStyleValue("---color-hr-light"):this.getComputedStyleValue("---color-far-light"):"response"===this.color?this.getComputedStyleValue(`---color-${t.response}-light`):"outcome"===this.color?this.getComputedStyleValue(`---color-${t.outcome}-light`):this.getComputedStyleValue("---color-acc-light"));return t=>s(r(es)(t))})).attrTween("x",((t,e,n)=>{const i=Vn(n[e].getAttribute("x"),u(t.binValue)+1.5);return t=>i(r(rs)(t))})).attrTween("y",((t,e,n)=>{const i=Vn(n[e].getAttribute("y"),d(0)+1.5-(t.binCount+1)*p);return t=>i(r(es)(t))})).on("end",((t,e,r)=>{r[e].removeAttribute("data-new-trial-ease-time"),t.new=!1,this.alignTrial(t),this.dispatchEvent(new CustomEvent("detectable-response",{detail:{stimulus:t.signal,response:t.response,outcome:t.outcome,h:this.h,m:this.m,fa:this.fa,cr:this.cr,nr:0},bubbles:!0}))}))}const o=s.filter((t=>t.new&&t.paused));if(!o.empty()){const t=o.attr("data-new-trial-ease-time");o.transition().duration(h).ease(rs).attr("x",(e=>Vn(0,u(e.binValue)+1.5)(rs(t)))).attr("y",(e=>Vn(0,d(0)+1.5-(e.binCount+1)*p)(es(t)))).attr("stroke",(e=>Fn(this.getComputedStyleValue("---color-acc"),"stimulus"===this.color?"present"===e.signal?this.getComputedStyleValue("---color-hr"):this.getComputedStyleValue("---color-far"):"response"===this.color?this.getComputedStyleValue(`---color-${e.response}`):"outcome"===this.color?this.getComputedStyleValue(`---color-${e.outcome}`):this.getComputedStyleValue("---color-acc"))(es(t)))).attr("fill",(e=>Fn(this.getComputedStyleValue("---color-acc-light"),"stimulus"===this.color?"present"===e.signal?this.getComputedStyleValue("---color-hr-light"):this.getComputedStyleValue("---color-far-light"):"response"===this.color?this.getComputedStyleValue(`---color-${e.response}-light`):"outcome"===this.color?this.getComputedStyleValue(`---color-${e.outcome}-light`):this.getComputedStyleValue("---color-acc-light"))(es(t))))}s.filter((t=>!t.new)).transition().duration(h).ease(rs).attr("x",(t=>u(t.binValue)+1.5)).attr("y",(t=>d(0)+1.5-(t.binCount+1)*p)).attr("stroke",(t=>"stimulus"===this.color?"present"===t.signal?this.getComputedStyleValue("---color-hr"):this.getComputedStyleValue("---color-far"):"response"===this.color?this.getComputedStyleValue(`---color-${t.response}`):"outcome"===this.color?this.getComputedStyleValue(`---color-${t.outcome}`):this.getComputedStyleValue("---color-acc"))).attr("fill",(t=>"stimulus"===this.color?"present"===t.signal?this.getComputedStyleValue("---color-hr-light"):this.getComputedStyleValue("---color-far-light"):"response"===this.color?this.getComputedStyleValue(`---color-${t.response}-light`):"outcome"===this.color?this.getComputedStyleValue(`---color-${t.outcome}-light`):this.getComputedStyleValue("---color-acc-light"))),i.exit().transition().duration(h).ease(ts).attrTween("stroke",((t,e,r)=>{const n=r[e],i=Fn(n.getAttribute("stroke"),this.getComputedStyleValue("---color-acc"));return t=>i(es(t))})).attrTween("fill",((t,e,r)=>{const n=r[e],i=Fn(n.getAttribute("fill"),this.getComputedStyleValue("---color-acc-light"));return t=>i(es(t))})).attrTween("x",((t,e,r)=>{const n=Vn(r[e].getAttribute("x"),0);return t=>n(es(t))})).attrTween("y",((t,e,r)=>{const n=Vn(r[e].getAttribute("y"),0);return t=>n(rs(t))})).remove()}const rt=$.append("g").classed("overlayer",!0),nt=_.select(".overlayer");rt.append("rect").classed("background",!0),nt.select(".background").attr("height",l).attr("width",c),this.drag=!1,this.firstUpdate=!1}pauseTrial(){const t=Lr(this.renderRoot).select(".trial[data-new-trial-ease-time]");t.interrupt("new"),t.datum((t=>(t.paused=!0,t)))}resumeTrial(){Lr(this.renderRoot).select(".trial[data-new-trial-ease-time]").datum((t=>(t.paused=!1,t))),this.requestUpdate()}}customElements.define("sdt-model",Xo);class Yo extends Io{static get properties(){return{feedback:{attribute:"feedback",type:String,reflect:!0},trial:{attribute:"trial",type:Boolean,reflect:!0},payoff:{attribute:"payoff",type:String,reflect:!0},hPayoff:{attribute:"hit-payoff",type:Number,reflect:!0},mPayoff:{attribute:"miss-payoff",type:Number,reflect:!0},faPayoff:{attribute:"false-alarm-payoff",type:Number,reflect:!0},crPayoff:{attribute:"correct-rejection-payoff",type:Number,reflect:!0},nrPayoff:{attribute:"no-response-payoff",type:Number,reflect:!0},state:{attribute:!1,type:String,reflect:!1},trialCount:{attribute:!1,type:Number,reflect:!1},trialTotal:{attribute:!1,type:Number,reflect:!1}}}constructor(){super(),this.feedbacks=["none","accuracy","outcome"],this.feedback="outcome",this.trial=!1,this.payoffs=["none","trial","total"],this.payoff="none",this.hPayoff=0,this.mPayoff=0,this.crPayoff=0,this.faPayoff=0,this.nrPayoff=0,this.states=["off","waiting","feedback"],this.state="off",this.trialCount=0,this.trialTotal=0,this.signals=["present","absent"],this.signal=void 0,this.responses=["present","absent"],this.response=void 0,this.outcomes=["h","m","fa","cr","nr"],this.outcome=void 0,this.accuracies=["c","e","nr"],this.accuracy=void 0,this.h=0,this.m=0,this.cr=0,this.fa=0,this.c=0,this.e=0,this.nr=0}get trialPayoff(){switch(this.outcome){case"h":return this.hPayoff;case"m":return this.mPayoff;case"fa":return this.faPayoff;case"cr":return this.crPayoff;case"nr":return this.nrPayoff;default:return}}get totalPayoff(){return this.h*this.hPayoff+this.m*this.mPayoff+this.cr*this.crPayoff+this.fa*this.faPayoff+this.nr*this.nrPayoff}start(t,e){this.trialCount=e,this.state="waiting",this.signal=t,this.response=void 0,this.outcome=void 0}stop(){this.state="feedback",void 0===this.response&&(this.outcome="nr",this.nr+=1,this.accuracy="nr")}present(){this.responded("present")}absent(){this.responded("absent")}responded(t){this.state="feedback",this.response=t,"present"===this.signal&&"present"===this.response?(this.outcome="h",this.h+=1,this.accuracy="c",this.c+=1):"present"===this.signal&&"absent"===this.response?(this.outcome="m",this.m+=1,this.accuracy="e",this.e+=1):"absent"===this.signal&&"present"===this.response?(this.outcome="fa",this.fa+=1,this.accuracy="e",this.e+=1):"absent"===this.signal&&"absent"===this.response&&(this.outcome="cr",this.cr+=1,this.accuracy="c",this.c+=1),this.dispatchEvent(new CustomEvent("detectable-response",{detail:{trial:this.trialCount,signal:this.signal,response:this.response,outcome:this.outcome,payoff:this.trialPayoff,h:this.h,m:this.m,fa:this.fa,cr:this.cr,nr:this.nr,totalPayoff:this.totalPayoff},bubbles:!0}))}reset(){this.state="off",this.trialCount=0,this.signal=void 0,this.response=void 0,this.outcome=void 0,this.accuracy=void 0,this.h=0,this.m=0,this.cr=0,this.fa=0,this.nr=0,this.c=0,this.e=0}static get styles(){return[super.styles,Q`
|
|
1313
|
+
`]}render(){return Pt`
|
|
1314
|
+
${Bo.svgFilters}
|
|
1315
|
+
`}sendEvent(){this.dispatchEvent(new CustomEvent("sdt-model-change",{detail:{d:this.d,c:this.c,s:this.s,far:this.far,hr:this.hr,h:this.h,m:this.m,fa:this.fa,cr:this.cr},bubbles:!0}))}getDimensions(){this.width=parseFloat(this.getComputedStyleValue("width"),10),this.height=parseFloat(this.getComputedStyleValue("height"),10),this.rem=parseFloat(getComputedStyle(document.documentElement).getPropertyValue("font-size"),10)}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.getDimensions.bind(this))}disconnectedCallback(){window.removeEventListener("resize",this.getDimensions.bind(this)),super.disconnectedCallback()}firstUpdated(t){super.firstUpdated(t),this.getDimensions()}update(t){if(super.update(t),this.alignState(),Number.isNaN(this.width)||Number.isNaN(this.height)||Number.isNaN(this.rem))return;const e=this.width,r=this.height;let n,i;e/r>1.8?(i=r,n=1.8*i):(n=e,i=n/1.8);const s=2*this.rem,a=3*this.rem,o=3*this.rem,l=i-(s+a),c=n-(o+(this.histogram&&this.distributions?3:.75)*this.rem),h=parseInt(this.getComputedStyleValue("---transition-duration"),10),u=Ro().domain([-3,3]).range([0,c]),d=Ro().domain([.5,0]).range([0,l]),p=u(this.binWidth)-u(0),f=Ro().domain([l/p,0]).range([0,l]),m=cn().subject((()=>({x:u(this.l),y:0}))).on("start",(t=>{Zr(t.currentTarget).classed("dragging",!0)})).on("drag",(t=>{this.drag=!0;let e=u.invert(t.x);e=e<u.domain()[0]?u.domain()[0]:e>u.domain()[1]?u.domain()[1]:e,this.c=Zo.l2C(e,this.s),this.alignState(),this.sendEvent()})).on("end",(t=>{Zr(t.currentTarget).classed("dragging",!1)})),b=cn().subject((()=>({x:u(this.muN),y:0}))).on("start",(t=>{Zr(t.currentTarget).classed("dragging",!0)})).on("drag",(t=>{this.drag=!0;let e=u.invert(t.x);e=e<u.domain()[0]?u.domain()[0]:e>u.domain()[1]?u.domain()[1]:e,this.d=Zo.muN2D(e,this.s),this.alignState(),this.sendEvent()})).on("end",(t=>{Zr(t.currentTarget).classed("dragging",!1)})),v=cn().subject((()=>({x:u(this.muS),y:d(this.hS)}))).on("start",((t,e)=>{Zr(t.currentTarget).classed("dragging",!0),e.startX=t.x,e.startY=t.y,e.startHS=this.hS,e.startMuS=this.muS})).on("drag",((t,e)=>{this.drag=!0;let r=this.muS;this.interactive&&(r=u.invert(t.x),r=r<u.domain()[0]?u.domain()[0]:r>u.domain()[1]?u.domain()[1]:r);let n=this.hS;this.unequal&&(n=d.invert(t.y),n=n<.01?.01:n>d.domain()[0]?d.domain()[0]:n),this.interactive&&this.unequal&&t.sourceEvent.shiftKey&&(Math.abs(t.x-e.startX)>Math.abs(t.y-e.startY)?n=e.startHS:r=e.startMuS),this.unequal&&(this.s=Zo.h2S(n),this.c=Zo.l2C(this.l,this.s)),this.d=Zo.muS2D(r,this.s),this.alignState(),this.sendEvent()})).on("end",(t=>{Zr(t.currentTarget).classed("dragging",!1)})),g=Uo().x((t=>u(t.e))).y((t=>d(t.p))),y=Zr(this.renderRoot).selectAll(".main").data([{width:this.width,height:this.height,rem:this.rem}]),w=y.enter().append("svg").classed("main",!0),x=w.merge(y).attr("viewBox",`0 0 ${n} ${i}`),$=w.append("g").classed("plot",!0),_=x.select(".plot").attr("transform",`translate(${o}, ${s})`),k=$.append("g").classed("underlayer",!0),S=_.select(".underlayer");k.append("rect").classed("background",!0),S.select(".background").attr("height",l).attr("width",c),k.append("g").classed("axis-x",!0);S.select(".axis-x").attr("transform",`translate(0, ${l})`).call(Ne(u)).attr("font-size",null).attr("font-family",null).selectAll("line, path").attr("stroke",null),k.append("text").classed("title-x",!0).attr("text-anchor","middle").text("Evidence"),S.select(".title-x").attr("transform",`translate(${c/2}, ${l+2.25*this.rem})`);const A=S.selectAll(".axis-y").data(this.distributions?[{}]:[]);A.enter().append("g").classed("axis-y",!0).merge(A).call(Re(d).ticks(5)).attr("font-size",null).attr("font-family",null).selectAll("line, path").attr("stroke",null),A.exit().remove();const E=S.selectAll(".title-y").data(this.distributions?[{}]:[]);E.enter().append("text").classed("title-y",!0).attr("text-anchor","middle").text("Probability").merge(E).attr("transform",`translate(${-2*this.rem}, ${l/2})rotate(-90)`),E.exit().remove();const M=S.selectAll(".axis-y2").data(this.histogram?[{}]:[]);var T;M.enter().append("g").classed("axis-y2",!0).merge(M).attr("transform",this.distributions?`translate(${c}, 0)`:"").call(this.distributions?(T=f,Ce(xe,T)).ticks(10):Re(f).ticks(10)).attr("font-size",null).attr("font-family",null).selectAll("line, path").attr("stroke",null),M.exit().remove();const C=S.selectAll(".title-y2").data(this.histogram?[{}]:[]);C.enter().append("text").classed("title-y2",!0).attr("text-anchor","middle").text("Count").merge(C).attr("transform",this.distributions?`translate(${c+1.5*this.rem}, ${l/2})rotate(90)`:`translate(${-1.5*this.rem}, ${l/2})rotate(-90)`),C.exit().remove(),$.append("g").classed("content",!0);const N=_.select(".content"),R=N.selectAll(".signal-noise").data(this.distributions?[{}]:[]),q=R.enter().append("g").classed("signal-noise",!0),P=q.merge(R);R.exit().remove();const z=q.append("g").classed("noise",!0),F=P.selectAll(".noise").attr("tabindex",this.interactive?0:null).classed("interactive",this.interactive).on("keydown",this.interactive?t=>{if(["ArrowRight","ArrowLeft"].includes(t.key)){let e=this.muN;switch(t.key){case"ArrowRight":e+=t.shiftKey?.01:.1;break;case"ArrowLeft":e-=t.shiftKey?.01:.1}e=e<u.domain()[0]?u.domain()[0]:e>u.domain()[1]?u.domain()[1]:e,e!==this.muN&&(this.d=Zo.muN2D(e,this.s),this.alignState(),this.sendEvent()),t.preventDefault()}}:null);(this.firstUpdate||t.has("interactive"))&&(this.interactive?F.call(b):F.on(".drag",null)),z.append("path").classed("curve-cr",!0),F.select(".curve-cr").transition().duration(this.drag?0:h).ease(cs).attrTween("d",((t,e,r)=>{const n=r[e],i=Jn(void 0!==n.d?n.d:this.d,this.d),s=Jn(void 0!==n.c?n.c:this.c,this.c),a=Jn(void 0!==n.s?n.s:this.s,this.s);return t=>{n.d=i(t),n.c=s(t),n.s=a(t);const e=ge(u.domain()[0],Zo.c2L(n.c,n.s),.05).map((t=>({e:t,p:Yo.normal.pdf(t,Zo.d2MuN(n.d,n.s),1)})));return e.push({e:Zo.c2L(n.c,n.s),p:Yo.normal.pdf(Zo.c2L(n.c,n.s),Zo.d2MuN(n.d,n.s),1)}),e.push({e:Zo.c2L(n.c,n.s),p:0}),e.push({e:u.domain()[0],p:0}),g(e)}})),z.append("path").classed("curve-fa",!0),F.select(".curve-fa").transition().duration(this.drag?0:h).ease(cs).attrTween("d",((t,e,r)=>{const n=r[e],i=Jn(void 0!==n.d?n.d:this.d,this.d),s=Jn(void 0!==n.c?n.c:this.c,this.c),a=Jn(void 0!==n.s?n.s:this.s,this.s);return t=>{n.d=i(t),n.c=s(t),n.s=a(t);const e=ge(Zo.c2L(n.c,n.s),u.domain()[1],.05).map((t=>({e:t,p:Yo.normal.pdf(t,Zo.d2MuN(n.d,n.s),1)})));return e.push({e:u.domain()[1],p:Yo.normal.pdf(u.domain()[1],Zo.d2MuN(n.d,n.s),1)}),e.push({e:u.domain()[1],p:0}),e.push({e:Zo.c2L(n.c,n.s),p:0}),g(e)}})),z.append("path").classed("curve-noise",!0),F.select(".curve-noise").transition().duration(this.drag?0:h).ease(cs).attrTween("d",((t,e,r)=>{const n=r[e],i=Jn(void 0!==n.d?n.d:this.d,this.d),s=Jn(void 0!==n.s?n.s:this.s,this.s);return t=>{n.d=i(t),n.s=s(t);const e=ge(u.domain()[0],u.domain()[1],.05).map((t=>({e:t,p:Yo.normal.pdf(t,Zo.d2MuN(n.d,n.s),1)})));return e.push({e:u.domain()[1],p:Yo.normal.pdf(u.domain()[1],Zo.d2MuN(n.d,n.s),1)}),g(e)}}));const O=q.append("g").classed("signal",!0),H=P.selectAll(".signal").attr("tabindex",this.interactive||this.unequal?0:null).classed("interactive",this.interactive).classed("unequal",this.unequal).on("keydown.sensitivity",this.interactive?t=>{if(["ArrowRight","ArrowLeft"].includes(t.key)){let e=this.muS;switch(t.key){case"ArrowRight":e+=t.shiftKey?.01:.1;break;case"ArrowLeft":e-=t.shiftKey?.01:.1}e=e<u.domain()[0]?u.domain()[0]:e>u.domain()[1]?u.domain()[1]:e,e!==this.muS&&(this.d=Zo.muS2D(e,this.s),this.alignState(),this.sendEvent()),t.preventDefault()}}:null).on("keydown.variance",this.unequal?t=>{if(["ArrowUp","ArrowDown"].includes(t.key)){let e=this.hS;switch(t.key){case"ArrowUp":e+=t.shiftKey?.002:.02;break;case"ArrowDown":e-=t.shiftKey?.002:.02}e=e<.01?.01:e>d.domain()[0]?d.domain()[0]:e,e!==this.hS&&(this.s=Zo.h2S(e),this.d=Zo.muN2D(this.muN,this.s),this.c=Zo.l2C(this.l,this.s),this.alignState(),this.sendEvent()),t.preventDefault()}}:null);(this.firstUpdate||t.has("interactive")||t.has("unequal"))&&(this.interactive||this.unequal?H.call(v):H.on(".drag",null)),O.append("path").classed("curve-m",!0),H.select(".curve-m").transition().duration(this.drag?0:h).ease(cs).attrTween("d",((t,e,r)=>{const n=r[e],i=Jn(void 0!==n.d?n.d:this.d,this.d),s=Jn(void 0!==n.c?n.c:this.c,this.c),a=Jn(void 0!==n.s?n.s:this.s,this.s);return t=>{n.d=i(t),n.c=s(t),n.s=a(t);const e=ge(u.domain()[0],Zo.c2L(n.c,n.s),.05).map((t=>({e:t,p:Yo.normal.pdf(t,Zo.d2MuS(n.d,n.s),n.s)})));return e.push({e:Zo.c2L(n.c,n.s),p:Yo.normal.pdf(Zo.c2L(n.c,n.s),Zo.d2MuS(n.d,n.s),n.s)}),e.push({e:Zo.c2L(n.c,n.s),p:0}),e.push({e:u.domain()[0],p:0}),g(e)}})),O.append("path").classed("curve-h",!0),H.select(".curve-h").transition().duration(this.drag?0:h).ease(cs).attrTween("d",((t,e,r)=>{const n=r[e],i=Jn(void 0!==n.d?n.d:this.d,this.d),s=Jn(void 0!==n.c?n.c:this.c,this.c),a=Jn(void 0!==n.s?n.s:this.s,this.s);return t=>{n.d=i(t),n.c=s(t),n.s=a(t);const e=ge(Zo.c2L(n.c,n.s),u.domain()[1],.05).map((t=>({e:t,p:Yo.normal.pdf(t,Zo.d2MuS(n.d,n.s),n.s)})));return e.push({e:u.domain()[1],p:Yo.normal.pdf(u.domain()[1],Zo.d2MuS(n.d,n.s),n.s)}),e.push({e:u.domain()[1],p:0}),e.push({e:Zo.c2L(n.c,n.s),p:0}),g(e)}})),O.append("path").classed("curve-signal",!0),H.select(".curve-signal").transition().duration(this.drag?0:h).ease(cs).attrTween("d",((t,e,r)=>{const n=r[e],i=Jn(void 0!==n.d?n.d:this.d,this.d),s=Jn(void 0!==n.s?n.s:this.s,this.s);return t=>{n.d=i(t),n.s=s(t);const e=ge(u.domain()[0],u.domain()[1],.05).map((t=>({e:t,p:Yo.normal.pdf(t,Zo.d2MuS(n.d,n.s),n.s)})));return e.push({e:u.domain()[1],p:Yo.normal.pdf(u.domain()[1],Zo.d2MuS(n.d,n.s),n.s)}),g(e)}}));const U=N.selectAll(".measure-d").data(this.sensitivity?[{}]:[]),D=U.enter().append("g").classed("measure-d",!0);D.append("line").classed("line",!0),D.append("line").classed("cap-left",!0),D.append("line").classed("cap-right",!0);const I=D.append("text").classed("label",!0);I.append("tspan").classed("d math-var",!0).text("d′"),I.append("tspan").classed("equals",!0).text(" = "),I.append("tspan").classed("value",!0);const L=D.merge(U);L.select(".line").transition().duration(this.drag?0:h).ease(cs).attr("x1",u(this.muN)).attr("y1",d(.43)).attr("x2",u(this.muS)).attr("y2",d(.43)),L.select(".cap-left").transition().duration(this.drag?0:h).ease(cs).attr("x1",u(this.muN)).attr("y1",d(.43)+5).attr("x2",u(this.muN)).attr("y2",d(.43)-5),L.select(".cap-right").transition().duration(this.drag?0:h).ease(cs).attr("x1",u(this.muS)).attr("y1",d(.43)+5).attr("x2",u(this.muS)).attr("y2",d(.43)-5);L.select(".label").transition().duration(this.drag?0:h).ease(cs).attr("x",u(this.muN>this.muS?this.muN:this.muS)+5).attr("y",d(.43)+3).select(".value").tween("text",((t,e,r)=>{const n=r[e],i=Jn(void 0!==n.d?n.d:this.d,this.d);return t=>{n.d=i(t),Zr(n).text(Ls(".3")(n.d))}})),U.exit().remove();const j=N.selectAll(".measure-c").data(this.bias?[{}]:[]),V=j.enter().append("g").classed("measure-c",!0);V.append("line").classed("line",!0),V.append("line").classed("cap-zero",!0);const B=V.append("text").classed("label",!0);B.append("tspan").classed("c math-var",!0).text("c"),B.append("tspan").classed("equals",!0).text(" = "),B.append("tspan").classed("value",!0);const K=V.merge(j);K.select(".line").transition().duration(this.drag?0:h).ease(cs).attr("x1",u(this.l)).attr("y1",d(.47)).attr("x2",u(0)).attr("y2",d(.47)),K.select(".cap-zero").transition().duration(this.drag?0:h).ease(cs).attr("x1",u(0)).attr("y1",d(.47)+5).attr("x2",u(0)).attr("y2",d(.47)-5);K.select(".label").transition().duration(this.drag?0:h).ease(cs).attr("x",u(0)+(this.l<0?5:-5)).attr("y",d(.47)+3).attr("text-anchor",this.c<0?"start":"end").select(".value").tween("text",((t,e,r)=>{const n=r[e],i=Jn(void 0!==n.c?n.c:this.c,this.c);return t=>{n.c=i(t),Zr(n).text(Ls(".3")(n.c))}})),j.exit().remove();const W=N.selectAll(".measure-s").data(this.variance?[{}]:[]),X=W.enter().append("g").classed("measure-s",!0);X.append("line").classed("line",!0),X.append("line").classed("cap-left",!0),X.append("line").classed("cap-right",!0);const Y=X.append("text").classed("label",!0);Y.append("tspan").classed("s math-var",!0).text("σ"),Y.append("tspan").classed("equals",!0).text(" = "),Y.append("tspan").classed("value",!0);const Z=X.merge(W);Z.select(".line").transition().duration(this.drag?0:h).ease(cs).attr("x1",u(this.muS-this.s)).attr("y1",d(Yo.normal.pdf(this.s,0,this.s))+10/this.s).attr("x2",u(this.muS+this.s)).attr("y2",d(Yo.normal.pdf(this.s,0,this.s))+10/this.s),Z.select(".cap-left").transition().duration(this.drag?0:h).ease(cs).attr("x1",u(this.muS-this.s)).attr("y1",d(Yo.normal.pdf(this.s,0,this.s))+10/this.s+5).attr("x2",u(this.muS-this.s)).attr("y2",d(Yo.normal.pdf(this.s,0,this.s))+10/this.s-5),Z.select(".cap-right").transition().duration(this.drag?0:h).ease(cs).attr("x1",u(this.muS+this.s)).attr("y1",d(Yo.normal.pdf(this.s,0,this.s))+10/this.s+5).attr("x2",u(this.muS+this.s)).attr("y2",d(Yo.normal.pdf(this.s,0,this.s))+10/this.s-5);Z.select(".label").transition().duration(this.drag?0:h).ease(cs).attr("x",u(this.muS)).attr("y",d(Yo.normal.pdf(this.s,0,this.s))+10/this.s-3).select(".value").tween("text",((t,e,r)=>{const n=r[e],i=Jn(void 0!==n.s?n.s:this.s,this.s);return t=>{n.s=i(t),Zr(n).text(Ls(".3")(n.s))}})),W.exit().remove();const G=N.selectAll(".threshold").data(this.threshold?[{}]:[]),J=G.enter().append("g").classed("threshold",!0);J.append("line").classed("line",!0),J.append("circle").classed("handle",!0);const Q=J.merge(G).attr("tabindex",this.interactive?0:null).classed("interactive",this.interactive);(this.firstUpdate||t.has("interactive"))&&(this.interactive?Q.call(m).on("keydown",(t=>{if(["ArrowRight","ArrowLeft"].includes(t.key)){let e=this.l;switch(t.key){case"ArrowRight":e+=t.shiftKey?.01:.1;break;case"ArrowLeft":e-=t.shiftKey?.01:.1}e=e<u.domain()[0]?u.domain()[0]:e>u.domain()[1]?u.domain()[1]:e,e!==this.l&&(this.c=Zo.l2C(e,this.s),this.alignState(),this.sendEvent()),t.preventDefault()}})):Q.on("drag",null).on("keydown",null)),Q.select(".line").transition().duration(this.drag?0:h).ease(cs).attr("x1",u(this.l)).attr("y1",d(0)).attr("x2",u(this.l)).attr("y2",d(.54)),Q.select(".handle").transition().duration(this.drag?0:h).ease(cs).attr("cx",u(this.l)).attr("cy",d(.54)),G.exit().remove();const tt=N.selectAll(".histogram").data(this.histogram?[{}]:[]),et=tt.enter().append("g").classed("histogram",!0).merge(tt);if(tt.exit().remove(),this.histogram){const t=ve().value((t=>t.trueEvidence)).domain(u.domain()).thresholds(ge(this.binRange[0],this.binRange[1],this.binWidth)),e=t(this.trials);let r=-1,n=-1;for(let t=0;t<e.length;t+=1)for(let i=0;i<e[t].length;i+=1)e[t][i].binValue=e[t].x0,e[t][i].binCount=i,0===t&&(r=i),t===e.length-1&&(n=i);for(let t=0;t<this.trials.length;t+=1)this.trials[t].trueEvidence<this.binRange[0]&&(r+=1,this.trials[t].binCount=r,this.trials[t].binValue=e[0].x0),this.trials[t].trueEvidence>this.binRange[1]&&(n+=1,this.trials[t].binCount=n,this.trials[t].binValue=e[e.length-1].x0);const i=et.selectAll(".trial").data(this.trials,(t=>t.trial)),s=i.enter().append("rect").attr("stroke-width",3).attr("data-new-trial-ease-time",0).attr("stroke",this.getComputedStyleValue("---color-acc")).attr("fill",this.getComputedStyleValue("---color-acc-light")).merge(i).attr("class",(t=>`trial ${t.outcome}`)).attr("width",p-3).attr("height",p-3),a=s.filter((t=>t.new&&!t.paused));if(!a.empty()){const t=a.attr("data-new-trial-ease-time"),e=e=>Ro().domain([0,1]).range([t,1])(e),r=e=>r=>Ro().domain([e(t),1]).range([0,1])(e(r));a.transition("new").duration((e=>Math.floor((.75*e.duration+.25*e.wait)*(1-t)))).ease(e).attr("data-new-trial-ease-time",1).attrTween("stroke",((t,e,n)=>{const i=n[e],s=jn(i.getAttribute("stroke"),"stimulus"===this.color?"present"===t.signal?this.getComputedStyleValue("---color-hr"):this.getComputedStyleValue("---color-far"):"response"===this.color?this.getComputedStyleValue(`---color-${t.response}`):"outcome"===this.color?this.getComputedStyleValue(`---color-${t.outcome}`):this.getComputedStyleValue("---color-acc"));return t=>s(r(ls)(t))})).attrTween("fill",((t,e,n)=>{const i=n[e],s=jn(i.getAttribute("fill"),"stimulus"===this.color?"present"===t.signal?this.getComputedStyleValue("---color-hr-light"):this.getComputedStyleValue("---color-far-light"):"response"===this.color?this.getComputedStyleValue(`---color-${t.response}-light`):"outcome"===this.color?this.getComputedStyleValue(`---color-${t.outcome}-light`):this.getComputedStyleValue("---color-acc-light"));return t=>s(r(ls)(t))})).attrTween("x",((t,e,n)=>{const i=Jn(n[e].getAttribute("x"),u(t.binValue)+1.5);return t=>i(r(cs)(t))})).attrTween("y",((t,e,n)=>{const i=Jn(n[e].getAttribute("y"),d(0)+1.5-(t.binCount+1)*p);return t=>i(r(ls)(t))})).on("end",((t,e,r)=>{r[e].removeAttribute("data-new-trial-ease-time"),t.new=!1,this.alignTrial(t),this.dispatchEvent(new CustomEvent("detectable-response",{detail:{stimulus:t.signal,response:t.response,outcome:t.outcome,h:this.h,m:this.m,fa:this.fa,cr:this.cr,nr:0},bubbles:!0}))}))}const o=s.filter((t=>t.new&&t.paused));if(!o.empty()){const t=o.attr("data-new-trial-ease-time");o.transition().duration(h).ease(cs).attr("x",(e=>Jn(0,u(e.binValue)+1.5)(cs(t)))).attr("y",(e=>Jn(0,d(0)+1.5-(e.binCount+1)*p)(ls(t)))).attr("stroke",(e=>jn(this.getComputedStyleValue("---color-acc"),"stimulus"===this.color?"present"===e.signal?this.getComputedStyleValue("---color-hr"):this.getComputedStyleValue("---color-far"):"response"===this.color?this.getComputedStyleValue(`---color-${e.response}`):"outcome"===this.color?this.getComputedStyleValue(`---color-${e.outcome}`):this.getComputedStyleValue("---color-acc"))(ls(t)))).attr("fill",(e=>jn(this.getComputedStyleValue("---color-acc-light"),"stimulus"===this.color?"present"===e.signal?this.getComputedStyleValue("---color-hr-light"):this.getComputedStyleValue("---color-far-light"):"response"===this.color?this.getComputedStyleValue(`---color-${e.response}-light`):"outcome"===this.color?this.getComputedStyleValue(`---color-${e.outcome}-light`):this.getComputedStyleValue("---color-acc-light"))(ls(t))))}s.filter((t=>!t.new)).transition().duration(h).ease(cs).attr("x",(t=>u(t.binValue)+1.5)).attr("y",(t=>d(0)+1.5-(t.binCount+1)*p)).attr("stroke",(t=>"stimulus"===this.color?"present"===t.signal?this.getComputedStyleValue("---color-hr"):this.getComputedStyleValue("---color-far"):"response"===this.color?this.getComputedStyleValue(`---color-${t.response}`):"outcome"===this.color?this.getComputedStyleValue(`---color-${t.outcome}`):this.getComputedStyleValue("---color-acc"))).attr("fill",(t=>"stimulus"===this.color?"present"===t.signal?this.getComputedStyleValue("---color-hr-light"):this.getComputedStyleValue("---color-far-light"):"response"===this.color?this.getComputedStyleValue(`---color-${t.response}-light`):"outcome"===this.color?this.getComputedStyleValue(`---color-${t.outcome}-light`):this.getComputedStyleValue("---color-acc-light"))),i.exit().transition().duration(h).ease(os).attrTween("stroke",((t,e,r)=>{const n=r[e],i=jn(n.getAttribute("stroke"),this.getComputedStyleValue("---color-acc"));return t=>i(ls(t))})).attrTween("fill",((t,e,r)=>{const n=r[e],i=jn(n.getAttribute("fill"),this.getComputedStyleValue("---color-acc-light"));return t=>i(ls(t))})).attrTween("x",((t,e,r)=>{const n=Jn(r[e].getAttribute("x"),0);return t=>n(ls(t))})).attrTween("y",((t,e,r)=>{const n=Jn(r[e].getAttribute("y"),0);return t=>n(cs(t))})).remove()}const rt=$.append("g").classed("overlayer",!0),nt=_.select(".overlayer");rt.append("rect").classed("background",!0),nt.select(".background").attr("height",l).attr("width",c),this.drag=!1,this.firstUpdate=!1}pauseTrial(){const t=Zr(this.renderRoot).select(".trial[data-new-trial-ease-time]");t.interrupt("new"),t.datum((t=>(t.paused=!0,t)))}resumeTrial(){Zr(this.renderRoot).select(".trial[data-new-trial-ease-time]").datum((t=>(t.paused=!1,t))),this.requestUpdate()}}customElements.define("sdt-model",Qo);class tl extends Bo{static get properties(){return{feedback:{attribute:"feedback",type:String,reflect:!0},trial:{attribute:"trial",type:Boolean,reflect:!0},payoff:{attribute:"payoff",type:String,reflect:!0},hPayoff:{attribute:"hit-payoff",type:Number,reflect:!0},mPayoff:{attribute:"miss-payoff",type:Number,reflect:!0},faPayoff:{attribute:"false-alarm-payoff",type:Number,reflect:!0},crPayoff:{attribute:"correct-rejection-payoff",type:Number,reflect:!0},nrPayoff:{attribute:"no-response-payoff",type:Number,reflect:!0},state:{attribute:!1,type:String,reflect:!1},trialCount:{attribute:!1,type:Number,reflect:!1},trialTotal:{attribute:!1,type:Number,reflect:!1}}}constructor(){super(),this.feedbacks=["none","accuracy","outcome"],this.feedback="outcome",this.trial=!1,this.payoffs=["none","trial","total"],this.payoff="none",this.hPayoff=0,this.mPayoff=0,this.crPayoff=0,this.faPayoff=0,this.nrPayoff=0,this.states=["off","waiting","feedback"],this.state="off",this.trialCount=0,this.trialTotal=0,this.signals=["present","absent"],this.signal=void 0,this.responses=["present","absent"],this.response=void 0,this.outcomes=["h","m","fa","cr","nr"],this.outcome=void 0,this.accuracies=["c","e","nr"],this.accuracy=void 0,this.h=0,this.m=0,this.cr=0,this.fa=0,this.c=0,this.e=0,this.nr=0}get trialPayoff(){switch(this.outcome){case"h":return this.hPayoff;case"m":return this.mPayoff;case"fa":return this.faPayoff;case"cr":return this.crPayoff;case"nr":return this.nrPayoff;default:return}}get totalPayoff(){return this.h*this.hPayoff+this.m*this.mPayoff+this.cr*this.crPayoff+this.fa*this.faPayoff+this.nr*this.nrPayoff}start(t,e){this.trialCount=e,this.state="waiting",this.signal=t,this.response=void 0,this.outcome=void 0}stop(){this.state="feedback",void 0===this.response&&(this.outcome="nr",this.nr+=1,this.accuracy="nr")}present(){this.responded("present")}absent(){this.responded("absent")}responded(t){this.state="feedback",this.response=t,"present"===this.signal&&"present"===this.response?(this.outcome="h",this.h+=1,this.accuracy="c",this.c+=1):"present"===this.signal&&"absent"===this.response?(this.outcome="m",this.m+=1,this.accuracy="e",this.e+=1):"absent"===this.signal&&"present"===this.response?(this.outcome="fa",this.fa+=1,this.accuracy="e",this.e+=1):"absent"===this.signal&&"absent"===this.response&&(this.outcome="cr",this.cr+=1,this.accuracy="c",this.c+=1),this.dispatchEvent(new CustomEvent("detectable-response",{detail:{trial:this.trialCount,signal:this.signal,response:this.response,outcome:this.outcome,payoff:this.trialPayoff,h:this.h,m:this.m,fa:this.fa,cr:this.cr,nr:this.nr,totalPayoff:this.totalPayoff},bubbles:!0}))}reset(){this.state="off",this.trialCount=0,this.signal=void 0,this.response=void 0,this.outcome=void 0,this.accuracy=void 0,this.h=0,this.m=0,this.cr=0,this.fa=0,this.nr=0,this.c=0,this.e=0}static get styles(){return[super.styles,nt`
|
|
1316
1316
|
:host {
|
|
1317
1317
|
display: inline-block;
|
|
1318
1318
|
}
|
|
@@ -1432,29 +1432,29 @@ const Ho=t=>null!=t?t:z;customElements.define("decidables-slider",class extends
|
|
|
1432
1432
|
.total .label {
|
|
1433
1433
|
font-weight: 600;
|
|
1434
1434
|
}
|
|
1435
|
-
`]}render(){const t=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}),e=e=>t.formatToParts(e).map((({type:t,value:e})=>"minusSign"===t?"−":e)).reduce(((t,e)=>t+e));return
|
|
1435
|
+
`]}render(){const t=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}),e=e=>t.formatToParts(e).map((({type:t,value:e})=>"minusSign"===t?"−":e)).reduce(((t,e)=>t+e));return Pt`
|
|
1436
1436
|
<div class="holder">
|
|
1437
1437
|
<div class="responses">
|
|
1438
1438
|
<decidables-button name="present" class=${"feedback"===this.state&&"present"===this.response?"selected":"waiting"===this.state?"waiting":""} ?disabled=${"waiting"!==this.state||!0!==this.interactive} @click=${this.present.bind(this)}>Present</decidables-button>
|
|
1439
1439
|
<decidables-button name="absent" class=${"feedback"===this.state&&"absent"===this.response?"selected":"waiting"===this.state?"waiting":""} ?disabled=${"waiting"!==this.state||!0!==this.interactive} @click=${this.absent.bind(this)}>Absent</decidables-button>
|
|
1440
1440
|
</div>
|
|
1441
|
-
${this.trial||"none"!==this.feedback||"total"===this.payoff?
|
|
1441
|
+
${this.trial||"none"!==this.feedback||"total"===this.payoff?Pt`
|
|
1442
1442
|
<div class="feedbacks">
|
|
1443
|
-
${this.trial?
|
|
1443
|
+
${this.trial?Pt`
|
|
1444
1444
|
<div class="trial">
|
|
1445
1445
|
<span class="label">Trial: </span><span class="count">${this.trialCount}</span><span class="of"> of </span><span class="total">${this.trialTotal}</span>
|
|
1446
|
-
</div>`:
|
|
1447
|
-
${"none"!==this.feedback?
|
|
1446
|
+
</div>`:Pt``}
|
|
1447
|
+
${"none"!==this.feedback?Pt`
|
|
1448
1448
|
<div class=${`feedback ${"feedback"===this.state?"outcome"===this.feedback?this.outcome:this.accuracy:""}`}>
|
|
1449
|
-
${"feedback"===this.state?"outcome"===this.feedback?"h"===this.outcome?
|
|
1450
|
-
${"feedback"!==this.state||"trial"!==this.payoff&&"total"!==this.payoff?
|
|
1451
|
-
</div>`:
|
|
1452
|
-
${"total"===this.payoff?
|
|
1449
|
+
${"feedback"===this.state?"outcome"===this.feedback?"h"===this.outcome?Pt`<span class="outcome">Hit</span>`:"m"===this.outcome?Pt`<span class="outcome">Miss</span>`:"fa"===this.outcome?Pt`<span class="outcome">False<br>Alarm</span>`:"cr"===this.outcome?Pt`<span class="outcome">Correct<br>Rejection</span>`:Pt`<span class="outcome">No<br>Response</span>`:"c"===this.accuracy?Pt`<span class="outcome">Correct</span>`:"e"===this.accuracy?Pt`<span class="outcome">Error</span>`:Pt`<span class="outcome">No<br>Response</span>`:""}
|
|
1450
|
+
${"feedback"!==this.state||"trial"!==this.payoff&&"total"!==this.payoff?Pt``:Pt`<span class="payoff">${e(this.trialPayoff)}</span>`}
|
|
1451
|
+
</div>`:Pt``}
|
|
1452
|
+
${"total"===this.payoff?Pt`
|
|
1453
1453
|
<div class="total">
|
|
1454
1454
|
<span class="label">Total: </span><span class="value">${e(this.totalPayoff)}</span>
|
|
1455
|
-
</div>`:
|
|
1456
|
-
</div>`:
|
|
1457
|
-
</div>`}}customElements.define("detectable-response",
|
|
1455
|
+
</div>`:Pt``}
|
|
1456
|
+
</div>`:Pt``}
|
|
1457
|
+
</div>`}}customElements.define("detectable-response",tl);class el extends Bo{static get properties(){return{numeric:{attribute:"numeric",type:Boolean,reflect:!0},summary:{attribute:"summary",converter:Vo,reflect:!0},color:{attribute:"color",type:String,reflect:!0},h:{attribute:"hits",type:Number,reflect:!0},m:{attribute:"misses",type:Number,reflect:!0},fa:{attribute:"false-alarms",type:Number,reflect:!0},cr:{attribute:"correct-rejections",type:Number,reflect:!0},payoff:{attribute:"payoff",type:Boolean,reflect:!0},hPayoff:{attribute:"hit-payoff",type:Number,reflect:!0},mPayoff:{attribute:"miss-payoff",type:Number,reflect:!0},faPayoff:{attribute:"false-alarm-payoff",type:Number,reflect:!0},crPayoff:{attribute:"correct-rejection-payoff",type:Number,reflect:!0},far:{attribute:!1,type:Number,reflect:!1},hr:{attribute:!1,type:Number,reflect:!1},acc:{attribute:!1,type:Number,reflect:!1},ppv:{attribute:!1,type:Number,reflect:!1},fomr:{attribute:!1,type:Number,reflect:!1}}}constructor(){super(),this.numeric=!1,this.summaries=["stimulusRates","responseRates","accuracy"],this.summary=new Set,this.colors=["none","accuracy","stimulus","response","outcome","all"],this.color="all",this.h=40,this.m=60,this.fa=75,this.cr=25,this.alignState(),this.payoff=!1,this.hPayoff=void 0,this.mPayoff=void 0,this.crPayoff=void 0,this.faPayoff=void 0}alignState(){this.hr=Zo.hM2Hr(this.h,this.m),this.far=Zo.faCr2Far(this.fa,this.cr),this.acc=Zo.hMFaCr2Acc(this.h,this.m,this.fa,this.cr),this.ppv=Zo.hFa2Ppv(this.h,this.fa),this.fomr=Zo.mCr2Fomr(this.m,this.cr)}sendEvent(){this.dispatchEvent(new CustomEvent("detectable-table-change",{detail:{h:this.h,m:this.m,hr:this.hr,fa:this.fa,cr:this.cr,far:this.far,acc:this.acc,ppv:this.ppv,fomr:this.fomr},bubbles:!0}))}hInput(t){this.h=parseInt(t.target.value,10),this.alignState(),this.sendEvent()}mInput(t){this.m=parseInt(t.target.value,10),this.alignState(),this.sendEvent()}faInput(t){this.fa=parseInt(t.target.value,10),this.alignState(),this.sendEvent()}crInput(t){this.cr=parseInt(t.target.value,10),this.alignState(),this.sendEvent()}hrInput(t){const e=parseFloat(t.target.value),r=this.h+this.m;this.h=Math.round(e*r),this.m=r-this.h,this.alignState(),this.sendEvent()}farInput(t){const e=parseFloat(t.target.value),r=this.fa+this.cr;this.fa=Math.round(e*r),this.cr=r-this.fa,this.alignState(),this.sendEvent()}accInput(t){const e=parseFloat(t.target.value),r=this.h+this.m,n=this.fa+this.cr,i=(this.hr+this.far-1)/2;let s=i+e,a=1+i-e;a>1&&(a=1,s=a+2*e-1),a<0&&(a=0,s=a+2*e-1),s>1&&(s=1,a=s-2*e+1),s<0&&(s=0,a=s-2*e+1),this.h=Math.round(s*r),this.m=r-this.h,this.fa=Math.round(a*n),this.cr=n-this.fa,this.alignState(),this.sendEvent()}ppvInput(t){const e=parseFloat(t.target.value),r=this.h+this.fa;this.h=Math.round(e*r),this.fa=r-this.h,this.alignState(),this.sendEvent()}fomrInput(t){const e=parseFloat(t.target.value),r=this.m+this.cr;this.m=Math.round(e*r),this.cr=r-this.m,this.alignState(),this.sendEvent()}static get styles(){return[super.styles,nt`
|
|
1458
1458
|
:host {
|
|
1459
1459
|
display: inline-block;
|
|
1460
1460
|
}
|
|
@@ -1637,51 +1637,51 @@ const Ho=t=>null!=t?t:z;customElements.define("decidables-slider",class extends
|
|
|
1637
1637
|
:host([color="none"]) .acc {
|
|
1638
1638
|
background: var(---color-element-background);
|
|
1639
1639
|
}
|
|
1640
|
-
`]}render(){const t=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}),e=e=>t.formatToParts(e).map((({type:t,value:e})=>"minusSign"===t?"−":e)).reduce(((t,e)=>t+e));let r,n,i,s,a,o,l,c,h;return this.alignState(),this.numeric?(r=
|
|
1640
|
+
`]}render(){const t=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}),e=e=>t.formatToParts(e).map((({type:t,value:e})=>"minusSign"===t?"−":e)).reduce(((t,e)=>t+e));let r,n,i,s,a,o,l,c,h;return this.alignState(),this.numeric?(r=Pt`
|
|
1641
1641
|
<decidables-spinner ?disabled=${!this.interactive} min="0" .value="${this.h}" @input=${this.hInput.bind(this)}>
|
|
1642
1642
|
<span>Hits</span>
|
|
1643
|
-
${this.payoff?
|
|
1643
|
+
${this.payoff?Pt`<span class="payoff">${e(this.hPayoff)}</span>`:Pt``}
|
|
1644
1644
|
</decidables-spinner>
|
|
1645
|
-
`,n=
|
|
1645
|
+
`,n=Pt`
|
|
1646
1646
|
<decidables-spinner ?disabled=${!this.interactive} min="0" .value="${this.m}" @input=${this.mInput.bind(this)}>
|
|
1647
1647
|
<span>Misses</span>
|
|
1648
|
-
${this.payoff?
|
|
1648
|
+
${this.payoff?Pt`<span class="payoff">${e(this.mPayoff)}</span>`:Pt``}
|
|
1649
1649
|
</decidables-spinner>
|
|
1650
|
-
`,i=
|
|
1650
|
+
`,i=Pt`
|
|
1651
1651
|
<decidables-spinner ?disabled=${!this.interactive} min="0" .value="${this.fa}" @input=${this.faInput.bind(this)}>
|
|
1652
1652
|
<span>False Alarms</span>
|
|
1653
|
-
${this.payoff?
|
|
1653
|
+
${this.payoff?Pt`<span class="payoff">${e(this.faPayoff)}</span>`:Pt``}
|
|
1654
1654
|
</decidables-spinner>
|
|
1655
|
-
`,s=
|
|
1655
|
+
`,s=Pt`
|
|
1656
1656
|
<decidables-spinner ?disabled=${!this.interactive} min="0" .value="${this.cr}" @input=${this.crInput.bind(this)}>
|
|
1657
1657
|
<span>Correct Rejections</span>
|
|
1658
|
-
${this.payoff?
|
|
1658
|
+
${this.payoff?Pt`<span class="payoff">${e(this.crPayoff)}</span>`:Pt``}
|
|
1659
1659
|
</decidables-spinner>
|
|
1660
|
-
`,a=
|
|
1660
|
+
`,a=Pt`
|
|
1661
1661
|
<decidables-spinner ?disabled=${!this.interactive} min="0" max="1" step=".001" .value="${+this.hr.toFixed(3)}" @input=${this.hrInput.bind(this)}>
|
|
1662
1662
|
<span>Hit Rate</span>
|
|
1663
1663
|
</decidables-spinner>
|
|
1664
|
-
`,o=
|
|
1664
|
+
`,o=Pt`
|
|
1665
1665
|
<decidables-spinner ?disabled=${!this.interactive} min="0" max="1" step=".001" .value="${+this.far.toFixed(3)}" @input=${this.farInput.bind(this)}>
|
|
1666
1666
|
<span>False Alarm Rate</span>
|
|
1667
1667
|
</decidables-spinner>
|
|
1668
|
-
`,l=
|
|
1668
|
+
`,l=Pt`
|
|
1669
1669
|
<decidables-spinner ?disabled=${!this.interactive} min="0" max="1" step=".001" .value="${+this.acc.toFixed(3)}" @input=${this.accInput.bind(this)}>
|
|
1670
1670
|
<span>Accuracy</span>
|
|
1671
1671
|
</decidables-spinner>
|
|
1672
|
-
`,c=
|
|
1672
|
+
`,c=Pt`
|
|
1673
1673
|
<decidables-spinner ?disabled=${!this.interactive} min="0" max="1" step=".001" .value="${+this.ppv.toFixed(3)}" @input=${this.ppvInput.bind(this)}>
|
|
1674
1674
|
<span>Positive Predictive Value</span>
|
|
1675
1675
|
</decidables-spinner>
|
|
1676
|
-
`,h=
|
|
1676
|
+
`,h=Pt`
|
|
1677
1677
|
<decidables-spinner ?disabled=${!this.interactive} min="0" max="1" step=".001" .value="${+this.fomr.toFixed(3)}" @input=${this.fomrInput.bind(this)}>
|
|
1678
1678
|
<span>False Omission Rate</span>
|
|
1679
1679
|
</decidables-spinner>
|
|
1680
|
-
`):(r=
|
|
1681
|
-
${this.payoff?
|
|
1682
|
-
${this.payoff?
|
|
1683
|
-
${this.payoff?
|
|
1684
|
-
${this.payoff?
|
|
1680
|
+
`):(r=Pt`<span>Hits</span>
|
|
1681
|
+
${this.payoff?Pt`<span class="payoff">${e(this.hPayoff)}</span>`:Pt``}`,n=Pt`<span>Misses</span>
|
|
1682
|
+
${this.payoff?Pt`<span class="payoff">${e(this.mPayoff)}</span>`:Pt``}`,i=Pt`<span>False Alarms</span>
|
|
1683
|
+
${this.payoff?Pt`<span class="payoff">${e(this.faPayoff)}</span>`:Pt``}`,s=Pt`<span>Correct Rejections</span>
|
|
1684
|
+
${this.payoff?Pt`<span class="payoff">${e(this.crPayoff)}</span>`:Pt``}`,a=Pt`<span>Hit Rate</span>`,o=Pt`<span>False Alarm Rate</span>`,l=Pt`<span>Accuracy</span>`,c=Pt`<span>Positive Predictive Value</span>`,h=Pt`<span>False Omission Rate</span>`),Pt`
|
|
1685
1685
|
<table class=${this.numeric?"numeric":""}>
|
|
1686
1686
|
<thead>
|
|
1687
1687
|
<tr>
|
|
@@ -1713,10 +1713,10 @@ const Ho=t=>null!=t?t:z;customElements.define("decidables-slider",class extends
|
|
|
1713
1713
|
<td class="td td-data m">
|
|
1714
1714
|
${n}
|
|
1715
1715
|
</td>
|
|
1716
|
-
${this.summary.has("stimulusRates")?
|
|
1716
|
+
${this.summary.has("stimulusRates")?Pt`
|
|
1717
1717
|
<td class="td td-summary hr">
|
|
1718
1718
|
${a}
|
|
1719
|
-
</td>`:
|
|
1719
|
+
</td>`:Pt``}
|
|
1720
1720
|
</tr>
|
|
1721
1721
|
<tr>
|
|
1722
1722
|
<th class="th th-sub th-left" scope="row">
|
|
@@ -1728,29 +1728,29 @@ const Ho=t=>null!=t?t:z;customElements.define("decidables-slider",class extends
|
|
|
1728
1728
|
<td class="td td-data cr">
|
|
1729
1729
|
${s}
|
|
1730
1730
|
</td>
|
|
1731
|
-
${this.summary.has("stimulusRates")?
|
|
1731
|
+
${this.summary.has("stimulusRates")?Pt`
|
|
1732
1732
|
<td class="td td-summary far">
|
|
1733
1733
|
${o}
|
|
1734
|
-
</td>`:
|
|
1734
|
+
</td>`:Pt``}
|
|
1735
1735
|
</tr>
|
|
1736
|
-
${this.summary.has("responseRates")||this.summary.has("accuracy")?
|
|
1736
|
+
${this.summary.has("responseRates")||this.summary.has("accuracy")?Pt`
|
|
1737
1737
|
<tr>
|
|
1738
1738
|
<td colspan="2"></td>
|
|
1739
|
-
${this.summary.has("responseRates")?
|
|
1739
|
+
${this.summary.has("responseRates")?Pt`
|
|
1740
1740
|
<td class="td td-summary ppv">
|
|
1741
1741
|
${c}
|
|
1742
1742
|
</td>
|
|
1743
1743
|
<td class="td td-summary fomr">
|
|
1744
1744
|
${h}
|
|
1745
|
-
</td>`:
|
|
1745
|
+
</td>`:Pt`
|
|
1746
1746
|
<td colspan="2"></td>`}
|
|
1747
|
-
${this.summary.has("accuracy")?
|
|
1747
|
+
${this.summary.has("accuracy")?Pt`
|
|
1748
1748
|
<td class="td td-summary acc" rowspan="2">
|
|
1749
1749
|
${l}
|
|
1750
|
-
</td>`:
|
|
1751
|
-
</tr>`:
|
|
1750
|
+
</td>`:Pt``}
|
|
1751
|
+
</tr>`:Pt``}
|
|
1752
1752
|
</tbody>
|
|
1753
|
-
</table>`}}customElements.define("detectable-table",
|
|
1753
|
+
</table>`}}customElements.define("detectable-table",el);class rl extends Bo{static get properties(){return{numeric:{attribute:"numeric",type:Boolean,reflect:!0}}}constructor(){super(),this.numeric=!1}static get styles(){return[super.styles,nt`
|
|
1754
1754
|
:host {
|
|
1755
1755
|
display: block;
|
|
1756
1756
|
|
|
@@ -1874,23 +1874,23 @@ const Ho=t=>null!=t?t:z;customElements.define("decidables-slider",class extends
|
|
|
1874
1874
|
.s {
|
|
1875
1875
|
background: var(---color-s-light);
|
|
1876
1876
|
}
|
|
1877
|
-
`]}}class
|
|
1877
|
+
`]}}class nl extends rl{static get properties(){return{unequal:{attribute:"unequal",type:Boolean,reflect:!0},d:{attribute:"d",type:Number,reflect:!0},c:{attribute:"c",type:Number,reflect:!0},s:{attribute:"s",type:Number,reflect:!0},far:{attribute:!1,type:Number,reflect:!1}}}constructor(){super(),this.unequal=!1,this.d=0,this.c=0,this.s=1,this.alignState()}alignState(){this.far=Zo.dC2Far(this.d,this.c,this.s)}sendEvent(){this.dispatchEvent(new CustomEvent("sdt-equation-dc2far-change",{detail:{d:this.d,c:this.c,s:this.s,far:this.far},bubbles:!0}))}dInput(t){this.d=parseFloat(t.target.value),this.alignState(),this.sendEvent()}cInput(t){this.c=parseFloat(t.target.value),this.alignState(),this.sendEvent()}sInput(t){this.s=parseFloat(t.target.value),this.alignState(),this.sendEvent()}render(){let t,e,r,n,i;return this.alignState(),this.numeric?(t=Pt`
|
|
1878
1878
|
<decidables-spinner class="d bottom" ?disabled=${!this.interactive} step=".001" .value="${this.d}" @input=${this.dInput.bind(this)}>
|
|
1879
1879
|
<var class="math-var">d′</var>
|
|
1880
1880
|
</decidables-spinner>
|
|
1881
|
-
`,e=
|
|
1881
|
+
`,e=Pt`
|
|
1882
1882
|
<decidables-spinner class="c bottom" ?disabled=${!this.interactive} step=".001" .value="${this.c}" @input=${this.cInput.bind(this)}>
|
|
1883
1883
|
<var class="math-var">c</var>
|
|
1884
1884
|
</decidables-spinner>
|
|
1885
|
-
`,r=
|
|
1885
|
+
`,r=Pt`
|
|
1886
1886
|
<decidables-spinner class="s bottom" ?disabled=${!this.interactive} min="0" step=".001" .value="${this.s}" @input=${this.sInput.bind(this)}>
|
|
1887
1887
|
<var class="math-var">σ</var>
|
|
1888
1888
|
</decidables-spinner>
|
|
1889
|
-
`,n=
|
|
1889
|
+
`,n=Pt`
|
|
1890
1890
|
<decidables-spinner class="far bottom" disabled min="0" max="1" step=".001" .value="${+this.far.toFixed(3)}">
|
|
1891
1891
|
<var>False Alarm Rate</var>
|
|
1892
1892
|
</decidables-spinner>
|
|
1893
|
-
`):(t=
|
|
1893
|
+
`):(t=Pt`<var class="math-var d">d′</var>`,e=Pt`<var class="math-var c">c</var>`,r=Pt`<var class="math-var s">σ</var>`,n=Pt`<var class="far">False Alarm Rate</var>`),i=this.unequal?Pt`
|
|
1894
1894
|
<tr>
|
|
1895
1895
|
<td rowspan="2">
|
|
1896
1896
|
${n}<span class="equals">=</span><var class="math-greek phi tight">Φ</var><span class="paren tight">(</span><span class="bracket tight">[</span>
|
|
@@ -1915,7 +1915,7 @@ const Ho=t=>null!=t?t:z;customElements.define("decidables-slider",class extends
|
|
|
1915
1915
|
<td>
|
|
1916
1916
|
<span><span>1</span><span class="plus">+</span>${r}</span>
|
|
1917
1917
|
</td>
|
|
1918
|
-
</tr>`:
|
|
1918
|
+
</tr>`:Pt`
|
|
1919
1919
|
<tr>
|
|
1920
1920
|
<td rowspan="2">
|
|
1921
1921
|
${n}<span class="equals">=</span><var class="math-greek phi tight">Φ</var><span class="paren tight">(</span><span class="minus tight">−</span>
|
|
@@ -1931,30 +1931,30 @@ const Ho=t=>null!=t?t:z;customElements.define("decidables-slider",class extends
|
|
|
1931
1931
|
<td>
|
|
1932
1932
|
<span>2</span>
|
|
1933
1933
|
</td>
|
|
1934
|
-
</tr>`,
|
|
1934
|
+
</tr>`,Pt`
|
|
1935
1935
|
<div class="holder">
|
|
1936
1936
|
<table class="equation">
|
|
1937
1937
|
<tbody>
|
|
1938
1938
|
${i}
|
|
1939
1939
|
</tbody>
|
|
1940
1940
|
</table>
|
|
1941
|
-
</div>`}}customElements.define("sdt-equation-dc2far",
|
|
1941
|
+
</div>`}}customElements.define("sdt-equation-dc2far",nl);class il extends rl{static get properties(){return{unequal:{attribute:"unequal",type:Boolean,reflect:!0},d:{attribute:"d",type:Number,reflect:!0},c:{attribute:"c",type:Number,reflect:!0},s:{attribute:"s",type:Number,reflect:!0},hr:{attribute:!1,type:Number,reflect:!1}}}constructor(){super(),this.unequal=!1,this.d=0,this.c=0,this.s=1,this.alignState()}alignState(){this.hr=Zo.dC2Hr(this.d,this.c,this.s)}sendEvent(){this.dispatchEvent(new CustomEvent("sdt-equation-dc2hr-change",{detail:{d:this.d,c:this.c,s:this.s,hr:this.hr},bubbles:!0}))}dInput(t){this.d=parseFloat(t.target.value),this.alignState(),this.sendEvent()}cInput(t){this.c=parseFloat(t.target.value),this.alignState(),this.sendEvent()}sInput(t){this.s=parseFloat(t.target.value),this.alignState(),this.sendEvent()}render(){let t,e,r,n,i;return this.alignState(),this.numeric?(t=Pt`
|
|
1942
1942
|
<decidables-spinner class="d bottom" ?disabled=${!this.interactive} step=".001" .value="${this.d}" @input=${this.dInput.bind(this)}>
|
|
1943
1943
|
<var class="math-var">d′</var>
|
|
1944
1944
|
</decidables-spinner>
|
|
1945
|
-
`,e=
|
|
1945
|
+
`,e=Pt`
|
|
1946
1946
|
<decidables-spinner class="c bottom" ?disabled=${!this.interactive} step=".001" .value="${this.c}" @input=${this.cInput.bind(this)}>
|
|
1947
1947
|
<var class="math-var">c</var>
|
|
1948
1948
|
</decidables-spinner>
|
|
1949
|
-
`,r=
|
|
1949
|
+
`,r=Pt`
|
|
1950
1950
|
<decidables-spinner class="s bottom" ?disabled=${!this.interactive} min="0" step=".001" .value="${this.s}" @input=${this.sInput.bind(this)}>
|
|
1951
1951
|
<var class="math-var">σ</var>
|
|
1952
1952
|
</decidables-spinner>
|
|
1953
|
-
`,n=
|
|
1953
|
+
`,n=Pt`
|
|
1954
1954
|
<decidables-spinner class="hr bottom" disabled min="0" max="1" step=".001" .value="${+this.hr.toFixed(3)}">
|
|
1955
1955
|
<var>Hit Rate</var>
|
|
1956
1956
|
</decidables-spinner>
|
|
1957
|
-
`):(t=
|
|
1957
|
+
`):(t=Pt`<var class="math-var d">d′</var>`,e=Pt`<var class="math-var c">c</var>`,r=Pt`<var class="math-var s">σ</var>`,n=Pt`<var class="hr">Hit Rate</var>`),i=this.unequal?Pt`
|
|
1958
1958
|
<tr>
|
|
1959
1959
|
<td rowspan="2">
|
|
1960
1960
|
${n}<span class="equals">=</span><var class="math-greek phi tight">Φ</var><span class="paren tight">(</span><span class="bracket tight">[</span>
|
|
@@ -1988,7 +1988,7 @@ const Ho=t=>null!=t?t:z;customElements.define("decidables-slider",class extends
|
|
|
1988
1988
|
<td>
|
|
1989
1989
|
${r}
|
|
1990
1990
|
</td>
|
|
1991
|
-
</tr>`:
|
|
1991
|
+
</tr>`:Pt`
|
|
1992
1992
|
<tr>
|
|
1993
1993
|
<td rowspan="2">
|
|
1994
1994
|
${n}<span class="equals">=</span><var class="math-greek phi tight">Φ</var><span class="paren tight">(</span>
|
|
@@ -2004,26 +2004,26 @@ const Ho=t=>null!=t?t:z;customElements.define("decidables-slider",class extends
|
|
|
2004
2004
|
<td>
|
|
2005
2005
|
<span>2</span>
|
|
2006
2006
|
</td>
|
|
2007
|
-
</tr>`,
|
|
2007
|
+
</tr>`,Pt`
|
|
2008
2008
|
<div class="holder">
|
|
2009
2009
|
<table class="equation">
|
|
2010
2010
|
<tbody>
|
|
2011
2011
|
${i}
|
|
2012
2012
|
</tbody>
|
|
2013
2013
|
</table>
|
|
2014
|
-
</div>`}}customElements.define("sdt-equation-dc2hr",
|
|
2014
|
+
</div>`}}customElements.define("sdt-equation-dc2hr",il);class sl extends rl{static get properties(){return{fa:{attribute:"false-alarms",type:Number,reflect:!0},cr:{attribute:"correct-rejections",type:Number,reflect:!0},far:{attribute:!1,type:Number,reflect:!1}}}constructor(){super(),this.fa=0,this.cr=0,this.alignState()}alignState(){this.far=Zo.faCr2Far(this.fa,this.cr)}sendEvent(){this.dispatchEvent(new CustomEvent("sdt-equation-facr2far-change",{detail:{fa:this.fa,cr:this.cr,far:this.far},bubbles:!0}))}faInput(t){this.fa=parseInt(t.target.value,10),this.alignState(),this.sendEvent()}crInput(t){this.cr=parseInt(t.target.value,10),this.alignState(),this.sendEvent()}render(){let t,e,r;return this.alignState(),this.numeric?(t=Pt`
|
|
2015
2015
|
<decidables-spinner class="fa" ?disabled=${!this.interactive} min="0" .value="${this.fa}" @input=${this.faInput.bind(this)}>
|
|
2016
2016
|
<var>False Alarms</var>
|
|
2017
2017
|
</decidables-spinner>
|
|
2018
|
-
`,e=
|
|
2018
|
+
`,e=Pt`
|
|
2019
2019
|
<decidables-spinner class="cr" ?disabled=${!this.interactive} min="0" .value="${this.cr}" @input=${this.crInput.bind(this)}>
|
|
2020
2020
|
<var>Correct Rejections</var>
|
|
2021
2021
|
</decidables-spinner>
|
|
2022
|
-
`,r=
|
|
2022
|
+
`,r=Pt`
|
|
2023
2023
|
<decidables-spinner class="far" disabled min="0" max="1" step=".001" .value="${+this.far.toFixed(3)}">
|
|
2024
2024
|
<var>False Alarm Rate</var>
|
|
2025
2025
|
</decidables-spinner>
|
|
2026
|
-
`):(t=
|
|
2026
|
+
`):(t=Pt`<var class="fa">False Alarms</var>`,e=Pt`<var class="cr">Correct Rejections</var>`,r=Pt`<var class="far">False Alarm Rate</var>`),Pt`
|
|
2027
2027
|
<div class="holder">
|
|
2028
2028
|
<table class="equation">
|
|
2029
2029
|
<tbody>
|
|
@@ -2042,19 +2042,19 @@ const Ho=t=>null!=t?t:z;customElements.define("decidables-slider",class extends
|
|
|
2042
2042
|
</tr>
|
|
2043
2043
|
</tbody>
|
|
2044
2044
|
</table>
|
|
2045
|
-
</div>`}}customElements.define("sdt-equation-facr2far",
|
|
2045
|
+
</div>`}}customElements.define("sdt-equation-facr2far",sl);class al extends rl{static get properties(){return{h:{attribute:"hits",type:Number,reflect:!0},fa:{attribute:"false-alarms",type:Number,reflect:!0},ppv:{attribute:!1,type:Number,reflect:!1}}}constructor(){super(),this.h=0,this.fa=0,this.alignState()}alignState(){this.ppv=Zo.hFa2Ppv(this.h,this.fa)}sendEvent(){this.dispatchEvent(new CustomEvent("sdt-equation-hfa2ppv-change",{detail:{h:this.h,fa:this.fa,ppv:this.ppv},bubbles:!0}))}hInput(t){this.h=parseInt(t.target.value,10),this.alignState(),this.sendEvent()}faInput(t){this.fa=parseInt(t.target.value,10),this.alignState(),this.sendEvent()}render(){let t,e,r;return this.alignState(),this.numeric?(t=Pt`
|
|
2046
2046
|
<decidables-spinner class="h" ?disabled=${!this.interactive} min="0" .value="${this.h}" @input=${this.hInput.bind(this)}>
|
|
2047
2047
|
<var>Hits</var>
|
|
2048
2048
|
</decidables-spinner>
|
|
2049
|
-
`,e=
|
|
2049
|
+
`,e=Pt`
|
|
2050
2050
|
<decidables-spinner class="fa" ?disabled=${!this.interactive} min="0" .value="${this.fa}" @input=${this.faInput.bind(this)}>
|
|
2051
2051
|
<var>False Alarms</var>
|
|
2052
2052
|
</decidables-spinner>
|
|
2053
|
-
`,r=
|
|
2053
|
+
`,r=Pt`
|
|
2054
2054
|
<decidables-spinner class="ppv" disabled min="0" max="1" step=".001" .value="${+this.ppv.toFixed(3)}">
|
|
2055
2055
|
<var>Positive Predictive Value</var>
|
|
2056
2056
|
</decidables-spinner>
|
|
2057
|
-
`):(t=
|
|
2057
|
+
`):(t=Pt`<var class="h">Hits</var>`,e=Pt`<var class="fa">False Alarms</var>`,r=Pt`<var class="ppv">Positive Predictive Value</var>`),Pt`
|
|
2058
2058
|
<div class="holder">
|
|
2059
2059
|
<table class="equation">
|
|
2060
2060
|
<tbody>
|
|
@@ -2074,19 +2074,19 @@ const Ho=t=>null!=t?t:z;customElements.define("decidables-slider",class extends
|
|
|
2074
2074
|
</tbody>
|
|
2075
2075
|
</table>
|
|
2076
2076
|
</div>
|
|
2077
|
-
`}}customElements.define("sdt-equation-hfa2ppv",
|
|
2077
|
+
`}}customElements.define("sdt-equation-hfa2ppv",al);class ol extends rl{static get properties(){return{h:{attribute:"hits",type:Number,reflect:!0},m:{attribute:"misses",type:Number,reflect:!0},hr:{attribute:!1,type:Number,reflect:!1}}}constructor(){super(),this.h=0,this.m=0,this.alignState()}alignState(){this.hr=Zo.hM2Hr(this.h,this.m)}sendEvent(){this.dispatchEvent(new CustomEvent("sdt-equation-hm2hr-change",{detail:{h:this.h,m:this.m,hr:this.hr},bubbles:!0}))}hInput(t){this.h=parseInt(t.target.value,10),this.alignState(),this.sendEvent()}mInput(t){this.m=parseInt(t.target.value,10),this.alignState(),this.sendEvent()}render(){let t,e,r;return this.alignState(),this.numeric?(t=Pt`
|
|
2078
2078
|
<decidables-spinner class="h" ?disabled=${!this.interactive} min="0" .value="${this.h}" @input=${this.hInput.bind(this)}>
|
|
2079
2079
|
<var>Hits</var>
|
|
2080
2080
|
</decidables-spinner>
|
|
2081
|
-
`,e=
|
|
2081
|
+
`,e=Pt`
|
|
2082
2082
|
<decidables-spinner class="m" ?disabled=${!this.interactive} min="0" .value="${this.m}" @input=${this.mInput.bind(this)}>
|
|
2083
2083
|
<var>Misses</var>
|
|
2084
2084
|
</decidables-spinner>
|
|
2085
|
-
`,r=
|
|
2085
|
+
`,r=Pt`
|
|
2086
2086
|
<decidables-spinner class="hr" disabled min="0" max="1" step=".001" .value="${+this.hr.toFixed(3)}">
|
|
2087
2087
|
<var>Hit Rate</var>
|
|
2088
2088
|
</decidables-spinner>
|
|
2089
|
-
`):(t=
|
|
2089
|
+
`):(t=Pt`<var class="h">Hits</var>`,e=Pt`<var class="m">Misses</var>`,r=Pt`<var class="hr">Hit Rate</var>`),Pt`
|
|
2090
2090
|
<div class="holder">
|
|
2091
2091
|
<table class="equation">
|
|
2092
2092
|
<tbody>
|
|
@@ -2106,27 +2106,27 @@ const Ho=t=>null!=t?t:z;customElements.define("decidables-slider",class extends
|
|
|
2106
2106
|
</tbody>
|
|
2107
2107
|
</table>
|
|
2108
2108
|
</div>
|
|
2109
|
-
`}}customElements.define("sdt-equation-hm2hr",
|
|
2109
|
+
`}}customElements.define("sdt-equation-hm2hr",ol);class ll extends rl{static get properties(){return{h:{attribute:"hits",type:Number,reflect:!0},m:{attribute:"misses",type:Number,reflect:!0},fa:{attribute:"false-alarms",type:Number,reflect:!0},cr:{attribute:"correct-rejections",type:Number,reflect:!0},acc:{attribute:!1,type:Number,reflect:!1}}}constructor(){super(),this.h=0,this.m=0,this.fa=0,this.cr=0,this.alignState()}alignState(){this.acc=Zo.hMFaCr2Acc(this.h,this.m,this.fa,this.cr)}sendEvent(){this.dispatchEvent(new CustomEvent("sdt-equation-hmfacr2acc-change",{detail:{h:this.h,m:this.m,fa:this.fa,cr:this.cr,acc:this.acc},bubbles:!0}))}hInput(t){this.h=parseInt(t.target.value,10),this.alignState(),this.sendEvent()}mInput(t){this.m=parseInt(t.target.value,10),this.alignState(),this.sendEvent()}faInput(t){this.fa=parseInt(t.target.value,10),this.alignState(),this.sendEvent()}crInput(t){this.cr=parseInt(t.target.value,10),this.alignState(),this.sendEvent()}render(){let t,e,r,n,i;return this.alignState(),this.numeric?(t=Pt`
|
|
2110
2110
|
<decidables-spinner class="h" ?disabled=${!this.interactive} min="0" .value="${this.h}" @input=${this.hInput.bind(this)}>
|
|
2111
2111
|
<var>Hits</var>
|
|
2112
2112
|
</decidables-spinner>
|
|
2113
|
-
`,e=
|
|
2113
|
+
`,e=Pt`
|
|
2114
2114
|
<decidables-spinner class="m" ?disabled=${!this.interactive} min="0" .value="${this.m}" @input=${this.mInput.bind(this)}>
|
|
2115
2115
|
<var>Misses</var>
|
|
2116
2116
|
</decidables-spinner>
|
|
2117
|
-
`,r=
|
|
2117
|
+
`,r=Pt`
|
|
2118
2118
|
<decidables-spinner class="fa" ?disabled=${!this.interactive} min="0" .value="${this.fa}" @input=${this.faInput.bind(this)}>
|
|
2119
2119
|
<var>False Alarms</var>
|
|
2120
2120
|
</decidables-spinner>
|
|
2121
|
-
`,n=
|
|
2121
|
+
`,n=Pt`
|
|
2122
2122
|
<decidables-spinner class="cr" ?disabled=${!this.interactive} min="0" .value="${this.cr}" @input=${this.crInput.bind(this)}>
|
|
2123
2123
|
<var>Correct Rejections</var>
|
|
2124
2124
|
</decidables-spinner>
|
|
2125
|
-
`,i=
|
|
2125
|
+
`,i=Pt`
|
|
2126
2126
|
<decidables-spinner class="acc" disabled min="0" max="1" step=".001" .value="${+this.acc.toFixed(3)}">
|
|
2127
2127
|
<var>Accuracy</var>
|
|
2128
2128
|
</decidables-spinner>
|
|
2129
|
-
`):(t=
|
|
2129
|
+
`):(t=Pt`<var class="h">Hits</var>`,e=Pt`<var class="m">Misses</var>`,r=Pt`<var class="fa">False Alarms</var>`,n=Pt`<var class="cr">Correct Rejections</var>`,i=Pt`<var class="acc">Accuracy</var>`),Pt`
|
|
2130
2130
|
<div class="holder">
|
|
2131
2131
|
<table class="equation">
|
|
2132
2132
|
<tbody>
|
|
@@ -2145,23 +2145,23 @@ const Ho=t=>null!=t?t:z;customElements.define("decidables-slider",class extends
|
|
|
2145
2145
|
</tr>
|
|
2146
2146
|
</tbody>
|
|
2147
2147
|
</table>
|
|
2148
|
-
</div>`}}customElements.define("sdt-equation-hmfacr2acc",
|
|
2148
|
+
</div>`}}customElements.define("sdt-equation-hmfacr2acc",ll);class cl extends rl{static get properties(){return{unequal:{attribute:"unequal",type:Boolean,reflect:!0},hr:{attribute:"hit-rate",type:Number,reflect:!0},far:{attribute:"false-alarm-rate",type:Number,reflect:!0},s:{attribute:"s",type:Number,reflect:!0},c:{attribute:!1,type:Number,reflect:!1}}}constructor(){super(),this.unequal=!1,this.hr=0,this.far=0,this.s=1,this.alignState()}alignState(){this.c=Zo.hrFar2C(this.hr,this.far,this.s)}sendEvent(){this.dispatchEvent(new CustomEvent("sdt-equation-hrfar2c-change",{detail:{hr:this.hr,far:this.far,s:this.s,c:this.c},bubbles:!0}))}hrInput(t){this.hr=parseFloat(t.target.value),this.alignState(),this.sendEvent()}farInput(t){this.far=parseFloat(t.target.value),this.alignState(),this.sendEvent()}sInput(t){this.s=parseFloat(t.target.value),this.alignState(),this.sendEvent()}render(){let t,e,r,n,i;return this.alignState(),this.numeric?(t=Pt`
|
|
2149
2149
|
<decidables-spinner class="hr bottom" ?disabled=${!this.interactive} min="0" max="1" step=".001" .value="${this.hr}" @input=${this.hrInput.bind(this)}>
|
|
2150
2150
|
<var>Hit Rate</var>
|
|
2151
2151
|
</decidables-spinner>
|
|
2152
|
-
`,e=
|
|
2152
|
+
`,e=Pt`
|
|
2153
2153
|
<decidables-spinner class="far bottom" ?disabled=${!this.interactive} min="0" max="1" step=".001" .value="${this.far}" @input=${this.farInput.bind(this)}>
|
|
2154
2154
|
<var>False Alarm Rate</var>
|
|
2155
2155
|
</decidables-spinner>
|
|
2156
|
-
`,r=
|
|
2156
|
+
`,r=Pt`
|
|
2157
2157
|
<decidables-spinner class="s bottom" ?disabled=${!this.interactive} min="0" step=".001" .value="${this.s}" @input=${this.sInput.bind(this)}>
|
|
2158
2158
|
<var class="math-var">σ</var>
|
|
2159
2159
|
</decidables-spinner>
|
|
2160
|
-
`,n=
|
|
2160
|
+
`,n=Pt`
|
|
2161
2161
|
<decidables-spinner class="c bottom" disabled step=".001" .value="${+this.c.toFixed(3)}">
|
|
2162
2162
|
<var class="math-var">c</var>
|
|
2163
2163
|
</decidables-spinner>
|
|
2164
|
-
`):(t=
|
|
2164
|
+
`):(t=Pt`<var class="hr">Hit Rate</var>`,e=Pt`<var class="far">False Alarm Rate</var>`,r=Pt`<var class="math-var s">σ</var>`,n=Pt`<var class="math-var c">c</var>`),i=this.unequal?Pt`
|
|
2165
2165
|
<tr>
|
|
2166
2166
|
<td rowspan="2">
|
|
2167
2167
|
${n}<span class="equals">=</span><span class="bracket tight">(</span>
|
|
@@ -2186,7 +2186,7 @@ const Ho=t=>null!=t?t:z;customElements.define("decidables-slider",class extends
|
|
|
2186
2186
|
<td>
|
|
2187
2187
|
<span><span>1</span><span class="plus">+</span>${r}</span>
|
|
2188
2188
|
</td>
|
|
2189
|
-
</tr>`:
|
|
2189
|
+
</tr>`:Pt`
|
|
2190
2190
|
<tr>
|
|
2191
2191
|
<td rowspan="2">
|
|
2192
2192
|
${n}<span class="equals">=</span>
|
|
@@ -2199,30 +2199,30 @@ const Ho=t=>null!=t?t:z;customElements.define("decidables-slider",class extends
|
|
|
2199
2199
|
<td>
|
|
2200
2200
|
<span>2</span>
|
|
2201
2201
|
</td>
|
|
2202
|
-
</tr>`,
|
|
2202
|
+
</tr>`,Pt`
|
|
2203
2203
|
<div class="holder">
|
|
2204
2204
|
<table class="equation">
|
|
2205
2205
|
<tbody>
|
|
2206
2206
|
${i}
|
|
2207
2207
|
</tbody>
|
|
2208
2208
|
</table>
|
|
2209
|
-
</div>`}}customElements.define("sdt-equation-hrfar2c",
|
|
2209
|
+
</div>`}}customElements.define("sdt-equation-hrfar2c",cl);class hl extends rl{static get properties(){return{unequal:{attribute:"unequal",type:Boolean,reflect:!0},hr:{attribute:"hit-rate",type:Number,reflect:!0},far:{attribute:"false-alarm-rate",type:Number,reflect:!0},s:{attribute:"s",type:Number,reflect:!0},d:{attribute:!1,type:Number,reflect:!1}}}constructor(){super(),this.unequal=!1,this.hr=0,this.far=0,this.s=1,this.alignState()}alignState(){this.d=Zo.hrFar2D(this.hr,this.far,this.s)}sendEvent(){this.dispatchEvent(new CustomEvent("sdt-equation-hrfar2d-change",{detail:{hr:this.hr,far:this.far,s:this.s,d:this.d},bubbles:!0}))}hrInput(t){this.hr=parseFloat(t.target.value),this.alignState(),this.sendEvent()}farInput(t){this.far=parseFloat(t.target.value),this.alignState(),this.sendEvent()}sInput(t){this.s=parseFloat(t.target.value),this.alignState(),this.sendEvent()}render(){let t,e,r,n,i;return this.alignState(),this.numeric?(t=Pt`
|
|
2210
2210
|
<decidables-spinner class="hr bottom" ?disabled=${!this.interactive} min="0" max="1" step=".001" .value="${this.hr}" @input=${this.hrInput.bind(this)}>
|
|
2211
2211
|
<var>Hit Rate</var>
|
|
2212
2212
|
</decidables-spinner>
|
|
2213
|
-
`,e=
|
|
2213
|
+
`,e=Pt`
|
|
2214
2214
|
<decidables-spinner class="far bottom" ?disabled=${!this.interactive} min="0" max="1" step=".001" .value="${this.far}" @input=${this.farInput.bind(this)}>
|
|
2215
2215
|
<var>False Alarm Rate</var>
|
|
2216
2216
|
</decidables-spinner>
|
|
2217
|
-
`,r=
|
|
2217
|
+
`,r=Pt`
|
|
2218
2218
|
<decidables-spinner class="s bottom" ?disabled=${!this.interactive} min="0" step=".001" .value="${this.s}" @input=${this.sInput.bind(this)}>
|
|
2219
2219
|
<var class="math-var">σ</var>
|
|
2220
2220
|
</decidables-spinner>
|
|
2221
|
-
`,n=
|
|
2221
|
+
`,n=Pt`
|
|
2222
2222
|
<decidables-spinner class="d bottom" disabled step=".001" .value="${+this.d.toFixed(3)}">
|
|
2223
2223
|
<var class="math-var">d′</var>
|
|
2224
2224
|
</decidables-spinner>
|
|
2225
|
-
`):(t=
|
|
2225
|
+
`):(t=Pt`<var class="hr">Hit Rate</var>`,e=Pt`<var class="far">False Alarm Rate</var>`,r=Pt`<var class="math-var s">σ</var>`,n=Pt`<var class="math-var d">d′</var>`),i=this.unequal?Pt`
|
|
2226
2226
|
<tr>
|
|
2227
2227
|
<td rowspan="2">
|
|
2228
2228
|
${n}<span class="equals">=</span><span class="bracket tight">(</span>
|
|
@@ -2238,31 +2238,31 @@ const Ho=t=>null!=t?t:z;customElements.define("decidables-slider",class extends
|
|
|
2238
2238
|
<td>
|
|
2239
2239
|
<span>2</span>
|
|
2240
2240
|
</td>
|
|
2241
|
-
</tr>`:
|
|
2241
|
+
</tr>`:Pt`
|
|
2242
2242
|
<tr>
|
|
2243
2243
|
<td>
|
|
2244
2244
|
${n}<span class="equals">=</span><span class="tight"><var class="math-greek phi tight">Φ</var><sup class="exp">−1</sup></span><span class="paren tight">(</span>${t}<span class="paren tight">)</span><span class="minus">−</span><span class="tight"><var class="math-greek phi tight">Φ</var><sup class="exp">−1</sup></span><span class="paren tight">(</span>${e}<span class="paren tight">)</span>
|
|
2245
2245
|
</td>
|
|
2246
|
-
</tr>`,
|
|
2246
|
+
</tr>`,Pt`
|
|
2247
2247
|
<div class="holder">
|
|
2248
2248
|
<table class="equation">
|
|
2249
2249
|
<tbody>
|
|
2250
2250
|
${i}
|
|
2251
2251
|
</tbody>
|
|
2252
2252
|
</table>
|
|
2253
|
-
</div>`}}customElements.define("sdt-equation-hrfar2d",
|
|
2253
|
+
</div>`}}customElements.define("sdt-equation-hrfar2d",hl);class ul extends rl{static get properties(){return{m:{attribute:"misses",type:Number,reflect:!0},cr:{attribute:"correct-rejections",type:Number,reflect:!0},fomr:{attribute:!1,type:Number,reflect:!1}}}constructor(){super(),this.m=0,this.cr=0,this.alignState()}alignState(){this.fomr=Zo.mCr2Fomr(this.m,this.cr)}sendEvent(){this.dispatchEvent(new CustomEvent("sdt-equation-mcr2fomr-change",{detail:{m:this.m,cr:this.cr,fomr:this.fomr},bubbles:!0}))}mInput(t){this.m=parseInt(t.target.value,10),this.alignState(),this.sendEvent()}crInput(t){this.cr=parseInt(t.target.value,10),this.alignState(),this.sendEvent()}render(){let t,e,r;return this.alignState(),this.numeric?(t=Pt`
|
|
2254
2254
|
<decidables-spinner class="m" ?disabled=${!this.interactive} min="0" .value="${this.m}" @input=${this.mInput.bind(this)}>
|
|
2255
2255
|
<var>Misses</var>
|
|
2256
2256
|
</decidables-spinner>
|
|
2257
|
-
`,e=
|
|
2257
|
+
`,e=Pt`
|
|
2258
2258
|
<decidables-spinner class="cr" ?disabled=${!this.interactive} min="0" .value="${this.cr}" @input=${this.crInput.bind(this)}>
|
|
2259
2259
|
<var>Correct Rejections</var>
|
|
2260
2260
|
</decidables-spinner>
|
|
2261
|
-
`,r=
|
|
2261
|
+
`,r=Pt`
|
|
2262
2262
|
<decidables-spinner class="fomr" disabled min="0" max="1" step=".001" .value="${+this.fomr.toFixed(3)}">
|
|
2263
2263
|
<var>False Omission Rate</var>
|
|
2264
2264
|
</decidables-spinner>
|
|
2265
|
-
`):(t=
|
|
2265
|
+
`):(t=Pt`<var class="m">Misses</var>`,e=Pt`<var class="cr">Correct Rejections</var>`,r=Pt`<var class="fomr">False Omission Rate</var>`),Pt`
|
|
2266
2266
|
<div class="holder">
|
|
2267
2267
|
<table class="equation">
|
|
2268
2268
|
<tbody>
|
|
@@ -2282,7 +2282,7 @@ const Ho=t=>null!=t?t:z;customElements.define("decidables-slider",class extends
|
|
|
2282
2282
|
</tbody>
|
|
2283
2283
|
</table>
|
|
2284
2284
|
</div>
|
|
2285
|
-
`}}customElements.define("sdt-equation-mcr2fomr",
|
|
2285
|
+
`}}customElements.define("sdt-equation-mcr2fomr",ul);class dl extends Bo{static get styles(){return[super.styles,nt`
|
|
2286
2286
|
:host {
|
|
2287
2287
|
display: inline-block;
|
|
2288
2288
|
|
|
@@ -2326,10 +2326,10 @@ const Ho=t=>null!=t?t:z;customElements.define("decidables-slider",class extends
|
|
|
2326
2326
|
.body ::slotted(rdk-task) {
|
|
2327
2327
|
margin-left: 0;
|
|
2328
2328
|
}
|
|
2329
|
-
`]}render(){return
|
|
2329
|
+
`]}render(){return Pt`
|
|
2330
2330
|
<div class="holder">
|
|
2331
2331
|
<div class="body">
|
|
2332
2332
|
<slot>Empty!</slot>
|
|
2333
2333
|
</div>
|
|
2334
|
-
</div>`}}customElements.define("sdt-example",ol);class ll extends ol{firstUpdated(){this.one={},this.one.h=95,this.one.m=5,this.one.fa=35,this.one.cr=65,this.one.hr=Vo.hM2Hr(this.one.h,this.one.m),this.one.far=Vo.faCr2Far(this.one.fa,this.one.cr),this.one.d=Vo.hrFar2D(this.one.hr,this.one.far),this.one.c=Vo.hrFar2C(this.one.hr,this.one.far),this.two={},this.two.h=40,this.two.m=60,this.two.fa=20,this.two.cr=80,this.two.hr=Vo.hM2Hr(this.two.h,this.two.m),this.two.far=Vo.faCr2Far(this.two.fa,this.two.cr),this.two.d=Vo.hrFar2D(this.two.hr,this.two.far),this.two.c=Vo.hrFar2C(this.two.hr,this.two.far),this.detectableTableOne=this.querySelector("detectable-table:nth-of-type(1)"),this.detectableTableTwo=this.querySelector("detectable-table:nth-of-type(2)"),this.rocSpace=this.querySelector("roc-space"),this.sdtModelOne=this.querySelector("sdt-model:nth-of-type(1)"),this.sdtModelTwo=this.querySelector("sdt-model:nth-of-type(2)"),this.detectableTableOne&&(this.detectableTableOne.h=this.one.h,this.detectableTableOne.m=this.one.m,this.detectableTableOne.fa=this.one.fa,this.detectableTableOne.cr=this.one.cr,this.detectableTableOne.addEventListener("detectable-table-change",(t=>{this.rocSpace&&this.rocSpace.set(t.detail.hr,t.detail.far,"default","↑"),this.sdtModelOne&&(this.sdtModelOne.d=Vo.hrFar2D(t.detail.hr,t.detail.far),this.sdtModelOne.c=Vo.hrFar2C(t.detail.hr,t.detail.far))}))),this.detectableTableTwo&&(this.detectableTableTwo.h=this.two.h,this.detectableTableTwo.m=this.two.m,this.detectableTableTwo.fa=this.two.fa,this.detectableTableTwo.cr=this.two.cr,this.detectableTableTwo.addEventListener("detectable-table-change",(t=>{this.rocSpace&&this.rocSpace.set(t.detail.hr,t.detail.far,"two","↓"),this.sdtModelTwo&&(this.sdtModelTwo.d=Vo.hrFar2D(t.detail.hr,t.detail.far),this.sdtModelTwo.c=Vo.hrFar2C(t.detail.hr,t.detail.far))}))),this.rocSpace&&(this.rocSpace.set(this.one.hr,this.one.far,"default","↑"),this.rocSpace.set(this.two.hr,this.two.far,"two","↓"),this.rocSpace.addEventListener("roc-point-change",(t=>{if("default"===t.detail.name&&this.sdtModelOne?(this.sdtModelOne.d=t.detail.d,this.sdtModelOne.c=t.detail.c):"two"===t.detail.name&&this.sdtModelTwo&&(this.sdtModelTwo.d=t.detail.d,this.sdtModelTwo.c=t.detail.c),"default"===t.detail.name&&this.detectableTableOne){const e=Math.round((this.detectableTableOne.h+this.detectableTableOne.m)*t.detail.hr),r=this.detectableTableOne.h+this.detectableTableOne.m-e,n=Math.round((this.detectableTableOne.fa+this.detectableTableOne.cr)*t.detail.far),i=this.detectableTableOne.fa+this.detectableTableOne.cr-n;this.detectableTableOne.h=e,this.detectableTableOne.m=r,this.detectableTableOne.fa=n,this.detectableTableOne.cr=i}else if("two"===t.detail.name&&this.detectableTableTwo){const e=Math.round((this.detectableTableTwo.h+this.detectableTableTwo.m)*t.detail.hr),r=this.detectableTableTwo.h+this.detectableTableTwo.m-e,n=Math.round((this.detectableTableTwo.fa+this.detectableTableTwo.cr)*t.detail.far),i=this.detectableTableTwo.fa+this.detectableTableTwo.cr-n;this.detectableTableTwo.h=e,this.detectableTableTwo.m=r,this.detectableTableTwo.fa=n,this.detectableTableTwo.cr=i}}))),this.sdtModelOne&&(this.sdtModelOne.d=this.one.d,this.sdtModelOne.c=this.one.c,this.sdtModelOne.addEventListener("sdt-model-change",(t=>{if(this.rocSpace&&this.rocSpace.setWithSDT(t.detail.d,t.detail.c,"default","↑"),this.detectableTableOne){const e=Math.round((this.detectableTableOne.h+this.detectableTableOne.m)*t.detail.hr),r=this.detectableTableOne.h+this.detectableTableOne.m-e,n=Math.round((this.detectableTableOne.fa+this.detectableTableOne.cr)*t.detail.far),i=this.detectableTableOne.fa+this.detectableTableOne.cr-n;this.detectableTableOne.h=e,this.detectableTableOne.m=r,this.detectableTableOne.fa=n,this.detectableTableOne.cr=i}}))),this.sdtModelTwo&&(this.sdtModelTwo.d=this.two.d,this.sdtModelTwo.c=this.two.c,this.sdtModelTwo.addEventListener("sdt-model-change",(t=>{if(this.rocSpace&&this.rocSpace.setWithSDT(t.detail.d,t.detail.c,"two","↓"),this.detectableTableTwo){const e=Math.round((this.detectableTableTwo.h+this.detectableTableTwo.m)*t.detail.hr),r=this.detectableTableTwo.h+this.detectableTableTwo.m-e,n=Math.round((this.detectableTableTwo.fa+this.detectableTableTwo.cr)*t.detail.far),i=this.detectableTableTwo.fa+this.detectableTableTwo.cr-n;this.detectableTableTwo.h=e,this.detectableTableTwo.m=r,this.detectableTableTwo.fa=n,this.detectableTableTwo.cr=i}})))}}customElements.define("sdt-example-double-interactive",ll);class cl extends ol{firstUpdated(){this.count=1,this.detectableControl=this.querySelector("detectable-control"),this.rdkTask=this.querySelector("rdk-task"),this.detectableResponse=this.querySelector("detectable-response"),this.detectableTable=this.querySelector("detectable-table"),this.rocSpace=this.querySelector("roc-space"),this.sdtModel=this.querySelector("sdt-model"),this.rocSpace&&this.rocSpace.hasAttribute("history")&&this.rocSpace.set(.5,.5,"default",this.count),this.detectableControl&&this.detectableControl.hasAttribute("trials")&&this.detectableControl.addEventListener("detectable-control-trials",(t=>{this.rdkTask&&(this.rdkTask.trials=t.detail.trials),this.detectableResponse&&(this.detectableResponse.trialTotal=t.detail.trials)})),this.detectableControl&&this.detectableControl.hasAttribute("duration")&&this.detectableControl.addEventListener("detectable-control-duration",(t=>{this.rdkTask&&(this.rdkTask.duration=t.detail.duration,this.rdkTask.wait=t.detail.duration,this.rdkTask.iti=t.detail.duration)})),this.detectableControl&&this.detectableControl.hasAttribute("coherence")&&this.detectableControl.addEventListener("detectable-control-coherence",(t=>{this.rdkTask&&(this.rdkTask.coherence=t.detail.coherence)})),this.detectableControl&&this.detectableControl.hasAttribute("payoff")&&this.detectableControl.addEventListener("detectable-control-payoff",(t=>{this.detectableResponse&&(this.detectableResponse.hPayoff=t.detail.payoff,this.detectableResponse.mPayoff=0-t.detail.payoff,this.detectableResponse.faPayoff=0-(100-t.detail.payoff),this.detectableResponse.crPayoff=100-t.detail.payoff),this.detectableTable&&(this.detectableTable.hPayoff=t.detail.payoff,this.detectableTable.mPayoff=0-t.detail.payoff,this.detectableTable.faPayoff=0-(100-t.detail.payoff),this.detectableTable.crPayoff=100-t.detail.payoff)})),this.detectableControl&&this.detectableControl.hasAttribute("run")&&this.detectableControl.addEventListener("detectable-control-run",(()=>{this.rdkTask&&(this.rdkTask.running=!0)})),this.detectableControl&&this.detectableControl.hasAttribute("pause")&&this.detectableControl.addEventListener("detectable-control-pause",(()=>{this.rdkTask&&(this.rdkTask.running=!1)})),this.detectableControl&&this.detectableControl.hasAttribute("reset")&&this.detectableControl.addEventListener("detectable-control-reset",(()=>{this.rdkTask&&this.rdkTask.reset(),this.detectableResponse&&this.detectableResponse.reset(),this.detectableTable&&(this.detectableTable.h=0,this.detectableTable.m=0,this.detectableTable.fa=0,this.detectableTable.cr=0),this.rocSpace&&(this.rocSpace.hasAttribute("history")?(this.count+=1,this.rocSpace.set(.5,.5,`point${this.count}`,this.count)):(this.rocSpace.hr=.5,this.rocSpace.far=.5)),this.sdtModel&&(this.sdtModel.d=0,this.sdtModel.c=0)})),this.rdkTask&&this.detectableResponse&&(this.detectableResponse.trialTotal=this.rdkTask.trials),this.rdkTask&&this.rdkTask.addEventListener("rdk-trial-start",(t=>{this.detectableResponse&&this.detectableResponse.start(t.detail.signal,t.detail.trial)})),this.rdkTask&&this.rdkTask.addEventListener("rdk-trial-end",(()=>{this.detectableResponse&&this.detectableResponse.stop()})),this.rdkTask&&this.rdkTask.addEventListener("rdk-block-end",(()=>{this.detectableControl&&this.detectableControl.complete()})),this.detectableResponse&&this.detectableResponse.addEventListener("detectable-response",(t=>{this.detectableTable&&(this.detectableTable.h=t.detail.h,this.detectableTable.m=t.detail.m,this.detectableTable.fa=t.detail.fa,this.detectableTable.cr=t.detail.cr);const e=Vo.hM2Hr(t.detail.h+1,t.detail.m+1),r=Vo.faCr2Far(t.detail.fa+1,t.detail.cr+1);this.rocSpace&&(this.rocSpace.hasAttribute("history")?this.rocSpace.set(e,r,1===this.count?"default":`point${this.count}`,this.count):(this.rocSpace.hr=e,this.rocSpace.far=r)),this.sdtModel&&(this.sdtModel.d=Vo.hrFar2D(e,r),this.sdtModel.c=Vo.hrFar2C(e,r))}))}}customElements.define("sdt-example-human",cl);class hl extends ol{firstUpdated(){this.detectableControl=this.querySelector("detectable-control"),this.detectableTable=this.querySelector("detectable-table"),this.rocSpace=this.querySelector("roc-space"),this.sdtModel=this.querySelector("sdt-model"),this.rocSpaces=this.querySelectorAll("roc-space"),this.detectableControl&&this.detectableControl.hasAttribute("color")&&this.detectableControl.addEventListener("detectable-control-color",(t=>{this.sdtModel&&(this.sdtModel.color=t.detail.color),this.detectableTable&&(this.detectableTable.color=t.detail.color)})),this.detectableControl&&this.detectableControl.addEventListener("detectable-control-z-roc",(t=>{this.rocSpaces.length>0&&this.rocSpaces.forEach((e=>{e.zRoc=t.detail.zRoc}))})),this.detectableTable&&(this.rocSpace&&(this.rocSpace.hr=Vo.hM2Hr(this.detectableTable.h,this.detectableTable.m),this.rocSpace.far=Vo.faCr2Far(this.detectableTable.fa,this.detectableTable.cr)),this.sdtModel&&(this.sdtModel.d=Vo.hrFar2D(Vo.hM2Hr(this.detectableTable.h,this.detectableTable.m),Vo.faCr2Far(this.detectableTable.fa,this.detectableTable.cr),this.sdtModel.s),this.sdtModel.c=Vo.hrFar2C(Vo.hM2Hr(this.detectableTable.h,this.detectableTable.m),Vo.faCr2Far(this.detectableTable.fa,this.detectableTable.cr),this.sdtModel.s)),this.detectableTable.addEventListener("detectable-table-change",(t=>{this.rocSpace&&(this.rocSpace.far=t.detail.far,this.rocSpace.hr=t.detail.hr),this.sdtModel&&(this.sdtModel.d=Vo.hrFar2D(t.detail.hr,t.detail.far,this.sdtModel.s),this.sdtModel.c=Vo.hrFar2C(t.detail.hr,t.detail.far,this.sdtModel.s))}))),this.rocSpace&&(this.sdtModel&&!this.detectableTable&&(this.sdtModel.d=Vo.hrFar2D(this.rocSpace.hr,this.rocSpace.far,this.rocSpace.s),this.sdtModel.c=Vo.hrFar2C(this.rocSpace.hr,this.rocSpace.far,this.rocSpace.s),this.sdtModel.s=this.rocSpace.s),this.rocSpace.addEventListener("roc-point-change",(t=>{if(this.sdtModel&&(this.sdtModel.d=t.detail.d,this.sdtModel.c=t.detail.c,this.sdtModel.s=t.detail.s),this.detectableTable){const e=Math.round((this.detectableTable.h+this.detectableTable.m)*t.detail.hr),r=this.detectableTable.h+this.detectableTable.m-e,n=Math.round((this.detectableTable.fa+this.detectableTable.cr)*t.detail.far),i=this.detectableTable.fa+this.detectableTable.cr-n;this.detectableTable.h=e,this.detectableTable.m=r,this.detectableTable.fa=n,this.detectableTable.cr=i}}))),this.sdtModel&&this.sdtModel.addEventListener("sdt-model-change",(t=>{if(this.rocSpaces.length>0&&this.rocSpaces.forEach((e=>{e.setWithSDT(t.detail.d,t.detail.c,"default","",t.detail.s)})),this.detectableTable){const e=Math.round((this.detectableTable.h+this.detectableTable.m)*t.detail.hr),r=this.detectableTable.h+this.detectableTable.m-e,n=Math.round((this.detectableTable.fa+this.detectableTable.cr)*t.detail.far),i=this.detectableTable.fa+this.detectableTable.cr-n;this.detectableTable.h=e,this.detectableTable.m=r,this.detectableTable.fa=n,this.detectableTable.cr=i}}))}}customElements.define("sdt-example-interactive",hl);class ul extends ol{firstUpdated(){this.count=1,this.detectableControl=this.querySelector("detectable-control"),this.rdkTask=this.querySelector("rdk-task"),this.sdtModel=this.querySelector("sdt-model"),this.detectableResponse=this.querySelector("detectable-response"),this.detectableTable=this.querySelector("detectable-table"),this.rocSpace=this.querySelector("roc-space"),this.detectableControl&&this.detectableControl.hasAttribute("color")&&this.detectableControl.addEventListener("detectable-control-color",(t=>{this.sdtModel&&(this.sdtModel.color=t.detail.color),this.detectableTable&&(this.detectableTable.color=t.detail.color)})),this.detectableControl&&this.detectableControl.hasAttribute("duration")&&this.detectableControl.addEventListener("detectable-control-duration",(t=>{this.rdkTask&&(this.rdkTask.duration=t.detail.duration,this.rdkTask.wait=t.detail.duration,this.rdkTask.iti=t.detail.duration)})),this.detectableControl&&this.detectableControl.hasAttribute("trials")&&this.detectableControl.addEventListener("detectable-control-trials",(t=>{this.rdkTask&&(this.rdkTask.trials=t.detail.trials),this.detectableResponse&&(this.detectableResponse.trialTotal=t.detail.trials)})),this.detectableControl&&this.detectableControl.hasAttribute("coherence")&&this.detectableControl.addEventListener("detectable-control-coherence",(t=>{this.rdkTask&&(this.rdkTask.coherence=t.detail.coherence)})),this.detectableControl&&this.detectableControl.hasAttribute("run")&&this.detectableControl.addEventListener("detectable-control-run",(()=>{this.rdkTask&&(this.rdkTask.running=!0),this.sdtModel&&this.sdtModel.resumeTrial()})),this.detectableControl&&this.detectableControl.hasAttribute("pause")&&this.detectableControl.addEventListener("detectable-control-pause",(()=>{this.rdkTask&&(this.rdkTask.running=!1),this.sdtModel&&this.sdtModel.pauseTrial()})),this.detectableControl&&this.detectableControl.hasAttribute("reset")&&this.detectableControl.addEventListener("detectable-control-reset",(()=>{this.rdkTask&&this.rdkTask.reset(),this.detectableResponse&&this.detectableResponse.reset(),this.sdtModel&&this.sdtModel.reset(),this.detectableTable&&(this.detectableTable.h=0,this.detectableTable.m=0,this.detectableTable.fa=0,this.detectableTable.cr=0),this.rocSpace&&(this.rocSpace.hasAttribute("history")?(this.count+=1,this.rocSpace.set(.5,.5,`point${this.count}`,"",1)):(this.rocSpace.hr=.5,this.rocSpace.far=.5))})),this.rdkTask&&this.detectableResponse&&(this.detectableResponse.trialTotal=this.rdkTask.trials),this.rdkTask&&this.rdkTask.addEventListener("rdk-trial-start",(t=>{this.detectableResponse&&this.detectableResponse.start(t.detail.signal,t.detail.trial),this.sdtModel&&this.sdtModel.trial(t.detail.trial,t.detail.signal,t.detail.duration,t.detail.wait,t.detail.iti)})),this.rdkTask&&this.rdkTask.addEventListener("rdk-trial-middle",(()=>{})),this.rdkTask&&this.rdkTask.addEventListener("rdk-trial-end",(()=>{this.detectableResponse&&this.detectableResponse.stop()})),this.rdkTask&&this.rdkTask.addEventListener("rdk-block-end",(()=>{this.detectableControl&&this.detectableControl.complete()})),this.sdtModel&&this.sdtModel.addEventListener("detectable-response",(t=>{this.detectableResponse&&this.detectableResponse.responded(t.detail.response),this.detectableTable&&(this.detectableTable.h=t.detail.h,this.detectableTable.m=t.detail.m,this.detectableTable.fa=t.detail.fa,this.detectableTable.cr=t.detail.cr),this.rocSpace&&(this.rocSpace.hr=Vo.hM2Hr(t.detail.h,t.detail.m),this.rocSpace.far=Vo.faCr2Far(t.detail.fa,t.detail.cr))})),this.sdtModel&&this.sdtModel.addEventListener("sdt-model-change",(t=>{this.detectableTable&&(this.detectableTable.h=t.detail.h,this.detectableTable.m=t.detail.m,this.detectableTable.fa=t.detail.fa,this.detectableTable.cr=t.detail.cr),this.rocSpace&&(this.rocSpace.hr=Vo.hM2Hr(t.detail.h,t.detail.m),this.rocSpace.far=Vo.faCr2Far(t.detail.fa,t.detail.cr))}))}}customElements.define("sdt-example-model",ul);class dl extends ol{static get properties(){return{variable:{attribute:"variable",type:String,reflect:!0},values:{attribute:"values",converter:Uo,reflect:!0}}}constructor(){super(),this.variables=["d","c"],this.variable="d",this.values=[0,1]}firstUpdated(){this.detectableControl=this.querySelector("detectable-control"),this.rocSpace=this.querySelector("roc-space"),this.sdtModel=this.querySelector("sdt-model"),this.detectableControl&&this.detectableControl.addEventListener("detectable-control-z-roc",(t=>{this.rocSpace.zRoc=t.detail.zRoc})),this.rocSpace&&(this.rocSpace.setWithSDT(1,0,"default","",1),"d"===this.variable?this.values.forEach(((t,e)=>{this.rocSpace.setWithSDT(t,this.sdtModel.c,`point${e}`,e+1,this.sdtModel.s)})):"c"===this.variable&&this.values.forEach(((t,e)=>{this.rocSpace.setWithSDT(this.sdtModel.d,t,`point${e}`,e+1,this.sdtModel.s)}))),this.sdtModel&&this.sdtModel.addEventListener("sdt-model-change",(t=>{this.rocSpace&&(this.rocSpace.setWithSDT(t.detail.d,t.detail.c,"default","",t.detail.s),"d"===this.variable?this.values.forEach(((e,r)=>{this.rocSpace.setWithSDT(e,t.detail.c,`point${r}`,r+1,t.detail.s)})):"c"===this.variable&&this.values.forEach(((e,r)=>{this.rocSpace.setWithSDT(t.detail.d,e,`point${r}`,r+1,t.detail.s)})))}))}}customElements.define("sdt-example-multiple",dl);class pl extends ol{firstUpdated(){this.detectableControl=this.querySelector("detectable-control"),this.rocSpace=this.querySelector("roc-space"),this.sdtModel=this.querySelector("sdt-model"),this.detectableControl&&this.detectableControl.addEventListener("detectable-control-z-roc",(t=>{this.rocSpace.zRoc=t.detail.zRoc})),this.rocSpace&&(this.rocSpace.setWithSDT(1,0,"default","",1),ue(-1.5,1.6,.5).forEach(((t,e)=>{this.rocSpace.setWithSDT(this.sdtModel.d,t,`point${e}`,"",this.sdtModel.s)}))),this.sdtModel&&this.sdtModel.addEventListener("sdt-model-change",(t=>{this.rocSpace&&ue(-1.5,1.6,.5).forEach(((e,r)=>{this.rocSpace.setWithSDT(t.detail.d,e,`point${r}`,"",t.detail.s)}))}))}}customElements.define("sdt-example-unequal",pl),t.DetectableControl=Wo,t.DetectableElement=Io,t.DetectableResponse=Yo,t.DetectableTable=Zo,t.RDKTask=Lo,t.ROCSpace=Ko,t.SDTEquationDC2Far=Jo,t.SDTEquationDC2Hr=Qo,t.SDTEquationFaCr2Far=tl,t.SDTEquationHFa2Ppv=el,t.SDTEquationHM2Hr=rl,t.SDTEquationHMFaCr2Acc=nl,t.SDTEquationHrFar2C=il,t.SDTEquationHrFar2D=sl,t.SDTEquationMCr2Fomr=al,t.SDTExampleDoubleInteractive=ll,t.SDTExampleHuman=cl,t.SDTExampleInteractive=hl,t.SDTExampleModel=ul,t.SDTExampleMultiple=dl,t.SDTExampleUnequal=pl,t.SDTModel=Xo}));
|
|
2334
|
+
</div>`}}customElements.define("sdt-example",dl);class pl extends dl{firstUpdated(){this.one={},this.one.h=95,this.one.m=5,this.one.fa=35,this.one.cr=65,this.one.hr=Zo.hM2Hr(this.one.h,this.one.m),this.one.far=Zo.faCr2Far(this.one.fa,this.one.cr),this.one.d=Zo.hrFar2D(this.one.hr,this.one.far),this.one.c=Zo.hrFar2C(this.one.hr,this.one.far),this.two={},this.two.h=40,this.two.m=60,this.two.fa=20,this.two.cr=80,this.two.hr=Zo.hM2Hr(this.two.h,this.two.m),this.two.far=Zo.faCr2Far(this.two.fa,this.two.cr),this.two.d=Zo.hrFar2D(this.two.hr,this.two.far),this.two.c=Zo.hrFar2C(this.two.hr,this.two.far),this.detectableTableOne=this.querySelector("detectable-table:nth-of-type(1)"),this.detectableTableTwo=this.querySelector("detectable-table:nth-of-type(2)"),this.rocSpace=this.querySelector("roc-space"),this.sdtModelOne=this.querySelector("sdt-model:nth-of-type(1)"),this.sdtModelTwo=this.querySelector("sdt-model:nth-of-type(2)"),this.detectableTableOne&&(this.detectableTableOne.h=this.one.h,this.detectableTableOne.m=this.one.m,this.detectableTableOne.fa=this.one.fa,this.detectableTableOne.cr=this.one.cr,this.detectableTableOne.addEventListener("detectable-table-change",(t=>{this.rocSpace&&this.rocSpace.set(t.detail.hr,t.detail.far,"default","↑"),this.sdtModelOne&&(this.sdtModelOne.d=Zo.hrFar2D(t.detail.hr,t.detail.far),this.sdtModelOne.c=Zo.hrFar2C(t.detail.hr,t.detail.far))}))),this.detectableTableTwo&&(this.detectableTableTwo.h=this.two.h,this.detectableTableTwo.m=this.two.m,this.detectableTableTwo.fa=this.two.fa,this.detectableTableTwo.cr=this.two.cr,this.detectableTableTwo.addEventListener("detectable-table-change",(t=>{this.rocSpace&&this.rocSpace.set(t.detail.hr,t.detail.far,"two","↓"),this.sdtModelTwo&&(this.sdtModelTwo.d=Zo.hrFar2D(t.detail.hr,t.detail.far),this.sdtModelTwo.c=Zo.hrFar2C(t.detail.hr,t.detail.far))}))),this.rocSpace&&(this.rocSpace.set(this.one.hr,this.one.far,"default","↑"),this.rocSpace.set(this.two.hr,this.two.far,"two","↓"),this.rocSpace.addEventListener("roc-point-change",(t=>{if("default"===t.detail.name&&this.sdtModelOne?(this.sdtModelOne.d=t.detail.d,this.sdtModelOne.c=t.detail.c):"two"===t.detail.name&&this.sdtModelTwo&&(this.sdtModelTwo.d=t.detail.d,this.sdtModelTwo.c=t.detail.c),"default"===t.detail.name&&this.detectableTableOne){const e=Math.round((this.detectableTableOne.h+this.detectableTableOne.m)*t.detail.hr),r=this.detectableTableOne.h+this.detectableTableOne.m-e,n=Math.round((this.detectableTableOne.fa+this.detectableTableOne.cr)*t.detail.far),i=this.detectableTableOne.fa+this.detectableTableOne.cr-n;this.detectableTableOne.h=e,this.detectableTableOne.m=r,this.detectableTableOne.fa=n,this.detectableTableOne.cr=i}else if("two"===t.detail.name&&this.detectableTableTwo){const e=Math.round((this.detectableTableTwo.h+this.detectableTableTwo.m)*t.detail.hr),r=this.detectableTableTwo.h+this.detectableTableTwo.m-e,n=Math.round((this.detectableTableTwo.fa+this.detectableTableTwo.cr)*t.detail.far),i=this.detectableTableTwo.fa+this.detectableTableTwo.cr-n;this.detectableTableTwo.h=e,this.detectableTableTwo.m=r,this.detectableTableTwo.fa=n,this.detectableTableTwo.cr=i}}))),this.sdtModelOne&&(this.sdtModelOne.d=this.one.d,this.sdtModelOne.c=this.one.c,this.sdtModelOne.addEventListener("sdt-model-change",(t=>{if(this.rocSpace&&this.rocSpace.setWithSDT(t.detail.d,t.detail.c,"default","↑"),this.detectableTableOne){const e=Math.round((this.detectableTableOne.h+this.detectableTableOne.m)*t.detail.hr),r=this.detectableTableOne.h+this.detectableTableOne.m-e,n=Math.round((this.detectableTableOne.fa+this.detectableTableOne.cr)*t.detail.far),i=this.detectableTableOne.fa+this.detectableTableOne.cr-n;this.detectableTableOne.h=e,this.detectableTableOne.m=r,this.detectableTableOne.fa=n,this.detectableTableOne.cr=i}}))),this.sdtModelTwo&&(this.sdtModelTwo.d=this.two.d,this.sdtModelTwo.c=this.two.c,this.sdtModelTwo.addEventListener("sdt-model-change",(t=>{if(this.rocSpace&&this.rocSpace.setWithSDT(t.detail.d,t.detail.c,"two","↓"),this.detectableTableTwo){const e=Math.round((this.detectableTableTwo.h+this.detectableTableTwo.m)*t.detail.hr),r=this.detectableTableTwo.h+this.detectableTableTwo.m-e,n=Math.round((this.detectableTableTwo.fa+this.detectableTableTwo.cr)*t.detail.far),i=this.detectableTableTwo.fa+this.detectableTableTwo.cr-n;this.detectableTableTwo.h=e,this.detectableTableTwo.m=r,this.detectableTableTwo.fa=n,this.detectableTableTwo.cr=i}})))}}customElements.define("sdt-example-double-interactive",pl);class fl extends dl{firstUpdated(){this.count=1,this.detectableControl=this.querySelector("detectable-control"),this.rdkTask=this.querySelector("rdk-task"),this.detectableResponse=this.querySelector("detectable-response"),this.detectableTable=this.querySelector("detectable-table"),this.rocSpace=this.querySelector("roc-space"),this.sdtModel=this.querySelector("sdt-model"),this.rocSpace&&this.rocSpace.hasAttribute("history")&&this.rocSpace.set(.5,.5,"default",this.count),this.detectableControl&&this.detectableControl.hasAttribute("trials")&&this.detectableControl.addEventListener("detectable-control-trials",(t=>{this.rdkTask&&(this.rdkTask.trials=t.detail.trials),this.detectableResponse&&(this.detectableResponse.trialTotal=t.detail.trials)})),this.detectableControl&&this.detectableControl.hasAttribute("duration")&&this.detectableControl.addEventListener("detectable-control-duration",(t=>{this.rdkTask&&(this.rdkTask.duration=t.detail.duration,this.rdkTask.wait=t.detail.duration,this.rdkTask.iti=t.detail.duration)})),this.detectableControl&&this.detectableControl.hasAttribute("coherence")&&this.detectableControl.addEventListener("detectable-control-coherence",(t=>{this.rdkTask&&(this.rdkTask.coherence=t.detail.coherence)})),this.detectableControl&&this.detectableControl.hasAttribute("payoff")&&this.detectableControl.addEventListener("detectable-control-payoff",(t=>{this.detectableResponse&&(this.detectableResponse.hPayoff=t.detail.payoff,this.detectableResponse.mPayoff=0-t.detail.payoff,this.detectableResponse.faPayoff=0-(100-t.detail.payoff),this.detectableResponse.crPayoff=100-t.detail.payoff),this.detectableTable&&(this.detectableTable.hPayoff=t.detail.payoff,this.detectableTable.mPayoff=0-t.detail.payoff,this.detectableTable.faPayoff=0-(100-t.detail.payoff),this.detectableTable.crPayoff=100-t.detail.payoff)})),this.detectableControl&&this.detectableControl.hasAttribute("run")&&this.detectableControl.addEventListener("detectable-control-run",(()=>{this.rdkTask&&(this.rdkTask.running=!0)})),this.detectableControl&&this.detectableControl.hasAttribute("pause")&&this.detectableControl.addEventListener("detectable-control-pause",(()=>{this.rdkTask&&(this.rdkTask.running=!1)})),this.detectableControl&&this.detectableControl.hasAttribute("reset")&&this.detectableControl.addEventListener("detectable-control-reset",(()=>{this.rdkTask&&this.rdkTask.reset(),this.detectableResponse&&this.detectableResponse.reset(),this.detectableTable&&(this.detectableTable.h=0,this.detectableTable.m=0,this.detectableTable.fa=0,this.detectableTable.cr=0),this.rocSpace&&(this.rocSpace.hasAttribute("history")?(this.count+=1,this.rocSpace.set(.5,.5,`point${this.count}`,this.count)):(this.rocSpace.hr=.5,this.rocSpace.far=.5)),this.sdtModel&&(this.sdtModel.d=0,this.sdtModel.c=0)})),this.rdkTask&&this.detectableResponse&&(this.detectableResponse.trialTotal=this.rdkTask.trials),this.rdkTask&&this.rdkTask.addEventListener("rdk-trial-start",(t=>{this.detectableResponse&&this.detectableResponse.start(t.detail.signal,t.detail.trial)})),this.rdkTask&&this.rdkTask.addEventListener("rdk-trial-end",(()=>{this.detectableResponse&&this.detectableResponse.stop()})),this.rdkTask&&this.rdkTask.addEventListener("rdk-block-end",(()=>{this.detectableControl&&this.detectableControl.complete()})),this.detectableResponse&&this.detectableResponse.addEventListener("detectable-response",(t=>{this.detectableTable&&(this.detectableTable.h=t.detail.h,this.detectableTable.m=t.detail.m,this.detectableTable.fa=t.detail.fa,this.detectableTable.cr=t.detail.cr);const e=Zo.hM2Hr(t.detail.h+1,t.detail.m+1),r=Zo.faCr2Far(t.detail.fa+1,t.detail.cr+1);this.rocSpace&&(this.rocSpace.hasAttribute("history")?this.rocSpace.set(e,r,1===this.count?"default":`point${this.count}`,this.count):(this.rocSpace.hr=e,this.rocSpace.far=r)),this.sdtModel&&(this.sdtModel.d=Zo.hrFar2D(e,r),this.sdtModel.c=Zo.hrFar2C(e,r))}))}}customElements.define("sdt-example-human",fl);class ml extends dl{firstUpdated(){this.detectableControl=this.querySelector("detectable-control"),this.detectableTable=this.querySelector("detectable-table"),this.rocSpace=this.querySelector("roc-space"),this.sdtModel=this.querySelector("sdt-model"),this.rocSpaces=this.querySelectorAll("roc-space"),this.detectableControl&&this.detectableControl.hasAttribute("color")&&this.detectableControl.addEventListener("detectable-control-color",(t=>{this.sdtModel&&(this.sdtModel.color=t.detail.color),this.detectableTable&&(this.detectableTable.color=t.detail.color)})),this.detectableControl&&this.detectableControl.addEventListener("detectable-control-z-roc",(t=>{this.rocSpaces.length>0&&this.rocSpaces.forEach((e=>{e.zRoc=t.detail.zRoc}))})),this.detectableTable&&(this.rocSpace&&(this.rocSpace.hr=Zo.hM2Hr(this.detectableTable.h,this.detectableTable.m),this.rocSpace.far=Zo.faCr2Far(this.detectableTable.fa,this.detectableTable.cr)),this.sdtModel&&(this.sdtModel.d=Zo.hrFar2D(Zo.hM2Hr(this.detectableTable.h,this.detectableTable.m),Zo.faCr2Far(this.detectableTable.fa,this.detectableTable.cr),this.sdtModel.s),this.sdtModel.c=Zo.hrFar2C(Zo.hM2Hr(this.detectableTable.h,this.detectableTable.m),Zo.faCr2Far(this.detectableTable.fa,this.detectableTable.cr),this.sdtModel.s)),this.detectableTable.addEventListener("detectable-table-change",(t=>{this.rocSpace&&(this.rocSpace.far=t.detail.far,this.rocSpace.hr=t.detail.hr),this.sdtModel&&(this.sdtModel.d=Zo.hrFar2D(t.detail.hr,t.detail.far,this.sdtModel.s),this.sdtModel.c=Zo.hrFar2C(t.detail.hr,t.detail.far,this.sdtModel.s))}))),this.rocSpace&&(this.sdtModel&&!this.detectableTable&&(this.sdtModel.d=Zo.hrFar2D(this.rocSpace.hr,this.rocSpace.far,this.rocSpace.s),this.sdtModel.c=Zo.hrFar2C(this.rocSpace.hr,this.rocSpace.far,this.rocSpace.s),this.sdtModel.s=this.rocSpace.s),this.rocSpace.addEventListener("roc-point-change",(t=>{if(this.sdtModel&&(this.sdtModel.d=t.detail.d,this.sdtModel.c=t.detail.c,this.sdtModel.s=t.detail.s),this.detectableTable){const e=Math.round((this.detectableTable.h+this.detectableTable.m)*t.detail.hr),r=this.detectableTable.h+this.detectableTable.m-e,n=Math.round((this.detectableTable.fa+this.detectableTable.cr)*t.detail.far),i=this.detectableTable.fa+this.detectableTable.cr-n;this.detectableTable.h=e,this.detectableTable.m=r,this.detectableTable.fa=n,this.detectableTable.cr=i}}))),this.sdtModel&&this.sdtModel.addEventListener("sdt-model-change",(t=>{if(this.rocSpaces.length>0&&this.rocSpaces.forEach((e=>{e.setWithSDT(t.detail.d,t.detail.c,"default","",t.detail.s)})),this.detectableTable){const e=Math.round((this.detectableTable.h+this.detectableTable.m)*t.detail.hr),r=this.detectableTable.h+this.detectableTable.m-e,n=Math.round((this.detectableTable.fa+this.detectableTable.cr)*t.detail.far),i=this.detectableTable.fa+this.detectableTable.cr-n;this.detectableTable.h=e,this.detectableTable.m=r,this.detectableTable.fa=n,this.detectableTable.cr=i}}))}}customElements.define("sdt-example-interactive",ml);class bl extends dl{firstUpdated(){this.count=1,this.detectableControl=this.querySelector("detectable-control"),this.rdkTask=this.querySelector("rdk-task"),this.sdtModel=this.querySelector("sdt-model"),this.detectableResponse=this.querySelector("detectable-response"),this.detectableTable=this.querySelector("detectable-table"),this.rocSpace=this.querySelector("roc-space"),this.detectableControl&&this.detectableControl.hasAttribute("color")&&this.detectableControl.addEventListener("detectable-control-color",(t=>{this.sdtModel&&(this.sdtModel.color=t.detail.color),this.detectableTable&&(this.detectableTable.color=t.detail.color)})),this.detectableControl&&this.detectableControl.hasAttribute("duration")&&this.detectableControl.addEventListener("detectable-control-duration",(t=>{this.rdkTask&&(this.rdkTask.duration=t.detail.duration,this.rdkTask.wait=t.detail.duration,this.rdkTask.iti=t.detail.duration)})),this.detectableControl&&this.detectableControl.hasAttribute("trials")&&this.detectableControl.addEventListener("detectable-control-trials",(t=>{this.rdkTask&&(this.rdkTask.trials=t.detail.trials),this.detectableResponse&&(this.detectableResponse.trialTotal=t.detail.trials)})),this.detectableControl&&this.detectableControl.hasAttribute("coherence")&&this.detectableControl.addEventListener("detectable-control-coherence",(t=>{this.rdkTask&&(this.rdkTask.coherence=t.detail.coherence)})),this.detectableControl&&this.detectableControl.hasAttribute("run")&&this.detectableControl.addEventListener("detectable-control-run",(()=>{this.rdkTask&&(this.rdkTask.running=!0),this.sdtModel&&this.sdtModel.resumeTrial()})),this.detectableControl&&this.detectableControl.hasAttribute("pause")&&this.detectableControl.addEventListener("detectable-control-pause",(()=>{this.rdkTask&&(this.rdkTask.running=!1),this.sdtModel&&this.sdtModel.pauseTrial()})),this.detectableControl&&this.detectableControl.hasAttribute("reset")&&this.detectableControl.addEventListener("detectable-control-reset",(()=>{this.rdkTask&&this.rdkTask.reset(),this.detectableResponse&&this.detectableResponse.reset(),this.sdtModel&&this.sdtModel.reset(),this.detectableTable&&(this.detectableTable.h=0,this.detectableTable.m=0,this.detectableTable.fa=0,this.detectableTable.cr=0),this.rocSpace&&(this.rocSpace.hasAttribute("history")?(this.count+=1,this.rocSpace.set(.5,.5,`point${this.count}`,"",1)):(this.rocSpace.hr=.5,this.rocSpace.far=.5))})),this.rdkTask&&this.detectableResponse&&(this.detectableResponse.trialTotal=this.rdkTask.trials),this.rdkTask&&this.rdkTask.addEventListener("rdk-trial-start",(t=>{this.detectableResponse&&this.detectableResponse.start(t.detail.signal,t.detail.trial),this.sdtModel&&this.sdtModel.trial(t.detail.trial,t.detail.signal,t.detail.duration,t.detail.wait,t.detail.iti)})),this.rdkTask&&this.rdkTask.addEventListener("rdk-trial-middle",(()=>{})),this.rdkTask&&this.rdkTask.addEventListener("rdk-trial-end",(()=>{this.detectableResponse&&this.detectableResponse.stop()})),this.rdkTask&&this.rdkTask.addEventListener("rdk-block-end",(()=>{this.detectableControl&&this.detectableControl.complete()})),this.sdtModel&&this.sdtModel.addEventListener("detectable-response",(t=>{this.detectableResponse&&this.detectableResponse.responded(t.detail.response),this.detectableTable&&(this.detectableTable.h=t.detail.h,this.detectableTable.m=t.detail.m,this.detectableTable.fa=t.detail.fa,this.detectableTable.cr=t.detail.cr),this.rocSpace&&(this.rocSpace.hr=Zo.hM2Hr(t.detail.h,t.detail.m),this.rocSpace.far=Zo.faCr2Far(t.detail.fa,t.detail.cr))})),this.sdtModel&&this.sdtModel.addEventListener("sdt-model-change",(t=>{this.detectableTable&&(this.detectableTable.h=t.detail.h,this.detectableTable.m=t.detail.m,this.detectableTable.fa=t.detail.fa,this.detectableTable.cr=t.detail.cr),this.rocSpace&&(this.rocSpace.hr=Zo.hM2Hr(t.detail.h,t.detail.m),this.rocSpace.far=Zo.faCr2Far(t.detail.fa,t.detail.cr))}))}}customElements.define("sdt-example-model",bl);class vl extends dl{static get properties(){return{variable:{attribute:"variable",type:String,reflect:!0},values:{attribute:"values",converter:jo,reflect:!0}}}constructor(){super(),this.variables=["d","c"],this.variable="d",this.values=[0,1]}firstUpdated(){this.detectableControl=this.querySelector("detectable-control"),this.rocSpace=this.querySelector("roc-space"),this.sdtModel=this.querySelector("sdt-model"),this.detectableControl&&this.detectableControl.addEventListener("detectable-control-z-roc",(t=>{this.rocSpace.zRoc=t.detail.zRoc})),this.rocSpace&&(this.rocSpace.setWithSDT(1,0,"default","",1),"d"===this.variable?this.values.forEach(((t,e)=>{this.rocSpace.setWithSDT(t,this.sdtModel.c,`point${e}`,e+1,this.sdtModel.s)})):"c"===this.variable&&this.values.forEach(((t,e)=>{this.rocSpace.setWithSDT(this.sdtModel.d,t,`point${e}`,e+1,this.sdtModel.s)}))),this.sdtModel&&this.sdtModel.addEventListener("sdt-model-change",(t=>{this.rocSpace&&(this.rocSpace.setWithSDT(t.detail.d,t.detail.c,"default","",t.detail.s),"d"===this.variable?this.values.forEach(((e,r)=>{this.rocSpace.setWithSDT(e,t.detail.c,`point${r}`,r+1,t.detail.s)})):"c"===this.variable&&this.values.forEach(((e,r)=>{this.rocSpace.setWithSDT(t.detail.d,e,`point${r}`,r+1,t.detail.s)})))}))}}customElements.define("sdt-example-multiple",vl);class gl extends dl{firstUpdated(){this.detectableControl=this.querySelector("detectable-control"),this.rocSpace=this.querySelector("roc-space"),this.sdtModel=this.querySelector("sdt-model"),this.detectableControl&&this.detectableControl.addEventListener("detectable-control-z-roc",(t=>{this.rocSpace.zRoc=t.detail.zRoc})),this.rocSpace&&(this.rocSpace.setWithSDT(1,0,"default","",1),ge(-1.5,1.6,.5).forEach(((t,e)=>{this.rocSpace.setWithSDT(this.sdtModel.d,t,`point${e}`,"",this.sdtModel.s)}))),this.sdtModel&&this.sdtModel.addEventListener("sdt-model-change",(t=>{this.rocSpace&&ge(-1.5,1.6,.5).forEach(((e,r)=>{this.rocSpace.setWithSDT(t.detail.d,e,`point${r}`,"",t.detail.s)}))}))}}customElements.define("sdt-example-unequal",gl),t.DetectableControl=Jo,t.DetectableElement=Bo,t.DetectableResponse=tl,t.DetectableTable=el,t.RDKTask=Ko,t.ROCSpace=Go,t.SDTEquationDC2Far=nl,t.SDTEquationDC2Hr=il,t.SDTEquationFaCr2Far=sl,t.SDTEquationHFa2Ppv=al,t.SDTEquationHM2Hr=ol,t.SDTEquationHMFaCr2Acc=ll,t.SDTEquationHrFar2C=cl,t.SDTEquationHrFar2D=hl,t.SDTEquationMCr2Fomr=ul,t.SDTExampleDoubleInteractive=pl,t.SDTExampleHuman=fl,t.SDTExampleInteractive=ml,t.SDTExampleModel=bl,t.SDTExampleMultiple=vl,t.SDTExampleUnequal=gl,t.SDTModel=Qo}));
|
|
2335
2335
|
//# sourceMappingURL=detectableElements.umd.min.js.map
|