UNPKG

@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

145 lines • 130 kB
var g3=function(t){"use strict";!function(){const t={};try{if(process)return process.env=Object.assign({},process.env),void Object.assign(process.env,t)}catch(t){}globalThis.process={env:t}}();var e=function(){function t(t){var e=this;this._insertTag=function(t){var n;n=0===e.tags.length?e.insertionPoint?e.insertionPoint.nextSibling:e.prepend?e.container.firstChild:e.before:e.tags[e.tags.length-1].nextSibling,e.container.insertBefore(t,n),e.tags.push(t)},this.isSpeedy=void 0===t.speedy||t.speedy,this.tags=[],this.ctr=0,this.nonce=t.nonce,this.key=t.key,this.container=t.container,this.prepend=t.prepend,this.insertionPoint=t.insertionPoint,this.before=null}var e=t.prototype;return e.hydrate=function(t){t.forEach(this._insertTag)},e.insert=function(t){this.ctr%(this.isSpeedy?65e3:1)==0&&this._insertTag(function(t){var e=document.createElement("style");return e.setAttribute("data-emotion",t.key),void 0!==t.nonce&&e.setAttribute("nonce",t.nonce),e.appendChild(document.createTextNode("")),e.setAttribute("data-s",""),e}(this));var e=this.tags[this.tags.length-1];if(this.isSpeedy){var n=function(t){if(t.sheet)return t.sheet;for(var e=0;e<document.styleSheets.length;e++)if(document.styleSheets[e].ownerNode===t)return document.styleSheets[e]}(e);try{n.insertRule(t,n.cssRules.length)}catch(t){}}else e.appendChild(document.createTextNode(t));this.ctr++},e.flush=function(){this.tags.forEach(function(t){var e;return null==(e=t.parentNode)?void 0:e.removeChild(t)}),this.tags=[],this.ctr=0},t}(),n="-ms-",r="-moz-",a="-webkit-",i="comm",o="rule",s="decl",l="@keyframes",u=Math.abs,c=String.fromCharCode,h=Object.assign;function f(t){return t.trim()}function p(t,e,n){return t.replace(e,n)}function m(t,e){return t.indexOf(e)}function g(t,e){return 0|t.charCodeAt(e)}function d(t,e,n){return t.slice(e,n)}function y(t){return t.length}function v(t){return t.length}function _(t,e){return e.push(t),t}var b=1,w=1,x=0,k=0,M=0,C="";function A(t,e,n,r,a,i,o){return{value:t,root:e,parent:n,type:r,props:a,children:i,line:b,column:w,length:o,return:""}}function $(t,e){return h(A("",null,null,"",null,null,0),t,{length:-t.length},e)}function S(){return M=k>0?g(C,--k):0,w--,10===M&&(w=1,b--),M}function N(){return M=k<x?g(C,k++):0,w++,10===M&&(w=1,b++),M}function j(){return g(C,k)}function E(){return k}function O(t,e){return d(C,t,e)}function z(t){switch(t){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 G(t){return b=w=1,x=y(C=t),k=0,[]}function T(t){return C="",t}function P(t){return f(O(k-1,L(91===t?t+2:40===t?t+1:t)))}function D(t){for(;(M=j())&&M<33;)N();return z(t)>2||z(M)>3?"":" "}function R(t,e){for(;--e&&N()&&!(M<48||M>102||M>57&&M<65||M>70&&M<97););return O(t,E()+(e<6&&32==j()&&32==N()))}function L(t){for(;N();)switch(M){case t:return k;case 34:case 39:34!==t&&39!==t&&L(M);break;case 40:41===t&&L(t);break;case 92:N()}return k}function K(t,e){for(;N()&&t+M!==57&&(t+M!==84||47!==j()););return"/*"+O(e,k-1)+"*"+c(47===t?t:N())}function q(t){for(;!z(j());)N();return O(t,k)}function I(t){return T(B("",null,null,null,[""],t=G(t),0,[0],t))}function B(t,e,n,r,a,i,o,s,l){for(var u=0,h=0,f=o,d=0,v=0,b=0,w=1,x=1,k=1,M=0,C="",A=a,$=i,O=r,z=C;x;)switch(b=M,M=N()){case 40:if(108!=b&&58==g(z,f-1)){-1!=m(z+=p(P(M),"&","&\f"),"&\f")&&(k=-1);break}case 34:case 39:case 91:z+=P(M);break;case 9:case 10:case 13:case 32:z+=D(b);break;case 92:z+=R(E()-1,7);continue;case 47:switch(j()){case 42:case 47:_(F(K(N(),E()),e,n),l);break;default:z+="/"}break;case 123*w:s[u++]=y(z)*k;case 125*w:case 59:case 0:switch(M){case 0:case 125:x=0;case 59+h:-1==k&&(z=p(z,/\f/g,"")),v>0&&y(z)-f&&_(v>32?V(z+";",r,n,f-1):V(p(z," ","")+";",r,n,f-2),l);break;case 59:z+=";";default:if(_(O=H(z,e,n,u,h,a,s,C,A=[],$=[],f),i),123===M)if(0===h)B(z,e,O,O,A,i,f,s,$);else switch(99===d&&110===g(z,3)?100:d){case 100:case 108:case 109:case 115:B(t,O,O,r&&_(H(t,O,O,0,0,a,s,C,a,A=[],f),$),a,$,f,s,r?A:$);break;default:B(z,O,O,O,[""],$,0,s,$)}}u=h=v=0,w=k=1,C=z="",f=o;break;case 58:f=1+y(z),v=b;default:if(w<1)if(123==M)--w;else if(125==M&&0==w++&&125==S())continue;switch(z+=c(M),M*w){case 38:k=h>0?1:(z+="\f",-1);break;case 44:s[u++]=(y(z)-1)*k,k=1;break;case 64:45===j()&&(z+=P(N())),d=j(),h=f=y(C=z+=q(E())),M++;break;case 45:45===b&&2==y(z)&&(w=0)}}return i}function H(t,e,n,r,a,i,s,l,c,h,m){for(var g=a-1,y=0===a?i:[""],_=v(y),b=0,w=0,x=0;b<r;++b)for(var k=0,M=d(t,g+1,g=u(w=s[b])),C=t;k<_;++k)(C=f(w>0?y[k]+" "+M:p(M,/&\f/g,y[k])))&&(c[x++]=C);return A(t,e,n,0===a?o:l,c,h,m)}function F(t,e,n){return A(t,e,n,i,c(M),d(t,2,-2),0)}function V(t,e,n,r){return A(t,e,n,s,d(t,0,r),d(t,r+1,-1),r)}function U(t,e){for(var n="",r=v(t),a=0;a<r;a++)n+=e(t[a],a,t,e)||"";return n}function W(t,e,n,r){switch(t.type){case"@layer":if(t.children.length)break;case"@import":case s:return t.return=t.return||t.value;case i:return"";case l:return t.return=t.value+"{"+U(t.children,r)+"}";case o:t.value=t.props.join(",")}return y(n=U(t.children,r))?t.return=t.value+"{"+n+"}":""}function X(t){var e=v(t);return function(n,r,a,i){for(var o="",s=0;s<e;s++)o+=t[s](n,r,a,i)||"";return o}}function Y(t){var e=Object.create(null);return function(n){return void 0===e[n]&&(e[n]=t(n)),e[n]}}var J="undefined"!=typeof document,Q=function(t,e,n){for(var r=0,a=0;r=a,a=j(),38===r&&12===a&&(e[n]=1),!z(a);)N();return O(t,k)},Z=function(t,e){return T(function(t,e){var n=-1,r=44;do{switch(z(r)){case 0:38===r&&12===j()&&(e[n]=1),t[n]+=Q(k-1,e,n);break;case 2:t[n]+=P(r);break;case 4:if(44===r){t[++n]=58===j()?"&\f":"",e[n]=t[n].length;break}default:t[n]+=c(r)}}while(r=N());return t}(G(t),e))},tt=new WeakMap,et=function(t){if("rule"===t.type&&t.parent&&!(t.length<1)){for(var e=t.value,n=t.parent,r=t.column===n.column&&t.line===n.line;"rule"!==n.type;)if(!(n=n.parent))return;if((1!==t.props.length||58===e.charCodeAt(0)||tt.get(n))&&!r){tt.set(t,!0);for(var a=[],i=Z(e,a),o=n.props,s=0,l=0;s<i.length;s++)for(var u=0;u<o.length;u++,l++)t.props[l]=a[s]?i[s].replace(/&\f/g,o[u]):o[u]+" "+i[s]}}},nt=function(t){if("decl"===t.type){var e=t.value;108===e.charCodeAt(0)&&98===e.charCodeAt(2)&&(t.return="",t.value="")}};function rt(t,e){switch(function(t,e){return 45^g(t,0)?(((e<<2^g(t,0))<<2^g(t,1))<<2^g(t,2))<<2^g(t,3):0}(t,e)){case 5103:return a+"print-"+t+t;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 a+t+t;case 5349:case 4246:case 4810:case 6968:case 2756:return a+t+r+t+n+t+t;case 6828:case 4268:return a+t+n+t+t;case 6165:return a+t+n+"flex-"+t+t;case 5187:return a+t+p(t,/(\w+).+(:[^]+)/,a+"box-$1$2"+n+"flex-$1$2")+t;case 5443:return a+t+n+"flex-item-"+p(t,/flex-|-self/,"")+t;case 4675:return a+t+n+"flex-line-pack"+p(t,/align-content|flex-|-self/,"")+t;case 5548:return a+t+n+p(t,"shrink","negative")+t;case 5292:return a+t+n+p(t,"basis","preferred-size")+t;case 6060:return a+"box-"+p(t,"-grow","")+a+t+n+p(t,"grow","positive")+t;case 4554:return a+p(t,/([^-])(transform)/g,"$1"+a+"$2")+t;case 6187:return p(p(p(t,/(zoom-|grab)/,a+"$1"),/(image-set)/,a+"$1"),t,"")+t;case 5495:case 3959:return p(t,/(image-set\([^]*)/,a+"$1$`$1");case 4968:return p(p(t,/(.+:)(flex-)?(.*)/,a+"box-pack:$3"+n+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+a+t+t;case 4095:case 3583:case 4068:case 2532:return p(t,/(.+)-inline(.+)/,a+"$1$2")+t;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(t)-1-e>6)switch(g(t,e+1)){case 109:if(45!==g(t,e+4))break;case 102:return p(t,/(.+:)(.+)-([^]+)/,"$1"+a+"$2-$3$1"+r+(108==g(t,e+3)?"$3":"$2-$3"))+t;case 115:return~m(t,"stretch")?rt(p(t,"stretch","fill-available"),e)+t:t}break;case 4949:if(115!==g(t,e+1))break;case 6444:switch(g(t,y(t)-3-(~m(t,"!important")&&10))){case 107:return p(t,":",":"+a)+t;case 101:return p(t,/(.+:)([^;!]+)(;|!.+)?/,"$1"+a+(45===g(t,14)?"inline-":"")+"box$3$1"+a+"$2$3$1"+n+"$2box$3")+t}break;case 5936:switch(g(t,e+11)){case 114:return a+t+n+p(t,/[svh]\w+-[tblr]{2}/,"tb")+t;case 108:return a+t+n+p(t,/[svh]\w+-[tblr]{2}/,"tb-rl")+t;case 45:return a+t+n+p(t,/[svh]\w+-[tblr]{2}/,"lr")+t}return a+t+n+t+t}return t}var at,it,ot=J?void 0:(at=function(){return Y(function(){return{}})},it=new WeakMap,function(t){if(it.has(t))return it.get(t);var e=at(t);return it.set(t,e),e}),st=[function(t,e,r,i){if(t.length>-1&&!t.return)switch(t.type){case s:t.return=rt(t.value,t.length);break;case l:return U([$(t,{value:p(t.value,"@","@"+a)})],i);case o:if(t.length)return function(t,e){return t.map(e).join("")}(t.props,function(e){switch(function(t,e){return(t=e.exec(t))?t[0]:t}(e,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return U([$(t,{props:[p(e,/:(read-\w+)/,":-moz-$1")]})],i);case"::placeholder":return U([$(t,{props:[p(e,/:(plac\w+)/,":"+a+"input-$1")]}),$(t,{props:[p(e,/:(plac\w+)/,":-moz-$1")]}),$(t,{props:[p(e,/:(plac\w+)/,n+"input-$1")]})],i)}return""})}}],lt=function(t){var n=t.key;if(J&&"css"===n){var r=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(r,function(t){-1!==t.getAttribute("data-emotion").indexOf(" ")&&(document.head.appendChild(t),t.setAttribute("data-s",""))})}var a,i,o=t.stylisPlugins||st,s={},l=[];J&&(a=t.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+n+' "]'),function(t){for(var e=t.getAttribute("data-emotion").split(" "),n=1;n<e.length;n++)s[e[n]]=!0;l.push(t)}));var u,c=[et,nt];if(ot){var h=[W],f=X(c.concat(o,h)),p=ot(o)(n),m=function(t,e){var n=e.name;return void 0===p[n]&&(p[n]=U(I(t?t+"{"+e.styles+"}":e.styles),f)),p[n]};i=function(t,e,n,r){var a=e.name,i=m(t,e);return void 0===v.compat?(r&&(v.inserted[a]=!0),i):r?void(v.inserted[a]=i):i}}else{var g,d=[W,(u=function(t){g.insert(t)},function(t){t.root||(t=t.return)&&u(t)})],y=X(c.concat(o,d));i=function(t,e,n,r){g=n,U(I(t?t+"{"+e.styles+"}":e.styles),y),r&&(v.inserted[e.name]=!0)}}var v={key:n,sheet:new e({key:n,container:a,nonce:t.nonce,speedy:t.speedy,prepend:t.prepend,insertionPoint:t.insertionPoint}),nonce:t.nonce,inserted:s,registered:{},insert:i};return v.sheet.hydrate(l),v};var ut={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},ct=/[A-Z]|^ms/g,ht=/_EMO_([^_]+?)_([^]*?)_EMO_/g,ft=function(t){return 45===t.charCodeAt(1)},pt=function(t){return null!=t&&"boolean"!=typeof t},mt=Y(function(t){return ft(t)?t:t.replace(ct,"-$&").toLowerCase()}),gt=function(t,e){switch(t){case"animation":case"animationName":if("string"==typeof e)return e.replace(ht,function(t,e,n){return yt={name:e,styles:n,next:yt},e})}return 1===ut[t]||ft(t)||"number"!=typeof e||0===e?e:e+"px"};function dt(t,e,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 a=n;if(1===a.anim)return yt={name:a.name,styles:a.styles,next:yt},a.name;var i=n;if(void 0!==i.styles){var o=i.next;if(void 0!==o)for(;void 0!==o;)yt={name:o.name,styles:o.styles,next:yt},o=o.next;return i.styles+";"}return function(t,e,n){var r="";if(Array.isArray(n))for(var a=0;a<n.length;a++)r+=dt(t,e,n[a])+";";else for(var i in n){var o=n[i];if("object"!=typeof o){var s=o;null!=e&&void 0!==e[s]?r+=i+"{"+e[s]+"}":pt(s)&&(r+=mt(i)+":"+gt(i,s)+";")}else if(!Array.isArray(o)||"string"!=typeof o[0]||null!=e&&void 0!==e[o[0]]){var l=dt(t,e,o);switch(i){case"animation":case"animationName":r+=mt(i)+":"+l+";";break;default:r+=i+"{"+l+"}"}}else for(var u=0;u<o.length;u++)pt(o[u])&&(r+=mt(i)+":"+gt(i,o[u])+";")}return r}(t,e,n);case"function":if(void 0!==t){var s=yt,l=n(t);return yt=s,dt(t,e,l)}}var u=n;if(null==e)return u;var c=e[u];return void 0!==c?c:u}var yt,vt=/label:\s*([^\s;{]+)\s*(;|$)/g;function _t(t,e,n){if(1===t.length&&"object"==typeof t[0]&&null!==t[0]&&void 0!==t[0].styles)return t[0];var r=!0,a="";yt=void 0;var i=t[0];null==i||void 0===i.raw?(r=!1,a+=dt(n,e,i)):a+=i[0];for(var o=1;o<t.length;o++){if(a+=dt(n,e,t[o]),r)a+=i[o]}vt.lastIndex=0;for(var s,l="";null!==(s=vt.exec(a));)l+="-"+s[1];var u=function(t){for(var e,n=0,r=0,a=t.length;a>=4;++r,a-=4)e=1540483477*(65535&(e=255&t.charCodeAt(r)|(255&t.charCodeAt(++r))<<8|(255&t.charCodeAt(++r))<<16|(255&t.charCodeAt(++r))<<24))+(59797*(e>>>16)<<16),n=1540483477*(65535&(e^=e>>>24))+(59797*(e>>>16)<<16)^1540483477*(65535&n)+(59797*(n>>>16)<<16);switch(a){case 3:n^=(255&t.charCodeAt(r+2))<<16;case 2:n^=(255&t.charCodeAt(r+1))<<8;case 1:n=1540483477*(65535&(n^=255&t.charCodeAt(r)))+(59797*(n>>>16)<<16)}return(((n=1540483477*(65535&(n^=n>>>13))+(59797*(n>>>16)<<16))^n>>>15)>>>0).toString(36)}(a)+l;return{name:u,styles:a,next:yt}}var bt="undefined"!=typeof document;function wt(t,e,n){var r="";return n.split(" ").forEach(function(n){void 0!==t[n]?e.push(t[n]+";"):n&&(r+=n+" ")}),r}var xt=function(t,e,n){!function(t,e,n){var r=t.key+"-"+e.name;(!1===n||!1===bt&&void 0!==t.compat)&&void 0===t.registered[r]&&(t.registered[r]=e.styles)}(t,e,n);var r=t.key+"-"+e.name;if(void 0===t.inserted[e.name]){var a="",i=e;do{var o=t.insert(e===i?"."+r:"",i,t.sheet,!0);bt||void 0===o||(a+=o),i=i.next}while(void 0!==i);if(!bt&&0!==a.length)return a}};function kt(t,e){if(void 0===t.inserted[e.name])return t.insert("",e,t.sheet,!0)}function Mt(t,e,n){var r=[],a=wt(t,r,n);return r.length<2?n:a+e(r)}var Ct=function t(e){for(var n="",r=0;r<e.length;r++){var a=e[r];if(null!=a){var i=void 0;switch(typeof a){case"boolean":break;case"object":if(Array.isArray(a))i=t(a);else for(var o in i="",a)a[o]&&o&&(i&&(i+=" "),i+=o);break;default:i=a}i&&(n&&(n+=" "),n+=i)}}return n},At=function(t){var e=lt(t);e.sheet.speedy=function(t){this.isSpeedy=t},e.compat=!0;var n=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var a=_t(n,e.registered,void 0);return xt(e,a,!1),e.key+"-"+a.name};return{css:n,cx:function(){for(var t=arguments.length,r=new Array(t),a=0;a<t;a++)r[a]=arguments[a];return Mt(e.registered,n,Ct(r))},injectGlobal:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var a=_t(n,e.registered);kt(e,a)},keyframes:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var a=_t(n,e.registered),i="animation-"+a.name;return kt(e,{name:a.name,styles:"@keyframes "+i+"{"+a.styles+"}"}),i},hydrate:function(t){t.forEach(function(t){e.inserted[t]=!0})},flush:function(){e.registered={},e.inserted={},e.sheet.flush()},sheet:e.sheet,cache:e,getRegisteredStyles:wt.bind(null,e.registered),merge:Mt.bind(null,e.registered,n)}}({key:"css"}),$t=At.injectGlobal,St=At.css;function Nt(t,e){return null==t||null==e?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function jt(t,e){return null==t||null==e?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function Et(t){let e,n,r;function a(t,r,a=0,i=t.length){if(a<i){if(0!==e(r,r))return i;do{const e=a+i>>>1;n(t[e],r)<0?a=e+1:i=e}while(a<i)}return a}return 2!==t.length?(e=Nt,n=(e,n)=>Nt(t(e),n),r=(e,n)=>t(e)-n):(e=t===Nt||t===jt?t:Ot,n=t,r=t),{left:a,center:function(t,e,n=0,i=t.length){const o=a(t,e,n,i-1);return o>n&&r(t[o-1],e)>-r(t[o],e)?o-1:o},right:function(t,r,a=0,i=t.length){if(a<i){if(0!==e(r,r))return i;do{const e=a+i>>>1;n(t[e],r)<=0?a=e+1:i=e}while(a<i)}return a}}}function Ot(){return 0}const zt=Et(Nt).right;Et(function(t){return null===t?NaN:+t}).center;var Gt=zt;const Tt=Math.sqrt(50),Pt=Math.sqrt(10),Dt=Math.sqrt(2);function Rt(t,e,n){const r=(e-t)/Math.max(0,n),a=Math.floor(Math.log10(r)),i=r/Math.pow(10,a),o=i>=Tt?10:i>=Pt?5:i>=Dt?2:1;let s,l,u;return a<0?(u=Math.pow(10,-a)/o,s=Math.round(t*u),l=Math.round(e*u),s/u<t&&++s,l/u>e&&--l,u=-u):(u=Math.pow(10,a)*o,s=Math.round(t/u),l=Math.round(e/u),s*u<t&&++s,l*u>e&&--l),l<s&&.5<=n&&n<2?Rt(t,e,2*n):[s,l,u]}function Lt(t,e,n){return Rt(t=+t,e=+e,n=+n)[2]}function Kt(t,e,n){t=+t,e=+e,n=(a=arguments.length)<2?(e=t,t=0,1):a<3?1:+n;for(var r=-1,a=0|Math.max(0,Math.ceil((e-t)/n)),i=new Array(a);++r<a;)i[r]=t+r*n;return i}var qt={value:()=>{}};function It(){for(var t,e=0,n=arguments.length,r={};e<n;++e){if(!(t=arguments[e]+"")||t in r||/[\s.]/.test(t))throw new Error("illegal type: "+t);r[t]=[]}return new Bt(r)}function Bt(t){this._=t}function Ht(t,e){for(var n,r=0,a=t.length;r<a;++r)if((n=t[r]).name===e)return n.value}function Ft(t,e,n){for(var r=0,a=t.length;r<a;++r)if(t[r].name===e){t[r]=qt,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=n&&t.push({name:e,value:n}),t}Bt.prototype=It.prototype={constructor:Bt,on:function(t,e){var n,r,a=this._,i=(r=a,(t+"").trim().split(/^|\s+/).map(function(t){var e="",n=t.indexOf(".");if(n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}})),o=-1,s=i.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++o<s;)if(n=(t=i[o]).type)a[n]=Ft(a[n],t.name,e);else if(null==e)for(n in a)a[n]=Ft(a[n],t.name,null);return this}for(;++o<s;)if((n=(t=i[o]).type)&&(n=Ht(a[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new Bt(t)},call:function(t,e){if((n=arguments.length-2)>0)for(var n,r,a=new Array(n),i=0;i<n;++i)a[i]=arguments[i+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(i=0,n=(r=this._[t]).length;i<n;++i)r[i].value.apply(e,a)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],a=0,i=r.length;a<i;++a)r[a].value.apply(e,n)}};var Vt="http://www.w3.org/1999/xhtml",Ut={svg:"http://www.w3.org/2000/svg",xhtml:Vt,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Wt(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),Ut.hasOwnProperty(e)?{space:Ut[e],local:t}:t}function Xt(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===Vt&&e.documentElement.namespaceURI===Vt?e.createElement(t):e.createElementNS(n,t)}}function Yt(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function Jt(t){var e=Wt(t);return(e.local?Yt:Xt)(e)}function Qt(){}function Zt(t){return null==t?Qt:function(){return this.querySelector(t)}}function te(){return[]}function ee(t){return null==t?te:function(){return this.querySelectorAll(t)}}function ne(t){return function(){return function(t){return null==t?[]:Array.isArray(t)?t:Array.from(t)}(t.apply(this,arguments))}}function re(t){return function(){return this.matches(t)}}function ae(t){return function(e){return e.matches(t)}}var ie=Array.prototype.find;function oe(){return this.firstElementChild}var se=Array.prototype.filter;function le(){return Array.from(this.children)}function ue(t){return new Array(t.length)}function ce(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function he(t,e,n,r,a,i){for(var o,s=0,l=e.length,u=i.length;s<u;++s)(o=e[s])?(o.__data__=i[s],r[s]=o):n[s]=new ce(t,i[s]);for(;s<l;++s)(o=e[s])&&(a[s]=o)}function fe(t,e,n,r,a,i,o){var s,l,u,c=new Map,h=e.length,f=i.length,p=new Array(h);for(s=0;s<h;++s)(l=e[s])&&(p[s]=u=o.call(l,l.__data__,s,e)+"",c.has(u)?a[s]=l:c.set(u,l));for(s=0;s<f;++s)u=o.call(t,i[s],s,i)+"",(l=c.get(u))?(r[s]=l,l.__data__=i[s],c.delete(u)):n[s]=new ce(t,i[s]);for(s=0;s<h;++s)(l=e[s])&&c.get(p[s])===l&&(a[s]=l)}function pe(t){return t.__data__}function me(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function ge(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function de(t){return function(){this.removeAttribute(t)}}function ye(t){return function(){this.removeAttributeNS(t.space,t.local)}}function ve(t,e){return function(){this.setAttribute(t,e)}}function _e(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function be(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function we(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function xe(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function ke(t){return function(){this.style.removeProperty(t)}}function Me(t,e,n){return function(){this.style.setProperty(t,e,n)}}function Ce(t,e,n){return function(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function Ae(t,e){return t.style.getPropertyValue(e)||xe(t).getComputedStyle(t,null).getPropertyValue(e)}function $e(t){return function(){delete this[t]}}function Se(t,e){return function(){this[t]=e}}function Ne(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function je(t){return t.trim().split(/^|\s+/)}function Ee(t){return t.classList||new Oe(t)}function Oe(t){this._node=t,this._names=je(t.getAttribute("class")||"")}function ze(t,e){for(var n=Ee(t),r=-1,a=e.length;++r<a;)n.add(e[r])}function Ge(t,e){for(var n=Ee(t),r=-1,a=e.length;++r<a;)n.remove(e[r])}function Te(t){return function(){ze(this,t)}}function Pe(t){return function(){Ge(this,t)}}function De(t,e){return function(){(e.apply(this,arguments)?ze:Ge)(this,t)}}function Re(){this.textContent=""}function Le(t){return function(){this.textContent=t}}function Ke(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}function qe(){this.innerHTML=""}function Ie(t){return function(){this.innerHTML=t}}function Be(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}function He(){this.nextSibling&&this.parentNode.appendChild(this)}function Fe(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Ve(){return null}function Ue(){var t=this.parentNode;t&&t.removeChild(this)}function We(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Xe(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Ye(t){return function(){var e=this.__on;if(e){for(var n,r=0,a=-1,i=e.length;r<i;++r)n=e[r],t.type&&n.type!==t.type||n.name!==t.name?e[++a]=n:this.removeEventListener(n.type,n.listener,n.options);++a?e.length=a:delete this.__on}}}function Je(t,e,n){return function(){var r,a=this.__on,i=function(t){return function(e){t.call(this,e,this.__data__)}}(e);if(a)for(var o=0,s=a.length;o<s;++o)if((r=a[o]).type===t.type&&r.name===t.name)return this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=i,r.options=n),void(r.value=e);this.addEventListener(t.type,i,n),r={type:t.type,name:t.name,value:e,listener:i,options:n},a?a.push(r):this.__on=[r]}}function Qe(t,e,n){var r=xe(t),a=r.CustomEvent;"function"==typeof a?a=new a(e,n):(a=r.document.createEvent("Event"),n?(a.initEvent(e,n.bubbles,n.cancelable),a.detail=n.detail):a.initEvent(e,!1,!1)),t.dispatchEvent(a)}function Ze(t,e){return function(){return Qe(this,t,e)}}function tn(t,e){return function(){return Qe(this,t,e.apply(this,arguments))}}ce.prototype={constructor:ce,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}},Oe.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var en=[null];function nn(t,e){this._groups=t,this._parents=e}function rn(){return new nn([[document.documentElement]],en)}function an(t){return"string"==typeof t?new nn([[document.querySelector(t)]],[document.documentElement]):new nn([[t]],en)}function on(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function sn(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function ln(){}nn.prototype=rn.prototype={constructor:nn,select:function(t){"function"!=typeof t&&(t=Zt(t));for(var e=this._groups,n=e.length,r=new Array(n),a=0;a<n;++a)for(var i,o,s=e[a],l=s.length,u=r[a]=new Array(l),c=0;c<l;++c)(i=s[c])&&(o=t.call(i,i.__data__,c,s))&&("__data__"in i&&(o.__data__=i.__data__),u[c]=o);return new nn(r,this._parents)},selectAll:function(t){t="function"==typeof t?ne(t):ee(t);for(var e=this._groups,n=e.length,r=[],a=[],i=0;i<n;++i)for(var o,s=e[i],l=s.length,u=0;u<l;++u)(o=s[u])&&(r.push(t.call(o,o.__data__,u,s)),a.push(o));return new nn(r,a)},selectChild:function(t){return this.select(null==t?oe:function(t){return function(){return ie.call(this.children,t)}}("function"==typeof t?t:ae(t)))},selectChildren:function(t){return this.selectAll(null==t?le:function(t){return function(){return se.call(this.children,t)}}("function"==typeof t?t:ae(t)))},filter:function(t){"function"!=typeof t&&(t=re(t));for(var e=this._groups,n=e.length,r=new Array(n),a=0;a<n;++a)for(var i,o=e[a],s=o.length,l=r[a]=[],u=0;u<s;++u)(i=o[u])&&t.call(i,i.__data__,u,o)&&l.push(i);return new nn(r,this._parents)},data:function(t,e){if(!arguments.length)return Array.from(this,pe);var n=e?fe:he,r=this._parents,a=this._groups;"function"!=typeof t&&(t=function(t){return function(){return t}}(t));for(var i=a.length,o=new Array(i),s=new Array(i),l=new Array(i),u=0;u<i;++u){var c=r[u],h=a[u],f=h.length,p=me(t.call(c,c&&c.__data__,u,r)),m=p.length,g=s[u]=new Array(m),d=o[u]=new Array(m);n(c,h,g,d,l[u]=new Array(f),p,e);for(var y,v,_=0,b=0;_<m;++_)if(y=g[_]){for(_>=b&&(b=_+1);!(v=d[b])&&++b<m;);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(ue),this._parents)},exit:function(){return new nn(this._exit||this._groups.map(ue),this._parents)},join:function(t,e,n){var r=this.enter(),a=this,i=this.exit();return"function"==typeof t?(r=t(r))&&(r=r.selection()):r=r.append(t+""),null!=e&&(a=e(a))&&(a=a.selection()),null==n?i.remove():n(i),r&&a?r.merge(a).order():a},merge:function(t){for(var e=t.selection?t.selection():t,n=this._groups,r=e._groups,a=n.length,i=r.length,o=Math.min(a,i),s=new Array(a),l=0;l<o;++l)for(var u,c=n[l],h=r[l],f=c.length,p=s[l]=new Array(f),m=0;m<f;++m)(u=c[m]||h[m])&&(p[m]=u);for(;l<a;++l)s[l]=n[l];return new nn(s,this._parents)},selection:function(){return this},order:function(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r,a=t[e],i=a.length-1,o=a[i];--i>=0;)(r=a[i])&&(o&&4^r.compareDocumentPosition(o)&&o.parentNode.insertBefore(r,o),o=r);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=ge);for(var n=this._groups,r=n.length,a=new Array(r),i=0;i<r;++i){for(var o,s=n[i],l=s.length,u=a[i]=new Array(l),c=0;c<l;++c)(o=s[c])&&(u[c]=o);u.sort(e)}return new nn(a,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],a=0,i=r.length;a<i;++a){var o=r[a];if(o)return o}return null},size:function(){let t=0;for(const e of this)++t;return t},empty:function(){return!this.node()},each:function(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var a,i=e[n],o=0,s=i.length;o<s;++o)(a=i[o])&&t.call(a,a.__data__,o,i);return this},attr:function(t,e){var n=Wt(t);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((null==e?n.local?ye:de:"function"==typeof e?n.local?we:be:n.local?_e:ve)(n,e))},style:function(t,e,n){return arguments.length>1?this.each((null==e?ke:"function"==typeof e?Ce:Me)(t,e,null==n?"":n)):Ae(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?$e:"function"==typeof e?Ne:Se)(t,e)):this.node()[t]},classed:function(t,e){var n=je(t+"");if(arguments.length<2){for(var r=Ee(this.node()),a=-1,i=n.length;++a<i;)if(!r.contains(n[a]))return!1;return!0}return this.each(("function"==typeof e?De:e?Te:Pe)(n,e))},text:function(t){return arguments.length?this.each(null==t?Re:("function"==typeof t?Ke:Le)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?qe:("function"==typeof t?Be:Ie)(t)):this.node().innerHTML},raise:function(){return this.each(He)},lower:function(){return this.each(Fe)},append:function(t){var e="function"==typeof t?t:Jt(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})},insert:function(t,e){var n="function"==typeof t?t:Jt(t),r=null==e?Ve:"function"==typeof e?e:Zt(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})},remove:function(){return this.each(Ue)},clone:function(t){return this.select(t?Xe:We)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,e,n){var r,a,i=function(t){return t.trim().split(/^|\s+/).map(function(t){var e="",n=t.indexOf(".");return n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}})}(t+""),o=i.length;if(!(arguments.length<2)){for(s=e?Je:Ye,r=0;r<o;++r)this.each(s(i[r],e,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((a=i[r]).type===l.type&&a.name===l.name)return l.value},dispatch:function(t,e){return this.each(("function"==typeof e?tn:Ze)(t,e))},[Symbol.iterator]:function*(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r,a=t[e],i=0,o=a.length;i<o;++i)(r=a[i])&&(yield r)}};var un=.7,cn=1/un,hn="\\s*([+-]?\\d+)\\s*",fn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",pn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",mn=/^#([0-9a-f]{3,8})$/,gn=new RegExp(`^rgb\\(${hn},${hn},${hn}\\)$`),dn=new RegExp(`^rgb\\(${pn},${pn},${pn}\\)$`),yn=new RegExp(`^rgba\\(${hn},${hn},${hn},${fn}\\)$`),vn=new RegExp(`^rgba\\(${pn},${pn},${pn},${fn}\\)$`),_n=new RegExp(`^hsl\\(${fn},${pn},${pn}\\)$`),bn=new RegExp(`^hsla\\(${fn},${pn},${pn},${fn}\\)$`),wn={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 xn(){return this.rgb().formatHex()}function kn(){return this.rgb().formatRgb()}function Mn(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=mn.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?Cn(e):3===n?new Sn(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?An(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?An(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=gn.exec(t))?new Sn(e[1],e[2],e[3],1):(e=dn.exec(t))?new Sn(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=yn.exec(t))?An(e[1],e[2],e[3],e[4]):(e=vn.exec(t))?An(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=_n.exec(t))?Gn(e[1],e[2]/100,e[3]/100,1):(e=bn.exec(t))?Gn(e[1],e[2]/100,e[3]/100,e[4]):wn.hasOwnProperty(t)?Cn(wn[t]):"transparent"===t?new Sn(NaN,NaN,NaN,0):null}function Cn(t){return new Sn(t>>16&255,t>>8&255,255&t,1)}function An(t,e,n,r){return r<=0&&(t=e=n=NaN),new Sn(t,e,n,r)}function $n(t,e,n,r){return 1===arguments.length?((a=t)instanceof ln||(a=Mn(a)),a?new Sn((a=a.rgb()).r,a.g,a.b,a.opacity):new Sn):new Sn(t,e,n,null==r?1:r);var a}function Sn(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function Nn(){return`#${zn(this.r)}${zn(this.g)}${zn(this.b)}`}function jn(){const t=En(this.opacity);return`${1===t?"rgb(":"rgba("}${On(this.r)}, ${On(this.g)}, ${On(this.b)}${1===t?")":`, ${t})`}`}function En(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function On(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function zn(t){return((t=On(t))<16?"0":"")+t.toString(16)}function Gn(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Pn(t,e,n,r)}function Tn(t){if(t instanceof Pn)return new Pn(t.h,t.s,t.l,t.opacity);if(t instanceof ln||(t=Mn(t)),!t)return new Pn;if(t instanceof Pn)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,a=Math.min(e,n,r),i=Math.max(e,n,r),o=NaN,s=i-a,l=(i+a)/2;return s?(o=e===i?(n-r)/s+6*(n<r):n===i?(r-e)/s+2:(e-n)/s+4,s/=l<.5?i+a:2-i-a,o*=60):s=l>0&&l<1?0:o,new Pn(o,s,l,t.opacity)}function Pn(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function Dn(t){return(t=(t||0)%360)<0?t+360:t}function Rn(t){return Math.max(0,Math.min(1,t||0))}function Ln(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}on(ln,Mn,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:xn,formatHex:xn,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Tn(this).formatHsl()},formatRgb:kn,toString:kn}),on(Sn,$n,sn(ln,{brighter(t){return t=null==t?cn:Math.pow(cn,t),new Sn(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?un:Math.pow(un,t),new Sn(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Sn(On(this.r),On(this.g),On(this.b),En(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`#${zn(this.r)}${zn(this.g)}${zn(this.b)}${zn(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:jn,toString:jn})),on(Pn,function(t,e,n,r){return 1===arguments.length?Tn(t):new Pn(t,e,n,null==r?1:r)},sn(ln,{brighter(t){return t=null==t?cn:Math.pow(cn,t),new Pn(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?un:Math.pow(un,t),new Pn(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,a=2*n-r;return new Sn(Ln(t>=240?t-240:t+120,a,r),Ln(t,a,r),Ln(t<120?t+240:t-120,a,r),this.opacity)},clamp(){return new Pn(Dn(this.h),Rn(this.s),Rn(this.l),En(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=En(this.opacity);return`${1===t?"hsl(":"hsla("}${Dn(this.h)}, ${100*Rn(this.s)}%, ${100*Rn(this.l)}%${1===t?")":`, ${t})`}`}}));var Kn=t=>()=>t;function qn(t){return 1===(t=+t)?In:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}(e,n,t):Kn(isNaN(e)?n:e)}}function In(t,e){var n=e-t;return n?function(t,e){return function(n){return t+n*e}}(t,n):Kn(isNaN(t)?e:t)}var Bn=function t(e){var n=qn(e);function r(t,e){var r=n((t=$n(t)).r,(e=$n(e)).r),a=n(t.g,e.g),i=n(t.b,e.b),o=In(t.opacity,e.opacity);return function(e){return t.r=r(e),t.g=a(e),t.b=i(e),t.opacity=o(e),t+""}}return r.gamma=t,r}(1);function Hn(t,e){e||(e=[]);var n,r=t?Math.min(e.length,t.length):0,a=e.slice();return function(i){for(n=0;n<r;++n)a[n]=t[n]*(1-i)+e[n]*i;return a}}function Fn(t,e){var n,r=e?e.length:0,a=t?Math.min(r,t.length):0,i=new Array(a),o=new Array(r);for(n=0;n<a;++n)i[n]=Qn(t[n],e[n]);for(;n<r;++n)o[n]=e[n];return function(t){for(n=0;n<a;++n)o[n]=i[n](t);return o}}function Vn(t,e){var n=new Date;return t=+t,e=+e,function(r){return n.setTime(t*(1-r)+e*r),n}}function Un(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function Wn(t,e){var n,r={},a={};for(n in null!==t&&"object"==typeof t||(t={}),null!==e&&"object"==typeof e||(e={}),e)n in t?r[n]=Qn(t[n],e[n]):a[n]=e[n];return function(t){for(n in r)a[n]=r[n](t);return a}}var Xn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Yn=new RegExp(Xn.source,"g");function Jn(t,e){var n,r,a,i=Xn.lastIndex=Yn.lastIndex=0,o=-1,s=[],l=[];for(t+="",e+="";(n=Xn.exec(t))&&(r=Yn.exec(e));)(a=r.index)>i&&(a=e.slice(i,a),s[o]?s[o]+=a:s[++o]=a),(n=n[0])===(r=r[0])?s[o]?s[o]+=r:s[++o]=r:(s[++o]=null,l.push({i:o,x:Un(n,r)})),i=Yn.lastIndex;return i<e.length&&(a=e.slice(i),s[o]?s[o]+=a:s[++o]=a),s.length<2?l[0]?function(t){return function(e){return t(e)+""}}(l[0].x):function(t){return function(){return t}}(e):(e=l.length,function(t){for(var n,r=0;r<e;++r)s[(n=l[r]).i]=n.x(t);return s.join("")})}function Qn(t,e){var n,r=typeof e;return null==e||"boolean"===r?Kn(e):("number"===r?Un:"string"===r?(n=Mn(e))?(e=n,Bn):Jn:e instanceof Mn?Bn:e instanceof Date?Vn:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}(e)?Hn:Array.isArray(e)?Fn:"function"!=typeof e.valueOf&&"function"!=typeof e.toString||isNaN(e)?Wn:Un)(t,e)}function Zn(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}var tr,er=180/Math.PI,nr={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function rr(t,e,n,r,a,i){var o,s,l;return(o=Math.sqrt(t*t+e*e))&&(t/=o,e/=o),(l=t*n+e*r)&&(n-=t*l,r-=e*l),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,l/=s),t*r<e*n&&(t=-t,e=-e,l=-l,o=-o),{translateX:a,translateY:i,rotate:Math.atan2(e,t)*er,skewX:Math.atan(l)*er,scaleX:o,scaleY:s}}function ar(t,e,n,r){function a(t){return t.length?t.pop()+" ":""}return function(i,o){var s=[],l=[];return i=t(i),o=t(o),function(t,r,a,i,o,s){if(t!==a||r!==i){var l=o.push("translate(",null,e,null,n);s.push({i:l-4,x:Un(t,a)},{i:l-2,x:Un(r,i)})}else(a||i)&&o.push("translate("+a+e+i+n)}(i.translateX,i.translateY,o.translateX,o.translateY,s,l),function(t,e,n,i){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),i.push({i:n.push(a(n)+"rotate(",null,r)-2,x:Un(t,e)})):e&&n.push(a(n)+"rotate("+e+r)}(i.rotate,o.rotate,s,l),function(t,e,n,i){t!==e?i.push({i:n.push(a(n)+"skewX(",null,r)-2,x:Un(t,e)}):e&&n.push(a(n)+"skewX("+e+r)}(i.skewX,o.skewX,s,l),function(t,e,n,r,i,o){if(t!==n||e!==r){var s=i.push(a(i)+"scale(",null,",",null,")");o.push({i:s-4,x:Un(t,n)},{i:s-2,x:Un(e,r)})}else 1===n&&1===r||i.push(a(i)+"scale("+n+","+r+")")}(i.scaleX,i.scaleY,o.scaleX,o.scaleY,s,l),i=o=null,function(t){for(var e,n=-1,r=l.length;++n<r;)s[(e=l[n]).i]=e.x(t);return s.join("")}}}var ir,or,sr=ar(function(t){const e=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?nr:rr(e.a,e.b,e.c,e.d,e.e,e.f)},"px, ","px)","deg)"),lr=ar(function(t){return null==t?nr:(tr||(tr=document.createElementNS("http://www.w3.org/2000/svg","g")),tr.setAttribute("transform",t),(t=tr.transform.baseVal.consolidate())?rr((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):nr)},", ",")",")"),ur=0,cr=0,hr=0,fr=0,pr=0,mr=0,gr="object"==typeof performance&&performance.now?performance:Date,dr="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function yr(){return pr||(dr(vr),pr=gr.now()+mr)}function vr(){pr=0}function _r(){this._call=this._time=this._next=null}function br(t,e,n){var r=new _r;return r.restart(t,e,n),r}function wr(){pr=(fr=gr.now())+mr,ur=cr=0;try{!function(){yr(),++ur;for(var t,e=ir;e;)(t=pr-e._time)>=0&&e._call.call(void 0,t),e=e._next;--ur}()}finally{ur=0,function(){var t,e,n=ir,r=1/0;for(;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:ir=e);or=t,kr(r)}(),pr=0}}function xr(){var t=gr.now(),e=t-fr;e>1e3&&(mr-=e,fr=t)}function kr(t){ur||(cr&&(cr=clearTimeout(cr)),t-pr>24?(t<1/0&&(cr=setTimeout(wr,t-gr.now()-mr)),hr&&(hr=clearInterval(hr))):(hr||(fr=gr.now(),hr=setInterval(xr,1e3)),ur=1,dr(wr)))}function Mr(t,e,n){var r=new _r;return e=null==e?0:+e,r.restart(n=>{r.stop(),t(n+e)},e,n),r}_r.prototype=br.prototype={constructor:_r,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?yr():+n)+(null==e?0:+e),this._next||or===this||(or?or._next=this:ir=this,or=this),this._call=t,this._time=n,kr()},stop:function(){this._call&&(this._call=null,this._time=1/0,kr())}};var Cr=It("start","end","cancel","interrupt"),Ar=[];function $r(t,e,n,r,a,i){var o=t.__transition;if(o){if(n in o)return}else t.__transition={};!function(t,e,n){var r,a=t.__transition;function i(t){n.state=1,n.timer.restart(o,n.delay,n.time),n.delay<=t&&o(t-n.delay)}function o(i){var u,c,h,f;if(1!==n.state)return l();for(u in a)if((f=a[u]).name===n.name){if(3===f.state)return Mr(o);4===f.state?(f.state=6,f.timer.stop(),f.on.call("interrupt",t,t.__data__,f.index,f.group),delete a[u]):+u<e&&(f.state=6,f.timer.stop(),f.on.call("cancel",t,t.__data__,f.index,f.group),delete a[u])}if(Mr(function(){3===n.state&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(i))}),n.state=2,n.on.call("start",t,t.__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)(f=n.tween[u].value.call(t,t.__data__,n.index,n.group))&&(r[++c]=f);r.length=c+1}}function s(e){for(var a=e<n.duration?n.ease.call(null,e/n.duration):(n.timer.restart(l),n.state=5,1),i=-1,o=r.length;++i<o;)r[i].call(t,a);5===n.state&&(n.on.call("end",t,t.__data__,n.index,n.group),l())}function l(){for(var r in n.state=6,n.timer.stop(),delete a[e],a)return;delete t.__transition}a[e]=n,n.timer=br(i,0,n.time)}(t,n,{name:e,index:r,group:a,on:Cr,tween:Ar,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:0})}function Sr(t,e){var n=jr(t,e);if(n.state>0)throw new Error("too late; already scheduled");return n}function Nr(t,e){var n=jr(t,e);if(n.state>3)throw new Error("too late; already running");return n}function jr(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function Er(t,e){var n,r;return function(){var a=Nr(this,t),i=a.tween;if(i!==n)for(var o=0,s=(r=n=i).length;o<s;++o)if(r[o].name===e){(r=r.slice()).splice(o,1);break}a.tween=r}}function Or(t,e,n){var r,a;if("function"!=typeof n)throw new Error;return function(){var i=Nr(this,t),o=i.tween;if(o!==r){a=(r=o).slice();for(var s={name:e,value:n},l=0,u=a.length;l<u;++l)if(a[l].name===e){a[l]=s;break}l===u&&a.push(s)}i.tween=a}}function zr(t,e,n){var r=t._id;return t.each(function(){var t=Nr(this,r);(t.value||(t.value={}))[e]=n.apply(this,arguments)}),function(t){return jr(t,r).value[e]}}function Gr(t,e){var n;return("number"==typeof e?Un:e instanceof Mn?Bn:(n=Mn(e))?(e=n,Bn):Jn)(t,e)}function Tr(t){return function(){this.removeAttribute(t)}}function Pr(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Dr(t,e,n){var r,a,i=n+"";return function(){var o=this.getAttribute(t);return o===i?null:o===r?a:a=e(r=o,n)}}function Rr(t,e,n){var r,a,i=n+"";return function(){var o=this.getAttributeNS(t.space,t.local);return o===i?null:o===r?a:a=e(r=o,n)}}function Lr(t,e,n){var r,a,i;return function(){var o,s,l=n(this);if(null!=l)return(o=this.getAttribute(t))===(s=l+"")?null:o===r&&s===a?i:(a=s,i=e(r=o,l));this.removeAttribute(t)}}function Kr(t,e,n){var r,a,i;return function(){var o,s,l=n(this);if(null!=l)return(o=this.getAttributeNS(t.space,t.local))===(s=l+"")?null:o===r&&s===a?i:(a=s,i=e(r=o,l));this.removeAttributeNS(t.space,t.local)}}function qr(t,e){var n,r;function a(){var a=e.apply(this,arguments);return a!==r&&(n=(r=a)&&function(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}(t,a)),n}return a._value=e,a}function Ir(t,e){var n,r;function a(){var a=e.apply(this,arguments);return a!==r&&(n=(r=a)&&function(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}(t,a)),n}return a._value=e,a}function Br(t,e){return function(){Sr(this,t).delay=+e.apply(this,arguments)}}function Hr(t,e){return e=+e,function(){Sr(this,t).delay=e}}function Fr(t,e){return function(){Nr(this,t).duration=+e.apply(this,arguments)}}function Vr(t,e){return e=+e,function(){Nr(this,t).duration=e}}var Ur=rn.prototype.constructor;function Wr(t){return function(){this.style.removeProperty(t)}}var Xr=0;function Yr(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function Jr(){return++Xr}var Qr=rn.prototype;Yr.prototype={constructor:Yr,select:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=Zt(t));for(var r=this._groups,a=r.length,i=new Array(a),o=0;o<a;++o)for(var s,l,u=r[o],c=u.length,h=i[o]=new Array(c),f=0;f<c;++f)(s=u[f])&&(l=t.call(s,s.__data__,f,u))&&("__data__"in s&&(l.__data__=s.__data__),h[f]=l,$r(h[f],e,n,f,h,jr(s,n)));return new Yr(i,this._parents,e,n)},selectAll:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=ee(t));for(var r=this._groups,a=r.length,i=[],o=[],s=0;s<a;++s)for(var l,u=r[s],c=u.length,h=0;h<c;++h)if(l=u[h]){for(var f,p=t.call(l,l.__data__,h,u),m=jr(l,n),g=0,d=p.length;g<d;++g)(f=p[g])&&$r(f,e,n,g,p,m);i.push(p),o.push(l)}return new Yr(i,o,e,n)},selectChild:Qr.selectChild,selectChildren:Qr.selectChildren,filter:function(t){"function"!=typeof t&&(t=re(t));for(var e=this._groups,n=e.length,r=new Array(n),a=0;a<n;++a)for(var i,o=e[a],s=o.length,l=r[a]=[],u=0;u<s;++u)(i=o[u])&&t.call(i,i.__data__,u,o)&&l.push(i);return new Yr(r,this._parents,this._name,this._id)},merge:function(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,a=n.length,i=Math.min(r,a),o=new Array(r),s=0;s<i;++s)for(var l,u=e[s],c=n[s],h=u.length,f=o[s]=new Array(h),p=0;p<h;++p)(l=u[p]||c[p])&&(f[p]=l);for(;s<r;++s)o[s]=e[s];return new Yr(o,this._parents,this._name,this._id)},selection:function(){return new Ur(this._groups,this._parents)},transition:function(){for(var t=this._name,e=this._id,n=Jr(),r=this._groups,a=r.length,i=0;i<a;++i)for(var o,s=r[i],l=s.length,u=0;u<l;++u)if(o=s[u]){var c=jr(o,e);$r(o,t,n,u,s,{time:c.time+c.delay+c.duration,delay:0,duration:c.duration,ease:c.ease})}return new Yr(r,this._parents,t,n)},call:Qr.call,nodes:Qr.nodes,node:Qr.node,size:Qr.size,empty:Qr.empty,each:Qr.each,on:function(t,e){var n=this._id;return arguments.length<2?jr(this.node(),n).on.on(t):this.each(function(t,e,n){var r,a,i=function(t){return(t+"").trim().split(/^|\s+/).every(function(t){var e=t.indexOf(".");return e>=0&&(t=t.slice(0,e)),!t||"start"===t})}(e)?Sr:Nr;return function(){var o=i(this,t),s=o.on;s!==r&&(a=(r=s).copy()).on(e,n),o.on=a}}(n,t,e))},attr:function(t,e){var n=Wt(t),r="transform"===n?lr:Gr;return this.attrTween(t,"function"==typeof e?(n.local?Kr:Lr)(n,r,zr(this,"attr."+t,e)):null==e?(n.local?Pr:Tr)(n):(n.local?Rr:Dr)(n,r,e))},attrTween:function(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==e)return this.tween(n,null);if("function"!=typeof e)throw new Error;var r=Wt(t);return this.tween(n,(r.local?qr:Ir)(r,e))},style:function(t,e,n){var r="transform"==(t+="")?sr:Gr;return null==e?this.styleTween(t,function(t,e){var n,r,a;return function(){var i=Ae(this,t),o=(this.style.removeProperty(t),Ae(this,t));return i===o?null:i===n&&o===r?a:a=e(n=i,r=o)}}(t,r)).on("end.style."+t,Wr(t)):"function"==typeof e?this.styleTween(t,function(t,e,n){var r,a,i;return function(){var o=Ae(this,t),s=n(this),l=s+"";return null==s&&(this.style.removeProperty(t),l=s=Ae(this,t)),o===l?null:o===r&&l===a?i:(a=l,i=e(r=o,s))}}(t,r,zr(this,"style."+t,e))).each(function(t,e){var n,r,a,i,o="style."+e,s="end."+o;return function(){var l=Nr(this,t),u=l.on,c=null==l.value[o]?i||(i=Wr(e)):void 0;u===n&&a===c||(r=(n=u).copy()).on(s,a=c),l.on=r}}(this._id,t)):this.styleTween(t,function(t,e,n){var r,a,i=n+"";return function(){var o=Ae(this,t);return o===i?null:o===r?a:a=e(r=o,n)}}(t,r,e),n).on("end.style."+t,null)},styleTween:function(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==e)return this.tween(r,null);if("function"!=typeof e)throw new Error;return this.tween(r,function(t,e,n){var r,a;function i(){var i=e.apply(this,arguments);return i!==a&&(r=(a=i)&&function(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}(t,i,n)),r}return i._value=e,i}(t,e,null==n?"":n))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var e=t(this);this.textContent=null==e?"":e}}(zr(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))},textTween:function(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(null==t)return this.tween(e,null);if("function"!=typeof t)throw new Error;return this.tween(e,function(t){var e,n;function r(){var r=t.apply(this,arguments);return r!==n&&(e=(n=r)&&function(t){return function(e){this.textContent=t.call(this,e)}}(r)),e}return r._value=t,r}(t))},remove:function(){return this.on("end.remove",function(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}(this._id))},tween:function(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r,a=jr(this.node(),n).tween,i=0,o=a.length;i<o;++i)if((r=a[i]).name===t)return r.value;return null}return this.each((null==e?Er:Or)(n,t,e))},delay:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?Br:Hr)(e,t)):jr(this.node(),e).delay},duration:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?Fr:Vr)(e,t)):jr(this.node(),e).duration},ease:function(t){var e=this._id;return arguments.length?this.each(function(t,e){if("function"!=typeof e)throw new Error;return function(){Nr(this,t).ease=e}}(e,t)):jr(this.node(),e).ease},easeVarying:function(t){if("function"!=typeof t)throw new Error;return this.each(function(t,e){return function(){var n=e.apply(this,arguments);if("function"!=typeof n)throw new Error;Nr(this,t).ease=n}}(this._id,t))},end:function(){var t,e,n=this,r=n._id,a=n.size();return new Promise(function(i,o){var s={value:o},l={value:function(){0===--a&&i()}};n.each(function(){var n=Nr(this,r),a=n.on;a!==t&&((e=(t=a).copy())._.cancel.push(s),e._.interrupt.push(s),e._.end.push(l)),n.on=e}),0===a&&i()})},[Symbol.iterator]:Qr[Symbol.iterator]};const Zr=t=>+t;var ta={time:null,delay:0,duration:250,ease:function(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}};function ea(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}rn.prototype.interrupt=function(t){return this.each(function(){!function(t,e){var n,r,a,i=t.__transition,o=!0;if(i){for(a in e=null==e?null:e+"",i)(n=i[a]).name===e?(r=n.state>2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(r?"interrupt":"cancel",t,t.__data__,n.index,n.group),delete i[a]):o=!1;o&&delete t.__transition}}(this,t)})},rn.prototype.transition=function(t){var e,n;t instanceof Yr?(e=t._id,t=t._name):(e=Jr(),(n=ta).time=yr(),t=null==t?null:t+"");for(var r=this._groups,a=r.length,i=0;i<a;++i)for(var o,s=r[i],l=s.length,u=0;u<l;++u)(o=s[u])&&$r(o,t,e,u,s,n||ea(o,e));return new Yr(r,this._parents,t,e)};const na=Math.PI,ra=2*na,aa=1e-6,ia=ra-aa;function oa(t){this._+=t[0];for(let e=1,n=t.length;e<n;++e)this._+=arguments[e]+t[e]}class sa{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=null==t?oa:function(t){let e=Math.floor(t);if(!(e>=0))throw new Error(`invalid digits: ${t}`);if(e>15)return oa;const n=10**e;return function(t){this._+=t[0];for(let e=1,r=t.length;e<r;++e)this._+=Math.round(arguments[e]*n)/n+t[e]}}(t)}moveTo(t,e){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,e){this._append`L${this._x1=+t},${this._y1=+e}`}quadraticCurveTo(t,e,n,r){this._append`Q${+t},${+e},${this._x1=+n},${this._y1=+r}`}bezierCurveTo(t,e,n,r,a,i){this._append`C${+t},${+e},${+n},${+r},${this._x1=+a},${this._y1=+i}`}arcTo(t,e,n,r,a){if(t=+t,e=+e,n=+n,r=+r,(a=+a)<0)throw new Error(`negative radius: ${a}`);let i=this._x1,o=this._y1,s=n-t,l=r-e,u=i-t,c=o-e,h=u*u+c*c;if(null===this._x1)this._append`M${this._x1=t},${this._y1=e}`;else if(h>aa)if(Math.abs(c*s-l*u)>aa&&a){let f=n-i,p=r-o,m=s*s+l*l,g=f*f+p*p,d=Math.sqrt(m),y=Math.sqrt(h),v=a*Math.tan((na-Math.acos((m+h-g)/(2*d*y)))/2),_=v/y,b=v/d;Math.abs(_-1)>aa&&this._append`L${t+_*u},${e+_*c}`,this._append`A${a},${a},0,0,${+(c*f>u*p)},${this._x1=t+b*s},${this._y1=e+b*l}`}else this._append`L${this._x1=t},${this._y1=e}`;else;}arc(t,e,n,r,a,i){if(t=+t,e=+e,i=!!i,(n=+n)<0)throw new Error(`negative radius: ${n}`);let o=n*Math.cos(r),s=n*Math.sin(r),l=t+o,u=e+s,c=1^i,h=i?r-a:a-r;null===this._x1?this._append`M${l},${u}`:(Math.abs(this._x1-l)>aa||Math.abs(this._y1-u)>aa)&&this._append`L${l},${u}`,n&&(h<0&&(h=h%ra+ra),h>ia?this._append`A${n},${n},0,1,${c},${t-o},${e-s}A${n},${n},0,1,${c},${this._x1=l},${this._y1=u}`:h>aa&&this._append`A${n},${n},0,${+(h>=na)},${c},${this._x1=t+n*Math.cos(a)},${this._y1=e+n*Math.sin(a)}`)}rect(t,e,n,r){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}}function la(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function ua(t){return(t=la(Math.abs(t)))?t[1]:NaN}var ca,ha=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function fa(t){if(!(e=ha.exec(t)))throw new Error("invalid format: "+t);var e;return new pa({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function pa(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function ma(t,e){var n=la(t,e);if(!n)return t+"";var r=n[0],a=n[1];return a<0?"0."+new Array(-a).join("0")+r:r.length>a+1?r.slice(0,a+1)+"."+r.slice(a+1):r+new Array(a-r.length+2).join("0")}fa.prototype=pa.prototype,pa.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 ga={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>ma(100*t,e),r:ma,s:function(t,e){var n=la(t,e);if(!n)return t+"";var r=n[0],a=n[1],i=a-(ca=3*Math.max(-8,Math.min(8,Math.floor(a/3))))+1,o=r.length;return i===o?r:i>o?r+new Array(i-o+1).join("0"):i>0?r.slice(0,i)+"."+r.slice(i):"0."+new Array(1-i).join("0")+la(t,Math.max(0,e+i-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function da(t){return t}var ya,va,_a,ba=Array.prototype.map,wa=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function xa(t){var e,n,r=void 0===t.grouping||void 0===t.thousands?da:(e=ba.call(t.grouping,Number),n=t.thousands+"",function(t,r){for(var a=t.length,i=[],o=0,s=e[0],l=0;a>0&&s>0&&(l+s+1>r&&(s=Math.max(1,r-l)),i.push(t.substring(a-=s,a+s)),!((l+=s+1)>r));)s=e[o=(o+1)%e.length];return i.reverse().join(n)}),a=void 0===t.currency?"":t.currency[0]+"",i=void 0===t.currency?"":t.currency[1]+"",o=void 0===t.decimal?".":t.decimal+"",s=void 0===t.numerals?da:function(t){return function(e){return e.replace(/[0-9]/g,function(e){return t[+e]})}}(ba.call(t.numerals,String)),l=void 0===t.percent?"%":t.percent+"",u=void 0===t.minus?"−":t.minus+"",c=void 0===t.nan?"NaN":t.nan+"";function h(t){var e=(t=fa(t)).fill,n=t.align,h=t.sign,f=t.symbol,p=t.zero,m=t.width,g=t.comma,d=t.precision,y=t.trim,v=t.type;"n"===v?(g=!0,v="g"):ga[v]||(void 0===d&&(d=12),y=!0,v="g"),(p||"0"===e&&"="===n)&&(p=!0,e="0",n="=");var _="$"===f?a:"#"===f&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",b="$"===f?i:/[%p]/.test(v)?l:"",w=ga[v],x=/[defgprs%]/.test(v);function k(t){var a,i,l,f=_,k=b;if("c"===v)k=w(t)+k,t="";else{var M=(t=+t)<0||1/t<0;if(t=isNaN(t)?c:w(Math.abs(t),d),y&&(t=function(t){t:for(var e,n=t.length,r=1,a=-1;r<n;++r)switch(t[r]){case".":a=e=r;break;case"0":0===a&&(a=r),e=r;break;default:if(!+t[r])break t;a>0&&(a=0)}return a>0?t.slice(0,a)+t.slice(e+1):t}(t)),M&&0===+t&&"+"!==h&&(M=!1),f=(M?"("===h?h:u:"-"===h||"("===h?"":h)+f,k=("s"===v?wa[8+ca/3]:"")+k+(M&&"("===h?")":""),x)for(a=-1,i=t.length;++a<i;)if(48>(l=t.charCodeAt(a))||l>57){k=(46===l?o+t.slice(a+1):t.slice(a))+k,t=t.slice(0,a);break}}g&&!p&&(t=r(t,1/0));var C=f.length+t.length+k.length,A=C<m?new Array(m-C+1).join(e):"";switch(g&&p&&(t=r(A+t,A.length?m-k.length:1/0),A=""),n){case"<":t=f+t+k+A;break;case"=":t=f+A+t+k;break;case"^":t=A.slice(0,C=A.length>>1)+f+t+k+A.slice(C);break;default:t=A+f+t+k}return s(t)}return d=void 0===d?6:/[gprs]/.test(v)?Math.max(1,Math.min(21,d)):Math.max(0,Math.min(20,d)),k.toString=function(){return t+""},k}return{format:h,formatPrefix:function(t,e){var n=h(((t=fa(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(ua(e)/3))),a=Math.pow(10,-r),i=wa[8+r/3];return function(t){return n(a*t)+i}}}}function ka(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}function Ma(t){return+t}ya=xa({thousands:",",grouping:[3],currency:["$",""]}),va=ya.format,_a=ya.formatPrefix;var Ca=[0,1];function Aa(t){return t}function $a(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:function(t){return function(){return t}}(isNaN(e)?NaN:.5)}function Sa(t,e,n){var r=t[0],a=t[1],i=e[0],o=e[1];return a<r?(r=$a(a,r),i=n(o,i)):(r=$a(r,a),i=n(i,o)),function(t){return i(r(t))}}function Na(t,e,n){var r=Math.min(t.length,e.length)-1,a=new Array(r),i=new Array(r),o=-1;for(t[r]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++o<r;)a[o]=$a(t[o],t[o+1]),i[o]=n(e[o],e[o+1]);return function(e){var n=Gt(t,e,1,r)-1;return i[n](a[n](e))}}function ja(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function Ea(){var t,e,n,r,a,i,o=Ca,s=Ca,l=Qn,u=Aa;function c(){var t,e,n,l=Math.min(o.length,s.length);return u!==Aa&&(t=o[0],e=o[l-1],t>e&&(n=t,t=e,e=n),u=function(n){return Math.max(t,Math.min(e,n))}),r=l>2?Na:Sa,a=i=null,h}function h(e){return null==e||isNaN(e=+e)?n:(a||(a=r(o.map(t),s,l)))(t(u(e)))}return h.invert=function(n){return u(e((i||(i=r(s,o.map(t),Un)))(n)))},h.domain=function(t){return arguments.length?(o=Array.from(t,Ma),c()):o.slice()},h.range=function(t){return arguments.length?(s=Array.from(t),c()):s.slice()},h.rangeRound=function(t){return s=Array.from(t),l=Zn,c()},h.clamp=function(t){return arguments.length?(u=!!t||Aa,c()):u!==Aa},h.interpolate=function(t){return arguments.length?(l=t,c()):l},h.unknown=function(t){return arguments.length?(n=t,h):n},function(n,r){return t=n,e=r,c()}}function Oa(t,e,n,r){var a,i=function(t,e,n){n=+n;const r=(e=+e)<(t=+t),a=r?Lt(e,t,n):Lt(t,e,n);return(r?-1:1)*(a<0?1/-a:a)}(t,e,n);switch((r=fa(null==r?",f":r)).type){case"s":var o=Math.max(Math.abs(t),Math.abs(e));return null!=r.precision||isNaN(a=function(t,e){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(ua(e)/3)))-ua(Math.abs(t)))}(i,o))||(r.precision=a),_a(r,o);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(a=function(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,ua(e)-ua(t))+1}(i,Math.max(Math.abs(t),Math.abs(e))))||(r.precision=a-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(a=function(t){return Math.max(0,-ua(Math.abs(t)))}(i))||(r.precision=a-2*("%"===r.type))}return va(r)}function za(t){var e=t.domain;return t.ticks=function(t){var n=e();return function(t,e,n){if(!((n=+n)>0))return[];if((t=+t)===(e=+e))return[t];const r=e<t,[a,i,o]=r?Rt(e,t,n):Rt(t,e,n);if(!(i>=a))return[];const s=i-a+1,l=new Array(s);if(r)if(o<0)for(let t=0;t<s;++t)l[t]=(i-t)/-o;else for(let t=0;t<s;++t)l[t]=(i-t)*o;else if(o<0)for(let t=0;t<s;++t)l[t]=(a+t)/-o;else for(let t=0;t<s;++t)l[t]=(a+t)*o;return l}(n[0],n[n.length-1],null==t?10:t)},t.tickFormat=function(t,n){var r=e();return Oa(r[0],r[r.length-1],null==t?10:t,n)},t.nice=function(n){null==n&&(n=10);var r,a,i=e(),o=0,s=i.length-1,l=i[o],u=i[s],c=10;for(u<l&&(a=l,l=u,u=a,a=o,o=s,s=a);c-- >0;){if((a=Lt(l,u,n))===r)return i[o]=l,i[s]=u,e(i);if(a>0)l=Math.floor(l/a)*a,u=Math.ceil(u/a)*a;else{if(!(a<0))break;l=Math.ceil(l*a)/a,u=Math.floor(u*a)/a}r=a}return t},t}function Ga(){var t=Ea()(Aa,Aa);return t.copy=function(){return ja(t,Ga())},ka.apply(t,arguments),za(t)}function Ta(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function Pa(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function Da(t){return t<0?-t*t:t*t}function Ra(t){var e=t(Aa,Aa),n=1;return e.exponent=function(e){return arguments.length?1===(n=+e)?t(Aa,Aa):.5===n?t(Pa,Da):t(Ta(n),Ta(1/n)):n},za(e)}function La(){var t=Ra(Ea());return t.copy=function(){return ja(t,La()).exponent(t.exponent())},ka.apply(t,arguments),t}function Ka(t){return function(){return t}}const qa=Math.abs,Ia=Math.atan2,Ba=Math.cos,Ha=Math.max,Fa=Math.min,Va=Math.sin,Ua=Math.sqrt,Wa=1e-12,Xa=Math.PI,Ya=Xa/2,Ja=2*Xa;function Qa(t){return t>=1?Ya:t<=-1?-Ya:Math.asin(t)}function Za(t){let e=3;return t.digits=function(n){if(!arguments.length)return e;if(null==n)e=null;else{const t=Math.floor(n);if(!(t>=0))throw new RangeError(`invalid digits: ${n}`);e=t}return t},()=>new sa(e)}function ti(t){return t.innerRadius}function ei(t){return t.outerRadius}function ni(t){return t.startAngle}function ri(t){return t.endAngle}function ai(t){return t&&t.padAngle}function ii(t,e,n,r,a,i,o){var s=t-n,l=e-r,u=(o?i:-i)/Ua(s*s+l*l),c=u*l,h=-u*s,f=t+c,p=e+h,m=n+c,g=r+h,d=(f+m)/2,y=(p+g)/2,v=m-f,_=g-p,b=v*v+_*_,w=a-i,x=f*g-m*p,k=(_<0?-1:1)*Ua(Ha(0,w*w*b-x*x)),M=(x*_-v*k)/b,C=(-x*v-_*k)/b,A=(x*_+v*k)/b,$=(-x*v+_*k)/b,S=M-d,N=C-y,j=A-d,E=$-y;return S*S+N*N>j*j+E*E&&(M=A,C=$),{cx:M,cy:C,x01:-c,y01:-h,x11:M*(a/w-1),y11:C*(a/w-1)}}function oi(){var t=ti,e=ei,n=Ka(0),r=null,a=ni,i=ri,o=ai,s=null,l=Za(u);function u(){var u,c,h=+t.apply(this,arguments),f=+e.apply(this,arguments),p=a.apply(this,arguments)-Ya,m=i.apply(this,arguments)-Ya,g=qa(m-p),d=m>p;if(s||(s=u=l()),f<h&&(c=f,f=h,h=c),f>Wa)if(g>Ja-Wa)s.moveTo(f*Ba(p),f*Va(p)),s.arc(0,0,f,p,m,!d),h>Wa&&(s.moveTo(h*Ba(m),h*Va(m)),s.arc(0,0,h,m,p,d));else{var y,v,_=p,b=m,w=p,x=m,k=g,M=g,C=o.apply(this,arguments)/2,A=C>Wa&&(r?+r.apply(this,arguments):Ua(h*h+f*f)),$=Fa(qa(f-h)/2,+n.apply(this,arguments)),S=$,N=$;if(A>Wa){var j=Qa(A/h*Va(C)),E=Qa(A/f*Va(C));(k-=2*j)>Wa?(w+=j*=d?1:-1,x-=j):(k=0,w=x=(p+m)/2),(M-=2*E)>Wa?(_+=E*=d?1:-1,b-=E):(M=0,_=b=(p+m)/2)}var O=f*Ba(_),z=f*Va(_),G=h*Ba(x),T=h*Va(x);if($>Wa){var P,D=f*Ba(b),R=f*Va(b),L=h*Ba(w),K=h*Va(w);if(g<Xa)if(P=function(t,e,n,r,a,i,o,s){var l=n-t,u=r-e,c=o-a,h=s-i,f=h*l-c*u;if(!(f*f<Wa))return[t+(f=(c*(e-i)-h*(t-a))/f)*l,e+f*u]}(O,z,L,K,D,R,G,T)){var q=O-P[0],I=z-P[1],B=D-P[0],H=R-P[1],F=1/Va(function(t){return t>1?0:t<-1?Xa:Math.acos(t)}((q*B+I*H)/(Ua(q*q+I*I)*Ua(B*B+H*H)))/2),V=Ua(P[0]*P[0]+P[1]*P[1]);S=Fa($,(h-V)/(F-1)),N=Fa($,(f-V)/(F+1))}else S=N=0}M>Wa?N>Wa?(y=ii(L,K,O,z,f,N,d),v=ii(D,R,G,T,f,N,d),s.moveTo(y.cx+y.x01,y.cy+y.y01),N<$?s.arc(y.cx,y.cy,N,Ia(y.y01,y.x01),Ia(v.y01,v.x01),!d):(s.arc(y.cx,y.cy,N,Ia(y.y01,y.x01),Ia(y.y11,y.x11),!d),s.arc(0,0,f,Ia(y.cy+y.y11,y.cx+y.x11),Ia(v.cy+v.y11,v.cx+v.x11),!d),s.arc(v.cx,v.cy,N,Ia(v.y11,v.x11),Ia(v.y01,v.x01),!d))):(s.moveTo(O,z),s.arc(0,0,f,_,b,!d)):s.moveTo(O,z),h>Wa&&k>Wa?S>Wa?(y=ii(G,T,D,R,h,-S,d),v=ii(O,z,L,K,h,-S,d),s.lineTo(y.cx+y.x01,y.cy+y.y01),S<$?s.arc(y.cx,y.cy,S,Ia(y.y01,y.x01),Ia(v.y01,v.x01),!d):(s.arc(y.cx,y.cy,S,Ia(y.y01,y.x01),Ia(y.y11,y.x11),!d),s.arc(0,0,h,Ia(y.cy+y.y11,y.cx+y.x11),Ia(v.cy+v.y11,v.cx+v.x11),d),s.arc(v.cx,v.cy,S,Ia(v.y11,v.x11),Ia(v.y01,v.x01),!d))):s.arc(0,0,h,x,w,d):s.lineTo(G,T)}else s.moveTo(0,0);if(s.closePath(),u)return s=null,u+""||null}return u.centroid=function(){var n=(+t.apply(this,arguments)+ +e.apply(this,arguments))/2,r=(+a.apply(this,arguments)+ +i.apply(this,arguments))/2-Xa/2;return[Ba(r)*n,Va(r)*n]},u.innerRadius=function(e){return arguments.length?(t="function"==typeof e?e:Ka(+e),u):t},u.outerRadius=function(t){return arguments.length?(e="function"==typeof t?t:Ka(+t),u):e},u.cornerRadius=function(t){return arguments.length?(n="function"==typeof t?t:Ka(+t),u):n},u.padRadius=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:Ka(+t),u):r},u.startAngle=function(t){return arguments.length?(a="function"==typeof t?t:Ka(+t),u):a},u.endAngle=function(t){return arguments.length?(i="function"==typeof t?t:Ka(+t),u):i},u.padAngle=function(t){return arguments.length?(o="function"==typeof t?t:Ka(+t),u):o},u.context=function(t){return arguments.length?(s=null==t?null:t,u):s},u}function si(t){this._context=t}function li(t){return new si(t)}function ui(t){return t[0]}function ci(t){return t[1]}function hi(t,e){var n=Ka(!0),r=null,a=li,i=null,o=Za(s);function s(s){var l,u,c,h=(s=function(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}(s)).length,f=!1;for(null==r&&(i=a(c=o())),l=0;l<=h;++l)!(l<h&&n(u=s[l],l,s))===f&&((f=!f)?i.lineStart():i.lineEnd()),f&&i.point(+t(u,l,s),+e(u,l,s));if(c)return i=null,c+""||null}return t="function"==typeof t?t:void 0===t?ui:Ka(t),e="function"==typeof e?e:void 0===e?ci:Ka(e),s.x=function(e){return arguments.length?(t="function"==typeof e?e:Ka(+e),s):t},s.y=function(t){return arguments.length?(e="function"==typeof t?t:Ka(+t),s):e},s.defined=function(t){return arguments.length?(n="function"==typeof t?t:Ka(!!t),s):n},s.curve=function(t){return arguments.length?(a=t,null!=r&&(i=a(r)),s):a},s.context=function(t){return arguments.length?(null==t?r=i=null:i=a(r=t),s):r},s}function fi(t,e,n){this.k=t,this.x=e,this.y=n}function pi(t){return"string"==typeof t?an(t):t}function mi(t,e){const n=e||{};let r;const a=bi(vi(wi(Object.assign(function(e,i){const o=pi(e).append(t);Object.entries(n).forEach(([t,e])=>o.attr(t,e)),void 0!==r&&o.text(r),a.stylable(o),a.appendable(o,i),a.interactable(o,i)},{attr:(t,e)=>void 0!==e?(n[t]=e,a):n[t],text(t){return arguments.length?(r=t,a):r}}))));return a}function gi(){const t=bi(vi(_i(wi(function(e,n){const r=pi(e).append("g");t.transformable(r),t.stylable(r),t.appendable(r,n),t.interactable(r,n)}))));return t}si.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e)}}},fi.prototype={constructor:fi,scale:function(t){return 1===t?this:new fi(this.k*t,this.x,this.y)},translate:function(t,e){return 0===t&0===e?this:new fi(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}},new fi(1,0,0),fi.prototype;const di=t=>t,yi=Object.assign(function(t){return t+(++yi.nextId).toString(36)},{nextId:0});function vi(t){let e,n=[];const r=Object.assign(t,{stylable(t){n.length&&t.attr("class",r.class()),e&&t.attr("style",r.style())},css(t){return arguments.length?(n.push(St(t)),r):n.join(" ")},class(t){return arguments.length?(n=n.concat(t.split(" ")),r):n.join(" ")},style(t){return arguments.length?(e=t,r):e}});return r}function _i(t){let e=0,n=0,r=1,a=1,i=0;const o=Object.assign(t,{transformable(t){t.attr("transform",`translate(${e}, ${n}) rotate(${i}) scale(${r}, ${a})`)},x(t){return arguments.length?(e=t,o):e},y(t){return arguments.length?(n=t,o):n},scale(t,e){return arguments.length?(r=t,a=e??t,o):[r,a]},rotate(t){return arguments.length?(i=t,o):i}});return o}function bi(t){const e={},n=Object.assign(t,{interactable(t,...n){Object.entries(e).forEach(([e,r])=>{const[a,i]=r;t.on(e,t=>a(t,...n),i)})},on(t,r,a){return arguments.length?(e[t]=[r,a],n):e}});return n}function wi(t){let e=[],n=[];const r=Object.assign(t,{appendable(t,r){const a=pi(t);if(e.length){const t=a.node(),n=an((t&&"ownerSVGElement"in t?t.ownerSVGElement:null)||t).select("defs");if(n.empty())throw"Couldn't find svg defs element";n.selectAll(null).data(e).enter().each(function(t){an(this).call(t,r)})}a.selectAll(null).data(n).enter().each(function(t){an(this).call(t,r)})},defs(...t){return arguments.length?(e=e.concat(t),r):e},append(...t){return arguments.length?(n=n.concat(t),r):n}});return r}class xi extends Error{}const ki={create(t){const e=Number(t);if(Number.isNaN(e))throw new xi(`"${t}" cannot be parsed into a number`);return e},add:(t,e)=>Number(t)+Number(e),sub:(t,e)=>Number(t)-Number(e),mul:(t,e)=>Number(t)*Number(e),div:(t,e)=>Number(t)/Number(e),lt:(t,e)=>Number(t)<Number(e),lte:(t,e)=>Number(t)<=Number(e),gt:(t,e)=>Number(t)>Number(e),gte:(t,e)=>Number(t)>=Number(e)};function Mi(t){return null!=t&&"object"==typeof t&&"numerator"in t&&("number"==typeof t.numerator||"string"==typeof t.numerator)&&"denominator"in t&&("number"==typeof t.denominator||"string"==typeof t.denominator)}class Ci extends Error{}class Ai extends Error{}class $i extends Error{}class Si extends Error{}class Ni extends Error{}class ji{constructor(t,e){this.destination=null,this.origin=null,this.cls=t.cls,this.val=this.cls.create(e||0),this.measureData=t.measures,this.unitCache=t.unitCache}from(t){if(null!=this.destination)throw new Ai(".from must be called before .to");return this.origin=this.getUnit(t),null==this.origin&&this.throwUnsupportedUnitError(t),this}convertFraction(t){return Mi(t)?this.cls.div(t.numerator,t.denominator):this.cls.create(t)}to(t){var e,n;if(null==this.origin)throw new Error(".to must be called after .from");this.destination=this.getUnit(t),null==this.destination&&this.throwUnsupportedUnitError(t);const r=this.destination,a=this.origin;if(a.abbr===r.abbr)return this.val;if(r.measure!=a.measure)throw new $i(`Cannot convert incompatible measures of ${r.measure} and ${a.measure}`);let i=this.cls.mul(this.val,this.convertFraction(a.unit.to_anchor));if(a.unit.anchor_shift&&(i=this.cls.sub(i,this.convertFraction(a.unit.anchor_shift))),a.system!=r.system){const t=this.measureData[a.measure].anchors;if(null==t)throw new Si(`Unable to convert units. Anchors are missing for "${a.measure}" and "${r.measure}" measures.`);const o=t[a.system];if(null==o)throw new Si(`Unable to find anchor for "${a.measure}" to "${r.measure}". Please make sure it is defined.`);const s=null===(e=o[r.system])||void 0===e?void 0:e.transform,l=null===(n=o[r.system])||void 0===n?void 0:n.ratio;if("function"==typeof s)i=s(i,this.cls);else if("number"==typeof l)i=this.cls.mul(i,l);else{if(!Mi(l))throw new Si("A system anchor needs to either have a defined ratio number or a transform function.");i=this.cls.mul(i,this.convertFraction(l))}}return r.unit.anchor_shift&&(i=this.cls.add(i,this.convertFraction(r.unit.anchor_shift))),this.cls.div(i,this.convertFraction(r.unit.to_anchor))}toBest(t){var e,n,r;if(null==this.origin)throw new Ai(".toBest must be called after .from");const a=this.cls.lt(this.val,0);let i=[],o=a?-1:1,s=this.origin.system;"object"==typeof t&&(i=null!==(e=t.exclude)&&void 0!==e?e:[],o=null!==(n=t.cutOffNumber)&&void 0!==n?n:o,s=null!==(r=t.system)&&void 0!==r?r:this.origin.system);let l=null;for(const t of this.possibilities()){const e=this.describe(t);if(-1===i.indexOf(t)&&e.system===s){const n=this.to(t);if(a?this.cls.gt(n,o):this.cls.lt(n,o))continue;(null===l||(a?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:t,singular:e.singular,plural:e.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(t){var e;return null!==(e=this.unitCache.get(t))&&void 0!==e?e:null}describe(t){const e=this.getUnit(t);if(null!=e)return this.describeUnit(e);this.throwUnsupportedUnitError(t)}describeUnit(t){return{abbr:t.abbr,measure:t.measure,system:t.system,singular:t.unit.name.singular,plural:t.unit.name.plural}}list(t){const e=[];if(null==t)for(const[t,n]of Object.entries(this.measureData))for(const[r,a]of Object.entries(n.systems))for(const[n,i]of Object.entries(a))e.push(this.describeUnit({abbr:n,measure:t,system:r,unit:i}));else{if(!this.isMeasure(t))throw new Ni(`Meausure "${t}" not found.`);const n=this.measureData[t];for(const[r,a]of Object.entries(n.systems))for(const[n,i]of Object.entries(a))e.push(this.describeUnit({abbr:n,measure:t,system:r,unit:i}))}return e}isMeasure(t){return t in this.measureData}throwUnsupportedUnitError(t){let e=[];for(const t of Object.values(this.measureData))for(const n of Object.values(t.systems))e=e.concat(Object.keys(n));throw new Ci(`Unsupported unit ${t}, use one of: ${e.join(", ")}`)}possibilities(t){let e=[],n=[];"string"==typeof t&&this.isMeasure(t)?n.push(t):null!=this.origin?n.push(this.origin.measure):n=Object.keys(this.measureData);for(const t of n){const n=this.measureData[t].systems;for(const t of Object.values(n))e=[...e,...Object.keys(t)]}return e}measures(){return Object.keys(this.measureData)}}const Ei=function(t,e){if("object"!=typeof t)throw new TypeError("The measures argument needs to be an object");const n=function(t){const e=new Map;for(const[n,r]of Object.entries(t))for(const[t,a]of Object.entries(r.systems))for(const[r,i]of Object.entries(a))e.set(r,{measure:n,system:t,abbr:r,unit:i});return e}(t);return null!=e&&(null!=(r=e)&&"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 ji({measures:t,unitCache:n,cls:e},r):e=>new ji({measures:t,unitCache:n,cls:ki},e);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(t,e){return e.add(e.div(t,e.div(5,9)),32)}}},imperial:{metric:{transform:function(t,e){return e.mul(e.sub(t,32),e.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}}}}}}),Oi=Ei().possibilities();function zi(t,e,n){let r=t;if(e&&n)try{r=Ei(t).from(e).to(n)}catch(t){const e=t instanceof Error?t.message:String(t);console.log("Unit conversion error: "+e)}else"string"==typeof t&&t.match(/^\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d/)&&(r=new Date(t));return r}function Gi(t,e){const n=t.split(".");for(;n.length;){const t=n.join(".");if(t in e)return t;n.pop()}}function Ti(){const e=[],n={},r={},a={},i=new Map;let o,s=!1;function l(t){return i.has(t)||i.set(t,Gi(t,r)),i.get(t)}const u=Object.assign(function(t,n){const o=t.metrics||{};if(Object.keys(o).some(t=>!(t in r))&&i.clear(),Object.assign(r,o),Object.assign(a,t.units||{}),!s&&Object.keys(o).length){s=!0;const t=u.indicators().filter(t=>void 0===l(t));t.length&&console.log("Warning: no metric matching",t)}e.forEach(({updater:t,keys:e,unit:i})=>{if(!e.some(t=>{const e=l(t);return void 0!==e&&e in o}))return;const s=l(e[0]);if(void 0===s)return;const u=a[s]||"",c=zi(r[s],u,i);void 0===c?console.log(`Warning: failed to convert ${r[s]} from ${u} to ${i}`):t(c,n,r,i||u)})},{register(t,n,r){const a=(Array.isArray(n)?n:[n]).filter(t=>!!t);a.length&&e.push({updater:t,keys:a,unit:r||""})},fake(t,e,r){t in n?console.log(`Warning: ignoring duplicate fake for ${t}`):n[t]={fake:e,unit:r}},fakes:()=>n,indicators:()=>Array.from(new Set(e.flatMap(t=>t.keys))),sink:t=>(o=t,u),send(...t){o?o(t):console.log("g3: actions dropped, no hub input configured:",t)}});return t.activeController=u,u}function Pi(t){const e={},n={},r={};let a=1;function i(t){return Object.keys(t).length&&a++,{latest:a,metrics:t,units:Object.fromEntries(Object.keys(t).filter(t=>t in n).map(t=>[t,n[t]]))}}return Object.entries(t).forEach(([t,{fake:a,unit:i}])=>{i&&(n[t]=i),"function"==typeof a?(r[t]=a,e[t]=a(void 0)):e[t]=a}),{snapshot:()=>({latest:a,metrics:{...e},units:{...n}}),tick(){const t={};return Object.entries(r).forEach(([n,r])=>{e[n]=t[n]=r(e[n])}),i(t)},apply(t){const r={};return t.forEach(t=>function(t,r){if("trigger"===t.op)return void console.log("g3 local hub: ignoring trigger",t.event);const a=void 0===t.metric?void 0:Gi(t.metric,e);if(void 0===a)return void console.log("g3 local hub: ignoring action for unknown metric",t);const i=n[a];let o;if("set"===t.op)o=zi(t.value,t.unit,i);else{if("adjust"!==t.op)return void console.log("g3 local hub: ignoring unknown action",t);{const{min:n,max:r,wrap:s}=t;let l=Number(zi(e[a],i,t.unit))+t.by;if(s&&void 0!==n&&void 0!==r){const t=r-n;l=((l-n)%t+t)%t+n}else void 0!==n&&(l=Math.max(n,l)),void 0!==r&&(l=Math.min(r,l));o=zi(l,t.unit,i)}}e[a]=o,r[a]=o}(t,r)),i(r)}}}t.activeController=void 0;const Di=1e-6;function Ri(){let t=0,e=0,n=2e3,r=2e3,a=100,i=100,o=10,s=10;const l=vi(Object.assign(function(u){const c=pi(u).append("g").attr("class","g3-grid");l.stylable(c);const h=Kt(t,t+n+Di,a),f=Kt(e,e+r+Di,i);c.selectAll(null).data(Kt(t,t+n+Di,o).filter(t=>!h.includes(t))).enter().append("line").attr("class","g3-grid-hairline").attr("transform",t=>"translate("+t+","+e+")").attr("y2",r),c.selectAll(null).data(Kt(e,e+r+Di,s).filter(t=>!f.includes(t))).enter().append("line").attr("class","g3-grid-hairline").attr("transform",e=>"translate("+t+","+e+")").attr("x2",n);const p=c.selectAll(null).data(h).enter().append("g").attr("class","g3-grid-line").attr("transform",t=>"translate("+t+","+e+")"),m=c.selectAll(null).data(f).enter().append("g").attr("class","g3-grid-line").attr("transform",e=>"translate("+t+","+e+")");p.append("line").attr("y2",r),m.append("line").attr("x2",n),p.selectAll(null).data(f.slice(0,-1)).enter().append("g").attr("class","g3-grid-label").attr("transform",t=>"translate(0,"+(t-e+i/2)+") rotate(-90) "),m.selectAll(null).data(h.slice(0,-1)).enter().append("g").attr("class","g3-grid-label").attr("transform",e=>"translate("+(e-t+a/2)+", 0)");const g=c.selectAll(".g3-grid-label");g.append("rect").attr("x",-12).attr("width",24).attr("y",-4).attr("height",8).attr("rx",4),g.append("text").text(function(){return String(an(this.parentNode.parentNode).datum())})},{x(e){return arguments.length?(t=e,l):t},y(t){return arguments.length?(e=t,l):e},width(t){return arguments.length?(n=t,l):n},height(t){return arguments.length?(r=t,l):r},xmajor(t){return arguments.length?(a=t,l):a},ymajor(t){return arguments.length?(i=t,l):i},xminor(t){return arguments.length?(o=t,l):o},yminor(t){return arguments.length?(s=t,l):s}}));return l}function Li(t){const e="undefined"!=typeof document&&document.location?document.location.href:"http://localhost";return new URL(t.toString(),e)}const Ki={needle:gi().append(mi("rect",{x:-1,y:-90,width:2,height:100}).class("g3-pointer-needle"),mi("circle",{r:5}).class("g3-pointer-hub")),blade:gi().scale(5.625,-5.625).append(mi("path",{d:"M 0,9 L 0.6,7 l 0,-7 l -1.2,0 l 0,7 z"}).class("g3-pointer-blade"),mi("circle",{r:1.25}).class("g3-pointer-hub")),dagger:gi().scale(5.625,-5.625).append(mi("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"),mi("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"),mi("circle",{r:1.25}).class("g3-pointer-hub")),rondel:gi().scale(5.625,-5.625).append(mi("path",{d:"M 0,15 L 1,0 l -2,0 z"}).class("g3-pointer-blade"),mi("circle",{r:2.4}).class("g3-pointer-hub")),sword:gi().scale(5.625,-5.625).append(mi("path",{d:"M 0,16 L 0.6,14 l 0,-12 l -1.2,0 l 0,12 z"}).class("g3-pointer-blade"),mi("rect",{x:-.6,y:-6,height:8,width:1.2}).class("g3-pointer-handle"),mi("circle",{r:1.2}).class("g3-pointer-hub"),mi("circle",{r:.5}).class("g3-highlight"),mi("circle",{r:1.2,cy:-6}).class("g3-pointer-pommel")),wedge:gi().append(mi("path",{d:"M 5,25 l -10,0 l 5,-120 z"}).class("g3-pointer-blade"),mi("circle",{r:10}).class("g3-pointer-hub"),mi("circle",{r:4}).class("g3-highlight")),"omega-second":gi().append(mi("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"),mi("path",{d:"M 0,-69 l 3,12 l -3,3 l -3,-3 z"}).class("g3-pointer-luminous"),mi("circle",{r:4}).class("g3-pointer-hub"),mi("circle",{r:2}).class("g3-highlight")),"omega-baton-long":gi().append(mi("path",{d:"M 3,0 l 0,-80 l -3,-10 l -3,10 l 0,80 z"}).class("g3-pointer-blade"),mi("path",{d:"M 2,0 l 0,-80 l -4,0 l 0,80 z"}).class("g3-pointer-luminous"),mi("circle",{r:6.5}).class("g3-pointer-hub")),"omega-baton-short":gi().append(mi("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"),mi("path",{d:"M 2.5,0 l 0,-55 l -5,0 l 0,55 z"}).class("g3-pointer-luminous"),mi("circle",{r:9}).class("g3-pointer-hub")),"aircraft-heading":gi().x(-160).y(-160).scale(.8).append(mi("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":gi().x(-218).y(-157.5).scale(.5).append(mi("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"}),mi("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 qi(t){return[t[0],t[t.length-1]]}function Ii(t,e){const[n,r]=qi(e);return"circular"==t&&n!==r&&(n-r)%360==0}function Bi(){let e={opacity:1},n={opacity:0},r=di;const a=wi(Object.assign(function(i,o){const s=Qn(n,e),l=pi(i).append("g").attr("class","g3-indicate-style");if(a.appendable(l,o),t.activeController&&o){const e=(t,e,n,a)=>{const i=s(Number(r(t,n,a)));for(const t in i)l.style(t,i[t])};t.activeController.register(e,o.metrics(),o.unit())}},{styleOn(t){return arguments.length?(e=t,a):e},styleOff(t){return arguments.length?(n=t,a):n},trigger(t){return arguments.length?(r=t,a):r}}));return a}function Hi(e){let n,r,a,i,o,s=e,l=[],u=di,c=Ga().range([0,360]),h="circular",f=!1,p=100,m=!1;const g=vi(wi(Object.assign(function(e,s){let l=s?s._ns.slice():[];if(a)if(a.startsWith(".")){const t=a.match(/^\.+(.*)/),e=t?t[1]:"";l=l.slice(0,-(a.length-e.length-1)),e&&l.push(e)}else l.push(a);g._ns=l;const d=g.metric(),y=pi(e).append("g");g.stylable(y);const v=y.append("g");if("function"==typeof o){const t=yi("gauge-clip");o(v.append("clipPath").attr("id",t)),v.attr("clip-path",`url(#${t})`)}if(g.appendable(v,g),m&&Ri().x(-p).y(-p).xmajor(50).ymajor(50).width(2*p).height(2*p)(v),n=t.activeController,t.activeController&&(void 0!==i&&d&&t.activeController.fake(d,i,r),f&&d)){const e=Ii(h,c.range()),n=(t,n,r,a)=>{const i=g.metrictransform(u(t,r,a),!0),o="function"==typeof n?n(v):v;v.attr("transform")||v.attr("transform",i),!e&&"attrTween"in o?o.attrTween("transform",function(){return Jn(this.getAttribute("transform")||i,i)}):o.attr("transform",i)};v.classed("will-change-transform",!0),t.activeController.register(n,g.metrics(),r)}},{_ns:[],metric(t,...e){return arguments.length?(s=t,l=e,g):s&&[s].concat(g._ns).join(".")},metrics:()=>(s?[s,...l]:[]).map(t=>[t].concat(g._ns).join(".")),send(...t){const e=g.metric(),a=t.map(t=>"trigger"===t.op||void 0!==t.metric?t:{...t,metric:e,...r&&!t.unit?{unit:r}:{}});n?n.send(...a):console.log("g3: actions dropped, gauge has not been drawn:",a)},rescale(t){return arguments.length?(u=t,g):u},unit(t){return t&&!Oi.includes(t)&&console.log(`WARNING: gauge.unit ${t} not a known unit, see https://github.com/convert-units/convert-units`),arguments.length?(r=t,g):r},instance(t){return arguments.length?(a=t??void 0,g):a},fake(t){return arguments.length?(i=t,g):i},kind(t){return arguments.length?(h=t,g):h},clip(t){return arguments.length?(o=t,g):o},r(t){return arguments.length?(p=t,g):p},measure(t){return arguments.length?(c=t,g):c},autoindicate(t){return arguments.length?(f=t,g):f},grid(t){return arguments.length?(m=!!t,g):m},metrictransform(t,e){const n="circular"==h,r=e?-c(t):c(t);return n?`rotate(${r})`:`translate(${r}, 0)`},marktransform(t,e){const n="circular"==h,r=e??0,a=c(t),i=r+(n?-p:0);return n?`rotate(${a}) translate(0, ${i})`:`translate(${a}, ${i})`},sectorpath(t,e,n,r){const a=n??0,i=r??0,o=g.r(),s=g.measure(),l=s(t),u=s(e);return"circular"==g.kind()?oi()({innerRadius:o-i-a,outerRadius:o-i,startAngle:Ei(l).from("deg").to("rad"),endAngle:Ei(u).from("deg").to("rad")}):`M ${l},${i} l 0,${a} l ${u-l},0 l 0,${-a} z`}}))).class("g3-gauge");return g}function Fi(){let t,e=100;const n=vi(Object.assign(function(r,a){const i=pi(r);let o;if("function"==typeof t){o=yi("gauge-face-window-");const n=i.append("mask").attr("id",o);n.append("circle").attr("r",e).style("fill","white");const r=n.append("g").attr("style","fill: black");t(r,a)}const s=i.append("circle").attr("r",e);n.stylable(s),o&&s.attr("mask",`url(#${o})`)},{r(t){return arguments.length?(e=t,n):e},window(e){return arguments.length?(t=e,n):t}})).class("g3-gauge-face");return n}function Vi(t,e,n,r){if(void 0!==t)return t.slice();let a;if("number"==typeof e&&r){const[t,i]=qi(r.measure().domain().slice().sort((t,e)=>t-e));a=[];for(let r=n??Math.ceil(t/e)*e;r<=i;r+=e)a.push(r);Ii(r.kind(),r.measure().range())&&a.includes(t)&&a.includes(i)&&a.pop()}else a=r?r.measure().ticks():[];return a}function Ui(t){const e=t?t.slice():null;let n=5,r=0;const a=vi(Object.assign(function(t,i){const[o,s]=e||qi(i.measure().domain()),l=pi(t).append("path").attr("d",i.sectorpath(o,s,n,r));a.stylable(l)},{size(t){return arguments.length?(n=t,a):n},inset(t){return arguments.length?(r=t,a):r}})).class("g3-axis-sector");return a}function Wi(t,e,n){const r=t??0,a=e??1,i=n??{},o=i.fmax??.01,s=i.damping??.9,l=i.wrap??!1;let u=Math.random(),c=0;return function(t){return"number"==typeof t&&isFinite(t)&&a>r&&(u=Math.min(1,Math.max(0,(t-r)/(a-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*(a-r)+r}}return $t`
/* 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;
}
`,t.axisLabels=function(t){const e="object"==typeof t&&null!==t&&!Array.isArray(t),n=["fixed","relative","upward","clockwise","counterclockwise"];let r,a,i="fixed",o=20,s=25,l=0,u=e?e=>t[e]:di;const c=e?Object.keys(t):t,h=vi(Object.assign(function(t,e){const n=Vi(c,r,a,e),f=i.endsWith("clockwise"),p=f?yi("axis-label-path-"):void 0,m=pi(t).append("g");h.stylable(m);const g=m.selectAll(null).data(n).enter().append("g");if(f){const t=e.r()-s,n="clockwise"==i?1:0;g.append("path").attr("id",(t,e)=>`${p}-${e}`).attr("d",`M 0,${t} A ${t},${t},0,1,${n},0,-${t} A ${t},${t},0,1,${n},0,${t}`).attr("style","visibility: hidden").attr("transform",t=>e.metrictransform(t))}const d=g.append("text").attr("font-size",o);f?d.append("textPath").attr("startOffset","50%").attr("href",(t,e)=>`#${p}-${e}`).text(u):d.attr("transform",t=>{let n=e.marktransform(t,s),r=l;if("circular"==e.kind())if("fixed"==i)n+=" "+e.metrictransform(t,!0);else if("upward"==i){const n=(e.measure()(Number(t)+r)%360+360)%360;90<n&&n<270&&(r+=180)}return r&&(n+=` rotate(${r})`),`${n}`}).text(u)},{step(t){return arguments.length?(r=t,h):r},start(t){return arguments.length?(a=t,h):a},orient(t){if(t&&!n.includes(t))throw`g3.axisLabels().orient() unknown orientation '${t}'`;return arguments.length?(i=t,h):i},size(t){return arguments.length?(o=t,h):o},inset(t){return arguments.length?(s=t,h):s},rotate(t){return arguments.length?(l=t,h):l},format(t){return arguments.length?(u=t,h):u}})).class("g3-axis-labels");return h},t.axisLine=function(){return Ui().size(0).class("g3-axis-line")},t.axisSector=Ui,t.axisTicks=function(t){let e,n,r="tick",a=10,i=1,o=0;const s=t&&t.slice(),l=vi(Object.assign(function(t,u){const c=Vi(s,e,n,u),h=pi(t).append("g");l.class("g3-axis-ticks-"+r).stylable(h);const f=h.selectAll(null).data(c).enter().append("g").attr("transform",t=>u.marktransform(t,o));switch(r){case"dot":f.append("circle").attr("r",a);break;case"wedge":f.append("path").attr("d",`M 0,${a} L ${i/2},0 L ${-i/2},0 z`);break;case"rect":f.append("rect").attr("width",i).attr("height",a).attr("x",-i/2);break;default:f.append("path").attr("d",hi()([[0,0],[0,a]]))}},{step(t){return arguments.length?(e=t,l):e},start(t){return arguments.length?(n=t,l):n},shape(t){return arguments.length?(r=t,l):r},size(t){return arguments.length?(a=t,l):a},width(t){return arguments.length?(i=t,l):i},inset(t){return arguments.length?(o=t,l):o}})).class("g3-axis-ticks");return l},t.categoricalSeries=function(t){const e=t.length,n=Wi(0,e,{wrap:!0});let r;return function(a){const i=void 0===a||a===r?-1:t.indexOf(a);return r=t[Math.min(Math.floor(n(i<0?void 0:i+.5)),e-1)],r}},t.convertUnits=Ei,t.d3sel=pi,t.datetimeSeries=function(){return function(){return new Date}},t.elapsedSecondsSeries=function(){const t=new Date;return function(){return((new Date).getTime()-t.getTime())/1e3}},t.element=mi,t.flatten=function t(e,n){const r=n||[],a=[];return Object.entries(e).forEach(([e,n])=>{const i=r.concat([e]);null!==n&&"object"==typeof n?a.push(...t(n,i)):a.push([i,n])}),a},t.forceSeries=Wi,t.gauge=Hi,t.gaugeController=Ti,t.gaugeFace=Fi,t.gaugeLabel=function(t,e){let n=t||"",r=0,a=0,i=0,o=0,s=10;const l=vi(Object.assign(function(t){const e=pi(t).append("text").attr("x",r).attr("y",a).attr("dx",i).attr("dy",o).attr("font-size",s).text(n);l.stylable(e)},{value(t){return arguments.length?(n=t,l):n},size(t){return arguments.length?(s=t,l):s},x(t){return arguments.length?(r=t,l):r},y(t){return arguments.length?(a=t,l):a},dx(t){return arguments.length?(i=t,l):i},dy(t){return arguments.length?(o=t,l):o}})).class("g3-gauge-label");if("object"==typeof e){const t=l;Object.entries(e).forEach(([e,n])=>{const r=t[e];if("function"!=typeof r)throw`label: unknown attribute ${e}`;r.call(l,n)})}return l},t.gaugeScrew=function(){let t=8,e="slotted";const n=vi(_i(Object.assign(function(r){const a=360*Math.random(),i=pi(r).append("g").attr("class","g3-gauge-screw");switch(n.transformable(i),n.stylable(i),i.append("circle").attr("r",t).attr("class","g3-gauge-screw-head"),i.append("circle").attr("r",t).attr("class","g3-highlight"),e){case"robertson":i.append("rect").attr("transform",`scale(${t}) rotate(${a})`).attr("x",-.4).attr("width",.8).attr("y",-.4).attr("height",.8);break;case"phillips":i.append("rect").attr("transform",`scale(${t}) rotate(${a+90})`).attr("x",-1).attr("width",2).attr("y",-.2).attr("height",.4);default:i.append("rect").attr("transform",`scale(${t}) rotate(${a})`).attr("x",-1).attr("width",2).attr("y",-.2).attr("height",.4)}},{r(e){return arguments.length?(t=e,n):t},shape(t){return arguments.length?(e=t,n):e}})));return n},t.grid=Ri,t.indicatePointer=function(){let e=di,n=[void 0,void 0],r="needle";const a=vi(wi(Object.assign(function(i,o){const s=pi(i).append("g").classed("will-change-transform",!0);if(a.stylable(s),a.append().length||a.append(Ki[r]),a.appendable(s,o),t.activeController&&o){const r="number"==typeof n[0]||"number"==typeof n[1],a=Ii(o.kind(),o.measure().range())&&!r,i=(t,r,i,l)=>{let u=e(t,i,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),!a&&"attrTween"in h?h.attrTween("transform",function(){return Jn(this.getAttribute("transform")||c,c)}):h.attr("transform",c)};t.activeController.register(i,o.metrics(),o.unit())}},{rescale(t){return arguments.length?(e=t,a):e},clamp(t){return arguments.length?(n=t?[t[0]??void 0,t[1]??void 0]:[void 0,void 0],a):n},shape(t){if(arguments.length&&!(t in Ki))throw`pointer: unknown shape ${t}`;return arguments.length?(r=t,a):r}}))).class("g3-indicate-pointer");return a},t.indicateSector=function(){let e=di,n=[void 0,void 0],r=0,a=10,i=0;const o=vi(Object.assign(function(s,l){const u=pi(s).append("path");if(o.stylable(u),t.activeController&&l){const o=(t,o,s,c)=>{let h=e(t,s,c);const f=e(r,s,c),p=t<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(p?h:f,p?f:h,a,i)),u.classed("g3-indicate-sector-negative",p)};t.activeController.register(o,l.metrics(),l.unit())}},{rescale(t){return arguments.length?(e=t,o):e},clamp(t){return arguments.length?(n=t?[t[0]??void 0,t[1]??void 0]:[void 0,void 0],o):n},anchor(t){return arguments.length?(r=t,o):r},size(t){return arguments.length?(a=t,o):a},inset(t){return arguments.length?(i=t,o):i}})).class("g3-indicate-sector");return o},t.indicateStyle=Bi,t.indicateText=function(){let e=di,n=20;const r=vi(Object.assign(function(a,i){let o=pi(a).append("text").attr("font-size",n);if(r.stylable(o),o=o.text(""),t.activeController&&i){const n=(t,n,r,a)=>{o.text(e(t,r,a))};t.activeController.register(n,i.metrics(),i.unit())}},{format(t){return arguments.length?(e=t,r):e},size(t){return arguments.length?(n=t,r):n}})).class("g3-indicate-text");return r},t.indicateUnit=function(){let e=di,n=20;const r=vi(Object.assign(function(a,i){let o=pi(a).append("text").attr("font-size",n);if(r.stylable(o),o=o.text(i?.unit()?e(i.unit()):""),t.activeController&&i){const n=(t,n,r,a)=>{o.text(e(a||"",t,r))};t.activeController.register(n,i.metrics(),i.unit())}},{format(t){return arguments.length?(e=t,r):e},size(t){return arguments.length?(n=t,r):n}})).class("g3-indicate-unit");return r},t.knownUnits=Oi,t.localHub=Pi,t.midnightSecondsSeries=function(){return function(){const t=new Date;return(t.getTime()-t.setHours(0,0,0,0))/1e3}},t.panel=function(){let t,e,n=1024,r=768,a=250,i=!1,o=!0;const s=vi(wi(_i(Object.assign(function(l){const u=pi(l),c=Ti(),h=o?t=>t.transition().duration(a||250).ease(Zr):t=>t,f=u.append("svg").attr("width",n).attr("height",r),p=f.append("defs");((t,e)=>[mi("radialGradient",{id:"highlightGradient",cx:"50%",cy:"50%",fx:"25%",fy:"40%",r:"50%"}).append(...["white","black"].map(t=>mi("stop",{"stop-color":t,offset:"white"==t?"0%":"100%"}))),...[1,2,3].map(n=>mi("filter",{id:"dropShadow"+n,filterUnits:"userSpaceOnUse",x:-t,width:2*t,y:-e,height:2*e}).append(mi("feDropShadow",{stdDeviation:n,dx:0,dy:0}))),...[1,2,3].map(t=>mi("filter",{id:"gaussianBlur"+t}).append(mi("feGaussianBlur",{in:"SourceGraphic",stdDeviation:t})))])(n,r).forEach(t=>t(p));const m=f.append("g");s.stylable(m),s.transformable(m),s.appendable(m),i&&Ri().width(n).height(r)(m);const g=c.indicators();if(console.log("Starting panel expecting metrics for:",g),!t){const t=Pi(c.fakes());return c.sink(e=>c(t.apply(e),h)),c(t.snapshot()),void setInterval(()=>c(t.tick(),h),a||250)}if(e){let t=Promise.resolve();c.sink(n=>{t=t.then(()=>fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({actions:n})})).then(t=>{t&&!1===t.ok&&console.log("g3: hub rejected actions",t.status,n)}).catch(t=>console.log("g3: failed to send actions",t,n))})}if(a){let e=0;setInterval(()=>{t.search=new URLSearchParams({latest:String(e),units:String(0==e),keys:g.join(",")}).toString(),fetch(t).then(t=>t.json()).then(t=>{c(t,h),e=t.latest??0}).catch(t=>{console.log("g3: failed to poll metrics",t),e=0})},a)}else{t.search=new URLSearchParams({keys:g.join(",")}).toString();new EventSource(t).onmessage=function(t){c(JSON.parse(t.data),h)}}},{width(t){return arguments.length?(n=t,s):n},height(t){return arguments.length?(r=t,s):r},grid(t){return arguments.length?(i=!!t,s):i},url(e){return arguments.length?(t=Li(e),s):t},inputUrl(t){return arguments.length?(e=Li(t),s):e},interval(t){return arguments.length?(a=t,s):a},smooth(t){return arguments.length?(o=t,s):o}})))).class("g3-panel");return s},t.pointers=Ki,t.put=gi,t.snapScale=function(){let t=1,e=0,n=5;const r=Object.assign(function(r){const a=Math.round((r-e)/t)*t+e,i=t/2;return a+La().domain([-i,i]).range([-i,i]).exponent(n)(r-a)},{start(t){return arguments.length?(e=t,r):e},step(e){return arguments.length?(t=e,r):t},strength(t){return arguments.length?(n=t,r):n}});return r},t.statusLight=function(){const t=Hi();let e=di,n="red";const r=Object.assign(function(r,a){Hi().metric(t.metric()).instance(t.instance()).fake(t.fake()).append(Bi().trigger(e).append(Fi().style(`fill: ${n}`),Fi().class("g3-highlight")))(r,a)},{metric(e){return arguments.length?(t.metric(e),r):t.metric()},instance(e){return arguments.length?(t.instance(e),r):t.instance()},fake(e){return arguments.length?(t.fake(e),r):t.fake()},trigger(t){return arguments.length?(e=t,r):e},color(t){return arguments.length?(n=t,r):n}});return r},Object.defineProperty(t,"__esModule",{value:!0}),t}({});