@decidables/detectable-elements 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/lib/detectableElements.esm.js +167 -210
- package/lib/detectableElements.esm.js.map +1 -1
- package/lib/detectableElements.esm.min.js +259 -290
- package/lib/detectableElements.esm.min.js.map +1 -1
- package/lib/detectableElements.umd.js +167 -210
- package/lib/detectableElements.umd.js.map +1 -1
- package/lib/detectableElements.umd.min.js +206 -237
- package/lib/detectableElements.umd.min.js.map +1 -1
- package/package.json +6 -5
- package/src/components/detectable-response.js +2 -0
- package/src/components/detectable-table.js +1 -0
- package/src/components/roc-space.js +5 -5
- package/src/components/sdt-model.js +7 -7
- package/src/components/sdt-parameters.js +2 -1
|
@@ -3,23 +3,23 @@
|
|
|
3
3
|
* @license
|
|
4
4
|
* Copyright 2019 Google LLC
|
|
5
5
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
6
|
-
*/const e=globalThis,r=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,n=Symbol(),
|
|
6
|
+
*/const e=globalThis,r=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,n=Symbol(),i=new WeakMap;let s=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==n)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(r&&void 0===t){const r=void 0!==e&&1===e.length;r&&(t=i.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&i.set(e,t))}return t}toString(){return this.cssText}};const a=t=>new s("string"==typeof t?t:t+"",void 0,n),o=(t,...e)=>{const r=1===t.length?t[0]:e.reduce((e,r,n)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+t[n+1],t[0]);return new s(r,t,n)},l=r?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const r of t.cssRules)e+=r.cssText;return a(e)})(t):t,{is:c,defineProperty:h,getOwnPropertyDescriptor:u,getOwnPropertyNames:d,getOwnPropertySymbols:f,getPrototypeOf:p}=Object,m=globalThis,b=m.trustedTypes,g=b?b.emptyScript:"",v=m.reactiveElementPolyfillSupport,y=(t,e)=>t,w={toAttribute(t,e){switch(e){case Boolean:t=t?g:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let r=t;switch(e){case Boolean:r=null!==t;break;case Number:r=null===t?null:Number(t);break;case Object:case Array:try{r=JSON.parse(t)}catch(t){r=null}}return r}},x=(t,e)=>!c(t,e),$={attribute:!0,type:String,converter:w,reflect:!1,useDefault:!1,hasChanged:x};
|
|
7
7
|
/**
|
|
8
8
|
* @license
|
|
9
9
|
* Copyright 2017 Google LLC
|
|
10
10
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
11
|
-
*/Symbol.metadata??=Symbol("metadata"),m.litPropertyMetadata??=new WeakMap;let
|
|
11
|
+
*/Symbol.metadata??=Symbol("metadata"),m.litPropertyMetadata??=new WeakMap;let k=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=$){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const r=Symbol(),n=this.getPropertyDescriptor(t,r,e);void 0!==n&&h(this.prototype,t,n)}}static getPropertyDescriptor(t,e,r){const{get:n,set:i}=u(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:n,set(e){const s=n?.call(this);i?.call(this,e),this.requestUpdate(t,s,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??$}static _$Ei(){if(this.hasOwnProperty(y("elementProperties")))return;const t=p(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(y("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(y("properties"))){const t=this.properties,e=[...d(t),...f(t)];for(const r of e)this.createProperty(r,t[r])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,r]of e)this.elementProperties.set(t,r)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const r=this._$Eu(t,e);void 0!==r&&this._$Eh.set(r,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const r=new Set(t.flat(1/0).reverse());for(const t of r)e.unshift(l(t))}else void 0!==t&&e.push(l(t));return e}static _$Eu(t,e){const r=e.attribute;return!1===r?void 0:"string"==typeof r?r:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const r of e.keys())this.hasOwnProperty(r)&&(t.set(r,this[r]),delete this[r]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((t,n)=>{if(r)t.adoptedStyleSheets=n.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const r of n){const n=document.createElement("style"),i=e.litNonce;void 0!==i&&n.setAttribute("nonce",i),n.textContent=r.cssText,t.appendChild(n)}})(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,r){this._$AK(t,r)}_$ET(t,e){const r=this.constructor.elementProperties.get(t),n=this.constructor._$Eu(t,r);if(void 0!==n&&!0===r.reflect){const i=(void 0!==r.converter?.toAttribute?r.converter:w).toAttribute(e,r.type);this._$Em=t,null==i?this.removeAttribute(n):this.setAttribute(n,i),this._$Em=null}}_$AK(t,e){const r=this.constructor,n=r._$Eh.get(t);if(void 0!==n&&this._$Em!==n){const t=r.getPropertyOptions(n),i="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:w;this._$Em=n;const s=i.fromAttribute(e,t.type);this[n]=s??this._$Ej?.get(n)??s,this._$Em=null}}requestUpdate(t,e,r){if(void 0!==t){const n=this.constructor,i=this[t];if(r??=n.getPropertyOptions(t),!((r.hasChanged??x)(i,e)||r.useDefault&&r.reflect&&i===this._$Ej?.get(t)&&!this.hasAttribute(n._$Eu(t,r))))return;this.C(t,e,r)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:r,reflect:n,wrapped:i},s){r&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,s??e??this[t]),!0!==i||void 0!==s)||(this._$AL.has(t)||(this.hasUpdated||r||(e=void 0),this._$AL.set(t,e)),!0===n&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,r]of t){const{wrapped:t}=r,n=this[e];!0!==t||this._$AL.has(e)||void 0===n||this.C(e,void 0,r,n)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(e)):this._$EM()}catch(e){throw t=!1,this._$EM(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(t){}firstUpdated(t){}};k.elementStyles=[],k.shadowRootOptions={mode:"open"},k[y("elementProperties")]=new Map,k[y("finalized")]=new Map,v?.({ReactiveElement:k}),(m.reactiveElementVersions??=[]).push("2.1.1");
|
|
12
12
|
/**
|
|
13
13
|
* @license
|
|
14
14
|
* Copyright 2017 Google LLC
|
|
15
15
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
16
16
|
*/
|
|
17
|
-
const _=globalThis,S=_.trustedTypes,M=S?S.createPolicy("lit-html",{createHTML:t=>t}):void 0,A="$lit$",E=`lit$${Math.random().toFixed(9).slice(2)}$`,N="?"+E,T=`<${N}>`,C=document,
|
|
17
|
+
const _=globalThis,S=_.trustedTypes,M=S?S.createPolicy("lit-html",{createHTML:t=>t}):void 0,A="$lit$",E=`lit$${Math.random().toFixed(9).slice(2)}$`,N="?"+E,T=`<${N}>`,C=document,P=()=>C.createComment(""),R=t=>null===t||"object"!=typeof t&&"function"!=typeof t,q=Array.isArray,F="[ \t\n\f\r]",z=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,O=/-->/g,I=/>/g,D=RegExp(`>|${F}(?:([^\\s"'>=/]+)(${F}*=${F}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),U=/'/g,j=/"/g,L=/^(?:script|style|textarea|title)$/i,H=t=>(e,...r)=>({_$litType$:t,strings:e,values:r}),V=H(1),B=H(2),X=Symbol.for("lit-noChange"),K=Symbol.for("lit-nothing"),Z=new WeakMap,W=C.createTreeWalker(C,129);function Y(t,e){if(!q(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==M?M.createHTML(e):e}const G=(t,e)=>{const r=t.length-1,n=[];let i,s=2===e?"<svg>":3===e?"<math>":"",a=z;for(let e=0;e<r;e++){const r=t[e];let o,l,c=-1,h=0;for(;h<r.length&&(a.lastIndex=h,l=a.exec(r),null!==l);)h=a.lastIndex,a===z?"!--"===l[1]?a=O:void 0!==l[1]?a=I:void 0!==l[2]?(L.test(l[2])&&(i=RegExp("</"+l[2],"g")),a=D):void 0!==l[3]&&(a=D):a===D?">"===l[0]?(a=i??z,c=-1):void 0===l[1]?c=-2:(c=a.lastIndex-l[2].length,o=l[1],a=void 0===l[3]?D:'"'===l[3]?j:U):a===j||a===U?a=D:a===O||a===I?a=z:(a=D,i=void 0);const u=a===D&&t[e+1].startsWith("/>")?" ":"";s+=a===z?r+T:c>=0?(n.push(o),r.slice(0,c)+A+r.slice(c)+E+u):r+E+(-2===c?e:u)}return[Y(t,s+(t[r]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),n]};class Q{constructor({strings:t,_$litType$:e},r){let n;this.parts=[];let i=0,s=0;const a=t.length-1,o=this.parts,[l,c]=G(t,e);if(this.el=Q.createElement(l,r),W.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(n=W.nextNode())&&o.length<a;){if(1===n.nodeType){if(n.hasAttributes())for(const t of n.getAttributeNames())if(t.endsWith(A)){const e=c[s++],r=n.getAttribute(t).split(E),a=/([.?@])?(.*)/.exec(e);o.push({type:1,index:i,name:a[2],strings:r,ctor:"."===a[1]?nt:"?"===a[1]?it:"@"===a[1]?st:rt}),n.removeAttribute(t)}else t.startsWith(E)&&(o.push({type:6,index:i}),n.removeAttribute(t));if(L.test(n.tagName)){const t=n.textContent.split(E),e=t.length-1;if(e>0){n.textContent=S?S.emptyScript:"";for(let r=0;r<e;r++)n.append(t[r],P()),W.nextNode(),o.push({type:2,index:++i});n.append(t[e],P())}}}else if(8===n.nodeType)if(n.data===N)o.push({type:2,index:i});else{let t=-1;for(;-1!==(t=n.data.indexOf(E,t+1));)o.push({type:7,index:i}),t+=E.length-1}i++}}static createElement(t,e){const r=C.createElement("template");return r.innerHTML=t,r}}function J(t,e,r=t,n){if(e===X)return e;let i=void 0!==n?r._$Co?.[n]:r._$Cl;const s=R(e)?void 0:e._$litDirective$;return i?.constructor!==s&&(i?._$AO?.(!1),void 0===s?i=void 0:(i=new s(t),i._$AT(t,r,n)),void 0!==n?(r._$Co??=[])[n]=i:r._$Cl=i),void 0!==i&&(e=J(t,i._$AS(t,e.values),i,n)),e}class tt{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:r}=this._$AD,n=(t?.creationScope??C).importNode(e,!0);W.currentNode=n;let i=W.nextNode(),s=0,a=0,o=r[0];for(;void 0!==o;){if(s===o.index){let e;2===o.type?e=new et(i,i.nextSibling,this,t):1===o.type?e=new o.ctor(i,o.name,o.strings,this,t):6===o.type&&(e=new at(i,this,t)),this._$AV.push(e),o=r[++a]}s!==o?.index&&(i=W.nextNode(),s++)}return W.currentNode=C,n}p(t){let e=0;for(const r of this._$AV)void 0!==r&&(void 0!==r.strings?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}}class et{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,r,n){this.type=2,this._$AH=K,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=n,this._$Cv=n?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t?.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=J(this,t,e),R(t)?t===K||null==t||""===t?(this._$AH!==K&&this._$AR(),this._$AH=K):t!==this._$AH&&t!==X&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>q(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==K&&R(this._$AH)?this._$AA.nextSibling.data=t:this.T(C.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:r}=t,n="number"==typeof r?this._$AC(t):(void 0===r.el&&(r.el=Q.createElement(Y(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===n)this._$AH.p(e);else{const t=new tt(n,this),r=t.u(this.options);t.p(e),this.T(r),this._$AH=t}}_$AC(t){let e=Z.get(t.strings);return void 0===e&&Z.set(t.strings,e=new Q(t)),e}k(t){q(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let r,n=0;for(const i of t)n===e.length?e.push(r=new et(this.O(P()),this.O(P()),this,this.options)):r=e[n],r._$AI(i),n++;n<e.length&&(this._$AR(r&&r._$AB.nextSibling,n),e.length=n)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class rt{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,n,i){this.type=1,this._$AH=K,this._$AN=void 0,this.element=t,this.name=e,this._$AM=n,this.options=i,r.length>2||""!==r[0]||""!==r[1]?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=K}_$AI(t,e=this,r,n){const i=this.strings;let s=!1;if(void 0===i)t=J(this,t,e,0),s=!R(t)||t!==this._$AH&&t!==X,s&&(this._$AH=t);else{const n=t;let a,o;for(t=i[0],a=0;a<i.length-1;a++)o=J(this,n[r+a],e,a),o===X&&(o=this._$AH[a]),s||=!R(o)||o!==this._$AH[a],o===K?t=K:t!==K&&(t+=(o??"")+i[a+1]),this._$AH[a]=o}s&&!n&&this.j(t)}j(t){t===K?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class nt extends rt{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===K?void 0:t}}class it extends rt{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==K)}}class st extends rt{constructor(t,e,r,n,i){super(t,e,r,n,i),this.type=5}_$AI(t,e=this){if((t=J(this,t,e,0)??K)===X)return;const r=this._$AH,n=t===K&&r!==K||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,i=t!==K&&(r===K||n);n&&this.element.removeEventListener(this.name,this,r),i&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class at{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){J(this,t)}}const ot=_.litHtmlPolyfillSupport;ot?.(Q,et),(_.litHtmlVersions??=[]).push("3.3.1");const lt=(t,e,r)=>{const n=r?.renderBefore??e;let i=n._$litPart$;if(void 0===i){const t=r?.renderBefore??null;n._$litPart$=i=new et(e.insertBefore(P(),t),t,void 0,r??{})}return i._$AI(t),i},ct=globalThis;
|
|
18
18
|
/**
|
|
19
19
|
* @license
|
|
20
20
|
* Copyright 2017 Google LLC
|
|
21
21
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
22
|
-
*/class ht extends ${constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=lt(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return X}}ht._$litElement$=!0,ht.finalized=!0,ct.litElementHydrateSupport?.({LitElement:ht});const ut=ct.litElementPolyfillSupport;function dt(t,e){return null==t||null==e?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function ft(t,e){return null==t||null==e?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function pt(t){let e,r,n;function s(t,n,s=0,i=t.length){if(s<i){if(0!==e(n,n))return i;do{const e=s+i>>>1;r(t[e],n)<0?s=e+1:i=e}while(s<i)}return s}return 2!==t.length?(e=dt,r=(e,r)=>dt(t(e),r),n=(e,r)=>t(e)-r):(e=t===dt||t===ft?t:mt,r=t,n=t),{left:s,center:function(t,e,r=0,i=t.length){const a=s(t,e,r,i-1);return a>r&&n(t[a-1],e)>-n(t[a],e)?a-1:a},right:function(t,n,s=0,i=t.length){if(s<i){if(0!==e(n,n))return i;do{const e=s+i>>>1;r(t[e],n)<=0?s=e+1:i=e}while(s<i)}return s}}}function mt(){return 0}ut?.({LitElement:ht}),(ct.litElementVersions??=[]).push("4.2.1");const bt=pt(dt).right;function gt(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 s=-1;for(let i of t)null!=(i=e(i,++s,t))&&(void 0===r?i>=i&&(r=n=i):(r>i&&(r=i),n<i&&(n=i)))}return[r,n]}pt(function(t){return null===t?NaN:+t}).center;class vt{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 s=e[n],i=t+s,a=Math.abs(t)<Math.abs(s)?t-(i-s):s-(i-t);a&&(e[r++]=a),t=i}return e[r]=t,this._n=r+1,this}valueOf(){const t=this._partials;let e,r,n,s=this._n,i=0;if(s>0){for(i=t[--s];s>0&&(e=i,r=t[--s],i=e+r,n=r-(i-e),!n););s>0&&(n<0&&t[s-1]<0||n>0&&t[s-1]>0)&&(r=2*n,e=i+r,r==e-i&&(i=e))}return i}}function yt(t){return t}var wt=Array.prototype.slice;function xt(t){return()=>t}const kt=Math.sqrt(50),$t=Math.sqrt(10),_t=Math.sqrt(2);function St(t,e,r){const n=(e-t)/Math.max(0,r),s=Math.floor(Math.log10(n)),i=n/Math.pow(10,s),a=i>=kt?10:i>=$t?5:i>=_t?2:1;let o,l,c;return s<0?(c=Math.pow(10,-s)/a,o=Math.round(t*c),l=Math.round(e*c),o/c<t&&++o,l/c>e&&--l,c=-c):(c=Math.pow(10,s)*a,o=Math.round(t/c),l=Math.round(e/c),o*c<t&&++o,l*c>e&&--l),l<o&&.5<=r&&r<2?St(t,e,2*r):[o,l,c]}function Mt(t,e,r){if(!((r=+r)>0))return[];if((t=+t)===(e=+e))return[t];const n=e<t,[s,i,a]=n?St(e,t,r):St(t,e,r);if(!(i>=s))return[];const o=i-s+1,l=new Array(o);if(n)if(a<0)for(let t=0;t<o;++t)l[t]=(i-t)/-a;else for(let t=0;t<o;++t)l[t]=(i-t)*a;else if(a<0)for(let t=0;t<o;++t)l[t]=(s+t)/-a;else for(let t=0;t<o;++t)l[t]=(s+t)*a;return l}function At(t,e,r){return St(t=+t,e=+e,r=+r)[2]}function Et(t,e,r){let n;for(;;){const s=At(t,e,r);if(s===n||0===s||!isFinite(s))return[t,e];s>0?(t=Math.floor(t/s)*s,e=Math.ceil(e/s)*s):s<0&&(t=Math.ceil(t*s)/s,e=Math.floor(e*s)/s),n=s}}function Nt(t){return Math.max(1,Math.ceil(Math.log(function(t){let e=0;for(let r of t)null!=r&&(r=+r)>=r&&++e;return e}(t))/Math.LN2)+1)}function Tt(t,e,r){t=+t,e=+e,r=(s=arguments.length)<2?(e=t,t=0,1):s<3?1:+r;for(var n=-1,s=0|Math.max(0,Math.ceil((e-t)/r)),i=new Array(s);++n<s;)i[n]=t+n*r;return i}function Ct(t){return t}var Rt=1e-6;function Pt(t){return"translate("+t+",0)"}function qt(t){return"translate(0,"+t+")"}function Ft(t){return e=>+t(e)}function zt(t,e){return e=Math.max(0,t.bandwidth()-2*e)/2,t.round()&&(e=Math.round(e)),r=>+t(r)+e}function Ot(){return!this.__axis}function It(t,e){var r=[],n=null,s=null,i=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?Pt:qt;function d(d){var f=null==n?e.ticks?e.ticks.apply(e,r):e.domain():n,p=null==s?e.tickFormat?e.tickFormat.apply(e,r):Ct:s,m=Math.max(i,0)+o,b=e.range(),g=+b[0]+l,v=+b[b.length-1]+l,y=(e.bandwidth?zt:Ft)(e.copy(),l),w=d.selection?d.selection():d,x=w.selectAll(".domain").data([null]),k=w.selectAll(".tick").data(f,e).order(),$=k.exit(),_=k.enter().append("g").attr("class","tick"),S=k.select("line"),M=k.select("text");x=x.merge(x.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),k=k.merge(_),S=S.merge(_.append("line").attr("stroke","currentColor").attr(h+"2",c*i)),M=M.merge(_.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),k=k.transition(d),S=S.transition(d),M=M.transition(d),$=$.transition(d).attr("opacity",Rt).attr("transform",function(t){return isFinite(t=y(t))?u(t+l):this.getAttribute("transform")}),_.attr("opacity",Rt).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+","+g+"H"+l+"V"+v+"H"+c*a:"M"+l+","+g+"V"+v:a?"M"+g+","+c*a+"V"+l+"H"+v+"V"+c*a:"M"+g+","+l+"H"+v),k.attr("opacity",1).attr("transform",function(t){return u(y(t)+l)}),S.attr(h+"2",c*i),M.attr(h,c*m).text(p),w.filter(Ot).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?(s=t,d):s},d.tickSize=function(t){return arguments.length?(i=a=+t,d):i},d.tickSizeInner=function(t){return arguments.length?(i=+t,d):i},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 Dt(t){return It(3,t)}function Ut(t){return It(4,t)}var jt={value:()=>{}};function Ht(){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 Lt(n)}function Lt(t){this._=t}function Vt(t,e){for(var r,n=0,s=t.length;n<s;++n)if((r=t[n]).name===e)return r.value}function Bt(t,e,r){for(var n=0,s=t.length;n<s;++n)if(t[n].name===e){t[n]=jt,t=t.slice(0,n).concat(t.slice(n+1));break}return null!=r&&t.push({name:e,value:r}),t}Lt.prototype=Ht.prototype={constructor:Lt,on:function(t,e){var r,n,s=this._,i=(n=s,(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=i.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++a<o;)if(r=(t=i[a]).type)s[r]=Bt(s[r],t.name,e);else if(null==e)for(r in s)s[r]=Bt(s[r],t.name,null);return this}for(;++a<o;)if((r=(t=i[a]).type)&&(r=Vt(s[r],t.name)))return r},copy:function(){var t={},e=this._;for(var r in e)t[r]=e[r].slice();return new Lt(t)},call:function(t,e){if((r=arguments.length-2)>0)for(var r,n,s=new Array(r),i=0;i<r;++i)s[i]=arguments[i+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(i=0,r=(n=this._[t]).length;i<r;++i)n[i].value.apply(e,s)},apply:function(t,e,r){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var n=this._[t],s=0,i=n.length;s<i;++s)n[s].value.apply(e,r)}};var Xt="http://www.w3.org/1999/xhtml",Kt={svg:"http://www.w3.org/2000/svg",xhtml:Xt,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Zt(t){var e=t+="",r=e.indexOf(":");return r>=0&&"xmlns"!==(e=t.slice(0,r))&&(t=t.slice(r+1)),Kt.hasOwnProperty(e)?{space:Kt[e],local:t}:t}function Wt(t){return function(){var e=this.ownerDocument,r=this.namespaceURI;return r===Xt&&e.documentElement.namespaceURI===Xt?e.createElement(t):e.createElementNS(r,t)}}function Yt(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function Gt(t){var e=Zt(t);return(e.local?Yt:Wt)(e)}function Qt(){}function Jt(t){return null==t?Qt:function(){return this.querySelector(t)}}function te(){return[]}function ee(t){return null==t?te:function(){return this.querySelectorAll(t)}}function re(t){return function(){return function(t){return null==t?[]:Array.isArray(t)?t:Array.from(t)}(t.apply(this,arguments))}}function ne(t){return function(){return this.matches(t)}}function se(t){return function(e){return e.matches(t)}}var ie=Array.prototype.find;function ae(){return this.firstElementChild}var oe=Array.prototype.filter;function le(){return Array.from(this.children)}function ce(t){return new Array(t.length)}function he(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function ue(t,e,r,n,s,i){for(var a,o=0,l=e.length,c=i.length;o<c;++o)(a=e[o])?(a.__data__=i[o],n[o]=a):r[o]=new he(t,i[o]);for(;o<l;++o)(a=e[o])&&(s[o]=a)}function de(t,e,r,n,s,i,a){var o,l,c,h=new Map,u=e.length,d=i.length,f=new Array(u);for(o=0;o<u;++o)(l=e[o])&&(f[o]=c=a.call(l,l.__data__,o,e)+"",h.has(c)?s[o]=l:h.set(c,l));for(o=0;o<d;++o)c=a.call(t,i[o],o,i)+"",(l=h.get(c))?(n[o]=l,l.__data__=i[o],h.delete(c)):r[o]=new he(t,i[o]);for(o=0;o<u;++o)(l=e[o])&&h.get(f[o])===l&&(s[o]=l)}function fe(t){return t.__data__}function pe(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function me(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function be(t){return function(){this.removeAttribute(t)}}function ge(t){return function(){this.removeAttributeNS(t.space,t.local)}}function ve(t,e){return function(){this.setAttribute(t,e)}}function ye(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function we(t,e){return function(){var r=e.apply(this,arguments);null==r?this.removeAttribute(t):this.setAttribute(t,r)}}function xe(t,e){return function(){var r=e.apply(this,arguments);null==r?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,r)}}function ke(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function $e(t){return function(){this.style.removeProperty(t)}}function _e(t,e,r){return function(){this.style.setProperty(t,e,r)}}function Se(t,e,r){return function(){var n=e.apply(this,arguments);null==n?this.style.removeProperty(t):this.style.setProperty(t,n,r)}}function Me(t,e){return t.style.getPropertyValue(e)||ke(t).getComputedStyle(t,null).getPropertyValue(e)}function Ae(t){return function(){delete this[t]}}function Ee(t,e){return function(){this[t]=e}}function Ne(t,e){return function(){var r=e.apply(this,arguments);null==r?delete this[t]:this[t]=r}}function Te(t){return t.trim().split(/^|\s+/)}function Ce(t){return t.classList||new Re(t)}function Re(t){this._node=t,this._names=Te(t.getAttribute("class")||"")}function Pe(t,e){for(var r=Ce(t),n=-1,s=e.length;++n<s;)r.add(e[n])}function qe(t,e){for(var r=Ce(t),n=-1,s=e.length;++n<s;)r.remove(e[n])}function Fe(t){return function(){Pe(this,t)}}function ze(t){return function(){qe(this,t)}}function Oe(t,e){return function(){(e.apply(this,arguments)?Pe:qe)(this,t)}}function Ie(){this.textContent=""}function De(t){return function(){this.textContent=t}}function Ue(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}function je(){this.innerHTML=""}function He(t){return function(){this.innerHTML=t}}function Le(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}function Ve(){this.nextSibling&&this.parentNode.appendChild(this)}function Be(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Xe(){return null}function Ke(){var t=this.parentNode;t&&t.removeChild(this)}function Ze(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function We(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Ye(t){return function(){var e=this.__on;if(e){for(var r,n=0,s=-1,i=e.length;n<i;++n)r=e[n],t.type&&r.type!==t.type||r.name!==t.name?e[++s]=r:this.removeEventListener(r.type,r.listener,r.options);++s?e.length=s:delete this.__on}}}function Ge(t,e,r){return function(){var n,s=this.__on,i=function(t){return function(e){t.call(this,e,this.__data__)}}(e);if(s)for(var a=0,o=s.length;a<o;++a)if((n=s[a]).type===t.type&&n.name===t.name)return this.removeEventListener(n.type,n.listener,n.options),this.addEventListener(n.type,n.listener=i,n.options=r),void(n.value=e);this.addEventListener(t.type,i,r),n={type:t.type,name:t.name,value:e,listener:i,options:r},s?s.push(n):this.__on=[n]}}function Qe(t,e,r){var n=ke(t),s=n.CustomEvent;"function"==typeof s?s=new s(e,r):(s=n.document.createEvent("Event"),r?(s.initEvent(e,r.bubbles,r.cancelable),s.detail=r.detail):s.initEvent(e,!1,!1)),t.dispatchEvent(s)}function Je(t,e){return function(){return Qe(this,t,e)}}function tr(t,e){return function(){return Qe(this,t,e.apply(this,arguments))}}he.prototype={constructor:he,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)}},Re.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 er=[null];function rr(t,e){this._groups=t,this._parents=e}function nr(){return new rr([[document.documentElement]],er)}function sr(t){return"string"==typeof t?new rr([[document.querySelector(t)]],[document.documentElement]):new rr([[t]],er)}function ir(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 s=e.getBoundingClientRect();return[t.clientX-s.left-e.clientLeft,t.clientY-s.top-e.clientTop]}}return[t.pageX,t.pageY]}rr.prototype=nr.prototype={constructor:rr,select:function(t){"function"!=typeof t&&(t=Jt(t));for(var e=this._groups,r=e.length,n=new Array(r),s=0;s<r;++s)for(var i,a,o=e[s],l=o.length,c=n[s]=new Array(l),h=0;h<l;++h)(i=o[h])&&(a=t.call(i,i.__data__,h,o))&&("__data__"in i&&(a.__data__=i.__data__),c[h]=a);return new rr(n,this._parents)},selectAll:function(t){t="function"==typeof t?re(t):ee(t);for(var e=this._groups,r=e.length,n=[],s=[],i=0;i<r;++i)for(var a,o=e[i],l=o.length,c=0;c<l;++c)(a=o[c])&&(n.push(t.call(a,a.__data__,c,o)),s.push(a));return new rr(n,s)},selectChild:function(t){return this.select(null==t?ae:function(t){return function(){return ie.call(this.children,t)}}("function"==typeof t?t:se(t)))},selectChildren:function(t){return this.selectAll(null==t?le:function(t){return function(){return oe.call(this.children,t)}}("function"==typeof t?t:se(t)))},filter:function(t){"function"!=typeof t&&(t=ne(t));for(var e=this._groups,r=e.length,n=new Array(r),s=0;s<r;++s)for(var i,a=e[s],o=a.length,l=n[s]=[],c=0;c<o;++c)(i=a[c])&&t.call(i,i.__data__,c,a)&&l.push(i);return new rr(n,this._parents)},data:function(t,e){if(!arguments.length)return Array.from(this,fe);var r=e?de:ue,n=this._parents,s=this._groups;"function"!=typeof t&&(t=function(t){return function(){return t}}(t));for(var i=s.length,a=new Array(i),o=new Array(i),l=new Array(i),c=0;c<i;++c){var h=n[c],u=s[c],d=u.length,f=pe(t.call(h,h&&h.__data__,c,n)),p=f.length,m=o[c]=new Array(p),b=a[c]=new Array(p);r(h,u,m,b,l[c]=new Array(d),f,e);for(var g,v,y=0,w=0;y<p;++y)if(g=m[y]){for(y>=w&&(w=y+1);!(v=b[w])&&++w<p;);g._next=v||null}}return(a=new rr(a,n))._enter=o,a._exit=l,a},enter:function(){return new rr(this._enter||this._groups.map(ce),this._parents)},exit:function(){return new rr(this._exit||this._groups.map(ce),this._parents)},join:function(t,e,r){var n=this.enter(),s=this,i=this.exit();return"function"==typeof t?(n=t(n))&&(n=n.selection()):n=n.append(t+""),null!=e&&(s=e(s))&&(s=s.selection()),null==r?i.remove():r(i),n&&s?n.merge(s).order():s},merge:function(t){for(var e=t.selection?t.selection():t,r=this._groups,n=e._groups,s=r.length,i=n.length,a=Math.min(s,i),o=new Array(s),l=0;l<a;++l)for(var c,h=r[l],u=n[l],d=h.length,f=o[l]=new Array(d),p=0;p<d;++p)(c=h[p]||u[p])&&(f[p]=c);for(;l<s;++l)o[l]=r[l];return new rr(o,this._parents)},selection:function(){return this},order:function(){for(var t=this._groups,e=-1,r=t.length;++e<r;)for(var n,s=t[e],i=s.length-1,a=s[i];--i>=0;)(n=s[i])&&(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=me);for(var r=this._groups,n=r.length,s=new Array(n),i=0;i<n;++i){for(var a,o=r[i],l=o.length,c=s[i]=new Array(l),h=0;h<l;++h)(a=o[h])&&(c[h]=a);c.sort(e)}return new rr(s,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],s=0,i=n.length;s<i;++s){var a=n[s];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 s,i=e[r],a=0,o=i.length;a<o;++a)(s=i[a])&&t.call(s,s.__data__,a,i);return this},attr:function(t,e){var r=Zt(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?ge:be:"function"==typeof e?r.local?xe:we:r.local?ye:ve)(r,e))},style:function(t,e,r){return arguments.length>1?this.each((null==e?$e:"function"==typeof e?Se:_e)(t,e,null==r?"":r)):Me(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?Ae:"function"==typeof e?Ne:Ee)(t,e)):this.node()[t]},classed:function(t,e){var r=Te(t+"");if(arguments.length<2){for(var n=Ce(this.node()),s=-1,i=r.length;++s<i;)if(!n.contains(r[s]))return!1;return!0}return this.each(("function"==typeof e?Oe:e?Fe:ze)(r,e))},text:function(t){return arguments.length?this.each(null==t?Ie:("function"==typeof t?Ue:De)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?je:("function"==typeof t?Le:He)(t)):this.node().innerHTML},raise:function(){return this.each(Ve)},lower:function(){return this.each(Be)},append:function(t){var e="function"==typeof t?t:Gt(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})},insert:function(t,e){var r="function"==typeof t?t:Gt(t),n=null==e?Xe:"function"==typeof e?e:Jt(e);return this.select(function(){return this.insertBefore(r.apply(this,arguments),n.apply(this,arguments)||null)})},remove:function(){return this.each(Ke)},clone:function(t){return this.select(t?We:Ze)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,e,r){var n,s,i=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=i.length;if(!(arguments.length<2)){for(o=e?Ge:Ye,n=0;n<a;++n)this.each(o(i[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((s=i[n]).type===l.type&&s.name===l.name)return l.value},dispatch:function(t,e){return this.each(("function"==typeof e?tr:Je)(t,e))},[Symbol.iterator]:function*(){for(var t=this._groups,e=0,r=t.length;e<r;++e)for(var n,s=t[e],i=0,a=s.length;i<a;++i)(n=s[i])&&(yield n)}};const ar={passive:!1},or={capture:!0,passive:!1};function lr(t){t.stopImmediatePropagation()}function cr(t){t.preventDefault(),t.stopImmediatePropagation()}var hr=t=>()=>t;function ur(t,{sourceEvent:e,subject:r,target:n,identifier:s,active:i,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:s,enumerable:!0,configurable:!0},active:{value:i,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 dr(t){return!t.ctrlKey&&!t.button}function fr(){return this.parentNode}function pr(t,e){return null==e?{x:t.x,y:t.y}:e}function mr(){return navigator.maxTouchPoints||"ontouchstart"in this}function br(){var t,e,r,n,s=dr,i=fr,a=pr,o=mr,l={},c=Ht("start","drag","end"),h=0,u=0;function d(t){t.on("mousedown.drag",f).filter(o).on("touchstart.drag",b).on("touchmove.drag",g,ar).on("touchend.drag touchcancel.drag",v).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function f(a,o){if(!n&&s.call(this,a,o)){var l=y(this,i.call(this,a,o),a,o,"mouse");l&&(sr(a.view).on("mousemove.drag",p,or).on("mouseup.drag",m,or),function(t){var e=t.document.documentElement,r=sr(t).on("dragstart.drag",cr,or);"onselectstart"in e?r.on("selectstart.drag",cr,or):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}(a.view),lr(a),r=!1,t=a.clientX,e=a.clientY,l("start",a))}}function p(n){if(cr(n),!r){var s=n.clientX-t,i=n.clientY-e;r=s*s+i*i>u}l.mouse("drag",n)}function m(t){sr(t.view).on("mousemove.drag mouseup.drag",null),function(t,e){var r=t.document.documentElement,n=sr(t).on("dragstart.drag",null);e&&(n.on("click.drag",cr,or),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),cr(t),l.mouse("end",t)}function b(t,e){if(s.call(this,t,e)){var r,n,a=t.changedTouches,o=i.call(this,t,e),l=a.length;for(r=0;r<l;++r)(n=y(this,o,t,e,a[r].identifier,a[r]))&&(lr(t),n("start",t,a[r]))}}function g(t){var e,r,n=t.changedTouches,s=n.length;for(e=0;e<s;++e)(r=l[n[e].identifier])&&(cr(t),r("drag",t,n[e]))}function v(t){var e,r,s=t.changedTouches,i=s.length;for(n&&clearTimeout(n),n=setTimeout(function(){n=null},500),e=0;e<i;++e)(r=l[s[e].identifier])&&(lr(t),r("end",t,s[e]))}function y(t,e,r,n,s,i){var o,u,f,p=c.copy(),m=ir(i||r,e);if(null!=(f=a.call(t,new ur("beforestart",{sourceEvent:r,target:d,identifier:s,active:h,x:m[0],y:m[1],dx:0,dy:0,dispatch:p}),n)))return o=f.x-m[0]||0,u=f.y-m[1]||0,function r(i,a,c){var b,g=m;switch(i){case"start":l[s]=r,b=h++;break;case"end":delete l[s],--h;case"drag":m=ir(c||a,e),b=h}p.call(i,t,new ur(i,{sourceEvent:a,subject:f,target:d,identifier:s,active:b,x:m[0]+o,y:m[1]+u,dx:m[0]-g[0],dy:m[1]-g[1],dispatch:p}),n)}}return d.filter=function(t){return arguments.length?(s="function"==typeof t?t:hr(!!t),d):s},d.container=function(t){return arguments.length?(i="function"==typeof t?t:hr(t),d):i},d.subject=function(t){return arguments.length?(a="function"==typeof t?t:hr(t),d):a},d.touchable=function(t){return arguments.length?(o="function"==typeof t?t:hr(!!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 gr(t,e,r){t.prototype=e.prototype=r,r.constructor=t}function vr(t,e){var r=Object.create(t.prototype);for(var n in e)r[n]=e[n];return r}function yr(){}ur.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};var wr=.7,xr=1/wr,kr="\\s*([+-]?\\d+)\\s*",$r="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",_r="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Sr=/^#([0-9a-f]{3,8})$/,Mr=new RegExp(`^rgb\\(${kr},${kr},${kr}\\)$`),Ar=new RegExp(`^rgb\\(${_r},${_r},${_r}\\)$`),Er=new RegExp(`^rgba\\(${kr},${kr},${kr},${$r}\\)$`),Nr=new RegExp(`^rgba\\(${_r},${_r},${_r},${$r}\\)$`),Tr=new RegExp(`^hsl\\(${$r},${_r},${_r}\\)$`),Cr=new RegExp(`^hsla\\(${$r},${_r},${_r},${$r}\\)$`),Rr={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 Pr(){return this.rgb().formatHex()}function qr(){return this.rgb().formatRgb()}function Fr(t){var e,r;return t=(t+"").trim().toLowerCase(),(e=Sr.exec(t))?(r=e[1].length,e=parseInt(e[1],16),6===r?zr(e):3===r?new Dr(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===r?Or(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===r?Or(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=Mr.exec(t))?new Dr(e[1],e[2],e[3],1):(e=Ar.exec(t))?new Dr(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=Er.exec(t))?Or(e[1],e[2],e[3],e[4]):(e=Nr.exec(t))?Or(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=Tr.exec(t))?Br(e[1],e[2]/100,e[3]/100,1):(e=Cr.exec(t))?Br(e[1],e[2]/100,e[3]/100,e[4]):Rr.hasOwnProperty(t)?zr(Rr[t]):"transparent"===t?new Dr(NaN,NaN,NaN,0):null}function zr(t){return new Dr(t>>16&255,t>>8&255,255&t,1)}function Or(t,e,r,n){return n<=0&&(t=e=r=NaN),new Dr(t,e,r,n)}function Ir(t,e,r,n){return 1===arguments.length?function(t){return t instanceof yr||(t=Fr(t)),t?new Dr((t=t.rgb()).r,t.g,t.b,t.opacity):new Dr}(t):new Dr(t,e,r,null==n?1:n)}function Dr(t,e,r,n){this.r=+t,this.g=+e,this.b=+r,this.opacity=+n}function Ur(){return`#${Vr(this.r)}${Vr(this.g)}${Vr(this.b)}`}function jr(){const t=Hr(this.opacity);return`${1===t?"rgb(":"rgba("}${Lr(this.r)}, ${Lr(this.g)}, ${Lr(this.b)}${1===t?")":`, ${t})`}`}function Hr(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Lr(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Vr(t){return((t=Lr(t))<16?"0":"")+t.toString(16)}function Br(t,e,r,n){return n<=0?t=e=r=NaN:r<=0||r>=1?t=e=NaN:e<=0&&(t=NaN),new Kr(t,e,r,n)}function Xr(t){if(t instanceof Kr)return new Kr(t.h,t.s,t.l,t.opacity);if(t instanceof yr||(t=Fr(t)),!t)return new Kr;if(t instanceof Kr)return t;var e=(t=t.rgb()).r/255,r=t.g/255,n=t.b/255,s=Math.min(e,r,n),i=Math.max(e,r,n),a=NaN,o=i-s,l=(i+s)/2;return o?(a=e===i?(r-n)/o+6*(r<n):r===i?(n-e)/o+2:(e-r)/o+4,o/=l<.5?i+s:2-i-s,a*=60):o=l>0&&l<1?0:a,new Kr(a,o,l,t.opacity)}function Kr(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}function Zr(t){return(t=(t||0)%360)<0?t+360:t}function Wr(t){return Math.max(0,Math.min(1,t||0))}function Yr(t,e,r){return 255*(t<60?e+(r-e)*t/60:t<180?r:t<240?e+(r-e)*(240-t)/60:e)}gr(yr,Fr,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Pr,formatHex:Pr,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Xr(this).formatHsl()},formatRgb:qr,toString:qr}),gr(Dr,Ir,vr(yr,{brighter(t){return t=null==t?xr:Math.pow(xr,t),new Dr(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?wr:Math.pow(wr,t),new Dr(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Dr(Lr(this.r),Lr(this.g),Lr(this.b),Hr(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Ur,formatHex:Ur,formatHex8:function(){return`#${Vr(this.r)}${Vr(this.g)}${Vr(this.b)}${Vr(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:jr,toString:jr})),gr(Kr,function(t,e,r,n){return 1===arguments.length?Xr(t):new Kr(t,e,r,null==n?1:n)},vr(yr,{brighter(t){return t=null==t?xr:Math.pow(xr,t),new Kr(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?wr:Math.pow(wr,t),new Kr(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*e,s=2*r-n;return new Dr(Yr(t>=240?t-240:t+120,s,n),Yr(t,s,n),Yr(t<120?t+240:t-120,s,n),this.opacity)},clamp(){return new Kr(Zr(this.h),Wr(this.s),Wr(this.l),Hr(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=Hr(this.opacity);return`${1===t?"hsl(":"hsla("}${Zr(this.h)}, ${100*Wr(this.s)}%, ${100*Wr(this.l)}%${1===t?")":`, ${t})`}`}}));var Gr=t=>()=>t;function Qr(t){return 1===(t=+t)?Jr: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):Gr(isNaN(e)?r:e)}}function Jr(t,e){var r=e-t;return r?function(t,e){return function(r){return t+r*e}}(t,r):Gr(isNaN(t)?e:t)}var tn=function t(e){var r=Qr(e);function n(t,e){var n=r((t=Ir(t)).r,(e=Ir(e)).r),s=r(t.g,e.g),i=r(t.b,e.b),a=Jr(t.opacity,e.opacity);return function(e){return t.r=n(e),t.g=s(e),t.b=i(e),t.opacity=a(e),t+""}}return n.gamma=t,n}(1);function en(t,e){e||(e=[]);var r,n=t?Math.min(e.length,t.length):0,s=e.slice();return function(i){for(r=0;r<n;++r)s[r]=t[r]*(1-i)+e[r]*i;return s}}function rn(t,e){var r,n=e?e.length:0,s=t?Math.min(n,t.length):0,i=new Array(s),a=new Array(n);for(r=0;r<s;++r)i[r]=hn(t[r],e[r]);for(;r<n;++r)a[r]=e[r];return function(t){for(r=0;r<s;++r)a[r]=i[r](t);return a}}function nn(t,e){var r=new Date;return t=+t,e=+e,function(n){return r.setTime(t*(1-n)+e*n),r}}function sn(t,e){return t=+t,e=+e,function(r){return t*(1-r)+e*r}}function an(t,e){var r,n={},s={};for(r in null!==t&&"object"==typeof t||(t={}),null!==e&&"object"==typeof e||(e={}),e)r in t?n[r]=hn(t[r],e[r]):s[r]=e[r];return function(t){for(r in n)s[r]=n[r](t);return s}}var on=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ln=new RegExp(on.source,"g");function cn(t,e){var r,n,s,i=on.lastIndex=ln.lastIndex=0,a=-1,o=[],l=[];for(t+="",e+="";(r=on.exec(t))&&(n=ln.exec(e));)(s=n.index)>i&&(s=e.slice(i,s),o[a]?o[a]+=s:o[++a]=s),(r=r[0])===(n=n[0])?o[a]?o[a]+=n:o[++a]=n:(o[++a]=null,l.push({i:a,x:sn(r,n)})),i=ln.lastIndex;return i<e.length&&(s=e.slice(i),o[a]?o[a]+=s:o[++a]=s),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 hn(t,e){var r,n=typeof e;return null==e||"boolean"===n?Gr(e):("number"===n?sn:"string"===n?(r=Fr(e))?(e=r,tn):cn:e instanceof Fr?tn:e instanceof Date?nn:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}(e)?en:Array.isArray(e)?rn:"function"!=typeof e.valueOf&&"function"!=typeof e.toString||isNaN(e)?an:sn)(t,e)}function un(t,e){return t=+t,e=+e,function(r){return Math.round(t*(1-r)+e*r)}}var dn,fn=180/Math.PI,pn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function mn(t,e,r,n,s,i){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:s,translateY:i,rotate:Math.atan2(e,t)*fn,skewX:Math.atan(l)*fn,scaleX:a,scaleY:o}}function bn(t,e,r,n){function s(t){return t.length?t.pop()+" ":""}return function(i,a){var o=[],l=[];return i=t(i),a=t(a),function(t,n,s,i,a,o){if(t!==s||n!==i){var l=a.push("translate(",null,e,null,r);o.push({i:l-4,x:sn(t,s)},{i:l-2,x:sn(n,i)})}else(s||i)&&a.push("translate("+s+e+i+r)}(i.translateX,i.translateY,a.translateX,a.translateY,o,l),function(t,e,r,i){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),i.push({i:r.push(s(r)+"rotate(",null,n)-2,x:sn(t,e)})):e&&r.push(s(r)+"rotate("+e+n)}(i.rotate,a.rotate,o,l),function(t,e,r,i){t!==e?i.push({i:r.push(s(r)+"skewX(",null,n)-2,x:sn(t,e)}):e&&r.push(s(r)+"skewX("+e+n)}(i.skewX,a.skewX,o,l),function(t,e,r,n,i,a){if(t!==r||e!==n){var o=i.push(s(i)+"scale(",null,",",null,")");a.push({i:o-4,x:sn(t,r)},{i:o-2,x:sn(e,n)})}else 1===r&&1===n||i.push(s(i)+"scale("+r+","+n+")")}(i.scaleX,i.scaleY,a.scaleX,a.scaleY,o,l),i=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 gn,vn,yn=bn(function(t){const e=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?pn:mn(e.a,e.b,e.c,e.d,e.e,e.f)},"px, ","px)","deg)"),wn=bn(function(t){return null==t?pn:(dn||(dn=document.createElementNS("http://www.w3.org/2000/svg","g")),dn.setAttribute("transform",t),(t=dn.transform.baseVal.consolidate())?mn((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):pn)},", ",")",")"),xn=0,kn=0,$n=0,_n=0,Sn=0,Mn=0,An="object"==typeof performance&&performance.now?performance:Date,En="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Nn(){return Sn||(En(Tn),Sn=An.now()+Mn)}function Tn(){Sn=0}function Cn(){this._call=this._time=this._next=null}function Rn(t,e,r){var n=new Cn;return n.restart(t,e,r),n}function Pn(){Sn=(_n=An.now())+Mn,xn=kn=0;try{!function(){Nn(),++xn;for(var t,e=gn;e;)(t=Sn-e._time)>=0&&e._call.call(void 0,t),e=e._next;--xn}()}finally{xn=0,function(){var t,e,r=gn,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:gn=e);vn=t,Fn(n)}(),Sn=0}}function qn(){var t=An.now(),e=t-_n;e>1e3&&(Mn-=e,_n=t)}function Fn(t){xn||(kn&&(kn=clearTimeout(kn)),t-Sn>24?(t<1/0&&(kn=setTimeout(Pn,t-An.now()-Mn)),$n&&($n=clearInterval($n))):($n||(_n=An.now(),$n=setInterval(qn,1e3)),xn=1,En(Pn)))}function zn(t,e,r){var n=new Cn;return e=null==e?0:+e,n.restart(r=>{n.stop(),t(r+e)},e,r),n}Cn.prototype=Rn.prototype={constructor:Cn,restart:function(t,e,r){if("function"!=typeof t)throw new TypeError("callback is not a function");r=(null==r?Nn():+r)+(null==e?0:+e),this._next||vn===this||(vn?vn._next=this:gn=this,vn=this),this._call=t,this._time=r,Fn()},stop:function(){this._call&&(this._call=null,this._time=1/0,Fn())}};var On=Ht("start","end","cancel","interrupt"),In=[];function Dn(t,e,r,n,s,i){var a=t.__transition;if(a){if(r in a)return}else t.__transition={};!function(t,e,r){var n,s=t.__transition;function i(t){r.state=1,r.timer.restart(a,r.delay,r.time),r.delay<=t&&a(t-r.delay)}function a(i){var c,h,u,d;if(1!==r.state)return l();for(c in s)if((d=s[c]).name===r.name){if(3===d.state)return zn(a);4===d.state?(d.state=6,d.timer.stop(),d.on.call("interrupt",t,t.__data__,d.index,d.group),delete s[c]):+c<e&&(d.state=6,d.timer.stop(),d.on.call("cancel",t,t.__data__,d.index,d.group),delete s[c])}if(zn(function(){3===r.state&&(r.state=4,r.timer.restart(o,r.delay,r.time),o(i))}),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 s=e<r.duration?r.ease.call(null,e/r.duration):(r.timer.restart(l),r.state=5,1),i=-1,a=n.length;++i<a;)n[i].call(t,s);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 s[e],s)return;delete t.__transition}s[e]=r,r.timer=Rn(i,0,r.time)}(t,r,{name:e,index:n,group:s,on:On,tween:In,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:0})}function Un(t,e){var r=Hn(t,e);if(r.state>0)throw new Error("too late; already scheduled");return r}function jn(t,e){var r=Hn(t,e);if(r.state>3)throw new Error("too late; already running");return r}function Hn(t,e){var r=t.__transition;if(!r||!(r=r[e]))throw new Error("transition not found");return r}function Ln(t,e){var r,n;return function(){var s=jn(this,t),i=s.tween;if(i!==r)for(var a=0,o=(n=r=i).length;a<o;++a)if(n[a].name===e){(n=n.slice()).splice(a,1);break}s.tween=n}}function Vn(t,e,r){var n,s;if("function"!=typeof r)throw new Error;return function(){var i=jn(this,t),a=i.tween;if(a!==n){s=(n=a).slice();for(var o={name:e,value:r},l=0,c=s.length;l<c;++l)if(s[l].name===e){s[l]=o;break}l===c&&s.push(o)}i.tween=s}}function Bn(t,e,r){var n=t._id;return t.each(function(){var t=jn(this,n);(t.value||(t.value={}))[e]=r.apply(this,arguments)}),function(t){return Hn(t,n).value[e]}}function Xn(t,e){var r;return("number"==typeof e?sn:e instanceof Fr?tn:(r=Fr(e))?(e=r,tn):cn)(t,e)}function Kn(t){return function(){this.removeAttribute(t)}}function Zn(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Wn(t,e,r){var n,s,i=r+"";return function(){var a=this.getAttribute(t);return a===i?null:a===n?s:s=e(n=a,r)}}function Yn(t,e,r){var n,s,i=r+"";return function(){var a=this.getAttributeNS(t.space,t.local);return a===i?null:a===n?s:s=e(n=a,r)}}function Gn(t,e,r){var n,s,i;return function(){var a,o,l=r(this);if(null!=l)return(a=this.getAttribute(t))===(o=l+"")?null:a===n&&o===s?i:(s=o,i=e(n=a,l));this.removeAttribute(t)}}function Qn(t,e,r){var n,s,i;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===s?i:(s=o,i=e(n=a,l));this.removeAttributeNS(t.space,t.local)}}function Jn(t,e){var r,n;function s(){var s=e.apply(this,arguments);return s!==n&&(r=(n=s)&&function(t,e){return function(r){this.setAttributeNS(t.space,t.local,e.call(this,r))}}(t,s)),r}return s._value=e,s}function ts(t,e){var r,n;function s(){var s=e.apply(this,arguments);return s!==n&&(r=(n=s)&&function(t,e){return function(r){this.setAttribute(t,e.call(this,r))}}(t,s)),r}return s._value=e,s}function es(t,e){return function(){Un(this,t).delay=+e.apply(this,arguments)}}function rs(t,e){return e=+e,function(){Un(this,t).delay=e}}function ns(t,e){return function(){jn(this,t).duration=+e.apply(this,arguments)}}function ss(t,e){return e=+e,function(){jn(this,t).duration=e}}var is=nr.prototype.constructor;function as(t){return function(){this.style.removeProperty(t)}}var os=0;function ls(t,e,r,n){this._groups=t,this._parents=e,this._name=r,this._id=n}function cs(){return++os}var hs=nr.prototype;ls.prototype={constructor:ls,select:function(t){var e=this._name,r=this._id;"function"!=typeof t&&(t=Jt(t));for(var n=this._groups,s=n.length,i=new Array(s),a=0;a<s;++a)for(var o,l,c=n[a],h=c.length,u=i[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,Dn(u[d],e,r,d,u,Hn(o,r)));return new ls(i,this._parents,e,r)},selectAll:function(t){var e=this._name,r=this._id;"function"!=typeof t&&(t=ee(t));for(var n=this._groups,s=n.length,i=[],a=[],o=0;o<s;++o)for(var l,c=n[o],h=c.length,u=0;u<h;++u)if(l=c[u]){for(var d,f=t.call(l,l.__data__,u,c),p=Hn(l,r),m=0,b=f.length;m<b;++m)(d=f[m])&&Dn(d,e,r,m,f,p);i.push(f),a.push(l)}return new ls(i,a,e,r)},selectChild:hs.selectChild,selectChildren:hs.selectChildren,filter:function(t){"function"!=typeof t&&(t=ne(t));for(var e=this._groups,r=e.length,n=new Array(r),s=0;s<r;++s)for(var i,a=e[s],o=a.length,l=n[s]=[],c=0;c<o;++c)(i=a[c])&&t.call(i,i.__data__,c,a)&&l.push(i);return new ls(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,s=r.length,i=Math.min(n,s),a=new Array(n),o=0;o<i;++o)for(var l,c=e[o],h=r[o],u=c.length,d=a[o]=new Array(u),f=0;f<u;++f)(l=c[f]||h[f])&&(d[f]=l);for(;o<n;++o)a[o]=e[o];return new ls(a,this._parents,this._name,this._id)},selection:function(){return new is(this._groups,this._parents)},transition:function(){for(var t=this._name,e=this._id,r=cs(),n=this._groups,s=n.length,i=0;i<s;++i)for(var a,o=n[i],l=o.length,c=0;c<l;++c)if(a=o[c]){var h=Hn(a,e);Dn(a,t,r,c,o,{time:h.time+h.delay+h.duration,delay:0,duration:h.duration,ease:h.ease})}return new ls(n,this._parents,t,r)},call:hs.call,nodes:hs.nodes,node:hs.node,size:hs.size,empty:hs.empty,each:hs.each,on:function(t,e){var r=this._id;return arguments.length<2?Hn(this.node(),r).on.on(t):this.each(function(t,e,r){var n,s,i=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)?Un:jn;return function(){var a=i(this,t),o=a.on;o!==n&&(s=(n=o).copy()).on(e,r),a.on=s}}(r,t,e))},attr:function(t,e){var r=Zt(t),n="transform"===r?wn:Xn;return this.attrTween(t,"function"==typeof e?(r.local?Qn:Gn)(r,n,Bn(this,"attr."+t,e)):null==e?(r.local?Zn:Kn)(r):(r.local?Yn:Wn)(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=Zt(t);return this.tween(r,(n.local?Jn:ts)(n,e))},style:function(t,e,r){var n="transform"==(t+="")?yn:Xn;return null==e?this.styleTween(t,function(t,e){var r,n,s;return function(){var i=Me(this,t),a=(this.style.removeProperty(t),Me(this,t));return i===a?null:i===r&&a===n?s:s=e(r=i,n=a)}}(t,n)).on("end.style."+t,as(t)):"function"==typeof e?this.styleTween(t,function(t,e,r){var n,s,i;return function(){var a=Me(this,t),o=r(this),l=o+"";return null==o&&(this.style.removeProperty(t),l=o=Me(this,t)),a===l?null:a===n&&l===s?i:(s=l,i=e(n=a,o))}}(t,n,Bn(this,"style."+t,e))).each(function(t,e){var r,n,s,i,a="style."+e,o="end."+a;return function(){var l=jn(this,t),c=l.on,h=null==l.value[a]?i||(i=as(e)):void 0;c===r&&s===h||(n=(r=c).copy()).on(o,s=h),l.on=n}}(this._id,t)):this.styleTween(t,function(t,e,r){var n,s,i=r+"";return function(){var a=Me(this,t);return a===i?null:a===n?s:s=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,s;function i(){var i=e.apply(this,arguments);return i!==s&&(n=(s=i)&&function(t,e,r){return function(n){this.style.setProperty(t,e.call(this,n),r)}}(t,i,r)),n}return i._value=e,i}(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}}(Bn(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,s=Hn(this.node(),r).tween,i=0,a=s.length;i<a;++i)if((n=s[i]).name===t)return n.value;return null}return this.each((null==e?Ln:Vn)(r,t,e))},delay:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?es:rs)(e,t)):Hn(this.node(),e).delay},duration:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?ns:ss)(e,t)):Hn(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(){jn(this,t).ease=e}}(e,t)):Hn(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;jn(this,t).ease=r}}(this._id,t))},end:function(){var t,e,r=this,n=r._id,s=r.size();return new Promise(function(i,a){var o={value:a},l={value:function(){0===--s&&i()}};r.each(function(){var r=jn(this,n),s=r.on;s!==t&&((e=(t=s).copy())._.cancel.push(o),e._.interrupt.push(o),e._.end.push(l)),r.on=e}),0===s&&i()})},[Symbol.iterator]:hs[Symbol.iterator]};const us=t=>+t;function ds(t){return t*t*t}function fs(t){return--t*t*t+1}var ps={time:null,delay:0,duration:250,ease:function(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}};function ms(t,e){for(var r;!(r=t.__transition)||!(r=r[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return r}nr.prototype.interrupt=function(t){return this.each(function(){!function(t,e){var r,n,s,i=t.__transition,a=!0;if(i){for(s in e=null==e?null:e+"",i)(r=i[s]).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 i[s]):a=!1;a&&delete t.__transition}}(this,t)})},nr.prototype.transition=function(t){var e,r;t instanceof ls?(e=t._id,t=t._name):(e=cs(),(r=ps).time=Nn(),t=null==t?null:t+"");for(var n=this._groups,s=n.length,i=0;i<s;++i)for(var a,o=n[i],l=o.length,c=0;c<l;++c)(a=o[c])&&Dn(a,t,e,c,o,r||ms(a,e));return new ls(n,this._parents,t,e)};const bs=Math.PI,gs=2*bs,vs=1e-6,ys=gs-vs;function ws(t){this._+=t[0];for(let e=1,r=t.length;e<r;++e)this._+=arguments[e]+t[e]}class xs{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=null==t?ws:function(t){let e=Math.floor(t);if(!(e>=0))throw new Error(`invalid digits: ${t}`);if(e>15)return ws;const r=10**e;return function(t){this._+=t[0];for(let e=1,n=t.length;e<n;++e)this._+=Math.round(arguments[e]*r)/r+t[e]}}(t)}moveTo(t,e){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,e){this._append`L${this._x1=+t},${this._y1=+e}`}quadraticCurveTo(t,e,r,n){this._append`Q${+t},${+e},${this._x1=+r},${this._y1=+n}`}bezierCurveTo(t,e,r,n,s,i){this._append`C${+t},${+e},${+r},${+n},${this._x1=+s},${this._y1=+i}`}arcTo(t,e,r,n,s){if(t=+t,e=+e,r=+r,n=+n,(s=+s)<0)throw new Error(`negative radius: ${s}`);let i=this._x1,a=this._y1,o=r-t,l=n-e,c=i-t,h=a-e,u=c*c+h*h;if(null===this._x1)this._append`M${this._x1=t},${this._y1=e}`;else if(u>vs)if(Math.abs(h*o-l*c)>vs&&s){let d=r-i,f=n-a,p=o*o+l*l,m=d*d+f*f,b=Math.sqrt(p),g=Math.sqrt(u),v=s*Math.tan((bs-Math.acos((p+u-m)/(2*b*g)))/2),y=v/g,w=v/b;Math.abs(y-1)>vs&&this._append`L${t+y*c},${e+y*h}`,this._append`A${s},${s},0,0,${+(h*d>c*f)},${this._x1=t+w*o},${this._y1=e+w*l}`}else this._append`L${this._x1=t},${this._y1=e}`;else;}arc(t,e,r,n,s,i){if(t=+t,e=+e,i=!!i,(r=+r)<0)throw new Error(`negative radius: ${r}`);let a=r*Math.cos(n),o=r*Math.sin(n),l=t+a,c=e+o,h=1^i,u=i?n-s:s-n;null===this._x1?this._append`M${l},${c}`:(Math.abs(this._x1-l)>vs||Math.abs(this._y1-c)>vs)&&this._append`L${l},${c}`,r&&(u<0&&(u=u%gs+gs),u>ys?this._append`A${r},${r},0,1,${h},${t-a},${e-o}A${r},${r},0,1,${h},${this._x1=l},${this._y1=c}`:u>vs&&this._append`A${r},${r},0,${+(u>=bs)},${h},${this._x1=t+r*Math.cos(s)},${this._y1=e+r*Math.sin(s)}`)}rect(t,e,r,n){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}h${r=+r}v${+n}h${-r}Z`}toString(){return this._}}var ks=Array.prototype.slice;function $s(t,e){return t-e}var _s=t=>()=>t;function Ss(t,e){for(var r,n=-1,s=e.length;++n<s;)if(r=Ms(t,e[n]))return r;return 0}function Ms(t,e){for(var r=e[0],n=e[1],s=-1,i=0,a=t.length,o=a-1;i<a;o=i++){var l=t[i],c=l[0],h=l[1],u=t[o],d=u[0],f=u[1];if(As(l,u,e))return 0;h>n!=f>n&&r<(d-c)*(n-h)/(f-h)+c&&(s=-s)}return s}function As(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 Es(){}var Ns=[[],[[[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 Ts(){var t=1,e=1,r=Nt,n=o;function s(t){var e=r(t);if(Array.isArray(e))e=e.slice().sort($s);else{const r=gt(t,Cs);for(e=Mt(...Et(r[0],r[1],e),e);e[e.length-1]>=r[1];)e.pop();for(;e[1]<r[0];)e.shift()}return e.map(e=>i(t,e))}function i(r,s){const i=null==s?NaN:+s;if(isNaN(i))throw new Error(`invalid value: ${s}`);var o=[],l=[];return function(r,n,s){var i,o,l,c,h,u,d=new Array,f=new Array;i=o=-1,c=Rs(r[0],n),Ns[c<<1].forEach(p);for(;++i<t-1;)l=c,c=Rs(r[i+1],n),Ns[l|c<<1].forEach(p);Ns[c|0].forEach(p);for(;++o<e-1;){for(i=-1,c=Rs(r[o*t+t],n),h=Rs(r[o*t],n),Ns[c<<1|h<<2].forEach(p);++i<t-1;)l=c,c=Rs(r[o*t+t+i+1],n),u=h,h=Rs(r[o*t+i+1],n),Ns[l|c<<1|h<<2|u<<3].forEach(p);Ns[c|h<<3].forEach(p)}i=-1,h=r[o*t]>=n,Ns[h<<2].forEach(p);for(;++i<t-1;)u=h,h=Rs(r[o*t+i+1],n),Ns[h<<2|u<<3].forEach(p);function p(t){var e,r,n=[t[0][0]+i,t[0][1]+o],l=[t[1][0]+i,t[1][1]+o],c=a(n),h=a(l);(e=f[c])?(r=d[h])?(delete f[e.end],delete d[r.start],e===r?(e.ring.push(l),s(e.ring)):d[e.start]=f[r.end]={start:e.start,end:r.end,ring:e.ring.concat(r.ring)}):(delete f[e.end],e.ring.push(l),f[e.end=h]=e):(e=d[h])?(r=f[c])?(delete d[e.start],delete f[r.end],e===r?(e.ring.push(l),s(e.ring)):d[r.start]=f[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]=f[h]={start:c,end:h,ring:[n,l]}}Ns[h<<3].forEach(p)}(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?o.push([t]):l.push(t)}),l.forEach(function(t){for(var e,r=0,n=o.length;r<n;++r)if(-1!==Ss((e=o[r])[0],t))return void e.push(t)}),{type:"MultiPolygon",value:s,coordinates:o}}function a(e){return 2*e[0]+e[1]*(t+1)*4}function o(r,n,s){r.forEach(function(r){var i=r[0],a=r[1],o=0|i,l=0|a,c=Ps(n[l*t+o]);i>0&&i<t&&o===i&&(r[0]=qs(i,Ps(n[l*t+o-1]),c,s)),a>0&&a<e&&l===a&&(r[1]=qs(a,Ps(n[(l-1)*t+o]),c,s))})}return s.contour=i,s.size=function(r){if(!arguments.length)return[t,e];var n=Math.floor(r[0]),i=Math.floor(r[1]);if(!(n>=0&&i>=0))throw new Error("invalid size");return t=n,e=i,s},s.thresholds=function(t){return arguments.length?(r="function"==typeof t?t:Array.isArray(t)?_s(ks.call(t)):_s(t),s):r},s.smooth=function(t){return arguments.length?(n=t?o:Es,s):n===o},s}function Cs(t){return isFinite(t)?t:NaN}function Rs(t,e){return null!=t&&+t>=e}function Ps(t){return null==t||isNaN(t=+t)?-1/0:t}function qs(t,e,r,n){const s=n-e,i=r-e,a=isFinite(s)||isFinite(i)?s/i:Math.sign(s)/Math.sign(i);return isNaN(a)?t:t+a-.5}function Fs(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 zs(t){return(t=Fs(Math.abs(t)))?t[1]:NaN}var Os,Is=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Ds(t){if(!(e=Is.exec(t)))throw new Error("invalid format: "+t);var e;return new Us({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 Us(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 js(t,e){var r=Fs(t,e);if(!r)return t+"";var n=r[0],s=r[1];return s<0?"0."+new Array(-s).join("0")+n:n.length>s+1?n.slice(0,s+1)+"."+n.slice(s+1):n+new Array(s-n.length+2).join("0")}Ds.prototype=Us.prototype,Us.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 Hs={"%":(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)=>js(100*t,e),r:js,s:function(t,e){var r=Fs(t,e);if(!r)return t+"";var n=r[0],s=r[1],i=s-(Os=3*Math.max(-8,Math.min(8,Math.floor(s/3))))+1,a=n.length;return i===a?n:i>a?n+new Array(i-a+1).join("0"):i>0?n.slice(0,i)+"."+n.slice(i):"0."+new Array(1-i).join("0")+Fs(t,Math.max(0,e+i-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function Ls(t){return t}var Vs,Bs,Xs,Ks=Array.prototype.map,Zs=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Ws(t){var e,r,n=void 0===t.grouping||void 0===t.thousands?Ls:(e=Ks.call(t.grouping,Number),r=t.thousands+"",function(t,n){for(var s=t.length,i=[],a=0,o=e[0],l=0;s>0&&o>0&&(l+o+1>n&&(o=Math.max(1,n-l)),i.push(t.substring(s-=o,s+o)),!((l+=o+1)>n));)o=e[a=(a+1)%e.length];return i.reverse().join(r)}),s=void 0===t.currency?"":t.currency[0]+"",i=void 0===t.currency?"":t.currency[1]+"",a=void 0===t.decimal?".":t.decimal+"",o=void 0===t.numerals?Ls:function(t){return function(e){return e.replace(/[0-9]/g,function(e){return t[+e]})}}(Ks.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=Ds(t)).fill,r=t.align,u=t.sign,d=t.symbol,f=t.zero,p=t.width,m=t.comma,b=t.precision,g=t.trim,v=t.type;"n"===v?(m=!0,v="g"):Hs[v]||(void 0===b&&(b=12),g=!0,v="g"),(f||"0"===e&&"="===r)&&(f=!0,e="0",r="=");var y="$"===d?s:"#"===d&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",w="$"===d?i:/[%p]/.test(v)?l:"",x=Hs[v],k=/[defgprs%]/.test(v);function $(t){var s,i,l,d=y,$=w;if("c"===v)$=x(t)+$,t="";else{var _=(t=+t)<0||1/t<0;if(t=isNaN(t)?h:x(Math.abs(t),b),g&&(t=function(t){t:for(var e,r=t.length,n=1,s=-1;n<r;++n)switch(t[n]){case".":s=e=n;break;case"0":0===s&&(s=n),e=n;break;default:if(!+t[n])break t;s>0&&(s=0)}return s>0?t.slice(0,s)+t.slice(e+1):t}(t)),_&&0===+t&&"+"!==u&&(_=!1),d=(_?"("===u?u:c:"-"===u||"("===u?"":u)+d,$=("s"===v?Zs[8+Os/3]:"")+$+(_&&"("===u?")":""),k)for(s=-1,i=t.length;++s<i;)if(48>(l=t.charCodeAt(s))||l>57){$=(46===l?a+t.slice(s+1):t.slice(s))+$,t=t.slice(0,s);break}}m&&!f&&(t=n(t,1/0));var S=d.length+t.length+$.length,M=S<p?new Array(p-S+1).join(e):"";switch(m&&f&&(t=n(M+t,M.length?p-$.length:1/0),M=""),r){case"<":t=d+t+$+M;break;case"=":t=d+M+t+$;break;case"^":t=M.slice(0,S=M.length>>1)+d+t+$+M.slice(S);break;default:t=M+d+t+$}return o(t)}return b=void 0===b?6:/[gprs]/.test(v)?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=Ds(t)).type="f",t)),n=3*Math.max(-8,Math.min(8,Math.floor(zs(e)/3))),s=Math.pow(10,-n),i=Zs[8+n/3];return function(t){return r(s*t)+i}}}}Vs=Ws({thousands:",",grouping:[3],currency:["$",""]}),Bs=Vs.format,Xs=Vs.formatPrefix;var Ys=1e-6,Gs=Math.PI,Qs=2*Gs,Js=180/Gs,ti=Gs/180,ei=Math.abs,ri=Math.cos,ni=Math.sin,si=Math.sqrt;function ii(){}function ai(t,e){t&&li.hasOwnProperty(t.type)&&li[t.type](t,e)}var oi={Feature:function(t,e){ai(t.geometry,e)},FeatureCollection:function(t,e){for(var r=t.features,n=-1,s=r.length;++n<s;)ai(r[n].geometry,e)}},li={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,s=r.length;++n<s;)t=r[n],e.point(t[0],t[1],t[2])},LineString:function(t,e){ci(t.coordinates,e,0)},MultiLineString:function(t,e){for(var r=t.coordinates,n=-1,s=r.length;++n<s;)ci(r[n],e,0)},Polygon:function(t,e){hi(t.coordinates,e)},MultiPolygon:function(t,e){for(var r=t.coordinates,n=-1,s=r.length;++n<s;)hi(r[n],e)},GeometryCollection:function(t,e){for(var r=t.geometries,n=-1,s=r.length;++n<s;)ai(r[n],e)}};function ci(t,e,r){var n,s=-1,i=t.length-r;for(e.lineStart();++s<i;)n=t[s],e.point(n[0],n[1],n[2]);e.lineEnd()}function hi(t,e){var r=-1,n=t.length;for(e.polygonStart();++r<n;)ci(t[r],e,1);e.polygonEnd()}function ui(t,e){t&&oi.hasOwnProperty(t.type)?oi[t.type](t,e):ai(t,e)}function di(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 fi(t,e,r,n,s){var i,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 ei(t[0]-e[0])<Ys&&ei(t[1]-e[1])<Ys}(n,a)){if(!n[2]&&!a[2]){for(s.lineStart(),i=0;i<e;++i)s.point((n=t[i])[0],n[1]);return void s.lineEnd()}a[0]+=2e-6}o.push(r=new di(n,t,null,!0)),l.push(r.o=new di(n,null,r,!1)),o.push(r=new di(a,t,null,!1)),l.push(r.o=new di(a,null,r,!0))}}),o.length){for(l.sort(e),pi(o),pi(l),i=0,a=l.length;i<a;++i)l[i].e=r=!r;for(var c,h,u=o[0];;){for(var d=u,f=!0;d.v;)if((d=d.n)===u)return;c=d.z,s.lineStart();do{if(d.v=d.o.v=!0,d.e){if(f)for(i=0,a=c.length;i<a;++i)s.point((h=c[i])[0],h[1]);else n(d.x,d.n.x,1,s);d=d.n}else{if(f)for(c=d.p.z,i=c.length-1;i>=0;--i)s.point((h=c[i])[0],h[1]);else n(d.x,d.p.x,-1,s);d=d.p}c=(d=d.o).z,f=!f}while(!d.v);s.lineEnd()}}}function pi(t){if(e=t.length){for(var e,r,n=0,s=t[0];++n<e;)s.n=r=t[n],r.p=s,s=r;s.n=r=t[0],r.p=s}}var mi=1e9,bi=-mi;function gi(t,e,r,n){function s(s,i){return t<=s&&s<=r&&e<=i&&i<=n}function i(s,i,o,c){var h=0,u=0;if(null==s||(h=a(s,o))!==(u=a(i,o))||l(s,i)<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(i[0],i[1])}function a(n,s){return ei(n[0]-t)<Ys?s>0?0:3:ei(n[0]-r)<Ys?s>0?2:1:ei(n[1]-e)<Ys?s>0?1:0:s>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,f,p,m,b,g,v,y=a,w=function(){var t,e=[];return{point:function(e,r,n){t.push([e,r,n])},lineStart:function(){e.push(t=[])},lineEnd:ii,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var r=e;return e=[],t=null,r}}}(),x={point:k,lineStart:function(){x.point=$,c&&c.push(h=[]);g=!0,b=!1,p=m=NaN},lineEnd:function(){l&&($(u,d),f&&b&&w.rejoin(),l.push(w.result()));x.point=k,b&&y.lineEnd()},polygonStart:function(){y=w,l=[],c=[],v=!0},polygonEnd:function(){var e=function(){for(var e=0,r=0,s=c.length;r<s;++r)for(var i,a,o=c[r],l=1,h=o.length,u=o[0],d=u[0],f=u[1];l<h;++l)i=d,a=f,d=(u=o[l])[0],f=u[1],a<=n?f>n&&(d-i)*(n-a)>(f-a)*(t-i)&&++e:f<=n&&(d-i)*(n-a)<(f-a)*(t-i)&&--e;return e}(),r=v&&e,s=(u=l,l=Array.from(function*(t){for(const e of t)yield*e}(u))).length;var u;(r||s)&&(a.polygonStart(),r&&(a.lineStart(),i(null,null,1,a),a.lineEnd()),s&&fi(l,o,e,i,a),a.polygonEnd());y=a,l=c=h=null}};function k(t,e){s(t,e)&&y.point(t,e)}function $(i,a){var o=s(i,a);if(c&&h.push([i,a]),g)u=i,d=a,f=o,g=!1,o&&(y.lineStart(),y.point(i,a));else if(o&&b)y.point(i,a);else{var l=[p=Math.max(bi,Math.min(mi,p)),m=Math.max(bi,Math.min(mi,m))],w=[i=Math.max(bi,Math.min(mi,i)),a=Math.max(bi,Math.min(mi,a))];!function(t,e,r,n,s,i){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=s-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=i-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(i,a),v=!1):(b||(y.lineStart(),y.point(l[0],l[1])),y.point(w[0],w[1]),o||y.lineEnd(),v=!1)}p=i,m=a,b=o}return x}}var vi,yi,wi,xi,ki=t=>t,$i=new vt,_i=new vt,Si={point:ii,lineStart:ii,lineEnd:ii,polygonStart:function(){Si.lineStart=Mi,Si.lineEnd=Ni},polygonEnd:function(){Si.lineStart=Si.lineEnd=Si.point=ii,$i.add(ei(_i)),_i=new vt},result:function(){var t=$i/2;return $i=new vt,t}};function Mi(){Si.point=Ai}function Ai(t,e){Si.point=Ei,vi=wi=t,yi=xi=e}function Ei(t,e){_i.add(xi*t-wi*e),wi=t,xi=e}function Ni(){Ei(vi,yi)}var Ti=1/0,Ci=Ti,Ri=-Ti,Pi=Ri,qi={point:function(t,e){t<Ti&&(Ti=t);t>Ri&&(Ri=t);e<Ci&&(Ci=e);e>Pi&&(Pi=e)},lineStart:ii,lineEnd:ii,polygonStart:ii,polygonEnd:ii,result:function(){var t=[[Ti,Ci],[Ri,Pi]];return Ri=Pi=-(Ci=Ti=1/0),t}};var Fi,zi,Oi,Ii,Di=0,Ui=0,ji=0,Hi=0,Li=0,Vi=0,Bi=0,Xi=0,Ki=0,Zi={point:Wi,lineStart:Yi,lineEnd:Ji,polygonStart:function(){Zi.lineStart=ta,Zi.lineEnd=ea},polygonEnd:function(){Zi.point=Wi,Zi.lineStart=Yi,Zi.lineEnd=Ji},result:function(){var t=Ki?[Bi/Ki,Xi/Ki]:Vi?[Hi/Vi,Li/Vi]:ji?[Di/ji,Ui/ji]:[NaN,NaN];return Di=Ui=ji=Hi=Li=Vi=Bi=Xi=Ki=0,t}};function Wi(t,e){Di+=t,Ui+=e,++ji}function Yi(){Zi.point=Gi}function Gi(t,e){Zi.point=Qi,Wi(Oi=t,Ii=e)}function Qi(t,e){var r=t-Oi,n=e-Ii,s=si(r*r+n*n);Hi+=s*(Oi+t)/2,Li+=s*(Ii+e)/2,Vi+=s,Wi(Oi=t,Ii=e)}function Ji(){Zi.point=Wi}function ta(){Zi.point=ra}function ea(){na(Fi,zi)}function ra(t,e){Zi.point=na,Wi(Fi=Oi=t,zi=Ii=e)}function na(t,e){var r=t-Oi,n=e-Ii,s=si(r*r+n*n);Hi+=s*(Oi+t)/2,Li+=s*(Ii+e)/2,Vi+=s,Bi+=(s=Ii*t-Oi*e)*(Oi+t),Xi+=s*(Ii+e),Ki+=3*s,Wi(Oi=t,Ii=e)}function sa(t){this._context=t}sa.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,Qs)}},result:ii};var ia,aa,oa,la,ca,ha=new vt,ua={point:ii,lineStart:function(){ua.point=da},lineEnd:function(){ia&&fa(aa,oa),ua.point=ii},polygonStart:function(){ia=!0},polygonEnd:function(){ia=null},result:function(){var t=+ha;return ha=new vt,t}};function da(t,e){ua.point=fa,aa=la=t,oa=ca=e}function fa(t,e){la-=t,ca-=e,ha.add(si(la*la+ca*ca)),la=t,ca=e}let pa,ma,ba,ga;class va{constructor(t){this._append=null==t?ya:function(t){const e=Math.floor(t);if(!(e>=0))throw new RangeError(`invalid digits: ${t}`);if(e>15)return ya;if(e!==pa){const t=10**e;pa=e,ma=function(e){let r=1;this._+=e[0];for(const n=e.length;r<n;++r)this._+=Math.round(arguments[r]*t)/t+e[r]}}return ma}(t),this._radius=4.5,this._=""}pointRadius(t){return this._radius=+t,this}polygonStart(){this._line=0}polygonEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){0===this._line&&(this._+="Z"),this._point=NaN}point(t,e){switch(this._point){case 0:this._append`M${t},${e}`,this._point=1;break;case 1:this._append`L${t},${e}`;break;default:if(this._append`M${t},${e}`,this._radius!==ba||this._append!==ma){const t=this._radius,e=this._;this._="",this._append`m0,${t}a${t},${t} 0 1,1 0,${-2*t}a${t},${t} 0 1,1 0,${2*t}z`,ba=t,ma=this._append,ga=this._,this._=e}this._+=ga}}result(){const t=this._;return this._="",t.length?t:null}}function ya(t){let e=1;this._+=t[0];for(const r=t.length;e<r;++e)this._+=arguments[e]+t[e]}function wa(t,e){let r,n,s=3,i=4.5;function a(t){return t&&("function"==typeof i&&n.pointRadius(+i.apply(this,arguments)),ui(t,r(n))),n.result()}return a.area=function(t){return ui(t,r(Si)),Si.result()},a.measure=function(t){return ui(t,r(ua)),ua.result()},a.bounds=function(t){return ui(t,r(qi)),qi.result()},a.centroid=function(t){return ui(t,r(Zi)),Zi.result()},a.projection=function(e){return arguments.length?(r=null==e?(t=null,ki):(t=e).stream,a):t},a.context=function(t){return arguments.length?(n=null==t?(e=null,new va(s)):new sa(e=t),"function"!=typeof i&&n.pointRadius(i),a):e},a.pointRadius=function(t){return arguments.length?(i="function"==typeof t?t:(n.pointRadius(+t),+t),a):i},a.digits=function(t){if(!arguments.length)return s;if(null==t)s=null;else{const e=Math.floor(t);if(!(e>=0))throw new RangeError(`invalid digits: ${t}`);s=e}return null===e&&(n=new va(s)),a},a.projection(t).digits(s).context(e)}function xa(){}function ka(t,e,r){var n=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=n&&t.clipExtent(null),ui(r,t.stream(qi)),e(qi.result()),null!=n&&t.clipExtent(n),t}function $a(t,e,r){return ka(t,function(r){var n=e[1][0]-e[0][0],s=e[1][1]-e[0][1],i=Math.min(n/(r[1][0]-r[0][0]),s/(r[1][1]-r[0][1])),a=+e[0][0]+(n-i*(r[1][0]+r[0][0]))/2,o=+e[0][1]+(s-i*(r[1][1]+r[0][1]))/2;t.scale(150*i).translate([a,o])},r)}function _a(){var t,e,r,n,s,i,a,o,l=1,c=0,h=0,u=1,d=1,f=0,p=null,m=1,b=1,g=(o={point:function(t,e){var r=w([t,e]);this.stream.point(r[0],r[1])}},function(t){var e=new xa;for(var r in o)e[r]=o[r];return e.stream=t,e}),v=ki;function y(){return m=l*u,b=l*d,i=a=null,w}function w(r){var n=r[0]*m,s=r[1]*b;if(f){var i=s*t-n*e;n=n*t+s*e,s=i}return[n+c,s+h]}return w.invert=function(r){var n=r[0]-c,s=r[1]-h;if(f){var i=s*t+n*e;n=n*t-s*e,s=i}return[n/m,s/b]},w.stream=function(t){return i&&a===t?i:i=g(v(a=t))},w.postclip=function(t){return arguments.length?(v=t,p=r=n=s=null,y()):v},w.clipExtent=function(t){return arguments.length?(v=null==t?(p=r=n=s=null,ki):gi(p=+t[0][0],r=+t[0][1],n=+t[1][0],s=+t[1][1]),y()):null==p?null:[[p,r],[n,s]]},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=ni(f=r%360*ti),t=ri(f),y()):f*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 $a(w,t,e)},w.fitSize=function(t,e){return function(t,e,r){return $a(t,[[0,0],e],r)}(w,t,e)},w.fitWidth=function(t,e){return function(t,e,r){return ka(t,function(r){var n=+e,s=n/(r[1][0]-r[0][0]),i=(n-s*(r[1][0]+r[0][0]))/2,a=-s*r[0][1];t.scale(150*s).translate([i,a])},r)}(w,t,e)},w.fitHeight=function(t,e){return function(t,e,r){return ka(t,function(r){var n=+e,s=n/(r[1][1]-r[0][1]),i=-s*r[0][0],a=(n-s*(r[1][1]+r[0][1]))/2;t.scale(150*s).translate([i,a])},r)}(w,t,e)},w}function Sa(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}function Ma(t){return+t}xa.prototype={constructor:xa,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 Aa=[0,1];function Ea(t){return t}function Na(t,e){return(e-=t=+t)?function(r){return(r-t)/e}:function(t){return function(){return t}}(isNaN(e)?NaN:.5)}function Ta(t,e,r){var n=t[0],s=t[1],i=e[0],a=e[1];return s<n?(n=Na(s,n),i=r(a,i)):(n=Na(n,s),i=r(i,a)),function(t){return i(n(t))}}function Ca(t,e,r){var n=Math.min(t.length,e.length)-1,s=new Array(n),i=new Array(n),a=-1;for(t[n]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++a<n;)s[a]=Na(t[a],t[a+1]),i[a]=r(e[a],e[a+1]);return function(e){var r=bt(t,e,1,n)-1;return i[r](s[r](e))}}function Ra(){var t,e,r,n,s,i,a=Aa,o=Aa,l=hn,c=Ea;function h(){var t=Math.min(a.length,o.length);return c!==Ea&&(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?Ca:Ta,s=i=null,u}function u(e){return null==e||isNaN(e=+e)?r:(s||(s=n(a.map(t),o,l)))(t(c(e)))}return u.invert=function(r){return c(e((i||(i=n(o,a.map(t),sn)))(r)))},u.domain=function(t){return arguments.length?(a=Array.from(t,Ma),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=un,h()},u.clamp=function(t){return arguments.length?(c=!!t||Ea,h()):c!==Ea},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 Pa(t,e,r,n){var s,i=function(t,e,r){r=+r;const n=(e=+e)<(t=+t),s=n?At(e,t,r):At(t,e,r);return(n?-1:1)*(s<0?1/-s:s)}(t,e,r);switch((n=Ds(null==n?",f":n)).type){case"s":var a=Math.max(Math.abs(t),Math.abs(e));return null!=n.precision||isNaN(s=function(t,e){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(zs(e)/3)))-zs(Math.abs(t)))}(i,a))||(n.precision=s),Xs(n,a);case"":case"e":case"g":case"p":case"r":null!=n.precision||isNaN(s=function(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,zs(e)-zs(t))+1}(i,Math.max(Math.abs(t),Math.abs(e))))||(n.precision=s-("e"===n.type));break;case"f":case"%":null!=n.precision||isNaN(s=function(t){return Math.max(0,-zs(Math.abs(t)))}(i))||(n.precision=s-2*("%"===n.type))}return Bs(n)}function qa(){var t=Ra()(Ea,Ea);return t.copy=function(){return e=t,qa().domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown());var e},Sa.apply(t,arguments),function(t){var e=t.domain;return t.ticks=function(t){var r=e();return Mt(r[0],r[r.length-1],null==t?10:t)},t.tickFormat=function(t,r){var n=e();return Pa(n[0],n[n.length-1],null==t?10:t,r)},t.nice=function(r){null==r&&(r=10);var n,s,i=e(),a=0,o=i.length-1,l=i[a],c=i[o],h=10;for(c<l&&(s=l,l=c,c=s,s=a,a=o,o=s);h-- >0;){if((s=At(l,c,r))===n)return i[a]=l,i[o]=c,e(i);if(s>0)l=Math.floor(l/s)*s,c=Math.ceil(c/s)*s;else{if(!(s<0))break;l=Math.ceil(l*s)/s,c=Math.floor(c*s)/s}n=s}return t},t}(t)}function Fa(t){return function(){return t}}function za(t){this._context=t}function Oa(t){return new za(t)}function Ia(t){return t[0]}function Da(t){return t[1]}function Ua(t,e){var r=Fa(!0),n=null,s=Oa,i=null,a=function(t){let e=3;return t.digits=function(r){if(!arguments.length)return e;if(null==r)e=null;else{const t=Math.floor(r);if(!(t>=0))throw new RangeError(`invalid digits: ${r}`);e=t}return t},()=>new xs(e)}(o);function o(o){var l,c,h,u=(o=function(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}(o)).length,d=!1;for(null==n&&(i=s(h=a())),l=0;l<=u;++l)!(l<u&&r(c=o[l],l,o))===d&&((d=!d)?i.lineStart():i.lineEnd()),d&&i.point(+t(c,l,o),+e(c,l,o));if(h)return i=null,h+""||null}return t="function"==typeof t?t:void 0===t?Ia:Fa(t),e="function"==typeof e?e:void 0===e?Da:Fa(e),o.x=function(e){return arguments.length?(t="function"==typeof e?e:Fa(+e),o):t},o.y=function(t){return arguments.length?(e="function"==typeof t?t:Fa(+t),o):e},o.defined=function(t){return arguments.length?(r="function"==typeof t?t:Fa(!!t),o):r},o.curve=function(t){return arguments.length?(s=t,null!=n&&(i=s(n)),o):s},o.context=function(t){return arguments.length?(null==t?n=i=null:i=s(n=t),o):n},o}function ja(t,e,r){this.k=t,this.x=e,this.y=r}za.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)}}},ja.prototype={constructor:ja,scale:function(t){return 1===t?this:new ja(this.k*t,this.x,this.y)},translate:function(t,e){return 0===t&0===e?this:new ja(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+")"}},ja.prototype;class Ha extends ht{getComputedStyleValue(t){return getComputedStyle(this).getPropertyValue(t).trim()}firstUpdated(t){super.firstUpdated(t),sr(this.renderRoot.host).classed("keyboard",!0).on("mousemove.keyboard touchstart.keyboard",t=>{sr(t.currentTarget.renderRoot.host).classed("keyboard",!1).on("mousemove.keyboard touchstart.keyboard",null)}).on("keydown.keyboard",t=>{sr(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=tn(t,"#ffffff")(.75),e.light50=tn(t,"#ffffff")(.5),e.light25=tn(t,"#ffffff")(.25),e.grey=t,e.dark25=tn(t,"#000000")(.25),e.dark50=tn(t,"#000000")(.5),e.dark75=tn(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,s=this.shadows.opacityPenumbra+this.shadows.opacityBoost,i=this.shadows.opacityAmbient+this.shadows.opacityBoost,a=r?`rgba(${this.shadows.inverseBaselineColorString}, ${n})`:`rgba(${this.shadows.baselineColorString}, ${n})`,o=r?`rgba(${this.shadows.inverseBaselineColorString}, ${s})`:`rgba(${this.shadows.baselineColorString}, ${s})`,l=r?`rgba(${this.shadows.inverseBaselineColorString}, ${i})`:`rgba(${this.shadows.baselineColorString}, ${i})`,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=Ha.shadows,e=t.elevations.map(e=>B`
|
|
22
|
+
*/class ht extends k{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=lt(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return X}}ht._$litElement$=!0,ht.finalized=!0,ct.litElementHydrateSupport?.({LitElement:ht});const ut=ct.litElementPolyfillSupport;function dt(t,e){return null==t||null==e?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function ft(t,e){return null==t||null==e?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function pt(t){let e,r,n;function i(t,n,i=0,s=t.length){if(i<s){if(0!==e(n,n))return s;do{const e=i+s>>>1;r(t[e],n)<0?i=e+1:s=e}while(i<s)}return i}return 2!==t.length?(e=dt,r=(e,r)=>dt(t(e),r),n=(e,r)=>t(e)-r):(e=t===dt||t===ft?t:mt,r=t,n=t),{left:i,center:function(t,e,r=0,s=t.length){const a=i(t,e,r,s-1);return a>r&&n(t[a-1],e)>-n(t[a],e)?a-1:a},right:function(t,n,i=0,s=t.length){if(i<s){if(0!==e(n,n))return s;do{const e=i+s>>>1;r(t[e],n)<=0?i=e+1:s=e}while(i<s)}return i}}}function mt(){return 0}ut?.({LitElement:ht}),(ct.litElementVersions??=[]).push("4.2.1");const bt=pt(dt).right;function gt(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]}pt(function(t){return null===t?NaN:+t}).center;class vt{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 yt(t){return t}var wt=Array.prototype.slice;function xt(t){return()=>t}const $t=Math.sqrt(50),kt=Math.sqrt(10),_t=Math.sqrt(2);function St(t,e,r){const n=(e-t)/Math.max(0,r),i=Math.floor(Math.log10(n)),s=n/Math.pow(10,i),a=s>=$t?10:s>=kt?5:s>=_t?2:1;let o,l,c;return i<0?(c=Math.pow(10,-i)/a,o=Math.round(t*c),l=Math.round(e*c),o/c<t&&++o,l/c>e&&--l,c=-c):(c=Math.pow(10,i)*a,o=Math.round(t/c),l=Math.round(e/c),o*c<t&&++o,l*c>e&&--l),l<o&&.5<=r&&r<2?St(t,e,2*r):[o,l,c]}function Mt(t,e,r){if(!((r=+r)>0))return[];if((t=+t)===(e=+e))return[t];const n=e<t,[i,s,a]=n?St(e,t,r):St(t,e,r);if(!(s>=i))return[];const o=s-i+1,l=new Array(o);if(n)if(a<0)for(let t=0;t<o;++t)l[t]=(s-t)/-a;else for(let t=0;t<o;++t)l[t]=(s-t)*a;else if(a<0)for(let t=0;t<o;++t)l[t]=(i+t)/-a;else for(let t=0;t<o;++t)l[t]=(i+t)*a;return l}function At(t,e,r){return St(t=+t,e=+e,r=+r)[2]}function Et(t,e,r){let n;for(;;){const i=At(t,e,r);if(i===n||0===i||!isFinite(i))return[t,e];i>0?(t=Math.floor(t/i)*i,e=Math.ceil(e/i)*i):i<0&&(t=Math.ceil(t*i)/i,e=Math.floor(e*i)/i),n=i}}function Nt(t){return Math.max(1,Math.ceil(Math.log(function(t){let e=0;for(let r of t)null!=r&&(r=+r)>=r&&++e;return e}(t))/Math.LN2)+1)}function Tt(t,e,r){t=+t,e=+e,r=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+r;for(var n=-1,i=0|Math.max(0,Math.ceil((e-t)/r)),s=new Array(i);++n<i;)s[n]=t+n*r;return s}function Ct(t){return t}var Pt=1e-6;function Rt(t){return"translate("+t+",0)"}function qt(t){return"translate(0,"+t+")"}function Ft(t){return e=>+t(e)}function zt(t,e){return e=Math.max(0,t.bandwidth()-2*e)/2,t.round()&&(e=Math.round(e)),r=>+t(r)+e}function Ot(){return!this.__axis}function It(t,e){var r=[],n=null,i=null,s=6,a=6,o=3,l="undefined"!=typeof window&&window.devicePixelRatio>1?0:.5,c=1===t||4===t?-1:1,h=4===t||2===t?"x":"y",u=1===t||3===t?Rt:qt;function d(d){var f=null==n?e.ticks?e.ticks.apply(e,r):e.domain():n,p=null==i?e.tickFormat?e.tickFormat.apply(e,r):Ct:i,m=Math.max(s,0)+o,b=e.range(),g=+b[0]+l,v=+b[b.length-1]+l,y=(e.bandwidth?zt:Ft)(e.copy(),l),w=d.selection?d.selection():d,x=w.selectAll(".domain").data([null]),$=w.selectAll(".tick").data(f,e).order(),k=$.exit(),_=$.enter().append("g").attr("class","tick"),S=$.select("line"),M=$.select("text");x=x.merge(x.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),$=$.merge(_),S=S.merge(_.append("line").attr("stroke","currentColor").attr(h+"2",c*s)),M=M.merge(_.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),M=M.transition(d),k=k.transition(d).attr("opacity",Pt).attr("transform",function(t){return isFinite(t=y(t))?u(t+l):this.getAttribute("transform")}),_.attr("opacity",Pt).attr("transform",function(t){var e=this.parentNode.__axis;return u((e&&isFinite(e=e(t))?e:y(t))+l)})),k.remove(),x.attr("d",4===t||2===t?a?"M"+c*a+","+g+"H"+l+"V"+v+"H"+c*a:"M"+l+","+g+"V"+v:a?"M"+g+","+c*a+"V"+l+"H"+v+"V"+c*a:"M"+g+","+l+"H"+v),$.attr("opacity",1).attr("transform",function(t){return u(y(t)+l)}),S.attr(h+"2",c*s),M.attr(h,c*m).text(p),w.filter(Ot).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 Dt(t){return It(3,t)}function Ut(t){return It(4,t)}var jt={value:()=>{}};function Lt(){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 Ht(n)}function Ht(t){this._=t}function Vt(t,e){for(var r,n=0,i=t.length;n<i;++n)if((r=t[n]).name===e)return r.value}function Bt(t,e,r){for(var n=0,i=t.length;n<i;++n)if(t[n].name===e){t[n]=jt,t=t.slice(0,n).concat(t.slice(n+1));break}return null!=r&&t.push({name:e,value:r}),t}Ht.prototype=Lt.prototype={constructor:Ht,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]=Bt(i[r],t.name,e);else if(null==e)for(r in i)i[r]=Bt(i[r],t.name,null);return this}for(;++a<o;)if((r=(t=s[a]).type)&&(r=Vt(i[r],t.name)))return r},copy:function(){var t={},e=this._;for(var r in e)t[r]=e[r].slice();return new Ht(t)},call:function(t,e){if((r=arguments.length-2)>0)for(var r,n,i=new Array(r),s=0;s<r;++s)i[s]=arguments[s+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(s=0,r=(n=this._[t]).length;s<r;++s)n[s].value.apply(e,i)},apply:function(t,e,r){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var n=this._[t],i=0,s=n.length;i<s;++i)n[i].value.apply(e,r)}};var Xt="http://www.w3.org/1999/xhtml",Kt={svg:"http://www.w3.org/2000/svg",xhtml:Xt,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Zt(t){var e=t+="",r=e.indexOf(":");return r>=0&&"xmlns"!==(e=t.slice(0,r))&&(t=t.slice(r+1)),Kt.hasOwnProperty(e)?{space:Kt[e],local:t}:t}function Wt(t){return function(){var e=this.ownerDocument,r=this.namespaceURI;return r===Xt&&e.documentElement.namespaceURI===Xt?e.createElement(t):e.createElementNS(r,t)}}function Yt(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function Gt(t){var e=Zt(t);return(e.local?Yt:Wt)(e)}function Qt(){}function Jt(t){return null==t?Qt:function(){return this.querySelector(t)}}function te(){return[]}function ee(t){return null==t?te:function(){return this.querySelectorAll(t)}}function re(t){return function(){return function(t){return null==t?[]:Array.isArray(t)?t:Array.from(t)}(t.apply(this,arguments))}}function ne(t){return function(){return this.matches(t)}}function ie(t){return function(e){return e.matches(t)}}var se=Array.prototype.find;function ae(){return this.firstElementChild}var oe=Array.prototype.filter;function le(){return Array.from(this.children)}function ce(t){return new Array(t.length)}function he(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function ue(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 he(t,s[o]);for(;o<l;++o)(a=e[o])&&(i[o]=a)}function de(t,e,r,n,i,s,a){var o,l,c,h=new Map,u=e.length,d=s.length,f=new Array(u);for(o=0;o<u;++o)(l=e[o])&&(f[o]=c=a.call(l,l.__data__,o,e)+"",h.has(c)?i[o]=l:h.set(c,l));for(o=0;o<d;++o)c=a.call(t,s[o],o,s)+"",(l=h.get(c))?(n[o]=l,l.__data__=s[o],h.delete(c)):r[o]=new he(t,s[o]);for(o=0;o<u;++o)(l=e[o])&&h.get(f[o])===l&&(i[o]=l)}function fe(t){return t.__data__}function pe(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function me(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function be(t){return function(){this.removeAttribute(t)}}function ge(t){return function(){this.removeAttributeNS(t.space,t.local)}}function ve(t,e){return function(){this.setAttribute(t,e)}}function ye(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function we(t,e){return function(){var r=e.apply(this,arguments);null==r?this.removeAttribute(t):this.setAttribute(t,r)}}function xe(t,e){return function(){var r=e.apply(this,arguments);null==r?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,r)}}function $e(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function ke(t){return function(){this.style.removeProperty(t)}}function _e(t,e,r){return function(){this.style.setProperty(t,e,r)}}function Se(t,e,r){return function(){var n=e.apply(this,arguments);null==n?this.style.removeProperty(t):this.style.setProperty(t,n,r)}}function Me(t,e){return t.style.getPropertyValue(e)||$e(t).getComputedStyle(t,null).getPropertyValue(e)}function Ae(t){return function(){delete this[t]}}function Ee(t,e){return function(){this[t]=e}}function Ne(t,e){return function(){var r=e.apply(this,arguments);null==r?delete this[t]:this[t]=r}}function Te(t){return t.trim().split(/^|\s+/)}function Ce(t){return t.classList||new Pe(t)}function Pe(t){this._node=t,this._names=Te(t.getAttribute("class")||"")}function Re(t,e){for(var r=Ce(t),n=-1,i=e.length;++n<i;)r.add(e[n])}function qe(t,e){for(var r=Ce(t),n=-1,i=e.length;++n<i;)r.remove(e[n])}function Fe(t){return function(){Re(this,t)}}function ze(t){return function(){qe(this,t)}}function Oe(t,e){return function(){(e.apply(this,arguments)?Re:qe)(this,t)}}function Ie(){this.textContent=""}function De(t){return function(){this.textContent=t}}function Ue(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}function je(){this.innerHTML=""}function Le(t){return function(){this.innerHTML=t}}function He(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}function Ve(){this.nextSibling&&this.parentNode.appendChild(this)}function Be(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Xe(){return null}function Ke(){var t=this.parentNode;t&&t.removeChild(this)}function Ze(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function We(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Ye(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 Ge(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 Qe(t,e,r){var n=$e(t),i=n.CustomEvent;"function"==typeof i?i=new i(e,r):(i=n.document.createEvent("Event"),r?(i.initEvent(e,r.bubbles,r.cancelable),i.detail=r.detail):i.initEvent(e,!1,!1)),t.dispatchEvent(i)}function Je(t,e){return function(){return Qe(this,t,e)}}function tr(t,e){return function(){return Qe(this,t,e.apply(this,arguments))}}he.prototype={constructor:he,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}},Pe.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var er=[null];function rr(t,e){this._groups=t,this._parents=e}function nr(){return new rr([[document.documentElement]],er)}function ir(t){return"string"==typeof t?new rr([[document.querySelector(t)]],[document.documentElement]):new rr([[t]],er)}function sr(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]}rr.prototype=nr.prototype={constructor:rr,select:function(t){"function"!=typeof t&&(t=Jt(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 rr(n,this._parents)},selectAll:function(t){t="function"==typeof t?re(t):ee(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 rr(n,i)},selectChild:function(t){return this.select(null==t?ae:function(t){return function(){return se.call(this.children,t)}}("function"==typeof t?t:ie(t)))},selectChildren:function(t){return this.selectAll(null==t?le:function(t){return function(){return oe.call(this.children,t)}}("function"==typeof t?t:ie(t)))},filter:function(t){"function"!=typeof t&&(t=ne(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 rr(n,this._parents)},data:function(t,e){if(!arguments.length)return Array.from(this,fe);var r=e?de:ue,n=this._parents,i=this._groups;"function"!=typeof t&&(t=function(t){return function(){return t}}(t));for(var s=i.length,a=new Array(s),o=new Array(s),l=new Array(s),c=0;c<s;++c){var h=n[c],u=i[c],d=u.length,f=pe(t.call(h,h&&h.__data__,c,n)),p=f.length,m=o[c]=new Array(p),b=a[c]=new Array(p);r(h,u,m,b,l[c]=new Array(d),f,e);for(var g,v,y=0,w=0;y<p;++y)if(g=m[y]){for(y>=w&&(w=y+1);!(v=b[w])&&++w<p;);g._next=v||null}}return(a=new rr(a,n))._enter=o,a._exit=l,a},enter:function(){return new rr(this._enter||this._groups.map(ce),this._parents)},exit:function(){return new rr(this._exit||this._groups.map(ce),this._parents)},join:function(t,e,r){var n=this.enter(),i=this,s=this.exit();return"function"==typeof t?(n=t(n))&&(n=n.selection()):n=n.append(t+""),null!=e&&(i=e(i))&&(i=i.selection()),null==r?s.remove():r(s),n&&i?n.merge(i).order():i},merge:function(t){for(var e=t.selection?t.selection():t,r=this._groups,n=e._groups,i=r.length,s=n.length,a=Math.min(i,s),o=new Array(i),l=0;l<a;++l)for(var c,h=r[l],u=n[l],d=h.length,f=o[l]=new Array(d),p=0;p<d;++p)(c=h[p]||u[p])&&(f[p]=c);for(;l<i;++l)o[l]=r[l];return new rr(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=me);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 rr(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=Zt(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?ge:be:"function"==typeof e?r.local?xe:we:r.local?ye:ve)(r,e))},style:function(t,e,r){return arguments.length>1?this.each((null==e?ke:"function"==typeof e?Se:_e)(t,e,null==r?"":r)):Me(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?Ae:"function"==typeof e?Ne:Ee)(t,e)):this.node()[t]},classed:function(t,e){var r=Te(t+"");if(arguments.length<2){for(var n=Ce(this.node()),i=-1,s=r.length;++i<s;)if(!n.contains(r[i]))return!1;return!0}return this.each(("function"==typeof e?Oe:e?Fe:ze)(r,e))},text:function(t){return arguments.length?this.each(null==t?Ie:("function"==typeof t?Ue:De)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?je:("function"==typeof t?He:Le)(t)):this.node().innerHTML},raise:function(){return this.each(Ve)},lower:function(){return this.each(Be)},append:function(t){var e="function"==typeof t?t:Gt(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})},insert:function(t,e){var r="function"==typeof t?t:Gt(t),n=null==e?Xe:"function"==typeof e?e:Jt(e);return this.select(function(){return this.insertBefore(r.apply(this,arguments),n.apply(this,arguments)||null)})},remove:function(){return this.each(Ke)},clone:function(t){return this.select(t?We:Ze)},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?Ge:Ye,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?tr:Je)(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 ar={passive:!1},or={capture:!0,passive:!1};function lr(t){t.stopImmediatePropagation()}function cr(t){t.preventDefault(),t.stopImmediatePropagation()}var hr=t=>()=>t;function ur(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 dr(t){return!t.ctrlKey&&!t.button}function fr(){return this.parentNode}function pr(t,e){return null==e?{x:t.x,y:t.y}:e}function mr(){return navigator.maxTouchPoints||"ontouchstart"in this}function br(){var t,e,r,n,i=dr,s=fr,a=pr,o=mr,l={},c=Lt("start","drag","end"),h=0,u=0;function d(t){t.on("mousedown.drag",f).filter(o).on("touchstart.drag",b).on("touchmove.drag",g,ar).on("touchend.drag touchcancel.drag",v).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function f(a,o){if(!n&&i.call(this,a,o)){var l=y(this,s.call(this,a,o),a,o,"mouse");l&&(ir(a.view).on("mousemove.drag",p,or).on("mouseup.drag",m,or),function(t){var e=t.document.documentElement,r=ir(t).on("dragstart.drag",cr,or);"onselectstart"in e?r.on("selectstart.drag",cr,or):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}(a.view),lr(a),r=!1,t=a.clientX,e=a.clientY,l("start",a))}}function p(n){if(cr(n),!r){var i=n.clientX-t,s=n.clientY-e;r=i*i+s*s>u}l.mouse("drag",n)}function m(t){ir(t.view).on("mousemove.drag mouseup.drag",null),function(t,e){var r=t.document.documentElement,n=ir(t).on("dragstart.drag",null);e&&(n.on("click.drag",cr,or),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),cr(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]))&&(lr(t),n("start",t,a[r]))}}function g(t){var e,r,n=t.changedTouches,i=n.length;for(e=0;e<i;++e)(r=l[n[e].identifier])&&(cr(t),r("drag",t,n[e]))}function v(t){var e,r,i=t.changedTouches,s=i.length;for(n&&clearTimeout(n),n=setTimeout(function(){n=null},500),e=0;e<s;++e)(r=l[i[e].identifier])&&(lr(t),r("end",t,i[e]))}function y(t,e,r,n,i,s){var o,u,f,p=c.copy(),m=sr(s||r,e);if(null!=(f=a.call(t,new ur("beforestart",{sourceEvent:r,target:d,identifier:i,active:h,x:m[0],y:m[1],dx:0,dy:0,dispatch:p}),n)))return o=f.x-m[0]||0,u=f.y-m[1]||0,function r(s,a,c){var b,g=m;switch(s){case"start":l[i]=r,b=h++;break;case"end":delete l[i],--h;case"drag":m=sr(c||a,e),b=h}p.call(s,t,new ur(s,{sourceEvent:a,subject:f,target:d,identifier:i,active:b,x:m[0]+o,y:m[1]+u,dx:m[0]-g[0],dy:m[1]-g[1],dispatch:p}),n)}}return d.filter=function(t){return arguments.length?(i="function"==typeof t?t:hr(!!t),d):i},d.container=function(t){return arguments.length?(s="function"==typeof t?t:hr(t),d):s},d.subject=function(t){return arguments.length?(a="function"==typeof t?t:hr(t),d):a},d.touchable=function(t){return arguments.length?(o="function"==typeof t?t:hr(!!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 gr(t,e,r){t.prototype=e.prototype=r,r.constructor=t}function vr(t,e){var r=Object.create(t.prototype);for(var n in e)r[n]=e[n];return r}function yr(){}ur.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};var wr=.7,xr=1/wr,$r="\\s*([+-]?\\d+)\\s*",kr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",_r="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Sr=/^#([0-9a-f]{3,8})$/,Mr=new RegExp(`^rgb\\(${$r},${$r},${$r}\\)$`),Ar=new RegExp(`^rgb\\(${_r},${_r},${_r}\\)$`),Er=new RegExp(`^rgba\\(${$r},${$r},${$r},${kr}\\)$`),Nr=new RegExp(`^rgba\\(${_r},${_r},${_r},${kr}\\)$`),Tr=new RegExp(`^hsl\\(${kr},${_r},${_r}\\)$`),Cr=new RegExp(`^hsla\\(${kr},${_r},${_r},${kr}\\)$`),Pr={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Rr(){return this.rgb().formatHex()}function qr(){return this.rgb().formatRgb()}function Fr(t){var e,r;return t=(t+"").trim().toLowerCase(),(e=Sr.exec(t))?(r=e[1].length,e=parseInt(e[1],16),6===r?zr(e):3===r?new Dr(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===r?Or(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===r?Or(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=Mr.exec(t))?new Dr(e[1],e[2],e[3],1):(e=Ar.exec(t))?new Dr(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=Er.exec(t))?Or(e[1],e[2],e[3],e[4]):(e=Nr.exec(t))?Or(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=Tr.exec(t))?Br(e[1],e[2]/100,e[3]/100,1):(e=Cr.exec(t))?Br(e[1],e[2]/100,e[3]/100,e[4]):Pr.hasOwnProperty(t)?zr(Pr[t]):"transparent"===t?new Dr(NaN,NaN,NaN,0):null}function zr(t){return new Dr(t>>16&255,t>>8&255,255&t,1)}function Or(t,e,r,n){return n<=0&&(t=e=r=NaN),new Dr(t,e,r,n)}function Ir(t,e,r,n){return 1===arguments.length?function(t){return t instanceof yr||(t=Fr(t)),t?new Dr((t=t.rgb()).r,t.g,t.b,t.opacity):new Dr}(t):new Dr(t,e,r,null==n?1:n)}function Dr(t,e,r,n){this.r=+t,this.g=+e,this.b=+r,this.opacity=+n}function Ur(){return`#${Vr(this.r)}${Vr(this.g)}${Vr(this.b)}`}function jr(){const t=Lr(this.opacity);return`${1===t?"rgb(":"rgba("}${Hr(this.r)}, ${Hr(this.g)}, ${Hr(this.b)}${1===t?")":`, ${t})`}`}function Lr(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Hr(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Vr(t){return((t=Hr(t))<16?"0":"")+t.toString(16)}function Br(t,e,r,n){return n<=0?t=e=r=NaN:r<=0||r>=1?t=e=NaN:e<=0&&(t=NaN),new Kr(t,e,r,n)}function Xr(t){if(t instanceof Kr)return new Kr(t.h,t.s,t.l,t.opacity);if(t instanceof yr||(t=Fr(t)),!t)return new Kr;if(t instanceof Kr)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 Kr(a,o,l,t.opacity)}function Kr(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}function Zr(t){return(t=(t||0)%360)<0?t+360:t}function Wr(t){return Math.max(0,Math.min(1,t||0))}function Yr(t,e,r){return 255*(t<60?e+(r-e)*t/60:t<180?r:t<240?e+(r-e)*(240-t)/60:e)}gr(yr,Fr,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Rr,formatHex:Rr,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Xr(this).formatHsl()},formatRgb:qr,toString:qr}),gr(Dr,Ir,vr(yr,{brighter(t){return t=null==t?xr:Math.pow(xr,t),new Dr(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?wr:Math.pow(wr,t),new Dr(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Dr(Hr(this.r),Hr(this.g),Hr(this.b),Lr(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Ur,formatHex:Ur,formatHex8:function(){return`#${Vr(this.r)}${Vr(this.g)}${Vr(this.b)}${Vr(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:jr,toString:jr})),gr(Kr,function(t,e,r,n){return 1===arguments.length?Xr(t):new Kr(t,e,r,null==n?1:n)},vr(yr,{brighter(t){return t=null==t?xr:Math.pow(xr,t),new Kr(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?wr:Math.pow(wr,t),new Kr(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*e,i=2*r-n;return new Dr(Yr(t>=240?t-240:t+120,i,n),Yr(t,i,n),Yr(t<120?t+240:t-120,i,n),this.opacity)},clamp(){return new Kr(Zr(this.h),Wr(this.s),Wr(this.l),Lr(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=Lr(this.opacity);return`${1===t?"hsl(":"hsla("}${Zr(this.h)}, ${100*Wr(this.s)}%, ${100*Wr(this.l)}%${1===t?")":`, ${t})`}`}}));var Gr=t=>()=>t;function Qr(t){return 1===(t=+t)?Jr: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):Gr(isNaN(e)?r:e)}}function Jr(t,e){var r=e-t;return r?function(t,e){return function(r){return t+r*e}}(t,r):Gr(isNaN(t)?e:t)}var tn=function t(e){var r=Qr(e);function n(t,e){var n=r((t=Ir(t)).r,(e=Ir(e)).r),i=r(t.g,e.g),s=r(t.b,e.b),a=Jr(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 en(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 rn(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]=hn(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 nn(t,e){var r=new Date;return t=+t,e=+e,function(n){return r.setTime(t*(1-n)+e*n),r}}function sn(t,e){return t=+t,e=+e,function(r){return t*(1-r)+e*r}}function an(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]=hn(t[r],e[r]):i[r]=e[r];return function(t){for(r in n)i[r]=n[r](t);return i}}var on=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ln=new RegExp(on.source,"g");function cn(t,e){var r,n,i,s=on.lastIndex=ln.lastIndex=0,a=-1,o=[],l=[];for(t+="",e+="";(r=on.exec(t))&&(n=ln.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:sn(r,n)})),s=ln.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 hn(t,e){var r,n=typeof e;return null==e||"boolean"===n?Gr(e):("number"===n?sn:"string"===n?(r=Fr(e))?(e=r,tn):cn:e instanceof Fr?tn:e instanceof Date?nn:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}(e)?en:Array.isArray(e)?rn:"function"!=typeof e.valueOf&&"function"!=typeof e.toString||isNaN(e)?an:sn)(t,e)}function un(t,e){return t=+t,e=+e,function(r){return Math.round(t*(1-r)+e*r)}}var dn,fn=180/Math.PI,pn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function mn(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)*fn,skewX:Math.atan(l)*fn,scaleX:a,scaleY:o}}function bn(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:sn(t,i)},{i:l-2,x:sn(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:sn(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:sn(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:sn(t,r)},{i:o-2,x:sn(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 gn,vn,yn=bn(function(t){const e=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?pn:mn(e.a,e.b,e.c,e.d,e.e,e.f)},"px, ","px)","deg)"),wn=bn(function(t){return null==t?pn:(dn||(dn=document.createElementNS("http://www.w3.org/2000/svg","g")),dn.setAttribute("transform",t),(t=dn.transform.baseVal.consolidate())?mn((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):pn)},", ",")",")"),xn=0,$n=0,kn=0,_n=0,Sn=0,Mn=0,An="object"==typeof performance&&performance.now?performance:Date,En="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Nn(){return Sn||(En(Tn),Sn=An.now()+Mn)}function Tn(){Sn=0}function Cn(){this._call=this._time=this._next=null}function Pn(t,e,r){var n=new Cn;return n.restart(t,e,r),n}function Rn(){Sn=(_n=An.now())+Mn,xn=$n=0;try{!function(){Nn(),++xn;for(var t,e=gn;e;)(t=Sn-e._time)>=0&&e._call.call(void 0,t),e=e._next;--xn}()}finally{xn=0,function(){var t,e,r=gn,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:gn=e);vn=t,Fn(n)}(),Sn=0}}function qn(){var t=An.now(),e=t-_n;e>1e3&&(Mn-=e,_n=t)}function Fn(t){xn||($n&&($n=clearTimeout($n)),t-Sn>24?(t<1/0&&($n=setTimeout(Rn,t-An.now()-Mn)),kn&&(kn=clearInterval(kn))):(kn||(_n=An.now(),kn=setInterval(qn,1e3)),xn=1,En(Rn)))}function zn(t,e,r){var n=new Cn;return e=null==e?0:+e,n.restart(r=>{n.stop(),t(r+e)},e,r),n}Cn.prototype=Pn.prototype={constructor:Cn,restart:function(t,e,r){if("function"!=typeof t)throw new TypeError("callback is not a function");r=(null==r?Nn():+r)+(null==e?0:+e),this._next||vn===this||(vn?vn._next=this:gn=this,vn=this),this._call=t,this._time=r,Fn()},stop:function(){this._call&&(this._call=null,this._time=1/0,Fn())}};var On=Lt("start","end","cancel","interrupt"),In=[];function Dn(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 zn(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(zn(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=Pn(s,0,r.time)}(t,r,{name:e,index:n,group:i,on:On,tween:In,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:0})}function Un(t,e){var r=Ln(t,e);if(r.state>0)throw new Error("too late; already scheduled");return r}function jn(t,e){var r=Ln(t,e);if(r.state>3)throw new Error("too late; already running");return r}function Ln(t,e){var r=t.__transition;if(!r||!(r=r[e]))throw new Error("transition not found");return r}function Hn(t,e){var r,n;return function(){var i=jn(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 Vn(t,e,r){var n,i;if("function"!=typeof r)throw new Error;return function(){var s=jn(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 Bn(t,e,r){var n=t._id;return t.each(function(){var t=jn(this,n);(t.value||(t.value={}))[e]=r.apply(this,arguments)}),function(t){return Ln(t,n).value[e]}}function Xn(t,e){var r;return("number"==typeof e?sn:e instanceof Fr?tn:(r=Fr(e))?(e=r,tn):cn)(t,e)}function Kn(t){return function(){this.removeAttribute(t)}}function Zn(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Wn(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 Yn(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 Gn(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 Qn(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 Jn(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 ti(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 ei(t,e){return function(){Un(this,t).delay=+e.apply(this,arguments)}}function ri(t,e){return e=+e,function(){Un(this,t).delay=e}}function ni(t,e){return function(){jn(this,t).duration=+e.apply(this,arguments)}}function ii(t,e){return e=+e,function(){jn(this,t).duration=e}}var si=nr.prototype.constructor;function ai(t){return function(){this.style.removeProperty(t)}}var oi=0;function li(t,e,r,n){this._groups=t,this._parents=e,this._name=r,this._id=n}function ci(){return++oi}var hi=nr.prototype;li.prototype={constructor:li,select:function(t){var e=this._name,r=this._id;"function"!=typeof t&&(t=Jt(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,Dn(u[d],e,r,d,u,Ln(o,r)));return new li(s,this._parents,e,r)},selectAll:function(t){var e=this._name,r=this._id;"function"!=typeof t&&(t=ee(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,f=t.call(l,l.__data__,u,c),p=Ln(l,r),m=0,b=f.length;m<b;++m)(d=f[m])&&Dn(d,e,r,m,f,p);s.push(f),a.push(l)}return new li(s,a,e,r)},selectChild:hi.selectChild,selectChildren:hi.selectChildren,filter:function(t){"function"!=typeof t&&(t=ne(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 li(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),f=0;f<u;++f)(l=c[f]||h[f])&&(d[f]=l);for(;o<n;++o)a[o]=e[o];return new li(a,this._parents,this._name,this._id)},selection:function(){return new si(this._groups,this._parents)},transition:function(){for(var t=this._name,e=this._id,r=ci(),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=Ln(a,e);Dn(a,t,r,c,o,{time:h.time+h.delay+h.duration,delay:0,duration:h.duration,ease:h.ease})}return new li(n,this._parents,t,r)},call:hi.call,nodes:hi.nodes,node:hi.node,size:hi.size,empty:hi.empty,each:hi.each,on:function(t,e){var r=this._id;return arguments.length<2?Ln(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)?Un:jn;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=Zt(t),n="transform"===r?wn:Xn;return this.attrTween(t,"function"==typeof e?(r.local?Qn:Gn)(r,n,Bn(this,"attr."+t,e)):null==e?(r.local?Zn:Kn)(r):(r.local?Yn:Wn)(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=Zt(t);return this.tween(r,(n.local?Jn:ti)(n,e))},style:function(t,e,r){var n="transform"==(t+="")?yn:Xn;return null==e?this.styleTween(t,function(t,e){var r,n,i;return function(){var s=Me(this,t),a=(this.style.removeProperty(t),Me(this,t));return s===a?null:s===r&&a===n?i:i=e(r=s,n=a)}}(t,n)).on("end.style."+t,ai(t)):"function"==typeof e?this.styleTween(t,function(t,e,r){var n,i,s;return function(){var a=Me(this,t),o=r(this),l=o+"";return null==o&&(this.style.removeProperty(t),l=o=Me(this,t)),a===l?null:a===n&&l===i?s:(i=l,s=e(n=a,o))}}(t,n,Bn(this,"style."+t,e))).each(function(t,e){var r,n,i,s,a="style."+e,o="end."+a;return function(){var l=jn(this,t),c=l.on,h=null==l.value[a]?s||(s=ai(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=Me(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}}(Bn(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=Ln(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?Hn:Vn)(r,t,e))},delay:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?ei:ri)(e,t)):Ln(this.node(),e).delay},duration:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?ni:ii)(e,t)):Ln(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(){jn(this,t).ease=e}}(e,t)):Ln(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;jn(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=jn(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]:hi[Symbol.iterator]};const ui=t=>+t;function di(t){return t*t*t}function fi(t){return--t*t*t+1}var pi={time:null,delay:0,duration:250,ease:function(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}};function mi(t,e){for(var r;!(r=t.__transition)||!(r=r[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return r}nr.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)})},nr.prototype.transition=function(t){var e,r;t instanceof li?(e=t._id,t=t._name):(e=ci(),(r=pi).time=Nn(),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])&&Dn(a,t,e,c,o,r||mi(a,e));return new li(n,this._parents,t,e)};const bi=Math.PI,gi=2*bi,vi=1e-6,yi=gi-vi;function wi(t){this._+=t[0];for(let e=1,r=t.length;e<r;++e)this._+=arguments[e]+t[e]}class xi{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=null==t?wi:function(t){let e=Math.floor(t);if(!(e>=0))throw new Error(`invalid digits: ${t}`);if(e>15)return wi;const r=10**e;return function(t){this._+=t[0];for(let e=1,n=t.length;e<n;++e)this._+=Math.round(arguments[e]*r)/r+t[e]}}(t)}moveTo(t,e){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,e){this._append`L${this._x1=+t},${this._y1=+e}`}quadraticCurveTo(t,e,r,n){this._append`Q${+t},${+e},${this._x1=+r},${this._y1=+n}`}bezierCurveTo(t,e,r,n,i,s){this._append`C${+t},${+e},${+r},${+n},${this._x1=+i},${this._y1=+s}`}arcTo(t,e,r,n,i){if(t=+t,e=+e,r=+r,n=+n,(i=+i)<0)throw new Error(`negative radius: ${i}`);let s=this._x1,a=this._y1,o=r-t,l=n-e,c=s-t,h=a-e,u=c*c+h*h;if(null===this._x1)this._append`M${this._x1=t},${this._y1=e}`;else if(u>vi)if(Math.abs(h*o-l*c)>vi&&i){let d=r-s,f=n-a,p=o*o+l*l,m=d*d+f*f,b=Math.sqrt(p),g=Math.sqrt(u),v=i*Math.tan((bi-Math.acos((p+u-m)/(2*b*g)))/2),y=v/g,w=v/b;Math.abs(y-1)>vi&&this._append`L${t+y*c},${e+y*h}`,this._append`A${i},${i},0,0,${+(h*d>c*f)},${this._x1=t+w*o},${this._y1=e+w*l}`}else this._append`L${this._x1=t},${this._y1=e}`;else;}arc(t,e,r,n,i,s){if(t=+t,e=+e,s=!!s,(r=+r)<0)throw new Error(`negative radius: ${r}`);let a=r*Math.cos(n),o=r*Math.sin(n),l=t+a,c=e+o,h=1^s,u=s?n-i:i-n;null===this._x1?this._append`M${l},${c}`:(Math.abs(this._x1-l)>vi||Math.abs(this._y1-c)>vi)&&this._append`L${l},${c}`,r&&(u<0&&(u=u%gi+gi),u>yi?this._append`A${r},${r},0,1,${h},${t-a},${e-o}A${r},${r},0,1,${h},${this._x1=l},${this._y1=c}`:u>vi&&this._append`A${r},${r},0,${+(u>=bi)},${h},${this._x1=t+r*Math.cos(i)},${this._y1=e+r*Math.sin(i)}`)}rect(t,e,r,n){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}h${r=+r}v${+n}h${-r}Z`}toString(){return this._}}var $i=Array.prototype.slice;function ki(t,e){return t-e}var _i=t=>()=>t;function Si(t,e){for(var r,n=-1,i=e.length;++n<i;)if(r=Mi(t,e[n]))return r;return 0}function Mi(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],f=u[1];if(Ai(l,u,e))return 0;h>n!=f>n&&r<(d-c)*(n-h)/(f-h)+c&&(i=-i)}return i}function Ai(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 Ei(){}var Ni=[[],[[[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 Ti(){var t=1,e=1,r=Nt,n=o;function i(t){var e=r(t);if(Array.isArray(e))e=e.slice().sort(ki);else{const r=gt(t,Ci);for(e=Mt(...Et(r[0],r[1],e),e);e[e.length-1]>=r[1];)e.pop();for(;e[1]<r[0];)e.shift()}return e.map(e=>s(t,e))}function s(r,i){const s=null==i?NaN:+i;if(isNaN(s))throw new Error(`invalid value: ${i}`);var o=[],l=[];return function(r,n,i){var s,o,l,c,h,u,d=new Array,f=new Array;s=o=-1,c=Pi(r[0],n),Ni[c<<1].forEach(p);for(;++s<t-1;)l=c,c=Pi(r[s+1],n),Ni[l|c<<1].forEach(p);Ni[c|0].forEach(p);for(;++o<e-1;){for(s=-1,c=Pi(r[o*t+t],n),h=Pi(r[o*t],n),Ni[c<<1|h<<2].forEach(p);++s<t-1;)l=c,c=Pi(r[o*t+t+s+1],n),u=h,h=Pi(r[o*t+s+1],n),Ni[l|c<<1|h<<2|u<<3].forEach(p);Ni[c|h<<3].forEach(p)}s=-1,h=r[o*t]>=n,Ni[h<<2].forEach(p);for(;++s<t-1;)u=h,h=Pi(r[o*t+s+1],n),Ni[h<<2|u<<3].forEach(p);function p(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=f[c])?(r=d[h])?(delete f[e.end],delete d[r.start],e===r?(e.ring.push(l),i(e.ring)):d[e.start]=f[r.end]={start:e.start,end:r.end,ring:e.ring.concat(r.ring)}):(delete f[e.end],e.ring.push(l),f[e.end=h]=e):(e=d[h])?(r=f[c])?(delete d[e.start],delete f[r.end],e===r?(e.ring.push(l),i(e.ring)):d[r.start]=f[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]=f[h]={start:c,end:h,ring:[n,l]}}Ni[h<<3].forEach(p)}(r,s,function(t){n(t,r,s),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?o.push([t]):l.push(t)}),l.forEach(function(t){for(var e,r=0,n=o.length;r<n;++r)if(-1!==Si((e=o[r])[0],t))return void e.push(t)}),{type:"MultiPolygon",value:i,coordinates:o}}function a(e){return 2*e[0]+e[1]*(t+1)*4}function o(r,n,i){r.forEach(function(r){var s=r[0],a=r[1],o=0|s,l=0|a,c=Ri(n[l*t+o]);s>0&&s<t&&o===s&&(r[0]=qi(s,Ri(n[l*t+o-1]),c,i)),a>0&&a<e&&l===a&&(r[1]=qi(a,Ri(n[(l-1)*t+o]),c,i))})}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)?_i($i.call(t)):_i(t),i):r},i.smooth=function(t){return arguments.length?(n=t?o:Ei,i):n===o},i}function Ci(t){return isFinite(t)?t:NaN}function Pi(t,e){return null!=t&&+t>=e}function Ri(t){return null==t||isNaN(t=+t)?-1/0:t}function qi(t,e,r,n){const i=n-e,s=r-e,a=isFinite(i)||isFinite(s)?i/s:Math.sign(i)/Math.sign(s);return isNaN(a)?t:t+a-.5}function Fi(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 zi(t){return(t=Fi(Math.abs(t)))?t[1]:NaN}var Oi,Ii=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Di(t){if(!(e=Ii.exec(t)))throw new Error("invalid format: "+t);var e;return new Ui({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 Ui(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 ji(t,e){var r=Fi(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")}Di.prototype=Ui.prototype,Ui.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 Li={"%":(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)=>ji(100*t,e),r:ji,s:function(t,e){var r=Fi(t,e);if(!r)return t+"";var n=r[0],i=r[1],s=i-(Oi=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")+Fi(t,Math.max(0,e+s-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function Hi(t){return t}var Vi,Bi,Xi,Ki=Array.prototype.map,Zi=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Wi(t){var e,r,n=void 0===t.grouping||void 0===t.thousands?Hi:(e=Ki.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?Hi:function(t){return function(e){return e.replace(/[0-9]/g,function(e){return t[+e]})}}(Ki.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=Di(t)).fill,r=t.align,u=t.sign,d=t.symbol,f=t.zero,p=t.width,m=t.comma,b=t.precision,g=t.trim,v=t.type;"n"===v?(m=!0,v="g"):Li[v]||(void 0===b&&(b=12),g=!0,v="g"),(f||"0"===e&&"="===r)&&(f=!0,e="0",r="=");var y="$"===d?i:"#"===d&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",w="$"===d?s:/[%p]/.test(v)?l:"",x=Li[v],$=/[defgprs%]/.test(v);function k(t){var i,s,l,d=y,k=w;if("c"===v)k=x(t)+k,t="";else{var _=(t=+t)<0||1/t<0;if(t=isNaN(t)?h:x(Math.abs(t),b),g&&(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)),_&&0===+t&&"+"!==u&&(_=!1),d=(_?"("===u?u:c:"-"===u||"("===u?"":u)+d,k=("s"===v?Zi[8+Oi/3]:"")+k+(_&&"("===u?")":""),$)for(i=-1,s=t.length;++i<s;)if(48>(l=t.charCodeAt(i))||l>57){k=(46===l?a+t.slice(i+1):t.slice(i))+k,t=t.slice(0,i);break}}m&&!f&&(t=n(t,1/0));var S=d.length+t.length+k.length,M=S<p?new Array(p-S+1).join(e):"";switch(m&&f&&(t=n(M+t,M.length?p-k.length:1/0),M=""),r){case"<":t=d+t+k+M;break;case"=":t=d+M+t+k;break;case"^":t=M.slice(0,S=M.length>>1)+d+t+k+M.slice(S);break;default:t=M+d+t+k}return o(t)}return b=void 0===b?6:/[gprs]/.test(v)?Math.max(1,Math.min(21,b)):Math.max(0,Math.min(20,b)),k.toString=function(){return t+""},k}return{format:u,formatPrefix:function(t,e){var r=u(((t=Di(t)).type="f",t)),n=3*Math.max(-8,Math.min(8,Math.floor(zi(e)/3))),i=Math.pow(10,-n),s=Zi[8+n/3];return function(t){return r(i*t)+s}}}}Vi=Wi({thousands:",",grouping:[3],currency:["$",""]}),Bi=Vi.format,Xi=Vi.formatPrefix;var Yi=1e-6,Gi=Math.PI,Qi=2*Gi,Ji=180/Gi,ts=Gi/180,es=Math.abs,rs=Math.cos,ns=Math.sin,is=Math.sqrt;function ss(){}function as(t,e){t&&ls.hasOwnProperty(t.type)&&ls[t.type](t,e)}var os={Feature:function(t,e){as(t.geometry,e)},FeatureCollection:function(t,e){for(var r=t.features,n=-1,i=r.length;++n<i;)as(r[n].geometry,e)}},ls={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){cs(t.coordinates,e,0)},MultiLineString:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)cs(r[n],e,0)},Polygon:function(t,e){hs(t.coordinates,e)},MultiPolygon:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)hs(r[n],e)},GeometryCollection:function(t,e){for(var r=t.geometries,n=-1,i=r.length;++n<i;)as(r[n],e)}};function cs(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 hs(t,e){var r=-1,n=t.length;for(e.polygonStart();++r<n;)cs(t[r],e,1);e.polygonEnd()}function us(t,e){t&&os.hasOwnProperty(t.type)?os[t.type](t,e):as(t,e)}function ds(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 fs(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 es(t[0]-e[0])<Yi&&es(t[1]-e[1])<Yi}(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 ds(n,t,null,!0)),l.push(r.o=new ds(n,null,r,!1)),o.push(r=new ds(a,t,null,!1)),l.push(r.o=new ds(a,null,r,!0))}}),o.length){for(l.sort(e),ps(o),ps(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,f=!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(f)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(f)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,f=!f}while(!d.v);i.lineEnd()}}}function ps(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 ms=1e9,bs=-ms;function gs(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 es(n[0]-t)<Yi?i>0?0:3:es(n[0]-r)<Yi?i>0?2:1:es(n[1]-e)<Yi?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,f,p,m,b,g,v,y=a,w=function(){var t,e=[];return{point:function(e,r,n){t.push([e,r,n])},lineStart:function(){e.push(t=[])},lineEnd:ss,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=k,c&&c.push(h=[]);g=!0,b=!1,p=m=NaN},lineEnd:function(){l&&(k(u,d),f&&b&&w.rejoin(),l.push(w.result()));x.point=$,b&&y.lineEnd()},polygonStart:function(){y=w,l=[],c=[],v=!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],f=u[1];l<h;++l)s=d,a=f,d=(u=o[l])[0],f=u[1],a<=n?f>n&&(d-s)*(n-a)>(f-a)*(t-s)&&++e:f<=n&&(d-s)*(n-a)<(f-a)*(t-s)&&--e;return e}(),r=v&&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&&fs(l,o,e,s,a),a.polygonEnd());y=a,l=c=h=null}};function $(t,e){i(t,e)&&y.point(t,e)}function k(s,a){var o=i(s,a);if(c&&h.push([s,a]),g)u=s,d=a,f=o,g=!1,o&&(y.lineStart(),y.point(s,a));else if(o&&b)y.point(s,a);else{var l=[p=Math.max(bs,Math.min(ms,p)),m=Math.max(bs,Math.min(ms,m))],w=[s=Math.max(bs,Math.min(ms,s)),a=Math.max(bs,Math.min(ms,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),v=!1):(b||(y.lineStart(),y.point(l[0],l[1])),y.point(w[0],w[1]),o||y.lineEnd(),v=!1)}p=s,m=a,b=o}return x}}var vs,ys,ws,xs,$s=t=>t,ks=new vt,_s=new vt,Ss={point:ss,lineStart:ss,lineEnd:ss,polygonStart:function(){Ss.lineStart=Ms,Ss.lineEnd=Ns},polygonEnd:function(){Ss.lineStart=Ss.lineEnd=Ss.point=ss,ks.add(es(_s)),_s=new vt},result:function(){var t=ks/2;return ks=new vt,t}};function Ms(){Ss.point=As}function As(t,e){Ss.point=Es,vs=ws=t,ys=xs=e}function Es(t,e){_s.add(xs*t-ws*e),ws=t,xs=e}function Ns(){Es(vs,ys)}var Ts=1/0,Cs=Ts,Ps=-Ts,Rs=Ps,qs={point:function(t,e){t<Ts&&(Ts=t);t>Ps&&(Ps=t);e<Cs&&(Cs=e);e>Rs&&(Rs=e)},lineStart:ss,lineEnd:ss,polygonStart:ss,polygonEnd:ss,result:function(){var t=[[Ts,Cs],[Ps,Rs]];return Ps=Rs=-(Cs=Ts=1/0),t}};var Fs,zs,Os,Is,Ds=0,Us=0,js=0,Ls=0,Hs=0,Vs=0,Bs=0,Xs=0,Ks=0,Zs={point:Ws,lineStart:Ys,lineEnd:Js,polygonStart:function(){Zs.lineStart=ta,Zs.lineEnd=ea},polygonEnd:function(){Zs.point=Ws,Zs.lineStart=Ys,Zs.lineEnd=Js},result:function(){var t=Ks?[Bs/Ks,Xs/Ks]:Vs?[Ls/Vs,Hs/Vs]:js?[Ds/js,Us/js]:[NaN,NaN];return Ds=Us=js=Ls=Hs=Vs=Bs=Xs=Ks=0,t}};function Ws(t,e){Ds+=t,Us+=e,++js}function Ys(){Zs.point=Gs}function Gs(t,e){Zs.point=Qs,Ws(Os=t,Is=e)}function Qs(t,e){var r=t-Os,n=e-Is,i=is(r*r+n*n);Ls+=i*(Os+t)/2,Hs+=i*(Is+e)/2,Vs+=i,Ws(Os=t,Is=e)}function Js(){Zs.point=Ws}function ta(){Zs.point=ra}function ea(){na(Fs,zs)}function ra(t,e){Zs.point=na,Ws(Fs=Os=t,zs=Is=e)}function na(t,e){var r=t-Os,n=e-Is,i=is(r*r+n*n);Ls+=i*(Os+t)/2,Hs+=i*(Is+e)/2,Vs+=i,Bs+=(i=Is*t-Os*e)*(Os+t),Xs+=i*(Is+e),Ks+=3*i,Ws(Os=t,Is=e)}function ia(t){this._context=t}ia.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,Qi)}},result:ss};var sa,aa,oa,la,ca,ha=new vt,ua={point:ss,lineStart:function(){ua.point=da},lineEnd:function(){sa&&fa(aa,oa),ua.point=ss},polygonStart:function(){sa=!0},polygonEnd:function(){sa=null},result:function(){var t=+ha;return ha=new vt,t}};function da(t,e){ua.point=fa,aa=la=t,oa=ca=e}function fa(t,e){la-=t,ca-=e,ha.add(is(la*la+ca*ca)),la=t,ca=e}let pa,ma,ba,ga;class va{constructor(t){this._append=null==t?ya:function(t){const e=Math.floor(t);if(!(e>=0))throw new RangeError(`invalid digits: ${t}`);if(e>15)return ya;if(e!==pa){const t=10**e;pa=e,ma=function(e){let r=1;this._+=e[0];for(const n=e.length;r<n;++r)this._+=Math.round(arguments[r]*t)/t+e[r]}}return ma}(t),this._radius=4.5,this._=""}pointRadius(t){return this._radius=+t,this}polygonStart(){this._line=0}polygonEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){0===this._line&&(this._+="Z"),this._point=NaN}point(t,e){switch(this._point){case 0:this._append`M${t},${e}`,this._point=1;break;case 1:this._append`L${t},${e}`;break;default:if(this._append`M${t},${e}`,this._radius!==ba||this._append!==ma){const t=this._radius,e=this._;this._="",this._append`m0,${t}a${t},${t} 0 1,1 0,${-2*t}a${t},${t} 0 1,1 0,${2*t}z`,ba=t,ma=this._append,ga=this._,this._=e}this._+=ga}}result(){const t=this._;return this._="",t.length?t:null}}function ya(t){let e=1;this._+=t[0];for(const r=t.length;e<r;++e)this._+=arguments[e]+t[e]}function wa(t,e){let r,n,i=3,s=4.5;function a(t){return t&&("function"==typeof s&&n.pointRadius(+s.apply(this,arguments)),us(t,r(n))),n.result()}return a.area=function(t){return us(t,r(Ss)),Ss.result()},a.measure=function(t){return us(t,r(ua)),ua.result()},a.bounds=function(t){return us(t,r(qs)),qs.result()},a.centroid=function(t){return us(t,r(Zs)),Zs.result()},a.projection=function(e){return arguments.length?(r=null==e?(t=null,$s):(t=e).stream,a):t},a.context=function(t){return arguments.length?(n=null==t?(e=null,new va(i)):new ia(e=t),"function"!=typeof s&&n.pointRadius(s),a):e},a.pointRadius=function(t){return arguments.length?(s="function"==typeof t?t:(n.pointRadius(+t),+t),a):s},a.digits=function(t){if(!arguments.length)return i;if(null==t)i=null;else{const e=Math.floor(t);if(!(e>=0))throw new RangeError(`invalid digits: ${t}`);i=e}return null===e&&(n=new va(i)),a},a.projection(t).digits(i).context(e)}function xa(){}function $a(t,e,r){var n=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=n&&t.clipExtent(null),us(r,t.stream(qs)),e(qs.result()),null!=n&&t.clipExtent(n),t}function ka(t,e,r){return $a(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 _a(){var t,e,r,n,i,s,a,o,l=1,c=0,h=0,u=1,d=1,f=0,p=null,m=1,b=1,g=(o={point:function(t,e){var r=w([t,e]);this.stream.point(r[0],r[1])}},function(t){var e=new xa;for(var r in o)e[r]=o[r];return e.stream=t,e}),v=$s;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(f){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(f){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=g(v(a=t))},w.postclip=function(t){return arguments.length?(v=t,p=r=n=i=null,y()):v},w.clipExtent=function(t){return arguments.length?(v=null==t?(p=r=n=i=null,$s):gs(p=+t[0][0],r=+t[0][1],n=+t[1][0],i=+t[1][1]),y()):null==p?null:[[p,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=ns(f=r%360*ts),t=rs(f),y()):f*Ji},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 ka(w,t,e)},w.fitSize=function(t,e){return function(t,e,r){return ka(t,[[0,0],e],r)}(w,t,e)},w.fitWidth=function(t,e){return function(t,e,r){return $a(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 $a(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 Sa(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}function Ma(t){return+t}xa.prototype={constructor:xa,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 Aa=[0,1];function Ea(t){return t}function Na(t,e){return(e-=t=+t)?function(r){return(r-t)/e}:function(t){return function(){return t}}(isNaN(e)?NaN:.5)}function Ta(t,e,r){var n=t[0],i=t[1],s=e[0],a=e[1];return i<n?(n=Na(i,n),s=r(a,s)):(n=Na(n,i),s=r(s,a)),function(t){return s(n(t))}}function Ca(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]=Na(t[a],t[a+1]),s[a]=r(e[a],e[a+1]);return function(e){var r=bt(t,e,1,n)-1;return s[r](i[r](e))}}function Pa(){var t,e,r,n,i,s,a=Aa,o=Aa,l=hn,c=Ea;function h(){var t=Math.min(a.length,o.length);return c!==Ea&&(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?Ca:Ta,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),sn)))(r)))},u.domain=function(t){return arguments.length?(a=Array.from(t,Ma),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=un,h()},u.clamp=function(t){return arguments.length?(c=!!t||Ea,h()):c!==Ea},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 Ra(t,e,r,n){var i,s=function(t,e,r){r=+r;const n=(e=+e)<(t=+t),i=n?At(e,t,r):At(t,e,r);return(n?-1:1)*(i<0?1/-i:i)}(t,e,r);switch((n=Di(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(zi(e)/3)))-zi(Math.abs(t)))}(s,a))||(n.precision=i),Xi(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,zi(e)-zi(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,-zi(Math.abs(t)))}(s))||(n.precision=i-2*("%"===n.type))}return Bi(n)}function qa(){var t=Pa()(Ea,Ea);return t.copy=function(){return e=t,qa().domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown());var e},Sa.apply(t,arguments),function(t){var e=t.domain;return t.ticks=function(t){var r=e();return Mt(r[0],r[r.length-1],null==t?10:t)},t.tickFormat=function(t,r){var n=e();return Ra(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=At(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)}function Fa(t){return function(){return t}}function za(t){this._context=t}function Oa(t){return new za(t)}function Ia(t){return t[0]}function Da(t){return t[1]}function Ua(t,e){var r=Fa(!0),n=null,i=Oa,s=null,a=function(t){let e=3;return t.digits=function(r){if(!arguments.length)return e;if(null==r)e=null;else{const t=Math.floor(r);if(!(t>=0))throw new RangeError(`invalid digits: ${r}`);e=t}return t},()=>new xi(e)}(o);function o(o){var l,c,h,u=(o=function(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}(o)).length,d=!1;for(null==n&&(s=i(h=a())),l=0;l<=u;++l)!(l<u&&r(c=o[l],l,o))===d&&((d=!d)?s.lineStart():s.lineEnd()),d&&s.point(+t(c,l,o),+e(c,l,o));if(h)return s=null,h+""||null}return t="function"==typeof t?t:void 0===t?Ia:Fa(t),e="function"==typeof e?e:void 0===e?Da:Fa(e),o.x=function(e){return arguments.length?(t="function"==typeof e?e:Fa(+e),o):t},o.y=function(t){return arguments.length?(e="function"==typeof t?t:Fa(+t),o):e},o.defined=function(t){return arguments.length?(r="function"==typeof t?t:Fa(!!t),o):r},o.curve=function(t){return arguments.length?(i=t,null!=n&&(s=i(n)),o):i},o.context=function(t){return arguments.length?(null==t?n=s=null:s=i(n=t),o):n},o}function ja(t,e,r){this.k=t,this.x=e,this.y=r}za.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)}}},ja.prototype={constructor:ja,scale:function(t){return 1===t?this:new ja(this.k*t,this.x,this.y)},translate:function(t,e){return 0===t&0===e?this:new ja(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+")"}},ja.prototype;class La extends ht{getComputedStyleValue(t){return getComputedStyle(this).getPropertyValue(t).trim()}static get greys(){const t="#999999",e={white:"#ffffff"};return e.light75=tn(t,"#ffffff")(.75),e.light50=tn(t,"#ffffff")(.5),e.light25=tn(t,"#ffffff")(.25),e.grey=t,e.dark25=tn(t,"#000000")(.25),e.dark50=tn(t,"#000000")(.5),e.dark75=tn(t,"#000000")(.75),e.black="#000000",e}static get shadows(){return{elevations:[0,2,4,8,16],baselineColor:"#000000",baselineColorString:"0, 0, 0",inverseBaselineColor:"#FFFFFF",inverseBaselineColorString:"255, 255, 255",opacityUmbra:.2,opacityPenumbra:.14,opacityAmbient:.12,opacityBoost:.2,mapUmbra:{0:{x:0,y:0,b:0,s:0},2:{x:0,y:3,b:1,s:-2},4:{x:0,y:2,b:4,s:-1},8:{x:0,y:5,b:5,s:-3},16:{x:0,y:8,b:10,s:-5}},mapPenumbra:{0:{x:0,y:0,b:0,s:0},2:{x:0,y:2,b:2,s:0},4:{x:0,y:4,b:5,s:0},8:{x:0,y:8,b:10,s:1},16:{x:0,y:16,b:24,s:2}},mapAmbient:{0:{x:0,y:0,b:0,s:0},2:{x:0,y:1,b:5,s:0},4:{x:0,y:1,b:10,s:0},8:{x:0,y:3,b:14,s:2},16:{x:0,y:6,b:30,s:5}}}}static cssBoxShadow(t,e=!1){const r=this.shadows.opacityUmbra+this.shadows.opacityBoost,n=this.shadows.opacityPenumbra+this.shadows.opacityBoost,i=this.shadows.opacityAmbient+this.shadows.opacityBoost,s=e?`rgba(${this.shadows.inverseBaselineColorString}, ${r})`:`rgba(${this.shadows.baselineColorString}, ${r})`,a=e?`rgba(${this.shadows.inverseBaselineColorString}, ${n})`:`rgba(${this.shadows.baselineColorString}, ${n})`,o=e?`rgba(${this.shadows.inverseBaselineColorString}, ${i})`:`rgba(${this.shadows.baselineColorString}, ${i})`,l=this.shadows.mapUmbra[t],c=this.shadows.mapPenumbra[t],h=this.shadows.mapAmbient[t];return`${`${l.y/2}px ${l.y}px ${l.b}px ${l.s}px`} ${s}, ${`${c.y/2}px ${c.y}px ${c.b}px ${c.s}px`} ${a}, ${`${h.y/2}px ${h.y}px ${h.b}px ${h.s}px`} ${o}`}static get svgFilters(){const t=La.shadows,e=t.elevations.map(e=>B`
|
|
23
23
|
<filter id=${`shadow-${e}`} filterUnits="userSpaceOnUse" x="-100%" y="-100%" width="200%" height="200%">
|
|
24
24
|
<feComponentTransfer in="SourceAlpha" result="solid">
|
|
25
25
|
<feFuncA type="table" tableValues="0 1 1"/>
|
|
@@ -111,7 +111,7 @@ const _=globalThis,S=_.trustedTypes,M=S?S.createPolicy("lit-html",{createHTML:t=
|
|
|
111
111
|
width: 0;
|
|
112
112
|
height: 0;
|
|
113
113
|
}
|
|
114
|
-
`}}customElements.define("decidables-button",class extends
|
|
114
|
+
`}}customElements.define("decidables-button",class extends La{static get properties(){return{disabled:{attribute:"disabled",type:Boolean,reflect:!0}}}constructor(){super(),this.disabled=!1}static get styles(){return[super.styles,o`
|
|
115
115
|
:host {
|
|
116
116
|
---decidables-button-background-color-disabled: var(--decidables-button-background-color, var(---color-element-disabled));
|
|
117
117
|
---decidables-button-background-color-enabled: var(--decidables-button-background-color, var(---color-element-enabled));
|
|
@@ -122,49 +122,58 @@ const _=globalThis,S=_.trustedTypes,M=S?S.createPolicy("lit-html",{createHTML:t=
|
|
|
122
122
|
button {
|
|
123
123
|
width: 100%;
|
|
124
124
|
height: 100%;
|
|
125
|
+
|
|
125
126
|
padding: 0.375rem 0.75rem;
|
|
126
127
|
|
|
127
128
|
font-family: var(---font-family-base);
|
|
128
129
|
font-size: 1.125rem;
|
|
130
|
+
|
|
129
131
|
line-height: 1.5;
|
|
132
|
+
|
|
130
133
|
color: var(---color-text-inverse);
|
|
131
134
|
|
|
135
|
+
outline: none;
|
|
136
|
+
|
|
132
137
|
border: 0;
|
|
133
138
|
border-radius: var(---border-radius);
|
|
134
|
-
outline: none;
|
|
135
139
|
}
|
|
136
140
|
|
|
137
141
|
button:disabled {
|
|
138
|
-
background-color: var(---decidables-button-background-color-disabled);
|
|
139
142
|
outline: none;
|
|
143
|
+
|
|
144
|
+
background-color: var(---decidables-button-background-color-disabled);
|
|
140
145
|
box-shadow: none;
|
|
141
146
|
}
|
|
142
147
|
|
|
143
148
|
button:enabled {
|
|
144
149
|
cursor: pointer;
|
|
150
|
+
outline: none;
|
|
145
151
|
|
|
146
152
|
background-color: var(---decidables-button-background-color-enabled);
|
|
147
|
-
outline: none;
|
|
148
153
|
box-shadow: var(---shadow-2);
|
|
149
154
|
}
|
|
150
155
|
|
|
151
156
|
button:enabled:hover {
|
|
152
157
|
outline: none;
|
|
158
|
+
|
|
153
159
|
box-shadow: var(---shadow-4);
|
|
154
160
|
}
|
|
155
161
|
|
|
156
162
|
button:enabled:active {
|
|
157
163
|
outline: none;
|
|
164
|
+
|
|
158
165
|
box-shadow: var(---shadow-8);
|
|
159
166
|
}
|
|
160
167
|
|
|
161
|
-
|
|
168
|
+
button:enabled:focus-visible {
|
|
162
169
|
outline: none;
|
|
170
|
+
|
|
163
171
|
box-shadow: var(---shadow-4);
|
|
164
172
|
}
|
|
165
173
|
|
|
166
|
-
|
|
174
|
+
button:enabled:focus-visible:active {
|
|
167
175
|
outline: none;
|
|
176
|
+
|
|
168
177
|
box-shadow: var(---shadow-8);
|
|
169
178
|
}
|
|
170
179
|
`]}render(){return V`
|
|
@@ -177,16 +186,12 @@ const _=globalThis,S=_.trustedTypes,M=S?S.createPolicy("lit-html",{createHTML:t=
|
|
|
177
186
|
* Copyright 2018 Google LLC
|
|
178
187
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
179
188
|
*/
|
|
180
|
-
const
|
|
189
|
+
const Ha=t=>t??K;customElements.define("decidables-slider",class extends La{static get properties(){return{disabled:{attribute:"disabled",type:Boolean,reflect:!0},scale:{attribute:"scale",type:Boolean,reflect:!0},max:{attribute:"max",type:Number,reflect:!0},min:{attribute:"min",type:Number,reflect:!0},step:{attribute:"step",type:Number,reflect:!0},value:{attribute:"value",type:Number,reflect:!0},nonlinear:{attribute:!1,type:Boolean,reflect:!1}}}constructor(){super(),this.disabled=!1,this.scale=!1,this.max=void 0,this.min=void 0,this.step=void 0,this.value=void 0,this.nonlinear=!1,this.rangeMax=void 0,this.rangeMin=void 0,this.rangeStep=void 0,this.rangeValue=void 0,this.toRange=void 0,this.fromRange=void 0}nonlinearRange(t,e,r){this.nonlinear=t,this.toRange=t?e:void 0,this.fromRange=t?r:void 0}rangeChanged(t){this.value=this.nonlinear?this.fromRange(t.target.value):t.target.value,this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},bubbles:!0}))}rangeInputted(t){this.value=this.nonlinear?this.fromRange(t.target.value):t.target.value}spinnerInputted(t){this.value=t.target.value}willUpdate(){this.rangeMax=void 0===this.max?void 0:this.nonlinear?this.toRange(this.max):this.max,this.rangeMin=void 0===this.min?void 0:this.nonlinear?this.toRange(this.min):this.min,this.rangeStep=void 0===this.step?void 0:this.nonlinear?"any":this.step,this.rangeValue=void 0===this.value?void 0:this.nonlinear?this.toRange(this.value):this.value}static get styles(){return[super.styles,o`
|
|
181
190
|
:host {
|
|
182
191
|
---decidables-slider-background-color: var(--decidables-slider-background-color, var(---color-element-disabled));
|
|
183
192
|
---decidables-slider-color: var(--decidables-slider-color, var(---color-element-enabled));
|
|
184
193
|
---decidables-spinner-background-color: var(--decidables-slider-background-color, none);
|
|
185
194
|
|
|
186
|
-
---shadow-2-rotate: var(--shadow-2-rotate, ${a(this.cssBoxShadow(2,!0,!1))});
|
|
187
|
-
---shadow-4-rotate: var(--shadow-4-rotate, ${a(this.cssBoxShadow(4,!0,!1))});
|
|
188
|
-
---shadow-8-rotate: var(--shadow-8-rotate, ${a(this.cssBoxShadow(8,!0,!1))});
|
|
189
|
-
|
|
190
195
|
display: flex;
|
|
191
196
|
|
|
192
197
|
flex-direction: column;
|
|
@@ -201,12 +206,14 @@ const La=t=>t??K;customElements.define("decidables-slider",class extends Ha{stat
|
|
|
201
206
|
|
|
202
207
|
.range {
|
|
203
208
|
position: relative;
|
|
209
|
+
|
|
204
210
|
display: flex;
|
|
205
211
|
|
|
206
212
|
flex-direction: row;
|
|
207
213
|
|
|
208
214
|
width: 3.5rem;
|
|
209
215
|
height: 4.75rem;
|
|
216
|
+
|
|
210
217
|
margin: 0 0.25rem 0.25rem;
|
|
211
218
|
}
|
|
212
219
|
|
|
@@ -218,21 +225,20 @@ const La=t=>t??K;customElements.define("decidables-slider",class extends Ha{stat
|
|
|
218
225
|
background: var(---decidables-spinner-background-color);
|
|
219
226
|
}
|
|
220
227
|
|
|
221
|
-
/* Adapted from http://danielstern.ca/range.css/#/ */
|
|
222
228
|
/* Overall */
|
|
223
229
|
input[type=range] {
|
|
224
|
-
width:
|
|
225
|
-
height:
|
|
230
|
+
width: 3.5rem;
|
|
231
|
+
height: 4.75rem;
|
|
232
|
+
|
|
226
233
|
padding: 0;
|
|
227
234
|
margin: 0;
|
|
235
|
+
|
|
236
|
+
appearance: none;
|
|
228
237
|
|
|
229
238
|
background-color: unset;
|
|
230
239
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
/* stylelint-disable-next-line property-no-vendor-prefix */
|
|
235
|
-
-webkit-appearance: none;
|
|
240
|
+
direction: rtl;
|
|
241
|
+
writing-mode: vertical-lr;
|
|
236
242
|
}
|
|
237
243
|
|
|
238
244
|
input[type=range]:enabled {
|
|
@@ -243,16 +249,10 @@ const La=t=>t??K;customElements.define("decidables-slider",class extends Ha{stat
|
|
|
243
249
|
outline: none;
|
|
244
250
|
}
|
|
245
251
|
|
|
246
|
-
/* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
|
|
247
|
-
input[type=range]::-ms-tooltip {
|
|
248
|
-
display: none;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
252
|
/* Track */
|
|
252
|
-
/* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
|
|
253
253
|
input[type=range]::-webkit-slider-runnable-track {
|
|
254
|
-
width:
|
|
255
|
-
height:
|
|
254
|
+
width: 4px;
|
|
255
|
+
height: 100%;
|
|
256
256
|
|
|
257
257
|
background: var(---decidables-slider-background-color);
|
|
258
258
|
border: 0;
|
|
@@ -264,10 +264,9 @@ const La=t=>t??K;customElements.define("decidables-slider",class extends Ha{stat
|
|
|
264
264
|
background: var(---decidables-slider-background-color);
|
|
265
265
|
}
|
|
266
266
|
|
|
267
|
-
/* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
|
|
268
267
|
input[type=range]::-moz-range-track {
|
|
269
|
-
width:
|
|
270
|
-
height:
|
|
268
|
+
width: 4px;
|
|
269
|
+
height: 100%;
|
|
271
270
|
|
|
272
271
|
background: var(---decidables-slider-background-color);
|
|
273
272
|
border: 0;
|
|
@@ -275,57 +274,17 @@ const La=t=>t??K;customElements.define("decidables-slider",class extends Ha{stat
|
|
|
275
274
|
box-shadow: none;
|
|
276
275
|
}
|
|
277
276
|
|
|
278
|
-
/* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
|
|
279
|
-
input[type=range]::-ms-track {
|
|
280
|
-
width: 100%;
|
|
281
|
-
height: 4px;
|
|
282
|
-
|
|
283
|
-
color: transparent;
|
|
284
|
-
|
|
285
|
-
background: transparent;
|
|
286
|
-
border-color: transparent;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
/* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
|
|
290
|
-
input[type=range]::-ms-fill-lower {
|
|
291
|
-
background: #cccccc;
|
|
292
|
-
/* background: var(---decidables-slider-background-color); */
|
|
293
|
-
border: 0;
|
|
294
|
-
border-radius: 2px;
|
|
295
|
-
box-shadow: none;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
/* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
|
|
299
|
-
input[type=range]::-ms-fill-upper {
|
|
300
|
-
background: #cccccc;
|
|
301
|
-
/* background: var(---decidables-slider-background-color); */
|
|
302
|
-
border: 0;
|
|
303
|
-
border-radius: 2px;
|
|
304
|
-
box-shadow: none;
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
/* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
|
|
308
|
-
input[type=range]:focus::-ms-fill-lower {
|
|
309
|
-
background: var(---decidables-slider-background-color);
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
/* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
|
|
313
|
-
input[type=range]:focus::-ms-fill-upper {
|
|
314
|
-
background: var(---decidables-slider-background-color);
|
|
315
|
-
}
|
|
316
|
-
|
|
317
277
|
/* Thumb */
|
|
318
|
-
/* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
|
|
319
278
|
input[type=range]::-webkit-slider-thumb {
|
|
320
|
-
width:
|
|
321
|
-
height:
|
|
322
|
-
|
|
279
|
+
width: 20px;
|
|
280
|
+
height: 10px;
|
|
281
|
+
|
|
282
|
+
margin-left: -8px;
|
|
283
|
+
|
|
284
|
+
appearance: none;
|
|
323
285
|
|
|
324
286
|
border: 0;
|
|
325
287
|
border-radius: 4px;
|
|
326
|
-
|
|
327
|
-
/* stylelint-disable-next-line property-no-vendor-prefix */
|
|
328
|
-
-webkit-appearance: none;
|
|
329
288
|
}
|
|
330
289
|
|
|
331
290
|
input[type=range]:disabled::-webkit-slider-thumb {
|
|
@@ -335,112 +294,65 @@ const La=t=>t??K;customElements.define("decidables-slider",class extends Ha{stat
|
|
|
335
294
|
|
|
336
295
|
input[type=range]:enabled::-webkit-slider-thumb {
|
|
337
296
|
background: var(---decidables-slider-color);
|
|
338
|
-
box-shadow: var(---shadow-2
|
|
297
|
+
box-shadow: var(---shadow-2);
|
|
339
298
|
}
|
|
340
299
|
|
|
341
300
|
input[type=range]:enabled:hover::-webkit-slider-thumb {
|
|
342
|
-
box-shadow: var(---shadow-4
|
|
301
|
+
box-shadow: var(---shadow-4);
|
|
343
302
|
}
|
|
344
303
|
|
|
345
304
|
input[type=range]:enabled:active::-webkit-slider-thumb {
|
|
346
|
-
box-shadow: var(---shadow-8
|
|
305
|
+
box-shadow: var(---shadow-8);
|
|
347
306
|
}
|
|
348
307
|
|
|
349
|
-
|
|
350
|
-
box-shadow: var(---shadow-4
|
|
308
|
+
input[type=range]:enabled:focus-visible::-webkit-slider-thumb {
|
|
309
|
+
box-shadow: var(---shadow-4);
|
|
351
310
|
}
|
|
352
311
|
|
|
353
|
-
|
|
354
|
-
box-shadow: var(---shadow-8
|
|
312
|
+
input[type=range]:enabled:focus-visible:active::-webkit-slider-thumb {
|
|
313
|
+
box-shadow: var(---shadow-8);
|
|
355
314
|
}
|
|
356
315
|
|
|
357
|
-
/* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
|
|
358
316
|
input[type=range]::-moz-range-thumb {
|
|
359
|
-
width:
|
|
360
|
-
height:
|
|
317
|
+
width: 20px;
|
|
318
|
+
height: 10px;
|
|
361
319
|
|
|
362
320
|
border: 0;
|
|
363
321
|
border-radius: 4px;
|
|
364
322
|
}
|
|
365
323
|
|
|
366
|
-
/* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
|
|
367
324
|
input[type=range]:disabled::-moz-range-thumb {
|
|
368
325
|
background: var(---decidables-slider-background-color);
|
|
369
326
|
box-shadow: none;
|
|
370
327
|
}
|
|
371
328
|
|
|
372
|
-
/* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
|
|
373
329
|
input[type=range]:enabled::-moz-range-thumb {
|
|
374
330
|
background: var(---decidables-slider-color);
|
|
375
|
-
box-shadow: var(---shadow-2
|
|
331
|
+
box-shadow: var(---shadow-2);
|
|
376
332
|
}
|
|
377
333
|
|
|
378
|
-
/* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
|
|
379
334
|
input[type=range]:enabled:hover::-moz-range-thumb {
|
|
380
|
-
box-shadow: var(---shadow-4
|
|
335
|
+
box-shadow: var(---shadow-4);
|
|
381
336
|
}
|
|
382
337
|
|
|
383
|
-
/* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
|
|
384
338
|
input[type=range]:enabled:active::-moz-range-thumb {
|
|
385
|
-
box-shadow: var(---shadow-8
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
:host(.keyboard) input[type=range]:enabled:focus::-moz-range-thumb {
|
|
389
|
-
box-shadow: var(---shadow-4-rotate);
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
:host(.keyboard) input[type=range]:enabled:focus:active::-moz-range-thumb {
|
|
393
|
-
box-shadow: var(---shadow-8-rotate);
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
/* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
|
|
397
|
-
input[type=range]::-ms-thumb {
|
|
398
|
-
width: 10px;
|
|
399
|
-
height: 20px;
|
|
400
|
-
margin-top: 0;
|
|
401
|
-
|
|
402
|
-
background: #999999;
|
|
403
|
-
/* background: var(---color-element-enabled); */
|
|
404
|
-
border: 0;
|
|
405
|
-
border-radius: 4px;
|
|
406
|
-
box-shadow: var(---shadow-2-rotate);
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
/* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
|
|
410
|
-
input[type=range]:disabled::-ms-thumb {
|
|
411
|
-
background: var(---decidables-slider-background-color);
|
|
412
|
-
box-shadow: none;
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
/* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
|
|
416
|
-
input[type=range]:enabled::-ms-thumb {
|
|
417
|
-
background: var(---decidables-slider-color);
|
|
418
|
-
box-shadow: var(---shadow-2-rotate);
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
/* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
|
|
422
|
-
input[type=range]:enabled:hover::-ms-thumb {
|
|
423
|
-
box-shadow: var(---shadow-4-rotate);
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
/* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
|
|
427
|
-
input[type=range]:enabled:active::-ms-thumb {
|
|
428
|
-
box-shadow: var(---shadow-8-rotate);
|
|
339
|
+
box-shadow: var(---shadow-8);
|
|
429
340
|
}
|
|
430
341
|
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
box-shadow: var(---shadow-4-rotate);
|
|
342
|
+
input[type=range]:enabled:focus-visible::-moz-range-thumb {
|
|
343
|
+
box-shadow: var(---shadow-4);
|
|
434
344
|
}
|
|
435
345
|
|
|
436
|
-
|
|
437
|
-
box-shadow: var(---shadow-8
|
|
346
|
+
input[type=range]:enabled:focus-visible:active::-moz-range-thumb {
|
|
347
|
+
box-shadow: var(---shadow-8);
|
|
438
348
|
}
|
|
439
349
|
|
|
440
|
-
|
|
350
|
+
/* Tick marks */
|
|
351
|
+
.datalist {
|
|
441
352
|
position: absolute;
|
|
442
353
|
left: 2rem;
|
|
443
354
|
z-index: -1;
|
|
355
|
+
|
|
444
356
|
display: flex;
|
|
445
357
|
|
|
446
358
|
flex-direction: column;
|
|
@@ -453,14 +365,13 @@ const La=t=>t??K;customElements.define("decidables-slider",class extends Ha{stat
|
|
|
453
365
|
font-size: 0.75rem;
|
|
454
366
|
}
|
|
455
367
|
|
|
456
|
-
option {
|
|
457
|
-
padding: 0;
|
|
458
|
-
|
|
368
|
+
.option {
|
|
459
369
|
line-height: 0.8;
|
|
460
|
-
|
|
370
|
+
|
|
371
|
+
white-space: nowrap;
|
|
461
372
|
}
|
|
462
373
|
|
|
463
|
-
option::before {
|
|
374
|
+
.option::before {
|
|
464
375
|
content: "– ";
|
|
465
376
|
}
|
|
466
377
|
`]}render(){return V`
|
|
@@ -468,29 +379,30 @@ const La=t=>t??K;customElements.define("decidables-slider",class extends Ha{stat
|
|
|
468
379
|
<slot></slot>
|
|
469
380
|
</label>
|
|
470
381
|
<div class="range">
|
|
471
|
-
<input ?disabled=${this.disabled} type="range" id="slider" min=${
|
|
382
|
+
<input ?disabled=${this.disabled} type="range" id="slider" min=${Ha(this.rangeMin)} max=${Ha(this.rangeMax)} step=${Ha(this.rangeStep)} .value=${this.rangeValue} @change=${this.rangeChanged.bind(this)} @input=${this.rangeInputted.bind(this)}>
|
|
472
383
|
${this.scale?V`
|
|
473
|
-
<
|
|
474
|
-
<option
|
|
475
|
-
<option
|
|
476
|
-
</
|
|
384
|
+
<div class="datalist">
|
|
385
|
+
<div class="option">${Ha(this.max)}</div>
|
|
386
|
+
<div class="option">${Ha(this.min)}</div>
|
|
387
|
+
</div>
|
|
477
388
|
`:V``}
|
|
478
389
|
</div>
|
|
479
|
-
<decidables-spinner ?disabled=${this.disabled} min=${
|
|
480
|
-
`}});customElements.define("decidables-spinner",class extends
|
|
390
|
+
<decidables-spinner ?disabled=${this.disabled} min=${Ha(this.min)} max=${Ha(this.max)} step=${Ha(this.step)} .value=${this.value} @input=${this.spinnerInputted.bind(this)}></decidables-spinner>
|
|
391
|
+
`}});customElements.define("decidables-spinner",class extends La{static get properties(){return{disabled:{attribute:"disabled",type:Boolean,reflect:!0},max:{attribute:"max",type:Number,reflect:!0},min:{attribute:"min",type:Number,reflect:!0},step:{attribute:"step",type:Number,reflect:!0},value:{attribute:"value",type:Number,reflect:!0}}}constructor(){super(),this.disabled=!1,this.max=void 0,this.min=void 0,this.step=void 0,this.value=void 0}inputted(t){this.value=t.target.value}static get styles(){return[super.styles,o`
|
|
481
392
|
:host {
|
|
482
393
|
---decidables-spinner-font-size: var(--decidables-spinner-font-size, 1.125rem);
|
|
483
394
|
---decidables-spinner-input-width: var(--decidables-spinner-input-width, 4rem);
|
|
484
395
|
---decidables-spinner-prefix: var(--decidables-spinner-prefix, "");
|
|
485
396
|
|
|
486
397
|
---decidables-spinner-postfix: var(--decidables-spinner-postfix, "");
|
|
487
|
-
---decidables-spinner-postfix-padding: var(--decidables-spinner-postfix-padding,
|
|
398
|
+
---decidables-spinner-postfix-padding: var(--decidables-spinner-postfix-padding, 0rem);
|
|
488
399
|
|
|
489
400
|
display: block;
|
|
490
401
|
}
|
|
491
402
|
|
|
492
403
|
label {
|
|
493
404
|
position: relative;
|
|
405
|
+
|
|
494
406
|
display: flex;
|
|
495
407
|
|
|
496
408
|
flex-direction: column;
|
|
@@ -508,6 +420,7 @@ const La=t=>t??K;customElements.define("decidables-slider",class extends Ha{stat
|
|
|
508
420
|
left: calc(50% - var(---decidables-spinner-input-width) / 2 + 0.25rem);
|
|
509
421
|
|
|
510
422
|
font-size: var(---decidables-spinner-font-size);
|
|
423
|
+
|
|
511
424
|
line-height: normal;
|
|
512
425
|
|
|
513
426
|
content: var(---decidables-spinner-prefix);
|
|
@@ -519,6 +432,7 @@ const La=t=>t??K;customElements.define("decidables-slider",class extends Ha{stat
|
|
|
519
432
|
bottom: 1px;
|
|
520
433
|
|
|
521
434
|
font-size: var(---decidables-spinner-font-size);
|
|
435
|
+
|
|
522
436
|
line-height: normal;
|
|
523
437
|
|
|
524
438
|
content: var(---decidables-spinner-postfix);
|
|
@@ -526,20 +440,24 @@ const La=t=>t??K;customElements.define("decidables-slider",class extends Ha{stat
|
|
|
526
440
|
|
|
527
441
|
input[type=number] {
|
|
528
442
|
width: var(---decidables-spinner-input-width);
|
|
529
|
-
|
|
443
|
+
|
|
444
|
+
padding: 1px var(---decidables-spinner-postfix-padding) 1px 2px;
|
|
445
|
+
margin: 0;
|
|
530
446
|
|
|
531
447
|
font-family: var(---font-family-base);
|
|
532
448
|
font-size: var(---decidables-spinner-font-size);
|
|
449
|
+
|
|
533
450
|
color: inherit;
|
|
451
|
+
|
|
534
452
|
text-align: right;
|
|
535
453
|
|
|
454
|
+
appearance: none;
|
|
455
|
+
outline: none;
|
|
456
|
+
|
|
536
457
|
background: none;
|
|
537
458
|
border: 0;
|
|
538
459
|
border-radius: 0;
|
|
539
|
-
outline: none;
|
|
540
460
|
box-shadow: var(---shadow-2);
|
|
541
|
-
|
|
542
|
-
-webkit-appearance: none; /* stylelint-disable-line property-no-vendor-prefix */
|
|
543
461
|
}
|
|
544
462
|
|
|
545
463
|
input[type=number]:hover {
|
|
@@ -556,27 +474,61 @@ const La=t=>t??K;customElements.define("decidables-slider",class extends Ha{stat
|
|
|
556
474
|
|
|
557
475
|
border: 0;
|
|
558
476
|
box-shadow: none;
|
|
477
|
+
}
|
|
559
478
|
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
479
|
+
/* HACK: Manage spinners in Firefox */
|
|
480
|
+
@supports (-moz-appearance: textfield) {
|
|
481
|
+
input[type=number] {
|
|
482
|
+
padding-right: calc(18px + var(---decidables-spinner-postfix-padding));
|
|
483
|
+
|
|
484
|
+
appearance: textfield;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
input[type=number]:hover,
|
|
488
|
+
input[type=number]:focus,
|
|
489
|
+
input[type=number]:active {
|
|
490
|
+
padding-right: var(---decidables-spinner-postfix-padding);
|
|
491
|
+
|
|
492
|
+
appearance: none;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
input[type=number]:disabled {
|
|
496
|
+
padding-right: calc(18px + var(---decidables-spinner-postfix-padding));
|
|
497
|
+
|
|
498
|
+
appearance: textfield;
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
/* HACK: Manage spinners in Chrome/Edge/Safari */
|
|
503
|
+
input[type=number]::-webkit-inner-spin-button {
|
|
504
|
+
/* Avoid oversized spinners in Safari */
|
|
505
|
+
font-size: 1.125rem;
|
|
506
|
+
|
|
507
|
+
opacity: 0;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
input[type=number]:hover::-webkit-inner-spin-button,
|
|
511
|
+
input[type=number]:focus::-webkit-inner-spin-button,
|
|
512
|
+
input[type=number]:active::-webkit-inner-spin-button {
|
|
513
|
+
opacity: 1;
|
|
566
514
|
}
|
|
567
515
|
|
|
568
|
-
/* HACK: Hide spinners in disabled input for Firefox and Safari */
|
|
569
|
-
input[type=number]:disabled::-webkit-outer-spin-button,
|
|
570
516
|
input[type=number]:disabled::-webkit-inner-spin-button {
|
|
571
|
-
|
|
572
|
-
|
|
517
|
+
opacity: 0;
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
/* HACK: Adjust padding on mobile w/o spinners */
|
|
521
|
+
@media only screen and (hover: none) and (pointer: coarse) {
|
|
522
|
+
input[type=number] {
|
|
523
|
+
padding-right: calc(1.125rem + var(---decidables-spinner-postfix-padding));
|
|
524
|
+
}
|
|
573
525
|
}
|
|
574
526
|
`]}render(){return V`
|
|
575
527
|
<label>
|
|
576
528
|
<slot></slot>
|
|
577
|
-
<input ?disabled=${this.disabled} type="number" min=${
|
|
529
|
+
<input ?disabled=${this.disabled} type="number" min=${Ha(this.min)} max=${Ha(this.max)} step=${Ha(this.step)} .value=${this.value} @input=${this.inputted.bind(this)}>
|
|
578
530
|
</label>
|
|
579
|
-
`}});customElements.define("decidables-switch",class extends
|
|
531
|
+
`}});customElements.define("decidables-switch",class extends La{static get properties(){return{checked:{attribute:"checked",type:Boolean,reflect:!0},disabled:{attribute:"disabled",type:Boolean,reflect:!0}}}constructor(){super(),this.checked=!1,this.disabled=!1}changed(t){this.checked=t.target.checked,this.dispatchEvent(new CustomEvent("change",{detail:{checked:this.checked},bubbles:!0}))}static get styles(){return[super.styles,o`
|
|
580
532
|
:host {
|
|
581
533
|
display: flex;
|
|
582
534
|
|
|
@@ -593,13 +545,16 @@ const La=t=>t??K;customElements.define("decidables-slider",class extends Ha{stat
|
|
|
593
545
|
|
|
594
546
|
width: 1px;
|
|
595
547
|
height: 1px;
|
|
548
|
+
|
|
596
549
|
padding: 0;
|
|
597
550
|
margin: -1px;
|
|
551
|
+
|
|
598
552
|
overflow: hidden;
|
|
599
553
|
|
|
600
554
|
white-space: nowrap;
|
|
601
555
|
|
|
602
556
|
border: 0;
|
|
557
|
+
|
|
603
558
|
clip-path: inset(100%); /* May cause a performance issue: https://github.com/h5bp/html5-boilerplate/issues/2021 */
|
|
604
559
|
}
|
|
605
560
|
|
|
@@ -615,6 +570,7 @@ const La=t=>t??K;customElements.define("decidables-slider",class extends Ha{stat
|
|
|
615
570
|
position: relative;
|
|
616
571
|
|
|
617
572
|
min-width: 24px;
|
|
573
|
+
|
|
618
574
|
padding: 0 0 36px;
|
|
619
575
|
margin: 0.25rem 0.25rem 0;
|
|
620
576
|
|
|
@@ -626,17 +582,17 @@ const La=t=>t??K;customElements.define("decidables-slider",class extends Ha{stat
|
|
|
626
582
|
input[type=checkbox] + label + label::before,
|
|
627
583
|
input[type=checkbox] + label + label::after {
|
|
628
584
|
position: absolute;
|
|
629
|
-
|
|
630
585
|
left: 50%;
|
|
631
586
|
|
|
632
587
|
margin: 0;
|
|
633
588
|
|
|
634
|
-
content: "";
|
|
635
|
-
|
|
636
589
|
outline: 0;
|
|
637
590
|
|
|
638
|
-
|
|
591
|
+
content: "";
|
|
592
|
+
|
|
639
593
|
transform: translate(-50%, 0);
|
|
594
|
+
|
|
595
|
+
transition: all var(---transition-duration) ease;
|
|
640
596
|
}
|
|
641
597
|
|
|
642
598
|
input[type=checkbox] + label + label::before {
|
|
@@ -684,17 +640,14 @@ const La=t=>t??K;customElements.define("decidables-slider",class extends Ha{stat
|
|
|
684
640
|
box-shadow: var(---shadow-8);
|
|
685
641
|
}
|
|
686
642
|
|
|
687
|
-
|
|
688
|
-
:host(.keyboard) input[type=checkbox]:enabled:focus + label + label::after {
|
|
643
|
+
input[type=checkbox]:enabled:focus-visible + label + label::after {
|
|
689
644
|
box-shadow: var(---shadow-4);
|
|
690
645
|
}
|
|
691
646
|
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
:host(.keyboard) input[type=checkbox]:enabled:focus:active + label + label::after {
|
|
647
|
+
input[type=checkbox]:enabled:focus-visible + label + label:active::after,
|
|
648
|
+
input[type=checkbox]:enabled:focus-visible:active + label + label::after {
|
|
695
649
|
box-shadow: var(---shadow-8);
|
|
696
650
|
}
|
|
697
|
-
/* stylelint-enable selector-max-compound-selectors */
|
|
698
651
|
`]}render(){return V`
|
|
699
652
|
<input type="checkbox" id="switch" ?checked=${this.checked} ?disabled=${this.disabled} @change=${this.changed.bind(this)}>
|
|
700
653
|
<label for="switch">
|
|
@@ -703,7 +656,7 @@ const La=t=>t??K;customElements.define("decidables-slider",class extends Ha{stat
|
|
|
703
656
|
<label for="switch">
|
|
704
657
|
<slot></slot>
|
|
705
658
|
</label>
|
|
706
|
-
`}});customElements.define("decidables-toggle",class extends
|
|
659
|
+
`}});customElements.define("decidables-toggle",class extends La{static get properties(){return{disabled:{attribute:"disabled",type:Boolean,reflect:!0}}}constructor(){super(),this.disabled=!1}static get styles(){return[super.styles,o`
|
|
707
660
|
fieldset {
|
|
708
661
|
display: flex;
|
|
709
662
|
|
|
@@ -725,7 +678,7 @@ const La=t=>t??K;customElements.define("decidables-slider",class extends Ha{stat
|
|
|
725
678
|
<legend><slot name="label"></slot></legend>
|
|
726
679
|
<slot></slot>
|
|
727
680
|
</fieldset>
|
|
728
|
-
`}});customElements.define("decidables-toggle-option",class extends
|
|
681
|
+
`}});customElements.define("decidables-toggle-option",class extends La{static get properties(){return{checked:{attribute:"checked",type:Boolean,reflect:!0},disabled:{attribute:"disabled",type:Boolean,reflect:!0},name:{attribute:"name",type:String,reflect:!0},value:{attribute:"value",type:String,reflect:!0}}}constructor(){super(),this.checked=!1,this.disabled=!1,this.name=void 0,this.value=void 0}changed(t){this.checked=t.target.checked,this.dispatchEvent(new CustomEvent("change",{detail:{checked:this.checked,value:this.value},bubbles:!0}))}static get styles(){return[super.styles,o`
|
|
729
682
|
:host {
|
|
730
683
|
display: flex;
|
|
731
684
|
}
|
|
@@ -736,39 +689,46 @@ const La=t=>t??K;customElements.define("decidables-slider",class extends Ha{stat
|
|
|
736
689
|
|
|
737
690
|
width: 1px;
|
|
738
691
|
height: 1px;
|
|
692
|
+
|
|
739
693
|
padding: 0;
|
|
740
694
|
margin: -1px;
|
|
695
|
+
|
|
741
696
|
overflow: hidden;
|
|
742
697
|
|
|
743
698
|
white-space: nowrap;
|
|
744
699
|
|
|
745
700
|
border: 0;
|
|
701
|
+
|
|
746
702
|
clip-path: inset(100%); /* May cause a performance issue: https://github.com/h5bp/html5-boilerplate/issues/2021 */
|
|
747
703
|
}
|
|
748
704
|
|
|
749
705
|
input[type=radio] + label {
|
|
750
706
|
width: 100%;
|
|
707
|
+
|
|
751
708
|
padding: 0.375rem 0.75rem;
|
|
752
709
|
|
|
753
710
|
font-family: var(---font-family-base);
|
|
754
711
|
font-size: 1.125rem;
|
|
712
|
+
|
|
755
713
|
line-height: 1.5;
|
|
714
|
+
|
|
756
715
|
color: var(---color-text-inverse);
|
|
716
|
+
|
|
757
717
|
text-align: center;
|
|
758
718
|
|
|
759
719
|
cursor: pointer;
|
|
720
|
+
outline: none;
|
|
760
721
|
|
|
761
722
|
background-color: var(---color-element-enabled);
|
|
762
723
|
border: 0;
|
|
763
724
|
border-radius: 0;
|
|
764
|
-
outline: none;
|
|
765
|
-
|
|
766
725
|
box-shadow: var(---shadow-2);
|
|
767
726
|
}
|
|
768
727
|
|
|
769
728
|
input[type=radio]:checked + label {
|
|
770
|
-
background-color: var(---color-element-selected);
|
|
771
729
|
outline: none;
|
|
730
|
+
|
|
731
|
+
background-color: var(---color-element-selected);
|
|
772
732
|
box-shadow: var(---shadow-2);
|
|
773
733
|
}
|
|
774
734
|
|
|
@@ -776,6 +736,7 @@ const La=t=>t??K;customElements.define("decidables-slider",class extends Ha{stat
|
|
|
776
736
|
z-index: 1;
|
|
777
737
|
|
|
778
738
|
outline: none;
|
|
739
|
+
|
|
779
740
|
box-shadow: var(---shadow-4);
|
|
780
741
|
}
|
|
781
742
|
|
|
@@ -783,6 +744,7 @@ const La=t=>t??K;customElements.define("decidables-slider",class extends Ha{stat
|
|
|
783
744
|
z-index: 2;
|
|
784
745
|
|
|
785
746
|
outline: none;
|
|
747
|
+
|
|
786
748
|
box-shadow: var(---shadow-8);
|
|
787
749
|
}
|
|
788
750
|
|
|
@@ -796,25 +758,28 @@ const La=t=>t??K;customElements.define("decidables-slider",class extends Ha{stat
|
|
|
796
758
|
border-bottom-left-radius: 0.25rem;
|
|
797
759
|
}
|
|
798
760
|
|
|
799
|
-
|
|
761
|
+
input[type=radio]:focus-visible + label {
|
|
800
762
|
z-index: 1;
|
|
801
763
|
|
|
802
764
|
outline: none;
|
|
765
|
+
|
|
803
766
|
box-shadow: var(---shadow-4);
|
|
804
767
|
}
|
|
805
768
|
|
|
806
|
-
|
|
769
|
+
input[type=radio]:focus-visible:checked + label {
|
|
807
770
|
z-index: 1;
|
|
808
771
|
|
|
809
|
-
background-color: var(---color-element-selected);
|
|
810
772
|
outline: none;
|
|
773
|
+
|
|
774
|
+
background-color: var(---color-element-selected);
|
|
811
775
|
box-shadow: var(---shadow-4);
|
|
812
776
|
}
|
|
813
777
|
|
|
814
|
-
|
|
778
|
+
input[type=radio]:focus-visible + label:active {
|
|
815
779
|
z-index: 2;
|
|
816
780
|
|
|
817
781
|
outline: none;
|
|
782
|
+
|
|
818
783
|
box-shadow: var(---shadow-8);
|
|
819
784
|
}
|
|
820
785
|
`]}render(){return V`
|
|
@@ -822,7 +787,7 @@ const La=t=>t??K;customElements.define("decidables-slider",class extends Ha{stat
|
|
|
822
787
|
<label for="toggle-option">
|
|
823
788
|
<slot></slot>
|
|
824
789
|
</label>
|
|
825
|
-
`}});const Va={fromAttribute:t=>t.split(/\s+/).map(t=>Number.parseFloat(t)),toAttribute:t=>t.length?t.map(t=>t.toFixed(3)).join(" "):null},Ba={fromAttribute:t=>new Set(t.split(/\s+/)),toAttribute:t=>t.size?[...t].join(" "):null};function Xa(t){return class extends t{static get properties(){return{width:{attribute:!1,type:Number,reflect:!1},height:{attribute:!1,type:Number,reflect:!1},rem:{attribute:!1,type:Number,reflect:!1}}}constructor(){super(),this.width=NaN,this.height=NaN,this.rem=NaN}getDimensions(){this.width=parseFloat(this.getComputedStyleValue("width"),10),this.height=parseFloat(this.getComputedStyleValue("height"),10),this.rem=parseFloat(getComputedStyle(document.documentElement).getPropertyValue("font-size"),10)}connectedCallback(){super.connectedCallback(),this.resizeObserver=new ResizeObserver(this.getDimensions.bind(this)),this.resizeObserver.observe(this)}disconnectedCallback(){this.resizeObserver.unobserve(this),super.disconnectedCallback()}}}var Ka={h:"#4daf4a",m:"#ff7f00",fa:"#377eb8",cr:"#e41a1c",hr:"#ffff33",far:"#984ea3",acc:"#999999",d:"#f781bf",c:"#a65628",s:"#4545d0",present:"#f032e6",absent:"#10dbc9",correct:"#ffffff",error:"#000000",nr:"#cccccc"};class Za extends
|
|
790
|
+
`}});const Va={fromAttribute:t=>t.split(/\s+/).map(t=>Number.parseFloat(t)),toAttribute:t=>t.length?t.map(t=>t.toFixed(3)).join(" "):null},Ba={fromAttribute:t=>new Set(t.split(/\s+/)),toAttribute:t=>t.size?[...t].join(" "):null};function Xa(t){return class extends t{static get properties(){return{width:{attribute:!1,type:Number,reflect:!1},height:{attribute:!1,type:Number,reflect:!1},rem:{attribute:!1,type:Number,reflect:!1}}}constructor(){super(),this.width=NaN,this.height=NaN,this.rem=NaN}getDimensions(){this.width=parseFloat(this.getComputedStyleValue("width"),10),this.height=parseFloat(this.getComputedStyleValue("height"),10),this.rem=parseFloat(getComputedStyle(document.documentElement).getPropertyValue("font-size"),10)}connectedCallback(){super.connectedCallback(),this.resizeObserver=new ResizeObserver(this.getDimensions.bind(this)),this.resizeObserver.observe(this)}disconnectedCallback(){this.resizeObserver.unobserve(this),super.disconnectedCallback()}}}var Ka={h:"#4daf4a",m:"#ff7f00",fa:"#377eb8",cr:"#e41a1c",hr:"#ffff33",far:"#984ea3",acc:"#999999",d:"#f781bf",c:"#a65628",s:"#4545d0",present:"#f032e6",absent:"#10dbc9",correct:"#ffffff",error:"#000000",nr:"#cccccc"};class Za extends La{static get properties(){return{interactive:{attribute:"interactive",type:Boolean,reflect:!0}}}constructor(){super(),this.interactive=!1}static get colors(){return Ka}static get lights(){return Object.keys(Za.colors).reduce((t,e)=>(t[e]=tn(Za.colors[e],"#ffffff")(.5),t),{})}static get darks(){return Object.keys(Za.colors).reduce((t,e)=>(t[e]=tn(Za.colors[e],"#000000")(.5),t),{})}static get styles(){return[super.styles,o`
|
|
826
791
|
:host {
|
|
827
792
|
---color-h: var(--color-h, ${a(this.colors.h)});
|
|
828
793
|
---color-m: var(--color-m, ${a(this.colors.m)});
|
|
@@ -992,6 +957,7 @@ const La=t=>t??K;customElements.define("decidables-slider",class extends Ha{stat
|
|
|
992
957
|
|
|
993
958
|
width: 6rem;
|
|
994
959
|
height: 3.5rem;
|
|
960
|
+
|
|
995
961
|
padding: 0.375rem 0.75rem;
|
|
996
962
|
margin: 0.25rem;
|
|
997
963
|
|
|
@@ -1038,6 +1004,7 @@ const La=t=>t??K;customElements.define("decidables-slider",class extends Ha{stat
|
|
|
1038
1004
|
|
|
1039
1005
|
.feedback .outcome {
|
|
1040
1006
|
font-weight: 600;
|
|
1007
|
+
|
|
1041
1008
|
line-height: 1.15;
|
|
1042
1009
|
}
|
|
1043
1010
|
|
|
@@ -1071,7 +1038,7 @@ const La=t=>t??K;customElements.define("decidables-slider",class extends Ha{stat
|
|
|
1071
1038
|
<span class="label">Total: </span><span class="value">${e(this.totalPayoff)}</span>
|
|
1072
1039
|
</div>`:V``}
|
|
1073
1040
|
</div>`:V``}
|
|
1074
|
-
</div>`}}function Ga(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}customElements.define("detectable-response",Ya);var Qa={exports:{}};!function(t){t.exports=function(){var t=function(t,e){var r=Array.prototype.concat,n=Array.prototype.slice,s=Object.prototype.toString;function i(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]"===s.call(t)};function o(t){return"[object Function]"===s.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 f(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:i,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(s){r[s][n]=t[s][e]})}),r}for(var n=new Array(t.length),s=0;s<t.length;s++)n[s]=[t[s][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,s,i,o=[];for(a(t[0])||(t=[t]),r=t.length,n=t[0].length,i=0;i<n;i++){for(e=new Array(r),s=0;s<r;s++)e[s]=t[s][i];o.push(e)}return 1===o.length?o[0]:o},h.map=function(t,e,r){var n,s,i,o,l;for(a(t[0])||(t=[t]),s=t.length,i=t[0].length,o=r?t:new Array(s),n=0;n<s;n++)for(o[n]||(o[n]=new Array(i)),l=0;l<i;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,s,i,o,l;for(a(t[0])||(t=[t]),s=t.length,i=t[0].length,o=r?t:new Array(s),n=0;n<s;n++)for(o[n]||(o[n]=new Array(i)),i>0&&(o[n][0]=t[n][0]),l=1;l<i;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,s,i=new Array(t);for(o(e)&&(r=e,e=t),n=0;n<t;n++)for(i[n]=new Array(e),s=0;s<e;s++)i[n][s]=r(n,s);return i},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,f)},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 s,a=[],l=i(t,e),c=(e*l-t*l)/((r-1)*l),h=t;for(s=0;h<=e&&s<r;h=(t*l+c*l*++s)/l)a.push(n?n(h,s):h);return a},h.arange=function(t,r,n){var s,i=[];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(s=t;s<r;s+=n)i.push(s);else for(s=t;s>r;s+=n)i.push(s);return i},h.slice=function(){function t(t,r,n,s){var i,a=[],o=t.length;if(r===e&&n===e&&s===e)return h.copy(t);if(s=s||1,(r=(r=r||0)>=0?r:o+r)===(n=(n=n||t.length)>=0?n:o+n)||0===s)return[];if(r<n&&s<0)return[];if(r>n&&s>0)return[];if(s>0)for(i=r;i<n;i+=s)a.push(t[i]);else for(i=r;i>n;i+=s)a.push(t[i]);return a}function r(e,r){var n,s;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),(s=r.row||{}).start,s.end,s.step):(s=r.row||{},n=r.col||{},t(e,s.start,s.end,s.step).map(function(e){return t(e,n.start,n.end,n.step)}))}return r}(),h.sliceAssign=function(r,n,s){var i,a;if(l(n.row)){if(l(n.col))return r[n.row][n.col]=s;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,i=h.arange(n.col.start,t.min(r.length,n.col.end),n.col.step);var o=n.row;return i.forEach(function(t,e){r[o][t]=s[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]=s[e]}),r}return s[0].length===e&&(s=[s]),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),i=h.arange(n.col.start,t.min(r[0].length,n.col.end),n.col.step),a.forEach(function(t,e){i.forEach(function(n,i){r[t][n]=s[e][i]})}),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 p=h.prototype;return p.length=0,p.push=Array.prototype.push,p.sort=Array.prototype.sort,p.splice=Array.prototype.splice,p.slice=Array.prototype.slice,p.toArray=function(){return this.length>1?n.call(this):n.call(this)[0]},p.map=function(t,e){return h(h.map(this,t,e))},p.cumreduce=function(t,e){return h(h.cumreduce(this,t,e))},p.alter=function(t){return h.alter(this,t),this},function(t){for(var e=0;e<t.length;e++)(function(t){p[t]=function(e){var r,n=this;return e?(setTimeout(function(){e.call(n,p[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){p[t]=function(e,r){var n=this;return r?(setTimeout(function(){r.call(n,p[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){p[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 s(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),s=0,i=e.length;--i>=0;)s+=(r=e[i]-n)*r;return s},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),s=t.mean(n);return e.exp(s)},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=[],s={};for(e=0;e<t.length;e++)s[l=t[e]]?s[l]++:(s[l]=1,r.push(l));var i=r.sort(n),a={},o=1;for(e=0;e<i.length;e++){var l,c=s[l=i[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,s=t.slice().sort(n),i=1,a=0,o=0,l=[];for(e=0;e<r;e++)s[e]===s[e+1]?i++:(i>a?(l=[s[e]],a=i,o=0):i===a&&(l.push(s[e]),o++),i=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,s=new Array(n),i=0;i<n;i++)s[i]=e[i]-r;return s},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),s=[],i=r.length-1;i>=0;i--)s.push(e.abs(r[i]-n));return t.mean(s)},t.meddev=function(r){for(var n=t.median(r),s=[],i=r.length-1;i>=0;i--)s.push(e.abs(r[i]-n));return t.median(s)},t.coeffvar=function(e){return t.stdev(e)/t.mean(e)},t.quartiles=function(t){var r=t.length,s=t.slice().sort(n);return[s[e.round(r/4)-1],s[e.round(r/2)-1],s[e.round(3*r/4)-1]]},t.quantiles=function(t,r,i,a){var o,l,c,h,u,d=t.slice().sort(n),f=[r.length],p=t.length;for(void 0===i&&(i=3/8),void 0===a&&(a=3/8),o=0;o<r.length;o++)c=p*(l=r[o])+(i+l*(1-i-a)),h=e.floor(s(c,1,p-1)),u=s(c-h,0,1),f[o]=(1-u)*d[h-1]+u*d[h];return f},t.percentile=function(t,e,r){var s=t.slice().sort(n),i=e*(s.length+(r?1:-1))+(r?0:1),a=parseInt(i),o=i-a;return a+1<s.length?s[a-1]+o*(s[a]-s[a-1]):s[a-1]},t.percentileOfScore=function(t,e,r){var n,s,i=0,a=t.length,o=!1;for("strict"===r&&(o=!0),s=0;s<a;s++)n=t[s],(o&&n<e||!o&&n<=e)&&i++;return i/a},t.histogram=function(r,n){n=n||4;var s,i=t.min(r),a=(t.max(r)-i)/n,o=r.length,l=[];for(s=0;s<n;s++)l[s]=0;for(s=0;s<o;s++)l[e.min(e.floor((r[s]-i)/a),n-1)]+=1;return l},t.covariance=function(e,r){var n,s=t.mean(e),i=t.mean(r),a=e.length,o=new Array(a);for(n=0;n<a;n++)o[n]=(e[n]-s)*(r[n]-i);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 s=t.mean(r),i=t.stdev(r),a=r.length,o=0,l=0;l<a;l++)o+=e.pow((r[l]-s)/i,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 i=t.prototype;!function(e){for(var n=0;n<e.length;n++)(function(e){i[e]=function(n,s){var a=[],o=0,l=this;if(r(n)&&(s=n,n=!1),s)return setTimeout(function(){s.call(l,i[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){i[e]=function(n,s){var a=[],o=0,l=this;if(r(n)&&(s=n,n=!1),s)return setTimeout(function(){s.call(l,i[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){i[e]=function(){var n,s=[],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,i[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++)s[a]=h(o[a]);return s}return h(this[0])}})(e[n])}("quantiles percentileOfScore".split(" "))}(t,Math),function(t,e){t.gammaln=function(t){var r,n,s,i=0,a=[76.18009172947146,-86.50532032941678,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18],o=1.000000000190015;for(s=(n=r=t)+5.5,s-=(r+.5)*e.log(s);i<6;i++)o+=a[i]/++n;return e.log(2.5066282746310007*o/r)-s},t.loggam=function(t){var r,n,s,i,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),s=2*e.PI,a=c[9],o=8;o>=0;o--)a*=n,a+=c[o];if(i=a/r+.5*e.log(s)+(r-.5)*e.log(r)-r,t<=7)for(o=1;o<=l;o++)i-=e.log(r-1),r-=1;return i},t.gammafn=function(t){var r,n,s,i,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(!(i=d%1+36e-17))return 1/0;l=(1&d?-1:1)*e.PI/e.sin(e.PI*i),d=1-d}for(s=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(i=u/h+1,s<d)i/=s;else if(s>d)for(r=0;r<c;++r)i*=d,d++;return l&&(i=l/i),i},t.gammap=function(e,r){return t.lowRegGamma(e,r)*t.gammafn(e)},t.lowRegGamma=function(r,n){var s,i=t.gammaln(r),a=r,o=1/r,l=o,c=n+1-r,h=1/1e-30,u=1/c,d=u,f=1,p=-~(8.5*e.log(r>=1?r:1/r)+.4*r+17);if(n<0||r<=0)return NaN;if(n<r+1){for(;f<=p;f++)o+=l*=n/++a;return o*e.exp(-n+r*e.log(n)-i)}for(;f<=p;f++)d*=(u=1/(u=(s=-f*(f-r))*u+(c+=2)))*(h=c+s/h);return 1-d*e.exp(-n+r*e.log(n)-i)},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 s,i,a,o,l=1e-30,c=1,h=r+n,u=r+1,d=r-1,f=1,p=1-h*t/u;for(e.abs(p)<l&&(p=l),o=p=1/p;c<=100&&(p=1+(i=c*(n-c)*t/((d+(s=2*c))*(r+s)))*p,e.abs(p)<l&&(p=l),f=1+i/f,e.abs(f)<l&&(f=l),o*=(p=1/p)*f,p=1+(i=-(r+c)*(h+c)*t/((r+s)*(u+s)))*p,e.abs(p)<l&&(p=l),f=1+i/f,e.abs(f)<l&&(f=l),o*=a=(p=1/p)*f,!(e.abs(a-1)<3e-7));c++);return o},t.gammapinv=function(r,n){var s,i,a,o,l,c,h=0,u=n-1,d=1e-8,f=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)-f),o=r<.5?r:1-r,s=(2.30753+.27061*(i=e.sqrt(-2*e.log(o))))/(1+i*(.99229+.04481*i))-i,r<.5&&(s=-s),s=e.max(.001,n*e.pow(1-1/(9*n)-s/(3*e.sqrt(n)),3))):s=r<(i=1-n*(.253+.12*n))?e.pow(r/i,1/n):1-e.log(1-(r-i)/(1-i));h<12;h++){if(s<=0)return 0;if((s-=i=(a=(t.lowRegGamma(n,s)-r)/(i=n>1?c*e.exp(-(s-u)+u*(e.log(s)-l)):e.exp(-s+u*e.log(s)-f)))/(1-.5*e.min(1,a*((n-1)/s-1))))<=0&&(s=.5*(s+i)),e.abs(i)<d*s)break}return s},t.erf=function(t){var r,n,s,i,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--)s=c,c=n*c-h+a[o],h=s;return i=r*e.exp(-t*t+.5*(a[0]+n*c)-h),l?i-1:1-i},t.erfc=function(e){return 1-t.erf(e)},t.erfcinv=function(r){var n,s,i,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*(i=e.sqrt(-2*e.log(a/2))))/(1+i*(.99229+.04481*i))-i);o<2;o++)n+=(s=t.erfc(n)-a)/(1.1283791670955126*e.exp(-n*n)-n*s);return r<1?n:-n},t.ibetainv=function(r,n,s){var i,a,o,l,c,h,u,d,f,p,m=1e-8,b=n-1,g=s-1,v=0;if(r<=0)return 0;if(r>=1)return 1;for(n>=1&&s>=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*s-1)),f=h*e.sqrt(u+d)/d-(1/(2*s-1)-1/(2*n-1))*(u+5/6-2/(3*d)),h=n/(n+s*e.exp(2*f))):(i=e.log(n/(n+s)),a=e.log(s/(n+s)),h=r<(l=e.exp(n*i)/n)/(f=l+(c=e.exp(s*a)/s))?e.pow(n*f*r,1/n):1-e.pow(s*f*(1-r),1/s)),p=-t.gammaln(n)-t.gammaln(s)+t.gammaln(n+s);v<10;v++){if(0===h||1===h)return h;if((h-=l=(c=(t.ibeta(h,n,s)-r)/(l=e.exp(b*e.log(h)+g*e.log(1-h)+p)))/(1-.5*e.min(1,c*(b/h-g/(1-h)))))<=0&&(h=.5*(h+l)),h>=1&&(h=.5*(h+l+1)),e.abs(l)<m*h&&v>0)break}return h},t.ibeta=function(r,n,s){var i=0===r||1===r?0:e.exp(t.gammaln(n+s)-t.gammaln(n)-t.gammaln(s)+n*e.log(r)+s*e.log(1-r));return!(r<0||r>1)&&(r<(n+1)/(n+s+2)?i*t.betacf(r,n,s)/n:1-i*t.betacf(1-r,s,n)/s)},t.randn=function(r,n){var s,i,a,o,l;if(n||(n=r),r)return t.create(r,n,function(){return t.randn()});do{s=t._random_fn(),i=1.7156*(t._random_fn()-.5),l=(a=s-.449871)*a+(o=e.abs(i)+.386595)*(.196*o-.25472*a)}while(l>.27597&&(l>.27846||i*i>-4*e.log(s)*s*s));return i/s},t.randg=function(r,n,s){var i,a,o,l,c,h,u=r;if(s||(s=n),r||(r=1),n)return(h=t.zeros(n,s)).alter(function(){return t.randg(r)}),h;r<1&&(r+=1),i=r-1/3,a=1/e.sqrt(9*i);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+i*(1-l+e.log(l)));if(r==u)return i*l;do{o=t._random_fn()}while(0===o);return e.pow(o,1/u)*i*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,s){for(var i,a=0,o=1,l=1,c=1,h=0,u=0;e.abs((l-u)/l)>s;)u=l,o=c+(i=-(r+h)*(r+n+h)*t/(r+2*h)/(r+2*h+1))*o,l=(a=l+i*a)+(i=(h+=1)*(n-h)*t/(r+2*h-1)/(r+2*h))*l,a/=c=o+i*c,o/=c,l/=c,c=1;return l/r}function n(t){return t/e.abs(t)}function s(r,n,s){var i=12,a=6,o=-30,l=-50,c=60,h=8,u=3,d=2,f=3,p=[.9815606342467192,.9041172563704749,.7699026741943047,.5873179542866175,.3678314989981802,.1252334085114689],m=[.04717533638651183,.10693932599531843,.16007832854334622,.20316742672306592,.2334925365383548,.24914704581340277],b=.5*r;if(b>=h)return 1;var g,v=2*t.normal.cdf(b,0,1,1,0)-1;v=v>=e.exp(l/s)?e.pow(v,s):0;for(var y=b,w=(h-b)/(g=r>u?d:f),x=y+w,k=0,$=s-1,_=1;_<=g;_++){for(var S=0,M=.5*(x+y),A=.5*(x-y),E=1;E<=i;E++){var N,T=M+A*(a<E?p[(N=i-E+1)-1]:-p[(N=E)-1]),C=T*T;if(C>c)break;var R=2*t.normal.cdf(T,0,1,1,0)*.5-2*t.normal.cdf(T,r,1,1,0)*.5;R>=e.exp(o/$)&&(S+=R=m[N-1]*e.exp(-.5*C)*e.pow(R,$))}k+=S*=2*A*s/e.sqrt(2*e.PI),y=x,x+=w}return(v+=k)<=e.exp(o/n)?0:(v=e.pow(v,n))>=1?1:v}function i(t,r,n){var s=.322232421088,i=.099348462606,a=-1,o=.588581570495,l=-.342242088547,c=.531103462366,h=-.204231210125,u=.10353775285,d=-453642210148e-16,f=.0038560700634,p=.8832,m=.2368,b=1.208,g=1.4142,v=120,y=.5-.5*t,w=e.sqrt(e.log(1/(y*y))),x=w+((((w*d+h)*w+l)*w+a)*w+s)/((((w*f+u)*w+c)*w+o)*w+i);n<v&&(x+=(x*x*x+x)/n/4);var k=p-m*x;return n<v&&(k+=-1.214/n+b*x/n),x*(k*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,s){var i=t[e](r,n,s);return i.data=this,i},t[e].prototype.sample=function(r){var n=this._a,s=this._b,i=this._c;return r?t.alter(r,function(){return t[e].sample(n,s,i)}):t[e].sample(n,s,i)},function(r){for(var n=0;n<r.length;n++)(function(r){t[e].prototype[r]=function(n){var s=this._a,i=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,s,i,a)}):t[e][r](n,s,i,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,s){return r>1||r<0?0:1==n&&1==s?1:n<512&&s<512?e.pow(r,n-1)*e.pow(1-r,s-1)/t.betafn(n,s):e.exp((n-1)*e.log(r)+(s-1)*e.log(1-r)-t.betaln(n,s))},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,s){var i;return r<0?0:n<=2?0===r&&n<2?1/0:0===r&&2===n?1:1/t.betafn(n/2,s/2)*e.pow(n/s,n/2)*e.pow(r,n/2-1)*e.pow(1+n/s*r,-(n+s)/2):(i=n*r/(s+r*n),n*(s/(s+r*n))/2*t.binomial.pdf((n-2)/2,(n+s-2)/2,i))},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,s){return r<0?0:0===r&&1===n?1/s:e.exp((n-1)*e.log(r)-r/s-t.gammaln(n)-n*e.log(s))},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,s){return r<=0?0:e.exp(-(n+1)*e.log(r)-s/r-t.gammaln(n)+n*e.log(s))},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,s){return r<0?0:.5+.5*t.erf((e.log(r)-n)/e.sqrt(2*s*s))},inv:function(r,n,s){return e.exp(-1.4142135623730951*s*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,s){var i=1e-14;return e.abs(s)<i?t.studentt.pdf(r,n):e.abs(r)<i?e.exp(t.gammaln((n+1)/2)-s*s/2-.5*e.log(e.PI*n)-t.gammaln(n/2)):n/r*(t.noncentralt.cdf(r*e.sqrt(1+2/n),n+2,s)-t.noncentralt.cdf(r,n,s))},cdf:function(r,n,s){var i=1e-14,a=200;if(e.abs(s)<i)return t.studentt.cdf(r,n);var o=!1;r<0&&(o=!0,s=-s);for(var l=t.normal.cdf(-s,0,1),c=i+1,h=c,u=r*r/(r*r+n),d=0,f=e.exp(-s*s/2),p=e.exp(-s*s/2-.5*e.log(2)-t.gammaln(1.5))*s;d<a||h>i||c>i;)h=c,d>0&&(f*=s*s/(2*d),p*=s*s/(2*(d+.5))),l+=.5*(c=f*t.beta.cdf(u,d+.5,n/2)+p*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,s){return.5*(1+t.erf((r-n)/e.sqrt(2*s*s)))},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 s=n/2;return t.ibeta((r+e.sqrt(r*r+n))/(2*e.sqrt(r*r+n)),s,s)},inv:function(r,n){var s=t.ibetainv(2*e.min(r,1-r),.5*n,.5);return s=e.sqrt(n*(1-s)/s),r>.5?s:-s},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,s){return 0===s||1===s?n*s===r?1:0:t.combination(n,r)*e.pow(s,r)*e.pow(1-s,n-r)},cdf:function(n,s,i){var a,o=1e-10;if(n<0)return 0;if(n>=s)return 1;if(i<0||i>1||s<=0)return NaN;var l=i,c=(n=e.floor(n))+1,h=s-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,s){return r===r>>>0&&(r<0?0:t.combination(r+n-1,n-1)*e.pow(1-s,r)*e.pow(s,n))},cdf:function(e,r,n){var s=0,i=0;if(e<0)return 0;for(;i<=e;i++)s+=t.negbin.pdf(i,r,n);return s}}),t.extend(t.hypgeom,{pdf:function(r,n,s,i){if(r!=r|0)return!1;if(r<0||r<s-(n-i))return 0;if(r>i||r>s)return 0;if(2*s>n)return 2*i>n?t.hypgeom.pdf(n-s-i+r,n,n-s,n-i):t.hypgeom.pdf(i-r,n,n-s,i);if(2*i>n)return t.hypgeom.pdf(s-r,n,s,n-i);if(s<i)return t.hypgeom.pdf(r,n,i,s);for(var a=1,o=0,l=0;l<r;l++){for(;a>1&&o<i;)a*=1-s/(n-o),o++;a*=(i-l)*(s-l)/((l+1)*(n-s-i+l+1))}for(;o<i;o++)a*=1-s/(n-o);return e.min(1,e.max(0,a))},cdf:function(r,n,s,i){if(r<0||r<s-(n-i))return 0;if(r>=i||r>=s)return 1;if(2*s>n)return 2*i>n?t.hypgeom.cdf(n-s-i+r,n,n-s,n-i):1-t.hypgeom.cdf(i-r-1,n,n-s,i);if(2*i>n)return 1-t.hypgeom.cdf(s-r-1,n,s,n-i);if(s<i)return t.hypgeom.cdf(r,n,i,s);for(var a=1,o=1,l=0,c=0;c<r;c++){for(;a>1&&l<i;){var h=1-s/(n-l);o*=h,a*=h,l++}a+=o*=(i-c)*(s-c)/((c+1)*(n-s-i+c+1))}for(;l<i;l++)a*=1-s/(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=[],s=0;if(e<0)return 0;for(;s<=e;s++)n.push(t.poisson.pdf(s,r));return t.sum(n)},mean:function(t){return t},variance:function(t){return t},sampleSmall:function(r){var n=1,s=0,i=e.exp(-r);do{s++,n*=t._random_fn()}while(n>i);return s-1},sampleLarge:function(r){var n,s,i,a,o,l,c,h,u,d,f=r;for(a=e.sqrt(f),o=e.log(f),l=.02483*(c=.931+2.53*a)-.059,h=1.1239+1.1328/(c-3.4),u=.9277-3.6224/(c-2);;){if(s=e.random()-.5,i=e.random(),d=.5-e.abs(s),n=e.floor((2*l/d+c)*s+f+.43),d>=.07&&i<=u)return n;if(!(n<0||d<.013&&i>d)&&e.log(i)+e.log(h)-e.log(l/(d*d)+c)<=n*o-f-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,s){return n<=r||s<r||s>n?NaN:t<=r?0:t>=n?1:t<=s?e.pow(t-r,2)/((n-r)*(s-r)):1-e.pow(n-t,2)/((n-r)*(n-s))},inv:function(t,r,n,s){return n<=r||s<r||s>n?NaN:t<=(s-r)/(n-r)?r+(n-r)*e.sqrt(t*((s-r)/(n-r))):r+(n-r)*(1-e.sqrt((1-t)*(1-(s-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,s){var i=t._random_fn();return i<(s-r)/(n-r)?r+e.sqrt(i*(n-r)*(s-r)):n-e.sqrt((1-i)*(n-r)*(n-s))},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,s){var i=t._random_fn()-.5;return r-s*n(i)*e.log(1-2*e.abs(i))}}),t.extend(t.tukey,{cdf:function(r,n,i){var a=1,o=n,l=16,c=8,h=-30,u=1e-14,d=100,f=800,p=5e3,m=25e3,b=1,g=.5,v=.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(i<2||a<1||o<2)return NaN;if(!Number.isFinite(r))return 1;if(i>m)return s(r,a,o);var k,$=.5*i,_=$*e.log(i)-i*e.log(2)-t.gammaln($),S=$-1,M=.25*i;k=i<=d?b:i<=f?g:i<=p?v:y,_+=e.log(k);for(var A=0,E=1;E<=50;E++){for(var N=0,T=(2*E-1)*k,C=1;C<=l;C++){var R,P;c<C?(R=C-c-1,P=_+S*e.log(T+w[R]*k)-(w[R]*k+T)*M):(R=C-1,P=_+S*e.log(T-w[R]*k)+(w[R]*k-T)*M),P>=h&&(N+=s(c<C?r*e.sqrt(.5*(w[R]*k+T)):r*e.sqrt(.5*(-w[R]*k+T)),a,o)*x[R]*e.exp(P))}if(E*k>=1&&N<=u)break;A+=N}if(N>u)throw new Error("tukey.cdf failed to converge");return A>1&&(A=1),A},inv:function(r,n,s){var a=1e-4,o=50;if(s<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=i(r,n,s),h=t.tukey.cdf(c,n,s)-r;l=h>0?e.max(0,c-1):c+1;for(var u,d=t.tukey.cdf(l,n,s)-r,f=1;f<o;f++)if(u=l-d*(l-c)/(d-h),h=d,c=l,u<0&&(u=0,d=-r),d=t.tukey.cdf(u,n,s)-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 s(e){return n(e)||e instanceof t}t.extend({add:function(e,r){return s(r)?(s(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 s(r)?(s(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 s(r)?(s(r[0])||(r=[r]),t.multiply(e,t.inv(r))):t.map(e,function(t){return t/r})},multiply:function(e,r){var n,i,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=s(r)?r[0].length:c),u=0,s(r)){for(;u<a;u++)for(n=0;n<l;n++){for(o=0,i=0;i<c;i++)o+=e[n][i]*r[i][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){s(e[0])||(e=[e]),s(r[0])||(r=[r]);for(var n,i,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,i=0;i<u;i++)n+=a[c][i]*o[c][i];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,i=0;for(isNaN(r)&&(r=2),s(t[0])&&(t=t[0]);i<t.length;i++)n+=e.pow(e.abs(t[i]),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,s=[];for(n=0;n<t.length;n++)s.push(t[n].slice());for(n=0;n<s.length;n++)r.apply(s[n],e[n]);return s},inv:function(e){for(var r,n=e.length,s=e[0].length,i=t.identity(n,s),a=t.gauss_jordan(e,i),o=[],l=0;l<n;l++)for(o[l]=[],r=s;r<a[0].length;r++)o[l][r-s]=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 s=[],i=1;i<e.length;i++){s[i-1]=[];for(var a=0;a<e.length;a++)a<n?s[i-1][a]=e[i][a]:a>n&&(s[i-1][a-1]=e[i][a])}var o=n%2?-1:1;r+=t(s)*e[0][n]*o}return r},gauss_elimination:function(r,n){var s,i,a,o,l=0,c=0,h=r.length,u=r[0].length,d=1,f=0,p=[];for(s=(r=t.aug(r,n))[0].length,l=0;l<h;l++){for(i=r[l][l],c=l,o=l+1;o<u;o++)i<e.abs(r[o][l])&&(i=r[o][l],c=o);if(c!=l)for(o=0;o<s;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<s;o++)r[c][o]=r[c][o]-d*r[l][o]}for(l=h-1;l>=0;l--){for(f=0,c=l+1;c<=h-1;c++)f+=p[c]*r[l][c];p[l]=(r[l][s-1]-f)/r[l][l]}return p},gauss_jordan:function(r,n){var s,i,a,o=t.aug(r,n),l=o.length,c=o[0].length,h=0;for(i=0;i<l;i++){var u=i;for(a=i+1;a<l;a++)e.abs(o[a][i])>e.abs(o[u][i])&&(u=a);var d=o[i];for(o[i]=o[u],o[u]=d,a=i+1;a<l;a++)for(h=o[a][i]/o[i][i],s=i;s<c;s++)o[a][s]-=o[i][s]*h}for(i=l-1;i>=0;i--){for(h=o[i][i],a=0;a<i;a++)for(s=c-1;s>i-1;s--)o[a][s]-=o[i][s]*o[a][i]/h;for(o[i][i]/=h,s=l;s<c;s++)o[i][s]/=h}return o},triaUpSolve:function(e,r){var n,s=e[0].length,i=t.zeros(1,s)[0],a=!1;return null!=r[0].length&&(r=r.map(function(t){return t[0]}),a=!0),t.arange(s-1,-1,-1).forEach(function(a){n=t.arange(a+1,s).map(function(t){return i[t]*e[a][t]}),i[a]=(r[a]-t.sum(n))/e[a][a]}),a?i.map(function(t){return[t]}):i},triaLowSolve:function(e,r){var n,s=e[0].length,i=t.zeros(1,s)[0],a=!1;return null!=r[0].length&&(r=r.map(function(t){return t[0]}),a=!0),t.arange(s).forEach(function(s){n=t.arange(s).map(function(t){return e[s][t]*i[t]}),i[s]=(r[s]-t.sum(n))/e[s][s]}),a?i.map(function(t){return[t]}):i},lu:function(e){var r,n=e.length,s=t.identity(n),i=t.zeros(e.length,e[0].length);return t.arange(n).forEach(function(t){i[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 s[a][t]*i[t][n]}),s[a][n]=(e[a][n]-t.sum(r))/i[n][n]}),t.arange(a,n).forEach(function(n){r=t.arange(a).map(function(t){return s[a][t]*i[t][n]}),i[a][n]=e[r.length][n]-t.sum(r)})}),[s,i]},cholesky:function(r){var n,s=r.length,i=t.zeros(r.length,r[0].length);return t.arange(s).forEach(function(a){n=t.arange(a).map(function(t){return e.pow(i[a][t],2)}),i[a][a]=e.sqrt(r[a][a]-t.sum(n)),t.arange(a+1,s).forEach(function(e){n=t.arange(a).map(function(t){return i[a][t]*i[e][t]}),i[e][a]=(r[a][e]-t.sum(n))/i[a][a]})}),i},gauss_jacobi:function(r,n,s,i){for(var a,o,l,c,h=0,u=0,d=r.length,f=[],p=[],m=[];h<d;h++)for(f[h]=[],p[h]=[],m[h]=[],u=0;u<d;u++)h>u?(f[h][u]=r[h][u],p[h][u]=m[h][u]=0):h<u?(p[h][u]=r[h][u],f[h][u]=m[h][u]=0):(m[h][u]=r[h][u],f[h][u]=p[h][u]=0);for(l=t.multiply(t.multiply(t.inv(m),t.add(f,p)),-1),o=t.multiply(t.inv(m),n),a=s,c=t.add(t.multiply(l,s),o),h=2;e.abs(t.norm(t.subtract(c,a)))>i;)a=c,c=t.add(t.multiply(l,a),o),h++;return c},gauss_seidel:function(r,n,s,i){for(var a,o,l,c,h,u=0,d=r.length,f=[],p=[],m=[];u<d;u++)for(f[u]=[],p[u]=[],m[u]=[],a=0;a<d;a++)u>a?(f[u][a]=r[u][a],p[u][a]=m[u][a]=0):u<a?(p[u][a]=r[u][a],f[u][a]=m[u][a]=0):(m[u][a]=r[u][a],f[u][a]=p[u][a]=0);for(c=t.multiply(t.multiply(t.inv(t.add(m,f)),p),-1),l=t.multiply(t.inv(t.add(m,f)),n),o=s,h=t.add(t.multiply(c,s),l),u=2;e.abs(t.norm(t.subtract(h,o)))>i;)o=h,h=t.add(t.multiply(c,o),l),u+=1;return h},SOR:function(r,n,s,i,a){for(var o,l,c,h,u,d=0,f=r.length,p=[],m=[],b=[];d<f;d++)for(p[d]=[],m[d]=[],b[d]=[],o=0;o<f;o++)d>o?(p[d][o]=r[d][o],m[d][o]=b[d][o]=0):d<o?(m[d][o]=r[d][o],p[d][o]=b[d][o]=0):(b[d][o]=r[d][o],p[d][o]=m[d][o]=0);for(h=t.multiply(t.inv(t.add(b,t.multiply(p,a))),t.subtract(t.multiply(b,1-a),t.multiply(m,a))),c=t.multiply(t.multiply(t.inv(t.add(b,t.multiply(p,a))),n),a),l=s,u=t.add(t.multiply(h,s),c),d=2;e.abs(t.norm(t.subtract(u,l)))>i;)l=u,u=t.add(t.multiply(h,l),c),d++;return u},householder:function(r){for(var n,s,i,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),s=e.sqrt((n*n-r[c+1][c]*n)/2),(h=t.zeros(o,1))[c+1][0]=(r[c+1][c]-n)/(2*s),i=c+2;i<o;i++)h[i][0]=r[i][c]/(2*s);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 s(s){var i,a,o,l=s.length,c=s[0].length,h=t.zeros(c,c);for(s=t.copy(s),a=0;a<c;a++){for(h[a][a]=e.sqrt(r(n(l).map(function(t){return s[t][a]*s[t][a]}))),i=0;i<l;i++)s[i][a]=s[i][a]/h[a][a];for(o=a+1;o<c;o++)for(h[a][o]=r(n(l).map(function(t){return s[t][a]*s[t][o]})),i=0;i<l;i++)s[i][o]=s[i][o]-s[i][a]*h[a][o]}return[s,h]}return s}(),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(s){var i=t.multiply(e[s][r],-1),a=t.slice(e,{row:s}),o=t.multiply(t.slice(e,{row:r}),i);t.sliceAssign(e,{row:s},t.add(a,o));var l=t.slice(n,{row:s}),c=t.multiply(t.slice(n,{row:r}),i);t.sliceAssign(n,{row:s},t.add(l,c))})}),n}function r(r,n){var s=!1;void 0===n[0].length&&(n=n.map(function(t){return[t]}),s=!0);var i=t.QR(r),a=i[0],o=i[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]]),s?d.map(function(t){return t[0]}):d}return r}(),jacobi:function(r){for(var n,s,i,a,o,l,c,h=1,u=r.length,d=t.identity(u,u),f=[];1===h;){for(o=r[0][1],i=0,a=1,n=0;n<u;n++)for(s=0;s<u;s++)n!=s&&o<e.abs(r[n][s])&&(o=e.abs(r[n][s]),i=n,a=s);for(l=r[i][i]===r[a][a]?r[i][a]>0?e.PI/4:-e.PI/4:e.atan(2*r[i][a]/(r[i][i]-r[a][a]))/2,(c=t.identity(u,u))[i][i]=e.cos(l),c[i][a]=-e.sin(l),c[a][i]=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(s=1;s<u;s++)n!=s&&e.abs(r[n][s])>.001&&(h=1)}for(n=0;n<u;n++)f.push(r[n][n]);return[d,f]},rungekutta:function(t,e,r,n,s,i){var a,o,l;if(2===i)for(;n<=r;)s+=((a=e*t(n,s))+(o=e*t(n+e,s+a)))/2,n+=e;if(4===i)for(;n<=r;)s+=((a=e*t(n,s))+2*(o=e*t(n+e/2,s+a/2))+2*(l=e*t(n+e/2,s+o/2))+e*t(n+e,s+l))/6,n+=e;return s},romberg:function(t,r,n,s){for(var i,a,o,l,c,h=0,u=(n-r)/2,d=[],f=[],p=[];h<s/2;){for(c=t(r),o=r,l=0;o<=n;o+=u,l++)d[l]=o;for(i=d.length,o=1;o<i-1;o++)c+=(o%2!=0?4:2)*t(d[o]);c=u/3*(c+t(n)),p[h]=c,u/=2,h++}for(a=p.length,i=1;1!==a;){for(o=0;o<a-1;o++)f[o]=(e.pow(4,i)*p[o+1]-p[o])/(e.pow(4,i)-1);a=f.length,p=f,f=[],i++}return p},richardson:function(t,r,n,s){function i(t,e){for(var r,n=0,s=t.length;n<s;n++)t[n]===e&&(r=n);return r}for(var a,o,l,c,h,u=e.abs(n-t[i(t,n)+1]),d=0,f=[],p=[];s>=u;)a=i(t,n+s),o=i(t,n),f[d]=(r[a]-2*r[o]+r[2*o-a])/(s*s),s/=2,d++;for(c=f.length,l=1;1!=c;){for(h=0;h<c-1;h++)p[h]=(e.pow(4,l)*f[h+1]-f[h])/(e.pow(4,l)-1);c=p.length,f=p,p=[],l++}return f},simpson:function(t,e,r,n){for(var s,i=(r-e)/n,a=t(e),o=[],l=e,c=0,h=1;l<=r;l+=i,c++)o[c]=l;for(s=o.length;h<s-1;h++)a+=(h%2!=0?4:2)*t(o[h]);return i/3*(a+t(r))},hermite:function(t,e,r,n){for(var s,i=t.length,a=0,o=0,l=[],c=[],h=[],u=[];o<i;o++){for(l[o]=1,s=0;s<i;s++)o!=s&&(l[o]*=(n-t[s])/(t[o]-t[s]));for(c[o]=0,s=0;s<i;s++)o!=s&&(c[o]+=1/(t[o]-t[s]));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,s,i=0,a=0,o=t.length;a<o;a++){for(s=e[a],n=0;n<o;n++)a!=n&&(s*=(r-t[n])/(t[a]-t[n]));i+=s}return i},cubic_spline:function(e,r,n){for(var s,i=e.length,a=0,o=[],l=[],c=[],h=[],u=[],d=[],f=[];a<i-1;a++)u[a]=e[a+1]-e[a];for(c[0]=0,a=1;a<i-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<i-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),s=0;s<i-1;s++)d[s]=(r[s+1]-r[s])/u[s]-u[s]*(h[s+1][0]+2*h[s][0])/3,f[s]=(h[s+1][0]-h[s][0])/(3*u[s]);for(s=0;s<i&&!(e[s]>n);s++);return r[s-=1]+(n-e[s])*d[s]+t.sq(n-e[s])*h[s]+(n-e[s])*t.sq(n-e[s])*f[s]},gauss_quadrature:function(){throw new Error("gauss_quadrature not yet implemented")},PCA:function(e){var r,n,s=e.length,i=e[0].length,a=0,o=[],l=[],c=[],h=[],u=[],d=[],f=[],p=[],m=[],b=[];for(a=0;a<s;a++)o[a]=t.sum(e[a])/i;for(a=0;a<i;a++)for(f[a]=[],r=0;r<s;r++)f[a][r]=e[r][a]-o[r];for(f=t.transpose(f),a=0;a<s;a++)for(p[a]=[],r=0;r<s;r++)p[a][r]=t.dot([f[a]],[f[r]])/(i-1);for(m=(c=t.jacobi(p))[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(f),a=0;a<s;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 s=this;return n?(setTimeout(function(){n.call(s,t.fn[e].call(s,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,s=t.utils.isArray;function i(t,r,n,s){if(t>1||n>1||t<=0||n<=0)throw new Error("Proportions should be greater than 0 and less than 1");var i=(t*r+n*s)/(r+s);return(t-n)/e.sqrt(i*(1-i)*(1/r+1/s))}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,i=r.call(arguments);return s(i[1])?(n=t.zscore(i[0],i[1],i[3]),1===i[2]?t.normal.cdf(-e.abs(n),0,1):2*t.normal.cdf(-e.abs(n),0,1)):i.length>2?(n=t.zscore(i[0],i[1],i[2]),1===i[3]?t.normal.cdf(-e.abs(n),0,1):2*t.normal.cdf(-e.abs(n),0,1)):(n=i[0],1===i[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,s){var i=e.abs(this.zscore(r,s));return 1===n?t.normal.cdf(-i,0,1):2*t.normal.cdf(-i,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 s,i=r.call(arguments);return 5===i.length?(s=e.abs(t.tscore(i[0],i[1],i[2],i[3])),1===i[4]?t.studentt.cdf(-s,i[3]-1):2*t.studentt.cdf(-s,i[3]-1)):n(i[1])?(s=e.abs(i[0]),1==i[2]?t.studentt.cdf(-s,i[1]-1):2*t.studentt.cdf(-s,i[1]-1)):(s=e.abs(t.tscore(i[0],i[1])),1==i[2]?t.studentt.cdf(-s,i[1].length-1):2*t.studentt.cdf(-s,i[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,s,i,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(s=new Array,c=0;c<u.length;c++)s=s.concat(u[c]);for(i=t.mean(s),n=0,c=0;c<u.length;c++)n+=u[c].length*e.pow(t.mean(u[c])-i,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/=s.length-u.length)},anovaftest:function(){var e,s,i,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,i=0,a=0;a<o.length;a++)i+=o[a].length;return s=i-e-1,1-t.centralF.cdf(l,e,s)},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 s,i,a,o,l,c=r.call(arguments);return n(c[0])?(s=c[0],i=c[1],a=c[2],o=c[3],l=c[4]):(s=t.mean(c[0]),i=t.mean(c[1]),a=c[0].length,o=c[1].length,l=c[2]),e.abs(s-i)/(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 s=n[0],i=n[1];return 1-t.tukey.cdf(e,i,s-i)},tukeyhsd:function(e){for(var r=t.pooledstdev(e),n=e.map(function(e){return t.mean(e)}),s=e.reduce(function(t,e){return t+e.length},0),i=[],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,s,e.length);i.push([[a,o],l])}return i}}),t.extend({normalci:function(){var n,s=r.call(arguments),i=new Array(2);return n=4===s.length?e.abs(t.normal.inv(s[1]/2,0,1)*s[2]/e.sqrt(s[3])):e.abs(t.normal.inv(s[1]/2,0,1)*t.stdev(s[2])/e.sqrt(s[2].length)),i[0]=s[0]-n,i[1]=s[0]+n,i},tci:function(){var n,s=r.call(arguments),i=new Array(2);return n=4===s.length?e.abs(t.studentt.inv(s[1]/2,s[3]-1)*s[2]/e.sqrt(s[3])):e.abs(t.studentt.inv(s[1]/2,s[2].length-1)*t.stdev(s[2],!0)/e.sqrt(s[2].length)),i[0]=s[0]-n,i[1]=s[0]+n,i},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,s){var a=i(e,r,n,s);return t.ztest(a,1)},twoSidedDifferenceOfProportions:function(e,r,n,s){var a=i(e,r,n,s);return t.ztest(a,2)}})}(t,Math),t.models=function(){function e(e){var n=e[0].length,s=t.arange(n).map(function(s){var i=t.arange(n).filter(function(t){return t!==s});return r(t.col(e,s).map(function(t){return t[0]}),t.col(e,i))});return s}function r(e,r){var n=e.length,s=r[0].length-1,i=n-s-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:s,df_resid:i,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),s=Math.sqrt(r.SSR/r.df_resid),i=n.map(function(t){var e=t.SST,r=t.R2;return s/Math.sqrt(e*(1-r))}),a=r.coef.map(function(t,e){return(t-0)/i[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*i[e];return[t-r,t+r]});return{se:i,t:a,p:o,sigmaHat:s,interval95:c}}function s(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 i(t,e){var i=r(t,e),a=n(i),o=s(i),l=1-(1-i.R2)*((i.nobs-1)/i.df_resid);return i.t=a,i.f=o,i.adjust_R2=l,i}return{ols:i}}(),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,s,i,a,o;if(e.cols()==r.rows()){if(r.rows()>1){for(a=[],n=0;n<e.rows();n++)for(a[n]=[],s=0;s<r.cols();s++){for(o=0,i=0;i<e.cols();i++)o+=e.toArray()[n][i]*r.toArray()[i][s];a[n][s]=o}return t(a)}for(a=[],n=0;n<e.rows();n++)for(a[n]=[],s=0;s<r.cols();s++){for(o=0,i=0;i<e.cols();i++)o+=e.toArray()[n][i]*r.toArray()[s];a[n][s]=o}return t(a)}},regress:function(e,r){var n=t.xtranspxinv(e),s=e.transpose(),i=t.matrixmult(t(n),s);return t.matrixmult(i,r)},regresst:function(e,r,n){var s=t.regress(e,r),i={anova:{}},a=t.jMatYBar(e,s);i.yBar=a;var o=r.mean();i.anova.residuals=t.residuals(r,a),i.anova.ssr=t.ssr(a,o),i.anova.msr=i.anova.ssr/(e[0].length-1),i.anova.sse=t.sse(r,a),i.anova.mse=i.anova.sse/(r.length-(e[0].length-1)-1),i.anova.sst=t.sst(r,o),i.anova.mst=i.anova.sst/(r.length-1),i.anova.r2=1-i.anova.sse/i.anova.sst,i.anova.r2<0&&(i.anova.r2=0),i.anova.fratio=i.anova.msr/i.anova.mse,i.anova.pvalue=t.anovaftest(i.anova.fratio,e[0].length-1,r.length-(e[0].length-1)-1),i.anova.rmse=Math.sqrt(i.anova.mse),i.anova.r2adj=1-i.anova.mse/i.anova.mst,i.anova.r2adj<0&&(i.anova.r2adj=0),i.stats=new Array(e[0].length);for(var l,c,h,u=t.xtranspxinv(e),d=0;d<s.length;d++)l=Math.sqrt(i.anova.mse*Math.abs(u[d][d])),c=Math.abs(s[d]/l),h=t.ttest(c,r.length-e[0].length-1,n),i.stats[d]=[s[d],l,c,h];return i.regress=s,i},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),s=0;s<e.length;s++){n[s]=new Array(e[s].length);for(var i=0;i<e[s].length;i++)n[s][i]=e[s][i]-r[s][i]}return t(n)}}),t.jStat=t,t}()}(Qa);var Ja=Ga(Qa.exports);class to{static d={DEFAULT:1,MIN:-6,MAX:6,STEP:.01,JUMP:.1};static c={DEFAULT:0,MIN:-3,MAX:3,STEP:.01,JUMP:.1};static s={DEFAULT:1,MIN:.8,MAX:40,STEP:.01,JUMP:.05};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?Ja.normal.inv(t,0,1)-Ja.normal.inv(e,0,1):Math.sqrt(2/(r*r+1))*(r*Ja.normal.inv(t,0,1)-Ja.normal.inv(e,0,1))}static hrFar2C(t,e,r=1){return 1===r?-(Ja.normal.inv(t,0,1)+Ja.normal.inv(e,0,1))/2:Math.sqrt(2/(r*r+1))*(r/(r+1))*-(Ja.normal.inv(t,0,1)+Ja.normal.inv(e,0,1))}static dC2Hr(t,e,r=1){return 1===r?Ja.normal.cdf(t/2-e,0,1):Ja.normal.cdf(Math.sqrt((r*r+1)/2)*(t/(1+r)-e/r),0,1)}static dC2Far(t,e,r=1){return 1===r?Ja.normal.cdf(-(t/2+e),0,1):Ja.normal.cdf(Math.sqrt((r*r+1)/2)*-(t/(1+r)+e),0,1)}static dFar2Hr(t,e,r=1){return 1===r?Ja.normal.cdf(t+Ja.normal.inv(e,0,1),0,1):Ja.normal.cdf((Math.sqrt((r*r+1)/2)*t+Ja.normal.inv(e,0,1))/r,0,1)}static cFar2Hr(t,e,r=1){return 1===r?Ja.normal.cdf(-2*t-Ja.normal.inv(e,0,1),0,1):Ja.normal.cdf(-Math.sqrt((r*r+1)/2)*((r+1)/r)*t-Ja.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 Ja.normal.inv(t,0,1)}static far2Zfar(t){return Ja.normal.inv(t,0,1)}static zhr2Hr(t){return Ja.normal.cdf(t,0,1)}static zfar2Far(t){return Ja.normal.cdf(t,0,1)}}class eo extends Za{static get properties(){return{numeric:{attribute:"numeric",type:Boolean,reflect:!0},summary:{attribute:"summary",converter:Ba,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.payoff=!1,this.hPayoff=void 0,this.mPayoff=void 0,this.crPayoff=void 0,this.faPayoff=void 0,this.h=40,this.m=60,this.fa=75,this.cr=25,this.alignState()}alignState(){this.hr=to.hM2Hr(this.h,this.m),this.far=to.faCr2Far(this.fa,this.cr),this.acc=to.hMFaCr2Acc(this.h,this.m,this.fa,this.cr),this.ppv=to.hFa2Ppv(this.h,this.fa),this.fomr=to.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,s=(this.hr+this.far-1)/2;let i=s+e,a=1+s-e;a>1&&(a=1,i=a+2*e-1),a<0&&(a=0,i=a+2*e-1),i>1&&(i=1,a=i-2*e+1),i<0&&(i=0,a=i-2*e+1),this.h=Math.round(i*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,o`
|
|
1041
|
+
</div>`}}function Ga(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}customElements.define("detectable-response",Ya);var Qa={exports:{}};!function(t){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 f(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,f)},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 p=h.prototype;return p.length=0,p.push=Array.prototype.push,p.sort=Array.prototype.sort,p.splice=Array.prototype.splice,p.slice=Array.prototype.slice,p.toArray=function(){return this.length>1?n.call(this):n.call(this)[0]},p.map=function(t,e){return h(h.map(this,t,e))},p.cumreduce=function(t,e){return h(h.cumreduce(this,t,e))},p.alter=function(t){return h.alter(this,t),this},function(t){for(var e=0;e<t.length;e++)(function(t){p[t]=function(e){var r,n=this;return e?(setTimeout(function(){e.call(n,p[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){p[t]=function(e,r){var n=this;return r?(setTimeout(function(){r.call(n,p[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){p[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),f=[r.length],p=t.length;for(void 0===s&&(s=3/8),void 0===a&&(a=3/8),o=0;o<r.length;o++)c=p*(l=r[o])+(s+l*(1-s-a)),h=e.floor(i(c,1,p-1)),u=i(c-h,0,1),f[o]=(1-u)*d[h-1]+u*d[h];return f},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,f=1,p=-~(8.5*e.log(r>=1?r:1/r)+.4*r+17);if(n<0||r<=0)return NaN;if(n<r+1){for(;f<=p;f++)o+=l*=n/++a;return o*e.exp(-n+r*e.log(n)-s)}for(;f<=p;f++)d*=(u=1/(u=(i=-f*(f-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,f=1,p=1-h*t/u;for(e.abs(p)<l&&(p=l),o=p=1/p;c<=100&&(p=1+(s=c*(n-c)*t/((d+(i=2*c))*(r+i)))*p,e.abs(p)<l&&(p=l),f=1+s/f,e.abs(f)<l&&(f=l),o*=(p=1/p)*f,p=1+(s=-(r+c)*(h+c)*t/((r+i)*(u+i)))*p,e.abs(p)<l&&(p=l),f=1+s/f,e.abs(f)<l&&(f=l),o*=a=(p=1/p)*f,!(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,f=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)-f),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)-f)))/(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,f,p,m=1e-8,b=n-1,g=i-1,v=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)),f=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*f))):(s=e.log(n/(n+i)),a=e.log(i/(n+i)),h=r<(l=e.exp(n*s)/n)/(f=l+(c=e.exp(i*a)/i))?e.pow(n*f*r,1/n):1-e.pow(i*f*(1-r),1/i)),p=-t.gammaln(n)-t.gammaln(i)+t.gammaln(n+i);v<10;v++){if(0===h||1===h)return h;if((h-=l=(c=(t.ibeta(h,n,i)-r)/(l=e.exp(b*e.log(h)+g*e.log(1-h)+p)))/(1-.5*e.min(1,c*(b/h-g/(1-h)))))<=0&&(h=.5*(h+l)),h>=1&&(h=.5*(h+l+1)),e.abs(l)<m*h&&v>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,f=3,p=[.9815606342467192,.9041172563704749,.7699026741943047,.5873179542866175,.3678314989981802,.1252334085114689],m=[.04717533638651183,.10693932599531843,.16007832854334622,.20316742672306592,.2334925365383548,.24914704581340277],b=.5*r;if(b>=h)return 1;var g,v=2*t.normal.cdf(b,0,1,1,0)-1;v=v>=e.exp(l/i)?e.pow(v,i):0;for(var y=b,w=(h-b)/(g=r>u?d:f),x=y+w,$=0,k=i-1,_=1;_<=g;_++){for(var S=0,M=.5*(x+y),A=.5*(x-y),E=1;E<=s;E++){var N,T=M+A*(a<E?p[(N=s-E+1)-1]:-p[(N=E)-1]),C=T*T;if(C>c)break;var P=2*t.normal.cdf(T,0,1,1,0)*.5-2*t.normal.cdf(T,r,1,1,0)*.5;P>=e.exp(o/k)&&(S+=P=m[N-1]*e.exp(-.5*C)*e.pow(P,k))}$+=S*=2*A*i/e.sqrt(2*e.PI),y=x,x+=w}return(v+=$)<=e.exp(o/n)?0:(v=e.pow(v,n))>=1?1:v}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,f=.0038560700634,p=.8832,m=.2368,b=1.208,g=1.4142,v=120,y=.5-.5*t,w=e.sqrt(e.log(1/(y*y))),x=w+((((w*d+h)*w+l)*w+a)*w+i)/((((w*f+u)*w+c)*w+o)*w+s);n<v&&(x+=(x*x*x+x)/n/4);var $=p-m*x;return n<v&&($+=-1.214/n+b*x/n),x*($*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,f=e.exp(-i*i/2),p=e.exp(-i*i/2-.5*e.log(2)-t.gammaln(1.5))*i;d<a||h>s||c>s;)h=c,d>0&&(f*=i*i/(2*d),p*=i*i/(2*(d+.5))),l+=.5*(c=f*t.beta.cdf(u,d+.5,n/2)+p*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,f=r;for(a=e.sqrt(f),o=e.log(f),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+f+.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-f-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,f=800,p=5e3,m=25e3,b=1,g=.5,v=.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 $,k=.5*s,_=k*e.log(s)-s*e.log(2)-t.gammaln(k),S=k-1,M=.25*s;$=s<=d?b:s<=f?g:s<=p?v:y,_+=e.log($);for(var A=0,E=1;E<=50;E++){for(var N=0,T=(2*E-1)*$,C=1;C<=l;C++){var P,R;c<C?(P=C-c-1,R=_+S*e.log(T+w[P]*$)-(w[P]*$+T)*M):(P=C-1,R=_+S*e.log(T-w[P]*$)+(w[P]*$-T)*M),R>=h&&(N+=i(c<C?r*e.sqrt(.5*(w[P]*$+T)):r*e.sqrt(.5*(-w[P]*$+T)),a,o)*x[P]*e.exp(R))}if(E*$>=1&&N<=u)break;A+=N}if(N>u)throw new Error("tukey.cdf failed to converge");return A>1&&(A=1),A},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,f=1;f<o;f++)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,f=0,p=[];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(f=0,c=l+1;c<=h-1;c++)f+=p[c]*r[l][c];p[l]=(r[l][i-1]-f)/r[l][l]}return p},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,f=[],p=[],m=[];h<d;h++)for(f[h]=[],p[h]=[],m[h]=[],u=0;u<d;u++)h>u?(f[h][u]=r[h][u],p[h][u]=m[h][u]=0):h<u?(p[h][u]=r[h][u],f[h][u]=m[h][u]=0):(m[h][u]=r[h][u],f[h][u]=p[h][u]=0);for(l=t.multiply(t.multiply(t.inv(m),t.add(f,p)),-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,f=[],p=[],m=[];u<d;u++)for(f[u]=[],p[u]=[],m[u]=[],a=0;a<d;a++)u>a?(f[u][a]=r[u][a],p[u][a]=m[u][a]=0):u<a?(p[u][a]=r[u][a],f[u][a]=m[u][a]=0):(m[u][a]=r[u][a],f[u][a]=p[u][a]=0);for(c=t.multiply(t.multiply(t.inv(t.add(m,f)),p),-1),l=t.multiply(t.inv(t.add(m,f)),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,f=r.length,p=[],m=[],b=[];d<f;d++)for(p[d]=[],m[d]=[],b[d]=[],o=0;o<f;o++)d>o?(p[d][o]=r[d][o],m[d][o]=b[d][o]=0):d<o?(m[d][o]=r[d][o],p[d][o]=b[d][o]=0):(b[d][o]=r[d][o],p[d][o]=m[d][o]=0);for(h=t.multiply(t.inv(t.add(b,t.multiply(p,a))),t.subtract(t.multiply(b,1-a),t.multiply(m,a))),c=t.multiply(t.multiply(t.inv(t.add(b,t.multiply(p,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),f=[];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++)f.push(r[n][n]);return[d,f]},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=[],f=[],p=[];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)),p[h]=c,u/=2,h++}for(a=p.length,s=1;1!==a;){for(o=0;o<a-1;o++)f[o]=(e.pow(4,s)*p[o+1]-p[o])/(e.pow(4,s)-1);a=f.length,p=f,f=[],s++}return p},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,f=[],p=[];i>=u;)a=s(t,n+i),o=s(t,n),f[d]=(r[a]-2*r[o]+r[2*o-a])/(i*i),i/=2,d++;for(c=f.length,l=1;1!=c;){for(h=0;h<c-1;h++)p[h]=(e.pow(4,l)*f[h+1]-f[h])/(e.pow(4,l)-1);c=p.length,f=p,p=[],l++}return f},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=[],f=[];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,f[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])*f[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=[],f=[],p=[],m=[],b=[];for(a=0;a<i;a++)o[a]=t.sum(e[a])/s;for(a=0;a<s;a++)for(f[a]=[],r=0;r<i;r++)f[a][r]=e[r][a]-o[r];for(f=t.transpose(f),a=0;a<i;a++)for(p[a]=[],r=0;r<i;r++)p[a][r]=t.dot([f[a]],[f[r]])/(s-1);for(m=(c=t.jacobi(p))[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(f),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}()}(Qa);var Ja=Ga(Qa.exports);class to{static d={DEFAULT:1,MIN:-6,MAX:6,STEP:.01,JUMP:.1};static c={DEFAULT:0,MIN:-3,MAX:3,STEP:.01,JUMP:.1};static s={DEFAULT:1,MIN:.8,MAX:40,STEP:.01,JUMP:.05};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?Ja.normal.inv(t,0,1)-Ja.normal.inv(e,0,1):Math.sqrt(2/(r*r+1))*(r*Ja.normal.inv(t,0,1)-Ja.normal.inv(e,0,1))}static hrFar2C(t,e,r=1){return 1===r?-(Ja.normal.inv(t,0,1)+Ja.normal.inv(e,0,1))/2:Math.sqrt(2/(r*r+1))*(r/(r+1))*-(Ja.normal.inv(t,0,1)+Ja.normal.inv(e,0,1))}static dC2Hr(t,e,r=1){return 1===r?Ja.normal.cdf(t/2-e,0,1):Ja.normal.cdf(Math.sqrt((r*r+1)/2)*(t/(1+r)-e/r),0,1)}static dC2Far(t,e,r=1){return 1===r?Ja.normal.cdf(-(t/2+e),0,1):Ja.normal.cdf(Math.sqrt((r*r+1)/2)*-(t/(1+r)+e),0,1)}static dFar2Hr(t,e,r=1){return 1===r?Ja.normal.cdf(t+Ja.normal.inv(e,0,1),0,1):Ja.normal.cdf((Math.sqrt((r*r+1)/2)*t+Ja.normal.inv(e,0,1))/r,0,1)}static cFar2Hr(t,e,r=1){return 1===r?Ja.normal.cdf(-2*t-Ja.normal.inv(e,0,1),0,1):Ja.normal.cdf(-Math.sqrt((r*r+1)/2)*((r+1)/r)*t-Ja.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 Ja.normal.inv(t,0,1)}static far2Zfar(t){return Ja.normal.inv(t,0,1)}static zhr2Hr(t){return Ja.normal.cdf(t,0,1)}static zfar2Far(t){return Ja.normal.cdf(t,0,1)}}class eo extends Za{static get properties(){return{numeric:{attribute:"numeric",type:Boolean,reflect:!0},summary:{attribute:"summary",converter:Ba,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.payoff=!1,this.hPayoff=void 0,this.mPayoff=void 0,this.crPayoff=void 0,this.faPayoff=void 0,this.h=40,this.m=60,this.fa=75,this.cr=25,this.alignState()}alignState(){this.hr=to.hM2Hr(this.h,this.m),this.far=to.faCr2Far(this.fa,this.cr),this.acc=to.hMFaCr2Acc(this.h,this.m,this.fa,this.cr),this.ppv=to.hFa2Ppv(this.h,this.fa),this.fomr=to.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,o`
|
|
1075
1042
|
:host {
|
|
1076
1043
|
display: inline-block;
|
|
1077
1044
|
}
|
|
@@ -1120,6 +1087,7 @@ const La=t=>t??K;customElements.define("decidables-slider",class extends Ha{stat
|
|
|
1120
1087
|
/* Labels */
|
|
1121
1088
|
.payoff {
|
|
1122
1089
|
font-weight: 600;
|
|
1090
|
+
|
|
1123
1091
|
line-height: 0.75rem;
|
|
1124
1092
|
}
|
|
1125
1093
|
|
|
@@ -1254,7 +1222,7 @@ const La=t=>t??K;customElements.define("decidables-slider",class extends Ha{stat
|
|
|
1254
1222
|
:host([color="none"]) .acc {
|
|
1255
1223
|
background: var(---color-element-background);
|
|
1256
1224
|
}
|
|
1257
|
-
`]}willUpdate(){this.alignState()}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,s,
|
|
1225
|
+
`]}willUpdate(){this.alignState()}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.numeric?(r=V`
|
|
1258
1226
|
<decidables-spinner ?disabled=${!this.interactive} min="0" .value="${this.h}" @input=${this.hInput.bind(this)}>
|
|
1259
1227
|
<span>Hits</span>
|
|
1260
1228
|
${this.payoff?V`<span class="payoff">${e(this.hPayoff)}</span>`:V``}
|
|
@@ -1264,12 +1232,12 @@ const La=t=>t??K;customElements.define("decidables-slider",class extends Ha{stat
|
|
|
1264
1232
|
<span>Misses</span>
|
|
1265
1233
|
${this.payoff?V`<span class="payoff">${e(this.mPayoff)}</span>`:V``}
|
|
1266
1234
|
</decidables-spinner>
|
|
1267
|
-
`,
|
|
1235
|
+
`,i=V`
|
|
1268
1236
|
<decidables-spinner ?disabled=${!this.interactive} min="0" .value="${this.fa}" @input=${this.faInput.bind(this)}>
|
|
1269
1237
|
<span>False Alarms</span>
|
|
1270
1238
|
${this.payoff?V`<span class="payoff">${e(this.faPayoff)}</span>`:V``}
|
|
1271
1239
|
</decidables-spinner>
|
|
1272
|
-
`,
|
|
1240
|
+
`,s=V`
|
|
1273
1241
|
<decidables-spinner ?disabled=${!this.interactive} min="0" .value="${this.cr}" @input=${this.crInput.bind(this)}>
|
|
1274
1242
|
<span>Correct Rejections</span>
|
|
1275
1243
|
${this.payoff?V`<span class="payoff">${e(this.crPayoff)}</span>`:V``}
|
|
@@ -1296,8 +1264,8 @@ const La=t=>t??K;customElements.define("decidables-slider",class extends Ha{stat
|
|
|
1296
1264
|
</decidables-spinner>
|
|
1297
1265
|
`):(r=V`<span>Hits</span>
|
|
1298
1266
|
${this.payoff?V`<span class="payoff">${e(this.hPayoff)}</span>`:V``}`,n=V`<span>Misses</span>
|
|
1299
|
-
${this.payoff?V`<span class="payoff">${e(this.mPayoff)}</span>`:V``}`,
|
|
1300
|
-
${this.payoff?V`<span class="payoff">${e(this.faPayoff)}</span>`:V``}`,
|
|
1267
|
+
${this.payoff?V`<span class="payoff">${e(this.mPayoff)}</span>`:V``}`,i=V`<span>False Alarms</span>
|
|
1268
|
+
${this.payoff?V`<span class="payoff">${e(this.faPayoff)}</span>`:V``}`,s=V`<span>Correct Rejections</span>
|
|
1301
1269
|
${this.payoff?V`<span class="payoff">${e(this.crPayoff)}</span>`:V``}`,a=V`<span>Hit Rate</span>`,o=V`<span>False Alarm Rate</span>`,l=V`<span>Accuracy</span>`,c=V`<span>Positive Predictive Value</span>`,h=V`<span>False Omission Rate</span>`),V`
|
|
1302
1270
|
<table class=${this.numeric?"numeric":""}>
|
|
1303
1271
|
<thead>
|
|
@@ -1340,10 +1308,10 @@ const La=t=>t??K;customElements.define("decidables-slider",class extends Ha{stat
|
|
|
1340
1308
|
Absent
|
|
1341
1309
|
</th>
|
|
1342
1310
|
<td class="td td-data fa">
|
|
1343
|
-
${
|
|
1311
|
+
${i}
|
|
1344
1312
|
</td>
|
|
1345
1313
|
<td class="td td-data cr">
|
|
1346
|
-
${
|
|
1314
|
+
${s}
|
|
1347
1315
|
</td>
|
|
1348
1316
|
${this.summary.has("stimulusRates")?V`
|
|
1349
1317
|
<td class="td td-summary far">
|
|
@@ -1412,7 +1380,7 @@ const La=t=>t??K;customElements.define("decidables-slider",class extends Ha{stat
|
|
|
1412
1380
|
font-size: 1.75rem;
|
|
1413
1381
|
font-weight: 600;
|
|
1414
1382
|
}
|
|
1415
|
-
`]}render(){return V``}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),s=.25*this.rem,i=.25*this.rem,a=.25*this.rem,o=n-(s+i),l=n-(a+.25*this.rem);this.xScale=qa().domain([-1,1]).range([0,l]),this.yScale=qa().domain([1,-1]).range([0,o]);const c=sr(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),f=u.select(".plot").attr("transform",`translate(${a}, ${s})`),p=d.append("g").classed("underlayer",!0),m=f.select(".underlayer");p.append("circle").classed("background",!0),m.select(".background").attr("cx",this.xScale(0)).attr("cy",this.yScale(0)).attr("r",this.xScale(1)-this.xScale(0)),d.append("g").classed("content",!0).attr("clip-path","url(#clip-rdk-task)");f.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),g=f.select(".overlayer");b.append("circle").classed("outline",!0),g.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+=Nn()-this.pauseTime,this.pauseTime=0),this.runner=function(t,e,r){var n=new Cn,s=e;return n._restart=n.restart,n.restart=function(t,e,r){e=+e,r=null==r?Nn():+r,n._restart(function i(a){a+=s,n._restart(i,s+=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=Nn())),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=sr(this.renderRoot).select(".content").selectAll(".dots").data([[],[]]).selectAll(".dot").data(t=>t);t.exit().remove();sr(this.renderRoot).select(".content").selectAll(".fixation").data([]).exit().remove();sr(this.renderRoot).select(".content").selectAll(".query").data([]).exit().remove()}run(){const t=Nn(),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 s=!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?(s=!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 i=void 0===this.dots[t][r];i&&(this.dots[t][r]={});const a=this.dots[t][r];if(s||i){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 i=sr(this.renderRoot).select(".content").selectAll(".fixation").data("iti"===this.state?[!0]:[]),a=i.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)),i.exit().remove();const o=sr(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=sr(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()}}function no(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function so(t){return so="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},so(t)}function io(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ao(){return ao=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},ao.apply(this,arguments)}function oo(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function lo(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return oo(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?oo(t,e):void 0}}(t))||e){r&&(t=r);var n=0,s=function(){};return{s:s,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,o=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){o=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(o)throw i}}}}function co(t,e){var r=[],n=[];return t.length&&function t(e,s){if(1===e.length)r.push(e[0]),n.push(e[0]);else{for(var i=Array(e.length-1),a=0;a<i.length;a++)0===a&&r.push(e[0]),a===i.length-1&&n.push(e[a+1]),i[a]=[(1-s)*e[a][0]+s*e[a+1][0],(1-s)*e[a][1]+s*e[a+1][1]];t(i,s)}}(t,e),{left:r,right:n.reverse()}}function ho(t){var e={};return 4===t.length&&(e.x2=t[2][0],e.y2=t[2][1]),t.length>=3&&(e.x1=t[1][0],e.y1=t[1][1]),e.x=t[t.length-1][0],e.y=t[t.length-1][1],4===t.length?e.type="C":3===t.length?e.type="Q":e.type="L",e}function uo(t,e,r){var n=[[t.x,t.y]];return null!=e.x1&&n.push([e.x1,e.y1]),null!=e.x2&&n.push([e.x2,e.y2]),n.push([e.x,e.y]),function(t,e){for(var r=[],n=t,s=1/(e=e||2),i=0;i<e-1;i++){var a=co(n,s/(1-s*i));r.push(a.left),n=a.right}return r.push(n),r}(n,r).map(ho)}customElements.define("rdk-task",ro);var fo=/[MLCSTQAHVZmlcstqahv]|-?[\d.e+-]+/g,po={M:["x","y"],L:["x","y"],H:["x"],V:["y"],C:["x1","y1","x2","y2","x","y"],S:["x2","y2","x","y"],Q:["x1","y1","x","y"],T:["x","y"],A:["rx","ry","xAxisRotation","largeArcFlag","sweepFlag","x","y"],Z:[]};function mo(t,e){for(var r=Array(t),n=0;n<t;n++)r[n]=e;return r}function bo(t){return"".concat(t.type).concat(po[t.type].map(function(e){return t[e]}).join(","))}function go(t,e,r){var n=t.length-1,s=e.length-1,i=n/s,a=mo(s).reduce(function(e,n,s){var a=Math.floor(i*s);if(r&&a<t.length-1&&r(t[a],t[a+1])){var o=i*s%1<.5;e[a]&&(o?a>0?a-=1:a<t.length-1&&(a+=1):a<t.length-1?a+=1:a>0&&(a-=1))}return e[a]=(e[a]||0)+1,e},[]),o=a.reduce(function(e,r,n){if(n===t.length-1){var s=mo(r,ao({},t[t.length-1]));return"M"===s[0].type&&s.forEach(function(t){t.type="L"}),e.concat(s)}return e.concat(function(t,e,r){var n=[];if("L"===e.type||"Q"===e.type||"C"===e.type)n=n.concat(uo(t,e,r));else{var s=ao({},t);"M"===s.type&&(s.type="L"),(n=n.concat(mo(r-1).map(function(){return s}))).push(e)}return n}(t[n],t[n+1],r))},[]);return o.unshift(t[0]),o}function vo(t){for(var e,r,n=(t||"").match(fo)||[],s=[],i=0;i<n.length;++i)if(e=po[n[i]]){r={type:n[i]};for(var a=0;a<e.length;++a)r[e[a]]=+n[i+a+1];i+=e.length,s.push(r)}return s}function yo(t,e,r){var n=null==t?[]:t.slice(),s=null==e?[]:e.slice(),i="object"===so(r)?r:{excludeSegment:r,snapEndsToInput:!0},a=i.excludeSegment,o=i.snapEndsToInput;if(!n.length&&!s.length)return function(){return[]};var l=!(0!==n.length&&"Z"!==n[n.length-1].type||0!==s.length&&"Z"!==s[s.length-1].type);n.length>0&&"Z"===n[n.length-1].type&&n.pop(),s.length>0&&"Z"===s[s.length-1].type&&s.pop(),n.length?s.length||s.push(n[0]):n.push(s[0]),0!==Math.abs(s.length-n.length)&&(s.length>n.length?n=go(n,s,a):s.length<n.length&&(s=go(s,n,a))),n=n.map(function(t,e){return function(t,e){var r={x1:"x",y1:"y",x2:"x",y2:"y"},n=["xAxisRotation","largeArcFlag","sweepFlag"];if(t.type!==e.type&&"M"!==e.type.toUpperCase()){var s={};Object.keys(e).forEach(function(i){var a=e[i],o=t[i];void 0===o&&(n.includes(i)?o=a:(void 0===o&&r[i]&&(o=t[r[i]]),void 0===o&&(o=0))),s[i]=o}),s.type=e.type,t=s}return t}(t,s[e])});var c=n.map(function(t){return function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?no(Object(r),!0).forEach(function(e){io(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):no(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}({},t)});return l&&(c.push({type:"Z"}),n.push({type:"Z"})),function(t){if(1===t&&o)return null==e?[]:e;if(0===t)return n;for(var r=0;r<c.length;++r){var i,a=n[r],l=s[r],h=c[r],u=lo(po[h.type]);try{for(u.s();!(i=u.n()).done;){var d=i.value;h[d]=(1-t)*a[d]+t*l[d],"largeArcFlag"!==d&&"sweepFlag"!==d||(h[d]=Math.round(h[d]))}}catch(t){u.e(t)}finally{u.f()}}return c}}Object.keys(po).forEach(function(t){po[t.toLowerCase()]=po[t]});var wo={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};const xo=Object.create(null);for(const t in wo)Object.hasOwn(wo,t)&&(xo[wo[t]]=t);const ko={to:{},get:{}};function $o(t,e,r){return Math.min(Math.max(e,t),r)}function _o(t){const e=Math.round(t).toString(16).toUpperCase();return e.length<2?"0"+e:e}ko.get=function(t){let e,r;switch(t.slice(0,3).toLowerCase()){case"hsl":e=ko.get.hsl(t),r="hsl";break;case"hwb":e=ko.get.hwb(t),r="hwb";break;default:e=ko.get.rgb(t),r="rgb"}return e?{model:r,value:e}:null},ko.get.rgb=function(t){if(!t)return null;let e,r,n,s=[0,0,0,1];if(e=t.match(/^#([a-f\d]{6})([a-f\d]{2})?$/i)){for(n=e[2],e=e[1],r=0;r<3;r++){const t=2*r;s[r]=Number.parseInt(e.slice(t,t+2),16)}n&&(s[3]=Number.parseInt(n,16)/255)}else if(e=t.match(/^#([a-f\d]{3,4})$/i)){for(e=e[1],n=e[3],r=0;r<3;r++)s[r]=Number.parseInt(e[r]+e[r],16);n&&(s[3]=Number.parseInt(n+n,16)/255)}else if(e=t.match(/^rgba?\(\s*([+-]?(?:\d*\.)?\d+(?:e\d+)?)(?=[\s,])\s*(?:,\s*)?([+-]?(?:\d*\.)?\d+(?:e\d+)?)(?=[\s,])\s*(?:,\s*)?([+-]?(?:\d*\.)?\d+(?:e\d+)?)\s*(?:[\s,|/]\s*([+-]?(?:\d*\.)?\d+(?:e\d+)?)(%?)\s*)?\)$/i)){for(r=0;r<3;r++)s[r]=Number.parseFloat(e[r+1]);e[4]&&(s[3]=e[5]?.01*Number.parseFloat(e[4]):Number.parseFloat(e[4]))}else{if(!(e=t.match(/^rgba?\(\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[\s,|/]\s*([+-]?[\d.]+)(%?)\s*)?\)$/i)))return(e=t.toLowerCase().match(/^(\w+)$/))?"transparent"===e[1]?[0,0,0,0]:Object.hasOwn(wo,e[1])?(s=wo[e[1]].slice(),s[3]=1,s):null:null;for(r=0;r<3;r++)s[r]=Math.round(2.55*Number.parseFloat(e[r+1]));e[4]&&(s[3]=e[5]?.01*Number.parseFloat(e[4]):Number.parseFloat(e[4]))}for(r=0;r<3;r++)s[r]=$o(s[r],0,255);return s[3]=$o(s[3],0,1),s},ko.get.hsl=function(t){if(!t)return null;const e=t.match(/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[,|/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:e[+-]?\d+)?)\s*)?\)$/i);if(e){const t=Number.parseFloat(e[4]);return[(Number.parseFloat(e[1])%360+360)%360,$o(Number.parseFloat(e[2]),0,100),$o(Number.parseFloat(e[3]),0,100),$o(Number.isNaN(t)?1:t,0,1)]}return null},ko.get.hwb=function(t){if(!t)return null;const e=t.match(/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*[\s,]\s*([+-]?[\d.]+)%\s*[\s,]\s*([+-]?[\d.]+)%\s*(?:[\s,]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:e[+-]?\d+)?)\s*)?\)$/i);if(e){const t=Number.parseFloat(e[4]);return[(Number.parseFloat(e[1])%360+360)%360,$o(Number.parseFloat(e[2]),0,100),$o(Number.parseFloat(e[3]),0,100),$o(Number.isNaN(t)?1:t,0,1)]}return null},ko.to.hex=function(...t){return"#"+_o(t[0])+_o(t[1])+_o(t[2])+(t[3]<1?_o(Math.round(255*t[3])):"")},ko.to.rgb=function(...t){return t.length<4||1===t[3]?"rgb("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+")":"rgba("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+", "+t[3]+")"},ko.to.rgb.percent=function(...t){const e=Math.round(t[0]/255*100),r=Math.round(t[1]/255*100),n=Math.round(t[2]/255*100);return t.length<4||1===t[3]?"rgb("+e+"%, "+r+"%, "+n+"%)":"rgba("+e+"%, "+r+"%, "+n+"%, "+t[3]+")"},ko.to.hsl=function(...t){return t.length<4||1===t[3]?"hsl("+t[0]+", "+t[1]+"%, "+t[2]+"%)":"hsla("+t[0]+", "+t[1]+"%, "+t[2]+"%, "+t[3]+")"},ko.to.hwb=function(...t){let e="";return t.length>=4&&1!==t[3]&&(e=", "+t[3]),"hwb("+t[0]+", "+t[1]+"%, "+t[2]+"%"+e+")"},ko.to.keyword=function(...t){return xo[t.slice(0,3)]};const So={};for(const t of Object.keys(wo))So[wo[t]]=t;const Mo={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},oklab:{channels:3,labels:["okl","oka","okb"]},lch:{channels:3,labels:"lch"},oklch:{channels:3,labels:["okl","okc","okh"]},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}},Ao=(6/29)**3;function Eo(t){const e=t>.0031308?1.055*t**(1/2.4)-.055:12.92*t;return Math.min(Math.max(0,e),1)}function No(t){return t>.04045?((t+.055)/1.055)**2.4:t/12.92}for(const t of Object.keys(Mo)){if(!("channels"in Mo[t]))throw new Error("missing channels property: "+t);if(!("labels"in Mo[t]))throw new Error("missing channel labels property: "+t);if(Mo[t].labels.length!==Mo[t].channels)throw new Error("channel and label counts mismatch: "+t);const{channels:e,labels:r}=Mo[t];delete Mo[t].channels,delete Mo[t].labels,Object.defineProperty(Mo[t],"channels",{value:e}),Object.defineProperty(Mo[t],"labels",{value:r})}function To(t,e){return(t[0]-e[0])**2+(t[1]-e[1])**2+(t[2]-e[2])**2}function Co(t){const e=function(){const t={},e=Object.keys(Mo);for(let{length:r}=e,n=0;n<r;n++)t[e[n]]={distance:-1,parent:null};return t}(),r=[t];for(e[t].distance=0;r.length>0;){const t=r.pop(),n=Object.keys(Mo[t]);for(let{length:s}=n,i=0;i<s;i++){const s=n[i],a=e[s];-1===a.distance&&(a.distance=e[t].distance+1,a.parent=t,r.unshift(s))}}return e}function Ro(t,e){return function(r){return e(t(r))}}function Po(t,e){const r=[e[t].parent,t];let n=Mo[e[t].parent][t],s=e[t].parent;for(;e[s].parent;)r.unshift(e[s].parent),n=Ro(Mo[e[s].parent][s],n),s=e[s].parent;return n.conversion=r,n}function qo(t){const e=Co(t),r={},n=Object.keys(e);for(let{length:t}=n,s=0;s<t;s++){const t=n[s];null!==e[t].parent&&(r[t]=Po(t,e))}return r}Mo.rgb.hsl=function(t){const e=t[0]/255,r=t[1]/255,n=t[2]/255,s=Math.min(e,r,n),i=Math.max(e,r,n),a=i-s;let o,l;switch(i){case s:o=0;break;case e:o=(r-n)/a;break;case r:o=2+(n-e)/a;break;case n:o=4+(e-r)/a}o=Math.min(60*o,360),o<0&&(o+=360);const c=(s+i)/2;return l=i===s?0:c<=.5?a/(i+s):a/(2-i-s),[o,100*l,100*c]},Mo.rgb.hsv=function(t){let e,r,n,s,i;const a=t[0]/255,o=t[1]/255,l=t[2]/255,c=Math.max(a,o,l),h=c-Math.min(a,o,l),u=function(t){return(c-t)/6/h+.5};if(0===h)s=0,i=0;else{switch(i=h/c,e=u(a),r=u(o),n=u(l),c){case a:s=n-r;break;case o:s=1/3+e-n;break;case l:s=2/3+r-e}s<0?s+=1:s>1&&(s-=1)}return[360*s,100*i,100*c]},Mo.rgb.hwb=function(t){const e=t[0],r=t[1];let n=t[2];const s=Mo.rgb.hsl(t)[0],i=1/255*Math.min(e,Math.min(r,n));return n=1-1/255*Math.max(e,Math.max(r,n)),[s,100*i,100*n]},Mo.rgb.oklab=function(t){const e=No(t[0]/255),r=No(t[1]/255),n=No(t[2]/255),s=Math.cbrt(.4122214708*e+.5363325363*r+.0514459929*n),i=Math.cbrt(.2119034982*e+.6806995451*r+.1073969566*n),a=Math.cbrt(.0883024619*e+.2817188376*r+.6299787005*n);return[100*(.2104542553*s+.793617785*i-.0040720468*a),100*(1.9779984951*s-2.428592205*i+.4505937099*a),100*(.0259040371*s+.7827717662*i-.808675766*a)]},Mo.rgb.cmyk=function(t){const e=t[0]/255,r=t[1]/255,n=t[2]/255,s=Math.min(1-e,1-r,1-n);return[100*((1-e-s)/(1-s)||0),100*((1-r-s)/(1-s)||0),100*((1-n-s)/(1-s)||0),100*s]},Mo.rgb.keyword=function(t){const e=So[t];if(e)return e;let r,n=Number.POSITIVE_INFINITY;for(const e of Object.keys(wo)){const s=To(t,wo[e]);s<n&&(n=s,r=e)}return r},Mo.keyword.rgb=function(t){return[...wo[t]]},Mo.rgb.xyz=function(t){const e=No(t[0]/255),r=No(t[1]/255),n=No(t[2]/255);return[100*(.4124564*e+.3575761*r+.1804375*n),100*(.2126729*e+.7151522*r+.072175*n),100*(.0193339*e+.119192*r+.9503041*n)]},Mo.rgb.lab=function(t){const e=Mo.rgb.xyz(t);let r=e[0],n=e[1],s=e[2];r/=95.047,n/=100,s/=108.883,r=r>Ao?r**(1/3):7.787*r+16/116,n=n>Ao?n**(1/3):7.787*n+16/116,s=s>Ao?s**(1/3):7.787*s+16/116;return[116*n-16,500*(r-n),200*(n-s)]},Mo.hsl.rgb=function(t){const e=t[0]/360,r=t[1]/100,n=t[2]/100;let s,i;if(0===r)return i=255*n,[i,i,i];const a=n<.5?n*(1+r):n+r-n*r,o=2*n-a,l=[0,0,0];for(let t=0;t<3;t++)s=e+1/3*-(t-1),s<0&&s++,s>1&&s--,i=6*s<1?o+6*(a-o)*s:2*s<1?a:3*s<2?o+(a-o)*(2/3-s)*6:o,l[t]=255*i;return l},Mo.hsl.hsv=function(t){const e=t[0];let r=t[1]/100,n=t[2]/100,s=r;const i=Math.max(n,.01);n*=2,r*=n<=1?n:2-n,s*=i<=1?i:2-i;return[e,100*(0===n?2*s/(i+s):2*r/(n+r)),100*((n+r)/2)]},Mo.hsv.rgb=function(t){const e=t[0]/60,r=t[1]/100;let n=t[2]/100;const s=Math.floor(e)%6,i=e-Math.floor(e),a=255*n*(1-r),o=255*n*(1-r*i),l=255*n*(1-r*(1-i));switch(n*=255,s){case 0:return[n,l,a];case 1:return[o,n,a];case 2:return[a,n,l];case 3:return[a,o,n];case 4:return[l,a,n];case 5:return[n,a,o]}},Mo.hsv.hsl=function(t){const e=t[0],r=t[1]/100,n=t[2]/100,s=Math.max(n,.01);let i,a;a=(2-r)*n;const o=(2-r)*s;return i=r*s,i/=o<=1?o:2-o,i=i||0,a/=2,[e,100*i,100*a]},Mo.hwb.rgb=function(t){const e=t[0]/360;let r=t[1]/100,n=t[2]/100;const s=r+n;let i;s>1&&(r/=s,n/=s);const a=Math.floor(6*e),o=1-n;i=6*e-a,1&a&&(i=1-i);const l=r+i*(o-r);let c,h,u;switch(a){default:case 6:case 0:c=o,h=l,u=r;break;case 1:c=l,h=o,u=r;break;case 2:c=r,h=o,u=l;break;case 3:c=r,h=l,u=o;break;case 4:c=l,h=r,u=o;break;case 5:c=o,h=r,u=l}return[255*c,255*h,255*u]},Mo.cmyk.rgb=function(t){const e=t[0]/100,r=t[1]/100,n=t[2]/100,s=t[3]/100;return[255*(1-Math.min(1,e*(1-s)+s)),255*(1-Math.min(1,r*(1-s)+s)),255*(1-Math.min(1,n*(1-s)+s))]},Mo.xyz.rgb=function(t){const e=t[0]/100,r=t[1]/100,n=t[2]/100;let s,i,a;return s=3.2404542*e+-1.5371385*r+-.4985314*n,i=-.969266*e+1.8760108*r+.041556*n,a=.0556434*e+-.2040259*r+1.0572252*n,s=Eo(s),i=Eo(i),a=Eo(a),[255*s,255*i,255*a]},Mo.xyz.lab=function(t){let e=t[0],r=t[1],n=t[2];e/=95.047,r/=100,n/=108.883,e=e>Ao?e**(1/3):7.787*e+16/116,r=r>Ao?r**(1/3):7.787*r+16/116,n=n>Ao?n**(1/3):7.787*n+16/116;return[116*r-16,500*(e-r),200*(r-n)]},Mo.xyz.oklab=function(t){const e=t[0]/100,r=t[1]/100,n=t[2]/100,s=Math.cbrt(.8189330101*e+.3618667424*r-.1288597137*n),i=Math.cbrt(.0329845436*e+.9293118715*r+.0361456387*n),a=Math.cbrt(.0482003018*e+.2643662691*r+.633851707*n);return[100*(.2104542553*s+.793617785*i-.0040720468*a),100*(1.9779984951*s-2.428592205*i+.4505937099*a),100*(.0259040371*s+.7827717662*i-.808675766*a)]},Mo.oklab.oklch=function(t){return Mo.lab.lch(t)},Mo.oklab.xyz=function(t){const e=t[0]/100,r=t[1]/100,n=t[2]/100,s=(.999999998*e+.396337792*r+.215803758*n)**3,i=(1.000000008*e-.105561342*r-.063854175*n)**3,a=(1.000000055*e-.089484182*r-1.291485538*n)**3;return[100*(1.227013851*s-.55779998*i+.281256149*a),100*(-.040580178*s+1.11225687*i-.071676679*a),100*(-.076381285*s-.421481978*i+1.58616322*a)]},Mo.oklab.rgb=function(t){const e=t[0]/100,r=t[1]/100,n=t[2]/100,s=(e+.3963377774*r+.2158037573*n)**3,i=(e-.1055613458*r-.0638541728*n)**3,a=(e-.0894841775*r-1.291485548*n)**3;return[255*Eo(4.0767416621*s-3.3077115913*i+.2309699292*a),255*Eo(-1.2684380046*s+2.6097574011*i-.3413193965*a),255*Eo(-.0041960863*s-.7034186147*i+1.707614701*a)]},Mo.oklch.oklab=function(t){return Mo.lch.lab(t)},Mo.lab.xyz=function(t){let e,r,n;r=(t[0]+16)/116,e=t[1]/500+r,n=r-t[2]/200;const s=r**3,i=e**3,a=n**3;return r=s>Ao?s:(r-16/116)/7.787,e=i>Ao?i:(e-16/116)/7.787,n=a>Ao?a:(n-16/116)/7.787,e*=95.047,r*=100,n*=108.883,[e,r,n]},Mo.lab.lch=function(t){const e=t[0],r=t[1],n=t[2];let s;s=360*Math.atan2(n,r)/2/Math.PI,s<0&&(s+=360);return[e,Math.sqrt(r*r+n*n),s]},Mo.lch.lab=function(t){const e=t[0],r=t[1],n=t[2]/360*2*Math.PI;return[e,r*Math.cos(n),r*Math.sin(n)]},Mo.rgb.ansi16=function(t,e=null){const[r,n,s]=t;let i=null===e?Mo.rgb.hsv(t)[2]:e;if(i=Math.round(i/50),0===i)return 30;let a=30+(Math.round(s/255)<<2|Math.round(n/255)<<1|Math.round(r/255));return 2===i&&(a+=60),a},Mo.hsv.ansi16=function(t){return Mo.rgb.ansi16(Mo.hsv.rgb(t),t[2])},Mo.rgb.ansi256=function(t){const e=t[0],r=t[1],n=t[2];if(e>>4==r>>4&&r>>4==n>>4)return e<8?16:e>248?231:Math.round((e-8)/247*24)+232;return 16+36*Math.round(e/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5)},Mo.ansi16.rgb=function(t){let e=(t=t[0])%10;if(0===e||7===e)return t>50&&(e+=3.5),e=e/10.5*255,[e,e,e];const r=.5*(Math.trunc(t>50)+1);return[(1&e)*r*255,(e>>1&1)*r*255,(e>>2&1)*r*255]},Mo.ansi256.rgb=function(t){if((t=t[0])>=232){const e=10*(t-232)+8;return[e,e,e]}let e;t-=16;return[Math.floor(t/36)/5*255,Math.floor((e=t%36)/6)/5*255,e%6/5*255]},Mo.rgb.hex=function(t){const e=(((255&Math.round(t[0]))<<16)+((255&Math.round(t[1]))<<8)+(255&Math.round(t[2]))).toString(16).toUpperCase();return"000000".slice(e.length)+e},Mo.hex.rgb=function(t){const e=t.toString(16).match(/[a-f\d]{6}|[a-f\d]{3}/i);if(!e)return[0,0,0];let r=e[0];3===e[0].length&&(r=[...r].map(t=>t+t).join(""));const n=Number.parseInt(r,16);return[n>>16&255,n>>8&255,255&n]},Mo.rgb.hcg=function(t){const e=t[0]/255,r=t[1]/255,n=t[2]/255,s=Math.max(Math.max(e,r),n),i=Math.min(Math.min(e,r),n),a=s-i;let o;return o=a<=0?0:s===e?(r-n)/a%6:s===r?2+(n-e)/a:4+(e-r)/a,o/=6,o%=1,[360*o,100*a,100*(a<1?i/(1-a):0)]},Mo.hsl.hcg=function(t){const e=t[1]/100,r=t[2]/100,n=r<.5?2*e*r:2*e*(1-r);let s=0;return n<1&&(s=(r-.5*n)/(1-n)),[t[0],100*n,100*s]},Mo.hsv.hcg=function(t){const e=t[1]/100,r=t[2]/100,n=e*r;let s=0;return n<1&&(s=(r-n)/(1-n)),[t[0],100*n,100*s]},Mo.hcg.rgb=function(t){const e=t[0]/360,r=t[1]/100,n=t[2]/100;if(0===r)return[255*n,255*n,255*n];const s=[0,0,0],i=e%1*6,a=i%1,o=1-a;let l=0;switch(Math.floor(i)){case 0:s[0]=1,s[1]=a,s[2]=0;break;case 1:s[0]=o,s[1]=1,s[2]=0;break;case 2:s[0]=0,s[1]=1,s[2]=a;break;case 3:s[0]=0,s[1]=o,s[2]=1;break;case 4:s[0]=a,s[1]=0,s[2]=1;break;default:s[0]=1,s[1]=0,s[2]=o}return l=(1-r)*n,[255*(r*s[0]+l),255*(r*s[1]+l),255*(r*s[2]+l)]},Mo.hcg.hsv=function(t){const e=t[1]/100,r=e+t[2]/100*(1-e);let n=0;return r>0&&(n=e/r),[t[0],100*n,100*r]},Mo.hcg.hsl=function(t){const e=t[1]/100,r=t[2]/100*(1-e)+.5*e;let n=0;return r>0&&r<.5?n=e/(2*r):r>=.5&&r<1&&(n=e/(2*(1-r))),[t[0],100*n,100*r]},Mo.hcg.hwb=function(t){const e=t[1]/100,r=e+t[2]/100*(1-e);return[t[0],100*(r-e),100*(1-r)]},Mo.hwb.hcg=function(t){const e=t[1]/100,r=1-t[2]/100,n=r-e;let s=0;return n<1&&(s=(r-n)/(1-n)),[t[0],100*n,100*s]},Mo.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]},Mo.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]},Mo.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]},Mo.gray.hsl=function(t){return[0,0,t[0]]},Mo.gray.hsv=Mo.gray.hsl,Mo.gray.hwb=function(t){return[0,100,t[0]]},Mo.gray.cmyk=function(t){return[0,0,0,t[0]]},Mo.gray.lab=function(t){return[t[0],0,0]},Mo.gray.hex=function(t){const e=255&Math.round(t[0]/100*255),r=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".slice(r.length)+r},Mo.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]};const Fo={},zo=Object.keys(Mo);function Oo(t){const e=function(...e){const r=e[0];return null==r?r:(r.length>1&&(e=r),t(e))};return"conversion"in t&&(e.conversion=t.conversion),e}function Io(t){const e=function(...e){const r=e[0];if(null==r)return r;r.length>1&&(e=r);const n=t(e);if("object"==typeof n)for(let{length:t}=n,e=0;e<t;e++)n[e]=Math.round(n[e]);return n};return"conversion"in t&&(e.conversion=t.conversion),e}for(const t of zo){Fo[t]={},Object.defineProperty(Fo[t],"channels",{value:Mo[t].channels}),Object.defineProperty(Fo[t],"labels",{value:Mo[t].labels});const e=qo(t),r=Object.keys(e);for(const n of r){const r=e[n];Fo[t][n]=Io(r),Fo[t][n].raw=Oo(r)}}const Do=["keyword","gray","hex"],Uo={};for(const t of Object.keys(Fo))Uo[[...Fo[t].labels].sort().join("")]=t;const jo={};function Ho(t,e){if(!(this instanceof Ho))return new Ho(t,e);if(e&&e in Do&&(e=null),e&&!(e in Fo))throw new Error("Unknown model: "+e);let r,n;if(null==t)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(t instanceof Ho)this.model=t.model,this.color=[...t.color],this.valpha=t.valpha;else if("string"==typeof t){const e=ko.get(t);if(null===e)throw new Error("Unable to parse color from string: "+t);this.model=e.model,n=Fo[this.model].channels,this.color=e.value.slice(0,n),this.valpha="number"==typeof e.value[n]?e.value[n]:1}else if(t.length>0){this.model=e||"rgb",n=Fo[this.model].channels;const r=Array.prototype.slice.call(t,0,n);this.color=Xo(r,n),this.valpha="number"==typeof t[n]?t[n]:1}else if("number"==typeof t)this.model="rgb",this.color=[t>>16&255,t>>8&255,255&t],this.valpha=1;else{this.valpha=1;const e=Object.keys(t);"alpha"in t&&(e.splice(e.indexOf("alpha"),1),this.valpha="number"==typeof t.alpha?t.alpha:0);const n=e.sort().join("");if(!(n in Uo))throw new Error("Unable to parse color from object: "+JSON.stringify(t));this.model=Uo[n];const{labels:s}=Fo[this.model],i=[];for(r=0;r<s.length;r++)i.push(t[s[r]]);this.color=Xo(i)}if(jo[this.model])for(n=Fo[this.model].channels,r=0;r<n;r++){const t=jo[this.model][r];t&&(this.color[r]=t(this.color[r]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}Ho.prototype={toString(){return this.string()},toJSON(){return this[this.model]()},string(t){let e=this.model in ko.to?this:this.rgb();e=e.round("number"==typeof t?t:1);const r=1===e.valpha?e.color:[...e.color,this.valpha];return ko.to[e.model](...r)},percentString(t){const e=this.rgb().round("number"==typeof t?t:1),r=1===e.valpha?e.color:[...e.color,this.valpha];return ko.to.rgb.percent(...r)},array(){return 1===this.valpha?[...this.color]:[...this.color,this.valpha]},object(){const t={},{channels:e}=Fo[this.model],{labels:r}=Fo[this.model];for(let n=0;n<e;n++)t[r[n]]=this.color[n];return 1!==this.valpha&&(t.alpha=this.valpha),t},unitArray(){const t=this.rgb().color;return t[0]/=255,t[1]/=255,t[2]/=255,1!==this.valpha&&t.push(this.valpha),t},unitObject(){const t=this.rgb().object();return t.r/=255,t.g/=255,t.b/=255,1!==this.valpha&&(t.alpha=this.valpha),t},round(t){return t=Math.max(t||0,0),new Ho([...this.color.map(Lo(t)),this.valpha],this.model)},alpha(t){return void 0!==t?new Ho([...this.color,Math.max(0,Math.min(1,t))],this.model):this.valpha},red:Vo("rgb",0,Bo(255)),green:Vo("rgb",1,Bo(255)),blue:Vo("rgb",2,Bo(255)),hue:Vo(["hsl","hsv","hsl","hwb","hcg"],0,t=>(t%360+360)%360),saturationl:Vo("hsl",1,Bo(100)),lightness:Vo("hsl",2,Bo(100)),saturationv:Vo("hsv",1,Bo(100)),value:Vo("hsv",2,Bo(100)),chroma:Vo("hcg",1,Bo(100)),gray:Vo("hcg",2,Bo(100)),white:Vo("hwb",1,Bo(100)),wblack:Vo("hwb",2,Bo(100)),cyan:Vo("cmyk",0,Bo(100)),magenta:Vo("cmyk",1,Bo(100)),yellow:Vo("cmyk",2,Bo(100)),black:Vo("cmyk",3,Bo(100)),x:Vo("xyz",0,Bo(95.047)),y:Vo("xyz",1,Bo(100)),z:Vo("xyz",2,Bo(108.833)),l:Vo("lab",0,Bo(100)),a:Vo("lab",1),b:Vo("lab",2),keyword(t){return void 0!==t?new Ho(t):Fo[this.model].keyword(this.color)},hex(t){return void 0!==t?new Ho(t):ko.to.hex(...this.rgb().round().color)},hexa(t){if(void 0!==t)return new Ho(t);const e=this.rgb().round().color;let r=Math.round(255*this.valpha).toString(16).toUpperCase();return 1===r.length&&(r="0"+r),ko.to.hex(...e)+r},rgbNumber(){const t=this.rgb().color;return(255&t[0])<<16|(255&t[1])<<8|255&t[2]},luminosity(){const t=this.rgb().color,e=[];for(const[r,n]of t.entries()){const t=n/255;e[r]=t<=.04045?t/12.92:((t+.055)/1.055)**2.4}return.2126*e[0]+.7152*e[1]+.0722*e[2]},contrast(t){const e=this.luminosity(),r=t.luminosity();return e>r?(e+.05)/(r+.05):(r+.05)/(e+.05)},level(t){const e=this.contrast(t);return e>=7?"AAA":e>=4.5?"AA":""},isDark(){const t=this.rgb().color;return(2126*t[0]+7152*t[1]+722*t[2])/1e4<128},isLight(){return!this.isDark()},negate(){const t=this.rgb();for(let e=0;e<3;e++)t.color[e]=255-t.color[e];return t},lighten(t){const e=this.hsl();return e.color[2]+=e.color[2]*t,e},darken(t){const e=this.hsl();return e.color[2]-=e.color[2]*t,e},saturate(t){const e=this.hsl();return e.color[1]+=e.color[1]*t,e},desaturate(t){const e=this.hsl();return e.color[1]-=e.color[1]*t,e},whiten(t){const e=this.hwb();return e.color[1]+=e.color[1]*t,e},blacken(t){const e=this.hwb();return e.color[2]+=e.color[2]*t,e},grayscale(){const t=this.rgb().color,e=.3*t[0]+.59*t[1]+.11*t[2];return Ho.rgb(e,e,e)},fade(t){return this.alpha(this.valpha-this.valpha*t)},opaquer(t){return this.alpha(this.valpha+this.valpha*t)},rotate(t){const e=this.hsl();let r=e.color[0];return r=(r+t)%360,r=r<0?360+r:r,e.color[0]=r,e},mix(t,e){if(!t||!t.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof t);const r=t.rgb(),n=this.rgb(),s=void 0===e?.5:e,i=2*s-1,a=r.alpha()-n.alpha(),o=((i*a===-1?i:(i+a)/(1+i*a))+1)/2,l=1-o;return Ho.rgb(o*r.red()+l*n.red(),o*r.green()+l*n.green(),o*r.blue()+l*n.blue(),r.alpha()*s+n.alpha()*(1-s))}};for(const t of Object.keys(Fo)){if(Do.includes(t))continue;const{channels:e}=Fo[t];Ho.prototype[t]=function(...e){return this.model===t?new Ho(this):e.length>0?new Ho(e,t):new Ho([...(r=Fo[this.model][t].raw(this.color),Array.isArray(r)?r:[r]),this.valpha],t);var r},Ho[t]=function(...r){let n=r[0];return"number"==typeof n&&(n=Xo(r,e)),new Ho(n,t)}}function Lo(t){return function(e){return function(t,e){return Number(t.toFixed(e))}(e,t)}}function Vo(t,e,r){t=Array.isArray(t)?t:[t];for(const n of t)(jo[n]||=[])[e]=r;return t=t[0],function(n){let s;return void 0!==n?(r&&(n=r(n)),s=this[t](),s.color[e]=n,s):(s=this[t]().color[e],r&&(s=r(s)),s)}}function Bo(t){return function(e){return Math.max(0,Math.min(t,e))}}function Xo(t,e){for(let r=0;r<e;r++)"number"!=typeof t[r]&&(t[r]=0);return t}class Ko extends(Xa(Za)){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}}}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=to.s.DEFAULT,this.label="",this.locations=[{name:"default",far:this.far,hr:this.hr,s:this.s,label:""}],this.pointArray=[],this.isoDArray=[],this.isoCArray=[],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=to.hrFar2D(this.hr,this.far,this.s),this.c=to.hrFar2C(this.hr,this.far,this.s),this.pointArray=[],this.isoDArray=[],this.isoCArray=[],this.locations.forEach((t,e)=>{t.d=to.hrFar2D(t.hr,t.far,t.s),t.c=to.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="",s=1){"default"===r&&(this.hr=t,this.far=e,this.s=s,this.label=n);const i=this.locations.find(t=>t.name===r);void 0===i?this.locations.push({name:r,far:e,hr:t,s:s,label:n}):(i.hr=t,i.far=e,i.s=s,i.label=n),this.requestUpdate()}setWithSDT(t,e,r="default",n="",s=1){"default"===r&&(this.hr=to.dC2Hr(t,e,s),this.far=to.dC2Far(t,e,s),this.s=s,this.label=n);const i=this.locations.find(t=>t.name===r);void 0===i?this.locations.push({name:r,far:to.dC2Far(t,e,s),hr:to.dC2Hr(t,e,s),s:s,label:n}):(i.hr=to.dC2Hr(t,e,s),i.far=to.dC2Far(t,e,s),i.s=s,i.label=n),this.sdt=!0,this.requestUpdate()}static get styles(){return[super.styles,o`
|
|
1383
|
+
`]}render(){return V``}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=qa().domain([-1,1]).range([0,l]),this.yScale=qa().domain([1,-1]).range([0,o]);const c=ir(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),f=u.select(".plot").attr("transform",`translate(${a}, ${i})`),p=d.append("g").classed("underlayer",!0),m=f.select(".underlayer");p.append("circle").classed("background",!0),m.select(".background").attr("cx",this.xScale(0)).attr("cy",this.yScale(0)).attr("r",this.xScale(1)-this.xScale(0)),d.append("g").classed("content",!0).attr("clip-path","url(#clip-rdk-task)");f.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),g=f.select(".overlayer");b.append("circle").classed("outline",!0),g.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+=Nn()-this.pauseTime,this.pauseTime=0),this.runner=function(t,e,r){var n=new Cn,i=e;return n._restart=n.restart,n.restart=function(t,e,r){e=+e,r=null==r?Nn():+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=Nn())),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=ir(this.renderRoot).select(".content").selectAll(".dots").data([[],[]]).selectAll(".dot").data(t=>t);t.exit().remove();ir(this.renderRoot).select(".content").selectAll(".fixation").data([]).exit().remove();ir(this.renderRoot).select(".content").selectAll(".query").data([]).exit().remove()}run(){const t=Nn(),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=ir(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=ir(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=ir(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()}}function no(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function io(t){return io="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},io(t)}function so(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ao(){return ao=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},ao.apply(this,arguments)}function oo(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function lo(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return oo(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?oo(t,e):void 0}}(t))||e){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,o=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){o=!0,s=t},f:function(){try{a||null==r.return||r.return()}finally{if(o)throw s}}}}function co(t,e){var r=[],n=[];return t.length&&function t(e,i){if(1===e.length)r.push(e[0]),n.push(e[0]);else{for(var s=Array(e.length-1),a=0;a<s.length;a++)0===a&&r.push(e[0]),a===s.length-1&&n.push(e[a+1]),s[a]=[(1-i)*e[a][0]+i*e[a+1][0],(1-i)*e[a][1]+i*e[a+1][1]];t(s,i)}}(t,e),{left:r,right:n.reverse()}}function ho(t){var e={};return 4===t.length&&(e.x2=t[2][0],e.y2=t[2][1]),t.length>=3&&(e.x1=t[1][0],e.y1=t[1][1]),e.x=t[t.length-1][0],e.y=t[t.length-1][1],4===t.length?e.type="C":3===t.length?e.type="Q":e.type="L",e}function uo(t,e,r){var n=[[t.x,t.y]];return null!=e.x1&&n.push([e.x1,e.y1]),null!=e.x2&&n.push([e.x2,e.y2]),n.push([e.x,e.y]),function(t,e){for(var r=[],n=t,i=1/(e=e||2),s=0;s<e-1;s++){var a=co(n,i/(1-i*s));r.push(a.left),n=a.right}return r.push(n),r}(n,r).map(ho)}customElements.define("rdk-task",ro);var fo=/[MLCSTQAHVZmlcstqahv]|-?[\d.e+-]+/g,po={M:["x","y"],L:["x","y"],H:["x"],V:["y"],C:["x1","y1","x2","y2","x","y"],S:["x2","y2","x","y"],Q:["x1","y1","x","y"],T:["x","y"],A:["rx","ry","xAxisRotation","largeArcFlag","sweepFlag","x","y"],Z:[]};function mo(t,e){for(var r=Array(t),n=0;n<t;n++)r[n]=e;return r}function bo(t){return"".concat(t.type).concat(po[t.type].map(function(e){return t[e]}).join(","))}function go(t,e,r){var n=t.length-1,i=e.length-1,s=n/i,a=mo(i).reduce(function(e,n,i){var a=Math.floor(s*i);if(r&&a<t.length-1&&r(t[a],t[a+1])){var o=s*i%1<.5;e[a]&&(o?a>0?a-=1:a<t.length-1&&(a+=1):a<t.length-1?a+=1:a>0&&(a-=1))}return e[a]=(e[a]||0)+1,e},[]),o=a.reduce(function(e,r,n){if(n===t.length-1){var i=mo(r,ao({},t[t.length-1]));return"M"===i[0].type&&i.forEach(function(t){t.type="L"}),e.concat(i)}return e.concat(function(t,e,r){var n=[];if("L"===e.type||"Q"===e.type||"C"===e.type)n=n.concat(uo(t,e,r));else{var i=ao({},t);"M"===i.type&&(i.type="L"),(n=n.concat(mo(r-1).map(function(){return i}))).push(e)}return n}(t[n],t[n+1],r))},[]);return o.unshift(t[0]),o}function vo(t){for(var e,r,n=(t||"").match(fo)||[],i=[],s=0;s<n.length;++s)if(e=po[n[s]]){r={type:n[s]};for(var a=0;a<e.length;++a)r[e[a]]=+n[s+a+1];s+=e.length,i.push(r)}return i}function yo(t,e,r){var n=null==t?[]:t.slice(),i=null==e?[]:e.slice(),s="object"===io(r)?r:{excludeSegment:r,snapEndsToInput:!0},a=s.excludeSegment,o=s.snapEndsToInput;if(!n.length&&!i.length)return function(){return[]};var l=!(0!==n.length&&"Z"!==n[n.length-1].type||0!==i.length&&"Z"!==i[i.length-1].type);n.length>0&&"Z"===n[n.length-1].type&&n.pop(),i.length>0&&"Z"===i[i.length-1].type&&i.pop(),n.length?i.length||i.push(n[0]):n.push(i[0]),0!==Math.abs(i.length-n.length)&&(i.length>n.length?n=go(n,i,a):i.length<n.length&&(i=go(i,n,a))),n=n.map(function(t,e){return function(t,e){var r={x1:"x",y1:"y",x2:"x",y2:"y"},n=["xAxisRotation","largeArcFlag","sweepFlag"];if(t.type!==e.type&&"M"!==e.type.toUpperCase()){var i={};Object.keys(e).forEach(function(s){var a=e[s],o=t[s];void 0===o&&(n.includes(s)?o=a:(void 0===o&&r[s]&&(o=t[r[s]]),void 0===o&&(o=0))),i[s]=o}),i.type=e.type,t=i}return t}(t,i[e])});var c=n.map(function(t){return function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?no(Object(r),!0).forEach(function(e){so(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):no(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}({},t)});return l&&(c.push({type:"Z"}),n.push({type:"Z"})),function(t){if(1===t&&o)return null==e?[]:e;if(0===t)return n;for(var r=0;r<c.length;++r){var s,a=n[r],l=i[r],h=c[r],u=lo(po[h.type]);try{for(u.s();!(s=u.n()).done;){var d=s.value;h[d]=(1-t)*a[d]+t*l[d],"largeArcFlag"!==d&&"sweepFlag"!==d||(h[d]=Math.round(h[d]))}}catch(t){u.e(t)}finally{u.f()}}return c}}Object.keys(po).forEach(function(t){po[t.toLowerCase()]=po[t]});var wo={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};const xo=Object.create(null);for(const t in wo)Object.hasOwn(wo,t)&&(xo[wo[t]]=t);const $o={to:{},get:{}};function ko(t,e,r){return Math.min(Math.max(e,t),r)}function _o(t){const e=Math.round(t).toString(16).toUpperCase();return e.length<2?"0"+e:e}$o.get=function(t){let e,r;switch(t.slice(0,3).toLowerCase()){case"hsl":e=$o.get.hsl(t),r="hsl";break;case"hwb":e=$o.get.hwb(t),r="hwb";break;default:e=$o.get.rgb(t),r="rgb"}return e?{model:r,value:e}:null},$o.get.rgb=function(t){if(!t)return null;let e,r,n,i=[0,0,0,1];if(e=t.match(/^#([a-f\d]{6})([a-f\d]{2})?$/i)){for(n=e[2],e=e[1],r=0;r<3;r++){const t=2*r;i[r]=Number.parseInt(e.slice(t,t+2),16)}n&&(i[3]=Number.parseInt(n,16)/255)}else if(e=t.match(/^#([a-f\d]{3,4})$/i)){for(e=e[1],n=e[3],r=0;r<3;r++)i[r]=Number.parseInt(e[r]+e[r],16);n&&(i[3]=Number.parseInt(n+n,16)/255)}else if(e=t.match(/^rgba?\(\s*([+-]?(?:\d*\.)?\d+(?:e\d+)?)(?=[\s,])\s*(?:,\s*)?([+-]?(?:\d*\.)?\d+(?:e\d+)?)(?=[\s,])\s*(?:,\s*)?([+-]?(?:\d*\.)?\d+(?:e\d+)?)\s*(?:[\s,|/]\s*([+-]?(?:\d*\.)?\d+(?:e\d+)?)(%?)\s*)?\)$/i)){for(r=0;r<3;r++)i[r]=Number.parseFloat(e[r+1]);e[4]&&(i[3]=e[5]?.01*Number.parseFloat(e[4]):Number.parseFloat(e[4]))}else{if(!(e=t.match(/^rgba?\(\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[\s,|/]\s*([+-]?[\d.]+)(%?)\s*)?\)$/i)))return(e=t.toLowerCase().match(/^(\w+)$/))?"transparent"===e[1]?[0,0,0,0]:Object.hasOwn(wo,e[1])?(i=wo[e[1]].slice(),i[3]=1,i):null:null;for(r=0;r<3;r++)i[r]=Math.round(2.55*Number.parseFloat(e[r+1]));e[4]&&(i[3]=e[5]?.01*Number.parseFloat(e[4]):Number.parseFloat(e[4]))}for(r=0;r<3;r++)i[r]=ko(i[r],0,255);return i[3]=ko(i[3],0,1),i},$o.get.hsl=function(t){if(!t)return null;const e=t.match(/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[,|/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:e[+-]?\d+)?)\s*)?\)$/i);if(e){const t=Number.parseFloat(e[4]);return[(Number.parseFloat(e[1])%360+360)%360,ko(Number.parseFloat(e[2]),0,100),ko(Number.parseFloat(e[3]),0,100),ko(Number.isNaN(t)?1:t,0,1)]}return null},$o.get.hwb=function(t){if(!t)return null;const e=t.match(/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*[\s,]\s*([+-]?[\d.]+)%\s*[\s,]\s*([+-]?[\d.]+)%\s*(?:[\s,]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:e[+-]?\d+)?)\s*)?\)$/i);if(e){const t=Number.parseFloat(e[4]);return[(Number.parseFloat(e[1])%360+360)%360,ko(Number.parseFloat(e[2]),0,100),ko(Number.parseFloat(e[3]),0,100),ko(Number.isNaN(t)?1:t,0,1)]}return null},$o.to.hex=function(...t){return"#"+_o(t[0])+_o(t[1])+_o(t[2])+(t[3]<1?_o(Math.round(255*t[3])):"")},$o.to.rgb=function(...t){return t.length<4||1===t[3]?"rgb("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+")":"rgba("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+", "+t[3]+")"},$o.to.rgb.percent=function(...t){const e=Math.round(t[0]/255*100),r=Math.round(t[1]/255*100),n=Math.round(t[2]/255*100);return t.length<4||1===t[3]?"rgb("+e+"%, "+r+"%, "+n+"%)":"rgba("+e+"%, "+r+"%, "+n+"%, "+t[3]+")"},$o.to.hsl=function(...t){return t.length<4||1===t[3]?"hsl("+t[0]+", "+t[1]+"%, "+t[2]+"%)":"hsla("+t[0]+", "+t[1]+"%, "+t[2]+"%, "+t[3]+")"},$o.to.hwb=function(...t){let e="";return t.length>=4&&1!==t[3]&&(e=", "+t[3]),"hwb("+t[0]+", "+t[1]+"%, "+t[2]+"%"+e+")"},$o.to.keyword=function(...t){return xo[t.slice(0,3)]};const So={};for(const t of Object.keys(wo))So[wo[t]]=t;const Mo={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},oklab:{channels:3,labels:["okl","oka","okb"]},lch:{channels:3,labels:"lch"},oklch:{channels:3,labels:["okl","okc","okh"]},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}},Ao=(6/29)**3;function Eo(t){const e=t>.0031308?1.055*t**(1/2.4)-.055:12.92*t;return Math.min(Math.max(0,e),1)}function No(t){return t>.04045?((t+.055)/1.055)**2.4:t/12.92}for(const t of Object.keys(Mo)){if(!("channels"in Mo[t]))throw new Error("missing channels property: "+t);if(!("labels"in Mo[t]))throw new Error("missing channel labels property: "+t);if(Mo[t].labels.length!==Mo[t].channels)throw new Error("channel and label counts mismatch: "+t);const{channels:e,labels:r}=Mo[t];delete Mo[t].channels,delete Mo[t].labels,Object.defineProperty(Mo[t],"channels",{value:e}),Object.defineProperty(Mo[t],"labels",{value:r})}function To(t,e){return(t[0]-e[0])**2+(t[1]-e[1])**2+(t[2]-e[2])**2}function Co(t){const e=function(){const t={},e=Object.keys(Mo);for(let{length:r}=e,n=0;n<r;n++)t[e[n]]={distance:-1,parent:null};return t}(),r=[t];for(e[t].distance=0;r.length>0;){const t=r.pop(),n=Object.keys(Mo[t]);for(let{length:i}=n,s=0;s<i;s++){const i=n[s],a=e[i];-1===a.distance&&(a.distance=e[t].distance+1,a.parent=t,r.unshift(i))}}return e}function Po(t,e){return function(r){return e(t(r))}}function Ro(t,e){const r=[e[t].parent,t];let n=Mo[e[t].parent][t],i=e[t].parent;for(;e[i].parent;)r.unshift(e[i].parent),n=Po(Mo[e[i].parent][i],n),i=e[i].parent;return n.conversion=r,n}function qo(t){const e=Co(t),r={},n=Object.keys(e);for(let{length:t}=n,i=0;i<t;i++){const t=n[i];null!==e[t].parent&&(r[t]=Ro(t,e))}return r}Mo.rgb.hsl=function(t){const e=t[0]/255,r=t[1]/255,n=t[2]/255,i=Math.min(e,r,n),s=Math.max(e,r,n),a=s-i;let o,l;switch(s){case i:o=0;break;case e:o=(r-n)/a;break;case r:o=2+(n-e)/a;break;case n:o=4+(e-r)/a}o=Math.min(60*o,360),o<0&&(o+=360);const c=(i+s)/2;return l=s===i?0:c<=.5?a/(s+i):a/(2-s-i),[o,100*l,100*c]},Mo.rgb.hsv=function(t){let e,r,n,i,s;const a=t[0]/255,o=t[1]/255,l=t[2]/255,c=Math.max(a,o,l),h=c-Math.min(a,o,l),u=function(t){return(c-t)/6/h+.5};if(0===h)i=0,s=0;else{switch(s=h/c,e=u(a),r=u(o),n=u(l),c){case a:i=n-r;break;case o:i=1/3+e-n;break;case l:i=2/3+r-e}i<0?i+=1:i>1&&(i-=1)}return[360*i,100*s,100*c]},Mo.rgb.hwb=function(t){const e=t[0],r=t[1];let n=t[2];const i=Mo.rgb.hsl(t)[0],s=1/255*Math.min(e,Math.min(r,n));return n=1-1/255*Math.max(e,Math.max(r,n)),[i,100*s,100*n]},Mo.rgb.oklab=function(t){const e=No(t[0]/255),r=No(t[1]/255),n=No(t[2]/255),i=Math.cbrt(.4122214708*e+.5363325363*r+.0514459929*n),s=Math.cbrt(.2119034982*e+.6806995451*r+.1073969566*n),a=Math.cbrt(.0883024619*e+.2817188376*r+.6299787005*n);return[100*(.2104542553*i+.793617785*s-.0040720468*a),100*(1.9779984951*i-2.428592205*s+.4505937099*a),100*(.0259040371*i+.7827717662*s-.808675766*a)]},Mo.rgb.cmyk=function(t){const e=t[0]/255,r=t[1]/255,n=t[2]/255,i=Math.min(1-e,1-r,1-n);return[100*((1-e-i)/(1-i)||0),100*((1-r-i)/(1-i)||0),100*((1-n-i)/(1-i)||0),100*i]},Mo.rgb.keyword=function(t){const e=So[t];if(e)return e;let r,n=Number.POSITIVE_INFINITY;for(const e of Object.keys(wo)){const i=To(t,wo[e]);i<n&&(n=i,r=e)}return r},Mo.keyword.rgb=function(t){return[...wo[t]]},Mo.rgb.xyz=function(t){const e=No(t[0]/255),r=No(t[1]/255),n=No(t[2]/255);return[100*(.4124564*e+.3575761*r+.1804375*n),100*(.2126729*e+.7151522*r+.072175*n),100*(.0193339*e+.119192*r+.9503041*n)]},Mo.rgb.lab=function(t){const e=Mo.rgb.xyz(t);let r=e[0],n=e[1],i=e[2];r/=95.047,n/=100,i/=108.883,r=r>Ao?r**(1/3):7.787*r+16/116,n=n>Ao?n**(1/3):7.787*n+16/116,i=i>Ao?i**(1/3):7.787*i+16/116;return[116*n-16,500*(r-n),200*(n-i)]},Mo.hsl.rgb=function(t){const e=t[0]/360,r=t[1]/100,n=t[2]/100;let i,s;if(0===r)return s=255*n,[s,s,s];const a=n<.5?n*(1+r):n+r-n*r,o=2*n-a,l=[0,0,0];for(let t=0;t<3;t++)i=e+1/3*-(t-1),i<0&&i++,i>1&&i--,s=6*i<1?o+6*(a-o)*i:2*i<1?a:3*i<2?o+(a-o)*(2/3-i)*6:o,l[t]=255*s;return l},Mo.hsl.hsv=function(t){const e=t[0];let r=t[1]/100,n=t[2]/100,i=r;const s=Math.max(n,.01);n*=2,r*=n<=1?n:2-n,i*=s<=1?s:2-s;return[e,100*(0===n?2*i/(s+i):2*r/(n+r)),100*((n+r)/2)]},Mo.hsv.rgb=function(t){const e=t[0]/60,r=t[1]/100;let n=t[2]/100;const i=Math.floor(e)%6,s=e-Math.floor(e),a=255*n*(1-r),o=255*n*(1-r*s),l=255*n*(1-r*(1-s));switch(n*=255,i){case 0:return[n,l,a];case 1:return[o,n,a];case 2:return[a,n,l];case 3:return[a,o,n];case 4:return[l,a,n];case 5:return[n,a,o]}},Mo.hsv.hsl=function(t){const e=t[0],r=t[1]/100,n=t[2]/100,i=Math.max(n,.01);let s,a;a=(2-r)*n;const o=(2-r)*i;return s=r*i,s/=o<=1?o:2-o,s=s||0,a/=2,[e,100*s,100*a]},Mo.hwb.rgb=function(t){const e=t[0]/360;let r=t[1]/100,n=t[2]/100;const i=r+n;let s;i>1&&(r/=i,n/=i);const a=Math.floor(6*e),o=1-n;s=6*e-a,1&a&&(s=1-s);const l=r+s*(o-r);let c,h,u;switch(a){default:case 6:case 0:c=o,h=l,u=r;break;case 1:c=l,h=o,u=r;break;case 2:c=r,h=o,u=l;break;case 3:c=r,h=l,u=o;break;case 4:c=l,h=r,u=o;break;case 5:c=o,h=r,u=l}return[255*c,255*h,255*u]},Mo.cmyk.rgb=function(t){const e=t[0]/100,r=t[1]/100,n=t[2]/100,i=t[3]/100;return[255*(1-Math.min(1,e*(1-i)+i)),255*(1-Math.min(1,r*(1-i)+i)),255*(1-Math.min(1,n*(1-i)+i))]},Mo.xyz.rgb=function(t){const e=t[0]/100,r=t[1]/100,n=t[2]/100;let i,s,a;return i=3.2404542*e+-1.5371385*r+-.4985314*n,s=-.969266*e+1.8760108*r+.041556*n,a=.0556434*e+-.2040259*r+1.0572252*n,i=Eo(i),s=Eo(s),a=Eo(a),[255*i,255*s,255*a]},Mo.xyz.lab=function(t){let e=t[0],r=t[1],n=t[2];e/=95.047,r/=100,n/=108.883,e=e>Ao?e**(1/3):7.787*e+16/116,r=r>Ao?r**(1/3):7.787*r+16/116,n=n>Ao?n**(1/3):7.787*n+16/116;return[116*r-16,500*(e-r),200*(r-n)]},Mo.xyz.oklab=function(t){const e=t[0]/100,r=t[1]/100,n=t[2]/100,i=Math.cbrt(.8189330101*e+.3618667424*r-.1288597137*n),s=Math.cbrt(.0329845436*e+.9293118715*r+.0361456387*n),a=Math.cbrt(.0482003018*e+.2643662691*r+.633851707*n);return[100*(.2104542553*i+.793617785*s-.0040720468*a),100*(1.9779984951*i-2.428592205*s+.4505937099*a),100*(.0259040371*i+.7827717662*s-.808675766*a)]},Mo.oklab.oklch=function(t){return Mo.lab.lch(t)},Mo.oklab.xyz=function(t){const e=t[0]/100,r=t[1]/100,n=t[2]/100,i=(.999999998*e+.396337792*r+.215803758*n)**3,s=(1.000000008*e-.105561342*r-.063854175*n)**3,a=(1.000000055*e-.089484182*r-1.291485538*n)**3;return[100*(1.227013851*i-.55779998*s+.281256149*a),100*(-.040580178*i+1.11225687*s-.071676679*a),100*(-.076381285*i-.421481978*s+1.58616322*a)]},Mo.oklab.rgb=function(t){const e=t[0]/100,r=t[1]/100,n=t[2]/100,i=(e+.3963377774*r+.2158037573*n)**3,s=(e-.1055613458*r-.0638541728*n)**3,a=(e-.0894841775*r-1.291485548*n)**3;return[255*Eo(4.0767416621*i-3.3077115913*s+.2309699292*a),255*Eo(-1.2684380046*i+2.6097574011*s-.3413193965*a),255*Eo(-.0041960863*i-.7034186147*s+1.707614701*a)]},Mo.oklch.oklab=function(t){return Mo.lch.lab(t)},Mo.lab.xyz=function(t){let e,r,n;r=(t[0]+16)/116,e=t[1]/500+r,n=r-t[2]/200;const i=r**3,s=e**3,a=n**3;return r=i>Ao?i:(r-16/116)/7.787,e=s>Ao?s:(e-16/116)/7.787,n=a>Ao?a:(n-16/116)/7.787,e*=95.047,r*=100,n*=108.883,[e,r,n]},Mo.lab.lch=function(t){const e=t[0],r=t[1],n=t[2];let i;i=360*Math.atan2(n,r)/2/Math.PI,i<0&&(i+=360);return[e,Math.sqrt(r*r+n*n),i]},Mo.lch.lab=function(t){const e=t[0],r=t[1],n=t[2]/360*2*Math.PI;return[e,r*Math.cos(n),r*Math.sin(n)]},Mo.rgb.ansi16=function(t,e=null){const[r,n,i]=t;let s=null===e?Mo.rgb.hsv(t)[2]:e;if(s=Math.round(s/50),0===s)return 30;let a=30+(Math.round(i/255)<<2|Math.round(n/255)<<1|Math.round(r/255));return 2===s&&(a+=60),a},Mo.hsv.ansi16=function(t){return Mo.rgb.ansi16(Mo.hsv.rgb(t),t[2])},Mo.rgb.ansi256=function(t){const e=t[0],r=t[1],n=t[2];if(e>>4==r>>4&&r>>4==n>>4)return e<8?16:e>248?231:Math.round((e-8)/247*24)+232;return 16+36*Math.round(e/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5)},Mo.ansi16.rgb=function(t){let e=(t=t[0])%10;if(0===e||7===e)return t>50&&(e+=3.5),e=e/10.5*255,[e,e,e];const r=.5*(Math.trunc(t>50)+1);return[(1&e)*r*255,(e>>1&1)*r*255,(e>>2&1)*r*255]},Mo.ansi256.rgb=function(t){if((t=t[0])>=232){const e=10*(t-232)+8;return[e,e,e]}let e;t-=16;return[Math.floor(t/36)/5*255,Math.floor((e=t%36)/6)/5*255,e%6/5*255]},Mo.rgb.hex=function(t){const e=(((255&Math.round(t[0]))<<16)+((255&Math.round(t[1]))<<8)+(255&Math.round(t[2]))).toString(16).toUpperCase();return"000000".slice(e.length)+e},Mo.hex.rgb=function(t){const e=t.toString(16).match(/[a-f\d]{6}|[a-f\d]{3}/i);if(!e)return[0,0,0];let r=e[0];3===e[0].length&&(r=[...r].map(t=>t+t).join(""));const n=Number.parseInt(r,16);return[n>>16&255,n>>8&255,255&n]},Mo.rgb.hcg=function(t){const e=t[0]/255,r=t[1]/255,n=t[2]/255,i=Math.max(Math.max(e,r),n),s=Math.min(Math.min(e,r),n),a=i-s;let o;return o=a<=0?0:i===e?(r-n)/a%6:i===r?2+(n-e)/a:4+(e-r)/a,o/=6,o%=1,[360*o,100*a,100*(a<1?s/(1-a):0)]},Mo.hsl.hcg=function(t){const e=t[1]/100,r=t[2]/100,n=r<.5?2*e*r:2*e*(1-r);let i=0;return n<1&&(i=(r-.5*n)/(1-n)),[t[0],100*n,100*i]},Mo.hsv.hcg=function(t){const e=t[1]/100,r=t[2]/100,n=e*r;let i=0;return n<1&&(i=(r-n)/(1-n)),[t[0],100*n,100*i]},Mo.hcg.rgb=function(t){const e=t[0]/360,r=t[1]/100,n=t[2]/100;if(0===r)return[255*n,255*n,255*n];const i=[0,0,0],s=e%1*6,a=s%1,o=1-a;let l=0;switch(Math.floor(s)){case 0:i[0]=1,i[1]=a,i[2]=0;break;case 1:i[0]=o,i[1]=1,i[2]=0;break;case 2:i[0]=0,i[1]=1,i[2]=a;break;case 3:i[0]=0,i[1]=o,i[2]=1;break;case 4:i[0]=a,i[1]=0,i[2]=1;break;default:i[0]=1,i[1]=0,i[2]=o}return l=(1-r)*n,[255*(r*i[0]+l),255*(r*i[1]+l),255*(r*i[2]+l)]},Mo.hcg.hsv=function(t){const e=t[1]/100,r=e+t[2]/100*(1-e);let n=0;return r>0&&(n=e/r),[t[0],100*n,100*r]},Mo.hcg.hsl=function(t){const e=t[1]/100,r=t[2]/100*(1-e)+.5*e;let n=0;return r>0&&r<.5?n=e/(2*r):r>=.5&&r<1&&(n=e/(2*(1-r))),[t[0],100*n,100*r]},Mo.hcg.hwb=function(t){const e=t[1]/100,r=e+t[2]/100*(1-e);return[t[0],100*(r-e),100*(1-r)]},Mo.hwb.hcg=function(t){const e=t[1]/100,r=1-t[2]/100,n=r-e;let i=0;return n<1&&(i=(r-n)/(1-n)),[t[0],100*n,100*i]},Mo.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]},Mo.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]},Mo.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]},Mo.gray.hsl=function(t){return[0,0,t[0]]},Mo.gray.hsv=Mo.gray.hsl,Mo.gray.hwb=function(t){return[0,100,t[0]]},Mo.gray.cmyk=function(t){return[0,0,0,t[0]]},Mo.gray.lab=function(t){return[t[0],0,0]},Mo.gray.hex=function(t){const e=255&Math.round(t[0]/100*255),r=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".slice(r.length)+r},Mo.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]};const Fo={},zo=Object.keys(Mo);function Oo(t){const e=function(...e){const r=e[0];return null==r?r:(r.length>1&&(e=r),t(e))};return"conversion"in t&&(e.conversion=t.conversion),e}function Io(t){const e=function(...e){const r=e[0];if(null==r)return r;r.length>1&&(e=r);const n=t(e);if("object"==typeof n)for(let{length:t}=n,e=0;e<t;e++)n[e]=Math.round(n[e]);return n};return"conversion"in t&&(e.conversion=t.conversion),e}for(const t of zo){Fo[t]={},Object.defineProperty(Fo[t],"channels",{value:Mo[t].channels}),Object.defineProperty(Fo[t],"labels",{value:Mo[t].labels});const e=qo(t),r=Object.keys(e);for(const n of r){const r=e[n];Fo[t][n]=Io(r),Fo[t][n].raw=Oo(r)}}const Do=["keyword","gray","hex"],Uo={};for(const t of Object.keys(Fo))Uo[[...Fo[t].labels].sort().join("")]=t;const jo={};function Lo(t,e){if(!(this instanceof Lo))return new Lo(t,e);if(e&&e in Do&&(e=null),e&&!(e in Fo))throw new Error("Unknown model: "+e);let r,n;if(null==t)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(t instanceof Lo)this.model=t.model,this.color=[...t.color],this.valpha=t.valpha;else if("string"==typeof t){const e=$o.get(t);if(null===e)throw new Error("Unable to parse color from string: "+t);this.model=e.model,n=Fo[this.model].channels,this.color=e.value.slice(0,n),this.valpha="number"==typeof e.value[n]?e.value[n]:1}else if(t.length>0){this.model=e||"rgb",n=Fo[this.model].channels;const r=Array.prototype.slice.call(t,0,n);this.color=Xo(r,n),this.valpha="number"==typeof t[n]?t[n]:1}else if("number"==typeof t)this.model="rgb",this.color=[t>>16&255,t>>8&255,255&t],this.valpha=1;else{this.valpha=1;const e=Object.keys(t);"alpha"in t&&(e.splice(e.indexOf("alpha"),1),this.valpha="number"==typeof t.alpha?t.alpha:0);const n=e.sort().join("");if(!(n in Uo))throw new Error("Unable to parse color from object: "+JSON.stringify(t));this.model=Uo[n];const{labels:i}=Fo[this.model],s=[];for(r=0;r<i.length;r++)s.push(t[i[r]]);this.color=Xo(s)}if(jo[this.model])for(n=Fo[this.model].channels,r=0;r<n;r++){const t=jo[this.model][r];t&&(this.color[r]=t(this.color[r]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}Lo.prototype={toString(){return this.string()},toJSON(){return this[this.model]()},string(t){let e=this.model in $o.to?this:this.rgb();e=e.round("number"==typeof t?t:1);const r=1===e.valpha?e.color:[...e.color,this.valpha];return $o.to[e.model](...r)},percentString(t){const e=this.rgb().round("number"==typeof t?t:1),r=1===e.valpha?e.color:[...e.color,this.valpha];return $o.to.rgb.percent(...r)},array(){return 1===this.valpha?[...this.color]:[...this.color,this.valpha]},object(){const t={},{channels:e}=Fo[this.model],{labels:r}=Fo[this.model];for(let n=0;n<e;n++)t[r[n]]=this.color[n];return 1!==this.valpha&&(t.alpha=this.valpha),t},unitArray(){const t=this.rgb().color;return t[0]/=255,t[1]/=255,t[2]/=255,1!==this.valpha&&t.push(this.valpha),t},unitObject(){const t=this.rgb().object();return t.r/=255,t.g/=255,t.b/=255,1!==this.valpha&&(t.alpha=this.valpha),t},round(t){return t=Math.max(t||0,0),new Lo([...this.color.map(Ho(t)),this.valpha],this.model)},alpha(t){return void 0!==t?new Lo([...this.color,Math.max(0,Math.min(1,t))],this.model):this.valpha},red:Vo("rgb",0,Bo(255)),green:Vo("rgb",1,Bo(255)),blue:Vo("rgb",2,Bo(255)),hue:Vo(["hsl","hsv","hsl","hwb","hcg"],0,t=>(t%360+360)%360),saturationl:Vo("hsl",1,Bo(100)),lightness:Vo("hsl",2,Bo(100)),saturationv:Vo("hsv",1,Bo(100)),value:Vo("hsv",2,Bo(100)),chroma:Vo("hcg",1,Bo(100)),gray:Vo("hcg",2,Bo(100)),white:Vo("hwb",1,Bo(100)),wblack:Vo("hwb",2,Bo(100)),cyan:Vo("cmyk",0,Bo(100)),magenta:Vo("cmyk",1,Bo(100)),yellow:Vo("cmyk",2,Bo(100)),black:Vo("cmyk",3,Bo(100)),x:Vo("xyz",0,Bo(95.047)),y:Vo("xyz",1,Bo(100)),z:Vo("xyz",2,Bo(108.833)),l:Vo("lab",0,Bo(100)),a:Vo("lab",1),b:Vo("lab",2),keyword(t){return void 0!==t?new Lo(t):Fo[this.model].keyword(this.color)},hex(t){return void 0!==t?new Lo(t):$o.to.hex(...this.rgb().round().color)},hexa(t){if(void 0!==t)return new Lo(t);const e=this.rgb().round().color;let r=Math.round(255*this.valpha).toString(16).toUpperCase();return 1===r.length&&(r="0"+r),$o.to.hex(...e)+r},rgbNumber(){const t=this.rgb().color;return(255&t[0])<<16|(255&t[1])<<8|255&t[2]},luminosity(){const t=this.rgb().color,e=[];for(const[r,n]of t.entries()){const t=n/255;e[r]=t<=.04045?t/12.92:((t+.055)/1.055)**2.4}return.2126*e[0]+.7152*e[1]+.0722*e[2]},contrast(t){const e=this.luminosity(),r=t.luminosity();return e>r?(e+.05)/(r+.05):(r+.05)/(e+.05)},level(t){const e=this.contrast(t);return e>=7?"AAA":e>=4.5?"AA":""},isDark(){const t=this.rgb().color;return(2126*t[0]+7152*t[1]+722*t[2])/1e4<128},isLight(){return!this.isDark()},negate(){const t=this.rgb();for(let e=0;e<3;e++)t.color[e]=255-t.color[e];return t},lighten(t){const e=this.hsl();return e.color[2]+=e.color[2]*t,e},darken(t){const e=this.hsl();return e.color[2]-=e.color[2]*t,e},saturate(t){const e=this.hsl();return e.color[1]+=e.color[1]*t,e},desaturate(t){const e=this.hsl();return e.color[1]-=e.color[1]*t,e},whiten(t){const e=this.hwb();return e.color[1]+=e.color[1]*t,e},blacken(t){const e=this.hwb();return e.color[2]+=e.color[2]*t,e},grayscale(){const t=this.rgb().color,e=.3*t[0]+.59*t[1]+.11*t[2];return Lo.rgb(e,e,e)},fade(t){return this.alpha(this.valpha-this.valpha*t)},opaquer(t){return this.alpha(this.valpha+this.valpha*t)},rotate(t){const e=this.hsl();let r=e.color[0];return r=(r+t)%360,r=r<0?360+r:r,e.color[0]=r,e},mix(t,e){if(!t||!t.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof t);const r=t.rgb(),n=this.rgb(),i=void 0===e?.5:e,s=2*i-1,a=r.alpha()-n.alpha(),o=((s*a===-1?s:(s+a)/(1+s*a))+1)/2,l=1-o;return Lo.rgb(o*r.red()+l*n.red(),o*r.green()+l*n.green(),o*r.blue()+l*n.blue(),r.alpha()*i+n.alpha()*(1-i))}};for(const t of Object.keys(Fo)){if(Do.includes(t))continue;const{channels:e}=Fo[t];Lo.prototype[t]=function(...e){return this.model===t?new Lo(this):e.length>0?new Lo(e,t):new Lo([...(r=Fo[this.model][t].raw(this.color),Array.isArray(r)?r:[r]),this.valpha],t);var r},Lo[t]=function(...r){let n=r[0];return"number"==typeof n&&(n=Xo(r,e)),new Lo(n,t)}}function Ho(t){return function(e){return function(t,e){return Number(t.toFixed(e))}(e,t)}}function Vo(t,e,r){t=Array.isArray(t)?t:[t];for(const n of t)(jo[n]||=[])[e]=r;return t=t[0],function(n){let i;return void 0!==n?(r&&(n=r(n)),i=this[t](),i.color[e]=n,i):(i=this[t]().color[e],r&&(i=r(i)),i)}}function Bo(t){return function(e){return Math.max(0,Math.min(t,e))}}function Xo(t,e){for(let r=0;r<e;r++)"number"!=typeof t[r]&&(t[r]=0);return t}class Ko extends(Xa(Za)){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}}}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=to.s.DEFAULT,this.label="",this.locations=[{name:"default",far:this.far,hr:this.hr,s:this.s,label:""}],this.pointArray=[],this.isoDArray=[],this.isoCArray=[],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=to.hrFar2D(this.hr,this.far,this.s),this.c=to.hrFar2C(this.hr,this.far,this.s),this.pointArray=[],this.isoDArray=[],this.isoCArray=[],this.locations.forEach((t,e)=>{t.d=to.hrFar2D(t.hr,t.far,t.s),t.c=to.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=to.dC2Hr(t,e,i),this.far=to.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:to.dC2Far(t,e,i),hr:to.dC2Hr(t,e,i),s:i,label:n}):(s.hr=to.dC2Hr(t,e,i),s.far=to.dC2Far(t,e,i),s.s=i,s.label=n),this.sdt=!0,this.requestUpdate()}static get styles(){return[super.styles,o`
|
|
1416
1384
|
:host {
|
|
1417
1385
|
display: inline-block;
|
|
1418
1386
|
|
|
@@ -1441,9 +1409,9 @@ const La=t=>t??K;customElements.define("decidables-slider",class extends Ha{stat
|
|
|
1441
1409
|
|
|
1442
1410
|
.point.interactive {
|
|
1443
1411
|
cursor: move;
|
|
1412
|
+
outline: none;
|
|
1444
1413
|
|
|
1445
1414
|
filter: url("#shadow-2");
|
|
1446
|
-
outline: none;
|
|
1447
1415
|
|
|
1448
1416
|
/* HACK: This gets Safari to correctly apply the filter! */
|
|
1449
1417
|
/* https://github.com/emilbjorklund/svg-weirdness/issues/27 */
|
|
@@ -1466,7 +1434,7 @@ const La=t=>t??K;customElements.define("decidables-slider",class extends Ha{stat
|
|
|
1466
1434
|
stroke: #00ff00;
|
|
1467
1435
|
}
|
|
1468
1436
|
|
|
1469
|
-
|
|
1437
|
+
.point.interactive:focus-visible {
|
|
1470
1438
|
filter: url("#shadow-8");
|
|
1471
1439
|
|
|
1472
1440
|
/* HACK: This gets Safari to correctly apply the filter! */
|
|
@@ -1505,8 +1473,8 @@ const La=t=>t??K;customElements.define("decidables-slider",class extends Ha{stat
|
|
|
1505
1473
|
|
|
1506
1474
|
.diagonal {
|
|
1507
1475
|
stroke: var(---color-element-border);
|
|
1508
|
-
stroke-dasharray: 4;
|
|
1509
1476
|
stroke-width: 1;
|
|
1477
|
+
stroke-dasharray: 4;
|
|
1510
1478
|
}
|
|
1511
1479
|
|
|
1512
1480
|
.curve-iso-d {
|
|
@@ -1531,8 +1499,8 @@ const La=t=>t??K;customElements.define("decidables-slider",class extends Ha{stat
|
|
|
1531
1499
|
font-size: 0.75rem;
|
|
1532
1500
|
|
|
1533
1501
|
dominant-baseline: central;
|
|
1534
|
-
text-anchor: middle;
|
|
1535
1502
|
|
|
1503
|
+
text-anchor: middle;
|
|
1536
1504
|
fill: var(---color-text-inverse);
|
|
1537
1505
|
}
|
|
1538
1506
|
|
|
@@ -1544,11 +1512,11 @@ const La=t=>t??K;customElements.define("decidables-slider",class extends Ha{stat
|
|
|
1544
1512
|
|
|
1545
1513
|
@media (pointer: coarse) {
|
|
1546
1514
|
.interactive .touch {
|
|
1547
|
-
stroke-linecap: round;
|
|
1548
1515
|
stroke-width: 12;
|
|
1516
|
+
stroke-linecap: round;
|
|
1549
1517
|
}
|
|
1550
1518
|
}
|
|
1551
|
-
`]}render(){return V``}willUpdate(){this.alignState()}update(t){if(super.update(t),Number.isNaN(this.width)||Number.isNaN(this.height)||Number.isNaN(this.rem))return;const e=this.width,r=this.height,n=Math.min(e,r),s=2*this.rem,i=3*this.rem,a=3*this.rem,o=n-(s+i),l=n-(a+2*this.rem),c=parseInt(this.getComputedStyleValue("---transition-duration"),10),h=qa().domain(this.zRoc?[-3,3]:[0,1]).range([0,l]);this.xScale=h;const u=qa().domain(this.zRoc?[3,-3]:[1,0]).range([0,o]);this.yScale=u;const d=br().subject((t,e)=>({x:this.xScale(this.zRoc?to.far2Zfar(e.far):e.far),y:this.yScale(this.zRoc?to.hr2Zhr(e.hr):e.hr)})).on("start",t=>{sr(t.currentTarget).classed("dragging",!0)}).on("drag",(t,e)=>{this.drag=!0;const r=this.zRoc?to.zfar2Far(this.xScale.invert(t.x)):this.xScale.invert(t.x),n=this.zRoc?to.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=>{sr(t.currentTarget).classed("dragging",!1)}),f=Ua().x(t=>h(this.zRoc?to.far2Zfar(t.far):t.far)).y(t=>u(this.zRoc?to.hr2Zhr(t.hr):t.hr)),p=sr(this.renderRoot).selectAll(".main").data([{width:this.width,height:this.height,rem:this.rem}]),m=p.enter().append("svg").classed("main",!0).each((t,e,r)=>{lt(Za.svgFilters,r[e])}),b=m.merge(p).attr("viewBox",`0 0 ${n} ${n}`),g=m.append("g").classed("plot",!0),v=b.select(".plot").attr("transform",`translate(${a}, ${s})`);g.append("clipPath").attr("id","clip-roc-space").append("rect"),v.select("clipPath rect").attr("height",o+1).attr("width",l+1);const y=g.append("g").classed("underlayer",!0),w=v.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 s=.5;s<t;s+=1,n+=1){const i=this.zRoc?to.zhr2Hr(s/t*6-3):s/t,a=this.zRoc?to.zfar2Far(6*(1-r/t)-3):1-r/t;e[n]="bias"===this.contour?to.hrFar2C(i,a,this.s):"sensitivity"===this.contour?to.hrFar2D(i,a,this.s):"accuracy"===this.contour?to.hrFar2Acc(i,a):null}const r="bias"===this.contour?Tt(-3,3,.25):"sensitivity"===this.contour?Tt(-6,6,.5):"accuracy"===this.contour?Tt(0,1,.05):null,n=Ts().size([t,t]).thresholds(r),s=this.getComputedStyleValue("bias"===this.contour?"---color-element-background":"sensitivity"===this.contour?"---color-d":"accuracy"===this.contour?"---color-acc-dark":null),i=this.getComputedStyleValue("bias"===this.contour?"---color-c":"sensitivity"===this.contour||"accuracy"===this.contour?"---color-element-background":null),a=qa().domain(gt(r)).interpolate(()=>tn(Ho(s).hex(),Ho(i).hex())),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(fs).attrTween("d",(e,r,n)=>function(t,e,r){var n=vo(t),s=vo(e),i="object"===so(r)?r:{excludeSegment:r,snapEndsToInput:!0},a=i.excludeSegment,o=i.snapEndsToInput;if(!n.length&&!s.length)return function(){return""};var l=yo(n,s,{excludeSegment:a,snapEndsToInput:o});return function(t){if(1===t&&o)return null==e?"":e;var r,n="",s=lo(l(t));try{for(s.s();!(r=s.n()).done;)n+=bo(r.value)}catch(t){s.e(t)}finally{s.f()}return n}}(sr(n[r]).attr("d"),wa(_a().scale(l/t))(e))).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,f=[];for(let e=.5,r=0;e<d;e+=1,r+=4)f[r]="bias"===this.contour?-(e/t*6-3):"sensitivity"===this.contour?e/t*12-6:"accuracy"===this.contour?e/t:null,f[r+1]=f[r],f[r+2]=f[r],f[r+3]=f[r];const p=Ts().size([4,d]).thresholds(r),m=qa().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]),g=b.enter().append("g").classed("legend-contour",!0),v=g.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(),g.append("g").classed("axis-contour",!0),v.select(".axis-contour").call(Ut(m).ticks(7).tickSize(0)).attr("font-size",null).attr("font-family",null);const y=v.selectAll(".contour").data(p(f));y.enter().append("path").classed("contour",!0).merge(y).attr("d",wa(_a().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(fs).call(Dt(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 k=w.select(".title-x").attr("transform",`translate(${l/2}, ${o+2.25*this.rem})`);k.select("tspan.z").text(this.zRoc?"z":""),k.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(fs).call(Ut(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 _=w.select(".title-y").attr("transform",`translate(${-2*this.rem}, ${o/2})rotate(-90)`);_.select("tspan.z").text(this.zRoc?"z":""),_.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)),g.append("g").classed("content",!0);const S=v.select(".content"),M=S.selectAll(".curve-iso-d").data(this.isoDArray,t=>t.name),A=M.enter().append("path").classed("curve-iso-d",!0).attr("clip-path","url(#clip-roc-space)").merge(M);this.firstUpdate||t.has("zRoc")?A.transition().duration(this.drag?0:2*c).ease(fs).attr("d",t=>f(Tt(h.range()[0],h.range()[1]+1,1).map(e=>({far:this.zRoc?to.zfar2Far(h.invert(e)):h.invert(e),hr:this.zRoc?to.dFar2Hr(t.d,to.zfar2Far(h.invert(e)),t.s):to.dFar2Hr(t.d,h.invert(e),t.s)})))):this.sdt?A.transition().duration(this.drag?0:c).ease(fs).attrTween("d",(t,e,r)=>{const n=r[e];n.hr=void 0,n.far=void 0;const s=hn(void 0!==n.d?n.d:t.d,t.d),i=hn(void 0!==n.s?n.s:t.s,t.s);return t=>{n.d=s(t),n.s=i(t);const e=Tt(h.range()[0],h.range()[1]+1,1).map(t=>({far:this.zRoc?to.zfar2Far(h.invert(t)):h.invert(t),hr:this.zRoc?to.dFar2Hr(n.d,to.zfar2Far(h.invert(t)),n.s):to.dFar2Hr(n.d,h.invert(t),n.s)}));return f(e)}}):A.transition().duration(this.drag?0:c).ease(fs).attrTween("d",(t,e,r)=>{const n=r[e];n.d=void 0,n.s=void 0;const s=hn(void 0!==n.hr?n.hr:t.hr,t.hr),i=hn(void 0!==n.far?n.far:t.far,t.far);return e=>{n.hr=s(e),n.far=i(e);const r=Tt(h.range()[0],h.range()[1]+1,1).map(e=>({far:this.zRoc?to.zfar2Far(h.invert(e)):h.invert(e),hr:this.zRoc?to.dFar2Hr(to.hrFar2D(n.hr,n.far,t.s),to.zfar2Far(h.invert(e)),t.s):to.dFar2Hr(to.hrFar2D(n.hr,n.far,t.s),h.invert(e),t.s)}));return f(r)}}),M.exit().remove();const E=S.selectAll(".curve-iso-c").data(this.isoCArray,t=>t.name),N=E.enter().append("path").classed("curve-iso-c",!0).attr("clip-path","url(#clip-roc-space)").merge(E);this.firstUpdate||t.has("zRoc")?N.transition().duration(this.drag?0:2*c).ease(fs).attr("d",t=>f(Tt(h.range()[0],h.range()[1]+1,1).map(e=>({far:this.zRoc?to.zfar2Far(h.invert(e)):h.invert(e),hr:this.zRoc?to.cFar2Hr(t.c,to.zfar2Far(h.invert(e)),t.s):to.cFar2Hr(t.c,h.invert(e),t.s)})))):this.sdt?N.transition().duration(this.drag?0:c).ease(fs).attrTween("d",(t,e,r)=>{const n=r[e];n.hr=void 0,n.far=void 0;const s=hn(void 0!==n.c?n.c:t.c,t.c),i=hn(void 0!==n.s?n.s:t.s,t.s);return t=>{n.c=s(t),n.s=i(t);const e=Tt(h.range()[0],h.range()[1]+1,1).map(t=>({far:this.zRoc?to.zfar2Far(h.invert(t)):h.invert(t),hr:this.zRoc?to.cFar2Hr(n.c,to.zfar2Far(h.invert(t)),n.s):to.cFar2Hr(n.c,h.invert(t),n.s)}));return f(e)}}):N.transition().duration(this.drag?0:c).ease(fs).attrTween("d",(t,e,r)=>{const n=r[e];n.c=void 0,n.s=void 0;const s=hn(void 0!==n.hr?n.hr:t.hr,t.hr),i=hn(void 0!==n.far?n.far:t.far,t.far);return e=>{n.hr=s(e),n.far=i(e);const r=Tt(h.range()[0],h.range()[1]+1,1).map(e=>({far:this.zRoc?to.zfar2Far(h.invert(e)):h.invert(e),hr:this.zRoc?to.cFar2Hr(to.hrFar2C(n.hr,n.far,t.s),to.zfar2Far(h.invert(e)),t.s):to.cFar2Hr(to.hrFar2C(n.hr,n.far,t.s),h.invert(e),t.s)}));return f(r)}}),E.exit().remove();const T=S.selectAll(".point").data(this.pointArray,t=>t.name),C=T.enter().append("g").classed("point",!0);C.append("circle").classed("circle touch",!0),C.append("text").classed("label",!0);const R=C.merge(T);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?to.hr2Zhr(e.hr):e.hr,n=this.zRoc?to.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?to.zhr2Hr(r):r,n=this.zRoc?to.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(fs).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?to.far2Zfar(t.far):t.far)},\n ${u(this.zRoc?to.hr2Zhr(t.hr):t.hr)}\n )`}):this.sdt?R.transition().duration(this.drag?0:c).ease(fs).attrTween("transform",(t,e,r)=>{const n=r[e],s=hn(void 0!==n.d?n.d:t.d,t.d),i=hn(void 0!==n.c?n.c:t.c,t.c),a=hn(void 0!==n.s?n.s:t.s,t.s);return t=>(n.d=s(t),n.c=i(t),n.s=a(t),`translate(\n ${h(this.zRoc?to.far2Zfar(to.dC2Far(n.d,n.c,n.s)):to.dC2Far(n.d,n.c,n.s))},\n ${u(this.zRoc?to.hr2Zhr(to.dC2Hr(n.d,n.c,n.s)):to.dC2Hr(n.d,n.c,n.s))}\n )`)}):R.transition().duration(this.drag?0:c).ease(fs).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?to.far2Zfar(t.far):t.far)},\n ${u(this.zRoc?to.hr2Zhr(t.hr):t.hr)}\n )`}),T.exit().remove(),this.drag=!1,this.sdt=!1,this.firstUpdate=!1}}customElements.define("roc-space",Ko);class Zo extends(Xa(Za)){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}}}constructor(){super(),this.colors=["all","outcome","response","stimulus","none"],this.color="all",this.distributions=!1,this.threshold=!1,this.unequal=!1,this.sensitivity=!1,this.bias=!1,this.variance=!1,this.histogram=!1,this.d=to.d.DEFAULT,this.c=to.c.DEFAULT,this.s=to.s.DEFAULT,this.binWidth=.25,this.signals=["present","absent"],this.responses=["present","absent"],this.trials=[],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,s){const i={new:!0,paused:!1};i.trial=t,i.signal=e,i.duration=r,i.wait=n,i.iti=s,i.evidence=Ja.normal.sample(0,1),this.alignTrial(i),this.trials.push(i),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=to.dC2Far(this.d,this.c,this.s),this.hr=to.dC2Hr(this.d,this.c,this.s),this.muN=to.d2MuN(this.d,this.s),this.muS=to.d2MuS(this.d,this.s),this.l=to.c2L(this.c,this.s),this.hS=to.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,o`
|
|
1519
|
+
`]}render(){return V``}willUpdate(){this.alignState()}update(t){if(super.update(t),Number.isNaN(this.width)||Number.isNaN(this.height)||Number.isNaN(this.rem))return;const e=this.width,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=qa().domain(this.zRoc?[-3,3]:[0,1]).range([0,l]);this.xScale=h;const u=qa().domain(this.zRoc?[3,-3]:[1,0]).range([0,o]);this.yScale=u;const d=br().subject((t,e)=>({x:this.xScale(this.zRoc?to.far2Zfar(e.far):e.far),y:this.yScale(this.zRoc?to.hr2Zhr(e.hr):e.hr)})).on("start",t=>{ir(t.currentTarget).classed("dragging",!0)}).on("drag",(t,e)=>{this.drag=!0;const r=this.zRoc?to.zfar2Far(this.xScale.invert(t.x)):this.xScale.invert(t.x),n=this.zRoc?to.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=>{ir(t.currentTarget).classed("dragging",!1)}),f=Ua().x(t=>h(this.zRoc?to.far2Zfar(t.far):t.far)).y(t=>u(this.zRoc?to.hr2Zhr(t.hr):t.hr)),p=ir(this.renderRoot).selectAll(".main").data([{width:this.width,height:this.height,rem:this.rem}]),m=p.enter().append("svg").classed("main",!0).each((t,e,r)=>{lt(Za.svgFilters,r[e])}),b=m.merge(p).attr("viewBox",`0 0 ${n} ${n}`),g=m.append("g").classed("plot",!0),v=b.select(".plot").attr("transform",`translate(${a}, ${i})`);g.append("clipPath").attr("id","clip-roc-space").append("rect"),v.select("clipPath rect").attr("height",o+1).attr("width",l+1);const y=g.append("g").classed("underlayer",!0),w=v.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?to.zhr2Hr(i/t*6-3):i/t,a=this.zRoc?to.zfar2Far(6*(1-r/t)-3):1-r/t;e[n]="bias"===this.contour?to.hrFar2C(s,a,this.s):"sensitivity"===this.contour?to.hrFar2D(s,a,this.s):"accuracy"===this.contour?to.hrFar2Acc(s,a):null}const r="bias"===this.contour?Tt(-3,3,.25):"sensitivity"===this.contour?Tt(-6,6,.5):"accuracy"===this.contour?Tt(0,1,.05):null,n=Ti().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=qa().domain(gt(r)).interpolate(()=>tn(Lo(i).hex(),Lo(s).hex())),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(fi).attrTween("d",(e,r,n)=>function(t,e,r){var n=vo(t),i=vo(e),s="object"===io(r)?r:{excludeSegment:r,snapEndsToInput:!0},a=s.excludeSegment,o=s.snapEndsToInput;if(!n.length&&!i.length)return function(){return""};var l=yo(n,i,{excludeSegment:a,snapEndsToInput:o});return function(t){if(1===t&&o)return null==e?"":e;var r,n="",i=lo(l(t));try{for(i.s();!(r=i.n()).done;)n+=bo(r.value)}catch(t){i.e(t)}finally{i.f()}return n}}(ir(n[r]).attr("d"),wa(_a().scale(l/t))(e))).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,f=[];for(let e=.5,r=0;e<d;e+=1,r+=4)f[r]="bias"===this.contour?-(e/t*6-3):"sensitivity"===this.contour?e/t*12-6:"accuracy"===this.contour?e/t:null,f[r+1]=f[r],f[r+2]=f[r],f[r+3]=f[r];const p=Ti().size([4,d]).thresholds(r),m=qa().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]),g=b.enter().append("g").classed("legend-contour",!0),v=g.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(),g.append("g").classed("axis-contour",!0),v.select(".axis-contour").call(Ut(m).ticks(7).tickSize(0)).attr("font-size",null).attr("font-family",null);const y=v.selectAll(".contour").data(p(f));y.enter().append("path").classed("contour",!0).merge(y).attr("d",wa(_a().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(fi).call(Dt(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(fi).call(Ut(u)).attr("font-size",null).attr("font-family",null).selectAll("line, path").attr("stroke",null);const k=y.append("text").classed("title-y",!0).attr("text-anchor","middle");k.append("tspan").classed("z math-var",!0),k.append("tspan").classed("name",!0);const _=w.select(".title-y").attr("transform",`translate(${-2*this.rem}, ${o/2})rotate(-90)`);_.select("tspan.z").text(this.zRoc?"z":""),_.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)),g.append("g").classed("content",!0);const S=v.select(".content"),M=S.selectAll(".curve-iso-d").data(this.isoDArray,t=>t.name),A=M.enter().append("path").classed("curve-iso-d",!0).attr("clip-path","url(#clip-roc-space)").merge(M);this.firstUpdate||t.has("zRoc")?A.transition().duration(this.drag?0:2*c).ease(fi).attr("d",t=>f(Tt(h.range()[0],h.range()[1]+1,1).map(e=>({far:this.zRoc?to.zfar2Far(h.invert(e)):h.invert(e),hr:this.zRoc?to.dFar2Hr(t.d,to.zfar2Far(h.invert(e)),t.s):to.dFar2Hr(t.d,h.invert(e),t.s)})))):this.sdt?A.transition().duration(this.drag?0:c).ease(fi).attrTween("d",(t,e,r)=>{const n=r[e];n.hr=void 0,n.far=void 0;const i=hn(void 0!==n.d?n.d:t.d,t.d),s=hn(void 0!==n.s?n.s:t.s,t.s);return t=>{n.d=i(t),n.s=s(t);const e=Tt(h.range()[0],h.range()[1]+1,1).map(t=>({far:this.zRoc?to.zfar2Far(h.invert(t)):h.invert(t),hr:this.zRoc?to.dFar2Hr(n.d,to.zfar2Far(h.invert(t)),n.s):to.dFar2Hr(n.d,h.invert(t),n.s)}));return f(e)}}):A.transition().duration(this.drag?0:c).ease(fi).attrTween("d",(t,e,r)=>{const n=r[e];n.d=void 0,n.s=void 0;const i=hn(void 0!==n.hr?n.hr:t.hr,t.hr),s=hn(void 0!==n.far?n.far:t.far,t.far);return e=>{n.hr=i(e),n.far=s(e);const r=Tt(h.range()[0],h.range()[1]+1,1).map(e=>({far:this.zRoc?to.zfar2Far(h.invert(e)):h.invert(e),hr:this.zRoc?to.dFar2Hr(to.hrFar2D(n.hr,n.far,t.s),to.zfar2Far(h.invert(e)),t.s):to.dFar2Hr(to.hrFar2D(n.hr,n.far,t.s),h.invert(e),t.s)}));return f(r)}}),M.exit().remove();const E=S.selectAll(".curve-iso-c").data(this.isoCArray,t=>t.name),N=E.enter().append("path").classed("curve-iso-c",!0).attr("clip-path","url(#clip-roc-space)").merge(E);this.firstUpdate||t.has("zRoc")?N.transition().duration(this.drag?0:2*c).ease(fi).attr("d",t=>f(Tt(h.range()[0],h.range()[1]+1,1).map(e=>({far:this.zRoc?to.zfar2Far(h.invert(e)):h.invert(e),hr:this.zRoc?to.cFar2Hr(t.c,to.zfar2Far(h.invert(e)),t.s):to.cFar2Hr(t.c,h.invert(e),t.s)})))):this.sdt?N.transition().duration(this.drag?0:c).ease(fi).attrTween("d",(t,e,r)=>{const n=r[e];n.hr=void 0,n.far=void 0;const i=hn(void 0!==n.c?n.c:t.c,t.c),s=hn(void 0!==n.s?n.s:t.s,t.s);return t=>{n.c=i(t),n.s=s(t);const e=Tt(h.range()[0],h.range()[1]+1,1).map(t=>({far:this.zRoc?to.zfar2Far(h.invert(t)):h.invert(t),hr:this.zRoc?to.cFar2Hr(n.c,to.zfar2Far(h.invert(t)),n.s):to.cFar2Hr(n.c,h.invert(t),n.s)}));return f(e)}}):N.transition().duration(this.drag?0:c).ease(fi).attrTween("d",(t,e,r)=>{const n=r[e];n.c=void 0,n.s=void 0;const i=hn(void 0!==n.hr?n.hr:t.hr,t.hr),s=hn(void 0!==n.far?n.far:t.far,t.far);return e=>{n.hr=i(e),n.far=s(e);const r=Tt(h.range()[0],h.range()[1]+1,1).map(e=>({far:this.zRoc?to.zfar2Far(h.invert(e)):h.invert(e),hr:this.zRoc?to.cFar2Hr(to.hrFar2C(n.hr,n.far,t.s),to.zfar2Far(h.invert(e)),t.s):to.cFar2Hr(to.hrFar2C(n.hr,n.far,t.s),h.invert(e),t.s)}));return f(r)}}),E.exit().remove();const T=S.selectAll(".point").data(this.pointArray,t=>t.name),C=T.enter().append("g").classed("point",!0);C.append("circle").classed("circle touch",!0),C.append("text").classed("label",!0);const P=C.merge(T);P.select("text").text(t=>t.label),(this.firstUpdate||t.has("interactive"))&&(this.interactive?P.attr("tabindex",0).classed("interactive",!0).call(d).on("keydown",(t,e)=>{if(["ArrowUp","ArrowDown","ArrowRight","ArrowLeft"].includes(t.key)){let r=this.zRoc?to.hr2Zhr(e.hr):e.hr,n=this.zRoc?to.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?to.zhr2Hr(r):r,n=this.zRoc?to.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()}}):P.attr("tabindex",null).classed("interactive",!1).on("drag",null).on("keydown",null)),this.firstUpdate||t.has("zRoc")?P.transition().duration(this.drag?0:2*c).ease(fi).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?to.far2Zfar(t.far):t.far)},\n ${u(this.zRoc?to.hr2Zhr(t.hr):t.hr)}\n )`}):this.sdt?P.transition().duration(this.drag?0:c).ease(fi).attrTween("transform",(t,e,r)=>{const n=r[e],i=hn(void 0!==n.d?n.d:t.d,t.d),s=hn(void 0!==n.c?n.c:t.c,t.c),a=hn(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?to.far2Zfar(to.dC2Far(n.d,n.c,n.s)):to.dC2Far(n.d,n.c,n.s))},\n ${u(this.zRoc?to.hr2Zhr(to.dC2Hr(n.d,n.c,n.s)):to.dC2Hr(n.d,n.c,n.s))}\n )`)}):P.transition().duration(this.drag?0:c).ease(fi).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?to.far2Zfar(t.far):t.far)},\n ${u(this.zRoc?to.hr2Zhr(t.hr):t.hr)}\n )`}),T.exit().remove(),this.drag=!1,this.sdt=!1,this.firstUpdate=!1}}customElements.define("roc-space",Ko);class Zo extends(Xa(Za)){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}}}constructor(){super(),this.colors=["all","outcome","response","stimulus","none"],this.color="all",this.distributions=!1,this.threshold=!1,this.unequal=!1,this.sensitivity=!1,this.bias=!1,this.variance=!1,this.histogram=!1,this.d=to.d.DEFAULT,this.c=to.c.DEFAULT,this.s=to.s.DEFAULT,this.binWidth=.25,this.signals=["present","absent"],this.responses=["present","absent"],this.trials=[],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=Ja.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=to.dC2Far(this.d,this.c,this.s),this.hr=to.dC2Hr(this.d,this.c,this.s),this.muN=to.d2MuN(this.d,this.s),this.muS=to.d2MuS(this.d,this.s),this.l=to.c2L(this.c,this.s),this.hS=to.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,o`
|
|
1552
1520
|
:host {
|
|
1553
1521
|
display: inline-block;
|
|
1554
1522
|
|
|
@@ -1586,16 +1554,16 @@ const La=t=>t??K;customElements.define("decidables-slider",class extends Ha{stat
|
|
|
1586
1554
|
.signal.interactive,
|
|
1587
1555
|
.threshold.interactive {
|
|
1588
1556
|
cursor: ew-resize;
|
|
1557
|
+
outline: none;
|
|
1589
1558
|
|
|
1590
1559
|
filter: url("#shadow-2");
|
|
1591
|
-
outline: none;
|
|
1592
1560
|
}
|
|
1593
1561
|
|
|
1594
1562
|
.signal.unequal {
|
|
1595
1563
|
cursor: ns-resize;
|
|
1564
|
+
outline: none;
|
|
1596
1565
|
|
|
1597
1566
|
filter: url("#shadow-2");
|
|
1598
|
-
outline: none;
|
|
1599
1567
|
}
|
|
1600
1568
|
|
|
1601
1569
|
.signal.interactive.unequal {
|
|
@@ -1623,10 +1591,10 @@ const La=t=>t??K;customElements.define("decidables-slider",class extends Ha{stat
|
|
|
1623
1591
|
transform: translateY(0);
|
|
1624
1592
|
}
|
|
1625
1593
|
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1594
|
+
.noise.interactive:focus-visible,
|
|
1595
|
+
.signal.interactive:focus-visible,
|
|
1596
|
+
.signal.unequal:focus-visible,
|
|
1597
|
+
.threshold.interactive:focus-visible {
|
|
1630
1598
|
filter: url("#shadow-8");
|
|
1631
1599
|
|
|
1632
1600
|
/* HACK: This gets Safari to correctly apply the filter! */
|
|
@@ -1791,11 +1759,11 @@ const La=t=>t??K;customElements.define("decidables-slider",class extends Ha{stat
|
|
|
1791
1759
|
|
|
1792
1760
|
@media (pointer: coarse) {
|
|
1793
1761
|
.interactive .touch {
|
|
1794
|
-
stroke-linecap: round;
|
|
1795
1762
|
stroke-width: 12;
|
|
1763
|
+
stroke-linecap: round;
|
|
1796
1764
|
}
|
|
1797
1765
|
}
|
|
1798
|
-
`]}render(){return V``}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}))}willUpdate(){this.alignState()}update(t){if(super.update(t),Number.isNaN(this.width)||Number.isNaN(this.height)||Number.isNaN(this.rem))return;const e=this.width,r=this.height;let n,s;e/r>1.8?(s=r,n=1.8*s):(n=e,s=n/1.8);const i=2*this.rem,a=3*this.rem,o=3*this.rem,l=s-(i+a),c=n-(o+(this.histogram&&this.distributions?3:.75)*this.rem),h=parseInt(this.getComputedStyleValue("---transition-duration"),10),u=qa().domain([-3,3]).range([0,c]),d=qa().domain([.5,0]).range([0,l]),f=u(this.binWidth)-u(0),p=qa().domain([l/f,0]).range([0,l]),m=br().subject(()=>({x:u(this.l),y:0})).on("start",t=>{sr(t.currentTarget).classed("dragging",!0)}).on("drag",t=>{this.drag=!0;const e=u.invert(t.x),r=to.l2C(e,this.s);this.c=r<to.c.MIN?to.c.MIN:r>to.c.MAX?to.c.MAX:r,this.alignState(),this.sendEvent()}).on("end",t=>{sr(t.currentTarget).classed("dragging",!1)}),b=br().subject(()=>({x:u(this.muN),y:0})).on("start",t=>{sr(t.currentTarget).classed("dragging",!0)}).on("drag",t=>{this.drag=!0;const e=u.invert(t.x),r=to.muN2D(e,this.s);this.d=r<to.d.MIN?to.d.MIN:r>to.d.MAX?to.d.MAX:r,this.alignState(),this.sendEvent()}).on("end",t=>{sr(t.currentTarget).classed("dragging",!1)}),g=br().subject(()=>({x:u(this.muS),y:d(this.hS)})).on("start",(t,e)=>{sr(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));let n=this.hS;if(this.unequal&&(n=d.invert(t.y)),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){const t=to.h2S(n);this.s=t<to.s.MIN?to.s.MIN:t>to.s.MAX?to.s.MAX:t;const e=to.l2C(this.l,this.s);this.c=e<to.c.MIN?to.c.MIN:e>to.c.MAX?to.c.MAX:e}const s=to.muS2D(r,this.s);this.d=s<to.d.MIN?to.d.MIN:s>to.d.MAX?to.d.MAX:s,this.alignState(),this.sendEvent()}).on("end",t=>{sr(t.currentTarget).classed("dragging",!1)}),v=Ua().x(t=>u(t.e)).y(t=>d(t.p)),y=sr(this.renderRoot).selectAll(".main").data([{width:this.width,height:this.height,rem:this.rem}]),w=y.enter().append("svg").classed("main",!0).each((t,e,r)=>{lt(Za.svgFilters,r[e])}),x=w.merge(y).attr("viewBox",`0 0 ${n} ${s}`),k=w.append("g").classed("plot",!0),$=x.select(".plot").attr("transform",`translate(${o}, ${i})`),_=k.append("g").classed("underlayer",!0),S=$.select(".underlayer");_.append("rect").classed("background",!0),S.select(".background").attr("height",l).attr("width",c),_.append("g").classed("axis-x",!0);S.select(".axis-x").attr("transform",`translate(0, ${l})`).call(Dt(u)).attr("font-size",null).attr("font-family",null).selectAll("line, path").attr("stroke",null),_.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 M=S.selectAll(".axis-y").data(this.distributions?[{}]:[]);M.enter().append("g").classed("axis-y",!0).merge(M).call(Ut(d).ticks(5)).attr("font-size",null).attr("font-family",null).selectAll("line, path").attr("stroke",null),M.exit().remove();const A=S.selectAll(".title-y").data(this.distributions?[{}]:[]);A.enter().append("text").classed("title-y",!0).attr("text-anchor","middle").text("Probability").merge(A).attr("transform",`translate(${-2*this.rem}, ${l/2})rotate(-90)`),A.exit().remove();const E=S.selectAll(".axis-y2").data(this.histogram?[{}]:[]);var N;E.enter().append("g").classed("axis-y2",!0).merge(E).attr("transform",this.distributions?`translate(${c}, 0)`:"").call(this.distributions?(N=p,It(2,N)).ticks(10):Ut(p).ticks(10)).attr("font-size",null).attr("font-family",null).selectAll("line, path").attr("stroke",null),E.exit().remove();const T=S.selectAll(".title-y2").data(this.histogram?[{}]:[]);T.enter().append("text").classed("title-y2",!0).attr("text-anchor","middle").text("Count").merge(T).attr("transform",this.distributions?`translate(${c+1.5*this.rem}, ${l/2})rotate(90)`:`translate(${-1.5*this.rem}, ${l/2})rotate(-90)`),T.exit().remove(),k.append("g").classed("content",!0);const C=$.select(".content"),R=C.selectAll(".signal-noise").data(this.distributions?[{}]:[]),P=R.enter().append("g").classed("signal-noise",!0),q=P.merge(R);R.exit().remove();const F=P.append("g").classed("noise",!0),z=q.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}const r=to.muN2D(e,this.s);this.d=r<to.d.MIN?to.d.MIN:r>to.d.MAX?to.d.MAX:r,this.alignState(),this.sendEvent(),t.preventDefault()}}:null);(this.firstUpdate||t.has("interactive"))&&(this.interactive?z.call(b):z.on(".drag",null)),F.append("path").classed("curve-cr",!0),z.select(".curve-cr").transition().duration(this.drag?0:h).ease(fs).attrTween("d",(t,e,r)=>{const n=r[e],s=hn(void 0!==n.d?n.d:this.d,this.d),i=hn(void 0!==n.c?n.c:this.c,this.c),a=hn(void 0!==n.s?n.s:this.s,this.s);return t=>{n.d=s(t),n.c=i(t),n.s=a(t);const e=Tt(u.domain()[0],to.c2L(n.c,n.s),.05).map(t=>({e:t,p:Ja.normal.pdf(t,to.d2MuN(n.d,n.s),1)}));return e.push({e:to.c2L(n.c,n.s),p:Ja.normal.pdf(to.c2L(n.c,n.s),to.d2MuN(n.d,n.s),1)}),e.push({e:to.c2L(n.c,n.s),p:0}),e.push({e:u.domain()[0],p:0}),v(e)}}),F.append("path").classed("curve-fa",!0),z.select(".curve-fa").transition().duration(this.drag?0:h).ease(fs).attrTween("d",(t,e,r)=>{const n=r[e],s=hn(void 0!==n.d?n.d:this.d,this.d),i=hn(void 0!==n.c?n.c:this.c,this.c),a=hn(void 0!==n.s?n.s:this.s,this.s);return t=>{n.d=s(t),n.c=i(t),n.s=a(t);const e=Tt(to.c2L(n.c,n.s),u.domain()[1],.05).map(t=>({e:t,p:Ja.normal.pdf(t,to.d2MuN(n.d,n.s),1)}));return e.push({e:u.domain()[1],p:Ja.normal.pdf(u.domain()[1],to.d2MuN(n.d,n.s),1)}),e.push({e:u.domain()[1],p:0}),e.push({e:to.c2L(n.c,n.s),p:0}),v(e)}}),F.append("path").classed("curve-noise",!0),z.select(".curve-noise").transition().duration(this.drag?0:h).ease(fs).attrTween("d",(t,e,r)=>{const n=r[e],s=hn(void 0!==n.d?n.d:this.d,this.d),i=hn(void 0!==n.s?n.s:this.s,this.s);return t=>{n.d=s(t),n.s=i(t);const e=Tt(u.domain()[0],u.domain()[1],.05).map(t=>({e:t,p:Ja.normal.pdf(t,to.d2MuN(n.d,n.s),1)}));return e.push({e:u.domain()[1],p:Ja.normal.pdf(u.domain()[1],to.d2MuN(n.d,n.s),1)}),v(e)}});const O=P.append("g").classed("signal",!0),I=q.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}const r=to.muS2D(e,this.s);this.d=r<to.d.MIN?to.d.MIN:r>to.d.MAX?to.d.MAX:r,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<0?0:e;const r=to.h2S(e);this.s=r<to.s.MIN?to.s.MIN:r>to.s.MAX?to.s.MAX:r,this.d=to.muN2D(this.muN,this.s),this.c=to.l2C(this.l,this.s),this.alignState(),this.sendEvent(),t.preventDefault()}}:null);(this.firstUpdate||t.has("interactive")||t.has("unequal"))&&(this.interactive||this.unequal?I.call(g):I.on(".drag",null)),O.append("path").classed("curve-m",!0),I.select(".curve-m").transition().duration(this.drag?0:h).ease(fs).attrTween("d",(t,e,r)=>{const n=r[e],s=hn(void 0!==n.d?n.d:this.d,this.d),i=hn(void 0!==n.c?n.c:this.c,this.c),a=hn(void 0!==n.s?n.s:this.s,this.s);return t=>{n.d=s(t),n.c=i(t),n.s=a(t);const e=Tt(u.domain()[0],to.c2L(n.c,n.s),.05).map(t=>({e:t,p:Ja.normal.pdf(t,to.d2MuS(n.d,n.s),n.s)}));return e.push({e:to.c2L(n.c,n.s),p:Ja.normal.pdf(to.c2L(n.c,n.s),to.d2MuS(n.d,n.s),n.s)}),e.push({e:to.c2L(n.c,n.s),p:0}),e.push({e:u.domain()[0],p:0}),v(e)}}),O.append("path").classed("curve-h",!0),I.select(".curve-h").transition().duration(this.drag?0:h).ease(fs).attrTween("d",(t,e,r)=>{const n=r[e],s=hn(void 0!==n.d?n.d:this.d,this.d),i=hn(void 0!==n.c?n.c:this.c,this.c),a=hn(void 0!==n.s?n.s:this.s,this.s);return t=>{n.d=s(t),n.c=i(t),n.s=a(t);const e=Tt(to.c2L(n.c,n.s),u.domain()[1],.05).map(t=>({e:t,p:Ja.normal.pdf(t,to.d2MuS(n.d,n.s),n.s)}));return e.push({e:u.domain()[1],p:Ja.normal.pdf(u.domain()[1],to.d2MuS(n.d,n.s),n.s)}),e.push({e:u.domain()[1],p:0}),e.push({e:to.c2L(n.c,n.s),p:0}),v(e)}}),O.append("path").classed("curve-signal",!0),I.select(".curve-signal").transition().duration(this.drag?0:h).ease(fs).attrTween("d",(t,e,r)=>{const n=r[e],s=hn(void 0!==n.d?n.d:this.d,this.d),i=hn(void 0!==n.s?n.s:this.s,this.s);return t=>{n.d=s(t),n.s=i(t);const e=Tt(u.domain()[0],u.domain()[1],.05).map(t=>({e:t,p:Ja.normal.pdf(t,to.d2MuS(n.d,n.s),n.s)}));return e.push({e:u.domain()[1],p:Ja.normal.pdf(u.domain()[1],to.d2MuS(n.d,n.s),n.s)}),v(e)}});const D=C.selectAll(".measure-d").data(this.sensitivity?[{}]:[]),U=D.enter().append("g").classed("measure-d",!0);U.append("line").classed("line",!0),U.append("line").classed("cap-left",!0),U.append("line").classed("cap-right",!0);const j=U.append("text").classed("label",!0);j.append("tspan").classed("d math-var",!0).text("d′"),j.append("tspan").classed("equals",!0).text(" = "),j.append("tspan").classed("value",!0);const H=U.merge(D);H.select(".line").transition().duration(this.drag?0:h).ease(fs).attr("x1",u(this.muN)).attr("y1",d(.43)).attr("x2",u(this.muS)).attr("y2",d(.43)),H.select(".cap-left").transition().duration(this.drag?0:h).ease(fs).attr("x1",u(this.muN)).attr("y1",d(.43)+5).attr("x2",u(this.muN)).attr("y2",d(.43)-5),H.select(".cap-right").transition().duration(this.drag?0:h).ease(fs).attr("x1",u(this.muS)).attr("y1",d(.43)+5).attr("x2",u(this.muS)).attr("y2",d(.43)-5);H.select(".label").transition().duration(this.drag?0:h).ease(fs).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],s=hn(void 0!==n.d?n.d:this.d,this.d);return t=>{n.d=s(t),sr(n).text(Bs(".3")(n.d))}}),D.exit().remove();const L=C.selectAll(".measure-c").data(this.bias?[{}]:[]),V=L.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 X=V.merge(L);X.select(".line").transition().duration(this.drag?0:h).ease(fs).attr("x1",u(this.l)).attr("y1",d(.47)).attr("x2",u(0)).attr("y2",d(.47)),X.select(".cap-zero").transition().duration(this.drag?0:h).ease(fs).attr("x1",u(0)).attr("y1",d(.47)+5).attr("x2",u(0)).attr("y2",d(.47)-5);X.select(".label").transition().duration(this.drag?0:h).ease(fs).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],s=hn(void 0!==n.c?n.c:this.c,this.c);return t=>{n.c=s(t),sr(n).text(Bs(".3")(n.c))}}),L.exit().remove();const K=C.selectAll(".measure-s").data(this.variance?[{}]:[]),Z=K.enter().append("g").classed("measure-s",!0);Z.append("line").classed("line",!0),Z.append("line").classed("cap-left",!0),Z.append("line").classed("cap-right",!0);const W=Z.append("text").classed("label",!0);W.append("tspan").classed("s math-var",!0).text("σ"),W.append("tspan").classed("equals",!0).text(" = "),W.append("tspan").classed("value",!0);const Y=Z.merge(K);Y.select(".line").transition().duration(this.drag?0:h).ease(fs).attr("x1",u(this.muS-this.s)).attr("y1",d(Ja.normal.pdf(this.s,0,this.s))+10/this.s).attr("x2",u(this.muS+this.s)).attr("y2",d(Ja.normal.pdf(this.s,0,this.s))+10/this.s),Y.select(".cap-left").transition().duration(this.drag?0:h).ease(fs).attr("x1",u(this.muS-this.s)).attr("y1",d(Ja.normal.pdf(this.s,0,this.s))+10/this.s+5).attr("x2",u(this.muS-this.s)).attr("y2",d(Ja.normal.pdf(this.s,0,this.s))+10/this.s-5),Y.select(".cap-right").transition().duration(this.drag?0:h).ease(fs).attr("x1",u(this.muS+this.s)).attr("y1",d(Ja.normal.pdf(this.s,0,this.s))+10/this.s+5).attr("x2",u(this.muS+this.s)).attr("y2",d(Ja.normal.pdf(this.s,0,this.s))+10/this.s-5);Y.select(".label").transition().duration(this.drag?0:h).ease(fs).attr("x",u(this.muS)).attr("y",d(Ja.normal.pdf(this.s,0,this.s))+10/this.s-3).select(".value").tween("text",(t,e,r)=>{const n=r[e],s=hn(void 0!==n.s?n.s:this.s,this.s);return t=>{n.s=s(t),sr(n).text(Bs(".3")(n.s))}}),K.exit().remove();const G=C.selectAll(".threshold").data(this.threshold?[{}]:[]),Q=G.enter().append("g").classed("threshold",!0);Q.append("line").classed("line",!0),Q.append("line").classed("line touch",!0),Q.append("circle").classed("handle touch",!0);const J=Q.merge(G).attr("tabindex",this.interactive?0:null).classed("interactive",this.interactive);(this.firstUpdate||t.has("interactive"))&&(this.interactive?J.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}const r=to.l2C(e,this.s);this.c=r<to.c.MIN?to.c.MIN:r>to.c.MAX?to.c.MAX:r,this.alignState(),this.sendEvent(),t.preventDefault()}}):J.on("drag",null).on("keydown",null)),J.select(".line").transition().duration(this.drag?0:h).ease(fs).attr("x1",u(this.l)).attr("y1",d(0)).attr("x2",u(this.l)).attr("y2",d(.54)),J.select(".line.touch").transition().duration(this.drag?0:h).ease(fs).attr("x1",u(this.l)).attr("y1",d(0)).attr("x2",u(this.l)).attr("y2",d(.54)),J.select(".handle").transition().duration(this.drag?0:h).ease(fs).attr("cx",u(this.l)).attr("cy",d(.54)),G.exit().remove();const tt=C.selectAll(".histogram").data(this.histogram?[{}]:[]),et=tt.enter().append("g").classed("histogram",!0).merge(tt);if(tt.exit().remove(),this.histogram){const t=function(){var t=yt,e=gt,r=Nt;function n(n){Array.isArray(n)||(n=Array.from(n));var s,i,a,o=n.length,l=new Array(o);for(s=0;s<o;++s)l[s]=t(n[s],s,n);var c=e(l),h=c[0],u=c[1],d=r(l,h,u);if(!Array.isArray(d)){const t=u,r=+d;if(e===gt&&([h,u]=Et(h,u,r)),(d=Mt(h,u,r))[0]<=h&&(a=At(h,u,r)),d[d.length-1]>=u)if(t>=u&&e===gt){const t=At(h,u,r);isFinite(t)&&(t>0?u=(Math.floor(u/t)+1)*t:t<0&&(u=(Math.ceil(u*-t)+1)/-t))}else d.pop()}for(var f=d.length,p=0,m=f;d[p]<=h;)++p;for(;d[m-1]>u;)--m;(p||m<f)&&(d=d.slice(p,m),f=m-p);var b,g=new Array(f+1);for(s=0;s<=f;++s)(b=g[s]=[]).x0=s>0?d[s-1]:h,b.x1=s<f?d[s]:u;if(isFinite(a)){if(a>0)for(s=0;s<o;++s)null!=(i=l[s])&&h<=i&&i<=u&&g[Math.min(f,Math.floor((i-h)/a))].push(n[s]);else if(a<0)for(s=0;s<o;++s)if(null!=(i=l[s])&&h<=i&&i<=u){const t=Math.floor((h-i)*a);g[Math.min(f,t+(d[t]<=i))].push(n[s])}}else for(s=0;s<o;++s)null!=(i=l[s])&&h<=i&&i<=u&&g[bt(d,i,0,f)].push(n[s]);return g}return n.value=function(e){return arguments.length?(t="function"==typeof e?e:xt(e),n):t},n.domain=function(t){return arguments.length?(e="function"==typeof t?t:xt([t[0],t[1]]),n):e},n.thresholds=function(t){return arguments.length?(r="function"==typeof t?t:xt(Array.isArray(t)?wt.call(t):t),n):r},n}().value(t=>t.trueEvidence).domain(u.domain()).thresholds(Tt(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 s=0;s<e[t].length;s+=1)e[t][s].binValue=e[t].x0,e[t][s].binCount=s,0===t&&(r=s),t===e.length-1&&(n=s);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 s=et.selectAll(".trial").data(this.trials,t=>t.trial),i=s.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(s).attr("class",t=>`trial ${t.outcome}`).attr("width",f-3).attr("height",f-3),a=i.filter(t=>t.new&&!t.paused);if(!a.empty()){const t=a.attr("data-new-trial-ease-time"),e=e=>qa().domain([0,1]).range([t,1])(e),r=e=>r=>qa().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 s=n[e],i=tn(s.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||"all"===this.color?this.getComputedStyleValue(`---color-${t.outcome}`):this.getComputedStyleValue("---color-acc"));return t=>i(r(ds)(t))}).attrTween("fill",(t,e,n)=>{const s=n[e],i=tn(s.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||"all"===this.color?this.getComputedStyleValue(`---color-${t.outcome}-light`):this.getComputedStyleValue("---color-acc-light"));return t=>i(r(ds)(t))}).attrTween("x",(t,e,n)=>{const s=hn(n[e].getAttribute("x"),u(t.binValue)+1.5);return t=>s(r(fs)(t))}).attrTween("y",(t,e,n)=>{const s=hn(n[e].getAttribute("y"),d(0)+1.5-(t.binCount+1)*f);return t=>s(r(ds)(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=i.filter(t=>t.new&&t.paused);if(!o.empty()){const t=o.attr("data-new-trial-ease-time");o.transition().duration(h).ease(fs).attr("x",e=>hn(0,u(e.binValue)+1.5)(fs(t))).attr("y",e=>hn(0,d(0)+1.5-(e.binCount+1)*f)(ds(t))).attr("stroke",e=>tn(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||"all"===this.color?this.getComputedStyleValue(`---color-${e.outcome}`):this.getComputedStyleValue("---color-acc"))(ds(t))).attr("fill",e=>tn(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||"all"===this.color?this.getComputedStyleValue(`---color-${e.outcome}-light`):this.getComputedStyleValue("---color-acc-light"))(ds(t)))}i.filter(t=>!t.new).transition().duration(h).ease(fs).attr("x",t=>u(t.binValue)+1.5).attr("y",t=>d(0)+1.5-(t.binCount+1)*f).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||"all"===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||"all"===this.color?this.getComputedStyleValue(`---color-${t.outcome}-light`):this.getComputedStyleValue("---color-acc-light")),s.exit().transition().duration(h).ease(us).attrTween("stroke",(t,e,r)=>{const n=r[e],s=tn(n.getAttribute("stroke"),this.getComputedStyleValue("---color-acc"));return t=>s(ds(t))}).attrTween("fill",(t,e,r)=>{const n=r[e],s=tn(n.getAttribute("fill"),this.getComputedStyleValue("---color-acc-light"));return t=>s(ds(t))}).attrTween("x",(t,e,r)=>{const n=hn(r[e].getAttribute("x"),0);return t=>n(ds(t))}).attrTween("y",(t,e,r)=>{const n=hn(r[e].getAttribute("y"),0);return t=>n(fs(t))}).remove()}const rt=k.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=sr(this.renderRoot).select(".trial[data-new-trial-ease-time]");t.interrupt("new"),t.datum(t=>(t.paused=!0,t))}resumeTrial(){sr(this.renderRoot).select(".trial[data-new-trial-ease-time]").datum(t=>(t.paused=!1,t)),this.requestUpdate()}}customElements.define("sdt-model",Zo);class Wo extends Za{static get properties(){return{d:{attribute:"d",type:Number,reflect:!0},c:{attribute:"c",type:Number,reflect:!0},s:{attribute:"s",type:Number,reflect:!0}}}constructor(){super(),this.d=void 0,this.c=void 0,this.s=void 0}setSensitivity(t){this.d=+t.target.value,this.dispatchEvent(new CustomEvent("sdt-parameters-d",{detail:{d:this.d},bubbles:!0}))}setBias(t){this.c=+t.target.value,this.dispatchEvent(new CustomEvent("sdt-parameters-c",{detail:{c:this.c},bubbles:!0}))}setVariance(t){this.s=+t.target.value,this.dispatchEvent(new CustomEvent("sdt-parameters-s",{detail:{s:this.s},bubbles:!0}))}static get styles(){return[super.styles,o`
|
|
1766
|
+
`]}render(){return V``}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}))}willUpdate(){this.alignState()}update(t){if(super.update(t),Number.isNaN(this.width)||Number.isNaN(this.height)||Number.isNaN(this.rem))return;const e=this.width,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=qa().domain([-3,3]).range([0,c]),d=qa().domain([.5,0]).range([0,l]),f=u(this.binWidth)-u(0),p=qa().domain([l/f,0]).range([0,l]),m=br().subject(()=>({x:u(this.l),y:0})).on("start",t=>{ir(t.currentTarget).classed("dragging",!0)}).on("drag",t=>{this.drag=!0;const e=u.invert(t.x),r=to.l2C(e,this.s);this.c=r<to.c.MIN?to.c.MIN:r>to.c.MAX?to.c.MAX:r,this.alignState(),this.sendEvent()}).on("end",t=>{ir(t.currentTarget).classed("dragging",!1)}),b=br().subject(()=>({x:u(this.muN),y:0})).on("start",t=>{ir(t.currentTarget).classed("dragging",!0)}).on("drag",t=>{this.drag=!0;const e=u.invert(t.x),r=to.muN2D(e,this.s);this.d=r<to.d.MIN?to.d.MIN:r>to.d.MAX?to.d.MAX:r,this.alignState(),this.sendEvent()}).on("end",t=>{ir(t.currentTarget).classed("dragging",!1)}),g=br().subject(()=>({x:u(this.muS),y:d(this.hS)})).on("start",(t,e)=>{ir(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));let n=this.hS;if(this.unequal&&(n=d.invert(t.y)),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){const t=to.h2S(n);this.s=t<to.s.MIN?to.s.MIN:t>to.s.MAX?to.s.MAX:t;const e=to.l2C(this.l,this.s);this.c=e<to.c.MIN?to.c.MIN:e>to.c.MAX?to.c.MAX:e}const i=to.muS2D(r,this.s);this.d=i<to.d.MIN?to.d.MIN:i>to.d.MAX?to.d.MAX:i,this.alignState(),this.sendEvent()}).on("end",t=>{ir(t.currentTarget).classed("dragging",!1)}),v=Ua().x(t=>u(t.e)).y(t=>d(t.p)),y=ir(this.renderRoot).selectAll(".main").data([{width:this.width,height:this.height,rem:this.rem}]),w=y.enter().append("svg").classed("main",!0).each((t,e,r)=>{lt(Za.svgFilters,r[e])}),x=w.merge(y).attr("viewBox",`0 0 ${n} ${i}`),$=w.append("g").classed("plot",!0),k=x.select(".plot").attr("transform",`translate(${o}, ${s})`),_=$.append("g").classed("underlayer",!0),S=k.select(".underlayer");_.append("rect").classed("background",!0),S.select(".background").attr("height",l).attr("width",c),_.append("g").classed("axis-x",!0);S.select(".axis-x").attr("transform",`translate(0, ${l})`).call(Dt(u)).attr("font-size",null).attr("font-family",null).selectAll("line, path").attr("stroke",null),_.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 M=S.selectAll(".axis-y").data(this.distributions?[{}]:[]);M.enter().append("g").classed("axis-y",!0).merge(M).call(Ut(d).ticks(5)).attr("font-size",null).attr("font-family",null).selectAll("line, path").attr("stroke",null),M.exit().remove();const A=S.selectAll(".title-y").data(this.distributions?[{}]:[]);A.enter().append("text").classed("title-y",!0).attr("text-anchor","middle").text("Probability").merge(A).attr("transform",`translate(${-2*this.rem}, ${l/2})rotate(-90)`),A.exit().remove();const E=S.selectAll(".axis-y2").data(this.histogram?[{}]:[]);var N;E.enter().append("g").classed("axis-y2",!0).merge(E).attr("transform",this.distributions?`translate(${c}, 0)`:"").call(this.distributions?(N=p,It(2,N)).ticks(10):Ut(p).ticks(10)).attr("font-size",null).attr("font-family",null).selectAll("line, path").attr("stroke",null),E.exit().remove();const T=S.selectAll(".title-y2").data(this.histogram?[{}]:[]);T.enter().append("text").classed("title-y2",!0).attr("text-anchor","middle").text("Count").merge(T).attr("transform",this.distributions?`translate(${c+1.5*this.rem}, ${l/2})rotate(90)`:`translate(${-1.5*this.rem}, ${l/2})rotate(-90)`),T.exit().remove(),$.append("g").classed("content",!0);const C=k.select(".content"),P=C.selectAll(".signal-noise").data(this.distributions?[{}]:[]),R=P.enter().append("g").classed("signal-noise",!0),q=R.merge(P);P.exit().remove();const F=R.append("g").classed("noise",!0),z=q.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}const r=to.muN2D(e,this.s);this.d=r<to.d.MIN?to.d.MIN:r>to.d.MAX?to.d.MAX:r,this.alignState(),this.sendEvent(),t.preventDefault()}}:null);(this.firstUpdate||t.has("interactive"))&&(this.interactive?z.call(b):z.on(".drag",null)),F.append("path").classed("curve-cr",!0),z.select(".curve-cr").transition().duration(this.drag?0:h).ease(fi).attrTween("d",(t,e,r)=>{const n=r[e],i=hn(void 0!==n.d?n.d:this.d,this.d),s=hn(void 0!==n.c?n.c:this.c,this.c),a=hn(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=Tt(u.domain()[0],to.c2L(n.c,n.s),.05).map(t=>({e:t,p:Ja.normal.pdf(t,to.d2MuN(n.d,n.s),1)}));return e.push({e:to.c2L(n.c,n.s),p:Ja.normal.pdf(to.c2L(n.c,n.s),to.d2MuN(n.d,n.s),1)}),e.push({e:to.c2L(n.c,n.s),p:0}),e.push({e:u.domain()[0],p:0}),v(e)}}),F.append("path").classed("curve-fa",!0),z.select(".curve-fa").transition().duration(this.drag?0:h).ease(fi).attrTween("d",(t,e,r)=>{const n=r[e],i=hn(void 0!==n.d?n.d:this.d,this.d),s=hn(void 0!==n.c?n.c:this.c,this.c),a=hn(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=Tt(to.c2L(n.c,n.s),u.domain()[1],.05).map(t=>({e:t,p:Ja.normal.pdf(t,to.d2MuN(n.d,n.s),1)}));return e.push({e:u.domain()[1],p:Ja.normal.pdf(u.domain()[1],to.d2MuN(n.d,n.s),1)}),e.push({e:u.domain()[1],p:0}),e.push({e:to.c2L(n.c,n.s),p:0}),v(e)}}),F.append("path").classed("curve-noise",!0),z.select(".curve-noise").transition().duration(this.drag?0:h).ease(fi).attrTween("d",(t,e,r)=>{const n=r[e],i=hn(void 0!==n.d?n.d:this.d,this.d),s=hn(void 0!==n.s?n.s:this.s,this.s);return t=>{n.d=i(t),n.s=s(t);const e=Tt(u.domain()[0],u.domain()[1],.05).map(t=>({e:t,p:Ja.normal.pdf(t,to.d2MuN(n.d,n.s),1)}));return e.push({e:u.domain()[1],p:Ja.normal.pdf(u.domain()[1],to.d2MuN(n.d,n.s),1)}),v(e)}});const O=R.append("g").classed("signal",!0),I=q.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}const r=to.muS2D(e,this.s);this.d=r<to.d.MIN?to.d.MIN:r>to.d.MAX?to.d.MAX:r,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<0?0:e;const r=to.h2S(e);this.s=r<to.s.MIN?to.s.MIN:r>to.s.MAX?to.s.MAX:r,this.d=to.muN2D(this.muN,this.s),this.c=to.l2C(this.l,this.s),this.alignState(),this.sendEvent(),t.preventDefault()}}:null);(this.firstUpdate||t.has("interactive")||t.has("unequal"))&&(this.interactive||this.unequal?I.call(g):I.on(".drag",null)),O.append("path").classed("curve-m",!0),I.select(".curve-m").transition().duration(this.drag?0:h).ease(fi).attrTween("d",(t,e,r)=>{const n=r[e],i=hn(void 0!==n.d?n.d:this.d,this.d),s=hn(void 0!==n.c?n.c:this.c,this.c),a=hn(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=Tt(u.domain()[0],to.c2L(n.c,n.s),.05).map(t=>({e:t,p:Ja.normal.pdf(t,to.d2MuS(n.d,n.s),n.s)}));return e.push({e:to.c2L(n.c,n.s),p:Ja.normal.pdf(to.c2L(n.c,n.s),to.d2MuS(n.d,n.s),n.s)}),e.push({e:to.c2L(n.c,n.s),p:0}),e.push({e:u.domain()[0],p:0}),v(e)}}),O.append("path").classed("curve-h",!0),I.select(".curve-h").transition().duration(this.drag?0:h).ease(fi).attrTween("d",(t,e,r)=>{const n=r[e],i=hn(void 0!==n.d?n.d:this.d,this.d),s=hn(void 0!==n.c?n.c:this.c,this.c),a=hn(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=Tt(to.c2L(n.c,n.s),u.domain()[1],.05).map(t=>({e:t,p:Ja.normal.pdf(t,to.d2MuS(n.d,n.s),n.s)}));return e.push({e:u.domain()[1],p:Ja.normal.pdf(u.domain()[1],to.d2MuS(n.d,n.s),n.s)}),e.push({e:u.domain()[1],p:0}),e.push({e:to.c2L(n.c,n.s),p:0}),v(e)}}),O.append("path").classed("curve-signal",!0),I.select(".curve-signal").transition().duration(this.drag?0:h).ease(fi).attrTween("d",(t,e,r)=>{const n=r[e],i=hn(void 0!==n.d?n.d:this.d,this.d),s=hn(void 0!==n.s?n.s:this.s,this.s);return t=>{n.d=i(t),n.s=s(t);const e=Tt(u.domain()[0],u.domain()[1],.05).map(t=>({e:t,p:Ja.normal.pdf(t,to.d2MuS(n.d,n.s),n.s)}));return e.push({e:u.domain()[1],p:Ja.normal.pdf(u.domain()[1],to.d2MuS(n.d,n.s),n.s)}),v(e)}});const D=C.selectAll(".measure-d").data(this.sensitivity?[{}]:[]),U=D.enter().append("g").classed("measure-d",!0);U.append("line").classed("line",!0),U.append("line").classed("cap-left",!0),U.append("line").classed("cap-right",!0);const j=U.append("text").classed("label",!0);j.append("tspan").classed("d math-var",!0).text("d′"),j.append("tspan").classed("equals",!0).text(" = "),j.append("tspan").classed("value",!0);const L=U.merge(D);L.select(".line").transition().duration(this.drag?0:h).ease(fi).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(fi).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(fi).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(fi).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=hn(void 0!==n.d?n.d:this.d,this.d);return t=>{n.d=i(t),ir(n).text(Bi(".3")(n.d))}}),D.exit().remove();const H=C.selectAll(".measure-c").data(this.bias?[{}]:[]),V=H.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 X=V.merge(H);X.select(".line").transition().duration(this.drag?0:h).ease(fi).attr("x1",u(this.l)).attr("y1",d(.47)).attr("x2",u(0)).attr("y2",d(.47)),X.select(".cap-zero").transition().duration(this.drag?0:h).ease(fi).attr("x1",u(0)).attr("y1",d(.47)+5).attr("x2",u(0)).attr("y2",d(.47)-5);X.select(".label").transition().duration(this.drag?0:h).ease(fi).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=hn(void 0!==n.c?n.c:this.c,this.c);return t=>{n.c=i(t),ir(n).text(Bi(".3")(n.c))}}),H.exit().remove();const K=C.selectAll(".measure-s").data(this.variance?[{}]:[]),Z=K.enter().append("g").classed("measure-s",!0);Z.append("line").classed("line",!0),Z.append("line").classed("cap-left",!0),Z.append("line").classed("cap-right",!0);const W=Z.append("text").classed("label",!0);W.append("tspan").classed("s math-var",!0).text("σ"),W.append("tspan").classed("equals",!0).text(" = "),W.append("tspan").classed("value",!0);const Y=Z.merge(K);Y.select(".line").transition().duration(this.drag?0:h).ease(fi).attr("x1",u(this.muS-this.s)).attr("y1",d(Ja.normal.pdf(this.s,0,this.s))+10/this.s).attr("x2",u(this.muS+this.s)).attr("y2",d(Ja.normal.pdf(this.s,0,this.s))+10/this.s),Y.select(".cap-left").transition().duration(this.drag?0:h).ease(fi).attr("x1",u(this.muS-this.s)).attr("y1",d(Ja.normal.pdf(this.s,0,this.s))+10/this.s+5).attr("x2",u(this.muS-this.s)).attr("y2",d(Ja.normal.pdf(this.s,0,this.s))+10/this.s-5),Y.select(".cap-right").transition().duration(this.drag?0:h).ease(fi).attr("x1",u(this.muS+this.s)).attr("y1",d(Ja.normal.pdf(this.s,0,this.s))+10/this.s+5).attr("x2",u(this.muS+this.s)).attr("y2",d(Ja.normal.pdf(this.s,0,this.s))+10/this.s-5);Y.select(".label").transition().duration(this.drag?0:h).ease(fi).attr("x",u(this.muS)).attr("y",d(Ja.normal.pdf(this.s,0,this.s))+10/this.s-3).select(".value").tween("text",(t,e,r)=>{const n=r[e],i=hn(void 0!==n.s?n.s:this.s,this.s);return t=>{n.s=i(t),ir(n).text(Bi(".3")(n.s))}}),K.exit().remove();const G=C.selectAll(".threshold").data(this.threshold?[{}]:[]),Q=G.enter().append("g").classed("threshold",!0);Q.append("line").classed("line",!0),Q.append("line").classed("line touch",!0),Q.append("circle").classed("handle touch",!0);const J=Q.merge(G).attr("tabindex",this.interactive?0:null).classed("interactive",this.interactive);(this.firstUpdate||t.has("interactive"))&&(this.interactive?J.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}const r=to.l2C(e,this.s);this.c=r<to.c.MIN?to.c.MIN:r>to.c.MAX?to.c.MAX:r,this.alignState(),this.sendEvent(),t.preventDefault()}}):J.on("drag",null).on("keydown",null)),J.select(".line").transition().duration(this.drag?0:h).ease(fi).attr("x1",u(this.l)).attr("y1",d(0)).attr("x2",u(this.l)).attr("y2",d(.54)),J.select(".line.touch").transition().duration(this.drag?0:h).ease(fi).attr("x1",u(this.l)).attr("y1",d(0)).attr("x2",u(this.l)).attr("y2",d(.54)),J.select(".handle").transition().duration(this.drag?0:h).ease(fi).attr("cx",u(this.l)).attr("cy",d(.54)),G.exit().remove();const tt=C.selectAll(".histogram").data(this.histogram?[{}]:[]),et=tt.enter().append("g").classed("histogram",!0).merge(tt);if(tt.exit().remove(),this.histogram){const t=function(){var t=yt,e=gt,r=Nt;function n(n){Array.isArray(n)||(n=Array.from(n));var i,s,a,o=n.length,l=new Array(o);for(i=0;i<o;++i)l[i]=t(n[i],i,n);var c=e(l),h=c[0],u=c[1],d=r(l,h,u);if(!Array.isArray(d)){const t=u,r=+d;if(e===gt&&([h,u]=Et(h,u,r)),(d=Mt(h,u,r))[0]<=h&&(a=At(h,u,r)),d[d.length-1]>=u)if(t>=u&&e===gt){const t=At(h,u,r);isFinite(t)&&(t>0?u=(Math.floor(u/t)+1)*t:t<0&&(u=(Math.ceil(u*-t)+1)/-t))}else d.pop()}for(var f=d.length,p=0,m=f;d[p]<=h;)++p;for(;d[m-1]>u;)--m;(p||m<f)&&(d=d.slice(p,m),f=m-p);var b,g=new Array(f+1);for(i=0;i<=f;++i)(b=g[i]=[]).x0=i>0?d[i-1]:h,b.x1=i<f?d[i]:u;if(isFinite(a)){if(a>0)for(i=0;i<o;++i)null!=(s=l[i])&&h<=s&&s<=u&&g[Math.min(f,Math.floor((s-h)/a))].push(n[i]);else if(a<0)for(i=0;i<o;++i)if(null!=(s=l[i])&&h<=s&&s<=u){const t=Math.floor((h-s)*a);g[Math.min(f,t+(d[t]<=s))].push(n[i])}}else for(i=0;i<o;++i)null!=(s=l[i])&&h<=s&&s<=u&&g[bt(d,s,0,f)].push(n[i]);return g}return n.value=function(e){return arguments.length?(t="function"==typeof e?e:xt(e),n):t},n.domain=function(t){return arguments.length?(e="function"==typeof t?t:xt([t[0],t[1]]),n):e},n.thresholds=function(t){return arguments.length?(r="function"==typeof t?t:xt(Array.isArray(t)?wt.call(t):t),n):r},n}().value(t=>t.trueEvidence).domain(u.domain()).thresholds(Tt(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",f-3).attr("height",f-3),a=s.filter(t=>t.new&&!t.paused);if(!a.empty()){const t=a.attr("data-new-trial-ease-time"),e=e=>qa().domain([0,1]).range([t,1])(e),r=e=>r=>qa().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=tn(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||"all"===this.color?this.getComputedStyleValue(`---color-${t.outcome}`):this.getComputedStyleValue("---color-acc"));return t=>s(r(di)(t))}).attrTween("fill",(t,e,n)=>{const i=n[e],s=tn(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||"all"===this.color?this.getComputedStyleValue(`---color-${t.outcome}-light`):this.getComputedStyleValue("---color-acc-light"));return t=>s(r(di)(t))}).attrTween("x",(t,e,n)=>{const i=hn(n[e].getAttribute("x"),u(t.binValue)+1.5);return t=>i(r(fi)(t))}).attrTween("y",(t,e,n)=>{const i=hn(n[e].getAttribute("y"),d(0)+1.5-(t.binCount+1)*f);return t=>i(r(di)(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(fi).attr("x",e=>hn(0,u(e.binValue)+1.5)(fi(t))).attr("y",e=>hn(0,d(0)+1.5-(e.binCount+1)*f)(di(t))).attr("stroke",e=>tn(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||"all"===this.color?this.getComputedStyleValue(`---color-${e.outcome}`):this.getComputedStyleValue("---color-acc"))(di(t))).attr("fill",e=>tn(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||"all"===this.color?this.getComputedStyleValue(`---color-${e.outcome}-light`):this.getComputedStyleValue("---color-acc-light"))(di(t)))}s.filter(t=>!t.new).transition().duration(h).ease(fi).attr("x",t=>u(t.binValue)+1.5).attr("y",t=>d(0)+1.5-(t.binCount+1)*f).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||"all"===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||"all"===this.color?this.getComputedStyleValue(`---color-${t.outcome}-light`):this.getComputedStyleValue("---color-acc-light")),i.exit().transition().duration(h).ease(ui).attrTween("stroke",(t,e,r)=>{const n=r[e],i=tn(n.getAttribute("stroke"),this.getComputedStyleValue("---color-acc"));return t=>i(di(t))}).attrTween("fill",(t,e,r)=>{const n=r[e],i=tn(n.getAttribute("fill"),this.getComputedStyleValue("---color-acc-light"));return t=>i(di(t))}).attrTween("x",(t,e,r)=>{const n=hn(r[e].getAttribute("x"),0);return t=>n(di(t))}).attrTween("y",(t,e,r)=>{const n=hn(r[e].getAttribute("y"),0);return t=>n(fi(t))}).remove()}const rt=$.append("g").classed("overlayer",!0),nt=k.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=ir(this.renderRoot).select(".trial[data-new-trial-ease-time]");t.interrupt("new"),t.datum(t=>(t.paused=!0,t))}resumeTrial(){ir(this.renderRoot).select(".trial[data-new-trial-ease-time]").datum(t=>(t.paused=!1,t)),this.requestUpdate()}}customElements.define("sdt-model",Zo);class Wo extends Za{static get properties(){return{d:{attribute:"d",type:Number,reflect:!0},c:{attribute:"c",type:Number,reflect:!0},s:{attribute:"s",type:Number,reflect:!0}}}constructor(){super(),this.d=void 0,this.c=void 0,this.s=void 0}setSensitivity(t){this.d=+t.target.value,this.dispatchEvent(new CustomEvent("sdt-parameters-d",{detail:{d:this.d},bubbles:!0}))}setBias(t){this.c=+t.target.value,this.dispatchEvent(new CustomEvent("sdt-parameters-c",{detail:{c:this.c},bubbles:!0}))}setVariance(t){this.s=+t.target.value,this.dispatchEvent(new CustomEvent("sdt-parameters-s",{detail:{s:this.s},bubbles:!0}))}static get styles(){return[super.styles,o`
|
|
1799
1767
|
:host {
|
|
1800
1768
|
display: inline-block;
|
|
1801
1769
|
}
|
|
@@ -1811,6 +1779,7 @@ const La=t=>t??K;customElements.define("decidables-slider",class extends Ha{stat
|
|
|
1811
1779
|
|
|
1812
1780
|
decidables-slider {
|
|
1813
1781
|
line-height: 1;
|
|
1782
|
+
|
|
1814
1783
|
text-align: center;
|
|
1815
1784
|
}
|
|
1816
1785
|
|
|
@@ -1988,7 +1957,7 @@ const La=t=>t??K;customElements.define("decidables-slider",class extends Ha{stat
|
|
|
1988
1957
|
.s {
|
|
1989
1958
|
background: var(---color-s-light);
|
|
1990
1959
|
}
|
|
1991
|
-
`]}}class Go extends Yo{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=to.d.DEFAULT,this.c=to.c.DEFAULT,this.s=to.s.DEFAULT,this.alignState()}alignState(){this.far=to.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()}willUpdate(){this.alignState()}render(){let t,e,r,n,
|
|
1960
|
+
`]}}class Go extends Yo{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=to.d.DEFAULT,this.c=to.c.DEFAULT,this.s=to.s.DEFAULT,this.alignState()}alignState(){this.far=to.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()}willUpdate(){this.alignState()}render(){let t,e,r,n,i;return this.numeric?(t=V`
|
|
1992
1961
|
<decidables-spinner class="d bottom"
|
|
1993
1962
|
?disabled=${!this.interactive}
|
|
1994
1963
|
step=${to.d.STEP}
|
|
@@ -2025,7 +1994,7 @@ const La=t=>t??K;customElements.define("decidables-slider",class extends Ha{stat
|
|
|
2025
1994
|
>
|
|
2026
1995
|
<var>False Alarm Rate</var>
|
|
2027
1996
|
</decidables-spinner>
|
|
2028
|
-
`):(t=V`<var class="math-var d">d′</var>`,e=V`<var class="math-var c">c</var>`,r=V`<var class="math-var s">σ</var>`,n=V`<var class="far">False Alarm Rate</var>`),
|
|
1997
|
+
`):(t=V`<var class="math-var d">d′</var>`,e=V`<var class="math-var c">c</var>`,r=V`<var class="math-var s">σ</var>`,n=V`<var class="far">False Alarm Rate</var>`),i=this.unequal?V`
|
|
2029
1998
|
<tr>
|
|
2030
1999
|
<td rowspan="2">
|
|
2031
2000
|
${n}<span class="equals">=</span><var class="math-greek phi tight">Φ</var><span class="paren tight">(</span><span class="bracket tight">[</span>
|
|
@@ -2070,10 +2039,10 @@ const La=t=>t??K;customElements.define("decidables-slider",class extends Ha{stat
|
|
|
2070
2039
|
<div class="holder">
|
|
2071
2040
|
<table class="equation">
|
|
2072
2041
|
<tbody>
|
|
2073
|
-
${
|
|
2042
|
+
${i}
|
|
2074
2043
|
</tbody>
|
|
2075
2044
|
</table>
|
|
2076
|
-
</div>`}}customElements.define("sdt-equation-dc2far",Go);class Qo extends Yo{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=to.d.DEFAULT,this.c=to.c.DEFAULT,this.s=to.s.DEFAULT,this.alignState()}alignState(){this.hr=to.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()}willUpdate(){this.alignState()}render(){let t,e,r,n,
|
|
2045
|
+
</div>`}}customElements.define("sdt-equation-dc2far",Go);class Qo extends Yo{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=to.d.DEFAULT,this.c=to.c.DEFAULT,this.s=to.s.DEFAULT,this.alignState()}alignState(){this.hr=to.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()}willUpdate(){this.alignState()}render(){let t,e,r,n,i;return this.numeric?(t=V`
|
|
2077
2046
|
<decidables-spinner class="d bottom"
|
|
2078
2047
|
?disabled=${!this.interactive}
|
|
2079
2048
|
step=${to.d.STEP}
|
|
@@ -2111,7 +2080,7 @@ const La=t=>t??K;customElements.define("decidables-slider",class extends Ha{stat
|
|
|
2111
2080
|
>
|
|
2112
2081
|
<var>Hit Rate</var>
|
|
2113
2082
|
</decidables-spinner>
|
|
2114
|
-
`):(t=V`<var class="math-var d">d′</var>`,e=V`<var class="math-var c">c</var>`,r=V`<var class="math-var s">σ</var>`,n=V`<var class="hr">Hit Rate</var>`),
|
|
2083
|
+
`):(t=V`<var class="math-var d">d′</var>`,e=V`<var class="math-var c">c</var>`,r=V`<var class="math-var s">σ</var>`,n=V`<var class="hr">Hit Rate</var>`),i=this.unequal?V`
|
|
2115
2084
|
<tr>
|
|
2116
2085
|
<td rowspan="2">
|
|
2117
2086
|
${n}<span class="equals">=</span><var class="math-greek phi tight">Φ</var><span class="paren tight">(</span><span class="bracket tight">[</span>
|
|
@@ -2165,7 +2134,7 @@ const La=t=>t??K;customElements.define("decidables-slider",class extends Ha{stat
|
|
|
2165
2134
|
<div class="holder">
|
|
2166
2135
|
<table class="equation">
|
|
2167
2136
|
<tbody>
|
|
2168
|
-
${
|
|
2137
|
+
${i}
|
|
2169
2138
|
</tbody>
|
|
2170
2139
|
</table>
|
|
2171
2140
|
</div>`}}customElements.define("sdt-equation-dc2hr",Qo);class Jo extends Yo{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=to.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()}willUpdate(){this.alignState()}render(){let t,e,r;return this.numeric?(t=V`
|
|
@@ -2311,7 +2280,7 @@ const La=t=>t??K;customElements.define("decidables-slider",class extends Ha{stat
|
|
|
2311
2280
|
</tbody>
|
|
2312
2281
|
</table>
|
|
2313
2282
|
</div>
|
|
2314
|
-
`}}customElements.define("sdt-equation-hm2hr",el);class rl extends Yo{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=to.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()}willUpdate(){this.alignState()}render(){let t,e,r,n,
|
|
2283
|
+
`}}customElements.define("sdt-equation-hm2hr",el);class rl extends Yo{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=to.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()}willUpdate(){this.alignState()}render(){let t,e,r,n,i;return this.numeric?(t=V`
|
|
2315
2284
|
<decidables-spinner class="h"
|
|
2316
2285
|
?disabled=${!this.interactive}
|
|
2317
2286
|
min="0"
|
|
@@ -2347,7 +2316,7 @@ const La=t=>t??K;customElements.define("decidables-slider",class extends Ha{stat
|
|
|
2347
2316
|
>
|
|
2348
2317
|
<var>Correct Rejections</var>
|
|
2349
2318
|
</decidables-spinner>
|
|
2350
|
-
`,
|
|
2319
|
+
`,i=V`
|
|
2351
2320
|
<decidables-spinner class="acc"
|
|
2352
2321
|
disabled
|
|
2353
2322
|
min="0"
|
|
@@ -2357,13 +2326,13 @@ const La=t=>t??K;customElements.define("decidables-slider",class extends Ha{stat
|
|
|
2357
2326
|
>
|
|
2358
2327
|
<var>Accuracy</var>
|
|
2359
2328
|
</decidables-spinner>
|
|
2360
|
-
`):(t=V`<var class="h">Hits</var>`,e=V`<var class="m">Misses</var>`,r=V`<var class="fa">False Alarms</var>`,n=V`<var class="cr">Correct Rejections</var>`,
|
|
2329
|
+
`):(t=V`<var class="h">Hits</var>`,e=V`<var class="m">Misses</var>`,r=V`<var class="fa">False Alarms</var>`,n=V`<var class="cr">Correct Rejections</var>`,i=V`<var class="acc">Accuracy</var>`),V`
|
|
2361
2330
|
<div class="holder">
|
|
2362
2331
|
<table class="equation">
|
|
2363
2332
|
<tbody>
|
|
2364
2333
|
<tr>
|
|
2365
2334
|
<td rowspan="2">
|
|
2366
|
-
${
|
|
2335
|
+
${i}<span class="equals">=</span>
|
|
2367
2336
|
</td>
|
|
2368
2337
|
<td class="underline">
|
|
2369
2338
|
${t}<span class="plus">+</span>${n}
|
|
@@ -2376,7 +2345,7 @@ const La=t=>t??K;customElements.define("decidables-slider",class extends Ha{stat
|
|
|
2376
2345
|
</tr>
|
|
2377
2346
|
</tbody>
|
|
2378
2347
|
</table>
|
|
2379
|
-
</div>`}}customElements.define("sdt-equation-hmfacr2acc",rl);class nl extends Yo{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=to.s.DEFAULT,this.alignState()}alignState(){this.c=to.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()}willUpdate(){this.alignState()}render(){let t,e,r,n,
|
|
2348
|
+
</div>`}}customElements.define("sdt-equation-hmfacr2acc",rl);class nl extends Yo{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=to.s.DEFAULT,this.alignState()}alignState(){this.c=to.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()}willUpdate(){this.alignState()}render(){let t,e,r,n,i;return this.numeric?(t=V`
|
|
2380
2349
|
<decidables-spinner class="hr bottom"
|
|
2381
2350
|
?disabled=${!this.interactive}
|
|
2382
2351
|
min="0"
|
|
@@ -2416,7 +2385,7 @@ const La=t=>t??K;customElements.define("decidables-slider",class extends Ha{stat
|
|
|
2416
2385
|
>
|
|
2417
2386
|
<var class="math-var">c</var>
|
|
2418
2387
|
</decidables-spinner>
|
|
2419
|
-
`):(t=V`<var class="hr">Hit Rate</var>`,e=V`<var class="far">False Alarm Rate</var>`,r=V`<var class="math-var s">σ</var>`,n=V`<var class="math-var c">c</var>`),
|
|
2388
|
+
`):(t=V`<var class="hr">Hit Rate</var>`,e=V`<var class="far">False Alarm Rate</var>`,r=V`<var class="math-var s">σ</var>`,n=V`<var class="math-var c">c</var>`),i=this.unequal?V`
|
|
2420
2389
|
<tr>
|
|
2421
2390
|
<td rowspan="2">
|
|
2422
2391
|
${n}<span class="equals">=</span><span class="bracket tight">(</span>
|
|
@@ -2458,10 +2427,10 @@ const La=t=>t??K;customElements.define("decidables-slider",class extends Ha{stat
|
|
|
2458
2427
|
<div class="holder">
|
|
2459
2428
|
<table class="equation">
|
|
2460
2429
|
<tbody>
|
|
2461
|
-
${
|
|
2430
|
+
${i}
|
|
2462
2431
|
</tbody>
|
|
2463
2432
|
</table>
|
|
2464
|
-
</div>`}}customElements.define("sdt-equation-hrfar2c",nl);class
|
|
2433
|
+
</div>`}}customElements.define("sdt-equation-hrfar2c",nl);class il extends Yo{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=to.s.DEFAULT,this.alignState()}alignState(){this.d=to.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()}willUpdate(){this.alignState()}render(){let t,e,r,n,i;return this.numeric?(t=V`
|
|
2465
2434
|
<decidables-spinner class="hr bottom"
|
|
2466
2435
|
?disabled=${!this.interactive}
|
|
2467
2436
|
min="0"
|
|
@@ -2501,7 +2470,7 @@ const La=t=>t??K;customElements.define("decidables-slider",class extends Ha{stat
|
|
|
2501
2470
|
>
|
|
2502
2471
|
<var class="math-var">d′</var>
|
|
2503
2472
|
</decidables-spinner>
|
|
2504
|
-
`):(t=V`<var class="hr">Hit Rate</var>`,e=V`<var class="far">False Alarm Rate</var>`,r=V`<var class="math-var s">σ</var>`,n=V`<var class="math-var d">d′</var>`),
|
|
2473
|
+
`):(t=V`<var class="hr">Hit Rate</var>`,e=V`<var class="far">False Alarm Rate</var>`,r=V`<var class="math-var s">σ</var>`,n=V`<var class="math-var d">d′</var>`),i=this.unequal?V`
|
|
2505
2474
|
<tr>
|
|
2506
2475
|
<td rowspan="2">
|
|
2507
2476
|
${n}<span class="equals">=</span><span class="bracket tight">(</span>
|
|
@@ -2526,10 +2495,10 @@ const La=t=>t??K;customElements.define("decidables-slider",class extends Ha{stat
|
|
|
2526
2495
|
<div class="holder">
|
|
2527
2496
|
<table class="equation">
|
|
2528
2497
|
<tbody>
|
|
2529
|
-
${
|
|
2498
|
+
${i}
|
|
2530
2499
|
</tbody>
|
|
2531
2500
|
</table>
|
|
2532
|
-
</div>`}}customElements.define("sdt-equation-hrfar2d",
|
|
2501
|
+
</div>`}}customElements.define("sdt-equation-hrfar2d",il);class sl extends Yo{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=to.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()}willUpdate(){this.alignState()}render(){let t,e,r;return this.numeric?(t=V`
|
|
2533
2502
|
<decidables-spinner class="m"
|
|
2534
2503
|
?disabled=${!this.interactive}
|
|
2535
2504
|
min="0"
|
|
@@ -2577,7 +2546,7 @@ const La=t=>t??K;customElements.define("decidables-slider",class extends Ha{stat
|
|
|
2577
2546
|
</tbody>
|
|
2578
2547
|
</table>
|
|
2579
2548
|
</div>
|
|
2580
|
-
`}}customElements.define("sdt-equation-mcr2fomr",
|
|
2549
|
+
`}}customElements.define("sdt-equation-mcr2fomr",sl);class al extends Za{static get styles(){return[super.styles,o`
|
|
2581
2550
|
:host {
|
|
2582
2551
|
display: inline-block;
|
|
2583
2552
|
|
|
@@ -2626,5 +2595,5 @@ const La=t=>t??K;customElements.define("decidables-slider",class extends Ha{stat
|
|
|
2626
2595
|
<div class="body">
|
|
2627
2596
|
<slot>Empty!</slot>
|
|
2628
2597
|
</div>
|
|
2629
|
-
</div>`}}customElements.define("sdt-example",al);class ol extends al{connectedCallback(){super.connectedCallback(),this.one={},this.one.h=95,this.one.m=5,this.one.fa=35,this.one.cr=65,this.one.hr=to.hM2Hr(this.one.h,this.one.m),this.one.far=to.faCr2Far(this.one.fa,this.one.cr),this.one.d=to.hrFar2D(this.one.hr,this.one.far),this.one.c=to.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=to.hM2Hr(this.two.h,this.two.m),this.two.far=to.faCr2Far(this.two.fa,this.two.cr),this.two.d=to.hrFar2D(this.two.hr,this.two.far),this.two.c=to.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=to.hrFar2D(t.detail.hr,t.detail.far),this.sdtModelOne.c=to.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=to.hrFar2D(t.detail.hr,t.detail.far),this.sdtModelTwo.c=to.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),s=this.detectableTableOne.fa+this.detectableTableOne.cr-n;this.detectableTableOne.h=e,this.detectableTableOne.m=r,this.detectableTableOne.fa=n,this.detectableTableOne.cr=s}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),s=this.detectableTableTwo.fa+this.detectableTableTwo.cr-n;this.detectableTableTwo.h=e,this.detectableTableTwo.m=r,this.detectableTableTwo.fa=n,this.detectableTableTwo.cr=s}})),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),s=this.detectableTableOne.fa+this.detectableTableOne.cr-n;this.detectableTableOne.h=e,this.detectableTableOne.m=r,this.detectableTableOne.fa=n,this.detectableTableOne.cr=s}})),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),s=this.detectableTableTwo.fa+this.detectableTableTwo.cr-n;this.detectableTableTwo.h=e,this.detectableTableTwo.m=r,this.detectableTableTwo.fa=n,this.detectableTableTwo.cr=s}}))}}customElements.define("sdt-example-double-interactive",ol);class ll extends al{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},h:{attribute:!1,type:Number,reflect:!1},m:{attribute:!1,type:Number,reflect:!1},fa:{attribute:!1,type:Number,reflect:!1},cr:{attribute:!1,type:Number,reflect:!1},hr:{attribute:!1,type:Number,reflect:!1},far:{attribute:!1,type:Number,reflect:!1},d:{attribute:!1,type:Number,reflect:!1},c:{attribute:!1,type:Number,reflect:!1},s:{attribute:!1,type:Number,reflect:!1}}}constructor(){super(),this.trials=10,this.duration=2e3,this.coherence=.5,this.payoff=0,this.h=0,this.m=0,this.fa=0,this.cr=0,this.hr=.5,this.far=.5,this.d=0,this.c=0,this.s=to.s.DEFAULT,this.count=0,this.detectableControl=null,this.detectableResponse=null,this.detectableTable=null,this.rdkTask=null,this.rocSpace=null,this.sdtModel=null,this.sdtParameters=null}connectedCallback(){super.connectedCallback(),this.count=1,this.detectableControl=this.querySelector("detectable-control"),this.detectableResponse=this.querySelector("detectable-response"),this.detectableTable=this.querySelector("detectable-table"),this.rdkTask=this.querySelector("rdk-task"),this.rocSpace=this.querySelector("roc-space"),this.sdtModel=this.querySelector("sdt-model"),this.sdtParameters=this.querySelector("sdt-parameters"),this.rocSpace&&this.rocSpace.hasAttribute("history")&&this.rocSpace.set(.5,.5,"default",this.count),this.detectableControl&&(this.detectableControl.addEventListener("detectable-control-trials",t=>{this.trials=t.detail.trials}),this.detectableControl.addEventListener("detectable-control-duration",t=>{this.duration=t.detail.duration}),this.detectableControl.addEventListener("detectable-control-coherence",t=>{this.coherence=t.detail.coherence}),this.detectableControl.addEventListener("detectable-control-payoff",t=>{this.payoff=t.detail.payoff}),this.detectableControl.addEventListener("detectable-control-run",()=>{this.rdkTask&&(this.rdkTask.running=!0)}),this.detectableControl.addEventListener("detectable-control-pause",()=>{this.rdkTask&&(this.rdkTask.running=!1)}),this.detectableControl.addEventListener("detectable-control-reset",()=>{this.rdkTask&&this.rdkTask.reset(),this.detectableResponse&&this.detectableResponse.reset(),this.h=0,this.m=0,this.fa=0,this.cr=0,this.hr=.5,this.far=.5,this.d=0,this.c=0,this.rocSpace&&this.rocSpace.hasAttribute("history")&&(this.count+=1,this.rocSpace.set(.5,.5,`point${this.count}`,this.count))})),this.rdkTask&&(this.rdkTask.addEventListener("rdk-trial-start",t=>{this.detectableResponse&&this.detectableResponse.start(t.detail.signal,t.detail.trial)}),this.rdkTask.addEventListener("rdk-trial-end",()=>{this.detectableResponse&&this.detectableResponse.stop()}),this.rdkTask.addEventListener("rdk-block-end",()=>{this.detectableControl&&this.detectableControl.complete()})),this.detectableResponse&&this.detectableResponse.addEventListener("detectable-response",t=>{this.h=t.detail.h,this.m=t.detail.m,this.fa=t.detail.fa,this.cr=t.detail.cr,this.hr=to.hM2Hr(this.h+1,this.m+1),this.far=to.faCr2Far(this.fa+1,this.cr+1),this.d=to.hrFar2D(this.hr,this.far),this.c=to.hrFar2C(this.hr,this.far),this.rocSpace&&this.rocSpace.hasAttribute("history")&&this.rocSpace.set(this.hr,this.far,1===this.count?"default":`point${this.count}`,this.count)}),this.sdtParameters&&(this.sdtParameters.addEventListener("sdt-parameters-d",t=>{this.d=t.detail.d}),this.sdtParameters.addEventListener("sdt-parameters-c",t=>{this.c=t.detail.c}),this.sdtParameters.addEventListener("sdt-parameters-s",t=>{this.s=t.detail.s}))}update(t){super.update(t),this.detectableControl&&(this.detectableControl.trials=null!=this.detectableControl.trials?this.trials:void 0,this.detectableControl.duration=null!=this.detectableControl.duration?this.duration:void 0,this.detectableControl.coherence=null!=this.detectableControl.coherence?this.coherence:void 0,this.detectableControl.payoff=null!=this.detectableControl.payoff?this.payoff:void 0),this.detectableResponse&&(this.detectableResponse.trialTotal=this.trials,this.detectableResponse.hPayoff=this.payoff,this.detectableResponse.mPayoff=0-this.payoff,this.detectableResponse.faPayoff=0-(100-this.payoff),this.detectableResponse.crPayoff=100-this.payoff),this.detectableTable&&(this.detectableTable.h=this.h,this.detectableTable.m=this.m,this.detectableTable.cr=this.cr,this.detectableTable.fa=this.fa,this.detectableTable.hPayoff=this.payoff,this.detectableTable.mPayoff=0-this.payoff,this.detectableTable.faPayoff=0-(100-this.payoff),this.detectableTable.crPayoff=100-this.payoff),this.rdkTask&&(this.rdkTask.trials=this.trials,this.rdkTask.duration=this.duration,this.rdkTask.wait=this.duration===1/0?0:this.duration,this.rdkTask.iti=this.duration===1/0?0:this.duration,this.rdkTask.coherence=this.coherence),this.rocSpace&&!this.rocSpace.hasAttribute("history")&&(this.rocSpace.hr=this.hr,this.rocSpace.far=this.far),this.sdtModel&&(this.sdtModel.d=this.d,this.sdtModel.c=this.c,this.sdtModel.s=this.s),this.sdtParameters&&(this.sdtParameters.d=null!=this.sdtParameters.d?this.d:void 0,this.sdtParameters.c=null!=this.sdtParameters.c?this.c:void 0,this.sdtParameters.s=null!=this.sdtParameters.s?this.s:void 0)}}customElements.define("sdt-example-human",ll);class cl extends al{static get properties(){return{color:{attribute:"color",type:String,reflect:!0},zRoc:{attribute:"z-roc",type:Boolean,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},hr:{attribute:"hr",type:Number,reflect:!0},far:{attribute:"far",type:Number,reflect:!0},d:{attribute:"d",type:Number,reflect:!0},c:{attribute:"c",type:Number,reflect:!0},s:{attribute:"s",type:Number,reflect:!0}}}constructor(){super(),this.color="all",this.zRoc=!1,this.h=void 0,this.m=void 0,this.fa=void 0,this.cr=void 0,this.hr=void 0,this.far=void 0,this.d=to.d.DEFAULT,this.c=to.c.DEFAULT,this.s=to.s.DEFAULT,this.detectableControl=null,this.detectableTable=null,this.rocSpace=null,this.sdtModel=null,this.sdtParameters=null,this.rocSpaces=[]}connectedCallback(){if(super.connectedCallback(),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.sdtParameters=this.querySelector("sdt-parameters"),this.rocSpaces=this.querySelectorAll("roc-space"),void 0!==this.h&&void 0!==this.m&&void 0!==this.fa&&void 0!==this.cr)this.hr=to.hM2Hr(this.h,this.m),this.far=to.faCr2Far(this.fa,this.cr),this.d=to.hrFar2D(this.hr,this.far,this.s),this.c=to.hrFar2C(this.hr,this.far,this.s);else if(void 0!==this.hr&&void 0!==this.far)this.d=to.hrFar2D(this.hr,this.far,this.s),this.c=to.hrFar2C(this.hr,this.far,this.s);else if(void 0!==this.d&&void 0!==this.c){this.hr=to.dC2Hr(this.d,this.c,this.s),this.far=to.dC2Far(this.d,this.c,this.s);const t=100;this.h=Math.round(t*this.hr),this.m=t-this.h,this.fa=Math.round(t*this.far),this.cr=t-this.fa}this.detectableControl&&(this.detectableControl.addEventListener("detectable-control-color",t=>{this.color=t.detail.color}),this.detectableControl.addEventListener("detectable-control-z-roc",t=>{this.zRoc=t.detail.zRoc})),this.detectableTable&&this.detectableTable.addEventListener("detectable-table-change",t=>{this.h=t.detail.h,this.m=t.detail.m,this.fa=t.detail.fa,this.cr=t.detail.cr,this.far=t.detail.far,this.hr=t.detail.hr,this.d=to.hrFar2D(this.hr,this.far,this.s),this.c=to.hrFar2C(this.hr,this.far,this.s)}),this.rocSpace&&this.rocSpace.addEventListener("roc-point-change",t=>{this.d=t.detail.d,this.c=t.detail.c,this.s=t.detail.s,this.hr=t.detail.hr,this.far=t.detail.far;const e=Math.round((this.h+this.m)*this.hr),r=this.h+this.m-e,n=Math.round((this.fa+this.cr)*this.far),s=this.fa+this.cr-n;this.h=e,this.m=r,this.fa=n,this.cr=s}),this.sdtModel&&this.sdtModel.addEventListener("sdt-model-change",t=>{this.d=t.detail.d,this.c=t.detail.c,this.s=t.detail.s,this.hr=t.detail.hr,this.far=t.detail.far;const e=Math.round((this.h+this.m)*this.hr),r=this.h+this.m-e,n=Math.round((this.fa+this.cr)*this.far),s=this.fa+this.cr-n;this.h=e,this.m=r,this.fa=n,this.cr=s}),this.sdtParameters&&(this.sdtParameters.addEventListener("sdt-parameters-d",t=>{this.d=t.detail.d}),this.sdtParameters.addEventListener("sdt-parameters-c",t=>{this.c=t.detail.c}),this.sdtParameters.addEventListener("sdt-parameters-s",t=>{this.s=t.detail.s}))}update(t){super.update(t),this.detectableControl&&(this.detectableControl.color=null!=this.detectableControl.color?this.color:void 0,this.detectableControl.zRoc=null!=this.detectableControl.zRoc?this.zRoc:void 0),this.detectableTable&&(this.detectableTable.color=this.color,this.detectableTable.h=this.h,this.detectableTable.m=this.m,this.detectableTable.cr=this.cr,this.detectableTable.fa=this.fa),this.rocSpace&&(this.rocSpace.hr=this.hr,this.rocSpace.far=this.far),this.sdtModel&&(this.sdtModel.color=this.color,this.sdtModel.d=this.d,this.sdtModel.c=this.c,this.sdtModel.s=this.s),this.rocSpaces.length>0&&this.rocSpaces.forEach(t=>{t.zRoc=this.zRoc,t.setWithSDT(this.d,this.c,"default","",this.s)}),this.sdtParameters&&(this.sdtParameters.d=null!=this.sdtParameters.d?this.d:void 0,this.sdtParameters.c=null!=this.sdtParameters.c?this.c:void 0,this.sdtParameters.s=null!=this.sdtParameters.s?this.s:void 0)}}customElements.define("sdt-example-interactive",cl);class hl extends al{static get properties(){return{trials:{attribute:"trials",type:Number,reflect:!0},duration:{attribute:"duration",type:Number,reflect:!0},coherence:{attribute:"coherence",type:Number,reflect:!0},color:{attribute:"color",type:String,reflect:!0},d:{attribute:"d",type:Number,reflect:!0},c:{attribute:"c",type:Number,reflect:!0},s:{attribute:"s",type:Number,reflect:!0},h:{attribute:!1,type:Number,reflect:!1},m:{attribute:!1,type:Number,reflect:!1},fa:{attribute:!1,type:Number,reflect:!1},cr:{attribute:!1,type:Number,reflect:!1},hr:{attribute:!1,type:Number,reflect:!1},far:{attribute:!1,type:Number,reflect:!1}}}constructor(){super(),this.trials=10,this.duration=2e3,this.coherence=.5,this.color="all",this.d=to.s.DEFAULT,this.c=to.s.DEFAULT,this.s=to.s.DEFAULT,this.h=0,this.m=0,this.fa=0,this.cr=0,this.hr=.5,this.far=.5,this.detectableControl=null,this.detectableResponse=null,this.detectableTable=null,this.rdkTask=null,this.rocSpace=null,this.sdtModel=null,this.sdtParameters=null}connectedCallback(){super.connectedCallback(),this.detectableControl=this.querySelector("detectable-control"),this.detectableResponse=this.querySelector("detectable-response"),this.detectableTable=this.querySelector("detectable-table"),this.rdkTask=this.querySelector("rdk-task"),this.rocSpace=this.querySelector("roc-space"),this.sdtModel=this.querySelector("sdt-model"),this.sdtParameters=this.querySelector("sdt-parameters"),this.detectableControl&&(this.detectableControl.addEventListener("detectable-control-trials",t=>{this.trials=t.detail.trials}),this.detectableControl.addEventListener("detectable-control-coherence",t=>{this.coherence=t.detail.coherence}),this.detectableControl.addEventListener("detectable-control-duration",t=>{this.duration=t.detail.duration}),this.detectableControl.addEventListener("detectable-control-color",t=>{this.color=t.detail.color}),this.detectableControl.addEventListener("detectable-control-run",()=>{this.rdkTask&&(this.rdkTask.running=!0),this.sdtModel&&this.sdtModel.resumeTrial()}),this.detectableControl.addEventListener("detectable-control-pause",()=>{this.rdkTask&&(this.rdkTask.running=!1),this.sdtModel&&this.sdtModel.pauseTrial()}),this.detectableControl.addEventListener("detectable-control-reset",()=>{this.rdkTask&&this.rdkTask.reset(),this.detectableResponse&&this.detectableResponse.reset(),this.sdtModel&&this.sdtModel.reset(),this.h=0,this.m=0,this.fa=0,this.cr=0,this.hr=.5,this.far=.5})),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.addEventListener("rdk-trial-end",()=>{this.detectableResponse&&this.detectableResponse.stop()}),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.h=t.detail.h,this.m=t.detail.m,this.fa=t.detail.fa,this.cr=t.detail.cr,this.hr=to.hM2Hr(this.h,this.m),this.far=to.faCr2Far(this.fa,this.cr)}),this.sdtModel.addEventListener("sdt-model-change",t=>{this.d=t.detail.d,this.c=t.detail.c,this.s=t.detail.s,this.h=t.detail.h,this.m=t.detail.m,this.fa=t.detail.fa,this.cr=t.detail.cr,this.hr=to.hM2Hr(this.h,this.m),this.far=to.faCr2Far(this.fa,this.cr)})),this.sdtParameters&&(this.sdtParameters.addEventListener("sdt-parameters-d",t=>{this.d=t.detail.d}),this.sdtParameters.addEventListener("sdt-parameters-c",t=>{this.c=t.detail.c}),this.sdtParameters.addEventListener("sdt-parameters-s",t=>{this.s=t.detail.s}))}update(t){super.update(t),this.detectableControl&&(this.detectableControl.trials=void 0!==this.detectableControl.trials?this.trials:void 0,this.detectableControl.coherence=void 0!==this.detectableControl.coherence?this.coherence:void 0,this.detectableControl.duration=void 0!==this.detectableControl.duration?this.duration:void 0,this.detectableControl.color=void 0!==this.detectableControl.color?this.color:void 0),this.detectableResponse&&(this.detectableResponse.trialTotal=this.trials),this.detectableTable&&(this.detectableTable.color=this.color,this.detectableTable.h=this.h,this.detectableTable.m=this.m,this.detectableTable.cr=this.cr,this.detectableTable.fa=this.fa),this.rdkTask&&(this.rdkTask.trials=this.trials,this.rdkTask.duration=this.duration,this.rdkTask.wait=this.duration,this.rdkTask.iti=this.duration,this.rdkTask.coherence=this.coherence),this.rocSpace&&(this.rocSpace.hr=this.hr,this.rocSpace.far=this.far),this.sdtModel&&(this.sdtModel.color=this.color,this.sdtModel.d=this.d,this.sdtModel.c=this.c,this.sdtModel.s=this.s),this.sdtParameters&&(this.sdtParameters.d=null!=this.sdtParameters.d?this.d:void 0,this.sdtParameters.c=null!=this.sdtParameters.c?this.c:void 0,this.sdtParameters.s=null!=this.sdtParameters.s?this.s:void 0)}}customElements.define("sdt-example-model",hl);class ul extends al{static get properties(){return{variable:{attribute:"variable",type:String,reflect:!0},values:{attribute:"values",converter:Va,reflect:!0}}}constructor(){super(),this.variables=["d","c"],this.variable="d",this.values=[0,1]}connectedCallback(){super.connectedCallback(),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",ul);class dl extends al{connectedCallback(){super.connectedCallback(),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),Tt(-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&&Tt(-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",dl),t.DetectableControl=Wa,t.DetectableElement=Za,t.DetectableResponse=Ya,t.DetectableTable=eo,t.RDKTask=ro,t.ROCSpace=Ko,t.SDTEquationDC2Far=Go,t.SDTEquationDC2Hr=Qo,t.SDTEquationFaCr2Far=Jo,t.SDTEquationHFa2Ppv=tl,t.SDTEquationHM2Hr=el,t.SDTEquationHMFaCr2Acc=rl,t.SDTEquationHrFar2C=nl,t.SDTEquationHrFar2D=sl,t.SDTEquationMCr2Fomr=il,t.SDTExampleDoubleInteractive=ol,t.SDTExampleHuman=ll,t.SDTExampleInteractive=cl,t.SDTExampleModel=hl,t.SDTExampleMultiple=ul,t.SDTExampleUnequal=dl,t.SDTModel=Zo,t.SDTParameters=Wo});
|
|
2598
|
+
</div>`}}customElements.define("sdt-example",al);class ol extends al{connectedCallback(){super.connectedCallback(),this.one={},this.one.h=95,this.one.m=5,this.one.fa=35,this.one.cr=65,this.one.hr=to.hM2Hr(this.one.h,this.one.m),this.one.far=to.faCr2Far(this.one.fa,this.one.cr),this.one.d=to.hrFar2D(this.one.hr,this.one.far),this.one.c=to.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=to.hM2Hr(this.two.h,this.two.m),this.two.far=to.faCr2Far(this.two.fa,this.two.cr),this.two.d=to.hrFar2D(this.two.hr,this.two.far),this.two.c=to.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=to.hrFar2D(t.detail.hr,t.detail.far),this.sdtModelOne.c=to.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=to.hrFar2D(t.detail.hr,t.detail.far),this.sdtModelTwo.c=to.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",ol);class ll extends al{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},h:{attribute:!1,type:Number,reflect:!1},m:{attribute:!1,type:Number,reflect:!1},fa:{attribute:!1,type:Number,reflect:!1},cr:{attribute:!1,type:Number,reflect:!1},hr:{attribute:!1,type:Number,reflect:!1},far:{attribute:!1,type:Number,reflect:!1},d:{attribute:!1,type:Number,reflect:!1},c:{attribute:!1,type:Number,reflect:!1},s:{attribute:!1,type:Number,reflect:!1}}}constructor(){super(),this.trials=10,this.duration=2e3,this.coherence=.5,this.payoff=0,this.h=0,this.m=0,this.fa=0,this.cr=0,this.hr=.5,this.far=.5,this.d=0,this.c=0,this.s=to.s.DEFAULT,this.count=0,this.detectableControl=null,this.detectableResponse=null,this.detectableTable=null,this.rdkTask=null,this.rocSpace=null,this.sdtModel=null,this.sdtParameters=null}connectedCallback(){super.connectedCallback(),this.count=1,this.detectableControl=this.querySelector("detectable-control"),this.detectableResponse=this.querySelector("detectable-response"),this.detectableTable=this.querySelector("detectable-table"),this.rdkTask=this.querySelector("rdk-task"),this.rocSpace=this.querySelector("roc-space"),this.sdtModel=this.querySelector("sdt-model"),this.sdtParameters=this.querySelector("sdt-parameters"),this.rocSpace&&this.rocSpace.hasAttribute("history")&&this.rocSpace.set(.5,.5,"default",this.count),this.detectableControl&&(this.detectableControl.addEventListener("detectable-control-trials",t=>{this.trials=t.detail.trials}),this.detectableControl.addEventListener("detectable-control-duration",t=>{this.duration=t.detail.duration}),this.detectableControl.addEventListener("detectable-control-coherence",t=>{this.coherence=t.detail.coherence}),this.detectableControl.addEventListener("detectable-control-payoff",t=>{this.payoff=t.detail.payoff}),this.detectableControl.addEventListener("detectable-control-run",()=>{this.rdkTask&&(this.rdkTask.running=!0)}),this.detectableControl.addEventListener("detectable-control-pause",()=>{this.rdkTask&&(this.rdkTask.running=!1)}),this.detectableControl.addEventListener("detectable-control-reset",()=>{this.rdkTask&&this.rdkTask.reset(),this.detectableResponse&&this.detectableResponse.reset(),this.h=0,this.m=0,this.fa=0,this.cr=0,this.hr=.5,this.far=.5,this.d=0,this.c=0,this.rocSpace&&this.rocSpace.hasAttribute("history")&&(this.count+=1,this.rocSpace.set(.5,.5,`point${this.count}`,this.count))})),this.rdkTask&&(this.rdkTask.addEventListener("rdk-trial-start",t=>{this.detectableResponse&&this.detectableResponse.start(t.detail.signal,t.detail.trial)}),this.rdkTask.addEventListener("rdk-trial-end",()=>{this.detectableResponse&&this.detectableResponse.stop()}),this.rdkTask.addEventListener("rdk-block-end",()=>{this.detectableControl&&this.detectableControl.complete()})),this.detectableResponse&&this.detectableResponse.addEventListener("detectable-response",t=>{this.h=t.detail.h,this.m=t.detail.m,this.fa=t.detail.fa,this.cr=t.detail.cr,this.hr=to.hM2Hr(this.h+1,this.m+1),this.far=to.faCr2Far(this.fa+1,this.cr+1),this.d=to.hrFar2D(this.hr,this.far),this.c=to.hrFar2C(this.hr,this.far),this.rocSpace&&this.rocSpace.hasAttribute("history")&&this.rocSpace.set(this.hr,this.far,1===this.count?"default":`point${this.count}`,this.count)}),this.sdtParameters&&(this.sdtParameters.addEventListener("sdt-parameters-d",t=>{this.d=t.detail.d}),this.sdtParameters.addEventListener("sdt-parameters-c",t=>{this.c=t.detail.c}),this.sdtParameters.addEventListener("sdt-parameters-s",t=>{this.s=t.detail.s}))}update(t){super.update(t),this.detectableControl&&(this.detectableControl.trials=null!=this.detectableControl.trials?this.trials:void 0,this.detectableControl.duration=null!=this.detectableControl.duration?this.duration:void 0,this.detectableControl.coherence=null!=this.detectableControl.coherence?this.coherence:void 0,this.detectableControl.payoff=null!=this.detectableControl.payoff?this.payoff:void 0),this.detectableResponse&&(this.detectableResponse.trialTotal=this.trials,this.detectableResponse.hPayoff=this.payoff,this.detectableResponse.mPayoff=0-this.payoff,this.detectableResponse.faPayoff=0-(100-this.payoff),this.detectableResponse.crPayoff=100-this.payoff),this.detectableTable&&(this.detectableTable.h=this.h,this.detectableTable.m=this.m,this.detectableTable.cr=this.cr,this.detectableTable.fa=this.fa,this.detectableTable.hPayoff=this.payoff,this.detectableTable.mPayoff=0-this.payoff,this.detectableTable.faPayoff=0-(100-this.payoff),this.detectableTable.crPayoff=100-this.payoff),this.rdkTask&&(this.rdkTask.trials=this.trials,this.rdkTask.duration=this.duration,this.rdkTask.wait=this.duration===1/0?0:this.duration,this.rdkTask.iti=this.duration===1/0?0:this.duration,this.rdkTask.coherence=this.coherence),this.rocSpace&&!this.rocSpace.hasAttribute("history")&&(this.rocSpace.hr=this.hr,this.rocSpace.far=this.far),this.sdtModel&&(this.sdtModel.d=this.d,this.sdtModel.c=this.c,this.sdtModel.s=this.s),this.sdtParameters&&(this.sdtParameters.d=null!=this.sdtParameters.d?this.d:void 0,this.sdtParameters.c=null!=this.sdtParameters.c?this.c:void 0,this.sdtParameters.s=null!=this.sdtParameters.s?this.s:void 0)}}customElements.define("sdt-example-human",ll);class cl extends al{static get properties(){return{color:{attribute:"color",type:String,reflect:!0},zRoc:{attribute:"z-roc",type:Boolean,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},hr:{attribute:"hr",type:Number,reflect:!0},far:{attribute:"far",type:Number,reflect:!0},d:{attribute:"d",type:Number,reflect:!0},c:{attribute:"c",type:Number,reflect:!0},s:{attribute:"s",type:Number,reflect:!0}}}constructor(){super(),this.color="all",this.zRoc=!1,this.h=void 0,this.m=void 0,this.fa=void 0,this.cr=void 0,this.hr=void 0,this.far=void 0,this.d=to.d.DEFAULT,this.c=to.c.DEFAULT,this.s=to.s.DEFAULT,this.detectableControl=null,this.detectableTable=null,this.rocSpace=null,this.sdtModel=null,this.sdtParameters=null,this.rocSpaces=[]}connectedCallback(){if(super.connectedCallback(),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.sdtParameters=this.querySelector("sdt-parameters"),this.rocSpaces=this.querySelectorAll("roc-space"),void 0!==this.h&&void 0!==this.m&&void 0!==this.fa&&void 0!==this.cr)this.hr=to.hM2Hr(this.h,this.m),this.far=to.faCr2Far(this.fa,this.cr),this.d=to.hrFar2D(this.hr,this.far,this.s),this.c=to.hrFar2C(this.hr,this.far,this.s);else if(void 0!==this.hr&&void 0!==this.far)this.d=to.hrFar2D(this.hr,this.far,this.s),this.c=to.hrFar2C(this.hr,this.far,this.s);else if(void 0!==this.d&&void 0!==this.c){this.hr=to.dC2Hr(this.d,this.c,this.s),this.far=to.dC2Far(this.d,this.c,this.s);const t=100;this.h=Math.round(t*this.hr),this.m=t-this.h,this.fa=Math.round(t*this.far),this.cr=t-this.fa}this.detectableControl&&(this.detectableControl.addEventListener("detectable-control-color",t=>{this.color=t.detail.color}),this.detectableControl.addEventListener("detectable-control-z-roc",t=>{this.zRoc=t.detail.zRoc})),this.detectableTable&&this.detectableTable.addEventListener("detectable-table-change",t=>{this.h=t.detail.h,this.m=t.detail.m,this.fa=t.detail.fa,this.cr=t.detail.cr,this.far=t.detail.far,this.hr=t.detail.hr,this.d=to.hrFar2D(this.hr,this.far,this.s),this.c=to.hrFar2C(this.hr,this.far,this.s)}),this.rocSpace&&this.rocSpace.addEventListener("roc-point-change",t=>{this.d=t.detail.d,this.c=t.detail.c,this.s=t.detail.s,this.hr=t.detail.hr,this.far=t.detail.far;const e=Math.round((this.h+this.m)*this.hr),r=this.h+this.m-e,n=Math.round((this.fa+this.cr)*this.far),i=this.fa+this.cr-n;this.h=e,this.m=r,this.fa=n,this.cr=i}),this.sdtModel&&this.sdtModel.addEventListener("sdt-model-change",t=>{this.d=t.detail.d,this.c=t.detail.c,this.s=t.detail.s,this.hr=t.detail.hr,this.far=t.detail.far;const e=Math.round((this.h+this.m)*this.hr),r=this.h+this.m-e,n=Math.round((this.fa+this.cr)*this.far),i=this.fa+this.cr-n;this.h=e,this.m=r,this.fa=n,this.cr=i}),this.sdtParameters&&(this.sdtParameters.addEventListener("sdt-parameters-d",t=>{this.d=t.detail.d}),this.sdtParameters.addEventListener("sdt-parameters-c",t=>{this.c=t.detail.c}),this.sdtParameters.addEventListener("sdt-parameters-s",t=>{this.s=t.detail.s}))}update(t){super.update(t),this.detectableControl&&(this.detectableControl.color=null!=this.detectableControl.color?this.color:void 0,this.detectableControl.zRoc=null!=this.detectableControl.zRoc?this.zRoc:void 0),this.detectableTable&&(this.detectableTable.color=this.color,this.detectableTable.h=this.h,this.detectableTable.m=this.m,this.detectableTable.cr=this.cr,this.detectableTable.fa=this.fa),this.rocSpace&&(this.rocSpace.hr=this.hr,this.rocSpace.far=this.far),this.sdtModel&&(this.sdtModel.color=this.color,this.sdtModel.d=this.d,this.sdtModel.c=this.c,this.sdtModel.s=this.s),this.rocSpaces.length>0&&this.rocSpaces.forEach(t=>{t.zRoc=this.zRoc,t.setWithSDT(this.d,this.c,"default","",this.s)}),this.sdtParameters&&(this.sdtParameters.d=null!=this.sdtParameters.d?this.d:void 0,this.sdtParameters.c=null!=this.sdtParameters.c?this.c:void 0,this.sdtParameters.s=null!=this.sdtParameters.s?this.s:void 0)}}customElements.define("sdt-example-interactive",cl);class hl extends al{static get properties(){return{trials:{attribute:"trials",type:Number,reflect:!0},duration:{attribute:"duration",type:Number,reflect:!0},coherence:{attribute:"coherence",type:Number,reflect:!0},color:{attribute:"color",type:String,reflect:!0},d:{attribute:"d",type:Number,reflect:!0},c:{attribute:"c",type:Number,reflect:!0},s:{attribute:"s",type:Number,reflect:!0},h:{attribute:!1,type:Number,reflect:!1},m:{attribute:!1,type:Number,reflect:!1},fa:{attribute:!1,type:Number,reflect:!1},cr:{attribute:!1,type:Number,reflect:!1},hr:{attribute:!1,type:Number,reflect:!1},far:{attribute:!1,type:Number,reflect:!1}}}constructor(){super(),this.trials=10,this.duration=2e3,this.coherence=.5,this.color="all",this.d=to.s.DEFAULT,this.c=to.s.DEFAULT,this.s=to.s.DEFAULT,this.h=0,this.m=0,this.fa=0,this.cr=0,this.hr=.5,this.far=.5,this.detectableControl=null,this.detectableResponse=null,this.detectableTable=null,this.rdkTask=null,this.rocSpace=null,this.sdtModel=null,this.sdtParameters=null}connectedCallback(){super.connectedCallback(),this.detectableControl=this.querySelector("detectable-control"),this.detectableResponse=this.querySelector("detectable-response"),this.detectableTable=this.querySelector("detectable-table"),this.rdkTask=this.querySelector("rdk-task"),this.rocSpace=this.querySelector("roc-space"),this.sdtModel=this.querySelector("sdt-model"),this.sdtParameters=this.querySelector("sdt-parameters"),this.detectableControl&&(this.detectableControl.addEventListener("detectable-control-trials",t=>{this.trials=t.detail.trials}),this.detectableControl.addEventListener("detectable-control-coherence",t=>{this.coherence=t.detail.coherence}),this.detectableControl.addEventListener("detectable-control-duration",t=>{this.duration=t.detail.duration}),this.detectableControl.addEventListener("detectable-control-color",t=>{this.color=t.detail.color}),this.detectableControl.addEventListener("detectable-control-run",()=>{this.rdkTask&&(this.rdkTask.running=!0),this.sdtModel&&this.sdtModel.resumeTrial()}),this.detectableControl.addEventListener("detectable-control-pause",()=>{this.rdkTask&&(this.rdkTask.running=!1),this.sdtModel&&this.sdtModel.pauseTrial()}),this.detectableControl.addEventListener("detectable-control-reset",()=>{this.rdkTask&&this.rdkTask.reset(),this.detectableResponse&&this.detectableResponse.reset(),this.sdtModel&&this.sdtModel.reset(),this.h=0,this.m=0,this.fa=0,this.cr=0,this.hr=.5,this.far=.5})),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.addEventListener("rdk-trial-end",()=>{this.detectableResponse&&this.detectableResponse.stop()}),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.h=t.detail.h,this.m=t.detail.m,this.fa=t.detail.fa,this.cr=t.detail.cr,this.hr=to.hM2Hr(this.h,this.m),this.far=to.faCr2Far(this.fa,this.cr)}),this.sdtModel.addEventListener("sdt-model-change",t=>{this.d=t.detail.d,this.c=t.detail.c,this.s=t.detail.s,this.h=t.detail.h,this.m=t.detail.m,this.fa=t.detail.fa,this.cr=t.detail.cr,this.hr=to.hM2Hr(this.h,this.m),this.far=to.faCr2Far(this.fa,this.cr)})),this.sdtParameters&&(this.sdtParameters.addEventListener("sdt-parameters-d",t=>{this.d=t.detail.d}),this.sdtParameters.addEventListener("sdt-parameters-c",t=>{this.c=t.detail.c}),this.sdtParameters.addEventListener("sdt-parameters-s",t=>{this.s=t.detail.s}))}update(t){super.update(t),this.detectableControl&&(this.detectableControl.trials=void 0!==this.detectableControl.trials?this.trials:void 0,this.detectableControl.coherence=void 0!==this.detectableControl.coherence?this.coherence:void 0,this.detectableControl.duration=void 0!==this.detectableControl.duration?this.duration:void 0,this.detectableControl.color=void 0!==this.detectableControl.color?this.color:void 0),this.detectableResponse&&(this.detectableResponse.trialTotal=this.trials),this.detectableTable&&(this.detectableTable.color=this.color,this.detectableTable.h=this.h,this.detectableTable.m=this.m,this.detectableTable.cr=this.cr,this.detectableTable.fa=this.fa),this.rdkTask&&(this.rdkTask.trials=this.trials,this.rdkTask.duration=this.duration,this.rdkTask.wait=this.duration,this.rdkTask.iti=this.duration,this.rdkTask.coherence=this.coherence),this.rocSpace&&(this.rocSpace.hr=this.hr,this.rocSpace.far=this.far),this.sdtModel&&(this.sdtModel.color=this.color,this.sdtModel.d=this.d,this.sdtModel.c=this.c,this.sdtModel.s=this.s),this.sdtParameters&&(this.sdtParameters.d=null!=this.sdtParameters.d?this.d:void 0,this.sdtParameters.c=null!=this.sdtParameters.c?this.c:void 0,this.sdtParameters.s=null!=this.sdtParameters.s?this.s:void 0)}}customElements.define("sdt-example-model",hl);class ul extends al{static get properties(){return{variable:{attribute:"variable",type:String,reflect:!0},values:{attribute:"values",converter:Va,reflect:!0}}}constructor(){super(),this.variables=["d","c"],this.variable="d",this.values=[0,1]}connectedCallback(){super.connectedCallback(),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",ul);class dl extends al{connectedCallback(){super.connectedCallback(),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),Tt(-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&&Tt(-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",dl),t.DetectableControl=Wa,t.DetectableElement=Za,t.DetectableResponse=Ya,t.DetectableTable=eo,t.RDKTask=ro,t.ROCSpace=Ko,t.SDTEquationDC2Far=Go,t.SDTEquationDC2Hr=Qo,t.SDTEquationFaCr2Far=Jo,t.SDTEquationHFa2Ppv=tl,t.SDTEquationHM2Hr=el,t.SDTEquationHMFaCr2Acc=rl,t.SDTEquationHrFar2C=nl,t.SDTEquationHrFar2D=il,t.SDTEquationMCr2Fomr=sl,t.SDTExampleDoubleInteractive=ol,t.SDTExampleHuman=ll,t.SDTExampleInteractive=cl,t.SDTExampleModel=hl,t.SDTExampleMultiple=ul,t.SDTExampleUnequal=dl,t.SDTModel=Zo,t.SDTParameters=Wo});
|
|
2630
2599
|
//# sourceMappingURL=detectableElements.umd.min.js.map
|