@patricksurry/g3
Version:
A flexible Javascript framework for building steam gauge instrument panels that display live external metrics from flight (or other) simulators like XPlane or MS FS2020
169 lines • 173 kB
JavaScript
var g3=function(e){"use strict";!function(){const e={};try{if(process)return process.env=Object.assign({},process.env),void Object.assign(process.env,e)}catch(e){}globalThis.process={env:e}}();var t=function(){function e(e){var t=this;this._insertTag=function(e){var n;n=0===t.tags.length?t.insertionPoint?t.insertionPoint.nextSibling:t.prepend?t.container.firstChild:t.before:t.tags[t.tags.length-1].nextSibling,t.container.insertBefore(e,n),t.tags.push(e)},this.isSpeedy=void 0===e.speedy||e.speedy,this.tags=[],this.ctr=0,this.nonce=e.nonce,this.key=e.key,this.container=e.container,this.prepend=e.prepend,this.insertionPoint=e.insertionPoint,this.before=null}var t=e.prototype;return t.hydrate=function(e){e.forEach(this._insertTag)},t.insert=function(e){this.ctr%(this.isSpeedy?65e3:1)==0&&this._insertTag(function(e){var t=document.createElement("style");return t.setAttribute("data-emotion",e.key),void 0!==e.nonce&&t.setAttribute("nonce",e.nonce),t.appendChild(document.createTextNode("")),t.setAttribute("data-s",""),t}(this));var t=this.tags[this.tags.length-1];if(this.isSpeedy){var n=function(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]}(t);try{n.insertRule(e,n.cssRules.length)}catch(e){}}else t.appendChild(document.createTextNode(e));this.ctr++},t.flush=function(){this.tags.forEach(function(e){var t;return null==(t=e.parentNode)?void 0:t.removeChild(e)}),this.tags=[],this.ctr=0},e}(),n="-ms-",r="-moz-",i="-webkit-",a="comm",o="rule",s="decl",l="@keyframes",u=Math.abs,c=String.fromCharCode,h=Object.assign;function p(e){return e.trim()}function f(e,t,n){return e.replace(t,n)}function g(e,t){return e.indexOf(t)}function m(e,t){return 0|e.charCodeAt(t)}function d(e,t,n){return e.slice(t,n)}function y(e){return e.length}function v(e){return e.length}function w(e,t){return t.push(e),e}var b=1,_=1,k=0,x=0,M=0,z="";function C(e,t,n,r,i,a,o){return{value:e,root:t,parent:n,type:r,props:i,children:a,line:b,column:_,length:o,return:""}}function S(e,t){return h(C("",null,null,"",null,null,0),e,{length:-e.length},t)}function A(){return M=x>0?m(z,--x):0,_--,10===M&&(_=1,b--),M}function T(){return M=x<k?m(z,x++):0,_++,10===M&&(_=1,b++),M}function $(){return m(z,x)}function D(){return x}function E(e,t){return d(z,e,t)}function N(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function O(e){return b=_=1,k=y(z=e),x=0,[]}function j(e){return z="",e}function P(e){return p(E(x-1,U(91===e?e+2:40===e?e+1:e)))}function L(e){for(;(M=$())&&M<33;)T();return N(e)>2||N(M)>3?"":" "}function F(e,t){for(;--t&&T()&&!(M<48||M>102||M>57&&M<65||M>70&&M<97););return E(e,D()+(t<6&&32==$()&&32==T()))}function U(e){for(;T();)switch(M){case e:return x;case 34:case 39:34!==e&&39!==e&&U(M);break;case 40:41===e&&U(e);break;case 92:T()}return x}function R(e,t){for(;T()&&e+M!==57&&(e+M!==84||47!==$()););return"/*"+E(t,x-1)+"*"+c(47===e?e:T())}function G(e){for(;!N($());)T();return E(e,x)}function H(e){return j(I("",null,null,null,[""],e=O(e),0,[0],e))}function I(e,t,n,r,i,a,o,s,l){for(var u=0,h=0,p=o,d=0,v=0,b=0,_=1,k=1,x=1,M=0,z="",C=i,S=a,E=r,N=z;k;)switch(b=M,M=T()){case 40:if(108!=b&&58==m(N,p-1)){-1!=g(N+=f(P(M),"&","&\f"),"&\f")&&(x=-1);break}case 34:case 39:case 91:N+=P(M);break;case 9:case 10:case 13:case 32:N+=L(b);break;case 92:N+=F(D()-1,7);continue;case 47:switch($()){case 42:case 47:w(q(R(T(),D()),t,n),l);break;default:N+="/"}break;case 123*_:s[u++]=y(N)*x;case 125*_:case 59:case 0:switch(M){case 0:case 125:k=0;case 59+h:-1==x&&(N=f(N,/\f/g,"")),v>0&&y(N)-p&&w(v>32?B(N+";",r,n,p-1):B(f(N," ","")+";",r,n,p-2),l);break;case 59:N+=";";default:if(w(E=K(N,t,n,u,h,i,s,z,C=[],S=[],p),a),123===M)if(0===h)I(N,t,E,E,C,a,p,s,S);else switch(99===d&&110===m(N,3)?100:d){case 100:case 108:case 109:case 115:I(e,E,E,r&&w(K(e,E,E,0,0,i,s,z,i,C=[],p),S),i,S,p,s,r?C:S);break;default:I(N,E,E,E,[""],S,0,s,S)}}u=h=v=0,_=x=1,z=N="",p=o;break;case 58:p=1+y(N),v=b;default:if(_<1)if(123==M)--_;else if(125==M&&0==_++&&125==A())continue;switch(N+=c(M),M*_){case 38:x=h>0?1:(N+="\f",-1);break;case 44:s[u++]=(y(N)-1)*x,x=1;break;case 64:45===$()&&(N+=P(T())),d=$(),h=p=y(z=N+=G(D())),M++;break;case 45:45===b&&2==y(N)&&(_=0)}}return a}function K(e,t,n,r,i,a,s,l,c,h,g){for(var m=i-1,y=0===i?a:[""],w=v(y),b=0,_=0,k=0;b<r;++b)for(var x=0,M=d(e,m+1,m=u(_=s[b])),z=e;x<w;++x)(z=p(_>0?y[x]+" "+M:f(M,/&\f/g,y[x])))&&(c[k++]=z);return C(e,t,n,0===i?o:l,c,h,g)}function q(e,t,n){return C(e,t,n,a,c(M),d(e,2,-2),0)}function B(e,t,n,r){return C(e,t,n,s,d(e,0,r),d(e,r+1,-1),r)}function Y(e,t){for(var n="",r=v(e),i=0;i<r;i++)n+=t(e[i],i,e,t)||"";return n}function V(e,t,n,r){switch(e.type){case"@layer":if(e.children.length)break;case"@import":case s:return e.return=e.return||e.value;case a:return"";case l:return e.return=e.value+"{"+Y(e.children,r)+"}";case o:e.value=e.props.join(",")}return y(n=Y(e.children,r))?e.return=e.value+"{"+n+"}":""}function W(e){var t=v(e);return function(n,r,i,a){for(var o="",s=0;s<t;s++)o+=e[s](n,r,i,a)||"";return o}}function X(e){var t=Object.create(null);return function(n){return void 0===t[n]&&(t[n]=e(n)),t[n]}}var Z="undefined"!=typeof document,J=function(e,t,n){for(var r=0,i=0;r=i,i=$(),38===r&&12===i&&(t[n]=1),!N(i);)T();return E(e,x)},Q=function(e,t){return j(function(e,t){var n=-1,r=44;do{switch(N(r)){case 0:38===r&&12===$()&&(t[n]=1),e[n]+=J(x-1,t,n);break;case 2:e[n]+=P(r);break;case 4:if(44===r){e[++n]=58===$()?"&\f":"",t[n]=e[n].length;break}default:e[n]+=c(r)}}while(r=T());return e}(O(e),t))},ee=new WeakMap,te=function(e){if("rule"===e.type&&e.parent&&!(e.length<1)){for(var t=e.value,n=e.parent,r=e.column===n.column&&e.line===n.line;"rule"!==n.type;)if(!(n=n.parent))return;if((1!==e.props.length||58===t.charCodeAt(0)||ee.get(n))&&!r){ee.set(e,!0);for(var i=[],a=Q(t,i),o=n.props,s=0,l=0;s<a.length;s++)for(var u=0;u<o.length;u++,l++)e.props[l]=i[s]?a[s].replace(/&\f/g,o[u]):o[u]+" "+a[s]}}},ne=function(e){if("decl"===e.type){var t=e.value;108===t.charCodeAt(0)&&98===t.charCodeAt(2)&&(e.return="",e.value="")}};function re(e,t){switch(function(e,t){return 45^m(e,0)?(((t<<2^m(e,0))<<2^m(e,1))<<2^m(e,2))<<2^m(e,3):0}(e,t)){case 5103:return i+"print-"+e+e;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return i+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return i+e+r+e+n+e+e;case 6828:case 4268:return i+e+n+e+e;case 6165:return i+e+n+"flex-"+e+e;case 5187:return i+e+f(e,/(\w+).+(:[^]+)/,i+"box-$1$2"+n+"flex-$1$2")+e;case 5443:return i+e+n+"flex-item-"+f(e,/flex-|-self/,"")+e;case 4675:return i+e+n+"flex-line-pack"+f(e,/align-content|flex-|-self/,"")+e;case 5548:return i+e+n+f(e,"shrink","negative")+e;case 5292:return i+e+n+f(e,"basis","preferred-size")+e;case 6060:return i+"box-"+f(e,"-grow","")+i+e+n+f(e,"grow","positive")+e;case 4554:return i+f(e,/([^-])(transform)/g,"$1"+i+"$2")+e;case 6187:return f(f(f(e,/(zoom-|grab)/,i+"$1"),/(image-set)/,i+"$1"),e,"")+e;case 5495:case 3959:return f(e,/(image-set\([^]*)/,i+"$1$`$1");case 4968:return f(f(e,/(.+:)(flex-)?(.*)/,i+"box-pack:$3"+n+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+i+e+e;case 4095:case 3583:case 4068:case 2532:return f(e,/(.+)-inline(.+)/,i+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(y(e)-1-t>6)switch(m(e,t+1)){case 109:if(45!==m(e,t+4))break;case 102:return f(e,/(.+:)(.+)-([^]+)/,"$1"+i+"$2-$3$1"+r+(108==m(e,t+3)?"$3":"$2-$3"))+e;case 115:return~g(e,"stretch")?re(f(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(115!==m(e,t+1))break;case 6444:switch(m(e,y(e)-3-(~g(e,"!important")&&10))){case 107:return f(e,":",":"+i)+e;case 101:return f(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+i+(45===m(e,14)?"inline-":"")+"box$3$1"+i+"$2$3$1"+n+"$2box$3")+e}break;case 5936:switch(m(e,t+11)){case 114:return i+e+n+f(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return i+e+n+f(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return i+e+n+f(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return i+e+n+e+e}return e}var ie,ae,oe=Z?void 0:(ie=function(){return X(function(){return{}})},ae=new WeakMap,function(e){if(ae.has(e))return ae.get(e);var t=ie(e);return ae.set(e,t),t}),se=[function(e,t,r,a){if(e.length>-1&&!e.return)switch(e.type){case s:e.return=re(e.value,e.length);break;case l:return Y([S(e,{value:f(e.value,"@","@"+i)})],a);case o:if(e.length)return function(e,t){return e.map(t).join("")}(e.props,function(t){switch(function(e,t){return(e=t.exec(e))?e[0]:e}(t,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return Y([S(e,{props:[f(t,/:(read-\w+)/,":-moz-$1")]})],a);case"::placeholder":return Y([S(e,{props:[f(t,/:(plac\w+)/,":"+i+"input-$1")]}),S(e,{props:[f(t,/:(plac\w+)/,":-moz-$1")]}),S(e,{props:[f(t,/:(plac\w+)/,n+"input-$1")]})],a)}return""})}}],le=function(e){var n=e.key;if(Z&&"css"===n){var r=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(r,function(e){-1!==e.getAttribute("data-emotion").indexOf(" ")&&(document.head.appendChild(e),e.setAttribute("data-s",""))})}var i,a,o=e.stylisPlugins||se,s={},l=[];Z&&(i=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+n+' "]'),function(e){for(var t=e.getAttribute("data-emotion").split(" "),n=1;n<t.length;n++)s[t[n]]=!0;l.push(e)}));var u,c=[te,ne];if(oe){var h=[V],p=W(c.concat(o,h)),f=oe(o)(n),g=function(e,t){var n=t.name;return void 0===f[n]&&(f[n]=Y(H(e?e+"{"+t.styles+"}":t.styles),p)),f[n]};a=function(e,t,n,r){var i=t.name,a=g(e,t);return void 0===v.compat?(r&&(v.inserted[i]=!0),a):r?void(v.inserted[i]=a):a}}else{var m,d=[V,(u=function(e){m.insert(e)},function(e){e.root||(e=e.return)&&u(e)})],y=W(c.concat(o,d));a=function(e,t,n,r){m=n,Y(H(e?e+"{"+t.styles+"}":t.styles),y),r&&(v.inserted[t.name]=!0)}}var v={key:n,sheet:new t({key:n,container:i,nonce:e.nonce,speedy:e.speedy,prepend:e.prepend,insertionPoint:e.insertionPoint}),nonce:e.nonce,inserted:s,registered:{},insert:a};return v.sheet.hydrate(l),v};var ue={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},ce=/[A-Z]|^ms/g,he=/_EMO_([^_]+?)_([^]*?)_EMO_/g,pe=function(e){return 45===e.charCodeAt(1)},fe=function(e){return null!=e&&"boolean"!=typeof e},ge=X(function(e){return pe(e)?e:e.replace(ce,"-$&").toLowerCase()}),me=function(e,t){switch(e){case"animation":case"animationName":if("string"==typeof t)return t.replace(he,function(e,t,n){return ye={name:t,styles:n,next:ye},t})}return 1===ue[e]||pe(e)||"number"!=typeof t||0===t?t:t+"px"};function de(e,t,n){if(null==n)return"";var r=n;if(void 0!==r.__emotion_styles)return r;switch(typeof n){case"boolean":return"";case"object":var i=n;if(1===i.anim)return ye={name:i.name,styles:i.styles,next:ye},i.name;var a=n;if(void 0!==a.styles){var o=a.next;if(void 0!==o)for(;void 0!==o;)ye={name:o.name,styles:o.styles,next:ye},o=o.next;return a.styles+";"}return function(e,t,n){var r="";if(Array.isArray(n))for(var i=0;i<n.length;i++)r+=de(e,t,n[i])+";";else for(var a in n){var o=n[a];if("object"!=typeof o){var s=o;null!=t&&void 0!==t[s]?r+=a+"{"+t[s]+"}":fe(s)&&(r+=ge(a)+":"+me(a,s)+";")}else if(!Array.isArray(o)||"string"!=typeof o[0]||null!=t&&void 0!==t[o[0]]){var l=de(e,t,o);switch(a){case"animation":case"animationName":r+=ge(a)+":"+l+";";break;default:r+=a+"{"+l+"}"}}else for(var u=0;u<o.length;u++)fe(o[u])&&(r+=ge(a)+":"+me(a,o[u])+";")}return r}(e,t,n);case"function":if(void 0!==e){var s=ye,l=n(e);return ye=s,de(e,t,l)}}var u=n;if(null==t)return u;var c=t[u];return void 0!==c?c:u}var ye,ve=/label:\s*([^\s;{]+)\s*(;|$)/g;function we(e,t,n){if(1===e.length&&"object"==typeof e[0]&&null!==e[0]&&void 0!==e[0].styles)return e[0];var r=!0,i="";ye=void 0;var a=e[0];null==a||void 0===a.raw?(r=!1,i+=de(n,t,a)):i+=a[0];for(var o=1;o<e.length;o++){if(i+=de(n,t,e[o]),r)i+=a[o]}ve.lastIndex=0;for(var s,l="";null!==(s=ve.exec(i));)l+="-"+s[1];var u=function(e){for(var t,n=0,r=0,i=e.length;i>=4;++r,i-=4)t=1540483477*(65535&(t=255&e.charCodeAt(r)|(255&e.charCodeAt(++r))<<8|(255&e.charCodeAt(++r))<<16|(255&e.charCodeAt(++r))<<24))+(59797*(t>>>16)<<16),n=1540483477*(65535&(t^=t>>>24))+(59797*(t>>>16)<<16)^1540483477*(65535&n)+(59797*(n>>>16)<<16);switch(i){case 3:n^=(255&e.charCodeAt(r+2))<<16;case 2:n^=(255&e.charCodeAt(r+1))<<8;case 1:n=1540483477*(65535&(n^=255&e.charCodeAt(r)))+(59797*(n>>>16)<<16)}return(((n=1540483477*(65535&(n^=n>>>13))+(59797*(n>>>16)<<16))^n>>>15)>>>0).toString(36)}(i)+l;return{name:u,styles:i,next:ye}}var be="undefined"!=typeof document;function _e(e,t,n){var r="";return n.split(" ").forEach(function(n){void 0!==e[n]?t.push(e[n]+";"):n&&(r+=n+" ")}),r}var ke=function(e,t,n){!function(e,t,n){var r=e.key+"-"+t.name;(!1===n||!1===be&&void 0!==e.compat)&&void 0===e.registered[r]&&(e.registered[r]=t.styles)}(e,t,n);var r=e.key+"-"+t.name;if(void 0===e.inserted[t.name]){var i="",a=t;do{var o=e.insert(t===a?"."+r:"",a,e.sheet,!0);be||void 0===o||(i+=o),a=a.next}while(void 0!==a);if(!be&&0!==i.length)return i}};function xe(e,t){if(void 0===e.inserted[t.name])return e.insert("",t,e.sheet,!0)}function Me(e,t,n){var r=[],i=_e(e,r,n);return r.length<2?n:i+t(r)}var ze=function e(t){for(var n="",r=0;r<t.length;r++){var i=t[r];if(null!=i){var a=void 0;switch(typeof i){case"boolean":break;case"object":if(Array.isArray(i))a=e(i);else for(var o in a="",i)i[o]&&o&&(a&&(a+=" "),a+=o);break;default:a=i}a&&(n&&(n+=" "),n+=a)}}return n},Ce=function(e){var t=le(e);t.sheet.speedy=function(e){this.isSpeedy=e},t.compat=!0;var n=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];var i=we(n,t.registered,void 0);return ke(t,i,!1),t.key+"-"+i.name};return{css:n,cx:function(){for(var e=arguments.length,r=new Array(e),i=0;i<e;i++)r[i]=arguments[i];return Me(t.registered,n,ze(r))},injectGlobal:function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];var i=we(n,t.registered);xe(t,i)},keyframes:function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];var i=we(n,t.registered),a="animation-"+i.name;return xe(t,{name:i.name,styles:"@keyframes "+a+"{"+i.styles+"}"}),a},hydrate:function(e){e.forEach(function(e){t.inserted[e]=!0})},flush:function(){t.registered={},t.inserted={},t.sheet.flush()},sheet:t.sheet,cache:t,getRegisteredStyles:_e.bind(null,t.registered),merge:Me.bind(null,t.registered,n)}}({key:"css"}),Se=Ce.injectGlobal,Ae=Ce.css;function Te(e,t){return null==e||null==t?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function $e(e,t){return null==e||null==t?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function De(e){let t,n,r;function i(e,r,i=0,a=e.length){if(i<a){if(0!==t(r,r))return a;do{const t=i+a>>>1;n(e[t],r)<0?i=t+1:a=t}while(i<a)}return i}return 2!==e.length?(t=Te,n=(t,n)=>Te(e(t),n),r=(t,n)=>e(t)-n):(t=e===Te||e===$e?e:Ee,n=e,r=e),{left:i,center:function(e,t,n=0,a=e.length){const o=i(e,t,n,a-1);return o>n&&r(e[o-1],t)>-r(e[o],t)?o-1:o},right:function(e,r,i=0,a=e.length){if(i<a){if(0!==t(r,r))return a;do{const t=i+a>>>1;n(e[t],r)<=0?i=t+1:a=t}while(i<a)}return i}}}function Ee(){return 0}const Ne=De(Te).right;De(function(e){return null===e?NaN:+e}).center;var Oe=Ne;const je=Math.sqrt(50),Pe=Math.sqrt(10),Le=Math.sqrt(2);function Fe(e,t,n){const r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),a=r/Math.pow(10,i),o=a>=je?10:a>=Pe?5:a>=Le?2:1;let s,l,u;return i<0?(u=Math.pow(10,-i)/o,s=Math.round(e*u),l=Math.round(t*u),s/u<e&&++s,l/u>t&&--l,u=-u):(u=Math.pow(10,i)*o,s=Math.round(e/u),l=Math.round(t/u),s*u<e&&++s,l*u>t&&--l),l<s&&.5<=n&&n<2?Fe(e,t,2*n):[s,l,u]}function Ue(e,t,n){return Fe(e=+e,t=+t,n=+n)[2]}function Re(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=0|Math.max(0,Math.ceil((t-e)/n)),a=new Array(i);++r<i;)a[r]=e+r*n;return a}var Ge={value:()=>{}};function He(){for(var e,t=0,n=arguments.length,r={};t<n;++t){if(!(e=arguments[t]+"")||e in r||/[\s.]/.test(e))throw new Error("illegal type: "+e);r[e]=[]}return new Ie(r)}function Ie(e){this._=e}function Ke(e,t){for(var n,r=0,i=e.length;r<i;++r)if((n=e[r]).name===t)return n.value}function qe(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=Ge,e=e.slice(0,r).concat(e.slice(r+1));break}return null!=n&&e.push({name:t,value:n}),e}Ie.prototype=He.prototype={constructor:Ie,on:function(e,t){var n,r,i=this._,a=(r=i,(e+"").trim().split(/^|\s+/).map(function(e){var t="",n=e.indexOf(".");if(n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),e&&!r.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:t}})),o=-1,s=a.length;if(!(arguments.length<2)){if(null!=t&&"function"!=typeof t)throw new Error("invalid callback: "+t);for(;++o<s;)if(n=(e=a[o]).type)i[n]=qe(i[n],e.name,t);else if(null==t)for(n in i)i[n]=qe(i[n],e.name,null);return this}for(;++o<s;)if((n=(e=a[o]).type)&&(n=Ke(i[n],e.name)))return n},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Ie(e)},call:function(e,t){if((n=arguments.length-2)>0)for(var n,r,i=new Array(n),a=0;a<n;++a)i[a]=arguments[a+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(a=0,n=(r=this._[e]).length;a<n;++a)r[a].value.apply(t,i)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(t,n)}};var Be="http://www.w3.org/1999/xhtml",Ye={svg:"http://www.w3.org/2000/svg",xhtml:Be,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ve(e){var t=e+="",n=t.indexOf(":");return n>=0&&"xmlns"!==(t=e.slice(0,n))&&(e=e.slice(n+1)),Ye.hasOwnProperty(t)?{space:Ye[t],local:e}:e}function We(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Be&&t.documentElement.namespaceURI===Be?t.createElement(e):t.createElementNS(n,e)}}function Xe(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Ze(e){var t=Ve(e);return(t.local?Xe:We)(t)}function Je(){}function Qe(e){return null==e?Je:function(){return this.querySelector(e)}}function et(){return[]}function tt(e){return null==e?et:function(){return this.querySelectorAll(e)}}function nt(e){return function(){return function(e){return null==e?[]:Array.isArray(e)?e:Array.from(e)}(e.apply(this,arguments))}}function rt(e){return function(){return this.matches(e)}}function it(e){return function(t){return t.matches(e)}}var at=Array.prototype.find;function ot(){return this.firstElementChild}var st=Array.prototype.filter;function lt(){return Array.from(this.children)}function ut(e){return new Array(e.length)}function ct(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}function ht(e,t,n,r,i,a){for(var o,s=0,l=t.length,u=a.length;s<u;++s)(o=t[s])?(o.__data__=a[s],r[s]=o):n[s]=new ct(e,a[s]);for(;s<l;++s)(o=t[s])&&(i[s]=o)}function pt(e,t,n,r,i,a,o){var s,l,u,c=new Map,h=t.length,p=a.length,f=new Array(h);for(s=0;s<h;++s)(l=t[s])&&(f[s]=u=o.call(l,l.__data__,s,t)+"",c.has(u)?i[s]=l:c.set(u,l));for(s=0;s<p;++s)u=o.call(e,a[s],s,a)+"",(l=c.get(u))?(r[s]=l,l.__data__=a[s],c.delete(u)):n[s]=new ct(e,a[s]);for(s=0;s<h;++s)(l=t[s])&&c.get(f[s])===l&&(i[s]=l)}function ft(e){return e.__data__}function gt(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function mt(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function dt(e){return function(){this.removeAttribute(e)}}function yt(e){return function(){this.removeAttributeNS(e.space,e.local)}}function vt(e,t){return function(){this.setAttribute(e,t)}}function wt(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function bt(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttribute(e):this.setAttribute(e,n)}}function _t(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function kt(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function xt(e){return function(){this.style.removeProperty(e)}}function Mt(e,t,n){return function(){this.style.setProperty(e,t,n)}}function zt(e,t,n){return function(){var r=t.apply(this,arguments);null==r?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function Ct(e,t){return e.style.getPropertyValue(t)||kt(e).getComputedStyle(e,null).getPropertyValue(t)}function St(e){return function(){delete this[e]}}function At(e,t){return function(){this[e]=t}}function Tt(e,t){return function(){var n=t.apply(this,arguments);null==n?delete this[e]:this[e]=n}}function $t(e){return e.trim().split(/^|\s+/)}function Dt(e){return e.classList||new Et(e)}function Et(e){this._node=e,this._names=$t(e.getAttribute("class")||"")}function Nt(e,t){for(var n=Dt(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function Ot(e,t){for(var n=Dt(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function jt(e){return function(){Nt(this,e)}}function Pt(e){return function(){Ot(this,e)}}function Lt(e,t){return function(){(t.apply(this,arguments)?Nt:Ot)(this,e)}}function Ft(){this.textContent=""}function Ut(e){return function(){this.textContent=e}}function Rt(e){return function(){var t=e.apply(this,arguments);this.textContent=null==t?"":t}}function Gt(){this.innerHTML=""}function Ht(e){return function(){this.innerHTML=e}}function It(e){return function(){var t=e.apply(this,arguments);this.innerHTML=null==t?"":t}}function Kt(){this.nextSibling&&this.parentNode.appendChild(this)}function qt(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Bt(){return null}function Yt(){var e=this.parentNode;e&&e.removeChild(this)}function Vt(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Wt(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Xt(e){return function(){var t=this.__on;if(t){for(var n,r=0,i=-1,a=t.length;r<a;++r)n=t[r],e.type&&n.type!==e.type||n.name!==e.name?t[++i]=n:this.removeEventListener(n.type,n.listener,n.options);++i?t.length=i:delete this.__on}}}function Zt(e,t,n){return function(){var r,i=this.__on,a=function(e){return function(t){e.call(this,t,this.__data__)}}(t);if(i)for(var o=0,s=i.length;o<s;++o)if((r=i[o]).type===e.type&&r.name===e.name)return this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=a,r.options=n),void(r.value=t);this.addEventListener(e.type,a,n),r={type:e.type,name:e.name,value:t,listener:a,options:n},i?i.push(r):this.__on=[r]}}function Jt(e,t,n){var r=kt(e),i=r.CustomEvent;"function"==typeof i?i=new i(t,n):(i=r.document.createEvent("Event"),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function Qt(e,t){return function(){return Jt(this,e,t)}}function en(e,t){return function(){return Jt(this,e,t.apply(this,arguments))}}ct.prototype={constructor:ct,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}},Et.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};var tn=[null];function nn(e,t){this._groups=e,this._parents=t}function rn(){return new nn([[document.documentElement]],tn)}function an(e){return"string"==typeof e?new nn([[document.querySelector(e)]],[document.documentElement]):new nn([[e]],tn)}nn.prototype=rn.prototype={constructor:nn,select:function(e){"function"!=typeof e&&(e=Qe(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var a,o,s=t[i],l=s.length,u=r[i]=new Array(l),c=0;c<l;++c)(a=s[c])&&(o=e.call(a,a.__data__,c,s))&&("__data__"in a&&(o.__data__=a.__data__),u[c]=o);return new nn(r,this._parents)},selectAll:function(e){e="function"==typeof e?nt(e):tt(e);for(var t=this._groups,n=t.length,r=[],i=[],a=0;a<n;++a)for(var o,s=t[a],l=s.length,u=0;u<l;++u)(o=s[u])&&(r.push(e.call(o,o.__data__,u,s)),i.push(o));return new nn(r,i)},selectChild:function(e){return this.select(null==e?ot:function(e){return function(){return at.call(this.children,e)}}("function"==typeof e?e:it(e)))},selectChildren:function(e){return this.selectAll(null==e?lt:function(e){return function(){return st.call(this.children,e)}}("function"==typeof e?e:it(e)))},filter:function(e){"function"!=typeof e&&(e=rt(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var a,o=t[i],s=o.length,l=r[i]=[],u=0;u<s;++u)(a=o[u])&&e.call(a,a.__data__,u,o)&&l.push(a);return new nn(r,this._parents)},data:function(e,t){if(!arguments.length)return Array.from(this,ft);var n=t?pt:ht,r=this._parents,i=this._groups;"function"!=typeof e&&(e=function(e){return function(){return e}}(e));for(var a=i.length,o=new Array(a),s=new Array(a),l=new Array(a),u=0;u<a;++u){var c=r[u],h=i[u],p=h.length,f=gt(e.call(c,c&&c.__data__,u,r)),g=f.length,m=s[u]=new Array(g),d=o[u]=new Array(g);n(c,h,m,d,l[u]=new Array(p),f,t);for(var y,v,w=0,b=0;w<g;++w)if(y=m[w]){for(w>=b&&(b=w+1);!(v=d[b])&&++b<g;);y._next=v||null}}return(o=new nn(o,r))._enter=s,o._exit=l,o},enter:function(){return new nn(this._enter||this._groups.map(ut),this._parents)},exit:function(){return new nn(this._exit||this._groups.map(ut),this._parents)},join:function(e,t,n){var r=this.enter(),i=this,a=this.exit();return"function"==typeof e?(r=e(r))&&(r=r.selection()):r=r.append(e+""),null!=t&&(i=t(i))&&(i=i.selection()),null==n?a.remove():n(a),r&&i?r.merge(i).order():i},merge:function(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,a=r.length,o=Math.min(i,a),s=new Array(i),l=0;l<o;++l)for(var u,c=n[l],h=r[l],p=c.length,f=s[l]=new Array(p),g=0;g<p;++g)(u=c[g]||h[g])&&(f[g]=u);for(;l<i;++l)s[l]=n[l];return new nn(s,this._parents)},selection:function(){return this},order:function(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r,i=e[t],a=i.length-1,o=i[a];--a>=0;)(r=i[a])&&(o&&4^r.compareDocumentPosition(o)&&o.parentNode.insertBefore(r,o),o=r);return this},sort:function(e){function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}e||(e=mt);for(var n=this._groups,r=n.length,i=new Array(r),a=0;a<r;++a){for(var o,s=n[a],l=s.length,u=i[a]=new Array(l),c=0;c<l;++c)(o=s[c])&&(u[c]=o);u.sort(t)}return new nn(i,this._parents).order()},call:function(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length;i<a;++i){var o=r[i];if(o)return o}return null},size:function(){let e=0;for(const t of this)++e;return e},empty:function(){return!this.node()},each:function(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i,a=t[n],o=0,s=a.length;o<s;++o)(i=a[o])&&e.call(i,i.__data__,o,a);return this},attr:function(e,t){var n=Ve(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((null==t?n.local?yt:dt:"function"==typeof t?n.local?_t:bt:n.local?wt:vt)(n,t))},style:function(e,t,n){return arguments.length>1?this.each((null==t?xt:"function"==typeof t?zt:Mt)(e,t,null==n?"":n)):Ct(this.node(),e)},property:function(e,t){return arguments.length>1?this.each((null==t?St:"function"==typeof t?Tt:At)(e,t)):this.node()[e]},classed:function(e,t){var n=$t(e+"");if(arguments.length<2){for(var r=Dt(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each(("function"==typeof t?Lt:t?jt:Pt)(n,t))},text:function(e){return arguments.length?this.each(null==e?Ft:("function"==typeof e?Rt:Ut)(e)):this.node().textContent},html:function(e){return arguments.length?this.each(null==e?Gt:("function"==typeof e?It:Ht)(e)):this.node().innerHTML},raise:function(){return this.each(Kt)},lower:function(){return this.each(qt)},append:function(e){var t="function"==typeof e?e:Ze(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})},insert:function(e,t){var n="function"==typeof e?e:Ze(e),r=null==t?Bt:"function"==typeof t?t:Qe(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})},remove:function(){return this.each(Yt)},clone:function(e){return this.select(e?Wt:Vt)},datum:function(e){return arguments.length?this.property("__data__",e):this.node().__data__},on:function(e,t,n){var r,i,a=function(e){return e.trim().split(/^|\s+/).map(function(e){var t="",n=e.indexOf(".");return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}(e+""),o=a.length;if(!(arguments.length<2)){for(s=t?Zt:Xt,r=0;r<o;++r)this.each(s(a[r],t,n));return this}var s=this.node().__on;if(s)for(var l,u=0,c=s.length;u<c;++u)for(r=0,l=s[u];r<o;++r)if((i=a[r]).type===l.type&&i.name===l.name)return l.value},dispatch:function(e,t){return this.each(("function"==typeof t?en:Qt)(e,t))},[Symbol.iterator]:function*(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r,i=e[t],a=0,o=i.length;a<o;++a)(r=i[a])&&(yield r)}};var on=0;function sn(){return new ln}function ln(){this._="@"+(++on).toString(36)}function un(e,t){if(e=function(e){let t;for(;t=e.sourceEvent;)e=t;return e}(e),void 0===t&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,[(r=r.matrixTransform(t.getScreenCTM().inverse())).x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}function cn(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function hn(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function pn(){}ln.prototype=sn.prototype={constructor:ln,get:function(e){for(var t=this._;!(t in e);)if(!(e=e.parentNode))return;return e[t]},set:function(e,t){return e[this._]=t},remove:function(e){return this._ in e&&delete e[this._]},toString:function(){return this._}};var fn=.7,gn=1/fn,mn="\\s*([+-]?\\d+)\\s*",dn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",yn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",vn=/^#([0-9a-f]{3,8})$/,wn=new RegExp(`^rgb\\(${mn},${mn},${mn}\\)$`),bn=new RegExp(`^rgb\\(${yn},${yn},${yn}\\)$`),_n=new RegExp(`^rgba\\(${mn},${mn},${mn},${dn}\\)$`),kn=new RegExp(`^rgba\\(${yn},${yn},${yn},${dn}\\)$`),xn=new RegExp(`^hsl\\(${dn},${yn},${yn}\\)$`),Mn=new RegExp(`^hsla\\(${dn},${yn},${yn},${dn}\\)$`),zn={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 Cn(){return this.rgb().formatHex()}function Sn(){return this.rgb().formatRgb()}function An(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=vn.exec(e))?(n=t[1].length,t=parseInt(t[1],16),6===n?Tn(t):3===n?new En(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?$n(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?$n(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=wn.exec(e))?new En(t[1],t[2],t[3],1):(t=bn.exec(e))?new En(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=_n.exec(e))?$n(t[1],t[2],t[3],t[4]):(t=kn.exec(e))?$n(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=xn.exec(e))?Fn(t[1],t[2]/100,t[3]/100,1):(t=Mn.exec(e))?Fn(t[1],t[2]/100,t[3]/100,t[4]):zn.hasOwnProperty(e)?Tn(zn[e]):"transparent"===e?new En(NaN,NaN,NaN,0):null}function Tn(e){return new En(e>>16&255,e>>8&255,255&e,1)}function $n(e,t,n,r){return r<=0&&(e=t=n=NaN),new En(e,t,n,r)}function Dn(e,t,n,r){return 1===arguments.length?((i=e)instanceof pn||(i=An(i)),i?new En((i=i.rgb()).r,i.g,i.b,i.opacity):new En):new En(e,t,n,null==r?1:r);var i}function En(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}function Nn(){return`#${Ln(this.r)}${Ln(this.g)}${Ln(this.b)}`}function On(){const e=jn(this.opacity);return`${1===e?"rgb(":"rgba("}${Pn(this.r)}, ${Pn(this.g)}, ${Pn(this.b)}${1===e?")":`, ${e})`}`}function jn(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Pn(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Ln(e){return((e=Pn(e))<16?"0":"")+e.toString(16)}function Fn(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Rn(e,t,n,r)}function Un(e){if(e instanceof Rn)return new Rn(e.h,e.s,e.l,e.opacity);if(e instanceof pn||(e=An(e)),!e)return new Rn;if(e instanceof Rn)return e;var t=(e=e.rgb()).r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,l=(a+i)/2;return s?(o=t===a?(n-r)/s+6*(n<r):n===a?(r-t)/s+2:(t-n)/s+4,s/=l<.5?a+i:2-a-i,o*=60):s=l>0&&l<1?0:o,new Rn(o,s,l,e.opacity)}function Rn(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function Gn(e){return(e=(e||0)%360)<0?e+360:e}function Hn(e){return Math.max(0,Math.min(1,e||0))}function In(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}cn(pn,An,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Cn,formatHex:Cn,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Un(this).formatHsl()},formatRgb:Sn,toString:Sn}),cn(En,Dn,hn(pn,{brighter(e){return e=null==e?gn:Math.pow(gn,e),new En(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?fn:Math.pow(fn,e),new En(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new En(Pn(this.r),Pn(this.g),Pn(this.b),jn(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:Nn,formatHex:Nn,formatHex8:function(){return`#${Ln(this.r)}${Ln(this.g)}${Ln(this.b)}${Ln(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:On,toString:On})),cn(Rn,function(e,t,n,r){return 1===arguments.length?Un(e):new Rn(e,t,n,null==r?1:r)},hn(pn,{brighter(e){return e=null==e?gn:Math.pow(gn,e),new Rn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?fn:Math.pow(fn,e),new Rn(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new En(In(e>=240?e-240:e+120,i,r),In(e,i,r),In(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Rn(Gn(this.h),Hn(this.s),Hn(this.l),jn(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 e=jn(this.opacity);return`${1===e?"hsl(":"hsla("}${Gn(this.h)}, ${100*Hn(this.s)}%, ${100*Hn(this.l)}%${1===e?")":`, ${e})`}`}}));var Kn=e=>()=>e;function qn(e){return 1===(e=+e)?Bn:function(t,n){return n-t?function(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}(t,n,e):Kn(isNaN(t)?n:t)}}function Bn(e,t){var n=t-e;return n?function(e,t){return function(n){return e+n*t}}(e,n):Kn(isNaN(e)?t:e)}var Yn=function e(t){var n=qn(t);function r(e,t){var r=n((e=Dn(e)).r,(t=Dn(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=Bn(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+""}}return r.gamma=e,r}(1);function Vn(e,t){t||(t=[]);var n,r=e?Math.min(t.length,e.length):0,i=t.slice();return function(a){for(n=0;n<r;++n)i[n]=e[n]*(1-a)+t[n]*a;return i}}function Wn(e,t){var n,r=t?t.length:0,i=e?Math.min(r,e.length):0,a=new Array(i),o=new Array(r);for(n=0;n<i;++n)a[n]=nr(e[n],t[n]);for(;n<r;++n)o[n]=t[n];return function(e){for(n=0;n<i;++n)o[n]=a[n](e);return o}}function Xn(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function Zn(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function Jn(e,t){var n,r={},i={};for(n in null!==e&&"object"==typeof e||(e={}),null!==t&&"object"==typeof t||(t={}),t)n in e?r[n]=nr(e[n],t[n]):i[n]=t[n];return function(e){for(n in r)i[n]=r[n](e);return i}}var Qn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,er=new RegExp(Qn.source,"g");function tr(e,t){var n,r,i,a=Qn.lastIndex=er.lastIndex=0,o=-1,s=[],l=[];for(e+="",t+="";(n=Qn.exec(e))&&(r=er.exec(t));)(i=r.index)>a&&(i=t.slice(a,i),s[o]?s[o]+=i:s[++o]=i),(n=n[0])===(r=r[0])?s[o]?s[o]+=r:s[++o]=r:(s[++o]=null,l.push({i:o,x:Zn(n,r)})),a=er.lastIndex;return a<t.length&&(i=t.slice(a),s[o]?s[o]+=i:s[++o]=i),s.length<2?l[0]?function(e){return function(t){return e(t)+""}}(l[0].x):function(e){return function(){return e}}(t):(t=l.length,function(e){for(var n,r=0;r<t;++r)s[(n=l[r]).i]=n.x(e);return s.join("")})}function nr(e,t){var n,r=typeof t;return null==t||"boolean"===r?Kn(t):("number"===r?Zn:"string"===r?(n=An(t))?(t=n,Yn):tr:t instanceof An?Yn:t instanceof Date?Xn:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}(t)?Vn:Array.isArray(t)?Wn:"function"!=typeof t.valueOf&&"function"!=typeof t.toString||isNaN(t)?Jn:Zn)(e,t)}function rr(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}var ir,ar=180/Math.PI,or={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function sr(e,t,n,r,i,a){var o,s,l;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(l=e*n+t*r)&&(n-=e*l,r-=t*l),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,l/=s),e*r<t*n&&(e=-e,t=-t,l=-l,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*ar,skewX:Math.atan(l)*ar,scaleX:o,scaleY:s}}function lr(e,t,n,r){function i(e){return e.length?e.pop()+" ":""}return function(a,o){var s=[],l=[];return a=e(a),o=e(o),function(e,r,i,a,o,s){if(e!==i||r!==a){var l=o.push("translate(",null,t,null,n);s.push({i:l-4,x:Zn(e,i)},{i:l-2,x:Zn(r,a)})}else(i||a)&&o.push("translate("+i+t+a+n)}(a.translateX,a.translateY,o.translateX,o.translateY,s,l),function(e,t,n,a){e!==t?(e-t>180?t+=360:t-e>180&&(e+=360),a.push({i:n.push(i(n)+"rotate(",null,r)-2,x:Zn(e,t)})):t&&n.push(i(n)+"rotate("+t+r)}(a.rotate,o.rotate,s,l),function(e,t,n,a){e!==t?a.push({i:n.push(i(n)+"skewX(",null,r)-2,x:Zn(e,t)}):t&&n.push(i(n)+"skewX("+t+r)}(a.skewX,o.skewX,s,l),function(e,t,n,r,a,o){if(e!==n||t!==r){var s=a.push(i(a)+"scale(",null,",",null,")");o.push({i:s-4,x:Zn(e,n)},{i:s-2,x:Zn(t,r)})}else 1===n&&1===r||a.push(i(a)+"scale("+n+","+r+")")}(a.scaleX,a.scaleY,o.scaleX,o.scaleY,s,l),a=o=null,function(e){for(var t,n=-1,r=l.length;++n<r;)s[(t=l[n]).i]=t.x(e);return s.join("")}}}var ur,cr,hr=lr(function(e){const t=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?or:sr(t.a,t.b,t.c,t.d,t.e,t.f)},"px, ","px)","deg)"),pr=lr(function(e){return null==e?or:(ir||(ir=document.createElementNS("http://www.w3.org/2000/svg","g")),ir.setAttribute("transform",e),(e=ir.transform.baseVal.consolidate())?sr((e=e.matrix).a,e.b,e.c,e.d,e.e,e.f):or)},", ",")",")"),fr=0,gr=0,mr=0,dr=0,yr=0,vr=0,wr="object"==typeof performance&&performance.now?performance:Date,br="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function _r(){return yr||(br(kr),yr=wr.now()+vr)}function kr(){yr=0}function xr(){this._call=this._time=this._next=null}function Mr(e,t,n){var r=new xr;return r.restart(e,t,n),r}function zr(){yr=(dr=wr.now())+vr,fr=gr=0;try{!function(){_r(),++fr;for(var e,t=ur;t;)(e=yr-t._time)>=0&&t._call.call(void 0,e),t=t._next;--fr}()}finally{fr=0,function(){var e,t,n=ur,r=1/0;for(;n;)n._call?(r>n._time&&(r=n._time),e=n,n=n._next):(t=n._next,n._next=null,n=e?e._next=t:ur=t);cr=e,Sr(r)}(),yr=0}}function Cr(){var e=wr.now(),t=e-dr;t>1e3&&(vr-=t,dr=e)}function Sr(e){fr||(gr&&(gr=clearTimeout(gr)),e-yr>24?(e<1/0&&(gr=setTimeout(zr,e-wr.now()-vr)),mr&&(mr=clearInterval(mr))):(mr||(dr=wr.now(),mr=setInterval(Cr,1e3)),fr=1,br(zr)))}function Ar(e,t,n){var r=new xr;return t=null==t?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}xr.prototype=Mr.prototype={constructor:xr,restart:function(e,t,n){if("function"!=typeof e)throw new TypeError("callback is not a function");n=(null==n?_r():+n)+(null==t?0:+t),this._next||cr===this||(cr?cr._next=this:ur=this,cr=this),this._call=e,this._time=n,Sr()},stop:function(){this._call&&(this._call=null,this._time=1/0,Sr())}};var Tr=He("start","end","cancel","interrupt"),$r=[];function Dr(e,t,n,r,i,a){var o=e.__transition;if(o){if(n in o)return}else e.__transition={};!function(e,t,n){var r,i=e.__transition;function a(e){n.state=1,n.timer.restart(o,n.delay,n.time),n.delay<=e&&o(e-n.delay)}function o(a){var u,c,h,p;if(1!==n.state)return l();for(u in i)if((p=i[u]).name===n.name){if(3===p.state)return Ar(o);4===p.state?(p.state=6,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete i[u]):+u<t&&(p.state=6,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete i[u])}if(Ar(function(){3===n.state&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(a))}),n.state=2,n.on.call("start",e,e.__data__,n.index,n.group),2===n.state){for(n.state=3,r=new Array(h=n.tween.length),u=0,c=-1;u<h;++u)(p=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(r[++c]=p);r.length=c+1}}function s(t){for(var i=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(l),n.state=5,1),a=-1,o=r.length;++a<o;)r[a].call(e,i);5===n.state&&(n.on.call("end",e,e.__data__,n.index,n.group),l())}function l(){for(var r in n.state=6,n.timer.stop(),delete i[t],i)return;delete e.__transition}i[t]=n,n.timer=Mr(a,0,n.time)}(e,n,{name:t,index:r,group:i,on:Tr,tween:$r,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function Er(e,t){var n=Or(e,t);if(n.state>0)throw new Error("too late; already scheduled");return n}function Nr(e,t){var n=Or(e,t);if(n.state>3)throw new Error("too late; already running");return n}function Or(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function jr(e,t){var n,r;return function(){var i=Nr(this,e),a=i.tween;if(a!==n)for(var o=0,s=(r=n=a).length;o<s;++o)if(r[o].name===t){(r=r.slice()).splice(o,1);break}i.tween=r}}function Pr(e,t,n){var r,i;if("function"!=typeof n)throw new Error;return function(){var a=Nr(this,e),o=a.tween;if(o!==r){i=(r=o).slice();for(var s={name:t,value:n},l=0,u=i.length;l<u;++l)if(i[l].name===t){i[l]=s;break}l===u&&i.push(s)}a.tween=i}}function Lr(e,t,n){var r=e._id;return e.each(function(){var e=Nr(this,r);(e.value||(e.value={}))[t]=n.apply(this,arguments)}),function(e){return Or(e,r).value[t]}}function Fr(e,t){var n;return("number"==typeof t?Zn:t instanceof An?Yn:(n=An(t))?(t=n,Yn):tr)(e,t)}function Ur(e){return function(){this.removeAttribute(e)}}function Rr(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Gr(e,t,n){var r,i,a=n+"";return function(){var o=this.getAttribute(e);return o===a?null:o===r?i:i=t(r=o,n)}}function Hr(e,t,n){var r,i,a=n+"";return function(){var o=this.getAttributeNS(e.space,e.local);return o===a?null:o===r?i:i=t(r=o,n)}}function Ir(e,t,n){var r,i,a;return function(){var o,s,l=n(this);if(null!=l)return(o=this.getAttribute(e))===(s=l+"")?null:o===r&&s===i?a:(i=s,a=t(r=o,l));this.removeAttribute(e)}}function Kr(e,t,n){var r,i,a;return function(){var o,s,l=n(this);if(null!=l)return(o=this.getAttributeNS(e.space,e.local))===(s=l+"")?null:o===r&&s===i?a:(i=s,a=t(r=o,l));this.removeAttributeNS(e.space,e.local)}}function qr(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&function(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}(e,i)),n}return i._value=t,i}function Br(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&function(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}(e,i)),n}return i._value=t,i}function Yr(e,t){return function(){Er(this,e).delay=+t.apply(this,arguments)}}function Vr(e,t){return t=+t,function(){Er(this,e).delay=t}}function Wr(e,t){return function(){Nr(this,e).duration=+t.apply(this,arguments)}}function Xr(e,t){return t=+t,function(){Nr(this,e).duration=t}}var Zr=rn.prototype.constructor;function Jr(e){return function(){this.style.removeProperty(e)}}var Qr=0;function ei(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function ti(){return++Qr}var ni=rn.prototype;ei.prototype={constructor:ei,select:function(e){var t=this._name,n=this._id;"function"!=typeof e&&(e=Qe(e));for(var r=this._groups,i=r.length,a=new Array(i),o=0;o<i;++o)for(var s,l,u=r[o],c=u.length,h=a[o]=new Array(c),p=0;p<c;++p)(s=u[p])&&(l=e.call(s,s.__data__,p,u))&&("__data__"in s&&(l.__data__=s.__data__),h[p]=l,Dr(h[p],t,n,p,h,Or(s,n)));return new ei(a,this._parents,t,n)},selectAll:function(e){var t=this._name,n=this._id;"function"!=typeof e&&(e=tt(e));for(var r=this._groups,i=r.length,a=[],o=[],s=0;s<i;++s)for(var l,u=r[s],c=u.length,h=0;h<c;++h)if(l=u[h]){for(var p,f=e.call(l,l.__data__,h,u),g=Or(l,n),m=0,d=f.length;m<d;++m)(p=f[m])&&Dr(p,t,n,m,f,g);a.push(f),o.push(l)}return new ei(a,o,t,n)},selectChild:ni.selectChild,selectChildren:ni.selectChildren,filter:function(e){"function"!=typeof e&&(e=rt(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var a,o=t[i],s=o.length,l=r[i]=[],u=0;u<s;++u)(a=o[u])&&e.call(a,a.__data__,u,o)&&l.push(a);return new ei(r,this._parents,this._name,this._id)},merge:function(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,i=n.length,a=Math.min(r,i),o=new Array(r),s=0;s<a;++s)for(var l,u=t[s],c=n[s],h=u.length,p=o[s]=new Array(h),f=0;f<h;++f)(l=u[f]||c[f])&&(p[f]=l);for(;s<r;++s)o[s]=t[s];return new ei(o,this._parents,this._name,this._id)},selection:function(){return new Zr(this._groups,this._parents)},transition:function(){for(var e=this._name,t=this._id,n=ti(),r=this._groups,i=r.length,a=0;a<i;++a)for(var o,s=r[a],l=s.length,u=0;u<l;++u)if(o=s[u]){var c=Or(o,t);Dr(o,e,n,u,s,{time:c.time+c.delay+c.duration,delay:0,duration:c.duration,ease:c.ease})}return new ei(r,this._parents,e,n)},call:ni.call,nodes:ni.nodes,node:ni.node,size:ni.size,empty:ni.empty,each:ni.each,on:function(e,t){var n=this._id;return arguments.length<2?Or(this.node(),n).on.on(e):this.each(function(e,t,n){var r,i,a=function(e){return(e+"").trim().split(/^|\s+/).every(function(e){var t=e.indexOf(".");return t>=0&&(e=e.slice(0,t)),!e||"start"===e})}(t)?Er:Nr;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}(n,e,t))},attr:function(e,t){var n=Ve(e),r="transform"===n?pr:Fr;return this.attrTween(e,"function"==typeof t?(n.local?Kr:Ir)(n,r,Lr(this,"attr."+e,t)):null==t?(n.local?Rr:Ur)(n):(n.local?Hr:Gr)(n,r,t))},attrTween:function(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==t)return this.tween(n,null);if("function"!=typeof t)throw new Error;var r=Ve(e);return this.tween(n,(r.local?qr:Br)(r,t))},style:function(e,t,n){var r="transform"==(e+="")?hr:Fr;return null==t?this.styleTween(e,function(e,t){var n,r,i;return function(){var a=Ct(this,e),o=(this.style.removeProperty(e),Ct(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}(e,r)).on("end.style."+e,Jr(e)):"function"==typeof t?this.styleTween(e,function(e,t,n){var r,i,a;return function(){var o=Ct(this,e),s=n(this),l=s+"";return null==s&&(this.style.removeProperty(e),l=s=Ct(this,e)),o===l?null:o===r&&l===i?a:(i=l,a=t(r=o,s))}}(e,r,Lr(this,"style."+e,t))).each(function(e,t){var n,r,i,a,o="style."+t,s="end."+o;return function(){var l=Nr(this,e),u=l.on,c=null==l.value[o]?a||(a=Jr(t)):void 0;u===n&&i===c||(r=(n=u).copy()).on(s,i=c),l.on=r}}(this._id,e)):this.styleTween(e,function(e,t,n){var r,i,a=n+"";return function(){var o=Ct(this,e);return o===a?null:o===r?i:i=t(r=o,n)}}(e,r,t),n).on("end.style."+e,null)},styleTween:function(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==t)return this.tween(r,null);if("function"!=typeof t)throw new Error;return this.tween(r,function(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&function(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}(e,a,n)),r}return a._value=t,a}(e,t,null==n?"":n))},text:function(e){return this.tween("text","function"==typeof e?function(e){return function(){var t=e(this);this.textContent=null==t?"":t}}(Lr(this,"text",e)):function(e){return function(){this.textContent=e}}(null==e?"":e+""))},textTween:function(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(null==e)return this.tween(t,null);if("function"!=typeof e)throw new Error;return this.tween(t,function(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&function(e){return function(t){this.textContent=e.call(this,t)}}(r)),t}return r._value=e,r}(e))},remove:function(){return this.on("end.remove",function(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}(this._id))},tween:function(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r,i=Or(this.node(),n).tween,a=0,o=i.length;a<o;++a)if((r=i[a]).name===e)return r.value;return null}return this.each((null==t?jr:Pr)(n,e,t))},delay:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?Yr:Vr)(t,e)):Or(this.node(),t).delay},duration:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?Wr:Xr)(t,e)):Or(this.node(),t).duration},ease:function(e){var t=this._id;return arguments.length?this.each(function(e,t){if("function"!=typeof t)throw new Error;return function(){Nr(this,e).ease=t}}(t,e)):Or(this.node(),t).ease},easeVarying:function(e){if("function"!=typeof e)throw new Error;return this.each(function(e,t){return function(){var n=t.apply(this,arguments);if("function"!=typeof n)throw new Error;Nr(this,e).ease=n}}(this._id,e))},end:function(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(a,o){var s={value:o},l={value:function(){0===--i&&a()}};n.each(function(){var n=Nr(this,r),i=n.on;i!==e&&((t=(e=i).copy())._.cancel.push(s),t._.interrupt.push(s),t._.end.push(l)),n.on=t}),0===i&&a()})},[Symbol.iterator]:ni[Symbol.iterator]};const ri=e=>+e;var ii={time:null,delay:0,duration:250,ease:function(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}};function ai(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}rn.prototype.interrupt=function(e){return this.each(function(){!function(e,t){var n,r,i,a=e.__transition,o=!0;if(a){for(i in t=null==t?null:t+"",a)(n=a[i]).name===t?(r=n.state>2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(r?"interrupt":"cancel",e,e.__data__,n.index,n.group),delete a[i]):o=!1;o&&delete e.__transition}}(this,e)})},rn.prototype.transition=function(e){var t,n;e instanceof ei?(t=e._id,e=e._name):(t=ti(),(n=ii).time=_r(),e=null==e?null:e+"");for(var r=this._groups,i=r.length,a=0;a<i;++a)for(var o,s=r[a],l=s.length,u=0;u<l;++u)(o=s[u])&&Dr(o,e,t,u,s,n||ai(o,t));return new ei(r,this._parents,e,t)};const oi=Math.PI,si=2*oi,li=1e-6,ui=si-li;function ci(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}class hi{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=null==e?ci:function(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return ci;const n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=Math.round(arguments[t]*n)/n+e[t]}}(e)}moveTo(e,t){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,t){this._append`L${this._x1=+e},${this._y1=+t}`}quadraticCurveTo(e,t,n,r){this._append`Q${+e},${+t},${this._x1=+n},${this._y1=+r}`}bezierCurveTo(e,t,n,r,i,a){this._append`C${+e},${+t},${+n},${+r},${this._x1=+i},${this._y1=+a}`}arcTo(e,t,n,r,i){if(e=+e,t=+t,n=+n,r=+r,(i=+i)<0)throw new Error(`negative radius: ${i}`);let a=this._x1,o=this._y1,s=n-e,l=r-t,u=a-e,c=o-t,h=u*u+c*c;if(null===this._x1)this._append`M${this._x1=e},${this._y1=t}`;else if(h>li)if(Math.abs(c*s-l*u)>li&&i){let p=n-a,f=r-o,g=s*s+l*l,m=p*p+f*f,d=Math.sqrt(g),y=Math.sqrt(h),v=i*Math.tan((oi-Math.acos((g+h-m)/(2*d*y)))/2),w=v/y,b=v/d;Math.abs(w-1)>li&&this._append`L${e+w*u},${t+w*c}`,this._append`A${i},${i},0,0,${+(c*p>u*f)},${this._x1=e+b*s},${this._y1=t+b*l}`}else this._append`L${this._x1=e},${this._y1=t}`;else;}arc(e,t,n,r,i,a){if(e=+e,t=+t,a=!!a,(n=+n)<0)throw new Error(`negative radius: ${n}`);let o=n*Math.cos(r),s=n*Math.sin(r),l=e+o,u=t+s,c=1^a,h=a?r-i:i-r;null===this._x1?this._append`M${l},${u}`:(Math.abs(this._x1-l)>li||Math.abs(this._y1-u)>li)&&this._append`L${l},${u}`,n&&(h<0&&(h=h%si+si),h>ui?this._append`A${n},${n},0,1,${c},${e-o},${t-s}A${n},${n},0,1,${c},${this._x1=l},${this._y1=u}`:h>li&&this._append`A${n},${n},0,${+(h>=oi)},${c},${this._x1=e+n*Math.cos(i)},${this._y1=t+n*Math.sin(i)}`)}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}}function pi(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function fi(e){return(e=pi(Math.abs(e)))?e[1]:NaN}var gi,mi=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function di(e){if(!(t=mi.exec(e)))throw new Error("invalid format: "+e);var t;return new yi({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}function yi(e){this.fill=void 0===e.fill?" ":e.fill+"",this.align=void 0===e.align?">":e.align+"",this.sign=void 0===e.sign?"-":e.sign+"",this.symbol=void 0===e.symbol?"":e.symbol+"",this.zero=!!e.zero,this.width=void 0===e.width?void 0:+e.width,this.comma=!!e.comma,this.precision=void 0===e.precision?void 0:+e.precision,this.trim=!!e.trim,this.type=void 0===e.type?"":e.type+""}function vi(e,t){var n=pi(e,t);if(!n)return e+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}di.prototype=yi.prototype,yi.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 wi={"%":(e,t)=>(100*e).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:function(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)},e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>vi(100*e,t),r:vi,s:function(e,t){var n=pi(e,t);if(!n)return e+"";var r=n[0],i=n[1],a=i-(gi=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,o=r.length;return a===o?r:a>o?r+new Array(a-o+1).join("0"):a>0?r.slice(0,a)+"."+r.slice(a):"0."+new Array(1-a).join("0")+pi(e,Math.max(0,t+a-1))[0]},X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function bi(e){return e}var _i,ki,xi,Mi=Array.prototype.map,zi=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Ci(e){var t,n,r=void 0===e.grouping||void 0===e.thousands?bi:(t=Mi.call(e.grouping,Number),n=e.thousands+"",function(e,r){for(var i=e.length,a=[],o=0,s=t[0],l=0;i>0&&s>0&&(l+s+1>r&&(s=Math.max(1,r-l)),a.push(e.substring(i-=s,i+s)),!((l+=s+1)>r));)s=t[o=(o+1)%t.length];return a.reverse().join(n)}),i=void 0===e.currency?"":e.currency[0]+"",a=void 0===e.currency?"":e.currency[1]+"",o=void 0===e.decimal?".":e.decimal+"",s=void 0===e.numerals?bi:function(e){return function(t){return t.replace(/[0-9]/g,function(t){return e[+t]})}}(Mi.call(e.numerals,String)),l=void 0===e.percent?"%":e.percent+"",u=void 0===e.minus?"−":e.minus+"",c=void 0===e.nan?"NaN":e.nan+"";function h(e){var t=(e=di(e)).fill,n=e.align,h=e.sign,p=e.symbol,f=e.zero,g=e.width,m=e.comma,d=e.precision,y=e.trim,v=e.type;"n"===v?(m=!0,v="g"):wi[v]||(void 0===d&&(d=12),y=!0,v="g"),(f||"0"===t&&"="===n)&&(f=!0,t="0",n="=");var w="$"===p?i:"#"===p&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",b="$"===p?a:/[%p]/.test(v)?l:"",_=wi[v],k=/[defgprs%]/.test(v);function x(e){var i,a,l,p=w,x=b;if("c"===v)x=_(e)+x,e="";else{var M=(e=+e)<0||1/e<0;if(e=isNaN(e)?c:_(Math.abs(e),d),y&&(e=function(e){e:for(var t,n=e.length,r=1,i=-1;r<n;++r)switch(e[r]){case".":i=t=r;break;case"0":0===i&&(i=r),t=r;break;default:if(!+e[r])break e;i>0&&(i=0)}return i>0?e.slice(0,i)+e.slice(t+1):e}(e)),M&&0===+e&&"+"!==h&&(M=!1),p=(M?"("===h?h:u:"-"===h||"("===h?"":h)+p,x=("s"===v?zi[8+gi/3]:"")+x+(M&&"("===h?")":""),k)for(i=-1,a=e.length;++i<a;)if(48>(l=e.charCodeAt(i))||l>57){x=(46===l?o+e.slice(i+1):e.slice(i))+x,e=e.slice(0,i);break}}m&&!f&&(e=r(e,1/0));var z=p.length+e.length+x.length,C=z<g?new Array(g-z+1).join(t):"";switch(m&&f&&(e=r(C+e,C.length?g-x.length:1/0),C=""),n){case"<":e=p+e+x+C;break;case"=":e=p+C+e+x;break;case"^":e=C.slice(0,z=C.length>>1)+p+e+x+C.slice(z);break;default:e=C+p+e+x}return s(e)}return d=void 0===d?6:/[gprs]/.test(v)?Math.max(1,Math.min(21,d)):Math.max(0,Math.min(20,d)),x.toString=function(){return e+""},x}return{format:h,formatPrefix:function(e,t){var n=h(((e=di(e)).type="f",e)),r=3*Math.max(-8,Math.min(8,Math.floor(fi(t)/3))),i=Math.pow(10,-r),a=zi[8+r/3];return function(e){return n(i*e)+a}}}}function Si(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e)}return this}function Ai(e){return+e}_i=Ci({thousands:",",grouping:[3],currency:["$",""]}),ki=_i.format,xi=_i.formatPrefix;var Ti=[0,1];function $i(e){return e}function Di(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:function(e){return function(){return e}}(isNaN(t)?NaN:.5)}function Ei(e,t,n){var r=e[0],i=e[1],a=t[0],o=t[1];return i<r?(r=Di(i,r),a=n(o,a)):(r=Di(r,i),a=n(a,o)),function(e){return a(r(e))}}function Ni(e,t,n){var r=Math.min(e.length,t.length)-1,i=new Array(r),a=new Array(r),o=-1;for(e[r]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++o<r;)i[o]=Di(e[o],e[o+1]),a[o]=n(t[o],t[o+1]);return function(t){var n=Oe(e,t,1,r)-1;return a[n](i[n](t))}}function Oi(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function ji(){var e,t,n,r,i,a,o=Ti,s=Ti,l=nr,u=$i;function c(){var e,t,n,l=Math.min(o.length,s.length);return u!==$i&&(e=o[0],t=o[l-1],e>t&&(n=e,e=t,t=n),u=function(n){return Math.max(e,Math.min(t,n))}),r=l>2?Ni:Ei,i=a=null,h}function h(t){return null==t||isNaN(t=+t)?n:(i||(i=r(o.map(e),s,l)))(e(u(t)))}return h.invert=function(n){return u(t((a||(a=r(s,o.map(e),Zn)))(n)))},h.domain=function(e){return arguments.length?(o=Array.from(e,Ai),c()):o.slice()},h.range=function(e){return arguments.length?(s=Array.from(e),c()):s.slice()},h.rangeRound=function(e){return s=Array.from(e),l=rr,c()},h.clamp=function(e){return arguments.length?(u=!!e||$i,c()):u!==$i},h.interpolate=function(e){return arguments.length?(l=e,c()):l},h.unknown=function(e){return arguments.length?(n=e,h):n},function(n,r){return e=n,t=r,c()}}function Pi(e,t,n,r){var i,a=function(e,t,n){n=+n;const r=(t=+t)<(e=+e),i=r?Ue(t,e,n):Ue(e,t,n);return(r?-1:1)*(i<0?1/-i:i)}(e,t,n);switch((r=di(null==r?",f":r)).type){case"s":var o=Math.max(Math.abs(e),Math.abs(t));return null!=r.precision||isNaN(i=function(e,t){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(fi(t)/3)))-fi(Math.abs(e)))}(a,o))||(r.precision=i),xi(r,o);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(i=function(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,fi(t)-fi(e))+1}(a,Math.max(Math.abs(e),Math.abs(t))))||(r.precision=i-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(i=function(e){return Math.max(0,-fi(Math.abs(e)))}(a))||(r.precision=i-2*("%"===r.type))}return ki(r)}function Li(e){var t=e.domain;return e.ticks=function(e){var n=t();return function(e,t,n){if(!((n=+n)>0))return[];if((e=+e)===(t=+t))return[e];const r=t<e,[i,a,o]=r?Fe(t,e,n):Fe(e,t,n);if(!(a>=i))return[];const s=a-i+1,l=new Array(s);if(r)if(o<0)for(let e=0;e<s;++e)l[e]=(a-e)/-o;else for(let e=0;e<s;++e)l[e]=(a-e)*o;else if(o<0)for(let e=0;e<s;++e)l[e]=(i+e)/-o;else for(let e=0;e<s;++e)l[e]=(i+e)*o;return l}(n[0],n[n.length-1],null==e?10:e)},e.tickFormat=function(e,n){var r=t();return Pi(r[0],r[r.length-1],null==e?10:e,n)},e.nice=function(n){null==n&&(n=10);var r,i,a=t(),o=0,s=a.length-1,l=a[o],u=a[s],c=10;for(u<l&&(i=l,l=u,u=i,i=o,o=s,s=i);c-- >0;){if((i=Ue(l,u,n))===r)return a[o]=l,a[s]=u,t(a);if(i>0)l=Math.floor(l/i)*i,u=Math.ceil(u/i)*i;else{if(!(i<0))break;l=Math.ceil(l*i)/i,u=Math.floor(u*i)/i}r=i}return e},e}function Fi(){var e=ji()($i,$i);return e.copy=function(){return Oi(e,Fi())},Si.apply(e,arguments),Li(e)}function Ui(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function Ri(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function Gi(e){return e<0?-e*e:e*e}function Hi(e){var t=e($i,$i),n=1;return t.exponent=function(t){return arguments.length?1===(n=+t)?e($i,$i):.5===n?e(Ri,Gi):e(Ui(n),Ui(1/n)):n},Li(t)}function Ii(){var e=Hi(ji());return e.copy=function(){return Oi(e,Ii()).exponent(e.exponent())},Si.apply(e,arguments),e}const Ki=new Date,qi=new Date;function Bi(e,t,n,r){function i(t){return e(t=0===arguments.length?new Date:new Date(+t)),t}return i.floor=t=>(e(t=new Date(+t)),t),i.ceil=n=>(e(n=new Date(n-1)),t(n,1),e(n),n),i.round=e=>{const t=i(e),n=i.ceil(e);return e-t<n-e?t:n},i.offset=(e,n)=>(t(e=new Date(+e),null==n?1:Math.floor(n)),e),i.range=(n,r,a)=>{const o=[];if(n=i.ceil(n),a=null==a?1:Math.floor(a),!(n<r&&a>0))return o;let s;do{o.push(s=new Date(+n)),t(n,a),e(n)}while(s<n&&n<r);return o},i.filter=n=>Bi(t=>{if(t>=t)for(;e(t),!n(t);)t.setTime(t-1)},(e,r)=>{if(e>=e)if(r<0)for(;++r<=0;)for(;t(e,-1),!n(e););else for(;--r>=0;)for(;t(e,1),!n(e););}),n&&(i.count=(t,r)=>(Ki.setTime(+t),qi.setTime(+r),e(Ki),e(qi),Math.floor(n(Ki,qi))),i.every=e=>(e=Math.floor(e),isFinite(e)&&e>0?e>1?i.filter(r?t=>r(t)%e===0:t=>i.count(0,t)%e===0):i:null)),i}const Yi=6e4,Vi=864e5,Wi=6048e5,Xi=Bi(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Yi)/Vi,e=>e.getDate()-1);Xi.range;const Zi=Bi(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Vi,e=>e.getUTCDate()-1);Zi.range;const Ji=Bi(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Vi,e=>Math.floor(e/Vi));function Qi(e){return Bi(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(e,t)=>{e.setDate(e.getDate()+7*t)},(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Yi)/Wi)}Ji.range;const ea=Qi(0),ta=Qi(1),na=Qi(2),ra=Qi(3),ia=Qi(4),aa=Qi(5),oa=Qi(6);function sa(e){return Bi(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+7*t)},(e,t)=>(t-e)/Wi)}ea.range,ta.range,na.range,ra.range,ia.range,aa.range,oa.range;const la=sa(0),ua=sa(1),ca=sa(2),ha=sa(3),pa=sa(4),fa=sa(5),ga=sa(6);la.range,ua.range,ca.range,ha.range,pa.range,fa.range,ga.range;const ma=Bi(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());ma.every=e=>isFinite(e=Math.floor(e))&&e>0?Bi(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)}):null,ma.range;const da=Bi(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());function ya(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function va(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function wa(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}da.every=e=>isFinite(e=Math.floor(e))&&e>0?Bi(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)}):null,da.range;var ba,_a,ka={"-":"",_:" ",0:"0"},xa=/^\s*\d+/,Ma=/^%/,za=/[\\^$*+?|[\]().{}]/g;function Ca(e,t,n){var r=e<0?"-":"",i=(r?-e:e)+"",a=i.length;return r+(a<n?new Array(n-a+1).join(t)+i:i)}function Sa(e){return e.replace(za,"\\$&")}function Aa(e){return new RegExp("^(?:"+e.map(Sa).join("|")+")","i")}function Ta(e){return new Map(e.map((e,t)=>[e.toLowerCase(),t]))}function $a(e,t,n){var r=xa.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function Da(e,t,n){var r=xa.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function Ea(e,t,n){var r=xa.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function Na(e,t,n){var r=xa.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function Oa(e,t,n){var r=xa.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function ja(e,t,n){var r=xa.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function Pa(e,t,n){var r=xa.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function La(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function Fa(e,t,n){var r=xa.exec(t.slice(n,n+1));return r?(e.q=3*r[0]-3,n+r[0].length):-1}function Ua(e,t,n){var r=xa.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function Ra(e,t,n){var r=xa.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function Ga(e,t,n){var r=xa.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function Ha(e,t,n){var r=xa.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function Ia(e,t,n){var r=xa.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function Ka(e,t,n){var r=xa.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function qa(e,t,n){var r=xa.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function Ba(e,t,n){var r=xa.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Ya(e,t,n){var r=Ma.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function Va(e,t,n){var r=xa.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function Wa(e,t,n){var r=xa.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function Xa(e,t){return Ca(e.getDate(),t,2)}function Za(e,t){return Ca(e.getHours(),t,2)}function Ja(e,t){return Ca(e.getHours()%12||12,t,2)}function Qa(e,t){return Ca(1+Xi.count(ma(e),e),t,3)}function eo(e,t){return Ca(e.getMilliseconds(),t,3)}function to(e,t){return eo(e,t)+"000"}function no(e,t){return Ca(e.getMonth()+1,t,2)}function ro(e,t){return Ca(e.getMinutes(),t,2)}function io(e,t){return Ca(e.getSeconds(),t,2)}function ao(e){var t=e.getDay();return 0===t?7:t}function oo(e,t){return Ca(ea.count(ma(e)-1,e),t,2)}function so(e){var t=e.getDay();return t>=4||0===t?ia(e):ia.ceil(e)}function lo(e,t){return e=so(e),Ca(ia.count(ma(e),e)+(4===ma(e).getDay()),t,2)}function uo(e){return e.getDay()}function co(e,t){return Ca(ta.count(ma(e)-1,e),t,2)}function ho(e,t){return Ca(e.getFullYear()%100,t,2)}function po(e,t){return Ca((e=so(e)).getFullYear()%100,t,2)}function fo(e,t){return Ca(e.getFullYear()%1e4,t,4)}function go(e,t){var n=e.getDay();return Ca((e=n>=4||0===n?ia(e):ia.ceil(e)).getFullYear()%1e4,t,4)}function mo(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+Ca(t/60|0,"0",2)+Ca(t%60,"0",2)}function yo(e,t){return Ca(e.getUTCDate(),t,2)}function vo(e,t){return Ca(e.getUTCHours(),t,2)}function wo(e,t){return Ca(e.getUTCHours()%12||12,t,2)}function bo(e,t){return Ca(1+Zi.count(da(e),e),t,3)}function _o(e,t){return Ca(e.getUTCMilliseconds(),t,3)}function ko(e,t){return _o(e,t)+"000"}function xo(e,t){return Ca(e.getUTCMonth()+1,t,2)}function Mo(e,t){return Ca(e.getUTCMinutes(),t,2)}function zo(e,t){return Ca(e.getUTCSeconds(),t,2)}function Co(e){var t=e.getUTCDay();return 0===t?7:t}function So(e,t){return Ca(la.count(da(e)-1,e),t,2)}function Ao(e){var t=e.getUTCDay();return t>=4||0===t?pa(e):pa.ceil(e)}function To(e,t){return e=Ao(e),Ca(pa.count(da(e),e)+(4===da(e).getUTCDay()),t,2)}function $o(e){return e.getUTCDay()}function Do(e,t){return Ca(ua.count(da(e)-1,e),t,2)}function Eo(e,t){return Ca(e.getUTCFullYear()%100,t,2)}function No(e,t){return Ca((e=Ao(e)).getUTCFullYear()%100,t,2)}function Oo(e,t){return Ca(e.getUTCFullYear()%1e4,t,4)}function jo(e,t){var n=e.getUTCDay();return Ca((e=n>=4||0===n?pa(e):pa.ceil(e)).getUTCFullYear()%1e4,t,4)}function Po(){return"+0000"}function Lo(){return"%"}function Fo(e){return+e}function Uo(e){return Math.floor(+e/1e3)}function Ro(e){return function(){return e}}!function(e){ba=function(e){var t=e.dateTime,n=e.date,r=e.time,i=e.periods,a=e.days,o=e.shortDays,s=e.months,l=e.shortMonths,u=Aa(i),c=Ta(i),h=Aa(a),p=Ta(a),f=Aa(o),g=Ta(o),m=Aa(s),d=Ta(s),y=Aa(l),v=Ta(l),w={a:function(e){return o[e.getDay()]},A:function(e){return a[e.getDay()]},b:function(e){return l[e.getMonth()]},B:function(e){return s[e.getMonth()]},c:null,d:Xa,e:Xa,f:to,g:po,G:go,H:Za,I:Ja,j:Qa,L:eo,m:no,M:ro,p:function(e){return i[+(e.getHours()>=12)]},q:function(e){return 1+~~(e.getMonth()/3)},Q:Fo,s:Uo,S:io,u:ao,U:oo,V:lo,w:uo,W:co,x:null,X:null,y:ho,Y:fo,Z:mo,"%":Lo},b={a:function(e){return o[e.getUTCDay()]},A:function(e){return a[e.getUTCDay()]},b:function(e){return l[e.getUTCMonth()]},B:function(e){return s[e.getUTCMonth()]},c:null,d:yo,e:yo,f:ko,g:No,G:jo,H:vo,I:wo,j:bo,L:_o,m:xo,M:Mo,p:function(e){return i[+(e.getUTCHours()>=12)]},q:function(e){return 1+~~(e.getUTCMonth()/3)},Q:Fo,s:Uo,S:zo,u:Co,U:So,V:To,w:$o,W:Do,x:null,X:null,y:Eo,Y:Oo,Z:Po,"%":Lo},_={a:function(e,t,n){var r=f.exec(t.slice(n));return r?(e.w=g.get(r[0].toLowerCase()),n+r[0].length):-1},A:function(e,t,n){var r=h.exec(t.slice(n));return r?(e.w=p.get(r[0].toLowerCase()),n+r[0].length):-1},b:function(e,t,n){var r=y.exec(t.slice(n));return r?(e.m=v.get(r[0].toLowerCase()),n+r[0].length):-1},B:function(e,t,n){var r=m.exec(t.slice(n));return r?(e.m=d.get(r[0].toLowerCase()),n+r[0].length):-1},c:function(e,n,r){return M(e,t,n,r)},d:Ra,e:Ra,f:Ba,g:Pa,G:ja,H:Ha,I:Ha,j:Ga,L:qa,m:Ua,M:Ia,p:function(e,t,n){var r=u.exec(t.slice(n));return r?(e.p=c.get(r[0].toLowerCase()),n+r[0].length):-1},q:Fa,Q:Va,s:Wa,S:Ka,u:Da,U:Ea,V:Na,w:$a,W:Oa,x:function(e,t,r){return M(e,n,t,r)},X:function(e,t,n){return M(e,r,t,n)},y:Pa,Y:ja,Z:La,"%":Ya};function k(e,t){return function(n){var r,i,a,o=[],s=-1,l=0,u=e.length;for(n instanceof Date||(n=new Date(+n));++s<u;)37===e.charCodeAt(s)&&(o.push(e.slice(l,s)),null!=(i=ka[r=e.charAt(++s)])?r=e.charAt(++s):i="e"===r?" ":"0",(a=t[r])&&(r=a(n,i)),o.push(r),l=s+1);return o.push(e.slice(l,s)),o.join("")}}function x(e,t){return function(n){var r,i,a=wa(1900,void 0,1);if(M(a,e,n+="",0)!=n.length)return null;if("Q"in a)return new Date(a.Q);if("s"in a)return new Date(1e3*a.s+("L"in a?a.L:0));if(t&&!("Z"in a)&&(a.Z=0),"p"in a&&(a.H=a.H%12+12*a.p),void 0===a.m&&(a.m="q"in a?a.q:0),"V"in a){if(a.V<1||a.V>53)return null;"w"in a||(a.w=1),"Z"in a?(i=(r=va(wa(a.y,0,1))).getUTCDay(),r=i>4||0===i?ua.ceil(r):ua(r),r=Zi.offset(r,7*(a.V-1)),a.y=r.getUTCFullYear(),a.m=r.getUTCMonth(),a.d=r.getUTCDate()+(a.w+6)%7):(i=(r=ya(wa(a.y,0,1))).getDay(),r=i>4||0===i?ta.ceil(r):ta(r),r=Xi.offset(r,7*(a.V-1)),a.y=r.getFullYear(),a.m=r.getMonth(),a.d=r.getDate()+(a.w+6)%7)}else("W"in a||"U"in a)&&("w"in a||(a.w="u"in a?a.u%7:"W"in a?1:0),i="Z"in a?va(wa(a.y,0,1)).getUTCDay():ya(wa(a.y,0,1)).getDay(),a.m=0,a.d="W"in a?(a.w+6)%7+7*a.W-(i+5)%7:a.w+7*a.U-(i+6)%7);return"Z"in a?(a.H+=a.Z/100|0,a.M+=a.Z%100,va(a)):ya(a)}}function M(e,t,n,r){for(var i,a,o=0,s=t.length,l=n.length;o<s;){if(r>=l)return-1;if(37===(i=t.charCodeAt(o++))){if(i=t.charAt(o++),!(a=_[i in ka?t.charAt(o++):i])||(r=a(e,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}return w.x=k(n,w),w.X=k(r,w),w.c=k(t,w),b.x=k(n,b),b.X=k(r,b),b.c=k(t,b),{format:function(e){var t=k(e+="",w);return t.toString=function(){return e},t},parse:function(e){var t=x(e+="",!1);return t.toString=function(){return e},t},utcFormat:function(e){var t=k(e+="",b);return t.toString=function(){return e},t},utcParse:function(e){var t=x(e+="",!0);return t.toString=function(){return e},t}}}(e),_a=ba.format,ba.parse,ba.utcFormat,ba.utcParse}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});const Go=Math.abs,Ho=Math.atan2,Io=Math.cos,Ko=Math.max,qo=Math.min,Bo=Math.sin,Yo=Math.sqrt,Vo=1e-12,Wo=Math.PI,Xo=Wo/2,Zo=2*Wo;function Jo(e){return e>=1?Xo:e<=-1?-Xo:Math.asin(e)}function Qo(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(null==n)t=null;else{const e=Math.floor(n);if(!(e>=0))throw new RangeError(`invalid digits: ${n}`);t=e}return e},()=>new hi(t)}function es(e){return e.innerRadius}function ts(e){return e.outerRadius}function ns(e){return e.startAngle}function rs(e){return e.endAngle}function is(e){return e&&e.padAngle}function as(e,t,n,r,i,a,o){var s=e-n,l=t-r,u=(o?a:-a)/Yo(s*s+l*l),c=u*l,h=-u*s,p=e+c,f=t+h,g=n+c,m=r+h,d=(p+g)/2,y=(f+m)/2,v=g-p,w=m-f,b=v*v+w*w,_=i-a,k=p*m-g*f,x=(w<0?-1:1)*Yo(Ko(0,_*_*b-k*k)),M=(k*w-v*x)/b,z=(-k*v-w*x)/b,C=(k*w+v*x)/b,S=(-k*v+w*x)/b,A=M-d,T=z-y,$=C-d,D=S-y;return A*A+T*T>$*$+D*D&&(M=C,z=S),{cx:M,cy:z,x01:-c,y01:-h,x11:M*(i/_-1),y11:z*(i/_-1)}}function os(){var e=es,t=ts,n=Ro(0),r=null,i=ns,a=rs,o=is,s=null,l=Qo(u);function u(){var u,c,h=+e.apply(this,arguments),p=+t.apply(this,arguments),f=i.apply(this,arguments)-Xo,g=a.apply(this,arguments)-Xo,m=Go(g-f),d=g>f;if(s||(s=u=l()),p<h&&(c=p,p=h,h=c),p>Vo)if(m>Zo-Vo)s.moveTo(p*Io(f),p*Bo(f)),s.arc(0,0,p,f,g,!d),h>Vo&&(s.moveTo(h*Io(g),h*Bo(g)),s.arc(0,0,h,g,f,d));else{var y,v,w=f,b=g,_=f,k=g,x=m,M=m,z=o.apply(this,arguments)/2,C=z>Vo&&(r?+r.apply(this,arguments):Yo(h*h+p*p)),S=qo(Go(p-h)/2,+n.apply(this,arguments)),A=S,T=S;if(C>Vo){var $=Jo(C/h*Bo(z)),D=Jo(C/p*Bo(z));(x-=2*$)>Vo?(_+=$*=d?1:-1,k-=$):(x=0,_=k=(f+g)/2),(M-=2*D)>Vo?(w+=D*=d?1:-1,b-=D):(M=0,w=b=(f+g)/2)}var E=p*Io(w),N=p*Bo(w),O=h*Io(k),j=h*Bo(k);if(S>Vo){var P,L=p*Io(b),F=p*Bo(b),U=h*Io(_),R=h*Bo(_);if(m<Wo)if(P=function(e,t,n,r,i,a,o,s){var l=n-e,u=r-t,c=o-i,h=s-a,p=h*l-c*u;if(!(p*p<Vo))return[e+(p=(c*(t-a)-h*(e-i))/p)*l,t+p*u]}(E,N,U,R,L,F,O,j)){var G=E-P[0],H=N-P[1],I=L-P[0],K=F-P[1],q=1/Bo(function(e){return e>1?0:e<-1?Wo:Math.acos(e)}((G*I+H*K)/(Yo(G*G+H*H)*Yo(I*I+K*K)))/2),B=Yo(P[0]*P[0]+P[1]*P[1]);A=qo(S,(h-B)/(q-1)),T=qo(S,(p-B)/(q+1))}else A=T=0}M>Vo?T>Vo?(y=as(U,R,E,N,p,T,d),v=as(L,F,O,j,p,T,d),s.moveTo(y.cx+y.x01,y.cy+y.y01),T<S?s.arc(y.cx,y.cy,T,Ho(y.y01,y.x01),Ho(v.y01,v.x01),!d):(s.arc(y.cx,y.cy,T,Ho(y.y01,y.x01),Ho(y.y11,y.x11),!d),s.arc(0,0,p,Ho(y.cy+y.y11,y.cx+y.x11),Ho(v.cy+v.y11,v.cx+v.x11),!d),s.arc(v.cx,v.cy,T,Ho(v.y11,v.x11),Ho(v.y01,v.x01),!d))):(s.moveTo(E,N),s.arc(0,0,p,w,b,!d)):s.moveTo(E,N),h>Vo&&x>Vo?A>Vo?(y=as(O,j,L,F,h,-A,d),v=as(E,N,U,R,h,-A,d),s.lineTo(y.cx+y.x01,y.cy+y.y01),A<S?s.arc(y.cx,y.cy,A,Ho(y.y01,y.x01),Ho(v.y01,v.x01),!d):(s.arc(y.cx,y.cy,A,Ho(y.y01,y.x01),Ho(y.y11,y.x11),!d),s.arc(0,0,h,Ho(y.cy+y.y11,y.cx+y.x11),Ho(v.cy+v.y11,v.cx+v.x11),d),s.arc(v.cx,v.cy,A,Ho(v.y11,v.x11),Ho(v.y01,v.x01),!d))):s.arc(0,0,h,k,_,d):s.lineTo(O,j)}else s.moveTo(0,0);if(s.closePath(),u)return s=null,u+""||null}return u.centroid=function(){var n=(+e.apply(this,arguments)+ +t.apply(this,arguments))/2,r=(+i.apply(this,arguments)+ +a.apply(this,arguments))/2-Wo/2;return[Io(r)*n,Bo(r)*n]},u.innerRadius=function(t){return arguments.length?(e="function"==typeof t?t:Ro(+t),u):e},u.outerRadius=function(e){return arguments.length?(t="function"==typeof e?e:Ro(+e),u):t},u.cornerRadius=function(e){return arguments.length?(n="function"==typeof e?e:Ro(+e),u):n},u.padRadius=function(e){return arguments.length?(r=null==e?null:"function"==typeof e?e:Ro(+e),u):r},u.startAngle=function(e){return arguments.length?(i="function"==typeof e?e:Ro(+e),u):i},u.endAngle=function(e){return arguments.length?(a="function"==typeof e?e:Ro(+e),u):a},u.padAngle=function(e){return arguments.length?(o="function"==typeof e?e:Ro(+e),u):o},u.context=function(e){return arguments.length?(s=null==e?null:e,u):s},u}function ss(e){this._context=e}function ls(e){return new ss(e)}function us(e){return e[0]}function cs(e){return e[1]}function hs(e,t){var n=Ro(!0),r=null,i=ls,a=null,o=Qo(s);function s(s){var l,u,c,h=(s=function(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}(s)).length,p=!1;for(null==r&&(a=i(c=o())),l=0;l<=h;++l)!(l<h&&n(u=s[l],l,s))===p&&((p=!p)?a.lineStart():a.lineEnd()),p&&a.point(+e(u,l,s),+t(u,l,s));if(c)return a=null,c+""||null}return e="function"==typeof e?e:void 0===e?us:Ro(e),t="function"==typeof t?t:void 0===t?cs:Ro(t),s.x=function(t){return arguments.length?(e="function"==typeof t?t:Ro(+t),s):e},s.y=function(e){return arguments.length?(t="function"==typeof e?e:Ro(+e),s):t},s.defined=function(e){return arguments.length?(n="function"==typeof e?e:Ro(!!e),s):n},s.curve=function(e){return arguments.length?(i=e,null!=r&&(a=i(r)),s):i},s.context=function(e){return arguments.length?(null==e?r=a=null:a=i(r=e),s):r},s}function ps(e,t,n){this.k=e,this.x=t,this.y=n}function fs(e){return"string"==typeof e?an(e):e}function gs(e,t){const n=t||{};let r;const i=ks(bs(xs(Object.assign(function(t,a){const o=fs(t).append(e);Object.entries(n).forEach(([e,t])=>o.attr(e,t)),void 0!==r&&o.text(r),i.stylable(o),i.appendable(o,a),i.interactable(o,a)},{attr:(e,t)=>void 0!==t?(n[e]=t,i):n[e],text(e){return arguments.length?(r=e,i):r}}))));return i}function ms(){const e=ks(bs(_s(xs(function(t,n){const r=fs(t).append("g");e.transformable(r),e.stylable(r),e.appendable(r,n),e.interactable(r,n)}))));return e}function ds(){let e=1,t=0,n=5;const r=Object.assign(function(r){const i=Math.round((r-t)/e)*e+t,a=e/2;return i+Ii().domain([-a,a]).range([-a,a]).exponent(n)(r-i)},{start(e){return arguments.length?(t=e,r):t},step(t){return arguments.length?(e=t,r):e},strength(e){return arguments.length?(n=e,r):n}});return r}function ys(e,t){const n=t||[],r=[];return Object.entries(e).forEach(([e,t])=>{const i=n.concat([e]);null!==t&&"object"==typeof t?r.push(...ys(t,i)):r.push([i,t])}),r}ss.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(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t)}}},ps.prototype={constructor:ps,scale:function(e){return 1===e?this:new ps(this.k*e,this.x,this.y)},translate:function(e,t){return 0===e&0===t?this:new ps(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}},new ps(1,0,0),ps.prototype;const vs=e=>e,ws=Object.assign(function(e){return e+(++ws.nextId).toString(36)},{nextId:0});function bs(e){let t,n=[];const r=Object.assign(e,{stylable(e){n.length&&e.attr("class",r.class()),t&&e.attr("style",r.style())},css(e){return arguments.length?(n.push(Ae(e)),r):n.join(" ")},class(e){return arguments.length?(n=n.concat(e.split(" ")),r):n.join(" ")},style(e){return arguments.length?(t=e,r):t}});return r}function _s(e){let t=0,n=0,r=1,i=1,a=0;const o=Object.assign(e,{transformable(e){e.attr("transform",`translate(${t}, ${n}) rotate(${a}) scale(${r}, ${i})`)},x(e){return arguments.length?(t=e,o):t},y(e){return arguments.length?(n=e,o):n},scale(e,t){return arguments.length?(r=e,i=t??e,o):[r,i]},rotate(e){return arguments.length?(a=e,o):a}});return o}function ks(e){const t={},n=Object.assign(e,{interactable(e,...n){Object.entries(t).forEach(([t,r])=>{const[i,a]=r;e.on(t,e=>i(e,...n),a)})},on(e,r,i){return arguments.length?(t[e]=[r,i],n):t}});return n}function xs(e){let t=[],n=[];const r=Object.assign(e,{appendable(e,r){const i=fs(e);if(t.length){const e=i.node(),n=an((e&&"ownerSVGElement"in e?e.ownerSVGElement:null)||e).select("defs");if(n.empty())throw"Couldn't find svg defs element";n.selectAll(null).data(t).enter().each(function(e){an(this).call(e,r)})}i.selectAll(null).data(n).enter().each(function(e){an(this).call(e,r)})},defs(...e){return arguments.length?(t=t.concat(e),r):t},append(...e){return arguments.length?(n=n.concat(e),r):n}});return r}class Ms extends Error{}const zs={create(e){const t=Number(e);if(Number.isNaN(t))throw new Ms(`"${e}" cannot be parsed into a number`);return t},add:(e,t)=>Number(e)+Number(t),sub:(e,t)=>Number(e)-Number(t),mul:(e,t)=>Number(e)*Number(t),div:(e,t)=>Number(e)/Number(t),lt:(e,t)=>Number(e)<Number(t),lte:(e,t)=>Number(e)<=Number(t),gt:(e,t)=>Number(e)>Number(t),gte:(e,t)=>Number(e)>=Number(t)};function Cs(e){return null!=e&&"object"==typeof e&&"numerator"in e&&("number"==typeof e.numerator||"string"==typeof e.numerator)&&"denominator"in e&&("number"==typeof e.denominator||"string"==typeof e.denominator)}class Ss extends Error{}class As extends Error{}class Ts extends Error{}class $s extends Error{}class Ds extends Error{}class Es{constructor(e,t){this.destination=null,this.origin=null,this.cls=e.cls,this.val=this.cls.create(t||0),this.measureData=e.measures,this.unitCache=e.unitCache}from(e){if(null!=this.destination)throw new As(".from must be called before .to");return this.origin=this.getUnit(e),null==this.origin&&this.throwUnsupportedUnitError(e),this}convertFraction(e){return Cs(e)?this.cls.div(e.numerator,e.denominator):this.cls.create(e)}to(e){var t,n;if(null==this.origin)throw new Error(".to must be called after .from");this.destination=this.getUnit(e),null==this.destination&&this.throwUnsupportedUnitError(e);const r=this.destination,i=this.origin;if(i.abbr===r.abbr)return this.val;if(r.measure!=i.measure)throw new Ts(`Cannot convert incompatible measures of ${r.measure} and ${i.measure}`);let a=this.cls.mul(this.val,this.convertFraction(i.unit.to_anchor));if(i.unit.anchor_shift&&(a=this.cls.sub(a,this.convertFraction(i.unit.anchor_shift))),i.system!=r.system){const e=this.measureData[i.measure].anchors;if(null==e)throw new $s(`Unable to convert units. Anchors are missing for "${i.measure}" and "${r.measure}" measures.`);const o=e[i.system];if(null==o)throw new $s(`Unable to find anchor for "${i.measure}" to "${r.measure}". Please make sure it is defined.`);const s=null===(t=o[r.system])||void 0===t?void 0:t.transform,l=null===(n=o[r.system])||void 0===n?void 0:n.ratio;if("function"==typeof s)a=s(a,this.cls);else if("number"==typeof l)a=this.cls.mul(a,l);else{if(!Cs(l))throw new $s("A system anchor needs to either have a defined ratio number or a transform function.");a=this.cls.mul(a,this.convertFraction(l))}}return r.unit.anchor_shift&&(a=this.cls.add(a,this.convertFraction(r.unit.anchor_shift))),this.cls.div(a,this.convertFraction(r.unit.to_anchor))}toBest(e){var t,n,r;if(null==this.origin)throw new As(".toBest must be called after .from");const i=this.cls.lt(this.val,0);let a=[],o=i?-1:1,s=this.origin.system;"object"==typeof e&&(a=null!==(t=e.exclude)&&void 0!==t?t:[],o=null!==(n=e.cutOffNumber)&&void 0!==n?n:o,s=null!==(r=e.system)&&void 0!==r?r:this.origin.system);let l=null;for(const e of this.possibilities()){const t=this.describe(e);if(-1===a.indexOf(e)&&t.system===s){const n=this.to(e);if(i?this.cls.gt(n,o):this.cls.lt(n,o))continue;(null===l||(i?this.cls.lte(n,o)&&this.cls.gt(n,l.val):this.cls.gte(n,o)&&this.cls.lt(n,l.val)))&&(l={val:n,unit:e,singular:t.singular,plural:t.plural})}}return null==l?{val:this.val,unit:this.origin.abbr,singular:this.origin.unit.name.singular,plural:this.origin.unit.name.plural}:l}getUnit(e){var t;return null!==(t=this.unitCache.get(e))&&void 0!==t?t:null}describe(e){const t=this.getUnit(e);if(null!=t)return this.describeUnit(t);this.throwUnsupportedUnitError(e)}describeUnit(e){return{abbr:e.abbr,measure:e.measure,system:e.system,singular:e.unit.name.singular,plural:e.unit.name.plural}}list(e){const t=[];if(null==e)for(const[e,n]of Object.entries(this.measureData))for(const[r,i]of Object.entries(n.systems))for(const[n,a]of Object.entries(i))t.push(this.describeUnit({abbr:n,measure:e,system:r,unit:a}));else{if(!this.isMeasure(e))throw new Ds(`Meausure "${e}" not found.`);const n=this.measureData[e];for(const[r,i]of Object.entries(n.systems))for(const[n,a]of Object.entries(i))t.push(this.describeUnit({abbr:n,measure:e,system:r,unit:a}))}return t}isMeasure(e){return e in this.measureData}throwUnsupportedUnitError(e){let t=[];for(const e of Object.values(this.measureData))for(const n of Object.values(e.systems))t=t.concat(Object.keys(n));throw new Ss(`Unsupported unit ${e}, use one of: ${t.join(", ")}`)}possibilities(e){let t=[],n=[];"string"==typeof e&&this.isMeasure(e)?n.push(e):null!=this.origin?n.push(this.origin.measure):n=Object.keys(this.measureData);for(const e of n){const n=this.measureData[e].systems;for(const e of Object.values(n))t=[...t,...Object.keys(e)]}return t}measures(){return Object.keys(this.measureData)}}const Ns=function(e,t){if("object"!=typeof e)throw new TypeError("The measures argument needs to be an object");const n=function(e){const t=new Map;for(const[n,r]of Object.entries(e))for(const[e,i]of Object.entries(r.systems))for(const[r,a]of Object.entries(i))t.set(r,{measure:n,system:e,abbr:r,unit:a});return t}(e);return null!=t&&(null!=(r=t)&&"object"==typeof r&&"create"in r&&"function"==typeof r.create&&"add"in r&&"function"==typeof r.add&&"sub"in r&&"function"==typeof r.sub&&"mul"in r&&"function"==typeof r.mul&&"div"in r&&"function"==typeof r.div&&"lt"in r&&"function"==typeof r.lt&&"lte"in r&&"function"==typeof r.lte&&"gt"in r&&"function"==typeof r.gt&&"gte"in r&&"function"==typeof r.gte)?r=>new Es({measures:e,unitCache:n,cls:t},r):t=>new Es({measures:e,unitCache:n,cls:zs},t);var r}({acceleration:{systems:{metric:{"g-force":{name:{singular:"g-force",plural:"g-forces"},to_anchor:9.80665},"m/s2":{name:{singular:"Metre per second squared",plural:"Metres per second squared"},to_anchor:1},g0:{name:{singular:"Standard Gravity",plural:"Standard Gravities"},to_anchor:9.80665}}}},angle:{systems:{SI:{rad:{name:{singular:"radian",plural:"radians"},to_anchor:{numerator:180,denominator:Math.PI}},deg:{name:{singular:"degree",plural:"degrees"},to_anchor:1},grad:{name:{singular:"gradian",plural:"gradians"},to_anchor:{numerator:9,denominator:10}},arcmin:{name:{singular:"arcminute",plural:"arcminutes"},to_anchor:{numerator:1,denominator:60}},arcsec:{name:{singular:"arcsecond",plural:"arcseconds"},to_anchor:{numerator:1,denominator:3600}}}}},apparentPower:{systems:{SI:{VA:{name:{singular:"Volt-Ampere",plural:"Volt-Amperes"},to_anchor:1},mVA:{name:{singular:"Millivolt-Ampere",plural:"Millivolt-Amperes"},to_anchor:.001},kVA:{name:{singular:"Kilovolt-Ampere",plural:"Kilovolt-Amperes"},to_anchor:1e3},MVA:{name:{singular:"Megavolt-Ampere",plural:"Megavolt-Amperes"},to_anchor:1e6},GVA:{name:{singular:"Gigavolt-Ampere",plural:"Gigavolt-Amperes"},to_anchor:1e9}}}},area:{systems:{metric:{nm2:{name:{singular:"Square Nanometer",plural:"Square Nanometers"},to_anchor:1e-18},"μm2":{name:{singular:"Square Micrometer",plural:"Square Micrometers"},to_anchor:1e-12},mm2:{name:{singular:"Square Millimeter",plural:"Square Millimeters"},to_anchor:{numerator:1,denominator:1e6}},cm2:{name:{singular:"Square Centimeter",plural:"Square Centimeters"},to_anchor:{numerator:1,denominator:1e4}},dm2:{name:{singular:"Square Decimeter",plural:"Square Decimeters"},to_anchor:{numerator:1,denominator:100}},m2:{name:{singular:"Square Meter",plural:"Square Meters"},to_anchor:1},a:{name:{singular:"Are",plural:"Ares"},to_anchor:100},ha:{name:{singular:"Hectare",plural:"Hectares"},to_anchor:1e4},km2:{name:{singular:"Square Kilometer",plural:"Square Kilometers"},to_anchor:1e6}},imperial:{in2:{name:{singular:"Square Inch",plural:"Square Inches"},to_anchor:{numerator:1,denominator:144}},yd2:{name:{singular:"Square Yard",plural:"Square Yards"},to_anchor:9},ft2:{name:{singular:"Square Foot",plural:"Square Feet"},to_anchor:1},ac:{name:{singular:"Acre",plural:"Acres"},to_anchor:43560},mi2:{name:{singular:"Square Mile",plural:"Square Miles"},to_anchor:27878400}}},anchors:{metric:{imperial:{ratio:10.7639}},imperial:{metric:{ratio:{numerator:1,denominator:10.7639}}}}},charge:{systems:{SI:{c:{name:{singular:"Coulomb",plural:"Coulombs"},to_anchor:1},mC:{name:{singular:"Millicoulomb",plural:"Millicoulombs"},to_anchor:{numerator:1,denominator:1e3}},"μC":{name:{singular:"Microcoulomb",plural:"Microcoulombs"},to_anchor:{numerator:1,denominator:1e6}},nC:{name:{singular:"Nanocoulomb",plural:"Nanocoulombs"},to_anchor:1e-9},pC:{name:{singular:"Picocoulomb",plural:"Picocoulombs"},to_anchor:1e-12}}}},current:{systems:{SI:{A:{name:{singular:"Ampere",plural:"Amperes"},to_anchor:1},"μA":{name:{singular:"Microampere",plural:"Microamperes"},to_anchor:1e-6},mA:{name:{singular:"Milliampere",plural:"Milliamperes"},to_anchor:.001},kA:{name:{singular:"Kiloampere",plural:"Kiloamperes"},to_anchor:1e3},MA:{name:{singular:"Megaampere",plural:"Megaamperes"},to_anchor:1e6}}}},digital:{systems:{bit:{bit:{name:{singular:"Bit",plural:"Bits"},to_anchor:1},kb:{name:{singular:"Kilobit",plural:"Kilobits"},to_anchor:1e3},Mb:{name:{singular:"Megabit",plural:"Megabits"},to_anchor:1e6},Gb:{name:{singular:"Gigabit",plural:"Gigabits"},to_anchor:1e9},Tb:{name:{singular:"Terabit",plural:"Terabits"},to_anchor:1e12}},byte:{byte:{name:{singular:"Byte",plural:"Bytes"},to_anchor:1},kB:{name:{singular:"Kilobyte",plural:"Kilobytes"},to_anchor:1e3},MB:{name:{singular:"Megabyte",plural:"Megabytes"},to_anchor:1e6},GB:{name:{singular:"Gigabyte",plural:"Gigabytes"},to_anchor:1e9},TB:{name:{singular:"Terabyte",plural:"Terabytes"},to_anchor:1e12}},IECBit:{Kib:{name:{singular:"Kibibit",plural:"Kibibits"},to_anchor:1},Mib:{name:{singular:"Mebibit",plural:"Mebibits"},to_anchor:1024},Gib:{name:{singular:"Gibibit",plural:"Gibibits"},to_anchor:1048576},Tib:{name:{singular:"Tebibit",plural:"Tebibits"},to_anchor:1073741824}},IECByte:{KiB:{name:{singular:"Kibibyte",plural:"Kibibytes"},to_anchor:1},MiB:{name:{singular:"Mebibyte",plural:"Mebibytes"},to_anchor:1024},GiB:{name:{singular:"Gibibyte",plural:"Gibibytes"},to_anchor:1048576},TiB:{name:{singular:"Tebibyte",plural:"Tebibytes"},to_anchor:1073741824}}},anchors:{bit:{byte:{ratio:.125},IECBit:{ratio:.0009765625},IECByte:{ratio:.0001220703125}},byte:{bit:{ratio:8},IECBit:{ratio:.0078125},IECByte:{ratio:.0009765625}},IECBit:{bit:{ratio:1024},byte:{ratio:128},IECByte:{ratio:.125}},IECByte:{bit:{ratio:8192},byte:{ratio:1024},IECBit:{ratio:8}}}},each:{systems:{metric:{ea:{name:{singular:"Each",plural:"Each"},to_anchor:1},dz:{name:{singular:"Dozen",plural:"Dozens"},to_anchor:12}}}},energy:{systems:{SI:{Ws:{name:{singular:"Watt-second",plural:"Watt-seconds"},to_anchor:1},Wm:{name:{singular:"Watt-minute",plural:"Watt-minutes"},to_anchor:60},Wh:{name:{singular:"Watt-hour",plural:"Watt-hours"},to_anchor:3600},mWh:{name:{singular:"Milliwatt-hour",plural:"Milliwatt-hours"},to_anchor:3.6},kWh:{name:{singular:"Kilowatt-hour",plural:"Kilowatt-hours"},to_anchor:36e5},MWh:{name:{singular:"Megawatt-hour",plural:"Megawatt-hours"},to_anchor:36e8},GWh:{name:{singular:"Gigawatt-hour",plural:"Gigawatt-hours"},to_anchor:36e11},J:{name:{singular:"Joule",plural:"Joules"},to_anchor:1},kJ:{name:{singular:"Kilojoule",plural:"Kilojoules"},to_anchor:1e3},MJ:{name:{singular:"Megajoule",plural:"Megajoules"},to_anchor:1e6},GJ:{name:{singular:"Gigajoule",plural:"Gigajoules"},to_anchor:1e9}},nutrition:{cal:{name:{singular:"calorie",plural:"calories"},to_anchor:1},kcal:{name:{singular:"Kilocalorie",plural:"Kilocalories"},to_anchor:1e3}}},anchors:{SI:{nutrition:{ratio:{numerator:1,denominator:4.184}}},nutrition:{SI:{ratio:4.184}}}},force:{systems:{SI:{N:{name:{singular:"Newton",plural:"Newtons"},to_anchor:1},kN:{name:{singular:"Kilonewton",plural:"Kilonewtons"},to_anchor:1e3},lbf:{name:{singular:"Pound-force",plural:"Pound-forces"},to_anchor:4.44822},kgf:{name:{singular:"Kilogram-force",plural:"Kilogram-forces"},to_anchor:9.807}}}},frequency:{systems:{SI:{mHz:{name:{singular:"millihertz",plural:"millihertz"},to_anchor:{numerator:1,denominator:1e3}},Hz:{name:{singular:"hertz",plural:"hertz"},to_anchor:1},kHz:{name:{singular:"kilohertz",plural:"kilohertz"},to_anchor:1e3},MHz:{name:{singular:"megahertz",plural:"megahertz"},to_anchor:1e6},GHz:{name:{singular:"gigahertz",plural:"gigahertz"},to_anchor:1e9},THz:{name:{singular:"terahertz",plural:"terahertz"},to_anchor:1e12},rpm:{name:{singular:"rotation per minute",plural:"rotations per minute"},to_anchor:{numerator:1,denominator:60}},"deg/s":{name:{singular:"degree per second",plural:"degrees per second"},to_anchor:{numerator:1,denominator:360}},"rad/s":{name:{singular:"radian per second",plural:"radians per second"},to_anchor:{numerator:1,denominator:6.283185307179586}}}}},illuminance:{systems:{metric:{lx:{name:{singular:"Lux",plural:"Lux"},to_anchor:1}},imperial:{"ft-cd":{name:{singular:"Foot-candle",plural:"Foot-candles"},to_anchor:1}}},anchors:{metric:{imperial:{ratio:{numerator:1,denominator:10.76391}}},imperial:{metric:{ratio:10.76391}}}},length:{systems:{metric:{nm:{name:{singular:"Nanometer",plural:"Nanometers"},to_anchor:1e-9},"μm":{name:{singular:"Micrometer",plural:"Micrometers"},to_anchor:1e-6},mm:{name:{singular:"Millimeter",plural:"Millimeters"},to_anchor:.001},cm:{name:{singular:"Centimeter",plural:"Centimeters"},to_anchor:.01},dm:{name:{singular:"Decimeter",plural:"Decimeters"},to_anchor:.1},m:{name:{singular:"Meter",plural:"Meters"},to_anchor:1},km:{name:{singular:"Kilometer",plural:"Kilometers"},to_anchor:1e3}},imperial:{mil:{name:{singular:"Mil",plural:"Mils"},to_anchor:{numerator:1,denominator:12e3}},in:{name:{singular:"Inch",plural:"Inches"},to_anchor:{numerator:1,denominator:12}},yd:{name:{singular:"Yard",plural:"Yards"},to_anchor:3},"ft-us":{name:{singular:"US Survey Foot",plural:"US Survey Feet"},to_anchor:1.000002},ft:{name:{singular:"Foot",plural:"Feet"},to_anchor:1},fathom:{name:{singular:"Fathom",plural:"Fathoms"},to_anchor:6},mi:{name:{singular:"Mile",plural:"Miles"},to_anchor:5280},nMi:{name:{singular:"Nautical Mile",plural:"Nautical Miles"},to_anchor:6076.12}}},anchors:{metric:{imperial:{ratio:3.28084}},imperial:{metric:{ratio:{numerator:1,denominator:3.28084}}}}},mass:{systems:{metric:{mcg:{name:{singular:"Microgram",plural:"Micrograms"},to_anchor:{numerator:1,denominator:1e6}},mg:{name:{singular:"Milligram",plural:"Milligrams"},to_anchor:{numerator:1,denominator:1e3}},g:{name:{singular:"Gram",plural:"Grams"},to_anchor:1},kg:{name:{singular:"Kilogram",plural:"Kilograms"},to_anchor:1e3},mt:{name:{singular:"Metric Tonne",plural:"Metric Tonnes"},to_anchor:1e6}},imperial:{oz:{name:{singular:"Ounce",plural:"Ounces"},to_anchor:{numerator:1,denominator:16}},lb:{name:{singular:"Pound",plural:"Pounds"},to_anchor:1},st:{name:{singular:"Stone",plural:"Stones"},to_anchor:14},t:{name:{singular:"Ton",plural:"Tons"},to_anchor:2e3}}},anchors:{metric:{imperial:{ratio:{numerator:1,denominator:453.59237}}},imperial:{metric:{ratio:453.59237}}}},massFlowRate:{systems:{metric:{"kg/s":{name:{singular:"Kilogram per second",plural:"Kilograms per second"},to_anchor:1},"kg/min":{name:{singular:"Kilogram per minute",plural:"Kilograms per minute"},to_anchor:1/60},"kg/h":{name:{singular:"Kilogram per hour",plural:"Kilograms per hour"},to_anchor:{numerator:1,denominator:3600}},"mt/h":{name:{singular:"Ton per hour",plural:"Tons per hour"},to_anchor:{numerator:1,denominator:3.6}}},imperial:{"lb/s":{name:{singular:"Pound per second",plural:"Pounds per second"},to_anchor:1},"lb/h":{name:{singular:"Pound per hour",plural:"Pounds per hour"},to_anchor:{numerator:1,denominator:3600}}}},anchors:{metric:{imperial:{ratio:{numerator:1,denominator:.453592}}},imperial:{metric:{ratio:.453592}}}},pace:{systems:{metric:{"min/km":{name:{singular:"Minute per kilometre",plural:"Minutes per kilometre"},to_anchor:.06},"s/m":{name:{singular:"Second per metre",plural:"Seconds per metre"},to_anchor:1}},imperial:{"min/mi":{name:{singular:"Minute per mile",plural:"Minutes per mile"},to_anchor:.0113636},"s/ft":{name:{singular:"Second per foot",plural:"Seconds per foot"},to_anchor:1}}},anchors:{metric:{imperial:{ratio:.3048}},imperial:{metric:{ratio:{numerator:1,denominator:.3048}}}}},partsPer:{systems:{SI:{ppm:{name:{singular:"Part-per Million",plural:"Parts-per Million"},to_anchor:1},ppb:{name:{singular:"Part-per Billion",plural:"Parts-per Billion"},to_anchor:.001},ppt:{name:{singular:"Part-per Trillion",plural:"Parts-per Trillion"},to_anchor:1e-6},ppq:{name:{singular:"Part-per Quadrillion",plural:"Parts-per Quadrillion"},to_anchor:1e-9}}}},pieces:{systems:{unit:{pcs:{name:{singular:"Piece",plural:"Pieces"},to_anchor:1},"bk-doz":{name:{singular:"Bakers Dozen",plural:"Bakers Dozen"},to_anchor:13},cp:{name:{singular:"Couple",plural:"Couples"},to_anchor:2},"doz-doz":{name:{singular:"Dozen Dozen",plural:"Dozen Dozen"},to_anchor:144},doz:{name:{singular:"Dozen",plural:"Dozens"},to_anchor:12},"gr-gr":{name:{singular:"Great Gross",plural:"Great Gross"},to_anchor:1728},gros:{name:{singular:"Gross",plural:"Gross"},to_anchor:144},"half-dozen":{name:{singular:"Half Dozen",plural:"Half Dozen"},to_anchor:6},"long-hundred":{name:{singular:"Long Hundred",plural:"Long Hundred"},to_anchor:120},ream:{name:{singular:"Reams",plural:"Reams"},to_anchor:500},scores:{name:{singular:"Scores",plural:"Scores"},to_anchor:20},"sm-gr":{name:{singular:"Small Gross",plural:"Small Gross"},to_anchor:120},trio:{name:{singular:"Trio",plural:"Trio"},to_anchor:3}}}},power:{systems:{metric:{W:{name:{singular:"Watt",plural:"Watts"},to_anchor:1},mW:{name:{singular:"Milliwatt",plural:"Milliwatts"},to_anchor:.001},kW:{name:{singular:"Kilowatt",plural:"Kilowatts"},to_anchor:1e3},MW:{name:{singular:"Megawatt",plural:"Megawatts"},to_anchor:1e6},GW:{name:{singular:"Gigawatt",plural:"Gigawatts"},to_anchor:1e9},PS:{name:{singular:"Horsepower (metric)",plural:"Horsepower (metric)"},to_anchor:735.49875}},imperial:{"Btu/s":{name:{singular:"British thermal unit per second",plural:"British thermal units per second"},to_anchor:778.16937},"ft-lb/s":{name:{singular:"Foot-pound per second",plural:"Foot-pounds per second"},to_anchor:1},hp:{name:{singular:"Horsepower (British)",plural:"Horsepower (British)"},to_anchor:550}}},anchors:{metric:{imperial:{ratio:.737562149}},imperial:{metric:{ratio:{numerator:1,denominator:.737562149}}}}},pressure:{systems:{metric:{Pa:{name:{singular:"pascal",plural:"pascals"},to_anchor:{numerator:1,denominator:1e3}},kPa:{name:{singular:"kilopascal",plural:"kilopascals"},to_anchor:1},MPa:{name:{singular:"megapascal",plural:"megapascals"},to_anchor:1e3},hPa:{name:{singular:"hectopascal",plural:"hectopascals"},to_anchor:{numerator:1,denominator:10}},mbar:{name:{singular:"millibar",plural:"millibar"},to_anchor:.1},bar:{name:{singular:"bar",plural:"bar"},to_anchor:100},torr:{name:{singular:"torr",plural:"torr"},to_anchor:{numerator:101325,denominator:76e4}},mH2O:{name:{singular:"meter of water @ 4°C",plural:"meters of water @ 4°C"},to_anchor:9.80665},mmHg:{name:{singular:"millimeter of mercury",plural:"millimeters of mercury"},to_anchor:.133322}},imperial:{psi:{name:{singular:"pound per square inch",plural:"pounds per square inch"},to_anchor:{numerator:1,denominator:1e3}},ksi:{name:{singular:"kilopound per square inch",plural:"kilopound per square inch"},to_anchor:1},inHg:{name:{singular:"Inch of mercury",plural:"Inches of mercury"},to_anchor:491154e-9}}},anchors:{metric:{imperial:{ratio:.00014503768078}},imperial:{metric:{ratio:{numerator:1,denominator:.00014503768078}}}}},reactiveEnergy:{systems:{SI:{VARh:{name:{singular:"Volt-Ampere Reactive Hour",plural:"Volt-Amperes Reactive Hour"},to_anchor:1},mVARh:{name:{singular:"Millivolt-Ampere Reactive Hour",plural:"Millivolt-Amperes Reactive Hour"},to_anchor:.001},kVARh:{name:{singular:"Kilovolt-Ampere Reactive Hour",plural:"Kilovolt-Amperes Reactive Hour"},to_anchor:1e3},MVARh:{name:{singular:"Megavolt-Ampere Reactive Hour",plural:"Megavolt-Amperes Reactive Hour"},to_anchor:1e6},GVARh:{name:{singular:"Gigavolt-Ampere Reactive Hour",plural:"Gigavolt-Amperes Reactive Hour"},to_anchor:1e9}}}},reactivePower:{systems:{SI:{VAR:{name:{singular:"Volt-Ampere Reactive",plural:"Volt-Amperes Reactive"},to_anchor:1},mVAR:{name:{singular:"Millivolt-Ampere Reactive",plural:"Millivolt-Amperes Reactive"},to_anchor:.001},kVAR:{name:{singular:"Kilovolt-Ampere Reactive",plural:"Kilovolt-Amperes Reactive"},to_anchor:1e3},MVAR:{name:{singular:"Megavolt-Ampere Reactive",plural:"Megavolt-Amperes Reactive"},to_anchor:1e6},GVAR:{name:{singular:"Gigavolt-Ampere Reactive",plural:"Gigavolt-Amperes Reactive"},to_anchor:1e9}}}},speed:{systems:{metric:{"m/s":{name:{singular:"Metre per second",plural:"Metres per second"},to_anchor:3.6},"km/h":{name:{singular:"Kilometre per hour",plural:"Kilometres per hour"},to_anchor:1},"mm/h":{name:{singular:"Millimeter per hour",plural:"Millimeters per hour"},to_anchor:1e-6}},imperial:{mph:{name:{singular:"Mile per hour",plural:"Miles per hour"},to_anchor:1},knot:{name:{singular:"Knot",plural:"Knots"},to_anchor:1.150779},"ft/s":{name:{singular:"Foot per second",plural:"Feet per second"},to_anchor:.681818},"ft/min":{name:{singular:"Foot per minute",plural:"Feet per minute"},to_anchor:.0113636},"in/h":{name:{singular:"Inch per hour",plural:"Inches per hour"},to_anchor:1578e-8}}},anchors:{metric:{imperial:{ratio:{numerator:1,denominator:1.609344}}},imperial:{metric:{ratio:1.609344}}}},torque:{systems:{metric:{Nm:{name:{singular:"Newton-meter",plural:"Newton-meters"},to_anchor:1},cNm:{name:{singular:"Centinewton-meter",plural:"Centinewton-meters"},to_anchor:.01},dNm:{name:{singular:"Decinewton-meter",plural:"Decinewton-meters"},to_anchor:.1},kgm:{name:{singular:"Kilogram-meter",plural:"Kilogram-meters"},to_anchor:9.806649999787735},"kg-cm":{name:{singular:"Kilogram-centimeter",plural:"Kilogram-centimeters"},to_anchor:.09806649999787735}},imperial:{"lbf-ft":{name:{singular:"Pound-foot",plural:"Pound-feet"},to_anchor:1},"lbf-in":{name:{singular:"Pound-inch",plural:"Pound-inches"},to_anchor:.08333333333333333},"ozf-in":{name:{singular:"Ounce-inch",plural:"Ounce-inches"},to_anchor:.005208333271755643}}},anchors:{metric:{imperial:{ratio:{numerator:1,denominator:1.355818}}},imperial:{metric:{ratio:1.355818}}}},temperature:{systems:{metric:{C:{name:{singular:"degree Celsius",plural:"degrees Celsius"},to_anchor:1,anchor_shift:0},K:{name:{singular:"Kelvin",plural:"Kelvins"},to_anchor:1,anchor_shift:273.15}},imperial:{F:{name:{singular:"degree Fahrenheit",plural:"degrees Fahrenheit"},to_anchor:1},R:{name:{singular:"degree Rankine",plural:"degrees Rankine"},to_anchor:1,anchor_shift:459.67}}},anchors:{metric:{imperial:{transform:function(e,t){return t.add(t.div(e,t.div(5,9)),32)}}},imperial:{metric:{transform:function(e,t){return t.mul(t.sub(e,32),t.div(5,9))}}}}},time:{systems:{SI:{ns:{name:{singular:"Nanosecond",plural:"Nanoseconds"},to_anchor:{numerator:1,denominator:1e9}},mu:{name:{singular:"Microsecond",plural:"Microseconds"},to_anchor:{numerator:1,denominator:1e6}},ms:{name:{singular:"Millisecond",plural:"Milliseconds"},to_anchor:{numerator:1,denominator:1e3}},s:{name:{singular:"Second",plural:"Seconds"},to_anchor:1},min:{name:{singular:"Minute",plural:"Minutes"},to_anchor:60},h:{name:{singular:"Hour",plural:"Hours"},to_anchor:3600},d:{name:{singular:"Day",plural:"Days"},to_anchor:86400},week:{name:{singular:"Week",plural:"Weeks"},to_anchor:604800},month:{name:{singular:"Month",plural:"Months"},to_anchor:{numerator:31557600,denominator:12}},year:{name:{singular:"Year",plural:"Years"},to_anchor:31557600}}}},voltage:{systems:{SI:{V:{name:{singular:"Volt",plural:"Volts"},to_anchor:1},"μV":{name:{singular:"Microvolt",plural:"Microvolts"},to_anchor:1e-6},mV:{name:{singular:"Millivolt",plural:"Millivolts"},to_anchor:.001},kV:{name:{singular:"Kilovolt",plural:"Kilovolts"},to_anchor:1e3},MV:{name:{singular:"Megavolt",plural:"Megavolts"},to_anchor:1e6}}}},volume:{systems:{metric:{mm3:{name:{singular:"Cubic Millimeter",plural:"Cubic Millimeters"},to_anchor:{numerator:1,denominator:1e6}},cm3:{name:{singular:"Cubic Centimeter",plural:"Cubic Centimeters"},to_anchor:{numerator:1,denominator:1e3}},dm3:{name:{singular:"Cubic Decimeter",plural:"Cubic Decimeters"},to_anchor:1},ml:{name:{singular:"Millilitre",plural:"Millilitres"},to_anchor:{numerator:1,denominator:1e3}},cl:{name:{singular:"Centilitre",plural:"Centilitres"},to_anchor:{numerator:1,denominator:100}},dl:{name:{singular:"Decilitre",plural:"Decilitres"},to_anchor:{numerator:1,denominator:10}},l:{name:{singular:"Litre",plural:"Litres"},to_anchor:1},kl:{name:{singular:"Kilolitre",plural:"Kilolitres"},to_anchor:1e3},Ml:{name:{singular:"Megalitre",plural:"Megalitres"},to_anchor:1e6},Gl:{name:{singular:"Gigalitre",plural:"Gigalitres"},to_anchor:1e9},m3:{name:{singular:"Cubic meter",plural:"Cubic meters"},to_anchor:1e3},km3:{name:{singular:"Cubic kilometer",plural:"Cubic kilometers"},to_anchor:1e12},krm:{name:{singular:"Kryddmått",plural:"Kryddmått"},to_anchor:{numerator:1,denominator:1e3}},tsk:{name:{singular:"Tesked",plural:"Teskedar"},to_anchor:{numerator:5,denominator:1e3}},msk:{name:{singular:"Matsked",plural:"Matskedar"},to_anchor:{numerator:15,denominator:1e3}},kkp:{name:{singular:"Kaffekopp",plural:"Kaffekoppar"},to_anchor:{numerator:150,denominator:1e3}},glas:{name:{singular:"Glas",plural:"Glas"},to_anchor:{numerator:200,denominator:1e3}},kanna:{name:{singular:"Kanna",plural:"Kannor"},to_anchor:2.617}},imperial:{tsp:{name:{singular:"Teaspoon",plural:"Teaspoons"},to_anchor:{numerator:1,denominator:6}},Tbs:{name:{singular:"Tablespoon",plural:"Tablespoons"},to_anchor:{numerator:1,denominator:2}},in3:{name:{singular:"Cubic inch",plural:"Cubic inches"},to_anchor:.55411},"fl-oz":{name:{singular:"Fluid Ounce",plural:"Fluid Ounces"},to_anchor:1},cup:{name:{singular:"Cup",plural:"Cups"},to_anchor:8},pnt:{name:{singular:"Pint",plural:"Pints"},to_anchor:16},qt:{name:{singular:"Quart",plural:"Quarts"},to_anchor:32},gal:{name:{singular:"Gallon",plural:"Gallons"},to_anchor:128},ft3:{name:{singular:"Cubic foot",plural:"Cubic feet"},to_anchor:957.506},yd3:{name:{singular:"Cubic yard",plural:"Cubic yards"},to_anchor:25852.7}}},anchors:{metric:{imperial:{ratio:33.8140226}},imperial:{metric:{ratio:{numerator:1,denominator:33.8140226}}}}},volumeFlowRate:{systems:{metric:{"mm3/s":{name:{singular:"Cubic Millimeter per second",plural:"Cubic Millimeters per second"},to_anchor:{numerator:1,denominator:1e6}},"cm3/s":{name:{singular:"Cubic Centimeter per second",plural:"Cubic Centimeters per second"},to_anchor:{numerator:1,denominator:1e3}},"dm3/s":{name:{singular:"Cubic Decimeter per second",plural:"Cubic Decimeters per second"},to_anchor:1},"dm3/min":{name:{singular:"Cubic Decimeter per minute",plural:"Cubic Decimeters per minute"},to_anchor:1/60},"dm3/h":{name:{singular:"Cubic Decimeter per hour",plural:"Cubic Decimeters per hour"},to_anchor:1/3600},"dm3/d":{name:{singular:"Cubic Decimeter per day",plural:"Cubic Decimeters per day"},to_anchor:1/86400},"dm3/a":{name:{singular:"Cubic Decimeter per year",plural:"Cubic Decimeters per year"},to_anchor:1/31557600},"ml/s":{name:{singular:"Millilitre per second",plural:"Millilitres per second"},to_anchor:{numerator:1,denominator:1e3}},"cl/s":{name:{singular:"Centilitre per second",plural:"Centilitres per second"},to_anchor:{numerator:1,denominator:100}},"dl/s":{name:{singular:"Decilitre per second",plural:"Decilitres per second"},to_anchor:{numerator:1,denominator:10}},"l/s":{name:{singular:"Litre per second",plural:"Litres per second"},to_anchor:1},"l/min":{name:{singular:"Litre per minute",plural:"Litres per minute"},to_anchor:{numerator:1,denominator:60}},"l/h":{name:{singular:"Litre per hour",plural:"Litres per hour"},to_anchor:{numerator:1,denominator:3600}},"l/d":{name:{singular:"Litre per day",plural:"Litres per day"},to_anchor:1/86400},"l/a":{name:{singular:"Litre per year",plural:"Litres per year"},to_anchor:1/31557600},"kl/s":{name:{singular:"Kilolitre per second",plural:"Kilolitres per second"},to_anchor:1e3},"kl/min":{name:{singular:"Kilolitre per minute",plural:"Kilolitres per minute"},to_anchor:{numerator:50,denominator:3}},"kl/h":{name:{singular:"Kilolitre per hour",plural:"Kilolitres per hour"},to_anchor:{numerator:5,denominator:18}},"m3/s":{name:{singular:"Cubic meter per second",plural:"Cubic meters per second"},to_anchor:1e3},"m3/min":{name:{singular:"Cubic meter per minute",plural:"Cubic meters per minute"},to_anchor:{numerator:50,denominator:3}},"m3/h":{name:{singular:"Cubic meter per hour",plural:"Cubic meters per hour"},to_anchor:{numerator:5,denominator:18}},"m3/d":{name:{singular:"Cubic meter per day",plural:"Cubic meters per day"},to_anchor:5/432},"m3/a":{name:{singular:"Cubic meter per year",plural:"Cubic meters per year"},to_anchor:5/157788},"km3/s":{name:{singular:"Cubic kilometer per second",plural:"Cubic kilometers per second"},to_anchor:1e12}},imperial:{"tsp/s":{name:{singular:"Teaspoon per second",plural:"Teaspoons per second"},to_anchor:{numerator:1,denominator:6}},"Tbs/s":{name:{singular:"Tablespoon per second",plural:"Tablespoons per second"},to_anchor:{numerator:1,denominator:2}},"in3/s":{name:{singular:"Cubic inch per second",plural:"Cubic inches per second"},to_anchor:.55411},"in3/min":{name:{singular:"Cubic inch per minute",plural:"Cubic inches per minute"},to_anchor:{numerator:.55411,denominator:60}},"in3/h":{name:{singular:"Cubic inch per hour",plural:"Cubic inches per hour"},to_anchor:{numerator:.55411,denominator:3600}},"fl-oz/s":{name:{singular:"Fluid Ounce per second",plural:"Fluid Ounces per second"},to_anchor:1},"fl-oz/min":{name:{singular:"Fluid Ounce per minute",plural:"Fluid Ounces per minute"},to_anchor:{numerator:1,denominator:60}},"fl-oz/h":{name:{singular:"Fluid Ounce per hour",plural:"Fluid Ounces per hour"},to_anchor:{numerator:1,denominator:3600}},"cup/s":{name:{singular:"Cup per second",plural:"Cups per second"},to_anchor:8},"pnt/s":{name:{singular:"Pint per second",plural:"Pints per second"},to_anchor:16},"pnt/min":{name:{singular:"Pint per minute",plural:"Pints per minute"},to_anchor:{numerator:4,denominator:15}},"pnt/h":{name:{singular:"Pint per hour",plural:"Pints per hour"},to_anchor:{numerator:1,denominator:225}},"qt/s":{name:{singular:"Quart per second",plural:"Quarts per second"},to_anchor:32},"gal/s":{name:{singular:"Gallon per second",plural:"Gallons per second"},to_anchor:128},"gal/min":{name:{singular:"Gallon per minute",plural:"Gallons per minute"},to_anchor:{numerator:32,denominator:15}},"gal/h":{name:{singular:"Gallon per hour",plural:"Gallons per hour"},to_anchor:{numerator:8,denominator:225}},"ft3/s":{name:{singular:"Cubic foot per second",plural:"Cubic feet per second"},to_anchor:957.506},"ft3/min":{name:{singular:"Cubic foot per minute",plural:"Cubic feet per minute"},to_anchor:{numerator:957.506,denominator:60}},"ft3/h":{name:{singular:"Cubic foot per hour",plural:"Cubic feet per hour"},to_anchor:{numerator:957.506,denominator:3600}},"yd3/s":{name:{singular:"Cubic yard per second",plural:"Cubic yards per second"},to_anchor:25852.7},"yd3/min":{name:{singular:"Cubic yard per minute",plural:"Cubic yards per minute"},to_anchor:{numerator:25852.7,denominator:60}},"yd3/h":{name:{singular:"Cubic yard per hour",plural:"Cubic yards per hour"},to_anchor:{numerator:25852.7,denominator:3600}}}},anchors:{metric:{imperial:{ratio:33.8140227}},imperial:{metric:{ratio:{numerator:1,denominator:33.8140227}}}}}}),Os=Ns().possibilities();function js(e,t,n){let r=e;if(t&&n)try{r=Ns(e).from(t).to(n)}catch(e){const t=e instanceof Error?e.message:String(e);console.log("Unit conversion error: "+t)}else"string"==typeof e&&e.match(/^\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d/)&&(r=new Date(e));return r}function Ps(e,t){const n=e.split(".");for(;n.length;){const e=n.join(".");if(e in t)return e;n.pop()}}function Ls(){const t=[],n={},r={},i={},a=new Map;let o,s=!1;function l(e){return a.has(e)||a.set(e,Ps(e,r)),a.get(e)}const u=Object.assign(function(e,n){const o=e.metrics||{};if(Object.keys(o).some(e=>!(e in r))&&a.clear(),Object.assign(r,o),Object.assign(i,e.units||{}),!s&&Object.keys(o).length){s=!0;const e=u.indicators().filter(e=>void 0===l(e));e.length&&console.log("Warning: no metric matching",e)}t.forEach(({updater:e,keys:t,unit:a})=>{if(!t.some(e=>{const t=l(e);return void 0!==t&&t in o}))return;const s=l(t[0]);if(void 0===s)return;const u=i[s]||"",c=js(r[s],u,a);void 0===c?console.log(`Warning: failed to convert ${r[s]} from ${u} to ${a}`):e(c,n,r,a||u)})},{register(e,n,r){const i=(Array.isArray(n)?n:[n]).filter(e=>!!e);i.length&&t.push({updater:e,keys:i,unit:r||""})},fake(e,t,r){e in n?console.log(`Warning: ignoring duplicate fake for ${e}`):n[e]={fake:t,unit:r}},fakes:()=>n,indicators:()=>Array.from(new Set(t.flatMap(e=>e.keys))),sink:e=>(o=e,u),send(...e){o?o(e):console.log("g3: actions dropped, no hub input configured:",e)}});return e.activeController=u,u}function Fs(e){const t={},n={},r={};let i=1;function a(e){return Object.keys(e).length&&i++,{latest:i,metrics:e,units:Object.fromEntries(Object.keys(e).filter(e=>e in n).map(e=>[e,n[e]]))}}return Object.entries(e).forEach(([e,{fake:i,unit:a}])=>{a&&(n[e]=a),"function"==typeof i?(r[e]=i,t[e]=i(void 0)):t[e]=i}),{snapshot:()=>({latest:i,metrics:{...t},units:{...n}}),tick(){const e={};return Object.entries(r).forEach(([n,r])=>{t[n]=e[n]=r(t[n])}),a(e)},apply(e){const r={};return e.forEach(e=>function(e,r){if("trigger"===e.op)return void console.log("g3 local hub: ignoring trigger",e.event);const i=void 0===e.metric?void 0:Ps(e.metric,t);if(void 0===i)return void console.log("g3 local hub: ignoring action for unknown metric",e);const a=n[i];let o;if("set"===e.op)o=js(e.value,e.unit,a);else{if("adjust"!==e.op)return void console.log("g3 local hub: ignoring unknown action",e);{const{min:n,max:r,wrap:s}=e;let l=Number(js(t[i],a,e.unit))+e.by;if(s&&void 0!==n&&void 0!==r){const e=r-n;l=((l-n)%e+e)%e+n}else void 0!==n&&(l=Math.max(n,l)),void 0!==r&&(l=Math.min(r,l));o=js(l,e.unit,a)}}t[i]=o,r[i]=o}(e,r)),a(r)}}}e.activeController=void 0;const Us=1e-6;function Rs(){let e=0,t=0,n=2e3,r=2e3,i=100,a=100,o=10,s=10;const l=bs(Object.assign(function(u){const c=fs(u).append("g").attr("class","g3-grid");l.stylable(c);const h=Re(e,e+n+Us,i),p=Re(t,t+r+Us,a);c.selectAll(null).data(Re(e,e+n+Us,o).filter(e=>!h.includes(e))).enter().append("line").attr("class","g3-grid-hairline").attr("transform",e=>"translate("+e+","+t+")").attr("y2",r),c.selectAll(null).data(Re(t,t+r+Us,s).filter(e=>!p.includes(e))).enter().append("line").attr("class","g3-grid-hairline").attr("transform",t=>"translate("+e+","+t+")").attr("x2",n);const f=c.selectAll(null).data(h).enter().append("g").attr("class","g3-grid-line").attr("transform",e=>"translate("+e+","+t+")"),g=c.selectAll(null).data(p).enter().append("g").attr("class","g3-grid-line").attr("transform",t=>"translate("+e+","+t+")");f.append("line").attr("y2",r),g.append("line").attr("x2",n),f.selectAll(null).data(p.slice(0,-1)).enter().append("g").attr("class","g3-grid-label").attr("transform",e=>"translate(0,"+(e-t+a/2)+") rotate(-90) "),g.selectAll(null).data(h.slice(0,-1)).enter().append("g").attr("class","g3-grid-label").attr("transform",t=>"translate("+(t-e+i/2)+", 0)");const m=c.selectAll(".g3-grid-label");m.append("rect").attr("x",-12).attr("width",24).attr("y",-4).attr("height",8).attr("rx",4),m.append("text").text(function(){return String(an(this.parentNode.parentNode).datum())})},{x(t){return arguments.length?(e=t,l):e},y(e){return arguments.length?(t=e,l):t},width(e){return arguments.length?(n=e,l):n},height(e){return arguments.length?(r=e,l):r},xmajor(e){return arguments.length?(i=e,l):i},ymajor(e){return arguments.length?(a=e,l):a},xminor(e){return arguments.length?(o=e,l):o},yminor(e){return arguments.length?(s=e,l):s}}));return l}function Gs(e){const t="undefined"!=typeof document&&document.location?document.location.href:"http://localhost";return new URL(e.toString(),t)}function Hs(){let e,t,n=1024,r=768,i=250,a=!1,o=!0;const s=bs(xs(_s(Object.assign(function(l){const u=fs(l),c=Ls(),h=o?e=>e.transition().duration(i||250).ease(ri):e=>e,p=u.append("svg").attr("width",n).attr("height",r),f=p.append("defs");((e,t)=>[gs("radialGradient",{id:"highlightGradient",cx:"50%",cy:"50%",fx:"25%",fy:"40%",r:"50%"}).append(...["white","black"].map(e=>gs("stop",{"stop-color":e,offset:"white"==e?"0%":"100%"}))),...[1,2,3].map(n=>gs("filter",{id:"dropShadow"+n,filterUnits:"userSpaceOnUse",x:-e,width:2*e,y:-t,height:2*t}).append(gs("feDropShadow",{stdDeviation:n,dx:0,dy:0}))),...[1,2,3].map(e=>gs("filter",{id:"gaussianBlur"+e}).append(gs("feGaussianBlur",{in:"SourceGraphic",stdDeviation:e})))])(n,r).forEach(e=>e(f));const g=p.append("g");s.stylable(g),s.transformable(g),s.appendable(g),a&&Rs().width(n).height(r)(g);const m=c.indicators();if(console.log("Starting panel expecting metrics for:",m),!e){const e=Fs(c.fakes());return c.sink(t=>c(e.apply(t),h)),c(e.snapshot()),void setInterval(()=>c(e.tick(),h),i||250)}if(t){let e=Promise.resolve();c.sink(n=>{e=e.then(()=>fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({actions:n})})).then(e=>{e&&!1===e.ok&&console.log("g3: hub rejected actions",e.status,n)}).catch(e=>console.log("g3: failed to send actions",e,n))})}if(i){let t=0;setInterval(()=>{e.search=new URLSearchParams({latest:String(t),units:String(0==t),keys:m.join(",")}).toString(),fetch(e).then(e=>e.json()).then(e=>{c(e,h),t=e.latest??0}).catch(e=>{console.log("g3: failed to poll metrics",e),t=0})},i)}else{e.search=new URLSearchParams({keys:m.join(",")}).toString();new EventSource(e).onmessage=function(e){c(JSON.parse(e.data),h)}}},{width(e){return arguments.length?(n=e,s):n},height(e){return arguments.length?(r=e,s):r},grid(e){return arguments.length?(a=!!e,s):a},url(t){return arguments.length?(e=Gs(t),s):e},inputUrl(e){return arguments.length?(t=Gs(e),s):t},interval(e){return arguments.length?(i=e,s):i},smooth(e){return arguments.length?(o=e,s):o}})))).class("g3-panel");return s}const Is={needle:ms().append(gs("rect",{x:-1,y:-90,width:2,height:100}).class("g3-pointer-needle"),gs("circle",{r:5}).class("g3-pointer-hub")),blade:ms().scale(5.625,-5.625).append(gs("path",{d:"M 0,9 L 0.6,7 l 0,-7 l -1.2,0 l 0,7 z"}).class("g3-pointer-blade"),gs("circle",{r:1.25}).class("g3-pointer-hub")),dagger:ms().scale(5.625,-5.625).append(gs("path",{d:"M 0,6 L 1.2,3 L 0.6,0 L -0.6,0 L -1.2,3 Z"}).class("g3-pointer-blade"),gs("path",{d:"M 0.6, 0 L 1.6,-3 A 3,3,0,0,0,-1.6,-3 L -0.6,0 Z"}).class("g3-pointer-handle"),gs("circle",{r:1.25}).class("g3-pointer-hub")),rondel:ms().scale(5.625,-5.625).append(gs("path",{d:"M 0,15 L 1,0 l -2,0 z"}).class("g3-pointer-blade"),gs("circle",{r:2.4}).class("g3-pointer-hub")),sword:ms().scale(5.625,-5.625).append(gs("path",{d:"M 0,16 L 0.6,14 l 0,-12 l -1.2,0 l 0,12 z"}).class("g3-pointer-blade"),gs("rect",{x:-.6,y:-6,height:8,width:1.2}).class("g3-pointer-handle"),gs("circle",{r:1.2}).class("g3-pointer-hub"),gs("circle",{r:.5}).class("g3-highlight"),gs("circle",{r:1.2,cy:-6}).class("g3-pointer-pommel")),wedge:ms().append(gs("path",{d:"M 5,25 l -10,0 l 5,-120 z"}).class("g3-pointer-blade"),gs("circle",{r:10}).class("g3-pointer-hub"),gs("circle",{r:4}).class("g3-highlight")),"omega-second":ms().append(gs("path",{d:"M 3,25 l -6,0 l 3,-115 z M 0,-72 l 4,15 l -4,5 l -4,-5 z"}).class("g3-pointer-blade"),gs("path",{d:"M 0,-69 l 3,12 l -3,3 l -3,-3 z"}).class("g3-pointer-luminous"),gs("circle",{r:4}).class("g3-pointer-hub"),gs("circle",{r:2}).class("g3-highlight")),"omega-baton-long":ms().append(gs("path",{d:"M 3,0 l 0,-80 l -3,-10 l -3,10 l 0,80 z"}).class("g3-pointer-blade"),gs("path",{d:"M 2,0 l 0,-80 l -4,0 l 0,80 z"}).class("g3-pointer-luminous"),gs("circle",{r:6.5}).class("g3-pointer-hub")),"omega-baton-short":ms().append(gs("path",{d:"M 3.5,0 l 0,-55 l -3.5,-10 l -3.5,10 l 0,55 z"}).class("g3-pointer-blade"),gs("path",{d:"M 2.5,0 l 0,-55 l -5,0 l 0,55 z"}).class("g3-pointer-luminous"),gs("circle",{r:9}).class("g3-pointer-hub")),"aircraft-heading":ms().x(-160).y(-160).scale(.8).append(gs("path",{d:"M 200.45288,260.80553 L 203.16177,253.84124 L 225.12833,263.88589 C 227.03295,264.83725 228.33805,264.53956 228.33805,262.63589 L 228.40255,256.61982 C 228.40255,250.22869 224.75105,247.90625 219.51131,243.70732 L 208.47788,235.31446 L 211.28639,196.92161 L 261.23772,213.1716 C 263.62163,213.95469 264.64806,212.98991 264.64806,211.20732 L 264.82432,201.9216 C 264.82432,194.61271 260.92135,191.45797 255.6207,187.81446 L 213.09186,157.27875 C 212.31569,139.15817 210.07741,119.6713 200.45288,103.52874 C 190.82836,119.6713 188.59008,139.15817 187.81391,157.27875 L 145.28507,187.81446 C 139.98442,191.45797 136.08145,194.61271 136.08145,201.9216 L 136.25771,211.20732 C 136.25771,212.98991 137.28414,213.95469 139.66805,213.1716 L 189.61938,196.92161 L 192.42789,235.31446 L 181.39446,243.70732 C 176.15472,247.90625 172.50322,250.22869 172.50322,256.61982 L 172.56772,262.63589 C 172.56772,264.53956 173.87282,264.83725 175.77744,263.88589 L 197.744,253.84124 L 200.45288,260.80553 z"}).class("g3-highlight-stroke g3-no-fill")),"aircraft-turn":ms().x(-218).y(-157.5).scale(.5).append(gs("path",{d:"m 435.64988,289.47018 c -12.33394,0 -22.41326,9.69394 -23.03125,21.875 l -121.9375,-0.22694 c -4.43702,0.0318 -5.34776,6.2322 -0.5,7.0625 l 126.375,7.25819 c 4.14867,6.10563 11.15189,10.125 19.09375,10.125 7.92634,0 14.91358,-4.00188 19.0625,-10.09375 l 126.9375,-7.28944 c 4.84776,-0.8303 3.93702,-7.0307 -0.5,-7.0625 l -122.46875,0.25819 c -0.6019,-12.19506 -10.68685,-21.90625 -23.03125,-21.90625 z"}),gs("path",{d:"m 382.64058,299.50149 c 4.38251,0.0518 102.16734,0.0518 106.54985,0 4.38251,-0.0518 5.82754,-6.6971 -0.25253,-7.17567 l -44.44671,-2.12492 c -3.68642,-0.66946 -4.02856,-2.28053 -4.29315,-4.3671 l -0.50508,-25.22318 c 0,-3.88798 -7.42864,-3.96105 -7.42864,0 l -0.50508,25.22318 c -0.26459,2.08657 -0.60673,3.69764 -4.29315,4.3671 l -44.57298,2.12492 c -6.08007,0.47857 -4.63504,7.12387 -0.25253,7.17567 z"})).class("g3-fg-fill")};function Ks(e){return[e[0],e[e.length-1]]}function qs(e,t){const[n,r]=Ks(t);return"circular"==e&&n!==r&&(n-r)%360==0}function Bs(){let t=vs,n=20;const r=bs(Object.assign(function(i,a){let o=fs(i).append("text").attr("font-size",n);if(r.stylable(o),o=o.text(""),e.activeController&&a){const n=(e,n,r,i)=>{o.text(t(e,r,i))};e.activeController.register(n,a.metrics(),a.unit())}},{format(e){return arguments.length?(t=e,r):t},size(e){return arguments.length?(n=e,r):n}})).class("g3-indicate-text");return r}function Ys(){let t=vs,n=[void 0,void 0],r="needle";const i=bs(xs(Object.assign(function(a,o){const s=fs(a).append("g").classed("will-change-transform",!0);if(i.stylable(s),i.append().length||i.append(Is[r]),i.appendable(s,o),e.activeController&&o){const r="number"==typeof n[0]||"number"==typeof n[1],i=qs(o.kind(),o.measure().range())&&!r,a=(e,r,a,l)=>{let u=t(e,a,l);"number"==typeof n[0]&&(u=Math.max(u,n[0])),"number"==typeof n[1]&&(u=Math.min(u,n[1]));const c=o.metrictransform(u),h="function"==typeof r?r(s):s;s.attr("transform")||s.attr("transform",c),!i&&"attrTween"in h?h.attrTween("transform",function(){return tr(this.getAttribute("transform")||c,c)}):h.attr("transform",c)};e.activeController.register(a,o.metrics(),o.unit())}},{rescale(e){return arguments.length?(t=e,i):t},clamp(e){return arguments.length?(n=e?[e[0]??void 0,e[1]??void 0]:[void 0,void 0],i):n},shape(e){if(arguments.length&&!(e in Is))throw`pointer: unknown shape ${e}`;return arguments.length?(r=e,i):r}}))).class("g3-indicate-pointer");return i}function Vs(){let t=vs,n=[void 0,void 0],r=0,i=10,a=0;const o=bs(Object.assign(function(s,l){const u=fs(s).append("path");if(o.stylable(u),e.activeController&&l){const o=(e,o,s,c)=>{let h=t(e,s,c);const p=t(r,s,c),f=e<r;"number"==typeof n[0]&&(h=Math.max(h,n[0])),"number"==typeof n[1]&&(h=Math.min(h,n[1]));("function"==typeof o?o(u):u).attr("d",l.sectorpath(f?h:p,f?p:h,i,a)),u.classed("g3-indicate-sector-negative",f)};e.activeController.register(o,l.metrics(),l.unit())}},{rescale(e){return arguments.length?(t=e,o):t},clamp(e){return arguments.length?(n=e?[e[0]??void 0,e[1]??void 0]:[void 0,void 0],o):n},anchor(e){return arguments.length?(r=e,o):r},size(e){return arguments.length?(i=e,o):i},inset(e){return arguments.length?(a=e,o):a}})).class("g3-indicate-sector");return o}function Ws(){let t={opacity:1},n={opacity:0},r=vs;const i=xs(Object.assign(function(a,o){const s=nr(n,t),l=fs(a).append("g").attr("class","g3-indicate-style");if(i.appendable(l,o),e.activeController&&o){const t=(e,t,n,i)=>{const a=s(Number(r(e,n,i)));for(const e in a)l.style(e,a[e])};e.activeController.register(t,o.metrics(),o.unit())}},{styleOn(e){return arguments.length?(t=e,i):t},styleOff(e){return arguments.length?(n=e,i):n},trigger(e){return arguments.length?(r=e,i):r}}));return i}function Xs(t){let n,r,i,a,o,s=t,l=[],u=vs,c=Fi().range([0,360]),h="circular",p=!1,f=100,g=!1;const m=bs(xs(Object.assign(function(t,s){let l=s?s._ns.slice():[];if(i)if(i.startsWith(".")){const e=i.match(/^\.+(.*)/),t=e?e[1]:"";l=l.slice(0,-(i.length-t.length-1)),t&&l.push(t)}else l.push(i);m._ns=l;const d=m.metric(),y=fs(t).append("g");m.stylable(y);const v=y.append("g");if("function"==typeof o){const e=ws("gauge-clip");o(v.append("clipPath").attr("id",e)),v.attr("clip-path",`url(#${e})`)}if(m.appendable(v,m),g&&Rs().x(-f).y(-f).xmajor(50).ymajor(50).width(2*f).height(2*f)(v),n=e.activeController,e.activeController&&(void 0!==a&&d&&e.activeController.fake(d,a,r),p&&d)){const t=qs(h,c.range()),n=(e,n,r,i)=>{const a=m.metrictransform(u(e,r,i),!0),o="function"==typeof n?n(v):v;v.attr("transform")||v.attr("transform",a),!t&&"attrTween"in o?o.attrTween("transform",function(){return tr(this.getAttribute("transform")||a,a)}):o.attr("transform",a)};v.classed("will-change-transform",!0),e.activeController.register(n,m.metrics(),r)}},{_ns:[],metric(e,...t){return arguments.length?(s=e,l=t,m):s&&[s].concat(m._ns).join(".")},metrics:()=>(s?[s,...l]:[]).map(e=>[e].concat(m._ns).join(".")),send(...e){const t=m.metric(),i=e.map(e=>"trigger"===e.op||void 0!==e.metric?e:{...e,metric:t,...r&&!e.unit?{unit:r}:{}});n?n.send(...i):console.log("g3: actions dropped, gauge has not been drawn:",i)},rescale(e){return arguments.length?(u=e,m):u},unit(e){return e&&!Os.includes(e)&&console.log(`WARNING: gauge.unit ${e} not a known unit, see https://github.com/convert-units/convert-units`),arguments.length?(r=e,m):r},instance(e){return arguments.length?(i=e??void 0,m):i},fake(e){return arguments.length?(a=e,m):a},kind(e){return arguments.length?(h=e,m):h},clip(e){return arguments.length?(o=e,m):o},r(e){return arguments.length?(f=e,m):f},measure(e){return arguments.length?(c=e,m):c},autoindicate(e){return arguments.length?(p=e,m):p},grid(e){return arguments.length?(g=!!e,m):g},metrictransform(e,t){const n="circular"==h,r=t?-c(e):c(e);return n?`rotate(${r})`:`translate(${r}, 0)`},marktransform(e,t){const n="circular"==h,r=t??0,i=c(e),a=r+(n?-f:0);return n?`rotate(${i}) translate(0, ${a})`:`translate(${i}, ${a})`},sectorpath(e,t,n,r){const i=n??0,a=r??0,o=m.r(),s=m.measure(),l=s(e),u=s(t);return"circular"==m.kind()?os()({innerRadius:o-a-i,outerRadius:o-a,startAngle:Ns(l).from("deg").to("rad"),endAngle:Ns(u).from("deg").to("rad")}):`M ${l},${a} l 0,${i} l ${u-l},0 l 0,${-i} z`}}))).class("g3-gauge");return m}function Zs(){let e,t=100;const n=bs(Object.assign(function(r,i){const a=fs(r);let o;if("function"==typeof e){o=ws("gauge-face-window-");const n=a.append("mask").attr("id",o);n.append("circle").attr("r",t).style("fill","white");const r=n.append("g").attr("style","fill: black");e(r,i)}const s=a.append("circle").attr("r",t);n.stylable(s),o&&s.attr("mask",`url(#${o})`)},{r(e){return arguments.length?(t=e,n):t},window(t){return arguments.length?(e=t,n):e}})).class("g3-gauge-face");return n}function Js(){let e=8,t="slotted";const n=bs(_s(Object.assign(function(r){const i=360*Math.random(),a=fs(r).append("g").attr("class","g3-gauge-screw");switch(n.transformable(a),n.stylable(a),a.append("circle").attr("r",e).attr("class","g3-gauge-screw-head"),a.append("circle").attr("r",e).attr("class","g3-highlight"),t){case"robertson":a.append("rect").attr("transform",`scale(${e}) rotate(${i})`).attr("x",-.4).attr("width",.8).attr("y",-.4).attr("height",.8);break;case"phillips":a.append("rect").attr("transform",`scale(${e}) rotate(${i+90})`).attr("x",-1).attr("width",2).attr("y",-.2).attr("height",.4);default:a.append("rect").attr("transform",`scale(${e}) rotate(${i})`).attr("x",-1).attr("width",2).attr("y",-.2).attr("height",.4)}},{r(t){return arguments.length?(e=t,n):e},shape(e){return arguments.length?(t=e,n):t}})));return n}function Qs(e,t){let n=e||"",r=0,i=0,a=0,o=0,s=10;const l=bs(Object.assign(function(e){const t=fs(e).append("text").attr("x",r).attr("y",i).attr("dx",a).attr("dy",o).attr("font-size",s).text(n);l.stylable(t)},{value(e){return arguments.length?(n=e,l):n},size(e){return arguments.length?(s=e,l):s},x(e){return arguments.length?(r=e,l):r},y(e){return arguments.length?(i=e,l):i},dx(e){return arguments.length?(a=e,l):a},dy(e){return arguments.length?(o=e,l):o}})).class("g3-gauge-label");if("object"==typeof t){const e=l;Object.entries(t).forEach(([t,n])=>{const r=e[t];if("function"!=typeof r)throw`label: unknown attribute ${t}`;r.call(l,n)})}return l}function el(){const e=Xs();let t=vs,n="red";const r=Object.assign(function(r,i){Xs().metric(e.metric()).instance(e.instance()).fake(e.fake()).append(Ws().trigger(t).append(Zs().style(`fill: ${n}`),Zs().class("g3-highlight")))(r,i)},{metric(t){return arguments.length?(e.metric(t),r):e.metric()},instance(t){return arguments.length?(e.instance(t),r):e.instance()},fake(t){return arguments.length?(e.fake(t),r):e.fake()},trigger(e){return arguments.length?(t=e,r):t},color(e){return arguments.length?(n=e,r):n}});return r}function tl(e,t,n,r){if(void 0!==e)return e.slice();let i;if("number"==typeof t&&r){const[e,a]=Ks(r.measure().domain().slice().sort((e,t)=>e-t));i=[];for(let r=n??Math.ceil(e/t)*t;r<=a;r+=t)i.push(r);qs(r.kind(),r.measure().range())&&i.includes(e)&&i.includes(a)&&i.pop()}else i=r?r.measure().ticks():[];return i}function nl(e){const t=e?e.slice():null;let n=5,r=0;const i=bs(Object.assign(function(e,a){const[o,s]=t||Ks(a.measure().domain()),l=fs(e).append("path").attr("d",a.sectorpath(o,s,n,r));i.stylable(l)},{size(e){return arguments.length?(n=e,i):n},inset(e){return arguments.length?(r=e,i):r}})).class("g3-axis-sector");return i}function rl(){return nl().size(0).class("g3-axis-line")}function il(e){let t,n,r="tick",i=10,a=1,o=0;const s=e&&e.slice(),l=bs(Object.assign(function(e,u){const c=tl(s,t,n,u),h=fs(e).append("g");l.class("g3-axis-ticks-"+r).stylable(h);const p=h.selectAll(null).data(c).enter().append("g").attr("transform",e=>u.marktransform(e,o));switch(r){case"dot":p.append("circle").attr("r",i);break;case"wedge":p.append("path").attr("d",`M 0,${i} L ${a/2},0 L ${-a/2},0 z`);break;case"rect":p.append("rect").attr("width",a).attr("height",i).attr("x",-a/2);break;default:p.append("path").attr("d",hs()([[0,0],[0,i]]))}},{step(e){return arguments.length?(t=e,l):t},start(e){return arguments.length?(n=e,l):n},shape(e){return arguments.length?(r=e,l):r},size(e){return arguments.length?(i=e,l):i},width(e){return arguments.length?(a=e,l):a},inset(e){return arguments.length?(o=e,l):o}})).class("g3-axis-ticks");return l}function al(e){const t="object"==typeof e&&null!==e&&!Array.isArray(e),n=["fixed","relative","upward","clockwise","counterclockwise"];let r,i,a="fixed",o=20,s=25,l=0,u=t?t=>e[t]:vs;const c=t?Object.keys(e):e,h=bs(Object.assign(function(e,t){const n=tl(c,r,i,t),p=a.endsWith("clockwise"),f=p?ws("axis-label-path-"):void 0,g=fs(e).append("g");h.stylable(g);const m=g.selectAll(null).data(n).enter().append("g");if(p){const e=t.r()-s,n="clockwise"==a?1:0;m.append("path").attr("id",(e,t)=>`${f}-${t}`).attr("d",`M 0,${e} A ${e},${e},0,1,${n},0,-${e} A ${e},${e},0,1,${n},0,${e}`).attr("style","visibility: hidden").attr("transform",e=>t.metrictransform(e))}const d=m.append("text").attr("font-size",o);p?d.append("textPath").attr("startOffset","50%").attr("href",(e,t)=>`#${f}-${t}`).text(u):d.attr("transform",e=>{let n=t.marktransform(e,s),r=l;if("circular"==t.kind())if("fixed"==a)n+=" "+t.metrictransform(e,!0);else if("upward"==a){const n=(t.measure()(Number(e)+r)%360+360)%360;90<n&&n<270&&(r+=180)}return r&&(n+=` rotate(${r})`),`${n}`}).text(u)},{step(e){return arguments.length?(r=e,h):r},start(e){return arguments.length?(i=e,h):i},orient(e){if(e&&!n.includes(e))throw`g3.axisLabels().orient() unknown orientation '${e}'`;return arguments.length?(a=e,h):a},size(e){return arguments.length?(o=e,h):o},inset(e){return arguments.length?(s=e,h):s},rotate(e){return arguments.length?(l=e,h):l},format(e){return arguments.length?(u=e,h):u}})).class("g3-axis-labels");return h}function ol(e,t,n){const r=e??0,i=t??1,a=n??{},o=a.fmax??.01,s=a.damping??.9,l=a.wrap??!1;let u=Math.random(),c=0;return function(e){return"number"==typeof e&&isFinite(e)&&i>r&&(u=Math.min(1,Math.max(0,(e-r)/(i-r)))),u+=c,c+=(2*Math.random()-1)*o,c*=s,(u<0||u>1)&&(l?u=u>1?u-1:u+1:(c=-c,u=u<0?-u:2-u)),u*(i-r)+r}}function sl(e){const t=e.length,n=ol(0,t,{wrap:!0});let r;return function(i){const a=void 0===i||i===r?-1:e.indexOf(i);return r=e[Math.min(Math.floor(n(a<0?void 0:a+.5)),t-1)],r}}function ll(){return function(){return new Date}}function ul(){return function(){const e=new Date;return(e.getTime()-e.setHours(0,0,0,0))/1e3}}function cl(){const e=new Date;return function(){return((new Date).getTime()-e.getTime())/1e3}}Se`
/* Declare 7 and 14 segment LCD fonts, many other variants at https://www.keshikan.net/fonts-e.html */
@font-face {
font-family: 'DSEG7-Classic';
src: url('https://cdn.jsdelivr.net/npm/dseg@0.46.0/fonts/DSEG7-Classic/DSEG7Classic-Bold.woff2') format('woff2'),
url('https://cdn.jsdelivr.net/npm/dseg@0.46.0/fonts/DSEG7-Classic/DSEG7Classic-Bold.woff') format('woff'),
url('https://cdn.jsdelivr.net/npm/dseg@0.46.0/fonts/DSEG7-Classic/DSEG7Classic-Bold.ttf') format('truetype');
font-weight: bold;
font-style: normal;
}
@font-face {
font-family: 'DSEG14-Classic';
src: url('https://cdn.jsdelivr.net/npm/dseg@0.46.0/fonts/DSEG14-Classic/DSEG14Classic-Bold.woff2') format('woff2'),
url('https://cdn.jsdelivr.net/npm/dseg@0.46.0/fonts/DSEG14-Classic/DSEG14Classic-Bold.woff') format('woff'),
url('https://cdn.jsdelivr.net/npm/dseg@0.46.0/fonts/DSEG14-Classic/DSEG14Classic-Bold.ttf') format('truetype');
font-weight: bold;
font-style: normal;
}
/* default center panel on black background */
body {
margin: 0;
background-color: black;
font-family: Gill Sans,Gill Sans MT,Calibri,sans-serif;
color: #ccc;
}
.will-change-transform {
will-change: transform;
}
.g3-panel {
background-color: black;
display: block;
margin: 0 auto;
stroke: none;
fill: none;
}
.g3-panel * {
vector-effect: non-scaling-stroke;
}
.g3-panel text {
text-anchor: middle;
dominant-baseline: central;
font-stretch: condensed;
fill: #aaa;
}
.g3-axis-ticks-dot, .g3-axis-ticks-wedge, .g3-axis-sector, .g3-fg-fill {
fill: #ddd;
}
.g3-axis-line, .g3-axis-ticks, .g3-fg-stroke {
stroke: #ddd;
}
.g3-axis-ticks .g3-axis-ticks-dot, .g3-axis-ticks .g3-axis-ticks-wedge {
stroke: none;
}
.g3-grid-line line {
stroke: #666;
}
.g3-grid-hairline {
stroke: #333;
}
.g3-grid-label text {
font-size: 8px;
text-anchor: middle;
dominant-baseline: central;
fill: #999;
}
.g3-grid-label rect {
stroke: none; fill: black; opacity: 0.5;
}
.g3-gauge-face, .g3-bg-fill {
fill: #181818;
}
.g3-bg-stroke {
stroke: #181818;
}
/* semantic styles */
.g3-no-fill {
fill: none;
}
.g3-no-stroke {
stroke: none;
}
.g3-highlight-fill {
fill: orange;
}
.g3-highlight-stroke {
stroke: orange;
stroke-width: 2;
}
.g3-danger-stroke {
stroke: red;
stroke-width: 2;
}
.g3-danger-fill {
fill: red
}
.g3-warning-fill {
fill: #987808;
}
.g3-normal-fill {
fill: green;
}
.g3-cold-fill, .g3-sky-fill {
fill: #0580BA;
}
.g3-ground-fill {
fill: #6B5634;
}
/* pointer default styles */
.g3-indicate-pointer {
fill: #222;
filter: url(#dropShadow2);
}
.g3-pointer-needle {
fill: red;
}
.g3-pointer-blade {
fill: #e8e8e8;
stroke: #e8e8e8;
}
.g3-pointer-luminous {
fill: #e0e8d0;
stroke: #d0d8c0;
}
.g3-indicate-sector {
fill: green;
stroke: none;
}
.g3-indicate-sector.g3-indicate-sector-negative {
fill: red;
}
.g3-gauge-screw {
fill: #333;
filter: url(#dropShadow2);
}
.g3-gauge-screw rect {
fill: #222;
}
.g3-highlight {
fill: url(#highlightGradient);
fill-opacity: 0.25;
}
`;const hl=e=>e%90==0?"NESW".charAt(e/90):e/10,pl=Fi().domain([-10,10]).range([-50,50]);Se`
.g3-switch-control { cursor: pointer; }
.g3-switch-bezel { fill: #555; }
.g3-switch-recess { fill: #141414; }
.g3-switch-cap { fill: #282828; }
.g3-switch-cap-shine { fill: #3a3a3a; }
.g3-switch-cap-down { fill: #181818; }
.g3-switch-cap-down-face { fill: #222; }
.g3-switch-button text { fill: #e0e0e0; font-weight: bold; }
.g3-switch-button .g3-switch-pressed text { fill: #aaa; }
.g3-switch-collar { fill: #999; }
.g3-switch-collar-recess { fill: #333; }
.g3-switch-knurl { fill: #4a4a4a; }
.g3-switch-knob { fill: #1b1b1b; }
.g3-switch-knob-ridge { fill: #2c2c2c; }
`;const fl=sn();function gl(e,t="g3-gauge"){const n=fs(e).append("g").node(),r=n.closest("."+t)??n.parentElement;return n.remove(),r}function ml(t){return function(n,r){const i=gl(n);e.activeController&&r&&e.activeController.register(e=>{fl.set(i,e),t&&t(i,e)},r.metrics(),r.unit())}}function dl(e,t,n=18){const r=[],i=2*n;for(let n=0;n<i;n++){const a=n*Math.PI*2/i,o=n%2==0?e:t;r.push(`${0===n?"M":"L"} ${(o*Math.sin(a)).toFixed(2)},${(-o*Math.cos(a)).toFixed(2)}`)}return r.join(" ")+" Z"}function yl(e,t,n={}){const r=e??(n.onPress||"trigger"===n.mode?void 0:"button"),i=t??r??"",a=n.mode??"momentary",o=sn(),s=(e,t)=>an(e).select(".g3-switch-pressed").style("opacity",t?1:0);function l(e,t){if(n.onPress)n.onPress(e,t);else if("trigger"===a){const e=n.event??t.metric();e&&t.send({op:"trigger",event:e})}else"latch"===a?t.send({op:"set",value:fl.get(e.currentTarget)?0:1}):t.send({op:"set",value:1})}function u(e,t){const r=e.currentTarget;o.get(r)&&(o.set(r,!1),s(r,!1),"momentary"!==a||n.onPress||t.send({op:"set",value:0}))}const c=ms().class("g3-switch-control");"latch"!==a||n.onPress?c.on("pointerdown",function(e,t){const n=e.currentTarget;o.get(n)||(o.set(n,!0),s(n,!0),l(e,t))}).on("pointerup",u).on("pointerleave",u).on("pointercancel",u):c.on("click",l);const h=Xs().class("g3-switch-button");if(r&&h.metric(r),r&&"trigger"!==a&&h.fake(0),h.append(ml("latch"===a?(e,t)=>s(e,!!t):void 0)),"rect"===n.shape){const e=n.width??84,t=n.height??54,r=Math.round(.18*Math.min(e,t)),a=Math.round(.48*t),o=(n,r,i,a,o=0)=>gs("rect",{x:-e/2+n,y:-t/2+n+o,width:e-2*n,height:r,rx:i}).class(a);return h.append(c.append(o(0,t,r,"g3-switch-bezel"),o(3,t-6,.8*r,"g3-switch-recess"),o(5,t-10,.65*r,"g3-switch-cap"),gs("rect",{x:-e/2+8,y:-t/2+7,width:e-16,height:.34*(t-14),rx:.45*r}).class("g3-switch-cap-shine"),Qs(i,{size:a}),ms().class("g3-switch-pressed").style("opacity: 0").append(o(5,t-10,.65*r,"g3-switch-cap-down"),o(6,t-13,.55*r,"g3-switch-cap-down-face",1),Qs(i,{y:2,size:a}))))}return h.append(Qs(i,{size:20,y:-60}),c.append(gs("circle",{r:45}).class("g3-fg-fill"),gs("circle",{r:38}).class("g3-bg-fill"),gs("circle",{r:33}).class("g3-switch-recess"),gs("circle",{r:28}).class("g3-fg-fill").style("filter: url(#dropShadow2)"),ms().class("g3-switch-pressed").style("opacity: 0").append(gs("circle",{r:29}).class("g3-switch-cap-down"),gs("circle",{r:26}).class("g3-switch-bezel")),gs("circle",{r:28}).class("g3-highlight")))}function vl(e,t,n,r={}){const i=e||"selector",a=t??i,o=n||["OFF","ON"],s=Array.isArray(o)?Object.fromEntries(o.map((e,t)=>[t,e])):o,l=Object.keys(s).map(Number).sort((e,t)=>e-t),u=l.length,c=e=>l.indexOf(Number(e));function h(e,t,n){const i=c(fl.get(e.currentTarget));let a=i<0?0:i+n;if(a<0||a>=u){if(!r.wrap)return;a=(a+u)%u}t.send({op:"set",value:l[a]})}return Xs().metric(i).fake(l[0]).measure(Fi().domain([0,Math.max(1,u-1)]).range(r.range||[-60,60])).append(ml(),il(Re(u)).inset(54).size(6).style("stroke-width: 1.5"),al(Object.fromEntries(l.map((e,t)=>[t,s[e]]))).inset(34).size(14),Qs(a,{size:20,y:68}),ms().class("g3-switch-control").on("click",(e,t)=>h(e,t,un(e)[0]<0?-1:1)).on("wheel",(e,t)=>{e.preventDefault(),h(e,t,e.deltaY<0?1:-1)},{passive:!1}).append(gs("circle",{r:36}).class("g3-switch-collar"),gs("circle",{r:32}).class("g3-switch-collar-recess"),gs("circle",{r:29}).class("g3-bg-fill"),Ys().rescale(e=>Math.max(0,c(e))).append(gs("path",{d:dl(27,24.5,18)}).class("g3-switch-knurl"),gs("circle",{r:23}).class("g3-switch-knob"),gs("path",{d:"M -5.5,15 L -3.5,-30 L 3.5,-30 L 5.5,15 Z"}).class("g3-switch-knob-ridge"),gs("rect",{x:-1.6,y:-30,width:3.2,height:16,rx:.8}).class("g3-fg-fill"),gs("circle",{r:23}).class("g3-highlight"))))}Se`
.kt76c-bezel { fill: #1c1c1c; stroke: #444; stroke-width: 1.5; }
.kt76c-face { fill: #131313; stroke: #2a2a2a; stroke-width: 1; }
.kt76c-silkscreen { fill: #ccc; font-weight: bold; }
.kt76c-window { fill: #22090c; stroke: #333; stroke-width: 1.5; }
.kt76c-window-inner { fill: #2d0b0f; stroke: #160406; stroke-width: 1; }
.kt76c-photocell { fill: #111; stroke: #444; stroke-width: 0.8; }
.g3-panel text.kt76c-segment { fill: #ff2e1f; font-weight: bold; }
.g3-panel text.kt76c-digits { fill: #ff2e1f; font-family: DSEG7-Classic, monospace; }
`;const wl=["OFF","SBY","TST","ON","ALT"];function bl(e,t,n,r){const i=e??2,a=t??19,o=n??96,s=.05*(a-i);return Xs().metric("fuel").unit("gal").instance(r).fake(ol(0,a+2)).measure(Fi().domain([i,a]).range([180+o/2,540-o/2])).append(Zs(),rl(),il().step(4).size(15),il([i,a]).size(15),al().inset(30).size(25).step(4),al({[i-s]:"E",[a+s]:"F"}).inset(10).size(25),Qs((r??"").toUpperCase()).size(25).y(-30),ms().y(40).scale(.1).append(el().metric("fuelSelector").instance(r?"..":"").fake(sl(["front","center","rear"])).trigger(e=>e==r?1:.1).color("orange")),Ys().shape("rondel"))}const _l=e=>_a("%a")(e).slice(0,2).toUpperCase();const kl=[].concat(Re(60,95,5),Re(100,200,10),Re(200,300,25),Re(300,400,50),Re(400,600,100)),xl=e=>!kl.includes(e),Ml=e=>Math.abs(e-5*Math.round(e/5))>.25;const zl={nav:{airspeed:{DHC2:function(){return Xs().metric("airspeed").unit("knot").fake(ol(40,200)).measure(Fi().domain([40,200]).range([30,350])).append(Zs(),nl([60,105]).inset(10).size(5),nl([60,145]).size(5).class("g3-normal-fill"),nl([145,180]).size(5).class("g3-danger-fill"),il().step(5).size(10),il().step(10).size(15).style("stroke-width: 2"),il([180]).size(15).class("g3-danger-stroke"),al().step(20).inset(30),Qs("AIRSPEED").size(12).y(-33),Qs("MPH").y(33),Ys().shape("sword"))}},altitude:{generic:function(){return Xs().metric("altitude").unit("ft").fake(ol(0,3e4,{fmax:.001})).measure(Fi().domain([0,1e3]).range([0,360])).defs(gs("pattern",{id:"altitudeDangerPattern",width:10,height:10,patternTransform:"rotate(45)",patternUnits:"userSpaceOnUse"}).append(gs("rect",{width:10,height:5}).class("g3-fg-fill"))).append(ms().rotate(90).append(Xs().metric("pressureSetting").unit("hPa").fake(ol(955,1075)).measure(Fi().domain([955,1075]).range([0,360])).autoindicate(!0).append(Zs().style("fill: #111"),il().step(5).size(5).inset(10),il().step(1).size(3).inset(10),il([1013.25]).size(5).inset(10).class("g3-danger-stroke"),al(Re(955,1075,5)).size(10).orient("relative").rotate(-90))),gs("circle",{r:65,fill:"url(#altitudeDangerPattern)"}),Ys().rescale(e=>3*e/100).append(nl([625,1125]).inset(40).size(60).class("g3-bg-fill")).style("filter: url(#dropShadow1)"),Zs().window((e,t)=>{nl([225,275]).inset(11).size(24).style("fill: black")(e,t),nl([425,575]).inset(40).size(40).style("fill: black")(e,t)}).style("filter: url(#dropShadow3)"),il([250]).shape("wedge").size(10).width(3),il().step(20),il().step(100).size(15).style("stroke-width: 2"),al().step(100).format(e=>e/100).size(25),al({950:"100",50:"FEET"}).orient("relative").size(8).inset(16),al({0:"1000 FEET"}).orient("clockwise").inset(50).size(8),al({0:"10000 FEET"}).orient("clockwise").inset(62).size(8),Qs("CALIBRATED").x(-40).y(-8).size(6),Qs("TO").x(-40).y(0).size(6),Qs("20,000 FEET").x(-40).y(8).size(6),Ys().shape("dagger").rescale(e=>e/100),Ys().shape("blade").rescale(e=>e/10),Ys().shape("sword"))}},attitude:{generic:function(){return Xs().append(Xs().metric("roll").unit("deg").fake(ol(-25,25)).measure(Fi().domain([-90,90]).range([-90,90])).autoindicate(!0).clip(Zs()).append(ms().rotate(-90).append(Xs().metric("pitch").unit("deg").fake(ol(-25,25)).measure(Fi().domain([-20,20]).range([-25,25])).kind("linear").autoindicate(!0).css("text {fill: #ddd}").append(gs("rect",{height:200,width:150,y:-100}).class("g3-sky-fill g3-fg-stroke"),gs("rect",{height:200,width:150,x:-150,y:-100}).class("g3-ground-fill g3-fg-stroke"),il([-20,20]).size(50).inset(-25),il([-10,10]).size(30).inset(-15),il().start(-15).step(10).size(20).inset(-10),al([-20,20]).inset(35).format(Math.abs).rotate(90).size(12),al([-20,20]).inset(-35).format(Math.abs).rotate(90).size(12),al([-10,10]).inset(25).format(Math.abs).rotate(90).size(12),al([-10,10]).inset(-25).format(Math.abs).rotate(90).size(12))),nl([0,360]).size(20).style("filter: url(#dropShadow3)"),nl([-90,90]).size(20).class("g3-sky-fill g3-fg-stroke"),nl([90,270]).size(20).class("g3-ground-fill g3-fg-stroke"),il().step(30).size(20),il([-45,45]).shape("wedge").inset(10).size(10).width(10),il([-20,-10,10,20]).inset(10).size(10)),gs("circle",{r:100}).class("g3-fg-stroke"),ms().append(gs("path",{d:"M 0,-80 l 5,15 l -10,0 z"}).class("g3-highlight-stroke g3-no-fill"),gs("path",{d:"M -15,0 a 15,10 0 0 0 30,0 M 0,10 l 0,35"}).class("g3-bg-stroke").style("stroke-width: 2"),gs("path",{d:"M 0,40 l 15,38 a 100,100 0 0 1 -30,0 z"}).class("g3-bg-fill").style("stroke-width: 2"),gs("path",{d:"M -50,0 l 35,0 m 30,0 l 35,0"}).class("g3-highlight-stroke g3-no-fill").style("filter: url(#dropShadow1)"),gs("circle",{r:2}).class("g3-highlight-fill")).style("filter: url(#dropShadow1)"))}},heading:{generic:function(){return Xs().metric("heading").unit("deg").fake(ol(0,360,{wrap:!0})).measure(Fi().domain([0,360]).range([0,360])).autoindicate(!0).append(Zs(),il().step(5).size(5),il().step(10).size(10),il().step(30).size(10).style("stroke-width: 2"),al().step(30).orient("relative").format(hl),Ys().shape("aircraft-heading"))}},turnCoordinator:{generic:function(){return Xs().metric("turnrate").unit("deg/s").fake(ol(-10,10)).measure(Fi().domain([-3,3]).range([-20,20])).append(Xs().metric("slip").unit("deg").fake(ol(-25,25)).measure(Fi().domain([-20,20]).range([170,190])).r(300).append(Zs(),Qs("TURN COORDINATOR").size(11).y(22),Qs("2 MIN").size(14).y(65),ms().y(-255).append(nl([-30,30]).inset(-9).size(18).style("fill: #c0c0a8; filter: url(#dropShadow3)"),Ys().clamp([-20,20]).append(ms().scale(.8,1).y(-300).rotate(-180).append(gs("circle",{r:8}).style("fill: #333"),gs("circle",{r:8}).class("g3-highlight"))),il([-3,3]).inset(-9).size(18).style("stroke-width: 2; stroke: #666"),nl([-30,30]).inset(0).size(6).style("fill: white; filter: url(#gaussianBlur1); fill-opacity: 0.33"))),nl([0,360]).size(24).class("g3-bg-fill").style("filter: url(#dropShadow2)"),il([-16.5,-13.5,13.5,16.5]).size(24).style("stroke-width: 4"),Qs("D.C.").y(-92),Qs("ELEC.").y(-82),Qs("NO PITCH").y(80).size(8),Qs("INFORMATION").y(90).size(8),Ys().clamp([-9,9]).shape("aircraft-turn"))}},VSI:{generic:function(){return Xs().metric("verticalSpeed").unit("ft/min").fake(ol(-2500,2500)).measure(Fi().domain([-2e3,2e3]).range([90,450])).append(Zs(),il().step(100).size(5),il().step(500).size(15).style("stroke-width: 2"),al().step(1e3).format(e=>Math.abs(e/100)),al().step(1e3).start(-1500).format(e=>Math.abs(e/100)).size(16),Qs("VERTICAL SPEED").y(-25).size(12),Qs("100 FEET PER MIMUTE").y(-10).size(10),nl([100,400]).size(0).inset(25).class("g3-fg-stroke").style("stroke-width: 2"),nl([-100,-400]).size(0).inset(25).class("g3-fg-stroke").style("stroke-width: 2"),(e,t)=>{e.selectAll(null).data([-400,400]).enter().append("path").attr("d","M 2,0 l -7,4 l 0,-8 Z").attr("transform",e=>t.marktransform(e,25)+(e<0?" rotate(-180)":"")).attr("class","g3-fg-fill")},Qs("UP").x(-57).y(-37).size(8).style("text-anchor: start"),Qs("DOWN").x(-57).y(37).size(8).style("text-anchor: start"),Ys().shape("sword").clamp([-1950,1950]))}}},radionav:{ADF:{generic:function(){return Xs().metric("relativeADF").unit("deg").fake(ol(0,360,{wrap:!0})).measure(Fi().domain([0,360]).range([0,360])).append(Xs().metric("headingADF").unit("deg").fake(ol(0,360,{wrap:!0})).measure(Fi().domain([0,360]).range([0,360])).autoindicate(!0).append(nl([0,360]).size(30).class("g3-bg-fill"),il().step(5).inset(30).size(-5),il().step(10).inset(30).size(-10),il().step(30).inset(30).size(-10).style("stroke-width: 2"),al().step(30).inset(10).size(16).orient("relative").format(hl)),Zs().r(70),Ys().append(gs("path",{d:"M 0,-65 L 0,60"}).class("g3-fg-stroke").style("stroke-width: 4"),gs("path",{d:"M 0,65 l 5,-15 l -10,0 z"}).class("g3-fg-fill")),il().step(45).shape("wedge").size(15).width(6).class("g3-highlight-fill g3-no-stroke"),gs("path",{d:"M 0,-10 l 0,30 m 5,-5 l -10,0 M 15,0 l -30,0"}).class("g3-highlight-stroke").style("stroke-width: 3"))}},VOR:{generic:function(){return Xs().metric("radialDeviation").unit("deg").fake(ol(-10,10)).measure(pl).kind("linear").clip(Zs()).append(Zs(),il([-10,-8,-6,-4,0,4,6,8,10]).shape("dot").size(3),gs("circle",{r:pl(2)}).class("g3-axis-ticks").style("stroke-width: 2; fill: none"),Qs("TO").x(35).y(-35).size(8),Qs("FR").x(35).y(35).size(8),gs("path",{d:"M 35,25 l 8,-14 l -16,0 z"}).class("g3-highlight-fill"),gs("path",{d:"M 35,-25 l 8,14 l -16,0 z"}).class("g3-bg-fill"),Xs().metric("toFromVOR").fake(sl([1,0,-1])).append(Ws().trigger(e=>-1==e?.9:.1).append(gs("path",{d:"M 35,25 l 8,-14 l -16,0 z"}).class("g3-bg-fill"),gs("path",{d:"M 35,-25 l 8,14 l -16,0 z"}).class("g3-highlight-fill"))),Xs().metric("toFromVOR").append(Ws().trigger(e=>0==e?1:0).append(gs("path",{d:"M 35,-25 l 8,14 l -16,0 z"}).class("g3-bg-fill"),gs("path",{d:"M 35,25 l 8,-14 l -16,0 z"}).class("g3-bg-fill"),gs("rect",{x:10,width:12,y:-50,height:30}).style("fill: red"))),ms().y(-35).x(16).css("text {fill: black}").append(Qs("N").y(-9),Qs("A"),Qs("V").y(9)),Ys().append(gs("path",{d:"M 0,-100 L 0,100"}).class("g3-fg-stroke").style("stroke-width: 4")),Xs().metric("radialVOR").unit("deg").fake(ol(0,360,{wrap:!0})).measure(Fi().domain([0,360]).range([0,360])).autoindicate(!0).append(nl([0,360]).size(30).style("filter: url(#dropShadow3)").class("g3-bg-fill"),il().step(5).inset(30).size(-5),il().step(10).inset(30).size(-10),il().step(30).inset(30).size(-10).style("stroke-width: 2"),al().step(30).inset(10).size(16).orient("relative").format(hl)),gs("path",{d:"M 0,-80 l 0,10 l 8,14 l -16,0 l 8,-14 z"}).class("g3-highlight-fill g3-highlight-stroke"))}},transponder:{KT76C:function(t={}){const n=t.code??"transponderCode",r=t.mode??"transponderMode",i=t.ident??"transponderIdent",a=t.altitude??"altitude.pressure",o=(e,...t)=>t.some(t=>Number(e)===wl.indexOf(t)),s=sn();function l(e){var t;e.text?.text(o(e.mode,"TST")?"8888":e.entry?e.entry.padEnd(4,"-"):null==(t=e.code)||""===t?"----":String(t).padStart(4,"0"))}const u=(e,t)=>(r,i)=>{const a=s.get(r.currentTarget);a.entry=void 0===t?e(a.entry):"",4==a.entry.length?(i.send({op:"set",metric:n,value:a.entry}),a.entry=""):void 0!==t&&i.send({op:"set",metric:n,value:t}),l(a)},c=(e,t,n,r,i)=>Ws().trigger((e,t)=>i(e,t)?1:0).append(ms().class(t).append(Qs(e,{x:n,y:r,size:3.6}).class("kt76c-segment"))),h=(e,t,n,r)=>ms().x(t).y(20).scale(.16).append(yl(void 0,e,{shape:"rect",width:n,height:56,onPress:r}));return Xs().class("kt76c").append(e=>{s.set(gl(e,"kt76c"),{entry:""})},gs("rect",{x:-100,y:-32,width:200,height:64,rx:3}).class("kt76c-bezel"),gs("rect",{x:-97,y:-29,width:194,height:40,rx:2}).class("kt76c-face"),Qs("BENDIX/KING",{x:-76,y:-23.5,size:4.1}).class("kt76c-silkscreen"),Qs("XPDR",{x:52,y:-23.5,size:4.1}).class("kt76c-silkscreen"),Qs("KT 76C TSO",{x:80,y:-23.5,size:3.7}).class("kt76c-silkscreen"),ms().x(-76).y(-8).scale(.2).append(yl(void 0,"IDT",{shape:"rect",width:92,height:52,mode:"trigger",event:i})),gs("rect",{x:-55,y:-24,width:98,height:29,rx:1.5}).class("kt76c-window"),gs("rect",{x:-53,y:-22,width:94,height:25,rx:1}).class("kt76c-window-inner"),Xs().metric(a,r).unit("ft").fake(ol(1e3,18e3)).append(Ws().trigger((e,t)=>o(t?.[r],"ALT","TST")?1:0).append(Qs("FL",{x:-47,y:-3,size:4.2}).class("kt76c-segment"),ms().x(-30).y(-9).class("kt76c-fl").append(Bs().size(12.5).class("kt76c-digits").format((e,t)=>o(t?.[r],"TST")?"888":ki("03d")(Math.max(0,Math.round((Number(e)||0)/100))))))),Xs().metric(r,i).append(c("ALT","kt76c-alt",-11,-15.5,e=>o(e,"ALT","TST")),c("ON","kt76c-on",-2,-15.5,e=>o(e,"ON","ALT","TST")),c("SBY","kt76c-sby",-7,-3,e=>o(e,"SBY","TST")),c("R","kt76c-reply",5,-15.5,(e,t)=>o(e,"TST")||!!t?.[i]&&o(e,"ON","ALT"))),Xs().metric(n,r).fake("1200").append(Ws().trigger((e,t)=>o(t?.[r],"OFF")?0:1).append(ms().x(22).y(-9).class("kt76c-code").append((t,n)=>{const i=fs(t).append("text").attr("font-size",12.5).attr("class","kt76c-digits"),a=s.get(i.node());a.text=i,e.activeController&&n&&e.activeController.register((e,t,n)=>{a.code=e,a.mode=n?.[r],l(a)},n.metrics(),n.unit()),l(a)}))),ms().x(76).y(-4).scale(.24).append(vl(r,"",[...wl],{range:[-135,-20]}).fake(wl.indexOf("ALT"))),...[-86,-69,-52,-35,-18,4,21,38].map((e,t)=>h(String(t),e,82,u(e=>e+t))),gs("circle",{cx:-7,cy:20,r:2.2}).class("kt76c-photocell"),h("CLR",61,96,u(e=>e.slice(0,-1))),h("VFR",83,96,u(e=>e,"1200")))}}},engine:{tachometer:{DHC2:function(){return Xs().metric("engineRPM").unit("rpm").fake(ol(300,3500)).measure(Fi().domain([300,3500]).range([225,495])).append(Zs(),nl([1600,2e3]).size(7).class("g3-cold-fill"),nl([2e3,2200]).size(7).class("g3-normal-fill"),il().step(100).size(10),il().step(500).size(15).style("stroke-width: 2"),il([2300]).size(15).class("g3-danger-stroke"),al().step(500).inset(30).format(e=>e/100),al([300]).format(e=>e/100),Qs("RPM").size(12).y(-45),Qs("HUNDREDS").size(8).y(-30),Ys().shape("rondel"))},jageype:function(){return Xs().metric("engineRPM").unit("rpm").measure(Fi().domain([0,6e3]).range([-125,125])).css("\ntext.g3-gauge-label, .g3-axis-labels text {\n font-stretch: normal;\n font-weight: 600;\n fill: #ccc;\n}\n.g3-gauge-face { fill: #282828 }\n").append(Zs(),Zs().r(50).style("filter: url(#dropShadow2)"),nl([5e3,6e3]).inset(50).size(35).style("fill: #800"),Qs("SMITHS").y(-45).size(7),Qs("8 CYL").y(40).size(7),ms().rotate(180).append(al({3e3:"POSITIVE EARTH"}).orient("counterclockwise").size(3.5).inset(52)),Qs("RPM").y(65).size(12),Qs("X 100").y(75).size(8),Js().shape("phillips").r(3).x(-20),Js().shape("phillips").r(3).x(20),ms().scale(.95).append(nl().style("fill: none; stroke: white"),il().step(500).style("stroke-width: 5"),il().step(100).size(5),al().inset(20).size(15).format(e=>e/100),Ys().append(gs("path",{d:"M 3,0 l -1.5,-90 l -1.5,-5 l -1.5,5 l -1.5,90 z"}).style("fill: #ddd"),gs("path",{d:"M 3,0 l -0.75,-45 l -4.5,0 l -0.75,45 z"}).style("fill: #333"),gs("path",{d:"M -1,0 l 0,-90 l 2,0 z"}).style("fill: white; filter: url(#gaussianBlur1); opacity: 0.5"),gs("circle",{r:15}).style("fill: #ccd"),gs("circle",{r:15}).class("g3-highlight"),gs("circle",{r:5}).style("fill: #333"))))}},speedometer:{BMW:function(){return Xs().metric("speed").unit("mph").fake(ol(9,160)).measure(Fi().domain([0,160]).range([-120,120])).append(Zs(),nl([-3,163]).size(1).inset(-1).class("g3-axis-line"),nl([-3,163]).inset(2).size(5).style("fill: #333"),il().step(10).inset(2).size(5),al().step(20).size(14).inset(20).format(e=>e.toString().padEnd(3," ")),al({"-3":"mph"}).inset(24).size(6),Xs().metric("speed").unit("km/h").measure(Fi().domain([0,257.4944]).range([-120,120])).r(66).append(il(Re(0,261,10)).step(10).size(3),al(Re(0,261,20)).size(8).inset(12).format(e=>e.toString().padEnd(3," ")),al({"-5":" km/h"}).inset(16).size(5)),Ys(),Xs().metric("range").unit("mi").fake(ol(0,500)).measure(Fi().domain([-100,600]).range([240,120])).r(90).append(nl([-50,550]).size(1).inset(-3).class("g3-axis-line"),il(Re(0,500,10)).style("stroke: #800").size(5),al(Re(0,500,200)).size(10).inset(15),Vs().size(5).style("fill: red"),il(Re(0,501,100)).size(8).style("stroke-width: 2"),al({500:"miles"}).orient("counterclockwise").size(6).inset(-7)),Xs().metric("destination").unit("mi").fake(ol(0,500)).measure(Fi().domain([-100,600]).range([240,120])).append(Ys().append(gs("circle",{cy:-85,r:4})).style("fill: white; stroke: black; filter: none;")))}},suctionPressure:{DHC2:function(){return Xs().metric("suctionPressure").unit("inHg").fake(ol(0,10)).measure(Fi().domain([0,10]).range([210,510])).append(Zs(),il(Re(0,10.1,.2)).size(10),il(Re(0,10.1)).size(20).style("stroke-width: 2"),il([4.5,5.4]).size(20).class("g3-danger-stroke"),al(Re(0,10.1,2)).inset(33),Qs("SUCTION").size(15).y(-33),Qs("INCHES OF MERCURY").y(25),Ys().shape("sword"))}},manifoldPressure:{DHC2:function(){return Xs().metric("manifoldPressure").unit("inHg").fake(ol(10,50)).measure(Fi().domain([10,50]).range([-1e3/9,1e3/9])).append(Zs(),nl([30,35]).size(7).class("g3-normal-fill"),nl([18,30]).size(7).class("g3-cold-fill"),il(Re(10,51)).size(10),il(Re(10,51,5)).size(15).style("stroke-width: 2"),il([30,36.5]).size(17).class("g3-danger-stroke"),al(Re(10,51,10)).inset(30).size(25),al(Re(15,51,10)).size(15),Qs("MANIFOLD").size(12).y(-45),Qs("PRESSURE").size(12).y(-30),Qs("INCHES OF MERCURY").size(8).y(50),Ys().shape("sword"))}},fuel:{generic:bl,DHC2:function(){return Xs().append(Zs(),Qs("FUEL").size(15).y(75),ms().scale(.4).x(-45).y(25.98).append(bl(3,25,96,"front")),ms().scale(.4).x(45).y(25.98).append(bl(3,25,96,"center")),ms().scale(.4).y(-51.96).append(bl(2,19,88,"rear")))}},oilFuelStatus:{DHC2:function(){return Xs().append(Zs(),Qs("LBS").y(50),Qs("SQ.IN").size(7).y(60),ms().scale(.5).x(-15).y(40).append(Xs().r(90).metric("oilPressure").unit("psi").fake(ol(0,200)).measure(Fi().domain([0,200]).range([180,360])).append(rl(),nl([70,90]).inset(-5).class("g3-normal-fill"),il().step(50).inset(-15).size(15),il().step(10).inset(-10).size(10),il([50,100]).inset(-15).size(15).class("g3-danger-stroke"),al().step(50),Qs("OIL").size(20).x(-5).y(-20),Ys().shape("sword"))),ms().scale(.5).x(15).y(40).append(Xs().r(90).metric("fuelPressure").unit("psi").fake(ol(0,10)).measure(Fi().domain([0,10]).range([180,0])).append(rl(),nl([4,5]).inset(-5).class("g3-normal-fill"),il().step(1).inset(-15).size(15),il([3,6]).inset(-15).size(15).class("g3-danger-stroke"),al().step(5),Qs("FUEL").size(20).x(5).y(-20),Ys().shape("sword"))),ms().scale(.9).y(-5).append(Xs().r(90).metric("oilTemperature").unit("C").fake(ol(0,100)).measure(Fi().domain([0,100]).range([-90,90])).append(rl(),nl([60,75]).inset(-3).size(3).class("g3-normal-fill"),il().step(10).inset(-10).size(10),il().step(5).inset(-5).size(5),il([40,85]).inset(-10).size(10).class("g3-danger-stroke"),al().step(20).inset(20),Qs("TEMP°C").size(11).y(-45),Ys().shape("sword"))))}},carbMixtureTemp:{DHC2:function(){return Xs().metric("carbMixtureTemp").unit("C").fake(ol(-50,50)).measure(Fi().domain([-50,50]).range([225,315])).append(Zs(),Qs("°C").size(20).x(-10),Js().shape("phillips").x(30).y(60),Js().shape("phillips").x(30).y(-60),ms().x(50).append(nl([-10,5]).inset(-10).size(10).class("g3-warning-fill"),nl([5,15]).inset(-10).size(10).class("g3-normal-fill"),il().step(5).inset(-10).size(10),il().step(10).inset(-20).size(20),il([20]).inset(-20).size(20).class("g3-danger-stroke"),al().step(20).inset(15).size(15).format(e=>{const t=Math.abs(e);return t+(40==t?e>0?"+":"-":"")}),Ys().shape("needle")))}},cylinderHeadTemp:{DHC2:function(){return Xs().metric("cylinderHeadTemp").unit("C").fake(ol(0,350)).measure(Fi().domain([0,350]).range([-70,70])).r(90).append(Zs(),Qs("°C").size(12).y(-45),Qs("CYL.TEMP.").size(12).y(-25),Js().shape("phillips").x(50).y(50),Js().shape("phillips").x(-50).y(50),ms().y(30).append(nl([150,230]).inset(-5).size(5).class("g3-cold-fill"),nl([230,260]).inset(-5).size(5).class("g3-normal-fill"),il().step(10).size(5).inset(-5),il().step(50).size(10).inset(-10),il([100,260]).size(10).inset(-10).class("g3-danger-stroke"),al().step(100).start(100).inset(-20).size(15).format(e=>e/100),al([50,150,250]).inset(-18).size(8),al({"-10":0,360:350}).inset(0).size(10),Ys().shape("needle")))}}},electrical:{ammeter:{DHC2:function(){return Xs().metric("alternatorLoad").unit("proportion").fake(ol(-.1,1.25)).measure(Fi().domain([-.1,1.2]).range([-45,45])).append(Zs(),Qs("ALT. LOAD").size(15).y(-30),ms().y(50).append(rl(),il().step(.1).size(5).inset(-5),il().step(.5).start(0).size(10).inset(-10),il([1]).size(10).inset(-10).class("g3-danger-stroke"),al().start(0).step(.5).inset(-20).size(15).format(e=>e.toFixed(1)),al({"-0.2":"D",1.3:"C"}).size(15).inset(0),Ys().shape("rondel")))}},voltmeter:{DHC2:function(){return Xs().metric("alternatorVolts").unit("V").fake(ol(0,30)).measure(Fi().domain([0,30]).range([-45,45])).append(Zs(),Qs("VOLTS").size(15).y(-35),Qs("DC").size(15).y(-20),ms().y(50).append(rl(),il().step(1).inset(-5).size(5),il().step(5).inset(-8).size(8),il().step(10).inset(-10).size(10),al([10,20]).size(15).inset(-20),al([0,30]).size(15).inset(10),Ys().shape("rondel")))}}},clocks:{simple:function(){return Xs().metric("time").unit("s").fake(ul()).measure(Fi().domain([0,60]).range([0,360])).append(Zs(),il().step(5).size(10),il(Re(0,60).filter(e=>e%5)).shape("dot").size(1).inset(2).style("stroke: none; fill: white"),al().step(5).start(5).format(e=>e/5).inset(20),Ys().shape("blade").rescale(e=>e/60/12),Ys().shape("sword").rescale(e=>e/60),Ys().rescale(ds()))},casioF91W:function(){return Xs().metric("date").unit("dateTime").fake(ll()).css("text.g3-indicate-text { fill: #20282C }").append(gs("rect",{width:200,height:80,x:-100,y:-43}).attr("rx",10).style("fill: #BCDCD8"),ms().x(-65).y(-20).append(Bs().format(_a("%p")).size(15).style("font-family: Gill Sans; font-weight: normal;")),ms().x(-5).y(-25).append(Bs().format(_l).style("font-family: DSEG14-Classic")),ms().x(70).y(-25).append(Bs().format(_a("%e")).style("font-family: DSEG14-Classic")),ms().x(-20).y(10).append(Bs().format(_a("%_I:%M")).size(36).style("font-family: DSEG7-Classic")),ms().x(65).y(14).append(Bs().format(_a("%S")).size(27).style("font-family: DSEG7-Classic")))},omegaSpeedmaster:function(){return Xs().metric("time").unit("s").fake(ul()).measure(Fi().domain([0,60]).range([0,360])).css("\n.g3-pointer-hub, .g3-pointer-blade {fill: #ddd; stroke: #ddd}\ntext {fill: #ccc}\n.g3-highlight {fill-opacity: 0.5;}\n").append(ms().rotate(90).append(Xs().autoindicate(!0).metric("date").unit("dateTime").fake(ll()).rescale(e=>e.getDate()).measure(Fi().domain([1,32]).range([0,360])).append(Zs(),al().step(1).orient("relative").rotate(-90).size(13).inset(45))),Zs().window(nl([13.75,16.25]).inset(36).size(19).style("fill: black")),Zs().r(45).style("fill: #282828"),nl([13.75,16.25]).inset(36).size(19).style("fill: none; stroke: #ccc; stroke-width: 3"),rl().style("stroke-width: 4; stroke: #aaa"),nl().inset(14).size(10).style("fill: #aaa"),nl().inset(17).size(1).style("fill: white; filter: url(#gaussianBlur1)"),Xs().measure(Ii().exponent(-1).domain([60,500]).range([360,43.2])).append(il(Re(60,100).filter(xl)).inset(12).size(-3),il(Re(60,140,5).filter(xl)).inset(12).size(-5),il(kl).shape("dot").size(.5).inset(12),al(kl).inset(6).size(6)),al({3.6:"TACHYMETRE"}).orient("clockwise").inset(7).size(7),ms().scale(.72).append(il(Re(0,60,.2).filter(Ml)).size(3).style("stroke: #888"),il(Re(0,60,1).filter(Ml)).size(8),il([29,31]).inset(3).size(5).class("g3-bg-stroke"),il(Re(0,60,5).filter(e=>e%15)).inset(8).size(16).shape("wedge").width(4).style("stroke-width: 3"),al().step(5).start(5).format(ki("02d")).inset(2.5).size(7.5).orient("upward")),al({31:"SWISS",29:"MADE"}).orient("counterclockwise").inset(31.5).size(2.5),gs("image",{href:"speedmaster_logo.png",width:32,x:9,y:-16}),ms().x(-42).scale(.25).append(Zs(),rl().style("stroke: #aaa; stroke-width: 4"),nl().size(50).style("fill: #282828"),il(Re(5,60,5).filter(e=>e%15)).inset(5).size(20).style("stroke-width: 2"),al().step(15).start(15).size(40),Ys().shape("wedge").rescale(ds())),Xs().metric("elapsed").unit("s").fake(cl()).measure(Fi().domain([0,60]).range([0,360])).append(ms().y(-42).scale(.25).append(Zs(),rl().style("stroke: #aaa; stroke-width: 4"),nl().size(50).style("fill: #282828"),il(Re(2,60,2).filter(e=>Math.abs(e-20*Math.round(e/20))>2)).step(2).inset(5).size(10),il().start(10).step(20).inset(5).size(20).style("stroke-width: 2"),al().start(20).step(20).size(40).format(e=>e/2),Ys().shape("wedge").rescale(e=>e/30)),ms().y(42).scale(.25).append(Zs(),rl().style("stroke: #aaa; stroke-width: 4"),nl().size(50).style("fill: #282828"),il(Re(5,60,5).filter(e=>e%15)).inset(5).size(20).style("stroke-width: 2"),al().step(15).start(15).size(40).format(e=>e/5),Ys().shape("wedge").rescale(e=>e/60/12))),ms().scale(.75).append(Ys().shape("omega-baton-short").rescale(e=>e/60/12),Ys().shape("omega-baton-long").rescale(e=>e/60),Xs().metric("elapsed").unit("s").measure(Fi().domain([0,60]).range([0,360])).append(Ys().shape("omega-second"))))}},switches:{toggle:function(e,t){const n=e||"status",r=t??n;return Xs().metric(n).fake(0).measure(Fi().domain([0,1]).range([-40,40])).kind("linear").append(ml(),ms().rotate(-90).class("g3-switch-control").on("click",(e,t)=>t.send({op:"set",value:fl.get(e.currentTarget)?0:1})).append(gs("path",{d:"M 40,40 a 40,40 0 0 0 0,-80 l -80,0 a 40,40 0 0 0 0,80 z"}).class("g3-fg-stroke g3-bg-fill").style("stroke-width: 7"),al({0:"off",1:"on"}).inset(60).rotate(90),Qs(r,{size:20,y:-60}),Ys().append(gs("circle",{r:30}).class("g3-fg-fill"))))},button:yl,rotary:function(e,t,n={}){const r=e||"rotary",i=t??r,a=n.step??1,o=n.detents??12,s=Object.fromEntries(["min","max","wrap"].filter(e=>void 0!==n[e]).map(e=>[e,n[e]])),l=(e,t)=>e.send({op:"adjust",by:t*a,...s});return Xs().metric(r).fake(n.min??0).measure(Fi().domain([0,a*o]).range([0,360])).append(Qs(i,{size:20,y:-65}),nl([-4.2*a,-1.8*a]).inset(48).size(0).class("g3-fg-stroke").style("stroke-width: 2"),nl([1.8*a,4.2*a]).inset(48).size(0).class("g3-fg-stroke").style("stroke-width: 2"),Qs("-",{x:-55,y:0,size:24}),Qs("+",{x:55,y:0,size:20}),ms().class("g3-switch-control").on("click",(e,t)=>l(t,un(e)[0]<0?-1:1)).on("wheel",(e,t)=>{e.preventDefault(),l(t,e.deltaY<0?1:-1)},{passive:!1}).append(gs("circle",{r:44}).class("g3-fg-fill"),gs("circle",{r:39}).class("g3-bg-fill"),Ys().append(gs("path",{d:dl(35,31.5,20)}).class("g3-switch-collar"),gs("circle",{r:29.5}).class("g3-switch-cap-down-face"),gs("circle",{r:28}).class("g3-switch-collar-recess"),gs("circle",{cy:-17,r:5}).class("g3-switch-cap-down"),gs("circle",{r:28}).class("g3-highlight"))))},selector:vl},debug:{alignment:function(){return Xs().append(Zs().style("fill: #333"),gs("line",{x1:-100,x2:100}).style("stroke: #8f8"),gs("line",{y1:-100,y2:100}).style("stroke: #8f8"),rl().style("stroke: #ff8"))}}},Cl=ys(zl).filter(([,e])=>"function"==typeof e).map(([e,t])=>[e.join("."),t()]),Sl=Object.keys(Is),Al={contrib:Hs().width(1280).height(320*Math.floor((Cl.length+3)/4)+40).append(...Cl.map(([e,t],n)=>ms().x(n%4*320+160).y(320*Math.floor(n/4)+160).scale(1.28).append(t,Qs(e).y(120)))),pointers:Hs().width(960).height(240*Math.floor((Sl.length+4)/4)+40).append(...Sl.map((e,t)=>ms().x(t%4*240+120).y(240*Math.floor(t/4)+120).append(Xs("pointer-"+e).append(rl().style("stroke: #333"),Ys().shape(e)),Qs(e).y(110).size(15))))};return e.axisLabels=al,e.axisLine=rl,e.axisSector=nl,e.axisTicks=il,e.categoricalSeries=sl,e.contrib=zl,e.convertUnits=Ns,e.d3sel=fs,e.datetimeSeries=ll,e.elapsedSecondsSeries=cl,e.element=gs,e.flatten=ys,e.forceSeries=ol,e.gallery=Al,e.gauge=Xs,e.gaugeController=Ls,e.gaugeFace=Zs,e.gaugeLabel=Qs,e.gaugeScrew=Js,e.grid=Rs,e.indicatePointer=Ys,e.indicateSector=Vs,e.indicateStyle=Ws,e.indicateText=Bs,e.indicateUnit=function(){let t=vs,n=20;const r=bs(Object.assign(function(i,a){let o=fs(i).append("text").attr("font-size",n);if(r.stylable(o),o=o.text(a?.unit()?t(a.unit()):""),e.activeController&&a){const n=(e,n,r,i)=>{o.text(t(i||"",e,r))};e.activeController.register(n,a.metrics(),a.unit())}},{format(e){return arguments.length?(t=e,r):t},size(e){return arguments.length?(n=e,r):n}})).class("g3-indicate-unit");return r},e.knownUnits=Os,e.localHub=Fs,e.midnightSecondsSeries=ul,e.panel=Hs,e.pointers=Is,e.put=ms,e.snapScale=ds,e.statusLight=el,Object.defineProperty(e,"__esModule",{value:!0}),e}({});