@plotdb/chart 3.13.0 → 3.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bundle.min.js CHANGED
@@ -1 +1 @@
1
- !function(){var b=function(u,l){var t,h,c;return"number"==typeof u&&null==l?new Promise(function(t){return setTimeout(t,u)}):("function"==typeof l&&(u=(t=[l,u])[0],l=t[1]),l=l||{},t="object"==typeof u?[u.func,u]:[u,{delay:"object"==typeof l?l.delay||750:l}],u=t[0],l=t[1],h={},(c=function(){for(var e,n,i,t,o=this,r=[],s=0,a=arguments.length;s<a;++s)r.push(arguments[s]);return e=r,n=!1,i=c.delay.value||l.delay||750,c.delay.value=0,(t=new Promise(function(r,t){if(!n)return h.h&&c.clear(),h.res=r,h.rej=t,h.h=setTimeout(function(){var t=u.apply(o,e);return t&&"function"==typeof t.then?t.then(function(){for(var t,e=[],n=0,i=arguments.length;n<i;++n)e.push(arguments[n]);return t=e,r.apply(null,t)}):r(t),h.res=null,h.rej=null,h.h=0,h},i)})).now=function(){return n=!0,c.clear(),u.apply(o,e)},t.cancel=function(){return c.clear()},t}).clear=function(){return clearTimeout(h.h),h.res&&h.res(null),h.h=0,h.res=null,h.rej=null,h},c.delay=function(t){return c.delay.value=t,c},c)},k={exports:{}},z=(!function(){var x,e,c,f,d,t,n,o,r,s,i,a,u,l,h,p,m,y,_,g;function v(t,e,f){function d(t,e){return n.call(t,e)}var p={}.toString,n={}.hasOwnProperty,m=!0;return function t(e,n,i){var r,o,s,a,u,l,h,c;if(null==e||null==n)return e===n;if(e.__placeholder__||n.__placeholder__)return!0;if(e===n)return 0!==e||1/e==1/n;r=p.call(e);if(p.call(n)!=r)return!1;switch(r){case"[object String]":return e==String(n);case"[object Number]":return e!=+e?n!=+n:0==e?1/e==1/n:e==+n;case"[object Date]":case"[object Boolean]":return+e==+n;case"[object RegExp]":return e.source==n.source&&e.global==n.global&&e.multiline==n.multiline&&e.ignoreCase==n.ignoreCase}if("object"!=typeof e||"object"!=typeof n)return!1;o=i.length;for(;o--;)if(i[o]==e)return!0;i.push(e);s=0;a=!0;if("[object Array]"==r){if(u=e.length,l=n.length,m){switch(f){case"===":a=u===l;break;case"<==":a=u<=l;break;case"<<=":a=u<l}s=u,m=!1}else a=u===l,s=u;if(a)for(;s--&&(a=s in e==s in n&&t(e[s],n[s],i)););}else{if("constructor"in e!="constructor"in n||e.constructor!=n.constructor)return!1;for(h in e)if(d(e,h)&&(s++,!(a=d(n,h)&&t(e[h],n[h],i))))break;if(a){for(h in c=0,n)d(n,h)&&++c;a=m?"<<="===f?s<c:"<=="===f?s<=c:s===c:(m=!1,s===c)}}i.pop();return a}(t,e,[])}function w(t,e){var n,i={}.hasOwnProperty;for(n in e)i.call(e,n)&&(t[n]=e[n]);return t}x="http://www.w3.org/2000/svg",e=new function(t){var n=new Intl.NumberFormat(t),t=n.formatToParts(12345.6),e=Array.from({length:10}).map(function(t,e){return n.format(e)}),i=new Map(e.map(function(t,e){return[t,e]}));return this._group=new RegExp("["+t.find(function(t){return v(t.type,"group","===")}).value+"]","g"),this._decimal=new RegExp("["+t.find(function(t){return v(t.type,"decimal","===")}).value+"]"),this._numeral=new RegExp("["+e.join("")+"]","g"),this._index=function(t){return i.get(t)},this}("en-US"),c=function(t){return(t=((t=null==t?"":t)+"").trim().replace(e._group,"").replace(e._decimal,".").replace(e._numeral,e._index))?+t:NaN},f=function(t){return"number"==typeof t?t:!t&&0!==t||isNaN(+t)?0:+t},d=function(t){return!(!/[RIT]/.exec((t=null==t?{}:t).type||"")||/[CN]/.exec(t.type||""))},t=function(e){var t,n,i,r,o,s=[];for(n in e=null==e?{}:e)s.push(n);for(t=s,i=0,o=(r=["name","order"]).length;i<o;++i)if(e[n=r[i]]&&!d(e[n]))return n;return t.filter(function(t){return!d(e[t])})[0]},n=function(){var u,l,h,a=this,c=(this.mod||{}).dimension||{};if(this._subset)return u=t(c),l=this._subset.map(function(e){var t,n,i,r,o={};for(t in n=c)i=n[t],(r=a.binding[t])&&(o[t]=i.multiple?(r.map?r:[r]).map(s):e[r.key],d(i))&&(o[t]=Array.isArray(o[t])?o[t].map(f):f(o[t]));return o;function s(t){return e[t.key]}}),h={},u&&l.map(function(t){return h[t[u]+""]=t}),this.data.map(function(t,e){var n,i,r,o=u?h[t[u]+""]:l[e],s={};for(n in i=c)r=i[n],d(r)&&(s[n]=r.multiple?(t[n]||[]).map(a):o?f(o[n]):0);return t.subset=s;function a(t,e){return o?f((o[n]||[])[e]):0}}),"shrink"===(((this.cfg||{}).common||{}).subset||{}).mode?this.data.map(function(t){var e,n,i,r=[];for(e in n=c)i=n[e],d(i)&&r.push(t[e]=t.subset[e]);return r}):void 0;this.data.map(function(t){var e=t.subset;return delete t.subset,e})},o=function(t){return!(!t||Array.isArray(t)||!Array.isArray(t.frames))},r=function(t){return"number"==typeof t||"string"==typeof t&&t.trim()&&!isNaN(+t)},s=function(t){return t instanceof Date||"string"==typeof t&&!isNaN(Date.parse(t))},i=function(t){var e,n,o,i;return e=((t=null==t?{}:t).frames||[]).map(function(t,e){return{id:null!=t.id?t.id:e,raw:t.raw||[]}}),t=t.frameOrder,Array.isArray(t)&&t.length?(n={},e.map(function(t){return n[t.id+""]=t}),(o=t.map(function(t){return n[t+""]}).filter(function(t){return t})).concat(e.filter(function(t){for(var e=t,n=o,i=-1,r=n.length>>>0;++i<r;)if(e===n[i])return!1;return!0}))):(t=e.map(function(t){return t.id})).length&&t.every(r)?e.map(function(t,e){return{f:t,i:e}}).sort(function(t,e){return+t.f.id-+e.f.id||t.i-e.i}).map(function(t){return t.f}):t.length&&t.every(s)?(i=function(t){return t instanceof Date?t.getTime():Date.parse(t)},e.map(function(t,e){return{f:t,i:e}}).sort(function(t,e){return i(t.f.id)-i(e.f.id)||t.i-e.i}).map(function(t){return t.f})):e},a=function(t){var e,n;if("string"!=typeof t)return null;if(t=t.trim(),e=/^#([0-9a-f]{3})$/i.exec(t)){for(var i,r=[],o=0,s=(i=e[1].split("")).length;o<s;++o)n=i[o],r.push(parseInt(n+n,16));return r}return(e=/^#([0-9a-f]{6})$/i.exec(t))?[0,1,2].map(function(t){return parseInt(e[1].substr(2*t,2),16)}):(e=/^rgba?\(([^)]+)\)$/i.exec(t))&&3===(t=e[1].split(",").slice(0,3).map(function(t){return parseFloat(t.trim())})).length&&t.every(function(t){return!isNaN(t)})?t:null},u=function(t,e,n){var i,r,o,s;for(r in null==n&&(n={}),i={},o=w(w({},e=null==e?{}:e),n||{}))s=o[r],i[r]="function"==typeof s?s.bind(t):s;return i},l=function(t,e,n){for(var i=t;t&&t!==n;)t=t.parentNode;if(t!==n)return null;if(!e)return t;for(t=i;t&&t!==n&&(!t.matches||(t.matches,!t.matches(e)));)t=t.parentNode;return t!==n||n.matches&&n.matches(e)?t:null},(h=function(){return this.running=!1,this.time={now:0,last:0},this.fps(60),this.evtHandler={},this}).prototype=w(Object.create(Object.prototype),{on:function(t,n){var i=this;return(Array.isArray(t)?t:[t]).map(function(t){var e;return((e=i.evtHandler)[t]||(e[t]=[])).push(n)})},fire:function(t){for(var e,n,i,r,o=[],s=[],a=1,u=arguments.length;a<u;++a)s.push(arguments[a]);for(e=s,a=0,i=(n=this.evtHandler[t]||[]).length;a<i;++a)r=n[a],o.push(r.apply(this,e));return o},reset:function(){return this.time={now:0}},setTime:function(t){return this.time.now=t},getTime:function(){return this.time.now},isRunning:function(){return this.running},toggle:function(t){return null!=t&&(this.running=!t),this.running?this.pause():this.run()},pause:function(){return this.running=!1},render:function(t){return this.fire("tick",this.time.now,t=null==t?0:t)},run:function(t){var e=this;if(null!=t&&this.fps(t),!this.running)return this.running=!0,requestAnimationFrame(function(t){return e.handler(e.time.last=t,!0)})},throttle:function(t){return this.isThrottled=t=null==t?!0:t},fps:function(t){return null==t?this._fps_val:(this._fps_val=.01<t?t:.01,this._fps_delay=1e3/this._fps_val)},handler:function(t,e){var n,i,r=this;if(null==e&&(e=!1),this.running)return this.external&&this.external()?(this.time.last=t,requestAnimationFrame(function(t){return r.handler(t,!1)})):(this.time.now=t,n=this.isThrottled?1e3<(n=this._fps_delay)?n:1e3:this._fps_delay,(e||(i=this.time.now-this.time.last)>=n)&&(this.time.last=t,this.render(e?0:i)),requestAnimationFrame(function(t){return r.handler(t,!1)}))}}),p={list:[],init:function(){var t,n,i=this;return this.inited=!0,t=null==document.hidden&&null==document.msHidden&&null!=document.webkiHidden?["webkitHidden","webkitvisibilitychange"]:["hidden","visibilitychange"],n=t[0],document.addEventListener(t[1],b(150,function(){var e=!!document[n];return i.list.map(function(t){return t.throttle(e)})}))},add:function(t){return this.inited||this.init(),this.list.push(t)}},m={wm:new WeakMap,ro:new ResizeObserver(function(t){return t.map(function(t){return m.wm.get(t.target)._resize()})}),add:function(t,e){return this.wm.set(t,e),this.ro.observe(t)},delete:function(t){return this.ro.unobserve(t),this.wm.delete(t)}},y=function(t,e,n){return null==e&&(e={}),null==n&&(n={}),function(t,e,n){var i,r;for(i in e)r=e[i],null==t[i]?t[i]=r:"object"!=typeof t[i]||"object"!=typeof r||n[i]&&n[i].type||y(t[i],e[i],n[i]);return t}(t=null==t?{}:t,e=JSON.parse(JSON.stringify(e)),n)},_=function(t){var r=function(t,e){var n,i;for(n in null==e&&(e={}),t.child,t)(i=t[n]).type?i.default&&(e[n]=i.default):r(i,e[n]||(e[n]={}));return e};return r(t)},(g=function(t){var e,n,i,r=this;for(e in this.root="string"==typeof(t=null==t?{}:t).root?document.querySelector(t.root):t.root,this.useSample=null==t.useSample||t.useSample,this.autoSelect=null==t.autoSelect||t.autoSelect,this.forceInit=t.forceInit||!1,this.prepareSvg=null==t.prepareSvg||t.prepareSvg,this.layoutOpt=null==t.layout||t.layout,this.delayRender=t.delayRender||!1,this.dataAccessor=null!=t.dataAccessor?t.dataAccessor:function(t){return t?t.data._raw:null},this.data=[],this.raw=t.raw||null,this.mod=t.mod||{},this.cfg=t.config||{},this.seed=t.seed||Math.random(),this.binding=t.binding||{},this._normalizeBinding(),this.evtHandler={},this._subset=t.subset||null,this._frames=null,this._player={playing:!1,pos:0,origin:0,raf:null},o(this.raw)&&(this._setFrames(this.raw),this.raw=(null!=(t=this._frames.list[this._frames.index])?t.raw:void 0)||[]),n=g.scopes){if(i=n[e],null!=this[e])throw new Error("[@plotdb/chart] scope name `"+e+"` is already taken.");this[e]=u(this,i,this.mod[e])}if(null!=this.local)throw new Error("[@plotdb/chart] scope name `local` is already taken.");return this.local=u(this,{},this.mod.local),(g.utils||(g.utils={})).anim&&null==this.anim&&(this.anim=new g.utils.anim),this.anim&&this.anim.on("step",function(){if(r._player.playing)return r._playerTick()}),this.init=proxise.once(function(){return r._init()}),this._resize=null,this._inited=!1,this.autoSelect&&(this.root.addEventListener("click",this._select=function(t){if(t=l(t.target,".data",r.root))return r.fire("select",[{data:r.dataAccessor(t),node:t}])}),this.root.addEventListener("mouseover",this._hover=function(t){if(t=l(t.target,".data",r.root))return r.fire("hover",[{data:r.dataAccessor(t),node:t}])})),this}).prototype=w(Object.create(Object.prototype),{_init:function(){var n,t,e,i=this;return"static"===window.getComputedStyle(this.root).position&&(this.root.style.position="relative"),n=this.layoutOpt?"object"!=typeof this.layoutOpt?this.root.querySelector(".pdl-layout"):"string"==typeof this.layoutOpt.root?this.root.querySelector(this.layoutOpt.root):this.layoutOpt.root||null:null,this.prepareSvg&&!(this.svg=this.root.querySelector("svg"))&&(this.svg=document.createElementNS(x,"svg"),(t=this.svg.style).width="100%",t.height="100%",!this.layoutOpt||(n||console.error("[@plotdb/chart] layout enabled yet layout root isn't configured properly. "),e=n.querySelector("[data-type=render]"))||console.warn("[@plotdb/chart] prepareSvg and layout is configured at the same time,\nyet render container for layout is not found. svg is thus appended in the root."),(e||this.root).appendChild(this.svg)),this._aniloop=new h,p.add(this._aniloop),this._aniloop.on("tick",function(t,e){return i.tick(t,e)}),this.anim&&(this._aniloop.external=function(){return i.anim.manual()},this.anim.on("step",function(t,e){if(i._aniloop.isRunning())return i._aniloop.setTime(t),i._aniloop.render(e)})),Promise.resolve().then(function(){var t;return i.mod.config=y(i.mod.config||{},g.commonConfig),i._defcfg=t=_(i.mod.config),y(i.cfg,t),i.raw&&Array.isArray(i.raw)?{raw:i.raw,binding:i.binding}:i.useSample&&i.mod.sample?(t=i.mod.sample.apply(i)).then?t.then():Promise.resolve(t):void 0}).then(function(t){return i.raw=(t=t||{}).raw,i.binding=t.binding,i}).then(function(){var t,e;return i.raw||(i.raw=[]),i.layoutOpt&&("undefined"==typeof layout||null===layout?console.warn("[@plotdb/chart] layout-opt is set yet @plotdb/layout is not found."):(n||(console.error("[@plotdb/chart] cannot determine root node for @plotdb/layout."),console.error("[@plotdb/chart] config layout properly or disable layout by setting layout to false")),i.layout=new layout("object"==typeof i.layoutOpt?((e=w({},i.layoutOpt)).watchResize=!1,e):{root:n,watchResize:!1}))),t=proxise(function(){return m.add(i.root,i),null}),i._resize=function(){return t.resolve()},e=t(),(i.forceInit||!i.root.offsetParent||"none"===window.getComputedStyle(i.root).display||i.root.offsetWidth&&i.root.offsetHeight)&&t.resolve(),e}).then(function(){return i._resize=function(){}}).then(function(){var t,e=function(){if(i.mod.init)return i.mod.init.apply(i)};return(i.layout?(t=proxise(function(){return Promise.resolve(i.layout.init(e)),null}),i._layout=function(){return t.resolve()},i.layout.on("render",function(){return i._layout()}),t):e)()}).then(function(){i._layout=function(){},Promise.resolve().then(function(){if(i.delayRender&&!i._pendingRaw)return i.renderLock=proxise(function(){}),i.renderLock()}).then(function(){if(i._inited=!0,i._resize=function(){i.anim&&i.anim.immediate(!0);try{return i.resize(),i.render()}finally{i.anim&&i.anim.immediate(!1)}},i._layout=function(){return i.parse(),i.bind(),i.resize(),i.render()},i.parse(),i.bind(),i.resize(),i.render(),i._frames)return i._framesStart()})})},parse:function(){if(this.data=this._parseRows(this.raw),this._frames&&(this._frames.all=null),n.apply(this),this.mod.parse)return this.mod.parse.apply(this)},_parseRows:function(t){var l,e,h;return null==t&&(t=[]),l=(e=this.mod).dimension||(e.dimension={}),h=this.binding,t.map(function(e,t){var n,i,r,o,s={};for(n in i=l)r=i[n],(o=h[n])?(s[n]=r.multiple?(o.map?o:[o]).map(a):e[o.key],/[RIT]/.exec(r.type)&&!/[CN]/.exec(r.type)&&(s[n]=Array.isArray(s[n])?s[n].map(u):c(s[n]))):r.multiple&&(s[n]=[]);return s._raw=e,s._idx=t,s;function a(t){return e[t.key]}function u(t){return c(t)}})},bind:function(){if(this.mod.bind)return this.mod.bind.apply(this)},start:function(){if(this._aniloop.run(),this.mod.start)return this.mod.start.apply(this)},stop:function(){if(this._aniloop.pause(),this.mod.stop)return this.mod.stop.apply(this)},resize:function(){if(this._inited)return this.layout&&this.layout.update(!1),this.box=this.root.getBoundingClientRect(),this.mod.resize?this.mod.resize.apply(this):void 0},tick:function(t,e){if(this.mod.tick)return this.mod.tick.apply(this,[t,e])},render:function(){if(this._inited)return this._syncAnim(),this.mod.render&&this.mod.render.apply(this),this._brushStyle(),this._empty(),this._anno()},_emptyText:function(){var t,e,n=((this.cfg||{}).common||{}).empty||{};return n.text||(n=g.i18nNs+":text",(t="undefined"!=typeof block&&null!==block&&block.i18n&&block.i18n.module?block.i18n.module:null)&&t.t&&(e=t.t(n))&&e!==n&&"text"!==e?e:(n=(t?t.language||t.lng:null)||("undefined"!=typeof document&&null!==document?document.documentElement.lang:"")||"en",(g.i18n[n]||g.i18n[n.split("-")[0]]||(/^zh/i.exec(n)?g.i18n[/cn|hans|sg/i.exec(n)?"zh-CN":"zh-TW"]:void 0)||g.i18n.en).text))},_empty:function(){var t,e=((this.cfg||{}).common||{}).empty||{},n=!(null!=e.enabled&&!e.enabled||(this.data||[]).length);if(this.svg){if(n)return this._emptyG||(this._emptyG=document.createElementNS(x,"g"),this._emptyG.setAttribute("data-type","empty"),this._emptyG.style.pointerEvents="none"),this.svg.appendChild(this._emptyG),this._emptyG.textContent="",n=this._annoBox(),(t=document.createElementNS(x,"text")).setAttribute("x",n.x+n.width/2),t.setAttribute("y",n.y+n.height/2),t.setAttribute("text-anchor","middle"),t.setAttribute("dominant-baseline","middle"),t.style.fill=e.color||"currentColor",t.style.opacity=null!=e.opacity?e.opacity:.45,(e.font||{}).size&&(t.style.fontSize=e.font.size+""),t.textContent=this._emptyText(),this._emptyG.appendChild(t);this._emptyG&&this._emptyG.parentNode&&this._emptyG.parentNode.removeChild(this._emptyG)}},_brushStyle:function(){var t,e,n,i,r,o=[],s=((this.cfg||{}).common||{}).brush||{};if(this.svg){for(t=function(t,e,n){if(null!=n&&""!==n)return t.setAttribute(e,n)},e=0,i=(n=this.svg.querySelectorAll("rect.selection")).length;e<i;++e)t(r=n[e],"fill",s.fill),t(r,"fill-opacity",s.fillOpacity),t(r,"stroke",s.stroke),t(r,"stroke-opacity",s.strokeOpacity),t(r,"stroke-width",s.strokeWidth);for(e=0,i=(n=this.svg.querySelectorAll("rect.handle")).length;e<i;++e)t(r=n[e],"fill",s.handleFill),o.push(t(r,"fill-opacity",s.handleOpacity));return o}},_annoBox:function(){var t;if(this.layout)try{if((t=this.layout.getBox("view"))&&t.width&&t.height)return t}catch(t){}return{x:0,y:0,width:(this.box||{}).width||0,height:(this.box||{}).height||0}},_anno:function(){var t,s,e,n,i,r,o,a,u,l,h,c,f,d,p=this,m=[],y=((this.cfg||{}).common||{}).annotation||{},_=null==y.enabled||!!y.enabled,g=_&&y.notes||[],v=_&&y.reference||[];if(this.svg){if(g.length||v.length){for(this._annoG||(this._annoG=document.createElementNS(x,"g"),this._annoG.setAttribute("data-type","annotation"),this._annoG.style.pointerEvents="none"),this.svg.appendChild(this._annoG),this._annoG.textContent="",t=this._annoBox(),s=y.font||{},e=function(t,e,n,i,r){var o=document.createElementNS(x,"text");return o.setAttribute("x",e),o.setAttribute("y",n),o.setAttribute("text-anchor",i),o.setAttribute("dominant-baseline",r),o.style.fill=t.color||y.color||"currentColor",(t.size||s.size)&&(o.style.fontSize=(t.size||s.size)+""),o.style.opacity=null!=t.opacity?t.opacity:null!=y.opacity?y.opacity:1,o.textContent=t.text+"",p._annoG.appendChild(o),o},n=0,i=g.length;n<i;++n)(r=g[n])&&null!=r.text&&e(r,t.x+t.width*(null!=r.x?r.x:.5),t.y+t.height*(null!=r.y?r.y:.5),r.align||"middle",r.baseline||"middle");for(n=0,i=v.length;n<i;++n)(o=v[n])&&(a="x"===o.axis?"x":"y",null==(u=b.call(this))||isNaN(u)||u<0||u>("y"===a?t.height:t.width)||(l=document.createElementNS(x,"line"),c=(h="y"===a?[t.x,t.y+u,t.x+t.width,t.y+u]:[t.x+u,t.y,t.x+u,t.y+t.height])[1],f=h[2],d=h[3],l.setAttribute("x1",h[0]),l.setAttribute("y1",c),l.setAttribute("x2",f),l.setAttribute("y2",d),w(l.style,{stroke:o.color||y.color||"currentColor",strokeWidth:null!=o.width?o.width:1,strokeDasharray:null!=o.dash?o.dash:"4 3",opacity:null!=o.opacity?o.opacity:null!=y.opacity?y.opacity:.6}),this._annoG.appendChild(l),null!=o.label&&(h="y"===a?[t.x+t.width-2,t.y+u-3,"end","auto"]:[t.x+u+3,t.y+2,"start","hanging"],m.push(e({text:o.label,color:o.color,size:o.size,opacity:o.opacity},h[0],h[1],h[2],h[3])))));return m}this._annoG&&this._annoG.parentNode&&this._annoG.parentNode.removeChild(this._annoG)}function b(){try{return this.space[a](o.value)}catch(t){return null}}},destroy:function(){var t=this;return Promise.resolve().then(function(){if(t._select&&t.root.removeEventListener("click",t._select),t._hover&&t.root.removeEventListener("mouseover",t._hover),m.delete(t.root),t.layout&&t.layout.destroy(),t.pause(),t.stop(),t.mod.destroy)return t.mod.destroy.apply(t)})},config:function(){var t,e,n;if(!arguments.length)return this.cfg;for(t={},e=0,n=arguments.length;e<n;++e)y(t,arguments[e],this.mod.config);return y(t,this.cfg,this.mod.config),y(t,this._defcfg,this.mod.config),w(this.cfg,t)},_normalizeBinding:function(t){var e,n,i,r,o,s,a,u=[];if(null==t){for(t in e=[],this.mod.dimension||{})e.push(t);t=e}for(n=0,i=(t=Array.isArray(t)?t:[t]).length;n<i;++n)r=t[n],o=(this.mod.dimension||{})[r]||{},s=this.binding[r],a=Array.isArray(s),!o.multiple!=!a&&(o.multiple||a)&&u.push(this.binding[r]=a?s[0]:s?[s]:[]);return u},setBind:function(t,e){if(this.binding[t]=e,this._normalizeBinding([t]),this._inited)return this.parse(),this.bind(),this.resize(),this.render()},setRaw:function(t,e,n){var i;return null==n&&(n=!1),!t||Array.isArray(t)||o(t)||("subset"in t&&(this._subset=t.subset||null),t=(i=t).raw,e=i.binding,n=i.reinit),o(t)?(this._setFrames(t),t=(null!=(i=this._frames.list[this._frames.index])?i.raw:void 0)||[]):null!=t&&this._frames&&(this.pause(),this._frames=null,this._player.pos=0,this.anim)&&this.anim.resume(),null!=t&&(this.raw=t),null!=e&&(this.binding=e,this._normalizeBinding()),this.renderLock?(this.renderLock.resolve(),this.renderLock=null):this._inited?(n&&this.mod.init&&this.mod.init.apply(this),this.parse(),this.bind(),this.resize(),this.render(),this._frames?this._framesStart():void 0):this._pendingRaw=!0},_animCfg:function(){return((this.cfg||{}).common||{}).animation||{}},_syncAnim:function(){var t;if(this.anim)return null!=(t=this._animCfg()).transition&&this.anim.duration(t.transition),this.anim.speed(null!=t.speed?t.speed:1)},_setFrames:function(t){var e,t=i(t);return this._frames={list:t,index:0,all:null},this._frames.index=this._frameAt((t=this._player.pos)<(e=this.duration())?t:e)},_interval:function(){return+this._animCfg().interval||1e3},_clock:function(){return this.anim?this.anim.time():("undefined"!=typeof performance&&null!==performance?performance:Date).now()},_frameAt:function(t){var e=this._frames?this._frames.list.length:0;return e?(t=0<(t=Math.floor(t/this._interval()))?t:0)<(e=e-1)?t:e:0},_framesStart:function(){if(this.fire("frame",{index:this._frames.index,id:this.frame.id()}),this._animCfg().autoplay&&!this._player.playing)return this.play()},_goto:function(t,e){var n,i,r,o=this;if(null==e&&(e=0),(n=this._frames)&&n.list.length&&(t=(i=0<t?t:0)<(r=n.list.length-1)?i:r,n.index=t,this.raw=n.list[t].raw,this._inited))return this.parse(),this.bind(),this.resize(),this.anim&&0<e?this.anim.ago(e,function(){return o.render()}):this.render(),this.fire("frame",{index:t,id:n.list[t].id})},duration:function(){return this._frames?this._frames.list.length*this._interval():0},position:function(){var t=this._player;return t.playing?this._clock()-t.origin:t.pos},playing:function(){return this._player.playing},play:function(){var t=this._player;if(this._frames&&!t.playing&&this._frames.list.length)return t.pos>=this.duration()&&(t.pos=0),this._syncAnim(),this.anim&&this.anim.resume(),t.origin=this._clock()-t.pos,t.playing=!0,this.fire("play"),this._playerLoop()},pause:function(){var t=this._player;if(t.playing)return t.pos=this.position(),t.playing=!1,t.raf&&cancelAnimationFrame(t.raf),t.raf=null,this.anim&&this.anim.pause(),this.fire("pause")},seek:function(t){var e,n,i,r;if(this._frames&&this._frames.list.length)return r=this._interval(),n=(t=(i=0<(i=+(t=t&&"object"==typeof t?((t.frame||0)+(t.progress||0))*r:t)||0)?i:0)<(e=this.duration())?i:e)-(e=this._frameAt(t))*r,i=(i=+this._animCfg().transition||0)<r?i:r,0<e&&n<i?(this._goto(e-1),this.anim&&this.anim.flush(),this._goto(e,n)):(this._goto(e),this.anim&&this.anim.flush()),(r=this._player).pos=t,r.playing&&(r.origin=this._clock()-t),this.fire("progress",{time:t,duration:this.duration(),index:e})},_playerLoop:function(){var t,e=this,n=this._player;if(!n.raf&&"undefined"!=typeof requestAnimationFrame&&null!==requestAnimationFrame)return n.raf=requestAnimationFrame(t=function(){if(n.raf=null,n.playing)return e.anim&&e.anim.manual()||e._playerTick(),n.playing?n.raf=requestAnimationFrame(t):void 0})},_playerTick:function(){var t,e,n=this._player,i=this._frames;if(i&&i.list.length){if((t=this.duration())<=(e=this.position())){if(!this._animCfg().loop)return n.pos=t,n.playing=!1,this.fire("progress",{time:t,duration:t,index:i.index}),void this.fire("end");e%=t,n.origin=this._clock()-e}return(n=this._frameAt(e))!==i.index&&this._goto(n,e-n*this._interval()),this.fire("progress",{time:e,duration:t,index:n})}},on:function(t,n){var i=this;return(Array.isArray(t)?t:[t]).map(function(t){var e;return((e=i.evtHandler)[t]||(e[t]=[])).push(n)})},fire:function(t){for(var e,n,i,r,o=[],s=[],a=1,u=arguments.length;a<u;++a)s.push(arguments[a]);for(e=s,a=0,i=(n=this.evtHandler[t]||[]).length;a<i;++a)r=n[a],o.push(r.apply(this,e));return o},filter:function(t,e){var n,i,r,o,s;for(i in null==t&&(t={}),null==e&&(e=!1),n=[],r=this.binding)o=r[i],s=(s=Array.isArray(o)?o:[o]).map(a),n=n.concat(s);for(i in t)o=t[i],n.filter(u).map(l);return e&&this.fire("filter",t),this.mod.filter&&this.mod.filter.apply(this,[t,e]),this.parse(),this.bind(),this.resize(),this.render();function a(t){return{k:i,v:t}}function u(t){return t.k===i}function l(t){return t.v.filter=o}},sample:function(){return this.mod.sample?this.mod.sample.apply(this):{raw:[],binding:{}}},filterDims:function(){var t;return(t=(this.mod||{}).filterDims)?t.call(this):(this.mod||{}).filter?["name"]:[]},canFilter:function(){return!!this.filterDims().length}}),g.commonConfig={common:{animation:{transition:{type:"number",default:350,min:0,max:5e3,step:10},interval:{type:"number",default:1e3,min:100,max:2e4,step:50},speed:{type:"number",default:1,min:.1,max:10,step:.1},loop:{type:"boolean",default:!0},autoplay:{type:"boolean",default:!0}},subset:{mode:{type:"choice",values:["dim","partial","shrink"],default:"dim"},opacity:{type:"number",default:.2,min:0,max:1,step:.05},fade:{type:"number",default:.72,min:0,max:1,step:.01},background:{type:"color",default:"transparent"}},empty:{enabled:{type:"boolean",default:!0},text:{type:"text",default:""},color:{type:"color",default:"currentColor"},opacity:{type:"number",default:.45,min:0,max:1,step:.05},font:{size:{type:"quantity",default:"",units:[{name:"em",max:10,step:.01,default:1}]}}},brush:{fill:{type:"color",default:""},fillOpacity:{type:"number",default:"",min:0,max:1,step:.05},stroke:{type:"color",default:""},strokeOpacity:{type:"number",default:"",min:0,max:1,step:.05},strokeWidth:{type:"number",default:"",min:0,max:20,step:.5},handleFill:{type:"color",default:""},handleOpacity:{type:"number",default:"",min:0,max:1,step:.05}},annotation:{enabled:{type:"boolean",default:!0},color:{type:"color",default:"currentColor"},opacity:{type:"number",default:1,min:0,max:1,step:.05},font:{size:{type:"quantity",default:".8em",units:[{name:"em",max:10,step:.01,default:.8}]}}}}},g.i18nNs="@plotdb/chart",g.i18n={en:{text:"No data to show"},"zh-TW":{text:"沒有可顯示的資料"},"zh-CN":{text:"没有可显示的数据"},ja:{text:"表示するデータがありません"}},g.scopes={space:{x:function(t){return null},y:function(t){return null}},frame:{active:function(){return!!this._frames},count:function(){return this._frames?this._frames.list.length:0},index:function(){return this._frames?this._frames.index:-1},id:function(t){return this._frames?(this._frames.list[null!=t?t:this._frames.index]||{}).id:null},ids:function(){return this._frames?this._frames.list.map(function(t){return t.id}):[]},all:function(){var t,e;return this._frames?null!=(e=(t=this._frames).all)?e:t.all=this._parseRows([].concat.apply([],this._frames.list.map(function(t){return t.raw}))):this._parseRows(this.raw)}},subset:{set:function(t){if(this._subset=t||null,this._inited)return this.parse(),this.bind(),this.resize(),this.render()},mode:function(){return(((this.cfg||{}).common||{}).subset||{}).mode||"dim"},ratio:function(t,e,n){return t&&t.subset?!(t=(n=null!=n?[(t[e]||[])[n],(t.subset[e]||[])[n]]:[t[e],t.subset[e]])[0])||(e=n[1]/t)<0?0:1<e?1:e:null},color:function(t,e){var n,i,r,o;return(i=a(t))?(n=.3*i[0]+.59*i[1]+.11*i[2],i=((this.cfg||{}).common||{}).subset||{},r=null!=(r=null!=e?e:i.fade)?r:.72,o=a(i.background)||a((this.cfg||{}).background)||[255,255,255],"rgb("+[0,1,2].map(function(t){return Math.round(n+(o[t]-n)*r)}).join(",")+")"):t}}},g.dataframe={is:o,split:function(t,n){var i={},r=[];return(t=null==t?[]:t).map(function(t){var e=t[n]+"";return i[e]||r.push(i[e]={id:t[n],raw:[]}),i[e].raw.push(t)}),{frames:r}}},null!=k?k.exports=g:"undefined"!=typeof window&&null!==window&&(window.chart=g)}.call(this),k.exports);!function(){var A={re:/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i,prefixes:["y","z","a","f","p","n","µ","m"].concat([""],["k","M","G","T","P","E","Z","Y"]),locale:{decimal:".",thousands:",",grouping:[3],currency:["$",""],minus:"−",percent:"%",nan:"NaN"},parts:function(t,e){var n;return!isFinite(t)||0===t||(e=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0?null:[1<(n=t.slice(0,e)).length?n[0]+n.slice(2):n,+t.slice(e+1)]},rounded:function(t,e){var n;return(e=A.parts(t,e))?(n=e[0],(e=e[1])<0?"0."+new Array(-e).join("0")+n:n.length>e+1?n.slice(0,e+1)+"."+n.slice(e+1):n+new Array(e-n.length+2).join("0")):t+""},prefixAuto:function(t,e){var n,i,r;return(i=A.parts(t,e))?(n=i[0],i=i[1],A._pe=3*Math.max(-8,Math.min(8,Math.floor(i/3))),(i=i-A._pe+1)===(r=n.length)?n:r<i?n+new Array(i-r+1).join("0"):0<i?n.slice(0,i)+"."+n.slice(i):"0."+new Array(1-i).join("0")+A.parts(t,Math.max(0,e+i-1))[0]):(A._pe=void 0,t.toPrecision(e))},decimal:function(t){return 1e21<=Math.abs(t=Math.round(t))?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},types:{"%":function(t,e){return(100*t).toFixed(e)},b:function(t){return Math.round(t).toString(2)},c:function(t){return t+""},d:function(t){return A.decimal(t)},e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},g:function(t,e){return t.toPrecision(e)},o:function(t){return Math.round(t).toString(8)},p:function(t,e){return A.rounded(100*t,e)},r:function(t,e){return A.rounded(t,e)},s:function(t,e){return A.prefixAuto(t,e)},X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}},trim:function(t){for(var e,n,i=[-1,-1],r=i[0],o=i[1],s=1,a=t.length;s<a;++s)if("."===(n=t[e=s]))r=o=e;else if("0"===n)0===r&&(r=e),o=e;else{if(!+n)break;0<r&&(r=0)}return 0<r?t.slice(0,r)+t.slice(o+1):t},group:function(t,e){for(var n=A.locale,i=n.grouping,r=n.thousands,o=(n=[t.length,[],0,i[0],0])[0],s=n[1],a=n[2],u=n[3],l=n[4];0<o&&0<u&&(e<l+u+1&&(u=Math.max(1,e-l)),s.push(t.substring(o-=u,o+u)),!((l+=u+1)>e));)u=i[a=(a+1)%i.length];return s.reverse().join(r)},format:function(t){var e,h,c,f,d,n,p,m,y,_,g,v,i,b,x,w,k;if(e=A.re.exec(t))return h=A.locale,c=null!=e[1]?e[1]:" ",f=e[2]||">",d=e[3]||"-",n=e[4]||"",p=!!e[5],m=null!=e[6]?+e[6]:void 0,y=!!e[7],_=e[8]?+e[8].slice(1):void 0,g=!!e[9],"n"===(v=e[10]||"")?(y=(i=[!0,"g"])[0],v=i[1]):A.types[v]||(null==_&&(_=12),g=(i=[!0,"g"])[0],v=i[1]),(p||"0"===c&&"="===f)&&(p=(i=[!0,"0","="])[0],c=i[1],f=i[2]),b="$"===n?h.currency[0]:"#"===n&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",x="$"===n?h.currency[1]:/[%p]/.test(v)?h.percent:"",w=A.types[v],k=/[defgprs%]/.test(v),_=null==_?6:/[gprs]/.test(v)?Math.max(1,Math.min(21,_)):Math.max(0,Math.min(20,_)),function(t){var e,n,i,r,o,s,a=[b,x],u=a[0],l=a[1];if("c"===v)l=w(t)+l,t="";else if(a=(t=+t)<0||1/t<0,t=isNaN(t)?h.nan:w(Math.abs(t),_),g&&(t=A.trim(t)),u=((a=a&&0==+t&&"+"!==d?!1:a)?"("===d?d:h.minus:"-"===d||"("===d?"":d)+u,l=("s"!==v||isNaN(t)||null==A._pe?"":A.prefixes[8+A._pe/3])+l+(a&&"("===d?")":""),k)for(e=0,n=t.length;e<n;++e)if(i=e,(r=t.charCodeAt(i))<48||57<r){l=(46===r?h.decimal+t.slice(i+1):t.slice(i))+l,t=t.slice(0,i);break}switch(y&&!p&&(t=A.group(t,1/0)),o=(a=u.length+t.length+l.length)<m?new Array(m-a+1).join(c):"",y&&p&&(t=A.group(o+t,o.length?m-l.length:1/0),o=""),f){case"<":return u+t+l+o;case"=":return u+o+t+l;case"^":return s=o.length>>1,o.slice(0,s)+u+t+l+o.slice(s);default:return o+u+t+l}};throw new Error("invalid format: "+t)}},e={d3:function(t){return("undefined"!=typeof d3&&null!==d3&&d3.format?d3:A).format(t)},from:function(t){try{return e.d3(t)}catch(t){return function(t){return t}}},auto:function(t){return null==t&&(t=[]),e.d3(".3s")},simple:function(t){return isNaN(t=+t)?t:1e9<=t?(t/1e9).toFixed(0)+"G":1e6<=t?(t/1e6).toFixed(0)+"M":1e3<=t?(t/1e3).toFixed(0)+"K":Math.floor(t)===t?t.toFixed(0):t.toFixed(2)}};e._d3f=A,null!=z&&((z.utils||(z.utils={})).format=e)}.call(this),function(){var u=Math.sqrt(50),l=Math.sqrt(10),h=Math.sqrt(2),f=function(t,e,n){var i,r,o,s=(e-t)/Math.max(0,n),a=Math.floor(Math.log10(s)),s=s/Math.pow(10,a),s=u<=s?10:l<=s?5:h<=s?2:1;return a<0?(i=Math.pow(10,-a)/s,(r=Math.round(t*i))/i<t&&r++,e<(o=Math.round(e*i))/i&&o--,i=-i):(i=Math.pow(10,a)*s,(r=Math.round(t/i))*i<t&&r++,e<(o=Math.round(e/i))*i&&o--),o<r&&.5<=n&&n<2?f(t,e,2*n):[r,o,i]},c=function(t,e,n){var i,r,o,s,a,u,l,h=[],c=[+t,+e,+n];if(!(0<(n=c[2])))return[];if((t=c[0])===(e=c[1]))return[t];if(r=(c=(i=e<t)?f(e,t,n):f(t,e,n))[0],s=c[2],!(r<=(o=c[1])))return[];for(a=o-r+1,u=0;u<a;++u)l=i?o-u:r+u,h.push(s<0?l/-s:l*s);return h},d=function(t){return t},p=function(e,n){var t=[+e,+n];return e=t[0],n=t[1],function(t){return e*(1-t)+n*t}},m=function(t,e){return"number"==typeof e?p(t,e):null!=z&&z.utils&&z.utils.anim?z.utils.anim.interpolate(t,e):function(){return e}},y=function(e,n){return(n-=e=+e)?function(t){return(t-e)/n}:isNaN(n)?function(){return NaN}:function(){return.5}},_=function(t,e,n,i){for(var r;n<i;)e<t[r=n+i>>>1]?i=r:n=1+r;return n},g=function(n,t,e){var i,r,o,s,a,u,l,h,c,f,d,p=Math.min(n.length,t.length)-1;if(p<=1)return s=(i=[n[0],n[1],t[0],t[1]])[2],a=i[3],i=(o=i[1])<(r=i[0])?[y(o,r),e(a,s)]:[y(r,o),e(s,a)],u=i[0],l=i[1],function(t){return l(u(t))};for(n[p]<n[0]&&(n=n.slice().reverse(),t=t.slice().reverse()),c=[],f=0;f<p;++f)l=f,c.push(y(n[l],n[l+1]));for(h=c,c=[],f=0;f<p;++f)l=f,c.push(e(t[l],t[l+1]));return d=c,function(t){var e=_(n,t,1,p)-1;return d[e](h[e](t))}},v=function(n,i){var t,r,o,s,e,a,u,l,h;return null==n&&(n=d),null==i&&(i=d),r=(t=[[0,1],[0,1],!1])[0],o=t[1],s=t[2],e=(t=[null,null])[0],a=t[1],u=function(t){var e,n,i;return s?((i=(e=[r[0],r[Math.min(r.length,o.length)-1]])[1])<(n=e[0])&&(n=(e=[i,n])[0],i=e[1]),Math.max(n,Math.min(i,t))):t},l=function(){return a=e=null,h},(h=function(t){if(null!=t&&!isNaN(t=+t))return(e=e||g(r.map(n),o,m))(n(u(t)))}).invert=function(t){return a=a||g(o,r.map(n),p),u(i(a(t)))},h.domain=function(t){return arguments.length?(r=Array.from(t,function(t){return+t}),l()):r.slice()},h.range=function(t){return arguments.length?(o=Array.from(t),l()):o.slice()},h.clamp=function(t){return arguments.length?(s=!!t,l()):s},h.ticks=function(t){return c(r[0],r[r.length-1],t=null==t?10:t)},h._transform=function(t,e){return n=t,i=e,l()},h._copy=function(t){return t.domain(r).range(o).clamp(s)},h.copy=function(){return h._copy(v(n,i))},h},i=function(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}},r=function(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)},o=function(t){return t<0?-t*t:t*t},s=function(){var t=v(),e=1,n=function(){return 1===e?t._transform(d,d):.5===e?t._transform(r,o):t._transform(i(e),i(1/e))};return t.exponent=function(t){return arguments.length?(e=+t,n()):e},t.copy=function(){return t._copy(s().exponent(e))},t},a=function(){var t=v(),e=1,n=function(){return t._transform(function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))},function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e})};return t.constant=function(t){return arguments.length?(e=+t,n()):e},t.copy=function(){return t._copy(a().constant(e))},n()},e=function(){var u,t=[[],new Map,[0,1],0,0,.5],l=t[0],o=t[1],h=t[2],c=t[3],f=t[4],d=t[5],p=(t=[0,0,[]])[0],m=t[1],y=t[2],s=function(){var t,e,n,i=l.length,r=h[0],o=h[1],s=o<r,r=s?[o,r]:[r,o],a=r[0],o=r[1];for(a+=(o-a-(p=(o-a)/Math.max(1,i-c+2*f))*(i-c))*d,m=p*(1-c),t=[],e=0;e<i;++e)n=e,t.push(a+p*n);return y=t,s&&y.reverse(),u};return(u=function(t){if(o.has(t))return y[o.get(t)]}).domain=function(t){var e,n,i,r;if(!arguments.length)return l.slice();for(e=[[],new Map],l=e[0],o=e[1],n=0,i=t.length;n<i;++n)r=t[n],o.has(r)||o.set(r,l.push(r)-1);return s()},u.range=function(t){return arguments.length?(h=Array.from(t,function(t){return+t}),s()):h.slice()},u.bandwidth=function(){return m},u.step=function(){return p},u.paddingInner=function(t){return arguments.length?(c=Math.min(1,t),s()):c},u.paddingOuter=function(t){return arguments.length?(f=t,s()):f},u.padding=function(t){return arguments.length?(c=Math.min(1,f=t),s()):c},u.align=function(t){return arguments.length?(d=Math.max(0,Math.min(1,t)),s()):d},u.copy=function(){return e().domain(l).range(h).paddingInner(c).paddingOuter(f).align(d)},s()},n=function(t){var e=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,delete t.paddingOuter,t.copy=function(){return n(e())},t},t={linear:function(){return v()},pow:s,sqrt:function(){return s().exponent(.5)},symlog:a,band:e,point:function(){return n(e().paddingInner(1))},ticks:c};null!=z&&((z.utils||(z.utils={})).scale=t)}.call(this),function(){var L,P,e,i,r,n,o,s,t,a,b,u,F=Math.abs,B=Math.atan2,G=Math.cos,I=Math.sin,H=Math.sqrt,W=Math.min,p=Math.max,D=Math.PI,$=D/2,J=2*D,U=1e-12,c=J-1e-6,V=function(t){return 1<t?0:t<-1?D:Math.acos(t)},X=function(t){return 1<=t?$:t<=-1?-$:Math.asin(t)},x=function(t){return function(){return t}},w=function(t){return"function"==typeof t?t:x(+t)},Z=function(t){return this._x0=this._y0=this._x1=this._y1=null,this._="",this._k=null!=t&&Math.floor(t)<=15?Math.pow(10,Math.floor(t)):null,this};Z.prototype={_a:function(t){for(var e,n,i=[],r=1,o=arguments.length;r<o;++r)i.push(arguments[r]);return e=i,n=this._k,this._+=t+(null!=n?e.map(function(t){return Math.round(t*n)/n}):e).join(",")},moveTo:function(t,e){return this._x0=this._x1=+t,this._y0=this._y1=+e,this._a("M",this._x0,this._y0)},closePath:function(){if(null!==this._x1)return this._x1=this._x0,this._y1=this._y0,this._+="Z"},lineTo:function(t,e){return this._x1=+t,this._y1=+e,this._a("L",this._x1,this._y1)},bezierCurveTo:function(t,e,n,i,r,o){return this._x1=+r,this._y1=+o,this._a("C",+t,+e,+n,+i,this._x1,this._y1)},arc:function(t,e,n,i,r,o){var s,a,u,l,h=[+t,+e,+n,!!o];if(t=h[0],e=h[1],o=h[3],(n=h[2])<0)throw new Error("negative radius: "+n);if(a=t+(h=n*G(i)),u=e+(s=n*I(i)),l=o?0:1,o=o?i-r:r-i,null===this._x1?this._a("M",a,u):(1e-6<F(this._x1-a)||1e-6<F(this._y1-u))&&this._a("L",a,u),n)return c<(o=o<0?o%J+J:o)?(this._a("A",n,n,0,1,l,t-h,e-s),this._x1=a,this._y1=u,this._a("A",n,n,0,1,l,this._x1,this._y1)):1e-6<o?(this._x1=t+n*G(r),this._y1=e+n*I(r),this._a("A",n,n,0,D<=o?1:0,l,this._x1,this._y1)):void 0},toString:function(){return this._}},L=function(t,e,n,i,r,o,s,a){var n=[n-t,i-e,s-r,a-o],i=n[0],s=n[1],a=n[2],n=n[3],u=n*i-a*s;if(!(u*u<U))return[t+(u=(a*(e-o)-n*(t-r))/u)*i,e+u*s]},P=function(t,e,n,i,r,o,s){var a=t-n,u=e-i,s=(s?o:-o)/H(a*a+u*u),u=s*u,s=-s*a,a=t+u,t=e+s,e=n+u,n=i+s,i=(a+e)/2,l=(t+n)/2,h=e-a,c=n-t,f=h*h+c*c,o=r-o,a=a*n-e*t,n=(c<0?-1:1)*H(p(0,o*o*f-a*a)),e=(a*c-h*n)/f,t=(-a*h-c*n)/f,d=(a*c+h*n)/f,a=(-a*h+c*n)/f,h=e-i,c=t-l,n=d-i,f=a-l;return n*n+f*f<h*h+c*c&&(e=d,t=a),{cx:e,cy:t,x01:-u,y01:-s,x11:e*(r/o-1),y11:t*(r/o-1)}},u=function(){var z=function(t){return t.innerRadius},C=function(t){return t.outerRadius},E=x(0),O=null,j=function(t){return t.startAngle},R=function(t){return t.endAngle},T=function(t){return t&&t.padAngle},q=3,e=function(){var t,e,n,i,r,o,s,a,u,l,h,c,f,d,p,m,y,_,g,v,b=arguments,x=new Z(q),w=+z.apply(this,b),k=+C.apply(this,b),A=j.apply(this,b)-$,M=R.apply(this,b)-$,N=F(M-A),S=A<M;return k<w&&(w=(o=[k,w])[0],k=o[1]),U<k?J-U<N?(x.moveTo(k*G(A),k*I(A)),x.arc(0,0,k,A,M,!S),U<w&&(x.moveTo(w*G(M),w*I(M)),x.arc(0,0,w,M,A,S))):(t=(o=[A,M,A,M,N,N])[0],e=o[1],n=o[2],i=o[3],r=o[4],o=o[5],u=T.apply(this,b)/2,h=U<u&&(O?+O.apply(this,b):H(w*w+k*k)),a=s=b=W(F(k-w)/2,+E.apply(this,b)),U<h&&(l=X(h/w*I(u)),h=X(h/k*I(u)),(r-=2*l)>U?(n+=l*=S?1:-1,i-=l):(r=0,n=i=(A+M)/2),(o-=2*h)>U?(t+=h*=S?1:-1,e-=h):(o=0,t=e=(A+M)/2)),u=k*G(t),l=k*I(t),h=w*G(i),A=w*I(i),U<b&&(c=k*G(e),f=k*I(e),d=w*G(n),p=w*I(n),N<D)&&((M=L(u,l,d,p,c,f,h,A))?(N=u-M[0],_=l-M[1],m=c-M[0],y=f-M[1],N=1/I(V((N*m+_*y)/(H(N*N+_*_)*H(m*m+y*y)))/2),_=H(M[0]*M[0]+M[1]*M[1]),s=W(b,(w-_)/(N-1)),a=W(b,(k-_)/(1+N))):s=a=0),U<o?U<a?(g=P(d,p,u,l,k,a,S),v=P(c,f,h,A,k,a,S),x.moveTo(g.cx+g.x01,g.cy+g.y01),a<b?x.arc(g.cx,g.cy,a,B(g.y01,g.x01),B(v.y01,v.x01),!S):(x.arc(g.cx,g.cy,a,B(g.y01,g.x01),B(g.y11,g.x11),!S),x.arc(0,0,k,B(g.cy+g.y11,g.cx+g.x11),B(v.cy+v.y11,v.cx+v.x11),!S),x.arc(v.cx,v.cy,a,B(v.y11,v.x11),B(v.y01,v.x01),!S))):(x.moveTo(u,l),x.arc(0,0,k,t,e,!S)):x.moveTo(u,l),U<w&&U<r?U<s?(g=P(h,A,c,f,w,-s,S),v=P(u,l,d,p,w,-s,S),x.lineTo(g.cx+g.x01,g.cy+g.y01),s<b?x.arc(g.cx,g.cy,s,B(g.y01,g.x01),B(v.y01,v.x01),!S):(x.arc(g.cx,g.cy,s,B(g.y01,g.x01),B(g.y11,g.x11),!S),x.arc(0,0,w,B(g.cy+g.y11,g.cx+g.x11),B(v.cy+v.y11,v.cx+v.x11),S),x.arc(v.cx,v.cy,s,B(v.y11,v.x11),B(v.y01,v.x01),!S))):x.arc(0,0,w,i,n,S):x.lineTo(h,A)):x.moveTo(0,0),x.closePath(),x.toString()||null};return e.centroid=function(){var t=(+z.apply(this,arguments)+ +C.apply(this,arguments))/2,e=(+j.apply(this,arguments)+ +R.apply(this,arguments))/2-D/2;return[G(e)*t,I(e)*t]},e.innerRadius=function(t){return arguments.length?(z=w(t),e):z},e.outerRadius=function(t){return arguments.length?(C=w(t),e):C},e.cornerRadius=function(t){return arguments.length?(E=w(t),e):E},e.padRadius=function(t){return arguments.length?(O=null!=t?w(t):null,e):O},e.startAngle=function(t){return arguments.length?(j=w(t),e):j},e.endAngle=function(t){return arguments.length?(R=w(t),e):R},e.padAngle=function(t){return arguments.length?(T=w(t),e):T},e.digits=function(t){return arguments.length?(q=null!=t?Math.floor(t):null,e):q},e},(e=function(t){return this._context=t,this}).prototype={areaStart:function(){return this._line=0},areaEnd:function(){return this._line=NaN},lineStart:function(){return this._point=0},lineEnd:function(){return(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var n=[+t,+e];return t=n[0],e=n[1],0===this._point?(this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e)):(this._point=2,this._context.lineTo(t,e))}},i=function(t){return new e(t)},r=function(t,e,n){var i=t._k;return t._context.bezierCurveTo(t._x1+i*(t._x2-t._x0),t._y1+i*(t._y2-t._y0),t._x2+i*(t._x1-e),t._y2+i*(t._y1-n),t._x2,t._y2)},(n=function(t,e){return this._context=t,this._k=(1-e)/6,this}).prototype={areaStart:function(){return this._line=0},areaEnd:function(){return this._line=NaN},lineStart:function(){return this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){return 2===this._point?this._context.lineTo(this._x2,this._y2):3===this._point&&r(this,this._x1,this._y1),(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var n=[+t,+e];return t=n[0],e=n[1],0===this._point?(this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e)):1===this._point?(this._point=2,this._x1=t,this._y1=e):(this._point=3,r(this,t,e)),n=[this._x1,this._x2,t],this._x0=n[0],this._x1=n[1],this._x2=n[2],n=[this._y1,this._y2,e],this._y0=n[0],this._y1=n[1],this._y2=n[2],n}},o=function(t,e,n){var i,r,o=[t._x1,t._y1,t._x2,t._y2],s=o[0],a=o[1],u=o[2],o=o[3];return U<t._l01_a&&(s=(s*(i=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a)-t._x0*t._l12_2a+t._x2*t._l01_2a)/(r=3*t._l01_a*(t._l01_a+t._l12_a)),a=(a*i-t._y0*t._l12_2a+t._y2*t._l01_2a)/r),U<t._l23_a&&(u=(u*(i=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a)+t._x1*t._l23_2a-e*t._l12_2a)/(r=3*t._l23_a*(t._l23_a+t._l12_a)),o=(o*i+t._y1*t._l23_2a-n*t._l12_2a)/r),t._context.bezierCurveTo(s,a,u,o,t._x2,t._y2)},(s=function(t,e){return this._context=t,this._alpha=e,this}).prototype={areaStart:function(){return this._line=0},areaEnd:function(){return this._line=NaN},lineStart:function(){return this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){return 2===this._point?this._context.lineTo(this._x2,this._y2):3===this._point&&this.point(this._x2,this._y2),(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var n,i,r=[+t,+e];return t=r[0],e=r[1],this._point&&(n=this._x2-t,i=this._y2-e,this._l23_a=H(this._l23_2a=Math.pow(n*n+i*i,this._alpha))),0===this._point?(this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e)):1===this._point?this._point=2:(this._point=3,o(this,t,e)),r=[this._l12_a,this._l23_a],this._l01_a=r[0],this._l12_a=r[1],r=[this._l12_2a,this._l23_2a],this._l01_2a=r[0],this._l12_2a=r[1],r=[this._x1,this._x2,t],this._x0=r[0],this._x1=r[1],this._x2=r[2],r=[this._y1,this._y2,e],this._y0=r[0],this._y1=r[1],this._y2=r[2],r}},t=(a=function(e){var t=function(t){return e?new s(t,e):new n(t,0)};return t.alpha=function(t){return a(+t)},t})(.5),b=function(t){return"object"==typeof t&&"length"in t?t:Array.from(t)},u={arc:u,line:function(t,e){var l=x(!0),h=i,c=3,f="function"==typeof t?t:void 0===t?function(t){return t[0]}:x(t),d="function"==typeof e?e:void 0===e?function(t){return t[1]}:x(e),n=function(t){for(var e,n,i,r,o=(t=b(t)).length,s=!1,a=h(e=new Z(c)),u=0;u<=o;++u)i=!1,(n=u)<o&&(r=t[n],i=!!l(r,n,t)),!i===s&&((s=!s)?a.lineStart():a.lineEnd()),s&&a.point(+f(r,n,t),+d(r,n,t));return e.toString()||null};return n.x=function(t){return arguments.length?(f=w(t),n):f},n.y=function(t){return arguments.length?(d=w(t),n):d},n.defined=function(t){return arguments.length?(l="function"==typeof t?t:x(!!t),n):l},n.curve=function(t){return arguments.length?(h=t,n):h},n.digits=function(t){return arguments.length?(c=null!=t?Math.floor(t):null,n):c},n},area:function(d,p,m){var e,y=null,_=x(!0),g=i,v=3;return d="function"==typeof d?d:void 0===d?function(t){return t[0]}:x(+d),p="function"==typeof p?p:x(void 0===p?0:+p),m="function"==typeof m?m:void 0===m?function(t){return t[1]}:x(+m),(e=function(t){for(var e,n,i,r,o,s=(t=b(t)).length,a=!1,u=new Array(s),l=new Array(s),h=0,c=g(e=new Z(v)),f=0;f<=s;++f){if(i=!1,(n=f)<s&&(r=t[n],i=!!_(r,n,t)),!i===a)if(a=!a)h=n,c.areaStart(),c.lineStart();else{for(c.lineEnd(),c.lineStart(),o=n-1;h<=o;)c.point(u[o],l[o]),o--;c.lineEnd(),c.areaEnd()}a&&(u[n]=+d(r,n,t),l[n]=+p(r,n,t),c.point(y?+y(r,n,t):u[n],m?+m(r,n,t):l[n]))}return e.toString()||null}).x=function(t){return arguments.length?(d=w(t),y=null,e):d},e.x0=function(t){return arguments.length?(d=w(t),e):d},e.x1=function(t){return arguments.length?(y=null!=t?w(t):null,e):y},e.y=function(t){return arguments.length?(p=w(t),m=null,e):p},e.y0=function(t){return arguments.length?(p=w(t),e):p},e.y1=function(t){return arguments.length?(m=null!=t?w(t):null,e):m},e.defined=function(t){return arguments.length?(_="function"==typeof t?t:x(!!t),e):_},e.curve=function(t){return arguments.length?(g=t,e):g},e.digits=function(t){return arguments.length?(v=null!=t?Math.floor(t):null,e):v},e},curve:{linear:i,catmullRom:t},path:function(t){return new Z(t)}},null!=z&&((z.utils||(z.utils={})).shape=u)}.call(this),function(){var e=function(t){return Math.max(0,Math.min(255,Math.round(t)))},t={turbo:function(t){return t=Math.max(0,Math.min(1,t)),"rgb("+e(34.61+t*(1172.33-t*(10793.56-t*(33300.12-t*(38394.49-14825.05*t)))))+", "+e(23.31+t*(557.33+t*(1225.33-t*(3574.96-t*(1073.77+707.56*t)))))+", "+e(27.2+t*(3211.1-t*(15327.97-t*(27814-t*(22569.18-6838.66*t)))))+")"},discrete:function(e){var n=e.length;return function(t){return e[Math.max(0,Math.min(n-1,Math.floor(t*n)))]}},quantize:function(t,e){for(var n,i=[],r=0;r<e;++r)n=r,i.push(t(n/(e-1)));return i}};null!=z&&((z.utils||(z.utils={})).color=t)}.call(this),function(){var n,c,l,r,o,s,f,d,p,m,t,e;n=function(){return("undefined"!=typeof performance&&null!==performance?performance:Date).now()},c={linear:function(t){return t},cubicInOut:function(t){return(t*=2)<=1?t*t*t/2:((t-=2)*t*t+2)/2},cubicOut:function(t){return--t*t*t+1},quadInOut:function(t){return(t*=2)<=1?t*t/2:(--t*(2-t)+1)/2}},l=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,r=function(t){var e,n;return"string"!=typeof t?null:(t=t.trim(),(e=/^#([0-9a-f]{3,4})$/i.exec(t))?[(n=e[1].split("").map(function(t){return parseInt(t+t,16)}))[0],n[1],n[2],null!=n[3]?n[3]/255:1]:(e=/^#([0-9a-f]{6})([0-9a-f]{2})?$/i.exec(t))?(n=[0,1,2].map(function(t){return parseInt(e[1].substr(2*t,2),16)})).concat([e[2]?parseInt(e[2],16)/255:1]):!(e=/^rgba?\(([^)]+)\)$/i.exec(t))||(n=e[1].split(/[\s,\/]+/).filter(function(t){return t}).map(function(t){return parseFloat(t)})).length<3||n.slice(0,3).some(function(t){return isNaN(t)})?null:[n[0],n[1],n[2],null==n[3]||isNaN(n[3])?1:n[3]])},o=function(s,a){return function(e){var t=[0,1,2,3].map(function(t){return s[t]+(a[t]-s[t])*e}),n=t[0],i=t[1],r=t[2],o=t[3];return n=(t=[n,i,r].map(function(t){return(t=0<(t=Math.round(t))?t:0)<255?t:255}))[0],i=t[1],r=t[2],1===(o=!isNaN(o)&&(t=0<o?o:0)<1?t:1)?"rgb("+n+", "+i+", "+r+")":"rgba("+n+", "+i+", "+r+", "+o+")"}},s=function(t,e){var n,i,r,o,s,a,u;for(e+="",n=(t+="").match(l)||[],i=[],l.lastIndex=o=r=0;s=l.exec(e);)s.index>r&&i.push(e.slice(r,s.index)),a=+s[0],u=null!=n[o]?+n[o]:null,i.push(null!=u&&u!==a?{a:u,b:a}:s[0]),r=l.lastIndex,o++;return r<e.length&&i.push(e.slice(r)),i.some(function(t){return"object"==typeof t})?function(e){return i.map(function(t){return"object"==typeof t?t.a+(t.b-t.a)*e:t}).join("")}:function(){return e}},f=function(e,n){var t,i;return"number"==typeof n?(e=parseFloat(e),isNaN(e)&&(e=0),function(t){return e+(n-e)*t}):null==e?function(){return n}:(t=r(n))?(i=r(e))?o(i,t):function(){return n}:s(e,n)},d=function(t,e){return e.startsWith("style:")?t.style.getPropertyValue(e.slice(6)):t.getAttribute(e)},p=function(t,e,n){return e.startsWith("style:")?t.style.setProperty(e.slice(6),n):t.setAttribute(e,n)},m=function(t,e){return e.startsWith("style:")?t.style.removeProperty(e.slice(6)):t.removeAttribute(e)},(t=function(t){var e=this;return this._manual=!!(t=null==t?{}:t).manual,this._now=0,this._base=0,this._since=n(),this._speed=1,this._frozen=!1,this._dur=350,this._immediate=!1,this._back=0,this._raf=null,this._list=new Map,this.evtHandler={},this._tick=function(t){if(e._raf=null,!e._manual&&!e._frozen)return e._apply(e.time()),e._list.size?e._kick():void 0},this}).prototype=((t,e)=>{var n,i={}.hasOwnProperty;for(n in e)i.call(e,n)&&(t[n]=e[n]);return t})(Object.create(Object.prototype),{on:function(t,n){var i=this;return(Array.isArray(t)?t:[t]).map(function(t){var e;return((e=i.evtHandler)[t]||(e[t]=[])).push(n)})},fire:function(t){for(var e,n,i,r,o=[],s=[],a=1,u=arguments.length;a<u;++a)s.push(arguments[a]);for(e=s,a=0,i=(n=this.evtHandler[t]||[]).length;a<i;++a)r=n[a],o.push(r.apply(this,e));return o},time:function(){return this._manual?this._now:this._frozen?this._base:this._base+(n()-this._since)*this._speed},_rebase:function(){return this._base=this.time(),this._since=n()},duration:function(t){return arguments.length?(t=+t,this._dur=isNaN(t)||t<0?350:t,this):this._dur},immediate:function(t){return arguments.length?(this._immediate=!!t,this):this._immediate},speed:function(t){return arguments.length?(t=+t,(t=isNaN(t)||t<=0?1:t)!==this._speed&&(this._manual||this._rebase(),this._speed=t),this):this._speed},paused:function(){return this._frozen},pause:function(){return this._frozen||(this._manual||this._rebase(),this._frozen=!0,this._raf&&cancelAnimationFrame(this._raf),this._raf=null),this},resume:function(){return this._frozen&&(this._since=n(),this._frozen=!1,this._list.size)&&this._kick(),this},ago:function(t,e){this._back=t||0;try{e()}finally{this._back=0}return t&&this._apply(this.time()),this},manual:function(t){return arguments.length?((t=!!t)!==this._manual&&(t?(this._now=this.time(),this._manual=!0,this._raf&&cancelAnimationFrame(this._raf),this._raf=null):(this._base=this._now,this._since=n(),this._manual=!1,this._list.size&&this._kick())),this):this._manual},step:function(t){return null==t&&(t=1e3/60),this._manual||this.manual(!0),t*=this._speed,this._now+=t,this._apply(this._now),this.fire("step",this._now,t),this},seek:function(t){return this._manual||this.manual(!0),this._now=t,this._apply(this._now),this.fire("step",this._now,0),this},busy:function(){return 0<this._list.size},flush:function(){return this._apply(1/0),this},interrupt:function(t){return this._list.delete(t)},_kick:function(){var t=this;if(!(this._manual||this._frozen||this._raf))return"undefined"==typeof requestAnimationFrame||null===requestAnimationFrame?setTimeout(function(){return t._tick()},16):this._raf=requestAnimationFrame(this._tick)},tween:function(t,e,n){var i,r,o,s,a,u,l,h;for(l in null==e&&(e={}),r=this._dur/350,i=(null!=(n=null==n?{}:n).duration?n.duration:350)*r,r=(n.delay||0)*r,o="function"==typeof n.ease?n.ease:c[n.ease||"cubic-in-out"]||c.cubicInOut,s=this._immediate||i<=0&&r<=0||!this._manual&&"undefined"!=typeof document&&null!==document&&document.hidden,(a=this._list.get(t)||{attr:{},cb:[]}).remove=!!n.remove,n.end&&a.cb.push(n.end),u=this.time()-this._back+r,e)null==(h=e[l])?(m(t,l),delete a.attr[l]):l.startsWith("style:")&&!t.style.getPropertyValue(l.slice(6))&&window.getComputedStyle(t).getPropertyValue(l.slice(6))===h+""?delete a.attr[l]:s?(p(t,l,"function"==typeof h?h(1):h),delete a.attr[l]):a.attr[l]="function"==typeof h?{fn:h,start:u,dur:0<i?i:0,ease:o}:{to:h,start:u,dur:0<i?i:0,ease:o};return this._list.set(t,a),s&&!(()=>{var t=[];for(l in a.attr)t.push(l);return t})().length?this._done(t,a):this._manual||this._kick(),this},_done:function(e,t){return this._list.delete(e),t.remove&&e.parentNode&&e.parentNode.removeChild(e),t.cb.map(function(t){return t.call(e)})},_apply:function(t){for(var e,n,i,r,o,s,a,u,l=[],h=0,c=(e=Array.from(this._list)).length;h<c;++h)if(i=(n=e[h])[0],r=n[1],this._list.get(i)===r){for(o in n=r.attr)t<(s=n[o]).start||(s.fn?(a=s.dur&&(u=(t-s.start)/s.dur)<1?u:1,p(i,o,s.fn(1<=a?1:s.ease(a))),1<=a&&delete r.attr[o]):(s.interp||(s.interp=f(d(i,o),s.to)),1<=(a=s.dur&&(u=(t-s.start)/s.dur)<1?u:1)?(p(i,o,s.to),delete r.attr[o]):p(i,o,s.interp(s.ease(a)))));(()=>{var t=[];for(o in r.attr)t.push(o);return t})().length||l.push(this._done(i,r))}return l}}),e=function(t){var e,i,r,o,s,n,a,u,l,h=t.root,c=null!=(e=t.tag)?e:"g",f=t.cls,d=null!=(e=t.data)?e:[],p=t.key;for(p=p||function(t,e){return e},t=Array.from(h.childNodes).filter(function(t){return 1===t.nodeType&&t.tagName===c&&(!f||t.classList.contains(f))}),i=new Map,r=(e=[[],[],[],[]])[0],o=e[1],s=e[2],n=e[3],t.map(function(t,e){e=p(t.__data__,e);return i.has(e)?n.push(t):i.set(e,t)}),d.map(function(t,e){var n,e=p(t,e);return((n=i.get(e))?(i.delete(e),o):(n=document.createElementNS("http://www.w3.org/2000/svg",c),f&&n.setAttribute("class",f),n._entering=!0,r)).push(n),n.__data__=t,s.push(n)}),a=null,u=s.length-1;0<=u;--u)a=((l=s[u])._entering&&(delete l._entering,h.insertBefore(l,a)),l);return n=n.concat(Array.from(i.values())),{enter:r,update:o,exit:n,nodes:s}},t.ease=c,t.interpolate=f,t.join=e,null!=z&&((z.utils||(z.utils={})).anim=t)}.call(this),function(){var t;(t=function(t){return this.dir="y"===(t=null==t?{}:t).dir?"y":"x",this._extent=[[0,0],[1,1]],this._sel=null,this._g=null,this.evtHandler={},this}).prototype=((t,e)=>{var n,i={}.hasOwnProperty;for(n in e)i.call(e,n)&&(t[n]=e[n]);return t})(Object.create(Object.prototype),{on:function(t,n){var i=this;return(Array.isArray(t)?t:[t]).map(function(t){var e;return((e=i.evtHandler)[t]||(e[t]=[])).push(n)})},fire:function(t){for(var e,n,i,r,o=[],s=[],a=1,u=arguments.length;a<u;++a)s.push(arguments[a]);for(e=s,a=0,i=(n=this.evtHandler[t]||[]).length;a<i;++a)r=n[a],o.push(r.apply(this,e));return o},extent:function(t){return arguments.length?(this._extent=t,this._render(),this):this._extent},selection:function(){return this._sel?this._sel.slice():null},attached:function(){return!!this._g},_span:function(){var t="x"===this.dir?0:1;return[this._extent[0][t],this._extent[1][t]]},_emit:function(t,e){return this.fire(t,{type:t,selection:this.selection(),sourceEvent:e||null,target:this})},move:function(t,e){var n=this;return this._sel=null!=t?[+t[0],+t[1]]:null,this._render(),["start","brush","end"].map(function(t){return n._emit(t,e)}),this},clear:function(t){return this.move(null,t)},attach:function(s){var e,t,n,i=this;return this._g!==s&&(this._g&&this.detach(),s.__brush&&s.__brush!==this&&s.__brush.detach(),((s.__brush=this)._g=s).setAttribute("fill","none"),s.setAttribute("pointer-events","all"),("undefined"!=typeof navigator&&null!==navigator&&navigator.maxTouchPoints||"ontouchstart"in s)&&(s.style.touchAction="none",s.style.setProperty("-webkit-tap-highlight-color","rgba(0,0,0,0)")),t="x"===this.dir?["w","e"]:["n","s"],n="x"===this.dir?"ew-resize":"ns-resize",this._n={overlay:(e=function(t,e,n){var i,r,o;for(r in null==n&&(n={}),(i=s.querySelector(":scope > rect."+t.split(" ").join("."))||s.appendChild(document.createElementNS("http://www.w3.org/2000/svg","rect"))).setAttribute("class",t),i.__data__={type:e},n)o=n[r],i.setAttribute(r,o);return i})("overlay","overlay",{"pointer-events":"all",cursor:"crosshair"}),selection:e("selection","selection",{cursor:"move",fill:"#777","fill-opacity":.3,stroke:"#fff","shape-rendering":"crispEdges"}),handle:t.map(function(t){return e("handle handle--"+t,t,{cursor:n})})},s.addEventListener("pointerdown",this._down=function(t){return i._start(t)})),this._render(),this},detach:function(){var t,e,n,i;if(this._g){for(this._g.removeEventListener("pointerdown",this._down),t=0,n=(e=[this._n.overlay,this._n.selection].concat(this._n.handle)).length;t<n;++t)(i=e[t]).parentNode&&i.parentNode.removeChild(i);return this._g.__brush===this&&(this._g.__brush=null),this._g=null}},_render:function(){var t,e,n,i,r,o,s,a,u,l,h,c,f,d,p=this;if(this._g){if(e=(i=(t=this._extent)[0])[0],d=i[1],n=(i=t[1])[0],i=i[1],(a=this._n.overlay).setAttribute("x",e),a.setAttribute("y",d),a.setAttribute("width",n-e),a.setAttribute("height",i-d),this._sel)return a=(t=this._sel)[0],u=t[1],t="x"===this.dir?[a,d,u,i]:[e,a,n,u],l=t[0],h=t[1],c=t[2],f=t[3],(d=this._n.selection).style.display="",d.setAttribute("x",l),d.setAttribute("y",h),d.setAttribute("width",c-l),d.setAttribute("height",f-h),this._n.handle.map(function(t,e){return t.style.display="","x"===p.dir?(t.setAttribute("x",(e?c:l)-3),t.setAttribute("y",h-3),t.setAttribute("width",6),t.setAttribute("height",f-h+6)):(t.setAttribute("x",l-3),t.setAttribute("y",(e?f:h)-3),t.setAttribute("width",c-l+6),t.setAttribute("height",6))});for(r=0,o=(t=[this._n.selection].concat(this._n.handle)).length;r<o;++r)(s=t[r]).style.display="none",["x","y","width","height"].map(m)}function m(t){return s.removeAttribute(t)}},_pos:function(t){var e=this._g.getScreenCTM();return e?(t=new DOMPoint(t.clientX,t.clientY).matrixTransform(e.inverse()),"x"===this.dir?t.x:t.y):0},_start:function(t){var e,n,o,s,a,u,l,h,i,r,c,f,d=this;if((null==t.button||0===t.button)&&(e=(t.target.__data__||{}).type))return t.stopImmediatePropagation(),t.preventDefault(),n=this._span(),o=n[0],s=n[1],a=function(t){return(t=o<t?t:o)<s?t:s},u=this._pos(t),l=this._sel?this._sel.slice():null,"new"===(h="selection"===e?"move":"w"!==e&&"n"!==e||!l?"e"!==e&&"s"!==e||!l?"new":"hi":"lo")&&(u=a(u)),i=!1,this._emit("start",t),r=function(t){var e,n,i,r=d._pos(t);return"move"===h?(e=(i=(e=r-u)>(i=o-l[0])?e:i)<(n=s-l[1])?i:n,d._sel=[l[0]+e,l[1]+e]):(i="new"===h?u:"lo"===h?l[1]:l[0],r=a(r),d._sel=[Math.min(i,r),Math.max(i,r)]),d._render(),d._emit("brush",t)},c=function(t){return i=!0,r(t)},f=function(t){var e;return window.removeEventListener("pointermove",c),window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",f),i||"move"===h||(d._sel=null),d._sel&&d._sel[0]===d._sel[1]&&(d._sel=null),d._render(),i&&(e=function(t){return t.stopImmediatePropagation(),t.preventDefault()},window.addEventListener("click",e,!0),setTimeout(function(){return window.removeEventListener("click",e,!0)},0)),d._emit("end",t)},window.addEventListener("pointermove",c),window.addEventListener("pointerup",f),window.addEventListener("pointercancel",f)}}),null!=z&&((z.utils||(z.utils={})).brush=t)}.call(this),function(){var r;(r=function(t){return this.isUnique=null==(t=null==t?{}:t).unique||t.unique,this.map={},this.nmap=[],this.wm=new WeakMap,this.count=0,this._ext=t.extent||[0,1],this.set(t.palette)||t.colors,this.mode(t.mode),this}).default=["#e15c64","#f7b26a","#f3ed9d","#a4bd81","#a0d7d2","#8db1da","#daaedb"],r.prototype=((t,e)=>{var n,i={}.hasOwnProperty;for(n in e)i.call(e,n)&&(t[n]=e[n]);return t})(Object.create(Object.prototype),{set:function(t){var e,n=this,i=(t=null==t?[]:t).key||t.name;return null==e&&(e=null!=i&&this.key!==i),this.key=i,this.colors=Array.isArray(t)&&t.length?t:t.colors&&Array.isArray(t.colors)?t.colors:r.default,this.nmap=t.maps||[],this.tags=this.colors.map(function(t){return t.tag||[]}),this.colors=this.colors.map(function(t){return t.value||t}),1===this.colors.length&&this.colors.push(ldcolor.complement(this.colors[0])),this.colors=this.colors.map(function(t){return ldcolor.hsl(t)}),this.len=2<(i=this.colors.length)?i:2,e?this.reset():this.nmap.map(function(t,e){return(Array.isArray(t)?t:[t]).map(function(t){return n.get(t,0,e)})}),this.tags.map(function(t,e){return t.map(function(t){return n.get(t,0,e)})})},unique:function(t){return null!=t?this.isUnique=!!t:this.isUnique},reset:function(){var n=this;return this.map={},this.wm=new WeakMap,this.count=0,(this.nmap||[]).map(function(t,e){return(Array.isArray(t)?t:[t]).map(function(t){return n.get(t,0,e)})})},mode:function(t){return 0===arguments.length?this._m:this._m=t},extent:function(t){return 0===arguments.length?this._ext:(this._ext=t.map(function(t){return null!=t?t:0}),this._ext.sort(function(t,e){return t-e}))},get:function(t,e,n){switch(null==e&&(e=0),this._m){case 1:return this._vd(t,e);case 2:return this._vc(t,e);case 3:return this._vs(t,e);default:return this._d(t,e,n)}},_v:function(t,e){return 0<e?t=ldcolor.lighter(t,e):e<0&&(t=ldcolor.darker(t,-e)),ldcolor.web(t)},_d:function(t,e,n){var i,r,o,s,a,u,l,h;if(null==e&&(e=0),null!=n?(this.count<n&&(this.count=n+1),i=n%this.len,"object"==typeof t?this.wm.set(t,i):this.map[t]=i):("object"==typeof t?null==(i=this.wm.get(t))&&this.wm.set(t,i=this.count++):null==(i=this.map[t])&&(this.map[t]=i=this.count++),this.isUnique||(i%=this.len)),i>=this.len){for(n=i%(this.len-1),r=Math.floor(i/(this.len-1)),s=(o=[0,1])[0],a=o[1];0<r;)s=(o=[2*s,2*a])[0],a=o[1],r%2&&(s+=1),r>>=1;r=s/a,o=[this.colors[n],this.colors[1+n]],u=o[0],l=o[1],h={h:(o=["h","s","l"].map(function(t){return r*(l[t]-u[t])+u[t]}))[0],s:o[1],l:o[2]}}else h=this.colors[i];return this._v(h,e)},_vs:function(t,e){for(var n,i,r,o=this._ext||[0,1],s=-1,a=0,u=o.length-1;a<u;++a)if(!(t>=o[(n=a)+1])){s=n;break}return-1===s&&(s=o.length),this._v(this.colors[(i=0<s?s:0)<(r=this.colors.length-1)?i:r],e)},_vd:function(t,e){var n=this._ext||[0,1],i=(n=0<(t=(t-n[0])/(n[1]-n[0]||1))?t:0)<1?n:1;return this._v(this.colors[Math.floor((n=i*(this.len||1))<(t=this.len-1)?n:t)],e)},_vc:function(t,e){var n,i,r,o=this._ext||[0,1],t=((o=0<(t=(t-o[0])/(o[1]-o[0]||1))?t:0)<1?o:1)*(0<(o=this.len-1)?o:0),o=t==this.len-1?[0<(o=this.len-2)?o:0,0<(o=this.len-1)?o:0]:[Math.floor(t),Math.floor(t)+1],s=o[0];return o=[this.colors[s],this.colors[o[1]]],n=o[0],i=o[1],r=t-s,t=(o=["h","s","l"].map(function(t){return r*(i[t]-n[t])+n[t]}))[0],this._v({h:t,s:o[1],l:o[2]},e)},text:function(t,e){return null==e&&(e={}),t=ldcolor.hcl(this.get(t)),ldcolor.web(50<t.l?e.textDark||"#000":e.textLight||"#fff")}}),r.mode={ordinal:0,discrete:1,continuous:2,ranges:3},null!=z&&((z.utils||(z.utils={})).tint=r)}.call(this),function(){var t=function(t){var i,e,n,r,o,s,a,u,l,h,c,f,d,p,m,y,_,g,v,b,x,w,k,A=(t=null==t?{}:t).extent||[0,1],M=t.len||3,N=A=(A=A.map(function(t){return isNaN(t)?0:t}))[0]>A[1]?[A[1],A[0]]:A;if(null!=t.exp){if(i=[10,15,20,25,30,40,50,75,100],e=[],n=[],r=Math.pow(10,t.exp),null==t.pretty||t.pretty){for(A=[[A[0],"floor"],[A[1],"ceil"]].map(function(t){var e=t[0],n=t[1],t=i.map(function(t){return[t,Math.abs(e-Math[n](e/t)*t)]});return t.sort(function(t,e){return t[1]-e[1]}),t[0][0]*Math[n](e/t[0][0])}),o=A[1]-A[0],s=1;s<=M;++s){for(a=s,u=+(o*(Math.pow(a/M,r)-Math.pow((a-1)/M,r))).toFixed(2),l=Math.floor(Math.log(u)/Math.LN10),h=0,c=i.length;h<c&&!((f=i[h]*Math.pow(10,l-1).toFixed(2))>=u);++h);n.push(f)}for(o=n.reduce(function(t,e){return t+e},0),p=(A=[[(A=[A[0],(d=A[0]+o)>(m=A[1])?d:m])[0],"floor"],[A[1],"ceil"]].map(function(t){var e=t[0],n=t[1],t=i.map(function(t){return[t,Math.abs(e-Math[n](e/t)*t)]});return t.sort(function(t,e){return t[1]-e[1]}),t[0][0]*Math[n](e/t[0][0])}))[0],s=0;s<M&&(a=s,e.push(p),!((p+=n[a])>=N[1]));++s);e.push(p)}else o=A[1]-A[0],e=(()=>{for(var t=[],e=0,n=M;e<=n;++e)t.push(e);return t})().map(function(t){return o*Math.pow(t/M,r)+A[0]});e.sort(function(t,e){return t-e}),m=[e[0],e[M-1]]}else if(null==t.pretty||t.pretty){for(u=(A[1]-A[0])/(M+1),l=Math.floor(Math.log((A[1]-A[0]||1)/(M+1))/Math.LN10),s=0,c=(d=[10,20,25,50,100]).length;s<c&&(a=d[s],!((f=a*Math.pow(10,l-1))>u));++s);y=f*Math.floor(A[0]/f),m=[(e=(()=>{for(var t=[],e=0,n=M;e<=n;++e)t.push(e);return t})().map(function(t){return y+f*t}))[0],e[M]]}else m=[(e=(()=>{for(var t=[],e=0,n=M;e<n;++e)t.push(e);return t})().map(function(t){return A[0]+(A[1]-A[0])*t/(1<(t=M-1)?t:1)}))[0],e[M-1]];if(_=t.legend){if(g=_.format||function(t){return t},v=_.unit||"",_.range)for(b=[],s=0,x=e.length-1;s<x;++s)w=(d=[e[a=s],e[a+1]])[0],b.push({ext:[w,k=d[1]],key:(w+k)/2,text:_.text?_.text(w,k):g(w)+" - "+g(k)+v});else b=e.map(function(t){return{key:t,text:_.text?_.text(t):g(t)+""+v}});b.sort(function(t,e){return t.key<e.key?1:t.key>e.key?-1:0})}return{ticks:e,extent:m,labels:b}};null!=z&&((z.utils||(z.utils={})).tick=t)}.call(this),function(){var t;t={from:function(t){var u=this,l=function(t,e){var n,i;if(e.preset){var r,o=t,s=JSON.parse(JSON.stringify(u.preset[e.preset])),a={}.hasOwnProperty;for(r in s)a.call(s,r)&&(o[r]=s[r])}for(n in e)i=e[n],"preset"!==n&&("string"==typeof i?t[n]=JSON.parse(JSON.stringify(u.preset[i]))||{}:l(t[n]||(t[n]={}),i));return t};return l({},t)},preset:{default:{margin:{type:"number"},font:t={family:{type:"font"},size:{type:"quantity",default:"1em",units:[{name:"em",max:10,step:.01,default:1},{name:"px",max:256,step:1,default:16}]}},color:{type:"color",default:"currentColor"},palette:{type:"palette"},background:{type:"color",default:"transparent"}},font:t,tip:{enabled:{type:"boolean",default:!0},format:{type:"format",default:".3s"}},label:{format:{type:"format",default:".3s"}},legend:{selectable:{type:"boolean",default:!0},actions:{type:"boolean",default:!0},enabled:{type:"boolean",default:!0},position:{type:"choice",values:["bottom","right"],default:"right"},sort:{direction:{type:"choice",values:["asc","desc"],default:"desc"},mode:{type:"choice",values:["label","value","none"],default:"value"}},subset:{mode:{type:"choice",values:["shrink","dim","partial"],default:"shrink"},opacity:{type:"number",default:.2,min:0,max:1,step:.05}},crossfilter:{type:"boolean",default:!1}},bin:{enabled:{type:"boolean",default:!1},width:{type:"number",default:0,min:0,max:1e6,step:.01},count:{type:"number",default:0,min:0,max:100,step:1},anchor:{type:"number",default:0,min:-1e6,max:1e6,step:.01},closed:{type:"choice",values:["left","right"],default:"left"},label:{type:"choice",values:["range","start","center"],default:"range"},format:{type:"format",default:""},empty:{type:"boolean",default:!0}},axis:{enabled:{type:"boolean",default:!0},center:{type:"boolean",default:!1},tick:{inner:{type:"number",name:"Inner Tick Size",default:8,min:0,max:40,step:.1},color:{type:"color",default:"currentColor"},count:{type:"number",default:4,min:1,max:40},boundaryOffset:{type:"boolean",default:!0}},baseline:{show:{type:"boolean",default:!0},color:{type:"color",default:"currentColor"}},label:{color:{type:"color",default:"currentColor"},format:{type:"format",default:".3s"},direction:{type:"choice",default:"horizontal",values:["horizontal","angled","vertical","auto"]},angle:{type:"number",default:45,min:0,max:90,step:1},gap:{type:"number",default:1.5,min:0,max:10,step:.1},strategy:{type:"choice",default:"stride",values:["stride","ends"]},tolerance:{type:"number",default:.2,min:0,max:1,step:.05},padding:{type:"number",default:1,min:0,max:100,step:.5},font:t},caption:{color:{type:"color",default:"currentColor"},text:{type:"text",default:""},show:{type:"boolean",default:!0},padding:{type:"number",default:1,min:0,max:100,step:.5},position:{type:"choice",default:4,values:[{name:"in / start",value:0},{name:"in / middle",value:1},{name:"in / end",value:2},{name:"out / start",value:3},{name:"out / middle",value:4},{name:"out / end",value:5}]},font:t},sideNoteStart:{show:{type:"boolean",default:!1},text:{type:"text",default:""},position:{type:"choice",default:0,values:[{name:"in",value:0},{name:"out",value:1}]},font:t,color:{type:"color",default:"currentColor"},padding:{type:"number",default:1,min:0,max:100,step:.5}},sideNoteEnd:{show:{type:"boolean",default:!1},text:{type:"text",default:""},position:{type:"choice",default:0,values:[{name:"in",value:0},{name:"out",value:1}]},font:t,color:{type:"color",default:"currentColor"},padding:{type:"number",default:1,min:0,max:100,step:.5}}}}},null!=z&&((z.utils||(z.utils={})).config=t)}.call(this),function(){var d={number:function(t){return(t=(t=null==t?{}:t).data.filter(function(t){return!(!t||""===(t+"").trim())})).filter(function(t){return!isNaN(parseFloat(t))}).length/t.length},serial:function(t){var e,n,i,r,o,s,a;for((e=[].concat((t=null==t?{}:t).data)).sort(function(t,e){return e-t}),n={},i=1,r=e.length;i<r;++i)o=i,isNaN(e[o])||isNaN(e[o-1])?n[e[o]>e[o-1]?e[o]+":"+e[o-1]:e[o-1]+":"+e[o]]=!0:s=e[o]-e[o-1],n[s]=!0;return 1/((()=>{var t=[];for(a in n)t.push(a);return t})().filter(function(t){return"0"!==t}).length||2)},text:function(t){return 1-this.number(t=null==t?{}:t)},category:function(t){var e;return null==t&&(t={}),e=(e=0<(e=1-(0<(e=Array.from(new Set(t.data)).length-2)?e:0)/(e=t.data.length)-1/e)?e:0)<1?e:1,this.number(t)&&(e*=.9),e},parse:function(t){var e,n;return Array.isArray(t)?(e=t.slice(0,1)[0],n=(n=t.slice(1)).map(function(n,t){var i={};return e.map(function(t,e){return i[t]=n[e]}),i}),{head:e,body:n}):t},autotype:function(t){var e,n,i,r,o,s,a,u,l=[];for(n in(t=null==t?[]:t)[0]||{})l.push(n);for(i=[],r=0,o=(e=l).length;r<o;++r)s=e[r],u=t.map(h),a={key:s,types:{R:d.number({data:u}),O:d.serial({data:u}),N:d.text({data:u}),C:d.category({data:u})}},(u=["R","O","N","C"].map(c)).sort(f),a.type=u[0][0],i.push(a);return i;function h(t){return t[s]}function c(t){return[t,a.types[t]]}function f(t,e){return e[1]-t[1]}},autobind:function(t,n){var e,i,r,o,s,a,u,l,h,c,f,d,p,m,y;for(null==n&&(n={}),e=this.autotype(t=null==t?[]:t),(i=(()=>{var t,e=[];for(r in t=n)o=t[r],e.push({k:r,v:o});return e})().filter(function(t){return!t.v.passive})).sort(function(t,e){var n=(t.v.priority||100)-(e.v.priority||100);return 0!=n?n:(n=[t.v.type||"R",e.v.type||"R"].map(function(i){return Math.min.apply(Math,(()=>{for(var t=[],e=0,n=i.length;e<n;++e)t.push(e);return t})().map(function(t){return"CONR".indexOf(i[t])}))}))[0]-n[1]}),s=0,a=i.length;s<a;++s)for((u=i[s]).bind=null,h=0,c=(l=u.v.type||"RNOC").length;h<c;++h)for(f=l[h],e.sort(_),d=0,p=e.length;d<p;++d)if(!((m=e[d]).types[f]<.5||m.used||"C"===f&&.5<m.types.R)){u.bind=u.v.multiple?[m]:m,m.used=!0;break}for(s=0,a=i.length;s<a;++s)if((u=i[s]).v.multiple)for(h=0,c=(l=u.v.type||"RNOC").length;h<c;++h)for(f=l[h],e.sort(g),d=0,p=e.length;d<p;++d)(m=e[d]).types[f]<.5||m.used||"C"===f&&.5<m.types.R||(u.bind.push(m),m.used=!0);for(y={},s=0,a=i.length;s<a;++s)(u=i[s]).bind&&(y[u.k]=u.bind,(Array.isArray(u.bind)?u.bind:[u.bind]).map(v));return y;function _(t,e){var n=(e.types[f]||0)-(t.types[f]||0);return e.types[f]===t.types[f]&&"R"===f?(t.types.O||0)-(e.types.O||0):n}function g(t,e){var n=(e[f]||0)-(t[f]||0);return e[f]===t[f]&&"R"===f?(t.O||0)-(e.O||0):n}function v(t){var e=t.used;return delete t.used,e}}};null!=z&&((z.utils||(z.utils={})).data=d)}.call(this),function(){var h,c;h="http://www.w3.org/2000/svg",(c=function(o){var t,e,n,i,r,s,a,u,l=this;if(null==o&&(o={}),this._data=o.data||[],this.name=o.name||"legend",this.cfg=o.cfg||{},this.root="string"==typeof o.root?document.querySelector(o.root):o.root,this.dir=o.direction||"vertical",this.evtHandler={},this._picked=Object.fromEntries(this._data.map(function(t){return[t.key,!0]})),this.layout=o.layout||new layout({root:this.root}),(e=this.layout).on("update",function(){return l.update()}),e.on("render",function(){return l.render()}),this.id=Math.random().toString(36).substring(2),e=this.layout.getNode(this.name),t=this.layout.getGroup(this.name),e.querySelector("[ld-each=legend]")||(e.innerHTML='<div class="pdlg '+this.dir+'">\n <div ld-each="legend">\n <div class="pdl-cell" ld="shape" data-only></div>\n <div class="pdl-cell" ld="text" data-only></div>\n </div>\n</div>'),t.querySelector("[ld-each=legend]")||(e=document.createElementNS(h,"g"),n=document.createElementNS(h,"g"),i=document.createElementNS(h,"g"),e.classList.add("pdlg-g"),e.setAttribute("ld-each","legend"),n.setAttribute("ld","shape"),i.setAttribute("ld","text"),e.appendChild(n),e.appendChild(i),t.appendChild(e)),this._i18n=o.i18n||("undefined"!=typeof block&&null!==block&&block.i18n&&block.i18n.module?block.i18n.module:null),this._t=o.t||null,this._i18n){if(r=this._i18n.addResourceBundle)for(s in a=c.i18n){u=a[s];try{r.call(this._i18n,s,c.i18nNs,u,!0,!1)}catch(t){}}this._i18n.on&&this._i18n.on("languageChanged",this._lngHandler=function(){return l._relocalize()})}return this._func=[{key:"all",type:"func",text:this._text("all")},{key:"none",type:"func",text:this._text("none")}],this.view={layout:new ldview({root:this.layout.getNode(this.name),initRender:!1,handler:{legend:{list:function(){var n,t=l._data.map(function(t){return t}),i=l.cfg.sort||{};return"none"!==i.mode&&(n="desc"===i.direction?1:-1,t.sort(function(t,e){return"value"===i.mode?n*(e.value-t.value):n*(t.text<e.text?1:t.text>e.text?-1:0)})),t.concat(l._actions()?l._func:[])},key:function(t){return t.key},view:{handler:{shape:function(t){return t.node.setAttribute("data-name",l._name(t.ctx,"shape"))},text:function(t){var e=t.node,t=t.ctx;return e.setAttribute("data-name",l._name(t,"text")),e.innerText=t.text}}}}}}),render:new ldview({root:this.layout.getGroup(this.name),initRender:!1,handler:{legend:{list:function(){return l._data.concat(l._actions()?l._func:[])},key:function(t){return t.key},view:{action:{click:{"@":function(t){t.node;var e,n=t.ctx;if(l.cfg.selectable){if("func"===n.type)for(e in l._picked)l._picked[e]="all"===n.key;else l._picked[n.key]=!l._picked[n.key];return l.view.render.render("legend"),l.fire("select",l._picked)}}}},handler:{"@":function(t){var e=t.node,t=t.ctx;return e.style.opacity=!l.cfg.selectable||"func"===t.type||l._picked[t.key]?1:.3},shape:function(t){var e,n,i,r=t.node,t=t.ctx;if("func"!==t.type)return r.querySelector("circle")||r.appendChild(document.createElementNS(h,"circle")),e=r.querySelector("circle"),n=l.layout.getBox(l._name(t,"shape")),i=l.layout.getBox(l.name),e.setAttribute("cx",".5em"),e.setAttribute("cy",".5em"),e.setAttribute("r",".5em"),e.setAttribute("transform","translate("+(n.x-i.x)+", "+(n.y-i.y)+")"),"function"==typeof o.shape?o.shape.call(e,t):void 0;r.style.display="none"},text:function(t){var e=t.node,t=t.ctx,n=l.layout.getNode(l._name(t,"text")),t=l.layout.getBox(l._name(t,"text")),i=l.layout.getBox(l.name);return e.setAttribute("transform","translate("+(t.x-i.x)+", "+(t.y-i.y)+")"),e.textContent="",t=wrapSvgText({node:n,useRange:!0}),e.appendChild(t)}}}}}})},this.update(),this}).i18nNs="@plotdb/chart.legend",c.i18n={en:{all:"Select All",none:"Select None"},"zh-TW":{all:"全選",none:"全不選"},"zh-CN":{all:"全选",none:"全不选"},ja:{all:"すべて選択",none:"すべて解除"}},c.prototype=((t,e)=>{var n,i={}.hasOwnProperty;for(n in e)i.call(e,n)&&(t[n]=e[n]);return t})(Object.create(Object.prototype),{_text:function(t){var e,n;return this._t&&(e=this._t("legend."+t))&&e!=="legend."+t||(n=c.i18nNs+":"+t,this._i18n&&this._i18n.t&&(e=this._i18n.t(n))&&e!==n&&e!==t)?e:(n=(n=this._i18n?this._i18n.language||this._i18n.lng:null)||("undefined"!=typeof document&&null!==document?document.documentElement.lang:"")||"en",(c.i18n[n]||c.i18n[n.split("-")[0]]||(/^zh/i.exec(n)?c.i18n[/cn|hans|sg/i.exec(n)?"zh-CN":"zh-TW"]:void 0)||c.i18n.en)[t])},_relocalize:function(){var e=this;if(this._func.map(function(t){return t.text=e._text(t.key)}),this._actions())return this.view.layout.render("legend"),this.layout.update(!1),this.view.render.render()},destroy:function(){return this._i18n&&this._lngHandler&&this._i18n.off&&this._i18n.off("languageChanged",this._lngHandler),this._lngHandler=null},_actions:function(){return!(!this.cfg.selectable||null!=this.cfg.actions&&!this.cfg.actions)},_name:function(t,e){return"pdlg-"+(e=null==e?"s":e)+"-"+this.id+"-"+(t.type||"")+"-"+t.key},enabled:function(){return this._data&&this._data.length&&(!(null!=this.cfg.enabled)||this.cfg.enabled)},update:function(){var t=this.enabled()?"":"0px",e=this.layout.getNode(this.name).style;return e.width=t,e.height=t,e.padding=t,e.margin=t,(e=this.layout.getNode(this.name).querySelector(".pdlg"))&&("vertical"===this.dir?(e.style.height="fit-content",e.style.height=getComputedStyle(e.parentNode).height):e.style.height=""),this.view.layout.render()},render:function(){var t=this.enabled();if(this.layout.getGroup(this.name).style.display=t?"":"none",t)return this.view.render.render()},config:function(t){var e,n=this;return null==t?this.cfg:(this.cfg.selectable!==t.selectable&&(this._picked=null,this._updatePicked()),this.cfg=t,this.dir="bottom"===this.cfg.position?"horizontal":"vertical",e=this.layout.getNode(this.name).querySelector(".pdlg"),["horizontal","vertical"].map(function(t){return e.classList.toggle(t,n.dir===t)}))},_updatePicked:function(){var e=this;return null==this._picked&&(this._picked=Object.fromEntries(this._data.map(function(t){return[t.key,!0]}))),this._data.map(function(t){if(null==e._picked[t.key])return e._picked[t.key]=!0})},data:function(t){var n;return arguments.length?(n={},t.map(function(t,e){return n[t.key]=e}),this._data=t.filter(function(t,e){return n[t.key]===e}),this._range=this._data.filter(function(t){return t.ext}),this._updatePicked(),this.update(),this.layout.update(!1),this.view.render.render()):this._data},on:function(t,n){var i=this;return(Array.isArray(t)?t:[t]).map(function(t){var e;return((e=i.evtHandler)[t]||(e[t]=[])).push(n)})},fire:function(t){for(var e,n,i,r,o=[],s=[],a=1,u=arguments.length;a<u;++a)s.push(arguments[a]);for(e=s,a=0,i=(n=this.evtHandler[t]||[]).length;a<i;++a)r=n[a],o.push(r.apply(this,e));return o},isSelected:function(e){var n=this;return this._range&&this._range.length?!!this._range.filter(function(t){return e>=t.ext[0]&&e<t.ext[1]&&n._picked[t.key]}).length:!!this._picked[e]},mode:function(){return"shrink"===((this.cfg.subset||{}).mode||"shrink")?"shrink":"dim"},opacity:function(){var t;return null!=(t=(this.cfg.subset||{}).opacity)?t:.2},isVisible:function(t){return"shrink"!==this.mode()||this.isSelected(t)},select:function(t){var e;return null==t?this._picked=Object.fromEntries(this._data.map(function(t){return[t.key,!0]})):(e=Object.fromEntries(t.map(function(t){return[t,!0]})),this._picked=Object.fromEntries(this._data.map(function(t){return[t.key,!!e[t.key]]}))),this.view.render.render("legend"),this},selected:function(){var e=this,t=this._data.filter(function(t){return!!e._picked[t.key]}).map(function(t){return t.key});return t.length===this._data.length?null:t}}),null!=z&&((z.utils||(z.utils={})).legend=c)}.call(this),function(){var h,t;function c(t,e){var n,i={}.hasOwnProperty;for(n in e)i.call(e,n)&&(t[n]=e[n]);return t}h=function(t){return document.createElementNS("http://www.w3.org/2000/svg",t)},(t=function(t){var i,e=this;return this.dir={bottom:0,left:2}[(t=null==t?{}:t).direction||"bottom"],this.name=t.name||"axis",this.layout=t.layout||new layout({root:this.root}),this._ticks=[],this._scale=t.scale||function(t){return t},this._format=z.utils.format.simple,this._config(t.cfg),this._map={},this._n=i={root:h("g"),layout:this.layout.getNode(this.name),render:this.layout.getGroup(this.name),wrap:null,domain:h("path")},i.render.appendChild(i.root),i.root.appendChild(i.domain),i.label=h("text"),i.label.textContent="",(t=i.label).setAttribute("dominant-baseline","hanging"),t.setAttribute("text-anchor","middle"),i.root.appendChild(i.label),i.sideNote=[0,1].map(function(t){var e,n=h("text");return n.textContent="",(e=n).setAttribute("dominant-baseline","hanging"),e.setAttribute("text-anchor",["start","end"][t]),i.root.appendChild(n)}),this.wrapper(),(t=this.layout).on("update",function(){return e.update()}),t.on("render",function(){return e.render()}),this}).prototype=c(Object.create(Object.prototype),{wrapper:function(){var t,e=this._n;return e.wrap&&e.wrap.parentNode&&e.wrap.parentNode.removeChild(e.wrap),e.wrap=document.createElement("div"),c(((t=e.wrap.style).visibility="hidden",t.position="absolute",t.top=0,t.left=0,t.pointerEvents="none",t.userSelect="none",t.zIndex=0,t.wordBreak="break-all",t.lineHeight=".95em",t),this.dir<2&&null!=this.cfg.textWidth?{whiteSpace:"wrap",width:(1<(t=this.cfg.textWidth)?t:1)+"em"}:{whiteSpace:"pre",width:"4em"}),e.layout.appendChild(e.wrap)},_config:function(e){var t,n=this;return null==e&&(e={}),this.cfg={tick:{inner:8},baseline:{},label:{padding:1,direction:"horizontal",gap:1.5,strategy:"stride",tolerance:.2},caption:{padding:1},enabled:e.enabled,sideNoteStart:{padding:1},sideNoteEnd:{padding:1}},["tick","baseline","label","caption","sideNoteStart","sideNoteEnd"].map(function(t){return c(n.cfg[t],e[t]||{})}),(t=this.cfg.label).font||(t.font={}),(t=this.cfg.caption).font||(t.font={}),(t=this.cfg.sideNoteStart).font||(t.font={}),(t=this.cfg.sideNoteEnd).font||(t.font={}),this.format(this.cfg.label.format)},config:function(t){return null==t?this.cfg:(this._config(t),this.wrapper())},format:function(t){return null==t?this._format:this._format="string"==typeof t?z.utils.format.from(t):t||z.utils.format.simple},scale:function(t){return null!=t?this._scale=t:this._scale},caption:function(t){return arguments.length&&(this._caption=t),!this.cfg.enabled||null!=this.cfg.caption.show&&!this.cfg.caption.show?this._n.label.textContent="":this._n.label.textContent=this.cfg.caption.text||this._caption||""},update:function(){},ticks:function(n){var t,e,i,r=this,o={},s=this._n.layout.getBoundingClientRect()[this.dir<2?"width":"height"],a=this.dir<2&&"horizontal"!==this.cfg.label.direction?12:25,s=Math.round(s/a),u=1<(t=Math.round(n.length/(1<s?s:1)))?t:1,l="ends"===this.cfg.label.strategy;for(e in this._ticks=n.filter(function(t,e){return!(e%u)||l&&e===n.length-1}).map(function(t){var e,n;return o[(t="object"!=typeof t?{v:t}:t).v]=c((e=r._map)[n=t.v]||(e[n]={}),t)}),t=this._map)i=t[e],o[e]||i.n.g.parentNode.removeChild(i.n.g);return this._map=o,this._ticks.filter(function(t){return!t.n}).map(function(t){if(t.n={g:h("g"),p:h("path"),t:h("g")},t.n.g.appendChild(t.n.p),t.n.g.appendChild(t.n.t),r._n.root.appendChild(t.n.g),isNaN(+t.v))return t.t=t.v})},render:function(){var i,t,r,e,n,o,s,a=this,u=this._n,l=this.dir<2,h=u.wrap;if(h.style.fontSize=this.cfg.label.font.size?this.cfg.label.font.size+""||"":void 0,h.setAttribute("class",(this.cfg.label.font.family||{}).className||""),i=this._ticks,null==this.cfg.enabled||this.cfg.enabled)return l?((t=u.layout.style).height="",t.paddingTop="",t.paddingBottom=""):((t=u.layout.style).width="",t.paddingLeft="",t.paddingRight=""),u.domain.style.display="",i.map(function(t){return t.n.g.style.display=""}),r=getComputedStyle(h).fontSize,e=u.layout.getBoundingClientRect(),(t=u.domain.style).strokeWidth=1,t.stroke="currentColor",t.fill="none",i.map(function(t,e){var n,e=e?e===i.length-1?2:1:0;return t._c=null!=t.c?t.c:a._scale(t.v)+(a._scale.bandwidth?a._scale.bandwidth()/2:0),t._t=null!=t.t?t.t:a._format(t.v),(n=t.n.p.style).strokeWidth=1,n.stroke="currentColor",n.fill="none",h.textContent=t._t,h.style.textAlign=l?["left","center","right"][e]:["right","left"][a.dir-2],t.n.tt=wrapSvgText({node:h}),t.n.t.style.fontSize=r,t.n.t.style.fill=a.cfg.label.color,t.n.t.textContent="",t.n.t.appendChild(t.n.tt),t.n.t.setAttribute("class",(a.cfg.label.font||{}).className||"")}),i.sort(function(t,e){return t._c-e._c}),u.domain.style.stroke=this.cfg.baseline.show?this.cfg.baseline.color:"none",n=(this.cfg.caption.position||0)%3,o=Math.floor((this.cfg.caption.position||0)/3),(s=u.label).setAttribute("text-anchor",["start","middle","end"][n]),s.setAttribute("dominant-baseline",["baseline","hanging"][o]),u.sideNote.map(function(t,e){e=(a.cfg[["sideNoteStart","sideNoteEnd"][e]]||{}).position||0;return t.setAttribute("dominant-baseline",["baseline","hanging"][e])}),l?(u.domain.setAttribute("d","M0 0L"+e.width+" 0Z"),u.label.setAttribute("x",e.width/2),u.label.setAttribute("x",[2,e.width/2,e.width-2][n])):(u.domain.setAttribute("d","M0 0L0 "+e.height+"Z"),s=[2,e.height/2,e.height-2][n],u.label.setAttribute("transform","translate(0,"+s+") rotate(90)")),i.map(function(t){return t.box=t.n.t.getBBox()}),this.adjust();l?((t=u.layout.style).height="0px",t.paddingTop="0",t.paddingBottom="0"):((t=u.layout.style).width="0px",t.paddingLeft="0",t.paddingRight="0"),u.domain.style.display="none",i.map(function(t){return t.n.g.style.display="none"})},adjust:function(){for(var t,r,e,n,i,o,s,u,l,a,h,c,f,d,p,m,y,_,g=this,v=this._ticks,b=this.dir<2,x=(parseFloat(getComputedStyle(this._n.wrap).fontSize)||16)*(null!=this.cfg.label.gap?this.cfg.label.gap:1.5),w=function(t){for(var e,n=null,i=0,r=t.length;i<r;++i){if(e=t[i],e=v[e],null!=n&&e._start-(n._start+n._size)<x)return!1;n=e}return!0},k=function(t,e,n){var i=b&&"vertical"===n,n=b&&"angled"===n,r=null!=g.cfg.label.angle?g.cfg.label.angle:45,o=[Math.cos(r*Math.PI/180),Math.sin(r*Math.PI/180)],s=o[0],o=o[1],e=e?e===v.length-1?2:1:0,a=t._c,u=t.box,l={x:-u.x,y:-u.y},h=!g._scale.bandwidth&&(null!=g.cfg.tick.boundaryOffset?!!g.cfg.tick.boundaryOffset:g.dir<2),h=!i&&h?e/2:.5;return i?(l.x-=u.width,l.y-=u.height*h):n?l.x-=u.width:b?l.x-=u.width*h:l.y-=u.height*h,t.n.tt.setAttribute("transform","translate("+l.x+","+l.y+")"),t._size=i?u.height:n?u.width*s+u.height*o:u[b?"width":"height"],t._sizeAlt=i?u.width:n?u.width*o+u.height*s:u[b?"height":"width"],t._start=n?a-u.width*s:a-t._size*h,b?(t.n.g.setAttribute("transform","translate("+a+",0)"),t.n.p.setAttribute("d","M0 0L0 "+g.cfg.tick.inner),e=g.cfg.tick.inner+g.cfg.label.padding,t.n.t.setAttribute("transform","translate(0,"+e+")"+(i?" rotate(-90)":n?" rotate("+-r+")":""))):(t.n.g.setAttribute("transform","translate(0,"+a+")"),t.n.p.setAttribute("d","M0 0L-"+g.cfg.tick.inner+" 0"),t.n.t.setAttribute("transform","translate("+(-g.cfg.tick.inner-t._sizeAlt-1-g.cfg.label.padding)+",0)")),t.n.p.style.stroke=g.cfg.tick.color||""},A=b&&"auto"===this.cfg.label.direction?["horizontal","angled","vertical"]:[this.cfg.label.direction||"horizontal"],M=[],N=0,S=v.length;N<S;++N)r=N,M.push(r);for(t=M,N=0,e=A.length;N<e&&(n=A[N],v.map(z),!w(t));++N);if(i=[0],1<v.length)if("ends"!==this.cfg.label.strategy){for(o=1;o<v.length&&!w((()=>{var t,e,n,i=[];for(t=0,n=v.length,e=o;e<0?n<t:t<n;t+=e)r=t,i.push(r);return i})());)o++;for(M=[],N=0,S=v.length;o<0?S<N:N<S;N+=o)r=N,M.push(r);i=M}else for(s=null!=this.cfg.label.tolerance?this.cfg.label.tolerance:.2,_=[v[0]._c,v[v.length-1]._c],u=_[0],l=_[1],a=function(t){for(var e,n,i,r,o,s=[],a=0;a<=t;++a){for(e=u+(l-u)*a/t,n=0,i=1,r=v.length;i<r;++i)o=i,Math.abs(v[o]._c-e)<Math.abs(v[n]._c-e)&&(n=o);s[s.length-1]!==n&&s.push(n)}return s},h=function(t){var e,n,i,r;if(!(t.length<3)&&(e=(v[t[t.length-1]]._c-v[t[0]]._c)/(t.length-1)))for(n=0,i=t.length-1;n<i;++n)if(r=v[t[(r=n)+1]]._c-v[t[r]]._c,Math.abs(r-e)>e*s+.5)return!1;return!0},N=v.length-1;1<=N;--N)if(1<(c=a(N)).length&&h(c)&&w(c)){i=c;break}return f={},i.map(function(t){return f[t]=!0}),v.map(function(t,e){return t.n.t.style.opacity=f[e]?1:0}),_=v.filter(function(t,e){return f[e]}),this._n.label.style.fill=this.cfg.caption.color,this._n.label.style.fontSize=this.cfg.caption.font.size?this.cfg.caption.font.size+""||"":void 0,this._n.label.setAttribute("class",(this.cfg.caption.font.family||{}).className||""),this.caption(),this._n.sideNote.map(function(t,e){var e=g.cfg[["sideNoteStart","sideNoteEnd"][e]]||{},n=e.font||{};return t.textContent=e.show&&e.text||"",t.style.fill=e.color,t.style.fontSize=n.size?n.size+""||"":void 0,t.setAttribute("class",(n.family||{}).className||"")}),d=(this.cfg.caption.position||0)%3,p=Math.floor((this.cfg.caption.position||0)/3),_=Math.max.apply(Math,[0].concat(_.map(function(t){return t._sizeAlt}))),m=this.cfg.tick.inner+this.cfg.label.padding+this.cfg.caption.padding+_,this.dir<2?(this._n.label.setAttribute("y",[-2,m][p]),this._n.layout.style.height=m+this._n.label.getBoundingClientRect().height+"px",y=this._n.layout.getBoundingClientRect(),this._n.sideNote.map(function(t,e){var n=g.cfg[["sideNoteStart","sideNoteEnd"][e]]||{},i=n.position||0;return t.setAttribute("x",[2,y.width-2][e]),t.setAttribute("y",[-2-n.padding,m+n.padding][i])})):(this._n.label.setAttribute("x",0),this._n.label.setAttribute("y",0),this._n.layout.style.width=m+this._n.label.getBoundingClientRect().width+"px",_=[2,(y=this._n.layout.getBoundingClientRect()).height/2,y.height-2][d],this._n.label.setAttribute("transform","translate("+[2,-m-2][p]+","+_+") rotate(90)"),this._n.root.setAttribute("transform","translate("+(y.width-1)+",0)"),this._n.sideNote.map(function(t,e){var n=g.cfg[["sideNoteStart","sideNoteEnd"][e]]||{},i=n.position||0,e=[2,y.height-2][e];return t.setAttribute("transform","translate("+[2+n.padding,-m-2-n.padding][i]+","+e+") rotate(90)")}));function z(t,e){return k(t,e,n)}}}),null!=z&&((z.utils||(z.utils={})).axis=t)}.call(this),function(){var t,e=function(t){var e,n=this;return this.root="string"==typeof(t=null==t?{}:t).root?document.querySelector(t.root):t.root,this.tip="string"==typeof t.node?this.root.querySelector(t.node):t.node,this.margin=null!=t.margin?t.margin:10,this.type="over"===t.type?"over":"move",this.accessor=t.accessor,this.range=t.range,this.zmgr=t.zmgr,this._z=0,this.enabled=!0,this.tip||(this.tip=document.createElement("div"),this.tip.innerHTML='<div ld="group" style="font-size:.75em"></div>\n<div ld="name" style="font-size:.85em"></div>\n<div ld="value" style="font-weight:bold;font-size:1.1em;line-height:1.2em"></div>\n<div ld="value-alt" style="font-size:0.9em;line-height:1em"></div>',this.root.appendChild(this.tip),(e=this.tip.style).padding=".4em .5em",e.background="#13171a",e.color="#fff",e.borderRadius="3px",e.boxShadow="0 2px 4px rgba(0,0,0,.3)",e.lineHeight="1.2em",e.fontSize=".9em",e.maxWidth="10em",e.wordBreak="break-all"),(e=this.tip.style).position="absolute",e.zIndex=1,e.top=0,e.left=0,e.pointerEvents="none",e.userSelect="none",e.opacity=0,e.transition="opacity .15s ease-in-out"+("over"===this.type?", transform .15s ease-in-out":""),this.view=new ldview({root:this.tip,text:t.view||{group:function(t){t=t.ctx;return t?t.group:""},name:function(t){t=t.ctx;return t?t.name:""},value:function(t){t=t.ctx;return t?t.value:""},"value-alt":function(t){t=t.ctx;return t?t.valueAlt:""}}}),this.hide=b(3e3,function(){if(this.tip.style.opacity=0,this.zmgr)return this.zmgr.remove(this._z)}),this._evthdr={},this.accessor&&(this.root.addEventListener("over"===this.type?"mouseover":"mousemove",this._evthdr.over=function(t){var e;if(t.target&&(e=n.accessor({evt:t})))return n.render({data:e,node:t.target,evt:t})}),this.root.addEventListener("mouseout",this._evthdr.out=function(){return n.hide().now()})),this};e.prototype=((t=Object.create(Object.prototype)).destroy=function(){if(this._evthdr.over&&this.root.removeEventListener("over"===this.type?"mouseover":"mousemove",this._evthdr.over),this._evthdr.out)return this.root.removeEventListener("mouseout",this._evthdr.out)},t.toggle=function(t){return null==t?this.enabled:this.enabled=t},t.render=function(t){var e,n,i,r,o,s,a;if(null==t&&(t={}),this.enabled)return this.view.ctx(t.data),this.view.render(),e=this.root.getBoundingClientRect(),i=null!=t.node?((i=t.node.getBoundingClientRect()).x=i.x-e.x,i.y=i.y-e.y,i):null!=t.box?t.box:{x:t.x,y:t.y,width:t.width,height:t.height},n=this.tip.getBoundingClientRect(),r=(t=[t.evt.clientX-e.x,t.evt.clientY-e.y])[0],a=t[1],s=this.margin,i=(t=[i.x+(null!=i.width?i.width/2:0),i.y+(null!=i.height?i.height/2:0)])[0],o=t[1],i=(t=[(t=[r-n.width/2,a-n.height/2])[0]+(i<r?1:-1)*(s+n.width/2),t[1]+(o<a?1:-1)*(s+n.height/2)])[0],r=t[1],i=(t=[((t=(i>(a=(o=this.range?this.range():e).x-e.x)?i:a)+n.width)<(s=o.width+o.x-e.x)?t:s)-n.width,((t=(r>(a=o.y-e.y)?r:a)+n.height)<(s=o.height+o.y-e.y)?t:s)-n.height])[0],r=t[1],(t=this.tip.style).transform="translate("+i+"px,"+r+"px)",t.opacity=1,t.zIndex=this._z=this.zmgr?this.zmgr.add(10):10,this.hide()},t),null!=z&&((z.utils||(z.utils={})).tip=e)}.call(this),function(){var d,p,m,r,y,_,S;d=1e-9,p=function(t){return+(+t).toPrecision(12)},m=function(t){return Math.abs(t-Math.round(t))<d},r=function(t,e){var t=t/(1<e?e:1);return 0<t?(t=(t=t/(e=Math.pow(10,Math.floor(Math.log10(t)))))>=Math.sqrt(50)?10:t>=Math.sqrt(10)?5:t>=Math.sqrt(2)?2:1,p(t*e)):1},y=function(t,e,n,i){i=0<i.count?i.count:Math.ceil(Math.log2(1<(i=t.length)?i:1))+1;return n===e&&m(e)||(n=e<n?n-e:Math.abs(e)||1,e=r(n,i),t.every(m)&&e<1)?1:e},_=function(t,e){t=(t-e.start)/e.width;return Math.abs(t-Math.round(t))<d&&(t=Math.round(t)),"right"===e.closed?Math.ceil(t)-1:Math.floor(t)},S={edges:function(t,e){var n,i,r,o,s,a,u,l,h,c,f;if(null==e&&(e={}),t=(t=null==t?[]:t).filter(function(t){return"number"==typeof t&&isFinite(t)}),n="right"===e.closed?"right":"left",i=isFinite(+e.anchor)?+e.anchor:0,r=e.max||500,!t.length)return{start:i,width:+e.width||1,anchor:i,closed:n,discrete:!1,n:0,edges:[]};for(a={width:s=r<((o=(r=[Math.min.apply(Math,t),Math.max.apply(Math,t)])[1])-(u=r[0]))/(s=0<+e.width?+e.width:y(t,u,o,e))?y(t,u,o,{count:e.count}):s,anchor:i,closed:n,discrete:e=m(s)&&m(i)&&t.every(m)},t=(u-i)/s,Math.abs(t-Math.round(t))<d&&(t=Math.round(t)),a.start=p(i+s*("left"==n?Math.floor(t):!e&&m(t)?t:Math.ceil(t)-1)),u=_(o,a),!e&&"left"==n&&0<u&&m((o-a.start)/s)&&(u-=1),a.n=1<(r=u+1)?r:1,l=[],h=0,c=a.n;h<=c;++h)f=h,l.push(p(a.start+s*f));return a.edges=l,a},index:function(t,e){var n;return"number"!=typeof t||!isFinite(t)||!e.n||(n=_(t,e),e.discrete||-1===(n=n===e.n&&"left"===e.closed&&Math.abs(t-e.edges[e.n])<d*e.width?e.n-1:n)&&"right"===e.closed&&Math.abs(t-e.edges[0])<d*e.width&&(n=0),n<0)||n>=e.n?-1:n},range:function(t,e){var t=[e.edges[t],e.edges[t+1]],n=t[0],t=t[1];return e.discrete?"right"===e.closed?[p(n+1),t]:[n,p(t-1)]:[n,t]},label:function(t,e,n){var i,r=(n=null==n?{}:n).format&&null!=z&&null!=(i=z.utils)&&i.format?z.utils.format.from(n.format):function(t){return p(t)+""},o=(i=S.range(t,e))[0],s=i[1];switch(n.label){case"start":return r(o);case"center":return r(p((e.edges[t]+e.edges[t+1])/2));default:return o===s?r(o):r(o)+"–"+r(s)}},count:function(t,e,n){var i,r,o,s,a,u,l,h,c,f,d,p,m;for(null==t&&(t=[]),i=n&&1<(r=(n[0]||[]).length)?r:1,s=[],a=0,u=e.n;a<u;++a)l=a,s.push(((t,e)=>{for(var n=[];0<e;(e>>=1)&&(t=t.concat(t)))1&e&&n.push.apply(n,t);return n})([0],i));for(o=s,a=0,h=t.length;a<h;++a)if(f=t[c=a],!((l=S.index(f,e))<0))if(n)for(d=0;d<i;++d)p=d,m=+(n[c]||[])[p],isFinite(m)&&(o[l][p]+=m);else o[l][0]+=1;return o},parse:function(t){for(var n,e,i,r,o,s,a,u,l,h,c,f,d,p,m,y=[(t=null==t?{}:t).value||"value",t.size||"size",t.name||"name"],_=y[0],g=y[1],v=y[2],b=t.config||(this.cfg||{}).bin||{},x=(x=this.binding[g])?Array.isArray(x)?x:[x]:[],w=(this.binding[_]||{}).key,k=[],A=0,M=x.length;A<M;++A)(i=x[e=A])&&i.key===w||k.push(e);for(r=(n=k).length,t=this._parseRows(this.raw||[]),y=this._frames&&null!=z&&null!=(y=z.scopes)&&y.frame?z.scopes.frame.all.call(this):t,o=S.edges(y.map(function(t){return t[_]}),b),y=function(t){return r?t.map(function(t){var e=[].concat(t[g]);return n.map(function(t){return e[t]})}):null},a=S.count((s=function(t){return t.map(function(t){return t[_]})})(t),o,y(t)),u=this._subset?S.count(s(this._parseRows(this._subset)),o,y(this._parseRows(this._subset))):null,l="shrink"===(((this.cfg||{}).common||{}).subset||{}).mode,k=[],A=0,c=o.n;A<c;++A)e=A,k.push(S.label(e,o,b));if(h=k,new Set(h).size!==h.length){for(k=[],A=0,c=o.n;A<c;++A)e=A,k.push(S.label(e,o,{label:b.label}));h=k}for(f=[],A=0,c=o.n;A<c;++A)e=A,!1===b.empty&&a[e].every(N)||((d={})[v]=h[e],d[g]=a[e],m=(p=[o.edges[e],o.edges[e+1]])[0],d.bin={x0:m,x1:p[1],index:e},u&&(d.subset={},d.subset[g]=u[e],l)&&(d[g]=u[e]),d._idx=f.length,d._raw=((p=((t,e)=>{var n,i={}.hasOwnProperty;for(n in e)i.call(e,n)&&(t[n]=e[n]);return t})({},d.bin)).count=a[e],p),f.push(d));return{data:f,info:o,series:r||1,keep:n};function N(t){return!t}},filter:function(t,e,n){var i=[n.edges[t],n.edges[e+1]],r=n.closed;return n.discrete||"right"===(r="left"===r&&e===n.n-1?"both":r)&&0===t&&(r="both"),{type:"range",value:[i[0],i[1]],closed:r}},select:function(t,e){var n,i,r,o,s,a;if(!t||"range"!==t.type||!Array.isArray(t.value)||!e.n)return null;for(n=(t=t.value)[0],i=t[1],r=[],o=0,s=e.n;o<s;++o)a=o,e.edges[a+1]>n&&e.edges[a]<i&&r.push(a);return(t=r).length?[t[0],t[t.length-1]]:null}},null!=z&&((z.utils||(z.utils={})).bin=S)}.call(this),z.utils.debounce=b,"undefined"!=typeof window&&null!==window&&(window.chart=z)}();
1
+ !function(){var b=function(u,l){var t,h,c;return"number"==typeof u&&null==l?new Promise(function(t){return setTimeout(t,u)}):("function"==typeof l&&(u=(t=[l,u])[0],l=t[1]),l=l||{},t="object"==typeof u?[u.func,u]:[u,{delay:"object"==typeof l?l.delay||750:l}],u=t[0],l=t[1],h={},(c=function(){for(var e,n,i,t,o=this,r=[],s=0,a=arguments.length;s<a;++s)r.push(arguments[s]);return e=r,n=!1,i=c.delay.value||l.delay||750,c.delay.value=0,(t=new Promise(function(r,t){if(!n)return h.h&&c.clear(),h.res=r,h.rej=t,h.h=setTimeout(function(){var t=u.apply(o,e);return t&&"function"==typeof t.then?t.then(function(){for(var t,e=[],n=0,i=arguments.length;n<i;++n)e.push(arguments[n]);return t=e,r.apply(null,t)}):r(t),h.res=null,h.rej=null,h.h=0,h},i)})).now=function(){return n=!0,c.clear(),u.apply(o,e)},t.cancel=function(){return c.clear()},t}).clear=function(){return clearTimeout(h.h),h.res&&h.res(null),h.h=0,h.res=null,h.rej=null,h},c.delay=function(t){return c.delay.value=t,c},c)},k={exports:{}},z=(!function(){var x,e,c,f,d,t,n,o,r,s,i,a,u,l,h,p,m,y,_,g;function v(t,e,f){function d(t,e){return n.call(t,e)}var p={}.toString,n={}.hasOwnProperty,m=!0;return function t(e,n,i){var r,o,s,a,u,l,h,c;if(null==e||null==n)return e===n;if(e.__placeholder__||n.__placeholder__)return!0;if(e===n)return 0!==e||1/e==1/n;r=p.call(e);if(p.call(n)!=r)return!1;switch(r){case"[object String]":return e==String(n);case"[object Number]":return e!=+e?n!=+n:0==e?1/e==1/n:e==+n;case"[object Date]":case"[object Boolean]":return+e==+n;case"[object RegExp]":return e.source==n.source&&e.global==n.global&&e.multiline==n.multiline&&e.ignoreCase==n.ignoreCase}if("object"!=typeof e||"object"!=typeof n)return!1;o=i.length;for(;o--;)if(i[o]==e)return!0;i.push(e);s=0;a=!0;if("[object Array]"==r){if(u=e.length,l=n.length,m){switch(f){case"===":a=u===l;break;case"<==":a=u<=l;break;case"<<=":a=u<l}s=u,m=!1}else a=u===l,s=u;if(a)for(;s--&&(a=s in e==s in n&&t(e[s],n[s],i)););}else{if("constructor"in e!="constructor"in n||e.constructor!=n.constructor)return!1;for(h in e)if(d(e,h)&&(s++,!(a=d(n,h)&&t(e[h],n[h],i))))break;if(a){for(h in c=0,n)d(n,h)&&++c;a=m?"<<="===f?s<c:"<=="===f?s<=c:s===c:(m=!1,s===c)}}i.pop();return a}(t,e,[])}function w(t,e){var n,i={}.hasOwnProperty;for(n in e)i.call(e,n)&&(t[n]=e[n]);return t}x="http://www.w3.org/2000/svg",e=new function(t){var n=new Intl.NumberFormat(t),t=n.formatToParts(12345.6),e=Array.from({length:10}).map(function(t,e){return n.format(e)}),i=new Map(e.map(function(t,e){return[t,e]}));return this._group=new RegExp("["+t.find(function(t){return v(t.type,"group","===")}).value+"]","g"),this._decimal=new RegExp("["+t.find(function(t){return v(t.type,"decimal","===")}).value+"]"),this._numeral=new RegExp("["+e.join("")+"]","g"),this._index=function(t){return i.get(t)},this}("en-US"),c=function(t){return(t=((t=null==t?"":t)+"").trim().replace(e._group,"").replace(e._decimal,".").replace(e._numeral,e._index))?+t:NaN},f=function(t){return"number"==typeof t?t:!t&&0!==t||isNaN(+t)?0:+t},d=function(t){return!(!/[RIT]/.exec((t=null==t?{}:t).type||"")||/[CN]/.exec(t.type||""))},t=function(e){var t,n,i,r,o,s=[];for(n in e=null==e?{}:e)s.push(n);for(t=s,i=0,o=(r=["name","order"]).length;i<o;++i)if(e[n=r[i]]&&!d(e[n]))return n;return t.filter(function(t){return!d(e[t])})[0]},n=function(){var u,l,h,a=this,c=(this.mod||{}).dimension||{};if(this._subset)return u=t(c),l=this._subset.map(function(e){var t,n,i,r,o={};for(t in n=c)i=n[t],(r=a.binding[t])&&(o[t]=i.multiple?(r.map?r:[r]).map(s):e[r.key],d(i))&&(o[t]=Array.isArray(o[t])?o[t].map(f):f(o[t]));return o;function s(t){return e[t.key]}}),h={},u&&l.map(function(t){return h[t[u]+""]=t}),this.data.map(function(t,e){var n,i,r,o=u?h[t[u]+""]:l[e],s={};for(n in i=c)r=i[n],d(r)&&(s[n]=r.multiple?(t[n]||[]).map(a):o?f(o[n]):0);return t.subset=s;function a(t,e){return o?f((o[n]||[])[e]):0}}),"shrink"===(((this.cfg||{}).common||{}).subset||{}).mode?this.data.map(function(t){var e,n,i,r=[];for(e in n=c)i=n[e],d(i)&&r.push(t[e]=t.subset[e]);return r}):void 0;this.data.map(function(t){var e=t.subset;return delete t.subset,e})},o=function(t){return!(!t||Array.isArray(t)||!Array.isArray(t.frames))},r=function(t){return"number"==typeof t||"string"==typeof t&&t.trim()&&!isNaN(+t)},s=function(t){return t instanceof Date||"string"==typeof t&&!isNaN(Date.parse(t))},i=function(t){var e,n,o,i;return e=((t=null==t?{}:t).frames||[]).map(function(t,e){return{id:null!=t.id?t.id:e,raw:t.raw||[]}}),t=t.frameOrder,Array.isArray(t)&&t.length?(n={},e.map(function(t){return n[t.id+""]=t}),(o=t.map(function(t){return n[t+""]}).filter(function(t){return t})).concat(e.filter(function(t){for(var e=t,n=o,i=-1,r=n.length>>>0;++i<r;)if(e===n[i])return!1;return!0}))):(t=e.map(function(t){return t.id})).length&&t.every(r)?e.map(function(t,e){return{f:t,i:e}}).sort(function(t,e){return+t.f.id-+e.f.id||t.i-e.i}).map(function(t){return t.f}):t.length&&t.every(s)?(i=function(t){return t instanceof Date?t.getTime():Date.parse(t)},e.map(function(t,e){return{f:t,i:e}}).sort(function(t,e){return i(t.f.id)-i(e.f.id)||t.i-e.i}).map(function(t){return t.f})):e},a=function(t){var e,n;if("string"!=typeof t)return null;if(t=t.trim(),e=/^#([0-9a-f]{3})$/i.exec(t)){for(var i,r=[],o=0,s=(i=e[1].split("")).length;o<s;++o)n=i[o],r.push(parseInt(n+n,16));return r}return(e=/^#([0-9a-f]{6})$/i.exec(t))?[0,1,2].map(function(t){return parseInt(e[1].substr(2*t,2),16)}):(e=/^rgba?\(([^)]+)\)$/i.exec(t))&&3===(t=e[1].split(",").slice(0,3).map(function(t){return parseFloat(t.trim())})).length&&t.every(function(t){return!isNaN(t)})?t:null},u=function(t,e,n){var i,r,o,s;for(r in null==n&&(n={}),i={},o=w(w({},e=null==e?{}:e),n||{}))s=o[r],i[r]="function"==typeof s?s.bind(t):s;return i},l=function(t,e,n){for(var i=t;t&&t!==n;)t=t.parentNode;if(t!==n)return null;if(!e)return t;for(t=i;t&&t!==n&&(!t.matches||(t.matches,!t.matches(e)));)t=t.parentNode;return t!==n||n.matches&&n.matches(e)?t:null},(h=function(){return this.running=!1,this.time={now:0,last:0},this.fps(60),this.evtHandler={},this}).prototype=w(Object.create(Object.prototype),{on:function(t,n){var i=this;return(Array.isArray(t)?t:[t]).map(function(t){var e;return((e=i.evtHandler)[t]||(e[t]=[])).push(n)})},fire:function(t){for(var e,n,i,r,o=[],s=[],a=1,u=arguments.length;a<u;++a)s.push(arguments[a]);for(e=s,a=0,i=(n=this.evtHandler[t]||[]).length;a<i;++a)r=n[a],o.push(r.apply(this,e));return o},reset:function(){return this.time={now:0}},setTime:function(t){return this.time.now=t},getTime:function(){return this.time.now},isRunning:function(){return this.running},toggle:function(t){return null!=t&&(this.running=!t),this.running?this.pause():this.run()},pause:function(){return this.running=!1},render:function(t){return this.fire("tick",this.time.now,t=null==t?0:t)},run:function(t){var e=this;if(null!=t&&this.fps(t),!this.running)return this.running=!0,requestAnimationFrame(function(t){return e.handler(e.time.last=t,!0)})},throttle:function(t){return this.isThrottled=t=null==t?!0:t},fps:function(t){return null==t?this._fps_val:(this._fps_val=.01<t?t:.01,this._fps_delay=1e3/this._fps_val)},handler:function(t,e){var n,i,r=this;if(null==e&&(e=!1),this.running)return this.external&&this.external()?(this.time.last=t,requestAnimationFrame(function(t){return r.handler(t,!1)})):(this.time.now=t,n=this.isThrottled?1e3<(n=this._fps_delay)?n:1e3:this._fps_delay,(e||(i=this.time.now-this.time.last)>=n)&&(this.time.last=t,this.render(e?0:i)),requestAnimationFrame(function(t){return r.handler(t,!1)}))}}),p={list:[],init:function(){var t,n,i=this;return this.inited=!0,t=null==document.hidden&&null==document.msHidden&&null!=document.webkiHidden?["webkitHidden","webkitvisibilitychange"]:["hidden","visibilitychange"],n=t[0],document.addEventListener(t[1],b(150,function(){var e=!!document[n];return i.list.map(function(t){return t.throttle(e)})}))},add:function(t){return this.inited||this.init(),this.list.push(t)}},m={wm:new WeakMap,ro:new ResizeObserver(function(t){return t.map(function(t){return m.wm.get(t.target)._resize()})}),add:function(t,e){return this.wm.set(t,e),this.ro.observe(t)},delete:function(t){return this.ro.unobserve(t),this.wm.delete(t)}},y=function(t,e,n){return null==e&&(e={}),null==n&&(n={}),function(t,e,n){var i,r;for(i in e)r=e[i],null==t[i]?t[i]=r:"object"!=typeof t[i]||"object"!=typeof r||n[i]&&n[i].type||y(t[i],e[i],n[i]);return t}(t=null==t?{}:t,e=JSON.parse(JSON.stringify(e)),n)},_=function(t){var r=function(t,e){var n,i;for(n in null==e&&(e={}),t.child,t)(i=t[n]).type?i.default&&(e[n]=i.default):r(i,e[n]||(e[n]={}));return e};return r(t)},(g=function(t){var e,n,i,r=this;for(e in this.root="string"==typeof(t=null==t?{}:t).root?document.querySelector(t.root):t.root,this.useSample=null==t.useSample||t.useSample,this.autoSelect=null==t.autoSelect||t.autoSelect,this.forceInit=t.forceInit||!1,this.prepareSvg=null==t.prepareSvg||t.prepareSvg,this.layoutOpt=null==t.layout||t.layout,this.delayRender=t.delayRender||!1,this.dataAccessor=null!=t.dataAccessor?t.dataAccessor:function(t){return t?t.data._raw:null},this.data=[],this.raw=t.raw||null,this.mod=t.mod||{},this.cfg=t.config||{},this.seed=t.seed||Math.random(),this.binding=t.binding||{},this._normalizeBinding(),this.evtHandler={},this._subset=t.subset||null,this._frames=null,this._player={playing:!1,pos:0,origin:0,raf:null},o(this.raw)&&(this._setFrames(this.raw),this.raw=(null!=(t=this._frames.list[this._frames.index])?t.raw:void 0)||[]),n=g.scopes){if(i=n[e],null!=this[e])throw new Error("[@plotdb/chart] scope name `"+e+"` is already taken.");this[e]=u(this,i,this.mod[e])}if(null!=this.local)throw new Error("[@plotdb/chart] scope name `local` is already taken.");return this.local=u(this,{},this.mod.local),(g.utils||(g.utils={})).anim&&null==this.anim&&(this.anim=new g.utils.anim),this.anim&&this.anim.on("step",function(){if(r._player.playing)return r._playerTick()}),this.init=proxise.once(function(){return r._init()}),this._resize=null,this._inited=!1,this.autoSelect&&(this.root.addEventListener("click",this._select=function(t){if(t=l(t.target,".data",r.root))return r.fire("select",[{data:r.dataAccessor(t),node:t}])}),this.root.addEventListener("mouseover",this._hover=function(t){if(t=l(t.target,".data",r.root))return r.fire("hover",[{data:r.dataAccessor(t),node:t}])})),this}).prototype=w(Object.create(Object.prototype),{_init:function(){var n,t,e,i=this;return"static"===window.getComputedStyle(this.root).position&&(this.root.style.position="relative"),n=this.layoutOpt?"object"!=typeof this.layoutOpt?this.root.querySelector(".pdl-layout"):"string"==typeof this.layoutOpt.root?this.root.querySelector(this.layoutOpt.root):this.layoutOpt.root||null:null,this.prepareSvg&&!(this.svg=this.root.querySelector("svg"))&&(this.svg=document.createElementNS(x,"svg"),(t=this.svg.style).width="100%",t.height="100%",!this.layoutOpt||(n||console.error("[@plotdb/chart] layout enabled yet layout root isn't configured properly. "),e=n.querySelector("[data-type=render]"))||console.warn("[@plotdb/chart] prepareSvg and layout is configured at the same time,\nyet render container for layout is not found. svg is thus appended in the root."),(e||this.root).appendChild(this.svg)),this._aniloop=new h,p.add(this._aniloop),this._aniloop.on("tick",function(t,e){return i.tick(t,e)}),this.anim&&(this._aniloop.external=function(){return i.anim.manual()},this.anim.on("step",function(t,e){if(i._aniloop.isRunning())return i._aniloop.setTime(t),i._aniloop.render(e)})),Promise.resolve().then(function(){var t;return i.mod.config=y(i.mod.config||{},g.commonConfig),i._defcfg=t=_(i.mod.config),y(i.cfg,t),i.raw&&Array.isArray(i.raw)?{raw:i.raw,binding:i.binding}:i.useSample&&i.mod.sample?(t=i.mod.sample.apply(i)).then?t.then():Promise.resolve(t):void 0}).then(function(t){return i.raw=(t=t||{}).raw,i.binding=t.binding,i}).then(function(){var t,e;return i.raw||(i.raw=[]),i.layoutOpt&&("undefined"==typeof layout||null===layout?console.warn("[@plotdb/chart] layout-opt is set yet @plotdb/layout is not found."):(n||(console.error("[@plotdb/chart] cannot determine root node for @plotdb/layout."),console.error("[@plotdb/chart] config layout properly or disable layout by setting layout to false")),i.layout=new layout("object"==typeof i.layoutOpt?((e=w({},i.layoutOpt)).watchResize=!1,e):{root:n,watchResize:!1}))),t=proxise(function(){return m.add(i.root,i),null}),i._resize=function(){return t.resolve()},e=t(),(i.forceInit||!i.root.offsetParent||"none"===window.getComputedStyle(i.root).display||i.root.offsetWidth&&i.root.offsetHeight)&&t.resolve(),e}).then(function(){return i._resize=function(){}}).then(function(){var t,e=function(){if(i.mod.init)return i.mod.init.apply(i)};return(i.layout?(t=proxise(function(){return Promise.resolve(i.layout.init(e)),null}),i._layout=function(){return t.resolve()},i.layout.on("render",function(){return i._layout()}),t):e)()}).then(function(){i._layout=function(){},Promise.resolve().then(function(){if(i.delayRender&&!i._pendingRaw)return i.renderLock=proxise(function(){}),i.renderLock()}).then(function(){if(i._inited=!0,i._resize=function(){i.anim&&i.anim.immediate(!0);try{return i.resize(),i.render()}finally{i.anim&&i.anim.immediate(!1)}},i._layout=function(){return i.parse(),i.bind(),i.resize(),i.render()},i.parse(),i.bind(),i.resize(),i.render(),i._frames)return i._framesStart()})})},parse:function(){if(this.data=this._parseRows(this.raw),this._frames&&(this._frames.all=null),n.apply(this),this.mod.parse)return this.mod.parse.apply(this)},_parseRows:function(t){var l,e,h;return null==t&&(t=[]),l=(e=this.mod).dimension||(e.dimension={}),h=this.binding,t.map(function(e,t){var n,i,r,o,s={};for(n in i=l)r=i[n],(o=h[n])?(s[n]=r.multiple?(o.map?o:[o]).map(a):e[o.key],/[RIT]/.exec(r.type)&&!/[CN]/.exec(r.type)&&(s[n]=Array.isArray(s[n])?s[n].map(u):c(s[n]))):r.multiple&&(s[n]=[]);return s._raw=e,s._idx=t,s;function a(t){return e[t.key]}function u(t){return c(t)}})},bind:function(){if(this.mod.bind)return this.mod.bind.apply(this)},start:function(){if(this._aniloop.run(),this.mod.start)return this.mod.start.apply(this)},stop:function(){if(this._aniloop.pause(),this.mod.stop)return this.mod.stop.apply(this)},resize:function(){if(this._inited)return this.layout&&this.layout.update(!1),this.box=this.root.getBoundingClientRect(),this.mod.resize?this.mod.resize.apply(this):void 0},tick:function(t,e){if(this.mod.tick)return this.mod.tick.apply(this,[t,e])},render:function(){if(this._inited)return this._syncAnim(),this.mod.render&&this.mod.render.apply(this),this._brushStyle(),this._empty(),this._anno()},_emptyText:function(){var t,e,n=((this.cfg||{}).common||{}).empty||{};return n.text||(n=g.i18nNs+":text",(t="undefined"!=typeof block&&null!==block&&block.i18n&&block.i18n.module?block.i18n.module:null)&&t.t&&(e=t.t(n))&&e!==n&&"text"!==e?e:(n=(t?t.language||t.lng:null)||("undefined"!=typeof document&&null!==document?document.documentElement.lang:"")||"en",(g.i18n[n]||g.i18n[n.split("-")[0]]||(/^zh/i.exec(n)?g.i18n[/cn|hans|sg/i.exec(n)?"zh-CN":"zh-TW"]:void 0)||g.i18n.en).text))},_empty:function(){var t,e=((this.cfg||{}).common||{}).empty||{},n=!(null!=e.enabled&&!e.enabled||(this.data||[]).length);if(this.svg){if(n)return this._emptyG||(this._emptyG=document.createElementNS(x,"g"),this._emptyG.setAttribute("data-type","empty"),this._emptyG.style.pointerEvents="none"),this.svg.appendChild(this._emptyG),this._emptyG.textContent="",n=this._annoBox(),(t=document.createElementNS(x,"text")).setAttribute("x",n.x+n.width/2),t.setAttribute("y",n.y+n.height/2),t.setAttribute("text-anchor","middle"),t.setAttribute("dominant-baseline","middle"),t.style.fill=e.color||"currentColor",t.style.opacity=null!=e.opacity?e.opacity:.45,(e.font||{}).size&&(t.style.fontSize=e.font.size+""),t.textContent=this._emptyText(),this._emptyG.appendChild(t);this._emptyG&&this._emptyG.parentNode&&this._emptyG.parentNode.removeChild(this._emptyG)}},_brushStyle:function(){var t,e,n,i,r,o=[],s=((this.cfg||{}).common||{}).brush||{};if(this.svg){for(t=function(t,e,n){if(null!=n&&""!==n)return t.setAttribute(e,n)},e=0,i=(n=this.svg.querySelectorAll("rect.selection")).length;e<i;++e)t(r=n[e],"fill",s.fill),t(r,"fill-opacity",s.fillOpacity),t(r,"stroke",s.stroke),t(r,"stroke-opacity",s.strokeOpacity),t(r,"stroke-width",s.strokeWidth);for(e=0,i=(n=this.svg.querySelectorAll("rect.handle")).length;e<i;++e)t(r=n[e],"fill",s.handleFill),o.push(t(r,"fill-opacity",s.handleOpacity));return o}},_annoBox:function(){var t;if(this.layout)try{if((t=this.layout.getBox("view"))&&t.width&&t.height)return t}catch(t){}return{x:0,y:0,width:(this.box||{}).width||0,height:(this.box||{}).height||0}},_anno:function(){var t,s,e,n,i,r,o,a,u,l,h,c,f,d,p=this,m=[],y=((this.cfg||{}).common||{}).annotation||{},_=null==y.enabled||!!y.enabled,g=_&&y.notes||[],v=_&&y.reference||[];if(this.svg){if(g.length||v.length){for(this._annoG||(this._annoG=document.createElementNS(x,"g"),this._annoG.setAttribute("data-type","annotation"),this._annoG.style.pointerEvents="none"),this.svg.appendChild(this._annoG),this._annoG.textContent="",t=this._annoBox(),s=y.font||{},e=function(t,e,n,i,r){var o=document.createElementNS(x,"text");return o.setAttribute("x",e),o.setAttribute("y",n),o.setAttribute("text-anchor",i),o.setAttribute("dominant-baseline",r),o.style.fill=t.color||y.color||"currentColor",(t.size||s.size)&&(o.style.fontSize=(t.size||s.size)+""),o.style.opacity=null!=t.opacity?t.opacity:null!=y.opacity?y.opacity:1,o.textContent=t.text+"",p._annoG.appendChild(o),o},n=0,i=g.length;n<i;++n)(r=g[n])&&null!=r.text&&e(r,t.x+t.width*(null!=r.x?r.x:.5),t.y+t.height*(null!=r.y?r.y:.5),r.align||"middle",r.baseline||"middle");for(n=0,i=v.length;n<i;++n)(o=v[n])&&(a="x"===o.axis?"x":"y",null==(u=b.call(this))||isNaN(u)||u<0||u>("y"===a?t.height:t.width)||(l=document.createElementNS(x,"line"),c=(h="y"===a?[t.x,t.y+u,t.x+t.width,t.y+u]:[t.x+u,t.y,t.x+u,t.y+t.height])[1],f=h[2],d=h[3],l.setAttribute("x1",h[0]),l.setAttribute("y1",c),l.setAttribute("x2",f),l.setAttribute("y2",d),w(l.style,{stroke:o.color||y.color||"currentColor",strokeWidth:null!=o.width?o.width:1,strokeDasharray:null!=o.dash?o.dash:"4 3",opacity:null!=o.opacity?o.opacity:null!=y.opacity?y.opacity:.6}),this._annoG.appendChild(l),null!=o.label&&(h="y"===a?[t.x+t.width-2,t.y+u-3,"end","auto"]:[t.x+u+3,t.y+2,"start","hanging"],m.push(e({text:o.label,color:o.color,size:o.size,opacity:o.opacity},h[0],h[1],h[2],h[3])))));return m}this._annoG&&this._annoG.parentNode&&this._annoG.parentNode.removeChild(this._annoG)}function b(){try{return this.space[a](o.value)}catch(t){return null}}},destroy:function(){var t=this;return Promise.resolve().then(function(){if(t._select&&t.root.removeEventListener("click",t._select),t._hover&&t.root.removeEventListener("mouseover",t._hover),m.delete(t.root),t.layout&&t.layout.destroy(),t.pause(),t.stop(),t.mod.destroy)return t.mod.destroy.apply(t)})},config:function(){var t,e,n;if(!arguments.length)return this.cfg;for(t={},e=0,n=arguments.length;e<n;++e)y(t,arguments[e],this.mod.config);return y(t,this.cfg,this.mod.config),y(t,this._defcfg,this.mod.config),w(this.cfg,t)},_normalizeBinding:function(t){var e,n,i,r,o,s,a,u=[];if(null==t){for(t in e=[],this.mod.dimension||{})e.push(t);t=e}for(n=0,i=(t=Array.isArray(t)?t:[t]).length;n<i;++n)r=t[n],o=(this.mod.dimension||{})[r]||{},s=this.binding[r],a=Array.isArray(s),!o.multiple!=!a&&(o.multiple||a)&&u.push(this.binding[r]=a?s[0]:s?[s]:[]);return u},setBind:function(t,e){if(this.binding[t]=e,this._normalizeBinding([t]),this._inited)return this.parse(),this.bind(),this.resize(),this.render()},setRaw:function(t,e,n){var i;return null==n&&(n=!1),!t||Array.isArray(t)||o(t)||("subset"in t&&(this._subset=t.subset||null),t=(i=t).raw,e=i.binding,n=i.reinit),o(t)?(this._setFrames(t),t=(null!=(i=this._frames.list[this._frames.index])?i.raw:void 0)||[]):null!=t&&this._frames&&(this.pause(),this._frames=null,this._player.pos=0,this.anim)&&this.anim.resume(),null!=t&&(this.raw=t),null!=e&&(this.binding=e,this._normalizeBinding()),this.renderLock?(this.renderLock.resolve(),this.renderLock=null):this._inited?(n&&this.mod.init&&this.mod.init.apply(this),this.parse(),this.bind(),this.resize(),this.render(),this._frames?this._framesStart():void 0):this._pendingRaw=!0},_animCfg:function(){return((this.cfg||{}).common||{}).animation||{}},_syncAnim:function(){var t;if(this.anim)return null!=(t=this._animCfg()).transition&&this.anim.duration(t.transition),this.anim.speed(null!=t.speed?t.speed:1)},_setFrames:function(t){var e,t=i(t);return this._frames={list:t,index:0,all:null},this._frames.index=this._frameAt((t=this._player.pos)<(e=this.duration())?t:e)},_interval:function(){return+this._animCfg().interval||1e3},_clock:function(){return this.anim?this.anim.time():("undefined"!=typeof performance&&null!==performance?performance:Date).now()},_frameAt:function(t){var e=this._frames?this._frames.list.length:0;return e?(t=0<(t=Math.floor(t/this._interval()))?t:0)<(e=e-1)?t:e:0},_framesStart:function(){if(this.fire("frame",{index:this._frames.index,id:this.frame.id()}),this._animCfg().autoplay&&!this._player.playing)return this.play()},_goto:function(t,e){var n,i,r,o=this;if(null==e&&(e=0),(n=this._frames)&&n.list.length&&(t=(i=0<t?t:0)<(r=n.list.length-1)?i:r,n.index=t,this.raw=n.list[t].raw,this._inited))return this.parse(),this.bind(),this.resize(),this.anim&&0<e?this.anim.ago(e,function(){return o.render()}):this.render(),this.fire("frame",{index:t,id:n.list[t].id})},duration:function(){return this._frames?this._frames.list.length*this._interval():0},position:function(){var t=this._player;return t.playing?this._clock()-t.origin:t.pos},playing:function(){return this._player.playing},play:function(){var t=this._player;if(this._frames&&!t.playing&&this._frames.list.length)return t.pos>=this.duration()&&(t.pos=0),this._syncAnim(),this.anim&&this.anim.resume(),t.origin=this._clock()-t.pos,t.playing=!0,this.fire("play"),this._playerLoop()},pause:function(){var t=this._player;if(t.playing)return t.pos=this.position(),t.playing=!1,t.raf&&cancelAnimationFrame(t.raf),t.raf=null,this.anim&&this.anim.pause(),this.fire("pause")},seek:function(t){var e,n,i,r;if(this._frames&&this._frames.list.length)return r=this._interval(),n=(t=(i=0<(i=+(t=t&&"object"==typeof t?((t.frame||0)+(t.progress||0))*r:t)||0)?i:0)<(e=this.duration())?i:e)-(e=this._frameAt(t))*r,i=(i=+this._animCfg().transition||0)<r?i:r,0<e&&n<i?(this._goto(e-1),this.anim&&this.anim.flush(),this._goto(e,n)):(this._goto(e),this.anim&&this.anim.flush()),(r=this._player).pos=t,r.playing&&(r.origin=this._clock()-t),this.fire("progress",{time:t,duration:this.duration(),index:e})},_playerLoop:function(){var t,e=this,n=this._player;if(!n.raf&&"undefined"!=typeof requestAnimationFrame&&null!==requestAnimationFrame)return n.raf=requestAnimationFrame(t=function(){if(n.raf=null,n.playing)return e.anim&&e.anim.manual()||e._playerTick(),n.playing?n.raf=requestAnimationFrame(t):void 0})},_playerTick:function(){var t,e,n=this._player,i=this._frames;if(i&&i.list.length){if((t=this.duration())<=(e=this.position())){if(!this._animCfg().loop)return n.pos=t,n.playing=!1,this.fire("progress",{time:t,duration:t,index:i.index}),void this.fire("end");e%=t,n.origin=this._clock()-e}return(n=this._frameAt(e))!==i.index&&this._goto(n,e-n*this._interval()),this.fire("progress",{time:e,duration:t,index:n})}},on:function(t,n){var i=this;return(Array.isArray(t)?t:[t]).map(function(t){var e;return((e=i.evtHandler)[t]||(e[t]=[])).push(n)})},fire:function(t){for(var e,n,i,r,o=[],s=[],a=1,u=arguments.length;a<u;++a)s.push(arguments[a]);for(e=s,a=0,i=(n=this.evtHandler[t]||[]).length;a<i;++a)r=n[a],o.push(r.apply(this,e));return o},filter:function(t,e){var n,i,r,o,s;for(i in null==t&&(t={}),null==e&&(e=!1),n=[],r=this.binding)o=r[i],s=(s=Array.isArray(o)?o:[o]).map(a),n=n.concat(s);for(i in t)o=t[i],n.filter(u).map(l);return e&&this.fire("filter",t),this.mod.filter&&this.mod.filter.apply(this,[t,e]),this.parse(),this.bind(),this.resize(),this.render();function a(t){return{k:i,v:t}}function u(t){return t.k===i}function l(t){return t.v.filter=o}},sample:function(){return this.mod.sample?this.mod.sample.apply(this):{raw:[],binding:{}}},filterDims:function(){var t;return(t=(this.mod||{}).filterDims)?t.call(this):(this.mod||{}).filter?["name"]:[]},canFilter:function(){return!!this.filterDims().length}}),g.commonConfig={common:{animation:{transition:{type:"number",default:350,min:0,max:5e3,step:10},interval:{type:"number",default:1e3,min:100,max:2e4,step:50},speed:{type:"number",default:1,min:.1,max:10,step:.1},loop:{type:"boolean",default:!0},autoplay:{type:"boolean",default:!0}},subset:{mode:{type:"choice",values:["dim","partial","shrink"],default:"dim"},opacity:{type:"number",default:.2,min:0,max:1,step:.05},fade:{type:"number",default:.72,min:0,max:1,step:.01},background:{type:"color",default:"transparent"}},empty:{enabled:{type:"boolean",default:!0},text:{type:"text",default:""},color:{type:"color",default:"currentColor"},opacity:{type:"number",default:.45,min:0,max:1,step:.05},font:{size:{type:"quantity",default:"",units:[{name:"em",max:10,step:.01,default:1}]}}},brush:{fill:{type:"color",default:""},fillOpacity:{type:"number",default:"",min:0,max:1,step:.05},stroke:{type:"color",default:""},strokeOpacity:{type:"number",default:"",min:0,max:1,step:.05},strokeWidth:{type:"number",default:"",min:0,max:20,step:.5},handleFill:{type:"color",default:""},handleOpacity:{type:"number",default:"",min:0,max:1,step:.05}},annotation:{enabled:{type:"boolean",default:!0},color:{type:"color",default:"currentColor"},opacity:{type:"number",default:1,min:0,max:1,step:.05},font:{size:{type:"quantity",default:".8em",units:[{name:"em",max:10,step:.01,default:.8}]}}}}},g.i18nNs="@plotdb/chart",g.i18n={en:{text:"No data to show"},"zh-TW":{text:"沒有可顯示的資料"},"zh-CN":{text:"没有可显示的数据"},ja:{text:"表示するデータがありません"}},g.scopes={space:{x:function(t){return null},y:function(t){return null}},frame:{active:function(){return!!this._frames},count:function(){return this._frames?this._frames.list.length:0},index:function(){return this._frames?this._frames.index:-1},id:function(t){return this._frames?(this._frames.list[null!=t?t:this._frames.index]||{}).id:null},ids:function(){return this._frames?this._frames.list.map(function(t){return t.id}):[]},all:function(){var t,e;return this._frames?null!=(e=(t=this._frames).all)?e:t.all=this._parseRows([].concat.apply([],this._frames.list.map(function(t){return t.raw}))):this._parseRows(this.raw)}},subset:{set:function(t){if(this._subset=t||null,this._inited)return this.parse(),this.bind(),this.resize(),this.render()},mode:function(){return(((this.cfg||{}).common||{}).subset||{}).mode||"dim"},ratio:function(t,e,n){return t&&t.subset?!(t=(n=null!=n?[(t[e]||[])[n],(t.subset[e]||[])[n]]:[t[e],t.subset[e]])[0])||(e=n[1]/t)<0?0:1<e?1:e:null},color:function(t,e){var n,i,r,o;return(i=a(t))?(n=.3*i[0]+.59*i[1]+.11*i[2],i=((this.cfg||{}).common||{}).subset||{},r=null!=(r=null!=e?e:i.fade)?r:.72,o=a(i.background)||a((this.cfg||{}).background)||[255,255,255],"rgb("+[0,1,2].map(function(t){return Math.round(n+(o[t]-n)*r)}).join(",")+")"):t}}},g.dataframe={is:o,split:function(t,n){var i={},r=[];return(t=null==t?[]:t).map(function(t){var e=t[n]+"";return i[e]||r.push(i[e]={id:t[n],raw:[]}),i[e].raw.push(t)}),{frames:r}}},null!=k?k.exports=g:"undefined"!=typeof window&&null!==window&&(window.chart=g)}.call(this),k.exports);!function(){var A={re:/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i,prefixes:["y","z","a","f","p","n","µ","m"].concat([""],["k","M","G","T","P","E","Z","Y"]),locale:{decimal:".",thousands:",",grouping:[3],currency:["$",""],minus:"−",percent:"%",nan:"NaN"},parts:function(t,e){var n;return!isFinite(t)||0===t||(e=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0?null:[1<(n=t.slice(0,e)).length?n[0]+n.slice(2):n,+t.slice(e+1)]},rounded:function(t,e){var n;return(e=A.parts(t,e))?(n=e[0],(e=e[1])<0?"0."+new Array(-e).join("0")+n:n.length>e+1?n.slice(0,e+1)+"."+n.slice(e+1):n+new Array(e-n.length+2).join("0")):t+""},prefixAuto:function(t,e){var n,i,r;return(i=A.parts(t,e))?(n=i[0],i=i[1],A._pe=3*Math.max(-8,Math.min(8,Math.floor(i/3))),(i=i-A._pe+1)===(r=n.length)?n:r<i?n+new Array(i-r+1).join("0"):0<i?n.slice(0,i)+"."+n.slice(i):"0."+new Array(1-i).join("0")+A.parts(t,Math.max(0,e+i-1))[0]):(A._pe=void 0,t.toPrecision(e))},decimal:function(t){return 1e21<=Math.abs(t=Math.round(t))?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},types:{"%":function(t,e){return(100*t).toFixed(e)},b:function(t){return Math.round(t).toString(2)},c:function(t){return t+""},d:function(t){return A.decimal(t)},e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},g:function(t,e){return t.toPrecision(e)},o:function(t){return Math.round(t).toString(8)},p:function(t,e){return A.rounded(100*t,e)},r:function(t,e){return A.rounded(t,e)},s:function(t,e){return A.prefixAuto(t,e)},X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}},trim:function(t){for(var e,n,i=[-1,-1],r=i[0],o=i[1],s=1,a=t.length;s<a;++s)if("."===(n=t[e=s]))r=o=e;else if("0"===n)0===r&&(r=e),o=e;else{if(!+n)break;0<r&&(r=0)}return 0<r?t.slice(0,r)+t.slice(o+1):t},group:function(t,e){for(var n=A.locale,i=n.grouping,r=n.thousands,o=(n=[t.length,[],0,i[0],0])[0],s=n[1],a=n[2],u=n[3],l=n[4];0<o&&0<u&&(e<l+u+1&&(u=Math.max(1,e-l)),s.push(t.substring(o-=u,o+u)),!((l+=u+1)>e));)u=i[a=(a+1)%i.length];return s.reverse().join(r)},format:function(t){var e,h,c,f,d,n,p,m,y,_,g,v,i,b,x,w,k;if(e=A.re.exec(t))return h=A.locale,c=null!=e[1]?e[1]:" ",f=e[2]||">",d=e[3]||"-",n=e[4]||"",p=!!e[5],m=null!=e[6]?+e[6]:void 0,y=!!e[7],_=e[8]?+e[8].slice(1):void 0,g=!!e[9],"n"===(v=e[10]||"")?(y=(i=[!0,"g"])[0],v=i[1]):A.types[v]||(null==_&&(_=12),g=(i=[!0,"g"])[0],v=i[1]),(p||"0"===c&&"="===f)&&(p=(i=[!0,"0","="])[0],c=i[1],f=i[2]),b="$"===n?h.currency[0]:"#"===n&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",x="$"===n?h.currency[1]:/[%p]/.test(v)?h.percent:"",w=A.types[v],k=/[defgprs%]/.test(v),_=null==_?6:/[gprs]/.test(v)?Math.max(1,Math.min(21,_)):Math.max(0,Math.min(20,_)),function(t){var e,n,i,r,o,s,a=[b,x],u=a[0],l=a[1];if("c"===v)l=w(t)+l,t="";else if(a=(t=+t)<0||1/t<0,t=isNaN(t)?h.nan:w(Math.abs(t),_),g&&(t=A.trim(t)),u=((a=a&&0==+t&&"+"!==d?!1:a)?"("===d?d:h.minus:"-"===d||"("===d?"":d)+u,l=("s"!==v||isNaN(t)||null==A._pe?"":A.prefixes[8+A._pe/3])+l+(a&&"("===d?")":""),k)for(e=0,n=t.length;e<n;++e)if(i=e,(r=t.charCodeAt(i))<48||57<r){l=(46===r?h.decimal+t.slice(i+1):t.slice(i))+l,t=t.slice(0,i);break}switch(y&&!p&&(t=A.group(t,1/0)),o=(a=u.length+t.length+l.length)<m?new Array(m-a+1).join(c):"",y&&p&&(t=A.group(o+t,o.length?m-l.length:1/0),o=""),f){case"<":return u+t+l+o;case"=":return u+o+t+l;case"^":return s=o.length>>1,o.slice(0,s)+u+t+l+o.slice(s);default:return o+u+t+l}};throw new Error("invalid format: "+t)}},e={d3:function(t){return("undefined"!=typeof d3&&null!==d3&&d3.format?d3:A).format(t)},from:function(t){try{return e.d3(t)}catch(t){return function(t){return t}}},auto:function(t){return null==t&&(t=[]),e.d3(".3s")},simple:function(t){return isNaN(t=+t)?t:1e9<=t?(t/1e9).toFixed(0)+"G":1e6<=t?(t/1e6).toFixed(0)+"M":1e3<=t?(t/1e3).toFixed(0)+"K":Math.floor(t)===t?t.toFixed(0):t.toFixed(2)}};e._d3f=A,null!=z&&((z.utils||(z.utils={})).format=e)}.call(this),function(){var u=Math.sqrt(50),l=Math.sqrt(10),h=Math.sqrt(2),f=function(t,e,n){var i,r,o,s=(e-t)/Math.max(0,n),a=Math.floor(Math.log10(s)),s=s/Math.pow(10,a),s=u<=s?10:l<=s?5:h<=s?2:1;return a<0?(i=Math.pow(10,-a)/s,(r=Math.round(t*i))/i<t&&r++,e<(o=Math.round(e*i))/i&&o--,i=-i):(i=Math.pow(10,a)*s,(r=Math.round(t/i))*i<t&&r++,e<(o=Math.round(e/i))*i&&o--),o<r&&.5<=n&&n<2?f(t,e,2*n):[r,o,i]},c=function(t,e,n){var i,r,o,s,a,u,l,h=[],c=[+t,+e,+n];if(!(0<(n=c[2])))return[];if((t=c[0])===(e=c[1]))return[t];if(r=(c=(i=e<t)?f(e,t,n):f(t,e,n))[0],s=c[2],!(r<=(o=c[1])))return[];for(a=o-r+1,u=0;u<a;++u)l=i?o-u:r+u,h.push(s<0?l/-s:l*s);return h},d=function(t){return t},p=function(e,n){var t=[+e,+n];return e=t[0],n=t[1],function(t){return e*(1-t)+n*t}},m=function(t,e){return"number"==typeof e?p(t,e):null!=z&&z.utils&&z.utils.anim?z.utils.anim.interpolate(t,e):function(){return e}},y=function(e,n){return(n-=e=+e)?function(t){return(t-e)/n}:isNaN(n)?function(){return NaN}:function(){return.5}},_=function(t,e,n,i){for(var r;n<i;)e<t[r=n+i>>>1]?i=r:n=1+r;return n},g=function(n,t,e){var i,r,o,s,a,u,l,h,c,f,d,p=Math.min(n.length,t.length)-1;if(p<=1)return s=(i=[n[0],n[1],t[0],t[1]])[2],a=i[3],i=(o=i[1])<(r=i[0])?[y(o,r),e(a,s)]:[y(r,o),e(s,a)],u=i[0],l=i[1],function(t){return l(u(t))};for(n[p]<n[0]&&(n=n.slice().reverse(),t=t.slice().reverse()),c=[],f=0;f<p;++f)l=f,c.push(y(n[l],n[l+1]));for(h=c,c=[],f=0;f<p;++f)l=f,c.push(e(t[l],t[l+1]));return d=c,function(t){var e=_(n,t,1,p)-1;return d[e](h[e](t))}},v=function(n,i){var t,r,o,s,e,a,u,l,h;return null==n&&(n=d),null==i&&(i=d),r=(t=[[0,1],[0,1],!1])[0],o=t[1],s=t[2],e=(t=[null,null])[0],a=t[1],u=function(t){var e,n,i;return s?((i=(e=[r[0],r[Math.min(r.length,o.length)-1]])[1])<(n=e[0])&&(n=(e=[i,n])[0],i=e[1]),Math.max(n,Math.min(i,t))):t},l=function(){return a=e=null,h},(h=function(t){if(null!=t&&!isNaN(t=+t))return(e=e||g(r.map(n),o,m))(n(u(t)))}).invert=function(t){return a=a||g(o,r.map(n),p),u(i(a(t)))},h.domain=function(t){return arguments.length?(r=Array.from(t,function(t){return+t}),l()):r.slice()},h.range=function(t){return arguments.length?(o=Array.from(t),l()):o.slice()},h.clamp=function(t){return arguments.length?(s=!!t,l()):s},h.ticks=function(t){return c(r[0],r[r.length-1],t=null==t?10:t)},h._transform=function(t,e){return n=t,i=e,l()},h._copy=function(t){return t.domain(r).range(o).clamp(s)},h.copy=function(){return h._copy(v(n,i))},h},i=function(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}},r=function(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)},o=function(t){return t<0?-t*t:t*t},s=function(){var t=v(),e=1,n=function(){return 1===e?t._transform(d,d):.5===e?t._transform(r,o):t._transform(i(e),i(1/e))};return t.exponent=function(t){return arguments.length?(e=+t,n()):e},t.copy=function(){return t._copy(s().exponent(e))},t},a=function(){var t=v(),e=1,n=function(){return t._transform(function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))},function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e})};return t.constant=function(t){return arguments.length?(e=+t,n()):e},t.copy=function(){return t._copy(a().constant(e))},n()},e=function(){var u,t=[[],new Map,[0,1],0,0,.5],l=t[0],o=t[1],h=t[2],c=t[3],f=t[4],d=t[5],p=(t=[0,0,[]])[0],m=t[1],y=t[2],s=function(){var t,e,n,i=l.length,r=h[0],o=h[1],s=o<r,r=s?[o,r]:[r,o],a=r[0],o=r[1];for(a+=(o-a-(p=(o-a)/Math.max(1,i-c+2*f))*(i-c))*d,m=p*(1-c),t=[],e=0;e<i;++e)n=e,t.push(a+p*n);return y=t,s&&y.reverse(),u};return(u=function(t){if(o.has(t))return y[o.get(t)]}).domain=function(t){var e,n,i,r;if(!arguments.length)return l.slice();for(e=[[],new Map],l=e[0],o=e[1],n=0,i=t.length;n<i;++n)r=t[n],o.has(r)||o.set(r,l.push(r)-1);return s()},u.range=function(t){return arguments.length?(h=Array.from(t,function(t){return+t}),s()):h.slice()},u.bandwidth=function(){return m},u.step=function(){return p},u.paddingInner=function(t){return arguments.length?(c=Math.min(1,t),s()):c},u.paddingOuter=function(t){return arguments.length?(f=t,s()):f},u.padding=function(t){return arguments.length?(c=Math.min(1,f=t),s()):c},u.align=function(t){return arguments.length?(d=Math.max(0,Math.min(1,t)),s()):d},u.copy=function(){return e().domain(l).range(h).paddingInner(c).paddingOuter(f).align(d)},s()},n=function(t){var e=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,delete t.paddingOuter,t.copy=function(){return n(e())},t},t={linear:function(){return v()},pow:s,sqrt:function(){return s().exponent(.5)},symlog:a,band:e,point:function(){return n(e().paddingInner(1))},ticks:c};null!=z&&((z.utils||(z.utils={})).scale=t)}.call(this),function(){var L,P,e,i,r,n,o,s,t,a,b,u,B=Math.abs,F=Math.atan2,G=Math.cos,I=Math.sin,H=Math.sqrt,W=Math.min,p=Math.max,D=Math.PI,$=D/2,J=2*D,U=1e-12,c=J-1e-6,X=function(t){return 1<t?0:t<-1?D:Math.acos(t)},V=function(t){return 1<=t?$:t<=-1?-$:Math.asin(t)},x=function(t){return function(){return t}},w=function(t){return"function"==typeof t?t:x(+t)},Z=function(t){return this._x0=this._y0=this._x1=this._y1=null,this._="",this._k=null!=t&&Math.floor(t)<=15?Math.pow(10,Math.floor(t)):null,this};Z.prototype={_a:function(t){for(var e,n,i=[],r=1,o=arguments.length;r<o;++r)i.push(arguments[r]);return e=i,n=this._k,this._+=t+(null!=n?e.map(function(t){return Math.round(t*n)/n}):e).join(",")},moveTo:function(t,e){return this._x0=this._x1=+t,this._y0=this._y1=+e,this._a("M",this._x0,this._y0)},closePath:function(){if(null!==this._x1)return this._x1=this._x0,this._y1=this._y0,this._+="Z"},lineTo:function(t,e){return this._x1=+t,this._y1=+e,this._a("L",this._x1,this._y1)},bezierCurveTo:function(t,e,n,i,r,o){return this._x1=+r,this._y1=+o,this._a("C",+t,+e,+n,+i,this._x1,this._y1)},arc:function(t,e,n,i,r,o){var s,a,u,l,h=[+t,+e,+n,!!o];if(t=h[0],e=h[1],o=h[3],(n=h[2])<0)throw new Error("negative radius: "+n);if(a=t+(h=n*G(i)),u=e+(s=n*I(i)),l=o?0:1,o=o?i-r:r-i,null===this._x1?this._a("M",a,u):(1e-6<B(this._x1-a)||1e-6<B(this._y1-u))&&this._a("L",a,u),n)return c<(o=o<0?o%J+J:o)?(this._a("A",n,n,0,1,l,t-h,e-s),this._x1=a,this._y1=u,this._a("A",n,n,0,1,l,this._x1,this._y1)):1e-6<o?(this._x1=t+n*G(r),this._y1=e+n*I(r),this._a("A",n,n,0,D<=o?1:0,l,this._x1,this._y1)):void 0},toString:function(){return this._}},L=function(t,e,n,i,r,o,s,a){var n=[n-t,i-e,s-r,a-o],i=n[0],s=n[1],a=n[2],n=n[3],u=n*i-a*s;if(!(u*u<U))return[t+(u=(a*(e-o)-n*(t-r))/u)*i,e+u*s]},P=function(t,e,n,i,r,o,s){var a=t-n,u=e-i,s=(s?o:-o)/H(a*a+u*u),u=s*u,s=-s*a,a=t+u,t=e+s,e=n+u,n=i+s,i=(a+e)/2,l=(t+n)/2,h=e-a,c=n-t,f=h*h+c*c,o=r-o,a=a*n-e*t,n=(c<0?-1:1)*H(p(0,o*o*f-a*a)),e=(a*c-h*n)/f,t=(-a*h-c*n)/f,d=(a*c+h*n)/f,a=(-a*h+c*n)/f,h=e-i,c=t-l,n=d-i,f=a-l;return n*n+f*f<h*h+c*c&&(e=d,t=a),{cx:e,cy:t,x01:-u,y01:-s,x11:e*(r/o-1),y11:t*(r/o-1)}},u=function(){var z=function(t){return t.innerRadius},C=function(t){return t.outerRadius},E=x(0),O=null,j=function(t){return t.startAngle},R=function(t){return t.endAngle},T=function(t){return t&&t.padAngle},q=3,e=function(){var t,e,n,i,r,o,s,a,u,l,h,c,f,d,p,m,y,_,g,v,b=arguments,x=new Z(q),w=+z.apply(this,b),k=+C.apply(this,b),A=j.apply(this,b)-$,M=R.apply(this,b)-$,N=B(M-A),S=A<M;return k<w&&(w=(o=[k,w])[0],k=o[1]),U<k?J-U<N?(x.moveTo(k*G(A),k*I(A)),x.arc(0,0,k,A,M,!S),U<w&&(x.moveTo(w*G(M),w*I(M)),x.arc(0,0,w,M,A,S))):(t=(o=[A,M,A,M,N,N])[0],e=o[1],n=o[2],i=o[3],r=o[4],o=o[5],u=T.apply(this,b)/2,h=U<u&&(O?+O.apply(this,b):H(w*w+k*k)),a=s=b=W(B(k-w)/2,+E.apply(this,b)),U<h&&(l=V(h/w*I(u)),h=V(h/k*I(u)),(r-=2*l)>U?(n+=l*=S?1:-1,i-=l):(r=0,n=i=(A+M)/2),(o-=2*h)>U?(t+=h*=S?1:-1,e-=h):(o=0,t=e=(A+M)/2)),u=k*G(t),l=k*I(t),h=w*G(i),A=w*I(i),U<b&&(c=k*G(e),f=k*I(e),d=w*G(n),p=w*I(n),N<D)&&((M=L(u,l,d,p,c,f,h,A))?(N=u-M[0],_=l-M[1],m=c-M[0],y=f-M[1],N=1/I(X((N*m+_*y)/(H(N*N+_*_)*H(m*m+y*y)))/2),_=H(M[0]*M[0]+M[1]*M[1]),s=W(b,(w-_)/(N-1)),a=W(b,(k-_)/(1+N))):s=a=0),U<o?U<a?(g=P(d,p,u,l,k,a,S),v=P(c,f,h,A,k,a,S),x.moveTo(g.cx+g.x01,g.cy+g.y01),a<b?x.arc(g.cx,g.cy,a,F(g.y01,g.x01),F(v.y01,v.x01),!S):(x.arc(g.cx,g.cy,a,F(g.y01,g.x01),F(g.y11,g.x11),!S),x.arc(0,0,k,F(g.cy+g.y11,g.cx+g.x11),F(v.cy+v.y11,v.cx+v.x11),!S),x.arc(v.cx,v.cy,a,F(v.y11,v.x11),F(v.y01,v.x01),!S))):(x.moveTo(u,l),x.arc(0,0,k,t,e,!S)):x.moveTo(u,l),U<w&&U<r?U<s?(g=P(h,A,c,f,w,-s,S),v=P(u,l,d,p,w,-s,S),x.lineTo(g.cx+g.x01,g.cy+g.y01),s<b?x.arc(g.cx,g.cy,s,F(g.y01,g.x01),F(v.y01,v.x01),!S):(x.arc(g.cx,g.cy,s,F(g.y01,g.x01),F(g.y11,g.x11),!S),x.arc(0,0,w,F(g.cy+g.y11,g.cx+g.x11),F(v.cy+v.y11,v.cx+v.x11),S),x.arc(v.cx,v.cy,s,F(v.y11,v.x11),F(v.y01,v.x01),!S))):x.arc(0,0,w,i,n,S):x.lineTo(h,A)):x.moveTo(0,0),x.closePath(),x.toString()||null};return e.centroid=function(){var t=(+z.apply(this,arguments)+ +C.apply(this,arguments))/2,e=(+j.apply(this,arguments)+ +R.apply(this,arguments))/2-D/2;return[G(e)*t,I(e)*t]},e.innerRadius=function(t){return arguments.length?(z=w(t),e):z},e.outerRadius=function(t){return arguments.length?(C=w(t),e):C},e.cornerRadius=function(t){return arguments.length?(E=w(t),e):E},e.padRadius=function(t){return arguments.length?(O=null!=t?w(t):null,e):O},e.startAngle=function(t){return arguments.length?(j=w(t),e):j},e.endAngle=function(t){return arguments.length?(R=w(t),e):R},e.padAngle=function(t){return arguments.length?(T=w(t),e):T},e.digits=function(t){return arguments.length?(q=null!=t?Math.floor(t):null,e):q},e},(e=function(t){return this._context=t,this}).prototype={areaStart:function(){return this._line=0},areaEnd:function(){return this._line=NaN},lineStart:function(){return this._point=0},lineEnd:function(){return(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var n=[+t,+e];return t=n[0],e=n[1],0===this._point?(this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e)):(this._point=2,this._context.lineTo(t,e))}},i=function(t){return new e(t)},r=function(t,e,n){var i=t._k;return t._context.bezierCurveTo(t._x1+i*(t._x2-t._x0),t._y1+i*(t._y2-t._y0),t._x2+i*(t._x1-e),t._y2+i*(t._y1-n),t._x2,t._y2)},(n=function(t,e){return this._context=t,this._k=(1-e)/6,this}).prototype={areaStart:function(){return this._line=0},areaEnd:function(){return this._line=NaN},lineStart:function(){return this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){return 2===this._point?this._context.lineTo(this._x2,this._y2):3===this._point&&r(this,this._x1,this._y1),(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var n=[+t,+e];return t=n[0],e=n[1],0===this._point?(this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e)):1===this._point?(this._point=2,this._x1=t,this._y1=e):(this._point=3,r(this,t,e)),n=[this._x1,this._x2,t],this._x0=n[0],this._x1=n[1],this._x2=n[2],n=[this._y1,this._y2,e],this._y0=n[0],this._y1=n[1],this._y2=n[2],n}},o=function(t,e,n){var i,r,o=[t._x1,t._y1,t._x2,t._y2],s=o[0],a=o[1],u=o[2],o=o[3];return U<t._l01_a&&(s=(s*(i=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a)-t._x0*t._l12_2a+t._x2*t._l01_2a)/(r=3*t._l01_a*(t._l01_a+t._l12_a)),a=(a*i-t._y0*t._l12_2a+t._y2*t._l01_2a)/r),U<t._l23_a&&(u=(u*(i=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a)+t._x1*t._l23_2a-e*t._l12_2a)/(r=3*t._l23_a*(t._l23_a+t._l12_a)),o=(o*i+t._y1*t._l23_2a-n*t._l12_2a)/r),t._context.bezierCurveTo(s,a,u,o,t._x2,t._y2)},(s=function(t,e){return this._context=t,this._alpha=e,this}).prototype={areaStart:function(){return this._line=0},areaEnd:function(){return this._line=NaN},lineStart:function(){return this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){return 2===this._point?this._context.lineTo(this._x2,this._y2):3===this._point&&this.point(this._x2,this._y2),(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var n,i,r=[+t,+e];return t=r[0],e=r[1],this._point&&(n=this._x2-t,i=this._y2-e,this._l23_a=H(this._l23_2a=Math.pow(n*n+i*i,this._alpha))),0===this._point?(this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e)):1===this._point?this._point=2:(this._point=3,o(this,t,e)),r=[this._l12_a,this._l23_a],this._l01_a=r[0],this._l12_a=r[1],r=[this._l12_2a,this._l23_2a],this._l01_2a=r[0],this._l12_2a=r[1],r=[this._x1,this._x2,t],this._x0=r[0],this._x1=r[1],this._x2=r[2],r=[this._y1,this._y2,e],this._y0=r[0],this._y1=r[1],this._y2=r[2],r}},t=(a=function(e){var t=function(t){return e?new s(t,e):new n(t,0)};return t.alpha=function(t){return a(+t)},t})(.5),b=function(t){return"object"==typeof t&&"length"in t?t:Array.from(t)},u={arc:u,line:function(t,e){var l=x(!0),h=i,c=3,f="function"==typeof t?t:void 0===t?function(t){return t[0]}:x(t),d="function"==typeof e?e:void 0===e?function(t){return t[1]}:x(e),n=function(t){for(var e,n,i,r,o=(t=b(t)).length,s=!1,a=h(e=new Z(c)),u=0;u<=o;++u)i=!1,(n=u)<o&&(r=t[n],i=!!l(r,n,t)),!i===s&&((s=!s)?a.lineStart():a.lineEnd()),s&&a.point(+f(r,n,t),+d(r,n,t));return e.toString()||null};return n.x=function(t){return arguments.length?(f=w(t),n):f},n.y=function(t){return arguments.length?(d=w(t),n):d},n.defined=function(t){return arguments.length?(l="function"==typeof t?t:x(!!t),n):l},n.curve=function(t){return arguments.length?(h=t,n):h},n.digits=function(t){return arguments.length?(c=null!=t?Math.floor(t):null,n):c},n},area:function(d,p,m){var e,y=null,_=x(!0),g=i,v=3;return d="function"==typeof d?d:void 0===d?function(t){return t[0]}:x(+d),p="function"==typeof p?p:x(void 0===p?0:+p),m="function"==typeof m?m:void 0===m?function(t){return t[1]}:x(+m),(e=function(t){for(var e,n,i,r,o,s=(t=b(t)).length,a=!1,u=new Array(s),l=new Array(s),h=0,c=g(e=new Z(v)),f=0;f<=s;++f){if(i=!1,(n=f)<s&&(r=t[n],i=!!_(r,n,t)),!i===a)if(a=!a)h=n,c.areaStart(),c.lineStart();else{for(c.lineEnd(),c.lineStart(),o=n-1;h<=o;)c.point(u[o],l[o]),o--;c.lineEnd(),c.areaEnd()}a&&(u[n]=+d(r,n,t),l[n]=+p(r,n,t),c.point(y?+y(r,n,t):u[n],m?+m(r,n,t):l[n]))}return e.toString()||null}).x=function(t){return arguments.length?(d=w(t),y=null,e):d},e.x0=function(t){return arguments.length?(d=w(t),e):d},e.x1=function(t){return arguments.length?(y=null!=t?w(t):null,e):y},e.y=function(t){return arguments.length?(p=w(t),m=null,e):p},e.y0=function(t){return arguments.length?(p=w(t),e):p},e.y1=function(t){return arguments.length?(m=null!=t?w(t):null,e):m},e.defined=function(t){return arguments.length?(_="function"==typeof t?t:x(!!t),e):_},e.curve=function(t){return arguments.length?(g=t,e):g},e.digits=function(t){return arguments.length?(v=null!=t?Math.floor(t):null,e):v},e},curve:{linear:i,catmullRom:t},path:function(t){return new Z(t)}},null!=z&&((z.utils||(z.utils={})).shape=u)}.call(this),function(){var e=function(t){return Math.max(0,Math.min(255,Math.round(t)))},t={turbo:function(t){return t=Math.max(0,Math.min(1,t)),"rgb("+e(34.61+t*(1172.33-t*(10793.56-t*(33300.12-t*(38394.49-14825.05*t)))))+", "+e(23.31+t*(557.33+t*(1225.33-t*(3574.96-t*(1073.77+707.56*t)))))+", "+e(27.2+t*(3211.1-t*(15327.97-t*(27814-t*(22569.18-6838.66*t)))))+")"},discrete:function(e){var n=e.length;return function(t){return e[Math.max(0,Math.min(n-1,Math.floor(t*n)))]}},quantize:function(t,e){for(var n,i=[],r=0;r<e;++r)n=r,i.push(t(n/(e-1)));return i}};null!=z&&((z.utils||(z.utils={})).color=t)}.call(this),function(){var n,c,l,r,o,s,f,d,p,m,t,e;n=function(){return("undefined"!=typeof performance&&null!==performance?performance:Date).now()},c={linear:function(t){return t},cubicInOut:function(t){return(t*=2)<=1?t*t*t/2:((t-=2)*t*t+2)/2},cubicOut:function(t){return--t*t*t+1},quadInOut:function(t){return(t*=2)<=1?t*t/2:(--t*(2-t)+1)/2}},l=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,r=function(t){var e,n;return"string"!=typeof t?null:(t=t.trim(),(e=/^#([0-9a-f]{3,4})$/i.exec(t))?[(n=e[1].split("").map(function(t){return parseInt(t+t,16)}))[0],n[1],n[2],null!=n[3]?n[3]/255:1]:(e=/^#([0-9a-f]{6})([0-9a-f]{2})?$/i.exec(t))?(n=[0,1,2].map(function(t){return parseInt(e[1].substr(2*t,2),16)})).concat([e[2]?parseInt(e[2],16)/255:1]):!(e=/^rgba?\(([^)]+)\)$/i.exec(t))||(n=e[1].split(/[\s,\/]+/).filter(function(t){return t}).map(function(t){return parseFloat(t)})).length<3||n.slice(0,3).some(function(t){return isNaN(t)})?null:[n[0],n[1],n[2],null==n[3]||isNaN(n[3])?1:n[3]])},o=function(s,a){return function(e){var t=[0,1,2,3].map(function(t){return s[t]+(a[t]-s[t])*e}),n=t[0],i=t[1],r=t[2],o=t[3];return n=(t=[n,i,r].map(function(t){return(t=0<(t=Math.round(t))?t:0)<255?t:255}))[0],i=t[1],r=t[2],1===(o=!isNaN(o)&&(t=0<o?o:0)<1?t:1)?"rgb("+n+", "+i+", "+r+")":"rgba("+n+", "+i+", "+r+", "+o+")"}},s=function(t,e){var n,i,r,o,s,a,u;for(e+="",n=(t+="").match(l)||[],i=[],l.lastIndex=o=r=0;s=l.exec(e);)s.index>r&&i.push(e.slice(r,s.index)),a=+s[0],u=null!=n[o]?+n[o]:null,i.push(null!=u&&u!==a?{a:u,b:a}:s[0]),r=l.lastIndex,o++;return r<e.length&&i.push(e.slice(r)),i.some(function(t){return"object"==typeof t})?function(e){return i.map(function(t){return"object"==typeof t?t.a+(t.b-t.a)*e:t}).join("")}:function(){return e}},f=function(e,n){var t,i;return"number"==typeof n?(e=parseFloat(e),isNaN(e)&&(e=0),function(t){return e+(n-e)*t}):null==e?function(){return n}:(t=r(n))?(i=r(e))?o(i,t):function(){return n}:s(e,n)},d=function(t,e){return e.startsWith("style:")?t.style.getPropertyValue(e.slice(6)):t.getAttribute(e)},p=function(t,e,n){return e.startsWith("style:")?t.style.setProperty(e.slice(6),n):t.setAttribute(e,n)},m=function(t,e){return e.startsWith("style:")?t.style.removeProperty(e.slice(6)):t.removeAttribute(e)},(t=function(t){var e=this;return this._manual=!!(t=null==t?{}:t).manual,this._now=0,this._base=0,this._since=n(),this._speed=1,this._frozen=!1,this._dur=350,this._immediate=!1,this._back=0,this._raf=null,this._list=new Map,this.evtHandler={},this._tick=function(t){if(e._raf=null,!e._manual&&!e._frozen)return e._apply(e.time()),e._list.size?e._kick():void 0},this}).prototype=((t,e)=>{var n,i={}.hasOwnProperty;for(n in e)i.call(e,n)&&(t[n]=e[n]);return t})(Object.create(Object.prototype),{on:function(t,n){var i=this;return(Array.isArray(t)?t:[t]).map(function(t){var e;return((e=i.evtHandler)[t]||(e[t]=[])).push(n)})},fire:function(t){for(var e,n,i,r,o=[],s=[],a=1,u=arguments.length;a<u;++a)s.push(arguments[a]);for(e=s,a=0,i=(n=this.evtHandler[t]||[]).length;a<i;++a)r=n[a],o.push(r.apply(this,e));return o},time:function(){return this._manual?this._now:this._frozen?this._base:this._base+(n()-this._since)*this._speed},_rebase:function(){return this._base=this.time(),this._since=n()},duration:function(t){return arguments.length?(t=+t,this._dur=isNaN(t)||t<0?350:t,this):this._dur},immediate:function(t){return arguments.length?(this._immediate=!!t,this):this._immediate},speed:function(t){return arguments.length?(t=+t,(t=isNaN(t)||t<=0?1:t)!==this._speed&&(this._manual||this._rebase(),this._speed=t),this):this._speed},paused:function(){return this._frozen},pause:function(){return this._frozen||(this._manual||this._rebase(),this._frozen=!0,this._raf&&cancelAnimationFrame(this._raf),this._raf=null),this},resume:function(){return this._frozen&&(this._since=n(),this._frozen=!1,this._list.size)&&this._kick(),this},ago:function(t,e){this._back=t||0;try{e()}finally{this._back=0}return t&&this._apply(this.time()),this},manual:function(t){return arguments.length?((t=!!t)!==this._manual&&(t?(this._now=this.time(),this._manual=!0,this._raf&&cancelAnimationFrame(this._raf),this._raf=null):(this._base=this._now,this._since=n(),this._manual=!1,this._list.size&&this._kick())),this):this._manual},step:function(t){return null==t&&(t=1e3/60),this._manual||this.manual(!0),t*=this._speed,this._now+=t,this._apply(this._now),this.fire("step",this._now,t),this},seek:function(t){return this._manual||this.manual(!0),this._now=t,this._apply(this._now),this.fire("step",this._now,0),this},busy:function(){return 0<this._list.size},flush:function(){return this._apply(1/0),this},interrupt:function(t){return this._list.delete(t)},_kick:function(){var t=this;if(!(this._manual||this._frozen||this._raf))return"undefined"==typeof requestAnimationFrame||null===requestAnimationFrame?setTimeout(function(){return t._tick()},16):this._raf=requestAnimationFrame(this._tick)},tween:function(t,e,n){var i,r,o,s,a,u,l,h;for(l in null==e&&(e={}),r=this._dur/350,i=(null!=(n=null==n?{}:n).duration?n.duration:350)*r,r=(n.delay||0)*r,o="function"==typeof n.ease?n.ease:c[n.ease||"cubic-in-out"]||c.cubicInOut,s=this._immediate||i<=0&&r<=0||!this._manual&&"undefined"!=typeof document&&null!==document&&document.hidden,(a=this._list.get(t)||{attr:{},cb:[]}).remove=!!n.remove,n.end&&a.cb.push(n.end),u=this.time()-this._back+r,e)null==(h=e[l])?(m(t,l),delete a.attr[l]):l.startsWith("style:")&&!t.style.getPropertyValue(l.slice(6))&&window.getComputedStyle(t).getPropertyValue(l.slice(6))===h+""?delete a.attr[l]:s?(p(t,l,"function"==typeof h?h(1):h),delete a.attr[l]):a.attr[l]="function"==typeof h?{fn:h,start:u,dur:0<i?i:0,ease:o}:{to:h,start:u,dur:0<i?i:0,ease:o};return this._list.set(t,a),s&&!(()=>{var t=[];for(l in a.attr)t.push(l);return t})().length?this._done(t,a):this._manual||this._kick(),this},_done:function(e,t){return this._list.delete(e),t.remove&&e.parentNode&&e.parentNode.removeChild(e),t.cb.map(function(t){return t.call(e)})},_apply:function(t){for(var e,n,i,r,o,s,a,u,l=[],h=0,c=(e=Array.from(this._list)).length;h<c;++h)if(i=(n=e[h])[0],r=n[1],this._list.get(i)===r){for(o in n=r.attr)t<(s=n[o]).start||(s.fn?(a=s.dur&&(u=(t-s.start)/s.dur)<1?u:1,p(i,o,s.fn(1<=a?1:s.ease(a))),1<=a&&delete r.attr[o]):(s.interp||(s.interp=f(d(i,o),s.to)),1<=(a=s.dur&&(u=(t-s.start)/s.dur)<1?u:1)?(p(i,o,s.to),delete r.attr[o]):p(i,o,s.interp(s.ease(a)))));(()=>{var t=[];for(o in r.attr)t.push(o);return t})().length||l.push(this._done(i,r))}return l}}),e=function(t){var e,i,r,o,s,n,a,u,l,h=t.root,c=null!=(e=t.tag)?e:"g",f=t.cls,d=null!=(e=t.data)?e:[],p=t.key;for(p=p||function(t,e){return e},t=Array.from(h.childNodes).filter(function(t){return 1===t.nodeType&&t.tagName===c&&(!f||t.classList.contains(f))}),i=new Map,r=(e=[[],[],[],[]])[0],o=e[1],s=e[2],n=e[3],t.map(function(t,e){e=p(t.__data__,e);return i.has(e)?n.push(t):i.set(e,t)}),d.map(function(t,e){var n,e=p(t,e);return((n=i.get(e))?(i.delete(e),o):(n=document.createElementNS("http://www.w3.org/2000/svg",c),f&&n.setAttribute("class",f),n._entering=!0,r)).push(n),n.__data__=t,s.push(n)}),a=null,u=s.length-1;0<=u;--u)a=((l=s[u])._entering&&(delete l._entering,h.insertBefore(l,a)),l);return n=n.concat(Array.from(i.values())),{enter:r,update:o,exit:n,nodes:s}},t.ease=c,t.interpolate=f,t.join=e,null!=z&&((z.utils||(z.utils={})).anim=t)}.call(this),function(){var t;(t=function(t){return this.dir="y"===(t=null==t?{}:t).dir?"y":"x",this._extent=[[0,0],[1,1]],this._sel=null,this._g=null,this.evtHandler={},this}).prototype=((t,e)=>{var n,i={}.hasOwnProperty;for(n in e)i.call(e,n)&&(t[n]=e[n]);return t})(Object.create(Object.prototype),{on:function(t,n){var i=this;return(Array.isArray(t)?t:[t]).map(function(t){var e;return((e=i.evtHandler)[t]||(e[t]=[])).push(n)})},fire:function(t){for(var e,n,i,r,o=[],s=[],a=1,u=arguments.length;a<u;++a)s.push(arguments[a]);for(e=s,a=0,i=(n=this.evtHandler[t]||[]).length;a<i;++a)r=n[a],o.push(r.apply(this,e));return o},extent:function(t){return arguments.length?(this._extent=t,this._render(),this):this._extent},selection:function(){return this._sel?this._sel.slice():null},attached:function(){return!!this._g},_span:function(){var t="x"===this.dir?0:1;return[this._extent[0][t],this._extent[1][t]]},_emit:function(t,e){return this.fire(t,{type:t,selection:this.selection(),sourceEvent:e||null,target:this})},move:function(t,e){var n=this;return this._sel=null!=t?[+t[0],+t[1]]:null,this._render(),["start","brush","end"].map(function(t){return n._emit(t,e)}),this},clear:function(t){return this.move(null,t)},attach:function(s){var e,t,n,i=this;return this._g!==s&&(this._g&&this.detach(),s.__brush&&s.__brush!==this&&s.__brush.detach(),((s.__brush=this)._g=s).setAttribute("fill","none"),s.setAttribute("pointer-events","all"),("undefined"!=typeof navigator&&null!==navigator&&navigator.maxTouchPoints||"ontouchstart"in s)&&(s.style.touchAction="none",s.style.setProperty("-webkit-tap-highlight-color","rgba(0,0,0,0)")),t="x"===this.dir?["w","e"]:["n","s"],n="x"===this.dir?"ew-resize":"ns-resize",this._n={overlay:(e=function(t,e,n){var i,r,o;for(r in null==n&&(n={}),(i=s.querySelector(":scope > rect."+t.split(" ").join("."))||s.appendChild(document.createElementNS("http://www.w3.org/2000/svg","rect"))).setAttribute("class",t),i.__data__={type:e},n)o=n[r],i.setAttribute(r,o);return i})("overlay","overlay",{"pointer-events":"all",cursor:"crosshair"}),selection:e("selection","selection",{cursor:"move",fill:"#777","fill-opacity":.3,stroke:"#fff","shape-rendering":"crispEdges"}),handle:t.map(function(t){return e("handle handle--"+t,t,{cursor:n})})},s.addEventListener("pointerdown",this._down=function(t){return i._start(t)})),this._render(),this},detach:function(){var t,e,n,i;if(this._g){for(this._g.removeEventListener("pointerdown",this._down),t=0,n=(e=[this._n.overlay,this._n.selection].concat(this._n.handle)).length;t<n;++t)(i=e[t]).parentNode&&i.parentNode.removeChild(i);return this._g.__brush===this&&(this._g.__brush=null),this._g=null}},_render:function(){var t,e,n,i,r,o,s,a,u,l,h,c,f,d,p=this;if(this._g){if(e=(i=(t=this._extent)[0])[0],d=i[1],n=(i=t[1])[0],i=i[1],(a=this._n.overlay).setAttribute("x",e),a.setAttribute("y",d),a.setAttribute("width",n-e),a.setAttribute("height",i-d),this._sel)return a=(t=this._sel)[0],u=t[1],t="x"===this.dir?[a,d,u,i]:[e,a,n,u],l=t[0],h=t[1],c=t[2],f=t[3],(d=this._n.selection).style.display="",d.setAttribute("x",l),d.setAttribute("y",h),d.setAttribute("width",c-l),d.setAttribute("height",f-h),this._n.handle.map(function(t,e){return t.style.display="","x"===p.dir?(t.setAttribute("x",(e?c:l)-3),t.setAttribute("y",h-3),t.setAttribute("width",6),t.setAttribute("height",f-h+6)):(t.setAttribute("x",l-3),t.setAttribute("y",(e?f:h)-3),t.setAttribute("width",c-l+6),t.setAttribute("height",6))});for(r=0,o=(t=[this._n.selection].concat(this._n.handle)).length;r<o;++r)(s=t[r]).style.display="none",["x","y","width","height"].map(m)}function m(t){return s.removeAttribute(t)}},_pos:function(t){var e=this._g.getScreenCTM();return e?(t=new DOMPoint(t.clientX,t.clientY).matrixTransform(e.inverse()),"x"===this.dir?t.x:t.y):0},_start:function(t){var e,n,o,s,a,u,l,h,i,r,c,f,d=this;if((null==t.button||0===t.button)&&(e=(t.target.__data__||{}).type))return t.stopImmediatePropagation(),t.preventDefault(),n=this._span(),o=n[0],s=n[1],a=function(t){return(t=o<t?t:o)<s?t:s},u=this._pos(t),l=this._sel?this._sel.slice():null,"new"===(h="selection"===e?"move":"w"!==e&&"n"!==e||!l?"e"!==e&&"s"!==e||!l?"new":"hi":"lo")&&(u=a(u)),i=!1,this._emit("start",t),r=function(t){var e,n,i,r=d._pos(t);return"move"===h?(e=(i=(e=r-u)>(i=o-l[0])?e:i)<(n=s-l[1])?i:n,d._sel=[l[0]+e,l[1]+e]):(i="new"===h?u:"lo"===h?l[1]:l[0],r=a(r),d._sel=[Math.min(i,r),Math.max(i,r)]),d._render(),d._emit("brush",t)},c=function(t){return i=!0,r(t)},f=function(t){var e;return window.removeEventListener("pointermove",c),window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",f),i||"move"===h||(d._sel=null),d._sel&&d._sel[0]===d._sel[1]&&(d._sel=null),d._render(),i&&(e=function(t){return t.stopImmediatePropagation(),t.preventDefault()},window.addEventListener("click",e,!0),setTimeout(function(){return window.removeEventListener("click",e,!0)},0)),d._emit("end",t)},window.addEventListener("pointermove",c),window.addEventListener("pointerup",f),window.addEventListener("pointercancel",f)}}),null!=z&&((z.utils||(z.utils={})).brush=t)}.call(this),function(){var r;(r=function(t){return this.isUnique=null==(t=null==t?{}:t).unique||t.unique,this.map={},this.nmap=[],this.wm=new WeakMap,this.count=0,this._ext=t.extent||[0,1],this.set(t.palette)||t.colors,this.mode(t.mode),this}).default=["#e15c64","#f7b26a","#f3ed9d","#a4bd81","#a0d7d2","#8db1da","#daaedb"],r.prototype=((t,e)=>{var n,i={}.hasOwnProperty;for(n in e)i.call(e,n)&&(t[n]=e[n]);return t})(Object.create(Object.prototype),{set:function(t){var e,n=this,i=(t=null==t?[]:t).key||t.name;return null==e&&(e=null!=i&&this.key!==i),this.key=i,this.colors=Array.isArray(t)&&t.length?t:t.colors&&Array.isArray(t.colors)?t.colors:r.default,this.nmap=t.maps||[],this.tags=this.colors.map(function(t){return t.tag||[]}),this.colors=this.colors.map(function(t){return t.value||t}),1===this.colors.length&&this.colors.push(ldcolor.complement(this.colors[0])),this.colors=this.colors.map(function(t){return ldcolor.hsl(t)}),this.len=2<(i=this.colors.length)?i:2,e?this.reset():this.nmap.map(function(t,e){return(Array.isArray(t)?t:[t]).map(function(t){return n.get(t,0,e)})}),this.tags.map(function(t,e){return t.map(function(t){return n.get(t,0,e)})})},unique:function(t){return null!=t?this.isUnique=!!t:this.isUnique},reset:function(){var n=this;return this.map={},this.wm=new WeakMap,this.count=0,(this.nmap||[]).map(function(t,e){return(Array.isArray(t)?t:[t]).map(function(t){return n.get(t,0,e)})})},mode:function(t){return 0===arguments.length?this._m:this._m=t},extent:function(t){return 0===arguments.length?this._ext:(this._ext=t.map(function(t){return null!=t?t:0}),this._ext.sort(function(t,e){return t-e}))},get:function(t,e,n){switch(null==e&&(e=0),this._m){case 1:return this._vd(t,e);case 2:return this._vc(t,e);case 3:return this._vs(t,e);default:return this._d(t,e,n)}},_v:function(t,e){return 0<e?t=ldcolor.lighter(t,e):e<0&&(t=ldcolor.darker(t,-e)),ldcolor.web(t)},_d:function(t,e,n){var i,r,o,s,a,u,l,h;if(null==e&&(e=0),null!=n?(this.count<n&&(this.count=n+1),i=n%this.len,"object"==typeof t?this.wm.set(t,i):this.map[t]=i):("object"==typeof t?null==(i=this.wm.get(t))&&this.wm.set(t,i=this.count++):null==(i=this.map[t])&&(this.map[t]=i=this.count++),this.isUnique||(i%=this.len)),i>=this.len){for(n=i%(this.len-1),r=Math.floor(i/(this.len-1)),s=(o=[0,1])[0],a=o[1];0<r;)s=(o=[2*s,2*a])[0],a=o[1],r%2&&(s+=1),r>>=1;r=s/a,o=[this.colors[n],this.colors[1+n]],u=o[0],l=o[1],h={h:(o=["h","s","l"].map(function(t){return r*(l[t]-u[t])+u[t]}))[0],s:o[1],l:o[2]}}else h=this.colors[i];return this._v(h,e)},_vs:function(t,e){for(var n,i,r,o=this._ext||[0,1],s=-1,a=0,u=o.length-1;a<u;++a)if(!(t>=o[(n=a)+1])){s=n;break}return-1===s&&(s=o.length),this._v(this.colors[(i=0<s?s:0)<(r=this.colors.length-1)?i:r],e)},_vd:function(t,e){var n=this._ext||[0,1],i=(n=0<(t=(t-n[0])/(n[1]-n[0]||1))?t:0)<1?n:1;return this._v(this.colors[Math.floor((n=i*(this.len||1))<(t=this.len-1)?n:t)],e)},_vc:function(t,e){var n,i,r,o=this._ext||[0,1],t=((o=0<(t=(t-o[0])/(o[1]-o[0]||1))?t:0)<1?o:1)*(0<(o=this.len-1)?o:0),o=t==this.len-1?[0<(o=this.len-2)?o:0,0<(o=this.len-1)?o:0]:[Math.floor(t),Math.floor(t)+1],s=o[0];return o=[this.colors[s],this.colors[o[1]]],n=o[0],i=o[1],r=t-s,t=(o=["h","s","l"].map(function(t){return r*(i[t]-n[t])+n[t]}))[0],this._v({h:t,s:o[1],l:o[2]},e)},text:function(t,e){return null==e&&(e={}),t=ldcolor.hcl(this.get(t)),ldcolor.web(50<t.l?e.textDark||"#000":e.textLight||"#fff")}}),r.mode={ordinal:0,discrete:1,continuous:2,ranges:3},null!=z&&((z.utils||(z.utils={})).tint=r)}.call(this),function(){var t=function(t){var i,e,n,r,o,s,a,u,l,h,c,f,d,p,m,y,_,g,v,b,x,w,k,A=(t=null==t?{}:t).extent||[0,1],M=t.len||3,N=A=(A=A.map(function(t){return isNaN(t)?0:t}))[0]>A[1]?[A[1],A[0]]:A;if(null!=t.exp){if(i=[10,15,20,25,30,40,50,75,100],e=[],n=[],r=Math.pow(10,t.exp),null==t.pretty||t.pretty){for(A=[[A[0],"floor"],[A[1],"ceil"]].map(function(t){var e=t[0],n=t[1],t=i.map(function(t){return[t,Math.abs(e-Math[n](e/t)*t)]});return t.sort(function(t,e){return t[1]-e[1]}),t[0][0]*Math[n](e/t[0][0])}),o=A[1]-A[0],s=1;s<=M;++s){for(a=s,u=+(o*(Math.pow(a/M,r)-Math.pow((a-1)/M,r))).toFixed(2),l=Math.floor(Math.log(u)/Math.LN10),h=0,c=i.length;h<c&&!((f=i[h]*Math.pow(10,l-1).toFixed(2))>=u);++h);n.push(f)}for(o=n.reduce(function(t,e){return t+e},0),p=(A=[[(A=[A[0],(d=A[0]+o)>(m=A[1])?d:m])[0],"floor"],[A[1],"ceil"]].map(function(t){var e=t[0],n=t[1],t=i.map(function(t){return[t,Math.abs(e-Math[n](e/t)*t)]});return t.sort(function(t,e){return t[1]-e[1]}),t[0][0]*Math[n](e/t[0][0])}))[0],s=0;s<M&&(a=s,e.push(p),!((p+=n[a])>=N[1]));++s);e.push(p)}else o=A[1]-A[0],e=(()=>{for(var t=[],e=0,n=M;e<=n;++e)t.push(e);return t})().map(function(t){return o*Math.pow(t/M,r)+A[0]});e.sort(function(t,e){return t-e}),m=[e[0],e[M-1]]}else if(null==t.pretty||t.pretty){for(u=(A[1]-A[0])/(M+1),l=Math.floor(Math.log((A[1]-A[0]||1)/(M+1))/Math.LN10),s=0,c=(d=[10,20,25,50,100]).length;s<c&&(a=d[s],!((f=a*Math.pow(10,l-1))>u));++s);y=f*Math.floor(A[0]/f),m=[(e=(()=>{for(var t=[],e=0,n=M;e<=n;++e)t.push(e);return t})().map(function(t){return y+f*t}))[0],e[M]]}else m=[(e=(()=>{for(var t=[],e=0,n=M;e<n;++e)t.push(e);return t})().map(function(t){return A[0]+(A[1]-A[0])*t/(1<(t=M-1)?t:1)}))[0],e[M-1]];if(_=t.legend){if(g=_.format||function(t){return t},v=_.unit||"",_.range)for(b=[],s=0,x=e.length-1;s<x;++s)w=(d=[e[a=s],e[a+1]])[0],b.push({ext:[w,k=d[1]],key:(w+k)/2,text:_.text?_.text(w,k):g(w)+" - "+g(k)+v});else b=e.map(function(t){return{key:t,text:_.text?_.text(t):g(t)+""+v}});b.sort(function(t,e){return t.key<e.key?1:t.key>e.key?-1:0})}return{ticks:e,extent:m,labels:b}};null!=z&&((z.utils||(z.utils={})).tick=t)}.call(this),function(){var t;t={from:function(t){var u=this,l=function(t,e){var n,i;if(e.preset){var r,o=t,s=JSON.parse(JSON.stringify(u.preset[e.preset])),a={}.hasOwnProperty;for(r in s)a.call(s,r)&&(o[r]=s[r])}for(n in e)i=e[n],"preset"!==n&&("string"==typeof i?t[n]=JSON.parse(JSON.stringify(u.preset[i]))||{}:l(t[n]||(t[n]={}),i));return t};return l({},t)},preset:{default:{margin:{type:"number"},font:t={family:{type:"font"},size:{type:"quantity",default:"1em",units:[{name:"em",max:10,step:.01,default:1},{name:"px",max:256,step:1,default:16}]}},color:{type:"color",default:"currentColor"},palette:{type:"palette"},background:{type:"color",default:"transparent"}},font:t,tip:{enabled:{type:"boolean",default:!0},format:{type:"format",default:".3s"}},label:{format:{type:"format",default:".3s"}},legend:{mode:{type:"choice",values:["list","direct"],default:"list"},selectable:{type:"boolean",default:!0},actions:{type:"boolean",default:!0},enabled:{type:"boolean",default:!0},position:{type:"choice",values:["bottom","right"],default:"right"},sort:{direction:{type:"choice",values:["asc","desc"],default:"desc"},mode:{type:"choice",values:["label","value","none"],default:"value"}},subset:{mode:{type:"choice",values:["shrink","dim","partial"],default:"shrink"},opacity:{type:"number",default:.2,min:0,max:1,step:.05}},crossfilter:{type:"boolean",default:!1}},bin:{enabled:{type:"boolean",default:!1},width:{type:"number",default:0,min:0,max:1e6,step:.01},count:{type:"number",default:0,min:0,max:100,step:1},anchor:{type:"number",default:0,min:-1e6,max:1e6,step:.01},closed:{type:"choice",values:["left","right"],default:"left"},label:{type:"choice",values:["range","start","center"],default:"range"},format:{type:"format",default:""},empty:{type:"boolean",default:!0}},axis:{enabled:{type:"boolean",default:!0},grid:{show:{type:"boolean",default:!1},color:{type:"color",default:"currentColor"},opacity:{type:"number",default:.12,min:0,max:1,step:.01},width:{type:"number",default:1,min:0,max:10,step:.5},dash:{type:"text",default:""}},center:{type:"boolean",default:!1},tick:{inner:{type:"number",name:"Inner Tick Size",default:8,min:0,max:40,step:.1},color:{type:"color",default:"currentColor"},count:{type:"number",default:4,min:1,max:40},boundaryOffset:{type:"boolean",default:!0}},baseline:{show:{type:"boolean",default:!0},color:{type:"color",default:"currentColor"}},label:{color:{type:"color",default:"currentColor"},format:{type:"format",default:".3s"},direction:{type:"choice",default:"horizontal",values:["horizontal","angled","vertical","auto"]},angle:{type:"number",default:45,min:0,max:90,step:1},gap:{type:"number",default:1.5,min:0,max:10,step:.1},strategy:{type:"choice",default:"stride",values:["stride","ends"]},tolerance:{type:"number",default:.2,min:0,max:1,step:.05},padding:{type:"number",default:1,min:0,max:100,step:.5},font:t},caption:{color:{type:"color",default:"currentColor"},text:{type:"text",default:""},show:{type:"boolean",default:!0},padding:{type:"number",default:1,min:0,max:100,step:.5},position:{type:"choice",default:4,values:[{name:"in / start",value:0},{name:"in / middle",value:1},{name:"in / end",value:2},{name:"out / start",value:3},{name:"out / middle",value:4},{name:"out / end",value:5}]},font:t},sideNoteStart:{show:{type:"boolean",default:!1},text:{type:"text",default:""},position:{type:"choice",default:0,values:[{name:"in",value:0},{name:"out",value:1}]},font:t,color:{type:"color",default:"currentColor"},padding:{type:"number",default:1,min:0,max:100,step:.5}},sideNoteEnd:{show:{type:"boolean",default:!1},text:{type:"text",default:""},position:{type:"choice",default:0,values:[{name:"in",value:0},{name:"out",value:1}]},font:t,color:{type:"color",default:"currentColor"},padding:{type:"number",default:1,min:0,max:100,step:.5}}}}},null!=z&&((z.utils||(z.utils={})).config=t)}.call(this),function(){var d={number:function(t){return(t=(t=null==t?{}:t).data.filter(function(t){return!(!t||""===(t+"").trim())})).filter(function(t){return!isNaN(parseFloat(t))}).length/t.length},serial:function(t){var e,n,i,r,o,s,a;for((e=[].concat((t=null==t?{}:t).data)).sort(function(t,e){return e-t}),n={},i=1,r=e.length;i<r;++i)o=i,isNaN(e[o])||isNaN(e[o-1])?n[e[o]>e[o-1]?e[o]+":"+e[o-1]:e[o-1]+":"+e[o]]=!0:s=e[o]-e[o-1],n[s]=!0;return 1/((()=>{var t=[];for(a in n)t.push(a);return t})().filter(function(t){return"0"!==t}).length||2)},text:function(t){return 1-this.number(t=null==t?{}:t)},category:function(t){var e;return null==t&&(t={}),e=(e=0<(e=1-(0<(e=Array.from(new Set(t.data)).length-2)?e:0)/(e=t.data.length)-1/e)?e:0)<1?e:1,this.number(t)&&(e*=.9),e},parse:function(t){var e,n;return Array.isArray(t)?(e=t.slice(0,1)[0],n=(n=t.slice(1)).map(function(n,t){var i={};return e.map(function(t,e){return i[t]=n[e]}),i}),{head:e,body:n}):t},autotype:function(t){var e,n,i,r,o,s,a,u,l=[];for(n in(t=null==t?[]:t)[0]||{})l.push(n);for(i=[],r=0,o=(e=l).length;r<o;++r)s=e[r],u=t.map(h),a={key:s,types:{R:d.number({data:u}),O:d.serial({data:u}),N:d.text({data:u}),C:d.category({data:u})}},(u=["R","O","N","C"].map(c)).sort(f),a.type=u[0][0],i.push(a);return i;function h(t){return t[s]}function c(t){return[t,a.types[t]]}function f(t,e){return e[1]-t[1]}},autobind:function(t,n){var e,i,r,o,s,a,u,l,h,c,f,d,p,m,y;for(null==n&&(n={}),e=this.autotype(t=null==t?[]:t),(i=(()=>{var t,e=[];for(r in t=n)o=t[r],e.push({k:r,v:o});return e})().filter(function(t){return!t.v.passive})).sort(function(t,e){var n=(t.v.priority||100)-(e.v.priority||100);return 0!=n?n:(n=[t.v.type||"R",e.v.type||"R"].map(function(i){return Math.min.apply(Math,(()=>{for(var t=[],e=0,n=i.length;e<n;++e)t.push(e);return t})().map(function(t){return"CONR".indexOf(i[t])}))}))[0]-n[1]}),s=0,a=i.length;s<a;++s)for((u=i[s]).bind=null,h=0,c=(l=u.v.type||"RNOC").length;h<c;++h)for(f=l[h],e.sort(_),d=0,p=e.length;d<p;++d)if(!((m=e[d]).types[f]<.5||m.used||"C"===f&&.5<m.types.R)){u.bind=u.v.multiple?[m]:m,m.used=!0;break}for(s=0,a=i.length;s<a;++s)if((u=i[s]).v.multiple)for(h=0,c=(l=u.v.type||"RNOC").length;h<c;++h)for(f=l[h],e.sort(g),d=0,p=e.length;d<p;++d)(m=e[d]).types[f]<.5||m.used||"C"===f&&.5<m.types.R||(u.bind.push(m),m.used=!0);for(y={},s=0,a=i.length;s<a;++s)(u=i[s]).bind&&(y[u.k]=u.bind,(Array.isArray(u.bind)?u.bind:[u.bind]).map(v));return y;function _(t,e){var n=(e.types[f]||0)-(t.types[f]||0);return e.types[f]===t.types[f]&&"R"===f?(t.types.O||0)-(e.types.O||0):n}function g(t,e){var n=(e[f]||0)-(t[f]||0);return e[f]===t[f]&&"R"===f?(t.O||0)-(e.O||0):n}function v(t){var e=t.used;return delete t.used,e}}};null!=z&&((z.utils||(z.utils={})).data=d)}.call(this),function(){var t={place:function(i,t){var o,e,r,n,s,a,u,l,h,c,f,d,p,m,y;if(!(i=null==i?[]:i).length)return[];for(o=(t=null==t?{}:t).gap||0,e=null!=t.top?t.top:0,t=null!=t.bottom?t.bottom:1/0,r=function(t){return(t||{}).height||0},(n=i.map(function(t,e){return e})).sort(function(t,e){return i[t].y-i[e].y||t-e}),s=[],a=0,u=n.length;a<u;++a)for(l=n[a],s.push({list:[l],h:r(i[l]),sum:i[l].y,n:1});1<s.length&&(h=s[s.length-1],!((c=s[s.length-2]).sum/c.n+c.h+o<=h.sum/h.n));)c.sum+=h.sum-h.n*(c.h+o),c.n+=h.n,c.h+=o+h.h,c.list=c.list.concat(h.list),s.pop();if(f=s.map(function(t){return t.sum/t.n}),(d=function(){for(var t,e,n=[],i=1,r=s.length;i<r;++i)e=f[(t=i)-1]+s[t-1].h+o,f[t]<e&&n.push(f[t]=e);return n})(),t<1/0)for(f[p=s.length-1]+s[p].h>t&&(f[p]=t-s[p].h),a=s.length-2;0<=a;--a)m=f[(l=a)+1]-s[l].h-o,f[l]>m&&(f[l]=m);return f[0]<e&&(f[0]=e),d(),y=[],s.map(function(t,e){var n=f[e];return t.list.map(function(t){return y[t]={y:n,moved:.5<Math.abs(n-i[t].y)},n+=r(i[t])+o})}),y}};null!=z&&((z.utils||(z.utils={})).labels=t)}.call(this),function(){var h,c;h="http://www.w3.org/2000/svg",(c=function(o){var t,e,n,i,r,s,a,u,l=this;if(null==o&&(o={}),this._data=o.data||[],this.name=o.name||"legend",this.cfg=o.cfg||{},this.root="string"==typeof o.root?document.querySelector(o.root):o.root,this.dir=o.direction||"vertical",this.evtHandler={},this._picked=Object.fromEntries(this._data.map(function(t){return[t.key,!0]})),this.layout=o.layout||new layout({root:this.root}),(e=this.layout).on("update",function(){return l.update()}),e.on("render",function(){return l.render()}),this.id=Math.random().toString(36).substring(2),this._anchor=null,this._pos={},e=this.layout.getNode(this.name),t=this.layout.getGroup(this.name),e.querySelector("[ld-each=legend]")||(e.innerHTML='<div class="pdlg '+this.dir+'">\n <div ld-each="legend">\n <div class="pdl-cell" ld="shape" data-only></div>\n <div class="pdl-cell" ld="text" data-only></div>\n </div>\n</div>'),t.querySelector("[ld-each=legend]")||(e=document.createElementNS(h,"g"),n=document.createElementNS(h,"g"),i=document.createElementNS(h,"g"),e.classList.add("pdlg-g"),e.setAttribute("ld-each","legend"),n.setAttribute("ld","shape"),i.setAttribute("ld","text"),e.appendChild(n),e.appendChild(i),t.appendChild(e)),this._i18n=o.i18n||("undefined"!=typeof block&&null!==block&&block.i18n&&block.i18n.module?block.i18n.module:null),this._t=o.t||null,this._i18n){if(r=this._i18n.addResourceBundle)for(s in a=c.i18n){u=a[s];try{r.call(this._i18n,s,c.i18nNs,u,!0,!1)}catch(t){}}this._i18n.on&&this._i18n.on("languageChanged",this._lngHandler=function(){return l._relocalize()})}return this._func=[{key:"all",type:"func",text:this._text("all")},{key:"none",type:"func",text:this._text("none")}],this.view={layout:new ldview({root:this.layout.getNode(this.name),initRender:!1,handler:{legend:{list:function(){var n,t=l._data.map(function(t){return t}),i=l.cfg.sort||{};return"none"!==i.mode&&(n="desc"===i.direction?1:-1,t.sort(function(t,e){return"value"===i.mode?n*(e.value-t.value):n*(t.text<e.text?1:t.text>e.text?-1:0)})),t.concat(l._actions()?l._func:[])},key:function(t){return t.key},view:{handler:{shape:function(t){return t.node.setAttribute("data-name",l._name(t.ctx,"shape"))},text:function(t){var e=t.node,t=t.ctx;return e.setAttribute("data-name",l._name(t,"text")),e.innerText=t.text}}}}}}),render:new ldview({root:this.layout.getGroup(this.name),initRender:!1,handler:{legend:{list:function(){return l._data.concat(l._actions()?l._func:[])},key:function(t){return t.key},view:{action:{click:{"@":function(t){t.node;var e,n=t.ctx;if(l.cfg.selectable){if("func"===n.type)for(e in l._picked)l._picked[e]="all"===n.key;else l._picked[n.key]=!l._picked[n.key];return l.view.render.render("legend"),l.fire("select",l._picked)}}}},handler:{"@":function(t){var e=t.node,t=t.ctx;return e.style.opacity=!l.cfg.selectable||"func"===t.type||l._picked[t.key]?1:.3,l._direct()&&(t=l._pos[t.key])?e.setAttribute("transform","translate(0,"+t.dy+")"):e.removeAttribute("transform")},shape:function(t){var e,n,i,r=t.node,t=t.ctx;if("func"!==t.type)return r.querySelector("circle")||r.appendChild(document.createElementNS(h,"circle")),e=r.querySelector("circle"),n=l.layout.getBox(l._name(t,"shape")),i=l.layout.getBox(l.name),e.setAttribute("cx",".5em"),e.setAttribute("cy",".5em"),e.setAttribute("r",".5em"),e.setAttribute("transform","translate("+(n.x-i.x)+", "+(n.y-i.y)+")"),"function"==typeof o.shape?o.shape.call(e,t):void 0;r.style.display="none"},text:function(t){var e=t.node,t=t.ctx,n=l.layout.getNode(l._name(t,"text")),t=l.layout.getBox(l._name(t,"text")),i=l.layout.getBox(l.name);return e.setAttribute("transform","translate("+(t.x-i.x)+", "+(t.y-i.y)+")"),e.textContent="",t=wrapSvgText({node:n,useRange:!0}),e.appendChild(t)}}}}}})},this.update(),this}).i18nNs="@plotdb/chart.legend",c.i18n={en:{all:"Select All",none:"Select None"},"zh-TW":{all:"全選",none:"全不選"},"zh-CN":{all:"全选",none:"全不选"},ja:{all:"すべて選択",none:"すべて解除"}},c.prototype=((t,e)=>{var n,i={}.hasOwnProperty;for(n in e)i.call(e,n)&&(t[n]=e[n]);return t})(Object.create(Object.prototype),{_text:function(t){var e,n;return this._t&&(e=this._t("legend."+t))&&e!=="legend."+t||(n=c.i18nNs+":"+t,this._i18n&&this._i18n.t&&(e=this._i18n.t(n))&&e!==n&&e!==t)?e:(n=(n=this._i18n?this._i18n.language||this._i18n.lng:null)||("undefined"!=typeof document&&null!==document?document.documentElement.lang:"")||"en",(c.i18n[n]||c.i18n[n.split("-")[0]]||(/^zh/i.exec(n)?c.i18n[/cn|hans|sg/i.exec(n)?"zh-CN":"zh-TW"]:void 0)||c.i18n.en)[t])},_relocalize:function(){var e=this;if(this._func.map(function(t){return t.text=e._text(t.key)}),this._actions())return this.view.layout.render("legend"),this.layout.update(!1),this.view.render.render()},destroy:function(){return this._i18n&&this._lngHandler&&this._i18n.off&&this._i18n.off("languageChanged",this._lngHandler),this._lngHandler=null},_actions:function(){return!(!this.cfg.selectable||null!=this.cfg.actions&&!this.cfg.actions||this._direct())},_direct:function(){return"direct"===this.cfg.mode&&!!this._anchor&&"vertical"===this.dir},anchor:function(t){return arguments.length?(this._anchor=t,this):this._anchor},_solve:function(){var i,r,t,o,s=this;if(this._pos={},this._direct()&&(i=this.layout.getBox(this.name),r=[],this._data.map(function(t){var e=s.layout.getBox(s._name(t,"text")),n=function(){try{return this._anchor(t)}catch(t){return null}}.call(s);return r.push({d:t,nbox:e,y:n})}),(t=r.filter(function(t){return null!=t.y&&!isNaN(t.y)})).length))return o=z.utils.labels.place(t.map(function(t){return{y:t.y-t.nbox.height/2,height:t.nbox.height}}),{top:0,bottom:i.height,gap:2}),t.map(function(t,e){var n=t.nbox.y-i.y;return s._pos[t.d.key]={dy:o[e].y-n,y:o[e].y,h:t.nbox.height,moved:o[e].moved,anchor:t.y}})},_leads:function(){var e,t,n,i,r,o,s=[],a=this.layout.getGroup(this.name);if(this._lead||(this._lead=document.createElementNS(h,"g"),this._lead.setAttribute("data-type","leader"),this._lead.style.pointerEvents="none"),this._direct()){for(e in a.insertBefore(this._lead,a.firstChild),this._lead.textContent="",t=this._pos)(r=t[e]).moved&&this._data.filter(u)[0]&&(n=document.createElementNS(h,"path"),i=(r=[r.anchor,r.y+r.h/2])[0],r=r[1],o=this._shapeX(),n.setAttribute("d","M0 "+i+" L"+o/2+" "+i+" L"+o/2+" "+r+" L"+o+" "+r),n.setAttribute("fill","none"),n.setAttribute("stroke","currentColor"),n.setAttribute("stroke-width",1),n.setAttribute("opacity",this._picked[e]?.35:.12),s.push(this._lead.appendChild(n)));return s}function u(t){return t.key===e}this._lead.parentNode&&this._lead.parentNode.removeChild(this._lead)},_shapeX:function(){var t,e=this._data[0];return e?(t=this.layout.getBox(this.name),this.layout.getBox(this._name(e,"shape")).x-t.x):0},_name:function(t,e){return"pdlg-"+(e=null==e?"s":e)+"-"+this.id+"-"+(t.type||"")+"-"+t.key},enabled:function(){return this._data&&this._data.length&&(!(null!=this.cfg.enabled)||this.cfg.enabled)},update:function(){var t=this.enabled()?"":"0px",e=this.layout.getNode(this.name).style;return e.width=t,e.height=t,e.padding=t,e.margin=t,(e=this.layout.getNode(this.name).querySelector(".pdlg"))&&("vertical"===this.dir?(e.style.height="fit-content",e.style.height=getComputedStyle(e.parentNode).height):e.style.height=""),this.view.layout.render()},render:function(){var t=this.enabled();if(this.layout.getGroup(this.name).style.display=t?"":"none",t)return this._solve(),this.view.render.render(),this._leads()},config:function(t){var e,n=this;return null==t?this.cfg:(this.cfg.selectable!==t.selectable&&(this._picked=null,this._updatePicked()),this.cfg=t,this.dir="bottom"===this.cfg.position?"horizontal":"vertical",e=this.layout.getNode(this.name).querySelector(".pdlg"),["horizontal","vertical"].map(function(t){return e.classList.toggle(t,n.dir===t)}))},_updatePicked:function(){var e=this;return null==this._picked&&(this._picked=Object.fromEntries(this._data.map(function(t){return[t.key,!0]}))),this._data.map(function(t){if(null==e._picked[t.key])return e._picked[t.key]=!0})},data:function(t){var n;return arguments.length?(n={},t.map(function(t,e){return n[t.key]=e}),this._data=t.filter(function(t,e){return n[t.key]===e}),this._range=this._data.filter(function(t){return t.ext}),this._updatePicked(),this.update(),this.layout.update(!1),this.view.render.render()):this._data},on:function(t,n){var i=this;return(Array.isArray(t)?t:[t]).map(function(t){var e;return((e=i.evtHandler)[t]||(e[t]=[])).push(n)})},fire:function(t){for(var e,n,i,r,o=[],s=[],a=1,u=arguments.length;a<u;++a)s.push(arguments[a]);for(e=s,a=0,i=(n=this.evtHandler[t]||[]).length;a<i;++a)r=n[a],o.push(r.apply(this,e));return o},isSelected:function(e){var n=this;return this._range&&this._range.length?!!this._range.filter(function(t){return e>=t.ext[0]&&e<t.ext[1]&&n._picked[t.key]}).length:!!this._picked[e]},mode:function(){return"shrink"===((this.cfg.subset||{}).mode||"shrink")?"shrink":"dim"},opacity:function(){var t;return null!=(t=(this.cfg.subset||{}).opacity)?t:.2},isVisible:function(t){return"shrink"!==this.mode()||this.isSelected(t)},select:function(t){var e;return null==t?this._picked=Object.fromEntries(this._data.map(function(t){return[t.key,!0]})):(e=Object.fromEntries(t.map(function(t){return[t,!0]})),this._picked=Object.fromEntries(this._data.map(function(t){return[t.key,!!e[t.key]]}))),this.view.render.render("legend"),this},selected:function(){var e=this,t=this._data.filter(function(t){return!!e._picked[t.key]}).map(function(t){return t.key});return t.length===this._data.length?null:t}}),null!=z&&((z.utils||(z.utils={})).legend=c)}.call(this),function(){var p,t;function m(t,e){var n,i={}.hasOwnProperty;for(n in e)i.call(e,n)&&(t[n]=e[n]);return t}p=function(t){return document.createElementNS("http://www.w3.org/2000/svg",t)},((t=function(t){var i,e=this;return this.dir={bottom:0,left:2}[(t=null==t?{}:t).direction||"bottom"],this.name=t.name||"axis",this.layout=t.layout||new layout({root:this.root}),this._gridName=t.grid||"view",this._ticks=[],this._scale=t.scale||function(t){return t},this._format=z.utils.format.simple,this._config(t.cfg),this._map={},this._n=i={root:p("g"),layout:this.layout.getNode(this.name),render:this.layout.getGroup(this.name),wrap:null,domain:p("path")},i.render.appendChild(i.root),i.root.appendChild(i.domain),i.label=p("text"),i.label.textContent="",(t=i.label).setAttribute("dominant-baseline","hanging"),t.setAttribute("text-anchor","middle"),i.root.appendChild(i.label),i.sideNote=[0,1].map(function(t){var e,n=p("text");return n.textContent="",(e=n).setAttribute("dominant-baseline","hanging"),e.setAttribute("text-anchor",["start","end"][t]),i.root.appendChild(n)}),this.wrapper(),(t=this.layout).on("update",function(){return e.update()}),t.on("render",function(){return e.render()}),this}).prototype=m(Object.create(Object.prototype),{wrapper:function(){var t,e=this._n;return e.wrap&&e.wrap.parentNode&&e.wrap.parentNode.removeChild(e.wrap),e.wrap=document.createElement("div"),m(((t=e.wrap.style).visibility="hidden",t.position="absolute",t.top=0,t.left=0,t.pointerEvents="none",t.userSelect="none",t.zIndex=0,t.wordBreak="break-all",t.lineHeight=".95em",t),this.dir<2&&null!=this.cfg.textWidth?{whiteSpace:"wrap",width:(1<(t=this.cfg.textWidth)?t:1)+"em"}:{whiteSpace:"pre",width:"4em"}),e.layout.appendChild(e.wrap)},_config:function(e){var t,n=this;return null==e&&(e={}),this.cfg={grid:{},tick:{inner:8},baseline:{},label:{padding:1,direction:"horizontal",gap:1.5,strategy:"stride",tolerance:.2},caption:{padding:1},enabled:e.enabled,sideNoteStart:{padding:1},sideNoteEnd:{padding:1}},["grid","tick","baseline","label","caption","sideNoteStart","sideNoteEnd"].map(function(t){return m(n.cfg[t],e[t]||{})}),(t=this.cfg.label).font||(t.font={}),(t=this.cfg.caption).font||(t.font={}),(t=this.cfg.sideNoteStart).font||(t.font={}),(t=this.cfg.sideNoteEnd).font||(t.font={}),this.format(this.cfg.label.format)},config:function(t){return null==t?this.cfg:(this._config(t),this.wrapper())},format:function(t){return null==t?this._format:this._format="string"==typeof t?z.utils.format.from(t):t||z.utils.format.simple},scale:function(t){return null!=t?this._scale=t:this._scale},caption:function(t){return arguments.length&&(this._caption=t),!this.cfg.enabled||null!=this.cfg.caption.show&&!this.cfg.caption.show?this._n.label.textContent="":this._n.label.textContent=this.cfg.caption.text||this._caption||""},update:function(){},ticks:function(n){var t,e,i,r=this,o={},s=this._n.layout.getBoundingClientRect()[this.dir<2?"width":"height"],a=this.dir<2&&"horizontal"!==this.cfg.label.direction?12:25,s=Math.round(s/a),u=1<(t=Math.round(n.length/(1<s?s:1)))?t:1,l="ends"===this.cfg.label.strategy;for(e in this._ticks=n.filter(function(t,e){return!(e%u)||l&&e===n.length-1}).map(function(t){var e,n;return o[(t="object"!=typeof t?{v:t}:t).v]=m((e=r._map)[n=t.v]||(e[n]={}),t)}),t=this._map)i=t[e],o[e]||i.n.g.parentNode.removeChild(i.n.g);return this._map=o,this._ticks.filter(function(t){return!t.n}).map(function(t){if(t.n={g:p("g"),p:p("path"),t:p("g")},t.n.g.appendChild(t.n.p),t.n.g.appendChild(t.n.t),r._n.root.appendChild(t.n.g),isNaN(+t.v))return t.t=t.v})},render:function(){var i,t,r,e,n,o,s,a=this,u=this._n,l=this.dir<2,h=u.wrap;if(h.style.fontSize=this.cfg.label.font.size?this.cfg.label.font.size+""||"":void 0,h.setAttribute("class",(this.cfg.label.font.family||{}).className||""),i=this._ticks,null==this.cfg.enabled||this.cfg.enabled)return l?((t=u.layout.style).height="",t.paddingTop="",t.paddingBottom=""):((t=u.layout.style).width="",t.paddingLeft="",t.paddingRight=""),u.domain.style.display="",i.map(function(t){return t.n.g.style.display=""}),r=getComputedStyle(h).fontSize,e=u.layout.getBoundingClientRect(),(t=u.domain.style).strokeWidth=1,t.stroke="currentColor",t.fill="none",i.map(function(t,e){var n,e=e?e===i.length-1?2:1:0;return t._c=null!=t.c?t.c:a._scale(t.v)+(a._scale.bandwidth?a._scale.bandwidth()/2:0),t._t=null!=t.t?t.t:a._format(t.v),(n=t.n.p.style).strokeWidth=1,n.stroke="currentColor",n.fill="none",h.textContent=t._t,h.style.textAlign=l?["left","center","right"][e]:["right","left"][a.dir-2],t.n.tt=wrapSvgText({node:h}),t.n.t.style.fontSize=r,t.n.t.style.fill=a.cfg.label.color,t.n.t.textContent="",t.n.t.appendChild(t.n.tt),t.n.t.setAttribute("class",(a.cfg.label.font||{}).className||"")}),i.sort(function(t,e){return t._c-e._c}),u.domain.style.stroke=this.cfg.baseline.show?this.cfg.baseline.color:"none",n=(this.cfg.caption.position||0)%3,o=Math.floor((this.cfg.caption.position||0)/3),(s=u.label).setAttribute("text-anchor",["start","middle","end"][n]),s.setAttribute("dominant-baseline",["baseline","hanging"][o]),u.sideNote.map(function(t,e){e=(a.cfg[["sideNoteStart","sideNoteEnd"][e]]||{}).position||0;return t.setAttribute("dominant-baseline",["baseline","hanging"][e])}),l?(u.domain.setAttribute("d","M0 0L"+e.width+" 0Z"),u.label.setAttribute("x",e.width/2),u.label.setAttribute("x",[2,e.width/2,e.width-2][n])):(u.domain.setAttribute("d","M0 0L0 "+e.height+"Z"),s=[2,e.height/2,e.height-2][n],u.label.setAttribute("transform","translate(0,"+s+") rotate(90)")),i.map(function(t){return t.box=t.n.t.getBBox()}),this.adjust();l?((t=u.layout.style).height="0px",t.paddingTop="0",t.paddingBottom="0"):((t=u.layout.style).width="0px",t.paddingLeft="0",t.paddingRight="0"),u.domain.style.display="none",i.map(function(t){return t.n.g.style.display="none"})},adjust:function(){for(var t,r,e,n,i,o,s,u,l,a,h,c,f,d,p,m,y,_,g=this,v=this._ticks,b=this.dir<2,x=(parseFloat(getComputedStyle(this._n.wrap).fontSize)||16)*(null!=this.cfg.label.gap?this.cfg.label.gap:1.5),w=function(t){for(var e,n=null,i=0,r=t.length;i<r;++i){if(e=t[i],e=v[e],null!=n&&e._start-(n._start+n._size)<x)return!1;n=e}return!0},k=function(t,e,n){var i=b&&"vertical"===n,n=b&&"angled"===n,r=null!=g.cfg.label.angle?g.cfg.label.angle:45,o=[Math.cos(r*Math.PI/180),Math.sin(r*Math.PI/180)],s=o[0],o=o[1],e=e?e===v.length-1?2:1:0,a=t._c,u=t.box,l={x:-u.x,y:-u.y},h=!g._scale.bandwidth&&(null!=g.cfg.tick.boundaryOffset?!!g.cfg.tick.boundaryOffset:g.dir<2),h=!i&&h?e/2:.5;return i?(l.x-=u.width,l.y-=u.height*h):n?l.x-=u.width:b?l.x-=u.width*h:l.y-=u.height*h,t.n.tt.setAttribute("transform","translate("+l.x+","+l.y+")"),t._size=i?u.height:n?u.width*s+u.height*o:u[b?"width":"height"],t._sizeAlt=i?u.width:n?u.width*o+u.height*s:u[b?"height":"width"],t._start=n?a-u.width*s:a-t._size*h,b?(t.n.g.setAttribute("transform","translate("+a+",0)"),t.n.p.setAttribute("d","M0 0L0 "+g.cfg.tick.inner),e=g.cfg.tick.inner+g.cfg.label.padding,t.n.t.setAttribute("transform","translate(0,"+e+")"+(i?" rotate(-90)":n?" rotate("+-r+")":""))):(t.n.g.setAttribute("transform","translate(0,"+a+")"),t.n.p.setAttribute("d","M0 0L-"+g.cfg.tick.inner+" 0"),t.n.t.setAttribute("transform","translate("+(-g.cfg.tick.inner-t._sizeAlt-1-g.cfg.label.padding)+",0)")),t.n.p.style.stroke=g.cfg.tick.color||""},A=b&&"auto"===this.cfg.label.direction?["horizontal","angled","vertical"]:[this.cfg.label.direction||"horizontal"],M=[],N=0,S=v.length;N<S;++N)r=N,M.push(r);for(t=M,N=0,e=A.length;N<e&&(n=A[N],v.map(z),!w(t));++N);if(i=[0],1<v.length)if("ends"!==this.cfg.label.strategy){for(o=1;o<v.length&&!w((()=>{var t,e,n,i=[];for(t=0,n=v.length,e=o;e<0?n<t:t<n;t+=e)r=t,i.push(r);return i})());)o++;for(M=[],N=0,S=v.length;o<0?S<N:N<S;N+=o)r=N,M.push(r);i=M}else for(s=null!=this.cfg.label.tolerance?this.cfg.label.tolerance:.2,_=[v[0]._c,v[v.length-1]._c],u=_[0],l=_[1],a=function(t){for(var e,n,i,r,o,s=[],a=0;a<=t;++a){for(e=u+(l-u)*a/t,n=0,i=1,r=v.length;i<r;++i)o=i,Math.abs(v[o]._c-e)<Math.abs(v[n]._c-e)&&(n=o);s[s.length-1]!==n&&s.push(n)}return s},h=function(t){var e,n,i,r;if(!(t.length<3)&&(e=(v[t[t.length-1]]._c-v[t[0]]._c)/(t.length-1)))for(n=0,i=t.length-1;n<i;++n)if(r=v[t[(r=n)+1]]._c-v[t[r]]._c,Math.abs(r-e)>e*s+.5)return!1;return!0},N=v.length-1;1<=N;--N)if(1<(c=a(N)).length&&h(c)&&w(c)){i=c;break}return f={},i.map(function(t){return f[t]=!0}),v.map(function(t,e){return t.n.t.style.opacity=f[e]?1:0}),_=v.filter(function(t,e){return f[e]}),this._grid(v),this._n.label.style.fill=this.cfg.caption.color,this._n.label.style.fontSize=this.cfg.caption.font.size?this.cfg.caption.font.size+""||"":void 0,this._n.label.setAttribute("class",(this.cfg.caption.font.family||{}).className||""),this.caption(),this._n.sideNote.map(function(t,e){var e=g.cfg[["sideNoteStart","sideNoteEnd"][e]]||{},n=e.font||{};return t.textContent=e.show&&e.text||"",t.style.fill=e.color,t.style.fontSize=n.size?n.size+""||"":void 0,t.setAttribute("class",(n.family||{}).className||"")}),d=(this.cfg.caption.position||0)%3,p=Math.floor((this.cfg.caption.position||0)/3),_=Math.max.apply(Math,[0].concat(_.map(function(t){return t._sizeAlt}))),m=this.cfg.tick.inner+this.cfg.label.padding+this.cfg.caption.padding+_,this.dir<2?(this._n.label.setAttribute("y",[-2,m][p]),this._n.layout.style.height=m+this._n.label.getBoundingClientRect().height+"px",y=this._n.layout.getBoundingClientRect(),this._n.sideNote.map(function(t,e){var n=g.cfg[["sideNoteStart","sideNoteEnd"][e]]||{},i=n.position||0;return t.setAttribute("x",[2,y.width-2][e]),t.setAttribute("y",[-2-n.padding,m+n.padding][i])})):(this._n.label.setAttribute("x",0),this._n.label.setAttribute("y",0),this._n.layout.style.width=m+this._n.label.getBoundingClientRect().width+"px",_=[2,(y=this._n.layout.getBoundingClientRect()).height/2,y.height-2][d],this._n.label.setAttribute("transform","translate("+[2,-m-2][p]+","+_+") rotate(90)"),this._n.root.setAttribute("transform","translate("+(y.width-1)+",0)"),this._n.sideNote.map(function(t,e){var n=g.cfg[["sideNoteStart","sideNoteEnd"][e]]||{},i=n.position||0,e=[2,y.height-2][e];return t.setAttribute("transform","translate("+[2+n.padding,-m-2-n.padding][i]+","+e+") rotate(90)")}));function z(t,e){return k(t,e,n)}}}))._grid=function(t){var e,n,i,r,o,s,a,u,l,h=[],c=this.cfg.grid||{},f=c.show?function(){try{return this.layout.getGroup(this._gridName)}catch(t){}}.call(this):null,d=f?function(){try{return this.layout.getBox(this._gridName)}catch(t){}}.call(this):null;if(f&&d&&d.width&&d.height){for(this._n.grid||(this._n.grid=p("g"),this._n.grid.setAttribute("data-type","grid"),this._n.grid.style.pointerEvents="none"),this._n.grid.parentNode!==f&&f.insertBefore(this._n.grid,f.firstChild),this._n.grid.textContent="",n=(e=[(f=this.layout.getBox(this.name)).x-d.x,f.y-d.y])[0],i=e[1],r=0,o=t.length;r<o;++r)a=t[r],s=p("line"),a=(e=this.dir<2?[n+a._c,0,n+a._c,d.height]:[0,i+a._c,d.width,i+a._c])[1],u=e[2],l=e[3],s.setAttribute("x1",e[0]),s.setAttribute("y1",a),s.setAttribute("x2",u),s.setAttribute("y2",l),m(s.style,{stroke:c.color||"currentColor",strokeWidth:null!=c.width?c.width:1,opacity:null!=c.opacity?c.opacity:.12}),c.dash&&(s.style.strokeDasharray=c.dash),h.push(this._n.grid.appendChild(s));return h}this._n.grid&&this._n.grid.parentNode&&this._n.grid.parentNode.removeChild(this._n.grid)},null!=z&&((z.utils||(z.utils={})).axis=t)}.call(this),function(){var t,e=function(t){var e,n=this;return this.root="string"==typeof(t=null==t?{}:t).root?document.querySelector(t.root):t.root,this.tip="string"==typeof t.node?this.root.querySelector(t.node):t.node,this.margin=null!=t.margin?t.margin:10,this.type="over"===t.type?"over":"move",this.accessor=t.accessor,this.range=t.range,this.zmgr=t.zmgr,this._z=0,this.enabled=!0,this.tip||(this.tip=document.createElement("div"),this.tip.innerHTML='<div ld="group" style="font-size:.75em"></div>\n<div ld="name" style="font-size:.85em"></div>\n<div ld="value" style="font-weight:bold;font-size:1.1em;line-height:1.2em"></div>\n<div ld="value-alt" style="font-size:0.9em;line-height:1em"></div>',this.root.appendChild(this.tip),(e=this.tip.style).padding=".4em .5em",e.background="#13171a",e.color="#fff",e.borderRadius="3px",e.boxShadow="0 2px 4px rgba(0,0,0,.3)",e.lineHeight="1.2em",e.fontSize=".9em",e.maxWidth="10em",e.wordBreak="break-all"),(e=this.tip.style).position="absolute",e.zIndex=1,e.top=0,e.left=0,e.pointerEvents="none",e.userSelect="none",e.opacity=0,e.transition="opacity .15s ease-in-out"+("over"===this.type?", transform .15s ease-in-out":""),this.view=new ldview({root:this.tip,text:t.view||{group:function(t){t=t.ctx;return t?t.group:""},name:function(t){t=t.ctx;return t?t.name:""},value:function(t){t=t.ctx;return t?t.value:""},"value-alt":function(t){t=t.ctx;return t?t.valueAlt:""}}}),this.hide=b(3e3,function(){if(this.tip.style.opacity=0,this.zmgr)return this.zmgr.remove(this._z)}),this._evthdr={},this.accessor&&(this.root.addEventListener("over"===this.type?"mouseover":"mousemove",this._evthdr.over=function(t){var e;if(t.target&&(e=n.accessor({evt:t})))return n.render({data:e,node:t.target,evt:t})}),this.root.addEventListener("mouseout",this._evthdr.out=function(){return n.hide().now()})),this};e.prototype=((t=Object.create(Object.prototype)).destroy=function(){if(this._evthdr.over&&this.root.removeEventListener("over"===this.type?"mouseover":"mousemove",this._evthdr.over),this._evthdr.out)return this.root.removeEventListener("mouseout",this._evthdr.out)},t.toggle=function(t){return null==t?this.enabled:this.enabled=t},t.render=function(t){var e,n,i,r,o,s,a;if(null==t&&(t={}),this.enabled)return this.view.ctx(t.data),this.view.render(),e=this.root.getBoundingClientRect(),i=null!=t.node?((i=t.node.getBoundingClientRect()).x=i.x-e.x,i.y=i.y-e.y,i):null!=t.box?t.box:{x:t.x,y:t.y,width:t.width,height:t.height},n=this.tip.getBoundingClientRect(),r=(t=[t.evt.clientX-e.x,t.evt.clientY-e.y])[0],a=t[1],s=this.margin,i=(t=[i.x+(null!=i.width?i.width/2:0),i.y+(null!=i.height?i.height/2:0)])[0],o=t[1],i=(t=[(t=[r-n.width/2,a-n.height/2])[0]+(i<r?1:-1)*(s+n.width/2),t[1]+(o<a?1:-1)*(s+n.height/2)])[0],r=t[1],i=(t=[((t=(i>(a=(o=this.range?this.range():e).x-e.x)?i:a)+n.width)<(s=o.width+o.x-e.x)?t:s)-n.width,((t=(r>(a=o.y-e.y)?r:a)+n.height)<(s=o.height+o.y-e.y)?t:s)-n.height])[0],r=t[1],(t=this.tip.style).transform="translate("+i+"px,"+r+"px)",t.opacity=1,t.zIndex=this._z=this.zmgr?this.zmgr.add(10):10,this.hide()},t),null!=z&&((z.utils||(z.utils={})).tip=e)}.call(this),function(){var d,p,m,r,y,_,S;d=1e-9,p=function(t){return+(+t).toPrecision(12)},m=function(t){return Math.abs(t-Math.round(t))<d},r=function(t,e){var t=t/(1<e?e:1);return 0<t?(t=(t=t/(e=Math.pow(10,Math.floor(Math.log10(t)))))>=Math.sqrt(50)?10:t>=Math.sqrt(10)?5:t>=Math.sqrt(2)?2:1,p(t*e)):1},y=function(t,e,n,i){i=0<i.count?i.count:Math.ceil(Math.log2(1<(i=t.length)?i:1))+1;return n===e&&m(e)||(n=e<n?n-e:Math.abs(e)||1,e=r(n,i),t.every(m)&&e<1)?1:e},_=function(t,e){t=(t-e.start)/e.width;return Math.abs(t-Math.round(t))<d&&(t=Math.round(t)),"right"===e.closed?Math.ceil(t)-1:Math.floor(t)},S={edges:function(t,e){var n,i,r,o,s,a,u,l,h,c,f;if(null==e&&(e={}),t=(t=null==t?[]:t).filter(function(t){return"number"==typeof t&&isFinite(t)}),n="right"===e.closed?"right":"left",i=isFinite(+e.anchor)?+e.anchor:0,r=e.max||500,!t.length)return{start:i,width:+e.width||1,anchor:i,closed:n,discrete:!1,n:0,edges:[]};for(a={width:s=r<((o=(r=[Math.min.apply(Math,t),Math.max.apply(Math,t)])[1])-(u=r[0]))/(s=0<+e.width?+e.width:y(t,u,o,e))?y(t,u,o,{count:e.count}):s,anchor:i,closed:n,discrete:e=m(s)&&m(i)&&t.every(m)},t=(u-i)/s,Math.abs(t-Math.round(t))<d&&(t=Math.round(t)),a.start=p(i+s*("left"==n?Math.floor(t):!e&&m(t)?t:Math.ceil(t)-1)),u=_(o,a),!e&&"left"==n&&0<u&&m((o-a.start)/s)&&(u-=1),a.n=1<(r=u+1)?r:1,l=[],h=0,c=a.n;h<=c;++h)f=h,l.push(p(a.start+s*f));return a.edges=l,a},index:function(t,e){var n;return"number"!=typeof t||!isFinite(t)||!e.n||(n=_(t,e),e.discrete||-1===(n=n===e.n&&"left"===e.closed&&Math.abs(t-e.edges[e.n])<d*e.width?e.n-1:n)&&"right"===e.closed&&Math.abs(t-e.edges[0])<d*e.width&&(n=0),n<0)||n>=e.n?-1:n},range:function(t,e){var t=[e.edges[t],e.edges[t+1]],n=t[0],t=t[1];return e.discrete?"right"===e.closed?[p(n+1),t]:[n,p(t-1)]:[n,t]},label:function(t,e,n){var i,r=(n=null==n?{}:n).format&&null!=z&&null!=(i=z.utils)&&i.format?z.utils.format.from(n.format):function(t){return p(t)+""},o=(i=S.range(t,e))[0],s=i[1];switch(n.label){case"start":return r(o);case"center":return r(p((e.edges[t]+e.edges[t+1])/2));default:return o===s?r(o):r(o)+"–"+r(s)}},count:function(t,e,n){var i,r,o,s,a,u,l,h,c,f,d,p,m;for(null==t&&(t=[]),i=n&&1<(r=(n[0]||[]).length)?r:1,s=[],a=0,u=e.n;a<u;++a)l=a,s.push(((t,e)=>{for(var n=[];0<e;(e>>=1)&&(t=t.concat(t)))1&e&&n.push.apply(n,t);return n})([0],i));for(o=s,a=0,h=t.length;a<h;++a)if(f=t[c=a],!((l=S.index(f,e))<0))if(n)for(d=0;d<i;++d)p=d,m=+(n[c]||[])[p],isFinite(m)&&(o[l][p]+=m);else o[l][0]+=1;return o},parse:function(t){for(var n,e,i,r,o,s,a,u,l,h,c,f,d,p,m,y=[(t=null==t?{}:t).value||"value",t.size||"size",t.name||"name"],_=y[0],g=y[1],v=y[2],b=t.config||(this.cfg||{}).bin||{},x=(x=this.binding[g])?Array.isArray(x)?x:[x]:[],w=(this.binding[_]||{}).key,k=[],A=0,M=x.length;A<M;++A)(i=x[e=A])&&i.key===w||k.push(e);for(r=(n=k).length,t=this._parseRows(this.raw||[]),y=this._frames&&null!=z&&null!=(y=z.scopes)&&y.frame?z.scopes.frame.all.call(this):t,o=S.edges(y.map(function(t){return t[_]}),b),y=function(t){return r?t.map(function(t){var e=[].concat(t[g]);return n.map(function(t){return e[t]})}):null},a=S.count((s=function(t){return t.map(function(t){return t[_]})})(t),o,y(t)),u=this._subset?S.count(s(this._parseRows(this._subset)),o,y(this._parseRows(this._subset))):null,l="shrink"===(((this.cfg||{}).common||{}).subset||{}).mode,k=[],A=0,c=o.n;A<c;++A)e=A,k.push(S.label(e,o,b));if(h=k,new Set(h).size!==h.length){for(k=[],A=0,c=o.n;A<c;++A)e=A,k.push(S.label(e,o,{label:b.label}));h=k}for(f=[],A=0,c=o.n;A<c;++A)e=A,!1===b.empty&&a[e].every(N)||((d={})[v]=h[e],d[g]=a[e],m=(p=[o.edges[e],o.edges[e+1]])[0],d.bin={x0:m,x1:p[1],index:e},u&&(d.subset={},d.subset[g]=u[e],l)&&(d[g]=u[e]),d._idx=f.length,d._raw=((p=((t,e)=>{var n,i={}.hasOwnProperty;for(n in e)i.call(e,n)&&(t[n]=e[n]);return t})({},d.bin)).count=a[e],p),f.push(d));return{data:f,info:o,series:r||1,keep:n};function N(t){return!t}},filter:function(t,e,n){var i=[n.edges[t],n.edges[e+1]],r=n.closed;return n.discrete||"right"===(r="left"===r&&e===n.n-1?"both":r)&&0===t&&(r="both"),{type:"range",value:[i[0],i[1]],closed:r}},select:function(t,e){var n,i,r,o,s,a;if(!t||"range"!==t.type||!Array.isArray(t.value)||!e.n)return null;for(n=(t=t.value)[0],i=t[1],r=[],o=0,s=e.n;o<s;++o)a=o,e.edges[a+1]>n&&e.edges[a]<i&&r.push(a);return(t=r).length?[t[0],t[t.length-1]]:null}},null!=z&&((z.utils||(z.utils={})).bin=S)}.call(this),z.utils.debounce=b,"undefined"!=typeof window&&null!==window&&(window.chart=z)}();
package/package.json CHANGED
@@ -1 +1 @@
1
- {"author":"zbryikt","name":"@plotdb/chart","license":"MIT","description":"plotdb charts","style":"index.min.css","browser":"index.min.js","main":"index.min.js","version":"3.13.0","homepage":"https://github.com/plotdb/chart","repository":{"type":"git","url":"https://github.com/plotdb/chart"},"engines":{"node":">=10.14.1","npm":">=6.4.1"},"scripts":{"start":"npx server -r web -o true -p 3457","verify":"node tools/verify/shape-test.js && node tools/verify/scale-test.js"},"devDependencies":{"@loadingio/bootstrap.ext":"^0.0.12","@loadingio/ldcolorpicker":"^3.0.6","@loadingio/ldquery":"^3.0.6","@loadingio/loading.css":"^3.2.1","@loadingio/vscroll":"^0.0.11","@plotdb/layout":"^0.0.12","@plotdb/pdmap-world":"^0.0.5","@plotdb/semver":"^0.0.3","@plotdb/sheet":"^0.7.0","@xlfont/choose":"^0.0.32","@xlfont/load":"^2.1.5","@zbryikt/template":"^2.4.3","@zbryikt/voronoijs":"^1.0.0","bootstrap":"^4.6.1","bootstrap.native":"^3.0.15","choosefont.js":"^0.0.1","d3":"^7.9.2","d3-force-boundary":"^0.0.2","fedep":"^1.9.0","jsdom":"^22.1.0","ldbutton":"^2.0.5","ldcover":"^3.6.1","ldfile":"^2.0.1","ldiconfont":"^0.2.8","ldloader":"^3.0.3","ldpalettepicker":"^4.1.4","ldslider":"^3.2.0","ldview":"^1.5.1","livescript":"^1.6.0","pdmaptw":"2.2.1","uglify-js":"^3.13.1","uglifycss":"^0.0.29","zmgr":"^2.2.3"},"frontendDependencies":{"root":"web/static/assets/lib","modules":["bootstrap","bootstrap.native","@loadingio/bootstrap.ext","@loadingio/ldquery","@loadingio/loading.css","@loadingio/ldcolorpicker","@loadingio/debounce.js","@loadingio/vscroll","@plotdb/pdmap-world","@plotdb/block","@plotdb/csscope","@plotdb/rescope","@plotdb/layout","@plotdb/sheet","@plotdb/konfig","@plotdb/semver","@xlfont/choose","@xlfont/load","@zbryikt/voronoijs","d3","d3-array","d3-axis","d3-brush","d3-color","d3-dispatch","d3-drag","d3-ease","d3-force","d3-force-boundary","d3-format","d3-hierarchy","d3-interpolate","d3-path","d3-quadtree","d3-random","d3-scale-chromatic","d3-selection","d3-shape","d3-timer","d3-transition","choosefont.js","pdmaptw","proxise","ldiconfont","ldloader","ldbutton","ldcover","ldcolor","ldfile","ldslider","wrap-svg-text","ldpalettepicker","zmgr","ldview"]},"dependencies":{"@loadingio/debounce.js":"^1.0.1","@plotdb/block":"^5.2.2","@plotdb/csscope":"^5.0.3","@plotdb/konfig":"^4.8.12","@plotdb/rescope":"^5.0.9","ldcolor":"^1.1.3","proxise":"^1.0.1","wrap-svg-text":"^0.0.7"}}
1
+ {"author":"zbryikt","name":"@plotdb/chart","license":"MIT","description":"plotdb charts","style":"index.min.css","browser":"index.min.js","main":"index.min.js","version":"3.15.0","homepage":"https://github.com/plotdb/chart","repository":{"type":"git","url":"https://github.com/plotdb/chart"},"engines":{"node":">=10.14.1","npm":">=6.4.1"},"scripts":{"start":"npx server -r web -o true -p 3457","verify":"node tools/verify/shape-test.js && node tools/verify/scale-test.js"},"devDependencies":{"@loadingio/bootstrap.ext":"^0.0.12","@loadingio/ldcolorpicker":"^3.0.6","@loadingio/ldquery":"^3.0.6","@loadingio/loading.css":"^3.2.1","@loadingio/vscroll":"^0.0.11","@plotdb/layout":"^0.0.12","@plotdb/pdmap-world":"^0.0.5","@plotdb/semver":"^0.0.3","@plotdb/sheet":"^0.7.0","@xlfont/choose":"^0.0.32","@xlfont/load":"^2.1.5","@zbryikt/template":"^2.4.3","@zbryikt/voronoijs":"^1.0.0","bootstrap":"^4.6.1","bootstrap.native":"^3.0.15","choosefont.js":"^0.0.1","d3":"^7.9.2","d3-force-boundary":"^0.0.2","fedep":"^1.9.0","jsdom":"^22.1.0","ldbutton":"^2.0.5","ldcover":"^3.6.1","ldfile":"^2.0.1","ldiconfont":"^0.2.8","ldloader":"^3.0.3","ldpalettepicker":"^4.1.4","ldslider":"^3.2.0","ldview":"^1.5.1","livescript":"^1.6.0","pdmaptw":"2.2.1","uglify-js":"^3.13.1","uglifycss":"^0.0.29","zmgr":"^2.2.3"},"frontendDependencies":{"root":"web/static/assets/lib","modules":["bootstrap","bootstrap.native","@loadingio/bootstrap.ext","@loadingio/ldquery","@loadingio/loading.css","@loadingio/ldcolorpicker","@loadingio/debounce.js","@loadingio/vscroll","@plotdb/pdmap-world","@plotdb/block","@plotdb/csscope","@plotdb/rescope","@plotdb/layout","@plotdb/sheet","@plotdb/konfig","@plotdb/semver","@xlfont/choose","@xlfont/load","@zbryikt/voronoijs","d3","d3-array","d3-axis","d3-brush","d3-color","d3-dispatch","d3-drag","d3-ease","d3-force","d3-force-boundary","d3-format","d3-hierarchy","d3-interpolate","d3-path","d3-quadtree","d3-random","d3-scale-chromatic","d3-selection","d3-shape","d3-timer","d3-transition","choosefont.js","pdmaptw","proxise","ldiconfont","ldloader","ldbutton","ldcover","ldcolor","ldfile","ldslider","wrap-svg-text","ldpalettepicker","zmgr","ldview"]},"dependencies":{"@loadingio/debounce.js":"^1.0.1","@plotdb/block":"^5.2.2","@plotdb/csscope":"^5.0.3","@plotdb/konfig":"^4.8.12","@plotdb/rescope":"^5.0.9","ldcolor":"^1.1.3","proxise":"^1.0.1","wrap-svg-text":"^0.0.7"}}